@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
@@ -3,6 +3,7 @@ import { t } from '../../i18n.js';
3
3
  import { runningPresetOf } from '../presets.js';
4
4
  import { agentCapabilityEvidence, resolveAgentCapabilities } from './capabilities.js';
5
5
  import { createSessionBatchRouter, createSessionBinder } from './core/binding-feed.js';
6
+ import { sessionWorkingDirectory } from '../../channel/working-directory.js';
6
7
  /**
7
8
  * Foreground transcript listeners capture a binding generation: the bound
8
9
  * `AgentSession`'s event batches feed the shared projector, and the DSH
@@ -107,7 +108,14 @@ export function createBindingEvents(ctx, deps) {
107
108
  deps.state.provider = selected.provider;
108
109
  deps.state.model = selected.model;
109
110
  }
110
- void deps.modelActions.applyPreferredEffort();
111
+ const recorded = deps.binding.agent.session.requestHeader?.()?.config;
112
+ // Reattachment keeps a live pin; an adopted header also owns the
113
+ // absence of a pin. A child on a different route still seeds normally.
114
+ const preserveSessionEffort = selected?.reasoningEffort !== undefined ||
115
+ (recorded?.provider === deps.state.provider && recorded?.model === deps.state.model);
116
+ if (preserveSessionEffort)
117
+ deps.state.reasoningEffort = selected === undefined ? recorded?.reasoningEffort : selected.reasoningEffort;
118
+ void deps.modelActions.applyPreferredEffort(preserveSessionEffort);
111
119
  deps.modeActions.refreshMode();
112
120
  // Same pattern as the preferred effort above: the remembered
113
121
  // permission preference seeds sessions that never chose their own.
@@ -132,6 +140,15 @@ export function createBindingEvents(ctx, deps) {
132
140
  deps.messageObserver?.publish(native.agent.session, event);
133
141
  deps.modeActions.onSessionEvent(native.agent.session, event);
134
142
  deps.jobs?.onSessionEvent(event);
143
+ if (event.type === 'working-directory/change') {
144
+ // The projector folds this event later in the same dispatch; only a
145
+ // move to a different directory refreshes.
146
+ const before = sessionWorkingDirectory(deps.state);
147
+ queueMicrotask(() => {
148
+ if (current() && sessionWorkingDirectory(deps.state) !== before)
149
+ deps.onWorkingDirectoryChange?.();
150
+ });
151
+ }
135
152
  }));
136
153
  },
137
154
  };
@@ -1 +1 @@
1
- {"version":3,"file":"command-completions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/command-completions.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAM1G,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAmC9C,wFAAwF;AACxF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,KAAK,EAAE,MAAM,YAAY,CAAA;IACzB,SAAS,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAA;IACjD,YAAY,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,qBAAqB,EAAE,CAAA;KAAE,CAAA;IACtF,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;4EACwE;IACxE,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5C,yEAAyE;IACzE,MAAM,CAAC,EAAE;QACP,eAAe,IAAI,IAAI,CAAA;QACvB,WAAW,IAAI,SAAS,qBAAqB,EAAE,CAAA;KAChD,CAAA;IACD,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,IAAI,IAAI,CAAA;KACzB,CAAA;CACF,IAES,OAAO,MAAM,qDAiJtB"}
1
+ {"version":3,"file":"command-completions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/command-completions.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAO1G,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAmC9C,wFAAwF;AACxF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,KAAK,EAAE,MAAM,YAAY,CAAA;IACzB,SAAS,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAA;IACjD,YAAY,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,qBAAqB,EAAE,CAAA;KAAE,CAAA;IACtF,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;4EACwE;IACxE,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5C,yEAAyE;IACzE,MAAM,CAAC,EAAE;QACP,eAAe,IAAI,IAAI,CAAA;QACvB,WAAW,IAAI,SAAS,qBAAqB,EAAE,CAAA;KAChD,CAAA;IACD,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,IAAI,IAAI,CAAA;KACzB,CAAA;CACF,IAES,OAAO,MAAM,qDAmJtB"}
@@ -1,5 +1,6 @@
1
1
  import { completeCommands, isCommandCompletionToken } from '../../commands.js';
2
- import { getSidePanelPanels, parseSidePanelIds } from '../../tuiDisplayPrefs.js';
2
+ import { getHiddenTemporarySidePanels, getSidePanelPanels, resolveSidePanelIds } from '../../tuiDisplayPrefs.js';
3
+ import { panelStore } from '../../components/sidePanel/PanelStore.js';
3
4
  import { SESSION_COLOR_NAMES } from '../../terminal-utils/sessionColors.js';
4
5
  import { getLang, LANGS, t } from '../../i18n.js';
5
6
  import { PERMISSION_PRESET_AUTO, permissionPresetKeys } from '../../permissionPresetLabels.js';
@@ -86,12 +87,6 @@ export function createCommandCompletions(deps) {
86
87
  model.warmPresetOptions();
87
88
  return [{ name: 'status', description: 'Show the current agent preset', descriptionKey: 'sugg-status-desc' }, ...model.presetOptions().map(preset => ({ name: preset.id, description: preset.description ?? preset.name ?? preset.id, ...(preset.id === state.agentPreset ? { tag: 'current' } : preset.isDefault ? { tag: 'default' } : {}) }))];
88
89
  }
89
- if (path.length === 1 && path[0] === 'team')
90
- return [
91
- { name: 'status', description: 'Show the team mode state', descriptionKey: 'sugg-status-desc' },
92
- { name: 'on', description: 'Switch Agent Teams on', descriptionKey: 'sugg-team-on-desc' },
93
- { name: 'off', description: 'Switch Agent Teams off', descriptionKey: 'sugg-team-off-desc' },
94
- ];
95
90
  if (path.length === 1 && path[0] === 'activity')
96
91
  return [
97
92
  { name: 'status', description: 'Show the current activity preset', descriptionKey: 'sugg-status-desc' },
@@ -159,7 +154,10 @@ export function createCommandCompletions(deps) {
159
154
  { name: 'toggle', description: 'Toggle the sidebar', descriptionKey: 'sugg-panel-toggle-desc' },
160
155
  { name: 'focus', description: 'Focus the side panel', descriptionKey: 'sugg-panel-focus-desc' },
161
156
  { name: 'zoom', description: 'Zoom the active panel', descriptionKey: 'sugg-panel-zoom-desc' },
162
- ...parseSidePanelIds(getSidePanelPanels()).map(id => ({ name: id, description: `Open the ${id} panel`, descriptionKey: 'sugg-panel-id-desc' })),
157
+ // Same derivation as the bar and the picker: a temporary panel hidden
158
+ // for this run must not be suggested, or running the suggestion only
159
+ // reaches the "unavailable" fallback.
160
+ ...resolveSidePanelIds(getSidePanelPanels(), panelStore.list().map(entry => entry.definition.id), getHiddenTemporarySidePanels()).map(id => ({ name: id, description: `Open the ${id} panel`, descriptionKey: 'sugg-panel-id-desc' })),
163
161
  ];
164
162
  if (path.length === 1 && path[0] === 'plan')
165
163
  return [
@@ -1,7 +1,7 @@
1
1
  import type { ServiceLookup } from './channel-host.js';
2
2
  import type { LocalImageStore } from './core/local-images.js';
3
3
  import type { ChannelOwner } from './owner.js';
4
- import type { ChannelImageBlock, ComposerImageRef, StagedImageHandle, StagedImageInput, TranscriptImage } from './types.js';
4
+ import type { ChannelImageBlock, MentionAttachments, ComposerImageRef, StagedImageAdjustment, StagedImageHandle, StagedImageInput, TranscriptImage } from './types.js';
5
5
  /** Every visible composer placeholder token, in source order. */
6
6
  export declare const COMPOSER_IMAGE_TOKEN: RegExp;
7
7
  /** One whole placeholder token; the distinction matters because a mention
@@ -52,6 +52,14 @@ export interface ComposerImages {
52
52
  /** Enqueue-time capture: legacy bindings merged, one object per ref. */
53
53
  captureDraftImages(text: string, images: readonly ComposerImageRef[]): readonly ComposerImageRef[];
54
54
  }
55
+ /** A controlled admission refusal, safe to expose alongside a failed mention. */
56
+ export declare class ImageAdmissionError extends Error {
57
+ }
58
+ /** Shared paste/mention admission; the returned attachment is the store's truth. */
59
+ export declare function saveAdmittedImage(attachments: MentionAttachments, input: StagedImageInput): Promise<{
60
+ attachment: ChannelImageBlock['attachment'];
61
+ adjustment?: StagedImageAdjustment;
62
+ }>;
55
63
  /**
56
64
  * Owns the editable-composer image capabilities: the session epoch, the
57
65
  * capability map, its preview facades and the `[Image #N]` compatibility
@@ -1 +1 @@
1
- {"version":3,"file":"composer-images.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/composer-images.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAOtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAEhB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,QAAqB,CAAA;AAEtD;6EAC6E;AAC7E,eAAO,MAAM,0BAA0B,QAAsB,CAAA;AAE7D,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,KAAG,MACe,CAAA;AAE1E;;;2EAG2E;AAC3E,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,gBAAgB,EAAE,EACjC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,GAC7B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAehB;AAED;;4EAE4E;AAC5E,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,MAAM,GAAG,SAAS,CAKpB;AAOD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IACpC;iEAC6D;IAC7D,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,6BAA6B;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAChC;AAED,iFAAiF;AACjF,MAAM,WAAW,cAAc;IAC7B;sEACkE;IAClE,qBAAqB,IAAI,MAAM,CAAA;IAC/B;yEACqE;IACrE,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACpD;iFAC6E;IAC7E,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAC3F,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;IACxC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAA;IACzD,iBAAiB,IAAI,mBAAmB,GAAG,SAAS,CAAA;IACpD;0EACsE;IACtE,iBAAiB,IAAI,IAAI,CAAA;IACzB,6EAA6E;IAC7E,QAAQ,IAAI,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAA;IAChE;4DACwD;IACxD,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAAG,SAAS,gBAAgB,EAAE,CAAA;IACtG,wEAAwE;IACxE,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAAG,SAAS,gBAAgB,EAAE,CAAA;CACnG;AA0BD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE;IACJ,UAAU,IAAI,MAAM,CAAA;IACpB,kFAAkF;IAClF,SAAS,CAAC,IAAI,MAAM,CAAA;IACpB;;+BAE2B;IAC3B,WAAW,CAAC,IAAI,eAAe,GAAG,SAAS,CAAA;CAC5C,GACA,cAAc,CAuRhB"}
1
+ {"version":3,"file":"composer-images.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/composer-images.ts"],"names":[],"mappings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CAAA;IACpB;;+BAE2B;IAC3B,WAAW,CAAC,IAAI,eAAe,GAAG,SAAS,CAAA;CAC5C,GACA,cAAc,CAuKhB"}
@@ -65,6 +65,115 @@ function admissionFailure(outcome, context) {
65
65
  /** A store-reported pixel dimension, or the gate's own value when the store
66
66
  * reported none (lean attachment fakes in the verify scripts). */
67
67
  const positiveOr = (value, fallback) => typeof value === 'number' && value > 0 ? value : fallback;
68
+ /** A controlled admission refusal, safe to expose alongside a failed mention. */
69
+ export class ImageAdmissionError extends Error {
70
+ }
71
+ /** Shared paste/mention admission; the returned attachment is the store's truth. */
72
+ export async function saveAdmittedImage(attachments, input) {
73
+ if (input.data.byteLength > attachments.imageLimits.maxImageBytes) {
74
+ throw new ImageAdmissionError(`image exceeds this profile's per-image size limit`);
75
+ }
76
+ // Ingress adaptation (issue #938): the store admits by media type, byte
77
+ // budget and the per-side / total pixel caps, and refuses on all of them
78
+ // when the bytes reach it. Measure and re-encode HERE instead, while the
79
+ // paste can still be explained to the user. Admission is judged against
80
+ // the pair this gate HANDS OVER (the store may normalize further on its
81
+ // own — that step is outside this feature), and both triggers are
82
+ // size-independent:
83
+ // * a source media type the profile does not accept is converted, so a
84
+ // small PNG is never refused while a large one succeeds;
85
+ // * a probe-recognized image inside the caps skips sharp entirely;
86
+ // * an unrecognized format is decoded for measurement (never trusted by
87
+ // byte budget alone — the #432 gap);
88
+ // * with sharp absent the image goes to the store unchanged ONLY while
89
+ // it is still admissible as-is — an accepted format whose size the
90
+ // probe could not prove fits (upstream stays the backstop); a measured
91
+ // oversize, a decode failure, an unaccepted format or a multi-frame
92
+ // image this gate would have to re-encode is reported now instead of
93
+ // becoming a token that dies at save time.
94
+ // The runtime guards keep older attachment fakes (whose imageLimits
95
+ // predate the dimension fields) on the legacy synchronous path.
96
+ const dimensionCap = attachments.imageLimits.maxImageDimension;
97
+ const pixelCap = attachments.imageLimits.maxImagePixels;
98
+ let mediaType = input.mediaType;
99
+ let data = input.data;
100
+ // The content wins over the declared label — the same rule the local
101
+ // image store applies (channel/core/local-images.ts): a paste declares
102
+ // its media type from the filename, and a renamed or mis-exported file
103
+ // (a wechat download, a re-saved screenshot) would otherwise be judged
104
+ // and stored under a type its bytes contradict. The sniff reads magic
105
+ // bytes only; content it cannot identify keeps the declared label and
106
+ // takes the decode-or-refuse path below.
107
+ const sniffed = sniffImageMediaType(data);
108
+ if (sniffed !== undefined && sniffed !== mediaType)
109
+ mediaType = sniffed;
110
+ let adapted;
111
+ if (typeof dimensionCap === 'number' && typeof pixelCap === 'number'
112
+ && Number.isFinite(dimensionCap) && Number.isFinite(pixelCap)) {
113
+ const dimensionLimits = { maxImageDimension: dimensionCap, maxImagePixels: pixelCap };
114
+ const probe = probeImageSize(data);
115
+ const sourceAccepted = attachments.imageLimits.mediaTypes.includes(mediaType);
116
+ // Only a probe-measured oversize is *known* to be refused by the store;
117
+ // an unmeasurable image may well be admissible, which is what keeps the
118
+ // sharp-less degradation a degradation rather than a guess.
119
+ const knownOversize = probe !== null && !withinDimensionLimits(probe, dimensionLimits);
120
+ if (!sourceAccepted || probe === null || knownOversize) {
121
+ const outcome = await adaptImageForAdmission(data, mediaType, dimensionLimits, attachments.imageLimits.mediaTypes);
122
+ if (outcome.kind === 'adapted') {
123
+ // outcome.mediaType comes from the accepted list inside the gate, so
124
+ // it is one of the profile's media types at runtime — narrowing,
125
+ // not trusting.
126
+ mediaType = outcome.mediaType;
127
+ data = outcome.data;
128
+ adapted = outcome;
129
+ if (data.byteLength > attachments.imageLimits.maxImageBytes) {
130
+ throw new ImageAdmissionError(`image still exceeds this profile's per-image size limit after resampling`);
131
+ }
132
+ }
133
+ else if (outcome.kind === 'unavailable') {
134
+ // Degrade ONLY when the paste is still admissible as-is: an accepted
135
+ // format whose size the probe could not prove fits. Everything else
136
+ // (measured oversize, unaccepted format, decode failure, animation
137
+ // that cannot survive) is a refusal we can state now.
138
+ const degraded = outcome.reason === 'sharp-missing' && sourceAccepted && !knownOversize;
139
+ if (!degraded) {
140
+ // The refused bytes are the only forensic handle on a "could not
141
+ // be decoded" paste — the temp export is unlinked right after —
142
+ // so an opted-in run records what the gate actually saw.
143
+ logForDebugging('image ingress refused', {
144
+ reason: outcome.reason,
145
+ detail: outcome.detail,
146
+ declared: input.mediaType,
147
+ sniffed,
148
+ bytes: data.byteLength,
149
+ prefix: Buffer.from(data.subarray(0, 16)).toString('hex'),
150
+ ...(input.name === undefined ? {} : { name: input.name }),
151
+ });
152
+ throw new ImageAdmissionError(admissionFailure(outcome, { probe, mediaType, limits: dimensionLimits }));
153
+ }
154
+ }
155
+ }
156
+ }
157
+ // What the store will actually see: an accepted media type, inside the
158
+ // byte cap. A media type can still be unaccepted here only when the
159
+ // adaptation did not run (legacy limits) or could not produce one.
160
+ if (!attachments.imageLimits.mediaTypes.includes(mediaType)) {
161
+ throw new ImageAdmissionError(`${mediaType} images are not accepted by this profile`);
162
+ }
163
+ // The source path is TUI-side display metadata; the store only sees the
164
+ // fields its contract names. mediaType/data may be the adapted pair from
165
+ // the ingress gate above.
166
+ const { path: _path, ...stored } = input;
167
+ const attachment = await attachments.saveImage({ ...stored, mediaType, data });
168
+ const sourceSize = probeImageSize(input.data);
169
+ const width = positiveOr(attachment.width, adapted?.width ?? sourceSize?.width ?? 0);
170
+ const height = positiveOr(attachment.height, adapted?.height ?? sourceSize?.height ?? 0);
171
+ const resized = adapted?.resized === true || (adapted !== undefined && (width !== adapted.width || height !== adapted.height)) || (sourceSize !== null && (width !== sourceSize.width || height !== sourceSize.height));
172
+ const adjustment = adapted !== undefined || resized || attachment.mediaType !== mediaType
173
+ ? { sourceMediaType: input.mediaType, mediaType: attachment.mediaType, width, height, resized, flattened: adapted?.flattened ?? false }
174
+ : undefined;
175
+ return { attachment, ...(adjustment === undefined ? {} : { adjustment }) };
176
+ }
68
177
  /**
69
178
  * Owns the editable-composer image capabilities: the session epoch, the
70
179
  * capability map, its preview facades and the `[Image #N]` compatibility
@@ -149,101 +258,8 @@ export function createComposerImages(ctx, owner, deps) {
149
258
  if (generation !== stagedImageEpoch) {
150
259
  throw new Error('the session changed while the image was being staged');
151
260
  }
152
- if (input.data.byteLength > attachments.imageLimits.maxImageBytes) {
153
- throw new Error(`image exceeds this profile's per-image size limit`);
154
- }
155
- // Ingress adaptation (issue #938): the store admits by media type, byte
156
- // budget and the per-side / total pixel caps, and refuses on all of them
157
- // when the bytes reach it. Measure and re-encode HERE instead, while the
158
- // paste can still be explained to the user. Admission is judged against
159
- // the pair this gate HANDS OVER (the store may normalize further on its
160
- // own — that step is outside this feature), and both triggers are
161
- // size-independent:
162
- // * a source media type the profile does not accept is converted, so a
163
- // small PNG is never refused while a large one succeeds;
164
- // * a probe-recognized image inside the caps skips sharp entirely;
165
- // * an unrecognized format is decoded for measurement (never trusted by
166
- // byte budget alone — the #432 gap);
167
- // * with sharp absent the image goes to the store unchanged ONLY while
168
- // it is still admissible as-is — an accepted format whose size the
169
- // probe could not prove fits (upstream stays the backstop); a measured
170
- // oversize, a decode failure, an unaccepted format or a multi-frame
171
- // image this gate would have to re-encode is reported now instead of
172
- // becoming a token that dies at save time.
173
- // The runtime guards keep older attachment fakes (whose imageLimits
174
- // predate the dimension fields) on the legacy synchronous path.
175
- const dimensionCap = attachments.imageLimits.maxImageDimension;
176
- const pixelCap = attachments.imageLimits.maxImagePixels;
177
- let mediaType = input.mediaType;
178
- let data = input.data;
179
- // The content wins over the declared label — the same rule the local
180
- // image store applies (channel/core/local-images.ts): a paste declares
181
- // its media type from the filename, and a renamed or mis-exported file
182
- // (a wechat download, a re-saved screenshot) would otherwise be judged
183
- // and stored under a type its bytes contradict. The sniff reads magic
184
- // bytes only; content it cannot identify keeps the declared label and
185
- // takes the decode-or-refuse path below.
186
- const sniffed = sniffImageMediaType(data);
187
- if (sniffed !== undefined && sniffed !== mediaType)
188
- mediaType = sniffed;
189
- let adapted;
190
- if (typeof dimensionCap === 'number' && typeof pixelCap === 'number'
191
- && Number.isFinite(dimensionCap) && Number.isFinite(pixelCap)) {
192
- const dimensionLimits = { maxImageDimension: dimensionCap, maxImagePixels: pixelCap };
193
- const probe = probeImageSize(data);
194
- const sourceAccepted = attachments.imageLimits.mediaTypes.includes(mediaType);
195
- // Only a probe-measured oversize is *known* to be refused by the store;
196
- // an unmeasurable image may well be admissible, which is what keeps the
197
- // sharp-less degradation a degradation rather than a guess.
198
- const knownOversize = probe !== null && !withinDimensionLimits(probe, dimensionLimits);
199
- if (!sourceAccepted || probe === null || knownOversize) {
200
- const outcome = await adaptImageForAdmission(data, mediaType, dimensionLimits, attachments.imageLimits.mediaTypes);
201
- if (outcome.kind === 'adapted') {
202
- // outcome.mediaType comes from the accepted list inside the gate, so
203
- // it is one of the profile's media types at runtime — narrowing,
204
- // not trusting.
205
- mediaType = outcome.mediaType;
206
- data = outcome.data;
207
- adapted = outcome;
208
- if (data.byteLength > attachments.imageLimits.maxImageBytes) {
209
- throw new Error(`image still exceeds this profile's per-image size limit after resampling`);
210
- }
211
- }
212
- else if (outcome.kind === 'unavailable') {
213
- // Degrade ONLY when the paste is still admissible as-is: an accepted
214
- // format whose size the probe could not prove fits. Everything else
215
- // (measured oversize, unaccepted format, decode failure, animation
216
- // that cannot survive) is a refusal we can state now.
217
- const degraded = outcome.reason === 'sharp-missing' && sourceAccepted && !knownOversize;
218
- if (!degraded) {
219
- // The refused bytes are the only forensic handle on a "could not
220
- // be decoded" paste — the temp export is unlinked right after —
221
- // so an opted-in run records what the gate actually saw.
222
- logForDebugging('image ingress refused', {
223
- reason: outcome.reason,
224
- detail: outcome.detail,
225
- declared: input.mediaType,
226
- sniffed,
227
- bytes: data.byteLength,
228
- prefix: Buffer.from(data.subarray(0, 16)).toString('hex'),
229
- ...(input.name === undefined ? {} : { name: input.name }),
230
- });
231
- throw new Error(admissionFailure(outcome, { probe, mediaType, limits: dimensionLimits }));
232
- }
233
- }
234
- }
235
- }
236
- // What the store will actually see: an accepted media type, inside the
237
- // byte cap. A media type can still be unaccepted here only when the
238
- // adaptation did not run (legacy limits) or could not produce one.
239
- if (!attachments.imageLimits.mediaTypes.includes(mediaType)) {
240
- throw new Error(`${mediaType} images are not accepted by this profile`);
241
- }
242
- // The source path is TUI-side display metadata; the store only sees the
243
- // fields its contract names. mediaType/data may be the adapted pair from
244
- // the ingress gate above.
245
- const { path, ...stored } = input;
246
- const attachment = await attachments.saveImage({ ...stored, mediaType, data });
261
+ const { attachment, adjustment } = await saveAdmittedImage(attachments, input);
262
+ const { path } = input;
247
263
  // A session change (/new, resume, rewind, model switch, background)
248
264
  // cleared the maps while the save was in flight: the durable object is
249
265
  // harmless, but the OLD session's capability must not reach the new one.
@@ -264,22 +280,6 @@ export function createComposerImages(ctx, owner, deps) {
264
280
  break;
265
281
  deleteStagedImage(oldest);
266
282
  }
267
- // The adjustment travels with the capability so the composer can say what
268
- // happened instead of letting a rewritten image reach the store silently.
269
- // Its numbers come from the STORE's own report, not from what this gate
270
- // handed over: the store normalizes further (dimensions, and the media type
271
- // too), and a notice quoting the gate's numbers would contradict the
272
- // preview card the user is looking at.
273
- const adjustment = adapted === undefined ? undefined : {
274
- sourceMediaType: input.mediaType,
275
- mediaType: attachment.mediaType,
276
- width: positiveOr(attachment.width, adapted.width),
277
- height: positiveOr(attachment.height, adapted.height),
278
- resized: adapted.resized
279
- || positiveOr(attachment.width, adapted.width) !== adapted.width
280
- || positiveOr(attachment.height, adapted.height) !== adapted.height,
281
- flattened: adapted.flattened,
282
- };
283
283
  return adjustment === undefined ? { stageId } : { stageId, adjustment };
284
284
  };
285
285
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"composer-mentions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/composer-mentions.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEpG;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,EAAE,EAAE,SAAS,GAAG,SAAS,EACzB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,kBAAkB,EAChC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC,GAClE,OAAO,CAAC,gBAAgB,CAAC,CAqL3B"}
1
+ {"version":3,"file":"composer-mentions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/composer-mentions.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEpG;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,EAAE,EAAE,SAAS,GAAG,SAAS,EACzB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,kBAAkB,EAChC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC,GAClE,OAAO,CAAC,gBAAgB,CAAC,CAyL3B"}
@@ -1,6 +1,6 @@
1
1
  import { isAbsolute, join } from 'node:path';
2
2
  import { extractMentions } from '../../utils/mentions.js';
3
- import { COMPOSER_IMAGE_TOKEN } from './composer-images.js';
3
+ import { COMPOSER_IMAGE_TOKEN, ImageAdmissionError, saveAdmittedImage } from './composer-images.js';
4
4
  import { MENTION_MAX_DIR_ENTRIES, MENTION_MAX_FILE_CHARS, MENTION_MAX_TOTAL_CHARS, mentionImageMediaType, tryResolveMention, } from './mentions.js';
5
5
  import { basename } from './paths.js';
6
6
  /**
@@ -19,6 +19,8 @@ export async function expandComposerMentions(fs, cwd, text, attachments, stagedI
19
19
  const blocks = [{ type: 'text', text }];
20
20
  const attached = [];
21
21
  const missing = [];
22
+ const imageAdjustments = [];
23
+ const imageFailures = [];
22
24
  const mentions = extractMentions(text);
23
25
  let budget = MENTION_MAX_TOTAL_CHARS;
24
26
  let imageCount = 0;
@@ -107,28 +109,32 @@ export async function expandComposerMentions(fs, cwd, text, attachments, stagedI
107
109
  if (info?.type === 'file') {
108
110
  if (imageType !== undefined && attachments !== undefined && fs.readBytes !== undefined) {
109
111
  const limits = attachments.imageLimits;
110
- if (!limits.mediaTypes.includes(imageType) || imageCount >= limits.maxImagesPerMessage) {
112
+ if (imageCount >= limits.maxImagesPerMessage) {
111
113
  missing.push(display);
112
114
  continue;
113
115
  }
114
116
  try {
115
117
  const data = await fs.readBytes(target, undefined, limits.maxImageBytes);
116
- if (imageBytes + data.byteLength > limits.maxMessageImageBytes) {
117
- missing.push(display);
118
- continue;
119
- }
120
- const attachment = await attachments.saveImage({
118
+ const { attachment, adjustment } = await saveAdmittedImage(attachments, {
121
119
  data,
122
120
  mediaType: imageType,
123
121
  name: basename(target.displayPath),
124
122
  });
123
+ if (imageBytes + attachment.bytes > limits.maxMessageImageBytes) {
124
+ missing.push(display);
125
+ continue;
126
+ }
125
127
  blocks.push({ type: 'image', attachment });
128
+ if (adjustment !== undefined)
129
+ imageAdjustments.push({ path: display, adjustment });
126
130
  imageCount += 1;
127
- imageBytes += data.byteLength;
131
+ imageBytes += attachment.bytes;
128
132
  attached.push(display);
129
133
  }
130
- catch {
134
+ catch (error) {
131
135
  missing.push(display);
136
+ if (error instanceof ImageAdmissionError)
137
+ imageFailures.push({ path: display, reason: error.message });
132
138
  }
133
139
  continue;
134
140
  }
@@ -196,5 +202,5 @@ export async function expandComposerMentions(fs, cwd, text, attachments, stagedI
196
202
  // Absent (stat → undefined) or a special file.
197
203
  missing.push(display);
198
204
  }
199
- return { blocks, attached, missing };
205
+ return { blocks, attached, missing, ...(imageAdjustments.length === 0 ? {} : { imageAdjustments }), ...(imageFailures.length === 0 ? {} : { imageFailures }) };
200
206
  }
@@ -22,7 +22,7 @@ import type { ChannelState } from '../types.js';
22
22
  export declare function createCapabilityDelegates(deps: {
23
23
  owner: Pick<ChannelOwner, 'current'>;
24
24
  session(): AgentSession;
25
- state: () => Pick<ChannelState, 'provider' | 'model' | 'backendCapabilities'>;
25
+ state: () => Pick<ChannelState, 'provider' | 'model' | 'backendCapabilities' | 'emit'>;
26
26
  notify: ChannelState['notify'];
27
27
  unavailable(name: string): void;
28
28
  unavailableLines(name: string): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/channel/core/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAG7D,OAAO,EAAoC,KAAK,sBAAsB,EAAE,KAAK,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AACzI,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;IACpC,OAAO,IAAI,YAAY,CAAA;IACvB,KAAK,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,OAAO,GAAG,qBAAqB,CAAC,CAAA;IAC7E,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAA;IAC9B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACxC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CACzE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAmHlC;AAED,qGAAqG;AACrG,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,EAC1D,MAAM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AAO,CAAC,CAAC,CAAC,CAAA;CACzE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAmIlC;AAED,qGAAqG;AACrG,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,EAC1D,MAAM,EAAE;IACN,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACxC,UAAU,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAC3C,IAAI,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;IACrC,SAAS,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,SAAS,CAAA;CACvD,EACD,OAAO,UAAQ,GACd,IAAI,CAON"}
@@ -1,5 +1,6 @@
1
1
  import { conversationRecapPrompt, parseRecapResponse, sideQuestionPrompt } from '../../../channel/side-prompts.js';
2
2
  import { t } from '../../../i18n.js';
3
+ import { nearestLowerEffort } from '../../../effortPrefs.js';
3
4
  import { createUnavailableActionDelegates } from '../action-readiness.js';
4
5
  export function createCapabilityDelegates(deps) {
5
6
  const { notify, unavailable, guarded } = deps;
@@ -31,14 +32,18 @@ export function createCapabilityDelegates(deps) {
31
32
  await modes.set(list[(index + 1) % list.length].id);
32
33
  }),
33
34
  listModels: () => guarded('model', [], async () => {
34
- const models = caps().models;
35
+ const session = deps.session();
36
+ const models = session.capabilities.models;
35
37
  if (models === undefined) {
36
38
  unavailable('model');
37
39
  return [];
38
40
  }
39
41
  // One provider: the backend itself; `/model <id>` needs no provider segment.
40
42
  const provider = deps.state().provider;
41
- return (await models.list()).map(model => ({ provider: model.provider ?? provider, id: model.id, name: model.label, ...(model.description === undefined ? {} : { description: model.description }) }));
43
+ const list = await models.list();
44
+ if (deps.owner.current() && deps.session() === session)
45
+ deps.state().emit();
46
+ return list.map(model => ({ provider: model.provider ?? provider, id: model.id, name: model.label, ...(model.description === undefined ? {} : { description: model.description }) }));
42
47
  }),
43
48
  switchModel: (provider, model) => guarded('model', false, async () => {
44
49
  const models = caps().models;
@@ -82,6 +87,22 @@ export function createCapabilityDelegates(deps) {
82
87
  // the slider can say so instead of presenting them as the model's tiers.
83
88
  return Promise.resolve({ efforts: levels.map(level => ({ id: level.id, name: level.label })), defaultEffort: effort.current(), ...(effort.levelsFallback === true ? { levelsFallback: true } : {}) });
84
89
  },
90
+ setDefaultEffort: id => {
91
+ const effort = caps().effort;
92
+ if (id !== undefined && effort?.levelsAvailable === false)
93
+ return false;
94
+ void guarded('effort', undefined, async () => {
95
+ if (effort === undefined)
96
+ return;
97
+ const applied = id === undefined ? undefined : nearestLowerEffort(id, effort.levels().map(level => level.id));
98
+ await effort.set(applied ?? null);
99
+ if (!deps.owner.current() || id === undefined || applied === id)
100
+ return;
101
+ notify(applied === undefined
102
+ ? t('effort-preference-unsupported', { preferred: id })
103
+ : t('effort-preference-downgraded', { preferred: id, applied }), { color: 'warning' });
104
+ });
105
+ },
85
106
  setEffort: id => guarded('effort', false, async () => {
86
107
  const effort = caps().effort;
87
108
  if (effort === undefined || !effort.levels().some(level => level.id === id)) {
@@ -75,6 +75,7 @@ export declare function createSessionBatchRouter(deps: {
75
75
  route: (batch: readonly AgentEvent[], meta: AgentEventMeta, current: () => boolean) => void;
76
76
  reconcileRetiredProjection: (status: "idle" | "disposed") => void;
77
77
  turnStarts: () => number;
78
+ turnEnds: () => number;
78
79
  };
79
80
  /**
80
81
  * The bind that follows the bound session: shared by the channel feed below
@@ -142,8 +143,10 @@ export declare function createBindingFeed(ctx: {
142
143
  route: (batch: readonly AgentEvent[], meta: AgentEventMeta, current: () => boolean) => void;
143
144
  reconcileRetiredProjection: (status: "idle" | "disposed") => void;
144
145
  turnStarts: () => number;
146
+ turnEnds: () => number;
145
147
  };
146
- bind: (seed?: readonly AgentEvent[]) => void;
148
+ liveTurnEnds: () => number;
149
+ bind(seed?: readonly AgentEvent[]): void;
147
150
  resetProjection: () => void;
148
151
  /** Install the backend's job-registry feed and pricing policy (before start). */
149
152
  configureProjection(update: Partial<Pick<ChannelProjectionDeps, "jobs" | "pricingWindow">>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"binding-feed.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/channel/core/binding-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,OAAO,EAA2B,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAE5H,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,oEAAoE;IACpE,OAAO,IAAI,OAAO,CAAA;IAClB,8EAA8E;IAC9E,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAA;CAC9C;AAED,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,YAAY,C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E,EAAE,IAAI,EAAE;IACnF,KAAK,EAAE,YAAY,CAAA;IACnB,OAAO,EAAE,cAAc,CAAA;IACvB,KAAK,EAAE,YAAY,CAAA;IACnB,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,aAAa,GAAG,gBAAgB,CAAC,CAAA;IACrE,gBAAgB,EAAE,gBAAgB,CAAA;IAClC;0EACsE;IACtE,UAAU,EAAE,IAAI,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAA;IAC3D,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC,QAAQ,EAAE,eAAe,CAAA;IACzB,KAAK,IAAI,gBAAgB,CAAA;IACzB,6DAA6D;IAC7D,OAAO,CAAC,CAAC,KAAK,EAAE,YAAY,CAAC,eAAe,CAAC,GAAG,IAAI,CAAA;IACpD,sEAAsE;IACtE,eAAe,CAAC,IAAI,IAAI,CAAA;CACzB;;;;;;;;;;;;;;;;;;uBAxKuB,SAAS,UAAU,EAAE,QAAQ,cAAc,WAAW,MAAM,OAAO,KAAG,IAAI;6CAnDpD,MAAM,GAAG,UAAU,KAAG,IAAI;0BAmHV,MAAM;wBAA8B,MAAM;;wBA+LlF,MAAM;gBACZ,SAAS,UAAU,EAAE,GAAG,IAAI;2BAlEd,IAAI;IAwE9B,iFAAiF;gCACrD,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,GAAG,IAAI;EAKpG;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
@@ -59,6 +59,7 @@ export function createSessionBatchRouter(deps) {
59
59
  /** Monotonic count of live turns that started on a bound session (`/new`
60
60
  * compares it across its open: a whole turn may come and go meanwhile). */
61
61
  let turnStarts = 0;
62
+ let turnEnds = 0;
62
63
  const route = (batch, meta, current) => {
63
64
  // The generation fence covers the whole batch, whatever it carries. A
64
65
  // callback retained past a rebind (an in-flight dispatch, a compaction
@@ -74,6 +75,10 @@ export function createSessionBatchRouter(deps) {
74
75
  if (!meta.replay)
75
76
  turnStarts += 1;
76
77
  break;
78
+ case 'turn.end':
79
+ if (!meta.replay)
80
+ turnEnds += 1;
81
+ break;
77
82
  case 'session.status':
78
83
  applyStatus(event.status);
79
84
  break;
@@ -129,7 +134,7 @@ export function createSessionBatchRouter(deps) {
129
134
  deps.state.emit();
130
135
  deps.taskCompletion?.(events, meta, current);
131
136
  };
132
- return { route, reconcileRetiredProjection, turnStarts: () => turnStarts };
137
+ return { route, reconcileRetiredProjection, turnStarts: () => turnStarts, turnEnds: () => turnEnds };
133
138
  }
134
139
  /**
135
140
  * The bind that follows the bound session: shared by the channel feed below
@@ -277,10 +282,16 @@ export function createBindingFeed(ctx, deps) {
277
282
  },
278
283
  },
279
284
  });
285
+ let endsBeforeBind = 0;
280
286
  return {
281
287
  projector,
282
288
  router,
283
- bind: binder.bind,
289
+ liveTurnEnds: () => router.turnEnds() - endsBeforeBind,
290
+ bind(seed) {
291
+ // Capture before subscribe can synchronously deliver an entire live turn.
292
+ endsBeforeBind = router.turnEnds();
293
+ binder.bind(seed);
294
+ },
284
295
  resetProjection,
285
296
  /** Install the backend's job-registry feed and pricing policy (before start). */
286
297
  configureProjection(update) {
@@ -156,8 +156,10 @@ export declare function createCoreChannel(ctx: ChannelHost, initialSession: Agen
156
156
  route: (batch: readonly AgentEvent[], meta: import("../../../agent/events.js").AgentEventMeta, current: () => boolean) => void;
157
157
  reconcileRetiredProjection: (status: "idle" | "disposed") => void;
158
158
  turnStarts: () => number;
159
+ turnEnds: () => number;
159
160
  };
160
- bind: (seed?: readonly AgentEvent[]) => void;
161
+ liveTurnEnds: () => number;
162
+ bind(seed?: readonly AgentEvent[]): void;
161
163
  resetProjection: () => void;
162
164
  configureProjection(update: Partial<Pick<import("../../../channel/projection.js").ChannelProjectionDeps, "jobs" | "pricingWindow">>): void;
163
165
  };
@@ -172,6 +174,7 @@ export declare function createCoreChannel(ctx: ChannelHost, initialSession: Agen
172
174
  clear(): void;
173
175
  pushLocal(title: string, lines: readonly string[], options?: {
174
176
  readonly lineLimit?: number;
177
+ readonly preserveWhitespace?: boolean;
175
178
  }): void;
176
179
  setActivityFrames: (name: string) => boolean;
177
180
  runLocalCommand(command: string, includeInContext: boolean): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/channel/core/compose.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAA;AAGvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAW7D,OAAO,EAA4D,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAQ9H,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAG/E,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAIrE,OAAO,EAA8C,KAAK,oBAAoB,EAAuB,MAAM,aAAa,CAAA;AACxH,OAAO,KAAK,EAAE,YAAY,EAA0B,MAAM,aAAa,CAAA;AAEvE,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAA0C,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC3F,OAAO,EAAqE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAO5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAkE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAYrJ;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;+EAC2E;IAC3E,eAAe,CAAC,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAAA;IAC/C;4EACwE;IACxE,aAAa,CAAC,IA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