aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/assistant/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/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/Config.js')
-rw-r--r--desktop/modules/assistant/Config.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/desktop/modules/assistant/Config.js b/desktop/modules/assistant/Config.js
index 4c71b14..5c76e3b 100644
--- a/desktop/modules/assistant/Config.js
+++ b/desktop/modules/assistant/Config.js
@@ -142,8 +142,9 @@ function setEnv(text, key, val) {
return lines.join("\n");
}
-// [[cloud]] tables, the daemon's providers: name, url and key_cmd strings
-// and a one-line models array, as setClouds writes them.
+// [[cloud]] tables, the daemon's providers: name, url and key_cmd strings,
+// a one-line models array and an optional safe boolean, as setClouds
+// writes them.
const CLOUD = /^\s*\[\[cloud\]\]\s*(#.*)?$/;
// A one-line array of strings, ["a", "b"]; null for anything else.
@@ -175,14 +176,14 @@ function cloudBlocks(lines) {
return out;
}
-// [{name, url, key_cmd, models}] in file order, or null when a table holds
+// [{name, url, key_cmd, models, safe}] in file order, or null when a table holds
// a line this cannot read (a multi-line array, another key): the page then
// leaves them to be edited by hand rather than rewrite what it did not read.
function clouds(text) {
const lines = text.split("\n");
const out = [];
for (const b of cloudBlocks(lines)) {
- const c = { name: "", url: "", key_cmd: "", models: [] };
+ const c = { name: "", url: "", key_cmd: "", models: [], safe: false };
for (let i = b.start + 1; i < b.end; i++) {
if (/^\s*(#.*)?$/.test(lines[i])) continue;
const m = KEY.exec(lines[i]);
@@ -191,6 +192,8 @@ function clouds(text) {
const a = strings(m[4]);
if (a === null) return null;
c.models = a;
+ } else if (m[3] === "safe" && /^(true|false)\s*(#.*)?$/.test(m[4])) {
+ c.safe = m[4].startsWith("true");
} else if (["name", "url", "key_cmd"].includes(m[3]) && m[4].startsWith('"')) {
c[m[3]] = value(m[4]).v;
} else return null;
@@ -209,6 +212,7 @@ function setClouds(text, list) {
for (const c of list)
lines.push("", "[[cloud]]", "name = " + quote(c.name), "url = " + quote(c.url),
"key_cmd = " + quote(c.key_cmd),
+ ...(c.safe ? ["safe = true"] : []),
"models = [" + c.models.map(quote).join(", ") + "]");
return lines.join("\n") + "\n";
}