@zergai/ztc 0.26.2-dev.202611210149 → 0.26.4-dev.202611231953

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 (275) hide show
  1. package/README.md +590 -28
  2. package/bin/zmux-darwin-arm64 +0 -0
  3. package/bin/zmux-linux-x64 +0 -0
  4. package/bin/ztc-audio-darwin-arm64 +0 -0
  5. package/bin/ztc-capture-darwin-arm64 +0 -0
  6. package/bin/ztc-tui-darwin-arm64 +0 -0
  7. package/bin/ztc-tui-linux-x64 +0 -0
  8. package/bin/zterm-darwin-arm64 +2 -2
  9. package/dist/App.js +18 -1
  10. package/dist/agent/agent.d.ts +25 -1
  11. package/dist/agent/agent.js +26 -1
  12. package/dist/agent/attached_images.d.ts +58 -0
  13. package/dist/agent/attached_images.js +145 -0
  14. package/dist/agent/backends/anthropic.d.ts +14 -0
  15. package/dist/agent/backends/anthropic.js +49 -2
  16. package/dist/agent/backends/codex_app_server.d.ts +3 -1
  17. package/dist/agent/backends/codex_app_server.js +9 -6
  18. package/dist/agent/backends/codex_auth.js +3 -0
  19. package/dist/agent/backends/gemini.js +3 -0
  20. package/dist/agent/backends/host_effort_policy.js +14 -2
  21. package/dist/agent/backends/http_error.d.ts +17 -0
  22. package/dist/agent/backends/http_error.js +50 -1
  23. package/dist/agent/backends/index.js +2 -1
  24. package/dist/agent/backends/model_redirect.d.ts +47 -0
  25. package/dist/agent/backends/model_redirect.js +97 -0
  26. package/dist/agent/backends/openai_compatible.js +5 -0
  27. package/dist/agent/backends/openai_responses.d.ts +9 -1
  28. package/dist/agent/backends/openai_responses.js +21 -12
  29. package/dist/agent/backends/prompt_cache.d.ts +8 -0
  30. package/dist/agent/backends/prompt_cache.js +10 -0
  31. package/dist/agent/backends/provider_ids.d.ts +1 -1
  32. package/dist/agent/backends/provider_ids.js +1 -1
  33. package/dist/agent/backends/types.d.ts +8 -0
  34. package/dist/agent/backends/zerg-api.js +5 -1
  35. package/dist/agent/backends/zrouter_stream.d.ts +75 -9
  36. package/dist/agent/backends/zrouter_stream.js +250 -49
  37. package/dist/agent/commands/config.js +51 -4
  38. package/dist/agent/commands/connect.js +20 -0
  39. package/dist/agent/commands/credential_status.js +5 -3
  40. package/dist/agent/commands/debug.js +3 -0
  41. package/dist/agent/commands/diff.js +9 -5
  42. package/dist/agent/commands/emulation.js +7 -1
  43. package/dist/agent/commands/inbox.js +4 -3
  44. package/dist/agent/commands/mcp.js +3 -0
  45. package/dist/agent/commands/models.js +20 -3
  46. package/dist/agent/commands/permissions.js +16 -2
  47. package/dist/agent/commands/provider_selection.js +13 -6
  48. package/dist/agent/commands/settings.js +15 -4
  49. package/dist/agent/commands/status.js +23 -1
  50. package/dist/agent/commands/types.d.ts +34 -3
  51. package/dist/agent/commands/update.d.ts +2 -1
  52. package/dist/agent/commands/update.js +8 -3
  53. package/dist/agent/commands/zerg.d.ts +6 -0
  54. package/dist/agent/commands/zerg.js +152 -28
  55. package/dist/agent/commands/ztc_pane.js +8 -5
  56. package/dist/agent/factory.js +22 -4
  57. package/dist/agent/request_encoder.js +11 -2
  58. package/dist/agent/runtime/command_jobs.js +16 -1
  59. package/dist/agent/runtime/command_panes.js +4 -1
  60. package/dist/agent/runtime/execution_context.d.ts +8 -1
  61. package/dist/agent/runtime/execution_context.js +8 -2
  62. package/dist/agent/runtime/policy.d.ts +66 -5
  63. package/dist/agent/runtime/policy.js +161 -33
  64. package/dist/agent/runtime/remote_broker_transport.d.ts +7 -0
  65. package/dist/agent/runtime/remote_broker_transport.js +33 -3
  66. package/dist/agent/runtime/remote_resource_errors.d.ts +7 -0
  67. package/dist/agent/runtime/remote_resource_errors.js +10 -0
  68. package/dist/agent/runtime/remote_resources.d.ts +1 -1
  69. package/dist/agent/runtime/remote_resources.js +7 -3
  70. package/dist/agent/runtime/source_verification.js +15 -12
  71. package/dist/agent/runtime/tool_runtime.js +165 -58
  72. package/dist/agent/runtime/verifier_capture.d.ts +1 -1
  73. package/dist/agent/runtime/verifier_capture.js +6 -0
  74. package/dist/agent/runtime/work_base.js +46 -14
  75. package/dist/agent/tools/adaptation.js +29 -12
  76. package/dist/agent/tools/apply_patch.js +62 -5
  77. package/dist/agent/tools/background.js +2 -0
  78. package/dist/agent/tools/benchmark_cpu.js +2 -0
  79. package/dist/agent/tools/bus_message.d.ts +4 -2
  80. package/dist/agent/tools/bus_message.js +21 -3
  81. package/dist/agent/tools/delegate.js +2 -0
  82. package/dist/agent/tools/file.d.ts +12 -1
  83. package/dist/agent/tools/file.js +92 -11
  84. package/dist/agent/tools/lsp.d.ts +12 -0
  85. package/dist/agent/tools/lsp.js +61 -5
  86. package/dist/agent/tools/pane.js +20 -45
  87. package/dist/agent/tools/project_context.js +5 -2
  88. package/dist/agent/tools/routine.js +20 -4
  89. package/dist/agent/tools/screenshot.d.ts +8 -0
  90. package/dist/agent/tools/screenshot.js +39 -25
  91. package/dist/agent/tools/search.js +31 -3
  92. package/dist/agent/tools/shell.js +7 -1
  93. package/dist/agent/tools/supervision.js +6 -0
  94. package/dist/agent/tools/types.d.ts +18 -0
  95. package/dist/agent/tools/zerg.js +15 -19
  96. package/dist/agent/tools/ztc_command.d.ts +15 -4
  97. package/dist/agent/tools/ztc_command.js +48 -34
  98. package/dist/app/agent_runner.js +8 -6
  99. package/dist/app/conversation_compaction.d.ts +6 -3
  100. package/dist/app/conversation_compaction.js +6 -3
  101. package/dist/app/tool_callbacks.js +1 -0
  102. package/dist/audio/sfx.js +6 -0
  103. package/dist/batch/worktree.js +22 -10
  104. package/dist/board/client.js +2 -1
  105. package/dist/cli_main.d.ts +1 -0
  106. package/dist/cli_main.js +141 -45
  107. package/dist/cli_ratatui.d.ts +49 -4
  108. package/dist/cli_ratatui.js +355 -79
  109. package/dist/conductor_branch.js +4 -1
  110. package/dist/config/host_credentials.d.ts +157 -0
  111. package/dist/config/host_credentials.js +589 -0
  112. package/dist/config/model_pin.d.ts +111 -0
  113. package/dist/config/model_pin.js +182 -0
  114. package/dist/config/own_state_files.d.ts +35 -0
  115. package/dist/config/own_state_files.js +161 -0
  116. package/dist/config/permission_pin.d.ts +148 -0
  117. package/dist/config/permission_pin.js +203 -0
  118. package/dist/config/permissions.d.ts +9 -2
  119. package/dist/config/permissions.js +14 -3
  120. package/dist/config/platform_login.d.ts +72 -0
  121. package/dist/config/platform_login.js +111 -0
  122. package/dist/config/profile_limits.d.ts +34 -0
  123. package/dist/config/profile_limits.js +66 -0
  124. package/dist/config/provider_api_key_env.js +3 -2
  125. package/dist/config/provider_models.d.ts +6 -1
  126. package/dist/config/provider_models.js +38 -11
  127. package/dist/config/repo_config.d.ts +22 -0
  128. package/dist/config/repo_config.js +77 -3
  129. package/dist/config/router_runtime_grant.d.ts +53 -0
  130. package/dist/config/router_runtime_grant.js +131 -0
  131. package/dist/config/settings_merge.d.ts +22 -0
  132. package/dist/config/settings_merge.js +75 -0
  133. package/dist/config/types.d.ts +8 -0
  134. package/dist/config.d.ts +334 -4
  135. package/dist/config.js +1024 -41
  136. package/dist/context/project_intelligence.d.ts +11 -2
  137. package/dist/context/project_intelligence.js +38 -15
  138. package/dist/desktop/daily/desktop_wiring.js +8 -6
  139. package/dist/desktop/daily/native_pane_launcher.js +2 -1
  140. package/dist/desktop/daily/native_tool.d.ts +1 -1
  141. package/dist/desktop/daily/native_tool.js +4 -3
  142. package/dist/desktop/daily/process_identity.js +10 -2
  143. package/dist/desktop/daily/source_baseline.js +4 -3
  144. package/dist/diagnostics/native_terminal_benchmark.js +3 -2
  145. package/dist/diagnostics/session_export.js +27 -14
  146. package/dist/embedded/anempa_runtime.js +3 -3
  147. package/dist/embedded/gameboy_runtime.js +5 -4
  148. package/dist/embedded/zergpod_runtime.js +5 -4
  149. package/dist/emulation/catalog.js +6 -1
  150. package/dist/emulation/tool_adapters.js +13 -3
  151. package/dist/environment/store.js +5 -4
  152. package/dist/extension_discovery.d.ts +12 -2
  153. package/dist/extension_discovery.js +52 -7
  154. package/dist/headless.d.ts +8 -0
  155. package/dist/headless.js +52 -13
  156. package/dist/headless_cli.js +16 -1
  157. package/dist/headless_workflow_trigger.js +1 -1
  158. package/dist/hooks/dispatcher.d.ts +8 -0
  159. package/dist/hooks/dispatcher.js +22 -2
  160. package/dist/hooks/lifecycle.d.ts +6 -0
  161. package/dist/hooks/lifecycle.js +1 -0
  162. package/dist/hooks/program_files.d.ts +10 -0
  163. package/dist/hooks/program_files.js +175 -0
  164. package/dist/hooks/runner.d.ts +11 -1
  165. package/dist/hooks/runner.js +112 -11
  166. package/dist/hooks/types.d.ts +2 -0
  167. package/dist/host_credentials_startup.d.ts +6 -0
  168. package/dist/host_credentials_startup.js +17 -0
  169. package/dist/instance_registry.d.ts +6 -2
  170. package/dist/instance_registry.js +9 -15
  171. package/dist/intake/format.d.ts +6 -0
  172. package/dist/intake/format.js +9 -0
  173. package/dist/intake/notifications.js +2 -1
  174. package/dist/lsp/manager.d.ts +1 -1
  175. package/dist/lsp/manager.js +4 -5
  176. package/dist/mcp/client.d.ts +2 -0
  177. package/dist/mcp/client.js +116 -18
  178. package/dist/mcp/registry.d.ts +12 -0
  179. package/dist/mcp/registry.js +15 -1
  180. package/dist/modes/handlers.js +14 -5
  181. package/dist/panes/agent_cli.d.ts +23 -1
  182. package/dist/panes/agent_cli.js +96 -1
  183. package/dist/panes/agent_panes.d.ts +27 -4
  184. package/dist/panes/agent_panes.js +73 -11
  185. package/dist/panes/editor_program.d.ts +8 -0
  186. package/dist/panes/editor_program.js +25 -0
  187. package/dist/panes/motsi.d.ts +11 -1
  188. package/dist/panes/motsi.js +14 -1
  189. package/dist/panes/pane_registry.d.ts +28 -1
  190. package/dist/panes/pane_registry.js +25 -0
  191. package/dist/panes/worker_route.js +5 -3
  192. package/dist/panes/ztc_launch.d.ts +8 -0
  193. package/dist/panes/ztc_launch.js +26 -1
  194. package/dist/profile_baseline.js +2 -0
  195. package/dist/router_auth.d.ts +8 -3
  196. package/dist/router_auth.js +34 -2
  197. package/dist/runtime_info.js +56 -38
  198. package/dist/session.js +12 -2
  199. package/dist/shannon/runtime.js +13 -1
  200. package/dist/simulation/domains/loader.d.ts +2 -1
  201. package/dist/simulation/domains/loader.js +19 -2
  202. package/dist/simulation/living/context.d.ts +8 -8
  203. package/dist/simulation/living/types.d.ts +2 -2
  204. package/dist/simulation/memory/embedding.d.ts +2 -1
  205. package/dist/simulation/memory/embedding.js +25 -6
  206. package/dist/terminal_attach.js +2 -1
  207. package/dist/types.d.ts +21 -0
  208. package/dist/ui/ratatui/headless_pane_manager.d.ts +12 -6
  209. package/dist/ui/ratatui/headless_pane_manager.js +65 -21
  210. package/dist/ui/ratatui/ipc_path.d.ts +41 -2
  211. package/dist/ui/ratatui/ipc_path.js +164 -5
  212. package/dist/ui/ratatui/pane_credential_broker.d.ts +17 -4
  213. package/dist/ui/ratatui/pane_credential_broker.js +23 -5
  214. package/dist/ui/ratatui/pane_relay.d.ts +74 -0
  215. package/dist/ui/ratatui/pane_relay.js +188 -13
  216. package/dist/ui/ratatui/process.d.ts +15 -1
  217. package/dist/ui/ratatui/process.js +129 -163
  218. package/dist/ui/ratatui/protocol.d.ts +11 -1
  219. package/dist/ui/ratatui/protocol.js +6 -0
  220. package/dist/ui/ratatui/ztc_launch_trust.d.ts +87 -0
  221. package/dist/ui/ratatui/ztc_launch_trust.js +249 -0
  222. package/dist/utils/admitted_open.d.ts +40 -0
  223. package/dist/utils/admitted_open.js +111 -0
  224. package/dist/utils/clipboard.js +2 -1
  225. package/dist/utils/computer_native.js +12 -56
  226. package/dist/utils/dictation.js +15 -12
  227. package/dist/utils/dictation_native.js +17 -60
  228. package/dist/utils/git_probe_options.d.ts +28 -0
  229. package/dist/utils/git_probe_options.js +30 -0
  230. package/dist/utils/git_program_files.d.ts +145 -0
  231. package/dist/utils/git_program_files.js +1282 -0
  232. package/dist/utils/git_repository_programs.d.ts +13 -0
  233. package/dist/utils/git_repository_programs.js +38 -0
  234. package/dist/utils/host_shell.js +2 -1
  235. package/dist/utils/idle_compaction.js +8 -1
  236. package/dist/utils/image_fit.d.ts +4 -1
  237. package/dist/utils/image_fit.js +6 -2
  238. package/dist/utils/image_preview.js +3 -2
  239. package/dist/utils/mirror_media.d.ts +22 -4
  240. package/dist/utils/mirror_media.js +87 -86
  241. package/dist/utils/ml_native.js +11 -56
  242. package/dist/utils/native_install.d.ts +55 -0
  243. package/dist/utils/native_install.js +107 -0
  244. package/dist/utils/open_url.js +2 -0
  245. package/dist/utils/process_end.d.ts +16 -0
  246. package/dist/utils/process_end.js +73 -0
  247. package/dist/utils/router_catalog.js +9 -2
  248. package/dist/utils/sandbox.d.ts +64 -1
  249. package/dist/utils/sandbox.js +397 -89
  250. package/dist/utils/shell.js +31 -12
  251. package/dist/utils/subprocess_env.d.ts +218 -2
  252. package/dist/utils/subprocess_env.js +429 -11
  253. package/dist/utils/system_ps.d.ts +5 -0
  254. package/dist/utils/system_ps.js +30 -0
  255. package/dist/utils/tts.js +5 -0
  256. package/dist/utils/tts_native.js +13 -60
  257. package/dist/utils/zlicky_overlay.js +17 -50
  258. package/dist/utils/ztc_own_state.d.ts +58 -0
  259. package/dist/utils/ztc_own_state.js +236 -0
  260. package/dist/web/mirror_authenticator.d.ts +67 -6
  261. package/dist/web/mirror_authenticator.js +131 -22
  262. package/dist/web/mirror_stream.d.ts +54 -10
  263. package/dist/web/mirror_stream.js +379 -92
  264. package/dist/web/observer_query_redaction.js +53 -13
  265. package/dist/web/observer_secret_redaction.d.ts +59 -0
  266. package/dist/web/observer_secret_redaction.js +714 -0
  267. package/dist/web/pane_credentials.d.ts +20 -2
  268. package/dist/web/pane_credentials.js +58 -5
  269. package/dist/worker/executor.js +3 -1
  270. package/dist/workspace_collision.js +19 -15
  271. package/dist/zerg/local_zerg_launches.d.ts +27 -0
  272. package/dist/zerg/local_zerg_launches.js +198 -0
  273. package/dist/zlm-embed.mjs +6257 -2791
  274. package/npm-shrinkwrap.json +1 -1
  275. package/package.json +42 -15
package/dist/config.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { AuthContext, ResolvedLLMConfig } from './config/resolved.js';
7
7
  import { type RetiredRouteRequest } from './config/retired_routes.js';
8
8
  import { type LaunchRouteFlags } from './config/retired_ids.js';
9
9
  import { type RouterSessionStatus } from './router_auth.js';
10
+ import { type HostedSessionSettings } from './hosted/session_settings.js';
10
11
  import { type ApiKeySource } from './config/provider_api_key_env.js';
11
12
  /** Validate and normalize an OpenAI-compatible inference destination. */
12
13
  export declare function compatEndpoint(value: string, options?: {
@@ -71,6 +72,8 @@ export declare class ConfigStore {
71
72
  * compares against to tell this process's own changes from another ZTC's (see mergeSavedSettings).
72
73
  */
73
74
  private savedBase;
75
+ /** This process's settings as it held them when savedBase was taken: what a reload merges this process's changes from. */
76
+ private savedBaseConfig;
74
77
  private configScope;
75
78
  /** See onChange. */
76
79
  private readonly changeListeners;
@@ -124,6 +127,22 @@ export declare class ConfigStore {
124
127
  private sessionRouteChoice;
125
128
  /** This process's session settings are a hosted thread's, not the person's choice in it (see markHostedSession). */
126
129
  private hostedSession;
130
+ /**
131
+ * The hosted thread's settings this session took last (applyHostedThreadSettings): the host's, which a clear of the
132
+ * session's own settings leaves in place (clearSessionOverrides).
133
+ */
134
+ private hostedThreadSettings;
135
+ /**
136
+ * The sandbox settings and tool permissions as config.json saves them, without ZTC's defaults (load). A host's pin of
137
+ * the permission settings is taken from these (pinStartupPermissions), so a ZTC of another version, started again in
138
+ * place, resolves them with its own defaults.
139
+ */
140
+ private savedPermissionSettings;
141
+ /**
142
+ * The permission settings this session's host pinned (ZTC_PERMISSION_PROFILE_PINNED; config/permission_pin.ts), as the
143
+ * session held them once its startup was done (pinStartupPermissions): taken once, and never changed or ended.
144
+ */
145
+ private permissionPin;
127
146
  /**
128
147
  * The move off the retired routes, when it could not be saved with its
129
148
  * backup: it applies to this run only, and save() writes that backup before
@@ -143,6 +162,28 @@ export declare class ConfigStore {
143
162
  private environmentRouteSources;
144
163
  /** The model the environment pins this load; a retired one is ignored and pins nothing. */
145
164
  private environmentModelPin;
165
+ /**
166
+ * What save() writes for each setting a reload kept as this process had it, under a profile that limits the agent
167
+ * (FROZEN_UNDER_LIMITS), where that is not what this process holds: the value config.json holds, with only what this
168
+ * process changed in the setting itself applied over it (noteFrozenValueToSave), so this process never undoes an edit
169
+ * it did not take, and the edit applies at the next start. A restart in place would take each (see
170
+ * listSettingsARestartWouldTake).
171
+ */
172
+ private frozenFileValues;
173
+ /** The frozen settings whose ignored edit this process has said (see keepFrozenSettings): each is said once. */
174
+ private frozenEditsSaid;
175
+ /** The config.json this process last read, whose later edits a profile that limits the agent does not take. */
176
+ private loadedConfigFile;
177
+ /**
178
+ * For each config.json this process left for another config profile's under a permission profile that limits the
179
+ * agent, and for the copy /profile duplicate made of the one it ran on: the settings of FROZEN_UNDER_LIMITS as it held
180
+ * them there. A switch back under such a profile holds them so again (switchProfile), as a reload of that config.json
181
+ * would, so an edit to them that it held back there, or one made there while it was away, waits for a restart, as it
182
+ * would had it stayed.
183
+ */
184
+ private heldForConfigFile;
185
+ /** What the switch under way holds for the config.json it loads (heldForConfigFile), which load() takes. */
186
+ private switchHolds;
146
187
  private deriveZRouterUrl;
147
188
  /** The route that runs, as notices name it: `provider/model` with every override applied. */
148
189
  private describeRoute;
@@ -185,6 +226,106 @@ export declare class ConfigStore {
185
226
  */
186
227
  private clearMovedClaudeDefault;
187
228
  private applyEnvOverrides;
229
+ /**
230
+ * Whether the permission profile this process runs under now limits the agent (config/profile_limits.ts), decided as a
231
+ * reload decides whether to keep the settings ZTC started with: startup asks it once the profile is known.
232
+ */
233
+ permissionProfileLimitsAgent(): boolean;
234
+ /** Whether the permission profile this process runs under now limits the agent, as get() resolves it. */
235
+ private profileLimitsAgentNow;
236
+ /**
237
+ * Whether this process holds what could widen its permission profile as it started (FROZEN_UNDER_LIMITS), taking no
238
+ * config.json edit to it on a reload: under a profile that limits the agent, and whenever its host pinned its
239
+ * permission settings (ZTC_PERMISSION_PROFILE_PINNED), whether or not that profile limits the agent.
240
+ */
241
+ private holdsWhatCouldWiden;
242
+ /**
243
+ * Pin the permission settings this session holds now, its startup done, as its only ones where its host asked for that
244
+ * (ZTC_PERMISSION_PROFILE_PINNED; config/permission_pin.ts): the permission profile (the launch's --permission-profile,
245
+ * a hosted thread's, or the one config.json saves) with its definition, the sandbox settings and the tool permissions,
246
+ * as get() resolves them now. From then on get() holds them whatever another layer says, every change of them is
247
+ * refused naming the variable, and nothing ends the pin: the variable is read here, once. Without it, nothing changes.
248
+ * The profile's relative file roots are resolved here against the folder the session started in (process.cwd(), which
249
+ * --cwd chose), its mounted workspace, and get() holds them so: the agent's file tools and the OS sandbox of its
250
+ * commands resolve a relative root against the folder the agent works in, which a controller's /cd moves.
251
+ * A ZTC started again in place in a pinned one's stead is handed what that one's pin was taken from: where its own
252
+ * differs (another process edited config.json, or the host's thread, after the restart's check, while this ZTC was
253
+ * still to read them), it throws PermissionPinChangedError, and its caller doesn't start. Where the profile it would
254
+ * pin limits nothing (trusted, the default), or lets the agent's commands run outside an OS sandbox, it throws
255
+ * PermissionPinUnlimitedError, and its caller doesn't start either.
256
+ */
257
+ pinStartupPermissions(): void;
258
+ /** Whether this session's host pinned its permission profile and sandbox (pinStartupPermissions). */
259
+ permissionsPinned(): boolean;
260
+ /**
261
+ * The folder the session started in, where its host's pin holds the permission profile's relative roots, or undefined
262
+ * without the pin: a ZTC started again in place starts there, as it pins those roots at the folder it starts in.
263
+ */
264
+ permissionPinFolder(): string | undefined;
265
+ /**
266
+ * What a ZTC started again in place in this one's stead is handed under the host's pin, so it pins what this one does
267
+ * or doesn't start (pinStartupPermissions); nothing without the pin.
268
+ */
269
+ permissionPinRestartEnv(): Record<string, string>;
270
+ /**
271
+ * Why a change of this session's permission profile, sandbox or tool permissions is refused, or undefined when it may
272
+ * go: its host pinned them (ZTC_PERMISSION_PROFILE_PINNED). The message names the variable and nothing of the profile.
273
+ */
274
+ permissionPinRefusal(): string | undefined;
275
+ /**
276
+ * The permission settings the host's pin holds, over every other layer of the settings (composeConfig): copies, so no
277
+ * caller changes the pin through what get() returns. The pinned profile's definition replaces the one PROFILES holds
278
+ * under its id: by default as the pin holds it for the agent, its relative roots those of the folder the session started
279
+ * in; AS_DEFINED, as config.json (or ZTC, for a built-in one) defines it, which a write of the same settings may name.
280
+ */
281
+ private pinnedPermissionLayer;
282
+ /**
283
+ * Refuse KEY = VALUE where the host pinned this session's permission settings (permissionPin) and KEY is one of them
284
+ * (PINNED_PERMISSION_SETTINGS): another value than the pin holds throws PermissionsPinnedError, naming the variable.
285
+ * True when the pin holds KEY, so the caller writes nothing: what the pin holds is never saved as the person's choice,
286
+ * nor kept in a layer of the session's own.
287
+ */
288
+ private refusePinnedPermissionChange;
289
+ /**
290
+ * The permission settings this session would hold on SAVED, the config.json a switch to another config profile's
291
+ * folder loads (or HOLDS, what this process held there), with the launch's permission profile it keeps (KEPT): its
292
+ * session settings go with the old folder.
293
+ */
294
+ private permissionsHeldOn;
295
+ /**
296
+ * After a reload under a profile that limits the agent: put back each setting of FROZEN_UNDER_LIMITS as this process
297
+ * held it (HELD), keep what the file said for save() (frozenFileValues), and say once which edit was ignored.
298
+ */
299
+ private keepFrozenSettings;
300
+ /**
301
+ * What save() writes for KEY, a setting of FROZEN_UNDER_LIMITS that this process holds as it started, kept in
302
+ * frozenFileValues while it is not what this process holds: this process's own change to it since it last read or
303
+ * wrote config.json (from savedBaseConfig, the setting as it held it then, to the setting as it holds it now) applied
304
+ * over config.json's value then (savedBase), field by field within a group of settings (mergeSettingValue). So a change
305
+ * of its own to one field of the tool permissions or the sandbox never writes back, from what it holds, a field another
306
+ * ZTC changed, and where it changed nothing config.json's value is written back as it is.
307
+ */
308
+ private noteFrozenValueToSave;
309
+ /**
310
+ * KEY, set by this process itself: a setting of FROZEN_UNDER_LIMITS is saved as its change over config.json's value
311
+ * (noteFrozenValueToSave), also once the profile no longer limits the agent, until this process reads the profile
312
+ * again, since it still holds the setting as it started. Where it read the setting from config.json, as it does under
313
+ * a profile that limits nothing, that is its own value.
314
+ */
315
+ private noteOwnSetting;
316
+ /**
317
+ * Whether the next load takes the settings of FROZEN_UNDER_LIMITS as this process holds them (see keepFrozenSettings):
318
+ * a reload of the same config.json under a profile that limits the agent, or where the host pinned the permission
319
+ * settings (holdsWhatCouldWiden).
320
+ */
321
+ private reloadHoldsFrozenSettings;
322
+ /** The settings of FROZEN_UNDER_LIMITS as this process holds them now: a copy of its own. */
323
+ private frozenSettingsAsHeld;
324
+ /**
325
+ * Take SAVED as the settings this process last read or wrote (savedBase), and HELD, by default its settings as it
326
+ * holds them now, as what it held then (savedBaseConfig).
327
+ */
328
+ private noteSavedBase;
188
329
  load(force?: boolean, options?: ConfigLoadOptions): Promise<ZTCConfig>;
189
330
  /**
190
331
  * Load the profile again when another ZTC on it saved its settings, or a Router login or logout, since this one
@@ -193,6 +334,22 @@ export declare class ConfigStore {
193
334
  * changed while it reads still counts, and a save waits for it (see withSettingsLock). True when it loaded.
194
335
  */
195
336
  refreshIfChangedElsewhere(): Promise<boolean>;
337
+ /**
338
+ * Load the profile again as refreshIfChangedElsewhere does: where its files' stamps (inode, size, modification time)
339
+ * changed since this process last read or wrote them, or, WHATEVER_THE_STAMPS, in any case. True when it loaded.
340
+ */
341
+ private readSettingsAgain;
342
+ /**
343
+ * What a ZTC started again in place (a hot restart: this ZTC again, resuming its session) would take from config.json
344
+ * that this one, under a permission profile that limits the agent, does not (FROZEN_UNDER_LIMITS): an edit to its
345
+ * hooks, MCP servers, profiles, tool permissions, sandbox or extension roots made since it started. config.json is read
346
+ * now, whatever its stamp says, so an edit made since the last reload counts, and so does one another process made in
347
+ * place that kept the file's inode, size and modification time, which its stamp doesn't tell apart from no edit (the
348
+ * reviewer's restart probe, 2026-11-22). Empty under a profile that limits nothing (unless the host pinned the
349
+ * permission settings, under which a reload holds them all the same), and when config.json holds what this ZTC does. A
350
+ * config.json that can't be read again counts as such an edit, and says why.
351
+ */
352
+ listSettingsARestartWouldTake(): Promise<string[]>;
196
353
  /**
197
354
  * Run `work` (a save, or a read of another ZTC's save) after the one before it ends, so neither writes the profile
198
355
  * from settings the other is replacing.
@@ -233,6 +390,15 @@ export declare class ConfigStore {
233
390
  * Account registrations retain their credential paths; account homes are not cloned.
234
391
  */
235
392
  duplicateProfile(requestedName: string, source?: string, activate?: () => void | Promise<void>): Promise<string>;
393
+ /**
394
+ * The launch overrides a switch to another config profile's folder keeps: the permission profile `--permission-profile`
395
+ * named, which holds the agent to it and to the OS sandbox it requires, so no switch (the person's /profile, a
396
+ * controller's or a relayed one, /profile create and duplicate, the settings panel's picker) drops them. No other launch
397
+ * flag sets the sandbox. The launch's route and effort (--provider, --model, --auth-mode, --router-url, --effort) go with
398
+ * the config profile they were given for, as before: another one keeps its own routes and the keys and sign-ins they
399
+ * need, and a route limits nothing the agent does.
400
+ */
401
+ private launchOverridesKeptAcrossProfiles;
236
402
  /** Load a profile in this process; restore the old view if runtime activation fails. */
237
403
  switchProfile(name: string, activate: () => void | Promise<void>): Promise<void>;
238
404
  /**
@@ -243,7 +409,14 @@ export declare class ConfigStore {
243
409
  save(): Promise<void>;
244
410
  /** save()'s write of this process's settings, merged with another ZTC's newer save of them. */
245
411
  private writeSettings;
246
- /** Clear the active profile's saved settings and reset this process's settings view. */
412
+ /**
413
+ * Clear the active profile's saved settings and reset this process's settings view. The permission profile this
414
+ * process's launch named (`--permission-profile`) is kept, as a config-profile switch keeps it: the config.json a reset
415
+ * leaves defines the built-in permission profiles alone, so a reset that would leave it undefined there (one only
416
+ * config.json defines), or, where it limits the agent, defined otherwise (a built-in one config.json redefines), is
417
+ * refused before anything is removed. Its other launch flags go, as before. Under the host's pin of the permission
418
+ * settings (ZTC_PERMISSION_PROFILE_PINNED), every reset is refused.
419
+ */
247
420
  factoryReset(): Promise<void>;
248
421
  get(): ZTCConfig;
249
422
  /**
@@ -257,6 +430,12 @@ export declare class ConfigStore {
257
430
  getMaxTokensSource(): string;
258
431
  getConfigScope(): ZTCConfigScope;
259
432
  setConfigScope(scope: ZTCConfigScope): void;
433
+ /**
434
+ * Clear the settings this session chose for itself. A hosted thread's settings (applyHostedThreadSettings) are the
435
+ * host's, not the session's choice: its permission profile, sandbox, instructions and route are taken again, so a clear
436
+ * never drops the profile the host runs the thread under. What the host's pin of the permission settings holds
437
+ * (ZTC_PERMISSION_PROFILE_PINNED) outranks every layer, so it holds after a clear as before.
438
+ */
260
439
  clearSessionOverrides(): void;
261
440
  /**
262
441
  * This process's session-scoped settings are a hosted thread's own (its
@@ -265,6 +444,24 @@ export declare class ConfigStore {
265
444
  * route choice (see noteSessionRouteChoice).
266
445
  */
267
446
  markHostedSession(): void;
447
+ /**
448
+ * Take SETTINGS, a hosted thread's (hosted/session_settings.ts), as this session's, as the host's settings rather
449
+ * than a route the person chose (markHostedSession): its provider and model, output limit, instructions, route plan,
450
+ * effort, permission profile and sandbox, through Zerg Router. A session its host pinned (ZTC_MODEL_PINNED) to another
451
+ * route keeps that route, as a resumed session's saved route leaves it (restoreSessionSelection), and so does one whose
452
+ * routing the environment pins (ZTC_LLM_AUTH_MODE) when the thread's route runs another way: the thread's provider
453
+ * and model are not taken, the log says where the thread ran, and the rest of its settings are taken. A session whose
454
+ * host pinned its permission settings (ZTC_PERMISSION_PROFILE_PINNED) refuses a revision that names another permission
455
+ * profile than it started on, with PermissionsPinnedError and nothing taken; the pin holds the profile and sandbox.
456
+ */
457
+ applyHostedThreadSettings(settings: HostedSessionSettings): void;
458
+ /**
459
+ * Why the host's pin of this session's permission settings (ZTC_PERMISSION_PROFILE_PINNED) refuses SETTINGS, a hosted
460
+ * thread's later revision, or undefined when it doesn't: a revision names the permission profile the session started on
461
+ * (the thread's then, else the pinned one) or nothing of it is taken. A caller asks before it changes anything, so a
462
+ * refused revision leaves nothing to roll back; the message names the variable and nothing of the profile.
463
+ */
464
+ hostedRevisionPinRefusal(settings: HostedSessionSettings): string | undefined;
268
465
  withConfigScope<T>(scope: ZTCConfigScope, fn: () => T | Promise<T>): Promise<T>;
269
466
  /**
270
467
  * Setting a route in the settings (/provider, /model, /settings, /config) chooses this pane's route too, so it
@@ -305,7 +502,11 @@ export declare class ConfigStore {
305
502
  hasApiKey(): boolean;
306
503
  /** The name Router gave this device at the profile's Router login, when the login kept one (the launch card shows it). */
307
504
  getRouterDeviceName(): string | undefined;
308
- /** Router login state for the configured Router origin; never contacts Router. */
505
+ /**
506
+ * Router login state for the configured Router origin; never contacts Router. Where the host's Router runtime grant
507
+ * serves that Router, Router is reached as on a current sign-in, whatever the profile holds: 'signed_in', so nothing
508
+ * asks for a ZergAI login there (getHostRouterGrantOrigin says it is the grant).
509
+ */
309
510
  getRouterSessionStatus(): RouterSessionStatus;
310
511
  /**
311
512
  * True when this machine holds a real credential for a local provider: an
@@ -372,6 +573,17 @@ export declare class ConfigStore {
372
573
  * is, so the next source is named, as resolveApiKey uses it.
373
574
  */
374
575
  getApiKeySource(provider?: string): ApiKeySource;
576
+ /**
577
+ * Every credential this profile holds for ZTC to infer or sign in with, by value: what each variable a profile names
578
+ * as a provider's key holds (apiKeyEnv), each key saved in ZTC (apiKeys, the custom endpoint's, the legacy single
579
+ * slot), saved or for this session, the hosted native Messages route's bearer (nativeAnthropicMessagesRouter, its only
580
+ * credential), each header value the custom endpoint is sent with every request (Azure takes its key as api-key), the
581
+ * ZergAI login's token, and the Router sign-in's key as router-auth.json holds it now, expired or not. What shows ZTC's
582
+ * output to someone who is not its user (a read-only observer of the mirror) withholds them (a value too short to be
583
+ * a credential, as an X-Org header's, only where it is long enough: liveObserverSecrets). Reading them sends nothing
584
+ * and changes nothing a request or a subprocess is given.
585
+ */
586
+ listHeldCredentials(): string[];
375
587
  /** The environment variable named as this provider's key, if any. */
376
588
  getApiKeyEnv(provider: string): string | undefined;
377
589
  setApiKey(key: string, provider?: string): void;
@@ -400,6 +612,8 @@ export declare class ConfigStore {
400
612
  * an explicit undefined, so the configured setting applies again.
401
613
  */
402
614
  setCliOverride<K extends keyof Pick<ZTCConfig, 'provider' | 'model' | 'codexEffort' | 'authMode' | 'zergProxyUrl' | 'permissionProfile'>>(key: K, value: Pick<ZTCConfig, 'provider' | 'model' | 'codexEffort' | 'authMode' | 'zergProxyUrl' | 'permissionProfile'>[K] | undefined): void;
615
+ /** The permission profile this process's launch named (`--permission-profile`), which a switch and a reset keep. */
616
+ getLaunchPermissionProfile(): string | undefined;
403
617
  /** This process's own launch overrides of the route (`--provider`, `--model`, `--auth-mode`), as they stand. */
404
618
  getLaunchOverrides(): Partial<Pick<ZTCConfig, 'provider' | 'model' | 'authMode'>>;
405
619
  /**
@@ -589,6 +803,10 @@ export declare class ConfigStore {
589
803
  getOpenAICompatibleBaseUrl(): string | undefined;
590
804
  setOpenAICompatibleBaseUrl(url: string | undefined): void;
591
805
  getAuthMode(): ZTCAuthMode;
806
+ /**
807
+ * Set the routing, as /config routing, the settings panel's Routing row and the mirror's routing setting do. One
808
+ * other than the routing the environment pins (ZTC_LLM_AUTH_MODE) is refused, and nothing is saved.
809
+ */
592
810
  setAuthMode(mode: ZTCAuthMode): void;
593
811
  /** The active permission-profile id, defaulting to `'trusted'`. */
594
812
  getActivePermissionProfileId(): string;
@@ -648,7 +866,9 @@ export declare class ConfigStore {
648
866
  getRouterSignInOrigin(): string | undefined;
649
867
  /**
650
868
  * The person's own Zerg Router credential: this profile's Router sign-in (a CLI device key), while it is valid. The
651
- * legacy platform login is not one: it is the platform's, scoped to its /api/zrouter proxy.
869
+ * legacy platform login is not one: it is the platform's, scoped to its /api/zrouter proxy. On the Router the host
870
+ * claimed for its Router runtime grant, the grant wins, usable or not, and the sign-in is no credential of this
871
+ * process's there.
652
872
  */
653
873
  getPersonalRouterCredential(): {
654
874
  origin: string;
@@ -678,12 +898,34 @@ export declare class ConfigStore {
678
898
  * The ZergAI platform login, for `destination` only when that is the platform's own Router proxy
679
899
  * (`<API base>/api/zrouter`), the one place the platform issued it for. Any other Router, Zerg Router's own origin
680
900
  * or one a profile or ZERG_PROXY_URL names, gets nothing. ZTC's chat route, its Router catalog and simulation memory
681
- * all take the platform token from here.
901
+ * all take the platform token from here. A login the environment handed over (ZTC_AUTH_TOKEN) goes there only when
902
+ * someone named that platform (platformApiNamed); otherwise it goes nowhere.
682
903
  */
683
904
  getPlatformProxyLogin(destination: string | undefined): {
684
905
  origin: string;
685
906
  token: string;
686
907
  } | undefined;
908
+ /**
909
+ * The host's Router runtime grant (config/router_runtime_grant.ts) for a Router request to DESTINATION, the configured
910
+ * Router by default: when the host named that Router's origin in ZERG_ROUTER_BASE_URL, and DESTINATION is not the
911
+ * platform's own proxy (`<API base>/api/zrouter`), whose credential is the platform's login. Deployment routing: where
912
+ * it is given, it wins over this profile's Router sign-in. Never saved; never shown.
913
+ */
914
+ getHostRouterGrant(destination?: string | undefined): {
915
+ origin: string;
916
+ token: string;
917
+ } | undefined;
918
+ /**
919
+ * The configured Router's origin when the host claimed it for its Router runtime grant (hostClaimsRouter), for what ZTC
920
+ * shows: no sign-in of the profile's is used there, and only a usable grant goes. Never the grant.
921
+ */
922
+ getHostRouterGrantOrigin(): string | undefined;
923
+ /**
924
+ * Whether the host claimed DESTINATION's Router (the configured one by default) for its Router runtime grant, a usable
925
+ * bearer or not (config/router_runtime_grant.ts hostClaimsRouter). There only the grant goes: nothing goes with a
926
+ * grant that is no usable bearer, and nothing in its place.
927
+ */
928
+ hostClaimsRouter(destination?: string | undefined): boolean;
687
929
  getRouterCatalogConnection(destination?: string | undefined): RouterCatalogConnection | undefined;
688
930
  /**
689
931
  * New children use configured routing, not a parent's restored inference route. A new pane reads its provider and
@@ -747,6 +989,12 @@ export declare class ConfigStore {
747
989
  */
748
990
  private hasUsablePooledAccount;
749
991
  getConfigPath(): string;
992
+ /**
993
+ * config.json as it is saved now, parsed, whatever JSON it holds: read again rather than as this process last read it,
994
+ * since another ZTC on the profile may have saved it since (see refreshIfChangedElsewhere). Undefined when it is
995
+ * missing or can't be read.
996
+ */
997
+ readSavedSettings(): Promise<unknown>;
750
998
  get locationLabel(): string;
751
999
  getMaxIterations(): number;
752
1000
  getAutoContinue(): boolean;
@@ -799,10 +1047,92 @@ export declare class ConfigStore {
799
1047
  hasExplicitModelOverride(): boolean;
800
1048
  /** The model this pane runs on: its own route's, else the configured one (launch flags, session, saved). */
801
1049
  getModel(): string;
1050
+ /**
1051
+ * The routing PROVIDER runs on once chosen, as the resolver decides it: direct for a local subscription, and for
1052
+ * Morph on a key this machine holds (APIKEY, else CFG's), which go to the provider itself; otherwise CFG's routing,
1053
+ * ZTC_LLM_AUTH_MODE first. ZTC_LLM_AUTH_MODE=zrouter keeps Morph on Zerg Router wherever its key comes from (a saved
1054
+ * key, MORPH_API_KEY, one /config key gives it later): the pin holds every route that can run through Router there
1055
+ * (config/model_pin.ts).
1056
+ */
1057
+ private routingOf;
1058
+ /**
1059
+ * Why moving this session to PROVIDER/MODEL (either may be left out: it stays as it is) is refused, or undefined when
1060
+ * it may move (config/model_pin.ts): another route than the one its host pinned (ZTC_MODEL_PINNED), else a provider
1061
+ * that runs off the routing the environment pins (ZTC_LLM_AUTH_MODE), such as a local login under zrouter.
1062
+ */
1063
+ routeChangeRefusal(provider?: string, model?: string): string | undefined;
1064
+ /**
1065
+ * Why a route on PROVIDER is refused by the routing the environment pins (ZTC_LLM_AUTH_MODE), or undefined when that
1066
+ * provider runs on it: for a pane whose own route only its routing binds (config/model_pin.ts).
1067
+ */
1068
+ routingRefusal(provider: string): string | undefined;
1069
+ /**
1070
+ * Pin the route this session started on, its launch flags and environment applied, as its only route when its host
1071
+ * asked for that (ZTC_MODEL_PINNED; config/model_pin.ts): from then on the provider, model and routing read as they
1072
+ * are now, and a change to another is refused with the pinned route named. Without the pin, nothing changes.
1073
+ */
1074
+ pinStartupRoute(): void;
1075
+ /** The routing a pinned session started on (pinStartupRoute), or undefined when no host pinned it. */
1076
+ private pinnedAuthMode;
1077
+ /**
1078
+ * Refuses KEY = VALUE in a pinned session when it would move the session off its route: another provider or model,
1079
+ * or routing the environment doesn't already decide that differs from the routing it started on.
1080
+ */
1081
+ private refuseRouteChange;
802
1082
  /** The model launch flags, session settings and the saved profile name, without this pane's own route. */
803
1083
  private configuredModel;
1084
+ /** Whether ZTC holds a ZergAI platform login it may send to the platform API getApiBaseUrl() returns (getAuthToken). */
804
1085
  isAuthenticated(): boolean;
1086
+ /**
1087
+ * The ZergAI platform login, for the platform API getApiBaseUrl() returns: the account check, /zerg, the zerg tools,
1088
+ * zerg mode and the platform's legacy LLM endpoint send it as `Authorization: Token`. Undefined when there is none, and
1089
+ * when there is one ZTC sends to no platform API (platformLoginRefusal): a Zerg Router credential, or one the
1090
+ * environment handed over in ZTC_AUTH_TOKEN with no platform API named for it. The platform's own Router proxy gets its
1091
+ * login from getPlatformProxyLogin.
1092
+ */
805
1093
  getAuthToken(): string | undefined;
1094
+ /**
1095
+ * Why ZTC sends the platform login TOKEN to no platform API, or undefined when it goes to getApiBaseUrl(): a Zerg Router
1096
+ * credential goes to none, named or not (holdsRouterCredential); a login the environment handed over (ZTC_AUTH_TOKEN)
1097
+ * goes only to a platform API someone named (unnamedEnvironmentLogin). A login config.json holds (an older release's
1098
+ * /auth login) is the person's own, for the API they signed in to.
1099
+ */
1100
+ private platformLoginRefusal;
1101
+ /** Whether TOKEN is the login the environment handed over (ZTC_AUTH_TOKEN) and no platform API is named for it. */
1102
+ private unnamedEnvironmentLogin;
1103
+ /**
1104
+ * Whether TOKEN (blanks around it aside) is a Zerg Router credential: one of Router's own shapes
1105
+ * (looksLikeRouterCredential), or a value ZTC holds as a Router credential too: the host's Router runtime grant, the
1106
+ * required Router's service credential (ZERG_AUTH_TOKEN), the profile's Router sign-in (router-auth.json, as
1107
+ * router-auth.json holds it now).
1108
+ */
1109
+ private holdsRouterCredential;
1110
+ /**
1111
+ * Whether someone named the ZergAI platform API getApiBaseUrl() returns, so that a platform login the environment
1112
+ * handed over may go there:
1113
+ *
1114
+ * - ZTC_API_BASE_URL;
1115
+ * - a colony's COLONY_PORT (its API is on COLONY_PORT + 1);
1116
+ * - an apiEnvironment the person chose: one of API_ENDPOINTS' names, saved in config.json or set in this process (the
1117
+ * settings' API environment), and not one the environment applied over it (a null or empty one leaves ZTC's own
1118
+ * default, which nobody chose);
1119
+ * - that API's own Router proxy (`<API>/api/zrouter`) named in ZERG_PROXY_URL by the launcher, as the ZergAI platform
1120
+ * launches its zergs (ZERG_PROXY_URL=https://api.zergai.com/api/zrouter with the zerg's platform token).
1121
+ *
1122
+ * Nothing else names one: not ZTC's built-in default (https://api.zergai.com); not ZTC_API_ENVIRONMENT or
1123
+ * ZERG_DEPLOY_TIER, which zerg/docker-entrypoint.sh sets for every zerg (ZERG_DEPLOY_TIER=local by default, so
1124
+ * http://localhost:8000), ZergCloud's on a Router credential among them; not a ZERG_PROXY_URL that entrypoint filled in
1125
+ * itself from the tier or a Router address, as it says in PROXY_URL_SOURCE_ENV (a dev or prod tier gets its platform's
1126
+ * proxy whatever token the launcher hands over); not a Router address (ZERG_ROUTER_BASE_URL, --router-url, a saved
1127
+ * Zerg Router URL), which names a Router and no platform API.
1128
+ */
1129
+ private platformApiNamed;
1130
+ /**
1131
+ * Why there is no platform login to send, for /zerg, the zerg tools and zerg mode to say (never its value), or
1132
+ * undefined when there is one, or none was handed over or saved. It names what holds the login: ZTC_AUTH_TOKEN for
1133
+ * the one the environment handed over, config.json for one saved there (only a Zerg Router credential is refused so).
1134
+ */
1135
+ getPlatformLoginRefusal(): string | undefined;
806
1136
  getActiveWorkspace(): {
807
1137
  id: number;
808
1138
  name: string;