Commit Graph

12 Commits

Author SHA1 Message Date
王性驊 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
王性驊 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
王性驊 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
王性驊 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
王性驊 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
AnyBot Dev 5f7efd7dba Plan: P6 complete (step 2: embeddings + document shelf) 2026-11-09 20:23:38 +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
王性驊 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
王性驊 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