@deepseek-harness-tui/dsh-tui 0.11.1 → 0.11.2

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 (427) hide show
  1. package/README.md +50 -20
  2. package/assets/whale-girl/whale-girl-dark.png +0 -0
  3. package/assets/whale-girl/whale-girl-happy.png +0 -0
  4. package/assets/whale-girl/whale-girl.png +0 -0
  5. package/bin/dsh-tui.js +63 -3
  6. package/cordis.patch.yml +39 -17
  7. package/cordis.yml +3 -2
  8. package/lib/settings.json +1272 -0
  9. package/lib/types/adapter/channel/ui-policy.d.ts +9 -2
  10. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  11. package/lib/types/adapter/channel/ui-policy.js +13 -0
  12. package/lib/types/adapter/kernel/replay.d.ts.map +1 -1
  13. package/lib/types/adapter/kernel/replay.js +2 -0
  14. package/lib/types/adapter/ports/channel-display.d.ts +12 -0
  15. package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
  16. package/lib/types/adapter/ports/channel-session.d.ts +38 -0
  17. package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
  18. package/lib/types/adapter/ports/channel-settings.d.ts +12 -0
  19. package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
  20. package/lib/types/adapter/ports/channel-ui.d.ts +46 -4
  21. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  22. package/lib/types/adapter/ports/channel-view.d.ts +43 -0
  23. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  24. package/lib/types/commands.d.ts.map +1 -1
  25. package/lib/types/commands.js +2 -0
  26. package/lib/types/components/BalanceReportRow.d.ts +10 -2
  27. package/lib/types/components/BalanceReportRow.d.ts.map +1 -1
  28. package/lib/types/components/BalanceReportRow.js +18 -4
  29. package/lib/types/components/CompactionStatusRow.d.ts +24 -0
  30. package/lib/types/components/CompactionStatusRow.d.ts.map +1 -0
  31. package/lib/types/components/CompactionStatusRow.js +72 -0
  32. package/lib/types/components/GoalTodoPanel.js +2 -2
  33. package/lib/types/components/HelpMenu.d.ts +2 -2
  34. package/lib/types/components/HelpMenu.d.ts.map +1 -1
  35. package/lib/types/components/HelpMenu.js +5 -4
  36. package/lib/types/components/InlineMathParagraph.d.ts +22 -0
  37. package/lib/types/components/InlineMathParagraph.d.ts.map +1 -0
  38. package/lib/types/components/InlineMathParagraph.js +178 -0
  39. package/lib/types/components/LogoV2.d.ts +41 -3
  40. package/lib/types/components/LogoV2.d.ts.map +1 -1
  41. package/lib/types/components/LogoV2.js +148 -24
  42. package/lib/types/components/Markdown.d.ts +10 -3
  43. package/lib/types/components/Markdown.d.ts.map +1 -1
  44. package/lib/types/components/Markdown.js +47 -14
  45. package/lib/types/components/MathBlock.d.ts +13 -0
  46. package/lib/types/components/MathBlock.d.ts.map +1 -0
  47. package/lib/types/components/MathBlock.js +136 -0
  48. package/lib/types/components/MessageList.d.ts +10 -1
  49. package/lib/types/components/MessageList.d.ts.map +1 -1
  50. package/lib/types/components/MessageList.js +13 -4
  51. package/lib/types/components/MigratePicker.d.ts +30 -0
  52. package/lib/types/components/MigratePicker.d.ts.map +1 -0
  53. package/lib/types/components/MigratePicker.js +38 -0
  54. package/lib/types/components/PromptInput.d.ts +17 -0
  55. package/lib/types/components/PromptInput.d.ts.map +1 -1
  56. package/lib/types/components/PromptInput.js +48 -7
  57. package/lib/types/components/SplitDiffView.d.ts.map +1 -1
  58. package/lib/types/components/SplitDiffView.js +2 -1
  59. package/lib/types/components/StarPrompt.d.ts +53 -0
  60. package/lib/types/components/StarPrompt.d.ts.map +1 -0
  61. package/lib/types/components/StarPrompt.js +281 -0
  62. package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
  63. package/lib/types/components/StreamingMarkdown.js +20 -3
  64. package/lib/types/components/TimelineRail.d.ts.map +1 -1
  65. package/lib/types/components/TimelineRail.js +9 -1
  66. package/lib/types/components/Whale.d.ts +17 -8
  67. package/lib/types/components/Whale.d.ts.map +1 -1
  68. package/lib/types/components/Whale.js +25 -15
  69. package/lib/types/components/WhaleGirl.d.ts +29 -0
  70. package/lib/types/components/WhaleGirl.d.ts.map +1 -0
  71. package/lib/types/components/WhaleGirl.js +32 -0
  72. package/lib/types/components/WorkingSpinner.d.ts +4 -1
  73. package/lib/types/components/WorkingSpinner.d.ts.map +1 -1
  74. package/lib/types/components/WorkingSpinner.js +2 -2
  75. package/lib/types/components/bigfont.d.ts +47 -18
  76. package/lib/types/components/bigfont.d.ts.map +1 -1
  77. package/lib/types/components/bigfont.js +55 -40
  78. package/lib/types/components/design-system/ThemeProvider.d.ts +6 -0
  79. package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
  80. package/lib/types/components/design-system/ThemeProvider.js +40 -1
  81. package/lib/types/components/maidPortrait.d.ts +44 -0
  82. package/lib/types/components/maidPortrait.d.ts.map +1 -0
  83. package/lib/types/components/maidPortrait.js +178 -0
  84. package/lib/types/components/mathPreview.d.ts +25 -0
  85. package/lib/types/components/mathPreview.d.ts.map +1 -0
  86. package/lib/types/components/mathPreview.js +48 -0
  87. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
  88. package/lib/types/components/messages/AssistantThinkingMessage.js +2 -1
  89. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  90. package/lib/types/components/messages/AssistantToolUseMessage.js +3 -2
  91. package/lib/types/components/messages/TranscriptImages.d.ts.map +1 -1
  92. package/lib/types/components/messages/TranscriptImages.js +11 -1
  93. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +14 -2
  94. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  95. package/lib/types/components/questions/AskUserQuestionPanel.js +80 -38
  96. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  97. package/lib/types/components/questions/PlanReviewPanel.js +3 -3
  98. package/lib/types/components/sessions/ForeignSessionRow.d.ts +34 -0
  99. package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -0
  100. package/lib/types/components/sessions/ForeignSessionRow.js +43 -0
  101. package/lib/types/components/sessions/SourceTabs.d.ts +52 -0
  102. package/lib/types/components/sessions/SourceTabs.d.ts.map +1 -0
  103. package/lib/types/components/sessions/SourceTabs.js +70 -0
  104. package/lib/types/components/splashEggs.d.ts +56 -0
  105. package/lib/types/components/splashEggs.d.ts.map +1 -0
  106. package/lib/types/components/splashEggs.js +67 -0
  107. package/lib/types/components/splashFonts.d.ts +119 -0
  108. package/lib/types/components/splashFonts.d.ts.map +1 -0
  109. package/lib/types/components/splashFonts.js +267 -0
  110. package/lib/types/components/splashLayout.d.ts +41 -0
  111. package/lib/types/components/splashLayout.d.ts.map +1 -0
  112. package/lib/types/components/splashLayout.js +40 -0
  113. package/lib/types/components/whaleGirlSprite.d.ts +17 -0
  114. package/lib/types/components/whaleGirlSprite.d.ts.map +1 -0
  115. package/lib/types/components/whaleGirlSprite.js +47 -0
  116. package/lib/types/deepseekPricing.d.ts +74 -0
  117. package/lib/types/deepseekPricing.d.ts.map +1 -1
  118. package/lib/types/deepseekPricing.js +110 -11
  119. package/lib/types/dsh-adapter/channel/action-readiness.d.ts +1 -1
  120. package/lib/types/dsh-adapter/channel/action-readiness.d.ts.map +1 -1
  121. package/lib/types/dsh-adapter/channel/action-readiness.js +6 -1
  122. package/lib/types/dsh-adapter/channel/background-action.d.ts +1 -0
  123. package/lib/types/dsh-adapter/channel/background-action.d.ts.map +1 -1
  124. package/lib/types/dsh-adapter/channel/background-action.js +1 -0
  125. package/lib/types/dsh-adapter/channel/binding-events.d.ts +8 -9
  126. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  127. package/lib/types/dsh-adapter/channel/binding-events.js +69 -21
  128. package/lib/types/dsh-adapter/channel/compaction.d.ts +2 -1
  129. package/lib/types/dsh-adapter/channel/compaction.d.ts.map +1 -1
  130. package/lib/types/dsh-adapter/channel/compaction.js +35 -2
  131. package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
  132. package/lib/types/dsh-adapter/channel/local-actions.js +6 -1
  133. package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
  134. package/lib/types/dsh-adapter/channel/model-switch.js +5 -1
  135. package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
  136. package/lib/types/dsh-adapter/channel/paths.js +7 -1
  137. package/lib/types/dsh-adapter/channel/preferences.d.ts +1 -1
  138. package/lib/types/dsh-adapter/channel/preferences.d.ts.map +1 -1
  139. package/lib/types/dsh-adapter/channel/preferences.js +16 -0
  140. package/lib/types/dsh-adapter/channel/projection.d.ts +1 -2
  141. package/lib/types/dsh-adapter/channel/projection.d.ts.map +1 -1
  142. package/lib/types/dsh-adapter/channel/projection.js +127 -17
  143. package/lib/types/dsh-adapter/channel/question-record.d.ts +76 -0
  144. package/lib/types/dsh-adapter/channel/question-record.d.ts.map +1 -0
  145. package/lib/types/dsh-adapter/channel/question-record.js +107 -0
  146. package/lib/types/dsh-adapter/channel/session-lineage.d.ts +42 -0
  147. package/lib/types/dsh-adapter/channel/session-lineage.d.ts.map +1 -0
  148. package/lib/types/dsh-adapter/channel/session-lineage.js +51 -0
  149. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +2 -0
  150. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
  151. package/lib/types/dsh-adapter/channel/session-live-adoption.js +9 -3
  152. package/lib/types/dsh-adapter/channel/session-metadata.d.ts +2 -1
  153. package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
  154. package/lib/types/dsh-adapter/channel/session-metadata.js +39 -7
  155. package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
  156. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  157. package/lib/types/dsh-adapter/channel/session-reset.js +7 -0
  158. package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -0
  159. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  160. package/lib/types/dsh-adapter/channel/session-resume.js +4 -2
  161. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  162. package/lib/types/dsh-adapter/channel/settings-host.js +8 -0
  163. package/lib/types/dsh-adapter/channel/state.d.ts +14 -1
  164. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  165. package/lib/types/dsh-adapter/channel/state.js +6 -1
  166. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +30 -35
  167. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
  168. package/lib/types/dsh-adapter/channel/subagent-projection.js +138 -4
  169. package/lib/types/dsh-adapter/channel/types.d.ts +1 -1
  170. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  171. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  172. package/lib/types/dsh-adapter/channel.js +19 -4
  173. package/lib/types/dsh-adapter/compat/messages.d.ts +6 -0
  174. package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
  175. package/lib/types/dsh-adapter/compat/messages.js +9 -0
  176. package/lib/types/dsh-adapter/contract.d.ts +5 -5
  177. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  178. package/lib/types/dsh-adapter/contract.js +8 -6
  179. package/lib/types/dsh-adapter/index.d.ts +36 -1
  180. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  181. package/lib/types/dsh-adapter/index.js +22 -6
  182. package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts +3 -0
  183. package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts.map +1 -0
  184. package/lib/types/dsh-adapter/migrate/adapters/claude-code.js +131 -0
  185. package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts +17 -0
  186. package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts.map +1 -0
  187. package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.js +329 -0
  188. package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts +3 -0
  189. package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts.map +1 -0
  190. package/lib/types/dsh-adapter/migrate/adapters/codex.js +102 -0
  191. package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts +16 -0
  192. package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts.map +1 -0
  193. package/lib/types/dsh-adapter/migrate/adapters/codex.parse.js +289 -0
  194. package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts +3 -0
  195. package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts.map +1 -0
  196. package/lib/types/dsh-adapter/migrate/adapters/grok-build.js +117 -0
  197. package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts +13 -0
  198. package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts.map +1 -0
  199. package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.js +178 -0
  200. package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts +3 -0
  201. package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts.map +1 -0
  202. package/lib/types/dsh-adapter/migrate/adapters/omp.js +133 -0
  203. package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts +60 -0
  204. package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts.map +1 -0
  205. package/lib/types/dsh-adapter/migrate/adapters/scan-fs.js +178 -0
  206. package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts +8 -0
  207. package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts.map +1 -0
  208. package/lib/types/dsh-adapter/migrate/adapters/scan.js +40 -0
  209. package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts +3 -0
  210. package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts.map +1 -0
  211. package/lib/types/dsh-adapter/migrate/adapters/zcode.js +93 -0
  212. package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts +9 -0
  213. package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts.map +1 -0
  214. package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.js +89 -0
  215. package/lib/types/dsh-adapter/migrate/bin-path.d.ts +6 -0
  216. package/lib/types/dsh-adapter/migrate/bin-path.d.ts.map +1 -0
  217. package/lib/types/dsh-adapter/migrate/bin-path.js +30 -0
  218. package/lib/types/dsh-adapter/migrate/browse.d.ts +42 -0
  219. package/lib/types/dsh-adapter/migrate/browse.d.ts.map +1 -0
  220. package/lib/types/dsh-adapter/migrate/browse.js +90 -0
  221. package/lib/types/dsh-adapter/migrate/cli.d.ts +9 -0
  222. package/lib/types/dsh-adapter/migrate/cli.d.ts.map +1 -0
  223. package/lib/types/dsh-adapter/migrate/cli.js +106 -0
  224. package/lib/types/dsh-adapter/migrate/import-one.d.ts +89 -0
  225. package/lib/types/dsh-adapter/migrate/import-one.d.ts.map +1 -0
  226. package/lib/types/dsh-adapter/migrate/import-one.js +133 -0
  227. package/lib/types/dsh-adapter/migrate/index.d.ts +35 -0
  228. package/lib/types/dsh-adapter/migrate/index.d.ts.map +1 -0
  229. package/lib/types/dsh-adapter/migrate/index.js +107 -0
  230. package/lib/types/dsh-adapter/migrate/parse/injection.d.ts +40 -0
  231. package/lib/types/dsh-adapter/migrate/parse/injection.d.ts.map +1 -0
  232. package/lib/types/dsh-adapter/migrate/parse/injection.js +127 -0
  233. package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts +28 -0
  234. package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts.map +1 -0
  235. package/lib/types/dsh-adapter/migrate/parse/jsonl.js +40 -0
  236. package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts +28 -0
  237. package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts.map +1 -0
  238. package/lib/types/dsh-adapter/migrate/parse/role-turns.js +50 -0
  239. package/lib/types/dsh-adapter/migrate/parse/title.d.ts +18 -0
  240. package/lib/types/dsh-adapter/migrate/parse/title.d.ts.map +1 -0
  241. package/lib/types/dsh-adapter/migrate/parse/title.js +29 -0
  242. package/lib/types/dsh-adapter/migrate/parse/tools.d.ts +62 -0
  243. package/lib/types/dsh-adapter/migrate/parse/tools.d.ts.map +1 -0
  244. package/lib/types/dsh-adapter/migrate/parse/tools.js +110 -0
  245. package/lib/types/dsh-adapter/migrate/picker.d.ts +64 -0
  246. package/lib/types/dsh-adapter/migrate/picker.d.ts.map +1 -0
  247. package/lib/types/dsh-adapter/migrate/picker.js +86 -0
  248. package/lib/types/dsh-adapter/migrate/recent-agents.d.ts +40 -0
  249. package/lib/types/dsh-adapter/migrate/recent-agents.d.ts.map +1 -0
  250. package/lib/types/dsh-adapter/migrate/recent-agents.js +100 -0
  251. package/lib/types/dsh-adapter/migrate/sessionize.d.ts +39 -0
  252. package/lib/types/dsh-adapter/migrate/sessionize.d.ts.map +1 -0
  253. package/lib/types/dsh-adapter/migrate/sessionize.js +271 -0
  254. package/lib/types/dsh-adapter/migrate/types.d.ts +176 -0
  255. package/lib/types/dsh-adapter/migrate/types.d.ts.map +1 -0
  256. package/lib/types/dsh-adapter/migrate/types.js +11 -0
  257. package/lib/types/dsh-adapter/migrate/uuid.d.ts +7 -0
  258. package/lib/types/dsh-adapter/migrate/uuid.d.ts.map +1 -0
  259. package/lib/types/dsh-adapter/migrate/uuid.js +25 -0
  260. package/lib/types/dsh-adapter/plugin.d.ts +4 -2
  261. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  262. package/lib/types/dsh-adapter/plugin.js +143 -364
  263. package/lib/types/dsh-adapter/providerWizard.d.ts +17 -0
  264. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  265. package/lib/types/dsh-adapter/providerWizard.js +254 -66
  266. package/lib/types/dsh-adapter/questions.d.ts +22 -15
  267. package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
  268. package/lib/types/dsh-adapter/questions.js +47 -45
  269. package/lib/types/dsh-adapter/sessions/digest.d.ts +11 -6
  270. package/lib/types/dsh-adapter/sessions/digest.d.ts.map +1 -1
  271. package/lib/types/dsh-adapter/sessions/digest.js +20 -13
  272. package/lib/types/dsh-adapter/sessions/frames.d.ts +3 -1
  273. package/lib/types/dsh-adapter/sessions/frames.d.ts.map +1 -1
  274. package/lib/types/dsh-adapter/sessions/frames.js +5 -4
  275. package/lib/types/dsh-adapter/sessions/list.d.ts +6 -1
  276. package/lib/types/dsh-adapter/sessions/list.d.ts.map +1 -1
  277. package/lib/types/dsh-adapter/sessions/list.js +188 -164
  278. package/lib/types/dsh-adapter/sessions/recovery.d.ts +16 -0
  279. package/lib/types/dsh-adapter/sessions/recovery.d.ts.map +1 -0
  280. package/lib/types/dsh-adapter/sessions/recovery.js +108 -0
  281. package/lib/types/dsh-adapter/sessions/snapshot.d.ts +7 -0
  282. package/lib/types/dsh-adapter/sessions/snapshot.d.ts.map +1 -0
  283. package/lib/types/dsh-adapter/sessions/snapshot.js +90 -0
  284. package/lib/types/dsh-adapter/sessions/store.d.ts +10 -4
  285. package/lib/types/dsh-adapter/sessions/store.d.ts.map +1 -1
  286. package/lib/types/dsh-adapter/sessions/store.js +62 -25
  287. package/lib/types/dsh-adapter/sideQuestion.d.ts +41 -2
  288. package/lib/types/dsh-adapter/sideQuestion.d.ts.map +1 -1
  289. package/lib/types/dsh-adapter/sideQuestion.js +98 -2
  290. package/lib/types/dsh-adapter/subagents.d.ts +28 -3
  291. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  292. package/lib/types/dsh-adapter/subagents.js +77 -2
  293. package/lib/types/herdr.d.ts +2 -0
  294. package/lib/types/herdr.d.ts.map +1 -1
  295. package/lib/types/herdr.js +9 -3
  296. package/lib/types/i18n.d.ts +424 -42
  297. package/lib/types/i18n.d.ts.map +1 -1
  298. package/lib/types/i18n.js +145 -20
  299. package/lib/types/ink/components/App.d.ts +2 -2
  300. package/lib/types/ink/components/App.d.ts.map +1 -1
  301. package/lib/types/ink/components/App.js +5 -1
  302. package/lib/types/ink/components/Image.d.ts +14 -1
  303. package/lib/types/ink/components/Image.d.ts.map +1 -1
  304. package/lib/types/ink/components/Image.js +2 -2
  305. package/lib/types/ink/events/input-event.js +3 -3
  306. package/lib/types/ink/hooks/use-terminal-images.d.ts +12 -0
  307. package/lib/types/ink/hooks/use-terminal-images.d.ts.map +1 -1
  308. package/lib/types/ink/hooks/use-terminal-images.js +13 -0
  309. package/lib/types/ink/ink.d.ts +6 -0
  310. package/lib/types/ink/ink.d.ts.map +1 -1
  311. package/lib/types/ink/ink.js +16 -1
  312. package/lib/types/ink/kitty-graphics.d.ts +44 -3
  313. package/lib/types/ink/kitty-graphics.d.ts.map +1 -1
  314. package/lib/types/ink/kitty-graphics.js +184 -23
  315. package/lib/types/ink/output.d.ts +24 -2
  316. package/lib/types/ink/output.d.ts.map +1 -1
  317. package/lib/types/ink/output.js +83 -5
  318. package/lib/types/ink/parse-keypress.d.ts +26 -1
  319. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  320. package/lib/types/ink/parse-keypress.js +156 -13
  321. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  322. package/lib/types/ink/render-node-to-output.js +8 -1
  323. package/lib/types/ink/screen.d.ts +24 -0
  324. package/lib/types/ink/screen.d.ts.map +1 -1
  325. package/lib/types/ink/screen.js +89 -0
  326. package/lib/types/ink/selection.d.ts +40 -18
  327. package/lib/types/ink/selection.d.ts.map +1 -1
  328. package/lib/types/ink/selection.js +142 -30
  329. package/lib/types/ink/sixel-codec.d.ts +12 -1
  330. package/lib/types/ink/sixel-codec.d.ts.map +1 -1
  331. package/lib/types/ink/sixel-codec.js +29 -5
  332. package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
  333. package/lib/types/ink/sixel-graphics.js +5 -3
  334. package/lib/types/ink/styles.d.ts +9 -0
  335. package/lib/types/ink/styles.d.ts.map +1 -1
  336. package/lib/types/ink/terminal-image.d.ts +8 -0
  337. package/lib/types/ink/terminal-image.d.ts.map +1 -1
  338. package/lib/types/ink/terminal-querier.d.ts +7 -1
  339. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  340. package/lib/types/ink/terminal-querier.js +12 -2
  341. package/lib/types/ink/timeline-rail.d.ts +5 -0
  342. package/lib/types/ink/timeline-rail.d.ts.map +1 -1
  343. package/lib/types/math/inline-layout.d.ts +29 -0
  344. package/lib/types/math/inline-layout.d.ts.map +1 -0
  345. package/lib/types/math/inline-layout.js +106 -0
  346. package/lib/types/math/layout.d.ts +58 -0
  347. package/lib/types/math/layout.d.ts.map +1 -0
  348. package/lib/types/math/layout.js +59 -0
  349. package/lib/types/math/renderer.d.ts +64 -0
  350. package/lib/types/math/renderer.d.ts.map +1 -0
  351. package/lib/types/math/renderer.js +256 -0
  352. package/lib/types/screens/Chat.d.ts +14 -1
  353. package/lib/types/screens/Chat.d.ts.map +1 -1
  354. package/lib/types/screens/Chat.js +606 -53
  355. package/lib/types/screens/SessionSupervisor.d.ts +2 -1
  356. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  357. package/lib/types/screens/SessionSupervisor.js +156 -19
  358. package/lib/types/screens/Settings.d.ts.map +1 -1
  359. package/lib/types/screens/Settings.js +49 -11
  360. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  361. package/lib/types/screens/StatusLine.js +45 -15
  362. package/lib/types/screens/chatOverlay.d.ts +5 -0
  363. package/lib/types/screens/chatOverlay.d.ts.map +1 -1
  364. package/lib/types/screens/chatOverlay.js +1 -0
  365. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +47 -0
  366. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -0
  367. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +65 -0
  368. package/lib/types/screens/sessionSupervisor/model.d.ts +12 -0
  369. package/lib/types/screens/sessionSupervisor/model.d.ts.map +1 -1
  370. package/lib/types/screens/sessionSupervisor/model.js +26 -0
  371. package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts +107 -0
  372. package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts.map +1 -0
  373. package/lib/types/screens/sessionSupervisor/useForeignSessions.js +312 -0
  374. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +4 -1
  375. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
  376. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +97 -14
  377. package/lib/types/sessionHistory.d.ts +2 -2
  378. package/lib/types/sessionHistory.d.ts.map +1 -1
  379. package/lib/types/sessionHistory.js +31 -5
  380. package/lib/types/settings/definitions.d.ts +681 -0
  381. package/lib/types/settings/definitions.d.ts.map +1 -0
  382. package/lib/types/settings/definitions.js +511 -0
  383. package/lib/types/starAction.d.ts +44 -0
  384. package/lib/types/starAction.d.ts.map +1 -0
  385. package/lib/types/starAction.js +52 -0
  386. package/lib/types/terminal-utils/latex.d.ts +10 -0
  387. package/lib/types/terminal-utils/latex.d.ts.map +1 -0
  388. package/lib/types/terminal-utils/latex.js +1417 -0
  389. package/lib/types/terminal-utils/markdown.d.ts +3 -1
  390. package/lib/types/terminal-utils/markdown.d.ts.map +1 -1
  391. package/lib/types/terminal-utils/markdown.js +26 -1
  392. package/lib/types/terminal-utils/math.d.ts +66 -0
  393. package/lib/types/terminal-utils/math.d.ts.map +1 -0
  394. package/lib/types/terminal-utils/math.js +337 -0
  395. package/lib/types/tips.d.ts.map +1 -1
  396. package/lib/types/tips.js +6 -0
  397. package/lib/types/tuiDisplayPrefs.d.ts +67 -0
  398. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  399. package/lib/types/tuiDisplayPrefs.js +59 -0
  400. package/lib/types/ui.d.ts +1 -1
  401. package/lib/types/ui.d.ts.map +1 -1
  402. package/lib/types/ui.js +1 -1
  403. package/lib/types/usageStats.d.ts +98 -0
  404. package/lib/types/usageStats.d.ts.map +1 -0
  405. package/lib/types/usageStats.js +169 -0
  406. package/lib/types/utils/bmp.d.ts +17 -0
  407. package/lib/types/utils/bmp.d.ts.map +1 -0
  408. package/lib/types/utils/bmp.js +154 -0
  409. package/lib/types/utils/clipboard.d.ts +14 -2
  410. package/lib/types/utils/clipboard.d.ts.map +1 -1
  411. package/lib/types/utils/clipboard.js +143 -8
  412. package/lib/types/utils/fold-long-lines.d.ts.map +1 -1
  413. package/lib/types/utils/fold-long-lines.js +2 -1
  414. package/lib/types/utils/keymap.d.ts +4 -1
  415. package/lib/types/utils/keymap.d.ts.map +1 -1
  416. package/lib/types/utils/keymap.js +8 -0
  417. package/lib/types/utils/modifiers.d.ts +4 -3
  418. package/lib/types/utils/modifiers.d.ts.map +1 -1
  419. package/lib/types/utils/modifiers.js +4 -3
  420. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/LICENSE +202 -0
  421. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/NOTICE +20 -0
  422. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/index.d.ts +16 -0
  423. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/bundled-packages.json +4 -0
  424. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs +20 -0
  425. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs.LEGAL.txt +35 -0
  426. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/package.json +29 -0
  427. package/package.json +111 -97
@@ -0,0 +1,40 @@
1
+ import { bigTextWidth } from './bigfont.js';
2
+ /**
3
+ * 开屏头部的窄终端降级阶梯——越窄越先放弃「并排」这件事:
4
+ *
5
+ * ① 像素鲸鱼 + `DEEPSEEK`/`HARNESS` 大字 —— 两者都放得下
6
+ * ② 只留大字 logo —— 先撤鲸鱼:大字被截断会毁掉品牌字形,
7
+ * 鲸鱼被撤只是少一个装饰
8
+ * ③ 只留像素鲸鱼 —— 大字放不下,鲸鱼顶上撑住开屏
9
+ * ④ 一行纯文字 —— 两者都放不下
10
+ *
11
+ * 列数一律按**内容区**算:`PageMargin` 已经把 `TerminalSizeContext` 收窄成
12
+ * 内容宽(`PageMargin.tsx`),所以这里不再减页边距。
13
+ */
14
+ /**
15
+ * 鲸鱼 art 的固定盒宽:甩尾帧比标准姿势向右多出 4 列,钉死宽度才不让文字列
16
+ * 跟着左右跳。
17
+ */
18
+ export const WHALE_BOX_WIDTH = 40;
19
+ /** 鲸鱼与文字列之间的间隔列数(头部那行 `Box` 的 `gap`)。 */
20
+ export const COLUMN_GAP = 2;
21
+ /**
22
+ * 解析开屏头部的阶梯档位。
23
+ * @param columns - 内容区列数(不是终端总宽)。
24
+ * @param options - `whale` 对应 `dsh-tui.whale` 设置;`font` 是当天那款字体
25
+ * (字身宽度不同,阈值也就不同)。
26
+ * @returns 该宽度下要渲染的部件。
27
+ */
28
+ export function resolveSplashLayout(columns, options) {
29
+ const { font } = options;
30
+ // 阈值按**画出来**的列数算:每行末尾还会画出一格字距,而 `bigTextWidth` 只算到
31
+ // 最后一个字形。按 ink 宽判「放得下」,会在恰好卡阈值时让 Ink 走 `truncate-end`
32
+ // ——最后一个字形被换成 `…`(可达边界:基准款 55 列即复现)。末尾那一格是空白,
33
+ // 少画一格不可惜,字形被吃掉才可惜。
34
+ const titleWidth = bigTextWidth(font, font.tagline.top, font.tagline.topKerning) + font.tagline.topKerning;
35
+ const fitsTitle = columns >= titleWidth;
36
+ const showWhale = options.whale &&
37
+ columns >= WHALE_BOX_WIDTH &&
38
+ (columns >= titleWidth + COLUMN_GAP + WHALE_BOX_WIDTH || !fitsTitle);
39
+ return { showWhale, showBigTitle: fitsTitle, showPlainTitle: !fitsTitle && !showWhale };
40
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 女仆娘精灵表(30 列 × 30 精灵格,半块渲染 → 15 个文本行)。
3
+ *
4
+ * 来源:本项目作者设计的像素画 `等面积像素格 鲸鱼娘.png`(464×464,透明底),
5
+ * 由 `.local/convert-maid.mjs` 生成:去白底 → 众数降采样 → 眼睛对称化 + 嘴巴/脖子微调。
6
+ * **原创作品、非第三方素材,无需 THIRD_PARTY_LICENSES 条目。**
7
+ *
8
+ * 契约:每行 30 格;`null` = 透明;每格是 [r, g, b]。渲染见 `whaleGirl.ts`。
9
+ * 改了源图就重跑那份脚本,不要手改这个文件。
10
+ */
11
+ /** 精灵格数(列)。 */
12
+ export declare const WHALE_GIRL_COLS = 30;
13
+ /** 精灵行数(半块渲染后是 `WHALE_GIRL_ROWS / 2` 个文本行)。 */
14
+ export declare const WHALE_GIRL_SPRITE_ROWS = 30;
15
+ /** 精灵表:[行][列] = null(透明)或 [r, g, b]。 */
16
+ export declare const WHALE_GIRL_SPRITE: readonly (readonly (readonly [number, number, number] | null)[])[];
17
+ //# sourceMappingURL=whaleGirlSprite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whaleGirlSprite.d.ts","sourceRoot":"","sources":["../../../src/components/whaleGirlSprite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAe;AACf,eAAO,MAAM,eAAe,KAAK,CAAA;AACjC,+CAA+C;AAC/C,eAAO,MAAM,sBAAsB,KAAK,CAAA;AAExC,wCAAwC;AACxC,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,EA+B/F,CAAA"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * 女仆娘精灵表(30 列 × 30 精灵格,半块渲染 → 15 个文本行)。
3
+ *
4
+ * 来源:本项目作者设计的像素画 `等面积像素格 鲸鱼娘.png`(464×464,透明底),
5
+ * 由 `.local/convert-maid.mjs` 生成:去白底 → 众数降采样 → 眼睛对称化 + 嘴巴/脖子微调。
6
+ * **原创作品、非第三方素材,无需 THIRD_PARTY_LICENSES 条目。**
7
+ *
8
+ * 契约:每行 30 格;`null` = 透明;每格是 [r, g, b]。渲染见 `whaleGirl.ts`。
9
+ * 改了源图就重跑那份脚本,不要手改这个文件。
10
+ */
11
+ /** 精灵格数(列)。 */
12
+ export const WHALE_GIRL_COLS = 30;
13
+ /** 精灵行数(半块渲染后是 `WHALE_GIRL_ROWS / 2` 个文本行)。 */
14
+ export const WHALE_GIRL_SPRITE_ROWS = 30;
15
+ /** 精灵表:[行][列] = null(透明)或 [r, g, b]。 */
16
+ export const WHALE_GIRL_SPRITE = [
17
+ [null, null, null, null, null, null, null, null, null, null, [43, 56, 120], [80, 98, 170], [82, 100, 171], null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null],
18
+ [null, null, null, null, null, null, null, null, null, [36, 46, 105], [83, 100, 171], null, [49, 63, 134], [25, 32, 84], null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null],
19
+ [null, null, null, null, null, null, null, null, null, [33, 42, 100], null, [18, 21, 71], [20, 24, 75], [18, 21, 72], [253, 253, 253], [18, 21, 72], [19, 23, 74], null, null, null, null, null, null, null, null, null, null, null, null, null],
20
+ [null, null, null, null, null, null, null, null, null, null, [16, 19, 67], [253, 252, 253], [254, 254, 254], [254, 254, 254], [254, 254, 254], [189, 185, 212], [253, 253, 253], [254, 253, 254], [16, 19, 69], null, null, null, null, null, null, null, null, null, null, null],
21
+ [null, null, null, null, null, null, null, null, null, [16, 19, 67], [188, 184, 211], [254, 254, 254], [254, 254, 254], [253, 253, 254], [254, 254, 254], [189, 184, 211], [254, 254, 254], [254, 254, 254], [251, 250, 252], [19, 22, 71], null, null, null, null, null, null, null, null, null, null],
22
+ [null, null, null, null, null, null, null, null, [16, 19, 67], [250, 250, 252], [254, 254, 254], [254, 254, 254], [72, 92, 173], [45, 61, 131], [45, 61, 131], [47, 61, 131], [253, 253, 254], [254, 254, 254], [254, 254, 254], [20, 23, 72], null, null, null, null, null, null, null, null, null, null],
23
+ [null, null, null, null, null, null, null, null, [16, 19, 67], [252, 252, 253], [46, 60, 129], [46, 61, 129], [73, 93, 174], [73, 93, 175], [73, 93, 175], [72, 93, 173], [45, 61, 132], [46, 62, 133], [254, 254, 254], [187, 183, 211], [17, 21, 70], null, null, null, null, null, null, null, null, null],
24
+ [null, null, null, null, null, null, null, null, [16, 19, 67], [47, 62, 131], [73, 93, 173], [74, 94, 174], [74, 94, 174], [74, 94, 175], [75, 95, 175], [74, 94, 175], [73, 94, 175], [73, 94, 175], [46, 62, 132], [252, 251, 253], [252, 252, 252], [17, 20, 70], null, null, null, null, null, null, null, null],
25
+ [null, null, null, null, null, null, null, [17, 20, 70], [42, 56, 123], [73, 93, 172], [73, 93, 172], [44, 57, 124], [74, 94, 174], [74, 94, 174], [97, 124, 191], [97, 124, 191], [75, 95, 175], [74, 95, 175], [15, 20, 68], [96, 126, 191], [26, 32, 86], [56, 79, 169], null, null, null, null, null, null, null, null],
26
+ [null, null, null, null, null, null, null, [17, 20, 70], [72, 90, 168], [73, 91, 170], [73, 92, 170], [45, 57, 122], [73, 92, 171], [74, 93, 173], [73, 92, 172], [45, 60, 128], [75, 94, 174], [74, 94, 175], [16, 21, 70], [16, 20, 68], [247, 192, 126], [56, 78, 168], [14, 20, 68], null, null, null, null, null, null, null],
27
+ [null, null, null, null, null, null, null, [17, 20, 69], [72, 90, 168], [73, 91, 169], [44, 57, 123], [59, 71, 139], [74, 92, 169], [75, 93, 171], [73, 92, 172], [46, 60, 128], [74, 94, 174], [74, 94, 174], [15, 20, 68], [250, 250, 250], [247, 191, 125], [33, 47, 114], null, null, null, null, null, null, null, null],
28
+ [null, null, null, null, null, null, null, [17, 20, 69], [72, 90, 168], [73, 91, 169], [43, 57, 123], [248, 181, 153], [73, 91, 168], [73, 92, 171], [73, 92, 172], [250, 191, 164], [45, 60, 130], [74, 93, 173], [73, 94, 176], [18, 23, 73], [27, 34, 87], [15, 19, 68], null, null, null, null, null, null, null, null],
29
+ [null, null, null, null, null, null, [17, 20, 69], [72, 89, 166], [72, 89, 166], [73, 91, 169], [245, 178, 151], [254, 233, 220], [73, 90, 166], [73, 91, 170], [251, 191, 166], [254, 233, 220], [250, 192, 167], [73, 93, 172], [72, 93, 175], [16, 20, 70], [71, 92, 174], [16, 20, 69], [16, 20, 69], null, null, null, null, null, null, null],
30
+ [null, null, null, null, null, [17, 20, 70], [40, 50, 107], [72, 89, 166], [72, 89, 167], [72, 89, 167], [20, 22, 69], [17, 20, 65], [247, 229, 217], [73, 90, 167], [252, 234, 222], [16, 18, 65], [15, 19, 65], [14, 18, 66], [73, 94, 175], [73, 93, 175], [40, 54, 122], [41, 53, 117], [46, 61, 133], [16, 19, 70], null, null, null, null, null, null],
31
+ [null, null, null, [22, 24, 73], [23, 27, 78], [41, 51, 108], [41, 51, 108], [72, 89, 166], [72, 88, 167], [15, 17, 64], [251, 251, 252], [31, 46, 102], [18, 21, 66], [74, 91, 169], [19, 22, 70], [251, 251, 252], [55, 78, 139], [15, 20, 68], [73, 93, 176], [73, 94, 176], [40, 55, 123], [162, 158, 194], [46, 60, 130], [46, 60, 129], [17, 21, 72], null, null, null, null, null],
32
+ [null, null, null, null, null, [17, 20, 69], [165, 160, 195], [163, 158, 195], [40, 55, 124], [73, 94, 176], [72, 93, 176], [51, 88, 146], [48, 86, 146], [254, 254, 254], [254, 233, 220], [254, 254, 254], [48, 86, 146], [51, 88, 146], [72, 93, 176], [73, 94, 176], [40, 55, 124], [163, 158, 195], [165, 160, 195], [17, 20, 69], null, null, null, null, null, null],
33
+ [null, null, null, null, null, null, [164, 159, 195], [43, 58, 127], [71, 92, 173], [44, 60, 132], [73, 94, 176], [99, 157, 204], [100, 159, 206], [254, 254, 254], [254, 232, 220], [254, 254, 254], [100, 159, 206], [99, 157, 204], [73, 94, 176], [44, 60, 132], [71, 92, 173], [43, 58, 127], [164, 159, 195], null, null, null, null, null, null, null],
34
+ [null, null, null, null, null, null, [16, 20, 69], [41, 57, 126], [72, 92, 174], [44, 60, 132], [72, 93, 174], [251, 183, 155], [253, 232, 220], [254, 232, 219], [254, 233, 220], [254, 232, 219], [253, 232, 220], [251, 183, 155], [72, 93, 174], [44, 60, 132], [72, 92, 174], [41, 57, 126], [16, 20, 69], null, null, null, null, null, null, null],
35
+ [null, null, null, null, null, null, null, [46, 62, 132], [69, 88, 169], [44, 60, 130], [44, 59, 129], [41, 57, 128], [254, 233, 220], [254, 232, 219], [254, 233, 219], [254, 233, 220], [43, 59, 130], [72, 93, 175], [39, 52, 118], [46, 61, 134], [71, 91, 173], [71, 92, 173], [37, 50, 118], null, null, null, null, [22, 28, 82], null, null],
36
+ [null, null, null, null, null, null, [19, 22, 71], [18, 21, 69], [71, 90, 169], [44, 59, 131], [37, 49, 113], [42, 58, 128], [41, 56, 127], [247, 173, 143], [246, 170, 140], [42, 58, 127], [42, 58, 128], [72, 92, 173], [40, 52, 119], [39, 52, 118], [44, 60, 133], [72, 92, 174], [71, 92, 173], [20, 23, 72], null, null, [17, 20, 70], [43, 58, 129], null, null],
37
+ [null, null, null, null, null, [16, 19, 68], [253, 233, 220], [253, 233, 220], [70, 90, 170], [44, 59, 130], [38, 50, 115], [251, 251, 253], [252, 252, 253], [246, 170, 140], [254, 254, 254], [254, 253, 254], [72, 93, 174], [72, 93, 173], [40, 52, 120], [39, 52, 119], [44, 60, 133], [71, 92, 174], [71, 92, 173], [18, 21, 71], [17, 20, 70], null, [23, 29, 84], [44, 59, 130], null, null],
38
+ [null, null, null, null, null, [15, 17, 66], [253, 233, 220], [254, 233, 220], [17, 21, 71], [43, 58, 129], [251, 251, 253], [254, 254, 254], [17, 20, 70], [200, 194, 217], [17, 20, 68], [18, 21, 70], [71, 91, 171], [251, 251, 253], [20, 24, 75], [38, 51, 119], [45, 61, 134], [71, 92, 174], [71, 92, 173], [18, 21, 71], [43, 60, 131], [17, 21, 72], [44, 60, 131], [43, 59, 129], null, null],
39
+ [null, null, null, null, null, [179, 174, 204], [249, 190, 166], [254, 233, 219], [17, 21, 72], [19, 22, 74], [179, 174, 207], [253, 253, 254], [22, 27, 79], [245, 192, 129], [34, 43, 99], [17, 20, 70], [73, 94, 174], [190, 185, 212], [190, 185, 213], [19, 22, 75], [44, 60, 133], [71, 91, 173], [70, 91, 172], null, [43, 59, 131], [44, 60, 132], [44, 60, 131], null, null, null],
40
+ [null, null, null, null, [21, 24, 72], [162, 158, 197], [253, 253, 254], [253, 253, 253], [45, 56, 122], [15, 19, 68], [254, 253, 254], [134, 134, 184], [36, 46, 107], [253, 253, 253], [17, 20, 70], [43, 55, 122], [252, 252, 253], [254, 254, 254], [47, 59, 123], [43, 55, 120], [16, 20, 70], [71, 91, 173], [41, 58, 131], null, null, [40, 58, 132], [17, 21, 71], null, null, null],
41
+ [null, null, null, null, [15, 18, 66], [32, 42, 98], [34, 43, 100], [146, 145, 190], [43, 55, 119], [15, 19, 69], [134, 134, 183], [253, 252, 253], [14, 17, 64], [254, 254, 254], [253, 253, 253], [16, 19, 66], [253, 253, 253], [253, 253, 254], [44, 56, 121], [45, 57, 122], [45, 58, 124], [15, 20, 69], [70, 90, 171], [18, 23, 71], [42, 61, 134], [41, 59, 132], [17, 21, 72], null, null, null],
42
+ [null, null, null, null, null, [16, 20, 68], [34, 43, 99], [40, 52, 114], [33, 43, 101], [34, 44, 102], [15, 19, 67], [253, 253, 254], [253, 252, 253], [254, 254, 254], [185, 179, 210], [252, 252, 253], [254, 254, 254], [16, 20, 67], [251, 233, 222], [254, 233, 221], [44, 56, 121], [15, 19, 67], [70, 90, 171], [41, 59, 133], [41, 59, 132], [41, 59, 132], [16, 20, 71], null, null, null],
43
+ [null, null, null, null, null, [14, 18, 67], [40, 52, 116], [33, 43, 100], [34, 44, 102], [34, 44, 102], [15, 19, 67], [194, 189, 215], [193, 189, 214], [245, 191, 127], [18, 21, 71], [194, 190, 215], [193, 189, 215], [15, 18, 66], [254, 233, 221], [254, 233, 221], [251, 193, 168], [15, 18, 66], [33, 45, 109], [42, 60, 133], [42, 60, 133], [18, 22, 74], null, null, null, null],
44
+ [null, null, null, null, null, null, [22, 26, 76], [35, 44, 102], [36, 46, 105], [18, 22, 71], [19, 22, 69], [192, 188, 213], [194, 189, 214], [245, 192, 130], [18, 21, 71], [200, 196, 219], [195, 190, 216], [19, 22, 70], [254, 236, 226], [254, 234, 221], [251, 194, 168], [20, 23, 70], [34, 46, 109], [42, 57, 127], [23, 28, 81], null, null, null, null, null],
45
+ [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null],
46
+ [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null],
47
+ ];
@@ -80,4 +80,78 @@ export declare function estimateSessionCostSplitCny(tokens: CostTokenBuckets, mo
80
80
  * 估算本会话花费(人民币,元)——estimateSessionCostSplitCny 的总价捷径。
81
81
  */
82
82
  export declare function estimateSessionCostCny(tokens: CostTokenBuckets, model: string): number | undefined;
83
+ /** 一笔增量 usage(durable assistant/message.usage 的计价字段)。 */
84
+ export type CostUsageDelta = Partial<CostTokenTotals>;
85
+ /** 空的峰谷分桶(新模型 / 新会话累计起点)。 */
86
+ export declare function emptyCostBuckets(): CostTokenBuckets;
87
+ /** 深拷贝分桶,供快照镜像(调用方拿到后修改不得影响累计源)。 */
88
+ export declare function cloneCostBuckets(buckets: CostTokenBuckets): CostTokenBuckets;
89
+ /**
90
+ * 把一笔 usage 按计价时段累加进分桶(in-place)。durable 事件按发生时刻
91
+ * 落桶,峰/谷单价不同;cacheRead/cacheWrite 作为分项保留(cacheRead 计价
92
+ * 时按命中价,见 costSplit)。
93
+ */
94
+ export declare function addUsageToCostBuckets(buckets: CostTokenBuckets, usage: CostUsageDelta, peak: boolean): void;
95
+ /** 一笔待计价用量:provider 决定官方与否,model 查价目,buckets 为峰谷分桶。 */
96
+ export interface CostBucketEntry {
97
+ readonly provider: string;
98
+ readonly model: string;
99
+ readonly buckets: CostTokenBuckets;
100
+ /** 展示分侧(主会话 / 子代理);缺省按主会话处理(兼容旧调用)。 */
101
+ readonly scope?: 'main' | 'subagent';
102
+ }
103
+ /** 多模型桶计价选项。 */
104
+ export interface EstimateCostOptions {
105
+ /** 默认 true:非官方 provider 一律不估价(只计入 unpriced)。false 时
106
+ * 非官方 provider 也按 model 价目估算(调用方自担口径)。 */
107
+ readonly officialOnly?: boolean;
108
+ }
109
+ /** 多模型桶计价结果:金额按展示分侧拆解,未计价 token 单独上报。 */
110
+ export interface SessionCostEstimate {
111
+ /** 已计价总额(元)= main + subagent。 */
112
+ readonly total: number;
113
+ /** 主会话部分(元)。 */
114
+ readonly main: number;
115
+ /** 子代理部分(元)。 */
116
+ readonly subagent: number;
117
+ /** 高峰时段部分(元)。 */
118
+ readonly peak: number;
119
+ /** 空闲时段部分(元)。 */
120
+ readonly idle: number;
121
+ /** 未能计价的用量 token(非官方 provider / 价目未收录):只展示,不计金额。 */
122
+ readonly unpricedTokens: number;
123
+ }
124
+ /**
125
+ * 多模型桶计价纯函数:逐条目查价求和,金额按 scope 拆成主会话/子代理,
126
+ * 非官方 provider 或未收录模型计入 unpriced(只上报 token,不给金额)。
127
+ * 所有条目都是零 token 时返回 undefined(调用方不显示金额)。
128
+ * 空 provider 表示旧快照/测试桩(生产契约里 provider 恒有)——不武断视为
129
+ * 非官方,按 model 价目估算,避免既有展示静默少算。
130
+ */
131
+ export declare function estimateCostFromBucketsCny(entries: readonly CostBucketEntry[], options?: EstimateCostOptions): SessionCostEstimate | undefined;
132
+ /** 费用估算输入:主会话按模型桶 + 子代理按 (provider, model) 桶。 */
133
+ export interface SessionCostInput {
134
+ /** 主会话当前 provider(主会话条目的官方判定;空串 = 旧快照)。 */
135
+ readonly provider: string;
136
+ /** 主会话按模型分桶(ChannelState.mainCost)。 */
137
+ readonly main?: Readonly<Record<string, CostTokenBuckets>> | undefined;
138
+ /** 子代理按 (provider, model) 分桶(ChannelState.subagentCost)。 */
139
+ readonly subagents?: readonly {
140
+ readonly provider: string;
141
+ readonly model: string;
142
+ readonly buckets: CostTokenBuckets;
143
+ }[] | undefined;
144
+ /** main 缺失/为空时的回退 token(旧快照/测试桩没有 mainCost 时用
145
+ * channel.tokens + 当前模型,保持既有展示不消失)。 */
146
+ readonly fallbackTokens?: CostTokenBuckets | undefined;
147
+ readonly fallbackModel?: string | undefined;
148
+ }
149
+ /**
150
+ * 汇总一次费用估算的输入条目:主会话按模型分桶优先;没有分桶的旧快照
151
+ * 回退到 `channel.tokens` + 当前模型(不叠加,避免双计);子代理条目
152
+ * 追加在后。纯函数,不修改入参。
153
+ */
154
+ export declare function collectSessionCostEntries(input: SessionCostInput): CostBucketEntry[];
155
+ /** collectSessionCostEntries + estimateCostFromBucketsCny 的展示侧捷径。 */
156
+ export declare function estimateSessionCostSnapshotCny(input: SessionCostInput, options?: EstimateCostOptions): SessionCostEstimate | undefined;
83
157
  //# sourceMappingURL=deepseekPricing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepseekPricing.d.ts","sourceRoot":"","sources":["../../src/deepseekPricing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,uCAAuC;AACvC,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAErD,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,SAAS,EAAE,aAAa,CAAA;IACxB,gBAAgB;IAChB,QAAQ,EAAE,aAAa,CAAA;IACvB,UAAU;IACV,MAAM,EAAE,aAAa,CAAA;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAsB9E,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAIxD,CAAA;AAED,gDAAgD;AAChD,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,GAAE,IAAiB,GAAG,OAAO,CAM3D;AAED,wCAAwC;AACxC,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAU3E;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,E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A;CAC5C;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,gBAAgB,GAAG,eAAe,EAAE,CAgBpF;AAED,qEAAqE;AACrE,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,gBAAgB,EACvB,OAAO,GAAE,mBAAwB,GAChC,mBAAmB,GAAG,SAAS,CAEjC"}
@@ -25,20 +25,18 @@ export const DEEPSEEK_MODEL_PRICES = {
25
25
  inputHit: [0.02, 0.04],
26
26
  output: [4.0, 8.0],
27
27
  },
28
+ // issue #857:官方已按 Flash 价计费 V4.1-Flash 的正式 id 与 vision 实验 id;
29
+ // V4-Pro 已下线,不再保留价目行(未收录 → priceForModel 返回 undefined,
30
+ // 界面只展示 token、不给金额)。
28
31
  'deepseek-v4-flash': {
29
- inputMiss: [1.5, 3.0],
30
- inputHit: [0.05, 0.10],
31
- output: [4.5, 9.0],
32
- },
33
- 'deepseek-v4-pro': {
34
- inputMiss: [4.5, 9.0],
35
- inputHit: [0.15, 0.30],
36
- output: [13.5, 27.0],
32
+ inputMiss: [1.0, 2.0],
33
+ inputHit: [0.02, 0.04],
34
+ output: [4.0, 8.0],
37
35
  },
38
36
  'deepseek-v4-flash-vision-exp': {
39
- inputMiss: [1.5, 3.0],
40
- inputHit: [0.05, 0.10],
41
- output: [4.5, 9.0],
37
+ inputMiss: [1.0, 2.0],
38
+ inputHit: [0.02, 0.04],
39
+ output: [4.0, 8.0],
42
40
  },
43
41
  };
44
42
  /**
@@ -138,3 +136,104 @@ export function estimateSessionCostSplitCny(tokens, model) {
138
136
  export function estimateSessionCostCny(tokens, model) {
139
137
  return estimateSessionCostSplitCny(tokens, model)?.total;
140
138
  }
139
+ /** 空的峰谷分桶(新模型 / 新会话累计起点)。 */
140
+ export function emptyCostBuckets() {
141
+ return {
142
+ peak: { ...EMPTY_TOTALS },
143
+ idle: { ...EMPTY_TOTALS },
144
+ };
145
+ }
146
+ /** 深拷贝分桶,供快照镜像(调用方拿到后修改不得影响累计源)。 */
147
+ export function cloneCostBuckets(buckets) {
148
+ return {
149
+ peak: { ...(buckets.peak ?? EMPTY_TOTALS) },
150
+ idle: { ...(buckets.idle ?? EMPTY_TOTALS) },
151
+ };
152
+ }
153
+ /**
154
+ * 把一笔 usage 按计价时段累加进分桶(in-place)。durable 事件按发生时刻
155
+ * 落桶,峰/谷单价不同;cacheRead/cacheWrite 作为分项保留(cacheRead 计价
156
+ * 时按命中价,见 costSplit)。
157
+ */
158
+ export function addUsageToCostBuckets(buckets, usage, peak) {
159
+ const bucket = peak ? buckets.peak : buckets.idle;
160
+ bucket.input += usage.input ?? 0;
161
+ bucket.output += usage.output ?? 0;
162
+ bucket.cacheRead += usage.cacheRead ?? 0;
163
+ bucket.cacheWrite += usage.cacheWrite ?? 0;
164
+ }
165
+ /** 分桶里的计价 token 总数(input 含 cacheRead,与既有显示口径一致)。 */
166
+ function bucketTokenTotal(buckets) {
167
+ const peak = buckets.peak ?? EMPTY_TOTALS;
168
+ const idle = buckets.idle ?? EMPTY_TOTALS;
169
+ return peak.input + peak.output + idle.input + idle.output;
170
+ }
171
+ /**
172
+ * 多模型桶计价纯函数:逐条目查价求和,金额按 scope 拆成主会话/子代理,
173
+ * 非官方 provider 或未收录模型计入 unpriced(只上报 token,不给金额)。
174
+ * 所有条目都是零 token 时返回 undefined(调用方不显示金额)。
175
+ * 空 provider 表示旧快照/测试桩(生产契约里 provider 恒有)——不武断视为
176
+ * 非官方,按 model 价目估算,避免既有展示静默少算。
177
+ */
178
+ export function estimateCostFromBucketsCny(entries, options = {}) {
179
+ const officialOnly = options.officialOnly !== false;
180
+ let total = 0;
181
+ let main = 0;
182
+ let subagent = 0;
183
+ let peak = 0;
184
+ let idle = 0;
185
+ let unpricedTokens = 0;
186
+ let tokenCount = 0;
187
+ for (const entry of entries) {
188
+ const tokens = bucketTokenTotal(entry.buckets);
189
+ tokenCount += tokens;
190
+ const priceable = !officialOnly
191
+ || entry.provider === ''
192
+ || isDeepSeekOfficialProvider(entry.provider);
193
+ const price = priceable ? priceForModel(entry.model) : undefined;
194
+ if (price === undefined) {
195
+ unpricedTokens += tokens;
196
+ continue;
197
+ }
198
+ const split = costSplit(entry.buckets, price);
199
+ const amount = (split.peak + split.idle) / 1_000_000;
200
+ total += amount;
201
+ peak += split.peak / 1_000_000;
202
+ idle += split.idle / 1_000_000;
203
+ if (entry.scope === 'subagent')
204
+ subagent += amount;
205
+ else
206
+ main += amount;
207
+ }
208
+ if (tokenCount <= 0)
209
+ return undefined;
210
+ return { total, main, subagent, peak, idle, unpricedTokens };
211
+ }
212
+ /**
213
+ * 汇总一次费用估算的输入条目:主会话按模型分桶优先;没有分桶的旧快照
214
+ * 回退到 `channel.tokens` + 当前模型(不叠加,避免双计);子代理条目
215
+ * 追加在后。纯函数,不修改入参。
216
+ */
217
+ export function collectSessionCostEntries(input) {
218
+ const entries = [];
219
+ const main = input.main ?? {};
220
+ const mainModels = Object.keys(main);
221
+ if (mainModels.length > 0) {
222
+ for (const model of mainModels) {
223
+ const buckets = main[model];
224
+ if (buckets !== undefined)
225
+ entries.push({ provider: input.provider, model, buckets, scope: 'main' });
226
+ }
227
+ }
228
+ else if (input.fallbackTokens !== undefined && input.fallbackModel !== undefined && input.fallbackModel !== '') {
229
+ entries.push({ provider: input.provider, model: input.fallbackModel, buckets: input.fallbackTokens, scope: 'main' });
230
+ }
231
+ for (const subagent of input.subagents ?? []) {
232
+ entries.push({ provider: subagent.provider, model: subagent.model, buckets: subagent.buckets, scope: 'subagent' });
233
+ }
234
+ return entries;
235
+ }
236
+ /** collectSessionCostEntries + estimateCostFromBucketsCny 的展示侧捷径。 */
237
+ export function estimateSessionCostSnapshotCny(input, options = {}) {
238
+ return estimateCostFromBucketsCny(collectSessionCostEntries(input), options);
239
+ }
@@ -4,7 +4,7 @@ import type { ChannelState } from './types.js';
4
4
  * specialist has been constructed. Construction-time callers fail closed
5
5
  * rather than receiving a plausible no-op while the Channel is incomplete.
6
6
  */
7
- export type ChannelActionDelegates = Pick<ChannelState, 'commandCompletions' | 'loadOlder' | 'rewindTo' | 'rewindToNode' | 'forkSession' | 'resumeTo' | 'newSession' | 'listWorkspaces' | 'listWorkspaceRegistry' | 'removeWorkspace' | 'renameWorkspaceAt' | 'resolveWorkspace' | 'switchWorkspace' | 'renameWorkspace' | 'workspaceCommands' | 'runWorkspaceCommand' | 'switchModel' | 'listEfforts' | 'setEffort' | 'setDefaultEffort' | 'cycleMode' | 'runPermissionPreset' | 'clear' | 'setActivityFrames' | 'listPresets' | 'switchPreset' | 'listModels' | 'listProviders' | 'invalidateModelCompletion' | 'listSkills' | 'describeCredential' | 'balanceInfo' | 'sideQuestion' | 'listFileCandidates' | 'listFiles' | 'listSessions' | 'previewSession' | 'bindApprovalStore' | 'agentViewRows' | 'subscribeAgentView' | 'dispatchBackgroundAgent' | 'stopBackgroundAgent' | 'attachToAgent' | 'peekAgentSession' | 'replyToAgent' | 'backgroundCurrent' | 'setResumeTarget' | 'renameSession' | 'setSessionColor' | 'recapRecent' | 'deleteSession' | 'renameSessionTo' | 'compact' | 'runExternalCommand' | 'runExternalCommandOutcome' | 'pushLocal' | 'mcpStatus' | 'exportSession' | 'initWorkspace' | 'doctorInfo' | 'pluginsInfo' | 'listSubagents'> & {
7
+ export type ChannelActionDelegates = Pick<ChannelState, 'commandCompletions' | 'loadOlder' | 'rewindTo' | 'rewindToNode' | 'forkSession' | 'resumeTo' | 'newSession' | 'listWorkspaces' | 'listWorkspaceRegistry' | 'removeWorkspace' | 'renameWorkspaceAt' | 'resolveWorkspace' | 'switchWorkspace' | 'renameWorkspace' | 'workspaceCommands' | 'runWorkspaceCommand' | 'switchModel' | 'listEfforts' | 'setEffort' | 'setDefaultEffort' | 'cycleMode' | 'runPermissionPreset' | 'clear' | 'setActivityFrames' | 'listPresets' | 'switchPreset' | 'listModels' | 'listProviders' | 'invalidateModelCompletion' | 'listSkills' | 'describeCredential' | 'balanceInfo' | 'sideQuestion' | 'listFileCandidates' | 'listFiles' | 'cachedSessions' | 'listSessions' | 'previewSession' | 'listForeignSources' | 'listForeignSessions' | 'importForeignSession' | 'bindApprovalStore' | 'agentViewRows' | 'subscribeAgentView' | 'dispatchBackgroundAgent' | 'stopBackgroundAgent' | 'attachToAgent' | 'peekAgentSession' | 'replyToAgent' | 'backgroundCurrent' | 'setResumeTarget' | 'renameSession' | 'setSessionColor' | 'recapRecent' | 'deleteSession' | 'renameSessionTo' | 'compact' | 'cancelCompact' | 'runExternalCommand' | 'runExternalCommandOutcome' | 'pushLocal' | 'mcpStatus' | 'exportSession' | 'initWorkspace' | 'doctorInfo' | 'pluginsInfo' | 'listSubagents'> & {
8
8
  runLocalCommand(command: string, includeInContext: boolean): Promise<void>;
9
9
  };
10
10
  type ChannelActionMethodName = Exclude<keyof ChannelActionDelegates, 'runLocalCommand'>;
@@ -1 +1 @@
1
- {"version":3,"file":"action-readiness.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/action-readiness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,YAAY,EAClD,oBAAoB,GACpB,WAAW,GACX,UAAU,GACV,cAAc,GACd,aAAa,GACb,UAAU,GACV,YAAY,GACZ,gBAAgB,GAChB,uBAAuB,GACvB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,qBAAqB,GACrB,aAAa,GACb,aAAa,GACb,WAAW,GACX,kBAAkB,GAClB,WAAW,GACX,qBAAqB,GACrB,OAAO,GACP,mBAAmB,GACnB,aAAa,GACb,cAAc,GACd,YAAY,GACZ,eAAe,GACf,2BAA2B,GAC3B,YAAY,GACZ,oBAAoB,GACpB,aAAa,GACb,cAAc,GACd,oBAAoB,GACpB,WAAW,GACX,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GACnB,eAAe,GACf,oBAAoB,GACpB,yBAAyB,GACzB,qBAAqB,GACrB,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,mBAAmB,GACnB,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,iBAAiB,GACjB,SAAS,GACT,oBAAoB,GACpB,2BAA2B,GAC3B,WAAW,GACX,WAAW,GACX,eAAe,GACf,eAAe,GACf,YAAY,GACZ,aAAa,GACb,eAAe,CAClB,GAAG;IACF,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3E,CAAA;AAED,KAAK,uBAAuB,GAAG,OAAO,CAAC,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,CAAA;AACvF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;AAE9E;4EAC4E;AAC5E,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,sBAAsB,GAC5C,oBAAoB,CAoEtB;AAED,wBAAgB,4BAA4B;kBAG1B,sBAAsB,GAAG,IAAI;uBAIxB,sBAAsB;EAK5C"}
1
+ {"version":3,"file":"action-readiness.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/action-readiness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,YAAY,EAClD,oBAAoB,GACpB,WAAW,GACX,UAAU,GACV,cAAc,GACd,aAAa,GACb,UAAU,GACV,YAAY,GACZ,gBAAgB,GAChB,uBAAuB,GACvB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,qBAAqB,GACrB,aAAa,GACb,aAAa,GACb,WAAW,GACX,kBAAkB,GAClB,WAAW,GACX,qBAAqB,GACrB,OAAO,GACP,mBAAmB,GACnB,aAAa,GACb,cAAc,GACd,YAAY,GACZ,eAAe,GACf,2BAA2B,GAC3B,YAAY,GACZ,oBAAoB,GACpB,aAAa,GACb,cAAc,GACd,oBAAoB,GACpB,WAAW,GACX,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,oBAAoB,GACpB,qBAAqB,GACrB,sBAAsB,GACtB,mBAAmB,GACnB,eAAe,GACf,oBAAoB,GACpB,yBAAyB,GACzB,qBAAqB,GACrB,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,mBAAmB,GACnB,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,iBAAiB,GACjB,SAAS,GACT,eAAe,GACf,oBAAoB,GACpB,2BAA2B,GAC3B,WAAW,GACX,WAAW,GACX,eAAe,GACf,eAAe,GACf,YAAY,GACZ,aAAa,GACb,eAAe,CAClB,GAAG;IACF,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3E,CAAA;AAED,KAAK,uBAAuB,GAAG,OAAO,CAAC,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,CAAA;AACvF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;AAE9E;4EAC4E;AAC5E,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,sBAAsB,GAC5C,oBAAoB,CAyEtB;AAED,wBAAgB,4BAA4B;kBAG1B,sBAAsB,GAAG,IAAI;uBAIxB,sBAAsB;EAK5C"}
@@ -40,8 +40,12 @@ export function createChannelActionMethods(getReadyActions) {
40
40
  sideQuestion: (question, options) => getReadyActions().sideQuestion(question, options),
41
41
  listFileCandidates: (query, options) => getReadyActions().listFileCandidates(query, options),
42
42
  listFiles: () => getReadyActions().listFiles(),
43
- listSessions: () => getReadyActions().listSessions(),
43
+ cachedSessions: () => getReadyActions().cachedSessions(),
44
+ listSessions: (onEnriched, onPartial) => getReadyActions().listSessions(onEnriched, onPartial),
44
45
  previewSession: sessionId => getReadyActions().previewSession(sessionId),
46
+ listForeignSources: () => getReadyActions().listForeignSources(),
47
+ listForeignSessions: (agentId, onRow) => getReadyActions().listForeignSessions(agentId, onRow),
48
+ importForeignSession: (agentId, key) => getReadyActions().importForeignSession(agentId, key),
45
49
  bindApprovalStore: store => getReadyActions().bindApprovalStore(store),
46
50
  agentViewRows: () => getReadyActions().agentViewRows(),
47
51
  subscribeAgentView: listener => getReadyActions().subscribeAgentView(listener),
@@ -58,6 +62,7 @@ export function createChannelActionMethods(getReadyActions) {
58
62
  deleteSession: sessionId => getReadyActions().deleteSession(sessionId),
59
63
  renameSessionTo: (sessionId, title) => getReadyActions().renameSessionTo(sessionId, title),
60
64
  compact: () => getReadyActions().compact(),
65
+ cancelCompact: () => getReadyActions().cancelCompact(),
61
66
  runExternalCommand: (name, rawInput) => getReadyActions().runExternalCommand(name, rawInput),
62
67
  runExternalCommandOutcome: (name, rawInput, images) => getReadyActions().runExternalCommandOutcome(name, rawInput, images),
63
68
  pushLocal: (title, lines) => getReadyActions().pushLocal(title, lines),
@@ -22,6 +22,7 @@ export declare function createBackgroundCurrentAction(ctx: Context, state: Pick<
22
22
  };
23
23
  resetProjector(): void;
24
24
  resetSubagents(): void;
25
+ parkSubagents(agent: AgentHandle['agent']): void;
25
26
  resetJobs(): void;
26
27
  refreshEffortLevels(): void;
27
28
  bindAgent(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"background-action.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/background-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,wBAAwB,CAAA;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAYlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAA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IAAI,IAAI,CAAA;CACxB,GACA,MAAM,OAAO,CAAC,gBAAgB,CAAC,CA0FjC"}
@@ -62,6 +62,7 @@ export function createBackgroundCurrentAction(ctx, state, options, deps) {
62
62
  try {
63
63
  const result = deps.binding.adopt(handle, adoption, (previous, disposePrevious) => {
64
64
  const previousSessionId = String(previous.agent.session.id);
65
+ deps.parkSubagents(previous.agent);
65
66
  if (previous.handle !== undefined) {
66
67
  deps.backgroundHandles.set(previousSessionId, previous.handle);
67
68
  disposePrevious('park');
@@ -1,4 +1,4 @@
1
- import type { AssistantStreamFrame, ModelSelectionRef } from '@deepseek-ai/dsh-agent';
1
+ import type { Agent, AssistantStreamFrame, ModelSelectionRef } from '@deepseek-ai/dsh-agent';
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
3
  import type { InputConvergence } from './input-actions.js';
4
4
  import type { ChannelBinding } from './binding.js';
@@ -6,11 +6,10 @@ import type { ChannelOwner } from './owner.js';
6
6
  import { type createChannelProjection } from './projection.js';
7
7
  import type { ChannelState } from './types.js';
8
8
  /**
9
- * The binding event router is the sole subscriber for a foreground Agent.
10
- * It captures the binding generation at every listener entry; teardown is
11
- * incremental and retained callbacks check that captured Agent/session pair
12
- * before touching state. Transcript presentation remains exclusively owned by
13
- * ChannelProjection.
9
+ * Foreground transcript listeners capture a binding generation. Child event
10
+ * listeners instead span the Channel owner, keeping parked reducers current
11
+ * across rebinds. Both paths own registrations incrementally and fence retained
12
+ * callbacks; only ChannelProjection presents the foreground transcript.
14
13
  */
15
14
  export declare function createBindingEvents(ctx: Context, deps: {
16
15
  owner: ChannelOwner;
@@ -36,19 +35,19 @@ export declare function createBindingEvents(ctx: Context, deps: {
36
35
  subagents: {
37
36
  onSessionEvent(session: unknown, event: unknown): boolean;
38
37
  onStreamFrame?(agent: unknown, frame: AssistantStreamFrame): boolean;
39
- onParentEvent?(event: unknown): void;
40
38
  onStart(info: {
41
39
  id: string;
42
40
  runId?: string;
43
41
  provider: string;
44
42
  local?: boolean;
45
- }): void;
43
+ }, parent: object | null): void;
46
44
  onEnd(info: {
47
45
  id: string;
48
46
  runId?: string;
49
47
  stopReason: string;
50
48
  lastAssistantMessage?: unknown[];
51
- }): void;
49
+ }, parent: object | null): void;
50
+ forget?(agent: Agent): void;
52
51
  };
53
52
  agentView: {
54
53
  schedule(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"binding-events.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/binding-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;IACtD,KAAK,EAAE,YAAY,CAAA;IACnB,OAAO,EAAE,cAAc,CAAA;IACvB,KAAK,EAAE,YAAY,CAAA;IACnB;;;;iDAI6C;IAC7C,YAAY,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACrC,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,SAAS,EAAE,iBAAiB,CAAA;IAC5B,YAAY,EAAE;QAAE,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QAAC,SAAS,EAAE,iBAAiB,CAAA;KAAE,CAAA;IACrF,WAAW,EAAE;QAAE,WAAW,IAAI,IAAI,CAAC;QAAC,cAAc,CAAC,OAAO,EAAE,O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;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;QAC7G,KAAK,CAAC,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAC;YAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,CAAA;SAAE,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;QAC9H,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;KAC5B,CAAA;IACD,SAAS,EAAE;QAAE,QAAQ,IAAI,IAAI,CAAA;KAAE,CAAA;IAC/B,eAAe,CAAC,EAAE;QAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAA;IACrE;;;sCAGkC;IAClC,gBAAgB,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3C;gBAqCkB,IAAI;EAiJtB"}
@@ -1,11 +1,43 @@
1
+ import { carrierKeyOf } from '@deepseek-ai/dsh-scope';
2
+ import { isTokenDelta, tokenDeltaChars } from './usage.js';
1
3
  /**
2
- * The binding event router is the sole subscriber for a foreground Agent.
3
- * It captures the binding generation at every listener entry; teardown is
4
- * incremental and retained callbacks check that captured Agent/session pair
5
- * before touching state. Transcript presentation remains exclusively owned by
6
- * ChannelProjection.
4
+ * Foreground transcript listeners capture a binding generation. Child event
5
+ * listeners instead span the Channel owner, keeping parked reducers current
6
+ * across rebinds. Both paths own registrations incrementally and fence retained
7
+ * callbacks; only ChannelProjection presents the foreground transcript.
7
8
  */
8
9
  export function createBindingEvents(ctx, deps) {
10
+ let subagentsInstalled = false;
11
+ const installSubagents = () => {
12
+ if (subagentsInstalled)
13
+ return;
14
+ subagentsInstalled = true;
15
+ // Child reducers span foreground bindings. One owner subscription keeps
16
+ // parked stores current; only the active reducer publishes view changes.
17
+ deps.owner.own(ctx.on('session/event', (session, event) => {
18
+ if (deps.owner.current())
19
+ deps.subagents.onSessionEvent(session, event);
20
+ }));
21
+ deps.owner.own(ctx.on('agent/assistant-stream', ({ agent, frame }) => {
22
+ if (deps.owner.current())
23
+ deps.subagents.onStreamFrame?.(agent, frame);
24
+ }));
25
+ // Cordis binds the dispatch receiver as `this`. The upstream carrier
26
+ // names the direct delegating parent, even for external children absent
27
+ // from agents.get(); its ancestor-inclusive filter cannot identify it.
28
+ deps.owner.own(ctx.on('subagent/start', (function (info) {
29
+ if (deps.owner.current())
30
+ deps.subagents.onStart(info, carrierKeyOf(this) ?? null);
31
+ })));
32
+ deps.owner.own(ctx.on('subagent/end', (function (info) {
33
+ if (deps.owner.current())
34
+ deps.subagents.onEnd(info, carrierKeyOf(this) ?? null);
35
+ })));
36
+ deps.owner.own(ctx.on('agent/disposed', ({ agent }) => {
37
+ if (deps.owner.current())
38
+ deps.subagents.forget?.(agent);
39
+ }));
40
+ };
9
41
  const reconcileRetiredProjection = (status) => {
10
42
  if (!deps.state.working)
11
43
  return;
@@ -20,6 +52,7 @@ export function createBindingEvents(ctx, deps) {
20
52
  const bind = () => {
21
53
  try {
22
54
  deps.state.agentBindingGeneration = deps.binding.bind();
55
+ installSubagents();
23
56
  deps.inputConvergence.cancelInFlight = false;
24
57
  deps.inputConvergence.interruptSeq += 1;
25
58
  deps.seedActivity?.(deps.binding.agent.session);
@@ -118,15 +151,9 @@ export function createBindingEvents(ctx, deps) {
118
151
  if (!current())
119
152
  return;
120
153
  const isMainSession = subject === session;
121
- if (!isMainSession && deps.subagents.onSessionEvent(subject, event))
122
- return;
123
154
  if (!isMainSession)
124
155
  return;
125
156
  deps.messageObserver?.publish(subject, event);
126
- // Parent-log discovery events (`subagent/catalog`, workflow member
127
- // edges) reach the dashboard through the same firehose; they are not
128
- // transcript rows and render below remains untouched by them.
129
- deps.subagents.onParentEvent?.(event);
130
157
  deps.modeActions.onSessionEvent(subject, event);
131
158
  deps.projector.renderEvent(event);
132
159
  if (event.type === 'assistant/chunk')
@@ -142,24 +169,45 @@ export function createBindingEvents(ctx, deps) {
142
169
  on('agent/assistant-stream', ({ agent: subject, frame }) => {
143
170
  if (!current())
144
171
  return;
145
- if (subject !== capture.agent) {
146
- deps.subagents.onStreamFrame?.(subject, frame);
172
+ if (subject !== capture.agent)
147
173
  return;
148
- }
149
174
  deps.projector.renderStreamFrame(frame);
150
175
  if (frame.type === 'chunk')
151
176
  deps.state.emitStream();
152
177
  else if (frame.type === 'end')
153
178
  deps.state.emit();
154
179
  });
155
- on('subagent/start', (info) => {
156
- if (current())
157
- deps.subagents.onStart(info);
158
- });
159
- on('subagent/end', (info) => {
160
- if (current())
161
- deps.subagents.onEnd(info);
180
+ /**
181
+ * Live compaction progress. The summarizer is one `ctx.llm.stream()`
182
+ * call, so its chunks are the only work signal a compaction has between
183
+ * `compaction/start` and `compaction/end` (dsh-llm tags the call
184
+ * `purpose: 'compaction'`, and a manual one runs while the session is
185
+ * idle, so it cannot be confused with the foreground turn's stream).
186
+ * Everything else passes through untouched: the original iterable is
187
+ * returned for any other purpose or session.
188
+ */
189
+ const disposeCompactionStream = ctx.on('llm/stream', (options, next) => {
190
+ const stream = next();
191
+ if (options.purpose !== 'compaction')
192
+ return stream;
193
+ if (options.sessionId === undefined || String(options.sessionId) !== String(session.id))
194
+ return stream;
195
+ return (async function* compactionStream() {
196
+ for await (const chunk of stream) {
197
+ const compaction = deps.state.compaction;
198
+ if (compaction !== undefined && isTokenDelta(chunk)) {
199
+ deps.state.compaction = {
200
+ ...compaction,
201
+ phase: 'summary',
202
+ outputChars: compaction.outputChars + tokenDeltaChars(chunk),
203
+ };
204
+ deps.state.emitStream();
205
+ }
206
+ yield chunk;
207
+ }
208
+ })();
162
209
  });
210
+ register(disposeCompactionStream);
163
211
  }
164
212
  catch (error) {
165
213
  deps.owner.dispose();