AnyBot/src/main.rs

569 lines
23 KiB
Rust
Raw Normal View History

#![recursion_limit = "512"] // the one `computer` tool's schema is one deep json! literal
mod agent;
feat: 追進度、送 token 減量、首字等待依請求大小、摘要分段必成、換模型不掉東西 追進度(follow_up,src/followup.rs、src/app/followup_ui.rs) - Bot 啟動要等的事後登記檢查指令與 done_when(可選 fail_when、then),就結束這一輪;大腦定期在那台電腦上跑檢查(不叫模型) - 有進展時聊天記一行(最多每 10 分鐘);好了、失敗、15 分鐘沒變、超時、檢查連續失敗就叫醒 Bot 接著做 - 登記時檢查指令照 shell 規則審批一次(被擋的不登記);存在 Bot 身上,重開照樣追;只有大腦跑 - 系統指示:要等的事不要 sleep、不要說「我去盯」就結束;主動回報。說了就做的提醒也指向 follow_up 送 token 減量 - 收起的步驟,它的長參數(例如三千字 SSH 腳本)送給模型時也只留開頭(fold_called_args);估算同步 - 滾動收起:舊結果累積到可讀長度 15% 就整批收起,一批一次,快取只斷一次 模型怪怪的 - 第一個字的等待依請求大小(120 秒起,每多 1,000 token 多 2 秒,最多 10 分鐘),看門狗同步 - 等不到任何回應時不再原樣重送:先收小對話(收起結果、寫摘要)再問一次 壓縮 - 摘要分段寫(每段 40,000 字內,結果只帶 600 字),模型寫不出來時 AnyBot 本地整理一份,收縮一定成功 換模型 - 換過去的第一輪先收起舊結果;別的模型的思考區塊不送(會被拒);可讀長度改成每個模型各記(model_limits) feature-map:goal.md 新增 goal-followup(含步驟);chat.md 改寫 chat-compact、chat-stall;models.md 新增 models-switch。FEATURES.md 同步。 已驗證: cargo test 753 通過(新增 followup 5 項、a_follow_up_reports_and_wakes_its_bot_when_done、calls_of_set_aside_steps_go_shortened、old_results_are_set_aside_before_the_chat_is_full、a_long_stretch_is_summarized_in_pieces、a_summary_the_model_cant_write_is_written_here、a_switched_model_starts_from_a_lean_request、首字等待兩項),clippy 無新警告;verify-anybot:goal.md「追進度」(登記後同一輪結束,背景檢查看到 DL_DONE 把 Bot 叫回來,follow_ups 歸零)、chat.md「說了就做」「/ 指令」,ctl down 無殘留 未驗證: 手機頁面畫面(這台沒有 Google Chrome);真的自架模型的首字等待與收小重試(要真的慢模型);跨機器(SSH、帳號裡別台電腦)的檢查實跑;models.md「從手機換回來」步驟(要無頭 Chrome);新增 App 工具 follow_up 與其審批需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:28:52 +00:00
mod followup;
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
mod shared;
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
mod ask;
mod app;
mod appctl;
mod attach;
mod axread;
mod axwrite;
mod avatar;
mod bidi;
mod botbrowser;
mod browser;
mod cloudbox;
mod channels;
feat: 檢查點與 /rewind:Bot 用 edit_file 改的檔案和對話可以退回之前說的某一句 - edit_file 改檔案前先存原本的樣子(沒有這個檔案也記),記在開始那一輪的那句話底下,同一輪同一個檔案只記一次;你的電腦、Bot 自己的電腦(Docker、封閉資料夾)、SSH 電腦都記;存在資料夾的 checkpoints/,同樣內容存一份,一週後清掉。 - /rewind 列出最近 10 句和之後改過幾個檔案;/rewind N 檔案和對話都退回(新的先退,新建的刪掉;那句話放回輸入框;退回前的整段對話收進過去的對話「退回前:…」);/rewind N 檔案、/rewind N 對話 只退一邊。檔案在背景還原,好了一行報告。 - 用指令改的、其他 AnyBot 電腦上的、超過 2 MB 的不在裡面,照實說。 - tools.rs:file_spot、file_now、file_put(box 的路徑檢查抽成 box_guard 共用);Place 可以存檔。 - 背景做完的一行字(later_notes)走同一個地方進聊天。 已驗證:cargo test 593 通過(兩輪改三個檔案:退到第二輪只還原那輪的、退到第一輪全部還原、新建的刪掉、太大的照實說;App 裡 /rewind 清單、編號不存在、退回後只剩 AnyBot 的字、草稿是那句話、退回前收進過去的對話、README 回到中文、INSTALL.md 刪掉)、clippy -D warnings 乾淨。 未驗證:Docker 和 SSH 電腦上的存與還原(走同一個 cat 的路)、真的 App 和手機上打 /rewind。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 04:35:31 +00:00
mod checkpoint;
mod computer;
mod desktop;
mod diagram;
mod platform;
mod mic;
mod pages;
#[cfg(target_os = "linux")]
mod x11;
#[cfg(target_os = "linux")]
mod wl;
#[cfg(target_os = "linux")]
mod portal;
#[cfg(target_os = "linux")]
mod desk;
mod egress;
Bots work like someone who knows the computer: they know each machine, reach what they see, plan, and hand the planned steps to a quick model Measured on the bot's own box (8 tasks x 2, grok-4.7): 14/16 done, 120 steps, 1114 s before; 16/16, 102 steps, 574 s after (model time 1015 -> 471 s). A replayed skill: 49 s -> 15 s. Knowing the machine - facts.rs: 電腦現況 per computer (system, desktop, systemd, sudo, network, package manager, tools, apps, a fixed TZ), read once by a small read-only probe, kept 30 min, in the instructions at the start of a turn. - The box's sudo is the bot's: only what follows sudo is checked against the always-denied list (it was refused outright, while the instructions said it could sudo), and commands with sudo run as the box's root (setuid does nothing under gVisor). - Box image v8 drops ENV TZ=UTC (it overrode /etc/localtime). ANYBOT_BOX_IMAGE / ANYBOT_BOX_VOLUME give a throwaway box its own image and volume, never adopting the real one. - Mac shell sandbox: App Store app CLIs (they carry their own app sandbox) and ps/top run outside it; plain `osascript -e` too, asked the first time even in direct mode, refusing do shell script, terminals, keystrokes, file reads, ObjC and the secret folders. A command the sandbox broke says so, instead of looking like a broken program. Reaching what it sees - The Mac menu bar's status icons are numbered (each app's AXExtrasMenuBar, named from inside for the system's own), computer_use_zoom looks closer at full sharpness. - Numbers stay with their controls from look to look (they were reassigned every look, so a step's second click landed elsewhere); the box's front window is listed first; a control can be named instead of numbered (name "4"). - Web page numbering walks open shadow DOM (Chromium settings, web components). - A box on a Docker host elsewhere retries the next port when the usual one is taken (a retry without it came up with no network). Working like a person - Instructions: pick the route, know what done looks like, one route, check once, say what's stuck instead of faking it with a substitute, ask before cutting the connection. - StepPlan: the bot's model takes the first step, the step after trouble (failed, refused, repeated, nothing changed on screen, the quick model switching routes), one in four, and the final check; a quick model (Bot.step_model, auto: grok-4.20-0309-non-reasoning on xAI) does the planned steps in between, falling back to the bot's model if it can't be used. - Skills keep the steps that worked (with what each acted on, not numbers); replay_skill does them again with no model in between, finding each control again, handing back on a mismatch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-09 01:01:03 +00:00
mod facts;
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
mod find;
mod httpd;
mod intents;
mod i18n;
mod i18n_table;
mod icons;
mod landlock;
mod lantls;
mod lock;
mod macapps;
Bots click by number: every control on the screen is boxed and numbered, on every computer A bot asked to open a Threads profile clicked an empty strip ten times: it guessed coordinates from a picture, and the web tools' description told it they didn't work on its own computer. - marks.rs: the picture a bot gets has every button, link, field and menu item boxed and numbered (a tiny built-in digit font, pure Rust), with the same numbers in a list. click / typing / scroll / mouse_move take the number (ref) and land on the control's centre. - Where the controls come from: macOS AX and Linux AT-SPI through agent-desktop on a person's computer (desktop::elements); AT-SPI in the bots' own computer (box/a11y, after XBot's box-a11y), web pages included. On a Mac a control whose spot another app's window covers gets no number (topmost window at its centre must be the app's; the Dock's invisible full-screen window doesn't count). open_app waits until the app is really in front. - No going round in circles: a step that changed nothing says so; the same step (clicks within 16 px) a third time in a turn comes with a warning, from the fourth time it isn't run. - The box (version 4): one TigerVNC server instead of Xvfb + x11vnc, the AT-SPI bus and registry at boot, one browser launcher (box/browser, after XBot's box-chrome: same profile and CDP, renderer accessibility, a launch lock, stale profile locks cleared). One docker exec per look (list + picture, ~0.4 s). A brain updates an older box by itself when it has been idle a minute (files and logins stay); a new box is never made from an older image. - Gone: computer_use_read_app (the list is in every picture), computer_use_mouse_button, the per-call picture for the phone (it gets a plain one), the stale browser_read note; the prompt says web work goes through browser_* by number, and never to read browser cookie or history files. Tests: marks (numbering, drawing, fingerprints), box_numbers_are_exact on a box from the new image (a Threads-like page: the icon links get numbers, Profile clicked by number, Chinese typed into the numbered field, a click on nothing called out), box_screen_is_exact, VNC e2e 11/11 on TigerVNC, Calculator 7×8=56 by numbers through the signed app on this Mac, remote_e2e 28/28, 153 unit tests; Linux build + 157 tests + x11_live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 16:47:01 +00:00
mod marks;
mod mcp;
mod mcp_oauth;
feat: ChatGPT 方案——用 ChatGPT 帳號登入,Bot 用你 ChatGPT 方案的額度,不用 API 金鑰 - 新供應商「ChatGPT 方案」(src/chatgpt.rs):照 OpenAI 給開源 App 的 Sign in with ChatGPT。 第一次登入註冊 AnyBot(dynamic_agent_client → oaiapp_…)並重用;PKCE、state、nonce; ID token 驗 RS256 簽章、iss、aud、exp、nonce;沒同意使用方案算登入但不能用(再登入會要求同意)。 - 要求走 Responses API(api.openai.com/v1/responses,store:false、stream:true、instructions), token 只送 OpenAI 自己的網址;收到 response.completed 才算完成;額度用完停下來給管理用量連結, 不重試、不改用 API 金鑰。token 快到期或 401 時更新(一次一個,refresh token 會輪替)。 - 設定 › 模型 › ChatGPT 方案:使用 ChatGPT 繼續、登出、換帳號、打開登入頁、管理用量; 連到伺服器大腦的螢幕電腦和手機也能登入(登入頁開在自己這台,打不開的那頁網址貼回給大腦)。 - Bot 工具 chatgpt_login(status、login、logout、switch_account;登出和換帳號先問)。 - 修連接器登入:封存的 token 前綴寫錯("sealed:" 實際是 "enc:v1:"),重開 App 後 token 沒解開就被當成憑證送出,登入等於每次重開都失效。 已驗證: cargo test 全綠(chatgpt::、providers::、appctl::、remote::、mcp_oauth::、featuremap::、layout_audit::); 授權網址的參數送到 auth.openai.com 沒被拒(302 到登入頁)。 未驗證: 實際用 ChatGPT 帳號登入、同意、Responses 串流與工具呼叫(要真的 ChatGPT 付費帳號和瀏覽器); 螢幕電腦貼回網址、手機登入(要實機);Windows 的「打開登入頁」。 動到審批路徑(appctl::needs_approval 的 chatgpt_login):需要實機測試+人類簽名。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:23:10 +00:00
mod chatgpt;
mod memory;
記憶: a page to see it, a few lines picked while typing, a local model The memory had grown into a list carried whole, a top-14 recalled by a trigram index and pasted into the system prompt with the clock, and a page that broke its own layout. Nobody could see what went to the model, the prompt cache missed every message, and 「記住」 kept saying the same thing twice. Rebuilt per the spec (docs/memory.md): - Three kinds in memory.db: 記得的事 (fact), 做過的事 (event, a line per finished turn), 整理過的 (rollup). Each keeps pinned, uses, last_used, deleted, superseded_by, span. state.json keeps the facts as the copy that syncs; the page reads SQLite. - Search: jieba words ∪ CJK bigrams in an FTS5 unicode61 table (Traditional text goes through Simplified first), weighted share of query terms hit; plus local vectors, vec = clamp((cos−0.35)/0.35). score = max + 0.15×min, events ×0.9. ≥0.15 suggested, ≥0.5 ticked, ≥0.55 carried when nobody chose (3 at most). - What the model gets: the system prompt has the time zone and the pinned memories only, the same every turn. Each person message gets 〔送出時間〕 and 〔相關記憶〕 from Message.memories, built in group_history into a transient Message.context, so the beginning of a chat reads the same next turn (cache hits) and the event log, skills and audit see only what was typed. A memory already carried in view isn't carried again; each carry counts a use. - Picks travel with the message: Cmd::Send / POST send / sync act "memories" (empty = none; absent = the brain chooses, once, saved). - remember finds the like one (cos ≥ 0.85 or the same words) and asks for `replaces`; the old one is superseded, never carried. A fact forgotten and remembered again comes back. New search_memory (query, kind), with dates; read-only. - Nightly on the brain, no model: events past 30 days fold into a line per week (「11/3–11/9 做過的事(14 件):整理照片 ×3…」, ≤400 chars, like with like by words or vectors), weeks past 180 days into months; the folded go to 最近刪除 for 30 days. Facts are never removed. The page offers duplicates, facts unused for half a year, and what can fold now. - Local model: minishlab/potion-multilingual-128M through m2v.rs (same token ids as model2vec-rs on 13/13 sentences, cos ≥ 0.9999, without tokenizers' 1.1 GB). Converted while downloading: vocab.bin, table.i8 (int8 + row scales), dims.json, 137 MB kept of 530 MB; ANYBOT_HF_BASE picks a mirror (now passed into the server's brain container too). Loaded when first needed (34 ms), let go after 10 idle minutes. The brain loads it; a screen only with a document folder set; hands and phones never. 設定 › 一般 › 語意搜尋: 本機模型/Ollama/關閉; a new engine clears every vector. - Three files, three connections: memory.db (backed up nightly, 7 kept), docs.db (a cache), oplog/audit.db (30 days). An old audit.db hands its memories and documents over once and shrinks (a real one: 172 MB → 16 KB). docs_search scans every chunk now, vectors cached in RAM (it stopped at 8000); FTS optimize + VACUUM daily (260 MB of tombstones over 31 MB of text). - API: POST /api/memory (owner) and /api/sync/memory (mirror). Reads answer on the HTTP thread; writes go through phone_act("memory"). - Screens: a memory dialog (Bot menu 記憶…, Bot settings 打開記憶) with counts, live search, filters, suggestions, per-item kind/date/uses and pin/edit/forget/restore; chips above the composer 300 ms after typing stops, with a token estimate; 「帶了 N 條記憶」 under person messages. The phone has the same as a 記憶 tab, chips and tag. Checked: make test passes (app 297, relay 16), with new tests for the scores and thresholds, Traditional Chinese segmentation, remember's dedupe and replaces, two turns sending the same beginning, no double carry, weekly/monthly folding and the trash, and the audit.db move. Brain idle 37 MB as before, ~230 MB with the model loaded; search on the brain 0.2–0.5 ms, 7–44 ms from the phone page. A deadlock found on the way (stats re-taking the lock) is fixed and tested. Docs: docs/memory.md has the whole design; FEATURES.md, protocol, architecture (zh/en), multi-device and install say what changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3SYw9JJ9dXwaNvYh4
2026-11-10 23:46:50 +00:00
mod memstore;
Bot 之間溝通:ask_bot 問同事並等回答、群組 @點名、共用頁面/「關於你」記憶/教技能;修正插話丟附件、Enter 核准失效等 問同事(ask_bot) - A 問 B 並等它回答:問題放進 B 自己的聊天,B 用自己的模型、工具、記憶和電腦做,最後的回覆交回 A - 最多轉 3 手、不能互等(避免卡死)、對方忙就排隊(10 分鐘逾時)、停止 A 時 B 也停 - message_bot 也加轉手上限;別的 Bot 叫的不算使用者的話(改不了自己的設定) 群組 @點名 - 「@名字」只叫被點到的成員回答;成員在回覆裡 @ 別人就接著說(一輪最多 8 則) - 電腦和手機的輸入框打 @ 會列出成員 - 修正:每個成員帶自己的記憶;成員回覆的每一步都記得是誰說的 共用資源 - Bot 可以讀其他 Bot 的頁面(只能讀,改要請作者改) - 共用的「關於你」記憶:每個 Bot 都帶著,記憶頁可切換查看、編輯;外人的訊息不帶 - teach_skill:把自己會的技能教給同事(先問你);同事名冊列出每個 Bot 會的技能 修正 - 插話(Bot 工作中傳訊息)會帶附件:聊天有檔案卡片,模型看得到圖片;當機復原也帶著 - 輸入框有焦點、框是空的時 Enter 允許待核准的步驟(原本被當成空白送出吃掉) - 大腦的螢幕連不到大腦時,引用、附件、記憶不會先被用掉 - 「還原上一個答案」存在 Bot 上:重開還在,連大腦的畫面和手機都能還原;停止的回合也留著 - Bot 忙時被叫醒(例行任務、message_bot、觸發器)改成排隊開自己的一輪,不再壓成純文字插話 - 停止時結果已回來的步驟標成完成;輸入法剛選字的那一格不送出 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3a7riWESpv471gDgC
2026-11-13 13:34:03 +00:00
mod mention;
mod pty;
記憶: a page to see it, a few lines picked while typing, a local model The memory had grown into a list carried whole, a top-14 recalled by a trigram index and pasted into the system prompt with the clock, and a page that broke its own layout. Nobody could see what went to the model, the prompt cache missed every message, and 「記住」 kept saying the same thing twice. Rebuilt per the spec (docs/memory.md): - Three kinds in memory.db: 記得的事 (fact), 做過的事 (event, a line per finished turn), 整理過的 (rollup). Each keeps pinned, uses, last_used, deleted, superseded_by, span. state.json keeps the facts as the copy that syncs; the page reads SQLite. - Search: jieba words ∪ CJK bigrams in an FTS5 unicode61 table (Traditional text goes through Simplified first), weighted share of query terms hit; plus local vectors, vec = clamp((cos−0.35)/0.35). score = max + 0.15×min, events ×0.9. ≥0.15 suggested, ≥0.5 ticked, ≥0.55 carried when nobody chose (3 at most). - What the model gets: the system prompt has the time zone and the pinned memories only, the same every turn. Each person message gets 〔送出時間〕 and 〔相關記憶〕 from Message.memories, built in group_history into a transient Message.context, so the beginning of a chat reads the same next turn (cache hits) and the event log, skills and audit see only what was typed. A memory already carried in view isn't carried again; each carry counts a use. - Picks travel with the message: Cmd::Send / POST send / sync act "memories" (empty = none; absent = the brain chooses, once, saved). - remember finds the like one (cos ≥ 0.85 or the same words) and asks for `replaces`; the old one is superseded, never carried. A fact forgotten and remembered again comes back. New search_memory (query, kind), with dates; read-only. - Nightly on the brain, no model: events past 30 days fold into a line per week (「11/3–11/9 做過的事(14 件):整理照片 ×3…」, ≤400 chars, like with like by words or vectors), weeks past 180 days into months; the folded go to 最近刪除 for 30 days. Facts are never removed. The page offers duplicates, facts unused for half a year, and what can fold now. - Local model: minishlab/potion-multilingual-128M through m2v.rs (same token ids as model2vec-rs on 13/13 sentences, cos ≥ 0.9999, without tokenizers' 1.1 GB). Converted while downloading: vocab.bin, table.i8 (int8 + row scales), dims.json, 137 MB kept of 530 MB; ANYBOT_HF_BASE picks a mirror (now passed into the server's brain container too). Loaded when first needed (34 ms), let go after 10 idle minutes. The brain loads it; a screen only with a document folder set; hands and phones never. 設定 › 一般 › 語意搜尋: 本機模型/Ollama/關閉; a new engine clears every vector. - Three files, three connections: memory.db (backed up nightly, 7 kept), docs.db (a cache), oplog/audit.db (30 days). An old audit.db hands its memories and documents over once and shrinks (a real one: 172 MB → 16 KB). docs_search scans every chunk now, vectors cached in RAM (it stopped at 8000); FTS optimize + VACUUM daily (260 MB of tombstones over 31 MB of text). - API: POST /api/memory (owner) and /api/sync/memory (mirror). Reads answer on the HTTP thread; writes go through phone_act("memory"). - Screens: a memory dialog (Bot menu 記憶…, Bot settings 打開記憶) with counts, live search, filters, suggestions, per-item kind/date/uses and pin/edit/forget/restore; chips above the composer 300 ms after typing stops, with a token estimate; 「帶了 N 條記憶」 under person messages. The phone has the same as a 記憶 tab, chips and tag. Checked: make test passes (app 297, relay 16), with new tests for the scores and thresholds, Traditional Chinese segmentation, remember's dedupe and replaces, two turns sending the same beginning, no double carry, weekly/monthly folding and the trash, and the audit.db move. Brain idle 37 MB as before, ~230 MB with the model loaded; search on the brain 0.2–0.5 ms, 7–44 ms from the phone page. A deadlock found on the way (stats re-taking the lock) is fixed and tested. Docs: docs/memory.md has the whole design; FEATURES.md, protocol, architecture (zh/en), multi-device and install say what changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3SYw9JJ9dXwaNvYh4
2026-11-10 23:46:50 +00:00
mod m2v;
mod model;
mod notify;
A turn cut off by a crash leaves a 「繼續」 card, and nothing it may have done runs twice Each bot keeps a work log (oplog/bot-<id>.jsonl, after pi's durable-harness design, cut down): before something happens a line says it is about to — the turn, each model call, each step once its checks passed (with the arguments it runs with and whether it may run again), each message typed mid-turn — synced to disk first. When the turn ends the file shrinks to the messages still waiting, usually nothing. On the next start after AnyBot was killed mid-turn, the log puts the chat right before anything runs: the message the turn answered comes back if the chat lost it; a step that was running and reaches outside (a text, a click, a file, a published site) shows as 「可能已經執行了」, both to the person and in the result the bot reads — no longer as "not allowed"; a step that only looked shows as cut off; messages typed mid-turn that never reached the bot go back into the chat. The chat is saved, then the log closes the turn. A turn the person didn't stop ends with a 「繼續」 card (what it was doing, what may have run, the messages put back); it goes on only when they press it — in the window, on a screen of the brain, or on the phone — from where its steps stand, never running a step that may have run again. Pressing stop is on disk at once, and a stopped turn stays stopped. Also in the turn loop: - 自動審核 that doesn't answer (or answers something that isn't a verdict) asks the person; in 直接操作 mode it used to let the step through unchecked. - "Too long for this model" folds older messages into a summary and asks the same step again, once per thing the person said, instead of ending the turn. - Folding keeps the person's chat whole: the summary goes in at the fold and the model reads from the newest summary on (it used to delete what it folded). - A step moved to the chosen computer runs there, but the chat keeps the call as the model wrote it; the result says where it ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha5F5gJt93t3yEx3XcS
2026-11-08 16:49:12 +00:00
mod oplog;
個人資料與用量(計畫 C4、C5,照 OpenBot 的排版):設定多一頁「個人資料」(左下角選單也有「個人資料與用量…」)。名字和「過去一年有 N 個活躍日」;五張卡——Token(過去一年,不算快取命中)、最活躍的一天、訊息、目前連續天數(今天還沒用不算斷)、最長連續天數;「活動」一年的熱度格子(53 週,越忙越深,滑過看日期、token、訊息數);「用量」7/30/90 天/一年:token(新讀、寫、快取讀到)、呼叫次數、花費(只算模型服務回報的,沒回報寫「未定價」,不是 0 元)、每天一條、依模型、依 Bot。 全部從已經有的紀錄算(stats.rs:usage/YYYY-MM.jsonl 和每則訊息的時間,usage::since_any 讀一年),用大腦的時區切日子,打開時在背景算、一分鐘內不重算。螢幕電腦向大腦要(api/sync/stats),手機的路是 api/stats(擁有者才有,手機頁面還沒做)。卡片做成 kit.rs 的 stat_card(設計檢查不准散落的手工卡片)。功能地圖 settings.md(settings-me、驗證步驟)、FEATURES.md、計畫 C4/C5 狀態、版面檢查加「設定 › 個人資料」。 已驗證: cargo test 全綠(831),新測試 stats::a_year_in_figures(不算快取命中、最忙的一天、訊息、今天還沒用不斷、最長、台北時區 23:30 還算那天、熱度四級、7 天的依模型依 Bot、檢查算在它的 Bot、刪掉的 Bot、花費和未定價)、counts_and_costs_are_said_plainly、me_ui 的日期;layout_audit 過(第一版卡片的邊框讓頁面寬了 4 px,被它抓到);clippy 錯誤數跟之前一樣(12);桌面截圖(scratch 寫進一年假的用量紀錄):五張卡、熱度格子、用量的 30 天、每日條、依模型、依 Bot;verify-anybot:api/stats 回 371 天、四個期間,沒登入 401。 未驗證: 螢幕電腦向大腦要(要兩台);真的一年資料的大腦算多久(Jenny 那台 3.5 萬則舊訊息)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 05:54:31 +00:00
mod stats;
mod phone;
mod policy;
mod preview;
Bot 個人檔案:soul、擅長、技能、能力、可用電腦、同事名冊;例行任務每輪開新對話(省 token) 每個 Bot 是獨立的個體(src/profile.rs、src/app/profile_ui.rs) - 新欄位:soul(只有自己讀,放在提示最前面)、擅長、不找它做的事、會的技能、能力、可以用的電腦 - 同事名冊:每個 Bot 的提示裡一行一個其他 Bot(簡介、擅長、不找它、在哪幾台電腦),不含別人的 soul 和記憶;順序固定,吃得到快取 - 能力 11 類(上網、瀏覽器、螢幕、檔案與指令、Mac App、連接器、電話簡訊 X、例行任務、頁面、 合作、管理 App):沒勾的工具不提供、規則不寫進提示;硬叫會被 agent 擋下並說該找誰 - 技能:說明只列自己會的,use_skill 只讀得到自己的;自己學會的自動算它的 - 可以用的電腦:自己的電腦一定可以;預設電腦不在名單時回到自己的電腦,不誤報「沒有連線」; 其他畫面也拿得到完整電腦清單來勾;匯出 Bot 不帶電腦名單和草稿 - 舊 Bot 全部勾選(None = 全部),行為不變 - 例行任務:每輪只從那則訊息讀起(Message::fresh),提醒先讀頁面/查記憶;聊天畫面不變, 使用者自己的下一則照樣看整段 - 順手修:角色說明結尾的「。」不再變成「。。」 - 實測(照建議勾能力):明日之星固定內容 ~21.7k → ~11.5k token、FSD ~25.5k → ~13.2k; 例行任務每輪歷史最多 ~70k → 幾百 連接器(MCP) - 實測三個連接器都能用(本機用 AnyBot 自己的 MCP client):time(get_current_time)、 fetch(讀 example.com)、SccMCP(82 個工具,唯讀的 system_status 查詢成功;超過 20 個走 find / use,搜尋得到) - 測試:有「連接器」能力的 Bot 拿得到(大的走 find/use、提示有說明),沒有的拿不到,硬叫三種 方式都被擋 - 測試用的假模型伺服器改成讀完整個請求再回,平行跑測試時不再偶發斷線 驗證:macOS cargo test 389 通過(連跑三次);Windows/Linux cargo check 通過 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 09:14:51 +00:00
mod profile;
mod providers;
feat: 發布關卡——已送帳本、發布前檢查、送出後讀頁面留證據、例行任務完成條件、重播可填空格 1. 已送帳本(publish.rs):Bot 用 AnyBot 瀏覽器送出前,系統先讀頁面,看是哪個帳號、回哪一篇(回覆對話框或文章裡的貼文網址、或頁面本身);同一帳號回過同一篇就擋下(記 60 天),頁面看不出回哪篇時只擋 24 小時內同頁同字。搜尋框按 Enter 不算送出。瀏覽器新增 sent 動作,直接從帳本列出帳號回過誰,不必每輪讀完網站的回覆頁 2. 發布前檢查:送出前請另一家供應商的快速模型照基本規則(簡體字、AI 腔、不該公開的內容)、這一輪讀過的技能與自訂規則檢查,沒過就不送並說原因;固定不變的放在系統提示最前面方便快取,同一段字一輪只問一次;設定可關、可加規則 3. 送出後的證據:系統重讀頁面,確認文字出現、輸入框清空,抓出留言自己的網址;寫進 Message.sent(頁面文字偽造不了),送出計數、例行任務紀錄、/goal 評審、手機頁面都以它為準;框裡還留著字就記為沒有送出 4. 完成條件:例行任務可設 target_sends,系統自己數:到數就不准再送,結束時不到算失敗,連續兩輪(50 步)沒有新的送出就停下;喚醒訊息與進展檢查都說明目前計數 5. 重播空格:自動學技能時把每次不同的內容(留言、貼文網址)存成 {{名稱}},replay_skill 用 values 填這次的內容,缺哪格就說哪格 6. 間隔從真正送出那一刻算起;送出後確認最多等 8 秒,框清空 4 秒仍沒看到就先記「還沒確認」 Mac 480 個測試通過;送出前後讀頁面在 Brave、Firefox 實機測試通過。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 17:48:13 +00:00
mod publish;
mod remote;
mod routines;
日程:每個 Bot 被設定要做的事放在同一個日曆上(照 OpenBot 日程的排版,風格是 AnyBot 自己的),不用一個個問 Bot「你今天要幹嘛」。另外修好獨立審查在工作流(351ce3f)找到的問題。 日程(schedule.rs 算資料、app/schedule_ui.rs 畫): - 側邊欄最上面一排多了日曆按鈕(所有檔案、工作流、日程、任務…);「日/週/月」「‹ 今天 ›」、右上角寫時區。 - 例行任務(照排程的)和有排程的工作流:跑過的照執行紀錄(✓ 完成、✗ 失敗或中斷、■ 停止、圓點執行中),還沒到的用排程本身的 next_run 算(暫停的變灰帶 ‖);事件觸發的只看得到跑過的;每個一段期間最多 200 次。 - 週:每天一欄,時間+頭像,下面是名稱;月:每天三筆+「還有 N 個」,點那天換成日看法;日:照時間一列列。下面「即將執行」:所有 Bot 最先要跑的六筆。 - 點一筆打開卡片:時間、狀態、怎麼重複、最近一次、要它做什麼;打開聊天/立即執行/暫停繼續(工作流:打開工作流/立即執行)。「+ 新增例行任務」回到聊天、輸入框先放「每天早上 9 點幫我」。 - 功能地圖新的一區 schedule.md;library.md 的座標 76,30 → 32,30(最上面那排多了按鈕)。 工作流的審查(新開脈絡照 workflow.md 審 351ce3f,提了 6 個 P0/P1、3 個 P2,全修): 1. 停止時,還排在忙碌 Bot 後面的那步問題直接拿掉,不再停掉 Bot 手上不相干的那一輪(以前停掉了,排著的問題之後照樣送出)。 2. 交付遇到 Bot 正在回答:等那一輪結束才放進聊天(以前塞進去會被串流蓋掉)。 3. 重開 AnyBot:正在跑的那次標成失敗「AnyBot 在執行中被關掉…」(以前永遠卡住、排程從此不跑);等你確認的留著。 4. 刪除的允許卡片:要刪哪一個在問的當下就定下來寫進呼叫(以前卡片寫 B、按了刪 A);id 給錯(0、"x"、不存在)是錯誤,不會換成別的。 5. edit 設「僅一次」從設的那一刻算(以前可能永遠不跑)。 6. edit 的排程錯了,整次都不留(以前名字照樣改掉)。 另外:只有你正看著的那個 Bot 改工作流才會換畫布,換的時候放掉正在打字/拖的東西;新步驟不會用到執行或版本裡還有的編號;步驟的 Bot 被刪掉,那次停下來;螢幕電腦的選單不能新建、改名、還原、刪除。 已驗證: cargo test 860 過(新:schedule:: 一週的日曆(跑過/即將/暫停/事件觸發/工作流/上限)、日月週的範圍和標題;workflow:: 指定目標和釘住、改一半不留/僅一次/編號不重用/重開時中斷;app::workflow_run 停止拿掉排隊問題不停 Bot、交付等那一輪、Bot 被刪、別的 Bot 不換畫布;layout_audit 日程三景,窄視窗時標題不壓到日週月);clippy 沒有新的(bin 8)。scratch 真資料:手機聊天裡建兩個例行任務、立即執行一次,桌面:側邊欄日曆打開日程(✓ 今天那次、之後的圓點、即將執行六筆帶頭像),卡片、按暫停後變灰且 state 的 paused 是 true;月、日看法;所有檔案在 32,30 打得開。 未驗證: 這輪工作流的修正沒有再跑一次 workflow.md 的六步(單元測試有走每一條);重開 AnyBot 那條只有單元測試(scratch 的截圖模式不走啟動時的收尾)。刪工作流的卡片改在 app.rs 的 AppAction 分支先定目標:動到審批路徑,照規定要你看過再發佈。手機還沒有日程。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 10:58:15 +00:00
mod schedule;
工作流:照 OpenBot 工作流畫布的排版(它公開的程式沒有畫布,照截圖做),風格是 AnyBot 自己的。可以畫、加註解、執行,也可以在聊天裡用一般的話請 Bot 做和改——畫布開在那個 Bot 的聊天旁邊,看著它改。 - 畫布(側邊欄最上面一排的流程圖示):名稱選單(每個工作流和步驟數、新建、版本歷史、重新命名、建立副本、刪除)、右上「聊天/執行紀錄/▷ 執行工作流」、拖曳縮放、工具列(選取、拖曳|畫筆、便利貼、形狀、文字|搜尋|+ 新增節點)、縮放列、小地圖。窄視窗時縮放列移到工具列上面,等你確認那條橫跨上方。 - 卡片:觸發器(手動/排程、下次執行、立即執行)、Bot 步驟、等你確認、檢查、交付、通知你;從卡片底下的點拉線,不能連回觸發器、不能繞圈。 - 執行(workflow_run.rs):照線走;Bot 步驟是那個 Bot 聊天裡的一則問題,最後的回答交給下一步;檢查回「通過」才繼續;等你確認發通知;一次只跑一個;排程到了自動跑;執行紀錄 20 次、版本歷史 30 版。 - 聊出來:新工具 `workflow`(appctl;list/show/create/edit/run/stop/delete,刪除先問),屬於「例行任務與工作流」能力。Bot 做的排成一欄(tidy),插在中間時後面的往下移,使用者自己排過的不重排;改到的卡片和便利貼亮 2.6 秒,跑出畫面就縮到看得到全部。聊天抽成 chat_column,放在畫布旁邊(視窗 ≥ 900),跟著側邊欄選的 Bot 換。 - 修掉的:拖曳的起點用按下的位置(之前從點拉線會搬走卡片);搜尋打開時游標進搜尋框;一個步驟問的是正忙的 Bot(就是叫它開始的那一輪)時,那一輪結束不算這一步的回答(之前整個執行馬上失敗「做完了但沒有寫結果」);「要繼续嗎」簡體字。 - 側邊欄多了工作流按鈕,所有檔案往左一格:library.md 的座標 120,30 → 76,30。 - ctl desktop-shot:手機直接連線只聽 127.0.0.1(ANYBOT_SHOT_REAL=1 的視窗以前會聽區網和 Tailscale,有密碼、截完就關)。 已驗證: cargo test 855 過(新:workflow:: 3 個——聊天裡建立排整齊、一步步改(插中間、分支、刪掉接起來、錯一個整次不留)、run/stop;app::workflow_run 的 a_bots_workflow_call_shows_beside_its_chat,拿掉修正時會失敗;layout_audit 工作流四景;theme 設計檢查——浮在畫布上的改用 kit::floating,便利貼的字用淺色主題的字色);clippy 沒有新的(bin 8)。全新 scratch 照 workflow.md 六步逐字跑過:手機聊天裡建立、修改、執行(第 1 步在 Bot 聊天裡問、檢查「通過」、停在等你確認),桌面截圖:畫布+旁邊的聊天、在旁邊的聊天打字畫布跟著亮起來並縮到看得到全部、自己貼便利貼打字、拉線、搜尋。版本數、state 的步驟和位置另外看過。 未驗證: 真的模型聽一般的話做出工作流(scratch 只能用假模型);「等你確認」的通知真的跳出來(要 AnyBot.app/手機帳號);按「繼續」之後交付、通知你那兩步在真資料上(截圖模式按了會在這台 Mac 跳通知,沒按;單元測試有走)。動到 appctl 的 needs_approval(刪工作流先問,跟刪例行任務一樣):照規定要你看過再發佈。手機還沒有畫布。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 10:37:31 +00:00
mod workflow;
mod setup;
2026-11-11 08:19:06 +00:00
mod skills;
mod teach;
mod share;
Voice: its own 設定 › 語音, run by the brain for every screen and the phone Voice was three implementations that broke on their own: speech to text borrowed the OpenAI key (so with only Grok set up the mic recorded, then failed), OpenAI's models it hard-coded stop on 2027-02-26, read aloud was macOS `say` or espeak-ng (silently nothing on Windows, where espeak isn't installed), and the phone used the browser's own recognition. Now: - 設定 › 語音 has 聽 and 說, each a service: off, OpenAI-compatible (OpenAI, Groq, a Whisper server of your own: the address decides), xAI or ElevenLabs. An empty key borrows 設定 › 模型's for the same service. Each side says 可以用 or what it lacks; 聽 has 試試看 (record a sentence, show what was heard), 說 has 試聽 and the voice list. speech.rs does the calls; xAI's both ways were checked for real (Mandarin read, then heard back, in Traditional characters). - The brain does it all: the phone POSTs its recording (MediaRecorder) to /api/voice/transcribe, screens to /api/sync/voice/transcribe; answers come back as MP3 from …/voice/speech and are played on the device (rodio; an <audio> on the phone, 「唸出來」 in a message's menu). Keys stay on the brain (the voice keys are redacted for screens like the others). - No service, no voice anywhere: the mic, 語音聊天, 會議錄音 and 朗讀 only appear once 聽 (and 說) can be called; the phone's state says which. Without voice the send arrow just rests where 語音聊天 was. - 會議錄音 is uploaded to the brain, which turns it into text in the background and hands it to the bot itself: a meeting is longer than the 35 s the account lets a request wait, and a brain on a server has no window (the jobs are polled in background()). - Recognisers answer Mandarin in Simplified: in a Traditional Chinese window or phone the text becomes Traditional with Taiwan wording. - Older saves: whoever had an OpenAI key keeps voice input (聽 = OpenAI); everyone else starts with it off. Bots' macOS voice names are cleared. 對話詳細資訊's 加入會議 started plain voice input; it starts a meeting now.
2026-11-10 14:58:18 +00:00
mod speech;
mod teams;
mod theme;
mod tools;
mod triggers;
mod embed;
feat: 借鏡 pstack/Grok Bot——例行任務執行紀錄、完成看證據、教訓分流、園丁報告、減少操作步驟、網站地圖 1. 例行任務執行紀錄:每次執行記開始/結束、完成/失敗/被停止/中斷、步數與失敗步數、原因,保留最近 20 次(Grok Bot 官方規格);上次失敗或中斷的原因帶進下一次;連續失敗 2 次自動暫停並說明原因;設定頁、手機詳細頁、list_routines 都看得到,沒有紀錄時說「查不到」不說「沒跑過」 2. 完成看證據:evidence.rs 從步驟算出實際成功送出幾次,寫進例行任務紀錄;/goal 評審的摘錄把 Bot 的話標成「不是證據」並附系統統計,對不上以系統為準;評審優先用另一家供應商的模型,失敗退回原本的 3. 教訓分流:自動學技能時,AnyBot 自己的工具問題寫進 tool_issues → 「待改進」清單(同一工具合併計次),不寫進技能;設定 › 更新可看可清除 4. 園丁報告(garden.rs):平日 8:44 掃過去一天的失敗、走冤枉路的執行、自動暫停與重複出現的待改進;週一 8:49 列出失敗多或太耗時的例行任務;沒事不報,可在設定關掉 5. 減少步驟:browser type 多行文字一次放進欄位(先試貼上事件、檢查沒進再用 insertText,Firefox 也行)並回報欄位內容;點進輸入框回「游標已在…」不再說「沒有變化」;元素編號在同一頁重讀時不變;wait 的 after_send 從上次送出算間隔 6. 網站地圖:學技能時同一網站的操作知識整理進「<網站> 網站地圖」(功能/怎麼到/怎麼操作/陷阱),做事的技能只寫特有規則 Mac 465、Linux 469 個測試通過;多行輸入與編號實機測試在 Brave、Firefox 通過。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:52:44 +00:00
mod evidence;
mod claims;
mod tasks;
feat: AnyBot 功能地圖——Bot 用 anybot_guide 認識 AnyBot 本身;修好地圖整理時找到的七個問題 功能地圖(照 Lauren Tan 的 feature map,poteto/verification-skill-example) - docs/feature-map/:20 區加索引,每區四段(子功能/使用者怎麼到/怎麼操作(Bot:、驗證:)/陷阱),內容逐條對照程式;索引寫共同前提、證據與略過的回報、全面檢查順序 - Bot 的系統提示多一行區塊目錄;新工具 anybot_guide 一次讀一區(唯讀) - cargo test featuremap:: 擋漏寫:Bot 能拿到的每個工具、browser/computer 的每個動作、設定視窗每個分頁和區塊、update_settings 的鍵;每區要有四段、不能太長 - 自動學技能:AnyBot 本身怎麼用不抄進技能,地圖錯漏記成待改進;園丁在重複的待改進旁提醒補地圖 - CLAUDE.md:改功能時同一個 commit 一起改地圖 - 側邊欄「分區」工具的說明寫清楚:不是群組聊天 修正 1. 別人傳來的訊息(訊息管道、團隊成員)那一輪不給 AnyBot 瀏覽器、保險庫和已送紀錄(瀏覽器帶著使用者的登入);硬叫也擋下,公開網頁仍可 web_fetch 2. 自動學會的技能加進那個 Bot 自己的技能清單(支線的算主 Bot 的) 3. 按停止一併停掉這個 Bot 的互動終端機(一般背景指令照舊) 4. 設定 › 整合 › 技能、頁面的「刪除」要再按一次確定 5. update_bot 先跳確認卡片,列出每一項要改成什麼 6. Bot 範本的頭像形狀改成存在的形狀,並加測試 7. 文字:直接操作的提示改「設定 → 權限」、金鑰錯誤改「設定 → 模型」、等核准逾時照實說是什麼在等 Mac 490 個測試通過。 Refs: cl3xk7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 03:15:09 +00:00
mod featuremap;
feat: 借鏡 pstack/Grok Bot——例行任務執行紀錄、完成看證據、教訓分流、園丁報告、減少操作步驟、網站地圖 1. 例行任務執行紀錄:每次執行記開始/結束、完成/失敗/被停止/中斷、步數與失敗步數、原因,保留最近 20 次(Grok Bot 官方規格);上次失敗或中斷的原因帶進下一次;連續失敗 2 次自動暫停並說明原因;設定頁、手機詳細頁、list_routines 都看得到,沒有紀錄時說「查不到」不說「沒跑過」 2. 完成看證據:evidence.rs 從步驟算出實際成功送出幾次,寫進例行任務紀錄;/goal 評審的摘錄把 Bot 的話標成「不是證據」並附系統統計,對不上以系統為準;評審優先用另一家供應商的模型,失敗退回原本的 3. 教訓分流:自動學技能時,AnyBot 自己的工具問題寫進 tool_issues → 「待改進」清單(同一工具合併計次),不寫進技能;設定 › 更新可看可清除 4. 園丁報告(garden.rs):平日 8:44 掃過去一天的失敗、走冤枉路的執行、自動暫停與重複出現的待改進;週一 8:49 列出失敗多或太耗時的例行任務;沒事不報,可在設定關掉 5. 減少步驟:browser type 多行文字一次放進欄位(先試貼上事件、檢查沒進再用 insertText,Firefox 也行)並回報欄位內容;點進輸入框回「游標已在…」不再說「沒有變化」;元素編號在同一頁重讀時不變;wait 的 after_send 從上次送出算間隔 6. 網站地圖:學技能時同一網站的操作知識整理進「<網站> 網站地圖」(功能/怎麼到/怎麼操作/陷阱),做事的技能只寫特有規則 Mac 465、Linux 469 個測試通過;多行輸入與編號實機測試在 Brave、Firefox 通過。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:52:44 +00:00
mod garden;
mod goal;
feat: /plan 先規劃再動手、聊天裡請 Bot 管理連接器、/always-approve 一律放行;輸入框上方的狀態不再破版 /plan(照 Claude Code 的 plan mode、Cursor 的 Plan Mode、Codex 的 update_plan) - 「/plan 要做的事」:這一輪只給會看的工具(讀檔、搜尋、web_fetch、瀏覽器的打開/讀取/捲動、截圖、anybot_guide、問題卡),在執行那一層擋下其他步驟(回「計畫還沒核准」),不是只靠提示詞。 - Bot 用 submit_plan 交計畫:聊天裡一張「計畫」卡(摘要、步驟、怎麼確認做對了、注意),下面的問題卡「照這個計畫做嗎?」:開始照計畫做/先不要/打字寫要改哪裡。 - 核准後同一輪接著做:工具全開、系統指示換成照計畫做,第 1 步自動進行中;update_plan 每做完一步更新一次(整份清單、只有一步進行中),卡上打勾、輸入框上方「照計畫做 · 2/6 · 這一步」;全部做完留「計畫完成」那一行。 - 「/plan」看狀態、「/plan clear」取消;例行任務、訊息管道、團隊成員的訊息不受影響;群組不能用;支線不帶計畫;清除聊天或新對話一起清;分享 Bot 檔不含。手機:計畫卡、計畫列、取消計畫。 - 新功能地圖 plan.md;研究(Claude Code、Codex、Cursor、Gemini CLI…)的結論寫進提示:只寫建議的做法、通常 3 到 7 步、問題最多 3 題、打勾不要太勤。 聊天裡管理連接器(設定能做的聊天也要能做) - 新工具 manage_connectors(管理 App 能力):list、add、update(含開關)、reconnect、remove。改的就是大腦上 設定 › 整合 › 連接器 那一份,不會寫到手腳電腦的檔案(進化之神之前叫使用者去 nobledesktop 的 ~/.local/share/AnyBot 設)。 - 新增、修改、移除先跳卡片:指令(在大腦上執行)或網址、環境變數、標頭;TOKEN、KEY、SECRET、PASS、AUTH… 和密碼顯示「••••(已填)」。名稱重複、command 和 url 都給、網址不對、還有「{…}」、沒東西可改,在問之前就回給 Bot。 - 加好後等它連上(最多 90 秒)再回報幾個工具或原因;一輪裡連接器的工具變了,下一步起就換新(加完同一輪就能用)。 /always-approve(也可以 /yolo) - 使用者自己打(電腦、大腦的螢幕、手機的擁有者)或 設定 › 權限 ›「一律放行」:打開直接操作,之後所有要等「允許」的都自動允許(含一律詢問規則、付款/傳送/刪除的點擊、寄信、傳訊息、打電話、發文、保險庫卡片),自動審核略過;打開時在等的卡片一起放行。 - 照樣擋:安全規則一律拒絕的;別人傳來的訊息那一輪;問題卡、需要處理、計畫卡。Bot、例行任務、訊息管道打不開;管理員和成員打的變成「【名字】/always-approve」。管理員鎖了直接操作就打不開。 - 開著時每個聊天輸入框上方一條「一律放行」和「關閉」;「/always-approve off」關掉,直接操作是它打開的就一起關。 輸入框上方的狀態 - 好幾行的狀態(模型忙碌重試:錯誤、說明、幾秒後重試)以前疊出那一列、壓到輸入框;現在一行:「模型供應商目前負載過高,15 秒後重試(第 3 次,共 3 次)…」。 已驗證:cargo test 548 通過、1 個失敗(layout_audit 的 設定 › 電腦 被這台 Mac 的 Docker 位址 unix:///Users/daniel/.lima/anybot-gvisor 撐寬;把這次的改動 stash 掉一樣失敗,跟這次無關)。新測試:plan:: 7 個;agent 的計畫模式三個(只看到卡片說開始、先不要什麼都不做、修改後重交);app 的 /plan 從打字到計畫完成、Bot 從聊天加連接器(卡片不露 Token、同一輪就用它的工具算出 sum=5)、/always-approve(之前會問、之後不問直接在這台跑、陌生人的訊息照樣問、off 回原樣);mcp::manage_tests 4 個;狀態一行。截圖看過:計畫卡等你決定/照著做打勾、503 重試那一行。手機頁面 JS 語法檢查和計畫卡四種狀態的 HTML。 未驗證:真的模型走一次 /plan 和加 GitLab 連接器;手機實機;伺服器上的大腦(要 make update-server)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 02:55:37 +00:00
mod plan;
mod always;
智慧模式 (/smart): 一问一决定,不是一步一卡 询问和一律放行中间的设定(CLAUDE.md 改善轮迴的第一块:聊天卡顿的主因是一步一卡)。 - 卡片多一个「这轮都准」: 同类操作这一轮只问一次(Job 就是一轮,按构造就是 per-turn; 下一轮会再问)。grant 非空的 Action 卡与连接器卡有这按钮;must-ask(付款/传送/删除的 点击、你的屏幕和 App、保险库、一律询问规则、hook)没有,也不被覆盖。 - 卡片逾时: 你几分钟没回,卡片自己回答——看档案/上网这类先做(步骤结果里写明),敏感操作 自动拒绝并告诉 Bot 别重试。/smart 中途开关都即时(窗口一个 Arc,Job 共享)。 - 审核缓存: 自动审核的模型判决这一轮按(规则,动作)缓存,重复同一步不再每次付 10–20 秒; 审查看不见档案全文时照旧自己问(没动)。 - 开关: /smart(/smart off、status)、设定›权限(滑块调时限,默认 300 秒)、输入列旁图标。 手机/远端只能关不能开(words_loosen + remote setting 只收紧);untrusted 回合永不智慧。 - 锁: 管理员锁住直接操作/本地执行时,智慧模式一起锁。 - feature-map: chat.md / safety.md / autonomy.md / settings.md 同步(featuremap 测试绿)。 已验证: cargo test 全绿 716(含 featuremap::、layout_audit::、approval/tool 锁未动) 未验证: 实机批准卡路径(新按钮、逾时行为)需人类实机点测并签名(CLAUDE.md 审批准则)
2026-11-19 06:59:29 +00:00
mod smart;
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 03:09:13 +00:00
mod secrets;
mod logfile;
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 03:13:59 +00:00
mod net;
feat: /doctor 診斷這台電腦:連線、Tailscale 直連還是中繼、大腦、模型服務、Bot 的電腦、連接器、磁碟、上次出錯 工程基礎計畫 E11(grok-build 的 /doctor)。早上「連不到大腦」花了半小時用指令查出是 Tailscale 走香港中繼,現在打一句就看得到。 - doctor.rs:報告的樣子(一項一行 ✓/✗,最後數有幾項要看);帳號伺服器網址是 *.ts.net 時跑 tailscale ping,讀出是直連還是走哪個中繼(走中繼寫延遲和「多半是中間擋了 UDP 41641」);df 看磁碟;找最新的當掉報告。 - app/doctor_ui.rs:當下就知道的(版本、資料夾、紀錄檔、這台 ↔ 帳號伺服器、帳號伺服器 ↔ 大腦、螢幕連不連得到大腦和原因、上次同步的大小和速度、Bot 的電腦、每個開著的連接器、磁碟少於 2 GB、上次出錯),要上網的在背景跑(Tailscale、每個 Bot 用到的模型服務列模型清單),好了在聊天留一行。 - 在連到大腦的螢幕電腦上:/doctor 在連不到大腦的檢查之前就處理,檢查的是這台本身,結果跳成提示(那個聊天是大腦的)。手機打的是大腦檢查自己。 - / 清單、手機的指令清單多一個 doctor;功能地圖 garden.md、chat.md,FEATURES.md。 已驗證:cargo test 全過、clippy -D warnings 過。新測試:報告的格式和計數;tailscale ping 的直連和中繼兩種輸出(用今天早上這台真的輸出「via DERP(hkg) in 63ms」);最新的當掉報告、磁碟;從聊天打 /doctor 先說「診斷中」、再一份報告(模型服務指向測試用的假模型)。 未驗證:螢幕電腦上真的跑一次(要更新這台 App)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:48:01 +00:00
mod doctor;
mod outputs;
mod gate;
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 04:59:21 +00:00
mod hooks;
feat: 每一次模型呼叫都記用量;/usage 看最近一天和一週 工程基礎計畫 E8,參考 grok-build 的 `grok usage`。 - providers.rs:StepOutput 多一個 usage(輸入、輸出、快取讀、快取寫、花費)。OpenAI 系的串流最後一段的 usage(OpenAI、xAI、OpenRouter 的請求加 stream_options.include_usage;其他有給也讀);Anthropic 從 message_start 和 message_delta 讀。OpenAI 的 prompt_tokens 包含快取讀的,拆開,兩家的「輸入」同一個意思。OpenRouter 回的 cost 記成百萬分之一美元。拿掉沒人讀的 CACHE_STATS。 - usage.rs:run_step_as_written(每一次模型呼叫都經過)之後寫一行到資料夾的 usage/YYYY-MM.jsonl:時間、供應商、模型、session(看得出哪個 Bot、做什麼:回合、發布前檢查、目標檢查、支線)、token、花費。沒回報用量的呼叫不寫。 - 「/usage」(電腦、螢幕、手機):最近 24 小時和 7 天的呼叫次數、輸入、輸出、快取讀了幾成、花費(有回報才寫),依 Bot、依模型各列前 8 名。不猜價錢。 - / 清單、手機的指令清單多一個 usage;功能地圖 chat.md、FEATURES.md。 已驗證:cargo test 全過、cargo clippy -D warnings 過。新測試:兩種串流的用量讀得對(OpenAI 的快取拆出來、OpenRouter 的花費、Anthropic 的四種),只對認得的服務送 stream_options;session 看得出是誰的;一天和一週的加總、依 Bot 和依模型、七天前的不算;寫一行再讀回來,沒用量的不寫。 未驗證:真的 OpenAI/xAI/OpenRouter 回的 usage(照它們的文件寫,假模型測過格式)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:27:34 +00:00
mod usage;
#[cfg(test)]
mod testkit;
2026-11-09 10:00:56 +00:00
mod store;
mod docindex;
mod drops;
mod vault;
mod vault_store;
mod version;
People watch and help on the bots' computer through VNC (noVNC), carried by the account server The core: the bot works the computer; a person watches it like a colleague, and takes over when it needs them. VNC is made for that (only what changed, every mouse move and key, touch on phones), so the pictures sent one by one go, and with them their own input path. - vnc.rs: a VNC proxy to the box's x11vnc through one docker exec (a Python bridge that ends with either side). It signs in to the box with the box's own password (its VNC_PASSWORD) and offers the viewer no password, so the password never leaves the brain. The person's clicks and keys make the bot's steps wait until 8 s after they stop; text typed in the viewer's box (any language) is pasted in the box. - Account server: /screen (the viewer page) and /novnc.js (noVNC 1.6.0, MPL-2.0, bundled); /relay/vnc/<host> takes the browser's WebSocket (account session, or a 10-minute ticket the app asks for with POST /relay/screen-ticket; owners and admins) and carries it over that AnyBot's lasting connection (vopen / vdata / vtext / vclose). Both ends of that connection wait 2 ms instead of 40 ms to read while things move: a request and its answer took up to 160 ms more than needed. - Phone page: 看 Bot 的電腦 and 接管 open the viewer page (also on the local network: /api/vnc on the AnyBot's own phone server). This Mac's own screen moved to the ⋯ menu. - Mac app: 看畫面 opens the viewer in the browser (a screen of a brain: the brain's computer by ticket; else this computer's box, noVNC straight from it). The in-app picture viewer, the live JPEG stream, the person's click/move/scroll/key endpoints and the input shell are gone. - Opening a Mac app uses LaunchServices (`open -a`): agent-desktop's launch waited on the window through accessibility and failed without 輔助使用 now and then. Measured on this Mac (made-up account, local relay + headless brain + the real box): viewer signed in in 0.4–0.7 s, a request and its answer through relay + brain + box 25–58 ms median; headless Chrome shows the desktop live in /screen. remote_e2e 28/28 ×2, 149 unit tests, relay 11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 15:05:44 +00:00
mod vnc;
mod voice;
#[cfg(target_os = "windows")]
mod win;
mod tunnel;
mod web;
mod wire;
use eframe::egui;
use std::path::PathBuf;
/// PingFang ships as a downloadable system asset on macOS; its folder name varies per Mac.
fn pingfang_path() -> Option<PathBuf> {
let root = std::path::Path::new("/System/Library/AssetsV2");
for set in std::fs::read_dir(root).ok()?.flatten() {
if !set.file_name().to_string_lossy().starts_with("com_apple_MobileAsset_Font") {
continue;
}
for asset in std::fs::read_dir(set.path()).into_iter().flatten().flatten() {
let p = asset.path().join("AssetData/PingFang.ttc");
if p.exists() {
return Some(p);
}
}
}
None
}
/// PingFang TC Regular inside PingFang.ttc.
const PINGFANG_TC_INDEX: u32 = 2;
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
/// PingFang TC Semibold inside PingFang.ttc: the bold Apple sets titles in (lighter than Bold).
const PINGFANG_TC_SEMIBOLD_INDEX: u32 = 10;
/// SF Pro, macOS's own Latin face (one variable font: the weight is an axis).
const SF_PRO: &str = "/System/Library/Fonts/SFNS.ttf";
/// The window's first size (screenshot mode can ask for another, e.g. ANYBOT_SHOT_SIZE=760x560).
fn shot_size() -> [f32; 2] {
std::env::var("ANYBOT_SHOT_SIZE").ok().and_then(|v| {
let (w, h) = v.split_once('x')?;
Some([w.parse().ok()?, h.parse().ok()?])
}).unwrap_or([1180.0, 780.0])
}
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
/// 思源黑體 (Noto Sans TC Regular, SIL OFL 1.1, fonts/OFL.txt): the interface's font where the
/// computer has no Apple fonts (Windows, Linux), and what fills in a character the system's lack.
pub const NOTO_TC: &[u8] = include_bytes!("../fonts/NotoSansTC-Regular.otf");
/// 思源黑體's bold weight, for titles, bold words and the main button of a choice.
pub const NOTO_TC_BOLD: &[u8] = include_bytes!("../fonts/NotoSansTC-Bold.otf");
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
/// The family bold interface text is set in (`RichText::family(bold())`, `FontId::new(size, bold())`).
pub fn bold() -> egui::FontFamily {
egui::FontFamily::Name("bold".into())
}
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
/// The reading family: answers and pages. The same face as the interface (Apple's way: one
/// calm sans everywhere; answers used to be in 思源宋體, which read formal and heavy).
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
pub fn read() -> egui::FontFamily {
egui::FontFamily::Name("read".into())
}
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
/// The reading family's bold: headings and bold words in answers and pages.
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
pub fn read_bold() -> egui::FontFamily {
egui::FontFamily::Name("read-bold".into())
}
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
/// The fonts. On a Mac, Apple's own: SF Pro for Latin and 蘋方 (PingFang TC) for Chinese, the
/// pair macOS itself sets text in — Regular, and Semibold for bold (Apple's titles are
/// Semibold, not Bold: lighter, more relaxed). Elsewhere 思源黑體, bundled, so every computer
/// gets a good Chinese face; it also fills in what the Apple fonts lack. The system's mono for
/// code; egui's own fonts stay last for emoji.
pub fn load_fonts(ctx: &egui::Context) {
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
use std::sync::Arc;
let mut fonts = egui::FontDefinitions::default();
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
// Code: the original's `--cursor-font-family-mono` list is ui-monospace, SFMono-Regular, Menlo…
for path in ["/System/Library/Fonts/SFNSMono.ttf", "/System/Library/Fonts/Menlo.ttc"] {
if let Ok(bytes) = std::fs::read(path) {
fonts.font_data.insert("mono".into(), egui::FontData::from_owned(bytes).into());
fonts.families.entry(egui::FontFamily::Monospace).or_default().insert(0, "mono".into());
break;
}
}
// Apple's pair, when this Mac has 蘋方 (a downloadable system asset; nearly always there).
// (SF Pro first: it has the Latin letters and digits, 蘋方 everything Chinese. One file each,
// shared between the weights.)
let mut regular: Vec<String> = vec![];
let mut semibold: Vec<String> = vec![];
// (Read once per run and shared: 蘋方 is 78 MB, and a window or a check may set fonts again.)
static APPLE: std::sync::OnceLock<(Option<egui::epaint::text::Blob>, Option<egui::epaint::text::Blob>)> = std::sync::OnceLock::new();
let (pf, sf) = APPLE.get_or_init(|| {
let blob = |b: Vec<u8>| -> egui::epaint::text::Blob { Arc::new(b) };
(pingfang_path().and_then(|p| std::fs::read(p).ok()).map(blob), std::fs::read(SF_PRO).ok().map(blob))
});
if let Some(pf) = pf.clone() {
if let Some(sf) = sf.clone() {
for (name, wght) in [("sf", 400.0), ("sf-bold", 600.0)] {
let mut d = egui::FontData::from_blob(sf.clone(), 0);
d.tweak.coords = egui::epaint::text::VariationCoords::new([(b"wght", wght)]);
fonts.font_data.insert(name.into(), d.into());
}
regular.push("sf".into());
semibold.push("sf-bold".into());
}
fonts.font_data.insert("pf".into(), egui::FontData::from_blob(pf.clone(), PINGFANG_TC_INDEX).into());
fonts.font_data.insert("pf-bold".into(), egui::FontData::from_blob(pf, PINGFANG_TC_SEMIBOLD_INDEX).into());
regular.push("pf".into());
semibold.push("pf-bold".into());
} else {
// No 蘋方: the system's CJK font only fills in what 思源黑體 lacks (a symbol, a rare character).
let candidates = [
("/System/Library/Fonts/Hiragino Sans GB.ttc", 0),
("/System/Library/Fonts/STHeiti Medium.ttc", 0),
("/System/Library/Fonts/Supplemental/Arial Unicode.ttf", 0),
("C:\\Windows\\Fonts\\msjh.ttc", 0),
("C:\\Windows\\Fonts\\msyh.ttc", 0),
// Linux: Noto Sans CJK (face 3 = Traditional Chinese) on Debian/Ubuntu, Arch, Fedora; then WenQuanYi.
("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc", 3),
("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc", 3),
("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc", 3),
("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc", 0),
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
];
for (path, index) in candidates {
if let Ok(bytes) = std::fs::read(path) {
let mut data = egui::FontData::from_owned(bytes);
data.index = index;
fonts.font_data.insert("cjk".into(), data.into());
break;
}
}
}
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
for (name, bytes) in [("noto", NOTO_TC), ("noto-bold", NOTO_TC_BOLD)] {
fonts.font_data.insert(name.into(), egui::FontData::from_static(bytes).into());
}
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
regular.push("noto".into());
semibold.push("noto-bold".into());
if fonts.font_data.contains_key("cjk") {
regular.push("cjk".into());
}
// The interface: the faces in front of egui's own (emoji last).
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
let base = {
let p = fonts.families.entry(egui::FontFamily::Proportional).or_default();
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
for (i, f) in regular.iter().enumerate() {
p.insert(i, f.clone());
}
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
p.clone()
};
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
// Code: after the mono font, the same faces for Chinese inside code.
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
let mono = fonts.families.entry(egui::FontFamily::Monospace).or_default();
字體改成 Apple 的(SF Pro+蘋方,粗體用半粗),回答不再用宋體;設定左邊每頁加圖示;「模型」改成供應商圖塊(不再是設定旁邊再一排清單);「個人資料與用量」改成數字列+大數字+長條+彩色比例條,不再一整片字。 - 字體(src/main.rs):Mac 上介面和讀的文字都用系統的 SF Pro(可變字體,400/600)加蘋方 PingFang TC(Regular/Semibold),跟 macOS 自己一樣;沒有蘋方的電腦用包在 App 裡的思源黑體。蘋方 78MB 只讀一次共用。思源宋體拿掉(App 小 16MB)。手機的 --font-read 改成跟介面同一種,標題 600。 - 設定左邊分頁:原本就配好的圖示畫出來(齒輪、人、星光、格子、螢幕、盾牌、保險庫、麥克風、雲);拿掉分頁和內容之間的線(底色已經分開)。 - 模型(新 src/app/models_ui.rs):每家一塊圖塊——服務的圖案(src/icons.rs provider_mark,自己畫的簡單圖形,不是任何人的商標圖檔)、名字、「● 可以用/還沒設定」、雲端/本機;點進去才是金鑰和網址,上面「‹ 模型」回來。從聊天、搜尋設定跳來直接進那一家。 - 個人資料與用量(src/app/me_ui.rs):五張有框的卡(兩三欄)→ 一條淡底沒有框的數字列(細節在滑過);最活躍的一天放到熱度格子旁邊一行;用量:大數字 token(新讀、寫、快取在滑過)、呼叫和花費一行、每天的長條、「依模型/依 Bot」切換(依模型一條彩色比例條,每列有服務圖案;依 Bot 每列有頭像)。示範截圖有一年的假資料(ANYBOT_SHOT_TAB=me)。 - 數字:過千萬不帶小數(3,699萬,不是 3699.0萬),整數不寫「.0」。 - 修:任務頁兩個任務同一毫秒開頭時 id 一樣,兩張卡搶同一個按鍵(版面檢查在變慢後抓到);卡片 id 加上它在清單裡的位置。 已驗證: cargo test 876 個全過(含 layout_audit::、featuremap::、stats::);clippy 沒有新警告;desktop-shot 看過聊天(中英混排基準線對齊)、設定一般、模型圖塊、個人資料上半和用量(捲下去)。 未驗證: 手機頁面的字體只改了 CSS,沒有在真的 iPhone 上看;Windows/Linux 的思源黑體備案沒有實機跑;版面檢查變慢(約 40 秒 → 100 秒,每個畫面都載入蘋方)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-22 00:35:28 +00:00
for f in &regular {
if f != "sf" {
mono.push(f.clone());
}
}
let bold_list: Vec<String> = semibold.iter().cloned().chain(base.iter().cloned()).collect();
fonts.families.insert(bold(), bold_list.clone());
fonts.families.insert(read(), base);
fonts.families.insert(read_bold(), bold_list);
ctx.set_fonts(fonts);
}
/// The window icon (Linux taskbars and window switchers; macOS uses the app bundle's).
fn app_icon() -> egui::IconData {
svg_icon(include_str!("../icons/anybot.svg"), 256)
}
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-15 16:06:12 +00:00
/// AnyBot's icon (the cat on yellow) as straight RGBA, `px` square (notification banners).
pub fn app_icon_rgba(px: u32) -> Vec<u8> {
svg_icon(include_str!("../icons/anybot.svg"), px).rgba
}
/// An SVG drawn to a square RGBA picture of `px` pixels.
fn svg_icon(svg: &str, px: u32) -> egui::IconData {
let tree = resvg::usvg::Tree::from_str(svg, &resvg::usvg::Options::default()).expect("icon svg");
let mut pm = resvg::tiny_skia::Pixmap::new(px, px).expect("icon pixmap");
let s = px as f32 / tree.size().width();
resvg::render(&tree, resvg::tiny_skia::Transform::from_scale(s, s), &mut pm.as_mut());
// tiny-skia is premultiplied; IconData wants straight alpha.
let mut rgba = pm.take();
for c in rgba.as_chunks_mut::<4>().0 {
let a = c[3] as u32;
if a > 0 && a < 255 {
for v in &mut c[..3] {
*v = ((*v as u32 * 255 + a / 2) / a).min(255) as u8;
}
}
}
egui::IconData { rgba, width: px, height: px }
}
/// `anybot --write-icon out.png [size] [file.svg]`: the app icon (or that SVG) as a PNG, drawn at
/// that size (for the Mac bundle, Linux packages and the web icons).
fn write_icon(out: &str, px: u32, svg: Option<&str>) -> Result<(), String> {
let icon = match svg {
Some(path) => svg_icon(&std::fs::read_to_string(path).map_err(|e| format!("{path}: {e}"))?, px),
None => svg_icon(include_str!("../icons/anybot.svg"), px),
};
let img = image::RgbaImage::from_raw(icon.width, icon.height, icon.rgba).ok_or("icon")?;
img.save(out).map_err(|e| e.to_string())
}
/// This data folder for this copy (`--serve`, `--ask`), or a clear word and exit when another
/// AnyBot is using it.
fn take_folder_or_exit() -> lock::DataLock {
match lock::take(lock::WAIT) {
Ok(l) => l,
Err(msg) => {
eprintln!("AnyBot:{msg}");
std::process::exit(1);
}
}
}
/// What a second window shows instead of opening: another AnyBot is using this data folder.
fn busy_window(msg: String) -> eframe::Result<()> {
eprintln!("AnyBot:{msg}");
let viewport = egui::ViewportBuilder::default().with_title("AnyBot").with_inner_size([460.0, 240.0]).with_resizable(false).with_app_id("anybot").with_icon(app_icon());
eframe::run_native(
"AnyBot",
eframe::NativeOptions { viewport, ..Default::default() },
Box::new(move |cc| {
load_fonts(&cc.egui_ctx);
Ok(Box::new(Busy(msg)))
}),
)
}
struct Busy(String);
impl eframe::App for Busy {
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ui, |ui| {
ui.add_space(10.0);
ui.label(egui::RichText::new("AnyBot 已經在執行").size(17.0).strong());
ui.add_space(8.0);
ui.label(&self.0);
ui.add_space(14.0);
if ui.button("關閉").clicked() {
ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close);
}
});
}
}
const USAGE: &str = "用法:
anybot 打開 AnyBot 視窗
anybot --serve 不開視窗,讓 Bot 繼續工作、接手機
feat: anybot --ask 給腳本用:--json、--bot、--data-dir、--approve、結束碼 工程基礎計畫 E10(grok-build 的 -p 加 JSON 輸出、結束碼)。 - AskOpts::parse:--json、--bot 名字、--data-dir 資料夾、--approve once|reject,選項可以夾在問題的字中間。寫錯時說哪裡錯、結束碼 2。--data-dir 在讀任何東西(紀錄檔、狀態)之前設成 ANYBOT_DATA_DIR。 - ask_cli:--json 時每則訊息一行 JSON(role、text、error、tools、tool_call_id),核准一行 approval、學到技能一行 learned,最後 done(ok、code、steps、secs、timed_out、answer),文字和參數裡的金鑰遮過。Ctrl-C 先停下 Bot、結束碼 130;時間到或這一輪沒有順利 1;順利 0;資料夾裡還沒有 Bot 2(以前什麼都不印就結束)。 - 核准改走 answer()(跟按鈕一樣):以前直接回覆核准卡的頻道,App 操作的核准(刪例行任務這類)在這裡會一直等到時間到。 - 用法說明(anybot -h)、FEATURES.md。 已驗證:cargo test 577 全過、clippy -D warnings 過。新測試:選項在任何位置都讀得到、缺東西時說清楚;結束碼對應。實際跑:隔離的資料夾裡沒有 Bot 時印出提醒、結束碼 2、立刻結束;--json 的 done 那一行格式對。 未驗證:完整一輪的 --json 輸出。手寫的測試狀態檔有 api_key 欄位,除錯版要從鑰匙圈拿保險庫的鑰匙,會在畫面上跳出允許視窗並卡住,所以停在這裡(已記下這個陷阱)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:58:04 +00:00
anybot --ask 問題… 問一個 Bot 一句,印出這一輪(給人看)
--json 一行一個 JSON(給腳本:message、approval、learned、done)
--bot 名字 問哪個 Bot(預設主要 Bot)
--data-dir 資料夾 用另一個資料夾(像 ANYBOT_DATA_DIR)
--approve once 要核准的自動允許一次(預設自動拒絕)
結束碼:0 這一輪順利、1 失敗或時間到、130 按了 Ctrl-C、2 指令寫錯
anybot setup … 在沒有螢幕的機器上設定
2026-11-11 08:19:06 +00:00
anybot --install-skill 來源 安裝技能(GitHub 網址、owner/repo/path、SKILL.md 網址或本機資料夾)
anybot --update-box 更新 Bot 的電腦(同 設定 › 電腦 › 更新;AnyBot 開著就請它做)
連線體檢(計畫 A1):/doctor 不只看「連著沒」,每一段量真的數字。這台 ↔ 帳號伺服器:小請求打四次,第一次(含建立連線、TLS)另外寫,其餘取中位數當來回時間;再下載 256 KB 算每秒幾 KB——帳號伺服器新加 /api/speed,給壓不小的亂數(Cloudflare、Caddy 都縮不了,量到的是真的線速,最多 1 MB、不快取)。螢幕電腦再量到大腦:大腦新加 /api/sync/ping,由網路那條執行緒直接回、不經過視窗(只給螢幕,手機那條路 403),三次取中位數,扣掉第一段就是帳號伺服器 ↔ 大腦。來回超過 400 ms、每秒不到 300 KB 是 ✗,寫慢在哪一段;帳號伺服器或大腦是舊版就說量不到、不算錯。沒有視窗的電腦(手腳、伺服器)用 anybot --doctor(只讀設定,AnyBot 開著也能跑,有 ✗ 結束碼 1)。功能地圖 garden.md(garden-doctor、新的「量連線」步驟、自動測試)、FEATURES.md、計畫(A1 狀態;A2 暫緩——使用者定了 anybot.30cm.net 是唯一的網址;A5 做完;§0 記下 ai、jenny-host 搬到 headscale、帳號伺服器只剩 anybot.30cm.net)同步。設定頁的「檢查連線」按鈕沒做:account.md 篇幅滿了,/doctor 在聊天(手機也行)就能叫。 已驗證: cargo test 全綠(821)、relay cargo test 全綠(25);新測試 the_connection_check_times_each_leg_and_says_which_is_slow(整條路、舊伺服器和舊大腦、大腦離線、伺服器連不到、大腦那段慢)、a_screen_pings_its_brain_without_the_window、relay 的 the_speed_check_gets_noise_of_the_size_asked;featuremap 全過;clippy:app 的錯誤數跟之前一樣(12,都在沒動的檔)、relay 乾淨;verify-anybot:scratch 開這份的 relay、用配對碼加入、anybot --doctor 印「來回 60 ms(第一次連上 135 ms)」「下載 256 KB 用了 62 ms:每秒 4129 KB」,換成只認 /api/hello 的舊伺服器說「量不到」,關掉伺服器「✗ … 連不到」、結束碼 1。 未驗證: 帳號伺服器 ↔ 大腦那段要兩台(大腦+螢幕電腦)實機,只有自動測試;三台實機(Mac mini、MacBook Pro、iPhone)的數字要等帳號伺服器和各台換成新版。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 02:54:46 +00:00
anybot --doctor 量連線:這台 ↔ 帳號伺服器、到大腦(同聊天裡的 /doctor 那幾行)
anybot --screenshot 檔名 把視窗畫成一張圖
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-15 16:06:12 +00:00
anybot --banner 標題 內文 送一則通知,看它怎麼送出(Mac:AnyBot.app 自己的通知)
anybot --version 印出版本(v0.0.1-36bc2be · 建置時間)
資料夾:ANYBOT_DATA_DIR(沒設就用這個使用者的 AnyBot 資料夾)";
fn main() -> eframe::Result<()> {
// Linux 的指令沙盒 (landlock.rs): AnyBot started as the sandbox around one command — nothing
// of the app, and before reading the arguments as text (a path in them may not be).
if std::env::args_os().nth(1).is_some_and(|a| a == landlock::ARG) {
landlock::run_helper(&std::env::args_os().skip(2).collect::<Vec<_>>());
}
let args: Vec<String> = std::env::args().collect();
// Before anything else: no data folder, no window.
if matches!(args.get(1).map(String::as_str), Some("--version" | "-V")) {
println!("AnyBot {}", version::full(version::exe_modified()));
return Ok(());
}
feat: anybot --ask 給腳本用:--json、--bot、--data-dir、--approve、結束碼 工程基礎計畫 E10(grok-build 的 -p 加 JSON 輸出、結束碼)。 - AskOpts::parse:--json、--bot 名字、--data-dir 資料夾、--approve once|reject,選項可以夾在問題的字中間。寫錯時說哪裡錯、結束碼 2。--data-dir 在讀任何東西(紀錄檔、狀態)之前設成 ANYBOT_DATA_DIR。 - ask_cli:--json 時每則訊息一行 JSON(role、text、error、tools、tool_call_id),核准一行 approval、學到技能一行 learned,最後 done(ok、code、steps、secs、timed_out、answer),文字和參數裡的金鑰遮過。Ctrl-C 先停下 Bot、結束碼 130;時間到或這一輪沒有順利 1;順利 0;資料夾裡還沒有 Bot 2(以前什麼都不印就結束)。 - 核准改走 answer()(跟按鈕一樣):以前直接回覆核准卡的頻道,App 操作的核准(刪例行任務這類)在這裡會一直等到時間到。 - 用法說明(anybot -h)、FEATURES.md。 已驗證:cargo test 577 全過、clippy -D warnings 過。新測試:選項在任何位置都讀得到、缺東西時說清楚;結束碼對應。實際跑:隔離的資料夾裡沒有 Bot 時印出提醒、結束碼 2、立刻結束;--json 的 done 那一行格式對。 未驗證:完整一輪的 --json 輸出。手寫的測試狀態檔有 api_key 欄位,除錯版要從鑰匙圈拿保險庫的鑰匙,會在畫面上跳出允許視窗並卡住,所以停在這裡(已記下這個陷阱)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:58:04 +00:00
// `anybot --ask … --data-dir X`: that folder for everything (set before anything reads it).
let ask = (args.get(1).map(String::as_str) == Some("--ask")).then(|| app::AskOpts::parse(&args[2..]));
if let Some(Err(e)) = &ask {
eprintln!("{e}");
std::process::exit(2);
}
if let Some(Ok(app::AskOpts { data_dir: Some(d), .. })) = &ask {
std::env::set_var("ANYBOT_DATA_DIR", d);
}
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 03:09:13 +00:00
// 紀錄檔與當掉報告 (logfile.rs): logs/ in the data folder, and a report if anything panics.
logfile::init();
// 完整結果 older than a week go.
outputs::prune();
feat: 檢查點與 /rewind:Bot 用 edit_file 改的檔案和對話可以退回之前說的某一句 - edit_file 改檔案前先存原本的樣子(沒有這個檔案也記),記在開始那一輪的那句話底下,同一輪同一個檔案只記一次;你的電腦、Bot 自己的電腦(Docker、封閉資料夾)、SSH 電腦都記;存在資料夾的 checkpoints/,同樣內容存一份,一週後清掉。 - /rewind 列出最近 10 句和之後改過幾個檔案;/rewind N 檔案和對話都退回(新的先退,新建的刪掉;那句話放回輸入框;退回前的整段對話收進過去的對話「退回前:…」);/rewind N 檔案、/rewind N 對話 只退一邊。檔案在背景還原,好了一行報告。 - 用指令改的、其他 AnyBot 電腦上的、超過 2 MB 的不在裡面,照實說。 - tools.rs:file_spot、file_now、file_put(box 的路徑檢查抽成 box_guard 共用);Place 可以存檔。 - 背景做完的一行字(later_notes)走同一個地方進聊天。 已驗證:cargo test 593 通過(兩輪改三個檔案:退到第二輪只還原那輪的、退到第一輪全部還原、新建的刪掉、太大的照實說;App 裡 /rewind 清單、編號不存在、退回後只剩 AnyBot 的字、草稿是那句話、退回前收進過去的對話、README 回到中文、INSTALL.md 刪掉)、clippy -D warnings 乾淨。 未驗證:Docker 和 SSH 電腦上的存與還原(走同一個 cat 的路)、真的 App 和手機上打 /rewind。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 04:35:31 +00:00
// 檢查點 kept content no change has used for a week.
checkpoint::prune();
// `anybot --update-box` (make update-box): 更新 Bot 的電腦 from a terminal, by this AnyBot —
// or the one running on this data folder (cloudbox::update_box_cli).
if args.get(1).map(String::as_str) == Some("--update-box") {
std::process::exit(cloudbox::update_box_cli());
}
連線體檢(計畫 A1):/doctor 不只看「連著沒」,每一段量真的數字。這台 ↔ 帳號伺服器:小請求打四次,第一次(含建立連線、TLS)另外寫,其餘取中位數當來回時間;再下載 256 KB 算每秒幾 KB——帳號伺服器新加 /api/speed,給壓不小的亂數(Cloudflare、Caddy 都縮不了,量到的是真的線速,最多 1 MB、不快取)。螢幕電腦再量到大腦:大腦新加 /api/sync/ping,由網路那條執行緒直接回、不經過視窗(只給螢幕,手機那條路 403),三次取中位數,扣掉第一段就是帳號伺服器 ↔ 大腦。來回超過 400 ms、每秒不到 300 KB 是 ✗,寫慢在哪一段;帳號伺服器或大腦是舊版就說量不到、不算錯。沒有視窗的電腦(手腳、伺服器)用 anybot --doctor(只讀設定,AnyBot 開著也能跑,有 ✗ 結束碼 1)。功能地圖 garden.md(garden-doctor、新的「量連線」步驟、自動測試)、FEATURES.md、計畫(A1 狀態;A2 暫緩——使用者定了 anybot.30cm.net 是唯一的網址;A5 做完;§0 記下 ai、jenny-host 搬到 headscale、帳號伺服器只剩 anybot.30cm.net)同步。設定頁的「檢查連線」按鈕沒做:account.md 篇幅滿了,/doctor 在聊天(手機也行)就能叫。 已驗證: cargo test 全綠(821)、relay cargo test 全綠(25);新測試 the_connection_check_times_each_leg_and_says_which_is_slow(整條路、舊伺服器和舊大腦、大腦離線、伺服器連不到、大腦那段慢)、a_screen_pings_its_brain_without_the_window、relay 的 the_speed_check_gets_noise_of_the_size_asked;featuremap 全過;clippy:app 的錯誤數跟之前一樣(12,都在沒動的檔)、relay 乾淨;verify-anybot:scratch 開這份的 relay、用配對碼加入、anybot --doctor 印「來回 60 ms(第一次連上 135 ms)」「下載 256 KB 用了 62 ms:每秒 4129 KB」,換成只認 /api/hello 的舊伺服器說「量不到」,關掉伺服器「✗ … 連不到」、結束碼 1。 未驗證: 帳號伺服器 ↔ 大腦那段要兩台(大腦+螢幕電腦)實機,只有自動測試;三台實機(Mac mini、MacBook Pro、iPhone)的數字要等帳號伺服器和各台換成新版。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 02:54:46 +00:00
// `anybot --doctor`: 連線體檢 from a terminal (a computer without a window, hands, a server),
// the same timed legs /doctor puts in the chat. Only reads the settings (AnyBot may be open).
if args.get(1).map(String::as_str) == Some("--doctor") {
let st = model::State::load();
if st.remote.relay_url.is_empty() {
println!("這台沒有登入帳號:沒有帳號伺服器可以量");
std::process::exit(0);
}
println!("連線體檢:{}{}", st.remote.relay_url, if st.remote.brain_id.is_empty() { String::new() } else { format!("(大腦「{}」)", st.remote.brain_name) });
let lines = remote::net_check(&st.remote);
for l in &lines {
println!("{} {}", if l.ok { "✓" } else { "✗" }, l.text);
}
std::process::exit(if lines.iter().all(|l| l.ok) { 0 } else { 1 });
}
2026-11-11 08:19:06 +00:00
// P7: install a skill package (a GitHub folder/URL, SKILL.md URL, or local folder/file).
if let Some(i) = args.iter().position(|a| a == "--install-skill") {
let src = args.get(i + 1).cloned().unwrap_or_default();
if src.is_empty() {
2026-11-11 08:19:06 +00:00
eprintln!("用法:anybot --install-skill <GitHub 網址、owner/repo/路徑、SKILL.md 網址或本機資料夾>");
std::process::exit(2);
}
2026-11-11 08:19:06 +00:00
match crate::skills::install_from_source(&src) {
Ok(name) => {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs - macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file ignores and enforce symlink/policy checks across SSH, device and document search. - 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs): forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP labels, box screenshots and control text lists; preserve non-text Wayland clipboards. - 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser): verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval and PDF export while masking card/CVC values and screenshots; remember sites only on always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker ports, OrbStack 198.18/15 and IPv6 transition ranges. - 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact routine trigger secrets and clear REDACTED when endpoints change; isolate channel and team-member turns from owner memories, appctl and grants; scrub shared bot exports and reset grants/routines on import; validate drop IDs and serialize chunk writes. - 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff buffers; move VNC stdin/text off the tunnel loop. - 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs, setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs): wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved mirror edits across brief disconnects; give Chinese skills distinct folders and approval gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths; fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill, cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let _folder = take_folder_or_exit();
2026-11-11 08:19:06 +00:00
let mut st = model::State::load();
crate::memory::merge_skill_files(&mut st.skills);
st.save();
println!("已安裝技能「{name}」(在 設定 › 整合 › 技能 可看)");
}
Err(e) => {
eprintln!("{e}");
std::process::exit(1);
}
}
return Ok(());
}
let screenshot = args.iter().position(|a| a == "--screenshot").and_then(|i| args.get(i + 1)).map(PathBuf::from);
// For tests that start AnyBots of their own: a whole settings file (the sample bots) to edit.
if args.get(1).map(String::as_str) == Some("--sample-state") {
let out = args.get(2).cloned().unwrap_or_else(|| "state.json".into());
let mut st = model::State::samples();
st.remote = Default::default();
if let Err(e) = std::fs::write(&out, serde_json::to_vec_pretty(&st).unwrap_or_default()) {
eprintln!("{e}");
std::process::exit(1);
}
return Ok(());
}
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-15 16:06:12 +00:00
// `anybot --banner 標題 內文`: send one banner the way a bot's would (checks that AnyBot.app's
// own notifications work: its icon, allowed in 系統設定 › 通知).
if args.get(1).map(String::as_str) == Some("--banner") {
notify::prepare();
println!("{}", notify::banner_now(args.get(2).map(String::as_str).unwrap_or("AnyBot"), args.get(3).map(String::as_str).unwrap_or("通知測試")));
return Ok(());
}
if args.get(1).map(String::as_str) == Some("--write-icon") {
let out = args.get(2).cloned().unwrap_or_else(|| "anybot.png".into());
let px = args.get(3).and_then(|v| v.parse().ok()).unwrap_or(256);
if let Err(e) = write_icon(&out, px, args.get(4).map(String::as_str)) {
eprintln!("{e}");
std::process::exit(1);
}
return Ok(());
}
Bots click by number: every control on the screen is boxed and numbered, on every computer A bot asked to open a Threads profile clicked an empty strip ten times: it guessed coordinates from a picture, and the web tools' description told it they didn't work on its own computer. - marks.rs: the picture a bot gets has every button, link, field and menu item boxed and numbered (a tiny built-in digit font, pure Rust), with the same numbers in a list. click / typing / scroll / mouse_move take the number (ref) and land on the control's centre. - Where the controls come from: macOS AX and Linux AT-SPI through agent-desktop on a person's computer (desktop::elements); AT-SPI in the bots' own computer (box/a11y, after XBot's box-a11y), web pages included. On a Mac a control whose spot another app's window covers gets no number (topmost window at its centre must be the app's; the Dock's invisible full-screen window doesn't count). open_app waits until the app is really in front. - No going round in circles: a step that changed nothing says so; the same step (clicks within 16 px) a third time in a turn comes with a warning, from the fourth time it isn't run. - The box (version 4): one TigerVNC server instead of Xvfb + x11vnc, the AT-SPI bus and registry at boot, one browser launcher (box/browser, after XBot's box-chrome: same profile and CDP, renderer accessibility, a launch lock, stale profile locks cleared). One docker exec per look (list + picture, ~0.4 s). A brain updates an older box by itself when it has been idle a minute (files and logins stay); a new box is never made from an older image. - Gone: computer_use_read_app (the list is in every picture), computer_use_mouse_button, the per-call picture for the phone (it gets a plain one), the stale browser_read note; the prompt says web work goes through browser_* by number, and never to read browser cookie or history files. Tests: marks (numbering, drawing, fingerprints), box_numbers_are_exact on a box from the new image (a Threads-like page: the icon links get numbers, Profile clicked by number, Chinese typed into the numbered field, a click on nothing called out), box_screen_is_exact, VNC e2e 11/11 on TigerVNC, Calculator 7×8=56 by numbers through the signed app on this Mac, remote_e2e 28/28, 153 unit tests; Linux build + 157 tests + x11_live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 16:47:01 +00:00
// For testing on a new system: `anybot --tool computer_use_screenshot '{}' computer_use_click
// '{"ref":"7"}' …` runs computer tools in order (one process, so a picture's numbers carry
// over), prints what the bot would hear, and saves the numbered pictures that come back as
// anybot-tool-N.jpg in the temp folder.
if args.get(1).map(String::as_str) == Some("--tool") {
let mut all_ok = true;
for (i, pair) in args[2..].chunks(2).enumerate() {
let json = pair.get(1).cloned().unwrap_or_else(|| "{}".into());
let (text, ok, img) = computer::run(&pair[0], &json);
println!("{} {}: {text}", pair[0], if ok { "ok" } else { "failed" });
if let Some(b64) = img {
use base64::Engine;
let out = std::env::temp_dir().join(format!("anybot-tool-{i}.jpg"));
let _ = std::fs::write(&out, base64::engine::general_purpose::STANDARD.decode(b64).unwrap_or_default());
println!(" saved {}", out.display());
}
all_ok &= ok;
std::thread::sleep(std::time::Duration::from_millis(300));
}
std::process::exit(if all_ok { 0 } else { 1 });
}
// For trying agent-desktop on a new system: `anybot --desktop snapshot '{"app":"Finder"}'`.
if args.get(1).map(String::as_str) == Some("--desktop") {
let cmd = args.get(2).cloned().unwrap_or_else(|| "apps".into());
let v: serde_json::Value = serde_json::from_str(args.get(3).map(String::as_str).unwrap_or("{}")).unwrap_or_default();
match desktop::run(&cmd, &v) {
Ok(out) => println!("{}", serde_json::to_string_pretty(&out).unwrap_or_default()),
Err(e) => {
eprintln!("{e}");
std::process::exit(1);
}
}
std::process::exit(0);
}
// `anybot setup`: make this computer a brain, or hands for a brain (in a terminal). It takes
// the data folder only while it writes the settings (see setup.rs).
if args.get(1).map(String::as_str) == Some("setup") {
std::process::exit(setup::run(&args[2..]));
}
// Everything below uses the data folder (the chats, the work log): one AnyBot at a time.
feat: anybot --ask 給腳本用:--json、--bot、--data-dir、--approve、結束碼 工程基礎計畫 E10(grok-build 的 -p 加 JSON 輸出、結束碼)。 - AskOpts::parse:--json、--bot 名字、--data-dir 資料夾、--approve once|reject,選項可以夾在問題的字中間。寫錯時說哪裡錯、結束碼 2。--data-dir 在讀任何東西(紀錄檔、狀態)之前設成 ANYBOT_DATA_DIR。 - ask_cli:--json 時每則訊息一行 JSON(role、text、error、tools、tool_call_id),核准一行 approval、學到技能一行 learned,最後 done(ok、code、steps、secs、timed_out、answer),文字和參數裡的金鑰遮過。Ctrl-C 先停下 Bot、結束碼 130;時間到或這一輪沒有順利 1;順利 0;資料夾裡還沒有 Bot 2(以前什麼都不印就結束)。 - 核准改走 answer()(跟按鈕一樣):以前直接回覆核准卡的頻道,App 操作的核准(刪例行任務這類)在這裡會一直等到時間到。 - 用法說明(anybot -h)、FEATURES.md。 已驗證:cargo test 577 全過、clippy -D warnings 過。新測試:選項在任何位置都讀得到、缺東西時說清楚;結束碼對應。實際跑:隔離的資料夾裡沒有 Bot 時印出提醒、結束碼 2、立刻結束;--json 的 done 那一行格式對。 未驗證:完整一輪的 --json 輸出。手寫的測試狀態檔有 api_key 欄位,除錯版要從鑰匙圈拿保險庫的鑰匙,會在畫面上跳出允許視窗並卡住,所以停在這裡(已記下這個陷阱)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:58:04 +00:00
if let Some(Ok(opts)) = ask {
let ctx = egui::Context::default();
let _folder = take_folder_or_exit();
feat: anybot --ask 給腳本用:--json、--bot、--data-dir、--approve、結束碼 工程基礎計畫 E10(grok-build 的 -p 加 JSON 輸出、結束碼)。 - AskOpts::parse:--json、--bot 名字、--data-dir 資料夾、--approve once|reject,選項可以夾在問題的字中間。寫錯時說哪裡錯、結束碼 2。--data-dir 在讀任何東西(紀錄檔、狀態)之前設成 ANYBOT_DATA_DIR。 - ask_cli:--json 時每則訊息一行 JSON(role、text、error、tools、tool_call_id),核准一行 approval、學到技能一行 learned,最後 done(ok、code、steps、secs、timed_out、answer),文字和參數裡的金鑰遮過。Ctrl-C 先停下 Bot、結束碼 130;時間到或這一輪沒有順利 1;順利 0;資料夾裡還沒有 Bot 2(以前什麼都不印就結束)。 - 核准改走 answer()(跟按鈕一樣):以前直接回覆核准卡的頻道,App 操作的核准(刪例行任務這類)在這裡會一直等到時間到。 - 用法說明(anybot -h)、FEATURES.md。 已驗證:cargo test 577 全過、clippy -D warnings 過。新測試:選項在任何位置都讀得到、缺東西時說清楚;結束碼對應。實際跑:隔離的資料夾裡沒有 Bot 時印出提醒、結束碼 2、立刻結束;--json 的 done 那一行格式對。 未驗證:完整一輪的 --json 輸出。手寫的測試狀態檔有 api_key 欄位,除錯版要從鑰匙圈拿保險庫的鑰匙,會在畫面上跳出允許視窗並卡住,所以停在這裡(已記下這個陷阱)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 03:58:04 +00:00
app::App::ask_cli(&ctx, opts);
}
// No window: keep the bots working and answer the phone (always-on Mac or server).
if args.iter().any(|a| a == "--serve") {
// The first line of the log says which build is running (make server-logs, journalctl).
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 03:09:13 +00:00
log::info!("AnyBot {}", version::full(version::exe_modified()));
let ctx = egui::Context::default();
let _folder = take_folder_or_exit();
app::App::serve(&ctx);
}
// `--help` or a flag this build doesn't know: say what there is and stop. (It used to open the
// window on the real data folder, next to the AnyBot already using it.) Single-dash arguments
// are macOS's own (-psn_…, -NSDocumentRevisionsDebugMode) and are left alone.
if let Some(bad) = args.iter().skip(1).find(|a| a.as_str() == "-h" || (a.starts_with("--") && !matches!(a.as_str(), "--screenshot" | "--serve"))) {
if bad != "--help" && bad != "-h" {
eprintln!("AnyBot:不認得「{bad}」。");
}
eprintln!("{USAGE}");
std::process::exit(if bad == "--help" || bad == "-h" { 0 } else { 2 });
}
// (A screenshot run is a tool next to the AnyBot that owns the folder; it doesn't take it.)
let _folder = if screenshot.is_some() {
None
} else {
match lock::take(lock::WAIT) {
Ok(l) => Some(l),
Err(msg) => return busy_window(msg),
}
};
let mut viewport = egui::ViewportBuilder::default()
.with_title("AnyBot")
.with_inner_size(shot_size())
.with_min_inner_size([app::SIDEBAR_MIN_WIDTH + app::CHAT_MIN_WIDTH, 480.0])
.with_app_id("anybot")
.with_icon(app_icon());
// On a Mac the window is one surface to the very top (the grey system title bar didn't match
// a dark window); the traffic lights sit over the sidebar's empty corner.
if cfg!(target_os = "macos") {
viewport = viewport.with_fullsize_content_view(true).with_titlebar_shown(false).with_title_shown(false);
}
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
let mut options = eframe::NativeOptions { viewport, ..Default::default() };
// The built-in graphics, not the separate card: egui-wgpu asks for HighPerformance, which on
// a two-GPU Intel Mac keeps the discrete card awake (heat, fans, battery) for a chat window.
// WGPU_POWER_PREF still wins when set.
if std::env::var_os("WGPU_POWER_PREF").is_none() {
if let eframe::egui_wgpu::WgpuSetup::CreateNew(c) = &mut options.wgpu_options.wgpu_setup {
c.power_preference = eframe::wgpu::PowerPreference::LowPower;
}
}
eframe::run_native(
"AnyBot",
options,
Box::new(move |cc| {
load_fonts(&cc.egui_ctx);
沒有顯示卡的電腦上,Bot 工作時視窗一直閃、一直卡:Jenny 的大腦(jenny-Host,2 核虛擬機,畫面由 CPU 畫、從 noVNC 看)升級後「對話一直閃」。實測兩個原因:一、Bot 工作時每 5 秒存一次檔,在畫面的執行緒上把整份聊天重寫——她的 Bot 留了 3.5 萬則舊對話(60 MB),每次存 77–90 MB,在我的 Mac 上一次 90–290 毫秒,那台慢好幾倍,等於每 5 秒停住快一秒,一小時寫幾十 GB;二、轉圈、流光字、側欄頭像、串流每秒把整個視窗重畫 20–30 次,每張都靠 CPU 畫(那台捲動 5 秒,畫圖就用掉 2.4 秒 CPU),旁邊還有 Bot 自己開的 Firefox。 現在:過去的對話(討論串)另存在 chats/threads/bot-<編號>.json,只有收起、切換、刪掉對話時才寫;工作中的存檔只寫目前這段(同樣大小的假聊天:每次 7–10 毫秒、0.75 MB)。讀檔直接讀進型別,不先轉成 JSON 樹(3.5 萬則 67 毫秒)。舊格式(對話在聊天檔裡)照讀、第一次存檔搬出去;中間跑過舊版 AnyBot(看不到另存的對話、新放下的寫在聊天檔裡)兩邊合併、舊版放下的排前面、不重複;壞掉的檔改名留著;刪掉 Bot 兩個檔一起刪。另存的檔放在子資料夾:舊版會刪掉 chats/ 裡它不認得的 bot-*.json。開視窗時從 wgpu 的介面卡認出「CPU 畫圖」(llvmpipe/lavapipe),那時這些動畫每 250 毫秒一張(每秒 4 張,還是看得出在動);有顯示卡照舊。功能地圖 chat.md、FEATURES.md 同步。 另外在 Jenny 那台把系統的螢幕閱讀器(orca,11/21 00:00:47 被打開,跟升級同一刻)關掉:同樣捲動 5 秒,AnyBot 主執行緒從 1.31–1.38 秒降到 0.83–0.86 秒(那是那台的設定,不在這個 commit 裡)。 已驗證: cargo test 全綠(819);新測試 earlier_conversations_are_not_written_again_while_a_bot_works(工作中舊對話檔不重寫、讀回、舊格式搬出、舊版跑過的合併不重複、壞檔留著、刪 Bot 一起刪)、animations_slow_down_when_the_processor_draws_the_window;featuremap 全過;clippy 錯誤數跟改之前一樣(12 個,都在沒動的檔);verify-anybot:scratch AnyBot 上傳訊息→開始新對話→舊的在 chats/threads/bot-1.json、聊天檔只剩現在這段→再回一則只有聊天檔更新、舊對話檔時間不變→重開兩段都在→切回過去的對話兩個檔互換。 未驗證: 「CPU 畫圖」那條在這台 Mac 走不到(有顯示卡),要在 jenny-Host 裝上新版後實測 Bot 工作時的 CPU 和畫面;Windows 沒試。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 02:42:51 +00:00
// No graphics card: the window is drawn by the processor (llvmpipe, lavapipe…).
if let Some(rs) = &cc.wgpu_render_state {
app::set_drawn_by_cpu(rs.adapter.get_info().device_type == eframe::wgpu::DeviceType::Cpu);
}
Ok(Box::new(app::App::new(&cc.egui_ctx, screenshot)))
}),
)
}