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
// 保險庫 / 1Password / 安全表單: the bot can sign in to a site in AnyBot's browser without ever
// seeing the password (the original keeps logins in a vault and fills them through a secure
// form; it also connects to 1Password). The login comes from the macOS Keychain (AnyBot's own
// saved logins or any internet password there) or the 1Password CLI (`op`), and is typed into
// the page by AnyBot; the model only hears that it was filled.
use serde_json ::Value ;
use std ::process ::Command ;
pub const TOOL : & str = " browser_fill_login " ;
/// Keychain entries AnyBot saves are marked with this label.
const LABEL : & str = " AnyBot 登入 " ;
pub const LIST_TOOL : & str = " vault_list " ;
pub const CARD_TOOL : & str = " browser_fill_card " ;
pub const CONTACT_TOOL : & str = " browser_fill_contact " ;
2026-11-12 14:53:30 +00:00
/// The vault's internal tool: the mechanical fill on the computer that has the browser. The
/// brain plans (the vault store stays there), the person approves, and one entry's secret
/// rides this one command over the account's encrypted relay to the person's own computer;
/// the script there spends it only on the page it belongs to (the host guard bails out when
/// the page changed). Never offered to the model: only AnyBot-to-AnyBot.
pub const REMOTE_TOOL : & str = " browser_vault_fill " ;
/// One vault step on this machine's browser. kind: "host" — the current tab (for the brain's
/// plan); "login" — username/password into the login page; "form" — card/contact values from
/// the brain into the form. Answers {ok, page}, {ok, url, host} or {ok:false, text}.
pub fn run_remote ( args : & str ) -> Value {
let v = crate ::tools ::args_of ( args ) ;
let profile = profile_of ( & v ) ;
let ran = | js : & str | -> Value {
match crate ::botbrowser ::eval_current ( profile . as_deref ( ) , js ) {
Ok ( ( _ , r ) ) = > serde_json ::json! ( { " ok " : true , " page " : r . as_str ( ) . and_then ( | s | serde_json ::from_str ::< Value > ( s ) . ok ( ) ) . unwrap_or ( Value ::Null ) } ) ,
Err ( e ) = > serde_json ::json! ( { " ok " : false , " text " : e } ) ,
}
} ;
match v [ " kind " ] . as_str ( ) . unwrap_or ( " " ) {
" host " = > match crate ::botbrowser ::eval_current ( profile . as_deref ( ) , " 1 " ) {
Ok ( ( url , _ ) ) = > serde_json ::json! ( { " ok " : true , " url " : url , " host " : host_of ( & url ) } ) ,
Err ( e ) = > serde_json ::json! ( { " ok " : false , " text " : e } ) ,
} ,
" login " = > ran ( & fill_script_for_host ( v [ " username " ] . as_str ( ) . unwrap_or ( " " ) , v [ " password " ] . as_str ( ) . unwrap_or ( " " ) , v [ " submit " ] . as_bool ( ) . unwrap_or ( false ) , v [ " site " ] . as_str ( ) ) ) ,
" form " = > ran ( & form_fill_script_for_host ( & v [ " values " ] , v [ " site " ] . as_str ( ) , v [ " https " ] . as_bool ( ) . unwrap_or ( false ) ) ) ,
other = > serde_json ::json! ( { " ok " : false , " text " : format ! ( " 不懂的保險庫填入種類「{other}」 " ) } ) ,
}
}
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-14 08:21:32 +00:00
/// What the vault can fill right now (on the brain, where the vault lives). A kind with nothing
/// behind it isn't offered: a bot that patrols Threads with an empty vault was handed three fill
/// tools anyway, and a small model kept "accidentally" calling them — 171 failed fills in one
/// turn, each answered with "open a tab first", which sent it round again.
#[ derive(Clone, Copy, Debug, Default, PartialEq, Eq) ]
pub struct Offer {
pub login : bool ,
pub card : bool ,
pub contact : bool ,
}
impl Offer {
/// From the kinds saved in the vault, and whether logins can also come from elsewhere
/// (the macOS Keychain, the 1Password CLI).
pub fn from_kinds ( kinds : & [ crate ::vault_store ::Kind ] , logins_elsewhere : bool ) -> Offer {
use crate ::vault_store ::Kind ;
Offer { login : logins_elsewhere | | kinds . contains ( & Kind ::Login ) , card : kinds . contains ( & Kind ::Card ) , contact : kinds . contains ( & Kind ::Contact ) }
}
pub fn any ( & self ) -> bool {
self . login | | self . card | | self . contact
}
/// The kinds the browser tool's `fill` action may name.
pub fn kinds ( & self ) -> Vec < & 'static str > {
[ ( " login " , self . login ) , ( " card " , self . card ) , ( " contact " , self . contact ) ] . into_iter ( ) . filter ( | k | k . 1 ) . map ( | k | k . 0 ) . collect ( )
}
}
/// What this computer's vault (and keychain / 1Password) can fill now.
pub fn offer ( ) -> Offer {
let kinds : Vec < crate ::vault_store ::Kind > = crate ::vault_store ::list ( ) . map ( | l | l . into_iter ( ) . map ( | i | i . kind ) . collect ( ) ) . unwrap_or_default ( ) ;
Offer ::from_kinds ( & kinds , cfg! ( target_os = " macos " ) | | op_installed ( ) )
}
/// The 1Password CLI is on the tools' PATH.
fn op_installed ( ) -> bool {
let exe = if cfg! ( windows ) { " op.exe " } else { " op " } ;
crate ::cloudbox ::tool_path ( ) . split ( if cfg! ( windows ) { ';' } else { ':' } ) . filter ( | d | ! d . is_empty ( ) ) . any ( | d | std ::path ::Path ::new ( d ) . join ( exe ) . is_file ( ) )
}
/// The vault tools the bot gets (with AnyBot's browser): only for what there is to fill.
pub fn specs_for ( offer : & Offer ) -> Vec < Value > {
if ! offer . any ( ) {
return vec! [ ] ;
}
let mut v = vec! [ serde_json ::json! ( { " name " : LIST_TOOL , " description " : " List what the person saved in AnyBot's 保險庫 (vault): logins (site, username, notes — never the password), payment cards (nickname, brand, last 4 digits, expiry — never the number or security code) and contact info (name, address, phones, emails). Notes say when to use an item. Use the ids with the browser tool's fill action. Only for signing in, paying or filling an address — never for typing into a page (that is the browser tool's type). " ,
" parameters " : { " type " : " object " , " properties " : { " kind " : { " type " : " string " , " enum " : [ " all " , " login " , " card " , " contact " ] } , " query " : { " type " : " string " , " description " : " Words to search for " } } } } ) ] ;
if offer . login {
v . push ( serde_json ::json! ( { " name " : TOOL , " description " : " Sign in on the current tab of AnyBot's browser with a login from the person's vault (or the macOS Keychain / 1Password). You never see the password; the person approves each use. Open the login page with browser_open first; after filling, press the page's sign-in button (computer_use or ask the person) and check with browser_read. " ,
" parameters " : { " type " : " object " , " properties " : { " login_id " : { " type " : " string " , " description " : " From vault_list (default: the saved login for the current site) " } , " site " : { " type " : " string " , " description " : " Domain to use (default: the current tab's) " } , " submit " : { " type " : " boolean " , " description " : " Also submit the form " } } } } ) ) ;
}
if offer . card {
v . push ( serde_json ::json! ( { " name " : CARD_TOOL , " description " : " Fill a saved payment card into the checkout form on the current tab of AnyBot's browser (card number, expiry, security code, name). You never see the number or security code; the person approves every use. Card fields inside a payment provider's frame may need the person's help. Never submit a payment without the person saying so. " ,
" parameters " : { " type " : " object " , " properties " : { " card_id " : { " type " : " string " , " description " : " From vault_list " } } , " required " : [ " card_id " ] } } ) ) ;
}
if offer . contact {
v . push ( serde_json ::json! ( { " name " : CONTACT_TOOL , " description " : " Fill saved contact info (name, address, phone, email) into the form on the current tab of AnyBot's browser, e.g. a shipping or billing address. " ,
" parameters " : { " type " : " object " , " properties " : { " contact_id " : { " type " : " string " , " description " : " From vault_list " } } , " required " : [ " contact_id " ] } } ) ) ;
}
v
}
/// A fill that names an item the vault doesn't have is answered at once — before the browser is
/// touched, so the answer is about the item and not about tabs — in words that send the bot to
/// the tool it meant (it usually wanted to type into the page).
pub fn check_ids ( tool : & str , args : & str ) -> Result < ( ) , String > {
let items = crate ::vault_store ::list ( ) . unwrap_or_default ( ) ;
check_ids_in ( tool , args , & items . iter ( ) . map ( | i | ( i . id . as_str ( ) , i . kind ) ) . collect ::< Vec < _ > > ( ) )
}
pub ( crate ) fn check_ids_in ( tool : & str , args : & str , items : & [ ( & str , crate ::vault_store ::Kind ) ] ) -> Result < ( ) , String > {
use crate ::vault_store ::Kind ;
let v = crate ::tools ::args_of ( args ) ;
let ( field , kind , what ) = match tool {
CARD_TOOL = > ( " card_id " , Kind ::Card , " 付款卡 " ) ,
CONTACT_TOOL = > ( " contact_id " , Kind ::Contact , " 聯絡資訊 " ) ,
_ = > ( " login_id " , Kind ::Login , " 登入資訊 " ) ,
} ;
let id = v [ field ] . as_str ( ) . unwrap_or ( " " ) . trim ( ) ;
// A login without an id is looked up by the page's site (and the keychain / 1Password).
if tool = = TOOL & & id . is_empty ( ) {
return Ok ( ( ) ) ;
}
if items . iter ( ) . any ( | ( i , k ) | * i = = id & & * k = = kind ) {
return Ok ( ( ) ) ;
}
let not_this = " 這個工具只把使用者存在保險庫的帳密、卡號或地址填進表單,不是用來在網頁上打字。要在輸入框打字請用 browser 的 action=type( value 是要打的字),要開網址用 action=open。 " ;
Err ( if items . iter ( ) . any ( | ( _ , k ) | * k = = kind ) {
format! ( " 沒有執行:保險庫裡沒有 id 為「 {id} 」的 {what} (先用 vault_list 看 id) 。 {not_this} " )
} else {
format! ( " 沒有執行:保險庫裡沒有存任何 {what} ,這一步用不上。 {not_this} " )
} )
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
}
/// vault_list: what the bot may know (no passwords, card numbers or security codes).
pub fn list_for_bot ( args : & str ) -> String {
use crate ::vault_store ::Kind ;
let v : Value = serde_json ::from_str ( if args . trim ( ) . is_empty ( ) { " {} " } else { args } ) . unwrap_or_default ( ) ;
let kind = v [ " kind " ] . as_str ( ) . unwrap_or ( " all " ) ;
let q = v [ " query " ] . as_str ( ) . unwrap_or ( " " ) . trim ( ) . to_lowercase ( ) ;
let items = match crate ::vault_store ::list ( ) {
Ok ( i ) = > i ,
Err ( e ) = > return format! ( " 讀不到保險庫: {e} " ) ,
} ;
let rows : Vec < Value > = items
. iter ( )
. filter ( | i | match kind {
" login " = > i . kind = = Kind ::Login ,
" card " = > i . kind = = Kind ::Card ,
" contact " = > i . kind = = Kind ::Contact ,
_ = > true ,
} )
. filter ( | i | q . is_empty ( ) | | i . haystack ( ) . contains ( & q ) )
. map ( | i | match i . kind {
Kind ::Login = > serde_json ::json! ( { " id " : i . id , " kind " : " login " , " title " : i . display_title ( ) , " sites " : i . sites , " username " : i . username , " notes " : i . notes } ) ,
Kind ::Card = > serde_json ::json! ( { " id " : i . id , " kind " : " card " , " title " : i . display_title ( ) , " brand " : i . brand , " last4 " : i . last4 , " expiry " : format ! ( " {:02}/{} " , i . exp_month , i . exp_year % 100 ) , " holder " : i . holder , " billing_address " : i . billing . one_line ( ) , " notes " : i . notes } ) ,
Kind ::Contact = > serde_json ::json! ( { " id " : i . id , " kind " : " contact " , " label " : i . title , " name " : i . name , " address " : { " line1 " : i . address . line1 , " line2 " : i . address . line2 , " city " : i . address . city , " region " : i . address . region , " postal_code " : i . address . postal , " country " : i . address . country } , " phones " : i . phones , " emails " : i . emails , " notes " : i . notes } ) ,
} )
. collect ( ) ;
if rows . is_empty ( ) {
return " 保險庫裡沒有符合的項目。請使用者到「設定 → 保險庫」新增,或改問使用者。 " . into ( ) ;
}
serde_json ::to_string_pretty ( & rows ) . unwrap_or_default ( )
}
/// "https://accounts.example.com/login?x" → "accounts.example.com"
pub fn host_of ( url : & str ) -> String {
let rest = url . split ( " :// " ) . nth ( 1 ) . unwrap_or ( url ) ;
Clippy is clean on macOS and Linux, for the app and the relay
Every warning `cargo clippy --all-targets` gave (50 on macOS, 8 more only on
Linux, 1 in the relay), fixed without changing what anything does:
- long types get a name (Peer, Members, Imported, Joining, Mention, Stream…);
- the two big enum variants are boxed (the vault's login plan, joining an
account);
- a test now waits for the copy it relaunched (it left a zombie behind);
- a hint's format had a dead `if` whose two branches were both "";
- the rest is what clippy suggests: sort_by_key, as_chunks, is_none_or,
is_multiple_of, while let, from_ref, next_back, struct init, no casts to
the same type.
Checked: cargo test (177 macOS, 181 Linux), relay tests (11), remote_e2e
28/28, and the live Linux test (X11; Wayland clicks, keys, Chinese typing,
scroll and screenshots).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
2026-11-07 02:10:28 +00:00
rest . split ( [ '/' , '?' , '#' ] ) . next ( ) . unwrap_or ( " " ) . split ( '@' ) . next_back ( ) . unwrap_or ( " " ) . split ( ':' ) . next ( ) . unwrap_or ( " " ) . to_lowercase ( )
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
}
/// accounts.google.com → [accounts.google.com, google.com]
pub fn candidates ( host : & str ) -> Vec < String > {
let parts : Vec < & str > = host . split ( '.' ) . collect ( ) ;
let mut v = vec! [ host . to_string ( ) ] ;
for i in 1 .. parts . len ( ) . saturating_sub ( 1 ) {
v . push ( parts [ i .. ] . join ( " . " ) ) ;
}
v
}
pub struct Login {
pub username : String ,
pub password : String ,
pub source : & 'static str ,
}
// ---------- Linux: the desktop keyring (GNOME Keyring / KWallet) through Secret Service ----------
// Entries are stored with attributes application=anybot, server=<host>, user=<name>.
fn secret_tool ( args : & [ & str ] , input : Option < & str > ) -> Option < std ::process ::Output > {
use std ::io ::Write ;
let mut c = Command ::new ( " secret-tool " ) ;
// The label has Chinese in it: make sure secret-tool reads its arguments as UTF-8 (C.UTF-8
// exists everywhere; the person's own locale might not be installed).
c . env ( " LC_ALL " , " C.UTF-8 " ) ;
c . args ( args ) . stdout ( std ::process ::Stdio ::piped ( ) ) . stderr ( std ::process ::Stdio ::piped ( ) ) . stdin ( if input . is_some ( ) { std ::process ::Stdio ::piped ( ) } else { std ::process ::Stdio ::null ( ) } ) ;
let mut child = c . spawn ( ) . ok ( ) ? ;
if let ( Some ( text ) , Some ( mut w ) ) = ( input , child . stdin . take ( ) ) {
let _ = w . write_all ( text . as_bytes ( ) ) ;
}
child . wait_with_output ( ) . ok ( )
}
/// `secret-tool search --all` blocks → (attributes, secret).
pub fn parse_secret_search ( out : & str ) -> Vec < ( std ::collections ::HashMap < String , String > , String ) > {
let mut v = vec! [ ] ;
for block in out . split ( " \n [ " ) . map ( | b | b . trim_start_matches ( '[' ) ) {
let mut attrs = std ::collections ::HashMap ::new ( ) ;
let mut secret = String ::new ( ) ;
for l in block . lines ( ) {
if let Some ( ( k , val ) ) = l . split_once ( " = " ) {
match k . trim ( ) {
" secret " = > secret = val . to_string ( ) ,
k if k . starts_with ( " attribute. " ) = > {
attrs . insert ( k . trim_start_matches ( " attribute. " ) . to_string ( ) , val . to_string ( ) ) ;
}
_ = > { }
}
}
}
if ! attrs . is_empty ( ) {
v . push ( ( attrs , secret ) ) ;
}
}
v
}
fn linux_find ( host : & str ) -> Option < Login > {
let o = secret_tool ( & [ " search " , " --all " , " --unlock " , " application " , " anybot " , " server " , host ] , None ) ? ;
// secret-tool prints the matches on stdout, or (older versions) on stderr.
let text = format! ( " {} \n {} " , String ::from_utf8_lossy ( & o . stdout ) , String ::from_utf8_lossy ( & o . stderr ) ) ;
let ( attrs , secret ) = parse_secret_search ( & text ) . into_iter ( ) . find ( | ( _ , s ) | ! s . is_empty ( ) ) ? ;
Some ( Login { username : attrs . get ( " user " ) . cloned ( ) . unwrap_or_default ( ) , password : secret , source : " 系統鑰匙圈 " } )
}
/// One Keychain login by site and account (bringing old AnyBot logins into the vault file).
pub fn keychain_login ( site : & str , account : & str ) -> Option < Login > {
if ! cfg! ( target_os = " macos " ) {
return linux_find ( site ) . filter ( | l | l . username = = account ) ;
}
let out = Command ::new ( " security " ) . args ( [ " find-internet-password " , " -s " , site , " -a " , account , " -g " ] ) . output ( ) . ok ( ) ? ;
if ! out . status . success ( ) {
return None ;
}
Some ( Login { username : account . to_string ( ) , password : parse_g_password ( & String ::from_utf8_lossy ( & out . stderr ) ) ? , source : " 鑰匙圈 " } )
}
fn keychain ( host : & str ) -> Option < Login > {
if ! cfg! ( target_os = " macos " ) {
return linux_find ( host ) ;
}
// `-g` prints the attributes on stdout and the password on stderr, either as `"text"` or,
// when it isn't plain ASCII, as `0x<hex> "escaped"` (`-w` gives bare hex then, which
// can't be told apart from a password that looks like hex).
let out = Command ::new ( " security " ) . args ( [ " find-internet-password " , " -s " , host , " -g " ] ) . output ( ) . ok ( ) ? ;
if ! out . status . success ( ) {
return None ;
}
let meta = String ::from_utf8_lossy ( & out . stdout ) . to_string ( ) ;
let account = meta . lines ( ) . find ( | l | l . contains ( " \" acct \" " ) ) . and_then ( | l | l . split ( " = \" " ) . nth ( 1 ) ) . map ( | s | s . trim_end_matches ( '"' ) . to_string ( ) ) . unwrap_or_default ( ) ;
let password = parse_g_password ( & String ::from_utf8_lossy ( & out . stderr ) ) ? ;
Some ( Login { username : account , password , source : " 鑰匙圈 " } )
}
/// The password line of `security find-…-password -g`.
pub fn parse_g_password ( stderr : & str ) -> Option < String > {
let line = stderr . lines ( ) . find_map ( | l | l . strip_prefix ( " password: " ) . or_else ( | | ( l = = " password: " ) . then_some ( " " ) ) ) ? ;
if let Some ( hex ) = line . strip_prefix ( " 0x " ) {
let hex : String = hex . chars ( ) . take_while ( | c | c . is_ascii_hexdigit ( ) ) . collect ( ) ;
let bytes : Option < Vec < u8 > > = ( 0 .. hex . len ( ) / 2 ) . map ( | i | u8 ::from_str_radix ( & hex [ i * 2 .. i * 2 + 2 ] , 16 ) . ok ( ) ) . collect ( ) ;
return String ::from_utf8 ( bytes ? ) . ok ( ) ;
}
Some ( line . strip_prefix ( '"' ) . and_then ( | l | l . strip_suffix ( '"' ) ) . unwrap_or ( line ) . to_string ( ) )
}
fn onepassword ( host : & str ) -> Option < Login > {
let path = crate ::cloudbox ::tool_path ( ) ;
let list = Command ::new ( " op " ) . env ( " PATH " , & path ) . args ( [ " item " , " list " , " --categories " , " Login " , " --format " , " json " ] ) . output ( ) . ok ( ) ? ;
if ! list . status . success ( ) {
return None ;
}
let items : Value = serde_json ::from_slice ( & list . stdout ) . ok ( ) ? ;
2026-11-05 07:48:20 +00:00
// Match the host exactly or as a subdomain (with the dot): "notgoogle.com" must not
// answer for "google.com" (a plain ends_with fills the wrong login on a lookalike domain).
let host_match = | h : & str , want : & str | h = = want | | h . ends_with ( & format! ( " . {want} " ) ) ;
let id = items . as_array ( ) ? . iter ( ) . find ( | i | i [ " urls " ] . as_array ( ) . into_iter ( ) . flatten ( ) . any ( | u | host_match ( & host_of ( u [ " href " ] . as_str ( ) . unwrap_or ( " " ) ) , host ) ) ) ? [ " id " ] . as_str ( ) ? . to_string ( ) ;
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 got = Command ::new ( " op " ) . env ( " PATH " , & path ) . args ( [ " item " , " get " , & id , " --fields " , " label=username,label=password " , " --reveal " , " --format " , " json " ] ) . output ( ) . ok ( ) ? ;
let fields : Value = serde_json ::from_slice ( & got . stdout ) . ok ( ) ? ;
let arr = fields . as_array ( ) ? ;
let get = | l : & str | arr . iter ( ) . find ( | f | f [ " label " ] . as_str ( ) = = Some ( l ) ) . and_then ( | f | f [ " value " ] . as_str ( ) ) . unwrap_or ( " " ) . to_string ( ) ;
Some ( Login { username : get ( " username " ) , password : get ( " password " ) , source : " 1Password " } )
}
pub fn find ( host : & str ) -> Option < Login > {
for h in candidates ( host ) {
if let Some ( l ) = keychain ( & h ) {
return Some ( l ) ;
}
}
for h in candidates ( host ) {
if let Some ( l ) = onepassword ( & h ) {
return Some ( l ) ;
}
}
None
}
/// AnyBot's list of the logins it saved: site and account only (the passwords stay in the
/// keychain). macOS prints a non-ASCII label like 「AnyBot 登入」 as hex bytes, so the keychain
/// can't be searched by label reliably; this list is the source of truth for what to show.
fn index_path ( ) -> std ::path ::PathBuf {
crate ::model ::State ::path ( ) . parent ( ) . map ( | d | d . join ( " vault-index.json " ) ) . unwrap_or_default ( )
}
fn read_index ( ) -> Option < Vec < ( String , String ) > > {
let mut list : Vec < ( String , String ) > = std ::fs ::read_to_string ( index_path ( ) ) . ok ( ) . and_then ( | t | serde_json ::from_str ( & t ) . ok ( ) ) . unwrap_or_default ( ) ;
// Once: bring in logins AnyBot saved before the list existed.
let marker = index_path ( ) . with_file_name ( " vault-index-imported " ) ;
if cfg! ( target_os = " macos " ) & & ! marker . exists ( ) {
for l in legacy_keychain_logins ( ) {
if ! list . contains ( & l ) {
list . push ( l ) ;
}
}
write_index ( & list ) ;
let _ = std ::fs ::write ( & marker , " 1 " ) ;
}
Some ( list )
}
fn write_index ( list : & [ ( String , String ) ] ) {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs
- macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and
concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed
mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file
ignores and enforce symlink/policy checks across SSH, device and document search.
- 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs):
forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard
gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if
the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP
labels, box screenshots and control text lists; preserve non-text Wayland clipboards.
- 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser):
verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval
and PDF export while masking card/CVC values and screenshots; remember sites only on
always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker
ports, OrbStack 198.18/15 and IPv6 transition ranges.
- 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate
paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact
routine trigger secrets and clear REDACTED when endpoints change; isolate channel and
team-member turns from owner memories, appctl and grants; scrub shared bot exports and
reset grants/routines on import; validate drop IDs and serialize chunk writes.
- 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow
and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup
reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff
buffers; move VNC stdin/text off the tunnel loop.
- 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs,
setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs):
wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved
mirror edits across brief disconnects; give Chinese skills distinct folders and approval
gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths;
fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill,
cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let _ = crate ::httpd ::write_private ( & index_path ( ) , serde_json ::to_string_pretty ( list ) . unwrap_or_default ( ) . as_bytes ( ) ) ;
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 keychain has this login (no password is read, so no prompt).
fn keychain_has ( site : & str , account : & str ) -> bool {
Command ::new ( " security " ) . args ( [ " find-internet-password " , " -s " , site , " -a " , account ] ) . output ( ) . map ( | o | o . status . success ( ) ) . unwrap_or ( false )
}
/// Logins saved before the index existed: keychain items with AnyBot's label, which
/// `security dump-keychain` prints either as text or as hex bytes.
fn legacy_keychain_logins ( ) -> Vec < ( String , String ) > {
let Ok ( out ) = Command ::new ( " security " ) . args ( [ " dump-keychain " ] ) . output ( ) else { return vec! [ ] } ;
let text = String ::from_utf8_lossy ( & out . stdout ) ;
let hex : String = LABEL . bytes ( ) . map ( | b | format! ( " {b:02X} " ) ) . collect ( ) ;
let mut v = vec! [ ] ;
for block in text . split ( " keychain: " ) {
if ! block . contains ( & format! ( " = \" {LABEL} \" " ) ) & & ! block . to_uppercase ( ) . contains ( & format! ( " 0X {hex} " ) ) {
continue ;
}
let get = | k : & str | block . lines ( ) . find ( | l | l . contains ( & format! ( " \" {k} \" " ) ) ) . and_then ( | l | l . split ( " = \" " ) . nth ( 1 ) ) . map ( | s | s . trim_end_matches ( '"' ) . to_string ( ) ) . unwrap_or_default ( ) ;
let ( s , a ) = ( get ( " srvr " ) , get ( " acct " ) ) ;
if ! s . is_empty ( ) {
v . push ( ( s , a ) ) ;
}
}
v
}
/// Sites AnyBot saved (names only).
pub fn saved_sites ( ) -> Vec < ( String , String ) > {
if ! cfg! ( target_os = " macos " ) {
let Some ( o ) = secret_tool ( & [ " search " , " --all " , " application " , " anybot " ] , None ) else { return vec! [ ] } ;
let text = format! ( " {} \n {} " , String ::from_utf8_lossy ( & o . stdout ) , String ::from_utf8_lossy ( & o . stderr ) ) ;
return parse_secret_search ( & text ) . into_iter ( ) . filter_map ( | ( a , _ ) | Some ( ( a . get ( " server " ) ? . clone ( ) , a . get ( " user " ) . cloned ( ) . unwrap_or_default ( ) ) ) ) . collect ( ) ;
}
let list = read_index ( ) . unwrap_or_default ( ) ;
// Drop entries someone deleted in 鑰匙圈存取 meanwhile.
let kept : Vec < _ > = list . iter ( ) . filter ( | ( s , a ) | keychain_has ( s , a ) ) . cloned ( ) . collect ( ) ;
if kept . len ( ) ! = list . len ( ) {
write_index ( & kept ) ;
}
kept
}
/// The JavaScript that types the login into the page (as a JSON-encoded string literal).
安全、修正: 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
#[ cfg(test) ]
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
pub fn fill_script ( username : & str , password : & str , submit : bool ) -> String {
安全、修正: 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
fill_script_for_host ( username , password , submit , None )
}
pub fn fill_script_for_host ( username : & str , password : & str , submit : bool , expected_host : Option < & str > ) -> String {
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 u = serde_json ::to_string ( username ) . unwrap_or_default ( ) ;
let p = serde_json ::to_string ( password ) . unwrap_or_default ( ) ;
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs
- macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and
concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed
mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file
ignores and enforce symlink/policy checks across SSH, device and document search.
- 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs):
forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard
gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if
the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP
labels, box screenshots and control text lists; preserve non-text Wayland clipboards.
- 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser):
verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval
and PDF export while masking card/CVC values and screenshots; remember sites only on
always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker
ports, OrbStack 198.18/15 and IPv6 transition ranges.
- 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate
paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact
routine trigger secrets and clear REDACTED when endpoints change; isolate channel and
team-member turns from owner memories, appctl and grants; scrub shared bot exports and
reset grants/routines on import; validate drop IDs and serialize chunk writes.
- 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow
and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup
reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff
buffers; move VNC stdin/text off the tunnel loop.
- 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs,
setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs):
wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved
mirror edits across brief disconnects; give Chinese skills distinct folders and approval
gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths;
fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill,
cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let want = serde_json ::to_string ( expected_host . unwrap_or ( " " ) ) . unwrap_or_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
format! (
r #" (() => {{
安全、修正: 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
const want = { want } ;
if ( want & & location . hostname . toLowerCase ( ) ! = = want . toLowerCase ( ) ) return JSON . stringify ( { { wrong_host : location . hostname } } ) ;
const set = ( el , v , secret ) = > { { const d = Object . getOwnPropertyDescriptor ( HTMLInputElement . prototype , ' value ' ) ; d . set . call ( el , v ) ; if ( secret ) { { el . setAttribute ( ' data - anybot - vault - secret ' , '1' ) ; window . __anybot_vault_tainted = true ; } } el . dispatchEvent ( new Event ( ' input ' , { { bubbles : true } } ) ) ; el . dispatchEvent ( new Event ( ' change ' , { { bubbles : 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
const vis = el = > el . offsetParent ! = = null & & ! el . disabled ;
const pw = [ .. . document . querySelectorAll ( ' input [ type = password ] ' ) ] . find ( vis ) ;
const users = [ .. . document . querySelectorAll ( ' input [ type = email ] , input [ type = text ] , input [ autocomplete = username ] , input [ name * = user i ] , input [ name * = mail i ] , input [ id * = user i ] , input [ id * = mail i ] ' ) ] . filter ( vis ) ;
let user = null ;
if ( pw ) { { for ( const el of users ) { { if ( el . compareDocumentPosition ( pw ) & Node . DOCUMENT_POSITION_FOLLOWING ) user = el ; } } } } else { { user = users [ 0 ] | | null ; } }
安全、修正: 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
if ( user & & { u } ) set ( user , { u } , false ) ;
if ( pw ) set ( pw , { p } , 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 submitted = false ;
if ( { submit } & & ( pw | | user ) ) { {
const field = pw | | user ;
const f = field . form ;
// The form's own button; else (pages without a <form>, like many shops) the nearest visible
// button that says 登入 / Log in / Sign in / 繼續 / 下一步.
let b = f ? ( f . querySelector ( ' button [ type = submit ] , input [ type = submit ] ' ) | | f . querySelector ( ' button ' ) ) : null ;
if ( ! b ) { {
const words = / 登 入 | 登 录 | log ? in | sign ? in | 繼 續 | 继 续 | 下 一 步 | next | continue / i ;
const cands = [ .. . document . querySelectorAll ( ' button , input [ type = submit ] , [ role = button ] , a ' ) ] . filter ( vis ) . filter ( el = > words . test ( ( el . innerText | | el . value | | el . getAttribute ( ' aria - label ' ) | | ' ' ) . trim ( ) ) ) ;
const fr = field . getBoundingClientRect ( ) ;
cands . sort ( ( a , c ) = > { { const ra = a . getBoundingClientRect ( ) , rc = c . getBoundingClientRect ( ) ; return ( Math . abs ( ra . top - fr . top ) + Math . abs ( ra . left - fr . left ) ) - ( Math . abs ( rc . top - fr . top ) + Math . abs ( rc . left - fr . left ) ) ; } } ) ;
b = cands [ 0 ] | | null ;
} }
if ( b & & ! b . disabled ) { { b . click ( ) ; submitted = true ; } }
else if ( f ) { { f . requestSubmit ? f . requestSubmit ( ) : f . submit ( ) ; submitted = true ; } }
} }
return JSON . stringify ( { { user : ! ! user , password : ! ! pw , submitted } } ) ;
} } ) ( ) " #
)
}
安全、修正: 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
fn profile_of ( v : & Value ) -> Option < String > {
v [ " profile " ] . as_str ( ) . map ( str ::trim ) . filter ( | s | ! s . is_empty ( ) ) . map ( String ::from )
}
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 current tab's host in AnyBot's browser.
安全、修正: 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
fn current_host_in ( profile : Option < & str > ) -> Result < String , String > {
let ( url , _ ) = crate ::botbrowser ::eval_current ( profile , " 1 " ) ? ;
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
Ok ( host_of ( & url ) )
}
/// What browser_fill_login will use, worked out before asking the person.
pub struct LoginPlan {
pub host : String ,
安全、修正: 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
pub profile : Option < String > ,
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
/// A vault login (public fields only).
pub item : Option < crate ::vault_store ::Item > ,
/// The vault login is saved for this site (else the person is warned before allowing it).
pub matched : bool ,
/// A Keychain / 1Password login (when the vault has none).
other : Option < Login > ,
}
impl LoginPlan {
/// The approval question.
pub fn question ( & self ) -> String {
match & self . item {
Some ( i ) if self . matched = > format! ( " 用保險庫的登入資訊( {} {} )登入 {} ( Bot 看不到密碼)" , i . display_title ( ) , if i . username . is_empty ( ) { String ::new ( ) } else { format! ( " · {} " , i . username ) } , self . host ) ,
Some ( i ) = > format! (
" 也要在 {} 上使用 {} 嗎?(已為 {} 儲存) \n 只有在它與已儲存的網站屬於同一服務時才允許。仿冒網站可能會竊取你的密碼。 " ,
self . host ,
i . display_title ( ) ,
i . sites . join ( " 、 " )
) ,
None = > format! ( " 用 {} 的登入資料( {} )登入 {} ( Bot 看不到密碼)" , self . other . as_ref ( ) . map ( | l | l . source ) . unwrap_or ( " 已儲存 " ) , self . other . as_ref ( ) . map ( | l | l . username . as_str ( ) ) . unwrap_or ( " " ) , self . host ) ,
}
}
}
pub fn plan_login ( args : & str ) -> Result < LoginPlan , String > {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs
- macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and
concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed
mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file
ignores and enforce symlink/policy checks across SSH, device and document search.
- 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs):
forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard
gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if
the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP
labels, box screenshots and control text lists; preserve non-text Wayland clipboards.
- 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser):
verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval
and PDF export while masking card/CVC values and screenshots; remember sites only on
always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker
ports, OrbStack 198.18/15 and IPv6 transition ranges.
- 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate
paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact
routine trigger secrets and clear REDACTED when endpoints change; isolate channel and
team-member turns from owner memories, appctl and grants; scrub shared bot exports and
reset grants/routines on import; validate drop IDs and serialize chunk writes.
- 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow
and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup
reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff
buffers; move VNC stdin/text off the tunnel loop.
- 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs,
setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs):
wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved
mirror edits across brief disconnects; give Chinese skills distinct folders and approval
gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths;
fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill,
cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let v = crate ::tools ::args_of ( args ) ;
let profile = profile_of ( & v ) ;
plan_login_on ( & current_host_in ( profile . as_deref ( ) ) ? , & v )
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 plan for the page that is open (`tab`, its host).
///
/// The password goes into the open tab, so the open tab is the site: what the person is asked
/// about, what 「一律允許」 is remembered for, and what the saved login is checked against.
/// `site` only picks which saved login to use. It used to stand in for all three — a page could
/// talk the bot into `site: "google.com"` and, where the person had always-allowed google.com,
/// have Google's password typed into itself without a question.
pub ( crate ) fn plan_login_on ( tab : & str , v : & Value ) -> Result < LoginPlan , String > {
if tab . is_empty ( ) {
return Err ( " 目前的分頁沒有開著網站。先打開要登入的那一頁,再填入。 " . into ( ) ) ;
}
let host = tab . to_string ( ) ;
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs
- macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and
concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed
mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file
ignores and enforce symlink/policy checks across SSH, device and document search.
- 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs):
forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard
gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if
the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP
labels, box screenshots and control text lists; preserve non-text Wayland clipboards.
- 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser):
verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval
and PDF export while masking card/CVC values and screenshots; remember sites only on
always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker
ports, OrbStack 198.18/15 and IPv6 transition ranges.
- 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate
paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact
routine trigger secrets and clear REDACTED when endpoints change; isolate channel and
team-member turns from owner memories, appctl and grants; scrub shared bot exports and
reset grants/routines on import; validate drop IDs and serialize chunk writes.
- 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow
and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup
reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff
buffers; move VNC stdin/text off the tunnel loop.
- 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs,
setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs):
wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved
mirror edits across brief disconnects; give Chinese skills distinct folders and approval
gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths;
fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill,
cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let profile = profile_of ( v ) ;
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 ( id ) = v [ " login_id " ] . as_str ( ) . filter ( | s | ! s . is_empty ( ) ) {
let item = crate ::vault_store ::get ( id ) . filter ( | i | i . kind = = crate ::vault_store ::Kind ::Login ) . ok_or ( " 保險庫裡沒有這筆登入資訊(先用 vault_list 看 id) " ) ? ;
let matched = item . fills_on ( & host ) ;
安全、修正: 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
return Ok ( LoginPlan { host , profile , item : Some ( item ) , matched , other : None } ) ;
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
let site = v [ " site " ] . as_str ( ) . filter ( | s | ! s . trim ( ) . is_empty ( ) ) . map ( host_of ) . filter ( | h | ! h . is_empty ( ) ) ;
let same_site = | s : & str | crate ::vault_store ::registrable_domain ( s ) = = crate ::vault_store ::registrable_domain ( tab ) ;
if let Some ( site ) = site . filter ( | s | ! same_site ( s ) ) {
// A login saved for another site: the person sees the lookalike warning (matched is
// false when it isn't saved for this page), and no grant is kept.
return match crate ::vault_store ::logins_for ( & site ) . into_iter ( ) . next ( ) {
Some ( item ) = > {
let matched = item . fills_on ( & host ) ;
安全、修正: 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
Ok ( LoginPlan { host , profile , item : Some ( item ) , matched , other : None } )
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
}
// Keychain and 1Password logins carry no list of sites to warn with: only on their own site.
None = > Err ( format! ( " 目前的分頁是 {host} ,不是 {site} 。先打開 {site} 的登入頁,再填入(密碼只會填進它所屬的網站)。 " ) ) ,
} ;
}
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 ( item ) = crate ::vault_store ::logins_for ( & host ) . into_iter ( ) . next ( ) {
安全、修正: 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
return Ok ( LoginPlan { host , profile , item : Some ( item ) , matched : true , other : None } ) ;
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
}
match find ( & host ) {
安全、修正: 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
Some ( l ) = > Ok ( LoginPlan { host , profile , item : None , matched : true , other : Some ( l ) } ) ,
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
None = > Err ( format! ( " 找不到「 {host} 」的登入資料。請使用者在「設定 → 保險庫」新增一筆登入資訊(或存在 macOS 鑰匙圈/ 1Password) 。 " ) ) ,
}
}
/// Type the planned login into the page (after the person allowed it).
安全、修正: 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
#[ cfg(test) ]
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
pub fn fill_login ( plan : & LoginPlan , submit : bool ) -> Result < String , String > {
安全、修正: 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
fill_login_with ( plan , submit , false )
}
pub fn fill_login_with ( plan : & LoginPlan , submit : bool , remember_site : bool ) -> Result < String , String > {
2026-11-12 14:53:30 +00:00
let ( username , password , source ) = login_secret_of ( plan ) ? ;
let ( _ , r ) = crate ::botbrowser ::eval_current ( plan . profile . as_deref ( ) , & fill_script_for_host ( & username , & password , submit , Some ( & plan . host ) ) ) ? ;
let got : Value = r . as_str ( ) . and_then ( | s | serde_json ::from_str ( s ) . ok ( ) ) . unwrap_or_default ( ) ;
login_fill_text ( plan , & username , & source , submit , & got , remember_site )
}
/// The secret of a planned login: (username, password, where it came from). The brain keeps
/// the vault; only this one entry's secret travels to the computer that has the browser.
pub ( crate ) fn login_secret_of ( plan : & LoginPlan ) -> Result < ( String , String , String ) , String > {
match ( & plan . item , & plan . other ) {
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
( Some ( i ) , _ ) = > {
let ( u , p ) = crate ::vault_store ::login_secret ( & i . id ) . ok_or ( " 保險庫裡沒有這筆登入資訊 " ) ? ;
2026-11-12 14:53:30 +00:00
Ok ( ( u , p , " 保險庫 " . to_string ( ) ) )
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 14:53:30 +00:00
( None , Some ( l ) ) = > Ok ( ( l . username . clone ( ) , l . password . clone ( ) , l . source . to_string ( ) ) ) ,
_ = > Err ( " 沒有可用的登入資料 " . into ( ) ) ,
}
}
/// What a fill script answered (`got`, its JSON), said to the bot: the host guard bails on a
/// changed page, the wording tells the bot the next step. 「一律允許」 remembers the new site
/// in the vault — here, on the brain, where the vault lives.
pub ( crate ) fn login_fill_text ( plan : & LoginPlan , username : & str , source : & str , submit : bool , got : & Value , remember_site : bool ) -> Result < String , String > {
安全、修正: 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
if let Some ( now_host ) = got [ " wrong_host " ] . as_str ( ) {
return Err ( format! ( " 頁面網址在等待核准期間變成了 {now_host} (原本是 {} ),已取消填入密碼以防釣魚。 " , plan . host ) ) ;
}
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 got [ " password " ] . as_bool ( ) ! = Some ( true ) & & got [ " user " ] . as_bool ( ) ! = Some ( true ) {
return Err ( " 這一頁找不到帳號或密碼欄位。先打開登入頁(有些網站要先按「登入」或先填帳號、按下一步才出現密碼欄)。 " . into ( ) ) ;
}
安全、修正: 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
// Only permanently add a new domain when the person explicitly chose 「一律允許」, never on a one-time approval.
if remember_site & & ! plan . matched {
2026-11-05 07:48:20 +00:00
if let Some ( i ) = & plan . item {
crate ::vault_store ::add_site ( & i . id , & plan . host ) ? ;
}
}
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
Ok ( format! (
" 已在 {} 填入{}{}(來自{source},你看不到密碼)。{} " ,
plan . host ,
if got [ " user " ] . as_bool ( ) = = Some ( true ) { format! ( " 帳號 {username} " ) } else { String ::new ( ) } ,
if got [ " password " ] . as_bool ( ) = = Some ( true ) { " 和密碼 " } else { " (這頁沒有密碼欄,可能要先按下一步) " } ,
if submit & & got [ " submitted " ] . as_bool ( ) = = Some ( true ) {
" 也已按下登入,請用 browser_read 確認是否登入成功。如果還在登入頁(常見原因:需要驗證碼、簡訊碼或人機驗證),請使用者在 AnyBot 瀏覽器視窗裡完成,之後會記住登入。 "
} else if submit {
" 但頁面上找不到登入按鈕,沒有送出。請用 computer_use 按登入按鈕,或請使用者按。 "
} else {
" 接著按頁面上的登入按鈕。 "
}
) )
}
/// JavaScript that fills a form's fields by their autocomplete hints and common names.
/// `values` maps a field role to its value; the page gets them as one JSON string literal.
安全、修正: 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
#[ allow(dead_code) ]
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
pub fn form_fill_script ( values : & Value ) -> String {
安全、修正: 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
form_fill_script_for_host ( values , None , false )
}
pub fn form_fill_script_for_host ( values : & Value , expected_host : Option < & str > , require_https : bool ) -> String {
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 data = serde_json ::to_string ( & values . to_string ( ) ) . unwrap_or_default ( ) ;
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs
- macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and
concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed
mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file
ignores and enforce symlink/policy checks across SSH, device and document search.
- 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs):
forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard
gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if
the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP
labels, box screenshots and control text lists; preserve non-text Wayland clipboards.
- 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser):
verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval
and PDF export while masking card/CVC values and screenshots; remember sites only on
always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker
ports, OrbStack 198.18/15 and IPv6 transition ranges.
- 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate
paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact
routine trigger secrets and clear REDACTED when endpoints change; isolate channel and
team-member turns from owner memories, appctl and grants; scrub shared bot exports and
reset grants/routines on import; validate drop IDs and serialize chunk writes.
- 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow
and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup
reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff
buffers; move VNC stdin/text off the tunnel loop.
- 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs,
setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs):
wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved
mirror edits across brief disconnects; give Chinese skills distinct folders and approval
gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths;
fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill,
cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let want = serde_json ::to_string ( expected_host . unwrap_or ( " " ) ) . unwrap_or_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
format! (
r #" (() => {{
安全、修正: 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
const want = { want } ;
if ( want & & location . hostname . toLowerCase ( ) ! = = want . toLowerCase ( ) ) return JSON . stringify ( { { wrong_host : location . hostname } } ) ;
if ( { require_https } & & location . protocol ! = = ' https :' & & location . hostname ! = = ' 127. 0. 0.1 ' & & location . hostname ! = = ' localhost ' ) return JSON . stringify ( { { insecure : location . protocol } } ) ;
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
const V = JSON . parse ( { data } ) ;
const vis = el = > el . offsetParent ! = = null & & ! el . disabled & & ! el . readOnly ;
安全、修正: 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
const set = ( el , v , secret ) = > { {
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 ( el . tagName = = = ' SELECT ' ) { {
const want = String ( v ) . toLowerCase ( ) ;
const opt = [ .. . el . options ] . find ( o = > o . value . toLowerCase ( ) = = = want | | o . text . trim ( ) . toLowerCase ( ) = = = want | | ( want . length > 1 & & o . text . trim ( ) . toLowerCase ( ) . startsWith ( want ) ) ) ;
if ( ! opt ) return false ;
el . value = opt . value ;
} } else { {
const proto = el . tagName = = = ' TEXTAREA ' ? HTMLTextAreaElement . prototype : HTMLInputElement . prototype ;
Object . getOwnPropertyDescriptor ( proto , ' value ' ) . set . call ( el , String ( v ) ) ;
安全、修正: 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
if ( secret ) { { el . setAttribute ( ' data - anybot - vault - secret ' , '1' ) ; window . __anybot_vault_tainted = 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
} }
el . dispatchEvent ( new Event ( ' input ' , { { bubbles : true } } ) ) ;
el . dispatchEvent ( new Event ( ' change ' , { { bubbles : true } } ) ) ;
return true ;
} } ;
const rules = { {
' cc - number ' : [ / card . ? num | cc . ? num | cardnumber | ccnumber | 卡 號 / i ] ,
' cc - exp ' : [ / ^ ( cc - ? ) ? exp ( iry | iration ) ? ( - ? date ) ? $ | mm . ? \ / ? . ? yy | 有 效 期 / i ] ,
' cc - exp - month ' : [ / exp . * month | cc - ? month | card . ? month | 月 / i ] ,
' cc - exp - year ' : [ / exp . * year | cc - ? year | card . ? year | 年 / i ] ,
' cc - csc ' : [ / cvc | cvv | csc | security . ? code | card . ? code | 安 全 碼 | 驗 證 碼 / i ] ,
' cc - name ' : [ / name . ? on . ? card | card . ? holder | holder . ? name | cc - ? name | 持 卡 人 / i ] ,
' name ' : [ / ^ ( full . ? ) ? name $ | 姓 名 | 收 件 人 / i ] ,
' address - line1 ' : [ / address . ? ( line ) ? . ? 1 | street | ^ address $ | 地 址 / i ] ,
' address - line2 ' : [ / address . ? ( line ) ? . ? 2 | apt | suite | unit / i ] ,
' address - level2 ' : [ / city | town | 城 市 | 縣 市 / i ] ,
' address - level1 ' : [ / state | province | region | county | 州 | 省 / i ] ,
' postal - code ' : [ / zip | postal | postcode | 郵 遞 區 號 | 郵 遞 / i ] ,
' country ' : [ / country | 國 家 / i ] ,
' tel ' : [ / phone | mobile | tel | 手 機 | 電 話 / i ] ,
' email ' : [ / e - ? mail | 電 子 郵 件 / i ] ,
} } ;
const fields = [ .. . document . querySelectorAll ( ' input :not ( [ type = hidden ] ) :not ( [ type = checkbox ] ) :not ( [ type = radio ] ) :not ( [ type = password ] ) , select , textarea ' ) ] . filter ( vis ) ;
const used = new Set ( ) ;
const filled = [ ] ;
for ( const role of Object . keys ( V ) ) { {
if ( V [ role ] = = = ' ' | | V [ role ] = = null ) continue ;
let el = fields . find ( f = > ! used . has ( f ) & & ( f . autocomplete | | ' ' ) . toLowerCase ( ) . split ( / \ s + / ) . includes ( role ) ) ;
if ( ! el ) { {
const pats = rules [ role ] | | [ ] ;
el = fields . find ( f = > { { const ac = ( f . autocomplete | | ' ' ) . toLowerCase ( ) ; return ! used . has ( f ) & & ( ac = = = ' ' | | ac = = = ' on ' | | ac = = = ' off ' | | ac . startsWith ( ' cc - ' ) = = = role . startsWith ( ' cc - ' ) ) & & pats . some ( p = > p . test ( [ f . type = = = ' text ' ? ' ' : f . type , f . name , f . id , f . placeholder , f . getAttribute ( ' aria - label ' ) | | ' ' , ( f . labels & & f . labels [ 0 ] ? f . labels [ 0 ] . innerText : ' ' ) ] . join ( ' ' ) ) ) ; } } ) ;
} }
安全、修正: 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
if ( el & & set ( el , V [ role ] , role = = = ' cc - number ' | | role = = = ' cc - csc ' ) ) { { used . add ( el ) ; filled . push ( role ) ; } }
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
} }
const frames = document . querySelectorAll ( ' iframe ' ) . length ;
return JSON . stringify ( { { filled , frames } } ) ;
} } ) ( ) " #
)
}
/// Names for the roles, as the bot is told what was filled.
fn role_name ( r : & str ) -> & 'static str {
match r {
" cc-number " = > " 卡號 " ,
" cc-exp " | " cc-exp-month " | " cc-exp-year " = > " 有效期限 " ,
" cc-csc " = > " 安全碼 " ,
" cc-name " = > " 持卡人姓名 " ,
" name " = > " 姓名 " ,
" address-line1 " | " address-line2 " = > " 地址 " ,
" address-level2 " = > " 城市 " ,
" address-level1 " = > " 州/省/地區 " ,
" postal-code " = > " 郵遞區號 " ,
" country " = > " 國家/地區 " ,
" tel " = > " 電話 " ,
" email " = > " 電子郵件 " ,
_ = > " 欄位 " ,
}
}
fn filled_summary ( r : & Value ) -> ( Vec < & 'static str > , u64 ) {
let mut names : Vec < & 'static str > = r [ " filled " ] . as_array ( ) . into_iter ( ) . flatten ( ) . filter_map ( | x | x . as_str ( ) ) . map ( role_name ) . collect ( ) ;
names . dedup ( ) ;
( names , r [ " frames " ] . as_u64 ( ) . unwrap_or ( 0 ) )
}
/// For the approval question: (current host, card label) without secrets.
pub fn plan_card ( args : & str ) -> Result < ( String , crate ::vault_store ::Item ) , String > {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs
- macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and
concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed
mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file
ignores and enforce symlink/policy checks across SSH, device and document search.
- 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs):
forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard
gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if
the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP
labels, box screenshots and control text lists; preserve non-text Wayland clipboards.
- 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser):
verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval
and PDF export while masking card/CVC values and screenshots; remember sites only on
always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker
ports, OrbStack 198.18/15 and IPv6 transition ranges.
- 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate
paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact
routine trigger secrets and clear REDACTED when endpoints change; isolate channel and
team-member turns from owner memories, appctl and grants; scrub shared bot exports and
reset grants/routines on import; validate drop IDs and serialize chunk writes.
- 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow
and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup
reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff
buffers; move VNC stdin/text off the tunnel loop.
- 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs,
setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs):
wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved
mirror edits across brief disconnects; give Chinese skills distinct folders and approval
gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths;
fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill,
cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let v = crate ::tools ::args_of ( args ) ;
let profile = profile_of ( & v ) ;
let ( url , _ ) = crate ::botbrowser ::eval_current ( profile . as_deref ( ) , " 1 " ) ? ;
2026-11-12 14:53:30 +00:00
plan_card_at ( & v , & url )
}
/// The card plan for the page open at `url` — read on the computer that has the browser.
pub ( crate ) fn plan_card_at ( v : & Value , url : & str ) -> Result < ( String , crate ::vault_store ::Item ) , String > {
let id = v [ " card_id " ] . as_str ( ) . unwrap_or ( " " ) . to_string ( ) ;
let card = crate ::vault_store ::get ( & id ) . filter ( | i | i . kind = = crate ::vault_store ::Kind ::Card ) . ok_or ( " 保險庫裡沒有這張卡片(先用 vault_list 看 id) " ) ? ;
let host = host_of ( url ) ;
安全、修正: 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
if ! url . starts_with ( " https:// " ) & & host ! = " 127.0.0.1 " & & host ! = " localhost " {
return Err ( format! ( " 目前的分頁不是安全的 HTTPS 網頁( {url} ),為了保護卡號不會填入。 " ) ) ;
}
Ok ( ( host , card ) )
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
}
安全、修正: 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
#[ cfg(test) ]
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
pub fn fill_card ( args : & str ) -> Result < String , String > {
安全、修正: 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
fill_card_on ( args , None )
}
pub fn fill_card_on ( args : & str , expected_host : Option < & str > ) -> Result < String , String > {
let v = crate ::tools ::args_of ( args ) ;
let id = v [ " card_id " ] . as_str ( ) . unwrap_or ( " " ) . to_string ( ) ;
let profile = profile_of ( & v ) ;
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 c = crate ::vault_store ::card_secret ( & id ) . ok_or ( " 保險庫裡沒有這張卡片 " ) ? ;
2026-11-12 14:53:30 +00:00
let ( _ , r ) = crate ::botbrowser ::eval_current ( profile . as_deref ( ) , & form_fill_script_for_host ( & card_values ( & c ) , expected_host , true ) ) ? ;
let got : Value = r . as_str ( ) . and_then ( | s | serde_json ::from_str ( s ) . ok ( ) ) . unwrap_or_default ( ) ;
card_fill_text ( & c , & got )
}
/// The card form values — the secrets; they travel to the browser's computer one fill at a time.
pub ( crate ) fn card_values ( c : & crate ::vault_store ::Item ) -> Value {
serde_json ::json! ( {
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
" cc-number " : c . number ,
" cc-exp " : format ! ( " {:02}/{:02} " , c . exp_month , c . exp_year % 100 ) ,
" cc-exp-month " : format ! ( " {:02} " , c . exp_month ) ,
" cc-exp-year " : c . exp_year . to_string ( ) ,
" cc-csc " : c . csc ,
" cc-name " : c . holder ,
2026-11-12 14:53:30 +00:00
} )
}
/// What the card fill script answered, said to the bot (no secrets in the words).
pub ( crate ) fn card_fill_text ( c : & crate ::vault_store ::Item , got : & Value ) -> Result < String , String > {
安全、修正: 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
if let Some ( now_host ) = got [ " wrong_host " ] . as_str ( ) {
return Err ( format! ( " 頁面網址在等待核准期間變成了 {now_host} ,已取消填入卡號。 " ) ) ;
}
if got . get ( " insecure " ) . is_some ( ) {
return Err ( " 頁面已切換成非 HTTPS 連線,已取消填入卡號。 " . into ( ) ) ;
}
2026-11-12 14:53:30 +00:00
let ( names , frames ) = filled_summary ( got ) ;
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 names . is_empty ( ) {
return Err ( if frames > 0 {
" 這一頁的付款欄位在付款服務的框架裡, AnyBot 填不進去。請使用者自己填卡號,或改用網站提供的其他付款方式。 " . into ( )
} else {
" 這一頁找不到付款欄位。先打開結帳頁的付款步驟。 " . into ( )
} ) ;
}
Ok ( format! ( " 已填入 {} •••• {} 的 {} (你看不到卡號和安全碼)。送出付款前一定要先問使用者。 " , c . display_title ( ) , c . last4 , names . join ( " 、 " ) ) )
}
pub fn plan_contact ( args : & str ) -> Result < ( String , crate ::vault_store ::Item ) , String > {
安全、修正: harden sandboxes, approval gates, vault, relay roles, and fix protocol/UI bugs
- macOS 沙盒與工具 (tools.rs, policy.rs, docindex.rs): block AppleScript raw events and
concatenation outside the sandbox; stop exposing ~/.ssh or localhost sockets in Sealed
mode; deny writes to shell profiles, LaunchAgents and .git/hooks; expand secret-file
ignores and enforce symlink/policy checks across SSH, device and document search.
- 電腦操作與遮罩 (computer.rs, agent.rs, marks.rs, desktop.rs, cloudbox.rs, portal.rs):
forbid clicking or typing into AnyBot's own windows; extend the sensitive-action hard
gate to raw coordinates, Return/Delete submits and remote devices; stop batch steps if
the front app changes; black out secrets on zoom, show, >600-node trees, adjacent OTP
labels, box screenshots and control text lists; preserve non-text Wayland clipboards.
- 保險庫與瀏覽器 (vault.rs, vault_store.rs, browser.rs, botbrowser.rs, web.rs, box/browser):
verify tab host and HTTPS atomically at fill time; taint filled tabs against browser_eval
and PDF export while masking card/CVC values and screenshots; remember sites only on
always-allow; drop --remote-allow-origins=*; gate private URLs and block metadata/Docker
ports, OrbStack 198.18/15 and IPv6 transition ranges.
- 帳號伺服器、同步與傳送 (relay/, remote.rs, mirror_ui.rs, share.rs, drops.rs): isolate
paired hands hosts from brain sync, tickets, pairing and backup overwrites; redact
routine trigger secrets and clear REDACTED when endpoints change; isolate channel and
team-member turns from owner memories, appctl and grants; scrub shared bot exports and
reset grants/routines on import; validate drop IDs and serialize chunk writes.
- 網路與協定穩定性 (httpd.rs, tunnel.rs, vnc.rs, Caddyfile*): fix chunked integer overflow
and CRLF header injection; enforce Origin checks, connection/job caps, 200 MB backup
reads, unique atomic temp files and ASCII hex guards; bound deflate unzip and VNC sniff
buffers; move VNC stdin/text off the tunnel loop.
- 介面、排程、語言與其他修正 (app.rs, i18n.rs, providers.rs, skills.rs, routines.rs,
setup.rs, store.rs, preview.rs, attach.rs, speech.rs, teams.rs, mcp.rs, voice.rs):
wire up the delete-routine confirmation dialog and mirror run-now; preserve unsaved
mirror edits across brief disconnects; give Chinese skills distinct folders and approval
gates; convert parsed tool JSON fields without corrupting code fences, URLs or paths;
fix Hourly DST offsets and time out unattended routine approvals; lock --install-skill,
cap docx/xlsx unzip sizes, isolate test env keys, and tighten local file permissions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 06:34:10 +00:00
let v = crate ::tools ::args_of ( args ) ;
let profile = profile_of ( & v ) ;
2026-11-12 14:53:30 +00:00
let host = current_host_in ( profile . as_deref ( ) ) ? ;
Ok ( ( host , plan_contact_at ( & v ) ? ) )
}
/// The contact item an id names (no browser: works on the brain for a page read remotely).
pub ( crate ) fn plan_contact_at ( v : & Value ) -> Result < crate ::vault_store ::Item , String > {
let id = v [ " contact_id " ] . as_str ( ) . unwrap_or ( " " ) . to_string ( ) ;
crate ::vault_store ::get ( & id ) . filter ( | i | i . kind = = crate ::vault_store ::Kind ::Contact ) . ok_or ( " 保險庫裡沒有這筆聯絡資訊(先用 vault_list 看 id) " . into ( ) )
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
}
安全、修正: 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
#[ cfg(test) ]
AnyBot: first commit of the working desktop app
Rust/egui rebuild of Grok Bot as of 2026-11-04: chat with streaming
providers (xAI, OpenAI, Claude, Gemini, OpenRouter, OpenCode Go, Ollama,
custom), tools and approvals, the bot's Docker computer, computer use on
macOS / Linux X11 / Wayland, AnyBot's browser with a full DevTools-based
toolset, the encrypted vault, pinned grid and sidebar sections, Markdown
with Mermaid diagrams, phone access through the relay, and the Linux
build and test scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha3oEtWeHh58zA7ErHa
2026-11-04 08:51:51 +00:00
pub fn fill_contact ( args : & str ) -> Result < String , String > {
安全、修正: 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
fill_contact_on ( args , None )
}
pub fn fill_contact_on ( args : & str , expected_host : Option < & str > ) -> Result < String , String > {
let v = crate ::tools ::args_of ( args ) ;
let profile = profile_of ( & v ) ;
2026-11-12 14:53:30 +00:00
let c = plan_contact_at ( & v ) ? ;
let ( _ , r ) = crate ::botbrowser ::eval_current ( profile . as_deref ( ) , & form_fill_script_for_host ( & contact_values ( & c ) , expected_host , false ) ) ? ;
let got : Value = r . as_str ( ) . and_then ( | s | serde_json ::from_str ( s ) . ok ( ) ) . unwrap_or_default ( ) ;
contact_fill_text ( & c , & got )
}
/// The contact form values (they travel to the browser's computer for one fill).
pub ( crate ) fn contact_values ( c : & crate ::vault_store ::Item ) -> Value {
serde_json ::json! ( {
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
" name " : c . name , " address-line1 " : c . address . line1 , " address-line2 " : c . address . line2 , " address-level2 " : c . address . city ,
" address-level1 " : c . address . region , " postal-code " : c . address . postal , " country " : c . address . country ,
" tel " : c . phones . first ( ) . cloned ( ) . unwrap_or_default ( ) , " email " : c . emails . first ( ) . cloned ( ) . unwrap_or_default ( ) ,
2026-11-12 14:53:30 +00:00
} )
}
/// What the contact fill script answered, said to the bot.
pub ( crate ) fn contact_fill_text ( c : & crate ::vault_store ::Item , got : & Value ) -> Result < String , String > {
安全、修正: 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
if let Some ( now_host ) = got [ " wrong_host " ] . as_str ( ) {
return Err ( format! ( " 頁面網址在等待核准期間變成了 {now_host} ,已取消填入聯絡資訊。 " ) ) ;
}
2026-11-12 14:53:30 +00:00
let ( names , _ ) = filled_summary ( got ) ;
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 names . is_empty ( ) {
return Err ( " 這一頁找不到地址或聯絡欄位。 " . into ( ) ) ;
}
Ok ( format! ( " 已填入「 {} 」的 {} 。請用 browser_read 確認。 " , c . display_title ( ) , names . join ( " 、 " ) ) )
}
#[ cfg(test) ]
mod tests {
use super ::* ;
2026-11-14 08:21:32 +00:00
#[ test ]
fn an_empty_vault_offers_no_fill_tools ( ) {
use crate ::vault_store ::Kind ;
let names = | o : & Offer | specs_for ( o ) . iter ( ) . map ( | t | t [ " name " ] . as_str ( ) . unwrap ( ) . to_string ( ) ) . collect ::< Vec < _ > > ( ) ;
// Linux with nothing saved and no 1Password: nothing to fill, nothing offered.
let none = Offer ::from_kinds ( & [ ] , false ) ;
assert! ( ! none . any ( ) & & specs_for ( & none ) . is_empty ( ) ) ;
// Only what is there.
let contacts = Offer ::from_kinds ( & [ Kind ::Contact ] , false ) ;
assert_eq! ( names ( & contacts ) , [ LIST_TOOL , CONTACT_TOOL ] ) ;
assert_eq! ( contacts . kinds ( ) , [ " contact " ] ) ;
// Logins can come from the keychain / 1Password with nothing saved.
assert_eq! ( names ( & Offer ::from_kinds ( & [ ] , true ) ) , [ LIST_TOOL , TOOL ] ) ;
assert_eq! ( names ( & Offer ::from_kinds ( & [ Kind ::Card , Kind ::Login ] , false ) ) , [ LIST_TOOL , TOOL , CARD_TOOL ] ) ;
}
#[ test ]
fn a_fill_of_an_item_that_is_not_there_says_so_first ( ) {
use crate ::vault_store ::Kind ;
// 「contact_id: x」 with no contacts saved: about the vault, not about tabs, and pointing
// at what the bot meant to do.
let e = check_ids_in ( CONTACT_TOOL , r # "{"contact_id":"x"}"# , & [ ] ) . unwrap_err ( ) ;
assert! ( e . contains ( " 沒有存任何聯絡資訊 " ) & & e . contains ( " action=type " ) & & ! e . contains ( " 分頁 " ) , " {e} " ) ;
let e = check_ids_in ( CARD_TOOL , r # "{"card_id":"y"}"# , & [ ( " c1 " , Kind ::Card ) ] ) . unwrap_err ( ) ;
assert! ( e . contains ( " 「y」 " ) & & e . contains ( " vault_list " ) , " {e} " ) ;
// An id of another kind is no id of this one.
assert! ( check_ids_in ( CONTACT_TOOL , r # "{"contact_id":"c1"}"# , & [ ( " c1 " , Kind ::Card ) ] ) . is_err ( ) ) ;
assert! ( check_ids_in ( CONTACT_TOOL , r # "{"contact_id":"k1"}"# , & [ ( " k1 " , Kind ::Contact ) ] ) . is_ok ( ) ) ;
// A login by site (no id) is looked up later; one by id must exist.
assert! ( check_ids_in ( TOOL , r # "{"site":"threads.com"}"# , & [ ] ) . is_ok ( ) ) ;
assert! ( check_ids_in ( TOOL , r # "{"login_id":"zz"}"# , & [ ] ) . is_err ( ) ) ;
}
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
#[ test ]
fn hosts_and_candidates ( ) {
assert_eq! ( host_of ( " https://accounts.Google.com/signin?x=1 " ) , " accounts.google.com " ) ;
assert_eq! ( host_of ( " https://me:pw@example.com:8443/a " ) , " example.com " ) ;
assert_eq! ( candidates ( " a.b.example.com " ) , vec! [ " a.b.example.com " , " b.example.com " , " example.com " ] ) ;
let found = parse_secret_search ( " [/org/freedesktop/secrets/collection/login/7] \n label = AnyBot 登入: x.com \n secret = hunter2 \n created = 2026-11-04 \n attribute.application = anybot \n attribute.server = x.com \n attribute.user = me \n [/org/freedesktop/secrets/collection/login/8] \n secret = pw2 \n attribute.server = y.com \n " ) ;
assert_eq! ( found . len ( ) , 2 ) ;
assert_eq! ( found [ 0 ] . 1 , " hunter2 " ) ;
assert_eq! ( found [ 0 ] . 0 [ " user " ] , " me " ) ;
assert_eq! ( found [ 1 ] . 0 [ " server " ] , " y.com " ) ;
}
#[ test ]
fn keychain_password_lines ( ) {
assert_eq! ( parse_g_password ( " password: \" hunter2 \" \n " ) . unwrap ( ) , " hunter2 " ) ;
assert_eq! ( parse_g_password ( " password: \" a \" b \" \n " ) . unwrap ( ) , " a \" b " ) ;
assert_eq! ( parse_g_password ( " password: 0x706122737320E4BDA0E5A5BD \" pa \\ \" ss \\ 344 \\ 275 \\ 240 \\ 345 \\ 245 \\ 275 \" \n " ) . unwrap ( ) , " pa \" ss 你好 " ) ;
assert_eq! ( parse_g_password ( " password: \n " ) . unwrap ( ) , " " ) ;
assert! ( parse_g_password ( " nothing " ) . is_none ( ) ) ;
}
#[ test ]
fn the_script_keeps_the_password_in_a_string ( ) {
let js = fill_script ( " me@x.com " , " p \" w'</script> " , true ) ;
assert! ( js . contains ( r # ""p\"w'</script>""# ) ) ;
assert! ( js . contains ( " input[type=password] " ) & & js . contains ( " if (true && (pw || user)) " ) ) ;
}
/// The whole bot-side flow on this computer: local pages in AnyBot's browser (a throwaway
/// profile), items in a scratch vault, and the fill tools. Run with ANYBOT_DATA_DIR set to a
/// scratch folder; opens a browser window for a moment.
#[ test ]
#[ ignore ]
fn fill_live ( ) {
use crate ::vault_store as store ;
use std ::io ::{ Read , Write } ;
let dir = crate ::model ::State ::path ( ) . parent ( ) . unwrap ( ) . to_path_buf ( ) ;
std ::env ::set_var ( " ANYBOT_VAULT_DIR " , & dir ) ;
std ::env ::set_var ( " ANYBOT_VAULT_KEY_FILE " , dir . join ( " vault-test.key " ) ) ;
let listener = std ::net ::TcpListener ::bind ( " 127.0.0.1:0 " ) . unwrap ( ) ;
let port = listener . local_addr ( ) . unwrap ( ) . port ( ) ;
std ::thread ::spawn ( move | | {
for mut c in listener . incoming ( ) . flatten ( ) {
let mut buf = [ 0 u8 ; 2048 ] ;
let n = c . read ( & mut buf ) . unwrap_or ( 0 ) ;
let req = String ::from_utf8_lossy ( & buf [ .. n ] ) ;
let page = if req . starts_with ( " GET /checkout " ) {
" <html><body><form><input autocomplete=name id=n><input name=street id=a1><input placeholder=City id=c><input name=zip id=z><input type=tel id=t><input id=cc name=cardnumber><input id=ex placeholder='MM / YY'><input id=cv name=cvc><input id=hn placeholder='Name on card'></form></body></html> "
} else {
" <html><body><form><input type=email name=email id=e><input type=password id=p><button type=submit>Sign in</button></form></body></html> "
} ;
let _ = write! ( c , " HTTP/1.1 200 OK \r \n Content-Type: text/html; charset=utf-8 \r \n Content-Length: {} \r \n Connection: close \r \n \r \n {page} " , page . len ( ) ) ;
}
} ) ;
crate ::botbrowser ::add ( " vault-test " ) . unwrap ( ) ;
let run = | | -> Result < ( ) , String > {
let login = store ::put_login ( store ::LoginInput { id : None , sites : vec ! [ " 127.0.0.1 " . into ( ) ] , username : " tester@example.org " . into ( ) , password : " pa \" ss 你好 " . into ( ) , notes : String ::new ( ) } ) ? ;
let card = store ::put_card ( store ::CardInput { id : None , number : " 4111111111111111 " . into ( ) , expiry : " 08/39 " . into ( ) , csc : " 123 " . into ( ) , holder : " WANG XIAOMING " . into ( ) , nickname : " 測試 " . into ( ) , billing : store ::Address ::default ( ) , notes : String ::new ( ) } ) ? ;
let contact = store ::put_contact ( store ::ContactInput { id : None , label : " 住家 " . into ( ) , name : " 王小明 " . into ( ) , address : store ::Address { line1 : " 信義路五段 7 號 " . into ( ) , city : " 台北市 " . into ( ) , postal : " 110 " . into ( ) , .. Default ::default ( ) } , phones : vec ! [ " 0912345678 " . into ( ) ] , emails : vec ! [ ] , notes : String ::new ( ) } ) ? ;
// What the bot sees has no secrets.
let seen = list_for_bot ( " {} " ) ;
assert! ( seen . contains ( " tester@example.org " ) & & seen . contains ( " 1111 " ) & & ! seen . contains ( " 4111111111111111 " ) & & ! seen . contains ( " pa \\ \" ss " ) & & ! seen . contains ( " 123 \" " ) , " {seen} " ) ;
crate ::botbrowser ::open ( & format! ( " http://127.0.0.1: {port} /login " ) , Some ( " vault-test " ) ) ? ;
let plan = plan_login ( " {} " ) ? ;
assert! ( plan . matched & & plan . item . as_ref ( ) . map ( | i | i . id = = login ) . unwrap_or ( false ) ) ;
let said = fill_login ( & plan , false ) ? ;
assert! ( ! said . contains ( " pa \" ss " ) , " {said} " ) ;
let ( _ , got ) = crate ::botbrowser ::eval_current ( None , " JSON.stringify([e.value, p.value]) " ) ? ;
assert_eq! ( got . as_str ( ) . unwrap ( ) , r # "["tester@example.org","pa\"ss 你好"]"# ) ;
crate ::botbrowser ::open ( & format! ( " http://127.0.0.1: {port} /checkout " ) , Some ( " vault-test " ) ) ? ;
let said = fill_card ( & format! ( " {{ \" card_id \" : \" {card} \" }} " ) ) ? ;
assert! ( ! said . contains ( " 4111111111111111 " ) & & ! said . contains ( " 123 " ) , " {said} " ) ;
fill_contact ( & format! ( " {{ \" contact_id \" : \" {contact} \" }} " ) ) ? ;
let ( _ , got ) = crate ::botbrowser ::eval_current ( None , " JSON.stringify([n.value,a1.value,c.value,z.value,t.value,cc.value,ex.value,cv.value,hn.value]) " ) ? ;
assert_eq! ( got . as_str ( ) . unwrap ( ) , r # "["王小明","信義路五段 7 號","台北市","110","0912345678","4111111111111111","08/39","123","WANG XIAOMING"]"# ) ;
Ok ( ( ) )
} ;
let r = run ( ) ;
let _ = crate ::botbrowser ::remove ( " vault-test " ) ;
let _ = std ::fs ::remove_file ( dir . join ( " vault-test.key " ) ) ;
let _ = std ::fs ::remove_file ( store ::file_path ( ) ) ;
r . unwrap ( ) ;
}
}