@deepseek-harness-tui/dsh-tui 0.16.1 → 0.18.0

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 (488) hide show
  1. package/README.md +213 -34
  2. package/assets/plugin-icon.svg +13 -0
  3. package/assets/windows-installer.cs +308 -0
  4. package/assets/windows-installer.ps1 +17 -0
  5. package/bin/dsh-tui.js +64 -5
  6. package/cli/adapters/dsh/index.mjs +111 -0
  7. package/cli/adapters/dsh/locate.mjs +73 -0
  8. package/cli/adapters/dsh/management-plugin.mjs +111 -0
  9. package/cli/args.mjs +154 -0
  10. package/cli/contracts.d.ts +48 -0
  11. package/cli/engine.mjs +92 -0
  12. package/cli/entry.mjs +48 -0
  13. package/cli/process.mjs +118 -0
  14. package/cli/protocol.mjs +23 -0
  15. package/cli/schema-v1.json +33 -0
  16. package/cordis.patch.yml +3 -1
  17. package/cordis.yml +3 -1
  18. package/guide/dsh-tui-guide/SKILL.md +1 -0
  19. package/guide/dsh-tui-guide/cli.en.md +114 -0
  20. package/guide/dsh-tui-guide/cli.md +114 -0
  21. package/guide/dsh-tui-guide/configuration.en.md +7 -5
  22. package/guide/dsh-tui-guide/configuration.md +7 -5
  23. package/guide/dsh-tui-guide/getting-started.en.md +33 -3
  24. package/guide/dsh-tui-guide/getting-started.md +23 -2
  25. package/guide/dsh-tui-guide/interaction.en.md +50 -17
  26. package/guide/dsh-tui-guide/interaction.md +35 -13
  27. package/guide/dsh-tui-guide/plugins.en.md +63 -11
  28. package/guide/dsh-tui-guide/plugins.md +41 -7
  29. package/guide/dsh-tui-guide/user-guide.en.md +55 -34
  30. package/guide/dsh-tui-guide/user-guide.md +45 -28
  31. package/lib/settings.json +85 -42
  32. package/lib/types/adapter/channel/plugins.d.ts.map +1 -1
  33. package/lib/types/adapter/channel/plugins.js +8 -0
  34. package/lib/types/adapter/channel/ui-policy.d.ts +2 -1
  35. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  36. package/lib/types/adapter/channel/ui-policy.js +4 -0
  37. package/lib/types/adapter/ports/channel-display.d.ts +10 -0
  38. package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
  39. package/lib/types/adapter/ports/channel-session.d.ts +2 -0
  40. package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
  41. package/lib/types/adapter/ports/channel-settings.d.ts +20 -0
  42. package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
  43. package/lib/types/adapter/ports/channel-ui.d.ts +22 -2
  44. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  45. package/lib/types/adapter/ports/channel-view.d.ts +11 -1
  46. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  47. package/lib/types/adapter/ports/channel.d.ts +7 -0
  48. package/lib/types/adapter/ports/channel.d.ts.map +1 -1
  49. package/lib/types/adapter/standard/grants.d.ts +60 -0
  50. package/lib/types/adapter/standard/grants.d.ts.map +1 -1
  51. package/lib/types/adapter/standard/grants.js +74 -0
  52. package/lib/types/agent/capabilities.d.ts +2 -0
  53. package/lib/types/agent/capabilities.d.ts.map +1 -1
  54. package/lib/types/agent/events.d.ts +15 -1
  55. package/lib/types/agent/events.d.ts.map +1 -1
  56. package/lib/types/api.d.ts +2 -2
  57. package/lib/types/api.d.ts.map +1 -1
  58. package/lib/types/backends/claude/translate/events.d.ts.map +1 -1
  59. package/lib/types/backends/claude/translate/events.js +2 -1
  60. package/lib/types/backends/codex/auth/status.js +1 -1
  61. package/lib/types/backends/codex/session/controls.d.ts.map +1 -1
  62. package/lib/types/backends/codex/session/controls.js +6 -5
  63. package/lib/types/backends/codex/session/goals.d.ts.map +1 -1
  64. package/lib/types/backends/codex/session/side-query.d.ts.map +1 -1
  65. package/lib/types/backends/codex/translate/events.d.ts.map +1 -1
  66. package/lib/types/backends/codex/translate/events.js +3 -1
  67. package/lib/types/backends/shared/channel-tokens.d.ts.map +1 -1
  68. package/lib/types/backends/shared/channel-tokens.js +9 -8
  69. package/lib/types/channel/history-restore.d.ts.map +1 -1
  70. package/lib/types/channel/history-restore.js +2 -0
  71. package/lib/types/channel/interaction.d.ts.map +1 -1
  72. package/lib/types/channel/interaction.js +1 -0
  73. package/lib/types/channel/projection.d.ts +1 -1
  74. package/lib/types/channel/projection.d.ts.map +1 -1
  75. package/lib/types/channel/projection.js +19 -4
  76. package/lib/types/channel/questions.d.ts +2 -0
  77. package/lib/types/channel/questions.d.ts.map +1 -1
  78. package/lib/types/channel/sanitize.d.ts +14 -0
  79. package/lib/types/channel/sanitize.d.ts.map +1 -1
  80. package/lib/types/channel/sanitize.js +55 -0
  81. package/lib/types/channel/working-directory.d.ts +9 -0
  82. package/lib/types/channel/working-directory.d.ts.map +1 -0
  83. package/lib/types/channel/working-directory.js +7 -0
  84. package/lib/types/commands.d.ts +8 -1
  85. package/lib/types/commands.d.ts.map +1 -1
  86. package/lib/types/commands.js +14 -5
  87. package/lib/types/components/ChatTitle.d.ts +7 -0
  88. package/lib/types/components/ChatTitle.d.ts.map +1 -0
  89. package/lib/types/components/ChatTitle.js +15 -0
  90. package/lib/types/components/CodeBlockFrame.d.ts.map +1 -1
  91. package/lib/types/components/CodeBlockFrame.js +10 -5
  92. package/lib/types/components/CompactionStatusRow.d.ts.map +1 -1
  93. package/lib/types/components/CompactionStatusRow.js +24 -3
  94. package/lib/types/components/GoalTodoPanel.d.ts +73 -6
  95. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  96. package/lib/types/components/GoalTodoPanel.js +165 -17
  97. package/lib/types/components/Markdown.d.ts +9 -1
  98. package/lib/types/components/Markdown.d.ts.map +1 -1
  99. package/lib/types/components/Markdown.js +5 -4
  100. package/lib/types/components/MessageList.d.ts.map +1 -1
  101. package/lib/types/components/MessageList.js +20 -14
  102. package/lib/types/components/PluginGrantList.d.ts +45 -0
  103. package/lib/types/components/PluginGrantList.d.ts.map +1 -0
  104. package/lib/types/components/PluginGrantList.js +126 -0
  105. package/lib/types/components/PluginInstallPane.d.ts.map +1 -1
  106. package/lib/types/components/PluginInstallPane.js +35 -6
  107. package/lib/types/components/PluginManagePane.d.ts.map +1 -1
  108. package/lib/types/components/PluginManagePane.js +65 -8
  109. package/lib/types/components/PromptInput.d.ts +13 -5
  110. package/lib/types/components/PromptInput.d.ts.map +1 -1
  111. package/lib/types/components/PromptInput.js +190 -108
  112. package/lib/types/components/SplitDiffView.d.ts.map +1 -1
  113. package/lib/types/components/SplitDiffView.js +232 -22
  114. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  115. package/lib/types/components/SubagentDashboard.js +10 -0
  116. package/lib/types/components/SubagentDetailScene.d.ts +3 -1
  117. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  118. package/lib/types/components/SubagentDetailScene.js +17 -1
  119. package/lib/types/components/Whale.d.ts.map +1 -1
  120. package/lib/types/components/Whale.js +8 -5
  121. package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
  122. package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
  123. package/lib/types/components/approvals/ApprovalPanel.js +93 -11
  124. package/lib/types/components/bigfont.d.ts.map +1 -1
  125. package/lib/types/components/bigfont.js +2 -1
  126. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -1
  127. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  128. package/lib/types/components/messages/AssistantToolUseMessage.js +24 -11
  129. package/lib/types/components/onboardingModel.d.ts +2 -2
  130. package/lib/types/components/onboardingModel.js +3 -3
  131. package/lib/types/components/onboardingProviderPlan.d.ts +110 -0
  132. package/lib/types/components/onboardingProviderPlan.d.ts.map +1 -0
  133. package/lib/types/components/onboardingProviderPlan.js +78 -0
  134. package/lib/types/components/previewRows.d.ts +19 -0
  135. package/lib/types/components/previewRows.d.ts.map +1 -0
  136. package/lib/types/components/previewRows.js +46 -0
  137. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  138. package/lib/types/components/questions/AskUserQuestionPanel.js +75 -10
  139. package/lib/types/components/sessions/ForeignSessionRow.d.ts +3 -9
  140. package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -1
  141. package/lib/types/components/sessions/ForeignSessionRow.js +6 -10
  142. package/lib/types/components/sessions/SessionListRow.d.ts +4 -9
  143. package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
  144. package/lib/types/components/sessions/SessionListRow.js +18 -10
  145. package/lib/types/components/sidePanel/InfoPanel.d.ts.map +1 -1
  146. package/lib/types/components/sidePanel/InfoPanel.js +4 -3
  147. package/lib/types/components/sidePanel/SidePanelLayout.d.ts.map +1 -1
  148. package/lib/types/components/sidePanel/SidePanelLayout.js +5 -5
  149. package/lib/types/components/sidePanel/WorkspacePanel.d.ts.map +1 -1
  150. package/lib/types/components/sidePanel/WorkspacePanel.js +19 -7
  151. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +7 -0
  152. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
  153. package/lib/types/components/sidePanel/btw/BtwComposer.js +16 -0
  154. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
  155. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +8 -1
  156. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts +7 -1
  157. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
  158. package/lib/types/components/sidePanel/btw/BtwThreadScene.js +8 -1
  159. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts +30 -0
  160. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts.map +1 -0
  161. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.js +94 -0
  162. package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
  163. package/lib/types/components/sidePanel/builtinPanels.js +36 -18
  164. package/lib/types/components/sidePanel/companion/CompanionPanel.d.ts.map +1 -1
  165. package/lib/types/components/sidePanel/companion/CompanionPanel.js +2 -1
  166. package/lib/types/components/sidePanel/panelMarkdown.d.ts +32 -0
  167. package/lib/types/components/sidePanel/panelMarkdown.d.ts.map +1 -0
  168. package/lib/types/components/sidePanel/panelMarkdown.js +45 -0
  169. package/lib/types/components/sidePanel/pluginPanelAdapter.d.ts.map +1 -1
  170. package/lib/types/components/sidePanel/pluginPanelAdapter.js +6 -1
  171. package/lib/types/components/sidePanel/subagentFailureRead.d.ts +21 -0
  172. package/lib/types/components/sidePanel/subagentFailureRead.d.ts.map +1 -0
  173. package/lib/types/components/sidePanel/subagentFailureRead.js +66 -0
  174. package/lib/types/components/sidePanel/types.d.ts +2 -0
  175. package/lib/types/components/sidePanel/types.d.ts.map +1 -1
  176. package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
  177. package/lib/types/components/sidePanel/useSidePanel.js +39 -7
  178. package/lib/types/components/trajectory/MiniWake.d.ts +2 -2
  179. package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
  180. package/lib/types/components/trajectory/MiniWake.js +7 -3
  181. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
  182. package/lib/types/components/workspaces/HomeWorkspaceRow.js +4 -7
  183. package/lib/types/dsh-adapter/backend/session.d.ts +7 -1
  184. package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
  185. package/lib/types/dsh-adapter/backend/session.js +62 -6
  186. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  187. package/lib/types/dsh-adapter/backend/translate.js +18 -4
  188. package/lib/types/dsh-adapter/backend-admission.d.ts +3 -3
  189. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
  190. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
  191. package/lib/types/dsh-adapter/channel/agent-view-projection.js +3 -1
  192. package/lib/types/dsh-adapter/channel/binding-events.d.ts +5 -1
  193. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  194. package/lib/types/dsh-adapter/channel/binding-events.js +18 -1
  195. package/lib/types/dsh-adapter/channel/command-completions.d.ts.map +1 -1
  196. package/lib/types/dsh-adapter/channel/command-completions.js +6 -8
  197. package/lib/types/dsh-adapter/channel/composer-images.d.ts +11 -1
  198. package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
  199. package/lib/types/dsh-adapter/channel/composer-images.js +121 -113
  200. package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
  201. package/lib/types/dsh-adapter/channel/composer-mentions.js +38 -17
  202. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +1 -1
  203. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
  204. package/lib/types/dsh-adapter/channel/context-bookkeeping.js +9 -5
  205. package/lib/types/dsh-adapter/channel/core/actions.d.ts +1 -1
  206. package/lib/types/dsh-adapter/channel/core/actions.d.ts.map +1 -1
  207. package/lib/types/dsh-adapter/channel/core/actions.js +23 -2
  208. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +10 -1
  209. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
  210. package/lib/types/dsh-adapter/channel/core/binding-feed.js +48 -3
  211. package/lib/types/dsh-adapter/channel/core/compose.d.ts +5 -2
  212. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  213. package/lib/types/dsh-adapter/channel/core/compose.js +7 -0
  214. package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
  215. package/lib/types/dsh-adapter/channel/core/files.js +2 -1
  216. package/lib/types/dsh-adapter/channel/core/host.d.ts +14 -10
  217. package/lib/types/dsh-adapter/channel/core/host.d.ts.map +1 -1
  218. package/lib/types/dsh-adapter/channel/core/host.js +192 -13
  219. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts +1 -0
  220. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
  221. package/lib/types/dsh-adapter/channel/core/local-actions.js +32 -3
  222. package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
  223. package/lib/types/dsh-adapter/channel/extensions.js +31 -5
  224. package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
  225. package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
  226. package/lib/types/dsh-adapter/channel/input-actions.js +34 -0
  227. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +5 -2
  228. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  229. package/lib/types/dsh-adapter/channel/input-delivery.js +31 -4
  230. package/lib/types/dsh-adapter/channel/mentions.d.ts.map +1 -1
  231. package/lib/types/dsh-adapter/channel/mentions.js +21 -7
  232. package/lib/types/dsh-adapter/channel/model-actions.d.ts +1 -1
  233. package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
  234. package/lib/types/dsh-adapter/channel/model-actions.js +7 -1
  235. package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
  236. package/lib/types/dsh-adapter/channel/model-selection.js +6 -4
  237. package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
  238. package/lib/types/dsh-adapter/channel/paths.js +11 -9
  239. package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
  240. package/lib/types/dsh-adapter/channel/session-fork.js +1 -0
  241. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +1 -1
  242. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
  243. package/lib/types/dsh-adapter/channel/session-live-adoption.js +6 -1
  244. package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
  245. package/lib/types/dsh-adapter/channel/session-metadata.js +15 -2
  246. package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
  247. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  248. package/lib/types/dsh-adapter/channel/session-reset.js +7 -1
  249. package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -1
  250. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  251. package/lib/types/dsh-adapter/channel/session-resume.js +56 -36
  252. package/lib/types/dsh-adapter/channel/session-rewind.d.ts +1 -1
  253. package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
  254. package/lib/types/dsh-adapter/channel/session-rewind.js +3 -1
  255. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts +1 -1
  256. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
  257. package/lib/types/dsh-adapter/channel/session-tree-actions.js +3 -1
  258. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  259. package/lib/types/dsh-adapter/channel/settings-host.js +10 -3
  260. package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
  261. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  262. package/lib/types/dsh-adapter/channel/state.js +2 -2
  263. package/lib/types/dsh-adapter/channel/types.d.ts +13 -1
  264. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  265. package/lib/types/dsh-adapter/compat/liveSession.d.ts +3 -3
  266. package/lib/types/dsh-adapter/compat/liveSession.js +3 -3
  267. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +1 -1
  268. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
  269. package/lib/types/dsh-adapter/compat/sessionLog.js +17 -1
  270. package/lib/types/dsh-adapter/contract.d.ts +7 -5
  271. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  272. package/lib/types/dsh-adapter/contract.js +10 -5
  273. package/lib/types/dsh-adapter/effect-ledger.d.ts +1 -1
  274. package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -1
  275. package/lib/types/dsh-adapter/effect-ledger.js +1 -0
  276. package/lib/types/dsh-adapter/entry-slot.d.ts +6 -0
  277. package/lib/types/dsh-adapter/entry-slot.d.ts.map +1 -1
  278. package/lib/types/dsh-adapter/experimental-bundles.d.ts +29 -0
  279. package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -0
  280. package/lib/types/dsh-adapter/experimental-bundles.js +15 -0
  281. package/lib/types/dsh-adapter/grant-file.d.ts +70 -0
  282. package/lib/types/dsh-adapter/grant-file.d.ts.map +1 -0
  283. package/lib/types/dsh-adapter/grant-file.js +178 -0
  284. package/lib/types/dsh-adapter/host-access.d.ts +4 -0
  285. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
  286. package/lib/types/dsh-adapter/host-access.js +54 -4
  287. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  288. package/lib/types/dsh-adapter/host-contract.js +2 -2
  289. package/lib/types/dsh-adapter/host-dsh.js +3 -3
  290. package/lib/types/dsh-adapter/index.d.ts +8 -4
  291. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  292. package/lib/types/dsh-adapter/index.js +17 -12
  293. package/lib/types/dsh-adapter/panels.d.ts +28 -8
  294. package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
  295. package/lib/types/dsh-adapter/panels.js +11 -56
  296. package/lib/types/dsh-adapter/plugin-declaration.d.ts +28 -0
  297. package/lib/types/dsh-adapter/plugin-declaration.d.ts.map +1 -1
  298. package/lib/types/dsh-adapter/plugin-declaration.js +43 -1
  299. package/lib/types/dsh-adapter/plugin-install.d.ts +28 -1
  300. package/lib/types/dsh-adapter/plugin-install.d.ts.map +1 -1
  301. package/lib/types/dsh-adapter/plugin-install.js +160 -13
  302. package/lib/types/dsh-adapter/plugin-manage.d.ts +53 -10
  303. package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
  304. package/lib/types/dsh-adapter/plugin-manage.js +240 -51
  305. package/lib/types/dsh-adapter/plugin.d.ts +81 -0
  306. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  307. package/lib/types/dsh-adapter/plugin.js +378 -84
  308. package/lib/types/dsh-adapter/plugins-info.d.ts +6 -7
  309. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
  310. package/lib/types/dsh-adapter/plugins-info.js +99 -31
  311. package/lib/types/dsh-adapter/presets.d.ts +19 -6
  312. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  313. package/lib/types/dsh-adapter/presets.js +69 -12
  314. package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
  315. package/lib/types/dsh-adapter/process-exit.js +1 -1
  316. package/lib/types/dsh-adapter/providerWizard.d.ts +2 -0
  317. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  318. package/lib/types/dsh-adapter/providerWizard.js +11 -5
  319. package/lib/types/dsh-adapter/row-attachment.d.ts +30 -0
  320. package/lib/types/dsh-adapter/row-attachment.d.ts.map +1 -0
  321. package/lib/types/dsh-adapter/row-attachment.js +29 -0
  322. package/lib/types/dsh-adapter/session-tools.d.ts +34 -0
  323. package/lib/types/dsh-adapter/session-tools.d.ts.map +1 -0
  324. package/lib/types/dsh-adapter/session-tools.js +39 -0
  325. package/lib/types/dsh-adapter/settings-sections.d.ts +18 -1
  326. package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
  327. package/lib/types/dsh-adapter/settings-sections.js +73 -0
  328. package/lib/types/dsh-adapter/status.d.ts +88 -1
  329. package/lib/types/dsh-adapter/status.d.ts.map +1 -1
  330. package/lib/types/dsh-adapter/status.js +318 -3
  331. package/lib/types/dsh-adapter/team-mode.d.ts +42 -33
  332. package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
  333. package/lib/types/dsh-adapter/team-mode.js +76 -112
  334. package/lib/types/dsh-adapter/worktree-tool.d.ts +27 -0
  335. package/lib/types/dsh-adapter/worktree-tool.d.ts.map +1 -0
  336. package/lib/types/dsh-adapter/worktree-tool.js +87 -0
  337. package/lib/types/extensions.d.ts +1 -1
  338. package/lib/types/extensions.d.ts.map +1 -1
  339. package/lib/types/force-production-react.js +3 -3
  340. package/lib/types/heldInputs.d.ts +36 -0
  341. package/lib/types/heldInputs.d.ts.map +1 -0
  342. package/lib/types/heldInputs.js +173 -0
  343. package/lib/types/i18n.d.ts +543 -73
  344. package/lib/types/i18n.d.ts.map +1 -1
  345. package/lib/types/i18n.js +265 -46
  346. package/lib/types/ink/colorize.d.ts +7 -1
  347. package/lib/types/ink/colorize.d.ts.map +1 -1
  348. package/lib/types/ink/colorize.js +29 -8
  349. package/lib/types/ink/components/App.d.ts +2 -1
  350. package/lib/types/ink/components/App.d.ts.map +1 -1
  351. package/lib/types/ink/components/App.js +10 -3
  352. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
  353. package/lib/types/ink/components/ScrollBox.js +1 -0
  354. package/lib/types/ink/dom.d.ts +1 -0
  355. package/lib/types/ink/dom.d.ts.map +1 -1
  356. package/lib/types/ink/hooks/use-program-status.d.ts +78 -0
  357. package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -0
  358. package/lib/types/ink/hooks/use-program-status.js +96 -0
  359. package/lib/types/ink/ink.d.ts +13 -4
  360. package/lib/types/ink/ink.d.ts.map +1 -1
  361. package/lib/types/ink/ink.js +119 -25
  362. package/lib/types/ink/output.d.ts +17 -2
  363. package/lib/types/ink/output.d.ts.map +1 -1
  364. package/lib/types/ink/output.js +85 -2
  365. package/lib/types/ink/parse-keypress.d.ts +1 -0
  366. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  367. package/lib/types/ink/parse-keypress.js +5 -4
  368. package/lib/types/ink/render-node-to-output.d.ts +2 -0
  369. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  370. package/lib/types/ink/render-node-to-output.js +79 -10
  371. package/lib/types/ink/root.d.ts +8 -0
  372. package/lib/types/ink/root.d.ts.map +1 -1
  373. package/lib/types/ink/root.js +12 -3
  374. package/lib/types/ink/screen.d.ts +11 -0
  375. package/lib/types/ink/screen.d.ts.map +1 -1
  376. package/lib/types/ink/screen.js +44 -0
  377. package/lib/types/ink/selection.d.ts +7 -2
  378. package/lib/types/ink/selection.d.ts.map +1 -1
  379. package/lib/types/ink/selection.js +187 -44
  380. package/lib/types/ink/shutdown-input.d.ts +15 -0
  381. package/lib/types/ink/shutdown-input.d.ts.map +1 -0
  382. package/lib/types/ink/shutdown-input.js +28 -0
  383. package/lib/types/ink/sixel-cursor-heal.d.ts +21 -0
  384. package/lib/types/ink/sixel-cursor-heal.d.ts.map +1 -0
  385. package/lib/types/ink/sixel-cursor-heal.js +62 -0
  386. package/lib/types/ink/sixel-graphics.d.ts +6 -0
  387. package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
  388. package/lib/types/ink/sixel-graphics.js +18 -0
  389. package/lib/types/ink/styles.d.ts +8 -1
  390. package/lib/types/ink/styles.d.ts.map +1 -1
  391. package/lib/types/ink/terminal-notification-windows.d.ts +195 -0
  392. package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -0
  393. package/lib/types/ink/terminal-notification-windows.js +433 -0
  394. package/lib/types/ink/terminal-notification.d.ts +3 -1
  395. package/lib/types/ink/terminal-notification.d.ts.map +1 -1
  396. package/lib/types/ink/terminal-notification.js +4 -1
  397. package/lib/types/ink/terminal-querier.d.ts +9 -1
  398. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  399. package/lib/types/ink/terminal-querier.js +32 -1
  400. package/lib/types/ink/terminal.d.ts +23 -2
  401. package/lib/types/ink/terminal.d.ts.map +1 -1
  402. package/lib/types/ink/terminal.js +32 -2
  403. package/lib/types/ink/termio/osc.d.ts +2 -1
  404. package/lib/types/ink/termio/osc.d.ts.map +1 -1
  405. package/lib/types/ink/termio/osc.js +37 -8
  406. package/lib/types/ink/termio/osc7501.d.ts +102 -0
  407. package/lib/types/ink/termio/osc7501.d.ts.map +1 -0
  408. package/lib/types/ink/termio/osc7501.js +229 -0
  409. package/lib/types/ink/termio/tokenize.js +5 -7
  410. package/lib/types/onboardingDraft.d.ts +143 -0
  411. package/lib/types/onboardingDraft.d.ts.map +1 -0
  412. package/lib/types/onboardingDraft.js +71 -0
  413. package/lib/types/panels.d.ts +1 -1
  414. package/lib/types/panels.d.ts.map +1 -1
  415. package/lib/types/screens/AgentTranscriptScene.d.ts +3 -1
  416. package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
  417. package/lib/types/screens/AgentTranscriptScene.js +5 -1
  418. package/lib/types/screens/Chat.d.ts +6 -6
  419. package/lib/types/screens/Chat.d.ts.map +1 -1
  420. package/lib/types/screens/Chat.js +394 -141
  421. package/lib/types/screens/Launchpad.d.ts +8 -2
  422. package/lib/types/screens/Launchpad.d.ts.map +1 -1
  423. package/lib/types/screens/Launchpad.js +32 -12
  424. package/lib/types/screens/Onboarding.d.ts +22 -3
  425. package/lib/types/screens/Onboarding.d.ts.map +1 -1
  426. package/lib/types/screens/Onboarding.js +606 -36
  427. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  428. package/lib/types/screens/SessionSupervisor.js +31 -21
  429. package/lib/types/screens/Settings.d.ts +5 -1
  430. package/lib/types/screens/Settings.d.ts.map +1 -1
  431. package/lib/types/screens/Settings.js +528 -51
  432. package/lib/types/screens/StatusLine.d.ts +9 -3
  433. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  434. package/lib/types/screens/StatusLine.js +91 -15
  435. package/lib/types/screens/StatusMetrics.d.ts +2 -11
  436. package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
  437. package/lib/types/screens/StatusMetrics.js +20 -14
  438. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
  439. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +1 -1
  440. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +1 -1
  441. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
  442. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +13 -21
  443. package/lib/types/sessionMounts.d.ts +14 -0
  444. package/lib/types/sessionMounts.d.ts.map +1 -1
  445. package/lib/types/sessionMounts.js +20 -9
  446. package/lib/types/sessions/format.d.ts +39 -0
  447. package/lib/types/sessions/format.d.ts.map +1 -1
  448. package/lib/types/sessions/format.js +83 -0
  449. package/lib/types/sessions/resumeFailure.d.ts +4 -0
  450. package/lib/types/sessions/resumeFailure.d.ts.map +1 -1
  451. package/lib/types/sessions/resumeFailure.js +12 -4
  452. package/lib/types/sessions/workspaceCounts.d.ts +6 -0
  453. package/lib/types/sessions/workspaceCounts.d.ts.map +1 -0
  454. package/lib/types/sessions/workspaceCounts.js +24 -0
  455. package/lib/types/settings/definitions.d.ts +24 -0
  456. package/lib/types/settings/definitions.d.ts.map +1 -1
  457. package/lib/types/settings/definitions.js +40 -15
  458. package/lib/types/tips.js +2 -2
  459. package/lib/types/tuiDisplayPrefs.d.ts +113 -5
  460. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  461. package/lib/types/tuiDisplayPrefs.js +276 -14
  462. package/lib/types/update.d.ts +15 -14
  463. package/lib/types/update.d.ts.map +1 -1
  464. package/lib/types/update.js +163 -115
  465. package/lib/types/updateProcess.d.ts +28 -0
  466. package/lib/types/updateProcess.d.ts.map +1 -0
  467. package/lib/types/updateProcess.js +135 -0
  468. package/lib/types/utils/inputWordBoundary.d.ts +5 -0
  469. package/lib/types/utils/inputWordBoundary.d.ts.map +1 -0
  470. package/lib/types/utils/inputWordBoundary.js +18 -0
  471. package/lib/types/utils/keymap.d.ts +1 -1
  472. package/lib/types/utils/keymap.d.ts.map +1 -1
  473. package/lib/types/utils/keymap.js +6 -1
  474. package/lib/types/utils/paths.d.ts +15 -0
  475. package/lib/types/utils/paths.d.ts.map +1 -1
  476. package/lib/types/utils/paths.js +25 -0
  477. package/lib/types/windowsInstaller.d.ts +4 -0
  478. package/lib/types/windowsInstaller.d.ts.map +1 -0
  479. package/lib/types/windowsInstaller.js +237 -0
  480. package/locale/en.json +6 -0
  481. package/locale/zh.json +6 -0
  482. package/package.json +130 -111
  483. package/presets/liangshen/custom-bash.mjs +13 -1
  484. package/presets/liangshen/instruction-hint.mjs +4 -1
  485. package/presets/liangshen/skill-search.mjs +14 -2
  486. package/presets/winbash.mjs +16 -4
  487. package/tui-profile/feed/README.md +17 -8
  488. package/tui-profile/feed/first-party.json +1 -1
@@ -11,7 +11,7 @@ import { envThemeOverride } from '../components/design-system/ThemeProvider.js';
11
11
  import { resolveBrand, setActiveBrand } from '../branding.js';
12
12
  import { hasPath } from '../dsh-adapter/settingsEditor.js';
13
13
  import { planReload } from '../reload.js';
14
- import { AlternateScreen, Box, Image, Text, InputCaret, useInput, ScrollBox, useTheme, useTerminalSize } from '../ui.js';
14
+ import { AlternateScreen, Box, Image, Text, InputCaret, useInput, useApp, useStdin, ScrollBox, useTheme, useTerminalSize } from '../ui.js';
15
15
  import { usePageInset } from '../components/PageMargin.js';
16
16
  import { POINTER } from '../terminal-utils/figures.js';
17
17
  import { previousCodePoint } from '../components/AgentMessageComposer.js';
@@ -20,8 +20,10 @@ import { actionMatches, effectiveComboDisplay, primaryComboString } from '../uti
20
20
  import { formatTokens } from '../terminal-utils/format.js';
21
21
  import { formatClock } from '../trajectory/format.js';
22
22
  import { homeDir } from '../utils/paths.js';
23
+ import { displayWorkingDirectory } from '../sessions/format.js';
24
+ import { sessionWorkingDirectory } from '../channel/working-directory.js';
23
25
  import { execFileNoThrow } from '../utils/execFileNoThrow.js';
24
- import { cleanBlockLines, cleanRenderText, cleanScalarText } from '../dsh-adapter/sanitize.js';
26
+ import { cleanBlockLines, cleanCommandReport, cleanRenderText, cleanScalarText } from '../dsh-adapter/sanitize.js';
25
27
  import { readModelRecents, recordModelUse } from '../modelRecents.js';
26
28
  import { WORKING_GATE_NOTICES } from '../commands.js';
27
29
  import { TuiDialogStore } from '../dsh-adapter/dialogs.js';
@@ -46,9 +48,12 @@ import { AskUserQuestionPanel } from '../components/questions/AskUserQuestionPan
46
48
  import { ApprovalPanel } from '../components/approvals/ApprovalPanel.js';
47
49
  import { ExtensionDialog } from '../components/ExtensionDialog.js';
48
50
  import { consumeBoundaryRecoveryRemount } from '../ink/update-overflow-guard.js';
51
+ import { InputEvent } from '../ink/events/input-event.js';
49
52
  import { useSearchHighlight } from '../ink/hooks/use-search-highlight.js';
50
- import { useTerminalTitle } from '../ink/hooks/use-terminal-title.js';
53
+ import { ChatTitle } from '../components/ChatTitle.js';
51
54
  import { useTerminalFocus } from '../ink/hooks/use-terminal-focus.js';
55
+ import { useProgramStatus } from '../ink/hooks/use-program-status.js';
56
+ import { supportsProgramStatus } from '../ink/termio/osc7501.js';
52
57
  import { useCopyOnSelect } from '../ink/hooks/use-copy-on-select.js';
53
58
  import { useSelection } from '../ink/hooks/use-selection.js';
54
59
  import { NoSelect } from '../ink/components/NoSelect.js';
@@ -65,6 +70,7 @@ import { PromptInput, composerImageRefsForText } from '../components/PromptInput
65
70
  import { turnUsageParts } from '../components/TurnUsageRow.js';
66
71
  import { AgentTranscriptScene } from './AgentTranscriptScene.js';
67
72
  import { agentViewStore } from '../components/sidePanel/agentViewStore.js';
73
+ import { subagentFailureRead, subagentFailureScope } from '../components/sidePanel/subagentFailureRead.js';
68
74
  import { agentComposeTargetOf } from '../components/messages/agentTeam.js';
69
75
  import { resolveBindingGeneration } from '../components/promptDraftCache.js';
70
76
  import { PromptEditorLayer, usePromptEditorOpen } from '../components/PromptEditor.js';
@@ -140,10 +146,10 @@ import { statSync } from 'node:fs';
140
146
  import { setClipboard } from '../ink/termio/osc.js';
141
147
  import { TerminalWriteContext } from '../ink/useTerminalNotification.js';
142
148
  import instances from '../ink/instances.js';
143
- import { useAnimationFrame } from '../ink/hooks/use-animation-frame.js';
144
149
  import { useExternalVersion } from '../hooks/useExternalVersion.js';
145
150
  import { TrajectoryScene } from './TrajectoryScene.js';
146
151
  import { markHomeSeen } from '../homePrefs.js';
152
+ import { clearOnboardingDraft } from '../onboardingDraft.js';
147
153
  import { markOnboardingDone } from '../onboardingPrefs.js';
148
154
  import { Launchpad, launchpadVisible } from './Launchpad.js';
149
155
  import { resolveLaunchpadActions } from '../components/launchpadActions.js';
@@ -184,6 +190,15 @@ const LOCAL_BLOCK_CELLS = 4000;
184
190
  * file, but a healthy import of thousands of conversations finishes well
185
191
  * inside this; without a cap a wedged child would hang the loop forever. */
186
192
  const MIGRATE_CHILD_TIMEOUT_MS = 30 * 60 * 1000;
193
+ /**
194
+ * How long an interrupt may stay unconverged before the TUI says so. A normal
195
+ * abort ends the turn in well under a second; a tool that ignores its
196
+ * `AbortSignal` keeps the agent loop waiting forever (dsh-agent-loop awaits
197
+ * every dispatched tool on abort), so `working`/`cancelPending` never clear.
198
+ * The notice names `/restart` as the recovery hatch; this only ends the silent
199
+ * dead end in which every key seemed to do nothing.
200
+ */
201
+ const INTERRUPT_STUCK_MS = 10_000;
187
202
  /**
188
203
  * 落地页参数行四段能点开的既有选择器(第五版):模型 → /model、思考深度 →
189
204
  * /effort、模式 → /plan、权限预设 → /permission。盖在落地页之上时键盘归
@@ -277,8 +292,6 @@ function contextOccupancyLine(channel) {
277
292
  window: formatTokens(occupancy.contextWindow),
278
293
  });
279
294
  }
280
- /** Terminal-title spinner frames. */
281
- const TITLE_SPINNER_FRAMES = ['⠂', '⠐'];
282
295
  /** Searchable transcript text for one row (`/` incsearch):
283
296
  * user text, assistant text, thinking, tool args/results, local output). */
284
297
  function searchableText(row) {
@@ -332,6 +345,7 @@ function peekKey(image, title) {
332
345
  return `${title ?? ''} ${image.id}`;
333
346
  }
334
347
  export function Chat({ channel, questionStore, approvalStore, extensionDialogs, bonusNotices, extensionStatus, activityStore, extensionShortcuts, themeHost, onExit, onUpdate, onRestart, onSwitchBackend, onRestartFreshSession, onProbeKernels, kernelEntries = EMPTY_KERNEL_ENTRIES, onResolveSdkInstall, onPluginInstall, onPluginManage, onTeamCommand, kernelPinned, fullscreen = false, trajectorySeen: trajectorySeenProp, injectControllerRef, promptControllerRef: promptControllerRefProp, renderScene, openHomeOnBoot, launchpadOnBoot, onboardingOnBoot, starPrompt, }) {
348
+ const { internal_eventEmitter: inputEmitter } = useStdin();
335
349
  const writeRaw = React.useContext(TerminalWriteContext);
336
350
  // Re-render whenever the channel mutates; rows/status are read fresh below.
337
351
  // DEFAULT lane on purpose (useExternalVersion): the channel version bumps
@@ -342,8 +356,10 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
342
356
  // the process (beta.3; the reveal-store half was PR #680, this is the
343
357
  // channel half — the surviving source on Windows timer granularity).
344
358
  useExternalVersion(channel.subscribe, () => channel.version);
345
- // Re-render on language switches so the whole UI hot-swaps its strings.
346
- React.useSyncExternalStore(subscribeLang, getLang);
359
+ const failureScope = subagentFailureScope(channel);
360
+ // Re-render on language switches so the whole UI hot-swaps its strings; the
361
+ // value itself is what memoized strings key their language dependency on.
362
+ const lang = React.useSyncExternalStore(subscribeLang, getLang);
347
363
  const promptEditorOpen = usePromptEditorOpen();
348
364
  // The pending ask-user-question (DSH user-interaction seam): the model's
349
365
  // `ask_user_question` tool parks here until the panel is answered.
@@ -373,6 +389,18 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
373
389
  const subscribeStatus = React.useCallback((listener) => statusContributions.subscribe(listener), [statusContributions]);
374
390
  const statusEntries = React.useSyncExternalStore(subscribeStatus, () => statusContributions.getSnapshot());
375
391
  const statusViews = React.useSyncExternalStore(subscribeStatus, () => statusContributions.getViewSnapshot());
392
+ // Plugin footer fields (tuiStatus.setField): same subscription/store as the
393
+ // text line, own snapshot — a mutation rebuilds only the affected list.
394
+ const statusFields = React.useSyncExternalStore(subscribeStatus, () => statusContributions.getFieldSnapshot());
395
+ // A plugin's footer-field click that threw is logged by the service; the
396
+ // user-facing signal is a toast naming the key (same shape as the shortcut
397
+ // handler above). The service never lets the throw reach the renderer.
398
+ React.useEffect(() => {
399
+ statusContributions.setFieldErrorHandler(key => {
400
+ channel.notify(t('ext-status-field-failed', { key }), { color: 'error', timeoutMs: 4000 });
401
+ });
402
+ return () => statusContributions.setFieldErrorHandler(undefined);
403
+ }, [statusContributions, channel]);
376
404
  // Shortcut handler failures surface as toasts (the registry also logs
377
405
  // them); the hook is re-pointed on every mount so a stale closure never
378
406
  // outlives its channel.
@@ -529,6 +557,77 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
529
557
  return ok;
530
558
  });
531
559
  };
560
+ /**
561
+ * The guide's access step needs two ACTIONS, and both of them already exist
562
+ * as flows Chat owns: the subscription sign-in (`runOAuthLogin` over the
563
+ * shared question panel — the same one `/login` uses on a backend session)
564
+ * and the `/provider` add flow. Chat hands them to the wizard as plain
565
+ * callbacks, so the screen keeps importing no adapter VALUES of its own and
566
+ * the question panel keeps exactly one owner.
567
+ *
568
+ * The catalog tail is the same consistency `/provider` performs: a sign-in
569
+ * flips a provider's credential-gated catalog from empty to full, so the
570
+ * model picker's cache, `models` and `providerInfos` must be re-read.
571
+ */
572
+ const refreshProviderCatalog = React.useCallback(() => {
573
+ channel.invalidateModelCompletion();
574
+ const generation = ++modelCatalogGeneration.current;
575
+ void channel.listModels().then((list) => {
576
+ if (generation === modelCatalogGeneration.current)
577
+ setModels(list);
578
+ }).catch(() => undefined);
579
+ void channel.listProviders().then((list) => {
580
+ if (generation === modelCatalogGeneration.current)
581
+ setProviderInfos(list);
582
+ }).catch(() => {
583
+ if (generation === modelCatalogGeneration.current)
584
+ setProviderInfos([]);
585
+ });
586
+ }, [channel]);
587
+ const onboardingSignIn = React.useCallback((provider) => {
588
+ const oauth = channel.providerSetup()?.oauth;
589
+ if (oauth === undefined) {
590
+ channel.notify(t('provider-oauth-unmounted', { provider }), { color: 'warning', timeoutMs: 8000 });
591
+ return Promise.resolve('failed');
592
+ }
593
+ return runOAuthLogin({
594
+ ask: (request, options) => questionStore.ask(request, options),
595
+ notify: (text, options) => channel.notify(text, options),
596
+ pushLocal: (title, lines) => channel.pushLocal(title, lines),
597
+ }, oauth, provider).then((outcome) => {
598
+ // A sign-out empties that provider's catalog just as a sign-in fills it.
599
+ if (outcome === 'added' || outcome === 'signed-out')
600
+ refreshProviderCatalog();
601
+ return outcome;
602
+ }).catch(() => 'failed');
603
+ }, [channel, questionStore, refreshProviderCatalog]);
604
+ /** `/provider` and the guide's add-provider action: one wizard wiring, one catalog tail. */
605
+ const runProviderSetup = React.useCallback(() => {
606
+ const host = channel.providerSetup();
607
+ if (host === undefined) {
608
+ channel.notify(t('provider-unavailable'), { color: 'warning', timeoutMs: 8000 });
609
+ return Promise.resolve('failed');
610
+ }
611
+ return runProviderWizard({
612
+ host,
613
+ ask: (request, options) => questionStore.ask(request, options),
614
+ notify: (text, options) => channel.notify(text, options),
615
+ pushLocal: (title, lines) => channel.pushLocal(title, lines),
616
+ working: () => channel.working,
617
+ switchModel: (provider, model) => switchModelRecorded(provider, model),
618
+ currentModel: () => channel.model,
619
+ }).then((outcome) => {
620
+ // A catalog-changing outcome invalidates every cached model surface so
621
+ // `/model` (picker + completion) reflects it immediately; the wizard's
622
+ // live-switch branch already dropped the completion cache via
623
+ // switchModelRecorded — this covers keep-current, add, edit, delete and
624
+ // OAuth login/logout.
625
+ if (outcome === 'added' || outcome === 'updated' || outcome === 'deleted' || outcome === 'signed-out') {
626
+ refreshProviderCatalog();
627
+ }
628
+ return outcome;
629
+ }).catch(() => 'failed');
630
+ }, [channel, questionStore, refreshProviderCatalog, switchModelRecorded]);
532
631
  const modelPicker = useModelPicker({
533
632
  channel, models, providers: providerInfos, recents: modelProviderTabs ? modelRecents : undefined, open: overlay.kind === 'model',
534
633
  onCancel: () => dispatchOverlay({ type: 'close-if', kind: 'model' }),
@@ -674,9 +773,8 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
674
773
  /**
675
774
  * 打开**整屏界面**的命令(第七版):从落地页触发这些命令时**不收掉落地页**
676
775
  * ——整屏盖在落地页之上渲染(它们的 early-return 排在落地页分支之前),
677
- * Esc 退出整屏回到落地页(草稿/参数/焦点原样保留)。这是「从启动页进入
678
- * 对话页的唯一路径 = Enter 提交一条非命令消息」的落地:任何返回键都不再
679
- * 把人甩到对话页。其余命令(star / update / help / 转录输出类)的反馈在
776
+ * Esc 退出整屏回到落地页(草稿/参数/焦点原样保留),返回键不会切到对话页。
777
+ * 其余命令(star / update / help / 转录输出类)的反馈在
680
778
  * 对话页,仍按旧约收掉落地页再执行。
681
779
  */
682
780
  const launchpadScreenCommands = React.useMemo(() => new Set(['home', 'resume', 'agentview', 'settings', 'jobs', 'tree', 'agents', 'setup', 'bg', 'background']), []);
@@ -791,6 +889,10 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
791
889
  runSdkInstall(dir);
792
890
  });
793
891
  };
892
+ /** `/plugin` reports keep section indentation and blank rows. */
893
+ const pushPluginLocal = (lines) => {
894
+ channel.pushLocal('/plugin', lines, { preserveWhitespace: true });
895
+ };
794
896
  /**
795
897
  * `/plugin install <spec>` 的步骤态(C-4)。六件套(ref / state / 收尾 / 结算 /
796
898
  * 栅栏 / 起步)与 manage 侧共用 `usePluginWriteFlow`,两处的差异只有「关浮层
@@ -800,7 +902,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
800
902
  overlayKind: 'plugin-install',
801
903
  overlay,
802
904
  dispatchOverlay,
803
- pushLocal: lines => channel.pushLocal('/plugin', lines),
905
+ pushLocal: pushPluginLocal,
804
906
  initialStep: { kind: 'done' },
805
907
  // 装了半截就关浮层会把 profile 留在半装状态:取消由服务自己结算(回滚)。
806
908
  cancelOnClose: flow => flow.cancel(),
@@ -812,7 +914,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
812
914
  binding: () => channel.agentBindingGeneration,
813
915
  // 回合运行中改 profile 会触发应用/HMR:门禁在流程里(inspect 之前与写入之前各查一次)。
814
916
  busy: () => channel.working,
815
- onLines: lines => channel.pushLocal('/plugin', lines),
917
+ onLines: pushPluginLocal,
816
918
  });
817
919
  if (flow === undefined)
818
920
  return false;
@@ -840,7 +942,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
840
942
  overlayKind: 'plugin-manage',
841
943
  overlay,
842
944
  dispatchOverlay,
843
- pushLocal: lines => channel.pushLocal('/plugin', lines),
945
+ pushLocal: pushPluginLocal,
844
946
  initialStep: { kind: 'done' },
845
947
  failureLine: error => t('plugins-manage-failed', { reason: cleanScalarText(error, COMMAND_RESULT_CELLS) }),
846
948
  });
@@ -855,7 +957,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
855
957
  binding: () => channel.agentBindingGeneration,
856
958
  // 回合运行中改 profile 会触发应用/HMR:门禁在流程里(解析之前与写入之前各查一次)。
857
959
  busy: () => channel.working,
858
- onLines: lines => channel.pushLocal('/plugin', lines),
960
+ onLines: pushPluginLocal,
859
961
  teamActiveMembers: teamMembers,
860
962
  });
861
963
  if (flow === undefined)
@@ -1168,6 +1270,32 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
1168
1270
  const questionMinimized = questionSnapshot !== null && minimizedQuestionKey === questionSnapshot.key;
1169
1271
  /** Fold state for the GoalTodoPanel todo section (ctrl/cmd+q or click). */
1170
1272
  const [todoCollapsed, setTodoCollapsed] = React.useState(false);
1273
+ // Dismiss only this idle projection; new goal/todo data or a session switch
1274
+ // reveals the footer again without changing the backend's canonical state.
1275
+ const [todoFooterOverride, setTodoFooterOverride] = React.useState(undefined);
1276
+ const todoFooterOverrideMatches = !channel.working && todoFooterOverride !== undefined
1277
+ && todoFooterOverride.agentId === channel.agentId
1278
+ && todoFooterOverride.goal === channel.goal
1279
+ && todoFooterOverride.todos === channel.todos;
1280
+ const completedTodoSnapshot = React.useRef(undefined);
1281
+ if (channel.goal?.phase !== 'complete')
1282
+ completedTodoSnapshot.current = undefined;
1283
+ else if (channel.working || completedTodoSnapshot.current?.goal !== channel.goal
1284
+ || completedTodoSnapshot.current?.agentId !== channel.agentId) {
1285
+ completedTodoSnapshot.current = { agentId: channel.agentId, goal: channel.goal, todos: channel.todos };
1286
+ }
1287
+ const completedTodoFooter = channel.goal?.phase === 'complete' && !channel.working
1288
+ && completedTodoSnapshot.current?.todos === channel.todos;
1289
+ const todoFooterHidden = todoFooterOverrideMatches ? todoFooterOverride.hidden : completedTodoFooter;
1290
+ const toggleTodoFooter = () => {
1291
+ if (channel.working)
1292
+ setTodoCollapsed(previous => !previous);
1293
+ else
1294
+ setTodoFooterOverride({
1295
+ hidden: !todoFooterHidden,
1296
+ agentId: channel.agentId, goal: channel.goal, todos: channel.todos,
1297
+ });
1298
+ };
1171
1299
  const [thinkingVisible, setThinkingVisible] = React.useState(true);
1172
1300
  /** ctrl+r history-search entries (loaded on open, persists). */
1173
1301
  const [historyEntries, setHistoryEntries] = React.useState([]);
@@ -1177,10 +1305,11 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
1177
1305
  * a row they are no longer looking at). */
1178
1306
  const rewindRequestRef = React.useRef(0);
1179
1307
  /** /btw side-question thread: pure UI state in btwThreads — the answers
1180
- * never enter the transcript or the session log. The floating overlay is
1181
- * only the FALLBACK surface (btw panel not enabled); with the panel
1182
- * enabled the same thread routes to the sidebar instead — one answer,
1183
- * exactly one surface. */
1308
+ * never enter the transcript or the session log. Two surfaces, one owner:
1309
+ * the sidebar panel when the split can render AND is showing the btw
1310
+ * panel, otherwise the floating overlay in the conversation. This flag
1311
+ * records that the fallback is wanted; `btwOverlayVisible` decides whether
1312
+ * it actually owns the screen. */
1184
1313
  const [btwOverlayOpen, setBtwOverlayOpen] = React.useState(false);
1185
1314
  /** ⤢ fullscreen thread scene (openPanelFullscreen 'btw' route). */
1186
1315
  const [btwSceneOpen, setBtwSceneOpen] = React.useState(false);
@@ -1564,6 +1693,9 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
1564
1693
  */
1565
1694
  const closeOnboarding = React.useCallback((outcome) => {
1566
1695
  setOnboardingOpen(false);
1696
+ // The guide's in-process progress (step, diff baseline, in-flight action)
1697
+ // is only meaningful while it is on screen; a later `/setup` starts fresh.
1698
+ clearOnboardingDraft();
1567
1699
  if (outcome === 'done') {
1568
1700
  const written = markOnboardingDone();
1569
1701
  setOnboardingPending(false);
@@ -1600,14 +1732,16 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
1600
1732
  * in the effect below) resolves every clickable target the transcript
1601
1733
  * renders — http(s) links open the browser, `dsh-file:`/`file://` paths
1602
1734
  * open the file-action menu. `dsh-file:` payloads are RAW display paths
1603
- * (possibly relative), so they resolve against the CURRENT channel cwd
1604
- * at click time (read through a ref so this callback keeps a stable
1605
- * identity — it is threaded into memoized row components).
1735
+ * (possibly relative), so they resolve against the session's CURRENT
1736
+ * directory at click time — where it moved after opening, else its cwd
1737
+ * (read through a ref so this callback keeps a stable identity — it is
1738
+ * threaded into memoized row components).
1606
1739
  */
1607
- const cwdRef = React.useRef(channel.cwd);
1740
+ const currentCwd = sessionWorkingDirectory(channel);
1741
+ const cwdRef = React.useRef(currentCwd);
1608
1742
  React.useEffect(() => {
1609
- cwdRef.current = channel.cwd;
1610
- }, [channel.cwd]);
1743
+ cwdRef.current = currentCwd;
1744
+ }, [currentCwd]);
1611
1745
  const openFileActions = React.useCallback((rawPath) => {
1612
1746
  const resolved = resolveTargetPath(rawPath, cwdRef.current);
1613
1747
  // Whether the target is a directory decides the first menu row's label
@@ -1857,6 +1991,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
1857
1991
  * the user into a different conversation.
1858
1992
  */
1859
1993
  const promptDraftRef = React.useRef({ current: null });
1994
+ const launchpadPendingInputRef = React.useRef([]);
1860
1995
  /**
1861
1996
  * Latest channel for the unmount release below: that effect must not re-run
1862
1997
  * on a channel identity change, yet its cleanup must release against the
@@ -1962,6 +2097,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
1962
2097
  // A stored draft can only belong to the conversation being replaced: the
1963
2098
  // composer is the one that writes it, and it writes it on the way out.
1964
2099
  promptDraftRef.current.current = null;
2100
+ launchpadPendingInputRef.current = [];
1965
2101
  if (pendingFillRef.current === draftSessionId) {
1966
2102
  pendingFillRef.current = null;
1967
2103
  return;
@@ -2051,12 +2187,10 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
2051
2187
  uploadTokensRef.current = lastUploadTokens;
2052
2188
  loadingStartTimeRef.current = channel.turnStart;
2053
2189
  const thinkingStatus = useThinkingStatus(channel.spinnerMode === 'thinking');
2054
- // Terminal tab title: the session
2055
- // title when set, else "dsh-TUI"; a `⠂/⠐` spinner prefix while a turn is
2056
- // working (960ms cadence, only while the terminal is focused), a static
2057
- // `✦` otherwise. dsh-TUI brands the idle prefix with the DeepSeek whale.
2058
- const [titleFrame, setTitleFrame] = React.useState(0);
2059
2190
  const terminalFocused = useTerminalFocus();
2191
+ // Gate the stream this app renders to; embedders may replace process.stdout.
2192
+ const { stdout: appStdout } = useApp();
2193
+ const programStatusEnabled = React.useMemo(() => supportsProgramStatus(appStdout.isTTY === true), [appStdout]);
2060
2194
  // Mouse text selection auto-copy: active only in
2061
2195
  // fullscreen (<AlternateScreen> supplies mouse tracking); a no-op
2062
2196
  // subscription in inline mode, where selection belongs to the terminal.
@@ -2106,18 +2240,39 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
2106
2240
  // letting the highlight vanish silently.
2107
2241
  () => channel.notify(t('copy-refused-stale'), { timeoutMs: 2500 }));
2108
2242
  const { clearSelection: clearMouseSelection, hasSelection: hasMouseSelection, getState: getMouseSelectionState, } = useSelection();
2109
- React.useEffect(() => {
2110
- if (!channel.working || !terminalFocused)
2111
- return;
2112
- const interval = setInterval(() => {
2113
- setTitleFrame(f => (f + 1) % TITLE_SPINNER_FRAMES.length);
2114
- }, 960);
2115
- return () => { clearInterval(interval); };
2116
- }, [channel.working, terminalFocused]);
2117
- const titlePrefix = channel.working
2118
- ? (TITLE_SPINNER_FRAMES[titleFrame] ?? '✦')
2119
- : '✦';
2120
- useTerminalTitle(`${titlePrefix} 🐋 ${channel.sessionTitle}`);
2243
+ // OSC 7501 program status: tell the terminal (and any agentic inbox) whether
2244
+ // this session is working, parked on the user, or finished. Precedence
2245
+ // matches the UI's own: a parked ask outranks a running turn. The pending
2246
+ // prompt is reduced to the one-line message the protocol carries.
2247
+ const programStatusBlocked = React.useMemo(() => {
2248
+ if (approvalSnapshot !== null) {
2249
+ const detail = approvalSnapshot.command ?? approvalSnapshot.reason ?? approvalSnapshot.title;
2250
+ return {
2251
+ kind: 'permission',
2252
+ message: t('program-status-approval', {
2253
+ tool: detail === undefined
2254
+ ? approvalSnapshot.toolName
2255
+ : `${approvalSnapshot.toolName} · ${detail}`,
2256
+ }),
2257
+ };
2258
+ }
2259
+ if (dialogSnapshot !== null) {
2260
+ return { kind: 'question', message: t('program-status-dialog', { title: dialogSnapshot.title }) };
2261
+ }
2262
+ if (questionSnapshot !== null) {
2263
+ const { header, question, purpose } = questionSnapshot.question;
2264
+ return { kind: purpose === 'auth' ? 'auth' : 'question', message: t('program-status-question', { question: header ?? question }) };
2265
+ }
2266
+ return null;
2267
+ }, [approvalSnapshot, dialogSnapshot, questionSnapshot, lang]);
2268
+ // The hook reads the channel's own projected fields (`working`,
2269
+ // `turnOutcome` from `turn.end.reason`, the title and the session id), so
2270
+ // the usage ledger's stale outcome can never stand in for the turn's close.
2271
+ useProgramStatus({
2272
+ channel,
2273
+ blocked: programStatusBlocked,
2274
+ enabled: programStatusEnabled,
2275
+ });
2121
2276
  const handleWorkspaceResult = (result) => {
2122
2277
  workspaceFlowAbortRef.current = null;
2123
2278
  if (result.kind === 'target') {
@@ -2234,7 +2389,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
2234
2389
  * Dispatch a slash command; false lets the input flow to the model.
2235
2390
  * Built-in names run the local switch; anything registered by a DSH
2236
2391
  * plugin (plan/goal/…) dispatches through the command registry, whose
2237
- * result text lands as a notification. `rawInput` carries the text after
2392
+ * result text lands as a local report for generic plugin commands. `rawInput` carries the text after
2238
2393
  * the command name (`/plan off` → ` off`).
2239
2394
  *
2240
2395
  * `render.block` prints a multi-line report the way `/plugins` prints one:
@@ -2253,7 +2408,21 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
2253
2408
  channel.notify(t('command-not-found', { name }), { color: 'error' });
2254
2409
  return false;
2255
2410
  }
2256
- if (render?.block === true && outcome.kind !== 'error') {
2411
+ if (render?.report === true) {
2412
+ const { lines, truncated } = cleanCommandReport(outcome.text);
2413
+ if (truncated)
2414
+ lines.push(t('command-output-truncated'));
2415
+ // The report already has a cell cap. Avoid a second UTF-16 preview cut
2416
+ // splitting an emoji or a combining sequence in the local row sink.
2417
+ if (lines.length > 0)
2418
+ channel.pushLocal(`/${name}`, lines, { lineLimit: 65_536, preserveWhitespace: true });
2419
+ if (outcome.kind === 'error') {
2420
+ const cleaned = cleanRenderText(outcome.text, COMMAND_RESULT_CELLS);
2421
+ if (cleaned !== '')
2422
+ channel.notify(cleaned, { color: 'error' });
2423
+ }
2424
+ }
2425
+ else if (render?.block === true && outcome.kind !== 'error') {
2257
2426
  // Per-line sanitize: the newlines here are the report's structure.
2258
2427
  const lines = cleanBlockLines(outcome.text, LOCAL_BLOCK_CELLS);
2259
2428
  if (lines.length > 0)
@@ -2419,6 +2588,27 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
2419
2588
  channel.notify(t('startup-not-ready', { backend: kernelCurrentOption?.shortLabel ?? channel.backendCapabilities.backendId }), { color: 'warning', timeoutMs: 2500 });
2420
2589
  return true;
2421
2590
  };
2591
+ /** Move the unsent draft to chat, inserting a newline at the launchpad caret. */
2592
+ const newlineLaunchpad = (text, cursor) => {
2593
+ promptDraftRef.current.current = {
2594
+ ownerAgentId: String(channel.agentId),
2595
+ bindingGeneration: resolveBindingGeneration(channel),
2596
+ value: text.slice(0, cursor) + '\n' + text.slice(cursor),
2597
+ cursor: cursor + 1,
2598
+ foldBlock: null,
2599
+ expanded: false,
2600
+ vimEnabled: false,
2601
+ vimInsert: true,
2602
+ images: [...launchpadImagesRef.current],
2603
+ };
2604
+ // The composer snapshot now owns the capabilities behind the image chips.
2605
+ launchpadImagesRef.current.clear();
2606
+ setSupervisorOpen(false);
2607
+ setLaunchpadOpen(false);
2608
+ setLaunchpadFocus(-1);
2609
+ setLaunchpadDraft('');
2610
+ setLaunchpadCaret(0);
2611
+ };
2422
2612
  /**
2423
2613
  * Submit launchpad input or a selected command through the chat routes.
2424
2614
  *
@@ -2960,36 +3150,10 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
2960
3150
  // Interactive add-provider wizard (/provider): drives the shared
2961
3151
  // question panel, persists profile + key via the channel's settings/
2962
3152
  // credentials seams. No picker state — AskUserQuestionPanel renders it.
3153
+ // The wizard notifies on every handled failure, and the runner never
3154
+ // rejects.
2963
3155
  setHelpOpen(false);
2964
- const host = channel.providerSetup();
2965
- if (!host) {
2966
- channel.notify(t('provider-unavailable'), { color: 'warning', timeoutMs: 8000 });
2967
- return true;
2968
- }
2969
- void runProviderWizard({
2970
- host,
2971
- ask: (request, options) => questionStore.ask(request, options),
2972
- notify: (text, options) => channel.notify(text, options),
2973
- pushLocal: (title, lines) => channel.pushLocal(title, lines),
2974
- working: () => channel.working,
2975
- switchModel: (provider, model) => switchModelRecorded(provider, model),
2976
- }).then((outcome) => {
2977
- // A catalog-changing outcome invalidates every cached model surface
2978
- // so `/model` (picker + completion) reflects it immediately — the
2979
- // same consistency the picker's per-open refetch provides, minus
2980
- // the stale flash on the next open. The wizard's live-switch branch
2981
- // already dropped the completion cache via switchModelRecorded;
2982
- // this covers keep-current, add, edit, delete and OAuth login/logout.
2983
- if (outcome === 'added' || outcome === 'updated'
2984
- || outcome === 'deleted' || outcome === 'signed-out') {
2985
- channel.invalidateModelCompletion();
2986
- void channel.listModels().then(setModels);
2987
- void channel.listProviders().then(setProviderInfos).catch(() => setProviderInfos([]));
2988
- }
2989
- }).catch(() => {
2990
- // The wizard notifies on every handled failure; this only swallows
2991
- // an unexpected reject so it never surfaces as an unhandled promise.
2992
- });
3156
+ void runProviderSetup();
2993
3157
  return true;
2994
3158
  }
2995
3159
  case 'thinking':
@@ -3168,7 +3332,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
3168
3332
  `${t('status-model', { model: channel.model })}${channel.reasoningEffort ? ` · ${capitalize(channel.reasoningEffort)} effort` : ''}`,
3169
3333
  `${t('status-state', { state: channel.working ? t('status-working') : t('status-idle') })}`,
3170
3334
  `${t('status-session', { id: channel.agentId })}`,
3171
- `${t('status-dir', { cwd: channel.displayCwd })}${channel.gitBranch ? ` · ${channel.gitBranch}` : ''}`,
3335
+ `${t('status-dir', { cwd: displayWorkingDirectory(channel) })}${channel.gitBranch ? ` · ${channel.gitBranch}` : ''}`,
3172
3336
  t('tokens-session-total', {
3173
3337
  input: formatTokens(channel.tokens.input),
3174
3338
  output: formatTokens(channel.tokens.output),
@@ -3410,30 +3574,20 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
3410
3574
  void channel.pluginsInfo(rawInput).then((lines) => {
3411
3575
  if (channel.agentBindingGeneration !== originAgentBinding)
3412
3576
  return;
3413
- channel.pushLocal('/plugin', lines);
3577
+ pushPluginLocal(lines);
3414
3578
  });
3415
3579
  return true;
3416
3580
  }
3417
3581
  case 'team': {
3418
- // `/team` 是团队 bundle 的启停(team-mode.ts):on/off 走与 /plugin 同一个
3419
- // 生命周期流程与确认浮层,status 是一段报告;都按发起时的绑定落行。
3582
+ // `/team` 只报告团队状态(team-mode.ts);开关是 /plugin enable|disable。
3583
+ // 服务未挂载时这一行不在命令表里,但手敲仍会走到这里,拿回开启提示。
3420
3584
  setHelpOpen(false);
3421
3585
  if (onTeamCommand === undefined) {
3422
3586
  channel.pushLocal('/team', [t('team-cmd-unavailable')]);
3423
3587
  return true;
3424
3588
  }
3425
3589
  const originAgentBinding = channel.agentBindingGeneration;
3426
- const outcome = onTeamCommand(rawInput, {
3427
- binding: () => channel.agentBindingGeneration,
3428
- busy: () => channel.working,
3429
- onLines: lines => channel.pushLocal('/team', lines),
3430
- members: teamMembers,
3431
- });
3432
- if (outcome.kind === 'flow') {
3433
- pluginManage.start(outcome.flow, outcome.flow.begin());
3434
- return true;
3435
- }
3436
- void outcome.lines.then((lines) => {
3590
+ void onTeamCommand(rawInput, { members: teamMembers }).then((lines) => {
3437
3591
  if (channel.agentBindingGeneration !== originAgentBinding)
3438
3592
  return;
3439
3593
  channel.pushLocal('/team', [...lines]);
@@ -3883,15 +4037,19 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
3883
4037
  // (cordis.yml root config, frozen fullscreen layout, newly built
3884
4038
  // code), so /restart respawns the process with the original argv and
3885
4039
  // resumes this session — the /update handoff minus the pnpm step.
4040
+ // Allowed mid-turn on purpose: a turn whose abort never converges
4041
+ // (a tool ignoring its AbortSignal) can leave `working` true forever,
4042
+ // and refusing the one command that can rebuild the process would
4043
+ // leave the user with no way out. The handoff notice written by the
4044
+ // exit funnel owns the visible copy (and says what the restart
4045
+ // interrupts); this toast only covers embedders whose onRestart does
4046
+ // not tear the screen down.
3886
4047
  setHelpOpen(false);
3887
4048
  if (onRestart === undefined) {
3888
4049
  channel.notify(t('restart-unavailable'), { color: 'warning' });
3889
4050
  }
3890
- else if (channel.working) {
3891
- channel.notify(t(WORKING_GATE_NOTICES.restart), { color: 'warning' });
3892
- }
3893
4051
  else {
3894
- channel.notify(t('restart-starting'));
4052
+ channel.notify(t(channel.working ? 'restart-during-turn' : 'restart-starting'), channel.working ? { color: 'warning', timeoutMs: 6_000 } : undefined);
3895
4053
  onRestart();
3896
4054
  }
3897
4055
  return true;
@@ -3944,9 +4102,12 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
3944
4102
  }
3945
4103
  case 'btw': {
3946
4104
  // `/btw`:单轮无工具侧问,线程只在内存里(btwThreads,按会话
3947
- // 隔离),不打断主回合、不写会话历史。空参数只提示用法。启用了
3948
- // btw 面板就进面板线程(有模态界面时不抢开,只标未读);没启用
3949
- // 就用浮层。同一个问答只出现在一处。
4105
+ // 隔离),不打断主回合、不写会话历史。空参数只提示用法。分栏
4106
+ // 渲染得出来才进面板线程;否则退浮层——面板「已启用」只是配置,
4107
+ // 不代表分栏真的上屏(窄屏 / inline / 编辑器展开 /
4108
+ // splitEnabled=false 都会把它掩掉,issue #1631)。屏被别的浮层或
4109
+ // 整屏界面占着时两个表面都不抢开,只发通知。同一个问答只出现在
4110
+ // 一处。
3950
4111
  setHelpOpen(false);
3951
4112
  const question = rawInput.trim();
3952
4113
  if (!question) {
@@ -3958,12 +4119,18 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
3958
4119
  channel.notify(t('btw-thread-busy'), { color: 'warning', timeoutMs: 3000 });
3959
4120
  return true;
3960
4121
  }
3961
- if (sidePanel.enabledPanelIds.includes('btw')) {
3962
- if (btwSurfaceFree())
4122
+ const btwPanelEnabled = sidePanel.enabledPanelIds.includes('btw');
4123
+ if (btwSurfaceFree()) {
4124
+ if (btwPanelEnabled && sidePanel.splitAvailable)
3963
4125
  sidePanel.openPanel('btw');
4126
+ else
4127
+ setBtwOverlayOpen(true);
3964
4128
  }
3965
4129
  else {
3966
- setBtwOverlayOpen(true);
4130
+ // 屏被别的浮层/整屏界面占着:侧问照常发出,但只在通知通道里说一
4131
+ // 句——既不把答案静默塞进看不见的地方,也不挂一个既看不见、又
4132
+ // 会先吃掉按键的浮层。
4133
+ channel.notify(t('btw-surface-busy'), { color: 'warning', timeoutMs: 4000 });
3967
4134
  }
3968
4135
  return true;
3969
4136
  }
@@ -3996,7 +4163,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
3996
4163
  const external = channel.commandList.find(command => command.external && command.name === name);
3997
4164
  if (external) {
3998
4165
  setHelpOpen(false);
3999
- return runExternalCommand(name, rawInput, images);
4166
+ return runExternalCommand(name, rawInput, images, { report: true });
4000
4167
  }
4001
4168
  return false;
4002
4169
  }
@@ -4113,6 +4280,24 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
4113
4280
  fullscreen: fullscreen && !launchpadShown,
4114
4281
  editorOpen: promptEditorOpen,
4115
4282
  });
4283
+ /**
4284
+ * 「面板上屏」不等于「分栏在渲染」:分栏画出的是 activePanelId 那一块,
4285
+ * 而活动面板默认是启用列表第一项。浮层只在侧栏真的显示 btw 线程时让位;
4286
+ * 侧栏停在别的面板上时把浮层卸掉,等于让用户什么都看不到(issue #1631
4287
+ * 的同一条静默路径)。
4288
+ */
4289
+ const btwPanelOnScreen = sidePanel.enabledPanelIds.includes('btw') && sidePanel.split && sidePanel.activePanelId === 'btw';
4290
+ /**
4291
+ * 浮层是否真的占着屏幕(因而可以接管输入)。渲染门与所有「让位 / 暂停
4292
+ * 输入」的判定都读这一个值:`btwOverlayOpen` 只是「想要浮层」,分栏重新
4293
+ * 出现后它可能为真却什么都不画——那时不能再让 PromptInput 与 Chat 的按键
4294
+ * 处理器让位(否则 composer 消失、Esc/Ctrl+C 都失效)。
4295
+ */
4296
+ // 编辑器展开会收起分栏;此时不能复活浮层并暂停 PromptInput,否则编辑器
4297
+ // 发布/撤下与分栏恢复会循环触发。主任务问卷也先接管显示和键盘,结束后
4298
+ // 再恢复浮层请求,保留在途侧问。
4299
+ const btwOverlayVisible = btwOverlayOpen && !btwPanelOnScreen
4300
+ && !promptEditorOpen && questionSnapshot === null;
4116
4301
  /**
4117
4302
  * 「全屏」出口(PanelBar 的 ⤢):把侧栏里那个面板的内容切到它原本的整屏
4118
4303
  * 形态。只映射**真的有整屏对应物**的面板 id(能力位 capabilities.fullscreen
@@ -4176,7 +4361,6 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
4176
4361
  // length is the honest dependency; its identity never changes.
4177
4362
  // oxlint-disable-next-line react-hooks/exhaustive-deps
4178
4363
  [trajectory.nodes, trajectory.counts.rows, wakeWidth]);
4179
- const [wakeTickRef, wakeTime] = useAnimationFrame(channel.working ? 120 : null);
4180
4364
  /**
4181
4365
  * The key hint beside the strip retires itself once the trajectory has been
4182
4366
  * opened — teaching belongs in the first minute, not on every frame forever.
@@ -4328,7 +4512,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
4328
4512
  const lastModalEnterAtRef = React.useRef(0);
4329
4513
  const couponVisible = coupon !== null && starModal === null
4330
4514
  && approvalSnapshot === null && dialogSnapshot === null && questionSnapshot === null
4331
- && overlay.kind === 'none' && !btwOverlayOpen && recap === null
4515
+ && overlay.kind === 'none' && !btwOverlayVisible && recap === null
4332
4516
  && !supervisorOpen && !treeOpen && !settingsOpen && !jobsPanelOpen
4333
4517
  && !sceneOpen && !subagentDashboardOpen && subagentDetailId === null
4334
4518
  && !btwSceneOpen;
@@ -4339,6 +4523,41 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
4339
4523
  if (coupon !== null)
4340
4524
  bonusNotices?.dismiss(coupon.orderId);
4341
4525
  }, [bonusNotices, coupon]);
4526
+ /**
4527
+ * Escalation surface for a wedged abort. `cancelPending` means a turn was
4528
+ * asked to stop and has not produced its terminal event yet; a tool that
4529
+ * never settles can hold that state forever. The channel-side `cancel()`
4530
+ * ignores repeats while the abort converges, so a repeated Esc used to be a
4531
+ * silent no-op — the user's "I pressed Esc and nothing happened". The
4532
+ * watchdog raises the warning once per interrupt episode and Esc answers
4533
+ * every press; `/restart` (no longer gated on `working`) is the way out.
4534
+ */
4535
+ const interruptWatchdogRef = React.useRef(null);
4536
+ const interruptWarnedRef = React.useRef(false);
4537
+ const clearInterruptWatchdog = React.useCallback(() => {
4538
+ if (interruptWatchdogRef.current !== null)
4539
+ clearTimeout(interruptWatchdogRef.current);
4540
+ interruptWatchdogRef.current = null;
4541
+ }, []);
4542
+ React.useEffect(() => {
4543
+ if (!channel.working || !channel.cancelPending) {
4544
+ // The turn settled (or the session was replaced): the next interrupt
4545
+ // episode starts with a fresh warning.
4546
+ clearInterruptWatchdog();
4547
+ interruptWarnedRef.current = false;
4548
+ return;
4549
+ }
4550
+ if (interruptWatchdogRef.current !== null)
4551
+ return;
4552
+ interruptWatchdogRef.current = setTimeout(() => {
4553
+ interruptWatchdogRef.current = null;
4554
+ if (!channel.working || !channel.cancelPending || interruptWarnedRef.current)
4555
+ return;
4556
+ interruptWarnedRef.current = true;
4557
+ channel.notify(t('interrupt-stuck'), { color: 'warning', timeoutMs: 10_000 });
4558
+ }, INTERRUPT_STUCK_MS);
4559
+ }, [channel.working, channel.cancelPending]);
4560
+ React.useEffect(() => () => clearInterruptWatchdog(), [clearInterruptWatchdog]);
4342
4561
  useInput((input, key, event) => {
4343
4562
  // 开屏"求 star"弹窗开着时键盘全归它(↑/↓/Enter/Esc 由它自己的
4344
4563
  // useInput 处理),滚轮也不许滚动它身后的转录——和下面的整屏界面
@@ -4350,7 +4569,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
4350
4569
  // still lets the panel receive them. PromptInput now stays mounted but
4351
4570
  // suspended to preserve async command drafts, making this guard also
4352
4571
  // essential for Ctrl+C: it must never clear the hidden composer.
4353
- if (btwOverlayOpen
4572
+ if (btwOverlayVisible
4354
4573
  || overlay.kind === 'tips'
4355
4574
  || (recap !== null && (!recap.auto || recap.expanded)))
4356
4575
  return;
@@ -5063,6 +5282,17 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5063
5282
  event.stopImmediatePropagation();
5064
5283
  }
5065
5284
  }
5285
+ else if (view.step.kind === 'grant') {
5286
+ // registry 装后补授:Enter 写入清单,Esc 跳过(安装保留,浮层收起)。
5287
+ if (plainReturn) {
5288
+ pluginInstall.run(view.flow.grant());
5289
+ event.stopImmediatePropagation();
5290
+ }
5291
+ else if (key.escape) {
5292
+ pluginInstall.close();
5293
+ event.stopImmediatePropagation();
5294
+ }
5295
+ }
5066
5296
  else if (view.step.kind === 'build-blocked') {
5067
5297
  if (plainReturn) {
5068
5298
  pluginInstall.run(view.flow.approve(view.step.builds));
@@ -5384,8 +5614,9 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5384
5614
  }
5385
5615
  }
5386
5616
  else if (key.escape && promptControllerRef.current?.consumeEscape()) {
5387
- // Selection/editor Esc stays with the composer even though Chat's
5388
- // global listener runs first. Consume it before interrupting the turn.
5617
+ // Local menu/preview/selection/editor Esc stays with the composer even
5618
+ // though Chat's global listener runs first. Only an unconsumed Esc
5619
+ // reaches the working-turn interrupt below.
5389
5620
  event.stopImmediatePropagation();
5390
5621
  }
5391
5622
  else if (key.escape && channel.working && !helpOpen && !promptControllerRef.current?.vimActive()) {
@@ -5399,10 +5630,23 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5399
5630
  // vim mode (either submode) yields: there Esc is a MODE key (INSERT→
5400
5631
  // NORMAL, NORMAL = no-op/cancel pending d) and the prompt owns it;
5401
5632
  // interrupting still works via Ctrl+C / Ctrl+Enter.
5402
- if (channel.pending.length > 0) {
5403
- if (channel.interruptAndDock() === 0)
5633
+ const undocked = channel.pending.some(item => item.docked !== true);
5634
+ if (undocked) {
5635
+ // Docking is Esc's documented meaning for queued rows, and it starts
5636
+ // its own interrupt; keep it even while a plain abort is in flight.
5637
+ if (channel.interruptAndDock() === 0 && !channel.cancelPending)
5404
5638
  channel.cancel();
5405
5639
  }
5640
+ else if (channel.cancelPending) {
5641
+ // The abort is already in flight: `cancel()`/`interruptAndDock()`
5642
+ // ignore repeats by contract, so answer the press instead of
5643
+ // swallowing it. Past the watchdog window the turn is wedged, and
5644
+ // the warning names `/restart` (allowed mid-turn) as the way out.
5645
+ channel.notify(t(interruptWarnedRef.current ? 'interrupt-stuck' : 'interrupt-pending'), {
5646
+ color: 'warning',
5647
+ timeoutMs: interruptWarnedRef.current ? 10_000 : 4_000,
5648
+ });
5649
+ }
5406
5650
  else {
5407
5651
  channel.cancel();
5408
5652
  }
@@ -5517,10 +5761,8 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5517
5761
  event.stopImmediatePropagation();
5518
5762
  }
5519
5763
  else if (actionMatches('todoFold', input, key)) {
5520
- // Fold/unfold the GoalTodoPanel todo section (default Ctrl+Q) — works
5521
- // mid-turn too: the collapsed line keeps the done/total count and the
5522
- // live task preview, so long todo lists stop crowding the prompt.
5523
- setTodoCollapsed(previous => !previous);
5764
+ // Fold running work; hide/restore the idle footer without mutating todos.
5765
+ toggleTodoFooter();
5524
5766
  // Consume: same readline-shadowing rule as dashboard/showAll above.
5525
5767
  event.stopImmediatePropagation();
5526
5768
  }
@@ -5802,13 +6044,15 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5802
6044
  dispatchOverlay({ type: 'close' });
5803
6045
  runFileAction(index, path);
5804
6046
  } }) })), overlay.kind === 'search' && _jsx(TranscriptSearch, { query: searchQuery, cursorOffset: searchCursor, count: searchCount, current: searchCurrent })] }));
6047
+ // Every scene retains the title, while its frame state stays in a null leaf.
6048
+ const withTitle = (content) => (_jsxs(_Fragment, { children: [_jsx(ChatTitle, { title: channel.sessionTitle, working: channel.working, focused: terminalFocused }), content] }));
5805
6049
  const screenOpen = channel.pluginScene !== undefined || supervisorOpen || settingsOpen
5806
6050
  || subagentDetailId !== null || subagentDashboardOpen || sceneOpen
5807
6051
  || agentView !== null
5808
6052
  || launchpadShown || onboardingOpen;
5809
6053
  if (interruptPanel !== null && screenOpen) {
5810
6054
  const node = (_jsx(Box, { flexDirection: "column", width: "100%", paddingX: 1, children: interruptPanel }));
5811
- return fullscreen ? node : _jsx(AlternateScreen, { children: node });
6055
+ return withTitle(fullscreen ? node : _jsx(AlternateScreen, { children: node }));
5812
6056
  }
5813
6057
  // A plugin scene (dsh-tui-scenes) takes the whole terminal the same way
5814
6058
  // the trajectory scene does, and sits at the TOP of this return chain:
@@ -5829,7 +6073,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5829
6073
  channel.notify(t('plugin-scene-crashed', { id, err: error.message }), { color: 'error' });
5830
6074
  channel.closePluginScene();
5831
6075
  }, children: renderScene ? renderScene(pluginScene.id, channel) : _jsxs(Text, { children: ["Scene unavailable: ", pluginScene.id] }) }));
5832
- return fullscreen ? node : _jsx(AlternateScreen, { children: node });
6076
+ return withTitle(fullscreen ? node : _jsx(AlternateScreen, { children: node }));
5833
6077
  }
5834
6078
  /**
5835
6079
  * The first-run guide — the FIRST frame of a fresh installation.
@@ -5844,7 +6088,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5844
6088
  * the user lands on the launcher.
5845
6089
  */
5846
6090
  if (onboardingOpen) {
5847
- const node = (_jsx(Onboarding, { channel: channel, themeHost: themeHost, onClose: closeOnboarding, onApplyLang: applyLang, onRunCommand: (name) => {
6091
+ const node = (_jsx(Onboarding, { channel: channel, themeHost: themeHost, onClose: closeOnboarding, onApplyLang: applyLang, onProviderSignIn: onboardingSignIn, onProviderAddProvider: runProviderSetup, onRunCommand: (name) => {
5848
6092
  // 与落地页的 onAction 同一条规则:打开整屏界面的命令要先把向导收掉。
5849
6093
  // 走 `closeOnboarding('skipped')` 而不是直接置 false——用户是去试命令、
5850
6094
  // 没答完引导,按 skipped 的口径不记账(下次启动还会问)。
@@ -5852,7 +6096,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5852
6096
  closeOnboarding('skipped');
5853
6097
  void runCommand(name, '');
5854
6098
  } }));
5855
- return fullscreen ? node : _jsx(AlternateScreen, { children: node });
6099
+ return withTitle(fullscreen ? node : _jsx(AlternateScreen, { children: node }));
5856
6100
  }
5857
6101
  /**
5858
6102
  * The session supervisor: a screen in the same sense as the tree — an early
@@ -5922,9 +6166,11 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5922
6166
  return undefined;
5923
6167
  return { status: channel.working ? 'working' : 'idle', live: true, current: true, summary: '' };
5924
6168
  } }));
6169
+ // Tooltip 单例层挂在最外层末尾:被截断的工作区路径条 hover 后由它画完整路径。
6170
+ const supervisorScene = (_jsxs(_Fragment, { children: [supervisorNode, _jsx(TooltipLayer, {})] }));
5925
6171
  // Inline hosts enter the alternate screen for the duration; full-screen
5926
6172
  // hosts are already in it and must not nest a second one.
5927
- return fullscreen ? supervisorNode : _jsx(AlternateScreen, { children: supervisorNode });
6173
+ return withTitle(fullscreen ? supervisorScene : _jsx(AlternateScreen, { children: supervisorScene }));
5928
6174
  }
5929
6175
  // The session tree follows the browser's rule exactly: it REPLACES the
5930
6176
  // conversation (an early return after every hook above has run), so there
@@ -5938,14 +6184,14 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5938
6184
  pendingFillRef.current = String(channel.agentId);
5939
6185
  setHistoryFill(text);
5940
6186
  } }));
5941
- return fullscreen ? tree : _jsx(AlternateScreen, { children: tree });
6187
+ return withTitle(fullscreen ? tree : _jsx(AlternateScreen, { children: tree }));
5942
6188
  }
5943
6189
  // The settings screen follows the browser's rule exactly: it REPLACES the
5944
6190
  // conversation (an early return after every hook above has run), so there
5945
6191
  // is no transcript underneath to be repainted or bled through.
5946
6192
  if (settingsOpen && launchpadGate()) {
5947
- const screen = _jsx(Settings, { channel: channel, onClose: () => setSettingsOpen(false) });
5948
- return fullscreen ? screen : _jsx(AlternateScreen, { children: screen });
6193
+ const screen = _jsx(Settings, { channel: channel, onClose: () => setSettingsOpen(false), statusFields: statusFields });
6194
+ return withTitle(fullscreen ? screen : _jsx(AlternateScreen, { children: screen }));
5949
6195
  }
5950
6196
  // Main-screen read-only Agent View: a scene over the mounted Chat, with no
5951
6197
  // second Channel and no change of the bound session. It borrows the screen
@@ -5964,11 +6210,11 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5964
6210
  const loadTranscript = channel.subagentControl?.history;
5965
6211
  const viewMessages = messageControl === undefined ? [] : messageControl.messages().filter(m => m.from === agentView.agentId || m.to === agentView.agentId);
5966
6212
  const viewTarget = agentComposeTargetOf(agentView.agentId, new Map(channel.subagents.map(s => [s.agentId, s.description])));
5967
- const viewScene = (_jsx(AgentTranscriptScene, { subagent: viewSubagent, source: agentView.source, onExit: () => exitAgentView(agentView.source), ...(loadTranscript === undefined ? {} : { loadTranscript }), messages: viewMessages, ...(messageControl === undefined ? {} : { compose: { control: messageControl, target: viewTarget } }), roster: channel.subagents,
6213
+ const viewScene = (_jsx(AgentTranscriptScene, { subagent: viewSubagent, onFailureRead: agent => subagentFailureRead.acknowledge(failureScope, agent), source: agentView.source, onExit: () => exitAgentView(agentView.source), ...(loadTranscript === undefined ? {} : { loadTranscript }), messages: viewMessages, ...(messageControl === undefined ? {} : { compose: { control: messageControl, target: viewTarget } }), roster: channel.subagents,
5968
6214
  // Switching to a sibling or the parent swaps the viewed agent in
5969
6215
  // place; Esc still returns to the original entry point.
5970
6216
  onSwitchAgent: switchViewedAgent }));
5971
- return fullscreen ? viewScene : _jsx(AlternateScreen, { children: viewScene });
6217
+ return withTitle(fullscreen ? viewScene : _jsx(AlternateScreen, { children: viewScene }));
5972
6218
  }
5973
6219
  // Subagent detail scene: displays detailed view of a specific subagent.
5974
6220
  // Like the browser and settings, it replaces the conversation entirely.
@@ -5983,11 +6229,11 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5983
6229
  const detailControl = channel.subagentControl?.message;
5984
6230
  const detailMessages = detailControl === undefined ? [] : detailControl.messages().filter(m => m.from === subagent.agentId || m.to === subagent.agentId);
5985
6231
  const detailTarget = agentComposeTargetOf(subagent.agentId, new Map(channel.subagents.map(s => [s.agentId, s.description])));
5986
- const scene = (_jsx(SubagentDetailScene, { subagent: subagent, onInterrupt: (id) => channel.subagentControl?.interrupt(id), ...(channel.subagentControl?.history === undefined ? {} : { loadTranscript: channel.subagentControl.history }), onOpenView: () => openAgentView(subagent.agentId, { kind: 'agent-detail', agentId: subagent.agentId }), messages: detailMessages, ...(detailControl === undefined ? {} : { compose: { control: detailControl, target: detailTarget } }), onBack: () => {
6232
+ const scene = (_jsx(SubagentDetailScene, { subagent: subagent, onFailureRead: agent => subagentFailureRead.acknowledge(failureScope, agent), onInterrupt: (id) => channel.subagentControl?.interrupt(id), ...(channel.subagentControl?.history === undefined ? {} : { loadTranscript: channel.subagentControl.history }), onOpenView: () => openAgentView(subagent.agentId, { kind: 'agent-detail', agentId: subagent.agentId }), messages: detailMessages, ...(detailControl === undefined ? {} : { compose: { control: detailControl, target: detailTarget } }), onBack: () => {
5987
6233
  setSubagentDetailId(null);
5988
6234
  setSubagentDashboardOpen(true);
5989
6235
  } }));
5990
- return fullscreen ? scene : _jsx(AlternateScreen, { children: scene });
6236
+ return withTitle(fullscreen ? scene : _jsx(AlternateScreen, { children: scene }));
5991
6237
  }
5992
6238
  // Jobs panel: background jobs (running/killed) with kill/inspect actions.
5993
6239
  // Like the browser and settings, it replaces the conversation entirely.
@@ -5999,7 +6245,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
5999
6245
  channel.notify(t('jobs-kill-failed', { id }), { color: 'error' });
6000
6246
  }
6001
6247
  } }));
6002
- return fullscreen ? panel : _jsx(AlternateScreen, { children: panel });
6248
+ return withTitle(fullscreen ? panel : _jsx(AlternateScreen, { children: panel }));
6003
6249
  }
6004
6250
  // ⤢ btw thread scene (openPanelFullscreen 'btw'): the whole-terminal form
6005
6251
  // of the sidebar panel. Esc returns to the sidebar exactly as it was — the
@@ -6009,7 +6255,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6009
6255
  // 送聊天之后整屏场景让位:关场景 + 焦点回主输入框——与侧栏形态里
6010
6256
  // 「面板留着、焦点回输入框」的落点一致(见 BtwThreadScene.sendToChat)。
6011
6257
  onFocusChat: sidePanel.focusChat }));
6012
- return fullscreen ? scene : _jsx(AlternateScreen, { children: scene });
6258
+ return withTitle(fullscreen ? scene : _jsx(AlternateScreen, { children: scene }));
6013
6259
  }
6014
6260
  // Subagent dashboard: displays all active and completed subagents.
6015
6261
  // Like the browser and settings, it replaces the conversation entirely.
@@ -6020,12 +6266,12 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6020
6266
  setSubagentDashboardOpen(false);
6021
6267
  setSubagentDetailId(id);
6022
6268
  }, onOpenView: (id) => openAgentView(id, { kind: 'agents-dashboard' }), messages: channel.subagentControl?.message?.messages(), onClose: () => setSubagentDashboardOpen(false) }));
6023
- return fullscreen ? dashboard : _jsx(AlternateScreen, { children: dashboard });
6269
+ return withTitle(fullscreen ? dashboard : _jsx(AlternateScreen, { children: dashboard }));
6024
6270
  }
6025
6271
  /** Prompt input is inert while a modal dialog owns the keyboard. The
6026
6272
  * overlay union covers every picker/dialog and /tips in one check;
6027
6273
  * message-selection mode and the /btw panel live outside it. */
6028
- const promptSelectionActive = selectionActive || overlay.kind !== 'none' || btwOverlayOpen;
6274
+ const promptSelectionActive = selectionActive || overlay.kind !== 'none' || btwOverlayVisible;
6029
6275
  // These panels replace the visible composer, but PromptInput remains
6030
6276
  // mounted (suspended) so an async registry command cannot lose its exact
6031
6277
  // text/image draft while it waits for a user decision.
@@ -6033,7 +6279,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6033
6279
  || dialogSnapshot !== null
6034
6280
  || overlay.kind === 'tips'
6035
6281
  || (recap !== null && (!recap.auto || recap.expanded))
6036
- || btwOverlayOpen
6282
+ || btwOverlayVisible
6037
6283
  || questionPanelNode !== null
6038
6284
  || starModal !== null
6039
6285
  || couponVisible;
@@ -6047,7 +6293,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6047
6293
  // whole app back to the main screen.
6048
6294
  if (sceneOpen && launchpadGate()) {
6049
6295
  const scene = _jsx(TrajectoryScene, { channel: channel, build: trajectory, onClose: closeScene });
6050
- return fullscreen ? scene : _jsx(AlternateScreen, { children: scene });
6296
+ return withTitle(fullscreen ? scene : _jsx(AlternateScreen, { children: scene }));
6051
6297
  }
6052
6298
  /**
6053
6299
  * The launchpad — the landing page an ordinary launch starts on.
@@ -6055,8 +6301,9 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6055
6301
  * 第七版渲染姿态:early-return 排在**所有整屏界面(会话浏览器 / 设置 /
6056
6302
  * 任务面板 / 家谱 / 子代理 / 轨迹场景)之后**——从落地页打开的整屏盖在
6057
6303
  * 落地页之上,Esc 退出整屏回到这里(草稿/参数/焦点原样保留)。硬约束:
6058
- * 从启动页进入对话页的唯一路径是**提交一条非命令消息**(Enter 发送);
6059
- * 任何 Esc/返回都回到启动页。参数行点开的选择器经 `pickerPanels` +
6304
+ * Enter 发送非命令消息后进入对话页;Shift/Option+Enter 则带着未发送的
6305
+ * 草稿进入对话页,并在当前光标处换行。Esc/返回都回到启动页。
6306
+ * 参数行点开的选择器经 `pickerPanels` +
6060
6307
  * `inputPaused` 渲染在本屏之上,Esc 关掉它也回到这里。
6061
6308
  */
6062
6309
  if (launchpadShown) {
@@ -6122,10 +6369,9 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6122
6369
  dispatchOverlay({ type: 'close' });
6123
6370
  }
6124
6371
  void runCommand(segment, '');
6125
- }, onQueryChange: changeLaunchpadDraft, onSubmit: submitLaunchpad, onFocusChange: setLaunchpadFocus, onAction: (action) => {
6372
+ }, onQueryChange: changeLaunchpadDraft, onSubmit: submitLaunchpad, onNewline: newlineLaunchpad, onHandoffInput: event => launchpadPendingInputRef.current.push(event.keypress), onFocusChange: setLaunchpadFocus, onAction: (action) => {
6126
6373
  // 第八版(用户实测:「刚点帮助,不知道为什么直接进入聊天页面了」):
6127
- // 帮助**不属于**离开启动页的两条路(Enter 发非命令消息 / 会话浏览
6128
- // 里选中会话)——它盖在落地页之上(overlay kind 'help'),再点同一
6374
+ // 帮助盖在落地页之上(overlay kind 'help'),再点同一
6129
6375
  // 入口 = 收起(与参数段同一条切换语义)。
6130
6376
  if (action.command === 'help') {
6131
6377
  dispatchOverlay(overlay.kind === 'help'
@@ -6187,7 +6433,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6187
6433
  // 离开被悬停的那一段,没有这个键时旧卡片会继续画在选择器上方(复核场景回归见
6188
6434
  // `verify-launchpad-onboarding-chat` 的 R4)。
6189
6435
  const node = (_jsxs(_Fragment, { children: [launchpad, _jsx(TooltipLayer, { invalidationKey: overlay.kind })] }));
6190
- return fullscreen ? node : _jsx(AlternateScreen, { children: node });
6436
+ return withTitle(fullscreen ? node : _jsx(AlternateScreen, { children: node }));
6191
6437
  }
6192
6438
  // 浮层整体挂载条件:与内部各面板的可见条件同值(数据门在
6193
6439
  // dialogOverlayVisible 里逐面板镜像)。关闭时把整个 absolute 浮层从树里
@@ -6232,7 +6478,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6232
6478
  ? () => setPeekSuppressed(peekKey(activePreview.image, activePreview.title))
6233
6479
  : () => dispatchOverlay({ type: 'close-if', kind: 'image-preview' }), region: imagePreviewRegion }))
6234
6480
  : null;
6235
- return (_jsxs(Box, { ref: wakeTickRef, flexDirection: "column", flexGrow: 1, width: "100%", children: [_jsxs(SidePanelLayout, { geometry: sidePanel.geometry, focus: sidePanel.focus, onActivateChat: sidePanel.focusChat, onActivatePanel: sidePanel.focusPanel, onResize: sidePanel.resize, side: _jsx(SidePanelColumn, { width: sidePanel.panelColumns, controller: sidePanel, channel: channel, activity: workingActivity, attention: {
6481
+ return withTitle(_jsxs(Box, { flexDirection: "column", flexGrow: 1, width: "100%", children: [_jsxs(SidePanelLayout, { geometry: sidePanel.geometry, focus: sidePanel.focus, onActivateChat: sidePanel.focusChat, onActivatePanel: sidePanel.focusPanel, onResize: sidePanel.resize, side: _jsx(SidePanelColumn, { width: sidePanel.panelColumns, controller: sidePanel, channel: channel, activity: workingActivity, attention: {
6236
6482
  approvals: approvalSnapshot !== null ? 1 : 0,
6237
6483
  questions: questionSnapshot !== null ? 1 : 0,
6238
6484
  }, trajectory: trajectory, onExpand: openPanelFullscreen }), children: [!isSticky && timeline.activeId !== null && (_jsx(PinnedTurnHeader, { text: anchorUserText || null, onClick: () => {
@@ -6285,7 +6531,8 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6285
6531
  // inflating the reading next to a real upload number). An
6286
6532
  // automatic compaction mid-turn badges THIS line too — it is
6287
6533
  // the spinner slot whenever real activity data exists.
6288
- suffix: `${lastUploadTokens > 0 ? ` · ↑ ${formatTokens(lastUploadTokens)}` : ''} · ↓ ${formatTokens(Math.round(channel.responseChars / 4))} tokens${compactionBadge === undefined ? '' : ` · ${compactionBadge}`}` }) })) : (_jsx(WorkingSpinner, { mode: channel.spinnerMode, hasActiveTools: channel.activeToolCount > 0, responseLengthRef: responseLengthRef, uploadTokensRef: uploadTokensRef, loadingStartTimeRef: loadingStartTimeRef, totalPausedMsRef: totalPausedMsRef, pauseStartTimeRef: pauseStartTimeRef, thinkingStatus: thinkingStatus, suffix: compactionBadge }))), !channel.working && channel.compaction !== undefined && (_jsx(CompactionStatusRow, { compaction: channel.compaction, activityPreset: activitySlot ? channel.activityFrames : undefined })), !(sidePanel.split && sidePanel.enabledPanelIds.includes('todo')) && (_jsx(GoalTodoPanel, { channel: channel, collapsed: todoCollapsed, onToggle: () => setTodoCollapsed(previous => !previous) })), recap !== null && recap.auto && !recap.expanded && (_jsx(AutoRecapRow, { summary: recap.summary, streaming: !recap.done, onExpand: () => setRecap(prev => (prev ? { ...prev, expanded: true } : prev)), onDismiss: () => closeRecap() })), balance !== null && (_jsx(BalanceReportRow, { result: balance.result, refreshing: balance.refreshing, tokens: channel.tokens, model: channel.modelDisplay ?? channel.model, provider: channel.provider, mainCost: channel.mainCost, subagentCost: channel.subagentCost, onRefresh: runBalance, onDismiss: () => setBalance(null) })), statusEntries.length > 0 && (_jsx(Text, { dimColor: true, wrap: "truncate", children: statusEntries.map(entry => entry.text).join(' · ') })), activePreview === null && statusViews.map(view => (_jsx(PluginStatusViewBoundary, { viewKey: view.key, onError: (key, error) => statusContributions.reportViewError(key, error), children: _jsx(Box, { flexDirection: "column", flexShrink: 0, maxHeight: view.maxRows, overflow: "hidden", children: _jsx(Box, { flexDirection: "column", flexShrink: 0, children: React.createElement(view.component, {
6534
+ suffix: `${lastUploadTokens > 0 ? ` · ↑ ${formatTokens(lastUploadTokens)}` : ''} · ↓ ${formatTokens(Math.round(channel.responseChars / 4))} tokens${compactionBadge === undefined ? '' : ` · ${compactionBadge}`}` }) })) : (_jsx(WorkingSpinner, { mode: channel.spinnerMode, hasActiveTools: channel.activeToolCount > 0, responseLengthRef: responseLengthRef, uploadTokensRef: uploadTokensRef, loadingStartTimeRef: loadingStartTimeRef, totalPausedMsRef: totalPausedMsRef, pauseStartTimeRef: pauseStartTimeRef, thinkingStatus: thinkingStatus, suffix: compactionBadge }))), !channel.working && channel.compaction !== undefined && (_jsx(CompactionStatusRow, { compaction: channel.compaction, activityPreset: activitySlot ? channel.activityFrames : undefined })), !(sidePanel.split && sidePanel.enabledPanelIds.includes('todo'))
6535
+ && !todoFooterHidden && (_jsx(GoalTodoPanel, { channel: channel, collapsed: todoCollapsed, onToggle: toggleTodoFooter, idleDismissal: true })), recap !== null && recap.auto && !recap.expanded && (_jsx(AutoRecapRow, { summary: recap.summary, streaming: !recap.done, onExpand: () => setRecap(prev => (prev ? { ...prev, expanded: true } : prev)), onDismiss: () => closeRecap() })), balance !== null && (_jsx(BalanceReportRow, { result: balance.result, refreshing: balance.refreshing, tokens: channel.tokens, model: channel.modelDisplay ?? channel.model, provider: channel.provider, mainCost: channel.mainCost, subagentCost: channel.subagentCost, onRefresh: runBalance, onDismiss: () => setBalance(null) })), statusEntries.length > 0 && (_jsx(Text, { dimColor: true, wrap: "truncate", children: statusEntries.map(entry => entry.text).join(' · ') })), activePreview === null && statusViews.map(view => (_jsx(PluginStatusViewBoundary, { viewKey: view.key, onError: (key, error) => statusContributions.reportViewError(key, error), children: _jsx(Box, { flexDirection: "column", flexShrink: 0, maxHeight: view.maxRows, overflow: "hidden", children: _jsx(Box, { flexDirection: "column", flexShrink: 0, children: React.createElement(view.component, {
6289
6536
  React,
6290
6537
  ui: STATUS_VIEW_UI,
6291
6538
  }) }) }) }, `${view.key}:${view.registrationId}`))), _jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [approvalPanelNode !== null ? (approvalPanelNode) : dialogSnapshot !== null ? (_jsx(ExtensionDialog, { dialog: dialogSnapshot, onDecide: value => dialogs.decide(dialogSnapshot.key, value), onCancel: () => dialogs.cancel(dialogSnapshot.key) }, dialogSnapshot.key)) : overlay.kind === 'tips' ? (_jsx(Box, { flexDirection: "column", marginTop: 1, children: _jsx(TipsPanel, { onClose: () => dispatchOverlay({ type: 'close-if', kind: 'tips' }) }) })) : recap !== null && (!recap.auto || recap.expanded) ? (_jsx(Box, { flexDirection: "column", marginTop: 1, children: _jsx(RecapPanel, { summary: recap.summary, title: recap.title, error: recap.error, streaming: !recap.done, titleApplied: recap.titleApplied, onClose: () => {
@@ -6307,7 +6554,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6307
6554
  channel.renameSession(recap.title);
6308
6555
  setRecap(prev => (prev ? { ...prev, titleApplied: true } : prev));
6309
6556
  channel.notify(t('recap-title-applied-notify', { title: recap.title }), { color: 'success' });
6310
- } }) })) : btwOverlayOpen && !sidePanel.enabledPanelIds.includes('btw') ? (_jsx(Box, { flexDirection: "column", marginTop: 1, children: _jsx(BtwPanelFallback, { thread: btwOverlayThread, onClose: closeBtwOverlay, onCopy: answer => {
6557
+ } }) })) : btwOverlayVisible ? (_jsx(Box, { flexDirection: "column", marginTop: 1, children: _jsx(BtwPanelFallback, { thread: btwOverlayThread, onClose: closeBtwOverlay, onCopy: answer => {
6311
6558
  void setClipboard(answer).then(raw => { if (raw)
6312
6559
  writeRaw?.(raw); });
6313
6560
  channel.notify(t('copied-chars', { n: answer.length }), { timeoutMs: 1500 });
@@ -6319,7 +6566,14 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6319
6566
  // 不再重复弹同一条(error 色除外——可能要行动的信号永远走 toast)。
6320
6567
  // 渲染期判定(split + activePanelId),与气泡同一次提交切换,不会
6321
6568
  // 先闪一帧 toast 再消失。
6322
- toastSuppressed: petSaysNotices, draftCache: promptDraftRef.current, helpOpen: helpOpen, onToggleHelp: () => { setHelpOpen(previous => !previous); }, onRunCommand: runCommand, selectionActive: promptSelectionActive, fillText: historyFill, onFillConsumed: () => setHistoryFill(null), onRewindRequest: openRewind, onBackgroundRequest: backgroundToAgentView,
6569
+ toastSuppressed: petSaysNotices, draftCache: promptDraftRef.current, onInputReady: () => {
6570
+ // Restore the draft and register the composer listener before
6571
+ // replaying keys captured during the launchpad's final stdin batch.
6572
+ const pending = launchpadPendingInputRef.current;
6573
+ launchpadPendingInputRef.current = [];
6574
+ for (const keypress of pending)
6575
+ inputEmitter.emit('input', new InputEvent(keypress));
6576
+ }, helpOpen: helpOpen, onToggleHelp: () => { setHelpOpen(previous => !previous); }, onRunCommand: runCommand, selectionActive: promptSelectionActive, fillText: historyFill, onFillConsumed: () => setHistoryFill(null), onRewindRequest: openRewind, onBackgroundRequest: backgroundToAgentView,
6323
6577
  // The 🏠 at the head of the input row opens the same session screen
6324
6578
  // `/resume` and `/agentview` open — one surface, three doors. It is
6325
6579
  // gated on this prop rather than a setting, so hosts that mount the
@@ -6341,7 +6595,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6341
6595
  // clock and shifting every row-count layout invariant.
6342
6596
  channel.agentViewRows !== undefined && backgroundAgentsNeedingInput > 0
6343
6597
  ? backgroundAgentsNeedingInput
6344
- : undefined, controllerRef: promptControllerRef, onCaretImage: handleCaretImage, caretPreviewOpen: peekPreview !== null, onDismissCaretPreview: dismissPeek }, "prompt-input"), _jsx(StatusLine, { channel: channel, activity: workingActivity, selectionActive: selectionActive, helpOpen: helpOpen,
6598
+ : undefined, controllerRef: promptControllerRef, onCaretImage: handleCaretImage, caretPreviewOpen: peekPreview !== null, onDismissCaretPreview: dismissPeek }, "prompt-input"), _jsx(StatusLine, { channel: channel, activity: workingActivity, selectionActive: selectionActive, helpOpen: helpOpen, pluginFields: statusFields,
6345
6599
  // Backend-native permission modes: the footer mode segment always
6346
6600
  // shows (the base mode included) and clicks into the same
6347
6601
  // /permission picker the command opens (the launchpad param row's
@@ -6355,10 +6609,9 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
6355
6609
  : {
6356
6610
  band: wakeBand,
6357
6611
  hint: trajectorySeen ? undefined : primaryComboString('trajectory'),
6358
- tick: Math.floor(wakeTime / 120),
6359
6612
  onOpen: openScene,
6360
6613
  hoverHint: primaryComboString('trajectory'),
6361
- } }), dialogOverlayOpen && (_jsx(OverlayAbove, { maxHeight: Math.max(terminalRows - 8, 1), children: pickerPanels }))] })] }), _jsx(TooltipLayer, { invalidationKey: `${overlay.kind}:${dialogOverlayOpen}:${btwOverlayOpen}`, subscribeInvalidation: subscribeTooltipInvalidation })] }), _jsx(PromptEditorLayer, {}), promptEditorOpen && imagePreviewNode, starModal !== null && STAR_MILESTONES[starModal.index] !== undefined && (_jsx(StarPrompt, { milestone: STAR_MILESTONES[starModal.index], actions: starModalActions, onClose: closeStarModal, initialPhase: starModal.phase })), couponVisible && coupon !== null && (_jsx(WhaleCouponPrompt, { notice: coupon, onShown: markCouponShown, onClose: closeCoupon }))] }));
6614
+ } }), dialogOverlayOpen && (_jsx(OverlayAbove, { maxHeight: Math.max(terminalRows - 8, 1), children: pickerPanels }))] })] }), _jsx(TooltipLayer, { invalidationKey: `${overlay.kind}:${dialogOverlayOpen}:${btwOverlayVisible}`, subscribeInvalidation: subscribeTooltipInvalidation })] }), _jsx(PromptEditorLayer, {}), promptEditorOpen && imagePreviewNode, starModal !== null && STAR_MILESTONES[starModal.index] !== undefined && (_jsx(StarPrompt, { milestone: STAR_MILESTONES[starModal.index], actions: starModalActions, onClose: closeStarModal, initialPhase: starModal.phase })), couponVisible && coupon !== null && (_jsx(WhaleCouponPrompt, { notice: coupon, onShown: markCouponShown, onClose: closeCoupon }))] }));
6362
6615
  }
6363
6616
  /**
6364
6617
  * The pinned prompt header shown above the ScrollBox while the user has