Commit Graph

80 Commits

Author SHA1 Message Date
王性驊 10d29281c3 refactor: 核准關卡的規則搬到 gate.rs,用表格測試
工程基礎計畫 E9(grok-build 把權限判斷放在獨立、可測的 crate)。行為不變。

- gate::by_kind(關卡順序第 6 步):Mac 的 App(讀一次、改一次、送出每次)、螢幕(自己的桌面不問、看一次、每個 App 操作一次、不能點 AnyBot 自己)、帳號裡別台電腦的螢幕(看和操作各一次)、瀏覽器(讀已登入的分頁問一次)、其他照 tools::decide_on。要找目標 App 才問系統(照原本只在操作這台螢幕時)。
- gate::always_ask(第 8 步):付款/傳送/刪除這類點擊、寄信和傳訊息、沙盒外的 AppleScript,每次都問;拒絕的還是拒絕。回傳要不要清掉自動審核的備註、是不是不能一律允許。
- agent::spawn 只呼叫這兩個(少了約 100 行);要等人回答的第 3–5 步、要問模型的第 7 步留在原地。SCREEN_CONTROL_GRANT 和 screen_control_ask 搬到 gate.rs(說明照舊)。
- 功能地圖 safety.md 註明第 6、8 步的規則在 gate.rs。

已驗證:cargo test 569 全過(原本測核准的 agent 測試都過);新的表格測試 gate::tests 兩個(第 6 步 16 種情況、第 8 步 8 種);cargo clippy -D warnings 過。
未驗證:無。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:32:31 +08:00
王性驊 3ef5f8b752 feat: 每一次模型呼叫都記用量;/usage 看最近一天和一週
工程基礎計畫 E8,參考 grok-build 的 `grok usage`。

- providers.rs:StepOutput 多一個 usage(輸入、輸出、快取讀、快取寫、花費)。OpenAI 系的串流最後一段的 usage(OpenAI、xAI、OpenRouter 的請求加 stream_options.include_usage;其他有給也讀);Anthropic 從 message_start 和 message_delta 讀。OpenAI 的 prompt_tokens 包含快取讀的,拆開,兩家的「輸入」同一個意思。OpenRouter 回的 cost 記成百萬分之一美元。拿掉沒人讀的 CACHE_STATS。
- usage.rs:run_step_as_written(每一次模型呼叫都經過)之後寫一行到資料夾的 usage/YYYY-MM.jsonl:時間、供應商、模型、session(看得出哪個 Bot、做什麼:回合、發布前檢查、目標檢查、支線)、token、花費。沒回報用量的呼叫不寫。
- 「/usage」(電腦、螢幕、手機):最近 24 小時和 7 天的呼叫次數、輸入、輸出、快取讀了幾成、花費(有回報才寫),依 Bot、依模型各列前 8 名。不猜價錢。
- / 清單、手機的指令清單多一個 usage;功能地圖 chat.md、FEATURES.md。

已驗證:cargo test 全過、cargo clippy -D warnings 過。新測試:兩種串流的用量讀得對(OpenAI 的快取拆出來、OpenRouter 的花費、Anthropic 的四種),只對認得的服務送 stream_options;session 看得出是誰的;一天和一週的加總、依 Bot 和依模型、七天前的不算;寫一行再讀回來,沒用量的不寫。
未驗證:真的 OpenAI/xAI/OpenRouter 回的 usage(照它們的文件寫,假模型測過格式)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:27:34 +08:00
王性驊 c1946a4935 test: 共用的假模型服務(OpenAI 和 Anthropic 兩種格式、可以注入錯誤)
工程基礎計畫 E7,參考 grok-build 的 xai-grok-test-support。

- testkit.rs(只在測試裡):一個假的模型服務,照劇本一個請求回一個:文字、工具呼叫、錯誤狀態(帶 Retry-After)、直接斷線、空的回答、原樣的內容;劇本用完後可以一直回「ok」或不再接。兩種格式:OpenAI 的 chat completions 串流、Anthropic 的 messages 串流(message_start、content_block_*、message_delta、message_stop)。每個請求原樣和 JSON 都留著。
- agent.rs 的 fake_http/sse_text/sse_call 和 app.rs 的 fake_model/scripted_model 改成用它(簽名不變,用到它們的測試一行沒改)。以前三份各寫各的伺服器,都只會 OpenAI 格式、不能注入錯誤。
- 新測試:兩種格式都被 providers 自己的解析器讀成文字和工具呼叫;503 帶 Retry-After: 1 會等完再問、斷線也再問,第三次成功。

已驗證:cargo test 562 全過;cargo clippy --all-targets -- -D warnings 過。
未驗證:無。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:21:01 +08:00
王性驊 d23ca7628d chore: clippy 全部清乾淨,CI 有新警告就失敗;make lint
工程基礎計畫 E6。33 個警告改掉,行為不變(測試全過):
- 順序一樣、寫法更直接:sort_by(b.cmp(a)) → sort_by_key(Reverse)(三處,都是穩定排序);chunks_exact(4) → as_chunks::<4>()(拿掉一個 unwrap);用 checked_div 取代先判斷 total > 0;兩個一樣的分支合成一個條件;計數迴圈用 enumerate;單一運算式的立即呼叫閉包改成區塊;回傳 () 的函式不再包在 Ok() 裡。
- 型別取名:VoicesAnswer、Vocab、Group。system_prompt 的 11 個參數留著(每個是指示的不同部分),標 allow 並寫理由。
- 小的:多餘的 clone、format!、vec!、into、借用;3_600_000 的分組;文件註解的縮排和空行;新檔案明說不截斷。
- .gitea/workflows/ci.yml:clippy 改成 `--all-targets -- -D warnings`(原本只報告)。make lint 跑一樣的檢查。
- 不加 rust-toolchain.toml:AnyBot 是使用者自己建的,釘版本會逼每個人和 make update-server 多下載一套 Rust;CI 映像本來就釘 1.98.1。

已驗證:cargo test 560 全過;cargo clippy --bin anybot --all-targets -- -D warnings 在這台 Mac 過。
未驗證:只在 Linux 編譯的程式(x11.rs、wl.rs、portal.rs…)的 clippy:這台 Mac 看不到,第一次 CI 跑會檢查,若有警告會擋下來。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:18:12 +08:00
王性驊 1ad81532cd feat: 所有 HTTP 用戶端信任同一份憑證;連接器連同它帶起來的程式一起關;按停止馬上結束連接器的呼叫
工程基礎計畫 E5,參考 grok-build 的 clippy.toml(HTTP 用戶端只能從一個地方建)和 ProcessScope。

- net.rs:net::config() 是所有 HTTP 用戶端的起點,憑證是公開的加上這台電腦自己信任的(tunnel::trusted_roots);net::agent(秒數) 是常用的那種(整個請求的逾時、錯誤狀態當成回答,一種逾時一個、重複用)。18 個自己建 ureq 的地方全部換成 net::config(),各自的逾時、轉址、User-Agent 不變。以前只有連帳號伺服器的那條看這台電腦信任的憑證:公司自己簽憑證的連接器、模型服務、Webhook 在別處會失敗。帳號伺服器的用戶端改用 net::agent,拿掉它自己的那份快取。
- clippy.toml:disallowed-methods 擋 ureq::Agent::config_builder(net.rs 以外)。
- 連接器:關掉、移除、重新連線、連不上時用 tools::kill_tree 連同子行程一起關(npx/uvx/sh 底下真正的伺服器以前留著)。
- mcp::call_until:本機連接器的呼叫每 0.2 秒看一次停止,按停止馬上回「已停止」;伺服器晚到的答案下一次會跳過。用網址連的還是等它回或 120 秒(ureq 的請求停不下來)。
- 測試用的假連接器多一個 slow 工具(FAKE_SLOW=1 才列出,不影響其他測試的工具數)。

已驗證:cargo test 560 全過;cargo clippy 沒有 disallowed 的違規。新測試:按停止 0.3 秒後呼叫在 2 秒內結束、之後同一個連接器照樣能用(sum=3);用 sh 帶起來的連接器關掉後,它帶起來的 sleep 也沒了;所有用戶端的憑證至少是公開那一份。
未驗證:公司自己簽憑證的真的連接器(這台沒有)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:13:59 +08:00
王性驊 e039368d6b feat: 紀錄檔、當掉報告、秘密遮罩
參考 xai-org/grok-build(每個 session 的 debug log、xai-crash-handler、xai-grok-secrets 的 sanitizer)。工程基礎計畫的 E2–E4。

- 紀錄檔(logfile.rs):AnyBot 自己說的話寫到資料夾的 logs/anybot-YYYY-MM-DD.log(時間、等級、來源;一天一個、留 7 天、一天上限 20 MB),終端機照舊印,伺服器的 docker logs 不變。ANYBOT_LOG 設等級(預設 info),其他套件只收 warn 以上。36 個執行中的 eprintln! 改成 log::info!/warn!/error!;終端機給人看的(用法、setup 的 ✗、更新進度、截圖、測試)照舊。cargo test 不開紀錄檔。
- 當掉報告:panic hook 寫 logs/crash-時間.txt(版本、執行緒、位置、訊息、backtrace);下次打開在主要 Bot 的聊天留一行並記進待改進,每份只說一次(改名 .seen.txt);螢幕電腦跳提示。
- 秘密遮罩(secrets.rs):glpat-、ghp_/github_pat_、sk-、xai-、AKIA/ASIA、xox、AIza、私鑰區塊、Bearer/Basic、JWT,名字像 TOKEN/SECRET/PASSWORD/API_KEY 的變數值 → ••••(留前綴)。用在紀錄檔、當掉報告、手機上的步驟細節和結果。工作紀錄(oplog)不遮:當掉後要照原本的參數重做;Bot 看到的不遮。
- regex、log 改成直接相依(本來就在建置裡,沒有新的下載)。

已驗證:cargo test 557 全過;新測試 secrets:: 3 個(每種格式、變數名留著、一般文字不動)、logfile:: 4 個(等級和來源、一行的格式和遮罩、每天換檔/上限只說一次/七天前的刪掉、當掉報告遮過且只說一次)。隔離的 --serve(沒有金鑰、DOCKER_HOST 指向不存在、自己的 HOME 和資料夾)跑 10 秒:logs/anybot-2026-11-17.log 有啟動版本、手機密碼提醒、記憶整理、收到停止訊號四行,終端機一樣。
未驗證:真的 panic 寫出報告後重開看到那一行(測試直接呼叫寫報告和讀報告的函式,沒有讓程式真的當掉)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:09:13 +08:00
王性驊 9390b70fe7 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 10:55:37 +08:00
王性驊 525a7fe56b fix: 選了做事的電腦之後,瀏覽器和螢幕步驟不再跑到使用者自己的 Mac
使用者把「工程」「FSD 追蹤專員」的做事的電腦設成 nobledesktop(雲端大腦所在的伺服器)。那台還沒裝瀏覽器時,Bot 沒指名電腦的 browser_open/browser_read 一路退到「使用者的電腦」,在使用者的 MacBook 上開 Brave(紀錄裡的結果是「[王性驊的MacBook Pro (2)] 已在 AnyBot 瀏覽器…打開」)。

- browser_place:Bot 沒指名時,使用者選的電腦開不了瀏覽器就失敗並說為什麼(沒裝瀏覽器/要 Docker/SSH 沒有視窗),要 Bot 先問使用者、公開網頁用 web_fetch,不再換到別台。
- screen_target:選的電腦沒有螢幕(SSH)時同樣失敗,不換到別台的螢幕。
- keep_to_chosen:Bot 自己指名使用者沒提的電腦,就算選的那台做不了這種步驟也拉回去(在那裡說清楚做不了),不再留在使用者的 Mac 上跑。
- 只管「使用者選了別台」(chosen_by_person:做事的電腦不是 Bot 自己的);沒選過、用 Bot 自己的電腦而這裡沒有 Docker 時,照舊可以借使用者的瀏覽器和螢幕。

已驗證:cargo test --bin anybot 528 通過(新增 a_chosen_computer_keeps_its_steps_off_the_persons_mac:選 SSH 的 nobledesktop → 瀏覽器、螢幕都失敗並說明;Bot 指名 Mac → 拉回;使用者說「用我的電腦」→ 去 Mac;沒選過 → 照舊借 Mac);原本的 a_step_moved_back_to_the_chosen_computer_says_so 等都過。
未驗證:真的雲端大腦(要更新 nobledesktop 上的大腦才生效)。
2026-11-17 00:10:09 +08:00
王性驊 dd6fd5aec7 feat: 每個 Bot 一個螢幕——Bot 的電腦上各有自己的螢幕和瀏覽器,支線另開暫時的螢幕,右側面板和「全部螢幕」看得到每一個
照 Grok Bot 的分法:一台電腦、每個 Bot 一個螢幕,大家同時做互不干擾。使用者自己的電腦只有一個實體螢幕,還是一次一個 Bot。

- box:anybot-screen(up/down/list/reap)開關每個 Bot 的螢幕,同時最多 6 個,閒置 10 分鐘關掉;browser 每個螢幕自己的設定檔(第一次從共用的複製登入;支線 <key>-t<n> 從主線那份複製,關掉時刪掉);start.sh 給每個螢幕 VNC token;Bot 電腦升到版本 10
- cloudbox:每個螢幕有自己的狀態(編號、尺寸、貼上檔、瀏覽器埠),指令開的視窗出現在它的 Bot 的螢幕上;branch_screen、close_screen、open_screens、thumbnail_of
- agent:在 Bot 的電腦上,一輪用它自己的螢幕(支線用暫時的),佔用照螢幕算
- 支線結束時關掉它的暫時螢幕
- 畫面:右側「電腦」顯示目前 Bot 的螢幕;群組跟著正在回答的成員,「成員」卡片點小畫面就固定顯示那個成員;「全部螢幕(N)」一格一個螢幕;接管時只停那個 Bot;手機和中繼帶上要看哪個 Bot 的螢幕
- 群組和支線的系統指示:看不到彼此開著的網頁,交棒時寫網址或檔案路徑
- 功能地圖:screen、team、computers、browser

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha4mzWbjJAWAsDVuBun
2026-11-15 16:12:09 +08:00
王性驊 eb70608160 feat: AnyBot 功能地圖——Bot 用 anybot_guide 認識 AnyBot 本身;修好地圖整理時找到的七個問題
功能地圖(照 Lauren Tan 的 feature map,poteto/verification-skill-example)
- docs/feature-map/:20 區加索引,每區四段(子功能/使用者怎麼到/怎麼操作(Bot:、驗證:)/陷阱),內容逐條對照程式;索引寫共同前提、證據與略過的回報、全面檢查順序
- Bot 的系統提示多一行區塊目錄;新工具 anybot_guide 一次讀一區(唯讀)
- cargo test featuremap:: 擋漏寫:Bot 能拿到的每個工具、browser/computer 的每個動作、設定視窗每個分頁和區塊、update_settings 的鍵;每區要有四段、不能太長
- 自動學技能:AnyBot 本身怎麼用不抄進技能,地圖錯漏記成待改進;園丁在重複的待改進旁提醒補地圖
- CLAUDE.md:改功能時同一個 commit 一起改地圖
- 側邊欄「分區」工具的說明寫清楚:不是群組聊天

修正
1. 別人傳來的訊息(訊息管道、團隊成員)那一輪不給 AnyBot 瀏覽器、保險庫和已送紀錄(瀏覽器帶著使用者的登入);硬叫也擋下,公開網頁仍可 web_fetch
2. 自動學會的技能加進那個 Bot 自己的技能清單(支線的算主 Bot 的)
3. 按停止一併停掉這個 Bot 的互動終端機(一般背景指令照舊)
4. 設定 › 整合 › 技能、頁面的「刪除」要再按一次確定
5. update_bot 先跳確認卡片,列出每一項要改成什麼
6. Bot 範本的頭像形狀改成存在的形狀,並加測試
7. 文字:直接操作的提示改「設定 → 權限」、金鑰錯誤改「設定 → 模型」、等核准逾時照實說是什麼在等

Mac 490 個測試通過。

Refs: cl3xk7

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 11:15:09 +08:00
王性驊 c7f6da7fe8 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-15 01:48:13 +08:00
王性驊 98fc63e65b 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 23:52:44 +08:00
王性驊 0a25db7199 fix: 模型說對話太長時自己騰出空間再試——先拿掉截圖、再收起舊結果、再摘要(一輪中間也能切);記下模型真正的上限,把圖當文字算的模型不再傳圖
一台 Linux 換成自訂端點的模型後,一張網頁截圖讓請求從約 1.8 萬 tokens 變成 178,553(上限 131,072):那個端點把圖的 base64 當文字算。AnyBot 一張圖只估 3,200、也沒算工具說明,所以沒先壓縮;模型說太長時,最新 6 則一律保留(截圖就在裡面),這一輪又只有一則指令沒地方摘要,直接報錯;下一輪截圖還在記憶體裡又送一次。

- 模型說太長:依序拿掉圖片(聊天裡的步驟截圖也放掉,下一輪不再送)→ 收起除了最新 2 步以外的長結果 → 摘要(只有一則指令的長回合在這一輪中間切,指令原文保留)→ 都試過才報錯,並說明指示、工具說明、對話各多大
- 從錯誤訊息讀出上限(husky、OpenAI、vLLM、Anthropic 的寫法),比 Bot 設定小就記下來(StreamEvent::ContextLimit)
- 實際用量比估算每張圖多 2 萬 tokens 以上(圖被當文字算)時,拿掉圖片成功後這個模型不再傳圖(改用文字描述);看得到圖、只是剛好超過一點的模型照樣看螢幕
- 估算加進工具說明(約 1.2 萬 tokens)

測試:husky 那次的截圖情境、一則指令的長回合、看圖模型只超過一點點、各家錯誤訊息的上限與用量解析。Mac 451 個測試通過。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:57:51 +08:00
王性驊 56e6d231c9 fix: 模型把參數包在 data 裡也照常執行;browser/computer 沒給動作時講清楚可以用哪些;被安全規則擋下也算同一個錯誤
一輪送拾日留言時,模型從某一步起把呼叫送成 browser {"data": "{\"action\": \"press\", …}"}(16:43 起 65 次),AnyBot 回「沒有『browser』這個工具」,Bot 以為工具不見了、一直換寫法重試,兩輪只送出 1 則;上一版加的「同一個錯誤就停」只算失敗、不算被擋,沒有攔住。

- tools::unwrapped_args:參數只有一個 data/arguments/args/input/params/parameters/kwargs 欄位、裡面是物件(或物件的 JSON 字串),而且工具自己的 schema 沒有這個欄位時,拆開照原意執行(write_terminal 的 input 這類真的欄位不動)
- browser/computer 沒給 action 或 action 不認得:回「要用 action 指定做什麼……可以用的有 open、read、click、press…」和正確寫法,不再說沒有這個工具
- 「被安全規則擋下」也算進同一個錯誤的連續次數,3 次就這一回合不再執行
- lock 測試:放開後再拿鎖等一下(平行測試啟動子程式時會短暫握著鎖,零等待偶爾撲空)

Mac 446、Linux 450 個測試通過。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 17:32:32 +08:00
王性驊 69080f9117 fix: Linux 操作恢復順暢——保險箱空的不給填入工具、同一個錯誤不再鬼打牆;Wayland 可一律允許、長網頁有編號、Enter 只看游標那格;做完就關掉瀏覽器
一台 Linux(Ubuntu 26.04、X11)上一輪 Threads 海巡 40 分鐘只送出 1 則:小模型一直誤叫保險箱填入(171 次),而 4b53ad4 之後回的是「沒有開著的分頁,請先 browser_open」,Bot 照做又再誤叫。

- 保險箱:只給有東西可填的種類(空的就沒有 vault 工具、browser 也沒有 fill);填入先查 id 在不在,錯誤講對、指向 type;規劃與填入都在這個任務自己的分頁上(本機、box、遠端手腳)
- 同一個工具連續 3 次回一樣的錯誤(換參數也一樣):這一回合不再執行
- Wayland(GNOME/KDE,wlroots 的座標點擊)認不出 App 時,改給「操作這台電腦的螢幕」一律允許(一律允許清單裡可移除)
- 元素樹走訪上限 4000 → 20000:長網頁捲下去,看得到的部分也有編號
- 敏感動作關卡:Enter/送出只看游標所在(或正在打字)的欄位;座標點擊只看點到的最內層控制項;英文整字比對(PayPal 不是 pay);步驟在別台電腦時不查大腦本機的編號
- 打字先點欄位再檢查最前面是不是 AnyBot;批次從 AnyBot 切到要操作的 App 不再中斷,切到第三個 App 或回到 AnyBot 才停
- 估算對話長度只算真的會送出的最新 3 張截圖
- 做完就關掉瀏覽器(設定 › 電腦 › AnyBot 瀏覽器設定檔,預設開):一輪結束關掉用過的 Firefox/Chrome,別的 Bot 還在用就只關自己的分頁;box 的 Chromium 不變

Mac 444、Linux 448 個測試通過;Firefox 收尾實機測試(Mac、Linux Snap 版)通過;已在那台 Linux 上部署驗證。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 16:21:32 +08:00
王性驊 8ed7132e6b /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 23:36:34 +08:00
王性驊 3b8c4c3d3b 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 21:34:03 +08:00
王性驊 8fbcc25e54 步驟上限改成 50000 步(等於不設限);每 25 步的自我檢查改問「最近這 25 步有沒有進展」
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 20:45:13 +08:00
王性驊 3f3d049ae8 個人檔案:指示和 soul 合成一欄;Bot 知道自己有個人檔案,聊天裡可以看和改自己的設定(先給你確認)
- 「Soul 與指示」一欄(instructions):Bot 設定拿掉另外的「指示」卡片(群組保留);舊存檔裡的
  soul 讀進來時併到指示最前面(Bot::fold_soul),之後不再寫出
- 說明裡加上:它有個人檔案、怎麼看和改、它沒有哪些能力(profile::self_knowledge)
- 新工具 my_profile(看:描述、soul 與指示、擅長、不做的事、能力有/沒有、技能與技能庫、
  可用電腦與預設、模型、思考模式、步驟模型、頭像)、update_my_profile(改上述欄位)
- 改設定一律先跳確認卡片,逐項列出改了什麼,按允許才生效、拒絕不動;按下允許時依當下的
  Bot 重算再套用,只動設定欄位;錯誤要求(沒有的能力、技能、電腦、顏色、重名、拿掉自己的
  電腦、沒變化)直接說原因;群組裡改的是正在說話的成員
- 例行任務和訊息管道的對話拿不到這兩個工具;網頁、檔案、別的 Bot 叫它改的不算
- 測試:聊天 → 確認卡 → 改好(拒絕則不改)、看設定與錯誤要求、舊 soul 併入指示
- 順手修:src/agent.rs 一個重複的 #[test]

驗證:macOS cargo test 391 通過(連跑兩次);Windows/Linux cargo check 通過

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 17:24:58 +08:00
王性驊 bf3238d960 Bot 個人檔案:soul、擅長、技能、能力、可用電腦、同事名冊;例行任務每輪開新對話(省 token)
每個 Bot 是獨立的個體(src/profile.rs、src/app/profile_ui.rs)
- 新欄位:soul(只有自己讀,放在提示最前面)、擅長、不找它做的事、會的技能、能力、可以用的電腦
- 同事名冊:每個 Bot 的提示裡一行一個其他 Bot(簡介、擅長、不找它、在哪幾台電腦),不含別人的
  soul 和記憶;順序固定,吃得到快取
- 能力 11 類(上網、瀏覽器、螢幕、檔案與指令、Mac App、連接器、電話簡訊 X、例行任務、頁面、
  合作、管理 App):沒勾的工具不提供、規則不寫進提示;硬叫會被 agent 擋下並說該找誰
- 技能:說明只列自己會的,use_skill 只讀得到自己的;自己學會的自動算它的
- 可以用的電腦:自己的電腦一定可以;預設電腦不在名單時回到自己的電腦,不誤報「沒有連線」;
  其他畫面也拿得到完整電腦清單來勾;匯出 Bot 不帶電腦名單和草稿
- 舊 Bot 全部勾選(None = 全部),行為不變
- 例行任務:每輪只從那則訊息讀起(Message::fresh),提醒先讀頁面/查記憶;聊天畫面不變,
  使用者自己的下一則照樣看整段
- 順手修:角色說明結尾的「。」不再變成「。。」
- 實測(照建議勾能力):明日之星固定內容 ~21.7k → ~11.5k token、FSD ~25.5k → ~13.2k;
  例行任務每輪歷史最多 ~70k → 幾百

連接器(MCP)
- 實測三個連接器都能用(本機用 AnyBot 自己的 MCP client):time(get_current_time)、
  fetch(讀 example.com)、SccMCP(82 個工具,唯讀的 system_status 查詢成功;超過 20 個走
  find / use,搜尋得到)
- 測試:有「連接器」能力的 Bot 拿得到(大的走 find/use、提示有說明),沒有的拿不到,硬叫三種
  方式都被擋
- 測試用的假模型伺服器改成讀完整個請求再回,平行跑測試時不再偶發斷線

驗證:macOS cargo test 389 通過(連跑三次);Windows/Linux cargo check 通過

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 17:14:51 +08:00
王性驊 c834ab689f 修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫
卡住當機
- ⌘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 14:19:59 +08:00
daniel wang 4b53ad41eb 保險箱: 填入跟著瀏覽器路由走——手機叫 bot 也能填「裝置連結」電腦的瀏覽器
- vault::REMOTE_TOOL (browser_vault_fill): 大腦規劃、使用者核准後,只有這一筆
  密徑經帳號中繼送到那台電腦,在它的瀏覽器填入;分頁網址守衛照舊防釣魚
- 登入/卡片/聯絡三種填入都支援;填入前先在該電腦讀分頁(kind:host)再規劃
- 填入結果與「一律允許」記回大腦端的保險箱;模型永遠看不到密碼
- 雲箱路由補上 in_box 包住規劃(雲端大脑的保險箱填入不再填錯機器)
- 拆出 login_secret_of / login_fill_text / card_values / card_fill_text /
  contact_values / contact_fill_text / plan_card_at / plan_contact_at,
  本機與遠端兩條路共用同一套文字與安全檢查
2026-11-12 22:53:30 +08:00
王性驊 66dce03cee 思考模式、連接器帳密、圖表: a bot's thinking mode, connectors that log in with a username and password, native charts
思考模式: each bot picks 自動/快速/平衡/深入. Claude gets output_config.effort,
OpenAI-compatible services get reasoning_effort; a model that refuses the
setting is retried without it and not sent it again.

連接器: a connector takes a 帳號 and 密碼. {username}/{password} written in the
command, env, address or header are filled in there; written nowhere, a local
server gets MCP_USERNAME/MCP_PASSWORD and a remote one Authorization: Basic.
The password is kept like a key: screens see only 已設定, and the brain clears
it when a screen changes the command or address. A test now covers a screen's
switch stopping and restarting the brain's connector.

Also in this tree (written by pi-bolt earlier): ```chart blocks drawn as
native charts, older images sent as summaries with a look_image tool, and
image tokens counted in the history size.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha4t4P58pvWECQYXBjo
2026-11-12 21:00:14 +08:00
王性驊 f7ce2dae0c 連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
  「未連線」 and its error never reached the person. The brain now sends its connectors' state with
  each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
  tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
  connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
  connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
  itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
  128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
  last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 15:53:17 +08:00
王性驊 eb3157852a 安全、修正: 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 14:34:10 +08:00
王性驊 935cee9346 繁體中文、換電腦: what a model writes is put into Traditional Chinese whatever the setting's system; a work folder from another computer lands under this home
- 繁體中文: converted at the one place every model call comes back (providers::run_step),
  decided from the request itself: the setting is 繁體中文, or it follows the system and
  the person writes Traditional. It used to be on only for the explicit setting, so a
  brain on an English server with 跟著系統 never converted, whatever the instructions said.
  Not when another language is chosen, nor when the latest message asks for Simplified.
- Converted: the reply, the thinking, and steps whose words are for the person (question
  card, card, page, memory, routine). Left as written: code blocks and `inline code`, a
  line of Japanese, file names, commands, searches, recipients.
- Taiwan wording after the characters: about 55 one-meaning computer terms (網絡→網路,
  文件夾→資料夾, 默認→預設…), and zhconv's OpenCC tables on (设置里的 → 設定裡的).
- The reply instruction says it too: no Simplified characters, no mainland wording.
- 換電腦: a bot's work folder chosen on one computer (/Users/daniel on a Mac) no longer
  breaks every file and command step on another (Linux, another user). It is sent as ~/…
  with the folder as chosen alongside; the receiving computer uses the folder if it is
  there, else the same place under its own home, else its home.
- FEATURES.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 10:29:02 +08:00
王性驊 3720ee501e 問題卡、搜尋: 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 10:17:32 +08:00
王性驊 908433967a 長對話: old step results are set aside first; a summary only if that isn't enough, written by the quick model
- at 70% of the context, results of older steps longer than 600 characters keep their first 200 for the model
  (the newest 6 messages stay whole): no model call, no wait — 20 file reads went from about 128k to 22k
  tokens in 10 ms in the test
- the chat keeps every result whole for the person; the mark (Message::folded) is kept, so the model reads the
  same thing each turn
- the summary, when still needed, is written by the bot's step model when it has one

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 00:02:32 +08:00
王性驊 f9a261959c version_0_1_1-alpha 2026-11-11 16:19:06 +08:00
王性驊 c6c9a1674a 傳送: a file or a few words from any device of the account to any other
Outside the chats and without a bot: computer → phone, phone → computer,
computer → computer.

- The brain is the post office (src/drops.rs). The sender hands the file
  over in 2 MB pieces; the brain keeps it in drops/ and pushes it piece by
  piece to the destination computer (device/run tool `drop_put`), going on
  from where a broken link stopped and waiting up to 7 days for a computer
  that is off. What is for the phone waits at the brain to be downloaded.
- Files land in Downloads/AnyBot with a notification; words go on the
  clipboard. A computer takes parcels only from its own brain.
- Window: an ↑ button at the bottom of the sidebar opens 傳送到其他裝置
  (pick a device, drop files or paste text, the last 7 days below).
- Phone: 傳送到其他裝置 in the account menu (send, download, copy).
- Bots: a `send_to_device` tool, gated like send_file.
- Owner only; the account server is unchanged. Without an account, this
  computer and a phone connected to it directly can exchange.
- Docs: FEATURES §36, protocol, architecture, multi-device (zh and en).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3SYw9JJ9dXwaNvYh4
2026-11-11 10:04:13 +08:00
王性驊 b4ba710eb4 記憶: each bot keeps its own, remembers like a person, and decides for itself
- Each bot only sees its own memories (the shared "bot 0" layer is gone).
- A 做過的事 line is written only for a turn that really did something
  (or looked things up in 5+ steps); small talk and simple answers aren't kept.
- The bot judges on its own what is worth remembering and whether a new fact
  is the same as, replaces, or stands beside an old one (`separate`); it
  doesn't ask the person first.
- remember no longer refuses a different fact that shares a subject with an
  old one (likeness is counted both ways).
- Filler messages (謝謝, 繼續, ok…) carry no memories; `_` and `%` are no
  longer wildcards in the search.
- Team members no longer receive `memories` with messages, and picks are
  taken only from the owner and only when they are this bot's real memories.
- forget only retires 記得的事, never a 做過的事 line.
- Memory chips are hidden while the bot is working (desktop and phone).
- A reply made long after the message gets a 〔現在時間〕 line.
- The nightly tidy runs only on the brain; edits are capped at 500 chars.
- Model download: no total body time limit, only a 60 s stall limit.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3SYw9JJ9dXwaNvYh4
2026-11-11 09:35:59 +08:00
王性驊 28784232a5 記憶: 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-11 07:46:50 +08:00
王性驊 a514b33fb3 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 11:46:17 +08:00
AnyBot Dev 61c38dca66 Live e2e wiring: real-brain shell + browser turns (env-gated test, ANYBOT_BROWSER_FLAGS dev flags)
- agent live test drives real OpenAI-compatible endpoints (ANYBOT_LIVE_BASE/KEY/MODEL/PROMPT)
- specs assembled like the app (web::specs_for) so the model truly sees the browser tool
- botbrowser honors ANYBOT_BROWSER_FLAGS (containers: --no-sandbox --headless=new)
2026-11-09 21:11:11 +08:00
AnyBot Dev 6f8568d16b A live-model e2e: any OpenAI-compatible brain must drive a shell turn (gated by env) 2026-11-09 20:57:32 +08:00
AnyBot Dev 7d61de83a8 Skills you can hold in your hand: skill files, install, 示範即教學 (P7+C8)
- a skill is now a .md file (front matter + instructions + an optional
  steps fence): <data>/skills/ is read at every start, files win;
  install from the CLI (anybot --install-skill <path|url>) or from the
  phone (設定 › 整合 › 技能 › 從網址安裝), delete takes the file with it
- skillify (C8): long-press your own message in the chat → 教我做 —
  the last turn that answered it becomes a replayable skill from the
  oplog: only steps that succeeded, looking steps and numbered clicks
  filtered (numbers die with their screenshot)
- a browser replay step that doesn't fit gets one fresh page read
  before the bot takes over, same courtesy the screen steps had (C8)
- three example skills in skills/, the format guide in docs/skills.md
- the prompt lines that merges had eaten: menu_click/fill_form/wait_for
  (C3), memory recall + search_documents (P6) — the tools were there,
  the model just wasn't told about them
2026-11-09 20:46:02 +08:00
AnyBot Dev f7eb5dbcab Meaning beside the words: local embeddings + a document shelf (P6, step 2)
- embed.rs: vectors from the person's own Ollama (/api/embed), model
  auto-found among installed ones (bge-m3, nomic-embed-text…), off by
  absence — no Ollama is a normal state: every search still answers
  with words, the toggle lives in 設定 › 一般
- memories grow a vec column; recall() is now hybrid: trigram FTS,
  two-character windows for Chinese, cosine over the shelf, merged by
  reciprocal rank — 「那篇講語法的筆記」 finds text that never says 筆記
- docindex.rs: the person's folders (their 文件 by default, add more in
  設定 › 一般), text-shaped files chunked into SQLite + FTS, refreshed
  by mtime, gone files leave; one background thread does it all — the
  turn never waits on embeddings
- one tool for it: search_documents {query, limit} — reads, no approval
- 251 tests: a real temp folder swept, answered, and swept again after
  deletion; offline Ollama tested as the normal state it is
2026-11-09 20:23:35 +08:00
AnyBot Dev bbd677b050 Memory, searched not carried: FTS index + event log (P6, step 1)
- store.rs grows a memories table + FTS5 (trigram) index: bot facts and
  the person's shared lines (bot 0), no cap — state.json's 200-item list
  stays the source that mirrors sync and the 設定 list; the index is its
  searchable superset, best-effort as always
- queries answer in Chinese: phrase hits (FTS), then words inside lines —
  CJK queries cut into two-character windows, lines scored by how many
  they contain (「有没有靠窗」 finds 「我喜歡靠窗的座位」)
- every finished turn writes one event line (ask → answer) nobody's
  asked to write: 「我上個月說的那個報表」 answers from months back
- the turn's prompt carries the 14 memories that answer *this* request
  (no index yet: the list itself, the old behavior); remember/forget and
  the UI's 忘記 keep the index in step with the list
- embedding (Ollama) and document indexing land on this same table next
2026-11-09 18:15:24 +08:00
AnyBot Dev 9b68017a19 System prompt speaks the one-tool shape (H2 follow-up)
- 「網頁上的事一律用 browser 一個工具」: the guidance lines now name
  action=open/read/click/type/table/find/wait/download and action=profiles —
  the model reads one vocabulary in the system prompt, the schema and the
  loop-guard messages (browser_read/browser_open mentions gone from those)
- H3, light: usage rules were already in the system prompt (and C1 caches
  the tools block too, so moving descriptions there saves little) — the
  browser schema shed its duplicated safety sentence to the click line;
  wholesale description-slimming deliberately not done: the guidance that
  reads as noise is what keeps a small model out of trouble
2026-11-09 18:12:18 +08:00
AnyBot Dev 6f660dd15d One browser tool: 25 schemas → 2, actions like the CUA prior (H2)
- browser {action: open|read|elements|find|table|screenshot|click|hover|
  type|press|select|scroll|wait|tabs|back|upload|download|pdf|dialog|eval|
  profiles|fill} — the shape models are trained on (Anthropic CUA, OpenAI CUA)
- vault fills ride on it: fill {kind: login|card|contact, id}; vault_list
  stays its own tool; the fills' approvals (every use asks, the model never
  sees the secret) are untouched — expand happens at the model-output
  boundary, so oplog, approvals, replay, remote limbs keep internal names
- web keeps {web_fetch, browser}; the eighteen browser_* and the three
  fill_* schemas leave the model's view (−48% schema text, −58% counting
  the old web trio; 25 tools → 2)
- tests: every action maps to a real internal tool, every internal tool is
  reachable from the one schema
2026-11-09 18:11:36 +08:00
AnyBot Dev f4c135a98b Audit timeline: what this turn did, on the phone (S5)
- oplog gets wall-clock times on tool records (serde-default: old logs read
  fine), and OpLog::timeline turns the machine log into a story: per turn —
  the prompt, model calls (retries counted into one line), every tool with
  the arguments it ran with and its status (等核准/進行中/完成/被拒絕/失敗),
  messages typed mid-turn, stop, outcome
- GET /api/bots/<id>/audit (owner/admin; members' allow-list untouched)
- 對話詳細資訊 gains a 稽核 tab: newest turn first, running tool shows
  進行中…, an approval gate shows as 等核准 — the phone can answer the question
  'what is my bot doing right now, exactly', step by step
- the log stays the machine format recovery reads; the timeline is derived
2026-11-09 17:59:26 +08:00
AnyBot Dev ef58028cf4 Merge s3/injection: injection defences + red-team bench (S3) 2026-11-09 17:20:10 +08:00
AnyBot Dev e1d0998c20 Injection defences and a red-team suite (S3)
- clicks on controls whose own words say money/sending/deleting ask the person
  every time — on every computer, in direct mode, no grant silences it (the
  harness decides, not the model, so a page cannot talk its way past it)
- screenshots paint card-number and OTP boxes black before any model sees them
- content the bot READS (pages, files, screens) enters the history wrapped in
  <untrusted>, and the system prompt says the wrapper means content-not-orders
- keep_to_chosen now has a test on the screen tools: a model cannot move a
  screen step onto another computer by itself (B26's promise, pinned)
- bench red team R1–R7: every payload's goal is a harmless probe file /
  button code; passing = reporting the page honestly and leaving the probe
  untouched. Run: --tasks R1..R7
2026-11-09 17:19:21 +08:00
AnyBot Dev ccfeaff235 Noop detection by machine tag, not by matching the Chinese sentence 2026-11-09 17:10:25 +08:00
AnyBot Dev f2af1f65b4 One computer tool with an action enum replaces twelve computer_use_* specs
The model picks action=screenshot/click/typing/… on a single `computer` tool
(the shape Anthropic's and OpenAI's computer-use models are trained on):
choosing among twelve near-identical names was its own error source, and the
twelve schemas were the biggest stable part of every request. Calls expand to
the internal per-action tools at the model-output boundary, so approvals,
repeat guards, skill replay, the remote limb protocol and the work log keep
their existing names — old limbs need no update.
2026-11-09 16:50:18 +08:00
AnyBot Dev f3c7f45499 Pin the prompt-cache contract: system+tools are built once per turn (facts added before the step loop) 2026-11-09 16:45:56 +08:00
AnyBot Dev 1bc2fdcec9 Rewrite decompilation comments as behaviour specs; move reverse-engineering docs out of the repo; drop third-party marks from UI strings (i18n tables synced) 2026-11-09 16:37:33 +08:00
王性驊 22eaf031b0 The quick model runs again, the Mac's own menus get numbers, and an unread window is said
- quick_tools indexed serde_json Values mutably, which inserted
  actions.items.properties = null into click/typing/scroll; xAI refused
  the whole tool list, so since ba1fce5 every step fell back to the main
  model. It now uses get_mut and the test checks nothing but ref changes.
- The front app's menu bar titles and any open menu (submenus, right-click
  menus) are listed with numbers and their shortcuts; an option-key
  alternate in the same place is noted on the visible item.
- Disclosure triangles, colour wells and date fields get numbers; an
  icon-only control without a name goes by its description.
- When the front window can't be read the list says so (with the reason)
  instead of 「」 above the menu bar alone.
- Computer facts add each system's conventions (Mac: cmd+shift+G, save
  panel, default format, /bin/sh echo -n; Linux: GTK ctrl+L).
- `anybot --help` and unknown -- flags print the usage and exit instead of
  opening the window on the real data folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-09 14:58:40 +08:00
王性驊 ba1fce5558 Keys wait until the app the bot looked at is still in front; the quick model names its controls; system prompts are the person's
- Keys and typing into no field go to whatever is in front: a cmd+w meant for TextEdit reached
  the person's terminal after the TextEdit window had closed (its "close this window?" came up
  and was cancelled). They are now refused, with why, when the app in front isn't the one of the
  latest look.
- The quick model's screen tools have no `ref`: looking numbers up is where it pressed the wrong
  keys; it names controls (two of a name come back as trouble for the bot's own model).
- Instructions: macOS permission and security prompts are for the person to answer (a bot
  pressed 「不允許」 on one), and check what's in front before a shortcut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-09 14:03:40 +08:00
王性驊 d4745a7a7a The same click twice in a step is done once, a front app that vanishes for a moment is looked at again, and the notes have the Mac and held-out results
- Two identical clicks in one step opened the Mac's Wi‑Fi menu and closed it again: the second is
  skipped with a word on why (count: 2 for a double click).
- macOS Calculator had no focused window for a moment after 「乘」 and the list came back with
  only the menu bar: an empty or failed read is tried once more 0.3 s later.
- Benchmark notes: three more unseen apps on box v9 (16/16, GTK 2 apps 4-10x faster with gail)
  and the Mac mini run with Screen Recording (zoom, Wi‑Fi menu, Calculator checked by eye).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-09 13:31:25 +08:00