@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,64 @@
1
+ import { type AdapterScanSpec } from './recent-agents.js';
2
+ /** One selectable picker row (rendered by components/MigratePicker.tsx). */
3
+ export interface MigratePickerRow {
4
+ readonly agentId: string;
5
+ readonly label: string;
6
+ readonly count: number;
7
+ /** Minutes since the newest source activity, when inside the window. */
8
+ readonly minutesAgo?: number;
9
+ }
10
+ /** Each adapter's name-only scan shape, shared by count() callers and the activity hint. */
11
+ export declare const MIGRATE_SCAN_SPECS: Readonly<Record<string, AdapterScanSpec>>;
12
+ /**
13
+ * Collect picker rows for every registered adapter: scan count plus a
14
+ * recent-activity badge when the source was used inside the window. Recent
15
+ * sources sort first (newest activity at top), cold sources keep registry
16
+ * order. Sub-second at real-world scale, but still meant for a background
17
+ * pass — never the render path.
18
+ */
19
+ export declare function collectMigratePickerRows(nowMs: number): MigratePickerRow[];
20
+ /** One source's import outcome, parsed from the CLI child's stdout. */
21
+ export interface ImportSummary {
22
+ readonly agentId: string;
23
+ readonly imported: number;
24
+ readonly existing: number;
25
+ }
26
+ /**
27
+ * Parse per-source import counters out of the CLI's report lines
28
+ * (`[<agentId>] imported 12 · already present 3`). Pure string work so the
29
+ * TUI's completion notification can carry real numbers (PRD #3) without
30
+ * re-running any scan.
31
+ */
32
+ export declare function parseImportSummary(stdout: string): ImportSummary[];
33
+ /**
34
+ * Classify one `/migrate` command line (the text AFTER the command word) into
35
+ * the action Chat must take. Pure and registry-driven on purpose: whether a
36
+ * command is valid must never depend on the picker having been opened first
37
+ * (`migrateRows` is empty on a fresh mount, which used to make every
38
+ * `/migrate <agent>` report an unknown source), and the CLI keeps the same
39
+ * one-source rule (`dsh-tui migrate a b` is a usage error there too).
40
+ *
41
+ * @param rawInput - arguments after `/migrate`, e.g. `" claude-code --dry-run"`.
42
+ * @param knownAgentIds - the adapter registry's ids (see MIGRATION_ADAPTERS).
43
+ */
44
+ export declare function resolveMigrateCommand(rawInput: string, knownAgentIds: readonly string[]): MigrateCommand;
45
+ /** What one `/migrate` line asks for. */
46
+ export type MigrateCommand = {
47
+ readonly kind: 'picker';
48
+ } | {
49
+ readonly kind: 'import';
50
+ readonly agentId: string;
51
+ readonly dryRun: boolean;
52
+ } | {
53
+ readonly kind: 'unknown';
54
+ readonly agentId: string;
55
+ }
56
+ /** More than one source named: rejected, like the CLI's usage error. */
57
+ | {
58
+ readonly kind: 'usage';
59
+ }
60
+ /** `--dry-run` with no source: previewing needs to know what to preview. */
61
+ | {
62
+ readonly kind: 'dry-run-needs-source';
63
+ };
64
+ //# sourceMappingURL=picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"picker.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/picker.ts"],"names":[],"mappings":"AAWA,OAAO,EAA4C,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEnG,4EAA4E;AAC5E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,wEAAwE;IACxE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,4FAA4F;AAC5F,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAMxE,CAAA;AAID;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAc1E;AAED,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,CAUlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAWxG;AAED,yCAAyC;AACzC,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC/E;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AACxD,wEAAwE;GACtE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE;AAC5B,4EAA4E;GAC1E;IAAE,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAA;CAAE,CAAA"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Data collection for the `/migrate` source picker, plus the command
3
+ * classifier and the child-report parser.
4
+ *
5
+ * Combines the name-only scan count (list mode's fast path) with the
6
+ * recent-activity detector into the row shape the picker renders. Pure data:
7
+ * no React, no Cordis — Chat imports these helpers and owns all UI.
8
+ *
9
+ * @module @deepseek-harness-tui/dsh-tui/migrate/picker
10
+ */
11
+ import { MIGRATION_ADAPTERS } from './index.js';
12
+ import { collectActivitySamples, recentAgentsFrom } from './recent-agents.js';
13
+ /** Each adapter's name-only scan shape, shared by count() callers and the activity hint. */
14
+ export const MIGRATE_SCAN_SPECS = {
15
+ 'claude-code': { maxDepth: 3, fileMatch: name => name.endsWith('.jsonl') },
16
+ codex: { maxDepth: 5, fileMatch: name => name.startsWith('rollout-') && name.endsWith('.jsonl') },
17
+ omp: { maxDepth: 3, fileMatch: name => name.endsWith('.jsonl') },
18
+ zcode: { maxDepth: 3, fileMatch: name => name.endsWith('.json') },
19
+ 'grok-build': { maxDepth: 2, fileMatch: name => name === 'chat_history.jsonl' },
20
+ };
21
+ const scanOf = (agentId) => MIGRATE_SCAN_SPECS[agentId];
22
+ /**
23
+ * Collect picker rows for every registered adapter: scan count plus a
24
+ * recent-activity badge when the source was used inside the window. Recent
25
+ * sources sort first (newest activity at top), cold sources keep registry
26
+ * order. Sub-second at real-world scale, but still meant for a background
27
+ * pass — never the render path.
28
+ */
29
+ export function collectMigratePickerRows(nowMs) {
30
+ const samples = collectActivitySamples(MIGRATION_ADAPTERS, adapter => scanOf(adapter.id));
31
+ const recent = new Map(recentAgentsFrom(samples, nowMs).map(agent => [agent.agentId, agent.minutesAgo]));
32
+ const rows = MIGRATION_ADAPTERS.map(adapter => ({
33
+ agentId: adapter.id,
34
+ label: adapter.label,
35
+ count: adapter.count !== undefined ? adapter.count() : adapter.discover().sessions.length,
36
+ minutesAgo: recent.get(adapter.id),
37
+ }));
38
+ return rows.sort((a, b) => {
39
+ const aRecent = a.minutesAgo ?? Number.MAX_SAFE_INTEGER;
40
+ const bRecent = b.minutesAgo ?? Number.MAX_SAFE_INTEGER;
41
+ return aRecent - bRecent;
42
+ });
43
+ }
44
+ /**
45
+ * Parse per-source import counters out of the CLI's report lines
46
+ * (`[<agentId>] imported 12 · already present 3`). Pure string work so the
47
+ * TUI's completion notification can carry real numbers (PRD #3) without
48
+ * re-running any scan.
49
+ */
50
+ export function parseImportSummary(stdout) {
51
+ const summaries = [];
52
+ for (const match of stdout.matchAll(/\[([a-z0-9-]+)\] imported (\d+)(?: · already present (\d+))?/gu)) {
53
+ summaries.push({
54
+ agentId: match[1],
55
+ imported: Number(match[2]),
56
+ existing: match[3] === undefined ? 0 : Number(match[3]),
57
+ });
58
+ }
59
+ return summaries;
60
+ }
61
+ /**
62
+ * Classify one `/migrate` command line (the text AFTER the command word) into
63
+ * the action Chat must take. Pure and registry-driven on purpose: whether a
64
+ * command is valid must never depend on the picker having been opened first
65
+ * (`migrateRows` is empty on a fresh mount, which used to make every
66
+ * `/migrate <agent>` report an unknown source), and the CLI keeps the same
67
+ * one-source rule (`dsh-tui migrate a b` is a usage error there too).
68
+ *
69
+ * @param rawInput - arguments after `/migrate`, e.g. `" claude-code --dry-run"`.
70
+ * @param knownAgentIds - the adapter registry's ids (see MIGRATION_ADAPTERS).
71
+ */
72
+ export function resolveMigrateCommand(rawInput, knownAgentIds) {
73
+ const words = rawInput.trim().split(/\s+/u).filter(Boolean);
74
+ const dryRun = words.includes('--dry-run');
75
+ const agents = words.filter(word => word !== '--dry-run');
76
+ // One source per invocation: the CLI rejects a second word, and silently
77
+ // importing only the first would hide which selection the user asked for.
78
+ if (agents.length > 1)
79
+ return { kind: 'usage' };
80
+ const wanted = agents[0];
81
+ if (wanted === undefined)
82
+ return dryRun ? { kind: 'dry-run-needs-source' } : { kind: 'picker' };
83
+ if (!knownAgentIds.includes(wanted))
84
+ return { kind: 'unknown', agentId: wanted };
85
+ return { kind: 'import', agentId: wanted, dryRun };
86
+ }
@@ -0,0 +1,40 @@
1
+ import type { MigrationAdapter } from './types.js';
2
+ /** How recent the newest source activity must be to earn a hint. */
3
+ export declare const RECENT_ACTIVITY_WINDOW_MS: number;
4
+ /** One source's last-activity sample. `newestMtimeMs: null` = no data. */
5
+ export interface ActivitySample {
6
+ readonly agentId: string;
7
+ readonly label: string;
8
+ readonly newestMtimeMs: number | null;
9
+ }
10
+ /** A source that was active inside the window. */
11
+ export interface RecentAgent {
12
+ readonly agentId: string;
13
+ readonly label: string;
14
+ /** Minutes since the newest activity, rounded down (≥ 0). */
15
+ readonly minutesAgo: number;
16
+ }
17
+ /**
18
+ * Pure judgment: which samples count as recent, newest first.
19
+ * @param samples - one per source, `null` mtime = no data (never recent).
20
+ * @param nowMs - the current epoch milliseconds (injected for testability).
21
+ * @param windowMs - activity window, default 20 minutes.
22
+ */
23
+ export declare function recentAgentsFrom(samples: readonly ActivitySample[], nowMs: number, windowMs?: number): RecentAgent[];
24
+ /**
25
+ * Newest file mtime under one set of roots, name-matched only (the counter's
26
+ * walk shape — no parsing). Returns null when nothing matches or IO fails;
27
+ * failures must read as "no data", never as "long ago".
28
+ */
29
+ export declare function collectNewestMtime(roots: readonly string[], fileMatch: (name: string) => boolean, maxDepth: number): number | null;
30
+ /** The file-name matcher and walk depth an adapter's count() uses. */
31
+ export interface AdapterScanSpec {
32
+ readonly maxDepth: number;
33
+ readonly fileMatch: (name: string) => boolean;
34
+ }
35
+ /**
36
+ * Collect one sample per adapter that can describe its scan; adapters
37
+ * without count() (no name-only scan shape) are skipped, not guessed.
38
+ */
39
+ export declare function collectActivitySamples(adapters: readonly MigrationAdapter[], scanOf: (adapter: MigrationAdapter) => AdapterScanSpec | undefined): ActivitySample[];
40
+ //# sourceMappingURL=recent-agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recent-agents.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/recent-agents.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,oEAAoE;AACpE,eAAO,MAAM,yBAAyB,QAAiB,CAAA;AAEvD,0EAA0E;AAC1E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAED,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,MAAkC,GAC3C,WAAW,EAAE,CAUf;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EACpC,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,IAAI,CA4Bf;AAED,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;CAC9C;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,MAAM,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,eAAe,GAAG,SAAS,GACjE,cAAc,EAAE,CAYlB"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Recent foreign-agent activity detection for the migration hint.
3
+ *
4
+ * "Did the user just come from another coding agent?" is answered from file
5
+ * mtimes inside each source store: an active conversation appends to its
6
+ * log in real time (claude-code updates within the same minute), so the
7
+ * NEWEST file mtime per source is a faithful last-activity signal with good
8
+ * separation (measured on a real machine: 0min vs 117min vs 5867min across
9
+ * sources). Parent-directory mtimes would miss appends to existing
10
+ * conversations, so the scan is file-level — bounded by the same
11
+ * name-matching walk as the list-mode counter (sub-second at ~3000 files)
12
+ * and meant for a BACKGROUND pass, never the render path.
13
+ *
14
+ * Split: `recentAgentsFrom` is a pure judgment over collected samples
15
+ * (directly testable with fixture mtimes); `collectNewestMtime` is the IO
16
+ * collector; `detectRecentAgents` binds them for the TUI.
17
+ *
18
+ * @module @deepseek-harness-tui/dsh-tui/migrate/recent-agents
19
+ */
20
+ import { readdirSync, statSync } from 'node:fs';
21
+ import { join } from 'node:path';
22
+ /** How recent the newest source activity must be to earn a hint. */
23
+ export const RECENT_ACTIVITY_WINDOW_MS = 20 * 60 * 1000;
24
+ /**
25
+ * Pure judgment: which samples count as recent, newest first.
26
+ * @param samples - one per source, `null` mtime = no data (never recent).
27
+ * @param nowMs - the current epoch milliseconds (injected for testability).
28
+ * @param windowMs - activity window, default 20 minutes.
29
+ */
30
+ export function recentAgentsFrom(samples, nowMs, windowMs = RECENT_ACTIVITY_WINDOW_MS) {
31
+ const recent = [];
32
+ for (const sample of samples) {
33
+ if (sample.newestMtimeMs === null)
34
+ continue;
35
+ const age = nowMs - sample.newestMtimeMs;
36
+ if (age < 0 || age > windowMs)
37
+ continue;
38
+ recent.push({ agentId: sample.agentId, label: sample.label, minutesAgo: Math.floor(age / 60_000) });
39
+ }
40
+ recent.sort((a, b) => a.minutesAgo - b.minutesAgo);
41
+ return recent;
42
+ }
43
+ /**
44
+ * Newest file mtime under one set of roots, name-matched only (the counter's
45
+ * walk shape — no parsing). Returns null when nothing matches or IO fails;
46
+ * failures must read as "no data", never as "long ago".
47
+ */
48
+ export function collectNewestMtime(roots, fileMatch, maxDepth) {
49
+ const match = fileMatch;
50
+ let newest = null;
51
+ const walk = (dir, depth) => {
52
+ if (depth > maxDepth)
53
+ return;
54
+ let entries;
55
+ try {
56
+ entries = readdirSync(dir, { withFileTypes: true });
57
+ }
58
+ catch {
59
+ return;
60
+ }
61
+ for (const entry of entries) {
62
+ const path = join(dir, entry.name);
63
+ if (entry.isDirectory()) {
64
+ walk(path, depth + 1);
65
+ continue;
66
+ }
67
+ if (!entry.isFile() || !match(entry.name))
68
+ continue;
69
+ try {
70
+ const mtimeMs = statSync(path).mtimeMs;
71
+ if (newest === null || mtimeMs > newest)
72
+ newest = mtimeMs;
73
+ }
74
+ catch {
75
+ // A stat race on one file costs that file, not the scan.
76
+ }
77
+ }
78
+ };
79
+ for (const root of roots)
80
+ walk(root, 0);
81
+ return newest;
82
+ }
83
+ /**
84
+ * Collect one sample per adapter that can describe its scan; adapters
85
+ * without count() (no name-only scan shape) are skipped, not guessed.
86
+ */
87
+ export function collectActivitySamples(adapters, scanOf) {
88
+ const samples = [];
89
+ for (const adapter of adapters) {
90
+ const spec = scanOf(adapter);
91
+ if (spec === undefined)
92
+ continue;
93
+ samples.push({
94
+ agentId: adapter.id,
95
+ label: adapter.label,
96
+ newestMtimeMs: collectNewestMtime(adapter.roots(), spec.fileMatch, spec.maxDepth),
97
+ });
98
+ }
99
+ return samples;
100
+ }
@@ -0,0 +1,39 @@
1
+ import { SessionId, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session';
2
+ import type { MigrationSession } from './types.js';
3
+ /** One migration turn's model-visible outcome, ready for persistence. */
4
+ export interface SessionizedLog {
5
+ readonly header: SessionHeader;
6
+ readonly events: readonly SessionEvent[];
7
+ }
8
+ /**
9
+ * The empty system head an imported log opens with, in whichever shape the
10
+ * installed harness writes. `createSystemMessage` changed arity between the
11
+ * validated lines: 0.1.5-alpha.2 takes the owning plugin and stamps a plugin
12
+ * source, later lines take the text alone and stamp `system-prompt`. Calling
13
+ * it with both arguments lets each line build its own native head (the later
14
+ * one ignores the extra argument) instead of this module hard-coding either.
15
+ */
16
+ /**
17
+ * The checkpoint framing the native compaction engine writes around a summary
18
+ * (dsh-compaction-basic `frameSummary`): a preamble, then the summary inside
19
+ * `<compacted-summary>` tags. The tags are how a LATER compaction recognises
20
+ * this node as a prior checkpoint and merges it instead of summarising the
21
+ * summary, so an imported checkpoint has to carry them exactly. The package
22
+ * does not export the constants; verify-migrate pins these against the
23
+ * installed engine's own source so a drift fails the regression.
24
+ */
25
+ export declare const CHECKPOINT_PREAMBLE = "This is an automatically generated checkpoint condensing an earlier span of the conversation to free up context. Treat the captured context as established background and build on it without restating it. Continue the task directly from the messages that follow, without acknowledging this checkpoint.";
26
+ export declare const SUMMARY_OPEN_TAG = "<compacted-summary>";
27
+ export declare const SUMMARY_CLOSE_TAG = "</compacted-summary>";
28
+ /**
29
+ * Build one official DSH session log from a normalized foreign conversation.
30
+ *
31
+ * @param id - deterministic session id (see uuid.ts); the id IS the dedupe.
32
+ * @param agentId - source adapter id, stamped into assistant provenance as
33
+ * `migrated:<agentId>` so the transcript can name where text came from.
34
+ * @param session - the normalized foreign conversation.
35
+ * @returns the official header plus the full event log, exactly as the
36
+ * persistence backend expects them.
37
+ */
38
+ export declare function sessionize(id: SessionId, agentId: string, session: MigrationSession): SessionizedLog;
39
+ //# sourceMappingURL=sessionize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionize.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/migrate/sessionize.ts"],"names":[],"mappings":"AA0DA,OAAO,EAGL,SAAS,EAET,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAc,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAc9D,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;CACzC;AAgBD;;;;;;;GAOG;AACH;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,iTAAiT,CAAA;AACjV,eAAO,MAAM,gBAAgB,wBAAwB,CAAA;AACrD,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AAevD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAmJpG"}
@@ -0,0 +1,271 @@
1
+ /**
2
+ * Cross-agent conversation migration: MigrationSession → official DSH events.
3
+ *
4
+ * The sessionize step owns NO storage decisions. It drives the official
5
+ * `Session` logical-event API (`Session.create` + `append`), so envelope
6
+ * fields (seq/time/id), surface contract and format version come from the
7
+ * upstream implementation — the part the first iteration of this feature got
8
+ * wrong by hand-crafting physical log rows. Physical encoding, project
9
+ * layout, zstd and atomic writes belong to JsonlSessionPersistence (see
10
+ * index.ts), exactly as scripts/migrate-sessions-to-jsonl.mts does for the
11
+ * retired sqlite store.
12
+ *
13
+ * Turn shape follows the live loop: `turn/start`, then one step per
14
+ * {@link ImportStep} with the turn's prompt as the first step's user message,
15
+ * then `turn/end`. A turn with no prompt (source lost its head) carries no
16
+ * user message; a turn with no step is a legal step-less turn whose prompt
17
+ * sits directly inside the turn.
18
+ *
19
+ * Inside a step, events follow the live loop too: the step's user inputs
20
+ * (mid-turn context), the assistant message whose content carries the
21
+ * tool-call blocks, one `tool/call` per call, then one `tool/result` per
22
+ * call citing its call event. Parsing already closed every call
23
+ * (closeToolPairs), so no step leaves a call unanswered — the invariant the
24
+ * wire needs on resume: every tool call is followed by its tool message
25
+ * before any later assistant message.
26
+ *
27
+ * System head: the live loop reserves surface node 0 for the system prompt
28
+ * (an empty `system/message` in the first step, before any user message).
29
+ * An imported log gets the same empty head: it projects to no message, so
30
+ * re-reading is unchanged, and when the session is resumed the loop REPLACES
31
+ * it with the rendered prompt. Without it the loop appends its prompt after
32
+ * the imported history, where adapters that only lift a LEADING system
33
+ * message (pi-ai) send it as one more user message.
34
+ *
35
+ * Compaction: a turn carrying {@link ImportTurn.compaction} is preceded by
36
+ * one native compaction transaction — `compaction/start` (standalone,
37
+ * `turn: null`), `compaction/summary`, the checkpoint `user/message` that
38
+ * REPLACES every surface node after the head, `compaction/end` — the same
39
+ * shape `/compact` writes. The raw log keeps the shadowed events (replay
40
+ * stays exact) while the model sees the checkpoint plus what follows, which
41
+ * is the context the source agent itself continued with. The upstream
42
+ * compaction package is not a dependency here, so its event and source
43
+ * shapes are written structurally (see compactionEvents below).
44
+ *
45
+ * Title: only a title the SOURCE owns (`titleExplicit`) is written, as one
46
+ * trailing `session/title` — a first-prompt fallback is left out so DSH
47
+ * derives it from the first user message exactly as for a native session.
48
+ *
49
+ * @module @deepseek-harness-tui/dsh-tui/migrate/sessionize
50
+ */
51
+ import { ToolCallId, createAssistantMessage, createSystemMessage, createToolResultMessage, createUserMessage, } from '@deepseek-ai/dsh-llm';
52
+ import { SESSION_FORMAT_VERSION, Session, } from '@deepseek-ai/dsh-session';
53
+ import { userTitleData } from '../compat/sessionLog.js';
54
+ import { normalizeTitle } from './parse/title.js';
55
+ /** Rough token estimate for shadowed text (the compaction metering field). */
56
+ function estimateTokens(chars) {
57
+ return Math.ceil(chars / 4);
58
+ }
59
+ /** Blocks for one migrated step, in source order (reasoning before the text
60
+ * it explains, tool calls where the model made them). A step with no
61
+ * content keeps one empty text block so the assistant message stays
62
+ * well-formed. */
63
+ function assistantBlocks(step) {
64
+ const blocks = step.blocks.map(block => block.type === 'tool-call'
65
+ ? { type: 'tool-call', id: ToolCallId(block.id), name: block.name, arguments: block.arguments }
66
+ : { type: block.type, text: block.text });
67
+ if (blocks.length === 0)
68
+ blocks.push({ type: 'text', text: '' });
69
+ return blocks;
70
+ }
71
+ /**
72
+ * The empty system head an imported log opens with, in whichever shape the
73
+ * installed harness writes. `createSystemMessage` changed arity between the
74
+ * validated lines: 0.1.5-alpha.2 takes the owning plugin and stamps a plugin
75
+ * source, later lines take the text alone and stamp `system-prompt`. Calling
76
+ * it with both arguments lets each line build its own native head (the later
77
+ * one ignores the extra argument) instead of this module hard-coding either.
78
+ */
79
+ /**
80
+ * The checkpoint framing the native compaction engine writes around a summary
81
+ * (dsh-compaction-basic `frameSummary`): a preamble, then the summary inside
82
+ * `<compacted-summary>` tags. The tags are how a LATER compaction recognises
83
+ * this node as a prior checkpoint and merges it instead of summarising the
84
+ * summary, so an imported checkpoint has to carry them exactly. The package
85
+ * does not export the constants; verify-migrate pins these against the
86
+ * installed engine's own source so a drift fails the regression.
87
+ */
88
+ export const CHECKPOINT_PREAMBLE = 'This is an automatically generated checkpoint condensing an earlier span of the conversation to free up context. Treat the captured context as established background and build on it without restating it. Continue the task directly from the messages that follow, without acknowledging this checkpoint.';
89
+ export const SUMMARY_OPEN_TAG = '<compacted-summary>';
90
+ export const SUMMARY_CLOSE_TAG = '</compacted-summary>';
91
+ function frameCheckpoint(summary) {
92
+ return [
93
+ { type: 'text', text: `${CHECKPOINT_PREAMBLE}\n\n${SUMMARY_OPEN_TAG}` },
94
+ { type: 'text', text: summary },
95
+ { type: 'text', text: SUMMARY_CLOSE_TAG },
96
+ ];
97
+ }
98
+ function emptySystemHead() {
99
+ const create = createSystemMessage;
100
+ return create('', 'dsh-tui-migrate');
101
+ }
102
+ /**
103
+ * Build one official DSH session log from a normalized foreign conversation.
104
+ *
105
+ * @param id - deterministic session id (see uuid.ts); the id IS the dedupe.
106
+ * @param agentId - source adapter id, stamped into assistant provenance as
107
+ * `migrated:<agentId>` so the transcript can name where text came from.
108
+ * @param session - the normalized foreign conversation.
109
+ * @returns the official header plus the full event log, exactly as the
110
+ * persistence backend expects them.
111
+ */
112
+ export function sessionize(id, agentId, session) {
113
+ const header = {
114
+ version: SESSION_FORMAT_VERSION,
115
+ id,
116
+ createdAt: session.startedAt,
117
+ cwd: session.cwd,
118
+ isSeeded: false,
119
+ };
120
+ const model = Session.create(id, undefined, header);
121
+ // Collect each append()'s RETURN (a fully enveloped event) instead of the
122
+ // deprecated snapshotEvents() bulk read — upstream forbids NEW callers of
123
+ // the latter, and append already returns seq/time-stamped events.
124
+ const events = [];
125
+ let headWritten = false;
126
+ const writeHead = (turn, step) => {
127
+ events.push(model.append('system/message', { turn, step, message: emptySystemHead() }, { surfaceOp: 'append' }));
128
+ headWritten = true;
129
+ };
130
+ const writePrompt = (prompt) => {
131
+ if (prompt === '')
132
+ return;
133
+ surfaceChars += prompt.length;
134
+ events.push(model.append('user/message', createUserMessage({
135
+ content: [{ type: 'text', text: prompt }],
136
+ source: { kind: 'user' },
137
+ }), { surfaceOp: 'append' }));
138
+ };
139
+ const writeTools = (turn, step, imported) => {
140
+ const callSeqs = new Map();
141
+ for (const block of imported.blocks) {
142
+ if (block.type !== 'tool-call')
143
+ continue;
144
+ const call = model.append('tool/call', { turn, step, callId: ToolCallId(block.id), name: block.name, arguments: block.arguments });
145
+ events.push(call);
146
+ callSeqs.set(block.id, call.seq);
147
+ }
148
+ for (const result of imported.results) {
149
+ const callSeq = callSeqs.get(result.callId);
150
+ if (callSeq === undefined)
151
+ continue;
152
+ events.push(model.append('tool/result', {
153
+ turn,
154
+ step,
155
+ message: createToolResultMessage({
156
+ callId: ToolCallId(result.callId),
157
+ content: result.text === '' ? [] : [{ type: 'text', text: result.text }],
158
+ isError: result.isError,
159
+ }),
160
+ }, { surfaceOp: 'append', sourceEventSeqs: [callSeq] }));
161
+ }
162
+ };
163
+ let compactions = 0;
164
+ // Text volume on the surface since the last checkpoint, for the summary's
165
+ // shadowedTokenCount (an estimate, like the live engine's).
166
+ let surfaceChars = 0;
167
+ /** Fold every surface node after the head into one checkpoint; false when
168
+ * there is nothing to fold (the upstream contract needs a non-empty span). */
169
+ const writeCompaction = (summary, summaryModel) => {
170
+ const shadowed = model.surface.nodes.filter(seq => model.eventAt(seq)?.type !== 'system/message');
171
+ if (shadowed.length === 0)
172
+ return false;
173
+ compactions += 1;
174
+ const compactionId = `import:${id}:c${compactions}`;
175
+ const untyped = model;
176
+ const range = { start: shadowed[0], end: shadowed[shadowed.length - 1] };
177
+ events.push(untyped.append('compaction/start', { compactionId, turn: null }));
178
+ events.push(untyped.append('compaction/summary', {
179
+ compactionId,
180
+ summary: [{ type: 'text', text: summary }],
181
+ shadowedRange: range,
182
+ shadowedSeqs: shadowed,
183
+ shadowedTokenCount: estimateTokens(surfaceChars),
184
+ provider: `migrated:${agentId}`,
185
+ model: summaryModel ?? agentId,
186
+ }));
187
+ events.push(untyped.append('user/message', createUserMessage({
188
+ content: frameCheckpoint(summary),
189
+ // The compaction package's checkpoint marker (COMPACT_CHECKPOINT_MARKER).
190
+ source: { kind: 'compact-checkpoint', compactionId },
191
+ }), { surfaceOp: { op: 'replace', startSeq: range.start, endSeq: range.end }, sourceEventSeqs: shadowed }));
192
+ events.push(untyped.append('compaction/end', { compactionId, turn: null }));
193
+ surfaceChars = summary.length;
194
+ return true;
195
+ };
196
+ let turnIndex = 0;
197
+ for (const turn of session.turns) {
198
+ // A summary with nothing before it to fold still reaches the model: it
199
+ // opens the turn as a plain user message instead.
200
+ let preface = '';
201
+ if (turn.compaction !== undefined && turn.compaction.summary !== '') {
202
+ if (!writeCompaction(turn.compaction.summary, turn.compaction.model))
203
+ preface = turn.compaction.summary;
204
+ // A boundary with no prompt and no step (the source stopped right at
205
+ // the compaction) needs no turn of its own.
206
+ if (turn.prompt === '' && turn.steps.length === 0 && preface === '')
207
+ continue;
208
+ }
209
+ turnIndex += 1;
210
+ events.push(model.append('turn/start', { turn: turnIndex }));
211
+ if (turn.steps.length === 0) {
212
+ if (headWritten) {
213
+ writePrompt(preface);
214
+ writePrompt(turn.prompt);
215
+ }
216
+ else {
217
+ // The head needs an open step; a step-less first turn gets one that
218
+ // carries only the head and the prompt (no model call).
219
+ events.push(model.append('step/start', { turn: turnIndex, step: 1 }));
220
+ writeHead(turnIndex, 1);
221
+ writePrompt(preface);
222
+ writePrompt(turn.prompt);
223
+ events.push(model.append('step/end', { turn: turnIndex, step: 1 }));
224
+ }
225
+ }
226
+ let step = 0;
227
+ for (const imported of turn.steps) {
228
+ step += 1;
229
+ events.push(model.append('step/start', { turn: turnIndex, step }));
230
+ if (!headWritten)
231
+ writeHead(turnIndex, step);
232
+ if (step === 1) {
233
+ writePrompt(preface);
234
+ writePrompt(turn.prompt);
235
+ }
236
+ for (const input of imported.inputs)
237
+ writePrompt(input);
238
+ for (const block of imported.blocks)
239
+ surfaceChars += block.type === 'tool-call' ? block.arguments.length : block.text.length;
240
+ for (const result of imported.results)
241
+ surfaceChars += result.text.length;
242
+ events.push(model.append('assistant/message', {
243
+ turn: turnIndex,
244
+ step,
245
+ message: createAssistantMessage({
246
+ content: assistantBlocks(imported),
247
+ // createAssistantMessage stamps `kind: 'model'` itself; the
248
+ // caller-visible provenance is provider + model only.
249
+ source: {
250
+ provider: `migrated:${agentId}`,
251
+ model: imported.model ?? agentId,
252
+ },
253
+ }),
254
+ stream: [],
255
+ }, { surfaceOp: 'append' }));
256
+ writeTools(turnIndex, step, imported);
257
+ events.push(model.append('step/end', { turn: turnIndex, step }));
258
+ }
259
+ // A source-recorded interruption keeps its meaning. Sources record it
260
+ // coarsely (no user/hook/dispose distinction), which is exactly what the
261
+ // `legacy` cancel cause exists for.
262
+ events.push(model.append('turn/end', {
263
+ turn: turnIndex,
264
+ reason: turn.aborted === true ? { kind: 'aborted', reason: { kind: 'legacy' } } : { kind: 'completed' },
265
+ }));
266
+ }
267
+ const title = session.titleExplicit ? normalizeTitle(session.title) : '';
268
+ if (title !== '')
269
+ events.push(model.append('session/title', userTitleData(title)));
270
+ return { header: model.header, events };
271
+ }