@deepseek-harness-tui/dsh-tui 0.11.0 → 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 (484) hide show
  1. package/README.md +55 -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 +43 -20
  7. package/cordis.yml +6 -4
  8. package/lib/settings.json +1272 -0
  9. package/lib/types/activityPrefs.d.ts +24 -0
  10. package/lib/types/activityPrefs.d.ts.map +1 -1
  11. package/lib/types/activityPrefs.js +50 -1
  12. package/lib/types/adapter/channel/state.d.ts.map +1 -1
  13. package/lib/types/adapter/channel/state.js +3 -1
  14. package/lib/types/adapter/channel/ui-policy.d.ts +9 -2
  15. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  16. package/lib/types/adapter/channel/ui-policy.js +14 -1
  17. package/lib/types/adapter/kernel/replay.d.ts.map +1 -1
  18. package/lib/types/adapter/kernel/replay.js +2 -0
  19. package/lib/types/adapter/ports/channel-display.d.ts +12 -0
  20. package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
  21. package/lib/types/adapter/ports/channel-session.d.ts +38 -0
  22. package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
  23. package/lib/types/adapter/ports/channel-settings.d.ts +12 -0
  24. package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
  25. package/lib/types/adapter/ports/channel-ui.d.ts +53 -7
  26. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  27. package/lib/types/adapter/ports/channel-view.d.ts +43 -12
  28. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  29. package/lib/types/adapter/ports/channel.d.ts +4 -1
  30. package/lib/types/adapter/ports/channel.d.ts.map +1 -1
  31. package/lib/types/commands.d.ts.map +1 -1
  32. package/lib/types/commands.js +2 -0
  33. package/lib/types/components/ActivityLine.d.ts +7 -2
  34. package/lib/types/components/ActivityLine.d.ts.map +1 -1
  35. package/lib/types/components/ActivityLine.js +0 -8
  36. package/lib/types/components/BalanceReportRow.d.ts +10 -2
  37. package/lib/types/components/BalanceReportRow.d.ts.map +1 -1
  38. package/lib/types/components/BalanceReportRow.js +18 -4
  39. package/lib/types/components/CompactionStatusRow.d.ts +24 -0
  40. package/lib/types/components/CompactionStatusRow.d.ts.map +1 -0
  41. package/lib/types/components/CompactionStatusRow.js +72 -0
  42. package/lib/types/components/GoalTodoPanel.js +2 -2
  43. package/lib/types/components/HelpMenu.d.ts +2 -2
  44. package/lib/types/components/HelpMenu.d.ts.map +1 -1
  45. package/lib/types/components/HelpMenu.js +5 -4
  46. package/lib/types/components/InlineMathParagraph.d.ts +22 -0
  47. package/lib/types/components/InlineMathParagraph.d.ts.map +1 -0
  48. package/lib/types/components/InlineMathParagraph.js +178 -0
  49. package/lib/types/components/LogoV2.d.ts +41 -3
  50. package/lib/types/components/LogoV2.d.ts.map +1 -1
  51. package/lib/types/components/LogoV2.js +148 -24
  52. package/lib/types/components/Markdown.d.ts +10 -3
  53. package/lib/types/components/Markdown.d.ts.map +1 -1
  54. package/lib/types/components/Markdown.js +47 -14
  55. package/lib/types/components/MathBlock.d.ts +13 -0
  56. package/lib/types/components/MathBlock.d.ts.map +1 -0
  57. package/lib/types/components/MathBlock.js +136 -0
  58. package/lib/types/components/MessageList.d.ts +10 -1
  59. package/lib/types/components/MessageList.d.ts.map +1 -1
  60. package/lib/types/components/MessageList.js +15 -5
  61. package/lib/types/components/MigratePicker.d.ts +30 -0
  62. package/lib/types/components/MigratePicker.d.ts.map +1 -0
  63. package/lib/types/components/MigratePicker.js +38 -0
  64. package/lib/types/components/PromptInput.d.ts +17 -0
  65. package/lib/types/components/PromptInput.d.ts.map +1 -1
  66. package/lib/types/components/PromptInput.js +96 -9
  67. package/lib/types/components/SplitDiffView.d.ts.map +1 -1
  68. package/lib/types/components/SplitDiffView.js +3 -1
  69. package/lib/types/components/StarPrompt.d.ts +53 -0
  70. package/lib/types/components/StarPrompt.d.ts.map +1 -0
  71. package/lib/types/components/StarPrompt.js +281 -0
  72. package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
  73. package/lib/types/components/StreamingMarkdown.js +20 -3
  74. package/lib/types/components/SubagentCard.d.ts.map +1 -1
  75. package/lib/types/components/SubagentCard.js +12 -6
  76. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  77. package/lib/types/components/SubagentDetailScene.js +8 -3
  78. package/lib/types/components/TimelineRail.d.ts.map +1 -1
  79. package/lib/types/components/TimelineRail.js +9 -1
  80. package/lib/types/components/Whale.d.ts +17 -8
  81. package/lib/types/components/Whale.d.ts.map +1 -1
  82. package/lib/types/components/Whale.js +25 -15
  83. package/lib/types/components/WhaleGirl.d.ts +29 -0
  84. package/lib/types/components/WhaleGirl.d.ts.map +1 -0
  85. package/lib/types/components/WhaleGirl.js +32 -0
  86. package/lib/types/components/WorkingSpinner.d.ts +4 -1
  87. package/lib/types/components/WorkingSpinner.d.ts.map +1 -1
  88. package/lib/types/components/WorkingSpinner.js +2 -2
  89. package/lib/types/components/bigfont.d.ts +47 -18
  90. package/lib/types/components/bigfont.d.ts.map +1 -1
  91. package/lib/types/components/bigfont.js +55 -40
  92. package/lib/types/components/design-system/HintLine.d.ts +1 -2
  93. package/lib/types/components/design-system/HintLine.d.ts.map +1 -1
  94. package/lib/types/components/design-system/HintLine.js +1 -2
  95. package/lib/types/components/design-system/ThemeProvider.d.ts +6 -0
  96. package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
  97. package/lib/types/components/design-system/ThemeProvider.js +40 -1
  98. package/lib/types/components/maidPortrait.d.ts +44 -0
  99. package/lib/types/components/maidPortrait.d.ts.map +1 -0
  100. package/lib/types/components/maidPortrait.js +178 -0
  101. package/lib/types/components/mathPreview.d.ts +25 -0
  102. package/lib/types/components/mathPreview.d.ts.map +1 -0
  103. package/lib/types/components/mathPreview.js +48 -0
  104. package/lib/types/components/messages/AssistantThinkingMessage.d.ts +2 -1
  105. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
  106. package/lib/types/components/messages/AssistantThinkingMessage.js +4 -2
  107. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -2
  108. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  109. package/lib/types/components/messages/AssistantToolUseMessage.js +31 -26
  110. package/lib/types/components/messages/TranscriptImages.d.ts.map +1 -1
  111. package/lib/types/components/messages/TranscriptImages.js +11 -1
  112. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +14 -2
  113. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  114. package/lib/types/components/questions/AskUserQuestionPanel.js +80 -38
  115. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  116. package/lib/types/components/questions/PlanReviewPanel.js +3 -3
  117. package/lib/types/components/sessions/ForeignSessionRow.d.ts +34 -0
  118. package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -0
  119. package/lib/types/components/sessions/ForeignSessionRow.js +43 -0
  120. package/lib/types/components/sessions/SourceTabs.d.ts +52 -0
  121. package/lib/types/components/sessions/SourceTabs.d.ts.map +1 -0
  122. package/lib/types/components/sessions/SourceTabs.js +70 -0
  123. package/lib/types/components/splashEggs.d.ts +56 -0
  124. package/lib/types/components/splashEggs.d.ts.map +1 -0
  125. package/lib/types/components/splashEggs.js +67 -0
  126. package/lib/types/components/splashFonts.d.ts +119 -0
  127. package/lib/types/components/splashFonts.d.ts.map +1 -0
  128. package/lib/types/components/splashFonts.js +267 -0
  129. package/lib/types/components/splashLayout.d.ts +41 -0
  130. package/lib/types/components/splashLayout.d.ts.map +1 -0
  131. package/lib/types/components/splashLayout.js +40 -0
  132. package/lib/types/components/whaleGirlSprite.d.ts +17 -0
  133. package/lib/types/components/whaleGirlSprite.d.ts.map +1 -0
  134. package/lib/types/components/whaleGirlSprite.js +47 -0
  135. package/lib/types/deepseekPricing.d.ts +74 -0
  136. package/lib/types/deepseekPricing.d.ts.map +1 -1
  137. package/lib/types/deepseekPricing.js +110 -11
  138. package/lib/types/dsh-adapter/activity-store.d.ts +221 -0
  139. package/lib/types/dsh-adapter/activity-store.d.ts.map +1 -0
  140. package/lib/types/dsh-adapter/activity-store.js +359 -0
  141. package/lib/types/dsh-adapter/channel/action-readiness.d.ts +1 -1
  142. package/lib/types/dsh-adapter/channel/action-readiness.d.ts.map +1 -1
  143. package/lib/types/dsh-adapter/channel/action-readiness.js +6 -1
  144. package/lib/types/dsh-adapter/channel/background-action.d.ts +2 -1
  145. package/lib/types/dsh-adapter/channel/background-action.d.ts.map +1 -1
  146. package/lib/types/dsh-adapter/channel/background-action.js +2 -0
  147. package/lib/types/dsh-adapter/channel/binding-events.d.ts +15 -14
  148. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  149. package/lib/types/dsh-adapter/channel/binding-events.js +70 -21
  150. package/lib/types/dsh-adapter/channel/compaction.d.ts +2 -2
  151. package/lib/types/dsh-adapter/channel/compaction.d.ts.map +1 -1
  152. package/lib/types/dsh-adapter/channel/compaction.js +35 -4
  153. package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
  154. package/lib/types/dsh-adapter/channel/local-actions.js +6 -1
  155. package/lib/types/dsh-adapter/channel/model-switch.d.ts +1 -2
  156. package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
  157. package/lib/types/dsh-adapter/channel/model-switch.js +6 -2
  158. package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
  159. package/lib/types/dsh-adapter/channel/paths.js +7 -1
  160. package/lib/types/dsh-adapter/channel/preferences.d.ts +1 -1
  161. package/lib/types/dsh-adapter/channel/preferences.d.ts.map +1 -1
  162. package/lib/types/dsh-adapter/channel/preferences.js +16 -0
  163. package/lib/types/dsh-adapter/channel/projection.d.ts +1 -2
  164. package/lib/types/dsh-adapter/channel/projection.d.ts.map +1 -1
  165. package/lib/types/dsh-adapter/channel/projection.js +127 -17
  166. package/lib/types/dsh-adapter/channel/question-record.d.ts +76 -0
  167. package/lib/types/dsh-adapter/channel/question-record.d.ts.map +1 -0
  168. package/lib/types/dsh-adapter/channel/question-record.js +107 -0
  169. package/lib/types/dsh-adapter/channel/session-adoption.d.ts +1 -1
  170. package/lib/types/dsh-adapter/channel/session-adoption.d.ts.map +1 -1
  171. package/lib/types/dsh-adapter/channel/session-adoption.js +1 -0
  172. package/lib/types/dsh-adapter/channel/session-lineage.d.ts +42 -0
  173. package/lib/types/dsh-adapter/channel/session-lineage.d.ts.map +1 -0
  174. package/lib/types/dsh-adapter/channel/session-lineage.js +51 -0
  175. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +3 -1
  176. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
  177. package/lib/types/dsh-adapter/channel/session-live-adoption.js +10 -3
  178. package/lib/types/dsh-adapter/channel/session-metadata.d.ts +2 -1
  179. package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
  180. package/lib/types/dsh-adapter/channel/session-metadata.js +43 -9
  181. package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
  182. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  183. package/lib/types/dsh-adapter/channel/session-reset.js +7 -1
  184. package/lib/types/dsh-adapter/channel/session-resume.d.ts +2 -1
  185. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  186. package/lib/types/dsh-adapter/channel/session-resume.js +5 -2
  187. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  188. package/lib/types/dsh-adapter/channel/settings-host.js +8 -0
  189. package/lib/types/dsh-adapter/channel/state.d.ts +19 -1
  190. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  191. package/lib/types/dsh-adapter/channel/state.js +8 -3
  192. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +32 -17
  193. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
  194. package/lib/types/dsh-adapter/channel/subagent-projection.js +309 -8
  195. package/lib/types/dsh-adapter/channel/types.d.ts +1 -1
  196. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  197. package/lib/types/dsh-adapter/channel.d.ts +1 -1
  198. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  199. package/lib/types/dsh-adapter/channel.js +34 -18
  200. package/lib/types/dsh-adapter/compat/index.d.ts +1 -1
  201. package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -1
  202. package/lib/types/dsh-adapter/compat/index.js +1 -1
  203. package/lib/types/dsh-adapter/compat/messages.d.ts +6 -0
  204. package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
  205. package/lib/types/dsh-adapter/compat/messages.js +9 -0
  206. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +18 -0
  207. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
  208. package/lib/types/dsh-adapter/compat/sessionLog.js +18 -3
  209. package/lib/types/dsh-adapter/compat/settings.d.ts +2 -0
  210. package/lib/types/dsh-adapter/compat/settings.d.ts.map +1 -1
  211. package/lib/types/dsh-adapter/compat/settings.js +14 -0
  212. package/lib/types/dsh-adapter/contract.d.ts +5 -4
  213. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  214. package/lib/types/dsh-adapter/contract.js +9 -5
  215. package/lib/types/dsh-adapter/index.d.ts +36 -1
  216. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  217. package/lib/types/dsh-adapter/index.js +22 -6
  218. package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts +3 -0
  219. package/lib/types/dsh-adapter/migrate/adapters/claude-code.d.ts.map +1 -0
  220. package/lib/types/dsh-adapter/migrate/adapters/claude-code.js +131 -0
  221. package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts +17 -0
  222. package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.d.ts.map +1 -0
  223. package/lib/types/dsh-adapter/migrate/adapters/claude-code.parse.js +329 -0
  224. package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts +3 -0
  225. package/lib/types/dsh-adapter/migrate/adapters/codex.d.ts.map +1 -0
  226. package/lib/types/dsh-adapter/migrate/adapters/codex.js +102 -0
  227. package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts +16 -0
  228. package/lib/types/dsh-adapter/migrate/adapters/codex.parse.d.ts.map +1 -0
  229. package/lib/types/dsh-adapter/migrate/adapters/codex.parse.js +289 -0
  230. package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts +3 -0
  231. package/lib/types/dsh-adapter/migrate/adapters/grok-build.d.ts.map +1 -0
  232. package/lib/types/dsh-adapter/migrate/adapters/grok-build.js +117 -0
  233. package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts +13 -0
  234. package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.d.ts.map +1 -0
  235. package/lib/types/dsh-adapter/migrate/adapters/grok-build.parse.js +178 -0
  236. package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts +3 -0
  237. package/lib/types/dsh-adapter/migrate/adapters/omp.d.ts.map +1 -0
  238. package/lib/types/dsh-adapter/migrate/adapters/omp.js +133 -0
  239. package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts +60 -0
  240. package/lib/types/dsh-adapter/migrate/adapters/scan-fs.d.ts.map +1 -0
  241. package/lib/types/dsh-adapter/migrate/adapters/scan-fs.js +178 -0
  242. package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts +8 -0
  243. package/lib/types/dsh-adapter/migrate/adapters/scan.d.ts.map +1 -0
  244. package/lib/types/dsh-adapter/migrate/adapters/scan.js +40 -0
  245. package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts +3 -0
  246. package/lib/types/dsh-adapter/migrate/adapters/zcode.d.ts.map +1 -0
  247. package/lib/types/dsh-adapter/migrate/adapters/zcode.js +93 -0
  248. package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts +9 -0
  249. package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.d.ts.map +1 -0
  250. package/lib/types/dsh-adapter/migrate/adapters/zcode.parse.js +89 -0
  251. package/lib/types/dsh-adapter/migrate/bin-path.d.ts +6 -0
  252. package/lib/types/dsh-adapter/migrate/bin-path.d.ts.map +1 -0
  253. package/lib/types/dsh-adapter/migrate/bin-path.js +30 -0
  254. package/lib/types/dsh-adapter/migrate/browse.d.ts +42 -0
  255. package/lib/types/dsh-adapter/migrate/browse.d.ts.map +1 -0
  256. package/lib/types/dsh-adapter/migrate/browse.js +90 -0
  257. package/lib/types/dsh-adapter/migrate/cli.d.ts +9 -0
  258. package/lib/types/dsh-adapter/migrate/cli.d.ts.map +1 -0
  259. package/lib/types/dsh-adapter/migrate/cli.js +106 -0
  260. package/lib/types/dsh-adapter/migrate/import-one.d.ts +89 -0
  261. package/lib/types/dsh-adapter/migrate/import-one.d.ts.map +1 -0
  262. package/lib/types/dsh-adapter/migrate/import-one.js +133 -0
  263. package/lib/types/dsh-adapter/migrate/index.d.ts +35 -0
  264. package/lib/types/dsh-adapter/migrate/index.d.ts.map +1 -0
  265. package/lib/types/dsh-adapter/migrate/index.js +107 -0
  266. package/lib/types/dsh-adapter/migrate/parse/injection.d.ts +40 -0
  267. package/lib/types/dsh-adapter/migrate/parse/injection.d.ts.map +1 -0
  268. package/lib/types/dsh-adapter/migrate/parse/injection.js +127 -0
  269. package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts +28 -0
  270. package/lib/types/dsh-adapter/migrate/parse/jsonl.d.ts.map +1 -0
  271. package/lib/types/dsh-adapter/migrate/parse/jsonl.js +40 -0
  272. package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts +28 -0
  273. package/lib/types/dsh-adapter/migrate/parse/role-turns.d.ts.map +1 -0
  274. package/lib/types/dsh-adapter/migrate/parse/role-turns.js +50 -0
  275. package/lib/types/dsh-adapter/migrate/parse/title.d.ts +18 -0
  276. package/lib/types/dsh-adapter/migrate/parse/title.d.ts.map +1 -0
  277. package/lib/types/dsh-adapter/migrate/parse/title.js +29 -0
  278. package/lib/types/dsh-adapter/migrate/parse/tools.d.ts +62 -0
  279. package/lib/types/dsh-adapter/migrate/parse/tools.d.ts.map +1 -0
  280. package/lib/types/dsh-adapter/migrate/parse/tools.js +110 -0
  281. package/lib/types/dsh-adapter/migrate/picker.d.ts +64 -0
  282. package/lib/types/dsh-adapter/migrate/picker.d.ts.map +1 -0
  283. package/lib/types/dsh-adapter/migrate/picker.js +86 -0
  284. package/lib/types/dsh-adapter/migrate/recent-agents.d.ts +40 -0
  285. package/lib/types/dsh-adapter/migrate/recent-agents.d.ts.map +1 -0
  286. package/lib/types/dsh-adapter/migrate/recent-agents.js +100 -0
  287. package/lib/types/dsh-adapter/migrate/sessionize.d.ts +39 -0
  288. package/lib/types/dsh-adapter/migrate/sessionize.d.ts.map +1 -0
  289. package/lib/types/dsh-adapter/migrate/sessionize.js +271 -0
  290. package/lib/types/dsh-adapter/migrate/types.d.ts +176 -0
  291. package/lib/types/dsh-adapter/migrate/types.d.ts.map +1 -0
  292. package/lib/types/dsh-adapter/migrate/types.js +11 -0
  293. package/lib/types/dsh-adapter/migrate/uuid.d.ts +7 -0
  294. package/lib/types/dsh-adapter/migrate/uuid.d.ts.map +1 -0
  295. package/lib/types/dsh-adapter/migrate/uuid.js +25 -0
  296. package/lib/types/dsh-adapter/plugin.d.ts +5 -3
  297. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  298. package/lib/types/dsh-adapter/plugin.js +168 -372
  299. package/lib/types/dsh-adapter/providerWizard.d.ts +17 -0
  300. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  301. package/lib/types/dsh-adapter/providerWizard.js +254 -66
  302. package/lib/types/dsh-adapter/questions.d.ts +22 -15
  303. package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
  304. package/lib/types/dsh-adapter/questions.js +47 -45
  305. package/lib/types/dsh-adapter/sessions/digest.d.ts +11 -6
  306. package/lib/types/dsh-adapter/sessions/digest.d.ts.map +1 -1
  307. package/lib/types/dsh-adapter/sessions/digest.js +20 -13
  308. package/lib/types/dsh-adapter/sessions/frames.d.ts +3 -1
  309. package/lib/types/dsh-adapter/sessions/frames.d.ts.map +1 -1
  310. package/lib/types/dsh-adapter/sessions/frames.js +5 -4
  311. package/lib/types/dsh-adapter/sessions/list.d.ts +6 -1
  312. package/lib/types/dsh-adapter/sessions/list.d.ts.map +1 -1
  313. package/lib/types/dsh-adapter/sessions/list.js +188 -164
  314. package/lib/types/dsh-adapter/sessions/recovery.d.ts +16 -0
  315. package/lib/types/dsh-adapter/sessions/recovery.d.ts.map +1 -0
  316. package/lib/types/dsh-adapter/sessions/recovery.js +108 -0
  317. package/lib/types/dsh-adapter/sessions/snapshot.d.ts +7 -0
  318. package/lib/types/dsh-adapter/sessions/snapshot.d.ts.map +1 -0
  319. package/lib/types/dsh-adapter/sessions/snapshot.js +90 -0
  320. package/lib/types/dsh-adapter/sessions/store.d.ts +10 -4
  321. package/lib/types/dsh-adapter/sessions/store.d.ts.map +1 -1
  322. package/lib/types/dsh-adapter/sessions/store.js +62 -25
  323. package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
  324. package/lib/types/dsh-adapter/settings-sections.js +7 -4
  325. package/lib/types/dsh-adapter/sideQuestion.d.ts +41 -2
  326. package/lib/types/dsh-adapter/sideQuestion.d.ts.map +1 -1
  327. package/lib/types/dsh-adapter/sideQuestion.js +98 -2
  328. package/lib/types/dsh-adapter/subagents.d.ts +44 -6
  329. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  330. package/lib/types/dsh-adapter/subagents.js +163 -26
  331. package/lib/types/herdr.d.ts +2 -0
  332. package/lib/types/herdr.d.ts.map +1 -1
  333. package/lib/types/herdr.js +9 -3
  334. package/lib/types/history.d.ts +13 -1
  335. package/lib/types/history.d.ts.map +1 -1
  336. package/lib/types/history.js +15 -2
  337. package/lib/types/i18n.d.ts +512 -41
  338. package/lib/types/i18n.d.ts.map +1 -1
  339. package/lib/types/i18n.js +199 -20
  340. package/lib/types/ink/components/App.d.ts +2 -2
  341. package/lib/types/ink/components/App.d.ts.map +1 -1
  342. package/lib/types/ink/components/App.js +5 -1
  343. package/lib/types/ink/components/Image.d.ts +14 -1
  344. package/lib/types/ink/components/Image.d.ts.map +1 -1
  345. package/lib/types/ink/components/Image.js +2 -2
  346. package/lib/types/ink/events/input-event.js +3 -3
  347. package/lib/types/ink/hooks/use-terminal-images.d.ts +12 -0
  348. package/lib/types/ink/hooks/use-terminal-images.d.ts.map +1 -1
  349. package/lib/types/ink/hooks/use-terminal-images.js +13 -0
  350. package/lib/types/ink/ink.d.ts +6 -0
  351. package/lib/types/ink/ink.d.ts.map +1 -1
  352. package/lib/types/ink/ink.js +16 -1
  353. package/lib/types/ink/kitty-graphics.d.ts +44 -3
  354. package/lib/types/ink/kitty-graphics.d.ts.map +1 -1
  355. package/lib/types/ink/kitty-graphics.js +184 -23
  356. package/lib/types/ink/log-update.d.ts.map +1 -1
  357. package/lib/types/ink/log-update.js +19 -1
  358. package/lib/types/ink/output.d.ts +24 -2
  359. package/lib/types/ink/output.d.ts.map +1 -1
  360. package/lib/types/ink/output.js +83 -5
  361. package/lib/types/ink/parse-keypress.d.ts +26 -1
  362. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  363. package/lib/types/ink/parse-keypress.js +156 -13
  364. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  365. package/lib/types/ink/render-node-to-output.js +8 -1
  366. package/lib/types/ink/screen.d.ts +24 -0
  367. package/lib/types/ink/screen.d.ts.map +1 -1
  368. package/lib/types/ink/screen.js +89 -0
  369. package/lib/types/ink/selection.d.ts +68 -18
  370. package/lib/types/ink/selection.d.ts.map +1 -1
  371. package/lib/types/ink/selection.js +178 -31
  372. package/lib/types/ink/sixel-codec.d.ts +12 -1
  373. package/lib/types/ink/sixel-codec.d.ts.map +1 -1
  374. package/lib/types/ink/sixel-codec.js +29 -5
  375. package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
  376. package/lib/types/ink/sixel-graphics.js +5 -3
  377. package/lib/types/ink/styles.d.ts +9 -0
  378. package/lib/types/ink/styles.d.ts.map +1 -1
  379. package/lib/types/ink/terminal-image.d.ts +8 -0
  380. package/lib/types/ink/terminal-image.d.ts.map +1 -1
  381. package/lib/types/ink/terminal-querier.d.ts +7 -1
  382. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  383. package/lib/types/ink/terminal-querier.js +12 -2
  384. package/lib/types/ink/timeline-rail.d.ts +5 -0
  385. package/lib/types/ink/timeline-rail.d.ts.map +1 -1
  386. package/lib/types/math/inline-layout.d.ts +29 -0
  387. package/lib/types/math/inline-layout.d.ts.map +1 -0
  388. package/lib/types/math/inline-layout.js +106 -0
  389. package/lib/types/math/layout.d.ts +58 -0
  390. package/lib/types/math/layout.d.ts.map +1 -0
  391. package/lib/types/math/layout.js +59 -0
  392. package/lib/types/math/renderer.d.ts +64 -0
  393. package/lib/types/math/renderer.d.ts.map +1 -0
  394. package/lib/types/math/renderer.js +256 -0
  395. package/lib/types/screens/Chat.d.ts +17 -1
  396. package/lib/types/screens/Chat.d.ts.map +1 -1
  397. package/lib/types/screens/Chat.js +618 -57
  398. package/lib/types/screens/SessionSupervisor.d.ts +2 -1
  399. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  400. package/lib/types/screens/SessionSupervisor.js +156 -19
  401. package/lib/types/screens/Settings.d.ts.map +1 -1
  402. package/lib/types/screens/Settings.js +49 -11
  403. package/lib/types/screens/StatusLine.d.ts +5 -1
  404. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  405. package/lib/types/screens/StatusLine.js +47 -17
  406. package/lib/types/screens/chatOverlay.d.ts +5 -0
  407. package/lib/types/screens/chatOverlay.d.ts.map +1 -1
  408. package/lib/types/screens/chatOverlay.js +1 -0
  409. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +47 -0
  410. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -0
  411. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +65 -0
  412. package/lib/types/screens/sessionSupervisor/model.d.ts +12 -0
  413. package/lib/types/screens/sessionSupervisor/model.d.ts.map +1 -1
  414. package/lib/types/screens/sessionSupervisor/model.js +26 -0
  415. package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts +107 -0
  416. package/lib/types/screens/sessionSupervisor/useForeignSessions.d.ts.map +1 -0
  417. package/lib/types/screens/sessionSupervisor/useForeignSessions.js +312 -0
  418. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +4 -1
  419. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
  420. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +97 -14
  421. package/lib/types/sessionHistory.d.ts +2 -2
  422. package/lib/types/sessionHistory.d.ts.map +1 -1
  423. package/lib/types/sessionHistory.js +31 -5
  424. package/lib/types/settings/definitions.d.ts +681 -0
  425. package/lib/types/settings/definitions.d.ts.map +1 -0
  426. package/lib/types/settings/definitions.js +511 -0
  427. package/lib/types/starAction.d.ts +44 -0
  428. package/lib/types/starAction.d.ts.map +1 -0
  429. package/lib/types/starAction.js +52 -0
  430. package/lib/types/terminal-utils/latex.d.ts +10 -0
  431. package/lib/types/terminal-utils/latex.d.ts.map +1 -0
  432. package/lib/types/terminal-utils/latex.js +1417 -0
  433. package/lib/types/terminal-utils/markdown.d.ts +3 -1
  434. package/lib/types/terminal-utils/markdown.d.ts.map +1 -1
  435. package/lib/types/terminal-utils/markdown.js +26 -1
  436. package/lib/types/terminal-utils/math.d.ts +66 -0
  437. package/lib/types/terminal-utils/math.d.ts.map +1 -0
  438. package/lib/types/terminal-utils/math.js +337 -0
  439. package/lib/types/tips.d.ts.map +1 -1
  440. package/lib/types/tips.js +6 -0
  441. package/lib/types/tuiDisplayPrefs.d.ts +67 -0
  442. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  443. package/lib/types/tuiDisplayPrefs.js +59 -0
  444. package/lib/types/ui.d.ts +1 -1
  445. package/lib/types/ui.d.ts.map +1 -1
  446. package/lib/types/ui.js +1 -1
  447. package/lib/types/usageStats.d.ts +98 -0
  448. package/lib/types/usageStats.d.ts.map +1 -0
  449. package/lib/types/usageStats.js +169 -0
  450. package/lib/types/utils/bmp.d.ts +17 -0
  451. package/lib/types/utils/bmp.d.ts.map +1 -0
  452. package/lib/types/utils/bmp.js +154 -0
  453. package/lib/types/utils/clipboard.d.ts +14 -2
  454. package/lib/types/utils/clipboard.d.ts.map +1 -1
  455. package/lib/types/utils/clipboard.js +143 -8
  456. package/lib/types/utils/fold-long-lines.d.ts +1 -1
  457. package/lib/types/utils/fold-long-lines.d.ts.map +1 -1
  458. package/lib/types/utils/fold-long-lines.js +3 -2
  459. package/lib/types/utils/keymap.d.ts +4 -1
  460. package/lib/types/utils/keymap.d.ts.map +1 -1
  461. package/lib/types/utils/keymap.js +8 -0
  462. package/lib/types/utils/modifiers.d.ts +4 -3
  463. package/lib/types/utils/modifiers.d.ts.map +1 -1
  464. package/lib/types/utils/modifiers.js +4 -3
  465. package/lib/types/working-activity.d.ts +10 -9
  466. package/lib/types/working-activity.d.ts.map +1 -1
  467. package/lib/types/working-activity.js +17 -10
  468. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/LICENSE +202 -0
  469. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/NOTICE +20 -0
  470. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/index.d.ts +16 -0
  471. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/bundled-packages.json +4 -0
  472. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs +20 -0
  473. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/lib/index.mjs.LEGAL.txt +35 -0
  474. package/node_modules/@dsh-tui-vendor/mathjax-tex-svg/package.json +29 -0
  475. package/package.json +117 -99
  476. package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +0 -19
  477. package/lib/types/components/design-system/KeyboardShortcutHint.d.ts.map +0 -1
  478. package/lib/types/components/design-system/KeyboardShortcutHint.js +0 -14
  479. package/lib/types/dsh-adapter/channel/activity.d.ts +0 -20
  480. package/lib/types/dsh-adapter/channel/activity.d.ts.map +0 -1
  481. package/lib/types/dsh-adapter/channel/activity.js +0 -113
  482. package/lib/types/terminal-utils/terminal.d.ts +0 -18
  483. package/lib/types/terminal-utils/terminal.d.ts.map +0 -1
  484. package/lib/types/terminal-utils/terminal.js +0 -96
@@ -0,0 +1,329 @@
1
+ /**
2
+ * Claude Code transcript parsing (pure): one `<session>.jsonl` → one
3
+ * {@link MigrationSession}.
4
+ *
5
+ * Lines are self-describing (`type`). A human prompt is a `user` line whose
6
+ * content is a string or text blocks; an assistant line carries ONE content
7
+ * block of a model response, and one response spans several lines sharing
8
+ * `message.id` (thinking, text, each tool_use — tool results can land
9
+ * between them). Those lines are merged back into one step: one step is one
10
+ * model call.
11
+ *
12
+ * Tool results arrive as `user` lines of `tool_result` blocks, usually
13
+ * after every tool_use of the response has been written; each is paired to
14
+ * the step that made the call by `tool_use_id` (never to the newest step).
15
+ *
16
+ * Machine text in the user role: `isMeta` lines are context the model saw
17
+ * mid-turn and become the next step's inputs (never a turn); slash-command
18
+ * echoes become `/name args` prompts, dropped when the model never answered
19
+ * them (local commands); local-command output and other injection is
20
+ * dropped. Everything dropped is counted in `stats.filtered`.
21
+ *
22
+ * A `user` line flagged `isCompactSummary` is a compaction boundary: its
23
+ * text becomes the checkpoint in front of the next turn (sessionize writes
24
+ * the native compaction transaction). The legacy 2.0.x `summary` record is
25
+ * a one-line leaf title written at the head of a file, not a boundary.
26
+ *
27
+ * Title authority: `custom-title` (the user's /rename; the LAST one wins —
28
+ * renames append) > legacy `summary` > `ai-title` (the FIRST one; later
29
+ * ones are rewritten per turn and drift) > the first real prompt as a
30
+ * fallback that is not written to the log.
31
+ *
32
+ * @module @deepseek-harness-tui/dsh-tui/migrate/adapters/claude-code.parse
33
+ */
34
+ import { isRecord, parseJsonl } from '../parse/jsonl.js';
35
+ import { isInjectedText, stripSystemReminders, unwrapUserText } from '../parse/injection.js';
36
+ import { emptyStats } from '../parse/role-turns.js';
37
+ import { normalizeTitle } from '../parse/title.js';
38
+ import { CallIndex, IMAGE_PLACEHOLDER, closeToolPairs, newStep } from '../parse/tools.js';
39
+ function toMillis(iso) {
40
+ return typeof iso === 'string' ? Date.parse(iso) || 0 : 0;
41
+ }
42
+ /** Text of a string or block-array content; each image becomes a placeholder. */
43
+ function textOf(content) {
44
+ if (typeof content === 'string')
45
+ return content;
46
+ if (!Array.isArray(content))
47
+ return '';
48
+ const parts = [];
49
+ for (const block of content) {
50
+ if (!isRecord(block))
51
+ continue;
52
+ if (block.type === 'text' && typeof block.text === 'string' && block.text !== '')
53
+ parts.push(block.text);
54
+ else if (block.type === 'image')
55
+ parts.push(IMAGE_PLACEHOLDER);
56
+ }
57
+ return parts.join('\n\n');
58
+ }
59
+ /** Model-facing text of a tool_result's content: a string, or text blocks
60
+ * with each image replaced by a placeholder. */
61
+ function toolResultText(content) {
62
+ if (typeof content === 'string')
63
+ return content;
64
+ if (!Array.isArray(content))
65
+ return '';
66
+ const parts = [];
67
+ for (const block of content) {
68
+ if (!isRecord(block))
69
+ continue;
70
+ if (block.type === 'text' && typeof block.text === 'string')
71
+ parts.push(block.text);
72
+ else if (block.type === 'image')
73
+ parts.push(IMAGE_PLACEHOLDER);
74
+ }
75
+ return parts.join('\n');
76
+ }
77
+ /** Whether a user text is Claude Code's echo of a slash command. */
78
+ function isCommandEcho(text) {
79
+ return text.startsWith('<command-name>') || text.startsWith('<command-message>');
80
+ }
81
+ /** Body of the first `<tag>…</tag>` in text, or ''. */
82
+ function tagBody(text, tag) {
83
+ const open = `<${tag}>`;
84
+ const start = text.indexOf(open);
85
+ if (start === -1)
86
+ return '';
87
+ const end = text.indexOf(`</${tag}>`, start + open.length);
88
+ return text.slice(start + open.length, end === -1 ? undefined : end).trim();
89
+ }
90
+ /** A slash-command echo as the user typed it: `/name args`. */
91
+ function commandPrompt(text) {
92
+ const name = tagBody(text, 'command-name');
93
+ const args = tagBody(text, 'command-args');
94
+ return `${name} ${args}`.trim() || text;
95
+ }
96
+ /**
97
+ * Drop failed-dispatch ghosts: when a response's tool calls got no result,
98
+ * Claude Code re-sends the SAME calls (same ids, same arguments) in the next
99
+ * response. Kept, the id would appear twice in the log. A step is a ghost
100
+ * when it holds only tool calls, none answered, and the very next step
101
+ * re-sends every one of them verbatim; its inputs move to the retry.
102
+ * @returns How many steps were dropped.
103
+ */
104
+ function dropGhostRetries(steps) {
105
+ let dropped = 0;
106
+ for (let i = 0; i < steps.length - 1;) {
107
+ const ghost = steps[i];
108
+ const retry = steps[i + 1];
109
+ const isGhost = ghost.blocks.length > 0 && ghost.results.length === 0
110
+ && ghost.blocks.every(block => block.type === 'tool-call'
111
+ && retry.blocks.some(again => again.type === 'tool-call' && again.id === block.id
112
+ && again.name === block.name && again.arguments === block.arguments));
113
+ if (!isGhost) {
114
+ i += 1;
115
+ continue;
116
+ }
117
+ retry.inputs = [...ghost.inputs, ...retry.inputs];
118
+ steps.splice(i, 1);
119
+ dropped += 1;
120
+ // Stay at i: the retry may itself be a ghost of the step after it.
121
+ }
122
+ return dropped;
123
+ }
124
+ /** Whether a user line is a tool-result carrier rather than a prompt. */
125
+ function isToolResultLine(content) {
126
+ return Array.isArray(content) && content.some(block => isRecord(block) && block.type === 'tool_result');
127
+ }
128
+ /**
129
+ * Parse one Claude Code transcript.
130
+ * @returns The session, or undefined when it holds no human prompt or is an
131
+ * auxiliary transcript (its records name another session: only the main
132
+ * `<sessionId>.jsonl` is a conversation of its own).
133
+ */
134
+ export function parseClaudeTranscript(input) {
135
+ const { records, badLines } = parseJsonl(input.raw);
136
+ const owner = records.find(record => typeof record.sessionId === 'string' && record.sessionId !== '')?.sessionId;
137
+ if (owner !== undefined && owner !== input.fileStem)
138
+ return undefined;
139
+ const stats = { ...emptyStats(), badLines };
140
+ let turns = [];
141
+ let current;
142
+ /** message.id → its step, within the current turn. */
143
+ let stepOfMessage = new Map();
144
+ let startedAt = 0;
145
+ let lineCwd;
146
+ const calls = new CallIndex();
147
+ /** A compaction summary waiting for the turn that follows the boundary. */
148
+ let pendingCompaction;
149
+ let lastModel;
150
+ let renamedTitle;
151
+ let legacyTitle;
152
+ let aiTitle;
153
+ /** isMeta texts waiting for the next step of the current turn. */
154
+ let pendingInputs = [];
155
+ /** Turns opened by a slash-command echo rather than typed words. */
156
+ const commandTurns = new Set();
157
+ const openTurn = (prompt) => {
158
+ current = pendingCompaction === undefined ? { prompt, steps: [] } : { prompt, compaction: pendingCompaction, steps: [] };
159
+ pendingCompaction = undefined;
160
+ turns.push(current);
161
+ stepOfMessage = new Map();
162
+ };
163
+ const appendAssistant = (message) => {
164
+ if (current === undefined)
165
+ openTurn('');
166
+ const turn = current;
167
+ const messageId = typeof message.id === 'string' && message.id !== '' ? message.id : undefined;
168
+ let step = messageId === undefined ? undefined : stepOfMessage.get(messageId);
169
+ if (typeof message.model === 'string' && message.model !== '')
170
+ lastModel = message.model;
171
+ if (step === undefined) {
172
+ step = newStep(typeof message.model === 'string' && message.model !== '' ? message.model : undefined);
173
+ step.inputs = pendingInputs;
174
+ pendingInputs = [];
175
+ turn.steps.push(step);
176
+ if (messageId !== undefined)
177
+ stepOfMessage.set(messageId, step);
178
+ }
179
+ const content = message.content;
180
+ if (typeof content === 'string') {
181
+ if (content !== '')
182
+ step.blocks.push({ type: 'text', text: content });
183
+ return;
184
+ }
185
+ if (!Array.isArray(content))
186
+ return;
187
+ for (const block of content) {
188
+ if (!isRecord(block))
189
+ continue;
190
+ if (block.type === 'text' && typeof block.text === 'string' && block.text !== '') {
191
+ step.blocks.push({ type: 'text', text: block.text });
192
+ }
193
+ else if (block.type === 'thinking') {
194
+ // The trace lives in `thinking` (not `text`); accept both.
195
+ const text = typeof block.thinking === 'string' ? block.thinking : typeof block.text === 'string' ? block.text : '';
196
+ if (text !== '')
197
+ step.blocks.push({ type: 'reasoning', text });
198
+ }
199
+ else if (block.type === 'tool_use' && typeof block.id === 'string' && block.id !== '') {
200
+ const name = typeof block.name === 'string' && block.name !== '' ? block.name : 'unknown';
201
+ step.blocks.push({ type: 'tool-call', id: block.id, name, arguments: JSON.stringify(block.input ?? {}) });
202
+ }
203
+ }
204
+ calls.register(step);
205
+ };
206
+ const attachResults = (content) => {
207
+ for (const block of content) {
208
+ if (!isRecord(block) || block.type !== 'tool_result' || typeof block.tool_use_id !== 'string')
209
+ continue;
210
+ calls.attach(block.tool_use_id, toolResultText(block.content), block.is_error === true);
211
+ }
212
+ };
213
+ const acceptUserText = (record, content) => {
214
+ const raw = textOf(content);
215
+ const text = stripSystemReminders(raw);
216
+ if (record.isMeta === true) {
217
+ // Machine context the model saw mid-turn (skill bodies, image notes,
218
+ // "Continue from where you left off."): it enters the NEXT step as a
219
+ // user input instead of opening a turn. Local-command caveats carry
220
+ // no model reply and are dropped.
221
+ if (text === '' || isInjectedText(raw)) {
222
+ stats.filtered += 1;
223
+ return;
224
+ }
225
+ pendingInputs.push(text);
226
+ stats.meta += 1;
227
+ return;
228
+ }
229
+ if (isCommandEcho(text)) {
230
+ openTurn(commandPrompt(text));
231
+ commandTurns.add(current);
232
+ return;
233
+ }
234
+ if (text === '')
235
+ return;
236
+ if (isInjectedText(text)) {
237
+ stats.filtered += 1;
238
+ return;
239
+ }
240
+ // Mid-turn context that no step consumed before the next prompt is
241
+ // stale; the prompt starts over.
242
+ stats.filtered += pendingInputs.length;
243
+ pendingInputs = [];
244
+ openTurn(text);
245
+ };
246
+ for (const record of records) {
247
+ const type = record.type;
248
+ if (type === 'custom-title' && typeof record.customTitle === 'string' && record.customTitle.trim() !== '')
249
+ renamedTitle = record.customTitle;
250
+ else if (type === 'summary' && typeof record.summary === 'string' && record.summary.trim() !== '')
251
+ legacyTitle = record.summary;
252
+ else if (type === 'ai-title' && typeof record.aiTitle === 'string' && record.aiTitle.trim() !== '')
253
+ aiTitle ??= record.aiTitle;
254
+ if (type !== 'user' && type !== 'assistant')
255
+ continue;
256
+ if (record.isSidechain === true)
257
+ continue;
258
+ const message = record.message;
259
+ if (!isRecord(message))
260
+ continue;
261
+ // Claude Code writes the authoritative cwd on every message line; the
262
+ // dash-munged directory name cannot preserve `_`/`.`/`-`.
263
+ if (typeof record.cwd === 'string' && record.cwd !== '')
264
+ lineCwd = record.cwd;
265
+ if (startedAt === 0)
266
+ startedAt = toMillis(record.timestamp);
267
+ if (type === 'user') {
268
+ if (isToolResultLine(message.content)) {
269
+ attachResults(message.content);
270
+ }
271
+ else if (record.isCompactSummary === true) {
272
+ // Compaction boundary: the summary becomes a native checkpoint in
273
+ // front of the next turn; the turn in progress is over.
274
+ const summary = stripSystemReminders(textOf(message.content));
275
+ if (summary !== '') {
276
+ pendingCompaction = lastModel === undefined ? { summary } : { summary, model: lastModel };
277
+ current = undefined;
278
+ }
279
+ }
280
+ else {
281
+ acceptUserText(record, message.content);
282
+ }
283
+ continue;
284
+ }
285
+ appendAssistant(message);
286
+ }
287
+ stats.filtered += pendingInputs.length;
288
+ // The transcript stopped right at a boundary: keep the checkpoint.
289
+ if (pendingCompaction !== undefined)
290
+ turns.push({ prompt: '', compaction: pendingCompaction, steps: [] });
291
+ // A response that produced nothing importable leaves no step behind, and
292
+ // a slash command the model never answered (/model, /clear, …) is local
293
+ // housekeeping, not conversation.
294
+ for (const turn of turns)
295
+ turn.steps = turn.steps.filter(step => step.blocks.length > 0 || step.inputs.length > 0);
296
+ turns = turns.filter(turn => {
297
+ if (commandTurns.has(turn) && turn.steps.length === 0 && turn.compaction === undefined) {
298
+ stats.filtered += 1;
299
+ return false;
300
+ }
301
+ return turn.prompt !== '' || turn.steps.length > 0 || turn.compaction !== undefined;
302
+ });
303
+ for (const turn of turns)
304
+ dropGhostRetries(turn.steps);
305
+ stats.droppedToolResults = calls.orphans + closeToolPairs(turns);
306
+ if (!turns.some(turn => turn.prompt !== ''))
307
+ return undefined;
308
+ // cwd precedence: the per-line `cwd` field → the first prompt's
309
+ // "Primary working directory:" note → the unmunged directory name.
310
+ let cwd = lineCwd ?? input.fallbackCwd;
311
+ if (lineCwd === undefined) {
312
+ const noted = turns.find(turn => turn.prompt.includes('Primary working directory:'));
313
+ const match = noted === undefined ? null : /Primary working directory: (\S+)/u.exec(noted.prompt);
314
+ if (match !== null)
315
+ cwd = match[1];
316
+ }
317
+ const explicit = normalizeTitle(renamedTitle ?? legacyTitle ?? aiTitle);
318
+ const firstPrompt = turns.find(turn => turn.prompt !== '' && !commandTurns.has(turn))?.prompt;
319
+ const title = explicit !== '' ? explicit : normalizeTitle(firstPrompt === undefined ? undefined : unwrapUserText(firstPrompt));
320
+ return {
321
+ sourceId: input.fileStem,
322
+ cwd,
323
+ ...(title === '' ? {} : { title }),
324
+ titleExplicit: explicit !== '',
325
+ startedAt,
326
+ turns,
327
+ stats,
328
+ };
329
+ }
@@ -0,0 +1,3 @@
1
+ import type { MigrationAdapter } from '../types.js';
2
+ export declare const codexAdapter: MigrationAdapter;
3
+ //# sourceMappingURL=codex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/codex.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAmC,gBAAgB,EAA+D,MAAM,aAAa,CAAA;AAyCjJ,eAAO,MAAM,YAAY,EAAE,gBA6C1B,CAAA"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Codex adapter: `~/.codex/sessions/YYYY/MM/DD/rollout-<id>.jsonl`. File
3
+ * discovery lives here; the rollout format is parsed by the pure
4
+ * codex.parse.ts. The browse scan runs the same parser over the rollout's
5
+ * head: the first session_meta, the first real prompt and the sub-agent
6
+ * marker all sit there.
7
+ *
8
+ * @module @deepseek-harness-tui/dsh-tui/migrate/adapters/codex
9
+ */
10
+ import { readdirSync, readFileSync, statSync } from 'node:fs';
11
+ import { homedir } from 'node:os';
12
+ import { basename, join } from 'node:path';
13
+ import { parseCodexRollout } from './codex.parse.js';
14
+ import { countEntries } from './scan.js';
15
+ import { fingerprintOf, loadText, runScan, walkFiles, withHead } from './scan-fs.js';
16
+ const isRollout = (name) => name.startsWith('rollout-') && name.endsWith('.jsonl');
17
+ const WALK = { maxDepth: 5, match: isRollout };
18
+ /** The rollout's stable source id: the uuid in its file name. */
19
+ function sourceIdOf(path) {
20
+ const match = /rollout-.*-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/u.exec(path);
21
+ // Fallback is the bare file name, never the whole path: the id is the dedupe
22
+ // key, so an absolute path would make it depend on where the store lives.
23
+ return match?.[1] ?? basename(path);
24
+ }
25
+ function readOne(path) {
26
+ let raw;
27
+ try {
28
+ raw = readFileSync(path, 'utf8');
29
+ }
30
+ catch {
31
+ return undefined;
32
+ }
33
+ return parseCodexRollout({ raw, sourceId: sourceIdOf(path) });
34
+ }
35
+ async function summarize({ ref, fp }) {
36
+ const session = await withHead(ref, fp.size, raw => parseCodexRollout({ raw, sourceId: sourceIdOf(ref) }));
37
+ if (session === undefined)
38
+ return null;
39
+ return {
40
+ agentId: 'codex',
41
+ sessionKey: session.sourceId,
42
+ ref,
43
+ title: session.title ?? '',
44
+ cwd: session.cwd,
45
+ lastMessageAt: fp.mtimeMs,
46
+ createdAt: session.startedAt || fp.mtimeMs,
47
+ };
48
+ }
49
+ export const codexAdapter = {
50
+ id: 'codex',
51
+ label: 'Codex',
52
+ roots: () => [join(homedir(), '.codex', 'sessions')],
53
+ discover() {
54
+ const roots = this.roots();
55
+ const sessions = [];
56
+ const walk = (dir, depth) => {
57
+ if (depth > 5)
58
+ return;
59
+ let entries;
60
+ try {
61
+ entries = readdirSync(dir, { withFileTypes: true });
62
+ }
63
+ catch {
64
+ return;
65
+ }
66
+ for (const entry of entries) {
67
+ const path = join(dir, entry.name);
68
+ if (entry.isDirectory())
69
+ walk(path, depth + 1);
70
+ else if (entry.isFile() && isRollout(entry.name)) {
71
+ try {
72
+ if (statSync(path).size > 64 * 1024 * 1024)
73
+ continue;
74
+ }
75
+ catch {
76
+ continue;
77
+ }
78
+ const session = readOne(path);
79
+ if (session !== undefined)
80
+ sessions.push(session);
81
+ }
82
+ }
83
+ };
84
+ for (const root of roots)
85
+ walk(root, 0);
86
+ return { roots, sessions };
87
+ },
88
+ count() {
89
+ return countEntries(this.roots(), { maxDepth: WALK.maxDepth, fileMatch: WALK.match });
90
+ },
91
+ walk: WALK,
92
+ async scan(options) {
93
+ const files = walkFiles(this.roots(), { ...WALK, signal: options?.signal });
94
+ return runScan(files, file => file.path, fingerprintOf, options, summarize);
95
+ },
96
+ async load(ref) {
97
+ const raw = await loadText(ref);
98
+ if (typeof raw !== 'string')
99
+ return raw;
100
+ return parseCodexRollout({ raw, sourceId: sourceIdOf(ref) }) ?? { skip: 'not-a-session' };
101
+ },
102
+ };
@@ -0,0 +1,16 @@
1
+ import type { MigrationSession } from '../types.js';
2
+ /** What the adapter knows about a rollout besides its text. */
3
+ export interface CodexRolloutInput {
4
+ readonly raw: string;
5
+ /** The rollout's stable source id (the uuid in its file name). */
6
+ readonly sourceId: string;
7
+ }
8
+ /**
9
+ * Parse one Codex rollout.
10
+ * @returns The session, or undefined when it records no cwd or no prompt, or
11
+ * is a sub-agent thread (`thread_source: 'subagent'` / `source.subagent`):
12
+ * those are spawned by a main session and are not conversations of their
13
+ * own. Forks (`forked_from_id` without the sub-agent marker) are kept.
14
+ */
15
+ export declare function parseCodexRollout(input: CodexRolloutInput): MigrationSession | undefined;
16
+ //# sourceMappingURL=codex.parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.parse.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/migrate/adapters/codex.parse.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAA4C,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE7F,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AA4ED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAkKxF"}