@zergai/ztc 0.21.0-beta.1 → 0.22.0-beta.1

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.
Files changed (113) hide show
  1. package/README.md +144 -33
  2. package/bin/zmux-darwin-arm64 +0 -0
  3. package/bin/ztc-audio-darwin-arm64 +0 -0
  4. package/bin/ztc-capture-darwin-arm64 +0 -0
  5. package/bin/ztc-tui-darwin-arm64 +0 -0
  6. package/bin/zterm-darwin-arm64 +2 -2
  7. package/dist/App.js +2 -2
  8. package/dist/agent/agent.d.ts +13 -3
  9. package/dist/agent/agent.js +179 -91
  10. package/dist/agent/backends/codex_app_server.d.ts +1 -0
  11. package/dist/agent/backends/codex_app_server.js +3 -1
  12. package/dist/agent/backends/host_effort_policy.d.ts +12 -0
  13. package/dist/agent/backends/host_effort_policy.js +132 -0
  14. package/dist/agent/backends/index.d.ts +3 -2
  15. package/dist/agent/backends/index.js +4 -0
  16. package/dist/agent/backends/router_gate.d.ts +11 -0
  17. package/dist/agent/backends/router_gate.js +27 -2
  18. package/dist/agent/backends/router_keys.d.ts +63 -0
  19. package/dist/agent/backends/router_keys.js +94 -0
  20. package/dist/agent/backends/router_refusal.d.ts +12 -15
  21. package/dist/agent/backends/router_refusal.js +29 -5
  22. package/dist/agent/backends/types.d.ts +10 -0
  23. package/dist/agent/backends/zrouter_stream.d.ts +48 -1
  24. package/dist/agent/backends/zrouter_stream.js +215 -24
  25. package/dist/agent/commands/agent_cli.js +11 -3
  26. package/dist/agent/commands/config.js +12 -0
  27. package/dist/agent/commands/index.js +2 -1
  28. package/dist/agent/commands/mirror.js +15 -5
  29. package/dist/agent/commands/provider.js +4 -2
  30. package/dist/agent/commands/provider_selection.js +16 -2
  31. package/dist/agent/commands/router_availability.d.ts +15 -0
  32. package/dist/agent/commands/router_availability.js +45 -0
  33. package/dist/agent/commands/settings.js +38 -5
  34. package/dist/agent/commands/subs.d.ts +4 -1
  35. package/dist/agent/commands/subs.js +15 -5
  36. package/dist/agent/commands/types.d.ts +10 -0
  37. package/dist/agent/commands/ztc_pane.d.ts +20 -0
  38. package/dist/agent/commands/ztc_pane.js +239 -0
  39. package/dist/agent/factory.js +10 -2
  40. package/dist/agent/host_model_context.d.ts +9 -0
  41. package/dist/agent/host_model_context.js +40 -0
  42. package/dist/agent/request_encoder.d.ts +3 -0
  43. package/dist/agent/request_encoder.js +11 -4
  44. package/dist/agent/runtime/tool_runtime.js +8 -2
  45. package/dist/agent/subagent.d.ts +9 -0
  46. package/dist/agent/subagent.js +65 -46
  47. package/dist/agent/tools/file.js +10 -6
  48. package/dist/agent/tools/pane.d.ts +7 -0
  49. package/dist/agent/tools/pane.js +31 -6
  50. package/dist/agent/tools/ztc_command.d.ts +12 -0
  51. package/dist/agent/tools/ztc_command.js +21 -6
  52. package/dist/app/agent_runner.js +5 -2
  53. package/dist/app/command_context.js +10 -4
  54. package/dist/app/mirror_startup.d.ts +16 -0
  55. package/dist/app/mirror_startup.js +10 -0
  56. package/dist/app/runtime_choices.d.ts +2 -0
  57. package/dist/app/runtime_choices.js +1 -1
  58. package/dist/app/runtime_choices_source.js +2 -1
  59. package/dist/app/tool_callbacks.js +1 -0
  60. package/dist/cli_args.d.ts +2 -0
  61. package/dist/cli_args.js +5 -0
  62. package/dist/cli_ratatui.d.ts +14 -0
  63. package/dist/cli_ratatui.js +113 -27
  64. package/dist/config/permissions.d.ts +13 -0
  65. package/dist/config/permissions.js +63 -1
  66. package/dist/config/retired_routes.d.ts +23 -3
  67. package/dist/config/retired_routes.js +62 -11
  68. package/dist/config/types.d.ts +18 -1
  69. package/dist/config.d.ts +42 -0
  70. package/dist/config.js +102 -3
  71. package/dist/desktop/daily/desktop_wiring.js +9 -0
  72. package/dist/desktop/daily/recipes.js +7 -1
  73. package/dist/headless.js +2 -2
  74. package/dist/library.js +2 -2
  75. package/dist/mcp/client.js +6 -3
  76. package/dist/mcp/workspace_server.d.ts +6 -1
  77. package/dist/mcp/workspace_server.js +58 -9
  78. package/dist/onboarding/first_run.d.ts +3 -1
  79. package/dist/onboarding/first_run.js +21 -6
  80. package/dist/onboarding/router_tips.js +10 -7
  81. package/dist/panes/agent_cli.d.ts +48 -0
  82. package/dist/panes/agent_cli.js +145 -0
  83. package/dist/panes/agent_panes.d.ts +11 -0
  84. package/dist/panes/agent_panes.js +25 -4
  85. package/dist/panes/initial_input.d.ts +6 -0
  86. package/dist/panes/initial_input.js +6 -0
  87. package/dist/panes/motsi.d.ts +22 -7
  88. package/dist/panes/motsi.js +36 -9
  89. package/dist/panes/worker_route.d.ts +123 -0
  90. package/dist/panes/worker_route.js +464 -0
  91. package/dist/panes/ztc_launch.d.ts +9 -0
  92. package/dist/panes/ztc_launch.js +58 -2
  93. package/dist/router_auth.d.ts +18 -0
  94. package/dist/router_auth.js +78 -2
  95. package/dist/types.d.ts +5 -0
  96. package/dist/ui/ratatui/headless_pane_manager.d.ts +2 -0
  97. package/dist/ui/ratatui/headless_pane_manager.js +6 -3
  98. package/dist/ui/ratatui/pane_relay.d.ts +11 -1
  99. package/dist/ui/ratatui/pane_relay.js +14 -2
  100. package/dist/ui/ratatui/protocol.d.ts +9 -1
  101. package/dist/utils/atomic_write.js +26 -1
  102. package/dist/utils/docker_target.js +4 -1
  103. package/dist/utils/subprocess_env.d.ts +18 -0
  104. package/dist/utils/subprocess_env.js +45 -0
  105. package/dist/web/mirror_authenticator.d.ts +6 -0
  106. package/dist/web/mirror_authenticator.js +15 -12
  107. package/dist/web/mirror_stream.d.ts +50 -0
  108. package/dist/web/mirror_stream.js +121 -30
  109. package/dist/worker/worker_models.d.ts +11 -0
  110. package/dist/worker/worker_models.js +19 -7
  111. package/dist/zlm-embed.mjs +1349 -429
  112. package/dist/zlm.js +1 -1
  113. package/package.json +32 -16
package/README.md CHANGED
@@ -72,6 +72,17 @@ For browser login at **zergrouter.com**, run `ztc auth login` in your shell or
72
72
  Claude Code/Codex emulation, and `ztc "prompt"` or `ztc -p "prompt"` usage, and
73
73
  [Zerg Router limits](#zerg-router-limits) for what ZTC does when Router refuses a request.
74
74
 
75
+ Every ZTC pane on a profile, and the splits, workers and `/ztc` panes it opens, shares the
76
+ profile's one Router sign-in. Router replaces this computer's sign-in at every login, so a
77
+ login in any pane, or `ztc auth login`, is the one every pane uses from its next message,
78
+ with no restart. With no sign-in, or an expired one, a message on a Zerg Router model
79
+ isn't sent and `/ztc` opens nothing on one: ZTC says to run `/auth login`, and what you
80
+ typed goes with your next message once you sign in. If Router turns the sign-in away,
81
+ ZTC says so, and `/auth status` shows which Router account this ZTC uses. The launch
82
+ card shows your ZergAI login on its own line ("ZergAI login: …"), which can be another
83
+ account than Router's, and a "Zerg Router:" line saying whether Router is signed in,
84
+ with the name Router gave this device, or that `/auth login` signs it in.
85
+
75
86
  Use `/model openai [model]` or `/model deepseek [model]` for direct API calls with your
76
87
  local keys. Use `/model zergrouter <upstream-provider> [model]` to route through your
77
88
  Router login, or `/model modal [model]` for Modal shared endpoints. For Ollama,
@@ -109,9 +120,17 @@ link to your limits. It doesn't retry: the refusal holds that route, account and
109
120
  the whole ZTC process, so subagents, workers, heartbeats, `/loop` routines, goal loops and
110
121
  messages from other panes get the same message without contacting Router. One real request
111
122
  every five minutes still goes through, so a raised limit works within minutes, and a
112
- successful answer for that model lifts the hold. A message you send yourself (typed,
113
- dictated, from the browser mirror, or given on the command line) gets one real attempt,
114
- unless you type it into a ZTC pane or a colony cell, which the overseer can type into too.
123
+ successful answer for that model lifts the hold. When Router had no key for the model's
124
+ provider, `/provider refresh` lifts it too once Router's list shows the key you added.
125
+ Some providers' keys are personal in Router: Router uses such a key only for the logins of
126
+ the Router account that holds it, so it has to be in the account ZTC is signed in to,
127
+ which the refusal says. `/auth status` names that account and this device ("Zerg Router:
128
+ signed in · personal account 1a2b3c4d… · device ZTC on <computer>"); the ZergAI login line
129
+ at launch is your ZergAI platform login, which can be another account. To use a key held
130
+ in another Router account, run `/auth logout`, then `/auth login` to that account. A
131
+ message you send yourself (typed, dictated, from the browser mirror, or given on the
132
+ command line) gets one real attempt, unless you type it into a ZTC pane or a colony cell,
133
+ which the overseer can type into too.
115
134
  A full concurrency limit is retried a few times, and a provider cooldown is waited out;
116
135
  one longer than a minute ends the turn with the time it clears, and nothing, not even
117
136
  your own message, is sent to that model before then.
@@ -205,8 +224,8 @@ curl -fsSL https://zergai.com/install/ztc.sh | sh -s -- --preview
205
224
  The app carries its own Node and matching ZTC agent, so it starts from the
206
225
  icon without a global Node or ZTC install, and it uses the same accounts,
207
226
  configuration and saved sessions as the CLI. Its title bar names the project and branch, then
208
- the delegated Router's state when native panes are up, and holds the model (click it to choose
209
- another), the queue, Stop and Updates. Releases are signed, notarized and published in
227
+ the delegated workers' Router login when native panes are up, and holds the model (click it to
228
+ choose another), the queue, Stop and Updates. Releases are signed, notarized and published in
210
229
  [`Epoch-ML/ztc-releases`](https://github.com/Epoch-ML/ztc-releases).
211
230
 
212
231
  From a terminal you can also open the desktop surface explicitly:
@@ -280,14 +299,14 @@ An unrelated shell cannot use these commands without that authority. The channel
280
299
  has no terminal-input operation. Results currently use the registered
281
300
  `fixture-count-v1` numeric schema; arbitrary child-supplied schemas are refused.
282
301
 
283
- After the project and branch, the title bar shows the delegated Router:
284
- **Delegated Router: signed out** (or expired, rejected, unavailable) until the
285
- `desktop-delegated` profile's login is signed in, then its funding, such as
302
+ After the project and branch, the title bar shows the delegated workers' Router
303
+ login: **Workers' Router: signed out** (or expired, rejected, unavailable) until
304
+ the `desktop-delegated` profile's login is signed in, then its funding, such as
286
305
  **ready** or **needs payment**. It describes that profile, not the model chip's
287
- route, nor Claude or Codex subscriptions. Status shows structured enrolled-child
288
- rows alongside ordinary ZTC workers. Use Up/Down and Enter (or a click) to drill
289
- in. Unmodified Escape or Backspace collapses that drill-in and returns focus to
290
- Status. Interactive zooms keep those keys in their terminal.
306
+ route or a pane's, nor Claude or Codex subscriptions. Status shows structured
307
+ enrolled-child rows alongside ordinary ZTC workers. Use Up/Down and Enter (or a
308
+ click) to drill in. Unmodified Escape or Backspace collapses that drill-in and
309
+ returns focus to Status. Interactive zooms keep those keys in their terminal.
291
310
 
292
311
  Use `/pane stop <pane-id>` or **Stop native pane** in the picker.
293
312
  Stop validates process identity before signaling. SIGKILL requires human desktop
@@ -649,6 +668,15 @@ For a mirror served below a reverse-proxy prefix, set
649
668
  `ZTC_MIRROR_BASE_PATH=/your/prefix`; the browser client applies the prefix to
650
669
  its REST, SSE, asset, and media URLs while the proxy strips it upstream.
651
670
 
671
+ Who can connect: with sign-in off (the default outside production), the mirror
672
+ listens on `127.0.0.1` and answers only this computer, whatever a request's
673
+ `Host` or `X-Forwarded-For` says. To open it from another machine, start ZTC
674
+ with `ZTC_MIRROR_REQUIRE_AUTH=1` and open the link it prints; `ZTC_MIRROR_HOST`
675
+ sets the address it listens on. The desktop app's mirror, and the one a zmux
676
+ session starts by itself, open panes and take typing only from a caller with a
677
+ credential: its own panes, and the browser opened with the link from
678
+ `/mirror open`.
679
+
652
680
  In `zmux` mode the browser mirror can now focus panes, switch layout presets, toggle zoom, create ZTC or shell panes, close panes, and drive pane scroll position through the same mux state machine as the terminal client.
653
681
 
654
682
  ### Human Attention
@@ -1218,6 +1246,7 @@ Optional App Server config:
1218
1246
  ### zmux & Orchestration
1219
1247
  | Command | Description |
1220
1248
  |---------|-------------|
1249
+ | `/ztc [task]` | Open ZTC in a new pane next to this one, on this pane's route or one you name ([details](#claude-code-and-codex-in-panes)) |
1221
1250
  | `/swarm` | Enter conductor mode |
1222
1251
  | `/swarm-status` | Check agent progress |
1223
1252
  | `/swarm-stop` | Exit conductor mode |
@@ -1623,6 +1652,21 @@ credentials. Panes need zmux (plain `ztc`) or the desktop app.
1623
1652
  pane's directory. Plain text is the opening prompt (`/claude fix the failing
1624
1653
  test`); text that starts with a flag goes to the CLI as its arguments
1625
1654
  (`/claude --continue`, `/codex -m gpt-5 "review the diff"`).
1655
+ - `/ztc [--provider <id>] [--model <id>] [--effort <level>] [task]` opens ZTC
1656
+ itself the same way, next to this pane and in its directory, on the route
1657
+ this pane runs on now: its provider, model, auth mode and reasoning effort,
1658
+ as a split of it starts, so a pane on a route of its own passes that route
1659
+ rather than the default for new panes. The flags (or `--model=…`) start it
1660
+ on another route, checked against Zerg Router's list as an agent's
1661
+ `open_pane` worker is; a model alone finds its provider, and a route that
1662
+ can't run is refused before anything opens, this pane's own included: a Zerg
1663
+ Router model with no Router sign-in (run `/auth login`) or with Routing set to
1664
+ direct, where a model or provider named alone stays on your own keys
1665
+ (`--provider zergrouter:<provider>` chooses Router). The new pane runs at the
1666
+ effort `/ztc` names, and with `--effort default` at the one the profile saves
1667
+ for its model. Nothing is saved. Text after the flags is the pane's first task
1668
+ (`/ztc --model gpt-5.4 run the tests`); `--` ends the flags, so a task can
1669
+ start with a dash.
1626
1670
  - Ctrl+B c offers Claude Code and Codex next to bash and ZTC when they are
1627
1671
  installed. In the desktop app, the tab strip's + opens a ZTC tab, as Cmd+T
1628
1672
  does. The ▾ beside it, or a right-click or Ctrl-click on +, opens New tab and
@@ -1633,6 +1677,43 @@ credentials. Panes need zmux (plain `ztc`) or the desktop app.
1633
1677
  (Ctrl+Cmd+Z with ZTC, Cmd+D with a shell; Shift splits down), and Ctrl+Cmd+N
1634
1678
  opens the menu at the focused pane.
1635
1679
 
1680
+ Claude Code and Codex panes you open start without their permission prompts:
1681
+ ZTC passes Claude Code `--dangerously-skip-permissions` and Codex
1682
+ `--dangerously-bypass-approvals-and-sandbox`, ahead of your own arguments, in
1683
+ the panes you open with `/claude`, `/codex`, the menus and splits, Ctrl+B c and
1684
+ native interactive panes, so they run commands without asking, and Codex runs
1685
+ them outside its sandbox. The "Opened …" line shows the flag. The first time
1686
+ in each Claude Code config directory (`~/.claude`, and each profile's), Claude
1687
+ Code asks you to accept that mode. A permission choice of your own wins and ZTC
1688
+ adds nothing: `/claude --permission-mode plan`,
1689
+ `--allow-dangerously-skip-permissions`, `--permission-prompts …` or
1690
+ `--settings …`; `/codex -s read-only`, `-a on-request`, `--approve-for-me`,
1691
+ `--yolo`, `-p <profile>` or `-c approval_policy=…`. Run as root outside a
1692
+ sandbox, Claude Code refuses its flag, so ZTC leaves it out and says so. To
1693
+ have both ask as their own settings say, set Claude Code and Codex permissions
1694
+ to ask in `/settings` → Panes (`panes.agentPermissions: "ask"`).
1695
+
1696
+ Panes an agent opens ask before running commands, whatever that setting says:
1697
+ an agent's `/claude` or `/codex` (through `ztc_command`) and workspace-mcp's
1698
+ `open_pane` get no flag from ZTC, and an agent's own
1699
+ `--dangerously-skip-permissions`, `bypassPermissions` mode,
1700
+ `--dangerously-bypass-approvals-and-sandbox`, `--yolo` or `danger-full-access`
1701
+ sandbox is refused. Opening one starts a program that runs commands, so the
1702
+ agent's permission profile governs it as it governs a shell: a profile without
1703
+ `shell_exec` refuses it, and one that asks before shell commands asks before it
1704
+ opens. The delegated Codex and ZTC workers of the New pane chooser never
1705
+ bypass: they stay read-only.
1706
+
1707
+ An agent's `/ztc` follows the same rule, as ZTC's own `create_ztc_pane` does: a
1708
+ ZTC pane runs an agent that runs commands. A new ZTC pane runs under the
1709
+ profile's saved permissions, so an agent whose pane runs under narrower ones
1710
+ for this session (`/config scope session`, then `/permissions use …`) can't
1711
+ open one, and the refusal says what the new pane would allow beyond its own.
1712
+ An agent's task reaches the new pane as a message to that pane's agent, never as
1713
+ a command the pane runs, so a task such as `/permissions use trusted` changes
1714
+ nothing. Your own `/ztc` opens as your other new panes do, under the saved
1715
+ permissions, and a command in your task runs as one.
1716
+
1636
1717
  Each of these panes starts with ZTC's workspace MCP server (`ztc
1637
1718
  workspace-mcp`) attached for that session only, through Claude Code's
1638
1719
  `--mcp-config` or Codex's `-c mcp_servers.ztc.*`, so your own CLI configuration
@@ -1641,7 +1722,7 @@ is never edited. Its tools give the agent the workspace:
1641
1722
  | Tool | What it does |
1642
1723
  |------|--------------|
1643
1724
  | `list_panes` | Each pane's id, name and kind, and which pane is the agent's own |
1644
- | `open_pane` | Open a ZTC agent, Claude Code, Codex or a shell, optionally with a first task |
1725
+ | `open_pane` | Open a ZTC agent, Claude Code, Codex or a shell, optionally with a first task; a ZTC agent on a provider, model and effort you name |
1645
1726
  | `read_pane` | Read a pane's scrollback, or what is on screen |
1646
1727
  | `type_into_pane` | Type into a pane, then press Enter |
1647
1728
  | `send_message` | Message another agent over ZTC's bus |
@@ -1655,7 +1736,21 @@ Broadcasts to `all` reach ZTC agents only.
1655
1736
  A pane the agent opens with `open_pane` starts as one you open yourself, by
1656
1737
  ZTC's settings as saved at that moment: the profile new Claude Code and Codex
1657
1738
  panes start on, MotSi's remote view, the route a ZTC pane starts on and, in
1658
- the desktop app, Claude Code badges.
1739
+ the desktop app, Claude Code badges. Only the permission prompts differ: a
1740
+ Claude Code or Codex pane an agent opens asks before running commands.
1741
+
1742
+ A ZTC agent can be given its own route: `open_pane` with `kind: "ztc"` takes
1743
+ `provider` (a name `/provider` lists, or `zergrouter:openai` for Zerg Router
1744
+ rather than your own key), `model` and `effort`. ZTC checks them against Zerg
1745
+ Router's list first, asking Router again before it believes a key is missing,
1746
+ and opens nothing when the route can't run: a model Router doesn't list for
1747
+ that provider, one Router has no key for on your account (with where the key
1748
+ goes), a provider with no key here, a local subscription login, a model id that
1749
+ starts with `-`, or an effort the model doesn't take. The worker starts on that
1750
+ route through its own launch flags; the default for new panes doesn't change.
1751
+ Named alone, a provider starts on the model you last used with it, else its
1752
+ default. ZTC's own `create_ztc_pane` refuses a Router route with no key the
1753
+ same way.
1659
1754
 
1660
1755
  In the desktop app, `Shift+Enter` and `Option+Enter` start a new line in
1661
1756
  Claude Code's and Codex's prompts: the panes speak the kitty keyboard
@@ -1693,23 +1788,34 @@ it keeps that sign-in in the profile, so the CLI's sign-in in iTerm or Ghostty
1693
1788
  doesn't change. Codex panes on a profile keep their sign-in in the profile's
1694
1789
  files (`cli_auth_credentials_store="file"`). `/subs` lists your profiles, and
1695
1790
  `/subs use claude|codex [profile]` sets the one new panes start on (no profile:
1696
- the CLI's own sign-in). ZTC never reads what a CLI stores in a profile and
1697
- never moves a pane to another profile on its own. A profile starts without your
1698
- usual CLI settings, MCP servers or plugins, since those live in the CLI's
1699
- default config directory.
1791
+ this computer's normal sign-in, the one the CLI uses in any other terminal). A
1792
+ pane on a profile is named after it (`Claude Code @work`). ZTC never reads what
1793
+ a CLI stores in a profile and never moves a pane to another profile on its own.
1794
+ A profile starts without your usual CLI settings, MCP servers or plugins, since
1795
+ those live in the CLI's default config directory.
1700
1796
 
1701
1797
  #### In Zerg Router's Command Central
1702
1798
 
1703
- With MotSi installed and its remote view on (`motsi remote view on`), ZTC
1704
- starts the panes it opens — ZTC agents, Claude Code, Codex, shells and custom
1705
- panes — through `motsi run --title=<pane name> --`. Zerg Router's Command
1706
- Central then lists each pane under its name and shows it live as a real
1707
- terminal. MotSi redacts likely secrets on this computer before anything leaves
1708
- it, and lets a viewer type only into an agent (Claude Code, Codex or ZTC),
1709
- never into a shell. Nothing leaves the computer while MotSi's remote view is
1710
- off. To start panes without MotSi, set `panes.remoteView` to `false` in ZTC's
1711
- config. The pane ZTC itself starts in is not one ZTC opens; to share it, start
1712
- ZTC as `motsi run -- ztc`.
1799
+ With MotSi installed and its remote view on (`motsi remote view on`), the
1800
+ panes you open from ZTC's menus and commands (ZTC agents, Claude Code, Codex,
1801
+ shells and custom panes, including those an agent opens through `ztc
1802
+ workspace-mcp`) start through `motsi run --title=<pane name> --`. Zerg
1803
+ Router's Command Central then lists each pane under its name and shows it live
1804
+ as a real terminal. MotSi redacts likely secrets on this computer before
1805
+ anything leaves it. Viewers can type into Claude Code and Codex panes, never
1806
+ into a shell; ZTC panes are watch-only there for now. Nothing leaves the
1807
+ computer while MotSi's remote view is off. To start panes without MotSi, set
1808
+ `panes.remoteView` to `false` in ZTC's config.
1809
+
1810
+ Some panes start without MotSi, so Command Central doesn't list them: Main
1811
+ (pane 0), native and delegated workers, panes ZTC's own agent opens with its
1812
+ pane tools, ZTC panes the web mirror creates, and saved ZTC sessions resumed
1813
+ into panes. Shells and command panes opened from the web mirror's + menu start
1814
+ through MotSi like the ones you open in ZTC. A custom pane whose program is
1815
+ MotSi itself (`motsi`, or `zrouter motsi`) starts without it too, so MotSi's
1816
+ account details stay on this computer. In a terminal, you can share the pane
1817
+ ZTC itself runs in by starting ZTC as `motsi run -- ztc`; the desktop app's
1818
+ Main isn't a terminal, so that doesn't apply there.
1713
1819
 
1714
1820
  ZTC's own agent loop uses an Anthropic API key for Claude models (`/config key`
1715
1821
  or `ANTHROPIC_API_KEY`). Anthropic's [legal and compliance
@@ -1820,11 +1926,16 @@ adjusted (`Work Account` becomes `Work-Account`) and one whose name is taken
1820
1926
  gets a number (`personal-2`); the notice gives each profile's name. `~` in a saved path is read as
1821
1927
  your home directory; an account saved with a relative path gets no profile, and
1822
1928
  the notice says how to add it (`/accounts add claude_code <name> --path <dir>`).
1823
- A directory that no longer exists is named, to sign in there again. The account
1824
- you were using becomes the profile new Claude Code panes start on, unless you
1825
- had chosen one (`/subs use claude` goes back to Claude Code's own sign-in). An
1826
- account on `~/.claude` is Claude Code's own sign-in, which `/claude` uses
1827
- anyway. `/accounts use <old id>` still finds the profile an account became.
1929
+ A directory that no longer exists is named, to sign in there again. Plain
1930
+ `/claude` stays on this computer's own Claude Code sign-in (the one MotSi or you
1931
+ keep in `~/.claude`); `/subs use claude <name>` makes a profile the default. An
1932
+ earlier release made the account you were using the default, so `/claude` asked
1933
+ to sign in again on a computer signed in normally: that default is cleared once,
1934
+ and Main says how to choose it again. A default you choose with `/subs use` from
1935
+ this release on stays; one chosen before it can't be told from the earlier
1936
+ release's, so it is cleared once too, and Main says so. An account on
1937
+ `~/.claude` is Claude Code's own sign-in, which `/claude` uses anyway.
1938
+ `/accounts use <old id>` still finds the profile an account became.
1828
1939
 
1829
1940
  A run nobody watches (`--headless`, `-p`, `--json`, `--json-stream` or
1830
1941
  `zerg-ztc-headless`) that asks for a retired route with `--provider claude_code`,
Binary file
Binary file
Binary file
Binary file
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/zterm-darwin-arm64
3
- size: 33960480 bytes
4
- sha256: f6e8335bc6fe08075c793e388edf4ab3368bf6241832a1bf105b3fc1eea59c97
3
+ size: 33976912 bytes
4
+ sha256: e0e1d30f23d40f7b83ad425fc176fb2eaa1588369e2bbc5c6d3ac360d50ea0a7
package/dist/App.js CHANGED
@@ -1319,7 +1319,7 @@ export const App = () => {
1319
1319
  metadata: (result.usage || result.reasoning)
1320
1320
  ? {
1321
1321
  ...(result.usage ? { usage: result.usage } : {}),
1322
- ...(result.reasoning ? { reasoningContent: result.reasoning } : {}),
1322
+ ...(result.reasoning ? { reasoningContent: result.reasoning, reasoningModel: result.reasoningModel } : {}),
1323
1323
  }
1324
1324
  : undefined
1325
1325
  });
@@ -1336,7 +1336,7 @@ export const App = () => {
1336
1336
  return prev;
1337
1337
  return prev.map((m, i) => i === lastIdx
1338
1338
  ? { ...m, ...(result.nativeContent ? { nativeContent: result.nativeContent, nativeModel: result.nativeModel, nativeContextId: result.nativeContextId } : {}),
1339
- metadata: { ...m.metadata, ...(result.reasoning ? { reasoningContent: result.reasoning } : {}) } }
1339
+ metadata: { ...m.metadata, ...(result.reasoning ? { reasoningContent: result.reasoning, reasoningModel: result.reasoningModel } : {}) } }
1340
1340
  : m);
1341
1341
  });
1342
1342
  }
@@ -186,6 +186,7 @@ export interface AgentRunResult {
186
186
  usage?: TokenUsage;
187
187
  stopReason: 'complete' | 'interactive' | 'max_iterations';
188
188
  reasoning?: string;
189
+ reasoningModel?: string;
189
190
  responseItems?: Array<Record<string, unknown>>;
190
191
  nativeContent?: ContentBlock[];
191
192
  nativeModel?: string;
@@ -224,9 +225,6 @@ export declare class Agent {
224
225
  private midTurnCompactTokenBudget?;
225
226
  /** Codex/GPT reasoning effort override; undefined = provider default. */
226
227
  private _codexEffort?;
227
- /** One-shot: the next request carries the output-limit note at this effort. */
228
- /** The next request retries a discarded response: a note for the model, and lower effort when offered. */
229
- private responseRetry;
230
228
  /** The person's attempt (admitPersonRequest), waiting for the run that takes it: the next to start, or the one whose
231
229
  * steering admitted it. */
232
230
  private personRequestPending;
@@ -235,6 +233,13 @@ export declare class Agent {
235
233
  private eventHandlers;
236
234
  private toolEventSequence;
237
235
  private backend;
236
+ /** The run that started last and is still running: what the handoff summary, steering and the execution facts asked
237
+ * for outside a run's own loop go by. Its loop passes its own RunTurn everywhere. */
238
+ private activeRun?;
239
+ /** The backend, model and output limit RUN's request goes with: its host policy's snapshot, else the agent's own. */
240
+ private turnBackend;
241
+ private turnModel;
242
+ private turnMaxTokens;
238
243
  private policy;
239
244
  private tracer;
240
245
  private diagnostics;
@@ -249,6 +254,7 @@ export declare class Agent {
249
254
  private _lastResponseStreamed;
250
255
  private _cwd;
251
256
  private _autoContinue;
257
+ private modelSupportsTools;
252
258
  /** Auto-continues spent since the last tool run; reset per turn and per tool. */
253
259
  private _consecutiveAutoContinues;
254
260
  private _turnAutoContinues;
@@ -298,6 +304,8 @@ export declare class Agent {
298
304
  private readonly approvalContext?;
299
305
  private _hasCustomSystemPrompt;
300
306
  private readonly _authenticationManagedByBackend;
307
+ /** The provider the caller named, whose own key this Agent sends; none for a credential a host brokers. */
308
+ private readonly keyProvider?;
301
309
  constructor(config?: AgentConfig);
302
310
  private questionHandler;
303
311
  setAutoContinue(enabled: boolean): void;
@@ -430,6 +438,8 @@ export declare class Agent {
430
438
  setPinnedTask(task: string): void;
431
439
  /** Append the pinned task header (R7) to the static system prompt. */
432
440
  getExecutionContext(): ExecutionContext;
441
+ /** The execution facts RUN's requests go with: its host policy's output limit, when one chose the model. */
442
+ private executionContext;
433
443
  private systemWithTaskHeader;
434
444
  private persistToolCheckpoint;
435
445
  private checkpointPersistenceError;