Commit Graph

85 Commits

Author SHA1 Message Date
王性驊 97aa46a0d3 自己連自己的帳號伺服器走迴圈位址:修 App 重開後「好久連不上」
實測:App 的帳號伺服器位址是 nobledesktop.tailbcc3a6.ts.net:8443——
本機服務經 Tailscale 自己連自己,hairpin 繞遠方中繼,每個請求 7–14 秒
(同一個服務走 127.0.0.1 是 0.4 毫秒)。所有同步、狀態、長輪询都走這條
路,重開 App 後「連線慢」與日常卡頓都是它。

- remote::self_hop:ts.net 名字解析到本機自己的 Tailscale 位址時,連線
  改走 127.0.0.1(TLS 用 URL 裡的 ts.net 名字,證書照驗;別的機器連
  同一位址照走 tailnet)。套用到 sync 長輪询、登入/登出、備份、還原、
  團隊名單、大腦 API。結果緩存 60 秒。
- 連同上一輪的 connect 5 秒快失敗一起生效:重開到連上從 30–70 秒 → 秒級。
- 新測試 self_hop_shortcuts_only_your_own_tunnel_address

已驗證: cargo test 723 全綠;127.0.0.1:8443 本機連通 0.4ms(curl 實測)。
未驗證: 使用者真機重開 App 計時(tailnet hairpin 環境-dependent)。
2026-11-19 16:06:48 +08:00
王性驊 756882293f 全 app HTTP 連線 5 秒快失敗:修重開後「好久連不上」和按鈕卡 30 秒
根因:所有 ureq client 只設了總超時,連接超時是 ureq 預設的 30 秒。
重開 App、斷網、tailnet 未就緒時,每個請求(重連帳號伺服器、模型呼叫、
web 抓取、webhook)都靜靜掛滿 30 秒才發現連不上——App 重開後好久連不上、
按停止/任何按鈕長轉圈,都是這 30 秒。

- net::agent(共用基底)+所有自建 client(remote/teams/triggers/embed/
  phone/web/channels/botbrowser/mcp_oauth)統一 timeout_connect 5 秒
  (HF 大檔下載 10 秒、本機瀏覽器 3 秒)
- 帳號伺服器重連迴圈照 1→2→4…30 秒退避:連不上時 5+1 秒就重試,
  重開 App 到連上從 30–70 秒降到 ≤6 秒
- 新鎖測試 connecting_dies_fast_everywhere

已驗證: cargo test 722 全綠。
未驗證: 真機重開後連線秒數(使用者自觀);離線場景需實機斷網。
2026-11-19 16:01:50 +08:00
王性驊 14727cd226 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 20:09:52 +08:00
王性驊 36420f38cb 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 19:36:07 +08:00
王性驊 f3ff553551 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 17:44:16 +08:00
王性驊 b3a03ad7c8 Merge branch 'serve-bind': 明文 http 只走真的 Tailscale 通道;ANYBOT_PHONE_BIND
手機直接連線的 http、帳號伺服器的 http(帳號密碼、配對碼、這台電腦的金鑰)都只認真的 Tailscale
通道,不再看位址像不像 100.x(有些 Wi-Fi 也發 100.64/10)。帳號伺服器在開連線那一刻對要連的
位址查、固定解析結果、不走代理、http 不留舊連線;還原、長連線、備用連線都經過同一個檢查點。
ANYBOT_PHONE_BIND 讓手機頁面只聽一個位址,綁不上時在背景重試、照實說原因。IPv6 的登入鎖與憑證、
host_port 照 HTTP 程式庫的讀法、Windows 用 ipconfig 認 Tailscale。verify-anybot 的 scratch 只聽
127.0.0.1。

七個 commit(五輪+兩次文件、訊息修正),每輪都有乾淨脈絡的獨立審查,最後兩輪沒有 P0/P1。
衝突:docs/feature-map/phone.md 的「驗證:」一行,兩邊都加了東西——保留 F1 那一行,加上
`cargo test lantls::`。
已驗證: 全部 cargo test(試合併後三次全綠)、clippy、lint-sh、run.sh --replay;
  remote::account_sync_live 接 127.0.0.1 的帳號伺服器通過;修正前後用 lsof 和 curl 量過誰在聽、誰收 http
未驗證: 真的發 100.64.x 的 Wi-Fi、Linux/Windows 實機(Windows 的 cfg(windows) 沒編譯過)、
  真的帳號伺服器部署(make update-server)、tunnel::own_certificate_live
人類簽名: 使用者在對話中同意合併(2026-11-18)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 13:58:26 +08:00
王性驊 ce54297375 fix: 帳號伺服器 http 被拒的那一句不再說「之後會再試」;localhost 的原因不再被吞掉
一般拒絕(0c250d5 起)和 localhost 拒絕(a23f420)都說「之後會再試」,可是登入、建立帳號、
兩步驗證、配對、還原會回到表單,不會再試;只有長連線、備用連線、--serve 會再試(文件本來就這樣
分)。兩句都拿掉括號。localhost 那句沒有 http://,why_unreachable 只放行帶 http:// 的拒絕,
所以 relay_agent 的解析器擋下時只剩「網路連線出了問題」——改成「網址是 http://localhost」。
plain_hop 的註解把「每個位址都是 loopback」加回來(localhost 以外的名字仍要全部是)。

已驗證: 全部 cargo test(不帶金鑰、DOCKER_HOST 指到不存在)654 通過(新斷言加在既有的 a_one_word_name_is_never_a_number 裡);clippy -D warnings 乾淨;
  新斷言 why_unreachable(localhost 拒絕) 原樣傳出——把 http:// 拿掉時 a_one_word_name_is_never_a_number 失敗,還原後逐位元組相同
未驗證: 真的 /etc/hosts 有 fe80::1%lo0 的 Mac(只有單元測試);verify-anybot 沒重跑(手機上看不到差別)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 12:16:00 +08:00
王性驊 a23f420074 docs: localhost 的說法跟上程式——只連它的 loopback 位址,一個都沒有才不連
SECURITY.md、FEATURES.md 還寫著「查到的位址都是這台才算」,程式(8bb3ffc)已經改成只留
loopback 位址、其他略過;plain_hop 的註解同步。localhost 被拒的那一句跟一般拒絕的說法一致:
金鑰也不會送、「之後會再試」。

已驗證: 全部 cargo test(不帶金鑰、DOCKER_HOST 指到不存在)654 通過;clippy -D warnings 乾淨;
  拒絕訊息仍含 localhost 和 /etc/hosts(a_one_word_name_is_never_a_number)
未驗證: 只改文件、註解和一句訊息,沒有重跑 verify-anybot(手機上看不到差別)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 12:12:13 +08:00
王性驊 8bb3ffc9b0 fix: localhost 只連它的 loopback 位址;測試不再搶 65535、不再共用帳號長連線
第五輪(新的獨立審查,沒有 P0/P1):

- localhost:只留它查到的 loopback 位址來連(舊 Mac 的 /etc/hosts 還有 fe80::1%lo0 localhost,
  上一輪會因此整個拒絕、還說成「不經過 Tailscale」);一個 loopback 都沒有才拒絕,並照實說是 /etc/hosts。
- 測試 bind_problems_are_said_as_they_are 原本真的去綁 65535(放掉再綁一次),可是 65535 在 macOS 對外
  連線的臨時連接埠範圍裡,平行的測試可能剛好拿走。改成檢查連接埠範圍(新的 lan_ports,bind_lan 也用它),
  不碰真的 65535。the_phone_page_binds_where_told_and_keeps_trying 放掉占位的連接埠後,接受範圍裡任何一個
  (放掉的那個可能被別的測試的連線拿走)。
- 早就有的測試互相干擾:tunnel 的測試把整個程式共用的帳號長連線開著,a_brain_too_old… 這時呼叫 to_brain
  會走那條長連線而失敗。兩個測試用同一把只在測試裡的鎖(tunnel::LINK_TESTS)輪流跑,tunnel 測試結束前把
  它開的長連線清掉。產品程式碼沒變。
- phone.md:已經連上的長連線不會中途重查,照 SECURITY.md、FEATURES.md 的寫法改。

已驗證: 完整 cargo test(金鑰清空、DOCKER_HOST 指到不存在)連跑兩次都全綠(654 過、47 ignored 沒跑);
  cargo test -- tunnel:: a_brain_too_old 連跑三次全綠(修之前三次都失敗);cargo clippy --bin anybot
  --all-targets -- -D warnings 沒有警告;sh deploy/ci/lint-sh.sh 過。回退各做一次都被測試抓到:localhost
  改回要全部是 loopback、連接埠範圍改回不含最後一個(65535 變空的)、tunnel 測試不拿鎖。
未驗證: 沒有接真的帳號伺服器(同前幾輪);手機頁面行為沒變,沒有重跑 verify-anybot。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 12:06:00 +08:00
王性驊 cc16b7df0f fix: http 帳號伺服器每個請求都開新連線才查得到;一個字的名字不能是數字;文件照實寫重試
第四輪(新的獨立審查,沒有 P0/P1):

- http 的帳號伺服器 client 不留連線(max_idle_connections 0):每個請求都開新的連線,所以每個請求都在
  開連線那一刻查。上一個 commit 說「workers 每一輪也一樣」其實不對——keep-alive 會重用同一條連線;現在才對。
  https 照舊。長連線(WebSocket)是每次連上、重連時查,連著的時候不中途重查,文件照這樣寫。
- 一個字的名字要以英文字母開頭、只有字母數字 - _:系統的解析器會把 134744072、0x8080808、01002004010
  讀成 8.8.8.8,這些不再當成 Docker 的名字。localhost 只有查到的位址都是 loopback 才算這台。
- phone.md、SECURITY.md、FEATURES.md:登入、還原、配對被擋時回到表單說原因;只有長連線、備用連線和
  --serve 的 ANYBOT_ACCOUNT 會自己再試。

已驗證: 完整 cargo test(金鑰清空、DOCKER_HOST 指到不存在)全綠(654 過、47 ignored 沒跑);cargo clippy
  --bin anybot --all-targets -- -D warnings 沒有警告;sh deploy/ci/lint-sh.sh 過。新測試各回退一次都抓到:
  連線池打開(三個請求只開一條連線)、一個字的規則改回「沒有點、不是 IpAddr」、localhost 改回照名字相信。
未驗證: 沒有接真的帳號伺服器(同上一輪的原因);手機頁面行為沒變,這輪沒有重跑 verify-anybot。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 11:52:23 +08:00
王性驊 0c250d5a41 fix: 帳號伺服器的明文規則管到每一個帶密碼或金鑰的連線,在開連線那一刻查;Tailscale 通道認得更準
第三輪(新的獨立審查:兩個早就有的 P1,和幾個 P2):

- A:「從帳號備份還原」不經 relay_join,原本 http 檢查管不到。現在帶帳號密碼、配對碼或這台電腦金鑰
  的請求都經 relay_post/relay_agent:登入、建立帳號、兩步驗證、還原、配對、通知、網站、成員、備份、
  和大腦同步、手腳的指令、還有備用連線(workers)。
- B:http 的帳號伺服器原本只在登入時查一次,之後長連線每次重連都直接連。現在 tunnel::open 每次
  (重)連都對要連的位址查,不符合就不連、狀態寫原因、照原本的退避再試;workers 每一輪也一樣。
- 1(DNS 兩次查):選「釘住」——http 的帳號伺服器用自己的 ureq client,resolver 在開連線那一刻對
  查到的位址做檢查,只連通過的那幾個(web_fetch 已經用同一種做法);長連線也是查完就連那幾個位址。
  名字可以照常用,不必限定 IP 或 *.ts.net。這個 client 不走代理(代理會照它自己的路把明文轉出去)。
- 2:host_port 改用 ureq 自己的 URL 解析(http::Uri),`?`、`#` 後面不是主機;長連線也用它。
  model_fetch_here 的私有位址檢查一起修好。
- 3:Tailscale 通道要「叫 tailscale…」或「點對點介面+Tailscale IPv6(fd7a:115c:a1e0::/48)」,
  Windows 看介面卡名字;PPPoE、電信 NAT、WARP 的 100.x 不算,ip -o addr 的 /32 不再算。ifconfig 找不到
  通道(busybox、舊 net-tools 的 inet addr:)時也問 ip。
- 4:沒有 IPv6 的電腦上,*.ts.net 的 IPv6 位址沒有路由就略過、用 IPv4(原本整個拒絕)。
- 5:介面資料 30 秒更新一次,第一次之後都在背景讀,設定頁每一幀拿快取(Windows 不會在 UI 執行緒跑
  ipconfig);remote::addresses 也用同一份,不再每一幀跑 ifconfig。
- 6:綁不到連接埠時分開說:位址不在、不准用(1024 以下、系統保留)、被占用、其他;65535 會試,不再說
  「65535–65534」。
- 文件照程式寫:SECURITY.md(帳號伺服器的規則管到哪些請求、每次開連線查、釘住、不走代理、一個字的
  名字在一般網路上的風險、通道怎麼認)、phone.md、FEATURES.md。

已驗證: 完整 cargo test(金鑰清空、DOCKER_HOST 指到不存在)全綠(652 過、47 ignored 沒跑);cargo clippy --bin anybot --all-targets
  -- -D warnings 沒有警告;sh deploy/ci/lint-sh.sh 過。每個回退各做一次、新測試都抓到(10 個):relay_post
  不查、長連線開連線不查、workers 用一般 client、resolver 放行一切、host_port 改回手寫切法、任何點對點
  100.x 都算通道、沒路由的位址算拒絕、介面過期時在呼叫的執行緒重讀、不准用說成被占用、65535 不試。
  實機(verify-anybot,這台 Mac 的 utun4 有 100.84.144.91 和 fd7a:115c:a1e0::d738:905c):phone 區範例旅程
  照貼結束碼 0;預設綁定照舊(*:埠、Tailscale 位址 http 200、區網 http 308)。
未驗證: 帳號伺服器的部分沒有接真的帳號伺服器跑——用單元測試走 relay_join、restore、relay_worker、
  tunnel::run 和 http client 的真程式碼(scratch 不准帶 ANYBOT_ACCOUNT,也不手寫含金鑰的設定檔);
  Wi-Fi 自己發 100.64.x 的網路、PPPoE、WARP、busybox 的 ifconfig 只有樣本測試;Linux、Windows 實機沒跑
  (Windows 的 ipconfig 只有樣本;cargo check --target x86_64-pc-windows-msvc 卡在 ring 要 Windows SDK 的 C 標頭,cfg(windows) 那幾行沒編譯過);設定頁顯示快取的那一行沒有開視窗看。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 11:35:43 +08:00
王性驊 838bb95a26 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 11:09:59 +08:00
王性驊 afb1bff057 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 11:03:45 +08:00
王性驊 30c3895eac 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 10:48:10 +08:00
王性驊 413aab7d19 fix: 手機直接連線的 http 只認真的 Tailscale 通道;ANYBOT_PHONE_BIND 讓它只聽一個位址
區網直連的 HTTPS 前面放行不加密 http 的規則,看的是「來源位址在 100.64.0.0/10」。那一段是電信業者
NAT 的共用位址,不是 Tailscale 專用:Wi-Fi 自己發 100.64.x 位址時(部分熱點、校園和公司網路),
手機和這台都是 100.x,設定頁還把這台列成 http://100.x,手機密碼和登入就在空中明文傳。真的 Tailscale
沒有問題(位址在 utun/tailscale0 通道上,WireGuard 加密,tailnet 以外連不到)。

- lantls:不加密的 http 只收 loopback,或「來源在 Tailscale 範圍、而且連到的是這台 Tailscale
  通道介面上的位址」。通道位址從 ifconfig(POINTOPOINT)或 ip -o addr(tailscale0、/32)讀,30 秒快取;
  讀不到介面的電腦(Windows)沒有通道位址,http 一律轉 https。
- remote:列出的網址只有通道位址用 http(原本凡 100. 開頭都是 http);ANYBOT_PHONE_BIND 讓手機頁面
  只聽一個位址(127.0.0.1 給前面有代理或測試用的副本、Tailscale 位址只給 tailnet),列出的網址也只剩那個;
  寫的不是位址就不打開直接連線(不會退回聽每個位址)。沒設時照舊聽 0.0.0.0。
- 伺服器部署不受影響:大腦在 Docker 裡沒有發佈這個連接埠,tailscale serve 前面接的是帳號伺服器(8780)。
- verify-anybot:scratch 的 --serve 用 ANYBOT_PHONE_BIND=127.0.0.1,doctor 檢查只聽 127.0.0.1;
  要驗證從區網/Tailscale 連進來時用 ABV_PHONE_BIND=0.0.0.0。
- 文件:phone.md(http 只認通道、ANYBOT_PHONE_BIND/ANYBOT_PHONE_PORT、Windows、驗證加 lantls::)、
  FEATURES.md(手機網址、環境變數)、SECURITY.md。

已驗證: 完整 cargo test(金鑰清空、DOCKER_HOST 指到不存在)全綠(643 過、47 ignored 沒跑);cargo clippy --bin anybot --all-targets
  -- -D warnings 沒有警告;sh deploy/ci/lint-sh.sh 過;新測試 lantls::tests::tailscale_is_the_tunnel_not_the_range、
  remote::tests::the_phone_page_listens_where_it_is_told_and_lists_that,plain_http_from_the_wifi_is_sent_to_https
  加了 Wi-Fi 發 100.64.x 的情況。實機(這台 Mac,utun4 上 100.84.144.91)用 verify-anybot:修改前 scratch 的
  --serve 聽 *:埠,Tailscale 位址 http 200、區網 http 308;修改後預設(ctl)只聽 127.0.0.1,區網和 Tailscale
  位址連不上;ABV_PHONE_BIND=0.0.0.0 時照舊 *:埠、Tailscale 位址 http 200、區網 http 308→https(預設行為沒變);
  phone 區的範例旅程在只聽 127.0.0.1 下整段照貼結束碼 0。
未驗證: Wi-Fi 自己發 100.64.x 位址的網路——手邊沒有這種網路,只有單元測試;Linux(ifconfig/ip -o addr
  的格式只用樣本測)和 Windows(認不出通道、http 轉 https)沒有實機;伺服器部署沒有重新部署(沒有改 deploy/);
  手機實機連線沒有測(用無頭 Chrome 代替)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 10:36:45 +08:00
王性驊 158b3f80be Merge branch 'integrations-tidy': 連接器、技能改成清單+各自的頁;等你允許的卡片按鍵修正
衝突都是兩邊各加了東西,兩邊都保留:
- mirror_ui:送給螢幕電腦的連接器狀態用有上限的 mcp_state_for_screen,加上 ChatGPT 方案的帳號狀態。
- i18n_table:ChatGPT 方案和連接器/技能頁的翻譯。
- mcp_oauth、remote:兩邊各自新增的測試。

已驗證: 合併後 cargo test 整套連跑 4 次全綠(640)。
未驗證: 實機(允許卡片的 Enter/Esc、ChatGPT 帳號登入與串流、螢幕電腦改連接器名稱)。
審批路徑的改動由使用者要求合併發佈。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3KhvSzysuKUobKUTR
2026-11-17 21:08:21 +08:00
王性驊 6a4d90d935 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 19:08:59 +08:00
王性驊 a0e1b36a06 fix: 螢幕電腦改連接器名稱改成明確請大腦改,不再從網址猜
- 螢幕電腦上改名:排一個「把 A 改成 B」給大腦(/api/sync/mcp-rename,同一個工人照順序送,
  排在帶新名字的修改之前),大腦改它自己那一個:金鑰、密碼、在清單裡的位置、登入都留著;
  空白或同名、或不是擁有者,拒絕。連不到大腦時不改並說原因。
- 這台電腦自己改名,直接把登入搬過去。
- 拿掉從網址猜改名的兩段(大腦偵測改名、還原密鑰時用網址找):斷線時累積的「刪一個、加一個
  同網址的」可能被當成改名,把登入和密碼配給錯的連接器。還原密鑰回到只看名字(和 main 一樣)。
- feature-map 拿掉「Bot 也能改名」(manage_connectors 沒有改名);FEATURES.md 的順序照畫面。

已驗證: cargo test 全綠;新測試 the_brain_renames_a_connector_for_a_screen(位置、密碼、登入留著,
  同名、空白、非擁有者拒絕);mirror_ui 確認同網址的別的連接器拿不到密碼。
未驗證: 螢幕電腦連真的大腦實際改名(要兩台機器)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3KhvSzysuKUobKUTR
2026-11-17 18:26:52 +08:00
王性驊 a03f7c7458 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 17:23:10 +08:00
王性驊 1f59795d3f 合併: 手機網頁的改良(web-pwa-polish):新訊息進場、iOS 鍵盤、觸感、主畫面捷徑、通知上直接允許/拒絕
收進來的:新訊息從下面滑進來、iPhone 鍵盤蓋住時輸入框抬高、送出和允許時輕震、主畫面圖示的「主要 Bot」「未讀」捷徑、通知上的允許/拒絕。
沒收的:換頁動畫(main 已經有 in-fwd/in-back)、分支裡寫死在程式裡的 manifest 和 service worker(main 已經搬成 mobile/ 的檔案,種類、圖示數字、震動都比較完整),所以捷徑和按鈕補在那兩個檔案裡。
改過的:通知上的按鈕只給「要你允許的事」(操作、用電腦工具、在這台執行),問題卡和需要處理沒有(原本「允許」會把需要處理當成「我完成了」);通知帶請求的編號,大腦確認還是正在等的那一個才答,舊通知不會答到新的請求。

已驗證:cargo test 608 通過(新的 a_banner_answers_only_its_own_request)、clippy -D warnings 乾淨;relay 的 cargo test 22 通過。
未驗證:真的手機上的按鈕和動畫;帳號伺服器那半邊(relay、sw.js、manifest 由它送出)要 make update-server 才生效。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 13:54:10 +08:00
王性驊 f19b49f953 feat: Hooks:自己的程式插在 Bot 做事的固定時間點(Claude Code 的格式),Bot 也能在聊天裡幫你設
- hooks.json 跟 Claude Code 一樣(matcher、type command/http、timeout),AnyBot 和 Claude Code 的工具名字都認;使用者的在資料夾 hooks/,管理員的(先跑、改不了)在系統位置,MDM 可推。
- SessionStart(對話第一輪)、UserPromptSubmit(補資訊或擋下這一輪)、PreToolUse(擋、改參數、ask 一定問、allow 省一次問但擋不過安全規則和每次問的)、PostToolUse(換掉或補 Bot 讀到的結果)、Stop(叫它接著做,一輪最多 3 次)、Notification(跟著通知跑)。
- hook 自己出錯(結束碼、逾時、JSON、設定檔)就當它不在,紀錄檔寫原因;/doctor 寫有幾個、檔案看不看得懂。
- manage_hooks(list/add/remove):加和移除每次都先問,一律放行也問;管理 App 的能力,外面的訊息不能用。
- 測試裡每一輪只拿測試給那個 Bot 的 hook,不讀檔(同時跑的測試不會互相影響)。

已驗證:cargo test 602 通過(hook 本身:擋 rm、改參數、ask、壞掉的 hook、逾時、prompt 補資訊、Stop 用 stop_hook_active 放行、PostToolUse 換結果、manage_hooks 改檔;真的一輪:rm 沒有執行、跑的是 hook 改過的指令、Stop 讓模型多回一次)、clippy -D warnings 乾淨。
未驗證:HTTP hook 打到真的伺服器、管理員檔案的位置在真的 Mac/Linux 上、Windows 的 cmd。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 12:59:21 +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
王性驊 a60b101eb4 fix: 回覆下面的頁面卡片一頁只出一張,沒存成的寫入不出卡
一個回覆寫了同一頁好幾次(被寫法檢查退回、再存、又更新),每一步都是一則訊息、各畫一張卡,而卡片顯示的是頁面現在的樣子——同一張「第 3 版」出現三次;想改別的 Bot 的頁面被擋下,卡片也照樣出現(畫的是那個 Bot 的頁面)。

- pages::ids_in 只算存成功(Done)的 write_page。
- pages::cards_by_message:每個回覆(你的一則訊息到下一則之間)每一頁一張卡,放在最後存它的那一步下面。電腦的聊天和手機的 api 都用它;手機上沒輪到出卡的 write_page 顯示成一般步驟。

已驗證:cargo test --bin anybot 527 通過(新增 a_reply_shows_each_saved_page_once_under_its_last_save:被擋、被退回、存兩次 → 一張;下一個回覆再寫 → 再一張)。
未驗證:使用者那段對話本身(沒有那份資料);手機畫面沒有實點。
2026-11-17 00:05:21 +08:00
王性驊 9de00e244e 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 23:16:38 +08:00
王性驊 6695787989 fix: Bot 的電腦——瀏覽器埠、更新重試、螢幕對錯、看畫面不被收掉、make update-box、鎖檔
- browser_open_port 回傳並探測轉接後的本機埠(原本拿盒子裡的埠探本機:收工不收分頁,
  本機開著 9222 時還會關到自己 Chrome 的分頁)
- 自動更新重試:等待從失敗那一刻算(30/60/90…,上限 150 秒),連續失敗 5 次就停;
  自動重試不再另存快照;按「更新」重新計次
- 看畫面記下實際連上的螢幕;打字用該連線自己的螢幕,螢幕沒開就不打(不再開出看不到的新螢幕)
- box/screen:有人連著 VNC 埠的螢幕不算閒置;鎖檔改唯讀開啟,open_screens 以 bot 身分執行
  (root 建的鎖讓 Bot 開螢幕一直 ERROR=busy);box 第 13 版
- make update-box 改請 AnyBot 自己更新(anybot --update-box),用它內建的版本和設定的 Docker 主機

已驗證: cargo test 全過(新增瀏覽器埠、退避上限、螢幕對錯、被看著不收掉等測試)、clippy 無新警告、
lint-sh、bash -n
未驗證: 需要 Docker 的實機重建、盒子裡實際 reap、anybot --update-box 實跑
2026-11-16 21:33:35 +08:00
王性驊 5912ec6886 fix: 接管、打字、看畫面都只動自己那個螢幕;開著畫面的螢幕不會被收掉
每個 Bot 一個螢幕說好了「接管時只有它停手,別的 Bot 照做」,程式沒有照做:
任何人對任何螢幕動滑鼠打字,LAST_INPUT 是全域的一顆,所有 Bot 的電腦步驟都停
8 秒。現在記在每顆螢幕自己的按鍵時間上,person_active 只看自己那顆;電腦步驟
(computer_run)問的是自己正在用的那顆。

在 viewer 打的字(中文輸入、貼上的文字)以前永遠進共用螢幕(DISPLAY=:1),Bot
自己的螢幕收不到。現在 relay 在 vtext 上帶上這個 viewer 是替哪個 Bot 開的,
tunnel/remote 換成螢幕 key,vnc::person_typed 在 on_screen 裡貼進那個螢幕。
新 relay+舊大腦會退回共用螢幕(=舊行為),新大腦+舊 relay 也是,不會斷話。

開著畫面看的那顆螢幕不再被 10 分鐘閒置收掉:連上時 touch 一次,viewer 活著每
60 秒 touch 一次(靜止畫面不送 frame,不能掛在讀取迴圈上)。

瀏覽器那條路的螢幕已滿提示:screen_cdp_port 把 anybot-screen 的 stderr 丟了,
FULL= 進不了錯誤字串,screen_full 認不到——加 2>&1(computer 那條路早就有)。

瀏覽器清單和收工清分頁不再無端開螢幕:新增 browser_open_port 只讀 env 檔、
從不 up(老映像照 screen_sh 的規則退回共用埠),running_port 改用它;Bot 一輪
工作要用瀏覽器時照樣會開(ensure 走 browser_running)。

「開啟電腦」不再凍視窗:查「有哪些螢幕開著」的 docker 呼叫(5 秒)從 UI 執行
緒搬進背景工作。功能地圖:開著看畫面的不算閒置;viewer 打的字進正在看的螢幕。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 10:59:27 +08:00
王性驊 861887b563 feat: 電腦版不再破版、通知用 AnyBot 的貓、手機網頁像 App;從帳號看畫面不再斷線
電腦版:右側「進行中」的長重試訊息蓋過「停止」、衝出卡片,現在以「…」結尾(滑鼠移上去看
全文);Bot 設定的「團隊成員可以使用…」疊到儲存/取消、權限規則疊到「刪除」、「新增規則」
被切掉、電腦分頁的時間欄被切掉、窄視窗裡允許卡片的按鈕、「已排入…」和輸入框提示被切掉,
都修好。粉圓體比思源黑體寬,寫死寬度的地方用它就擠爆。新的 layout_audit 測試用三種字型、
最窄/一般/寬的視窗、示範和很長的資料,把每個設定分頁、Bot 設定、例行任務、右側面板畫一遍,
字被切掉或疊在一起就失敗(截圖模式也多了 ANYBOT_SHOT_PANEL/STATUS/TAB/SCROLL)。

通知:Mac 上原本用 osascript 的 display notification,橫幅是「工序指令編寫程式」的圖示、
點了還打開它。現在是 AnyBot.app 自己發的(NSUserNotificationCenter:新的
UNUserNotificationCenter 只給有 Apple 開發者簽章的 App 用,AnyBot 自簽),圖示是貓,點一
下打開那個 Bot;不在 .app 裡才退回 osascript。Linux 的 notify-send 帶上 AnyBot 的圖示。
anybot --banner 標題 內文 可以送一則試試。

手機(PWA):manifest 和 service worker 改成 mobile/ 裡一份,帳號伺服器和這台共用;加滿版的
maskable 圖示和 Android 狀態列用的單色貓(原本彩色圖變成白方塊)。每支手機滿版(左右安全
區域、狀態列跟著畫面顏色)、首頁提示裝成 App、換畫面左右滑、iPhone 主畫面 App 從左邊緣滑回
上一頁、按鈕長按不選字、搜尋框不放大。通知可以選要哪幾種(需要你/做完了/例行任務暫停/
收到檔案)、送測試通知,App 圖示上的數字是正在等你的 Bot。

帳號伺服器:看 Bot 電腦畫面時,瀏覽器回的 Pong 沒算成還活著,靜止畫面一分鐘就被切;看畫面
的票證十分鐘一到就切斷、重連又拿同一張過期的票回不來。現在票證記得誰申請的(那支手機的
登入、帳號裡那台電腦),申請者還有效就一直連著,使用中的票證會續期。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 00:06:12 +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
王性驊 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
王性驊 1eb88a9a60 公測前第二輪:區網直連改 HTTPS、手腳只聽大腦簽過的指令、更新驗簽章、聊天各存各的檔、視窗沒在前面也照常運作(提示音不再等你切回來)
- 區網直連:同一個埠用這台電腦自己做的憑證說 HTTPS(lantls),區網的 http 轉到 https,本機和 Tailscale 仍可用 http
- 配對碼後面帶一段不經過帳號伺服器的密鑰,大腦給手腳的指令都簽章(綁電腦、時間、只能用一次)
- deploy/update.sh、install.sh、install.ps1:記住簽章公鑰後,新版不是它簽的就不裝;make sign-setup 啟用
- state.json 只剩設定,聊天存 chats/bot-<id>.json,有變才寫;金鑰密封存檔
- 帳號伺服器:閒置連線少醒、讀取緩衝變小、請求開頭 15 秒沒送完就斷;本機壓測沒有洩漏
- 視窗縮小/被蓋住時照樣處理 Bot 的事件;任務完成也響提示音;Mac 關掉 App Nap
- 團隊成員在 Bot 忙時的訊息排隊不丟、群組沒有 @ 時看擅長分派、手機可改個人檔案
- setup.sh 對 root Docker 提出警告;收到停止訊號先收尾

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-14 00:40:16 +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
王性驊 7ac7c24012 手腳指令修好:輸入預設關閉(pi-bolt -p 不再卡住)、補齊 PATH、互動終端機、Windows 用 Git Bash/PowerShell;任何聊天都能 @ 其他 Bot,結果回報到發問的視窗
指令(手腳電腦和每台電腦)
- 一般指令的輸入一開始就關掉:會讀輸入到底的程式(pi-bolt -p、cat)不再永遠等下去
- PATH 先讀登入 shell 的設定,再補 ~/.local/bin、Homebrew、cargo、bun、nvm…(開機自動啟動的 AnyBot 原本找不到 pi-bolt)
- 互動終端機(shell 加 interactive):pty/ConPTY,Bot 讀整理好的畫面、打字和按鍵、等某段字出現;開互動 shell 每次都問
- Windows:有 Git Bash 用它,沒有用 PowerShell(原本一律 /bin/sh,跑不起來);PATH 用 Windows 的分隔符號
- 實測 pi-bolt:-p 模式回答、互動畫面裡問答都能用

Bot 之間
- 任何聊天按 @ 都跳出可以選的 Bot(群組是成員);點名後由這個 Bot 用 ask_bot 去問,結果在這裡整理,不叫使用者自己去看
- 問同事/交辦畫成對話卡:誰問誰、問題、進行中狀態、回答,還有對方的紀錄連結;電腦和手機都有
- message_bot 交辦的事做完會自動回報到發問的聊天(標著對方的名字)
- 被問的 Bot 在側欄顯示「正在回答「A」的問題…」

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 22:03:26 +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
daniel wang ac93db0cfa 手機網頁:畫面推入/返回動畫、新訊息進場動畫、iOS 鍵盤抬高輸入框、觸感回饋
- 通知加「允許/拒絕」按鈕(Android),點了直接回覆核准,不用打開 app
- manifest 加 id、lang、display_override 與主畫面捷徑(主要 Bot 對話、未讀對話)
- 從通知/捷徑進入:#answer=once|reject 自動回覆,?sc=main|unread 直接開聊天
2026-11-13 21:16:46 +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
王性驊 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
王性驊 31f41f62c6 目標: /goal keeps a bot working turn after turn until a second model, reading the chat, says the goal holds
- goal.rs: the command (/goal, /goal clear, /goal <condition>), the judge's brief and how its
  answer is read (met / not_met / waiting / impossible), and the brakes: 20 turns, 3 idle turns,
  a question for the person, a failed turn, a stop, a silent judge or a restart pause it; the
  person's next message takes it up again
- app/goal_ui.rs: on the brain, each finished turn of a goal is checked on a thread with the bot's
  quick model; not yet met wakes it with 「[目標]還沒達成:…」, the rest leave a note in the chat
  (never sent to the model) and tell the person when away; the line above the input with 清除目標
- typed on the computer, a screen or the phone, the brain acts on it; /goal leads the / list on
  both; the phone shows the bar, the notes and the 目標 tag
- anybot --ask "/goal …" runs to the end, like claude -p "/goal …"
- tests for the command, the verdicts, the brakes, the brief and the slash list; FEATURES.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 20:24:27 +08:00
王性驊 915fdcf589 連接器: 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 17:12:12 +08:00
王性驊 41b6b7f465 技能: / 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 16:54:58 +08:00
王性驊 f9a261959c version_0_1_1-alpha 2026-11-11 16:19:06 +08:00
王性驊 7bf5526f27 version_0_1_1-alpha 2026-11-11 11:07:55 +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