@zergai/ztc 0.5.0-beta.1 → 0.6.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 (1166) hide show
  1. package/README.md +65 -46
  2. package/THIRD_PARTY_NOTICES.md +7 -2
  3. package/bin/zmux-darwin-arm64 +0 -0
  4. package/bin/ztc-audio-darwin-arm64 +0 -0
  5. package/bin/ztc-capture-darwin-arm64 +0 -0
  6. package/bin/ztc-computer-darwin-arm64 +0 -0
  7. package/bin/ztc-llm-darwin-arm64 +0 -0
  8. package/bin/ztc-tts-darwin-arm64 +0 -0
  9. package/bin/ztc-tui-darwin-arm64 +0 -0
  10. package/bin/zterm-darwin-arm64 +0 -0
  11. package/dist/App.js +26 -9
  12. package/dist/agent/agent.d.ts +77 -0
  13. package/dist/agent/agent.js +618 -94
  14. package/dist/agent/backends/account_login.js +3 -1
  15. package/dist/agent/backends/anthropic.js +4 -3
  16. package/dist/agent/backends/bedrock.d.ts +20 -0
  17. package/dist/agent/backends/bedrock.js +175 -0
  18. package/dist/agent/backends/claude_cli.js +8 -0
  19. package/dist/agent/backends/codex_app_server.js +2 -0
  20. package/dist/agent/backends/codex_auth.d.ts +5 -2
  21. package/dist/agent/backends/codex_auth.js +131 -31
  22. package/dist/agent/backends/gemini.js +1 -1
  23. package/dist/agent/backends/http_error.d.ts +2 -0
  24. package/dist/agent/backends/http_error.js +4 -0
  25. package/dist/agent/backends/index.d.ts +3 -0
  26. package/dist/agent/backends/index.js +16 -0
  27. package/dist/agent/backends/model_pool.d.ts +20 -0
  28. package/dist/agent/backends/model_pool.js +98 -0
  29. package/dist/agent/backends/openai.js +2 -0
  30. package/dist/agent/backends/openai_compatible.js +8 -3
  31. package/dist/agent/backends/openai_responses.d.ts +14 -3
  32. package/dist/agent/backends/openai_responses.js +91 -26
  33. package/dist/agent/backends/responses_reasoning.d.ts +5 -0
  34. package/dist/agent/backends/responses_reasoning.js +23 -0
  35. package/dist/agent/backends/transport_errors.d.ts +6 -0
  36. package/dist/agent/backends/transport_errors.js +11 -0
  37. package/dist/agent/backends/types.d.ts +25 -2
  38. package/dist/agent/backends/types.js +4 -0
  39. package/dist/agent/backends/zrouter_stream.d.ts +16 -0
  40. package/dist/agent/backends/zrouter_stream.js +162 -17
  41. package/dist/agent/background_workers.d.ts +68 -0
  42. package/dist/agent/background_workers.js +139 -0
  43. package/dist/agent/commands/accounts.d.ts +9 -1
  44. package/dist/agent/commands/accounts.js +13 -5
  45. package/dist/agent/commands/auth.d.ts +30 -1
  46. package/dist/agent/commands/auth.js +166 -35
  47. package/dist/agent/commands/command_refusal.d.ts +8 -0
  48. package/dist/agent/commands/command_refusal.js +8 -0
  49. package/dist/agent/commands/compact.js +16 -10
  50. package/dist/agent/commands/config.js +386 -80
  51. package/dist/agent/commands/connect.d.ts +20 -0
  52. package/dist/agent/commands/connect.js +150 -0
  53. package/dist/agent/commands/credential_redaction.d.ts +12 -0
  54. package/dist/agent/commands/credential_redaction.js +46 -0
  55. package/dist/agent/commands/credential_status.d.ts +72 -0
  56. package/dist/agent/commands/credential_status.js +181 -0
  57. package/dist/agent/commands/direct_credential_prompt.d.ts +71 -0
  58. package/dist/agent/commands/direct_credential_prompt.js +422 -0
  59. package/dist/agent/commands/effort.d.ts +1 -0
  60. package/dist/agent/commands/effort.js +16 -34
  61. package/dist/agent/commands/goal.d.ts +0 -4
  62. package/dist/agent/commands/goal.js +48 -10
  63. package/dist/agent/commands/handoff.d.ts +6 -0
  64. package/dist/agent/commands/handoff.js +17 -0
  65. package/dist/agent/commands/help.js +1 -1
  66. package/dist/agent/commands/inbox.js +3 -0
  67. package/dist/agent/commands/index.js +5 -3
  68. package/dist/agent/commands/keybindings.js +4 -3
  69. package/dist/agent/commands/mirror.js +29 -16
  70. package/dist/agent/commands/model.js +83 -4
  71. package/dist/agent/commands/models.d.ts +1 -1
  72. package/dist/agent/commands/models.js +89 -67
  73. package/dist/agent/commands/openai_compat_wizard.d.ts +3 -2
  74. package/dist/agent/commands/openai_compat_wizard.js +53 -15
  75. package/dist/agent/commands/provider_choices.d.ts +56 -0
  76. package/dist/agent/commands/provider_choices.js +72 -3
  77. package/dist/agent/commands/provider_model_defaults.d.ts +7 -0
  78. package/dist/agent/commands/provider_model_defaults.js +11 -0
  79. package/dist/agent/commands/provider_selection.d.ts +27 -2
  80. package/dist/agent/commands/provider_selection.js +143 -8
  81. package/dist/agent/commands/reasoning_page.d.ts +33 -0
  82. package/dist/agent/commands/reasoning_page.js +595 -0
  83. package/dist/agent/commands/reasoning_picker.d.ts +14 -0
  84. package/dist/agent/commands/reasoning_picker.js +99 -0
  85. package/dist/agent/commands/reasoning_settings.d.ts +18 -0
  86. package/dist/agent/commands/reasoning_settings.js +46 -0
  87. package/dist/agent/commands/settings.d.ts +2 -0
  88. package/dist/agent/commands/settings.js +689 -264
  89. package/dist/agent/commands/status.js +13 -44
  90. package/dist/agent/commands/types.d.ts +108 -2
  91. package/dist/agent/commands/update.d.ts +18 -0
  92. package/dist/agent/commands/update.js +55 -96
  93. package/dist/agent/completion_state.d.ts +18 -0
  94. package/dist/agent/completion_state.js +35 -3
  95. package/dist/agent/factory.d.ts +9 -1
  96. package/dist/agent/factory.js +61 -17
  97. package/dist/agent/loop_policy.d.ts +14 -0
  98. package/dist/agent/loop_policy.js +9 -0
  99. package/dist/agent/request_encoder.d.ts +6 -0
  100. package/dist/agent/request_encoder.js +36 -6
  101. package/dist/agent/result_emit_cap.d.ts +1 -0
  102. package/dist/agent/result_emit_cap.js +1 -0
  103. package/dist/agent/runaway_output.d.ts +32 -0
  104. package/dist/agent/runaway_output.js +80 -0
  105. package/dist/agent/runtime/command_execution_policy.d.ts +6 -0
  106. package/dist/agent/runtime/command_execution_policy.js +39 -0
  107. package/dist/agent/runtime/evidence.d.ts +17 -1
  108. package/dist/agent/runtime/evidence.js +58 -8
  109. package/dist/agent/runtime/execution_context.js +7 -3
  110. package/dist/agent/runtime/read_only_command.d.ts +15 -0
  111. package/dist/agent/runtime/read_only_command.js +265 -0
  112. package/dist/agent/runtime/recovery.js +2 -38
  113. package/dist/agent/runtime/source_verification.js +3 -1
  114. package/dist/agent/runtime/tool_checkpoints.js +5 -1
  115. package/dist/agent/runtime/tool_runtime.js +15 -1
  116. package/dist/agent/runtime/tool_scheduler.js +3 -1
  117. package/dist/agent/subagent.d.ts +4 -0
  118. package/dist/agent/subagent.js +195 -23
  119. package/dist/agent/system_prompt.d.ts +3 -1
  120. package/dist/agent/system_prompt.js +3 -1
  121. package/dist/agent/tool_response_store.d.ts +9 -0
  122. package/dist/agent/tool_response_store.js +39 -3
  123. package/dist/agent/tool_result_parsing.d.ts +2 -0
  124. package/dist/agent/tool_result_parsing.js +1 -0
  125. package/dist/agent/tool_result_presentation.d.ts +21 -0
  126. package/dist/agent/tool_result_presentation.js +237 -0
  127. package/dist/agent/tools/apply_patch.js +130 -42
  128. package/dist/agent/tools/deferred.js +22 -2
  129. package/dist/agent/tools/delegate.js +182 -49
  130. package/dist/agent/tools/edit_view.d.ts +13 -0
  131. package/dist/agent/tools/edit_view.js +134 -0
  132. package/dist/agent/tools/file.js +54 -16
  133. package/dist/agent/tools/recall_tool_response.d.ts +6 -0
  134. package/dist/agent/tools/recall_tool_response.js +60 -17
  135. package/dist/agent/tools/screenshot.js +5 -3
  136. package/dist/agent/tools/search.js +18 -9
  137. package/dist/agent/tools/shell.d.ts +1 -1
  138. package/dist/agent/tools/shell.js +48 -10
  139. package/dist/agent/tools/sim_domain_tools.js +7 -1
  140. package/dist/agent/tools/tool_groups.d.ts +34 -0
  141. package/dist/agent/tools/tool_groups.js +112 -0
  142. package/dist/agent/tools/types.d.ts +10 -0
  143. package/dist/app/activity.js +2 -1
  144. package/dist/app/agent_runner.js +13 -4
  145. package/dist/app/ask_user_response.d.ts +6 -0
  146. package/dist/app/ask_user_response.js +26 -0
  147. package/dist/app/command_context.js +11 -5
  148. package/dist/app/launch_notices.d.ts +10 -0
  149. package/dist/app/launch_notices.js +20 -0
  150. package/dist/app/selection_completion.d.ts +30 -1
  151. package/dist/app/selection_completion.js +191 -28
  152. package/dist/app/session_manager.d.ts +5 -0
  153. package/dist/app/session_manager.js +50 -12
  154. package/dist/app/session_messages.d.ts +3 -0
  155. package/dist/app/session_messages.js +34 -12
  156. package/dist/app/workspace_admission_details.d.ts +7 -0
  157. package/dist/app/workspace_admission_details.js +45 -1
  158. package/dist/cli_args.js +1 -1
  159. package/dist/cli_main.js +20 -3
  160. package/dist/cli_ratatui.d.ts +95 -3
  161. package/dist/cli_ratatui.js +654 -161
  162. package/dist/components/InputArea.js +1 -1
  163. package/dist/config/compaction.d.ts +2 -1
  164. package/dist/config/compaction.js +2 -1
  165. package/dist/config/defaults.js +20 -48
  166. package/dist/config/provider_api_key_env.d.ts +76 -0
  167. package/dist/config/provider_api_key_env.js +148 -0
  168. package/dist/config/resolved.d.ts +4 -4
  169. package/dist/config/types.d.ts +102 -1
  170. package/dist/config.d.ts +70 -8
  171. package/dist/config.js +253 -63
  172. package/dist/diagnostics/session_export.d.ts +1 -0
  173. package/dist/diagnostics/session_export.js +81 -13
  174. package/dist/emulation/catalog.d.ts +2 -0
  175. package/dist/emulation/catalog.js +50 -21
  176. package/dist/emulation/tool_adapters.d.ts +6 -0
  177. package/dist/emulation/tool_adapters.js +30 -0
  178. package/dist/emulation/ztc_addendum.d.ts +22 -0
  179. package/dist/emulation/ztc_addendum.js +37 -0
  180. package/dist/events.d.ts +3 -0
  181. package/dist/headless.d.ts +35 -1
  182. package/dist/headless.js +209 -14
  183. package/dist/headless_cli.js +6 -0
  184. package/dist/headless_cli_args.d.ts +4 -0
  185. package/dist/headless_cli_args.js +2 -0
  186. package/dist/headless_output_schema.d.ts +46 -0
  187. package/dist/headless_output_schema.js +386 -0
  188. package/dist/headless_trajectory.d.ts +44 -0
  189. package/dist/headless_trajectory.js +113 -0
  190. package/dist/library.d.ts +6 -3
  191. package/dist/library.js +8 -4
  192. package/dist/lsp/client.js +4 -1
  193. package/dist/lsp/servers.js +2 -0
  194. package/dist/onboarding/first_run.d.ts +26 -6
  195. package/dist/onboarding/first_run.js +63 -45
  196. package/dist/onboarding/router_tips.d.ts +7 -0
  197. package/dist/onboarding/router_tips.js +38 -0
  198. package/dist/onboarding/setup.js +1 -1
  199. package/dist/onboarding/wordmark.d.ts +7 -0
  200. package/dist/onboarding/wordmark.js +14 -0
  201. package/dist/onboarding/zergai_login.d.ts +48 -0
  202. package/dist/onboarding/zergai_login.js +60 -0
  203. package/dist/prompts/subagent_worker.j2 +20 -0
  204. package/dist/prompts/tool_delegate_task.j2 +5 -14
  205. package/dist/router_auth.d.ts +37 -3
  206. package/dist/router_auth.js +221 -73
  207. package/dist/runtime_info.d.ts +19 -6
  208. package/dist/runtime_info.js +64 -28
  209. package/dist/session.d.ts +9 -0
  210. package/dist/session.js +41 -8
  211. package/dist/session_handoff_contract.d.ts +13 -0
  212. package/dist/session_handoff_contract.js +81 -15
  213. package/dist/session_media.d.ts +5 -0
  214. package/dist/session_media.js +2 -1
  215. package/dist/simulation/domain_types.d.ts +3 -3
  216. package/dist/simulation/living/context.d.ts +9 -9
  217. package/dist/simulation/living/definition.d.ts +1 -1
  218. package/dist/simulation/living/open-world.d.ts +3 -3
  219. package/dist/simulation/living/recall.d.ts +1 -1
  220. package/dist/simulation/living/types.d.ts +18 -18
  221. package/dist/simulation/orchestration/world_response.d.ts +2 -2
  222. package/dist/simulation/toolkit/dynamic_meetings.d.ts +1 -1
  223. package/dist/simulation/toolkit/dynamic_state.d.ts +1 -1
  224. package/dist/simulation/world/bootstrap_schema.d.ts +1 -1
  225. package/dist/simulation/world/gm_schema.d.ts +8 -8
  226. package/dist/skills/loader.js +3 -1
  227. package/dist/types.d.ts +6 -2
  228. package/dist/ui/core/input.d.ts +5 -1
  229. package/dist/ui/core/input.js +5 -1
  230. package/dist/ui/core/input_segments.d.ts +5 -1
  231. package/dist/ui/core/input_segments.js +5 -3
  232. package/dist/ui/ratatui/headless_pane_manager.d.ts +3 -1
  233. package/dist/ui/ratatui/headless_pane_manager.js +16 -5
  234. package/dist/ui/ratatui/input.js +4 -3
  235. package/dist/ui/ratatui/process.js +22 -13
  236. package/dist/ui/ratatui/protocol.d.ts +14 -0
  237. package/dist/ui/ratatui/protocol.js +2 -0
  238. package/dist/ui/scrollback.d.ts +17 -0
  239. package/dist/ui/scrollback.js +138 -4
  240. package/dist/ui/terminal_image.d.ts +129 -0
  241. package/dist/ui/terminal_image.js +516 -0
  242. package/dist/ui/transcript_render_cache.d.ts +4 -4
  243. package/dist/ui/transcript_render_cache.js +7 -4
  244. package/dist/ui/views/app.d.ts +7 -3
  245. package/dist/ui/views/app.js +13 -6
  246. package/dist/ui/views/completion_menu.js +18 -10
  247. package/dist/ui/views/input_area.d.ts +1 -2
  248. package/dist/ui/views/input_area.js +2 -2
  249. package/dist/ui/views/message_list.d.ts +8 -1
  250. package/dist/ui/views/message_list.js +176 -45
  251. package/dist/ui/views/status_bar.js +7 -1
  252. package/dist/ui/views/theme.d.ts +2 -0
  253. package/dist/ui/views/theme.js +2 -0
  254. package/dist/ui/widgets/color_panel.js +4 -3
  255. package/dist/ui/widgets/form.d.ts +8 -1
  256. package/dist/ui/widgets/form.js +36 -22
  257. package/dist/ui/widgets/index.d.ts +1 -1
  258. package/dist/ui/widgets/index.js +1 -1
  259. package/dist/ui/widgets/log_view.js +4 -3
  260. package/dist/ui/widgets/navigator_panel.js +5 -4
  261. package/dist/ui/widgets/panel_frame.d.ts +2 -0
  262. package/dist/ui/widgets/panel_frame.js +14 -0
  263. package/dist/ui/widgets/prompt_viewer.js +2 -1
  264. package/dist/ui/widgets/questionnaire.js +3 -3
  265. package/dist/ui/widgets/reasoning_track.d.ts +60 -0
  266. package/dist/ui/widgets/reasoning_track.js +218 -0
  267. package/dist/ui/widgets/resume_panel.js +15 -10
  268. package/dist/ui/widgets/rewind_panel.js +4 -16
  269. package/dist/ui/widgets/select.d.ts +90 -4
  270. package/dist/ui/widgets/select.js +305 -135
  271. package/dist/ui/widgets/settings_panel.d.ts +21 -1
  272. package/dist/ui/widgets/settings_panel.js +266 -45
  273. package/dist/ui/widgets/status_line_panel.js +6 -5
  274. package/dist/ui/widgets/text_input.d.ts +4 -0
  275. package/dist/ui/widgets/text_input.js +20 -13
  276. package/dist/ui/widgets/types.d.ts +2 -0
  277. package/dist/utils/compaction.d.ts +24 -4
  278. package/dist/utils/compaction.js +228 -44
  279. package/dist/utils/context.js +1 -0
  280. package/dist/utils/debug_log.d.ts +12 -0
  281. package/dist/utils/debug_log.js +25 -3
  282. package/dist/utils/deepseek.d.ts +3 -1
  283. package/dist/utils/deepseek.js +29 -1
  284. package/dist/utils/docker_target.d.ts +28 -0
  285. package/dist/utils/docker_target.js +89 -0
  286. package/dist/utils/ephemeral.js +2 -0
  287. package/dist/utils/fireworks.d.ts +4 -4
  288. package/dist/utils/fireworks.js +11 -7
  289. package/dist/utils/idle_compaction.d.ts +32 -0
  290. package/dist/utils/idle_compaction.js +113 -0
  291. package/dist/utils/mid_turn_compaction.d.ts +12 -0
  292. package/dist/utils/mid_turn_compaction.js +17 -0
  293. package/dist/utils/open_url.d.ts +4 -0
  294. package/dist/utils/open_url.js +10 -0
  295. package/dist/utils/openrouter_prices.d.ts +165 -0
  296. package/dist/utils/openrouter_prices.js +313 -0
  297. package/dist/utils/router_catalog.d.ts +13 -0
  298. package/dist/utils/router_catalog.js +30 -3
  299. package/dist/utils/sandbox.d.ts +12 -0
  300. package/dist/utils/sandbox.js +23 -5
  301. package/dist/utils/session_interactivity.d.ts +21 -0
  302. package/dist/utils/session_interactivity.js +28 -0
  303. package/dist/utils/shell.d.ts +7 -0
  304. package/dist/utils/shell.js +43 -7
  305. package/dist/utils/subprocess_env.d.ts +27 -0
  306. package/dist/utils/subprocess_env.js +69 -3
  307. package/dist/utils/tool_output_copies.d.ts +44 -0
  308. package/dist/utils/tool_output_copies.js +196 -0
  309. package/dist/utils/tool_result_message.d.ts +7 -0
  310. package/dist/utils/tool_result_message.js +11 -0
  311. package/dist/utils/tool_trace.d.ts +15 -0
  312. package/dist/utils/tool_trace.js +40 -9
  313. package/dist/web/event_history_store.d.ts +2 -0
  314. package/dist/web/event_history_store.js +31 -6
  315. package/dist/web/mirror_client.d.ts +3 -0
  316. package/dist/web/mirror_stream.d.ts +11 -0
  317. package/dist/web/mirror_stream.js +23 -3
  318. package/dist/worker/executor.js +3 -1
  319. package/dist/worker/toolsets.d.ts +1 -1
  320. package/dist/worker/toolsets.js +4 -3
  321. package/dist/worker/types.d.ts +6 -0
  322. package/dist/worker/worker_models.d.ts +17 -0
  323. package/dist/worker/worker_models.js +79 -0
  324. package/dist/zlm-embed.mjs +53761 -10916
  325. package/node_modules/@zerg/model-contracts/README.md +16 -5
  326. package/node_modules/@zerg/model-contracts/index.d.ts +7 -3
  327. package/node_modules/@zerg/model-contracts/index.js +40 -18
  328. package/node_modules/abort-controller/LICENSE +21 -0
  329. package/node_modules/abort-controller/README.md +98 -0
  330. package/node_modules/abort-controller/browser.js +13 -0
  331. package/node_modules/abort-controller/browser.mjs +11 -0
  332. package/node_modules/abort-controller/dist/abort-controller.d.ts +43 -0
  333. package/node_modules/abort-controller/dist/abort-controller.js +127 -0
  334. package/node_modules/abort-controller/dist/abort-controller.js.map +1 -0
  335. package/node_modules/abort-controller/dist/abort-controller.mjs +118 -0
  336. package/node_modules/abort-controller/dist/abort-controller.mjs.map +1 -0
  337. package/node_modules/abort-controller/dist/abort-controller.umd.js +5 -0
  338. package/node_modules/abort-controller/dist/abort-controller.umd.js.map +1 -0
  339. package/node_modules/abort-controller/package.json +97 -0
  340. package/node_modules/abort-controller/polyfill.js +21 -0
  341. package/node_modules/abort-controller/polyfill.mjs +19 -0
  342. package/node_modules/bluebird/LICENSE +1 -1
  343. package/node_modules/bluebird/README.md +8 -2
  344. package/node_modules/bluebird/js/browser/bluebird.core.js +325 -150
  345. package/node_modules/bluebird/js/browser/bluebird.core.min.js +4 -4
  346. package/node_modules/bluebird/js/browser/bluebird.js +362 -165
  347. package/node_modules/bluebird/js/browser/bluebird.min.js +5 -5
  348. package/node_modules/bluebird/js/release/async.js +15 -56
  349. package/node_modules/bluebird/js/release/debuggability.js +118 -25
  350. package/node_modules/bluebird/js/release/finally.js +37 -2
  351. package/node_modules/bluebird/js/release/generators.js +1 -1
  352. package/node_modules/bluebird/js/release/join.js +4 -7
  353. package/node_modules/bluebird/js/release/map.js +10 -3
  354. package/node_modules/bluebird/js/release/promise.js +89 -43
  355. package/node_modules/bluebird/js/release/promise_array.js +2 -0
  356. package/node_modules/bluebird/js/release/props.js +1 -1
  357. package/node_modules/bluebird/js/release/reduce.js +16 -5
  358. package/node_modules/bluebird/js/release/schedule.js +6 -5
  359. package/node_modules/bluebird/js/release/settle.js +4 -0
  360. package/node_modules/bluebird/js/release/util.js +53 -11
  361. package/node_modules/bluebird/package.json +7 -5
  362. package/node_modules/buffer/AUTHORS.md +3 -0
  363. package/node_modules/buffer/README.md +1 -1
  364. package/node_modules/buffer/index.d.ts +11 -3
  365. package/node_modules/buffer/index.js +424 -135
  366. package/node_modules/buffer/package.json +8 -11
  367. package/node_modules/compress-commons/README.md +1 -1
  368. package/node_modules/compress-commons/lib/archivers/archive-entry.js +6 -16
  369. package/node_modules/compress-commons/lib/archivers/archive-output-stream.js +79 -98
  370. package/node_modules/compress-commons/lib/archivers/zip/constants.js +99 -70
  371. package/node_modules/compress-commons/lib/archivers/zip/general-purpose-bit.js +70 -92
  372. package/node_modules/compress-commons/lib/archivers/zip/unix-stat.js +19 -53
  373. package/node_modules/compress-commons/lib/archivers/zip/util.js +49 -49
  374. package/node_modules/compress-commons/lib/archivers/zip/zip-archive-entry.js +356 -389
  375. package/node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js +335 -404
  376. package/node_modules/compress-commons/lib/compress-commons.js +18 -13
  377. package/node_modules/compress-commons/lib/util/index.js +11 -21
  378. package/node_modules/compress-commons/node_modules/readable-stream/README.md +116 -0
  379. package/node_modules/compress-commons/node_modules/readable-stream/lib/_stream_duplex.js +4 -0
  380. package/node_modules/compress-commons/node_modules/readable-stream/lib/_stream_passthrough.js +4 -0
  381. package/node_modules/compress-commons/node_modules/readable-stream/lib/_stream_readable.js +4 -0
  382. package/node_modules/compress-commons/node_modules/readable-stream/lib/_stream_transform.js +4 -0
  383. package/node_modules/compress-commons/node_modules/readable-stream/lib/_stream_writable.js +4 -0
  384. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/shims/process.js +19 -0
  385. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js +52 -0
  386. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/buffer_list.js +157 -0
  387. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/compose.js +194 -0
  388. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/destroy.js +290 -0
  389. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/duplex.js +143 -0
  390. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/duplexify.js +378 -0
  391. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +286 -0
  392. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/from.js +98 -0
  393. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/lazy_transform.js +51 -0
  394. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/legacy.js +94 -0
  395. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/operators.js +457 -0
  396. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/passthrough.js +39 -0
  397. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/pipeline.js +471 -0
  398. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/readable.js +1290 -0
  399. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/state.js +39 -0
  400. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/transform.js +180 -0
  401. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/utils.js +327 -0
  402. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/writable.js +819 -0
  403. package/node_modules/compress-commons/node_modules/readable-stream/lib/internal/validators.js +530 -0
  404. package/node_modules/compress-commons/node_modules/readable-stream/lib/ours/browser.js +35 -0
  405. package/node_modules/compress-commons/node_modules/readable-stream/lib/ours/errors.js +343 -0
  406. package/node_modules/compress-commons/node_modules/readable-stream/lib/ours/index.js +65 -0
  407. package/node_modules/compress-commons/node_modules/readable-stream/lib/ours/primordials.js +124 -0
  408. package/node_modules/compress-commons/node_modules/readable-stream/lib/ours/util/inspect.js +55 -0
  409. package/node_modules/compress-commons/node_modules/readable-stream/lib/ours/util.js +148 -0
  410. package/node_modules/compress-commons/node_modules/readable-stream/lib/stream/promises.js +43 -0
  411. package/node_modules/compress-commons/node_modules/readable-stream/lib/stream.js +143 -0
  412. package/node_modules/compress-commons/node_modules/readable-stream/package.json +89 -0
  413. package/node_modules/compress-commons/package.json +13 -10
  414. package/node_modules/crc32-stream/README.md +8 -8
  415. package/node_modules/crc32-stream/lib/crc32-stream.js +4 -23
  416. package/node_modules/crc32-stream/lib/deflate-crc32-stream.js +5 -27
  417. package/node_modules/crc32-stream/lib/index.js +7 -6
  418. package/node_modules/crc32-stream/node_modules/readable-stream/README.md +116 -0
  419. package/node_modules/crc32-stream/node_modules/readable-stream/lib/_stream_duplex.js +4 -0
  420. package/node_modules/crc32-stream/node_modules/readable-stream/lib/_stream_passthrough.js +4 -0
  421. package/node_modules/crc32-stream/node_modules/readable-stream/lib/_stream_readable.js +4 -0
  422. package/node_modules/crc32-stream/node_modules/readable-stream/lib/_stream_transform.js +4 -0
  423. package/node_modules/crc32-stream/node_modules/readable-stream/lib/_stream_writable.js +4 -0
  424. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/shims/process.js +19 -0
  425. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js +52 -0
  426. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/buffer_list.js +157 -0
  427. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/compose.js +194 -0
  428. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/destroy.js +290 -0
  429. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/duplex.js +143 -0
  430. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/duplexify.js +378 -0
  431. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +286 -0
  432. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/from.js +98 -0
  433. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/lazy_transform.js +51 -0
  434. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/legacy.js +94 -0
  435. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/operators.js +457 -0
  436. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/passthrough.js +39 -0
  437. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/pipeline.js +471 -0
  438. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/readable.js +1290 -0
  439. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/state.js +39 -0
  440. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/transform.js +180 -0
  441. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/utils.js +327 -0
  442. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/writable.js +819 -0
  443. package/node_modules/crc32-stream/node_modules/readable-stream/lib/internal/validators.js +530 -0
  444. package/node_modules/crc32-stream/node_modules/readable-stream/lib/ours/browser.js +35 -0
  445. package/node_modules/crc32-stream/node_modules/readable-stream/lib/ours/errors.js +343 -0
  446. package/node_modules/crc32-stream/node_modules/readable-stream/lib/ours/index.js +65 -0
  447. package/node_modules/crc32-stream/node_modules/readable-stream/lib/ours/primordials.js +124 -0
  448. package/node_modules/crc32-stream/node_modules/readable-stream/lib/ours/util/inspect.js +55 -0
  449. package/node_modules/crc32-stream/node_modules/readable-stream/lib/ours/util.js +148 -0
  450. package/node_modules/crc32-stream/node_modules/readable-stream/lib/stream/promises.js +43 -0
  451. package/node_modules/crc32-stream/node_modules/readable-stream/lib/stream.js +143 -0
  452. package/node_modules/crc32-stream/node_modules/readable-stream/package.json +89 -0
  453. package/node_modules/crc32-stream/package.json +9 -10
  454. package/node_modules/event-target-shim/LICENSE +22 -0
  455. package/node_modules/event-target-shim/README.md +293 -0
  456. package/node_modules/event-target-shim/dist/event-target-shim.js +871 -0
  457. package/node_modules/event-target-shim/dist/event-target-shim.js.map +1 -0
  458. package/node_modules/event-target-shim/dist/event-target-shim.mjs +862 -0
  459. package/node_modules/event-target-shim/dist/event-target-shim.mjs.map +1 -0
  460. package/node_modules/event-target-shim/dist/event-target-shim.umd.js +6 -0
  461. package/node_modules/event-target-shim/dist/event-target-shim.umd.js.map +1 -0
  462. package/node_modules/event-target-shim/index.d.ts +399 -0
  463. package/node_modules/event-target-shim/package.json +82 -0
  464. package/node_modules/events/.airtap.yml +15 -0
  465. package/node_modules/events/.github/FUNDING.yml +12 -0
  466. package/node_modules/events/.travis.yml +18 -0
  467. package/node_modules/events/History.md +118 -0
  468. package/node_modules/events/LICENSE +22 -0
  469. package/node_modules/events/Readme.md +50 -0
  470. package/node_modules/events/events.js +497 -0
  471. package/node_modules/events/package.json +37 -0
  472. package/node_modules/events/security.md +10 -0
  473. package/node_modules/events/tests/add-listeners.js +111 -0
  474. package/node_modules/events/tests/check-listener-leaks.js +101 -0
  475. package/node_modules/events/tests/common.js +104 -0
  476. package/node_modules/events/tests/errors.js +13 -0
  477. package/node_modules/events/tests/events-list.js +28 -0
  478. package/node_modules/events/tests/events-once.js +234 -0
  479. package/node_modules/events/tests/index.js +64 -0
  480. package/node_modules/events/tests/legacy-compat.js +16 -0
  481. package/node_modules/events/tests/listener-count.js +37 -0
  482. package/node_modules/events/tests/listeners-side-effects.js +56 -0
  483. package/node_modules/events/tests/listeners.js +168 -0
  484. package/node_modules/events/tests/max-listeners.js +47 -0
  485. package/node_modules/events/tests/method-names.js +35 -0
  486. package/node_modules/events/tests/modify-in-emit.js +90 -0
  487. package/node_modules/events/tests/num-args.js +60 -0
  488. package/node_modules/events/tests/once.js +83 -0
  489. package/node_modules/events/tests/prepend.js +31 -0
  490. package/node_modules/events/tests/remove-all-listeners.js +133 -0
  491. package/node_modules/events/tests/remove-listeners.js +212 -0
  492. package/node_modules/events/tests/set-max-listeners-side-effects.js +31 -0
  493. package/node_modules/events/tests/special-event-names.js +45 -0
  494. package/node_modules/events/tests/subclass.js +66 -0
  495. package/node_modules/events/tests/symbols.js +25 -0
  496. package/node_modules/exceljs/lib/stream/xlsx/workbook-reader.js +5 -1
  497. package/node_modules/exceljs/lib/stream/xlsx/workbook-writer.js +2 -2
  498. package/node_modules/exceljs/lib/utils/zip-archive.js +85 -0
  499. package/node_modules/exceljs/package.json +3 -3
  500. package/node_modules/fs-extra/LICENSE +15 -0
  501. package/node_modules/fs-extra/README.md +294 -0
  502. package/node_modules/fs-extra/lib/copy/copy-sync.js +171 -0
  503. package/node_modules/fs-extra/lib/copy/copy.js +182 -0
  504. package/node_modules/fs-extra/lib/copy/index.js +7 -0
  505. package/node_modules/fs-extra/lib/empty/index.js +39 -0
  506. package/node_modules/fs-extra/lib/ensure/file.js +66 -0
  507. package/node_modules/fs-extra/lib/ensure/index.js +23 -0
  508. package/node_modules/fs-extra/lib/ensure/link.js +64 -0
  509. package/node_modules/fs-extra/lib/ensure/symlink-paths.js +101 -0
  510. package/node_modules/fs-extra/lib/ensure/symlink-type.js +34 -0
  511. package/node_modules/fs-extra/lib/ensure/symlink.js +67 -0
  512. package/node_modules/fs-extra/lib/esm.mjs +68 -0
  513. package/node_modules/fs-extra/lib/fs/index.js +146 -0
  514. package/node_modules/fs-extra/lib/index.js +16 -0
  515. package/node_modules/fs-extra/lib/json/index.js +16 -0
  516. package/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
  517. package/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
  518. package/node_modules/fs-extra/lib/json/output-json.js +12 -0
  519. package/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
  520. package/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
  521. package/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
  522. package/node_modules/fs-extra/lib/move/index.js +7 -0
  523. package/node_modules/fs-extra/lib/move/move-sync.js +55 -0
  524. package/node_modules/fs-extra/lib/move/move.js +59 -0
  525. package/node_modules/fs-extra/lib/output-file/index.js +31 -0
  526. package/node_modules/fs-extra/lib/path-exists/index.js +12 -0
  527. package/node_modules/fs-extra/lib/remove/index.js +17 -0
  528. package/node_modules/fs-extra/lib/util/stat.js +159 -0
  529. package/node_modules/fs-extra/lib/util/utimes.js +36 -0
  530. package/node_modules/fs-extra/package.json +71 -0
  531. package/node_modules/is-stream/index.d.ts +90 -0
  532. package/node_modules/is-stream/index.js +37 -0
  533. package/node_modules/is-stream/license +9 -0
  534. package/node_modules/is-stream/package.json +48 -0
  535. package/node_modules/is-stream/readme.md +57 -0
  536. package/node_modules/jsonfile/LICENSE +15 -0
  537. package/node_modules/jsonfile/README.md +230 -0
  538. package/node_modules/jsonfile/index.js +88 -0
  539. package/node_modules/jsonfile/package.json +40 -0
  540. package/node_modules/jsonfile/utils.js +18 -0
  541. package/node_modules/node-int64/.npmignore +3 -0
  542. package/node_modules/node-int64/Int64.js +268 -0
  543. package/node_modules/node-int64/LICENSE +19 -0
  544. package/node_modules/node-int64/README.md +78 -0
  545. package/node_modules/node-int64/package.json +27 -0
  546. package/node_modules/node-int64/test.js +120 -0
  547. package/node_modules/process/.eslintrc +21 -0
  548. package/node_modules/process/LICENSE +22 -0
  549. package/node_modules/process/README.md +26 -0
  550. package/node_modules/process/browser.js +184 -0
  551. package/node_modules/process/index.js +2 -0
  552. package/node_modules/process/package.json +27 -0
  553. package/node_modules/process/test.js +199 -0
  554. package/node_modules/universalify/LICENSE +20 -0
  555. package/node_modules/universalify/README.md +76 -0
  556. package/node_modules/universalify/index.js +24 -0
  557. package/node_modules/universalify/package.json +34 -0
  558. package/node_modules/unzipper/README.md +206 -176
  559. package/node_modules/unzipper/eslint.config.mjs +29 -0
  560. package/node_modules/unzipper/lib/BufferStream.js +9 -15
  561. package/node_modules/unzipper/lib/Decrypt.js +58 -36
  562. package/node_modules/unzipper/lib/NoopStream.js +5 -10
  563. package/node_modules/unzipper/lib/Open/directory.js +140 -127
  564. package/node_modules/unzipper/lib/Open/index.js +72 -32
  565. package/node_modules/unzipper/lib/Open/unzip.js +68 -74
  566. package/node_modules/unzipper/lib/PullStream.js +50 -55
  567. package/node_modules/unzipper/lib/extract.js +26 -18
  568. package/node_modules/unzipper/lib/parse.js +119 -118
  569. package/node_modules/unzipper/lib/parseBuffer.js +55 -0
  570. package/node_modules/unzipper/lib/parseExtraField.js +17 -14
  571. package/node_modules/unzipper/lib/parseOne.js +23 -27
  572. package/node_modules/unzipper/package.json +12 -13
  573. package/node_modules/unzipper/unzip.js +0 -6
  574. package/node_modules/zip-stream/README.md +5 -5
  575. package/node_modules/zip-stream/index.js +143 -169
  576. package/node_modules/zip-stream/node_modules/readable-stream/README.md +116 -0
  577. package/node_modules/zip-stream/node_modules/readable-stream/lib/_stream_duplex.js +4 -0
  578. package/node_modules/zip-stream/node_modules/readable-stream/lib/_stream_passthrough.js +4 -0
  579. package/node_modules/zip-stream/node_modules/readable-stream/lib/_stream_readable.js +4 -0
  580. package/node_modules/zip-stream/node_modules/readable-stream/lib/_stream_transform.js +4 -0
  581. package/node_modules/zip-stream/node_modules/readable-stream/lib/_stream_writable.js +4 -0
  582. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/shims/process.js +19 -0
  583. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js +52 -0
  584. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/buffer_list.js +157 -0
  585. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/compose.js +194 -0
  586. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/destroy.js +290 -0
  587. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/duplex.js +143 -0
  588. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/duplexify.js +378 -0
  589. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +286 -0
  590. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/from.js +98 -0
  591. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/lazy_transform.js +51 -0
  592. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/legacy.js +94 -0
  593. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/operators.js +457 -0
  594. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/passthrough.js +39 -0
  595. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/pipeline.js +471 -0
  596. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/readable.js +1290 -0
  597. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/state.js +39 -0
  598. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/transform.js +180 -0
  599. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/utils.js +327 -0
  600. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/streams/writable.js +819 -0
  601. package/node_modules/zip-stream/node_modules/readable-stream/lib/internal/validators.js +530 -0
  602. package/node_modules/zip-stream/node_modules/readable-stream/lib/ours/browser.js +35 -0
  603. package/node_modules/zip-stream/node_modules/readable-stream/lib/ours/errors.js +343 -0
  604. package/node_modules/zip-stream/node_modules/readable-stream/lib/ours/index.js +65 -0
  605. package/node_modules/zip-stream/node_modules/readable-stream/lib/ours/primordials.js +124 -0
  606. package/node_modules/zip-stream/node_modules/readable-stream/lib/ours/util/inspect.js +55 -0
  607. package/node_modules/zip-stream/node_modules/readable-stream/lib/ours/util.js +148 -0
  608. package/node_modules/zip-stream/node_modules/readable-stream/lib/stream/promises.js +43 -0
  609. package/node_modules/zip-stream/node_modules/readable-stream/lib/stream.js +143 -0
  610. package/node_modules/zip-stream/node_modules/readable-stream/package.json +89 -0
  611. package/node_modules/zip-stream/package.json +15 -12
  612. package/node_modules/zip-stream/utils.js +21 -0
  613. package/package.json +22 -10
  614. package/packages/exceljs/PROVENANCE.md +24 -1
  615. package/packages/exceljs/lib/stream/xlsx/workbook-reader.js +5 -1
  616. package/packages/exceljs/lib/stream/xlsx/workbook-writer.js +2 -2
  617. package/packages/exceljs/lib/utils/zip-archive.js +85 -0
  618. package/packages/exceljs/package.json +3 -3
  619. package/packages/model-contracts/README.md +16 -5
  620. package/packages/model-contracts/index.d.ts +7 -3
  621. package/packages/model-contracts/index.js +40 -18
  622. package/scripts/install-macos-app.mjs +10 -1
  623. package/node_modules/archiver/LICENSE +0 -22
  624. package/node_modules/archiver/README.md +0 -94
  625. package/node_modules/archiver/index.js +0 -84
  626. package/node_modules/archiver/lib/core.js +0 -974
  627. package/node_modules/archiver/lib/error.js +0 -40
  628. package/node_modules/archiver/lib/plugins/json.js +0 -110
  629. package/node_modules/archiver/lib/plugins/tar.js +0 -167
  630. package/node_modules/archiver/lib/plugins/zip.js +0 -120
  631. package/node_modules/archiver/package.json +0 -60
  632. package/node_modules/archiver-utils/LICENSE +0 -22
  633. package/node_modules/archiver-utils/README.md +0 -7
  634. package/node_modules/archiver-utils/file.js +0 -209
  635. package/node_modules/archiver-utils/index.js +0 -156
  636. package/node_modules/archiver-utils/node_modules/readable-stream/.travis.yml +0 -34
  637. package/node_modules/archiver-utils/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  638. package/node_modules/archiver-utils/node_modules/readable-stream/GOVERNANCE.md +0 -136
  639. package/node_modules/archiver-utils/node_modules/readable-stream/README.md +0 -58
  640. package/node_modules/archiver-utils/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  641. package/node_modules/archiver-utils/node_modules/readable-stream/duplex-browser.js +0 -1
  642. package/node_modules/archiver-utils/node_modules/readable-stream/duplex.js +0 -1
  643. package/node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
  644. package/node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
  645. package/node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
  646. package/node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_transform.js +0 -214
  647. package/node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_writable.js +0 -685
  648. package/node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -78
  649. package/node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -84
  650. package/node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  651. package/node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  652. package/node_modules/archiver-utils/node_modules/readable-stream/package.json +0 -52
  653. package/node_modules/archiver-utils/node_modules/readable-stream/passthrough.js +0 -1
  654. package/node_modules/archiver-utils/node_modules/readable-stream/readable-browser.js +0 -7
  655. package/node_modules/archiver-utils/node_modules/readable-stream/readable.js +0 -19
  656. package/node_modules/archiver-utils/node_modules/readable-stream/transform.js +0 -1
  657. package/node_modules/archiver-utils/node_modules/readable-stream/writable-browser.js +0 -1
  658. package/node_modules/archiver-utils/node_modules/readable-stream/writable.js +0 -8
  659. package/node_modules/archiver-utils/node_modules/safe-buffer/LICENSE +0 -21
  660. package/node_modules/archiver-utils/node_modules/safe-buffer/README.md +0 -584
  661. package/node_modules/archiver-utils/node_modules/safe-buffer/index.d.ts +0 -187
  662. package/node_modules/archiver-utils/node_modules/safe-buffer/index.js +0 -62
  663. package/node_modules/archiver-utils/node_modules/safe-buffer/package.json +0 -37
  664. package/node_modules/archiver-utils/node_modules/string_decoder/.travis.yml +0 -50
  665. package/node_modules/archiver-utils/node_modules/string_decoder/LICENSE +0 -48
  666. package/node_modules/archiver-utils/node_modules/string_decoder/README.md +0 -47
  667. package/node_modules/archiver-utils/node_modules/string_decoder/lib/string_decoder.js +0 -296
  668. package/node_modules/archiver-utils/node_modules/string_decoder/package.json +0 -31
  669. package/node_modules/archiver-utils/package.json +0 -54
  670. package/node_modules/async/CHANGELOG.md +0 -351
  671. package/node_modules/async/LICENSE +0 -19
  672. package/node_modules/async/README.md +0 -59
  673. package/node_modules/async/all.js +0 -119
  674. package/node_modules/async/allLimit.js +0 -46
  675. package/node_modules/async/allSeries.js +0 -45
  676. package/node_modules/async/any.js +0 -122
  677. package/node_modules/async/anyLimit.js +0 -47
  678. package/node_modules/async/anySeries.js +0 -46
  679. package/node_modules/async/apply.js +0 -11
  680. package/node_modules/async/applyEach.js +0 -57
  681. package/node_modules/async/applyEachSeries.js +0 -37
  682. package/node_modules/async/asyncify.js +0 -118
  683. package/node_modules/async/auto.js +0 -333
  684. package/node_modules/async/autoInject.js +0 -182
  685. package/node_modules/async/bower.json +0 -17
  686. package/node_modules/async/cargo.js +0 -63
  687. package/node_modules/async/cargoQueue.js +0 -71
  688. package/node_modules/async/compose.js +0 -55
  689. package/node_modules/async/concat.js +0 -115
  690. package/node_modules/async/concatLimit.js +0 -60
  691. package/node_modules/async/concatSeries.js +0 -41
  692. package/node_modules/async/constant.js +0 -14
  693. package/node_modules/async/detect.js +0 -96
  694. package/node_modules/async/detectLimit.js +0 -48
  695. package/node_modules/async/detectSeries.js +0 -47
  696. package/node_modules/async/dir.js +0 -43
  697. package/node_modules/async/dist/async.js +0 -6061
  698. package/node_modules/async/dist/async.min.js +0 -1
  699. package/node_modules/async/dist/async.mjs +0 -5948
  700. package/node_modules/async/doDuring.js +0 -68
  701. package/node_modules/async/doUntil.js +0 -46
  702. package/node_modules/async/doWhilst.js +0 -68
  703. package/node_modules/async/during.js +0 -78
  704. package/node_modules/async/each.js +0 -129
  705. package/node_modules/async/eachLimit.js +0 -50
  706. package/node_modules/async/eachOf.js +0 -185
  707. package/node_modules/async/eachOfLimit.js +0 -47
  708. package/node_modules/async/eachOfSeries.js +0 -39
  709. package/node_modules/async/eachSeries.js +0 -44
  710. package/node_modules/async/ensureAsync.js +0 -67
  711. package/node_modules/async/every.js +0 -119
  712. package/node_modules/async/everyLimit.js +0 -46
  713. package/node_modules/async/everySeries.js +0 -45
  714. package/node_modules/async/filter.js +0 -93
  715. package/node_modules/async/filterLimit.js +0 -45
  716. package/node_modules/async/filterSeries.js +0 -43
  717. package/node_modules/async/find.js +0 -96
  718. package/node_modules/async/findLimit.js +0 -48
  719. package/node_modules/async/findSeries.js +0 -47
  720. package/node_modules/async/flatMap.js +0 -115
  721. package/node_modules/async/flatMapLimit.js +0 -60
  722. package/node_modules/async/flatMapSeries.js +0 -41
  723. package/node_modules/async/foldl.js +0 -153
  724. package/node_modules/async/foldr.js +0 -41
  725. package/node_modules/async/forEach.js +0 -129
  726. package/node_modules/async/forEachLimit.js +0 -50
  727. package/node_modules/async/forEachOf.js +0 -185
  728. package/node_modules/async/forEachOfLimit.js +0 -47
  729. package/node_modules/async/forEachOfSeries.js +0 -39
  730. package/node_modules/async/forEachSeries.js +0 -44
  731. package/node_modules/async/forever.js +0 -68
  732. package/node_modules/async/groupBy.js +0 -108
  733. package/node_modules/async/groupByLimit.js +0 -71
  734. package/node_modules/async/groupBySeries.js +0 -36
  735. package/node_modules/async/index.js +0 -588
  736. package/node_modules/async/inject.js +0 -153
  737. package/node_modules/async/internal/DoublyLinkedList.js +0 -92
  738. package/node_modules/async/internal/Heap.js +0 -120
  739. package/node_modules/async/internal/applyEach.js +0 -29
  740. package/node_modules/async/internal/asyncEachOfLimit.js +0 -75
  741. package/node_modules/async/internal/awaitify.js +0 -28
  742. package/node_modules/async/internal/breakLoop.js +0 -10
  743. package/node_modules/async/internal/consoleFunc.js +0 -31
  744. package/node_modules/async/internal/createTester.js +0 -40
  745. package/node_modules/async/internal/eachOfLimit.js +0 -90
  746. package/node_modules/async/internal/filter.js +0 -55
  747. package/node_modules/async/internal/getIterator.js +0 -11
  748. package/node_modules/async/internal/initialParams.js +0 -14
  749. package/node_modules/async/internal/isArrayLike.js +0 -10
  750. package/node_modules/async/internal/iterator.js +0 -57
  751. package/node_modules/async/internal/map.js +0 -30
  752. package/node_modules/async/internal/once.js +0 -17
  753. package/node_modules/async/internal/onlyOnce.js +0 -15
  754. package/node_modules/async/internal/parallel.js +0 -34
  755. package/node_modules/async/internal/promiseCallback.js +0 -23
  756. package/node_modules/async/internal/queue.js +0 -294
  757. package/node_modules/async/internal/range.js +0 -14
  758. package/node_modules/async/internal/reject.js +0 -26
  759. package/node_modules/async/internal/setImmediate.js +0 -34
  760. package/node_modules/async/internal/withoutIndex.js +0 -10
  761. package/node_modules/async/internal/wrapAsync.js +0 -34
  762. package/node_modules/async/log.js +0 -41
  763. package/node_modules/async/map.js +0 -142
  764. package/node_modules/async/mapLimit.js +0 -45
  765. package/node_modules/async/mapSeries.js +0 -44
  766. package/node_modules/async/mapValues.js +0 -152
  767. package/node_modules/async/mapValuesLimit.js +0 -61
  768. package/node_modules/async/mapValuesSeries.js +0 -37
  769. package/node_modules/async/memoize.js +0 -91
  770. package/node_modules/async/nextTick.js +0 -52
  771. package/node_modules/async/package.json +0 -75
  772. package/node_modules/async/parallel.js +0 -180
  773. package/node_modules/async/parallelLimit.js +0 -41
  774. package/node_modules/async/priorityQueue.js +0 -60
  775. package/node_modules/async/queue.js +0 -24
  776. package/node_modules/async/race.js +0 -67
  777. package/node_modules/async/reduce.js +0 -153
  778. package/node_modules/async/reduceRight.js +0 -41
  779. package/node_modules/async/reflect.js +0 -78
  780. package/node_modules/async/reflectAll.js +0 -93
  781. package/node_modules/async/reject.js +0 -87
  782. package/node_modules/async/rejectLimit.js +0 -45
  783. package/node_modules/async/rejectSeries.js +0 -43
  784. package/node_modules/async/retry.js +0 -159
  785. package/node_modules/async/retryable.js +0 -77
  786. package/node_modules/async/select.js +0 -93
  787. package/node_modules/async/selectLimit.js +0 -45
  788. package/node_modules/async/selectSeries.js +0 -43
  789. package/node_modules/async/seq.js +0 -79
  790. package/node_modules/async/series.js +0 -186
  791. package/node_modules/async/setImmediate.js +0 -45
  792. package/node_modules/async/some.js +0 -122
  793. package/node_modules/async/someLimit.js +0 -47
  794. package/node_modules/async/someSeries.js +0 -46
  795. package/node_modules/async/sortBy.js +0 -190
  796. package/node_modules/async/timeout.js +0 -89
  797. package/node_modules/async/times.js +0 -50
  798. package/node_modules/async/timesLimit.js +0 -43
  799. package/node_modules/async/timesSeries.js +0 -32
  800. package/node_modules/async/transform.js +0 -173
  801. package/node_modules/async/tryEach.js +0 -78
  802. package/node_modules/async/unmemoize.js +0 -25
  803. package/node_modules/async/until.js +0 -61
  804. package/node_modules/async/waterfall.js +0 -105
  805. package/node_modules/async/whilst.js +0 -78
  806. package/node_modules/async/wrapSync.js +0 -118
  807. package/node_modules/big-integer/BigInteger.d.ts +0 -2393
  808. package/node_modules/big-integer/BigInteger.js +0 -1453
  809. package/node_modules/big-integer/BigInteger.min.js +0 -1
  810. package/node_modules/big-integer/LICENSE +0 -24
  811. package/node_modules/big-integer/README.md +0 -589
  812. package/node_modules/big-integer/bower.json +0 -29
  813. package/node_modules/big-integer/package.json +0 -48
  814. package/node_modules/big-integer/tsconfig.json +0 -24
  815. package/node_modules/binary/.npmignore +0 -1
  816. package/node_modules/binary/.travis.yml +0 -4
  817. package/node_modules/binary/README.markdown +0 -177
  818. package/node_modules/binary/example/buf.js +0 -11
  819. package/node_modules/binary/example/parse.js +0 -10
  820. package/node_modules/binary/example/stream.js +0 -12
  821. package/node_modules/binary/index.js +0 -397
  822. package/node_modules/binary/lib/vars.js +0 -28
  823. package/node_modules/binary/package.json +0 -38
  824. package/node_modules/binary/perf/loop.js +0 -92
  825. package/node_modules/binary/perf/small.js +0 -80
  826. package/node_modules/binary/test/bu.js +0 -46
  827. package/node_modules/binary/test/deferred.js +0 -20
  828. package/node_modules/binary/test/dots.js +0 -23
  829. package/node_modules/binary/test/eof.js +0 -41
  830. package/node_modules/binary/test/flush.js +0 -17
  831. package/node_modules/binary/test/from_buffer.js +0 -14
  832. package/node_modules/binary/test/get_buffer.js +0 -28
  833. package/node_modules/binary/test/immediate.js +0 -18
  834. package/node_modules/binary/test/interval.js +0 -38
  835. package/node_modules/binary/test/into_buffer.js +0 -35
  836. package/node_modules/binary/test/into_stream.js +0 -43
  837. package/node_modules/binary/test/loop.js +0 -44
  838. package/node_modules/binary/test/loop_scan.js +0 -54
  839. package/node_modules/binary/test/lu.js +0 -46
  840. package/node_modules/binary/test/negbs.js +0 -29
  841. package/node_modules/binary/test/negls.js +0 -29
  842. package/node_modules/binary/test/nested.js +0 -35
  843. package/node_modules/binary/test/not_enough_buf.js +0 -17
  844. package/node_modules/binary/test/not_enough_parse.js +0 -19
  845. package/node_modules/binary/test/parse.js +0 -54
  846. package/node_modules/binary/test/peek.js +0 -40
  847. package/node_modules/binary/test/pipe.js +0 -49
  848. package/node_modules/binary/test/posbs.js +0 -29
  849. package/node_modules/binary/test/posls.js +0 -29
  850. package/node_modules/binary/test/scan.js +0 -33
  851. package/node_modules/binary/test/scan_buf.js +0 -18
  852. package/node_modules/binary/test/scan_buf_null.js +0 -16
  853. package/node_modules/binary/test/skip.js +0 -58
  854. package/node_modules/binary/test/split.js +0 -34
  855. package/node_modules/bl/.travis.yml +0 -17
  856. package/node_modules/bl/BufferList.js +0 -396
  857. package/node_modules/bl/LICENSE.md +0 -13
  858. package/node_modules/bl/README.md +0 -247
  859. package/node_modules/bl/bl.js +0 -84
  860. package/node_modules/bl/package.json +0 -37
  861. package/node_modules/bl/test/convert.js +0 -21
  862. package/node_modules/bl/test/indexOf.js +0 -492
  863. package/node_modules/bl/test/isBufferList.js +0 -32
  864. package/node_modules/bl/test/test.js +0 -869
  865. package/node_modules/buffer-crc32/LICENSE +0 -19
  866. package/node_modules/buffer-crc32/README.md +0 -47
  867. package/node_modules/buffer-crc32/index.js +0 -111
  868. package/node_modules/buffer-crc32/package.json +0 -39
  869. package/node_modules/buffer-indexof-polyfill/.eslintrc +0 -33
  870. package/node_modules/buffer-indexof-polyfill/.travis.yml +0 -17
  871. package/node_modules/buffer-indexof-polyfill/LICENSE +0 -22
  872. package/node_modules/buffer-indexof-polyfill/README.md +0 -33
  873. package/node_modules/buffer-indexof-polyfill/index.js +0 -73
  874. package/node_modules/buffer-indexof-polyfill/init-buffer.js +0 -8
  875. package/node_modules/buffer-indexof-polyfill/package.json +0 -34
  876. package/node_modules/buffer-indexof-polyfill/test/indexof.js +0 -128
  877. package/node_modules/buffers/README.markdown +0 -122
  878. package/node_modules/buffers/examples/slice.js +0 -9
  879. package/node_modules/buffers/examples/splice.js +0 -17
  880. package/node_modules/buffers/index.js +0 -269
  881. package/node_modules/buffers/package.json +0 -14
  882. package/node_modules/buffers/test/buffers.js +0 -209
  883. package/node_modules/chainsaw/.npmignore +0 -1
  884. package/node_modules/chainsaw/README.markdown +0 -157
  885. package/node_modules/chainsaw/examples/add_do.js +0 -25
  886. package/node_modules/chainsaw/examples/prompt.js +0 -67
  887. package/node_modules/chainsaw/index.js +0 -145
  888. package/node_modules/chainsaw/package.json +0 -23
  889. package/node_modules/chainsaw/test/chainsaw.js +0 -418
  890. package/node_modules/concat-map/.travis.yml +0 -4
  891. package/node_modules/concat-map/LICENSE +0 -18
  892. package/node_modules/concat-map/README.markdown +0 -62
  893. package/node_modules/concat-map/example/map.js +0 -6
  894. package/node_modules/concat-map/index.js +0 -13
  895. package/node_modules/concat-map/package.json +0 -43
  896. package/node_modules/concat-map/test/map.js +0 -39
  897. package/node_modules/end-of-stream/LICENSE +0 -21
  898. package/node_modules/end-of-stream/README.md +0 -54
  899. package/node_modules/end-of-stream/index.js +0 -96
  900. package/node_modules/end-of-stream/package.json +0 -37
  901. package/node_modules/fs-constants/LICENSE +0 -21
  902. package/node_modules/fs-constants/README.md +0 -26
  903. package/node_modules/fs-constants/browser.js +0 -1
  904. package/node_modules/fs-constants/index.js +0 -1
  905. package/node_modules/fs-constants/package.json +0 -19
  906. package/node_modules/fs.realpath/LICENSE +0 -43
  907. package/node_modules/fs.realpath/README.md +0 -33
  908. package/node_modules/fs.realpath/index.js +0 -66
  909. package/node_modules/fs.realpath/old.js +0 -303
  910. package/node_modules/fs.realpath/package.json +0 -26
  911. package/node_modules/fstream/.travis.yml +0 -9
  912. package/node_modules/fstream/LICENSE +0 -15
  913. package/node_modules/fstream/README.md +0 -76
  914. package/node_modules/fstream/examples/filter-pipe.js +0 -134
  915. package/node_modules/fstream/examples/pipe.js +0 -118
  916. package/node_modules/fstream/examples/reader.js +0 -68
  917. package/node_modules/fstream/examples/symlink-write.js +0 -27
  918. package/node_modules/fstream/fstream.js +0 -35
  919. package/node_modules/fstream/lib/abstract.js +0 -85
  920. package/node_modules/fstream/lib/collect.js +0 -70
  921. package/node_modules/fstream/lib/dir-reader.js +0 -252
  922. package/node_modules/fstream/lib/dir-writer.js +0 -174
  923. package/node_modules/fstream/lib/file-reader.js +0 -150
  924. package/node_modules/fstream/lib/file-writer.js +0 -107
  925. package/node_modules/fstream/lib/get-type.js +0 -33
  926. package/node_modules/fstream/lib/link-reader.js +0 -53
  927. package/node_modules/fstream/lib/link-writer.js +0 -95
  928. package/node_modules/fstream/lib/proxy-reader.js +0 -95
  929. package/node_modules/fstream/lib/proxy-writer.js +0 -111
  930. package/node_modules/fstream/lib/reader.js +0 -255
  931. package/node_modules/fstream/lib/socket-reader.js +0 -36
  932. package/node_modules/fstream/lib/writer.js +0 -390
  933. package/node_modules/fstream/package.json +0 -28
  934. package/node_modules/glob/LICENSE +0 -21
  935. package/node_modules/glob/README.md +0 -378
  936. package/node_modules/glob/common.js +0 -238
  937. package/node_modules/glob/glob.js +0 -790
  938. package/node_modules/glob/node_modules/balanced-match/.github/FUNDING.yml +0 -2
  939. package/node_modules/glob/node_modules/balanced-match/LICENSE.md +0 -21
  940. package/node_modules/glob/node_modules/balanced-match/README.md +0 -97
  941. package/node_modules/glob/node_modules/balanced-match/index.js +0 -62
  942. package/node_modules/glob/node_modules/balanced-match/package.json +0 -48
  943. package/node_modules/glob/node_modules/brace-expansion/LICENSE +0 -21
  944. package/node_modules/glob/node_modules/brace-expansion/README.md +0 -151
  945. package/node_modules/glob/node_modules/brace-expansion/index.js +0 -438
  946. package/node_modules/glob/node_modules/brace-expansion/package.json +0 -50
  947. package/node_modules/glob/node_modules/minimatch/LICENSE +0 -15
  948. package/node_modules/glob/node_modules/minimatch/README.md +0 -267
  949. package/node_modules/glob/node_modules/minimatch/minimatch.js +0 -1005
  950. package/node_modules/glob/node_modules/minimatch/package.json +0 -33
  951. package/node_modules/glob/package.json +0 -55
  952. package/node_modules/glob/sync.js +0 -486
  953. package/node_modules/inflight/LICENSE +0 -15
  954. package/node_modules/inflight/README.md +0 -37
  955. package/node_modules/inflight/inflight.js +0 -54
  956. package/node_modules/inflight/package.json +0 -29
  957. package/node_modules/lazystream/LICENSE +0 -23
  958. package/node_modules/lazystream/README.md +0 -114
  959. package/node_modules/lazystream/lib/lazystream.js +0 -54
  960. package/node_modules/lazystream/node_modules/readable-stream/.travis.yml +0 -34
  961. package/node_modules/lazystream/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  962. package/node_modules/lazystream/node_modules/readable-stream/GOVERNANCE.md +0 -136
  963. package/node_modules/lazystream/node_modules/readable-stream/README.md +0 -58
  964. package/node_modules/lazystream/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  965. package/node_modules/lazystream/node_modules/readable-stream/duplex-browser.js +0 -1
  966. package/node_modules/lazystream/node_modules/readable-stream/duplex.js +0 -1
  967. package/node_modules/lazystream/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
  968. package/node_modules/lazystream/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
  969. package/node_modules/lazystream/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
  970. package/node_modules/lazystream/node_modules/readable-stream/lib/_stream_transform.js +0 -214
  971. package/node_modules/lazystream/node_modules/readable-stream/lib/_stream_writable.js +0 -685
  972. package/node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -78
  973. package/node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -84
  974. package/node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  975. package/node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  976. package/node_modules/lazystream/node_modules/readable-stream/package.json +0 -52
  977. package/node_modules/lazystream/node_modules/readable-stream/passthrough.js +0 -1
  978. package/node_modules/lazystream/node_modules/readable-stream/readable-browser.js +0 -7
  979. package/node_modules/lazystream/node_modules/readable-stream/readable.js +0 -19
  980. package/node_modules/lazystream/node_modules/readable-stream/transform.js +0 -1
  981. package/node_modules/lazystream/node_modules/readable-stream/writable-browser.js +0 -1
  982. package/node_modules/lazystream/node_modules/readable-stream/writable.js +0 -8
  983. package/node_modules/lazystream/node_modules/safe-buffer/LICENSE +0 -21
  984. package/node_modules/lazystream/node_modules/safe-buffer/README.md +0 -584
  985. package/node_modules/lazystream/node_modules/safe-buffer/index.d.ts +0 -187
  986. package/node_modules/lazystream/node_modules/safe-buffer/index.js +0 -62
  987. package/node_modules/lazystream/node_modules/safe-buffer/package.json +0 -37
  988. package/node_modules/lazystream/node_modules/string_decoder/.travis.yml +0 -50
  989. package/node_modules/lazystream/node_modules/string_decoder/LICENSE +0 -48
  990. package/node_modules/lazystream/node_modules/string_decoder/README.md +0 -47
  991. package/node_modules/lazystream/node_modules/string_decoder/lib/string_decoder.js +0 -296
  992. package/node_modules/lazystream/node_modules/string_decoder/package.json +0 -31
  993. package/node_modules/lazystream/package.json +0 -46
  994. package/node_modules/lazystream/test/data.md +0 -13
  995. package/node_modules/lazystream/test/fs_test.js +0 -69
  996. package/node_modules/lazystream/test/helper.js +0 -39
  997. package/node_modules/lazystream/test/pipe_test.js +0 -36
  998. package/node_modules/lazystream/test/readable_test.js +0 -90
  999. package/node_modules/lazystream/test/writable_test.js +0 -59
  1000. package/node_modules/listenercount/.npmignore +0 -2
  1001. package/node_modules/listenercount/LICENSE.md +0 -5
  1002. package/node_modules/listenercount/README.md +0 -50
  1003. package/node_modules/listenercount/circle.yml +0 -6
  1004. package/node_modules/listenercount/index.js +0 -16
  1005. package/node_modules/listenercount/package.json +0 -27
  1006. package/node_modules/listenercount/test/test.js +0 -31
  1007. package/node_modules/lodash.defaults/LICENSE +0 -47
  1008. package/node_modules/lodash.defaults/README.md +0 -18
  1009. package/node_modules/lodash.defaults/index.js +0 -668
  1010. package/node_modules/lodash.defaults/package.json +0 -17
  1011. package/node_modules/lodash.difference/LICENSE +0 -47
  1012. package/node_modules/lodash.difference/README.md +0 -18
  1013. package/node_modules/lodash.difference/index.js +0 -1170
  1014. package/node_modules/lodash.difference/package.json +0 -17
  1015. package/node_modules/lodash.flatten/LICENSE +0 -47
  1016. package/node_modules/lodash.flatten/README.md +0 -18
  1017. package/node_modules/lodash.flatten/index.js +0 -349
  1018. package/node_modules/lodash.flatten/package.json +0 -17
  1019. package/node_modules/lodash.isplainobject/LICENSE +0 -47
  1020. package/node_modules/lodash.isplainobject/README.md +0 -18
  1021. package/node_modules/lodash.isplainobject/index.js +0 -139
  1022. package/node_modules/lodash.isplainobject/package.json +0 -17
  1023. package/node_modules/lodash.union/LICENSE +0 -47
  1024. package/node_modules/lodash.union/README.md +0 -18
  1025. package/node_modules/lodash.union/index.js +0 -1181
  1026. package/node_modules/lodash.union/package.json +0 -17
  1027. package/node_modules/minimist/.eslintrc +0 -29
  1028. package/node_modules/minimist/.github/FUNDING.yml +0 -12
  1029. package/node_modules/minimist/.nycrc +0 -14
  1030. package/node_modules/minimist/CHANGELOG.md +0 -298
  1031. package/node_modules/minimist/LICENSE +0 -18
  1032. package/node_modules/minimist/README.md +0 -121
  1033. package/node_modules/minimist/example/parse.js +0 -4
  1034. package/node_modules/minimist/index.js +0 -263
  1035. package/node_modules/minimist/package.json +0 -75
  1036. package/node_modules/minimist/test/all_bool.js +0 -34
  1037. package/node_modules/minimist/test/bool.js +0 -177
  1038. package/node_modules/minimist/test/dash.js +0 -43
  1039. package/node_modules/minimist/test/default_bool.js +0 -37
  1040. package/node_modules/minimist/test/dotted.js +0 -24
  1041. package/node_modules/minimist/test/kv_short.js +0 -32
  1042. package/node_modules/minimist/test/long.js +0 -33
  1043. package/node_modules/minimist/test/num.js +0 -38
  1044. package/node_modules/minimist/test/parse.js +0 -209
  1045. package/node_modules/minimist/test/parse_modified.js +0 -11
  1046. package/node_modules/minimist/test/proto.js +0 -64
  1047. package/node_modules/minimist/test/short.js +0 -69
  1048. package/node_modules/minimist/test/stop_early.js +0 -17
  1049. package/node_modules/minimist/test/unknown.js +0 -104
  1050. package/node_modules/minimist/test/whitespace.js +0 -10
  1051. package/node_modules/mkdirp/LICENSE +0 -21
  1052. package/node_modules/mkdirp/bin/cmd.js +0 -33
  1053. package/node_modules/mkdirp/bin/usage.txt +0 -12
  1054. package/node_modules/mkdirp/index.js +0 -102
  1055. package/node_modules/mkdirp/package.json +0 -33
  1056. package/node_modules/mkdirp/readme.markdown +0 -100
  1057. package/node_modules/once/LICENSE +0 -15
  1058. package/node_modules/once/README.md +0 -79
  1059. package/node_modules/once/once.js +0 -42
  1060. package/node_modules/once/package.json +0 -33
  1061. package/node_modules/path-is-absolute/index.js +0 -20
  1062. package/node_modules/path-is-absolute/license +0 -21
  1063. package/node_modules/path-is-absolute/package.json +0 -43
  1064. package/node_modules/path-is-absolute/readme.md +0 -59
  1065. package/node_modules/readdir-glob/LICENSE +0 -201
  1066. package/node_modules/readdir-glob/README.md +0 -85
  1067. package/node_modules/readdir-glob/index.js +0 -243
  1068. package/node_modules/readdir-glob/node_modules/balanced-match/.github/FUNDING.yml +0 -2
  1069. package/node_modules/readdir-glob/node_modules/balanced-match/LICENSE.md +0 -21
  1070. package/node_modules/readdir-glob/node_modules/balanced-match/README.md +0 -97
  1071. package/node_modules/readdir-glob/node_modules/balanced-match/index.js +0 -62
  1072. package/node_modules/readdir-glob/node_modules/balanced-match/package.json +0 -48
  1073. package/node_modules/readdir-glob/node_modules/brace-expansion/.github/FUNDING.yml +0 -2
  1074. package/node_modules/readdir-glob/node_modules/brace-expansion/LICENSE +0 -21
  1075. package/node_modules/readdir-glob/node_modules/brace-expansion/README.md +0 -157
  1076. package/node_modules/readdir-glob/node_modules/brace-expansion/index.js +0 -394
  1077. package/node_modules/readdir-glob/node_modules/brace-expansion/package.json +0 -49
  1078. package/node_modules/readdir-glob/node_modules/minimatch/LICENSE +0 -15
  1079. package/node_modules/readdir-glob/node_modules/minimatch/README.md +0 -296
  1080. package/node_modules/readdir-glob/node_modules/minimatch/lib/path.js +0 -4
  1081. package/node_modules/readdir-glob/node_modules/minimatch/minimatch.js +0 -996
  1082. package/node_modules/readdir-glob/node_modules/minimatch/package.json +0 -35
  1083. package/node_modules/readdir-glob/package.json +0 -43
  1084. package/node_modules/rimraf/LICENSE +0 -15
  1085. package/node_modules/rimraf/README.md +0 -101
  1086. package/node_modules/rimraf/bin.js +0 -50
  1087. package/node_modules/rimraf/package.json +0 -29
  1088. package/node_modules/rimraf/rimraf.js +0 -372
  1089. package/node_modules/tar-stream/LICENSE +0 -21
  1090. package/node_modules/tar-stream/README.md +0 -168
  1091. package/node_modules/tar-stream/extract.js +0 -257
  1092. package/node_modules/tar-stream/headers.js +0 -295
  1093. package/node_modules/tar-stream/index.js +0 -2
  1094. package/node_modules/tar-stream/pack.js +0 -255
  1095. package/node_modules/tar-stream/package.json +0 -58
  1096. package/node_modules/tar-stream/sandbox.js +0 -11
  1097. package/node_modules/traverse/.npmignore +0 -1
  1098. package/node_modules/traverse/LICENSE +0 -24
  1099. package/node_modules/traverse/README.markdown +0 -247
  1100. package/node_modules/traverse/examples/json.js +0 -16
  1101. package/node_modules/traverse/examples/leaves.js +0 -15
  1102. package/node_modules/traverse/examples/negative.js +0 -8
  1103. package/node_modules/traverse/examples/stringify.js +0 -38
  1104. package/node_modules/traverse/index.js +0 -322
  1105. package/node_modules/traverse/package.json +0 -18
  1106. package/node_modules/traverse/test/circular.js +0 -114
  1107. package/node_modules/traverse/test/date.js +0 -35
  1108. package/node_modules/traverse/test/equal.js +0 -219
  1109. package/node_modules/traverse/test/instance.js +0 -17
  1110. package/node_modules/traverse/test/interface.js +0 -42
  1111. package/node_modules/traverse/test/json.js +0 -47
  1112. package/node_modules/traverse/test/leaves.js +0 -21
  1113. package/node_modules/traverse/test/mutability.js +0 -203
  1114. package/node_modules/traverse/test/negative.js +0 -20
  1115. package/node_modules/traverse/test/obj.js +0 -15
  1116. package/node_modules/traverse/test/stop.js +0 -41
  1117. package/node_modules/traverse/test/stringify.js +0 -36
  1118. package/node_modules/traverse/test/super_deep.js +0 -54
  1119. package/node_modules/unzipper/.circleci/config.yml +0 -13
  1120. package/node_modules/unzipper/.travis.yml +0 -21
  1121. package/node_modules/unzipper/lib/Buffer.js +0 -12
  1122. package/node_modules/unzipper/node_modules/readable-stream/.travis.yml +0 -34
  1123. package/node_modules/unzipper/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  1124. package/node_modules/unzipper/node_modules/readable-stream/GOVERNANCE.md +0 -136
  1125. package/node_modules/unzipper/node_modules/readable-stream/README.md +0 -58
  1126. package/node_modules/unzipper/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  1127. package/node_modules/unzipper/node_modules/readable-stream/duplex-browser.js +0 -1
  1128. package/node_modules/unzipper/node_modules/readable-stream/duplex.js +0 -1
  1129. package/node_modules/unzipper/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
  1130. package/node_modules/unzipper/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
  1131. package/node_modules/unzipper/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
  1132. package/node_modules/unzipper/node_modules/readable-stream/lib/_stream_transform.js +0 -214
  1133. package/node_modules/unzipper/node_modules/readable-stream/lib/_stream_writable.js +0 -685
  1134. package/node_modules/unzipper/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -78
  1135. package/node_modules/unzipper/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -84
  1136. package/node_modules/unzipper/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  1137. package/node_modules/unzipper/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  1138. package/node_modules/unzipper/node_modules/readable-stream/package.json +0 -52
  1139. package/node_modules/unzipper/node_modules/readable-stream/passthrough.js +0 -1
  1140. package/node_modules/unzipper/node_modules/readable-stream/readable-browser.js +0 -7
  1141. package/node_modules/unzipper/node_modules/readable-stream/readable.js +0 -19
  1142. package/node_modules/unzipper/node_modules/readable-stream/transform.js +0 -1
  1143. package/node_modules/unzipper/node_modules/readable-stream/writable-browser.js +0 -1
  1144. package/node_modules/unzipper/node_modules/readable-stream/writable.js +0 -8
  1145. package/node_modules/unzipper/node_modules/safe-buffer/LICENSE +0 -21
  1146. package/node_modules/unzipper/node_modules/safe-buffer/README.md +0 -584
  1147. package/node_modules/unzipper/node_modules/safe-buffer/index.d.ts +0 -187
  1148. package/node_modules/unzipper/node_modules/safe-buffer/index.js +0 -62
  1149. package/node_modules/unzipper/node_modules/safe-buffer/package.json +0 -37
  1150. package/node_modules/unzipper/node_modules/string_decoder/.travis.yml +0 -50
  1151. package/node_modules/unzipper/node_modules/string_decoder/LICENSE +0 -48
  1152. package/node_modules/unzipper/node_modules/string_decoder/README.md +0 -47
  1153. package/node_modules/unzipper/node_modules/string_decoder/lib/string_decoder.js +0 -296
  1154. package/node_modules/unzipper/node_modules/string_decoder/package.json +0 -31
  1155. package/node_modules/wrappy/LICENSE +0 -15
  1156. package/node_modules/wrappy/README.md +0 -36
  1157. package/node_modules/wrappy/package.json +0 -29
  1158. package/node_modules/wrappy/wrappy.js +0 -33
  1159. package/node_modules/zip-stream/node_modules/archiver-utils/LICENSE +0 -22
  1160. package/node_modules/zip-stream/node_modules/archiver-utils/README.md +0 -6
  1161. package/node_modules/zip-stream/node_modules/archiver-utils/file.js +0 -209
  1162. package/node_modules/zip-stream/node_modules/archiver-utils/index.js +0 -149
  1163. package/node_modules/zip-stream/node_modules/archiver-utils/package.json +0 -54
  1164. /package/node_modules/{archiver-utils → compress-commons}/node_modules/readable-stream/LICENSE +0 -0
  1165. /package/node_modules/{lazystream → crc32-stream}/node_modules/readable-stream/LICENSE +0 -0
  1166. /package/node_modules/{unzipper → zip-stream}/node_modules/readable-stream/LICENSE +0 -0
@@ -8,7 +8,8 @@ import { waitForPaneCreatedOrError } from './agent/tools/pane.js';
8
8
  import { IntakeNotifications } from './intake/notifications.js';
9
9
  import { projectGoal } from './goal_contract.js';
10
10
  import { isToolResultMessage } from './utils/tool_result_message.js';
11
- import { formatTaskHandoffContext, projectTaskHandoff } from './session_handoff_contract.js';
11
+ import { layoutRestoreNotice } from './app/launch_notices.js';
12
+ import { formatTaskHandoffNotice, projectTaskHandoff } from './session_handoff_contract.js';
12
13
  /**
13
14
  * RatatuiApp — the interactive TUI application class.
14
15
  *
@@ -27,9 +28,10 @@ import { promisify } from 'util';
27
28
  import { configStore, resolveTerminalInteractionSettings } from './config.js';
28
29
  import { applyAccountOp, getAccountsPayloadWithCodexStatus } from './web/accounts_mirror.js';
29
30
  import { canonicalAccountProvider } from './agent/backends/account_pool.js';
31
+ import { normalizeProviderId } from './agent/backends/provider_ids.js';
30
32
  import { collectUsageViews, buildUsageViews, nativeUsageView } from './usage_projection.js';
31
33
  import { createUsageSnapshot, recordUsageReceipt } from './usage_snapshot.js';
32
- import { activeProfile, withActiveProfileArg } from './config/profiles.js';
34
+ import { withActiveProfileArg } from './config/profiles.js';
33
35
  import { DEFAULT_ROUTER_ORIGIN, RouterConfigurationError } from './router_auth.js';
34
36
  import { CODEX_REASONING_EFFORTS } from './config/types.js';
35
37
  import { getSupportedCodexReasoningEfforts, isCodexReasoningEffortSupported, unsupportedEffortMessage, } from './utils/models.js';
@@ -59,17 +61,28 @@ import { EvidenceLedger } from './agent/runtime/evidence.js';
59
61
  import { runtimePluginRegistry } from './plugin/runtime_registry.js';
60
62
  import { getMirrorCommandUsages, isRichSlashUsage } from './agent/commands/mirror_usages.js';
61
63
  import { createModeContext } from './agent/commands/mode_commands.js';
64
+ import { isLocalSubscription, isRouterOnlyProvider, modelRouteStatus } from './agent/commands/provider_choices.js';
65
+ import { isBuildableResolvedConfig } from './agent/commands/config.js';
66
+ import { promptForMissingDirectKey } from './agent/commands/direct_credential_prompt.js';
67
+ import { showConnectPrompt } from './agent/commands/connect.js';
68
+ import { onZergAILoginWaitChange, pendingZergAILogin, stopZergAILogin } from './agent/commands/auth.js';
69
+ import { connectionSnapshot } from './agent/commands/credential_status.js';
70
+ import { redactCredentialCommand } from './agent/commands/credential_redaction.js';
62
71
  import { goalManager, goalPinTask, detectGoalCompletion, detectGoalBlocked, goalBlockedReason, goalFinalNote, turnProducedText, turnToolOutcomes, shouldAccountFinalTurn, snapshotGoalForTurn } from './agent/commands/goal.js';
63
72
  import { allocatePlanArtifact, askPlanApproval, findPlanContent, generatePlanPath, commitPlan, PlanFileCreationError, } from './agent/commands/plan.js';
64
73
  import { setTodoUpdateCallback, clearTodoUpdateCallback, setPaneToolsTuiProcess, clearPaneToolsTuiProcess, setPaneToolsOwnId, setPaneToolsExitCallback, setPaneToolsMirrorCallback, setPaneToolsZdeLiteCallback, setPaneToolsPendingLaunchCallback, clearPaneToolsPendingLaunchCallback, setSupervisionManager, clearSupervisionManager, setBusTransport, clearBusTransport, setEvolutionTuiProcess, clearEvolutionTuiProcess, resetAskUserTurnFlag } from './agent/tools/index.js';
65
74
  import { shutdownLSPManager } from './lsp/index.js';
66
75
  import { zmuxKeymapPayload } from './config/keybindings.js';
67
76
  import { customPaneOptions } from './config/panes.js';
68
- import { CAPABILITY_DESKTOP_UPDATE_RESTART, CAPABILITY_DESKTOP_TASK_CONTROLS, CAPABILITY_DESKTOP_RUNTIME_CONTROLS, CAPABILITY_DESKTOP_SESSION_SHARE, isDesktopSessionShareAction, CAPABILITY_SCROLLBACK_ANCHOR, CAPABILITY_TERMINAL_INTERACTION, } from './ui/ratatui/protocol.js';
77
+ import { CAPABILITY_DESKTOP_UPDATE_RESTART, CAPABILITY_DESKTOP_TASK_CONTROLS, CAPABILITY_DESKTOP_RUNTIME_CONTROLS, CAPABILITY_DESKTOP_SESSION_SHARE, CAPABILITY_KITTY_GRAPHICS, isDesktopSessionShareAction, CAPABILITY_SCROLLBACK_ANCHOR, CAPABILITY_TERMINAL_INTERACTION, } from './ui/ratatui/protocol.js';
69
78
  import { writeClipboard } from './utils/clipboard.js';
70
79
  import { saveClipboardImagePng } from './utils/clipboard_image.js';
71
80
  import { loadEmulationProfiles, getEmulationProfile } from './emulation/catalog.js';
72
81
  import { buildToolGroupOutput } from './utils/tool_trace.js';
82
+ import { modelHandoffSummarizer } from './utils/compaction.js';
83
+ import { resolvePromptPrefixId } from './utils/compaction.js';
84
+ import { IDLE_COMPACT_DEFAULT_LEAD_MS, IDLE_COMPACT_MIN_CONTEXT_TOKENS, IdleCompactionScheduler, resolveCacheLifetimeMs, } from './utils/idle_compaction.js';
85
+ import { KittyImageUploads, kittyGraphicsTerminal, setTerminalImageMode, transcriptImagesForToolOutput } from './ui/terminal_image.js';
73
86
  import { insertText, insertBadge, expandPasteBadge, backspace, deleteForward, moveLeft, moveRight, moveWordLeft, moveWordRight, moveToStart, moveToEnd, moveToLineStart, moveToLineEnd, killToLineStart, killToLineEnd, moveVertical, wordBeforeCaret, wordAfterCaret, deleteWordBackward, deleteWordForward, getPlainText, serializeSegments, serializeMessageInput, textCursorIndex, killInputDraft, yankInputKill, historyUp, historyDown, PASTE_BADGE_THRESHOLD, } from './ui/core/input_segments.js';
74
87
  import { findAtMention, completeAtMention, applyAtMention } from './utils/at_mention.js';
75
88
  import { DEFAULT_SPINNER_VERBS } from './utils/spinner_verbs.js';
@@ -101,6 +114,7 @@ import { advanceEscapeStop, isEscapeStopArmed, ESCAPE_STOP_WINDOW_MS } from './a
101
114
  import { createAgentWithConfig, AgentRunLifecycle } from './app/agent_runner.js';
102
115
  import { classifyBusyInput } from './app/task_scope_router.js';
103
116
  import { hasWorkspaceCollisionRisk, inspectWorkspaceSessions, LocalWorkspaceCoordinator, prepareWorkspaceIsolation, WorkspaceIsolationError } from './workspace_collision.js';
117
+ import { describeWorkspaceOverlap } from './app/workspace_admission_details.js';
104
118
  import { mergeToolCheckpointMessages } from './agent/runtime/tool_checkpoints.js';
105
119
  import { clearWorkerExecutor } from './worker/index.js';
106
120
  import { isPhantomCompletion } from './app/phantom_completion.js';
@@ -114,6 +128,7 @@ import { getBackgroundRegistry, clearBackgroundRegistry } from './agent/tools/in
114
128
  import { getCurrentBatch, clearCurrentBatch } from './batch/index.js';
115
129
  import { getWorkflowRegistry } from './workflows/registry_handle.js';
116
130
  import { SessionManager } from './app/session_manager.js';
131
+ import { interruptedTurnMarker } from './app/session_messages.js';
117
132
  import { createWorkspaceLayoutController } from './app/workspace_layout_controller.js';
118
133
  import { linkWorkspaceAgentSessions, resolveWorkspaceAgentSession } from './workspace_agent.js';
119
134
  import { hostedSessionSettingsEqual, hostedSettingsConfigPatch, isHostedMuxCommandAllowed, parseHostedSessionSettings, } from './hosted/session_settings.js';
@@ -127,7 +142,12 @@ import { applyAgentEventToState, buildActivityDisplayState, formatApiRetryNotice
127
142
  import { PromptTurn } from './app/prompt_turn.js';
128
143
  import { resolveStallHintMs } from './app/liveness.js';
129
144
  import { openUrlInBrowser } from './utils/open_url.js';
130
- import { buildCredentialSetupMessage, buildNoCredentialsWelcome, buildReadyWelcome, buildResumedWelcome, buildSavedSessionNotice, createFirstRunLaunchMessage, excludePrintedFirstRunWelcome, shouldDeferFirstRunScrollback, } from './onboarding/first_run.js';
145
+ import { canAskAtLaunch } from './utils/session_interactivity.js';
146
+ import { buildCredentialSetupMessage, buildNoCredentialsWelcome, buildReadyWelcome, buildResumedWelcome, createFirstRunLaunchMessage, excludePrintedFirstRunWelcome, shouldDeferFirstRunScrollback, } from './onboarding/first_run.js';
147
+ import { routerLoginTip, routerTipForError } from './onboarding/router_tips.js';
148
+ import { askHowToConnectAtLaunch } from './onboarding/zergai_login.js';
149
+ /** A Zerg Router login tip stays in the status line long enough to read. */
150
+ const ROUTER_TIP_TOAST_MS = 12_000;
131
151
  import { selectCurrentTranscriptMessages, selectFallbackLiveMessages, } from './app/transcript_window.js';
132
152
  export { openUrlInBrowser } from './utils/open_url.js';
133
153
  export { LIVE_TRANSCRIPT_LIMIT, isRecapMessage, liveWindowBoundary, selectCurrentTranscriptMessages, selectFallbackLiveMessages, } from './app/transcript_window.js';
@@ -138,7 +158,7 @@ import { clearStaleTodosOnBoot, normalizeTodoItems } from './app/todo_state.js';
138
158
  import { writePaneResponseSync } from './utils/pane_response.js';
139
159
  import { registerInstance, deregisterInstance, loadInstances, updateInstance, heartbeatInstance, reapStoppedInstances, INSTANCE_HEARTBEAT_MS, } from './instance_registry.js';
140
160
  import { loadPreviewsForInstances } from './navigator_preview.js';
141
- import { FormWidget, SelectWidget, TextInputWidget, QuestionnaireWidget, PromptViewerWidget, LogViewWidget } from './ui/widgets/index.js';
161
+ import { FormWidget, SelectWidget, selectOptionSummary, TextInputWidget, QuestionnaireWidget, PromptViewerWidget, LogViewWidget } from './ui/widgets/index.js';
142
162
  import { SettingsPanelWidget } from './ui/widgets/settings_panel.js';
143
163
  import { StatusLinePanelWidget } from './ui/widgets/status_line_panel.js';
144
164
  import { ColorPanelWidget } from './ui/widgets/color_panel.js';
@@ -181,7 +201,7 @@ if (TRANSCRIPT_DEBUG_ENABLED) {
181
201
  writeFileSync(TRANSCRIPT_DEBUG_LOG_FILE, `[${new Date().toISOString()}] transcript debug PID=${process.pid}\n`);
182
202
  }
183
203
  export { debugLog, getLogBuffer } from './utils/debug_log.js';
184
- import { debugLog, getLogBuffer } from './utils/debug_log.js';
204
+ import { debugLog, describeInputForLog, getLogBuffer } from './utils/debug_log.js';
185
205
  function transcriptHash(value) {
186
206
  let hash = 2166136261;
187
207
  for (let i = 0; i < value.length; i++) {
@@ -243,6 +263,36 @@ const GENERATION_CANCELLED_NOTICE = 'Stopped by you';
243
263
  */
244
264
  const INTERRUPT_NOTICE = 'Interrupted. Tell me what to do next, or use /rewind to choose an earlier prompt.';
245
265
  const ESCAPE_STOP_NOTICE = 'Esc again to stop';
266
+ /** What the browser mirror shows for a select. */
267
+ function mirrorSelectOptions(options) {
268
+ return {
269
+ title: options.title,
270
+ question: options.question || 'Select an option',
271
+ type: options.type || 'select',
272
+ options: options.options || [],
273
+ // The browser highlights the same option the terminal does.
274
+ ...(options.defaultValue === undefined ? {} : { defaultValue: options.defaultValue }),
275
+ // A required choice ends only in a choice, so the browser offers no Close.
276
+ ...(options.required ? { required: true } : {}),
277
+ };
278
+ }
279
+ /**
280
+ * What the browser mirror shows for a prompt. The browser cannot run
281
+ * maskWhen, so a prompt that may receive a key is masked there from the start.
282
+ */
283
+ function mirrorPromptOptions(options) {
284
+ return {
285
+ title: options.title,
286
+ question: options.question || options.title || 'Enter a value',
287
+ placeholder: options.placeholder,
288
+ defaultValue: options.defaultValue,
289
+ isPassword: options.isPassword || options.maskWhen !== undefined,
290
+ allowEmptySubmit: options.allowEmptySubmit,
291
+ };
292
+ }
293
+ const ESCAPE_REWIND_NOTICE = 'Esc again to rewind';
294
+ /** Arms the idle Escape pair: as in Claude Code, a second press opens /rewind. */
295
+ const IDLE_REWIND_ESCAPE = Symbol('idle-rewind-escape');
246
296
  const STARTUP_CANCELLED = Symbol('startup cancelled by exit');
247
297
  const DEFAULT_INSTANCE_REGISTRY = {
248
298
  register: registerInstance,
@@ -353,7 +403,6 @@ export class RatatuiApp {
353
403
  */
354
404
  killRing = [];
355
405
  killRingIndex = 0;
356
- showYankHint = false;
357
406
  static KILL_RING_MAX = 20;
358
407
  agent = null;
359
408
  /** Mode the current `agent` was built for. Lets runAgent rebuild the agent
@@ -439,6 +488,10 @@ export class RatatuiApp {
439
488
  lastRenderIntervalMs = 0;
440
489
  lastInputAt = 0;
441
490
  lastInputToRenderMs = 0;
491
+ lastCacheActivityAt = 0;
492
+ idleCompaction = new IdleCompactionScheduler(() => this.idleCompactionInput(), async (signal) => {
493
+ await this.ensureSessionManager().compactHistory(30, 5, signal);
494
+ });
442
495
  debug = process.env.ZTC_DEBUG === '1';
443
496
  exitResolve;
444
497
  exitComplete;
@@ -465,6 +518,7 @@ export class RatatuiApp {
465
518
  desktopShareCapture = null;
466
519
  desktopShareRequests = new Map();
467
520
  desktopTaskRelayUnsubscribe = null;
521
+ streamAttemptStart = 0;
468
522
  currentRunStreamed = false; // Whether current run has streamed a response
469
523
  _promptTooLongRetried = false; // Guard for prompt-too-long auto-compact retry
470
524
  toolGroups = new Map();
@@ -495,6 +549,8 @@ export class RatatuiApp {
495
549
  // A turn owns admission through startup and post-run persistence/compaction,
496
550
  // even when the display status has already become idle.
497
551
  agentTurnOwner = null;
552
+ /** Required selects published to the mirror, by id, with their option values. */
553
+ requiredMirrorWidgets = new Map();
498
554
  agentTurnSettlements = new Set();
499
555
  cancelledTurnOwner = null;
500
556
  escapeStopArm = null;
@@ -702,12 +758,16 @@ export class RatatuiApp {
702
758
  transcriptCols = 0;
703
759
  transcriptExpandToolOutputs = false;
704
760
  transcriptShowThinking = true;
761
+ /** Images the terminal has been sent for Kitty placeholders (see ui/terminal_image.ts). */
762
+ kittyImageUploads = new KittyImageUploads();
705
763
  /** Per-message render cache: a rebuild only re-renders messages whose
706
764
  * rendering inputs changed (see ui/transcript_render_cache.ts). */
707
765
  transcriptRenderCache = new TranscriptRenderCache(message => this.messageToScrollbackLines(message));
708
766
  /** Fingerprint of the last transcript actually shipped, so an idle rebuild
709
767
  * (identical content) skips re-serialising and re-sending the whole buffer. */
710
768
  transcriptShipped = null;
769
+ /** Rows of the transcript last built for zmux: a compact select sits right under them (see render). */
770
+ transcriptRows = null;
711
771
  static TRANSCRIPT_REBUILD_THROTTLE_MS = 50;
712
772
  desktopMode = false;
713
773
  desktopRuntime;
@@ -735,6 +795,8 @@ export class RatatuiApp {
735
795
  * leak to new child panes (which should use configStore.getModel()). */
736
796
  overseerModelOverride = null;
737
797
  paneMode = false;
798
+ /** Turns completed in this session, which pace Zerg Router login tips. */
799
+ routerTipTurns = 0;
738
800
  computerUseMode = false;
739
801
  mlMode = false;
740
802
  numZergsGrid = { cols: 1, rows: 1 };
@@ -748,6 +810,12 @@ export class RatatuiApp {
748
810
  // Background agent idle polling — check for completions while user is idle
749
811
  backgroundPollTimer = null;
750
812
  intakePollTimer = null;
813
+ /** Stops refreshConnectedState from following config changes. */
814
+ stopFollowingConfig = null;
815
+ /** Stops refreshConnectedState from following a ZergAI login's wait. */
816
+ stopFollowingLogin = null;
817
+ /** The connection snapshot last given to which mirror server, as JSON. */
818
+ publishedConnection = null;
751
819
  intakeNotifications = new IntakeNotifications();
752
820
  BACKGROUND_POLL_INTERVAL = 2000; // 2 seconds
753
821
  zmuxLayoutPaneCount = 1; // pane 0 = overseer always in layout
@@ -915,6 +983,14 @@ export class RatatuiApp {
915
983
  return;
916
984
  this.controller.setMessages(messages.map(message => message.isStreaming ? { ...message, isStreaming: false } : message));
917
985
  }
986
+ dropStreamingMessages() {
987
+ const messages = this.controller.getState().messages;
988
+ const discarded = messages.slice(this.streamAttemptStart).filter(message => message.role === 'assistant' && message.metadata?.reasoning !== true);
989
+ const discardedIds = new Set(discarded.map(message => message.id));
990
+ this.controller.setMessages(messages.filter(message => !discardedIds.has(message.id)));
991
+ for (const id of discardedIds)
992
+ this.streamTypewriters.delete(id);
993
+ }
918
994
  clearLocalStreamDelta() {
919
995
  if (this.streamDeltaFlushTimer) {
920
996
  clearTimeout(this.streamDeltaFlushTimer);
@@ -954,6 +1030,10 @@ export class RatatuiApp {
954
1030
  if (output.diffLines) {
955
1031
  toolOutput.diffLines = output.diffLines;
956
1032
  }
1033
+ if (output.images) {
1034
+ // References only: inline bytes stay in memory, never in the session file.
1035
+ toolOutput.images = transcriptImagesForToolOutput(output.images);
1036
+ }
957
1037
  if (output.full !== output.preview) {
958
1038
  toolOutput.fullRef = this.rememberToolOutputFull(output.full, previousRef);
959
1039
  toolOutput.fullBytes = Buffer.byteLength(output.full, 'utf8');
@@ -1347,6 +1427,7 @@ export class RatatuiApp {
1347
1427
  this.mirrorServer.setCommands(getMirrorCommandUsages());
1348
1428
  this.mirrorServer.setSuperuser(configStore.isSuperuser());
1349
1429
  this.mirrorServer.setSfxConfig(configStore.get().sfx ?? { enabled: false });
1430
+ this.publishConnectionState();
1350
1431
  this.mirrorServer.onSetSfx((enabled) => {
1351
1432
  const sfx = { ...(configStore.get().sfx ?? {}), enabled };
1352
1433
  configStore.set('sfx', sfx);
@@ -1369,7 +1450,7 @@ export class RatatuiApp {
1369
1450
  // Input that carries attachments is encoded as a structured submit envelope so the child
1370
1451
  // pane can reconstruct them; plain text falls back to a flattened `[image ...]` form.
1371
1452
  this.mirrorServer.onPaneInput((paneId, input) => {
1372
- debugLog(`[Mirror] Pane input fallback via stdin: pane=${paneId} text=${input.text.slice(0, 50)}`);
1453
+ debugLog(`[Mirror] Pane input fallback via stdin: pane=${paneId} length=${input.text.length}`);
1373
1454
  if (input.attachments.length > 0) {
1374
1455
  // Attachments can't ride the plain-text prompt envelope, so encode them
1375
1456
  // as a submit_input control command — delivered BARE (control:true) so
@@ -1390,7 +1471,7 @@ export class RatatuiApp {
1390
1471
  }
1391
1472
  // Handle input from browser mirror (single-pane mode fallback)
1392
1473
  this.mirrorServer.onInput((input) => {
1393
- debugLog(`[Mirror] Received input from browser: ${input.text.slice(0, 50)}...`);
1474
+ debugLog(`[Mirror] Received input from browser: length=${input.text.length}`);
1394
1475
  this.handleSubmit(input);
1395
1476
  });
1396
1477
  this.mirrorServer.onCancel((paneId) => {
@@ -1419,6 +1500,8 @@ export class RatatuiApp {
1419
1500
  });
1420
1501
  return;
1421
1502
  }
1503
+ if (this.refusesMirrorClose(widgetId, answer))
1504
+ return;
1422
1505
  const callback = this.pendingWidgetCallbacks.get(widgetId);
1423
1506
  if (callback) {
1424
1507
  // Call first — persistent callbacks (settings panel) manage their own deletion.
@@ -2130,6 +2213,11 @@ export class RatatuiApp {
2130
2213
  reply('invalid', 'Use the terminal to edit full task text; desktop edits must contain at most 64 KiB.');
2131
2214
  return;
2132
2215
  }
2216
+ // A queued task is kept word for word, so a key command is never saved into one.
2217
+ if (redactCredentialCommand(event.text) !== event.text) {
2218
+ reply('invalid', "A key command can't wait in the queue. Run it in the terminal.");
2219
+ return;
2220
+ }
2133
2221
  const saved = await this.persistQueuedCorrectionEdit(entry.id, event.text);
2134
2222
  this.dispatchPendingAgentWork();
2135
2223
  reply(saved === 'saved' ? 'applied' : saved === 'failed' ? 'persistence_failed' : 'not_queued', saved === 'saved' ? 'Queued task updated.' : saved === 'failed'
@@ -2155,6 +2243,15 @@ export class RatatuiApp {
2155
2243
  // Sync mirror superuser state after auth changes (login/logout/status).
2156
2244
  this.mirrorServer?.setSuperuser(configStore.isSuperuser());
2157
2245
  }
2246
+ /**
2247
+ * The rebuild commands ask for after they saved a change. When the current
2248
+ * route cannot reach a model yet (no key, signed out), the saved change still
2249
+ * stands: the agent is dropped and the next message builds one or asks for
2250
+ * the missing key.
2251
+ */
2252
+ reloadAgentAfterCommand(defer = false) {
2253
+ this.reloadAgentInPlace(defer || !this.resolveSendRoute().ready);
2254
+ }
2158
2255
  /** Change the active config while retaining this renderer's session and transcript. */
2159
2256
  async switchConfigProfileInPlace(name, duplicateSource) {
2160
2257
  if (this.isHostedRuntime()) {
@@ -2275,6 +2372,26 @@ export class RatatuiApp {
2275
2372
  const keymap = zmuxKeymapPayload(configStore.get().keybindings);
2276
2373
  return { ZTC_ZMUX_KEYMAP: JSON.stringify(keymap) };
2277
2374
  }
2375
+ /**
2376
+ * A required select ends only in one of its choices. The browser offers no
2377
+ * Close for it, and an answer that is none of its options (a null close
2378
+ * included) leaves it open on both sides.
2379
+ */
2380
+ refusesMirrorClose(widgetId, answer) {
2381
+ const choices = this.requiredMirrorWidgets.get(widgetId);
2382
+ if (!choices)
2383
+ return false;
2384
+ const value = answer.value;
2385
+ const chosen = Array.isArray(value) ? value : [value];
2386
+ const valid = chosen.length > 0 && chosen.every(item => typeof item === 'string' && choices.has(item));
2387
+ // Answered in the terminal already, or now with a choice: nothing to refuse.
2388
+ if (!this.pendingWidgetCallbacks.has(widgetId) || valid) {
2389
+ this.requiredMirrorWidgets.delete(widgetId);
2390
+ return false;
2391
+ }
2392
+ debugLog(`[Mirror] Refused an answer outside the options of required widget ${widgetId}`);
2393
+ return true;
2394
+ }
2278
2395
  clearLegacyCommandPrompt(render = true) {
2279
2396
  if (!this.legacyCommandPrompt)
2280
2397
  return;
@@ -2342,7 +2459,7 @@ export class RatatuiApp {
2342
2459
  getContextWindow: () => this.controller.getState().contextStatus?.total,
2343
2460
  setContextUsage: (used, estimated) => this.publishContextUsage(used, estimated),
2344
2461
  setAgentState: (state) => this.controller.setAgentState(state),
2345
- reloadAgent: (options) => this.reloadAgentInPlace(options?.defer),
2462
+ reloadAgent: (options) => this.reloadAgentAfterCommand(options?.defer),
2346
2463
  // The terminal command owns its Accounts panel. External mirror/native
2347
2464
  // operations keep the default competing-prompt guard.
2348
2465
  applyAccountOperation: body => this.applyAccountOperation(body, true),
@@ -2494,14 +2611,7 @@ export class RatatuiApp {
2494
2611
  this.mirrorServer.publishWidgetDismiss(widgetId);
2495
2612
  void callback(answer.value);
2496
2613
  });
2497
- this.mirrorServer.publishWidgetPrompt(widgetId, {
2498
- title: options.title,
2499
- question: options.question || options.title || 'Enter a value',
2500
- placeholder: options.placeholder,
2501
- defaultValue: options.defaultValue,
2502
- isPassword: options.isPassword,
2503
- allowEmptySubmit: options.allowEmptySubmit,
2504
- });
2614
+ this.mirrorServer.publishWidgetPrompt(widgetId, mirrorPromptOptions(options));
2505
2615
  return;
2506
2616
  }
2507
2617
  // Non-headless with mirror: show TUI widget AND publish to mirror
@@ -2515,14 +2625,7 @@ export class RatatuiApp {
2515
2625
  }
2516
2626
  void callback(answer.value);
2517
2627
  });
2518
- this.mirrorServer.publishWidgetPrompt(widgetId, {
2519
- title: options.title,
2520
- question: options.question || options.title || 'Enter a value',
2521
- placeholder: options.placeholder,
2522
- defaultValue: options.defaultValue,
2523
- isPassword: options.isPassword,
2524
- allowEmptySubmit: options.allowEmptySubmit,
2525
- });
2628
+ this.mirrorServer.publishWidgetPrompt(widgetId, mirrorPromptOptions(options));
2526
2629
  // Also show TUI widget — first answer wins
2527
2630
  this.textInputWidget.show({
2528
2631
  ...options,
@@ -2545,14 +2648,7 @@ export class RatatuiApp {
2545
2648
  this.textInputWidget.cancel();
2546
2649
  void callback(answer.value);
2547
2650
  });
2548
- this.mirrorClient.publishWidgetPrompt(widgetId, {
2549
- title: options.title,
2550
- question: options.question || options.title || 'Enter a value',
2551
- placeholder: options.placeholder,
2552
- defaultValue: options.defaultValue,
2553
- isPassword: options.isPassword,
2554
- allowEmptySubmit: options.allowEmptySubmit,
2555
- });
2651
+ this.mirrorClient.publishWidgetPrompt(widgetId, mirrorPromptOptions(options));
2556
2652
  if (!this.headlessMirror)
2557
2653
  this.textInputWidget.show({ ...options, callback: value => {
2558
2654
  this.pendingWidgetCallbacks.delete(widgetId);
@@ -2687,12 +2783,9 @@ export class RatatuiApp {
2687
2783
  this.mirrorServer.publishWidgetDismiss(widgetId);
2688
2784
  void callback(answer.value);
2689
2785
  });
2690
- this.mirrorServer.publishWidgetSelect(widgetId, {
2691
- title: options.title,
2692
- question: options.question || 'Select an option',
2693
- type: options.type || 'select',
2694
- options: options.options || [],
2695
- });
2786
+ this.mirrorServer.publishWidgetSelect(widgetId, mirrorSelectOptions(options));
2787
+ if (options.required)
2788
+ this.requiredMirrorWidgets.set(widgetId, new Set((options.options ?? []).map(option => option.value)));
2696
2789
  return;
2697
2790
  }
2698
2791
  if (this.mirrorServer) {
@@ -2704,12 +2797,9 @@ export class RatatuiApp {
2704
2797
  }
2705
2798
  void callback(answer.value);
2706
2799
  });
2707
- this.mirrorServer.publishWidgetSelect(widgetId, {
2708
- title: options.title,
2709
- question: options.question || 'Select an option',
2710
- type: options.type || 'select',
2711
- options: options.options || [],
2712
- });
2800
+ this.mirrorServer.publishWidgetSelect(widgetId, mirrorSelectOptions(options));
2801
+ if (options.required)
2802
+ this.requiredMirrorWidgets.set(widgetId, new Set((options.options ?? []).map(option => option.value)));
2713
2803
  this.activeApprovalWidgetId = null;
2714
2804
  this.selectWidget.show({
2715
2805
  ...options,
@@ -2730,12 +2820,9 @@ export class RatatuiApp {
2730
2820
  this.mirrorClient.publishWidgetDismiss(widgetId);
2731
2821
  void callback(answer.value);
2732
2822
  });
2733
- this.mirrorClient.publishWidgetSelect(widgetId, {
2734
- title: options.title,
2735
- question: options.question || 'Select an option',
2736
- type: options.type || 'select',
2737
- options: options.options || [],
2738
- });
2823
+ this.mirrorClient.publishWidgetSelect(widgetId, mirrorSelectOptions(options));
2824
+ if (options.required)
2825
+ this.requiredMirrorWidgets.set(widgetId, new Set((options.options ?? []).map(option => option.value)));
2739
2826
  return;
2740
2827
  }
2741
2828
  // Non-headless with mirror client: publish as ask_user fallback
@@ -2747,9 +2834,9 @@ export class RatatuiApp {
2747
2834
  };
2748
2835
  this.pendingQuestionnaireQuestions = [{ name: '__select__', question: options.question || options.title || 'Select' }];
2749
2836
  this.askUserAnswerPending = false;
2750
- const mirrorOptions = (options.options || []).map((o) => ({
2751
- label: o.label,
2752
- description: o.description || '',
2837
+ const mirrorOptions = (options.options || []).map(option => ({
2838
+ label: option.label,
2839
+ description: selectOptionSummary(option),
2753
2840
  }));
2754
2841
  questionId = this.activeQuestionId = this.mirror.publishAskUser([{ question: options.question || options.title || 'Select', options: mirrorOptions }], undefined, options.allowOther ?? true);
2755
2842
  }
@@ -3027,6 +3114,9 @@ export class RatatuiApp {
3027
3114
  initialSetting: options.initialSetting,
3028
3115
  initialCategory: options.initialCategory,
3029
3116
  initialFilter: options.initialFilter,
3117
+ summary: options.summary,
3118
+ connectRepaint: options.connectRepaint,
3119
+ typingCloses: options.typingCloses,
3030
3120
  onSettingChange: (setting, value) => options.onSettingChange(setting, value),
3031
3121
  onClose: () => {
3032
3122
  this.pendingWidgetCallbacks.delete(widgetId);
@@ -3061,13 +3151,7 @@ export class RatatuiApp {
3061
3151
  },
3062
3152
  },
3063
3153
  rewindPanel: {
3064
- open: () => {
3065
- if (this.isAgentBusy()) {
3066
- this.controller.setToast('Stop the running turn before using /rewind');
3067
- return;
3068
- }
3069
- this.openRewindPanel();
3070
- },
3154
+ open: () => this.openRewindPanelWhenIdle(),
3071
3155
  },
3072
3156
  };
3073
3157
  const showLegacyPrompt = (message, callback, isPassword, allowEmptySubmit) => {
@@ -3167,7 +3251,7 @@ export class RatatuiApp {
3167
3251
  if (result && typeof result.then === 'function') {
3168
3252
  await result;
3169
3253
  }
3170
- this.controller.setHasApiKey(configStore.hasApiKey() || configStore.isAuthenticated());
3254
+ this.refreshConnectedState();
3171
3255
  // Agent-invoked goal command (via ztc_command): the turn-end hook already
3172
3256
  // drives continuation, so drop any armed kick to avoid a stale first-turn
3173
3257
  // trigger leaking into a later user command.
@@ -3197,6 +3281,7 @@ export class RatatuiApp {
3197
3281
  this.mirrorServer.setCommands(getMirrorCommandUsages());
3198
3282
  this.mirrorServer.setSuperuser(configStore.isSuperuser());
3199
3283
  this.mirrorServer.setSfxConfig(configStore.get().sfx ?? { enabled: false });
3284
+ this.publishConnectionState();
3200
3285
  this.mirrorServer.onSetSfx((enabled) => {
3201
3286
  const sfx = { ...(configStore.get().sfx ?? {}), enabled };
3202
3287
  configStore.set('sfx', sfx);
@@ -3223,7 +3308,7 @@ export class RatatuiApp {
3223
3308
  this.mirrorServer.onPaneViewport((paneId, ansi) => this.handleMirrorPaneViewportRead(paneId, ansi));
3224
3309
  }
3225
3310
  this.mirrorServer.onInput((input) => {
3226
- debugLog(`[Mirror] Received input from browser: ${input.text.slice(0, 50)}...`);
3311
+ debugLog(`[Mirror] Received input from browser: length=${input.text.length}`);
3227
3312
  this.handleSubmit(input);
3228
3313
  });
3229
3314
  this.mirrorServer.onCancel((paneId) => {
@@ -3395,6 +3480,7 @@ export class RatatuiApp {
3395
3480
  * render for this event-loop tick.
3396
3481
  */
3397
3482
  processCharacterInputImmediate(input) {
3483
+ this.idleCompaction.cancel();
3398
3484
  this.lastInputAt = Date.now();
3399
3485
  perfBeginKeystroke();
3400
3486
  perfStage('received');
@@ -3434,6 +3520,7 @@ export class RatatuiApp {
3434
3520
  processInputBuffer() {
3435
3521
  if (!this.inputBuffer)
3436
3522
  return;
3523
+ this.idleCompaction.cancel();
3437
3524
  this.lastInputAt = Date.now();
3438
3525
  // Reset path / @-mention completions on any input
3439
3526
  this.inputCompletions = [];
@@ -4118,6 +4205,7 @@ export class RatatuiApp {
4118
4205
  const desktopUpdateRelaunch = this.desktopMode
4119
4206
  ? buildDesktopUpdateRelaunchContext(withActiveProfileArg(process.argv.slice(1)), this.sessionId, process.execPath, process.cwd(), process.pid, this.desktopRuntime)
4120
4207
  : undefined;
4208
+ const resizesBeforeReady = this.scrollbackResizeSeq;
4121
4209
  const size = await this.tui.start({
4122
4210
  mux: this.muxMode,
4123
4211
  desktop: this.desktopMode,
@@ -4134,11 +4222,17 @@ export class RatatuiApp {
4134
4222
  this.wheelCaptureActive = false;
4135
4223
  this.widgetSurfaceOriginY = null;
4136
4224
  this.widgetSurfaceOriginX = 0;
4137
- const normalized = normalizeTerminalSize(size.cols, size.rows);
4138
- this.cols = normalized.cols;
4139
- this.rows = normalized.rows;
4140
- // Compute viewport to match what Rust uses. See viewportHeightFor.
4141
- this.liveViewportHeight = this.viewportHeightFor(this.rows, 'ready');
4225
+ // A renderer that painted before this process connected reports its
4226
+ // real size right behind Ready, in the same read, so that resize is
4227
+ // handled before start() returns. It is newer than Ready's size (ZTerm's
4228
+ // Ready carries a default grid); keep it, or the frame stays too small.
4229
+ if (this.scrollbackResizeSeq === resizesBeforeReady) {
4230
+ const normalized = normalizeTerminalSize(size.cols, size.rows);
4231
+ this.cols = normalized.cols;
4232
+ this.rows = normalized.rows;
4233
+ // Compute viewport to match what Rust uses. See viewportHeightFor.
4234
+ this.liveViewportHeight = this.viewportHeightFor(this.rows, 'ready');
4235
+ }
4142
4236
  this.lastSentViewportHeight = this.liveViewportHeight;
4143
4237
  }
4144
4238
  if (this.debug) {
@@ -4273,17 +4367,11 @@ export class RatatuiApp {
4273
4367
  }
4274
4368
  this.assertStartupActive();
4275
4369
  restoredMuxSessionForLater = restoredMuxSession;
4276
- if (restoredMuxSession && !process.env.ZTC_COLONY_CHILD) {
4277
- if (restoredMuxSession.diagnostic) {
4278
- this.addSystemMessage(`Mux layout restore skipped (${restoredMuxSession.diagnostic}).`, { ephemeral: true });
4279
- }
4280
- else {
4281
- const detail = restoredMuxSession.skippedPanes > 0
4282
- ? `, ${restoredMuxSession.skippedPanes} skipped`
4283
- : '';
4284
- this.addSystemMessage(`Mux layout restored (${restoredMuxSession.restoredPanes} child panes${detail}).`, { ephemeral: true });
4285
- }
4286
- }
4370
+ // One notice, and none when the saved layout had no panes to restore.
4371
+ const layoutNotice = restoredMuxSession && !process.env.ZTC_COLONY_CHILD
4372
+ ? layoutRestoreNotice(restoredMuxSession) : null;
4373
+ if (layoutNotice)
4374
+ this.addSystemMessage(layoutNotice, { ephemeral: true });
4287
4375
  await this.applyStartupModeBeforeLaunch();
4288
4376
  this.assertStartupActive();
4289
4377
  // Startup modes may synchronously replace the agent. Their response-store
@@ -4313,6 +4401,7 @@ export class RatatuiApp {
4313
4401
  dirtyFileCount: runtime.git.available === true ? runtime.git.dirtyFileCount : undefined,
4314
4402
  authEmail: configStore.isAuthenticated() ? auth?.email : undefined,
4315
4403
  workspaceName: configStore.isAuthenticated() ? workspace?.name : undefined,
4404
+ routerSession: configStore.getRouterSessionStatus(),
4316
4405
  };
4317
4406
  };
4318
4407
  if (this.resumedSession && this.resumedSession.messages.length > 0) {
@@ -4366,8 +4455,15 @@ export class RatatuiApp {
4366
4455
  credentialsReady,
4367
4456
  });
4368
4457
  }
4369
- if (!credentialsReady)
4370
- return buildNoCredentialsWelcome({ mode: launchMode });
4458
+ if (!credentialsReady) {
4459
+ // The launch prompt under a short readout offers both ways to connect.
4460
+ return buildNoCredentialsWelcome({
4461
+ ...getLaunchContext(),
4462
+ mode: launchMode,
4463
+ routerSession: configStore.getRouterSessionStatus(),
4464
+ promptFollows: this.launchConnectPromptWanted(),
4465
+ });
4466
+ }
4371
4467
  let recentSession;
4372
4468
  try {
4373
4469
  recentSession = await findRecentSessionSummary(cwd, {
@@ -4388,12 +4484,18 @@ export class RatatuiApp {
4388
4484
  });
4389
4485
  });
4390
4486
  this.assertStartupActive();
4391
- this.controller.addMessage(createFirstRunLaunchMessage(launchReadout));
4487
+ // Every launch welcome opens on the ZTC wordmark, as the site's film draws it.
4488
+ this.controller.addMessage(createFirstRunLaunchMessage(launchReadout, { wordmark: true }));
4392
4489
  // The controller subscription is not registered yet, so explicitly send
4393
4490
  // the launch readout to a headless mirror as well as the native renderer.
4394
4491
  this.mirror?.publishMessage('system', launchReadout);
4492
+ // The launch choice comes first: a task handoff waits until its flow has
4493
+ // ended (see showLaunchConnectPrompt). Other saved work in this project is
4494
+ // only the readout's Recent line, which points to /resume.
4495
+ if (this.launchConnectPromptWanted() && !this.composerHasDraft())
4496
+ this.heldLaunchNotices = [];
4395
4497
  if (this.taskHandoff) {
4396
- this.controller.addMessage(createFirstRunLaunchMessage(formatTaskHandoffContext(this.taskHandoff.snapshot)));
4498
+ this.showLaunchNotice(formatTaskHandoffNotice(this.taskHandoff.snapshot));
4397
4499
  this.publishTaskHandoff(this.taskHandoff);
4398
4500
  }
4399
4501
  else if (!this.resumedSession) {
@@ -4402,9 +4504,6 @@ export class RatatuiApp {
4402
4504
  this.assertStartupActive();
4403
4505
  if (offers.length > 0) {
4404
4506
  const offer = offers[0];
4405
- const notice = buildSavedSessionNotice(offer.snapshot, activeProfile());
4406
- this.controller.addMessage(createFirstRunLaunchMessage(notice));
4407
- this.mirror?.publishMessage('system', notice);
4408
4507
  // Receiver is this fresh pane. The source remains the prior session;
4409
4508
  // an offer does not give the current agent another task's context.
4410
4509
  this.publishTaskHandoff(offer);
@@ -4418,8 +4517,26 @@ export class RatatuiApp {
4418
4517
  }
4419
4518
  this._bypassThrottleOnce = true;
4420
4519
  this.render();
4421
- this.controller.setHasApiKey(configStore.hasApiKey() || configStore.isAuthenticated());
4520
+ this.stopFollowingConfig ??= configStore.onChange(() => this.refreshConnectedState());
4521
+ // The status line's Escape hint follows the login too, even before any message repaints it.
4522
+ this.stopFollowingLogin ??= onZergAILoginWaitChange(() => { this.refreshConnectedState(); this.render(); });
4523
+ this.refreshConnectedState();
4422
4524
  this.resolveStartupReady();
4525
+ // Ask how to connect until the user logs in with ZergAI or chooses local
4526
+ // API keys, and again when a ZergAI login expired (askHowToConnectAtLaunch).
4527
+ // Only a person at a terminal or in the desktop app is asked: automated
4528
+ // runs (tests, CI) never are, so their keystrokes cannot start a login.
4529
+ // Child panes, colony cells, hosted and headless runs never ask, and a
4530
+ // launch that already has work (a resumed session, an initial prompt, the
4531
+ // resume picker, or a draft typed while ZTC started) is not interrupted;
4532
+ // its readout still names an expired session. /connect stays available.
4533
+ if (this.launchConnectPromptWanted() && !this.composerHasDraft()) {
4534
+ this.showLaunchConnectPrompt();
4535
+ }
4536
+ else {
4537
+ // A draft typed meanwhile keeps the prompt closed; nothing waits for it.
4538
+ this.releaseLaunchNotices();
4539
+ }
4423
4540
  // Play startup sound effect
4424
4541
  playSfxLazy('session_start');
4425
4542
  // Notify about mirror server and auto-open browser.
@@ -5714,7 +5831,6 @@ export class RatatuiApp {
5714
5831
  const owner = createWorkspaceLayoutController(this.tui, () => this.resumedPaneSpecs, id => this.resumeWorkspacePane(id));
5715
5832
  try {
5716
5833
  const result = await owner.restoreSnapshot(state);
5717
- this.addSystemMessage('Workspace restored. Previous process state is unknown; use /layout run <pane-id> or /layout resume <pane-id>.');
5718
5834
  return { restoredPanes: result.restored_panes, skippedPanes: result.skipped_panes };
5719
5835
  }
5720
5836
  catch (error) {
@@ -5911,8 +6027,18 @@ export class RatatuiApp {
5911
6027
  if (message.metadata?.steeringPending === true)
5912
6028
  return [];
5913
6029
  const display = resolveMessageDisplaySettings(configStore.get());
5914
- return _messageToScrollbackLines(message, (d) => this.formatTime(d), this.cols, { showThinking: display.showThinking, showTurnMetadata: display.showTurnMetadata });
6030
+ return _messageToScrollbackLines(message, (d) => this.formatTime(d), this.cols, { showThinking: display.showThinking, showTurnMetadata: display.showTurnMetadata, wordmark: this.showsLaunchWordmark() });
5915
6031
  }
6032
+ /**
6033
+ * Whether the launch welcome draws the ZTC wordmark. It shows only whole:
6034
+ * once the launch transcript cannot fit above the open connect prompt (see
6035
+ * render), the welcome leaves it out for the rest of the session, as the
6036
+ * site's film drops the banner on a short screen.
6037
+ */
6038
+ showsLaunchWordmark() {
6039
+ return this.launchWordmarkFits;
6040
+ }
6041
+ launchWordmarkFits = true;
5916
6042
  messageHeaderToScrollbackLine(message) {
5917
6043
  return _messageHeaderToScrollbackLine(message, (d) => this.formatTime(d), this.cols, resolveMessageDisplaySettings(configStore.get()).showTurnMetadata);
5918
6044
  }
@@ -5923,6 +6049,13 @@ export class RatatuiApp {
5923
6049
  return _processMarkdownLine(line);
5924
6050
  }
5925
6051
  sendTranscriptCommand(cmd) {
6052
+ // The terminal keeps an uploaded image through clears and rebuilds, so
6053
+ // each goes out once, ahead of the first rows that place it.
6054
+ if (cmd.type === 'print_scrollback' || cmd.type === 'replace_scrollback' || cmd.type === 'replace_scrollback_with_anchor') {
6055
+ for (const image of this.kittyImageUploads.pending(cmd.lines.map(line => line.text))) {
6056
+ this.tui.send({ type: 'transmit_image', ...image });
6057
+ }
6058
+ }
5926
6059
  if (cmd.type === 'print_scrollback') {
5927
6060
  const bytes = cmd.lines.reduce((sum, line) => sum + Buffer.byteLength(line.text, 'utf8'), 0);
5928
6061
  const hash = transcriptHash(cmd.lines.map(line => line.text).join('\n'));
@@ -6204,7 +6337,7 @@ export class RatatuiApp {
6204
6337
  const display = resolveMessageDisplaySettings(configStore.get());
6205
6338
  // Everything a rendered message depends on besides the message itself.
6206
6339
  // A change here (resize, thinking visibility) invalidates every entry.
6207
- const configKey = `${this.cols}|${display.showThinking ? 1 : 0}|${display.showTurnMetadata ? 1 : 0}`;
6340
+ const configKey = `${this.cols}|${display.showThinking ? 1 : 0}|${display.showTurnMetadata ? 1 : 0}|${this.showsLaunchWordmark() ? 1 : 0}`;
6208
6341
  const allLines = [];
6209
6342
  const fingerprint = [];
6210
6343
  for (const msg of this.materializeToolOutputMessages(state.messages, state.expandToolOutputs)) {
@@ -6238,6 +6371,13 @@ export class RatatuiApp {
6238
6371
  fingerprint.push(rendered.hash);
6239
6372
  }
6240
6373
  this.pruneStreamTypewriters(state.messages);
6374
+ if (allLines.length !== this.transcriptRows) {
6375
+ this.transcriptRows = allLines.length;
6376
+ // A compact select sits on the row after the transcript: lay it out again
6377
+ // once this render (or the throttled rebuild) is done.
6378
+ if (this.selectWidget.isActive() && this.selectWidget.isCompact())
6379
+ queueMicrotask(() => this.render());
6380
+ }
6241
6381
  // Native scrolling is the source of truth. Preserve its current anchor at
6242
6382
  // replacement time; a resize-ack snapshot can predate newer user scrolling.
6243
6383
  if (this.transcriptShipped !== null
@@ -6310,6 +6450,11 @@ export class RatatuiApp {
6310
6450
  this.controller.addMessage({ role: 'system', content, metadata });
6311
6451
  this.mirror?.publishMessage('system', content);
6312
6452
  }
6453
+ /** Escape or Ctrl+C while a ZergAI login waits: stop it, as /auth cancel does. */
6454
+ stopWaitingLogin() {
6455
+ stopZergAILogin(content => this.addSystemMessage(content));
6456
+ this.render();
6457
+ }
6313
6458
  /**
6314
6459
  * Codex-style interrupt notice: the run stopped, the transcript so far stays.
6315
6460
  * Marked with `interrupted` so the renderer can style it and so tests can
@@ -6317,6 +6462,7 @@ export class RatatuiApp {
6317
6462
  */
6318
6463
  addInterruptedNotice() {
6319
6464
  this.addSystemMessage(INTERRUPT_NOTICE, { interrupted: true });
6465
+ this.controller.addMessage(interruptedTurnMarker());
6320
6466
  }
6321
6467
  looksLikePhantomCompletion(result, initialMessageCount) {
6322
6468
  const msgs = this.controller.getState().messages.slice(0, initialMessageCount);
@@ -6413,10 +6559,14 @@ export class RatatuiApp {
6413
6559
  if (this.escapeStopArm === null)
6414
6560
  return;
6415
6561
  this.escapeStopArm = null;
6416
- if (this.controller.getState().toast === ESCAPE_STOP_NOTICE)
6562
+ const toast = this.controller.getState().toast;
6563
+ if (toast === ESCAPE_STOP_NOTICE || toast === ESCAPE_REWIND_NOTICE)
6417
6564
  this.controller.setToast(null);
6418
6565
  }
6419
6566
  getEscapeHint() {
6567
+ // Escape only nudges a required choice (the launch prompt); Ctrl+C still quits.
6568
+ if (this.selectWidget.isRequired())
6569
+ return 'Enter chooses · Ctrl+C quits';
6420
6570
  if (this.clipboardInputTarget() !== null)
6421
6571
  return 'Esc closes this view';
6422
6572
  if (this.busyScopeChoicePending)
@@ -6430,8 +6580,10 @@ export class RatatuiApp {
6430
6580
  return isEscapeStopArmed(this.escapeStopArm, owner, Date.now())
6431
6581
  ? ESCAPE_STOP_NOTICE : 'Esc twice to stop';
6432
6582
  }
6433
- return this.controller.getState().queue.length > 0
6434
- ? 'Esc keeps queue · /rewind' : 'Esc keeps draft · /rewind';
6583
+ if (pendingZergAILogin())
6584
+ return 'Esc stops the ZergAI login';
6585
+ return isEscapeStopArmed(this.escapeStopArm, IDLE_REWIND_ESCAPE, Date.now())
6586
+ ? ESCAPE_REWIND_NOTICE : 'Esc twice to rewind';
6435
6587
  }
6436
6588
  /**
6437
6589
  * Add an error message that is visible in both local UI and mirror observers.
@@ -6536,16 +6688,20 @@ export class RatatuiApp {
6536
6688
  * of every spawned ZTC pane.
6537
6689
  *
6538
6690
  * Inline fills the terminal except for one shell row. The transcript remains
6539
- * in terminal scrollback when it no longer fits the live view. Desktop is
6540
- * left reserving one because ZTerm's own reservation is unverified.
6691
+ * in terminal scrollback when it no longer fits the live view.
6692
+ *
6693
+ * The desktop app runs in mux mode too, but ZTerm draws its tab strip and
6694
+ * status bar outside the grid it reports, at launch and on resize alike, so
6695
+ * every row is ours. Taking the zmux rule left a blank row under the status
6696
+ * line.
6541
6697
  */
6542
6698
  viewportHeightFor(rows, size) {
6699
+ if (this.desktopMode)
6700
+ return rows;
6543
6701
  if (this.muxMode)
6544
6702
  return size === 'ready' ? rows - 1 : rows;
6545
6703
  if (this.paneMode)
6546
6704
  return rows;
6547
- if (this.desktopMode)
6548
- return rows - 1;
6549
6705
  return rows - 1;
6550
6706
  }
6551
6707
  handleTuiEvent(event) {
@@ -6557,6 +6713,13 @@ export class RatatuiApp {
6557
6713
  rendererHostMode: this.desktopMode ? 'desktop' : 'terminal', rendererIdentitySource: 'host_launch_mode',
6558
6714
  columns: event.cols, rows: event.rows, source: 'renderer_ready',
6559
6715
  });
6716
+ // Real images need a renderer that writes uploads to the terminal
6717
+ // (ztc-tui, zmux) and a terminal that draws Kitty's Unicode
6718
+ // placeholders. Child panes, ZTC Desktop and other terminals keep
6719
+ // half blocks.
6720
+ setTerminalImageMode(!this.paneMode && !this.headlessMirror
6721
+ && this.tui.hasCapability(CAPABILITY_KITTY_GRAPHICS) && kittyGraphicsTerminal(process.env) ? 'kitty' : 'blocks', event.cell_pixels ?? null);
6722
+ this.kittyImageUploads.reset();
6560
6723
  break;
6561
6724
  case 'desktop_task_action':
6562
6725
  void this.handleDesktopTaskAction(event);
@@ -6777,11 +6940,11 @@ export class RatatuiApp {
6777
6940
  routed = configStore.resolveLLMBackendConfig().useProxy;
6778
6941
  }
6779
6942
  catch { /* Discovery can still show its isolated cache. */ }
6780
- const reasoningCommand = /^\/(?:effort|thinking)\s/i.test(text);
6943
+ const reasoningCommand = /^\/(?:effort|thinking|reasoning)\s/i.test(text);
6781
6944
  const connection = reasoningCommand && routed ? configStore.getRouterCatalogConnection() : undefined;
6782
6945
  this.selectionCompletion.update(text, configStore.getProvider(), (signal, provider, authMode) => buildModelsController(configStore).list(provider, { signal, authMode }), commands, configStore.getModel(), signal => buildModelsController(configStore).catalog(signal), routed, reasoningCommand ? { catalog: routed ? configStore.getRoutedModelCatalog() : undefined,
6783
6946
  current: configStore.getCodexEffort(), contract: configStore.getReasoningContract(),
6784
- scope: connection ? routerCatalogScope(connection) : undefined } : {});
6947
+ scope: connection ? routerCatalogScope(connection) : undefined } : { openRouterZdr: configStore.get().openRouter?.zdr === true }, () => modelRouteStatus(configStore));
6785
6948
  return this.selectionCompletion.view();
6786
6949
  }
6787
6950
  retireClipboardPaste() {
@@ -6889,7 +7052,7 @@ export class RatatuiApp {
6889
7052
  if (!key.escape || this.clipboardInputTarget() !== null || this.queueEdit !== null) {
6890
7053
  this.resetEscapeStop();
6891
7054
  }
6892
- debugLog(`[handleInput] input="${input}" key=${JSON.stringify(key)}`);
7055
+ debugLog(`[handleInput] ${describeInputForLog(input, key.paste)} key=${JSON.stringify(key)}`);
6893
7056
  // Explicit terminal paste is data. Raw control bytes retain their legacy
6894
7057
  // key meanings only when the transport did not identify a paste.
6895
7058
  if (paste && input === '')
@@ -6947,8 +7110,8 @@ export class RatatuiApp {
6947
7110
  return;
6948
7111
  }
6949
7112
  // Handle settings panel input (highest widget priority)
6950
- if (this.settingsPanelWidget.isActive()) {
6951
- this.settingsPanelWidget.handleInput(input, key);
7113
+ // A page that typing closes leaves the typed key to the composer.
7114
+ if (this.settingsPanelWidget.isActive() && this.settingsPanelWidget.handleInput(input, key)) {
6952
7115
  return;
6953
7116
  }
6954
7117
  // Handle questionnaire widget input (highest priority - multi-tab)
@@ -6961,9 +7124,9 @@ export class RatatuiApp {
6961
7124
  this.formWidget.handleInput(input, key);
6962
7125
  return;
6963
7126
  }
6964
- // Handle select widget input
6965
- if (this.selectWidget.isActive()) {
6966
- this.selectWidget.handleInput(input, key);
7127
+ // Handle select widget input. A required select (the launch prompt) leaves
7128
+ // Ctrl+C to the handling below, so ZTC can still quit.
7129
+ if (this.selectWidget.isActive() && this.selectWidget.handleInput(input, key)) {
6967
7130
  return;
6968
7131
  }
6969
7132
  // Handle text input widget
@@ -6977,6 +7140,7 @@ export class RatatuiApp {
6977
7140
  this.inputCompletions = [];
6978
7141
  this.inputCompletionIndex = 0;
6979
7142
  this.atMentionCompletion = null;
7143
+ this.idleCompaction.cancel();
6980
7144
  this.lastInputAt = Date.now();
6981
7145
  const text = input.replace(/\r\n?/g, '\n');
6982
7146
  const lines = text.split('\n').length;
@@ -7003,6 +7167,14 @@ export class RatatuiApp {
7003
7167
  const selection = this.selectionCompletion.handleKey({ ...key, return: key.return || input === '\r' || input === '\n' });
7004
7168
  if (selection.handled) {
7005
7169
  this.resetEscapeStop();
7170
+ if (selection.toggle === 'openrouter.zdr') {
7171
+ const openRouter = configStore.get().openRouter ?? {};
7172
+ configStore.set('openRouter', { ...openRouter, zdr: !openRouter.zdr });
7173
+ void configStore.save();
7174
+ this.controller.setToast(openRouter.zdr ? 'OpenRouter: any provider' : 'OpenRouter: zero-data-retention providers only');
7175
+ this.render();
7176
+ return;
7177
+ }
7006
7178
  if (selection.text !== undefined) {
7007
7179
  if (selection.submit && !this.queueEdit) {
7008
7180
  this.clearComposerAfterSubmit(selection.text);
@@ -7019,7 +7191,8 @@ export class RatatuiApp {
7019
7191
  // Handle Ctrl+C — priority order:
7020
7192
  // 1. If a generation is running, cancel it.
7021
7193
  // 2. Else if the composer has any text/badges, clear it.
7022
- // 3. Else exit ZTC.
7194
+ // 3. Else if a ZergAI login waits for the browser, stop waiting.
7195
+ // 4. Else exit ZTC.
7023
7196
  if (isControlKey(input, key, 'c')) {
7024
7197
  // Ignore any buffered Ctrl+C within the first second of startup
7025
7198
  if (Date.now() - this.startedAt < 1000) {
@@ -7037,12 +7210,15 @@ export class RatatuiApp {
7037
7210
  const kill = killInputDraft(this.inputState);
7038
7211
  this.recordKill(kill.killed);
7039
7212
  this.inputState = kill.state;
7040
- this.showYankHint = true;
7041
7213
  this.controller.setToast('Cleared · Ctrl+Y restores');
7042
7214
  this.controller.setInputState(this.inputState);
7043
7215
  this.render();
7044
7216
  return;
7045
7217
  }
7218
+ if (pendingZergAILogin()) {
7219
+ this.stopWaitingLogin();
7220
+ return;
7221
+ }
7046
7222
  this.exit();
7047
7223
  return;
7048
7224
  }
@@ -7062,15 +7238,28 @@ export class RatatuiApp {
7062
7238
  return;
7063
7239
  }
7064
7240
  const owner = this.runLifecycle.isRunning() ? this.agentTurnOwner : null;
7065
- const next = advanceEscapeStop(this.escapeStopArm, owner, Date.now());
7241
+ // With no turn to stop, Escape stops a ZergAI login waiting for the
7242
+ // browser, as its waiting message says. The draft stays as typed.
7243
+ if (owner === null && pendingZergAILogin()) {
7244
+ this.stopWaitingLogin();
7245
+ return;
7246
+ }
7247
+ // Two presses stop a running turn; with none running they open /rewind.
7248
+ const next = advanceEscapeStop(this.escapeStopArm, owner ?? IDLE_REWIND_ESCAPE, Date.now());
7066
7249
  this.escapeStopArm = next.arm;
7067
- if (next.confirmed) {
7250
+ if (next.confirmed && owner === null) {
7251
+ // The first press's notice is spent; the picker shows its own Esc hint.
7252
+ if (this.controller.getState().toast === ESCAPE_REWIND_NOTICE)
7253
+ this.controller.setToast(null);
7254
+ this.openRewindPanelWhenIdle();
7255
+ }
7256
+ else if (next.confirmed) {
7068
7257
  // A deliberate stop must not immediately dispatch the next queued turn.
7069
7258
  this.queuePaused = true;
7070
7259
  this.cancelIfRunning();
7071
7260
  }
7072
- else if (owner !== null) {
7073
- this.controller.setToast(ESCAPE_STOP_NOTICE, ESCAPE_STOP_WINDOW_MS);
7261
+ else {
7262
+ this.controller.setToast(owner !== null ? ESCAPE_STOP_NOTICE : ESCAPE_REWIND_NOTICE, ESCAPE_STOP_WINDOW_MS);
7074
7263
  }
7075
7264
  this.render();
7076
7265
  return;
@@ -7111,7 +7300,7 @@ export class RatatuiApp {
7111
7300
  // Some terminals/modes may send Enter as a character instead of as a key code
7112
7301
  const isEnterKey = key.return || (input === '\r' || input === '\n');
7113
7302
  if (isEnterKey) {
7114
- debugLog(`[handleInput] Enter pressed, shift=${key.shift}, via key.return=${key.return} input="${input}"`);
7303
+ debugLog(`[handleInput] Enter pressed, shift=${key.shift}, via key.return=${key.return}`);
7115
7304
  // Shift+Enter or Option/Alt+Enter inserts newline
7116
7305
  // (Option+Enter is the reliable fallback on terminals that don't
7117
7306
  // distinguish Shift+Enter from Enter without the kitty keyboard
@@ -7317,13 +7506,8 @@ export class RatatuiApp {
7317
7506
  this.controller.setInputState(this.inputState);
7318
7507
  return;
7319
7508
  }
7320
- // Handle Ctrl+A (start of the caret's line — readline parity; the whole
7321
- // draft stays reachable with Ctrl+Home)
7322
- if (isControlKey(input, key, 'a')) {
7323
- this.inputState = moveToLineStart(this.inputState);
7324
- this.controller.setInputState(this.inputState);
7325
- return;
7326
- }
7509
+ // Ctrl+A is no shortcut here: Home (and Cmd+Left in the desktop app) goes
7510
+ // to the caret line's start, Ctrl+Home to the draft's.
7327
7511
  // Handle Ctrl+E (end of the caret's line; the whole draft is Ctrl+End)
7328
7512
  if (isControlKey(input, key, 'e')) {
7329
7513
  this.inputState = moveToLineEnd(this.inputState);
@@ -7342,7 +7526,7 @@ export class RatatuiApp {
7342
7526
  }
7343
7527
  // Ctrl+O toggles every tool output, including previous groups and turns.
7344
7528
  // Keep Ctrl+Shift+O as an alias for terminals that distinguish it.
7345
- if (isControlKey(input, key, 'o')) {
7529
+ if (isControlKey(input, key, 'o') || isControlKey(input, key, 'o', { shift: true })) {
7346
7530
  const state = this.controller.getState();
7347
7531
  this.controller.dispatch({
7348
7532
  type: 'SET_EXPAND_TOOL_OUTPUTS',
@@ -7522,16 +7706,20 @@ export class RatatuiApp {
7522
7706
  // and the word kills all record their text, so clearing the composer stays
7523
7707
  // recoverable. Alt+Y walks to older kills. The admin-only prompt viewer
7524
7708
  // keeps Ctrl+Shift+Y and its entry on the Ctrl+B W navigator page.
7525
- if (isControlKey(input, key, 'y')) {
7526
- if (key.shift) {
7527
- if (!configStore.isSuperuser()) {
7528
- this.controller.setToast('Prompt view requires admin access');
7529
- return;
7530
- }
7531
- this.promptViewer.toggle();
7709
+ if (isControlKey(input, key, 'y', { shift: true })) {
7710
+ if (!configStore.isSuperuser()) {
7711
+ this.controller.setToast('Prompt view requires admin access');
7532
7712
  return;
7533
7713
  }
7534
- this.yankKill(Boolean(key.meta));
7714
+ this.promptViewer.toggle();
7715
+ return;
7716
+ }
7717
+ if (isControlKey(input, key, 'y')) {
7718
+ this.yankKill(false);
7719
+ return;
7720
+ }
7721
+ if (key.meta && !key.ctrl && !key.super && !key.shift && input === 'y') {
7722
+ this.yankKill(true);
7535
7723
  return;
7536
7724
  }
7537
7725
  // Handle Ctrl+U (kill to the start of the caret's line — readline parity;
@@ -8264,6 +8452,8 @@ export class RatatuiApp {
8264
8452
  }
8265
8453
  if (cmd.__ztc_cmd === 'widget_answer') {
8266
8454
  debugLog(`[Bus] Widget answer: ${cmd.widget_id}`);
8455
+ if (this.refusesMirrorClose(cmd.widget_id, cmd.answer ?? {}))
8456
+ return;
8267
8457
  const callback = this.pendingWidgetCallbacks.get(cmd.widget_id);
8268
8458
  if (callback) {
8269
8459
  callback(cmd.answer);
@@ -8373,7 +8563,7 @@ export class RatatuiApp {
8373
8563
  };
8374
8564
  this.controller.setInputState(this.inputState);
8375
8565
  }
8376
- async handleSubmit(rawInput, queuedEntryId, queuedAdmission, literalInput = false) {
8566
+ async handleSubmit(rawInput, queuedEntryId, queuedAdmission, literalInput = false, credentialPrompted = false) {
8377
8567
  if (this.exiting)
8378
8568
  return;
8379
8569
  const input = parseStructuredSubmitInput(rawInput);
@@ -8398,8 +8588,14 @@ export class RatatuiApp {
8398
8588
  }
8399
8589
  if (this.exiting)
8400
8590
  return;
8591
+ this.idleCompaction.cancel();
8401
8592
  this.lastInputAt = Date.now();
8402
8593
  if (this.runtimeMutationInFlight) {
8594
+ // A key command is never kept in the queue (it is stored word for word).
8595
+ if (redactCredentialCommand(text) !== text) {
8596
+ this.addSystemMessage('Account or model change in progress; run the key command again when it finishes.');
8597
+ return;
8598
+ }
8403
8599
  // Preserve ingress while settings/reload owns admission; do not interrupt a disposed backend.
8404
8600
  const retained = this.controller.enqueueMessage(input, 'end-of-turn');
8405
8601
  this.addSystemMessage(retained ? 'Account or model change in progress; input retained in the queue.'
@@ -8411,6 +8607,14 @@ export class RatatuiApp {
8411
8607
  this.recapController.cancel();
8412
8608
  // Route input: shell command, slash command, or regular message
8413
8609
  const route = literalInput ? { type: 'message', text } : routeUserInput(text);
8610
+ // History keeps this line with its key redacted, so the model must not get
8611
+ // the key either: a line that starts like a command but runs as a message
8612
+ // (a path, say) is not sent. A queued entry is left to the queue, which
8613
+ // would retry it.
8614
+ if (route.type === 'message' && !literalInput && !queuedEntryId && redactCredentialCommand(text) !== text) {
8615
+ this.addSystemMessage('Not sent: this line holds what looks like an API key. Save a key with /config key <provider> <key>.');
8616
+ return;
8617
+ }
8414
8618
  if (route.type === 'command') {
8415
8619
  const subcommand = route.args[0]?.toLowerCase();
8416
8620
  const modeConfigRead = route.cmd === 'mode'
@@ -8465,12 +8669,16 @@ export class RatatuiApp {
8465
8669
  return;
8466
8670
  }
8467
8671
  if (route.type === 'command') {
8468
- this.mirror?.publishMessage('user', text);
8672
+ this.mirror?.publishMessage('user', redactCredentialCommand(text));
8469
8673
  await this.handleCommand(route.cmd, route.args, false);
8470
8674
  return;
8471
8675
  }
8472
- // Regular message - send to agent
8473
- if (!configStore.hasApiKey() && !configStore.isAuthenticated()) {
8676
+ // Regular message - send to agent once the route it would use can reach a model.
8677
+ const sendRoute = this.resolveSendRoute();
8678
+ if (!sendRoute.ready) {
8679
+ if (!credentialPrompted && sendRoute.route
8680
+ && this.askForSendCredential(sendRoute.route, input, queuedEntryId, literalInput))
8681
+ return;
8474
8682
  this.controller.addMessage({
8475
8683
  role: 'user',
8476
8684
  content: text,
@@ -8549,6 +8757,119 @@ export class RatatuiApp {
8549
8757
  // Run the agent on current messages
8550
8758
  await this.runAgent();
8551
8759
  }
8760
+ /**
8761
+ * Whether a typed message can reach a model, judged by the route the agent
8762
+ * would be built for. Besides a buildable route, agent construction falls back
8763
+ * to a legacy platform login outside direct routing (never for Modal). A route
8764
+ * that fails to resolve keeps the older check, so agent construction reports
8765
+ * its specific error.
8766
+ */
8767
+ resolveSendRoute() {
8768
+ let route;
8769
+ try {
8770
+ route = configStore.resolveLLMBackendConfig({ cwd: this.shellCwd || process.cwd(), ...(this.overseerModelOverride ?? {}) });
8771
+ }
8772
+ catch {
8773
+ return { ready: configStore.hasApiKey() || configStore.isAuthenticated() };
8774
+ }
8775
+ const platformFallback = route.provider !== 'modal' && route.authMode !== 'direct' && configStore.isAuthenticated();
8776
+ return { ready: isBuildableResolvedConfig(route) || platformFallback, route };
8777
+ }
8778
+ /**
8779
+ * The one owner of the connected state the composer placeholder and the
8780
+ * status dot show: whether a message could reach a model now. It runs after
8781
+ * every command and after every saved or reloaded config change, which
8782
+ * covers keys saved or removed from prompts and the settings panel,
8783
+ * provider and route switches, ZergAI login and logout, and the launch
8784
+ * prompt.
8785
+ */
8786
+ refreshConnectedState() {
8787
+ const { ready, route } = this.resolveSendRoute();
8788
+ // A route that does not resolve (a Router-only route while signed out)
8789
+ // reaches no model, whatever keys are saved for other routes.
8790
+ const connected = ready && route !== undefined;
8791
+ if (this.controller.getState().hasApiKey !== connected)
8792
+ this.controller.setHasApiKey(connected);
8793
+ this.publishConnectionState();
8794
+ }
8795
+ /**
8796
+ * Give the mirror's settings page the Connection state (the ZergAI login
8797
+ * and each key's source, masked) when it changed or the mirror is new.
8798
+ */
8799
+ publishConnectionState() {
8800
+ const server = this.mirrorServer;
8801
+ if (!server)
8802
+ return;
8803
+ const snapshot = connectionSnapshot(configStore, pendingZergAILogin());
8804
+ const json = JSON.stringify(snapshot);
8805
+ if (this.publishedConnection?.server === server && this.publishedConnection.json === json)
8806
+ return;
8807
+ this.publishedConnection = { server, json };
8808
+ server.publishConnectionState(snapshot);
8809
+ }
8810
+ /** True while the composer holds text, including keys still in the typing buffer. */
8811
+ composerHasDraft() {
8812
+ return this.inputState.segments.length > 0 || this.inputBuffer !== '';
8813
+ }
8814
+ /** The connect prompt ZTC opens by itself at launch (see showConnectPrompt). */
8815
+ /**
8816
+ * Whether this launch asks how to connect (see the call in start), short of
8817
+ * a draft typed while ZTC started, which only the moment of asking knows.
8818
+ * The launch readout leaves the ways to connect to the prompt when it asks.
8819
+ */
8820
+ launchConnectPromptWanted() {
8821
+ return canAskAtLaunch({ terminal: Boolean(process.stdin.isTTY), desktop: this.desktopMode })
8822
+ && !configStore.isAuthenticated()
8823
+ && askHowToConnectAtLaunch(configStore.get(), configStore.getAuthMode(), configStore.getRouterSessionStatus(), this.resolveSendRoute().ready)
8824
+ && !this.paneMode && !this.headlessMirror && !this.isHostedRuntime() && !process.env.ZTC_COLONY_CHILD
8825
+ && !this.resumedSession && !this.initialPrompt?.trim() && !this.resumePicker;
8826
+ }
8827
+ showLaunchConnectPrompt() {
8828
+ const ctx = this.buildCommandContext(message => {
8829
+ this.controller.addMessage(message);
8830
+ if (message.role === 'system')
8831
+ this.mirror?.publishMessage('system', message.content);
8832
+ });
8833
+ showConnectPrompt(ctx, { launch: true, onFinished: () => { this.releaseLaunchNotices(); this.render(); } });
8834
+ }
8835
+ /** Launch notices held until the launch connect flow ends; null when none are held. */
8836
+ heldLaunchNotices = null;
8837
+ /** Show a launch notice (saved work, a task handoff), or hold it while the launch choice runs. */
8838
+ showLaunchNotice(text) {
8839
+ if (this.heldLaunchNotices) {
8840
+ this.heldLaunchNotices.push(text);
8841
+ return;
8842
+ }
8843
+ this.controller.addMessage(createFirstRunLaunchMessage(text));
8844
+ this.mirror?.publishMessage('system', text);
8845
+ }
8846
+ releaseLaunchNotices() {
8847
+ const held = this.heldLaunchNotices ?? [];
8848
+ this.heldLaunchNotices = null;
8849
+ for (const text of held)
8850
+ this.showLaunchNotice(text);
8851
+ }
8852
+ /**
8853
+ * Ask for the API key a direct route is missing, then send `input` as typed.
8854
+ * On cancel the text goes back to the composer. Only input typed in this
8855
+ * terminal or its mirror asks: queued input and pane children keep the setup
8856
+ * message, and an open widget is never replaced.
8857
+ */
8858
+ askForSendCredential(route, input, queuedEntryId, literalInput) {
8859
+ if (queuedEntryId || this.paneMode || this.routingInteractionOccupied())
8860
+ return false;
8861
+ const ctx = this.buildCommandContext(message => this.controller.addMessage(message));
8862
+ return promptForMissingDirectKey(route, ctx, async () => {
8863
+ // A live agent was built without this key; the send builds a fresh one.
8864
+ this.reloadAgentInPlace(true);
8865
+ await this.handleSubmit(input, undefined, undefined, literalInput, true);
8866
+ }, {
8867
+ onCancel: () => {
8868
+ this.restoreBusyDraft(input);
8869
+ this.addSystemMessage('Message not sent. Run /connect to log in with ZergAI or add a local API key, then press Enter to send it.');
8870
+ },
8871
+ });
8872
+ }
8552
8873
  localWorkspace() {
8553
8874
  if (this.workspaceCoordinator === null) {
8554
8875
  this.workspaceCoordinator = new LocalWorkspaceCoordinator({
@@ -8612,12 +8933,12 @@ export class RatatuiApp {
8612
8933
  const ctx = this.buildCommandContext(message => this.controller.addMessage(message));
8613
8934
  ctx.select.showSelect({
8614
8935
  title: 'Workspace overlap',
8615
- question: `Advisory local overlap: ${snapshot.reasons.join('; ')}. Choose where this session should continue.`,
8936
+ question: describeWorkspaceOverlap(snapshot),
8616
8937
  type: 'select', allowOther: false,
8617
8938
  options: [
8618
- { value: 'continue', label: 'Continue here', description: 'Acknowledge this local snapshot and continue in this workspace' },
8619
- { value: 'isolate', label: 'Isolate this session', description: 'Preserve this source and open a fresh isolated local session' },
8620
- { value: 'pause', label: 'Pause this session', description: 'Keep the prompt and queue dormant; leave other sessions running' },
8939
+ { value: 'continue', label: 'Continue here', description: 'Keep working in this checkout alongside the other session' },
8940
+ { value: 'isolate', label: 'Isolate this session', description: 'Copy your changes to a new branch in a separate worktree and continue there' },
8941
+ { value: 'pause', label: 'Pause this session', description: 'Keep your prompt and queue until you run /sessions continue' },
8621
8942
  ],
8622
8943
  }, value => choice.finish(typeof value === 'string' ? value : null));
8623
8944
  for (const id of this.pendingWidgetCallbacks.keys())
@@ -8654,8 +8975,12 @@ export class RatatuiApp {
8654
8975
  return false;
8655
8976
  }
8656
8977
  if (this.workspacePaused) {
8657
- if (input && !queuedEntryId)
8978
+ if (input && !queuedEntryId) {
8658
8979
  this.retainWorkspaceInput(input);
8980
+ // Enter once did nothing visible here: the prompt went back into the composer silently (2026-10-27).
8981
+ if (!this.exiting)
8982
+ this.addSystemMessage('This session is paused for a workspace overlap. Your message is kept; run /sessions continue to send it.');
8983
+ }
8659
8984
  return false;
8660
8985
  }
8661
8986
  for (;;) {
@@ -9426,6 +9751,7 @@ export class RatatuiApp {
9426
9751
  const preRunMessageCount = this.controller.getState().messages.length;
9427
9752
  const checkpointTurn = ++this.toolCheckpointTurn;
9428
9753
  let historyCheckpoint = [];
9754
+ const checkpointBaseIds = new Set();
9429
9755
  const transcriptIterations = [];
9430
9756
  const toolIterations = new Map();
9431
9757
  const suppliedSteeringIds = new Set();
@@ -9451,7 +9777,7 @@ export class RatatuiApp {
9451
9777
  await this.saveCurrentSession(true);
9452
9778
  return;
9453
9779
  }
9454
- historyCheckpoint = [...checkpoint.messages];
9780
+ historyCheckpoint = checkpoint.messages.filter(message => !checkpointBaseIds.has(message.id));
9455
9781
  retainCheckpoint();
9456
9782
  await this.saveCurrentSession(true);
9457
9783
  if (this.exiting && checkpoint.phase === 'before_execute') {
@@ -9508,9 +9834,19 @@ export class RatatuiApp {
9508
9834
  this.controller.setAgentState(applyAgentEventToState(this.controller.getState().agentState, event));
9509
9835
  break;
9510
9836
  case 'history_checkpoint':
9837
+ if (event.replacesHistory) {
9838
+ this.controller.setMessages(event.messages);
9839
+ checkpointBaseIds.clear();
9840
+ for (const message of event.messages)
9841
+ checkpointBaseIds.add(message.id);
9842
+ historyCheckpoint = [];
9843
+ transcriptIterations.length = 0;
9844
+ toolIterations.clear();
9845
+ break;
9846
+ }
9511
9847
  if (event.messages.some(message => message.toolCalls?.some(call => !toolIterations.has(call.id))))
9512
9848
  break;
9513
- historyCheckpoint = event.messages;
9849
+ historyCheckpoint = event.messages.filter(message => !checkpointBaseIds.has(message.id));
9514
9850
  retainCheckpoint();
9515
9851
  this.revealAdmittedSteering(new Set(event.messages.map(message => message.id)));
9516
9852
  break;
@@ -9539,6 +9875,7 @@ export class RatatuiApp {
9539
9875
  break;
9540
9876
  }
9541
9877
  case 'stream_start':
9878
+ this.streamAttemptStart = this.controller.getState().messages.length;
9542
9879
  // Visible answer text ends the consecutive tool group.
9543
9880
  this.closeToolGroup();
9544
9881
  this.finishLocalStreamingMessages();
@@ -9595,6 +9932,13 @@ export class RatatuiApp {
9595
9932
  }
9596
9933
  this.mirror?.publishReasoningDelta(event.content);
9597
9934
  break;
9935
+ case 'stream_reset': {
9936
+ this.clearLocalStreamDelta();
9937
+ this.dropStreamingMessages();
9938
+ this.controller.setAgentState(applyAgentEventToState(this.controller.getState().agentState, event));
9939
+ this.markTranscriptDirty();
9940
+ break;
9941
+ }
9598
9942
  case 'stream_end': {
9599
9943
  this.flushLocalStreamDelta();
9600
9944
  // Mark streaming message as complete
@@ -9693,7 +10037,15 @@ export class RatatuiApp {
9693
10037
  case 'api_retry': {
9694
10038
  this.controller.setAgentState(applyAgentEventToState(this.controller.getState().agentState, event));
9695
10039
  const retryMsg = formatApiRetryNotice(event);
9696
- this.addSystemMessage(retryMsg);
10040
+ // Retries of one request update one notice instead of adding a line per attempt.
10041
+ const retryMessages = this.controller.getState().messages;
10042
+ const previousRetry = retryMessages[retryMessages.length - 1];
10043
+ if (previousRetry?.role === 'system' && previousRetry.metadata?.apiRetry === true) {
10044
+ this.controller.setMessages([...retryMessages.slice(0, -1), { ...previousRetry, content: retryMsg }]);
10045
+ }
10046
+ else {
10047
+ this.addSystemMessage(retryMsg, { apiRetry: true });
10048
+ }
9697
10049
  break;
9698
10050
  }
9699
10051
  }
@@ -9717,7 +10069,7 @@ export class RatatuiApp {
9717
10069
  if (!ownsAdmission())
9718
10070
  throw new Error('Correction admission belongs to a retired run.');
9719
10071
  const admitted = checkpoint.sourceMessageIds.filter(id => suppliedSteeringIds.has(id));
9720
- historyCheckpoint = [...checkpoint.messages];
10072
+ historyCheckpoint = checkpoint.messages.filter(message => !checkpointBaseIds.has(message.id));
9721
10073
  retainCheckpoint();
9722
10074
  this.markHandoffDelivery(admitted, checkpoint.deliveryState ?? 'delivered');
9723
10075
  try {
@@ -9767,6 +10119,14 @@ export class RatatuiApp {
9767
10119
  }
9768
10120
  }
9769
10121
  this.addErrorMessage(`Error: ${errorMsg}`);
10122
+ let routedTurn = false;
10123
+ try {
10124
+ routedTurn = configStore.resolveLLMBackendConfig().useProxy;
10125
+ }
10126
+ catch { /* An unbuildable route is not routed. */ }
10127
+ const errorTip = routerTipForError(configStore.getRouterSessionStatus(), routedTurn, errorMsg);
10128
+ if (errorTip)
10129
+ this.addSystemMessage(errorTip, { ephemeral: true });
9770
10130
  this.pendingPlanApproval = false;
9771
10131
  this.pendingAskUser = false;
9772
10132
  this.askUserData = null;
@@ -9850,7 +10210,7 @@ export class RatatuiApp {
9850
10210
  // truth for a steered turn. The normal display path collapses all tool
9851
10211
  // calls onto the final assistant message, which would replay a steering
9852
10212
  // prompt before the tool result it followed.
9853
- const turnMessages = result.turnMessages ?? [];
10213
+ const turnMessages = (result.turnMessages ?? []).filter(message => !checkpointBaseIds.has(message.id));
9854
10214
  if (turnMessages.length > 0) {
9855
10215
  this.controller.setMessages(reconcileOrderedTranscript({
9856
10216
  live: this.controller.getState().messages, ordered: turnMessages,
@@ -9942,7 +10302,9 @@ export class RatatuiApp {
9942
10302
  this.addSystemMessage('Agent reached the configured iteration limit. The task is unfinished. Send a message to continue.');
9943
10303
  }
9944
10304
  const newMessages = this.controller.getState().messages.slice(initialMessageCount);
9945
- const emittedVisibleOutput = newMessages.some((message) => (message.role === 'assistant' && (message.content.trim().length > 0 || (message.toolCalls?.length ?? 0) > 0))
10305
+ // Reasoning is not an answer: with thinking hidden, a turn of reasoning alone shows the person nothing.
10306
+ const emittedVisibleOutput = newMessages.some((message) => (message.role === 'assistant' && message.metadata?.reasoning !== true
10307
+ && (message.content.trim().length > 0 || (message.toolCalls?.length ?? 0) > 0))
9946
10308
  || message.role === 'tool');
9947
10309
  if (!emittedVisibleOutput && result.content.trim().length === 0 && result.toolCalls.length === 0) {
9948
10310
  this.addSystemMessage('Agent returned an empty response. Retry the request or adjust the prompt.');
@@ -10005,6 +10367,11 @@ export class RatatuiApp {
10005
10367
  if (result?.stopReason === 'complete') {
10006
10368
  playSfxLazy('task_complete');
10007
10369
  }
10370
+ this.routerTipTurns++;
10371
+ const loginTip = routerLoginTip(configStore.getRouterSessionStatus(), this.routerTipTurns);
10372
+ // Periodic tips stay out of the transcript, so history, /rewind and saved sessions are unchanged.
10373
+ if (loginTip)
10374
+ this.controller.setToast(loginTip, ROUTER_TIP_TOAST_MS);
10008
10375
  // Write last assistant response for evolution conductor to read
10009
10376
  this.maybeWritePaneResponse();
10010
10377
  // Check if auto-compaction is needed after agent completes
@@ -10085,6 +10452,9 @@ export class RatatuiApp {
10085
10452
  this.syncPromptTurn(this.streamingPromptTurn ?? promptTurn, initialMessageCount);
10086
10453
  for (const owner of promptTurns)
10087
10454
  owner.finish();
10455
+ this.lastCacheActivityAt = Date.now();
10456
+ if (!this.exiting)
10457
+ this.idleCompaction.arm();
10088
10458
  }
10089
10459
  }
10090
10460
  beginPromptTurn(id) {
@@ -10389,7 +10759,6 @@ export class RatatuiApp {
10389
10759
  this.killRingIndex = cycle && this.killRingIndex + 1 < this.killRing.length
10390
10760
  ? this.killRingIndex + 1
10391
10761
  : 0;
10392
- this.showYankHint = false;
10393
10762
  if (this.controller.getState().toast === 'Cleared · Ctrl+Y restores')
10394
10763
  this.controller.setToast(null);
10395
10764
  this.inputState = yankInputKill(this.inputState, this.killRing[this.killRingIndex]);
@@ -10404,12 +10773,10 @@ export class RatatuiApp {
10404
10773
  noticeIfComposerCleared(killed) {
10405
10774
  if (!killed || this.inputState.segments.length > 0)
10406
10775
  return;
10407
- this.showYankHint = true;
10408
10776
  this.controller.setToast('Cleared · Ctrl+Y restores');
10409
10777
  }
10410
10778
  /** Reset the composer after a submission (Enter or Tab-queue) and record history. */
10411
10779
  clearComposerAfterSubmit(plainText) {
10412
- this.showYankHint = false;
10413
10780
  const parkedDraft = this.inputState.historyIdx >= 0 ? this.historyDraft : null;
10414
10781
  this.inputCompletions = [];
10415
10782
  this.inputCompletionIndex = 0;
@@ -10419,7 +10786,8 @@ export class RatatuiApp {
10419
10786
  ...this.inputState,
10420
10787
  segments: parkedDraft?.segments ?? [],
10421
10788
  cursor: parkedDraft?.cursor ?? { index: 0, offset: 0 },
10422
- history: [...this.inputState.history, plainText],
10789
+ // A key typed into a credential command is never recalled.
10790
+ history: [...this.inputState.history, redactCredentialCommand(plainText)],
10423
10791
  historyIdx: -1,
10424
10792
  };
10425
10793
  this.controller.setInputState(this.inputState);
@@ -10449,6 +10817,13 @@ export class RatatuiApp {
10449
10817
  const capturedInput = serializeMessageInput(this.inputState.segments);
10450
10818
  if (!isMeaningfulUserInput(capturedInput.text) && capturedInput.attachments.length === 0)
10451
10819
  return;
10820
+ // A queued line is kept word for word in the session file and the task
10821
+ // handoff. A key command must never be kept, so it runs now, as Enter would.
10822
+ if (redactCredentialCommand(capturedInput.text) !== capturedInput.text) {
10823
+ this.clearComposerAfterSubmit(plainText);
10824
+ void this.handleSubmit(capturedInput);
10825
+ return;
10826
+ }
10452
10827
  if (this.controller.getQueue().length + this.handoffQueueReservedSlots >= MAX_QUEUE) {
10453
10828
  this.controller.setToast(`Queue full (${MAX_QUEUE}). Cancel or wait.`);
10454
10829
  return;
@@ -10693,6 +11068,16 @@ export class RatatuiApp {
10693
11068
  */
10694
11069
  async commitQueueEditText(entryId) {
10695
11070
  const text = serializeSegments(this.inputState.segments);
11071
+ // A queued line is kept word for word, so a key command is never saved into
11072
+ // one. The editor goes back to the queued line, which takes the key off
11073
+ // screen and lets Option+Down return to the composer.
11074
+ if (redactCredentialCommand(text) !== text) {
11075
+ const index = this.controller.getQueue().findIndex(entry => entry.id === entryId);
11076
+ if (index >= 0)
11077
+ this.loadQueueEntryIntoComposer(index);
11078
+ this.controller.setToast("Not saved: a key command can't wait in the queue. Run it from the composer.");
11079
+ return 'failed';
11080
+ }
10696
11081
  return this.persistQueuedCorrectionEdit(entryId, text.trim() ? text : null);
10697
11082
  }
10698
11083
  /**
@@ -10813,7 +11198,7 @@ export class RatatuiApp {
10813
11198
  async handleCommand(cmd, cmdArgs, publishUserMessage = true) {
10814
11199
  const cmdText = `/${cmd}${cmdArgs.length ? ' ' + cmdArgs.join(' ') : ''}`;
10815
11200
  if (publishUserMessage) {
10816
- this.mirror?.publishMessage('user', cmdText);
11201
+ this.mirror?.publishMessage('user', redactCredentialCommand(cmdText));
10817
11202
  }
10818
11203
  await this.ensureOptionalControllersForCommand(cmd);
10819
11204
  const denial = getPlanModeCommandDenial(this.controller.getMode(), cmd, cmdArgs);
@@ -10945,7 +11330,7 @@ export class RatatuiApp {
10945
11330
  catch (err) {
10946
11331
  this.addErrorMessage(`Command failed: ${err instanceof Error ? err.message : 'Unknown error'}`);
10947
11332
  }
10948
- this.controller.setHasApiKey(configStore.hasApiKey() || configStore.isAuthenticated());
11333
+ this.refreshConnectedState();
10949
11334
  // If /goal just set or resumed an objective, run its first turn now. The
10950
11335
  // turn-end hook (maybeContinueGoal) drives every turn after this one.
10951
11336
  const goalKick = goalManager.takeKick();
@@ -11057,12 +11442,25 @@ export class RatatuiApp {
11057
11442
  configStore.setCliOverride('model', prevModel);
11058
11443
  }
11059
11444
  const who = (provider && provider.trim()) || prevProvider || 'that provider';
11060
- this.addSystemMessage(`⚠ ${who} isn't signed in — run /accounts (or set a key) first. Keeping the current model.`);
11445
+ const fix = isRouterOnlyProvider(who) ? 'log in with /auth login'
11446
+ : isLocalSubscription(who) ? 'sign in through /accounts' : `add a key with /config key ${who}`;
11447
+ // A caller may have saved the choice first; rolling back cannot undo that.
11448
+ const kept = isOverseer ? this.overseerModelOverride?.provider ?? configStore.getProvider() : configStore.getProvider();
11449
+ this.addSystemMessage(normalizeProviderId(kept) === normalizeProviderId(who)
11450
+ ? `⚠ ${who} is selected but can't reach a model yet: ${fix}.`
11451
+ : `⚠ ${who} isn't set up; ${fix} first. Keeping the current model.`);
11061
11452
  debugLog(`[hot-swap] rebuild failed for ${who}; kept ${prevProvider}/${prevModel}`);
11062
11453
  return;
11063
11454
  }
11064
11455
  this.replaceAgent(rebuilt);
11065
11456
  const effectiveModel = this.overseerModelOverride?.model || configStore.getModel();
11457
+ // The bar measures what is in use against the new model's window at once; it kept the old model's share (70%
11458
+ // of a 131K window on a 1M model) until the next answer (2026-10-27).
11459
+ const { agentState } = this.controller.getState();
11460
+ if (agentState.contextTokens) {
11461
+ const status = contextStatusFromUsed(agentState.contextTokens, effectiveModel, configStore.getModelContextWindow(effectiveModel));
11462
+ this.controller.dispatch({ type: 'SET_CONTEXT', length: agentState.contextTokens, estimated: agentState.tokensEstimated ?? false, status });
11463
+ }
11066
11464
  debugLog(`[hot-swap] Model switched to ${this.overseerModelOverride?.provider || configStore.getProvider()}/${effectiveModel}`);
11067
11465
  }
11068
11466
  /**
@@ -11256,6 +11654,7 @@ export class RatatuiApp {
11256
11654
  this.controller.setMessages(mergeToolCheckpointMessages(this.controller.getState().messages, checkpoint.messages));
11257
11655
  await this.saveCurrentSession(true);
11258
11656
  },
11657
+ onMidTurnCompact: ({ signal, messages }) => this.ensureSessionManager().compactHistory(30, 5, signal, messages),
11259
11658
  });
11260
11659
  // Rebind the freshly-constructed store to the session dir. Some callers
11261
11660
  // (reloadAgent, Shift+Tab) are sync, so we can't force them to await;
@@ -11353,6 +11752,22 @@ export class RatatuiApp {
11353
11752
  return;
11354
11753
  this.ensureSessionManager().startAutoSave(this.AUTO_SAVE_INTERVAL);
11355
11754
  }
11755
+ idleCompactionInput() {
11756
+ const provider = configStore.getProvider();
11757
+ return {
11758
+ enabled: configStore.getIdleCompaction(),
11759
+ interactive: true,
11760
+ agentIdle: this.controller.getState().agentState.status === 'idle',
11761
+ pendingWork: Boolean(this.pendingAgentTurn || this.activePromptTurn && this.activePromptTurn.snapshot().finishedAt === undefined),
11762
+ queuedInput: this.controller.getState().queue.length > 0,
11763
+ contextTokens: this.controller.getState().contextLength ?? 0,
11764
+ minContextTokens: IDLE_COMPACT_MIN_CONTEXT_TOKENS,
11765
+ cacheLifetimeMs: resolveCacheLifetimeMs(provider, { configuredMs: configStore.getPromptCacheTtlMs() }),
11766
+ idleMs: Date.now() - this.lastCacheActivityAt,
11767
+ leadMs: IDLE_COMPACT_DEFAULT_LEAD_MS,
11768
+ alreadyCompacted: resolvePromptPrefixId(this.controller.getState().messages) !== undefined,
11769
+ };
11770
+ }
11356
11771
  /**
11357
11772
  * Save the current session to disk
11358
11773
  */
@@ -11373,10 +11788,11 @@ export class RatatuiApp {
11373
11788
  // Try lightweight mux-only save first; fall back to full session save
11374
11789
  // when no dedicated mux dir exists (non-colony global storage).
11375
11790
  const mgr = this.ensureSessionManager();
11791
+ // ZTC exits on an unhandled rejection; a failed background save once closed it mid-turn (2026-10-27).
11376
11792
  void mgr.saveMuxOnly().then((wrote) => {
11377
11793
  if (!wrote)
11378
- void mgr.save();
11379
- });
11794
+ return mgr.save();
11795
+ }).catch(error => debugLog(`[session] Layout save failed: ${String(error)}`));
11380
11796
  };
11381
11797
  if (delayMs <= 0) {
11382
11798
  doSave();
@@ -11588,7 +12004,7 @@ export class RatatuiApp {
11588
12004
  const answerText = data.questions.length === 1
11589
12005
  ? answers[0]
11590
12006
  : JSON.stringify(data.questions.map((q, i) => ({ question: q.question, answer: answers[i] })));
11591
- this.controller.addMessage({ role: 'user', content: answerText });
12007
+ this.controller.addMessage({ role: 'user', content: answerText, metadata: { askUserAnswer: true } });
11592
12008
  this.mirror?.publishMessage('system', `Auto-answered: ${answers.join(', ')} (headless mode)`);
11593
12009
  this.requestAgentTurn();
11594
12010
  return;
@@ -11630,7 +12046,7 @@ export class RatatuiApp {
11630
12046
  }
11631
12047
  if (data.questions.length === 1) {
11632
12048
  const answerText = formatAskUserResponse(data.questions, answers);
11633
- this.controller.addMessage({ role: 'user', content: answerText });
12049
+ this.controller.addMessage({ role: 'user', content: answerText, metadata: { askUserAnswer: true } });
11634
12050
  this.mirror?.publishMessage('user', answerText, { isAskUserAnswer: true });
11635
12051
  this.requestAgentTurn();
11636
12052
  return;
@@ -11639,7 +12055,7 @@ export class RatatuiApp {
11639
12055
  // when the user supplied one.
11640
12056
  const answerText = formatAskUserResponse(data.questions, answers);
11641
12057
  debugLog(`[askUser multi] sending answer: ${answerText.slice(0, 200)}`);
11642
- this.controller.addMessage({ role: 'user', content: answerText });
12058
+ this.controller.addMessage({ role: 'user', content: answerText, metadata: { askUserAnswer: true } });
11643
12059
  this.mirror?.publishMessage('user', answerText, { isAskUserAnswer: true });
11644
12060
  this.requestAgentTurn();
11645
12061
  }),
@@ -11688,6 +12104,22 @@ export class RatatuiApp {
11688
12104
  }
11689
12105
  }
11690
12106
  }
12107
+ buildHandoffSummarizer(signal, messages) {
12108
+ const agent = this.agent;
12109
+ if (!agent)
12110
+ return undefined;
12111
+ const context = agent.getHandoffContext(messages ?? this.controller.getState().messages);
12112
+ return modelHandoffSummarizer(context.backend, context.model, {
12113
+ request: context,
12114
+ signal,
12115
+ onFallback: () => {
12116
+ if (!signal?.aborted)
12117
+ this.controller.setToast('Model handoff failed. Using a local summary.');
12118
+ },
12119
+ system: context.system,
12120
+ tools: context.tools,
12121
+ });
12122
+ }
11691
12123
  ensureSessionManager() {
11692
12124
  if (!this.sessionManager) {
11693
12125
  this.sessionManager = new SessionManager({
@@ -11727,6 +12159,7 @@ export class RatatuiApp {
11727
12159
  },
11728
12160
  getHostedSettings: () => this.hostedSessionSettings ?? undefined,
11729
12161
  getUsageObserver: () => this.activePromptTurn?.observe,
12162
+ getHandoffSummarizer: (signal, messages) => this.buildHandoffSummarizer(signal, messages),
11730
12163
  onCheckpoint: session => {
11731
12164
  this.taskHandoff = session.task_handoff ? projectTaskHandoff(session.task_handoff) : null;
11732
12165
  this.agent?.setTaskHandoff(this.taskHandoff);
@@ -11967,6 +12400,18 @@ export class RatatuiApp {
11967
12400
  keepPrintedInPane: this.muxMode || this.paneMode,
11968
12401
  });
11969
12402
  }
12403
+ // An open turn alone fills the live frame. A terminal shows the
12404
+ // conversation before it in scrollback above the frame, but a pane and the
12405
+ // desktop app show scrollback only when scrolled, so keep it above the
12406
+ // turn there; otherwise the screen goes blank until the turn ends.
12407
+ if (!externalTranscriptActive && openTranscriptIndex >= 0 && (this.muxMode || this.paneMode)) {
12408
+ liveMessages = [
12409
+ ...selectFallbackLiveMessages(visibleMessages.slice(0, openTranscriptIndex), this.printedMessageIds, {
12410
+ keepPrintedInPane: true,
12411
+ }),
12412
+ ...liveMessages,
12413
+ ];
12414
+ }
11970
12415
  // Once the first-run banner has reached scrollback, remove only that
11971
12416
  // explicitly-marked message from the live frame so it appears once when
11972
12417
  // the user scrolls. Mux/pane modes retain their existing fallback.
@@ -11997,7 +12442,23 @@ export class RatatuiApp {
11997
12442
  const completionView = widgetActive ? null : this.updateSelectionCompletion();
11998
12443
  // The question form is a transient overlay, not a work surface: it sizes to
11999
12444
  // its own content and keeps the recent transcript visible above it.
12000
- const compactWidget = questionnaireActive || this.busyScopeChoice !== null || this.workspaceChoice !== null;
12445
+ // A select its caller marked compact (the connect prompt) draws the same
12446
+ // way, when nothing drawn ahead of it in the widget chain below is open.
12447
+ const compactSelect = this.selectWidget.isActive() && this.selectWidget.isCompact()
12448
+ && !this.promptViewer.isActive() && !this.logViewWidget.isActive() && !this.fullPageSurfaceOpen
12449
+ && !questionnaireActive && !this.formWidget.isActive();
12450
+ const compactWidget = questionnaireActive || this.busyScopeChoice !== null || this.workspaceChoice !== null || compactSelect;
12451
+ // The select follows the transcript it continues: in a zmux pane its rows
12452
+ // start right after the rows ZTC shipped, as the site's film shows the
12453
+ // connect prompt under ZTC's welcome, and the spare rows go under it.
12454
+ const followedTranscriptRows = compactSelect && externalTranscriptActive && this.transcriptRows !== null
12455
+ ? this.transcriptRows
12456
+ : undefined;
12457
+ // The launch transcript (system messages only) opens on the welcome's
12458
+ // wordmark. When it cannot fit above the open prompt, zmux would show its
12459
+ // tail and cut the wordmark, so the welcome drops it and ships again.
12460
+ const launchWordmarkAtRisk = followedTranscriptRows !== undefined && this.launchWordmarkFits
12461
+ && state.messages.every(message => message.role === 'system');
12001
12462
  // The transcript region must stay above the activity line as the
12002
12463
  // completion menu expands or contracts.
12003
12464
  // Settings is a full work surface. Unlike transient questions and pickers,
@@ -12070,10 +12531,14 @@ export class RatatuiApp {
12070
12531
  widgetView = surface.view;
12071
12532
  }
12072
12533
  else if (this.formWidget.isActive()) {
12073
- widgetContent = this.formWidget.buildContent();
12534
+ widgetContent = this.formWidget.buildContent(this.cols);
12074
12535
  }
12075
12536
  else if (this.selectWidget.isActive()) {
12076
- widgetContent = this.selectWidget.buildContent(this.cols);
12537
+ // Sized to its rows so the options, key hints and border never clip. The
12538
+ // styled view carries the colours; `content` is the plain text measured.
12539
+ const surface = this.selectWidget.buildSurface(this.cols, widgetLayout.widgetHeight || widgetLayout.contentAreaHeight);
12540
+ widgetContent = surface.content;
12541
+ widgetView = surface.view;
12077
12542
  }
12078
12543
  else if (this.textInputWidget.isActive()) {
12079
12544
  widgetContent = this.textInputWidget.buildContent();
@@ -12095,12 +12560,18 @@ export class RatatuiApp {
12095
12560
  widgetActive,
12096
12561
  compactWidget,
12097
12562
  widgetContentRows: widgetContent.split('\n').length,
12563
+ transcriptRows: followedTranscriptRows,
12098
12564
  queueTotal: state.queue.length,
12099
12565
  externalTranscript: widgetExternalTranscript,
12100
12566
  agentActive,
12101
12567
  statusLine: configStore.get().statusLine,
12102
12568
  });
12103
12569
  }
12570
+ if (launchWordmarkAtRisk && followedTranscriptRows > frameLayout.transcriptHeight) {
12571
+ this.launchWordmarkFits = false;
12572
+ this.forceTranscriptRebuildOnNextRender();
12573
+ queueMicrotask(() => this.render());
12574
+ }
12104
12575
  // Dynamically expand viewport when a widget is active so it doesn't get cut off
12105
12576
  let effectiveViewportHeight = this.liveViewportHeight;
12106
12577
  if (widgetContent) {
@@ -12126,7 +12597,6 @@ export class RatatuiApp {
12126
12597
  messages: liveMessages,
12127
12598
  agentState: state.agentState,
12128
12599
  inputState: this.inputState,
12129
- canYank: this.showYankHint && this.inputState.segments.length === 0,
12130
12600
  sessionId: state.sessionId,
12131
12601
  sessionName: this.sessionName,
12132
12602
  cols: this.cols,
@@ -12157,9 +12627,13 @@ export class RatatuiApp {
12157
12627
  renderer: 'ratatui',
12158
12628
  showHeader: false,
12159
12629
  showMessages: !widgetContent && liveMessages.length > 0,
12630
+ // A pane and the desktop app draw the transcript in this frame; start it
12631
+ // at the top, as zmux draws the CLI's.
12632
+ transcriptAnchor: this.muxMode || this.paneMode ? 'top' : 'bottom',
12160
12633
  widgetContent,
12161
12634
  widgetView,
12162
12635
  compactWidget,
12636
+ transcriptRows: followedTranscriptRows,
12163
12637
  // Dictation state
12164
12638
  isRecording: state.isRecording,
12165
12639
  recordingDevice: state.recordingDevice,
@@ -12831,7 +13305,12 @@ export class RatatuiApp {
12831
13305
  if (this.exiting)
12832
13306
  return this.exitComplete;
12833
13307
  this.exiting = true;
13308
+ this.idleCompaction.cancel();
12834
13309
  this.startupCatalogController.abort(new Error('Runtime stopped'));
13310
+ this.stopFollowingConfig?.();
13311
+ this.stopFollowingConfig = null;
13312
+ this.stopFollowingLogin?.();
13313
+ this.stopFollowingLogin = null;
12835
13314
  this.intakeNotifications.dispose();
12836
13315
  if (this.intakePollTimer) {
12837
13316
  clearInterval(this.intakePollTimer);
@@ -13295,6 +13774,15 @@ export class RatatuiApp {
13295
13774
  this.controller.setToast('Session scan failed');
13296
13775
  }
13297
13776
  }
13777
+ /** /rewind and two idle Escapes open the picker only between turns. */
13778
+ openRewindPanelWhenIdle() {
13779
+ if (this.isAgentBusy()) {
13780
+ this.controller.setToast('Stop the running turn before using /rewind');
13781
+ this.render();
13782
+ return;
13783
+ }
13784
+ this.openRewindPanel();
13785
+ }
13298
13786
  /**
13299
13787
  * Explicit /rewind prompt picker. Lists the prompts of this session and rewinds
13300
13788
  * to the chosen one: everything from that prompt on leaves the transcript and
@@ -13347,11 +13835,16 @@ export class RatatuiApp {
13347
13835
  }
13348
13836
  }
13349
13837
  this.controller.setToast(`Rewound ${plan.removedCount} message${plan.removedCount === 1 ? '' : 's'}`);
13350
- void this.saveCurrentSession();
13838
+ void this.saveCurrentSession().catch(error => debugLog(`[session] Save after rewind failed: ${String(error)}`));
13351
13839
  this.render();
13352
13840
  }
13353
13841
  /** Put the rewound prompt back in the composer, attachments included. */
13354
13842
  restoreComposerAfterRewind(text, attachments) {
13843
+ // A typed draft is kept the way Ctrl+C keeps one: Ctrl+Y brings it back.
13844
+ if (this.inputState.segments.length > 0) {
13845
+ this.recordKill(killInputDraft(this.inputState).killed);
13846
+ this.controller.setToast('Draft replaced · Ctrl+Y restores');
13847
+ }
13355
13848
  const segments = [{ type: 'text', text }];
13356
13849
  for (const attachment of attachments) {
13357
13850
  if (attachment.localPath)