aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/assistant/test_config.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-12-02 15:27:35 +0100
committerDanilo M. <danix@danix.xyz>2026-12-02 15:27:35 +0100
commite64b96dae06ea56c71fada1dc5a20e355267534c (patch)
tree059150269ce622041ecbd26fa85ec7341adf3708 /desktop/modules/assistant/test_config.js
parent1445d06e704d28feba3ba45c21ff53cf80e131ec (diff)
downloadquickshell-e64b96dae06ea56c71fada1dc5a20e355267534c.tar.gz
quickshell-e64b96dae06ea56c71fada1dc5a20e355267534c.zip
feat(assistant): safe cloud providers and three-way tool cloudHEADmaster
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 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/assistant/test_config.js')
-rw-r--r--desktop/modules/assistant/test_config.js13
1 files changed, 9 insertions, 4 deletions
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);