@deepseek-harness-tui/dsh-tui 0.8.8 → 0.9.1

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 (467) hide show
  1. package/README.md +60 -238
  2. package/bin/dsh-tui.js +172 -5
  3. package/cordis.patch.yml +16 -4
  4. package/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -13
  5. package/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -59
  6. package/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -15
  7. package/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -32
  8. package/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -59
  9. package/dsh-ecosystem-spec/protocols/tui-channel.js +166 -166
  10. package/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -42
  11. package/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -143
  12. package/dsh-ecosystem-spec/registry/README.md +14 -14
  13. package/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -56
  14. package/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -13
  15. package/dsh-ecosystem-spec/registry/registry-0.15.json +149 -149
  16. package/lib/types/cc/hyperlink.d.ts +7 -1
  17. package/lib/types/cc/hyperlink.d.ts.map +1 -1
  18. package/lib/types/cc/hyperlink.js +3 -2
  19. package/lib/types/cc/markdown.d.ts.map +1 -1
  20. package/lib/types/cc/markdown.js +33 -3
  21. package/lib/types/cc/sessionColors.d.ts +27 -0
  22. package/lib/types/cc/sessionColors.d.ts.map +1 -0
  23. package/lib/types/cc/sessionColors.js +39 -0
  24. package/lib/types/commands.d.ts.map +1 -1
  25. package/lib/types/commands.js +10 -2
  26. package/lib/types/components/ActivityPicker.d.ts +4 -1
  27. package/lib/types/components/ActivityPicker.d.ts.map +1 -1
  28. package/lib/types/components/ActivityPicker.js +2 -2
  29. package/lib/types/components/AutoRecapRow.d.ts +23 -0
  30. package/lib/types/components/AutoRecapRow.d.ts.map +1 -0
  31. package/lib/types/components/AutoRecapRow.js +23 -0
  32. package/lib/types/components/BtwPanel.d.ts.map +1 -1
  33. package/lib/types/components/BtwPanel.js +1 -1
  34. package/lib/types/components/Chat/SubagentMessage.d.ts +2 -1
  35. package/lib/types/components/Chat/SubagentMessage.d.ts.map +1 -1
  36. package/lib/types/components/Chat/SubagentMessage.js +11 -3
  37. package/lib/types/components/ColorPicker.d.ts +17 -0
  38. package/lib/types/components/ColorPicker.d.ts.map +1 -0
  39. package/lib/types/components/ColorPicker.js +20 -0
  40. package/lib/types/components/CommandSuggestions.d.ts +23 -4
  41. package/lib/types/components/CommandSuggestions.d.ts.map +1 -1
  42. package/lib/types/components/CommandSuggestions.js +41 -14
  43. package/lib/types/components/ContextBarView.d.ts +33 -0
  44. package/lib/types/components/ContextBarView.d.ts.map +1 -0
  45. package/lib/types/components/ContextBarView.js +46 -0
  46. package/lib/types/components/EffortInputBorder.d.ts +12 -1
  47. package/lib/types/components/EffortInputBorder.d.ts.map +1 -1
  48. package/lib/types/components/EffortInputBorder.js +22 -5
  49. package/lib/types/components/EffortSlider.d.ts +4 -1
  50. package/lib/types/components/EffortSlider.d.ts.map +1 -1
  51. package/lib/types/components/EffortSlider.js +4 -2
  52. package/lib/types/components/ExtensionDialog.js +6 -2
  53. package/lib/types/components/FileActionsPanel.d.ts +22 -0
  54. package/lib/types/components/FileActionsPanel.d.ts.map +1 -0
  55. package/lib/types/components/FileActionsPanel.js +28 -0
  56. package/lib/types/components/FileSuggestions.d.ts +26 -7
  57. package/lib/types/components/FileSuggestions.d.ts.map +1 -1
  58. package/lib/types/components/FileSuggestions.js +39 -12
  59. package/lib/types/components/GoalTodoPanel.d.ts +26 -2
  60. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  61. package/lib/types/components/GoalTodoPanel.js +86 -17
  62. package/lib/types/components/HelpMenu.d.ts +7 -1
  63. package/lib/types/components/HelpMenu.d.ts.map +1 -1
  64. package/lib/types/components/HelpMenu.js +12 -4
  65. package/lib/types/components/HistorySearchDialog.d.ts +4 -1
  66. package/lib/types/components/HistorySearchDialog.d.ts.map +1 -1
  67. package/lib/types/components/HistorySearchDialog.js +2 -2
  68. package/lib/types/components/LangPicker.d.ts +14 -0
  69. package/lib/types/components/LangPicker.d.ts.map +1 -0
  70. package/lib/types/components/LangPicker.js +17 -0
  71. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
  72. package/lib/types/components/LoadedContextPanel.js +3 -1
  73. package/lib/types/components/Markdown.d.ts.map +1 -1
  74. package/lib/types/components/Markdown.js +12 -3
  75. package/lib/types/components/MessageList.d.ts +45 -2
  76. package/lib/types/components/MessageList.d.ts.map +1 -1
  77. package/lib/types/components/MessageList.js +560 -41
  78. package/lib/types/components/ModelPicker.d.ts +27 -2
  79. package/lib/types/components/ModelPicker.d.ts.map +1 -1
  80. package/lib/types/components/ModelPicker.js +26 -6
  81. package/lib/types/components/PermissionsPicker.d.ts +21 -0
  82. package/lib/types/components/PermissionsPicker.d.ts.map +1 -0
  83. package/lib/types/components/PermissionsPicker.js +27 -0
  84. package/lib/types/components/PlanPicker.d.ts +15 -0
  85. package/lib/types/components/PlanPicker.d.ts.map +1 -0
  86. package/lib/types/components/PlanPicker.js +18 -0
  87. package/lib/types/components/PresetPicker.d.ts +4 -1
  88. package/lib/types/components/PresetPicker.d.ts.map +1 -1
  89. package/lib/types/components/PresetPicker.js +2 -2
  90. package/lib/types/components/PromptInput.d.ts +4 -3
  91. package/lib/types/components/PromptInput.d.ts.map +1 -1
  92. package/lib/types/components/PromptInput.js +602 -75
  93. package/lib/types/components/RecapPanel.d.ts +25 -0
  94. package/lib/types/components/RecapPanel.d.ts.map +1 -0
  95. package/lib/types/components/RecapPanel.js +55 -0
  96. package/lib/types/components/RewindPicker.d.ts +12 -1
  97. package/lib/types/components/RewindPicker.d.ts.map +1 -1
  98. package/lib/types/components/RewindPicker.js +6 -4
  99. package/lib/types/components/ScrollbarGutter.d.ts +28 -0
  100. package/lib/types/components/ScrollbarGutter.d.ts.map +1 -0
  101. package/lib/types/components/ScrollbarGutter.js +119 -0
  102. package/lib/types/components/Select.d.ts +8 -1
  103. package/lib/types/components/Select.d.ts.map +1 -1
  104. package/lib/types/components/Select.js +4 -2
  105. package/lib/types/components/SkillsPicker.d.ts +4 -1
  106. package/lib/types/components/SkillsPicker.d.ts.map +1 -1
  107. package/lib/types/components/SkillsPicker.js +2 -2
  108. package/lib/types/components/SubagentCard.d.ts +2 -1
  109. package/lib/types/components/SubagentCard.d.ts.map +1 -1
  110. package/lib/types/components/SubagentCard.js +9 -2
  111. package/lib/types/components/SubagentDashboard.d.ts +4 -0
  112. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  113. package/lib/types/components/SubagentDashboard.js +9 -1
  114. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  115. package/lib/types/components/SubagentDetailScene.js +5 -4
  116. package/lib/types/components/SuggestionCard.d.ts +65 -0
  117. package/lib/types/components/SuggestionCard.d.ts.map +1 -0
  118. package/lib/types/components/SuggestionCard.js +77 -0
  119. package/lib/types/components/ThemePicker.d.ts +4 -1
  120. package/lib/types/components/ThemePicker.d.ts.map +1 -1
  121. package/lib/types/components/ThemePicker.js +2 -2
  122. package/lib/types/components/ThinkingToggle.d.ts +4 -1
  123. package/lib/types/components/ThinkingToggle.d.ts.map +1 -1
  124. package/lib/types/components/ThinkingToggle.js +2 -2
  125. package/lib/types/components/TimelineRail.d.ts +53 -0
  126. package/lib/types/components/TimelineRail.d.ts.map +1 -0
  127. package/lib/types/components/TimelineRail.js +197 -0
  128. package/lib/types/components/WorkspaceFlowPicker.d.ts +6 -1
  129. package/lib/types/components/WorkspaceFlowPicker.d.ts.map +1 -1
  130. package/lib/types/components/WorkspaceFlowPicker.js +4 -2
  131. package/lib/types/components/WorkspaceMenuPicker.d.ts +19 -0
  132. package/lib/types/components/WorkspaceMenuPicker.d.ts.map +1 -0
  133. package/lib/types/components/WorkspaceMenuPicker.js +19 -0
  134. package/lib/types/components/WorkspacePicker.d.ts +4 -1
  135. package/lib/types/components/WorkspacePicker.d.ts.map +1 -1
  136. package/lib/types/components/WorkspacePicker.js +2 -2
  137. package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
  138. package/lib/types/components/approvals/ApprovalPanel.js +5 -1
  139. package/lib/types/components/design-system/ListItem.d.ts +8 -1
  140. package/lib/types/components/design-system/ListItem.d.ts.map +1 -1
  141. package/lib/types/components/design-system/ListItem.js +8 -3
  142. package/lib/types/components/design-system/ThemeProvider.d.ts +7 -0
  143. package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
  144. package/lib/types/components/design-system/ThemeProvider.js +2 -1
  145. package/lib/types/components/messages/AssistantTextMessage.d.ts +5 -2
  146. package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -1
  147. package/lib/types/components/messages/AssistantTextMessage.js +6 -2
  148. package/lib/types/components/messages/AssistantThinkingMessage.d.ts +2 -1
  149. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
  150. package/lib/types/components/messages/AssistantThinkingMessage.js +10 -4
  151. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +15 -1
  152. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  153. package/lib/types/components/messages/AssistantToolUseMessage.js +37 -7
  154. package/lib/types/components/messages/UserPromptMessage.d.ts +2 -1
  155. package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -1
  156. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +7 -3
  157. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  158. package/lib/types/components/questions/AskUserQuestionPanel.js +75 -11
  159. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  160. package/lib/types/components/questions/PlanReviewPanel.js +13 -2
  161. package/lib/types/components/sessions/SessionListRow.d.ts +4 -1
  162. package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
  163. package/lib/types/components/sessions/SessionListRow.js +4 -2
  164. package/lib/types/components/trajectory/HotspotView.d.ts +7 -1
  165. package/lib/types/components/trajectory/HotspotView.d.ts.map +1 -1
  166. package/lib/types/components/trajectory/HotspotView.js +8 -2
  167. package/lib/types/components/trajectory/Ledger.d.ts +9 -1
  168. package/lib/types/components/trajectory/Ledger.d.ts.map +1 -1
  169. package/lib/types/components/trajectory/Ledger.js +23 -5
  170. package/lib/types/components/trajectory/WaveBand.d.ts +10 -1
  171. package/lib/types/components/trajectory/WaveBand.d.ts.map +1 -1
  172. package/lib/types/components/trajectory/WaveBand.js +7 -2
  173. package/lib/types/dsh-adapter/channel.d.ts +117 -7
  174. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  175. package/lib/types/dsh-adapter/channel.js +1301 -122
  176. package/lib/types/dsh-adapter/compat/index.d.ts +8 -6
  177. package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -1
  178. package/lib/types/dsh-adapter/compat/index.js +8 -6
  179. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +150 -0
  180. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
  181. package/lib/types/dsh-adapter/compat/sessionLog.js +518 -41
  182. package/lib/types/dsh-adapter/contract.d.ts +1 -1
  183. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  184. package/lib/types/dsh-adapter/contract.js +1 -0
  185. package/lib/types/dsh-adapter/extension-events.d.ts +1 -1
  186. package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -1
  187. package/lib/types/dsh-adapter/index.d.ts +20 -2
  188. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  189. package/lib/types/dsh-adapter/index.js +9 -1
  190. package/lib/types/dsh-adapter/plugin.d.ts +0 -9
  191. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  192. package/lib/types/dsh-adapter/plugin.js +453 -14
  193. package/lib/types/dsh-adapter/presets.d.ts +18 -0
  194. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  195. package/lib/types/dsh-adapter/presets.js +31 -0
  196. package/lib/types/dsh-adapter/providerWizard.d.ts +29 -1
  197. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  198. package/lib/types/dsh-adapter/providerWizard.js +89 -5
  199. package/lib/types/dsh-adapter/questions.d.ts +19 -2
  200. package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
  201. package/lib/types/dsh-adapter/questions.js +53 -10
  202. package/lib/types/dsh-adapter/recap.d.ts +49 -0
  203. package/lib/types/dsh-adapter/recap.d.ts.map +1 -0
  204. package/lib/types/dsh-adapter/recap.js +121 -0
  205. package/lib/types/dsh-adapter/sessionTree.d.ts +314 -0
  206. package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -0
  207. package/lib/types/dsh-adapter/sessionTree.js +954 -0
  208. package/lib/types/dsh-adapter/shortcuts.d.ts +15 -44
  209. package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -1
  210. package/lib/types/dsh-adapter/shortcuts.js +28 -165
  211. package/lib/types/dsh-adapter/types.d.ts +1 -1
  212. package/lib/types/dsh-adapter/types.d.ts.map +1 -1
  213. package/lib/types/herdr.js +1 -1
  214. package/lib/types/i18n.d.ts +770 -181
  215. package/lib/types/i18n.d.ts.map +1 -1
  216. package/lib/types/i18n.js +257 -80
  217. package/lib/types/ink/components/AlternateScreen.d.ts.map +1 -1
  218. package/lib/types/ink/components/AlternateScreen.js +13 -1
  219. package/lib/types/ink/components/App.d.ts +12 -1
  220. package/lib/types/ink/components/App.d.ts.map +1 -1
  221. package/lib/types/ink/components/App.js +101 -4
  222. package/lib/types/ink/components/ClockContext.d.ts.map +1 -1
  223. package/lib/types/ink/components/ClockContext.js +2 -0
  224. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
  225. package/lib/types/ink/components/ScrollBox.js +170 -91
  226. package/lib/types/ink/constants.d.ts +9 -0
  227. package/lib/types/ink/constants.d.ts.map +1 -1
  228. package/lib/types/ink/constants.js +9 -0
  229. package/lib/types/ink/events/click-event.d.ts +7 -16
  230. package/lib/types/ink/events/click-event.d.ts.map +1 -1
  231. package/lib/types/ink/events/click-event.js +16 -19
  232. package/lib/types/ink/events/event-handlers.d.ts +11 -1
  233. package/lib/types/ink/events/event-handlers.d.ts.map +1 -1
  234. package/lib/types/ink/events/event-handlers.js +2 -0
  235. package/lib/types/ink/events/input-event.d.ts +9 -0
  236. package/lib/types/ink/events/input-event.d.ts.map +1 -1
  237. package/lib/types/ink/events/input-event.js +4 -0
  238. package/lib/types/ink/events/pointer-event.d.ts +61 -0
  239. package/lib/types/ink/events/pointer-event.d.ts.map +1 -0
  240. package/lib/types/ink/events/pointer-event.js +61 -0
  241. package/lib/types/ink/events/wheel-event.d.ts +17 -0
  242. package/lib/types/ink/events/wheel-event.d.ts.map +1 -0
  243. package/lib/types/ink/events/wheel-event.js +20 -0
  244. package/lib/types/ink/geometry-trace.d.ts +51 -0
  245. package/lib/types/ink/geometry-trace.d.ts.map +1 -0
  246. package/lib/types/ink/geometry-trace.js +83 -0
  247. package/lib/types/ink/hit-test.d.ts +56 -1
  248. package/lib/types/ink/hit-test.d.ts.map +1 -1
  249. package/lib/types/ink/hit-test.js +146 -8
  250. package/lib/types/ink/ink.d.ts +58 -1
  251. package/lib/types/ink/ink.d.ts.map +1 -1
  252. package/lib/types/ink/ink.js +230 -29
  253. package/lib/types/ink/log-update.d.ts.map +1 -1
  254. package/lib/types/ink/log-update.js +21 -0
  255. package/lib/types/ink/node-cache.d.ts +5 -0
  256. package/lib/types/ink/node-cache.d.ts.map +1 -1
  257. package/lib/types/ink/parse-keypress.d.ts +8 -0
  258. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  259. package/lib/types/ink/parse-keypress.js +101 -12
  260. package/lib/types/ink/render-node-to-output.d.ts +10 -0
  261. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  262. package/lib/types/ink/render-node-to-output.js +111 -18
  263. package/lib/types/ink/timeline-rail.d.ts +138 -0
  264. package/lib/types/ink/timeline-rail.d.ts.map +1 -0
  265. package/lib/types/ink/timeline-rail.js +179 -0
  266. package/lib/types/ink/wrap-text.d.ts.map +1 -1
  267. package/lib/types/ink/wrap-text.js +47 -5
  268. package/lib/types/migrationPrefs.d.ts +60 -0
  269. package/lib/types/migrationPrefs.d.ts.map +1 -0
  270. package/lib/types/migrationPrefs.js +97 -0
  271. package/lib/types/modelGroups.d.ts +72 -0
  272. package/lib/types/modelGroups.d.ts.map +1 -0
  273. package/lib/types/modelGroups.js +97 -0
  274. package/lib/types/modelRecents.d.ts +39 -0
  275. package/lib/types/modelRecents.d.ts.map +1 -0
  276. package/lib/types/modelRecents.js +97 -0
  277. package/lib/types/native-ts/yoga-layout/index.d.ts +11 -0
  278. package/lib/types/native-ts/yoga-layout/index.d.ts.map +1 -1
  279. package/lib/types/native-ts/yoga-layout/index.js +31 -1
  280. package/lib/types/oauth.d.ts +15 -0
  281. package/lib/types/oauth.d.ts.map +1 -0
  282. package/lib/types/oauth.js +14 -0
  283. package/lib/types/reload.d.ts +109 -0
  284. package/lib/types/reload.d.ts.map +1 -0
  285. package/lib/types/reload.js +118 -0
  286. package/lib/types/screens/Chat.d.ts +3 -1
  287. package/lib/types/screens/Chat.d.ts.map +1 -1
  288. package/lib/types/screens/Chat.js +1377 -371
  289. package/lib/types/screens/SessionBrowser.d.ts.map +1 -1
  290. package/lib/types/screens/SessionBrowser.js +56 -29
  291. package/lib/types/screens/SessionTree.d.ts +27 -0
  292. package/lib/types/screens/SessionTree.d.ts.map +1 -0
  293. package/lib/types/screens/SessionTree.js +555 -0
  294. package/lib/types/screens/Settings.d.ts.map +1 -1
  295. package/lib/types/screens/Settings.js +64 -22
  296. package/lib/types/screens/StatusLine.d.ts +0 -8
  297. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  298. package/lib/types/screens/StatusLine.js +224 -45
  299. package/lib/types/screens/StatusMetrics.d.ts +35 -3
  300. package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
  301. package/lib/types/screens/StatusMetrics.js +63 -8
  302. package/lib/types/screens/TrajectoryScene.d.ts.map +1 -1
  303. package/lib/types/screens/TrajectoryScene.js +81 -14
  304. package/lib/types/screens/chatOverlay.d.ts +237 -0
  305. package/lib/types/screens/chatOverlay.d.ts.map +1 -0
  306. package/lib/types/screens/chatOverlay.js +116 -0
  307. package/lib/types/tips.d.ts.map +1 -1
  308. package/lib/types/tips.js +64 -10
  309. package/lib/types/tuiDisplayPrefs.d.ts +15 -0
  310. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  311. package/lib/types/tuiDisplayPrefs.js +9 -0
  312. package/lib/types/update.d.ts +139 -0
  313. package/lib/types/update.d.ts.map +1 -1
  314. package/lib/types/update.js +382 -30
  315. package/lib/types/utils/debug.d.ts +10 -0
  316. package/lib/types/utils/debug.d.ts.map +1 -1
  317. package/lib/types/utils/debug.js +24 -0
  318. package/lib/types/utils/fileTarget.d.ts +46 -0
  319. package/lib/types/utils/fileTarget.d.ts.map +1 -0
  320. package/lib/types/utils/fileTarget.js +178 -0
  321. package/lib/types/utils/keymap.d.ts +134 -0
  322. package/lib/types/utils/keymap.d.ts.map +1 -0
  323. package/lib/types/utils/keymap.js +311 -0
  324. package/lib/types/utils/mentions.d.ts +25 -2
  325. package/lib/types/utils/mentions.d.ts.map +1 -1
  326. package/lib/types/utils/mentions.js +69 -10
  327. package/lib/types/utils/openExternal.d.ts +50 -0
  328. package/lib/types/utils/openExternal.d.ts.map +1 -0
  329. package/lib/types/utils/openExternal.js +170 -0
  330. package/lib/types/utils/paths.d.ts.map +1 -1
  331. package/lib/types/utils/paths.js +1 -0
  332. package/node_modules/@deepseek-harness-tui/dsh-auth/LICENSE +21 -0
  333. package/node_modules/@deepseek-harness-tui/dsh-auth/README.md +140 -0
  334. package/node_modules/@deepseek-harness-tui/dsh-auth/cordis.patch.yml +11 -0
  335. package/node_modules/@deepseek-harness-tui/dsh-auth/dsh-plugin.json +44 -0
  336. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/command.d.ts +14 -0
  337. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/command.js +67 -0
  338. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/credentials.d.ts +64 -0
  339. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/credentials.js +170 -0
  340. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/index.d.ts +79 -0
  341. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/index.js +196 -0
  342. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/interaction.d.ts +68 -0
  343. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/interaction.js +193 -0
  344. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/opener.d.ts +32 -0
  345. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/opener.js +101 -0
  346. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/profiles.d.ts +31 -0
  347. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/profiles.js +68 -0
  348. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/service.d.ts +69 -0
  349. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/service.js +129 -0
  350. package/node_modules/@deepseek-harness-tui/dsh-auth/package.json +70 -0
  351. package/node_modules/@dsh-std/command/CHANGELOG.md +8 -8
  352. package/node_modules/@dsh-std/command/LICENSE +21 -21
  353. package/node_modules/@dsh-std/command/README.md +26 -26
  354. package/node_modules/@dsh-std/command/README.zh.md +28 -28
  355. package/node_modules/@dsh-std/command/lib/index.js.map +1 -1
  356. package/node_modules/@dsh-std/command/package.json +22 -22
  357. package/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
  358. package/node_modules/@dsh-std/connection/LICENSE +21 -21
  359. package/node_modules/@dsh-std/connection/README.md +42 -42
  360. package/node_modules/@dsh-std/connection/README.zh.md +42 -42
  361. package/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
  362. package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
  363. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
  364. package/node_modules/@dsh-std/connection/package.json +20 -20
  365. package/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  366. package/node_modules/@dsh-std/core/LICENSE +21 -21
  367. package/node_modules/@dsh-std/core/README.md +13 -13
  368. package/node_modules/@dsh-std/core/README.zh.md +13 -13
  369. package/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  370. package/node_modules/@dsh-std/core/package.json +21 -21
  371. package/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -9
  372. package/node_modules/@dsh-std/manifest/LICENSE +21 -21
  373. package/node_modules/@dsh-std/manifest/README.md +5 -5
  374. package/node_modules/@dsh-std/manifest/README.zh.md +5 -5
  375. package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -1
  376. package/node_modules/@dsh-std/manifest/package.json +20 -20
  377. package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -144
  378. package/node_modules/@dsh-std/messages/CHANGELOG.md +8 -8
  379. package/node_modules/@dsh-std/messages/LICENSE +21 -21
  380. package/node_modules/@dsh-std/messages/README.md +5 -5
  381. package/node_modules/@dsh-std/messages/README.zh.md +7 -7
  382. package/node_modules/@dsh-std/messages/lib/index.js.map +1 -1
  383. package/node_modules/@dsh-std/messages/package.json +20 -20
  384. package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -54
  385. package/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -9
  386. package/node_modules/@dsh-std/presentation/LICENSE +21 -21
  387. package/node_modules/@dsh-std/presentation/README.md +27 -27
  388. package/node_modules/@dsh-std/presentation/README.zh.md +29 -29
  389. package/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -1
  390. package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -1
  391. package/node_modules/@dsh-std/presentation/package.json +25 -25
  392. package/node_modules/@dsh-std/storage/CHANGELOG.md +8 -8
  393. package/node_modules/@dsh-std/storage/LICENSE +21 -21
  394. package/node_modules/@dsh-std/storage/README.md +5 -5
  395. package/node_modules/@dsh-std/storage/README.zh.md +7 -7
  396. package/node_modules/@dsh-std/storage/lib/index.js.map +1 -1
  397. package/node_modules/@dsh-std/storage/package.json +20 -20
  398. package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -56
  399. package/package.json +19 -5
  400. package/presets/liangshen/.dsh-tui-managed.json +1 -1
  401. package/presets/liangshen/instruction-hint.mjs +8 -0
  402. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
  403. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -21
  404. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -42
  405. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -42
  406. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
  407. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
  408. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
  409. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -20
  410. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  411. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -21
  412. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -13
  413. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -13
  414. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  415. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -21
  416. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -9
  417. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -21
  418. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -5
  419. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -5
  420. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -1
  421. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -20
  422. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -144
  423. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -9
  424. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -21
  425. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +27 -27
  426. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +29 -29
  427. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -1
  428. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -1
  429. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +25 -25
  430. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  431. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -21
  432. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -13
  433. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -13
  434. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  435. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -21
  436. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  437. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -21
  438. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -13
  439. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -13
  440. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  441. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -21
  442. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  443. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -21
  444. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -13
  445. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -13
  446. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  447. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -21
  448. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
  449. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -21
  450. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -42
  451. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -42
  452. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
  453. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
  454. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
  455. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -20
  456. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  457. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -21
  458. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -13
  459. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -13
  460. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  461. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -21
  462. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  463. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -21
  464. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -13
  465. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -13
  466. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  467. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -21
@@ -1 +1 @@
1
- {"version":3,"file":"AlternateScreen.d.ts","sourceRoot":"","sources":["../../../../src/ink/components/AlternateScreen.tsx"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,EAAE,KAAA,OA8CjC"}
1
+ {"version":3,"file":"AlternateScreen.d.ts","sourceRoot":"","sources":["../../../../src/ink/components/AlternateScreen.tsx"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,EAAE,KAAA,OAyDjC"}
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { c as _c } from "react/compiler-runtime";
3
3
  import { useContext, useInsertionEffect } from 'react';
4
4
  import instances from '../instances.js';
5
+ import { logMouseDebug } from '../../utils/debug.js';
5
6
  import { DISABLE_MOUSE_TRACKING, ENABLE_MOUSE_TRACKING, ENTER_ALT_SCREEN, EXIT_ALT_SCREEN } from '../termio/dec.js';
6
7
  import { TerminalWriteContext } from '../useTerminalNotification.js';
7
8
  import Box from './Box.js';
@@ -36,13 +37,24 @@ export function AlternateScreen(t0) {
36
37
  let t3;
37
38
  if ($[0] !== mouseTracking || $[1] !== writeRaw) {
38
39
  t2 = () => {
39
- const ink = instances.get(process.stdout);
40
+ // Same fallback as Chat's reanchor plumbing: embedders and test
41
+ // harnesses render with a stdout that is not process.stdout, so the
42
+ // strict key lookup would miss the only live instance and the
43
+ // alt-screen flag would never flip — silently killing click/hover
44
+ // dispatch (both are gated on altScreenActive). The "any instance"
45
+ // fallback is deliberately narrowed to the SINGLE-instance case:
46
+ // with several live Ink instances (multi-app embedding, tests
47
+ // running in parallel) guessing the first one would flip the wrong
48
+ // app's alt-screen state.
49
+ const ink = instances.get(process.stdout) ?? (instances.size === 1 ? instances.values().next().value : undefined);
50
+ logMouseDebug('alt-screen enter', { mouseTracking, inkFound: ink !== undefined, writeRaw: !!writeRaw, stack: new Error().stack?.split('\n').slice(2, 5).join(' | ') });
40
51
  if (!writeRaw) {
41
52
  return;
42
53
  }
43
54
  writeRaw(ENTER_ALT_SCREEN + "\x1B[2J\x1B[H" + (mouseTracking ? ENABLE_MOUSE_TRACKING : ""));
44
55
  ink?.setAltScreenActive(true, mouseTracking);
45
56
  return () => {
57
+ logMouseDebug('alt-screen exit', { stack: new Error().stack?.split('\n').slice(2, 5).join(' | ') });
46
58
  ink?.setAltScreenActive(false);
47
59
  ink?.clearTextSelection();
48
60
  writeRaw((mouseTracking ? DISABLE_MOUSE_TRACKING : "") + EXIT_ALT_SCREEN);
@@ -15,13 +15,15 @@ type Props = {
15
15
  readonly terminalRows: number;
16
16
  readonly selection: SelectionState;
17
17
  readonly onSelectionChange: () => void;
18
- readonly onClickAt: (col: number, row: number) => boolean;
18
+ readonly onClickAt: (col: number, row: number, button?: number) => boolean;
19
19
  readonly onHoverAt: (col: number, row: number) => void;
20
+ readonly onWheelAt: (col: number, row: number, deltaY: number, deltaX: number, button?: number) => boolean;
20
21
  readonly getHyperlinkAt: (col: number, row: number) => string | undefined;
21
22
  readonly onOpenHyperlink: (url: string) => void;
22
23
  readonly onMultiClick: (col: number, row: number, count: 2 | 3) => void;
23
24
  readonly onSelectionDrag: (col: number, row: number) => void;
24
25
  readonly onStdinResume?: () => void;
26
+ readonly onTerminalFocus?: (focused: boolean) => void;
25
27
  readonly onCursorDeclaration?: CursorDeclarationSetter;
26
28
  readonly dispatchKeyboardEvent: (parsedKey: ParsedKey) => void;
27
29
  };
@@ -51,6 +53,15 @@ export default class App extends PureComponent<Props, State> {
51
53
  pendingHyperlinkTimer: ReturnType<typeof setTimeout> | null;
52
54
  lastHoverCol: number;
53
55
  lastHoverRow: number;
56
+ /**
57
+ * Reset all transient pointer state. Called by Ink when the alt screen
58
+ * is entered/exited and on resize: rects, hover targets, and the click
59
+ * chain from the previous screen geometry/scene must not leak into the
60
+ * new one (stale hover sets would suppress the next real onMouseEnter;
61
+ * a stale clickCount could turn the first click on a fresh screen into
62
+ * a double-click).
63
+ */
64
+ resetPointerState(): void;
54
65
  lastStdinTime: number;
55
66
  writeRaw: (data: string) => void;
56
67
  isRawModeSupported(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../src/ink/components/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAGN,KAAK,SAAS,EACd,KAAK,WAAW,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAGN,KAAK,cAAc,EAEnB,MAAM,iBAAiB,CAAC;AAWzB,OAAO,EAAE,eAAe,EAAa,MAAM,wBAAwB,CAAC;AAsBpE,OAAiC,EAChC,KAAK,uBAAuB,EAC5B,MAAM,+BAA+B,CAAC;AAgBvC,KAAK,KAAK,GAAG;IACZ,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE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../../utils/envUtils.js";
7
7
  import { isMouseClicksDisabled } from "../../utils/fullscreen.js";
8
+ import { isInputSuppressed } from "../input-suppression.js";
9
+ import { logMouseDebug } from "../../utils/debug.js";
8
10
  import { logError } from "../../utils/log.js";
9
11
  import { EventEmitter } from "../events/emitter.js";
10
12
  import { InputEvent } from "../events/input-event.js";
@@ -83,6 +85,34 @@ export default class App extends PureComponent {
83
85
  // repeat events (drag-then-release at same cell, etc.).
84
86
  lastHoverCol = -1;
85
87
  lastHoverRow = -1;
88
+ /**
89
+ * Reset all transient pointer state. Called by Ink when the alt screen
90
+ * is entered/exited and on resize: rects, hover targets, and the click
91
+ * chain from the previous screen geometry/scene must not leak into the
92
+ * new one (stale hover sets would suppress the next real onMouseEnter;
93
+ * a stale clickCount could turn the first click on a fresh screen into
94
+ * a double-click).
95
+ */
96
+ resetPointerState() {
97
+ this.clickCount = 0;
98
+ this.lastClickTime = 0;
99
+ this.lastClickCol = -1;
100
+ this.lastClickRow = -1;
101
+ this.lastHoverCol = -1;
102
+ this.lastHoverRow = -1;
103
+ if (this.pendingHyperlinkTimer) {
104
+ clearTimeout(this.pendingHyperlinkTimer);
105
+ this.pendingHyperlinkTimer = null;
106
+ }
107
+ // A drag interrupted by a screen swap has no release coming — settle
108
+ // the selection so copy-on-select fires rather than orphaning
109
+ // isDragging with its drag-to-scroll timer running.
110
+ const sel = this.props.selection;
111
+ if (sel.isDragging) {
112
+ finishSelection(sel);
113
+ this.props.onSelectionChange();
114
+ }
115
+ }
86
116
  // Timestamp of last stdin chunk. Used to detect long gaps (tmux attach,
87
117
  // ssh reconnect, laptop wake) and trigger terminal mode re-assert.
88
118
  // Initialized to now so startup doesn't false-trigger.
@@ -94,6 +124,9 @@ export default class App extends PureComponent {
94
124
  // <AlternateScreen>'s insertion effect every frame, flapping the alt
95
125
  // screen on/off.
96
126
  writeRaw = (data) => {
127
+ if (data.includes("\x1b[?1049")) {
128
+ logMouseDebug("stdout:1049", { len: data.length, head: data.slice(0, 60) });
129
+ }
97
130
  this.props.stdout.write(data);
98
131
  };
99
132
  // Determines if TTY is supported on the provided stdin
@@ -400,6 +433,32 @@ export default class App extends PureComponent {
400
433
  // Helper to process all keys within a single discrete update context.
401
434
  // discreteUpdates expects (fn, a, b, c, d) -> fn(a, b, c, d)
402
435
  function processKeysInBatch(app, items, _unused1, _unused2) {
436
+ // Mouse-chain diagnostics: the single choke point every parsed mouse and
437
+ // wheel event passes through. Empty log here = the terminal never sent
438
+ // the sequences (tracking modes, ConPTY) rather than an in-app loss.
439
+ if (process.env.DSH_TUI_DEBUG_MOUSE) {
440
+ for (const item of items) {
441
+ if (item.kind === "mouse") {
442
+ logMouseDebug("mouse arrive", {
443
+ button: item.button,
444
+ action: item.action,
445
+ col: item.col,
446
+ row: item.row,
447
+ clicksDisabled: isMouseClicksDisabled(),
448
+ });
449
+ }
450
+ else if (item.kind === "key" &&
451
+ (item.name === "wheelup" || item.name === "wheeldown")) {
452
+ logMouseDebug("wheel arrive", { name: item.name });
453
+ }
454
+ else if (item.kind === "key") {
455
+ logMouseDebug("key arrive", {
456
+ name: item.name,
457
+ seq: (item.sequence ?? "").slice(0, 10),
458
+ });
459
+ }
460
+ }
461
+ }
403
462
  // Update interaction time for notification timeout tracking.
404
463
  // This is called from the central input handler to avoid having multiple
405
464
  // stdin listeners that can cause race conditions and dropped input.
@@ -429,6 +488,10 @@ function processKeysInBatch(app, items, _unused1, _unused2) {
429
488
  // Handle terminal focus events (DECSET 1004)
430
489
  if (sequence === FOCUS_IN) {
431
490
  app.handleTerminalFocus(true);
491
+ // Refocus is the first observable moment after a terminal-side
492
+ // mode reset (conpty drops 1049/mouse on DPI moves, renderer
493
+ // restarts, window snapping): probe and self-heal.
494
+ app.props.onTerminalFocus?.(true);
432
495
  const event = new TerminalFocusEvent("terminalfocus");
433
496
  app.internal_eventEmitter.emit("terminalfocus", event);
434
497
  continue;
@@ -458,6 +521,37 @@ function processKeysInBatch(app, items, _unused1, _unused2) {
458
521
  app.handleSuspend();
459
522
  continue;
460
523
  }
524
+ // Wheel keys carry the pointer position (SGR/X10 col/row). Route
525
+ // position-first: if a scroll container sits under the pointer, its
526
+ // onWheel consumes the event and the legacy global keybinding path
527
+ // never fires — exactly one layer scrolls. Events without coords
528
+ // (shouldn't happen for wheel) or over non-scroll areas fall
529
+ // through to the normal input path (Chat scrolls the transcript).
530
+ // Skipped during the post-handoff suppression window: a terminal
531
+ // replay burst can contain mouse-wheel fragments, and use-input's
532
+ // choke point never sees events consumed here.
533
+ if ((item.name === "wheelup" ||
534
+ item.name === "wheeldown" ||
535
+ item.name === "wheelleft" ||
536
+ item.name === "wheelright") &&
537
+ item.mouseCol !== undefined &&
538
+ item.mouseRow !== undefined &&
539
+ !isInputSuppressed()) {
540
+ const step = (item.name === "wheelup" || item.name === "wheelleft") ? -3 : 3;
541
+ const deltaY = item.name === "wheelup" || item.name === "wheeldown" ? step : 0;
542
+ const deltaX = item.name === "wheelleft" || item.name === "wheelright" ? step : 0;
543
+ const consumed = app.props.onWheelAt(item.mouseCol, item.mouseRow, deltaY, deltaX);
544
+ if (consumed) {
545
+ logMouseDebug("wheel routed by position", {
546
+ col: item.mouseCol,
547
+ row: item.mouseRow,
548
+ deltaY,
549
+ deltaX,
550
+ name: item.name,
551
+ });
552
+ continue;
553
+ }
554
+ }
461
555
  app.handleInput(sequence);
462
556
  const event = new InputEvent(item);
463
557
  app.internal_eventEmitter.emit("input", event);
@@ -472,9 +566,12 @@ export function handleMouseEvent(app, m) {
472
566
  if (isMouseClicksDisabled())
473
567
  return;
474
568
  const sel = app.props.selection;
475
- // Terminal coords are 1-indexed; screen buffer is 0-indexed
476
- const col = m.col - 1;
477
- const row = m.row - 1;
569
+ // Terminal coords are 1-indexed; screen buffer is 0-indexed. Clamp to
570
+ // the current frame's dimensions: a resize (or a terminal reporting a
571
+ // stale position) can deliver coordinates outside the screen buffer,
572
+ // and selection/hyperlink reads assume in-bounds cells.
573
+ const col = Math.max(0, Math.min(m.col - 1, app.props.terminalColumns - 1));
574
+ const row = Math.max(0, Math.min(m.row - 1, app.props.terminalRows - 1));
478
575
  const baseButton = m.button & 0x03;
479
576
  if (m.action === "press") {
480
577
  if ((m.button & 0x20) !== 0 && baseButton === 3) {
@@ -582,7 +679,7 @@ export function handleMouseEvent(app, m) {
582
679
  // Single click: dispatch DOM click immediately (cursor repositioning
583
680
  // etc. are latency-sensitive). If no DOM handler consumed it, defer
584
681
  // the hyperlink check so a second click can cancel it.
585
- if (!app.props.onClickAt(col, row)) {
682
+ if (!app.props.onClickAt(col, row, m.button)) {
586
683
  // Resolve the hyperlink URL synchronously while the screen buffer
587
684
  // still reflects what the user clicked — deferring only the
588
685
  // browser-open so double-click can cancel it.
@@ -1 +1 @@
1
- {"version":3,"file":"ClockContext.d.ts","sourceRoot":"","sources":["../../../../src/ink/components/ClockContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAGlE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,SAAS,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;IACpE,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AACF,wBAAgB,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,KAAK,CA0DzD;AACD,eAAO,MAAM,YAAY,6BAAoC,CAAC;AAM9D,wBAAgB,aAAa,CAAC,EAAE,KAAA,OAiC/B"}
1
+ {"version":3,"file":"ClockContext.d.ts","sourceRoot":"","sources":["../../../../src/ink/components/ClockContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAIlE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,SAAS,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;IACpE,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AACF,wBAAgB,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,KAAK,CA2DzD;AACD,eAAO,MAAM,YAAY,6BAAoC,CAAC;AAM9D,wBAAgB,aAAa,CAAC,EAAE,KAAA,OAiC/B"}
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { c as _c } from "react/compiler-runtime";
3
3
  import { createContext, useEffect, useState } from 'react';
4
4
  import { FRAME_INTERVAL_MS } from '../constants.js';
5
+ import { noteFrameCause } from '../geometry-trace.js';
5
6
  import { useTerminalFocus } from '../hooks/use-terminal-focus.js';
6
7
  export function createClock(tickIntervalMs) {
7
8
  const subscribers = new Map();
@@ -13,6 +14,7 @@ export function createClock(tickIntervalMs) {
13
14
  let tickTime = 0;
14
15
  function tick() {
15
16
  tickTime = Date.now() - startTime;
17
+ noteFrameCause('animation');
16
18
  for (const onChange of subscribers.keys()) {
17
19
  onChange();
18
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollBox.d.ts","sourceRoot":"","sources":["../../../../src/ink/components/ScrollBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,GAAG,EAAyC,MAAM,OAAO,CAAC;AACvG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B;;;;;;OAMG;IACH,eAAe,EAAE,CAAC,EAAE,EAAE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;;;;GASG;AACH,iBAAS,SAAS,CAAC,EACjB,QAAQ,EACR,GAAG,EACH,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC,SAAS,CAqOrD;AACD,eAAe,SAAS,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useImperativeHandle, useRef, useState } from 'react';
2
+ import { useCallback, useImperativeHandle, useRef, useState } from 'react';
3
+ import { FRAME_INTERVAL_MS } from '../constants.js';
3
4
  import { markScrollActivity } from '../../bootstrap/state.js';
4
5
  import { markDirty, scheduleRenderFrom } from '../dom.js';
6
+ import { noteFrameCause } from '../geometry-trace.js';
5
7
  import { markCommitStart } from '../reconciler.js';
6
8
  import Box from './Box.js';
7
9
  /**
@@ -27,18 +29,56 @@ function ScrollBox({ children, ref, stickyScroll, ...style }) {
27
29
  const [, forceRender] = useState(0);
28
30
  const listenersRef = useRef(new Set());
29
31
  const renderQueuedRef = useRef(false);
32
+ // The imperative handle, kept in a ref so the onWheel handler below can
33
+ // call scrollBy through the full public path (clamp bounds, sticky
34
+ // clearing, subscriber notify) instead of duplicating its logic.
35
+ const handleRef = useRef(null);
30
36
  const notify = () => {
31
37
  for (const l of listenersRef.current)
32
38
  l();
33
39
  };
40
+ // Input-edge intent coalescing (Qwen Code's 16ms wheel merge, Crush's
41
+ // pre-queue filter): subscribers drive React state (MessageList's mount
42
+ // window, Chat's sticky flag, the timeline rail), so notifying per wheel
43
+ // EVENT runs a full React commit per event — a fast flick is 10-30
44
+ // events, each re-running the offsets/window/timeline loops on a big
45
+ // session. The scrollTop mutation and the ink render are already
46
+ // frame-throttled; this aligns the React commits to the same frame
47
+ // budget. Both edges defer to a microtask: the remaining input events of
48
+ // the same stdin batch then land BEFORE any commit, and one commit
49
+ // covers the whole batch (the sync leading edge used to run a full
50
+ // commit inside the wheel dispatch itself — pure input latency).
51
+ const notifyQueuedRef = useRef(false);
52
+ const lastNotifyAtRef = useRef(-Infinity);
53
+ const notifyCoalesced = () => {
54
+ const since = performance.now() - lastNotifyAtRef.current;
55
+ if (!notifyQueuedRef.current && since >= FRAME_INTERVAL_MS) {
56
+ notifyQueuedRef.current = true;
57
+ lastNotifyAtRef.current = performance.now();
58
+ queueMicrotask(() => {
59
+ notifyQueuedRef.current = false;
60
+ notify();
61
+ });
62
+ return;
63
+ }
64
+ if (notifyQueuedRef.current)
65
+ return;
66
+ notifyQueuedRef.current = true;
67
+ setTimeout(() => {
68
+ notifyQueuedRef.current = false;
69
+ lastNotifyAtRef.current = performance.now();
70
+ notify();
71
+ }, Math.max(0, FRAME_INTERVAL_MS - since));
72
+ };
34
73
  function scrollMutated(el) {
35
74
  // Signal background intervals (IDE poll, LSP poll, GCS fetch, orphan
36
75
  // check) to skip their next tick — they compete for the event loop and
37
76
  // contributed to 1402ms max frame gaps during scroll drain.
38
77
  markScrollActivity();
78
+ noteFrameCause('scroll');
39
79
  markDirty(el);
40
80
  markCommitStart();
41
- notify();
81
+ notifyCoalesced();
42
82
  if (renderQueuedRef.current)
43
83
  return;
44
84
  renderQueuedRef.current = true;
@@ -47,99 +87,138 @@ function ScrollBox({ children, ref, stickyScroll, ...style }) {
47
87
  scheduleRenderFrom(el);
48
88
  });
49
89
  }
50
- useImperativeHandle(ref, () => ({
51
- scrollTo(y) {
52
- const el = domRef.current;
53
- if (!el)
54
- return;
55
- // Explicit false overrides the DOM attribute so manual scroll
56
- // breaks stickiness. Render code checks ?? precedence.
57
- el.stickyScroll = false;
58
- el.pendingScrollDelta = undefined;
59
- el.scrollAnchor = undefined;
60
- el.scrollTop = Math.max(0, Math.floor(y));
61
- scrollMutated(el);
62
- },
63
- scrollToElement(el, offset = 0) {
64
- const box = domRef.current;
65
- if (!box)
66
- return;
67
- box.stickyScroll = false;
68
- box.pendingScrollDelta = undefined;
69
- box.scrollAnchor = {
70
- el,
71
- offset
72
- };
73
- scrollMutated(box);
74
- },
75
- scrollBy(dy) {
76
- const el = domRef.current;
77
- if (!el)
78
- return;
79
- el.stickyScroll = false;
80
- // Wheel input cancels any in-flight anchor seek — user override.
81
- el.scrollAnchor = undefined;
82
- // Accumulate in pendingScrollDelta; renderer drains it at a capped
83
- // rate so fast flicks show intermediate frames. Pure accumulator:
84
- // scroll-up followed by scroll-down naturally cancels.
85
- el.pendingScrollDelta = (el.pendingScrollDelta ?? 0) + Math.floor(dy);
86
- scrollMutated(el);
87
- },
88
- scrollToBottom() {
89
- const el = domRef.current;
90
- if (!el)
91
- return;
92
- el.pendingScrollDelta = undefined;
93
- el.stickyScroll = true;
94
- markDirty(el);
95
- notify();
96
- forceRender(n => n + 1);
97
- },
98
- getScrollTop() {
99
- return domRef.current?.scrollTop ?? 0;
100
- },
101
- getPendingDelta() {
102
- // Accumulated-but-not-yet-drained delta. useVirtualScroll needs
103
- // this to mount the union [committed, committed+pending] range —
104
- // otherwise intermediate drain frames find no children (blank).
105
- return domRef.current?.pendingScrollDelta ?? 0;
106
- },
107
- getScrollHeight() {
108
- return domRef.current?.scrollHeight ?? 0;
109
- },
110
- getFreshScrollHeight() {
111
- const content = domRef.current?.childNodes[0];
112
- return content?.yogaNode?.getComputedHeight() ?? domRef.current?.scrollHeight ?? 0;
113
- },
114
- getViewportHeight() {
115
- return domRef.current?.scrollViewportHeight ?? 0;
116
- },
117
- getViewportTop() {
118
- return domRef.current?.scrollViewportTop ?? 0;
119
- },
120
- isSticky() {
121
- const el = domRef.current;
122
- if (!el)
123
- return false;
124
- return el.stickyScroll ?? Boolean(el.attributes['stickyScroll']);
125
- },
126
- subscribe(listener) {
127
- listenersRef.current.add(listener);
128
- return () => listenersRef.current.delete(listener);
129
- },
130
- setClampBounds(min, max) {
131
- const el = domRef.current;
132
- if (!el)
133
- return;
134
- el.scrollClampMin = min;
135
- el.scrollClampMax = max;
136
- }
137
- }),
90
+ useImperativeHandle(ref, () => {
91
+ const handle = {
92
+ scrollTo(y) {
93
+ const el = domRef.current;
94
+ if (!el)
95
+ return;
96
+ // Explicit false overrides the DOM attribute so manual scroll
97
+ // breaks stickiness. Render code checks ?? precedence.
98
+ el.stickyScroll = false;
99
+ el.pendingScrollDelta = undefined;
100
+ el.scrollAnchor = undefined;
101
+ el.scrollTop = Math.max(0, Math.floor(y));
102
+ scrollMutated(el);
103
+ },
104
+ scrollToElement(el, offset = 0) {
105
+ const box = domRef.current;
106
+ if (!box)
107
+ return;
108
+ box.stickyScroll = false;
109
+ box.pendingScrollDelta = undefined;
110
+ box.scrollAnchor = {
111
+ el,
112
+ offset
113
+ };
114
+ scrollMutated(box);
115
+ },
116
+ scrollBy(dy) {
117
+ const el = domRef.current;
118
+ if (!el)
119
+ return;
120
+ el.stickyScroll = false;
121
+ // Wheel input cancels any in-flight anchor seek — user override.
122
+ el.scrollAnchor = undefined;
123
+ // Accumulate in pendingScrollDelta; renderer drains it at a capped
124
+ // rate so fast flicks show intermediate frames. Pure accumulator:
125
+ // scroll-up followed by scroll-down naturally cancels.
126
+ el.pendingScrollDelta = (el.pendingScrollDelta ?? 0) + Math.floor(dy);
127
+ scrollMutated(el);
128
+ },
129
+ scrollToBottom() {
130
+ const el = domRef.current;
131
+ if (!el)
132
+ return;
133
+ el.scrollAnchor = undefined;
134
+ const viewportH = el.scrollViewportHeight ?? 0;
135
+ const maxScroll = Math.max(0, (el.scrollHeight ?? 0) - viewportH);
136
+ const distance = maxScroll - (el.scrollTop ?? 0);
137
+ if (distance > viewportH && viewportH > 0) {
138
+ // FAR jump: drain instead of teleport. The viewport would land on
139
+ // rows that were never mounted — their spacer heights are
140
+ // DEFAULT_ROW_HEIGHT estimates, so the topPad swallows the view
141
+ // (blank transcript) AND it is a fixed point: unmounted rows never
142
+ // measure, nothing retried until the next wheel event. The drain
143
+ // walks the exact wheel path instead: proportional steps, the
144
+ // virtualization window follows per commit (it mounts the union of
145
+ // committed + pending), the visual clamp pins to the mounted edge
146
+ // while rows measure as they enter — no blank at any distance. The
147
+ // renderer's at-bottom re-pin restores sticky when it lands
148
+ // (stickyScroll=false + pending undefined + scrollTop >= maxScroll).
149
+ el.stickyScroll = false;
150
+ el.pendingScrollDelta = (el.pendingScrollDelta ?? 0) + distance;
151
+ scrollMutated(el);
152
+ return;
153
+ }
154
+ el.pendingScrollDelta = undefined;
155
+ el.stickyScroll = true;
156
+ // DOM-direct pre-write of the target (near jumps only): the notify
157
+ // below triggers MessageList's window recompute, and its React commit
158
+ // must read the NEW scrollTop — the old order (notify first, renderer
159
+ // moves scrollTop later) left the window one commit behind. The
160
+ // renderer's sticky branch re-pins scrollTop to the exact fresh
161
+ // maxScroll next frame, so a stale cached height costs one frame.
162
+ el.scrollTop = maxScroll;
163
+ scrollMutated(el);
164
+ forceRender(n => n + 1);
165
+ },
166
+ getScrollTop() {
167
+ return domRef.current?.scrollTop ?? 0;
168
+ },
169
+ getPendingDelta() {
170
+ // Accumulated-but-not-yet-drained delta. useVirtualScroll needs
171
+ // this to mount the union [committed, committed+pending] range —
172
+ // otherwise intermediate drain frames find no children (blank).
173
+ return domRef.current?.pendingScrollDelta ?? 0;
174
+ },
175
+ getScrollHeight() {
176
+ return domRef.current?.scrollHeight ?? 0;
177
+ },
178
+ getFreshScrollHeight() {
179
+ const content = domRef.current?.childNodes[0];
180
+ return content?.yogaNode?.getComputedHeight() ?? domRef.current?.scrollHeight ?? 0;
181
+ },
182
+ getViewportHeight() {
183
+ return domRef.current?.scrollViewportHeight ?? 0;
184
+ },
185
+ getViewportTop() {
186
+ return domRef.current?.scrollViewportTop ?? 0;
187
+ },
188
+ isSticky() {
189
+ const el = domRef.current;
190
+ if (!el)
191
+ return false;
192
+ return el.stickyScroll ?? Boolean(el.attributes['stickyScroll']);
193
+ },
194
+ subscribe(listener) {
195
+ listenersRef.current.add(listener);
196
+ return () => listenersRef.current.delete(listener);
197
+ },
198
+ setClampBounds(min, max) {
199
+ const el = domRef.current;
200
+ if (!el)
201
+ return;
202
+ el.scrollClampMin = min;
203
+ el.scrollClampMax = max;
204
+ }
205
+ };
206
+ handleRef.current = handle;
207
+ return handle;
208
+ },
138
209
  // notify/scrollMutated are inline (no useCallback) but only close over
139
210
  // refs + imports — stable. Empty deps avoids rebuilding the handle on
140
211
  // every render (which re-registers the ref = churn).
141
212
  // eslint-disable-next-line react-hooks/exhaustive-deps
142
213
  []);
214
+ // Position-routed wheel events (pointer over this box) scroll THIS box
215
+ // through the public scrollBy path — clamp bounds, sticky clearing, and
216
+ // subscriber notify all apply. Horizontal wheel (deltaX) has no renderer
217
+ // support yet (no scrollLeft in the DOM model) and is ignored.
218
+ const handleWheel = useCallback((e) => {
219
+ if (e.deltaY !== 0)
220
+ handleRef.current?.scrollBy(e.deltaY);
221
+ }, []);
143
222
  // Structure: outer viewport (overflow:scroll, constrained height) >
144
223
  // inner content (flexGrow:1, flexShrink:0 — fills at least the viewport
145
224
  // but grows beyond it for tall content). flexGrow:1 lets children use
@@ -159,7 +238,7 @@ function ScrollBox({ children, ref, stickyScroll, ...style }) {
159
238
  // must reach React subscribers too — see dom.ts onStickyRestore.
160
239
  el.onStickyRestore = notify;
161
240
  }
162
- }, style: {
241
+ }, onWheel: handleWheel, style: {
163
242
  flexWrap: 'nowrap',
164
243
  flexDirection: style.flexDirection ?? 'row',
165
244
  flexGrow: style.flexGrow ?? 0,
@@ -1,3 +1,12 @@
1
1
  /** Shared frame interval for render throttling and animations (~60fps). */
2
2
  export declare const FRAME_INTERVAL_MS = 16;
3
+ /**
4
+ * In-flight pty gate threshold (bytes) for scroll-drain frames — Grok
5
+ * Build's Presenter in_flight gate. While stdout holds more unflushed
6
+ * output than this, drain frames hold off instead of stacking latency
7
+ * into a slow ConPTY/ssh link. Sized above one full-screen diff (~4KB at
8
+ * 100 cols) so the gate only trips on genuine backlog, never on a single
9
+ * in-transit frame.
10
+ */
11
+ export declare const PTY_BACKLOG_BYTES = 8192;
3
12
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/ink/constants.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,KAAK,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/ink/constants.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,KAAK,CAAA;AAEnC;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAA"}
@@ -1,2 +1,11 @@
1
1
  /** Shared frame interval for render throttling and animations (~60fps). */
2
2
  export const FRAME_INTERVAL_MS = 16;
3
+ /**
4
+ * In-flight pty gate threshold (bytes) for scroll-drain frames — Grok
5
+ * Build's Presenter in_flight gate. While stdout holds more unflushed
6
+ * output than this, drain frames hold off instead of stacking latency
7
+ * into a slow ConPTY/ssh link. Sized above one full-screen diff (~4KB at
8
+ * 100 cols) so the gate only trips on genuine backlog, never on a single
9
+ * in-transit frame.
10
+ */
11
+ export const PTY_BACKLOG_BYTES = 8192;