Commit Graph

51 Commits

Author SHA1 Message Date
王性驊 7eb2d79aa5 手機「載入更早的對話」補上來的不會再不見:大腦每次送的只是它發布的那一段(最新 120 則、不含步驟結果,從手機那份的開頭起),往回補超過那一段的開頭之後,下一次更新(例如來一則新訊息)就整份換成那一段,剛補的又不見、按鈕跑回來;有工具步驟的聊天那一段很短,按一次就會。現在補上來的留在那一段前面(S.winAt),新訊息把舊的推出那一段時也接到前面,存起來的那份一起記著,切到別的 Bot 再回來、頁面重開也接得對(舊版頁面存的那份第一次只留大腦送來的那段,裡面可能有舊錯誤留下的缺口);等「載入更早」回來時聊天開頭移了就不接、從現在的開頭再問一次;對補上來的訊息按表情,向大腦拿那則現在的表情。回到最底下最多留 300 則,捲在上面讀時超過 600 則(背景 300、怎樣都超過 1200)從頂上收,正在讀的那則留在畫面同一個地方(切到背景那一刻記下,回到前景畫好再放回去)。順手修:點進聊天、按表情之後要等 20–40 秒才更新——11/20 起 loadChat 在大腦回「沒變」時直接 return,loading 一直卡在 true,之後只能等輪詢順便帶過來。手機的編號清單照 Markdown 的讀法:空一行隔開的還是同一個清單(以前每一點都是「1.」),編號從第一點寫的數字起,縮排在一點底下的子項目、續行在那一點裡(以前被攤平成同一層一起編號)。大腦管理員:核對 Docker 網路改不成寫進紀錄、還不知道擁有者時先不動;更新時 Caddyfile 用 relay 容器的 IP 或 .env 裡的 {$變數}/{$變數:預設} 轉到 relay 的也認得出來。功能地圖 chat 和 FEATURES 跟著改。
已驗證: cargo test(906,含 featuremap::、layout_audit::;新的 node 測試:手機聊天視窗 30 項、Markdown 清單 12 項,換回舊程式各自會失敗);verify-anybot 全新 scratch 照功能地圖 chat「開聊天分頁」一步步走(40 輪各一步、按兩下到最開頭、再傳一則「填充1」還在),另外:每輪跟大腦整段聊天逐則比對一模一樣、離開聊天來兩則再回來 0–1 秒內更新、整頁重開接得對、對補上來的第 4 則按 👍 畫面和大腦一致、捲在上面讀時來新訊息讀的那則不動、模擬切到背景來兩則再回前景(5 輪)讀的那則不動、空行隔開的「1. 1. 1.」畫成 1、2、3 並有子項目;Debian 10 和 Ubuntu 24.04 上 Caddyfile 轉到 relay 的各種寫法(含變數、預設值、IP)判斷正確;測試機兩台更新成功、Docker 網路核對照舊。四輪獨立審查找到的 P1(載入更早的競態、存起來的那份沒記前段、清單無上限、背景時對著舊畫面調捲動)都修了。
未驗證: 最後一輪獨立審查(切到背景那一刻記下位置之前的版本)還沒回來;真的 iPhone(無頭 Chrome 模擬觸控、用改 document.hidden 模擬切到背景);超過 300、600、1200 則的收法只有自動測試,沒在實機堆到那麼多則。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-23 11:15:51 +08:00
王性驊 1605b38354 雲端大腦換新版失敗時不會一直停著:上次換到一半大腦管理員被停掉(舊的已經停了),之後新的又一直建不起來,以前只會一直排「換新版」、不會叫醒它,現在換不成就先把停著的舊大腦叫醒;新的已經換上原名、還沒啟動就被中斷的,下次刪掉它、放回舊的再換一次(以前直接刪掉舊的,新的起不來就沒有退路);讀不到原本的登入(Docker 一時沒回答)就先不換,不再改領新的登入(會把正在跑的那個登出)。管理員每一輪核對每個大腦接著的網路:現在設定給 Docker、而且建立時就有 Docker 的才接到 Docker,從 ANYBOT_BRAINS_DOCKER 拿掉再更新立刻拿掉(不等換成新版),掉了的接回來,放回或叫醒的舊大腦不會拿到建立時沒有的 Docker。更新時 Caddyfile 還有別的轉到 relay 的寫法(一行的、http://relay:8080、容器名、matcher、to、{ 後面接註解)就不用暗號、照舊,並在完成畫面寫出來、說怎麼自己補;同一台 Caddy 代理別的服務(NAS、別的網站)或網域名稱有 relay- 照樣補上;已經有暗號那行的 Caddyfile 還有沒帶暗號、轉到 relay 的路也寫出來。FEATURES 和功能地圖 server 跟著改。
三輪獨立審查:第一輪沒有 P0/P1(提的 P2:Caddyfile 判斷太寬、叫醒時可能把收回的 Docker 還回去,都修了);第二輪一個 P1(叫醒、放回時照現在的設定接 Docker,會接給建立時沒有 Docker 的舊大腦),改成每輪核對網路;第三輪沒有 P0/P1,這輪沒再改程式。留下的 P2:核對網路失敗時沒寫紀錄;擁有者檔案不見又剛好拿不到帳號清單時,擁有者的 Docker 會短暫被拔掉;用變數或 IP 轉到 relay 的 Caddyfile 偵測不到。

已驗證: cargo test(904,含 featuremap::、layout_audit::;brains:: 10)、bash -n;Debian 10(mawk 1.3.3)上 13 種 Caddyfile 寫法的判斷;三個範本和 nobledesktop 現在的 Caddyfile 不會被誤提醒,多一個沒帶暗號的區塊會提醒;隔離測試機 test3:舊大腦停著、新的建不起來(ANYBOT_BRAIN_MEMORY=1k)→ 叫醒原本那個(同一個容器 ID、在線),改回來後換成新版;新的換上原名還沒啟動就中斷(手動造出 -old 和沒啟動過的容器)→ 放回原本那個、在線;手動拔掉擁有者的 Docker 網路 → 下一輪接回,手動把 Docker 網路接給沒有 Docker 的大腦 → 下一輪拿掉;舊版伺服器測試機:Caddyfile 多一個 reverse_proxy http://relay:8080 → 更新印出警告、暗號拿掉、Caddyfile 沒被動、網址照常,還原後暗號回來。
未驗證: 讀不到原本登入就不換(要讓 Docker 一時不回答,造不出來,只讀過程式);換上後新的啟動失敗、放回舊的那條路(沒在實機重現);nobledesktop 還沒換上這一版(它沒有管理員開的大腦,這次改的只影響那些和更新時的 Caddyfile 檢查)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-23 09:10:12 +08:00
王性驊 ace27374e6 傻瓜安裝:伺服器 sh AnyBot/install.sh server 再 make update-server 就好(自動裝 Docker、自己選網址——Tailscale 用 http、區網用自己的憑證、有 Tailscale 憑證用它的名字——自己產生邀請碼和所有金鑰,中間不問問題,沒有終端機也跑得完);不用先開帳號:大腦管理員(compose 的 brains,anybot --brains)看到有人用邀請碼註冊,就替那個帳號開一個雲端大腦 anybot-brain-帳號(自己的資料卷、帳號伺服器發的登入,伺服器不存密碼),停了叫醒、重開機回來;第一個註冊的是擁有者,只有它的大腦有伺服器上的 Docker(Bot 的電腦),其他人的大腦拿掉 NET_RAW、限記憶體、CPU、程序數,最多 20 個;更新後換成新版時新的先在舊的旁邊建好,Docker 拒絕的話舊的照常在跑,舊的確定停了才換、換不成放回舊的,管理員中途被停掉下次接回來,一直失敗的帳號隔 1、2、4…分鐘最多半小時再試。電腦登入有雲端大腦的伺服器時,先等它上線(最多約一分半)再當它的螢幕和手腳,不把自己當大腦。帳號伺服器只相信 Caddy(帶暗號)說的請求來源,大腦自己寫 X-Forwarded-For 繞不過註冊、登入的次數限制;舊的 Caddyfile 更新時自動補上那一行(舊版 mawk 也行),Caddy 檢查過才換上。
順手修:Anthropic 回「錯誤 400:Invalid signature in thinking block」時這一輪不再停下來:舊的思考內容對不上就請它丟掉(thinking-binding-controls)或拿掉重送,聊天紀錄裡也一起丟掉,之後不再撞到;手機帳號登入的一個偶發失敗的測試。

功能地圖新增 server 區(models 和地圖的 README 跟著改),FEATURES、README.md、docs/multi-device.md 也改了;計畫在 docs/plan-2026-11-install.md(S8 App 信任伺服器的憑證、S9 伺服器上裝手腳還沒做)。

已驗證: cargo test(902)、relay cargo test(29)、bash -n;在 nobledesktop 上的隔離測試機(Ubuntu 24.04、全新安裝):一般使用者 install.sh server+make update-server 不給任何設定就跑完、兩個帳號註冊後各自有雲端大腦且在線、只有擁有者的大腦連得到 Docker、偽造 X-Forwarded-For 被擋、ANYBOT_BRAINS_SKIP 停掉指定帳號、重開機後全部回來、舊版伺服器(有自己的大腦)更新後保留原本的大腦並補上 Caddyfile、程式更新只換一次、只改 .env 不換、Docker 拒絕建立時舊的照常在跑、這次的更新(大腦管理員就緒、amy 換成新版在線、沒有殘留);Debian 10 的 mawk 1.3.3 補 Caddyfile;Anthropic 真的帳號:舊思考內容對不上時這一輪照常回答、丟掉的有回報;七輪獨立審查,最後兩輪沒有 P0/P1。
未驗證: 公開網址(有網域、DNS)那條路(要真的網域);Mac App 用帳號登入後等雲端大腦再當螢幕只跑了測試(ignored 的實機測試要真的伺服器);更新中途按 Ctrl-C 把管理員開回來只讀過程式沒實際按。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-23 08:09:02 +08:00
王性驊 073e0c5f83 伺服器的 docker-socket-proxy 多開 GRPC、SESSION:Docker 23 以上的大腦主機預設用 BuildKit 建置,大腦裡的 docker 要經 session 建 Bot 的電腦的映像檔,少了這兩項會被擋(403),「更新/重建」建不出來。照 nobledesktop 上手改、已經實際建成功的設定合回來(正式和 CI 兩份 compose,SECURITY.md 一起改)。
已驗證: nobledesktop(Docker 29.8.1)的 _ping 回 Builder-Version 2、大腦裡的 docker 是 20.10.24(跟著主機用 BuildKit);開了這兩項後 /session 經過代理(400 而不是 403),anybot-box:1 就是開了之後建成的;docker compose config 兩份都讀得過。
未驗證: 拿掉這兩項重現建置失敗(要在使用者的伺服器上重建映像檔,沒做)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 13:05:17 +08:00
王性驊 768b40fad2 make update 之後版本號還是舊的:Makefile 一開始就把「現在的 commit」放進 ANYBOT_GIT_COMMIT 並 export,deploy/update.sh 之後才 git pull,接著編的程式沿用那個舊值——程式是新的,設定 › 更新、--version、手機上寫的卻是更新前的版本(Jenny 那台 11/21 從 49055f1 更新到 5bf4444,--version 還說 49055f1;「升上來之後怪怪的」也讓人以為沒更新到)。update.sh 一開頭就清掉它,編譯時照新的 HEAD 重算;更新程式本身有改、用新版重跑自己時一樣清。
已驗證: sh -n、make lint-sh(update.sh 乾淨;剩下的 6 處是 migrate-relay.sh 原本就有的);在 jenny-Host 實際看到問題(新程式裡有新的字串、--version 是舊 commit)。
未驗證: 修好之後的 make update 還沒在實機跑一次(下一次更新 Jenny 那台時看 --version)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 10:54:33 +08:00
王性驊 1254e96535 migrate 第5步守衛修引號:sed 樣式內層的雙引號未_escape,遠端壳層炸 unexpected EOF 2026-11-19 17:29:27 +08:00
王性驊 8f829da5fc migrate 第5步加幂等守卫:大脑已接在目标服务器就跳过(2FA 账号 CLI 登不进,跳过才是正路)+連線超時 5→15 秒(DERP 握手实测 10 秒,5 秒会把自己锁门外) 2026-11-19 17:28:28 +08:00
王性驊 d9cf57ef13 migrate 第5步:密碼 base64 過 SSH(特殊字符不再被壳层拆烂)+顯示遠端真實輸出 2026-11-19 17:28:14 +08:00
王性驊 f3fc047a0e migrate 第5步:改用 pgrep -x anybot(依程式名精準比對,grep/pgrep/bash 包装行都不再误中) 2026-11-19 17:25:54 +08:00
王性驊 2b31edd273 migrate 第5步:pgrep 自匹配過濾(ssh 包裝行本身含搜尋字串,搶走 head -1) 2026-11-19 17:25:47 +08:00
王性驊 454cd97082 migrate 第5步:只认带绝对路径的宿主 serve 进程(容器里的裸 anybot 在主机喊不到) 2026-11-19 17:25:39 +08:00
王性驊 3c1e0f9bb0 migrate:新网址=旧网址时跳过 App 改址(别把连着的服务器踢成要重登) 2026-11-19 17:23:04 +08:00
王性驊 bf341491a0 migrate 加幂等:那台 8780 已有帳號伺服器(Docker 棧)就跳過安裝;帳號已存在改用登入验密码(2FA 使用者 login 200 即第一因子正确) 2026-11-19 17:22:57 +08:00
王性驊 0ac16f25b8 migrate 加自動整備:沒鑰匙自動 ssh-copy-id(現場輸一次密碼)、缺 Rust 自動裝 rustup、缺 Tailscale 試免密 sudo 裝;ts.net 名稱改用無依賴的 sed 解析 2026-11-19 17:13:51 +08:00
王性驊 6ef68eeb34 migrate:非互動 SSH 不讀 .bashrc——cargo 檢查與編譯都補 ~/.cargo/bin 進 PATH 2026-11-19 17:13:01 +08:00
王性驊 8924c147ac migrate 腳本修正:变量後紧跟全角字符在 C locale 下被吞進变量名($BRAIN(→unbound)——全部加大括号 2026-11-19 17:07:21 +08:00
王性驊 ee6f9d0973 治本三补丁+make migrate:把帳號伺服器搬到大腦那台的引導工具
長任務斷線根因:帳號伺服器與大腦分居兩台,每句話多绕一跳 tailnet
(实测 3–10 秒),所有計時器贴边跑:同步长轮询 45 秒窗口余量只剩几秒、
WS 判死 45 秒被 tailnet 重建轻易击穿、REST 兜底一次即敗報斷線。

計時器(搬家后也用得上的加固):
- tunnel WS 判死 45→90 秒(扛得过一次 tailnet 节点重建;真断线 15 秒
  ping 几秒内探到,不多等)
- 同步长轮询余量 25→70 秒(贴边超时消失;真断线晚 45 秒知道)
- 大腦 API 的 REST 兜底加一次 400ms 快速重試(重连窗口的瞬时抖动
  不再報成斷線)

make migrate(deploy/migrate-relay.sh,逐步引導、可逆、資料零搬家):
SSH 大脑机器 → 编译 relay → systemd 开机自启 → tailscale serve 8443
→ 建同名帳號 → 大腦 setup 改接 → 本機 App 改网址(state 先备份)→
引导手机/Windows/验证/停旧服务器,每步带验证,回滚=网址改回+重登。

已驗證: cargo test 723 全綠;sh -n 語法過。
未驗證: 真機遷移流程(需使用者的大腦机器 SSH,使用者當場跑)。
2026-11-19 16:58:33 +08:00
王性驊 7b1ec67754 design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式
依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。

- 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL);
  拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體;
  fonts/OFL.txt 補上思源黑體/宋體的版權
- 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、
  閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱,
  手機 167 個字級、79 個圓角、19 個色碼換成變數
- 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88)
- 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、
  表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框
- 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行
  「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680
- 圓餅圖拿掉黑色外圈、字照規格

已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、
clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9
未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 21:51:30 +08:00
王性驊 7ae503d0d6 fix: sign-setup.sh 的 $KEY 黏著全形括號(make lint-sh 不過) 2026-11-16 21:34:03 +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
王性驊 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
王性驊 f9a261959c version_0_1_1-alpha 2026-11-11 16:19:06 +08:00
王性驊 9d6b346462 版本: v<number>-<commit> with the build time, the same in the app, the phone, --version and the server log
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 13:51:52 +08:00
王性驊 36bc2bedaa 伺服器: one way to start it and one place for its settings
make update-server now starts the server through setup.sh --start, the same
path as make server, instead of its own docker compose call. Both use the
Docker named in .env (DOCKER_SOCKET) rather than whatever plain docker
reaches, so a host with both rootless and root Docker no longer gets a
second, empty server on the other daemon. The Tailscale HTTPS port comes from
the port in ANYBOT_RELAY_PUBLIC_URL (e.g. :8443), 443 without one. Adds make
server-logs, and skips the 80/443 check on a Tailscale-only setup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 11:26:35 +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
王性驊 12c9944dee Server voice service: Whisper on the brain's own server, checked for real
`make server` now asks whether to run a voice service there (and the
kept-setup menu can add or remove it): speaches, Whisper
large-v3-turbo on the CPU, behind the brain only (no published port),
enabled with COMPOSE_PROFILES=voice so it composes with the Tailscale
and LAN files. The brain sees ANYBOT_VOICE_URL, fills 設定 › 語音 › 聽
with it once (what is changed later stays), and asks the service for
its model at each start: this build downloads only when asked (it has
no PRELOAD_MODELS, and the 0.8.2-cpu tag is older still, so the image
is pinned by the digest that was tested).

Tested end to end on 12 CPU cores with the compose file itself: first
start 404 s to download the model, later starts 1 s; 11 s of Mandarin
mixed with English (Chrome, Tesla FSD) in 3.4–3.6 s, every word right.
small is three times faster and slipped a character. Reading aloud
stays with another service: speaches can't say Chinese (its espeak has
no "zh"), English works.

From the same test: a service that answers 200 with no sound is now an
error said in words (it was played as silence), Whisper's ASCII
punctuation in Chinese becomes full-width (,?!), and speaches'
"not installed locally" says the model is still on its way.
2026-11-11 00:14:50 +08:00
王性驊 04e744aa14 make update: pull, rebuild and restart what this computer runs
Updating meant knowing which of three ways applied: run install.sh
again (app, hands), anybot setup --refresh-service (the background
service), or git pull plus docker compose up --build in deploy/server.
deploy/update.sh does it per part, and make has a target for each:

  make update          whatever is installed here (server, app, hands)
  make update-app      swap the app; restart its background service
  make update-hands    Linux: swap, restart the systemd unit, check it
                       is still up 3 s later (a crash loop looks active
                       for a moment)
  make update-server   docker compose up -d --build, as .env sets it up

Each pulls first (--ff-only; a conflict stops it rather than installing
the old version), and carries on with the new deploy/update.sh when the
pull changed it. PULL=0 installs this checkout as it is. Small Linux
machines compile one crate per 2 GB, like install.sh. An open app
window is told to reopen; it keeps the old copy until then.
2026-11-10 22:00:48 +08:00
王性驊 983a2c2f02 install.sh: stop dying on macOS at the compile step
"$RUST_HOST;" is one variable name to macOS /bin/sh (bash 3.2): it
swallows the first byte of the full-width punctuation, so with set -u a
plain \`sh install.sh app\` aborted at [3/4] with "RUST_HOST\*: unbound
variable". Four such lines in install.sh, one in the server setup.
Brace them, add make lint-sh (sh -n for every shipped script plus a
check for this pattern) so it stays fixed.
2026-11-10 14:32:56 +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 5f7efd7dba Plan: P6 complete (step 2: embeddings + document shelf) 2026-11-09 20:23:38 +08:00
AnyBot Dev bc779d68c5 Server: drive Docker through a filtered socket proxy, never mount the raw socket 2026-11-09 16:36:51 +08:00
王性驊 c5bb16750f A screen never runs its own box or VM, from the start
The person wants the local box and Lima VM off whenever this AnyBot is set
to show another brain, not stopped after two idle minutes.

- sleep_on_a_screen has no idle wait and also runs right at start, before
  the loop's first 20-second pause; a resume of an interrupted rebuild is
  done on brains only (it would start the box on a screen).
- gvisor-vm.sh no longer registers the VM to start with the Mac: AnyBot
  starts it itself when it is the brain and wants its computer.

Verified on this Mac: VM started by hand while AnyBot was closed; the new
AnyBot (a screen of the cloud brain) stopped it 4 seconds after launch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-09 15:32:36 +08:00
王性驊 ec3fddf3ab A computer showing another brain lets its own box and Lima VM sleep
The Mac mini shows the cloud brain, whose bots work on the brain's own
computer and borrow only this Mac's screen, browser and apps. Its local
box still ran, and the Lima VM under it had grown to its whole 6 GB: the
Mac never gets back memory a VM once used.

- On a screen the box stops after 2 idle minutes, and the Lima VM too when
  nothing else runs in it. probe() no longer starts the VM there, and the
  volume holder and scheduled updates run on brains only. Becoming a brain
  again starts both (probe/ensure_running already wake the VM).
- Screen mode is decided from the settings before the box loop's first
  look, which used to start the VM at launch.
- gvisor-vm.sh: 4 GB instead of 6 (box capped at 2 GB), and the VM's
  ModemManager, udisks2 and multipathd are turned off.

Verified on this Mac: box and VM stopped by themselves 2 minutes after the
app started; the VM process (4.4 GB plus compressed pages) is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-09 15:24:28 +08:00
王性驊 00f6723588 HTTPS on the local network's own IP, with a certificate the server signs itself
setup.sh offers 「區網 IP」 (alone, or next to Tailscale): Caddy serves https://<LAN IP> with its
own small certificate authority (tls internal, default_sni for clients that send no name) and
hands out the root at http://<LAN IP>/anybot-ca.crt for each device to trust once.
docker-compose.lan.yml binds Caddy to that address only, so it sits beside tailscale serve.

The app now accepts, for the account server, the certificates this computer trusts as well as
the built-in public ones (HTTP and the WebSocket alike), so it connects once the root is
trusted; before that it says what to install instead of "the certificate is wrong".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-07 21:27:07 +08:00
王性驊 9a23411e51 Checked by using it: tests stay off the real box, gVisor scripts run clean, times are the person's
- box_numbers_only_on_what_is_seen is ignored again (a test inserted before it in cbada6b took
  its mark: every cargo test drove the real box), and the path test runs
- gvisor-vm.sh restarts the VM's Docker only when runsc was just registered (a restart stopped
  Bot 的電腦), and `${var}` before full-width text (bash read 「)」's first byte as part of
  the name and stopped)
- a scheduled box update and a PDF's name use the person's time zone (a server keeps UTC)
- 容器隔離 lists 標準 before 強隔離
- screenshots of real data can open 設定 › 電腦 (ANYBOT_SHOT_VIEW=computers) and scroll
  (ANYBOT_SHOT_SCROLL)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-07 00:19:56 +08:00
王性驊 4605b317d8 Bot 的電腦 can run under gVisor: its own kernel, Chromium's sandbox back on
容器隔離 in 設定 › 電腦: standard (runc, the container is the only wall, Chromium runs
--no-sandbox) or hardened (runsc: a virtualized kernel, all capabilities dropped but the few
the desktop needs, ANYBOT_BOX_SANDBOX=1 turns Chromium's own sandbox back on). Box image v7.
deploy/mac/gvisor-vm.sh makes a Lima VM with Docker + gVisor for a Mac (started at login),
gvisor-migrate.sh moves the box's files and logins there.

Checked and finished before committing:
- the hardened choice is offered only on a Docker host that has runsc; a box set to it on a
  host without it opens the standard way and says so (it used to not start at all)
- the settings row shows what the box really runs on, and when 更新 is needed
- no swap only under gVisor (a standard box keeps Docker's default)
- the migrate script sees the running Mac app ("AnyBot", not "anybot")
- the VM script starts an existing VM by name, checks runsc and the kernel from the Mac
- the version test says 7

Real run in the Lima VM: desktop, VNC, numbered controls, xdotool and screenshots work; no
Chromium process has --no-sandbox, renderers run with seccomp and their own namespaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-07 00:03:25 +08:00
王性驊 a202a96c02 Server image: keep dependencies fetched from GitHub between builds
agent-desktop comes from GitHub, and only the crates registry and target were cached, so every
server update fetched it again; a slow GitHub made nobledesktop's update fail (cargo exit 101, then
a fetch that hung for over ten minutes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-06 18:15:22 +08:00
王性驊 2867c8e822 Remove what nothing uses and keep one copy of what was written several times
Unused (found by taking away the dead-code allowances; nothing else used them, tests aside):
computer::specs, quiet_button, the never-made Poke::Spin, ten icons and their SVGs, the
theme's chrome/bubble_agent colours, ImportRow.line, voice's multipart/transcribe/speak
wrappers, and the old keychain writers vault::save/remove/index_add with their live test
(the vault store replaced them; reading old keychain entries for the import stays).

One copy each: percent-encoding (httpd::url_encode, was four), tool arguments (tools::args_of,
was three), the WebSocket handshake (httpd::accept_websocket, was three), the read pacing
(wire::Pace, was two: relay and app), docker with input and a time limit (dk_with_input, was
two). Docs: FEATURES §看畫面 (VNC), protocol (v* frames, /screen, tickets), architecture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 23:21:47 +08:00
王性驊 c87d598e64 E2E: remote screenshot, click and typing; a Linux Wayland run with a full runtime folder
remote_e2e.py: with E2E_SCREENSHOT=1 a screenshot of the hands comes back to the model as a
JPEG; with E2E_TYPE=1 also a click, typing (Chinese too) and Enter in a terminal there. The fake
model no longer takes a screenshot's picture message for the person speaking. E2E_APP picks the
app to open. deploy/test/wayland: the same test on a headless sway in Docker whose
XDG_RUNTIME_DIR is full (31/31).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 20:28:52 +08:00
王性驊 e44614736f 「我的電腦」 follows the computer the person types on, also mid-turn and after a restart
A turn started from the phone (not a computer) kept 「don't know」 for its whole run: a message
typed on the Mac while it waited on a hand-off had its 「我的電腦」 moved to the bot's own computer.
Each step now asks which computer the person last typed on, and the brain keeps it beside its
data (person-computer.txt) across restarts. remote_e2e: a second computer, and a mid-turn
message from the other one (fails without the fix); 28 checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 19:41:49 +08:00
王性驊 102746d9e8 A brain's box can go by its own name (ANYBOT_BOX_NAME); the server's brain takes over its old box under anybot-brain-box
A desktop AnyBot left on the server (older build) took "anybot-box" for its own and paused it
every ~20 s as idle while the brain woke it: the bots' computer kept showing as asleep. The
brain now renames its box once (files are in the volume, kept by name) and uses that name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 18:20:45 +08:00
王性驊 06801f549d Remote brain: a computer that just came on is known at once; an offline computer is said, not swapped; snapshots survive an open browser; end-to-end test
- The brain looked the account's computers up once a minute: for up to a minute after the Mac
  came on, 「我的電腦」 was unknown and steps went elsewhere. Now every 15 s, and at once when a
  message comes from a computer it doesn't know yet.
- A step naming a computer that is off says so in words instead of running on the chosen one
  with a note that the person hadn't asked.
- Snapshots: tar's 'file changed' (the open browser) is not a failure; browser caches are left
  out; ten minutes for a large home folder.
- box_end_to_end clicks the terminal where it opened; restore only with ANYBOT_TEST_RESTORE=1.
- deploy/test/remote_e2e.py: account server + headless brain + hands + scripted model, 27 checks
  (computers, redirect, agent-desktop on the hands, hand-off 3 ways, phone view, sync copy,
  edits, hands offline/back, brain restart, clear). anybot --sample-state for such tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 18:14:23 +08:00
王性驊 5b2c974f3c Mac permissions: ask at most every ten minutes; one fixed signing key keeps them across updates; open apps by their shown name
- Every untrusted step popped macOS's prompt and opened Settings; a remote brain's steps covered
  the screen. Now once per pane per ten minutes.
- Ad hoc signing made each build a new app to macOS, so 輔助使用/螢幕錄製 silently stopped
  working after updates (agent-desktop PERM_DENIED). deploy/mac/sign.sh signs with a local key
  kept in its own keychain under AnyBot's folder.
- computer_use_open_app finds 「計算機」 by display name and says the app opened even when its
  window can't be read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 16:57:44 +08:00
王性驊 6d6461e4f3 Server setup: Tailscale address instead of a domain, and a no-questions mode
- setup.sh offers the computer's Tailscale address (HTTPS from tailscale serve, Caddy not
  started, nothing open to the internet) — docker-compose.tailscale.yml
- ANYBOT_SETUP_USER / ANYBOT_SETUP_PASSWORD [/ ANYBOT_SETUP_DOMAIN] answer the questions,
  for scripts and deployment tools; install.sh server passes them through

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-05 01:26:33 +08:00
王性驊 472a004f87 One-step install: install.sh, fixed Linux and server builds, clearer README
- install.sh (curl | sh): app, hands, server and deps modes; installs system packages
  (right names per release, e.g. libasound2t64 on Ubuntu 24.04), Rust via rustup (1.95+),
  Docker for the server; limits parallel compiles on small machines
- Server Docker image: add the ALSA build/runtime packages (the build failed), cache the
  cargo registry and target between rebuilds, JOBS build arg
- 加一台電腦 now gives a line that installs AnyBot on a blank computer before joining it
- Makefile: make deps installs Rust too, make doctor, clear message when Rust is missing/old
- README rewritten: one line per use, getting started, update/remove, troubleshooting,
  deployment options; docs/install.md and multi-device.md follow it
- Tested on fresh ubuntu:24.04 (app) and debian:12 (curl | sh hands) containers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-05 00:52:10 +08:00
王性驊 867732bd73 make, README and docs: build and install from source
- Makefile: make / run / install / uninstall / deps / test / serve / setup /
  hands / relay-run / server / dist / clean (macOS and Linux).
- README.md and docs/: install (all platforms, data locations, troubleshooting),
  multi-device (brain, hands, screens, pairing, what the offline messages mean),
  architecture (layers, data, security, sync, keys, hands, picture helper),
  protocol (relay and AnyBot endpoints, WebSocket frames, sync ops), release
  (packaging, Gitea Actions, Linux and Mac runners).
- install.sh --deps-only, bundle.sh KEEP_APP=1 (used by make deps / install).
- FEATURES.md: the multi-device part is done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 22:16:45 +08:00
王性驊 87be66b016 Release builds on Gitea Actions: macOS app, Ubuntu, headless Linux, server
- .gitea/workflows/release.yml: on a v* tag, a Linux runner builds and
  packages the Ubuntu, headless and server bundles; a Mac runner makes
  AnyBot.app. Both attach their files to the tag's release.
- deploy/ci: the Linux build image (Ubuntu 22.04), packaging, release
  upload, runner settings, and a server bundle that runs the prebuilt
  binaries (no compiling on the server).
- deploy/mac/bundle.sh: AnyBot.app with its icon, signed ad hoc, zipped.
- relay/Dockerfile: copy src/wire.rs too (the relay needs it since the
  lasting connection).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 22:07:46 +08:00
王性驊 365dc87e54 Add a computer with one line: pairing codes, simpler setups
- 加一台電腦 (phone menu and the app's 大腦 card) gives a ten-minute,
  one-time code and the line to run: anybot setup <address> <code>. The
  new computer joins as hands for that brain with no password and nothing
  to answer, starts with the computer and checks the brain sees it.
- anybot setup without arguments is one screen: address and code (a pasted
  line fills both), or the account and password instead. No role, name or
  confirm questions; a brain is asked only when there are several.
- Hands computers are no longer offered as brains.
- The server setup asks only the domain, account and password.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 20:56:06 +08:00
王性驊 cb922da3fe anybot setup and the server setup: guided setup with a brain picker
- anybot setup: a full-screen terminal guide (role, name, account server,
  account, which brain) that saves the settings, installs a systemd user
  service (with a virtual screen when there is none), and checks that the
  account server and the brain see the computer. Flags for scripts.
- Hands can be limited to one brain; the account server says which AnyBot
  asks. Choosing a brain in the app does the same.
- deploy/server/setup.sh: domain, account, sign-ups and keys step by step;
  writes .env and Caddyfile, starts everything and checks HTTPS. The
  server's brain creates the account on first start.
- deploy/linux/hands.sh installs what's needed and opens anybot setup
  (no password kept in a file any more).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 20:38:45 +08:00
王性驊 b153051e58 Lasting connection to the account server, per-item sync, files and models via the brain
- Each AnyBot keeps one WebSocket to the account server (pinged, reopened
  within a second when cut). Requests come down it at once; calls to other
  AnyBots of the account (brain sync, hands) go up it. Frames carry raw
  bytes, compressed when that saves space. HTTP long-poll stays as fallback.
- The account server knows at once when an AnyBot goes away.
- Edits to lists and maps go item by item, so two computers editing one
  list keep both changes.
- Screens fetch chat files from the brain, get model lists through the
  brain's keys, and show the brain's computer as the brain's.
- Moving this computer's bots skips starter bots the brain has and bots
  already moved.
- The phone goes to the brain instead of a computer that shows it.
- deploy/linux/hands.sh: a Linux computer (with or without a screen) as
  hands, kept running by systemd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 19:30:32 +08:00