@deepseek-harness-tui/dsh-tui 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/README.md +74 -21
  2. package/bin/dsh-tui.js +115 -25
  3. package/cordis.patch.yml +69 -17
  4. package/cordis.yml +50 -12
  5. package/lib/types/activityPrefs.d.ts +1 -1
  6. package/lib/types/activityPrefs.js +3 -3
  7. package/lib/types/cc/figures.d.ts +27 -20
  8. package/lib/types/cc/figures.d.ts.map +1 -1
  9. package/lib/types/cc/figures.js +43 -34
  10. package/lib/types/cc/format.d.ts +18 -9
  11. package/lib/types/cc/format.d.ts.map +1 -1
  12. package/lib/types/cc/format.js +26 -18
  13. package/lib/types/cc/markdown.d.ts +31 -16
  14. package/lib/types/cc/markdown.d.ts.map +1 -1
  15. package/lib/types/cc/markdown.js +283 -260
  16. package/lib/types/cc/terminal.d.ts +10 -7
  17. package/lib/types/cc/terminal.d.ts.map +1 -1
  18. package/lib/types/cc/terminal.js +62 -50
  19. package/lib/types/command-trees.d.ts +3 -0
  20. package/lib/types/command-trees.d.ts.map +1 -0
  21. package/lib/types/command-trees.js +4 -0
  22. package/lib/types/commands.d.ts +37 -1
  23. package/lib/types/commands.d.ts.map +1 -1
  24. package/lib/types/commands.js +68 -3
  25. package/lib/types/components/ActivityLine.d.ts +1 -1
  26. package/lib/types/components/ActivityLine.d.ts.map +1 -1
  27. package/lib/types/components/ActivityPicker.d.ts.map +1 -1
  28. package/lib/types/components/ActivityPicker.js +3 -4
  29. package/lib/types/components/BtwPanel.d.ts +16 -0
  30. package/lib/types/components/BtwPanel.d.ts.map +1 -0
  31. package/lib/types/components/BtwPanel.js +47 -0
  32. package/lib/types/components/CommandSuggestions.d.ts +4 -2
  33. package/lib/types/components/CommandSuggestions.d.ts.map +1 -1
  34. package/lib/types/components/CommandSuggestions.js +2 -2
  35. package/lib/types/components/EffortSlider.d.ts +15 -0
  36. package/lib/types/components/EffortSlider.d.ts.map +1 -0
  37. package/lib/types/components/EffortSlider.js +17 -0
  38. package/lib/types/components/GoalTodoPanel.d.ts +1 -1
  39. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  40. package/lib/types/components/HelpMenu.d.ts +5 -2
  41. package/lib/types/components/HelpMenu.d.ts.map +1 -1
  42. package/lib/types/components/HelpMenu.js +8 -3
  43. package/lib/types/components/HistorySearchDialog.d.ts +1 -1
  44. package/lib/types/components/HistorySearchDialog.d.ts.map +1 -1
  45. package/lib/types/components/HistorySearchDialog.js +21 -10
  46. package/lib/types/components/InterruptedByUser.d.ts +2 -2
  47. package/lib/types/components/InterruptedByUser.d.ts.map +1 -1
  48. package/lib/types/components/InterruptedByUser.js +4 -3
  49. package/lib/types/components/LoadedContextPanel.d.ts +1 -1
  50. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
  51. package/lib/types/components/LogoV2.d.ts.map +1 -1
  52. package/lib/types/components/LogoV2.js +2 -1
  53. package/lib/types/components/Markdown.d.ts +11 -11
  54. package/lib/types/components/Markdown.d.ts.map +1 -1
  55. package/lib/types/components/Markdown.js +63 -57
  56. package/lib/types/components/MarkdownTable.d.ts +1 -1
  57. package/lib/types/components/MarkdownTable.js +2 -2
  58. package/lib/types/components/MessageList.d.ts +10 -2
  59. package/lib/types/components/MessageList.d.ts.map +1 -1
  60. package/lib/types/components/MessageList.js +17 -10
  61. package/lib/types/components/ModelPicker.d.ts +4 -1
  62. package/lib/types/components/ModelPicker.d.ts.map +1 -1
  63. package/lib/types/components/ModelPicker.js +16 -4
  64. package/lib/types/components/OverlayAbove.d.ts +20 -0
  65. package/lib/types/components/OverlayAbove.d.ts.map +1 -0
  66. package/lib/types/components/OverlayAbove.js +18 -0
  67. package/lib/types/components/PresetPicker.d.ts +1 -1
  68. package/lib/types/components/PresetPicker.d.ts.map +1 -1
  69. package/lib/types/components/PresetPicker.js +2 -3
  70. package/lib/types/components/PromptInput.d.ts +5 -4
  71. package/lib/types/components/PromptInput.d.ts.map +1 -1
  72. package/lib/types/components/PromptInput.js +186 -39
  73. package/lib/types/components/ResumePicker.d.ts +15 -4
  74. package/lib/types/components/ResumePicker.d.ts.map +1 -1
  75. package/lib/types/components/ResumePicker.js +25 -9
  76. package/lib/types/components/RewindPicker.d.ts +1 -1
  77. package/lib/types/components/RewindPicker.d.ts.map +1 -1
  78. package/lib/types/components/RewindPicker.js +14 -5
  79. package/lib/types/components/SearchBox.d.ts +1 -1
  80. package/lib/types/components/SearchBox.js +1 -1
  81. package/lib/types/components/Spinner/GlimmerMessage.d.ts +1 -2
  82. package/lib/types/components/Spinner/GlimmerMessage.d.ts.map +1 -1
  83. package/lib/types/components/Spinner/GlimmerMessage.js +1 -2
  84. package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts +1 -1
  85. package/lib/types/components/Spinner/SpinnerAnimationRow.js +2 -2
  86. package/lib/types/components/Spinner/SpinnerGlyph.d.ts +1 -1
  87. package/lib/types/components/Spinner/SpinnerGlyph.js +1 -1
  88. package/lib/types/components/Spinner/spinnerUtils.d.ts +13 -18
  89. package/lib/types/components/Spinner/spinnerUtils.d.ts.map +1 -1
  90. package/lib/types/components/Spinner/spinnerUtils.js +67 -71
  91. package/lib/types/components/Spinner/useStalledAnimation.d.ts +1 -2
  92. package/lib/types/components/Spinner/useStalledAnimation.d.ts.map +1 -1
  93. package/lib/types/components/Spinner/useStalledAnimation.js +1 -2
  94. package/lib/types/components/StreamingMarkdown.d.ts +1 -1
  95. package/lib/types/components/StreamingMarkdown.js +1 -1
  96. package/lib/types/components/ThemePicker.d.ts +13 -9
  97. package/lib/types/components/ThemePicker.d.ts.map +1 -1
  98. package/lib/types/components/ThemePicker.js +21 -15
  99. package/lib/types/components/ThinkingToggle.d.ts +1 -1
  100. package/lib/types/components/ThinkingToggle.d.ts.map +1 -1
  101. package/lib/types/components/ThinkingToggle.js +8 -8
  102. package/lib/types/components/ToolUseLoader.d.ts +1 -1
  103. package/lib/types/components/ToolUseLoader.js +1 -1
  104. package/lib/types/components/WorkingSpinner.d.ts +2 -2
  105. package/lib/types/components/WorkingSpinner.js +2 -2
  106. package/lib/types/components/WorkspaceFlowPicker.d.ts +15 -0
  107. package/lib/types/components/WorkspaceFlowPicker.d.ts.map +1 -0
  108. package/lib/types/components/WorkspaceFlowPicker.js +19 -0
  109. package/lib/types/components/WorkspacePicker.d.ts +9 -0
  110. package/lib/types/components/WorkspacePicker.d.ts.map +1 -0
  111. package/lib/types/components/WorkspacePicker.js +13 -0
  112. package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
  113. package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
  114. package/lib/types/components/approvals/ApprovalPanel.js +2 -1
  115. package/lib/types/components/design-system/Byline.d.ts +1 -1
  116. package/lib/types/components/design-system/Byline.js +1 -1
  117. package/lib/types/components/design-system/Divider.d.ts +1 -1
  118. package/lib/types/components/design-system/Divider.js +1 -1
  119. package/lib/types/components/design-system/HintLine.d.ts +12 -0
  120. package/lib/types/components/design-system/HintLine.d.ts.map +1 -0
  121. package/lib/types/components/design-system/HintLine.js +15 -0
  122. package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +1 -1
  123. package/lib/types/components/design-system/KeyboardShortcutHint.js +1 -1
  124. package/lib/types/components/design-system/ListItem.d.ts +2 -2
  125. package/lib/types/components/design-system/ListItem.d.ts.map +1 -1
  126. package/lib/types/components/design-system/ListItem.js +35 -3
  127. package/lib/types/components/design-system/LoadingState.d.ts +1 -2
  128. package/lib/types/components/design-system/LoadingState.d.ts.map +1 -1
  129. package/lib/types/components/design-system/LoadingState.js +1 -2
  130. package/lib/types/components/design-system/Pane.d.ts +2 -2
  131. package/lib/types/components/design-system/Pane.js +2 -2
  132. package/lib/types/components/design-system/ProgressBar.d.ts +1 -2
  133. package/lib/types/components/design-system/ProgressBar.d.ts.map +1 -1
  134. package/lib/types/components/design-system/ProgressBar.js +1 -2
  135. package/lib/types/components/design-system/StatusIcon.d.ts +2 -2
  136. package/lib/types/components/design-system/StatusIcon.js +2 -2
  137. package/lib/types/components/design-system/ThemeProvider.d.ts +1 -1
  138. package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
  139. package/lib/types/components/design-system/ThemeProvider.js +87 -26
  140. package/lib/types/components/design-system/ThemedBox.d.ts +1 -1
  141. package/lib/types/components/design-system/ThemedBox.js +1 -1
  142. package/lib/types/components/design-system/ThemedText.d.ts +2 -2
  143. package/lib/types/components/design-system/ThemedText.js +2 -2
  144. package/lib/types/components/listWindow.d.ts +26 -0
  145. package/lib/types/components/listWindow.d.ts.map +1 -0
  146. package/lib/types/components/listWindow.js +47 -0
  147. package/lib/types/components/messages/AssistantTextMessage.d.ts +1 -2
  148. package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -1
  149. package/lib/types/components/messages/AssistantTextMessage.js +1 -2
  150. package/lib/types/components/messages/AssistantThinkingMessage.d.ts +2 -2
  151. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
  152. package/lib/types/components/messages/AssistantThinkingMessage.js +6 -6
  153. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +12 -4
  154. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  155. package/lib/types/components/messages/AssistantToolUseMessage.js +9 -5
  156. package/lib/types/components/messages/MessageMetadata.d.ts +1 -1
  157. package/lib/types/components/messages/MessageMetadata.js +1 -1
  158. package/lib/types/components/messages/UserPromptMessage.d.ts +1 -1
  159. package/lib/types/components/messages/UserPromptMessage.js +1 -1
  160. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -1
  161. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  162. package/lib/types/components/questions/AskUserQuestionPanel.js +11 -9
  163. package/lib/types/components/questions/PlanReviewPanel.d.ts +1 -1
  164. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  165. package/lib/types/components/questions/PlanReviewPanel.js +3 -2
  166. package/lib/types/components/trajectory/HotspotView.d.ts +14 -0
  167. package/lib/types/components/trajectory/HotspotView.d.ts.map +1 -0
  168. package/lib/types/components/trajectory/HotspotView.js +83 -0
  169. package/lib/types/components/trajectory/Inspector.d.ts +31 -0
  170. package/lib/types/components/trajectory/Inspector.d.ts.map +1 -0
  171. package/lib/types/components/trajectory/Inspector.js +67 -0
  172. package/lib/types/components/trajectory/Ledger.d.ts +20 -0
  173. package/lib/types/components/trajectory/Ledger.d.ts.map +1 -0
  174. package/lib/types/components/trajectory/Ledger.js +112 -0
  175. package/lib/types/components/trajectory/MiniWake.d.ts +24 -0
  176. package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -0
  177. package/lib/types/components/trajectory/MiniWake.js +99 -0
  178. package/lib/types/components/trajectory/WaveBand.d.ts +33 -0
  179. package/lib/types/components/trajectory/WaveBand.d.ts.map +1 -0
  180. package/lib/types/components/trajectory/WaveBand.js +145 -0
  181. package/lib/types/customTheme.d.ts +6 -6
  182. package/lib/types/customTheme.d.ts.map +1 -1
  183. package/lib/types/customTheme.js +15 -12
  184. package/lib/types/dsh-adapter/approvals.d.ts.map +1 -0
  185. package/lib/types/{channel.d.ts → dsh-adapter/channel.d.ts} +184 -43
  186. package/lib/types/dsh-adapter/channel.d.ts.map +1 -0
  187. package/lib/types/{channel.js → dsh-adapter/channel.js} +972 -201
  188. package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -0
  189. package/lib/types/{childStderr.js → dsh-adapter/childStderr.js} +1 -1
  190. package/lib/types/dsh-adapter/command-trees.d.ts +27 -0
  191. package/lib/types/dsh-adapter/command-trees.d.ts.map +1 -0
  192. package/lib/types/dsh-adapter/command-trees.js +42 -0
  193. package/lib/types/dsh-adapter/compat/index.d.ts +22 -0
  194. package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -0
  195. package/lib/types/{compat → dsh-adapter/compat}/index.js +7 -4
  196. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +86 -0
  197. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -0
  198. package/lib/types/dsh-adapter/compat/sessionLog.js +347 -0
  199. package/lib/types/dsh-adapter/contract.d.ts +20 -0
  200. package/lib/types/dsh-adapter/contract.d.ts.map +1 -0
  201. package/lib/types/dsh-adapter/contract.js +109 -0
  202. package/lib/types/dsh-adapter/index.d.ts +80 -0
  203. package/lib/types/dsh-adapter/index.d.ts.map +1 -0
  204. package/lib/types/dsh-adapter/index.js +45 -0
  205. package/lib/types/dsh-adapter/invariant.d.ts.map +1 -0
  206. package/lib/types/dsh-adapter/packaged-skills.d.ts.map +1 -0
  207. package/lib/types/{plugin.d.ts → dsh-adapter/plugin.d.ts} +17 -0
  208. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -0
  209. package/lib/types/{plugin.js → dsh-adapter/plugin.js} +280 -80
  210. package/lib/types/dsh-adapter/presets.d.ts.map +1 -0
  211. package/lib/types/dsh-adapter/providerWizard.d.ts +91 -0
  212. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -0
  213. package/lib/types/dsh-adapter/providerWizard.js +332 -0
  214. package/lib/types/{questions.d.ts → dsh-adapter/questions.d.ts} +7 -2
  215. package/lib/types/dsh-adapter/questions.d.ts.map +1 -0
  216. package/lib/types/{questions.js → dsh-adapter/questions.js} +15 -7
  217. package/lib/types/dsh-adapter/sideQuestion.d.ts +38 -0
  218. package/lib/types/dsh-adapter/sideQuestion.d.ts.map +1 -0
  219. package/lib/types/dsh-adapter/sideQuestion.js +69 -0
  220. package/lib/types/dsh-adapter/trajectory/aggregate.d.ts +46 -0
  221. package/lib/types/dsh-adapter/trajectory/aggregate.d.ts.map +1 -0
  222. package/lib/types/dsh-adapter/trajectory/aggregate.js +207 -0
  223. package/lib/types/dsh-adapter/trajectory/guards.d.ts +177 -0
  224. package/lib/types/dsh-adapter/trajectory/guards.d.ts.map +1 -0
  225. package/lib/types/dsh-adapter/trajectory/guards.js +235 -0
  226. package/lib/types/dsh-adapter/trajectory/index.d.ts +16 -0
  227. package/lib/types/dsh-adapter/trajectory/index.d.ts.map +1 -0
  228. package/lib/types/dsh-adapter/trajectory/index.js +15 -0
  229. package/lib/types/dsh-adapter/trajectory/inspect.d.ts +40 -0
  230. package/lib/types/dsh-adapter/trajectory/inspect.d.ts.map +1 -0
  231. package/lib/types/dsh-adapter/trajectory/inspect.js +160 -0
  232. package/lib/types/dsh-adapter/trajectory/projection.d.ts +128 -0
  233. package/lib/types/dsh-adapter/trajectory/projection.d.ts.map +1 -0
  234. package/lib/types/dsh-adapter/trajectory/projection.js +653 -0
  235. package/lib/types/dsh-adapter/trajectory/types.d.ts +232 -0
  236. package/lib/types/dsh-adapter/trajectory/types.d.ts.map +1 -0
  237. package/lib/types/dsh-adapter/trajectory/types.js +70 -0
  238. package/lib/types/dsh-adapter/trajectory/wave.d.ts +45 -0
  239. package/lib/types/dsh-adapter/trajectory/wave.d.ts.map +1 -0
  240. package/lib/types/dsh-adapter/trajectory/wave.js +210 -0
  241. package/lib/types/dsh-adapter/types.d.ts +23 -0
  242. package/lib/types/dsh-adapter/types.d.ts.map +1 -0
  243. package/lib/types/dsh-adapter/types.js +1 -0
  244. package/lib/types/dsh-adapter/workspace.d.ts +22 -0
  245. package/lib/types/dsh-adapter/workspace.d.ts.map +1 -0
  246. package/lib/types/dsh-adapter/workspace.js +16 -0
  247. package/lib/types/dsh-adapter/workspaces.d.ts +118 -0
  248. package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -0
  249. package/lib/types/dsh-adapter/workspaces.js +290 -0
  250. package/lib/types/effortPrefs.d.ts +1 -1
  251. package/lib/types/effortPrefs.js +3 -3
  252. package/lib/types/history.js +2 -2
  253. package/lib/types/hooks/useBlink.d.ts +1 -1
  254. package/lib/types/hooks/useBlink.js +1 -1
  255. package/lib/types/i18n.d.ts +977 -36
  256. package/lib/types/i18n.d.ts.map +1 -1
  257. package/lib/types/i18n.js +307 -30
  258. package/lib/types/index.d.ts +1 -69
  259. package/lib/types/index.d.ts.map +1 -1
  260. package/lib/types/index.js +3 -31
  261. package/lib/types/ink/components/App.d.ts.map +1 -1
  262. package/lib/types/ink/components/App.js +33 -19
  263. package/lib/types/ink/dom.d.ts +15 -0
  264. package/lib/types/ink/dom.d.ts.map +1 -1
  265. package/lib/types/ink/dom.js +32 -0
  266. package/lib/types/ink/hooks/use-input.d.ts.map +1 -1
  267. package/lib/types/ink/hooks/use-input.js +8 -0
  268. package/lib/types/ink/hooks/use-terminal-size.d.ts +1 -1
  269. package/lib/types/ink/hooks/use-terminal-size.js +1 -1
  270. package/lib/types/ink/ink.d.ts.map +1 -1
  271. package/lib/types/ink/ink.js +109 -28
  272. package/lib/types/ink/input-suppression.d.ts +20 -0
  273. package/lib/types/ink/input-suppression.d.ts.map +1 -0
  274. package/lib/types/ink/input-suppression.js +26 -0
  275. package/lib/types/ink/log-update.js +21 -6
  276. package/lib/types/ink/parse-keypress.d.ts +31 -0
  277. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  278. package/lib/types/ink/parse-keypress.js +442 -8
  279. package/lib/types/ink/terminal-querier.d.ts +5 -1
  280. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  281. package/lib/types/ink/terminal-querier.js +27 -3
  282. package/lib/types/ink/terminal.d.ts +18 -0
  283. package/lib/types/ink/terminal.d.ts.map +1 -1
  284. package/lib/types/ink/terminal.js +32 -4
  285. package/lib/types/ink/termio/csi.d.ts +10 -0
  286. package/lib/types/ink/termio/csi.d.ts.map +1 -1
  287. package/lib/types/ink/termio/csi.js +20 -0
  288. package/lib/types/ink/termio/tokenize.js +10 -0
  289. package/lib/types/modelPrefs.d.ts +1 -1
  290. package/lib/types/modelPrefs.js +3 -3
  291. package/lib/types/presetPrefs.d.ts +1 -1
  292. package/lib/types/presetPrefs.js +3 -3
  293. package/lib/types/screens/Chat.d.ts +20 -4
  294. package/lib/types/screens/Chat.d.ts.map +1 -1
  295. package/lib/types/screens/Chat.js +655 -55
  296. package/lib/types/screens/StatusLine.d.ts +17 -2
  297. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  298. package/lib/types/screens/StatusLine.js +12 -4
  299. package/lib/types/screens/TrajectoryScene.d.ts +16 -0
  300. package/lib/types/screens/TrajectoryScene.d.ts.map +1 -0
  301. package/lib/types/screens/TrajectoryScene.js +305 -0
  302. package/lib/types/sessionHistory.d.ts +9 -1
  303. package/lib/types/sessionHistory.d.ts.map +1 -1
  304. package/lib/types/sessionHistory.js +56 -16
  305. package/lib/types/sessionModes.d.ts +29 -0
  306. package/lib/types/sessionModes.d.ts.map +1 -0
  307. package/lib/types/sessionModes.js +45 -0
  308. package/lib/types/theme.d.ts +27 -3
  309. package/lib/types/theme.d.ts.map +1 -1
  310. package/lib/types/theme.js +48 -4
  311. package/lib/types/themePrefs.d.ts +3 -3
  312. package/lib/types/themePrefs.js +5 -5
  313. package/lib/types/trajectory/format.d.ts +100 -0
  314. package/lib/types/trajectory/format.d.ts.map +1 -0
  315. package/lib/types/trajectory/format.js +213 -0
  316. package/lib/types/trajectory/motion.d.ts +99 -0
  317. package/lib/types/trajectory/motion.d.ts.map +1 -0
  318. package/lib/types/trajectory/motion.js +143 -0
  319. package/lib/types/trajectory/query.d.ts +83 -0
  320. package/lib/types/trajectory/query.d.ts.map +1 -0
  321. package/lib/types/trajectory/query.js +187 -0
  322. package/lib/types/trajectoryPrefs.d.ts +36 -0
  323. package/lib/types/trajectoryPrefs.d.ts.map +1 -0
  324. package/lib/types/trajectoryPrefs.js +65 -0
  325. package/lib/types/update.d.ts +3 -3
  326. package/lib/types/update.d.ts.map +1 -1
  327. package/lib/types/update.js +18 -7
  328. package/lib/types/utils/clipboard.d.ts +101 -29
  329. package/lib/types/utils/clipboard.d.ts.map +1 -1
  330. package/lib/types/utils/clipboard.js +533 -55
  331. package/lib/types/utils/debug.d.ts +1 -1
  332. package/lib/types/utils/debug.js +2 -2
  333. package/lib/types/utils/execFileNoThrow.d.ts.map +1 -1
  334. package/lib/types/utils/execFileNoThrow.js +16 -6
  335. package/lib/types/utils/externalEditor.d.ts +115 -0
  336. package/lib/types/utils/externalEditor.d.ts.map +1 -0
  337. package/lib/types/utils/externalEditor.js +270 -0
  338. package/lib/types/utils/fullscreen.d.ts +2 -2
  339. package/lib/types/utils/fullscreen.js +3 -3
  340. package/lib/types/utils/loaded-context.d.ts +1 -1
  341. package/lib/types/utils/loaded-context.d.ts.map +1 -1
  342. package/lib/types/utils/modifiers.d.ts +24 -0
  343. package/lib/types/utils/modifiers.d.ts.map +1 -1
  344. package/lib/types/utils/modifiers.js +27 -0
  345. package/lib/types/utils/paths.d.ts +45 -0
  346. package/lib/types/utils/paths.d.ts.map +1 -0
  347. package/lib/types/utils/paths.js +69 -0
  348. package/lib/types/utils/shellQuote.d.ts +14 -0
  349. package/lib/types/utils/shellQuote.d.ts.map +1 -0
  350. package/lib/types/utils/shellQuote.js +39 -0
  351. package/lib/types/utils/workspaceRoot.d.ts +21 -0
  352. package/lib/types/utils/workspaceRoot.d.ts.map +1 -0
  353. package/lib/types/utils/workspaceRoot.js +47 -0
  354. package/lib/types/workspaces.d.ts +3 -0
  355. package/lib/types/workspaces.d.ts.map +1 -0
  356. package/lib/types/workspaces.js +4 -0
  357. package/package.json +26 -8
  358. package/lib/types/approvals.d.ts.map +0 -1
  359. package/lib/types/channel.d.ts.map +0 -1
  360. package/lib/types/childStderr.d.ts.map +0 -1
  361. package/lib/types/compat/index.d.ts +0 -20
  362. package/lib/types/compat/index.d.ts.map +0 -1
  363. package/lib/types/compat/sessionLog.d.ts +0 -40
  364. package/lib/types/compat/sessionLog.d.ts.map +0 -1
  365. package/lib/types/compat/sessionLog.js +0 -226
  366. package/lib/types/invariant.d.ts.map +0 -1
  367. package/lib/types/packaged-skills.d.ts.map +0 -1
  368. package/lib/types/plugin.d.ts.map +0 -1
  369. package/lib/types/presets.d.ts.map +0 -1
  370. package/lib/types/questions.d.ts.map +0 -1
  371. /package/lib/types/{approvals.d.ts → dsh-adapter/approvals.d.ts} +0 -0
  372. /package/lib/types/{approvals.js → dsh-adapter/approvals.js} +0 -0
  373. /package/lib/types/{childStderr.d.ts → dsh-adapter/childStderr.d.ts} +0 -0
  374. /package/lib/types/{invariant.d.ts → dsh-adapter/invariant.d.ts} +0 -0
  375. /package/lib/types/{invariant.js → dsh-adapter/invariant.js} +0 -0
  376. /package/lib/types/{packaged-skills.d.ts → dsh-adapter/packaged-skills.d.ts} +0 -0
  377. /package/lib/types/{packaged-skills.js → dsh-adapter/packaged-skills.js} +0 -0
  378. /package/lib/types/{presets.d.ts → dsh-adapter/presets.d.ts} +0 -0
  379. /package/lib/types/{presets.js → dsh-adapter/presets.js} +0 -0
@@ -0,0 +1,232 @@
1
+ /**
2
+ * Trajectory projection — the data contract shared by the adapter-side fold
3
+ * and the UI-side scene (issue #80 evolution).
4
+ *
5
+ * Two rules shape every type here, and both exist because the projection
6
+ * feeds a terminal that repaints on a keystroke:
7
+ *
8
+ * 1. **Nodes carry references, never derived copies.** A node's `detail` is
9
+ * the raw event string exactly as the log holds it — JS strings are
10
+ * immutable and shared, so keeping one costs a pointer, while flattening
11
+ * or truncating it at fold time would allocate a second copy of every
12
+ * tool argument in the session AND bake in a width the terminal has not
13
+ * chosen yet. The view calls {@link previewText} on the ~15 rows it is
14
+ * about to paint; everything else stays untouched.
15
+ * 2. **Full content is never held at all.** `seq`/`endSeq` address the
16
+ * owning events, and the inspector re-reads them from the session's own
17
+ * immutable snapshot on demand. The projection is an index, not a mirror.
18
+ */
19
+ /** The row kinds a trajectory node can carry. */
20
+ export type TrajKind = 'turn' | 'step' | 'user' | 'assistant' | 'thinking' | 'tool' | 'subtool' | 'retry' | 'approval' | 'compaction' | 'system' | 'context' | 'todo';
21
+ /** Bracket outcome; open brackets stay `running` until their closer lands. */
22
+ export type TrajStatus = 'running' | 'ok' | 'error';
23
+ /** Per-message token accounting, present only when the adapter reported it. */
24
+ export interface TrajTokens {
25
+ readonly input: number;
26
+ readonly output: number;
27
+ readonly think: number;
28
+ readonly cacheRead: number;
29
+ readonly cacheWrite: number;
30
+ }
31
+ /**
32
+ * A run of consecutive same-name calls folded into one ledger row.
33
+ *
34
+ * The fold replaces the run with a *synthetic* node that carries this burst;
35
+ * `members` holds the original nodes, still live and still the objects the
36
+ * bracket-pairing maps mutate when their closers land. Totals are therefore
37
+ * derived on read ({@link burstDurationMs}, {@link burstErrors}) rather than
38
+ * maintained incrementally — a member closing after the fold needs no
39
+ * bookkeeping, and there is no head/member self-reference to trip a walker.
40
+ */
41
+ export interface TrajBurst {
42
+ /** Tool name shared by every member. */
43
+ readonly name: string;
44
+ /** Every folded call, in log order. */
45
+ readonly members: readonly TrajNode[];
46
+ }
47
+ /** Summed own-duration of the burst members whose brackets have closed. */
48
+ export declare function burstDurationMs(burst: TrajBurst): number;
49
+ /** Number of burst members that failed. */
50
+ export declare function burstErrors(burst: TrajBurst): number;
51
+ /** True while any burst member is still running. */
52
+ export declare function burstRunning(burst: TrajBurst): boolean;
53
+ /**
54
+ * One row of the trajectory ledger.
55
+ *
56
+ * Fields filled when the opening event is consumed are `readonly`; fields a
57
+ * later closing event completes (`endSeq`, `durationMs`, `status`, …) are
58
+ * mutable, matching the fold's in-place bracket pairing.
59
+ */
60
+ export interface TrajNode {
61
+ /** Seq of the opening event — the inspector's lookup key. */
62
+ readonly seq: number;
63
+ /** Epoch-ms timestamp of the opening event. */
64
+ readonly time: number;
65
+ readonly kind: TrajKind;
66
+ /** Owning turn; 0 for events that precede the first `turn/start`. */
67
+ readonly turn: number;
68
+ /** Owning step, when the event carried one. */
69
+ readonly step?: number;
70
+ /**
71
+ * Short, already-bounded label: a tool name, `turn 3`, a retry code. Safe
72
+ * to render as-is — it never holds user or model prose.
73
+ */
74
+ readonly label: string;
75
+ /** Raw one-line-preview source (arguments, message text). Never flattened. */
76
+ readonly detail?: string;
77
+ /** Raw result-preview source rendered after the `→`. Never flattened. */
78
+ outcome?: string;
79
+ /** Seq of the closing event, once it lands. */
80
+ endSeq?: number;
81
+ /** Own wall-clock duration, filled when the bracket closes. */
82
+ durationMs?: number;
83
+ status?: TrajStatus;
84
+ /** Message-level token accounting (assistant rows only). */
85
+ tokens?: TrajTokens;
86
+ /** Tool-call identity, used for `tool/call` ↔ `tool/result` pairing. */
87
+ readonly callId?: string;
88
+ /** Code-runner sub-call identity (`tool/code-dispatch*` pairing). */
89
+ readonly subCallId?: string;
90
+ /** Failure identity when `status === 'error'` (e.g. `RATE_LIMIT`). */
91
+ errorCode?: string;
92
+ /** Attempt count on a `retry` row (one row per retry sequence). */
93
+ attempts?: number;
94
+ /**
95
+ * Set on the synthetic node that stands in for a folded run of same-name
96
+ * calls. The node itself is not one of the members.
97
+ */
98
+ readonly burst?: TrajBurst;
99
+ /**
100
+ * True while this node belongs to seed history — events replayed from a
101
+ * resumed/forked log rather than produced by this lifecycle. The scene
102
+ * dims them so a resumed session's inherited past is visually distinct.
103
+ * Mutable because only the LAST `session/end-seed` bounds the inherited
104
+ * range, so a re-seeded log re-marks the rows folded before it.
105
+ */
106
+ seed?: boolean;
107
+ }
108
+ /** Minimum run length that folds into a {@link TrajBurst}. */
109
+ export declare const BURST_MIN = 3;
110
+ /** Timeline channel a node contributes to in the wave band. */
111
+ export type WaveChannel = 'input' | 'model' | 'tool';
112
+ /** One column of the wave band. */
113
+ export interface WaveBucket {
114
+ /** Total weight in this column, before normalization. */
115
+ weight: number;
116
+ /**
117
+ * Rows in this column, regardless of cost.
118
+ *
119
+ * Separate from `weight` because structural rows (turn/step) deliberately
120
+ * contribute no cost — their span is their children's — yet a column holding
121
+ * one is NOT empty. Conflating the two rendered such columns as gaps, which
122
+ * at status-line scale made the strip look broken rather than quiet.
123
+ */
124
+ count: number;
125
+ /** Per-channel weights; the dominant one drives the column's color. */
126
+ readonly channels: {
127
+ input: number;
128
+ model: number;
129
+ tool: number;
130
+ };
131
+ /** Any member failed. */
132
+ error: boolean;
133
+ /** Any member is an `llm/retry`. */
134
+ retry: boolean;
135
+ /** Any member is still running. */
136
+ running: boolean;
137
+ /** Ledger index of the first node in this column, for click-to-seek. */
138
+ firstIndex: number;
139
+ }
140
+ /** The wave band projected at one specific column count. */
141
+ export interface WaveBand {
142
+ readonly buckets: readonly WaveBucket[];
143
+ /**
144
+ * Weight that maps to the tallest glyph — the 95th percentile of non-empty
145
+ * columns, not the maximum. Columns above it clamp to a full block.
146
+ */
147
+ readonly peak: number;
148
+ /**
149
+ * Lowest NON-EMPTY bucket weight. Glyph levels are normalized between this
150
+ * and {@link peak} rather than from zero: a typical bucket already sits near
151
+ * half of `log1p(peak)`, so a zero-based scale leaves the lower half of the
152
+ * glyph ramp permanently unused and the band reads as a flat smear.
153
+ */
154
+ readonly floor: number;
155
+ /** Turn-boundary markers as `[turn, bucketIndex]`, for the ruler row. */
156
+ readonly turns: readonly (readonly [number, number])[];
157
+ }
158
+ /** How the wave band maps nodes onto columns. */
159
+ export type WaveProjection =
160
+ /** One column per equal slice of the node index range. */
161
+ 'sequence'
162
+ /** Columns proportional to wall-clock, idle gaps included. */
163
+ | 'time'
164
+ /** Columns proportional to wall-clock with idle gaps compressed out. */
165
+ | 'compressed';
166
+ /** Ordered cycle for the `m` key. */
167
+ export declare const WAVE_PROJECTIONS: readonly WaveProjection[];
168
+ /** One row of the hotspot view: a named cost bucket. */
169
+ export interface HotspotRow {
170
+ readonly label: string;
171
+ /** Summed wall-clock across every member. */
172
+ readonly totalMs: number;
173
+ readonly count: number;
174
+ /** Summed tokens where the group carries accounting. */
175
+ readonly tokens: number;
176
+ /** True for rows that represent a failure cost (retry backoff). */
177
+ readonly error?: boolean;
178
+ /** Ledger index of the group's first member, for `Enter` to seek. */
179
+ readonly firstIndex: number;
180
+ }
181
+ /** The hotspot view's three sections plus the session totals. */
182
+ export interface TrajAggregate {
183
+ /** Per tool name, descending by `totalMs`. */
184
+ readonly tools: readonly HotspotRow[];
185
+ /** Model-side cost: decode, time-to-first-token, retry backoff. */
186
+ readonly model: readonly HotspotRow[];
187
+ /** Per turn, descending by `totalMs`. */
188
+ readonly turns: readonly HotspotRow[];
189
+ readonly totals: TrajTotals;
190
+ }
191
+ /** Session-level counters shown in the scene header and the status badge. */
192
+ export interface TrajTotals {
193
+ readonly turns: number;
194
+ readonly steps: number;
195
+ /** Ledger rows, after burst folding. */
196
+ readonly rows: number;
197
+ /** Tool + subtool call count, before burst folding. */
198
+ readonly calls: number;
199
+ readonly errors: number;
200
+ readonly retries: number;
201
+ /** Wall-clock from the first to the last event. */
202
+ readonly spanMs: number;
203
+ /** Summed tool own-duration. */
204
+ readonly toolMs: number;
205
+ /** Summed assistant decode duration (first token → completion). */
206
+ readonly decodeMs: number;
207
+ /** Summed time-to-first-token. */
208
+ readonly ttftMs: number;
209
+ /** Number of steps that contributed a TTFT sample. */
210
+ readonly ttftSamples: number;
211
+ /** Summed retry backoff. */
212
+ readonly retryMs: number;
213
+ readonly tokens: TrajTokens;
214
+ }
215
+ /** Hotspot sort keys, cycled by the `t` key. */
216
+ export type HotspotSort = 'duration' | 'count' | 'tokens';
217
+ /** Ordered cycle for the `t` key. */
218
+ export declare const HOTSPOT_SORTS: readonly HotspotSort[];
219
+ /**
220
+ * Collapse whitespace and cap a raw detail string for one-line display.
221
+ *
222
+ * The scan is bounded: only the first `limit * 4 + 16` code units are ever
223
+ * examined, so a 200 KB tool result costs the same as a 200-byte one. This
224
+ * is the ONLY place raw detail becomes a display string, and it runs per
225
+ * painted row, never per stored node.
226
+ *
227
+ * @param raw - Untrusted message, argument, or result text.
228
+ * @param limit - Maximum characters to return, excluding the ellipsis.
229
+ * @returns Flattened preview, suffixed with `…` when the source was longer.
230
+ */
231
+ export declare function previewText(raw: string, limit: number): string;
232
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/trajectory/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iDAAiD;AACjD,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,MAAM,GACN,MAAM,GACN,WAAW,GACX,UAAU,GACV,MAAM,GACN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WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,gCAAgC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,kCAAkC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,sDAAsD;IACtD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAC5B;AAED,gDAAgD;AAChD,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEzD,qCAAqC;AACrC,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAAoC,CAAA;AAEpF;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAa9D"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Trajectory projection — the data contract shared by the adapter-side fold
3
+ * and the UI-side scene (issue #80 evolution).
4
+ *
5
+ * Two rules shape every type here, and both exist because the projection
6
+ * feeds a terminal that repaints on a keystroke:
7
+ *
8
+ * 1. **Nodes carry references, never derived copies.** A node's `detail` is
9
+ * the raw event string exactly as the log holds it — JS strings are
10
+ * immutable and shared, so keeping one costs a pointer, while flattening
11
+ * or truncating it at fold time would allocate a second copy of every
12
+ * tool argument in the session AND bake in a width the terminal has not
13
+ * chosen yet. The view calls {@link previewText} on the ~15 rows it is
14
+ * about to paint; everything else stays untouched.
15
+ * 2. **Full content is never held at all.** `seq`/`endSeq` address the
16
+ * owning events, and the inspector re-reads them from the session's own
17
+ * immutable snapshot on demand. The projection is an index, not a mirror.
18
+ */
19
+ /** Summed own-duration of the burst members whose brackets have closed. */
20
+ export function burstDurationMs(burst) {
21
+ let total = 0;
22
+ for (const member of burst.members)
23
+ total += member.durationMs ?? 0;
24
+ return total;
25
+ }
26
+ /** Number of burst members that failed. */
27
+ export function burstErrors(burst) {
28
+ let count = 0;
29
+ for (const member of burst.members)
30
+ if (member.status === 'error')
31
+ count += 1;
32
+ return count;
33
+ }
34
+ /** True while any burst member is still running. */
35
+ export function burstRunning(burst) {
36
+ return burst.members.some(member => member.status === 'running');
37
+ }
38
+ /** Minimum run length that folds into a {@link TrajBurst}. */
39
+ export const BURST_MIN = 3;
40
+ /** Ordered cycle for the `m` key. */
41
+ export const WAVE_PROJECTIONS = ['sequence', 'time', 'compressed'];
42
+ /** Ordered cycle for the `t` key. */
43
+ export const HOTSPOT_SORTS = ['duration', 'count', 'tokens'];
44
+ /**
45
+ * Collapse whitespace and cap a raw detail string for one-line display.
46
+ *
47
+ * The scan is bounded: only the first `limit * 4 + 16` code units are ever
48
+ * examined, so a 200 KB tool result costs the same as a 200-byte one. This
49
+ * is the ONLY place raw detail becomes a display string, and it runs per
50
+ * painted row, never per stored node.
51
+ *
52
+ * @param raw - Untrusted message, argument, or result text.
53
+ * @param limit - Maximum characters to return, excluding the ellipsis.
54
+ * @returns Flattened preview, suffixed with `…` when the source was longer.
55
+ */
56
+ export function previewText(raw, limit) {
57
+ if (limit <= 0)
58
+ return '';
59
+ // Bounded window: enough slack that collapsing runs of whitespace still
60
+ // yields `limit` visible characters in the worst realistic case.
61
+ const window = raw.slice(0, limit * 4 + 16);
62
+ const flat = window.replace(/\s+/g, ' ').trim();
63
+ if (flat.length <= limit) {
64
+ // Only authoritative when the window covered the whole source; a source
65
+ // longer than the window is still truncated even if the window collapsed
66
+ // below the limit.
67
+ return raw.length <= window.length ? flat : `${flat}…`;
68
+ }
69
+ return `${flat.slice(0, limit)}…`;
70
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Wave band projection — the whole session compressed onto one row of glyphs.
3
+ *
4
+ * The band answers, without reading a single word: how long was this session,
5
+ * where was it dense, where did it idle, where did it fail, and where am I
6
+ * looking right now. It is the trajectory's coarse navigation axis — a few
7
+ * keypresses cross a session that would take dozens of scrolls in the ledger.
8
+ *
9
+ * ## Three projections, one shape
10
+ *
11
+ * `sequence` gives every row equal width — best for scanning *what* happened.
12
+ * `time` maps real wall-clock, so a five-minute tool call is visibly five
13
+ * minutes and idle gaps are visibly idle. `compressed` keeps wall-clock
14
+ * proportions but caps each inter-row gap, which is what you want on a session
15
+ * that sat idle overnight between two bursts of work.
16
+ *
17
+ * ## Purity and cost
18
+ *
19
+ * {@link projectWave} is pure and O(nodes + columns). It is recomputed only
20
+ * when the node count, the column count, or the projection changes — the
21
+ * caller memoizes on exactly those three, which is why no cache lives here.
22
+ */
23
+ import { type TrajNode, type WaveBand, type WaveBucket, type WaveChannel, type WaveProjection } from './types.js';
24
+ /** Which band channel a row contributes its weight to. */
25
+ export declare function channelOf(kind: TrajNode['kind']): WaveChannel;
26
+ /**
27
+ * Project the ledger onto a fixed number of columns.
28
+ *
29
+ * @param nodes - The folded ledger, in log order.
30
+ * @param columns - Column count; normally the band's rendered width.
31
+ * @param projection - Horizontal domain (see the module comment).
32
+ * @returns The band, with `peak` for glyph scaling and turn markers for the
33
+ * ruler row. An empty ledger yields zero buckets and `peak` 0.
34
+ */
35
+ export declare function projectWave(nodes: readonly TrajNode[], columns: number, projection?: WaveProjection): WaveBand;
36
+ /** The dominant channel of a column, or `undefined` for an empty column. */
37
+ export declare function dominantChannel(bucket: WaveBucket): WaveChannel | undefined;
38
+ /**
39
+ * Map a ledger index back to its column — the inverse used to draw the
40
+ * viewport bracket under the band.
41
+ *
42
+ * @returns Column index, clamped into range; 0 for an empty band.
43
+ */
44
+ export declare function columnOfIndex(band: WaveBand, ledgerIndex: number): number;
45
+ //# sourceMappingURL=wave.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wave.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/trajectory/wave.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAe,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAS9H,0DAA0D;AAC1D,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,WAAW,CAe7D;AAiED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,cAA2B,GACtC,QAAQ,CA6DV;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,CAM3E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CASzE"}
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Wave band projection — the whole session compressed onto one row of glyphs.
3
+ *
4
+ * The band answers, without reading a single word: how long was this session,
5
+ * where was it dense, where did it idle, where did it fail, and where am I
6
+ * looking right now. It is the trajectory's coarse navigation axis — a few
7
+ * keypresses cross a session that would take dozens of scrolls in the ledger.
8
+ *
9
+ * ## Three projections, one shape
10
+ *
11
+ * `sequence` gives every row equal width — best for scanning *what* happened.
12
+ * `time` maps real wall-clock, so a five-minute tool call is visibly five
13
+ * minutes and idle gaps are visibly idle. `compressed` keeps wall-clock
14
+ * proportions but caps each inter-row gap, which is what you want on a session
15
+ * that sat idle overnight between two bursts of work.
16
+ *
17
+ * ## Purity and cost
18
+ *
19
+ * {@link projectWave} is pure and O(nodes + columns). It is recomputed only
20
+ * when the node count, the column count, or the projection changes — the
21
+ * caller memoizes on exactly those three, which is why no cache lives here.
22
+ */
23
+ import { burstErrors } from './types.js';
24
+ /**
25
+ * Longest inter-row gap the `compressed` projection preserves. Beyond this a
26
+ * gap contributes a fixed width, so an overnight pause reads as "a pause"
27
+ * instead of flattening the entire session into one column.
28
+ */
29
+ const GAP_CAP_MS = 2_000;
30
+ /** Which band channel a row contributes its weight to. */
31
+ export function channelOf(kind) {
32
+ switch (kind) {
33
+ case 'user':
34
+ case 'context':
35
+ case 'todo':
36
+ return 'input';
37
+ case 'tool':
38
+ case 'subtool':
39
+ case 'approval':
40
+ case 'compaction':
41
+ return 'tool';
42
+ default:
43
+ // turn / step / assistant / thinking / retry / system
44
+ return 'model';
45
+ }
46
+ }
47
+ /**
48
+ * Nominal cost of a row that brackets no wall-clock (a message, a mode
49
+ * switch). Without it a stretch of pure conversation would read as idle.
50
+ */
51
+ const NOMINAL_MS = 120;
52
+ /**
53
+ * Cost one row contributes to its column, in milliseconds.
54
+ *
55
+ * **Height is time, not tally.** An earlier version summed one unit per row,
56
+ * which made the band perfectly flat in the sequence projection — buckets hold
57
+ * equal numbers of rows there *by construction*, so the only thing the height
58
+ * could express was the constant it was built from. Summing own-duration
59
+ * instead gives every projection a real reading: along the event axis, tall
60
+ * means "these steps were expensive"; along the wall-clock axis, tall means
61
+ * "this stretch was busy" (occupancy), and idle gaps genuinely flatten.
62
+ *
63
+ * Structural rows (turn/step) contribute nothing: their duration is the sum of
64
+ * their children's, and counting both would double every span.
65
+ */
66
+ function costOf(node) {
67
+ if (node.kind === 'turn' || node.kind === 'step')
68
+ return 0;
69
+ if (node.burst !== undefined) {
70
+ let total = 0;
71
+ for (const member of node.burst.members)
72
+ total += (member.durationMs ?? 0) + NOMINAL_MS;
73
+ return total;
74
+ }
75
+ return (node.durationMs ?? 0) + NOMINAL_MS;
76
+ }
77
+ /** Positions of each row along the projection's horizontal domain, in [0, 1]. */
78
+ function positions(nodes, projection) {
79
+ const count = nodes.length;
80
+ if (count === 0)
81
+ return [];
82
+ if (count === 1)
83
+ return [0];
84
+ /** Equal spacing — the fallback whenever a time domain would divide by zero. */
85
+ const even = () => Array.from({ length: count }, (_, index) => index / (count - 1));
86
+ if (projection === 'sequence')
87
+ return even();
88
+ if (projection === 'time') {
89
+ const first = nodes[0].time;
90
+ const span = nodes[count - 1].time - first;
91
+ // A zero span (every row inside the same millisecond) has no meaningful
92
+ // time axis; fall back to equal spacing rather than dividing by zero.
93
+ if (span <= 0)
94
+ return even();
95
+ return Array.from({ length: count }, (_, index) => (nodes[index].time - first) / span);
96
+ }
97
+ // compressed: accumulate inter-row gaps, each capped.
98
+ let accumulated = 0;
99
+ const cumulative = Array.from({ length: count }, (_, index) => {
100
+ if (index > 0) {
101
+ const gap = nodes[index].time - nodes[index - 1].time;
102
+ accumulated += Math.min(Math.max(0, gap), GAP_CAP_MS);
103
+ }
104
+ return accumulated;
105
+ });
106
+ if (accumulated <= 0)
107
+ return even();
108
+ return cumulative.map(value => value / accumulated);
109
+ }
110
+ /**
111
+ * Project the ledger onto a fixed number of columns.
112
+ *
113
+ * @param nodes - The folded ledger, in log order.
114
+ * @param columns - Column count; normally the band's rendered width.
115
+ * @param projection - Horizontal domain (see the module comment).
116
+ * @returns The band, with `peak` for glyph scaling and turn markers for the
117
+ * ruler row. An empty ledger yields zero buckets and `peak` 0.
118
+ */
119
+ export function projectWave(nodes, columns, projection = 'sequence') {
120
+ const width = Math.max(0, Math.floor(columns));
121
+ if (width === 0 || nodes.length === 0)
122
+ return { buckets: [], peak: 0, floor: 0, turns: [] };
123
+ const buckets = Array.from({ length: width }, () => ({
124
+ weight: 0,
125
+ count: 0,
126
+ channels: { input: 0, model: 0, tool: 0 },
127
+ error: false,
128
+ retry: false,
129
+ running: false,
130
+ firstIndex: -1,
131
+ }));
132
+ const pos = positions(nodes, projection);
133
+ const turns = [];
134
+ for (let index = 0; index < nodes.length; index++) {
135
+ const node = nodes[index];
136
+ // `pos` is in [0, 1]; the final row must land inside the last column.
137
+ const column = Math.min(width - 1, Math.floor(pos[index] * width));
138
+ const slot = buckets[column];
139
+ const weight = costOf(node);
140
+ slot.count += 1;
141
+ slot.weight += weight;
142
+ slot.channels[channelOf(node.kind)] += weight;
143
+ if (slot.firstIndex === -1)
144
+ slot.firstIndex = index;
145
+ if (node.status === 'error' || (node.burst !== undefined && burstErrors(node.burst) > 0)) {
146
+ slot.error = true;
147
+ }
148
+ if (node.kind === 'retry')
149
+ slot.retry = true;
150
+ if (node.status === 'running')
151
+ slot.running = true;
152
+ if (node.kind === 'turn')
153
+ turns.push([node.turn, column]);
154
+ }
155
+ // Empty columns inherit the previous column's seek target, so clicking or
156
+ // scanning across an idle stretch lands on the row that started it rather
157
+ // than on nothing.
158
+ let carry = 0;
159
+ for (const slot of buckets) {
160
+ if (slot.firstIndex === -1)
161
+ slot.firstIndex = carry;
162
+ else
163
+ carry = slot.firstIndex;
164
+ }
165
+ // Log-scale the peak, not the buckets: a session holding one three-minute
166
+ // call next to hundreds of millisecond ones would otherwise render as a
167
+ // single spike over a flat line. The view divides log1p(weight) by
168
+ // log1p(peak), so four orders of magnitude still fit eight glyph levels.
169
+ // Scale between the smallest non-empty column and the 95th percentile
170
+ // rather than the maximum. One three-minute call among hundreds of
171
+ // millisecond ones is a genuine outlier, and letting it own the top of the
172
+ // scale flattens everything else into two glyph levels; clamping the top
173
+ // few columns to a full block keeps the rest of the session readable, which
174
+ // is the same trade every flame graph and latency histogram makes.
175
+ const weights = buckets.map(slot => slot.weight).filter(weight => weight > 0).sort((a, b) => a - b);
176
+ const floor = weights[0] ?? 0;
177
+ const peak = weights.length === 0
178
+ ? 0
179
+ : weights[Math.min(weights.length - 1, Math.floor(weights.length * 0.95))];
180
+ return { buckets, peak, floor, turns };
181
+ }
182
+ /** The dominant channel of a column, or `undefined` for an empty column. */
183
+ export function dominantChannel(bucket) {
184
+ const { input, model, tool } = bucket.channels;
185
+ if (input === 0 && model === 0 && tool === 0)
186
+ return undefined;
187
+ if (tool >= model && tool >= input)
188
+ return 'tool';
189
+ if (model >= input)
190
+ return 'model';
191
+ return 'input';
192
+ }
193
+ /**
194
+ * Map a ledger index back to its column — the inverse used to draw the
195
+ * viewport bracket under the band.
196
+ *
197
+ * @returns Column index, clamped into range; 0 for an empty band.
198
+ */
199
+ export function columnOfIndex(band, ledgerIndex) {
200
+ if (band.buckets.length === 0)
201
+ return 0;
202
+ // Buckets are monotonic in `firstIndex` after the carry pass, so a linear
203
+ // scan from the right finds the owning column in one pass without needing a
204
+ // parallel index array.
205
+ for (let column = band.buckets.length - 1; column >= 0; column--) {
206
+ if (band.buckets[column].firstIndex <= ledgerIndex)
207
+ return column;
208
+ }
209
+ return 0;
210
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Type-only re-exports of the official upstream surface for UI layers.
3
+ *
4
+ * UI modules (screens/, components/, ink/, hooks/, utils/) must never import
5
+ * `@deepseek-ai/*` directly — they import types from here. This keeps the
6
+ * upstream coupling in one tree (src/dsh-adapter/) so an upstream rc bump
7
+ * breaks exactly one module, never the whole UI.
8
+ */
9
+ export type { LlmModelInfo } from '@deepseek-ai/dsh-llm';
10
+ export type { Agent, AgentHandle, AgentStatus, CreateAgentOptions, ModelSelectionRef } from '@deepseek-ai/dsh-agent';
11
+ export type { SessionId, SessionEvent, SessionHeader } from '@deepseek-ai/dsh-session';
12
+ export type { CommandRuntime } from '@deepseek-ai/dsh-commands';
13
+ export type { ApprovalOutcome, ApprovalRequest } from '@deepseek-ai/dsh-user-approval';
14
+ export type { AgentSetup } from '@deepseek-ai/dsh-agent';
15
+ export type { Context } from '@deepseek-ai/cordis';
16
+ export type { InvariantInstaller } from '@deepseek-ai/dsh-invariants';
17
+ /**
18
+ * Trajectory projection types. Not upstream types, but the same rule applies:
19
+ * the scene is pure UI over this shape and never reaches into the projection's
20
+ * own modules (which do import `@deepseek-ai/*`).
21
+ */
22
+ export type { HotspotRow, HotspotSort, TrajAggregate, TrajBurst, TrajKind, TrajNode, TrajStatus, TrajTokens, TrajTotals, WaveBand, WaveBucket, WaveChannel, WaveProjection, } from './trajectory/types.js';
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AACpH,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACtF,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AACtF,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAErE;;;;GAIG;AACH,YAAY,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,cAAc,GACf,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Workspace-ledger integration shared by every TUI session entry path.
3
+ *
4
+ * A Session header's cwd is only a membership prerequisite. Web grouping is
5
+ * owned by the durable WorkspaceRegistry account, so a newly created Session
6
+ * must be attached after `agents.create()` succeeds. Resuming also attaches
7
+ * idempotently, which migrates sessions written by older TUI versions.
8
+ *
9
+ * @module @deepseek-harness-tui/dsh-tui/workspace
10
+ */
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ import type { SessionId } from '@deepseek-ai/dsh-session';
13
+ /**
14
+ * Find or create the Workspace for `cwd`, then durably account `sessionId`.
15
+ *
16
+ * The service is optional for bare/custom compositions. Returning `false`
17
+ * lets those deployments retain their pre-workspace behavior; the shipped
18
+ * profile mounts the same storage/workspace stack as Web and therefore always
19
+ * takes the durable attach path.
20
+ */
21
+ export declare function attachSessionToWorkspace(ctx: Context, cwd: string, sessionId: SessionId): Promise<boolean>;
22
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAGzD;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,OAAO,CAAC,CAOlB"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Find or create the Workspace for `cwd`, then durably account `sessionId`.
3
+ *
4
+ * The service is optional for bare/custom compositions. Returning `false`
5
+ * lets those deployments retain their pre-workspace behavior; the shipped
6
+ * profile mounts the same storage/workspace stack as Web and therefore always
7
+ * takes the durable attach path.
8
+ */
9
+ export async function attachSessionToWorkspace(ctx, cwd, sessionId) {
10
+ const registry = ctx.get('workspaceRegistry');
11
+ if (registry === undefined)
12
+ return false;
13
+ const workspace = await registry.resolveByPath(cwd) ?? await registry.create(cwd);
14
+ await workspace.attachSession(sessionId);
15
+ return true;
16
+ }