@deepseek-harness-tui/dsh-tui 0.17.0 → 0.19.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 (318) hide show
  1. package/README.md +43 -16
  2. package/bin/dsh-tui.js +46 -3
  3. package/cli/adapters/dsh/index.mjs +2 -2
  4. package/guide/dsh-tui-guide/cli.en.md +1 -1
  5. package/guide/dsh-tui-guide/cli.md +1 -1
  6. package/guide/dsh-tui-guide/codex-backend.en.md +2 -2
  7. package/guide/dsh-tui-guide/codex-backend.md +2 -2
  8. package/guide/dsh-tui-guide/configuration.en.md +8 -2
  9. package/guide/dsh-tui-guide/configuration.md +8 -2
  10. package/guide/dsh-tui-guide/getting-started.en.md +174 -6
  11. package/guide/dsh-tui-guide/getting-started.md +125 -15
  12. package/guide/dsh-tui-guide/interaction.en.md +30 -8
  13. package/guide/dsh-tui-guide/interaction.md +18 -5
  14. package/guide/dsh-tui-guide/plugins.en.md +28 -7
  15. package/guide/dsh-tui-guide/plugins.md +18 -5
  16. package/guide/dsh-tui-guide/user-guide.en.md +32 -17
  17. package/guide/dsh-tui-guide/user-guide.md +23 -12
  18. package/lib/settings.json +3 -3
  19. package/lib/types/adapter/channel/ui-policy.d.ts +1 -0
  20. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  21. package/lib/types/adapter/channel/ui-policy.js +1 -0
  22. package/lib/types/adapter/ports/channel-ui.d.ts +10 -2
  23. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  24. package/lib/types/adapter/ports/channel-view.d.ts +31 -5
  25. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  26. package/lib/types/adapter/standard/grants.d.ts +60 -0
  27. package/lib/types/adapter/standard/grants.d.ts.map +1 -1
  28. package/lib/types/adapter/standard/grants.js +74 -0
  29. package/lib/types/agent/events.d.ts +16 -3
  30. package/lib/types/agent/events.d.ts.map +1 -1
  31. package/lib/types/agent/session.d.ts +5 -0
  32. package/lib/types/agent/session.d.ts.map +1 -1
  33. package/lib/types/backends/claude/translate/core.d.ts +2 -2
  34. package/lib/types/backends/claude/translate/core.d.ts.map +1 -1
  35. package/lib/types/backends/claude/translate/core.js +10 -6
  36. package/lib/types/backends/codex/session/commands.d.ts +2 -0
  37. package/lib/types/backends/codex/session/commands.d.ts.map +1 -1
  38. package/lib/types/backends/codex/session/commands.js +8 -4
  39. package/lib/types/backends/codex/session/input.d.ts +11 -7
  40. package/lib/types/backends/codex/session/input.d.ts.map +1 -1
  41. package/lib/types/backends/codex/session/input.js +68 -15
  42. package/lib/types/backends/codex/session/session.d.ts.map +1 -1
  43. package/lib/types/backends/codex/session/session.js +2 -3
  44. package/lib/types/channel/projection.d.ts.map +1 -1
  45. package/lib/types/channel/projection.js +78 -10
  46. package/lib/types/channel/questions.d.ts +19 -3
  47. package/lib/types/channel/questions.d.ts.map +1 -1
  48. package/lib/types/channel/sanitize.d.ts.map +1 -1
  49. package/lib/types/channel/sanitize.js +8 -4
  50. package/lib/types/channel/subagent-failure.d.ts +49 -0
  51. package/lib/types/channel/subagent-failure.d.ts.map +1 -0
  52. package/lib/types/channel/subagent-failure.js +59 -0
  53. package/lib/types/channel/transcript.d.ts +17 -0
  54. package/lib/types/channel/transcript.d.ts.map +1 -1
  55. package/lib/types/channel/transcript.js +35 -0
  56. package/lib/types/commands.js +2 -2
  57. package/lib/types/components/GoalTodoPanel.d.ts +71 -6
  58. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  59. package/lib/types/components/GoalTodoPanel.js +165 -17
  60. package/lib/types/components/MessageList.d.ts.map +1 -1
  61. package/lib/types/components/MessageList.js +14 -9
  62. package/lib/types/components/PluginGrantList.d.ts +45 -0
  63. package/lib/types/components/PluginGrantList.d.ts.map +1 -0
  64. package/lib/types/components/PluginGrantList.js +126 -0
  65. package/lib/types/components/PluginInstallPane.d.ts.map +1 -1
  66. package/lib/types/components/PluginInstallPane.js +35 -6
  67. package/lib/types/components/PluginManagePane.d.ts.map +1 -1
  68. package/lib/types/components/PluginManagePane.js +65 -8
  69. package/lib/types/components/PromptInput.d.ts.map +1 -1
  70. package/lib/types/components/PromptInput.js +63 -8
  71. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  72. package/lib/types/components/SubagentDashboard.js +17 -1
  73. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  74. package/lib/types/components/SubagentDetailScene.js +12 -0
  75. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -1
  76. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  77. package/lib/types/components/messages/AssistantToolUseMessage.js +16 -7
  78. package/lib/types/components/onboardingModel.d.ts +2 -2
  79. package/lib/types/components/onboardingModel.js +3 -3
  80. package/lib/types/components/onboardingProviderPlan.d.ts +110 -0
  81. package/lib/types/components/onboardingProviderPlan.d.ts.map +1 -0
  82. package/lib/types/components/onboardingProviderPlan.js +78 -0
  83. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -8
  84. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  85. package/lib/types/components/questions/AskUserQuestionPanel.js +7 -4
  86. package/lib/types/components/questions/PlanReviewPanel.d.ts +3 -6
  87. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  88. package/lib/types/components/revealScope.d.ts +15 -0
  89. package/lib/types/components/revealScope.d.ts.map +1 -0
  90. package/lib/types/components/revealScope.js +17 -0
  91. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +41 -1
  92. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
  93. package/lib/types/components/sidePanel/btw/BtwComposer.js +123 -6
  94. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
  95. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +9 -2
  96. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts +7 -1
  97. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
  98. package/lib/types/components/sidePanel/btw/BtwThreadScene.js +9 -2
  99. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts +30 -0
  100. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts.map +1 -0
  101. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.js +94 -0
  102. package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
  103. package/lib/types/components/sidePanel/builtinPanels.js +14 -2
  104. package/lib/types/components/sidePanel/types.d.ts +2 -0
  105. package/lib/types/components/sidePanel/types.d.ts.map +1 -1
  106. package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
  107. package/lib/types/components/sidePanel/useSidePanel.js +15 -1
  108. package/lib/types/components/smoothReveal.d.ts +36 -6
  109. package/lib/types/components/smoothReveal.d.ts.map +1 -1
  110. package/lib/types/components/smoothReveal.js +92 -21
  111. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts +4 -14
  112. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
  113. package/lib/types/components/workspaces/HomeWorkspaceRow.js +26 -17
  114. package/lib/types/dsh-adapter/backend/session.d.ts +7 -1
  115. package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
  116. package/lib/types/dsh-adapter/backend/session.js +74 -6
  117. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  118. package/lib/types/dsh-adapter/backend/translate.js +15 -6
  119. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
  120. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
  121. package/lib/types/dsh-adapter/channel/agent-view-projection.js +3 -1
  122. package/lib/types/dsh-adapter/channel/attached-context.d.ts +15 -2
  123. package/lib/types/dsh-adapter/channel/attached-context.d.ts.map +1 -1
  124. package/lib/types/dsh-adapter/channel/attached-context.js +26 -3
  125. package/lib/types/dsh-adapter/channel/binding-events.d.ts +3 -0
  126. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  127. package/lib/types/dsh-adapter/channel/binding-events.js +43 -2
  128. package/lib/types/dsh-adapter/channel/composer-images.d.ts +2 -0
  129. package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
  130. package/lib/types/dsh-adapter/channel/composer-images.js +10 -2
  131. package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
  132. package/lib/types/dsh-adapter/channel/composer-mentions.js +22 -7
  133. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +3 -7
  134. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
  135. package/lib/types/dsh-adapter/channel/context-bookkeeping.js +16 -6
  136. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +6 -0
  137. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
  138. package/lib/types/dsh-adapter/channel/core/binding-feed.js +35 -1
  139. package/lib/types/dsh-adapter/channel/core/compose.d.ts +3 -7
  140. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  141. package/lib/types/dsh-adapter/channel/core/compose.js +6 -1
  142. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
  143. package/lib/types/dsh-adapter/channel/core/local-actions.js +3 -26
  144. package/lib/types/dsh-adapter/channel/emitter.js +1 -1
  145. package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
  146. package/lib/types/dsh-adapter/channel/extensions.js +8 -0
  147. package/lib/types/dsh-adapter/channel/input-actions.d.ts +4 -4
  148. package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
  149. package/lib/types/dsh-adapter/channel/input-actions.js +59 -5
  150. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +3 -7
  151. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  152. package/lib/types/dsh-adapter/channel/input-delivery.js +21 -8
  153. package/lib/types/dsh-adapter/channel/mentions.d.ts.map +1 -1
  154. package/lib/types/dsh-adapter/channel/mentions.js +21 -7
  155. package/lib/types/dsh-adapter/channel/model-actions.d.ts +4 -1
  156. package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
  157. package/lib/types/dsh-adapter/channel/model-actions.js +26 -9
  158. package/lib/types/dsh-adapter/channel/model-selection.d.ts +27 -2
  159. package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
  160. package/lib/types/dsh-adapter/channel/model-selection.js +81 -37
  161. package/lib/types/dsh-adapter/channel/model-switch.d.ts +1 -1
  162. package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
  163. package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
  164. package/lib/types/dsh-adapter/channel/paths.js +11 -9
  165. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +1 -1
  166. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
  167. package/lib/types/dsh-adapter/channel/session-live-adoption.js +6 -1
  168. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  169. package/lib/types/dsh-adapter/channel/session-reset.js +3 -1
  170. package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -1
  171. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  172. package/lib/types/dsh-adapter/channel/session-resume.js +10 -3
  173. package/lib/types/dsh-adapter/channel/session-rewind.d.ts +1 -1
  174. package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
  175. package/lib/types/dsh-adapter/channel/session-rewind.js +9 -3
  176. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts +1 -1
  177. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
  178. package/lib/types/dsh-adapter/channel/session-tree-actions.js +11 -5
  179. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  180. package/lib/types/dsh-adapter/channel/settings-host.js +6 -3
  181. package/lib/types/dsh-adapter/channel/transcript.d.ts +3 -2
  182. package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
  183. package/lib/types/dsh-adapter/channel/transcript.js +13 -4
  184. package/lib/types/dsh-adapter/channel/types.d.ts +11 -2
  185. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  186. package/lib/types/dsh-adapter/contract.d.ts +27 -3
  187. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  188. package/lib/types/dsh-adapter/contract.js +47 -5
  189. package/lib/types/dsh-adapter/entry-slot.d.ts +6 -0
  190. package/lib/types/dsh-adapter/entry-slot.d.ts.map +1 -1
  191. package/lib/types/dsh-adapter/experimental-bundles.d.ts +3 -0
  192. package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
  193. package/lib/types/dsh-adapter/experimental-bundles.js +4 -0
  194. package/lib/types/dsh-adapter/fresh-agent.d.ts +1 -1
  195. package/lib/types/dsh-adapter/fresh-agent.d.ts.map +1 -1
  196. package/lib/types/dsh-adapter/fresh-agent.js +60 -11
  197. package/lib/types/dsh-adapter/grant-file.d.ts +70 -0
  198. package/lib/types/dsh-adapter/grant-file.d.ts.map +1 -0
  199. package/lib/types/dsh-adapter/grant-file.js +178 -0
  200. package/lib/types/dsh-adapter/host-access.d.ts +4 -0
  201. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
  202. package/lib/types/dsh-adapter/host-access.js +114 -15
  203. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  204. package/lib/types/dsh-adapter/host-contract.d.ts.map +1 -1
  205. package/lib/types/dsh-adapter/host-contract.js +5 -3
  206. package/lib/types/dsh-adapter/host-dsh.d.ts +0 -8
  207. package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
  208. package/lib/types/dsh-adapter/host-dsh.js +27 -6
  209. package/lib/types/dsh-adapter/host-entry.js +4 -0
  210. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  211. package/lib/types/dsh-adapter/index.js +8 -5
  212. package/lib/types/dsh-adapter/oauth/profiles.d.ts.map +1 -1
  213. package/lib/types/dsh-adapter/oauth/profiles.js +14 -1
  214. package/lib/types/dsh-adapter/panels.d.ts +7 -1
  215. package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
  216. package/lib/types/dsh-adapter/plugin-declaration.d.ts +28 -0
  217. package/lib/types/dsh-adapter/plugin-declaration.d.ts.map +1 -1
  218. package/lib/types/dsh-adapter/plugin-declaration.js +43 -1
  219. package/lib/types/dsh-adapter/plugin-install.d.ts +28 -1
  220. package/lib/types/dsh-adapter/plugin-install.d.ts.map +1 -1
  221. package/lib/types/dsh-adapter/plugin-install.js +160 -13
  222. package/lib/types/dsh-adapter/plugin-manage.d.ts +53 -10
  223. package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
  224. package/lib/types/dsh-adapter/plugin-manage.js +240 -51
  225. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  226. package/lib/types/dsh-adapter/plugin.js +203 -58
  227. package/lib/types/dsh-adapter/plugins-info.d.ts +6 -7
  228. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
  229. package/lib/types/dsh-adapter/plugins-info.js +34 -21
  230. package/lib/types/dsh-adapter/presets.d.ts +41 -10
  231. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  232. package/lib/types/dsh-adapter/presets.js +59 -12
  233. package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
  234. package/lib/types/dsh-adapter/process-exit.js +1 -1
  235. package/lib/types/dsh-adapter/providerWizard.d.ts +2 -0
  236. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  237. package/lib/types/dsh-adapter/providerWizard.js +11 -5
  238. package/lib/types/dsh-adapter/questions.d.ts +3 -4
  239. package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
  240. package/lib/types/dsh-adapter/questions.js +1 -1
  241. package/lib/types/dsh-adapter/row-attachment.d.ts +30 -0
  242. package/lib/types/dsh-adapter/row-attachment.d.ts.map +1 -0
  243. package/lib/types/dsh-adapter/row-attachment.js +29 -0
  244. package/lib/types/dsh-adapter/session-list-metadata.js +2 -2
  245. package/lib/types/dsh-adapter/subagents.d.ts +5 -0
  246. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  247. package/lib/types/dsh-adapter/subagents.js +22 -1
  248. package/lib/types/dsh-adapter/team-mode.d.ts +17 -10
  249. package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
  250. package/lib/types/dsh-adapter/team-mode.js +19 -12
  251. package/lib/types/dsh-adapter/tool-scope.d.ts +24 -0
  252. package/lib/types/dsh-adapter/tool-scope.d.ts.map +1 -0
  253. package/lib/types/dsh-adapter/tool-scope.js +127 -0
  254. package/lib/types/dsh-adapter/types.d.ts +2 -1
  255. package/lib/types/dsh-adapter/types.d.ts.map +1 -1
  256. package/lib/types/dsh-adapter/worktree-tool.d.ts +27 -0
  257. package/lib/types/dsh-adapter/worktree-tool.d.ts.map +1 -0
  258. package/lib/types/dsh-adapter/worktree-tool.js +87 -0
  259. package/lib/types/heldInputs.d.ts +75 -0
  260. package/lib/types/heldInputs.d.ts.map +1 -0
  261. package/lib/types/heldInputs.js +409 -0
  262. package/lib/types/i18n.d.ts +577 -34
  263. package/lib/types/i18n.d.ts.map +1 -1
  264. package/lib/types/i18n.js +230 -22
  265. package/lib/types/ink/components/App.d.ts +2 -0
  266. package/lib/types/ink/components/App.d.ts.map +1 -1
  267. package/lib/types/ink/components/App.js +8 -0
  268. package/lib/types/ink/events/input-event.d.ts.map +1 -1
  269. package/lib/types/ink/events/input-event.js +7 -6
  270. package/lib/types/ink/hit-test.d.ts +2 -0
  271. package/lib/types/ink/hit-test.d.ts.map +1 -1
  272. package/lib/types/ink/hit-test.js +10 -0
  273. package/lib/types/ink/hooks/use-program-status.d.ts +1 -1
  274. package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -1
  275. package/lib/types/ink/hooks/use-program-status.js +3 -2
  276. package/lib/types/ink/ink.d.ts +1 -0
  277. package/lib/types/ink/ink.d.ts.map +1 -1
  278. package/lib/types/ink/ink.js +5 -2
  279. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  280. package/lib/types/ink/parse-keypress.js +25 -0
  281. package/lib/types/ink/terminal.d.ts +13 -2
  282. package/lib/types/ink/terminal.d.ts.map +1 -1
  283. package/lib/types/ink/terminal.js +29 -5
  284. package/lib/types/onboardingDraft.d.ts +143 -0
  285. package/lib/types/onboardingDraft.d.ts.map +1 -0
  286. package/lib/types/onboardingDraft.js +71 -0
  287. package/lib/types/screens/Chat.d.ts.map +1 -1
  288. package/lib/types/screens/Chat.js +133 -32
  289. package/lib/types/screens/Onboarding.d.ts +22 -3
  290. package/lib/types/screens/Onboarding.d.ts.map +1 -1
  291. package/lib/types/screens/Onboarding.js +606 -36
  292. package/lib/types/screens/SessionSupervisor.d.ts +3 -6
  293. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  294. package/lib/types/screens/SessionSupervisor.js +5 -8
  295. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +1 -2
  296. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
  297. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +2 -2
  298. package/lib/types/screens/sessionSupervisor/model.d.ts +1 -1
  299. package/lib/types/screens/sessionSupervisor/model.js +1 -1
  300. package/lib/types/sessionMounts.d.ts +12 -5
  301. package/lib/types/sessionMounts.d.ts.map +1 -1
  302. package/lib/types/sessionMounts.js +33 -6
  303. package/lib/types/settings/definitions.js +2 -2
  304. package/lib/types/update.d.ts +412 -20
  305. package/lib/types/update.d.ts.map +1 -1
  306. package/lib/types/update.js +2094 -193
  307. package/lib/types/updateHost.d.ts +198 -0
  308. package/lib/types/updateHost.d.ts.map +1 -0
  309. package/lib/types/updateHost.js +608 -0
  310. package/lib/types/utils/paths.d.ts +15 -0
  311. package/lib/types/utils/paths.d.ts.map +1 -1
  312. package/lib/types/utils/paths.js +25 -0
  313. package/lib/types/utils/processName.d.ts +16 -0
  314. package/lib/types/utils/processName.d.ts.map +1 -0
  315. package/lib/types/utils/processName.js +27 -0
  316. package/package.json +114 -108
  317. package/tui-profile/feed/README.md +1 -1
  318. package/tui-profile/feed/first-party.json +1 -1
@@ -14,6 +14,7 @@ import { EDITABLE_CONFIG_KEYS } from '../settings/definitions.js';
14
14
  import { kernelEntriesOf } from '../components/kernelCatalog.js';
15
15
  import { openBackendStartup, prepareBackendStartup, probeKernels, installSurfaceFor } from './backends.js';
16
16
  import { backendLabel, isBackendIdSyntax, isRegisteredBackend, listBackends, listOfferedBackends, loadBackend, parseBackendChoice, unloadBackends } from './backend-registry.js';
17
+ import { installedKernelVersion } from './contract.js';
17
18
  import { createPluginInstallEntry } from './plugin-install.js';
18
19
  import { createPluginManageEntry } from './plugin-manage.js';
19
20
  import { formatSessionRef } from '../agent/refs.js';
@@ -52,11 +53,12 @@ import { clearResumeTarget, resumeTargetFromArgv, stripResumeArgs, writeResumeTa
52
53
  import { cmdlineArgsOf, initialPromptFromCmdlineArgs } from './startup-args.js';
53
54
  import { readHomePrefs } from '../homePrefs.js';
54
55
  import { handoffEventTag, formatHandoffNotice } from '../handoffEvents.js';
56
+ import { adoptHeldInputs, collectHeldInputs, heldInputsResumeCommand, takeHeldInputs, writeHeldInputs } from '../heldInputs.js';
55
57
  import { armFirstFrameAck, beginHandoffAck, handoffAttemptId, ownsAltScreenExit } from '../handoffAck.js';
56
58
  import { DSH_BACKEND_ID, HOST_NOTICE_ENV, KERNEL_SWITCH_HANDOFF_ENV, RESUME_BACKEND_ENV, RESUME_RETRY_ENV, parseBackendId, readKernelPrefs, resolveRememberedBackend, resolveResumeTarget, writeKernelPrefs } from '../kernelPrefs.js';
57
59
  import { shouldOfferOnboarding } from '../onboardingPrefs.js';
58
60
  import { resolveSessionCwd } from '../utils/workspaceRoot.js';
59
- import { LAUNCH_PROMPT_SENT_ENV, beginRestartAttempt, checkForTuiUpdate, installedTuiVersion, isBootDeadlockTarget, isStandaloneRuntime, isVersionNewer, logRestartEvent, resolveDshProfileName, resolveTuiUpdateTarget, restartTui, updateTuiAndRestart, writeHandoffNotice, writeLastRunRecord } from '../update.js';
61
+ import { LAUNCH_PROMPT_SENT_ENV, beginRestartAttempt, blockedUpdateMessages, checkForTuiUpdate, describeHostStepReason, describeLauncherStepReason, deliverEngineSkipReport, idleReportMessages, installedTuiVersion, isBootDeadlockTarget, isStandaloneRuntime, isVersionNewer, logRestartEvent, resolveDshProfileName, resolveUpdatePlan, restartTui, updatePlanLayers, updatePlanState, updatePlanSuite, updateTuiAndRestart, writeHandoffNotice, writeLastRunRecord } from '../update.js';
60
62
  import { getLang, isLang, resolveStartupLang, setLang, t, writeLangPref } from '../i18n.js';
61
63
  import { applyBtwContextBudget, applyBtwContextTurns, applyCodeFrameStyle, applyCompanionSkin, applyImageBacking, applyMathImageBacking, applyMathImageScale, applyMathRendering, applyMermaidDiagrams, applyPageMargin, applySidePanelOpen, applySidePanelPanels, applySidePanelRatio, applySidePanelSplitEnabled, ALL_SIDE_PANELS, BTW_CONTEXT_BUDGET_MAX, BTW_CONTEXT_BUDGET_MIN, BTW_CONTEXT_TURNS_MAX, BTW_CONTEXT_TURNS_MIN, DEFAULT_PAGE_MARGIN, DEFAULT_STATUS_BAR, isPageMarginMode, normalizeJobGroupFold, normalizePageMargin, normalizeScrollGutter, normalizeSidePanelPanels, normalizePluginFieldsOrder, normalizeStatusBar, normalizeToolBackground, parsePageMarginSpec, parsePluginFieldsOrder, parseSidePanelPanels, resolveMathRendering } from '../tuiDisplayPrefs.js';
62
64
  import { draftComboConflicts, effectiveComboString, parseComboDraft, setKeymapOverrides, SHORTCUT_ACTIONS, } from '../utils/keymap.js';
@@ -79,7 +81,8 @@ import { getHostThemes } from './themes.js';
79
81
  import { attachSessionToWorkspace } from './workspace.js';
80
82
  import { createLocalWorkspaceRuntime, getHostWorkspaceRuntime } from './workspaces.js';
81
83
  import { trackHostSettingsSection } from './settings-sections.js';
82
- import { compositionRoot, withHostRootCapability } from './host-access.js';
84
+ import { compositionRoot, outsideActivation, withHostRootCapability } from './host-access.js';
85
+ import { createRowAttachment } from './row-attachment.js';
83
86
  import { armAdmissionLoader } from './admission-loader.js';
84
87
  import { assembleBackendsFromProfile } from './backend-assembly.js';
85
88
  import { disposeRootSettled } from './root-dispose.js';
@@ -425,10 +428,17 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
425
428
  // pretending the update landed.
426
429
  {
427
430
  const updatedFrom = process.env.DSH_TUI_UPDATED_FROM;
428
- if (updatedFrom !== undefined) {
429
- // Assigning undefined would stringify to "undefined" and leak the
430
- // marker into every child process; remove it for real.
431
+ const updatedDshFrom = process.env.DSH_TUI_UPDATED_DSH_FROM;
432
+ const launcherAbsent = process.env.DSH_TUI_LAUNCHER_ABSENT !== undefined;
433
+ // Assigning undefined would stringify to "undefined" and leak the marker
434
+ // into every child process; remove them for real.
435
+ if (updatedFrom !== undefined)
431
436
  delete process.env.DSH_TUI_UPDATED_FROM;
437
+ if (updatedDshFrom !== undefined)
438
+ delete process.env.DSH_TUI_UPDATED_DSH_FROM;
439
+ if (launcherAbsent)
440
+ delete process.env.DSH_TUI_LAUNCHER_ABSENT;
441
+ if (updatedFrom !== undefined) {
432
442
  const now = installedTuiVersion();
433
443
  if (now === undefined || !isVersionNewer(now, updatedFrom)) {
434
444
  ctx.logger.warn(`dsh-tui: /update restarted but the version did not advance (still ${now ?? 'unknown'}, was ${updatedFrom})`);
@@ -437,21 +447,45 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
437
447
  `可能是镜像 registry 未同步,请稍后重试或检查 registry 配置。\n`);
438
448
  }
439
449
  }
440
- else if (process.stderr.isTTY) {
441
- // Launcher alignment bridge (0.8.3): /update only replaces the
442
- // package inside the DSH profile; a globally installed `dsh-tui`
443
- // launcher is a separate copy that keeps its old version. Launchers
444
- // >=0.8.3 export DSH_TUI_LAUNCHER_VERSION so we can tell whether
445
- // the outer launcher lags the freshly installed profile. Launchers
446
- // <=0.8.2 never set the marker — the generic branch below is
447
- // intentionally one-shot: DSH_TUI_UPDATED_FROM exists only on the
448
- // replacement process immediately after /update.
449
- const launcherVersion = process.env.DSH_TUI_LAUNCHER_VERSION;
450
- if (launcherVersion === undefined) {
451
- process.stderr.write(`\n[dsh-tui] ${t('update-launcher-align-unknown', { version: now })}\n`);
450
+ }
451
+ // Engine counterpart (#1844 §3.6): the engine step reports its own stamp,
452
+ // so a "TUI already latest, engine-only" update is checked against the
453
+ // engine instead of tripping the TUI version-advance warning above.
454
+ if (updatedDshFrom !== undefined) {
455
+ const engine = installedKernelVersion();
456
+ if (engine === undefined || !isVersionNewer(engine, updatedDshFrom)) {
457
+ ctx.logger.warn(`dsh-tui: /update restarted but the dsh engine did not advance (still ${engine ?? 'unknown'}, was ${updatedDshFrom})`);
458
+ if (process.stderr.isTTY) {
459
+ process.stderr.write(`\n${t('update-engine-not-advanced', {
460
+ now: engine ?? 'unknown',
461
+ from: updatedDshFrom,
462
+ command: 'dsh-tui update',
463
+ })}\n`);
452
464
  }
453
- else if (isVersionNewer(now, launcherVersion)) {
454
- process.stderr.write(`\n[dsh-tui] ${t('update-launcher-outdated', { profile: now, launcher: launcherVersion })}\n`);
465
+ }
466
+ }
467
+ if ((updatedFrom !== undefined || updatedDshFrom !== undefined) && process.stderr.isTTY) {
468
+ // Launcher alignment bridge (0.8.3): the profile copy was just
469
+ // replaced; a globally installed `dsh-tui` launcher is a separate copy
470
+ // that keeps its old version. Launchers >=0.8.3 export
471
+ // DSH_TUI_LAUNCHER_VERSION so we can tell whether the outer launcher
472
+ // lags the freshly installed profile. Both stamps exist only on the
473
+ // replacement process immediately after /update.
474
+ const launcherVersion = process.env.DSH_TUI_LAUNCHER_VERSION;
475
+ if (launcherVersion === undefined) {
476
+ // A `dsh --profile` boot has no launcher to align at all, and plan
477
+ // §3.5 asks for no warning there: the update that just ran resolved no
478
+ // launcher and left a one-shot marker. An engine-only update stays
479
+ // silent unless a launcher actually reported itself; a TUI-only update
480
+ // through an older shim (version marker, no path) still warns.
481
+ if (updatedFrom !== undefined && !launcherAbsent) {
482
+ process.stderr.write(`\n[dsh-tui] ${t('update-launcher-align-unknown', { version: installedTuiVersion() ?? 'unknown' })}\n`);
483
+ }
484
+ }
485
+ else {
486
+ const profileVersion = installedTuiVersion();
487
+ if (profileVersion !== undefined && isVersionNewer(profileVersion, launcherVersion)) {
488
+ process.stderr.write(`\n[dsh-tui] ${t('update-launcher-outdated', { profile: profileVersion, launcher: launcherVersion })}\n`);
455
489
  }
456
490
  }
457
491
  }
@@ -482,16 +516,20 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
482
516
  // The host-level tool mount above is intentional for the TUI and for user
483
517
  // presets, but the official Minimal preset is a single-tool trajectory (one
484
518
  // persistent shell: bash on POSIX, pwsh on Windows). Filter only that preset
485
- // at the final assembly boundary. Reading the session on every assembly also
519
+ // (plus create_worktree for liangshen, presets.ts) at the final assembly
520
+ // boundary. Reading the session on every assembly also
486
521
  // makes blank-session /preset switches and resumed sessions behave correctly.
487
522
  // Agent Teams is decided at the same boundary: presets keep their legacy
488
523
  // delegation rows, and a request that carries `spawn_teammate` drops
489
524
  // `subagent` / `subagent_fork` (team-mode.ts), so a team bundle switched
490
525
  // at run time reaches the sessions already running.
526
+ // 0.2.2 presentations have no tool declarations: tool-scope.ts owns those
527
+ // restrictions and these shape-based filters keep only the section half.
528
+ // Old hosts still carry tools here and must retain the same safety filters.
491
529
  dshCtx.on('system-prompt/assemble', async (_assembly, context, next) => {
492
- const assembled = filterTeamReplacedTools(await next());
530
+ const assembled = await next();
493
531
  const presetId = context.agent === undefined ? undefined : runningPresetOf(context.agent.session);
494
- return filterMinimalPresetTools(assembled, presetId);
532
+ return filterMinimalPresetTools(filterTeamReplacedTools(assembled), presetId);
495
533
  });
496
534
  // `/debug-prompt` snapshots the final provider-neutral request at the
497
535
  // llm/stream boundary, after every prompt and tool contributor has run.
@@ -2046,6 +2084,10 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2046
2084
  // The standalone entry has no `ctx.cmdlineArgs` (its argv is the app's); a
2047
2085
  // replacement keeps the arguments but the first process sent their prompt.
2048
2086
  const initialPrompt = launchPromptSent ? '' : initialPromptFromCmdlineArgs(cmdlineArgs ?? process.argv.slice(2));
2087
+ // The queue a /restart carried over: held, never auto-sent (heldInputs.ts).
2088
+ const stopHeldInputs = adoptHeldInputs(channel);
2089
+ if (stopHeldInputs !== undefined)
2090
+ ctx.effect(() => stopHeldInputs, 'dsh-tui held inputs after startup');
2049
2091
  if (initialPrompt) {
2050
2092
  // A placeholder session refuses sends and nothing replays them after
2051
2093
  // adoption: hold the prompt until the channel is ready.
@@ -2062,6 +2104,15 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2062
2104
  ctx.effect(() => unsubscribe, 'dsh-tui initial prompt after startup');
2063
2105
  }
2064
2106
  }
2107
+ // The /update that restarted into this process skipped the engine. Its own
2108
+ // screen was torn down in the same tick, so the guidance lands here, on the
2109
+ // mount that survives the boot recompose.
2110
+ if (!shadow) {
2111
+ ctx.effect(() => deliverEngineSkipReport(channel, skip => {
2112
+ channel.pushLocal(skip.title, skip.report.split('\n').map(line => line.trimEnd()), { lineLimit: 2000 });
2113
+ notifyChannel(skip.toast, { color: 'warning' });
2114
+ }), 'dsh-tui engine skip report after startup');
2115
+ }
2065
2116
  // Attach the stderr reporter to the live channel and flush anything a
2066
2117
  // startup-spawned server produced while the channel didn't exist yet.
2067
2118
  notifyStderr = (text, options) => notifyChannel(text, options);
@@ -2086,7 +2137,8 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2086
2137
  let instance;
2087
2138
  let exited = false;
2088
2139
  let updateRequested = false;
2089
- let updateTargetVersion;
2140
+ /** The preflight plan for /update (TUI + engine + launcher, #1844). */
2141
+ let updatePlan;
2090
2142
  // `/restart` flag: same exit funnel as `/update` minus the pnpm step —
2091
2143
  // write the resume target, restore the terminal, respawn the process with
2092
2144
  // the original argv, and let the fresh boot attach the same session.
@@ -2153,6 +2205,14 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2153
2205
  return;
2154
2206
  }
2155
2207
  if (updateRequested) {
2208
+ // The plan is assigned in the same onUpdate block that raises
2209
+ // `updateRequested`; capturing it keeps the narrowed type inside the
2210
+ // exit closure. Unreachable, but exiting non-zero beats hanging.
2211
+ const plan = updatePlan;
2212
+ if (plan === undefined) {
2213
+ void disposeRootAndExit(ctx, 1);
2214
+ return;
2215
+ }
2156
2216
  try {
2157
2217
  // Non-DSH sessions keep their marker in backend prefs, not DSH's `resume.txt`.
2158
2218
  if (backendStart === undefined) {
@@ -2172,7 +2232,7 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2172
2232
  const hintText = isStandaloneRuntime()
2173
2233
  ? t('update-standalone-starting')
2174
2234
  : t('update-starting');
2175
- void finishExit(ctx, instance, bootedFullscreen, hintText, undefined, () => runUpdate(ctx, profile, handoffSessionId(), updateTargetVersion, backendChoice, handoffHint, exitSeam));
2235
+ void finishExit(ctx, instance, bootedFullscreen, hintText, undefined, () => runUpdate(ctx, profile, handoffSessionId(), plan, backendChoice, handoffHint, exitSeam));
2176
2236
  return;
2177
2237
  }
2178
2238
  // The kernel selector's switch: the same respawn machinery, no resume.
@@ -2225,12 +2285,27 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2225
2285
  });
2226
2286
  }
2227
2287
  refreshLastRunRecord();
2288
+ // The queue dies with this process (the kernel records it canceled);
2289
+ // the replacement parks the same inputs, images included, as held
2290
+ // dock rows (#1651). Their bytes are read now, while the session's
2291
+ // attachment store is still up; the spawn waits for them.
2292
+ const held = collectHeldInputs(channel.pending, stageId => channel.stagedImage(stageId));
2228
2293
  void finishExit(ctx, instance, bootedFullscreen,
2229
2294
  // This line is the one the user actually sees before the terminal is
2230
2295
  // handed over (the composer's toast dies with the unmount): a
2231
- // mid-turn restart must say that the running turn and its queued
2232
- // input are dropped, not promise a clean resume.
2233
- t(channel.working ? 'restart-during-turn' : 'restart-starting'), undefined, () => runRestart(ctx, profile, handoffSessionId(), handoffHint, { kernel: backendChoice }, exitSeam));
2296
+ // mid-turn restart must say that the running turn is interrupted,
2297
+ // not promise a clean resume.
2298
+ t(channel.working ? 'restart-during-turn' : 'restart-starting'), undefined, () => {
2299
+ // A failed collection must still restart, without the carried
2300
+ // input: the alternative is a half-disposed process that never
2301
+ // spawns a replacement. The texts stay in the composer's own
2302
+ // history either way.
2303
+ // `then(onOk, onErr)`, not `.then(...).catch(...)`: the catch form
2304
+ // also swallows a synchronous throw from `runRestart`, which would
2305
+ // dispose the root a second time and race two replacements for the
2306
+ // same session mount.
2307
+ void held.then(inputs => { runRestart(ctx, profile, handoffSessionId(), handoffHint, { kernel: backendChoice, env: writeHeldInputs(inputs) }, exitSeam); }, () => { runRestart(ctx, profile, handoffSessionId(), handoffHint, { kernel: backendChoice }, exitSeam); });
2308
+ });
2234
2309
  return;
2235
2310
  }
2236
2311
  // Judge against the live session behind the channel (channel.agentId),
@@ -2516,42 +2591,71 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2516
2591
  onUpdate: profile === undefined ? undefined : () => {
2517
2592
  if (exited || updateRequested)
2518
2593
  return;
2519
- // Confirm the target version before tearing the TUI down: on an
2520
- // already-latest install, an unconditional update+restart would churn
2521
- // the process and then trip the "version did not advance" warning.
2522
- void resolveTuiUpdateTarget().then((target) => {
2594
+ // Resolve the WHOLE set before tearing the TUI down (#1844): the TUI
2595
+ // target, the engine version its peer range validates, and whether the
2596
+ // global launcher lags. An already-current TUI does NOT end the check —
2597
+ // the engine and launcher layers may still have work to do.
2598
+ void resolveUpdatePlan().then((plan) => {
2523
2599
  if (exited || updateRequested)
2524
2600
  return;
2525
- if (target.kind === 'latest') {
2526
- notifyChannel(t('update-already-latest', { current: target.current }), { color: 'warning' });
2601
+ const state = updatePlanState(plan);
2602
+ if (state === 'blocked') {
2603
+ // The composer toast is a single truncated row; the refusal promises
2604
+ // a manual repair command, so the complete text goes into a durable
2605
+ // transcript report and the toast stays a short pointer.
2606
+ const blocked = blockedUpdateMessages(plan);
2607
+ channel.pushLocal(blocked.title, blocked.report.split('\n').map(line => line.trimEnd()), { lineLimit: 2000 });
2608
+ notifyChannel(blocked.toast, { color: 'warning' });
2609
+ return;
2610
+ }
2611
+ if (state === 'empty') {
2612
+ notifyChannel(t('update-plan-empty', { layers: updatePlanSuite(plan) }));
2527
2613
  return;
2528
2614
  }
2529
- if (target.kind === 'unknown') {
2615
+ if (state === 'idle') {
2616
+ const report = idleReportMessages(plan);
2617
+ if (report !== undefined) {
2618
+ // The composer toast is one truncated row; either the engine cannot
2619
+ // be aligned automatically (with a computed repair command) or a
2620
+ // newer release is waiting for a TUI that declares it, so the whole
2621
+ // explanation goes into the durable transcript.
2622
+ channel.pushLocal(report.title, report.report.split('\n').map(line => line.trimEnd()), { lineLimit: 2000 });
2623
+ notifyChannel(report.toast, { color: 'warning' });
2624
+ return;
2625
+ }
2626
+ notifyChannel(t('update-plan-idle', {
2627
+ current: plan.tui.kind === 'latest' ? plan.tui.current : installedTuiVersion() ?? 'unknown',
2628
+ reason: describeLauncherStepReason(plan.launcher) ?? describeHostStepReason(plan.host),
2629
+ }), { color: 'warning' });
2630
+ return;
2631
+ }
2632
+ if (plan.tui.kind === 'unknown') {
2530
2633
  notifyChannel(t('update-check-failed'));
2531
2634
  }
2532
- else {
2635
+ else if (plan.tui.kind === 'update') {
2533
2636
  // 0.7.0/0.7.1 hard-inject tuiWorkspaces at the code level; under
2534
2637
  // an older global launcher patch (no service row) that is a
2535
2638
  // permanent boot deadlock (issues #183/#307, the exact report
2536
2639
  // "pending (waiting for service: tuiWorkspaces)"). A stale mirror
2537
2640
  // pinning /update onto that range must be refused, not installed.
2538
- if (isBootDeadlockTarget(target.latest)) {
2641
+ if (isBootDeadlockTarget(plan.tui.latest)) {
2539
2642
  notifyChannel(t('update-refused-deadlock', {
2540
- latest: target.latest,
2541
- authoritative: target.authoritative ?? target.latest,
2643
+ latest: plan.tui.latest,
2644
+ authoritative: plan.tui.authoritative ?? plan.tui.latest,
2542
2645
  }), { color: 'warning' });
2543
2646
  return;
2544
2647
  }
2545
- if (target.authoritative !== undefined) {
2546
- notifyChannel(t('update-mirror-lag', { latest: target.latest, authoritative: target.authoritative }));
2648
+ if (plan.tui.authoritative !== undefined) {
2649
+ notifyChannel(t('update-mirror-lag', { latest: plan.tui.latest, authoritative: plan.tui.authoritative }));
2547
2650
  }
2548
- updateTargetVersion = target.latest;
2549
2651
  }
2652
+ updatePlan = plan;
2550
2653
  if (isStandaloneRuntime()) {
2551
2654
  notifyChannel(t('update-standalone-starting'));
2552
2655
  }
2553
2656
  else {
2554
- notifyChannel(t('update-starting'));
2657
+ const layers = updatePlanLayers(plan);
2658
+ notifyChannel(layers.length === 0 ? t('update-starting') : t('update-plan-starting', { layers: layers.join(' · ') }));
2555
2659
  }
2556
2660
  updateRequested = true;
2557
2661
  handleExit();
@@ -2741,6 +2845,36 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2741
2845
  catch {
2742
2846
  }
2743
2847
  };
2848
+ // The row's seams (presets, ask_user, approvals, the assembly filters)
2849
+ // live on the row and unload with it: a row that comes back mounts them again.
2850
+ const rowAttachment = createRowAttachment({
2851
+ closed: () => compositionFailed || exited,
2852
+ ready: () => channel.ready,
2853
+ mountSeams: async (dshCtx) => {
2854
+ await installPresets(dshCtx);
2855
+ const seams = mountDshQuestionSeams(dshCtx);
2856
+ if (seams.notice !== undefined)
2857
+ notifyChannel(seams.notice, { color: 'error' });
2858
+ if (seams.registration.kind === 'waterfall')
2859
+ seams.registration.register(channel);
2860
+ mountDshApprovals(dshCtx);
2861
+ refreshHostServices();
2862
+ },
2863
+ readConfig: (rowRuntimeConfig) => { rowFacts.config = configValues(rowRuntimeConfig); },
2864
+ ended: () => channel.status === 'disposed',
2865
+ // The resume path reopens the session on the entry's own context, so
2866
+ // a later unload of the row can no longer take the agent along. It
2867
+ // runs as the entry's action: the row's activation only triggered it.
2868
+ reopen: async () => {
2869
+ const result = await outsideActivation(() => channel.resumeTo(channel.sessionId));
2870
+ if (result.ok)
2871
+ notifyChannel(t('session-reattached'));
2872
+ },
2873
+ failed: (error) => {
2874
+ logForDebugging(`dsh-tui: reopening the session after its row came back failed (${error instanceof Error ? error.message : String(error)})`);
2875
+ },
2876
+ });
2877
+ entrySlot.reattachDsh = rowAttachment.reattach;
2744
2878
  entrySlot.attachDsh = async (rowCtx, rowRuntimeConfig) => {
2745
2879
  const dshCtx = rowCtx;
2746
2880
  // The composition failed (its row is on screen), or the process is
@@ -2750,14 +2884,7 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2750
2884
  try {
2751
2885
  const rowConfig = configValues(rowRuntimeConfig);
2752
2886
  rowFacts.config = rowConfig;
2753
- await installPresets(dshCtx);
2754
- const seams = mountDshQuestionSeams(dshCtx);
2755
- if (seams.notice !== undefined)
2756
- notifyChannel(seams.notice, { color: 'error' });
2757
- if (seams.registration.kind === 'waterfall')
2758
- seams.registration.register(channel);
2759
- mountDshApprovals(dshCtx);
2760
- refreshHostServices();
2887
+ await rowAttachment.mount(dshCtx);
2761
2888
  const rowRoute = { provider: rowConfig.provider, model: rowConfig.model };
2762
2889
  // The same startup/deployment split the plugin's own boot makes (issue #67).
2763
2890
  const { startupRoute: rowStartupRoute, deploymentRoute: rowDeploymentRoute } = startupRoutes(dshCtx, rowRoute);
@@ -2774,7 +2901,7 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2774
2901
  const created = await openOnRow(undefined, { cwd });
2775
2902
  await takeOpened(created);
2776
2903
  refreshLastRunRecord();
2777
- return createDshSession(dshCtx, { agent: created.agent, handle: created.handle });
2904
+ return createDshSession(dshCtx, { agent: created.agent, handle: created.handle }, { screenOutlivesContext: true });
2778
2905
  };
2779
2906
  // The entry mounted on rebuilt defaults: the row's own `workspace` /
2780
2907
  // `cwd` decide the session directory, with `apply`'s precedence. A
@@ -2798,7 +2925,7 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
2798
2925
  ? undefined
2799
2926
  : rowConfig.sessionId ?? resumeTargetFromArgv(cmdlineArgsOf(dshCtx) ?? process.argv.slice(2));
2800
2927
  const opened = await openOnRow(rowSessionId, startupMeta);
2801
- const session = createDshSession(dshCtx, { agent: opened.agent, handle: opened.handle });
2928
+ const session = createDshSession(dshCtx, { agent: opened.agent, handle: opened.handle }, { screenOutlivesContext: true });
2802
2929
  // The composition failed while this opened: close the unadoptable session.
2803
2930
  if (compositionFailed) {
2804
2931
  await session.dispose().catch(() => undefined);
@@ -3357,8 +3484,18 @@ function runRestart(ctx, profile, sessionId, hint = id => resumeCommand(profile,
3357
3484
  // abort). Spawning the replacement then would race this process for the
3358
3485
  // session mount, so the only honest answer is the resume hint the user can
3359
3486
  // run after this process is gone.
3487
+ // Held texts no replacement took (a stall, a failed spawn) stay on disk for
3488
+ // the resume command, which names their file; without a session to resume
3489
+ // they go. A replacement that ran took them already.
3490
+ const dropHeldInputs = () => { takeHeldInputs({ ...options.env }); };
3491
+ const resumeLine = (id) => heldInputsResumeCommand(hint(id), options.env);
3492
+ const ended = () => {
3493
+ if (sessionId === '')
3494
+ dropHeldInputs();
3495
+ return preservedSessionTail(sessionId, resumeLine);
3496
+ };
3360
3497
  const stalled = () => {
3361
- writeHandoffNotice(`\ndsh-tui restart timed out while stopping the current turn.${preservedSessionTail(sessionId, hint)}`);
3498
+ writeHandoffNotice(`\ndsh-tui restart timed out while stopping the current turn.${ended()}`);
3362
3499
  process.exit(1);
3363
3500
  };
3364
3501
  disposeRootAndThen(ctx, () => {
@@ -3375,21 +3512,29 @@ function runRestart(ctx, profile, sessionId, hint = id => resumeCommand(profile,
3375
3512
  void restartTui(sessionId, supervision).then(restartCode => {
3376
3513
  logRestartEvent('runRestart: restartTui resolved', { restartCode });
3377
3514
  if (restartCode !== 0) {
3378
- writeHandoffNotice(`\ndsh-tui restart failed to spawn (exit ${restartCode}).${preservedSessionTail(sessionId, hint)}`);
3515
+ writeHandoffNotice(`\ndsh-tui restart failed to spawn (exit ${restartCode}).${ended()}`);
3516
+ }
3517
+ else {
3518
+ dropHeldInputs();
3379
3519
  }
3380
3520
  process.exit(restartCode);
3381
3521
  }, restartError => {
3382
3522
  const message = restartError instanceof Error ? restartError.message : String(restartError);
3383
3523
  logRestartEvent('runRestart: restartTui rejected', { message });
3384
- writeHandoffNotice(`\ndsh-tui restart failed: ${message}.${preservedSessionTail(sessionId, hint)}`);
3524
+ writeHandoffNotice(`\ndsh-tui restart failed: ${message}.${ended()}`);
3385
3525
  process.exit(1);
3386
3526
  });
3387
3527
  }, stalled);
3388
3528
  }
3389
- function runUpdate(ctx, profile, sessionId, targetVersion, kernel, hint = id => resumeCommand(profile, id), exitSeam) {
3529
+ function runUpdate(ctx, profile, sessionId, plan, kernel, hint = id => resumeCommand(profile, id), exitSeam) {
3390
3530
  const recovery = preservedSessionTail(sessionId, hint);
3391
3531
  disposeRootAndThen(ctx, () => {
3392
- logRestartEvent('update: starting', { profile, targetVersion });
3532
+ logRestartEvent('update: starting', {
3533
+ profile,
3534
+ tui: plan.tui.kind === 'update' ? `${plan.tui.current}->${plan.tui.latest}` : plan.tui.kind,
3535
+ host: plan.host.kind === 'install' ? `${plan.host.from ?? '?'}->${plan.host.to}` : plan.host.kind,
3536
+ launcher: plan.launcher.kind,
3537
+ });
3393
3538
  writeHandoffNotice(`\ndsh-tui: installation starts. Check/repair an interrupted installation before resuming.${recovery}`);
3394
3539
  if (profile === undefined) {
3395
3540
  writeHandoffNotice(`\n${t('update-aborted-no-profile')}${recovery}`);
@@ -3411,7 +3556,7 @@ function runUpdate(ctx, profile, sessionId, targetVersion, kernel, hint = id =>
3411
3556
  exitSeam.request = replacementRequest;
3412
3557
  onSpawn?.(child);
3413
3558
  };
3414
- void updateTuiAndRestart(sessionId, profile, targetVersion, kernel, supervision, cancellation.signal).then(({ updateCode, restartCode }) => {
3559
+ void updateTuiAndRestart(sessionId, profile, plan, kernel, supervision, cancellation.signal).then(({ updateCode, restartCode }) => {
3415
3560
  logRestartEvent('update: finished', { updateCode, restartCode });
3416
3561
  if (updateCode !== 0) {
3417
3562
  writeHandoffNotice(`\ndsh-tui update failed (exit ${updateCode}). Check/repair the installation before resuming.${preservedSessionTail(sessionId, hint)}`);
@@ -76,18 +76,17 @@ export interface PluginFootprintOverrides {
76
76
  * storage namespaces ('host'/'undeclared' ledger identities are not
77
77
  * plugins and are excluded). */
78
78
  export declare function pluginFootprints(paths: PluginFootprintPaths): string[];
79
+ /** Which of the three sources still names one plugin id. */
80
+ export declare function pluginFootprintSourcesOf(pluginId: string, overrides?: PluginFootprintOverrides): {
81
+ readonly grants: boolean;
82
+ readonly ledger: boolean;
83
+ readonly storage: boolean;
84
+ };
79
85
  /**
80
86
  * The three footprint sources, resolved the way the diagnostics resolve them
81
87
  * (test overrides first, else the packaged locations under `~/.dsh-tui`).
82
88
  */
83
89
  export declare function pluginFootprintPaths(overrides?: PluginFootprintOverrides): PluginFootprintPaths;
84
- /**
85
- * Whether one plugin id still has a footprint in this profile: a grants-file
86
- * key, an effect-ledger record, or a storage namespace. The same three sources
87
- * the matrix unions — a removal that left something behind is read here rather
88
- * than by a second reader that could disagree with the report (C-5).
89
- */
90
- export declare function pluginFootprintContains(pluginId: string, overrides?: PluginFootprintOverrides): boolean;
91
90
  /** Which form of the command the raw argument text asks for. */
92
91
  export type PluginArgs = {
93
92
  readonly kind: 'overview';
@@ -1 +1 @@
1
- {"version":3,"file":"plugins-info.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/plugins-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAYH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAC5E,OAAO,EAA2C,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAEnI,OAAO,EAAqC,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,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACrC,OAAO,CAAC,MAAM,EAAE,CAAC,CAEnB"}
@@ -136,11 +136,16 @@ function readLedgerRecords(file) {
136
136
  }
137
137
  return records;
138
138
  }
139
- /** The plugin set for the matrix: grants-file keys ∪ ledger pluginIds ∪
140
- * storage namespaces ('host'/'undeclared' ledger identities are not
141
- * plugins and are excluded). */
142
- export function pluginFootprints(paths) {
143
- const found = new Set();
139
+ /**
140
+ * Read the three sources once. {@link pluginFootprints} and
141
+ * {@link pluginFootprintSourcesOf} both go through this, so the matrix, the
142
+ * "is anything left" check and the per-source residue report cannot disagree
143
+ * about what counts as a footprint.
144
+ */
145
+ function pluginFootprintSourceSets(paths) {
146
+ const grants = new Set();
147
+ const ledger = new Set();
148
+ const storage = new Set();
144
149
  try {
145
150
  const raw = JSON.parse(readFileSync(join(paths.dataDir, 'extension-grants.json'), 'utf8'));
146
151
  if (raw !== null && typeof raw === 'object') {
@@ -148,7 +153,7 @@ export function pluginFootprints(paths) {
148
153
  for (const section of [table.grants, table.denies]) {
149
154
  if (section !== null && typeof section === 'object') {
150
155
  for (const plugin of Object.keys(section))
151
- found.add(plugin);
156
+ grants.add(plugin);
152
157
  }
153
158
  }
154
159
  }
@@ -159,7 +164,7 @@ export function pluginFootprints(paths) {
159
164
  }
160
165
  for (const record of readLedgerRecords(paths.ledgerFile)) {
161
166
  if (typeof record.pluginId === 'string' && record.pluginId !== '' && record.pluginId !== 'host' && record.pluginId !== 'undeclared') {
162
- found.add(record.pluginId);
167
+ ledger.add(record.pluginId);
163
168
  }
164
169
  }
165
170
  try {
@@ -168,13 +173,29 @@ export function pluginFootprints(paths) {
168
173
  continue;
169
174
  const namespace = decodeURIComponent(entry.slice(0, -'.json'.length));
170
175
  if (namespace !== '')
171
- found.add(namespace);
176
+ storage.add(namespace);
172
177
  }
173
178
  }
174
179
  catch {
175
180
  // No storage directory yet: no rows from this source.
176
181
  }
177
- return [...found].sort();
182
+ return { grants, ledger, storage };
183
+ }
184
+ /** The plugin set for the matrix: grants-file keys ∪ ledger pluginIds ∪
185
+ * storage namespaces ('host'/'undeclared' ledger identities are not
186
+ * plugins and are excluded). */
187
+ export function pluginFootprints(paths) {
188
+ const sources = pluginFootprintSourceSets(paths);
189
+ return [...new Set([...sources.grants, ...sources.ledger, ...sources.storage])].sort();
190
+ }
191
+ /** Which of the three sources still names one plugin id. */
192
+ export function pluginFootprintSourcesOf(pluginId, overrides = {}) {
193
+ const sources = pluginFootprintSourceSets(pluginFootprintPaths(overrides));
194
+ return {
195
+ grants: sources.grants.has(pluginId),
196
+ ledger: sources.ledger.has(pluginId),
197
+ storage: sources.storage.has(pluginId),
198
+ };
178
199
  }
179
200
  /**
180
201
  * The three footprint sources, resolved the way the diagnostics resolve them
@@ -188,15 +209,6 @@ export function pluginFootprintPaths(overrides = {}) {
188
209
  storageDir: overrides.storageDir ?? join(dataDir, PLUGIN_STORAGE_DIR),
189
210
  };
190
211
  }
191
- /**
192
- * Whether one plugin id still has a footprint in this profile: a grants-file
193
- * key, an effect-ledger record, or a storage namespace. The same three sources
194
- * the matrix unions — a removal that left something behind is read here rather
195
- * than by a second reader that could disagree with the report (C-5).
196
- */
197
- export function pluginFootprintContains(pluginId, overrides = {}) {
198
- return pluginFootprints(pluginFootprintPaths(overrides)).includes(pluginId);
199
- }
200
212
  /** `/plugin check <path>`: official parse/projection + profile validation + negotiation. */
201
213
  function checkManifestLines(pathArg, deps) {
202
214
  const lines = [];
@@ -261,9 +273,10 @@ function checkManifestLines(pathArg, deps) {
261
273
  const decision = negotiate(index, manifest, host.descriptor, granted);
262
274
  lines.push(...decisionLines(decision));
263
275
  if (decision.decision === 'waiting_authorization') {
264
- // Close the loop on the five-state vocabulary: the user sees not just
265
- // the state but the exact file + shape that flips it (the interactive
266
- // grant flow is future work; this hint is its no-UI prerequisite).
276
+ // Close the loop on the five-state vocabulary: the user sees not just the
277
+ // state but the exact file + shape that flips it. `/plugin install` and
278
+ // `/plugin enable` are the interactive grant path; this hint stays for the
279
+ // static `check <path>` route, which may run with no live service.
267
280
  lines.push(t('plugins-check-grant-hint', {
268
281
  id: cell(manifest.id),
269
282
  perms: cell(decision.deniedPermissions.join(', ')),