@deepseek-harness-tui/dsh-tui 0.5.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 (638) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +235 -0
  3. package/bin/dsh-tui.js +95 -0
  4. package/cordis.patch.yml +218 -0
  5. package/cordis.yml +185 -0
  6. package/lib/invariant.js +28 -0
  7. package/lib/types/activityPrefs.d.ts +29 -0
  8. package/lib/types/activityPrefs.d.ts.map +1 -0
  9. package/lib/types/activityPrefs.js +60 -0
  10. package/lib/types/bootstrap/state.d.ts +13 -0
  11. package/lib/types/bootstrap/state.d.ts.map +1 -0
  12. package/lib/types/bootstrap/state.js +12 -0
  13. package/lib/types/cc/cliHighlight.d.ts +20 -0
  14. package/lib/types/cc/cliHighlight.d.ts.map +1 -0
  15. package/lib/types/cc/cliHighlight.js +53 -0
  16. package/lib/types/cc/figures.d.ts +59 -0
  17. package/lib/types/cc/figures.d.ts.map +1 -0
  18. package/lib/types/cc/figures.js +69 -0
  19. package/lib/types/cc/format.d.ts +26 -0
  20. package/lib/types/cc/format.d.ts.map +1 -0
  21. package/lib/types/cc/format.js +55 -0
  22. package/lib/types/cc/hash.d.ts +25 -0
  23. package/lib/types/cc/hash.d.ts.map +1 -0
  24. package/lib/types/cc/hash.js +41 -0
  25. package/lib/types/cc/hyperlink.d.ts +21 -0
  26. package/lib/types/cc/hyperlink.d.ts.map +1 -0
  27. package/lib/types/cc/hyperlink.js +31 -0
  28. package/lib/types/cc/markdown.d.ts +43 -0
  29. package/lib/types/cc/markdown.d.ts.map +1 -0
  30. package/lib/types/cc/markdown.js +345 -0
  31. package/lib/types/cc/spinnerVerbs.d.ts +3 -0
  32. package/lib/types/cc/spinnerVerbs.d.ts.map +1 -0
  33. package/lib/types/cc/spinnerVerbs.js +190 -0
  34. package/lib/types/cc/terminal.d.ts +15 -0
  35. package/lib/types/cc/terminal.d.ts.map +1 -0
  36. package/lib/types/cc/terminal.js +84 -0
  37. package/lib/types/channel.d.ts +672 -0
  38. package/lib/types/channel.d.ts.map +1 -0
  39. package/lib/types/channel.js +2427 -0
  40. package/lib/types/childStderr.d.ts +63 -0
  41. package/lib/types/childStderr.d.ts.map +1 -0
  42. package/lib/types/childStderr.js +161 -0
  43. package/lib/types/commands.d.ts +55 -0
  44. package/lib/types/commands.d.ts.map +1 -0
  45. package/lib/types/commands.js +101 -0
  46. package/lib/types/components/ActivityLine.d.ts +29 -0
  47. package/lib/types/components/ActivityLine.d.ts.map +1 -0
  48. package/lib/types/components/ActivityLine.js +47 -0
  49. package/lib/types/components/ActivityPicker.d.ts +13 -0
  50. package/lib/types/components/ActivityPicker.d.ts.map +1 -0
  51. package/lib/types/components/ActivityPicker.js +24 -0
  52. package/lib/types/components/CommandSuggestions.d.ts +14 -0
  53. package/lib/types/components/CommandSuggestions.d.ts.map +1 -0
  54. package/lib/types/components/CommandSuggestions.js +33 -0
  55. package/lib/types/components/FileSuggestions.d.ts +12 -0
  56. package/lib/types/components/FileSuggestions.d.ts.map +1 -0
  57. package/lib/types/components/FileSuggestions.js +26 -0
  58. package/lib/types/components/GoalTodoPanel.d.ts +13 -0
  59. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -0
  60. package/lib/types/components/GoalTodoPanel.js +57 -0
  61. package/lib/types/components/HelpMenu.d.ts +12 -0
  62. package/lib/types/components/HelpMenu.d.ts.map +1 -0
  63. package/lib/types/components/HelpMenu.js +12 -0
  64. package/lib/types/components/HistorySearchDialog.d.ts +16 -0
  65. package/lib/types/components/HistorySearchDialog.d.ts.map +1 -0
  66. package/lib/types/components/HistorySearchDialog.js +31 -0
  67. package/lib/types/components/InterruptedByUser.d.ts +7 -0
  68. package/lib/types/components/InterruptedByUser.d.ts.map +1 -0
  69. package/lib/types/components/InterruptedByUser.js +9 -0
  70. package/lib/types/components/LoadedContextPanel.d.ts +20 -0
  71. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -0
  72. package/lib/types/components/LoadedContextPanel.js +30 -0
  73. package/lib/types/components/LogoV2.d.ts +23 -0
  74. package/lib/types/components/LogoV2.d.ts.map +1 -0
  75. package/lib/types/components/LogoV2.js +95 -0
  76. package/lib/types/components/Markdown.d.ts +24 -0
  77. package/lib/types/components/Markdown.d.ts.map +1 -0
  78. package/lib/types/components/Markdown.js +106 -0
  79. package/lib/types/components/MarkdownTable.d.ts +17 -0
  80. package/lib/types/components/MarkdownTable.d.ts.map +1 -0
  81. package/lib/types/components/MarkdownTable.js +272 -0
  82. package/lib/types/components/MessageList.d.ts +41 -0
  83. package/lib/types/components/MessageList.d.ts.map +1 -0
  84. package/lib/types/components/MessageList.js +303 -0
  85. package/lib/types/components/ModelPicker.d.ts +14 -0
  86. package/lib/types/components/ModelPicker.d.ts.map +1 -0
  87. package/lib/types/components/ModelPicker.js +15 -0
  88. package/lib/types/components/PresetPicker.d.ts +17 -0
  89. package/lib/types/components/PresetPicker.d.ts.map +1 -0
  90. package/lib/types/components/PresetPicker.js +25 -0
  91. package/lib/types/components/PromptInput.d.ts +67 -0
  92. package/lib/types/components/PromptInput.d.ts.map +1 -0
  93. package/lib/types/components/PromptInput.js +778 -0
  94. package/lib/types/components/ResumePicker.d.ts +15 -0
  95. package/lib/types/components/ResumePicker.d.ts.map +1 -0
  96. package/lib/types/components/ResumePicker.js +34 -0
  97. package/lib/types/components/RewindPicker.d.ts +14 -0
  98. package/lib/types/components/RewindPicker.d.ts.map +1 -0
  99. package/lib/types/components/RewindPicker.js +23 -0
  100. package/lib/types/components/SearchBox.d.ts +20 -0
  101. package/lib/types/components/SearchBox.d.ts.map +1 -0
  102. package/lib/types/components/SearchBox.js +33 -0
  103. package/lib/types/components/Select.d.ts +22 -0
  104. package/lib/types/components/Select.d.ts.map +1 -0
  105. package/lib/types/components/Select.js +19 -0
  106. package/lib/types/components/Spinner/GlimmerMessage.d.ts +19 -0
  107. package/lib/types/components/Spinner/GlimmerMessage.d.ts.map +1 -0
  108. package/lib/types/components/Spinner/GlimmerMessage.js +78 -0
  109. package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts +31 -0
  110. package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts.map +1 -0
  111. package/lib/types/components/Spinner/SpinnerAnimationRow.js +162 -0
  112. package/lib/types/components/Spinner/SpinnerGlyph.d.ts +16 -0
  113. package/lib/types/components/Spinner/SpinnerGlyph.d.ts.map +1 -0
  114. package/lib/types/components/Spinner/SpinnerGlyph.js +36 -0
  115. package/lib/types/components/Spinner/spinnerMode.d.ts +6 -0
  116. package/lib/types/components/Spinner/spinnerMode.d.ts.map +1 -0
  117. package/lib/types/components/Spinner/spinnerMode.js +1 -0
  118. package/lib/types/components/Spinner/spinnerUtils.d.ts +41 -0
  119. package/lib/types/components/Spinner/spinnerUtils.d.ts.map +1 -0
  120. package/lib/types/components/Spinner/spinnerUtils.js +104 -0
  121. package/lib/types/components/Spinner/useStalledAnimation.d.ts +16 -0
  122. package/lib/types/components/Spinner/useStalledAnimation.d.ts.map +1 -0
  123. package/lib/types/components/Spinner/useStalledAnimation.js +71 -0
  124. package/lib/types/components/StreamingMarkdown.d.ts +12 -0
  125. package/lib/types/components/StreamingMarkdown.d.ts.map +1 -0
  126. package/lib/types/components/StreamingMarkdown.js +39 -0
  127. package/lib/types/components/ThemePicker.d.ts +22 -0
  128. package/lib/types/components/ThemePicker.d.ts.map +1 -0
  129. package/lib/types/components/ThemePicker.js +51 -0
  130. package/lib/types/components/ThinkingToggle.d.ts +17 -0
  131. package/lib/types/components/ThinkingToggle.d.ts.map +1 -0
  132. package/lib/types/components/ThinkingToggle.js +30 -0
  133. package/lib/types/components/ToolUseLoader.d.ts +13 -0
  134. package/lib/types/components/ToolUseLoader.d.ts.map +1 -0
  135. package/lib/types/components/ToolUseLoader.js +17 -0
  136. package/lib/types/components/Whale.d.ts +22 -0
  137. package/lib/types/components/Whale.d.ts.map +1 -0
  138. package/lib/types/components/Whale.js +78 -0
  139. package/lib/types/components/WorkingSpinner.d.ts +26 -0
  140. package/lib/types/components/WorkingSpinner.d.ts.map +1 -0
  141. package/lib/types/components/WorkingSpinner.js +68 -0
  142. package/lib/types/components/activityFrames.d.ts +31 -0
  143. package/lib/types/components/activityFrames.d.ts.map +1 -0
  144. package/lib/types/components/activityFrames.js +83 -0
  145. package/lib/types/components/bigfont.d.ts +28 -0
  146. package/lib/types/components/bigfont.d.ts.map +1 -0
  147. package/lib/types/components/bigfont.js +91 -0
  148. package/lib/types/components/design-system/Byline.d.ts +14 -0
  149. package/lib/types/components/design-system/Byline.d.ts.map +1 -0
  150. package/lib/types/components/design-system/Byline.js +17 -0
  151. package/lib/types/components/design-system/Divider.d.ts +40 -0
  152. package/lib/types/components/design-system/Divider.d.ts.map +1 -0
  153. package/lib/types/components/design-system/Divider.js +24 -0
  154. package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +19 -0
  155. package/lib/types/components/design-system/KeyboardShortcutHint.d.ts.map +1 -0
  156. package/lib/types/components/design-system/KeyboardShortcutHint.js +14 -0
  157. package/lib/types/components/design-system/ListItem.d.ts +36 -0
  158. package/lib/types/components/design-system/ListItem.d.ts.map +1 -0
  159. package/lib/types/components/design-system/ListItem.js +48 -0
  160. package/lib/types/components/design-system/LoadingState.d.ts +19 -0
  161. package/lib/types/components/design-system/LoadingState.d.ts.map +1 -0
  162. package/lib/types/components/design-system/LoadingState.js +22 -0
  163. package/lib/types/components/design-system/Pane.d.ts +17 -0
  164. package/lib/types/components/design-system/Pane.d.ts.map +1 -0
  165. package/lib/types/components/design-system/Pane.js +15 -0
  166. package/lib/types/components/design-system/ProgressBar.d.ts +22 -0
  167. package/lib/types/components/design-system/ProgressBar.d.ts.map +1 -0
  168. package/lib/types/components/design-system/ProgressBar.js +27 -0
  169. package/lib/types/components/design-system/StatusIcon.d.ts +15 -0
  170. package/lib/types/components/design-system/StatusIcon.d.ts.map +1 -0
  171. package/lib/types/components/design-system/StatusIcon.js +20 -0
  172. package/lib/types/components/design-system/ThemeProvider.d.ts +11 -0
  173. package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -0
  174. package/lib/types/components/design-system/ThemeProvider.js +135 -0
  175. package/lib/types/components/design-system/ThemedBox.d.ts +37 -0
  176. package/lib/types/components/design-system/ThemedBox.d.ts.map +1 -0
  177. package/lib/types/components/design-system/ThemedBox.js +26 -0
  178. package/lib/types/components/design-system/ThemedText.d.ts +56 -0
  179. package/lib/types/components/design-system/ThemedText.d.ts.map +1 -0
  180. package/lib/types/components/design-system/ThemedText.js +45 -0
  181. package/lib/types/components/messages/AssistantTextMessage.d.ts +18 -0
  182. package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -0
  183. package/lib/types/components/messages/AssistantTextMessage.js +15 -0
  184. package/lib/types/components/messages/AssistantThinkingMessage.d.ts +23 -0
  185. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -0
  186. package/lib/types/components/messages/AssistantThinkingMessage.js +23 -0
  187. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +23 -0
  188. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -0
  189. package/lib/types/components/messages/AssistantToolUseMessage.js +220 -0
  190. package/lib/types/components/messages/MessageMetadata.d.ts +15 -0
  191. package/lib/types/components/messages/MessageMetadata.d.ts.map +1 -0
  192. package/lib/types/components/messages/MessageMetadata.js +20 -0
  193. package/lib/types/components/messages/UserPromptMessage.d.ts +19 -0
  194. package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -0
  195. package/lib/types/components/messages/UserPromptMessage.js +15 -0
  196. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +39 -0
  197. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -0
  198. package/lib/types/components/questions/AskUserQuestionPanel.js +228 -0
  199. package/lib/types/components/shimmer.d.ts +35 -0
  200. package/lib/types/components/shimmer.d.ts.map +1 -0
  201. package/lib/types/components/shimmer.js +43 -0
  202. package/lib/types/components/whaleFrames.d.ts +25 -0
  203. package/lib/types/components/whaleFrames.d.ts.map +1 -0
  204. package/lib/types/components/whaleFrames.js +419 -0
  205. package/lib/types/customTheme.d.ts +104 -0
  206. package/lib/types/customTheme.d.ts.map +1 -0
  207. package/lib/types/customTheme.js +268 -0
  208. package/lib/types/effortPrefs.d.ts +22 -0
  209. package/lib/types/effortPrefs.d.ts.map +1 -0
  210. package/lib/types/effortPrefs.js +45 -0
  211. package/lib/types/history.d.ts +24 -0
  212. package/lib/types/history.d.ts.map +1 -0
  213. package/lib/types/history.js +75 -0
  214. package/lib/types/hooks/useBlink.d.ts +11 -0
  215. package/lib/types/hooks/useBlink.d.ts.map +1 -0
  216. package/lib/types/hooks/useBlink.js +20 -0
  217. package/lib/types/i18n.d.ts +926 -0
  218. package/lib/types/i18n.d.ts.map +1 -0
  219. package/lib/types/i18n.js +356 -0
  220. package/lib/types/index.d.ts +70 -0
  221. package/lib/types/index.d.ts.map +1 -0
  222. package/lib/types/index.js +31 -0
  223. package/lib/types/ink/Ansi.d.ts +11 -0
  224. package/lib/types/ink/Ansi.d.ts.map +1 -0
  225. package/lib/types/ink/Ansi.js +269 -0
  226. package/lib/types/ink/bidi.d.ts +18 -0
  227. package/lib/types/ink/bidi.d.ts.map +1 -0
  228. package/lib/types/ink/bidi.js +119 -0
  229. package/lib/types/ink/clearTerminal.d.ts +22 -0
  230. package/lib/types/ink/clearTerminal.d.ts.map +1 -0
  231. package/lib/types/ink/clearTerminal.js +72 -0
  232. package/lib/types/ink/colorize.d.ts +33 -0
  233. package/lib/types/ink/colorize.d.ts.map +1 -0
  234. package/lib/types/ink/colorize.js +213 -0
  235. package/lib/types/ink/components/AlternateScreen.d.ts +22 -0
  236. package/lib/types/ink/components/AlternateScreen.d.ts.map +1 -0
  237. package/lib/types/ink/components/AlternateScreen.js +74 -0
  238. package/lib/types/ink/components/App.d.ts +73 -0
  239. package/lib/types/ink/components/App.d.ts.map +1 -0
  240. package/lib/types/ink/components/App.js +597 -0
  241. package/lib/types/ink/components/AppContext.d.ts +15 -0
  242. package/lib/types/ink/components/AppContext.d.ts.map +1 -0
  243. package/lib/types/ink/components/AppContext.js +11 -0
  244. package/lib/types/ink/components/Box.d.ts +49 -0
  245. package/lib/types/ink/components/Box.d.ts.map +1 -0
  246. package/lib/types/ink/components/Box.js +153 -0
  247. package/lib/types/ink/components/Button.d.ts +37 -0
  248. package/lib/types/ink/components/Button.d.ts.map +1 -0
  249. package/lib/types/ink/components/Button.js +166 -0
  250. package/lib/types/ink/components/ClockContext.d.ts +10 -0
  251. package/lib/types/ink/components/ClockContext.d.ts.map +1 -0
  252. package/lib/types/ink/components/ClockContext.js +108 -0
  253. package/lib/types/ink/components/CursorDeclarationContext.d.ts +30 -0
  254. package/lib/types/ink/components/CursorDeclarationContext.d.ts.map +1 -0
  255. package/lib/types/ink/components/CursorDeclarationContext.js +6 -0
  256. package/lib/types/ink/components/ErrorOverview.d.ts +7 -0
  257. package/lib/types/ink/components/ErrorOverview.d.ts.map +1 -0
  258. package/lib/types/ink/components/ErrorOverview.js +49 -0
  259. package/lib/types/ink/components/Link.d.ts +8 -0
  260. package/lib/types/ink/components/Link.d.ts.map +1 -0
  261. package/lib/types/ink/components/Link.js +33 -0
  262. package/lib/types/ink/components/Newline.d.ts +13 -0
  263. package/lib/types/ink/components/Newline.d.ts.map +1 -0
  264. package/lib/types/ink/components/Newline.js +29 -0
  265. package/lib/types/ink/components/NoSelect.d.ts +20 -0
  266. package/lib/types/ink/components/NoSelect.d.ts.map +1 -0
  267. package/lib/types/ink/components/NoSelect.js +56 -0
  268. package/lib/types/ink/components/RawAnsi.d.ts +17 -0
  269. package/lib/types/ink/components/RawAnsi.d.ts.map +1 -0
  270. package/lib/types/ink/components/RawAnsi.js +45 -0
  271. package/lib/types/ink/components/ScrollBox.d.ts +78 -0
  272. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -0
  273. package/lib/types/ink/components/ScrollBox.js +174 -0
  274. package/lib/types/ink/components/Spacer.d.ts +6 -0
  275. package/lib/types/ink/components/Spacer.d.ts.map +1 -0
  276. package/lib/types/ink/components/Spacer.js +19 -0
  277. package/lib/types/ink/components/StdinContext.d.ts +32 -0
  278. package/lib/types/ink/components/StdinContext.d.ts.map +1 -0
  279. package/lib/types/ink/components/StdinContext.js +16 -0
  280. package/lib/types/ink/components/TerminalFocusContext.d.ts +11 -0
  281. package/lib/types/ink/components/TerminalFocusContext.d.ts.map +1 -0
  282. package/lib/types/ink/components/TerminalFocusContext.js +45 -0
  283. package/lib/types/ink/components/TerminalSizeContext.d.ts +6 -0
  284. package/lib/types/ink/components/TerminalSizeContext.d.ts.map +1 -0
  285. package/lib/types/ink/components/TerminalSizeContext.js +3 -0
  286. package/lib/types/ink/components/Text.d.ts +56 -0
  287. package/lib/types/ink/components/Text.d.ts.map +1 -0
  288. package/lib/types/ink/components/Text.js +194 -0
  289. package/lib/types/ink/constants.d.ts +3 -0
  290. package/lib/types/ink/constants.d.ts.map +1 -0
  291. package/lib/types/ink/constants.js +2 -0
  292. package/lib/types/ink/cursor.d.ts +11 -0
  293. package/lib/types/ink/cursor.d.ts.map +1 -0
  294. package/lib/types/ink/cursor.js +1 -0
  295. package/lib/types/ink/devtools.d.ts +7 -0
  296. package/lib/types/ink/devtools.d.ts.map +1 -0
  297. package/lib/types/ink/devtools.js +1 -0
  298. package/lib/types/ink/dom.d.ts +178 -0
  299. package/lib/types/ink/dom.d.ts.map +1 -0
  300. package/lib/types/ink/dom.js +424 -0
  301. package/lib/types/ink/events/click-event.d.ts +32 -0
  302. package/lib/types/ink/events/click-event.d.ts.map +1 -0
  303. package/lib/types/ink/events/click-event.js +36 -0
  304. package/lib/types/ink/events/dispatcher.d.ts +63 -0
  305. package/lib/types/ink/events/dispatcher.d.ts.map +1 -0
  306. package/lib/types/ink/events/dispatcher.js +194 -0
  307. package/lib/types/ink/events/emitter.d.ts +20 -0
  308. package/lib/types/ink/events/emitter.d.ts.map +1 -0
  309. package/lib/types/ink/events/emitter.js +43 -0
  310. package/lib/types/ink/events/event-handlers.d.ts +47 -0
  311. package/lib/types/ink/events/event-handlers.d.ts.map +1 -0
  312. package/lib/types/ink/events/event-handlers.js +30 -0
  313. package/lib/types/ink/events/event.d.ts +19 -0
  314. package/lib/types/ink/events/event.d.ts.map +1 -0
  315. package/lib/types/ink/events/event.js +22 -0
  316. package/lib/types/ink/events/focus-event.d.ts +19 -0
  317. package/lib/types/ink/events/focus-event.d.ts.map +1 -0
  318. package/lib/types/ink/events/focus-event.js +21 -0
  319. package/lib/types/ink/events/input-event.d.ts +53 -0
  320. package/lib/types/ink/events/input-event.d.ts.map +1 -0
  321. package/lib/types/ink/events/input-event.js +180 -0
  322. package/lib/types/ink/events/keyboard-event.d.ts +40 -0
  323. package/lib/types/ink/events/keyboard-event.d.ts.map +1 -0
  324. package/lib/types/ink/events/keyboard-event.js +65 -0
  325. package/lib/types/ink/events/paste-event.d.ts +11 -0
  326. package/lib/types/ink/events/paste-event.d.ts.map +1 -0
  327. package/lib/types/ink/events/paste-event.js +13 -0
  328. package/lib/types/ink/events/resize-event.d.ts +13 -0
  329. package/lib/types/ink/events/resize-event.d.ts.map +1 -0
  330. package/lib/types/ink/events/resize-event.js +16 -0
  331. package/lib/types/ink/events/terminal-event.d.ts +112 -0
  332. package/lib/types/ink/events/terminal-event.d.ts.map +1 -0
  333. package/lib/types/ink/events/terminal-event.js +131 -0
  334. package/lib/types/ink/events/terminal-focus-event.d.ts +21 -0
  335. package/lib/types/ink/events/terminal-focus-event.d.ts.map +1 -0
  336. package/lib/types/ink/events/terminal-focus-event.js +18 -0
  337. package/lib/types/ink/focus.d.ts +74 -0
  338. package/lib/types/ink/focus.d.ts.map +1 -0
  339. package/lib/types/ink/focus.js +188 -0
  340. package/lib/types/ink/frame.d.ts +119 -0
  341. package/lib/types/ink/frame.d.ts.map +1 -0
  342. package/lib/types/ink/frame.js +43 -0
  343. package/lib/types/ink/get-max-width.d.ts +20 -0
  344. package/lib/types/ink/get-max-width.d.ts.map +1 -0
  345. package/lib/types/ink/get-max-width.js +25 -0
  346. package/lib/types/ink/hit-test.d.ts +47 -0
  347. package/lib/types/ink/hit-test.d.ts.map +1 -0
  348. package/lib/types/ink/hit-test.js +126 -0
  349. package/lib/types/ink/hooks/use-animation-frame.d.ts +27 -0
  350. package/lib/types/ink/hooks/use-animation-frame.d.ts.map +1 -0
  351. package/lib/types/ink/hooks/use-animation-frame.js +48 -0
  352. package/lib/types/ink/hooks/use-app.d.ts +8 -0
  353. package/lib/types/ink/hooks/use-app.d.ts.map +1 -0
  354. package/lib/types/ink/hooks/use-app.js +8 -0
  355. package/lib/types/ink/hooks/use-copy-on-select.d.ts +22 -0
  356. package/lib/types/ink/hooks/use-copy-on-select.d.ts.map +1 -0
  357. package/lib/types/ink/hooks/use-copy-on-select.js +40 -0
  358. package/lib/types/ink/hooks/use-declared-cursor.d.ts +31 -0
  359. package/lib/types/ink/hooks/use-declared-cursor.d.ts.map +1 -0
  360. package/lib/types/ink/hooks/use-declared-cursor.js +65 -0
  361. package/lib/types/ink/hooks/use-input.d.ts +41 -0
  362. package/lib/types/ink/hooks/use-input.d.ts.map +1 -0
  363. package/lib/types/ink/hooks/use-input.js +73 -0
  364. package/lib/types/ink/hooks/use-interval.d.ts +23 -0
  365. package/lib/types/ink/hooks/use-interval.d.ts.map +1 -0
  366. package/lib/types/ink/hooks/use-interval.js +58 -0
  367. package/lib/types/ink/hooks/use-search-highlight.d.ts +34 -0
  368. package/lib/types/ink/hooks/use-search-highlight.d.ts.map +1 -0
  369. package/lib/types/ink/hooks/use-search-highlight.js +35 -0
  370. package/lib/types/ink/hooks/use-selection.d.ts +44 -0
  371. package/lib/types/ink/hooks/use-selection.d.ts.map +1 -0
  372. package/lib/types/ink/hooks/use-selection.js +64 -0
  373. package/lib/types/ink/hooks/use-stdin.d.ts +8 -0
  374. package/lib/types/ink/hooks/use-stdin.d.ts.map +1 -0
  375. package/lib/types/ink/hooks/use-stdin.js +8 -0
  376. package/lib/types/ink/hooks/use-tab-status.d.ts +18 -0
  377. package/lib/types/ink/hooks/use-tab-status.d.ts.map +1 -0
  378. package/lib/types/ink/hooks/use-tab-status.js +58 -0
  379. package/lib/types/ink/hooks/use-terminal-focus.d.ts +11 -0
  380. package/lib/types/ink/hooks/use-terminal-focus.d.ts.map +1 -0
  381. package/lib/types/ink/hooks/use-terminal-focus.js +15 -0
  382. package/lib/types/ink/hooks/use-terminal-size.d.ts +6 -0
  383. package/lib/types/ink/hooks/use-terminal-size.d.ts.map +1 -0
  384. package/lib/types/ink/hooks/use-terminal-size.js +12 -0
  385. package/lib/types/ink/hooks/use-terminal-title.d.ts +14 -0
  386. package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -0
  387. package/lib/types/ink/hooks/use-terminal-title.js +30 -0
  388. package/lib/types/ink/hooks/use-terminal-viewport.d.ts +32 -0
  389. package/lib/types/ink/hooks/use-terminal-viewport.d.ts.map +1 -0
  390. package/lib/types/ink/hooks/use-terminal-viewport.js +79 -0
  391. package/lib/types/ink/ink.d.ts +370 -0
  392. package/lib/types/ink/ink.d.ts.map +1 -0
  393. package/lib/types/ink/ink.js +1665 -0
  394. package/lib/types/ink/instances.d.ts +10 -0
  395. package/lib/types/ink/instances.d.ts.map +1 -0
  396. package/lib/types/ink/instances.js +13 -0
  397. package/lib/types/ink/layout/engine.d.ts +7 -0
  398. package/lib/types/ink/layout/engine.d.ts.map +1 -0
  399. package/lib/types/ink/layout/engine.js +8 -0
  400. package/lib/types/ink/layout/geometry.d.ts +86 -0
  401. package/lib/types/ink/layout/geometry.d.ts.map +1 -0
  402. package/lib/types/ink/layout/geometry.js +95 -0
  403. package/lib/types/ink/layout/node.d.ts +151 -0
  404. package/lib/types/ink/layout/node.d.ts.map +1 -0
  405. package/lib/types/ink/layout/node.js +72 -0
  406. package/lib/types/ink/layout/yoga.d.ts +69 -0
  407. package/lib/types/ink/layout/yoga.d.ts.map +1 -0
  408. package/lib/types/ink/layout/yoga.js +249 -0
  409. package/lib/types/ink/line-width-cache.d.ts +9 -0
  410. package/lib/types/ink/line-width-cache.d.ts.map +1 -0
  411. package/lib/types/ink/line-width-cache.js +45 -0
  412. package/lib/types/ink/log-update.d.ts +57 -0
  413. package/lib/types/ink/log-update.d.ts.map +1 -0
  414. package/lib/types/ink/log-update.js +710 -0
  415. package/lib/types/ink/measure-element.d.ts +19 -0
  416. package/lib/types/ink/measure-element.d.ts.map +1 -0
  417. package/lib/types/ink/measure-element.js +10 -0
  418. package/lib/types/ink/measure-text.d.ts +13 -0
  419. package/lib/types/ink/measure-text.d.ts.map +1 -0
  420. package/lib/types/ink/measure-text.js +38 -0
  421. package/lib/types/ink/node-cache.d.ts +33 -0
  422. package/lib/types/ink/node-cache.d.ts.map +1 -0
  423. package/lib/types/ink/node-cache.js +42 -0
  424. package/lib/types/ink/optimizer.d.ts +18 -0
  425. package/lib/types/ink/optimizer.d.ts.map +1 -0
  426. package/lib/types/ink/optimizer.js +83 -0
  427. package/lib/types/ink/output.d.ts +200 -0
  428. package/lib/types/ink/output.d.ts.map +1 -0
  429. package/lib/types/ink/output.js +663 -0
  430. package/lib/types/ink/parse-keypress.d.ts +132 -0
  431. package/lib/types/ink/parse-keypress.d.ts.map +1 -0
  432. package/lib/types/ink/parse-keypress.js +707 -0
  433. package/lib/types/ink/reconciler.d.ts +43 -0
  434. package/lib/types/ink/reconciler.d.ts.map +1 -0
  435. package/lib/types/ink/reconciler.js +413 -0
  436. package/lib/types/ink/render-border.d.ts +36 -0
  437. package/lib/types/ink/render-border.d.ts.map +1 -0
  438. package/lib/types/ink/render-border.js +143 -0
  439. package/lib/types/ink/render-node-to-output.d.ts +93 -0
  440. package/lib/types/ink/render-node-to-output.d.ts.map +1 -0
  441. package/lib/types/ink/render-node-to-output.js +1290 -0
  442. package/lib/types/ink/render-to-screen.d.ts +65 -0
  443. package/lib/types/ink/render-to-screen.d.ts.map +1 -0
  444. package/lib/types/ink/render-to-screen.js +189 -0
  445. package/lib/types/ink/renderer.d.ts +24 -0
  446. package/lib/types/ink/renderer.d.ts.map +1 -0
  447. package/lib/types/ink/renderer.js +136 -0
  448. package/lib/types/ink/root.d.ts +91 -0
  449. package/lib/types/ink/root.d.ts.map +1 -0
  450. package/lib/types/ink/root.js +93 -0
  451. package/lib/types/ink/screen.d.ts +443 -0
  452. package/lib/types/ink/screen.d.ts.map +1 -0
  453. package/lib/types/ink/screen.js +1295 -0
  454. package/lib/types/ink/searchHighlight.d.ts +25 -0
  455. package/lib/types/ink/searchHighlight.d.ts.map +1 -0
  456. package/lib/types/ink/searchHighlight.js +82 -0
  457. package/lib/types/ink/selection.d.ts +323 -0
  458. package/lib/types/ink/selection.d.ts.map +1 -0
  459. package/lib/types/ink/selection.js +881 -0
  460. package/lib/types/ink/squash-text-nodes.d.ts +30 -0
  461. package/lib/types/ink/squash-text-nodes.d.ts.map +1 -0
  462. package/lib/types/ink/squash-text-nodes.js +63 -0
  463. package/lib/types/ink/stringWidth.d.ts +11 -0
  464. package/lib/types/ink/stringWidth.d.ts.map +1 -0
  465. package/lib/types/ink/stringWidth.js +209 -0
  466. package/lib/types/ink/styles.d.ts +324 -0
  467. package/lib/types/ink/styles.d.ts.map +1 -0
  468. package/lib/types/ink/styles.js +307 -0
  469. package/lib/types/ink/supports-hyperlinks.d.ts +20 -0
  470. package/lib/types/ink/supports-hyperlinks.d.ts.map +1 -0
  471. package/lib/types/ink/supports-hyperlinks.js +44 -0
  472. package/lib/types/ink/tabstops.d.ts +9 -0
  473. package/lib/types/ink/tabstops.d.ts.map +1 -0
  474. package/lib/types/ink/tabstops.js +46 -0
  475. package/lib/types/ink/terminal-focus-state.d.ts +35 -0
  476. package/lib/types/ink/terminal-focus-state.d.ts.map +1 -0
  477. package/lib/types/ink/terminal-focus-state.js +57 -0
  478. package/lib/types/ink/terminal-querier.d.ts +161 -0
  479. package/lib/types/ink/terminal-querier.d.ts.map +1 -0
  480. package/lib/types/ink/terminal-querier.js +204 -0
  481. package/lib/types/ink/terminal.d.ts +80 -0
  482. package/lib/types/ink/terminal.d.ts.map +1 -0
  483. package/lib/types/ink/terminal.js +268 -0
  484. package/lib/types/ink/termio/ansi.d.ts +75 -0
  485. package/lib/types/ink/termio/ansi.d.ts.map +1 -0
  486. package/lib/types/ink/termio/ansi.js +79 -0
  487. package/lib/types/ink/termio/csi.d.ts +253 -0
  488. package/lib/types/ink/termio/csi.d.ts.map +1 -0
  489. package/lib/types/ink/termio/csi.js +347 -0
  490. package/lib/types/ink/termio/dec.d.ts +61 -0
  491. package/lib/types/ink/termio/dec.d.ts.map +1 -0
  492. package/lib/types/ink/termio/dec.js +76 -0
  493. package/lib/types/ink/termio/esc.d.ts +15 -0
  494. package/lib/types/ink/termio/esc.d.ts.map +1 -0
  495. package/lib/types/ink/termio/esc.js +57 -0
  496. package/lib/types/ink/termio/osc.d.ts +208 -0
  497. package/lib/types/ink/termio/osc.d.ts.map +1 -0
  498. package/lib/types/ink/termio/osc.js +466 -0
  499. package/lib/types/ink/termio/parser.d.ts +46 -0
  500. package/lib/types/ink/termio/parser.d.ts.map +1 -0
  501. package/lib/types/ink/termio/parser.js +366 -0
  502. package/lib/types/ink/termio/sgr.d.ts +17 -0
  503. package/lib/types/ink/termio/sgr.d.ts.map +1 -0
  504. package/lib/types/ink/termio/sgr.js +300 -0
  505. package/lib/types/ink/termio/tokenize.d.ts +50 -0
  506. package/lib/types/ink/termio/tokenize.d.ts.map +1 -0
  507. package/lib/types/ink/termio/tokenize.js +266 -0
  508. package/lib/types/ink/termio/types.d.ts +211 -0
  509. package/lib/types/ink/termio/types.d.ts.map +1 -0
  510. package/lib/types/ink/termio/types.js +68 -0
  511. package/lib/types/ink/termio.d.ts +25 -0
  512. package/lib/types/ink/termio.d.ts.map +1 -0
  513. package/lib/types/ink/termio.js +24 -0
  514. package/lib/types/ink/truncateToWidth.d.ts +7 -0
  515. package/lib/types/ink/truncateToWidth.d.ts.map +1 -0
  516. package/lib/types/ink/truncateToWidth.js +18 -0
  517. package/lib/types/ink/useTerminalNotification.d.ts +45 -0
  518. package/lib/types/ink/useTerminalNotification.d.ts.map +1 -0
  519. package/lib/types/ink/useTerminalNotification.js +70 -0
  520. package/lib/types/ink/warn.d.ts +7 -0
  521. package/lib/types/ink/warn.d.ts.map +1 -0
  522. package/lib/types/ink/warn.js +15 -0
  523. package/lib/types/ink/widest-line.d.ts +7 -0
  524. package/lib/types/ink/widest-line.d.ts.map +1 -0
  525. package/lib/types/ink/widest-line.js +19 -0
  526. package/lib/types/ink/wrap-text.d.ts +10 -0
  527. package/lib/types/ink/wrap-text.d.ts.map +1 -0
  528. package/lib/types/ink/wrap-text.js +61 -0
  529. package/lib/types/ink/wrapAnsi.d.ts +18 -0
  530. package/lib/types/ink/wrapAnsi.d.ts.map +1 -0
  531. package/lib/types/ink/wrapAnsi.js +16 -0
  532. package/lib/types/invariant.d.ts +20 -0
  533. package/lib/types/invariant.d.ts.map +1 -0
  534. package/lib/types/invariant.js +26 -0
  535. package/lib/types/modelPrefs.d.ts +37 -0
  536. package/lib/types/modelPrefs.d.ts.map +1 -0
  537. package/lib/types/modelPrefs.js +66 -0
  538. package/lib/types/modelRoute.d.ts +79 -0
  539. package/lib/types/modelRoute.d.ts.map +1 -0
  540. package/lib/types/modelRoute.js +96 -0
  541. package/lib/types/native-ts/yoga-layout/enums.d.ts +183 -0
  542. package/lib/types/native-ts/yoga-layout/enums.d.ts.map +1 -0
  543. package/lib/types/native-ts/yoga-layout/enums.js +150 -0
  544. package/lib/types/native-ts/yoga-layout/index.d.ts +788 -0
  545. package/lib/types/native-ts/yoga-layout/index.d.ts.map +1 -0
  546. package/lib/types/native-ts/yoga-layout/index.js +2571 -0
  547. package/lib/types/packaged-skills.d.ts +10 -0
  548. package/lib/types/packaged-skills.d.ts.map +1 -0
  549. package/lib/types/packaged-skills.js +63 -0
  550. package/lib/types/plugin.d.ts +33 -0
  551. package/lib/types/plugin.d.ts.map +1 -0
  552. package/lib/types/plugin.js +454 -0
  553. package/lib/types/presetPrefs.d.ts +29 -0
  554. package/lib/types/presetPrefs.d.ts.map +1 -0
  555. package/lib/types/presetPrefs.js +61 -0
  556. package/lib/types/presets.d.ts +110 -0
  557. package/lib/types/presets.d.ts.map +1 -0
  558. package/lib/types/presets.js +114 -0
  559. package/lib/types/questions.d.ts +97 -0
  560. package/lib/types/questions.d.ts.map +1 -0
  561. package/lib/types/questions.js +201 -0
  562. package/lib/types/screens/Chat.d.ts +23 -0
  563. package/lib/types/screens/Chat.d.ts.map +1 -0
  564. package/lib/types/screens/Chat.js +1263 -0
  565. package/lib/types/screens/StatusLine.d.ts +16 -0
  566. package/lib/types/screens/StatusLine.d.ts.map +1 -0
  567. package/lib/types/screens/StatusLine.js +105 -0
  568. package/lib/types/screens/StatusMetrics.d.ts +87 -0
  569. package/lib/types/screens/StatusMetrics.d.ts.map +1 -0
  570. package/lib/types/screens/StatusMetrics.js +252 -0
  571. package/lib/types/sessionHistory.d.ts +32 -0
  572. package/lib/types/sessionHistory.d.ts.map +1 -0
  573. package/lib/types/sessionHistory.js +87 -0
  574. package/lib/types/theme.d.ts +115 -0
  575. package/lib/types/theme.d.ts.map +1 -0
  576. package/lib/types/theme.js +300 -0
  577. package/lib/types/themePrefs.d.ts +28 -0
  578. package/lib/types/themePrefs.d.ts.map +1 -0
  579. package/lib/types/themePrefs.js +59 -0
  580. package/lib/types/ui.d.ts +28 -0
  581. package/lib/types/ui.d.ts.map +1 -0
  582. package/lib/types/ui.js +25 -0
  583. package/lib/types/update.d.ts +76 -0
  584. package/lib/types/update.d.ts.map +1 -0
  585. package/lib/types/update.js +203 -0
  586. package/lib/types/utils/clipboard.d.ts +43 -0
  587. package/lib/types/utils/clipboard.d.ts.map +1 -0
  588. package/lib/types/utils/clipboard.js +82 -0
  589. package/lib/types/utils/debug.d.ts +8 -0
  590. package/lib/types/utils/debug.d.ts.map +1 -0
  591. package/lib/types/utils/debug.js +12 -0
  592. package/lib/types/utils/earlyInput.d.ts +7 -0
  593. package/lib/types/utils/earlyInput.d.ts.map +1 -0
  594. package/lib/types/utils/earlyInput.js +6 -0
  595. package/lib/types/utils/env.d.ts +10 -0
  596. package/lib/types/utils/env.d.ts.map +1 -0
  597. package/lib/types/utils/env.js +9 -0
  598. package/lib/types/utils/envUtils.d.ts +8 -0
  599. package/lib/types/utils/envUtils.d.ts.map +1 -0
  600. package/lib/types/utils/envUtils.js +13 -0
  601. package/lib/types/utils/execFileNoThrow.d.ts +34 -0
  602. package/lib/types/utils/execFileNoThrow.d.ts.map +1 -0
  603. package/lib/types/utils/execFileNoThrow.js +31 -0
  604. package/lib/types/utils/fullscreen.d.ts +8 -0
  605. package/lib/types/utils/fullscreen.d.ts.map +1 -0
  606. package/lib/types/utils/fullscreen.js +10 -0
  607. package/lib/types/utils/intl.d.ts +7 -0
  608. package/lib/types/utils/intl.d.ts.map +1 -0
  609. package/lib/types/utils/intl.js +9 -0
  610. package/lib/types/utils/loaded-context.d.ts +20 -0
  611. package/lib/types/utils/loaded-context.d.ts.map +1 -0
  612. package/lib/types/utils/loaded-context.js +36 -0
  613. package/lib/types/utils/log.d.ts +7 -0
  614. package/lib/types/utils/log.d.ts.map +1 -0
  615. package/lib/types/utils/log.js +9 -0
  616. package/lib/types/utils/mentions.d.ts +30 -0
  617. package/lib/types/utils/mentions.d.ts.map +1 -0
  618. package/lib/types/utils/mentions.js +72 -0
  619. package/lib/types/utils/narration.d.ts +11 -0
  620. package/lib/types/utils/narration.d.ts.map +1 -0
  621. package/lib/types/utils/narration.js +16 -0
  622. package/lib/types/utils/semver.d.ts +9 -0
  623. package/lib/types/utils/semver.d.ts.map +1 -0
  624. package/lib/types/utils/semver.js +24 -0
  625. package/lib/types/utils/sliceAnsi.d.ts +12 -0
  626. package/lib/types/utils/sliceAnsi.d.ts.map +1 -0
  627. package/lib/types/utils/sliceAnsi.js +79 -0
  628. package/lib/types/working-activity.d.ts +19 -0
  629. package/lib/types/working-activity.d.ts.map +1 -0
  630. package/lib/types/working-activity.js +18 -0
  631. package/package.json +141 -0
  632. package/skills/audit/SKILL.md +24 -0
  633. package/skills/bug/SKILL.md +27 -0
  634. package/skills/pr-comments/SKILL.md +20 -0
  635. package/skills/practice/SKILL.md +22 -0
  636. package/skills/release-notes/SKILL.md +25 -0
  637. package/skills/review/SKILL.md +25 -0
  638. package/skills/vuln-check/SKILL.md +25 -0
@@ -0,0 +1,272 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import wrapAnsi from 'wrap-ansi';
3
+ import { useTerminalSize } from '../ink/hooks/use-terminal-size.js';
4
+ import Text from '../ink/components/Text.js';
5
+ import { stringWidth } from '../ink/stringWidth.js';
6
+ import stripAnsi from 'strip-ansi';
7
+ import { formatToken, padAligned } from '../cc/markdown.js';
8
+ /** Accounts for parent indentation and terminal resize races (from the leak). */
9
+ const SAFETY_MARGIN = 4;
10
+ /** Minimum column width to prevent degenerate layouts */
11
+ const MIN_COLUMN_WIDTH = 3;
12
+ /**
13
+ * Maximum number of lines per row before switching to vertical format.
14
+ */
15
+ const MAX_ROW_LINES = 4;
16
+ /** ANSI escape codes for text formatting */
17
+ const ANSI_BOLD_START = '\x1b[1m';
18
+ const ANSI_BOLD_END = '\x1b[22m';
19
+ /**
20
+ * Wrap text to fit within a given width, returning array of lines.
21
+ * ANSI-aware: preserves styling across line breaks.
22
+ *
23
+ * @param hard - If true, break words that exceed width. Default false.
24
+ */
25
+ function wrapText(text, width, options) {
26
+ if (width <= 0)
27
+ return [text];
28
+ // Strip trailing whitespace/newlines before wrapping.
29
+ const trimmedText = text.trimEnd();
30
+ const wrapped = wrapAnsi(trimmedText, width, {
31
+ hard: options?.hard ?? false,
32
+ trim: false,
33
+ wordWrap: true,
34
+ });
35
+ // Filter out empty lines that result from trailing newlines.
36
+ const lines = wrapped.split('\n').filter(line => line.length > 0);
37
+ // Ensure we always return at least one line (empty string for empty cells)
38
+ return lines.length > 0 ? lines : [''];
39
+ }
40
+ /**
41
+ * Renders a markdown table with proper column sizing, cell wrapping and box
42
+ * borders (ported from the leak's `MarkdownTable.tsx`). Falls back to a
43
+ * vertical key-value format on narrow terminals.
44
+ */
45
+ export function MarkdownTable({ token, highlight, forceWidth, }) {
46
+ const { columns: actualTerminalWidth } = useTerminalSize();
47
+ const terminalWidth = forceWidth ?? actualTerminalWidth;
48
+ // Format cell content to ANSI string
49
+ function formatCell(tokens) {
50
+ return (tokens
51
+ ?.map(_ => formatToken(_, 0, null, null, highlight))
52
+ .join('') ?? '');
53
+ }
54
+ // Get plain text (stripped of ANSI codes)
55
+ function getPlainText(tokens) {
56
+ return stripAnsi(formatCell(tokens));
57
+ }
58
+ // Get the longest word width in a cell (minimum width to avoid breaking words)
59
+ function getMinWidth(tokens) {
60
+ const text = getPlainText(tokens);
61
+ const words = text.split(/\s+/).filter(w => w.length > 0);
62
+ if (words.length === 0)
63
+ return MIN_COLUMN_WIDTH;
64
+ return Math.max(...words.map(w => stringWidth(w)), MIN_COLUMN_WIDTH);
65
+ }
66
+ // Get ideal width (full content without wrapping)
67
+ function getIdealWidth(tokens) {
68
+ return Math.max(stringWidth(getPlainText(tokens)), MIN_COLUMN_WIDTH);
69
+ }
70
+ // Calculate column widths
71
+ // Step 1: Get minimum (longest word) and ideal (full content) widths
72
+ const minWidths = token.header.map((header, colIndex) => {
73
+ let maxMinWidth = getMinWidth(header.tokens);
74
+ for (const row of token.rows) {
75
+ maxMinWidth = Math.max(maxMinWidth, getMinWidth(row[colIndex]?.tokens));
76
+ }
77
+ return maxMinWidth;
78
+ });
79
+ const idealWidths = token.header.map((header, colIndex) => {
80
+ let maxIdeal = getIdealWidth(header.tokens);
81
+ for (const row of token.rows) {
82
+ maxIdeal = Math.max(maxIdeal, getIdealWidth(row[colIndex]?.tokens));
83
+ }
84
+ return maxIdeal;
85
+ });
86
+ // Step 2: Calculate available space
87
+ // Border overhead: │ content │ content │ = 1 + (width + 3) per column
88
+ const numCols = token.header.length;
89
+ const borderOverhead = 1 + numCols * 3; // │ + (2 padding + 1 border) per col
90
+ // Account for SAFETY_MARGIN to avoid triggering the fallback safety check
91
+ const availableWidth = Math.max(terminalWidth - borderOverhead - SAFETY_MARGIN, numCols * MIN_COLUMN_WIDTH);
92
+ // Step 3: Calculate column widths that fit available space
93
+ const totalMin = minWidths.reduce((sum, w) => sum + w, 0);
94
+ const totalIdeal = idealWidths.reduce((sum, w) => sum + w, 0);
95
+ // Track whether columns are narrower than longest words (needs hard wrap)
96
+ let needsHardWrap = false;
97
+ let columnWidths;
98
+ if (totalIdeal <= availableWidth) {
99
+ // Everything fits - use ideal widths
100
+ columnWidths = idealWidths;
101
+ }
102
+ else if (totalMin <= availableWidth) {
103
+ // Need to shrink - give each column its min, distribute remaining space
104
+ const extraSpace = availableWidth - totalMin;
105
+ const overflows = idealWidths.map((ideal, i) => ideal - minWidths[i]);
106
+ const totalOverflow = overflows.reduce((sum, o) => sum + o, 0);
107
+ columnWidths = minWidths.map((min, i) => {
108
+ if (totalOverflow === 0)
109
+ return min;
110
+ const extra = Math.floor((overflows[i] / totalOverflow) * extraSpace);
111
+ return min + extra;
112
+ });
113
+ }
114
+ else {
115
+ // Table wider than terminal at minimum widths
116
+ // Shrink columns proportionally to fit, allowing word breaks
117
+ needsHardWrap = true;
118
+ const scaleFactor = availableWidth / totalMin;
119
+ columnWidths = minWidths.map(w => Math.max(Math.floor(w * scaleFactor), MIN_COLUMN_WIDTH));
120
+ }
121
+ // Step 4: Calculate max row lines to determine if vertical format is needed
122
+ function calculateMaxRowLines() {
123
+ let maxLines = 1;
124
+ // Check header
125
+ for (let i = 0; i < token.header.length; i++) {
126
+ const content = formatCell(token.header[i].tokens);
127
+ const wrapped = wrapText(content, columnWidths[i], {
128
+ hard: needsHardWrap,
129
+ });
130
+ maxLines = Math.max(maxLines, wrapped.length);
131
+ }
132
+ // Check rows
133
+ for (const row of token.rows) {
134
+ for (let i = 0; i < row.length; i++) {
135
+ const content = formatCell(row[i]?.tokens);
136
+ const wrapped = wrapText(content, columnWidths[i], {
137
+ hard: needsHardWrap,
138
+ });
139
+ maxLines = Math.max(maxLines, wrapped.length);
140
+ }
141
+ }
142
+ return maxLines;
143
+ }
144
+ // Use vertical format if wrapping would make rows too tall
145
+ const maxRowLines = calculateMaxRowLines();
146
+ const useVerticalFormat = maxRowLines > MAX_ROW_LINES;
147
+ // Render a single row with potential multi-line cells
148
+ // Returns an array of strings, one per line of the row
149
+ function renderRowLines(cells, isHeader) {
150
+ // Get wrapped lines for each cell (preserving ANSI formatting)
151
+ const cellLines = cells.map((cell, colIndex) => {
152
+ const formattedText = formatCell(cell.tokens);
153
+ const width = columnWidths[colIndex];
154
+ return wrapText(formattedText, width, { hard: needsHardWrap });
155
+ });
156
+ // Find max number of lines in this row
157
+ const maxLines = Math.max(...cellLines.map(lines => lines.length), 1);
158
+ // Calculate vertical offset for each cell (to center vertically)
159
+ const verticalOffsets = cellLines.map(lines => Math.floor((maxLines - lines.length) / 2));
160
+ // Build each line of the row as a single string
161
+ const result = [];
162
+ for (let lineIdx = 0; lineIdx < maxLines; lineIdx++) {
163
+ let line = '│';
164
+ for (let colIndex = 0; colIndex < cells.length; colIndex++) {
165
+ const lines = cellLines[colIndex];
166
+ const offset = verticalOffsets[colIndex];
167
+ const contentLineIdx = lineIdx - offset;
168
+ const lineText = contentLineIdx >= 0 && contentLineIdx < lines.length
169
+ ? lines[contentLineIdx]
170
+ : '';
171
+ const width = columnWidths[colIndex];
172
+ // Headers always centered; data uses table alignment
173
+ const align = isHeader ? 'center' : (token.align?.[colIndex] ?? 'left');
174
+ line +=
175
+ ' ' + padAligned(lineText, stringWidth(lineText), width, align) + ' │';
176
+ }
177
+ result.push(line);
178
+ }
179
+ return result;
180
+ }
181
+ // Render horizontal border as a single string
182
+ function renderBorderLine(type) {
183
+ const [left, mid, cross, right] = {
184
+ top: ['┌', '─', '┬', '┐'],
185
+ middle: ['├', '─', '┼', '┤'],
186
+ bottom: ['└', '─', '┴', '┘'],
187
+ }[type];
188
+ let line = left;
189
+ columnWidths.forEach((width, colIndex) => {
190
+ line += mid.repeat(width + 2);
191
+ line += colIndex < columnWidths.length - 1 ? cross : right;
192
+ });
193
+ return line;
194
+ }
195
+ // Render vertical format (key-value pairs) for extra-narrow terminals
196
+ function renderVerticalFormat() {
197
+ const lines = [];
198
+ const headers = token.header.map(h => getPlainText(h.tokens));
199
+ const separatorWidth = Math.min(terminalWidth - 1, 40);
200
+ const separator = '─'.repeat(separatorWidth);
201
+ // Small indent for wrapped lines (just 2 spaces)
202
+ const wrapIndent = ' ';
203
+ token.rows.forEach((row, rowIndex) => {
204
+ if (rowIndex > 0) {
205
+ lines.push(separator);
206
+ }
207
+ row.forEach((cell, colIndex) => {
208
+ const label = headers[colIndex] || `Column ${colIndex + 1}`;
209
+ // Clean value: trim, remove extra internal whitespace/newlines
210
+ const rawValue = formatCell(cell.tokens).trimEnd();
211
+ const value = rawValue.replace(/\n+/g, ' ').replace(/\s+/g, ' ').trim();
212
+ // Wrap value to fit terminal, accounting for label on first line
213
+ const firstLineWidth = terminalWidth - stringWidth(label) - 3;
214
+ const subsequentLineWidth = terminalWidth - wrapIndent.length - 1;
215
+ // Two-pass wrap: first line is narrower (label takes space),
216
+ // continuation lines get the full width minus indent.
217
+ const firstPassLines = wrapText(value, Math.max(firstLineWidth, 10));
218
+ const firstLine = firstPassLines[0] || '';
219
+ let wrappedValue;
220
+ if (firstPassLines.length <= 1 ||
221
+ subsequentLineWidth <= firstLineWidth) {
222
+ wrappedValue = firstPassLines;
223
+ }
224
+ else {
225
+ // Re-join remaining text and re-wrap to the wider continuation width
226
+ const remainingText = firstPassLines
227
+ .slice(1)
228
+ .map(l => l.trim())
229
+ .join(' ');
230
+ const rewrapped = wrapText(remainingText, subsequentLineWidth);
231
+ wrappedValue = [firstLine, ...rewrapped];
232
+ }
233
+ // First line: bold label + value
234
+ lines.push(`${ANSI_BOLD_START}${label}:${ANSI_BOLD_END} ${wrappedValue[0] || ''}`);
235
+ // Subsequent lines with small indent (skip empty lines)
236
+ for (let i = 1; i < wrappedValue.length; i++) {
237
+ const line = wrappedValue[i];
238
+ if (!line.trim())
239
+ continue;
240
+ lines.push(`${wrapIndent}${line}`);
241
+ }
242
+ });
243
+ });
244
+ return lines.join('\n');
245
+ }
246
+ // Choose format based on available width
247
+ if (useVerticalFormat) {
248
+ return _jsx(Text, { children: renderVerticalFormat() });
249
+ }
250
+ // Build the complete horizontal table as an array of strings
251
+ const tableLines = [];
252
+ tableLines.push(renderBorderLine('top'));
253
+ tableLines.push(...renderRowLines(token.header, true));
254
+ tableLines.push(renderBorderLine('middle'));
255
+ token.rows.forEach((row, rowIndex) => {
256
+ tableLines.push(...renderRowLines(row, false));
257
+ if (rowIndex < token.rows.length - 1) {
258
+ tableLines.push(renderBorderLine('middle'));
259
+ }
260
+ });
261
+ tableLines.push(renderBorderLine('bottom'));
262
+ // Safety check: verify no line exceeds terminal width.
263
+ const maxLineWidth = Math.max(...tableLines.map(line => stringWidth(stripAnsi(line))));
264
+ // If we're within SAFETY_MARGIN characters of the edge, use vertical format
265
+ // to account for terminal resize race conditions.
266
+ if (maxLineWidth > terminalWidth - SAFETY_MARGIN) {
267
+ return _jsx(Text, { children: renderVerticalFormat() });
268
+ }
269
+ // Render as a single Text block to prevent Ink from wrapping mid-row.
270
+ // Raw Text (not Ansi) so the fork's span parser doesn't drop SGR 1 bold.
271
+ return _jsx(Text, { children: tableLines.join('\n') });
272
+ }
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { type ScrollBoxHandle } from '../ui.js';
3
+ import type { ChatRow } from '../channel.js';
4
+ import type { DOMElement } from '../ink/dom.js';
5
+ export declare function MessageList({ rows, expanded, expandedRows, selectedId, onToggleRow, model, showAll, onToggleAll, onLoadOlder, thinkingVisible, registerRowRef, scrollHandle, forceMountRowId, newSinceRowId, onUnseenCount, }: {
6
+ rows: readonly ChatRow[];
7
+ expanded: boolean;
8
+ expandedRows: ReadonlySet<number>;
9
+ selectedId: number | null;
10
+ onToggleRow: (rowId: number) => void;
11
+ model: string;
12
+ showAll: boolean;
13
+ onToggleAll: () => void;
14
+ /** Restore folded-away older rows from the session log (CC-style "load
15
+ * earlier messages" affordance; shown only when rows were folded). */
16
+ onLoadOlder?: () => void;
17
+ thinkingVisible?: boolean;
18
+ /** Transcript search: register each row's DOM element for scroll-to-match. */
19
+ registerRowRef?: (rowId: number, el: DOMElement | null) => void;
20
+ /** Scroll viewport the list virtualizes against. */
21
+ scrollHandle?: ScrollBoxHandle | null;
22
+ /** Row that must be mounted this pass (seek target for scrollToElement). */
23
+ forceMountRowId?: number | null;
24
+ /** "Seen up to" anchor for the new-messages pill: rows with id greater
25
+ * than this are new. Null when pinned to the bottom (nothing unseen). */
26
+ newSinceRowId?: number | null;
27
+ /** Reports how many new rows still sit below the viewport bottom edge. */
28
+ onUnseenCount?: (count: number) => void;
29
+ }): React.JSX.Element;
30
+ /**
31
+ * The header block pinned above the transcript: the DeepSeek pixel whale
32
+ * with the wordmark, tagline, model/effort and cwd (`LogoV2`), plus the
33
+ * welcome line. It scrolls away with the transcript once the conversation
34
+ * fills the viewport (Claude Code shows its ✦ logo in the same slot).
35
+ */
36
+ export declare function LogoHeader({ model, effort, cwd, }: {
37
+ model: string;
38
+ effort?: string | undefined;
39
+ cwd: string;
40
+ }): React.ReactNode;
41
+ //# sourceMappingURL=MessageList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAA8B,KAAK,eAAe,EAAE,MAAM,UAAU,CAAA;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAyC,MAAM,eAAe,CAAA;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAwC/C,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,WAAW,EACX,KAAK,EACL,OAAO,EACP,WAAW,EACX,WAAW,EACX,eAAsB,EACtB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,GACd,EAAE;IACD,IAAI,EAAE,SAAS,OAAO,EAAE,CAAA;IACxB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACjC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB;2EACuE;IACvE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAA;IAC/D,oDAAoD;IACpD,YAAY,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;IACrC,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B;8EAC0E;IAC1E,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,0EAA0E;IAC1E,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC,qBAyOA;AAiQD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,MAAM,EACN,GAAG,GACJ,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,KAAK,CAAC,SAAS,CAMlB"}
@@ -0,0 +1,303 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { t } from '../i18n.js';
4
+ import { Box, Text, useTerminalSize } from '../ui.js';
5
+ import { Divider } from './design-system/Divider.js';
6
+ import { KeyboardShortcutHint } from './design-system/KeyboardShortcutHint.js';
7
+ import { UserPromptMessage } from './messages/UserPromptMessage.js';
8
+ import { AssistantTextMessage } from './messages/AssistantTextMessage.js';
9
+ import { AssistantThinkingMessage } from './messages/AssistantThinkingMessage.js';
10
+ import { AssistantToolUseMessage } from './messages/AssistantToolUseMessage.js';
11
+ import { InterruptedByUser } from './InterruptedByUser.js';
12
+ import { LogoV2 } from './LogoV2.js';
13
+ import { StreamingMarkdown } from './StreamingMarkdown.js';
14
+ import { MessageMetadata } from './messages/MessageMetadata.js';
15
+ import { stripNarration } from '../utils/narration.js';
16
+ import { stringWidth } from '../ink/stringWidth.js';
17
+ import { truncateToWidth } from '../ink/truncateToWidth.js';
18
+ /**
19
+ * Transcript rows rendered in the Claude Code visual language: user prompts
20
+ * on a grey bubble with a `❯` pointer, assistant text with a `●` bullet and
21
+ * markdown, thinking folded to `∴ Thinking (ctrl+o to expand)`, tool calls as
22
+ * status-dot cards. `expanded` (Ctrl+O) shows full reasoning + full tool
23
+ * args/results; `expandedRows` (message-selection mode, Enter) expands single
24
+ * rows; `selectedId` highlights the selected row.
25
+ */
26
+ /** Render cap for very long sessions (CC's MAX_MESSAGES_WITHOUT_VIRTUALIZATION
27
+ * equivalent): older rows fold behind a Divider until Ctrl+E expands them. */
28
+ const MAX_RENDERED_ROWS = 300;
29
+ // --- layout virtualization constants -------------------------------------
30
+ // Offscreen rows render as fixed-height spacers whose heights come from the
31
+ // previous commit's Yoga layout, so the pure-JS Yoga engine never walks
32
+ // their subtrees. Spacers preserve the scroll geometry (content height,
33
+ // sticky follow, scrollbar) of a fully-mounted list.
34
+ /** Lines of extra content mounted above/below the visible window. */
35
+ const OVERSCAN_LINES = 8;
36
+ /** Fallback row height before the first measurement (terminal lines). */
37
+ const DEFAULT_ROW_HEIGHT = 2;
38
+ /** Cold-start estimate of the header block above the rows; corrected by the
39
+ * first layout measurement. */
40
+ const DEFAULT_HEADER_LINES = 14;
41
+ export function MessageList({ rows, expanded, expandedRows, selectedId, onToggleRow, model, showAll, onToggleAll, onLoadOlder, thinkingVisible = true, registerRowRef, scrollHandle, forceMountRowId, newSinceRowId, onUnseenCount, }) {
42
+ const hiddenCount = rows.length - MAX_RENDERED_ROWS;
43
+ // The thinking filter runs BEFORE virtualization so window indices line up.
44
+ const visibleRows = (showAll || hiddenCount <= 0
45
+ ? rows
46
+ : rows.slice(hiddenCount)).filter(row => thinkingVisible || row.kind !== 'reasoning');
47
+ // CC addMargin: every rendered block gets a 1-row top margin except the
48
+ // first. Pre-pass over the FULL list so a windowed row keeps the exact
49
+ // spacing it would have in a fully-mounted list.
50
+ const margins = new Map();
51
+ {
52
+ let prev;
53
+ for (const row of visibleRows) {
54
+ margins.set(row.id, prev !== undefined);
55
+ prev = row.kind;
56
+ }
57
+ }
58
+ // CC's expanded rows keep a persistent hover-grey background (VirtualItem:
59
+ // `expanded ? userMessageBackgroundHover : undefined`).
60
+ const rowBackground = (rowId) => {
61
+ const isSelected = selectedId === rowId;
62
+ if (isSelected)
63
+ return 'messageActionsBackground';
64
+ if (expandedRows.has(rowId))
65
+ return 'userMessageBackgroundHover';
66
+ return undefined;
67
+ };
68
+ // --- layout virtualization ---------------------------------------------
69
+ const { columns } = useTerminalSize();
70
+ // Measured row heights, remembered after a row unmounts so virtualization
71
+ // can compute total content height. Bounded: row ids grow monotonically
72
+ // and rows are never removed from the transcript (foldRows keeps the
73
+ // row), so without a cap this Map grew by one entry per row forever.
74
+ // Eviction is FIFO (oldest row first); a forgotten height falls back to
75
+ // DEFAULT_ROW_HEIGHT, which only perturbs deep scrollback estimates.
76
+ const HEIGHTS_CACHE_MAX = 5000;
77
+ const heightsRef = React.useRef(new Map());
78
+ const localRefs = React.useRef(new Map());
79
+ /** Content-space offset of visibleRows[0] (header + dividers), measured. */
80
+ const baseRef = React.useRef(null);
81
+ const [, setMeasureTick] = React.useState(0);
82
+ const [, setScrollTick] = React.useState(0);
83
+ // A width change reflows every row — all measurements are stale.
84
+ const lastColumns = React.useRef(columns);
85
+ if (lastColumns.current !== columns) {
86
+ lastColumns.current = columns;
87
+ heightsRef.current.clear();
88
+ baseRef.current = null;
89
+ }
90
+ // Scrolling bypasses React (imperative DOM scrollTop): subscribe so the
91
+ // window follows the viewport.
92
+ React.useEffect(() => {
93
+ if (!scrollHandle)
94
+ return;
95
+ const tick = () => { setScrollTick(t => t + 1); };
96
+ return scrollHandle.subscribe(tick);
97
+ }, [scrollHandle]);
98
+ const heightOf = (row) => heightsRef.current.get(row.id) ?? DEFAULT_ROW_HEIGHT;
99
+ const offsets = new Array(visibleRows.length);
100
+ let total = 0;
101
+ for (let i = 0; i < visibleRows.length; i++) {
102
+ offsets[i] = total;
103
+ total += heightOf(visibleRows[i]);
104
+ }
105
+ const scrollTop = scrollHandle?.getScrollTop() ?? 0;
106
+ const pending = scrollHandle?.getPendingDelta() ?? 0;
107
+ const viewport = scrollHandle?.getViewportHeight() ?? 24;
108
+ const sticky = scrollHandle?.isSticky() ?? true;
109
+ const base = baseRef.current ?? DEFAULT_HEADER_LINES;
110
+ // Mount the union of the committed position and any in-flight pending
111
+ // delta, plus overscan; when sticky, always reach the tail (streaming row).
112
+ const relTop = Math.min(scrollTop, scrollTop + pending) - OVERSCAN_LINES - base;
113
+ const relBottom = Math.max(scrollTop, scrollTop + pending) + viewport + OVERSCAN_LINES - base;
114
+ let start = 0;
115
+ while (start < visibleRows.length && offsets[start] + heightOf(visibleRows[start]) <= relTop)
116
+ start++;
117
+ let end = start;
118
+ while (end < visibleRows.length && offsets[end] < relBottom)
119
+ end++;
120
+ if (sticky || !scrollHandle)
121
+ end = visibleRows.length;
122
+ // Pinned to bottom: the tail row must stay mounted EVERY pass. The
123
+ // streaming row's measured height only lands in heightsRef when it
124
+ // survives mounted across two consecutive commits (useLayoutEffect reads
125
+ // the previous Yoga pass). If an underestimated `total` ever lets relTop
126
+ // overshoot it, start=len unmounts everything → content collapses to the
127
+ // header → follow yanks scrollTop to 0 → next pass remounts all → follow
128
+ // back to the real bottom: a self-sustaining ping-pong that blanks the
129
+ // transcript mid-stream.
130
+ if (sticky && visibleRows.length > 0) {
131
+ start = Math.min(start, visibleRows.length - 1);
132
+ }
133
+ if (forceMountRowId !== undefined && forceMountRowId !== null) {
134
+ const idx = visibleRows.findIndex(row => row.id === forceMountRowId);
135
+ if (idx !== -1) {
136
+ start = Math.min(start, idx);
137
+ end = Math.max(end, idx + 1);
138
+ }
139
+ }
140
+ const topPad = offsets[start] ?? 0;
141
+ const mountedBottom = end < visibleRows.length ? offsets[end] : total;
142
+ const bottomPad = total - mountedBottom;
143
+ // New-messages pill count: rows past the seen-anchor whose top edge is
144
+ // still below the viewport bottom. Same rows-space math as the window
145
+ // (offsets are rows-space, scrollTop content-space — subtract the header
146
+ // base). Decrements as the user scrolls down through the new rows; 0 once
147
+ // every new row has appeared on screen. Reported post-commit (parent
148
+ // setState with an unchanged value is a React no-op, so the per-render
149
+ // effect only re-renders on actual count changes).
150
+ let unseenCount = 0;
151
+ if (newSinceRowId !== null && newSinceRowId !== undefined) {
152
+ const firstNew = visibleRows.findIndex(row => row.id > newSinceRowId);
153
+ if (firstNew !== -1) {
154
+ const seenBottom = scrollTop + viewport - base;
155
+ for (let i = firstNew; i < visibleRows.length; i++) {
156
+ if (offsets[i] >= seenBottom)
157
+ unseenCount++;
158
+ }
159
+ }
160
+ }
161
+ React.useEffect(() => {
162
+ onUnseenCount?.(unseenCount);
163
+ });
164
+ // Post-commit: measure mounted rows, derive the content-space base from
165
+ // the first mounted row's Yoga top, and clamp render-time scrollTop to the
166
+ // mounted coverage so burst scrolls never show blank spacer.
167
+ React.useLayoutEffect(() => {
168
+ let changed = false;
169
+ for (const [id, el] of localRefs.current) {
170
+ const h = el.yogaNode?.getComputedHeight();
171
+ if (h !== undefined && h > 0 && heightsRef.current.get(id) !== h) {
172
+ if (heightsRef.current.size >= HEIGHTS_CACHE_MAX) {
173
+ const oldest = heightsRef.current.keys().next().value;
174
+ if (oldest !== undefined)
175
+ heightsRef.current.delete(oldest);
176
+ }
177
+ heightsRef.current.set(id, h);
178
+ changed = true;
179
+ }
180
+ }
181
+ const firstMounted = visibleRows[start];
182
+ // oxlint-disable-next-line typescript/no-unnecessary-condition -- runtime guard: empty list window
183
+ const firstEl = firstMounted ? localRefs.current.get(firstMounted.id) : undefined;
184
+ const top = firstEl?.yogaNode?.getComputedTop();
185
+ if (top !== undefined) {
186
+ const measured = top - (offsets[start] ?? 0);
187
+ if (baseRef.current !== measured) {
188
+ baseRef.current = measured;
189
+ changed = true;
190
+ }
191
+ }
192
+ if (scrollHandle) {
193
+ if (sticky || (start === 0 && end >= visibleRows.length)) {
194
+ scrollHandle.setClampBounds(undefined, undefined);
195
+ }
196
+ else {
197
+ const min = Math.max(0, base + topPad - viewport);
198
+ scrollHandle.setClampBounds(min, Math.max(min, base + mountedBottom - viewport));
199
+ }
200
+ }
201
+ if (changed)
202
+ setMeasureTick(t => t + 1);
203
+ });
204
+ // useCallback: the reference feeds MemoRow's shallow compare; a fresh
205
+ // closure per render would defeat every row's memo.
206
+ const setRowRef = React.useCallback((rowId, el) => {
207
+ if (el)
208
+ localRefs.current.set(rowId, el);
209
+ else
210
+ localRefs.current.delete(rowId);
211
+ registerRowRef?.(rowId, el);
212
+ }, [registerRowRef]);
213
+ // Second-resolution clock for the running tool card's live elapsed time.
214
+ // Computed per render (cheap) but only forwarded to running rows, so
215
+ // settled rows never see a changing prop.
216
+ const nowSec = Math.floor(Date.now() / 1000);
217
+ return (_jsxs(_Fragment, { children: [rows.some(row => row.folded) && (_jsx(Box, { marginTop: 1, onClick: onLoadOlder, children: _jsx(Divider, { title: t('load-earlier') }) })), !showAll && hiddenCount > 0 && (_jsx(Box, { marginTop: 1, onClick: onToggleAll, children: _jsx(Divider, { title: ` ctrl+e to show ${hiddenCount} previous messages ` }) })), topPad > 0 && _jsx(Box, { height: topPad, flexShrink: 0 }), visibleRows
218
+ .slice(start, end)
219
+ .map((row) => {
220
+ // CC addMargin: pre-pass result keeps windowed rows at full-mount
221
+ // spacing; only the very first row of the whole list has none.
222
+ const addMargin = margins.get(row.id) === true;
223
+ const tool = row.tool;
224
+ return (_jsx(MemoRow, { rowId: row.id, kind: row.kind, text: row.text, streaming: row.streaming === true, durationMs: row.durationMs, time: row.time, addMargin: addMargin, isSelected: selectedId === row.id, isExpanded: expandedRows.has(row.id), expanded: expanded, model: model, background: rowBackground(row.id), toolCallId: tool?.callId, toolName: tool?.name, toolArgsText: tool?.argsText, toolArgsFull: tool?.argsFull, toolStatus: tool?.status, toolResultText: tool?.resultText, toolResultFull: tool?.resultFull, toolErrorText: tool?.errorText, toolCallView: tool?.callView, toolResultView: tool?.resultView, toolStartedAt: tool?.startedAt, toolDurationMs: tool?.durationMs, nowSec: tool?.status === 'running' ? nowSec : undefined, onToggleRow: onToggleRow, setRowRef: setRowRef }, row.id));
225
+ }), bottomPad > 0 && _jsx(Box, { height: bottomPad, flexShrink: 0 })] }));
226
+ }
227
+ function TranscriptRow({ rowId, kind, text, streaming, durationMs, time, addMargin, isSelected, isExpanded, expanded, model, background, toolCallId, toolName, toolArgsText, toolArgsFull, toolStatus, toolResultText, toolResultFull, toolErrorText, toolCallView, toolResultView, toolStartedAt, toolDurationMs, onToggleRow, setRowRef, }) {
228
+ const ref = React.useCallback((el) => {
229
+ setRowRef(rowId, el);
230
+ }, [setRowRef, rowId]);
231
+ const onClick = React.useCallback(() => {
232
+ onToggleRow(rowId);
233
+ }, [onToggleRow, rowId]);
234
+ switch (kind) {
235
+ case 'user':
236
+ return (_jsx(Box, { flexDirection: "column", ref: ref, children: _jsx(UserPromptMessage, { text: text, addMargin: addMargin, isSelected: isSelected, isExpanded: isExpanded, onClick: onClick }) }));
237
+ case 'assistant':
238
+ return streaming ? (_jsxs(Box, { alignItems: "flex-start", flexDirection: "row", marginTop: addMargin ? 1 : 0, width: "100%", backgroundColor: background, children: [_jsx(Box, { minWidth: 2, children: _jsx(Text, { color: "text", children: "\u25CF" }) }), _jsx(Box, { flexDirection: "column", children: _jsx(StreamingMarkdown, { children: stripNarration(text) }) })] })) : (_jsxs(Box, { width: "100%", flexDirection: "column", backgroundColor: background, ref: ref, children: [expanded && (_jsx(Box, { flexDirection: "row", justifyContent: "flex-end", gap: 1, marginTop: 1, children: _jsx(MessageMetadata, { timestamp: time, model: model }) })), _jsx(AssistantTextMessage, { text: stripNarration(text), addMargin: addMargin, isSelected: isSelected, isExpanded: isExpanded, onClick: onClick })] }));
239
+ case 'reasoning':
240
+ return (_jsx(Box, { flexDirection: "column", ref: ref, children: _jsx(AssistantThinkingMessage, { thinking: text, addMargin: addMargin,
241
+ // Streaming reasoning shows expanded live, then folds
242
+ // automatically once the turn settles (unless Ctrl+O or a
243
+ // single-row expansion keeps it open).
244
+ verbose: isExpanded || expanded || streaming, durationMs: durationMs, isSelected: isSelected, onClick: onClick }) }));
245
+ case 'tool': {
246
+ if (toolCallId === undefined ||
247
+ toolName === undefined ||
248
+ toolArgsText === undefined ||
249
+ toolStatus === undefined ||
250
+ toolStartedAt === undefined) {
251
+ return null;
252
+ }
253
+ // Rebuilt per render from the flattened props — cheap object literal,
254
+ // and AssistantToolUseMessage is only reached when memo let us through.
255
+ const tool = {
256
+ callId: toolCallId,
257
+ name: toolName,
258
+ argsText: toolArgsText,
259
+ argsFull: toolArgsFull,
260
+ status: toolStatus,
261
+ resultText: toolResultText,
262
+ resultFull: toolResultFull,
263
+ errorText: toolErrorText,
264
+ callView: toolCallView,
265
+ resultView: toolResultView,
266
+ startedAt: toolStartedAt,
267
+ durationMs: toolDurationMs,
268
+ };
269
+ return (_jsx(Box, { flexDirection: "column", ref: ref, children: _jsx(AssistantToolUseMessage, { tool: tool, addMargin: addMargin, verbose: isExpanded || expanded, isSelected: isSelected, isExpanded: isExpanded }) }));
270
+ }
271
+ case 'notice':
272
+ return (_jsx(Box, { marginTop: 1, ref: ref, children: _jsx(Divider, { title: ` ${text} ` }) }));
273
+ case 'interrupt':
274
+ return (_jsx(Box, { marginTop: 1, ref: ref, children: _jsx(InterruptedByUser, {}) }));
275
+ case 'local':
276
+ // `!` mode command echo, like CC's UserBashInputMessage.
277
+ return (_jsx(Box, { marginTop: 1, backgroundColor: background, ref: ref, children: _jsxs(Text, { color: "bashBorder", children: ["! ", text] }) }));
278
+ case 'local-output':
279
+ return (_jsx(Box, { paddingLeft: 2, backgroundColor: background, ref: ref, children: _jsx(Text, { dimColor: true, children: text }) }));
280
+ case 'compact':
281
+ // The post-compaction summary defaults to a folded one-liner with a
282
+ // text preview; Ctrl+O (global) or message-selection Enter reveals
283
+ // the full summary.
284
+ return (_jsx(Box, { marginTop: addMargin ? 1 : 0, paddingLeft: 2, backgroundColor: background, ref: ref, onClick: onClick, children: expanded || isExpanded ? (_jsx(Text, { dimColor: true, children: text })) : (_jsxs(Text, { dimColor: true, italic: true, children: ["\u2234 ", t('compact-summary-folded'), " \u00B7 ", compactPreview(text), ' ', _jsx(KeyboardShortcutHint, { shortcut: "ctrl+o", action: "expand", parens: true })] })) }));
285
+ }
286
+ }
287
+ /** Folded compact-summary preview: whitespace flattened, capped with an
288
+ * ellipsis so the fold line never wraps. `limit` is terminal cells, so
289
+ * CJK wide chars count double and never split mid-glyph. */
290
+ function compactPreview(text, limit = 60) {
291
+ const flat = text.replace(/\s+/g, ' ').trim();
292
+ return stringWidth(flat) <= limit ? flat : `${truncateToWidth(flat, limit - 1)}…`;
293
+ }
294
+ const MemoRow = React.memo(TranscriptRow);
295
+ /**
296
+ * The header block pinned above the transcript: the DeepSeek pixel whale
297
+ * with the wordmark, tagline, model/effort and cwd (`LogoV2`), plus the
298
+ * welcome line. It scrolls away with the transcript once the conversation
299
+ * fills the viewport (Claude Code shows its ✦ logo in the same slot).
300
+ */
301
+ export function LogoHeader({ model, effort, cwd, }) {
302
+ return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: _jsx(LogoV2, { model: model, effort: effort, cwd: cwd }) }));
303
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { LlmModelInfo } from '@deepseek-ai/dsh-llm';
3
+ /**
4
+ * Model picker in the CC ModelPicker style: a permission-colored Pane with
5
+ * the model list as Select rows (❯ focus pointer, ✓ on the active model,
6
+ * descriptions), plus the Enter/Esc hint line. The DSH agent's model is
7
+ * fixed at creation time, so a selection notifies "restart to apply".
8
+ */
9
+ export declare function ModelPicker({ models, focusIndex, currentModel, }: {
10
+ models: readonly LlmModelInfo[];
11
+ focusIndex: number;
12
+ currentModel: string;
13
+ }): React.ReactNode;
14
+ //# sourceMappingURL=ModelPicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelPicker.d.ts","sourceRoot":"","sources":["../../../src/components/ModelPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAMxD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,UAAU,EACV,YAAY,GACb,EAAE;IACD,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,KAAK,CAAC,SAAS,CA4BlB"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from '../ui.js';
3
+ import { Pane } from './design-system/Pane.js';
4
+ import { ListItem } from './design-system/ListItem.js';
5
+ import { Byline } from './design-system/Byline.js';
6
+ import { KeyboardShortcutHint } from './design-system/KeyboardShortcutHint.js';
7
+ /**
8
+ * Model picker in the CC ModelPicker style: a permission-colored Pane with
9
+ * the model list as Select rows (❯ focus pointer, ✓ on the active model,
10
+ * descriptions), plus the Enter/Esc hint line. The DSH agent's model is
11
+ * fixed at creation time, so a selection notifies "restart to apply".
12
+ */
13
+ export function ModelPicker({ models, focusIndex, currentModel, }) {
14
+ return (_jsxs(Pane, { color: "permission", children: [_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "remember", bold: true, children: "Model" }) }), models.map((model, index) => (_jsxs(ListItem, { isFocused: index === focusIndex, isSelected: `${model.provider}/${model.id}` === currentModel, description: model.description, children: [model.provider, " / ", model.name] }, `${model.provider}/${model.id}`)))] }), _jsx(Text, { dimColor: true, italic: true, children: _jsxs(Byline, { children: [_jsx(KeyboardShortcutHint, { shortcut: "Enter", action: "confirm", bold: true }), _jsx(KeyboardShortcutHint, { shortcut: "Esc", action: "exit" })] }) })] }));
15
+ }