AnyBot/src/app/mirror_ui.rs

2231 lines
109 KiB
Rust
Raw Normal View History

// 大腦: one AnyBot of the account keeps the bots, chats, memory and schedules (the brain, usually
// `anybot --serve` next to the account server). Every other AnyBot signed in to the account shows
// the brain's bots in its own window and lends its hands (screen, files, browser) through 裝置連結.
//
// The brain side answers "what changed since version N?" per screen: the settings (bots without
// their chats) when they changed, and for each bot only the messages from the first one that
// changed. The screen side keeps a copy, sends the person's edits back as small operations, and
// turns chat actions (send, stop, approve…) into requests. When the brain can't be reached the
// window stays readable and waits.
use super::*;
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear - Typing / at the start of the input (computer and phone) lists the skills that are on: names that start with what is typed first, then names containing it, then descriptions (「/簡報」 finds pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the brain recognises 「/name」 and adds a line after the message telling the model to read that skill with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added since is there. - On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」 hands over skills the same way. A refused package leaves no folder behind. - 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除 / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in … before them (the whole of it on hover). - Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
use crate::memory::Skill;
use crate::remote::{self, SyncKind};
use serde_json::{json, Value};
use std::hash::{Hash, Hasher};
use std::sync::atomic::AtomicU64;
/// Settings that belong to each computer, never to the brain.
const LOCAL_KEYS: &[&str] = &["remote", "theme", "accent", "sidebar_collapsed", "sidebar_width", "selected", "machine_label", "local_execution", "local_never", "messages_send", "messages_no_ask"];
/// 外觀 (底色、強調色、對比、密度、慶祝動畫): kept in this computer's own file and put back over the
/// brain's whenever the brain's settings come — an update restarted the screen on its copy of the
/// brain's, and a brain that doesn't know these (an older one) answered with 紙 and its clay every
/// time, so the 強調色 picked here was orange again. Still sent to the brain when changed here: the
/// phone wears the brain's.
fix: 頁面的數字卡不再把視窗撐出標題列(× 跑到中間);所有對話框都不會被內容撐寬 使用者那一頁(機箱健康報告:四張數字卡、結論、九張表、兩張圖)打開時視窗比標題列寬,× 在中間。原因是數字卡:每張卡的標籤、數字、變化該疊成三行,卻繼承了外面那一排「左到右」的排法而並排,卡片遠比算好的寬,整排超出閱讀欄、撐寬視窗;第一張的字還疊在一起。 - 數字卡(page_kpis):每張直排三行、同一排一樣寬;四張並排每張不到 150 時一排兩張(三張 → 三張,否則一張);字太長以 … 結尾,滑過看全文。 - dialog_body:內容在自己的一塊裡畫,太寬的在視窗邊緣切掉,不再撐寬整個視窗(標題列和 × 不會再錯位);超出時照樣記進 WIDER_DIALOGS,版面檢查看得到。 - 版面檢查的頁面場景加上四張長字數字卡、結論和十欄寬表格;寬表格真的左右捲動時回報那一條(scrolls_sideways),捲到邊被切的字不算錯。換回原本的數字卡程式,檢查報 36 個問題(含「視窗被內容撐寬 281px」)。 - 截圖用的 ANYBOT_SHOT_PAGE_JSON:整頁(標題、kpis、結論)換成檔案裡的。 - LOOK_KEYS 只給測試用,標成 cfg(test)(消掉警告)。 已驗證:cargo test --bin anybot 529 通過(含 text_stays_inside_its_place_on_every_screen 新場景);用使用者那一頁截圖 1180/1500 寬:× 在右上角、數字卡兩排各兩張,往下捲九張表和兩張圖都在閱讀欄內。 未驗證:使用者自己的螢幕尺寸。
2026-11-16 16:40:50 +00:00
#[cfg(test)]
const LOOK_KEYS: &[&str] = &["shell_tone", "shell_accent", "shell_contrast", "dense", "celebrate"];
/// This computer's own settings (LOCAL_KEYS but `selected`, which names a bot of one side, and
/// LOOK_KEYS) from `from` onto `to`. The one list of them: four hand-kept lists had drifted apart.
fn copy_own(to: &mut State, from: &State) {
to.remote = from.remote.clone();
to.theme = from.theme;
to.accent = from.accent;
to.sidebar_collapsed = from.sidebar_collapsed;
to.sidebar_width = from.sidebar_width;
to.machine_label = from.machine_label.clone();
to.local_execution = from.local_execution;
to.local_never = from.local_never;
to.messages_send = from.messages_send;
to.messages_no_ask = from.messages_no_ask;
to.shell_tone = from.shell_tone;
to.shell_accent = from.shell_accent.clone();
to.shell_contrast = from.shell_contrast;
to.dense = from.dense;
to.celebrate = from.celebrate;
}
/// Bot fields the brain alone changes (its chat, and what a turn leaves behind).
feat: /plan 先規劃再動手、聊天裡請 Bot 管理連接器、/always-approve 一律放行;輸入框上方的狀態不再破版 /plan(照 Claude Code 的 plan mode、Cursor 的 Plan Mode、Codex 的 update_plan) - 「/plan 要做的事」:這一輪只給會看的工具(讀檔、搜尋、web_fetch、瀏覽器的打開/讀取/捲動、截圖、anybot_guide、問題卡),在執行那一層擋下其他步驟(回「計畫還沒核准」),不是只靠提示詞。 - Bot 用 submit_plan 交計畫:聊天裡一張「計畫」卡(摘要、步驟、怎麼確認做對了、注意),下面的問題卡「照這個計畫做嗎?」:開始照計畫做/先不要/打字寫要改哪裡。 - 核准後同一輪接著做:工具全開、系統指示換成照計畫做,第 1 步自動進行中;update_plan 每做完一步更新一次(整份清單、只有一步進行中),卡上打勾、輸入框上方「照計畫做 · 2/6 · 這一步」;全部做完留「計畫完成」那一行。 - 「/plan」看狀態、「/plan clear」取消;例行任務、訊息管道、團隊成員的訊息不受影響;群組不能用;支線不帶計畫;清除聊天或新對話一起清;分享 Bot 檔不含。手機:計畫卡、計畫列、取消計畫。 - 新功能地圖 plan.md;研究(Claude Code、Codex、Cursor、Gemini CLI…)的結論寫進提示:只寫建議的做法、通常 3 到 7 步、問題最多 3 題、打勾不要太勤。 聊天裡管理連接器(設定能做的聊天也要能做) - 新工具 manage_connectors(管理 App 能力):list、add、update(含開關)、reconnect、remove。改的就是大腦上 設定 › 整合 › 連接器 那一份,不會寫到手腳電腦的檔案(進化之神之前叫使用者去 nobledesktop 的 ~/.local/share/AnyBot 設)。 - 新增、修改、移除先跳卡片:指令(在大腦上執行)或網址、環境變數、標頭;TOKEN、KEY、SECRET、PASS、AUTH… 和密碼顯示「••••(已填)」。名稱重複、command 和 url 都給、網址不對、還有「{…}」、沒東西可改,在問之前就回給 Bot。 - 加好後等它連上(最多 90 秒)再回報幾個工具或原因;一輪裡連接器的工具變了,下一步起就換新(加完同一輪就能用)。 /always-approve(也可以 /yolo) - 使用者自己打(電腦、大腦的螢幕、手機的擁有者)或 設定 › 權限 ›「一律放行」:打開直接操作,之後所有要等「允許」的都自動允許(含一律詢問規則、付款/傳送/刪除的點擊、寄信、傳訊息、打電話、發文、保險庫卡片),自動審核略過;打開時在等的卡片一起放行。 - 照樣擋:安全規則一律拒絕的;別人傳來的訊息那一輪;問題卡、需要處理、計畫卡。Bot、例行任務、訊息管道打不開;管理員和成員打的變成「【名字】/always-approve」。管理員鎖了直接操作就打不開。 - 開著時每個聊天輸入框上方一條「一律放行」和「關閉」;「/always-approve off」關掉,直接操作是它打開的就一起關。 輸入框上方的狀態 - 好幾行的狀態(模型忙碌重試:錯誤、說明、幾秒後重試)以前疊出那一列、壓到輸入框;現在一行:「模型供應商目前負載過高,15 秒後重試(第 3 次,共 3 次)…」。 已驗證:cargo test 548 通過、1 個失敗(layout_audit 的 設定 › 電腦 被這台 Mac 的 Docker 位址 unix:///Users/daniel/.lima/anybot-gvisor 撐寬;把這次的改動 stash 掉一樣失敗,跟這次無關)。新測試:plan:: 7 個;agent 的計畫模式三個(只看到卡片說開始、先不要什麼都不做、修改後重交);app 的 /plan 從打字到計畫完成、Bot 從聊天加連接器(卡片不露 Token、同一輪就用它的工具算出 sum=5)、/always-approve(之前會問、之後不問直接在這台跑、陌生人的訊息照樣問、off 回原樣);mcp::manage_tests 4 個;狀態一行。截圖看過:計畫卡等你決定/照著做打勾、503 重試那一行。手機頁面 JS 語法檢查和計畫卡四種狀態的 HTML。 未驗證:真的模型走一次 /plan 和加 GitLab 連接器;手機實機;伺服器上的大腦(要 make update-server)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 02:55:37 +00:00
const BOT_RUNTIME: &[&str] = &["id", "messages", "threads", "unread", "last_turn", "context_tokens", "goal", "plan", "regen_undo", "branches", "branch_of"];
/// Stands in for a key or token the brain doesn't hand out.
pub const REDACTED: &str = "••••(已設定,在大腦上)";
// ---------- shared ----------
/// The settings as JSON: everything but the chats (messages and earlier conversations).
pub(super) fn config_json(st: &mut State) -> Value {
let mut bots = std::mem::take(&mut st.bots);
let mut top = serde_json::to_value(&*st).unwrap_or(Value::Null);
let mut arr = Vec::with_capacity(bots.len());
for b in bots.iter_mut() {
let m = std::mem::take(&mut b.messages);
let th = std::mem::take(&mut b.threads);
arr.push(serde_json::to_value(&*b).unwrap_or(Value::Null));
b.messages = m;
b.threads = th;
}
st.bots = bots;
top["bots"] = Value::Array(arr);
top
}
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
const TRIGGER_SECRETS: [&str; 4] = ["token", "apiKey", "secret", "api_key"];
fn redact_triggers(v: &mut Value) {
match v {
Value::Object(m) => {
for k in TRIGGER_SECRETS {
if m.get(k).and_then(Value::as_str).is_some_and(|s| !s.is_empty()) {
m.insert(k.to_string(), Value::String(REDACTED.into()));
}
}
for x in m.values_mut() {
redact_triggers(x);
}
}
Value::Array(a) => a.iter_mut().for_each(redact_triggers),
_ => {}
}
}
/// Keys and tokens stay on the brain.
fn redact(top: &mut Value) {
if let Some(o) = top.as_object_mut() {
o.remove("remote");
}
let hide = |v: &mut Value| {
if v.as_str().map(|s| !s.is_empty()).unwrap_or(false) {
*v = Value::String(REDACTED.into());
}
};
if let Some(ps) = top["providers"].as_object_mut() {
for p in ps.values_mut() {
hide(&mut p["api_key"]);
}
}
for c in top["channels"].as_array_mut().into_iter().flatten() {
hide(&mut c["token"]);
}
Voice: its own 設定 › 語音, run by the brain for every screen and the phone Voice was three implementations that broke on their own: speech to text borrowed the OpenAI key (so with only Grok set up the mic recorded, then failed), OpenAI's models it hard-coded stop on 2027-02-26, read aloud was macOS `say` or espeak-ng (silently nothing on Windows, where espeak isn't installed), and the phone used the browser's own recognition. Now: - 設定 › 語音 has 聽 and 說, each a service: off, OpenAI-compatible (OpenAI, Groq, a Whisper server of your own: the address decides), xAI or ElevenLabs. An empty key borrows 設定 › 模型's for the same service. Each side says 可以用 or what it lacks; 聽 has 試試看 (record a sentence, show what was heard), 說 has 試聽 and the voice list. speech.rs does the calls; xAI's both ways were checked for real (Mandarin read, then heard back, in Traditional characters). - The brain does it all: the phone POSTs its recording (MediaRecorder) to /api/voice/transcribe, screens to /api/sync/voice/transcribe; answers come back as MP3 from …/voice/speech and are played on the device (rodio; an <audio> on the phone, 「唸出來」 in a message's menu). Keys stay on the brain (the voice keys are redacted for screens like the others). - No service, no voice anywhere: the mic, 語音聊天, 會議錄音 and 朗讀 only appear once 聽 (and 說) can be called; the phone's state says which. Without voice the send arrow just rests where 語音聊天 was. - 會議錄音 is uploaded to the brain, which turns it into text in the background and hands it to the bot itself: a meeting is longer than the 35 s the account lets a request wait, and a brain on a server has no window (the jobs are polled in background()). - Recognisers answer Mandarin in Simplified: in a Traditional Chinese window or phone the text becomes Traditional with Taiwan wording. - Older saves: whoever had an OpenAI key keeps voice input (聽 = OpenAI); everyone else starts with it off. Bots' macOS voice names are cleared. 對話詳細資訊's 加入會議 started plain voice input; it starts a meeting now.
2026-11-10 14:58:18 +00:00
// 設定 › 語音's own keys (ElevenLabs, or one just for voice).
if let Some(v) = top.get_mut("voice").and_then(Value::as_object_mut) {
for side in ["listen", "speak"] {
if let Some(e) = v.get_mut(side).and_then(Value::as_object_mut) {
if let Some(k) = e.get_mut("api_key") {
hide(k);
}
}
}
}
for m in top["mcp_servers"].as_array_mut().into_iter().flatten() {
for k in ["env", "headers"] {
for v in m[k].as_object_mut().into_iter().flat_map(|o| o.values_mut()) {
hide(v);
}
}
if let Some(v) = m.get_mut("password") {
hide(v);
}
}
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
for b in top["bots"].as_array_mut().into_iter().flatten() {
for r in b["routines"].as_array_mut().into_iter().flatten() {
redact_triggers(&mut r["trigger"]);
}
}
}
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
fn clear_redacted(v: &mut Value) {
match v {
Value::String(s) if s == REDACTED => s.clear(),
Value::Object(o) => o.values_mut().for_each(clear_redacted),
Value::Array(a) => a.iter_mut().for_each(clear_redacted),
_ => {}
}
}
/// Put the brain's own keys back wherever an edit still carries the stand-in — unless the
/// target address or command of that object changed (otherwise changing `base_url`/`url` to an
/// attacker's server while keeping `REDACTED` would make the brain send its real secret there).
fn unredact(new: &mut Value, old: &Value) {
match new {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
Value::String(s) if s == REDACTED => {
*new = old.as_str().map(|s| Value::String(s.to_string())).unwrap_or_else(|| Value::String(String::new()));
}
Value::Object(o) => {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let endpoint_changed = ["base_url", "url", "command", "args"].iter().any(|k| o.contains_key(*k) && o.get(*k) != old.get(*k));
if endpoint_changed {
for k in ["api_key", "token", "secret", "apiKey", "env", "headers", "password"] {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
if let Some(v) = o.get_mut(k) {
clear_redacted(v);
}
}
}
for (k, v) in o.iter_mut() {
unredact(v, old.get(k).unwrap_or(&Value::Null));
}
}
Value::Array(a) => {
for (i, v) in a.iter_mut().enumerate() {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let key = |x: &Value| x.get("id").cloned().filter(|x| !x.is_null()).or_else(|| x.get("name").cloned().filter(|s| s.as_str().is_some_and(|t| !t.is_empty())));
let twin = old.as_array().and_then(|olds| match key(v) {
Some(k) => olds.iter().find(|o| key(o).as_ref() == Some(&k)),
None => olds.get(i),
});
unredact(v, twin.unwrap_or(&Value::Null));
}
}
_ => {}
}
}
/// A cheap fingerprint of one message: enough to see it changed (streaming, a tool finishing…).
fn msg_sig(m: &Message) -> u64 {
let mut h = std::collections::hash_map::DefaultHasher::new();
(m.role as u8, m.text.len(), m.thinking.len(), m.error, m.summary, m.images.len(), m.attachments.len(), m.at, &m.tool_call_id, &m.reactions).hash(&mut h);
m.text.chars().rev().take(48).collect::<String>().hash(&mut h);
for c in &m.tool_calls {
(&c.id, c.args.len(), c.status as u8).hash(&mut h);
}
h.finish()
}
fn threads_sig(b: &Bot) -> u64 {
let mut h = std::collections::hash_map::DefaultHasher::new();
for (t, msgs) in &b.threads {
(t, msgs.len()).hash(&mut h);
}
h.finish()
}
fn hash_value(v: &Value) -> u64 {
let mut h = std::collections::hash_map::DefaultHasher::new();
v.to_string().hash(&mut h);
h.finish()
}
/// What names an item in a list: its id, else its name, else (plain values) the value itself.
fn item_key(x: &Value) -> Option<Value> {
match x {
Value::Object(o) => o.get("id").filter(|v| !v.is_null()).or_else(|| o.get("name").filter(|v| v.is_string())).cloned(),
Value::Array(_) | Value::Null => None,
v => Some(v.clone()),
}
}
/// Every item has its own key, and no two share one.
fn keyed(a: &[Value]) -> bool {
let mut seen = std::collections::HashSet::new();
a.iter().all(|x| item_key(x).map(|k| seen.insert(k.to_string())).unwrap_or(false))
}
/// The smallest change from `old` to `new`: lists of named things and maps change item by item,
/// so two computers editing different items of one list don't undo each other.
pub(super) fn patch_of(old: &Value, new: &Value) -> Value {
match (old, new) {
(Value::Object(o), Value::Object(n)) => {
let put: serde_json::Map<String, Value> = n.iter().filter(|(k, v)| o.get(*k) != Some(*v)).map(|(k, v)| (k.clone(), v.clone())).collect();
let del: Vec<&String> = o.keys().filter(|k| !n.contains_key(*k)).collect();
json!({"map": {"put": put, "del": del}})
}
(Value::Array(o), Value::Array(n)) if keyed(o) && keyed(n) => {
let key = |x: &Value| item_key(x).unwrap_or(Value::Null);
let put: Vec<&Value> = n.iter().filter(|x| !o.iter().any(|y| key(y) == key(x) && y == *x)).collect();
let del: Vec<Value> = o.iter().map(key).filter(|k| !n.iter().any(|x| key(x) == *k)).collect();
let common_old: Vec<Value> = o.iter().map(key).filter(|k| n.iter().any(|x| key(x) == *k)).collect();
let common_new: Vec<Value> = n.iter().map(key).filter(|k| o.iter().any(|x| key(x) == *k)).collect();
let mut p = json!({"list": {"put": put, "del": del}});
if common_old != common_new {
p["list"]["order"] = Value::Array(n.iter().map(key).collect());
}
p
}
_ => json!({"value": new}),
}
}
/// Apply a change made by `patch_of` to whatever the value is now.
pub(super) fn apply_patch(cur: &mut Value, p: &Value) {
if let Some(v) = p.get("value") {
*cur = v.clone();
} else if let Some(m) = p.get("map") {
if !cur.is_object() {
*cur = json!({});
}
let o = cur.as_object_mut().expect("object");
for (k, v) in m["put"].as_object().into_iter().flatten() {
o.insert(k.clone(), v.clone());
}
for k in m["del"].as_array().into_iter().flatten().filter_map(Value::as_str) {
o.remove(k);
}
} else if let Some(l) = p.get("list") {
if !cur.is_array() {
*cur = json!([]);
}
let a = cur.as_array_mut().expect("array");
let key = |x: &Value| item_key(x).unwrap_or(Value::Null);
for item in l["put"].as_array().into_iter().flatten() {
match a.iter_mut().find(|x| key(x) == key(item)) {
Some(x) => *x = item.clone(),
None => a.push(item.clone()),
}
}
let del: Vec<Value> = l["del"].as_array().cloned().unwrap_or_default();
a.retain(|x| !del.contains(&key(x)));
if let Some(order) = l["order"].as_array() {
a.sort_by_key(|x| order.iter().position(|k| *k == key(x)).unwrap_or(usize::MAX));
}
}
}
/// The person's edits since `base`, as operations the brain applies one by one.
pub(super) fn diff_ops(base: &Value, cur: &Value) -> Vec<Value> {
let mut ops = vec![];
let (Some(b), Some(c)) = (base.as_object(), cur.as_object()) else { return ops };
for (k, v) in c {
if k == "bots" || LOCAL_KEYS.contains(&k.as_str()) {
continue;
}
if b.get(k) != Some(v) {
let p = patch_of(b.get(k).unwrap_or(&Value::Null), v);
ops.push(if p.get("value").is_some() { json!({"op": "set", "key": k, "value": v}) } else { json!({"op": "patch", "key": k, "patch": p}) });
}
}
let id = |x: &Value| x["id"].as_u64().unwrap_or(0);
let empty = vec![];
let old = base["bots"].as_array().unwrap_or(&empty);
let new = cur["bots"].as_array().unwrap_or(&empty);
for nb in new {
match old.iter().find(|o| id(o) == id(nb)) {
None => ops.push(json!({"op": "bot_add", "bot": nb})),
Some(ob) => {
for (k, v) in nb.as_object().into_iter().flatten() {
if k == "unread" {
if ob[k] == true && *v == false {
ops.push(json!({"op": "bot_read", "id": id(nb)}));
}
continue;
}
if BOT_RUNTIME.contains(&k.as_str()) {
continue;
}
if ob.get(k) != Some(v) {
let p = patch_of(ob.get(k).unwrap_or(&Value::Null), v);
ops.push(if p.get("value").is_some() { json!({"op": "bot_set", "id": id(nb), "key": k, "value": v}) } else { json!({"op": "bot_patch", "id": id(nb), "key": k, "patch": p}) });
}
}
}
}
}
for ob in old {
if !new.iter().any(|n| id(n) == id(ob)) {
ops.push(json!({"op": "bot_del", "id": id(ob)}));
}
}
let order = |a: &Vec<Value>| a.iter().map(id).collect::<Vec<_>>();
let (oo, no) = (order(old), order(new));
let kept: Vec<u64> = oo.iter().copied().filter(|i| no.contains(i)).collect();
let kept_new: Vec<u64> = no.iter().copied().filter(|i| oo.contains(i)).collect();
if kept != kept_new {
ops.push(json!({"op": "bot_order", "ids": no}));
}
ops
}
/// Replay edit operations on settings JSON: a screen keeps its own not-yet-confirmed edits on
/// top of what the brain last sent, so typing isn't undone by the brain's slightly older copy.
pub(super) fn apply_ops(cfg: &mut Value, ops: &[Value]) {
let id = |x: &Value| x["id"].as_u64().unwrap_or(0);
for op in ops {
let target = op["id"].as_u64().unwrap_or(0);
match op["op"].as_str().unwrap_or("") {
"set" => {
if let Some(k) = op["key"].as_str() {
cfg[k] = op["value"].clone();
}
}
"patch" => {
if let Some(k) = op["key"].as_str() {
apply_patch(&mut cfg[k], &op["patch"]);
}
}
"bot_patch" => {
if let (Some(b), Some(k)) = (cfg["bots"].as_array_mut().and_then(|a| a.iter_mut().find(|b| id(b) == target)), op["key"].as_str()) {
apply_patch(&mut b[k], &op["patch"]);
}
}
"bot_add" => {
if let Some(a) = cfg["bots"].as_array_mut() {
if !a.iter().any(|b| id(b) == id(&op["bot"])) {
a.push(op["bot"].clone());
}
}
}
"bot_del" => {
if let Some(a) = cfg["bots"].as_array_mut() {
a.retain(|b| id(b) != target);
}
}
"bot_set" | "bot_read" => {
if let Some(b) = cfg["bots"].as_array_mut().and_then(|a| a.iter_mut().find(|b| id(b) == target)) {
if op["op"] == "bot_read" {
b["unread"] = json!(false);
} else if let Some(k) = op["key"].as_str() {
b[k] = op["value"].clone();
}
}
}
"bot_order" => {
let ids: Vec<u64> = op["ids"].as_array().into_iter().flatten().filter_map(Value::as_u64).collect();
if let Some(a) = cfg["bots"].as_array_mut() {
a.sort_by_key(|b| ids.iter().position(|i| *i == id(b)).unwrap_or(usize::MAX));
}
}
_ => {}
}
}
}
/// A schedule edited on a screen keeps what the brain knows about runs (when it last ran, when it
/// runs next), so an older copy can't make a routine run twice.
fn keep_run_times(new: &mut Value, old: &Value) {
for r in new.as_array_mut().into_iter().flatten() {
let Some(o) = old.as_array().and_then(|a| a.iter().find(|o| o["id"] == r["id"])) else { continue };
let last = |x: &Value| x["last_run"].as_i64();
if last(o) > last(r) || r["last_run"].is_null() {
r["last_run"] = o["last_run"].clone();
}
let same = ["schedule", "trigger", "paused"].iter().all(|k| r[*k] == o[*k]);
if same {
r["next_run"] = o["next_run"].clone();
}
}
}
// ---------- the brain's side ----------
/// What the brain last sent each screen.
#[derive(Default)]
pub struct Screens {
seen: HashMap<String, Seen>,
/// The settings fingerprint, refreshed now and then while something changes.
pub(super) cfg_hash: u64,
cfg_at: Option<Instant>,
/// The last edit (by number) each screen sent, so it knows which of its edits are in.
acked: HashMap<String, u64>,
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
#[derive(Default, Clone)]
struct Seen {
version: u64,
config: u64,
bots: HashMap<u64, Vec<u64>>,
threads: HashMap<u64, u64>,
at: Option<Instant>,
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
/// What the screen held before the last answer: when that answer was lost on the way (the
/// line dropped), the next pull starts from here instead of sending every chat again.
prev: Option<Box<Seen>>,
}
// ---------- the screen's side ----------
pub enum Incoming {
Pull(Value),
Offline(String),
/// A file from the brain arrived (its local copy's path).
File(String),
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
/// A message that couldn't reach the brain however long it was tried: its words go back
/// into that bot's input (when the person hasn't typed something else there since).
fix: 第二輪獨立審查的 P1——提醒不算這一輪的要求、安靜那步的起跑期限、斷線時附件不再遺失 - 說了就做的提醒(和 hook 的「還不能結束」)不再被當成這一輪的起點:記下做過的事、學技能與重播、發布前的「這一輪的任務」都從使用者真正的要求算起;回顧裡也不列成「使用者中途說」 - 安靜的那一步:UI 收到提醒時把「第一次回應」期限重設回 120 秒;這一步的輸出以空的思考事件告訴看門狗它正在回答(原本思考不串流的模型 35 秒就被判中斷) - 螢幕電腦斷線時送出附件:上傳也在斷線期間重送;有一個檔案上傳不了就不送文字,整則(文字和附件)放回輸入框;放回時不覆蓋已經打的字 - 等待連上大腦時不開設定、Bot 編輯等視窗(那時改的東西進門後會被丟掉) 已驗證: cargo test 740 通過(新增 a_nudge_is_not_the_person_talking;an_announced_step_is_carried_out_without_the_person 加驗安靜那步的輸出事件);verify-anybot 重跑 chat.md「說了就做」「/ 指令」、autonomy.md「智慧模式一直開著」結果相同,ctl down 無殘留 未驗證: 螢幕電腦斷線時附件重送與退回(要帳號伺服器與第二台電腦,只在程式層修正、無端到端測試);看門狗的 120 秒期限在真的慢模型上(要真的模型);手機頁面畫面那一層(這台沒有 Google Chrome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:44:29 +00:00
Unsent { bot: u64, text: String, atts: Vec<crate::attach::Attachment> },
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
}
/// Each message and chat action from this screen gets a name of its own (this screen's, then a
/// count), sent again under the same name while the line is down: the brain does it once.
fn act_id(client: &str) -> String {
static N: AtomicU64 = AtomicU64::new(0);
// (With this run's own mark: the screen keeps its name at the brain across restarts, and a
// count from 1 again matched the last run's — the brain took the new message for a repeat.)
static RUN: std::sync::OnceLock<String> = std::sync::OnceLock::new();
let run = RUN.get_or_init(|| crate::httpd::random_hex(4));
format!("{client}-{run}-{}", N.fetch_add(1, Ordering::Relaxed) + 1)
}
/// What a screen sends to the brain, one at a time and in order.
enum Out {
Edit { seq: u64, ops: Vec<Value> },
Act(Value),
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
Send { bot: u64, id: String, text: String, atts: Vec<crate::attach::Attachment>, memories: Option<Vec<String>> },
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear - Typing / at the start of the input (computer and phone) lists the skills that are on: names that start with what is typed first, then names containing it, then descriptions (「/簡報」 finds pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the brain recognises 「/name」 and adds a line after the message telling the model to read that skill with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added since is there. - On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」 hands over skills the same way. A refused package leaves no folder behind. - 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除 / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in … before them (the whole of it on hover). - Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
Move { ops: Vec<Value>, n: usize, skills: Vec<Skill> },
/// 技能 on a screen: done at the brain (see [`App::mirror_skill`]); the answer goes to `note`.
Skill { body: Value, note: SkillNote, busy: Arc<AtomicBool> },
/// 連接器 › 重新連線 on a screen: the servers run at the brain.
McpReconnect(String),
/// A connector renamed on a screen (old, new): the brain renames its own (see commit_mcp_name).
McpRename(String, String),
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear - Typing / at the start of the input (computer and phone) lists the skills that are on: names that start with what is typed first, then names containing it, then descriptions (「/簡報」 finds pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the brain recognises 「/name」 and adds a line after the message telling the model to read that skill with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added since is there. - On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」 hands over skills the same way. A refused package leaves no folder behind. - 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除 / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in … before them (the whole of it on hover). - Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
}
/// Where a skill request's answer is shown: (worked, words).
pub(super) type SkillNote = Arc<Mutex<Option<(bool, String)>>>;
/// What the brain is asked for a skill request: a folder or `.md` file named by its path on this
/// computer (`{"local": …}`) goes up whole, read here — the brain can't see this disk.
fn skill_request(body: Value) -> Result<Value, String> {
match body["local"].as_str() {
Some(p) => Ok(json!({"package": crate::skills::package_from_path(&crate::tools::expand_home(p))?})),
None => Ok(body),
}
}
/// The bots whose turn ended well since the last update (`seen` keeps when each bot's last turn
/// ended). Only an end heard while connected counts, and only a recent one: connecting, or coming
/// back after a while, never reads old answers out.
fn just_finished<'a>(seen: &mut HashMap<u64, i64>, turns: impl IntoIterator<Item = (u64, Option<&'a TurnSettlement>)>, now_ms: i64) -> Vec<u64> {
let mut out = vec![];
for (id, t) in turns {
let Some(t) = t else { continue };
let before = seen.insert(id, t.settled_at_ms);
if before.is_some_and(|s| s < t.settled_at_ms) && t.outcome == TurnOutcome::Success && now_ms - t.settled_at_ms < 120_000 {
out.push(id);
}
}
out
}
/// An edit sent to the brain and not yet confirmed: (its number, the operations).
type Pending = (u64, Vec<Value>);
#[derive(Default)]
pub struct Mirror {
/// This window shows a brain (instead of its own bots).
pub on: bool,
/// Heard from the brain lately.
pub online: bool,
/// The brain's settings as last received (edits are what differs from this).
pub(super) base: Value,
pub status: Arc<Mutex<String>>,
rx: Option<Receiver<Incoming>>,
tx: Option<Sender<Incoming>>,
gen: Arc<AtomicU64>,
version: Arc<AtomicU64>,
client: String,
/// This computer's own data, kept aside while it shows the brain.
local: Option<State>,
started: bool,
/// A request to the brain failed (shown above the message box).
pub(super) error: Arc<Mutex<String>>,
/// The person chose a brain in 設定 (applied on the next frame).
pub(super) want: Option<(String, String)>,
pub(super) leave: bool,
pub(super) moving: Arc<AtomicBool>,
/// Just signed in: copy this computer's bots to the brain once it answers.
pub(super) move_after_join: bool,
pub(super) move_note: Arc<Mutex<String>>,
/// Requests to the brain, sent in order by one worker.
outbox: Option<Sender<Out>>,
/// Edits sent but not yet confirmed (by number).
pending: Arc<Mutex<Vec<Pending>>>,
seq: u64,
/// Something didn't reach the brain: ask for everything again.
resync: Arc<AtomicBool>,
/// Why the brain can't be reached (shown above the chat), and since when.
pub(super) reason: String,
down_since: Option<Instant>,
/// Files from the brain being fetched (by local path).
fetching: std::collections::HashSet<String>,
/// 加一台電腦: the line to run on the new computer (or why there is none), and when it was made.
pub(super) pair: Arc<Mutex<(String, bool, Option<Instant>)>>,
/// The bots' own computer on the brain: {label, running, available, busy}.
pub(super) box_state: Value,
/// Each bot's computers on the brain, by bot id: {names: [{name, kind}], current, missing}.
pub(super) computers: HashMap<u64, Value>,
/// The connectors at the brain, as [`App::mcp_state`] gives them.
pub(super) mcp_state: Value,
/// When each bot's last turn ended, as last heard (a newer one ending well is read aloud).
settled: HashMap<u64, i64>,
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
/// The brain's key for each card waiting here (by bot id): an answer from this screen names
/// it, so the brain applies it only to that card.
pub(super) keys: HashMap<u64, String>,
fix: 慢的線上長連線不再被切斷;斷線接回馬上重新同步;大腦那一欄看得出是哪一段 計畫 R7。2026-11-17 早上:Mac mini 經 Tailscale 香港中繼連 nobledesktop(約 100 KB/s),大腦整份資料約 5 MB 要 45–55 秒。這台 45 秒沒收到「一則完整訊息」就算斷線,傳到一半被切、螢幕又從頭要整份,一直循環(實測:連線 9:41:48 開、9:42:33 剛好 45 秒時被切;第二次 9:43:55 一樣)。帳號那欄寫已連線、大腦那欄寫「和帳號伺服器的連線斷了」,看不出是哪一段。 - tunnel.rs:Stream 讀到資料就記(bytes_in、receiving);keep() 有資料進來就算還活著(DEAD_SECS 照舊,但量的是真的沒聲音)。call() 過了自己的時間、但連線還在收資料就繼續等(最多 10 分鐘)。link_serial() 給螢幕知道長連線接回了。 - 帳號伺服器(relay)的長連線同樣:Counted 包住 TcpStream,資料進來就算活著(這台上傳大份資料時不會被那端的 60 秒切掉)。要 make update-server 才生效。relay/clippy.toml:主程式的「HTTP 用戶端只能在 net.rs 建」不套用到 relay。 - 螢幕(mirror_ui):等重試時每 0.2 秒看一次長連線,接回就馬上再要(以前最多等 20 秒,這段時間帳號那欄已經寫已連線);記下上次同步的時間、大小、秒數。 - 設定的大腦那一欄:狀態下面分段寫「這台 ↔ 帳號伺服器」「帳號伺服器 ↔ 大腦(在線上/不在線上,帳號伺服器說的)」「上次同步 …(大小、秒數、KB/s)」。 已驗證:cargo test 571 全過、clippy -D warnings 過;relay cargo test 22 全過。新測試:假的帳號伺服器把一則 64 KB 的訊息分 3 秒慢慢送(允許的沉默設成 1 秒),連線不斷;之後真的沒聲音就斷。把「有資料進來就算活著」拿掉,同一個測試失敗:「已連線」後馬上「連線中斷」——就是早上的情況。 未驗證:真的 Tailscale 中繼線路上走一次(要更新這台的 App 和伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:41:15 +00:00
/// The last answer from the brain: when (ms), how many bytes came over the lasting
/// connection for it, and how long it took (ms) — the 大腦 section says the line's speed.
pub(super) last_sync: Arc<Mutex<Option<(i64, u64, u64)>>>,
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
/// The copy of the brain kept on disk (brain-copy.json): when it was last written, whether
/// newer news is waiting, and whether a write is running now (it runs on its own thread).
copy_at: Option<Instant>,
copy_dirty: bool,
copy_writing: Arc<AtomicBool>,
/// The brain's version of the last answer taken in here (what the copy on disk is, when
/// written with it: the next start asks only for what changed since).
applied: u64,
/// Messages handed to the outbox and not yet through: a copy written meanwhile holds one the
/// brain doesn't have yet, so it isn't one to resume from.
sending: Arc<std::sync::atomic::AtomicUsize>,
/// Cards answered here, by the brain's key, and when: an update the brain sent before it
/// took the answer in still has the card — it isn't shown (and chimed) a second time.
pub(super) answered: HashMap<String, Instant>,
/// The brain's first answer since this screen came to it is in (its settings taken, or
/// found unreadable and said so): the door opens.
entered: bool,
/// When this screen started knocking (the door's way back shows after a while).
door_since: Option<Instant>,
}
/// What the copy on disk is: which brain, this screen's name there, and the brain's version it
/// holds. Beside brain-copy.json, written after it.
#[derive(serde::Serialize, serde::Deserialize, Default)]
struct CopyAt {
brain: String,
client: String,
version: u64,
}
fn copy_at_path() -> PathBuf {
State::path().with_file_name("brain-copy.at.json")
fix: 慢的線上長連線不再被切斷;斷線接回馬上重新同步;大腦那一欄看得出是哪一段 計畫 R7。2026-11-17 早上:Mac mini 經 Tailscale 香港中繼連 nobledesktop(約 100 KB/s),大腦整份資料約 5 MB 要 45–55 秒。這台 45 秒沒收到「一則完整訊息」就算斷線,傳到一半被切、螢幕又從頭要整份,一直循環(實測:連線 9:41:48 開、9:42:33 剛好 45 秒時被切;第二次 9:43:55 一樣)。帳號那欄寫已連線、大腦那欄寫「和帳號伺服器的連線斷了」,看不出是哪一段。 - tunnel.rs:Stream 讀到資料就記(bytes_in、receiving);keep() 有資料進來就算還活著(DEAD_SECS 照舊,但量的是真的沒聲音)。call() 過了自己的時間、但連線還在收資料就繼續等(最多 10 分鐘)。link_serial() 給螢幕知道長連線接回了。 - 帳號伺服器(relay)的長連線同樣:Counted 包住 TcpStream,資料進來就算活著(這台上傳大份資料時不會被那端的 60 秒切掉)。要 make update-server 才生效。relay/clippy.toml:主程式的「HTTP 用戶端只能在 net.rs 建」不套用到 relay。 - 螢幕(mirror_ui):等重試時每 0.2 秒看一次長連線,接回就馬上再要(以前最多等 20 秒,這段時間帳號那欄已經寫已連線);記下上次同步的時間、大小、秒數。 - 設定的大腦那一欄:狀態下面分段寫「這台 ↔ 帳號伺服器」「帳號伺服器 ↔ 大腦(在線上/不在線上,帳號伺服器說的)」「上次同步 …(大小、秒數、KB/s)」。 已驗證:cargo test 571 全過、clippy -D warnings 過;relay cargo test 22 全過。新測試:假的帳號伺服器把一則 64 KB 的訊息分 3 秒慢慢送(允許的沉默設成 1 秒),連線不斷;之後真的沒聲音就斷。把「有資料進來就算活著」拿掉,同一個測試失敗:「已連線」後馬上「連線中斷」——就是早上的情況。 未驗證:真的 Tailscale 中繼線路上走一次(要更新這台的 App 和伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:41:15 +00:00
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
fn read_copy_at() -> CopyAt {
std::fs::read_to_string(copy_at_path()).ok().and_then(|s| serde_json::from_str(&s).ok()).unwrap_or_default()
}
/// The copy on disk is written at most this often (it is only for opening while the brain is
/// out of reach): every sync wrote all chats — megabytes — on the window's thread, ten times a
/// second while a bot answered.
const COPY_EVERY: std::time::Duration = std::time::Duration::from_secs(5);
fix: 慢的線上長連線不再被切斷;斷線接回馬上重新同步;大腦那一欄看得出是哪一段 計畫 R7。2026-11-17 早上:Mac mini 經 Tailscale 香港中繼連 nobledesktop(約 100 KB/s),大腦整份資料約 5 MB 要 45–55 秒。這台 45 秒沒收到「一則完整訊息」就算斷線,傳到一半被切、螢幕又從頭要整份,一直循環(實測:連線 9:41:48 開、9:42:33 剛好 45 秒時被切;第二次 9:43:55 一樣)。帳號那欄寫已連線、大腦那欄寫「和帳號伺服器的連線斷了」,看不出是哪一段。 - tunnel.rs:Stream 讀到資料就記(bytes_in、receiving);keep() 有資料進來就算還活著(DEAD_SECS 照舊,但量的是真的沒聲音)。call() 過了自己的時間、但連線還在收資料就繼續等(最多 10 分鐘)。link_serial() 給螢幕知道長連線接回了。 - 帳號伺服器(relay)的長連線同樣:Counted 包住 TcpStream,資料進來就算活著(這台上傳大份資料時不會被那端的 60 秒切掉)。要 make update-server 才生效。relay/clippy.toml:主程式的「HTTP 用戶端只能在 net.rs 建」不套用到 relay。 - 螢幕(mirror_ui):等重試時每 0.2 秒看一次長連線,接回就馬上再要(以前最多等 20 秒,這段時間帳號那欄已經寫已連線);記下上次同步的時間、大小、秒數。 - 設定的大腦那一欄:狀態下面分段寫「這台 ↔ 帳號伺服器」「帳號伺服器 ↔ 大腦(在線上/不在線上,帳號伺服器說的)」「上次同步 …(大小、秒數、KB/s)」。 已驗證:cargo test 571 全過、clippy -D warnings 過;relay cargo test 22 全過。新測試:假的帳號伺服器把一則 64 KB 的訊息分 3 秒慢慢送(允許的沉默設成 1 秒),連線不斷;之後真的沒聲音就斷。把「有資料進來就算活著」拿掉,同一個測試失敗:「已連線」後馬上「連線中斷」——就是早上的情況。 未驗證:真的 Tailscale 中繼線路上走一次(要更新這台的 App 和伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:41:15 +00:00
/// The last sync in words: 「上次同步 10:31:05(1.2 MB,11 秒,約 110 KB/s)」.
pub(super) fn sync_words(at_ms: i64, bytes: u64, ms: u64) -> String {
let when = chrono::DateTime::from_timestamp_millis(at_ms).map(|t| t.with_timezone(&chrono::Local).format("%H:%M:%S").to_string()).unwrap_or_default();
if bytes < 100_000 || ms == 0 {
return format!("上次同步 {when}");
}
let size = if bytes >= 1_000_000 { format!("{:.1} MB", bytes as f64 / 1e6) } else { format!("{} KB", bytes / 1000) };
format!("上次同步 {when}({size},{} 秒,約 {} KB/s)", ms.div_ceil(1000), bytes * 1000 / ms / 1000)
}
/// What a computer is, in a word a screen can show next to its name.
pub(super) fn computer_kind(t: &crate::tools::Target, r: &crate::tools::Roles) -> &'static str {
use crate::tools::Place;
if t.name == r.own {
"own"
} else if r.person.as_deref() == Some(t.name.as_str()) {
"person"
} else {
match t.place {
Place::Local { .. } if r.server => "server",
Place::Local { .. } => "this",
Place::Device { .. } => "device",
_ => "ssh",
}
}
}
/// Where a screen keeps its copy of a file the brain has.
fn local_copy(brain_path: &str, name: &str) -> PathBuf {
let h = crate::httpd::sha256_hex(brain_path);
let name: String = name.chars().filter(|c| !matches!(c, '/' | '\\' | '\0' | ':')).take(80).collect();
State::path().with_file_name("brain-files").join(format!("{}-{name}", &h[..16]))
}
fn cache_path() -> PathBuf {
State::path().with_file_name("brain-copy.json")
}
impl App {
/// The brain: answer the screens' requests (on the app's thread, where the state is).
pub(super) fn brain_serve(&mut self, ctx: &egui::Context) {
let reqs = remote::hub().take_sync();
if reqs.is_empty() {
return;
}
for r in reqs {
let v = match r.kind {
// 手機 (not a screen): what the desktop does, done the same way.
SyncKind::Phone { action, body, role } => {
if self.mir.on {
json!({"error": "這台 AnyBot 連著別的大腦,請在大腦上操作"})
} else {
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘1–⌘9(Win/Linux 為 Ctrl)在 ctx.input 裡又呼叫 ctx.input,egui 的 Context 被鎖兩次, 按住 ⌘(⌘C、⌘V、⌘Tab)視窗就永遠不動;改為只讀一次(bot_jump_key),加回歸測試 - 圖表 x 軸格線固定每 1 一條,縮小後一幀要畫上百萬條(凍結、記憶體爆);改為最多約 40 條, 滾輪不再被圖表吃掉(⌘/Ctrl+滾輪或雙指縮放) - 草稿每打一個字就同步重寫整個 state.json(含 fsync);改為停手 1.5 秒後才存,結尾空白也 不再造成每幀存檔 複製(三個系統) - Mac:pbcopy 從 Finder/Dock 開時沒有 UTF-8 語系,中文變亂碼;指定 UTF-8 - ⌘C 攔截只拿 CopyText,不再丟掉開連結、複製圖片、Linux 中鍵選取等指令(且只在 Mac 攔) - Windows:改用 Win32 剪貼簿(arboard,獨立執行緒),不再走 clip.exe(缺 BOM、多一個 NUL) - Linux:依 WAYLAND_DISPLAY/DISPLAY 選 wl-copy 或 xclip/xsel,都沒有時退回視窗剪貼簿 其他 - 頁面目錄點了不跳(標題位置從未記錄);目錄搜尋框按 Esc 會關掉整頁 - 圖表:單一系列欄名被 String::max 換成「數值」;同尺寸無標題的圖共用縮放;inf/NaN 不入圖 - KPI 卡片寬度未扣內距而超出欄寬 - 「還原上一個答案」在送出新訊息後會插錯位置;重試錯誤回覆不再存可還原的版本 - 手機:長輪詢回來時已切到別的聊天,不再把上一個聊天的訊息畫進來 - 輸入框上方頭像:思考時頭稍微縮小,三顆小球繞著頭轉(後面的從頭後經過、前面的壓在頭上並描邊), 不再被頭像蓋住 - 刪除未使用的 src/app/ui_kit.rs 驗證:macOS cargo test 374 通過(relay 18 通過);Windows/Linux cargo check 通過 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 06:19:59 +00:00
let mut out = self.phone_act(ctx, &action, &body, &role);
if out.get("error").is_none() {
self.remote_publish();
if let Some(o) = out.as_object_mut() {
o.entry("version").or_insert_with(|| json!(remote::hub().version()));
}
}
out
}
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
SyncKind::Pull { client, since, config, retry } => self.brain_pull(&client, since, config, retry),
SyncKind::Models(name) => {
let kind = serde_json::from_value::<crate::providers::ProviderKind>(json!(name)).ok();
match kind {
Some(kind) => {
let ps = self.state.provider(kind);
/btw 支線、送出先顯示;公測前的安全與資源修正(帳號盜用、灌爆、團隊權限、背景指令與連線的上限和清理) 支線與介面 - /btw:Bot 的分身帶著同一段對話和記憶平行做另一件事,做完回報到主聊天;主線在忙時先判斷會不會衝突,會就等主線做完 - 螢幕一次只給一輪工作操作(所有 Bot 適用) - 「/」只列指令,打字才找這個 Bot 自己的技能 - Bot 工作中送出的訊息立刻以淡色顯示(電腦、手機) - 支線修正:沒被讀到的回報照常進聊天、卡片顯示結果、可回答支線的問題、重新產生不吃掉卡片和回報 安全(中繼伺服器) - 大腦回傳的內容只放行安全類型並加沙箱;團隊改成邀請制;手機不照大腦說的類型開檔案 - 沒登入的請求最多 256 KB、接收中的上傳有總量上限、單一 IP 連線上限、常駐連線另計 - 登入次數加上每帳號上限並先計數再驗證;密碼雜湊同時最多 4 個 - 新增電腦要 15 分鐘內剛登入;可改密碼;註冊限速,有邀請碼時第一個帳號也要 - 發布的網站不能送表單和對外連線;Caddy 加安全標頭 安全(大腦) - 區網(明文)不能打開直接操作、加一律允許規則、加連接器;區網登入 30 天沒用失效 - 團隊成員只看得到勾選「團隊成員可以使用」的 Bot - 沒有角色的請求一律拒絕;環境變數的金鑰只送官方位址 資源 - 中繼:小變動每分鐘寫一次、回應有總時限、每台電腦呼叫上限、網站/登入/電腦/配對碼上限、資料檔壞掉不啟動 - App:伺服器回錯誤和連線秒斷時逐次退避;區網看螢幕偵測斷線 - 背景指令:刪 Bot 和支線結束時停掉、最多 24 個、結束 10 分鐘後移除、可用 stop 停掉 - 截圖在收起和歸檔時釋放;刪 Bot 時刪附件和對照表;每晚清稽核資料和暫存;手機圖片快取上限 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 15:36:34 +00:00
let (base, key) = (crate::providers::resolve_base(kind, &ps.base_url), crate::providers::resolve_key_for(kind, &ps.api_key, &ps.base_url));
let reply = r.reply;
// The list can take a while; the app doesn't wait for it.
std::thread::spawn(move || {
let _ = reply.send(match crate::providers::list_models(kind, &base, &key) {
Ok(models) => json!({"models": models}),
Err(e) => json!({"error": e}),
});
});
continue;
}
None => json!({"error": "大腦不認得這個模型服務(兩邊 AnyBot 版本不同?)"}),
}
}
SyncKind::Edit(body) => {
if self.mir.on {
json!({"error": "這台 AnyBot 本身連著別的大腦"})
} else {
self.brain_edit(&body)
}
}
};
let _ = r.reply.send(v);
}
}
/// Keep the settings fingerprint fresh (at most once a second) so screens hear of edits.
pub(super) fn brain_watch(&mut self) {
if self.mir.on || !self.dirty || self.scr.cfg_at.map(|t| t.elapsed().as_millis() < 1000).unwrap_or(false) {
return;
}
self.scr.cfg_at = Some(Instant::now());
let mut c = config_json(&mut self.state);
redact(&mut c);
self.scr.cfg_hash = hash_value(&c);
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
fn brain_pull(&mut self, client: &str, since: u64, config: bool, retry: bool) -> Value {
self.brain_pull_at(remote::hub().version(), client, since, config, retry)
}
/// brain_pull at the brain's `version` (what the hub has published). `retry`: the screen's
/// last pull failed — the answer may have been lost even when it carried the same version
/// (a long poll that ran out answers with what it has), so it counts from the answer before.
fn brain_pull_at(&mut self, version: u64, client: &str, since: u64, config: bool, retry: bool) -> Value {
if self.mir.on {
return json!({"error": "這台 AnyBot 本身連著別的大腦"});
}
// Forget screens not heard from in a day.
self.scr.seen.retain(|_, s| s.at.map(|t| t.elapsed().as_secs() < 86_400).unwrap_or(false));
let seen = self.scr.seen.entry(client.to_string()).or_default();
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
// A screen that missed the last answer starts again from the one before (what it still
// holds); one that is new, or missed more, gets everything again.
if since == 0 {
*seen = Seen::default();
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
} else {
// (From an answer older than what the screen holds is safe: it only sends more.)
let prev_fits = seen.prev.as_ref().is_some_and(|p| p.version == since || (retry && p.version <= since));
if prev_fits && (seen.version != since || retry) {
if let Some(p) = seen.prev.take() {
*seen = *p;
}
} else if seen.version != since {
*seen = Seen::default();
}
}
seen.prev = None;
seen.prev = Some(Box::new(seen.clone()));
// A screen that just started from its copy: the settings come along regardless.
if config {
seen.config = 0;
}
seen.at = Some(Instant::now());
seen.version = version;
let acked = self.scr.acked.get(client).copied().unwrap_or(0);
let mut out = json!({"version": version, "brain": self.state.remote.host_name, "edit_seq": acked});
let mut c = config_json(&mut self.state);
redact(&mut c);
let ch = hash_value(&c);
if seen.config != ch {
seen.config = ch;
out["config"] = c;
}
let mut bots = vec![];
let mut threads = vec![];
for b in &self.state.bots {
let sigs: Vec<u64> = b.messages.iter().map(msg_sig).collect();
let old = seen.bots.get(&b.id);
let from = match old {
Some(o) => o.iter().zip(sigs.iter()).position(|(a, b)| a != b).unwrap_or(o.len().min(sigs.len())),
None => 0,
};
if old.map(|o| o.len() != sigs.len() || from < sigs.len()).unwrap_or(true) {
bots.push(json!({"id": b.id, "from": from, "messages": &b.messages[from..]}));
}
seen.bots.insert(b.id, sigs);
let ts = threads_sig(b);
if seen.threads.get(&b.id) != Some(&ts) {
seen.threads.insert(b.id, ts);
threads.push(json!({"id": b.id, "threads": b.threads}));
}
}
seen.bots.retain(|id, _| self.state.bots.iter().any(|b| b.id == *id));
out["bots"] = Value::Array(bots);
out["threads"] = Value::Array(threads);
out["live"] = self.streams.iter().map(|(id, l)| (id.to_string(), json!({"status": l.status, "paused": l.paused}))).collect::<serde_json::Map<_, _>>().into();
out["approvals"] = self
.approvals
.iter()
.map(|(id, a)| {
let kind = match a.kind {
ApprovalKind::Action => "action",
ApprovalKind::EnableTools => "tools",
ApprovalKind::EnableThisComputer => "local",
ApprovalKind::Handoff => "handoff",
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
ApprovalKind::Question => "question",
};
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
// key: this card's (on_new_approval); the screen sends it back with its answer.
json!({"bot": id, "call_id": a.call_id, "tool": a.tool, "reason": a.reason, "grant": a.grant, "kind": kind, "key": self.ask_keys.get(id).cloned().unwrap_or_default()})
})
.collect();
// The connectors run here too: whether each is connected, or why not.
out["mcp"] = self.mcp_state_for_screen();
// ChatGPT 方案: whether the brain's account can be used (never its tokens).
out["chatgpt"] = crate::chatgpt::view();
// The bots' computer lives here; a screen shows its state, not its own computer's.
let run = crate::cloudbox::run_state();
feat: 每個 Bot 一個螢幕——Bot 的電腦上各有自己的螢幕和瀏覽器,支線另開暫時的螢幕,右側面板和「全部螢幕」看得到每一個 照 Grok Bot 的分法:一台電腦、每個 Bot 一個螢幕,大家同時做互不干擾。使用者自己的電腦只有一個實體螢幕,還是一次一個 Bot。 - box:anybot-screen(up/down/list/reap)開關每個 Bot 的螢幕,同時最多 6 個,閒置 10 分鐘關掉;browser 每個螢幕自己的設定檔(第一次從共用的複製登入;支線 <key>-t<n> 從主線那份複製,關掉時刪掉);start.sh 給每個螢幕 VNC token;Bot 電腦升到版本 10 - cloudbox:每個螢幕有自己的狀態(編號、尺寸、貼上檔、瀏覽器埠),指令開的視窗出現在它的 Bot 的螢幕上;branch_screen、close_screen、open_screens、thumbnail_of - agent:在 Bot 的電腦上,一輪用它自己的螢幕(支線用暫時的),佔用照螢幕算 - 支線結束時關掉它的暫時螢幕 - 畫面:右側「電腦」顯示目前 Bot 的螢幕;群組跟著正在回答的成員,「成員」卡片點小畫面就固定顯示那個成員;「全部螢幕(N)」一格一個螢幕;接管時只停那個 Bot;手機和中繼帶上要看哪個 Bot 的螢幕 - 群組和支線的系統指示:看不到彼此開著的網頁,交棒時寫網址或檔案路徑 - 功能地圖:screen、team、computers、browser Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha4mzWbjJAWAsDVuBun
2026-11-15 08:12:09 +00:00
out["box"] = json!({"label": run.label(), "running": run.is_running(), "available": crate::cloudbox::available(), "busy": crate::cloudbox::is_busy(), "screens": self.tiles_json()});
// Which computers each bot has (only the brain knows the account's other computers).
out["computers"] = self
.state
.bots
.iter()
.map(|b| {
let t = self.targets_for(b);
let r = self.roles_for(b, &t);
let (current, missing) = Self::chosen_computer(b, &t, &r);
let names: Vec<Value> = t.iter().map(|x| json!({"name": x.name, "kind": computer_kind(x, &r)})).collect();
Bot 個人檔案:soul、擅長、技能、能力、可用電腦、同事名冊;例行任務每輪開新對話(省 token) 每個 Bot 是獨立的個體(src/profile.rs、src/app/profile_ui.rs) - 新欄位:soul(只有自己讀,放在提示最前面)、擅長、不找它做的事、會的技能、能力、可以用的電腦 - 同事名冊:每個 Bot 的提示裡一行一個其他 Bot(簡介、擅長、不找它、在哪幾台電腦),不含別人的 soul 和記憶;順序固定,吃得到快取 - 能力 11 類(上網、瀏覽器、螢幕、檔案與指令、Mac App、連接器、電話簡訊 X、例行任務、頁面、 合作、管理 App):沒勾的工具不提供、規則不寫進提示;硬叫會被 agent 擋下並說該找誰 - 技能:說明只列自己會的,use_skill 只讀得到自己的;自己學會的自動算它的 - 可以用的電腦:自己的電腦一定可以;預設電腦不在名單時回到自己的電腦,不誤報「沒有連線」; 其他畫面也拿得到完整電腦清單來勾;匯出 Bot 不帶電腦名單和草稿 - 舊 Bot 全部勾選(None = 全部),行為不變 - 例行任務:每輪只從那則訊息讀起(Message::fresh),提醒先讀頁面/查記憶;聊天畫面不變, 使用者自己的下一則照樣看整段 - 順手修:角色說明結尾的「。」不再變成「。。」 - 實測(照建議勾能力):明日之星固定內容 ~21.7k → ~11.5k token、FSD ~25.5k → ~13.2k; 例行任務每輪歷史最多 ~70k → 幾百 連接器(MCP) - 實測三個連接器都能用(本機用 AnyBot 自己的 MCP client):time(get_current_time)、 fetch(讀 example.com)、SccMCP(82 個工具,唯讀的 system_status 查詢成功;超過 20 個走 find / use,搜尋得到) - 測試:有「連接器」能力的 Bot 拿得到(大的走 find/use、提示有說明),沒有的拿不到,硬叫三種 方式都被擋 - 測試用的假模型伺服器改成讀完整個請求再回,平行跑測試時不再偶發斷線 驗證:macOS cargo test 389 通過(連跑三次);Windows/Linux cargo check 通過 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 09:14:51 +00:00
// (Every computer there is, for the editor's 可以用的電腦.)
let all: Vec<Value> = self.all_targets_for(b).iter().map(|x| json!({"name": x.name, "kind": computer_kind(x, &r)})).collect();
(b.id.to_string(), json!({"names": names, "all": all, "current": current, "missing": missing}))
})
.collect::<serde_json::Map<_, _>>()
.into();
out
}
/// A screen's edits.
pub(super) fn brain_edit(&mut self, body: &Value) -> Value {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
// The same edit again (its answer was lost on the way and the screen sent it once more):
// done once — a 「新增 Bot」 done twice was two bots.
if let (Some(client), Some(seq)) = (body["client"].as_str(), body["seq"].as_u64()) {
if self.scr.acked.get(client).is_some_and(|&done| seq <= done) {
return json!({"ok": true, "applied": 0, "again": true});
}
}
let mut applied = 0;
let total = body["ops"].as_array().map(|a| a.len()).unwrap_or(0);
for op in body["ops"].as_array().into_iter().flatten() {
let ok = match op["op"].as_str().unwrap_or("") {
"set" => self.brain_set_top(op["key"].as_str().unwrap_or(""), op["value"].clone()),
"bot_add" => {
let mut v = op["bot"].clone();
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
unredact(&mut v, &Value::Null);
match serde_json::from_value::<Bot>(v.take()) {
Ok(mut b) => {
if b.id == 0 || self.state.bot(b.id).is_some() {
b.id = self.state.next_id.max(1);
}
self.state.next_id = self.state.next_id.max(b.id + 1);
self.state.bots.push(b);
self.state.fix_primary();
true
}
Err(_) => false,
}
}
"bot_del" => {
let id = op["id"].as_u64().unwrap_or(0);
if self.state.bot(id).is_none() {
false
} else {
self.stop(id);
/btw 支線、送出先顯示;公測前的安全與資源修正(帳號盜用、灌爆、團隊權限、背景指令與連線的上限和清理) 支線與介面 - /btw:Bot 的分身帶著同一段對話和記憶平行做另一件事,做完回報到主聊天;主線在忙時先判斷會不會衝突,會就等主線做完 - 螢幕一次只給一輪工作操作(所有 Bot 適用) - 「/」只列指令,打字才找這個 Bot 自己的技能 - Bot 工作中送出的訊息立刻以淡色顯示(電腦、手機) - 支線修正:沒被讀到的回報照常進聊天、卡片顯示結果、可回答支線的問題、重新產生不吃掉卡片和回報 安全(中繼伺服器) - 大腦回傳的內容只放行安全類型並加沙箱;團隊改成邀請制;手機不照大腦說的類型開檔案 - 沒登入的請求最多 256 KB、接收中的上傳有總量上限、單一 IP 連線上限、常駐連線另計 - 登入次數加上每帳號上限並先計數再驗證;密碼雜湊同時最多 4 個 - 新增電腦要 15 分鐘內剛登入;可改密碼;註冊限速,有邀請碼時第一個帳號也要 - 發布的網站不能送表單和對外連線;Caddy 加安全標頭 安全(大腦) - 區網(明文)不能打開直接操作、加一律允許規則、加連接器;區網登入 30 天沒用失效 - 團隊成員只看得到勾選「團隊成員可以使用」的 Bot - 沒有角色的請求一律拒絕;環境變數的金鑰只送官方位址 資源 - 中繼:小變動每分鐘寫一次、回應有總時限、每台電腦呼叫上限、網站/登入/電腦/配對碼上限、資料檔壞掉不啟動 - App:伺服器回錯誤和連線秒斷時逐次退避;區網看螢幕偵測斷線 - 背景指令:刪 Bot 和支線結束時停掉、最多 24 個、結束 10 分鐘後移除、可用 stop 停掉 - 截圖在收起和歸檔時釋放;刪 Bot 時刪附件和對照表;每晚清稽核資料和暫存;手機圖片快取上限 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 15:36:34 +00:00
self.bot_gone(id);
self.state.bots.retain(|b| b.id != id);
self.state.fix_primary();
true
}
}
"merge" => self.brain_merge_top(op["key"].as_str().unwrap_or(""), &op["value"]),
"patch" => {
let key = op["key"].as_str().unwrap_or("");
let mut v = self.top_value(key);
apply_patch(&mut v, &op["patch"]);
self.brain_set_top(key, v)
}
"bot_patch" => {
let (id, key) = (op["id"].as_u64().unwrap_or(0), op["key"].as_str().unwrap_or(""));
match self.state.bot(id).map(|b| serde_json::to_value(b).ok().map(|v| v[key].clone()).unwrap_or(Value::Null)) {
Some(mut v) => {
let old = v.clone();
apply_patch(&mut v, &op["patch"]);
unredact(&mut v, &old);
self.brain_set_bot(id, key, v)
}
None => false,
}
}
"bot_set" => self.brain_set_bot(op["id"].as_u64().unwrap_or(0), op["key"].as_str().unwrap_or(""), op["value"].clone()),
"bot_read" => match self.state.bot_mut(op["id"].as_u64().unwrap_or(0)) {
Some(b) => {
b.unread = false;
true
}
None => false,
},
"bot_order" => {
let ids: Vec<u64> = op["ids"].as_array().into_iter().flatten().filter_map(Value::as_u64).collect();
self.state.bots.sort_by_key(|b| ids.iter().position(|i| *i == b.id).unwrap_or(usize::MAX));
true
}
_ => false,
};
if ok {
applied += 1;
}
}
if let (Some(client), Some(seq)) = (body["client"].as_str(), body["seq"].as_u64()) {
self.scr.acked.insert(client.to_string(), seq);
// Something was refused: send that screen the settings again, so it drops it.
if applied < total {
if let Some(s) = self.scr.seen.get_mut(client) {
s.config = 0;
}
}
}
if applied > 0 {
self.mark();
// Screens hear of it at once.
self.scr.cfg_at = None;
self.brain_watch();
}
json!({"ok": true, "applied": applied})
}
/// One top-level setting as JSON (with the brain's real keys).
fn top_value(&mut self, key: &str) -> Value {
let bots = std::mem::take(&mut self.state.bots);
let v = serde_json::to_value(&self.state).map(|t| t[key].clone()).unwrap_or(Value::Null);
self.state.bots = bots;
v
}
fn brain_set_top(&mut self, key: &str, mut value: Value) -> bool {
if key.is_empty() || key == "bots" || LOCAL_KEYS.contains(&key) {
return false;
}
let bots = std::mem::take(&mut self.state.bots);
let mut top = serde_json::to_value(&self.state).unwrap_or(Value::Null);
unredact(&mut value, &top[key]);
// Counters never go back (a screen may be behind).
if key.starts_with("next_") {
value = json!(value.as_u64().unwrap_or(0).max(top[key].as_u64().unwrap_or(0)));
}
top[key] = value;
let ok = match serde_json::from_value::<State>(top) {
Ok(mut st) => {
st.remote = std::mem::take(&mut self.state.remote);
self.state = st;
true
}
Err(_) => false,
};
self.state.bots = bots;
ok
}
/// 搬到大腦: add what the brain doesn't have yet (keys it lacks, skills and connectors by name).
fn brain_merge_top(&mut self, key: &str, value: &Value) -> bool {
let bots = std::mem::take(&mut self.state.bots);
let top = serde_json::to_value(&self.state).unwrap_or(Value::Null);
self.state.bots = bots;
let mut cur = top[key].clone();
match (key, &mut cur) {
("providers", Value::Object(o)) => {
for (k, v) in value.as_object().into_iter().flatten() {
let missing = o.get(k).map(|x| x["api_key"].as_str().unwrap_or("").is_empty()).unwrap_or(true);
if missing && v["api_key"].as_str().map(|s| !s.is_empty() && s != REDACTED).unwrap_or(false) {
o.insert(k.clone(), v.clone());
}
}
}
("skills" | "mcp_servers", Value::Array(a)) => {
for v in value.as_array().into_iter().flatten() {
if !a.iter().any(|x| x["name"] == v["name"]) {
a.push(v.clone());
}
}
}
_ => return false,
}
self.brain_set_top(key, cur)
}
fn brain_set_bot(&mut self, id: u64, key: &str, value: Value) -> bool {
if BOT_RUNTIME.contains(&key) {
return false;
}
let Some(i) = self.state.bots.iter().position(|b| b.id == id) else { return false };
let b = &mut self.state.bots[i];
let msgs = std::mem::take(&mut b.messages);
let threads = std::mem::take(&mut b.threads);
let mut v = serde_json::to_value(&*b).unwrap_or(Value::Null);
let mut value = value;
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
unredact(&mut value, &v[key]);
if key == "routines" {
keep_run_times(&mut value, &v["routines"]);
}
v[key] = value;
let ok = match serde_json::from_value::<Bot>(v) {
Ok(nb) => {
*b = nb;
true
}
Err(_) => false,
};
let b = &mut self.state.bots[i];
b.messages = msgs;
b.threads = threads;
ok
}
// ---------- the screen ----------
/// Once at start: a brain was chosen earlier, so show its copy.
pub(super) fn mirror_boot(&mut self) {
if self.mir.started || self.demo {
return;
}
self.mir.started = true;
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
// The same name at the brain as last time (it remembers what this screen holds for a
// day), so a start asks only for what changed since the copy on disk.
let at = read_copy_at();
self.mir.client = if !at.client.is_empty() && at.brain == self.state.remote.brain_id { at.client } else { crate::httpd::random_hex(8) };
// Edits are numbered from the clock: always past the last run's (the brain does each
// number once, see brain_edit).
self.mir.seq = crate::model::now_ms().max(0) as u64;
if !self.state.remote.brain_id.is_empty() && !self.state.remote.host_token.is_empty() {
self.mirror_enter();
}
}
/// Start showing the brain: this computer's own bots are kept aside, untouched.
fn mirror_enter(&mut self) {
let ids: Vec<u64> = self.streams.keys().copied().collect();
for id in ids {
self.stop(id);
}
self.approvals.clear();
let local = self.state.clone();
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
let at = read_copy_at();
let mut resume = 0;
if let Some(copy) = std::fs::read_to_string(cache_path()).ok().and_then(|s| serde_json::from_str::<State>(&s).ok()).filter(|s| !s.bots.is_empty()) {
self.state = copy;
self.keep_local_fields(&local);
// Edits wait for the brain's own answer; the copy may be old.
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
if at.brain == self.state.remote.brain_id && at.client == self.mir.client {
resume = at.version;
}
}
self.mir.base = Value::Null;
self.mir.local = Some(local);
self.mir.on = true;
// The bots' computer is the brain's now; this one's box isn't kept awake.
crate::cloudbox::set_brain(false);
self.mir.online = false;
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
self.mir.version.store(resume, Ordering::SeqCst);
self.mir.applied = resume;
self.mir.entered = false;
self.mir.door_since = Some(Instant::now());
self.mir.pending.lock().unwrap().clear();
self.mir.reason.clear();
self.mir.down_since = None;
*self.mir.status.lock().unwrap() = "正在連到大腦…".into();
self.mirror_worker();
self.mirror_outbox();
crate::tunnel::hello(&self.state.remote.brain_id, self.state.remote.device_link);
}
/// Back to this computer's own bots.
fn mirror_leave(&mut self) {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
self.mirror_flush_copy(true);
self.mir.gen.fetch_add(1, Ordering::SeqCst);
self.mir.on = false;
crate::cloudbox::set_brain(true);
self.mir.online = false;
self.mir.outbox = None;
self.streams.clear();
self.approvals.clear();
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
self.mir.keys.clear();
self.mir.settled.clear();
if let Some(mut local) = self.mir.local.take() {
let mut remote = self.state.remote.clone();
remote.brain_id.clear();
remote.brain_name.clear();
remote.hands_for.clear();
remote.hands_for_name.clear();
copy_own(&mut local, &self.state);
local.remote = remote;
if local.bot(local.selected).is_none() {
local.selected = local.primary_bot;
}
self.state = local;
} else {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
// Never keep REDACTED placeholders as real keys when leaving mirror mode without a saved local state.
let mut v = serde_json::to_value(&self.state).unwrap_or(Value::Null);
clear_redacted(&mut v);
if let Ok(st) = serde_json::from_value::<State>(v) {
self.state = st;
}
self.state.remote.brain_id.clear();
self.state.remote.brain_name.clear();
self.state.remote.hands_for.clear();
self.state.remote.hands_for_name.clear();
}
self.state.save();
self.dirty = false;
crate::tunnel::hello("", self.state.remote.device_link);
}
fn keep_local_fields(&mut self, from: &State) {
copy_own(&mut self.state, from);
let st = &mut self.state;
if st.bot(from.selected).is_some() {
st.selected = from.selected;
} else if st.bot(st.selected).is_none() {
st.selected = st.primary_bot;
}
}
fn mirror_worker(&mut self) {
let gen = self.mir.gen.fetch_add(1, Ordering::SeqCst) + 1;
let (tx, rx) = channel();
self.mir.rx = Some(rx);
self.mir.tx = Some(tx.clone());
fix: 慢的線上長連線不再被切斷;斷線接回馬上重新同步;大腦那一欄看得出是哪一段 計畫 R7。2026-11-17 早上:Mac mini 經 Tailscale 香港中繼連 nobledesktop(約 100 KB/s),大腦整份資料約 5 MB 要 45–55 秒。這台 45 秒沒收到「一則完整訊息」就算斷線,傳到一半被切、螢幕又從頭要整份,一直循環(實測:連線 9:41:48 開、9:42:33 剛好 45 秒時被切;第二次 9:43:55 一樣)。帳號那欄寫已連線、大腦那欄寫「和帳號伺服器的連線斷了」,看不出是哪一段。 - tunnel.rs:Stream 讀到資料就記(bytes_in、receiving);keep() 有資料進來就算還活著(DEAD_SECS 照舊,但量的是真的沒聲音)。call() 過了自己的時間、但連線還在收資料就繼續等(最多 10 分鐘)。link_serial() 給螢幕知道長連線接回了。 - 帳號伺服器(relay)的長連線同樣:Counted 包住 TcpStream,資料進來就算活著(這台上傳大份資料時不會被那端的 60 秒切掉)。要 make update-server 才生效。relay/clippy.toml:主程式的「HTTP 用戶端只能在 net.rs 建」不套用到 relay。 - 螢幕(mirror_ui):等重試時每 0.2 秒看一次長連線,接回就馬上再要(以前最多等 20 秒,這段時間帳號那欄已經寫已連線);記下上次同步的時間、大小、秒數。 - 設定的大腦那一欄:狀態下面分段寫「這台 ↔ 帳號伺服器」「帳號伺服器 ↔ 大腦(在線上/不在線上,帳號伺服器說的)」「上次同步 …(大小、秒數、KB/s)」。 已驗證:cargo test 571 全過、clippy -D warnings 過;relay cargo test 22 全過。新測試:假的帳號伺服器把一則 64 KB 的訊息分 3 秒慢慢送(允許的沉默設成 1 秒),連線不斷;之後真的沒聲音就斷。把「有資料進來就算活著」拿掉,同一個測試失敗:「已連線」後馬上「連線中斷」——就是早上的情況。 未驗證:真的 Tailscale 中繼線路上走一次(要更新這台的 App 和伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:41:15 +00:00
let (g, version, client, s, resync, last_sync) = (self.mir.gen.clone(), self.mir.version.clone(), self.mir.client.clone(), self.state.remote.clone(), self.mir.resync.clone(), self.mir.last_sync.clone());
let repaint = self.repaint_fn();
std::thread::spawn(move || {
let mut backoff = 1u64;
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
// The first answer lets the person in: it brings the settings, and doesn't wait.
let mut first = true;
// The last pull failed: its answer may have been lost on the way (see brain_pull).
let mut retry = false;
while g.load(Ordering::SeqCst) == gen {
let since = if resync.swap(false, Ordering::SeqCst) { 0 } else { version.load(Ordering::SeqCst) };
fix: 慢的線上長連線不再被切斷;斷線接回馬上重新同步;大腦那一欄看得出是哪一段 計畫 R7。2026-11-17 早上:Mac mini 經 Tailscale 香港中繼連 nobledesktop(約 100 KB/s),大腦整份資料約 5 MB 要 45–55 秒。這台 45 秒沒收到「一則完整訊息」就算斷線,傳到一半被切、螢幕又從頭要整份,一直循環(實測:連線 9:41:48 開、9:42:33 剛好 45 秒時被切;第二次 9:43:55 一樣)。帳號那欄寫已連線、大腦那欄寫「和帳號伺服器的連線斷了」,看不出是哪一段。 - tunnel.rs:Stream 讀到資料就記(bytes_in、receiving);keep() 有資料進來就算還活著(DEAD_SECS 照舊,但量的是真的沒聲音)。call() 過了自己的時間、但連線還在收資料就繼續等(最多 10 分鐘)。link_serial() 給螢幕知道長連線接回了。 - 帳號伺服器(relay)的長連線同樣:Counted 包住 TcpStream,資料進來就算活著(這台上傳大份資料時不會被那端的 60 秒切掉)。要 make update-server 才生效。relay/clippy.toml:主程式的「HTTP 用戶端只能在 net.rs 建」不套用到 relay。 - 螢幕(mirror_ui):等重試時每 0.2 秒看一次長連線,接回就馬上再要(以前最多等 20 秒,這段時間帳號那欄已經寫已連線);記下上次同步的時間、大小、秒數。 - 設定的大腦那一欄:狀態下面分段寫「這台 ↔ 帳號伺服器」「帳號伺服器 ↔ 大腦(在線上/不在線上,帳號伺服器說的)」「上次同步 …(大小、秒數、KB/s)」。 已驗證:cargo test 571 全過、clippy -D warnings 過;relay cargo test 22 全過。新測試:假的帳號伺服器把一則 64 KB 的訊息分 3 秒慢慢送(允許的沉默設成 1 秒),連線不斷;之後真的沒聲音就斷。把「有資料進來就算活著」拿掉,同一個測試失敗:「已連線」後馬上「連線中斷」——就是早上的情況。 未驗證:真的 Tailscale 中繼線路上走一次(要更新這台的 App 和伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:41:15 +00:00
let (link_before, bytes_before, t0) = (crate::tunnel::link_serial(), crate::tunnel::bytes_in(), std::time::Instant::now());
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
match remote::sync_pull(&s, since, &client, first, retry) {
Ok(v) => {
backoff = 1;
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
first = false;
retry = false;
if g.load(Ordering::SeqCst) != gen {
break;
}
fix: 慢的線上長連線不再被切斷;斷線接回馬上重新同步;大腦那一欄看得出是哪一段 計畫 R7。2026-11-17 早上:Mac mini 經 Tailscale 香港中繼連 nobledesktop(約 100 KB/s),大腦整份資料約 5 MB 要 45–55 秒。這台 45 秒沒收到「一則完整訊息」就算斷線,傳到一半被切、螢幕又從頭要整份,一直循環(實測:連線 9:41:48 開、9:42:33 剛好 45 秒時被切;第二次 9:43:55 一樣)。帳號那欄寫已連線、大腦那欄寫「和帳號伺服器的連線斷了」,看不出是哪一段。 - tunnel.rs:Stream 讀到資料就記(bytes_in、receiving);keep() 有資料進來就算還活著(DEAD_SECS 照舊,但量的是真的沒聲音)。call() 過了自己的時間、但連線還在收資料就繼續等(最多 10 分鐘)。link_serial() 給螢幕知道長連線接回了。 - 帳號伺服器(relay)的長連線同樣:Counted 包住 TcpStream,資料進來就算活著(這台上傳大份資料時不會被那端的 60 秒切掉)。要 make update-server 才生效。relay/clippy.toml:主程式的「HTTP 用戶端只能在 net.rs 建」不套用到 relay。 - 螢幕(mirror_ui):等重試時每 0.2 秒看一次長連線,接回就馬上再要(以前最多等 20 秒,這段時間帳號那欄已經寫已連線);記下上次同步的時間、大小、秒數。 - 設定的大腦那一欄:狀態下面分段寫「這台 ↔ 帳號伺服器」「帳號伺服器 ↔ 大腦(在線上/不在線上,帳號伺服器說的)」「上次同步 …(大小、秒數、KB/s)」。 已驗證:cargo test 571 全過、clippy -D warnings 過;relay cargo test 22 全過。新測試:假的帳號伺服器把一則 64 KB 的訊息分 3 秒慢慢送(允許的沉默設成 1 秒),連線不斷;之後真的沒聲音就斷。把「有資料進來就算活著」拿掉,同一個測試失敗:「已連線」後馬上「連線中斷」——就是早上的情況。 未驗證:真的 Tailscale 中繼線路上走一次(要更新這台的 App 和伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:41:15 +00:00
// (A long poll that waited for news isn't the line's speed: only answers
// that came quickly or were big count.)
let (bytes, ms) = (crate::tunnel::bytes_in().saturating_sub(bytes_before), t0.elapsed().as_millis() as u64);
*last_sync.lock().unwrap_or_else(|e| e.into_inner()) = Some((crate::model::now_ms(), bytes, if bytes >= 100_000 { ms } else { 0 }));
version.store(v["version"].as_u64().unwrap_or(0), Ordering::SeqCst);
let _ = tx.send(Incoming::Pull(v));
}
Err(e) => {
let _ = tx.send(Incoming::Offline(e));
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
retry = true;
// (A request for everything that failed is asked for again.)
if since == 0 {
resync.store(true, Ordering::SeqCst);
}
// (The version stays: once it is back the brain sends only what changed
// since — it keeps the answer before last for a screen whose answer was
// lost. Starting over sent every chat again, megabytes, on every blip.)
fix: 慢的線上長連線不再被切斷;斷線接回馬上重新同步;大腦那一欄看得出是哪一段 計畫 R7。2026-11-17 早上:Mac mini 經 Tailscale 香港中繼連 nobledesktop(約 100 KB/s),大腦整份資料約 5 MB 要 45–55 秒。這台 45 秒沒收到「一則完整訊息」就算斷線,傳到一半被切、螢幕又從頭要整份,一直循環(實測:連線 9:41:48 開、9:42:33 剛好 45 秒時被切;第二次 9:43:55 一樣)。帳號那欄寫已連線、大腦那欄寫「和帳號伺服器的連線斷了」,看不出是哪一段。 - tunnel.rs:Stream 讀到資料就記(bytes_in、receiving);keep() 有資料進來就算還活著(DEAD_SECS 照舊,但量的是真的沒聲音)。call() 過了自己的時間、但連線還在收資料就繼續等(最多 10 分鐘)。link_serial() 給螢幕知道長連線接回了。 - 帳號伺服器(relay)的長連線同樣:Counted 包住 TcpStream,資料進來就算活著(這台上傳大份資料時不會被那端的 60 秒切掉)。要 make update-server 才生效。relay/clippy.toml:主程式的「HTTP 用戶端只能在 net.rs 建」不套用到 relay。 - 螢幕(mirror_ui):等重試時每 0.2 秒看一次長連線,接回就馬上再要(以前最多等 20 秒,這段時間帳號那欄已經寫已連線);記下上次同步的時間、大小、秒數。 - 設定的大腦那一欄:狀態下面分段寫「這台 ↔ 帳號伺服器」「帳號伺服器 ↔ 大腦(在線上/不在線上,帳號伺服器說的)」「上次同步 …(大小、秒數、KB/s)」。 已驗證:cargo test 571 全過、clippy -D warnings 過;relay cargo test 22 全過。新測試:假的帳號伺服器把一則 64 KB 的訊息分 3 秒慢慢送(允許的沉默設成 1 秒),連線不斷;之後真的沒聲音就斷。把「有資料進來就算活著」拿掉,同一個測試失敗:「已連線」後馬上「連線中斷」——就是早上的情況。 未驗證:真的 Tailscale 中繼線路上走一次(要更新這台的 App 和伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:41:15 +00:00
// …and the moment the lasting connection is back, not after the wait:
// the account row said 已連線 while this one still waited up to 20 s.
let until = std::time::Instant::now() + std::time::Duration::from_secs(backoff);
let mut back = false;
while std::time::Instant::now() < until && g.load(Ordering::SeqCst) == gen {
let now = crate::tunnel::link_serial();
if now != 0 && now != link_before {
back = true;
break;
}
std::thread::sleep(std::time::Duration::from_millis(200));
}
backoff = if back { 1 } else { (backoff * 2).min(20) };
if back {
let _ = tx.send(Incoming::Offline("已重新連上帳號伺服器,正在向大腦要資料…".into()));
}
}
}
repaint();
}
});
}
記憶: a page to see it, a few lines picked while typing, a local model The memory had grown into a list carried whole, a top-14 recalled by a trigram index and pasted into the system prompt with the clock, and a page that broke its own layout. Nobody could see what went to the model, the prompt cache missed every message, and 「記住」 kept saying the same thing twice. Rebuilt per the spec (docs/memory.md): - Three kinds in memory.db: 記得的事 (fact), 做過的事 (event, a line per finished turn), 整理過的 (rollup). Each keeps pinned, uses, last_used, deleted, superseded_by, span. state.json keeps the facts as the copy that syncs; the page reads SQLite. - Search: jieba words ∪ CJK bigrams in an FTS5 unicode61 table (Traditional text goes through Simplified first), weighted share of query terms hit; plus local vectors, vec = clamp((cos−0.35)/0.35). score = max + 0.15×min, events ×0.9. ≥0.15 suggested, ≥0.5 ticked, ≥0.55 carried when nobody chose (3 at most). - What the model gets: the system prompt has the time zone and the pinned memories only, the same every turn. Each person message gets 〔送出時間〕 and 〔相關記憶〕 from Message.memories, built in group_history into a transient Message.context, so the beginning of a chat reads the same next turn (cache hits) and the event log, skills and audit see only what was typed. A memory already carried in view isn't carried again; each carry counts a use. - Picks travel with the message: Cmd::Send / POST send / sync act "memories" (empty = none; absent = the brain chooses, once, saved). - remember finds the like one (cos ≥ 0.85 or the same words) and asks for `replaces`; the old one is superseded, never carried. A fact forgotten and remembered again comes back. New search_memory (query, kind), with dates; read-only. - Nightly on the brain, no model: events past 30 days fold into a line per week (「11/3–11/9 做過的事(14 件):整理照片 ×3…」, ≤400 chars, like with like by words or vectors), weeks past 180 days into months; the folded go to 最近刪除 for 30 days. Facts are never removed. The page offers duplicates, facts unused for half a year, and what can fold now. - Local model: minishlab/potion-multilingual-128M through m2v.rs (same token ids as model2vec-rs on 13/13 sentences, cos ≥ 0.9999, without tokenizers' 1.1 GB). Converted while downloading: vocab.bin, table.i8 (int8 + row scales), dims.json, 137 MB kept of 530 MB; ANYBOT_HF_BASE picks a mirror (now passed into the server's brain container too). Loaded when first needed (34 ms), let go after 10 idle minutes. The brain loads it; a screen only with a document folder set; hands and phones never. 設定 › 一般 › 語意搜尋: 本機模型/Ollama/關閉; a new engine clears every vector. - Three files, three connections: memory.db (backed up nightly, 7 kept), docs.db (a cache), oplog/audit.db (30 days). An old audit.db hands its memories and documents over once and shrinks (a real one: 172 MB → 16 KB). docs_search scans every chunk now, vectors cached in RAM (it stopped at 8000); FTS optimize + VACUUM daily (260 MB of tombstones over 31 MB of text). - API: POST /api/memory (owner) and /api/sync/memory (mirror). Reads answer on the HTTP thread; writes go through phone_act("memory"). - Screens: a memory dialog (Bot menu 記憶…, Bot settings 打開記憶) with counts, live search, filters, suggestions, per-item kind/date/uses and pin/edit/forget/restore; chips above the composer 300 ms after typing stops, with a token estimate; 「帶了 N 條記憶」 under person messages. The phone has the same as a 記憶 tab, chips and tag. Checked: make test passes (app 297, relay 16), with new tests for the scores and thresholds, Traditional Chinese segmentation, remember's dedupe and replaces, two turns sending the same beginning, no double carry, weekly/monthly folding and the trash, and the audit.db move. Brain idle 37 MB as before, ~230 MB with the model loaded; search on the brain 0.2–0.5 ms, 7–44 ms from the phone page. A deadlock found on the way (stats re-taking the lock) is fixed and tested. Docs: docs/memory.md has the whole design; FEATURES.md, protocol, architecture (zh/en), multi-device and install say what changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3SYw9JJ9dXwaNvYh4
2026-11-10 23:46:50 +00:00
pub(super) fn repaint_fn(&self) -> Arc<dyn Fn() + Send + Sync> {
match &self.ctx_handle {
Some(c) => {
let c = c.clone();
Arc::new(move || c.request_repaint())
}
None => Arc::new(|| {}),
}
}
/// Every frame on a screen: take in what the brain sent.
pub(super) fn mirror_tick(&mut self) {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
// (A copy that waited for its turn: written once COPY_EVERY has passed.)
if self.mir.on {
self.mirror_flush_copy(false);
}
if let Some((id, name)) = self.mir.want.take() {
if self.mir.on {
self.mirror_leave();
}
// This computer's hands are for that brain only.
self.state.remote.hands_for = id.clone();
self.state.remote.hands_for_name = name.clone();
self.state.remote.brain_id = id;
self.state.remote.brain_name = name;
self.state.save();
self.mirror_enter();
}
if std::mem::take(&mut self.mir.leave) && self.mir.on {
self.mirror_leave();
}
if !self.mir.on {
return;
}
let mut got = vec![];
if let Some(rx) = &self.mir.rx {
while let Ok(m) = rx.try_recv() {
got.push(m);
}
}
for m in got {
match m {
Incoming::Offline(e) => {
self.mir.online = false;
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
// Keep `self.mir.base` so edits made during a brief disconnect are diffed
// and replayed on top of the brain's config when the connection returns.
self.mir.down_since.get_or_insert_with(Instant::now);
*self.mir.status.lock().unwrap() = format!("連不到大腦:{e}");
self.mir.reason = e;
}
Incoming::File(path) => {
self.mir.fetching.remove(&path);
self.att.thumbs.remove(&path);
}
fix: 第二輪獨立審查的 P1——提醒不算這一輪的要求、安靜那步的起跑期限、斷線時附件不再遺失 - 說了就做的提醒(和 hook 的「還不能結束」)不再被當成這一輪的起點:記下做過的事、學技能與重播、發布前的「這一輪的任務」都從使用者真正的要求算起;回顧裡也不列成「使用者中途說」 - 安靜的那一步:UI 收到提醒時把「第一次回應」期限重設回 120 秒;這一步的輸出以空的思考事件告訴看門狗它正在回答(原本思考不串流的模型 35 秒就被判中斷) - 螢幕電腦斷線時送出附件:上傳也在斷線期間重送;有一個檔案上傳不了就不送文字,整則(文字和附件)放回輸入框;放回時不覆蓋已經打的字 - 等待連上大腦時不開設定、Bot 編輯等視窗(那時改的東西進門後會被丟掉) 已驗證: cargo test 740 通過(新增 a_nudge_is_not_the_person_talking;an_announced_step_is_carried_out_without_the_person 加驗安靜那步的輸出事件);verify-anybot 重跑 chat.md「說了就做」「/ 指令」、autonomy.md「智慧模式一直開著」結果相同,ctl down 無殘留 未驗證: 螢幕電腦斷線時附件重送與退回(要帳號伺服器與第二台電腦,只在程式層修正、無端到端測試);看門狗的 120 秒期限在真的慢模型上(要真的模型);手機頁面畫面那一層(這台沒有 Google Chrome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:44:29 +00:00
Incoming::Unsent { bot, text, atts } => {
// (Put before what was typed since, never in place of it.)
let draft = self.drafts.entry(bot).or_default();
*draft = if draft.trim().is_empty() { text } else { format!("{text}\n{draft}") };
self.att.pending.entry(bot).or_default().extend(atts);
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
}
Incoming::Pull(v) => {
if let Some(e) = v["error"].as_str() {
self.mir.online = false;
self.mir.down_since.get_or_insert_with(Instant::now);
*self.mir.status.lock().unwrap() = e.to_string();
self.mir.reason = e.to_string();
continue;
}
self.mir.online = true;
self.mir.down_since = None;
self.mir.reason.clear();
*self.mir.status.lock().unwrap() = format!("已連到大腦「{}」", v["brain"].as_str().unwrap_or(&self.state.remote.brain_name));
self.mirror_apply(v);
if std::mem::take(&mut self.mir.move_after_join) {
self.mirror_move_local();
}
}
}
}
}
fn mirror_apply(&mut self, v: Value) {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
self.mir.applied = v["version"].as_u64().unwrap_or(0);
// (A brain from before `config=1` may answer a resumed screen without its settings: ask
// for everything once more rather than wait at the door — once, before going in.)
if !v["config"].is_object() && !self.mir.entered {
self.mir.resync.store(true, Ordering::SeqCst);
}
// Edits the brain has taken in are no longer "on the way".
let acked = v["edit_seq"].as_u64().unwrap_or(0);
self.mir.pending.lock().unwrap().retain(|(s, _)| *s > acked);
if v["config"].is_object() {
// What the brain will have once the edits on the way arrive, and on top of that what
// the person changed here and hasn't sent yet.
let inflight: Vec<Value> = self.mir.pending.lock().unwrap().iter().flat_map(|(_, o)| o.clone()).collect();
let unsaved = if self.mir.base.is_object() { diff_ops(&self.mir.base, &config_json(&mut self.state)) } else { vec![] };
let mut base = v["config"].clone();
apply_ops(&mut base, &inflight);
let mut cfg = base.clone();
apply_ops(&mut cfg, &unsaved);
if !unsaved.is_empty() {
self.dirty = true;
}
let local = std::mem::replace(&mut self.state, State::first_run());
match serde_json::from_value::<State>(cfg.clone()) {
Ok(mut st) => {
// Chats stay as they are (they come separately).
let mut old = local.bots.clone();
for b in st.bots.iter_mut() {
if let Some(o) = old.iter_mut().find(|o| o.id == b.id) {
b.messages = std::mem::take(&mut o.messages);
b.threads = std::mem::take(&mut o.threads);
}
}
self.state = st;
self.keep_local_fields(&local);
self.mir.base = base;
}
Err(e) => {
self.state = local;
*self.mir.error.lock().unwrap() = format!("大腦的設定讀不出來(兩邊 AnyBot 版本不同?):{e}");
}
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
// In either way: settings taken, or unreadable and said so (waiting would not help,
// and asking for everything again would only repeat it).
self.mir.entered = true;
}
for d in v["bots"].as_array().into_iter().flatten() {
let id = d["id"].as_u64().unwrap_or(0);
let from = d["from"].as_u64().unwrap_or(0) as usize;
let mut msgs: Vec<Message> = serde_json::from_value(d["messages"].clone()).unwrap_or_default();
self.mirror_files(&mut msgs);
if let Some(b) = self.state.bot_mut(id) {
// The brain sends what changed from message `from` on, sure this copy has the
// ones before. A copy that is shorter (cleared here, or an answer lost on the
// way) would get them appended in the wrong place — the same message twice and
// half-written replies piling up. Ask for the whole chat again instead.
if b.messages.len() < from {
self.mir.resync.store(true, Ordering::SeqCst);
continue;
}
b.messages.truncate(from);
b.messages.extend(msgs);
}
}
for d in v["threads"].as_array().into_iter().flatten() {
if let Some(b) = self.state.bot_mut(d["id"].as_u64().unwrap_or(0)) {
b.threads = serde_json::from_value(d["threads"].clone()).unwrap_or_default();
}
}
// Who is working, and what waits for the person.
let live: HashMap<u64, (Option<String>, bool)> = v["live"].as_object().into_iter().flatten().filter_map(|(k, l)| Some((k.parse().ok()?, (l["status"].as_str().map(String::from), l["paused"].as_bool().unwrap_or(false))))).collect();
self.streams.retain(|id, _| live.contains_key(id));
for (id, (status, paused)) in live {
let l = self.streams.entry(id).or_insert_with(|| Live {
cancel: Arc::new(AtomicBool::new(false)),
started: Instant::now(),
last: Instant::now(),
produced: true,
status: None,
paused: false,
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
paused_at: None,
unattended: false,
steer: Arc::default(),
turn_id: String::new(),
direct: Arc::default(),
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings Permissions and reach - a file leaving a computer passes the same questions as reading it; "looking" shell commands that do more than look ask first - a symlink out of the work/sealed folder counts as outside it (real paths, not just lexical ones); the search walk skips links - web_fetch and skill_install read the public web only: localhost, the LAN and cloud metadata are refused, at every redirect - preview shows a file without running it; browser_upload may ask - vault: logins no longer match across shared suffixes (pages.dev, com.tw, ...); registrable_domain knows public suffixes - axwrite: found elements are retained (use-after-free) Relay - replacing or turning off 2FA needs the current code (rate-limited); new recovery codes only count once enrollment is verified - a removed computer loses its socket and its `call` access - a site name taken by another account answers 409 - RELAY_TRUST_PROXY: the login lock counts the caller's address, not the proxy's (compose files and README) - httpd: half a body is not a request Desktop - sign-in, join and restore work with 2FA on (code field; --serve reads ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code) - Windows: text was typed twice; modifiers are held through click, drag and scroll; horizontal scroll; screen control is no longer refused - a recording that hits the limit is transcribed, not thrown away - bot's computer: a new home volume restores the snapshot; a snapshot is read through before the home is wiped; a failed volume removal stops reset/restore - events of a stopped turn no longer land in the next one; each channel message gets a turn of its own - saving a bot's settings keeps what it got meanwhile (three-way merge); a save file that cannot be read is kept - pages in Big5/GBK/Shift_JIS are read in their own encoding (encoding_rs); osascript output past 64 KB no longer stalls - pick_tab keeps a job's own non-http tab; pictures larger than the texture limit are fitted; the auto-update time field takes typing - skills live in <data>/skills; memories are unnumbered in the prompt; the phone may skillify and skill_install CI - the test step fails when the tests fail (it piped into tail) Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged. Not run: Windows on a real machine (win.rs type-checked alone), the Docker paths of the bot's computer, the live accessibility writes. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
turn: 0,
});
l.status = status;
l.paused = paused;
l.last = Instant::now();
}
let mut waiting = HashMap::new();
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
self.mir.answered.retain(|_, t| t.elapsed() < std::time::Duration::from_secs(30));
for a in v["approvals"].as_array().into_iter().flatten() {
let id = a["bot"].as_u64().unwrap_or(0);
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
if a["key"].as_str().is_some_and(|k| !k.is_empty() && self.mir.answered.contains_key(k)) {
continue;
}
let kind = match a["kind"].as_str().unwrap_or("") {
"tools" => ApprovalKind::EnableTools,
"local" => ApprovalKind::EnableThisComputer,
"handoff" => ApprovalKind::Handoff,
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
"question" => ApprovalKind::Question,
_ => ApprovalKind::Action,
};
let (reply, _) = channel();
let s = |k: &str| a[k].as_str().unwrap_or("").to_string();
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
waiting.insert(id, (Approval { call_id: s("call_id"), tool: s("tool"), reason: s("reason"), grant: s("grant"), reply, kind }, s("key")));
}
let ctx = self.ctx_handle.clone();
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
for (id, (a, key)) in waiting {
// A new card is told by the brain's key (call ids repeat: call_0 every round); an
// older brain sends none, and then by its call id, as before.
let new = match key.is_empty() {
true => self.approvals.get(&id).map(|o| o.call_id != a.call_id).unwrap_or(true),
false => !self.approvals.contains_key(&id) || self.mir.keys.get(&id) != Some(&key),
};
self.approvals.insert(id, a);
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
if key.is_empty() {
self.mir.keys.remove(&id);
} else {
self.mir.keys.insert(id, key.clone());
}
if new {
if let Some(c) = &ctx {
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
match key.is_empty() {
true => self.on_new_approval(c, id),
false => self.new_approval_keyed(c, id, key),
}
}
}
}
if v["box"].is_object() {
self.mir.box_state = v["box"].clone();
}
if v["mcp"].is_object() {
self.mir.mcp_state = v["mcp"].clone();
}
if v["chatgpt"].is_object() {
crate::chatgpt::set_brain_view(v["chatgpt"].clone());
}
if let Some(c) = v["computers"].as_object() {
self.mir.computers = c.iter().filter_map(|(k, x)| Some((k.parse().ok()?, x.clone()))).collect();
}
let keep: Vec<u64> = v["approvals"].as_array().into_iter().flatten().filter_map(|a| a["bot"].as_u64()).collect();
self.approvals.retain(|id, _| keep.contains(id));
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
self.mir.keys.retain(|id, _| keep.contains(id));
if self.state.bot(self.state.selected).is_none() {
self.state.selected = self.state.primary_bot;
}
// 朗讀每個回答: the brain finishes the turns, this screen reads them (a brain on a server
// has nobody to read to). Its answer came in this same update.
let turns: Vec<(u64, Option<TurnSettlement>)> = self.state.bots.iter().map(|b| (b.id, b.last_turn.clone())).collect();
for id in just_finished(&mut self.mir.settled, turns.iter().map(|(id, t)| (*id, t.as_ref())), chrono::Utc::now().timestamp_millis()) {
self.read_reply(id);
}
self.mirror_save_copy();
}
/// Files in the brain's chats live on the brain: show local copies, fetched once.
fn mirror_files(&mut self, msgs: &mut [Message]) {
for a in msgs.iter_mut().flat_map(|m| m.attachments.iter_mut()) {
if std::path::Path::new(&a.path).exists() {
continue;
}
let local = local_copy(&a.path, &a.name);
let lp = local.display().to_string();
let brain_path = std::mem::replace(&mut a.path, lp.clone());
if local.exists() || !self.mir.fetching.insert(lp.clone()) {
continue;
}
let (s, tx, repaint) = (self.state.remote.clone(), self.mir.tx.clone(), self.repaint_fn());
std::thread::spawn(move || {
if let Ok(bytes) = remote::sync_file(&s, &brain_path) {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
if let Some(dir) = local.parent() {
crate::httpd::ensure_private_dir(dir);
}
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let _ = crate::httpd::write_private(&local, &bytes);
}
if let Some(tx) = tx {
let _ = tx.send(Incoming::File(lp));
}
repaint();
});
}
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
/// The copy on disk, soon: at most every COPY_EVERY, serialized and written on a thread of
/// its own (cloning the state is cheap: the chats are shared, see shared.rs).
fn mirror_save_copy(&mut self) {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
self.mir.copy_dirty = true;
self.mirror_flush_copy(false);
}
/// Write the waiting copy if it is time (or `now`: leaving the brain, quitting).
pub(super) fn mirror_flush_copy(&mut self, now: bool) {
if !self.mir.copy_dirty || self.mir.copy_writing.load(Ordering::Acquire) {
return;
}
if !now && self.mir.copy_at.is_some_and(|t| t.elapsed() < COPY_EVERY) {
return;
}
self.mir.copy_dirty = false;
self.mir.copy_at = Some(Instant::now());
let snap = self.state.clone();
// (Version 0: a message was still on its way — this copy is not one to resume from.)
let at = CopyAt {
brain: self.state.remote.brain_id.clone(),
client: self.mir.client.clone(),
version: if self.mir.sending.load(Ordering::Acquire) == 0 { self.mir.applied } else { 0 },
};
let writing = self.mir.copy_writing.clone();
writing.store(true, Ordering::Release);
let write = move || {
// The copy first, then what it is: a stop between the two leaves an older marker,
// which only means more is asked for next time.
let _ = std::fs::remove_file(copy_at_path());
if let Ok(s) = serde_json::to_string(&snap) {
if crate::httpd::write_private(&cache_path(), s.as_bytes()).is_ok() {
if let Ok(a) = serde_json::to_vec(&at) {
let _ = crate::httpd::write_private(&copy_at_path(), &a);
}
}
}
writing.store(false, Ordering::Release);
};
if now {
write();
} else {
std::thread::spawn(write);
}
}
/// Saving on a screen: edits go to the brain; this computer's own file keeps its own bots.
pub(super) fn mirror_save(&mut self) {
if let Some(local) = self.mir.local.as_mut() {
copy_own(local, &self.state);
local.save();
}
if !self.mir.online || !self.mir.base.is_object() {
return;
}
let cur = config_json(&mut self.state);
let ops = diff_ops(&self.mir.base, &cur);
if ops.is_empty() {
return;
}
self.mir.base = cur;
self.mir.seq += 1;
let seq = self.mir.seq;
self.mir.pending.lock().unwrap().push((seq, ops.clone()));
self.mirror_out(Out::Edit { seq, ops });
}
fn mirror_out(&mut self, o: Out) {
if let Some(tx) = &self.mir.outbox {
let _ = tx.send(o);
}
}
/// One worker sends everything to the brain in order (a rename before the message that uses
/// it, two quick edits in the order they were made).
fn mirror_outbox(&mut self) {
let (tx, rx) = channel::<Out>();
self.mir.outbox = Some(tx);
let (s, err, client, pending, resync) = (self.state.remote.clone(), self.mir.error.clone(), self.mir.client.clone(), self.mir.pending.clone(), self.mir.resync.clone());
let (note, busy) = (self.mir.move_note.clone(), self.mir.moving.clone());
let repaint = self.repaint_fn();
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
let back = self.mir.tx.clone();
let sending = self.mir.sending.clone();
std::thread::spawn(move || {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
// Said while a try is sent again (the line is down for a moment).
let waiting = || {
*err.lock().unwrap() = "網路不穩,正在重新傳送…".into();
repaint();
};
for o in rx {
match o {
Out::Edit { seq, ops } => {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
if let Err(e) = remote::sync_post_sure(&s, "edit", &json!({"ops": ops, "client": client, "seq": seq}), &waiting) {
*err.lock().unwrap() = format!("剛才的改動沒有存到大腦:{e}");
pending.lock().unwrap().retain(|(n, _)| *n != seq);
resync.store(true, Ordering::SeqCst);
}
}
Out::Act(body) => {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
if let Err(e) = remote::sync_post_sure(&s, "act", &body, &waiting) {
*err.lock().unwrap() = format!("大腦沒有收到:{e}");
}
}
Out::McpReconnect(name) => {
if let Err(e) = remote::sync_post(&s, "mcp", &json!({"name": name})) {
*err.lock().unwrap() = format!("大腦沒有重新連線:{e}");
}
}
Out::McpRename(old, new) => {
if let Err(e) = remote::sync_post(&s, "mcp-rename", &json!({"name": old, "rename": new})) {
*err.lock().unwrap() = format!("大腦沒有改連接器的名稱:{e}");
}
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
Out::Send { bot, id, text, atts, memories } => {
fix: 第二輪獨立審查的 P1——提醒不算這一輪的要求、安靜那步的起跑期限、斷線時附件不再遺失 - 說了就做的提醒(和 hook 的「還不能結束」)不再被當成這一輪的起點:記下做過的事、學技能與重播、發布前的「這一輪的任務」都從使用者真正的要求算起;回顧裡也不列成「使用者中途說」 - 安靜的那一步:UI 收到提醒時把「第一次回應」期限重設回 120 秒;這一步的輸出以空的思考事件告訴看門狗它正在回答(原本思考不串流的模型 35 秒就被判中斷) - 螢幕電腦斷線時送出附件:上傳也在斷線期間重送;有一個檔案上傳不了就不送文字,整則(文字和附件)放回輸入框;放回時不覆蓋已經打的字 - 等待連上大腦時不開設定、Bot 編輯等視窗(那時改的東西進門後會被丟掉) 已驗證: cargo test 740 通過(新增 a_nudge_is_not_the_person_talking;an_announced_step_is_carried_out_without_the_person 加驗安靜那步的輸出事件);verify-anybot 重跑 chat.md「說了就做」「/ 指令」、autonomy.md「智慧模式一直開著」結果相同,ctl down 無殘留 未驗證: 螢幕電腦斷線時附件重送與退回(要帳號伺服器與第二台電腦,只在程式層修正、無端到端測試);看門狗的 120 秒期限在真的慢模型上(要真的模型);手機頁面畫面那一層(這台沒有 Google Chrome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:44:29 +00:00
// The files first (each asked again while the line is down); one that can't
// go keeps the whole message here — words without their file would be a
// different message.
let mut paths = vec![];
fix: 第二輪獨立審查的 P1——提醒不算這一輪的要求、安靜那步的起跑期限、斷線時附件不再遺失 - 說了就做的提醒(和 hook 的「還不能結束」)不再被當成這一輪的起點:記下做過的事、學技能與重播、發布前的「這一輪的任務」都從使用者真正的要求算起;回顧裡也不列成「使用者中途說」 - 安靜的那一步:UI 收到提醒時把「第一次回應」期限重設回 120 秒;這一步的輸出以空的思考事件告訴看門狗它正在回答(原本思考不串流的模型 35 秒就被判中斷) - 螢幕電腦斷線時送出附件:上傳也在斷線期間重送;有一個檔案上傳不了就不送文字,整則(文字和附件)放回輸入框;放回時不覆蓋已經打的字 - 等待連上大腦時不開設定、Bot 編輯等視窗(那時改的東西進門後會被丟掉) 已驗證: cargo test 740 通過(新增 a_nudge_is_not_the_person_talking;an_announced_step_is_carried_out_without_the_person 加驗安靜那步的輸出事件);verify-anybot 重跑 chat.md「說了就做」「/ 指令」、autonomy.md「智慧模式一直開著」結果相同,ctl down 無殘留 未驗證: 螢幕電腦斷線時附件重送與退回(要帳號伺服器與第二台電腦,只在程式層修正、無端到端測試);看門狗的 120 秒期限在真的慢模型上(要真的模型);手機頁面畫面那一層(這台沒有 Google Chrome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:44:29 +00:00
let mut failed = None;
for a in &atts {
fix: 第二輪獨立審查的 P1——提醒不算這一輪的要求、安靜那步的起跑期限、斷線時附件不再遺失 - 說了就做的提醒(和 hook 的「還不能結束」)不再被當成這一輪的起點:記下做過的事、學技能與重播、發布前的「這一輪的任務」都從使用者真正的要求算起;回顧裡也不列成「使用者中途說」 - 安靜的那一步:UI 收到提醒時把「第一次回應」期限重設回 120 秒;這一步的輸出以空的思考事件告訴看門狗它正在回答(原本思考不串流的模型 35 秒就被判中斷) - 螢幕電腦斷線時送出附件:上傳也在斷線期間重送;有一個檔案上傳不了就不送文字,整則(文字和附件)放回輸入框;放回時不覆蓋已經打的字 - 等待連上大腦時不開設定、Bot 編輯等視窗(那時改的東西進門後會被丟掉) 已驗證: cargo test 740 通過(新增 a_nudge_is_not_the_person_talking;an_announced_step_is_carried_out_without_the_person 加驗安靜那步的輸出事件);verify-anybot 重跑 chat.md「說了就做」「/ 指令」、autonomy.md「智慧模式一直開著」結果相同,ctl down 無殘留 未驗證: 螢幕電腦斷線時附件重送與退回(要帳號伺服器與第二台電腦,只在程式層修正、無端到端測試);看門狗的 120 秒期限在真的慢模型上(要真的模型);手機頁面畫面那一層(這台沒有 Google Chrome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:44:29 +00:00
match std::fs::read(&a.path).map_err(|e| format!("讀不到這個檔案({e})")).and_then(|b| remote::sync_upload_sure(&s, bot, &a.name, &b, &waiting)) {
Ok(p) => paths.push(p),
fix: 第二輪獨立審查的 P1——提醒不算這一輪的要求、安靜那步的起跑期限、斷線時附件不再遺失 - 說了就做的提醒(和 hook 的「還不能結束」)不再被當成這一輪的起點:記下做過的事、學技能與重播、發布前的「這一輪的任務」都從使用者真正的要求算起;回顧裡也不列成「使用者中途說」 - 安靜的那一步:UI 收到提醒時把「第一次回應」期限重設回 120 秒;這一步的輸出以空的思考事件告訴看門狗它正在回答(原本思考不串流的模型 35 秒就被判中斷) - 螢幕電腦斷線時送出附件:上傳也在斷線期間重送;有一個檔案上傳不了就不送文字,整則(文字和附件)放回輸入框;放回時不覆蓋已經打的字 - 等待連上大腦時不開設定、Bot 編輯等視窗(那時改的東西進門後會被丟掉) 已驗證: cargo test 740 通過(新增 a_nudge_is_not_the_person_talking;an_announced_step_is_carried_out_without_the_person 加驗安靜那步的輸出事件);verify-anybot 重跑 chat.md「說了就做」「/ 指令」、autonomy.md「智慧模式一直開著」結果相同,ctl down 無殘留 未驗證: 螢幕電腦斷線時附件重送與退回(要帳號伺服器與第二台電腦,只在程式層修正、無端到端測試);看門狗的 120 秒期限在真的慢模型上(要真的模型);手機頁面畫面那一層(這台沒有 Google Chrome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:44:29 +00:00
Err(e) => {
failed = Some(format!("「{}」沒有傳到大腦:{e}", a.name));
break;
}
}
}
fix: 第二輪獨立審查的 P1——提醒不算這一輪的要求、安靜那步的起跑期限、斷線時附件不再遺失 - 說了就做的提醒(和 hook 的「還不能結束」)不再被當成這一輪的起點:記下做過的事、學技能與重播、發布前的「這一輪的任務」都從使用者真正的要求算起;回顧裡也不列成「使用者中途說」 - 安靜的那一步:UI 收到提醒時把「第一次回應」期限重設回 120 秒;這一步的輸出以空的思考事件告訴看門狗它正在回答(原本思考不串流的模型 35 秒就被判中斷) - 螢幕電腦斷線時送出附件:上傳也在斷線期間重送;有一個檔案上傳不了就不送文字,整則(文字和附件)放回輸入框;放回時不覆蓋已經打的字 - 等待連上大腦時不開設定、Bot 編輯等視窗(那時改的東西進門後會被丟掉) 已驗證: cargo test 740 通過(新增 a_nudge_is_not_the_person_talking;an_announced_step_is_carried_out_without_the_person 加驗安靜那步的輸出事件);verify-anybot 重跑 chat.md「說了就做」「/ 指令」、autonomy.md「智慧模式一直開著」結果相同,ctl down 無殘留 未驗證: 螢幕電腦斷線時附件重送與退回(要帳號伺服器與第二台電腦,只在程式層修正、無端到端測試);看門狗的 120 秒期限在真的慢模型上(要真的模型);手機頁面畫面那一層(這台沒有 Google Chrome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:44:29 +00:00
let sent = match failed {
Some(e) => Err(e),
None => {
let mut body = json!({"bot": bot, "action": "send", "id": id, "text": text, "attachments": paths});
if let Some(m) = memories {
body["memories"] = json!(m);
}
remote::sync_post_sure(&s, "act", &body, &waiting).map(|_| ())
}
};
if let Err(e) = sent {
let back_in = if text.trim_start().starts_with('/') { "" } else { "(已放回輸入框)" };
*err.lock().unwrap() = format!("訊息沒有送到大腦{back_in}:{e}");
fix: 第二輪獨立審查的 P1——提醒不算這一輪的要求、安靜那步的起跑期限、斷線時附件不再遺失 - 說了就做的提醒(和 hook 的「還不能結束」)不再被當成這一輪的起點:記下做過的事、學技能與重播、發布前的「這一輪的任務」都從使用者真正的要求算起;回顧裡也不列成「使用者中途說」 - 安靜的那一步:UI 收到提醒時把「第一次回應」期限重設回 120 秒;這一步的輸出以空的思考事件告訴看門狗它正在回答(原本思考不串流的模型 35 秒就被判中斷) - 螢幕電腦斷線時送出附件:上傳也在斷線期間重送;有一個檔案上傳不了就不送文字,整則(文字和附件)放回輸入框;放回時不覆蓋已經打的字 - 等待連上大腦時不開設定、Bot 編輯等視窗(那時改的東西進門後會被丟掉) 已驗證: cargo test 740 通過(新增 a_nudge_is_not_the_person_talking;an_announced_step_is_carried_out_without_the_person 加驗安靜那步的輸出事件);verify-anybot 重跑 chat.md「說了就做」「/ 指令」、autonomy.md「智慧模式一直開著」結果相同,ctl down 無殘留 未驗證: 螢幕電腦斷線時附件重送與退回(要帳號伺服器與第二台電腦,只在程式層修正、無端到端測試);看門狗的 120 秒期限在真的慢模型上(要真的模型);手機頁面畫面那一層(這台沒有 Google Chrome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:44:29 +00:00
// Take back the message shown ahead of time; its words and files go back to the input.
resync.store(true, Ordering::SeqCst);
// (A command a button sent — 「/goal clear」 — isn't the person's words: it
// doesn't go into the input, where it would join what they type next.)
if let Some(tx) = back.as_ref().filter(|_| !text.trim_start().starts_with('/')) {
fix: 第二輪獨立審查的 P1——提醒不算這一輪的要求、安靜那步的起跑期限、斷線時附件不再遺失 - 說了就做的提醒(和 hook 的「還不能結束」)不再被當成這一輪的起點:記下做過的事、學技能與重播、發布前的「這一輪的任務」都從使用者真正的要求算起;回顧裡也不列成「使用者中途說」 - 安靜的那一步:UI 收到提醒時把「第一次回應」期限重設回 120 秒;這一步的輸出以空的思考事件告訴看門狗它正在回答(原本思考不串流的模型 35 秒就被判中斷) - 螢幕電腦斷線時送出附件:上傳也在斷線期間重送;有一個檔案上傳不了就不送文字,整則(文字和附件)放回輸入框;放回時不覆蓋已經打的字 - 等待連上大腦時不開設定、Bot 編輯等視窗(那時改的東西進門後會被丟掉) 已驗證: cargo test 740 通過(新增 a_nudge_is_not_the_person_talking;an_announced_step_is_carried_out_without_the_person 加驗安靜那步的輸出事件);verify-anybot 重跑 chat.md「說了就做」「/ 指令」、autonomy.md「智慧模式一直開著」結果相同,ctl down 無殘留 未驗證: 螢幕電腦斷線時附件重送與退回(要帳號伺服器與第二台電腦,只在程式層修正、無端到端測試);看門狗的 120 秒期限在真的慢模型上(要真的模型);手機頁面畫面那一層(這台沒有 Google Chrome) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:44:29 +00:00
let _ = tx.send(Incoming::Unsent { bot, text: text.clone(), atts: atts.clone() });
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
}
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
sending.fetch_sub(1, Ordering::AcqRel);
}
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear - Typing / at the start of the input (computer and phone) lists the skills that are on: names that start with what is typed first, then names containing it, then descriptions (「/簡報」 finds pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the brain recognises 「/name」 and adds a line after the message telling the model to read that skill with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added since is there. - On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」 hands over skills the same way. A refused package leaves no folder behind. - 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除 / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in … before them (the whole of it on hover). - Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
Out::Move { ops, n, skills } => {
let mut said = match remote::sync_post(&s, "edit", &json!({"ops": ops})) {
Ok(_) if n == 0 => "已同步:大腦上已經有這台的 Bot;模型金鑰、技能和連接器有缺的已補上".to_string(),
Ok(_) => format!("已把 {n} 個 Bot(連同聊天)搬到大腦"),
Err(e) => format!("搬移失敗:{e}"),
};
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear - Typing / at the start of the input (computer and phone) lists the skills that are on: names that start with what is typed first, then names containing it, then descriptions (「/簡報」 finds pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the brain recognises 「/name」 and adds a line after the message telling the model to read that skill with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added since is there. - On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」 hands over skills the same way. A refused package leaves no folder behind. - 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除 / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in … before them (the whole of it on hover). - Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
// This computer's skills go up whole (with their files), one by one.
let failed: Vec<String> = skills
.iter()
.filter_map(|k| crate::skills::package_of(k).and_then(|p| remote::sync_post(&s, "skill", &json!({"package": p}))).err().map(|e| format!("「{}」:{e}", k.name)))
.collect();
if !failed.is_empty() {
said.push_str(&format!(";這些技能沒有搬過去:{}", failed.join("、")));
}
*note.lock().unwrap() = said;
busy.store(false, Ordering::SeqCst);
}
Out::Skill { body, note, busy } => {
*note.lock().unwrap() = Some(match skill_request(body).and_then(|b| remote::sync_post(&s, "skill", &b)) {
Ok(v) => (true, v["text"].as_str().unwrap_or("好了").to_string()),
Err(e) => (false, e),
});
busy.store(false, Ordering::SeqCst);
}
}
repaint();
}
});
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
/// A chat action on a screen goes to the brain (named, so a try sent again is done once).
/// While the line is down for a moment it waits in line and goes when it is back.
pub(super) fn mirror_act(&mut self, body: Value) {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
if !self.mirror_can_send() {
*self.mir.error.lock().unwrap() = "連不到大腦,現在只能看。".into();
return;
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
let mut body = body;
if body.is_object() && body.get("id").is_none() {
body["id"] = json!(act_id(&self.mir.client));
}
self.mirror_out(Out::Act(body));
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
/// Whether what the person does here can go to the brain: connected, or connected before
/// and only away for a moment (it is queued and sent when the line is back, for up to a
/// minute). Before the first answer from the brain, nothing can.
pub(super) fn mirror_can_send(&self) -> bool {
self.mir.online || (self.mir.base.is_object() && self.mir.down_since.is_none_or(|t| t.elapsed() < std::time::Duration::from_secs(remote::SURE_SECS)))
}
/// 連接器 › 重新連線 on a screen: the brain connects it again; its line says 連線中… until
/// the brain's next word on it.
pub(super) fn mirror_mcp_rename(&mut self, old: &str, new: &str) {
self.mirror_out(Out::McpRename(old.to_string(), new.to_string()));
}
pub(super) fn mirror_mcp_reconnect(&mut self, name: &str) {
if !self.mir.online {
*self.mir.error.lock().unwrap() = "連不到大腦,現在只能看。".into();
return;
}
if self.mir.mcp_state["servers"].is_object() {
self.mir.mcp_state["servers"][name] = json!({});
}
self.mir.mcp_state["busy"] = json!(true);
self.mirror_out(Out::McpReconnect(name.to_string()));
}
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear - Typing / at the start of the input (computer and phone) lists the skills that are on: names that start with what is typed first, then names containing it, then descriptions (「/簡報」 finds pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the brain recognises 「/name」 and adds a line after the message telling the model to read that skill with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added since is there. - On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」 hands over skills the same way. A refused package leaves no folder behind. - 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除 / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in … before them (the whole of it on hover). - Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
/// 技能 on a screen — add one from the market, install from an address or a folder here,
/// delete one — is done by the brain: the bots read skills from the brain's disk, and a
/// folder left there would bring a deleted skill back when the brain restarts. Turning one
/// on or off stays an ordinary edit. Edits made before go first.
pub(super) fn mirror_skill(&mut self, body: Value, note: SkillNote, busy: Arc<AtomicBool>) {
if !self.mir.online {
*note.lock().unwrap() = Some((false, "連不到大腦,技能沒有改。".into()));
return;
}
if busy.swap(true, Ordering::SeqCst) {
return;
}
*note.lock().unwrap() = None;
if self.dirty {
self.mirror_save();
}
self.mirror_out(Out::Skill { body, note, busy });
}
/// Send a message through the brain: files go up first, then the text.
記憶: a page to see it, a few lines picked while typing, a local model The memory had grown into a list carried whole, a top-14 recalled by a trigram index and pasted into the system prompt with the clock, and a page that broke its own layout. Nobody could see what went to the model, the prompt cache missed every message, and 「記住」 kept saying the same thing twice. Rebuilt per the spec (docs/memory.md): - Three kinds in memory.db: 記得的事 (fact), 做過的事 (event, a line per finished turn), 整理過的 (rollup). Each keeps pinned, uses, last_used, deleted, superseded_by, span. state.json keeps the facts as the copy that syncs; the page reads SQLite. - Search: jieba words ∪ CJK bigrams in an FTS5 unicode61 table (Traditional text goes through Simplified first), weighted share of query terms hit; plus local vectors, vec = clamp((cos−0.35)/0.35). score = max + 0.15×min, events ×0.9. ≥0.15 suggested, ≥0.5 ticked, ≥0.55 carried when nobody chose (3 at most). - What the model gets: the system prompt has the time zone and the pinned memories only, the same every turn. Each person message gets 〔送出時間〕 and 〔相關記憶〕 from Message.memories, built in group_history into a transient Message.context, so the beginning of a chat reads the same next turn (cache hits) and the event log, skills and audit see only what was typed. A memory already carried in view isn't carried again; each carry counts a use. - Picks travel with the message: Cmd::Send / POST send / sync act "memories" (empty = none; absent = the brain chooses, once, saved). - remember finds the like one (cos ≥ 0.85 or the same words) and asks for `replaces`; the old one is superseded, never carried. A fact forgotten and remembered again comes back. New search_memory (query, kind), with dates; read-only. - Nightly on the brain, no model: events past 30 days fold into a line per week (「11/3–11/9 做過的事(14 件):整理照片 ×3…」, ≤400 chars, like with like by words or vectors), weeks past 180 days into months; the folded go to 最近刪除 for 30 days. Facts are never removed. The page offers duplicates, facts unused for half a year, and what can fold now. - Local model: minishlab/potion-multilingual-128M through m2v.rs (same token ids as model2vec-rs on 13/13 sentences, cos ≥ 0.9999, without tokenizers' 1.1 GB). Converted while downloading: vocab.bin, table.i8 (int8 + row scales), dims.json, 137 MB kept of 530 MB; ANYBOT_HF_BASE picks a mirror (now passed into the server's brain container too). Loaded when first needed (34 ms), let go after 10 idle minutes. The brain loads it; a screen only with a document folder set; hands and phones never. 設定 › 一般 › 語意搜尋: 本機模型/Ollama/關閉; a new engine clears every vector. - Three files, three connections: memory.db (backed up nightly, 7 kept), docs.db (a cache), oplog/audit.db (30 days). An old audit.db hands its memories and documents over once and shrinks (a real one: 172 MB → 16 KB). docs_search scans every chunk now, vectors cached in RAM (it stopped at 8000); FTS optimize + VACUUM daily (260 MB of tombstones over 31 MB of text). - API: POST /api/memory (owner) and /api/sync/memory (mirror). Reads answer on the HTTP thread; writes go through phone_act("memory"). - Screens: a memory dialog (Bot menu 記憶…, Bot settings 打開記憶) with counts, live search, filters, suggestions, per-item kind/date/uses and pin/edit/forget/restore; chips above the composer 300 ms after typing stops, with a token estimate; 「帶了 N 條記憶」 under person messages. The phone has the same as a 記憶 tab, chips and tag. Checked: make test passes (app 297, relay 16), with new tests for the scores and thresholds, Traditional Chinese segmentation, remember's dedupe and replaces, two turns sending the same beginning, no double carry, weekly/monthly folding and the trash, and the audit.db move. Brain idle 37 MB as before, ~230 MB with the model loaded; search on the brain 0.2–0.5 ms, 7–44 ms from the phone page. A deadlock found on the way (stats re-taking the lock) is fixed and tested. Docs: docs/memory.md has the whole design; FEATURES.md, protocol, architecture (zh/en), multi-device and install say what changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3SYw9JJ9dXwaNvYh4
2026-11-10 23:46:50 +00:00
pub(super) fn mirror_send(&mut self, bot: u64, text: String, atts: Vec<crate::attach::Attachment>, memories: Option<Vec<String>>) -> bool {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
if !self.mirror_can_send() {
*self.mir.error.lock().unwrap() = "連不到大腦,訊息沒有送出。".into();
return false;
}
// Shown at once; the brain's copy replaces it.
if !self.streams.contains_key(&bot) {
if let Some(b) = self.state.bot_mut(bot) {
記憶: a page to see it, a few lines picked while typing, a local model The memory had grown into a list carried whole, a top-14 recalled by a trigram index and pasted into the system prompt with the clock, and a page that broke its own layout. Nobody could see what went to the model, the prompt cache missed every message, and 「記住」 kept saying the same thing twice. Rebuilt per the spec (docs/memory.md): - Three kinds in memory.db: 記得的事 (fact), 做過的事 (event, a line per finished turn), 整理過的 (rollup). Each keeps pinned, uses, last_used, deleted, superseded_by, span. state.json keeps the facts as the copy that syncs; the page reads SQLite. - Search: jieba words ∪ CJK bigrams in an FTS5 unicode61 table (Traditional text goes through Simplified first), weighted share of query terms hit; plus local vectors, vec = clamp((cos−0.35)/0.35). score = max + 0.15×min, events ×0.9. ≥0.15 suggested, ≥0.5 ticked, ≥0.55 carried when nobody chose (3 at most). - What the model gets: the system prompt has the time zone and the pinned memories only, the same every turn. Each person message gets 〔送出時間〕 and 〔相關記憶〕 from Message.memories, built in group_history into a transient Message.context, so the beginning of a chat reads the same next turn (cache hits) and the event log, skills and audit see only what was typed. A memory already carried in view isn't carried again; each carry counts a use. - Picks travel with the message: Cmd::Send / POST send / sync act "memories" (empty = none; absent = the brain chooses, once, saved). - remember finds the like one (cos ≥ 0.85 or the same words) and asks for `replaces`; the old one is superseded, never carried. A fact forgotten and remembered again comes back. New search_memory (query, kind), with dates; read-only. - Nightly on the brain, no model: events past 30 days fold into a line per week (「11/3–11/9 做過的事(14 件):整理照片 ×3…」, ≤400 chars, like with like by words or vectors), weeks past 180 days into months; the folded go to 最近刪除 for 30 days. Facts are never removed. The page offers duplicates, facts unused for half a year, and what can fold now. - Local model: minishlab/potion-multilingual-128M through m2v.rs (same token ids as model2vec-rs on 13/13 sentences, cos ≥ 0.9999, without tokenizers' 1.1 GB). Converted while downloading: vocab.bin, table.i8 (int8 + row scales), dims.json, 137 MB kept of 530 MB; ANYBOT_HF_BASE picks a mirror (now passed into the server's brain container too). Loaded when first needed (34 ms), let go after 10 idle minutes. The brain loads it; a screen only with a document folder set; hands and phones never. 設定 › 一般 › 語意搜尋: 本機模型/Ollama/關閉; a new engine clears every vector. - Three files, three connections: memory.db (backed up nightly, 7 kept), docs.db (a cache), oplog/audit.db (30 days). An old audit.db hands its memories and documents over once and shrinks (a real one: 172 MB → 16 KB). docs_search scans every chunk now, vectors cached in RAM (it stopped at 8000); FTS optimize + VACUUM daily (260 MB of tombstones over 31 MB of text). - API: POST /api/memory (owner) and /api/sync/memory (mirror). Reads answer on the HTTP thread; writes go through phone_act("memory"). - Screens: a memory dialog (Bot menu 記憶…, Bot settings 打開記憶) with counts, live search, filters, suggestions, per-item kind/date/uses and pin/edit/forget/restore; chips above the composer 300 ms after typing stops, with a token estimate; 「帶了 N 條記憶」 under person messages. The phone has the same as a 記憶 tab, chips and tag. Checked: make test passes (app 297, relay 16), with new tests for the scores and thresholds, Traditional Chinese segmentation, remember's dedupe and replaces, two turns sending the same beginning, no double carry, weekly/monthly folding and the trash, and the audit.db move. Brain idle 37 MB as before, ~230 MB with the model loaded; search on the brain 0.2–0.5 ms, 7–44 ms from the phone page. A deadlock found on the way (stats re-taking the lock) is fixed and tested. Docs: docs/memory.md has the whole design; FEATURES.md, protocol, architecture (zh/en), multi-device and install say what changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3SYw9JJ9dXwaNvYh4
2026-11-10 23:46:50 +00:00
b.messages.push(Message { attachments: atts.clone(), memories: memories.clone().unwrap_or_default(), ..Message::user(&text) });
}
}
// Settings changed just before go first.
if self.dirty {
self.mirror_save();
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
let id = act_id(&self.mir.client);
self.mir.sending.fetch_add(1, Ordering::AcqRel);
self.mirror_out(Out::Send { bot, id, text, atts, memories });
true
}
/// 把這台的 Bot 搬到大腦: copy this computer's own bots (with their chats), keys, skills and
/// connectors to the brain, as new bots there.
pub(super) fn mirror_move_local(&mut self) {
let Some(local) = self.mir.local.clone() else { return };
if self.mir.moving.swap(true, Ordering::SeqCst) {
return;
}
let mut ops: Vec<Value> = vec![];
// Skip what the brain already has: the same starter bot never used here, or a bot moved
// before (same name, same chat).
let last = |b: &Bot| b.messages.last().map(|m| (m.at, m.text.clone()));
let moving: Vec<&Bot> = local
.bots
.iter()
.filter(|b| !self.state.bots.iter().any(|o| o.name == b.name && (b.messages.is_empty() || (o.messages.len() == b.messages.len() && last(o) == last(b)))))
.collect();
for b in moving.iter().copied() {
let mut v = serde_json::to_value(b).unwrap_or(Value::Null);
v["id"] = json!(0);
ops.push(json!({"op": "bot_add", "bot": v}));
}
let top = serde_json::to_value(&local).unwrap_or(Value::Null);
ops.push(json!({"op": "merge", "key": "providers", "value": top["providers"]}));
// Connectors run at the brain: one that names this computer's own folders (e.g.
// 「files」 on ~/Documents) would fail there, so it stays here.
let servers: Vec<&crate::mcp::Server> = local.mcp_servers.iter().filter(|s| !crate::mcp::names_this_computer(s)).collect();
ops.push(json!({"op": "merge", "key": "mcp_servers", "value": servers}));
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear - Typing / at the start of the input (computer and phone) lists the skills that are on: names that start with what is typed first, then names containing it, then descriptions (「/簡報」 finds pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the brain recognises 「/name」 and adds a line after the message telling the model to read that skill with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added since is there. - On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」 hands over skills the same way. A refused package leaves no folder behind. - 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除 / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in … before them (the whole of it on hover). - Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
// Skills the brain doesn't have yet go up with their files (a bare entry in the list
// would leave its scripts on this computer).
let skills: Vec<Skill> = local.skills.iter().filter(|k| !self.state.skills.iter().any(|b| b.name == k.name)).cloned().collect();
let n = moving.len();
*self.mir.move_note.lock().unwrap() = "搬移中…".into();
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear - Typing / at the start of the input (computer and phone) lists the skills that are on: names that start with what is typed first, then names containing it, then descriptions (「/簡報」 finds pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the brain recognises 「/name」 and adds a line after the message telling the model to read that skill with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added since is there. - On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」 hands over skills the same way. A refused package leaves no folder behind. - 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除 / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in … before them (the whole of it on hover). - Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
self.mirror_out(Out::Move { ops, n, skills });
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
/// 連上才進去: a screen of a brain shows nothing of the brain until the brain's first answer
/// is in — then everything it shows is the brain as it is, and works (no old copy to read
/// while edits silently go nowhere, no 「只能看」).
pub(super) fn mirror_waiting_at_door(&self) -> bool {
self.mir.on && !self.demo && !self.mir.entered
}
/// The whole window while it waits at the door: what it is doing, why it can't yet, and a
/// way back to this computer's own bots when the brain stays out of reach.
pub(super) fn mirror_door(&mut self, ui: &mut egui::Ui) {
let p = self.pal;
let name = if self.state.remote.brain_name.trim().is_empty() { t("大腦") } else { self.state.remote.brain_name.clone() };
let status = self.mir.status.lock().unwrap().clone();
let waited = self.mir.door_since.map(|t| t.elapsed().as_secs()).unwrap_or(0);
let full = ui.max_rect();
ui.painter().rect_filled(full, 0.0, p.pane);
let w = 360.0f32.min(full.width() - 32.0);
let mut child = ui.new_child(egui::UiBuilder::new().max_rect(egui::Rect::from_center_size(full.center(), vec2(w, 220.0))).layout(Layout::top_down(Align::Center)));
let ui = &mut child;
super::chat_ui::spinner(ui, 22.0, p.text2);
ui.add_space(12.0);
ui.label(RichText::new(t("正在連到「{name}」…").replace("{name}", &name)).size(FONT_BASE).strong().family(crate::bold()).color(p.text));
ui.add_space(6.0);
let line = if status.is_empty() || status.starts_with("已連到") { t("連上、拿到最新的資料就進去") } else { status };
ui.add(egui::Label::new(RichText::new(line).size(FONT_SM).color(p.text2)).wrap());
// Out of reach for a while: the way back (from 設定 › 手機與帳號 it can be joined again).
if waited >= 10 {
ui.add_space(14.0);
if ui.add(secondary_button("改回用這台自己的 Bot")).on_hover_text(t("之後要再用大腦,到 設定 › 手機與帳號 選它。")).clicked() {
self.mir.leave = true;
}
}
ui.ctx().request_repaint_after(std::time::Duration::from_millis(500));
}
/// The bar above the chat while showing a brain.
pub(super) fn mirror_banner(&mut self, ui: &mut egui::Ui) {
if !self.mir.on {
return;
}
let p = self.pal;
let err = std::mem::take(&mut *self.mir.error.lock().unwrap());
if !err.is_empty() {
self.notice = Some(err);
}
if self.mir.online {
return;
}
// A blip (the account server restarting) isn't worth a warning.
let connecting = self.mir.down_since.is_none();
let (title, reason, tail) = match self.mir.down_since {
None => (format!("正在連到大腦「{}」…", self.state.remote.brain_name), String::new(), String::new()),
Some(t) if t.elapsed().as_secs() < 4 => return,
Some(_) => (format!("連不到大腦「{}」", self.state.remote.brain_name), self.mir.reason.clone(), t("之前的對話還能看,但現在不能傳訊息。連回來後會自動恢復。")),
};
ui.ctx().request_repaint_after(std::time::Duration::from_secs(1));
ui.vertical_centered(|ui| {
ui.set_max_width(TRANSCRIPT_MAX_WIDTH.min(ui.available_width() - 48.0));
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
Frame::new().fill(if connecting { p.hover } else { p.danger.gamma_multiply(0.08) }).corner_radius(R_M).inner_margin(Margin::symmetric(12, 8)).show(ui, |ui| {
ui.vertical(|ui| {
ui.label(RichText::new(title).size(FONT_SM).strong().family(crate::bold()).color(p.text));
for line in [reason, tail] {
if !line.is_empty() {
ui.add(egui::Label::new(RichText::new(line).size(FONT_SM).color(p.text2)).wrap());
}
}
});
});
});
ui.add_space(6.0);
}
}
#[cfg(test)]
mod tests {
fix: 連接器改名不走手機的路、一律允許跟著改名;在別處按 Enter 不再替你允許 - 手機的 /api/act/mcp 不收改名(區網沒加密:讀到一次登入的人可以靠兩次改名,讓別的連接器 接手某個連接器的「一律允許」)。改名只走螢幕電腦的 /api/sync/mcp-rename。 - 改名時每個 Bot 的「一律允許」(mcp:<名稱>)跟著改到新名字;之後別的連接器取舊名字也不會繼承。 - 螢幕電腦上改名不先改本機:請大腦改,新名字隨大腦的更新回來(期間連接器的頁照舊找得到); 大腦沒改成,兩邊都還是舊名字。沒改成的原因:還在那一頁寫在頁上,已經離開就用通知說。 - 審批:聊天裡有等你允許的卡片時,在設定視窗或別的輸入框按 Enter,會被當成「允許」 (main 就有)。現在設定開著、或這一幀開始時游標在別的輸入框,Enter/Esc 不回答卡片。 一張沒有選項的問題卡也不在設定開著時搶走游標。 - 測試:改名的打字測試改成照欄位 id 給游標(平行的測試會換語言、版面跟著變), 原因用頁面記下的字比對。這兩個問題是這個測試在整套一起跑時時好時壞找到的。 已驗證: cargo test 整套連跑 8 次全綠(620);新測試 enter_elsewhere_does_not_approve_the_waiting_step、 a_screen_asks_the_brain_to_rename_a_connector、a_connector_is_never_renamed_through_the_phones_road; the_brain_renames_a_connector_for_a_screen(一律允許跟著改)。 未驗證: 螢幕電腦連真的大腦實際改名(要兩台機器)。 動到審批路徑(approval_dock 的 Enter/Esc):依 CLAUDE.md 需要實機測試+人類簽名,不得自行發佈。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3KhvSzysuKUobKUTR
2026-11-17 10:35:57 +00:00
/// A connector renamed on a screen is asked of the brain (queued for it, in order), not
/// renamed here — the brain's update brings the new name. Without the brain: not at all,
/// and the person is told.
#[test]
fn a_screen_asks_the_brain_to_rename_a_connector() {
let ctx = egui::Context::default();
let mut app = App::new(&ctx, Some(std::env::temp_dir().join("anybot-screen-rename.png")));
app.state.mcp_servers = vec![crate::mcp::Server { name: "gh".into(), url: "https://gh.example/mcp".into(), enabled: true, ..Default::default() }];
app.mir.on = true;
app.mir.online = false;
app.ch.mcp_name = Some(("gh".into(), "gh-work".into()));
app.settle_mcp_name();
assert_eq!(app.state.mcp_servers[0].name, "gh");
assert!(app.notice.as_deref().is_some_and(|n| n.contains("連不到大腦")), "{:?}", app.notice);
let (tx, rx) = channel();
app.mir.outbox = Some(tx);
app.mir.online = true;
app.ch.mcp_name = Some(("gh".into(), "gh-work".into()));
app.settle_mcp_name();
match rx.try_recv() {
Ok(Out::McpRename(a, b)) => assert_eq!((a.as_str(), b.as_str()), ("gh", "gh-work")),
_ => panic!("the brain wasn't asked"),
}
assert_eq!(app.state.mcp_servers[0].name, "gh", "renamed by the brain, not here first");
}
use super::*;
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
/// 螢幕電腦上回答的卡帶著大腦給那張卡的 key(.claude/skills/verify-approval-routing 的
/// ScreenRefreshes → YouAnswerOnScreen → BrainTakesAnswer):大腦只把它交給那張卡。以前
/// 不帶,大腦交給那時候在等的卡(F1)。
#[test]
fn a_screen_answers_only_the_card_it_shows() {
let ctx = egui::Context::default();
let mut brain = App::new(&ctx, Some(std::env::temp_dir().join("anybot-screen-key-brain.png")));
let id = brain.state.bots[0].id;
let card = |app: &mut App, reason: &str, key: &str| {
let (tx, rx) = channel();
app.approvals.insert(id, Approval { call_id: "call_0".into(), tool: "shell".into(), reason: reason.into(), grant: "rm".into(), reply: tx, kind: ApprovalKind::Action });
app.ask_keys.insert(id, key.into());
rx
};
let first = card(&mut brain, "執行指令:ls", "k1");
// ScreenRefreshes:螢幕電腦拿到大腦的 approvals(和每張卡的 key)。
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
let pulled = brain.brain_pull("screen-test", 0, false, false);
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
// (The demo data has another bot's card too.)
let ours = pulled["approvals"].as_array().into_iter().flatten().find(|a| a["bot"] == id).cloned().unwrap_or_default();
assert_eq!(ours["key"], "k1", "{}", pulled["approvals"]);
let mut screen = App::new(&ctx, Some(std::env::temp_dir().join("anybot-screen-key-screen.png")));
screen.mir.on = true;
screen.mir.online = true;
let (otx, orx) = channel();
screen.mir.outbox = Some(otx);
screen.mirror_apply(json!({"approvals": pulled["approvals"].clone()}));
assert!(screen.approvals.contains_key(&id) && screen.mir.keys.get(&id).map(String::as_str) == Some("k1"));
// 大腦那邊,第一張卡在電腦上回答了,第二張(同一個 call_0)在等。
brain.answer(&ctx, id, ApprovalAnswer::Once);
assert_eq!(first.try_recv(), Ok(ApprovalAnswer::Once));
let second = card(&mut brain, "執行指令:rm -rf ~/Documents/報告", "k2");
// YouAnswerOnScreen:螢幕上還是第一張,按「一律允許」。
screen.answer(&ctx, id, ApprovalAnswer::Always("rm".into()));
let body = match orx.try_recv() {
Ok(Out::Act(b)) => b,
_ => panic!("the brain wasn't told"),
};
assert_eq!(body["call"], "k1", "{body}");
// BrainTakesAnswer:api/sync/act 的 answer 照 remote.rs 變成 Cmd::Answer。
fix: 等你允許的卡片第二輪——沒用上的回答照來源說怎麼辦、支線的那一行寫在主線、直接操作放行過的不再說 獨立審查(30c3895,沒有 P0/P1)提的 P2: - 沒用上的回答照它從哪條路來說該怎麼辦(Cmd::Answer 多一個 screen:api/sync/act 是螢幕電腦): 手機沒帶 key →「這個頁面太舊…重新整理」;螢幕電腦沒帶 key →「那台電腦的 AnyBot 比這台舊… 設定 › 更新」;帶了舊 key →「那張卡已經不在等了」。以前螢幕電腦也叫人重新整理(沒用)。 - 支線的卡沒用上時,那一行寫在主線的聊天(home_of):支線的卡顯示在那裡,支線自己的訊息哪裡都 不顯示(手機頁面的 view 也只帶主線的訊息)。 - 「全部允許,之後直接操作」:直接操作打開時放行的「可以用電腦嗎」卡記下它的 key (settled_by_direct),手機接著送來的那個回答不收、也不寫「沒有用上」。 - 手機的卡清單抽成 phone_cards(行為不變),新增測試:支線的卡帶支線自己的 key 和 target、 沒用上寫在主線;直接操作放行過的不寫;手機/螢幕電腦的提示各自對。螢幕電腦的測試改成真的 走到 new_approval_keyed(設 ctx_handle):同一個 call_0、同樣的字再問一次,螢幕自己的 ask_keys 跟著 mir.keys 換、等待 Enter/Esc 的時間重來。 - 功能地圖 phone、computers(比大腦舊的螢幕電腦答不了卡)和 FEATURES.md 跟著改。 - verify-approval-routing:REPLAY 多兩個測試;「沒有放進模型」加上舊帳號伺服器頁面的通知(沒有 from,今天安全的原因)、螢幕電腦推的通知帶大腦的 key、「沒有用上」寫在哪寫什麼;coverage 換成 phone_cards、cmd_answer 的開頭跟著改,對過模型後 rehash(這個 commit 就是新的同步 commit)。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)647 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、7 個重走測試通過;7 個故意改壞都被新測試抓到再改回(支線卡帶主線的 key、支線卡的 target 是主線、支線的那一行寫回支線、螢幕電腦只用 call id 分辨新卡、螢幕電腦給卡自己的 key、直接操作的回答當舊回答說、螢幕電腦也叫人重新整理);verify-anybot:手機上的允許、拒絕、問題卡照樣有用,第三張卡在等時舊 key、沒有 key、舊通知都不算且各自的提示對,/btw 開的支線問題卡顯示在主線、帶支線自己的 key(target 2),用舊 key 回答時「沒有用上」寫進主線的聊天、支線的卡還在等,之後手機上選答案才送到模型(證據 target/verify-anybot/20261118-110817) 未驗證: 真的螢幕電腦(要第二台電腦,舊版螢幕電腦的提示只有單元測試);真的手機推播通知;帳號伺服器的頁面(relay/ 要重新部署);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:09:59 +00:00
let as_sent = |b: &Value| crate::remote::Cmd::Answer { bot: id, answer: b["answer"].as_str().unwrap_or("reject").into(), text: b["text"].as_str().unwrap_or("").into(), call: b["call"].as_str().unwrap_or("").into(), notice: b["from"].as_str() == Some("notice"), screen: true };
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
brain.remote_cmd(&ctx, as_sent(&body));
assert!(second.try_recv().is_err() && brain.state.bot(id).unwrap().allow_rules.is_empty(), "the screen showed ls, not rm -rf");
// 螢幕同步到第二張以後,它的回答才算數。
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
screen.mirror_apply(json!({"approvals": brain.brain_pull("screen-test", 0, false, false)["approvals"].clone()}));
fix: 手機頁面和螢幕電腦的回答只交給它畫出來的那張卡(F1);通知上的按鈕只答允許請求 - 每張卡的 key(on_new_approval 發的)給手機(approval_json;支線的卡用支線自己的)和螢幕電腦 (brain_pull 的 approvals → mir.keys)。手機的允許/一律允許/拒絕、「全部允許,之後直接操作」、 問題卡的送出和略過、螢幕電腦的回答都帶 call。 - Cmd::Answer:key 不是現在在等的那張卡的、或根本沒帶 key(開了很久的舊頁面、舊版螢幕電腦)→ 不收; 有卡在等時聊天寫「沒有用上」。通知送來的(from: "notice")另外要過 notice_answers——放通知按鈕和 收通知回答用同一條規則——而且只收 once/reject:絕不是「我完成了」「略過」或一律允許。 - 螢幕電腦用大腦的 key 分辨新卡(call id 會重複),自己的卡也用那把 key;手機問題卡的表單用 key 分辨;手機畫面的簽章帶 key,新卡一定送到手機。 - verify-approval-routing 跟到修好的程式:程式事實換成現在的、加上卡的種類和 NoticeNeverFinishesHandoff;AllSurfaces 通過,CanAnswer 確認手機頁面、通知、螢幕電腦都還答得到; F1 的重走測試不再 ignore(舊程式會失敗),新增 a_phone_answer_without_its_cards_key_answers_nothing、 a_screen_answers_only_the_card_it_shows;同步 commit 改成「最後一次改 coverage.tsv 的 commit」。 - 功能地圖 phone、safety 和 FEATURES.md 跟著改。 - 部署要注意:帳號伺服器(relay/)自己編進一份手機頁面。它更新以前,用帳號登入的手機送不出 key, 手機上的卡都答不了(安全,但要在電腦上答);直接連線的手機用大腦給的頁面,沒有這個問題。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)644 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;verify-approval-routing 的 run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、5 個重走測試通過;暫時改壞兩次都抓到(大腦收沒帶 key 的回答 → AllSurfaces 違反 AllowOnlyWhatWasSeen、兩個回歸測試失敗;手機不送 key → CanAnswer 不預期地通過),改回後回到基準;verify-anybot(scratch AnyBot、假模型、無頭 Chrome 的手機頁面):手機上的允許、拒絕、問題卡照樣有用;第三張卡在等時,用第二張卡的 key、不帶 key、舊通知(from notice)各送一次都不算、聊天寫「沒有用上」、第三張卡和它的 key 還在,之後手機自己的「允許」才讓它通過(證據 target/verify-anybot/20261118-104552) 未驗證: 真的手機上的推播通知按鈕(要帳號伺服器和 Android 手機);螢幕電腦實機(要第二台電腦登入同一個帳號,只有 mirror_ui 的測試);帳號伺服器給的頁面(relay/ 要重新部署);支線的卡、需要處理卡在手機上的「我完成了」只有單元測試(scratch Bot 沒有可以交給使用者的螢幕);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:48:10 +00:00
screen.answer(&ctx, id, ApprovalAnswer::Reject);
let body = match orx.try_recv() {
Ok(Out::Act(b)) => b,
_ => panic!("the brain wasn't told"),
};
brain.remote_cmd(&ctx, as_sent(&body));
assert_eq!(second.try_recv(), Ok(ApprovalAnswer::Reject));
}
fix: 等你允許的卡片第二輪——沒用上的回答照來源說怎麼辦、支線的那一行寫在主線、直接操作放行過的不再說 獨立審查(30c3895,沒有 P0/P1)提的 P2: - 沒用上的回答照它從哪條路來說該怎麼辦(Cmd::Answer 多一個 screen:api/sync/act 是螢幕電腦): 手機沒帶 key →「這個頁面太舊…重新整理」;螢幕電腦沒帶 key →「那台電腦的 AnyBot 比這台舊… 設定 › 更新」;帶了舊 key →「那張卡已經不在等了」。以前螢幕電腦也叫人重新整理(沒用)。 - 支線的卡沒用上時,那一行寫在主線的聊天(home_of):支線的卡顯示在那裡,支線自己的訊息哪裡都 不顯示(手機頁面的 view 也只帶主線的訊息)。 - 「全部允許,之後直接操作」:直接操作打開時放行的「可以用電腦嗎」卡記下它的 key (settled_by_direct),手機接著送來的那個回答不收、也不寫「沒有用上」。 - 手機的卡清單抽成 phone_cards(行為不變),新增測試:支線的卡帶支線自己的 key 和 target、 沒用上寫在主線;直接操作放行過的不寫;手機/螢幕電腦的提示各自對。螢幕電腦的測試改成真的 走到 new_approval_keyed(設 ctx_handle):同一個 call_0、同樣的字再問一次,螢幕自己的 ask_keys 跟著 mir.keys 換、等待 Enter/Esc 的時間重來。 - 功能地圖 phone、computers(比大腦舊的螢幕電腦答不了卡)和 FEATURES.md 跟著改。 - verify-approval-routing:REPLAY 多兩個測試;「沒有放進模型」加上舊帳號伺服器頁面的通知(沒有 from,今天安全的原因)、螢幕電腦推的通知帶大腦的 key、「沒有用上」寫在哪寫什麼;coverage 換成 phone_cards、cmd_answer 的開頭跟著改,對過模型後 rehash(這個 commit 就是新的同步 commit)。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)647 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、7 個重走測試通過;7 個故意改壞都被新測試抓到再改回(支線卡帶主線的 key、支線卡的 target 是主線、支線的那一行寫回支線、螢幕電腦只用 call id 分辨新卡、螢幕電腦給卡自己的 key、直接操作的回答當舊回答說、螢幕電腦也叫人重新整理);verify-anybot:手機上的允許、拒絕、問題卡照樣有用,第三張卡在等時舊 key、沒有 key、舊通知都不算且各自的提示對,/btw 開的支線問題卡顯示在主線、帶支線自己的 key(target 2),用舊 key 回答時「沒有用上」寫進主線的聊天、支線的卡還在等,之後手機上選答案才送到模型(證據 target/verify-anybot/20261118-110817) 未驗證: 真的螢幕電腦(要第二台電腦,舊版螢幕電腦的提示只有單元測試);真的手機推播通知;帳號伺服器的頁面(relay/ 要重新部署);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:09:59 +00:00
/// The brain asks the same thing again (same call_0, same words) while the screen still
/// shows the first card: only the brain's key tells the two apart. The screen takes the new
/// key as its own card's (ask_keys, which its Enter/Esc and its own notifications go by) in
/// step with mir.keys, starts the new card's wait for keys over, and answers with that key.
#[test]
fn a_screen_keeps_its_cards_key_in_step_with_the_brains() {
let ctx = egui::Context::default();
let mut brain = App::new(&ctx, Some(std::env::temp_dir().join("anybot-screen-step-brain.png")));
let id = brain.state.bots[0].id;
let card = |app: &mut App, key: &str| {
let (tx, rx) = channel();
app.approvals.insert(id, Approval { call_id: "call_0".into(), tool: "shell".into(), reason: "執行指令:rm -rf build".into(), grant: "rm".into(), reply: tx, kind: ApprovalKind::Action });
app.ask_keys.insert(id, key.into());
rx
};
let mut screen = App::new(&ctx, Some(std::env::temp_dir().join("anybot-screen-step-screen.png")));
screen.mir.on = true;
screen.mir.online = true;
screen.ctx_handle = Some(ctx.clone());
let (otx, orx) = channel();
screen.mir.outbox = Some(otx);
let first = card(&mut brain, "k1");
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
screen.mirror_apply(json!({"approvals": brain.brain_pull("screen-step", 0, false, false)["approvals"].clone()}));
fix: 等你允許的卡片第二輪——沒用上的回答照來源說怎麼辦、支線的那一行寫在主線、直接操作放行過的不再說 獨立審查(30c3895,沒有 P0/P1)提的 P2: - 沒用上的回答照它從哪條路來說該怎麼辦(Cmd::Answer 多一個 screen:api/sync/act 是螢幕電腦): 手機沒帶 key →「這個頁面太舊…重新整理」;螢幕電腦沒帶 key →「那台電腦的 AnyBot 比這台舊… 設定 › 更新」;帶了舊 key →「那張卡已經不在等了」。以前螢幕電腦也叫人重新整理(沒用)。 - 支線的卡沒用上時,那一行寫在主線的聊天(home_of):支線的卡顯示在那裡,支線自己的訊息哪裡都 不顯示(手機頁面的 view 也只帶主線的訊息)。 - 「全部允許,之後直接操作」:直接操作打開時放行的「可以用電腦嗎」卡記下它的 key (settled_by_direct),手機接著送來的那個回答不收、也不寫「沒有用上」。 - 手機的卡清單抽成 phone_cards(行為不變),新增測試:支線的卡帶支線自己的 key 和 target、 沒用上寫在主線;直接操作放行過的不寫;手機/螢幕電腦的提示各自對。螢幕電腦的測試改成真的 走到 new_approval_keyed(設 ctx_handle):同一個 call_0、同樣的字再問一次,螢幕自己的 ask_keys 跟著 mir.keys 換、等待 Enter/Esc 的時間重來。 - 功能地圖 phone、computers(比大腦舊的螢幕電腦答不了卡)和 FEATURES.md 跟著改。 - verify-approval-routing:REPLAY 多兩個測試;「沒有放進模型」加上舊帳號伺服器頁面的通知(沒有 from,今天安全的原因)、螢幕電腦推的通知帶大腦的 key、「沒有用上」寫在哪寫什麼;coverage 換成 phone_cards、cmd_answer 的開頭跟著改,對過模型後 rehash(這個 commit 就是新的同步 commit)。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)647 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、7 個重走測試通過;7 個故意改壞都被新測試抓到再改回(支線卡帶主線的 key、支線卡的 target 是主線、支線的那一行寫回支線、螢幕電腦只用 call id 分辨新卡、螢幕電腦給卡自己的 key、直接操作的回答當舊回答說、螢幕電腦也叫人重新整理);verify-anybot:手機上的允許、拒絕、問題卡照樣有用,第三張卡在等時舊 key、沒有 key、舊通知都不算且各自的提示對,/btw 開的支線問題卡顯示在主線、帶支線自己的 key(target 2),用舊 key 回答時「沒有用上」寫進主線的聊天、支線的卡還在等,之後手機上選答案才送到模型(證據 target/verify-anybot/20261118-110817) 未驗證: 真的螢幕電腦(要第二台電腦,舊版螢幕電腦的提示只有單元測試);真的手機推播通知;帳號伺服器的頁面(relay/ 要重新部署);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:09:59 +00:00
assert_eq!((screen.ask_keys.get(&id).map(String::as_str), screen.mir.keys.get(&id).map(String::as_str)), (Some("k1"), Some("k1")));
// The card has been up a while on the screen (its Enter would answer it now).
screen.ask_shown.insert(id, Instant::now() - std::time::Duration::from_secs(2));
// At the brain: answered on its own window, and the same step asks again.
brain.answer(&ctx, id, ApprovalAnswer::Once);
assert_eq!(first.try_recv(), Ok(ApprovalAnswer::Once));
let second = card(&mut brain, "k2");
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
screen.mirror_apply(json!({"approvals": brain.brain_pull("screen-step", 0, false, false)["approvals"].clone()}));
fix: 等你允許的卡片第二輪——沒用上的回答照來源說怎麼辦、支線的那一行寫在主線、直接操作放行過的不再說 獨立審查(30c3895,沒有 P0/P1)提的 P2: - 沒用上的回答照它從哪條路來說該怎麼辦(Cmd::Answer 多一個 screen:api/sync/act 是螢幕電腦): 手機沒帶 key →「這個頁面太舊…重新整理」;螢幕電腦沒帶 key →「那台電腦的 AnyBot 比這台舊… 設定 › 更新」;帶了舊 key →「那張卡已經不在等了」。以前螢幕電腦也叫人重新整理(沒用)。 - 支線的卡沒用上時,那一行寫在主線的聊天(home_of):支線的卡顯示在那裡,支線自己的訊息哪裡都 不顯示(手機頁面的 view 也只帶主線的訊息)。 - 「全部允許,之後直接操作」:直接操作打開時放行的「可以用電腦嗎」卡記下它的 key (settled_by_direct),手機接著送來的那個回答不收、也不寫「沒有用上」。 - 手機的卡清單抽成 phone_cards(行為不變),新增測試:支線的卡帶支線自己的 key 和 target、 沒用上寫在主線;直接操作放行過的不寫;手機/螢幕電腦的提示各自對。螢幕電腦的測試改成真的 走到 new_approval_keyed(設 ctx_handle):同一個 call_0、同樣的字再問一次,螢幕自己的 ask_keys 跟著 mir.keys 換、等待 Enter/Esc 的時間重來。 - 功能地圖 phone、computers(比大腦舊的螢幕電腦答不了卡)和 FEATURES.md 跟著改。 - verify-approval-routing:REPLAY 多兩個測試;「沒有放進模型」加上舊帳號伺服器頁面的通知(沒有 from,今天安全的原因)、螢幕電腦推的通知帶大腦的 key、「沒有用上」寫在哪寫什麼;coverage 換成 phone_cards、cmd_answer 的開頭跟著改,對過模型後 rehash(這個 commit 就是新的同步 commit)。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)647 passed、0 failed,含 featuremap::、layout_audit::、tool_specs_are_locked、approval_decisions_are_characterized(鎖檔沒改);cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh;run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、7 個重走測試通過;7 個故意改壞都被新測試抓到再改回(支線卡帶主線的 key、支線卡的 target 是主線、支線的那一行寫回支線、螢幕電腦只用 call id 分辨新卡、螢幕電腦給卡自己的 key、直接操作的回答當舊回答說、螢幕電腦也叫人重新整理);verify-anybot:手機上的允許、拒絕、問題卡照樣有用,第三張卡在等時舊 key、沒有 key、舊通知都不算且各自的提示對,/btw 開的支線問題卡顯示在主線、帶支線自己的 key(target 2),用舊 key 回答時「沒有用上」寫進主線的聊天、支線的卡還在等,之後手機上選答案才送到模型(證據 target/verify-anybot/20261118-110817) 未驗證: 真的螢幕電腦(要第二台電腦,舊版螢幕電腦的提示只有單元測試);真的手機推播通知;帳號伺服器的頁面(relay/ 要重新部署);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑);大腦視窗按住「允許」時卡被換掉:沒有新發現,沒改 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:09:59 +00:00
assert_eq!((screen.ask_keys.get(&id).map(String::as_str), screen.mir.keys.get(&id).map(String::as_str)), (Some("k2"), Some("k2")), "the screen's card is the new one");
assert!(!screen.ask_shown.contains_key(&id), "a new card waits its own moment before Enter/Esc");
screen.answer(&ctx, id, ApprovalAnswer::Once);
let body = match orx.try_recv() {
Ok(Out::Act(b)) => b,
_ => panic!("the brain wasn't told"),
};
assert_eq!(body["call"], "k2", "{body}");
brain.remote_cmd(&ctx, crate::remote::Cmd::Answer { bot: id, answer: body["answer"].as_str().unwrap_or("").into(), text: String::new(), call: body["call"].as_str().unwrap_or("").into(), notice: false, screen: true });
assert_eq!(second.try_recv(), Ok(ApprovalAnswer::Once));
}
/// 每次更新強調色都變回橘色:外觀是這台自己的,連到大腦時、大腦的設定來時、存檔時都用這台的。
/// Every key on the two lists is set off its default here and must come across — a key added
/// to a list but not to copy_own (or not here) fails.
#[test]
fn a_screen_keeps_its_own_look_and_settings() {
let mut from = State::first_run();
from.remote.host_name = "這台".into();
from.theme = crate::model::Theme::Dark;
from.accent = crate::model::Accent::BotColor;
from.sidebar_collapsed = !from.sidebar_collapsed;
from.sidebar_width += 40.0;
from.machine_label = "工作機".into();
from.local_execution = !from.local_execution;
from.local_never = !from.local_never;
from.messages_send = !from.messages_send;
from.messages_no_ask = !from.messages_no_ask;
from.shell_tone = 0.25;
from.shell_accent = "indigo".into();
from.shell_contrast = 0.75;
from.dense = !from.dense;
from.celebrate = !from.celebrate;
let (base, want) = (serde_json::to_value(State::first_run()).unwrap(), serde_json::to_value(&from).unwrap());
let mut to = State::first_run();
copy_own(&mut to, &from);
let got = serde_json::to_value(&to).unwrap();
for k in LOCAL_KEYS.iter().chain(LOOK_KEYS).filter(|k| **k != "selected") {
assert_ne!(want[k], base[k], "{k}: set it off its default in this test");
assert_eq!(got[k], want[k], "{k} is this computer's own, but copy_own doesn't copy it");
}
}
#[test]
fn a_screen_reads_only_turns_it_saw_end() {
let turn = |at: i64, outcome| TurnSettlement { turn_id: format!("t{at}"), outcome, settled_at_ms: at };
let now = 1_000_000;
let mut seen = HashMap::new();
// Connecting: turns that ended before are not read out.
let (a, b) = (turn(now - 5_000, TurnOutcome::Success), turn(now - 9_000, TurnOutcome::Success));
assert!(just_finished(&mut seen, [(1, Some(&a)), (2, Some(&b)), (3, None)], now).is_empty());
// Nothing new: nothing read (every update says the same).
assert!(just_finished(&mut seen, [(1, Some(&a)), (2, Some(&b))], now).is_empty());
// Bot 1 finished again: read; bot 2 failed: not.
let (a2, b2) = (turn(now - 100, TurnOutcome::Success), turn(now - 50, TurnOutcome::Error));
assert_eq!(just_finished(&mut seen, [(1, Some(&a2)), (2, Some(&b2))], now), vec![1]);
// Long ago (heard only after being away): not read.
let a3 = turn(now - 600_000 + 1, TurnOutcome::Success);
let mut seen2 = HashMap::from([(1, now - 700_000)]);
assert!(just_finished(&mut seen2, [(1, Some(&a3))], now).is_empty());
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
/// A screen whose last answer was lost on the way (the line dropped) asks again from what it
/// still holds: the brain sends only what changed since then — not every chat again.
#[test]
fn a_lost_answer_costs_only_what_changed() {
let ctx = egui::Context::default();
let mut brain = App::new(&ctx, Some(std::env::temp_dir().join("anybot-lost-answer.png")));
let id = brain.state.bots[0].id;
let first = brain.brain_pull_at(10, "lost", 0, false, false);
assert!(first["bots"].as_array().unwrap().len() >= 2, "a new screen gets everything");
let n = brain.state.bots[0].messages.len();
brain.state.bot_mut(id).unwrap().messages.push(Message::user("新的一句"));
let second = brain.brain_pull_at(11, "lost", 10, false, false);
assert_eq!(second["bots"].as_array().unwrap().len(), 1);
// That answer (version 11) never arrived: the screen asks again from 10.
let again = brain.brain_pull_at(12, "lost", 10, false, false);
let bots = again["bots"].as_array().unwrap();
assert_eq!(bots.len(), 1, "only the bot that changed: {again}");
assert_eq!(bots[0]["id"], id);
assert_eq!(bots[0]["from"], n, "from the new message on, not from the start");
assert!(again.get("config").is_none(), "the settings didn't change");
// A screen that just started from its copy gets the settings all the same.
let fresh = brain.brain_pull_at(13, "lost", 12, true, false);
assert!(fresh["config"].is_object());
// An answer lost that carried no new version (a long poll that ran out): the next pull
// says so (retry), and the change comes again.
let m = brain.state.bots[0].messages.len();
brain.state.bot_mut(id).unwrap().messages.push(Message::user("又一句"));
let lost = brain.brain_pull_at(13, "lost", 13, false, false);
assert_eq!(lost["bots"][0]["from"], m);
let back = brain.brain_pull_at(13, "lost", 13, false, true);
assert_eq!(back["bots"].as_array().map(Vec::len), Some(1), "{back}");
assert_eq!(back["bots"][0]["from"], m, "the lost change again");
}
/// The same edit sent again (its answer was lost): done once — 「新增 Bot」 twice was two bots.
#[test]
fn an_edit_sent_twice_is_done_once() {
let ctx = egui::Context::default();
let mut brain = App::new(&ctx, Some(std::env::temp_dir().join("anybot-edit-twice.png")));
let mut bot = serde_json::to_value(&brain.state.bots[0]).unwrap();
bot["id"] = json!(0);
bot["name"] = json!("新的 Bot");
let before = brain.state.bots.len();
let edit = json!({"ops": [{"op": "bot_add", "bot": bot}], "client": "twice", "seq": 7});
assert_eq!(brain.brain_edit(&edit)["applied"], 1);
assert_eq!(brain.brain_edit(&edit)["again"], true);
assert_eq!(brain.state.bots.len(), before + 1);
let next = json!({"ops": [{"op": "bot_read", "id": brain.state.bots[0].id}], "client": "twice", "seq": 8});
assert_eq!(brain.brain_edit(&next)["applied"], 1, "the next number is taken as usual");
}
#[test]
fn edits_become_small_operations() {
let base = json!({"theme": "light", "folders": ["a"], "bots": [{"id": 1, "name": "A", "unread": true}, {"id": 2, "name": "B"}]});
let cur = json!({"theme": "dark", "folders": ["a", "b"], "bots": [{"id": 1, "name": "A2", "unread": false}, {"id": 3, "name": "C"}]});
let ops = diff_ops(&base, &cur);
// theme is this computer's own; folders changed.
assert!(ops.iter().any(|o| o["op"] == "patch" && o["key"] == "folders" && o["patch"]["list"]["put"] == json!(["b"])));
assert!(!ops.iter().any(|o| o["key"] == "theme"));
assert!(ops.iter().any(|o| o["op"] == "bot_set" && o["key"] == "name" && o["value"] == "A2"));
assert!(ops.iter().any(|o| o["op"] == "bot_read" && o["id"] == 1));
assert!(ops.iter().any(|o| o["op"] == "bot_add" && o["bot"]["id"] == 3));
assert!(ops.iter().any(|o| o["op"] == "bot_del" && o["id"] == 2));
}
#[test]
fn keys_stay_on_the_brain() {
Voice: its own 設定 › 語音, run by the brain for every screen and the phone Voice was three implementations that broke on their own: speech to text borrowed the OpenAI key (so with only Grok set up the mic recorded, then failed), OpenAI's models it hard-coded stop on 2027-02-26, read aloud was macOS `say` or espeak-ng (silently nothing on Windows, where espeak isn't installed), and the phone used the browser's own recognition. Now: - 設定 › 語音 has 聽 and 說, each a service: off, OpenAI-compatible (OpenAI, Groq, a Whisper server of your own: the address decides), xAI or ElevenLabs. An empty key borrows 設定 › 模型's for the same service. Each side says 可以用 or what it lacks; 聽 has 試試看 (record a sentence, show what was heard), 說 has 試聽 and the voice list. speech.rs does the calls; xAI's both ways were checked for real (Mandarin read, then heard back, in Traditional characters). - The brain does it all: the phone POSTs its recording (MediaRecorder) to /api/voice/transcribe, screens to /api/sync/voice/transcribe; answers come back as MP3 from …/voice/speech and are played on the device (rodio; an <audio> on the phone, 「唸出來」 in a message's menu). Keys stay on the brain (the voice keys are redacted for screens like the others). - No service, no voice anywhere: the mic, 語音聊天, 會議錄音 and 朗讀 only appear once 聽 (and 說) can be called; the phone's state says which. Without voice the send arrow just rests where 語音聊天 was. - 會議錄音 is uploaded to the brain, which turns it into text in the background and hands it to the bot itself: a meeting is longer than the 35 s the account lets a request wait, and a brain on a server has no window (the jobs are polled in background()). - Recognisers answer Mandarin in Simplified: in a Traditional Chinese window or phone the text becomes Traditional with Taiwan wording. - Older saves: whoever had an OpenAI key keeps voice input (聽 = OpenAI); everyone else starts with it off. Bots' macOS voice names are cleared. 對話詳細資訊's 加入會議 started plain voice input; it starts a meeting now.
2026-11-10 14:58:18 +00:00
let mut v = json!({"remote": {"host_token": "x"}, "providers": {"xai": {"api_key": "sk-1"}, "openai": {"api_key": ""}}, "channels": [{"id": 4, "token": "t"}], "voice": {"listen": {"kind": "eleven_labs", "api_key": "el-1"}, "speak": {"kind": "xai", "api_key": ""}}});
let old = v.clone();
redact(&mut v);
Voice: its own 設定 › 語音, run by the brain for every screen and the phone Voice was three implementations that broke on their own: speech to text borrowed the OpenAI key (so with only Grok set up the mic recorded, then failed), OpenAI's models it hard-coded stop on 2027-02-26, read aloud was macOS `say` or espeak-ng (silently nothing on Windows, where espeak isn't installed), and the phone used the browser's own recognition. Now: - 設定 › 語音 has 聽 and 說, each a service: off, OpenAI-compatible (OpenAI, Groq, a Whisper server of your own: the address decides), xAI or ElevenLabs. An empty key borrows 設定 › 模型's for the same service. Each side says 可以用 or what it lacks; 聽 has 試試看 (record a sentence, show what was heard), 說 has 試聽 and the voice list. speech.rs does the calls; xAI's both ways were checked for real (Mandarin read, then heard back, in Traditional characters). - The brain does it all: the phone POSTs its recording (MediaRecorder) to /api/voice/transcribe, screens to /api/sync/voice/transcribe; answers come back as MP3 from …/voice/speech and are played on the device (rodio; an <audio> on the phone, 「唸出來」 in a message's menu). Keys stay on the brain (the voice keys are redacted for screens like the others). - No service, no voice anywhere: the mic, 語音聊天, 會議錄音 and 朗讀 only appear once 聽 (and 說) can be called; the phone's state says which. Without voice the send arrow just rests where 語音聊天 was. - 會議錄音 is uploaded to the brain, which turns it into text in the background and hands it to the bot itself: a meeting is longer than the 35 s the account lets a request wait, and a brain on a server has no window (the jobs are polled in background()). - Recognisers answer Mandarin in Simplified: in a Traditional Chinese window or phone the text becomes Traditional with Taiwan wording. - Older saves: whoever had an OpenAI key keeps voice input (聽 = OpenAI); everyone else starts with it off. Bots' macOS voice names are cleared. 對話詳細資訊's 加入會議 started plain voice input; it starts a meeting now.
2026-11-10 14:58:18 +00:00
assert_eq!((v["voice"]["listen"]["api_key"].as_str(), v["voice"]["speak"]["api_key"].as_str()), (Some(REDACTED), Some("")));
let mut voice = v["voice"].clone();
unredact(&mut voice, &old["voice"]);
assert_eq!(voice["listen"]["api_key"], "el-1");
assert!(v.get("remote").is_none());
assert_eq!(v["providers"]["xai"]["api_key"], REDACTED);
assert_eq!(v["providers"]["openai"]["api_key"], "");
assert_eq!(v["channels"][0]["token"], REDACTED);
// An edit that kept the stand-in keeps the real key.
let mut edit = v["providers"].clone();
edit["openai"]["api_key"] = json!("sk-new");
unredact(&mut edit, &old["providers"]);
assert_eq!(edit["xai"]["api_key"], "sk-1");
assert_eq!(edit["openai"]["api_key"], "sk-new");
let mut ch = v["channels"].clone();
unredact(&mut ch, &old["channels"]);
assert_eq!(ch[0]["token"], "t");
// Secrets are found by name only: a renamed item (the brain wasn't told) gets none — never
// another item's that happens to have the same address.
let servers = json!([{"name": "a", "url": "https://x.example/mcp", "password": "pa"}, {"name": "b", "url": "https://x.example/mcp", "password": "pb"}]);
let mut guessed = json!([{"name": "c", "url": "https://x.example/mcp", "password": REDACTED}]);
unredact(&mut guessed, &servers);
assert_eq!(guessed[0]["password"], "");
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
// Changing base_url while keeping REDACTED must NEVER send the brain's real key to the new server.
let mut exfil = v["providers"].clone();
exfil["xai"]["base_url"] = json!("https://evil.example/v1");
unredact(&mut exfil, &old["providers"]);
assert_eq!(exfil["xai"]["api_key"], "");
// Routine trigger tokens are redacted too.
let mut with_trig = json!({"bots": [{"id": 1, "routines": [{"id": 9, "trigger": {"kind": "github", "token": "ghp_secret"}}]}]});
redact(&mut with_trig);
assert_eq!(with_trig["bots"][0]["routines"][0]["trigger"]["token"], REDACTED);
}
#[test]
fn edits_replay_on_a_newer_copy() {
let base = json!({"folders": ["a"], "bots": [{"id": 1, "name": "A", "unread": true}, {"id": 2, "name": "B"}]});
let cur = json!({"folders": ["a", "b"], "bots": [{"id": 2, "name": "B"}, {"id": 1, "name": "A2", "unread": false}, {"id": 3, "name": "C"}]});
let ops = diff_ops(&base, &cur);
let mut again = base.clone();
apply_ops(&mut again, &ops);
assert_eq!(again, cur);
// The brain meanwhile renamed bot 2: the screen's own edit stays, the brain's shows too.
let mut newer = json!({"folders": ["a"], "bots": [{"id": 1, "name": "A", "unread": true}, {"id": 2, "name": "B from brain"}]});
apply_ops(&mut newer, &ops);
assert_eq!(newer["bots"][1]["name"], "A2");
assert_eq!(newer["bots"][0]["name"], "B from brain");
assert_eq!(newer["folders"], json!(["a", "b"]));
}
#[test]
fn an_old_copy_cant_make_a_routine_run_twice() {
let brain = json!([{"id": 7, "schedule": "daily", "trigger": null, "paused": false, "last_run": 200, "next_run": 300}]);
let mut edit = json!([{"id": 7, "title": "new", "schedule": "daily", "trigger": null, "paused": false, "last_run": 100, "next_run": 150}]);
keep_run_times(&mut edit, &brain);
assert_eq!(edit[0]["last_run"], 200);
assert_eq!(edit[0]["next_run"], 300);
assert_eq!(edit[0]["title"], "new");
// A new schedule gets worked out again.
let mut moved = json!([{"id": 7, "schedule": "weekly", "trigger": null, "paused": false, "last_run": 100, "next_run": null}]);
keep_run_times(&mut moved, &brain);
assert_eq!(moved[0]["last_run"], 200);
assert!(moved[0]["next_run"].is_null());
}
#[test]
fn failures_read_as_words_not_codes() {
let w = remote::why_refused(502, &Value::Null, "大腦");
assert!(!w.contains("502") && w.contains("帳號伺服器"));
let off = remote::why_refused(503, &json!({"error": "那台 AnyBot 目前離線(電腦關機、睡眠,或 AnyBot 沒開)"}), "大腦");
assert!(off.starts_with("大腦目前離線"));
assert!(remote::why_refused(401, &Value::Null, "大腦").contains("重新登入"));
assert!(remote::why_unreachable(&ureq::Error::HostNotFound).contains("網路"));
}
#[test]
fn two_computers_edit_one_list_without_undoing_each_other() {
let base = json!({"skills": [{"name": "a", "on": true}, {"name": "b", "on": true}], "providers": {"xai": {"model": "1"}, "openai": {"model": "1"}}, "bots": [{"id": 1, "memories": ["x", "y"]}]});
// Laptop turns skill a off, changes xai, forgets memory x.
let mut laptop = base.clone();
laptop["skills"][0]["on"] = json!(false);
laptop["providers"]["xai"]["model"] = json!("2");
laptop["bots"][0]["memories"] = json!(["y"]);
// Meanwhile the desk computer turned skill b off, changed openai, and the bot learned z.
let mut brain = base.clone();
brain["skills"][1]["on"] = json!(false);
brain["skills"].as_array_mut().unwrap().push(json!({"name": "c", "on": true}));
brain["providers"]["openai"]["model"] = json!("3");
brain["bots"][0]["memories"] = json!(["x", "y", "z"]);
let ops = diff_ops(&base, &laptop);
assert!(ops.iter().all(|o| o["op"] != "set" || o["key"] != "skills"), "{ops:?}");
apply_ops(&mut brain, &ops);
assert_eq!(brain["skills"], json!([{"name": "a", "on": false}, {"name": "b", "on": false}, {"name": "c", "on": true}]));
assert_eq!(brain["providers"], json!({"xai": {"model": "2"}, "openai": {"model": "3"}}));
assert_eq!(brain["bots"][0]["memories"], json!(["y", "z"]));
}
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear - Typing / at the start of the input (computer and phone) lists the skills that are on: names that start with what is typed first, then names containing it, then descriptions (「/簡報」 finds pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the brain recognises 「/name」 and adds a line after the message telling the model to read that skill with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added since is there. - On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」 hands over skills the same way. A refused package leaves no folder behind. - 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除 / 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in … before them (the whole of it on hover). - Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
/// A skill folder named on a screen goes up read here (the brain can't see this disk); an
/// address, a market name or a delete goes as it is.
#[test]
fn a_skill_folder_here_goes_up_whole() {
let src = std::env::temp_dir().join(format!("anybot-screen-pkg-{}", std::process::id()));
std::fs::create_dir_all(src.join("references")).unwrap();
std::fs::write(src.join("SKILL.md"), "---\nname: 週報\ndescription: 整理每週進度\n---\n\n照 references/a.md 寫\n").unwrap();
std::fs::write(src.join("references/a.md"), "# 格式").unwrap();
let b = skill_request(json!({"local": src.display().to_string()})).unwrap();
assert!(b["package"]["skill_md"].as_str().unwrap().contains("name: 週報"));
assert_eq!(b["package"]["files"][0]["path"], "references/a.md");
assert!(b.get("local").is_none(), "no path of this computer goes to the brain");
std::fs::remove_dir_all(&src).unwrap();
for as_is in [json!({"install": "https://github.com/anthropics/skills/tree/main/skills/pdf"}), json!({"builtin": "pdf"}), json!({"name": "週報", "remove": true})] {
assert_eq!(skill_request(as_is.clone()).unwrap(), as_is);
}
assert!(skill_request(json!({"local": "/nonexistent/anybot-skill"})).is_err());
}
#[test]
fn lists_without_names_are_sent_whole() {
let p = patch_of(&json!([[1], [2]]), &json!([[2]]));
assert_eq!(p, json!({"value": [[2]]}));
let mut cur = json!([{"id": 1}, {"id": 2}]);
apply_patch(&mut cur, &patch_of(&json!([{"id": 1}, {"id": 2}]), &json!([{"id": 2}, {"id": 1}])));
assert_eq!(cur, json!([{"id": 2}, {"id": 1}]));
}
/// 連接器 on a screen: its switch decides whether the brain runs the server. Off, the brain
/// stops it and its tools are gone; on again, the brain starts it with the 密碼 it kept (a
/// screen only ever holds the stand-in).
#[test]
fn a_screens_switch_turns_the_brains_connector_off_and_on() {
let _one = crate::mcp::test_lock();
let ctx = egui::Context::default();
let mut brain = App::new(&ctx, Some(std::env::temp_dir().join("anybot-brain-mcp-test.png")));
let mut server = crate::mcp::fake_server("screen-switch", 0);
server.username = "amy".into();
server.password = "s3cret".into();
brain.state.mcp_servers = vec![server];
let running = |app: &App| crate::mcp::sync(&app.state.mcp_servers).is_empty() && crate::mcp::status().contains_key("screen-switch");
assert!(running(&brain));
// What a screen holds: the brain's settings with the secrets hidden.
let screen_view = |app: &App| {
let mut top = json!({"mcp_servers": serde_json::to_value(&app.state.mcp_servers).unwrap()});
redact(&mut top);
top
};
let base = screen_view(&brain);
assert_eq!(base["mcp_servers"][0]["password"], REDACTED);
assert!(!base.to_string().contains("s3cret"));
// The switch goes off on the screen.
let mut off = base.clone();
off["mcp_servers"][0]["enabled"] = json!(false);
let r = brain.brain_edit(&json!({"ops": diff_ops(&base, &off)}));
assert_eq!(r["applied"], 1, "{r}");
assert!(!brain.state.mcp_servers[0].enabled);
assert_eq!(brain.state.mcp_servers[0].password, "s3cret", "the brain's own password stays");
assert!(!running(&brain), "off: the brain stopped it");
assert!(crate::mcp::tools().iter().all(|t| t.server != "screen-switch"));
// And on again (from what the screen now holds).
let base = screen_view(&brain);
let mut on = base.clone();
on["mcp_servers"][0]["enabled"] = json!(true);
brain.brain_edit(&json!({"ops": diff_ops(&base, &on)}));
assert!(brain.state.mcp_servers[0].enabled && brain.state.mcp_servers[0].password == "s3cret");
assert!(running(&brain), "on: the brain runs it again");
assert!(crate::mcp::tools().iter().any(|t| t.server == "screen-switch" && t.name == "add"));
// A new 帳號 from the screen keeps the password; a new address drops it (it would
// otherwise be sent to wherever the address now points).
let base = screen_view(&brain);
let mut renamed = base.clone();
renamed["mcp_servers"][0]["username"] = json!("bob");
brain.brain_edit(&json!({"ops": diff_ops(&base, &renamed)}));
assert_eq!((brain.state.mcp_servers[0].username.as_str(), brain.state.mcp_servers[0].password.as_str()), ("bob", "s3cret"));
let base = screen_view(&brain);
let mut moved = base.clone();
moved["mcp_servers"][0]["command"] = json!("somewhere-else");
brain.brain_edit(&json!({"ops": diff_ops(&base, &moved)}));
assert_eq!(brain.state.mcp_servers[0].password, "");
crate::mcp::sync(&[]);
}
}