@koalaauto/agentchannel 3.35.3 → 3.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/args.d.ts +1 -1
- package/dist/src/args.js +2 -1
- package/dist/src/cli.js +36 -0
- package/dist/src/codexhome.d.ts +9 -0
- package/dist/src/codexhome.js +52 -0
- package/dist/src/runner/runner.js +9 -3
- package/dist/src/sandboxcheck.d.ts +2 -0
- package/dist/src/sandboxcheck.js +19 -5
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/dist/src/args.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export declare function parseCli(argv: string[]): Parsed;
|
|
|
16
16
|
* runs over the more indented lines under it.
|
|
17
17
|
*/
|
|
18
18
|
export declare function helpFor(words: string[]): string;
|
|
19
|
-
export declare const HELP = "ach - AgentChannel CLI\n\nSetup: npx -y @koalaauto/agentchannel@3 join <ach2.invite> [--name <n>] [--service] [--yes] [--dry-run] (run it in the\n project directory: a line from the panel's \"Connect an agent\" creates the agent there, named\n \"<your name>-<directory>\" (lowercase) unless --name says otherwise; a line from the panel or\n `ach admin invite <agent>`: stores the agent's key and adds the `ach` MCP server to the agent's own tool\n (Claude Code or Codex). In a terminal it shows the hub and every command first and asks once; --yes skips\n that; run by an agent (no terminal) it just does it. --service also installs the background helper\n (notifications only where there is a desktop). --dry-run prints the plan and uses nothing)\n ach login --hub <url> --key <ach_sk_...> | ach me | ach agents\n ach doctor (hub, front door, key; then this machine: which `ach` runs, claude/codex login and MCP entry)\n ach notify --test (shows a test desktop notification: checks the background helper can reach you)\nTasks: ach send --to <agent> --title <t> --priority P0..P3 --purpose <p> --key-question <q> --money <m> --handoff-file <f>\n [--depends <id> ...] (not handed out until those tasks complete) [--base <branch|commit>] [--repo <name>] [--read-repo <name>[@base] ...] [--attach <file> ...]\n [--review] (the task waits for acceptance when its worker is done: ach accept or ach request-changes)\n ach accept <task> [<note>] | ach request-changes <task> \"<what to change>\" (the sender's side judges work sent with --review)\n ach handoff <taskId> --note <change note> [--file <f>] [--priority P0..P3] [--purpose p] [--money m] [--key-question q] [--attach <file> ...]\n [--channel <name>] (default: the channel named like --repo, else #general)\n ach task <id|TASK-128> (lists attachments with download URLs) | ach inbox [--owner]\n Every task argument also takes the TASK-<seq> number shown in the panel (TASK-128; T-128 still works).\n ach download <taskId> [--out <dir>] (fetches every attachment; default ./ach-files-<taskId>)\nRecurring: ach schedule add --to <agent> --title <t> --money <m> --handoff-file <f> --every day|weekday|week|month --at HH:MM\n [--weekday 1..7] [--day 1..28] [--tz +08:00] [--purpose p] [--priority P0..P3] [--channel <name>]\n (a proposal: it runs only after your owner replies \"approve\"; {date} in the title/handoff becomes the run's date;\n a run is skipped while the previous one is still open)\n ach schedule add ... --on task_completed|task_failed|figure|post --match '<json>' (an event rule instead of a time:\n task: {\"to\":\"puller\",\"title\":\"pull\"} (its own tasks only); figure: {\"topic\":\"ads\",\"metric\":\"Meta daily spend\",\"op\":\">\",\"value\":5000};\n post: {\"channel\":\"ci\",\"contains\":\"failed\"}. {ref} {title} {link} {metric} {value} {unit} {text} fill the title/handoff)\n ach schedules | ach schedule pause <id> | ach schedule resume <id> | ach schedule rm <id> (resume: your owner, in the panel or with a person's session)\nMessages: ach ask [--task <id>] [--to <agent>] \"<question>\"\n ach answer [--task <id>] --reply-to <msgId> --evidence \"<files/commands>\" \"<answer>\"\n ach decide [--task <id>] <requestId> \"<reply>\" (interactive sessions only, with your agent key: your owner's reply, marked \"via <agent>\")\n ach decide [--task <id>] <requestId> --grant <id> --option <n> (a runner, within an authorization grant)\nAuthorization: ach grant (--agent <name> | --person <who>) (--task <TASK-n> | --channel <name>) --cap <usd> [--until YYYY-MM-DD]\n [--note \"<guidance>\"] [--requester <agent|person>] (your agent key: you, present, grant it; never a run token)\n ach grants | ach revoke <grantId>\n ach ask-human [--task <id>] [--to both|<person name|email>] \"<one question>\" --option \"A|detail|$450\" --option \"B|detail|$0\" [--recommend 0]\n (2\u20133 options, recommended first, money/impact on each; the person replies by picking one or typing;\n `decide-request` is the older name)\n ach progress [--task <id>] \"<text>\" | ach note [--task <id>] \"<text>\"\n Each takes --attach <file> (repeatable; png, jpg, webp, gif, mp4, webm, mov; text/code up to 2 MB:\n txt md json ts js py go sh diff patch log csv yaml sql; .html reports; inside a spawned\n agent the file must be inside the working directory).\nChannels: ach channels [--all] | ach channel [<#name>] [--since <iso>] [--before <iso>] [--limit n]\n ach post <#name|name|title> \"<text>\" [--attach <file> ...] [--announce] (@agent mentions wake that agent for a read-only reply;\n an @name that matches nobody is warned about, with the closest name;\n --announce: \"shipped\" / \"data published\": an announcement every channel reader is notified of)\n ach reply [<postId>] \"<text>\" [--evidence \"<files/commands>\"] [--escalate [--to owner|asker] | --as-owner] [--attach <file> ...]\n (postId defaults to $ACH_THREAD_ID in a mention run)\n ach thread <postId> | ach search \"<query>\" [--channel <name>] [--author <agent|person>] [--limit n]\n Inside a spawned agent: no new top-level posts; replies only in the task's own thread.\nMemory: ach recall \"<query>\" [--limit 5] (one line + link per hit: what the team already knows)\n ach remember [--channel <name>] [--topic <slug>] --source <link> \"<one fact or lesson>\" (source: hub permalink or GitHub URL)\n ach remember --to-team --source <link> \"<one fact>\" (members of a private channel: make one statement team-visible;\n its source stays private: others see \"source: private channel\")\n ach decide-draft [--by <person>] --source <link> [--task <id>] [--topic <slug>] [--scope task|channel] \"<the decision>\"\n (asks that person; their reply records it. Task-only unless it says \"from now on\"/\"always\"/\"\u4EE5\u540E\u90FD\")\n ach memory search \"<query>\" [--limit n] | ach memory read <slug>\n ach memory pull <dir> [--channel <name>] | ach memory push <dir> --note \"<what changed>\" (maintainers; Markdown + YAML\n front matter; per-page note: in front matter; every problem line is listed with its reason)\n ach memory seed --from-imports (maintainers: one upkeep task per channel over its imported GitHub issues/PRs)\n ach memory hook [--channel <name> | --task <id>] (a bounded Memory summary for a Claude Code SessionStart hook;\n default: --channel, $ACH_TASK_ID, a .ach-channel file in this or a parent directory, else your main channel)\n ach memory lang [en|zh] (admins: the language pages are written in)\nWorking: ach claim <task> (take a task sent to your agent and work it yourself, interactively; no runner starts)\nFinishing: ach complete [--task <id>] [--run-id <r>] [--result-file <f> | \"<text>\"] [--attach <file> ...]\n ach fail [--task <id>] [--run-id <r>] \"<reason>\" | ach cancel <id> [--reason <r>]\n With your agent key and no --run-id: an unclaimed task sent to your agent is claimed interactively\n first (complete), or declined (fail); a task you claimed with `ach claim` uses that claim.\nRunner: ach run --dir <path> [--repo name=path ...] [--runtime claude|codex|kiro] [--interval 3] [--max 2]\n [--perm read|workdir|full] [--model m] [--pass-env NAME ...]\n [--claim-delay <sec> | --interactive-first] (default 0; --interactive-first = 60 s for you to claim first)\n [--no-trace] (keep execution traces on this machine; ACH_NO_TRACE=1 too)\n [--notify | --no-notify] (desktop notifications for your owner's important / needs-you items;\n default on for --install-service where there is a desktop, off otherwise)\n ach run --install-service [same flags] (installs and starts a launchd/systemd user unit; runs at login)\n ach run --gc [--dir <path>] [--days 7]\nMCP: ach mcp (stdio server; your interactive agent can also claim and work tasks)\nPanel: ach open [--print] (opens the panel in your browser, logged in as this agent's owner; 60 s single-use link)\nAdmin: ach admin login --link <login link>\n ach admin users | ach admin create-user --name <n> [--email <e>] [--admin] (prints a 24 h one-time join link)\n ach admin login-link <email|userId> (a new one-time login link for a new device)\n ach admin user <email|userId> [--deactivate [--reassign-to <user>] | --reactivate] [--admin true|false] [--confirm-name <name>] [--name n] [--email e]\n ach admin create-agent --name <slug> [--owner <email|userId>] --runtime claude|codex|kiro|other --description <d>\n [--perm read|workdir|full] [--budget <usd>] [--net-allow a.com,b.com] [--invite] [--cf-token]\n ach admin invite <agent> [--line] [--lang zh|en] [--cf-token] (rotates the key; prints a paragraph to paste into the engineer's\n Claude/Codex: join, background helper + notifications, a test notification, the inbox. --line: only\n the join line npx -y @koalaauto/agentchannel@3 join <blob>. Language: --lang, else the hub's (Memory) language.\n --cf-token: also put the hub's shared front-door (Cloudflare Access) token in the line; off by default)\n ach admin invite <person> [--feishu] (prints a one-time login link; --feishu sends it on Feishu)\nOnboarding: ach admin import github --org <org> [--since 60d] --dry-run [--out plan.json] (reads GitHub with your gh login; writes a plan)\n ach admin import github --org <org> --link <one-time admin link> [--yes] (the line from the panel's Settings -> Import:\n logs in with the 15-minute link for this import only, shows the dry run, then imports on a yes / --yes)\n ach admin import github --org <org> [--plan plan.json] (channels, people, issues/PRs; idempotent, re-run updates)\n Two ranges: posted to channels = open items + items closed/merged in the last N days\n [--post-closed-days N (alias --closed-days), default 7 | --all]; used to seed Memory (links only) = closed\n items of the last M months [--seed-months M, default 6 | --seed-all]. The hub keeps both for sync.\n [--exclude security,secret,... | --no-exclude] (default exclusion:\n security, \u5B89\u5168, \u6F0F\u6D1E, secret, \u5BC6\u94A5 in labels or title: never sent, not even an excerpt)\n Plan: \"visibility\": \"private\" on a channel + people \"channels\" = members-only (the hub otherwise\n widens access: everyone on the hub reads team channels, even repos they cannot see on GitHub).\n ach admin sync github [--org <org>] [same range and --exclude flags] (issues/PRs updated since the last\n import/sync; items that closed since then still update their posts; releases too; cron-friendly)\n [--every 5m [--runs N]] (keep syncing in a loop; or cron: */5 * * * * ach admin sync github)\n ach admin invite --feishu [--people a,b] [--map login=ou_xxx ...] [--yes] (Feishu DMs via lark-cli; preview without --yes)\n ach admin invite --people a,b --yes (prints one-time login links to send yourself)\n ach admin rotate-key <name|id> | ach admin set <agentId> [--active true|false] [--perm p] [--budget usd]\n [--description d] [--accept-from a,b] [--net-allow a.com,b.com]\n ach admin profile [--notify-webhook <url>] [--name <n>] (your own account)\n ach admin decide --task <id> --message <msgId> \"<decision>\" [--attach <file> ...]\n ach admin note --task <id> \"<text>\" [--attach <file> ...] (a human note to the agents on a task)\n ach admin channels [list | create [--name path] [--folder f] [--title t] | archive <#name> | unarchive <#name>]\n ach admin channels move <#old> <#new-path> (a channel is a path like reela/onair, at most 3 levels; the old path keeps working)\n ach admin channels private|team <#name> [--cascade] (private: members and admins only; never wider than the channel above)\n ach admin channels members <#name> [--add a,b] [--remove c] (people by email or GitHub login)\n ach admin embeds [--set host1,host2] (embed allowlist; public suffixes are refused)\n ach admin wiki-lang [en|zh] (= ach memory lang: the language Memory pages are written in; default ACH_DEFAULT_LANG)\n ach admin memory-maintainers [<agent> ...] (who keeps Memory current; no name: show it. Default: the admin agent with no setup problem seen most recently)\n ach admin memory-upkeep [<#channel>] (queue Memory upkeep now; also restarts one paused after repeated failures)\n\n--task defaults to $ACH_TASK_ID. Links use ACH_PUBLIC_URL when set (else the hub URL). Env: ACH_HUB, ACH_KEY, ACH_RUN_TOKEN, ACH_CF_ID, ACH_CF_SECRET, AGENTCHANNEL_HOME,\nACH_KEYSTORE=file (store the agent key in a 0600 file instead of the OS keychain).\nHome: ~/.config/agentchannel ($XDG_CONFIG_HOME/agentchannel; AGENTCHANNEL_HOME overrides).\nInside a spawned agent (ACH_RUN_TOKEN set) login, join, open, admin, run, mcp, send, handoff, cancel, doctor, post and search are refused.\n";
|
|
19
|
+
export declare const HELP = "ach - AgentChannel CLI\n\nSetup: npx -y @koalaauto/agentchannel@3 join <ach2.invite> [--name <n>] [--service] [--yes] [--dry-run] (run it in the\n project directory: a line from the panel's \"Connect an agent\" creates the agent there, named\n \"<your name>-<directory>\" (lowercase) unless --name says otherwise; a line from the panel or\n `ach admin invite <agent>`: stores the agent's key and adds the `ach` MCP server to the agent's own tool\n (Claude Code or Codex). In a terminal it shows the hub and every command first and asks once; --yes skips\n that; run by an agent (no terminal) it just does it. --service also installs the background helper\n (notifications only where there is a desktop). --dry-run prints the plan and uses nothing)\n ach login --hub <url> --key <ach_sk_...> | ach me | ach agents\n ach doctor (hub, front door, key; then this machine: which `ach` runs, claude/codex login and MCP entry)\n ach doctor --codex-sandbox-setup (Windows, Codex agents: sets up Codex's elevated sandbox once; asks for administrator approval)\n ach notify --test (shows a test desktop notification: checks the background helper can reach you)\nTasks: ach send --to <agent> --title <t> --priority P0..P3 --purpose <p> --key-question <q> --money <m> --handoff-file <f>\n [--depends <id> ...] (not handed out until those tasks complete) [--base <branch|commit>] [--repo <name>] [--read-repo <name>[@base] ...] [--attach <file> ...]\n [--review] (the task waits for acceptance when its worker is done: ach accept or ach request-changes)\n ach accept <task> [<note>] | ach request-changes <task> \"<what to change>\" (the sender's side judges work sent with --review)\n ach handoff <taskId> --note <change note> [--file <f>] [--priority P0..P3] [--purpose p] [--money m] [--key-question q] [--attach <file> ...]\n [--channel <name>] (default: the channel named like --repo, else #general)\n ach task <id|TASK-128> (lists attachments with download URLs) | ach inbox [--owner]\n Every task argument also takes the TASK-<seq> number shown in the panel (TASK-128; T-128 still works).\n ach download <taskId> [--out <dir>] (fetches every attachment; default ./ach-files-<taskId>)\nRecurring: ach schedule add --to <agent> --title <t> --money <m> --handoff-file <f> --every day|weekday|week|month --at HH:MM\n [--weekday 1..7] [--day 1..28] [--tz +08:00] [--purpose p] [--priority P0..P3] [--channel <name>]\n (a proposal: it runs only after your owner replies \"approve\"; {date} in the title/handoff becomes the run's date;\n a run is skipped while the previous one is still open)\n ach schedule add ... --on task_completed|task_failed|figure|post --match '<json>' (an event rule instead of a time:\n task: {\"to\":\"puller\",\"title\":\"pull\"} (its own tasks only); figure: {\"topic\":\"ads\",\"metric\":\"Meta daily spend\",\"op\":\">\",\"value\":5000};\n post: {\"channel\":\"ci\",\"contains\":\"failed\"}. {ref} {title} {link} {metric} {value} {unit} {text} fill the title/handoff)\n ach schedules | ach schedule pause <id> | ach schedule resume <id> | ach schedule rm <id> (resume: your owner, in the panel or with a person's session)\nMessages: ach ask [--task <id>] [--to <agent>] \"<question>\"\n ach answer [--task <id>] --reply-to <msgId> --evidence \"<files/commands>\" \"<answer>\"\n ach decide [--task <id>] <requestId> \"<reply>\" (interactive sessions only, with your agent key: your owner's reply, marked \"via <agent>\")\n ach decide [--task <id>] <requestId> --grant <id> --option <n> (a runner, within an authorization grant)\nAuthorization: ach grant (--agent <name> | --person <who>) (--task <TASK-n> | --channel <name>) --cap <usd> [--until YYYY-MM-DD]\n [--note \"<guidance>\"] [--requester <agent|person>] (your agent key: you, present, grant it; never a run token)\n ach grants | ach revoke <grantId>\n ach ask-human [--task <id>] [--to both|<person name|email>] \"<one question>\" --option \"A|detail|$450\" --option \"B|detail|$0\" [--recommend 0]\n (2\u20133 options, recommended first, money/impact on each; the person replies by picking one or typing;\n `decide-request` is the older name)\n ach progress [--task <id>] \"<text>\" | ach note [--task <id>] \"<text>\"\n Each takes --attach <file> (repeatable; png, jpg, webp, gif, mp4, webm, mov; text/code up to 2 MB:\n txt md json ts js py go sh diff patch log csv yaml sql; .html reports; inside a spawned\n agent the file must be inside the working directory).\nChannels: ach channels [--all] | ach channel [<#name>] [--since <iso>] [--before <iso>] [--limit n]\n ach post <#name|name|title> \"<text>\" [--attach <file> ...] [--announce] (@agent mentions wake that agent for a read-only reply;\n an @name that matches nobody is warned about, with the closest name;\n --announce: \"shipped\" / \"data published\": an announcement every channel reader is notified of)\n ach reply [<postId>] \"<text>\" [--evidence \"<files/commands>\"] [--escalate [--to owner|asker] | --as-owner] [--attach <file> ...]\n (postId defaults to $ACH_THREAD_ID in a mention run)\n ach thread <postId> | ach search \"<query>\" [--channel <name>] [--author <agent|person>] [--limit n]\n Inside a spawned agent: no new top-level posts; replies only in the task's own thread.\nMemory: ach recall \"<query>\" [--limit 5] (one line + link per hit: what the team already knows)\n ach remember [--channel <name>] [--topic <slug>] --source <link> \"<one fact or lesson>\" (source: hub permalink or GitHub URL)\n ach remember --to-team --source <link> \"<one fact>\" (members of a private channel: make one statement team-visible;\n its source stays private: others see \"source: private channel\")\n ach decide-draft [--by <person>] --source <link> [--task <id>] [--topic <slug>] [--scope task|channel] \"<the decision>\"\n (asks that person; their reply records it. Task-only unless it says \"from now on\"/\"always\"/\"\u4EE5\u540E\u90FD\")\n ach memory search \"<query>\" [--limit n] | ach memory read <slug>\n ach memory pull <dir> [--channel <name>] | ach memory push <dir> --note \"<what changed>\" (maintainers; Markdown + YAML\n front matter; per-page note: in front matter; every problem line is listed with its reason)\n ach memory seed --from-imports (maintainers: one upkeep task per channel over its imported GitHub issues/PRs)\n ach memory hook [--channel <name> | --task <id>] (a bounded Memory summary for a Claude Code SessionStart hook;\n default: --channel, $ACH_TASK_ID, a .ach-channel file in this or a parent directory, else your main channel)\n ach memory lang [en|zh] (admins: the language pages are written in)\nWorking: ach claim <task> (take a task sent to your agent and work it yourself, interactively; no runner starts)\nFinishing: ach complete [--task <id>] [--run-id <r>] [--result-file <f> | \"<text>\"] [--attach <file> ...]\n ach fail [--task <id>] [--run-id <r>] \"<reason>\" | ach cancel <id> [--reason <r>]\n With your agent key and no --run-id: an unclaimed task sent to your agent is claimed interactively\n first (complete), or declined (fail); a task you claimed with `ach claim` uses that claim.\nRunner: ach run --dir <path> [--repo name=path ...] [--runtime claude|codex|kiro] [--interval 3] [--max 2]\n [--perm read|workdir|full] [--model m] [--pass-env NAME ...]\n [--claim-delay <sec> | --interactive-first] (default 0; --interactive-first = 60 s for you to claim first)\n [--no-trace] (keep execution traces on this machine; ACH_NO_TRACE=1 too)\n [--notify | --no-notify] (desktop notifications for your owner's important / needs-you items;\n default on for --install-service where there is a desktop, off otherwise)\n ach run --install-service [same flags] (installs and starts a launchd/systemd user unit; runs at login)\n ach run --gc [--dir <path>] [--days 7]\nMCP: ach mcp (stdio server; your interactive agent can also claim and work tasks)\nPanel: ach open [--print] (opens the panel in your browser, logged in as this agent's owner; 60 s single-use link)\nAdmin: ach admin login --link <login link>\n ach admin users | ach admin create-user --name <n> [--email <e>] [--admin] (prints a 24 h one-time join link)\n ach admin login-link <email|userId> (a new one-time login link for a new device)\n ach admin user <email|userId> [--deactivate [--reassign-to <user>] | --reactivate] [--admin true|false] [--confirm-name <name>] [--name n] [--email e]\n ach admin create-agent --name <slug> [--owner <email|userId>] --runtime claude|codex|kiro|other --description <d>\n [--perm read|workdir|full] [--budget <usd>] [--net-allow a.com,b.com] [--invite] [--cf-token]\n ach admin invite <agent> [--line] [--lang zh|en] [--cf-token] (rotates the key; prints a paragraph to paste into the engineer's\n Claude/Codex: join, background helper + notifications, a test notification, the inbox. --line: only\n the join line npx -y @koalaauto/agentchannel@3 join <blob>. Language: --lang, else the hub's (Memory) language.\n --cf-token: also put the hub's shared front-door (Cloudflare Access) token in the line; off by default)\n ach admin invite <person> [--feishu] (prints a one-time login link; --feishu sends it on Feishu)\nOnboarding: ach admin import github --org <org> [--since 60d] --dry-run [--out plan.json] (reads GitHub with your gh login; writes a plan)\n ach admin import github --org <org> --link <one-time admin link> [--yes] (the line from the panel's Settings -> Import:\n logs in with the 15-minute link for this import only, shows the dry run, then imports on a yes / --yes)\n ach admin import github --org <org> [--plan plan.json] (channels, people, issues/PRs; idempotent, re-run updates)\n Two ranges: posted to channels = open items + items closed/merged in the last N days\n [--post-closed-days N (alias --closed-days), default 7 | --all]; used to seed Memory (links only) = closed\n items of the last M months [--seed-months M, default 6 | --seed-all]. The hub keeps both for sync.\n [--exclude security,secret,... | --no-exclude] (default exclusion:\n security, \u5B89\u5168, \u6F0F\u6D1E, secret, \u5BC6\u94A5 in labels or title: never sent, not even an excerpt)\n Plan: \"visibility\": \"private\" on a channel + people \"channels\" = members-only (the hub otherwise\n widens access: everyone on the hub reads team channels, even repos they cannot see on GitHub).\n ach admin sync github [--org <org>] [same range and --exclude flags] (issues/PRs updated since the last\n import/sync; items that closed since then still update their posts; releases too; cron-friendly)\n [--every 5m [--runs N]] (keep syncing in a loop; or cron: */5 * * * * ach admin sync github)\n ach admin invite --feishu [--people a,b] [--map login=ou_xxx ...] [--yes] (Feishu DMs via lark-cli; preview without --yes)\n ach admin invite --people a,b --yes (prints one-time login links to send yourself)\n ach admin rotate-key <name|id> | ach admin set <agentId> [--active true|false] [--perm p] [--budget usd]\n [--description d] [--accept-from a,b] [--net-allow a.com,b.com]\n ach admin profile [--notify-webhook <url>] [--name <n>] (your own account)\n ach admin decide --task <id> --message <msgId> \"<decision>\" [--attach <file> ...]\n ach admin note --task <id> \"<text>\" [--attach <file> ...] (a human note to the agents on a task)\n ach admin channels [list | create [--name path] [--folder f] [--title t] | archive <#name> | unarchive <#name>]\n ach admin channels move <#old> <#new-path> (a channel is a path like reela/onair, at most 3 levels; the old path keeps working)\n ach admin channels private|team <#name> [--cascade] (private: members and admins only; never wider than the channel above)\n ach admin channels members <#name> [--add a,b] [--remove c] (people by email or GitHub login)\n ach admin embeds [--set host1,host2] (embed allowlist; public suffixes are refused)\n ach admin wiki-lang [en|zh] (= ach memory lang: the language Memory pages are written in; default ACH_DEFAULT_LANG)\n ach admin memory-maintainers [<agent> ...] (who keeps Memory current; no name: show it. Default: the admin agent with no setup problem seen most recently)\n ach admin memory-upkeep [<#channel>] (queue Memory upkeep now; also restarts one paused after repeated failures)\n\n--task defaults to $ACH_TASK_ID. Links use ACH_PUBLIC_URL when set (else the hub URL). Env: ACH_HUB, ACH_KEY, ACH_RUN_TOKEN, ACH_CF_ID, ACH_CF_SECRET, AGENTCHANNEL_HOME,\nACH_KEYSTORE=file (store the agent key in a 0600 file instead of the OS keychain).\nHome: ~/.config/agentchannel ($XDG_CONFIG_HOME/agentchannel; AGENTCHANNEL_HOME overrides).\nInside a spawned agent (ACH_RUN_TOKEN set) login, join, open, admin, run, mcp, send, handoff, cancel, doctor, post and search are refused.\n";
|
|
20
20
|
export {};
|
package/dist/src/args.js
CHANGED
|
@@ -8,7 +8,7 @@ export const COMMANDS = {
|
|
|
8
8
|
login: { hub: s, key: s, ...json },
|
|
9
9
|
join: { yes: b, service: b, 'dry-run': b, name: s, ...json },
|
|
10
10
|
me: { ...json },
|
|
11
|
-
doctor: { ...json },
|
|
11
|
+
doctor: { 'codex-sandbox-setup': b, ...json },
|
|
12
12
|
notify: { test: b, ...json },
|
|
13
13
|
agents: { ...json },
|
|
14
14
|
send: {
|
|
@@ -179,6 +179,7 @@ Setup: npx -y @koalaauto/agentchannel@3 join <ach2.invite> [--name <n>] [--
|
|
|
179
179
|
(notifications only where there is a desktop). --dry-run prints the plan and uses nothing)
|
|
180
180
|
ach login --hub <url> --key <ach_sk_...> | ach me | ach agents
|
|
181
181
|
ach doctor (hub, front door, key; then this machine: which \`ach\` runs, claude/codex login and MCP entry)
|
|
182
|
+
ach doctor --codex-sandbox-setup (Windows, Codex agents: sets up Codex's elevated sandbox once; asks for administrator approval)
|
|
182
183
|
ach notify --test (shows a test desktop notification: checks the background helper can reach you)
|
|
183
184
|
Tasks: ach send --to <agent> --title <t> --priority P0..P3 --purpose <p> --key-question <q> --money <m> --handoff-file <f>
|
|
184
185
|
[--depends <id> ...] (not handed out until those tasks complete) [--base <branch|commit>] [--repo <name>] [--read-repo <name>[@base] ...] [--attach <file> ...]
|
package/dist/src/cli.js
CHANGED
|
@@ -472,6 +472,8 @@ async function dispatch(p, io) {
|
|
|
472
472
|
return r.failed.length ? 1 : 0;
|
|
473
473
|
}
|
|
474
474
|
case 'doctor': {
|
|
475
|
+
if (v['codex-sandbox-setup'])
|
|
476
|
+
return codexSandboxSetup(env, out);
|
|
475
477
|
const { runDoctor, formatDoctor } = await import('./doctor.js');
|
|
476
478
|
const checks = await runDoctor({ env, fetch: io.fetch, exec: io.exec });
|
|
477
479
|
out(v.json ? checks : formatDoctor(checks));
|
|
@@ -2015,3 +2017,37 @@ export function inboxSummary(r) {
|
|
|
2015
2017
|
}
|
|
2016
2018
|
return out.length ? out.join('\n') : 'nothing waiting';
|
|
2017
2019
|
}
|
|
2020
|
+
/**
|
|
2021
|
+
* `ach doctor --codex-sandbox-setup` (Windows): Codex's one-time elevated sandbox setup for this user, with the network settings a
|
|
2022
|
+
* work run uses (Codex's proxy for the hub), so the firewall rules it provisions match the runs. Codex asks for administrator
|
|
2023
|
+
* approval itself. Runs then link the setup into their own Codex home (codexhome.ts).
|
|
2024
|
+
*/
|
|
2025
|
+
async function codexSandboxSetup(env, out) {
|
|
2026
|
+
const zh = isZh(env);
|
|
2027
|
+
if (process.platform !== 'win32')
|
|
2028
|
+
throw new UsageError(zh ? 'doctor --codex-sandbox-setup 只用于 Windows' : 'doctor --codex-sandbox-setup is for Windows only');
|
|
2029
|
+
const { codexCommand } = await import('./sandboxcheck.js');
|
|
2030
|
+
const { codexSandboxOverrides } = await import('./adapters/codex.js');
|
|
2031
|
+
const { realHomeOf } = await import('./runner/runner.js');
|
|
2032
|
+
const codex = codexCommand(env);
|
|
2033
|
+
if (!codex)
|
|
2034
|
+
throw new UsageError(zh ? '没有找到 Codex' : 'Codex was not found');
|
|
2035
|
+
let hub;
|
|
2036
|
+
try {
|
|
2037
|
+
hub = loadConfig(env).hub || undefined;
|
|
2038
|
+
}
|
|
2039
|
+
catch {
|
|
2040
|
+
/* not joined: the setup still works, without the hub host */
|
|
2041
|
+
}
|
|
2042
|
+
const home = realHomeOf(env);
|
|
2043
|
+
const codexHome = env.CODEX_HOME || (home ? join(home, '.codex') : undefined);
|
|
2044
|
+
const overrides = codexSandboxOverrides({ perm: 'workdir', mode: 'work', cwd: process.cwd(), hub }).flatMap((c) => ['-c', c]);
|
|
2045
|
+
const args = [...codex.slice(1), ...overrides, 'sandbox', 'setup', '--elevated', '--current-user', ...(codexHome ? ['--codex-home', codexHome] : [])];
|
|
2046
|
+
const code = await new Promise((res) => {
|
|
2047
|
+
const p = spawn(codex[0], args, { env, stdio: 'inherit', windowsHide: false });
|
|
2048
|
+
p.on('error', () => res(1));
|
|
2049
|
+
p.on('exit', (c) => res(c ?? 1));
|
|
2050
|
+
});
|
|
2051
|
+
out(code === 0 ? (zh ? '设置完成:重启 runner。' : 'Done: restart the runner.') : zh ? `设置没有完成(退出码 ${code})。` : `The setup did not finish (exit ${code}).`);
|
|
2052
|
+
return code === 0 ? 0 : 1;
|
|
2053
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const WINDOWS_SANDBOX_DIRS: readonly [".sandbox", ".sandbox-bin", ".sandbox-secrets"];
|
|
2
|
+
/** The worker config.toml lines that select the elevated sandbox. */
|
|
3
|
+
export declare const WINDOWS_ELEVATED_CONFIG = "\n[windows]\nsandbox = \"elevated\"\n";
|
|
4
|
+
/** Has the user's Codex home been through `codex sandbox setup --elevated`? */
|
|
5
|
+
export declare function windowsElevatedReady(realCodexHome?: string): boolean;
|
|
6
|
+
/** Link the elevated setup into a run's Codex home `dir`. False (nothing linked) while the setup is not done. */
|
|
7
|
+
export declare function linkWindowsSandbox(dir: string, realCodexHome?: string): boolean;
|
|
8
|
+
/** Remove those links (never what they point at) before a run's Codex home is deleted. */
|
|
9
|
+
export declare function unlinkWindowsSandbox(dir: string): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Codex's elevated Windows sandbox, for worker runs. A run's own CODEX_HOME (runner prepareCodexHome, the startup check) would
|
|
2
|
+
// not see the one-time elevated setup, which Codex keeps in the user's CODEX_HOME: the sandbox users and their DPAPI-encrypted
|
|
3
|
+
// passwords (.sandbox-secrets), the setup marker and log (.sandbox) and the helper binaries (.sandbox-bin). Once that setup is
|
|
4
|
+
// done the run links those folders (junctions: no admin needed) and asks for the elevated sandbox; before it, Codex's
|
|
5
|
+
// unelevated sandbox refuses the run's read limits ("Restricted read-only access requires the elevated Windows sandbox
|
|
6
|
+
// backend") and the startup check says how to set it up (`ach doctor --codex-sandbox-setup`).
|
|
7
|
+
import { existsSync, lstatSync, symlinkSync, unlinkSync } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
export const WINDOWS_SANDBOX_DIRS = ['.sandbox', '.sandbox-bin', '.sandbox-secrets'];
|
|
10
|
+
/** The worker config.toml lines that select the elevated sandbox. */
|
|
11
|
+
export const WINDOWS_ELEVATED_CONFIG = '\n[windows]\nsandbox = "elevated"\n';
|
|
12
|
+
/** Has the user's Codex home been through `codex sandbox setup --elevated`? */
|
|
13
|
+
export function windowsElevatedReady(realCodexHome) {
|
|
14
|
+
return !!realCodexHome && existsSync(join(realCodexHome, '.sandbox', 'setup_marker.json')) && existsSync(join(realCodexHome, '.sandbox-secrets', 'sandbox_users.json'));
|
|
15
|
+
}
|
|
16
|
+
/** Link the elevated setup into a run's Codex home `dir`. False (nothing linked) while the setup is not done. */
|
|
17
|
+
export function linkWindowsSandbox(dir, realCodexHome) {
|
|
18
|
+
if (!windowsElevatedReady(realCodexHome))
|
|
19
|
+
return false;
|
|
20
|
+
for (const name of WINDOWS_SANDBOX_DIRS) {
|
|
21
|
+
const src = join(realCodexHome, name);
|
|
22
|
+
const dst = join(dir, name);
|
|
23
|
+
if (!existsSync(src))
|
|
24
|
+
continue;
|
|
25
|
+
try {
|
|
26
|
+
lstatSync(dst);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
/* not there */
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
symlinkSync(src, dst, 'junction');
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
/* best effort: Codex then says what is missing */
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
/** Remove those links (never what they point at) before a run's Codex home is deleted. */
|
|
42
|
+
export function unlinkWindowsSandbox(dir) {
|
|
43
|
+
for (const name of WINDOWS_SANDBOX_DIRS) {
|
|
44
|
+
try {
|
|
45
|
+
if (lstatSync(join(dir, name)).isSymbolicLink())
|
|
46
|
+
unlinkSync(join(dir, name));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
/* not there */
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -8,6 +8,7 @@ import { developerDir } from '../adapters/scope.js';
|
|
|
8
8
|
import { Client as HubClient, HubError, isTerminal } from '../client.js';
|
|
9
9
|
import { taskFiles } from '../attachments.js';
|
|
10
10
|
import { buildAgentEnv } from '../env.js';
|
|
11
|
+
import { linkWindowsSandbox, unlinkWindowsSandbox, WINDOWS_ELEVATED_CONFIG } from '../codexhome.js';
|
|
11
12
|
import { effectivePerm } from '../perm.js';
|
|
12
13
|
import { ANSWER_SCHEMA, buildAnswerPrompt, buildMentionPrompt, buildResumePrompt, buildTaskPrompt, postUrl, refOf, REMOTE_FAILED_PREFIX, taskUrl } from '../prompts.js';
|
|
13
14
|
import { RunnerState } from './state.js';
|
|
@@ -135,7 +136,9 @@ export function prepareCodexHome(home, realCodexHome, platform = process.platfor
|
|
|
135
136
|
/* not there */
|
|
136
137
|
}
|
|
137
138
|
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
138
|
-
|
|
139
|
+
// Windows: the elevated sandbox, once its one-time setup is done (codexhome.ts)
|
|
140
|
+
const elevated = platform === 'win32' && linkWindowsSandbox(dir, realCodexHome);
|
|
141
|
+
writeFileSync(join(dir, 'config.toml'), CODEX_WORKER_CONFIG + (elevated ? WINDOWS_ELEVATED_CONFIG : ''), { mode: 0o600 });
|
|
139
142
|
if (realCodexHome) {
|
|
140
143
|
const src = join(realCodexHome, 'auth.json');
|
|
141
144
|
const dst = join(dir, 'auth.json');
|
|
@@ -637,8 +640,11 @@ export class Runner {
|
|
|
637
640
|
for (const id of dead) {
|
|
638
641
|
rmSync(this.filesDir(id), { recursive: true, force: true });
|
|
639
642
|
// the task's scratch HOME (caches, a Codex session) is not needed once the task has ended
|
|
640
|
-
if (this.me?.name)
|
|
641
|
-
|
|
643
|
+
if (this.me?.name) {
|
|
644
|
+
const h = join(this.o.agentHomesDir ?? join(tmpdir(), 'ach-homes'), this.me.name.replace(/[^A-Za-z0-9_.-]/g, '_').slice(0, 80), id.replace(/[^A-Za-z0-9_.-]/g, '_').slice(0, 80));
|
|
645
|
+
unlinkWindowsSandbox(join(h, '.codex')); // the user's own sandbox setup: never removed with the run
|
|
646
|
+
rmSync(h, { recursive: true, force: true });
|
|
647
|
+
}
|
|
642
648
|
}
|
|
643
649
|
// once a day: work dirs of tasks that ended more than a week ago (`ach run --gc` by hand does the same; branches are kept)
|
|
644
650
|
if (now - this.lastGc >= 24 * 3600_000) {
|
|
@@ -92,6 +92,8 @@ export interface ProbeOptions {
|
|
|
92
92
|
hub?: string;
|
|
93
93
|
/** the env a run's runtime gets (inheritedEnv); the sandboxed commands run with it. Default: env */
|
|
94
94
|
runEnv?: NodeJS.ProcessEnv;
|
|
95
|
+
/** the user's own Codex home (default: CODEX_HOME, else ~/.codex): where Windows keeps the elevated sandbox setup */
|
|
96
|
+
codexHome?: string;
|
|
95
97
|
}
|
|
96
98
|
/** Probe `tool`'s sandbox on this machine. Never throws. */
|
|
97
99
|
export declare function probeSandbox(tool: SandboxTool, o?: ProbeOptions): Promise<SandboxStatus>;
|
package/dist/src/sandboxcheck.js
CHANGED
|
@@ -5,6 +5,7 @@ import { createRequire } from 'node:module';
|
|
|
5
5
|
import { homedir, tmpdir } from 'node:os';
|
|
6
6
|
import { delimiter, dirname, join } from 'node:path';
|
|
7
7
|
import { codexSandboxOverrides } from './adapters/codex.js';
|
|
8
|
+
import { linkWindowsSandbox, unlinkWindowsSandbox, WINDOWS_ELEVATED_CONFIG } from './codexhome.js';
|
|
8
9
|
import { toolchainReadRoots } from './adapters/paths.js';
|
|
9
10
|
export const defaultRun = (file, args, opts) => new Promise((res) => {
|
|
10
11
|
execFile(file, args, { env: opts.env, cwd: opts.cwd, timeout: 20_000, encoding: 'utf8', maxBuffer: 1 << 20 }, (err, stdout, stderr) => {
|
|
@@ -104,9 +105,11 @@ function probeScript() {
|
|
|
104
105
|
'if [ -n "$4" ] && ! "$4" -e 0 >/dev/null 2>&1; then exit 8; fi; if [ -n "$5" ] && ! "$5" --version >/dev/null 2>&1; then exit 9; fi; exit $w');
|
|
105
106
|
}
|
|
106
107
|
/** A Codex home like a worker run's (prepareCodexHome): the user's own config.toml is not read, so it cannot switch the profile off. */
|
|
107
|
-
function probeCodexHome() {
|
|
108
|
+
function probeCodexHome(realCodexHome, platform) {
|
|
108
109
|
const d = mkdtempSync(join(tmpdir(), 'ach-sandbox-codex-'));
|
|
109
|
-
|
|
110
|
+
// Windows: the elevated sandbox once its setup is done, as a run gets it (codexhome.ts)
|
|
111
|
+
const elevated = platform === 'win32' && linkWindowsSandbox(d, realCodexHome);
|
|
112
|
+
writeFileSync(join(d, 'config.toml'), elevated ? WINDOWS_ELEVATED_CONFIG : '');
|
|
110
113
|
return d;
|
|
111
114
|
}
|
|
112
115
|
/** Probe `tool`'s sandbox on this machine. Never throws. */
|
|
@@ -118,7 +121,7 @@ export async function probeSandbox(tool, o = {}) {
|
|
|
118
121
|
const platform = o.platform ?? process.platform;
|
|
119
122
|
const host = o.host ?? detectHost(env, platform);
|
|
120
123
|
const run = o.run ?? defaultRun;
|
|
121
|
-
const st = await probe(tool, { env, platform, host, run, home: o.home ?? homedir(), codex: o.codex, hub: o.hub, runEnv: o.runEnv ?? env });
|
|
124
|
+
const st = await probe(tool, { env, platform, host, run, home: o.home ?? homedir(), codex: o.codex, hub: o.hub, runEnv: o.runEnv ?? env, codexHome: o.codexHome ?? (env.CODEX_HOME || join(o.home ?? homedir(), '.codex')) });
|
|
122
125
|
if (!st.ok)
|
|
123
126
|
st.fix = sandboxFix(st, host);
|
|
124
127
|
return st;
|
|
@@ -171,7 +174,7 @@ async function probe(tool, o) {
|
|
|
171
174
|
const cmd = platform === 'win32' ? ['cmd', '/c', `type nul > "${join(dir, 'ok')}" && (type nul > "${outside}" && exit 4 || exit 0)`] : sh;
|
|
172
175
|
if (canary)
|
|
173
176
|
writeFileSync(canary, 'probe\n', { mode: 0o600 });
|
|
174
|
-
codexHome = probeCodexHome();
|
|
177
|
+
codexHome = probeCodexHome(o.codexHome, platform);
|
|
175
178
|
const cenv = { ...runEnv, CODEX_HOME: codexHome };
|
|
176
179
|
// the work directory is the cwd; the sandbox is the one a work run gets (codexSandboxOverrides)
|
|
177
180
|
r = await run(codex[0], [...codex.slice(1), 'sandbox', ...codexProbeConfig(dir, o.home, o.hub), '--', ...cmd], { env: cenv, cwd: dir });
|
|
@@ -204,8 +207,10 @@ async function probe(tool, o) {
|
|
|
204
207
|
rmSync(outside, { force: true });
|
|
205
208
|
if (canaryDir)
|
|
206
209
|
rmSync(canaryDir, { recursive: true, force: true });
|
|
207
|
-
if (codexHome)
|
|
210
|
+
if (codexHome) {
|
|
211
|
+
unlinkWindowsSandbox(codexHome);
|
|
208
212
|
rmSync(codexHome, { recursive: true, force: true });
|
|
213
|
+
}
|
|
209
214
|
}
|
|
210
215
|
}
|
|
211
216
|
/** `-c` arguments for `codex sandbox`: the profile of a `workdir` work run in `dir` (with the toolchain: the network check runs node). */
|
|
@@ -271,6 +276,15 @@ export const BWRAP_APPARMOR = `printf '%s\\n' 'abi <abi/4.0>,' 'include <tunable
|
|
|
271
276
|
/** The fix for a failed probe on this host. */
|
|
272
277
|
export function sandboxFix(st, host) {
|
|
273
278
|
const name = st.tool === 'claude' ? 'Claude Code' : 'Codex';
|
|
279
|
+
// Windows Codex: the run's read limits need the elevated sandbox, set up once per user with administrator approval
|
|
280
|
+
if (st.tool === 'codex' && /requires the elevated Windows sandbox/i.test(st.detail ?? '')) {
|
|
281
|
+
const cmd = 'ach doctor --codex-sandbox-setup';
|
|
282
|
+
return {
|
|
283
|
+
en: `Codex needs its elevated Windows sandbox, set up once on this machine: run \`${cmd}\` as the user that runs this agent and approve the administrator prompt, then restart the runner.`,
|
|
284
|
+
zh: `Codex 需要 Windows 提权沙箱,这台机器要设置一次:以运行这个智能体的用户执行 \`${cmd}\`,同意管理员确认框,再重启 runner。`,
|
|
285
|
+
commands: [cmd],
|
|
286
|
+
};
|
|
287
|
+
}
|
|
274
288
|
switch (st.problem) {
|
|
275
289
|
case 'not-logged-in': {
|
|
276
290
|
const cmd = st.tool === 'claude' ? 'claude auth login' : 'codex login';
|
package/dist/src/version.d.ts
CHANGED
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koalaauto/agentchannel",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.36.0",
|
|
4
4
|
"description": "Hand work between your team's agents (Claude Code, Codex) and follow it in one panel: the ach CLI, MCP server and runner for AgentChannel v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentchannel",
|