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
// 訊息管道 in the window: the settings page, turning incoming messages into turns, and posting
// the bot's answer back when the turn ends.
use super ::* ;
use crate ::channels ::{ self , Channel , Incoming , Kind , ReplyTo } ;
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings
Permissions and reach
- a file leaving a computer passes the same questions as reading it;
"looking" shell commands that do more than look ask first
- a symlink out of the work/sealed folder counts as outside it
(real paths, not just lexical ones); the search walk skips links
- web_fetch and skill_install read the public web only: localhost, the
LAN and cloud metadata are refused, at every redirect
- preview shows a file without running it; browser_upload may ask
- vault: logins no longer match across shared suffixes (pages.dev,
com.tw, ...); registrable_domain knows public suffixes
- axwrite: found elements are retained (use-after-free)
Relay
- replacing or turning off 2FA needs the current code (rate-limited);
new recovery codes only count once enrollment is verified
- a removed computer loses its socket and its `call` access
- a site name taken by another account answers 409
- RELAY_TRUST_PROXY: the login lock counts the caller's address, not
the proxy's (compose files and README)
- httpd: half a body is not a request
Desktop
- sign-in, join and restore work with 2FA on (code field; --serve reads
ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code)
- Windows: text was typed twice; modifiers are held through click, drag
and scroll; horizontal scroll; screen control is no longer refused
- a recording that hits the limit is transcribed, not thrown away
- bot's computer: a new home volume restores the snapshot; a snapshot
is read through before the home is wiped; a failed volume removal
stops reset/restore
- events of a stopped turn no longer land in the next one; each channel
message gets a turn of its own
- saving a bot's settings keeps what it got meanwhile (three-way merge);
a save file that cannot be read is kept
- pages in Big5/GBK/Shift_JIS are read in their own encoding
(encoding_rs); osascript output past 64 KB no longer stalls
- pick_tab keeps a job's own non-http tab; pictures larger than the
texture limit are fitted; the auto-update time field takes typing
- skills live in <data>/skills; memories are unnumbered in the prompt;
the phone may skillify and skill_install
CI
- the test step fails when the tests fail (it piped into tail)
Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged.
Not run: Windows on a real machine (win.rs type-checked alone), the
Docker paths of the bot's computer, the live accessibility writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
use std ::collections ::VecDeque ;
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-12 07:55:35 +00:00
/// How often the connectors are synced again: what failed or died is connected again.
const MCP_RETRY : std ::time ::Duration = std ::time ::Duration ::from_secs ( 30 ) ;
2026-11-17 02:55:37 +00:00
/// How long a bot's 管理連接器 waits for a connector it added to connect before answering.
const CONNECT_WAIT : std ::time ::Duration = std ::time ::Duration ::from_secs ( 90 ) ;
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
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 struct ChannelUi {
pub tx : Sender < Incoming > ,
pub rx : Receiver < Incoming > ,
/// Where each bot's current answer goes back to.
pub replies : HashMap < u64 , Vec < ReplyTo > > ,
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings
Permissions and reach
- a file leaving a computer passes the same questions as reading it;
"looking" shell commands that do more than look ask first
- a symlink out of the work/sealed folder counts as outside it
(real paths, not just lexical ones); the search walk skips links
- web_fetch and skill_install read the public web only: localhost, the
LAN and cloud metadata are refused, at every redirect
- preview shows a file without running it; browser_upload may ask
- vault: logins no longer match across shared suffixes (pages.dev,
com.tw, ...); registrable_domain knows public suffixes
- axwrite: found elements are retained (use-after-free)
Relay
- replacing or turning off 2FA needs the current code (rate-limited);
new recovery codes only count once enrollment is verified
- a removed computer loses its socket and its `call` access
- a site name taken by another account answers 409
- RELAY_TRUST_PROXY: the login lock counts the caller's address, not
the proxy's (compose files and README)
- httpd: half a body is not a request
Desktop
- sign-in, join and restore work with 2FA on (code field; --serve reads
ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code)
- Windows: text was typed twice; modifiers are held through click, drag
and scroll; horizontal scroll; screen control is no longer refused
- a recording that hits the limit is transcribed, not thrown away
- bot's computer: a new home volume restores the snapshot; a snapshot
is read through before the home is wiped; a failed volume removal
stops reset/restore
- events of a stopped turn no longer land in the next one; each channel
message gets a turn of its own
- saving a bot's settings keeps what it got meanwhile (three-way merge);
a save file that cannot be read is kept
- pages in Big5/GBK/Shift_JIS are read in their own encoding
(encoding_rs); osascript output past 64 KB no longer stalls
- pick_tab keeps a job's own non-http tab; pictures larger than the
texture limit are fitted; the auto-update time field takes typing
- skills live in <data>/skills; memories are unnumbered in the prompt;
the phone may skillify and skill_install
CI
- the test step fails when the tests fail (it piped into tail)
Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged.
Not run: Windows on a real machine (win.rs type-checked alone), the
Docker paths of the bot's computer, the live accessibility writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
/// Messages that came while their bot was busy: each waits for a turn of its own.
waiting : VecDeque < Incoming > ,
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
new_kind : Kind ,
new_name : String ,
new_token : String ,
new_target : String ,
new_bot : u64 ,
pub note : Arc < Mutex < String > > ,
started : bool ,
trig_tx : Sender < crate ::triggers ::Fired > ,
trig_rx : Receiver < crate ::triggers ::Fired > ,
/// What the running watchers were started with (restart when it changes).
trig_sig : String ,
new_client : String ,
new_tenant : String ,
/// Teams sign-in: the code to show, and the refresh token when done.
ms_login : Arc < Mutex < ( String , Option < String > ) > > ,
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
pub ( super ) mcp_sig : String ,
The phone page does what the desktop does, laid out like it
A new mobile/index.html in the desktop's (and Grok Bot's) shape: the sidebar
with its sections and folders, the chat with steps, thinking, reactions, quotes
and the approval card, 對話詳細資訊, Bot 設定, routines, pages, computers and
設定. Each action goes to the desktop's own code on the app's thread
(api/act/<what> -> App::phone_act): appctl, set_pinned, restart_bot,
toggle_reaction, box_task, channels_restart and the rest. No new rules.
Keys, channel tokens and the vault never reach the phone; a model key can only
be written. Admins keep what the phone always let them do; making, changing or
deleting bots, routines, memories, pages, folders and settings stays the
owner's. The state the phone polls now carries the sidebar's section order.
Checked by using it on a preview brain: routines, memories, templates, folders,
keys, signing another phone out, approvals and a chat with a fake model.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-06 19:05:12 +00:00
pub ( super ) mcp_errors : Arc < Mutex < Vec < ( String , String ) > > > ,
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
pub ( super ) mcp_busy : Arc < AtomicBool > ,
2026-11-12 07:55:35 +00:00
/// When the connectors were last synced (again every half minute).
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
mcp_tried : Option < Instant > ,
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
new_mcp : ( String , String , String , String ) ,
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone
- 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API):
servers reached by address only (a package would have to run on the brain, which may have no
Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name
that only says "mcp" (com.notion/mcp) reads as whose it is (notion).
- 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the
header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown
unmasked with what to put there (the key's description, an address variable's choices). 新增
stays off while a 「{…}」 is left.
- The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to
its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key
or the address part and the brain adds it (the 「mcp」 action's new `add`).
- A server that answers 401 (or a 403 asking for a login) with no key given now says it signs
people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old.
- mcpservers.org and the like are pages for people behind a browser check, with no list a program
may read, so the market uses the registry.
- Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own
server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`.
- Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
/// What the form needs from the person, for a server picked from the 公用市集.
new_mcp_hint : String ,
2026-11-12 13:00:14 +00:00
/// 新增連接器's 帳號 and 密碼.
new_mcp_login : ( String , String ) ,
2026-11-17 09:43:09 +00:00
/// 連接器's page (the list, one connector, the market, the form).
pub ( super ) mcp_page : Page ,
/// The connector whose 「移除」 was pressed once (it asks 「確定移除」).
mcp_confirm : Option < String > ,
/// What is typed in a connector's page to find one of its tools.
tool_q : String ,
2026-11-17 09:55:32 +00:00
/// A connector's name as it is being typed (whose, the words): changed when done.
2026-11-17 10:07:33 +00:00
pub ( super ) mcp_name : Option < ( String , String ) > ,
2026-11-17 10:35:57 +00:00
/// The name field of the connector page showing (the tests give it the keyboard directly).
pub ( super ) name_field : Option < egui ::Id > ,
/// A rename asked of the brain from a screen (old, new, when): its page meanwhile.
pub ( super ) mcp_renaming : Option < ( String , String , Instant ) > ,
2026-11-17 09:55:32 +00:00
/// What a connector's page says (a login that didn't start, a name not taken).
2026-11-17 10:35:57 +00:00
pub ( super ) mcp_note : Arc < Mutex < String > > ,
2026-11-17 09:55:32 +00:00
/// The page shown last (a new one opens at its top).
page_key : Option < ( u8 , Page , Page ) > ,
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone
- 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API):
servers reached by address only (a package would have to run on the brain, which may have no
Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name
that only says "mcp" (com.notion/mcp) reads as whose it is (notion).
- 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the
header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown
unmasked with what to put there (the key's description, an address variable's choices). 新增
stays off while a 「{…}」 is left.
- The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to
its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key
or the address part and the brain adds it (the 「mcp」 action's new `add`).
- A server that answers 401 (or a 403 asking for a login) with no key given now says it signs
people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old.
- mcpservers.org and the like are pages for people behind a browser check, with no list a program
may read, so the market uses the registry.
- Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own
server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`.
- Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
/// 公用市集 (the official MCP Registry): what is typed, a search on its way, what it found.
reg_q : String ,
reg_busy : Arc < AtomicBool > ,
reg_found : Arc < Mutex < Option < RegistryAnswer > > > ,
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
/// 設定 › 整合's page: 0 訊息管道, 1 連接器, 2 技能.
pub sub : u8 ,
/// The form for a new channel is open (a press on one of 新增管道's tiles).
adding : bool ,
2026-11-11 08:19:06 +00:00
skill_src : String ,
2026-11-17 09:43:09 +00:00
/// 技能's page (the list, one skill, the market).
pub ( super ) skill_page : Page ,
/// What is typed to find a skill in a long list.
skill_q : String ,
2026-11-15 03:15:09 +00:00
/// The skill whose 「刪除」 was pressed once: it asks 「確定刪除」 before it goes (with its folder).
skill_confirm : Option < String > ,
2026-11-21 06:46:53 +00:00
pub ( super ) skill_busy : Arc < AtomicBool > ,
2026-11-11 08:19:06 +00:00
skill_reload : Arc < AtomicBool > ,
2026-11-21 06:46:53 +00:00
pub ( super ) skill_note : Arc < Mutex < Option < ( bool , String ) > > > ,
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
brain recognises 「/name」 and adds a line after the message telling the model to read that skill
with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
/ 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
/// The last skill request came from the 技能 list (a delete): its answer shows there.
skill_note_list : bool ,
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
}
impl Default for ChannelUi {
fn default ( ) -> Self {
let ( tx , rx ) = channel ( ) ;
let ( trig_tx , trig_rx ) = channel ( ) ;
2026-11-17 10:35:57 +00:00
ChannelUi { tx , rx , replies : HashMap ::new ( ) , waiting : VecDeque ::new ( ) , new_kind : Kind ::Telegram , new_name : String ::new ( ) , new_token : String ::new ( ) , new_target : String ::new ( ) , new_bot : 0 , note : Default ::default ( ) , started : false , trig_tx , trig_rx , trig_sig : String ::new ( ) , new_client : String ::new ( ) , new_tenant : String ::new ( ) , ms_login : Default ::default ( ) , mcp_sig : String ::new ( ) , mcp_errors : Default ::default ( ) , mcp_busy : Default ::default ( ) , mcp_tried : None , new_mcp : Default ::default ( ) , sub : 0 , adding : false , skill_src : String ::new ( ) , skill_page : Page ::List , skill_q : String ::new ( ) , skill_confirm : None , skill_busy : Default ::default ( ) , skill_reload : Default ::default ( ) , skill_note : Default ::default ( ) , skill_note_list : false , new_mcp_hint : String ::new ( ) , new_mcp_login : Default ::default ( ) , mcp_page : Page ::List , mcp_confirm : None , tool_q : String ::new ( ) , mcp_name : None , name_field : None , mcp_renaming : None , mcp_note : Default ::default ( ) , page_key : None , reg_q : String ::new ( ) , reg_busy : Default ::default ( ) , reg_found : Default ::default ( ) }
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
}
}
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings
Permissions and reach
- a file leaving a computer passes the same questions as reading it;
"looking" shell commands that do more than look ask first
- a symlink out of the work/sealed folder counts as outside it
(real paths, not just lexical ones); the search walk skips links
- web_fetch and skill_install read the public web only: localhost, the
LAN and cloud metadata are refused, at every redirect
- preview shows a file without running it; browser_upload may ask
- vault: logins no longer match across shared suffixes (pages.dev,
com.tw, ...); registrable_domain knows public suffixes
- axwrite: found elements are retained (use-after-free)
Relay
- replacing or turning off 2FA needs the current code (rate-limited);
new recovery codes only count once enrollment is verified
- a removed computer loses its socket and its `call` access
- a site name taken by another account answers 409
- RELAY_TRUST_PROXY: the login lock counts the caller's address, not
the proxy's (compose files and README)
- httpd: half a body is not a request
Desktop
- sign-in, join and restore work with 2FA on (code field; --serve reads
ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code)
- Windows: text was typed twice; modifiers are held through click, drag
and scroll; horizontal scroll; screen control is no longer refused
- a recording that hits the limit is transcribed, not thrown away
- bot's computer: a new home volume restores the snapshot; a snapshot
is read through before the home is wiped; a failed volume removal
stops reset/restore
- events of a stopped turn no longer land in the next one; each channel
message gets a turn of its own
- saving a bot's settings keeps what it got meanwhile (three-way merge);
a save file that cannot be read is kept
- pages in Big5/GBK/Shift_JIS are read in their own encoding
(encoding_rs); osascript output past 64 KB no longer stalls
- pick_tab keeps a job's own non-http tab; pictures larger than the
texture limit are fitted; the auto-update time field takes typing
- skills live in <data>/skills; memories are unnumbered in the prompt;
the phone may skillify and skill_install
CI
- the test step fails when the tests fail (it piped into tail)
Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged.
Not run: Windows on a real machine (win.rs type-checked alone), the
Docker paths of the bot's computer, the live accessibility writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
/// The waiting messages whose turn can start now: the oldest one of each bot that is free, in
/// the order they came. The rest stay, in order.
fn ready_messages ( waiting : & mut VecDeque < Incoming > , busy : impl Fn ( u64 ) -> bool ) -> Vec < Incoming > {
let ( mut ready , mut later ) : ( Vec < Incoming > , VecDeque < Incoming > ) = ( vec! [ ] , VecDeque ::new ( ) ) ;
while let Some ( m ) = waiting . pop_front ( ) {
if busy ( m . bot_id ) | | ready . iter ( ) . chain ( later . iter ( ) ) . any ( | w | w . bot_id = = m . bot_id ) {
later . push_back ( m ) ;
} else {
ready . push ( m ) ;
}
}
* waiting = later ;
ready
}
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
impl App {
pub ( super ) fn channels_restart ( & mut self , ctx : & egui ::Context ) {
if self . demo {
return ;
}
let c = ctx . clone ( ) ;
channels ::restart ( self . state . channels . clone ( ) , self . ch . tx . clone ( ) , Arc ::new ( move | | c . request_repaint ( ) ) ) ;
self . ch . started = true ;
}
/// Event-triggered routines: (re)start their watchers when they change, and run them when they fire.
fn triggers_poll ( & mut self , ctx : & egui ::Context ) {
let watches : Vec < crate ::triggers ::Watch > = self
. state
. bots
. iter ( )
. flat_map ( | b | b . routines . iter ( ) . filter ( | r | ! r . paused ) . filter_map ( move | r | r . trigger . clone ( ) . map ( | t | crate ::triggers ::Watch { bot_id : b . id , routine_id : r . id , trigger : t } ) ) )
. collect ( ) ;
let sig = watches . iter ( ) . map ( | w | format! ( " {} : {} : {:?} " , w . bot_id , w . routine_id , w . trigger ) ) . collect ::< Vec < _ > > ( ) . join ( " | " ) ;
if sig ! = self . ch . trig_sig {
self . ch . trig_sig = sig ;
let slack = self . state . channels . iter ( ) . find ( | c | c . kind = = Kind ::Slack & & ! c . token . trim ( ) . is_empty ( ) ) . map ( | c | c . token . clone ( ) ) . unwrap_or_default ( ) ;
let c = ctx . clone ( ) ;
crate ::triggers ::restart ( watches , slack , self . ch . trig_tx . clone ( ) , Arc ::new ( move | | c . request_repaint ( ) ) ) ;
}
while let Ok ( f ) = self . ch . trig_rx . try_recv ( ) {
let Some ( b ) = self . state . bot_mut ( f . bot_id ) else { continue } ;
let Some ( r ) = b . routines . iter_mut ( ) . find ( | r | r . id = = f . routine_id ) else { continue } ;
if r . paused {
continue ;
}
r . last_run = Some ( crate ::routines ::now ( ) ) ;
let text = format! ( " [觸發]例行任務「 {} 」被觸發: {} \n 要做的事: {} " , r . title , f . what , r . prompt ) ;
self . wake ( ctx , f . bot_id , Message { wake : true , .. Message ::user ( & text ) } ) ;
self . dirty = true ;
}
}
/// New messages from Slack / Discord / Telegram wake their bot.
pub ( super ) fn channels_poll ( & mut self , ctx : & egui ::Context ) {
if ! self . ch . started {
self . channels_restart ( ctx ) ;
}
self . triggers_poll ( ctx ) ;
self . mcp_poll ( ctx ) ;
2026-11-17 09:23:10 +00:00
// ChatGPT 方案: a sign-in that finished (the first one with the plan gets the welcome).
for r in crate ::chatgpt ::take_finished ( ) {
2026-11-17 09:46:09 +00:00
// (Signed in: this account's models, as the plan lists them.)
if r . is_ok ( ) & & ! self . mir . on {
self . fetch_models ( crate ::providers ::ProviderKind ::ChatGpt ) ;
}
2026-11-17 09:23:10 +00:00
self . notice = Some ( match r {
Ok ( who ) = > crate ::chatgpt ::welcome_once ( ) . unwrap_or_else ( | | format! ( " 已用 ChatGPT( {who} )登入。 " ) ) ,
Err ( e ) = > format! ( " ChatGPT 沒有登入成功: {e} " ) ,
} ) ;
}
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
// Microsoft rotates refresh tokens: keep the newest.
let rotated : Vec < ( u64 , String ) > = crate ::teams ::rotated ( ) . lock ( ) . unwrap ( ) . iter ( ) . map ( | ( k , v ) | ( * k , v . clone ( ) ) ) . collect ( ) ;
for ( id , tok ) in rotated {
if let Some ( c ) = self . state . channels . iter_mut ( ) . find ( | c | c . id = = id & & c . token ! = tok ) {
c . token = tok ;
self . dirty = true ;
}
}
while let Ok ( m ) = self . ch . rx . try_recv ( ) {
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings
Permissions and reach
- a file leaving a computer passes the same questions as reading it;
"looking" shell commands that do more than look ask first
- a symlink out of the work/sealed folder counts as outside it
(real paths, not just lexical ones); the search walk skips links
- web_fetch and skill_install read the public web only: localhost, the
LAN and cloud metadata are refused, at every redirect
- preview shows a file without running it; browser_upload may ask
- vault: logins no longer match across shared suffixes (pages.dev,
com.tw, ...); registrable_domain knows public suffixes
- axwrite: found elements are retained (use-after-free)
Relay
- replacing or turning off 2FA needs the current code (rate-limited);
new recovery codes only count once enrollment is verified
- a removed computer loses its socket and its `call` access
- a site name taken by another account answers 409
- RELAY_TRUST_PROXY: the login lock counts the caller's address, not
the proxy's (compose files and README)
- httpd: half a body is not a request
Desktop
- sign-in, join and restore work with 2FA on (code field; --serve reads
ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code)
- Windows: text was typed twice; modifiers are held through click, drag
and scroll; horizontal scroll; screen control is no longer refused
- a recording that hits the limit is transcribed, not thrown away
- bot's computer: a new home volume restores the snapshot; a snapshot
is read through before the home is wiped; a failed volume removal
stops reset/restore
- events of a stopped turn no longer land in the next one; each channel
message gets a turn of its own
- saving a bot's settings keeps what it got meanwhile (three-way merge);
a save file that cannot be read is kept
- pages in Big5/GBK/Shift_JIS are read in their own encoding
(encoding_rs); osascript output past 64 KB no longer stalls
- pick_tab keeps a job's own non-http tab; pictures larger than the
texture limit are fitted; the auto-update time field takes typing
- skills live in <data>/skills; memories are unnumbered in the prompt;
the phone may skillify and skill_install
CI
- the test step fails when the tests fail (it piped into tail)
Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged.
Not run: Windows on a real machine (win.rs type-checked alone), the
Docker paths of the bot's computer, the live accessibility writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
self . ch . waiting . push_back ( m ) ;
}
self . ch . waiting . retain ( | m | self . state . bot ( m . bot_id ) . is_some ( ) ) ;
// A message from a channel gets a turn of its own, when its bot is free. It used to be
// dropped into whatever turn was running, and that turn's answer (to the person's own
// question at the desk, say) was what went out to the channel.
let mut waiting = std ::mem ::take ( & mut self . ch . waiting ) ;
let ready = ready_messages ( & mut waiting , | id | {
self . streams . contains_key ( & id )
| | self . ch . replies . contains_key ( & id )
| | self . group_next . contains ( & id )
| | self . pending_turns . iter ( ) . any ( | ( b , _ ) | * b = = id )
2026-11-13 13:34:03 +00:00
| | self . waiting_wakes . iter ( ) . any ( | ( b , _ ) | * b = = id )
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings
Permissions and reach
- a file leaving a computer passes the same questions as reading it;
"looking" shell commands that do more than look ask first
- a symlink out of the work/sealed folder counts as outside it
(real paths, not just lexical ones); the search walk skips links
- web_fetch and skill_install read the public web only: localhost, the
LAN and cloud metadata are refused, at every redirect
- preview shows a file without running it; browser_upload may ask
- vault: logins no longer match across shared suffixes (pages.dev,
com.tw, ...); registrable_domain knows public suffixes
- axwrite: found elements are retained (use-after-free)
Relay
- replacing or turning off 2FA needs the current code (rate-limited);
new recovery codes only count once enrollment is verified
- a removed computer loses its socket and its `call` access
- a site name taken by another account answers 409
- RELAY_TRUST_PROXY: the login lock counts the caller's address, not
the proxy's (compose files and README)
- httpd: half a body is not a request
Desktop
- sign-in, join and restore work with 2FA on (code field; --serve reads
ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code)
- Windows: text was typed twice; modifiers are held through click, drag
and scroll; horizontal scroll; screen control is no longer refused
- a recording that hits the limit is transcribed, not thrown away
- bot's computer: a new home volume restores the snapshot; a snapshot
is read through before the home is wiped; a failed volume removal
stops reset/restore
- events of a stopped turn no longer land in the next one; each channel
message gets a turn of its own
- saving a bot's settings keeps what it got meanwhile (three-way merge);
a save file that cannot be read is kept
- pages in Big5/GBK/Shift_JIS are read in their own encoding
(encoding_rs); osascript output past 64 KB no longer stalls
- pick_tab keeps a job's own non-http tab; pictures larger than the
texture limit are fitted; the auto-update time field takes typing
- skills live in <data>/skills; memories are unnumbered in the prompt;
the phone may skillify and skill_install
CI
- the test step fails when the tests fail (it piped into tail)
Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged.
Not run: Windows on a real machine (win.rs type-checked alone), the
Docker paths of the bot's computer, the live accessibility writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
| | self . group_queue . get ( & id ) . is_some_and ( | q | ! q . is_empty ( ) )
} ) ;
self . ch . waiting = waiting ;
for m in ready {
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 text = format! ( " [訊息管道] {} 「 {} 」的 {} : {} " , m . reply . kind . label ( ) , m . reply . channel_name , m . from , m . text ) ;
self . ch . replies . entry ( m . bot_id ) . or_default ( ) . push ( m . reply . clone ( ) ) ;
安全、修正: 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
self . wake ( ctx , m . bot_id , Message { wake : true , untrusted_sender : true , memories_set : true , .. Message ::user ( & text ) } ) ;
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings
Permissions and reach
- a file leaving a computer passes the same questions as reading it;
"looking" shell commands that do more than look ask first
- a symlink out of the work/sealed folder counts as outside it
(real paths, not just lexical ones); the search walk skips links
- web_fetch and skill_install read the public web only: localhost, the
LAN and cloud metadata are refused, at every redirect
- preview shows a file without running it; browser_upload may ask
- vault: logins no longer match across shared suffixes (pages.dev,
com.tw, ...); registrable_domain knows public suffixes
- axwrite: found elements are retained (use-after-free)
Relay
- replacing or turning off 2FA needs the current code (rate-limited);
new recovery codes only count once enrollment is verified
- a removed computer loses its socket and its `call` access
- a site name taken by another account answers 409
- RELAY_TRUST_PROXY: the login lock counts the caller's address, not
the proxy's (compose files and README)
- httpd: half a body is not a request
Desktop
- sign-in, join and restore work with 2FA on (code field; --serve reads
ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code)
- Windows: text was typed twice; modifiers are held through click, drag
and scroll; horizontal scroll; screen control is no longer refused
- a recording that hits the limit is transcribed, not thrown away
- bot's computer: a new home volume restores the snapshot; a snapshot
is read through before the home is wiped; a failed volume removal
stops reset/restore
- events of a stopped turn no longer land in the next one; each channel
message gets a turn of its own
- saving a bot's settings keeps what it got meanwhile (three-way merge);
a save file that cannot be read is kept
- pages in Big5/GBK/Shift_JIS are read in their own encoding
(encoding_rs); osascript output past 64 KB no longer stalls
- pick_tab keeps a job's own non-http tab; pictures larger than the
texture limit are fitted; the auto-update time field takes typing
- skills live in <data>/skills; memories are unnumbered in the prompt;
the phone may skillify and skill_install
CI
- the test step fails when the tests fail (it piped into tail)
Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged.
Not run: Windows on a real machine (win.rs type-checked alone), the
Docker paths of the bot's computer, the live accessibility writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
// No turn started (a group with nobody in it): nothing will answer, so no later
// turn's answer may go there either. (A screen's turns run on its brain.)
if ! self . streams . contains_key ( & m . bot_id ) & & ! self . mir . on {
self . ch . replies . remove ( & m . bot_id ) ;
}
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
self . dirty = true ;
}
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings
Permissions and reach
- a file leaving a computer passes the same questions as reading it;
"looking" shell commands that do more than look ask first
- a symlink out of the work/sealed folder counts as outside it
(real paths, not just lexical ones); the search walk skips links
- web_fetch and skill_install read the public web only: localhost, the
LAN and cloud metadata are refused, at every redirect
- preview shows a file without running it; browser_upload may ask
- vault: logins no longer match across shared suffixes (pages.dev,
com.tw, ...); registrable_domain knows public suffixes
- axwrite: found elements are retained (use-after-free)
Relay
- replacing or turning off 2FA needs the current code (rate-limited);
new recovery codes only count once enrollment is verified
- a removed computer loses its socket and its `call` access
- a site name taken by another account answers 409
- RELAY_TRUST_PROXY: the login lock counts the caller's address, not
the proxy's (compose files and README)
- httpd: half a body is not a request
Desktop
- sign-in, join and restore work with 2FA on (code field; --serve reads
ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code)
- Windows: text was typed twice; modifiers are held through click, drag
and scroll; horizontal scroll; screen control is no longer refused
- a recording that hits the limit is transcribed, not thrown away
- bot's computer: a new home volume restores the snapshot; a snapshot
is read through before the home is wiped; a failed volume removal
stops reset/restore
- events of a stopped turn no longer land in the next one; each channel
message gets a turn of its own
- saving a bot's settings keeps what it got meanwhile (three-way merge);
a save file that cannot be read is kept
- pages in Big5/GBK/Shift_JIS are read in their own encoding
(encoding_rs); osascript output past 64 KB no longer stalls
- pick_tab keeps a job's own non-http tab; pictures larger than the
texture limit are fitted; the auto-update time field takes typing
- skills live in <data>/skills; memories are unnumbered in the prompt;
the phone may skillify and skill_install
CI
- the test step fails when the tests fail (it piped into tail)
Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged.
Not run: Windows on a real machine (win.rs type-checked alone), the
Docker paths of the bot's computer, the live accessibility writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
if ! self . ch . waiting . is_empty ( ) {
ctx . request_repaint_after ( std ::time ::Duration ::from_millis ( 500 ) ) ;
}
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 turn ended: send its answer back where the message came from.
pub ( super ) fn channels_settled ( & mut self , bot_id : u64 , outcome : TurnOutcome ) {
let Some ( targets ) = self . ch . replies . remove ( & bot_id ) else { return } ;
let answer = match outcome {
TurnOutcome ::Success = > self . state . bot ( bot_id ) . and_then ( | b | b . messages . iter ( ) . rev ( ) . find ( | m | m . role = = Role ::Assistant & & ! m . text . trim ( ) . is_empty ( ) & & ! m . error ) ) . map ( | m | m . text . clone ( ) ) ,
TurnOutcome ::Error = > Some ( " 抱歉,這次沒有完成,請再試一次。 " . to_string ( ) ) ,
TurnOutcome ::Cancelled = > None ,
} ;
let Some ( answer ) = answer else { return } ;
let note = self . ch . note . clone ( ) ;
std ::thread ::spawn ( move | | {
for t in targets {
if let Err ( e ) = channels ::reply ( & t , & answer ) {
* note . lock ( ) . unwrap ( ) = format! ( " 回覆到 {} 「 {} 」失敗: {e} " , t . kind . label ( ) , t . channel_name ) ;
}
}
} ) ;
}
pub ( super ) fn channels_page ( & mut self , ui : & mut egui ::Ui , ctx : & egui ::Context ) {
let p = self . pal ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
// 已連接: what there is, each on a line — what it is, who answers, how it stands, on or off.
ui . horizontal ( | ui | {
ui . spacing_mut ( ) . item_spacing . x = 4.0 ;
ui . label ( RichText ::new ( t ( " 已連接 " ) ) . size ( FONT_XS ) . family ( crate ::bold ( ) ) . color ( p . text2 ) ) ;
help_mark ( ui , " 讓 Bot 在 Slack、Discord、Telegram、Microsoft Teams、Mac 的「訊息」或「郵件」回覆別人。收到訊息時 Bot 會像收到你的訊息一樣開始工作, 做完後把回答傳回去( Slack 回在討論串, Discord 和 Telegram 引用原訊息) 。AnyBot 開著時才會收訊息。 " , p ) ;
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
} ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
ui . add_space ( 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 mut remove = None ;
let mut changed = false ;
let statuses = channels ::statuses ( ) . lock ( ) . unwrap ( ) . clone ( ) ;
let bots : Vec < ( u64 , String ) > = self . state . bots . iter ( ) . map ( | b | ( b . id , b . name . clone ( ) ) ) . collect ( ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
rows_card ( ui , p , | ui | {
if self . state . channels . is_empty ( ) {
ui . add_space ( 16.0 ) ;
ui . label ( RichText ::new ( t ( " 還沒有連接任何管道。從下面挑一個開始。 " ) ) . size ( FONT_BASE ) . color ( p . text2 ) ) ;
ui . add_space ( 16.0 ) ;
}
for ( i , c ) in self . state . channels . iter_mut ( ) . enumerate ( ) {
let top = ui . cursor ( ) . top ( ) ;
if i > 0 {
ui . painter ( ) . hline ( ui . max_rect ( ) . x_range ( ) , top , Stroke ::new ( 1.0 , p . border ) ) ;
}
let ( rect , _ ) = ui . allocate_exact_size ( vec2 ( ui . available_width ( ) , 64.0 ) , egui ::Sense ::hover ( ) ) ;
kind_tile ( ui , egui ::Rect ::from_min_size ( egui ::pos2 ( rect . left ( ) , rect . center ( ) . y - 18.0 ) , vec2 ( 36.0 , 36.0 ) ) , c . kind , p ) ;
// From the right: ⋯, the switch, how it stands.
let mut right = ui . new_child ( egui ::UiBuilder ::new ( ) . max_rect ( rect ) . layout ( Layout ::right_to_left ( Align ::Center ) ) ) ;
right . spacing_mut ( ) . item_spacing . x = 10.0 ;
let more = crate ::icons ::button ( & mut right , crate ::icons ::Icon ::More , 30.0 , p . text2 , p . hover ) . on_hover_text ( t ( " 更多 " ) ) ;
egui ::Popup ::menu ( & more ) . show ( | ui | {
ui . set_min_width ( menu_ui ::MENU_W ) ;
if menu_ui ::danger ( ui , p , crate ::icons ::Icon ::Trash , " 移除這個管道 " ) . clicked ( ) {
remove = Some ( i ) ;
ui . close ( ) ;
}
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
} ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
if right . add ( computers_ui ::toggle ( & mut c . enabled ) ) . changed ( ) {
changed = true ;
}
let ( col , text ) = match statuses . get ( & c . id ) {
_ if ! c . enabled = > ( p . text3 , t ( " 已暫停 " ) ) ,
2026-11-16 14:07:07 +00:00
Some ( s ) if s . ok = > ( p . up , if s . received > 0 { format! ( " {} (收到 {} 則) " , s . note , s . received ) } else { s . note . clone ( ) } ) ,
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
Some ( s ) = > ( p . danger , s . note . clone ( ) ) ,
None = > ( p . text3 , t ( " 連線中… " ) ) ,
} ;
let room = ( right . available_width ( ) - 36.0 - 150.0 ) . clamp ( 60.0 , 200.0 ) ;
2026-11-16 13:51:30 +00:00
right . label ( RichText ::new ( sidebar_ui ::shorten_width ( & right , & text , room , 12.0 ) ) . size ( FONT_XS ) . color ( if col = = p . text3 { p . text2 } else { col } ) ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
let ( dot , _ ) = right . allocate_exact_size ( vec2 ( 8.0 , 8.0 ) , egui ::Sense ::hover ( ) ) ;
right . painter ( ) . circle_filled ( dot . center ( ) , 4.0 , col ) ;
// The words, in the room that is left.
let words = egui ::Rect ::from_min_max ( egui ::pos2 ( rect . left ( ) + 48.0 , rect . top ( ) ) , egui ::pos2 ( ( right . min_rect ( ) . left ( ) - 10.0 ) . max ( rect . left ( ) + 120.0 ) , rect . bottom ( ) ) ) ;
let mut left = ui . new_child ( egui ::UiBuilder ::new ( ) . max_rect ( words ) . layout ( Layout ::top_down ( Align ::Min ) ) ) ;
left . spacing_mut ( ) . item_spacing . y = 1.0 ;
left . add_space ( 12.0 ) ;
2026-11-16 13:51:30 +00:00
left . add ( egui ::Label ::new ( RichText ::new ( format! ( " {} · {} " , c . name , c . kind . label ( ) ) ) . size ( FONT_BASE ) . color ( p . text ) ) . truncate ( ) ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
let bot = bots . iter ( ) . find ( | b | b . 0 = = c . bot_id ) . map ( | b | b . 1. clone ( ) ) . unwrap_or_else ( | | t ( " ( Bot 已刪除)" ) ) ;
let whom = if c . target . is_empty ( ) { t ( " {bot} 回覆 " ) . replace ( " {bot} " , & bot ) } else { format! ( " {} · {} " , t ( " {bot} 回覆 " ) . replace ( " {bot} " , & bot ) , c . target ) } ;
2026-11-16 13:51:30 +00:00
left . add ( egui ::Label ::new ( RichText ::new ( whom ) . size ( FONT_SM ) . color ( p . text2 ) ) . truncate ( ) ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
}
} ) ;
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 let Some ( i ) = remove {
self . state . channels . remove ( i ) ;
changed = true ;
}
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
// 新增管道: the kinds as tiles; a press opens that kind's form below.
ui . add_space ( 14.0 ) ;
ui . label ( RichText ::new ( t ( " 新增管道 " ) ) . size ( FONT_XS ) . family ( crate ::bold ( ) ) . color ( p . text2 ) ) ;
ui . add_space ( 4.0 ) ;
let kinds = [ Kind ::Telegram , Kind ::Slack , Kind ::Discord , Kind ::Teams , Kind ::IMessage , Kind ::Email , Kind ::Sms , Kind ::X ] ;
let cols = if ui . available_width ( ) < 470.0 { 2 } else { 4 } ;
let ( gap , w ) = ( 10.0 , ( ui . available_width ( ) - 10.0 * ( cols as f32 - 1.0 ) ) / cols as f32 ) ;
for row in kinds . chunks ( cols ) {
ui . horizontal ( | ui | {
ui . spacing_mut ( ) . item_spacing . x = gap ;
for k in row {
let ( rect , r ) = ui . allocate_exact_size ( vec2 ( w , 56.0 ) , egui ::Sense ::click ( ) ) ;
let on = self . ch . adding & & self . ch . new_kind = = * k ;
2026-11-16 13:51:30 +00:00
ui . painter ( ) . rect_filled ( rect , R_L , if r . hovered ( ) { p . hover } else { p . elevated } ) ;
ui . painter ( ) . rect_stroke ( rect , R_L , if on { Stroke ::new ( 2.0 , p . text ) } else { Stroke ::new ( 1.0 , p . border ) } , egui ::StrokeKind ::Inside ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
kind_tile ( ui , egui ::Rect ::from_min_size ( egui ::pos2 ( rect . left ( ) + 12.0 , rect . center ( ) . y - 16.0 ) , vec2 ( 32.0 , 32.0 ) ) , * k , p ) ;
let name = sidebar_ui ::shorten_width ( ui , k . label ( ) , w - 62.0 , FONT_BASE ) ;
ui . painter ( ) . text ( egui ::pos2 ( rect . left ( ) + 54.0 , rect . center ( ) . y ) , egui ::Align2 ::LEFT_CENTER , name , egui ::FontId ::proportional ( FONT_BASE ) , p . text ) ;
if r . on_hover_cursor ( egui ::CursorIcon ::PointingHand ) . clicked ( ) {
if self . ch . new_kind ! = * k {
self . ch . new_token . clear ( ) ;
self . ch . new_target . clear ( ) ;
}
self . ch . adding = ! on ;
self . ch . new_kind = * k ;
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
}
}
} ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
ui . add_space ( gap - 6.0 ) ;
}
if ! self . ch . adding {
hint ( ui , " 點一個,才打開它的表單(名稱、回覆的 Bot、Token) 。 " , p ) ;
}
let mut added = false ;
if self . ch . adding {
ui . add_space ( 6.0 ) ;
setting_card ( ui , p , | ui | {
ui . horizontal ( | ui | {
2026-11-16 13:51:30 +00:00
ui . label ( RichText ::new ( format! ( " {} {} " , t ( " 新增 " ) , self . ch . new_kind . label ( ) ) ) . size ( FONT_BASE ) . family ( crate ::bold ( ) ) . color ( p . text ) ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
ui . with_layout ( Layout ::right_to_left ( Align ::Center ) , | ui | {
if small_button ( ui , " 取消 " , p ) . clicked ( ) {
added = true ;
}
} ) ;
} ) ;
ui . add_space ( 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 k = self . ch . new_kind ;
if self . ch . new_bot = = 0 | | ! bots . iter ( ) . any ( | b | b . 0 = = self . ch . new_bot ) {
self . ch . new_bot = self . state . selected ;
}
form_row ( ui , " 名稱 " , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( & mut self . ch . new_name ) . hint_text ( t ( " 例如 客服群 " ) ) . desired_width ( ui . available_width ( ) ) ) ;
} ) ;
form_row ( ui , " 回覆的 Bot " , p , | ui | {
let cur = bots . iter ( ) . find ( | b | b . 0 = = self . ch . new_bot ) . map ( | b | b . 1. clone ( ) ) . unwrap_or_default ( ) ;
egui ::ComboBox ::from_id_salt ( " channel-bot " ) . selected_text ( cur ) . show_ui ( ui , | ui | {
for ( id , name ) in & bots {
ui . selectable_value ( & mut self . ch . new_bot , * id , name ) ;
}
} ) ;
} ) ;
if k = = Kind ::Teams {
form_row ( ui , " 應用程式 ID " , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( & mut self . ch . new_client ) . hint_text ( t ( " Entra 應用程式( 用戶端) ID " ) ) . desired_width ( ui . available_width ( ) ) . font ( egui ::TextStyle ::Monospace ) ) ;
} ) ;
form_row ( ui , " 租用戶 " , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( & mut self . ch . new_tenant ) . hint_text ( t ( " 留空 = 公司或學校帳號 " ) ) . desired_width ( ui . available_width ( ) ) . font ( egui ::TextStyle ::Monospace ) ) ;
} ) ;
hint ( ui , k . token_hint ( ) , p ) ;
// A finished sign-in fills the token.
if let Some ( tok ) = self . ch . ms_login . lock ( ) . unwrap ( ) . 1. take ( ) {
self . ch . new_token = tok ;
}
ui . horizontal ( | ui | {
let signed = ! self . ch . new_token . is_empty ( ) ;
if ui . add_enabled ( ! self . ch . new_client . trim ( ) . is_empty ( ) , secondary_button ( if signed { " 重新登入 Microsoft " } else { " 登入 Microsoft " } ) ) . clicked ( ) {
let ( client , tenant , slot , c ) = ( self . ch . new_client . clone ( ) , self . ch . new_tenant . clone ( ) , self . ch . ms_login . clone ( ) , ctx . clone ( ) ) ;
slot . lock ( ) . unwrap ( ) . 0 = " 正在取得登入代碼… " . into ( ) ;
std ::thread ::spawn ( move | | {
match crate ::teams ::device_code ( & client , & tenant ) {
Ok ( ( code , url , device , interval ) ) = > {
slot . lock ( ) . unwrap ( ) . 0 = format! ( " 在打開的網頁輸入代碼: {code} ( {url} ) " ) ;
crate ::preview ::open_with_system ( & url ) ;
c . request_repaint ( ) ;
let r = crate ::teams ::wait_for_login ( & client , & tenant , & device , interval , std ::time ::Duration ::from_secs ( 900 ) ) ;
let mut s = slot . lock ( ) . unwrap ( ) ;
match r {
Ok ( t ) = > {
s . 0 = " 已登入 Microsoft。 " . into ( ) ;
s . 1 = Some ( t ) ;
}
Err ( e ) = > s . 0 = e ,
}
}
Err ( e ) = > slot . lock ( ) . unwrap ( ) . 0 = format! ( " 拿不到登入代碼: {e} " ) ,
}
c . request_repaint ( ) ;
} ) ;
}
let msg = self . ch . ms_login . lock ( ) . unwrap ( ) . 0. clone ( ) ;
if ! msg . is_empty ( ) {
2026-11-16 14:07:07 +00:00
ui . label ( RichText ::new ( msg ) . size ( FONT_SM ) . color ( p . text2 ) ) ;
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
}
} ) ;
} else if matches! ( k , Kind ::IMessage | Kind ::Email ) {
hint ( ui , k . token_hint ( ) , p ) ;
self . ch . new_token = " local " . into ( ) ;
} else {
form_row ( ui , " Token " , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( & mut self . ch . new_token ) . password ( true ) . hint_text ( t ( " 貼上 Bot Token " ) ) . desired_width ( ui . available_width ( ) ) ) ;
} ) ;
hint ( ui , k . token_hint ( ) , p ) ;
}
form_row ( ui , match k { Kind ::Telegram = > " 聊天 ID " , Kind ::Teams = > " 聊天或頻道 " , Kind ::IMessage = > " 對象 " , Kind ::Email = > " 信箱 " , Kind ::Sms = > " 你的號碼 " , Kind ::X = > " (不用填) " , _ = > " 頻道 ID " } , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( & mut self . ch . new_target ) . hint_text ( k . target_hint ( ) ) . desired_width ( ui . available_width ( ) ) . font ( egui ::TextStyle ::Monospace ) ) ;
} ) ;
let needs_target = ! matches! ( k , Kind ::Telegram | Kind ::IMessage | Kind ::Email | Kind ::X ) ;
let ok = ! self . ch . new_token . trim ( ) . is_empty ( ) & & ( ! needs_target | | ! self . ch . new_target . trim ( ) . is_empty ( ) ) ;
ui . horizontal ( | ui | {
if k ! = Kind ::Teams & & ui . add_enabled ( ! self . ch . new_token . trim ( ) . is_empty ( ) , secondary_button ( if matches! ( k , Kind ::IMessage | Kind ::Email ) { " 測試 " } else { " 測試 Token " } ) ) . clicked ( ) {
let ( kind , token , note ) = ( k , self . ch . new_token . clone ( ) , self . ch . note . clone ( ) ) ;
* note . lock ( ) . unwrap ( ) = " 測試中… " . into ( ) ;
let c = ctx . clone ( ) ;
std ::thread ::spawn ( move | | {
* note . lock ( ) . unwrap ( ) = channels ::test ( kind , & token ) . unwrap_or_else ( | e | e ) ;
c . request_repaint ( ) ;
} ) ;
}
if ui . add_enabled ( ok , primary_button ( " 新增 " , p ) ) . clicked ( ) {
let id = self . state . next_channel_id . max ( 1 ) ;
self . state . next_channel_id = id + 1 ;
let name = if self . ch . new_name . trim ( ) . is_empty ( ) { k . label ( ) . to_string ( ) } else { self . ch . new_name . trim ( ) . to_string ( ) } ;
self . state . channels . push ( Channel { id , kind : k , name , bot_id : self . ch . new_bot , token : self . ch . new_token . trim ( ) . into ( ) , target : self . ch . new_target . trim ( ) . into ( ) , enabled : true , client_id : self . ch . new_client . trim ( ) . into ( ) , tenant : self . ch . new_tenant . trim ( ) . into ( ) } ) ;
self . ch . new_client . clear ( ) ;
self . ch . new_tenant . clear ( ) ;
self . ch . new_name . clear ( ) ;
self . ch . new_token . clear ( ) ;
self . ch . new_target . clear ( ) ;
changed = true ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
added = true ;
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 note = self . ch . note . lock ( ) . unwrap ( ) . clone ( ) ;
if ! note . is_empty ( ) {
2026-11-16 14:07:07 +00:00
ui . label ( RichText ::new ( note ) . size ( FONT_SM ) . color ( p . text2 ) ) ;
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
}
} ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
}
if added {
self . ch . adding = false ;
}
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 changed {
self . dirty = true ;
self . channels_restart ( ctx ) ;
}
}
}
// ---------- 連接器 (MCP) ----------
impl App {
2026-11-12 07:04:05 +00:00
/// Connect the configured MCP servers when they change (in the background), and re-sync
2026-11-12 07:55:35 +00:00
/// every half minute: sync keeps what is alive and connects again what failed or died, so a
/// server that wasn't up yet, crashed, or lost its machine comes back on its own.
2026-11-17 02:55:37 +00:00
pub ( super ) fn mcp_poll ( & mut self , ctx : & egui ::Context ) {
2026-11-17 05:08:45 +00:00
// 連接器登入 that finished: connect those again now, with their tokens, and say so.
let names : Vec < String > = self . state . mcp_servers . iter ( ) . map ( | s | s . name . clone ( ) ) . collect ( ) ;
for ( name , r ) in crate ::mcp_oauth ::take_finished ( | n | names . iter ( ) . any ( | x | x = = n ) ) {
match r {
Ok ( ( ) ) = > {
self . mcp_reconnect ( & name ) ;
self . notice = Some ( format! ( " 已登入連接器「 {name} 」,正在連線。 " ) ) ;
}
Err ( e ) = > self . notice = Some ( format! ( " 連接器「 {name} 」沒有登入成功: {e} " ) ) ,
}
}
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
if self . ch . mcp_busy . load ( Ordering ::SeqCst ) {
return ;
}
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 sig = serde_json ::to_string ( & self . state . mcp_servers ) . unwrap_or_default ( ) ;
2026-11-12 07:55:35 +00:00
if sig = = self . ch . mcp_sig & & self . ch . mcp_tried . is_some_and ( | t | t . elapsed ( ) < MCP_RETRY ) {
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
return ;
}
self . ch . mcp_sig = sig ;
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
self . ch . mcp_tried = Some ( Instant ::now ( ) ) ;
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 servers = self . state . mcp_servers . clone ( ) ;
let ( errs , busy , c ) = ( self . ch . mcp_errors . clone ( ) , self . ch . mcp_busy . clone ( ) , ctx . clone ( ) ) ;
busy . store ( true , Ordering ::SeqCst ) ;
std ::thread ::spawn ( move | | {
* errs . lock ( ) . unwrap ( ) = crate ::mcp ::sync ( & servers ) ;
busy . store ( false , Ordering ::SeqCst ) ;
c . request_repaint ( ) ;
} ) ;
}
2026-11-17 02:55:37 +00:00
/// 管理連接器 (a bot asked; the person already said yes to a change): the brain's own list
/// changes, as 新增連接器 / 設定 / 移除 would, and the answer waits until the connector has
/// connected or said why not (at most CONNECT_WAIT; a first `npx` may download for a while).
pub ( super ) fn manage_connectors ( & mut self , ctx : & egui ::Context , call : crate ::providers ::AppCall ) {
let change = match crate ::mcp ::parse_change ( & call . args , & self . state . mcp_servers ) {
Ok ( c ) = > c ,
Err ( e ) = > {
let _ = call . reply . send ( ( e , false ) ) ;
return ;
}
} ;
2026-11-17 05:08:45 +00:00
// 連接器登入: over the network, on a thread; the connection follows when it is done (mcp_poll).
if let crate ::mcp ::Change ::Login { name , url , callback } = change {
std ::thread ::spawn ( move | | {
let r = match callback {
Some ( cb ) = > crate ::mcp_oauth ::finish_from_url ( & cb ) . map ( | n | format! ( " 已登入「 {n} 」,正在連線:稍後用 action=list 看它連上了沒有。 " ) ) ,
None = > crate ::mcp_oauth ::start ( & name , & url ) . map ( | u | {
format! ( " 請使用者打開這個網址登入「 {name} 」(用 open_for_person 開在他正在用的電腦上,或把網址給他): \n {u} \n 登入好了 AnyBot 會自己接上(最多等 10 分鐘),不用再做什麼。如果登入後那一頁打不開(他的瀏覽器在別台電腦),請他把那一頁的網址整個複製給你,再用 manage_connectors( action=login、name=「 {name} 」、callback=那個網址)。 " )
} ) ,
} ;
let _ = call . reply . send ( match r {
Ok ( t ) = > ( t , true ) ,
Err ( e ) = > ( format! ( " 沒辦法登入「 {name} 」: {e} " ) , false ) ,
} ) ;
} ) ;
return ;
}
2026-11-17 02:55:37 +00:00
if change = = crate ::mcp ::Change ::List {
let text = crate ::mcp ::list_text ( & self . state . mcp_servers , & crate ::mcp ::status ( ) , & self . ch . mcp_errors . lock ( ) . unwrap ( ) , self . ch . mcp_busy . load ( Ordering ::SeqCst ) ) ;
let _ = call . reply . send ( ( text , true ) ) ;
return ;
}
let said = crate ::mcp ::apply_change ( & change , & mut self . state . mcp_servers ) ;
let waits = match & change {
crate ::mcp ::Change ::Add ( s ) = > Some ( s . name . clone ( ) ) ,
crate ::mcp ::Change ::Update { after , .. } if after . enabled = > Some ( after . name . clone ( ) ) ,
crate ::mcp ::Change ::Reconnect ( n ) = > Some ( n . clone ( ) ) ,
_ = > None ,
} ;
match & change {
crate ::mcp ::Change ::Update { after , .. } = > self . mcp_reconnect ( & after . name ) ,
crate ::mcp ::Change ::Reconnect ( n ) = > self . mcp_reconnect ( n ) ,
2026-11-17 06:24:12 +00:00
crate ::mcp ::Change ::Remove ( s ) = > {
crate ::mcp ::forget ( & s . name ) ;
let _ = crate ::mcp_oauth ::logout ( & s . name ) ;
2026-11-17 11:22:18 +00:00
self . forget_mcp_grants ( & s . name ) ;
2026-11-17 06:24:12 +00:00
}
// (Logged out: the link that still carries the token goes too.)
crate ::mcp ::Change ::Logout ( n ) = > self . mcp_reconnect ( n ) ,
2026-11-17 02:55:37 +00:00
_ = > { }
}
self . ch . mcp_errors . lock ( ) . unwrap ( ) . retain ( | e | Some ( & e . 0 ) ! = waits . as_ref ( ) ) ;
self . dirty = true ;
self . save_now = true ;
ctx . request_repaint ( ) ;
let Some ( name ) = waits else {
let _ = call . reply . send ( ( said , true ) ) ;
return ;
} ;
let ( errs , busy , c ) = ( self . ch . mcp_errors . clone ( ) , self . ch . mcp_busy . clone ( ) , ctx . clone ( ) ) ;
std ::thread ::spawn ( move | | {
let t0 = Instant ::now ( ) ;
// (Let the window start the connection first: until then the old answer stands.)
std ::thread ::sleep ( std ::time ::Duration ::from_millis ( 600 ) ) ;
loop {
c . request_repaint ( ) ;
let done = ! busy . load ( Ordering ::SeqCst ) & & t0 . elapsed ( ) > std ::time ::Duration ::from_secs ( 2 ) ;
if let Some ( ( text , ok ) ) = crate ::mcp ::connected_text ( & name , & crate ::mcp ::status ( ) , & errs . lock ( ) . unwrap ( ) ) . filter ( | _ | done ) {
let _ = call . reply . send ( ( format! ( " {said} \n {text} " ) , ok ) ) ;
return ;
}
if t0 . elapsed ( ) > CONNECT_WAIT {
let _ = call . reply . send ( ( format! ( " {said} \n 還在連線中(第一次啟動可能在下載套件)。稍後用 action=list 看它連上了沒有。 " ) , true ) ) ;
return ;
}
std ::thread ::sleep ( std ::time ::Duration ::from_millis ( 500 ) ) ;
}
} ) ;
}
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
/// 重新連線 (here, or asked by a screen or the phone): drop the server's link and connect it
/// again now; its line says 連線中… until the answer.
pub ( super ) fn mcp_reconnect ( & mut self , name : & str ) {
crate ::mcp ::forget ( name ) ;
self . ch . mcp_errors . lock ( ) . unwrap ( ) . retain ( | e | e . 0 ! = name ) ;
self . ch . mcp_sig . clear ( ) ;
}
/// The servers' state as 連接器 shows it: {servers: {name: {tools, error}}, busy, tools:
/// [[server, tool, description]]}. A screen gets the brain's (its own would say 未連線).
2026-11-17 10:07:33 +00:00
#[ cfg(test) ]
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
pub ( super ) fn mcp_state ( & self ) -> serde_json ::Value {
2026-11-17 09:55:32 +00:00
self . mcp_state_capped ( usize ::MAX , usize ::MAX )
}
/// What a screen of this brain is sent (every sync): up to 80 tools of each connector, a
/// line of what each does — so a big one doesn't crowd the others out, and the sync stays small.
pub ( super ) fn mcp_state_for_screen ( & self ) -> serde_json ::Value {
self . mcp_state_capped ( 80 , 160 )
}
fn mcp_state_capped ( & self , each : usize , words : usize ) -> serde_json ::Value {
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
let status = crate ::mcp ::status ( ) ;
let errors = self . ch . mcp_errors . lock ( ) . unwrap ( ) . clone ( ) ;
let servers : serde_json ::Map < String , serde_json ::Value > = self
. state
. mcp_servers
. iter ( )
. map ( | s | ( s . name . clone ( ) , serde_json ::json! ( { " tools " : status . get ( & s . name ) , " error " : errors . iter ( ) . find ( | e | e . 0 = = s . name ) . map ( | e | e . 1. clone ( ) ) } ) ) )
. collect ( ) ;
2026-11-17 09:43:09 +00:00
let mut per : std ::collections ::HashMap < & str , usize > = Default ::default ( ) ;
let all = crate ::mcp ::tools ( ) ;
let tools : Vec < serde_json ::Value > = all
. iter ( )
. filter ( | t | {
let n = per . entry ( t . server . as_str ( ) ) . or_default ( ) ;
* n + = 1 ;
2026-11-17 09:55:32 +00:00
* n < = each
2026-11-17 09:43:09 +00:00
} )
2026-11-17 09:55:32 +00:00
. map ( | t | serde_json ::json! ( [ t . server , t . name , t . description . chars ( ) . take ( words ) . collect ::< String > ( ) ] ) )
2026-11-17 09:43:09 +00:00
. collect ( ) ;
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
serde_json ::json! ( { " servers " : servers , " busy " : self . ch . mcp_busy . load ( Ordering ::SeqCst ) , " tools " : tools } )
}
2026-11-17 09:43:09 +00:00
/// 連接器 (`part` 1) and 技能 (`part` 2), each the way other apps' settings do it: a short
/// list (a row each: name, its state, the switch, › ), and a page of its own for one item,
/// for the market, and (連接器) for the form — instead of everything on one long scroll.
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
pub ( super ) fn connectors_page ( & mut self , ui : & mut egui ::Ui , ctx : & egui ::Context , part : u8 ) {
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 before = serde_json ::to_string ( & self . state . mcp_servers ) . unwrap_or_default ( ) ;
2026-11-17 09:55:32 +00:00
// Another page (the list, one item, the market…): it opens at its top.
let key = ( part , self . ch . mcp_page . clone ( ) , self . ch . skill_page . clone ( ) ) ;
if self . ch . page_key . as_ref ( ) ! = Some ( & key ) {
ui . scroll_to_cursor ( Some ( Align ::TOP ) ) ;
self . ch . page_key = Some ( key ) ;
}
2026-11-17 09:43:09 +00:00
// A finished install: this computer's skill folder joins the list. (Not on a screen: its
// list is the brain's, and the brain installs there itself.)
if self . ch . skill_reload . swap ( false , Ordering ::SeqCst ) & & ! self . mir . on {
crate ::memory ::merge_skill_files ( & mut self . state . skills ) ;
self . dirty = true ;
}
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
if part = = 1 {
2026-11-17 09:43:09 +00:00
match self . ch . mcp_page . clone ( ) {
Page ::List = > self . mcp_list ( ui ) ,
Page ::Item ( name ) = > self . mcp_item ( ui , & name ) ,
Page ::Market = > {
if back_link ( ui , " 連接器 " , self . pal ) {
self . ch . mcp_page = Page ::List ;
}
ui . add_space ( crate ::theme ::sp ::S2 ) ;
self . mcp_market ( ui , ctx ) ;
}
Page ::Add = > {
if back_link ( ui , " 連接器 " , self . pal ) {
self . ch . mcp_page = Page ::List ;
}
ui . add_space ( crate ::theme ::sp ::S2 ) ;
self . mcp_form ( ui ) ;
}
}
} else {
match self . ch . skill_page . clone ( ) {
Page ::Item ( name ) = > self . skill_item ( ui , & name ) ,
Page ::Market | Page ::Add = > {
if back_link ( ui , " 技能 " , self . pal ) {
self . ch . skill_page = Page ::List ;
}
ui . add_space ( crate ::theme ::sp ::S2 ) ;
self . skill_market ( ui , ctx ) ;
}
Page ::List = > self . skill_list ( ui ) ,
}
}
if serde_json ::to_string ( & self . state . mcp_servers ) . unwrap_or_default ( ) ! = before {
self . dirty = true ;
}
}
2026-11-17 10:07:33 +00:00
/// A connector's new name still being typed is taken (or refused, and said) as soon as its
/// field isn't on screen any more — another sub-tab or settings tab, the sidebar's market,
/// the window closed — never later, by surprise.
pub ( super ) fn settle_mcp_name ( & mut self ) {
let Some ( ( whose , _ ) ) = self . ch . mcp_name . as_ref ( ) else { return } ;
let showing = self . show_settings & & self . settings_tab = = SettingsTab ::Channels & & self . ch . sub = = 1 & & self . ch . mcp_page = = Page ::Item ( whose . clone ( ) ) ;
if ! showing {
self . commit_mcp_name ( ) ;
}
}
/// Take the name being typed: it becomes the connector's when it is free (not empty, no other
/// connector's); otherwise the page says why. Its login and its page follow it.
fn commit_mcp_name ( & mut self ) {
let Some ( ( whose , want ) ) = self . ch . mcp_name . take ( ) else { return } ;
let want = want . trim ( ) . to_string ( ) ;
if want = = whose {
return ;
}
2026-11-17 10:35:57 +00:00
// Why it wasn't changed: on its page, or (the page left) as a notice.
let on_page = self . ch . mcp_page = = Page ::Item ( whose . clone ( ) ) ;
let say = | app : & mut App , why : String | {
if on_page {
* app . ch . mcp_note . lock ( ) . unwrap ( ) = why ;
} else {
app . notice = Some ( why ) ;
}
} ;
2026-11-17 10:07:33 +00:00
let why = if want . is_empty ( ) {
Some ( t ( " 名稱不能空白,沒有改。 " ) )
} else if self . state . mcp_servers . iter ( ) . any ( | s | s . name = = want ) {
Some ( t ( " 已經有叫「{n}」的連接器,名稱沒有改。 " ) . replace ( " {n} " , & want ) )
} else {
None
} ;
if let Some ( why ) = why {
2026-11-17 10:35:57 +00:00
say ( self , why ) ;
2026-11-17 10:07:33 +00:00
return ;
}
2026-11-17 10:26:52 +00:00
if ! self . state . mcp_servers . iter ( ) . any ( | s | s . name = = whose ) {
2026-11-17 10:35:57 +00:00
say ( self , t ( " 這個連接器已經被改名或移除了,名稱沒有改。 " ) ) ;
2026-11-17 10:17:01 +00:00
return ;
2026-11-17 10:26:52 +00:00
}
2026-11-17 10:35:57 +00:00
// On a screen the connector is the brain's: the brain is asked to rename it — its own
// entry, with its keys, its place in the list, its sign-in and 「一律允許」 — and the new
// name comes back with the brain's next update. Nothing is renamed here first, so a
// rename the brain didn't make leaves both on the old name. Not guessed from addresses.
2026-11-17 10:26:52 +00:00
if self . mir . on {
if ! self . mir . online {
2026-11-17 10:35:57 +00:00
say ( self , t ( " 連不到大腦,名稱沒有改。 " ) ) ;
2026-11-17 10:26:52 +00:00
return ;
}
self . mirror_mcp_rename ( & whose , & want ) ;
2026-11-17 10:35:57 +00:00
self . ch . mcp_renaming = Some ( ( whose . clone ( ) , want . clone ( ) , Instant ::now ( ) ) ) ;
if on_page {
self . ch . mcp_page = Page ::Item ( want . clone ( ) ) ;
if let Some ( k ) = self . ch . page_key . as_mut ( ) {
k . 1 = Page ::Item ( want . clone ( ) ) ;
}
}
return ;
2026-11-17 10:26:52 +00:00
}
2026-11-17 10:35:57 +00:00
// (Its sign-in and 「一律允許」 are kept under its name, here: they move with it.)
crate ::mcp_oauth ::rename ( & whose , & want ) ;
self . ch . mcp_errors . lock ( ) . unwrap ( ) . retain ( | e | e . 0 ! = whose ) ;
self . move_mcp_grants ( & whose , & want ) ;
2026-11-17 10:26:52 +00:00
if let Some ( s ) = self . state . mcp_servers . iter_mut ( ) . find ( | s | s . name = = whose ) {
s . name = want . clone ( ) ;
}
2026-11-17 10:07:33 +00:00
self . dirty = true ;
self . ch . mcp_note . lock ( ) . unwrap ( ) . clear ( ) ;
if self . ch . mcp_page = = Page ::Item ( whose . clone ( ) ) {
self . ch . mcp_page = Page ::Item ( want . clone ( ) ) ;
// (The same page under its new name: it doesn't jump to the top.)
if let Some ( k ) = self . ch . page_key . as_mut ( ) {
k . 1 = Page ::Item ( want . clone ( ) ) ;
}
}
if self . ch . mcp_confirm . as_deref ( ) = = Some ( whose . as_str ( ) ) {
self . ch . mcp_confirm = Some ( want ) ;
}
}
2026-11-17 10:35:57 +00:00
/// 「一律允許」 for a connector is kept by its name (`mcp:<name>` in each bot's rules): a
/// renamed one keeps it, and a later one given the old name doesn't inherit it.
pub ( super ) fn move_mcp_grants ( & mut self , old : & str , new : & str ) {
let ( from , to ) = ( format! ( " mcp: {old} " ) , format! ( " mcp: {new} " ) ) ;
for b in & mut self . state . bots {
for r in b . allow_rules . iter_mut ( ) . filter ( | r | * * r = = from ) {
* r = to . clone ( ) ;
}
}
}
2026-11-17 11:22:18 +00:00
/// A connector removed: its 「一律允許」 go too — a later one given its name doesn't get them.
pub ( super ) fn forget_mcp_grants ( & mut self , name : & str ) {
let grant = format! ( " mcp: {name} " ) ;
for b in & mut self . state . bots {
b . allow_rules . retain ( | r | * r ! = grant ) ;
}
}
2026-11-17 09:43:09 +00:00
/// The connectors' state as this window shows it (on a screen, the brain's; in a screenshot
/// or the layout audit, a made-up one marked `demo`).
2026-11-17 10:07:33 +00:00
fn mcp_view ( & self , tools : bool ) -> serde_json ::Value {
if self . mir . on | | self . mir . mcp_state [ " demo " ] = = true {
self . mir . mcp_state . clone ( )
} else {
self . mcp_state_capped ( if tools { usize ::MAX } else { 0 } , usize ::MAX )
}
2026-11-17 09:43:09 +00:00
}
}
/// A made-up connector state for screenshots and the layout audit: every added connector
/// connected, with `tools` tools each (names and descriptions like a real API's, some long).
pub ( super ) fn demo_mcp_state ( servers : & [ crate ::mcp ::Server ] , tools : usize ) -> serde_json ::Value {
let mut st = serde_json ::json! ( { " demo " : true , " busy " : false , " servers " : { } , " tools " : [ ] } ) ;
for s in servers {
st [ " servers " ] [ s . name . as_str ( ) ] = serde_json ::json! ( { " tools " : tools } ) ;
for i in 0 .. tools {
let ( name , about ) = match i % 4 {
0 = > ( format! ( " v1_dashboard_event_summary_get_ {i} " ) , " Get BMC Event Severity Summary · [GET /v1/dashboard/eventSummary] · tags: Dashboard " . to_string ( ) ) ,
1 = > ( format! ( " v1_device_inventory_fru_physical_asset_get_ {i} " ) , " List the physical assets (FRU) of every device in the inventory, with their serial numbers, part numbers and where each one sits in the rack " . to_string ( ) ) ,
2 = > ( format! ( " api_search_ {i} " ) , " 搜尋 API 端點 " . to_string ( ) ) ,
_ = > ( format! ( " an_extremely_long_tool_name_that_keeps_going_without_any_break_at_all_ {i} " ) , String ::new ( ) ) ,
} ;
st [ " tools " ] . as_array_mut ( ) . unwrap ( ) . push ( serde_json ::json! ( [ s . name , name , about ] ) ) ;
}
}
st
}
impl App {
/// A connector's state in a few words, and its dot's colour.
fn mcp_words ( & self , s : & crate ::mcp ::Server , st : & serde_json ::Value ) -> ( Color32 , String ) {
let p = self . pal ;
let one = & st [ " servers " ] [ s . name . as_str ( ) ] ;
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
// (「這台電腦沒有 Node.js」 from the brain means the brain, not the computer in front.)
let at = if self . mir . on { " 在大腦上: " } else { " " } ;
2026-11-17 09:43:09 +00:00
match ( s . enabled , one [ " tools " ] . as_u64 ( ) , one [ " error " ] . as_str ( ) ) {
( false , _ , _ ) = > ( p . text3 , t ( " 已關閉 " ) ) ,
( _ , Some ( n ) , _ ) = > ( p . up , t ( " 已連上,{n} 個工具 " ) . replace ( " {n} " , & n . to_string ( ) ) ) ,
( _ , _ , Some ( e ) ) = > ( p . danger , format! ( " {at} {e} " ) ) ,
_ if st [ " busy " ] . as_bool ( ) . unwrap_or ( false ) = > ( p . text3 , t ( " 連線中… " ) ) ,
_ = > ( p . text3 , t ( " 未連線 " ) ) ,
}
}
/// 連接器: what it is, 瀏覽市集 and 新增連接器, then the ones added — a row each.
fn mcp_list ( & mut self , ui : & mut egui ::Ui ) {
let p = self . pal ;
2026-11-17 09:55:32 +00:00
// (A 「確定移除」 left pressed once on a connector's page doesn't wait there for next time.)
self . ch . mcp_confirm = None ;
2026-11-17 09:43:09 +00:00
setting_card ( ui , p , | ui | {
setting_title ( ui , " 連接器( MCP) " , " 接上 Model Context Protocol 伺服器, Bot 就能用它的工具(例如 GitHub、Notion、資料庫、你公司的內部系統) 。本機伺服器填指令( 例如 npx -y @modelcontextprotocol/server-filesystem ~/Documents) ; 遠端伺服器填網址( Streamable HTTP) , 需要時加上 Authorization 標頭。 " , p ) ;
hint ( ui , " 讓 Bot 用外部服務的工具。每個連接器第一次被使用時會先問你。 " , p ) ;
ui . add_space ( crate ::theme ::sp ::S2 ) ;
ui . horizontal ( | ui | {
if ui . add ( primary_button ( " 瀏覽市集 " , p ) ) . clicked ( ) {
self . ch . mcp_page = Page ::Market ;
}
if ui . add ( secondary_button ( " 新增連接器 " ) ) . on_hover_text ( t ( " 用指令或網址接你自己的伺服器 " ) ) . clicked ( ) {
self . ch . mcp_page = Page ::Add ;
}
} ) ;
} ) ;
if self . state . mcp_servers . is_empty ( ) {
section ( ui , " 已加入 " , p ) ;
hint ( ui , " 還沒有連接器。按「瀏覽市集」加一個常用的,或「新增連接器」接你自己的。 " , p ) ;
return ;
}
2026-11-17 10:07:33 +00:00
let st = self . mcp_view ( false ) ;
2026-11-17 09:43:09 +00:00
let words : Vec < ( Color32 , String ) > = self . state . mcp_servers . iter ( ) . map ( | s | self . mcp_words ( s , & st ) ) . collect ( ) ;
section ( ui , " 已加入 " , p ) ;
let mut open = None ;
rows_card ( ui , p , | ui | {
for ( s , ( col , text ) ) in self . state . mcp_servers . iter_mut ( ) . zip ( words ) {
let name = s . name . clone ( ) ;
if nav_row ( ui , p , & name , & text , Some ( col ) , | ui | {
ui . add ( computers_ui ::toggle ( & mut s . enabled ) ) . on_hover_text ( t ( " 開啟 " ) ) ;
} ) {
open = Some ( name ) ;
}
}
} ) ;
if let Some ( name ) = open {
self . ch . mcp_page = Page ::Item ( name ) ;
self . ch . tool_q . clear ( ) ;
2026-11-17 10:07:33 +00:00
self . ch . mcp_note . lock ( ) . unwrap ( ) . clear ( ) ;
2026-11-17 09:43:09 +00:00
}
}
/// One connector's own page: its state and switch, 重新連線/登入, its settings, its tools,
/// and 移除 at the end.
fn mcp_item ( & mut self , ui : & mut egui ::Ui , name : & str ) {
let p = self . pal ;
if back_link ( ui , " 連接器 " , p ) {
2026-11-17 10:35:57 +00:00
// (A new name typed and not yet done: taken now, if it can be — said as a notice, the
// page being left.)
2026-11-17 09:55:32 +00:00
self . ch . mcp_note . lock ( ) . unwrap ( ) . clear ( ) ;
2026-11-17 10:07:33 +00:00
self . ch . tool_q . clear ( ) ;
2026-11-17 09:43:09 +00:00
self . ch . mcp_page = Page ::List ;
2026-11-17 10:35:57 +00:00
self . commit_mcp_name ( ) ;
2026-11-17 09:43:09 +00:00
return ;
}
2026-11-17 10:35:57 +00:00
// (Renamed on a screen: until the brain's update brings the new name, it is the old one.)
let renaming = self . ch . mcp_renaming . as_ref ( ) . filter ( | r | r . 1 = = name & & r . 2. elapsed ( ) < std ::time ::Duration ::from_secs ( 30 ) ) . map ( | r | r . 0. clone ( ) ) ;
2026-11-17 11:22:18 +00:00
let exact = self . state . mcp_servers . iter ( ) . position ( | s | s . name = = name ) ;
// (Still under its old name: the brain hasn't sent the new one yet. Its fields wait —
// an edit now would name a connector the brain no longer has.)
let waiting = exact . is_none ( ) ;
let Some ( i ) = exact . or_else ( | | renaming . and_then ( | old | self . state . mcp_servers . iter ( ) . position ( | s | s . name = = old ) ) ) else {
2026-11-17 09:43:09 +00:00
self . ch . mcp_page = Page ::List ;
return ;
} ;
2026-11-17 10:07:33 +00:00
let st = self . mcp_view ( true ) ;
2026-11-17 09:43:09 +00:00
let ( col , text ) = self . mcp_words ( & self . state . mcp_servers [ i ] , & st ) ;
let mut remove = false ;
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
let mut reconnect = None ;
2026-11-17 05:08:45 +00:00
let mut login : Option < ( String , String ) > = None ;
2026-11-17 09:43:09 +00:00
ui . add_space ( crate ::theme ::sp ::S2 ) ;
rows_card ( ui , p , | ui | {
let s = & mut self . state . mcp_servers [ i ] ;
let shown = s . name . clone ( ) ;
status_row ( ui , p , & shown , & text , col , | ui | {
ui . add ( computers_ui ::toggle ( & mut s . enabled ) ) . on_hover_text ( t ( " 開啟 " ) ) ;
if s . enabled & & ui . add ( secondary_button ( " 重新連線 " ) ) . on_hover_text ( t ( " 再連一次,看連不連得上 " ) ) . clicked ( ) {
reconnect = Some ( s . name . clone ( ) ) ;
}
// 連接器登入: a remote connector, on the brain itself (a screen: ask a bot).
if s . enabled & & ! s . url . trim ( ) . is_empty ( ) & & ! self . mir . on {
let word = if crate ::mcp_oauth ::tokens ( & s . name ) . is_some ( ) { " 重新登入 " } else { " 登入 " } ;
if ui . add ( secondary_button ( word ) ) . on_hover_text ( t ( " 用帳號登入這個連接器( OAuth) , 在瀏覽器打開登入頁 " ) ) . clicked ( ) {
login = Some ( ( s . name . clone ( ) , s . url . clone ( ) ) ) ;
2026-11-16 14:45:03 +00:00
}
2026-11-12 13:55:50 +00:00
}
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-17 09:43:09 +00:00
} ) ;
2026-11-17 09:55:32 +00:00
let note = self . ch . mcp_note . lock ( ) . unwrap ( ) . clone ( ) ;
2026-11-17 09:43:09 +00:00
if ! note . is_empty ( ) {
hint ( ui , note , p ) ;
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-17 09:43:09 +00:00
// Its tools, its own (a search when there are many) — not every connector's on one card.
let tools : Vec < serde_json ::Value > = st [ " tools " ] . as_array ( ) . into_iter ( ) . flatten ( ) . filter ( | t | t [ 0 ] . as_str ( ) = = Some ( name ) ) . cloned ( ) . collect ( ) ;
if ! tools . is_empty ( ) {
let n = st [ " servers " ] [ name ] [ " tools " ] . as_u64 ( ) . unwrap_or ( tools . len ( ) as u64 ) ;
section ( ui , & t ( " 工具({n}) " ) . replace ( " {n} " , & n . to_string ( ) ) , p ) ;
if tools . len ( ) > 8 {
2026-11-17 09:55:32 +00:00
ui . add ( egui ::TextEdit ::singleline ( & mut self . ch . tool_q ) . id_salt ( " mcp-tool-search " ) . hint_text ( t ( " 搜尋工具 " ) ) . desired_width ( ui . available_width ( ) ) ) ;
2026-11-17 09:43:09 +00:00
ui . add_space ( crate ::theme ::sp ::S2 ) ;
}
2026-11-17 10:07:33 +00:00
// (The search counts only while its box shows.)
let q = if tools . len ( ) > 8 { self . ch . tool_q . trim ( ) . to_lowercase ( ) } else { String ::new ( ) } ;
2026-11-17 09:43:09 +00:00
let shown : Vec < & serde_json ::Value > = tools . iter ( ) . filter ( | t | q . is_empty ( ) | | t [ 1 ] . as_str ( ) . unwrap_or ( " " ) . to_lowercase ( ) . contains ( & q ) | | t [ 2 ] . as_str ( ) . unwrap_or ( " " ) . to_lowercase ( ) . contains ( & q ) ) . collect ( ) ;
2026-11-17 10:07:33 +00:00
if ( tools . len ( ) as u64 ) < n {
hint ( ui , t ( " 在這台螢幕電腦上只列出前 {k} 個。 " ) . replace ( " {k} " , & tools . len ( ) . to_string ( ) ) , p ) ;
}
2026-11-17 09:43:09 +00:00
if shown . is_empty ( ) {
hint ( ui , " 沒有符合的工具。 " , p ) ;
} else {
rows_card ( ui , p , | ui | {
for t in shown {
tool_row ( ui , p , t [ 1 ] . as_str ( ) . unwrap_or ( " " ) , t [ 2 ] . as_str ( ) . unwrap_or ( " " ) ) ;
}
} ) ;
}
2026-11-16 14:45:03 +00:00
}
2026-11-17 09:43:09 +00:00
// 設定: every field can be changed; it is kept as it changes (the page's fingerprint marks
2026-11-17 09:55:32 +00:00
// it dirty) and mcp_poll connects again when the fingerprint moves. Each field has an id of
// its own: the tools above come and go as it reconnects, and the one being typed in keeps
// its place. The name is changed when it is done (Enter, or leaving the field) — not on each
// letter, which passed through other connectors' names ("github" → "git") and empty.
2026-11-17 10:07:33 +00:00
let mut done = false ;
2026-11-17 10:35:57 +00:00
let mut name_field = None ;
2026-11-17 09:43:09 +00:00
section ( ui , " 設定 " , p ) ;
2026-11-17 11:22:18 +00:00
if waiting {
hint ( ui , " 正在請大腦改名… " , p ) ;
}
ui . add_enabled_ui ( ! waiting , | ui | setting_card ( ui , p , | ui | {
2026-11-17 09:43:09 +00:00
let s = & mut self . state . mcp_servers [ i ] ;
2026-11-17 09:55:32 +00:00
let draft = self . ch . mcp_name . get_or_insert_with ( | | ( name . to_string ( ) , name . to_string ( ) ) ) ;
if draft . 0 ! = name {
* draft = ( name . to_string ( ) , name . to_string ( ) ) ;
}
2026-11-17 09:43:09 +00:00
let mut cmd_edit = if s . url . is_empty ( ) { format! ( " {} {} " , s . command , s . args . join ( " " ) ) . trim ( ) . to_string ( ) } else { s . url . clone ( ) } ;
let mut env_edit : String = s . env . iter ( ) . map ( | ( k , v ) | format! ( " {k} = {v} " ) ) . collect ::< Vec < _ > > ( ) . join ( " " ) ;
let mut hdr_edit : String = s . headers . iter ( ) . map ( | ( k , v ) | format! ( " {k} : {v} " ) ) . collect ::< Vec < _ > > ( ) . join ( " " ) ;
let hide_hdr = ! hdr_edit . contains ( '{' ) & & ! hdr_edit . is_empty ( ) ;
let ( mut cmd_changed , mut env_changed , mut hdr_changed ) = ( false , false , false ) ;
form_row ( ui , " 名稱 " , p , | ui | {
2026-11-17 09:55:32 +00:00
let r = ui . add ( egui ::TextEdit ::singleline ( & mut draft . 1 ) . id_salt ( ( " mcp-field " , " name " ) ) . desired_width ( ui . available_width ( ) ) ) ;
2026-11-17 10:35:57 +00:00
name_field = Some ( r . id ) ;
2026-11-17 10:07:33 +00:00
// Esc: put back as it was.
if r . lost_focus ( ) & & ui . input ( | i | i . key_pressed ( egui ::Key ::Escape ) ) {
draft . 1 = name . to_string ( ) ;
} else if r . lost_focus ( ) {
done = true ;
2026-11-17 09:55:32 +00:00
}
2026-11-17 09:43:09 +00:00
} ) ;
form_row ( ui , " 指令或網址 " , p , | ui | {
2026-11-17 09:55:32 +00:00
cmd_changed = ui . add ( egui ::TextEdit ::singleline ( & mut cmd_edit ) . id_salt ( ( " mcp-field " , " cmd " ) ) . font ( egui ::TextStyle ::Monospace ) . hint_text ( t ( " npx -y … 或 https://…/mcp " ) ) . desired_width ( ui . available_width ( ) ) ) . changed ( ) ;
2026-11-17 09:43:09 +00:00
} ) ;
form_row ( ui , " 環境變數 " , p , | ui | {
2026-11-17 09:55:32 +00:00
env_changed = ui . add ( egui ::TextEdit ::singleline ( & mut env_edit ) . id_salt ( ( " mcp-field " , " env " ) ) . font ( egui ::TextStyle ::Monospace ) . password ( true ) . hint_text ( t ( " K=V K2=V2( 本機用, 選填) " ) ) . desired_width ( ui . available_width ( ) ) ) . changed ( ) ;
2026-11-17 09:43:09 +00:00
} ) ;
form_row ( ui , " 標頭 " , p , | ui | {
2026-11-17 09:55:32 +00:00
hdr_changed = ui . add ( egui ::TextEdit ::singleline ( & mut hdr_edit ) . id_salt ( ( " mcp-field " , " headers " ) ) . font ( egui ::TextStyle ::Monospace ) . password ( hide_hdr ) . hint_text ( t ( " Authorization: Bearer …(遠端用,選填) " ) ) . desired_width ( ui . available_width ( ) ) ) . changed ( ) ;
2026-11-17 09:43:09 +00:00
} ) ;
if cmd_changed {
let c = cmd_edit . trim ( ) . to_string ( ) ;
if c . starts_with ( " http:// " ) | | c . starts_with ( " https:// " ) {
s . url = c ;
s . command . clear ( ) ;
s . args . clear ( ) ;
} else {
let mut it = c . split_whitespace ( ) ;
s . command = it . next ( ) . unwrap_or_default ( ) . to_string ( ) ;
s . args = it . map ( String ::from ) . collect ( ) ;
s . url . clear ( ) ;
}
}
if env_changed {
s . env = env_edit . split_whitespace ( ) . filter_map ( | kv | kv . split_once ( '=' ) ) . map ( | ( k , v ) | ( k . to_string ( ) , v . to_string ( ) ) ) . collect ( ) ;
}
if hdr_changed {
s . headers = hdr_edit . split_once ( ':' ) . map ( | ( k , v ) | std ::iter ::once ( ( k . trim ( ) . to_string ( ) , v . trim ( ) . to_string ( ) ) ) . collect ( ) ) . unwrap_or_default ( ) ;
}
// 帳號 / 密碼: changed here, the server is connected again with the new ones.
let ( user , pass ) = ( & mut s . username , & mut s . password ) ;
form_pair (
ui ,
p ,
" 帳號 " ,
| ui | {
2026-11-17 09:55:32 +00:00
ui . add ( egui ::TextEdit ::singleline ( user ) . id_salt ( ( " mcp-field " , " user " ) ) . hint_text ( t ( " 選填 " ) ) . desired_width ( ui . available_width ( ) ) ) ;
2026-11-17 09:43:09 +00:00
} ,
" 密碼 " ,
| ui | {
2026-11-17 09:55:32 +00:00
ui . add ( egui ::TextEdit ::singleline ( pass ) . id_salt ( ( " mcp-field " , " pass " ) ) . password ( true ) . hint_text ( t ( " 選填 " ) ) . desired_width ( ui . available_width ( ) ) ) ;
2026-11-17 09:43:09 +00:00
} ,
) ;
form_row ( ui , " 給 Bot 的使用說明(選填) " , p , | ui | {
2026-11-17 09:55:32 +00:00
ui . add ( egui ::TextEdit ::multiline ( & mut s . instructions ) . id_salt ( ( " mcp-field " , " instructions " ) ) . desired_rows ( 1 ) . desired_width ( ui . available_width ( ) ) . hint_text ( t ( " 例如:查詢客戶資料時先用 search_customers " ) ) ) ;
2026-11-17 09:43:09 +00:00
} ) ;
2026-11-17 11:22:18 +00:00
} ) ) ;
2026-11-17 09:43:09 +00:00
// (Renamed: the page follows it.)
2026-11-17 10:35:57 +00:00
self . ch . name_field = name_field ;
2026-11-17 10:07:33 +00:00
if done {
self . commit_mcp_name ( ) ;
2026-11-16 14:45:03 +00:00
}
2026-11-17 09:43:09 +00:00
// 移除: at the end, away from the rest, asked once more.
ui . add_space ( crate ::theme ::sp ::S5 ) ;
ui . horizontal ( | ui | {
if self . ch . mcp_confirm . as_deref ( ) = = Some ( name ) {
if ui . add ( egui ::Button ::new ( RichText ::new ( t ( " 確定移除 " ) ) . color ( p . danger ) ) . frame ( false ) ) . clicked ( ) {
remove = true ;
self . ch . mcp_confirm = None ;
}
if ui . add ( egui ::Button ::new ( RichText ::new ( t ( " 取消 " ) ) . color ( p . text2 ) ) . frame ( false ) ) . clicked ( ) {
self . ch . mcp_confirm = None ;
}
} else if ui . add ( egui ::Button ::new ( RichText ::new ( t ( " 移除這個連接器 " ) ) . color ( p . danger ) ) . frame ( false ) ) . clicked ( ) {
self . ch . mcp_confirm = Some ( name . to_string ( ) ) ;
}
} ) ;
if remove {
2026-11-17 06:24:12 +00:00
let gone = self . state . mcp_servers . remove ( i ) ;
let _ = crate ::mcp_oauth ::logout ( & gone . name ) ;
2026-11-17 11:22:18 +00:00
self . forget_mcp_grants ( & gone . name ) ;
2026-11-17 10:07:33 +00:00
self . ch . mcp_note . lock ( ) . unwrap ( ) . clear ( ) ;
self . ch . mcp_name = None ;
2026-11-17 09:43:09 +00:00
self . ch . mcp_page = Page ::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
}
2026-11-17 05:08:45 +00:00
if let Some ( ( name , url ) ) = login {
2026-11-17 09:55:32 +00:00
let note = self . ch . mcp_note . clone ( ) ;
note . lock ( ) . unwrap ( ) . clear ( ) ;
2026-11-17 05:08:45 +00:00
std ::thread ::spawn ( move | | match crate ::mcp_oauth ::start ( & name , & url ) {
2026-11-17 06:24:12 +00:00
// (Windows' `start` reads & in an address as the end of it: the address is shown instead.)
Ok ( u ) if cfg! ( windows ) = > * note . lock ( ) . unwrap ( ) = format! ( " 在瀏覽器打開這個網址登入「 {name} 」: {u} " ) ,
2026-11-17 05:08:45 +00:00
Ok ( u ) = > {
let _ = crate ::computer ::spawn_reaped ( & mut crate ::preview ::system_open ( & u ) ) ;
}
Err ( e ) = > * note . lock ( ) . unwrap ( ) = format! ( " 沒辦法登入「 {name} 」: {e} " ) ,
} ) ;
}
連接器: the brain's connectors work — a screen shows the brain's state, 重新連線, many tools are found instead of sent
- 設定 › 連接器 on a screen showed the screen's own (empty) MCP state: every brain connector read
「未連線」 and its error never reached the person. The brain now sends its connectors' state with
each sync; errors from the brain say 「在大腦上:」.
- 重新連線 on each connector (computer, screen → brain, phone); one that is on but not connected is
tried again each minute; a link that died (process ended, HTTP session expired) is dropped and
connected again instead of failing every call.
- More than 20 connector tools: none ride along. The model gets find_connector_tool (the list of
connectors, search by words) and use_connector_tool (runs the found tool, asked like the tool
itself). A brain with scc (82) + the market's sent ~170 tools / ~120 KB a turn, over the
128-tool limit of many services.
- A server that doesn't start says why: no Node.js / uv, a folder not on this computer, and the
last lines it wrote to stderr; it is ended instead of left running.
- The brain image has nodejs/npm, python3 and uv (uvx), caches on /data.
- Moving to a brain leaves connectors that name this computer's folders here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha5Mk1tvt3gyzfzhDgb
2026-11-12 07:53:09 +00:00
if let Some ( name ) = reconnect {
if self . mir . on {
self . mirror_mcp_reconnect ( & name ) ;
} else {
self . mcp_reconnect ( & name ) ;
}
}
2026-11-17 09:43:09 +00:00
}
/// 瀏覽市集: the common connectors (one click), and the official MCP Registry's.
fn mcp_market ( & mut self , ui : & mut egui ::Ui , ctx : & egui ::Context ) {
let p = self . pal ;
setting_card ( ui , p , | ui | {
setting_title ( ui , " 連接器市集 " , " 常用的連接器,按「加入」就能用。需要金鑰的會打開「新增連接器」並填好,補上金鑰再按「新增」。本機的需要先裝 Node.js( npx) 或 uv( uvx) 。下面的「公用市集」搜尋官方 MCP Registry 裡用網址連的連接器。 " , p ) ;
for ( name , desc , cmd , needs ) in crate ::mcp ::MARKET {
let added = self . state . mcp_servers . iter ( ) . any ( | s | s . name = = name ) ;
listing_row (
ui ,
| ui | {
if added {
ui . label ( RichText ::new ( t ( " 已加入 " ) ) . size ( FONT_XS ) . color ( p . text3 ) ) ;
} else if ui . add ( secondary_button ( " 加入 " ) ) . clicked ( ) {
2026-11-21 06:46:53 +00:00
self . mcp_market_add ( name , cmd , needs ) ;
2026-11-17 09:43:09 +00:00
}
} ,
| ui | {
ui . label ( RichText ::new ( name ) . strong ( ) . family ( crate ::bold ( ) ) . size ( FONT_SM ) ) ;
ui . add ( egui ::Label ::new ( RichText ::new ( desc ) . size ( FONT_XS ) . color ( p . text3 ) ) . truncate ( ) ) . on_hover_text ( desc ) ;
} ,
) ;
}
self . registry_market ( ui , ctx ) ;
} ) ;
}
/// 新增連接器: the form (filled already when it came from the market).
fn mcp_form ( & mut self , ui : & mut egui ::Ui ) {
let p = self . pal ;
setting_card ( ui , p , | ui | {
setting_title ( ui , " 新增連接器 " , " " , p ) ;
let ( name , cmd , env , headers ) = & mut self . ch . new_mcp ;
form_row ( ui , " 名稱 " , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( name ) . hint_text ( t ( " 例如 github " ) ) . desired_width ( ui . available_width ( ) ) ) ;
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-17 09:43:09 +00:00
form_row ( ui , " 指令或網址 " , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( cmd ) . hint_text ( t ( " npx -y @modelcontextprotocol/server-github 或 https://…/mcp " ) ) . desired_width ( ui . available_width ( ) ) . font ( egui ::TextStyle ::Monospace ) ) ;
} ) ;
form_row ( ui , " 環境變數 " , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( env ) . hint_text ( t ( " GITHUB_TOKEN=…(多個用空白分開,本機伺服器用) " ) ) . password ( true ) . desired_width ( ui . available_width ( ) ) ) ;
} ) ;
form_row ( ui , " 標頭 " , p , | ui | {
// Shown as typed while a 「{…}」 is still to be replaced; hidden once it's a key.
let hide = ! headers . contains ( '{' ) ;
ui . add ( egui ::TextEdit ::singleline ( headers ) . hint_text ( t ( " Authorization: Bearer …(遠端伺服器用) " ) ) . password ( hide ) . desired_width ( ui . available_width ( ) ) ) ;
} ) ;
let ( user , pass ) = & mut self . ch . new_mcp_login ;
form_row ( ui , " 帳號 " , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( user ) . hint_text ( t ( " 要用帳號密碼登入的伺服器才填 " ) ) . desired_width ( ui . available_width ( ) ) ) ;
} ) ;
form_row ( ui , " 密碼 " , p , | ui | {
ui . add ( egui ::TextEdit ::singleline ( pass ) . password ( true ) . desired_width ( ui . available_width ( ) ) ) ;
} ) ;
hint ( ui , " 帳號密碼怎麼交給伺服器:在指令、環境變數、網址或標頭裡寫「{username}」「{password}」,就填在那裡(例如環境變數 SCC_USER={username} SCC_PASS={password});都沒寫的話,本機伺服器會收到環境變數 MCP_USERNAME、MCP_PASSWORD, 遠端伺服器收到 Authorization: Basic。 " , p ) ;
if ! self . ch . new_mcp_hint . is_empty ( ) {
ui . label ( RichText ::new ( & self . ch . new_mcp_hint ) . size ( FONT_SM ) . color ( p . text2 ) ) ;
}
// A 「{…}」 left in the address or the header can only fail (the 帳號/密碼 slots are filled when connecting).
let unfilled = crate ::mcp ::Server ::unfilled ( cmd ) | | crate ::mcp ::Server ::unfilled ( headers ) ;
if unfilled {
ui . label ( RichText ::new ( t ( " 還有「{…}」沒換成你的值 " ) ) . size ( FONT_XS ) . color ( p . danger ) ) ;
}
let ok = ! unfilled & & ! name . trim ( ) . is_empty ( ) & & ! cmd . trim ( ) . is_empty ( ) & & ! self . state . mcp_servers . iter ( ) . any ( | s | s . name = = name . trim ( ) ) ;
ui . add_space ( crate ::theme ::sp ::S2 ) ;
if ui . add_enabled ( ok , primary_button ( " 新增 " , p ) ) . clicked ( ) {
let c = cmd . trim ( ) . to_string ( ) ;
let is_url = c . starts_with ( " http:// " ) | | c . starts_with ( " https:// " ) ;
let parts : Vec < String > = c . split_whitespace ( ) . map ( String ::from ) . collect ( ) ;
let envs = env . split_whitespace ( ) . filter_map ( | kv | kv . split_once ( '=' ) ) . map ( | ( k , v ) | ( k . to_string ( ) , v . to_string ( ) ) ) . collect ( ) ;
let hdrs = headers . split_once ( ':' ) . map ( | ( k , v ) | std ::iter ::once ( ( k . trim ( ) . to_string ( ) , v . trim ( ) . to_string ( ) ) ) . collect ( ) ) . unwrap_or_default ( ) ;
let added = name . trim ( ) . to_string ( ) ;
self . state . mcp_servers . push ( crate ::mcp ::Server {
name : added . clone ( ) ,
command : if is_url { String ::new ( ) } else { parts . first ( ) . cloned ( ) . unwrap_or_default ( ) } ,
args : if is_url { vec! [ ] } else { parts . into_iter ( ) . skip ( 1 ) . collect ( ) } ,
env : envs ,
url : if is_url { c } else { String ::new ( ) } ,
headers : hdrs ,
enabled : true ,
instructions : String ::new ( ) ,
username : user . trim ( ) . to_string ( ) ,
password : pass . clone ( ) ,
} ) ;
self . ch . new_mcp_login = Default ::default ( ) ;
self . ch . new_mcp = Default ::default ( ) ;
self . ch . new_mcp_hint . clear ( ) ;
// Its own page: watch it connect.
self . ch . mcp_page = Page ::Item ( added ) ;
2026-11-17 10:07:33 +00:00
self . ch . tool_q . clear ( ) ;
self . ch . mcp_note . lock ( ) . unwrap ( ) . clear ( ) ;
2026-11-17 09:43:09 +00:00
}
} ) ;
}
2026-11-11 08:19:06 +00:00
2026-11-17 09:43:09 +00:00
/// 技能: what they are and 瀏覽市集, then the ones added — a row each (a search when many).
fn skill_list ( & mut self , ui : & mut egui ::Ui ) {
let p = self . pal ;
let busy = self . ch . skill_busy . load ( Ordering ::SeqCst ) ;
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
setting_card ( ui , p , | ui | {
2026-11-16 15:01:35 +00:00
setting_title ( ui , " 技能 " , " 所有 Bot 共用的專業指南與標準作業流程(相容 Agent Skills SKILL.md 規格,支援隨附 scripts/ 與 references/)。 " , p ) ;
hint ( ui , " 開著的技能會列在 Bot 的目錄裡,需要時自動載入。 " , p ) ;
2026-11-17 09:43:09 +00:00
ui . add_space ( crate ::theme ::sp ::S2 ) ;
if ui . add ( primary_button ( " 瀏覽市集 " , p ) ) . on_hover_text ( t ( " 內建技能包、Anthropic 開源技能,或從 GitHub、網址、資料夾安裝 " ) ) . clicked ( ) {
self . ch . skill_page = Page ::Market ;
}
2026-11-16 15:01:35 +00:00
} ) ;
2026-11-17 09:43:09 +00:00
let n = self . state . skills . len ( ) ;
section ( ui , & if n > 0 { t ( " 已加入({n}) " ) . replace ( " {n} " , & n . to_string ( ) ) } else { t ( " 已加入 " ) } , p ) ;
if n = = 0 {
hint ( ui , " 還沒有技能。按「瀏覽市集」從內建技能包加一個。 " , p ) ;
2026-11-17 09:55:32 +00:00
if self . ch . skill_note_list {
skill_status ( ui , & self . ch , busy , p ) ;
}
2026-11-17 09:43:09 +00:00
return ;
}
if n > 8 {
2026-11-17 09:55:32 +00:00
ui . add ( egui ::TextEdit ::singleline ( & mut self . ch . skill_q ) . id_salt ( " skill-search " ) . hint_text ( t ( " 搜尋技能 " ) ) . desired_width ( ui . available_width ( ) ) ) ;
2026-11-17 09:43:09 +00:00
ui . add_space ( crate ::theme ::sp ::S2 ) ;
}
2026-11-17 10:07:33 +00:00
let q = if n > 8 { self . ch . skill_q . trim ( ) . to_lowercase ( ) } else { String ::new ( ) } ;
2026-11-17 09:43:09 +00:00
let mut open = None ;
let mut toggled = false ;
let mut any = false ;
rows_card ( ui , p , | ui | {
for k in self . state . skills . iter_mut ( ) . filter ( | k | q . is_empty ( ) | | k . name . to_lowercase ( ) . contains ( & q ) | | k . description . to_lowercase ( ) . contains ( & q ) ) {
any = true ;
let ( name , about ) = ( k . name . clone ( ) , k . description . replace ( '\n' , " " ) ) ;
if nav_row ( ui , p , & name , & about , None , | ui | {
if ui . add ( computers_ui ::toggle ( & mut k . enabled ) ) . on_hover_text ( t ( " 開啟 " ) ) . changed ( ) {
toggled = true ;
2026-11-16 15:01:35 +00:00
}
2026-11-17 09:43:09 +00:00
} ) {
open = Some ( name ) ;
2026-11-11 08:19:06 +00:00
}
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-17 09:43:09 +00:00
if ! any {
ui . add_space ( crate ::theme ::sp ::S3 ) ;
ui . label ( RichText ::new ( t ( " 沒有符合的技能。 " ) ) . size ( FONT_SM ) . color ( p . text3 ) ) ;
ui . add_space ( crate ::theme ::sp ::S3 ) ;
}
} ) ;
if toggled {
self . dirty = true ;
2026-11-16 15:01:35 +00:00
}
2026-11-17 09:43:09 +00:00
if let Some ( name ) = open {
self . ch . skill_page = Page ::Item ( name ) ;
self . ch . skill_confirm = None ;
}
if self . ch . skill_note_list {
ui . add_space ( crate ::theme ::sp ::S2 ) ;
skill_status ( ui , & self . ch , busy , p ) ;
}
}
/// One skill's own page: its switch, all of what it is, its files, its instructions, and 刪除.
fn skill_item ( & mut self , ui : & mut egui ::Ui , name : & str ) {
let p = self . pal ;
if back_link ( ui , " 技能 " , p ) {
self . ch . skill_page = Page ::List ;
return ;
}
let Some ( i ) = self . state . skills . iter ( ) . position ( | k | k . name = = name ) else {
self . ch . skill_page = Page ::List ;
return ;
} ;
ui . add_space ( crate ::theme ::sp ::S2 ) ;
let mut toggled = false ;
let mut remove = false ;
rows_card ( ui , p , | ui | {
let k = & mut self . state . skills [ i ] ;
let words = if k . enabled { t ( " 開著:列在 Bot 的目錄裡 " ) } else { t ( " 關著:不列進任何 Bot 的說明 " ) } ;
card_row ( ui , p , name , & words , " " , | ui | {
if ui . add ( computers_ui ::toggle ( & mut k . enabled ) ) . on_hover_text ( t ( " 開啟 " ) ) . changed ( ) {
toggled = true ;
}
} ) ;
} ) ;
setting_card ( ui , p , | ui | {
remove = skill_detail ( ui , p , & self . state . skills [ i ] , & mut self . ch . skill_confirm ) ;
} ) ;
if toggled {
self . dirty = true ;
}
if remove {
2026-11-16 15:01:35 +00:00
if self . mir . on {
// The brain takes it off its list and its disk (a folder left there would
// bring it back when the brain restarts); the list here follows.
self . ch . skill_note_list = true ;
self . mirror_skill ( serde_json ::json! ( { " name " : name , " remove " : true } ) , self . ch . skill_note . clone ( ) , self . ch . skill_busy . clone ( ) ) ;
} else {
let gone = self . state . skills . remove ( i ) ;
crate ::memory ::remove_skill_files ( & gone . name ) ;
self . dirty = true ;
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
brain recognises 「/name」 and adds a line after the message telling the model to read that skill
with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
/ 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
}
2026-11-17 09:43:09 +00:00
self . ch . skill_page = Page ::List ;
2026-11-16 15:01:35 +00:00
}
2026-11-17 09:43:09 +00:00
}
2026-11-11 08:19:06 +00:00
2026-11-17 09:43:09 +00:00
/// 瀏覽市集 (技能): the built-in packs, Anthropic's open skills, and installing from an address.
fn skill_market ( & mut self , ui : & mut egui ::Ui , ctx : & egui ::Context ) {
let p = self . pal ;
let skill_busy = self . ch . skill_busy . load ( Ordering ::SeqCst ) ;
2026-11-16 15:01:35 +00:00
// 技能市集: the same quiet rows — 加入/安裝 until it is in, then a grey 「已加入」.
section ( ui , " 內建技能包 " , p ) ;
let mut add_builtin = None ;
rows_card ( ui , p , | ui | {
2026-11-11 08:19:06 +00:00
for b in crate ::skills ::BUILTIN_SKILLS {
let added = self . state . skills . iter ( ) . any ( | s | s . name = = b . slug ) ;
2026-11-16 15:01:35 +00:00
// (A pack named the same as its title says it once.)
let about = if b . title = = b . slug { b . summary . to_string ( ) } else { format! ( " {} — {} " , b . title , b . summary ) } ;
card_row ( ui , p , b . slug , & about , " " , | ui | {
if added {
ui . label ( RichText ::new ( t ( " 已加入 " ) ) . size ( FONT_SM ) . color ( p . text3 ) ) ;
} else if ui . add ( secondary_button ( " 加入 " ) ) . clicked ( ) {
add_builtin = Some ( b . slug ) ;
}
} ) ;
2026-11-11 08:19:06 +00:00
}
2026-11-16 15:01:35 +00:00
} ) ;
if let Some ( slug ) = add_builtin {
2026-11-21 06:46:53 +00:00
self . skill_add_builtin ( slug ) ;
2026-11-16 15:01:35 +00:00
}
2026-11-11 08:19:06 +00:00
2026-11-16 15:01:35 +00:00
section ( ui , " Anthropic 開源技能 " , p ) ;
let mut install = None ;
rows_card ( ui , p , | ui | {
2026-11-11 08:19:06 +00:00
for r in crate ::skills ::REMOTE_MARKET {
let added = self . state . skills . iter ( ) . any ( | s | s . name = = r . name ) ;
2026-11-16 15:01:35 +00:00
// (The section already says whose: no 「Anthropic 官方:」 on every row.)
card_row ( ui , p , r . name , r . summary . trim_start_matches ( " Anthropic 官方: " ) , " " , | ui | {
if added {
ui . label ( RichText ::new ( t ( " 已加入 " ) ) . size ( FONT_SM ) . color ( p . text3 ) ) ;
} else if ui . add_enabled ( ! skill_busy , secondary_button ( " 安裝 " ) ) . clicked ( ) {
install = Some ( r . source . to_string ( ) ) ;
}
} ) ;
2026-11-11 08:19:06 +00:00
}
2026-11-16 15:01:35 +00:00
} ) ;
2026-11-11 08:19:06 +00:00
2026-11-16 15:01:35 +00:00
section ( ui , " 從 GitHub、網址或資料夾安裝 " , p ) ;
setting_card ( ui , p , | ui | {
2026-11-11 08:19:06 +00:00
ui . horizontal ( | ui | {
let btn_w = 72.0 ;
2026-11-16 15:01:35 +00:00
let w = ( ui . available_width ( ) - btn_w - crate ::theme ::sp ::S2 ) . max ( 120.0 ) ;
2026-11-11 08:19:06 +00:00
let resp = ui . add (
egui ::TextEdit ::singleline ( & mut self . ch . skill_src )
. hint_text ( t ( " https://github.com/anthropics/skills/tree/main/skills/… 或本機路徑 " ) )
. desired_width ( w )
. font ( egui ::TextStyle ::Monospace ) ,
) ;
let can_install = ! skill_busy & & ! self . ch . skill_src . trim ( ) . is_empty ( ) ;
let enter = resp . lost_focus ( ) & & ui . input ( | i | i . key_pressed ( egui ::Key ::Enter ) ) ;
if ui . add_enabled ( can_install , primary_button ( " 安裝 " , p ) ) . clicked ( ) | | ( can_install & & enter ) {
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
brain recognises 「/name」 and adds a line after the message telling the model to read that skill
with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
/ 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
install = Some ( std ::mem ::take ( & mut self . ch . skill_src ) ) ;
2026-11-11 08:19:06 +00:00
}
} ) ;
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
brain recognises 「/name」 and adds a line after the message telling the model to read that skill
with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
/ 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
if ! self . ch . skill_note_list {
skill_status ( ui , & self . ch , skill_busy , p ) ;
2026-11-11 08:19:06 +00:00
}
} ) ;
2026-11-16 15:01:35 +00:00
if let Some ( src ) = install {
self . skill_install ( src , ctx ) ;
}
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
}
}
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings
Permissions and reach
- a file leaving a computer passes the same questions as reading it;
"looking" shell commands that do more than look ask first
- a symlink out of the work/sealed folder counts as outside it
(real paths, not just lexical ones); the search walk skips links
- web_fetch and skill_install read the public web only: localhost, the
LAN and cloud metadata are refused, at every redirect
- preview shows a file without running it; browser_upload may ask
- vault: logins no longer match across shared suffixes (pages.dev,
com.tw, ...); registrable_domain knows public suffixes
- axwrite: found elements are retained (use-after-free)
Relay
- replacing or turning off 2FA needs the current code (rate-limited);
new recovery codes only count once enrollment is verified
- a removed computer loses its socket and its `call` access
- a site name taken by another account answers 409
- RELAY_TRUST_PROXY: the login lock counts the caller's address, not
the proxy's (compose files and README)
- httpd: half a body is not a request
Desktop
- sign-in, join and restore work with 2FA on (code field; --serve reads
ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code)
- Windows: text was typed twice; modifiers are held through click, drag
and scroll; horizontal scroll; screen control is no longer refused
- a recording that hits the limit is transcribed, not thrown away
- bot's computer: a new home volume restores the snapshot; a snapshot
is read through before the home is wiped; a failed volume removal
stops reset/restore
- events of a stopped turn no longer land in the next one; each channel
message gets a turn of its own
- saving a bot's settings keeps what it got meanwhile (three-way merge);
a save file that cannot be read is kept
- pages in Big5/GBK/Shift_JIS are read in their own encoding
(encoding_rs); osascript output past 64 KB no longer stalls
- pick_tab keeps a job's own non-http tab; pictures larger than the
texture limit are fitted; the auto-update time field takes typing
- skills live in <data>/skills; memories are unnumbered in the prompt;
the phone may skillify and skill_install
CI
- the test step fails when the tests fail (it piped into tail)
Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged.
Not run: Windows on a real machine (win.rs type-checked alone), the
Docker paths of the bot's computer, the live accessibility writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
2026-11-17 09:43:09 +00:00
/// A connector's tool in its page's list: the name, and one line of what it does (all of it
/// under the pointer).
fn tool_row ( ui : & mut egui ::Ui , p : Palette , name : & str , about : & str ) {
let top = ui . cursor ( ) . top ( ) ;
if top > ui . max_rect ( ) . top ( ) + 1.0 {
ui . painter ( ) . hline ( ui . max_rect ( ) . x_range ( ) , top , Stroke ::new ( 1.0 , p . border ) ) ;
}
let ( rect , resp ) = ui . allocate_exact_size ( vec2 ( ui . available_width ( ) , if about . is_empty ( ) { 36.0 } else { 48.0 } ) , egui ::Sense ::hover ( ) ) ;
let mut c = ui . new_child ( egui ::UiBuilder ::new ( ) . max_rect ( rect ) . layout ( Layout ::top_down ( Align ::Min ) ) ) ;
c . spacing_mut ( ) . item_spacing . y = 1.0 ;
c . add_space ( if about . is_empty ( ) { 9.0 } else { 7.0 } ) ;
c . add ( egui ::Label ::new ( RichText ::new ( name ) . monospace ( ) . size ( FONT_SM ) . color ( p . text ) ) . truncate ( ) . selectable ( false ) ) ;
if ! about . is_empty ( ) {
c . add ( egui ::Label ::new ( RichText ::new ( about . replace ( '\n' , " " ) ) . size ( FONT_XS ) . color ( p . text3 ) ) . truncate ( ) . selectable ( false ) ) ;
resp . on_hover_text ( about ) ;
}
}
/// 連接器 and 技能: which page of the tab is showing.
#[ derive(Clone, Debug, Default, PartialEq) ]
pub enum Page {
/// The list of what is added.
#[ default ]
List ,
/// One item's own page (by its name).
Item ( String ) ,
/// 瀏覽市集.
Market ,
/// 新增連接器 (技能 has none: its market installs).
Add ,
}
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
brain recognises 「/name」 and adds a line after the message telling the model to read that skill
with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
/ 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
impl App {
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone
- 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API):
servers reached by address only (a package would have to run on the brain, which may have no
Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name
that only says "mcp" (com.notion/mcp) reads as whose it is (notion).
- 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the
header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown
unmasked with what to put there (the key's description, an address variable's choices). 新增
stays off while a 「{…}」 is left.
- The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to
its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key
or the address part and the brain adds it (the 「mcp」 action's new `add`).
- A server that answers 401 (or a 403 asking for a login) with no key given now says it signs
people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old.
- mcpservers.org and the like are pages for people behind a browser check, with no list a program
may read, so the market uses the registry.
- Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own
server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`.
- Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
/// 公用市集: search the official MCP Registry (in the background) and list what it has that
/// is reached by address; 加入 fills 新增連接器 with the address and the header to complete.
fn registry_market ( & mut self , ui : & mut egui ::Ui , ctx : & egui ::Context ) {
let p = self . pal ;
ui . add_space ( 8.0 ) ;
field_label ( ui , " 公用市集(官方 MCP Registry) " , p ) ;
let busy = self . ch . reg_busy . load ( Ordering ::SeqCst ) ;
let mut go = false ;
ui . horizontal ( | ui | {
let w = ( ui . available_width ( ) - 72.0 - 8.0 ) . max ( 120.0 ) ;
let resp = ui . add ( egui ::TextEdit ::singleline ( & mut self . ch . reg_q ) . hint_text ( t ( " 搜尋用網址連的連接器,例如 notion、search、docs " ) ) . desired_width ( w ) ) ;
let can = ! busy & & ! self . ch . reg_q . trim ( ) . is_empty ( ) ;
let enter = resp . lost_focus ( ) & & ui . input ( | i | i . key_pressed ( egui ::Key ::Enter ) ) ;
go = ui . add_enabled ( can , primary_button ( " 搜尋 " , p ) ) . clicked ( ) | | ( can & & enter ) ;
} ) ;
if go {
self . ch . reg_busy . store ( true , Ordering ::SeqCst ) ;
let ( q , busy , found , ctx ) = ( self . ch . reg_q . clone ( ) , self . ch . reg_busy . clone ( ) , self . ch . reg_found . clone ( ) , ctx . clone ( ) ) ;
std ::thread ::spawn ( move | | {
* found . lock ( ) . unwrap ( ) = Some ( crate ::mcp ::registry_search ( & q ) ) ;
busy . store ( false , Ordering ::SeqCst ) ;
ctx . request_repaint ( ) ;
} ) ;
}
if busy {
ui . label ( RichText ::new ( t ( " 搜尋中… " ) ) . size ( FONT_XS ) . color ( p . text3 ) ) ;
return ;
}
let found = self . ch . reg_found . lock ( ) . unwrap ( ) . clone ( ) ;
let list = match found {
None = > return ,
Some ( Err ( e ) ) = > {
ui . label ( RichText ::new ( e ) . size ( FONT_XS ) . color ( p . danger ) ) ;
return ;
}
Some ( Ok ( list ) ) if list . is_empty ( ) = > {
ui . label ( RichText ::new ( t ( " 沒有找到。換個關鍵字試試(英文的比較多)。 " ) ) . size ( FONT_XS ) . color ( p . text3 ) ) ;
return ;
}
Some ( Ok ( list ) ) = > list ,
} ;
let mut pick = None ;
for ( i , e ) in list . iter ( ) . enumerate ( ) {
let ( title , about , url , note ) = ( e [ " title " ] . as_str ( ) . unwrap_or ( " " ) , e [ " description " ] . as_str ( ) . unwrap_or ( " " ) , e [ " url " ] . as_str ( ) . unwrap_or ( " " ) , e [ " note " ] . as_str ( ) . unwrap_or ( " " ) ) ;
let added = self . state . mcp_servers . iter ( ) . any ( | s | s . url = = url ) ;
listing_row (
ui ,
| ui | {
if ! note . is_empty ( ) {
2026-11-16 13:51:30 +00:00
ui . label ( RichText ::new ( t ( note ) ) . size ( FONT_XS ) . color ( p . text3 ) ) ;
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone
- 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API):
servers reached by address only (a package would have to run on the brain, which may have no
Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name
that only says "mcp" (com.notion/mcp) reads as whose it is (notion).
- 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the
header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown
unmasked with what to put there (the key's description, an address variable's choices). 新增
stays off while a 「{…}」 is left.
- The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to
its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key
or the address part and the brain adds it (the 「mcp」 action's new `add`).
- A server that answers 401 (or a 403 asking for a login) with no key given now says it signs
people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old.
- mcpservers.org and the like are pages for people behind a browser check, with no list a program
may read, so the market uses the registry.
- Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own
server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`.
- Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
} else if added {
2026-11-16 13:51:30 +00:00
ui . label ( RichText ::new ( t ( " 已加入 " ) ) . size ( FONT_XS ) . color ( p . text3 ) ) ;
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone
- 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API):
servers reached by address only (a package would have to run on the brain, which may have no
Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name
that only says "mcp" (com.notion/mcp) reads as whose it is (notion).
- 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the
header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown
unmasked with what to put there (the key's description, an address variable's choices). 新增
stays off while a 「{…}」 is left.
- The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to
its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key
or the address part and the brain adds it (the 「mcp」 action's new `add`).
- A server that answers 401 (or a 403 asking for a login) with no key given now says it signs
people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old.
- mcpservers.org and the like are pages for people behind a browser check, with no list a program
may read, so the market uses the registry.
- Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own
server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`.
- Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
} else if ui . add ( secondary_button ( " 加入 " ) ) . clicked ( ) {
pick = Some ( i ) ;
}
} ,
| ui | {
外觀: 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
ui . label ( RichText ::new ( title ) . strong ( ) . family ( crate ::bold ( ) ) . size ( FONT_SM ) ) ;
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone
- 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API):
servers reached by address only (a package would have to run on the brain, which may have no
Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name
that only says "mcp" (com.notion/mcp) reads as whose it is (notion).
- 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the
header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown
unmasked with what to put there (the key's description, an address variable's choices). 新增
stays off while a 「{…}」 is left.
- The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to
its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key
or the address part and the brain adds it (the 「mcp」 action's new `add`).
- A server that answers 401 (or a 403 asking for a login) with no key given now says it signs
people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old.
- mcpservers.org and the like are pages for people behind a browser check, with no list a program
may read, so the market uses the registry.
- Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own
server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`.
- Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
if e [ " header " ] . is_object ( ) {
2026-11-16 13:51:30 +00:00
ui . label ( RichText ::new ( t ( " 要金鑰 " ) ) . size ( FONT_XS ) . color ( p . accent ) ) ;
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone
- 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API):
servers reached by address only (a package would have to run on the brain, which may have no
Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name
that only says "mcp" (com.notion/mcp) reads as whose it is (notion).
- 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the
header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown
unmasked with what to put there (the key's description, an address variable's choices). 新增
stays off while a 「{…}」 is left.
- The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to
its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key
or the address part and the brain adds it (the 「mcp」 action's new `add`).
- A server that answers 401 (or a 403 asking for a login) with no key given now says it signs
people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old.
- mcpservers.org and the like are pages for people behind a browser check, with no list a program
may read, so the market uses the registry.
- Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own
server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`.
- Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
}
ui . add ( egui ::Label ::new ( RichText ::new ( about ) . size ( FONT_XS ) . color ( p . text3 ) ) . truncate ( ) ) . on_hover_text ( format! ( " {about} \n {url} " ) ) ;
} ,
) ;
}
if let Some ( e ) = pick . and_then ( | i | list . get ( i ) ) {
let ( name , url , header , hint ) = crate ::mcp ::registry_form ( e , & self . state . mcp_servers ) ;
self . ch . new_mcp = ( name , url , String ::new ( ) , header ) ;
self . ch . new_mcp_hint = hint ;
2026-11-17 09:43:09 +00:00
self . ch . mcp_page = Page ::Add ;
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone
- 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API):
servers reached by address only (a package would have to run on the brain, which may have no
Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name
that only says "mcp" (com.notion/mcp) reads as whose it is (notion).
- 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the
header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown
unmasked with what to put there (the key's description, an address variable's choices). 新增
stays off while a 「{…}」 is left.
- The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to
its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key
or the address part and the brain adds it (the 「mcp」 action's new `add`).
- A server that answers 401 (or a 403 asking for a login) with no key given now says it signs
people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old.
- mcpservers.org and the like are pages for people behind a browser check, with no list a program
may read, so the market uses the registry.
- Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own
server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`.
- Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
}
}
/// Screenshot mode: the 公用市集 with this search done.
pub ( super ) fn shot_registry ( & mut self , q : & str ) {
self . ch . reg_q = q . to_string ( ) ;
* self . ch . reg_found . lock ( ) . unwrap ( ) = Some ( crate ::mcp ::registry_search ( q ) ) ;
}
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
brain recognises 「/name」 and adds a line after the message telling the model to read that skill
with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
/ 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
/// Install a skill from an address or a folder. On a screen the brain does it — it fetches
/// an address itself, and a folder on this computer goes up whole — since the bots read skills
/// from the brain's disk. Otherwise it is fetched in the background and the list reloads.
2026-11-21 06:46:53 +00:00
/// 連接器市集's 加入 (here and in the 市集 window): one that needs nothing is added; one that
/// needs a key or a login opens 新增連接器 filled in — true then.
pub ( super ) fn mcp_market_add ( & mut self , name : & str , cmd : & str , needs : & str ) -> bool {
if needs . is_empty ( ) {
self . state . mcp_servers . push ( crate ::mcp ::market_server ( name , cmd ) ) ;
self . dirty = true ;
return false ;
}
let remote = cmd . starts_with ( " http " ) ;
self . ch . new_mcp = ( name . to_string ( ) , cmd . to_string ( ) , if remote { String ::new ( ) } else { needs . to_string ( ) } , if remote { needs . to_string ( ) } else { String ::new ( ) } ) ;
self . ch . mcp_page = Page ::Add ;
true
}
/// 內建技能包's 加入 (here and in the 市集 window); on a screen the brain adds it.
pub ( super ) fn skill_add_builtin ( & mut self , slug : & str ) {
self . ch . skill_note_list = false ;
if self . mir . on {
self . mirror_skill ( serde_json ::json! ( { " builtin " : slug } ) , self . ch . skill_note . clone ( ) , self . ch . skill_busy . clone ( ) ) ;
} else {
match crate ::skills ::install_builtin ( slug , & mut self . state . skills ) {
Ok ( name ) = > {
* self . ch . skill_note . lock ( ) . unwrap ( ) = Some ( ( true , format! ( " 已加入技能「 {name} 」 " ) ) ) ;
self . dirty = true ;
}
Err ( e ) = > * self . ch . skill_note . lock ( ) . unwrap ( ) = Some ( ( false , e ) ) ,
}
}
}
pub ( super ) fn skill_install ( & mut self , src : String , ctx : & egui ::Context ) {
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
brain recognises 「/name」 and adds a line after the message telling the model to read that skill
with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
/ 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
self . ch . skill_note_list = false ;
let ( busy , note ) = ( self . ch . skill_busy . clone ( ) , self . ch . skill_note . clone ( ) ) ;
let src = src . trim ( ) . to_string ( ) ;
if self . mir . on {
let body = if crate ::tools ::expand_home ( & src ) . exists ( ) { serde_json ::json! ( { " local " : src } ) } else { serde_json ::json! ( { " install " : src } ) } ;
self . mirror_skill ( body , note , busy ) ;
return ;
}
if busy . swap ( true , Ordering ::SeqCst ) {
return ;
}
* note . lock ( ) . unwrap ( ) = None ;
let ( reload , ctx ) = ( self . ch . skill_reload . clone ( ) , ctx . clone ( ) ) ;
std ::thread ::spawn ( move | | {
* note . lock ( ) . unwrap ( ) = Some ( match crate ::skills ::install_from_source ( & src ) {
Ok ( name ) = > {
reload . store ( true , Ordering ::SeqCst ) ;
( true , format! ( " 已安裝技能「 {name} 」 " ) )
}
Err ( e ) = > ( false , e ) ,
} ) ;
busy . store ( false , Ordering ::SeqCst ) ;
ctx . request_repaint ( ) ;
} ) ;
}
}
/// How the last skill request went (or that it is still on its way).
fn skill_status ( ui : & mut egui ::Ui , ch : & ChannelUi , busy : bool , p : Palette ) {
if busy {
ui . label ( RichText ::new ( t ( " 處理中… " ) ) . size ( FONT_XS ) . color ( p . text3 ) ) ;
} else if let Some ( ( ok , msg ) ) = ch . skill_note . lock ( ) . unwrap ( ) . clone ( ) {
2026-11-16 14:07:07 +00:00
ui . label ( RichText ::new ( msg ) . size ( FONT_XS ) . color ( if ok { p . up } else { p . danger } ) ) ;
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
brain recognises 「/name」 and adds a line after the message telling the model to read that skill
with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
/ 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
}
}
2026-11-16 15:01:35 +00:00
/// How tall a looked-at skill's instructions get before they scroll.
const SKILL_BODY_HEIGHT : f32 = 240.0 ;
/// One skill looked at, under its row: all of what it is, its files, its instructions, and at
/// the end 刪除 — red words that ask 「確定刪除」 first (it goes with its folder, for good).
/// True when the second press came.
fn skill_detail ( ui : & mut egui ::Ui , p : Palette , k : & crate ::memory ::Skill , confirm : & mut Option < String > ) -> bool {
let mut gone = false ;
ui . add_space ( crate ::theme ::sp ::S1 ) ;
if ! k . description . trim ( ) . is_empty ( ) {
ui . add ( egui ::Label ::new ( RichText ::new ( & k . description ) . size ( FONT_SM ) . color ( p . text2 ) ) . wrap ( ) ) ;
}
if ! k . steps . is_empty ( ) {
ui . add_space ( crate ::theme ::sp ::S1 ) ;
ui . label ( RichText ::new ( t ( " 可重播 {n} 步 " ) . replace ( " {n} " , & k . steps . len ( ) . to_string ( ) ) ) . size ( FONT_SM ) . color ( p . text3 ) ) ;
}
if ! k . resources . is_empty ( ) {
field_label ( ui , " 隨附檔案 " , p ) ;
ui . add ( egui ::Label ::new ( RichText ::new ( k . resources . join ( " 、 " ) ) . monospace ( ) . size ( FONT_SM ) . color ( p . text2 ) ) . wrap ( ) ) ;
}
field_label ( ui , " 內容 " , p ) ;
let preview : String = k . instructions . chars ( ) . take ( 1800 ) . collect ( ) ;
// In a quiet tray that scrolls on its own, so 刪除 stays near (a skill runs to pages).
Frame ::new ( ) . fill ( p . muted ) . corner_radius ( R_M ) . inner_margin ( Margin ::symmetric ( 12 , 10 ) ) . show ( ui , | ui | {
egui ::ScrollArea ::vertical ( ) . id_salt ( ( " skill-body " , & k . name ) ) . max_height ( SKILL_BODY_HEIGHT ) . auto_shrink ( [ false , true ] ) . show ( ui , | ui | {
ui . add ( egui ::Label ::new ( RichText ::new ( preview ) . size ( FONT_SM ) . color ( p . text2 ) ) . wrap ( ) ) ;
} ) ;
} ) ;
ui . add_space ( crate ::theme ::sp ::S3 ) ;
ui . horizontal ( | ui | {
if confirm . as_deref ( ) = = Some ( k . name . as_str ( ) ) {
if ui . add ( egui ::Button ::new ( RichText ::new ( t ( " 確定刪除 " ) ) . color ( p . danger ) ) . frame ( false ) ) . on_hover_text ( t ( " 連同它的資料夾( scripts 等)一起刪掉,不能復原 " ) ) . clicked ( ) {
gone = true ;
* confirm = None ;
}
if ui . add ( egui ::Button ::new ( RichText ::new ( t ( " 取消 " ) ) . color ( p . text2 ) ) . frame ( false ) ) . clicked ( ) {
* confirm = None ;
}
} else if ui . add ( egui ::Button ::new ( RichText ::new ( t ( " 刪除 " ) ) . color ( p . danger ) ) . frame ( false ) ) . clicked ( ) {
* confirm = Some ( k . name . clone ( ) ) ;
}
} ) ;
ui . add_space ( crate ::theme ::sp ::S3 ) ;
gone
}
連接器: a 公用市集 of remote servers from the official MCP Registry, on the computer and the phone
- 連接器市集 gets a search box over registry.modelcontextprotocol.io (public, with an API):
servers reached by address only (a package would have to run on the brain, which may have no
Node or uv); old SSE ones are marked as not yet supported, taken-down ones left out. A name
that only says "mcp" (com.notion/mcp) reads as whose it is (notion).
- 加入 on the computer fills 新增連接器 and scrolls to it: a free name, the address, and the
header with the registry's placeholder ("Authorization: Bearer {smithery_api_key}"), shown
unmasked with what to put there (the key's description, an address variable's choices). 新增
stays off while a 「{…}」 is left.
- The phone: 設定 › 整合 › 從公用市集加入. The brain searches (the phone's page may only talk to
its own server; GET /api/mcp/registry, owner only, on the HTTP thread); a pick asks for the key
or the address part and the brain adds it (the 「mcp」 action's new `add`).
- A server that answers 401 (or a 403 asking for a login) with no key given now says it signs
people in with OAuth, which AnyBot can't do yet; with a key, that the key is wrong or old.
- mcpservers.org and the like are pages for people behind a browser check, with no list a program
may read, so the market uses the registry.
- Checked live: 「notion」 finds 6; AWS Knowledge (no key) connects with 5 tools; Notion's own
server (OAuth) gives the OAuth sentence. `cargo test -- --ignored registry_search_live`.
- Screenshot mode: ANYBOT_SHOT_MCP=<search> shows the 公用市集 after that search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:12:12 +00:00
/// What a 公用市集 search found (rows as `mcp::registry_entries` gives them), or why it failed.
type RegistryAnswer = Result < Vec < serde_json ::Value > , String > ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
/// A channel kind's mark: its first letter on a quiet tint of its own (no logos).
fn kind_tile ( ui : & egui ::Ui , rect : egui ::Rect , k : Kind , p : Palette ) {
let ( letter , rgb ) : ( & str , [ u8 ; 3 ] ) = match k {
Kind ::Telegram = > ( " T " , [ 0x0f , 0x4c , 0x8a ] ) ,
Kind ::Slack = > ( " S " , [ 0x5b , 0x2a , 0x86 ] ) ,
Kind ::Discord = > ( " D " , [ 0x3a , 0x3f , 0x9e ] ) ,
Kind ::Teams = > ( " M " , [ 0x43 , 0x38 , 0xa8 ] ) ,
Kind ::IMessage = > ( " 訊 " , [ 0x0b , 0x6b , 0x3d ] ) ,
Kind ::Email = > ( " 郵 " , [ 0x9a , 0x34 , 0x12 ] ) ,
Kind ::Sms = > ( " 簡 " , [ 0xa1 , 0x1d , 0x2b ] ) ,
Kind ::X = > ( " X " , [ 0x1c , 0x1c , 0x1c ] ) ,
} ;
let ink = Color32 ::from_rgb ( rgb [ 0 ] , rgb [ 1 ] , rgb [ 2 ] ) ;
let dark = p . pane . r ( ) < 128 ;
2026-11-16 13:51:30 +00:00
ui . painter ( ) . rect_filled ( rect , R_M , crate ::theme ::mist ( ink , Palette { pane : if dark { Color32 ::from_rgb ( 0x30 , 0x30 , 0x30 ) } else { Color32 ::WHITE } , .. p } ) . gamma_multiply ( 1.0 ) ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
let col = if dark { Color32 ::from_rgb ( 0xf0 , 0xf0 , 0xf0 ) } else { ink } ;
2026-11-16 13:51:30 +00:00
ui . painter ( ) . text ( rect . center ( ) , egui ::Align2 ::CENTER_CENTER , letter , egui ::FontId ::new ( FONT_BASE , crate ::bold ( ) ) , col ) ;
設定: 一般 and 整合 as drawn — white cards of rows, word-only pages, 整合 in three pages with the form behind a tile
- cards are white with a hairline edge; group titles small and grey; the page list is words only, the chosen
page in ink
- 聊天的顏色 is two dots (the bots' colours, black); switches are ink with a white knob
- 整合 is three pages (訊息管道, 連接器, 技能) instead of one long scroll
- 訊息管道: 已連接 lists each channel on a line (its mark, name · kind, who answers, how it stands, the switch,
⋯ to remove); 新增管道 is a grid of kinds, and a press opens that kind's form below (取消 closes it)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-11 14:10:44 +00:00
}
技能: / in the input picks one; on a brain's screen the brain adds, installs and deletes them; 設定 › 整合's lists keep their buttons clear
- Typing / at the start of the input (computer and phone) lists the skills that are on: names that
start with what is typed first, then names containing it, then descriptions (「/簡報」 finds
pptx). A click, or ↑↓ and Enter/Tab, puts 「/name 」 in the input; Esc closes the list. Sent, the
brain recognises 「/name」 and adds a line after the message telling the model to read that skill
with use_skill first, so a phone or a message channel gets it too; a / that names no skill (a
path) gets nothing. The phone asks the brain for the list again at each new /, so a skill added
since is there.
- On a screen, 加入 / 安裝 / 刪除 ran on the screen's own disk and only the list entry reached the
brain: a GitHub skill's scripts stayed on the screen's computer, an install also pushed every
skill in that computer's folder into the brain's list, and a deleted skill's folder stayed on the
brain and came back at its next start. These now go to the brain (/api/sync/skill, the phone's
own 「skill」 action): it fetches an address itself, a folder or .md file on the screen's
computer goes up whole with its files, and a delete takes the folder too. 「把這台的 Bot 搬到大腦」
hands over skills the same way. A refused package leaves no folder behind.
- 技能, 技能市集 and 連接器市集 rows: a long description took the whole row and 開啟 / 檢視 / 刪除
/ 已加入 / 安裝 were drawn over it. The buttons are laid out first and the description ends in …
before them (the whole of it on hover).
- Screenshot mode: ANYBOT_SHOT_KEYS="ArrowDown@60;Enter@64" presses keys at given frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:54:58 +00:00
/// One line of a list: its buttons on the right (`buttons` adds them rightmost first), and the
/// words on the left in the room that is left — a long description ends in … before the
/// buttons instead of running under them.
fn listing_row ( ui : & mut egui ::Ui , buttons : impl FnOnce ( & mut egui ::Ui ) , words : impl FnOnce ( & mut egui ::Ui ) ) {
ui . horizontal ( | ui | {
ui . with_layout ( Layout ::right_to_left ( Align ::Center ) , | ui | {
buttons ( ui ) ;
ui . with_layout ( Layout ::left_to_right ( Align ::Center ) , words ) ;
} ) ;
} ) ;
}
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings
Permissions and reach
- a file leaving a computer passes the same questions as reading it;
"looking" shell commands that do more than look ask first
- a symlink out of the work/sealed folder counts as outside it
(real paths, not just lexical ones); the search walk skips links
- web_fetch and skill_install read the public web only: localhost, the
LAN and cloud metadata are refused, at every redirect
- preview shows a file without running it; browser_upload may ask
- vault: logins no longer match across shared suffixes (pages.dev,
com.tw, ...); registrable_domain knows public suffixes
- axwrite: found elements are retained (use-after-free)
Relay
- replacing or turning off 2FA needs the current code (rate-limited);
new recovery codes only count once enrollment is verified
- a removed computer loses its socket and its `call` access
- a site name taken by another account answers 409
- RELAY_TRUST_PROXY: the login lock counts the caller's address, not
the proxy's (compose files and README)
- httpd: half a body is not a request
Desktop
- sign-in, join and restore work with 2FA on (code field; --serve reads
ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code)
- Windows: text was typed twice; modifiers are held through click, drag
and scroll; horizontal scroll; screen control is no longer refused
- a recording that hits the limit is transcribed, not thrown away
- bot's computer: a new home volume restores the snapshot; a snapshot
is read through before the home is wiped; a failed volume removal
stops reset/restore
- events of a stopped turn no longer land in the next one; each channel
message gets a turn of its own
- saving a bot's settings keeps what it got meanwhile (three-way merge);
a save file that cannot be read is kept
- pages in Big5/GBK/Shift_JIS are read in their own encoding
(encoding_rs); osascript output past 64 KB no longer stalls
- pick_tab keeps a job's own non-http tab; pictures larger than the
texture limit are fitted; the auto-update time field takes typing
- skills live in <data>/skills; memories are unnumbered in the prompt;
the phone may skillify and skill_install
CI
- the test step fails when the tests fail (it piped into tail)
Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged.
Not run: Windows on a real machine (win.rs type-checked alone), the
Docker paths of the bot's computer, the live accessibility writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
#[ cfg(test) ]
mod tests {
use super ::* ;
/// A message from a channel never joins a turn that is running: it waits for its own.
#[ test ]
fn a_channel_message_waits_for_a_turn_of_its_own ( ) {
let msg = | bot_id : u64 , text : & str | Incoming { bot_id , from : " ann " . into ( ) , text : text . into ( ) , reply : ReplyTo { kind : Kind ::Telegram , token : String ::new ( ) , target : " 1 " . into ( ) , thread : String ::new ( ) , channel_name : " c " . into ( ) } } ;
let texts = | v : & [ Incoming ] | v . iter ( ) . map ( | m | m . text . clone ( ) ) . collect ::< Vec < _ > > ( ) ;
let mut waiting : VecDeque < Incoming > = [ msg ( 1 , " a " ) , msg ( 2 , " b " ) , msg ( 1 , " c " ) , msg ( 3 , " d " ) ] . into ( ) ;
// Bot 2 is in the middle of the person's own question: its message stays.
let ready = ready_messages ( & mut waiting , | id | id = = 2 ) ;
assert_eq! ( texts ( & ready ) , [ " a " , " d " ] ) ;
assert_eq! ( texts ( & waiting . iter ( ) . cloned ( ) . collect ::< Vec < _ > > ( ) ) , [ " b " , " c " ] ) ;
// Later, everyone is free: one message each, the oldest first.
let ready = ready_messages ( & mut waiting , | _ | false ) ;
assert_eq! ( texts ( & ready ) , [ " b " , " c " ] ) ;
assert! ( waiting . is_empty ( ) ) ;
}
}