AnyBot/src/app/remote_ui.rs

3154 lines
195 KiB
Rust
Raw Normal View History

// 手機與帳號 in the window: what the phone sees (published when something changes), carrying out
// what the phone asks, and the settings page (phone password, account at the relay, backups,
// 裝置連結).
use super::*;
use crate::remote::{self, Cmd, Settings};
use serde_json::json;
use std::hash::{Hash, Hasher};
/// 團隊 as the relay answered: each (user, role), or why it could not be loaded.
type Members = Result<Vec<(String, String)>, String>;
#[derive(Default)]
pub struct RemoteUi {
sig: u64,
last_publish: Option<Instant>,
/// The settings the server threads were last given.
pushed: Option<Settings>,
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
/// And the voice service.
voice: crate::speech::Engines,
pw1: String,
pw2: String,
relay_url: String,
user: String,
pass: String,
invite: String,
create: bool,
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
/// 兩步驗證: the code that goes with the password, asked once the account said it has it on.
code: String,
need_code: bool,
pub(super) note: Arc<Mutex<String>>,
join_rx: Option<Receiver<Result<(Settings, remote::AccountFind), String>>>,
restore_rx: Option<Receiver<Result<Vec<u8>, String>>>,
帳號伺服器換了網址不用再登出重登:tailnet 從 Tailscale 換到自架 headscale 後,舊的 *.ts.net 網址一次全死(nobledesktop 的帳號伺服器改成 http://100.64.0.5),電腦版只能「登出再登入」——帳號裡多一台新的、舊的那台留著,大腦要重選(MacBook Pro 就這樣變成「(2)」,Mac mini 還卡在死網址)。現在 設定 › 手機與帳號 的帳號卡片多一列「帳號伺服器換了網址」:按「換網址」填新網址(連不上時自己展開),先確認那是 AnyBot 帳號伺服器、再用這台自己的金鑰問它認不認得這台(帳號裡的電腦有這台)才換;只換網址,不送密碼、不註冊,登記、大腦、副本、排著的訊息全部照舊;另一台伺服器、這台已被移除就不換,說要登出再登入。沒有視窗的電腦(手腳、伺服器)用 anybot setup --move-to 網址。功能地圖 account.md 加 account-move、FEATURES.md 同步。 已驗證: cargo test 全綠(817,含 featuremap::、layout_audit:: 的「已登入、連不上」畫面);新測試 a_moved_account_server_is_followed_only_when_it_knows_this_computer(同一台換成功且金鑰/大腦不變、另一台、不在帳號、不是帳號伺服器、同網址、沒登入都拒絕);verify-anybot 實跑:scratch relay A 配對加入 → A 關掉、同資料在 B 開 → --move-to 空的 C 被拒、--move-to 假模型埠被拒、--move-to B 成功,重開後 serve.log「透過帳號 verify 連線(…28782)」、/relay/me 同一台在線、沒有多一台;桌面截圖 desktop/account-unreachable.png 卡片自動展開新網址欄位。 未驗證: 桌面上真的點「換過去」那一下(沒有點畫面的工具;同一個 relay_move 由 CLI 和單元測試走過);手機頁面沒有這個功能(手機直接用新網址重新登入)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 00:50:16 +00:00
/// 換網址: the form is open (it opens by itself while the account server can't be reached),
/// the address typed, and the check under way (remote::relay_move).
move_open: bool,
move_url: String,
move_rx: Option<Receiver<Result<Settings, String>>>,
busy: Arc<AtomicBool>,
feat: /doctor 診斷這台電腦:連線、Tailscale 直連還是中繼、大腦、模型服務、Bot 的電腦、連接器、磁碟、上次出錯 工程基礎計畫 E11(grok-build 的 /doctor)。早上「連不到大腦」花了半小時用指令查出是 Tailscale 走香港中繼,現在打一句就看得到。 - doctor.rs:報告的樣子(一項一行 ✓/✗,最後數有幾項要看);帳號伺服器網址是 *.ts.net 時跑 tailscale ping,讀出是直連還是走哪個中繼(走中繼寫延遲和「多半是中間擋了 UDP 41641」);df 看磁碟;找最新的當掉報告。 - app/doctor_ui.rs:當下就知道的(版本、資料夾、紀錄檔、這台 ↔ 帳號伺服器、帳號伺服器 ↔ 大腦、螢幕連不連得到大腦和原因、上次同步的大小和速度、Bot 的電腦、每個開著的連接器、磁碟少於 2 GB、上次出錯),要上網的在背景跑(Tailscale、每個 Bot 用到的模型服務列模型清單),好了在聊天留一行。 - 在連到大腦的螢幕電腦上:/doctor 在連不到大腦的檢查之前就處理,檢查的是這台本身,結果跳成提示(那個聊天是大腦的)。手機打的是大腦檢查自己。 - / 清單、手機的指令清單多一個 doctor;功能地圖 garden.md、chat.md,FEATURES.md。 已驗證:cargo test 全過、clippy -D warnings 過。新測試:報告的格式和計數;tailscale ping 的直連和中繼兩種輸出(用今天早上這台真的輸出「via DERP(hkg) in 63ms」);最新的當掉報告、磁碟;從聊天打 /doctor 先說「診斷中」、再一份報告(模型服務指向測試用的假模型)。 未驗證:螢幕電腦上真的跑一次(要更新這台 App)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:48:01 +00:00
pub(super) peers: Arc<Mutex<Vec<(String, String, bool)>>>,
last_seen_mark: Option<Instant>,
peers_at: Option<Instant>,
/// 團隊: (user, role) shared with, loaded from the relay; the form to add one.
members: Arc<Mutex<Option<Members>>>,
new_member: String,
new_admin: bool,
started: bool,
帳號頁連不上時「登出」被擠出視窗:「AnyBot 帳號」的連線狀態原本跟帳號、網址擠在同一行而且不換行,連不上時那段錯誤(「連不上帳號伺服器:找不到伺服器:…」)把整張卡片撐得比視窗還寬,右邊的「登出」跑到畫面外看不到(上一版只在狀態是空的時候看過,沒抓到)。現在狀態在帳號下面自己一行、太長就換行,帳號和網址太長就「…」;大腦卡片的「連不到大腦:…」也改成在卡片裡換行。版面檢查加一個畫面「設定 › 手機與帳號(已登入、連不上)」(長錯誤、螢幕電腦連不到大腦),舊的排法在這個畫面會被報成 51 個問題。 已驗證: cargo test 全綠(816 passed,含 layout_audit:: 新畫面、featuremap::、remote_ui::);把狀態放回同一行時 layout_audit 報「連不上帳號伺服器…被切掉 338px」「視窗被內容撐寬 356px」等 51 個問題(證明檢查抓得到);桌面截圖用跟使用者截圖一樣的狀態(連不上帳號伺服器、連不到大腦、wang、同一個帳號伺服器網址與主機名稱)在 1000/664 寬:「登出」在卡片裡看得到。 未驗證: 使用者自己那台 AnyBot 上的畫面(不能開使用者真的 AnyBot,要重開 App 換上新版才看得到);真的帳號伺服器連不上時的長連線狀態(截圖用暫時的覆寫給同一段字,已拿掉)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:10:51 +00:00
/// The layout check's account connection state (a long error) instead of the live one.
#[cfg(test)]
pub(super) relay_status_shown: Option<String>,
}
/// Approvals as the phone shows them.
/// An address without what may be secret in it: no 「user:password@」, no query, no fragment.
fn address_only(url: &str) -> String {
let (scheme, rest) = url.split_once("://").map(|(a, b)| (format!("{a}://"), b)).unwrap_or((String::new(), url));
let rest = rest.split(['?', '#']).next().unwrap_or("");
let (host, path) = rest.split_once('/').map(|(h, p)| (h, format!("/{p}"))).unwrap_or((rest, String::new()));
format!("{scheme}{}{path}", host.rsplit('@').next().unwrap_or(host))
}
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
/// A card as the phone draws it. `key`: the card's own (on_new_approval) — the phone sends it
/// back with the answer, so the brain applies it only to this card.
fix: 十一個小錯——瀏覽器設定檔換得了、支線改不了設定、直接連線的拒絕照實說、手機的標籤和設定頁照實寫 1. 瀏覽器設定檔只能列出:browser 的 action 就是 profiles,裡面的 list/add/use 傳不到 browser_profiles,帶 name 也只列出。現在帶 name 就換到那個設定檔、還沒有就先新增 (profiles_tool 自己判斷,工具定義不變);步驟寫「切換到「…」」。 2. 支線改得了設定:支線的 update_bot 按允許後把主 Bot 改名。update_bot、update_settings、 update_my_profile、teach_skill,和新增/修改/移除連接器或 hook,在支線一律馬上回 「支線改不了設定:回到主線再請它改。」,不跳卡片;ChatGPT 登入登出照樣跳卡。 3. 直接連線的拒絕說「區網連線(沒有加密)」:直接連線是 https,擋的原因是只憑手機密碼。 改成「這會放寬 Bot 能做的事:同一個網路直接連的裝置只能收緊、不能放寬…」;能力、可以 用的電腦只有勾回才擋(勾掉以前也被擋)。 4. 本機網址的卡寫「(在 上)」:Bot 的電腦都開不了瀏覽器時,寫「(在 執行 AnyBot 的這台 電腦 上)」。 5. 手機把監看叫醒的訊息標「例行任務」:照電腦版的標籤表(目標、例行任務、觸發、訊息管道、 來自其他 Bot),加上「監看」;測試確認手機和電腦用同一張表。 6. 步驟名字:replay_skill 寫「重播技能 「記一筆」」(以前「工具 工作資料夾」);例行任務的 送出證據寫「傳訊息給其他 Bot 給 同事:早安」(以前「message_bot 工作資料夾」);只有 檔案步驟會寫資料夾。 7. 執行步驟用的模型的卡寫「自動 → 不分開」(以前「(空) → 「off」」)。 8. ChatGPT 的卡照要做的事寫標題:「…想要登出 ChatGPT 方案」「…想要換 ChatGPT 帳號」 (以前「想要ChatGPT 方案登入」),手機和電腦都是。 9. 正常關掉 AnyBot 時,沒做完的支線寫「AnyBot 關掉了,這條支線停了」(以前「被停止了」, 像使用者按了停止);還在等主線的也一起照實寫。 10. 手機的設定頁只讀一次:狀態版本一變就重讀開著的設定頁,其他頁下次打開重讀(/always-approve 填了預設規則,權限頁不用重新整理)。 11. 沒有 Docker 時手機的電腦頁寫「已是 v14」「這台 Docker 主機沒有 gVisor」:問不到的事送 null,頁面寫「沒有 Docker,現在沒有這台電腦」,不說有沒有 gVisor。 功能地圖:browser、branch、profile、autonomy、models、market、phone、files、replay、 routines、box 的子功能、Bot 那一行、步驟和看到的結果照新行為改;拿掉只在描述錯誤的陷阱 (autonomy 的設定頁不更新、box 的已是 v14)。FEATURES.md 同步。verify-approval-routing: approval_json、approval_body 只改了標題的字,模型的假設不變,rehash coverage.tsv(這個 commit 是新的同步 commit)。 找到但沒修:browser 的 tabs 也一樣,裡面的 switch/new/close 傳不到 browser_tabs(工具 說明本身就叫模型用 action 帶),要改工具定義才修得好。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(676 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(10 個重走都過);新測試先在拿掉修正的程式上跑過、 11 個都失敗;verify-anybot 照地圖跑 box、browser、models、files、replay、routines、branch、 autonomy、profile、phone、market 的步驟,全部通過(證據在 target/verify-anybot/)。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 會開真的瀏覽器,要人在實機跑、簽名;本機網址的卡按「允許」(會開真的瀏覽器);電腦版視窗 上的卡片標題和支線卡(要開視窗);帳號連線的手機(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 09:44:16 +00:00
/// What a card asks to do, for its title: the tool's name — or, where the call says which
/// (ChatGPT 方案: sign in, out, another account), that.
pub(super) fn card_what(bot: &Bot, a: &Approval) -> String {
if a.tool == crate::chatgpt::TOOL {
let args = bot.messages.iter().rev().take(24).flat_map(|m| m.tool_calls.iter()).find(|c| c.id == a.call_id).map(|c| c.args.as_str()).unwrap_or("");
return crate::chatgpt::ask_label(args).to_string();
}
remote::tool_label(&a.tool).to_string()
}
智慧模式設計審計修正:手機也有「這輪都准」、按鈕詞彙統一、無障礙與智慧晶片 照 frontend-design skill 審計(使用者流程與順眼程度): - 手機審批卡:智慧模式開著時「這輪都准」是主按鈕(scope 由大腦從卡片自己的 grant 取,手機的字不會決定範圍;通知不帶 scope);無卡片主按鈕改「允許一次」 (桌面同步改名,全產品動詞一致)。一律允許退為一般按鈕:最有力的許可 不再站最前排。 - 手機聊天輸入列:智慧模式開著時有 ✨ 晶片,點了關掉(手機只能收緊); 關後 state/settings 同步重抓。桌面 ✨ 第一次開著時旁邊標「智慧」兩字, 關過一次就不再有字。 - 無障礙:全站 :focus-visible 焦點框;圖示按鈕(返回、送出、選單…)加 aria-label;審批按鈕組加 role=group。「全部允許,之後直接操作」連結 由 accent 色改灰:最有力的許可給最靜的處理。 - 測試:手機 scope 回答新測試(卡片自己的 grant、通知不帶);真機 e2e: 無頭 iPhone 開聊天見晶片→點→toast、晶片消失、/api/settings 同步 false; 連接器工具卡四顆按鈕「這輪都准/允許一次/一律允許/拒絕」,按「這輪都准」 後工具執行、allow_rules 沒有新增(不落永久規則)。 - 地圖:autonomy/safety/phone/connectors/apps 同步(autonomy 壓回 8999/9000); TLA coverage.tsv 已 rehash(approval_body、cmd_answer、approval_json、 phone_cards、render_dock)。 已驗證: cargo test 721 全綠(含 featuremap::、layout_audit::、phone_scope)、 verify-approval-routing run.sh 全綠、真機 e2e(晶片開關三端同步、scope 卡執行 且無永久規則)、node --check 手機 JS。 未驗證: 桌面視窗的 ✨「智慧」標註與卡片主按鈕外觀(要開視窗,需使用者同意 desktop-shot+人類簽名)。
2026-11-19 07:24:37 +00:00
fn approval_json(bot: &Bot, a: &Approval, key: &str, smart: bool) -> serde_json::Value {
fix: 十一個小錯——瀏覽器設定檔換得了、支線改不了設定、直接連線的拒絕照實說、手機的標籤和設定頁照實寫 1. 瀏覽器設定檔只能列出:browser 的 action 就是 profiles,裡面的 list/add/use 傳不到 browser_profiles,帶 name 也只列出。現在帶 name 就換到那個設定檔、還沒有就先新增 (profiles_tool 自己判斷,工具定義不變);步驟寫「切換到「…」」。 2. 支線改得了設定:支線的 update_bot 按允許後把主 Bot 改名。update_bot、update_settings、 update_my_profile、teach_skill,和新增/修改/移除連接器或 hook,在支線一律馬上回 「支線改不了設定:回到主線再請它改。」,不跳卡片;ChatGPT 登入登出照樣跳卡。 3. 直接連線的拒絕說「區網連線(沒有加密)」:直接連線是 https,擋的原因是只憑手機密碼。 改成「這會放寬 Bot 能做的事:同一個網路直接連的裝置只能收緊、不能放寬…」;能力、可以 用的電腦只有勾回才擋(勾掉以前也被擋)。 4. 本機網址的卡寫「(在 上)」:Bot 的電腦都開不了瀏覽器時,寫「(在 執行 AnyBot 的這台 電腦 上)」。 5. 手機把監看叫醒的訊息標「例行任務」:照電腦版的標籤表(目標、例行任務、觸發、訊息管道、 來自其他 Bot),加上「監看」;測試確認手機和電腦用同一張表。 6. 步驟名字:replay_skill 寫「重播技能 「記一筆」」(以前「工具 工作資料夾」);例行任務的 送出證據寫「傳訊息給其他 Bot 給 同事:早安」(以前「message_bot 工作資料夾」);只有 檔案步驟會寫資料夾。 7. 執行步驟用的模型的卡寫「自動 → 不分開」(以前「(空) → 「off」」)。 8. ChatGPT 的卡照要做的事寫標題:「…想要登出 ChatGPT 方案」「…想要換 ChatGPT 帳號」 (以前「想要ChatGPT 方案登入」),手機和電腦都是。 9. 正常關掉 AnyBot 時,沒做完的支線寫「AnyBot 關掉了,這條支線停了」(以前「被停止了」, 像使用者按了停止);還在等主線的也一起照實寫。 10. 手機的設定頁只讀一次:狀態版本一變就重讀開著的設定頁,其他頁下次打開重讀(/always-approve 填了預設規則,權限頁不用重新整理)。 11. 沒有 Docker 時手機的電腦頁寫「已是 v14」「這台 Docker 主機沒有 gVisor」:問不到的事送 null,頁面寫「沒有 Docker,現在沒有這台電腦」,不說有沒有 gVisor。 功能地圖:browser、branch、profile、autonomy、models、market、phone、files、replay、 routines、box 的子功能、Bot 那一行、步驟和看到的結果照新行為改;拿掉只在描述錯誤的陷阱 (autonomy 的設定頁不更新、box 的已是 v14)。FEATURES.md 同步。verify-approval-routing: approval_json、approval_body 只改了標題的字,模型的假設不變,rehash coverage.tsv(這個 commit 是新的同步 commit)。 找到但沒修:browser 的 tabs 也一樣,裡面的 switch/new/close 傳不到 browser_tabs(工具 說明本身就叫模型用 action 帶),要改工具定義才修得好。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(676 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(10 個重走都過);新測試先在拿掉修正的程式上跑過、 11 個都失敗;verify-anybot 照地圖跑 box、browser、models、files、replay、routines、branch、 autonomy、profile、phone、market 的步驟,全部通過(證據在 target/verify-anybot/)。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 會開真的瀏覽器,要人在實機跑、簽名;本機網址的卡按「允許」(會開真的瀏覽器);電腦版視窗 上的卡片標題和支線卡(要開視窗);帳號連線的手機(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 09:44:16 +00:00
let what = card_what(bot, a);
let title = match a.kind {
ApprovalKind::EnableTools => format!("允許 {} 使用電腦工具嗎?", bot.name),
ApprovalKind::EnableThisComputer => format!("允許 {} 在你的電腦上執行任務嗎?", bot.name),
ApprovalKind::Action => format!("{} 想要{what}", bot.name),
ApprovalKind::Handoff => format!("{}:需要你", bot.name),
問題卡、搜尋: 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 => format!("{} 問你", bot.name),
};
問題卡、搜尋: 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
// 問題卡: the questions themselves, for the phone to draw.
if a.kind == ApprovalKind::Question {
let questions: serde_json::Value = serde_json::from_str(&a.reason).unwrap_or(json!([]));
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
return json!({"bot": bot.id, "title": title, "reason": crate::ask::describe(&a.reason), "tool": a.tool, "can_always": false, "kind": "question", "computer": "", "call_id": a.call_id, "questions": questions, "key": key});
問題卡、搜尋: 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
}
let handoff = a.kind == ApprovalKind::Handoff;
智慧模式設計審計修正:手機也有「這輪都准」、按鈕詞彙統一、無障礙與智慧晶片 照 frontend-design skill 審計(使用者流程與順眼程度): - 手機審批卡:智慧模式開著時「這輪都准」是主按鈕(scope 由大腦從卡片自己的 grant 取,手機的字不會決定範圍;通知不帶 scope);無卡片主按鈕改「允許一次」 (桌面同步改名,全產品動詞一致)。一律允許退為一般按鈕:最有力的許可 不再站最前排。 - 手機聊天輸入列:智慧模式開著時有 ✨ 晶片,點了關掉(手機只能收緊); 關後 state/settings 同步重抓。桌面 ✨ 第一次開著時旁邊標「智慧」兩字, 關過一次就不再有字。 - 無障礙:全站 :focus-visible 焦點框;圖示按鈕(返回、送出、選單…)加 aria-label;審批按鈕組加 role=group。「全部允許,之後直接操作」連結 由 accent 色改灰:最有力的許可給最靜的處理。 - 測試:手機 scope 回答新測試(卡片自己的 grant、通知不帶);真機 e2e: 無頭 iPhone 開聊天見晶片→點→toast、晶片消失、/api/settings 同步 false; 連接器工具卡四顆按鈕「這輪都准/允許一次/一律允許/拒絕」,按「這輪都准」 後工具執行、allow_rules 沒有新增(不落永久規則)。 - 地圖:autonomy/safety/phone/connectors/apps 同步(autonomy 壓回 8999/9000); TLA coverage.tsv 已 rehash(approval_body、cmd_answer、approval_json、 phone_cards、render_dock)。 已驗證: cargo test 721 全綠(含 featuremap::、layout_audit::、phone_scope)、 verify-approval-routing run.sh 全綠、真機 e2e(晶片開關三端同步、scope 卡執行 且無永久規則)、node --check 手機 JS。 未驗證: 桌面視窗的 ✨「智慧」標註與卡片主按鈕外觀(要開視窗,需使用者同意 desktop-shot+人類簽名)。
2026-11-19 07:24:37 +00:00
// 智慧模式: the phone's card gets 「這輪都准」 too — a yes smaller than 一律允許,
// good for this turn only (the brain applies it to the card's own grant, never the phone's words).
let can_scope = smart && a.kind == ApprovalKind::Action && !a.grant.is_empty();
json!({"bot": bot.id, "title": title, "reason": a.reason, "tool": a.tool, "can_always": !handoff && (a.kind != ApprovalKind::Action || !a.grant.is_empty()), "can_scope": can_scope, "kind": if handoff { "handoff" } else { "ask" }, "computer": if handoff { a.grant.as_str() } else { "" }, "key": key})
}
/// A teammate's messages waiting for a busy bot (more than this are not taken).
const MAX_WAITING_FROM_MEMBERS: usize = 8;
design: 手機網頁顏色跟著電腦版、改成 Claude 手機 App 的感覺,實點修好 12 個問題 - 顏色:api/state 帶出電腦的主題和淺色/深色兩組顏色(theme::shell 換成手機的 CSS 變數);手機「這支手機的外觀」預設「跟著電腦」,也可選跟著手機、淺色、深色;先驗證是 hex 才套用,存一份避免打開時閃預設色;狀態列跟著畫面。舊版電腦沒送顏色時維持「紙」。電腦畫面頁改成暖色深色。 - 感覺:標題列沒有底線、第二行只寫在做什麼或模型;輸入框是底部圓角卡片;回答下只留時間和三個操作;群組、晶片、建議、記憶卡拿掉框線;開關的「開」用墨色;允許卡細框;點擊範圍加大(44/40/36px)。 - 字更少:設定首頁拿掉重複說明;每列說明一行;「模型」頁右邊只寫可以用/未設定;Bot 那列選單少用的收進「更多…」。 - 修好:長 Bot 名字超出 @// 選單;引用顯示原始 Markdown 且沒有長度上限;第 8 個表情換行;.note 在清單裡變灰條;圖片點了跳出 App;上傳吐司蓋住輸入框;「聊天的顏色」永遠沒有 ✓(電腦送 "Quiet",改送 quiet/black/bot_color);「:」後的網址不成連結;深色模式黑頭像看不見;稽核分頁出現 ** 和多行 JSON;頁面卡標題重複;記憶搜尋框 14px 讓 iPhone 放大。 - 問題卡的「略過」、交辦的「跳過」、允許卡的「拒絕」不再是紅字,跟電腦版一樣是一般按鈕。 已驗證:cargo test --bin anybot 523 通過(含 phone_login_and_api 檢查主題和兩組顏色)、relay 22 通過;手機圖表 65/65、通知 9/9、電腦畫面 13/13;playwright 390×844 淺色深色點過登入、首頁、聊天、詳細資訊、Bot 設定、頁面、例行任務、電腦、設定每一頁,沒有 console 錯誤、失敗請求或橫向溢出;電腦換靛藍深色,手機跟著變。 未驗證:真的 iPhone/Android 實機。
2026-11-16 15:16:38 +00:00
/// 設定 › 一般 › 外觀 as the phone's colours: the shell the desktop draws, light and dark.
pub(super) fn phone_palettes(st: &crate::model::State) -> serde_json::Value {
修手機接管電腦後回不去;新增「風格」(8 套:紙、夜、墨、苔、海、糖、夕陽、終端機,一套顏色加聊天背景花紋,電腦和手機一起換,也能請 Bot 換);設定每一列都有圖示(電腦和手機)。 - 接管回不去(mobile/index.html newBoxFrame):以前每次打開/關掉都改同一個 iframe 的網址,iframe 換頁會加進上一頁紀錄;第二次之後按 ✕ 或返回,退的是框裡那一頁,接管畫面卡著。現在每次換一個新的框,關掉就拿掉。舊版重現:第 2、3 次關不掉;新版連續 3 次都回到首頁。 - 風格(src/theme.rs TEMPLATES、palette_for、backdrop):每套有淺色和深色的墨、紙、強調色(同一個產生器長出整個殼),加聊天背景 dots/grid/waves。State 新欄位 shell_template(空=自訂)。電腦:設定 › 一般 › 外觀最上面一排小圖(kit::style_gallery,每張是那個風格的縮小畫面),聊天區後面畫花紋(chat_backdrop);點強調色、動底色或重設回到自訂。手機:palettes 帶 backdrop,聊天背景用 CSS 畫;設定 › 一般最上面同一排小圖(api/settings 的 styles、style)。Bot:update_settings 多 `style`(appctl;不在 tools::specs 的鎖檔裡,鎖檔沒變)。截圖:ANYBOT_SHOT_STYLE=ocean。 - 設定圖示:icons::setting_icon 照名字的字配圖示(主題月亮、風格和顏色調色盤、通知鈴鐺、時區地球、權限盾牌、電腦螢幕…,沒對到是滑桿),card_row 和 setting_title 都畫;新 Lucide 圖示 palette、moon、globe、sliders-horizontal、volume-2、hard-drive。手機設定頁、Bot 設定、電腦頁的列用 sitem(同一套規則,SET_ICON)。 - 測試:theme::template_tests::every_template_reads_in_light_and_dark(每套淺深色都讀得清楚、紙就是原本的預設);appctl 的 update_settings 測試加 style。 - 功能地圖 appearance.md 加 appearance-style 和一步驗證、settings.md(Bot 能改四樣)、box.md 陷阱;FEATURES.md。 已驗證: cargo test 881 個全過;clippy 沒有新警告;scratch 手機:接管開關 3 次都回首頁(舊版第 2 次就卡住);設定 › 一般點「海」→ state shell_template=ocean、聊天背景波浪;聊天請 Bot `update_settings {"style":"terminal"}` → 手機強調色 #2d8a3e、格線;Bot 設定 36 列都有圖示。桌面截圖:外觀的 8 張小圖、海、終端機(深色)、糖的聊天,電腦設定一般/電腦頁每列有圖示。 未驗證: 在真的 iPhone 上滑返回手勢(接管開著時本來就停用,靠 ✕);花紋在很大的螢幕上的耗電(電腦版每幀畫點點/線,沒量)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:38:00 +00:00
let one = |dark| remote::palette_json(&crate::theme::palette_for(&st.shell_template, st.shell_tone, &st.shell_accent, st.shell_contrast, dark));
// (And the 風格's chat backdrop: dots, a grid, waves, or none.)
json!({"light": one(false), "dark": one(true), "backdrop": crate::theme::backdrop(&st.shell_template)})
design: 手機網頁顏色跟著電腦版、改成 Claude 手機 App 的感覺,實點修好 12 個問題 - 顏色:api/state 帶出電腦的主題和淺色/深色兩組顏色(theme::shell 換成手機的 CSS 變數);手機「這支手機的外觀」預設「跟著電腦」,也可選跟著手機、淺色、深色;先驗證是 hex 才套用,存一份避免打開時閃預設色;狀態列跟著畫面。舊版電腦沒送顏色時維持「紙」。電腦畫面頁改成暖色深色。 - 感覺:標題列沒有底線、第二行只寫在做什麼或模型;輸入框是底部圓角卡片;回答下只留時間和三個操作;群組、晶片、建議、記憶卡拿掉框線;開關的「開」用墨色;允許卡細框;點擊範圍加大(44/40/36px)。 - 字更少:設定首頁拿掉重複說明;每列說明一行;「模型」頁右邊只寫可以用/未設定;Bot 那列選單少用的收進「更多…」。 - 修好:長 Bot 名字超出 @// 選單;引用顯示原始 Markdown 且沒有長度上限;第 8 個表情換行;.note 在清單裡變灰條;圖片點了跳出 App;上傳吐司蓋住輸入框;「聊天的顏色」永遠沒有 ✓(電腦送 "Quiet",改送 quiet/black/bot_color);「:」後的網址不成連結;深色模式黑頭像看不見;稽核分頁出現 ** 和多行 JSON;頁面卡標題重複;記憶搜尋框 14px 讓 iPhone 放大。 - 問題卡的「略過」、交辦的「跳過」、允許卡的「拒絕」不再是紅字,跟電腦版一樣是一般按鈕。 已驗證:cargo test --bin anybot 523 通過(含 phone_login_and_api 檢查主題和兩組顏色)、relay 22 通過;手機圖表 65/65、通知 9/9、電腦畫面 13/13;playwright 390×844 淺色深色點過登入、首頁、聊天、詳細資訊、Bot 設定、頁面、例行任務、電腦、設定每一頁,沒有 console 錯誤、失敗請求或橫向溢出;電腦換靛藍深色,手機跟著變。 未驗證:真的 iPhone/Android 實機。
2026-11-16 15:16:38 +00:00
}
impl App {
pub(super) fn remote_start(&mut self, ctx: &egui::Context) {
if self.demo || self.rm.started {
return;
}
self.rm.started = true;
self.ctx_handle = Some(ctx.clone());
let c = ctx.clone();
remote::hub().set_repaint(Arc::new(move || c.request_repaint()));
self.remote_apply_settings();
self.mirror_boot();
// 傳送: whatever was still on its way when AnyBot stopped goes on.
crate::drops::kick();
}
/// Hand changed settings to the server threads (and restart what depends on them).
fn remote_apply_settings(&mut self) {
let s = self.state.remote.clone();
if self.rm.pushed.as_ref() == Some(&s) {
return;
}
let old = self.rm.pushed.replace(s.clone());
remote::hub().set_settings(&s);
let lan_changed = old.as_ref().map(|o| o.lan) != Some(s.lan);
if lan_changed {
match remote::set_lan(s.lan) {
Ok(_) => {}
Err(e) => *self.rm.note.lock().unwrap() = e,
}
}
let relay_changed = old.as_ref().map(|o| (o.relay_url.clone(), o.host_token.clone())) != Some((s.relay_url.clone(), s.host_token.clone()));
if relay_changed {
remote::relay_restart(&s);
}
}
/// Every frame: run what the phone asked and refresh what it sees.
pub(super) fn remote_tick(&mut self, ctx: &egui::Context) {
if self.demo {
return;
}
self.remote_apply_settings();
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
// 設定 › 語音 with its keys, for the phone's and the screens' recordings.
let voice = crate::speech::Engines::of(&self.state);
if self.rm.voice != voice {
remote::hub().set_voice(voice.clone());
self.rm.voice = voice;
}
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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 cmds = remote::hub().take_cmds();
let had_cmds = !cmds.is_empty();
for c in cmds {
// A screen of another brain has no bots of its own to run phone requests on.
if self.mir.on && !matches!(c, Cmd::DeviceAdded(_) | Cmd::DeviceSeen(_)) {
continue;
}
self.remote_cmd(ctx, c);
}
self.brain_serve(ctx);
self.brain_watch();
if let Some(rx) = &self.rm.join_rx {
if let Ok(r) = rx.try_recv() {
self.rm.join_rx = None;
match r {
Ok((s, found)) => {
self.state.remote = s;
self.rm.pass.clear();
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
self.rm.code.clear();
self.rm.need_code = false;
self.account_sync(found);
self.mark();
}
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
Err(e) => {
self.rm.need_code |= e.starts_with(remote::NEED_CODE);
// (A code is good for one try.)
self.rm.code.clear();
*self.rm.note.lock().unwrap() = e;
}
}
}
}
帳號伺服器換了網址不用再登出重登:tailnet 從 Tailscale 換到自架 headscale 後,舊的 *.ts.net 網址一次全死(nobledesktop 的帳號伺服器改成 http://100.64.0.5),電腦版只能「登出再登入」——帳號裡多一台新的、舊的那台留著,大腦要重選(MacBook Pro 就這樣變成「(2)」,Mac mini 還卡在死網址)。現在 設定 › 手機與帳號 的帳號卡片多一列「帳號伺服器換了網址」:按「換網址」填新網址(連不上時自己展開),先確認那是 AnyBot 帳號伺服器、再用這台自己的金鑰問它認不認得這台(帳號裡的電腦有這台)才換;只換網址,不送密碼、不註冊,登記、大腦、副本、排著的訊息全部照舊;另一台伺服器、這台已被移除就不換,說要登出再登入。沒有視窗的電腦(手腳、伺服器)用 anybot setup --move-to 網址。功能地圖 account.md 加 account-move、FEATURES.md 同步。 已驗證: cargo test 全綠(817,含 featuremap::、layout_audit:: 的「已登入、連不上」畫面);新測試 a_moved_account_server_is_followed_only_when_it_knows_this_computer(同一台換成功且金鑰/大腦不變、另一台、不在帳號、不是帳號伺服器、同網址、沒登入都拒絕);verify-anybot 實跑:scratch relay A 配對加入 → A 關掉、同資料在 B 開 → --move-to 空的 C 被拒、--move-to 假模型埠被拒、--move-to B 成功,重開後 serve.log「透過帳號 verify 連線(…28782)」、/relay/me 同一台在線、沒有多一台;桌面截圖 desktop/account-unreachable.png 卡片自動展開新網址欄位。 未驗證: 桌面上真的點「換過去」那一下(沒有點畫面的工具;同一個 relay_move 由 CLI 和單元測試走過);手機頁面沒有這個功能(手機直接用新網址重新登入)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 00:50:16 +00:00
if let Some(rx) = &self.rm.move_rx {
if let Ok(r) = rx.try_recv() {
self.rm.move_rx = None;
match r {
// Only the address: whatever else changed meanwhile (a name, backups) stays.
// The connection restarts on it (remote_apply_settings sees the new address).
Ok(s) if s.host_token == self.state.remote.host_token => {
*self.rm.note.lock().unwrap() = format!("已改用 {}:帳號、大腦和還沒送出的訊息都照舊", s.relay_url);
self.state.remote.relay_url = s.relay_url;
self.rm.move_open = false;
self.rm.move_url.clear();
self.mark();
}
Ok(_) => *self.rm.note.lock().unwrap() = "這台在檢查時登出或換了帳號,網址沒有換".into(),
Err(e) => *self.rm.note.lock().unwrap() = e,
}
}
}
if let Some(rx) = &self.rm.restore_rx {
if let Ok(r) = rx.try_recv() {
self.rm.restore_rx = None;
match r.and_then(|bytes| serde_json::from_slice::<State>(&bytes).map_err(|e| format!("備份內容讀不出來:{e}"))) {
Ok(mut st) => {
// Keep this computer's own phone and account settings.
st.remote = self.state.remote.clone();
let n = st.bots.len();
self.state = st;
self.state.save();
*self.rm.note.lock().unwrap() = format!("已從備份還原 {n} 個 Bot");
}
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
Err(e) => {
self.rm.need_code |= e.starts_with(remote::NEED_CODE);
self.rm.code.clear();
*self.rm.note.lock().unwrap() = e;
}
}
}
}
// 自動備份: once a day while signed in.
let s = &self.state.remote;
if !self.mir.on && s.auto_backup && !s.backup_key.is_empty() && !s.relay_url.is_empty() && chrono::Utc::now().timestamp() - s.last_backup > 86_400 && !self.rm.busy.load(Ordering::SeqCst) {
self.remote_backup();
}
// 裝置連結: keep the list of this account's computers fresh (every 15 s: a computer that
// comes on is one the bots can use soon after).
if !self.state.remote.host_token.is_empty() && !self.rm.peers_at.map(|t| t.elapsed().as_secs() < 15).unwrap_or(false) {
self.rm.peers_at = Some(Instant::now());
let (peers, s) = (self.rm.peers.clone(), self.state.remote.clone());
std::thread::spawn(move || {
let v = remote::devices_online(&s);
if !v.is_empty() {
*peers.lock().unwrap() = v;
}
});
}
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
if !self.mir.on && (had_cmds || !self.rm.last_publish.map(|t| t.elapsed().as_millis() < 75).unwrap_or(false)) {
self.remote_publish();
}
}
/// 加一台電腦: lines for Mac, any Linux (desktop or headless) and Windows. Each installs
/// AnyBot if needed and joins as hands, including the first pairing, with nothing to answer.
fn pair_section(&mut self, ui: &mut egui::Ui) {
let p = self.pal;
ui.add_space(6.0);
ui.separator();
ui.horizontal(|ui| {
帳號頁的登出不再歪:電腦版「AnyBot 帳號」卡片的「登出帳號」本來是黏在備份那一列最右邊的一行紅字(不像按鈕、也跟備份無關),現在是卡片最下面獨立一列「登出帳號 ?」+右邊「登出」按鈕,跟「加一台電腦」同一種樣子;「這台電腦在手機上叫」改成標籤在上、欄位跟卡片一樣寬(「王性驊的MacBook Pro (2)」這種名字本來被切掉);「加一台電腦」的名字和按鈕對齊同一條中線。手機:登出類的確認按鈕用登出圖示(本來是垃圾桶);帳戶選單的「登出這支手機」跟 設定 › 手機與帳號 用同一個確認,有沒送出的訊息也會說清掉幾則。登出做的事一字未動。 已驗證: cargo test 全綠(816 passed,含 featuremap::、layout_audit::);account.md 的 verify-anybot 步驟:只聽一個位址、密碼錯/登入、重開不用重登、登出另一台(確認鈕是登出圖示)、登出這支手機、錯 5 次要等、桌面的手機與帳號頁(ANYBOT_SHOT_REAL);手機帳戶選單 › 登出這支手機(斷線時排一則訊息 → 確認寫「還沒送出的 1 則訊息會跟著清掉」→ 取消 → 連回後送達);桌面已登入帳號頁用示範資料截圖(一般與螢幕電腦模式、664/1000 寬);獨立審查(乾淨脈絡照 account.md 審 diff)沒有 P0/P1,兩處 P2 文件用詞已改準。 未驗證: 真的帳號伺服器登入後按「登出」(要 relay/ 帳號伺服器,scratch 不准帶帳號);真的 iPhone/Android 與加入主畫面的 App(無頭瀏覽器 390×844 代替);使用者的帳號伺服器實際送出的手機頁版本(沙盒連不到 tailnet)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:25:26 +00:00
// (As tall as its button, so the name and the button share a middle.)
ui.set_min_height(30.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
ui.label(RichText::new(t("加一台電腦")).size(FONT_SM).strong().family(crate::bold()));
help_mark(ui, "讓另一台電腦當大腦的手腳:Mac、任何 Linux(含沒有螢幕的)、已登入的 Windows。貼上對應的那一行就會裝好並完成第一次配對,不用帳號密碼。它會在開機或登入後自動執行,只讓這個大腦使用。", p);
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
if ui.add(secondary_button("產生配對碼")).clicked() {
let (s, slot) = (self.state.remote.clone(), self.mir.pair.clone());
let for_host = if self.mir.on { s.brain_id.clone() } else { s.host_id.clone() };
*slot.lock().unwrap() = (t("正在產生…"), false, None);
// This computer is the brain: a key goes with the code (in the line to
// paste, never to the account server) and its commands to the new computer
// are signed with it. (As a screen of a brain elsewhere there is none: the
// key would have to cross the account server to reach that brain.)
let key = if self.mir.on { String::new() } else { crate::remote::new_link_key() };
if !key.is_empty() {
let keys = &mut self.state.remote.link_keys;
keys.push(key.clone());
let extra = keys.len().saturating_sub(crate::remote::MAX_LINK_KEYS);
keys.drain(..extra);
remote::hub().set_settings(&self.state.remote);
self.dirty = true;
}
std::thread::spawn(move || {
*slot.lock().unwrap() = match crate::remote::pair_code(&s, &for_host) {
Ok(code) if !key.is_empty() => (crate::remote::pair_block(&s.relay_url, &format!("{code}-{key}")), true, Some(Instant::now())),
Ok(code) => (crate::remote::pair_block(&s.relay_url, &code), true, Some(Instant::now())),
Err(e) => (e, false, None),
};
});
}
});
});
let (line, ok, at) = self.mir.pair.lock().unwrap().clone();
if line.is_empty() {
return;
}
let left = at.map(|t| 600u64.saturating_sub(t.elapsed().as_secs())).unwrap_or(0);
if ok && left == 0 {
hint(ui, "配對碼過期了,再按一次「產生配對碼」。", p);
return;
}
if !ok {
let c = if line.ends_with('…') { p.text2 } else { p.danger };
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
ui.label(RichText::new(line).size(FONT_SM).color(c));
return;
}
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(p.hover).corner_radius(R_M).inner_margin(Margin::symmetric(10, 8)).show(ui, |ui| {
ui.horizontal(|ui| {
2026-11-16 14:07:07 +00:00
ui.add(egui::Label::new(RichText::new(&line).monospace().size(FONT_SM)).selectable(true).wrap());
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
if ui.add(secondary_button("複製")).clicked() {
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
crate::platform::copy_text(ui.ctx(), &line);
self.notice = Some(t("已複製。Mac 和 Linux 貼終端機那一行,Windows 貼 PowerShell 那一行"));
}
});
});
});
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
ui.label(RichText::new(format!("{}(還有 {} 分 {:02} 秒,只能用一次)", t("在那台電腦貼上對應的那一行"), left / 60, left % 60)).size(FONT_XS).color(p.text3));
// Just made: bring it into view.
if at.map(|t| t.elapsed().as_millis() < 800).unwrap_or(false) {
ui.scroll_to_cursor(Some(Align::Max));
}
ui.ctx().request_repaint_after(std::time::Duration::from_secs(1));
}
fn remote_signature(&self) -> u64 {
let mut h = std::collections::hash_map::DefaultHasher::new();
self.state.remote.host_name.hash(&mut h);
self.state.timezone.hash(&mut h);
self.scr.cfg_hash.hash(&mut h);
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
(&self.state.folders, self.state.loose_index, &self.state.pin_order, self.state.accent as u8, self.newer_build.is_some(), self.state.always_approve).hash(&mut h);
design: 手機網頁顏色跟著電腦版、改成 Claude 手機 App 的感覺,實點修好 12 個問題 - 顏色:api/state 帶出電腦的主題和淺色/深色兩組顏色(theme::shell 換成手機的 CSS 變數);手機「這支手機的外觀」預設「跟著電腦」,也可選跟著手機、淺色、深色;先驗證是 hex 才套用,存一份避免打開時閃預設色;狀態列跟著畫面。舊版電腦沒送顏色時維持「紙」。電腦畫面頁改成暖色深色。 - 感覺:標題列沒有底線、第二行只寫在做什麼或模型;輸入框是底部圓角卡片;回答下只留時間和三個操作;群組、晶片、建議、記憶卡拿掉框線;開關的「開」用墨色;允許卡細框;點擊範圍加大(44/40/36px)。 - 字更少:設定首頁拿掉重複說明;每列說明一行;「模型」頁右邊只寫可以用/未設定;Bot 那列選單少用的收進「更多…」。 - 修好:長 Bot 名字超出 @// 選單;引用顯示原始 Markdown 且沒有長度上限;第 8 個表情換行;.note 在清單裡變灰條;圖片點了跳出 App;上傳吐司蓋住輸入框;「聊天的顏色」永遠沒有 ✓(電腦送 "Quiet",改送 quiet/black/bot_color);「:」後的網址不成連結;深色模式黑頭像看不見;稽核分頁出現 ** 和多行 JSON;頁面卡標題重複;記憶搜尋框 14px 讓 iPhone 放大。 - 問題卡的「略過」、交辦的「跳過」、允許卡的「拒絕」不再是紅字,跟電腦版一樣是一般按鈕。 已驗證:cargo test --bin anybot 523 通過(含 phone_login_and_api 檢查主題和兩組顏色)、relay 22 通過;手機圖表 65/65、通知 9/9、電腦畫面 13/13;playwright 390×844 淺色深色點過登入、首頁、聊天、詳細資訊、Bot 設定、頁面、例行任務、電腦、設定每一頁,沒有 console 錯誤、失敗請求或橫向溢出;電腦換靛藍深色,手機跟著變。 未驗證:真的 iPhone/Android 實機。
2026-11-16 15:16:38 +00:00
// 外觀: the phone wears the desktop's theme and colours.
修手機接管電腦後回不去;新增「風格」(8 套:紙、夜、墨、苔、海、糖、夕陽、終端機,一套顏色加聊天背景花紋,電腦和手機一起換,也能請 Bot 換);設定每一列都有圖示(電腦和手機)。 - 接管回不去(mobile/index.html newBoxFrame):以前每次打開/關掉都改同一個 iframe 的網址,iframe 換頁會加進上一頁紀錄;第二次之後按 ✕ 或返回,退的是框裡那一頁,接管畫面卡著。現在每次換一個新的框,關掉就拿掉。舊版重現:第 2、3 次關不掉;新版連續 3 次都回到首頁。 - 風格(src/theme.rs TEMPLATES、palette_for、backdrop):每套有淺色和深色的墨、紙、強調色(同一個產生器長出整個殼),加聊天背景 dots/grid/waves。State 新欄位 shell_template(空=自訂)。電腦:設定 › 一般 › 外觀最上面一排小圖(kit::style_gallery,每張是那個風格的縮小畫面),聊天區後面畫花紋(chat_backdrop);點強調色、動底色或重設回到自訂。手機:palettes 帶 backdrop,聊天背景用 CSS 畫;設定 › 一般最上面同一排小圖(api/settings 的 styles、style)。Bot:update_settings 多 `style`(appctl;不在 tools::specs 的鎖檔裡,鎖檔沒變)。截圖:ANYBOT_SHOT_STYLE=ocean。 - 設定圖示:icons::setting_icon 照名字的字配圖示(主題月亮、風格和顏色調色盤、通知鈴鐺、時區地球、權限盾牌、電腦螢幕…,沒對到是滑桿),card_row 和 setting_title 都畫;新 Lucide 圖示 palette、moon、globe、sliders-horizontal、volume-2、hard-drive。手機設定頁、Bot 設定、電腦頁的列用 sitem(同一套規則,SET_ICON)。 - 測試:theme::template_tests::every_template_reads_in_light_and_dark(每套淺深色都讀得清楚、紙就是原本的預設);appctl 的 update_settings 測試加 style。 - 功能地圖 appearance.md 加 appearance-style 和一步驗證、settings.md(Bot 能改四樣)、box.md 陷阱;FEATURES.md。 已驗證: cargo test 881 個全過;clippy 沒有新警告;scratch 手機:接管開關 3 次都回首頁(舊版第 2 次就卡住);設定 › 一般點「海」→ state shell_template=ocean、聊天背景波浪;聊天請 Bot `update_settings {"style":"terminal"}` → 手機強調色 #2d8a3e、格線;Bot 設定 36 列都有圖示。桌面截圖:外觀的 8 張小圖、海、終端機(深色)、糖的聊天,電腦設定一般/電腦頁每列有圖示。 未驗證: 在真的 iPhone 上滑返回手勢(接管開著時本來就停用,靠 ✕);花紋在很大的螢幕上的耗電(電腦版每幀畫點點/線,沒量)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:38:00 +00:00
(self.state.theme as u8, &self.state.shell_accent, &self.state.shell_template, self.state.shell_tone.to_bits(), self.state.shell_contrast.to_bits()).hash(&mut h);
for b in &self.state.bots {
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
(b.id, &b.name, &b.color, b.unread, b.messages.len(), &b.thinking, &b.step_model).hash(&mut h);
// (What the phone's home, editor and reactions show.)
(&b.description, &b.shape, b.pinned, &b.folder, b.members.len(), b.instructions.len(), b.memories.len(), b.tools_enabled).hash(&mut h);
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
for m in b.messages.iter().rev().take(remote::PHONE_TAIL) {
(m.role as u8, m.text.len(), m.thinking.len(), m.attachments.len(), m.tool_calls.len(), m.error, m.summary, m.interrupted, &m.reactions, m.memories.len()).hash(&mut h);
for c in &m.tool_calls {
(c.status as u8).hash(&mut h);
}
feat: 交付確認——Bot 傳的檔案記下在哪台裝置顯示、點開沒,沒顯示出來叫醒 Bot 一次 起因:Bot 產了一張圖、send_file 回報成功、Bot 一直說「已完成」,但圖一直沒出現在使用者 的聊天裡,系統完全不知道。「完成」改成:你看得到、能用,而且系統知道你收到了。 - 附件有身分:attach::store/store_bytes 給每個附件一個編號(舊資料讀得進來,沒有回報的 附件寫出來跟以前一字不差);螢幕電腦把路徑換成本機副本時編號不變,回報一律用編號。 - 三層狀態記在大腦那則附件上:已在聊天 → 已在某台裝置顯示 → 點開了,或「顯示失敗」加 原因;每筆記哪台裝置和時間,同一台同一種只記第一次,最多 12 筆。記號和「已顯示/已 點開」只看擁有者自己的裝置;團隊成員、管理員的裝置只記下(最多 4 筆)、不叫醒。 - 誰回報: - 手機:POST api/bots/<id>/seen(團隊成員也可以)。圖片真的載入、在畫面裡、頁面在前面 才算顯示;預覽真的畫出來(文字、表格、圖、PDF 的頁、能播的錄音影片)或存到手機才算 點開;大腦回 404/422/500 或圖片再抓一次還是解不開算失敗;斷線、408、429、502–504 算網路問題、不算。不排隊,每次開頁面每個附件每種只報一次。 - 大腦自己的視窗(「這台電腦」):卡片在畫面裡停留 0.8 秒、視窗在前面才算顯示(聊天剛 打開時從頂端畫的那一格、「回到最新訊息」捲過去的不算);點開算點開;檔案不見了算失敗。 - 螢幕電腦:api/sync/act 的 seen(大腦用它的名字記,另開執行緒送、不擋其他訊息);抓大腦 檔案被回 404 算失敗(以前完全不報),網路斷了不算。 - 裝置名稱、原因都由大腦從固定的字選,頁面送來的字不會原樣進到 Bot 那裡。 - 同步:remote_signature、msg_sig、聊天存檔的 chat_mark 都算進回報;message_json 對 Bot 傳 的附件輸出 id、delivery、seen。 - 畫面:Bot 傳來的附件下面一個灰色小記號——✓ 已在聊天、✓✓ 已在某台裝置顯示、點開過的 ✓✓ 是強調色;手機點記號跳出清單、電腦版滑過看清單(每台裝置、時間、顯示/點開/失敗和 原因)。使用者自己附的檔案沒有記號。失敗不另外跳字;手機上解不開的圖也顯示原本的 「這張圖讀不到」(以前是一塊空白)。 - Bot 知道:send_file 的結果改成「已放進聊天(…附件 <編號>)…不要說使用者已經看到」;之後 的回合結果後面帶一行〔交付狀態:…〕(日期寫死,不會每天變);系統提示加一句以那個狀態 為準、使用者問收到沒照它回答。 - 叫醒:擁有者的裝置回報顯示失敗、而且還沒有擁有者的裝置顯示過,叫醒那個 Bot 一次(新的 「[交付]」標籤,視窗和手機的 WAKE_TAGS 一起改),只寫附件編號和副檔名、哪台、為什麼 (不寫檔名:檔名可能來自外面,這則訊息帶著擁有者的信任開一輪),請它換方式交付。只在 「傳出這個檔案的那一輪是擁有者開的」時叫醒:訊息管道的人、團隊成員、別的 Bot 要的檔案、 群組聊天、給使用者看畫面的截圖、支線帶回的檔案都只記下。擁有者上次說話之後最多兩次; Bot 在忙、叫醒在排隊時別台顯示了就取消。 - docs/feature-map/deliver.md 新增子功能 deliver-confirm、使用者怎麼到、三條 verify-anybot 步驟、陷阱;FEATURES.md 同步。verify-anybot 的假模型照規則回答時多記 tool_results(這個 請求裡每個工具結果的結尾),用來證明 Bot 讀到〔交付狀態〕。 合進主線(接在手機、螢幕電腦「沒網路照樣能用」之後) - 手機頁面:apiOnce 用主線那行(已經帶 e.status、e.unsure);離開聊天先存一份、回到聊天看 畫面裡的附件,兩個都留。螢幕電腦:兩邊新增的測試都留,離線那輪的測試附件補上新欄位。 - 合併後跑 deliver.md 時發現(以前就有、離線那輪重畫變多後才明顯):手機聊天每次重畫, 圖片都先退回檔名再載入、長高,「停在最新訊息」只在重畫那一刻判斷,幾張圖之後最新那則 被推到畫面外、也就永遠不算「顯示」。改成:已經讀到的圖重畫時直接沿用;停在底部時, 內容在畫完之後變高(圖片載入)也跟著停在底部,往上捲在讀的不動;比螢幕高的問題卡留在 它的問題那裡,不被拉到底。FEATURES.md 同步。 已驗證: cargo test 全綠(主程式 767,含 featuremap::、layout_audit::、tool_specs_are_locked、 approval_decisions_are_characterized;新增 attach、deliver_ui 6 條、remote、mirror_ui、 remote_ui、app 的 group_history 與系統提示、layout_audit 的記號滑過清單);verify-anybot deliver.md 全部步驟照貼從頭跑過(傳檔預覽、機密不傳、伺服器上打不開、沒登入沒有發佈、 交付確認顯示/點開/Bot 讀到狀態、顯示失敗叫醒一次且重開後仍是一次),另手動驗過刪掉大腦 副本後手機記「大腦上找不到這個檔案」、已點開的不叫醒;十輪乾淨脈絡獨立審查,最後一輪無 P0/P1。 合進主線後:cargo test 774 通過;verify-approval-routing --replay 跟合併前一樣(AllSurfaces 通過、 replay 10 個都過,「改過了」的 5 段在 HEAD 就是如此);verify-anybot 在新的 scratch 上把 deliver.md、phone.md、cards.md 全部步驟各從頭跑過都通過(含「沒網路也打得開」「斷線又回來」、 問題卡一題一題走);另外實跑:往上捲在讀時,新傳來的圖不會把畫面拉回底部。合併的部分另做 一輪乾淨脈絡獨立審查:沒有 P0/P1,兩條 P2(高的問題卡被拉到底、重畫先用原檔)已修,一條 P2(超過 40 張圖時錯誤處理掛得晚,不會誤報)留著。 未驗證: 真的 iPhone/Android(Safari 的 IntersectionObserver、主畫面 App)——要實機;螢幕電腦 連大腦的真實路徑——要另一台登入同帳號的 AnyBot;桌面視窗的記號與 0.8 秒停留——要開視窗 (ABV_ALLOW_WINDOW,要使用者同意),只有行程內繪圖測試;團隊成員、管理員經帳號伺服器 回報——要帳號伺服器與第二個帳號。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5JgTkqJjkgMtrEXrn
2026-11-20 05:38:58 +00:00
// 交付確認: a device's word on a file (the phone's ✓✓).
for a in &m.attachments {
a.seen.len().hash(&mut h);
}
// 完成宣稱關卡: the reply's 「未驗證」.
m.check.len().hash(&mut h);
}
if let Some(l) = self.streams.get(&b.id) {
(1u8, &l.status, l.paused, l.steer.lock().unwrap().len()).hash(&mut h);
}
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
// (With its key: call ids repeat — call_0 every round — and a new card has to reach
// the phone with its own key.)
self.approvals.get(&b.id).map(|a| (a.call_id.clone(), self.ask_keys.get(&b.id).cloned())).hash(&mut h);
// The phone's home and bot sheet: its model, computer, routines and past chats.
(b.provider, &b.model, &b.default_computer, b.threads.len(), b.id == self.state.primary_bot).hash(&mut h);
for r in &b.routines {
(r.id, &r.title, r.paused, r.next_run).hash(&mut h);
}
}
for (id, _, online) in self.rm.peers.lock().unwrap().iter() {
(id, online).hash(&mut h);
}
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
// A 支線's card (shown in its main bot's chat), with its key.
for br in &self.state.branch_bots {
self.approvals.get(&br.id).map(|a| (br.id, a.call_id.clone(), self.ask_keys.get(&br.id).cloned())).hash(&mut h);
}
crate::cloudbox::run_state().label().hash(&mut h);
// 任務: the list the brain worked out (the phone's 任務 page and its count).
self.tk.sig.hash(&mut h);
// A connector connected or failing: screens and phones hear of it now, not at the next
// long poll's end.
let mut up: Vec<(String, usize)> = crate::mcp::status().into_iter().collect();
up.sort();
(up, self.ch.mcp_errors.lock().unwrap().clone(), self.ch.mcp_busy.load(Ordering::SeqCst)).hash(&mut h);
for pg in &self.state.pages {
(pg.id, pg.revision, pg.updated, &pg.title).hash(&mut h);
}
h.finish()
}
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 cards the phone shows in bot `b`'s chat, each with its own key (the phone sends it
/// back, and the brain applies the answer only to that card): `b`'s own, and its 支線's —
/// shown in the main bot's chat (`bot`), answered for the 支線 (`target`), with the 支線's key.
fn phone_cards(&self, b: &Bot) -> Vec<serde_json::Value> {
let key = |id: u64| self.ask_keys.get(&id).map(String::as_str).unwrap_or("");
let mut out = vec![];
智慧模式設計審計修正:手機也有「這輪都准」、按鈕詞彙統一、無障礙與智慧晶片 照 frontend-design skill 審計(使用者流程與順眼程度): - 手機審批卡:智慧模式開著時「這輪都准」是主按鈕(scope 由大腦從卡片自己的 grant 取,手機的字不會決定範圍;通知不帶 scope);無卡片主按鈕改「允許一次」 (桌面同步改名,全產品動詞一致)。一律允許退為一般按鈕:最有力的許可 不再站最前排。 - 手機聊天輸入列:智慧模式開著時有 ✨ 晶片,點了關掉(手機只能收緊); 關後 state/settings 同步重抓。桌面 ✨ 第一次開著時旁邊標「智慧」兩字, 關過一次就不再有字。 - 無障礙:全站 :focus-visible 焦點框;圖示按鈕(返回、送出、選單…)加 aria-label;審批按鈕組加 role=group。「全部允許,之後直接操作」連結 由 accent 色改灰:最有力的許可給最靜的處理。 - 測試:手機 scope 回答新測試(卡片自己的 grant、通知不帶);真機 e2e: 無頭 iPhone 開聊天見晶片→點→toast、晶片消失、/api/settings 同步 false; 連接器工具卡四顆按鈕「這輪都准/允許一次/一律允許/拒絕」,按「這輪都准」 後工具執行、allow_rules 沒有新增(不落永久規則)。 - 地圖:autonomy/safety/phone/connectors/apps 同步(autonomy 壓回 8999/9000); TLA coverage.tsv 已 rehash(approval_body、cmd_answer、approval_json、 phone_cards、render_dock)。 已驗證: cargo test 721 全綠(含 featuremap::、layout_audit::、phone_scope)、 verify-approval-routing run.sh 全綠、真機 e2e(晶片開關三端同步、scope 卡執行 且無永久規則)、node --check 手機 JS。 未驗證: 桌面視窗的 ✨「智慧」標註與卡片主按鈕外觀(要開視窗,需使用者同意 desktop-shot+人類簽名)。
2026-11-19 07:24:37 +00:00
let smart = self.smart_flag.load(std::sync::atomic::Ordering::Relaxed);
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
if let Some(a) = self.approvals.get(&b.id) {
智慧模式設計審計修正:手機也有「這輪都准」、按鈕詞彙統一、無障礙與智慧晶片 照 frontend-design skill 審計(使用者流程與順眼程度): - 手機審批卡:智慧模式開著時「這輪都准」是主按鈕(scope 由大腦從卡片自己的 grant 取,手機的字不會決定範圍;通知不帶 scope);無卡片主按鈕改「允許一次」 (桌面同步改名,全產品動詞一致)。一律允許退為一般按鈕:最有力的許可 不再站最前排。 - 手機聊天輸入列:智慧模式開著時有 ✨ 晶片,點了關掉(手機只能收緊); 關後 state/settings 同步重抓。桌面 ✨ 第一次開著時旁邊標「智慧」兩字, 關過一次就不再有字。 - 無障礙:全站 :focus-visible 焦點框;圖示按鈕(返回、送出、選單…)加 aria-label;審批按鈕組加 role=group。「全部允許,之後直接操作」連結 由 accent 色改灰:最有力的許可給最靜的處理。 - 測試:手機 scope 回答新測試(卡片自己的 grant、通知不帶);真機 e2e: 無頭 iPhone 開聊天見晶片→點→toast、晶片消失、/api/settings 同步 false; 連接器工具卡四顆按鈕「這輪都准/允許一次/一律允許/拒絕」,按「這輪都准」 後工具執行、allow_rules 沒有新增(不落永久規則)。 - 地圖:autonomy/safety/phone/connectors/apps 同步(autonomy 壓回 8999/9000); TLA coverage.tsv 已 rehash(approval_body、cmd_answer、approval_json、 phone_cards、render_dock)。 已驗證: cargo test 721 全綠(含 featuremap::、layout_audit::、phone_scope)、 verify-approval-routing run.sh 全綠、真機 e2e(晶片開關三端同步、scope 卡執行 且無永久規則)、node --check 手機 JS。 未驗證: 桌面視窗的 ✨「智慧」標註與卡片主按鈕外觀(要開視窗,需使用者同意 desktop-shot+人類簽名)。
2026-11-19 07:24:37 +00:00
out.push(approval_json(b, a, key(b.id), smart));
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
}
for br in self.state.branch_bots.iter().filter(|x| x.branch_of == b.id) {
if let Some(a) = self.approvals.get(&br.id) {
智慧模式設計審計修正:手機也有「這輪都准」、按鈕詞彙統一、無障礙與智慧晶片 照 frontend-design skill 審計(使用者流程與順眼程度): - 手機審批卡:智慧模式開著時「這輪都准」是主按鈕(scope 由大腦從卡片自己的 grant 取,手機的字不會決定範圍;通知不帶 scope);無卡片主按鈕改「允許一次」 (桌面同步改名,全產品動詞一致)。一律允許退為一般按鈕:最有力的許可 不再站最前排。 - 手機聊天輸入列:智慧模式開著時有 ✨ 晶片,點了關掉(手機只能收緊); 關後 state/settings 同步重抓。桌面 ✨ 第一次開著時旁邊標「智慧」兩字, 關過一次就不再有字。 - 無障礙:全站 :focus-visible 焦點框;圖示按鈕(返回、送出、選單…)加 aria-label;審批按鈕組加 role=group。「全部允許,之後直接操作」連結 由 accent 色改灰:最有力的許可給最靜的處理。 - 測試:手機 scope 回答新測試(卡片自己的 grant、通知不帶);真機 e2e: 無頭 iPhone 開聊天見晶片→點→toast、晶片消失、/api/settings 同步 false; 連接器工具卡四顆按鈕「這輪都准/允許一次/一律允許/拒絕」,按「這輪都准」 後工具執行、allow_rules 沒有新增(不落永久規則)。 - 地圖:autonomy/safety/phone/connectors/apps 同步(autonomy 壓回 8999/9000); TLA coverage.tsv 已 rehash(approval_body、cmd_answer、approval_json、 phone_cards、render_dock)。 已驗證: cargo test 721 全綠(含 featuremap::、layout_audit::、phone_scope)、 verify-approval-routing run.sh 全綠、真機 e2e(晶片開關三端同步、scope 卡執行 且無永久規則)、node --check 手機 JS。 未驗證: 桌面視窗的 ✨「智慧」標註與卡片主按鈕外觀(要開視窗,需使用者同意 desktop-shot+人類簽名)。
2026-11-19 07:24:37 +00:00
let mut j = approval_json(br, a, key(br.id), smart);
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
j["bot"] = json!(b.id);
j["target"] = json!(br.id);
j["title"] = json!(format!("支線:{}", j["title"].as_str().unwrap_or("")));
out.push(j);
}
}
out
}
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
pub(super) fn remote_publish(&mut self) {
let sig = self.remote_signature();
if sig == self.rm.sig {
return;
}
self.rm.sig = sig;
self.rm.last_publish = Some(Instant::now());
crate::routines::set_person_timezone(&self.state.timezone);
let names: HashMap<u64, String> = self.state.bots.iter().map(|b| (b.id, b.name.clone())).collect();
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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 raw_order: HashMap<u64, usize> = self.state.bots.iter().enumerate().map(|(i, b)| (b.id, i)).collect();
let mut bots: Vec<&Bot> = self.state.bots.iter().collect();
// Pinned first, then the most recently active.
bots.sort_by_key(|b| (!b.pinned, -(b.last_turn.as_ref().map(|t| t.settled_at_ms).unwrap_or(0))));
// 聊天的顏色, in the names update_settings takes (the phone compares and sends these).
let accent = match self.state.accent {
crate::model::Accent::Quiet => "quiet",
crate::model::Accent::Black => "black",
crate::model::Accent::BotColor => "bot_color",
}
.to_string();
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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 view = remote::View {
host: self.state.remote.host_name.clone(),
person: self.person_name(),
accent,
pin_order: self.pinned_ids(),
newer: self.newer_build.is_some(),
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
always: self.always_on(),
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
sections: self.section_order(),
design: 手機網頁顏色跟著電腦版、改成 Claude 手機 App 的感覺,實點修好 12 個問題 - 顏色:api/state 帶出電腦的主題和淺色/深色兩組顏色(theme::shell 換成手機的 CSS 變數);手機「這支手機的外觀」預設「跟著電腦」,也可選跟著手機、淺色、深色;先驗證是 hex 才套用,存一份避免打開時閃預設色;狀態列跟著畫面。舊版電腦沒送顏色時維持「紙」。電腦畫面頁改成暖色深色。 - 感覺:標題列沒有底線、第二行只寫在做什麼或模型;輸入框是底部圓角卡片;回答下只留時間和三個操作;群組、晶片、建議、記憶卡拿掉框線;開關的「開」用墨色;允許卡細框;點擊範圍加大(44/40/36px)。 - 字更少:設定首頁拿掉重複說明;每列說明一行;「模型」頁右邊只寫可以用/未設定;Bot 那列選單少用的收進「更多…」。 - 修好:長 Bot 名字超出 @// 選單;引用顯示原始 Markdown 且沒有長度上限;第 8 個表情換行;.note 在清單裡變灰條;圖片點了跳出 App;上傳吐司蓋住輸入框;「聊天的顏色」永遠沒有 ✓(電腦送 "Quiet",改送 quiet/black/bot_color);「:」後的網址不成連結;深色模式黑頭像看不見;稽核分頁出現 ** 和多行 JSON;頁面卡標題重複;記憶搜尋框 14px 讓 iPhone 放大。 - 問題卡的「略過」、交辦的「跳過」、允許卡的「拒絕」不再是紅字,跟電腦版一樣是一般按鈕。 已驗證:cargo test --bin anybot 523 通過(含 phone_login_and_api 檢查主題和兩組顏色)、relay 22 通過;手機圖表 65/65、通知 9/9、電腦畫面 13/13;playwright 390×844 淺色深色點過登入、首頁、聊天、詳細資訊、Bot 設定、頁面、例行任務、電腦、設定每一頁,沒有 console 錯誤、失敗請求或橫向溢出;電腦換靛藍深色,手機跟著變。 未驗證:真的 iPhone/Android 實機。
2026-11-16 15:16:38 +00:00
theme: match self.state.theme {
crate::model::Theme::Light => "light",
crate::model::Theme::Dark => "dark",
crate::model::Theme::System => "system",
}
.to_string(),
palettes: phone_palettes(&self.state),
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
..Default::default()
};
let peers = self.rm.peers.lock().unwrap().clone();
for b in bots {
// Its computers, each as the phone shows it: what it is and whether it is there now.
let targets = self.targets_for(b);
let roles = self.roles_for(b, &targets);
let computer = Self::chosen_computer(b, &targets, &roles).0;
本機和雲端分得出來(計畫 B3):每個模型服務標它在哪裡跑——「本機」(localhost)、「區網」(私有位址、tailnet 100.64/10、.local、.ts.net、沒有點的名字…)、「雲端」(其他全部;ChatGPT 方案一律雲端),本機、區網綠字。一句話說在哪台跑、什麼會送出去:「在這台電腦上跑:對話、檔案內容和截圖都不會離開這台」「在你網路裡的 192.168.1.20 上跑…」「在 xAI Grok 的伺服器上跑:Bot 的對話、它讀到的檔案內容和截圖會送過去」;螢幕電腦和手機上本機寫成大腦那台。只看網址字串、不查 DNS(原本的 is_local_model 會查名字,畫面每格都畫不得),分不出來就說雲端。 標在:設定 › 模型 左欄每列右邊(左欄 180 → 212 px 放得下「自訂(OpenAI 相容)」加標籤)、標題下一句;Bot 設定「AI 供應商與模型」下面;聊天頂端 Bot 名字後面;空聊天「供應商 · 模型 · 雲端」;輸入框 + 的模型選單每家後面。手機:大腦送 runs、runs_words(bots)和 runs(模型清單、設定的 providers),Bot 設定 › 模型 右邊、選模型時每家的標題、設定 › 模型 每家的說明。「Ollama(本機)」改叫「Ollama」(它可以指到區網另一台,名字寫死本機會說錯)。功能地圖 models.md(models-where、新的驗證步驟)、FEATURES.md(模型在哪裡跑)、計畫 B3 同步。 已驗證: cargo test 全綠(823),新測試 each_model_says_where_it_runs(本機、各種區網、雲端、帳密不進句子、公開網域算雲端、ChatGPT 方案、OpenRouter、空網址);layout_audit 過(第一版標籤和換行的句子重疊被它抓到,改成一段兩色的文字);clippy 錯誤數跟之前一樣(12);桌面截圖(ABV_ALLOW_WINDOW):設定 › 模型每列右邊「雲端/本機」、xAI Grok 標題下那句,聊天頂端「Bot 雲端」,空聊天「OpenAI · gpt-5 · 雲端」;verify-anybot 手機:Bot 設定 › 模型 右邊「本機」、選模型時「自訂(OpenAI 相容) · 本機」,API 的 runs_words「在大腦「驗證用 AnyBot」那台電腦上跑…」。 未驗證: 螢幕電腦(連著別台大腦)上那句寫大腦名字——要兩台;Bot 設定裡那一行要捲到下面,截圖沒截到(layout_audit 有畫到那裡)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 03:25:16 +00:00
let runs = crate::providers::runs_at(b.provider, &crate::providers::resolve_base(b.provider, &self.state.provider(b.provider).base_url));
let computers: Vec<serde_json::Value> = targets.iter().map(|t| {
let (kind, online) = match &t.place {
tools::Place::Box { .. } => ("own", crate::cloudbox::available()),
tools::Place::Sealed { .. } => ("own", false),
tools::Place::Local { .. } => ("this", true),
tools::Place::Device { host, .. } => ("device", peers.iter().any(|(id, _, on)| id == host && *on)),
tools::Place::Ssh { .. } => ("ssh", true),
};
json!({"name": t.name, "kind": kind, "online": online, "person": roles.person.as_deref() == Some(t.name.as_str())})
}).collect();
let live = self.streams.get(&b.id);
// The last thing said (not an error the model service sent, which then sat on the home).
let last = b.messages.iter().rev().find(|m| !m.text.trim().is_empty() && m.role != Role::Tool && !m.error).map(|m| first_line(&m.text, 60)).unwrap_or_default();
let c = crate::avatar::color(&b.color);
let hex = format!("#{:02x}{:02x}{:02x}", c.r(), c.g(), c.b());
view.bots.push(json!({
"id": b.id, "name": b.name, "description": b.description, "color": hex, "shape": b.shape,
"busy": live.is_some(), // (What it is doing now, in the same words as above the input on the computer.)
"status": self.working_phrase(crate::model::now_ms() as f64 / 1000.0, b).unwrap_or_default(),
"unread": b.unread, "last": last, "members": !b.members.is_empty(), "pinned": b.pinned,
Bot 之間溝通:ask_bot 問同事並等回答、群組 @點名、共用頁面/「關於你」記憶/教技能;修正插話丟附件、Enter 核准失效等 問同事(ask_bot) - A 問 B 並等它回答:問題放進 B 自己的聊天,B 用自己的模型、工具、記憶和電腦做,最後的回覆交回 A - 最多轉 3 手、不能互等(避免卡死)、對方忙就排隊(10 分鐘逾時)、停止 A 時 B 也停 - message_bot 也加轉手上限;別的 Bot 叫的不算使用者的話(改不了自己的設定) 群組 @點名 - 「@名字」只叫被點到的成員回答;成員在回覆裡 @ 別人就接著說(一輪最多 8 則) - 電腦和手機的輸入框打 @ 會列出成員 - 修正:每個成員帶自己的記憶;成員回覆的每一步都記得是誰說的 共用資源 - Bot 可以讀其他 Bot 的頁面(只能讀,改要請作者改) - 共用的「關於你」記憶:每個 Bot 都帶著,記憶頁可切換查看、編輯;外人的訊息不帶 - teach_skill:把自己會的技能教給同事(先問你);同事名冊列出每個 Bot 會的技能 修正 - 插話(Bot 工作中傳訊息)會帶附件:聊天有檔案卡片,模型看得到圖片;當機復原也帶著 - 輸入框有焦點、框是空的時 Enter 允許待核准的步驟(原本被當成空白送出吃掉) - 大腦的螢幕連不到大腦時,引用、附件、記憶不會先被用掉 - 「還原上一個答案」存在 Bot 上:重開還在,連大腦的畫面和手機都能還原;停止的回合也留著 - Bot 忙時被叫醒(例行任務、message_bot、觸發器)改成排隊開自己的一輪,不再壓成純文字插話 - 停止時結果已回來的步驟標成完成;輸入法剛選字的那一格不送出 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 13:34:03 +00:00
// 重新產生 replaced an answer: 「還原上一個答案」 can put it back.
"can_restore": !b.regen_undo.is_empty(),
/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
// 團隊: whether teammates may use it (remote.rs shows a member only these).
"team": b.team,
// Its skills (null: every one), for the phone's 「/word」 list.
"skills": b.skills,
Bot 之間溝通:ask_bot 問同事並等回答、群組 @點名、共用頁面/「關於你」記憶/教技能;修正插話丟附件、Enter 核准失效等 問同事(ask_bot) - A 問 B 並等它回答:問題放進 B 自己的聊天,B 用自己的模型、工具、記憶和電腦做,最後的回覆交回 A - 最多轉 3 手、不能互等(避免卡死)、對方忙就排隊(10 分鐘逾時)、停止 A 時 B 也停 - message_bot 也加轉手上限;別的 Bot 叫的不算使用者的話(改不了自己的設定) 群組 @點名 - 「@名字」只叫被點到的成員回答;成員在回覆裡 @ 別人就接著說(一輪最多 8 則) - 電腦和手機的輸入框打 @ 會列出成員 - 修正:每個成員帶自己的記憶;成員回覆的每一步都記得是誰說的 共用資源 - Bot 可以讀其他 Bot 的頁面(只能讀,改要請作者改) - 共用的「關於你」記憶:每個 Bot 都帶著,記憶頁可切換查看、編輯;外人的訊息不帶 - teach_skill:把自己會的技能教給同事(先問你);同事名冊列出每個 Bot 會的技能 修正 - 插話(Bot 工作中傳訊息)會帶附件:聊天有檔案卡片,模型看得到圖片;當機復原也帶著 - 輸入框有焦點、框是空的時 Enter 允許待核准的步驟(原本被當成空白送出吃掉) - 大腦的螢幕連不到大腦時,引用、附件、記憶不會先被用掉 - 「還原上一個答案」存在 Bot 上:重開還在,連大腦的畫面和手機都能還原;停止的回合也留著 - Bot 忙時被叫醒(例行任務、message_bot、觸發器)改成排隊開自己的一輪,不再壓成純文字插話 - 停止時結果已回來的步驟標成完成;輸入法剛選字的那一格不送出 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 13:34:03 +00:00
// @點名: a group's members, as the phone's @ list offers them.
"member_names": self.member_names(b).into_iter().map(|(_, n)| n).collect::<Vec<_>>(),
"primary": b.id == self.state.primary_bot,
"time": b.messages.iter().rev().find(|m| m.role != Role::Tool).map(|m| m.at).unwrap_or(0),
"via": format!("{} · {}", b.provider.label(), b.model),
本機和雲端分得出來(計畫 B3):每個模型服務標它在哪裡跑——「本機」(localhost)、「區網」(私有位址、tailnet 100.64/10、.local、.ts.net、沒有點的名字…)、「雲端」(其他全部;ChatGPT 方案一律雲端),本機、區網綠字。一句話說在哪台跑、什麼會送出去:「在這台電腦上跑:對話、檔案內容和截圖都不會離開這台」「在你網路裡的 192.168.1.20 上跑…」「在 xAI Grok 的伺服器上跑:Bot 的對話、它讀到的檔案內容和截圖會送過去」;螢幕電腦和手機上本機寫成大腦那台。只看網址字串、不查 DNS(原本的 is_local_model 會查名字,畫面每格都畫不得),分不出來就說雲端。 標在:設定 › 模型 左欄每列右邊(左欄 180 → 212 px 放得下「自訂(OpenAI 相容)」加標籤)、標題下一句;Bot 設定「AI 供應商與模型」下面;聊天頂端 Bot 名字後面;空聊天「供應商 · 模型 · 雲端」;輸入框 + 的模型選單每家後面。手機:大腦送 runs、runs_words(bots)和 runs(模型清單、設定的 providers),Bot 設定 › 模型 右邊、選模型時每家的標題、設定 › 模型 每家的說明。「Ollama(本機)」改叫「Ollama」(它可以指到區網另一台,名字寫死本機會說錯)。功能地圖 models.md(models-where、新的驗證步驟)、FEATURES.md(模型在哪裡跑)、計畫 B3 同步。 已驗證: cargo test 全綠(823),新測試 each_model_says_where_it_runs(本機、各種區網、雲端、帳密不進句子、公開網域算雲端、ChatGPT 方案、OpenRouter、空網址);layout_audit 過(第一版標籤和換行的句子重疊被它抓到,改成一段兩色的文字);clippy 錯誤數跟之前一樣(12);桌面截圖(ABV_ALLOW_WINDOW):設定 › 模型每列右邊「雲端/本機」、xAI Grok 標題下那句,聊天頂端「Bot 雲端」,空聊天「OpenAI · gpt-5 · 雲端」;verify-anybot 手機:Bot 設定 › 模型 右邊「本機」、選模型時「自訂(OpenAI 相容) · 本機」,API 的 runs_words「在大腦「驗證用 AnyBot」那台電腦上跑…」。 未驗證: 螢幕電腦(連著別台大腦)上那句寫大腦名字——要兩台;Bot 設定裡那一行要捲到下面,截圖沒截到(layout_audit 有畫到那裡)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 03:25:16 +00:00
// Where the model runs (本機/區網/雲端), for the phone: "this computer" is the brain.
"runs": runs.short(), "runs_words": runs.words(Some(if self.state.remote.host_name.trim().is_empty() { "大腦" } else { self.state.remote.host_name.trim() })),
"provider": serde_json::to_value(b.provider).unwrap_or_default(), "model": b.model,
"computer": computer, "computers": computers,
"routines": b.routines.iter().map(|r| json!({"id": r.id, "title": r.title, "paused": r.paused, "when": crate::appctl::routine_when(r)})).collect::<Vec<_>>(),
"threads": b.threads.iter().enumerate().rev().take(20).map(|(i, (title, msgs))| json!({"index": i, "title": title, "count": msgs.len(), "at": msgs.last().map(|m| m.at).unwrap_or(0)})).collect::<Vec<_>>(),
// The sidebar's sections, the colour by name (the editor), what is queued while it works.
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
"folder": b.folder, "color_key": b.color, "order": raw_order.get(&b.id).copied().unwrap_or(0),
// 聊天的顏色 (設定 › 一般): how the phone draws your bubbles — the same choice.
"bubble": match self.state.accent {
crate::model::Accent::Quiet => "quiet",
crate::model::Accent::Black => "black",
crate::model::Accent::BotColor => "bot",
},
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
"thinking": b.thinking, "step_model": b.step_model,
A turn cut off by a crash leaves a 「繼續」 card, and nothing it may have done runs twice Each bot keeps a work log (oplog/bot-<id>.jsonl, after pi's durable-harness design, cut down): before something happens a line says it is about to — the turn, each model call, each step once its checks passed (with the arguments it runs with and whether it may run again), each message typed mid-turn — synced to disk first. When the turn ends the file shrinks to the messages still waiting, usually nothing. On the next start after AnyBot was killed mid-turn, the log puts the chat right before anything runs: the message the turn answered comes back if the chat lost it; a step that was running and reaches outside (a text, a click, a file, a published site) shows as 「可能已經執行了」, both to the person and in the result the bot reads — no longer as "not allowed"; a step that only looked shows as cut off; messages typed mid-turn that never reached the bot go back into the chat. The chat is saved, then the log closes the turn. A turn the person didn't stop ends with a 「繼續」 card (what it was doing, what may have run, the messages put back); it goes on only when they press it — in the window, on a screen of the brain, or on the phone — from where its steps stand, never running a step that may have run again. Pressing stop is on disk at once, and a stopped turn stays stopped. Also in the turn loop: - 自動審核 that doesn't answer (or answers something that isn't a verdict) asks the person; in 直接操作 mode it used to let the step through unchecked. - "Too long for this model" folds older messages into a summary and asks the same step again, once per thing the person said, instead of ending the turn. - Folding keeps the person's chat whole: the summary goes in at the fold and the model reads from the newest summary on (it used to delete what it folded). - A step moved to the chosen computer runs there, but the chat keeps the call as the model wrote it; the result says where it ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-08 16:49:12 +00:00
"queued": live.map(|l| l.steer.lock().unwrap().iter().map(|q| q.text.clone()).collect::<Vec<_>>()).unwrap_or_default(),
// 目標: how it stands (its icon's words above the input), worded here so the phone says it the same way.
// 計畫: where it is (its icon's words above the input), worded here like the window's.
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
"plan": b.plan.as_ref().map(|p| json!({
"task": p.task, "stage": p.stage, "line": crate::plan::bar_text(p),
"steps": if p.stage == crate::plan::Stage::Doing { crate::plan::checklist(&p.steps) } else { String::new() },
})),
"goal": b.goal.as_ref().map(|g| json!({
"condition": g.condition, "reason": g.reason, "active": g.active(),
"line": if g.active() && self.goal_checking.contains(&b.id) { "目標 · 正在檢查有沒有達成…".to_string() } else { crate::goal::bar_text(g, crate::model::now_ms()) },
})),
}));
手機「載入更早的對話」按了沒反應:大腦的 api/bots/<id>/older 只在發布給手機的那份(最新 PHONE_TAIL=120 則,工具結果不算一則)裡往回找。Jenny 那一輪做了 65 個步驟,一步兩則,120 則還裝不下這一輪;手機拿完那份之後,按鈕還在(第一則序號 > 0),older 回來的都是手上已有的,loadOlder 看到沒有新的就直接 return,什麼都沒說——看起來就是按了沒反應。 - 大腦:older 改成問 App(phone_act "older",讀的角色都能用),從整段聊天組。發布那份和這裡用同一個 phone_messages(從 remote_ui 的發布迴圈抽出來,給任意一段:步驟帶結果、思考、頁面卡、支線、檔案的 ✓ 另外放);一段裡步驟佔掉位置時再往前補,補到 count 則或到開頭,多的切掉留給下一次,more 照實說。各角色看得到的照舊(messages_for_role)。沒有 App 在跑(只測伺服器,hub 沒有 repaint)時照舊從發布的那份找。 - 手機:補的時候按鈕寫「載入中…」、不能連按;補完畫面停在原本看的地方;到開頭說「已是對話最開頭」、按鈕收起;拿到的 ✓ 一起合進來。 - chat.md 的「開聊天分頁」那一步原本只填 40 則沒有步驟的訊息,全在那 120 則裡,從來沒測到這種聊天:改成 40 輪各一個步驟(160 則,超過手機那份),按兩下;原本點的 [data-s="out"] 在帳戶選單裡已經不存在(是「登出這支手機」選項),一起改;登入後等首頁出來再點。 已驗證: cargo test 839 過(新:loading_earlier_walks_the_whole_chat——301 則、150 個步驟的聊天,從 181 往前拿 60 則、最後一則 179、more true、每步帶結果;從 9 往前拿到 0、more false;管理員也能讀;remote:: 原有的 older 測試照舊過);clippy 維持 12;scratch 照 chat.md 那一步跑(40 輪、160 則,手機那份從序號 40 起):打開從「填充31」(序號 120、30 則),第一下補到「填充11」(序號 40),第二下補到「填充1」(序號 0,手機那份之外——以前這下沒反應)、「已是對話最開頭」、按鈕消失,畫面停在原本看的地方。 未驗證: Jenny 的手機上——「載入更早」是她電腦上的大腦(jenny-Host)回答的,要更新她的 AnyBot(要重開,等她閒著)才生效;手機頁面那半要更新 ai 的帳號伺服器。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 08:28:27 +00:00
// (The newest PHONE_TAIL; 載入更早 asks for any stretch before it: phone_messages.)
let (msgs, deliveries) = self.phone_messages(b, &names, b.messages.len().saturating_sub(remote::PHONE_TAIL), b.messages.len());
view.messages.insert(b.id, msgs);
view.deliveries.insert(b.id, deliveries);
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
view.approvals.extend(self.phone_cards(b));
}
view.pages = self.state.pages.clone();
view.tasks = self.tk.list.iter().map(crate::tasks::json).collect();
// The models a bot can be switched to from the phone: each provider that is ready.
view.models = crate::providers::ALL_PROVIDERS
.iter()
feat: ChatGPT 方案——用 ChatGPT 帳號登入,Bot 用你 ChatGPT 方案的額度,不用 API 金鑰 - 新供應商「ChatGPT 方案」(src/chatgpt.rs):照 OpenAI 給開源 App 的 Sign in with ChatGPT。 第一次登入註冊 AnyBot(dynamic_agent_client → oaiapp_…)並重用;PKCE、state、nonce; ID token 驗 RS256 簽章、iss、aud、exp、nonce;沒同意使用方案算登入但不能用(再登入會要求同意)。 - 要求走 Responses API(api.openai.com/v1/responses,store:false、stream:true、instructions), token 只送 OpenAI 自己的網址;收到 response.completed 才算完成;額度用完停下來給管理用量連結, 不重試、不改用 API 金鑰。token 快到期或 401 時更新(一次一個,refresh token 會輪替)。 - 設定 › 模型 › ChatGPT 方案:使用 ChatGPT 繼續、登出、換帳號、打開登入頁、管理用量; 連到伺服器大腦的螢幕電腦和手機也能登入(登入頁開在自己這台,打不開的那頁網址貼回給大腦)。 - Bot 工具 chatgpt_login(status、login、logout、switch_account;登出和換帳號先問)。 - 修連接器登入:封存的 token 前綴寫錯("sealed:" 實際是 "enc:v1:"),重開 App 後 token 沒解開就被當成憑證送出,登入等於每次重開都失效。 已驗證: cargo test 全綠(chatgpt::、providers::、appctl::、remote::、mcp_oauth::、featuremap::、layout_audit::); 授權網址的參數送到 auth.openai.com 沒被拒(302 到登入頁)。 未驗證: 實際用 ChatGPT 帳號登入、同意、Responses 串流與工具呼叫(要真的 ChatGPT 付費帳號和瀏覽器); 螢幕電腦貼回網址、手機登入(要實機);Windows 的「打開登入頁」。 動到審批路徑(appctl::needs_approval 的 chatgpt_login):需要實機測試+人類簽名。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:23:10 +00:00
.filter(|&&k| crate::providers::ready(k, &self.state.provider(k).api_key))
// Only models that chat: an image or video generator picked for a bot would break it.
本機和雲端分得出來(計畫 B3):每個模型服務標它在哪裡跑——「本機」(localhost)、「區網」(私有位址、tailnet 100.64/10、.local、.ts.net、沒有點的名字…)、「雲端」(其他全部;ChatGPT 方案一律雲端),本機、區網綠字。一句話說在哪台跑、什麼會送出去:「在這台電腦上跑:對話、檔案內容和截圖都不會離開這台」「在你網路裡的 192.168.1.20 上跑…」「在 xAI Grok 的伺服器上跑:Bot 的對話、它讀到的檔案內容和截圖會送過去」;螢幕電腦和手機上本機寫成大腦那台。只看網址字串、不查 DNS(原本的 is_local_model 會查名字,畫面每格都畫不得),分不出來就說雲端。 標在:設定 › 模型 左欄每列右邊(左欄 180 → 212 px 放得下「自訂(OpenAI 相容)」加標籤)、標題下一句;Bot 設定「AI 供應商與模型」下面;聊天頂端 Bot 名字後面;空聊天「供應商 · 模型 · 雲端」;輸入框 + 的模型選單每家後面。手機:大腦送 runs、runs_words(bots)和 runs(模型清單、設定的 providers),Bot 設定 › 模型 右邊、選模型時每家的標題、設定 › 模型 每家的說明。「Ollama(本機)」改叫「Ollama」(它可以指到區網另一台,名字寫死本機會說錯)。功能地圖 models.md(models-where、新的驗證步驟)、FEATURES.md(模型在哪裡跑)、計畫 B3 同步。 已驗證: cargo test 全綠(823),新測試 each_model_says_where_it_runs(本機、各種區網、雲端、帳密不進句子、公開網域算雲端、ChatGPT 方案、OpenRouter、空網址);layout_audit 過(第一版標籤和換行的句子重疊被它抓到,改成一段兩色的文字);clippy 錯誤數跟之前一樣(12);桌面截圖(ABV_ALLOW_WINDOW):設定 › 模型每列右邊「雲端/本機」、xAI Grok 標題下那句,聊天頂端「Bot 雲端」,空聊天「OpenAI · gpt-5 · 雲端」;verify-anybot 手機:Bot 設定 › 模型 右邊「本機」、選模型時「自訂(OpenAI 相容) · 本機」,API 的 runs_words「在大腦「驗證用 AnyBot」那台電腦上跑…」。 未驗證: 螢幕電腦(連著別台大腦)上那句寫大腦名字——要兩台;Bot 設定裡那一行要捲到下面,截圖沒截到(layout_audit 有畫到那裡)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 03:25:16 +00:00
.map(|&k| json!({"provider": serde_json::to_value(k).unwrap_or_default(), "label": k.label(), "runs": crate::providers::runs_at(k, &crate::providers::resolve_base(k, &self.state.provider(k).base_url)).short(), "models": self.models_for(k).into_iter().filter(|m| chats(m)).collect::<Vec<_>>()}))
.collect();
remote::hub().publish(view);
}
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
pub(super) fn remote_cmd(&mut self, ctx: &egui::Context, c: Cmd) {
match c {
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
Cmd::Meeting { bot, path, lang } => {
// Only a recording the app itself stored (uploaded into its attachments).
let root = crate::model::State::path().parent().map(|p| p.join("attachments")).and_then(|p| p.canonicalize().ok());
match (std::path::Path::new(&path).canonicalize().ok(), root) {
(Some(f), Some(root)) if f.starts_with(&root) && f.is_file() => self.meeting_job(bot, f, lang, true),
_ => {}
}
}
Bot 感知得到工作流:你在畫布旁邊打的每一則都帶著「開著工作流「X」(#id)的畫布」,說明裡列出有哪些工作流,並寫明工作流只能用 workflow 做。 查 nobledesktop 上的「水哥哥」(大腦和手腳都已經是 bbf5b4b,能力全開,那一輪的工具清單裡有 workflow): - 11:29(UTC)使用者說「我在工作流的版面了,你幫我寫」時大腦還是舊版(11:54 才更新),它真的沒有工具,就寫成頁面「海巡工作流」+例行任務,並說「我寫不進去那個畫布」。 - 更新後它照自己先前的說法,沒再看工具清單;查 anybot_guide 時讀的是 settings、chat、routines,三區都沒提工作流(log 裡它自己的檢討也這樣寫)。它也不知道使用者開著哪個畫布。 改的: - Message 多一個 seen:你在畫布旁邊打字時,視窗把「工作流「X」(#id,N 個步驟)的畫布,就在你的聊天旁邊——看和改它用 workflow(id N)」記在那則訊息上,模型在〔送出時間〕後面讀到〔使用者送出這則時開著:…〕。螢幕電腦也帶得過去(Job::Send 的 seen → /api/sync/act 的 send → Cmd::Send 的 seen);手機、團隊成員的訊息不帶。 - 說明(system prompt):「工作流只能用 workflow 建立和修改,不要用頁面或例行任務代替;這一輪的工具清單有 workflow 就做得到,之前在這個聊天說過做不到的,以現在為準」,並列出目前的工作流(最多 12 個:#id「名稱」(N 個步驟,排程))。 - 功能地圖:routines、pages 的陷阱各加一條「要的是工作流畫布 → workflow」,workflow 寫上 Bot 知道哪個畫布開著。 已驗證: cargo test 863 過(新:a_message_says_which_canvas_is_open、the_instructions_know_the_workflows);scratch 真資料:建一個工作流、打開畫布、在旁邊的聊天打「畫布上這個你看得到嗎」,假模型收到的那則後面是〔使用者送出這則時開著:工作流「海巡」(#1,1 個步驟)的畫布,就在你的聊天旁邊——看和改它用 workflow(id 1)〕;clippy 沒有新的。layout_audit 在一次全部跑時失敗過一次、再跑兩次都過(不穩,沒找到原因)。 未驗證: 真的 grok-4.7 收到這些後會不會用 workflow——要 nobledesktop 的大腦和你的螢幕都更新到這一版。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 12:13:50 +00:00
Cmd::Send { bot, text, attachments, from, memories, member, seen } => {
if self.state.bot(bot).is_none() {
return;
}
// Typed on one of the account's computers: that one is the person's now (for
// 「我的電腦」 and the model on their network). The phone isn't a computer.
安全、修正: 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 !from.is_empty() && !member {
remote::set_person_host(&from);
// A computer this brain hasn't heard of yet (it just came on): look the
// account's computers up now, or its 「我的電腦」 wouldn't be known for a minute.
if !self.rm.peers.lock().unwrap().iter().any(|(id, _, online)| *id == from && *online) {
let v = remote::devices_online(&self.state.remote);
if !v.is_empty() {
*self.rm.peers.lock().unwrap() = v;
}
self.rm.peers_at = Some(Instant::now());
}
self.typed_on = Some(from);
}
// Only files the app itself stored in its attachments folder may ride along;
// resolve first, so "../../" paths cannot escape it (the phone can name any path).
let root = crate::model::State::path().parent().map(|p| p.join("attachments")).and_then(|p| p.canonicalize().ok());
let atts: Vec<crate::attach::Attachment> = attachments
.iter()
.filter_map(|p| {
let f = std::path::Path::new(p).canonicalize().ok()?;
if !root.as_ref().map(|r| f.starts_with(r) && f.is_file()).unwrap_or(false) {
return None;
}
let meta = std::fs::metadata(&f).ok()?;
let file = f.file_name()?.to_string_lossy().to_string();
let name = file.split_once('-').map(|x| x.1.to_string()).unwrap_or(file);
// Also on the bot's own computer, where it works (a brain on a server
// has no other computer of its own to read it from).
let on_box = crate::cloudbox::copy_in(&f.display().to_string(), bot, &name).unwrap_or_default();
feat: 交付確認——Bot 傳的檔案記下在哪台裝置顯示、點開沒,沒顯示出來叫醒 Bot 一次 起因:Bot 產了一張圖、send_file 回報成功、Bot 一直說「已完成」,但圖一直沒出現在使用者 的聊天裡,系統完全不知道。「完成」改成:你看得到、能用,而且系統知道你收到了。 - 附件有身分:attach::store/store_bytes 給每個附件一個編號(舊資料讀得進來,沒有回報的 附件寫出來跟以前一字不差);螢幕電腦把路徑換成本機副本時編號不變,回報一律用編號。 - 三層狀態記在大腦那則附件上:已在聊天 → 已在某台裝置顯示 → 點開了,或「顯示失敗」加 原因;每筆記哪台裝置和時間,同一台同一種只記第一次,最多 12 筆。記號和「已顯示/已 點開」只看擁有者自己的裝置;團隊成員、管理員的裝置只記下(最多 4 筆)、不叫醒。 - 誰回報: - 手機:POST api/bots/<id>/seen(團隊成員也可以)。圖片真的載入、在畫面裡、頁面在前面 才算顯示;預覽真的畫出來(文字、表格、圖、PDF 的頁、能播的錄音影片)或存到手機才算 點開;大腦回 404/422/500 或圖片再抓一次還是解不開算失敗;斷線、408、429、502–504 算網路問題、不算。不排隊,每次開頁面每個附件每種只報一次。 - 大腦自己的視窗(「這台電腦」):卡片在畫面裡停留 0.8 秒、視窗在前面才算顯示(聊天剛 打開時從頂端畫的那一格、「回到最新訊息」捲過去的不算);點開算點開;檔案不見了算失敗。 - 螢幕電腦:api/sync/act 的 seen(大腦用它的名字記,另開執行緒送、不擋其他訊息);抓大腦 檔案被回 404 算失敗(以前完全不報),網路斷了不算。 - 裝置名稱、原因都由大腦從固定的字選,頁面送來的字不會原樣進到 Bot 那裡。 - 同步:remote_signature、msg_sig、聊天存檔的 chat_mark 都算進回報;message_json 對 Bot 傳 的附件輸出 id、delivery、seen。 - 畫面:Bot 傳來的附件下面一個灰色小記號——✓ 已在聊天、✓✓ 已在某台裝置顯示、點開過的 ✓✓ 是強調色;手機點記號跳出清單、電腦版滑過看清單(每台裝置、時間、顯示/點開/失敗和 原因)。使用者自己附的檔案沒有記號。失敗不另外跳字;手機上解不開的圖也顯示原本的 「這張圖讀不到」(以前是一塊空白)。 - Bot 知道:send_file 的結果改成「已放進聊天(…附件 <編號>)…不要說使用者已經看到」;之後 的回合結果後面帶一行〔交付狀態:…〕(日期寫死,不會每天變);系統提示加一句以那個狀態 為準、使用者問收到沒照它回答。 - 叫醒:擁有者的裝置回報顯示失敗、而且還沒有擁有者的裝置顯示過,叫醒那個 Bot 一次(新的 「[交付]」標籤,視窗和手機的 WAKE_TAGS 一起改),只寫附件編號和副檔名、哪台、為什麼 (不寫檔名:檔名可能來自外面,這則訊息帶著擁有者的信任開一輪),請它換方式交付。只在 「傳出這個檔案的那一輪是擁有者開的」時叫醒:訊息管道的人、團隊成員、別的 Bot 要的檔案、 群組聊天、給使用者看畫面的截圖、支線帶回的檔案都只記下。擁有者上次說話之後最多兩次; Bot 在忙、叫醒在排隊時別台顯示了就取消。 - docs/feature-map/deliver.md 新增子功能 deliver-confirm、使用者怎麼到、三條 verify-anybot 步驟、陷阱;FEATURES.md 同步。verify-anybot 的假模型照規則回答時多記 tool_results(這個 請求裡每個工具結果的結尾),用來證明 Bot 讀到〔交付狀態〕。 合進主線(接在手機、螢幕電腦「沒網路照樣能用」之後) - 手機頁面:apiOnce 用主線那行(已經帶 e.status、e.unsure);離開聊天先存一份、回到聊天看 畫面裡的附件,兩個都留。螢幕電腦:兩邊新增的測試都留,離線那輪的測試附件補上新欄位。 - 合併後跑 deliver.md 時發現(以前就有、離線那輪重畫變多後才明顯):手機聊天每次重畫, 圖片都先退回檔名再載入、長高,「停在最新訊息」只在重畫那一刻判斷,幾張圖之後最新那則 被推到畫面外、也就永遠不算「顯示」。改成:已經讀到的圖重畫時直接沿用;停在底部時, 內容在畫完之後變高(圖片載入)也跟著停在底部,往上捲在讀的不動;比螢幕高的問題卡留在 它的問題那裡,不被拉到底。FEATURES.md 同步。 已驗證: cargo test 全綠(主程式 767,含 featuremap::、layout_audit::、tool_specs_are_locked、 approval_decisions_are_characterized;新增 attach、deliver_ui 6 條、remote、mirror_ui、 remote_ui、app 的 group_history 與系統提示、layout_audit 的記號滑過清單);verify-anybot deliver.md 全部步驟照貼從頭跑過(傳檔預覽、機密不傳、伺服器上打不開、沒登入沒有發佈、 交付確認顯示/點開/Bot 讀到狀態、顯示失敗叫醒一次且重開後仍是一次),另手動驗過刪掉大腦 副本後手機記「大腦上找不到這個檔案」、已點開的不叫醒;十輪乾淨脈絡獨立審查,最後一輪無 P0/P1。 合進主線後:cargo test 774 通過;verify-approval-routing --replay 跟合併前一樣(AllSurfaces 通過、 replay 10 個都過,「改過了」的 5 段在 HEAD 就是如此);verify-anybot 在新的 scratch 上把 deliver.md、phone.md、cards.md 全部步驟各從頭跑過都通過(含「沒網路也打得開」「斷線又回來」、 問題卡一題一題走);另外實跑:往上捲在讀時,新傳來的圖不會把畫面拉回底部。合併的部分另做 一輪乾淨脈絡獨立審查:沒有 P0/P1,兩條 P2(高的問題卡被拉到底、重畫先用原檔)已修,一條 P2(超過 40 張圖時錯誤處理掛得晚,不會誤報)留著。 未驗證: 真的 iPhone/Android(Safari 的 IntersectionObserver、主畫面 App)——要實機;螢幕電腦 連大腦的真實路徑——要另一台登入同帳號的 AnyBot;桌面視窗的記號與 0.8 秒停留——要開視窗 (ABV_ALLOW_WINDOW,要使用者同意),只有行程內繪圖測試;團隊成員、管理員經帳號伺服器 回報——要帳號伺服器與第二個帳號。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5JgTkqJjkgMtrEXrn
2026-11-20 05:38:58 +00:00
Some(crate::attach::Attachment { image: crate::attach::is_image_name(&name), name, path: f.display().to_string(), bytes: meta.len(), on_box, ..Default::default() })
})
.collect();
安全、修正: 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
// 目標: 「/goal …」 is AnyBot's, not the bot's (owner/admin only); anything else takes a paused goal up again.
if !member {
// AnyBot's own commands from the phone or a screen (commands.rs): the owner's
// only (a teammate's words arrive as 「【名字】…」, never a command). A
// /doctor from there: the brain checks itself.
if let Some(cmd) = self.command_for(bot, &text) {
self.run_app_command(ctx, bot, cmd, &text, atts, memories);
feat: /doctor 診斷這台電腦:連線、Tailscale 直連還是中繼、大腦、模型服務、Bot 的電腦、連接器、磁碟、上次出錯 工程基礎計畫 E11(grok-build 的 /doctor)。早上「連不到大腦」花了半小時用指令查出是 Tailscale 走香港中繼,現在打一句就看得到。 - doctor.rs:報告的樣子(一項一行 ✓/✗,最後數有幾項要看);帳號伺服器網址是 *.ts.net 時跑 tailscale ping,讀出是直連還是走哪個中繼(走中繼寫延遲和「多半是中間擋了 UDP 41641」);df 看磁碟;找最新的當掉報告。 - app/doctor_ui.rs:當下就知道的(版本、資料夾、紀錄檔、這台 ↔ 帳號伺服器、帳號伺服器 ↔ 大腦、螢幕連不連得到大腦和原因、上次同步的大小和速度、Bot 的電腦、每個開著的連接器、磁碟少於 2 GB、上次出錯),要上網的在背景跑(Tailscale、每個 Bot 用到的模型服務列模型清單),好了在聊天留一行。 - 在連到大腦的螢幕電腦上:/doctor 在連不到大腦的檢查之前就處理,檢查的是這台本身,結果跳成提示(那個聊天是大腦的)。手機打的是大腦檢查自己。 - / 清單、手機的指令清單多一個 doctor;功能地圖 garden.md、chat.md,FEATURES.md。 已驗證:cargo test 全過、clippy -D warnings 過。新測試:報告的格式和計數;tailscale ping 的直連和中繼兩種輸出(用今天早上這台真的輸出「via DERP(hkg) in 63ms」);最新的當掉報告、磁碟;從聊天打 /doctor 先說「診斷中」、再一份報告(模型服務指向測試用的假模型)。 未驗證:螢幕電腦上真的跑一次(要更新這台 App)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:48:01 +00:00
return;
}
安全、修正: 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
self.goal_heard(bot);
}
A turn cut off by a crash leaves a 「繼續」 card, and nothing it may have done runs twice Each bot keeps a work log (oplog/bot-<id>.jsonl, after pi's durable-harness design, cut down): before something happens a line says it is about to — the turn, each model call, each step once its checks passed (with the arguments it runs with and whether it may run again), each message typed mid-turn — synced to disk first. When the turn ends the file shrinks to the messages still waiting, usually nothing. On the next start after AnyBot was killed mid-turn, the log puts the chat right before anything runs: the message the turn answered comes back if the chat lost it; a step that was running and reaches outside (a text, a click, a file, a published site) shows as 「可能已經執行了」, both to the person and in the result the bot reads — no longer as "not allowed"; a step that only looked shows as cut off; messages typed mid-turn that never reached the bot go back into the chat. The chat is saved, then the log closes the turn. A turn the person didn't stop ends with a 「繼續」 card (what it was doing, what may have run, the messages put back); it goes on only when they press it — in the window, on a screen of the brain, or on the phone — from where its steps stand, never running a step that may have run again. Pressing stop is on disk at once, and a stopped turn stays stopped. Also in the turn loop: - 自動審核 that doesn't answer (or answers something that isn't a verdict) asks the person; in 直接操作 mode it used to let the step through unchecked. - "Too long for this model" folds older messages into a summary and asks the same step again, once per thing the person said, instead of ending the turn. - Folding keeps the person's chat whole: the summary goes in at the fold and the model reads from the newest summary on (it used to delete what it folded). - A step moved to the chosen computer runs there, but the chat keeps the call as the model wrote it; the result says where it ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-08 16:49:12 +00:00
if self.streams.contains_key(&bot) {
功能互相打架的 bug(盤點出來的):你打的話不再混進別人的那一輪;事件觸發的例行任務算一次真的執行;工作流跑的時候來的事件和排程排隊不丟;工作流步驟算沒人在看;工作流不再一步一個「完成」通知;外面來的內容當資料不當指示。 1. 你打的話混進別人的那一輪:Bot 在回 Telegram 客人、做例行任務、做工作流的一步、做另一個 Bot 交代的事時,你打的字以前一律插進那一輪(最後的回答還會傳給客人)。現在那種時候(others_turn)你的話排進 pending_turns,等那一輪做完、用你自己的一輪回;輸入框下面和那個泡泡寫「等它做完手上那件事,再回你」。你自己的那一輪照舊插話。手機、螢幕送來的也一樣。 2. 沒讀到的話被推進同一秒剛開始的另一輪:pending_turns 在 Bot 有一輪在跑時先留著(以前照推進聊天,Bot 的回答會接在你的泡泡後面,例行任務卡在執行中、工作流那步失敗)。 3. 事件觸發的例行任務沒有帶例行任務編號:改用 appctl::wake_message(trigger_message),所以有執行紀錄、完成條件(送 N 則)有效、連續失敗會自動暫停、日程看得到。 4. 工作流跑著時事件和排程被丟掉:改成排隊(workflow.queued,事件每次都排、排程排一次,最多 10 個),這次跑完下一次 tick 接著跑;「執行紀錄」最上面和 Bot 的 show 都說還有幾次;按「停止」連排隊的一起清掉。 5. 工作流問 Bot 的那則改成 wake(沒人在看的一輪):卡在等允許 15 分鐘就結束,不會把 Bot 卡到天亮。 6. 通知重複:工作流的 Bot 步驟那一輪不再發「完成」通知(只有審批和輸出會);審批的通知照總開關,而且只在你不在電腦前時發。 7. 外面來的內容(Slack 訊息、信件、PR 標題、Webhook 內容)交給例行任務和工作流時包成 <untrusted>,寫明只當資料、不照裡面的指示做(以前直接放進受信任的一輪)。 8. 小的:日程上 Webhook/GitHub 觸發的工作流寫它的觸發(以前寫「手動」);圖片、影片、輸出步驟的 Bot 也算進日程的頭像。 功能地圖:chat(插話)、routines(事件觸發)、workflow(排隊、通知、沒人在看)同步。 已驗證: cargo test 868 過(新:what_comes_during_a_run_waits_for_it、the_persons_words_wait_for_their_own_turn、an_event_starts_a_routine_run_with_outside_words;a_run_goes_through_the_new_kinds 改成檢查外面的內容有包起來);clippy 沒有新的。 未驗證: 真的 Telegram/Slack/GitHub 事件(要帳號);手機的推播(盤點說工作流的通知 tag 都是 bot-0 會互相蓋掉,這次沒改:要動 sw.js 和推播的 id)。沒動:打開「直接操作」會改掉另外三頁的設定(在審批路徑上,要你決定)、螢幕電腦改工作流會整張覆蓋大腦那份(要做欄位合併)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 12:51:48 +00:00
if !member && self.others_turn(bot).is_some() {
// (Someone else's turn — a routine's, a workflow step's, an outside
// sender's: the words wait for one of their own.)
self.pending_turns.push((bot, vec![agent::Queued::with_files(text, atts)]));
} else if !member {
Bot 之間溝通:ask_bot 問同事並等回答、群組 @點名、共用頁面/「關於你」記憶/教技能;修正插話丟附件、Enter 核准失效等 問同事(ask_bot) - A 問 B 並等它回答:問題放進 B 自己的聊天,B 用自己的模型、工具、記憶和電腦做,最後的回覆交回 A - 最多轉 3 手、不能互等(避免卡死)、對方忙就排隊(10 分鐘逾時)、停止 A 時 B 也停 - message_bot 也加轉手上限;別的 Bot 叫的不算使用者的話(改不了自己的設定) 群組 @點名 - 「@名字」只叫被點到的成員回答;成員在回覆裡 @ 別人就接著說(一輪最多 8 則) - 電腦和手機的輸入框打 @ 會列出成員 - 修正:每個成員帶自己的記憶;成員回覆的每一步都記得是誰說的 共用資源 - Bot 可以讀其他 Bot 的頁面(只能讀,改要請作者改) - 共用的「關於你」記憶:每個 Bot 都帶著,記憶頁可切換查看、編輯;外人的訊息不帶 - teach_skill:把自己會的技能教給同事(先問你);同事名冊列出每個 Bot 會的技能 修正 - 插話(Bot 工作中傳訊息)會帶附件:聊天有檔案卡片,模型看得到圖片;當機復原也帶著 - 輸入框有焦點、框是空的時 Enter 允許待核准的步驟(原本被當成空白送出吃掉) - 大腦的螢幕連不到大腦時,引用、附件、記憶不會先被用掉 - 「還原上一個答案」存在 Bot 上:重開還在,連大腦的畫面和手機都能還原;停止的回合也留著 - Bot 忙時被叫醒(例行任務、message_bot、觸發器)改成排隊開自己的一輪,不再壓成純文字插話 - 停止時結果已回來的步驟標成完成;輸入法剛選字的那一格不送出 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 13:34:03 +00:00
self.queue_steer(bot, text, atts);
} else if self.waiting_wakes.iter().filter(|(b, _)| *b == bot).count() < MAX_WAITING_FROM_MEMBERS {
// A teammate's words never go into the owner's running turn (they are
// not the owner's): they get a turn of their own once the bot is free.
// (They used to be dropped without a word.)
let mut m = super::person_message(&self.state, bot, &text, atts, Some(vec![]));
m.untrusted_sender = true;
self.waiting_wakes.push((bot, m));
安全、修正: 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
}
return;
}
安全、修正: 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 mut m = super::person_message(&self.state, bot, &text, atts, if member { Some(vec![]) } else { memories });
m.untrusted_sender = member;
Bot 感知得到工作流:你在畫布旁邊打的每一則都帶著「開著工作流「X」(#id)的畫布」,說明裡列出有哪些工作流,並寫明工作流只能用 workflow 做。 查 nobledesktop 上的「水哥哥」(大腦和手腳都已經是 bbf5b4b,能力全開,那一輪的工具清單裡有 workflow): - 11:29(UTC)使用者說「我在工作流的版面了,你幫我寫」時大腦還是舊版(11:54 才更新),它真的沒有工具,就寫成頁面「海巡工作流」+例行任務,並說「我寫不進去那個畫布」。 - 更新後它照自己先前的說法,沒再看工具清單;查 anybot_guide 時讀的是 settings、chat、routines,三區都沒提工作流(log 裡它自己的檢討也這樣寫)。它也不知道使用者開著哪個畫布。 改的: - Message 多一個 seen:你在畫布旁邊打字時,視窗把「工作流「X」(#id,N 個步驟)的畫布,就在你的聊天旁邊——看和改它用 workflow(id N)」記在那則訊息上,模型在〔送出時間〕後面讀到〔使用者送出這則時開著:…〕。螢幕電腦也帶得過去(Job::Send 的 seen → /api/sync/act 的 send → Cmd::Send 的 seen);手機、團隊成員的訊息不帶。 - 說明(system prompt):「工作流只能用 workflow 建立和修改,不要用頁面或例行任務代替;這一輪的工具清單有 workflow 就做得到,之前在這個聊天說過做不到的,以現在為準」,並列出目前的工作流(最多 12 個:#id「名稱」(N 個步驟,排程))。 - 功能地圖:routines、pages 的陷阱各加一條「要的是工作流畫布 → workflow」,workflow 寫上 Bot 知道哪個畫布開著。 已驗證: cargo test 863 過(新:a_message_says_which_canvas_is_open、the_instructions_know_the_workflows);scratch 真資料:建一個工作流、打開畫布、在旁邊的聊天打「畫布上這個你看得到嗎」,假模型收到的那則後面是〔使用者送出這則時開著:工作流「海巡」(#1,1 個步驟)的畫布,就在你的聊天旁邊——看和改它用 workflow(id 1)〕;clippy 沒有新的。layout_audit 在一次全部跑時失敗過一次、再跑兩次都過(不穩,沒找到原因)。 未驗證: 真的 grok-4.7 收到這些後會不會用 workflow——要 nobledesktop 的大腦和你的螢幕都更新到這一版。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 12:13:50 +00:00
if !member {
m.seen = seen;
}
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(m);
}
self.start_reply(ctx, bot);
}
Cmd::Stop { bot } => self.stop(bot),
// The server's own zone (UTC) was never the person's choice: take theirs. A zone the
// person set on purpose stays.
Cmd::PersonTimezone(tz) => {
if crate::routines::is_server_default_zone(&self.state.timezone) && tz != self.state.timezone {
self.state.timezone = tz;
self.mark();
}
}
Cmd::SetBot { bot, provider, model, computer } => {
let kind = serde_json::from_value::<crate::providers::ProviderKind>(json!(provider)).ok();
if let (Some(k), false) = (kind, model.is_empty()) {
if let Some(b) = self.state.bot_mut(bot) {
b.provider = k;
b.model = model;
}
self.mark();
}
if !computer.is_empty() {
let _ = self.update_bot_computer(bot, &json!({"default_computer": computer}).to_string());
self.mark();
}
}
Cmd::Regenerate { bot } => self.regenerate(ctx, bot),
Bot 之間溝通:ask_bot 問同事並等回答、群組 @點名、共用頁面/「關於你」記憶/教技能;修正插話丟附件、Enter 核准失效等 問同事(ask_bot) - A 問 B 並等它回答:問題放進 B 自己的聊天,B 用自己的模型、工具、記憶和電腦做,最後的回覆交回 A - 最多轉 3 手、不能互等(避免卡死)、對方忙就排隊(10 分鐘逾時)、停止 A 時 B 也停 - message_bot 也加轉手上限;別的 Bot 叫的不算使用者的話(改不了自己的設定) 群組 @點名 - 「@名字」只叫被點到的成員回答;成員在回覆裡 @ 別人就接著說(一輪最多 8 則) - 電腦和手機的輸入框打 @ 會列出成員 - 修正:每個成員帶自己的記憶;成員回覆的每一步都記得是誰說的 共用資源 - Bot 可以讀其他 Bot 的頁面(只能讀,改要請作者改) - 共用的「關於你」記憶:每個 Bot 都帶著,記憶頁可切換查看、編輯;外人的訊息不帶 - teach_skill:把自己會的技能教給同事(先問你);同事名冊列出每個 Bot 會的技能 修正 - 插話(Bot 工作中傳訊息)會帶附件:聊天有檔案卡片,模型看得到圖片;當機復原也帶著 - 輸入框有焦點、框是空的時 Enter 允許待核准的步驟(原本被當成空白送出吃掉) - 大腦的螢幕連不到大腦時,引用、附件、記憶不會先被用掉 - 「還原上一個答案」存在 Bot 上:重開還在,連大腦的畫面和手機都能還原;停止的回合也留著 - Bot 忙時被叫醒(例行任務、message_bot、觸發器)改成排隊開自己的一輪,不再壓成純文字插話 - 停止時結果已回來的步驟標成完成;輸入法剛選字的那一格不送出 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 13:34:03 +00:00
Cmd::RestoreAnswer { bot } => self.restore_regenerated(bot),
Cmd::Reply { bot } => {
if !self.streams.contains_key(&bot) && self.state.bot(bot).and_then(|b| b.messages.last()).map(|m| m.role == Role::User).unwrap_or(false) {
self.start_reply(ctx, bot);
}
}
A turn cut off by a crash leaves a 「繼續」 card, and nothing it may have done runs twice Each bot keeps a work log (oplog/bot-<id>.jsonl, after pi's durable-harness design, cut down): before something happens a line says it is about to — the turn, each model call, each step once its checks passed (with the arguments it runs with and whether it may run again), each message typed mid-turn — synced to disk first. When the turn ends the file shrinks to the messages still waiting, usually nothing. On the next start after AnyBot was killed mid-turn, the log puts the chat right before anything runs: the message the turn answered comes back if the chat lost it; a step that was running and reaches outside (a text, a click, a file, a published site) shows as 「可能已經執行了」, both to the person and in the result the bot reads — no longer as "not allowed"; a step that only looked shows as cut off; messages typed mid-turn that never reached the bot go back into the chat. The chat is saved, then the log closes the turn. A turn the person didn't stop ends with a 「繼續」 card (what it was doing, what may have run, the messages put back); it goes on only when they press it — in the window, on a screen of the brain, or on the phone — from where its steps stand, never running a step that may have run again. Pressing stop is on disk at once, and a stopped turn stays stopped. Also in the turn loop: - 自動審核 that doesn't answer (or answers something that isn't a verdict) asks the person; in 直接操作 mode it used to let the step through unchecked. - "Too long for this model" folds older messages into a summary and asks the same step again, once per thing the person said, instead of ending the turn. - Folding keeps the person's chat whole: the summary goes in at the fold and the model reads from the newest summary on (it used to delete what it folded). - A step moved to the chosen computer runs there, but the chat keeps the call as the model wrote it; the result says where it ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-08 16:49:12 +00:00
Cmd::Resume { bot } => self.resume_turn(ctx, bot),
Cmd::RestoreThread { bot, index } => {
self.stop(bot);
if let Some(b) = self.state.bot_mut(bot) {
if index < b.threads.len() {
let (_, msgs) = b.threads.remove(index);
if !b.messages.is_empty() {
let title = b.messages.iter().find(|m| m.role == Role::User).map(|m| first_line(&m.text, 24)).unwrap_or_else(|| "對話".into());
let cur = std::mem::take(&mut b.messages);
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
b.threads.insert(0, (title, cur.into_inner()));
}
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
b.messages = msgs.into();
}
}
self.mark();
}
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
Cmd::Answer { bot, answer, text, call, notice, screen } => {
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
// Only the card it was given for: every answer from afar (the phone's card, a
// notification, a screen) names its card by the key on_new_approval gave it. A
// card answered, gone or replaced since — or a page too old to name one — takes
// nothing (it used to answer whatever waited by then: an 允許 for one step went
// to the next, and 一律允許 remembered the next one's kind).
let waiting = self.approvals.get(&bot);
let this_card = waiting.is_some() && !call.is_empty() && self.ask_keys.get(&bot) == Some(&call);
// A notification's 允許/拒絕 only on a card notice_answers gave the buttons to:
// never 「我完成了」 on a hand-off or 「略過」 on a question, whatever the key.
let fits = !notice || (waiting.is_some_and(super::notice_answers) && matches!(answer.as_str(), "once" | "reject"));
if !(this_card && fits) {
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
// Said only while something waits: with nothing waiting the answer was for a
// card already settled. Nor for a card 直接操作 let through as it came on (the
// phone's 「全部允許」 sends its answer for that card after) — already done.
if waiting.is_some() && !(!call.is_empty() && self.settled_by_direct.contains(&call)) {
// What to do about it depends on where it came from: a phone page too old
// to name its card is refreshed; a screen computer that old is updated.
let note = match (notice, screen, call.is_empty()) {
(true, ..) => "通知上的「允許/拒絕」沒有用上:那個請求已經不在等了(回答過,或換成了別的)。打開聊天看現在在等什麼。",
(_, true, true) => "螢幕電腦上的回答沒有用上:那台電腦的 AnyBot 比這台舊,說不出是哪一張卡。在那台打開 設定 › 更新 換新版,或在這台回答。",
(_, true, false) => "螢幕電腦上的回答沒有用上:那張卡已經不在等了(回答過,或換成了別的)。看現在在等什麼再回答。",
fix: 等你允許的卡片第三輪——螢幕電腦不推答不到的通知、舊頁面的提示說重新整理不行怎麼辦、問題卡表單照卡認 獨立審查(30c3895+838bb95,沒有 P0/P1)提的 P2: - 螢幕電腦(mir.on)不再把等你的卡推到手機。它推的通知被帳號伺服器蓋上螢幕電腦的 host,手機按了 就切到螢幕電腦、把回答送過去,可是螢幕電腦不替手機做事(丟掉手機指令)、也不給手機畫面:「允許」 不見了,手機還停在螢幕電腦上(本來就有的問題)。同一張卡由大腦推(「通知」是大腦的設定,螢幕電腦 跟著它;大腦不在前面或閒置 90 秒時推,在伺服器上一定推)。螢幕電腦照樣響、照樣跳 macOS 通知。 - 手機舊頁面的提示:「重新整理再回答;還是不行(帳號伺服器還沒更新),就在電腦上回答。」——帳號 伺服器沒更新時,重新整理拿到的還是舊頁面。 - 大腦視窗和螢幕電腦的問題卡:表單(步驟、勾選、打的字)、打字欄、游標、捲到卡的紀錄都照卡的 key 認,不再照 call id:同一個 call_0、題數一樣的下一張問題卡不會接手上一張的答案,「送出」不會送出 沒人選過的東西。新增測試 a_question_in_anothers_place_starts_with_nothing_picked。 - 功能地圖 phone、FEATURES.md 跟著改;verify-approval-routing 的「沒有放進模型」改成真的(螢幕電腦 不推、以前為什麼答不到、什麼時候大腦也不推),對照表加上 question_card,對過模型後 rehash(這個 commit 就是新的同步 commit)。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)648 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 個重走測試通過;改回舊的都被抓到(問題卡表單照 call id 認 → 新卡接手了步驟 1 和「否」;手機提示少了「在電腦上回答」);verify-anybot:允許、拒絕、問題卡、舊 key/沒有 key/舊通知都不算且提示對(含新的那一句)、支線的卡和它的提示在主線(證據 target/verify-anybot/20261118-112729) 未驗證: 螢幕電腦不推通知只照程式讀過(推播只在非示範模式、要連帳號伺服器,沒有測試)、真的螢幕電腦和手機推播都沒實機;大腦那台正在用時大腦和螢幕電腦都不推(這是取捨,不是新的路);帳號伺服器的頁面(relay/ 要重新部署);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:29:14 +00:00
// (Refreshing gets the page again from where it came: an account
// server not yet updated serves the old one again.)
(_, false, true) => "手機上的回答沒有用上:這個頁面太舊,說不出是哪一張卡。重新整理再回答;還是不行(帳號伺服器還沒更新),就在電腦上回答。",
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
(_, false, false) => "手機上的回答沒有用上:那張卡已經不在等了(回答過,或換成了別的)。看現在在等什麼再回答。",
};
// In the chat the person reads: a 支線's card is shown, and answered, in
// its main bot's chat — the 支線's own messages aren't shown anywhere.
let home = self.state.home_of(bot);
self.goal_note(home, note);
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
}
return;
}
let grant = self.approvals.get(&bot).map(|a| a.grant.clone()).unwrap_or_default();
問題卡、搜尋: 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
let question = self.approvals.get(&bot).is_some_and(|a| a.kind == ApprovalKind::Question);
let a = match answer.as_str() {
問題卡、搜尋: 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
// (Only a question takes an answer in words, and nothing else answers one.)
"answered" if question => ApprovalAnswer::Answered(text),
_ if question => ApprovalAnswer::Reject,
"once" => ApprovalAnswer::Once,
智慧模式設計審計修正:手機也有「這輪都准」、按鈕詞彙統一、無障礙與智慧晶片 照 frontend-design skill 審計(使用者流程與順眼程度): - 手機審批卡:智慧模式開著時「這輪都准」是主按鈕(scope 由大腦從卡片自己的 grant 取,手機的字不會決定範圍;通知不帶 scope);無卡片主按鈕改「允許一次」 (桌面同步改名,全產品動詞一致)。一律允許退為一般按鈕:最有力的許可 不再站最前排。 - 手機聊天輸入列:智慧模式開著時有 ✨ 晶片,點了關掉(手機只能收緊); 關後 state/settings 同步重抓。桌面 ✨ 第一次開著時旁邊標「智慧」兩字, 關過一次就不再有字。 - 無障礙:全站 :focus-visible 焦點框;圖示按鈕(返回、送出、選單…)加 aria-label;審批按鈕組加 role=group。「全部允許,之後直接操作」連結 由 accent 色改灰:最有力的許可給最靜的處理。 - 測試:手機 scope 回答新測試(卡片自己的 grant、通知不帶);真機 e2e: 無頭 iPhone 開聊天見晶片→點→toast、晶片消失、/api/settings 同步 false; 連接器工具卡四顆按鈕「這輪都准/允許一次/一律允許/拒絕」,按「這輪都准」 後工具執行、allow_rules 沒有新增(不落永久規則)。 - 地圖:autonomy/safety/phone/connectors/apps 同步(autonomy 壓回 8999/9000); TLA coverage.tsv 已 rehash(approval_body、cmd_answer、approval_json、 phone_cards、render_dock)。 已驗證: cargo test 721 全綠(含 featuremap::、layout_audit::、phone_scope)、 verify-approval-routing run.sh 全綠、真機 e2e(晶片開關三端同步、scope 卡執行 且無永久規則)、node --check 手機 JS。 未驗證: 桌面視窗的 ✨「智慧」標註與卡片主按鈕外觀(要開視窗,需使用者同意 desktop-shot+人類簽名)。
2026-11-19 07:24:37 +00:00
// 智慧模式's 「這輪都准」: the card's own grant, this turn only. The phone
// names the card by its key, and the grant comes from the card here — the
// phone's words never choose what a scope covers.
"scope" => ApprovalAnswer::Scope(grant),
"always" => ApprovalAnswer::Always(grant),
_ => ApprovalAnswer::Reject,
};
self.answer(ctx, bot, a);
}
Cmd::Read { bot } => {
if let Some(b) = self.state.bot_mut(bot) {
if b.unread {
b.unread = false;
self.mark();
}
}
}
feat: 交付確認——Bot 傳的檔案記下在哪台裝置顯示、點開沒,沒顯示出來叫醒 Bot 一次 起因:Bot 產了一張圖、send_file 回報成功、Bot 一直說「已完成」,但圖一直沒出現在使用者 的聊天裡,系統完全不知道。「完成」改成:你看得到、能用,而且系統知道你收到了。 - 附件有身分:attach::store/store_bytes 給每個附件一個編號(舊資料讀得進來,沒有回報的 附件寫出來跟以前一字不差);螢幕電腦把路徑換成本機副本時編號不變,回報一律用編號。 - 三層狀態記在大腦那則附件上:已在聊天 → 已在某台裝置顯示 → 點開了,或「顯示失敗」加 原因;每筆記哪台裝置和時間,同一台同一種只記第一次,最多 12 筆。記號和「已顯示/已 點開」只看擁有者自己的裝置;團隊成員、管理員的裝置只記下(最多 4 筆)、不叫醒。 - 誰回報: - 手機:POST api/bots/<id>/seen(團隊成員也可以)。圖片真的載入、在畫面裡、頁面在前面 才算顯示;預覽真的畫出來(文字、表格、圖、PDF 的頁、能播的錄音影片)或存到手機才算 點開;大腦回 404/422/500 或圖片再抓一次還是解不開算失敗;斷線、408、429、502–504 算網路問題、不算。不排隊,每次開頁面每個附件每種只報一次。 - 大腦自己的視窗(「這台電腦」):卡片在畫面裡停留 0.8 秒、視窗在前面才算顯示(聊天剛 打開時從頂端畫的那一格、「回到最新訊息」捲過去的不算);點開算點開;檔案不見了算失敗。 - 螢幕電腦:api/sync/act 的 seen(大腦用它的名字記,另開執行緒送、不擋其他訊息);抓大腦 檔案被回 404 算失敗(以前完全不報),網路斷了不算。 - 裝置名稱、原因都由大腦從固定的字選,頁面送來的字不會原樣進到 Bot 那裡。 - 同步:remote_signature、msg_sig、聊天存檔的 chat_mark 都算進回報;message_json 對 Bot 傳 的附件輸出 id、delivery、seen。 - 畫面:Bot 傳來的附件下面一個灰色小記號——✓ 已在聊天、✓✓ 已在某台裝置顯示、點開過的 ✓✓ 是強調色;手機點記號跳出清單、電腦版滑過看清單(每台裝置、時間、顯示/點開/失敗和 原因)。使用者自己附的檔案沒有記號。失敗不另外跳字;手機上解不開的圖也顯示原本的 「這張圖讀不到」(以前是一塊空白)。 - Bot 知道:send_file 的結果改成「已放進聊天(…附件 <編號>)…不要說使用者已經看到」;之後 的回合結果後面帶一行〔交付狀態:…〕(日期寫死,不會每天變);系統提示加一句以那個狀態 為準、使用者問收到沒照它回答。 - 叫醒:擁有者的裝置回報顯示失敗、而且還沒有擁有者的裝置顯示過,叫醒那個 Bot 一次(新的 「[交付]」標籤,視窗和手機的 WAKE_TAGS 一起改),只寫附件編號和副檔名、哪台、為什麼 (不寫檔名:檔名可能來自外面,這則訊息帶著擁有者的信任開一輪),請它換方式交付。只在 「傳出這個檔案的那一輪是擁有者開的」時叫醒:訊息管道的人、團隊成員、別的 Bot 要的檔案、 群組聊天、給使用者看畫面的截圖、支線帶回的檔案都只記下。擁有者上次說話之後最多兩次; Bot 在忙、叫醒在排隊時別台顯示了就取消。 - docs/feature-map/deliver.md 新增子功能 deliver-confirm、使用者怎麼到、三條 verify-anybot 步驟、陷阱;FEATURES.md 同步。verify-anybot 的假模型照規則回答時多記 tool_results(這個 請求裡每個工具結果的結尾),用來證明 Bot 讀到〔交付狀態〕。 合進主線(接在手機、螢幕電腦「沒網路照樣能用」之後) - 手機頁面:apiOnce 用主線那行(已經帶 e.status、e.unsure);離開聊天先存一份、回到聊天看 畫面裡的附件,兩個都留。螢幕電腦:兩邊新增的測試都留,離線那輪的測試附件補上新欄位。 - 合併後跑 deliver.md 時發現(以前就有、離線那輪重畫變多後才明顯):手機聊天每次重畫, 圖片都先退回檔名再載入、長高,「停在最新訊息」只在重畫那一刻判斷,幾張圖之後最新那則 被推到畫面外、也就永遠不算「顯示」。改成:已經讀到的圖重畫時直接沿用;停在底部時, 內容在畫完之後變高(圖片載入)也跟著停在底部,往上捲在讀的不動;比螢幕高的問題卡留在 它的問題那裡,不被拉到底。FEATURES.md 同步。 已驗證: cargo test 全綠(主程式 767,含 featuremap::、layout_audit::、tool_specs_are_locked、 approval_decisions_are_characterized;新增 attach、deliver_ui 6 條、remote、mirror_ui、 remote_ui、app 的 group_history 與系統提示、layout_audit 的記號滑過清單);verify-anybot deliver.md 全部步驟照貼從頭跑過(傳檔預覽、機密不傳、伺服器上打不開、沒登入沒有發佈、 交付確認顯示/點開/Bot 讀到狀態、顯示失敗叫醒一次且重開後仍是一次),另手動驗過刪掉大腦 副本後手機記「大腦上找不到這個檔案」、已點開的不叫醒;十輪乾淨脈絡獨立審查,最後一輪無 P0/P1。 合進主線後:cargo test 774 通過;verify-approval-routing --replay 跟合併前一樣(AllSurfaces 通過、 replay 10 個都過,「改過了」的 5 段在 HEAD 就是如此);verify-anybot 在新的 scratch 上把 deliver.md、phone.md、cards.md 全部步驟各從頭跑過都通過(含「沒網路也打得開」「斷線又回來」、 問題卡一題一題走);另外實跑:往上捲在讀時,新傳來的圖不會把畫面拉回底部。合併的部分另做 一輪乾淨脈絡獨立審查:沒有 P0/P1,兩條 P2(高的問題卡被拉到底、重畫先用原檔)已修,一條 P2(超過 40 張圖時錯誤處理掛得晚,不會誤報)留著。 未驗證: 真的 iPhone/Android(Safari 的 IntersectionObserver、主畫面 App)——要實機;螢幕電腦 連大腦的真實路徑——要另一台登入同帳號的 AnyBot;桌面視窗的記號與 0.8 秒停留——要開視窗 (ABV_ALLOW_WINDOW,要使用者同意),只有行程內繪圖測試;團隊成員、管理員經帳號伺服器 回報——要帳號伺服器與第二個帳號。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5JgTkqJjkgMtrEXrn
2026-11-20 05:38:58 +00:00
Cmd::Seen { bot, att, device, kind, why, trusted } => self.delivery_seen(ctx, bot, &att, &device, kind, &why, trusted),
Cmd::Clear { bot } => {
self.goal_drop(bot);
self.stop(bot);
if let Some(b) = self.state.bot_mut(bot) {
b.messages.clear();
}
self.mark();
}
安全、修正: 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
Cmd::RunRoutine { bot, routine } => {
let now = crate::routines::now();
let mut wake = None;
if let Some(b) = self.state.bot_mut(bot) {
if let Some(r) = b.routines.iter_mut().find(|r| r.id == routine) {
r.last_run = Some(now);
日程不再「才按完就有」:日程只放排程和事件自己跑的;按了沒步驟的工作流不再假裝「完成」;工作流問 Bot 的話不再像你自己打的;日程和工作流頁面簡化。 你說的幻覺,查到四個來源: 1. 只有觸發器的工作流(像剛新建的「未命名工作流」),一按「執行工作流」就馬上記一次「✓ 完成」——什麼都沒做,日程、執行紀錄、Bot 看到的「最近一次:完成」全是假的。現在不跑,說「這個工作流還沒有步驟,沒有執行:先在觸發器下面加一步…」(排程和事件到了也不跑);以前留下的空執行、試跑一步都不算「最近一次」。 2. 你手動按的(執行工作流、立即執行、請 Bot 跑的、試跑一步)一按就出現在日程上,看起來像排好的事。現在日程只放「定時」「觸發」自己跑的;手動的在執行紀錄。例行任務的執行多記一個 by_hand。 3. 例行任務「立即執行」跟 Bot 說「時間到了」——不是時間到,是你叫的。現在是「「名稱」現在就執行(使用者叫的,不是排定的時間):…」(電腦、手機、Bot 的 run_routine_now 都是)。 4. 工作流問 Bot 的話在聊天裡是你的泡泡、靠右,看起來像你自己打的,還整段附上上一步的結果。現在上面一行小標「工作流「名稱」第 k/n 步」、淡色泡泡,結果只顯示前三行(滑過看全文;檢查的「結果:」也是)。手機一樣。其他不是你打的(例行任務、觸發、別的 Bot)也改成淡色泡泡。 簡化: - 日程「即將執行」每個例行任務、工作流只一行(以前一個每天跑的占滿六行)。 - 日程右上的「時間以 Asia/Taipei 為準」只在時區跟這台電腦不同時才寫。 - 工作流右上拿掉「等你確認」「執行中…」(上面那條有「繼續/停止」,■ 停止 已經說了在跑)。 已驗證: cargo test 876 過(新:a_workflow_with_no_steps_does_not_run、what_was_run_by_hand_is_not_on_the_calendar、a_workflows_question_is_tagged_and_short);有兩次整套跑時各有一個不相干的測試失敗(remote 的 state_for、手機頁面綁連接埠),單獨跑和第三次整套都過,是本來就會偶爾失敗的;clippy 8 個沒變。scratch:workflow.md 聊天裡建立、修改、執行三步過,桌面截圖畫布+旁邊聊天(小標、淡色泡泡);schedule.md 四步過(今天沒有立即執行的那次、即將執行每個一行、日看法「這一天沒有排定的事」、卡片和暫停、state paused);routines.md 手機四步在新的 scratch 照貼全過(立即執行、兩次失敗暫停、送到了——假模型照「現在就執行」比對得到),state 裡立即執行的 by_hand 都是 true。 未驗證: 手機頁面上的工作流小標(手機沒有開工作流的步驟;改了 wakeTag,有測試檢查兩邊一致);你那台的真資料(要更新 App 和 nobledesktop 的大腦才看得到)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 14:03:18 +00:00
wake = Some(appctl::run_now_message(r));
安全、修正: 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(m) = wake {
self.wake(ctx, bot, m);
self.mark();
}
}
螢幕電腦上的工作流什麼都能做(以前新增、改名、刪除、畫筆、便利貼、形狀、文字、+ 新增節點都藏起來,只寫「這台是螢幕」);側邊欄窄的時候不再破版。 - 螢幕上的畫布跟大腦一樣能編輯:改的內容照其他設定一樣傳到大腦;執行、停止、等你確認的繼續/停止,送 /api/sync/act 的 workflow 動作請大腦做(remote.rs 的 Cmd::Workflow → wf_do)。日程卡片的「立即執行」也是。 - 大腦收到螢幕改的 workflows 時,runs 和 next_run 用自己的:螢幕上慢一步的那份不會把正在跑的那次蓋掉(mirror_ui 的 brain_set_top)。 - 螢幕收到大腦的工作流時,比對前後(workflow::changes):Bot 在大腦上改的那幾步和便利貼在螢幕上也亮,若是旁邊這個 Bot 剛用了 workflow 工具,畫布開在它的聊天旁邊(wf_remote_changes)。 - 側邊欄:最上面那排放不下六個按鈕(6 × 36 + 5 × 8 點)時,日程、工作流、所有檔案收進「⋯」;左下那排算進按鈕之間的間距,市集的按鈕不再被切掉(這個是 4bdc126 就有的)。 - 截圖多了 ANYBOT_SHOT_SCREEN=1(當成雲端大腦的螢幕)。 已驗證: cargo test 861 過(新:a_screen_edits_workflows_and_sees_a_bots_changes——螢幕改名傳到大腦、大腦的那次執行留著;Bot 在大腦加一步,螢幕上畫布打開、那一步亮);clippy 沒有新的。截圖(螢幕模式、側邊欄 240):最上面「⋯ 任務 搜尋 +」、左下兩個按鈕都在邊內,畫布有畫筆/便利貼/形狀/文字/+ 新增節點、停止、繼續,名稱選單有新建、版本歷史、重新命名、建立副本、刪除,「⋯」裡是日程、工作流、所有檔案。 未驗證: 真的兩台(螢幕+雲端大腦)一起跑:要大腦也更新成這一版,舊的大腦不認得 workflow 這個動作(回「沒有這個動作」)。macOS 視窗左上角的紅黃綠按鈕跟側邊欄最上面那排疊到的問題,截圖模式畫不出來,等排版重做。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 11:30:28 +00:00
// 工作流 from a screen: the brain runs them.
Cmd::Workflow { wf, act } => {
self.wf_do(ctx, wf, &act);
self.mark();
}
Cmd::NewThread { bot } => {
self.goal_drop(bot);
self.stop(bot);
if let Some(b) = self.state.bot_mut(bot) {
if !b.messages.is_empty() {
let title = b.messages.iter().find(|m| m.role == Role::User).map(|m| first_line(&m.text, 24)).unwrap_or_else(|| "對話".into());
let msgs = std::mem::take(&mut b.messages);
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
b.threads.insert(0, (title, msgs.into_inner()));
b.threads.truncate(50);
}
}
self.mark();
}
Cmd::DeviceAdded(d) => {
self.state.remote.devices.push(d);
self.mark();
}
Cmd::DeviceSeen(h) => {
if let Some(gone) = h.strip_prefix('-') {
self.state.remote.devices.retain(|d| d.token_hash != gone);
self.mark();
} else if !self.rm.last_seen_mark.map(|t| t.elapsed().as_secs() < 60).unwrap_or(false) {
self.rm.last_seen_mark = Some(Instant::now());
if let Some(d) = self.state.remote.devices.iter_mut().find(|d| d.token_hash == h) {
d.last_seen = chrono::Utc::now().timestamp();
self.mark();
}
}
}
}
}
/// 登入後同步: the account's bots and this computer's become one set.
/// • Another AnyBot of the account is the brain → show it, and copy this computer's bots
/// there (once it answers; bots it already has are skipped).
/// • This one is the only one → take in the backup's bots it doesn't have, then back up
/// the whole set, so the account has this computer's bots too.
fn account_sync(&mut self, found: remote::AccountFind) {
if let Some((id, name)) = found.brain {
*self.rm.note.lock().unwrap() = format!("已登入,改用「{name}」當大腦:那邊的 Bot 會同步過來,這台的也會搬過去");
self.mir.want = Some((id, name));
self.mir.move_after_join = true;
// The brain's bots may use this computer (each action still asks).
self.state.remote.device_link = true;
return;
}
let got = found.backup.and_then(|b| serde_json::from_slice::<State>(&b).ok());
let n = got.map(|st| self.state.take_in_bots(&st)).unwrap_or(0);
*self.rm.note.lock().unwrap() = if n > 0 { format!("已登入,帳號裡的 {n} 個 Bot 已同步到這台") } else { "已登入,這台 AnyBot 已加入帳號".into() };
if !self.state.bots.is_empty() && self.state.remote.auto_backup {
self.remote_backup();
}
}
fn remote_backup(&mut self) {
if self.rm.busy.swap(true, Ordering::SeqCst) {
return;
}
self.state.remote.last_backup = chrono::Utc::now().timestamp();
self.mark();
let s = self.state.remote.clone();
let mut st = self.state.clone();
// The backup is for the bots; this computer's own keys to the relay and phones stay here.
st.remote = Default::default();
let bytes = serde_json::to_vec(&st).unwrap_or_default();
let (note, busy) = (self.rm.note.clone(), self.rm.busy.clone());
std::thread::spawn(move || {
*note.lock().unwrap() = match remote::backup_now(&s, &bytes) {
Ok(n) => format!("已備份({},已加密)", crate::cloudbox::human(n as u64)),
Err(e) => e,
};
busy.store(false, Ordering::SeqCst);
});
}
帳號頁連不上時「登出」被擠出視窗:「AnyBot 帳號」的連線狀態原本跟帳號、網址擠在同一行而且不換行,連不上時那段錯誤(「連不上帳號伺服器:找不到伺服器:…」)把整張卡片撐得比視窗還寬,右邊的「登出」跑到畫面外看不到(上一版只在狀態是空的時候看過,沒抓到)。現在狀態在帳號下面自己一行、太長就換行,帳號和網址太長就「…」;大腦卡片的「連不到大腦:…」也改成在卡片裡換行。版面檢查加一個畫面「設定 › 手機與帳號(已登入、連不上)」(長錯誤、螢幕電腦連不到大腦),舊的排法在這個畫面會被報成 51 個問題。 已驗證: cargo test 全綠(816 passed,含 layout_audit:: 新畫面、featuremap::、remote_ui::);把狀態放回同一行時 layout_audit 報「連不上帳號伺服器…被切掉 338px」「視窗被內容撐寬 356px」等 51 個問題(證明檢查抓得到);桌面截圖用跟使用者截圖一樣的狀態(連不上帳號伺服器、連不到大腦、wang、同一個帳號伺服器網址與主機名稱)在 1000/664 寬:「登出」在卡片裡看得到。 未驗證: 使用者自己那台 AnyBot 上的畫面(不能開使用者真的 AnyBot,要重開 App 換上新版才看得到);真的帳號伺服器連不上時的長連線狀態(截圖用暫時的覆寫給同一段字,已拿掉)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:10:51 +00:00
/// The account connection's state as the page shows it.
fn relay_status_now(&self) -> String {
#[cfg(test)]
if let Some(s) = &self.rm.relay_status_shown {
return s.clone();
}
remote::hub().relay_status()
}
pub(super) fn remote_page(&mut self, ui: &mut egui::Ui, _ctx: &egui::Context) {
let p = self.pal;
let mut changed = false;
setting_card(ui, p, |ui| {
setting_title(ui, "手機與帳號", "在手機上和 Bot 聊天、核准它要做的事、看著它的電腦。", p);
hint(ui, "兩種連法:同一個網路(或 Tailscale)直接連這台電腦;或登入帳號,透過你的帳號伺服器從任何地方連,這台電腦不用開放任何連接埠。", p);
});
// ── 帳號(薄後端) ──
setting_card(ui, p, |ui| {
setting_title(ui, "AnyBot 帳號", "帳號伺服器保管帳號、裝置清單和加密備份,手機從外面連進來也靠它轉送。", p);
帳號頁連不上時「登出」被擠出視窗:「AnyBot 帳號」的連線狀態原本跟帳號、網址擠在同一行而且不換行,連不上時那段錯誤(「連不上帳號伺服器:找不到伺服器:…」)把整張卡片撐得比視窗還寬,右邊的「登出」跑到畫面外看不到(上一版只在狀態是空的時候看過,沒抓到)。現在狀態在帳號下面自己一行、太長就換行,帳號和網址太長就「…」;大腦卡片的「連不到大腦:…」也改成在卡片裡換行。版面檢查加一個畫面「設定 › 手機與帳號(已登入、連不上)」(長錯誤、螢幕電腦連不到大腦),舊的排法在這個畫面會被報成 51 個問題。 已驗證: cargo test 全綠(816 passed,含 layout_audit:: 新畫面、featuremap::、remote_ui::);把狀態放回同一行時 layout_audit 報「連不上帳號伺服器…被切掉 338px」「視窗被內容撐寬 356px」等 51 個問題(證明檢查抓得到);桌面截圖用跟使用者截圖一樣的狀態(連不上帳號伺服器、連不到大腦、wang、同一個帳號伺服器網址與主機名稱)在 1000/664 寬:「登出」在卡片裡看得到。 未驗證: 使用者自己那台 AnyBot 上的畫面(不能開使用者真的 AnyBot,要重開 App 換上新版才看得到);真的帳號伺服器連不上時的長連線狀態(截圖用暫時的覆寫給同一段字,已拿掉)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:10:51 +00:00
let status = self.relay_status_now();
let s = &self.state.remote;
if !s.host_token.is_empty() {
ui.horizontal(|ui| {
let ok = status == "已連線";
let (r, _) = ui.allocate_exact_size(vec2(10.0, 10.0), egui::Sense::hover());
2026-11-16 14:07:07 +00:00
ui.painter().circle_filled(r.center(), 4.0, if ok { p.up } else { p.text3 });
帳號頁連不上時「登出」被擠出視窗:「AnyBot 帳號」的連線狀態原本跟帳號、網址擠在同一行而且不換行,連不上時那段錯誤(「連不上帳號伺服器:找不到伺服器:…」)把整張卡片撐得比視窗還寬,右邊的「登出」跑到畫面外看不到(上一版只在狀態是空的時候看過,沒抓到)。現在狀態在帳號下面自己一行、太長就換行,帳號和網址太長就「…」;大腦卡片的「連不到大腦:…」也改成在卡片裡換行。版面檢查加一個畫面「設定 › 手機與帳號(已登入、連不上)」(長錯誤、螢幕電腦連不到大腦),舊的排法在這個畫面會被報成 51 個問題。 已驗證: cargo test 全綠(816 passed,含 layout_audit:: 新畫面、featuremap::、remote_ui::);把狀態放回同一行時 layout_audit 報「連不上帳號伺服器…被切掉 338px」「視窗被內容撐寬 356px」等 51 個問題(證明檢查抓得到);桌面截圖用跟使用者截圖一樣的狀態(連不上帳號伺服器、連不到大腦、wang、同一個帳號伺服器網址與主機名稱)在 1000/664 寬:「登出」在卡片裡看得到。 未驗證: 使用者自己那台 AnyBot 上的畫面(不能開使用者真的 AnyBot,要重開 App 換上新版才看得到);真的帳號伺服器連不上時的長連線狀態(截圖用暫時的覆寫給同一段字,已拿掉)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:10:51 +00:00
ui.add(egui::Label::new(RichText::new(format!("{} · {}", s.relay_user, s.relay_url)).size(FONT_BASE)).truncate());
});
帳號頁連不上時「登出」被擠出視窗:「AnyBot 帳號」的連線狀態原本跟帳號、網址擠在同一行而且不換行,連不上時那段錯誤(「連不上帳號伺服器:找不到伺服器:…」)把整張卡片撐得比視窗還寬,右邊的「登出」跑到畫面外看不到(上一版只在狀態是空的時候看過,沒抓到)。現在狀態在帳號下面自己一行、太長就換行,帳號和網址太長就「…」;大腦卡片的「連不到大腦:…」也改成在卡片裡換行。版面檢查加一個畫面「設定 › 手機與帳號(已登入、連不上)」(長錯誤、螢幕電腦連不到大腦),舊的排法在這個畫面會被報成 51 個問題。 已驗證: cargo test 全綠(816 passed,含 layout_audit:: 新畫面、featuremap::、remote_ui::);把狀態放回同一行時 layout_audit 報「連不上帳號伺服器…被切掉 338px」「視窗被內容撐寬 356px」等 51 個問題(證明檢查抓得到);桌面截圖用跟使用者截圖一樣的狀態(連不上帳號伺服器、連不到大腦、wang、同一個帳號伺服器網址與主機名稱)在 1000/664 寬:「登出」在卡片裡看得到。 未驗證: 使用者自己那台 AnyBot 上的畫面(不能開使用者真的 AnyBot,要重開 App 換上新版才看得到);真的帳號伺服器連不上時的長連線狀態(截圖用暫時的覆寫給同一段字,已拿掉)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:10:51 +00:00
// The connection's state on a line of its own, wrapped: beside the account on one
// line, an error (「連不上帳號伺服器:找不到伺服器:…」) pushed the card wider than
// the window, and 登出 off its right edge.
if !status.is_empty() {
帳號伺服器換了網址不用再登出重登:tailnet 從 Tailscale 換到自架 headscale 後,舊的 *.ts.net 網址一次全死(nobledesktop 的帳號伺服器改成 http://100.64.0.5),電腦版只能「登出再登入」——帳號裡多一台新的、舊的那台留著,大腦要重選(MacBook Pro 就這樣變成「(2)」,Mac mini 還卡在死網址)。現在 設定 › 手機與帳號 的帳號卡片多一列「帳號伺服器換了網址」:按「換網址」填新網址(連不上時自己展開),先確認那是 AnyBot 帳號伺服器、再用這台自己的金鑰問它認不認得這台(帳號裡的電腦有這台)才換;只換網址,不送密碼、不註冊,登記、大腦、副本、排著的訊息全部照舊;另一台伺服器、這台已被移除就不換,說要登出再登入。沒有視窗的電腦(手腳、伺服器)用 anybot setup --move-to 網址。功能地圖 account.md 加 account-move、FEATURES.md 同步。 已驗證: cargo test 全綠(817,含 featuremap::、layout_audit:: 的「已登入、連不上」畫面);新測試 a_moved_account_server_is_followed_only_when_it_knows_this_computer(同一台換成功且金鑰/大腦不變、另一台、不在帳號、不是帳號伺服器、同網址、沒登入都拒絕);verify-anybot 實跑:scratch relay A 配對加入 → A 關掉、同資料在 B 開 → --move-to 空的 C 被拒、--move-to 假模型埠被拒、--move-to B 成功,重開後 serve.log「透過帳號 verify 連線(…28782)」、/relay/me 同一台在線、沒有多一台;桌面截圖 desktop/account-unreachable.png 卡片自動展開新網址欄位。 未驗證: 桌面上真的點「換過去」那一下(沒有點畫面的工具;同一個 relay_move 由 CLI 和單元測試走過);手機頁面沒有這個功能(手機直接用新網址重新登入)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 00:50:16 +00:00
ui.add(egui::Label::new(RichText::new(status.as_str()).size(FONT_XS).color(p.text3)).wrap());
帳號頁連不上時「登出」被擠出視窗:「AnyBot 帳號」的連線狀態原本跟帳號、網址擠在同一行而且不換行,連不上時那段錯誤(「連不上帳號伺服器:找不到伺服器:…」)把整張卡片撐得比視窗還寬,右邊的「登出」跑到畫面外看不到(上一版只在狀態是空的時候看過,沒抓到)。現在狀態在帳號下面自己一行、太長就換行,帳號和網址太長就「…」;大腦卡片的「連不到大腦:…」也改成在卡片裡換行。版面檢查加一個畫面「設定 › 手機與帳號(已登入、連不上)」(長錯誤、螢幕電腦連不到大腦),舊的排法在這個畫面會被報成 51 個問題。 已驗證: cargo test 全綠(816 passed,含 layout_audit:: 新畫面、featuremap::、remote_ui::);把狀態放回同一行時 layout_audit 報「連不上帳號伺服器…被切掉 338px」「視窗被內容撐寬 356px」等 51 個問題(證明檢查抓得到);桌面截圖用跟使用者截圖一樣的狀態(連不上帳號伺服器、連不到大腦、wang、同一個帳號伺服器網址與主機名稱)在 1000/664 寬:「登出」在卡片裡看得到。 未驗證: 使用者自己那台 AnyBot 上的畫面(不能開使用者真的 AnyBot,要重開 App 換上新版才看得到);真的帳號伺服器連不上時的長連線狀態(截圖用暫時的覆寫給同一段字,已拿掉)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:10:51 +00:00
}
hint(ui, format!("手機打開 {} 用同一個帳號登入就能用。可以「加入主畫面」當成 App。", s.relay_url), p);
帳號頁的登出不再歪:電腦版「AnyBot 帳號」卡片的「登出帳號」本來是黏在備份那一列最右邊的一行紅字(不像按鈕、也跟備份無關),現在是卡片最下面獨立一列「登出帳號 ?」+右邊「登出」按鈕,跟「加一台電腦」同一種樣子;「這台電腦在手機上叫」改成標籤在上、欄位跟卡片一樣寬(「王性驊的MacBook Pro (2)」這種名字本來被切掉);「加一台電腦」的名字和按鈕對齊同一條中線。手機:登出類的確認按鈕用登出圖示(本來是垃圾桶);帳戶選單的「登出這支手機」跟 設定 › 手機與帳號 用同一個確認,有沒送出的訊息也會說清掉幾則。登出做的事一字未動。 已驗證: cargo test 全綠(816 passed,含 featuremap::、layout_audit::);account.md 的 verify-anybot 步驟:只聽一個位址、密碼錯/登入、重開不用重登、登出另一台(確認鈕是登出圖示)、登出這支手機、錯 5 次要等、桌面的手機與帳號頁(ANYBOT_SHOT_REAL);手機帳戶選單 › 登出這支手機(斷線時排一則訊息 → 確認寫「還沒送出的 1 則訊息會跟著清掉」→ 取消 → 連回後送達);桌面已登入帳號頁用示範資料截圖(一般與螢幕電腦模式、664/1000 寬);獨立審查(乾淨脈絡照 account.md 審 diff)沒有 P0/P1,兩處 P2 文件用詞已改準。 未驗證: 真的帳號伺服器登入後按「登出」(要 relay/ 帳號伺服器,scratch 不准帶帳號);真的 iPhone/Android 與加入主畫面的 App(無頭瀏覽器 390×844 代替);使用者的帳號伺服器實際送出的手機頁版本(沙盒連不到 tailnet)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:25:26 +00:00
// (A field as wide as the card: a long name like 「…的MacBook Pro (2)」 was cut off.)
form_row(ui, "這台電腦在手機上叫", p, |ui| {
if ui.add(egui::TextEdit::singleline(&mut self.state.remote.host_name).desired_width(f32::INFINITY)).lost_focus() {
changed = true;
}
});
帳號頁的登出不再歪:電腦版「AnyBot 帳號」卡片的「登出帳號」本來是黏在備份那一列最右邊的一行紅字(不像按鈕、也跟備份無關),現在是卡片最下面獨立一列「登出帳號 ?」+右邊「登出」按鈕,跟「加一台電腦」同一種樣子;「這台電腦在手機上叫」改成標籤在上、欄位跟卡片一樣寬(「王性驊的MacBook Pro (2)」這種名字本來被切掉);「加一台電腦」的名字和按鈕對齊同一條中線。手機:登出類的確認按鈕用登出圖示(本來是垃圾桶);帳戶選單的「登出這支手機」跟 設定 › 手機與帳號 用同一個確認,有沒送出的訊息也會說清掉幾則。登出做的事一字未動。 已驗證: cargo test 全綠(816 passed,含 featuremap::、layout_audit::);account.md 的 verify-anybot 步驟:只聽一個位址、密碼錯/登入、重開不用重登、登出另一台(確認鈕是登出圖示)、登出這支手機、錯 5 次要等、桌面的手機與帳號頁(ANYBOT_SHOT_REAL);手機帳戶選單 › 登出這支手機(斷線時排一則訊息 → 確認寫「還沒送出的 1 則訊息會跟著清掉」→ 取消 → 連回後送達);桌面已登入帳號頁用示範資料截圖(一般與螢幕電腦模式、664/1000 寬);獨立審查(乾淨脈絡照 account.md 審 diff)沒有 P0/P1,兩處 P2 文件用詞已改準。 未驗證: 真的帳號伺服器登入後按「登出」(要 relay/ 帳號伺服器,scratch 不准帶帳號);真的 iPhone/Android 與加入主畫面的 App(無頭瀏覽器 390×844 代替);使用者的帳號伺服器實際送出的手機頁版本(沙盒連不到 tailnet)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:25:26 +00:00
ui.add_space(4.0);
if ui.checkbox(&mut self.state.remote.auto_backup, t("每天自動備份到帳號(加密,金鑰由你的密碼產生,伺服器打不開)")).changed() {
changed = true;
}
ui.horizontal(|ui| {
let busy = self.rm.busy.load(Ordering::SeqCst);
if ui.add_enabled(!busy, secondary_button(if busy { "備份中…" } else { "立刻備份" })).clicked() {
self.remote_backup();
}
if self.state.remote.last_backup > 0 {
let t = chrono::DateTime::from_timestamp(self.state.remote.last_backup, 0).map(|d| d.with_timezone(&chrono::Local).format("%m/%d %H:%M").to_string()).unwrap_or_default();
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
ui.label(RichText::new(format!("上次備份 {t}")).size(FONT_XS).color(p.text3));
}
帳號頁的登出不再歪:電腦版「AnyBot 帳號」卡片的「登出帳號」本來是黏在備份那一列最右邊的一行紅字(不像按鈕、也跟備份無關),現在是卡片最下面獨立一列「登出帳號 ?」+右邊「登出」按鈕,跟「加一台電腦」同一種樣子;「這台電腦在手機上叫」改成標籤在上、欄位跟卡片一樣寬(「王性驊的MacBook Pro (2)」這種名字本來被切掉);「加一台電腦」的名字和按鈕對齊同一條中線。手機:登出類的確認按鈕用登出圖示(本來是垃圾桶);帳戶選單的「登出這支手機」跟 設定 › 手機與帳號 用同一個確認,有沒送出的訊息也會說清掉幾則。登出做的事一字未動。 已驗證: cargo test 全綠(816 passed,含 featuremap::、layout_audit::);account.md 的 verify-anybot 步驟:只聽一個位址、密碼錯/登入、重開不用重登、登出另一台(確認鈕是登出圖示)、登出這支手機、錯 5 次要等、桌面的手機與帳號頁(ANYBOT_SHOT_REAL);手機帳戶選單 › 登出這支手機(斷線時排一則訊息 → 確認寫「還沒送出的 1 則訊息會跟著清掉」→ 取消 → 連回後送達);桌面已登入帳號頁用示範資料截圖(一般與螢幕電腦模式、664/1000 寬);獨立審查(乾淨脈絡照 account.md 審 diff)沒有 P0/P1,兩處 P2 文件用詞已改準。 未驗證: 真的帳號伺服器登入後按「登出」(要 relay/ 帳號伺服器,scratch 不准帶帳號);真的 iPhone/Android 與加入主畫面的 App(無頭瀏覽器 390×844 代替);使用者的帳號伺服器實際送出的手機頁版本(沙盒連不到 tailnet)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:25:26 +00:00
});
帳號伺服器換了網址不用再登出重登:tailnet 從 Tailscale 換到自架 headscale 後,舊的 *.ts.net 網址一次全死(nobledesktop 的帳號伺服器改成 http://100.64.0.5),電腦版只能「登出再登入」——帳號裡多一台新的、舊的那台留著,大腦要重選(MacBook Pro 就這樣變成「(2)」,Mac mini 還卡在死網址)。現在 設定 › 手機與帳號 的帳號卡片多一列「帳號伺服器換了網址」:按「換網址」填新網址(連不上時自己展開),先確認那是 AnyBot 帳號伺服器、再用這台自己的金鑰問它認不認得這台(帳號裡的電腦有這台)才換;只換網址,不送密碼、不註冊,登記、大腦、副本、排著的訊息全部照舊;另一台伺服器、這台已被移除就不換,說要登出再登入。沒有視窗的電腦(手腳、伺服器)用 anybot setup --move-to 網址。功能地圖 account.md 加 account-move、FEATURES.md 同步。 已驗證: cargo test 全綠(817,含 featuremap::、layout_audit:: 的「已登入、連不上」畫面);新測試 a_moved_account_server_is_followed_only_when_it_knows_this_computer(同一台換成功且金鑰/大腦不變、另一台、不在帳號、不是帳號伺服器、同網址、沒登入都拒絕);verify-anybot 實跑:scratch relay A 配對加入 → A 關掉、同資料在 B 開 → --move-to 空的 C 被拒、--move-to 假模型埠被拒、--move-to B 成功,重開後 serve.log「透過帳號 verify 連線(…28782)」、/relay/me 同一台在線、沒有多一台;桌面截圖 desktop/account-unreachable.png 卡片自動展開新網址欄位。 未驗證: 桌面上真的點「換過去」那一下(沒有點畫面的工具;同一個 relay_move 由 CLI 和單元測試走過);手機頁面沒有這個功能(手機直接用新網址重新登入)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 00:50:16 +00:00
// 換網址: the account server moved (another machine or port, another VPN — going
// from Tailscale to headscale killed every *.ts.net name at once). Without this the
// only way was to sign out and in again: a new computer in the account (the old
// one left behind, its goodbye sent to the dead address) and the brain picked
// again. Open by itself while the server can't be reached.
let unreachable = status.starts_with("連不上帳號伺服器");
ui.add_space(6.0);
ui.separator();
ui.horizontal(|ui| {
ui.set_min_height(30.0);
ui.label(RichText::new(t("帳號伺服器換了網址")).size(FONT_SM).strong().family(crate::bold()));
help_mark(ui, "帳號伺服器搬到別的位址(換了機器、連接埠或 VPN)時,在這裡填新的網址:AnyBot 先用這台電腦的金鑰確認那邊是同一台帳號伺服器才換,不用登出、不用密碼,大腦、聊天和還沒送出的訊息都照舊。要改用另一台帳號伺服器,請先登出再登入。", p);
if !unreachable && !self.rm.move_open {
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
if ui.add(secondary_button("換網址")).clicked() {
self.rm.move_open = true;
}
});
}
});
if unreachable || self.rm.move_open {
if unreachable {
hint(ui, "連不上現在的網址。帳號伺服器換了位址的話,填新的網址,不用登出:", p);
}
form_row(ui, "新的網址", p, |ui| {
ui.add(egui::TextEdit::singleline(&mut self.rm.move_url).hint_text(t("https://anybot.你的網域,或 http://100.x.x.x")).desired_width(f32::INFINITY));
});
ui.horizontal(|ui| {
let busy = self.rm.move_rx.is_some();
if ui.add_enabled(!busy && !self.rm.move_url.trim().is_empty(), primary_button(if busy { "確認中…" } else { "換過去" }, p)).clicked() {
let (tx, rx) = channel();
self.rm.move_rx = Some(rx);
let (base, url) = (self.state.remote.clone(), self.rm.move_url.trim().to_string());
std::thread::spawn(move || {
let _ = tx.send(remote::relay_move(&base, &url));
});
}
if !unreachable && ui.add(secondary_button("取消")).clicked() {
self.rm.move_open = false;
self.rm.move_url.clear();
}
});
}
帳號頁的登出不再歪:電腦版「AnyBot 帳號」卡片的「登出帳號」本來是黏在備份那一列最右邊的一行紅字(不像按鈕、也跟備份無關),現在是卡片最下面獨立一列「登出帳號 ?」+右邊「登出」按鈕,跟「加一台電腦」同一種樣子;「這台電腦在手機上叫」改成標籤在上、欄位跟卡片一樣寬(「王性驊的MacBook Pro (2)」這種名字本來被切掉);「加一台電腦」的名字和按鈕對齊同一條中線。手機:登出類的確認按鈕用登出圖示(本來是垃圾桶);帳戶選單的「登出這支手機」跟 設定 › 手機與帳號 用同一個確認,有沒送出的訊息也會說清掉幾則。登出做的事一字未動。 已驗證: cargo test 全綠(816 passed,含 featuremap::、layout_audit::);account.md 的 verify-anybot 步驟:只聽一個位址、密碼錯/登入、重開不用重登、登出另一台(確認鈕是登出圖示)、登出這支手機、錯 5 次要等、桌面的手機與帳號頁(ANYBOT_SHOT_REAL);手機帳戶選單 › 登出這支手機(斷線時排一則訊息 → 確認寫「還沒送出的 1 則訊息會跟著清掉」→ 取消 → 連回後送達);桌面已登入帳號頁用示範資料截圖(一般與螢幕電腦模式、664/1000 寬);獨立審查(乾淨脈絡照 account.md 審 diff)沒有 P0/P1,兩處 P2 文件用詞已改準。 未驗證: 真的帳號伺服器登入後按「登出」(要 relay/ 帳號伺服器,scratch 不准帶帳號);真的 iPhone/Android 與加入主畫面的 App(無頭瀏覽器 390×844 代替);使用者的帳號伺服器實際送出的手機頁版本(沙盒連不到 tailnet)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:25:26 +00:00
// 登出帳號: a row of its own under a line, like 加一台電腦 (it was red words at the
// end of the backup row, not a button and not about backups).
ui.add_space(6.0);
ui.separator();
ui.horizontal(|ui| {
ui.set_min_height(30.0);
ui.label(RichText::new(t("登出帳號")).size(FONT_SM).strong().family(crate::bold()));
help_mark(ui, "這台電腦會從帳號移除:手機從外面連、裝置連結、分享都會斷。這台的 Bot 和聊天還在。", p);
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
外觀一輪「浮、圓、靜」(新分支 design-fresh-look,照 2026 的介面方向,桌面對齊手機):輸入框浮起來、按鈕全是膠囊、空白聊天的建議變輕、工作流的停止不再搶眼;允許卡片最後一行不再被切掉。 三條原則寫在 src/theme.rs 開頭: 1. 浮的東西用影子浮起來(調色盤新增 shade,手機的 --shade),平放的用底色和髮絲線分組。 - 聊天輸入框:1.5px 深灰框 → 髮絲線加柔和陰影,打字時框線變深(跟手機同一張卡)。 - 工作流畫布上浮著的工具列、縮放列、側邊設定、等你確認列:同一層陰影(kit::lift)。 2. 按鈕是膠囊、圓鈕是圓的。 - kit 的主要/次要/紅色按鈕、分段選擇、允許卡片的按鈕、分享、其餘 ui.button 都改成膠囊。 - 輸入框的 +/麥克風/送出:圓角方塊 → 圓(手機的 .cbtn 也是)。 3. 顏色只給意思。 - 新增 kit::danger_text_button(淡底紅字):工作流的「■ 停止」、移除電腦、登出用它,紅底只留給不能回頭的刪除。 - 空白聊天的三個開頭:整排灰色大塊 → 一排細框膠囊,滑過才有底。 修正:允許卡片估高度時沒算「之後都直接操作」那一行,800 高的視窗裡最後一行「輸入框空著時:Enter 允許,Esc 拒絕」被切掉一半(offers_direct、ASK_DIRECT_ROW)。 文件:FEATURES.md 的輸入框外觀、設計規格、共用元件按鈕、新對話;workflow.md 右上按鈕(順便拿掉已經不在的「等你確認」)。 已驗證: cargo test 876 個全過(含 featuremap::、layout_audit::、no_new_literal_sizes_radii_or_colours、the_phone_uses_the_same_design_spec);clippy 跟改之前一樣,沒有新警告;scratch 上用 desktop-shot 截了改前/改後(聊天、空白聊天、設定、工作流、允許卡片 1280×800 和 900×640、深色),允許卡片最後一行完整、沒有多出空白;手機頁面打開聊天、打字,送出鈕是圓的(border-radius 50%)。 未驗證: 沒有在你真的 Mac 上用真的資料看(只用示範資料和 scratch);允許卡片只改了高度估算和按鈕形狀,答案的路徑沒動,但它在審批卡片上,合併前請你看過;手機頁面其他畫面沒有一頁頁截。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:09:34 +00:00
if ui.add(danger_text_button("登出", p)).clicked() {
let keep_name = self.state.remote.host_name.clone();
// Say goodbye to the account server: the machine's registration is
// removed, so its key dies with the sign-out.
let (url, token) = (self.state.remote.relay_url.clone(), self.state.remote.host_token.clone());
if !url.is_empty() && !token.is_empty() {
std::thread::spawn(move || {
let _ = remote::relay_post(&format!("{url}/relay/host/remove"), &token, &serde_json::json!({}));
});
}
let s = &mut self.state.remote;
s.host_id.clear();
s.host_token.clear();
s.backup_key.clear();
s.host_name = keep_name;
changed = true;
}
});
});
} else {
let busy = self.rm.join_rx.is_some();
form_row(ui, "帳號伺服器", p, |ui| {
ui.add(egui::TextEdit::singleline(&mut self.rm.relay_url).hint_text(t("https://anybot.你的網域")).desired_width(f32::INFINITY));
});
form_row(ui, "帳號", p, |ui| {
ui.add(egui::TextEdit::singleline(&mut self.rm.user).desired_width(f32::INFINITY));
});
form_row(ui, "密碼", p, |ui| {
ui.add(egui::TextEdit::singleline(&mut self.rm.pass).password(true).desired_width(f32::INFINITY));
});
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
if self.rm.need_code {
form_row(ui, "驗證碼", p, |ui| {
ui.add(egui::TextEdit::singleline(&mut self.rm.code).hint_text(t("驗證器 App 的六位碼,或一組恢復碼")).desired_width(f32::INFINITY));
});
}
ui.checkbox(&mut self.rm.create, t("建立新帳號"));
if self.rm.create {
form_row(ui, "邀請碼", p, |ui| {
ui.add(egui::TextEdit::singleline(&mut self.rm.invite).hint_text(t("伺服器設定了才需要")).desired_width(f32::INFINITY));
});
}
ui.horizontal(|ui| {
let ready = !self.rm.relay_url.trim().is_empty() && !self.rm.user.trim().is_empty() && self.rm.pass.len() >= 8;
if ui.add_enabled(ready && !busy, primary_button(if busy { "連線中…" } else if self.rm.create { "建立並登入" } else { "登入" }, p)).clicked() {
let (tx, rx) = channel();
self.rm.join_rx = Some(rx);
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
let (url, user, pass, create, invite, base, code) = (self.rm.relay_url.clone(), self.rm.user.trim().to_string(), self.rm.pass.clone(), self.rm.create, self.rm.invite.clone(), self.state.remote.clone(), self.rm.code.clone());
std::thread::spawn(move || {
// Signed in: look right away for the bots the account already has.
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
let r = remote::relay_join(&base, &url, &user, &pass, create, &invite, &code).map(|s| {
let found = remote::find_account_bots(&s, &pass, &code);
(s, found)
});
let _ = tx.send(r);
});
}
if ui.add_enabled(ready && self.rm.restore_rx.is_none(), secondary_button("從帳號備份還原")).on_hover_text(t("把這台電腦的 Bot 換成帳號裡最新的備份")).clicked() {
let (tx, rx) = channel();
self.rm.restore_rx = Some(rx);
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
let (url, user, pass, code) = (self.rm.relay_url.clone(), self.rm.user.trim().to_string(), self.rm.pass.clone(), self.rm.code.clone());
std::thread::spawn(move || {
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
let _ = tx.send(remote::restore(&url, &user, &pass, &code));
});
}
});
hint(ui, "密碼至少 8 個字。帳號伺服器在 relay/ 資料夾,可以放在任何一台小主機(說明見 relay/README.md)。", p);
}
let note = self.rm.note.lock().unwrap().clone();
if !note.is_empty() {
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
ui.label(RichText::new(note).size(FONT_SM).color(p.text2));
}
});
// ── 大腦 ──
if !self.state.remote.host_token.is_empty() {
setting_card(ui, p, |ui| {
ui.horizontal(|ui| {
ui.label(RichText::new(t("大腦")).size(FONT_BASE).strong().family(crate::bold()));
feat: 螢幕電腦沒網路照樣能用——直接開副本、訊息和設定排著連上再送、離線只剩一個小標示 螢幕電腦經 Tailscale 香港中繼連大腦(來回 0.6–1 秒、常斷):以前打開一定先停在「正在連到…」 等大腦第一次回答,斷線就「現在只能看」、一大塊紅色提示佔掉聊天高度,訊息 100 秒送不到就退回輸入框。 - 有副本就直接進去:磁碟上有這個大腦的副本(brain-copy.at.json 是這個大腦、有 Bot)時,打開 App 立刻顯示副本、不等網路,之後照舊只拿變了的;只有第一次(沒副本、或是另一個大腦的)才停在等待頁。 副本的設定當「上次知道的大腦設定」(mir.base),離線時的改動照樣算成小改動。 - 沒網路照樣能送:訊息(連引用、附件、記憶)進排隊,馬上顯示在聊天最下面(等連上大腦後送出/ 傳送中…/排隊中…),還沒送出去過的可以「取消」放回輸入框。排隊存在 brain-queue-<大腦>.json (每個大腦一份、金鑰封存),關掉 App 再開還在;連上後依序送,斷線多久都等;附件傳上去的記下來, 重試不再傳;大腦一直連得到、這則卻連續 20 次送不過去才放棄(說可能已經到了)。大腦拒收的才退回輸入框。 - 只做一次:每則照舊帶編號(大腦記 10 分鐘);離第一次送出超過 9 分鐘才再送的,先看大腦的聊天裡 有沒有這句,有就不送。設定改動照舊用 (client, seq)。 - 沒網路照樣能改設定:改動同樣排著,連上後由現有的 pending/unsaved 機制疊在大腦的新設定上; 秘密欄位、keep_run_times 的保證不變。離線時新增的 Bot、例行任務,編號從大腦上次的計數之後 1000–9000(每台不同)起跳,不會跟大腦這段時間給出去的撞號;只讓出編號不算改動;計數器在 apply_ops 也只往前。 - 停止、重新產生、還原、執行例行任務、新對話、清除、回答卡片、按鈕送的指令:照舊要連上才做 (斷線不到約 100 秒照樣送),改走自己的一條路,不會卡在等連線的訊息後面(回答卡片不等; 其他最多等剛排進去的改動 10 秒)。回答卡片的內容和 key 沒變。 - 不擋畫面:紅色大提示拿掉,聊天頂端「分享」旁邊一個小小的「離線」(有在等的寫「離線 · N 則 等送出」,剛打開是「連線中…」),滑鼠移上去說原因、顯示的是幾點同步的、做的事連上後才送。 - 順便修好:大腦送出的設定裡,沒有觸發條件的例行任務被插了 "trigger": null,螢幕電腦每次存檔都 把所有 Bot 的例行任務當改動送回去(the_brains_settings_read_back_the_same)。 - src/remote.rs 只加了 sync_try(一次嘗試、分得出網路還是大腦拒收),拿掉不再用的 sync_upload_sure;first_delivery/DELIVERY_TTL 沒動。 - docs/feature-map/account.md 的 account-brain 和陷阱、FEATURES.md、docs/multi-device.md 同步。 已驗證: cargo test(主程式 763,含新測試:有副本就進去/沒副本才等、離線的訊息連上後只到一次、 重開後排隊還在、太久沒回答的先查聊天、試不過去會放棄、離線改的設定疊到大腦的新設定、離線新增 不撞號、送出的設定讀回來不多出改動、離線送出排隊與取消);featuremap::、layout_audit::、 approval_decisions_are_characterized、tool_specs_are_locked 綠;verify-anybot 帳號區走得到的步驟 (只聽一個位址、密碼錯/登入、重開不用重登、登出另一台、登出這支手機、錯 5 次要等)都過; 六輪乾淨脈絡審查,P0/P1 都修完,最後一輪沒有新的 P0/P1。 未驗證: 螢幕電腦連大腦的真實路徑(要帳號伺服器加第二台電腦,scratch 不准帶帳號);桌面視窗上 「離線」標示和排隊泡泡的樣子(ctl desktop-shot 要開視窗、須使用者同意,沒跑);大腦重開期間 回答掉了的訊息可能多收一次(大腦只在記憶體記編號)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5JgTkqJjkgMtrEXrn
2026-11-20 02:32:27 +00:00
help_mark(ui, "帳號裡選一台 AnyBot 當大腦(通常是跟帳號伺服器放在一起、一直開著的那台)。所有 Bot、聊天、記憶和例行任務都放在大腦上,由它思考和排程。其他電腦打開 AnyBot 看到的都是同一份,同時也是大腦的手腳:大腦的 Bot 可以透過裝置連結操作它們。大腦連不到時,照樣看得到上次同步的內容,也能傳訊息、改設定:先排著,連回來後依序送出;停止、重新產生這類動作要連上才能做。", p);
});
let s = &self.state.remote;
let status = self.mir.status.lock().unwrap().clone();
if self.mir.on {
ui.horizontal(|ui| {
let (r, _) = ui.allocate_exact_size(vec2(10.0, 10.0), egui::Sense::hover());
2026-11-16 14:07:07 +00:00
ui.painter().circle_filled(r.center(), 4.0, if self.mir.online { p.up } else { p.text3 });
帳號頁連不上時「登出」被擠出視窗:「AnyBot 帳號」的連線狀態原本跟帳號、網址擠在同一行而且不換行,連不上時那段錯誤(「連不上帳號伺服器:找不到伺服器:…」)把整張卡片撐得比視窗還寬,右邊的「登出」跑到畫面外看不到(上一版只在狀態是空的時候看過,沒抓到)。現在狀態在帳號下面自己一行、太長就換行,帳號和網址太長就「…」;大腦卡片的「連不到大腦:…」也改成在卡片裡換行。版面檢查加一個畫面「設定 › 手機與帳號(已登入、連不上)」(長錯誤、螢幕電腦連不到大腦),舊的排法在這個畫面會被報成 51 個問題。 已驗證: cargo test 全綠(816 passed,含 layout_audit:: 新畫面、featuremap::、remote_ui::);把狀態放回同一行時 layout_audit 報「連不上帳號伺服器…被切掉 338px」「視窗被內容撐寬 356px」等 51 個問題(證明檢查抓得到);桌面截圖用跟使用者截圖一樣的狀態(連不上帳號伺服器、連不到大腦、wang、同一個帳號伺服器網址與主機名稱)在 1000/664 寬:「登出」在卡片裡看得到。 未驗證: 使用者自己那台 AnyBot 上的畫面(不能開使用者真的 AnyBot,要重開 App 換上新版才看得到);真的帳號伺服器連不上時的長連線狀態(截圖用暫時的覆寫給同一段字,已拿掉)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:10:51 +00:00
// (Wrapped inside the card: a long 「連不到大腦:…」 widened it, like the account's.)
ui.add(egui::Label::new(RichText::new(status).size(FONT_SM).color(p.text2)).wrap());
});
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
// Which leg: this computer ↔ the account server, the account server ↔ the
// brain (as the account server last said), and the line's speed.
let brain_on = self.rm.peers.lock().unwrap().iter().find(|(id, _, _)| *id == s.brain_id).map(|x| x.2);
帳號頁連不上時「登出」被擠出視窗:「AnyBot 帳號」的連線狀態原本跟帳號、網址擠在同一行而且不換行,連不上時那段錯誤(「連不上帳號伺服器:找不到伺服器:…」)把整張卡片撐得比視窗還寬,右邊的「登出」跑到畫面外看不到(上一版只在狀態是空的時候看過,沒抓到)。現在狀態在帳號下面自己一行、太長就換行,帳號和網址太長就「…」;大腦卡片的「連不到大腦:…」也改成在卡片裡換行。版面檢查加一個畫面「設定 › 手機與帳號(已登入、連不上)」(長錯誤、螢幕電腦連不到大腦),舊的排法在這個畫面會被報成 51 個問題。 已驗證: cargo test 全綠(816 passed,含 layout_audit:: 新畫面、featuremap::、remote_ui::);把狀態放回同一行時 layout_audit 報「連不上帳號伺服器…被切掉 338px」「視窗被內容撐寬 356px」等 51 個問題(證明檢查抓得到);桌面截圖用跟使用者截圖一樣的狀態(連不上帳號伺服器、連不到大腦、wang、同一個帳號伺服器網址與主機名稱)在 1000/664 寬:「登出」在卡片裡看得到。 未驗證: 使用者自己那台 AnyBot 上的畫面(不能開使用者真的 AnyBot,要重開 App 換上新版才看得到);真的帳號伺服器連不上時的長連線狀態(截圖用暫時的覆寫給同一段字,已拿掉)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:10:51 +00:00
let legs = remote_legs(&self.relay_status_now(), brain_on, &s.brain_name, *self.mir.last_sync.lock().unwrap());
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
for line in legs {
ui.add(egui::Label::new(RichText::new(line).size(FONT_XS).color(p.text3)).wrap());
}
ui.horizontal(|ui| {
let busy = self.mir.moving.load(Ordering::SeqCst);
if ui.add_enabled(self.mir.online && !busy, secondary_button("把這台的 Bot 搬過去")).on_hover_text(t("把這台電腦原本的 Bot(連同聊天)、模型金鑰、技能和連接器複製到大腦。這台的原始資料不會刪掉。")).clicked() {
self.mirror_move_local();
}
if ui.add(secondary_button("改回用這台自己的 Bot")).clicked() {
self.mir.leave = true;
}
});
let note = self.mir.move_note.lock().unwrap().clone();
if !note.is_empty() {
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
ui.label(RichText::new(note).size(FONT_SM).color(p.text2));
}
} else {
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
ui.label(RichText::new(t("這台就是大腦:Bot 在這台電腦上思考和工作。")).size(FONT_SM).color(p.text2));
let me = s.host_id.clone();
let peers: Vec<(String, String, bool)> = self.rm.peers.lock().unwrap().iter().filter(|(id, _, _)| !id.is_empty() && *id != me && !remote::is_hands(id)).cloned().collect();
if peers.is_empty() {
hint(ui, "帳號裡還沒有別台可以當大腦的 AnyBot。", p);
}
for (id, name, online) in peers {
ui.horizontal(|ui| {
let (r, _) = ui.allocate_exact_size(vec2(10.0, 10.0), egui::Sense::hover());
2026-11-16 14:07:07 +00:00
ui.painter().circle_filled(r.center(), 4.0, if online { p.up } else { p.text3 });
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
ui.label(RichText::new(&name).size(FONT_SM));
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
if ui.add_enabled(online, secondary_button("改用它當大腦")).clicked() {
self.mir.want = Some((id.clone(), name.clone()));
// The brain's bots may use this computer (each action still asks).
self.state.remote.device_link = true;
changed = true;
}
});
});
}
}
self.pair_section(ui);
});
}
// ── 同一個網路 ──
setting_card(ui, p, |ui| {
setting_title(ui, "同一個網路直接連", "手機和這台電腦在同一個 Wi-Fi,或都裝了 Tailscale 時使用。", p);
let has_pw = !self.state.remote.password.is_empty();
if ui.add_enabled(has_pw, egui::Checkbox::new(&mut self.state.remote.lan, t("讓手機直接連這台電腦"))).changed() {
changed = true;
}
if self.state.remote.lan {
if let Some(port) = remote::lan_port() {
for a in remote::addresses(port) {
ui.horizontal(|ui| {
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
ui.label(RichText::new(&a).monospace().size(FONT_SM));
if ui.small_button(t("複製")).clicked() {
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
crate::platform::copy_text(ui.ctx(), &a);
}
});
}
if let Some(print) = remote::lan_fingerprint() {
ui.add_space(2.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
ui.label(RichText::new(t("https 的連線有加密。第一次打開,手機會問要不要信任這台電腦自己做的憑證:選「繼續」(進階 › 繼續前往)。要確認沒連錯台,比對憑證的 SHA-256 指紋:")).size(FONT_XS).color(p.text3));
ui.label(RichText::new(print).monospace().size(FONT_XS).color(p.text3));
} else {
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
ui.label(RichText::new(t("這個連線沒有加密:只在你信任的網路上使用。")).size(FONT_XS).color(p.danger));
}
fix: 帳號伺服器的 http 也看 Tailscale 通道;手機直接連線在背景重試、照實說原因;IPv6 的登入鎖與憑證 第二輪(獨立審查的 P2): - 帳號伺服器:relay_join 原本凡 100.64/10 位址和 *.ts.net 都准 http——Wi-Fi 自己發 100.x 時帳號 密碼會明文送出。現在要它的每個位址都是 Tailscale 的、而且這台到它的路由從 Tailscale 通道出去 (UDP connect 問路由表拿來源位址,看是不是通道位址;lantls::source_for/tailscale_server)。IPv6 位址不再被當成 Docker 網路的名字。其他把 100.64/10 當範圍用的地方(httpd 的每位址連線上限、web 的 私有位址封鎖、DNS rebinding 的 .ts.net 主機名)不是「當成加密」,沒有改。 - ANYBOT_PHONE_BIND 寫錯時,--serve 的紀錄會寫原因;開好後由 set_lan 自己寫「手機可以打開 …」(拿掉 app.rs 裡可能比開好還早跑的那段)。 - 綁定移到背景執行緒:位址還不在(開機時 Tailscale 還沒連上)就說「這台電腦現在沒有 X 這個位址」, 連接埠都被占用就說「連接埠 A–B 都被別的程式占用」,前 2.4 秒快速重試,之後每 5 秒重試、好了自己打開, 不用關掉再開;設定頁在還沒打開時顯示原因(remote::lan_problem)。不再擋 UI/serve 的執行緒。 ANYBOT_PHONE_PORT 接近 65535 時不再溢位。 - IPv6:登入錯誤鎖改用整個 IP 當鍵(原本切第一個冒號,fd7a 開頭的全部共用一把鎖);host_port 去掉 IPv6 的方括號(也修好沒有連接埠的 [v6] 網址),憑證裡是 IP,不是「[::1]」這種名字。 - Windows:從 ipconfig 找名字有 Tailscale 的介面卡(不加相依、不開主控台視窗)。 - 測試:綁定真的在指定位址、位址不在/連接埠被占用時的訊息和自動恢復、front 真的用連線落點和通道位址 決定 http 或 https、帳號伺服器 http 的判斷、IPv6 登入鎖、憑證的 IP、ipconfig 樣本。 - 文件:SECURITY.md 寫成程式實際做的(看連線落在哪個位址,不是封包從哪張網卡進來;同一個 Wi-Fi 上故意 打 Tailscale 位址的只會暴露它自己的流量)、帳號伺服器的規則;FEATURES.md 修正舊的「Tailscale 100.x 可用 http」並加一條;phone.md 補帳號伺服器網址、重試、Windows。 已驗證: 完整 cargo test(金鑰清空、DOCKER_HOST 指到不存在)全綠(648 過、47 ignored 沒跑);cargo clippy --bin anybot --all-targets -- -D warnings 沒有警告;sh deploy/ci/lint-sh.sh 過。每個回退各做一次、新測試都抓到: 綁定改回 0.0.0.0、carry 不傳連線落點、carry 不傳通道位址、http 判斷改回只看來源範圍、登入鎖改回切冒號、 帳號伺服器改回凡 100.64/10 都算、host_port 留方括號(兩個測試)。實機(verify-anybot,這台 Mac): ANYBOT_PHONE_BIND=not-an-address 時紀錄寫原因、不聽任何埠;=192.0.2.1 時寫「這台電腦現在沒有 192.0.2.1 這個位址」、不聽;26200–26209 被占用時寫「都被別的程式占用」,空出來後同一個 PID 自己聽到 127.0.0.1:26200 並寫「手機可以打開」;phone 區範例旅程照貼結束碼 0;預設綁定照舊(*:埠、Tailscale 位址 http 200、 區網 http 308)。 未驗證: Wi-Fi 自己發 100.64.x 的網路、帳號伺服器在那種網路上的拒絕——手邊沒有,只有單元測試;Windows 的 ipconfig 偵測——沒有 Windows,只有樣本輸出測試,也沒在 Windows 上編譯(cfg(windows) 的那幾行);Linux 實機; IPv6 綁定沒有實機跑(登入鎖和憑證只有單元測試);設定頁顯示 lan_problem 的那一行沒有開視窗看(不在使用者 螢幕上開視窗)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:03:45 +00:00
} else if let Some(why) = remote::lan_problem() {
// Not listening yet (the address isn't there, the ports are taken): it keeps trying.
ui.label(RichText::new(why).size(FONT_XS).color(p.danger));
}
}
ui.add_space(4.0);
form_row(ui, if has_pw { "更改手機密碼" } else { "設定手機密碼" }, p, |ui| {
ui.add(egui::TextEdit::singleline(&mut self.rm.pw1).password(true).hint_text(t("至少 8 個字")).desired_width(f32::INFINITY));
});
form_row(ui, "再輸入一次", p, |ui| {
ui.add(egui::TextEdit::singleline(&mut self.rm.pw2).password(true).desired_width(f32::INFINITY));
});
let ok = self.rm.pw1.chars().count() >= 8 && self.rm.pw1 == self.rm.pw2;
if ui.add_enabled(ok, secondary_button("儲存密碼")).clicked() {
self.state.remote.password = crate::httpd::hash_password(&self.rm.pw1);
// A new password signs every phone out.
self.state.remote.devices.clear();
self.rm.pw1.clear();
self.rm.pw2.clear();
changed = true;
}
if !self.rm.pw2.is_empty() && self.rm.pw1 != self.rm.pw2 {
hint(ui, "兩次輸入的密碼不一樣", p);
}
hint(ui, "不要把這個連接埠開放到網際網路上;從外面連請用上面的帳號,或 Tailscale。", p);
});
// ── 允許手機做什麼 ──
setting_card(ui, p, |ui| {
setting_title(ui, "手機可以做什麼", "聊天、核准、看 Bot 的電腦一律可以。下面這些會碰到這台電腦本身,預設關閉。", p);
if ui.checkbox(&mut self.state.remote.mac_from_phone, t("從手機看這台電腦的螢幕並操作(點、打字、按鍵)")).changed() {
changed = true;
}
// (裝置連結 — other AnyBots of the account using this computer — has nothing to do
// with phones: it is in 設定 › 電腦 ›「讓帳號裡的其他電腦使用這台」, its one place.)
note(ui, "讓帳號裡其他的 AnyBot(例如放在伺服器上的)操作這台:在 設定 › 電腦 ›「讓帳號裡的其他電腦使用這台」。", p);
});
// ── 已登入的裝置 ──
setting_card(ui, p, |ui| {
setting_title(ui, "直接連線的裝置", "用手機密碼登入過的手機和瀏覽器", p);
if self.state.remote.devices.is_empty() {
hint(ui, "還沒有", p);
}
let mut remove = None;
for (i, d) in self.state.remote.devices.iter().enumerate() {
ui.horizontal(|ui| {
ui.label(RichText::new(&d.name).size(FONT_BASE));
let seen = chrono::DateTime::from_timestamp(d.last_seen.max(d.created), 0).map(|t| t.with_timezone(&chrono::Local).format("最近 %m/%d %H:%M").to_string()).unwrap_or_default();
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
ui.label(RichText::new(seen).size(FONT_XS).color(p.text3));
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
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
if ui.add(egui::Button::new(RichText::new(t("登出")).size(FONT_XS).color(p.danger)).frame(false)).clicked() {
remove = Some(i);
}
});
});
}
if let Some(i) = remove {
self.state.remote.devices.remove(i);
changed = true;
}
});
// ── 團隊 ──
if !self.state.remote.host_token.is_empty() {
setting_card(ui, p, |ui| {
setting_title(ui, "分享給團隊", "讓帳號伺服器上的其他帳號也能用這台 AnyBot 的 Bot。", p);
hint(ui, "成員:可以和 Bot 聊天、附加檔案;Bot 會知道是誰在說話。管理員:另外可以核准 Bot 要做的事、停止、看和操作電腦畫面。需要你允許的事只通知你和管理員。", p);
let loaded = self.rm.members.lock().unwrap().clone();
if loaded.is_none() {
*self.rm.members.lock().unwrap() = Some(Ok(vec![]));
let (m, s) = (self.rm.members.clone(), self.state.remote.clone());
std::thread::spawn(move || *m.lock().unwrap() = Some(remote::members(&s)));
}
let mut change: Option<(String, &str)> = None;
match loaded {
Some(Ok(list)) => {
for (user, role) in list {
ui.horizontal(|ui| {
ui.label(RichText::new(&user).size(FONT_BASE));
let waits = role.ends_with('?');
let role = role.trim_end_matches('?').to_string();
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
ui.label(RichText::new(format!("{}{}", if role == "admin" { "管理員" } else { "成員" }, if waits { "(已邀請,等對方接受)" } else { "" })).size(FONT_XS).color(p.text3));
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
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
if ui.add(egui::Button::new(RichText::new(t("移除")).size(FONT_XS).color(p.danger)).frame(false)).clicked() {
change = Some((user.clone(), "remove"));
}
});
});
}
}
Some(Err(e)) => hint(ui, format!("讀不到分享清單:{e}"), p),
None => {}
}
ui.horizontal(|ui| {
ui.add(egui::TextEdit::singleline(&mut self.rm.new_member).hint_text(t("對方的帳號")).desired_width(160.0));
ui.checkbox(&mut self.rm.new_admin, t("管理員"));
if ui.add_enabled(!self.rm.new_member.trim().is_empty(), secondary_button("分享")).clicked() {
change = Some((self.rm.new_member.trim().to_string(), if self.rm.new_admin { "admin" } else { "member" }));
self.rm.new_member.clear();
}
});
// Talk to the relay off the window's thread, then show the new list.
if let Some((user, role)) = change {
let (m, note, s, role) = (self.rm.members.clone(), self.rm.note.clone(), self.state.remote.clone(), role.to_string());
std::thread::spawn(move || {
let r = remote::set_member(&s, &user, &role);
*note.lock().unwrap() = match r {
Ok(()) if role == "remove" => format!("已停止分享給 {user}"),
Ok(()) => format!("已分享給 {user}"),
Err(e) => e,
};
*m.lock().unwrap() = Some(remote::members(&s));
});
}
});
}
// ── 帳號裡的其他電腦 ──
if !self.state.remote.host_token.is_empty() {
setting_card(ui, p, |ui| {
setting_title(ui, "帳號裡的電腦", "登入同一個帳號的 AnyBot。開了裝置連結的電腦,Bot 可以操作它。", p);
if ui.small_button(t("重新整理")).clicked() || (self.rm.peers.lock().unwrap().is_empty() && !self.rm.busy.load(Ordering::SeqCst)) {
let (peers, s) = (self.rm.peers.clone(), self.state.remote.clone());
let first = peers.lock().unwrap().is_empty();
if first {
peers.lock().unwrap().push((String::new(), "讀取中…".into(), false));
}
std::thread::spawn(move || {
let v = remote::devices_online(&s);
*peers.lock().unwrap() = if v.is_empty() { vec![(String::new(), "(沒有)".into(), false)] } else { v };
});
}
for (id, name, online) in self.rm.peers.lock().unwrap().iter() {
ui.horizontal(|ui| {
let (r, _) = ui.allocate_exact_size(vec2(10.0, 10.0), egui::Sense::hover());
if !id.is_empty() {
2026-11-16 14:07:07 +00:00
ui.painter().circle_filled(r.center(), 4.0, if *online { p.up } else { p.text3 });
}
let me = *id == self.state.remote.host_id;
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
ui.label(RichText::new(format!("{name}{}", if me { "(這台)" } else { "" })).size(FONT_SM));
});
}
});
}
if changed {
self.mark();
}
}
/// Other AnyBots of this account that let bots operate them (裝置連結), as computers.
pub(super) fn linked_devices(&self) -> Vec<tools::Target> {
if self.state.remote.host_token.is_empty() {
return vec![];
}
let has_hands = !remote::my_hands(&self.state.remote.host_id).is_empty();
self.rm
.peers
.lock()
.unwrap()
.iter()
.filter(|(id, _, online)| !id.is_empty() && *online && *id != self.state.remote.host_id)
// A brain with hands of its own works on those, not on the account's other brains.
.filter(|(id, _, _)| !has_hands || remote::is_hands(id))
// A computer showing another brain lends its hands to that one, not to this.
.filter(|(id, _, _)| {
let uses = remote::peer_uses(id);
uses.is_empty() || uses == self.state.remote.host_id
})
.map(|(id, name, _)| tools::Target { name: name.clone(), place: tools::Place::Device { host: id.clone(), dir: String::new() } })
.collect()
}
}
/// A model one can chat with (not an image, video, speech or embedding one).
fn chats(model: &str) -> bool {
let m = model.to_lowercase();
!["imagine", "image", "video", "embed", "tts", "whisper", "audio", "moderation", "dall-e", "sora", "veo"].iter().any(|k| m.contains(k))
}
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 大腦 section's lines under its state: this computer ↔ the account server (the lasting
/// connection's own words), the account server ↔ the brain (online or not, as the account server
/// last said), and the last sync's size and speed.
pub(super) fn remote_legs(relay: &str, brain_online: Option<bool>, brain: &str, last: Option<(i64, u64, u64)>) -> Vec<String> {
let mut out = vec![];
if !relay.is_empty() {
out.push(format!("這台 ↔ 帳號伺服器:{relay}"));
}
match brain_online {
Some(true) => out.push(format!("帳號伺服器 ↔ 大腦「{brain}」:在線上")),
Some(false) => out.push(format!("帳號伺服器 ↔ 大腦「{brain}」:不在線上(大腦那台的 AnyBot 沒開、沒網路,或正在重新啟動)")),
None => {}
}
if let Some((at, bytes, ms)) = last {
out.push(super::mirror_ui::sync_words(at, bytes, ms));
}
out
}
手機補上「工作流」:首頁上面一排多一格,每個工作流一張卡(觸發、步驟數、這次或最近一次、▷ 執行/■ 停止),等你確認直接在卡上按「繼續」「停止」;點進去看步驟由上到下、每一步的狀態和結果、最近 10 次執行紀錄。 - 大腦(src/app/remote_ui.rs):phone_act 加 workflows(讀,管理員也可以)和 workflow(run/stop/go/halt,擁有者);沒步驟的不跑(NO_STEPS)、正在跑的不再開一次;手機按的執行記成「手動」,不上日程。workflow_json 給步驟(種類、內容、哪個 Bot)、觸發和下次、正在跑的和最近 10 次(每一步的狀態和結果前 600 字、審批在問什麼)。 - 同一個網路直接連的手機也可以(src/remote.rs lan_guard:workflows/workflow 算「不放寬」——步驟照各 Bot 自己的設定跑,跟排程開始時一樣)。 - 手機頁面(mobile/index.html):listWorkflows/drawWorkflows;跑的時候每 3 秒重讀;步驟的狀態:完成、進行中、等你確認(審批那一步)、失敗、略過,還沒到的變淡。 - 測試:remote_ui::phone_act_tests::the_phone_reads_and_runs_workflows。 - 功能地圖 workflow.md 加 workflow-phone 和一步手機驗證;FEATURES.md 改掉「手機沒有工作流」。 已驗證: cargo test 878 個全過;clippy 沒有新警告;scratch 手機頁面:聊天裡請 Bot 建「Threads 早報」→ 首頁「工作流」→ 卡上 ▷ 執行 →「開始執行」→ 卡上出現「等你確認:要把早報傳給你嗎?」→ 點進去看到觸發器、助手、條件「完成」、審批黃色「等你確認」、輸出變淡 → 按「繼續」→ state 最後一次 done、by 手動、五步都 done。 未驗證: 經帳號連的手機要 make update-server 才有新頁面;等你確認的推播點進來直接到這張卡(推播本身要真的手機)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:07:19 +00:00
impl App {
/// One workflow as the phone shows it (it is edited on the computer or by asking a bot; here
/// it is looked at and run).
fn workflow_json(&self, w: &crate::workflow::Workflow) -> serde_json::Value {
use crate::workflow::{NodeKind as K, RunState, StepState};
let bot_name = |id: u64| self.state.bot(id).map(|b| b.name.clone()).unwrap_or_default();
let state = |s: &RunState| match s {
RunState::Running => "running",
RunState::Waiting => "waiting",
RunState::Done => "done",
RunState::Failed => "failed",
RunState::Stopped => "stopped",
};
let step_state = |s: StepState| match s {
StepState::Waiting => "waiting",
StepState::Running => "running",
StepState::Done => "done",
StepState::Failed => "failed",
StepState::Skipped => "skipped",
};
let steps: Vec<serde_json::Value> = w
.order()
.iter()
.filter_map(|id| w.node(*id))
.map(|n| {
let who = match &n.kind {
K::Step { bot, .. } | K::Media { bot, .. } | K::Check { bot, .. } | K::Deliver { bot } | K::Output { bot, .. } => bot_name(*bot),
_ => String::new(),
};
json!({"id": n.id, "kind": n.kind.label(), "words": clip(&n.kind.words(), 240), "bot": who})
})
.collect();
let run = |r: &crate::workflow::Run| {
// (What a 審批 step asks, while the run waits on it.)
let asks = (r.state == RunState::Waiting).then(|| r.order.get(r.at).and_then(|id| w.node(*id))).flatten().map(|n| n.kind.words()).unwrap_or_default();
json!({
"id": r.id, "state": state(&r.state), "words": crate::workflow::describe_run(r), "by": r.by, "started": r.started, "ended": r.ended, "why": r.why, "asks": asks,
"steps": r.steps.iter().map(|s| json!({"node": s.node, "state": step_state(s.state), "output": clip(&s.output, 600)})).collect::<Vec<_>>(),
})
};
let trigger = w.trigger().map(|t| t.kind.words()).unwrap_or_else(|| "手動".into());
json!({
"id": w.id, "name": w.name, "when": trigger, "steps": steps, "step_count": w.step_count(),
"next": w.next_run.map(|t| crate::routines::describe_when(t, &self.state.timezone)),
"live": w.live_run().map(run),
"runs": w.runs.iter().rev().take(10).map(run).collect::<Vec<_>>(),
})
}
}
#[cfg(test)]
mod phone_tests {
手機「載入更早的對話」按了沒反應:大腦的 api/bots/<id>/older 只在發布給手機的那份(最新 PHONE_TAIL=120 則,工具結果不算一則)裡往回找。Jenny 那一輪做了 65 個步驟,一步兩則,120 則還裝不下這一輪;手機拿完那份之後,按鈕還在(第一則序號 > 0),older 回來的都是手上已有的,loadOlder 看到沒有新的就直接 return,什麼都沒說——看起來就是按了沒反應。 - 大腦:older 改成問 App(phone_act "older",讀的角色都能用),從整段聊天組。發布那份和這裡用同一個 phone_messages(從 remote_ui 的發布迴圈抽出來,給任意一段:步驟帶結果、思考、頁面卡、支線、檔案的 ✓ 另外放);一段裡步驟佔掉位置時再往前補,補到 count 則或到開頭,多的切掉留給下一次,more 照實說。各角色看得到的照舊(messages_for_role)。沒有 App 在跑(只測伺服器,hub 沒有 repaint)時照舊從發布的那份找。 - 手機:補的時候按鈕寫「載入中…」、不能連按;補完畫面停在原本看的地方;到開頭說「已是對話最開頭」、按鈕收起;拿到的 ✓ 一起合進來。 - chat.md 的「開聊天分頁」那一步原本只填 40 則沒有步驟的訊息,全在那 120 則裡,從來沒測到這種聊天:改成 40 輪各一個步驟(160 則,超過手機那份),按兩下;原本點的 [data-s="out"] 在帳戶選單裡已經不存在(是「登出這支手機」選項),一起改;登入後等首頁出來再點。 已驗證: cargo test 839 過(新:loading_earlier_walks_the_whole_chat——301 則、150 個步驟的聊天,從 181 往前拿 60 則、最後一則 179、more true、每步帶結果;從 9 往前拿到 0、more false;管理員也能讀;remote:: 原有的 older 測試照舊過);clippy 維持 12;scratch 照 chat.md 那一步跑(40 輪、160 則,手機那份從序號 40 起):打開從「填充31」(序號 120、30 則),第一下補到「填充11」(序號 40),第二下補到「填充1」(序號 0,手機那份之外——以前這下沒反應)、「已是對話最開頭」、按鈕消失,畫面停在原本看的地方。 未驗證: Jenny 的手機上——「載入更早」是她電腦上的大腦(jenny-Host)回答的,要更新她的 AnyBot(要重開,等她閒著)才生效;手機頁面那半要更新 ai 的帳號伺服器。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 08:28:27 +00:00
use super::*;
/// 載入更早 walks back through the whole chat, not only the newest PHONE_TAIL the phone was
/// sent: from any place, the messages just before it (steps' results folded into their
/// steps, so a stretch of steps still gives `count` to show), and `more` until the start.
/// (A turn of 65 steps filled the newest 120 by itself; the button then did nothing: jenny-Host,
/// 2026-11-21.)
#[test]
fn loading_earlier_walks_the_whole_chat() {
let ctx = egui::Context::default();
let mut app = App::new(&ctx, Some(std::env::temp_dir().join("anybot-older.png")));
let id = app.state.bots[0].id;
{
let b = app.state.bot_mut(id).unwrap();
b.messages.clear();
b.messages.push(Message::user("開始"));
for i in 0..150 {
let call = crate::model::ToolCall { id: format!("c{i}"), name: "web_fetch".into(), args: format!(r#"{{"url":"https://example.com/{i}"}}"#), status: ToolStatus::Done };
b.messages.push(Message { tool_calls: vec![call], ..Message::assistant(&format!("第 {i} 步"), "") });
b.messages.push(Message::tool_result(&format!("c{i}"), "web_fetch", &format!("結果 {i}")));
}
}
let n = app.state.bot(id).unwrap().messages.len();
assert_eq!(n, 301);
// The phone holds the newest stretch; it asks for what is before index 241 (far past the
// newest 120's start, 181, and far before it too).
let ask = |app: &mut App, from: usize| app.phone_act(&ctx, "older", &json!({"bot": id, "from": from, "count": 60}), "owner");
let v = ask(&mut app, 181);
let msgs = v["messages"].as_array().unwrap();
assert_eq!(msgs.len(), 60, "{v}");
assert!(msgs.iter().all(|m| m["index"].as_u64().unwrap() < 181), "{v}");
assert_eq!(msgs.last().unwrap()["index"], json!(179));
assert_eq!(v["more"], json!(true));
// Each step shows with what it brought back.
assert!(msgs[0]["tools"][0]["result"].as_str().is_some_and(|r| r.starts_with("結果 ")), "{}", msgs[0]);
// Near the start: what is left, and no more.
let v = ask(&mut app, 9);
let msgs = v["messages"].as_array().unwrap();
assert_eq!((msgs.first().unwrap()["index"].as_u64(), msgs.last().unwrap()["index"].as_u64(), v["more"].as_bool()), (Some(0), Some(7), Some(false)), "{v}");
// A reader who isn't the owner may too (it only looks).
assert!(app.phone_act(&ctx, "older", &json!({"bot": id, "from": 50}), "admin").get("error").is_none());
}
#[test]
fn only_chat_models_are_offered() {
assert!(super::chats("grok-4.7") && super::chats("claude-opus-5-5") && super::chats("gpt-5-mini"));
assert!(!super::chats("grok-imagine-video-1.5") && !super::chats("text-embedding-3-large") && !super::chats("gpt-4o-mini-tts"));
}
}
// ---------- 手機: everything the desktop does, from the phone ----------
// Each action calls what the desktop's own button calls (appctl for the actions a bot can take
// too, set_pinned, restart_bot, toggle_reaction, enable_direct_mode, box_task…), so the phone
// adds no ways of its own. Members never get here (remote::role_allows); some things are the
// owner's alone: deleting a bot, permissions and rules, channels, connectors and the box's
// runtime, update and schedule. Keys, tokens and the vault's secrets are never sent.
/// Docker facts for the phone's 電腦 settings, refreshed in the background (asking Docker on the
/// app's thread would stall the window): (when, update available, gVisor here, runs on).
static BOX_FACTS: std::sync::Mutex<Option<(Instant, serde_json::Value)>> = std::sync::Mutex::new(None);
static BOX_FACTS_BUSY: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
fn box_facts() -> serde_json::Value {
let (stale, v) = {
let g = BOX_FACTS.lock().unwrap_or_else(|e| e.into_inner());
(g.as_ref().map(|(t, _)| t.elapsed().as_secs() > 20).unwrap_or(true), g.as_ref().map(|(_, v)| v.clone()).unwrap_or_else(|| json!({})))
};
// (Unit tests don't ask Docker.)
if stale && !cfg!(test) && !BOX_FACTS_BUSY.swap(true, std::sync::atomic::Ordering::SeqCst) {
std::thread::spawn(|| {
let (n, exec_ms, total_ms) = crate::cloudbox::step_stats();
fix: 十一個小錯——瀏覽器設定檔換得了、支線改不了設定、直接連線的拒絕照實說、手機的標籤和設定頁照實寫 1. 瀏覽器設定檔只能列出:browser 的 action 就是 profiles,裡面的 list/add/use 傳不到 browser_profiles,帶 name 也只列出。現在帶 name 就換到那個設定檔、還沒有就先新增 (profiles_tool 自己判斷,工具定義不變);步驟寫「切換到「…」」。 2. 支線改得了設定:支線的 update_bot 按允許後把主 Bot 改名。update_bot、update_settings、 update_my_profile、teach_skill,和新增/修改/移除連接器或 hook,在支線一律馬上回 「支線改不了設定:回到主線再請它改。」,不跳卡片;ChatGPT 登入登出照樣跳卡。 3. 直接連線的拒絕說「區網連線(沒有加密)」:直接連線是 https,擋的原因是只憑手機密碼。 改成「這會放寬 Bot 能做的事:同一個網路直接連的裝置只能收緊、不能放寬…」;能力、可以 用的電腦只有勾回才擋(勾掉以前也被擋)。 4. 本機網址的卡寫「(在 上)」:Bot 的電腦都開不了瀏覽器時,寫「(在 執行 AnyBot 的這台 電腦 上)」。 5. 手機把監看叫醒的訊息標「例行任務」:照電腦版的標籤表(目標、例行任務、觸發、訊息管道、 來自其他 Bot),加上「監看」;測試確認手機和電腦用同一張表。 6. 步驟名字:replay_skill 寫「重播技能 「記一筆」」(以前「工具 工作資料夾」);例行任務的 送出證據寫「傳訊息給其他 Bot 給 同事:早安」(以前「message_bot 工作資料夾」);只有 檔案步驟會寫資料夾。 7. 執行步驟用的模型的卡寫「自動 → 不分開」(以前「(空) → 「off」」)。 8. ChatGPT 的卡照要做的事寫標題:「…想要登出 ChatGPT 方案」「…想要換 ChatGPT 帳號」 (以前「想要ChatGPT 方案登入」),手機和電腦都是。 9. 正常關掉 AnyBot 時,沒做完的支線寫「AnyBot 關掉了,這條支線停了」(以前「被停止了」, 像使用者按了停止);還在等主線的也一起照實寫。 10. 手機的設定頁只讀一次:狀態版本一變就重讀開著的設定頁,其他頁下次打開重讀(/always-approve 填了預設規則,權限頁不用重新整理)。 11. 沒有 Docker 時手機的電腦頁寫「已是 v14」「這台 Docker 主機沒有 gVisor」:問不到的事送 null,頁面寫「沒有 Docker,現在沒有這台電腦」,不說有沒有 gVisor。 功能地圖:browser、branch、profile、autonomy、models、market、phone、files、replay、 routines、box 的子功能、Bot 那一行、步驟和看到的結果照新行為改;拿掉只在描述錯誤的陷阱 (autonomy 的設定頁不更新、box 的已是 v14)。FEATURES.md 同步。verify-approval-routing: approval_json、approval_body 只改了標題的字,模型的假設不變,rehash coverage.tsv(這個 commit 是新的同步 commit)。 找到但沒修:browser 的 tabs 也一樣,裡面的 switch/new/close 傳不到 browser_tabs(工具 說明本身就叫模型用 action 帶),要改工具定義才修得好。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(676 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(10 個重走都過);新測試先在拿掉修正的程式上跑過、 11 個都失敗;verify-anybot 照地圖跑 box、browser、models、files、replay、routines、branch、 autonomy、profile、phone、market 的步驟,全部通過(證據在 target/verify-anybot/)。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 會開真的瀏覽器,要人在實機跑、簽名;本機網址的卡按「允許」(會開真的瀏覽器);電腦版視窗 上的卡片標題和支線卡(要開視窗);帳號連線的手機(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 09:44:16 +00:00
// (What can't be known — no Docker to ask, no box yet — is null, and the phone says
// so: it read 「已是 v14」 and 「這台 Docker 主機沒有 gVisor」 with no Docker at all.)
let v = json!({
fix: 十一個小錯——瀏覽器設定檔換得了、支線改不了設定、直接連線的拒絕照實說、手機的標籤和設定頁照實寫 1. 瀏覽器設定檔只能列出:browser 的 action 就是 profiles,裡面的 list/add/use 傳不到 browser_profiles,帶 name 也只列出。現在帶 name 就換到那個設定檔、還沒有就先新增 (profiles_tool 自己判斷,工具定義不變);步驟寫「切換到「…」」。 2. 支線改得了設定:支線的 update_bot 按允許後把主 Bot 改名。update_bot、update_settings、 update_my_profile、teach_skill,和新增/修改/移除連接器或 hook,在支線一律馬上回 「支線改不了設定:回到主線再請它改。」,不跳卡片;ChatGPT 登入登出照樣跳卡。 3. 直接連線的拒絕說「區網連線(沒有加密)」:直接連線是 https,擋的原因是只憑手機密碼。 改成「這會放寬 Bot 能做的事:同一個網路直接連的裝置只能收緊、不能放寬…」;能力、可以 用的電腦只有勾回才擋(勾掉以前也被擋)。 4. 本機網址的卡寫「(在 上)」:Bot 的電腦都開不了瀏覽器時,寫「(在 執行 AnyBot 的這台 電腦 上)」。 5. 手機把監看叫醒的訊息標「例行任務」:照電腦版的標籤表(目標、例行任務、觸發、訊息管道、 來自其他 Bot),加上「監看」;測試確認手機和電腦用同一張表。 6. 步驟名字:replay_skill 寫「重播技能 「記一筆」」(以前「工具 工作資料夾」);例行任務的 送出證據寫「傳訊息給其他 Bot 給 同事:早安」(以前「message_bot 工作資料夾」);只有 檔案步驟會寫資料夾。 7. 執行步驟用的模型的卡寫「自動 → 不分開」(以前「(空) → 「off」」)。 8. ChatGPT 的卡照要做的事寫標題:「…想要登出 ChatGPT 方案」「…想要換 ChatGPT 帳號」 (以前「想要ChatGPT 方案登入」),手機和電腦都是。 9. 正常關掉 AnyBot 時,沒做完的支線寫「AnyBot 關掉了,這條支線停了」(以前「被停止了」, 像使用者按了停止);還在等主線的也一起照實寫。 10. 手機的設定頁只讀一次:狀態版本一變就重讀開著的設定頁,其他頁下次打開重讀(/always-approve 填了預設規則,權限頁不用重新整理)。 11. 沒有 Docker 時手機的電腦頁寫「已是 v14」「這台 Docker 主機沒有 gVisor」:問不到的事送 null,頁面寫「沒有 Docker,現在沒有這台電腦」,不說有沒有 gVisor。 功能地圖:browser、branch、profile、autonomy、models、market、phone、files、replay、 routines、box 的子功能、Bot 那一行、步驟和看到的結果照新行為改;拿掉只在描述錯誤的陷阱 (autonomy 的設定頁不更新、box 的已是 v14)。FEATURES.md 同步。verify-approval-routing: approval_json、approval_body 只改了標題的字,模型的假設不變,rehash coverage.tsv(這個 commit 是新的同步 commit)。 找到但沒修:browser 的 tabs 也一樣,裡面的 switch/new/close 傳不到 browser_tabs(工具 說明本身就叫模型用 action 帶),要改工具定義才修得好。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(676 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(10 個重走都過);新測試先在拿掉修正的程式上跑過、 11 個都失敗;verify-anybot 照地圖跑 box、browser、models、files、replay、routines、branch、 autonomy、profile、phone、market 的步驟,全部通過(證據在 target/verify-anybot/)。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 會開真的瀏覽器,要人在實機跑、簽名;本機網址的卡按「允許」(會開真的瀏覽器);電腦版視窗 上的卡片標題和支線卡(要開視窗);帳號連線的手機(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 09:44:16 +00:00
"update": crate::cloudbox::box_outdated(),
"gvisor": crate::cloudbox::gvisor_on_host(),
"running": crate::cloudbox::running_runtime(),
"steps": {"n": n, "exec_ms": exec_ms, "total_ms": total_ms},
});
*BOX_FACTS.lock().unwrap_or_else(|e| e.into_inner()) = Some((Instant::now(), v));
BOX_FACTS_BUSY.store(false, std::sync::atomic::Ordering::SeqCst);
});
}
v
}
/// At most `n` characters (the phone shows excerpts).
fn clip(s: &str, n: usize) -> String {
if s.chars().count() <= n {
s.to_string()
} else {
format!("{}…", s.chars().take(n).collect::<String>())
}
}
impl App {
手機「載入更早的對話」按了沒反應:大腦的 api/bots/<id>/older 只在發布給手機的那份(最新 PHONE_TAIL=120 則,工具結果不算一則)裡往回找。Jenny 那一輪做了 65 個步驟,一步兩則,120 則還裝不下這一輪;手機拿完那份之後,按鈕還在(第一則序號 > 0),older 回來的都是手上已有的,loadOlder 看到沒有新的就直接 return,什麼都沒說——看起來就是按了沒反應。 - 大腦:older 改成問 App(phone_act "older",讀的角色都能用),從整段聊天組。發布那份和這裡用同一個 phone_messages(從 remote_ui 的發布迴圈抽出來,給任意一段:步驟帶結果、思考、頁面卡、支線、檔案的 ✓ 另外放);一段裡步驟佔掉位置時再往前補,補到 count 則或到開頭,多的切掉留給下一次,more 照實說。各角色看得到的照舊(messages_for_role)。沒有 App 在跑(只測伺服器,hub 沒有 repaint)時照舊從發布的那份找。 - 手機:補的時候按鈕寫「載入中…」、不能連按;補完畫面停在原本看的地方;到開頭說「已是對話最開頭」、按鈕收起;拿到的 ✓ 一起合進來。 - chat.md 的「開聊天分頁」那一步原本只填 40 則沒有步驟的訊息,全在那 120 則裡,從來沒測到這種聊天:改成 40 輪各一個步驟(160 則,超過手機那份),按兩下;原本點的 [data-s="out"] 在帳戶選單裡已經不存在(是「登出這支手機」選項),一起改;登入後等首頁出來再點。 已驗證: cargo test 839 過(新:loading_earlier_walks_the_whole_chat——301 則、150 個步驟的聊天,從 181 往前拿 60 則、最後一則 179、more true、每步帶結果;從 9 往前拿到 0、more false;管理員也能讀;remote:: 原有的 older 測試照舊過);clippy 維持 12;scratch 照 chat.md 那一步跑(40 輪、160 則,手機那份從序號 40 起):打開從「填充31」(序號 120、30 則),第一下補到「填充11」(序號 40),第二下補到「填充1」(序號 0,手機那份之外——以前這下沒反應)、「已是對話最開頭」、按鈕消失,畫面停在原本看的地方。 未驗證: Jenny 的手機上——「載入更早」是她電腦上的大腦(jenny-Host)回答的,要更新她的 AnyBot(要重開,等她閒著)才生效;手機頁面那半要更新 ai 的帳號伺服器。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 08:28:27 +00:00
/// The phone's form of the messages `start..end` of this bot's chat — each with its place in
/// it, its thinking and what each step brought back, in short — and the ✓ marks of the files
/// among them. The published view is the newest PHONE_TAIL; 載入更早 (phone_act "older") asks
/// for the stretch before what the phone holds, from the whole chat.
fn phone_messages(&self, b: &Bot, names: &HashMap<u64, String>, start: usize, end: usize) -> (Vec<serde_json::Value>, Vec<serde_json::Value>) {
let end = end.min(b.messages.len());
let start = start.min(end);
// 交付確認: the ✓ marks go beside the chat, not inside the messages — a phone opening
// an old chat reports every file it shows, and inside the messages that re-signed the
// whole chat on every report (see remote::chat_for).
let mut deliveries: Vec<serde_json::Value> = vec![];
// Each message with its place in the chat (表情回應), its thinking and, on each step,
// what came back (the desktop's 顯示步驟 / 思考過程), in short.
let results: HashMap<&str, &str> = b.messages[start..end].iter().filter(|m| m.role == Role::Tool).map(|m| (m.tool_call_id.as_str(), m.text.as_str())).collect();
// 頁面 cards: once a reply, under the step that saved the page last (over the whole chat,
// so a reply cut by the tail still knows its later steps).
let cards = crate::pages::cards_by_message(&b.messages);
let msgs: Vec<serde_json::Value> = b.messages[start..end]
.iter()
.enumerate()
.filter_map(|(k, m)| {
let mut v = remote::message_json(m, names, &self.state.pages, cards.get(start + k).map(Vec::as_slice).unwrap_or(&[]))?;
if let Some(atts) = v["attachments"].as_array_mut() {
for a in atts.iter_mut() {
let Some(o) = a.as_object_mut() else { continue };
let id = o.get("id").and_then(serde_json::Value::as_str).unwrap_or("").to_string();
let (Some(d), has_seen) = (o.remove("delivery"), o.contains_key("seen")) else { continue };
if id.is_empty() { continue; }
let seen = if has_seen { o.remove("seen").unwrap_or(json!([])) } else { json!([]) };
deliveries.push(json!({"id": id, "delivery": d, "seen": seen}));
}
}
v["index"] = json!(start + k);
// 支線: its record, for the card (and the report's label).
if m.branch != 0 {
if let Some(r) = b.branches.iter().find(|r| r.id == m.branch) {
v["branch"] = json!({"id": r.id, "task": r.task, "state": r.state, "note": r.note, "doing": r.doing, "steps": r.steps, "log": r.log, "result": r.result});
}
}
if !m.thinking.trim().is_empty() {
v["thinking"] = json!(clip(m.thinking.trim(), 1500));
}
if let Some(tools) = v["tools"].as_array_mut() {
for (t, c) in tools.iter_mut().zip(m.tool_calls.iter()) {
if t["plan"].is_object() {
let (state, live) = super::plan_ui::plan_card_state(b, c);
t["plan"]["state"] = state;
t["plan"]["live"] = live;
continue;
}
if t.get("talk").is_some() {
if let Some(r) = results.get(c.id.as_str()) {
t["talk"]["answer"] = json!(clip(r.trim(), 2000));
}
continue;
}
if t.get("label").is_some() {
t["name"] = json!(c.name);
if let Some(r) = results.get(c.id.as_str()) {
// (秘密遮罩: what a step printed may hold a key; the phone shows it masked.)
// (Masked on a window a little past what is shown, not on the whole
// output: a long command's output was scanned whole on every publish.)
t["result"] = json!(clip(&crate::secrets::mask(&clip(r.trim(), 1200)), 600));
}
}
}
}
Some(v)
})
.collect();
(msgs, deliveries)
}
pub(super) fn phone_act(&mut self, ctx: &egui::Context, action: &str, b: &serde_json::Value, role: &str) -> serde_json::Value {
let owner = role == "owner";
let bot = b["bot"].as_u64().unwrap_or(0);
let s = |k: &str| b[k].as_str().unwrap_or("").trim().to_string();
fix: 直接連線真的只能收緊;Bot 的電腦和支線換不了瀏覽器設定檔;支線不動大家共用的東西 複審 f3ff553 找到的問題,加上直接連線全部設定的盤點: A. 直接連線用多一格空白繞過檢查:檢查照原字讀名字,大腦那邊(phone_act)卻先去掉空白 再做,「direct_mode 」「 rule_add」「abilities 」都過關、照做。現在兩邊都照原字讀: phone_act 的 key/list/op 不再 trim,規則清單只認 ask、allow(以前認不得的都當允許 清單);直接連線上名字不是 AnyBot 認得的一律 400「不認得這個設定」,什麼都不改。 盤點(remote::lan_guard,直接連線送來的每個 api/act):放寬的一律 403——打開直接操作、 打開自動審核、加允許規則、拿掉詢問規則、加連接器或把關掉的打開、打開訊息管道、打開 Bot 的電腦工具(沒帶值也算打開,跟 phone_act 一樣)、分享給團隊、勾回能力或可以用的 電腦、Bot 的電腦從 gVisor 換回標準;收緊的和不動權限的照做。卡片的允許/一律允許照舊 (那是回答眼前那張卡)。「只能收緊、不能放寬」現在是真的。 B. Bot 的電腦裡換瀏覽器設定檔是假的:在 box 裡 add 在大腦建資料夾、set_current 卻寫 「預設」蓋掉這台記著的選擇,Bot 還聽到「已新增並切換」。現在 box 裡新增、切換一律 回「Bot 的電腦上的瀏覽器只有一個設定檔…」,box 裡也不再寫這台的使用中設定檔(以前在 box 開網頁就把它改回「預設」)。 P2 設定檔名字:「阿金」不再模糊對到使用者的「阿金(Firefox)」:只換 AnyBot 自己同名的 設定檔(大小寫不算),其他名字新增全新的;使用者自己的瀏覽器(Firefox 設定檔、「你的 瀏覽器」)Bot 不能換過去——拒絕並請使用者在設定裡換(換了是每一步、每個 Bot 都用他的 登入;這個工具沒有卡片可問)。某一步指名用它也不會變成使用中。 P2 支線:create_bot、create_group、move_to_group、rename_group、delete_group、 delete_skill、skill_install(內建的也是)也擋;連接器、hook 改成只放行「看」的動作 (空白、大小寫都算改);瀏覽器 profiles 的新增、切換擋在步驟(BranchLimits); save_skill、skillify 不能換掉技能庫裡已有的同名技能(apply 裡 bot_id 早就換成主 Bot,改用原本的支線 id 判斷;save_skill 在寫資料夾之前就擋)。支線的系統提示和 changes_settings 的說明照實列出擋什麼。 P3 oplog::replay_of 不再把 browser_profiles 當只看的。 功能地圖:autonomy(子功能、步驟加直接連線拿掉詢問規則 403、多空白名字 400、打開自動 審核 403、state 確認)、account、profile、phone、branch(Bot 那一行、步驟加支線建 Bot、 換設定檔被擋、陷阱)、browser(子功能、Bot 那一行、步驟加換「你的瀏覽器」被擋); FEATURES.md、SECURITY.md 同步。工具定義不變;verify-approval-routing 沒有漂移。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(679 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);7 個新/改的測試在 放回舊程式時都失敗(含複審的繞過:「direct_mode 」照做);verify-anybot 照地圖跑 autonomy、branch、browser、profile、market、phone、channels、connectors 的步驟。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 要人在實機跑、簽名;Bot 的電腦裡的瀏覽器(要 Docker);使用者真的 Firefox 設定檔(scratch 沒有);帳號連線那條路(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 11:36:07 +00:00
// A setting's name, exactly as sent: 「direct_mode 」 isn't direct_mode. (Trimmed, it slipped
// past the direct connection's guard, which reads names exactly — remote::lan_guard.)
let name_of = |k: &str| b[k].as_str().unwrap_or("").to_string();
let fail = |e: &str| json!({"error": e});
let done = |t: &str| json!({"ok": true, "text": t});
let owner_only = || json!({"error": "這件事只有這台 AnyBot 的擁有者能做"});
// 團隊: an admin keeps what the phone always let them do (approve, stop, the screens, the
// model and computer, a new chat, regenerate) plus looking and small chat things; making,
// changing or deleting bots, routines, memories, pages and settings stays the owner's.
let admin_ok = match action {
"detail" | "settings" | "pages" | "search" | "export_bot" | "export_transcript" | "restart_bot" | "react" | "reply" | "resume" | "older" | "workflows" | "schedule" | "library" => true,
"bot" => b["key"].as_str() == Some("unread"),
"box" => matches!(b["op"].as_str(), Some("wake" | "disk")),
_ => false,
};
if !owner && !admin_ok {
return owner_only();
}
match action {
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
"search" => {
let q = s("q");
let (hits, more) = crate::find::search(&self.state.bots, &q);
let items: Vec<serde_json::Value> = hits
.into_iter()
.map(|h| {
let bname = self.state.bot(h.bot).map(|x| x.name.clone()).unwrap_or_default();
let tname = h.thread.and_then(|ti| self.state.bot(h.bot).and_then(|x| x.threads.get(ti)).map(|t| t.0.clone()));
json!({"bot": h.bot, "bot_name": bname, "thread": h.thread, "thread_title": tname, "index": h.index, "at": h.at, "mine": h.mine, "file": h.file, "snippet": h.snippet})
})
.collect();
json!({"ok": true, "hits": items, "more": more})
}
手機補上「工作流」:首頁上面一排多一格,每個工作流一張卡(觸發、步驟數、這次或最近一次、▷ 執行/■ 停止),等你確認直接在卡上按「繼續」「停止」;點進去看步驟由上到下、每一步的狀態和結果、最近 10 次執行紀錄。 - 大腦(src/app/remote_ui.rs):phone_act 加 workflows(讀,管理員也可以)和 workflow(run/stop/go/halt,擁有者);沒步驟的不跑(NO_STEPS)、正在跑的不再開一次;手機按的執行記成「手動」,不上日程。workflow_json 給步驟(種類、內容、哪個 Bot)、觸發和下次、正在跑的和最近 10 次(每一步的狀態和結果前 600 字、審批在問什麼)。 - 同一個網路直接連的手機也可以(src/remote.rs lan_guard:workflows/workflow 算「不放寬」——步驟照各 Bot 自己的設定跑,跟排程開始時一樣)。 - 手機頁面(mobile/index.html):listWorkflows/drawWorkflows;跑的時候每 3 秒重讀;步驟的狀態:完成、進行中、等你確認(審批那一步)、失敗、略過,還沒到的變淡。 - 測試:remote_ui::phone_act_tests::the_phone_reads_and_runs_workflows。 - 功能地圖 workflow.md 加 workflow-phone 和一步手機驗證;FEATURES.md 改掉「手機沒有工作流」。 已驗證: cargo test 878 個全過;clippy 沒有新警告;scratch 手機頁面:聊天裡請 Bot 建「Threads 早報」→ 首頁「工作流」→ 卡上 ▷ 執行 →「開始執行」→ 卡上出現「等你確認:要把早報傳給你嗎?」→ 點進去看到觸發器、助手、條件「完成」、審批黃色「等你確認」、輸出變淡 → 按「繼續」→ state 最後一次 done、by 手動、五步都 done。 未驗證: 經帳號連的手機要 make update-server 才有新頁面;等你確認的推播點進來直接到這張卡(推播本身要真的手機)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:07:19 +00:00
// 工作流 on the phone: each one's steps in order, what starts it, how its runs went, and
// the question it waits on — read here; run, stop, 繼續 and 停止 below.
"workflows" => json!({"ok": true, "workflows": self.state.workflows.iter().map(|w| self.workflow_json(w)).collect::<Vec<_>>()}),
// 所有檔案 on the phone: every file the chats keep, across bots and conversations.
"library" => self.library_json(),
// 日程 on the phone: three days back to a week ahead — what ran on its own and how it
// went, what is coming — and 即將執行 (each thing once, soonest first).
"schedule" => {
use crate::schedule::{self as sch, Status, What};
let now = crate::routines::now();
let tz = self.state.timezone.clone();
let today = sch::day_of(now, &tz);
let from = sch::day_start(today - chrono::Duration::days(3), &tz);
let to = sch::day_start(today + chrono::Duration::days(7), &tz);
let one = |i: &sch::Item| {
let (kind, id) = match i.what {
What::Routine { id, .. } => ("routine", id),
What::Workflow { id } => ("workflow", id),
};
let status = match i.status {
Status::Done => "done",
Status::Failed => "failed",
Status::Stopped => "stopped",
Status::Running => "running",
Status::Coming => "coming",
Status::Paused => "paused",
};
json!({"at": i.at, "clock": sch::clock(i.at, &tz), "day": sch::day_of(i.at, &tz).to_string(), "title": i.title, "when": i.when, "bot": i.bot, "kind": kind, "id": id, "status": status})
};
let items: Vec<serde_json::Value> = sch::items(&self.state, from, to, now).iter().take(400).map(one).collect();
let coming: Vec<serde_json::Value> = sch::coming(&self.state, now, 6).iter().map(one).collect();
json!({"ok": true, "today": today.to_string(), "items": items, "coming": coming})
}
手機補上「工作流」:首頁上面一排多一格,每個工作流一張卡(觸發、步驟數、這次或最近一次、▷ 執行/■ 停止),等你確認直接在卡上按「繼續」「停止」;點進去看步驟由上到下、每一步的狀態和結果、最近 10 次執行紀錄。 - 大腦(src/app/remote_ui.rs):phone_act 加 workflows(讀,管理員也可以)和 workflow(run/stop/go/halt,擁有者);沒步驟的不跑(NO_STEPS)、正在跑的不再開一次;手機按的執行記成「手動」,不上日程。workflow_json 給步驟(種類、內容、哪個 Bot)、觸發和下次、正在跑的和最近 10 次(每一步的狀態和結果前 600 字、審批在問什麼)。 - 同一個網路直接連的手機也可以(src/remote.rs lan_guard:workflows/workflow 算「不放寬」——步驟照各 Bot 自己的設定跑,跟排程開始時一樣)。 - 手機頁面(mobile/index.html):listWorkflows/drawWorkflows;跑的時候每 3 秒重讀;步驟的狀態:完成、進行中、等你確認(審批那一步)、失敗、略過,還沒到的變淡。 - 測試:remote_ui::phone_act_tests::the_phone_reads_and_runs_workflows。 - 功能地圖 workflow.md 加 workflow-phone 和一步手機驗證;FEATURES.md 改掉「手機沒有工作流」。 已驗證: cargo test 878 個全過;clippy 沒有新警告;scratch 手機頁面:聊天裡請 Bot 建「Threads 早報」→ 首頁「工作流」→ 卡上 ▷ 執行 →「開始執行」→ 卡上出現「等你確認:要把早報傳給你嗎?」→ 點進去看到觸發器、助手、條件「完成」、審批黃色「等你確認」、輸出變淡 → 按「繼續」→ state 最後一次 done、by 手動、五步都 done。 未驗證: 經帳號連的手機要 make update-server 才有新頁面;等你確認的推播點進來直接到這張卡(推播本身要真的手機)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:07:19 +00:00
"workflow" => {
let wf = b["wf"].as_u64().unwrap_or(0);
let what = b["do"].as_str().unwrap_or("");
let Some(w) = self.state.workflows.iter().find(|w| w.id == wf) else { return fail("找不到這個工作流") };
if !["run", "stop", "go", "halt"].contains(&what) {
return fail("不認得的操作");
}
if what == "run" && !w.has_steps() {
return fail(crate::workflow::NO_STEPS);
}
if what == "run" && w.live_run().is_some() {
return fail("這個工作流正在執行");
}
let name = w.name.clone();
self.wf_do(ctx, wf, what);
self.mark();
done(&match what {
"run" => format!("開始執行「{name}」"),
"stop" => format!("已停止「{name}」"),
"go" => "好,繼續".to_string(),
_ => "停下來了".to_string(),
})
}
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
"export_bot" => match self.state.bot(bot) {
Some(x) => json!({"ok": true, "filename": format!("{}.anybot", x.name), "content": crate::share::export(x)}),
None => fail("找不到這個 Bot"),
},
"export_transcript" => match self.state.bot(bot) {
Some(x) => json!({"ok": true, "filename": format!("{} 對話.md", x.name), "content": super::transcript_markdown(x)}),
None => fail("找不到這個 Bot"),
},
"import_bot" => {
if !owner {
return owner_only();
}
let content = b["content"].as_str().unwrap_or("");
let id = self.state.next_id;
let mut next_rt = self.state.bots.iter().flat_map(|x| x.routines.iter()).map(|r| r.id).max().unwrap_or(0) + 1;
match crate::share::import(content, id, &mut next_rt, crate::routines::now()) {
Ok(nb) => {
let name = nb.name.clone();
self.state.next_id += 1;
self.state.bots.push(nb);
self.dirty = true;
json!({"ok": true, "bot": id, "text": format!("已匯入「{name}」")})
}
Err(e) => fail(&e),
}
}
"section_move" => {
if !owner {
return owner_only();
}
let folder = b["folder"].as_str().map(str::trim).filter(|f| !f.is_empty()).map(String::from);
let by = b["by"].as_i64().unwrap_or(0).clamp(-1, 1) as i32;
if by != 0 {
self.move_section(&folder, by);
}
done("好了")
}
記憶: 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
"memory" => {
let v = crate::memory::api_write(&mut self.state, b);
if v.get("ok").is_some() {
self.dirty = true;
}
v
}
手機「載入更早的對話」按了沒反應:大腦的 api/bots/<id>/older 只在發布給手機的那份(最新 PHONE_TAIL=120 則,工具結果不算一則)裡往回找。Jenny 那一輪做了 65 個步驟,一步兩則,120 則還裝不下這一輪;手機拿完那份之後,按鈕還在(第一則序號 > 0),older 回來的都是手上已有的,loadOlder 看到沒有新的就直接 return,什麼都沒說——看起來就是按了沒反應。 - 大腦:older 改成問 App(phone_act "older",讀的角色都能用),從整段聊天組。發布那份和這裡用同一個 phone_messages(從 remote_ui 的發布迴圈抽出來,給任意一段:步驟帶結果、思考、頁面卡、支線、檔案的 ✓ 另外放);一段裡步驟佔掉位置時再往前補,補到 count 則或到開頭,多的切掉留給下一次,more 照實說。各角色看得到的照舊(messages_for_role)。沒有 App 在跑(只測伺服器,hub 沒有 repaint)時照舊從發布的那份找。 - 手機:補的時候按鈕寫「載入中…」、不能連按;補完畫面停在原本看的地方;到開頭說「已是對話最開頭」、按鈕收起;拿到的 ✓ 一起合進來。 - chat.md 的「開聊天分頁」那一步原本只填 40 則沒有步驟的訊息,全在那 120 則裡,從來沒測到這種聊天:改成 40 輪各一個步驟(160 則,超過手機那份),按兩下;原本點的 [data-s="out"] 在帳戶選單裡已經不存在(是「登出這支手機」選項),一起改;登入後等首頁出來再點。 已驗證: cargo test 839 過(新:loading_earlier_walks_the_whole_chat——301 則、150 個步驟的聊天,從 181 往前拿 60 則、最後一則 179、more true、每步帶結果;從 9 往前拿到 0、more false;管理員也能讀;remote:: 原有的 older 測試照舊過);clippy 維持 12;scratch 照 chat.md 那一步跑(40 輪、160 則,手機那份從序號 40 起):打開從「填充31」(序號 120、30 則),第一下補到「填充11」(序號 40),第二下補到「填充1」(序號 0,手機那份之外——以前這下沒反應)、「已是對話最開頭」、按鈕消失,畫面停在原本看的地方。 未驗證: Jenny 的手機上——「載入更早」是她電腦上的大腦(jenny-Host)回答的,要更新她的 AnyBot(要重開,等她閒著)才生效;手機頁面那半要更新 ai 的帳號伺服器。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 08:28:27 +00:00
// 載入更早: the `count` (at most 120) messages before index `from`, from the whole chat
// (the published view holds only the newest PHONE_TAIL — the phone used to walk back
// through those alone, and the button then did nothing at all).
"older" => match self.state.bot(bot) {
Some(x) => {
let from = b["from"].as_u64().map(|f| f as usize).unwrap_or(x.messages.len()).min(x.messages.len());
let count = b["count"].as_u64().unwrap_or(60).clamp(1, 120) as usize;
let names: HashMap<u64, String> = self.state.bots.iter().map(|y| (y.id, y.name.clone())).collect();
// (Steps take room: walk back until `count` show, or the chat begins.)
let mut start = from.saturating_sub(count);
let (mut msgs, mut deliveries) = self.phone_messages(x, &names, start, from);
while msgs.len() < count && start > 0 {
let more_from = start;
start = start.saturating_sub(count);
let (m2, d2) = self.phone_messages(x, &names, start, more_from);
msgs.splice(0..0, m2);
deliveries.extend(d2);
}
// (The last stretch can bring more than asked: `count` at most, the rest next time.)
let mut more = start > 0;
if msgs.len() > count {
msgs.drain(..msgs.len() - count);
more = true;
}
json!({"bot": bot, "messages": msgs, "deliveries": deliveries, "more": more})
}
None => fail("找不到這個 Bot"),
},
"detail" => match self.state.bot(bot) {
安全、修正: 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
Some(x) => self.phone_detail(x, owner),
None => fail("找不到這個 Bot"),
},
"settings" => self.phone_settings(owner),
個人資料與用量(計畫 C4、C5,照 OpenBot 的排版):設定多一頁「個人資料」(左下角選單也有「個人資料與用量…」)。名字和「過去一年有 N 個活躍日」;五張卡——Token(過去一年,不算快取命中)、最活躍的一天、訊息、目前連續天數(今天還沒用不算斷)、最長連續天數;「活動」一年的熱度格子(53 週,越忙越深,滑過看日期、token、訊息數);「用量」7/30/90 天/一年:token(新讀、寫、快取讀到)、呼叫次數、花費(只算模型服務回報的,沒回報寫「未定價」,不是 0 元)、每天一條、依模型、依 Bot。 全部從已經有的紀錄算(stats.rs:usage/YYYY-MM.jsonl 和每則訊息的時間,usage::since_any 讀一年),用大腦的時區切日子,打開時在背景算、一分鐘內不重算。螢幕電腦向大腦要(api/sync/stats),手機的路是 api/stats(擁有者才有,手機頁面還沒做)。卡片做成 kit.rs 的 stat_card(設計檢查不准散落的手工卡片)。功能地圖 settings.md(settings-me、驗證步驟)、FEATURES.md、計畫 C4/C5 狀態、版面檢查加「設定 › 個人資料」。 已驗證: cargo test 全綠(831),新測試 stats::a_year_in_figures(不算快取命中、最忙的一天、訊息、今天還沒用不斷、最長、台北時區 23:30 還算那天、熱度四級、7 天的依模型依 Bot、檢查算在它的 Bot、刪掉的 Bot、花費和未定價)、counts_and_costs_are_said_plainly、me_ui 的日期;layout_audit 過(第一版卡片的邊框讓頁面寬了 4 px,被它抓到);clippy 錯誤數跟之前一樣(12);桌面截圖(scratch 寫進一年假的用量紀錄):五張卡、熱度格子、用量的 30 天、每日條、依模型、依 Bot;verify-anybot:api/stats 回 371 天、四個期間,沒登入 401。 未驗證: 螢幕電腦向大腦要(要兩台);真的一年資料的大腦算多久(Jenny 那台 3.5 萬則舊訊息)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 05:54:31 +00:00
// 個人資料與用量: the owner's alone (whose tokens, which bots).
"stats" => {
if !owner {
return owner_only();
}
crate::stats::build(&crate::stats::inputs(&self.state), crate::model::now_ms())
}
// Every page, newest first (the state the phone polls carries only the latest few).
"pages" => {
let now = crate::model::now_ms();
let mut list: Vec<&crate::pages::Page> = self.state.pages.iter().collect();
list.sort_by_key(|p| std::cmp::Reverse(p.updated));
let pages: Vec<serde_json::Value> = list
.into_iter()
.map(|p| {
let mut c = crate::pages::card_json(p, now);
c["bot"] = json!(self.state.bot(p.bot).map(|x| x.name.clone()).unwrap_or_default());
c
})
.collect();
json!({"ok": true, "pages": pages})
}
// The actions a bot can take on the app (the same appctl path as its tools).
"app" => {
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
// (skillify and skill_install are the phone's 「教我做」 and 「從網址安裝技能」.)
const ALLOWED: [&str; 17] = [
"create_bot", "update_bot", "remember", "forget", "save_skill", "delete_skill", "skillify", "skill_install", "create_routine", "update_routine",
"delete_routine", "run_routine_now", "create_group", "move_to_group", "rename_group", "delete_group", "update_settings",
];
let name = s("name");
if !ALLOWED.contains(&name.as_str()) {
return fail("手機不能做這件事");
}
let args = match &b["args"] {
serde_json::Value::String(t) => t.clone(),
v if v.is_object() => v.to_string(),
_ => "{}".to_string(),
};
// (The bot it is about; the app-wide ones act as the main bot, as from its chat.)
let id = [bot, self.state.primary_bot].into_iter().find(|i| self.state.bot(*i).is_some()).or_else(|| self.state.bots.first().map(|x| x.id)).unwrap_or(0);
let next = self.state.next_id;
let out = if name == "update_bot" && serde_json::from_str::<serde_json::Value>(&args).map(|v| v["default_computer"].is_string()).unwrap_or(false) {
self.update_bot_computer(id, &args)
} else {
appctl::apply(&mut self.state, id, &name, &args)
};
if out.theme_changed {
self.apply_theme(ctx);
}
for (target, msg) in out.wake {
self.wake(ctx, target, msg);
}
self.dirty = true;
if !out.ok {
return fail(&out.text);
}
let made = (self.state.next_id > next).then_some(next);
json!({"ok": true, "text": out.text, "bot": made})
}
// A bot's switches from its menu and editor.
"bot" => {
if self.state.bot(bot).is_none() {
return fail("找不到這個 Bot");
}
let v = &b["value"];
fix: 直接連線真的只能收緊;Bot 的電腦和支線換不了瀏覽器設定檔;支線不動大家共用的東西 複審 f3ff553 找到的問題,加上直接連線全部設定的盤點: A. 直接連線用多一格空白繞過檢查:檢查照原字讀名字,大腦那邊(phone_act)卻先去掉空白 再做,「direct_mode 」「 rule_add」「abilities 」都過關、照做。現在兩邊都照原字讀: phone_act 的 key/list/op 不再 trim,規則清單只認 ask、allow(以前認不得的都當允許 清單);直接連線上名字不是 AnyBot 認得的一律 400「不認得這個設定」,什麼都不改。 盤點(remote::lan_guard,直接連線送來的每個 api/act):放寬的一律 403——打開直接操作、 打開自動審核、加允許規則、拿掉詢問規則、加連接器或把關掉的打開、打開訊息管道、打開 Bot 的電腦工具(沒帶值也算打開,跟 phone_act 一樣)、分享給團隊、勾回能力或可以用的 電腦、Bot 的電腦從 gVisor 換回標準;收緊的和不動權限的照做。卡片的允許/一律允許照舊 (那是回答眼前那張卡)。「只能收緊、不能放寬」現在是真的。 B. Bot 的電腦裡換瀏覽器設定檔是假的:在 box 裡 add 在大腦建資料夾、set_current 卻寫 「預設」蓋掉這台記著的選擇,Bot 還聽到「已新增並切換」。現在 box 裡新增、切換一律 回「Bot 的電腦上的瀏覽器只有一個設定檔…」,box 裡也不再寫這台的使用中設定檔(以前在 box 開網頁就把它改回「預設」)。 P2 設定檔名字:「阿金」不再模糊對到使用者的「阿金(Firefox)」:只換 AnyBot 自己同名的 設定檔(大小寫不算),其他名字新增全新的;使用者自己的瀏覽器(Firefox 設定檔、「你的 瀏覽器」)Bot 不能換過去——拒絕並請使用者在設定裡換(換了是每一步、每個 Bot 都用他的 登入;這個工具沒有卡片可問)。某一步指名用它也不會變成使用中。 P2 支線:create_bot、create_group、move_to_group、rename_group、delete_group、 delete_skill、skill_install(內建的也是)也擋;連接器、hook 改成只放行「看」的動作 (空白、大小寫都算改);瀏覽器 profiles 的新增、切換擋在步驟(BranchLimits); save_skill、skillify 不能換掉技能庫裡已有的同名技能(apply 裡 bot_id 早就換成主 Bot,改用原本的支線 id 判斷;save_skill 在寫資料夾之前就擋)。支線的系統提示和 changes_settings 的說明照實列出擋什麼。 P3 oplog::replay_of 不再把 browser_profiles 當只看的。 功能地圖:autonomy(子功能、步驟加直接連線拿掉詢問規則 403、多空白名字 400、打開自動 審核 403、state 確認)、account、profile、phone、branch(Bot 那一行、步驟加支線建 Bot、 換設定檔被擋、陷阱)、browser(子功能、Bot 那一行、步驟加換「你的瀏覽器」被擋); FEATURES.md、SECURITY.md 同步。工具定義不變;verify-approval-routing 沒有漂移。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(679 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);7 個新/改的測試在 放回舊程式時都失敗(含複審的繞過:「direct_mode 」照做);verify-anybot 照地圖跑 autonomy、branch、browser、profile、market、phone、channels、connectors 的步驟。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 要人在實機跑、簽名;Bot 的電腦裡的瀏覽器(要 Docker);使用者真的 Firefox 設定檔(scratch 沒有);帳號連線那條路(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 11:36:07 +00:00
let key = name_of("key");
if matches!(key.as_str(), "tools" | "allow_remove" | "strengths" | "not_for" | "abilities" | "skills" | "may_use") && !owner {
return owner_only();
}
match key.as_str() {
"pinned" => self.set_pinned(bot, v.as_bool().unwrap_or(false), None),
// 團隊: whether teammates may use this bot (the owner's choice only).
"team" => {
if !owner {
return owner_only();
}
if let Some(b) = self.state.bot_mut(bot) {
b.team = v.as_bool().unwrap_or(false);
}
}
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
"pin_at" => self.set_pinned(bot, true, v.as_u64().map(|n| n as usize)),
"folder" => {
let f = v.as_str().unwrap_or("").trim().to_string();
self.set_pinned(bot, false, None);
if !f.is_empty() && !self.state.folders.contains(&f) {
self.state.folders.push(f.clone());
}
if let Some(x) = self.state.bot_mut(bot) {
x.folder = f;
}
}
"primary" => self.state.primary_bot = bot,
"members" => {
let ids: Vec<u64> = v.as_array().map(|a| a.iter().filter_map(|x| x.as_u64()).collect()).unwrap_or_default();
let ok: Vec<u64> = ids.into_iter().filter(|i| *i != bot && self.state.bot(*i).map(|x| x.members.is_empty()).unwrap_or(false)).collect();
if ok.is_empty() {
return fail("群組至少要有一個成員");
}
if let Some(x) = self.state.bot_mut(bot) {
x.members = ok;
}
}
// 個人檔案: 能力、技能、可以用的電腦 — the ticked ones; all of them is "no list".
"abilities" | "skills" | "may_use" => {
let ticked: Vec<String> = v.as_array().map(|a| a.iter().filter_map(|x| x.as_str().map(String::from)).collect()).unwrap_or_default();
let every: Vec<String> = match key.as_str() {
"abilities" => crate::profile::ABILITIES.iter().map(|a| a.0.to_string()).collect(),
"skills" => self.state.skills.iter().filter(|k| k.enabled).map(|k| k.name.clone()).collect(),
_ => self.state.bot(bot).map(|x| self.every_computer(x).into_iter().skip(1).map(|c| c.0).collect()).unwrap_or_default(),
};
// (In the list's own order, so what the bot is told reads the same every turn.)
let kept: Vec<String> = every.iter().filter(|n| ticked.contains(n)).cloned().collect();
fix: 直接連線再補三個放寬的路:/always-approve、匯入帶團隊分享、關機的電腦被算進「每一台」 複審 36420f3 用測試證明的三個繞過,和幾個小的: 1. 在聊天打「/always-approve」(/yolo):直接連線的 api/bots/:id/send 從沒問過檢查, 擁有者身分就開了直接操作和一律放行。現在 remote.rs 在門口先看這句話是不是會放寬的 AnyBot 指令(commands.rs 的 AppCommand::loosens,每個指令都要列在其中一邊,新的指令 一定得決定),是就 403、什麼都不送;status、off 照常。只有門口知道是不是直接連線 (帳號那條路送進來的 Cmd 一模一樣),所以擋在那裡。順便:`--ask` 跑 AnyBot 自己的 指令(沒開一輪)以前結束碼是 1,現在是 0——地圖改在這台電腦上打「/always-approve」。 2. api/act/import_bot 帶著檔案裡的 team:true 就分享給團隊:share 的匯出不寫、匯入不收 team(也清 branch_of、branches),電腦版一樣;lan_guard 把每個 api/act 動作都列在 一邊,沒列到的一律 400,不再默默放行。 3. 可以用的電腦:帳號裡關機的電腦不在清單上,全勾就存成 None(每一台),被排除的那台 開機又能用。現在沒列出的電腦維持原狀,有清單的 Bot 從手機上不會變成「每一台」(帳號 那條路也一樣)。能力沒有這個問題:11 類永遠都列出來,None 只多出以後新版加的類別。 P2:支線的瀏覽器步驟指名 profile 只用在那一步(不再 set_current);支線換掉技能庫已有 技能的檢查跟寫資料夾一樣忽略大小寫;直接連線把 Bot 加進分享給團隊的群組算放寬 (phone_detail 多帶 team);SECURITY.md、account.md、autonomy.md 寫明打開「從手機看 這台電腦的螢幕並操作」時這個保證不成立;autonomy.md「手機用擁有者身分打也可以」改成 帳號連線才行。 P3:phone_act 照原字讀名字的那一半有自己的測試了。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(683 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);新的測試在放回 36420f3 的程式時都失敗(/always-approve 403、沒分類的動作、匯入的 team、關機的電腦、 phone_act 去空白、技能大小寫、支線的瀏覽器步驟、分享群組加成員);verify-anybot: autonomy 照新步驟跑(手機打 /always-approve 被擋、字放回輸入框,--ask 打開),另外 手機打 /yolo 被擋、status 照答、直接連線匯入帶 team:true 的檔案後新 Bot 沒分享、沒分類的 動作 400;branch、browser、profile、phone、market 照地圖跑。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address、 numbers_controls_inside_web_components、drives_a_dashboard,vault 的 fill_live——open 的 參數改了)要人在實機跑、簽名;帳號裡的電腦關機那條要帳號伺服器(只有單元測試);分享 群組要帳號(只有單元測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 12:09:52 +00:00
let all = kept.len() == every.len();
let Some(x) = self.state.bot_mut(bot) else { return fail("找不到這個 Bot") };
fix: 直接連線再補三個放寬的路:/always-approve、匯入帶團隊分享、關機的電腦被算進「每一台」 複審 36420f3 用測試證明的三個繞過,和幾個小的: 1. 在聊天打「/always-approve」(/yolo):直接連線的 api/bots/:id/send 從沒問過檢查, 擁有者身分就開了直接操作和一律放行。現在 remote.rs 在門口先看這句話是不是會放寬的 AnyBot 指令(commands.rs 的 AppCommand::loosens,每個指令都要列在其中一邊,新的指令 一定得決定),是就 403、什麼都不送;status、off 照常。只有門口知道是不是直接連線 (帳號那條路送進來的 Cmd 一模一樣),所以擋在那裡。順便:`--ask` 跑 AnyBot 自己的 指令(沒開一輪)以前結束碼是 1,現在是 0——地圖改在這台電腦上打「/always-approve」。 2. api/act/import_bot 帶著檔案裡的 team:true 就分享給團隊:share 的匯出不寫、匯入不收 team(也清 branch_of、branches),電腦版一樣;lan_guard 把每個 api/act 動作都列在 一邊,沒列到的一律 400,不再默默放行。 3. 可以用的電腦:帳號裡關機的電腦不在清單上,全勾就存成 None(每一台),被排除的那台 開機又能用。現在沒列出的電腦維持原狀,有清單的 Bot 從手機上不會變成「每一台」(帳號 那條路也一樣)。能力沒有這個問題:11 類永遠都列出來,None 只多出以後新版加的類別。 P2:支線的瀏覽器步驟指名 profile 只用在那一步(不再 set_current);支線換掉技能庫已有 技能的檢查跟寫資料夾一樣忽略大小寫;直接連線把 Bot 加進分享給團隊的群組算放寬 (phone_detail 多帶 team);SECURITY.md、account.md、autonomy.md 寫明打開「從手機看 這台電腦的螢幕並操作」時這個保證不成立;autonomy.md「手機用擁有者身分打也可以」改成 帳號連線才行。 P3:phone_act 照原字讀名字的那一半有自己的測試了。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(683 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);新的測試在放回 36420f3 的程式時都失敗(/always-approve 403、沒分類的動作、匯入的 team、關機的電腦、 phone_act 去空白、技能大小寫、支線的瀏覽器步驟、分享群組加成員);verify-anybot: autonomy 照新步驟跑(手機打 /always-approve 被擋、字放回輸入框,--ask 打開),另外 手機打 /yolo 被擋、status 照答、直接連線匯入帶 team:true 的檔案後新 Bot 沒分享、沒分類的 動作 400;branch、browser、profile、phone、market 照地圖跑。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address、 numbers_controls_inside_web_components、drives_a_dashboard,vault 的 fill_live——open 的 參數改了)要人在實機跑、簽名;帳號裡的電腦關機那條要帳號伺服器(只有單元測試);分享 群組要帳號(只有單元測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 12:09:52 +00:00
let list = match (key.as_str(), &x.computers) {
// 可以用的電腦 lists the computers there now: an account computer that is
// off isn't. One not listed keeps how it was, allowed or not, and a
// bot with a list keeps one — ticking every computer listed made it
// "every computer", and one the person had left out came back in.
("may_use", Some(prev)) => Some(kept.into_iter().chain(prev.iter().filter(|c| !every.contains(c)).cloned()).collect()),
_ if all => None,
_ => Some(kept),
};
match key.as_str() {
"abilities" => x.abilities = list,
"skills" => x.skills = list,
_ => {
// The computer it works on by default must be one it may use.
let chosen = x.default_computer.trim().to_string();
let allowed = chosen.is_empty() || chosen == crate::model::BOT_COMPUTER_NAME || chosen == crate::model::own_computer_name(&x.name) || list.as_ref().is_none_or(|l| l.contains(&chosen));
if !allowed {
x.default_computer = crate::model::BOT_COMPUTER_NAME.to_string();
}
x.computers = list
}
}
}
k => {
let Some(x) = self.state.bot_mut(bot) else { return fail("找不到這個 Bot") };
match k {
"strengths" if v.is_string() => x.strengths = v.as_str().unwrap_or("").trim().chars().take(400).collect(),
"not_for" if v.is_string() => x.not_for = v.as_str().unwrap_or("").trim().chars().take(400).collect(),
"unread" => x.unread = v.as_bool().unwrap_or(true),
"tools" => x.tools_enabled = v.as_bool().unwrap_or(true),
"shape" if v.as_str().map(|t| crate::avatar::SHAPES.contains(&t)).unwrap_or(false) => x.shape = v.as_str().unwrap_or("").to_string(),
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
// (A preset, or a colour of one's own as #rrggbb, as on the computer.)
"color" if v.as_str().map(|t| crate::avatar::COLORS.iter().any(|c| c.0 == t) || (t.len() == 7 && t.starts_with('#') && t[1..].chars().all(|c| c.is_ascii_hexdigit()))).unwrap_or(false) => x.color = v.as_str().unwrap_or("").to_lowercase(),
// 備用模型: tried in order when the main one fails (at most MAX_FALLBACKS).
"fallbacks" if v.is_array() => {
x.fallbacks = v.as_array().unwrap().iter().filter_map(|f| {
let provider = crate::providers::ALL_PROVIDERS.iter().copied().find(|k| serde_json::to_value(k).ok().as_ref() == Some(&f["provider"]))?;
let model = f["model"].as_str()?.trim().to_string();
(!model.is_empty()).then_some(crate::model::Fallback { provider, model })
}).take(crate::model::MAX_FALLBACKS).collect();
}
// 語音聊天 for this bot: read every answer aloud, its voice, speed and language.
"speak_replies" => x.speak_replies = v.as_bool().unwrap_or(false),
"voice" if v.is_string() => x.voice = v.as_str().unwrap_or("").trim().to_string(),
"voice_rate" if v.is_number() => x.voice_rate = (v.as_f64().unwrap_or(1.0) as f32).clamp(0.5, 2.0),
"voice_lang" if v.is_string() => x.voice_lang = v.as_str().unwrap_or("").trim().to_string(),
// 起始資料夾: where its files and commands start.
"workdir" if v.as_str().is_some_and(|w| !w.trim().is_empty()) => x.workdir = v.as_str().unwrap_or("").trim().to_string(),
"context" => x.context_tokens = v.as_u64().unwrap_or(x.context_tokens).clamp(4_000, 2_000_000),
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
"thinking" if v.as_str().is_some_and(|t| ["", "low", "medium", "high"].contains(&t)) => x.thinking = v.as_str().unwrap_or("").to_string(),
"step_model" if v.is_string() => x.step_model = v.as_str().unwrap_or("").trim().to_string(),
"allow_remove" => x.allow_rules.retain(|r| Some(r.as_str()) != v.as_str()),
_ => return fail("不認得這個設定"),
}
}
}
self.dirty = true;
done("好了")
}
"group_chat" => {
// 群組聊天, as the desktop's new-bot menu makes it.
let ids: Vec<u64> = b["members"].as_array().map(|a| a.iter().filter_map(|x| x.as_u64()).collect()).unwrap_or_default();
let members: Vec<u64> = ids.into_iter().filter(|i| self.state.bot(*i).map(|x| x.members.is_empty()).unwrap_or(false)).collect();
if members.is_empty() {
return fail("選至少一個 Bot 當成員");
}
let id = self.state.next_id;
let name = Some(s("name")).filter(|n| !n.is_empty()).unwrap_or_else(|| "群組聊天".into());
let sel = self.state.selected;
let out = appctl::apply(&mut self.state, sel, "create_bot", &json!({"name": name, "description": "成員依序回答"}).to_string());
if !out.ok {
return fail(&out.text);
}
if let Some(x) = self.state.bot_mut(id) {
x.members = members;
x.shape = "cloud".into();
}
self.dirty = true;
json!({"ok": true, "text": out.text, "bot": id})
}
"delete_bot" => {
if !owner {
return owner_only();
}
if self.state.bot(bot).is_none() {
return fail("找不到這個 Bot");
}
// As the desktop's 刪除 Bot dialog.
self.stop(bot);
/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(bot);
self.state.bots.retain(|x| x.id != bot);
self.state.fix_primary();
self.dirty = true;
done("已刪除")
}
"restart_bot" => {
if self.state.bot(bot).is_none() {
return fail("找不到這個 Bot");
}
self.restart_bot(bot);
done("已重新啟動")
}
"react" => {
let idx = b["index"].as_u64().unwrap_or(u64::MAX) as usize;
let emoji = s("emoji");
if emoji.is_empty() || emoji.chars().count() > 8 || self.state.bot(bot).map(|x| idx >= x.messages.len()).unwrap_or(true) {
return fail("找不到這則訊息");
}
self.toggle_reaction(bot, idx, &emoji);
done("好了")
}
"reply" => {
self.remote_cmd(ctx, Cmd::Reply { bot });
done("重新傳送中…")
}
A turn cut off by a crash leaves a 「繼續」 card, and nothing it may have done runs twice Each bot keeps a work log (oplog/bot-<id>.jsonl, after pi's durable-harness design, cut down): before something happens a line says it is about to — the turn, each model call, each step once its checks passed (with the arguments it runs with and whether it may run again), each message typed mid-turn — synced to disk first. When the turn ends the file shrinks to the messages still waiting, usually nothing. On the next start after AnyBot was killed mid-turn, the log puts the chat right before anything runs: the message the turn answered comes back if the chat lost it; a step that was running and reaches outside (a text, a click, a file, a published site) shows as 「可能已經執行了」, both to the person and in the result the bot reads — no longer as "not allowed"; a step that only looked shows as cut off; messages typed mid-turn that never reached the bot go back into the chat. The chat is saved, then the log closes the turn. A turn the person didn't stop ends with a 「繼續」 card (what it was doing, what may have run, the messages put back); it goes on only when they press it — in the window, on a screen of the brain, or on the phone — from where its steps stand, never running a step that may have run again. Pressing stop is on disk at once, and a stopped turn stays stopped. Also in the turn loop: - 自動審核 that doesn't answer (or answers something that isn't a verdict) asks the person; in 直接操作 mode it used to let the step through unchecked. - "Too long for this model" folds older messages into a summary and asks the same step again, once per thing the person said, instead of ending the turn. - Folding keeps the person's chat whole: the summary goes in at the fold and the model reads from the newest summary on (it used to delete what it folded). - A step moved to the chosen computer runs there, but the chat keeps the call as the model wrote it; the result says where it ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-08 16:49:12 +00:00
"resume" => {
self.remote_cmd(ctx, Cmd::Resume { bot });
done("繼續中…")
}
"clear" => {
self.remote_cmd(ctx, Cmd::Clear { bot });
done("已清除聊天記錄")
}
"delete_page" => {
let id = b["id"].as_u64().unwrap_or(0);
let before = self.state.pages.len();
self.state.pages.retain(|x| x.id != id);
if self.state.pages.len() == before {
return fail("這個頁面已經刪除了");
}
self.mark();
done("已刪除頁面")
}
// 設定 › 一般 / 權限 (the owner's).
"setting" => {
if !owner {
return owner_only();
}
let v = &b["value"];
fix: 直接連線真的只能收緊;Bot 的電腦和支線換不了瀏覽器設定檔;支線不動大家共用的東西 複審 f3ff553 找到的問題,加上直接連線全部設定的盤點: A. 直接連線用多一格空白繞過檢查:檢查照原字讀名字,大腦那邊(phone_act)卻先去掉空白 再做,「direct_mode 」「 rule_add」「abilities 」都過關、照做。現在兩邊都照原字讀: phone_act 的 key/list/op 不再 trim,規則清單只認 ask、allow(以前認不得的都當允許 清單);直接連線上名字不是 AnyBot 認得的一律 400「不認得這個設定」,什麼都不改。 盤點(remote::lan_guard,直接連線送來的每個 api/act):放寬的一律 403——打開直接操作、 打開自動審核、加允許規則、拿掉詢問規則、加連接器或把關掉的打開、打開訊息管道、打開 Bot 的電腦工具(沒帶值也算打開,跟 phone_act 一樣)、分享給團隊、勾回能力或可以用的 電腦、Bot 的電腦從 gVisor 換回標準;收緊的和不動權限的照做。卡片的允許/一律允許照舊 (那是回答眼前那張卡)。「只能收緊、不能放寬」現在是真的。 B. Bot 的電腦裡換瀏覽器設定檔是假的:在 box 裡 add 在大腦建資料夾、set_current 卻寫 「預設」蓋掉這台記著的選擇,Bot 還聽到「已新增並切換」。現在 box 裡新增、切換一律 回「Bot 的電腦上的瀏覽器只有一個設定檔…」,box 裡也不再寫這台的使用中設定檔(以前在 box 開網頁就把它改回「預設」)。 P2 設定檔名字:「阿金」不再模糊對到使用者的「阿金(Firefox)」:只換 AnyBot 自己同名的 設定檔(大小寫不算),其他名字新增全新的;使用者自己的瀏覽器(Firefox 設定檔、「你的 瀏覽器」)Bot 不能換過去——拒絕並請使用者在設定裡換(換了是每一步、每個 Bot 都用他的 登入;這個工具沒有卡片可問)。某一步指名用它也不會變成使用中。 P2 支線:create_bot、create_group、move_to_group、rename_group、delete_group、 delete_skill、skill_install(內建的也是)也擋;連接器、hook 改成只放行「看」的動作 (空白、大小寫都算改);瀏覽器 profiles 的新增、切換擋在步驟(BranchLimits); save_skill、skillify 不能換掉技能庫裡已有的同名技能(apply 裡 bot_id 早就換成主 Bot,改用原本的支線 id 判斷;save_skill 在寫資料夾之前就擋)。支線的系統提示和 changes_settings 的說明照實列出擋什麼。 P3 oplog::replay_of 不再把 browser_profiles 當只看的。 功能地圖:autonomy(子功能、步驟加直接連線拿掉詢問規則 403、多空白名字 400、打開自動 審核 403、state 確認)、account、profile、phone、branch(Bot 那一行、步驟加支線建 Bot、 換設定檔被擋、陷阱)、browser(子功能、Bot 那一行、步驟加換「你的瀏覽器」被擋); FEATURES.md、SECURITY.md 同步。工具定義不變;verify-approval-routing 沒有漂移。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(679 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);7 個新/改的測試在 放回舊程式時都失敗(含複審的繞過:「direct_mode 」照做);verify-anybot 照地圖跑 autonomy、branch、browser、profile、market、phone、channels、connectors 的步驟。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 要人在實機跑、簽名;Bot 的電腦裡的瀏覽器(要 Docker);使用者真的 Firefox 設定檔(scratch 沒有);帳號連線那條路(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 11:36:07 +00:00
let key = name_of("key");
match key.as_str() {
"direct_mode" => {
if v.as_bool().unwrap_or(false) {
self.enable_direct_mode()
} else {
self.disable_direct_mode()
}
}
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
// 智慧模式 is always on (smart.rs): nothing to switch from a phone.
智慧模式 (/smart): 一问一决定,不是一步一卡 询问和一律放行中间的设定(CLAUDE.md 改善轮迴的第一块:聊天卡顿的主因是一步一卡)。 - 卡片多一个「这轮都准」: 同类操作这一轮只问一次(Job 就是一轮,按构造就是 per-turn; 下一轮会再问)。grant 非空的 Action 卡与连接器卡有这按钮;must-ask(付款/传送/删除的 点击、你的屏幕和 App、保险库、一律询问规则、hook)没有,也不被覆盖。 - 卡片逾时: 你几分钟没回,卡片自己回答——看档案/上网这类先做(步骤结果里写明),敏感操作 自动拒绝并告诉 Bot 别重试。/smart 中途开关都即时(窗口一个 Arc,Job 共享)。 - 审核缓存: 自动审核的模型判决这一轮按(规则,动作)缓存,重复同一步不再每次付 10–20 秒; 审查看不见档案全文时照旧自己问(没动)。 - 开关: /smart(/smart off、status)、设定›权限(滑块调时限,默认 300 秒)、输入列旁图标。 手机/远端只能关不能开(words_loosen + remote setting 只收紧);untrusted 回合永不智慧。 - 锁: 管理员锁住直接操作/本地执行时,智慧模式一起锁。 - feature-map: chat.md / safety.md / autonomy.md / settings.md 同步(featuremap 测试绿)。 已验证: cargo test 全绿 716(含 featuremap::、layout_audit::、approval/tool 锁未动) 未验证: 实机批准卡路径(新按钮、逾时行为)需人类实机点测并签名(CLAUDE.md 审批准则)
2026-11-19 06:59:29 +00:00
"smart_mode" => {
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 !v.as_bool().unwrap_or(true) {
return fail(crate::smart::OFF_NOTE);
智慧模式 (/smart): 一问一决定,不是一步一卡 询问和一律放行中间的设定(CLAUDE.md 改善轮迴的第一块:聊天卡顿的主因是一步一卡)。 - 卡片多一个「这轮都准」: 同类操作这一轮只问一次(Job 就是一轮,按构造就是 per-turn; 下一轮会再问)。grant 非空的 Action 卡与连接器卡有这按钮;must-ask(付款/传送/删除的 点击、你的屏幕和 App、保险库、一律询问规则、hook)没有,也不被覆盖。 - 卡片逾时: 你几分钟没回,卡片自己回答——看档案/上网这类先做(步骤结果里写明),敏感操作 自动拒绝并告诉 Bot 别重试。/smart 中途开关都即时(窗口一个 Arc,Job 共享)。 - 审核缓存: 自动审核的模型判决这一轮按(规则,动作)缓存,重复同一步不再每次付 10–20 秒; 审查看不见档案全文时照旧自己问(没动)。 - 开关: /smart(/smart off、status)、设定›权限(滑块调时限,默认 300 秒)、输入列旁图标。 手机/远端只能关不能开(words_loosen + remote setting 只收紧);untrusted 回合永不智慧。 - 锁: 管理员锁住直接操作/本地执行时,智慧模式一起锁。 - feature-map: chat.md / safety.md / autonomy.md / settings.md 同步(featuremap 测试绿)。 已验证: cargo test 全绿 716(含 featuremap::、layout_audit::、approval/tool 锁未动) 未验证: 实机批准卡路径(新按钮、逾时行为)需人类实机点测并签名(CLAUDE.md 审批准则)
2026-11-19 06:59:29 +00:00
}
}
"auto_review" => self.state.auto_review = v.as_bool().unwrap_or(false),
"notify" => self.state.notify = v.as_bool().unwrap_or(true),
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
// 一律放行 as the chat's /always-approve does it (direct mode with it, and back).
"always_approve" => {
let on = v.as_bool().unwrap_or(false);
if on && !(self.managed.direct.allows() && self.managed.local.allows()) {
return fail(crate::always::LOCKED_NOTE);
}
let bot = if self.state.bot(self.state.primary_bot).is_some() { self.state.primary_bot } else { self.state.selected };
self.always_command(ctx, bot, if on { crate::always::Command::On } else { crate::always::Command::Off });
return done(if on { "一律放行:開" } else { "一律放行:關" });
}
"smart_timeout_secs" => self.state.smart_timeout_secs = v.as_u64().unwrap_or(0).min(3600),
"auto_update" => self.state.auto_update_when_away = v.as_bool().unwrap_or(true),
"garden_reports" => self.state.garden_reports = v.as_bool().unwrap_or(true),
"embed" => {
self.state.embed_model = match v.as_str().unwrap_or("") {
"off" => "off".into(),
"ollama" => "ollama".into(),
_ => String::new(),
};
crate::embed::configure(&crate::embed::ollama_base(&self.state.provider(crate::providers::ProviderKind::Ollama).base_url), &self.state.embed_model);
}
"doc_folder_add" | "doc_folder_remove" => {
let f = v.as_str().unwrap_or("").trim().to_string();
if f.is_empty() {
return fail("資料夾是空的");
}
if key == "doc_folder_add" {
if !self.state.doc_folders.contains(&f) {
self.state.doc_folders.push(f);
}
} else {
self.state.doc_folders.retain(|x| *x != f);
}
*DOC_FOLDERS.write().unwrap_or_else(|e| e.into_inner()) = self.state.doc_folders.clone();
}
"rule_add" | "rule_remove" => {
let text = v.as_str().unwrap_or("").trim().to_string();
fix: 直接連線真的只能收緊;Bot 的電腦和支線換不了瀏覽器設定檔;支線不動大家共用的東西 複審 f3ff553 找到的問題,加上直接連線全部設定的盤點: A. 直接連線用多一格空白繞過檢查:檢查照原字讀名字,大腦那邊(phone_act)卻先去掉空白 再做,「direct_mode 」「 rule_add」「abilities 」都過關、照做。現在兩邊都照原字讀: phone_act 的 key/list/op 不再 trim,規則清單只認 ask、allow(以前認不得的都當允許 清單);直接連線上名字不是 AnyBot 認得的一律 400「不認得這個設定」,什麼都不改。 盤點(remote::lan_guard,直接連線送來的每個 api/act):放寬的一律 403——打開直接操作、 打開自動審核、加允許規則、拿掉詢問規則、加連接器或把關掉的打開、打開訊息管道、打開 Bot 的電腦工具(沒帶值也算打開,跟 phone_act 一樣)、分享給團隊、勾回能力或可以用的 電腦、Bot 的電腦從 gVisor 換回標準;收緊的和不動權限的照做。卡片的允許/一律允許照舊 (那是回答眼前那張卡)。「只能收緊、不能放寬」現在是真的。 B. Bot 的電腦裡換瀏覽器設定檔是假的:在 box 裡 add 在大腦建資料夾、set_current 卻寫 「預設」蓋掉這台記著的選擇,Bot 還聽到「已新增並切換」。現在 box 裡新增、切換一律 回「Bot 的電腦上的瀏覽器只有一個設定檔…」,box 裡也不再寫這台的使用中設定檔(以前在 box 開網頁就把它改回「預設」)。 P2 設定檔名字:「阿金」不再模糊對到使用者的「阿金(Firefox)」:只換 AnyBot 自己同名的 設定檔(大小寫不算),其他名字新增全新的;使用者自己的瀏覽器(Firefox 設定檔、「你的 瀏覽器」)Bot 不能換過去——拒絕並請使用者在設定裡換(換了是每一步、每個 Bot 都用他的 登入;這個工具沒有卡片可問)。某一步指名用它也不會變成使用中。 P2 支線:create_bot、create_group、move_to_group、rename_group、delete_group、 delete_skill、skill_install(內建的也是)也擋;連接器、hook 改成只放行「看」的動作 (空白、大小寫都算改);瀏覽器 profiles 的新增、切換擋在步驟(BranchLimits); save_skill、skillify 不能換掉技能庫裡已有的同名技能(apply 裡 bot_id 早就換成主 Bot,改用原本的支線 id 判斷;save_skill 在寫資料夾之前就擋)。支線的系統提示和 changes_settings 的說明照實列出擋什麼。 P3 oplog::replay_of 不再把 browser_profiles 當只看的。 功能地圖:autonomy(子功能、步驟加直接連線拿掉詢問規則 403、多空白名字 400、打開自動 審核 403、state 確認)、account、profile、phone、branch(Bot 那一行、步驟加支線建 Bot、 換設定檔被擋、陷阱)、browser(子功能、Bot 那一行、步驟加換「你的瀏覽器」被擋); FEATURES.md、SECURITY.md 同步。工具定義不變;verify-approval-routing 沒有漂移。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(679 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);7 個新/改的測試在 放回舊程式時都失敗(含複審的繞過:「direct_mode 」照做);verify-anybot 照地圖跑 autonomy、branch、browser、profile、market、phone、channels、connectors 的步驟。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 要人在實機跑、簽名;Bot 的電腦裡的瀏覽器(要 Docker);使用者真的 Firefox 設定檔(scratch 沒有);帳號連線那條路(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 11:36:07 +00:00
// (Any list but 「ask」 used to be the allow list.)
let list = match name_of("list").as_str() {
"ask" => &mut self.state.review_ask_rules,
"allow" => &mut self.state.review_allow_rules,
_ => return fail("不認得這個規則清單"),
};
if key == "rule_add" {
if text.is_empty() {
return fail("規則是空的");
}
fix: 網址照瀏覽器的讀法比對(web(domain:…)、內部網址卡);審核員只讀兩端時照樣問;上傳的開關卡不給審核省掉 第三輪審查(6a6d905..4303646)的四個 P1,加上能收的 P2。 P1-1 `web(domain:…)` 比對的不是瀏覽器打開的那個網站:gate.rs 自己切網址,`me@example.com`、 `example.com.`、`example.com\cart`、`browser_tabs` 帶網址開新分頁都對不上(0 張卡)。 P1-2 同一個根:web.rs 的 normalize_url/host_port 用 rsplit('@')、不把 `\` 當 `/`, `http://127.0.0.1\@a.com/`、`http://192.168.1.1\.example.com/` 被當成公開網址,內部網址卡不跳。 修法:web::parse_url 用 WHATWG 的 `url` crate(Cargo.lock 本來就有,改成直接依賴)——`\` 是 `/`、 帳號@ 不是主機、小寫、punycode、結尾的點、各種寫法的 IP;normalize_url、host_port、web::host_of 都用它, gate 的 web(…) 用 host_of 比主機(規則的網域也同樣讀),比對清單加上 browser_tabs 帶網址。 InBotsBrowser 把解析過的網址交給瀏覽器(open、新分頁、web_fetch),檢查的就是打開的;web_fetch 轉址的每一站也照解析過的去要。地圖寫清楚:只比對用網址打開或讀的那一步,點連結、轉址、上一頁不算。 P1-3 審核員只讀長參數的兩端:模型可以把要擋的東西塞在中間,審核員說允許就不跳卡片。修法:參數被截過、 而且這一步真的給模型看了(model_reads,跟 review_action 一樣的判斷)時,審核員的允許、直接操作下的 「都不符合」都改成跳卡片:「參數很長,自動審核只讀了開頭和結尾,所以先問你」(沒有直接操作時照舊可以 一律允許,跟審核失敗一樣)。選這個而不是把上限拉高:上限拉多高,中間都還是可能藏東西。 P1-4 從這台上傳檔案、電腦工具或「在這台電腦上執行」沒開時,那張卡被送進 reviewed(),允許規則就省掉了。 修法:抽成 here_upload_decision——開關沒開的那張卡(工作資料夾內外都是)一律跳、不給審核,別的 yes (樣式卡的允許)也省不掉它;開關開著才照檔案規則和 reviewed()。 P2: - browser.md 的陷阱和自動審核說的對齊(本機網址:一律允許、直接操作、自動審核的允許都可以不問, 「一律詢問」照樣問)。 - 「對不上任何東西」的提醒(gate::rule_warning)擴到 web(…)(沒寫 domain:、用 *、寫了 https:// 或路徑、 不是網站)和 tool(…)(不是哪一步的名字,例如 tool(browser) 要寫 tool(browser_*));featuremap 的 every_tool 搬出測試,提醒用同一份工具清單。 - hook 的「ask」跟瀏覽器的樣式卡放在同一張(run_call 的通用 hook 詢問不再管 InBotsBrowser)。 沒改,記著(略過樣式規則的路):伺服器大腦上的 open_for_person、/goal 評審自己呼叫的 web_fetch、 在使用者自己的瀏覽器 browser_open(OnComputer,不用問的不比對)、別人傳來的訊息那一輪的 web_fetch (沒有自動審核)。vault.rs 的 host_of 也是自己切網址,沒動。沒碰 src/remote.rs、src/botbrowser.rs。 特性表 connector_decisions_are_characterized 多 20 列(38 → 58):審核員說允許、長參數 × 審核員允許/ 都不符合/允許樣式/詢問樣式。tool_specs_are_locked、approval_decisions_are_characterized 沒有 diff。 已驗證: 全部 cargo test 686 通過(不帶金鑰、DOCKER_HOST 指到不存在、ANYBOT_VAULT_KEY_FILE 放暫存、 PATH 前面放假的 security 記下每次呼叫:這次 0 次);把四個修法和 hook 合併各自改回去, addresses_are_read_as_a_browser_reads_them、pattern_rules_decide_before_the_model、an_ask_pattern_stops_the_bots_browser、 connector_decisions_are_characterized、an_upload_with_the_switches_off_always_asks、 a_hook_ask_and_a_rule_make_one_card_for_a_browser_step 都失敗,改回來都過;clippy -D warnings、lint-sh、 verify-approval-routing run.sh --replay(跟基準一樣);verify-anybot:browser 每一步可跑的照 md 原文冷跑全過 (target/verify-anybot/20261118-200336:「在瀏覽器打開 http://127.0.0.1/@a.com/(符合你的「一律詢問」規則: web(domain:127.0.0.1))」,192.168.1.5\.example.com 跳內部網址卡、先給審核員看;全部拒絕、沒有開瀏覽器) 未驗證: 真的瀏覽器打開解析過的網址(scratch 沒有 Docker,這台開會出現真的瀏覽器);直接操作那一半的實機; 電腦設定頁提醒那一行的樣子;--ignored 的瀏覽器實機測試(清單見 4303646) 未簽: 審批路徑、瀏覽器——要人類跑 --ignored 並簽名才能合併,沒有合併、沒有推 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 12:06:35 +00:00
let unknown = crate::gate::rule_warning(&text, &self.state.mcp_servers);
if !list.contains(&text) {
list.push(text);
}
fix: 連接器「一律允許」過也照樣式的「一律詢問」問;審核員讀參數有上限;hook 和規則同一張卡 使用者的決定:樣式寫的「一律詢問」(`connector(…)`,只比對、不問模型)蓋過連接器的「一律允許」。 以前 `mcp:slack` 一律允許過,`connector(slack__post_message)` 就擋不住。現在: - steps.rs 的 connector_decision(連接器一步的第 6–8 關,一個地方):先比對「一律詢問」樣式—— 符合就跳卡片寫那條規則、沒有「一律允許」(一律允許過、直接操作開著都一樣);再看一律允許; 其他照舊交給 reviewed()(自動審核/直接操作)。 - 用一般的話寫的規則不看一律允許過的連接器(使用者選的:不要每一步都問模型);地圖、FEATURES、 SECURITY 照實寫:直接操作的三條預設擋不住一律允許過的連接器,要擋就寫成樣式。以前的一律允許照樣有效。 - 一律放行、自動審核關著:不比對(跟其他步驟一樣)。 審查的 P2 一起改: - 審核員讀的參數有上限:4000 字以內全部,更長的給前 3000、後 1000,中間寫省略了幾字 (整段塞進去會撐爆模型的上下文、審核失敗);卡片照舊前 160 字。 - hook 的「ask」跟規則放在同一張卡(以前 run_call 先問一張、Connector 再問一張);run_call 的 通用 hook 詢問不再管 Connector。 - 新增 `connector(…)` 規則對不上任何連接器的工具(顯示名稱、大小寫、中文名稱的代號、64 字截斷) 時說出來:mcp::rule_names_nothing;電腦的設定頁在那條規則下面寫,手機新增時跳「已新增。不過…」。 Bot 沒有能加規則的工具,不用改。 - 地圖的用字:autonomy-still-asks、autonomy-review、autonomy-patterns 寫出一律允許過的例外; connectors 的陷阱不再一句寫「直接操作不問」又寫「直接操作也一樣」。 - connectors 加真的步驟「一律允許也照樣式問」;autonomy 原本的連接器步驟搬過去(autonomy 快到 9,000 字),autonomy 留走不到的步驟指過去。 特性表(新的 connector_decisions_are_characterized,38 列):一律允許 有/無 × 直接操作 有/無 × 規則(關著、詢問樣式、允許樣式、兩種樣式、別的連接器的樣式、話寫的規則〔審核員說詢問/都不符合/ 答不出來〕、允許樣式+話寫的詢問),加上 hook 兩列;每列寫 Allow/Allow+note/Ask[一律允許會記的] 和原因、問了模型幾次。tool_specs_are_locked、approval_decisions_are_characterized 沒有 diff。 沒改 remote.rs(loosens_guard 沒碰)。 已驗證: 全部 cargo test(不帶金鑰、DOCKER_HOST 指到不存在)679 通過;新的 an_ask_pattern_wins_over_a_connectors_grant、 a_hook_ask_and_a_rule_make_one_card_for_a_connector_step 在改之前失敗(一律允許過照跑、兩張卡), a_failed_review_asks_about_a_connector_step、the_reviewer_reads_a_huge_argument_by_its_ends、 a_connector_rule_that_names_nothing_is_said_so、connector_decisions_are_characterized、phone 的 rule_add 提醒; clippy -D warnings、lint-sh、verify-approval-routing run.sh --replay(跟基準一樣); verify-anybot:connectors 每一步可跑的照 md 原文冷跑全過(target/verify-anybot/20261118-180143: 打錯大小寫的規則跳提醒、一律允許過的 e0 照樣跳卡片、只有允許/拒絕,allow_rules 還是 ["mcp:echo"]), autonomy 也全過(-180216) 未驗證: 電腦設定頁那行提醒的樣子(要開視窗);直接操作那一半的實機(區網的手機打不開,用 app 層測試); --ignored 的實機測試 未簽: 審批路徑——要人類簽名才能合併,沒有合併、沒有推 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 11:18:38 +00:00
self.dirty = true;
return done(&unknown.map(|w| format!("已新增。不過{w}")).unwrap_or_else(|| "已新增".into()));
} else {
list.retain(|r| *r != text);
}
}
_ => return fail("不認得這個設定"),
}
self.dirty = true;
done("好了")
}
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
// 設定 › 語音 from the phone: 聽 or 說's service, its address, key (written, never read
// back), model and (說) voice.
"voice" => {
if !owner {
return owner_only();
}
let mut v = self.state.voice.clone();
let e = match b["which"].as_str() {
Some("listen") => &mut v.listen,
Some("speak") => &mut v.speak,
_ => return fail("要說是「聽」還是「說」"),
};
if let Some(k) = b["kind"].as_str() {
e.kind = match serde_json::from_value(json!(k)) {
Ok(k) => k,
Err(_) => return fail("不認得這個語音服務"),
};
}
for (field, slot) in [("base_url", &mut e.base_url), ("api_key", &mut e.api_key), ("model", &mut e.model), ("voice", &mut e.voice)] {
if let Some(x) = b[field].as_str() {
*slot = x.trim().to_string();
}
}
v.saved = true;
self.state.voice = v;
self.mark();
done("好了")
}
// 設定 › 模型: a provider's key (written, never read back) and new bots' model.
"provider" => {
if !owner {
return owner_only();
}
let Some(kind) = crate::providers::ALL_PROVIDERS.iter().copied().find(|k| serde_json::to_value(k).ok().as_ref() == Some(&b["provider"])) else { return fail("不認得這個模型服務") };
let ps = self.state.providers.entry(kind.key().to_string()).or_default();
if let Some(k) = b["key"].as_str() {
ps.api_key = k.trim().to_string();
}
if let Some(m) = b["default_model"].as_str() {
ps.default_model = m.trim().to_string();
}
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
// 服務網址 (empty: the service's own) and 看不到圖時請雲端模型看 (a local model's).
if let Some(u) = b["base_url"].as_str() {
ps.base_url = u.trim().to_string();
}
if let Some(on) = b["cloud_eyes"].as_bool() {
ps.cloud_eyes = on;
}
self.dirty = true;
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
// 測試連線並取得模型清單: asked on its own thread; the page reads how it went.
if b["fetch"].as_bool() == Some(true) {
self.fetch_models(kind);
return done("正在測試連線…");
}
done("好了")
}
// 手機與帳號: sign a direct-connection phone out (as the desktop's list does).
"device_remove" => {
if !owner {
return owner_only();
}
let (name, created) = (s("name"), b["created"].as_i64().unwrap_or(0));
let before = self.state.remote.devices.len();
self.state.remote.devices.retain(|d| !(d.name == name && d.created == created));
if self.state.remote.devices.len() == before {
return fail("找不到這支手機");
}
self.dirty = true;
done("已登出那支手機")
}
"channel" => {
if !owner {
return owner_only();
}
let id = b["id"].as_u64().unwrap_or(0);
if !self.state.channels.iter().any(|c| c.id == id) {
return fail("找不到這個管道");
}
if b["remove"].as_bool().unwrap_or(false) {
self.state.channels.retain(|c| c.id != id);
} else if let Some(c) = self.state.channels.iter_mut().find(|c| c.id == id) {
c.enabled = b["enabled"].as_bool().unwrap_or(c.enabled);
}
self.dirty = true;
self.channels_restart(ctx);
done("好了")
}
"mcp" => {
if !owner {
return owner_only();
}
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone - 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API): servers reached by address only (a package would have to run on the brain, which may have no Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name that only says "mcp" (com.notion/mcp) reads as whose it is (notion). - 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown unmasked with what to put there (the key's description, an address variable's choices). 新增 stays off while a 「{…}」 is left. - The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key or the address part and the brain adds it (the 「mcp」 action's new `add`). - A server that answers 401 (or a 403 asking for a login) with no key given now says it signs people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old. - mcpservers.org and the like are pages for people behind a browser check, with no list a program may read, so the market uses the registry. - Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`. - Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
// From the phone's 公用市集: a server reached by address, with its key filled in.
if b["add"].is_object() {
let a = &b["add"];
let (url, header) = (a["url"].as_str().unwrap_or("").trim(), a["header"].as_str().unwrap_or("").trim());
if !(url.starts_with("https://") || url.starts_with("http://")) {
return fail("連接器要有網址");
}
if url.contains('{') || header.contains('{') {
return fail("還有「{…}」沒換成你的值");
}
let name = crate::mcp::free_name(a["name"].as_str().filter(|n| !n.trim().is_empty()).unwrap_or("連接器"), &self.state.mcp_servers);
self.state.mcp_servers.push(crate::mcp::remote_server(&name, url, header));
self.dirty = true;
return done(&format!("已加入連接器「{name}」"));
}
let name = s("name");
if !self.state.mcp_servers.iter().any(|m| m.name == name) {
return fail("找不到這個連接器");
}
if b["reconnect"].as_bool().unwrap_or(false) {
self.mcp_reconnect(&name);
return done("重新連線中…");
}
// Renamed (from a screen): this entry keeps its keys, its place and its sign-in.
if let Some(new) = b["rename"].as_str().map(str::trim) {
if new.is_empty() || self.state.mcp_servers.iter().any(|m| m.name == new) {
return fail("名稱不能空白,也不能跟別的連接器一樣");
}
if let Some(m) = self.state.mcp_servers.iter_mut().find(|m| m.name == name) {
m.name = new.to_string();
}
crate::mcp_oauth::rename(&name, new);
self.ch.mcp_errors.lock().unwrap().retain(|e| e.0 != name);
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
self.move_mcp_grants(&name, new);
self.dirty = true;
return done("好了");
}
// (mcp_poll connects or drops it when the list changes.)
if b["remove"].as_bool().unwrap_or(false) {
self.state.mcp_servers.retain(|m| m.name != name);
self.forget_mcp_grants(&name);
} else if let Some(m) = self.state.mcp_servers.iter_mut().find(|m| m.name == name) {
m.enabled = b["enabled"].as_bool().unwrap_or(m.enabled);
}
self.dirty = true;
done("好了")
}
2026-11-11 08:19:06 +00:00
"skill" => {
if !owner {
return owner_only();
}
if let Some(slug) = b["builtin"].as_str().filter(|s| !s.trim().is_empty()) {
return match crate::skills::install_builtin(slug, &mut self.state.skills) {
Ok(name) => {
self.dirty = true;
done(&format!("已加入技能「{name}」"))
}
Err(e) => fail(&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
// From a screen (設定 › 整合 on a computer showing this brain): a GitHub or web
// address is fetched here, and a folder on that computer arrives whole — the
// bots read skills from this disk.
if let Some(src) = b["install"].as_str().filter(|s| !s.trim().is_empty()) {
return match crate::skills::install_from_source(src) {
Ok(name) => {
crate::memory::merge_skill_files(&mut self.state.skills);
self.dirty = true;
done(&format!("已安裝技能「{name}」"))
}
Err(e) => fail(&e),
};
}
if b["package"].is_object() {
return match crate::skills::install_package(&b["package"]) {
Ok(k) => {
let name = k.name.clone();
crate::memory::upsert_skill(&mut self.state.skills, k);
self.dirty = true;
done(&format!("已安裝技能「{name}」"))
}
Err(e) => fail(&e),
};
}
2026-11-11 08:19:06 +00:00
let name = s("name");
if !self.state.skills.iter().any(|k| k.name == name) {
return fail("找不到這個技能");
}
if b["remove"].as_bool().unwrap_or(false) {
self.state.skills.retain(|k| k.name != name);
crate::memory::remove_skill_files(&name);
} else if let Some(k) = self.state.skills.iter_mut().find(|k| k.name == name) {
k.enabled = b["enabled"].as_bool().unwrap_or(k.enabled);
}
self.dirty = true;
done("好了")
}
// 設定 › 電腦's buttons for Bot 的電腦.
"box" => {
fix: 直接連線真的只能收緊;Bot 的電腦和支線換不了瀏覽器設定檔;支線不動大家共用的東西 複審 f3ff553 找到的問題,加上直接連線全部設定的盤點: A. 直接連線用多一格空白繞過檢查:檢查照原字讀名字,大腦那邊(phone_act)卻先去掉空白 再做,「direct_mode 」「 rule_add」「abilities 」都過關、照做。現在兩邊都照原字讀: phone_act 的 key/list/op 不再 trim,規則清單只認 ask、allow(以前認不得的都當允許 清單);直接連線上名字不是 AnyBot 認得的一律 400「不認得這個設定」,什麼都不改。 盤點(remote::lan_guard,直接連線送來的每個 api/act):放寬的一律 403——打開直接操作、 打開自動審核、加允許規則、拿掉詢問規則、加連接器或把關掉的打開、打開訊息管道、打開 Bot 的電腦工具(沒帶值也算打開,跟 phone_act 一樣)、分享給團隊、勾回能力或可以用的 電腦、Bot 的電腦從 gVisor 換回標準;收緊的和不動權限的照做。卡片的允許/一律允許照舊 (那是回答眼前那張卡)。「只能收緊、不能放寬」現在是真的。 B. Bot 的電腦裡換瀏覽器設定檔是假的:在 box 裡 add 在大腦建資料夾、set_current 卻寫 「預設」蓋掉這台記著的選擇,Bot 還聽到「已新增並切換」。現在 box 裡新增、切換一律 回「Bot 的電腦上的瀏覽器只有一個設定檔…」,box 裡也不再寫這台的使用中設定檔(以前在 box 開網頁就把它改回「預設」)。 P2 設定檔名字:「阿金」不再模糊對到使用者的「阿金(Firefox)」:只換 AnyBot 自己同名的 設定檔(大小寫不算),其他名字新增全新的;使用者自己的瀏覽器(Firefox 設定檔、「你的 瀏覽器」)Bot 不能換過去——拒絕並請使用者在設定裡換(換了是每一步、每個 Bot 都用他的 登入;這個工具沒有卡片可問)。某一步指名用它也不會變成使用中。 P2 支線:create_bot、create_group、move_to_group、rename_group、delete_group、 delete_skill、skill_install(內建的也是)也擋;連接器、hook 改成只放行「看」的動作 (空白、大小寫都算改);瀏覽器 profiles 的新增、切換擋在步驟(BranchLimits); save_skill、skillify 不能換掉技能庫裡已有的同名技能(apply 裡 bot_id 早就換成主 Bot,改用原本的支線 id 判斷;save_skill 在寫資料夾之前就擋)。支線的系統提示和 changes_settings 的說明照實列出擋什麼。 P3 oplog::replay_of 不再把 browser_profiles 當只看的。 功能地圖:autonomy(子功能、步驟加直接連線拿掉詢問規則 403、多空白名字 400、打開自動 審核 403、state 確認)、account、profile、phone、branch(Bot 那一行、步驟加支線建 Bot、 換設定檔被擋、陷阱)、browser(子功能、Bot 那一行、步驟加換「你的瀏覽器」被擋); FEATURES.md、SECURITY.md 同步。工具定義不變;verify-approval-routing 沒有漂移。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(679 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);7 個新/改的測試在 放回舊程式時都失敗(含複審的繞過:「direct_mode 」照做);verify-anybot 照地圖跑 autonomy、branch、browser、profile、market、phone、channels、connectors 的步驟。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 要人在實機跑、簽名;Bot 的電腦裡的瀏覽器(要 Docker);使用者真的 Firefox 設定檔(scratch 沒有);帳號連線那條路(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 11:36:07 +00:00
let op = name_of("op");
if matches!(op.as_str(), "update" | "reset" | "runtime" | "auto_update") && !owner {
return owner_only();
}
match op.as_str() {
"wake" => self.box_task(|| crate::cloudbox::ensure_running().map(|_| "Bot 的電腦已經開好了。".to_string())),
"snapshot" => self.box_task(|| crate::cloudbox::save_snapshot().map(|n| format!("已儲存快照({})。", crate::cloudbox::human(n)))),
"disk" => {
let slot = self.cu.disk.clone();
*slot.lock().unwrap() = Some("檢查中…".into());
std::thread::spawn(move || {
let r = crate::cloudbox::disk_report().unwrap_or_else(|e| e);
*slot.lock().unwrap() = Some(r);
});
}
"update" => {
// As the desktop's 更新: the bots stop first, the files and logins stay.
let ids: Vec<u64> = self.streams.keys().copied().collect();
for id in ids {
self.stop(id);
}
*self.cu.note.lock().unwrap() = match crate::cloudbox::rebuild(crate::cloudbox::Rebuild::Update) {
Ok(()) => t("更新已開始。"),
Err(e) => e,
};
}
"reset" => {
// As the desktop's 重設: back to the last snapshot (the current box saved
// first), or a brand-new computer when there is none.
let ids: Vec<u64> = self.streams.keys().copied().collect();
for id in ids {
self.stop(id);
}
let kind = if crate::cloudbox::snapshot_time().is_some() { crate::cloudbox::Rebuild::Restore } else { crate::cloudbox::Rebuild::Reset };
*self.cu.note.lock().unwrap() = match crate::cloudbox::rebuild(kind) {
Ok(()) => t("已開始。"),
Err(e) => e,
};
}
"runtime" => crate::cloudbox::set_box_runtime(&s("value")),
"auto_update" => {
let at = s("value");
if !at.is_empty() && chrono::NaiveTime::parse_from_str(&at, "%H:%M").is_err() {
return fail("時間要寫成 HH:MM");
}
crate::cloudbox::set_auto_update_at((!at.is_empty()).then_some(at));
}
_ => return fail("不認得這個動作"),
}
*BOX_FACTS.lock().unwrap_or_else(|e| e.into_inner()) = None;
done("好了")
}
_ => fail("沒有這個動作"),
}
}
/// A bot as its editor and the panel beside the chat show it.
安全、修正: 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 phone_detail(&self, b: &Bot, owner: bool) -> serde_json::Value {
let names: HashMap<u64, String> = self.state.bots.iter().map(|x| (x.id, x.name.clone())).collect();
let (choices, chosen) = self.computer_choices(b);
let trig = crate::triggers::statuses().lock().unwrap().clone();
// 資料庫: the chat's files, newest first (pictures and documents the person or the bot sent).
let mut files: Vec<serde_json::Value> = vec![];
for m in b.messages.iter().rev() {
for a in &m.attachments {
if files.len() < 80 {
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
files.push(json!({"name": a.name, "path": a.path, "image": a.image, "bytes": a.bytes, "kind": crate::preview::kind_label(&a.name), "at": m.at, "mine": m.role == Role::User}));
}
}
}
json!({
"id": b.id, "name": b.name, "description": b.description, "instructions": b.instructions,
"shape": b.shape, "color": b.color, "provider": serde_json::to_value(b.provider).unwrap_or_default(), "model": b.model,
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
"thinking": b.thinking, "step_model": b.step_model,
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
"fallbacks": b.fallbacks.iter().map(|f| json!({"provider": serde_json::to_value(f.provider).unwrap_or_default(), "model": f.model, "label": f.provider.label()})).collect::<Vec<_>>(),
"workdir": b.workdir,
"speak_replies": b.speak_replies, "voice": b.voice, "voice_rate": b.voice_rate, "voice_lang": b.voice_lang,
// 個人檔案 (each list: every choice there is, and whether this bot has it).
"strengths": b.strengths, "not_for": b.not_for,
"abilities": crate::profile::ABILITIES.iter().map(|(k, label, what)| json!({"key": k, "name": label, "note": what, "on": b.abilities.as_ref().is_none_or(|a| a.iter().any(|x| x == k))})).collect::<Vec<_>>(),
"skills": self.state.skills.iter().filter(|k| k.enabled).map(|k| json!({"key": k.name, "name": k.name, "note": k.description, "on": b.skills.as_ref().is_none_or(|a| a.contains(&k.name))})).collect::<Vec<_>>(),
"may_use": self.every_computer(b).into_iter().enumerate().map(|(i, (name, kind))| json!({"key": name, "name": name, "note": kind, "on": i == 0 || b.computers.as_ref().is_none_or(|a| a.contains(&name)), "fixed": i == 0})).collect::<Vec<_>>(),
"computer": chosen, "computers": choices.iter().map(|(name, note)| json!({"name": name, "note": note})).collect::<Vec<_>>(),
"tools_enabled": b.tools_enabled, "context_tokens": b.context_tokens, "folder": b.folder, "pinned": b.pinned,
fix: 直接連線再補三個放寬的路:/always-approve、匯入帶團隊分享、關機的電腦被算進「每一台」 複審 36420f3 用測試證明的三個繞過,和幾個小的: 1. 在聊天打「/always-approve」(/yolo):直接連線的 api/bots/:id/send 從沒問過檢查, 擁有者身分就開了直接操作和一律放行。現在 remote.rs 在門口先看這句話是不是會放寬的 AnyBot 指令(commands.rs 的 AppCommand::loosens,每個指令都要列在其中一邊,新的指令 一定得決定),是就 403、什麼都不送;status、off 照常。只有門口知道是不是直接連線 (帳號那條路送進來的 Cmd 一模一樣),所以擋在那裡。順便:`--ask` 跑 AnyBot 自己的 指令(沒開一輪)以前結束碼是 1,現在是 0——地圖改在這台電腦上打「/always-approve」。 2. api/act/import_bot 帶著檔案裡的 team:true 就分享給團隊:share 的匯出不寫、匯入不收 team(也清 branch_of、branches),電腦版一樣;lan_guard 把每個 api/act 動作都列在 一邊,沒列到的一律 400,不再默默放行。 3. 可以用的電腦:帳號裡關機的電腦不在清單上,全勾就存成 None(每一台),被排除的那台 開機又能用。現在沒列出的電腦維持原狀,有清單的 Bot 從手機上不會變成「每一台」(帳號 那條路也一樣)。能力沒有這個問題:11 類永遠都列出來,None 只多出以後新版加的類別。 P2:支線的瀏覽器步驟指名 profile 只用在那一步(不再 set_current);支線換掉技能庫已有 技能的檢查跟寫資料夾一樣忽略大小寫;直接連線把 Bot 加進分享給團隊的群組算放寬 (phone_detail 多帶 team);SECURITY.md、account.md、autonomy.md 寫明打開「從手機看 這台電腦的螢幕並操作」時這個保證不成立;autonomy.md「手機用擁有者身分打也可以」改成 帳號連線才行。 P3:phone_act 照原字讀名字的那一半有自己的測試了。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(683 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);新的測試在放回 36420f3 的程式時都失敗(/always-approve 403、沒分類的動作、匯入的 team、關機的電腦、 phone_act 去空白、技能大小寫、支線的瀏覽器步驟、分享群組加成員);verify-anybot: autonomy 照新步驟跑(手機打 /always-approve 被擋、字放回輸入框,--ask 打開),另外 手機打 /yolo 被擋、status 照答、直接連線匯入帶 team:true 的檔案後新 Bot 沒分享、沒分類的 動作 400;branch、browser、profile、phone、market 照地圖跑。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address、 numbers_controls_inside_web_components、drives_a_dashboard,vault 的 fill_live——open 的 參數改了)要人在實機跑、簽名;帳號裡的電腦關機那條要帳號伺服器(只有單元測試);分享 群組要帳號(只有單元測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 12:09:52 +00:00
"primary": b.id == self.state.primary_bot, "unread": b.unread, "team": b.team,
"members": b.members.iter().map(|i| json!({"id": i, "name": names.get(i).cloned().unwrap_or_default()})).collect::<Vec<_>>(),
安全、修正: 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
"memories": if owner { b.memories.clone() } else { vec![] }, "allow_rules": if owner { b.allow_rules.clone() } else { vec![] },
"demos": b.demos.iter().map(|d| json!({"name": d.name, "created": d.created, "steps": d.steps.len()})).collect::<Vec<_>>(),
"routines": b.routines.iter().map(|r| json!({
"id": r.id, "title": r.title, "prompt": r.prompt, "paused": r.paused, "when": appctl::routine_when(r),
"schedule": serde_json::to_value(&r.schedule).unwrap_or_default(), "repeat": crate::routines::describe(&r.schedule),
"trigger": r.trigger.as_ref().map(|t| t.describe()), "status": trig.get(&r.id).cloned(),
"last": r.last_run.map(|t| crate::routines::describe_when(t, &r.schedule.timezone)), "computer": r.computer,
feat: 借鏡 pstack/Grok Bot——例行任務執行紀錄、完成看證據、教訓分流、園丁報告、減少操作步驟、網站地圖 1. 例行任務執行紀錄:每次執行記開始/結束、完成/失敗/被停止/中斷、步數與失敗步數、原因,保留最近 20 次(Grok Bot 官方規格);上次失敗或中斷的原因帶進下一次;連續失敗 2 次自動暫停並說明原因;設定頁、手機詳細頁、list_routines 都看得到,沒有紀錄時說「查不到」不說「沒跑過」 2. 完成看證據:evidence.rs 從步驟算出實際成功送出幾次,寫進例行任務紀錄;/goal 評審的摘錄把 Bot 的話標成「不是證據」並附系統統計,對不上以系統為準;評審優先用另一家供應商的模型,失敗退回原本的 3. 教訓分流:自動學技能時,AnyBot 自己的工具問題寫進 tool_issues → 「待改進」清單(同一工具合併計次),不寫進技能;設定 › 更新可看可清除 4. 園丁報告(garden.rs):平日 8:44 掃過去一天的失敗、走冤枉路的執行、自動暫停與重複出現的待改進;週一 8:49 列出失敗多或太耗時的例行任務;沒事不報,可在設定關掉 5. 減少步驟:browser type 多行文字一次放進欄位(先試貼上事件、檢查沒進再用 insertText,Firefox 也行)並回報欄位內容;點進輸入框回「游標已在…」不再說「沒有變化」;元素編號在同一頁重讀時不變;wait 的 after_send 從上次送出算間隔 6. 網站地圖:學技能時同一網站的操作知識整理進「<網站> 網站地圖」(功能/怎麼到/怎麼操作/陷阱),做事的技能只寫特有規則 Mac 465、Linux 469 個測試通過;多行輸入與編號實機測試在 Brave、Firefox 通過。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:52:44 +00:00
"paused_why": if r.paused { r.paused_why.clone() } else { String::new() },
feat: 發布關卡——已送帳本、發布前檢查、送出後讀頁面留證據、例行任務完成條件、重播可填空格 1. 已送帳本(publish.rs):Bot 用 AnyBot 瀏覽器送出前,系統先讀頁面,看是哪個帳號、回哪一篇(回覆對話框或文章裡的貼文網址、或頁面本身);同一帳號回過同一篇就擋下(記 60 天),頁面看不出回哪篇時只擋 24 小時內同頁同字。搜尋框按 Enter 不算送出。瀏覽器新增 sent 動作,直接從帳本列出帳號回過誰,不必每輪讀完網站的回覆頁 2. 發布前檢查:送出前請另一家供應商的快速模型照基本規則(簡體字、AI 腔、不該公開的內容)、這一輪讀過的技能與自訂規則檢查,沒過就不送並說原因;固定不變的放在系統提示最前面方便快取,同一段字一輪只問一次;設定可關、可加規則 3. 送出後的證據:系統重讀頁面,確認文字出現、輸入框清空,抓出留言自己的網址;寫進 Message.sent(頁面文字偽造不了),送出計數、例行任務紀錄、/goal 評審、手機頁面都以它為準;框裡還留著字就記為沒有送出 4. 完成條件:例行任務可設 target_sends,系統自己數:到數就不准再送,結束時不到算失敗,連續兩輪(50 步)沒有新的送出就停下;喚醒訊息與進展檢查都說明目前計數 5. 重播空格:自動學技能時把每次不同的內容(留言、貼文網址)存成 {{名稱}},replay_skill 用 values 填這次的內容,缺哪格就說哪格 6. 間隔從真正送出那一刻算起;送出後確認最多等 8 秒,框清空 4 秒仍沒看到就先記「還沒確認」 Mac 480 個測試通過;送出前後讀頁面在 Brave、Firefox 實機測試通過。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 17:48:13 +00:00
"runs": r.runs.iter().rev().take(5).map(|x| json!({"line": crate::routines::describe_run(x, &r.schedule.timezone), "bad": matches!(x.outcome, crate::routines::RunOutcome::Failed | crate::routines::RunOutcome::Interrupted), "sends": x.sends})).collect::<Vec<_>>(),
"target": crate::appctl::target_words(r),
})).collect::<Vec<_>>(),
"threads": b.threads.iter().enumerate().rev().map(|(i, (title, msgs))| json!({"index": i, "title": title, "count": msgs.len(), "at": msgs.last().map(|m| m.at).unwrap_or(0)})).collect::<Vec<_>>(),
"files": files,
})
}
/// 設定 as the phone shows it (nothing secret: keys only as "set or not").
fn phone_settings(&self, owner: bool) -> serde_json::Value {
let st = &self.state;
let ch_status = crate::channels::statuses().lock().unwrap().iter().map(|(k, v)| (*k, (v.ok, v.note.clone(), v.received))).collect::<HashMap<_, _>>();
let mcp = crate::mcp::status();
let mcp_err = self.ch.mcp_errors.lock().unwrap().clone();
let bot_name = |id: u64| st.bot(id).map(|b| b.name.clone()).unwrap_or_else(|| "(Bot 已刪除)".into());
let log = crate::cloudbox::log_lines();
let mut out = json!({
"role": if owner { "owner" } else { "admin" },
"host": st.remote.host_name, "version": crate::version::LABEL, "built": crate::version::epoch_ms(self.exe_built), "newer": self.newer_build.is_some(),
"theme": match st.theme { Theme::Light => "light", Theme::Dark => "dark", Theme::System => "system" },
design: 手機網頁顏色跟著電腦版、改成 Claude 手機 App 的感覺,實點修好 12 個問題 - 顏色:api/state 帶出電腦的主題和淺色/深色兩組顏色(theme::shell 換成手機的 CSS 變數);手機「這支手機的外觀」預設「跟著電腦」,也可選跟著手機、淺色、深色;先驗證是 hex 才套用,存一份避免打開時閃預設色;狀態列跟著畫面。舊版電腦沒送顏色時維持「紙」。電腦畫面頁改成暖色深色。 - 感覺:標題列沒有底線、第二行只寫在做什麼或模型;輸入框是底部圓角卡片;回答下只留時間和三個操作;群組、晶片、建議、記憶卡拿掉框線;開關的「開」用墨色;允許卡細框;點擊範圍加大(44/40/36px)。 - 字更少:設定首頁拿掉重複說明;每列說明一行;「模型」頁右邊只寫可以用/未設定;Bot 那列選單少用的收進「更多…」。 - 修好:長 Bot 名字超出 @// 選單;引用顯示原始 Markdown 且沒有長度上限;第 8 個表情換行;.note 在清單裡變灰條;圖片點了跳出 App;上傳吐司蓋住輸入框;「聊天的顏色」永遠沒有 ✓(電腦送 "Quiet",改送 quiet/black/bot_color);「:」後的網址不成連結;深色模式黑頭像看不見;稽核分頁出現 ** 和多行 JSON;頁面卡標題重複;記憶搜尋框 14px 讓 iPhone 放大。 - 問題卡的「略過」、交辦的「跳過」、允許卡的「拒絕」不再是紅字,跟電腦版一樣是一般按鈕。 已驗證:cargo test --bin anybot 523 通過(含 phone_login_and_api 檢查主題和兩組顏色)、relay 22 通過;手機圖表 65/65、通知 9/9、電腦畫面 13/13;playwright 390×844 淺色深色點過登入、首頁、聊天、詳細資訊、Bot 設定、頁面、例行任務、電腦、設定每一頁,沒有 console 錯誤、失敗請求或橫向溢出;電腦換靛藍深色,手機跟著變。 未驗證:真的 iPhone/Android 實機。
2026-11-16 15:16:38 +00:00
// 聊天的顏色 in the words update_settings takes (the phone ticks the one in use; the
// enum's own names, "Quiet", matched none of them).
"accent": match st.accent {
crate::model::Accent::Quiet => "quiet",
crate::model::Accent::Black => "black",
crate::model::Accent::BotColor => "bot_color",
},
"timezone": st.timezone, "notify": st.notify, "language": st.language,
修手機接管電腦後回不去;新增「風格」(8 套:紙、夜、墨、苔、海、糖、夕陽、終端機,一套顏色加聊天背景花紋,電腦和手機一起換,也能請 Bot 換);設定每一列都有圖示(電腦和手機)。 - 接管回不去(mobile/index.html newBoxFrame):以前每次打開/關掉都改同一個 iframe 的網址,iframe 換頁會加進上一頁紀錄;第二次之後按 ✕ 或返回,退的是框裡那一頁,接管畫面卡著。現在每次換一個新的框,關掉就拿掉。舊版重現:第 2、3 次關不掉;新版連續 3 次都回到首頁。 - 風格(src/theme.rs TEMPLATES、palette_for、backdrop):每套有淺色和深色的墨、紙、強調色(同一個產生器長出整個殼),加聊天背景 dots/grid/waves。State 新欄位 shell_template(空=自訂)。電腦:設定 › 一般 › 外觀最上面一排小圖(kit::style_gallery,每張是那個風格的縮小畫面),聊天區後面畫花紋(chat_backdrop);點強調色、動底色或重設回到自訂。手機:palettes 帶 backdrop,聊天背景用 CSS 畫;設定 › 一般最上面同一排小圖(api/settings 的 styles、style)。Bot:update_settings 多 `style`(appctl;不在 tools::specs 的鎖檔裡,鎖檔沒變)。截圖:ANYBOT_SHOT_STYLE=ocean。 - 設定圖示:icons::setting_icon 照名字的字配圖示(主題月亮、風格和顏色調色盤、通知鈴鐺、時區地球、權限盾牌、電腦螢幕…,沒對到是滑桿),card_row 和 setting_title 都畫;新 Lucide 圖示 palette、moon、globe、sliders-horizontal、volume-2、hard-drive。手機設定頁、Bot 設定、電腦頁的列用 sitem(同一套規則,SET_ICON)。 - 測試:theme::template_tests::every_template_reads_in_light_and_dark(每套淺深色都讀得清楚、紙就是原本的預設);appctl 的 update_settings 測試加 style。 - 功能地圖 appearance.md 加 appearance-style 和一步驗證、settings.md(Bot 能改四樣)、box.md 陷阱;FEATURES.md。 已驗證: cargo test 881 個全過;clippy 沒有新警告;scratch 手機:接管開關 3 次都回首頁(舊版第 2 次就卡住);設定 › 一般點「海」→ state shell_template=ocean、聊天背景波浪;聊天請 Bot `update_settings {"style":"terminal"}` → 手機強調色 #2d8a3e、格線;Bot 設定 36 列都有圖示。桌面截圖:外觀的 8 張小圖、海、終端機(深色)、糖的聊天,電腦設定一般/電腦頁每列有圖示。 未驗證: 在真的 iPhone 上滑返回手勢(接管開著時本來就停用,靠 ✕);花紋在很大的螢幕上的耗電(電腦版每幀畫點點/線,沒量)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:38:00 +00:00
// 風格: the one worn ("" = 自訂) and each one's colours for the phone's little pictures.
"style": st.shell_template,
"styles": crate::theme::TEMPLATES.iter().map(|t| {
let look = |dark| { let p = crate::theme::palette_for(t.id, 1.0, "clay", st.shell_contrast, dark); let pj = remote::palette_json(&p); json!({"pane": pj["pane"], "side": pj["side"], "text3": pj["text3"], "hover": pj["hover"], "active": pj["active"], "bubble": pj["bubble-user"], "accent": pj["accent"], "line": pj["line"], "grid": pj["grid"]}) };
json!({"id": t.id, "name": t.name, "about": t.about, "backdrop": t.backdrop, "light": look(false), "dark": look(true)})
}).collect::<Vec<_>>(),
"direct_mode": st.direct_mode, "direct_locked": !self.managed.direct.allows() || !self.managed.local.allows(),
智慧模式 (/smart): 一问一决定,不是一步一卡 询问和一律放行中间的设定(CLAUDE.md 改善轮迴的第一块:聊天卡顿的主因是一步一卡)。 - 卡片多一个「这轮都准」: 同类操作这一轮只问一次(Job 就是一轮,按构造就是 per-turn; 下一轮会再问)。grant 非空的 Action 卡与连接器卡有这按钮;must-ask(付款/传送/删除的 点击、你的屏幕和 App、保险库、一律询问规则、hook)没有,也不被覆盖。 - 卡片逾时: 你几分钟没回,卡片自己回答——看档案/上网这类先做(步骤结果里写明),敏感操作 自动拒绝并告诉 Bot 别重试。/smart 中途开关都即时(窗口一个 Arc,Job 共享)。 - 审核缓存: 自动审核的模型判决这一轮按(规则,动作)缓存,重复同一步不再每次付 10–20 秒; 审查看不见档案全文时照旧自己问(没动)。 - 开关: /smart(/smart off、status)、设定›权限(滑块调时限,默认 300 秒)、输入列旁图标。 手机/远端只能关不能开(words_loosen + remote setting 只收紧);untrusted 回合永不智慧。 - 锁: 管理员锁住直接操作/本地执行时,智慧模式一起锁。 - feature-map: chat.md / safety.md / autonomy.md / settings.md 同步(featuremap 测试绿)。 已验证: cargo test 全绿 716(含 featuremap::、layout_audit::、approval/tool 锁未动) 未验证: 实机批准卡路径(新按钮、逾时行为)需人类实机点测并签名(CLAUDE.md 审批准则)
2026-11-19 06:59:29 +00:00
"smart_mode": st.smart_mode,
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
// 權限's 一律放行 and how long a 智慧模式 card waits; 更新's switches; 記憶與文件.
// 語音: who hears (聽) and who reads aloud (說); a key is only said to be there.
"voice": {
"listen": {"kind": serde_json::to_value(st.voice.listen.kind).unwrap_or_default(), "base_url": st.voice.listen.base_url, "model": st.voice.listen.model, "has_key": !st.voice.listen.api_key.is_empty(), "ready": crate::speech::resolve(&st.voice.listen, st, false).is_some()},
"speak": {"kind": serde_json::to_value(st.voice.speak.kind).unwrap_or_default(), "base_url": st.voice.speak.base_url, "model": st.voice.speak.model, "voice": st.voice.speak.voice, "has_key": !st.voice.speak.api_key.is_empty(), "ready": crate::speech::resolve(&st.voice.speak, st, true).is_some()},
},
"always_approve": st.always_approve, "smart_timeout_secs": st.smart_timeout_secs,
"auto_update": st.auto_update_when_away, "garden_reports": st.garden_reports,
"embed": match st.embed_model.trim() { "" | "local" => "local", "off" => "off", _ => "ollama" }, "doc_folders": st.doc_folders,
"auto_review": st.auto_review, "allow_rules": st.review_allow_rules, "ask_rules": st.review_ask_rules,
"providers": crate::providers::ALL_PROVIDERS.iter().map(|&k| {
let ps = st.provider(k);
feat: ChatGPT 方案——用 ChatGPT 帳號登入,Bot 用你 ChatGPT 方案的額度,不用 API 金鑰 - 新供應商「ChatGPT 方案」(src/chatgpt.rs):照 OpenAI 給開源 App 的 Sign in with ChatGPT。 第一次登入註冊 AnyBot(dynamic_agent_client → oaiapp_…)並重用;PKCE、state、nonce; ID token 驗 RS256 簽章、iss、aud、exp、nonce;沒同意使用方案算登入但不能用(再登入會要求同意)。 - 要求走 Responses API(api.openai.com/v1/responses,store:false、stream:true、instructions), token 只送 OpenAI 自己的網址;收到 response.completed 才算完成;額度用完停下來給管理用量連結, 不重試、不改用 API 金鑰。token 快到期或 401 時更新(一次一個,refresh token 會輪替)。 - 設定 › 模型 › ChatGPT 方案:使用 ChatGPT 繼續、登出、換帳號、打開登入頁、管理用量; 連到伺服器大腦的螢幕電腦和手機也能登入(登入頁開在自己這台,打不開的那頁網址貼回給大腦)。 - Bot 工具 chatgpt_login(status、login、logout、switch_account;登出和換帳號先問)。 - 修連接器登入:封存的 token 前綴寫錯("sealed:" 實際是 "enc:v1:"),重開 App 後 token 沒解開就被當成憑證送出,登入等於每次重開都失效。 已驗證: cargo test 全綠(chatgpt::、providers::、appctl::、remote::、mcp_oauth::、featuremap::、layout_audit::); 授權網址的參數送到 auth.openai.com 沒被拒(302 到登入頁)。 未驗證: 實際用 ChatGPT 帳號登入、同意、Responses 串流與工具呼叫(要真的 ChatGPT 付費帳號和瀏覽器); 螢幕電腦貼回網址、手機登入(要實機);Windows 的「打開登入頁」。 動到審批路徑(appctl::needs_approval 的 chatgpt_login):需要實機測試+人類簽名。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:23:10 +00:00
// (ChatGPT 方案 signs in with an account, not a key: `account`.)
json!({"key": serde_json::to_value(k).unwrap_or_default(), "label": k.label(), "needs_key": k.needs_key() && k != crate::providers::ProviderKind::ChatGpt, "account": k == crate::providers::ProviderKind::ChatGpt,
"ready": crate::providers::ready(k, &ps.api_key),
本機和雲端分得出來(計畫 B3):每個模型服務標它在哪裡跑——「本機」(localhost)、「區網」(私有位址、tailnet 100.64/10、.local、.ts.net、沒有點的名字…)、「雲端」(其他全部;ChatGPT 方案一律雲端),本機、區網綠字。一句話說在哪台跑、什麼會送出去:「在這台電腦上跑:對話、檔案內容和截圖都不會離開這台」「在你網路裡的 192.168.1.20 上跑…」「在 xAI Grok 的伺服器上跑:Bot 的對話、它讀到的檔案內容和截圖會送過去」;螢幕電腦和手機上本機寫成大腦那台。只看網址字串、不查 DNS(原本的 is_local_model 會查名字,畫面每格都畫不得),分不出來就說雲端。 標在:設定 › 模型 左欄每列右邊(左欄 180 → 212 px 放得下「自訂(OpenAI 相容)」加標籤)、標題下一句;Bot 設定「AI 供應商與模型」下面;聊天頂端 Bot 名字後面;空聊天「供應商 · 模型 · 雲端」;輸入框 + 的模型選單每家後面。手機:大腦送 runs、runs_words(bots)和 runs(模型清單、設定的 providers),Bot 設定 › 模型 右邊、選模型時每家的標題、設定 › 模型 每家的說明。「Ollama(本機)」改叫「Ollama」(它可以指到區網另一台,名字寫死本機會說錯)。功能地圖 models.md(models-where、新的驗證步驟)、FEATURES.md(模型在哪裡跑)、計畫 B3 同步。 已驗證: cargo test 全綠(823),新測試 each_model_says_where_it_runs(本機、各種區網、雲端、帳密不進句子、公開網域算雲端、ChatGPT 方案、OpenRouter、空網址);layout_audit 過(第一版標籤和換行的句子重疊被它抓到,改成一段兩色的文字);clippy 錯誤數跟之前一樣(12);桌面截圖(ABV_ALLOW_WINDOW):設定 › 模型每列右邊「雲端/本機」、xAI Grok 標題下那句,聊天頂端「Bot 雲端」,空聊天「OpenAI · gpt-5 · 雲端」;verify-anybot 手機:Bot 設定 › 模型 右邊「本機」、選模型時「自訂(OpenAI 相容) · 本機」,API 的 runs_words「在大腦「驗證用 AnyBot」那台電腦上跑…」。 未驗證: 螢幕電腦(連著別台大腦)上那句寫大腦名字——要兩台;Bot 設定裡那一行要捲到下面,截圖沒截到(layout_audit 有畫到那裡)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 03:25:16 +00:00
"default_model": ps.default_model, "custom_url": !ps.base_url.is_empty(),
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
"base_url": ps.base_url, "default_url": k.default_base_url(), "cloud_eyes": ps.cloud_eyes,
"local": crate::providers::is_local_model(k, &crate::providers::resolve_base(k, &ps.base_url)),
"known": ps.known_models.len(), "testing": self.model_fetch.contains_key(&k), "status": self.fetch_status.get(&k).cloned().unwrap_or_default(),
本機和雲端分得出來(計畫 B3):每個模型服務標它在哪裡跑——「本機」(localhost)、「區網」(私有位址、tailnet 100.64/10、.local、.ts.net、沒有點的名字…)、「雲端」(其他全部;ChatGPT 方案一律雲端),本機、區網綠字。一句話說在哪台跑、什麼會送出去:「在這台電腦上跑:對話、檔案內容和截圖都不會離開這台」「在你網路裡的 192.168.1.20 上跑…」「在 xAI Grok 的伺服器上跑:Bot 的對話、它讀到的檔案內容和截圖會送過去」;螢幕電腦和手機上本機寫成大腦那台。只看網址字串、不查 DNS(原本的 is_local_model 會查名字,畫面每格都畫不得),分不出來就說雲端。 標在:設定 › 模型 左欄每列右邊(左欄 180 → 212 px 放得下「自訂(OpenAI 相容)」加標籤)、標題下一句;Bot 設定「AI 供應商與模型」下面;聊天頂端 Bot 名字後面;空聊天「供應商 · 模型 · 雲端」;輸入框 + 的模型選單每家後面。手機:大腦送 runs、runs_words(bots)和 runs(模型清單、設定的 providers),Bot 設定 › 模型 右邊、選模型時每家的標題、設定 › 模型 每家的說明。「Ollama(本機)」改叫「Ollama」(它可以指到區網另一台,名字寫死本機會說錯)。功能地圖 models.md(models-where、新的驗證步驟)、FEATURES.md(模型在哪裡跑)、計畫 B3 同步。 已驗證: cargo test 全綠(823),新測試 each_model_says_where_it_runs(本機、各種區網、雲端、帳密不進句子、公開網域算雲端、ChatGPT 方案、OpenRouter、空網址);layout_audit 過(第一版標籤和換行的句子重疊被它抓到,改成一段兩色的文字);clippy 錯誤數跟之前一樣(12);桌面截圖(ABV_ALLOW_WINDOW):設定 › 模型每列右邊「雲端/本機」、xAI Grok 標題下那句,聊天頂端「Bot 雲端」,空聊天「OpenAI · gpt-5 · 雲端」;verify-anybot 手機:Bot 設定 › 模型 右邊「本機」、選模型時「自訂(OpenAI 相容) · 本機」,API 的 runs_words「在大腦「驗證用 AnyBot」那台電腦上跑…」。 未驗證: 螢幕電腦(連著別台大腦)上那句寫大腦名字——要兩台;Bot 設定裡那一行要捲到下面,截圖沒截到(layout_audit 有畫到那裡)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 03:25:16 +00:00
"runs": crate::providers::runs_at(k, &crate::providers::resolve_base(k, &ps.base_url)).short()})
}).collect::<Vec<_>>(),
2026-11-11 08:19:06 +00:00
"skills": st.skills.iter().map(|k| json!({
"name": k.name,
"description": k.description,
"instructions": k.instructions,
"enabled": k.enabled,
"resources": k.resources,
"steps": k.steps.len(),
"source": k.source,
})).collect::<Vec<_>>(),
"skill_market": crate::skills::BUILTIN_SKILLS.iter().map(|b| json!({
"name": b.slug,
"title": b.title,
"summary": b.summary,
"source": format!("builtin:{}", b.slug),
"remote": false,
})).chain(crate::skills::REMOTE_MARKET.iter().map(|r| json!({
"name": r.name,
"title": r.name,
"summary": r.summary,
"source": r.source,
"remote": true,
}))).collect::<Vec<_>>(),
"templates": crate::memory::TEMPLATES.iter().map(|t| {
let c = crate::avatar::color(t.color);
json!({"name": t.name, "description": t.description, "shape": t.shape, "color": format!("#{:02x}{:02x}{:02x}", c.r(), c.g(), c.b())})
}).collect::<Vec<_>>(),
"shapes": crate::avatar::SHAPES,
"colors": crate::avatar::COLORS.iter().map(|(k, n, c)| json!({"key": k, "name": n, "hex": format!("#{:02x}{:02x}{:02x}", c[0], c[1], c[2])})).collect::<Vec<_>>(),
"folders": st.folders,
"channels": st.channels.iter().map(|c| {
let (ok, note, received) = ch_status.get(&c.id).cloned().unwrap_or((false, String::new(), 0));
json!({"id": c.id, "kind": c.kind.label(), "name": c.name, "bot": bot_name(c.bot_id), "target": c.target, "enabled": c.enabled, "ok": ok, "note": note, "received": received})
}).collect::<Vec<_>>(),
"mcp": st.mcp_servers.iter().map(|m| json!({
"name": m.name, "enabled": m.enabled, "tools": mcp.get(&m.name), "error": mcp_err.iter().find(|e| e.0 == m.name).map(|e| e.1.clone()),
"what": if m.url.is_empty() { m.command.clone() } else { address_only(&m.url) },
})).collect::<Vec<_>>(),
"box": {
"state": crate::cloudbox::run_state().label(), "available": crate::cloudbox::available(),
"version": crate::cloudbox::wanted_version(), "runtime": crate::cloudbox::box_runtime(),
"snapshot": crate::cloudbox::snapshot_time().map(|t| t.format("%m/%d %H:%M").to_string()),
"auto_update": crate::cloudbox::auto_update_at(),
"note": self.cu.note.lock().unwrap().clone(), "disk": self.cu.disk.lock().unwrap().clone(),
"log": log.iter().rev().take(40).rev().cloned().collect::<Vec<_>>(),
"facts": box_facts(),
},
});
if owner {
out["devices"] = json!(st.remote.devices.iter().map(|d| json!({"name": d.name, "created": d.created, "last_seen": d.last_seen})).collect::<Vec<_>>());
out["docker_host"] = json!(crate::cloudbox::docker_host());
}
out
}
}
#[cfg(test)]
mod phone_act_tests {
use super::*;
/// The demo app (sample bots, nothing read from or saved to disk).
fn demo() -> (egui::Context, App) {
let ctx = egui::Context::default();
let app = App::new(&ctx, Some(std::env::temp_dir().join("anybot-phone-act-test.png")));
(ctx, app)
}
/// 允許/拒絕 on a phone notification answers only the request it showed: once that one
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
/// is gone and another waits, the old banner answers nothing (a note says so). And only a
/// request to allow that fits on the banner: never 我完成了, 略過 or 一律允許 from there.
#[test]
fn a_banner_answers_only_its_own_request() {
let (ctx, mut app) = demo();
let bot = app.state.bots[0].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
let card = |app: &mut App, kind: ApprovalKind, reason: &str, key: &str| {
let (tx, rx) = std::sync::mpsc::channel();
// (The same tool call asking again, as one step does: a new key each time.)
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
app.approvals.insert(bot, crate::providers::Approval { call_id: "c0".into(), tool: "shell".into(), reason: reason.into(), grant: "rm".into(), reply: tx, kind });
app.ask_keys.insert(bot, key.into());
rx
};
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 banner = |answer: &str, call: &str| Cmd::Answer { bot, answer: answer.into(), text: String::new(), call: call.into(), notice: true, screen: 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
let rx = card(&mut app, ApprovalKind::Action, "刪除 build", "call-2");
app.remote_cmd(&ctx, banner("once", "call-1"));
assert!(rx.try_recv().is_err(), "an old banner doesn't allow the new request");
assert!(app.approvals.contains_key(&bot));
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
assert!(app.state.bot(bot).unwrap().messages.iter().any(|m| m.note && m.text.contains("通知上的「允許/拒絕」沒有用上")));
// Its key, but 一律允許 (a banner has none) or a command too long for the banner: no.
app.remote_cmd(&ctx, banner("always", "call-2"));
assert!(rx.try_recv().is_err() && app.state.bot(bot).unwrap().allow_rules.is_empty());
app.remote_cmd(&ctx, banner("once", "call-2"));
assert!(matches!(rx.try_recv(), Ok(ApprovalAnswer::Once)));
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
let rx = card(&mut app, ApprovalKind::Action, "執行指令:\nrm -rf build\nrm -rf dist", "long");
app.remote_cmd(&ctx, banner("once", "long"));
assert!(rx.try_recv().is_err(), "the banner showed only its first line");
// A hand-off or a question isn't answered from a banner, even with its key…
let rx = card(&mut app, ApprovalKind::Handoff, "登入", "h");
app.remote_cmd(&ctx, banner("once", "h"));
assert!(rx.try_recv().is_err(), "允許 on a banner is never 我完成了");
// …but the phone's own card answers it, with that key.
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
app.remote_cmd(&ctx, Cmd::Answer { bot, answer: "once".into(), text: String::new(), call: "h".into(), notice: false, screen: 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
assert!(matches!(rx.try_recv(), Ok(ApprovalAnswer::Once)), "我完成了 on the phone's card");
let rx = card(&mut app, ApprovalKind::Question, r#"[{"question":"哪一天?"}]"#, "q");
app.remote_cmd(&ctx, banner("reject", "q"));
assert!(rx.try_recv().is_err(), "拒絕 on a banner is never 略過");
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
app.remote_cmd(&ctx, Cmd::Answer { bot, answer: "answered".into(), text: r#"["週五"]"#.into(), call: "q".into(), notice: false, screen: 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
assert_eq!(rx.try_recv(), Ok(ApprovalAnswer::Answered(r#"["週五"]"#.into())));
}
智慧模式設計審計修正:手機也有「這輪都准」、按鈕詞彙統一、無障礙與智慧晶片 照 frontend-design skill 審計(使用者流程與順眼程度): - 手機審批卡:智慧模式開著時「這輪都准」是主按鈕(scope 由大腦從卡片自己的 grant 取,手機的字不會決定範圍;通知不帶 scope);無卡片主按鈕改「允許一次」 (桌面同步改名,全產品動詞一致)。一律允許退為一般按鈕:最有力的許可 不再站最前排。 - 手機聊天輸入列:智慧模式開著時有 ✨ 晶片,點了關掉(手機只能收緊); 關後 state/settings 同步重抓。桌面 ✨ 第一次開著時旁邊標「智慧」兩字, 關過一次就不再有字。 - 無障礙:全站 :focus-visible 焦點框;圖示按鈕(返回、送出、選單…)加 aria-label;審批按鈕組加 role=group。「全部允許,之後直接操作」連結 由 accent 色改灰:最有力的許可給最靜的處理。 - 測試:手機 scope 回答新測試(卡片自己的 grant、通知不帶);真機 e2e: 無頭 iPhone 開聊天見晶片→點→toast、晶片消失、/api/settings 同步 false; 連接器工具卡四顆按鈕「這輪都准/允許一次/一律允許/拒絕」,按「這輪都准」 後工具執行、allow_rules 沒有新增(不落永久規則)。 - 地圖:autonomy/safety/phone/connectors/apps 同步(autonomy 壓回 8999/9000); TLA coverage.tsv 已 rehash(approval_body、cmd_answer、approval_json、 phone_cards、render_dock)。 已驗證: cargo test 721 全綠(含 featuremap::、layout_audit::、phone_scope)、 verify-approval-routing run.sh 全綠、真機 e2e(晶片開關三端同步、scope 卡執行 且無永久規則)、node --check 手機 JS。 未驗證: 桌面視窗的 ✨「智慧」標註與卡片主按鈕外觀(要開視窗,需使用者同意 desktop-shot+人類簽名)。
2026-11-19 07:24:37 +00:00
/// 智慧模式's 「這輪都准」 on the phone's card: the scope is the card's own grant (the phone's
/// words never pick what it covers), it is offered on the card only while smart mode is on,
/// and a banner never carries it (a notification has 允許/拒絕 only).
#[test]
fn the_phone_scope_answer_takes_the_cards_own_grant() {
let (ctx, mut app) = demo();
let bot = app.state.bots[0].id;
let card = |app: &mut App, key: &str| {
let (tx, rx) = std::sync::mpsc::channel();
app.approvals.insert(bot, crate::providers::Approval { call_id: "c1".into(), tool: "shell".into(), reason: "執行指令:\ngit commit -m x".into(), grant: "shell:git commit".into(), reply: tx, kind: ApprovalKind::Action });
app.ask_keys.insert(bot, key.into());
rx
};
let rx = card(&mut app, "k1");
let shown_off = approval_json(app.state.bot(bot).unwrap(), app.approvals.get(&bot).unwrap(), "k1", false);
assert_eq!(shown_off["can_scope"], json!(false), "no 這輪都准 on the card while smart mode is off");
let shown_on = approval_json(app.state.bot(bot).unwrap(), app.approvals.get(&bot).unwrap(), "k1", true);
assert_eq!(shown_on["can_scope"], json!(true));
app.remote_cmd(&ctx, Cmd::Answer { bot, answer: "scope".into(), text: String::new(), call: "k1".into(), notice: false, screen: false });
assert!(matches!(rx.try_recv(), Ok(ApprovalAnswer::Scope(g)) if g == "shell:git commit"), "the scope is the card's grant, this turn only");
let rx = card(&mut app, "k2");
app.remote_cmd(&ctx, Cmd::Answer { bot, answer: "scope".into(), text: String::new(), call: "k2".into(), notice: true, screen: false });
assert!(rx.try_recv().is_err(), "a banner has no 這輪都准");
}
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 phone's own card (and a screen) names its card too: a page too old to send a key, or
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
/// a card answered and replaced since, answers nothing while the next one waits — and the
/// note says what to do about it where it came from (refresh the phone's page; update the
/// screen computer's AnyBot). With nothing waiting there is nothing to say.
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
#[test]
fn a_phone_answer_without_its_cards_key_answers_nothing() {
let (ctx, mut app) = demo();
let bot = app.state.bots[0].id;
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 from = |screen: bool, answer: &str, call: &str| Cmd::Answer { bot, answer: answer.into(), text: String::new(), call: call.into(), notice: false, screen };
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
let (tx, rx) = std::sync::mpsc::channel();
app.approvals.insert(bot, crate::providers::Approval { call_id: "c0".into(), tool: "shell".into(), reason: "刪除 build".into(), grant: "rm".into(), reply: tx, kind: ApprovalKind::Action });
app.ask_keys.insert(bot, "now".into());
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 last_note = |app: &App| app.state.bot(bot).unwrap().messages.iter().rev().find(|m| m.note).map(|m| m.text.clone()).unwrap_or_default();
let notes = |app: &App| app.state.bot(bot).unwrap().messages.iter().filter(|m| m.note && m.text.contains("沒有用上")).count();
app.remote_cmd(&ctx, from(false, "always", ""));
fix: 等你允許的卡片第三輪——螢幕電腦不推答不到的通知、舊頁面的提示說重新整理不行怎麼辦、問題卡表單照卡認 獨立審查(30c3895+838bb95,沒有 P0/P1)提的 P2: - 螢幕電腦(mir.on)不再把等你的卡推到手機。它推的通知被帳號伺服器蓋上螢幕電腦的 host,手機按了 就切到螢幕電腦、把回答送過去,可是螢幕電腦不替手機做事(丟掉手機指令)、也不給手機畫面:「允許」 不見了,手機還停在螢幕電腦上(本來就有的問題)。同一張卡由大腦推(「通知」是大腦的設定,螢幕電腦 跟著它;大腦不在前面或閒置 90 秒時推,在伺服器上一定推)。螢幕電腦照樣響、照樣跳 macOS 通知。 - 手機舊頁面的提示:「重新整理再回答;還是不行(帳號伺服器還沒更新),就在電腦上回答。」——帳號 伺服器沒更新時,重新整理拿到的還是舊頁面。 - 大腦視窗和螢幕電腦的問題卡:表單(步驟、勾選、打的字)、打字欄、游標、捲到卡的紀錄都照卡的 key 認,不再照 call id:同一個 call_0、題數一樣的下一張問題卡不會接手上一張的答案,「送出」不會送出 沒人選過的東西。新增測試 a_question_in_anothers_place_starts_with_nothing_picked。 - 功能地圖 phone、FEATURES.md 跟著改;verify-approval-routing 的「沒有放進模型」改成真的(螢幕電腦 不推、以前為什麼答不到、什麼時候大腦也不推),對照表加上 question_card,對過模型後 rehash(這個 commit 就是新的同步 commit)。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)648 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 個重走測試通過;改回舊的都被抓到(問題卡表單照 call id 認 → 新卡接手了步驟 1 和「否」;手機提示少了「在電腦上回答」);verify-anybot:允許、拒絕、問題卡、舊 key/沒有 key/舊通知都不算且提示對(含新的那一句)、支線的卡和它的提示在主線(證據 target/verify-anybot/20261118-112729) 未驗證: 螢幕電腦不推通知只照程式讀過(推播只在非示範模式、要連帳號伺服器,沒有測試)、真的螢幕電腦和手機推播都沒實機;大腦那台正在用時大腦和螢幕電腦都不推(這是取捨,不是新的路);帳號伺服器的頁面(relay/ 要重新部署);--ignored 的實機測試(會開真的視窗和瀏覽器,留給人跑) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:29:14 +00:00
// (And when refreshing doesn't help — an account server not yet updated — the computer.)
assert!(last_note(&app).starts_with("手機上的回答沒有用上") && last_note(&app).contains("頁面太舊") && last_note(&app).contains("重新整理") && last_note(&app).contains("在電腦上回答"), "{}", last_note(&app));
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
app.remote_cmd(&ctx, from(false, "once", "before"));
assert!(last_note(&app).starts_with("手機上的回答沒有用上") && last_note(&app).contains("已經不在等了") && !last_note(&app).contains("頁面太舊"), "{}", last_note(&app));
// An older screen computer sends no key: refreshing does nothing there — updating does.
app.remote_cmd(&ctx, from(true, "once", ""));
assert!(last_note(&app).starts_with("螢幕電腦上的回答沒有用上") && last_note(&app).contains("設定 › 更新") && !last_note(&app).contains("重新整理"), "{}", last_note(&app));
app.remote_cmd(&ctx, from(true, "once", "before"));
assert!(last_note(&app).starts_with("螢幕電腦上的回答沒有用上") && last_note(&app).contains("已經不在等了"), "{}", last_note(&app));
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
assert!(rx.try_recv().is_err() && app.state.bot(bot).unwrap().allow_rules.is_empty(), "no key, or an old one: nothing");
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!(notes(&app), 4, "each one says so");
app.remote_cmd(&ctx, from(false, "reject", "now"));
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
assert_eq!(rx.try_recv(), Ok(ApprovalAnswer::Reject));
// Nothing waits now: an answer that comes late says nothing.
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
app.remote_cmd(&ctx, from(false, "once", "now"));
assert_eq!(notes(&app), 4);
}
/// A 支線's card on the phone: in its main bot's chat (`bot`), answered for the 支線
/// (`target`), with the 支線's own key — the main bot's would answer nothing (or, if the main
/// bot waits too, be refused as another card's). An answer that can't be taken is said in
/// the main bot's chat, where the 支線's card is shown: its own messages aren't shown anywhere.
#[test]
fn a_branch_card_on_the_phone_carries_its_own_key_and_target() {
let (ctx, mut app) = demo();
let main = app.state.bots[0].clone();
let mut br = main.clone();
br.id = 9001;
br.branch_of = main.id;
br.messages.clear();
app.state.branch_bots.push(br);
let card = |app: &mut App, id: u64, reason: &str, key: &str| {
let (tx, rx) = std::sync::mpsc::channel();
app.approvals.insert(id, crate::providers::Approval { call_id: "call_0".into(), tool: "shell".into(), reason: reason.into(), grant: String::new(), reply: tx, kind: ApprovalKind::Action });
app.ask_keys.insert(id, key.into());
rx
};
let main_rx = card(&mut app, main.id, "執行指令:ls", "km");
let branch_rx = card(&mut app, 9001, "執行指令:rm -rf build", "kb");
let cards = app.phone_cards(&main);
let b = cards.iter().find(|c| c["target"] == 9001).cloned().unwrap_or_default();
assert_eq!((b["bot"].as_u64(), b["key"].as_str()), (Some(main.id), Some("kb")), "{cards:?}");
let m = cards.iter().find(|c| c["target"].is_null()).cloned().unwrap_or_default();
assert_eq!(m["key"], "km", "{cards:?}");
// A stale answer for the 支線 (its last card's key): refused, said in the main chat.
app.remote_cmd(&ctx, Cmd::Answer { bot: 9001, answer: "once".into(), text: String::new(), call: "old".into(), notice: false, screen: false });
assert!(branch_rx.try_recv().is_err());
let said = |app: &App, id: u64| app.state.bot(id).unwrap().messages.iter().any(|m| m.note && m.text.contains("沒有用上"));
assert!(said(&app, main.id) && !said(&app, 9001), "the note is in the main bot's chat");
// The phone answers it as renderDock does: api/bots/{target}/answer with its key.
let target = b["target"].as_u64().unwrap_or(0);
app.remote_cmd(&ctx, Cmd::Answer { bot: target, answer: "once".into(), text: String::new(), call: b["key"].as_str().unwrap_or("").into(), notice: false, screen: false });
assert_eq!(branch_rx.try_recv(), Ok(ApprovalAnswer::Once));
assert!(main_rx.try_recv().is_err() && app.approvals.contains_key(&main.id), "the main bot's card still waits");
}
fix: 直接連線真的只能收緊;Bot 的電腦和支線換不了瀏覽器設定檔;支線不動大家共用的東西 複審 f3ff553 找到的問題,加上直接連線全部設定的盤點: A. 直接連線用多一格空白繞過檢查:檢查照原字讀名字,大腦那邊(phone_act)卻先去掉空白 再做,「direct_mode 」「 rule_add」「abilities 」都過關、照做。現在兩邊都照原字讀: phone_act 的 key/list/op 不再 trim,規則清單只認 ask、allow(以前認不得的都當允許 清單);直接連線上名字不是 AnyBot 認得的一律 400「不認得這個設定」,什麼都不改。 盤點(remote::lan_guard,直接連線送來的每個 api/act):放寬的一律 403——打開直接操作、 打開自動審核、加允許規則、拿掉詢問規則、加連接器或把關掉的打開、打開訊息管道、打開 Bot 的電腦工具(沒帶值也算打開,跟 phone_act 一樣)、分享給團隊、勾回能力或可以用的 電腦、Bot 的電腦從 gVisor 換回標準;收緊的和不動權限的照做。卡片的允許/一律允許照舊 (那是回答眼前那張卡)。「只能收緊、不能放寬」現在是真的。 B. Bot 的電腦裡換瀏覽器設定檔是假的:在 box 裡 add 在大腦建資料夾、set_current 卻寫 「預設」蓋掉這台記著的選擇,Bot 還聽到「已新增並切換」。現在 box 裡新增、切換一律 回「Bot 的電腦上的瀏覽器只有一個設定檔…」,box 裡也不再寫這台的使用中設定檔(以前在 box 開網頁就把它改回「預設」)。 P2 設定檔名字:「阿金」不再模糊對到使用者的「阿金(Firefox)」:只換 AnyBot 自己同名的 設定檔(大小寫不算),其他名字新增全新的;使用者自己的瀏覽器(Firefox 設定檔、「你的 瀏覽器」)Bot 不能換過去——拒絕並請使用者在設定裡換(換了是每一步、每個 Bot 都用他的 登入;這個工具沒有卡片可問)。某一步指名用它也不會變成使用中。 P2 支線:create_bot、create_group、move_to_group、rename_group、delete_group、 delete_skill、skill_install(內建的也是)也擋;連接器、hook 改成只放行「看」的動作 (空白、大小寫都算改);瀏覽器 profiles 的新增、切換擋在步驟(BranchLimits); save_skill、skillify 不能換掉技能庫裡已有的同名技能(apply 裡 bot_id 早就換成主 Bot,改用原本的支線 id 判斷;save_skill 在寫資料夾之前就擋)。支線的系統提示和 changes_settings 的說明照實列出擋什麼。 P3 oplog::replay_of 不再把 browser_profiles 當只看的。 功能地圖:autonomy(子功能、步驟加直接連線拿掉詢問規則 403、多空白名字 400、打開自動 審核 403、state 確認)、account、profile、phone、branch(Bot 那一行、步驟加支線建 Bot、 換設定檔被擋、陷阱)、browser(子功能、Bot 那一行、步驟加換「你的瀏覽器」被擋); FEATURES.md、SECURITY.md 同步。工具定義不變;verify-approval-routing 沒有漂移。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(679 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);7 個新/改的測試在 放回舊程式時都失敗(含複審的繞過:「direct_mode 」照做);verify-anybot 照地圖跑 autonomy、branch、browser、profile、market、phone、channels、connectors 的步驟。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 要人在實機跑、簽名;Bot 的電腦裡的瀏覽器(要 Docker);使用者真的 Firefox 設定檔(scratch 沒有);帳號連線那條路(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 11:36:07 +00:00
/// An act from a direct connection: remote::lan_guard first (asked about the bot as the
/// route asks), then phone_act — as remote.rs does it.
fn over_lan(ctx: &egui::Context, app: &mut App, action: &str, body: serde_json::Value) -> Result<serde_json::Value, crate::remote::Guard> {
let detail = app.phone_act(ctx, "detail", &json!({"bot": body["bot"]}), "owner");
match crate::remote::lan_guard(action, &body, || detail, "runc") {
crate::remote::Guard::Keeps => Ok(app.phone_act(ctx, action, &body, "owner")),
other => Err(other),
}
}
/// A direct connection only tightens, however a setting's name is spelled: 「direct_mode 」,
/// 「 rule_add」, 「abilities 」 got past the guard (it read the name exactly) and were done
/// anyway (phone_act trimmed it). Each loosening, padded, cased or with a wide space, leaves
/// every guard as it was; the tightenings still go through.
#[test]
fn a_direct_connection_cannot_loosen_by_spelling_a_setting_differently() {
let (ctx, mut app) = demo();
let b = app.state.bots[0].id;
app.state.direct_mode = false;
app.state.auto_review = false;
app.state.review_ask_rules = vec!["付款前先問我".into()];
app.state.review_allow_rules = vec![];
{
let x = app.state.bot_mut(b).unwrap();
x.abilities = Some(vec!["web".into()]);
x.tools_enabled = false;
x.team = false;
x.allow_rules = vec!["rm".into()];
}
let guards = |app: &App| {
let x = app.state.bot(b).unwrap();
format!("{} {} {:?} {:?} {:?} {} {} {:?}", app.state.direct_mode, app.state.auto_review, app.state.review_ask_rules, app.state.review_allow_rules, x.abilities, x.tools_enabled, x.team, x.allow_rules)
};
let before = guards(&app);
let every = crate::profile::ABILITIES.iter().map(|a| a.0).collect::<Vec<_>>();
let loosen: Vec<(&str, &str, serde_json::Value)> = vec![
("setting", "key", json!({"key": "direct_mode", "value": true})),
("setting", "key", json!({"key": "auto_review", "value": true})),
("setting", "key", json!({"key": "rule_add", "list": "allow", "value": "全部直接做"})),
("setting", "list", json!({"key": "rule_add", "list": "allow", "value": "全部直接做"})),
("setting", "key", json!({"key": "rule_remove", "list": "ask", "value": "付款前先問我"})),
("setting", "list", json!({"key": "rule_remove", "list": "ask", "value": "付款前先問我"})),
("bot", "key", json!({"bot": b, "key": "abilities", "value": every})),
("bot", "key", json!({"bot": b, "key": "tools", "value": true})),
("bot", "key", json!({"bot": b, "key": "team", "value": true})),
];
for (action, field, body) in loosen {
assert!(over_lan(&ctx, &mut app, action, body.clone()).is_err(), "as sent: {body}");
let name = body[field].as_str().unwrap().to_string();
for spelled in [format!("{name} "), format!(" {name}"), format!("\t{name}"), format!("{name}\u{3000}"), format!("{name}\u{a0}"), name.to_uppercase()] {
let mut odd = body.clone();
odd[field] = json!(spelled);
let _ = over_lan(&ctx, &mut app, action, odd.clone());
assert_eq!(guards(&app), before, "{odd}");
}
}
// Tightening still works from there: an ask rule in, an allow rule out, tools off.
assert_eq!(over_lan(&ctx, &mut app, "setting", json!({"key": "rule_add", "list": "ask", "value": "寄信前先問我"})).unwrap()["ok"], true);
assert_eq!(over_lan(&ctx, &mut app, "bot", json!({"bot": b, "key": "allow_remove", "value": "rm"})).unwrap()["ok"], true);
assert_eq!(over_lan(&ctx, &mut app, "bot", json!({"bot": b, "key": "abilities", "value": []})).unwrap()["ok"], true);
assert!(app.state.review_ask_rules.contains(&"寄信前先問我".to_string()) && app.state.bot(b).unwrap().allow_rules.is_empty());
assert_eq!(app.state.bot(b).unwrap().abilities, Some(vec![]));
// An unknown list is said so, not taken as the allow list.
assert!(app.phone_act(&ctx, "setting", &json!({"key": "rule_add", "list": "Ask", "value": "x"}), "owner")["error"].is_string());
assert!(app.state.review_allow_rules.is_empty());
}
fix: 直接連線再補三個放寬的路:/always-approve、匯入帶團隊分享、關機的電腦被算進「每一台」 複審 36420f3 用測試證明的三個繞過,和幾個小的: 1. 在聊天打「/always-approve」(/yolo):直接連線的 api/bots/:id/send 從沒問過檢查, 擁有者身分就開了直接操作和一律放行。現在 remote.rs 在門口先看這句話是不是會放寬的 AnyBot 指令(commands.rs 的 AppCommand::loosens,每個指令都要列在其中一邊,新的指令 一定得決定),是就 403、什麼都不送;status、off 照常。只有門口知道是不是直接連線 (帳號那條路送進來的 Cmd 一模一樣),所以擋在那裡。順便:`--ask` 跑 AnyBot 自己的 指令(沒開一輪)以前結束碼是 1,現在是 0——地圖改在這台電腦上打「/always-approve」。 2. api/act/import_bot 帶著檔案裡的 team:true 就分享給團隊:share 的匯出不寫、匯入不收 team(也清 branch_of、branches),電腦版一樣;lan_guard 把每個 api/act 動作都列在 一邊,沒列到的一律 400,不再默默放行。 3. 可以用的電腦:帳號裡關機的電腦不在清單上,全勾就存成 None(每一台),被排除的那台 開機又能用。現在沒列出的電腦維持原狀,有清單的 Bot 從手機上不會變成「每一台」(帳號 那條路也一樣)。能力沒有這個問題:11 類永遠都列出來,None 只多出以後新版加的類別。 P2:支線的瀏覽器步驟指名 profile 只用在那一步(不再 set_current);支線換掉技能庫已有 技能的檢查跟寫資料夾一樣忽略大小寫;直接連線把 Bot 加進分享給團隊的群組算放寬 (phone_detail 多帶 team);SECURITY.md、account.md、autonomy.md 寫明打開「從手機看 這台電腦的螢幕並操作」時這個保證不成立;autonomy.md「手機用擁有者身分打也可以」改成 帳號連線才行。 P3:phone_act 照原字讀名字的那一半有自己的測試了。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(683 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(沒有漂移,10 個重走都過);新的測試在放回 36420f3 的程式時都失敗(/always-approve 403、沒分類的動作、匯入的 team、關機的電腦、 phone_act 去空白、技能大小寫、支線的瀏覽器步驟、分享群組加成員);verify-anybot: autonomy 照新步驟跑(手機打 /always-approve 被擋、字放回輸入框,--ask 打開),另外 手機打 /yolo 被擋、status 照答、直接連線匯入帶 team:true 的檔案後新 Bot 沒分享、沒分類的 動作 400;branch、browser、profile、phone、market 照地圖跑。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address、 numbers_controls_inside_web_components、drives_a_dashboard,vault 的 fill_live——open 的 參數改了)要人在實機跑、簽名;帳號裡的電腦關機那條要帳號伺服器(只有單元測試);分享 群組要帳號(只有單元測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 12:09:52 +00:00
/// phone_act reads a setting's name exactly as sent, on every road in (the account's too):
/// 「direct_mode 」, 「Tools」, 「update 」 aren't those, and change nothing.
#[test]
fn phone_act_reads_setting_names_exactly() {
let (ctx, mut app) = demo();
let b = app.state.bots[0].id;
app.state.direct_mode = false;
app.state.bot_mut(b).unwrap().tools_enabled = false;
for (action, body) in [
("setting", json!({"key": "direct_mode ", "value": true})),
("setting", json!({"key": " auto_review", "value": true})),
("setting", json!({"key": "rule_add", "list": " allow", "value": "全部直接做"})),
("bot", json!({"bot": b, "key": "Tools", "value": true})),
("bot", json!({"bot": b, "key": "abilities\u{3000}", "value": []})),
("box", json!({"op": "update "})),
] {
assert!(app.phone_act(&ctx, action, &body, "owner")["error"].is_string(), "{body}");
}
assert!(!app.state.direct_mode && !app.state.auto_review && app.state.review_allow_rules.is_empty());
let x = app.state.bot(b).unwrap();
assert!(!x.tools_enabled && x.abilities.is_none());
}
/// A bot file imported from a direct connection: a file that says 「team」 doesn't share the
/// new bot with the team (it got past the guard as an action nobody had classified, and the
/// file's sharing was kept).
#[test]
fn an_imported_bot_is_not_shared_with_the_team() {
let (ctx, mut app) = demo();
let mut x = app.state.bots[0].clone();
x.team = true;
let content = crate::share::export(&x).replacen("\"name\"", "\"team\":true,\"name\"", 1);
let r = over_lan(&ctx, &mut app, "import_bot", json!({"content": content})).expect("importing changes no guard");
let id = r["bot"].as_u64().unwrap();
assert!(!app.state.bot(id).unwrap().team);
}
/// 可以用的電腦 from the phone while a computer of the account is off (so not listed): it
/// keeps how it was. Ticking every computer listed used to make the list "every computer",
/// and a computer the person had left out came back in.
#[test]
fn a_computer_that_is_off_keeps_its_place_in_the_list() {
let (ctx, mut app) = demo();
let b = app.state.bots[0].id;
app.state.remote.host_token = "t".into();
app.state.remote.host_id = "me".into();
*app.rm.peers.lock().unwrap() = vec![("dev1".into(), "筆電".into(), true), ("dev2".into(), "桌機".into(), true)];
let x = app.state.bot(b).unwrap().clone();
let names: Vec<String> = app.every_computer(&x).into_iter().map(|c| c.0).collect();
assert!(names.contains(&"筆電".to_string()) && names.contains(&"桌機".to_string()), "{names:?}");
// Every computer but 筆電; then 筆電 and 桌機 go off.
let kept: Vec<String> = names.iter().skip(1).filter(|n| *n != "筆電").cloned().collect();
app.state.bot_mut(b).unwrap().computers = Some(kept.clone());
*app.rm.peers.lock().unwrap() = vec![("dev1".into(), "筆電".into(), false), ("dev2".into(), "桌機".into(), false)];
let ticked = |app: &mut App| -> Vec<String> {
let d = app.phone_act(&ctx, "detail", &json!({"bot": b}), "owner");
d["may_use"].as_array().unwrap().iter().filter(|m| m["on"] == true).filter_map(|m| m["key"].as_str().map(String::from)).collect()
};
let now = ticked(&mut app);
assert!(over_lan(&ctx, &mut app, "bot", json!({"bot": b, "key": "may_use", "value": now})).is_ok());
assert_eq!(app.state.bot(b).unwrap().computers, Some(kept.clone()), "筆電 stays out, 桌機 stays in");
// From the account too (no guard there): a list stays a list.
let now = ticked(&mut app);
app.phone_act(&ctx, "bot", &json!({"bot": b, "key": "may_use", "value": now}), "owner");
assert_eq!(app.state.bot(b).unwrap().computers, Some(kept));
// A bot with no list (every computer) keeps none while everything listed stays ticked.
app.state.bot_mut(b).unwrap().computers = None;
let now = ticked(&mut app);
app.phone_act(&ctx, "bot", &json!({"bot": b, "key": "may_use", "value": now}), "owner");
assert_eq!(app.state.bot(b).unwrap().computers, None);
}
fix: 十一個小錯——瀏覽器設定檔換得了、支線改不了設定、直接連線的拒絕照實說、手機的標籤和設定頁照實寫 1. 瀏覽器設定檔只能列出:browser 的 action 就是 profiles,裡面的 list/add/use 傳不到 browser_profiles,帶 name 也只列出。現在帶 name 就換到那個設定檔、還沒有就先新增 (profiles_tool 自己判斷,工具定義不變);步驟寫「切換到「…」」。 2. 支線改得了設定:支線的 update_bot 按允許後把主 Bot 改名。update_bot、update_settings、 update_my_profile、teach_skill,和新增/修改/移除連接器或 hook,在支線一律馬上回 「支線改不了設定:回到主線再請它改。」,不跳卡片;ChatGPT 登入登出照樣跳卡。 3. 直接連線的拒絕說「區網連線(沒有加密)」:直接連線是 https,擋的原因是只憑手機密碼。 改成「這會放寬 Bot 能做的事:同一個網路直接連的裝置只能收緊、不能放寬…」;能力、可以 用的電腦只有勾回才擋(勾掉以前也被擋)。 4. 本機網址的卡寫「(在 上)」:Bot 的電腦都開不了瀏覽器時,寫「(在 執行 AnyBot 的這台 電腦 上)」。 5. 手機把監看叫醒的訊息標「例行任務」:照電腦版的標籤表(目標、例行任務、觸發、訊息管道、 來自其他 Bot),加上「監看」;測試確認手機和電腦用同一張表。 6. 步驟名字:replay_skill 寫「重播技能 「記一筆」」(以前「工具 工作資料夾」);例行任務的 送出證據寫「傳訊息給其他 Bot 給 同事:早安」(以前「message_bot 工作資料夾」);只有 檔案步驟會寫資料夾。 7. 執行步驟用的模型的卡寫「自動 → 不分開」(以前「(空) → 「off」」)。 8. ChatGPT 的卡照要做的事寫標題:「…想要登出 ChatGPT 方案」「…想要換 ChatGPT 帳號」 (以前「想要ChatGPT 方案登入」),手機和電腦都是。 9. 正常關掉 AnyBot 時,沒做完的支線寫「AnyBot 關掉了,這條支線停了」(以前「被停止了」, 像使用者按了停止);還在等主線的也一起照實寫。 10. 手機的設定頁只讀一次:狀態版本一變就重讀開著的設定頁,其他頁下次打開重讀(/always-approve 填了預設規則,權限頁不用重新整理)。 11. 沒有 Docker 時手機的電腦頁寫「已是 v14」「這台 Docker 主機沒有 gVisor」:問不到的事送 null,頁面寫「沒有 Docker,現在沒有這台電腦」,不說有沒有 gVisor。 功能地圖:browser、branch、profile、autonomy、models、market、phone、files、replay、 routines、box 的子功能、Bot 那一行、步驟和看到的結果照新行為改;拿掉只在描述錯誤的陷阱 (autonomy 的設定頁不更新、box 的已是 v14)。FEATURES.md 同步。verify-approval-routing: approval_json、approval_body 只改了標題的字,模型的假設不變,rehash coverage.tsv(這個 commit 是新的同步 commit)。 找到但沒修:browser 的 tabs 也一樣,裡面的 switch/new/close 傳不到 browser_tabs(工具 說明本身就叫模型用 action 帶),要改工具定義才修得好。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(676 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(10 個重走都過);新測試先在拿掉修正的程式上跑過、 11 個都失敗;verify-anybot 照地圖跑 box、browser、models、files、replay、routines、branch、 autonomy、profile、phone、market 的步驟,全部通過(證據在 target/verify-anybot/)。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 會開真的瀏覽器,要人在實機跑、簽名;本機網址的卡按「允許」(會開真的瀏覽器);電腦版視窗 上的卡片標題和支線卡(要開視窗);帳號連線的手機(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 09:44:16 +00:00
/// A ChatGPT card says what it asks — here a 支線 signing out — not the tool's name (it read
/// 「支線:…想要ChatGPT 方案登入」 for a logout).
#[test]
fn a_chatgpt_card_says_whether_it_signs_in_or_out() {
let (_ctx, mut app) = demo();
let main = app.state.bots[0].clone();
let mut br = main.clone();
br.id = 9003;
br.branch_of = main.id;
let call = crate::model::ToolCall { id: "c1".into(), name: crate::chatgpt::TOOL.into(), args: r#"{"action":"logout"}"#.into(), status: crate::model::ToolStatus::Waiting };
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
br.messages = vec![crate::model::Message::user("登出"), crate::model::Message { tool_calls: vec![call], ..crate::model::Message::assistant("", "x") }].into();
fix: 十一個小錯——瀏覽器設定檔換得了、支線改不了設定、直接連線的拒絕照實說、手機的標籤和設定頁照實寫 1. 瀏覽器設定檔只能列出:browser 的 action 就是 profiles,裡面的 list/add/use 傳不到 browser_profiles,帶 name 也只列出。現在帶 name 就換到那個設定檔、還沒有就先新增 (profiles_tool 自己判斷,工具定義不變);步驟寫「切換到「…」」。 2. 支線改得了設定:支線的 update_bot 按允許後把主 Bot 改名。update_bot、update_settings、 update_my_profile、teach_skill,和新增/修改/移除連接器或 hook,在支線一律馬上回 「支線改不了設定:回到主線再請它改。」,不跳卡片;ChatGPT 登入登出照樣跳卡。 3. 直接連線的拒絕說「區網連線(沒有加密)」:直接連線是 https,擋的原因是只憑手機密碼。 改成「這會放寬 Bot 能做的事:同一個網路直接連的裝置只能收緊、不能放寬…」;能力、可以 用的電腦只有勾回才擋(勾掉以前也被擋)。 4. 本機網址的卡寫「(在 上)」:Bot 的電腦都開不了瀏覽器時,寫「(在 執行 AnyBot 的這台 電腦 上)」。 5. 手機把監看叫醒的訊息標「例行任務」:照電腦版的標籤表(目標、例行任務、觸發、訊息管道、 來自其他 Bot),加上「監看」;測試確認手機和電腦用同一張表。 6. 步驟名字:replay_skill 寫「重播技能 「記一筆」」(以前「工具 工作資料夾」);例行任務的 送出證據寫「傳訊息給其他 Bot 給 同事:早安」(以前「message_bot 工作資料夾」);只有 檔案步驟會寫資料夾。 7. 執行步驟用的模型的卡寫「自動 → 不分開」(以前「(空) → 「off」」)。 8. ChatGPT 的卡照要做的事寫標題:「…想要登出 ChatGPT 方案」「…想要換 ChatGPT 帳號」 (以前「想要ChatGPT 方案登入」),手機和電腦都是。 9. 正常關掉 AnyBot 時,沒做完的支線寫「AnyBot 關掉了,這條支線停了」(以前「被停止了」, 像使用者按了停止);還在等主線的也一起照實寫。 10. 手機的設定頁只讀一次:狀態版本一變就重讀開著的設定頁,其他頁下次打開重讀(/always-approve 填了預設規則,權限頁不用重新整理)。 11. 沒有 Docker 時手機的電腦頁寫「已是 v14」「這台 Docker 主機沒有 gVisor」:問不到的事送 null,頁面寫「沒有 Docker,現在沒有這台電腦」,不說有沒有 gVisor。 功能地圖:browser、branch、profile、autonomy、models、market、phone、files、replay、 routines、box 的子功能、Bot 那一行、步驟和看到的結果照新行為改;拿掉只在描述錯誤的陷阱 (autonomy 的設定頁不更新、box 的已是 v14)。FEATURES.md 同步。verify-approval-routing: approval_json、approval_body 只改了標題的字,模型的假設不變,rehash coverage.tsv(這個 commit 是新的同步 commit)。 找到但沒修:browser 的 tabs 也一樣,裡面的 switch/new/close 傳不到 browser_tabs(工具 說明本身就叫模型用 action 帶),要改工具定義才修得好。 已驗證: env -u 金鑰… DOCKER_HOST=unix:///nonexistent cargo test(676 過、46 ignored)、 cargo clippy --bin anybot --all-targets -D warnings、sh deploy/ci/lint-sh.sh、 verify-approval-routing run.sh --replay(10 個重走都過);新測試先在拿掉修正的程式上跑過、 11 個都失敗;verify-anybot 照地圖跑 box、browser、models、files、replay、routines、branch、 autonomy、profile、phone、market 的步驟,全部通過(證據在 target/verify-anybot/)。 未驗證: --ignored 的實機瀏覽器測試(botbrowser 的 reads_a_real_page、a_persons_firefox_profile、 a_finished_job_quits_its_firefox、a_finished_job_quits_its_chrome,browser 的 lines_go_in_whole_and_numbers_stay_put、a_send_is_seen_with_the_post_it_answers_and_its_own_address) 會開真的瀏覽器,要人在實機跑、簽名;本機網址的卡按「允許」(會開真的瀏覽器);電腦版視窗 上的卡片標題和支線卡(要開視窗);帳號連線的手機(要帳號伺服器)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 09:44:16 +00:00
app.state.branch_bots.push(br);
let (tx, _rx) = std::sync::mpsc::channel();
app.approvals.insert(9003, crate::providers::Approval { call_id: "c1".into(), tool: crate::chatgpt::TOOL.into(), reason: "登出 ChatGPT:用 ChatGPT 方案的 Bot 會沒辦法回答,直到再登入。".into(), grant: String::new(), reply: tx, kind: ApprovalKind::Action });
let cards = app.phone_cards(&main);
let card = cards.iter().find(|c| c["target"] == 9003).cloned().unwrap_or_default();
assert_eq!(card["title"], format!("支線:{} 想要登出 ChatGPT 方案", main.name), "{cards:?}");
assert_eq!(crate::chatgpt::ask_label(r#"{"action":"switch_account"}"#), "換 ChatGPT 帳號");
}
fix: 等你允許的卡片第四輪——螢幕電腦照樣跑自己的 Notification hook;新卡重新送到手機有測試 獨立審查(8426638,沒有 P0/P1)提的: - 第三輪的退步:螢幕電腦不推到手機時,連自己的 Notification hook 也跳過了(remote::notify_about 先叫 hooks::notification 才推)。hooks 是每台電腦自己的(那台資料夾的 hooks/hooks.json),safety 寫 「Notification 跟著通知跑」:螢幕電腦現在照樣跑自己的 hook,只有推到手機那一步是大腦的。沒有加測試: 整段通知只在非示範模式跑(測試用示範的 App),hook 又是在執行緒上跑使用者自己的程式。 - 新測試 a_card_in_anothers_place_is_published_again:同一個 call_0、同樣的字的新卡(和支線的新卡) 會讓手機畫面的簽章改變、重新送出,手機和螢幕電腦才拿得到新卡的 key(不然每個回答都被擋)。 - verify-approval-routing 的 REPLAY 補上 a_question_in_anothers_place_starts_with_nothing_picked、 the_answer_after_direct_mode_let_its_card_through_says_nothing 和上面的新測試(共 10 個);「沒有 放進模型」寫上螢幕電腦照樣跑自己的 hook;對過模型後 rehash(這個 commit 就是新的同步 commit)。 - 功能地圖 chat:換成另一張問題卡(就算編號一樣)就從第一題、什麼都沒選重新開始。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)649 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 先報 brain.new_approval_keyed 改過(結束碼 3),照技能對過(螢幕電腦還是不推到手機,只多跑自己的 hook,模型不變)後 rehash,run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、10 個重走測試通過;簽章拿掉主線卡的 key、拿掉支線卡的 key,新測試都抓到,改回後一致 未驗證: 螢幕電腦的 Notification hook 真的跑(要非示範模式的螢幕電腦和一個 hook,沒有實機);手機頁面看得到的行為這一輪沒變,沒有重跑 verify-anybot;--ignored 的實機測試(留給人跑) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:45:57 +00:00
/// A card that takes another's place with the same call id (call_0 every round) and the same
/// words — the same step asking again — is published again (the view's signature changes),
/// so the phone and the screens get the new card's key: with the old one every answer would
/// be refused. A 支線's card the same.
feat: 交付確認——Bot 傳的檔案記下在哪台裝置顯示、點開沒,沒顯示出來叫醒 Bot 一次 起因:Bot 產了一張圖、send_file 回報成功、Bot 一直說「已完成」,但圖一直沒出現在使用者 的聊天裡,系統完全不知道。「完成」改成:你看得到、能用,而且系統知道你收到了。 - 附件有身分:attach::store/store_bytes 給每個附件一個編號(舊資料讀得進來,沒有回報的 附件寫出來跟以前一字不差);螢幕電腦把路徑換成本機副本時編號不變,回報一律用編號。 - 三層狀態記在大腦那則附件上:已在聊天 → 已在某台裝置顯示 → 點開了,或「顯示失敗」加 原因;每筆記哪台裝置和時間,同一台同一種只記第一次,最多 12 筆。記號和「已顯示/已 點開」只看擁有者自己的裝置;團隊成員、管理員的裝置只記下(最多 4 筆)、不叫醒。 - 誰回報: - 手機:POST api/bots/<id>/seen(團隊成員也可以)。圖片真的載入、在畫面裡、頁面在前面 才算顯示;預覽真的畫出來(文字、表格、圖、PDF 的頁、能播的錄音影片)或存到手機才算 點開;大腦回 404/422/500 或圖片再抓一次還是解不開算失敗;斷線、408、429、502–504 算網路問題、不算。不排隊,每次開頁面每個附件每種只報一次。 - 大腦自己的視窗(「這台電腦」):卡片在畫面裡停留 0.8 秒、視窗在前面才算顯示(聊天剛 打開時從頂端畫的那一格、「回到最新訊息」捲過去的不算);點開算點開;檔案不見了算失敗。 - 螢幕電腦:api/sync/act 的 seen(大腦用它的名字記,另開執行緒送、不擋其他訊息);抓大腦 檔案被回 404 算失敗(以前完全不報),網路斷了不算。 - 裝置名稱、原因都由大腦從固定的字選,頁面送來的字不會原樣進到 Bot 那裡。 - 同步:remote_signature、msg_sig、聊天存檔的 chat_mark 都算進回報;message_json 對 Bot 傳 的附件輸出 id、delivery、seen。 - 畫面:Bot 傳來的附件下面一個灰色小記號——✓ 已在聊天、✓✓ 已在某台裝置顯示、點開過的 ✓✓ 是強調色;手機點記號跳出清單、電腦版滑過看清單(每台裝置、時間、顯示/點開/失敗和 原因)。使用者自己附的檔案沒有記號。失敗不另外跳字;手機上解不開的圖也顯示原本的 「這張圖讀不到」(以前是一塊空白)。 - Bot 知道:send_file 的結果改成「已放進聊天(…附件 <編號>)…不要說使用者已經看到」;之後 的回合結果後面帶一行〔交付狀態:…〕(日期寫死,不會每天變);系統提示加一句以那個狀態 為準、使用者問收到沒照它回答。 - 叫醒:擁有者的裝置回報顯示失敗、而且還沒有擁有者的裝置顯示過,叫醒那個 Bot 一次(新的 「[交付]」標籤,視窗和手機的 WAKE_TAGS 一起改),只寫附件編號和副檔名、哪台、為什麼 (不寫檔名:檔名可能來自外面,這則訊息帶著擁有者的信任開一輪),請它換方式交付。只在 「傳出這個檔案的那一輪是擁有者開的」時叫醒:訊息管道的人、團隊成員、別的 Bot 要的檔案、 群組聊天、給使用者看畫面的截圖、支線帶回的檔案都只記下。擁有者上次說話之後最多兩次; Bot 在忙、叫醒在排隊時別台顯示了就取消。 - docs/feature-map/deliver.md 新增子功能 deliver-confirm、使用者怎麼到、三條 verify-anybot 步驟、陷阱;FEATURES.md 同步。verify-anybot 的假模型照規則回答時多記 tool_results(這個 請求裡每個工具結果的結尾),用來證明 Bot 讀到〔交付狀態〕。 合進主線(接在手機、螢幕電腦「沒網路照樣能用」之後) - 手機頁面:apiOnce 用主線那行(已經帶 e.status、e.unsure);離開聊天先存一份、回到聊天看 畫面裡的附件,兩個都留。螢幕電腦:兩邊新增的測試都留,離線那輪的測試附件補上新欄位。 - 合併後跑 deliver.md 時發現(以前就有、離線那輪重畫變多後才明顯):手機聊天每次重畫, 圖片都先退回檔名再載入、長高,「停在最新訊息」只在重畫那一刻判斷,幾張圖之後最新那則 被推到畫面外、也就永遠不算「顯示」。改成:已經讀到的圖重畫時直接沿用;停在底部時, 內容在畫完之後變高(圖片載入)也跟著停在底部,往上捲在讀的不動;比螢幕高的問題卡留在 它的問題那裡,不被拉到底。FEATURES.md 同步。 已驗證: cargo test 全綠(主程式 767,含 featuremap::、layout_audit::、tool_specs_are_locked、 approval_decisions_are_characterized;新增 attach、deliver_ui 6 條、remote、mirror_ui、 remote_ui、app 的 group_history 與系統提示、layout_audit 的記號滑過清單);verify-anybot deliver.md 全部步驟照貼從頭跑過(傳檔預覽、機密不傳、伺服器上打不開、沒登入沒有發佈、 交付確認顯示/點開/Bot 讀到狀態、顯示失敗叫醒一次且重開後仍是一次),另手動驗過刪掉大腦 副本後手機記「大腦上找不到這個檔案」、已點開的不叫醒;十輪乾淨脈絡獨立審查,最後一輪無 P0/P1。 合進主線後:cargo test 774 通過;verify-approval-routing --replay 跟合併前一樣(AllSurfaces 通過、 replay 10 個都過,「改過了」的 5 段在 HEAD 就是如此);verify-anybot 在新的 scratch 上把 deliver.md、phone.md、cards.md 全部步驟各從頭跑過都通過(含「沒網路也打得開」「斷線又回來」、 問題卡一題一題走);另外實跑:往上捲在讀時,新傳來的圖不會把畫面拉回底部。合併的部分另做 一輪乾淨脈絡獨立審查:沒有 P0/P1,兩條 P2(高的問題卡被拉到底、重畫先用原檔)已修,一條 P2(超過 40 張圖時錯誤處理掛得晚,不會誤報)留著。 未驗證: 真的 iPhone/Android(Safari 的 IntersectionObserver、主畫面 App)——要實機;螢幕電腦 連大腦的真實路徑——要另一台登入同帳號的 AnyBot;桌面視窗的記號與 0.8 秒停留——要開視窗 (ABV_ALLOW_WINDOW,要使用者同意),只有行程內繪圖測試;團隊成員、管理員經帳號伺服器 回報——要帳號伺服器與第二個帳號。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5JgTkqJjkgMtrEXrn
2026-11-20 05:38:58 +00:00
/// 交付確認: a device's word on a file the bot handed over reaches the phones (the ✓✓).
#[test]
fn a_files_delivery_is_published() {
let (ctx, mut app) = demo();
let bot = app.state.bots[0].id;
let a = crate::attach::Attachment { name: "貓.png".into(), path: "/x/貓.png".into(), image: true, id: "a1b2c3d4e5f6".into(), ..Default::default() };
app.state.bot_mut(bot).unwrap().messages.push(Message { attachments: vec![a], ..Message::assistant("好了", "") });
let before = app.remote_signature();
app.delivery_seen(&ctx, bot, "a1b2c3d4e5f6", "iPhone", crate::attach::SeenKind::Shown, "", true);
assert_ne!(app.remote_signature(), before);
let a = &app.state.bot(bot).unwrap().messages.last().unwrap().attachments[0];
assert_eq!((a.seen[0].device.as_str(), a.delivery()), ("iPhone", crate::attach::Delivery::Shown));
}
fix: 等你允許的卡片第四輪——螢幕電腦照樣跑自己的 Notification hook;新卡重新送到手機有測試 獨立審查(8426638,沒有 P0/P1)提的: - 第三輪的退步:螢幕電腦不推到手機時,連自己的 Notification hook 也跳過了(remote::notify_about 先叫 hooks::notification 才推)。hooks 是每台電腦自己的(那台資料夾的 hooks/hooks.json),safety 寫 「Notification 跟著通知跑」:螢幕電腦現在照樣跑自己的 hook,只有推到手機那一步是大腦的。沒有加測試: 整段通知只在非示範模式跑(測試用示範的 App),hook 又是在執行緒上跑使用者自己的程式。 - 新測試 a_card_in_anothers_place_is_published_again:同一個 call_0、同樣的字的新卡(和支線的新卡) 會讓手機畫面的簽章改變、重新送出,手機和螢幕電腦才拿得到新卡的 key(不然每個回答都被擋)。 - verify-approval-routing 的 REPLAY 補上 a_question_in_anothers_place_starts_with_nothing_picked、 the_answer_after_direct_mode_let_its_card_through_says_nothing 和上面的新測試(共 10 個);「沒有 放進模型」寫上螢幕電腦照樣跑自己的 hook;對過模型後 rehash(這個 commit 就是新的同步 commit)。 - 功能地圖 chat:換成另一張問題卡(就算編號一樣)就從第一題、什麼都沒選重新開始。 已驗證: 完整 cargo test(env -u 各家金鑰、DOCKER_HOST=unix:///nonexistent、ANYBOT_HF_BASE=http://127.0.0.1:9)649 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 先報 brain.new_approval_keyed 改過(結束碼 3),照技能對過(螢幕電腦還是不推到手機,只多跑自己的 hook,模型不變)後 rehash,run.sh --replay:沒有漂移、AllSurfaces 通過(421324 個狀態)、CanAnswer 找到三個地方都答得到、10 個重走測試通過;簽章拿掉主線卡的 key、拿掉支線卡的 key,新測試都抓到,改回後一致 未驗證: 螢幕電腦的 Notification hook 真的跑(要非示範模式的螢幕電腦和一個 hook,沒有實機);手機頁面看得到的行為這一輪沒變,沒有重跑 verify-anybot;--ignored 的實機測試(留給人跑) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 03:45:57 +00:00
#[test]
fn a_card_in_anothers_place_is_published_again() {
let (_ctx, mut app) = demo();
let main = app.state.bots[0].clone();
let mut br = main.clone();
br.id = 9002;
br.branch_of = main.id;
br.messages.clear();
app.state.branch_bots.push(br);
let card = |app: &mut App, id: u64, key: &str| {
let (tx, _) = std::sync::mpsc::channel();
app.approvals.insert(id, crate::providers::Approval { call_id: "call_0".into(), tool: "shell".into(), reason: "執行指令:rm -rf build".into(), grant: String::new(), reply: tx, kind: ApprovalKind::Action });
app.ask_keys.insert(id, key.into());
};
card(&mut app, main.id, "k1");
let before = app.remote_signature();
card(&mut app, main.id, "k2");
assert_ne!(app.remote_signature(), before, "the main bot's new card is published");
card(&mut app, 9002, "b1");
let before = app.remote_signature();
card(&mut app, 9002, "b2");
assert_ne!(app.remote_signature(), before, "the 支線's new card is published");
}
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
/// 「全部允許,之後直接操作」 on a "may I use the computer?" card: 直接操作 lets that card
/// through as it comes on, then the phone's answer for it arrives — maybe after the next card
/// is already up. That answer takes nothing, and isn't told as a stale one (the card was done).
#[test]
fn the_answer_after_direct_mode_let_its_card_through_says_nothing() {
let (ctx, mut app) = demo();
let bot = app.state.bots[0].id;
let (tx, first) = std::sync::mpsc::channel();
app.approvals.insert(bot, crate::providers::Approval { call_id: "call_0".into(), tool: "shell".into(), reason: "在你的電腦上執行任務:ls".into(), grant: String::new(), reply: tx, kind: ApprovalKind::EnableThisComputer });
app.ask_keys.insert(bot, "k1".into());
app.enable_direct_mode();
assert!(matches!(first.try_recv(), Ok(ApprovalAnswer::Always(_))), "直接操作 let it through");
let (tx, second) = std::sync::mpsc::channel();
app.approvals.insert(bot, crate::providers::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(bot, "k2".into());
app.remote_cmd(&ctx, Cmd::Answer { bot, answer: "once".into(), text: String::new(), call: "k1".into(), notice: false, screen: false });
assert!(second.try_recv().is_err() && app.approvals.contains_key(&bot), "the next card still waits");
assert!(!app.state.bot(bot).unwrap().messages.iter().any(|m| m.note && m.text.contains("沒有用上")), "no stale-answer note");
// Any other old key still is one.
app.remote_cmd(&ctx, Cmd::Answer { bot, answer: "once".into(), text: String::new(), call: "k0".into(), notice: false, screen: false });
assert!(app.state.bot(bot).unwrap().messages.iter().any(|m| m.note && m.text.contains("沒有用上")));
}
#[test]
fn the_phone_does_what_the_desktop_does() {
let (ctx, mut app) = demo();
assert!(app.demo && app.state.bots.len() >= 2);
let b = app.state.bots[0].id;
let act = |app: &mut App, what: &str, body: serde_json::Value, role: &str| app.phone_act(&ctx, what, &body, role);
// The actions a bot can take, by the same appctl path.
let v = act(&mut app, "app", json!({"bot": b, "name": "create_routine", "args": {"title": "早報", "prompt": "整理新聞", "schedule": {"frequency": "daily", "time": "08:00"}}}), "owner");
assert_eq!(v["ok"], true, "{v}");
let rid = app.state.bot(b).unwrap().routines.iter().find(|r| r.title == "早報").map(|r| r.id).expect("routine made");
assert_eq!(act(&mut app, "app", json!({"bot": b, "name": "update_routine", "args": {"id": rid, "paused": true}}), "owner")["ok"], true);
assert!(app.state.bot(b).unwrap().routines.iter().any(|r| r.id == rid && r.paused));
assert_eq!(act(&mut app, "app", json!({"bot": b, "name": "remember", "args": {"fact": "週末不排工作"}}), "owner")["ok"], true);
assert!(app.state.bot(b).unwrap().memories.contains(&"週末不排工作".to_string()));
// Only the app actions a bot has; nothing else through this door.
assert!(act(&mut app, "app", json!({"bot": b, "name": "write_page", "args": {}}), "owner")["error"].is_string());
assert!(act(&mut app, "nothing", json!({}), "owner")["error"].is_string());
// A bot's switches, checked like the editor checks them.
assert_eq!(act(&mut app, "bot", json!({"bot": b, "key": "shape", "value": "star"}), "owner")["ok"], true);
assert_eq!(app.state.bot(b).unwrap().shape, "star");
assert!(act(&mut app, "bot", json!({"bot": b, "key": "shape", "value": "<script>"}), "owner")["error"].is_string());
assert_eq!(act(&mut app, "bot", json!({"bot": b, "key": "pinned", "value": true}), "owner")["ok"], true);
assert!(app.state.bot(b).unwrap().pinned);
// 團隊: an admin keeps what the phone always let them do, and small chat things…
assert_eq!(act(&mut app, "bot", json!({"bot": b, "key": "unread", "value": true}), "admin")["ok"], true);
assert!(act(&mut app, "detail", json!({"bot": b}), "admin")["id"].is_u64());
// …but making, changing or deleting bots, routines, memories, pages and folders is the owner's.
for (what, body) in [
("app", json!({"bot": b, "name": "update_routine", "args": {"id": rid, "paused": false}})),
("app", json!({"bot": b, "name": "create_bot", "args": {"name": "x"}})),
("app", json!({"bot": b, "name": "remember", "args": {"fact": "x"}})),
("bot", json!({"bot": b, "key": "pinned", "value": false})),
("bot", json!({"bot": b, "key": "shape", "value": "cloud"})),
("group_chat", json!({"members": [b]})),
("clear", json!({"bot": b})),
("delete_page", json!({"id": 1})),
("box", json!({"op": "snapshot"})),
] {
assert!(act(&mut app, what, body.clone(), "admin")["error"].is_string(), "admin did {what} {body}");
}
assert!(app.state.bot(b).unwrap().routines.iter().any(|r| r.id == rid && r.paused));
assert!(app.state.bot(b).unwrap().pinned && app.state.bot(b).unwrap().shape == "star");
// The owner's alone: permissions, a bot's computer tools, deleting a bot.
assert!(act(&mut app, "setting", json!({"key": "auto_review", "value": true}), "admin")["error"].is_string());
assert!(act(&mut app, "bot", json!({"bot": b, "key": "tools", "value": true}), "admin")["error"].is_string());
assert!(act(&mut app, "delete_bot", json!({"bot": b}), "admin")["error"].is_string());
assert_eq!(act(&mut app, "setting", json!({"key": "rule_add", "list": "ask", "value": "付款前先問我"}), "owner")["ok"], true);
assert!(app.state.review_ask_rules.contains(&"付款前先問我".to_string()));
fix: 連接器「一律允許」過也照樣式的「一律詢問」問;審核員讀參數有上限;hook 和規則同一張卡 使用者的決定:樣式寫的「一律詢問」(`connector(…)`,只比對、不問模型)蓋過連接器的「一律允許」。 以前 `mcp:slack` 一律允許過,`connector(slack__post_message)` 就擋不住。現在: - steps.rs 的 connector_decision(連接器一步的第 6–8 關,一個地方):先比對「一律詢問」樣式—— 符合就跳卡片寫那條規則、沒有「一律允許」(一律允許過、直接操作開著都一樣);再看一律允許; 其他照舊交給 reviewed()(自動審核/直接操作)。 - 用一般的話寫的規則不看一律允許過的連接器(使用者選的:不要每一步都問模型);地圖、FEATURES、 SECURITY 照實寫:直接操作的三條預設擋不住一律允許過的連接器,要擋就寫成樣式。以前的一律允許照樣有效。 - 一律放行、自動審核關著:不比對(跟其他步驟一樣)。 審查的 P2 一起改: - 審核員讀的參數有上限:4000 字以內全部,更長的給前 3000、後 1000,中間寫省略了幾字 (整段塞進去會撐爆模型的上下文、審核失敗);卡片照舊前 160 字。 - hook 的「ask」跟規則放在同一張卡(以前 run_call 先問一張、Connector 再問一張);run_call 的 通用 hook 詢問不再管 Connector。 - 新增 `connector(…)` 規則對不上任何連接器的工具(顯示名稱、大小寫、中文名稱的代號、64 字截斷) 時說出來:mcp::rule_names_nothing;電腦的設定頁在那條規則下面寫,手機新增時跳「已新增。不過…」。 Bot 沒有能加規則的工具,不用改。 - 地圖的用字:autonomy-still-asks、autonomy-review、autonomy-patterns 寫出一律允許過的例外; connectors 的陷阱不再一句寫「直接操作不問」又寫「直接操作也一樣」。 - connectors 加真的步驟「一律允許也照樣式問」;autonomy 原本的連接器步驟搬過去(autonomy 快到 9,000 字),autonomy 留走不到的步驟指過去。 特性表(新的 connector_decisions_are_characterized,38 列):一律允許 有/無 × 直接操作 有/無 × 規則(關著、詢問樣式、允許樣式、兩種樣式、別的連接器的樣式、話寫的規則〔審核員說詢問/都不符合/ 答不出來〕、允許樣式+話寫的詢問),加上 hook 兩列;每列寫 Allow/Allow+note/Ask[一律允許會記的] 和原因、問了模型幾次。tool_specs_are_locked、approval_decisions_are_characterized 沒有 diff。 沒改 remote.rs(loosens_guard 沒碰)。 已驗證: 全部 cargo test(不帶金鑰、DOCKER_HOST 指到不存在)679 通過;新的 an_ask_pattern_wins_over_a_connectors_grant、 a_hook_ask_and_a_rule_make_one_card_for_a_connector_step 在改之前失敗(一律允許過照跑、兩張卡), a_failed_review_asks_about_a_connector_step、the_reviewer_reads_a_huge_argument_by_its_ends、 a_connector_rule_that_names_nothing_is_said_so、connector_decisions_are_characterized、phone 的 rule_add 提醒; clippy -D warnings、lint-sh、verify-approval-routing run.sh --replay(跟基準一樣); verify-anybot:connectors 每一步可跑的照 md 原文冷跑全過(target/verify-anybot/20261118-180143: 打錯大小寫的規則跳提醒、一律允許過的 e0 照樣跳卡片、只有允許/拒絕,allow_rules 還是 ["mcp:echo"]), autonomy 也全過(-180216) 未驗證: 電腦設定頁那行提醒的樣子(要開視窗);直接操作那一半的實機(區網的手機打不開,用 app 層測試); --ignored 的實機測試 未簽: 審批路徑——要人類簽名才能合併,沒有合併、沒有推 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5sXAsDLzxz6UZJgoC
2026-11-18 11:18:38 +00:00
// A connector(…) rule no connector answers to: added, and the person is told why it won't match.
let warned = act(&mut app, "setting", json!({"key": "rule_add", "list": "ask", "value": "connector(Nobody__*)"}), "owner");
assert!(warned["ok"] == true && warned["text"].as_str().is_some_and(|t| t.starts_with("已新增。不過") && t.contains("對不上")), "{warned}");
assert_eq!(act(&mut app, "setting", json!({"key": "rule_remove", "list": "ask", "value": "connector(Nobody__*)"}), "owner")["ok"], true);
assert_eq!(act(&mut app, "setting", json!({"key": "rule_remove", "list": "ask", "value": "付款前先問我"}), "owner")["ok"], true);
assert!(!app.state.review_ask_rules.contains(&"付款前先問我".to_string()));
// 群組聊天 as the desktop's menu makes it.
let others: Vec<u64> = app.state.bots.iter().filter(|x| x.members.is_empty()).map(|x| x.id).take(2).collect();
let g = act(&mut app, "group_chat", json!({"members": others}), "owner");
let gid = g["bot"].as_u64().expect("group made");
assert_eq!(app.state.bot(gid).unwrap().members, others);
// Deleting (the owner): gone, and there is still a main bot.
assert_eq!(act(&mut app, "delete_bot", json!({"bot": gid}), "owner")["ok"], true);
assert!(app.state.bot(gid).is_none() && app.state.bot(app.state.primary_bot).is_some());
}
技能: / 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
/// 技能 from a screen are the brain's to do: a folder from that computer lands on the brain's
/// disk whole (text and binary files), and a delete takes the folder too, so the next start
/// doesn't bring the skill back.
#[test]
fn a_screen_hands_a_skill_to_the_brain_and_takes_it_away() {
let (ctx, mut app) = demo();
let name = format!("螢幕交來的技能-{}", std::process::id());
let src = std::env::temp_dir().join(format!("anybot-screen-skill-{}", std::process::id()));
std::fs::create_dir_all(src.join("scripts")).unwrap();
std::fs::write(src.join("SKILL.md"), format!("---\nname: {name}\ndescription: 測試用\n---\n\n先跑 scripts/go.py\n")).unwrap();
std::fs::write(src.join("scripts/go.py"), "print('hi')\n").unwrap();
std::fs::write(src.join("scripts/logo.bin"), [0u8, 159, 146, 150]).unwrap();
let pkg = crate::skills::package_from_path(&src).unwrap();
// (The brain never sees the screen's disk.)
std::fs::remove_dir_all(&src).unwrap();
let r = app.phone_act(&ctx, "skill", &json!({"package": pkg}), "owner");
assert_eq!(r["ok"], true, "{r}");
let k = app.state.skills.iter().find(|k| k.name == name).cloned().expect("on the brain's list");
assert_eq!(k.resources, ["scripts/go.py", "scripts/logo.bin"]);
assert_eq!(crate::skills::read_resource(&k, "scripts/go.py").unwrap(), "print('hi')\n");
let dir = crate::skills::resolve_skill_dir(&k).expect("a folder on the brain");
assert_eq!(std::fs::read(dir.join("scripts/logo.bin")).unwrap(), [0u8, 159, 146, 150]);
// Deleted from the screen: off the list and off the disk.
assert_eq!(app.phone_act(&ctx, "skill", &json!({"name": name, "remove": true}), "owner")["ok"], true);
assert!(!dir.exists());
crate::memory::merge_skill_files(&mut app.state.skills);
assert!(!app.state.skills.iter().any(|k| k.name == name), "a restart doesn't bring it back");
// Only the owner's.
assert!(app.phone_act(&ctx, "skill", &json!({"builtin": "pdf"}), "admin")["error"].is_string());
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone - 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API): servers reached by address only (a package would have to run on the brain, which may have no Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name that only says "mcp" (com.notion/mcp) reads as whose it is (notion). - 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown unmasked with what to put there (the key's description, an address variable's choices). 新增 stays off while a 「{…}」 is left. - The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key or the address part and the brain adds it (the 「mcp」 action's new `add`). - A server that answers 401 (or a 403 asking for a login) with no key given now says it signs people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old. - mcpservers.org and the like are pages for people behind a browser check, with no list a program may read, so the market uses the registry. - Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`. - Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
}
/// A connector renamed on a screen: the brain renames its own entry — its keys, its place in
/// the list and its sign-in stay — and refuses an empty or taken name.
#[test]
fn the_brain_renames_a_connector_for_a_screen() {
let (ctx, mut app) = demo();
let tag = crate::httpd::random_hex(4);
let (gh, other) = (format!("gh-{tag}"), format!("x-{tag}"));
let server = |n: &str, url: &str| crate::mcp::Server { name: n.into(), url: url.into(), password: "pw".into(), enabled: true, ..Default::default() };
app.state.mcp_servers = vec![server(&gh, "https://gh.example/mcp"), server(&other, "https://x.example/mcp")];
crate::mcp_oauth::save_for_test(&gh, crate::mcp_oauth::Tokens { access: "tok".into(), url: "https://gh.example/mcp".into(), ..Default::default() });
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
app.state.bots[0].allow_rules.push(format!("mcp:{gh}"));
let new = format!("{gh}-work");
assert_eq!(app.phone_act(&ctx, "mcp", &json!({"name": gh, "rename": new}), "owner")["ok"], true);
let first = &app.state.mcp_servers[0];
assert_eq!((first.name.as_str(), first.password.as_str()), (new.as_str(), "pw"), "same place, same keys");
assert_eq!(crate::mcp_oauth::bearer(&new, "https://gh.example/mcp").as_deref(), Some("tok"));
assert!(crate::mcp_oauth::tokens(&gh).is_none());
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
assert!(app.state.bots[0].allow_rules.contains(&format!("mcp:{new}")) && !app.state.bots[0].allow_rules.contains(&format!("mcp:{gh}")), "「一律允許」 follows it");
for bad in [other.as_str(), " "] {
assert!(app.phone_act(&ctx, "mcp", &json!({"name": new, "rename": bad}), "owner")["error"].is_string(), "{bad:?}");
}
assert!(app.phone_act(&ctx, "mcp", &json!({"name": new, "rename": "y"}), "admin")["error"].is_string(), "the owner's only");
// Removed: its 「一律允許」 go with it (one given its name later starts from nothing).
assert_eq!(app.phone_act(&ctx, "mcp", &json!({"name": new, "remove": true}), "owner")["ok"], true);
assert!(!app.state.bots[0].allow_rules.iter().any(|r| r.starts_with("mcp:gh-")));
let _ = crate::mcp_oauth::logout(&new);
}
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone - 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API): servers reached by address only (a package would have to run on the brain, which may have no Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name that only says "mcp" (com.notion/mcp) reads as whose it is (notion). - 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown unmasked with what to put there (the key's description, an address variable's choices). 新增 stays off while a 「{…}」 is left. - The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key or the address part and the brain adds it (the 「mcp」 action's new `add`). - A server that answers 401 (or a 403 asking for a login) with no key given now says it signs people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old. - mcpservers.org and the like are pages for people behind a browser check, with no list a program may read, so the market uses the registry. - Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`. - Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
/// The phone's 公用市集 adds a server reached by address, with its key; never one with a
/// 「{…}」 left in it, never twice under one name, only the owner.
#[test]
fn the_phone_adds_a_connector_from_the_public_market() {
let (ctx, mut app) = demo();
let add = |name: &str, url: &str, header: &str| json!({"add": {"name": name, "url": url, "header": header}});
let r = app.phone_act(&ctx, "mcp", &add("Smithery", "https://server.smithery.ai/x/mcp", "Authorization: Bearer sk-1"), "owner");
assert_eq!(r["ok"], true, "{r}");
let m = app.state.mcp_servers.iter().find(|m| m.name == "Smithery").expect("added");
assert_eq!((m.url.as_str(), m.headers.get("Authorization").map(String::as_str), m.enabled), ("https://server.smithery.ai/x/mcp", Some("Bearer sk-1"), true));
assert_eq!(app.phone_act(&ctx, "mcp", &add("Smithery", "https://y.example/mcp", ""), "owner")["ok"], true);
assert!(app.state.mcp_servers.iter().any(|m| m.name == "Smithery 2"));
assert!(app.phone_act(&ctx, "mcp", &add("x", "https://y.example/mcp", "Authorization: Bearer {key}"), "owner")["error"].is_string());
assert!(app.phone_act(&ctx, "mcp", &add("x", "https://{host}/mcp", ""), "owner")["error"].is_string());
assert!(app.phone_act(&ctx, "mcp", &add("x", "npx -y evil", ""), "owner")["error"].is_string());
assert!(app.phone_act(&ctx, "mcp", &add("x", "https://y.example/mcp", ""), "admin")["error"].is_string());
// 重新連線: its old error goes, and the next poll connects it again (owner only).
app.ch.mcp_errors.lock().unwrap().push(("Smithery".into(), "連不上".into()));
app.ch.mcp_sig = "connected before".into();
assert!(app.phone_act(&ctx, "mcp", &json!({"name": "Smithery", "reconnect": true}), "admin")["error"].is_string());
let r = app.phone_act(&ctx, "mcp", &json!({"name": "Smithery", "reconnect": true}), "owner");
assert_eq!(r["ok"], true, "{r}");
assert!(app.ch.mcp_errors.lock().unwrap().is_empty() && app.ch.mcp_sig.is_empty());
assert!(app.state.mcp_servers.iter().any(|m| m.name == "Smithery"), "reconnecting keeps it");
// What 連接器 shows (here, and at a screen of this brain).
app.ch.mcp_errors.lock().unwrap().push(("Smithery 2".into(), "HTTP 401".into()));
let st = app.mcp_state();
assert_eq!(st["servers"]["Smithery 2"]["error"], "HTTP 401");
assert!(st["servers"]["Smithery"]["tools"].is_null() && st["servers"]["Smithery"]["error"].is_null());
技能: / 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
}
#[test]
fn the_phone_never_gets_keys_or_secrets() {
let (ctx, mut app) = demo();
let key = "sk-test-very-secret-1234567890";
app.state.providers.entry("openai".into()).or_default().api_key = key.into();
app.state.channels.push(crate::channels::Channel { id: 9, kind: crate::channels::Kind::Telegram, name: "t".into(), bot_id: app.state.bots[0].id, token: "tg-secret-token".into(), target: String::new(), enabled: true, client_id: String::new(), tenant: String::new() });
for role in ["owner", "admin"] {
let s = app.phone_act(&ctx, "settings", &json!({}), role).to_string();
assert!(!s.contains(key) && !s.contains("tg-secret-token"), "{role}: {s}");
assert!(s.contains("\"ready\":true"), "{s}");
}
// A key goes in (the owner's), and still never comes out.
let openai = serde_json::to_value(crate::providers::ProviderKind::OpenAi).unwrap();
assert!(app.phone_act(&ctx, "provider", &json!({"provider": openai, "key": "sk-new-secret-999"}), "admin")["error"].is_string());
assert_eq!(app.phone_act(&ctx, "provider", &json!({"provider": openai, "key": "sk-new-secret-999", "default_model": "gpt-5"}), "owner")["ok"], true);
assert_eq!(app.state.provider(crate::providers::ProviderKind::OpenAi).api_key, "sk-new-secret-999");
assert!(!app.phone_act(&ctx, "settings", &json!({}), "owner").to_string().contains("sk-new-secret-999"));
assert!(app.phone_act(&ctx, "box", &json!({"op": "reset"}), "admin")["error"].is_string());
// The owner's own lists only to the owner.
assert!(app.phone_act(&ctx, "settings", &json!({}), "admin").get("devices").is_none());
assert!(app.phone_act(&ctx, "settings", &json!({}), "owner").get("devices").is_some());
let b = app.state.bots[0].id;
let d = app.phone_act(&ctx, "detail", &json!({"bot": b}), "owner").to_string();
assert!(!d.contains(key) && d.contains("\"memories\""), "{d}");
}
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
手機補上「工作流」:首頁上面一排多一格,每個工作流一張卡(觸發、步驟數、這次或最近一次、▷ 執行/■ 停止),等你確認直接在卡上按「繼續」「停止」;點進去看步驟由上到下、每一步的狀態和結果、最近 10 次執行紀錄。 - 大腦(src/app/remote_ui.rs):phone_act 加 workflows(讀,管理員也可以)和 workflow(run/stop/go/halt,擁有者);沒步驟的不跑(NO_STEPS)、正在跑的不再開一次;手機按的執行記成「手動」,不上日程。workflow_json 給步驟(種類、內容、哪個 Bot)、觸發和下次、正在跑的和最近 10 次(每一步的狀態和結果前 600 字、審批在問什麼)。 - 同一個網路直接連的手機也可以(src/remote.rs lan_guard:workflows/workflow 算「不放寬」——步驟照各 Bot 自己的設定跑,跟排程開始時一樣)。 - 手機頁面(mobile/index.html):listWorkflows/drawWorkflows;跑的時候每 3 秒重讀;步驟的狀態:完成、進行中、等你確認(審批那一步)、失敗、略過,還沒到的變淡。 - 測試:remote_ui::phone_act_tests::the_phone_reads_and_runs_workflows。 - 功能地圖 workflow.md 加 workflow-phone 和一步手機驗證;FEATURES.md 改掉「手機沒有工作流」。 已驗證: cargo test 878 個全過;clippy 沒有新警告;scratch 手機頁面:聊天裡請 Bot 建「Threads 早報」→ 首頁「工作流」→ 卡上 ▷ 執行 →「開始執行」→ 卡上出現「等你確認:要把早報傳給你嗎?」→ 點進去看到觸發器、助手、條件「完成」、審批黃色「等你確認」、輸出變淡 → 按「繼續」→ state 最後一次 done、by 手動、五步都 done。 未驗證: 經帳號連的手機要 make update-server 才有新頁面;等你確認的推播點進來直接到這張卡(推播本身要真的手機)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:07:19 +00:00
/// 工作流 on the phone: the list carries each one's steps in order and its runs; a workflow
/// with no steps is not run (no fake 完成); a run started there is 手動, and a member can't.
#[test]
fn the_phone_reads_and_runs_workflows() {
let (ctx, mut app) = demo();
app.wf_demo();
let list = app.phone_act(&ctx, "workflows", &json!({}), "admin");
let first = &list["workflows"][0];
assert!(first["steps"][0]["kind"] == "觸發器" && first["steps"].as_array().unwrap().len() > 2, "{first}");
let empty = crate::workflow::Workflow::new(99, "空的", 0);
app.state.workflows.push(empty);
assert_eq!(app.phone_act(&ctx, "workflow", &json!({"wf": 99, "do": "run"}), "owner")["error"], crate::workflow::NO_STEPS);
assert!(app.state.workflows.iter().find(|w| w.id == 99).unwrap().runs.is_empty());
assert!(app.phone_act(&ctx, "workflow", &json!({"wf": 99, "do": "run"}), "member")["error"].is_string());
assert!(app.phone_act(&ctx, "workflow", &json!({"wf": 99, "do": "explode"}), "owner")["error"].is_string());
}
手機再補一批設定:權限的「一律放行」開關和智慧模式等幾秒、聊天上方「一律放行開著」可關、記憶與文件、更新的兩個開關、模型的服務網址/測試連線/看圖小幫手、整頁「語音」、Bot 設定的備用模型/起始資料夾/自訂頭像顏色/語音。 - 大腦(src/app/remote_ui.rs):setting 多 always_approve(走 always_command,跟聊天的 /always-approve 一樣連直接操作一起開關)、smart_timeout_secs、auto_update、garden_reports、embed、doc_folder_add/remove;provider 多 base_url、cloud_eyes、fetch(測試連線並取得模型清單,回報在 settings 的 status、known);新的 voice(聽/說的服務、網址、金鑰只寫、模型、聲音);bot 多 color 可用 #rrggbb、fallbacks、workdir、speak_replies、voice、voice_rate、voice_lang;detail 和 settings 帶上這些值。state 多 always(src/remote.rs View,給聊天上方那一條)。 - 同一個網路直接連(lan_guard):放寬的擋——一律放行打開、智慧模式設了秒數、加資料夾、換起始資料夾、打開看圖小幫手;其餘不放寬。 - 手機頁面:權限、一般、更新、模型、語音(新)、Bot 設定的列;聊天上方一律放行那一條;clock 圖示。 - 測試:remote_ui::phone_act_tests::the_phone_changes_the_rest_of_the_settings(每個設定真的改到、直接連線哪些被擋)。 - 功能地圖 autonomy.md(擋下的清單)、models.md、settings.md(十列)、phone.md、profile.md、appearance.md;FEATURES.md。 已驗證: cargo test 882 個、relay 27 個全過;scratch 手機(直接連線):一律放行打開被擋並說明「請在電腦上的 AnyBot 改,或用帳號連線」、智慧模式 1 分鐘被擋(state 還是 300)、加資料夾被擋、用意思找記憶改關閉 → state embed_model off;模型 › 自訂 › 測試連線 →「連線成功,找到 1 個模型」;語音 › 聽選 OpenAI 相容、網址 → state voice.listen open_ai/http://127.0.0.1:9/v1;Bot 設定朗讀速度 1.5 倍 → state voice_rate 1.5。 未驗證: 經帳號連線時那幾個放寬的設定真的改到(scratch 只有直接連線;靠上面的 Rust 測試);試聽(scratch 沒有語音服務);自訂顏色的手機選色器(無頭 Chrome 打不開系統選色器,大腦那邊有測試)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 01:48:52 +00:00
/// The settings the phone took over from the computer: 一律放行 (with direct mode, and back),
/// how long a 智慧模式 card waits, 更新's switches, 記憶與文件, and a bot's 備用模型,
/// 起始資料夾 and a colour of its own.
#[test]
fn the_phone_changes_the_rest_of_the_settings() {
let (ctx, mut app) = demo();
let set = |app: &mut App, key: &str, value: serde_json::Value| app.phone_act(&ctx, "setting", &json!({"key": key, "value": value}), "owner");
assert_eq!(set(&mut app, "always_approve", json!(true))["ok"], true);
assert!(app.state.always_approve && app.state.direct_mode);
assert_eq!(set(&mut app, "always_approve", json!(false))["ok"], true);
assert!(!app.state.always_approve && !app.state.direct_mode, "direct mode goes back to how it was");
set(&mut app, "smart_timeout_secs", json!(60));
set(&mut app, "auto_update", json!(false));
set(&mut app, "garden_reports", json!(false));
set(&mut app, "embed", json!("off"));
set(&mut app, "doc_folder_add", json!("~/Documents/筆記"));
assert_eq!((app.state.smart_timeout_secs, app.state.auto_update_when_away, app.state.garden_reports, app.state.embed_model.as_str(), app.state.doc_folders.clone()), (60, false, false, "off", vec!["~/Documents/筆記".to_string()]));
set(&mut app, "doc_folder_remove", json!("~/Documents/筆記"));
assert!(app.state.doc_folders.is_empty());
let b = app.state.bots[0].id;
let bot = |app: &mut App, key: &str, value: serde_json::Value| app.phone_act(&ctx, "bot", &json!({"bot": b, "key": key, "value": value}), "owner");
assert_eq!(bot(&mut app, "color", json!("#12AB9f"))["ok"], true);
assert!(bot(&mut app, "color", json!("#12AB9")).get("error").is_some(), "not a colour");
let xai = serde_json::to_value(crate::providers::ProviderKind::Xai).unwrap();
let openai = serde_json::to_value(crate::providers::ProviderKind::OpenAi).unwrap();
bot(&mut app, "fallbacks", json!([{"provider": xai, "model": "grok-4"}, {"provider": "nope", "model": "x"}, {"provider": openai, "model": " "}]));
bot(&mut app, "workdir", json!("~/work"));
let x = app.state.bot(b).unwrap();
assert_eq!((x.color.as_str(), x.fallbacks.len(), x.workdir.as_str()), ("#12ab9f", 1, "~/work"));
// Over the same network: what loosens is refused there, the rest goes.
let g = |action: &str, body: serde_json::Value| crate::remote::lan_guard(action, &body, || serde_json::Value::Null, "runc");
use crate::remote::Guard;
assert_eq!(g("setting", json!({"key": "always_approve", "value": true})), Guard::Loosens);
assert_eq!(g("setting", json!({"key": "always_approve", "value": false})), Guard::Keeps);
assert_eq!(g("setting", json!({"key": "smart_timeout_secs", "value": 60})), Guard::Loosens);
assert_eq!(g("setting", json!({"key": "smart_timeout_secs", "value": 0})), Guard::Keeps);
assert_eq!(g("setting", json!({"key": "doc_folder_add", "value": "~"})), Guard::Loosens);
assert_eq!(g("bot", json!({"bot": 1, "key": "workdir", "value": "~"})), Guard::Loosens);
assert_eq!(g("bot", json!({"bot": 1, "key": "fallbacks", "value": []})), Guard::Keeps);
}
/// 所有檔案 on the phone: each attachment once (across bots and past conversations), newest
/// first, with its kind and whether it is still there.
#[test]
fn the_phone_reads_all_files() {
let (ctx, mut app) = demo();
let b0 = app.state.bots[0].id;
let b1 = app.state.bots[1].id;
let att = |name: &str, path: &str| crate::attach::Attachment { name: name.into(), path: path.into(), ..Default::default() };
app.state.bot_mut(b0).unwrap().messages.push(Message { at: 100, attachments: vec![att("a.png", "/nowhere/a.png")], ..Message::user("") });
app.state.bot_mut(b1).unwrap().messages.push(Message { at: 200, attachments: vec![att("b.md", "/nowhere/b.md"), att("a.png", "/nowhere/a.png")], ..Message::user("") });
let v = app.phone_act(&ctx, "library", &json!({}), "admin");
let files: Vec<(&str, &str, bool)> = v["files"].as_array().unwrap().iter().filter(|f| f["path"].as_str().unwrap_or("").starts_with("/nowhere/")).map(|f| (f["name"].as_str().unwrap(), f["kind"].as_str().unwrap(), f["there"].as_bool().unwrap())).collect();
assert_eq!(files, vec![("b.md", "doc", false), ("a.png", "image", false)]);
}
/// 日程 on the phone: the days around today and 即將執行, each thing once there.
#[test]
fn the_phone_reads_the_schedule() {
let (ctx, mut app) = demo();
app.sched_demo();
let v = app.phone_act(&ctx, "schedule", &json!({}), "admin");
let items = v["items"].as_array().expect("items");
assert!(!items.is_empty() && items.iter().all(|i| i["day"].as_str().is_some_and(|d| d.len() == 10) && i["clock"].as_str().is_some_and(|c| c.len() == 5)), "{v}");
let coming: Vec<(String, u64)> = v["coming"].as_array().unwrap().iter().map(|i| (i["kind"].as_str().unwrap().to_string(), i["id"].as_u64().unwrap())).collect();
let mut once = coming.clone();
once.dedup();
assert_eq!(coming.len(), once.len(), "即將執行 lists each thing once: {coming:?}");
// (A team member never gets this far: the route refuses them.)
assert!(!crate::remote::role_allows("member", "POST", &["api", "act", "schedule"]));
}
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘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
#[test]
fn web_client_search_export_import_and_pin_order() {
let (ctx, mut app) = demo();
let b0 = app.state.bots[0].id;
let b1 = app.state.bots[1].id;
let b2 = app.state.bots[2].id;
app.state.bot_mut(b1).unwrap().messages.push(Message { at: 12345, ..Message::user("台南高鐵票與牛肉湯清單") });
// Cross-chat search finds the message and names its bot.
let s = app.phone_act(&ctx, "search", &json!({"q": "牛肉湯"}), "owner");
assert_eq!(s["ok"], true);
assert_eq!(s["hits"][0]["bot"], b1);
assert!(s["hits"][0]["snippet"].as_str().unwrap_or("").contains("牛肉湯"));
// Pin ordering and dragging into a folder unpins cleanly.
assert_eq!(app.phone_act(&ctx, "bot", &json!({"bot": b1, "key": "pin_at", "value": 0}), "owner")["ok"], true);
assert_eq!(app.phone_act(&ctx, "bot", &json!({"bot": b2, "key": "pin_at", "value": 0}), "owner")["ok"], true);
assert_eq!(app.pinned_ids()[0], b2);
assert_eq!(app.phone_act(&ctx, "bot", &json!({"bot": b2, "key": "folder", "value": "工作"}), "owner")["ok"], true);
assert!(!app.state.bot(b2).unwrap().pinned && app.state.bot(b2).unwrap().folder == "工作");
// Export .anybot and import back as a new bot; transcript exports Markdown.
let ex = app.phone_act(&ctx, "export_bot", &json!({"bot": b0}), "owner");
assert_eq!(ex["ok"], true);
let content = ex["content"].as_str().unwrap();
let im = app.phone_act(&ctx, "import_bot", &json!({"content": content}), "owner");
assert_eq!(im["ok"], true, "{im}");
assert!(app.state.bot(im["bot"].as_u64().unwrap()).is_some());
let md = app.phone_act(&ctx, "export_transcript", &json!({"bot": b1}), "admin");
assert_eq!(md["ok"], true);
assert!(md["content"].as_str().unwrap_or("").contains("牛肉湯"));
}
}
test: 等你允許的卡片「回答落在哪一張」用 TLA+ 驗證;找到 F1:手機頁面、螢幕電腦的允許會落在後來的卡上 - .claude/skills/verify-approval-routing:模型(ApprovalRouting.tla,每個動作對到程式碼)、三個 cfg、 一個指令 run.sh(固定 tla2tools 1.7.4+SHA-256、比對對照的程式碼有沒有改過、跑三個 cfg、--replay 在真的程式上重走)。 - 規則:允許/一律允許只讓按的人當時看到的那張卡通過;一律允許記下的類別就是那張卡的。 - 大腦視窗+手機通知(Guarded)通過;四個地方都能回答(AllSurfaces)違反:手機頁面 renderDock 和螢幕電腦的回答不帶 call,Cmd::Answer 交給「那時候」在等的卡,一律允許的 grant 也讀那張卡的(F1,沒有修)。 - src/app/remote_ui.rs 加 approval_routing_replay(只有測試):舊通知那條通過;F1 那條 #[ignore],在真的程式上失敗。 已驗證: run.sh 基準(Guarded、AllSurfacesKeyed 通過,AllSurfaces 只違反 F1),約 7 秒;--replay 在真的程式上重現 F1(rm -rf 那張收到 Always("rm")、allow_rules 記下 rm),舊通知那條通過;暫時把 on_new_approval 改成只發第一把 key:run.sh 報對照的程式碼改過,照技能對過模型(FreshKeyPerCard = FALSE)後 Guarded 違反、--replay 也失敗,現有的 a_banner_answers_only_its_own_request 等四個 approval 測試都沒抓到,改回後回到基準;每條規則都在改壞的版本上看過違反;/pstack:statechart 讀得出反例;cargo test featuremap:: app::remote_ui:: tool_specs_are_locked approval_decisions_are_characterized;cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh 未驗證: 真的手機和螢幕電腦上的 F1(要實機手機和第二台電腦);大腦視窗上按住「允許」時卡被換掉(沒放進模型);完整的 cargo test(只跑上面那些,免得 app 測試碰到 Bot 的 Docker 電腦) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:10:44 +00:00
/// 等你允許的卡片:一個回答落在哪一張卡上(.claude/skills/verify-approval-routing 的 TLA+
/// 模型)。模型找到的步驟在真的程式上一步一步重走,每一行註解是模型的一個動作
/// (ApprovalRouting.tla)。這裡只有測試,不改任何行為。
#[cfg(test)]
mod approval_routing_replay {
use super::*;
use std::sync::mpsc::{channel, Receiver};
/// 大腦(示範資料,不讀也不寫磁碟),第一個 Bot 有一輪在跑:drain_events 只收這一輪的事件。
fn brain(name: &str) -> (egui::Context, App, u64) {
let ctx = egui::Context::default();
let mut app = App::new(&ctx, Some(std::env::temp_dir().join(name)));
let id = app.state.bots[0].id;
app.streams.insert(id, Live { cancel: Arc::new(AtomicBool::new(false)), started: Instant::now(), last: Instant::now(), produced: true, status: None, paused: false, paused_at: None, unattended: false, steer: Arc::new(Mutex::new(vec![])), direct: Arc::new(AtomicBool::new(false)), turn_id: "t".into(), turn: 1 });
(ctx, app, id)
}
/// BotAsks + CardShows:Bot 送出 NeedApproval(帶這張卡自己的 reply),大腦的 drain_events
/// 收下:approvals.insert、on_new_approval 發這張卡的 key。call_0:沒給編號的模型服務每一輪
/// 都從 call_0 數起。
fn bot_asks(app: &mut App, ctx: &egui::Context, id: u64, reason: &str, grant: &str) -> Receiver<ApprovalAnswer> {
let (reply, got) = channel();
app.tx.send((id, 1, StreamEvent::NeedApproval(crate::providers::Approval { call_id: "call_0".into(), tool: "shell".into(), reason: reason.into(), grant: grant.into(), reply, kind: ApprovalKind::Action }))).unwrap();
app.drain_events(ctx);
assert!(app.approvals.get(&id).is_some_and(|a| a.reason == reason), "the card is up");
got
}
/// Guarded.cfg 守的那條路(FreshKeyPerCard、BannerKeyChecked 任一條不成立時模型的反例):
/// 手機通知是第一張卡的,第一張在電腦上回答了、Bot 問了第二件事,這時按通知上的「允許」,
/// 第二件事不能通過。
#[test]
fn an_old_banner_does_not_allow_the_next_card() {
let (ctx, mut app, id) = brain("anybot-replay-banner.png");
let first = bot_asks(&mut app, &ctx, id, "執行指令:ls", "ls");
// (通知帶的是這張卡的 key:on_new_approval → remote::notify_approval(…, &key)。)
let banner_key = app.ask_keys.get(&id).cloned().unwrap_or_default();
// YouAnswerOnDesk:電腦上按「允許」。
app.answer(&ctx, id, ApprovalAnswer::Once);
assert_eq!(first.try_recv(), Ok(ApprovalAnswer::Once));
// BotAsks + CardShows:下一件事。
let second = bot_asks(&mut app, &ctx, id, "執行指令:rm -rf ~/Documents/報告", "rm");
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
// YouTapBanner + BrainTakesAnswer:舊通知上的「允許」(sw.js:answer=once、call=d.ask;
// 頁面送出時加 from: "notice")。
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
app.remote_cmd(&ctx, Cmd::Answer { bot: id, answer: "once".into(), text: String::new(), call: banner_key, notice: true, screen: false });
test: 等你允許的卡片「回答落在哪一張」用 TLA+ 驗證;找到 F1:手機頁面、螢幕電腦的允許會落在後來的卡上 - .claude/skills/verify-approval-routing:模型(ApprovalRouting.tla,每個動作對到程式碼)、三個 cfg、 一個指令 run.sh(固定 tla2tools 1.7.4+SHA-256、比對對照的程式碼有沒有改過、跑三個 cfg、--replay 在真的程式上重走)。 - 規則:允許/一律允許只讓按的人當時看到的那張卡通過;一律允許記下的類別就是那張卡的。 - 大腦視窗+手機通知(Guarded)通過;四個地方都能回答(AllSurfaces)違反:手機頁面 renderDock 和螢幕電腦的回答不帶 call,Cmd::Answer 交給「那時候」在等的卡,一律允許的 grant 也讀那張卡的(F1,沒有修)。 - src/app/remote_ui.rs 加 approval_routing_replay(只有測試):舊通知那條通過;F1 那條 #[ignore],在真的程式上失敗。 已驗證: run.sh 基準(Guarded、AllSurfacesKeyed 通過,AllSurfaces 只違反 F1),約 7 秒;--replay 在真的程式上重現 F1(rm -rf 那張收到 Always("rm")、allow_rules 記下 rm),舊通知那條通過;暫時把 on_new_approval 改成只發第一把 key:run.sh 報對照的程式碼改過,照技能對過模型(FreshKeyPerCard = FALSE)後 Guarded 違反、--replay 也失敗,現有的 a_banner_answers_only_its_own_request 等四個 approval 測試都沒抓到,改回後回到基準;每條規則都在改壞的版本上看過違反;/pstack:statechart 讀得出反例;cargo test featuremap:: app::remote_ui:: tool_specs_are_locked approval_decisions_are_characterized;cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh 未驗證: 真的手機和螢幕電腦上的 F1(要實機手機和第二台電腦);大腦視窗上按住「允許」時卡被換掉(沒放進模型);完整的 cargo test(只跑上面那些,免得 app 測試碰到 Bot 的 Docker 電腦) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:10:44 +00:00
assert!(second.try_recv().is_err(), "第一張卡的通知讓第二件事通過了");
assert!(app.approvals.contains_key(&id), "the second card still waits");
}
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
/// F1(以前 AllSurfaces.cfg 的反例,已修好):手機頁面上畫的還是第一張卡,第一張已經不在了
/// (電腦上回答了),Bot 問了第二件事;這時在手機上按「一律允許」,第二件事不能通過,
/// 也不能把第二件事的類別記成一律允許——不管手機送的是它畫的那張卡的 key(現在的頁面),
/// 還是什麼都沒送(開了很久的舊頁面)。照舊的程式(沒帶 call 就交給那時候在等的卡)這個
/// 測試會失敗。最後,帶著第二張卡自己的 key 才算數。
test: 等你允許的卡片「回答落在哪一張」用 TLA+ 驗證;找到 F1:手機頁面、螢幕電腦的允許會落在後來的卡上 - .claude/skills/verify-approval-routing:模型(ApprovalRouting.tla,每個動作對到程式碼)、三個 cfg、 一個指令 run.sh(固定 tla2tools 1.7.4+SHA-256、比對對照的程式碼有沒有改過、跑三個 cfg、--replay 在真的程式上重走)。 - 規則:允許/一律允許只讓按的人當時看到的那張卡通過;一律允許記下的類別就是那張卡的。 - 大腦視窗+手機通知(Guarded)通過;四個地方都能回答(AllSurfaces)違反:手機頁面 renderDock 和螢幕電腦的回答不帶 call,Cmd::Answer 交給「那時候」在等的卡,一律允許的 grant 也讀那張卡的(F1,沒有修)。 - src/app/remote_ui.rs 加 approval_routing_replay(只有測試):舊通知那條通過;F1 那條 #[ignore],在真的程式上失敗。 已驗證: run.sh 基準(Guarded、AllSurfacesKeyed 通過,AllSurfaces 只違反 F1),約 7 秒;--replay 在真的程式上重現 F1(rm -rf 那張收到 Always("rm")、allow_rules 記下 rm),舊通知那條通過;暫時把 on_new_approval 改成只發第一把 key:run.sh 報對照的程式碼改過,照技能對過模型(FreshKeyPerCard = FALSE)後 Guarded 違反、--replay 也失敗,現有的 a_banner_answers_only_its_own_request 等四個 approval 測試都沒抓到,改回後回到基準;每條規則都在改壞的版本上看過違反;/pstack:statechart 讀得出反例;cargo test featuremap:: app::remote_ui:: tool_specs_are_locked approval_decisions_are_characterized;cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh 未驗證: 真的手機和螢幕電腦上的 F1(要實機手機和第二台電腦);大腦視窗上按住「允許」時卡被換掉(沒放進模型);完整的 cargo test(只跑上面那些,免得 app 測試碰到 Bot 的 Docker 電腦) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:10:44 +00:00
#[test]
fn a_phone_card_tapped_after_it_changed_answers_nothing_else() {
let (ctx, mut app, id) = brain("anybot-replay-page.png");
let first = bot_asks(&mut app, &ctx, id, "執行指令:npm install", "npm install");
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
// PageRefreshes:手機輪詢 api/state,renderDock 畫出 approval_json 給的這張卡(和它的 key)。
智慧模式設計審計修正:手機也有「這輪都准」、按鈕詞彙統一、無障礙與智慧晶片 照 frontend-design skill 審計(使用者流程與順眼程度): - 手機審批卡:智慧模式開著時「這輪都准」是主按鈕(scope 由大腦從卡片自己的 grant 取,手機的字不會決定範圍;通知不帶 scope);無卡片主按鈕改「允許一次」 (桌面同步改名,全產品動詞一致)。一律允許退為一般按鈕:最有力的許可 不再站最前排。 - 手機聊天輸入列:智慧模式開著時有 ✨ 晶片,點了關掉(手機只能收緊); 關後 state/settings 同步重抓。桌面 ✨ 第一次開著時旁邊標「智慧」兩字, 關過一次就不再有字。 - 無障礙:全站 :focus-visible 焦點框;圖示按鈕(返回、送出、選單…)加 aria-label;審批按鈕組加 role=group。「全部允許,之後直接操作」連結 由 accent 色改灰:最有力的許可給最靜的處理。 - 測試:手機 scope 回答新測試(卡片自己的 grant、通知不帶);真機 e2e: 無頭 iPhone 開聊天見晶片→點→toast、晶片消失、/api/settings 同步 false; 連接器工具卡四顆按鈕「這輪都准/允許一次/一律允許/拒絕」,按「這輪都准」 後工具執行、allow_rules 沒有新增(不落永久規則)。 - 地圖:autonomy/safety/phone/connectors/apps 同步(autonomy 壓回 8999/9000); TLA coverage.tsv 已 rehash(approval_body、cmd_answer、approval_json、 phone_cards、render_dock)。 已驗證: cargo test 721 全綠(含 featuremap::、layout_audit::、phone_scope)、 verify-approval-routing run.sh 全綠、真機 e2e(晶片開關三端同步、scope 卡執行 且無永久規則)、node --check 手機 JS。 未驗證: 桌面視窗的 ✨「智慧」標註與卡片主按鈕外觀(要開視窗,需使用者同意 desktop-shot+人類簽名)。
2026-11-19 07:24:37 +00:00
let shown = approval_json(app.state.bot(id).unwrap(), app.approvals.get(&id).unwrap(), app.ask_keys.get(&id).map(String::as_str).unwrap_or(""), false);
test: 等你允許的卡片「回答落在哪一張」用 TLA+ 驗證;找到 F1:手機頁面、螢幕電腦的允許會落在後來的卡上 - .claude/skills/verify-approval-routing:模型(ApprovalRouting.tla,每個動作對到程式碼)、三個 cfg、 一個指令 run.sh(固定 tla2tools 1.7.4+SHA-256、比對對照的程式碼有沒有改過、跑三個 cfg、--replay 在真的程式上重走)。 - 規則:允許/一律允許只讓按的人當時看到的那張卡通過;一律允許記下的類別就是那張卡的。 - 大腦視窗+手機通知(Guarded)通過;四個地方都能回答(AllSurfaces)違反:手機頁面 renderDock 和螢幕電腦的回答不帶 call,Cmd::Answer 交給「那時候」在等的卡,一律允許的 grant 也讀那張卡的(F1,沒有修)。 - src/app/remote_ui.rs 加 approval_routing_replay(只有測試):舊通知那條通過;F1 那條 #[ignore],在真的程式上失敗。 已驗證: run.sh 基準(Guarded、AllSurfacesKeyed 通過,AllSurfaces 只違反 F1),約 7 秒;--replay 在真的程式上重現 F1(rm -rf 那張收到 Always("rm")、allow_rules 記下 rm),舊通知那條通過;暫時把 on_new_approval 改成只發第一把 key:run.sh 報對照的程式碼改過,照技能對過模型(FreshKeyPerCard = FALSE)後 Guarded 違反、--replay 也失敗,現有的 a_banner_answers_only_its_own_request 等四個 approval 測試都沒抓到,改回後回到基準;每條規則都在改壞的版本上看過違反;/pstack:statechart 讀得出反例;cargo test featuremap:: app::remote_ui:: tool_specs_are_locked approval_decisions_are_characterized;cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh 未驗證: 真的手機和螢幕電腦上的 F1(要實機手機和第二台電腦);大腦視窗上按住「允許」時卡被換掉(沒放進模型);完整的 cargo test(只跑上面那些,免得 app 測試碰到 Bot 的 Docker 電腦) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:10:44 +00:00
assert!(shown["reason"].as_str().unwrap_or("").contains("npm install"), "{shown}");
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
let seen_key = shown["key"].as_str().unwrap_or("").to_string();
assert!(!seen_key.is_empty(), "the phone gets the card's key: {shown}");
test: 等你允許的卡片「回答落在哪一張」用 TLA+ 驗證;找到 F1:手機頁面、螢幕電腦的允許會落在後來的卡上 - .claude/skills/verify-approval-routing:模型(ApprovalRouting.tla,每個動作對到程式碼)、三個 cfg、 一個指令 run.sh(固定 tla2tools 1.7.4+SHA-256、比對對照的程式碼有沒有改過、跑三個 cfg、--replay 在真的程式上重走)。 - 規則:允許/一律允許只讓按的人當時看到的那張卡通過;一律允許記下的類別就是那張卡的。 - 大腦視窗+手機通知(Guarded)通過;四個地方都能回答(AllSurfaces)違反:手機頁面 renderDock 和螢幕電腦的回答不帶 call,Cmd::Answer 交給「那時候」在等的卡,一律允許的 grant 也讀那張卡的(F1,沒有修)。 - src/app/remote_ui.rs 加 approval_routing_replay(只有測試):舊通知那條通過;F1 那條 #[ignore],在真的程式上失敗。 已驗證: run.sh 基準(Guarded、AllSurfacesKeyed 通過,AllSurfaces 只違反 F1),約 7 秒;--replay 在真的程式上重現 F1(rm -rf 那張收到 Always("rm")、allow_rules 記下 rm),舊通知那條通過;暫時把 on_new_approval 改成只發第一把 key:run.sh 報對照的程式碼改過,照技能對過模型(FreshKeyPerCard = FALSE)後 Guarded 違反、--replay 也失敗,現有的 a_banner_answers_only_its_own_request 等四個 approval 測試都沒抓到,改回後回到基準;每條規則都在改壞的版本上看過違反;/pstack:statechart 讀得出反例;cargo test featuremap:: app::remote_ui:: tool_specs_are_locked approval_decisions_are_characterized;cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh 未驗證: 真的手機和螢幕電腦上的 F1(要實機手機和第二台電腦);大腦視窗上按住「允許」時卡被換掉(沒放進模型);完整的 cargo test(只跑上面那些,免得 app 測試碰到 Bot 的 Docker 電腦) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:10:44 +00:00
// YouAnswerOnDesk:電腦上按「允許」。
app.answer(&ctx, id, ApprovalAnswer::Once);
assert_eq!(first.try_recv(), Ok(ApprovalAnswer::Once));
// BotAsks + CardShows:下一件事。
let second = bot_asks(&mut app, &ctx, id, "執行指令:rm -rf ~/Documents/報告", "rm");
// YouTapOnPage + BrainTakesAnswer:手機上還是 npm install 那張,按「一律允許」:
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
// renderDock POST {answer: "always", call: a.key};舊頁面 POST {answer: "always"}。
for call in [seen_key, String::new()] {
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
app.remote_cmd(&ctx, Cmd::Answer { bot: id, answer: "always".into(), text: String::new(), call, notice: false, screen: 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
let got = second.try_recv();
let rules = app.state.bot(id).map(|b| b.allow_rules.clone()).unwrap_or_default();
assert!(got.is_err() && !rules.iter().any(|g| g == "rm"), "手機上看到的是 npm install;rm -rf 那張收到 {got:?},一律允許記下 {rules:?}");
}
assert!(app.state.bot(id).unwrap().messages.iter().any(|m| m.note && m.text.contains("沒有用上")), "the person is told");
// 第二張卡畫到手機上以後,帶它自己的 key 才算數。
智慧模式設計審計修正:手機也有「這輪都准」、按鈕詞彙統一、無障礙與智慧晶片 照 frontend-design skill 審計(使用者流程與順眼程度): - 手機審批卡:智慧模式開著時「這輪都准」是主按鈕(scope 由大腦從卡片自己的 grant 取,手機的字不會決定範圍;通知不帶 scope);無卡片主按鈕改「允許一次」 (桌面同步改名,全產品動詞一致)。一律允許退為一般按鈕:最有力的許可 不再站最前排。 - 手機聊天輸入列:智慧模式開著時有 ✨ 晶片,點了關掉(手機只能收緊); 關後 state/settings 同步重抓。桌面 ✨ 第一次開著時旁邊標「智慧」兩字, 關過一次就不再有字。 - 無障礙:全站 :focus-visible 焦點框;圖示按鈕(返回、送出、選單…)加 aria-label;審批按鈕組加 role=group。「全部允許,之後直接操作」連結 由 accent 色改灰:最有力的許可給最靜的處理。 - 測試:手機 scope 回答新測試(卡片自己的 grant、通知不帶);真機 e2e: 無頭 iPhone 開聊天見晶片→點→toast、晶片消失、/api/settings 同步 false; 連接器工具卡四顆按鈕「這輪都准/允許一次/一律允許/拒絕」,按「這輪都准」 後工具執行、allow_rules 沒有新增(不落永久規則)。 - 地圖:autonomy/safety/phone/connectors/apps 同步(autonomy 壓回 8999/9000); TLA coverage.tsv 已 rehash(approval_body、cmd_answer、approval_json、 phone_cards、render_dock)。 已驗證: cargo test 721 全綠(含 featuremap::、layout_audit::、phone_scope)、 verify-approval-routing run.sh 全綠、真機 e2e(晶片開關三端同步、scope 卡執行 且無永久規則)、node --check 手機 JS。 未驗證: 桌面視窗的 ✨「智慧」標註與卡片主按鈕外觀(要開視窗,需使用者同意 desktop-shot+人類簽名)。
2026-11-19 07:24:37 +00:00
let now = approval_json(app.state.bot(id).unwrap(), app.approvals.get(&id).unwrap(), app.ask_keys.get(&id).map(String::as_str).unwrap_or(""), false);
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
app.remote_cmd(&ctx, Cmd::Answer { bot: id, answer: "reject".into(), text: String::new(), call: now["key"].as_str().unwrap_or("").into(), notice: false, screen: 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
assert_eq!(second.try_recv(), Ok(ApprovalAnswer::Reject));
test: 等你允許的卡片「回答落在哪一張」用 TLA+ 驗證;找到 F1:手機頁面、螢幕電腦的允許會落在後來的卡上 - .claude/skills/verify-approval-routing:模型(ApprovalRouting.tla,每個動作對到程式碼)、三個 cfg、 一個指令 run.sh(固定 tla2tools 1.7.4+SHA-256、比對對照的程式碼有沒有改過、跑三個 cfg、--replay 在真的程式上重走)。 - 規則:允許/一律允許只讓按的人當時看到的那張卡通過;一律允許記下的類別就是那張卡的。 - 大腦視窗+手機通知(Guarded)通過;四個地方都能回答(AllSurfaces)違反:手機頁面 renderDock 和螢幕電腦的回答不帶 call,Cmd::Answer 交給「那時候」在等的卡,一律允許的 grant 也讀那張卡的(F1,沒有修)。 - src/app/remote_ui.rs 加 approval_routing_replay(只有測試):舊通知那條通過;F1 那條 #[ignore],在真的程式上失敗。 已驗證: run.sh 基準(Guarded、AllSurfacesKeyed 通過,AllSurfaces 只違反 F1),約 7 秒;--replay 在真的程式上重現 F1(rm -rf 那張收到 Always("rm")、allow_rules 記下 rm),舊通知那條通過;暫時把 on_new_approval 改成只發第一把 key:run.sh 報對照的程式碼改過,照技能對過模型(FreshKeyPerCard = FALSE)後 Guarded 違反、--replay 也失敗,現有的 a_banner_answers_only_its_own_request 等四個 approval 測試都沒抓到,改回後回到基準;每條規則都在改壞的版本上看過違反;/pstack:statechart 讀得出反例;cargo test featuremap:: app::remote_ui:: tool_specs_are_locked approval_decisions_are_characterized;cargo clippy --bin anybot --all-targets -D warnings;deploy/ci/lint-sh.sh 未驗證: 真的手機和螢幕電腦上的 F1(要實機手機和第二台電腦);大腦視窗上按住「允許」時卡被換掉(沒放進模型);完整的 cargo test(只跑上面那些,免得 app 測試碰到 Bot 的 Docker 電腦) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:10:44 +00:00
}
}