@zergai/ztc 0.14.1-dev.202611082047 → 0.15.1-dev.202611090248

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 (134) hide show
  1. package/README.md +175 -39
  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 +0 -0
  7. package/dist/App.js +17 -0
  8. package/dist/agent/agent.js +1 -5
  9. package/dist/agent/backends/account_events.d.ts +4 -4
  10. package/dist/agent/backends/account_events.js +4 -4
  11. package/dist/agent/backends/account_login.d.ts +1 -1
  12. package/dist/agent/backends/account_login.js +1 -1
  13. package/dist/agent/backends/account_pool.d.ts +11 -54
  14. package/dist/agent/backends/account_pool.js +12 -134
  15. package/dist/agent/backends/anthropic.js +18 -4
  16. package/dist/agent/backends/codex_app_server.d.ts +3 -4
  17. package/dist/agent/backends/codex_app_server.js +4 -5
  18. package/dist/agent/backends/codex_auth.d.ts +1 -0
  19. package/dist/agent/backends/codex_auth.js +6 -4
  20. package/dist/agent/backends/failover.d.ts +1 -1
  21. package/dist/agent/backends/failover.js +9 -9
  22. package/dist/agent/backends/index.d.ts +3 -24
  23. package/dist/agent/backends/index.js +8 -56
  24. package/dist/agent/backends/kimi_code_auth.d.ts +1 -1
  25. package/dist/agent/backends/kimi_code_auth.js +2 -2
  26. package/dist/agent/backends/provider_ids.d.ts +5 -0
  27. package/dist/agent/backends/provider_ids.js +6 -1
  28. package/dist/agent/backends/rate_limit.d.ts +7 -16
  29. package/dist/agent/backends/rate_limit.js +7 -29
  30. package/dist/agent/backends/types.d.ts +0 -5
  31. package/dist/agent/commands/accounts.d.ts +6 -2
  32. package/dist/agent/commands/accounts.js +97 -70
  33. package/dist/agent/commands/compact.js +4 -2
  34. package/dist/agent/commands/config.js +27 -13
  35. package/dist/agent/commands/connect.js +79 -3
  36. package/dist/agent/commands/credential_status.d.ts +2 -0
  37. package/dist/agent/commands/credential_status.js +5 -1
  38. package/dist/agent/commands/dictation.js +34 -14
  39. package/dist/agent/commands/direct_credential_prompt.js +7 -1
  40. package/dist/agent/commands/model.js +8 -0
  41. package/dist/agent/commands/models.js +5 -6
  42. package/dist/agent/commands/provider_choices.js +5 -5
  43. package/dist/agent/commands/provider_model_defaults.d.ts +3 -4
  44. package/dist/agent/commands/provider_model_defaults.js +4 -16
  45. package/dist/agent/commands/provider_selection.d.ts +4 -3
  46. package/dist/agent/commands/provider_selection.js +15 -7
  47. package/dist/agent/commands/settings.js +36 -50
  48. package/dist/agent/commands/sim.js +9 -0
  49. package/dist/agent/commands/subs.js +3 -2
  50. package/dist/agent/commands/types.d.ts +26 -6
  51. package/dist/agent/factory.js +17 -52
  52. package/dist/agent/subagent.js +4 -11
  53. package/dist/agent/tools/adaptation.js +10 -1
  54. package/dist/agent/tools/pane.js +25 -2
  55. package/dist/agent/tools/sim.js +12 -3
  56. package/dist/agent/tools/supervision.js +4 -0
  57. package/dist/app/agent_runner.js +9 -2
  58. package/dist/app/launch_notices.d.ts +44 -0
  59. package/dist/app/launch_notices.js +41 -0
  60. package/dist/app/retired_route_gate.d.ts +44 -0
  61. package/dist/app/retired_route_gate.js +73 -0
  62. package/dist/app/session_manager.js +2 -1
  63. package/dist/app/task_scope_router.js +1 -13
  64. package/dist/cli_main.js +39 -6
  65. package/dist/cli_ratatui.d.ts +28 -2
  66. package/dist/cli_ratatui.js +178 -40
  67. package/dist/components/InputArea.js +27 -10
  68. package/dist/config/anthropic_models.d.ts +18 -0
  69. package/dist/config/anthropic_models.js +22 -0
  70. package/dist/config/defaults.d.ts +0 -1
  71. package/dist/config/defaults.js +9 -10
  72. package/dist/config/permissions.js +4 -2
  73. package/dist/config/repo_config.js +8 -0
  74. package/dist/config/resolved.d.ts +1 -1
  75. package/dist/config/retired_ids.d.ts +33 -0
  76. package/dist/config/retired_ids.js +39 -0
  77. package/dist/config/retired_routes.d.ts +192 -0
  78. package/dist/config/retired_routes.js +609 -0
  79. package/dist/config/types.d.ts +61 -31
  80. package/dist/config.d.ts +269 -23
  81. package/dist/config.js +727 -106
  82. package/dist/evolution/mutation.js +4 -1
  83. package/dist/headless.js +46 -4
  84. package/dist/headless_cli.js +23 -6
  85. package/dist/headless_cli_args.d.ts +3 -1
  86. package/dist/headless_cli_args.js +7 -0
  87. package/dist/hosted/session_settings.js +11 -2
  88. package/dist/library.js +4 -0
  89. package/dist/onboarding/first_run.js +5 -2
  90. package/dist/onboarding/setup.js +2 -1
  91. package/dist/onboarding/setup_agent_health.js +5 -5
  92. package/dist/optimize/llm.js +4 -1
  93. package/dist/panes/agent_cli.d.ts +1 -1
  94. package/dist/panes/agent_cli.js +5 -2
  95. package/dist/panes/agent_panes.js +12 -4
  96. package/dist/panes/agent_profiles.d.ts +25 -5
  97. package/dist/panes/agent_profiles.js +35 -10
  98. package/dist/panes/model_catalog.d.ts +1 -1
  99. package/dist/panes/model_catalog.js +3 -24
  100. package/dist/panes/pane_registry.js +9 -3
  101. package/dist/panes/ztc_launch.js +28 -6
  102. package/dist/simulation/inference.d.ts +38 -4
  103. package/dist/simulation/inference.js +264 -24
  104. package/dist/simulation/living/context.d.ts +1 -1
  105. package/dist/simulation/living/open-world.d.ts +1 -1
  106. package/dist/simulation/living/types.d.ts +4 -4
  107. package/dist/simulation/llm.js +14 -4
  108. package/dist/simulation/memory/embedding.d.ts +6 -0
  109. package/dist/simulation/memory/embedding.js +35 -8
  110. package/dist/utils/compaction.js +0 -1
  111. package/dist/utils/context.js +2 -7
  112. package/dist/utils/dictation.d.ts +43 -8
  113. package/dist/utils/dictation.js +333 -138
  114. package/dist/utils/idle_compaction.js +1 -1
  115. package/dist/utils/models.js +0 -24
  116. package/dist/utils/subprocess_env.d.ts +14 -3
  117. package/dist/utils/subprocess_env.js +16 -3
  118. package/dist/web/accounts_mirror.d.ts +23 -57
  119. package/dist/web/accounts_mirror.js +52 -171
  120. package/dist/web/mirror_stream.d.ts +14 -3
  121. package/dist/web/mirror_stream.js +16 -12
  122. package/dist/zlicky/vision_locator.js +7 -2
  123. package/dist/zlm-embed.mjs +1398 -1488
  124. package/package.json +2 -2
  125. package/dist/agent/backends/account_rotation.d.ts +0 -138
  126. package/dist/agent/backends/account_rotation.js +0 -323
  127. package/dist/agent/backends/account_state.d.ts +0 -59
  128. package/dist/agent/backends/account_state.js +0 -139
  129. package/dist/agent/backends/claude_cli.d.ts +0 -85
  130. package/dist/agent/backends/claude_cli.js +0 -658
  131. package/dist/agent/backends/claude_code_auth.d.ts +0 -48
  132. package/dist/agent/backends/claude_code_auth.js +0 -171
  133. package/dist/agent/backends/rotation_factory.d.ts +0 -26
  134. package/dist/agent/backends/rotation_factory.js +0 -55
package/README.md CHANGED
@@ -59,11 +59,11 @@ other Zerg Router model with `/model zergrouter <provider> <model>`. `/connect`
59
59
  asks again any time. Then describe the project outcome you want. Review the
60
60
  plan and run `/execute` when you are ready for ZTC to make the proposed changes.
61
61
 
62
- Authentication options are Zerg Router browser login (`/auth login`), a provider API key
62
+ Authentication options are Zerg Router browser login (`/auth login`) or a provider API key
63
63
  (`/config key <provider>`, which takes the key in a hidden prompt or the name of the
64
- environment variable that holds it), or Claude Code OAuth (`claude setup-token`, then
65
- `/model claude_code`). A variable you name is used once it is set; until then ZTC keeps
66
- using the saved key or the provider's standard variable.
64
+ environment variable that holds it). A variable you name is used once it is set; until then
65
+ ZTC keeps using the saved key or the provider's standard variable. To use a Claude
66
+ subscription, run Claude Code in a ZTC pane with `/claude`; ZTC's own agent can't use one.
67
67
 
68
68
  For browser login at **zergrouter.com**, run `ztc auth login` in your shell or
69
69
  `/auth login` inside ZTC. Both use the same flow and credentials. `/auth cancel`
@@ -154,7 +154,7 @@ npm start
154
154
 
155
155
  - Node.js 20.19+ on the 20.x line, or 22.12+
156
156
  - Rust toolchain (for native binaries — `cargo`)
157
- - One authentication route: Zerg Router (`/auth login` or `ztc auth login`), provider API key (`/config key`), or Claude Code CLI OAuth (`claude setup-token` + `CLAUDE_CODE_OAUTH_TOKEN`)
157
+ - One authentication route: Zerg Router (`/auth login` or `ztc auth login`), a provider API key (`/config key`), or a local Codex or Kimi Code login
158
158
 
159
159
  The JS and headless surfaces support macOS, Linux, and Windows.
160
160
  The published beta native payload supports `darwin-arm64`
@@ -246,7 +246,42 @@ update installs, the next launch shows what's new in it. See
246
246
  and publication contract.
247
247
 
248
248
  ### Voice & Media
249
- - **Voice dictation** — native Whisper transcription (Ctrl+R)
249
+ - **Voice dictation** — Whisper transcription on this computer (Ctrl+R): the
250
+ native dictation binary, else local whisper (`whisper` or `whisper-cpp`, with
251
+ sox or ffmpeg to record), else macOS dictation, on-device only. ZTC asks
252
+ macOS for on-device recognition, so the Speech framework never sends the
253
+ recording to Apple's servers; on a Mac whose speech recognizer can't
254
+ recognize on-device, macOS dictation isn't used, and `/dictation macos` says
255
+ why. Where `swift` fails (before the Xcode license is accepted, say), macOS
256
+ dictation isn't available either: ZTC shows swift's own error, and asks swift
257
+ again ten seconds later, so fixing it needs no restart. If swift doesn't
258
+ answer within 30 seconds, ZTC doesn't ask it again on its own. It asks again
259
+ when you choose macOS dictation (with `/dictation macos` or the Dictation
260
+ provider setting) and in a new ZTC session at its first dictation action
261
+ (Ctrl+R or `/dictation`), and each of those can wait up to 30 seconds again,
262
+ so a swift that hangs never holds your typing again on its own.
263
+ Your audio stays on this computer, whatever keys you export.
264
+ `/dictation openai` sends each recording to OpenAI's Whisper API instead of
265
+ local whisper or macOS dictation (the native binary, while installed, still
266
+ transcribes here), and says as you choose it that the audio goes to OpenAI
267
+ and `OPENAI_API_KEY` pays. Only you make that choice, with `/dictation` or
268
+ the Dictation provider setting: ZTC refuses it from anything but your own
269
+ typing in its main session (its Main pane in `--mux`, or the desktop app),
270
+ the browser mirror (a colony cell's own included), or a `ztc` you run
271
+ yourself (`ztc -p` and `ztc --headless` included). That covers the agent's
272
+ `ztc_command`, ZTC panes and colony cells, colony's `send_to_worktree` and
273
+ the colony dashboard's Send Message (both post to a mirror's `/broadcast`),
274
+ bus messages and `write_terminal_pane`: a ZTC that another ZTC runs in one
275
+ of its panes reads a terminal the overseer's `write_terminal_pane` types
276
+ into too, so it can't tell your typing there from that. A choice you queue
277
+ (with Tab, or while an account or model change runs) is refused when it
278
+ runs, so type it again. An agent that can run shell commands can still
279
+ change your settings files, as it can any file you can edit, so the first
280
+ recording each session that goes to OpenAI says so in one line. What needs
281
+ code running on this machine (a process writing to a socket, an agent's
282
+ shell) is outside what ZTC's commands can refuse. The choice is saved,
283
+ `/dictation` shows it and `/dictation local` goes back. With no engine here
284
+ and no such choice, Ctrl+R records nothing and says how to get one.
250
285
  - **TTS synthesis** — multiple backends (macOS say, Parler, OpenAI, ElevenLabs)
251
286
  - **Image support** — paste from clipboard (Ctrl+I), screenshot compression
252
287
  - **Images in the transcript** — pasted images, image files the agent reads and
@@ -435,7 +470,7 @@ When running in zmux, the agent gains access to terminal pane management:
435
470
  |------|-------------|
436
471
  | `create_terminal_pane` | Spawn a process in a new pane (shell, server, child ZTC) |
437
472
  | `read_terminal_pane` | Read current terminal buffer contents |
438
- | `write_terminal_pane` | Send keystrokes to a pane |
473
+ | `write_terminal_pane` | Send keystrokes to a pane (never pane 0, ZTC's main session, where only you type) |
439
474
  | `close_terminal_pane` | Close a pane and kill its process |
440
475
  | `list_terminal_panes` | List all panes with status |
441
476
 
@@ -940,7 +975,7 @@ To keep several ChatGPT accounts signed in for manual switching, add each as a s
940
975
  /accounts use work
941
976
  ```
942
977
 
943
- Each login uses the official Codex CLI with its own `CODEX_HOME` under `~/.ztc/accounts/`, file credential storage, and ChatGPT authentication. The accounts stay signed in on disk without keeping an App Server process running for every account. `/accounts use <id>` switches the active profile; the browser Accounts panel offers the same one-click selection. Codex accounts never rotate automatically when a quota is reached, even if auto-rotation is enabled for Claude or Kimi.
978
+ Each login uses the official Codex CLI with its own `CODEX_HOME` under `~/.ztc/accounts/`, file credential storage, and ChatGPT authentication. The accounts stay signed in on disk without keeping an App Server process running for every account. `/accounts use <id>` switches the active profile; the browser Accounts panel offers the same one-click selection. Accounts switch only when you choose one: ZTC never rotates them when a quota is reached.
944
979
 
945
980
  The Accounts panel and `/accounts list` refresh the selected profiles through the official App Server. They show the ChatGPT identity, remaining quota windows, and token activity when OpenAI reports them. A failed quota or usage read is marked stale and retains the last observed value; an expired login needs a new `/accounts login <id>`. A profile whose login cannot be verified does not replace the current active profile. The panel's Refresh button checks again immediately. If an administrator requires keyring-only credentials, Codex may refuse the per-profile file-store setting; that profile will need a supported organization policy before it can be added to this pool.
946
981
 
@@ -1026,7 +1061,7 @@ Optional App Server config:
1026
1061
  ### Voice
1027
1062
  | Command | Description |
1028
1063
  |---------|-------------|
1029
- | `/dictation` | Manage dictation (devices, model) |
1064
+ | `/dictation` | Manage dictation: where it transcribes (`local`, `macos`, or `openai`, which sends your audio to OpenAI on `OPENAI_API_KEY`), devices, model |
1030
1065
  | `/voice` | Manage TTS synthesis |
1031
1066
 
1032
1067
  ### zmux & Orchestration
@@ -1429,35 +1464,137 @@ terms](https://code.claude.com/docs/en/legal-and-compliance) reserve Claude
1429
1464
  subscription sign-in for Claude Code and Anthropic's own apps: third-party tools
1430
1465
  may not route requests through Free, Pro, Max or Ultra plan credentials or
1431
1466
  handle Claude.ai credentials. Running your own Claude Code in a pane is how to
1432
- use a Claude subscription alongside ZTC.
1433
-
1434
- ### Claude Code CLI OAuth
1435
-
1436
- ZTC can use Claude Code subscription/OAuth auth through the official Claude Code CLI instead of direct Anthropic API-key billing:
1437
-
1438
- ```bash
1439
- npm install -g @anthropic-ai/claude-code
1440
- claude /login
1441
- claude setup-token
1442
- export CLAUDE_CODE_OAUTH_TOKEN=...
1443
- ztc
1444
- # inside ZTC:
1445
- /config provider claude_code
1446
- ```
1447
-
1448
- The `claude_code` provider shells out to `claude -p` with `CLAUDE_CODE_OAUTH_TOKEN` in the environment. This follows Claude Code's own auth/runtime and usage rules, and Claude Code's default system prompt/runtime behavior is intentionally involved. ZTC's prompt is appended to that runtime for context.
1449
-
1450
- The CLI backend passes explicit model IDs, dated versions, context suffixes and
1451
- deployment names through as selected, after trimming whitespace. The CLI and
1452
- account determine availability, and a rejected selection remains an error.
1453
- The exact legacy `sonnet` and `claude-code-sonnet` choices, or an empty model,
1454
- retain ZTC's `claude-sonnet-4-5` compatibility mapping; `claude-code-opus` and
1455
- `claude-code-haiku` map to `opus` and `haiku`. Status and usage model fields
1456
- describe the requested configuration; they do not attest which model the
1457
- provider actually served. This backend behavior does not change existing
1458
- dated-model migrations when loading or setting persistent configuration.
1459
-
1460
- The first implementation is text-only: ZTC tool definitions are not bridged into Claude Code CLI tool calls. A future MCP bridge can expose ZTC tools to Claude Code through official integration surfaces.
1467
+ use a Claude subscription alongside ZTC. Save an Anthropic key in ZTC
1468
+ (`/config key anthropic`) rather than exporting `ANTHROPIC_API_KEY` in the shell
1469
+ that starts ZTC: a plain `/claude` pane keeps your environment, and Claude Code
1470
+ can prefer an exported key over your subscription. A pane on a sign-in profile
1471
+ (`/claude @work`) clears `CLAUDE_CODE_OAUTH_TOKEN`, `ANTHROPIC_API_KEY` and
1472
+ `ANTHROPIC_AUTH_TOKEN`, also after your login files run, so it signs in as that
1473
+ profile. A Claude Code sign-in token (`sk-ant-oat…`) is never an API key: ZTC
1474
+ doesn't send one from `ANTHROPIC_API_KEY`, a variable you named or a saved key,
1475
+ and a headless or piped run says on stderr which of them holds it. `/status`,
1476
+ `/model` and ZTC's notices count such a value as not set and name the key that
1477
+ is sent instead.
1478
+
1479
+ ### Upgrading from the claude_code provider
1480
+
1481
+ ZTC no longer offers the `claude_code` and `claude_code_direct` providers, which
1482
+ made a Claude subscription ZTC's own model. On the first launch after upgrading, each settings profile that used them moves
1483
+ once, and the next interactive launch says where it went. It only ever moves to
1484
+ a route you set up in ZTC itself, so nothing starts billing a key you never gave
1485
+ ZTC and nothing moves you to another vendor:
1486
+
1487
+ - **Your Anthropic API key saved in ZTC** (`/config key anthropic`, or a variable
1488
+ you named for it): the same Claude model, billed per token. `sonnet`, `opus`
1489
+ and `haiku` become the current models of those families; an explicit
1490
+ `claude-*` id stays.
1491
+ - **Otherwise Zerg Router**, when you are logged in: the same Claude model through Router.
1492
+ - **Otherwise Anthropic, waiting for you to connect**: the launch opens the
1493
+ Connect prompt. A key found only in your environment (`ANTHROPIC_API_KEY`) is
1494
+ named in the notice and offered there as its own choice; ZTC never uses it
1495
+ on its own.
1496
+
1497
+ Until you choose a route (`/connect`, `/model` or a Zerg Router login), a
1498
+ profile left waiting has no route at all, whatever else could reach a model:
1499
+ an auth mode, a key or a platform token in your environment, an older ZergAI
1500
+ platform login, a resumed session's route, or a route a simulation or pane
1501
+ names. Every interactive launch, in the terminal or the desktop app, with or
1502
+ without a prompt (`ztc "..."`) or a resumed session, shows the notice again and
1503
+ opens the Connect prompt; a prompt waits for your choice, and a message typed
1504
+ meanwhile goes back to the composer unsent. `ztc --resume` with no session
1505
+ opens its session picker first, and the Connect prompt once you close it. A
1506
+ pane, a simulation, a subagent and `/setup` say no route is set up and to
1507
+ choose one with `/connect`; `/compact` summarizes locally, and no recap runs.
1508
+
1509
+ A route you choose for one session only (after `/config scope session`, or
1510
+ with `/config local`) is that session's route, and the profile still waits, so
1511
+ the next launch asks again. A model switch a pane is told to make, by its
1512
+ parent, another pane, a bus message or the mirror's pane picker, never chooses
1513
+ a route, and neither does a reset to the default model. One that lands on a
1514
+ provider this run has no route for leaves the pane's model as it was and says
1515
+ why; one within the run's own provider changes the model on that same route,
1516
+ as on any profile.
1517
+
1518
+ The other route such a profile has before then is one a run's own `--provider`
1519
+ chooses (with `--model`, and `--auth-mode direct` to run on that provider's API
1520
+ key). ZTC's own transport settings (`ZTC_AUTH_TOKEN`, `ZTC_LLM_AUTH_MODE`,
1521
+ saved settings) then decide how a request gets there, as they do for every
1522
+ profile. Delegated workers run on that route rather than on a worker pool, and
1523
+ the panes the run opens run on it too. A pane that names its own model keeps
1524
+ it on that route's provider; a pane on any other provider, from the mirror's
1525
+ new-pane picker or anywhere else, doesn't open, and ZTC says no route is set
1526
+ up. Recaps, `/compact`, simulations and the tools that call a provider
1527
+ themselves send only the key that route sends. Through Zerg Router that is
1528
+ none: no recap runs, `/compact` summarizes locally, and a tool that needs a key
1529
+ says it has none. A simulation whose world names that route's provider starts
1530
+ on the route, embeddings on or off: its chat goes where the route goes,
1531
+ through Router included, and its memory embeds only where the route can, on an
1532
+ OpenAI key, a custom endpoint or the ZergAI platform's own proxy when the
1533
+ route goes through that proxy on the platform login (never beside a direct
1534
+ route, auto mode's included). Otherwise, a Router sign-in or an Anthropic key
1535
+ for example, its recall matches words, not meaning, and the simulation says so
1536
+ once. A world on any other provider doesn't run: it says which provider it
1537
+ names and which route the run has, and what to name instead. `sim_init`'s
1538
+ default world is `openai/gpt-5.4-nano`, so on such a run give `sim_init` a
1539
+ `config_json` naming the run's provider and model, such as
1540
+ `{"provider":"anthropic","model":"claude-sonnet-4-6"}`. Keys a simulation's
1541
+ own settings name wait until you choose a route. The first launch after
1542
+ the move whose own `--provider` chose a route
1543
+ shows the notice and keeps its prompt in the composer until you press Enter,
1544
+ instead of asking how to connect. A later launch whose own `--provider` chose
1545
+ a route shows one line naming the route the run uses and saying the profile
1546
+ still waits, and sends its prompt at once. A provider's own key variable, such
1547
+ as `ANTHROPIC_API_KEY`, is still never chosen on its own.
1548
+
1549
+ An Anthropic API key you had saved under `claude_code` or `claude_code_direct`
1550
+ is not one of these routes either: the move keeps it apart, names it in the
1551
+ notice and offers it in `/connect`, and ZTC uses it only once you choose it
1552
+ there.
1553
+
1554
+ When the move picked a route that bills, a launch with a prompt (`ztc "..."`)
1555
+ shows the notice first and keeps the prompt in the composer until you press
1556
+ Enter. `/model` or `/connect` chooses another route at any time. The settings
1557
+ from before the move are kept in `config.json.pre-retired-routes-v1.bak` next to
1558
+ `config.json` (a later move adds a timestamp instead); the backup never keeps a
1559
+ Claude Code sign-in token or a key filed under a retired provider.
1560
+
1561
+ Claude accounts from `/accounts`, `claude_code_direct` ones included, become
1562
+ Claude Code sign-in profiles named after them, on the same directories
1563
+ (`/claude @work`, listed by `/subs`), so Claude Code keeps the sign-in it already
1564
+ has there; ZTC doesn't open what's inside them. A profile name uses letters,
1565
+ digits, `.`, `_` and `-`, up to 32 characters, so an id that can't be one is
1566
+ adjusted (`Work Account` becomes `Work-Account`) and one whose name is taken
1567
+ gets a number (`personal-2`); the notice gives each profile's name. `~` in a saved path is read as
1568
+ your home directory; an account saved with a relative path gets no profile, and
1569
+ the notice says how to add it (`/accounts add claude_code <name> --path <dir>`).
1570
+ A directory that no longer exists is named, to sign in there again. The account
1571
+ you were using becomes the profile new Claude Code panes start on, unless you
1572
+ had chosen one (`/subs use claude` goes back to Claude Code's own sign-in). An
1573
+ account on `~/.claude` is Claude Code's own sign-in, which `/claude` uses
1574
+ anyway. `/accounts use <old id>` still finds the profile an account became.
1575
+
1576
+ A run nobody watches (`--headless`, `-p`, `--json`, `--json-stream` or
1577
+ `zerg-ztc-headless`) that asks for a retired route with `--provider claude_code`,
1578
+ `--model claude-code-sonnet`, `ZTC_PROVIDER=claude_code` or another such variable
1579
+ exits with status 2 before any model request and says why; so does one whose
1580
+ profile moved with no route to use, until you choose one (`/connect`, `/model`
1581
+ or a Zerg Router login). Until then only the run's own `--provider` (with
1582
+ `--model`, and `--auth-mode direct` to run on that provider's API key) chooses a
1583
+ route for it: an auth mode, a key or a platform token found in the environment,
1584
+ or an older ZergAI platform login, never does, and a run that starts on such a
1585
+ profile prints the move's notice first. Launch flags outrank those variables, as
1586
+ they always do: a run given `--provider` and `--model` of a provider ZTC offers
1587
+ uses them and says which variable it ignored. An interactive launch ignores the
1588
+ request, together with the model and `--auth-mode` given with it, and says which
1589
+ route runs instead. A repository's `.ztc/config.json`, a resumed session or a
1590
+ child pane that names a retired route continues on the configured route. A saved
1591
+ simulation (or `ZTC_SIM_PROVIDER`) naming one continues on the route ZTC's agent
1592
+ uses, your key or Zerg Router, and the notice names it; on a profile still
1593
+ waiting for a route it says so and does not run. Library and hosted callers get
1594
+ an error that names what to use instead. ZTC no longer reads
1595
+ `CLAUDE_CODE_OAUTH_TOKEN`: a plain `/claude` pane passes it to Claude Code, and
1596
+ panes on a profile ignore it, so if you exported it only for ZTC, you can remove
1597
+ it.
1461
1598
 
1462
1599
  ### Environment Variables
1463
1600
 
@@ -1471,7 +1608,6 @@ unset preserves normal interactive discovery.
1471
1608
  | Variable | Description |
1472
1609
  |----------|-------------|
1473
1610
  | `ANTHROPIC_API_KEY` | Anthropic API key for direct API billing |
1474
- | `CLAUDE_CODE_OAUTH_TOKEN` | Claude Code OAuth token from `claude setup-token`; used by `/config provider claude_code` |
1475
1611
  | `ZTC_NO_BROWSER` | Set to `1` so ZTC never opens a browser (logins, `/mirror`, billing); it prints the URL instead. CI and test runs behave this way already |
1476
1612
  | `ZTC_DEBUG` | Enable debug logging |
1477
1613
  | `ZTC_SUBAGENT_DEBUG` | Log sub-agent execution |
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/App.js CHANGED
@@ -12,6 +12,7 @@ import { DEFAULT_TOAST_MS, MAX_QUEUE } from './app/controller.js';
12
12
  import { getQueuePreview } from './ui/views/queue_panel.js';
13
13
  import { estimateInputLines } from './ui/views/input_area.js';
14
14
  import { configStore } from './config.js';
15
+ import { claimLaunchNotices } from './app/launch_notices.js';
15
16
  import { applyAccountOp } from './web/accounts_mirror.js';
16
17
  import { createUsageSnapshot, mergeUsageSnapshots, recordUsageReceipt } from './usage_snapshot.js';
17
18
  import { resolveMessageDisplaySettings } from './config/message_display.js';
@@ -22,6 +23,7 @@ import { getTraceStyle } from './emulation/trace_style.js';
22
23
  import { debugLog } from './debug/logger.js';
23
24
  import { runShellCommand, resolveWorkingDir } from './utils/shell.js';
24
25
  import { writeClipboard } from './utils/clipboard.js';
26
+ import { launchedByAnotherZtc } from './utils/subprocess_env.js';
25
27
  import { isPersistableAssistantMessage } from './utils/assistant_message.js';
26
28
  import { listModels } from './utils/models.js';
27
29
  import { formatToolStart, formatToolError, buildToolOutputMessage } from './utils/tool_trace.js';
@@ -564,6 +566,17 @@ export const App = () => {
564
566
  timestamp: new Date()
565
567
  }]);
566
568
  }, []);
569
+ // One-time notices (where a retired Claude Code route went, what this launch
570
+ // ignored) show once, after the welcome.
571
+ React.useEffect(() => {
572
+ let cancelled = false;
573
+ void claimLaunchNotices(configStore, { interactive: !process.env.ZTC_COLONY_CHILD })
574
+ .then(notices => { if (!cancelled)
575
+ for (const notice of notices)
576
+ addMessage({ role: 'system', content: notice.text }); })
577
+ .catch(() => { });
578
+ return () => { cancelled = true; };
579
+ }, [addMessage]);
567
580
  const showToastRef = useRef(null);
568
581
  const questionnaireWidget = useMemo(() => new QuestionnaireWidget({
569
582
  render: () => renderQuestionnaireWidget(version => version + 1),
@@ -1480,6 +1493,10 @@ export const App = () => {
1480
1493
  }, [addMessage]);
1481
1494
  // App context for commands
1482
1495
  const appContext = useMemo(() => ({
1496
+ // Every command here is typed on this terminal. In a ZTC another ZTC launched into one of its panes (when its
1497
+ // terminal renderer couldn't start), that terminal is a PTY the overseer's write_terminal_pane types into too, so
1498
+ // the commands run as relayed input, which choices only the person makes refuse (CommandContext.commandOrigin).
1499
+ ...(launchedByAnotherZtc() ? { commandOrigin: 'relayed' } : {}),
1483
1500
  addMessage,
1484
1501
  clearMessages,
1485
1502
  getEvidenceSnapshot: () => agent?.getEvidenceSnapshot(),
@@ -405,7 +405,7 @@ export class Agent {
405
405
  apiKey,
406
406
  disableApiKeyFallback: config.disableApiKeyFallback ?? false,
407
407
  runtimeCredentialsAvailable: config.runtimeCredentialsAvailable ?? (defaultProvider === 'bedrock'),
408
- apiEndpoint: config.apiEndpoint || ((defaultProvider === 'anthropic' || defaultProvider === 'claude_code' || defaultProvider === 'claude-code') ? 'https://api.anthropic.com/v1/messages' : 'https://api.openai.com/v1'),
408
+ apiEndpoint: config.apiEndpoint || ((defaultProvider === 'anthropic' || defaultProvider === 'claude') ? 'https://api.anthropic.com/v1/messages' : 'https://api.openai.com/v1'),
409
409
  maxTokens: config.maxTokens,
410
410
  routePlan: config.routePlan,
411
411
  leadTurnNote: config.leadTurnNote,
@@ -2925,10 +2925,6 @@ INVESTIGATION STRATEGY — before making tool calls to explore or debug, follow
2925
2925
  const guardedRequest = {
2926
2926
  ...request,
2927
2927
  signal: attemptController.signal,
2928
- // The caller's cancel signal, kept separate from attemptController: the
2929
- // latter also aborts on the inactivity timeout below, so rotation needs
2930
- // this to tell a user cancel (skip failover) from a hung account (rotate).
2931
- userSignal: signal,
2932
2928
  timeoutMs,
2933
2929
  onActivity: () => {
2934
2930
  if (providerAttemptActive && !signal?.aborted && !attemptController.signal.aborted)
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Account-change notifier — a tiny decoupled signal so the web mirror can push a
3
3
  * live active-account badge without the config/pool layers depending on the
4
- * mirror. Both manual switches (/accounts use, the web op) and auto-rotation move
5
- * the active pointer through ConfigStore.setActiveAccount, which fires this; the
6
- * mirror subscribes and re-publishes its accounts SSE event.
4
+ * mirror. Manual switches (/accounts use, the web op) move the active pointer
5
+ * through ConfigStore.setActiveAccount, which fires this; the mirror subscribes
6
+ * and re-publishes its accounts SSE event.
7
7
  */
8
8
  type AccountsChangedListener = () => void;
9
- /** Subscribe to active-account / rotation changes. Returns an unsubscribe fn. */
9
+ /** Subscribe to active-account changes (the user switching accounts). Returns an unsubscribe fn. */
10
10
  export declare function onAccountsChanged(listener: AccountsChangedListener): () => void;
11
11
  /** Fire all listeners. Never throws — a bad listener can't break a switch. */
12
12
  export declare function notifyAccountsChanged(): void;
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Account-change notifier — a tiny decoupled signal so the web mirror can push a
3
3
  * live active-account badge without the config/pool layers depending on the
4
- * mirror. Both manual switches (/accounts use, the web op) and auto-rotation move
5
- * the active pointer through ConfigStore.setActiveAccount, which fires this; the
6
- * mirror subscribes and re-publishes its accounts SSE event.
4
+ * mirror. Manual switches (/accounts use, the web op) move the active pointer
5
+ * through ConfigStore.setActiveAccount, which fires this; the mirror subscribes
6
+ * and re-publishes its accounts SSE event.
7
7
  */
8
8
  const listeners = new Set();
9
- /** Subscribe to active-account / rotation changes. Returns an unsubscribe fn. */
9
+ /** Subscribe to active-account changes (the user switching accounts). Returns an unsubscribe fn. */
10
10
  export function onAccountsChanged(listener) {
11
11
  listeners.add(listener);
12
12
  return () => listeners.delete(listener);
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * ztc never handles tokens — but it CAN launch the official CLI's OAuth flow on
5
5
  * the ztc host so the user doesn't have to copy/paste a command. `runLoginCommand`
6
- * spawns `claude /login` / `codex login` with PIPED stdio (never stdio:'inherit',
6
+ * spawns `codex login` with PIPED stdio (never stdio:'inherit',
7
7
  * which would freeze the Node event loop and every mirror pane for the whole
8
8
  * OAuth). It resolves once the CLI exits (or a timeout kills it), reporting
9
9
  * success only when the CLI exited 0 AND usable credentials actually landed —
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * ztc never handles tokens — but it CAN launch the official CLI's OAuth flow on
5
5
  * the ztc host so the user doesn't have to copy/paste a command. `runLoginCommand`
6
- * spawns `claude /login` / `codex login` with PIPED stdio (never stdio:'inherit',
6
+ * spawns `codex login` with PIPED stdio (never stdio:'inherit',
7
7
  * which would freeze the Node event loop and every mirror pane for the whole
8
8
  * OAuth). It resolves once the CLI exits (or a timeout kills it), reporting
9
9
  * success only when the CLI exited 0 AND usable credentials actually landed —
@@ -1,37 +1,33 @@
1
1
  /**
2
- * Account pool — model + resolution for switchable Claude Code + Codex
3
- * subscription accounts.
2
+ * Account pool — model + resolution for switchable Codex and Kimi Code
3
+ * subscription accounts. Accounts switch only when the user chooses one.
4
4
  *
5
5
  * Resolve each active account to an isolated credential path for the backend.
6
6
  * Official CLI logins write each profile's credentials; this module probes
7
7
  * their files and builds the corresponding process environment.
8
+ *
9
+ * Claude accounts are not part of the pool: a Claude subscription runs in a
10
+ * Claude Code pane on a sign-in profile (panes/agent_profiles.ts), and ZTC
11
+ * never reads what Claude Code stores.
8
12
  */
9
- import type { Account, AccountProvider, AccountRotation, AccountSource, ZTCConfig } from '../../config/types.js';
10
- /** Root dir for ztc-owned per-account credential dirs. */
11
- export declare const ACCOUNTS_ROOT: string;
13
+ import type { Account, AccountProvider, AccountSource, ZTCConfig } from '../../config/types.js';
12
14
  /** Type guard for the registerable account providers. */
13
15
  export declare function isAccountProvider(value: string): value is AccountProvider;
14
- /** Default auto-rotate policy (applied at read time when `rotation` is unset). */
15
- export declare const DEFAULT_ACCOUNT_ROTATION: AccountRotation;
16
16
  /**
17
17
  * Account-selecting fields passed into {@link createBackendForProvider}. Exactly
18
18
  * one is set for a resolved account; all empty when no pool is configured.
19
19
  */
20
20
  export interface AccountBackendOptions {
21
- /** env CLAUDE_CONFIG_DIR for the spawned `claude` (claude_code). */
22
- claudeConfigDir?: string;
23
21
  /** env CODEX_HOME for the spawned `codex app-server` (codex_app_server). */
24
22
  codexHome?: string;
25
23
  /** auth.json path for CodexAuthManager (codex_legacy). */
26
24
  codexAuthFilePath?: string;
27
- /** .credentials.json path for ClaudeCodeAuthManager (claude_code_direct). */
28
- claudeCredsFilePath?: string;
29
25
  /** kimi-code.json path for KimiCodeAuthManager (kimi_code). */
30
26
  kimiCredsFilePath?: string;
31
27
  }
32
28
  /**
33
29
  * Canonical pool key for a provider id. {@link normalizeProviderId} only unifies
34
- * the codex aliases, so fold the `claude-code` hyphen variants into the
30
+ * the codex aliases, so fold the `kimi-code` hyphen variant into the
35
31
  * underscore {@link AccountProvider} form used by {@link Account.provider}.
36
32
  */
37
33
  export declare function canonicalAccountProvider(provider: string): string;
@@ -45,8 +41,6 @@ export declare function accountSourceToBackendOptions(source: AccountSource): Ac
45
41
  * account is active for that provider.
46
42
  */
47
43
  export declare function accountBackendOptions(config: ZTCConfig, provider: string): AccountBackendOptions;
48
- /** Effective rotation policy (config override merged over defaults). */
49
- export declare function resolveRotation(config: ZTCConfig): AccountRotation;
50
44
  /** Default ztc-owned credential dir for a freshly-added account. */
51
45
  export declare function defaultAccountDir(provider: AccountProvider, id: string): string;
52
46
  /**
@@ -70,48 +64,11 @@ export declare function ensureAccountDir(source: AccountSource): string;
70
64
  export declare function findCodexHomeCollision(accounts: readonly Account[], source: AccountSource): Account | undefined;
71
65
  /**
72
66
  * Whether an account holds ISOLATED (per-account) credentials. Always probes
73
- * the account's EXPLICIT path — never the cached default — and for the Claude
74
- * kinds suppresses the global env token and shared macOS keychain so one
75
- * account's login never reads as another's.
67
+ * the account's EXPLICIT path — never the cached default.
76
68
  */
77
69
  export declare function probeAccountIsolated(account: Account): boolean;
78
- /**
79
- * How an account's credentials are backed:
80
- * - 'isolated' per-account file/dir creds exist — the pool's isolation
81
- * guarantee holds for this account.
82
- * - 'shared_keychain' no isolated creds, but the shared macOS keychain item the
83
- * official `claude` CLI writes ("Claude Code-credentials")
84
- * exists. The account WORKS, but every claude account on
85
- * this machine shares that one identity — switching or
86
- * rotating between such accounts changes nothing.
87
- * - 'none' no credentials found; login required.
88
- */
89
- export type AccountCredentialSource = 'isolated' | 'shared_keychain' | 'none';
90
- /**
91
- * True when the shared macOS keychain item written by the official claude CLI
92
- * exists. Existence check ONLY (`security find-generic-password` without `-w`)
93
- * — ztc never reads credential material. Memoized for 5s on the default runner
94
- * so payload builds don't spawn `security` per account.
95
- */
96
- export declare function sharedClaudeKeychainPresent(runner?: (cmd: string, args: string[]) => {
97
- status: number | null;
98
- }): boolean;
99
- /** Resolve the credential backing for an account (see AccountCredentialSource). */
100
- export declare function accountCredentialSource(account: Account, keychainPresent?: () => boolean): AccountCredentialSource;
101
- /**
102
- * Whether an account can currently serve requests. Shared-keychain-backed
103
- * claude accounts count as usable (the CLI will run) — they just aren't
104
- * isolated; surface that via {@link accountCredentialSource}, don't hide it by
105
- * reporting a logged-in account as "needs login".
106
- */
107
- export declare function probeAccountUsable(account: Account, keychainPresent?: () => boolean): boolean;
108
- /**
109
- * Warn when an account is served by the SHARED macOS keychain identity rather
110
- * than isolated per-account credentials. Every claude account on such a machine
111
- * shares that one login, so switching or rotating between them is a silent
112
- * no-op until each logs in per-account. Emits nothing for isolated/none sources.
113
- */
114
- export declare function warnSharedKeychainAccount(account: Account, keychainPresent?: () => boolean, warn?: (message: string) => void): void;
70
+ /** Whether an account can currently serve requests: its own credentials exist. */
71
+ export declare function probeAccountUsable(account: Account): boolean;
115
72
  /** The official-CLI login invocation for an account (host-side OAuth flow). */
116
73
  export interface LoginCommand {
117
74
  command: string;