@deepseek-harness-tui/dsh-tui 0.16.1 → 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 (394) hide show
  1. package/README.md +208 -31
  2. package/assets/plugin-icon.svg +13 -0
  3. package/assets/windows-installer.cs +308 -0
  4. package/assets/windows-installer.ps1 +17 -0
  5. package/bin/dsh-tui.js +64 -5
  6. package/cli/adapters/dsh/index.mjs +111 -0
  7. package/cli/adapters/dsh/locate.mjs +73 -0
  8. package/cli/adapters/dsh/management-plugin.mjs +111 -0
  9. package/cli/args.mjs +154 -0
  10. package/cli/contracts.d.ts +48 -0
  11. package/cli/engine.mjs +92 -0
  12. package/cli/entry.mjs +48 -0
  13. package/cli/process.mjs +118 -0
  14. package/cli/protocol.mjs +23 -0
  15. package/cli/schema-v1.json +33 -0
  16. package/cordis.patch.yml +3 -1
  17. package/cordis.yml +3 -1
  18. package/guide/dsh-tui-guide/SKILL.md +1 -0
  19. package/guide/dsh-tui-guide/cli.en.md +114 -0
  20. package/guide/dsh-tui-guide/cli.md +114 -0
  21. package/guide/dsh-tui-guide/configuration.en.md +6 -5
  22. package/guide/dsh-tui-guide/configuration.md +6 -5
  23. package/guide/dsh-tui-guide/getting-started.en.md +27 -1
  24. package/guide/dsh-tui-guide/getting-started.md +19 -1
  25. package/guide/dsh-tui-guide/interaction.en.md +22 -10
  26. package/guide/dsh-tui-guide/interaction.md +18 -8
  27. package/guide/dsh-tui-guide/plugins.en.md +35 -4
  28. package/guide/dsh-tui-guide/plugins.md +23 -2
  29. package/guide/dsh-tui-guide/user-guide.en.md +30 -23
  30. package/guide/dsh-tui-guide/user-guide.md +29 -22
  31. package/lib/settings.json +83 -40
  32. package/lib/types/adapter/channel/plugins.d.ts.map +1 -1
  33. package/lib/types/adapter/channel/plugins.js +8 -0
  34. package/lib/types/adapter/channel/ui-policy.d.ts +1 -1
  35. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  36. package/lib/types/adapter/channel/ui-policy.js +3 -0
  37. package/lib/types/adapter/ports/channel-display.d.ts +10 -0
  38. package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
  39. package/lib/types/adapter/ports/channel-session.d.ts +2 -0
  40. package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
  41. package/lib/types/adapter/ports/channel-settings.d.ts +20 -0
  42. package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
  43. package/lib/types/adapter/ports/channel-ui.d.ts +17 -2
  44. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  45. package/lib/types/adapter/ports/channel-view.d.ts +8 -1
  46. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  47. package/lib/types/adapter/ports/channel.d.ts +7 -0
  48. package/lib/types/adapter/ports/channel.d.ts.map +1 -1
  49. package/lib/types/agent/capabilities.d.ts +2 -0
  50. package/lib/types/agent/capabilities.d.ts.map +1 -1
  51. package/lib/types/agent/events.d.ts +8 -0
  52. package/lib/types/agent/events.d.ts.map +1 -1
  53. package/lib/types/api.d.ts +2 -2
  54. package/lib/types/api.d.ts.map +1 -1
  55. package/lib/types/backends/claude/translate/events.d.ts.map +1 -1
  56. package/lib/types/backends/claude/translate/events.js +2 -1
  57. package/lib/types/backends/codex/auth/status.js +1 -1
  58. package/lib/types/backends/codex/session/controls.d.ts.map +1 -1
  59. package/lib/types/backends/codex/session/controls.js +6 -5
  60. package/lib/types/backends/codex/session/goals.d.ts.map +1 -1
  61. package/lib/types/backends/codex/session/side-query.d.ts.map +1 -1
  62. package/lib/types/backends/codex/translate/events.d.ts.map +1 -1
  63. package/lib/types/backends/codex/translate/events.js +3 -1
  64. package/lib/types/backends/shared/channel-tokens.d.ts.map +1 -1
  65. package/lib/types/backends/shared/channel-tokens.js +9 -8
  66. package/lib/types/channel/history-restore.d.ts.map +1 -1
  67. package/lib/types/channel/history-restore.js +2 -0
  68. package/lib/types/channel/interaction.d.ts.map +1 -1
  69. package/lib/types/channel/interaction.js +1 -0
  70. package/lib/types/channel/projection.d.ts +1 -1
  71. package/lib/types/channel/projection.d.ts.map +1 -1
  72. package/lib/types/channel/projection.js +19 -4
  73. package/lib/types/channel/questions.d.ts +2 -0
  74. package/lib/types/channel/questions.d.ts.map +1 -1
  75. package/lib/types/channel/sanitize.d.ts +14 -0
  76. package/lib/types/channel/sanitize.d.ts.map +1 -1
  77. package/lib/types/channel/sanitize.js +55 -0
  78. package/lib/types/channel/working-directory.d.ts +9 -0
  79. package/lib/types/channel/working-directory.d.ts.map +1 -0
  80. package/lib/types/channel/working-directory.js +7 -0
  81. package/lib/types/commands.d.ts +8 -1
  82. package/lib/types/commands.d.ts.map +1 -1
  83. package/lib/types/commands.js +13 -4
  84. package/lib/types/components/ChatTitle.d.ts +7 -0
  85. package/lib/types/components/ChatTitle.d.ts.map +1 -0
  86. package/lib/types/components/ChatTitle.js +15 -0
  87. package/lib/types/components/CodeBlockFrame.d.ts.map +1 -1
  88. package/lib/types/components/CodeBlockFrame.js +10 -5
  89. package/lib/types/components/CompactionStatusRow.d.ts.map +1 -1
  90. package/lib/types/components/CompactionStatusRow.js +24 -3
  91. package/lib/types/components/GoalTodoPanel.d.ts +3 -1
  92. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  93. package/lib/types/components/GoalTodoPanel.js +2 -2
  94. package/lib/types/components/Markdown.d.ts +9 -1
  95. package/lib/types/components/Markdown.d.ts.map +1 -1
  96. package/lib/types/components/Markdown.js +5 -4
  97. package/lib/types/components/MessageList.d.ts.map +1 -1
  98. package/lib/types/components/MessageList.js +17 -12
  99. package/lib/types/components/PromptInput.d.ts +13 -5
  100. package/lib/types/components/PromptInput.d.ts.map +1 -1
  101. package/lib/types/components/PromptInput.js +189 -107
  102. package/lib/types/components/SplitDiffView.d.ts.map +1 -1
  103. package/lib/types/components/SplitDiffView.js +232 -22
  104. package/lib/types/components/SubagentDetailScene.d.ts +3 -1
  105. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  106. package/lib/types/components/SubagentDetailScene.js +5 -1
  107. package/lib/types/components/Whale.d.ts.map +1 -1
  108. package/lib/types/components/Whale.js +8 -5
  109. package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
  110. package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
  111. package/lib/types/components/approvals/ApprovalPanel.js +93 -11
  112. package/lib/types/components/bigfont.d.ts.map +1 -1
  113. package/lib/types/components/bigfont.js +2 -1
  114. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  115. package/lib/types/components/messages/AssistantToolUseMessage.js +13 -6
  116. package/lib/types/components/previewRows.d.ts +19 -0
  117. package/lib/types/components/previewRows.d.ts.map +1 -0
  118. package/lib/types/components/previewRows.js +46 -0
  119. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  120. package/lib/types/components/questions/AskUserQuestionPanel.js +75 -10
  121. package/lib/types/components/sessions/ForeignSessionRow.d.ts +3 -9
  122. package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -1
  123. package/lib/types/components/sessions/ForeignSessionRow.js +6 -10
  124. package/lib/types/components/sessions/SessionListRow.d.ts +4 -9
  125. package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
  126. package/lib/types/components/sessions/SessionListRow.js +18 -10
  127. package/lib/types/components/sidePanel/InfoPanel.d.ts.map +1 -1
  128. package/lib/types/components/sidePanel/InfoPanel.js +4 -3
  129. package/lib/types/components/sidePanel/SidePanelLayout.d.ts.map +1 -1
  130. package/lib/types/components/sidePanel/SidePanelLayout.js +5 -5
  131. package/lib/types/components/sidePanel/WorkspacePanel.d.ts.map +1 -1
  132. package/lib/types/components/sidePanel/WorkspacePanel.js +19 -7
  133. package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
  134. package/lib/types/components/sidePanel/builtinPanels.js +22 -16
  135. package/lib/types/components/sidePanel/companion/CompanionPanel.d.ts.map +1 -1
  136. package/lib/types/components/sidePanel/companion/CompanionPanel.js +2 -1
  137. package/lib/types/components/sidePanel/panelMarkdown.d.ts +32 -0
  138. package/lib/types/components/sidePanel/panelMarkdown.d.ts.map +1 -0
  139. package/lib/types/components/sidePanel/panelMarkdown.js +45 -0
  140. package/lib/types/components/sidePanel/pluginPanelAdapter.d.ts.map +1 -1
  141. package/lib/types/components/sidePanel/pluginPanelAdapter.js +6 -1
  142. package/lib/types/components/sidePanel/subagentFailureRead.d.ts +21 -0
  143. package/lib/types/components/sidePanel/subagentFailureRead.d.ts.map +1 -0
  144. package/lib/types/components/sidePanel/subagentFailureRead.js +66 -0
  145. package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
  146. package/lib/types/components/sidePanel/useSidePanel.js +24 -6
  147. package/lib/types/components/trajectory/MiniWake.d.ts +2 -2
  148. package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
  149. package/lib/types/components/trajectory/MiniWake.js +7 -3
  150. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
  151. package/lib/types/components/workspaces/HomeWorkspaceRow.js +4 -7
  152. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  153. package/lib/types/dsh-adapter/backend/translate.js +11 -1
  154. package/lib/types/dsh-adapter/backend-admission.d.ts +3 -3
  155. package/lib/types/dsh-adapter/channel/binding-events.d.ts +5 -1
  156. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  157. package/lib/types/dsh-adapter/channel/binding-events.js +18 -1
  158. package/lib/types/dsh-adapter/channel/command-completions.d.ts.map +1 -1
  159. package/lib/types/dsh-adapter/channel/command-completions.js +6 -8
  160. package/lib/types/dsh-adapter/channel/composer-images.d.ts +9 -1
  161. package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
  162. package/lib/types/dsh-adapter/channel/composer-images.js +111 -111
  163. package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
  164. package/lib/types/dsh-adapter/channel/composer-mentions.js +16 -10
  165. package/lib/types/dsh-adapter/channel/core/actions.d.ts +1 -1
  166. package/lib/types/dsh-adapter/channel/core/actions.d.ts.map +1 -1
  167. package/lib/types/dsh-adapter/channel/core/actions.js +23 -2
  168. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +4 -1
  169. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
  170. package/lib/types/dsh-adapter/channel/core/binding-feed.js +13 -2
  171. package/lib/types/dsh-adapter/channel/core/compose.d.ts +4 -1
  172. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  173. package/lib/types/dsh-adapter/channel/core/compose.js +2 -0
  174. package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
  175. package/lib/types/dsh-adapter/channel/core/files.js +2 -1
  176. package/lib/types/dsh-adapter/channel/core/host.d.ts +14 -10
  177. package/lib/types/dsh-adapter/channel/core/host.d.ts.map +1 -1
  178. package/lib/types/dsh-adapter/channel/core/host.js +192 -13
  179. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts +1 -0
  180. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
  181. package/lib/types/dsh-adapter/channel/core/local-actions.js +32 -3
  182. package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
  183. package/lib/types/dsh-adapter/channel/extensions.js +31 -5
  184. package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
  185. package/lib/types/dsh-adapter/channel/input-actions.js +4 -0
  186. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +4 -1
  187. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  188. package/lib/types/dsh-adapter/channel/input-delivery.js +24 -1
  189. package/lib/types/dsh-adapter/channel/model-actions.d.ts +1 -1
  190. package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
  191. package/lib/types/dsh-adapter/channel/model-actions.js +7 -1
  192. package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
  193. package/lib/types/dsh-adapter/channel/model-selection.js +6 -4
  194. package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
  195. package/lib/types/dsh-adapter/channel/session-fork.js +1 -0
  196. package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
  197. package/lib/types/dsh-adapter/channel/session-metadata.js +15 -2
  198. package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
  199. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  200. package/lib/types/dsh-adapter/channel/session-reset.js +4 -0
  201. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  202. package/lib/types/dsh-adapter/channel/session-resume.js +46 -33
  203. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  204. package/lib/types/dsh-adapter/channel/settings-host.js +10 -3
  205. package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
  206. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  207. package/lib/types/dsh-adapter/channel/state.js +2 -2
  208. package/lib/types/dsh-adapter/channel/types.d.ts +13 -1
  209. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  210. package/lib/types/dsh-adapter/compat/liveSession.d.ts +3 -3
  211. package/lib/types/dsh-adapter/compat/liveSession.js +3 -3
  212. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +1 -1
  213. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
  214. package/lib/types/dsh-adapter/compat/sessionLog.js +17 -1
  215. package/lib/types/dsh-adapter/contract.d.ts +6 -5
  216. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  217. package/lib/types/dsh-adapter/contract.js +7 -5
  218. package/lib/types/dsh-adapter/effect-ledger.d.ts +1 -1
  219. package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -1
  220. package/lib/types/dsh-adapter/effect-ledger.js +1 -0
  221. package/lib/types/dsh-adapter/experimental-bundles.d.ts +26 -0
  222. package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -0
  223. package/lib/types/dsh-adapter/experimental-bundles.js +11 -0
  224. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  225. package/lib/types/dsh-adapter/host-contract.js +1 -1
  226. package/lib/types/dsh-adapter/host-dsh.js +3 -3
  227. package/lib/types/dsh-adapter/index.d.ts +8 -4
  228. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  229. package/lib/types/dsh-adapter/index.js +9 -7
  230. package/lib/types/dsh-adapter/panels.d.ts +21 -7
  231. package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
  232. package/lib/types/dsh-adapter/panels.js +11 -56
  233. package/lib/types/dsh-adapter/plugin.d.ts +81 -0
  234. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  235. package/lib/types/dsh-adapter/plugin.js +318 -70
  236. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
  237. package/lib/types/dsh-adapter/plugins-info.js +65 -10
  238. package/lib/types/dsh-adapter/presets.d.ts +15 -6
  239. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  240. package/lib/types/dsh-adapter/presets.js +51 -12
  241. package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
  242. package/lib/types/dsh-adapter/process-exit.js +1 -1
  243. package/lib/types/dsh-adapter/session-tools.d.ts +34 -0
  244. package/lib/types/dsh-adapter/session-tools.d.ts.map +1 -0
  245. package/lib/types/dsh-adapter/session-tools.js +39 -0
  246. package/lib/types/dsh-adapter/settings-sections.d.ts +18 -1
  247. package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
  248. package/lib/types/dsh-adapter/settings-sections.js +73 -0
  249. package/lib/types/dsh-adapter/status.d.ts +88 -1
  250. package/lib/types/dsh-adapter/status.d.ts.map +1 -1
  251. package/lib/types/dsh-adapter/status.js +318 -3
  252. package/lib/types/dsh-adapter/team-mode.d.ts +42 -33
  253. package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
  254. package/lib/types/dsh-adapter/team-mode.js +76 -112
  255. package/lib/types/extensions.d.ts +1 -1
  256. package/lib/types/extensions.d.ts.map +1 -1
  257. package/lib/types/force-production-react.js +3 -3
  258. package/lib/types/i18n.d.ts +195 -52
  259. package/lib/types/i18n.d.ts.map +1 -1
  260. package/lib/types/i18n.js +96 -30
  261. package/lib/types/ink/colorize.d.ts +7 -1
  262. package/lib/types/ink/colorize.d.ts.map +1 -1
  263. package/lib/types/ink/colorize.js +29 -8
  264. package/lib/types/ink/components/App.d.ts +2 -1
  265. package/lib/types/ink/components/App.d.ts.map +1 -1
  266. package/lib/types/ink/components/App.js +10 -3
  267. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
  268. package/lib/types/ink/components/ScrollBox.js +1 -0
  269. package/lib/types/ink/dom.d.ts +1 -0
  270. package/lib/types/ink/dom.d.ts.map +1 -1
  271. package/lib/types/ink/hooks/use-program-status.d.ts +78 -0
  272. package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -0
  273. package/lib/types/ink/hooks/use-program-status.js +96 -0
  274. package/lib/types/ink/ink.d.ts +13 -4
  275. package/lib/types/ink/ink.d.ts.map +1 -1
  276. package/lib/types/ink/ink.js +119 -25
  277. package/lib/types/ink/output.d.ts +17 -2
  278. package/lib/types/ink/output.d.ts.map +1 -1
  279. package/lib/types/ink/output.js +85 -2
  280. package/lib/types/ink/parse-keypress.d.ts +1 -0
  281. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  282. package/lib/types/ink/parse-keypress.js +5 -4
  283. package/lib/types/ink/render-node-to-output.d.ts +2 -0
  284. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  285. package/lib/types/ink/render-node-to-output.js +79 -10
  286. package/lib/types/ink/root.d.ts +8 -0
  287. package/lib/types/ink/root.d.ts.map +1 -1
  288. package/lib/types/ink/root.js +12 -3
  289. package/lib/types/ink/screen.d.ts +11 -0
  290. package/lib/types/ink/screen.d.ts.map +1 -1
  291. package/lib/types/ink/screen.js +44 -0
  292. package/lib/types/ink/selection.d.ts +7 -2
  293. package/lib/types/ink/selection.d.ts.map +1 -1
  294. package/lib/types/ink/selection.js +187 -44
  295. package/lib/types/ink/shutdown-input.d.ts +15 -0
  296. package/lib/types/ink/shutdown-input.d.ts.map +1 -0
  297. package/lib/types/ink/shutdown-input.js +28 -0
  298. package/lib/types/ink/sixel-cursor-heal.d.ts +21 -0
  299. package/lib/types/ink/sixel-cursor-heal.d.ts.map +1 -0
  300. package/lib/types/ink/sixel-cursor-heal.js +62 -0
  301. package/lib/types/ink/sixel-graphics.d.ts +6 -0
  302. package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
  303. package/lib/types/ink/sixel-graphics.js +18 -0
  304. package/lib/types/ink/styles.d.ts +8 -1
  305. package/lib/types/ink/styles.d.ts.map +1 -1
  306. package/lib/types/ink/terminal-notification-windows.d.ts +195 -0
  307. package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -0
  308. package/lib/types/ink/terminal-notification-windows.js +433 -0
  309. package/lib/types/ink/terminal-notification.d.ts +3 -1
  310. package/lib/types/ink/terminal-notification.d.ts.map +1 -1
  311. package/lib/types/ink/terminal-notification.js +4 -1
  312. package/lib/types/ink/terminal-querier.d.ts +9 -1
  313. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  314. package/lib/types/ink/terminal-querier.js +32 -1
  315. package/lib/types/ink/terminal.d.ts +23 -2
  316. package/lib/types/ink/terminal.d.ts.map +1 -1
  317. package/lib/types/ink/terminal.js +32 -2
  318. package/lib/types/ink/termio/osc.d.ts +2 -1
  319. package/lib/types/ink/termio/osc.d.ts.map +1 -1
  320. package/lib/types/ink/termio/osc.js +37 -8
  321. package/lib/types/ink/termio/osc7501.d.ts +102 -0
  322. package/lib/types/ink/termio/osc7501.d.ts.map +1 -0
  323. package/lib/types/ink/termio/osc7501.js +229 -0
  324. package/lib/types/ink/termio/tokenize.js +5 -7
  325. package/lib/types/panels.d.ts +1 -1
  326. package/lib/types/panels.d.ts.map +1 -1
  327. package/lib/types/screens/AgentTranscriptScene.d.ts +3 -1
  328. package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
  329. package/lib/types/screens/AgentTranscriptScene.js +5 -1
  330. package/lib/types/screens/Chat.d.ts +6 -6
  331. package/lib/types/screens/Chat.d.ts.map +1 -1
  332. package/lib/types/screens/Chat.js +304 -111
  333. package/lib/types/screens/Launchpad.d.ts +8 -2
  334. package/lib/types/screens/Launchpad.d.ts.map +1 -1
  335. package/lib/types/screens/Launchpad.js +32 -12
  336. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  337. package/lib/types/screens/SessionSupervisor.js +31 -21
  338. package/lib/types/screens/Settings.d.ts +5 -1
  339. package/lib/types/screens/Settings.d.ts.map +1 -1
  340. package/lib/types/screens/Settings.js +528 -51
  341. package/lib/types/screens/StatusLine.d.ts +9 -3
  342. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  343. package/lib/types/screens/StatusLine.js +91 -15
  344. package/lib/types/screens/StatusMetrics.d.ts +2 -11
  345. package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
  346. package/lib/types/screens/StatusMetrics.js +20 -14
  347. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
  348. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +1 -1
  349. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +1 -1
  350. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
  351. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +13 -21
  352. package/lib/types/sessionMounts.d.ts +14 -0
  353. package/lib/types/sessionMounts.d.ts.map +1 -1
  354. package/lib/types/sessionMounts.js +20 -9
  355. package/lib/types/sessions/format.d.ts +39 -0
  356. package/lib/types/sessions/format.d.ts.map +1 -1
  357. package/lib/types/sessions/format.js +83 -0
  358. package/lib/types/sessions/resumeFailure.d.ts +4 -0
  359. package/lib/types/sessions/resumeFailure.d.ts.map +1 -1
  360. package/lib/types/sessions/resumeFailure.js +12 -4
  361. package/lib/types/sessions/workspaceCounts.d.ts +6 -0
  362. package/lib/types/sessions/workspaceCounts.d.ts.map +1 -0
  363. package/lib/types/sessions/workspaceCounts.js +24 -0
  364. package/lib/types/settings/definitions.d.ts +24 -0
  365. package/lib/types/settings/definitions.d.ts.map +1 -1
  366. package/lib/types/settings/definitions.js +38 -13
  367. package/lib/types/tips.js +2 -2
  368. package/lib/types/tuiDisplayPrefs.d.ts +113 -5
  369. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  370. package/lib/types/tuiDisplayPrefs.js +276 -14
  371. package/lib/types/update.d.ts +15 -14
  372. package/lib/types/update.d.ts.map +1 -1
  373. package/lib/types/update.js +163 -115
  374. package/lib/types/updateProcess.d.ts +28 -0
  375. package/lib/types/updateProcess.d.ts.map +1 -0
  376. package/lib/types/updateProcess.js +135 -0
  377. package/lib/types/utils/inputWordBoundary.d.ts +5 -0
  378. package/lib/types/utils/inputWordBoundary.d.ts.map +1 -0
  379. package/lib/types/utils/inputWordBoundary.js +18 -0
  380. package/lib/types/utils/keymap.d.ts +1 -1
  381. package/lib/types/utils/keymap.d.ts.map +1 -1
  382. package/lib/types/utils/keymap.js +6 -1
  383. package/lib/types/windowsInstaller.d.ts +4 -0
  384. package/lib/types/windowsInstaller.d.ts.map +1 -0
  385. package/lib/types/windowsInstaller.js +237 -0
  386. package/locale/en.json +6 -0
  387. package/locale/zh.json +6 -0
  388. package/package.json +127 -111
  389. package/presets/liangshen/custom-bash.mjs +13 -1
  390. package/presets/liangshen/instruction-hint.mjs +4 -1
  391. package/presets/liangshen/skill-search.mjs +14 -2
  392. package/presets/winbash.mjs +16 -4
  393. package/tui-profile/feed/README.md +17 -8
  394. package/tui-profile/feed/first-party.json +1 -1
@@ -419,6 +419,7 @@ export function createCoreChannel(ctx, initialSession, options, owner) {
419
419
  const ref = binding.session.ref;
420
420
  return { backendId: ref.backendId, sessionId: ref.sessionId };
421
421
  },
422
+ get liveTurnEnds() { return feed.liveTurnEnds(); },
422
423
  costReport: undefined,
423
424
  rateLimit: undefined,
424
425
  get olderHistory() {
@@ -780,6 +781,7 @@ export function createCoreChannel(ctx, initialSession, options, owner) {
780
781
  state.costReport = undefined;
781
782
  state.lastUsage = undefined;
782
783
  state.turnUsage = undefined;
784
+ state.turnOutcome = undefined;
783
785
  state.contextSegments = { system: 0, prompt: 0, assistant: 0, thinking: 0, tools: 0 };
784
786
  state.activeToolCount = 0;
785
787
  state.responseChars = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/channel/core/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEzC,mEAAmE;AACnE,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,IAAI,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACnG,KAAK,EAAE;QACL,cAAc,IAAI,IAAI,CAAA;QACtB,UAAU,IAAI,SAAS,qBAAqB,EAAE,CAAA;QAC9C,iBAAiB,IAAI,IAAI,CAAA;QACzB,aAAa,IAAI,SAAS;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,OAAO,CAAA;SAAE,EAAE,CAAA;QACpG,gBAAgB,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AAC;YAAmB,CAAC;;;IA2D3E,qEAAqE;gCACzC,iBAAiB,GAAG,YAAY,CAAC,oBAAoB,CAAC;EAYrF"}
@@ -2,6 +2,7 @@ import { createCommandCompletions } from '../command-completions.js';
2
2
  import { createFileActions } from '../file-actions.js';
3
3
  import { createLocalFs } from '../local-fs.js';
4
4
  import { mentionFs } from '../mentions.js';
5
+ import { sessionWorkingDirectory } from '../../../channel/working-directory.js';
5
6
  /** No argument catalogs: the tree offers its static nodes only. */
6
7
  export const NO_COMPLETION_CATALOG = {
7
8
  workspaceCommands: () => [],
@@ -23,7 +24,7 @@ export function createCoreFiles(ctx, deps) {
23
24
  owner: deps.owner,
24
25
  capture: () => deps.binding.capture(),
25
26
  current: capture => deps.binding.isCurrent(capture),
26
- cwd: () => deps.state().cwd,
27
+ cwd: () => sessionWorkingDirectory(deps.state()),
27
28
  fs,
28
29
  });
29
30
  return {
@@ -1,11 +1,3 @@
1
- /**
2
- * Host seams every channel composition reads: the optional Cordis service
3
- * rows (themes, workspaces, command trees, scenes, settings sections,
4
- * custom-entry renderers), the default-deny decision gate with its
5
- * dispatch-topology marker, the runtime subscriptions that re-render on host
6
- * changes, and the git-branch breadcrumb. Each lookup degrades when its row
7
- * is not mounted, whatever backend serves the session.
8
- */
9
1
  import type { AdapterRuntimeOptions } from '../../../adapter/kernel/runtime.js';
10
2
  import { readGrantStore } from '../../../adapter/standard/grants.js';
11
3
  import { getHostCommandTrees } from '../../command-trees.js';
@@ -50,10 +42,22 @@ export declare function startHostSubscriptions(host: Pick<CoreHost, 'settingsSec
50
42
  * (best-effort, through the host `shell` service). Re-run when an adoption
51
43
  * lands on a different cwd (/resume, /workspace, issue #96) so the
52
44
  * breadcrumb never shows the previous workspace's branch.
45
+ *
46
+ * Adoption is not the only way the branch changes: a checkout in another
47
+ * terminal has to be seen through the workspace's own `.git/HEAD`, whose text
48
+ * is re-probed when it changes. Polling rather than `fs.watch` follows the
49
+ * grant store (a watcher can outlive a replaced inode, and `gitdir:`
50
+ * indirection, network mounts and watch limits each need their own fallback);
51
+ * the text is the signature, not the mtime, because timestamp granularity
52
+ * differs per filesystem while HEAD is well under 100 bytes.
53
+ *
54
+ * Where the host shell runs elsewhere (remote or sandboxed workspace), this
55
+ * process's `.git` is not the workspace's: with no HEAD to anchor on the poll
56
+ * stays quiet instead of clearing a value it cannot verify.
53
57
  */
54
58
  export declare function createGitBranchRefresher(ctx: ServiceLookup, deps: {
55
- owner: Pick<ChannelOwner, 'current'>;
56
- state: Pick<ChannelState, 'cwd' | 'gitBranch' | 'emit'>;
59
+ owner: Pick<ChannelOwner, 'current' | 'own'>;
60
+ state: Pick<ChannelState, 'cwd' | 'workingDirectory' | 'gitBranch' | 'emit'>;
57
61
  /** Record the resolved branch against the bound session (the session
58
62
  * browser's branch column); absent = nothing records it. */
59
63
  noteBranch?(branch: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/channel/core/host.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAA8B,MAAM,wBAAwB,CAAA;AAGxF,OAAO,EAAE,gBAAgB,EAA2B,MAAM,oBAAoB,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAwB,MAAM,iBAAiB,CAAA;AAC3E,OAAO,EAAE,uBAAuB,EAAmC,MAAM,4BAA4B,CAAA;AACrG,OAAO,EAAE,aAAa,EAAwB,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAA4B,MAAM,qBAAqB,CAAA;AACpH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO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,CA8Hb"}
@@ -1,4 +1,15 @@
1
+ /**
2
+ * Host seams every channel composition reads: the optional Cordis service
3
+ * rows (themes, workspaces, command trees, scenes, settings sections,
4
+ * custom-entry renderers), the default-deny decision gate with its
5
+ * dispatch-topology marker, the runtime subscriptions that re-render on host
6
+ * changes, and the git-branch breadcrumb. Each lookup degrades when its row
7
+ * is not mounted, whatever backend serves the session.
8
+ */
9
+ import { readlink, realpath, stat } from 'node:fs/promises';
10
+ import { dirname, join, resolve } from 'node:path';
1
11
  import { readGrantStore } from '../../../adapter/standard/grants.js';
12
+ import { readBoundedRegularFile } from '../../../utils/pastedImagePath.js';
2
13
  import { getHostCommandTrees } from '../../command-trees.js';
3
14
  import { runForegroundShell } from '../../compat/shell.js';
4
15
  import { getHostGrantStore } from '../../host-grants.js';
@@ -7,6 +18,7 @@ import { getHostSceneRuntime } from '../../scenes.js';
7
18
  import { getHostSettingsSections } from '../../settings-sections.js';
8
19
  import { getHostThemes } from '../../themes.js';
9
20
  import { createLocalWorkspaceRuntime, getHostWorkspaceRuntime } from '../../workspaces.js';
21
+ import { sessionWorkingDirectory } from '../../../channel/working-directory.js';
10
22
  /**
11
23
  * Resolve the host seams and install the decision gate. The topology marker
12
24
  * is effectful state, so it is owned at acquisition: a later construction
@@ -109,42 +121,209 @@ export function startHostSubscriptions(host, owner, state, services) {
109
121
  if (unwatch !== undefined)
110
122
  owner.own(unwatch);
111
123
  }
124
+ /** How often the workspace HEAD is read for a signature change. */
125
+ const BRANCH_HEAD_POLL_MS = 1000;
126
+ /** Ample room for long UTF-8 refs/gitdir paths without unbounded control-file reads. */
127
+ const GIT_METADATA_MAX_BYTES = 128 * 1024;
128
+ /**
129
+ * The `HEAD` file of the repository containing `cwd` (a linked worktree or a
130
+ * submodule points at its git dir through a `gitdir:` line in `.git`), or
131
+ * undefined when this process cannot see one. Reached from the timer path, so
132
+ * it answers rather than throws: a missing or malformed `.git` lands on
133
+ * undefined and leaves the poll silent.
134
+ */
135
+ async function gitHeadPath(cwd) {
136
+ try {
137
+ let dir = await realpath(cwd);
138
+ for (;;) {
139
+ const dotGit = join(dir, '.git');
140
+ const entry = await stat(dotGit).catch((error) => {
141
+ if (error.code === 'ENOENT' || error.code === 'ENOTDIR')
142
+ return undefined;
143
+ throw error;
144
+ });
145
+ if (entry?.isDirectory())
146
+ return join(dotGit, 'HEAD');
147
+ if (entry?.isFile()) {
148
+ const target = /^gitdir:\s*(.+)$/m.exec(await readGitMetadata(dotGit) ?? '')?.[1];
149
+ // Git records the target relative to the directory holding `.git`.
150
+ if (target === undefined)
151
+ return undefined;
152
+ return join(resolve(dirname(dotGit), target.trim()), 'HEAD');
153
+ }
154
+ if (entry !== undefined)
155
+ return undefined;
156
+ const parent = dirname(dir);
157
+ if (parent === dir)
158
+ return undefined;
159
+ dir = parent;
160
+ }
161
+ }
162
+ catch {
163
+ return undefined;
164
+ }
165
+ }
166
+ /** Small, regular Git control files only; unreadable metadata stays best-effort. */
167
+ async function readGitMetadata(path) {
168
+ if (path === undefined)
169
+ return undefined;
170
+ try {
171
+ return Buffer.from(await readBoundedRegularFile(path, GIT_METADATA_MAX_BYTES)).toString('utf8');
172
+ }
173
+ catch {
174
+ return undefined;
175
+ }
176
+ }
112
177
  /**
113
178
  * Statusline breadcrumb: the current git branch of the session cwd
114
179
  * (best-effort, through the host `shell` service). Re-run when an adoption
115
180
  * lands on a different cwd (/resume, /workspace, issue #96) so the
116
181
  * breadcrumb never shows the previous workspace's branch.
182
+ *
183
+ * Adoption is not the only way the branch changes: a checkout in another
184
+ * terminal has to be seen through the workspace's own `.git/HEAD`, whose text
185
+ * is re-probed when it changes. Polling rather than `fs.watch` follows the
186
+ * grant store (a watcher can outlive a replaced inode, and `gitdir:`
187
+ * indirection, network mounts and watch limits each need their own fallback);
188
+ * the text is the signature, not the mtime, because timestamp granularity
189
+ * differs per filesystem while HEAD is well under 100 bytes.
190
+ *
191
+ * Where the host shell runs elsewhere (remote or sandboxed workspace), this
192
+ * process's `.git` is not the workspace's: with no HEAD to anchor on the poll
193
+ * stays quiet instead of clearing a value it cannot verify.
117
194
  */
118
195
  export function createGitBranchRefresher(ctx, deps) {
119
- return () => {
120
- const { state } = deps;
121
- state.gitBranch = undefined;
196
+ const { state } = deps;
197
+ /** The HEAD text the last probe was issued against. */
198
+ let signature;
199
+ /** Retry the same HEAD after transient failure, backing off to 30 seconds. */
200
+ let retryAfter;
201
+ let retryDelayMs = 0;
202
+ const retry = () => {
203
+ retryDelayMs = Math.min(retryDelayMs * 2 || BRANCH_HEAD_POLL_MS, 30_000);
204
+ retryAfter = performance.now() + retryDelayMs;
205
+ };
206
+ /** Tickets handed out to probes; only the newest holder may publish. */
207
+ let issued = 0;
208
+ /** Slow filesystem reads never accumulate more than one periodic sample. */
209
+ let polling = false;
210
+ const probe = async (clearFirst) => {
211
+ // Adoption clears first so a switch never shows the previous workspace's
212
+ // branch; a poll keeps the value, so an unrelated redraw during the round
213
+ // trip cannot paint a gap.
214
+ if (clearFirst) {
215
+ state.gitBranch = undefined;
216
+ signature = undefined;
217
+ retryAfter = undefined;
218
+ retryDelayMs = 0;
219
+ issued += 1;
220
+ }
221
+ const requestedCwd = sessionWorkingDirectory(state);
222
+ const readTicket = issued;
223
+ // Resolve on every sample: git init and a retargeted .git file can change
224
+ // the repository without changing cwd. Async reads leave the UI runnable.
225
+ const headPath = await gitHeadPath(requestedCwd);
226
+ // core.preferSymlinkRefs stores the symbolic ref in the HEAD link itself.
227
+ const link = headPath === undefined ? undefined : await readlink(headPath).catch(() => undefined);
228
+ const observed = link?.startsWith('refs/')
229
+ ? `ref: ${link}`
230
+ : (await readGitMetadata(headPath))?.trim();
231
+ if (readTicket !== issued || !deps.owner.current() || sessionWorkingDirectory(state) !== requestedCwd)
232
+ return;
233
+ if (!clearFirst) {
234
+ if (observed === undefined) {
235
+ // A previously visible HEAD disappeared. Invalidate pending replies;
236
+ // a workspace whose HEAD was never readable keeps its shell-only value.
237
+ if (signature === undefined)
238
+ return;
239
+ signature = undefined;
240
+ retryAfter = undefined;
241
+ retryDelayMs = 0;
242
+ issued += 1;
243
+ if (state.gitBranch === undefined)
244
+ return;
245
+ state.gitBranch = undefined;
246
+ state.emit();
247
+ return;
248
+ }
249
+ if (observed === signature && (retryAfter === undefined || performance.now() < retryAfter))
250
+ return;
251
+ }
252
+ // Baseline at issue time: a checkout landing while the shell runs still
253
+ // differs from it and triggers the next tick.
254
+ if (observed !== signature)
255
+ retryDelayMs = 0;
256
+ signature = observed;
257
+ retryAfter = undefined;
122
258
  const shell = ctx.get('shell');
123
- if (!shell)
259
+ if (!shell) {
260
+ // A missing service must not leave an older HEAD's ticket current.
261
+ issued += 1;
262
+ retry();
124
263
  return;
264
+ }
125
265
  // Capture the requested cwd: a /resume landing while this query is in
126
266
  // flight refreshes the branch for the new cwd, so a late reply from the
127
267
  // old workspace must be dropped (stale statusline, issue #96).
128
- const requestedCwd = state.cwd;
268
+ // Two probes can be in flight (the shell does not serialize them); only
269
+ // the newest one speaks for the workspace.
270
+ const ticket = clearFirst ? readTicket : ++issued;
129
271
  void runForegroundShell(shell, {
130
272
  command: 'git branch --show-current',
131
273
  workdir: requestedCwd,
132
274
  timeoutMs: 3000,
133
275
  })
134
276
  .then((result) => {
135
- if (!deps.owner.current() || state.cwd !== requestedCwd)
277
+ // A newer probe already speaks for the workspace and its baseline
278
+ // matches HEAD, so nothing would re-probe after this slower reply.
279
+ if (ticket !== issued)
280
+ return;
281
+ if (!deps.owner.current() || sessionWorkingDirectory(state) !== requestedCwd)
282
+ return;
283
+ // A timed-out probe reports whatever it captured, often nothing: that
284
+ // is not "no branch". Retain the value and retry this HEAD.
285
+ if (result.timedOut) {
286
+ retry();
136
287
  return;
288
+ }
137
289
  const branch = result.stdout.text.trim();
138
- if (branch !== '') {
139
- state.gitBranch = branch;
140
- deps.noteBranch?.(branch);
141
- state.emit();
290
+ // A B -> C -> B checkout can return C while both polls saw B. Compare
291
+ // the shell reply to the symbolic HEAD, not just two equal snapshots.
292
+ const expectedBranch = observed?.startsWith('ref:')
293
+ ? /^ref:\s+refs\/heads\/(.+)$/.exec(observed)?.[1]
294
+ : observed === undefined ? undefined : ''; // A detached HEAD has no branch.
295
+ if (expectedBranch !== undefined && branch !== expectedBranch) {
296
+ retry();
297
+ return;
142
298
  }
299
+ retryDelayMs = 0;
300
+ // A detached HEAD (or a cwd outside any repository) answers nothing:
301
+ // clear it, which is also what a cold start would show.
302
+ const next = branch === '' ? undefined : branch;
303
+ if (next === state.gitBranch)
304
+ return;
305
+ state.gitBranch = next;
306
+ // The session index records branches, never the absence of one.
307
+ if (next !== undefined)
308
+ deps.noteBranch?.(next);
309
+ state.emit();
143
310
  })
144
311
  .catch(() => {
145
- // Git branch detection is best-effort; on Windows the sandbox
146
- // backend may be unavailable (no confinement yet) or the cwd may
147
- // not be a git repo. Either way the statusline simply stays blank.
312
+ // Only the current probe may request a retry; an older rejection must
313
+ // not invalidate a successful newer result.
314
+ if (ticket === issued && deps.owner.current() && sessionWorkingDirectory(state) === requestedCwd)
315
+ retry();
148
316
  });
149
317
  };
318
+ const timer = setInterval(() => {
319
+ if (!deps.owner.current() || polling)
320
+ return;
321
+ polling = true;
322
+ // Only the filesystem sample is single-flight: a slow shell reply must
323
+ // not prevent a later tick from noticing another checkout or removal.
324
+ void probe(false).finally(() => { polling = false; });
325
+ }, BRANCH_HEAD_POLL_MS);
326
+ timer.unref?.();
327
+ deps.owner.own(() => clearInterval(timer));
328
+ return () => { void probe(true); };
150
329
  }
@@ -35,6 +35,7 @@ export declare function createCoreLocalActions(ctx: ServiceLookup, deps: {
35
35
  clear(): void;
36
36
  pushLocal(title: string, lines: readonly string[], options?: {
37
37
  readonly lineLimit?: number;
38
+ readonly preserveWhitespace?: boolean;
38
39
  }): void;
39
40
  setActivityFrames: (name: string) => boolean;
40
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"local-actions.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/channel/core/local-actions.ts"],"names":[],"mappings":"AAAA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;IAC9B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,2EAA2E;IAC3E,QAAQ,IAAI,IAAI,CAAA;IAChB;2DACuD;IACvD,SAAS,IAAI,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAAA;IACvC,kEAAkE;IAClE,UAAU,CAAC,IAAI,MAAM,IAAI,CAAA;CAC1B;iBAIgB,MAAM;aAQV,IAAI;qBAYI,MAAM,SAAS,SAAS,MAAM,EAAE,YAAY;QAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;8BAqBhH,MAAM,KAAG,OAAO;IAE1C;;;;OAIG;6BAC4B,MAAM,oBAAoB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;EA8CnF;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
@@ -4,7 +4,8 @@ import { writeActivityFrames } from '../../../activityPrefs.js';
4
4
  import { isPresetName, normalizeActivityPreset } from '../../../components/activityFrames.js';
5
5
  import { t } from '../../../i18n.js';
6
6
  import { runForegroundShell } from '../../compat/shell.js';
7
- import { LOCAL_OUTPUT_LIMIT, preview } from '../transcript.js';
7
+ import { LOCAL_OUTPUT_LIMIT, MAX_ROWS, preview } from '../transcript.js';
8
+ import { sessionWorkingDirectory } from '../../../channel/working-directory.js';
8
9
  /** `/activity frames <name>`: validate, persist, re-render. */
9
10
  export function setActivityFrames(state, notify, name) {
10
11
  // A retired preset id normalizes to the current default, so the
@@ -28,6 +29,18 @@ export function setActivityFrames(state, notify, name) {
28
29
  notify(t('activity-indicator-switched', { name: preset }));
29
30
  return true;
30
31
  }
32
+ /**
33
+ * One report line that keeps its shape: blank rows stay blank and leading
34
+ * indentation survives; a stray newline still cannot become a second row.
35
+ */
36
+ function previewIndented(text, limit) {
37
+ const line = text.replace(/[\r\n]+/gu, ' ').replace(/\s+$/u, '');
38
+ // A truly empty Text node measures as zero height; one no-break space keeps
39
+ // the blank row the report asked for without painting anything.
40
+ if (line === '')
41
+ return '\u00a0';
42
+ return line.length <= limit ? line : `${line.slice(0, limit)}…`;
43
+ }
31
44
  export function createCoreLocalActions(ctx, deps) {
32
45
  const { owner, binding, state, rowIds, notify } = deps;
33
46
  return {
@@ -55,9 +68,25 @@ export function createCoreLocalActions(ctx, deps) {
55
68
  // A report whose line IS the payload (the /goal objective) raises the
56
69
  // budget; every other report keeps the shared 240-cell preview.
57
70
  const limit = options?.lineLimit ?? LOCAL_OUTPUT_LIMIT;
71
+ const render = options?.preserveWhitespace ? previewIndented : preview;
72
+ // Local reports cannot be restored from backend history. Retain whole
73
+ // recent blocks within the existing row budget, without folding facts.
74
+ let count = state.rows.reduce((sum, row) => sum + Number(row.kind === 'local' || row.kind === 'local-output'), lines.length + 1);
75
+ for (let i = 0; count > MAX_ROWS && i < state.rows.length;) {
76
+ if (state.rows[i].kind !== 'local' && state.rows[i].kind !== 'local-output') {
77
+ i++;
78
+ continue;
79
+ }
80
+ let end = i + 1;
81
+ while (state.rows[end]?.kind === 'local-output')
82
+ end++;
83
+ count -= end - i;
84
+ state.rows.splice(i, end - i);
85
+ markChannelReadDirty(state.rows);
86
+ }
58
87
  state.rows.push({ id: rowIds.value++, kind: 'local', text: title });
59
88
  for (const line of lines)
60
- state.rows.push({ id: rowIds.value++, kind: 'local-output', text: preview(line, limit) });
89
+ state.rows.push({ id: rowIds.value++, kind: 'local-output', text: render(line, limit) });
61
90
  state.emit();
62
91
  },
63
92
  setActivityFrames: (name) => setActivityFrames(state, notify, name),
@@ -81,7 +110,7 @@ export function createCoreLocalActions(ctx, deps) {
81
110
  async function runLocal(command, includeInContext) {
82
111
  const capture = binding.capture();
83
112
  const current = () => owner.current() && binding.isCurrent(capture);
84
- const cwd = state.cwd;
113
+ const cwd = sessionWorkingDirectory(state);
85
114
  const target = deps.workspace.describe(cwd);
86
115
  state.rows.push({ id: rowIds.value++, kind: 'local', text: command, executionTarget: target.kind === 'local' ? target.badge : `${target.badge} · ${target.label}` });
87
116
  state.emit();
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAwB5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA4BpD,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAqBzE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,OAAO,EACZ,aAAa,EAAE,SAAS,EACxB,OAAO,EAAE,oBAAoB,GAC5B,IAAI,CA0vBN"}
1
+ {"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAyB5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA4BpD,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAsBzE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,OAAO,EACZ,aAAa,EAAE,SAAS,EACxB,OAAO,EAAE,oBAAoB,GAC5B,IAAI,CAmxBN"}
@@ -8,6 +8,7 @@ import { installedMeetsVersion } from '../contract.js';
8
8
  import { createDshSession } from '../backend/session.js';
9
9
  import { createDshTranslator, dshPricingWindow } from '../backend/translate.js';
10
10
  import { concreteService } from '../host-access.js';
11
+ import { teamServiceActive, withTeamCommandVisibility } from '../team-mode.js';
11
12
  import { getHostMessageObserver } from '../message-observer.js';
12
13
  import { createForeignBrowser } from '../migrate/browse.js';
13
14
  import { createPluginCompletionCatalog } from '../plugin-completions.js';
@@ -46,6 +47,7 @@ import { createSkillCatalog } from './skill-catalog.js';
46
47
  import { createSubagentProjection } from './subagent-projection.js';
47
48
  import { readChildTranscriptPage } from './subagent-transcript.js';
48
49
  import { DSH_BACKEND_LABEL } from './state.js';
50
+ import { sessionWorkingDirectory } from '../../channel/working-directory.js';
49
51
  import { ensureUpstreamRetry } from './upstream-retry.js';
50
52
  import { foldBack } from './transcript.js';
51
53
  import { createWorkspaceActions } from './workspace-actions.js';
@@ -206,10 +208,27 @@ export function attachDshExtensions(core, ctx, initialNative, options) {
206
208
  // service lookups, so both consumers may call it freely: the public
207
209
  // `capabilities()` accessor and the command-list annotation below.
208
210
  const capabilitiesOf = () => resolveAgentCapabilities(agentCapabilityEvidence(ctx, binding.agent));
211
+ // `/team` is gated on its service, not on a backend capability: Help and `/`
212
+ // completion read `commandList`, so this is the one catalog that can hide it
213
+ // while `agentTeams` is absent. Keep the unfiltered list so a later service
214
+ // mount restores the row without waiting for a skill-catalog refresh.
215
+ let commandBase = LOCAL_COMMANDS;
216
+ const publishCommandList = (commands, emit = true) => {
217
+ state.commandList = annotateCommandCapabilities(withTeamCommandVisibility(commands, teamServiceActive(ctx)), capabilitiesOf());
218
+ if (emit)
219
+ state.emit();
220
+ };
209
221
  // Annotated from the start: Help and `/` completion read `commandList`
210
222
  // before the first skill-catalog refresh publishes a new one, and a command
211
223
  // whose capability is missing must never look usable in that window.
212
- state.commandList = annotateCommandCapabilities(LOCAL_COMMANDS, capabilitiesOf());
224
+ publishCommandList(LOCAL_COMMANDS, false);
225
+ // The team service appears and disappears with its bundle (HMR, a CLI or
226
+ // Web write). Follow the same `internal/service` signal the team store reads,
227
+ // so the command catalog and the Help/`/` popup change with it.
228
+ owner.own(ctx.on('internal/service', ((name) => {
229
+ if (name === 'agentTeams')
230
+ publishCommandList(commandBase);
231
+ })));
213
232
  Object.defineProperty(state, 'autoRecapOnOpen', {
214
233
  configurable: true,
215
234
  enumerable: true,
@@ -383,13 +402,13 @@ export function attachDshExtensions(core, ctx, initialNative, options) {
383
402
  owner,
384
403
  commandService,
385
404
  agent: () => binding.agent,
386
- cwd: () => state.cwd,
405
+ cwd: () => sessionWorkingDirectory(state),
387
406
  setCommands(commands) {
388
407
  // Annotate before publishing: Help and `/` completion both read
389
408
  // `commandList`, so a command whose capability is missing says so
390
409
  // instead of looking usable and failing on use.
391
- state.commandList = annotateCommandCapabilities(commands, capabilitiesOf());
392
- state.emit();
410
+ commandBase = commands;
411
+ publishCommandList(commands);
393
412
  },
394
413
  commandDescriptions: name => commandTrees?.descriptions(name),
395
414
  // A skill gesture typed mid-turn stays immediate (steer at the next step
@@ -436,7 +455,7 @@ export function attachDshExtensions(core, ctx, initialNative, options) {
436
455
  const loadedContext = createLoadedContextRefresher(ctx, {
437
456
  owner,
438
457
  agent: () => binding.agent,
439
- cwd: () => state.cwd,
458
+ cwd: () => sessionWorkingDirectory(state),
440
459
  skillRegistryFor,
441
460
  skillViewOptions,
442
461
  publish(context) { state.loadedContext = context; state.emit(); },
@@ -530,6 +549,13 @@ export function attachDshExtensions(core, ctx, initialNative, options) {
530
549
  messageObserver,
531
550
  seedUpstreamRetry,
532
551
  retireAttachment: core.input.retireAttachment,
552
+ onWorkingDirectoryChange: () => {
553
+ // The 1s poll also re-probes the new directory; starting it here drops
554
+ // the stale-branch window on a move.
555
+ core.refreshGitBranch();
556
+ void refreshLoadedContext();
557
+ void refreshSkillCommands();
558
+ },
533
559
  });
534
560
  const sessionAdoption = createSessionAdoption(state, {
535
561
  binding,
@@ -1 +1 @@
1
- {"version":3,"file":"input-actions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/input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O,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC;AAC9E;+EAC+E;AAC/E,KAAK,GAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAmB,GAChD,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,OAAO,GAAG,eAAe,GAAG,QAAQ,GAAG,qBAAqB,GAAG,kBAAkB,GAAG,eAAe,GAAG,oBAAoB,CAAC,CA6U3J"}
@@ -103,6 +103,10 @@ touch = touchSession) {
103
103
  input.cancelInFlight = true;
104
104
  input.cancelCause = 'user';
105
105
  state.cancelPending = true;
106
+ // Publish the window: the UI needs to show that the interrupt was
107
+ // received (and its watchdog needs the state change) even when the
108
+ // abort never converges and no backend event follows.
109
+ state.emit();
106
110
  void session.cancel('user');
107
111
  },
108
112
  /** Esc with queued input while a turn runs (Claude Code parity: "Press
@@ -13,6 +13,9 @@ export interface UserTextOrigin {
13
13
  readonly agentId: string;
14
14
  readonly generation: number;
15
15
  readonly cwd: string;
16
+ /** Where `@` mentions resolve: the session's current directory, the same
17
+ * one the model-facing fs tools use (the project stays `cwd`). */
18
+ readonly workingDirectory: string;
16
19
  readonly fs: MentionFs | undefined;
17
20
  readonly attachments: MentionAttachments | undefined;
18
21
  /** The in-memory image store when the session takes images itself: the
@@ -31,7 +34,7 @@ export interface UserTextOrigin {
31
34
  /** Input FIFO, staged attachments and decision notice timers share one lifetime. */
32
35
  export declare function createInputDelivery(ctx: ChannelHost, owner: ChannelOwner, binding: {
33
36
  readonly session: AgentSession;
34
- }, state: () => Pick<ChannelState, 'cwd' | 'agentId' | 'agentBindingGeneration'>, notify: ChannelState['notify'], trackPending: (message: {
37
+ }, state: () => Pick<ChannelState, 'cwd' | 'workingDirectory' | 'agentId' | 'agentBindingGeneration'>, notify: ChannelState['notify'], trackPending: (message: {
35
38
  id: string;
36
39
  text: string;
37
40
  images?: readonly ComposerImageRef[];
@@ -1 +1 @@
1
- {"version":3,"file":"input-delivery.d.ts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AU,CAAC,EAAE,MAAM,SAAS,GAAG,SAAS;AACxC;8EAC8E;AAC9E,WAAW,CAAC,EAAE,MAAM,eAAe,GAAG,SAAS;AAC/C;;;;;GAKG;AACH,uBAAuB,CAAC,EAAE,MAAM,SAAS,eAAe,EAAE;6BA2UjD,MAAM,aACD,cAAc,CAAC,WAAW,CAAC,WAC9B,SAAS,gBAAgB,EAAE,WAC1B,WAAW,KACnB,IAAI;IAmCL;gEAC4D;oBAC9C;QAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;4BAlB9F,MAAM,aACD,cAAc,CAAC,WAAW,CAAC,WAC9B,SAAS,gBAAgB,EAAE,WAC1B,WAAW,KACnB,IAAI;iCA1U6B,SAAS,WAAW,EAAE,KAAG,WAAW,EAAE;kCAarC,MAAM,KAAG,IAAI;0BA0LrB,CAAC,QAAQ,MAAM,WAAW,OAAO,CAAC,CAAC,CAAC,WAAW,cAAc,KAAG,OAAO,CAAC,CAAC,CAAC;6BAuIzE,IAAI;wBAoBZ,gBAAgB,KAAG,OAAO,CAAC,MAAM,CAAC;wBACpC,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;;EAGzE"}
@@ -7,6 +7,7 @@ import { appendAttachedContextBlocks } from './attached-context.js';
7
7
  import { normalizeInputDecision } from './decisions.js';
8
8
  import { attachIdeSelection } from './ide-selection.js';
9
9
  import { mentionAttachments, mentionFs } from './mentions.js';
10
+ import { sessionWorkingDirectory } from '../../channel/working-directory.js';
10
11
  /** Input FIFO, staged attachments and decision notice timers share one lifetime. */
11
12
  export function createInputDelivery(ctx, owner, binding, state, notify, trackPending, untrackPending, composer, selection, rememberSelection,
12
13
  /** The fs surface to use when the host mounts no `fs` service (a non-DSH
@@ -103,6 +104,7 @@ consumeAttachedContexts) {
103
104
  agentId: state().agentId,
104
105
  generation: state().agentBindingGeneration,
105
106
  cwd: state().cwd,
107
+ workingDirectory: sessionWorkingDirectory(state()),
106
108
  fs: mentionFs(ctx) ?? fallbackFs?.(),
107
109
  attachments: local ?? mentionAttachments(ctx),
108
110
  ...(local === undefined ? {} : { localImages: local }),
@@ -130,7 +132,7 @@ consumeAttachedContexts) {
130
132
  if (stale !== undefined) {
131
133
  notify(t('input-image-token-stale', { token: stale }), { color: 'warning', timeoutMs: 5000 });
132
134
  }
133
- const expansion = await expandComposerMentions(origin.fs, origin.cwd, text, origin.attachments, orderedImages);
135
+ const expansion = await expandComposerMentions(origin.fs, origin.workingDirectory, text, origin.attachments, orderedImages);
134
136
  // Mention reads can park for arbitrary I/O. A session switch during that
135
137
  // await invalidates the whole submission; neither the old nor the new
136
138
  // agent may receive a message assembled for a different conversation.
@@ -181,8 +183,12 @@ consumeAttachedContexts) {
181
183
  if (attach !== undefined)
182
184
  attachedByMessageId.delete(message.id);
183
185
  untrackPending(message.id);
186
+ // A refusal with no reason is still a refusal: say so, or the send
187
+ // looks successful while nothing was queued.
184
188
  if (result.reason !== undefined && result.reason !== '')
185
189
  notify(result.reason, { color: 'warning', timeoutMs: 4000 });
190
+ else
191
+ notify(t('input-not-accepted'), { color: 'warning', timeoutMs: 4000 });
186
192
  return;
187
193
  }
188
194
  }
@@ -192,6 +198,23 @@ consumeAttachedContexts) {
192
198
  untrackPending(message.id);
193
199
  throw error;
194
200
  }
201
+ if (current(origin)) {
202
+ for (const { path, adjustment } of expansion.imageAdjustments ?? []) {
203
+ const detail = [];
204
+ if (adjustment.resized)
205
+ detail.push(t('input-image-detail-resized', { width: adjustment.width, height: adjustment.height }));
206
+ if (adjustment.mediaType !== adjustment.sourceMediaType) {
207
+ const from = adjustment.sourceMediaType.replace(/^image\//u, '').toUpperCase();
208
+ const to = adjustment.mediaType.replace(/^image\//u, '').toUpperCase();
209
+ detail.push(t(adjustment.flattened ? 'input-image-detail-converted-flattened' : 'input-image-detail-converted', { from, to }));
210
+ }
211
+ if (detail.length > 0)
212
+ notify(t('mentions-image-adjusted', { path, detail: detail.join(' · ') }), { timeoutMs: 5000 });
213
+ }
214
+ for (const { path, reason } of expansion.imageFailures ?? []) {
215
+ notify(t('mentions-image-failed', { path, reason }), { color: 'warning', timeoutMs: 5000 });
216
+ }
217
+ }
195
218
  if (expansion.attached.length > 0) {
196
219
  notify(t('mentions-attached', { count: expansion.attached.length }), { timeoutMs: 2500 });
197
220
  }