@zergai/ztc 0.4.0-beta.1 → 0.5.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 (718) hide show
  1. package/README.md +398 -45
  2. package/RUST_THIRD_PARTY_LICENSES.txt +1080 -822
  3. package/THIRD_PARTY_NOTICES.md +273 -12
  4. package/bin/zmux-darwin-arm64 +0 -0
  5. package/bin/ztc-audio-darwin-arm64 +0 -0
  6. package/bin/ztc-capture-darwin-arm64 +0 -0
  7. package/bin/ztc-computer-darwin-arm64 +0 -0
  8. package/bin/ztc-llm-darwin-arm64 +0 -0
  9. package/bin/ztc-tts-darwin-arm64 +0 -0
  10. package/bin/ztc-tui-darwin-arm64 +0 -0
  11. package/bin/ztc-zlicky-overlay-darwin-arm64 +0 -0
  12. package/bin/zterm-darwin-arm64 +0 -0
  13. package/dist/App.js +1206 -209
  14. package/dist/agent/agent.d.ts +74 -8
  15. package/dist/agent/agent.js +1073 -184
  16. package/dist/agent/backends/account_rotation.d.ts +4 -0
  17. package/dist/agent/backends/account_rotation.js +8 -2
  18. package/dist/agent/backends/anthropic.d.ts +13 -0
  19. package/dist/agent/backends/anthropic.js +169 -28
  20. package/dist/agent/backends/claude_cli.js +18 -8
  21. package/dist/agent/backends/codex_app_server.d.ts +1 -0
  22. package/dist/agent/backends/codex_app_server.js +55 -3
  23. package/dist/agent/backends/codex_auth.d.ts +1 -0
  24. package/dist/agent/backends/codex_auth.js +67 -13
  25. package/dist/agent/backends/codex_buffered_recovery.d.ts +27 -0
  26. package/dist/agent/backends/codex_buffered_recovery.js +293 -0
  27. package/dist/agent/backends/gemini.js +3 -1
  28. package/dist/agent/backends/http_error.d.ts +26 -0
  29. package/dist/agent/backends/http_error.js +221 -0
  30. package/dist/agent/backends/index.d.ts +9 -2
  31. package/dist/agent/backends/index.js +22 -2
  32. package/dist/agent/backends/openai.d.ts +0 -6
  33. package/dist/agent/backends/openai.js +5 -2
  34. package/dist/agent/backends/openai_compatible.d.ts +5 -4
  35. package/dist/agent/backends/openai_compatible.js +26 -19
  36. package/dist/agent/backends/openai_responses.d.ts +8 -3
  37. package/dist/agent/backends/openai_responses.js +77 -33
  38. package/dist/agent/backends/provider_ids.d.ts +1 -0
  39. package/dist/agent/backends/provider_ids.js +4 -0
  40. package/dist/agent/backends/request_metrics.js +12 -2
  41. package/dist/agent/backends/types.d.ts +109 -6
  42. package/dist/agent/backends/types.js +5 -1
  43. package/dist/agent/backends/zrouter_stream.d.ts +6 -1
  44. package/dist/agent/backends/zrouter_stream.js +160 -42
  45. package/dist/agent/background_registry.d.ts +2 -0
  46. package/dist/agent/background_registry.js +1 -0
  47. package/dist/agent/claim_observation.d.ts +6 -0
  48. package/dist/agent/claim_observation.js +54 -0
  49. package/dist/agent/commands/accounts.js +46 -177
  50. package/dist/agent/commands/attention.d.ts +2 -0
  51. package/dist/agent/commands/attention.js +67 -0
  52. package/dist/agent/commands/auth.js +18 -2
  53. package/dist/agent/commands/board.d.ts +2 -0
  54. package/dist/agent/commands/board.js +169 -0
  55. package/dist/agent/commands/clipboard.js +50 -1
  56. package/dist/agent/commands/compact.js +21 -13
  57. package/dist/agent/commands/config.js +4 -1
  58. package/dist/agent/commands/context.js +6 -1
  59. package/dist/agent/commands/desktop.d.ts +2 -0
  60. package/dist/agent/commands/desktop.js +29 -0
  61. package/dist/agent/commands/effort.js +14 -6
  62. package/dist/agent/commands/environment.d.ts +3 -0
  63. package/dist/agent/commands/environment.js +109 -0
  64. package/dist/agent/commands/evidence.d.ts +2 -0
  65. package/dist/agent/commands/evidence.js +9 -0
  66. package/dist/agent/commands/fork.js +4 -3
  67. package/dist/agent/commands/goal.d.ts +33 -1
  68. package/dist/agent/commands/goal.js +174 -14
  69. package/dist/agent/commands/goal_exit.d.ts +36 -0
  70. package/dist/agent/commands/goal_exit.js +120 -0
  71. package/dist/agent/commands/help.js +3 -1
  72. package/dist/agent/commands/history.js +3 -1
  73. package/dist/agent/commands/inbox.d.ts +2 -0
  74. package/dist/agent/commands/inbox.js +148 -0
  75. package/dist/agent/commands/index.js +16 -1
  76. package/dist/agent/commands/input_mode.js +8 -6
  77. package/dist/agent/commands/job.d.ts +2 -0
  78. package/dist/agent/commands/job.js +93 -0
  79. package/dist/agent/commands/keybindings.js +4 -1
  80. package/dist/agent/commands/label.d.ts +2 -0
  81. package/dist/agent/commands/label.js +77 -0
  82. package/dist/agent/commands/layout.d.ts +2 -0
  83. package/dist/agent/commands/layout.js +20 -0
  84. package/dist/agent/commands/mirror.js +16 -1
  85. package/dist/agent/commands/model.js +12 -2
  86. package/dist/agent/commands/permissions.d.ts +3 -1
  87. package/dist/agent/commands/permissions.js +79 -89
  88. package/dist/agent/commands/plan.js +5 -15
  89. package/dist/agent/commands/profile.js +21 -2
  90. package/dist/agent/commands/provider_selection.js +20 -1
  91. package/dist/agent/commands/rename.js +1 -1
  92. package/dist/agent/commands/resources.d.ts +2 -0
  93. package/dist/agent/commands/resources.js +67 -0
  94. package/dist/agent/commands/rewind.d.ts +3 -0
  95. package/dist/agent/commands/rewind.js +16 -0
  96. package/dist/agent/commands/runbooks.d.ts +2 -0
  97. package/dist/agent/commands/runbooks.js +73 -0
  98. package/dist/agent/commands/runbooks_lazy.d.ts +2 -0
  99. package/dist/agent/commands/runbooks_lazy.js +8 -0
  100. package/dist/agent/commands/sessions.d.ts +1 -1
  101. package/dist/agent/commands/sessions.js +33 -5
  102. package/dist/agent/commands/settings.js +185 -39
  103. package/dist/agent/commands/setup.d.ts +2 -0
  104. package/dist/agent/commands/setup.js +78 -0
  105. package/dist/agent/commands/share.d.ts +2 -0
  106. package/dist/agent/commands/share.js +64 -0
  107. package/dist/agent/commands/status.js +14 -2
  108. package/dist/agent/commands/types.d.ts +99 -6
  109. package/dist/agent/commands/update.js +8 -0
  110. package/dist/agent/commands/usage.d.ts +2 -0
  111. package/dist/agent/commands/usage.js +8 -0
  112. package/dist/agent/factory.d.ts +11 -0
  113. package/dist/agent/factory.js +113 -88
  114. package/dist/agent/loop_policy.d.ts +6 -3
  115. package/dist/agent/loop_policy.js +12 -3
  116. package/dist/agent/measurement_guidance.d.ts +2 -0
  117. package/dist/agent/measurement_guidance.js +5 -0
  118. package/dist/agent/request_encoder.d.ts +8 -1
  119. package/dist/agent/request_encoder.js +95 -23
  120. package/dist/agent/runtime/benchmark_comparison.d.ts +30 -0
  121. package/dist/agent/runtime/benchmark_comparison.js +94 -0
  122. package/dist/agent/runtime/benchmark_contract.d.ts +48 -0
  123. package/dist/agent/runtime/benchmark_contract.js +90 -0
  124. package/dist/agent/runtime/checked_commands.d.ts +32 -0
  125. package/dist/agent/runtime/checked_commands.js +119 -0
  126. package/dist/agent/runtime/command_execution_policy.d.ts +26 -0
  127. package/dist/agent/runtime/command_execution_policy.js +91 -0
  128. package/dist/agent/runtime/command_jobs.d.ts +36 -18
  129. package/dist/agent/runtime/command_jobs.js +151 -13
  130. package/dist/agent/runtime/command_panes.d.ts +59 -0
  131. package/dist/agent/runtime/command_panes.js +398 -0
  132. package/dist/agent/runtime/command_wait.d.ts +19 -0
  133. package/dist/agent/runtime/command_wait.js +167 -0
  134. package/dist/agent/runtime/cpu_benchmark.d.ts +30 -0
  135. package/dist/agent/runtime/cpu_benchmark.js +126 -0
  136. package/dist/agent/runtime/delegated_evidence.d.ts +26 -0
  137. package/dist/agent/runtime/delegated_evidence.js +80 -0
  138. package/dist/agent/runtime/evidence.d.ts +127 -0
  139. package/dist/agent/runtime/evidence.js +468 -0
  140. package/dist/agent/runtime/execution_context.d.ts +7 -0
  141. package/dist/agent/runtime/execution_context.js +39 -3
  142. package/dist/agent/runtime/json_verifier_recipe.d.ts +8 -0
  143. package/dist/agent/runtime/json_verifier_recipe.js +66 -0
  144. package/dist/agent/runtime/measurements.d.ts +110 -0
  145. package/dist/agent/runtime/measurements.js +317 -0
  146. package/dist/agent/runtime/policy.d.ts +4 -0
  147. package/dist/agent/runtime/policy.js +31 -20
  148. package/dist/agent/runtime/provider_native_evidence.d.ts +20 -0
  149. package/dist/agent/runtime/provider_native_evidence.js +86 -0
  150. package/dist/agent/runtime/recovery.d.ts +2 -0
  151. package/dist/agent/runtime/recovery.js +45 -2
  152. package/dist/agent/runtime/remote_broker_transport.d.ts +10 -0
  153. package/dist/agent/runtime/remote_broker_transport.js +84 -0
  154. package/dist/agent/runtime/remote_deletion_receipts.d.ts +3 -0
  155. package/dist/agent/runtime/remote_deletion_receipts.js +43 -0
  156. package/dist/agent/runtime/remote_journal_replay.d.ts +13 -0
  157. package/dist/agent/runtime/remote_journal_replay.js +233 -0
  158. package/dist/agent/runtime/remote_mutation_journal.d.ts +25 -0
  159. package/dist/agent/runtime/remote_mutation_journal.js +208 -0
  160. package/dist/agent/runtime/remote_resource_endpoint.d.ts +7 -0
  161. package/dist/agent/runtime/remote_resource_endpoint.js +6 -0
  162. package/dist/agent/runtime/remote_resource_errors.d.ts +5 -0
  163. package/dist/agent/runtime/remote_resource_errors.js +9 -0
  164. package/dist/agent/runtime/remote_resource_script.d.ts +2 -0
  165. package/dist/agent/runtime/remote_resource_script.js +1009 -0
  166. package/dist/agent/runtime/remote_resources.d.ts +29 -0
  167. package/dist/agent/runtime/remote_resources.js +160 -0
  168. package/dist/agent/runtime/source_verification.d.ts +12 -0
  169. package/dist/agent/runtime/source_verification.js +210 -0
  170. package/dist/agent/runtime/source_verification_contract.d.ts +75 -0
  171. package/dist/agent/runtime/source_verification_contract.js +203 -0
  172. package/dist/agent/runtime/tool_checkpoints.d.ts +11 -0
  173. package/dist/agent/runtime/tool_checkpoints.js +26 -0
  174. package/dist/agent/runtime/tool_effects.d.ts +5 -0
  175. package/dist/agent/runtime/tool_progress.d.ts +12 -0
  176. package/dist/agent/runtime/tool_progress.js +76 -0
  177. package/dist/agent/runtime/tool_runtime.d.ts +16 -1
  178. package/dist/agent/runtime/tool_runtime.js +204 -10
  179. package/dist/agent/runtime/tracing.d.ts +1 -1
  180. package/dist/agent/runtime/verifier_capture.d.ts +9 -0
  181. package/dist/agent/runtime/verifier_capture.js +100 -0
  182. package/dist/agent/runtime/verifier_contract.d.ts +24 -0
  183. package/dist/agent/runtime/verifier_contract.js +41 -0
  184. package/dist/agent/subagent.d.ts +20 -10
  185. package/dist/agent/subagent.js +266 -29
  186. package/dist/agent/tool_response_directory.d.ts +24 -0
  187. package/dist/agent/tool_response_directory.js +61 -0
  188. package/dist/agent/tool_response_source.d.ts +8 -0
  189. package/dist/agent/tool_response_source.js +49 -0
  190. package/dist/agent/tool_response_store.d.ts +75 -4
  191. package/dist/agent/tool_response_store.js +583 -64
  192. package/dist/agent/tools/ask_user.d.ts +3 -1
  193. package/dist/agent/tools/ask_user.js +30 -11
  194. package/dist/agent/tools/background.js +1 -0
  195. package/dist/agent/tools/benchmark_cpu.d.ts +2 -0
  196. package/dist/agent/tools/benchmark_cpu.js +102 -0
  197. package/dist/agent/tools/compare_benchmarks.d.ts +2 -0
  198. package/dist/agent/tools/compare_benchmarks.js +53 -0
  199. package/dist/agent/tools/deferred.js +1 -0
  200. package/dist/agent/tools/delegate.js +18 -2
  201. package/dist/agent/tools/helper_requirements.d.ts +7 -0
  202. package/dist/agent/tools/helper_requirements.js +19 -0
  203. package/dist/agent/tools/index.d.ts +1 -0
  204. package/dist/agent/tools/index.js +3 -0
  205. package/dist/agent/tools/measurement_report.d.ts +22 -0
  206. package/dist/agent/tools/measurement_report.js +190 -0
  207. package/dist/agent/tools/pane.d.ts +0 -7
  208. package/dist/agent/tools/pane.js +5 -4
  209. package/dist/agent/tools/project_context.d.ts +3 -0
  210. package/dist/agent/tools/project_context.js +45 -0
  211. package/dist/agent/tools/recall_tool_response.d.ts +3 -5
  212. package/dist/agent/tools/recall_tool_response.js +19 -29
  213. package/dist/agent/tools/registry.d.ts +1 -0
  214. package/dist/agent/tools/registry.js +23 -0
  215. package/dist/agent/tools/related_sessions.d.ts +2 -0
  216. package/dist/agent/tools/related_sessions.js +156 -0
  217. package/dist/agent/tools/routine.js +13 -3
  218. package/dist/agent/tools/session_evidence.d.ts +3 -0
  219. package/dist/agent/tools/session_evidence.js +72 -0
  220. package/dist/agent/tools/shell.d.ts +4 -3
  221. package/dist/agent/tools/shell.js +174 -47
  222. package/dist/agent/tools/tool_search.js +3 -2
  223. package/dist/agent/tools/types.d.ts +28 -0
  224. package/dist/agent/tools/verify_artifact.d.ts +2 -0
  225. package/dist/agent/tools/verify_artifact.js +60 -0
  226. package/dist/agent/tools/workflow.js +1 -0
  227. package/dist/app/activity.d.ts +6 -1
  228. package/dist/app/activity.js +81 -12
  229. package/dist/app/agent_runner.d.ts +6 -1
  230. package/dist/app/agent_runner.js +34 -19
  231. package/dist/app/command_context.js +106 -10
  232. package/dist/app/controller.d.ts +15 -4
  233. package/dist/app/controller.js +29 -3
  234. package/dist/app/escape_stop.d.ts +11 -0
  235. package/dist/app/escape_stop.js +15 -0
  236. package/dist/app/liveness.d.ts +6 -4
  237. package/dist/app/liveness.js +13 -3
  238. package/dist/app/model_catalog_cache.d.ts +5 -0
  239. package/dist/app/model_catalog_cache.js +138 -0
  240. package/dist/app/ordered_transcript.js +43 -4
  241. package/dist/app/prompt_turn.d.ts +14 -0
  242. package/dist/app/prompt_turn.js +53 -0
  243. package/dist/app/recap.d.ts +3 -0
  244. package/dist/app/recap.js +9 -3
  245. package/dist/app/restart.d.ts +3 -2
  246. package/dist/app/restart.js +22 -7
  247. package/dist/app/rewind.d.ts +3 -3
  248. package/dist/app/rewind.js +3 -3
  249. package/dist/app/selection_completion.d.ts +17 -2
  250. package/dist/app/selection_completion.js +84 -9
  251. package/dist/app/session_manager.d.ts +38 -6
  252. package/dist/app/session_manager.js +263 -60
  253. package/dist/app/session_messages.d.ts +3 -0
  254. package/dist/app/session_messages.js +60 -0
  255. package/dist/app/task_scope_router.d.ts +20 -0
  256. package/dist/app/task_scope_router.js +173 -0
  257. package/dist/app/transcript_window.d.ts +2 -0
  258. package/dist/app/transcript_window.js +4 -0
  259. package/dist/app/workspace_admission_details.d.ts +3 -0
  260. package/dist/app/workspace_admission_details.js +26 -0
  261. package/dist/app/workspace_layout_controller.d.ts +11 -0
  262. package/dist/app/workspace_layout_controller.js +88 -0
  263. package/dist/app/workspace_monitor.d.ts +1 -0
  264. package/dist/app/workspace_monitor.js +216 -0
  265. package/dist/app/workspace_presets.d.ts +29 -0
  266. package/dist/app/workspace_presets.js +192 -0
  267. package/dist/attention/queue.d.ts +37 -0
  268. package/dist/attention/queue.js +183 -0
  269. package/dist/bench/rf_shared.d.ts +2 -0
  270. package/dist/board/binding.d.ts +42 -0
  271. package/dist/board/binding.js +38 -0
  272. package/dist/board/client.d.ts +42 -0
  273. package/dist/board/client.js +60 -0
  274. package/dist/cli.js +1 -1
  275. package/dist/cli_args.js +19 -17
  276. package/dist/cli_main.js +110 -13
  277. package/dist/cli_ratatui.d.ts +183 -16
  278. package/dist/cli_ratatui.js +3989 -1255
  279. package/dist/components/ActivityLine.d.ts +3 -2
  280. package/dist/components/ActivityLine.js +2 -2
  281. package/dist/components/InputArea.d.ts +19 -1
  282. package/dist/components/InputArea.js +264 -190
  283. package/dist/components/MessageList.d.ts +2 -0
  284. package/dist/components/MessageList.js +3 -1
  285. package/dist/components/SingleMessage.d.ts +2 -0
  286. package/dist/components/SingleMessage.js +4 -2
  287. package/dist/components/StatusBar.d.ts +4 -2
  288. package/dist/components/StatusBar.js +3 -1
  289. package/dist/conductor_branch.js +3 -0
  290. package/dist/config/api_retry.d.ts +6 -1
  291. package/dist/config/api_retry.js +19 -1
  292. package/dist/config/defaults.d.ts +2 -1
  293. package/dist/config/defaults.js +9 -2
  294. package/dist/config/message_display.d.ts +1 -0
  295. package/dist/config/message_display.js +17 -2
  296. package/dist/config/permissions.d.ts +21 -0
  297. package/dist/config/permissions.js +89 -0
  298. package/dist/config/resolved.d.ts +2 -2
  299. package/dist/config/types.d.ts +32 -5
  300. package/dist/config.d.ts +38 -4
  301. package/dist/config.js +290 -42
  302. package/dist/context/project_intelligence.d.ts +44 -0
  303. package/dist/context/project_intelligence.js +246 -0
  304. package/dist/desktop/cli_launch.d.ts +8 -0
  305. package/dist/desktop/cli_launch.js +6 -0
  306. package/dist/desktop/cli_shim.d.ts +8 -0
  307. package/dist/desktop/cli_shim.js +120 -0
  308. package/dist/desktop/runtime.d.ts +16 -0
  309. package/dist/desktop/runtime.js +161 -0
  310. package/dist/desktop/worker_launch.d.ts +7 -0
  311. package/dist/desktop/worker_launch.js +7 -0
  312. package/dist/diagnostics/cargo_mutants_selection.d.ts +27 -0
  313. package/dist/diagnostics/cargo_mutants_selection.js +48 -0
  314. package/dist/diagnostics/native_terminal_benchmark.d.ts +58 -0
  315. package/dist/diagnostics/native_terminal_benchmark.js +1247 -0
  316. package/dist/diagnostics/session_evidence_package.d.ts +40 -0
  317. package/dist/diagnostics/session_evidence_package.js +234 -0
  318. package/dist/diagnostics/session_export.d.ts +93 -0
  319. package/dist/diagnostics/session_export.js +634 -0
  320. package/dist/emulation/tool_adapters.js +48 -18
  321. package/dist/emulation/ztc_addendum.d.ts +1 -0
  322. package/dist/emulation/ztc_addendum.js +13 -12
  323. package/dist/environment/service_runner.d.ts +1 -0
  324. package/dist/environment/service_runner.js +68 -0
  325. package/dist/environment/store.d.ts +120 -0
  326. package/dist/environment/store.js +387 -0
  327. package/dist/events.d.ts +40 -1
  328. package/dist/events.js +10 -17
  329. package/dist/goal_contract.d.ts +25 -0
  330. package/dist/goal_contract.js +44 -0
  331. package/dist/headless.d.ts +31 -0
  332. package/dist/headless.js +578 -70
  333. package/dist/headless_cli.js +8 -0
  334. package/dist/headless_cli_args.d.ts +1 -0
  335. package/dist/headless_cli_args.js +1 -0
  336. package/dist/intake/cli.d.ts +1 -0
  337. package/dist/intake/cli.js +33 -0
  338. package/dist/intake/format.d.ts +2 -0
  339. package/dist/intake/format.js +14 -0
  340. package/dist/intake/notifications.d.ts +16 -0
  341. package/dist/intake/notifications.js +132 -0
  342. package/dist/intake/store.d.ts +56 -0
  343. package/dist/intake/store.js +238 -0
  344. package/dist/library.d.ts +8 -0
  345. package/dist/library.js +19 -10
  346. package/dist/mcp/client.d.ts +1 -0
  347. package/dist/mcp/client.js +20 -0
  348. package/dist/modes/builtin/plan.yaml +2 -2
  349. package/dist/modes/handlers.js +1 -1
  350. package/dist/onboarding/first_run.d.ts +3 -0
  351. package/dist/onboarding/first_run.js +33 -25
  352. package/dist/onboarding/setup.d.ts +32 -0
  353. package/dist/onboarding/setup.js +133 -0
  354. package/dist/onboarding/setup_agent_health.d.ts +17 -0
  355. package/dist/onboarding/setup_agent_health.js +79 -0
  356. package/dist/onboarding/setup_environment.d.ts +66 -0
  357. package/dist/onboarding/setup_environment.js +219 -0
  358. package/dist/onboarding/setup_workspace.d.ts +17 -0
  359. package/dist/onboarding/setup_workspace.js +129 -0
  360. package/dist/optimize/adapters/index.d.ts +4 -1
  361. package/dist/optimize/adapters/index.js +7 -0
  362. package/dist/optimize/adapters/kernelbench.js +14 -5
  363. package/dist/optimize/adapters/popcorn.js +3 -2
  364. package/dist/optimize/adapters/profile_benchmark.js +13 -7
  365. package/dist/optimize/adapters/rfbench.js +25 -14
  366. package/dist/optimize/adapters/types.d.ts +3 -0
  367. package/dist/optimize/adapters/zergpod.js +5 -2
  368. package/dist/optimize/baseline.js +10 -21
  369. package/dist/optimize/branch.js +9 -12
  370. package/dist/optimize/combine.js +2 -3
  371. package/dist/optimize/executor.js +34 -48
  372. package/dist/optimize/measurements.d.ts +55 -0
  373. package/dist/optimize/measurements.js +173 -0
  374. package/dist/optimize/results.d.ts +1 -0
  375. package/dist/optimize/results.js +11 -33
  376. package/dist/optimize/tge.js +2 -1
  377. package/dist/panes/initial_input.d.ts +19 -0
  378. package/dist/panes/initial_input.js +206 -0
  379. package/dist/panes/labels.d.ts +16 -0
  380. package/dist/panes/labels.js +42 -0
  381. package/dist/panes/model_catalog.d.ts +3 -3
  382. package/dist/panes/model_catalog.js +28 -4
  383. package/dist/panes/pane_registry.js +6 -2
  384. package/dist/panes/types.d.ts +3 -0
  385. package/dist/panes/ztc_launch.js +19 -0
  386. package/dist/plugin/optimization.d.ts +2 -0
  387. package/dist/plugin/optimization.js +1 -0
  388. package/dist/plugin/runtime.d.ts +2 -0
  389. package/dist/plugin/simulation.d.ts +6 -1
  390. package/dist/plugin/simulation_contract.d.ts +836 -1
  391. package/dist/plugin/simulation_documents.d.ts +22 -0
  392. package/dist/plugin/simulation_documents.js +1 -0
  393. package/dist/plugin/simulation_interventions.d.ts +103 -0
  394. package/dist/plugin/simulation_interventions.js +1 -0
  395. package/dist/plugin/simulation_living.d.ts +1 -0
  396. package/dist/plugin/simulation_living.js +3 -0
  397. package/dist/plugin/simulation_meetings.d.ts +121 -0
  398. package/dist/plugin/simulation_meetings.js +1 -0
  399. package/dist/plugin/simulation_story_review.d.ts +111 -0
  400. package/dist/plugin/simulation_story_review.js +1 -0
  401. package/dist/plugin/simulation_storyteller.d.ts +91 -0
  402. package/dist/plugin/simulation_storyteller.js +1 -0
  403. package/dist/plugin/simulation_structured.d.ts +2 -0
  404. package/dist/plugin/simulation_structured.js +2 -0
  405. package/dist/plugin/simulation_toolkit.d.ts +21 -0
  406. package/dist/plugin/simulation_toolkit.js +24 -0
  407. package/dist/prompts/tool_delegate_task.j2 +1 -1
  408. package/dist/remote-broker/Dockerfile +10 -0
  409. package/dist/remote-broker/archive.py +1227 -0
  410. package/dist/remote-broker/cutover.py +761 -0
  411. package/dist/remote-broker/requirements.txt +5 -0
  412. package/dist/remote-broker/resources.json +6 -0
  413. package/dist/remote-broker/resources.write-staging.example.json +18 -0
  414. package/dist/remote-broker/retained.py +686 -0
  415. package/dist/remote-broker/retained_cleanup.py +550 -0
  416. package/dist/remote-broker/server.py +648 -0
  417. package/dist/remote-broker/worker.py +1007 -0
  418. package/dist/router_auth.d.ts +31 -0
  419. package/dist/router_auth.js +155 -9
  420. package/dist/runbooks/catalog.d.ts +3 -0
  421. package/dist/runbooks/catalog.js +26 -0
  422. package/dist/runbooks/library.d.ts +11 -0
  423. package/dist/runbooks/library.js +95 -0
  424. package/dist/runbooks/package.d.ts +43 -0
  425. package/dist/runbooks/package.js +102 -0
  426. package/dist/session.d.ts +65 -13
  427. package/dist/session.js +548 -43
  428. package/dist/session_handoff.d.ts +25 -0
  429. package/dist/session_handoff.js +322 -0
  430. package/dist/session_handoff_contract.d.ts +89 -0
  431. package/dist/session_handoff_contract.js +179 -0
  432. package/dist/session_media.d.ts +41 -0
  433. package/dist/session_media.js +357 -0
  434. package/dist/session_ownership.d.ts +16 -0
  435. package/dist/session_ownership.js +221 -0
  436. package/dist/session_public.d.ts +10 -2
  437. package/dist/session_public.js +6 -1
  438. package/dist/simulation/dynamic_history.d.ts +42 -0
  439. package/dist/simulation/dynamic_history.js +173 -0
  440. package/dist/simulation/engines/swarm/pane_manager.js +7 -6
  441. package/dist/simulation/inference.d.ts +3 -1
  442. package/dist/simulation/inference.js +19 -1
  443. package/dist/simulation/intervention_generation.d.ts +27 -0
  444. package/dist/simulation/intervention_generation.js +246 -0
  445. package/dist/simulation/intervention_material.d.ts +4 -0
  446. package/dist/simulation/intervention_material.js +81 -0
  447. package/dist/simulation/living/context.d.ts +3130 -0
  448. package/dist/simulation/living/context.js +944 -0
  449. package/dist/simulation/living/definer.d.ts +12 -0
  450. package/dist/simulation/living/definer.js +223 -0
  451. package/dist/simulation/living/definition.d.ts +257 -0
  452. package/dist/simulation/living/definition.js +341 -0
  453. package/dist/simulation/living/frame.d.ts +259 -0
  454. package/dist/simulation/living/frame.js +223 -0
  455. package/dist/simulation/living/identifiers.d.ts +2 -0
  456. package/dist/simulation/living/identifiers.js +12 -0
  457. package/dist/simulation/living/index.d.ts +15 -0
  458. package/dist/simulation/living/index.js +15 -0
  459. package/dist/simulation/living/inference.d.ts +219 -0
  460. package/dist/simulation/living/inference.js +576 -0
  461. package/dist/simulation/living/mechanics.d.ts +54 -0
  462. package/dist/simulation/living/mechanics.js +588 -0
  463. package/dist/simulation/living/model-input.d.ts +25 -0
  464. package/dist/simulation/living/model-input.js +215 -0
  465. package/dist/simulation/living/open-world.d.ts +257 -0
  466. package/dist/simulation/living/open-world.js +102 -0
  467. package/dist/simulation/living/projection.d.ts +7 -0
  468. package/dist/simulation/living/projection.js +31 -0
  469. package/dist/simulation/living/recall.d.ts +17 -0
  470. package/dist/simulation/living/recall.js +25 -0
  471. package/dist/simulation/living/reduce.d.ts +15 -0
  472. package/dist/simulation/living/reduce.js +1853 -0
  473. package/dist/simulation/living/replay.d.ts +6 -0
  474. package/dist/simulation/living/replay.js +22 -0
  475. package/dist/simulation/living/runtime.d.ts +140 -0
  476. package/dist/simulation/living/runtime.js +3020 -0
  477. package/dist/simulation/living/shared-kinds.d.ts +24 -0
  478. package/dist/simulation/living/shared-kinds.js +96 -0
  479. package/dist/simulation/living/types.d.ts +2785 -0
  480. package/dist/simulation/living/types.js +669 -0
  481. package/dist/simulation/llm.d.ts +3 -1
  482. package/dist/simulation/llm.js +90 -30
  483. package/dist/simulation/memory/embedding.d.ts +1 -1
  484. package/dist/simulation/memory/embedding.js +9 -3
  485. package/dist/simulation/memory/filesystem.d.ts +2 -0
  486. package/dist/simulation/memory/filesystem.js +5 -1
  487. package/dist/simulation/memory/filesystem_file_tree.d.ts +4 -1
  488. package/dist/simulation/memory/filesystem_file_tree.js +41 -10
  489. package/dist/simulation/memory/filesystem_invariants.js +1 -2
  490. package/dist/simulation/memory/filesystem_types.d.ts +1 -0
  491. package/dist/simulation/memory/memory.d.ts +2 -0
  492. package/dist/simulation/memory/memory.js +5 -1
  493. package/dist/simulation/orchestration/intent.js +0 -2
  494. package/dist/simulation/orchestration/lifecycle.js +0 -2
  495. package/dist/simulation/plugin_host.d.ts +25 -1
  496. package/dist/simulation/plugin_host.js +334 -17
  497. package/dist/simulation/session_documents.d.ts +20 -0
  498. package/dist/simulation/session_documents.js +62 -0
  499. package/dist/simulation/session_input_validation.d.ts +43 -0
  500. package/dist/simulation/session_input_validation.js +364 -0
  501. package/dist/simulation/session_inputs.d.ts +32 -0
  502. package/dist/simulation/session_inputs.js +154 -0
  503. package/dist/simulation/telemetry.d.ts +11 -14
  504. package/dist/simulation/telemetry.js +177 -54
  505. package/dist/simulation/toolkit/bounded_turns.d.ts +13 -0
  506. package/dist/simulation/toolkit/bounded_turns.js +80 -0
  507. package/dist/simulation/toolkit/dynamic_agents.d.ts +25 -0
  508. package/dist/simulation/toolkit/dynamic_agents.js +218 -0
  509. package/dist/simulation/toolkit/dynamic_digest.d.ts +1 -0
  510. package/dist/simulation/toolkit/dynamic_digest.js +8 -0
  511. package/dist/simulation/toolkit/dynamic_documents.d.ts +7 -0
  512. package/dist/simulation/toolkit/dynamic_documents.js +71 -0
  513. package/dist/simulation/toolkit/dynamic_driver.d.ts +8 -0
  514. package/dist/simulation/toolkit/dynamic_driver.js +269 -0
  515. package/dist/simulation/toolkit/dynamic_game.d.ts +53 -0
  516. package/dist/simulation/toolkit/dynamic_game.js +805 -0
  517. package/dist/simulation/toolkit/dynamic_knowledge.d.ts +15 -0
  518. package/dist/simulation/toolkit/dynamic_knowledge.js +91 -0
  519. package/dist/simulation/toolkit/dynamic_mechanics.d.ts +22 -0
  520. package/dist/simulation/toolkit/dynamic_mechanics.js +910 -0
  521. package/dist/simulation/toolkit/dynamic_meetings.d.ts +239 -0
  522. package/dist/simulation/toolkit/dynamic_meetings.js +350 -0
  523. package/dist/simulation/toolkit/dynamic_progress.d.ts +131 -0
  524. package/dist/simulation/toolkit/dynamic_progress.js +214 -0
  525. package/dist/simulation/toolkit/dynamic_projection.d.ts +9 -0
  526. package/dist/simulation/toolkit/dynamic_projection.js +219 -0
  527. package/dist/simulation/toolkit/dynamic_runtime.d.ts +412 -0
  528. package/dist/simulation/toolkit/dynamic_runtime.js +6536 -0
  529. package/dist/simulation/toolkit/dynamic_state.d.ts +111 -0
  530. package/dist/simulation/toolkit/dynamic_state.js +1967 -0
  531. package/dist/simulation/toolkit/dynamic_story_review.d.ts +508 -0
  532. package/dist/simulation/toolkit/dynamic_story_review.js +333 -0
  533. package/dist/simulation/toolkit/dynamic_storyteller.d.ts +77 -0
  534. package/dist/simulation/toolkit/dynamic_storyteller.js +114 -0
  535. package/dist/simulation/toolkit/dynamic_storyteller_runtime.d.ts +26 -0
  536. package/dist/simulation/toolkit/dynamic_storyteller_runtime.js +126 -0
  537. package/dist/simulation/toolkit/dynamic_world.d.ts +22 -0
  538. package/dist/simulation/toolkit/dynamic_world.js +377 -0
  539. package/dist/simulation/toolkit/structured_output.d.ts +5 -0
  540. package/dist/simulation/toolkit/structured_output.js +321 -0
  541. package/dist/simulation/types/world.d.ts +2 -0
  542. package/dist/simulation/world/artifact_store.js +1 -1
  543. package/dist/simulation/world/memory_manager.d.ts +5 -0
  544. package/dist/simulation/world/memory_manager.js +17 -2
  545. package/dist/simulation/world/state.d.ts +3 -2
  546. package/dist/simulation/world/state.js +15 -5
  547. package/dist/skills/bundled/measurement-validation/SKILL.md +144 -0
  548. package/dist/terminal_attach.d.ts +1 -0
  549. package/dist/terminal_attach.js +113 -0
  550. package/dist/tool_progress.d.ts +3 -0
  551. package/dist/tool_progress.js +27 -0
  552. package/dist/types.d.ts +145 -10
  553. package/dist/types.js +3 -0
  554. package/dist/ui/core/input.d.ts +3 -0
  555. package/dist/ui/core/input_segments.d.ts +18 -1
  556. package/dist/ui/core/input_segments.js +131 -47
  557. package/dist/ui/core/input_state.d.ts +12 -0
  558. package/dist/ui/core/layout_yoga.d.ts +1 -1
  559. package/dist/ui/core/turn_metadata.d.ts +5 -0
  560. package/dist/ui/core/turn_metadata.js +22 -0
  561. package/dist/ui/ink/render.d.ts +2 -1
  562. package/dist/ui/ink/render.js +6 -5
  563. package/dist/ui/ratatui/headless_pane_manager.d.ts +14 -1
  564. package/dist/ui/ratatui/headless_pane_manager.js +293 -104
  565. package/dist/ui/ratatui/index.d.ts +1 -0
  566. package/dist/ui/ratatui/input.d.ts +4 -0
  567. package/dist/ui/ratatui/input.js +15 -0
  568. package/dist/ui/ratatui/ipc_path.d.ts +2 -0
  569. package/dist/ui/ratatui/ipc_path.js +29 -1
  570. package/dist/ui/ratatui/mux_persistence.d.ts +3 -1
  571. package/dist/ui/ratatui/mux_persistence.js +139 -1
  572. package/dist/ui/ratatui/pane_relay.d.ts +1 -1
  573. package/dist/ui/ratatui/pane_relay.js +55 -27
  574. package/dist/ui/ratatui/process.d.ts +17 -1
  575. package/dist/ui/ratatui/process.js +80 -7
  576. package/dist/ui/ratatui/protocol.d.ts +236 -1
  577. package/dist/ui/ratatui/protocol.js +90 -0
  578. package/dist/ui/scrollback.d.ts +2 -1
  579. package/dist/ui/scrollback.js +9 -4
  580. package/dist/ui/stream_typewriter.d.ts +8 -3
  581. package/dist/ui/stream_typewriter.js +30 -1
  582. package/dist/ui/streaming_scrollback.d.ts +1 -0
  583. package/dist/ui/streaming_scrollback.js +1 -1
  584. package/dist/ui/transcript_render_cache.js +10 -0
  585. package/dist/ui/views/activity_line.d.ts +5 -3
  586. package/dist/ui/views/activity_line.js +65 -7
  587. package/dist/ui/views/app.d.ts +6 -3
  588. package/dist/ui/views/app.js +17 -6
  589. package/dist/ui/views/completion_menu.js +10 -5
  590. package/dist/ui/views/input_area.d.ts +7 -3
  591. package/dist/ui/views/input_area.js +15 -9
  592. package/dist/ui/views/message_list.d.ts +4 -1
  593. package/dist/ui/views/message_list.js +89 -19
  594. package/dist/ui/views/queue_panel.d.ts +3 -1
  595. package/dist/ui/views/queue_panel.js +9 -2
  596. package/dist/ui/views/status_bar.d.ts +4 -2
  597. package/dist/ui/views/status_bar.js +28 -13
  598. package/dist/ui/views/theme.d.ts +2 -0
  599. package/dist/ui/views/theme.js +2 -0
  600. package/dist/ui/widgets/color_panel.js +18 -0
  601. package/dist/ui/widgets/form.js +8 -0
  602. package/dist/ui/widgets/log_view.js +7 -0
  603. package/dist/ui/widgets/navigator_panel.js +8 -0
  604. package/dist/ui/widgets/prompt_viewer.js +2 -0
  605. package/dist/ui/widgets/questionnaire.d.ts +2 -0
  606. package/dist/ui/widgets/questionnaire.js +79 -16
  607. package/dist/ui/widgets/resume_panel.d.ts +2 -0
  608. package/dist/ui/widgets/resume_panel.js +26 -15
  609. package/dist/ui/widgets/rewind_panel.d.ts +2 -2
  610. package/dist/ui/widgets/rewind_panel.js +4 -2
  611. package/dist/ui/widgets/select.js +16 -27
  612. package/dist/ui/widgets/settings_panel.js +16 -0
  613. package/dist/ui/widgets/status_line_panel.d.ts +1 -0
  614. package/dist/ui/widgets/status_line_panel.js +30 -4
  615. package/dist/ui/widgets/text_input.d.ts +2 -0
  616. package/dist/ui/widgets/text_input.js +15 -1
  617. package/dist/ui/widgets/types.d.ts +2 -0
  618. package/dist/usage_projection.d.ts +24 -0
  619. package/dist/usage_projection.js +130 -0
  620. package/dist/usage_snapshot.d.ts +36 -0
  621. package/dist/usage_snapshot.js +131 -0
  622. package/dist/utils/assistant_message.d.ts +2 -0
  623. package/dist/utils/assistant_message.js +5 -0
  624. package/dist/utils/atomic_write.d.ts +6 -2
  625. package/dist/utils/atomic_write.js +29 -4
  626. package/dist/utils/checked_shell.d.ts +25 -0
  627. package/dist/utils/checked_shell.js +107 -0
  628. package/dist/utils/compaction.d.ts +4 -1
  629. package/dist/utils/compaction.js +31 -7
  630. package/dist/utils/context.d.ts +4 -4
  631. package/dist/utils/context.js +14 -12
  632. package/dist/utils/deepseek.d.ts +2 -2
  633. package/dist/utils/deepseek.js +13 -5
  634. package/dist/utils/ephemeral.js +4 -0
  635. package/dist/utils/ephemeral_tools.d.ts +18 -0
  636. package/dist/utils/ephemeral_tools.js +97 -0
  637. package/dist/utils/jev_client.d.ts +4 -0
  638. package/dist/utils/jev_client.js +15 -0
  639. package/dist/utils/model_cache.d.ts +15 -0
  640. package/dist/utils/model_cache.js +143 -0
  641. package/dist/utils/models.d.ts +4 -2
  642. package/dist/utils/models.js +12 -16
  643. package/dist/utils/reasoning.d.ts +8 -1
  644. package/dist/utils/reasoning.js +31 -11
  645. package/dist/utils/router_catalog.d.ts +49 -0
  646. package/dist/utils/router_catalog.js +271 -0
  647. package/dist/utils/sandbox.d.ts +9 -0
  648. package/dist/utils/sandbox.js +118 -15
  649. package/dist/utils/shell.d.ts +7 -0
  650. package/dist/utils/shell.js +98 -34
  651. package/dist/utils/subprocess_env.d.ts +3 -0
  652. package/dist/utils/subprocess_env.js +27 -1
  653. package/dist/web/accounts_mirror.d.ts +3 -1
  654. package/dist/web/accounts_mirror.js +13 -9
  655. package/dist/web/child_publication.d.ts +17 -0
  656. package/dist/web/child_publication.js +45 -0
  657. package/dist/web/mirror_authenticator.d.ts +31 -11
  658. package/dist/web/mirror_authenticator.js +67 -17
  659. package/dist/web/mirror_client.d.ts +31 -4
  660. package/dist/web/mirror_client.js +189 -23
  661. package/dist/web/mirror_stream.d.ts +84 -22
  662. package/dist/web/mirror_stream.js +676 -95
  663. package/dist/web/observer_query_redaction.d.ts +6 -0
  664. package/dist/web/observer_query_redaction.js +58 -0
  665. package/dist/web/pane_registry.d.ts +2 -0
  666. package/dist/web/pane_registry.js +86 -22
  667. package/dist/web/tool_image.d.ts +6 -0
  668. package/dist/web/tool_image.js +17 -0
  669. package/dist/web/view_plugin.d.ts +14 -0
  670. package/dist/web/view_plugin.js +23 -1
  671. package/dist/worker/executor.js +31 -12
  672. package/dist/worker/index.d.ts +1 -0
  673. package/dist/worker/toolsets.js +3 -1
  674. package/dist/worker/types.d.ts +12 -1
  675. package/dist/workflows/registry.js +1 -0
  676. package/dist/workflows/registry_handle.d.ts +2 -0
  677. package/dist/workflows/runtime.d.ts +2 -0
  678. package/dist/workflows/runtime.js +1 -0
  679. package/dist/workspace_agent.d.ts +7 -0
  680. package/dist/workspace_agent.js +36 -0
  681. package/dist/workspace_collision.d.ts +76 -0
  682. package/dist/workspace_collision.js +688 -0
  683. package/dist/workspace_layout.d.ts +18 -0
  684. package/dist/workspace_layout.js +121 -0
  685. package/dist/workspace_runtime.d.ts +44 -0
  686. package/dist/workspace_runtime.js +82 -0
  687. package/dist/workspace_session_context.d.ts +62 -0
  688. package/dist/workspace_session_context.js +160 -0
  689. package/dist/zlm-embed.mjs +32518 -9615
  690. package/dist/zlm.js +1 -0
  691. package/node_modules/@zerg/model-contracts/LICENSE.md +375 -0
  692. package/node_modules/@zerg/model-contracts/README.md +90 -0
  693. package/node_modules/@zerg/model-contracts/index.d.ts +20 -0
  694. package/node_modules/@zerg/model-contracts/index.js +223 -0
  695. package/node_modules/@zerg/model-contracts/package.json +8 -0
  696. package/node_modules/glob/node_modules/brace-expansion/index.js +78 -22
  697. package/node_modules/glob/node_modules/brace-expansion/package.json +1 -1
  698. package/node_modules/readdir-glob/node_modules/brace-expansion/index.js +78 -22
  699. package/node_modules/readdir-glob/node_modules/brace-expansion/package.json +1 -1
  700. package/package.json +45 -24
  701. package/packages/model-contracts/LICENSE.md +375 -0
  702. package/packages/model-contracts/README.md +90 -0
  703. package/packages/model-contracts/index.d.ts +20 -0
  704. package/packages/model-contracts/index.js +223 -0
  705. package/packages/model-contracts/package.json +8 -0
  706. package/remote-broker/Dockerfile +10 -0
  707. package/remote-broker/README.md +308 -0
  708. package/remote-broker/archive.py +1227 -0
  709. package/remote-broker/cutover.py +761 -0
  710. package/remote-broker/requirements.txt +5 -0
  711. package/remote-broker/resources.example.json +6 -0
  712. package/remote-broker/resources.write-staging.example.json +18 -0
  713. package/remote-broker/retained.py +686 -0
  714. package/remote-broker/retained_cleanup.py +550 -0
  715. package/remote-broker/server.py +648 -0
  716. package/scripts/build-remote-broker.mjs +13 -0
  717. package/scripts/ensure-local-packages.mjs +6 -0
  718. package/scripts/node-pty-helpers.mjs +103 -0
@@ -1,10 +1,16 @@
1
+ import { parseReasoningSelection } from '../../utils/reasoning.js';
2
+ import { resolveRouterModel } from '../../utils/router_catalog.js';
3
+ import { getSupportedCodexReasoningEfforts } from '../../utils/models.js';
1
4
  import { resolveExecutionSettings } from '../../config/execution.js';
2
5
  import { accountsCommand } from './accounts.js';
3
6
  import { authCommand } from './auth.js';
7
+ import { setupCommand } from './setup.js';
8
+ import { activatePermissionConfig } from './permissions.js';
9
+ import { PERMISSION_CAPABILITIES } from '../../config/permissions.js';
4
10
  import { activeProfile, builtinProfileEmulation, listConfigProfiles } from '../../config/profiles.js';
5
11
  import { switchConfigProfile } from './config_profile_switch.js';
6
12
  import { keybindingsCommand } from './keybindings.js';
7
- import { DEFAULT_CONTEXT_PROGRESS_BAR } from '../../config.js';
13
+ import { DEFAULT_CONTEXT_PROGRESS_BAR, resolveTerminalInteractionSettings } from '../../config.js';
8
14
  import { loadRouterCredentials } from '../../router_auth.js';
9
15
  import { CODEX_REASONING_EFFORTS } from '../../config/types.js';
10
16
  import { customPaneOptions, storedCustomPaneOptions, withCustomPaneOptions, } from '../../config/panes.js';
@@ -16,13 +22,13 @@ import { applyRuntimeModelSelection, getEffectiveModel } from './runtime_model.j
16
22
  import { parseGoalTurnCap } from './goal.js';
17
23
  import { shutdownAndClearWorkflowRegistry } from '../../workflows/registry_handle.js';
18
24
  import { invalidateSkillsCache, preloadSkillsManifest } from '../../skills/registry.js';
19
- import { MIN_TOOL_OUTPUT_LINES, parseToolOutputLines, resolveMessageDisplaySettings, } from '../../config/message_display.js';
25
+ import { MIN_TOOL_OUTPUT_LINES, parseToolOutputLines, parseProseReadingRate, resolveMessageDisplaySettings, } from '../../config/message_display.js';
20
26
  import { DEFAULT_JEV_SETTINGS, MAX_AUTO_COMPACT_THRESHOLD, MAX_COMPACTION_TARGET_PERCENT, MIN_AUTO_COMPACT_THRESHOLD, MIN_COMPACTION_TARGET_PERCENT, MIN_CONTEXT_TOKEN_BUDGET, defaultTokenTrigger, maxCompactionTargetFor, minAutoCompactThresholdFor, parseCompactionTriggerMode, resolveAutoCompactThreshold, resolveCompactionTargetPercent, resolveCompactionTriggerMode, resolveCompactionSettings, resolveContextTokenBudget, tokenTriggerActive, MAX_JEV_KEEP_THRESHOLD, MAX_JEV_STATE_TOKENS, MIN_JEV_KEEP_THRESHOLD, MIN_JEV_PRESERVE_RECENT, MIN_JEV_STATE_TOKENS, parseAutoCompactThreshold, parseCompactionTargetPercent, parseContextTokenBudget, parseJevKeepThreshold, parseJevPreserveRecent, parseJevStateTokens, } from '../../config/compaction.js';
21
27
  import { MIN_MAX_ITERATIONS, parseMaxIterations } from '../../config/agent_limits.js';
22
28
  import { MAX_SFX_VOLUME, MIN_SFX_VOLUME, parseSfxPack, parseSfxVolume, resolveSfxPack, resolveSfxVolume, } from '../../config/sound.js';
23
29
  import { listPacks } from '../../audio/sfx.js';
24
30
  import { DEFAULT_SPINNER_VERBS, parseSpinnerVerbs } from '../../utils/spinner_verbs.js';
25
- import { MIN_API_RETRY_ATTEMPTS, MIN_API_RETRY_BASE_DELAY_MS, MIN_API_RETRY_TIMEOUT_MS, parseApiRetryAttempts, parseApiRetryBaseDelayMs, parseApiRetryTimeoutMs, resolveApiRetrySettings, } from '../../config/api_retry.js';
31
+ import { MIN_API_RETRY_ATTEMPTS, MIN_API_RETRY_BASE_DELAY_MS, MIN_API_RETRY_TIMEOUT_MS, parseApiRetryAttempts, parseApiRetryBaseDelayMs, parseApiRetryMaxDelayMs, parseApiRecoveryWindowMs, parseApiRetryTimeoutMs, resolveApiRetrySettings, } from '../../config/api_retry.js';
26
32
  import { STATUS_LINE_ITEMS, compactStatusLineVariants, normalizeStatusLineSeparator, parseStatusLineItems, replaceStatusLineSide, resolveStatusLineSettings, statusLineItemOptions, statusLineSettingsForStorage, } from '../../ui/status_line_config.js';
27
33
  import { BAR_COLOR_FIELDS, contextProgressBarConfig, normalizeBarColor, publishContextProgressBar, withBarColor, } from './context_progress_bar.js';
28
34
  /**
@@ -132,6 +138,8 @@ export async function buildSettingsCategories(ctx) {
132
138
  const routerSignedIn = routerCredentials !== null && Date.parse(routerCredentials.expiresAt) > Date.now();
133
139
  const provider = ctx.config.getProvider();
134
140
  const model = ctx.config.getModel?.() || config.model;
141
+ const reasoningEfforts = getSupportedCodexReasoningEfforts(model, provider, ctx.config.getReasoningWireSurface?.(provider, model)
142
+ ?? (config.authMode === 'zrouter' || provider === 'openai_compatible' ? 'chat_tools' : 'native_api'));
135
143
  const claudeCliInstalled = isClaudeCliAvailable();
136
144
  const claudeCodeTokenPresent = Boolean(process.env.CLAUDE_CODE_OAUTH_TOKEN?.trim());
137
145
  const claudeCodeReady = hasUsableClaudeCodeCliAuth();
@@ -168,10 +176,30 @@ export async function buildSettingsCategories(ctx) {
168
176
  modelOptions = models.slice(0, 20).map(m => ({ value: m, label: m }));
169
177
  }
170
178
  catch { /* fallback: no pre-fetched options, user can type manually */ }
179
+ const routerCatalog = ctx.config.getRoutedModelCatalog?.();
180
+ const routerDescriptor = routerCatalog?.version === 1
181
+ ? resolveRouterModel(routerCatalog, provider, model) : undefined;
182
+ if (routerCatalog?.version === 1)
183
+ modelOptions = routerCatalog.models.filter(row => row.owned_by === provider && row.capabilities?.chat)
184
+ .map(row => ({ value: row.id, label: `${row.display_name || row.id}${row.capabilities?.tools === false ? ' (chat only)' : ''}${row.available === false ? ' (access unavailable)' : ''}` }));
185
+ const reasoningChoices = routerCatalog?.version === 1 ? routerDescriptor?.capabilities?.reasoning?.choices ?? []
186
+ : reasoningEfforts ?? CODEX_REASONING_EFFORTS;
187
+ const effortSupported = config.codexEffort === undefined || reasoningChoices.includes(config.codexEffort);
171
188
  const sections = [
172
189
  {
173
190
  name: 'Config Scope',
174
191
  settings: [
192
+ {
193
+ name: 'setUpZtc',
194
+ label: 'Set up ZTC',
195
+ value: '/setup',
196
+ type: 'text',
197
+ description: 'Verify the runtime, account and sample workspace with the shared setup action.',
198
+ onActivate: async () => {
199
+ ctx.settingsPanel?.closeSettingsPanel?.();
200
+ await setupCommand.handler([], ctx);
201
+ },
202
+ },
175
203
  {
176
204
  name: 'configProfile',
177
205
  label: 'Active config profile',
@@ -242,7 +270,8 @@ export async function buildSettingsCategories(ctx) {
242
270
  // option matches a canonical PROVIDERS value instead of nothing.
243
271
  value: normalizeProviderId(provider),
244
272
  type: 'select',
245
- options: PROVIDERS,
273
+ options: routerCatalog?.version === 1 ? [...new Map(routerCatalog.models.filter(row => row.capabilities?.chat)
274
+ .map(row => [row.owned_by, { value: row.owned_by, label: row.provider_display_name || row.owned_by }])).values()] : PROVIDERS,
246
275
  },
247
276
  {
248
277
  name: 'model',
@@ -258,13 +287,15 @@ export async function buildSettingsCategories(ctx) {
258
287
  value: config.maxTokens === undefined ? 'provider default' : String(config.maxTokens),
259
288
  type: 'text',
260
289
  placeholder: 'provider default',
261
- description: 'Maximum output tokens, including reasoning tokens. Enter a positive whole number, or "provider default" to clear the limit.',
290
+ description: `Maximum output tokens, including reasoning tokens. ${routerDescriptor?.capabilities?.max_output_tokens ? `Router limit: ${routerDescriptor.capabilities.max_output_tokens.toLocaleString()}. ` : ''}Enter a positive whole number, or "provider default" to clear the limit.`,
262
291
  },
263
292
  {
264
293
  name: 'codexEffort', label: 'Default reasoning effort',
265
- value: config.codexEffort ?? 'provider default', type: 'select',
266
- options: [{ value: 'provider default', label: 'provider default' }, ...CODEX_REASONING_EFFORTS.map(level => ({ value: level, label: level }))],
267
- description: 'Global default. Model and provider overrides take precedence.',
294
+ value: effortSupported ? config.codexEffort ?? 'provider default' : 'provider default', type: 'select',
295
+ options: [{ value: 'provider default', label: 'provider default' }, ...reasoningChoices.map(level => ({ value: level, label: level }))],
296
+ description: reasoningChoices.length === 0
297
+ ? `This model takes no reasoning-effort setting (${provider} · ${model}).`
298
+ : `Levels supported by ${provider} · ${model}. Model and provider overrides take precedence.`,
268
299
  },
269
300
  {
270
301
  name: 'codexFastMode', label: 'Fast mode', value: String(config.codexFastMode === true), type: 'select',
@@ -536,7 +567,7 @@ export async function buildSettingsCategories(ctx) {
536
567
  // provider's health, not a choice between five presets.
537
568
  type: 'text',
538
569
  placeholder: '3',
539
- description: 'How many times to try one request before failing the turn. Any whole number of at least 1.',
570
+ description: 'Attempts before sustained recovery. 1 disables Agent-level retries and recovery; backend reconnect policies are separate. Any whole number of at least 1.',
540
571
  },
541
572
  {
542
573
  name: 'apiRetryBaseDelay',
@@ -544,7 +575,18 @@ export async function buildSettingsCategories(ctx) {
544
575
  value: String(apiRetry.baseDelayMs),
545
576
  type: 'text',
546
577
  placeholder: '2000',
547
- description: 'First wait between retries, in milliseconds. Each later wait doubles. Any whole number from 0.',
578
+ description: 'Exponential wait base in milliseconds. Waits use jitter and the maximum delay below. Any whole number from 0.',
579
+ },
580
+ {
581
+ name: 'apiRetryMaxDelay', label: 'Maximum retry wait', value: String(apiRetry.maxDelayMs),
582
+ type: 'text', placeholder: '30000',
583
+ description: 'Caps each retry wait in milliseconds. Any whole number of at least 1.',
584
+ },
585
+ {
586
+ name: 'apiRetryRecoveryWindow', label: 'Endpoint recovery window',
587
+ value: apiRetry.recoveryWindowMs === null ? 'continuous' : String(apiRetry.recoveryWindowMs),
588
+ type: 'text', placeholder: 'continuous',
589
+ description: 'After the initial attempts, retain the task until cancellation (continuous), for this many milliseconds, or stop at the initial limit (0).',
548
590
  },
549
591
  {
550
592
  name: 'apiRetryTimeout',
@@ -559,6 +601,16 @@ export async function buildSettingsCategories(ctx) {
559
601
  {
560
602
  name: 'Verbosity',
561
603
  settings: [
604
+ {
605
+ name: 'showTurnMetadata',
606
+ label: 'Turn time and tokens',
607
+ value: String(messageDisplay.showTurnMetadata),
608
+ type: 'select',
609
+ options: [
610
+ { value: 'true', label: 'shown', description: 'Show elapsed time and model usage beside assistant timestamps' },
611
+ { value: 'false', label: 'hidden', description: 'Keep message headers to role and timestamp' },
612
+ ],
613
+ },
562
614
  {
563
615
  name: 'showThinking',
564
616
  label: 'Show thinking prompts',
@@ -603,10 +655,19 @@ export async function buildSettingsCategories(ctx) {
603
655
  value: String(messageDisplay.smoothStreaming),
604
656
  type: 'select',
605
657
  options: [
606
- { value: 'true', label: 'smooth', description: 'Reveal bursty output at a steady pace, keeping pace with the stream' },
607
- { value: 'false', label: 'instant', description: 'Show every arrival the moment it lands' },
658
+ { value: 'true', label: 'smooth', description: 'Use bounded-lag smoothing when the prose reading cap is off' },
659
+ { value: 'false', label: 'instant', description: 'Show every arrival immediately when the prose reading cap is off' },
608
660
  ],
609
661
  },
662
+ {
663
+ name: 'proseReadingRateWordsPerSecond',
664
+ label: 'Prose reading rate',
665
+ value: messageDisplay.proseReadingRateWordsPerSecond === null
666
+ ? 'off' : String(messageDisplay.proseReadingRateWordsPerSecond),
667
+ type: 'text',
668
+ placeholder: '9',
669
+ description: 'Assistant prose words per second. Any positive finite rate, or "off" for bounded-lag streaming. Reasoning, tools, and messages containing fenced code are uncapped.',
670
+ },
610
671
  ],
611
672
  },
612
673
  {
@@ -719,6 +780,8 @@ export async function buildSettingsCategories(ctx) {
719
780
  settings: [
720
781
  { name: 'uiTheme', label: 'Theme', value: config.uiTheme ?? 'ztc-dark', type: 'text', description: 'Terminal theme name. Use /theme list for built-in choices.' },
721
782
  { name: 'rawScrollback', label: 'Raw scrollback', value: String(config.rawScrollback === true), type: 'select', options: [{ value: 'true', label: 'on' }, { value: 'false', label: 'off' }] },
783
+ { name: 'mouseCapture', label: 'Mouse capture', value: String(resolveTerminalInteractionSettings(config.terminalInteraction).mouseCapture), type: 'select', options: [{ value: 'true', label: 'on' }, { value: 'false', label: 'off' }], description: 'Requires a compatible renderer; otherwise saved for next launch.' },
784
+ { name: 'wheelScrollLines', label: 'Wheel scroll lines', value: String(resolveTerminalInteractionSettings(config.terminalInteraction).wheelScrollLines), type: 'text', description: 'Compatible renderer required. Lines per wheel: 1–20 (default 3).' },
722
785
  { name: 'keybindings', label: 'Keybindings', value: `${Object.keys(config.keybindings?.zmux ?? {}).length} overrides`, type: 'text', description: 'Enter to edit shortcuts.', onActivate: () => { void keybindingsCommand.handler([], ctx); } },
723
786
  {
724
787
  name: 'panesCustomOptions',
@@ -889,7 +952,7 @@ export async function buildSettingsCategories(ctx) {
889
952
  group('Accounts', 'Config Scope', 'Accounts'),
890
953
  group('Provider & Model', 'Provider & Model', 'Claude Code'),
891
954
  group('Auth & Routing', 'Auth & Routing', 'API Keys', 'Custom Endpoint'),
892
- group('Behavior', 'Behavior', 'Retries & Timeouts', 'Automation'),
955
+ group('Behavior', 'Behavior', 'Retries & Timeouts', 'Automation', 'Execution'),
893
956
  group('Context Compaction', 'Context Compaction', 'Context Storage'),
894
957
  group('Tools & Security', 'Tool Access'),
895
958
  group('Verbosity', 'Verbosity', 'Panes'),
@@ -1048,16 +1111,20 @@ function applySettingChange(ctx, setting, value) {
1048
1111
  ctx.config.set('execution', next);
1049
1112
  return;
1050
1113
  }
1051
- if (setting.startsWith('toolPermission_')) {
1052
- const capability = setting.slice('toolPermission_'.length);
1053
- if (!['file_read', 'file_write', 'shell_exec', 'network', 'screen_capture', 'computer_control', 'ml_inference'].includes(capability)) {
1054
- throw new Error(`Unknown tool permission: ${capability}`);
1055
- }
1056
- ctx.config.set('toolPermissions', { ...ctx.config.get().toolPermissions, [capability]: value === 'true' });
1057
- return;
1058
- }
1059
1114
  switch (setting) {
1060
1115
  case 'provider':
1116
+ {
1117
+ const catalog = ctx.config.getRoutedModelCatalog?.();
1118
+ if (catalog?.version === 1) {
1119
+ const rows = catalog.models.filter(row => row.owned_by === value && row.capabilities?.chat);
1120
+ const selected = rows.find(row => row.is_default) ?? rows[0];
1121
+ if (!selected)
1122
+ throw new Error('Provider is not in the Router chat catalog.');
1123
+ ctx.config.setProvider(value);
1124
+ ctx.config.set('model', selected.id);
1125
+ break;
1126
+ }
1127
+ }
1061
1128
  ctx.config.setProvider(value);
1062
1129
  {
1063
1130
  const resetModel = resolveModelForProviderChange(value, getEffectiveModel(ctx));
@@ -1082,10 +1149,19 @@ function applySettingChange(ctx, setting, value) {
1082
1149
  break;
1083
1150
  }
1084
1151
  case 'codexEffort':
1085
- if (value !== 'provider default' && !CODEX_REASONING_EFFORTS.includes(value)) {
1152
+ const catalog = ctx.config.getRoutedModelCatalog?.();
1153
+ const choices = catalog?.version === 1 ? resolveRouterModel(catalog, ctx.config.getProvider(), getEffectiveModel(ctx))?.capabilities?.reasoning?.choices ?? [] : CODEX_REASONING_EFFORTS;
1154
+ if (value !== 'provider default' && !choices.includes(value)) {
1086
1155
  throw new Error(`Unknown reasoning effort: ${value}`);
1087
1156
  }
1088
- ctx.config.set('codexEffort', value === 'provider default' ? undefined : value);
1157
+ const activeConfig = ctx.config.get();
1158
+ const activeProvider = ctx.config.getProvider();
1159
+ const activeModel = ctx.config.getModel?.() || activeConfig.model;
1160
+ const selectedEffort = parseReasoningSelection(activeProvider, activeModel, undefined, { effort: value === 'provider default' ? 'default' : value }, catalog?.version === 1
1161
+ ? resolveRouterModel(catalog, activeProvider, activeModel)?.capabilities?.reasoning?.choices ?? []
1162
+ : ctx.config.getReasoningWireSurface?.(activeProvider, activeModel)
1163
+ ?? (activeConfig.authMode === 'zrouter' || activeProvider === 'openai_compatible' ? 'chat_tools' : 'native_api'));
1164
+ ctx.config.set('codexEffort', selectedEffort ?? undefined);
1089
1165
  break;
1090
1166
  case 'codexFastMode':
1091
1167
  ctx.config.set('codexFastMode', value === 'true');
@@ -1296,6 +1372,20 @@ function applySettingChange(ctx, setting, value) {
1296
1372
  ctx.config.set('apiRetry', { ...(ctx.config.get().apiRetry ?? {}), requestTimeoutMs });
1297
1373
  break;
1298
1374
  }
1375
+ case 'apiRetryMaxDelay': {
1376
+ const maxDelayMs = parseApiRetryMaxDelayMs(value);
1377
+ if (maxDelayMs === null)
1378
+ throw new Error('Maximum retry wait must be a whole number of milliseconds of at least 1.');
1379
+ ctx.config.set('apiRetry', { ...(ctx.config.get().apiRetry ?? {}), maxDelayMs });
1380
+ break;
1381
+ }
1382
+ case 'apiRetryRecoveryWindow': {
1383
+ const recoveryWindowMs = parseApiRecoveryWindowMs(value);
1384
+ if (recoveryWindowMs === undefined)
1385
+ throw new Error('Recovery window must be continuous or a whole number of milliseconds of at least 0.');
1386
+ ctx.config.set('apiRetry', { ...(ctx.config.get().apiRetry ?? {}), recoveryWindowMs });
1387
+ break;
1388
+ }
1299
1389
  case 'compactionMethod':
1300
1390
  ctx.config.set('compaction', {
1301
1391
  ...resolveCompactionSettings(ctx.config.get()),
@@ -1366,6 +1456,12 @@ function applySettingChange(ctx, setting, value) {
1366
1456
  groupToolCalls: value === 'true',
1367
1457
  });
1368
1458
  break;
1459
+ case 'showTurnMetadata':
1460
+ ctx.config.set('messageDisplay', {
1461
+ ...resolveMessageDisplaySettings(ctx.config.get()),
1462
+ showTurnMetadata: value === 'true',
1463
+ });
1464
+ break;
1369
1465
  case 'showThinking':
1370
1466
  ctx.config.set('messageDisplay', {
1371
1467
  ...resolveMessageDisplaySettings(ctx.config.get()),
@@ -1378,6 +1474,16 @@ function applySettingChange(ctx, setting, value) {
1378
1474
  smoothStreaming: value === 'true',
1379
1475
  });
1380
1476
  break;
1477
+ case 'proseReadingRateWordsPerSecond': {
1478
+ const rate = parseProseReadingRate(value);
1479
+ if (rate === undefined)
1480
+ throw new Error('Prose reading rate must be positive finite words per second, or "off".');
1481
+ ctx.config.set('messageDisplay', {
1482
+ ...resolveMessageDisplaySettings(ctx.config.get()),
1483
+ proseReadingRateWordsPerSecond: rate,
1484
+ });
1485
+ break;
1486
+ }
1381
1487
  case 'statusLineEnabled':
1382
1488
  ctx.config.set('statusLine', statusLineSettingsForStorage({
1383
1489
  ...resolveStatusLineSettings(ctx.config.get().statusLine),
@@ -1430,22 +1536,6 @@ function applySettingChange(ctx, setting, value) {
1430
1536
  case 'mcpStatus':
1431
1537
  // Read-only informational setting.
1432
1538
  break;
1433
- case 'permissionProfile':
1434
- if (!ctx.config.get().permissionProfiles?.[value])
1435
- throw new Error(`Unknown permission profile: ${value}`);
1436
- ctx.config.set('permissionProfile', value);
1437
- break;
1438
- case 'sandboxEnabled':
1439
- ctx.config.set('sandbox', { ...ctx.config.get().sandbox, enabled: value === 'true' });
1440
- break;
1441
- case 'sandboxBackend':
1442
- if (!['auto', 'none', 'seatbelt', 'bubblewrap', 'windows-job'].includes(value))
1443
- throw new Error(`Unknown sandbox backend: ${value}`);
1444
- ctx.config.set('sandbox', { ...ctx.config.get().sandbox, backend: value });
1445
- break;
1446
- case 'sandboxRequireOsEnforcement':
1447
- ctx.config.set('sandbox', { ...ctx.config.get().sandbox, requireOsEnforcement: value === 'true' });
1448
- break;
1449
1539
  case 'sandboxAuditDir':
1450
1540
  ctx.config.set('sandbox', { ...ctx.config.get().sandbox, auditDir: value.trim() || undefined });
1451
1541
  break;
@@ -1570,6 +1660,19 @@ function applySettingChange(ctx, setting, value) {
1570
1660
  case 'rawScrollback':
1571
1661
  ctx.config.set('rawScrollback', value === 'true');
1572
1662
  break;
1663
+ case 'mouseCapture':
1664
+ if (value !== 'true' && value !== 'false')
1665
+ throw new Error('Mouse capture must be true or false.');
1666
+ ctx.config.set('terminalInteraction', { ...resolveTerminalInteractionSettings(ctx.config.get().terminalInteraction), mouseCapture: value === 'true' });
1667
+ break;
1668
+ case 'wheelScrollLines': {
1669
+ const lines = Number(value.trim());
1670
+ if (!value.trim() || !Number.isInteger(lines) || lines < 1 || lines > 20) {
1671
+ throw new Error('Wheel scroll lines must be a whole number from 1 to 20.');
1672
+ }
1673
+ ctx.config.set('terminalInteraction', { ...resolveTerminalInteractionSettings(ctx.config.get().terminalInteraction), wheelScrollLines: lines });
1674
+ break;
1675
+ }
1573
1676
  case 'manifestsDir':
1574
1677
  ctx.config.set('manifestsDir', value.trim() || undefined);
1575
1678
  break;
@@ -1679,10 +1782,12 @@ function applySettingChange(ctx, setting, value) {
1679
1782
  */
1680
1783
  const LIVE_READ_SETTINGS = new Set([
1681
1784
  'toolOutputLines',
1785
+ 'showTurnMetadata',
1682
1786
  'collapseToolCalls',
1683
1787
  'groupToolCalls',
1684
1788
  'showThinking',
1685
1789
  'smoothStreaming',
1790
+ 'proseReadingRateWordsPerSecond',
1686
1791
  'statusLineEnabled',
1687
1792
  'statusLineLeft',
1688
1793
  'statusLineRight',
@@ -1702,6 +1807,8 @@ const LIVE_READ_SETTINGS = new Set([
1702
1807
  'sfxVolume',
1703
1808
  'sfxPack',
1704
1809
  'configScope',
1810
+ 'mouseCapture',
1811
+ 'wheelScrollLines',
1705
1812
  ]);
1706
1813
  /**
1707
1814
  * Re-read the rows whose displayed value is not simply what was picked.
@@ -1771,6 +1878,36 @@ export const settingsCommand = {
1771
1878
  ? 'verbosity'
1772
1879
  : sub;
1773
1880
  const onSettingChange = async (setting, value) => {
1881
+ if (setting === 'permissionProfile' || setting.startsWith('toolPermission_')
1882
+ || ['sandboxEnabled', 'sandboxBackend', 'sandboxRequireOsEnforcement'].includes(setting)) {
1883
+ const config = ctx.config.get();
1884
+ let next;
1885
+ if (setting === 'permissionProfile')
1886
+ next = { ...config, permissionProfile: value };
1887
+ else if (setting.startsWith('toolPermission_')) {
1888
+ const cap = setting.slice('toolPermission_'.length);
1889
+ if (!PERMISSION_CAPABILITIES.includes(cap) || !['true', 'false'].includes(value))
1890
+ throw new Error('Invalid tool permission');
1891
+ next = { ...config, toolPermissions: { ...config.toolPermissions, [cap]: value === 'true' } };
1892
+ }
1893
+ else {
1894
+ if (setting === 'sandboxBackend') {
1895
+ if (!['auto', 'none', 'seatbelt', 'bubblewrap', 'windows-job'].includes(value))
1896
+ throw new Error(`Unknown sandbox backend: ${value}`);
1897
+ next = { ...config, sandbox: { ...config.sandbox, backend: value } };
1898
+ }
1899
+ else {
1900
+ if (!['true', 'false'].includes(value))
1901
+ throw new Error('Invalid sandbox toggle');
1902
+ const key = setting === 'sandboxEnabled' ? 'enabled' : 'requireOsEnforcement';
1903
+ next = { ...config, sandbox: { ...config.sandbox, [key]: value === 'true' } };
1904
+ }
1905
+ }
1906
+ const notice = await activatePermissionConfig(next, ctx);
1907
+ await refreshAllRowDisplays(categories, ctx);
1908
+ ctx.addMessage({ role: 'system', content: notice });
1909
+ return;
1910
+ }
1774
1911
  if (setting === 'workflowsEnabled' && value === 'false') {
1775
1912
  await shutdownAndClearWorkflowRegistry(5000);
1776
1913
  }
@@ -1801,6 +1938,15 @@ export const settingsCommand = {
1801
1938
  else if (setting !== 'clearSessionConfig' && !LIVE_READ_SETTINGS.has(setting)) {
1802
1939
  ctx.reloadAgent();
1803
1940
  }
1941
+ if (setting === 'mouseCapture' || setting === 'wheelScrollLines') {
1942
+ const applied = ctx.zmux?.setTerminalInteraction?.(resolveTerminalInteractionSettings(ctx.config.get().terminalInteraction)) === true;
1943
+ if (!applied)
1944
+ ctx.addMessage({
1945
+ role: 'system',
1946
+ content: 'Terminal interaction saved for the next compatible native renderer launch; not applied to this renderer.',
1947
+ metadata: { ephemeral: true },
1948
+ });
1949
+ }
1804
1950
  };
1805
1951
  /**
1806
1952
  * One entry point for the settings surface, so the color picker can hand the
@@ -0,0 +1,2 @@
1
+ import type { Command } from './types.js';
2
+ export declare const setupCommand: Command;
@@ -0,0 +1,78 @@
1
+ import { completeSetup, formatSetupReport } from '../../onboarding/setup.js';
2
+ let activeSetup = null;
3
+ async function startSetup(ctx, checkAgent) {
4
+ if (activeSetup) {
5
+ ctx.addMessage({ role: 'system', content: 'Setup is already running. Use /setup cancel to stop it.' });
6
+ return;
7
+ }
8
+ if (ctx.getMode?.() === 'plan') {
9
+ ctx.addMessage({ role: 'system', content: 'Setup can install tools and create a sample workspace. Use /exit-mode to leave Plan mode, then run /setup.' });
10
+ return;
11
+ }
12
+ const abort = new AbortController();
13
+ activeSetup = abort;
14
+ try {
15
+ const options = {
16
+ checkAgent, config: ctx.config, cwd: ctx.shell.getCwd(), signal: abort.signal,
17
+ onProgress: (content) => ctx.addMessage({ role: 'system', content }),
18
+ };
19
+ ctx.addMessage({ role: 'system', content: 'Setting up ZTC. Use /setup cancel to stop; completed steps can be resumed.' });
20
+ const report = await completeSetup(options);
21
+ ctx.addMessage({ role: 'system', content: formatSetupReport(report) });
22
+ }
23
+ catch {
24
+ ctx.addMessage({ role: 'system', content: abort.signal.aborted
25
+ ? 'ZTC setup cancelled. Completed steps were preserved; run /setup to resume.'
26
+ : 'ZTC setup could not complete. Check /doctor and the previous setup checks, then run /setup again.' });
27
+ }
28
+ finally {
29
+ if (activeSetup === abort)
30
+ activeSetup = null;
31
+ }
32
+ }
33
+ export const setupCommand = {
34
+ name: 'setup',
35
+ description: 'Set up and verify the environment, account and sample workspace',
36
+ usage: '[--check-agent|cancel]',
37
+ agentRunnable: false,
38
+ handler: (args, ctx) => {
39
+ if (ctx.commandOrigin === 'agent') {
40
+ ctx.addMessage({ role: 'system', content: 'Setup requires the user to type /setup and confirm its primary action.' });
41
+ return;
42
+ }
43
+ if (args.length === 1 && args[0] === 'cancel') {
44
+ activeSetup?.abort();
45
+ ctx.addMessage({ role: 'system', content: activeSetup ? 'Stopping setup…' : 'No setup is running. Use Esc to close an unconfirmed setup prompt.' });
46
+ return;
47
+ }
48
+ const checkAgent = args.length === 1 && args[0] === '--check-agent';
49
+ if (args.length && !checkAgent) {
50
+ ctx.addMessage({ role: 'system', content: 'Usage: /setup [--check-agent|cancel]' });
51
+ return;
52
+ }
53
+ if (activeSetup) {
54
+ ctx.addMessage({ role: 'system', content: 'Setup is already running. Use /setup cancel to stop it.' });
55
+ return;
56
+ }
57
+ ctx.addMessage({ role: 'system', content: 'Setup verifies Node, shell, GitHub auth and common tools; installs missing Git/ripgrep through a supported package manager; preserves current account/model defaults; creates a reusable sample; and checks shell health without spending model quota.' + (checkAgent ? ' You also requested one isolated model health request (at most 64 output tokens); it may use paid quota.' : '') });
58
+ let submitted = false;
59
+ const confirm = async (input) => {
60
+ if (submitted)
61
+ return;
62
+ submitted = true;
63
+ if (input === null)
64
+ return;
65
+ if (input.trim()) {
66
+ ctx.addMessage({ role: 'system', content: 'Setup was not started. Run /setup and press Enter to use its primary action, or Esc to cancel.' });
67
+ return;
68
+ }
69
+ await startSetup(ctx, checkAgent);
70
+ };
71
+ if (ctx.prompt.showPrompt) {
72
+ ctx.prompt.showPrompt({ title: 'Set up ZTC', question: checkAgent ? 'Enter to set up and use model quota · Esc to cancel' : 'Enter to set up without model quota · Esc to cancel' }, confirm);
73
+ }
74
+ else {
75
+ ctx.prompt.prompt(checkAgent ? 'Set up ZTC — Enter to set up and use model quota · Esc to cancel' : 'Set up ZTC — Enter to set up without model quota · Esc to cancel', confirm, { allowEmptySubmit: true });
76
+ }
77
+ },
78
+ };
@@ -0,0 +1,2 @@
1
+ import type { Command } from './types.js';
2
+ export declare const shareCommand: Command;
@@ -0,0 +1,64 @@
1
+ const USAGE = '/share [create [label] [--ttl seconds]|list|revoke <ID|all>|owner]';
2
+ export const shareCommand = {
3
+ name: 'share',
4
+ description: 'Create, inspect or revoke read-only browser access to this session',
5
+ usage: USAGE,
6
+ handler: async (args, ctx) => {
7
+ const say = (content) => ctx.addMessage({ role: 'system', content });
8
+ if (ctx.commandOrigin === 'agent') {
9
+ say('Only you can manage terminal sharing.');
10
+ return;
11
+ }
12
+ const action = args[0] ?? 'list';
13
+ try {
14
+ const mirror = ctx.mirror;
15
+ if (!mirror?.sharing)
16
+ throw new Error('Session sharing requires the native ZTC mirror.');
17
+ if (!mirror.isRunning())
18
+ throw new Error('Start the mirror with /mirror start first.');
19
+ if (action === 'create') {
20
+ const labelParts = [];
21
+ let ttl = 3600;
22
+ let ttlSeen = false;
23
+ for (let i = 1; i < args.length; i++) {
24
+ if (args[i] === '--ttl') {
25
+ if (ttlSeen || !/^\d+$/.test(args[i + 1] ?? ''))
26
+ throw new Error('TTL must be an integer from 1 to 43200 seconds.');
27
+ ttlSeen = true;
28
+ ttl = Number(args[++i]);
29
+ }
30
+ else {
31
+ if (args[i].startsWith('--'))
32
+ throw new Error(`Unknown sharing option: ${args[i]}`);
33
+ labelParts.push(args[i]);
34
+ }
35
+ }
36
+ if (!Number.isSafeInteger(ttl) || ttl < 1 || ttl > 43200)
37
+ throw new Error('TTL must be an integer from 1 to 43200 seconds.');
38
+ const share = mirror.sharing.create(labelParts.join(' ') || 'Observer', ttl);
39
+ say(`Read-only share created: ${share.label}\nID: ${share.id}\nExpires: ${new Date(share.expiresAtMs).toISOString()}\n${share.url}\nThis link shows terminal activity and output. It cannot control the session.\nRemote viewers need an authenticated SSH tunnel to this loopback mirror. Revoke: /share revoke ${share.id}\nExisting browser controllers may need /share owner after sharing enables authentication.`);
40
+ return;
41
+ }
42
+ if (action === 'list' && args.length <= 1) {
43
+ const shares = mirror.sharing.list();
44
+ say(shares.length === 0 ? 'No observation shares.' : ['Observation shares:', ...shares.map(share => `${share.id} · ${share.label} · ${share.revoked ? 'revoked' : share.expiresAtMs <= Date.now() ? 'expired' : 'active'} · ${new Date(share.expiresAtMs).toISOString()}`)].join('\n'));
45
+ return;
46
+ }
47
+ if (action === 'revoke' && args.length === 2) {
48
+ const ids = args[1] === 'all' ? mirror.sharing.list().filter(share => !share.revoked).map(share => share.id) : [args[1]];
49
+ const count = ids.filter(id => mirror.sharing.revoke(id)).length;
50
+ say(count ? `Revoked ${count} observation share${count === 1 ? '' : 's'}. The terminal session keeps running.` : 'No active observation share matches that ID.');
51
+ return;
52
+ }
53
+ if (action === 'owner' && args.length === 1) {
54
+ await mirror.open();
55
+ say('Opened your controller view. Keep its credential private.');
56
+ return;
57
+ }
58
+ throw new Error(USAGE);
59
+ }
60
+ catch (error) {
61
+ say(`Sharing: ${error instanceof Error ? error.message : String(error)}`);
62
+ }
63
+ },
64
+ };
@@ -8,9 +8,10 @@ import { isLocalSubscription } from './provider_choices.js';
8
8
  export const statusCommand = {
9
9
  name: 'status',
10
10
  description: 'Show current status',
11
+ usage: '/status [--verbose]',
11
12
  agentRunnable: true,
12
13
  category: 'core',
13
- handler: (_, ctx) => {
14
+ handler: (args, ctx) => {
14
15
  const isAuthenticated = ctx.config.isAuthenticated?.() ?? false;
15
16
  const config = ctx.config.get();
16
17
  const provider = ctx.config.getProvider();
@@ -46,11 +47,22 @@ export const statusCommand = {
46
47
  routeError = error instanceof Error ? error.message : String(error);
47
48
  }
48
49
  const execution = ctx.getExecutionContext?.();
50
+ const environment = ctx.getEnvironment?.();
51
+ const executionLines = !execution ? [] : args.includes('--verbose')
52
+ ? [describeExecutionContext(execution)]
53
+ : [
54
+ ` Mode: ${execution.mode}`,
55
+ ` Working directory: ${execution.cwd}`,
56
+ ` Output cap: ${execution.maxTokens ?? 'provider default'}`,
57
+ ` Tools: ${execution.tools.length} registered; mux ${execution.mux ? 'connected' : 'off'}`,
58
+ ' Full execution details: /status --verbose',
59
+ ];
49
60
  ctx.addMessage({
50
61
  role: 'system',
51
62
  content: [
52
63
  'Status:',
53
- ...(execution ? [describeExecutionContext(execution)] : []),
64
+ ...(environment ? [` Environment: ${environment.name} (${environment.status}); /environment status`] : []),
65
+ ...executionLines,
54
66
  ` API Key: ${hasKey ? '✓ configured' : '✗ not set (use /config key <key>)'}`,
55
67
  ` Platform Auth: ${isAuthenticated ? '✓ configured' : '✗ not set'}`,
56
68
  ` Provider: ${provider}`,