@deepseek-harness-tui/dsh-tui 0.16.0 → 0.17.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 (401) hide show
  1. package/README.md +214 -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/claude-backend.en.md +8 -0
  20. package/guide/dsh-tui-guide/claude-backend.md +5 -0
  21. package/guide/dsh-tui-guide/cli.en.md +114 -0
  22. package/guide/dsh-tui-guide/cli.md +114 -0
  23. package/guide/dsh-tui-guide/configuration.en.md +6 -5
  24. package/guide/dsh-tui-guide/configuration.md +6 -5
  25. package/guide/dsh-tui-guide/getting-started.en.md +44 -10
  26. package/guide/dsh-tui-guide/getting-started.md +31 -9
  27. package/guide/dsh-tui-guide/interaction.en.md +22 -10
  28. package/guide/dsh-tui-guide/interaction.md +18 -8
  29. package/guide/dsh-tui-guide/plugins.en.md +35 -4
  30. package/guide/dsh-tui-guide/plugins.md +23 -2
  31. package/guide/dsh-tui-guide/user-guide.en.md +30 -23
  32. package/guide/dsh-tui-guide/user-guide.md +29 -22
  33. package/lib/settings.json +83 -40
  34. package/lib/types/adapter/channel/plugins.d.ts.map +1 -1
  35. package/lib/types/adapter/channel/plugins.js +8 -0
  36. package/lib/types/adapter/channel/ui-policy.d.ts +1 -1
  37. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  38. package/lib/types/adapter/channel/ui-policy.js +3 -0
  39. package/lib/types/adapter/ports/channel-display.d.ts +10 -0
  40. package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
  41. package/lib/types/adapter/ports/channel-session.d.ts +2 -0
  42. package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
  43. package/lib/types/adapter/ports/channel-settings.d.ts +20 -0
  44. package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
  45. package/lib/types/adapter/ports/channel-ui.d.ts +17 -2
  46. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  47. package/lib/types/adapter/ports/channel-view.d.ts +8 -1
  48. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  49. package/lib/types/adapter/ports/channel.d.ts +7 -0
  50. package/lib/types/adapter/ports/channel.d.ts.map +1 -1
  51. package/lib/types/agent/capabilities.d.ts +2 -0
  52. package/lib/types/agent/capabilities.d.ts.map +1 -1
  53. package/lib/types/agent/events.d.ts +8 -0
  54. package/lib/types/agent/events.d.ts.map +1 -1
  55. package/lib/types/api.d.ts +2 -2
  56. package/lib/types/api.d.ts.map +1 -1
  57. package/lib/types/backends/claude/translate/events.d.ts.map +1 -1
  58. package/lib/types/backends/claude/translate/events.js +2 -1
  59. package/lib/types/backends/codex/auth/status.js +1 -1
  60. package/lib/types/backends/codex/session/controls.d.ts.map +1 -1
  61. package/lib/types/backends/codex/session/controls.js +6 -5
  62. package/lib/types/backends/codex/session/goals.d.ts.map +1 -1
  63. package/lib/types/backends/codex/session/side-query.d.ts.map +1 -1
  64. package/lib/types/backends/codex/translate/events.d.ts.map +1 -1
  65. package/lib/types/backends/codex/translate/events.js +3 -1
  66. package/lib/types/backends/shared/channel-tokens.d.ts.map +1 -1
  67. package/lib/types/backends/shared/channel-tokens.js +9 -8
  68. package/lib/types/channel/history-restore.d.ts.map +1 -1
  69. package/lib/types/channel/history-restore.js +2 -0
  70. package/lib/types/channel/interaction.d.ts.map +1 -1
  71. package/lib/types/channel/interaction.js +1 -0
  72. package/lib/types/channel/projection.d.ts +1 -1
  73. package/lib/types/channel/projection.d.ts.map +1 -1
  74. package/lib/types/channel/projection.js +19 -4
  75. package/lib/types/channel/questions.d.ts +2 -0
  76. package/lib/types/channel/questions.d.ts.map +1 -1
  77. package/lib/types/channel/sanitize.d.ts +14 -0
  78. package/lib/types/channel/sanitize.d.ts.map +1 -1
  79. package/lib/types/channel/sanitize.js +55 -0
  80. package/lib/types/channel/working-directory.d.ts +9 -0
  81. package/lib/types/channel/working-directory.d.ts.map +1 -0
  82. package/lib/types/channel/working-directory.js +7 -0
  83. package/lib/types/commands.d.ts +8 -1
  84. package/lib/types/commands.d.ts.map +1 -1
  85. package/lib/types/commands.js +13 -4
  86. package/lib/types/components/ChatTitle.d.ts +7 -0
  87. package/lib/types/components/ChatTitle.d.ts.map +1 -0
  88. package/lib/types/components/ChatTitle.js +15 -0
  89. package/lib/types/components/CodeBlockFrame.d.ts.map +1 -1
  90. package/lib/types/components/CodeBlockFrame.js +10 -5
  91. package/lib/types/components/CompactionStatusRow.d.ts.map +1 -1
  92. package/lib/types/components/CompactionStatusRow.js +24 -3
  93. package/lib/types/components/GoalTodoPanel.d.ts +3 -1
  94. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  95. package/lib/types/components/GoalTodoPanel.js +2 -2
  96. package/lib/types/components/Markdown.d.ts +9 -1
  97. package/lib/types/components/Markdown.d.ts.map +1 -1
  98. package/lib/types/components/Markdown.js +5 -4
  99. package/lib/types/components/MessageList.d.ts.map +1 -1
  100. package/lib/types/components/MessageList.js +17 -12
  101. package/lib/types/components/PromptInput.d.ts +13 -5
  102. package/lib/types/components/PromptInput.d.ts.map +1 -1
  103. package/lib/types/components/PromptInput.js +189 -107
  104. package/lib/types/components/SplitDiffView.d.ts.map +1 -1
  105. package/lib/types/components/SplitDiffView.js +232 -22
  106. package/lib/types/components/SubagentDetailScene.d.ts +3 -1
  107. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  108. package/lib/types/components/SubagentDetailScene.js +5 -1
  109. package/lib/types/components/Whale.d.ts.map +1 -1
  110. package/lib/types/components/Whale.js +8 -5
  111. package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
  112. package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
  113. package/lib/types/components/approvals/ApprovalPanel.js +93 -11
  114. package/lib/types/components/bigfont.d.ts.map +1 -1
  115. package/lib/types/components/bigfont.js +2 -1
  116. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  117. package/lib/types/components/messages/AssistantToolUseMessage.js +13 -6
  118. package/lib/types/components/previewRows.d.ts +19 -0
  119. package/lib/types/components/previewRows.d.ts.map +1 -0
  120. package/lib/types/components/previewRows.js +46 -0
  121. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  122. package/lib/types/components/questions/AskUserQuestionPanel.js +75 -10
  123. package/lib/types/components/sessions/ForeignSessionRow.d.ts +3 -9
  124. package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -1
  125. package/lib/types/components/sessions/ForeignSessionRow.js +6 -10
  126. package/lib/types/components/sessions/SessionListRow.d.ts +4 -9
  127. package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
  128. package/lib/types/components/sessions/SessionListRow.js +18 -10
  129. package/lib/types/components/sidePanel/InfoPanel.d.ts.map +1 -1
  130. package/lib/types/components/sidePanel/InfoPanel.js +4 -3
  131. package/lib/types/components/sidePanel/SidePanelLayout.d.ts.map +1 -1
  132. package/lib/types/components/sidePanel/SidePanelLayout.js +5 -5
  133. package/lib/types/components/sidePanel/WorkspacePanel.d.ts.map +1 -1
  134. package/lib/types/components/sidePanel/WorkspacePanel.js +19 -7
  135. package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
  136. package/lib/types/components/sidePanel/builtinPanels.js +22 -16
  137. package/lib/types/components/sidePanel/companion/CompanionPanel.d.ts.map +1 -1
  138. package/lib/types/components/sidePanel/companion/CompanionPanel.js +2 -1
  139. package/lib/types/components/sidePanel/panelMarkdown.d.ts +32 -0
  140. package/lib/types/components/sidePanel/panelMarkdown.d.ts.map +1 -0
  141. package/lib/types/components/sidePanel/panelMarkdown.js +45 -0
  142. package/lib/types/components/sidePanel/pluginPanelAdapter.d.ts.map +1 -1
  143. package/lib/types/components/sidePanel/pluginPanelAdapter.js +6 -1
  144. package/lib/types/components/sidePanel/subagentFailureRead.d.ts +21 -0
  145. package/lib/types/components/sidePanel/subagentFailureRead.d.ts.map +1 -0
  146. package/lib/types/components/sidePanel/subagentFailureRead.js +66 -0
  147. package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
  148. package/lib/types/components/sidePanel/useSidePanel.js +24 -6
  149. package/lib/types/components/trajectory/MiniWake.d.ts +2 -2
  150. package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
  151. package/lib/types/components/trajectory/MiniWake.js +7 -3
  152. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
  153. package/lib/types/components/workspaces/HomeWorkspaceRow.js +4 -7
  154. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  155. package/lib/types/dsh-adapter/backend/translate.js +11 -1
  156. package/lib/types/dsh-adapter/backend-admission.d.ts +3 -3
  157. package/lib/types/dsh-adapter/channel/binding-events.d.ts +5 -1
  158. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  159. package/lib/types/dsh-adapter/channel/binding-events.js +18 -1
  160. package/lib/types/dsh-adapter/channel/command-completions.d.ts.map +1 -1
  161. package/lib/types/dsh-adapter/channel/command-completions.js +6 -8
  162. package/lib/types/dsh-adapter/channel/composer-images.d.ts +9 -1
  163. package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
  164. package/lib/types/dsh-adapter/channel/composer-images.js +111 -111
  165. package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
  166. package/lib/types/dsh-adapter/channel/composer-mentions.js +16 -10
  167. package/lib/types/dsh-adapter/channel/core/actions.d.ts +1 -1
  168. package/lib/types/dsh-adapter/channel/core/actions.d.ts.map +1 -1
  169. package/lib/types/dsh-adapter/channel/core/actions.js +23 -2
  170. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +4 -1
  171. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
  172. package/lib/types/dsh-adapter/channel/core/binding-feed.js +13 -2
  173. package/lib/types/dsh-adapter/channel/core/compose.d.ts +4 -1
  174. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  175. package/lib/types/dsh-adapter/channel/core/compose.js +2 -0
  176. package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
  177. package/lib/types/dsh-adapter/channel/core/files.js +2 -1
  178. package/lib/types/dsh-adapter/channel/core/host.d.ts +14 -10
  179. package/lib/types/dsh-adapter/channel/core/host.d.ts.map +1 -1
  180. package/lib/types/dsh-adapter/channel/core/host.js +192 -13
  181. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts +1 -0
  182. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
  183. package/lib/types/dsh-adapter/channel/core/local-actions.js +32 -3
  184. package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
  185. package/lib/types/dsh-adapter/channel/extensions.js +31 -5
  186. package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
  187. package/lib/types/dsh-adapter/channel/input-actions.js +4 -0
  188. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +4 -1
  189. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  190. package/lib/types/dsh-adapter/channel/input-delivery.js +24 -1
  191. package/lib/types/dsh-adapter/channel/model-actions.d.ts +1 -1
  192. package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
  193. package/lib/types/dsh-adapter/channel/model-actions.js +7 -1
  194. package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
  195. package/lib/types/dsh-adapter/channel/model-selection.js +6 -4
  196. package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
  197. package/lib/types/dsh-adapter/channel/session-fork.js +1 -0
  198. package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
  199. package/lib/types/dsh-adapter/channel/session-metadata.js +15 -2
  200. package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
  201. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  202. package/lib/types/dsh-adapter/channel/session-reset.js +4 -0
  203. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  204. package/lib/types/dsh-adapter/channel/session-resume.js +46 -33
  205. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  206. package/lib/types/dsh-adapter/channel/settings-host.js +10 -3
  207. package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
  208. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  209. package/lib/types/dsh-adapter/channel/state.js +2 -2
  210. package/lib/types/dsh-adapter/channel/types.d.ts +13 -1
  211. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  212. package/lib/types/dsh-adapter/compat/liveSession.d.ts +3 -3
  213. package/lib/types/dsh-adapter/compat/liveSession.js +3 -3
  214. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +1 -1
  215. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
  216. package/lib/types/dsh-adapter/compat/sessionLog.js +17 -1
  217. package/lib/types/dsh-adapter/contract.d.ts +6 -5
  218. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  219. package/lib/types/dsh-adapter/contract.js +7 -5
  220. package/lib/types/dsh-adapter/effect-ledger.d.ts +1 -1
  221. package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -1
  222. package/lib/types/dsh-adapter/effect-ledger.js +1 -0
  223. package/lib/types/dsh-adapter/experimental-bundles.d.ts +26 -0
  224. package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -0
  225. package/lib/types/dsh-adapter/experimental-bundles.js +11 -0
  226. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
  227. package/lib/types/dsh-adapter/host-access.js +4 -0
  228. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  229. package/lib/types/dsh-adapter/host-contract.js +2 -2
  230. package/lib/types/dsh-adapter/host-dsh.js +3 -3
  231. package/lib/types/dsh-adapter/host-entry.js +5 -3
  232. package/lib/types/dsh-adapter/index.d.ts +8 -4
  233. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  234. package/lib/types/dsh-adapter/index.js +9 -7
  235. package/lib/types/dsh-adapter/install/pnpm-profile-add.d.ts.map +1 -1
  236. package/lib/types/dsh-adapter/install/pnpm-profile-add.js +9 -3
  237. package/lib/types/dsh-adapter/panels.d.ts +21 -7
  238. package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
  239. package/lib/types/dsh-adapter/panels.js +11 -56
  240. package/lib/types/dsh-adapter/plugin.d.ts +81 -0
  241. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  242. package/lib/types/dsh-adapter/plugin.js +318 -70
  243. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
  244. package/lib/types/dsh-adapter/plugins-info.js +65 -10
  245. package/lib/types/dsh-adapter/presets.d.ts +15 -6
  246. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  247. package/lib/types/dsh-adapter/presets.js +51 -12
  248. package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
  249. package/lib/types/dsh-adapter/process-exit.js +1 -1
  250. package/lib/types/dsh-adapter/session-tools.d.ts +34 -0
  251. package/lib/types/dsh-adapter/session-tools.d.ts.map +1 -0
  252. package/lib/types/dsh-adapter/session-tools.js +39 -0
  253. package/lib/types/dsh-adapter/settings-sections.d.ts +18 -1
  254. package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
  255. package/lib/types/dsh-adapter/settings-sections.js +73 -0
  256. package/lib/types/dsh-adapter/status.d.ts +88 -1
  257. package/lib/types/dsh-adapter/status.d.ts.map +1 -1
  258. package/lib/types/dsh-adapter/status.js +318 -3
  259. package/lib/types/dsh-adapter/team-mode.d.ts +42 -33
  260. package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
  261. package/lib/types/dsh-adapter/team-mode.js +76 -112
  262. package/lib/types/extensions.d.ts +1 -1
  263. package/lib/types/extensions.d.ts.map +1 -1
  264. package/lib/types/force-production-react.js +3 -3
  265. package/lib/types/i18n.d.ts +195 -52
  266. package/lib/types/i18n.d.ts.map +1 -1
  267. package/lib/types/i18n.js +96 -30
  268. package/lib/types/ink/colorize.d.ts +7 -1
  269. package/lib/types/ink/colorize.d.ts.map +1 -1
  270. package/lib/types/ink/colorize.js +29 -8
  271. package/lib/types/ink/components/App.d.ts +2 -1
  272. package/lib/types/ink/components/App.d.ts.map +1 -1
  273. package/lib/types/ink/components/App.js +10 -3
  274. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
  275. package/lib/types/ink/components/ScrollBox.js +1 -0
  276. package/lib/types/ink/dom.d.ts +1 -0
  277. package/lib/types/ink/dom.d.ts.map +1 -1
  278. package/lib/types/ink/hooks/use-program-status.d.ts +78 -0
  279. package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -0
  280. package/lib/types/ink/hooks/use-program-status.js +96 -0
  281. package/lib/types/ink/ink.d.ts +13 -4
  282. package/lib/types/ink/ink.d.ts.map +1 -1
  283. package/lib/types/ink/ink.js +119 -25
  284. package/lib/types/ink/output.d.ts +17 -2
  285. package/lib/types/ink/output.d.ts.map +1 -1
  286. package/lib/types/ink/output.js +85 -2
  287. package/lib/types/ink/parse-keypress.d.ts +1 -0
  288. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  289. package/lib/types/ink/parse-keypress.js +5 -4
  290. package/lib/types/ink/render-node-to-output.d.ts +2 -0
  291. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  292. package/lib/types/ink/render-node-to-output.js +79 -10
  293. package/lib/types/ink/root.d.ts +8 -0
  294. package/lib/types/ink/root.d.ts.map +1 -1
  295. package/lib/types/ink/root.js +12 -3
  296. package/lib/types/ink/screen.d.ts +11 -0
  297. package/lib/types/ink/screen.d.ts.map +1 -1
  298. package/lib/types/ink/screen.js +44 -0
  299. package/lib/types/ink/selection.d.ts +7 -2
  300. package/lib/types/ink/selection.d.ts.map +1 -1
  301. package/lib/types/ink/selection.js +187 -44
  302. package/lib/types/ink/shutdown-input.d.ts +15 -0
  303. package/lib/types/ink/shutdown-input.d.ts.map +1 -0
  304. package/lib/types/ink/shutdown-input.js +28 -0
  305. package/lib/types/ink/sixel-cursor-heal.d.ts +21 -0
  306. package/lib/types/ink/sixel-cursor-heal.d.ts.map +1 -0
  307. package/lib/types/ink/sixel-cursor-heal.js +62 -0
  308. package/lib/types/ink/sixel-graphics.d.ts +6 -0
  309. package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
  310. package/lib/types/ink/sixel-graphics.js +18 -0
  311. package/lib/types/ink/styles.d.ts +8 -1
  312. package/lib/types/ink/styles.d.ts.map +1 -1
  313. package/lib/types/ink/terminal-notification-windows.d.ts +195 -0
  314. package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -0
  315. package/lib/types/ink/terminal-notification-windows.js +433 -0
  316. package/lib/types/ink/terminal-notification.d.ts +3 -1
  317. package/lib/types/ink/terminal-notification.d.ts.map +1 -1
  318. package/lib/types/ink/terminal-notification.js +4 -1
  319. package/lib/types/ink/terminal-querier.d.ts +9 -1
  320. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  321. package/lib/types/ink/terminal-querier.js +32 -1
  322. package/lib/types/ink/terminal.d.ts +23 -2
  323. package/lib/types/ink/terminal.d.ts.map +1 -1
  324. package/lib/types/ink/terminal.js +32 -2
  325. package/lib/types/ink/termio/osc.d.ts +2 -1
  326. package/lib/types/ink/termio/osc.d.ts.map +1 -1
  327. package/lib/types/ink/termio/osc.js +37 -8
  328. package/lib/types/ink/termio/osc7501.d.ts +102 -0
  329. package/lib/types/ink/termio/osc7501.d.ts.map +1 -0
  330. package/lib/types/ink/termio/osc7501.js +229 -0
  331. package/lib/types/ink/termio/tokenize.js +5 -7
  332. package/lib/types/panels.d.ts +1 -1
  333. package/lib/types/panels.d.ts.map +1 -1
  334. package/lib/types/screens/AgentTranscriptScene.d.ts +3 -1
  335. package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
  336. package/lib/types/screens/AgentTranscriptScene.js +5 -1
  337. package/lib/types/screens/Chat.d.ts +6 -6
  338. package/lib/types/screens/Chat.d.ts.map +1 -1
  339. package/lib/types/screens/Chat.js +304 -111
  340. package/lib/types/screens/Launchpad.d.ts +8 -2
  341. package/lib/types/screens/Launchpad.d.ts.map +1 -1
  342. package/lib/types/screens/Launchpad.js +32 -12
  343. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  344. package/lib/types/screens/SessionSupervisor.js +31 -21
  345. package/lib/types/screens/Settings.d.ts +5 -1
  346. package/lib/types/screens/Settings.d.ts.map +1 -1
  347. package/lib/types/screens/Settings.js +528 -51
  348. package/lib/types/screens/StatusLine.d.ts +9 -3
  349. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  350. package/lib/types/screens/StatusLine.js +91 -15
  351. package/lib/types/screens/StatusMetrics.d.ts +2 -11
  352. package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
  353. package/lib/types/screens/StatusMetrics.js +20 -14
  354. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
  355. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +1 -1
  356. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +1 -1
  357. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
  358. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +13 -21
  359. package/lib/types/sessionMounts.d.ts +14 -0
  360. package/lib/types/sessionMounts.d.ts.map +1 -1
  361. package/lib/types/sessionMounts.js +20 -9
  362. package/lib/types/sessions/format.d.ts +39 -0
  363. package/lib/types/sessions/format.d.ts.map +1 -1
  364. package/lib/types/sessions/format.js +83 -0
  365. package/lib/types/sessions/resumeFailure.d.ts +4 -0
  366. package/lib/types/sessions/resumeFailure.d.ts.map +1 -1
  367. package/lib/types/sessions/resumeFailure.js +12 -4
  368. package/lib/types/sessions/workspaceCounts.d.ts +6 -0
  369. package/lib/types/sessions/workspaceCounts.d.ts.map +1 -0
  370. package/lib/types/sessions/workspaceCounts.js +24 -0
  371. package/lib/types/settings/definitions.d.ts +24 -0
  372. package/lib/types/settings/definitions.d.ts.map +1 -1
  373. package/lib/types/settings/definitions.js +38 -13
  374. package/lib/types/tips.js +2 -2
  375. package/lib/types/tuiDisplayPrefs.d.ts +113 -5
  376. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  377. package/lib/types/tuiDisplayPrefs.js +276 -14
  378. package/lib/types/update.d.ts +46 -36
  379. package/lib/types/update.d.ts.map +1 -1
  380. package/lib/types/update.js +248 -157
  381. package/lib/types/updateProcess.d.ts +28 -0
  382. package/lib/types/updateProcess.d.ts.map +1 -0
  383. package/lib/types/updateProcess.js +135 -0
  384. package/lib/types/utils/inputWordBoundary.d.ts +5 -0
  385. package/lib/types/utils/inputWordBoundary.d.ts.map +1 -0
  386. package/lib/types/utils/inputWordBoundary.js +18 -0
  387. package/lib/types/utils/keymap.d.ts +1 -1
  388. package/lib/types/utils/keymap.d.ts.map +1 -1
  389. package/lib/types/utils/keymap.js +6 -1
  390. package/lib/types/windowsInstaller.d.ts +4 -0
  391. package/lib/types/windowsInstaller.d.ts.map +1 -0
  392. package/lib/types/windowsInstaller.js +237 -0
  393. package/locale/en.json +6 -0
  394. package/locale/zh.json +6 -0
  395. package/package.json +127 -111
  396. package/presets/liangshen/custom-bash.mjs +13 -1
  397. package/presets/liangshen/instruction-hint.mjs +4 -1
  398. package/presets/liangshen/skill-search.mjs +14 -2
  399. package/presets/winbash.mjs +16 -4
  400. package/tui-profile/feed/README.md +17 -8
  401. package/tui-profile/feed/first-party.json +1 -1
@@ -18,6 +18,7 @@ import { HANDOFF_ACK_FD_ENV, HANDOFF_ATTEMPT_ENV, HANDOFF_SCREEN_ENV, parseHando
18
18
  import { DISABLE_KITTY_KEYBOARD, DISABLE_MODIFY_OTHER_KEYS, DISABLE_WIN32_INPUT_MODE } from './ink/termio/csi.js';
19
19
  import { DBP, DFE, DISABLE_MOUSE_TRACKING, EXIT_ALT_SCREEN, SHOW_CURSOR } from './ink/termio/dec.js';
20
20
  import { detachHandoffStdin } from './ink/stdin-handoff.js';
21
+ import { runInstallerProcess } from './updateProcess.js';
21
22
  // Re-exported for scripts/verify-update.mjs and the bin launcher, which reads
22
23
  // the compiled copy at lib/types/utils/shellQuote.js.
23
24
  export { shellQuote };
@@ -296,13 +297,15 @@ function isRecord(value) {
296
297
  return value !== null && typeof value === 'object' && !Array.isArray(value);
297
298
  }
298
299
  /** Fetch `latest` from a registry; undefined on any failure. */
299
- async function fetchLatestVersion(registryBase) {
300
+ async function fetchLatestVersion(registryBase, signal) {
301
+ if (signal?.aborted)
302
+ return undefined;
300
303
  const controller = new AbortController();
301
304
  const timeout = setTimeout(() => controller.abort(), UPDATE_CHECK_TIMEOUT_MS);
302
305
  try {
303
306
  const response = await fetch(`${registryBase}/${PACKAGE_NAME}/latest`, {
304
307
  headers: { accept: 'application/json' },
305
- signal: controller.signal,
308
+ signal: signal === undefined ? controller.signal : AbortSignal.any([controller.signal, signal]),
306
309
  });
307
310
  if (!response.ok)
308
311
  return undefined;
@@ -397,14 +400,16 @@ export function releaseChecksumUrl(version) {
397
400
  * the transition-period warning path instead of being blocked (new releases
398
401
  * always ship the manifest; old ones must keep updating).
399
402
  */
400
- async function probeChecksumManifestUrl(url) {
403
+ async function probeChecksumManifestUrl(url, signal) {
404
+ if (signal?.aborted)
405
+ return undefined;
401
406
  const controller = new AbortController();
402
407
  const timeout = setTimeout(() => controller.abort(), UPDATE_CHECK_TIMEOUT_MS);
403
408
  try {
404
409
  const response = await fetch(url, {
405
410
  headers: { 'user-agent': 'dsh-tui-updater' },
406
411
  redirect: 'follow',
407
- signal: controller.signal,
412
+ signal: signal === undefined ? controller.signal : AbortSignal.any([controller.signal, signal]),
408
413
  });
409
414
  return response.ok ? url : undefined;
410
415
  }
@@ -424,13 +429,15 @@ async function probeChecksumManifestUrl(url) {
424
429
  * failure.
425
430
  */
426
431
  export async function fetchGithubLatestRelease(options = {}) {
432
+ if (options.signal?.aborted)
433
+ return undefined;
427
434
  const doFetch = options.fetchImpl ?? fetch;
428
435
  const controller = new AbortController();
429
436
  const timeout = setTimeout(() => controller.abort(), UPDATE_CHECK_TIMEOUT_MS);
430
437
  try {
431
438
  const response = await doFetch(`${options.apiBaseUrl ?? 'https://api.github.com'}/repos/${GITHUB_REPO}/releases/latest`, {
432
439
  headers: { accept: 'application/vnd.github.v3+json', 'user-agent': 'dsh-tui-updater' },
433
- signal: controller.signal,
440
+ signal: options.signal === undefined ? controller.signal : AbortSignal.any([controller.signal, options.signal]),
434
441
  });
435
442
  if (!response.ok)
436
443
  return undefined;
@@ -628,14 +635,14 @@ export function validateExtractedTree(extractDir) {
628
635
  * {@link MAX_CHECKSUM_MANIFEST_BYTES}); tests inject a small value.
629
636
  * @returns The manifest text.
630
637
  */
631
- async function fetchChecksumManifest(checksumUrl, maxManifestBytes = MAX_CHECKSUM_MANIFEST_BYTES) {
638
+ async function fetchChecksumManifest(checksumUrl, maxManifestBytes = MAX_CHECKSUM_MANIFEST_BYTES, signal) {
632
639
  const controller = new AbortController();
633
640
  const timeout = setTimeout(() => controller.abort(), STANDALONE_DOWNLOAD_TIMEOUT_MS);
634
641
  try {
635
642
  const response = await fetch(checksumUrl, {
636
643
  headers: { 'user-agent': 'dsh-tui-updater' },
637
644
  redirect: 'follow',
638
- signal: controller.signal,
645
+ signal: signal === undefined ? controller.signal : AbortSignal.any([controller.signal, signal]),
639
646
  });
640
647
  if (!response.ok) {
641
648
  throw new Error(`checksum manifest fetch failed: HTTP ${response.status} ${response.statusText}`);
@@ -691,8 +698,12 @@ async function fetchChecksumManifest(checksumUrl, maxManifestBytes = MAX_CHECKSU
691
698
  */
692
699
  export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress, checksumUrl, options = {}) {
693
700
  const maxAssetBytes = options.maxAssetBytes ?? MAX_ASSET_BYTES;
701
+ const controller = new AbortController();
702
+ const signal = options.signal === undefined ? controller.signal : AbortSignal.any([controller.signal, options.signal]);
703
+ const timeout = setTimeout(() => controller.abort(), STANDALONE_DOWNLOAD_TIMEOUT_MS);
694
704
  const tempDir = join(process.env.DSH_TUI_STANDALONE_CACHE ?? join(homedir(), '.cache', 'dsh-tui-standalone'), `.update-${Date.now()}-${process.pid}`);
695
705
  try {
706
+ signal.throwIfAborted();
696
707
  const currentBinary = getStandaloneBinaryPath();
697
708
  const targetDir = dirname(currentBinary);
698
709
  const assetName = getStandaloneAssetName();
@@ -700,19 +711,11 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
700
711
  mkdirSync(tempDir, { recursive: true });
701
712
  const downloadPath = join(tempDir, assetName);
702
713
  onProgress?.(`downloading: ${downloadUrl}`);
703
- const controller = new AbortController();
704
- const timeout = setTimeout(() => controller.abort(), STANDALONE_DOWNLOAD_TIMEOUT_MS);
705
- let response;
706
- try {
707
- response = await fetch(downloadUrl, {
708
- headers: { 'user-agent': 'dsh-tui-updater' },
709
- redirect: 'follow',
710
- signal: controller.signal,
711
- });
712
- }
713
- finally {
714
- clearTimeout(timeout);
715
- }
714
+ const response = await fetch(downloadUrl, {
715
+ headers: { 'user-agent': 'dsh-tui-updater' },
716
+ redirect: 'follow',
717
+ signal,
718
+ });
716
719
  if (!response.ok) {
717
720
  throw new Error(`HTTP ${response.status} ${response.statusText}`);
718
721
  }
@@ -760,7 +763,7 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
760
763
  }
761
764
  else {
762
765
  onProgress?.('verifying checksum…');
763
- const manifest = await fetchChecksumManifest(checksumUrl, options.maxChecksumManifestBytes ?? MAX_CHECKSUM_MANIFEST_BYTES);
766
+ const manifest = await fetchChecksumManifest(checksumUrl, options.maxChecksumManifestBytes ?? MAX_CHECKSUM_MANIFEST_BYTES, signal);
764
767
  if (!verifyAssetChecksum(buffer, manifest, assetName)) {
765
768
  // Fail closed: never leave a mismatching (potentially hostile) asset
766
769
  // on disk for a later retry to pick up, and never extract it.
@@ -773,6 +776,7 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
773
776
  onProgress?.('checksum verified');
774
777
  }
775
778
  onProgress?.('extracting…');
779
+ signal.throwIfAborted();
776
780
  const extractDir = join(tempDir, 'extracted');
777
781
  mkdirSync(extractDir, { recursive: true });
778
782
  if (isZip) {
@@ -816,6 +820,7 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
816
820
  throw new Error(`expected binary entry is not a regular file: ${newBinaryPath}`);
817
821
  }
818
822
  onProgress?.('replacing binary…');
823
+ signal.throwIfAborted();
819
824
  if (process.platform !== 'win32') {
820
825
  try {
821
826
  chmodSync(newBinaryPath, 0o755);
@@ -847,18 +852,17 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
847
852
  chmodSync(stagedTarget, 0o755);
848
853
  renameSync(stagedTarget, currentBinary);
849
854
  }
850
- try {
851
- rmSync(tempDir, { recursive: true, force: true });
852
- }
853
- catch { }
854
855
  return { success: true };
855
856
  }
856
857
  catch (error) {
858
+ return { success: false, error: error instanceof Error ? error.message : String(error) };
859
+ }
860
+ finally {
861
+ clearTimeout(timeout);
857
862
  try {
858
863
  rmSync(tempDir, { recursive: true, force: true });
859
864
  }
860
865
  catch { }
861
- return { success: false, error: error instanceof Error ? error.message : String(error) };
862
866
  }
863
867
  }
864
868
  /**
@@ -874,14 +878,20 @@ export async function downloadAndReplaceStandaloneBinary(downloadUrl, onProgress
874
878
  * say "installing X now, official latest is Y" instead of silently
875
879
  * upgrading to yesterday's version.
876
880
  */
877
- export async function resolveTuiUpdateTarget() {
881
+ export async function resolveTuiUpdateTarget(signal) {
882
+ if (signal?.aborted)
883
+ return { kind: 'unknown' };
878
884
  const current = installedTuiVersion();
879
885
  const currentVersion = current === undefined ? null : valid(current);
880
886
  if (currentVersion === null)
881
887
  return { kind: 'unknown' };
882
888
  if (isStandaloneRuntime()) {
883
- const ghRelease = await fetchGithubLatestRelease();
884
- const latest = ghRelease?.version ?? (await fetchLatestVersion(resolveRegistryBase()));
889
+ const ghRelease = await fetchGithubLatestRelease({ signal });
890
+ if (signal?.aborted)
891
+ return { kind: 'unknown' };
892
+ const latest = ghRelease?.version ?? (await fetchLatestVersion(resolveRegistryBase(), signal));
893
+ if (signal?.aborted)
894
+ return { kind: 'unknown' };
885
895
  if (latest === undefined)
886
896
  return { kind: 'unknown' };
887
897
  if (!gt(latest, currentVersion))
@@ -896,15 +906,15 @@ export async function resolveTuiUpdateTarget() {
896
906
  // release-bundle.yml generates it alongside the assets).
897
907
  const checksumUrl = ghRelease !== undefined
898
908
  ? ghRelease.checksumUrl
899
- : await probeChecksumManifestUrl(releaseChecksumUrl(latest));
909
+ : await probeChecksumManifestUrl(releaseChecksumUrl(latest), signal);
900
910
  return checksumUrl === undefined
901
911
  ? { kind: 'update', current: currentVersion, latest, isStandalone: true, downloadUrl }
902
912
  : { kind: 'update', current: currentVersion, latest, isStandalone: true, downloadUrl, checksumUrl };
903
913
  }
904
914
  const registryBase = resolveRegistryBase();
905
915
  const [latest, official] = await Promise.all([
906
- fetchLatestVersion(registryBase),
907
- registryBase === DEFAULT_REGISTRY ? undefined : fetchLatestVersion(DEFAULT_REGISTRY),
916
+ fetchLatestVersion(registryBase, signal),
917
+ registryBase === DEFAULT_REGISTRY ? undefined : fetchLatestVersion(DEFAULT_REGISTRY, signal),
908
918
  ]);
909
919
  if (latest === undefined)
910
920
  return { kind: 'unknown' };
@@ -941,41 +951,23 @@ export async function checkForTuiUpdate() {
941
951
  * process never starts, leaving an updated package and a dead TUI.
942
952
  */
943
953
  function runProcess(command, args, options = {}) {
944
- return new Promise(resolve => {
945
- let settled = false;
946
- const useShell = options.shell === true && process.platform === 'win32';
947
- // DEP0190 (issue #148): Node ≥22 warns on `shell: true` with a non-empty
948
- // args array even when every arg is escaped — the check is syntactic.
949
- // Fold the shell-quoted args into the command string instead (an empty
950
- // args array does not trigger the warning); future Node majors may turn
951
- // the deprecation into a hard error.
952
- const [runCommand, runArgs] = useShell
953
- ? [`${command} ${shellQuote(args).join(' ')}`, []]
954
- : [command, args];
955
- const child = spawn(runCommand, runArgs, {
956
- env: options.env,
957
- stdio: options.onStderr === undefined ? 'inherit' : ['inherit', 'inherit', 'pipe'],
958
- shell: useShell,
959
- });
960
- if (options.onStderr !== undefined && child.stderr !== null) {
961
- const onStderr = options.onStderr;
962
- child.stderr.on('data', (chunk) => {
963
- const text = chunk.toString('utf8');
964
- process.stderr.write(text);
965
- onStderr(text);
966
- });
967
- }
968
- const finish = (code) => {
969
- if (settled)
970
- return;
971
- settled = true;
972
- resolve(code);
973
- };
974
- child.once('error', error => {
975
- process.stderr.write(`dsh-tui: failed to run ${command}: ${error.message}\n`);
976
- finish(127);
977
- });
978
- child.once('close', code => finish(code ?? 1));
954
+ return runInstallerProcess(command, args, {
955
+ ...options,
956
+ category: 'profile-install',
957
+ onStdout: text => { process.stdout.write(text); },
958
+ onStderr: text => {
959
+ process.stderr.write(text);
960
+ options.onStderr?.(text);
961
+ },
962
+ onEvent: event => {
963
+ if (event.stage === 'cleanup-error')
964
+ options.onCleanupError?.();
965
+ logRestartEvent('update installer', { ...event });
966
+ if (event.stage === 'timeout' || event.stage === 'cancel' || event.stage === 'cleanup-error' || event.stage === 'error') {
967
+ writeHandoffNotice(`dsh-tui: installer ${event.stage}; category=${event.category} pid=${event.pid ?? 'unavailable'} last-output=${event.lastOutputAt === undefined ? 'none' : new Date(event.lastOutputAt).toISOString()}${event.message === undefined ? '' : `: ${event.message}`}\n`);
968
+ writeHandoffNotice('Installation may be partial. Check/repair the profile before resuming; no automatic restart.\n');
969
+ }
970
+ },
979
971
  });
980
972
  }
981
973
  /** Build the profile-manager command, preferring a preflight-pinned version. */
@@ -1103,17 +1095,14 @@ export function ensureWorkspaceAllowBuilds(yamlPath) {
1103
1095
  * preserved, a missing `minimumReleaseAgeExclude` block is appended, a
1104
1096
  * missing file is created, and an absent profile directory resolves to
1105
1097
  * undefined — the caller still runs pnpm, whose own diagnostic stays the
1106
- * visible fallback. Own entries are re-rendered target-first on every
1107
- * rewrite: pnpm 11.7.x honours only the FIRST entry per package (later
1108
- * entries for the same package are ignored against the real registry), and
1109
- * 11.21.x applies every entry in any order, so the target — the version the
1110
- * swap itself has to resolve, and published by construction while a
1111
- * dev-built `updatedFrom` need not be — takes the slot older pnpm still
1112
- * reads. Both exemptions come from the manifest, not from `pnpm-lock.yaml`:
1113
- * a profile whose manifest and lockfile diverged keeps the lockfile's entry
1114
- * unexempted. The 11.7.x `--frozen-lockfile` policy check reads that first
1115
- * entry only, so a two-entry list does not clear it there; the `pnpm add`
1116
- * path `/update` runs resolves the target and does pass.
1098
+ * visible fallback. Both versions share ONE entry, `pkg@<target> || <from>`:
1099
+ * pnpm 11.5.x–11.7.x honour only the FIRST entry per package (later entries
1100
+ * for the same package are ignored), so two entries leave the old lockfile
1101
+ * version unexempted there whatever their order — the `pnpm update` dsh runs
1102
+ * for `/update` fails on it (issue #1605) — while 11.10+ applies every entry.
1103
+ * A version union is read whole by both. Both exemptions come from the
1104
+ * manifest, not from `pnpm-lock.yaml`: a profile whose manifest and lockfile
1105
+ * diverged keeps the lockfile's entry unexempted.
1117
1106
  *
1118
1107
  * @param profile - The dsh profile whose workspace file is seeded.
1119
1108
  * @param version - The update target (exact version).
@@ -1133,10 +1122,9 @@ export function ensureProfileReleaseAgeExclude(profile, version, alsoExempt) {
1133
1122
  // Missing file — start from an empty document; writeFileSync creates it.
1134
1123
  }
1135
1124
  const entry = `${PACKAGE_NAME}@${version}`;
1136
- const alsoEntry = alsoExempt !== undefined && alsoExempt !== '' && alsoExempt !== version
1137
- ? `${PACKAGE_NAME}@${alsoExempt}`
1138
- : undefined;
1139
- const keep = alsoEntry === undefined ? [entry] : [entry, alsoEntry];
1125
+ const keep = alsoExempt !== undefined && alsoExempt !== '' && alsoExempt !== version
1126
+ ? [`${entry} || ${alsoExempt}`]
1127
+ : [entry];
1140
1128
  const lines = text.split(/\r?\n/u);
1141
1129
  let blockStart = -1;
1142
1130
  for (let i = 0; i < lines.length; i += 1) {
@@ -1178,10 +1166,8 @@ export function ensureProfileReleaseAgeExclude(profile, version, alsoExempt) {
1178
1166
  if (!droppedStale && missing.length === 0) {
1179
1167
  return { entries: [...foreignLines.map(itemOf), ...present], changed: false };
1180
1168
  }
1181
- // Own entries are re-rendered in keep order (target first) instead of
1182
- // copied as found: pnpm 11.7.x honours only the first entry per package
1183
- // (11.21.x applies them all, order-independent), and the target is the
1184
- // version the swap must resolve, so it takes that first slot.
1169
+ // Own entries are re-rendered from the keep set instead of copied as
1170
+ // found, so a pre-#1605 two-entry pair collapses into the single union.
1185
1171
  const insert = foreignLines.concat(keep.map(item => ` - '${item}'`));
1186
1172
  if (blockStart !== -1) {
1187
1173
  lines.splice(blockStart + 1, blockEnd - blockStart - 1, ...insert);
@@ -1253,18 +1239,21 @@ function existsSafe(path) {
1253
1239
  }
1254
1240
  }
1255
1241
  /**
1256
- * sharp distributes its native binaries as platform-specific optional
1257
- * dependencies (@img/sharp-<platform> wrappers plus @img/sharp-libvips-<platform>
1258
- * runtimes). pnpm's lockfile records EVERY platform's entry by design, and
1259
- * some pnpm update paths materialize all of them — maintainer-group report
1260
- * 2026-09-11: a 0.10.0 → 0.10.1 update downloaded ~90MB of win32/darwin/
1261
- * musl/riscv64/s390x/ppc64 binaries on a linux-x64 box. The fix keeps
1262
- * `ignoredOptionalDependencies` patterns for every OTHER platform in the
1263
- * profile: pnpm skips ignored optionals entirely (no download, no node_modules
1264
- * entry), while the current platform's packages — the only ones sharp loads —
1265
- * stay untouched. These tables mirror sharp's published platform matrix; a
1266
- * suffix sharp adds later only costs the saving for that platform, never a
1267
- * broken install, since an unknown suffix is simply not ignored.
1242
+ * Native backends ship as platform-specific optional dependencies, and pnpm's
1243
+ * lockfile records EVERY platform's entry by design. Some pnpm update paths
1244
+ * materialize all of them — maintainer-group report 2026-09-11: a 0.10.0 →
1245
+ * 0.10.1 update downloaded ~90MB of win32/darwin/musl/riscv64/s390x/ppc64
1246
+ * sharp binaries on a linux-x64 box; a 0.15 → 0.16 dsh-tui update then pulled
1247
+ * seven foreign `@anthropic-ai/claude-agent-sdk-*` bundles (~230MB each,
1248
+ * ~1.6GB) the same way. The fix keeps `ignoredOptionalDependencies` patterns
1249
+ * for every OTHER platform in the profile: pnpm skips ignored optionals
1250
+ * entirely (no download, no node_modules entry), while the current platform's
1251
+ * packages — the only ones these backends load — stay untouched.
1252
+ *
1253
+ * Each table mirrors its package's published platform matrix for the pinned
1254
+ * version. A suffix the package adds later only costs the saving for that
1255
+ * platform, never a broken install: an unknown suffix is simply not listed
1256
+ * here, so it is never ignored.
1268
1257
  */
1269
1258
  const SHARP_WRAPPER_SUFFIXES = [
1270
1259
  'darwin-arm64', 'darwin-x64', 'freebsd-wasm32', 'linux-arm', 'linux-arm64',
@@ -1306,6 +1295,38 @@ export function ignoredSharpOptionalPatterns(platform, cpu, libc) {
1306
1295
  ...SHARP_LIBVIPS_SUFFIXES.filter(s => s !== current).map(s => `@img/sharp-libvips-${s}`),
1307
1296
  ];
1308
1297
  }
1298
+ /**
1299
+ * `@anthropic-ai/claude-agent-sdk` carries the Claude CLI as one native bundle
1300
+ * per platform in its optionalDependencies. The SDK is an on-demand backend —
1301
+ * the kernel picker adds it to a profile only when the user picks Claude — but
1302
+ * once it IS there, an update re-resolves it through the same pnpm path that
1303
+ * materializes every platform's optional (see the sharp report above), so the
1304
+ * same ignore list keeps only this platform's bundle. Suffixes mirror the
1305
+ * pinned SDK version's published matrix, musl variants included.
1306
+ */
1307
+ const CLAUDE_SDK_PREFIX = '@anthropic-ai/claude-agent-sdk-';
1308
+ const CLAUDE_SDK_SUFFIXES = [
1309
+ 'darwin-arm64', 'darwin-x64',
1310
+ 'linux-arm64', 'linux-arm64-musl', 'linux-x64', 'linux-x64-musl',
1311
+ 'win32-arm64', 'win32-x64',
1312
+ ];
1313
+ /** The SDK bundle suffix of the RUNNING platform (musl linux adds `-musl`). */
1314
+ export function claudeSdkCurrentSuffix(platform, cpu, libc) {
1315
+ const musl = platform === 'linux' && libc === 'musl';
1316
+ return `${platform}-${cpu}${musl ? '-musl' : ''}`;
1317
+ }
1318
+ /** Patterns for every SDK bundle EXCEPT the running one. */
1319
+ export function ignoredClaudeSdkOptionalPatterns(platform, cpu, libc) {
1320
+ const current = claudeSdkCurrentSuffix(platform, cpu, libc);
1321
+ return CLAUDE_SDK_SUFFIXES.filter(s => s !== current).map(s => `${CLAUDE_SDK_PREFIX}${s}`);
1322
+ }
1323
+ /** Patterns for every known native package this platform does not load. */
1324
+ export function ignoredForeignPlatformPatterns(platform, cpu, libc) {
1325
+ return [
1326
+ ...ignoredSharpOptionalPatterns(platform, cpu, libc),
1327
+ ...ignoredClaudeSdkOptionalPatterns(platform, cpu, libc),
1328
+ ];
1329
+ }
1309
1330
  /**
1310
1331
  * Libc verdict for an explicit platform, so the whole matrix is testable on any
1311
1332
  * host. Node's report wins when present: a stray musl loader (Debian's musl
@@ -1326,10 +1347,11 @@ function isMuslRuntime() {
1326
1347
  const report = process.report?.getReport();
1327
1348
  return detectLibc(process.platform, report, existsSafe('/lib/ld-musl-x86_64.so.1') || existsSafe('/lib/ld-musl-aarch64.so.1') || existsSafe('/etc/alpine-release')) === 'musl';
1328
1349
  }
1329
- /** Every @img package this module's tables cover (both the wrapper and the libvips matrix). */
1330
- const SHARP_MANAGED_PATTERNS = new Set([
1350
+ /** Every native package this module's tables cover (sharp wrappers/libvips and SDK bundles). */
1351
+ const MANAGED_OPTIONAL_PATTERNS = new Set([
1331
1352
  ...SHARP_WRAPPER_SUFFIXES.map(s => `@img/sharp-${s}`),
1332
1353
  ...SHARP_LIBVIPS_SUFFIXES.map(s => `@img/sharp-libvips-${s}`),
1354
+ ...CLAUDE_SDK_SUFFIXES.map(s => `${CLAUDE_SDK_PREFIX}${s}`),
1333
1355
  ]);
1334
1356
  /**
1335
1357
  * The package name a list entry names, whatever spelling pnpm accepts: an
@@ -1354,29 +1376,29 @@ function optionalDependencyNameOf(line) {
1354
1376
  return name === '' ? undefined : name;
1355
1377
  }
1356
1378
  /**
1357
- * Keep an `ignoredOptionalDependencies:` block in the profile's
1358
- * pnpm-workspace.yaml listing every non-current-platform @img package, so an
1359
- * update stops downloading the foreign-platform sharp natives. The list is
1360
- * recomputed on every run: it is a fact about the machine running the update,
1361
- * so a profile carried to another platform (WSL, a musl container, a new cpu)
1362
- * gets a fresh list instead of a stale one that would skip the packages that
1379
+ * Keep an `ignoredOptionalDependencies:` block in a profile's
1380
+ * pnpm-workspace.yaml listing every native package this platform does not
1381
+ * load — the foreign-platform sharp natives and Claude SDK bundles — so an
1382
+ * update (or an on-demand kernel install) stops downloading them. The list is
1383
+ * recomputed on every run: it is a fact about the machine running pnpm, so a
1384
+ * profile carried to another platform (WSL, a musl container, a new cpu) gets
1385
+ * a fresh list instead of a stale one that would skip the packages that
1363
1386
  * machine needs. Entries this module's own tables cover are rewritten (by
1364
1387
  * package name, so quoted forms, trailing comments and blank lines inside the
1365
- * block all still refresh); every other entry — a user's `fsevents`, a name
1366
- * sharp adds later, a user's own `@img/sharp-wasm32` exemption — is preserved
1367
- * verbatim, same as in {@link ensureProfileAllowBuilds}. Best effort and
1368
- * idempotent: the file is written only when the resulting block actually
1369
- * differs, a missing `ignoredOptionalDependencies:` block is appended, and an
1370
- * absent profile directory resolves to undefined — the update still runs, only
1371
- * the download-size win is lost. A document this function cannot rewrite safely
1372
- * (a flow-style value, a duplicated key, which is already invalid YAML) is left
1373
- * untouched rather than half-rewritten. Residual caveat shared by any persisted
1374
- * machine fact: a second platform using the same profile without running an
1375
- * update keeps this platform's list, so its own binaries stay skipped until the
1376
- * next update there.
1388
+ * block all still refresh); every other entry — a user's `fsevents`, a native
1389
+ * package a backend adds later, a user's own `@img/sharp-wasm32` exemption —
1390
+ * is preserved verbatim, same as in {@link ensureProfileAllowBuilds}. Best
1391
+ * effort and idempotent: the file is written only when the resulting block
1392
+ * actually differs, a missing `ignoredOptionalDependencies:` block is
1393
+ * appended, and an absent directory resolves to undefined — the caller still
1394
+ * runs pnpm, only the download-size win is lost. A document this function
1395
+ * cannot rewrite safely (a flow-style value, a duplicated key, which is
1396
+ * already invalid YAML) is left untouched rather than half-rewritten. Residual
1397
+ * caveat shared by any persisted machine fact: a second platform using the
1398
+ * same profile without running either path keeps this platform's list, so its
1399
+ * own binaries stay skipped until the next update or install there.
1377
1400
  */
1378
- export function ensureProfileSharpPlatformFilter(profile) {
1379
- const yamlPath = profileWorkspaceYamlPath(profile);
1401
+ export function ensurePlatformFilterAt(yamlPath) {
1380
1402
  try {
1381
1403
  if (!existsSafe(dirname(yamlPath)))
1382
1404
  return undefined;
@@ -1414,11 +1436,11 @@ export function ensureProfileSharpPlatformFilter(profile) {
1414
1436
  const name = optionalDependencyNameOf(line);
1415
1437
  // Entries from our own tables (possibly computed for another platform)
1416
1438
  // are dropped here and recomputed below; everything else is preserved.
1417
- if (name === undefined || !SHARP_MANAGED_PATTERNS.has(name))
1439
+ if (name === undefined || !MANAGED_OPTIONAL_PATTERNS.has(name))
1418
1440
  foreign.push(line);
1419
1441
  }
1420
1442
  }
1421
- const patterns = ignoredSharpOptionalPatterns(process.platform, process.arch, isMuslRuntime() ? 'musl' : 'glibc');
1443
+ const patterns = ignoredForeignPlatformPatterns(process.platform, process.arch, isMuslRuntime() ? 'musl' : 'glibc');
1422
1444
  const insert = foreign.concat(patterns.map(p => ` - '${p}'`));
1423
1445
  if (blockStart !== -1 && lines.slice(blockStart + 1, blockEnd).join('\n') === insert.join('\n')) {
1424
1446
  return { entries: patterns, changed: false };
@@ -1438,6 +1460,10 @@ export function ensureProfileSharpPlatformFilter(profile) {
1438
1460
  return undefined;
1439
1461
  }
1440
1462
  }
1463
+ /** {@link ensurePlatformFilterAt} for a profile's own workspace file. */
1464
+ export function ensureProfilePlatformFilter(profile) {
1465
+ return ensurePlatformFilterAt(profileWorkspaceYamlPath(profile));
1466
+ }
1441
1467
  /**
1442
1468
  * The pnpm Windows tmp-rename race signature (issue #225): pnpm swaps a
1443
1469
  * package directory via a `<name>_tmp_<pid>` staging dir, and a file lock or
@@ -1550,32 +1576,55 @@ export function migrateGlobalLauncher() {
1550
1576
  // layouts collapse both onto the same real path — copying onto ourselves
1551
1577
  // would be a no-op at best).
1552
1578
  let dir = dirname(resolve(launcherBin));
1553
- const ownDir = dirname(dirname(fileURLToPath(import.meta.url)));
1579
+ const here = dirname(fileURLToPath(import.meta.url));
1580
+ let own;
1581
+ // These are the same two layouts accepted by installedTuiVersion(). Read
1582
+ // both source files before replacing either destination file.
1583
+ for (const relativePath of ['../..', '..']) {
1584
+ try {
1585
+ const candidate = resolve(here, relativePath);
1586
+ const manifest = readFileSync(join(candidate, 'package.json'));
1587
+ const parsed = JSON.parse(manifest.toString('utf8'));
1588
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)
1589
+ || parsed.name !== PACKAGE_NAME)
1590
+ continue;
1591
+ const bin = readFileSync(join(candidate, 'bin', 'dsh-tui.js'));
1592
+ if (bin.length === 0)
1593
+ continue;
1594
+ own = { dir: realpathSync(candidate), bin, manifest };
1595
+ break;
1596
+ }
1597
+ catch {
1598
+ // A missing or invalid compiled root may still be a source checkout.
1599
+ }
1600
+ }
1601
+ if (!own)
1602
+ return false;
1554
1603
  for (let depth = 0; depth < 4; depth++) {
1555
1604
  const manifest = join(dir, 'package.json');
1556
1605
  try {
1557
1606
  const parsed = JSON.parse(readFileSync(manifest, 'utf8'));
1558
1607
  if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)
1559
1608
  && parsed.name === PACKAGE_NAME) {
1560
- let same = false;
1561
1609
  try {
1562
- same = realpathSync(dir) === realpathSync(ownDir);
1610
+ // Fail closed when the real paths cannot establish distinct roots.
1611
+ if (realpathSync(dir) === own.dir)
1612
+ return false;
1613
+ // Each rename is atomic, not the pair. A partial migration returns
1614
+ // false and can be retried; the standalone bin is safe in either case.
1615
+ const replace = (target, content) => {
1616
+ const staged = `${target}.dsh-tui-migrate`;
1617
+ writeFileSync(staged, content);
1618
+ renameSync(staged, target);
1619
+ };
1620
+ replace(join(dir, 'bin', 'dsh-tui.js'), own.bin);
1621
+ replace(manifest, own.manifest);
1622
+ return true;
1563
1623
  }
1564
1624
  catch {
1565
- same = resolve(dir) === resolve(ownDir);
1566
- }
1567
- if (same)
1625
+ // Keep the alignment warning as the permission/locked-file fallback.
1568
1626
  return false;
1569
- // tmp + rename keeps each file atomic; a crash mid-migration leaves
1570
- // either the old or the new file, never a truncated one.
1571
- const replace = (target, source) => {
1572
- const staged = `${target}.dsh-tui-migrate`;
1573
- writeFileSync(staged, readFileSync(source));
1574
- renameSync(staged, target);
1575
- };
1576
- replace(join(dir, 'bin', 'dsh-tui.js'), join(ownDir, 'bin', 'dsh-tui.js'));
1577
- replace(manifest, join(ownDir, 'package.json'));
1578
- return true;
1627
+ }
1579
1628
  }
1580
1629
  }
1581
1630
  catch {
@@ -1599,15 +1648,19 @@ export function migrateGlobalLauncher() {
1599
1648
  * undefined when that check failed and pnpm should resolve latest.
1600
1649
  * @returns The update exit code plus the before/after versions.
1601
1650
  */
1602
- export async function updateTui(profile, targetVersion) {
1651
+ export async function updateTui(profile, targetVersion, signal) {
1603
1652
  // Stamp the pre-update version BEFORE pnpm runs: it reads this package's
1604
1653
  // manifest from disk, which the update replaces on the fly — a
1605
1654
  // post-update read already sees the NEW version, and the restarted
1606
1655
  // process then compares new-vs-new and false-alarms "version did not
1607
1656
  // advance" on every successful update (issue #307's screenshots).
1608
1657
  const updatedFrom = installedTuiVersion() ?? '';
1658
+ if (signal?.aborted)
1659
+ return { code: 130, updatedFrom };
1609
1660
  if (isStandaloneRuntime()) {
1610
- const target = await resolveTuiUpdateTarget();
1661
+ const target = await resolveTuiUpdateTarget(signal);
1662
+ if (signal?.aborted)
1663
+ return { code: 130, updatedFrom };
1611
1664
  const latestVersion = targetVersion ?? (target.kind === 'update' ? target.latest : undefined);
1612
1665
  const downloadUrl = (target.kind === 'update' && target.downloadUrl)
1613
1666
  ? target.downloadUrl
@@ -1620,7 +1673,9 @@ export async function updateTui(profile, targetVersion) {
1620
1673
  process.stderr.write(`dsh-tui: 正在更新便携包 (${updatedFrom || 'current'} → ${latestVersion})…\n`);
1621
1674
  const result = await downloadAndReplaceStandaloneBinary(downloadUrl, msg => {
1622
1675
  process.stderr.write(`dsh-tui: ${msg}\n`);
1623
- }, checksumUrl);
1676
+ }, checksumUrl, { signal });
1677
+ if (signal?.aborted)
1678
+ return { code: 130, updatedFrom };
1624
1679
  if (!result.success) {
1625
1680
  process.stderr.write(`dsh-tui: 便携包更新失败: ${result.error ?? '未知错误'}\n`);
1626
1681
  return { code: 1, updatedFrom };
@@ -1638,12 +1693,15 @@ export async function updateTui(profile, targetVersion) {
1638
1693
  process.stderr.write(`dsh-tui: pre-seeded profile pnpm allowBuilds (${allowBuilds.added.join(', ')}) — ` +
1639
1694
  'postinstall-only deps are explicitly ignored\n');
1640
1695
  }
1641
- // Foreign-platform @img/sharp-* optionals are pure download waste (~90MB on
1642
- // the maintainer-group report); keep the profile's ignore list matching THIS
1643
- // machine (each update recomputes it) so pnpm never fetches them.
1644
- const sharpFilter = ensureProfileSharpPlatformFilter(profile);
1645
- if (sharpFilter !== undefined && sharpFilter.changed) {
1646
- process.stderr.write(`dsh-tui: sharp platform filter updated (${sharpFilter.entries.length} foreign-platform patterns ignored) — ` +
1696
+ // Foreign-platform natives are pure download waste (sharp ~90MB, the Claude
1697
+ // SDK's bundles ~1.6GB on the maintainer report); keep the profile's ignore
1698
+ // list matching THIS machine (each update recomputes it) so pnpm never
1699
+ // fetches them. The SDK is never ADDED here — it only enters a profile
1700
+ // through the kernel picker's guided install, and then only for the
1701
+ // platform it runs on.
1702
+ const platformFilter = ensureProfilePlatformFilter(profile);
1703
+ if (platformFilter !== undefined && platformFilter.changed) {
1704
+ process.stderr.write(`dsh-tui: platform filter updated (${platformFilter.entries.length} foreign-platform patterns ignored) — ` +
1647
1705
  `this profile's install keeps only the current platform's natives\n`);
1648
1706
  }
1649
1707
  // pnpm ≥11's minimumReleaseAge (24h by default) refuses installs of
@@ -1656,7 +1714,7 @@ export async function updateTui(profile, targetVersion) {
1656
1714
  const releaseAge = ensureProfileReleaseAgeExclude(profile, targetVersion, updatedFrom === '' ? undefined : updatedFrom);
1657
1715
  if (releaseAge !== undefined && releaseAge.changed) {
1658
1716
  const exempted = updatedFrom !== '' && updatedFrom !== targetVersion
1659
- ? `${PACKAGE_NAME}@${targetVersion} + ${PACKAGE_NAME}@${updatedFrom}`
1717
+ ? `${PACKAGE_NAME}@${targetVersion} || ${updatedFrom}`
1660
1718
  : `${PACKAGE_NAME}@${targetVersion}`;
1661
1719
  process.stderr.write(`dsh-tui: pre-seeded profile release-age exclusion (${exempted}) — ` +
1662
1720
  'freshly published versions install without the 24h supply-chain delay\n');
@@ -1664,14 +1722,28 @@ export async function updateTui(profile, targetVersion) {
1664
1722
  }
1665
1723
  let updateStderr = '';
1666
1724
  const capture = (chunk) => { updateStderr += chunk; };
1667
- let updateCode = await runProcess(dsh, updateArgs, { shell: true, onStderr: capture });
1725
+ let cleanupUnconfirmed = false;
1726
+ const onCleanupError = () => { cleanupUnconfirmed = true; };
1727
+ const installerOptions = { shell: true, onStderr: capture, signal, onCleanupError };
1728
+ let updateCode = await runProcess(dsh, updateArgs, installerOptions);
1729
+ // Exit codes alone cannot prove ownership cleanup: a supervisor failure can
1730
+ // use the same code/stderr as a retryable installer failure. Never overlap
1731
+ // a surviving installer with a retry, stale-file removal, repair or restart.
1732
+ if (cleanupUnconfirmed)
1733
+ return { code: updateCode || 1, updatedFrom };
1734
+ if (signal?.aborted)
1735
+ return { code: 130, updatedFrom };
1668
1736
  // Transient Windows tmp-rename race (issue #225): retry the identical
1669
1737
  // command once — it succeeds on a clean second run, and only the
1670
1738
  // `_tmp_<pid>` race signature qualifies, never a real resolution error.
1671
- if (updateCode !== 0 && isTransientUpdateFailure(updateStderr)) {
1739
+ if (![0, 124, 129, 130, 143].includes(updateCode) && isTransientUpdateFailure(updateStderr)) {
1672
1740
  process.stderr.write('dsh-tui: transient pnpm failure (Windows tmp-rename race) — retrying once…\n');
1673
1741
  updateStderr = '';
1674
- updateCode = await runProcess(dsh, updateArgs, { shell: true, onStderr: capture });
1742
+ updateCode = await runProcess(dsh, updateArgs, installerOptions);
1743
+ if (cleanupUnconfirmed)
1744
+ return { code: updateCode || 1, updatedFrom };
1745
+ if (signal?.aborted)
1746
+ return { code: 130, updatedFrom };
1675
1747
  }
1676
1748
  // Deterministic Linux tmp-rename race (issue #479): EEXIST never clears on
1677
1749
  // a plain retry (the staging-dir collision reproduces every run), and a
@@ -1679,14 +1751,18 @@ export async function updateTui(profile, targetVersion) {
1679
1751
  // recover by removing the stale install + staging dirs, then rerunning —
1680
1752
  // the field-verified workaround that takes pnpm down its fresh-install
1681
1753
  // path instead of renaming over the collision.
1682
- if (updateCode !== 0 && (isEexistTmpRenameFailure(updateStderr) || isTransientUpdateFailure(updateStderr))) {
1754
+ if (![0, 124, 129, 130, 143].includes(updateCode) && (isEexistTmpRenameFailure(updateStderr) || isTransientUpdateFailure(updateStderr))) {
1683
1755
  const flavor = isEexistTmpRenameFailure(updateStderr) ? 'EEXIST, issue #479' : 'retry failed, issue #225';
1684
1756
  const removal = removeStalePackageInstall(profile);
1685
1757
  const stagingNote = removal.tmpDirs.length > 0 ? ` + ${removal.tmpDirs.length} staging dir(s)` : '';
1686
1758
  process.stderr.write(`dsh-tui: pnpm tmp-rename race (${flavor}) — cleared the stale install ` +
1687
1759
  `(package dir: ${removal.packageDir}${stagingNote}) and rerunning the update…\n`);
1688
1760
  updateStderr = '';
1689
- updateCode = await runProcess(dsh, updateArgs, { shell: true, onStderr: capture });
1761
+ updateCode = await runProcess(dsh, updateArgs, installerOptions);
1762
+ if (cleanupUnconfirmed)
1763
+ return { code: updateCode || 1, updatedFrom };
1764
+ if (signal?.aborted)
1765
+ return { code: 130, updatedFrom };
1690
1766
  }
1691
1767
  if (updateCode !== 0)
1692
1768
  return { code: updateCode, updatedFrom };
@@ -1697,6 +1773,8 @@ export async function updateTui(profile, targetVersion) {
1697
1773
  // who was already on it keeps their restart (their combo demonstrably
1698
1774
  // boots) and gets the repair hint on the next /update instead.
1699
1775
  const installedNow = installedTuiVersion();
1776
+ if (signal?.aborted)
1777
+ return { code: 130, updatedFrom };
1700
1778
  if (installedNow !== undefined && installedNow !== updatedFrom && isBootDeadlockTarget(installedNow)) {
1701
1779
  process.stderr.write(`dsh-tui: update landed on ${installedNow}, which can permanently deadlock boot under older launcher patches ` +
1702
1780
  `(#183/#307) — NOT restarting into it. Repair with:\n` +
@@ -1711,8 +1789,16 @@ export async function updateTui(profile, targetVersion) {
1711
1789
  // a mixed state and hand the user the exact repair command instead.
1712
1790
  if (targetVersion !== undefined) {
1713
1791
  let installed = installedTuiVersion();
1792
+ if (signal?.aborted)
1793
+ return { code: 130, updatedFrom };
1714
1794
  if (installed !== targetVersion) {
1715
- await runProcess(dsh, ['plugin', '--profile', profile, 'install'], { shell: true });
1795
+ const repairCode = await runProcess(dsh, ['plugin', '--profile', profile, 'install'], { shell: true, signal, onCleanupError });
1796
+ if (cleanupUnconfirmed)
1797
+ return { code: repairCode || 1, updatedFrom };
1798
+ if (signal?.aborted)
1799
+ return { code: 130, updatedFrom };
1800
+ if (repairCode !== 0)
1801
+ return { code: repairCode, updatedFrom };
1716
1802
  installed = installedTuiVersion();
1717
1803
  }
1718
1804
  if (installed !== targetVersion) {
@@ -1726,10 +1812,13 @@ export async function updateTui(profile, targetVersion) {
1726
1812
  // delegating shim — stamp it over the global launcher so this is the LAST
1727
1813
  // time the outer copy can lag. Best-effort; the alignment warning stays as
1728
1814
  // the fallback when the copy is impossible.
1815
+ if (signal?.aborted)
1816
+ return { code: 130, updatedFrom };
1729
1817
  if (migrateGlobalLauncher()) {
1730
1818
  process.stderr.write('dsh-tui: global launcher aligned to the delegating shim (no manual npm i -g needed anymore).\n');
1731
1819
  }
1732
- return { code: 0, updatedFrom, installed: installedTuiVersion() };
1820
+ const installed = installedTuiVersion();
1821
+ return { code: signal?.aborted ? 130 : 0, updatedFrom, installed };
1733
1822
  }
1734
1823
  /**
1735
1824
  * Update the installed dsh-tui package and restart the same launcher while
@@ -1752,11 +1841,13 @@ export async function updateTui(profile, targetVersion) {
1752
1841
  */
1753
1842
  export async function updateTuiAndRestart(sessionId, profile, targetVersion, kernel,
1754
1843
  /** The standalone entry's supervision hooks (TuiRestartOptions.onSpawn / onTerminationSignal). */
1755
- supervision = {}) {
1756
- const outcome = await updateTui(profile, targetVersion);
1844
+ supervision = {}, signal) {
1845
+ const outcome = await updateTui(profile, targetVersion, signal);
1757
1846
  const { updatedFrom } = outcome;
1758
1847
  if (outcome.code !== 0)
1759
1848
  return { updateCode: outcome.code, restartCode: outcome.code };
1849
+ if (signal?.aborted)
1850
+ return { updateCode: 130, restartCode: 130 };
1760
1851
  // Restart through the same hardened handoff as /restart (issues
1761
1852
  // #284/#307/#483): wait for the replacement's natural exit (the outer
1762
1853
  // interpreter must not reclaim the console under it), re-assert the