From e64b96dae06ea56c71fada1dc5a20e355267534c Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 2 Dec 2026 15:27:35 +0100 Subject: feat(assistant): safe cloud providers and three-way tool cloud Each [[cloud]] provider gets a Safe switch (safe = true). Each tool's cloud switch becomes Local / Safe / All cloud, writing no cloud line, cloud = "safe" or cloud = true; "All tools" buttons set every tool in the draft. A note warns when a tool is set to Safe but no provider is marked safe. Before, a safe key made the Cloud section unreadable and a provider list read as off, and switching it on widened it to true. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/assistant/test_config.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'desktop/modules/assistant/test_config.js') diff --git a/desktop/modules/assistant/test_config.js b/desktop/modules/assistant/test_config.js index f79f4e1..b3e9f0f 100644 --- a/desktop/modules/assistant/test_config.js +++ b/desktop/modules/assistant/test_config.js @@ -93,6 +93,7 @@ const withCloud = file + [ 'name = "hetzner"', 'url = "https://llm.example.org/v1" # a comment', 'key_cmd = "pass llm/x"', + "safe = true", 'models = ["a/b", "c:d"]', "", "[[cloud]]", @@ -103,16 +104,20 @@ const withCloud = file + [ "", ].join("\n"); assert.deepStrictEqual(C.clouds(withCloud), [ - { name: "hetzner", url: "https://llm.example.org/v1", key_cmd: "pass llm/x", models: ["a/b", "c:d"] }, - { name: "two", url: "u", key_cmd: "k", models: [] }]); + { name: "hetzner", url: "https://llm.example.org/v1", key_cmd: "pass llm/x", models: ["a/b", "c:d"], safe: true }, + { name: "two", url: "u", key_cmd: "k", models: [], safe: false }]); +assert.strictEqual(C.clouds(withCloud.replace("safe = true", 'safe = "yes"')), null); assert.deepStrictEqual(C.clouds(file), []); assert.deepStrictEqual(C.env(withCloud), C.env(file)); // [env] ends at the table // A table this cannot read in full is not offered for editing. assert.strictEqual(C.clouds(withCloud.replace('models = ["a/b", "c:d"]', 'models = [\n "a/b",\n]')), null); assert.strictEqual(C.clouds(withCloud.replace('name = "two"', 'name = "two"\nextra = 1')), null); // Rewritten at the end of the file; everything else stays. -const one = C.setClouds(withCloud, [{ name: "n", url: "u", key_cmd: 'pass "q"', models: ["m"] }]); -assert.deepStrictEqual(C.clouds(one), [{ name: "n", url: "u", key_cmd: 'pass "q"', models: ["m"] }]); +const one = C.setClouds(withCloud, [{ name: "n", url: "u", key_cmd: 'pass "q"', models: ["m"], safe: false }]); +assert.deepStrictEqual(C.clouds(one), [{ name: "n", url: "u", key_cmd: 'pass "q"', models: ["m"], safe: false }]); +assert.ok(!one.includes("safe"), one); // false is left out +const safe = C.setClouds(one, [{ name: "n", url: "u", key_cmd: "k", models: [], safe: true }]); +assert.strictEqual(C.clouds(safe)[0].safe, true); assert.deepStrictEqual(C.env(one), C.env(file)); assert.deepStrictEqual(C.scalars(one, KEYS), C.scalars(file, KEYS)); assert.ok(one.includes("# Cloud models.") && one.endsWith('models = ["m"]\n'), one); -- cgit v1.2.3