${esc(ti
// 設定 rows all have a picture (as on the computer, src/icons.rs setting_icon): by the words in
// the name, first match wins; a name that matches none gets the sliders.
const SET_ICON = [[["上網"], "globe"], [["頁面"], "file-text"], [["合作", "同事"], "users"], [["電話", "簡訊"], "message"], [["Mac App"], "laptop"], [["管理 App"], "settings"], [["主題"], "moon"], [["風格", "強調色", "顏色", "外觀"], "palette"], [["頭像", "形狀"], "smile-plus"], [["語言", "時區"], "globe"], [["通知", "響一聲"], "bell"], [["記憶"], "brain"], [["資料夾", "文件", "檔案", "資料庫"], "folder"], [["金鑰", "Token", "密碼", "保險庫", "兩步"], "lock"], [["瀏覽器", "網址"], "globe"], [["更新", "版本", "重新啟動"], "refresh"], [["備份", "還原", "快照"], "history"], [["磁碟", "用量"], "hard-drive"], [["團隊", "成員", "分享"], "users"], [["帳號", "登入", "登出", "角色", "名稱"], "info"], [["手機", "裝置"], "smartphone"], [["語音", "聲音"], "audio-lines"], [["規則", "權限", "直接操作", "一律", "允許", "詢問", "審核", "隔離"], "shield"], [["連接器", "整合"], "plug"], [["管道"], "message"], [["技能"], "sparkles"], [["模型", "思考", "步驟"], "sparkles"], [["電腦", "螢幕", "Docker", "主機", "終端機"], "monitor"], [["例行"], "alarm-clock"], [["指示", "描述", "擅長", "不找"], "pen"], [["釘選"], "pin"], [["分區"], "folder"], [["主要"], "star"]];
+const SMART_SECS = [[0, "不自己回答"], [30, "30 秒後"], [60, "1 分鐘後"], [120, "2 分鐘後"], [300, "5 分鐘後"], [600, "10 分鐘後"]];
+const VOICE_KINDS = [["off", "關閉"], ["open_ai", "OpenAI 相容"], ["xai", "xAI"], ["eleven_labs", "ElevenLabs"]];
const setIcon = (k) => (SET_ICON.find(([ws]) => ws.some((w) => String(k || "").includes(w))) || [0, "settings"])[1];
const sitem = (o) => item(o.icon || o.noIcon ? o : {...o, icon: setIcon(o.k)});
async function loadAudit(id) {
@@ -3257,12 +3264,16 @@ async function renderBotset(id) {
h += ticks("會的技能", "skills", d.skills, "") .replace(/^(
會的技能)/, `$1
`);
h += ticks("可以用的電腦", "may_use", (d.may_use || []).length > 1 ? d.may_use : [], "它自己的電腦一定可以用。");
}
- h += `
頭像
${(st.shapes || []).map((s) => ``).join("")}
${(st.colors || []).map((c) => ``).join("")}
`;
+ h += `
頭像
${(st.shapes || []).map((s) => ``).join("")}
${(st.colors || []).map((c) => ``).join("")}${isOwner() ? `` : ""}
`;
// (As on the computer's Bot 設定: who carries out the planned steps, and how long it thinks.)
const EFFORTS = [["", "自動(模型自己決定)"], ["low", "快速(想得少,回得快)"], ["medium", "平衡"], ["high", "深入(想得久,較慢)"]];
const stepShown = !d.step_model ? "自動" : d.step_model === "off" ? "不分開" : d.step_model;
+ const fbs = d.fallbacks || [];
+ const extra2 = isOwner() ? sitem({icon: "refresh", k: "備用模型", v: fbs.length ? fbs.map((f) => f.model).join("、") : "主模型失敗時改用(還沒有)", tap: 1, data: 'data-e="fallbacks"'}) + sitem({icon: "folder", k: "起始資料夾", v: d.workdir || "", tap: 1, data: 'data-e="workdir"'}) : "";
const extra = isOwner() ? sitem({icon: "zap", k: "執行步驟用的模型", v: "想計畫和確認用上面的模型;照計畫做的步驟交給這個比較快的", r: stepShown, tap: 1, data: 'data-e="step"'}) + sitem({icon: "lightbulb", k: "思考模式", r: (EFFORTS.find((e) => e[0] === (d.thinking || "")) || EFFORTS[0])[1].replace(/(.*)/, ""), tap: 1, data: 'data-e="think"'}) : "";
- h += group("AI 與電腦", sitem({icon: "sparkles", k: "模型", v: b.via || b.model, r: b.runs || "", tap: 1, data: 'data-e="model"'}) + extra + sitem({icon: "monitor", k: "做事的電腦", r: b.computer || "", tap: 1, data: 'data-e="comp"'}) + sitem({icon: "terminal", k: "電腦操作", v: S.settings && S.settings.direct_mode ? "直接操作開著:照樣可以用電腦(關掉直接操作才照這裡)" : "關掉時,用電腦前會先問你", sw: d.tools_enabled !== false, swdata: 'data-sw="tools"', disabled: !isOwner()}) + sitem({icon: "brain", k: "模型可讀長度", r: (CTX.find((c) => c[0] === d.context_tokens) || [0, Math.round((d.context_tokens || 0) / 1000) + "K"])[1], tap: 1, data: 'data-e="ctx"'}));
+ h += group("AI 與電腦", sitem({icon: "sparkles", k: "模型", v: b.via || b.model, r: b.runs || "", tap: 1, data: 'data-e="model"'}) + extra + extra2 + sitem({icon: "monitor", k: "做事的電腦", r: b.computer || "", tap: 1, data: 'data-e="comp"'}) + sitem({icon: "terminal", k: "電腦操作", v: S.settings && S.settings.direct_mode ? "直接操作開著:照樣可以用電腦(關掉直接操作才照這裡)" : "關掉時,用電腦前會先問你", sw: d.tools_enabled !== false, swdata: 'data-sw="tools"', disabled: !isOwner()}) + sitem({icon: "brain", k: "模型可讀長度", r: (CTX.find((c) => c[0] === d.context_tokens) || [0, Math.round((d.context_tokens || 0) / 1000) + "K"])[1], tap: 1, data: 'data-e="ctx"'}));
+ // 語音聊天 (as the computer's right panel): read every answer aloud, the voice, speed, language.
+ if (isOwner()) h += group("語音", sitem({icon: "audio-lines", k: "朗讀每個回答", v: "回答好了就唸出來(要先在 設定 › 語音 選「說」的服務)", sw: !!d.speak_replies, swdata: 'data-sw="speak_replies"'}) + sitem({icon: "smile-plus", k: "聲音", r: d.voice || "跟著 設定 › 語音", tap: 1, data: 'data-e="voice"'}) + sitem({icon: "zap", k: "速度", r: (d.voice_rate || 1) + " 倍", tap: 1, data: 'data-e="rate"'}) + sitem({icon: "globe", k: "語言", r: ({"": "自動", "zh-TW": "中文", en: "英文", ja: "日文"})[d.voice_lang || ""] || d.voice_lang, tap: 1, data: 'data-e="vlang"'}));
if (isOwner()) h += group("已設定「一律允許」", (d.allow_rules || []).map((r) => `
`).join("") || `
還沒有。在核准時選「一律允許」就會記在這裡。
`);
h += group("整理", sitem({icon: "pin", k: "釘選", sw: !!d.pinned, swdata: 'data-sw="pinned"'}) + sitem({icon: "star", k: "主要 Bot", v: d.primary ? "這是主要 Bot" : "", sw: !!d.primary, swdata: 'data-sw="primary"', disabled: !!d.primary}) + sitem({icon: "folder", k: "分區", r: d.folder || "未分區", tap: 1, data: 'data-e="folder"'}));
if ((d.demos || []).length) h += group("示範教學", d.demos.map((x) => sitem({icon: "eye", k: x.name, v: `${x.steps} 個步驟 · ${x.created}`})).join("") + `
示範要在那台電腦上錄;Bot 在對話裡會照著做。
`);
@@ -3274,6 +3285,13 @@ async function renderBotset(id) {
const refresh = () => { delete S.detail[id]; setTimeout(() => cur().v === "botset" && renderBotset(id), 300); };
el.querySelectorAll("[data-shape]").forEach((x) => x.onclick = async () => { if (await act("bot", {bot: id, key: "shape", value: x.dataset.shape}, false)) refresh(); });
el.querySelectorAll("[data-color]").forEach((x) => x.onclick = async () => { if (await act("bot", {bot: id, key: "color", value: x.dataset.color}, false)) refresh(); });
+ // 自訂顏色: the phone's own colour picker; the bot wears #rrggbb.
+ el.querySelectorAll("[data-color-own]").forEach((x) => x.onclick = () => {
+ const pick = document.createElement("input"); pick.type = "color"; pick.value = /^#[0-9a-f]{6}$/i.test(d.color || "") ? d.color : "#c06244";
+ pick.style.cssText = "position:fixed;opacity:0;pointer-events:none"; document.body.appendChild(pick);
+ pick.onchange = async () => { pick.remove(); if (await act("bot", {bot: id, key: "color", value: pick.value}, "已換顏色")) refresh(); };
+ pick.click();
+ });
el.querySelectorAll("[data-rule]").forEach((x) => x.onclick = async () => { if (await act("bot", {bot: id, key: "allow_remove", value: x.dataset.rule}, "已移除")) refresh(); });
// 技能:全選/全不選 at once (the brain's list as it is now, all on or all off).
el.querySelectorAll("[data-allsk]").forEach((x) => x.onclick = () => oneAtATime(async () => {
@@ -3309,6 +3327,19 @@ async function renderBotset(id) {
else if (k === "not_for") { const n = await ask("不找它做的事", d.not_for || "", "例如:不寫程式、不碰帳務", true); if (n != null && n !== (d.not_for || "") && await act("bot", {bot: id, key: "not_for", value: n}, "已更新")) refresh(); }
else if (k === "model") modelSheet(b);
else if (k === "comp") pickComputer(b, d);
+ else if (k === "fallbacks") {
+ const save = async (list, ok) => { if (await act("bot", {bot: id, key: "fallbacks", value: list.map((f) => ({provider: f.provider, model: f.model}))}, ok)) refresh(); };
+ const add = () => {
+ const items = [];
+ for (const p of S.models || []) { items.push({group: p.label}); for (const m of p.models || []) items.push({label: m, on: () => save([...fbs, {provider: p.provider, model: m}], "已加入備用模型")}); }
+ sheet("加一個備用模型", items);
+ };
+ sheet("備用模型(照順序試)", [{group: "主模型失敗(額度用完、連不上)時照順序改用"}, ...fbs.map((f, i) => ({icon: "x", label: `${i + 1}. ${f.label} · ${f.model}`, x: "移除", on: () => save(fbs.filter((_, j) => j !== i), "已移除")})), ...(fbs.length < 8 ? [{icon: "plus", label: "加一個備用模型…", on: () => setTimeout(add, 60)}] : [])]);
+ }
+ else if (k === "voice") { const v = await ask("聲音(空白=跟著 設定 › 語音)", d.voice || ""); if (v != null && await act("bot", {bot: id, key: "voice", value: v}, "已更新")) refresh(); }
+ else if (k === "rate") sheet("朗讀速度", [0.8, 1, 1.2, 1.5, 2].map((r) => ({label: r + " 倍", check: (d.voice_rate || 1) === r, on: async () => { if (await act("bot", {bot: id, key: "voice_rate", value: r}, "已更新")) refresh(); }})));
+ else if (k === "vlang") sheet("朗讀的語言", [["", "自動"], ["zh-TW", "中文"], ["en", "英文"], ["ja", "日文"]].map(([v, n]) => ({label: n, check: (d.voice_lang || "") === v, on: async () => { if (await act("bot", {bot: id, key: "voice_lang", value: v}, "已更新")) refresh(); }})));
+ else if (k === "workdir") { const w = await ask("起始資料夾(它的檔案和指令從這裡開始)", d.workdir || ""); if (w && w !== d.workdir && await act("bot", {bot: id, key: "workdir", value: w}, "已更新起始資料夾")) refresh(); }
else if (k === "think") sheet("思考模式", [{group: "想得越久越仔細,也越慢、越花額度"}].concat(EFFORTS.map(([v, l]) => ({label: l, check: v === (d.thinking || ""), on: async () => { if (await act("bot", {bot: id, key: "thinking", value: v}, "已更新")) refresh(); }}))));
else if (k === "step") {
const models = ((S.models || []).find((p) => p.provider === b.provider) || {}).models || [];
@@ -3337,7 +3368,7 @@ async function loadSettings() {
} catch (e) { S.settingsOld = true; toast(e.message); }
return S.settings;
}
-const SETTINGS_PAGES = ["computers", "settings", "general", "models", "perms", "integrations", "vault", "account", "updates"];
+const SETTINGS_PAGES = ["computers", "settings", "general", "models", "perms", "integrations", "vault", "voice", "account", "updates"];
/** Something changed on the computer (the state's version moved): the settings read before are
* old — the page showing them is read again now, any other the next time it opens. (They were
* read once: after /always-approve filled the 一律詢問 rules, 權限 still said 還沒有規則.) */
@@ -3352,7 +3383,7 @@ async function settingsChanged() {
}
let listTimer = null;
function stopListTimer() { clearInterval(listTimer); listTimer = null; }
-const TITLES = {tasks: "任務", files: "所有檔案", schedule: "日程", workflows: "工作流", routines: "例行任務", pages: "頁面", computers: "電腦", settings: "設定", general: "一般", me: "個人資料與用量", models: "模型", perms: "權限", integrations: "整合", vault: "保險庫", account: "手機與帳號", updates: "更新"};
+const TITLES = {tasks: "任務", files: "所有檔案", schedule: "日程", workflows: "工作流", routines: "例行任務", pages: "頁面", computers: "電腦", settings: "設定", general: "一般", me: "個人資料與用量", models: "模型", perms: "權限", integrations: "整合", vault: "保險庫", voice: "語音", account: "手機與帳號", updates: "更新"};
async function renderList(arg) {
const kind = arg.kind;
$("list-title").textContent = TITLES[kind] || "";
@@ -3679,7 +3710,7 @@ function drawSettings(kind, quiet) {
if (kind === "settings") {
h += group("", [
["general", "settings", "一般", "外觀、時區、通知總開關"], ...(isOwner() ? [["me", "activity", "個人資料與用量", ""]] : []), ["models", "sparkles", "模型", "可以用的 AI 服務"], ["perms", "shield", "權限", st.direct_mode ? "直接操作:開" : "Bot 做事前的規則"],
- ["integrations", "plug", "整合", "訊息管道、連接器、技能"], ["computers", "monitor", "電腦", "Bot 的電腦和你帳號裡的電腦"], ["vault", "lock", "保險庫", "密碼和卡號"],
+ ["integrations", "plug", "整合", "訊息管道、連接器、技能"], ["computers", "monitor", "電腦", "Bot 的電腦和你帳號裡的電腦"], ["vault", "lock", "保險庫", "密碼和卡號"], ["voice", "audio-lines", "語音", "聽和說的服務"],
["account", "smartphone", "手機與帳號", "登入的手機、這支手機的通知"], ["updates", "download", "更新", st.version || ""],
].map(([k, i, n, v]) => sitem({icon: i, k: n, r: k === "updates" ? v : "", tap: 1, data: `data-go="${k}"`})).join(""));
}
@@ -3698,14 +3729,19 @@ function drawSettings(kind, quiet) {
}
if (isOwner()) h += group("電腦的外觀", sitem({icon: "moon", k: "主題", r: ({system: "跟隨系統", light: "淺色", dark: "深色"})[st.theme] || "跟隨系統", tap: 1, data: 'data-s="theme"'}) + sitem({icon: "message", k: "聊天的顏色", r: ACC[st.accent || "quiet"] || "", tap: 1, data: 'data-s="accent"'}));
h += group("", sitem({icon: "globe", k: "時區", r: st.timezone || "", tap: 1, data: 'data-s="tz"'}) + sitem({icon: "bell", k: "通知總開關", v: "Bot 做完或等你時通知,電腦和手機都算;關掉就都不通知", sw: !!st.notify, swdata: 'data-sset="notify"', disabled: !isOwner()}));
+ if (isOwner()) h += group("記憶與文件", sitem({icon: "brain", k: "用意思找記憶", v: "在這台電腦上算,不會上傳", r: ({local: "本機模型", ollama: "Ollama", off: "關閉"})[st.embed] || "本機模型", tap: 1, data: 'data-s="embed"'})
+ + (st.doc_folders || []).map((f) => `
`).join("")
+ + sitem({icon: "plus", k: (st.doc_folders || []).length ? "再加一個 Bot 可以翻的資料夾" : "Bot 可以翻的資料夾", v: "Bot 在這些資料夾的文字檔裡找答案(在那台電腦上的路徑)", tap: 1, data: 'data-s="docadd"', chev: false}));
h += group("這支手機", sitem({icon: "smartphone", k: "外觀", r: (THEMES.find((t) => t[0] === phoneTheme()) || THEMES[0])[1], tap: 1, data: 'data-s="phonetheme"'}));
}
if (kind === "models") {
- h += group("AI 服務", (st.providers || []).map((p, i) => sitem({icon: "sparkles", k: p.label, v: [p.runs, p.ready && p.default_model ? p.default_model : ""].filter(Boolean).join(" · "), r: p.ready ? "可以用" : "未設定", tap: isOwner() ? 1 : 0, data: `data-prov="${i}"`})).join(""));
+ h += group("AI 服務", (st.providers || []).map((p, i) => sitem({icon: "sparkles", k: p.label, v: [p.runs, p.ready && p.default_model ? p.default_model : "", p.status || ""].filter(Boolean).join(" · "), r: p.ready ? "可以用" : "未設定", tap: isOwner() ? 1 : 0, data: `data-prov="${i}"`})).join(""));
h += `
金鑰只存在這台 AnyBot,手機寫得進去、看不到。
`;
}
if (kind === "perms") {
- h += group("", sitem({icon: "zap", k: "直接操作", v: st.direct_locked ? "已由管理員關閉" : "Bot 直接做事,只有危險操作和「一律詢問」規則會先問你", sw: !!st.direct_mode, swdata: 'data-sset="direct_mode"', disabled: !isOwner() || st.direct_locked}) + sitem({icon: "shield", k: "自動審核", v: "照下面的規則自動允許或先問你", sw: !!st.auto_review, swdata: 'data-sset="auto_review"', disabled: !isOwner()}));
+ h += group("", sitem({icon: "zap", k: "直接操作", v: st.direct_locked ? "已由管理員關閉" : "Bot 直接做事,只有危險操作和「一律詢問」規則會先問你", sw: !!st.direct_mode, swdata: 'data-sset="direct_mode"', disabled: !isOwner() || st.direct_locked}) + sitem({icon: "shield", k: "自動審核", v: "照下面的規則自動允許或先問你", sw: !!st.auto_review, swdata: 'data-sset="auto_review"', disabled: !isOwner()})
+ + sitem({icon: "zap", k: "一律放行", v: "你自己的對話裡,要允許的都自動答應(和聊天打 /always-approve 一樣);危險操作和「一律詢問」照樣擋", sw: !!st.always_approve, swdata: 'data-sset="always_approve"', disabled: !isOwner() || st.direct_locked})
+ + sitem({icon: "clock", k: "智慧模式:卡片沒人回答時", r: SMART_SECS.find((x) => x[0] === (st.smart_timeout_secs || 0))?.[1] || (st.smart_timeout_secs + " 秒後"), tap: isOwner() ? 1 : 0, data: 'data-s="smartsecs"'}));
h += rulesGroup("一律詢問(優先)", st.ask_rules, "ask") + rulesGroup("無需詢問直接允許", st.allow_rules, "allow");
// 直接操作 always asks about these three too (not written into the rules: turning it off leaves nothing behind).
if (st.direct_mode) h += group("直接操作開著時也一定先問", ["刪除檔案或資料夾", "付款、購買或轉帳", "用我的帳號發文、留言,或傳訊息給別人"].map((r) => sitem({icon: "hand", k: r})).join(""));
@@ -3726,6 +3762,23 @@ function drawSettings(kind, quiet) {
h += group("技能", (skRows || `
還沒有技能。可從下方「技能市集」一鍵加入,或在聊天裡請 Bot 幫你建立。
`) + skActions);
}
if (kind === "computers") h += computersHtml(st);
+ // 語音: who hears you (聽) and who reads answers aloud (說) — on the brain, for every device.
+ if (kind === "voice") {
+ const V = st.voice || {};
+ const engine = (which, title, about) => {
+ const e = V[which] || {}, kindName = (VOICE_KINDS.find((k) => k[0] === e.kind) || VOICE_KINDS[0])[1];
+ let rows = sitem({icon: which === "listen" ? "mic" : "audio-lines", k: title, v: about, r: e.kind === "off" || !e.kind ? "關閉" : kindName + (e.ready ? "・可以用" : "・還不能用"), tap: isOwner() ? 1 : 0, data: `data-vk="${which}"`});
+ if (e.kind && e.kind !== "off") {
+ if (e.kind === "open_ai") rows += sitem({icon: "globe", k: "網址", r: e.base_url || "OpenAI", tap: 1, data: `data-vf="${which}:base_url"`});
+ rows += sitem({icon: "key", k: "金鑰", r: e.has_key ? "已設定" : "用「模型」裡同一家的", tap: 1, data: `data-vf="${which}:api_key"`});
+ rows += sitem({icon: "sparkles", k: "模型", r: e.model || "預設", tap: 1, data: `data-vf="${which}:model"`});
+ if (which === "speak") rows += sitem({icon: "smile-plus", k: "聲音", r: e.voice || "預設", tap: 1, data: `data-vf="speak:voice"`}) + (e.ready ? sitem({icon: "play", k: "試聽", tap: 1, data: 'data-vtest="1"', chev: false}) : "");
+ }
+ return group("", rows);
+ };
+ h += engine("listen", "聽(語音轉文字)", "語音輸入、語音聊天、會議錄音都用它") + engine("speak", "說(朗讀)", "把回答唸出來");
+ h += `
每台電腦和手機的錄音、朗讀都交給大腦,用這裡選的服務;金鑰只存在大腦,手機看不到。沒選服務時,麥克風和朗讀不會出現。
`;
+ }
if (kind === "vault") h += `
${ic("lock", 28)}
保險庫裡的密碼、卡號和聯絡資訊,只在電腦上的 AnyBot 管理。
Bot 用到時由 AnyBot 直接填進網頁,不會交給模型,也不會經過手機。
`;
if (kind === "account") {
h += group("這台 AnyBot", sitem({icon: "monitor", k: "名稱", r: st.host || S.hostName}) + sitem({icon: "info", k: "你的角色", r: isOwner() ? "擁有者" : "管理員"}));
@@ -3741,6 +3794,7 @@ function drawSettings(kind, quiet) {
}
if (kind === "updates") {
h += group("", sitem({icon: "info", k: "版本", v: st.built ? `${stamp(st.built)} 建置` : "", r: st.version || ""}) + (st.newer ? sitem({icon: "download", k: "有新版", v: "電腦上的 AnyBot 已經下載新版,重新啟動就會換上"}) : sitem({icon: "circle-check", k: "已是最新版"})));
+ if (isOwner()) h += group("自動", sitem({icon: "refresh", k: "你不在時自動更新", v: "有新版時,等你離開電腦再換上", sw: st.auto_update !== false, swdata: 'data-sset="auto_update"'}) + sitem({icon: "target", k: "園丁報告", v: "每天、每週整理 Bot 卡住和做錯的地方,給你看要不要改", sw: st.garden_reports !== false, swdata: 'data-sset="garden_reports"'}));
h += `
Bot 的電腦的更新在「電腦」裡。
`;
h += group("這支手機", sitem({icon: "smartphone", k: "畫面", v: fitWords(), tap: 1, data: 'data-ruler="1"'}));
h += `
畫面看起來被切到、上面糊糊的、下面空一塊時,按「畫面」打開量尺截圖給我們。
`;
@@ -3837,6 +3891,15 @@ function wireSettings(kind, st) {
if (!await act("setting", {key: k, value: x.checked})) x.checked = !x.checked; else again();
});
on("[data-addrule]", "onclick", async (x) => { const t = await ask(x.dataset.addrule === "ask" ? "一律詢問的規則" : "無需詢問的規則", "", x.dataset.addrule === "ask" ? "例如:發文、寄信、付款前先問我" : "例如:讀取網頁和檔案"); if (t && await act("setting", {key: "rule_add", list: x.dataset.addrule, value: t})) again(); });
+ on("[data-vk]", "onclick", (x) => { const w = x.dataset.vk, cur = ((st.voice || {})[w] || {}).kind || "off"; sheet(w === "listen" ? "聽(語音轉文字)" : "說(朗讀)", VOICE_KINDS.map(([k, n]) => ({label: n, check: cur === k, on: async () => { if (await act("voice", {which: w, kind: k})) again(); }}))); });
+ on("[data-vf]", "onclick", async (x) => {
+ const [w, f] = x.dataset.vf.split(":"), e = (st.voice || {})[w] || {};
+ const label = {base_url: "網址(以 /v1 結尾;空白=OpenAI 自己的)", api_key: "金鑰(空白=用「模型」裡同一家的)", model: "模型(空白=服務預設的)", voice: "聲音(空白=服務預設的)"}[f];
+ const val = await ask(label, f === "api_key" ? "" : e[f] || "");
+ if (val != null && await act("voice", {which: w, [f]: val}, "已更新")) again();
+ });
+ on("[data-vtest]", "onclick", () => speakText("你好,這是朗讀的聲音。"));
+ on("[data-docrm]", "onclick", async (x) => { if (await act("setting", {key: "doc_folder_remove", value: x.dataset.docrm}, "已移除")) again(); });
on("[data-rmrule]", "onclick", async (x) => { if (await act("setting", {key: "rule_remove", list: x.dataset.rmrule, value: x.dataset.r}, "已移除")) again(); });
on("[data-ch]", "onchange", async (x) => { if (!await act("channel", {id: +x.dataset.ch, enabled: x.checked})) x.checked = !x.checked; else again(); });
on("[data-chrm]", "onclick", async (x) => { if (await confirmSheet("移除這個管道?", "", "移除") && await act("channel", {id: +x.dataset.chrm, remove: true}, "已移除")) again(); });
@@ -3862,6 +3925,10 @@ function wireSettings(kind, st) {
if (r) { toast(r.text || (r.ok ? "已登入" : "沒有登入成功")); again(); }
}}, ...(p.ready ? [{icon: "trash", label: "登出 ChatGPT", danger: true, on: async () => { if (await confirmSheet("登出 ChatGPT?", "用 ChatGPT 方案的 Bot 會沒辦法回答,直到再登入。", "登出") && await act("chatgpt", {action: "logout"})) again(); }}] : [])] : []),
{icon: "sparkles", label: "新 Bot 預設模型…", x: p.default_model || "", on: async () => { const m = await ask("新 Bot 預設用的模型", p.default_model || ""); if (m != null && await act("provider", {provider: p.key, default_model: m}, "已更新")) again(); }},
+ // 服務網址, 測試連線並取得模型清單, and a local model's 看圖小幫手 — as on the computer.
+ ...(p.account ? [] : [{icon: "globe", label: "服務網址…", x: p.base_url ? "自訂" : "預設", on: async () => { const u = await ask("服務網址(空白=預設)", p.base_url || "", p.default_url || ""); if (u != null && await act("provider", {provider: p.key, base_url: u}, "已更新網址")) again(); }}]),
+ {icon: "refresh", label: p.testing ? "正在測試連線…" : "測試連線並取得模型清單", x: p.status ? p.status.slice(0, 18) : p.known ? `記住 ${p.known} 個` : "", on: async () => { if (await act("provider", {provider: p.key, fetch: true})) { setTimeout(again, 2500); setTimeout(again, 8000); } }},
+ ...(p.local ? [{icon: "eye", label: p.cloud_eyes ? "看不到圖時請雲端模型看:開" : "看不到圖時請雲端模型看:關", x: "", on: async () => { if (await act("provider", {provider: p.key, cloud_eyes: !p.cloud_eyes}, p.cloud_eyes ? "圖片不會離開了" : "看不到的圖會給雲端模型看")) again(); }}] : []),
...(p.ready && p.needs_key ? [{icon: "trash", label: "清除金鑰", danger: true, on: async () => { if (await confirmSheet(`清除 ${p.label} 的金鑰?`, "用這個服務的 Bot 會沒辦法回答,直到再設定一把。", "清除") && await act("provider", {provider: p.key, key: ""}, "已清除")) again(); }}] : []),
]);
});
@@ -3932,7 +3999,10 @@ function wireSettings(kind, st) {
});
on("[data-s]", "onclick", async (x) => {
const k = x.dataset.s;
- if (k === "style") { if (await app("update_settings", {style: x.dataset.style}, 0, false)) { toast("換好了"); again(); } }
+ if (k === "smartsecs") sheet("智慧模式:卡片沒人回答時", SMART_SECS.map(([v, n]) => ({label: n, check: (st.smart_timeout_secs || 0) === v, on: async () => { if (await act("setting", {key: "smart_timeout_secs", value: v})) again(); }})));
+ else if (k === "embed") sheet("用意思找記憶", [["local", "本機模型(在這台電腦上算)"], ["ollama", "Ollama"], ["off", "關閉"]].map(([v, n]) => ({label: n, check: (st.embed || "local") === v, on: async () => { if (await act("setting", {key: "embed", value: v})) again(); }})));
+ else if (k === "docadd") { const f = await ask("資料夾路徑(那台電腦上的)", "", "例如:~/Documents/筆記"); if (f && await act("setting", {key: "doc_folder_add", value: f}, "已加入")) again(); }
+ else if (k === "style") { if (await app("update_settings", {style: x.dataset.style}, 0, false)) { toast("換好了"); again(); } }
else if (k === "theme") sheet("主題", [["system", "跟隨系統"], ["light", "淺色"], ["dark", "深色"]].map(([v, n]) => ({label: n, check: st.theme === v, on: async () => { if (await app("update_settings", {theme: v})) again(); }})));
else if (k === "accent") sheet("聊天的顏色", [["quiet", "安靜(淡灰泡泡)"], ["bot_color", "跟著 Bot"], ["black", "只用黑色"]].map(([v, n]) => ({label: n, check: (st.accent || "quiet") === v, on: async () => { if (await app("update_settings", {accent: v})) again(); }})));
else if (k === "tz") {
diff --git a/src/app/remote_ui.rs b/src/app/remote_ui.rs
index 3045892..f4df644 100644
--- a/src/app/remote_ui.rs
+++ b/src/app/remote_ui.rs
@@ -319,7 +319,7 @@ impl App {
self.state.remote.host_name.hash(&mut h);
self.state.timezone.hash(&mut h);
self.scr.cfg_hash.hash(&mut h);
- (&self.state.folders, self.state.loose_index, &self.state.pin_order, self.state.accent as u8, self.newer_build.is_some()).hash(&mut h);
+ (&self.state.folders, self.state.loose_index, &self.state.pin_order, self.state.accent as u8, self.newer_build.is_some(), self.state.always_approve).hash(&mut h);
// 外觀: the phone wears the desktop's theme and colours.
(self.state.theme as u8, &self.state.shell_accent, &self.state.shell_template, self.state.shell_tone.to_bits(), self.state.shell_contrast.to_bits()).hash(&mut h);
for b in &self.state.bots {
@@ -419,6 +419,7 @@ impl App {
accent,
pin_order: self.pinned_ids(),
newer: self.newer_build.is_some(),
+ always: self.always_on(),
sections: self.section_order(),
theme: match self.state.theme {
crate::model::Theme::Light => "light",
@@ -1807,7 +1808,23 @@ impl App {
"unread" => x.unread = v.as_bool().unwrap_or(true),
"tools" => x.tools_enabled = v.as_bool().unwrap_or(true),
"shape" if v.as_str().map(|t| crate::avatar::SHAPES.contains(&t)).unwrap_or(false) => x.shape = v.as_str().unwrap_or("").to_string(),
- "color" if v.as_str().map(|t| crate::avatar::COLORS.iter().any(|c| c.0 == t)).unwrap_or(false) => x.color = v.as_str().unwrap_or("").to_string(),
+ // (A preset, or a colour of one's own as #rrggbb, as on the computer.)
+ "color" if v.as_str().map(|t| crate::avatar::COLORS.iter().any(|c| c.0 == t) || (t.len() == 7 && t.starts_with('#') && t[1..].chars().all(|c| c.is_ascii_hexdigit()))).unwrap_or(false) => x.color = v.as_str().unwrap_or("").to_lowercase(),
+ // 備用模型: tried in order when the main one fails (at most MAX_FALLBACKS).
+ "fallbacks" if v.is_array() => {
+ x.fallbacks = v.as_array().unwrap().iter().filter_map(|f| {
+ let provider = crate::providers::ALL_PROVIDERS.iter().copied().find(|k| serde_json::to_value(k).ok().as_ref() == Some(&f["provider"]))?;
+ let model = f["model"].as_str()?.trim().to_string();
+ (!model.is_empty()).then_some(crate::model::Fallback { provider, model })
+ }).take(crate::model::MAX_FALLBACKS).collect();
+ }
+ // 語音聊天 for this bot: read every answer aloud, its voice, speed and language.
+ "speak_replies" => x.speak_replies = v.as_bool().unwrap_or(false),
+ "voice" if v.is_string() => x.voice = v.as_str().unwrap_or("").trim().to_string(),
+ "voice_rate" if v.is_number() => x.voice_rate = (v.as_f64().unwrap_or(1.0) as f32).clamp(0.5, 2.0),
+ "voice_lang" if v.is_string() => x.voice_lang = v.as_str().unwrap_or("").trim().to_string(),
+ // 起始資料夾: where its files and commands start.
+ "workdir" if v.as_str().is_some_and(|w| !w.trim().is_empty()) => x.workdir = v.as_str().unwrap_or("").trim().to_string(),
"context" => x.context_tokens = v.as_u64().unwrap_or(x.context_tokens).clamp(4_000, 2_000_000),
"thinking" if v.as_str().is_some_and(|t| ["", "low", "medium", "high"].contains(&t)) => x.thinking = v.as_str().unwrap_or("").to_string(),
"step_model" if v.is_string() => x.step_model = v.as_str().unwrap_or("").trim().to_string(),
@@ -1916,6 +1933,41 @@ impl App {
}
"auto_review" => self.state.auto_review = v.as_bool().unwrap_or(false),
"notify" => self.state.notify = v.as_bool().unwrap_or(true),
+ // 一律放行 as the chat's /always-approve does it (direct mode with it, and back).
+ "always_approve" => {
+ let on = v.as_bool().unwrap_or(false);
+ if on && !(self.managed.direct.allows() && self.managed.local.allows()) {
+ return fail(crate::always::LOCKED_NOTE);
+ }
+ let bot = if self.state.bot(self.state.primary_bot).is_some() { self.state.primary_bot } else { self.state.selected };
+ self.always_command(ctx, bot, if on { crate::always::Command::On } else { crate::always::Command::Off });
+ return done(if on { "一律放行:開" } else { "一律放行:關" });
+ }
+ "smart_timeout_secs" => self.state.smart_timeout_secs = v.as_u64().unwrap_or(0).min(3600),
+ "auto_update" => self.state.auto_update_when_away = v.as_bool().unwrap_or(true),
+ "garden_reports" => self.state.garden_reports = v.as_bool().unwrap_or(true),
+ "embed" => {
+ self.state.embed_model = match v.as_str().unwrap_or("") {
+ "off" => "off".into(),
+ "ollama" => "ollama".into(),
+ _ => String::new(),
+ };
+ crate::embed::configure(&crate::embed::ollama_base(&self.state.provider(crate::providers::ProviderKind::Ollama).base_url), &self.state.embed_model);
+ }
+ "doc_folder_add" | "doc_folder_remove" => {
+ let f = v.as_str().unwrap_or("").trim().to_string();
+ if f.is_empty() {
+ return fail("資料夾是空的");
+ }
+ if key == "doc_folder_add" {
+ if !self.state.doc_folders.contains(&f) {
+ self.state.doc_folders.push(f);
+ }
+ } else {
+ self.state.doc_folders.retain(|x| *x != f);
+ }
+ *DOC_FOLDERS.write().unwrap_or_else(|e| e.into_inner()) = self.state.doc_folders.clone();
+ }
"rule_add" | "rule_remove" => {
let text = v.as_str().unwrap_or("").trim().to_string();
// (Any list but 「ask」 used to be the allow list.)
@@ -1943,6 +1995,34 @@ impl App {
self.dirty = true;
done("好了")
}
+ // 設定 › 語音 from the phone: 聽 or 說's service, its address, key (written, never read
+ // back), model and (說) voice.
+ "voice" => {
+ if !owner {
+ return owner_only();
+ }
+ let mut v = self.state.voice.clone();
+ let e = match b["which"].as_str() {
+ Some("listen") => &mut v.listen,
+ Some("speak") => &mut v.speak,
+ _ => return fail("要說是「聽」還是「說」"),
+ };
+ if let Some(k) = b["kind"].as_str() {
+ e.kind = match serde_json::from_value(json!(k)) {
+ Ok(k) => k,
+ Err(_) => return fail("不認得這個語音服務"),
+ };
+ }
+ for (field, slot) in [("base_url", &mut e.base_url), ("api_key", &mut e.api_key), ("model", &mut e.model), ("voice", &mut e.voice)] {
+ if let Some(x) = b[field].as_str() {
+ *slot = x.trim().to_string();
+ }
+ }
+ v.saved = true;
+ self.state.voice = v;
+ self.mark();
+ done("好了")
+ }
// 設定 › 模型: a provider's key (written, never read back) and new bots' model.
"provider" => {
if !owner {
@@ -1956,7 +2036,19 @@ impl App {
if let Some(m) = b["default_model"].as_str() {
ps.default_model = m.trim().to_string();
}
+ // 服務網址 (empty: the service's own) and 看不到圖時請雲端模型看 (a local model's).
+ if let Some(u) = b["base_url"].as_str() {
+ ps.base_url = u.trim().to_string();
+ }
+ if let Some(on) = b["cloud_eyes"].as_bool() {
+ ps.cloud_eyes = on;
+ }
self.dirty = true;
+ // 測試連線並取得模型清單: asked on its own thread; the page reads how it went.
+ if b["fetch"].as_bool() == Some(true) {
+ self.fetch_models(kind);
+ return done("正在測試連線…");
+ }
done("好了")
}
// 手機與帳號: sign a direct-connection phone out (as the desktop's list does).
@@ -2167,6 +2259,9 @@ impl App {
"id": b.id, "name": b.name, "description": b.description, "instructions": b.instructions,
"shape": b.shape, "color": b.color, "provider": serde_json::to_value(b.provider).unwrap_or_default(), "model": b.model,
"thinking": b.thinking, "step_model": b.step_model,
+ "fallbacks": b.fallbacks.iter().map(|f| json!({"provider": serde_json::to_value(f.provider).unwrap_or_default(), "model": f.model, "label": f.provider.label()})).collect::
>(),
+ "workdir": b.workdir,
+ "speak_replies": b.speak_replies, "voice": b.voice, "voice_rate": b.voice_rate, "voice_lang": b.voice_lang,
// 個人檔案 (each list: every choice there is, and whether this bot has it).
"strengths": b.strengths, "not_for": b.not_for,
"abilities": crate::profile::ABILITIES.iter().map(|(k, label, what)| json!({"key": k, "name": label, "note": what, "on": b.abilities.as_ref().is_none_or(|a| a.iter().any(|x| x == k))})).collect::>(),
@@ -2220,6 +2315,15 @@ impl App {
}).collect::>(),
"direct_mode": st.direct_mode, "direct_locked": !self.managed.direct.allows() || !self.managed.local.allows(),
"smart_mode": st.smart_mode,
+ // 權限's 一律放行 and how long a 智慧模式 card waits; 更新's switches; 記憶與文件.
+ // 語音: who hears (聽) and who reads aloud (說); a key is only said to be there.
+ "voice": {
+ "listen": {"kind": serde_json::to_value(st.voice.listen.kind).unwrap_or_default(), "base_url": st.voice.listen.base_url, "model": st.voice.listen.model, "has_key": !st.voice.listen.api_key.is_empty(), "ready": crate::speech::resolve(&st.voice.listen, st, false).is_some()},
+ "speak": {"kind": serde_json::to_value(st.voice.speak.kind).unwrap_or_default(), "base_url": st.voice.speak.base_url, "model": st.voice.speak.model, "voice": st.voice.speak.voice, "has_key": !st.voice.speak.api_key.is_empty(), "ready": crate::speech::resolve(&st.voice.speak, st, true).is_some()},
+ },
+ "always_approve": st.always_approve, "smart_timeout_secs": st.smart_timeout_secs,
+ "auto_update": st.auto_update_when_away, "garden_reports": st.garden_reports,
+ "embed": match st.embed_model.trim() { "" | "local" => "local", "off" => "off", _ => "ollama" }, "doc_folders": st.doc_folders,
"auto_review": st.auto_review, "allow_rules": st.review_allow_rules, "ask_rules": st.review_ask_rules,
"providers": crate::providers::ALL_PROVIDERS.iter().map(|&k| {
let ps = st.provider(k);
@@ -2227,6 +2331,9 @@ impl App {
json!({"key": serde_json::to_value(k).unwrap_or_default(), "label": k.label(), "needs_key": k.needs_key() && k != crate::providers::ProviderKind::ChatGpt, "account": k == crate::providers::ProviderKind::ChatGpt,
"ready": crate::providers::ready(k, &ps.api_key),
"default_model": ps.default_model, "custom_url": !ps.base_url.is_empty(),
+ "base_url": ps.base_url, "default_url": k.default_base_url(), "cloud_eyes": ps.cloud_eyes,
+ "local": crate::providers::is_local_model(k, &crate::providers::resolve_base(k, &ps.base_url)),
+ "known": ps.known_models.len(), "testing": self.model_fetch.contains_key(&k), "status": self.fetch_status.get(&k).cloned().unwrap_or_default(),
"runs": crate::providers::runs_at(k, &crate::providers::resolve_base(k, &ps.base_url)).short()})
}).collect::>(),
"skills": st.skills.iter().map(|k| json!({
@@ -2855,6 +2962,47 @@ mod phone_act_tests {
assert!(app.phone_act(&ctx, "workflow", &json!({"wf": 99, "do": "explode"}), "owner")["error"].is_string());
}
+ /// The settings the phone took over from the computer: 一律放行 (with direct mode, and back),
+ /// how long a 智慧模式 card waits, 更新's switches, 記憶與文件, and a bot's 備用模型,
+ /// 起始資料夾 and a colour of its own.
+ #[test]
+ fn the_phone_changes_the_rest_of_the_settings() {
+ let (ctx, mut app) = demo();
+ let set = |app: &mut App, key: &str, value: serde_json::Value| app.phone_act(&ctx, "setting", &json!({"key": key, "value": value}), "owner");
+ assert_eq!(set(&mut app, "always_approve", json!(true))["ok"], true);
+ assert!(app.state.always_approve && app.state.direct_mode);
+ assert_eq!(set(&mut app, "always_approve", json!(false))["ok"], true);
+ assert!(!app.state.always_approve && !app.state.direct_mode, "direct mode goes back to how it was");
+ set(&mut app, "smart_timeout_secs", json!(60));
+ set(&mut app, "auto_update", json!(false));
+ set(&mut app, "garden_reports", json!(false));
+ set(&mut app, "embed", json!("off"));
+ set(&mut app, "doc_folder_add", json!("~/Documents/筆記"));
+ assert_eq!((app.state.smart_timeout_secs, app.state.auto_update_when_away, app.state.garden_reports, app.state.embed_model.as_str(), app.state.doc_folders.clone()), (60, false, false, "off", vec!["~/Documents/筆記".to_string()]));
+ set(&mut app, "doc_folder_remove", json!("~/Documents/筆記"));
+ assert!(app.state.doc_folders.is_empty());
+ let b = app.state.bots[0].id;
+ let bot = |app: &mut App, key: &str, value: serde_json::Value| app.phone_act(&ctx, "bot", &json!({"bot": b, "key": key, "value": value}), "owner");
+ assert_eq!(bot(&mut app, "color", json!("#12AB9f"))["ok"], true);
+ assert!(bot(&mut app, "color", json!("#12AB9")).get("error").is_some(), "not a colour");
+ let xai = serde_json::to_value(crate::providers::ProviderKind::Xai).unwrap();
+ let openai = serde_json::to_value(crate::providers::ProviderKind::OpenAi).unwrap();
+ bot(&mut app, "fallbacks", json!([{"provider": xai, "model": "grok-4"}, {"provider": "nope", "model": "x"}, {"provider": openai, "model": " "}]));
+ bot(&mut app, "workdir", json!("~/work"));
+ let x = app.state.bot(b).unwrap();
+ assert_eq!((x.color.as_str(), x.fallbacks.len(), x.workdir.as_str()), ("#12ab9f", 1, "~/work"));
+ // Over the same network: what loosens is refused there, the rest goes.
+ let g = |action: &str, body: serde_json::Value| crate::remote::lan_guard(action, &body, || serde_json::Value::Null, "runc");
+ use crate::remote::Guard;
+ assert_eq!(g("setting", json!({"key": "always_approve", "value": true})), Guard::Loosens);
+ assert_eq!(g("setting", json!({"key": "always_approve", "value": false})), Guard::Keeps);
+ assert_eq!(g("setting", json!({"key": "smart_timeout_secs", "value": 60})), Guard::Loosens);
+ assert_eq!(g("setting", json!({"key": "smart_timeout_secs", "value": 0})), Guard::Keeps);
+ assert_eq!(g("setting", json!({"key": "doc_folder_add", "value": "~"})), Guard::Loosens);
+ assert_eq!(g("bot", json!({"bot": 1, "key": "workdir", "value": "~"})), Guard::Loosens);
+ assert_eq!(g("bot", json!({"bot": 1, "key": "fallbacks", "value": []})), Guard::Keeps);
+ }
+
/// 所有檔案 on the phone: each attachment once (across bots and past conversations), newest
/// first, with its kind and whether it is still there.
#[test]
diff --git a/src/remote.rs b/src/remote.rs
index d28e9d9..54ae730 100644
--- a/src/remote.rs
+++ b/src/remote.rs
@@ -247,6 +247,8 @@ pub struct View {
pub accent: String,
pub pin_order: Vec,
pub newer: bool,
+ /// 一律放行 is on (the phone shows it above the input, with 關閉, as the desktop does).
+ pub always: bool,
pub bots: Vec,
pub approvals: Vec,
pub messages: HashMap>,
@@ -706,7 +708,7 @@ pub fn handle(req: Req, via_relay: bool) -> Resp {
let tasks: Vec<&Value> = v.tasks.iter().filter(|t| shared(t["bot"].as_u64().unwrap_or(0))).collect();
let out = json!({
"version": v.version, "host": v.host, "person": v.person, "accent": v.accent,
- "pin_order": v.pin_order, "newer": v.newer, "bots": bots, "tasks": tasks,
+ "pin_order": v.pin_order, "newer": v.newer, "always": v.always && role != "member", "bots": bots, "tasks": tasks,
"approvals": if role == "member" { vec![] } else { v.approvals.clone() },
"box": crate::cloudbox::run_state().label(),
"box_available": crate::cloudbox::available(),
@@ -1247,7 +1249,12 @@ pub(crate) fn lan_guard(action: &str, body: &Value, now: impl FnOnce() -> Value,
"setting" => match key {
// (As phone_act reads them: a missing value is off.)
"direct_mode" | "auto_review" => looser(on(&body["value"])),
- "notify" => Guard::Keeps,
+ "notify" | "auto_update" | "garden_reports" | "embed" => Guard::Keeps,
+ // 一律放行 on, a 智慧模式 card answering itself, a folder bots may read: looser.
+ "always_approve" => looser(on(&body["value"])),
+ "smart_timeout_secs" => looser(body["value"].as_u64().unwrap_or(0) > 0),
+ "doc_folder_add" => Guard::Loosens,
+ "doc_folder_remove" => Guard::Keeps,
"rule_add" | "rule_remove" => match body["list"].as_str().unwrap_or("") {
"allow" => looser(key == "rule_add"),
"ask" => looser(key == "rule_remove"),
@@ -1270,10 +1277,16 @@ pub(crate) fn lan_guard(action: &str, body: &Value, now: impl FnOnce() -> Value,
let had: Vec = now["members"].as_array().into_iter().flatten().filter_map(|m| m["id"].as_u64()).collect();
looser(now["team"] != false && body["value"].as_array().into_iter().flatten().any(|m| !m.as_u64().is_some_and(|m| had.contains(&m))))
}
- "allow_remove" | "skills" | "pinned" | "pin_at" | "folder" | "primary" | "strengths" | "not_for" | "unread" | "shape" | "color" | "context" | "thinking" | "step_model" => Guard::Keeps,
+ "allow_remove" | "skills" | "pinned" | "pin_at" | "folder" | "primary" | "strengths" | "not_for" | "unread" | "shape" | "color" | "context" | "thinking" | "step_model" | "fallbacks" | "speak_replies" | "voice" | "voice_rate" | "voice_lang" => Guard::Keeps,
+ // A colour of one's own is only a look; a new 起始資料夾 is a folder its files and
+ // commands reach without asking: looser.
+ "workdir" => Guard::Loosens,
_ => Guard::Unknown,
},
// (Renaming is refused before this; reconnecting connects only what is on.)
+ // A model's key, address and list; letting a local model's pictures go to a cloud one
+ // (看不到圖時請雲端模型看) is looser.
+ "provider" => looser(on(&body["cloud_eyes"])),
"mcp" => looser(body["add"].is_object() || (!on(&body["reconnect"]) && !on(&body["remove"]) && on(&body["enabled"]))),
"channel" => looser(!on(&body["remove"]) && on(&body["enabled"])),
"box" => match body["op"].as_str().unwrap_or("") {
@@ -1286,7 +1299,7 @@ pub(crate) fn lan_guard(action: &str, body: &Value, now: impl FnOnce() -> Value,
// signing a phone out; a workflow looked at, run, stopped or answered (its steps run with
// the bots' own settings, as when its schedule starts it); the 日程, 所有檔案 — none of
// these moves a guard.
- "search" | "detail" | "settings" | "pages" | "export_bot" | "export_transcript" | "import_bot" | "section_move" | "memory" | "app" | "group_chat" | "delete_bot" | "restart_bot" | "react" | "reply" | "resume" | "clear" | "delete_page" | "provider" | "device_remove" | "skill" | "chatgpt" | "workflows" | "workflow" | "schedule" | "library" => Guard::Keeps,
+ "search" | "detail" | "settings" | "pages" | "export_bot" | "export_transcript" | "import_bot" | "section_move" | "memory" | "app" | "group_chat" | "delete_bot" | "restart_bot" | "react" | "reply" | "resume" | "clear" | "delete_page" | "device_remove" | "skill" | "chatgpt" | "workflows" | "workflow" | "schedule" | "library" | "voice" => Guard::Keeps,
// An action this list doesn't name is refused, not let through (import_bot slipped by
// that way with a file's 「team」). A new one has to be put on one side or the other.
_ => Guard::Unknown,
@@ -1401,7 +1414,7 @@ struct Told {
/// The state's keys whose fingerprints only change when the app publishes: memoized for the
/// newest view (single slot), so waking polls don't re-hash the whole bot list per wake.
-const FP_STABLE: [&str; 11] = ["host", "person", "accent", "pin_order", "newer", "bots", "approvals", "models", "sections", "theme", "palettes"];
+const FP_STABLE: [&str; 12] = ["host", "person", "accent", "pin_order", "newer", "always", "bots", "approvals", "models", "sections", "theme", "palettes"];
fn fp_cache() -> &'static Mutex)>> {
static C: std::sync::OnceLock)>>> = std::sync::OnceLock::new();