2026-11-09 08:50:18 +00:00
|
|
|
|
#![recursion_limit = "512"] // the one `computer` tool's schema is one deep json! literal
|
|
|
|
|
|
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod agent;
|
2026-11-19 15:28:52 +00:00
|
|
|
|
mod followup;
|
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;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod app;
|
|
|
|
|
|
mod appctl;
|
|
|
|
|
|
mod attach;
|
|
|
|
|
|
mod axread;
|
2026-11-09 08:53:12 +00:00
|
|
|
|
mod axwrite;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod avatar;
|
AnyBot's browser drives Firefox too, the person's own Firefox profiles included
Firefox dropped Chrome's DevTools protocol, so bidi.rs speaks WebDriver BiDi and does each
DevTools command the browser tools use the BiDi way (real mouse and keys, typing, screenshots,
PDF, dialogs, uploads, downloads, tabs). The 18 tools themselves are unchanged and pass the same
dashboard test on Firefox as on Chrome.
- A computer with only Firefox runs AnyBot's own profiles in it (under the Snap/Flatpak corner
of the home folder when Firefox is packaged that way).
- The person's own Firefox profiles are choices too, by the names Firefox shows (profiles.ini
and the newer profile switcher's SQLite list): 「阿金(Firefox)」, or just 「阿金」. Firefox
can't be taken over once open, so a profile open the everyday way is refused with "close it
first"; AnyBot then opens it itself, logins intact.
- Settings lists them without a remove button; the messages name Firefox as an option.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-07 16:55:17 +00:00
|
|
|
|
mod bidi;
|
2026-11-23 00:09:02 +00:00
|
|
|
|
mod brains;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod botbrowser;
|
|
|
|
|
|
mod browser;
|
|
|
|
|
|
mod cloudbox;
|
|
|
|
|
|
mod channels;
|
2026-11-17 04:35:31 +00:00
|
|
|
|
mod checkpoint;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod computer;
|
2026-11-04 09:19:59 +00:00
|
|
|
|
mod desktop;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod diagram;
|
|
|
|
|
|
mod platform;
|
|
|
|
|
|
mod mic;
|
頁面: pages a bot makes and keeps up to date (like the original's tracking pages)
- write_page / read_page / list_pages: Markdown pages with versions (last 10 kept), per bot;
the reply gets a card (title, fading preview, page icon, 頁面 · 更新時間, 最近更新), and
[標題](page:ID) links open the page
- The page opens large: summary, what changed, the version picker, 複製 / 存成檔案 / 刪除;
listed under 資料庫 in the right panel
- Page blocks for richer pages, in the chat's Markdown too: ```stats tiles, ```steps progress,
> [!NOTE]/[!TIP]/[!WARNING]/[!IMPORTANT] call-outs (with tables and Mermaid charts)
- Phone: the card in chats, page links, a page view with the same blocks; charts drawn by the
AnyBot as SVG (GET /api/pages/<id>[/chart/<n>]); members may read pages
- Bots are told to make a page for things to track and to update it from a routine only when
there is real news
- Screenshot views: ANYBOT_SHOT_VIEW=pagecard / page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 17:41:41 +00:00
|
|
|
|
mod pages;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
#[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;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod httpd;
|
Shortcuts before GUI (C6): the one-step doors, registered
- intents.rs: volume / wifi / lock / dark / trash / eject as named
shortcuts — the model picks a name, the script is built from
constants and checked numbers ("volume set 40; rm -rf /" is not a
thing: args are grammar-checked before any shell sees them)
- the computer tool gains action=intent {intent_name, intent_arg}:
one call where the bench measured 9 steps and 2 minutes of GUI
- the computer's facts line advertises the shortcuts each machine
really has (Mac 6, Linux desktop 5, headless box 0 — nobody hears
a box's volume), so the prompt cache carries the knowledge for free
- scripts self-dispatch (uname): osascript/networksetup/pmset on Mac,
pactl/amixer/nmcli/loginctl/gsettings on Linux, honest failure text
- system prompt: 有捷徑先捷徑,捷徑失敗才回 GUI
- tests: the injection grammar, the availability matrix, a real run
2026-11-09 12:30:38 +00:00
|
|
|
|
mod intents;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod i18n;
|
|
|
|
|
|
mod i18n_table;
|
|
|
|
|
|
mod icons;
|
2026-11-17 04:24:52 +00:00
|
|
|
|
mod landlock;
|
2026-11-13 16:40:16 +00:00
|
|
|
|
mod lantls;
|
2026-11-08 16:49:42 +00:00
|
|
|
|
mod lock;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
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;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod mcp;
|
2026-11-17 05:08:45 +00:00
|
|
|
|
mod mcp_oauth;
|
2026-11-17 09:23:10 +00:00
|
|
|
|
mod chatgpt;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
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;
|
2026-11-13 13:34:03 +00:00
|
|
|
|
mod mention;
|
2026-11-13 14:03:26 +00:00
|
|
|
|
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;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
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;
|
2026-11-21 05:54:31 +00:00
|
|
|
|
mod stats;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod phone;
|
|
|
|
|
|
mod policy;
|
|
|
|
|
|
mod preview;
|
2026-11-13 09:14:51 +00:00
|
|
|
|
mod profile;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod providers;
|
2026-11-14 17:48:13 +00:00
|
|
|
|
mod publish;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod remote;
|
|
|
|
|
|
mod routines;
|
2026-11-21 10:58:15 +00:00
|
|
|
|
mod schedule;
|
2026-11-21 10:37:31 +00:00
|
|
|
|
mod workflow;
|
2026-11-04 12:38:45 +00:00
|
|
|
|
mod setup;
|
2026-11-11 08:19:06 +00:00
|
|
|
|
mod skills;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
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;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod teams;
|
|
|
|
|
|
mod theme;
|
|
|
|
|
|
mod tools;
|
|
|
|
|
|
mod triggers;
|
Meaning beside the words: local embeddings + a document shelf (P6, step 2)
- embed.rs: vectors from the person's own Ollama (/api/embed), model
auto-found among installed ones (bge-m3, nomic-embed-text…), off by
absence — no Ollama is a normal state: every search still answers
with words, the toggle lives in 設定 › 一般
- memories grow a vec column; recall() is now hybrid: trigram FTS,
two-character windows for Chinese, cosine over the shelf, merged by
reciprocal rank — 「那篇講語法的筆記」 finds text that never says 筆記
- docindex.rs: the person's folders (their 文件 by default, add more in
設定 › 一般), text-shaped files chunked into SQLite + FTS, refreshed
by mtime, gone files leave; one background thread does it all — the
turn never waits on embeddings
- one tool for it: search_documents {query, limit} — reads, no approval
- 251 tests: a real temp folder swept, answered, and swept again after
deletion; offline Ollama tested as the normal state it is
2026-11-09 12:23:35 +00:00
|
|
|
|
mod embed;
|
2026-11-14 15:52:44 +00:00
|
|
|
|
mod evidence;
|
2026-11-20 08:16:43 +00:00
|
|
|
|
mod claims;
|
2026-11-20 08:16:43 +00:00
|
|
|
|
mod tasks;
|
2026-11-15 03:15:09 +00:00
|
|
|
|
mod featuremap;
|
2026-11-14 15:52:44 +00:00
|
|
|
|
mod garden;
|
目標: /goal keeps a bot working turn after turn until a second model, reading the chat, says the goal holds
- goal.rs: the command (/goal, /goal clear, /goal <condition>), the judge's brief and how its
answer is read (met / not_met / waiting / impossible), and the brakes: 20 turns, 3 idle turns,
a question for the person, a failed turn, a stop, a silent judge or a restart pause it; the
person's next message takes it up again
- app/goal_ui.rs: on the brain, each finished turn of a goal is checked on a thread with the bot's
quick model; not yet met wakes it with 「[目標]還沒達成:…」, the rest leave a note in the chat
(never sent to the model) and tell the person when away; the line above the input with 清除目標
- typed on the computer, a screen or the phone, the brain acts on it; /goal leads the / list on
both; the phone shows the bar, the notes and the 目標 tag
- anybot --ask "/goal …" runs to the end, like claude -p "/goal …"
- tests for the command, the verdicts, the brakes, the brief and the slash list; FEATURES.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 12:24:27 +00:00
|
|
|
|
mod goal;
|
2026-11-17 02:55:37 +00:00
|
|
|
|
mod plan;
|
|
|
|
|
|
mod always;
|
2026-11-19 06:59:29 +00:00
|
|
|
|
mod smart;
|
2026-11-17 03:09:13 +00:00
|
|
|
|
mod secrets;
|
|
|
|
|
|
mod logfile;
|
2026-11-17 03:13:59 +00:00
|
|
|
|
mod net;
|
2026-11-17 03:48:01 +00:00
|
|
|
|
mod doctor;
|
2026-11-17 03:44:36 +00:00
|
|
|
|
mod outputs;
|
2026-11-17 03:32:31 +00:00
|
|
|
|
mod gate;
|
2026-11-17 04:59:21 +00:00
|
|
|
|
mod hooks;
|
2026-11-17 03:27:34 +00:00
|
|
|
|
mod usage;
|
2026-11-17 03:21:01 +00:00
|
|
|
|
#[cfg(test)]
|
|
|
|
|
|
mod testkit;
|
2026-11-09 10:00:56 +00:00
|
|
|
|
mod store;
|
Meaning beside the words: local embeddings + a document shelf (P6, step 2)
- embed.rs: vectors from the person's own Ollama (/api/embed), model
auto-found among installed ones (bge-m3, nomic-embed-text…), off by
absence — no Ollama is a normal state: every search still answers
with words, the toggle lives in 設定 › 一般
- memories grow a vec column; recall() is now hybrid: trigram FTS,
two-character windows for Chinese, cosine over the shelf, merged by
reciprocal rank — 「那篇講語法的筆記」 finds text that never says 筆記
- docindex.rs: the person's folders (their 文件 by default, add more in
設定 › 一般), text-shaped files chunked into SQLite + FTS, refreshed
by mtime, gone files leave; one background thread does it all — the
turn never waits on embeddings
- one tool for it: search_documents {query, limit} — reads, no approval
- 251 tests: a real temp folder swept, answered, and swept again after
deletion; offline Ollama tested as the normal state it is
2026-11-09 12:23:35 +00:00
|
|
|
|
mod docindex;
|
傳送: a file or a few words from any device of the account to any other
Outside the chats and without a bot: computer → phone, phone → computer,
computer → computer.
- The brain is the post office (src/drops.rs). The sender hands the file
over in 2 MB pieces; the brain keeps it in drops/ and pushes it piece by
piece to the destination computer (device/run tool `drop_put`), going on
from where a broken link stopped and waiting up to 7 days for a computer
that is off. What is for the phone waits at the brain to be downloaded.
- Files land in Downloads/AnyBot with a notification; words go on the
clipboard. A computer takes parcels only from its own brain.
- Window: an ↑ button at the bottom of the sidebar opens 傳送到其他裝置
(pick a device, drop files or paste text, the last 7 days below).
- Phone: 傳送到其他裝置 in the account menu (send, download, copy).
- Bots: a `send_to_device` tool, gated like send_file.
- Owner only; the account server is unchanged. Without an account, this
computer and a phone connected to it directly can exchange.
- Docs: FEATURES §36, protocol, architecture, multi-device (zh and en).
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3SYw9JJ9dXwaNvYh4
2026-11-11 02:04:13 +00:00
|
|
|
|
mod drops;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod vault;
|
|
|
|
|
|
mod vault_store;
|
2026-11-11 05:51:52 +00:00
|
|
|
|
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;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod voice;
|
Windows has hands now (C9, engine)
- src/win.rs: the same mac:: API the harness drives, on Win32 —
SendInput mouse (absolute, multi-click, drag, wheel), keyboard
(macOS key codes mapped to VK, unicode text, modifiers), GDI BitBlt
screenshot, WindowFromPoint/GetForegroundWindow for window_at and
front_app; compiles clean against the windows crate for
x86_64-pc-windows-msvc (API-checked, no hardware here)
- the control tree was already speaking agent-desktop-windows
- intents answer honestly on Windows ("捷徑目前是 macOS/Linux 的")
and don't advertise themselves from the facts line
- CI: a report-only Windows compile job for wherever a Windows runner lives
- needs a real machine: multi-monitor coordinates, high-DPI, UIA-number
clicks, Chinese input
2026-11-09 12:50:44 +00:00
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
|
|
mod win;
|
2026-11-04 11:30:32 +00:00
|
|
|
|
mod tunnel;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
mod web;
|
2026-11-04 11:30:32 +00:00
|
|
|
|
mod wire;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
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";
|
|
|
|
|
|
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
/// 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])
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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.
|
外觀: the bot is the lead — its face over the input says what it is doing, its colour runs through the chat, requests dock above the input
- 思源黑體 (Noto Sans TC Regular, OFL, bundled) is the default font; 粉圓體 and the system font stay as choices
- the chat takes the bot's colour by default: the person's bubble, the send button, the chosen tile (a little of it)
- the bot's words sit on the page without a bubble; the person's bubble has its small corner toward them
- above the input: the bot's face, looking at the input when idle, up while it thinks, across at 「正在…」 while a
step runs, at the person (yellow dot) when it needs them, smiling for 2 s when done, flat-eyed after an error
- 需要你允許 is a yellow card docked above the input instead of a pop-up over the window; Enter allows and Esc
refuses while the input is empty, after the card has been up 0.6 s; yellow is the one colour for 「需要你」
- header: the name at the left, plain buttons without rings; icons drawn a little heavier (2.25)
- an empty chat: the face large, a line on what the bot is for, three things to start with
- screenshot hook ANYBOT_SHOT_CALM
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 13:44:59 +00:00
|
|
|
|
pub const NOTO_TC: &[u8] = include_bytes!("../fonts/NotoSansTC-Regular.otf");
|
|
|
|
|
|
|
外觀: a real bold weight, and 設定 › 一般 as cards of rows
- 思源黑體 Bold is bundled next to Regular: titles, bold words and headings in replies, the chosen page and
choice are set in it (粉圓體 and the system font keep their one weight; replies still fake bold there)
- 設定 › 一般 rearranged: 外觀, 記憶與文件, 通知, Bot, 帳戶 — each a card whose rows hold one thing, the name on the
left and its control on the right, at most one small line under the name, the rest behind the ?
- choices are one segmented control everywhere on the page; switches instead of checkboxes; plain names
(聊天的顏色, 用意思找記憶, Bot 可以翻的資料夾)
- the page list: the chosen page in ink, a yellow dot on 更新 when a newer build waits
- cards on the other pages take the same quiet fill and corners
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 13:54:24 +00:00
|
|
|
|
/// 思源黑體'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");
|
|
|
|
|
|
|
2026-11-16 13:51:30 +00:00
|
|
|
|
/// The family bold interface text is set in (`RichText::family(bold())`, `FontId::new(size, bold())`).
|
外觀: a real bold weight, and 設定 › 一般 as cards of rows
- 思源黑體 Bold is bundled next to Regular: titles, bold words and headings in replies, the chosen page and
choice are set in it (粉圓體 and the system font keep their one weight; replies still fake bold there)
- 設定 › 一般 rearranged: 外觀, 記憶與文件, 通知, Bot, 帳戶 — each a card whose rows hold one thing, the name on the
left and its control on the right, at most one small line under the name, the rest behind the ?
- choices are one segmented control everywhere on the page; switches instead of checkboxes; plain names
(聊天的顏色, 用意思找記憶, Bot 可以翻的資料夾)
- the page list: the chosen page in ink, a yellow dot on 更新 when a newer build waits
- cards on the other pages take the same quiet fill and corners
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 13:54:24 +00:00
|
|
|
|
pub fn bold() -> egui::FontFamily {
|
|
|
|
|
|
egui::FontFamily::Name("bold".into())
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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).
|
2026-11-16 13:51:30 +00:00
|
|
|
|
pub fn read() -> egui::FontFamily {
|
|
|
|
|
|
egui::FontFamily::Name("read".into())
|
外觀: a real bold weight, and 設定 › 一般 as cards of rows
- 思源黑體 Bold is bundled next to Regular: titles, bold words and headings in replies, the chosen page and
choice are set in it (粉圓體 and the system font keep their one weight; replies still fake bold there)
- 設定 › 一般 rearranged: 外觀, 記憶與文件, 通知, Bot, 帳戶 — each a card whose rows hold one thing, the name on the
left and its control on the right, at most one small line under the name, the rest behind the ?
- choices are one segmented control everywhere on the page; switches instead of checkboxes; plain names
(聊天的顏色, 用意思找記憶, Bot 可以翻的資料夾)
- the page list: the chosen page in ink, a yellow dot on 更新 when a newer build waits
- cards on the other pages take the same quiet fill and corners
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 13:54:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-22 00:35:28 +00:00
|
|
|
|
/// The reading family's bold: headings and bold words in answers and pages.
|
2026-11-16 13:51:30 +00:00
|
|
|
|
pub fn read_bold() -> egui::FontFamily {
|
|
|
|
|
|
egui::FontFamily::Name("read-bold".into())
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
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.
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
pub fn load_fonts(ctx: &egui::Context) {
|
2026-11-22 00:35:28 +00:00
|
|
|
|
use std::sync::Arc;
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
let mut fonts = egui::FontDefinitions::default();
|
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 = [
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
("/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),
|
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;
|
|
|
|
|
|
}
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-11-22 00:35:28 +00:00
|
|
|
|
for (name, bytes) in [("noto", NOTO_TC), ("noto-bold", NOTO_TC_BOLD)] {
|
外觀: the bot is the lead — its face over the input says what it is doing, its colour runs through the chat, requests dock above the input
- 思源黑體 (Noto Sans TC Regular, OFL, bundled) is the default font; 粉圓體 and the system font stay as choices
- the chat takes the bot's colour by default: the person's bubble, the send button, the chosen tile (a little of it)
- the bot's words sit on the page without a bubble; the person's bubble has its small corner toward them
- above the input: the bot's face, looking at the input when idle, up while it thinks, across at 「正在…」 while a
step runs, at the person (yellow dot) when it needs them, smiling for 2 s when done, flat-eyed after an error
- 需要你允許 is a yellow card docked above the input instead of a pop-up over the window; Enter allows and Esc
refuses while the input is empty, after the card has been up 0.6 s; yellow is the one colour for 「需要你」
- header: the name at the left, plain buttons without rings; icons drawn a little heavier (2.25)
- an empty chat: the face large, a line on what the bot is for, three things to start with
- screenshot hook ANYBOT_SHOT_CALM
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 13:44:59 +00:00
|
|
|
|
fonts.font_data.insert(name.into(), egui::FontData::from_static(bytes).into());
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
}
|
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).
|
2026-11-16 13:51:30 +00:00
|
|
|
|
let base = {
|
|
|
|
|
|
let p = fonts.families.entry(egui::FontFamily::Proportional).or_default();
|
2026-11-22 00:35:28 +00:00
|
|
|
|
for (i, f) in regular.iter().enumerate() {
|
|
|
|
|
|
p.insert(i, f.clone());
|
|
|
|
|
|
}
|
2026-11-16 13:51:30 +00:00
|
|
|
|
p.clone()
|
|
|
|
|
|
};
|
2026-11-22 00:35:28 +00:00
|
|
|
|
// Code: after the mono font, the same faces for Chinese inside code.
|
2026-11-16 13:51:30 +00:00
|
|
|
|
let mono = fonts.families.entry(egui::FontFamily::Monospace).or_default();
|
2026-11-22 00:35:28 +00:00
|
|
|
|
for f in ®ular {
|
|
|
|
|
|
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);
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
ctx.set_fonts(fonts);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// The window icon (Linux taskbars and window switchers; macOS uses the app bundle's).
|
|
|
|
|
|
fn app_icon() -> egui::IconData {
|
2026-11-05 11:20:29 +00:00
|
|
|
|
svg_icon(include_str!("../icons/anybot.svg"), 256)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-05 11:20:29 +00:00
|
|
|
|
/// An SVG drawn to a square RGBA picture of `px` pixels.
|
|
|
|
|
|
fn svg_icon(svg: &str, px: u32) -> egui::IconData {
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
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();
|
Clippy is clean on macOS and Linux, for the app and the relay
Every warning `cargo clippy --all-targets` gave (50 on macOS, 8 more only on
Linux, 1 in the relay), fixed without changing what anything does:
- long types get a name (Peer, Members, Imported, Joining, Mention, Stream…);
- the two big enum variants are boxed (the vault's login plan, joining an
account);
- a test now waits for the copy it relaunched (it left a zombie behind);
- a hint's format had a dead `if` whose two branches were both "";
- the rest is what clippy suggests: sort_by_key, as_chunks, is_none_or,
is_multiple_of, while let, from_ref, next_back, struct init, no casts to
the same type.
Checked: cargo test (177 macOS, 181 Linux), relay tests (11), remote_e2e
28/28, and the live Linux test (X11; Wayland clicks, keys, Chinese typing,
scroll and screenshots).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-07 02:10:28 +00:00
|
|
|
|
for c in rgba.as_chunks_mut::<4>().0 {
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
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 }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-05 11:20:29 +00:00
|
|
|
|
/// `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),
|
|
|
|
|
|
};
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
let img = image::RgbaImage::from_raw(icon.width, icon.height, icon.rgba).ok_or("icon")?;
|
|
|
|
|
|
img.save(out).map_err(|e| e.to_string())
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-08 16:49:42 +00:00
|
|
|
|
/// 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);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-09 06:58:40 +00:00
|
|
|
|
const USAGE: &str = "用法:
|
|
|
|
|
|
anybot 打開 AnyBot 視窗
|
|
|
|
|
|
anybot --serve 不開視窗,讓 Bot 繼續工作、接手機
|
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 指令寫錯
|
2026-11-09 06:58:40 +00:00
|
|
|
|
anybot setup … 在沒有螢幕的機器上設定
|
2026-11-11 08:19:06 +00:00
|
|
|
|
anybot --install-skill 來源 安裝技能(GitHub 網址、owner/repo/path、SKILL.md 網址或本機資料夾)
|
2026-11-16 13:33:35 +00:00
|
|
|
|
anybot --update-box 更新 Bot 的電腦(同 設定 › 電腦 › 更新;AnyBot 開著就請它做)
|
2026-11-21 02:54:46 +00:00
|
|
|
|
anybot --doctor 量連線:這台 ↔ 帳號伺服器、到大腦(同聊天裡的 /doctor 那幾行)
|
2026-11-09 06:58:40 +00:00
|
|
|
|
anybot --screenshot 檔名 把視窗畫成一張圖
|
2026-11-15 16:06:12 +00:00
|
|
|
|
anybot --banner 標題 內文 送一則通知,看它怎麼送出(Mac:AnyBot.app 自己的通知)
|
|
|
|
|
|
anybot --version 印出版本(v0.0.1-36bc2be · 建置時間)
|
2026-11-09 06:58:40 +00:00
|
|
|
|
資料夾:ANYBOT_DATA_DIR(沒設就用這個使用者的 AnyBot 資料夾)";
|
|
|
|
|
|
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
fn main() -> eframe::Result<()> {
|
2026-11-17 04:24:52 +00:00
|
|
|
|
// 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<_>>());
|
|
|
|
|
|
}
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
let args: Vec<String> = std::env::args().collect();
|
2026-11-11 05:51:52 +00:00
|
|
|
|
// 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(());
|
|
|
|
|
|
}
|
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);
|
|
|
|
|
|
}
|
2026-11-17 03:09:13 +00:00
|
|
|
|
// 紀錄檔與當掉報告 (logfile.rs): logs/ in the data folder, and a report if anything panics.
|
|
|
|
|
|
logfile::init();
|
2026-11-17 03:44:36 +00:00
|
|
|
|
// 完整結果 older than a week go.
|
|
|
|
|
|
outputs::prune();
|
2026-11-17 04:35:31 +00:00
|
|
|
|
// 檢查點 kept content no change has used for a week.
|
|
|
|
|
|
checkpoint::prune();
|
2026-11-23 00:09:02 +00:00
|
|
|
|
// `anybot --brains` (deploy/server's `brains`): 大腦管理員 — a cloud brain for every account.
|
|
|
|
|
|
if args.get(1).map(String::as_str) == Some("--brains") {
|
|
|
|
|
|
brains::run();
|
|
|
|
|
|
}
|
2026-11-16 13:33:35 +00:00
|
|
|
|
// `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());
|
|
|
|
|
|
}
|
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).
|
2026-11-09 12:46:02 +00:00
|
|
|
|
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 網址或本機資料夾>");
|
2026-11-09 12:46:02 +00:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-11-09 12:46:02 +00:00
|
|
|
|
return Ok(());
|
|
|
|
|
|
}
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
let screenshot = args.iter().position(|a| a == "--screenshot").and_then(|i| args.get(i + 1)).map(PathBuf::from);
|
Remote brain: a computer that just came on is known at once; an offline computer is said, not swapped; snapshots survive an open browser; end-to-end test
- The brain looked the account's computers up once a minute: for up to a minute after the Mac
came on, 「我的電腦」 was unknown and steps went elsewhere. Now every 15 s, and at once when a
message comes from a computer it doesn't know yet.
- A step naming a computer that is off says so in words instead of running on the chosen one
with a note that the person hadn't asked.
- Snapshots: tar's 'file changed' (the open browser) is not a failure; browser caches are left
out; ten minutes for a large home folder.
- box_end_to_end clicks the terminal where it opened; restore only with ANYBOT_TEST_RESTORE=1.
- deploy/test/remote_e2e.py: account server + headless brain + hands + scripted model, 27 checks
(computers, redirect, agent-desktop on the hands, hand-off 3 ways, phone view, sync copy,
edits, hands offline/back, brain restart, clear). anybot --sample-state for such tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 10:14:23 +00:00
|
|
|
|
// 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(());
|
|
|
|
|
|
}
|
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(());
|
|
|
|
|
|
}
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
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);
|
2026-11-05 11:20:29 +00:00
|
|
|
|
if let Err(e) = write_icon(&out, px, args.get(4).map(String::as_str)) {
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
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.
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
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 });
|
|
|
|
|
|
}
|
2026-11-04 09:19:59 +00:00
|
|
|
|
// 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);
|
|
|
|
|
|
}
|
2026-11-08 16:49:42 +00:00
|
|
|
|
// `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).
|
2026-11-04 12:38:45 +00:00
|
|
|
|
if args.get(1).map(String::as_str) == Some("setup") {
|
|
|
|
|
|
std::process::exit(setup::run(&args[2..]));
|
|
|
|
|
|
}
|
2026-11-08 16:49:42 +00:00
|
|
|
|
// Everything below uses the data folder (the chats, the work log): one AnyBot at a time.
|
2026-11-17 03:58:04 +00:00
|
|
|
|
if let Some(Ok(opts)) = ask {
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
let ctx = egui::Context::default();
|
2026-11-08 16:49:42 +00:00
|
|
|
|
let _folder = take_folder_or_exit();
|
2026-11-17 03:58:04 +00:00
|
|
|
|
app::App::ask_cli(&ctx, opts);
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
// No window: keep the bots working and answer the phone (always-on Mac or server).
|
|
|
|
|
|
if args.iter().any(|a| a == "--serve") {
|
2026-11-11 05:51:52 +00:00
|
|
|
|
// The first line of the log says which build is running (make server-logs, journalctl).
|
2026-11-17 03:09:13 +00:00
|
|
|
|
log::info!("AnyBot {}", version::full(version::exe_modified()));
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
let ctx = egui::Context::default();
|
2026-11-08 16:49:42 +00:00
|
|
|
|
let _folder = take_folder_or_exit();
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
app::App::serve(&ctx);
|
|
|
|
|
|
}
|
2026-11-09 06:58:40 +00:00
|
|
|
|
// `--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 });
|
|
|
|
|
|
}
|
2026-11-08 16:49:42 +00:00
|
|
|
|
// (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),
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
|
2026-11-05 09:29:55 +00:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
eframe::run_native(
|
|
|
|
|
|
"AnyBot",
|
|
|
|
|
|
options,
|
|
|
|
|
|
Box::new(move |cc| {
|
|
|
|
|
|
load_fonts(&cc.egui_ctx);
|
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);
|
|
|
|
|
|
}
|
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
|
|
|
|
Ok(Box::new(app::App::new(&cc.egui_ctx, screenshot)))
|
|
|
|
|
|
}),
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|