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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/README.md +74 -21
  2. package/bin/dsh-tui.js +115 -25
  3. package/cordis.patch.yml +69 -17
  4. package/cordis.yml +50 -12
  5. package/lib/types/activityPrefs.d.ts +1 -1
  6. package/lib/types/activityPrefs.js +3 -3
  7. package/lib/types/cc/figures.d.ts +27 -20
  8. package/lib/types/cc/figures.d.ts.map +1 -1
  9. package/lib/types/cc/figures.js +43 -34
  10. package/lib/types/cc/format.d.ts +18 -9
  11. package/lib/types/cc/format.d.ts.map +1 -1
  12. package/lib/types/cc/format.js +26 -18
  13. package/lib/types/cc/markdown.d.ts +31 -16
  14. package/lib/types/cc/markdown.d.ts.map +1 -1
  15. package/lib/types/cc/markdown.js +283 -260
  16. package/lib/types/cc/terminal.d.ts +10 -7
  17. package/lib/types/cc/terminal.d.ts.map +1 -1
  18. package/lib/types/cc/terminal.js +62 -50
  19. package/lib/types/command-trees.d.ts +3 -0
  20. package/lib/types/command-trees.d.ts.map +1 -0
  21. package/lib/types/command-trees.js +4 -0
  22. package/lib/types/commands.d.ts +37 -1
  23. package/lib/types/commands.d.ts.map +1 -1
  24. package/lib/types/commands.js +68 -3
  25. package/lib/types/components/ActivityLine.d.ts +1 -1
  26. package/lib/types/components/ActivityLine.d.ts.map +1 -1
  27. package/lib/types/components/ActivityPicker.d.ts.map +1 -1
  28. package/lib/types/components/ActivityPicker.js +3 -4
  29. package/lib/types/components/BtwPanel.d.ts +16 -0
  30. package/lib/types/components/BtwPanel.d.ts.map +1 -0
  31. package/lib/types/components/BtwPanel.js +47 -0
  32. package/lib/types/components/CommandSuggestions.d.ts +4 -2
  33. package/lib/types/components/CommandSuggestions.d.ts.map +1 -1
  34. package/lib/types/components/CommandSuggestions.js +2 -2
  35. package/lib/types/components/EffortSlider.d.ts +15 -0
  36. package/lib/types/components/EffortSlider.d.ts.map +1 -0
  37. package/lib/types/components/EffortSlider.js +17 -0
  38. package/lib/types/components/GoalTodoPanel.d.ts +1 -1
  39. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  40. package/lib/types/components/HelpMenu.d.ts +5 -2
  41. package/lib/types/components/HelpMenu.d.ts.map +1 -1
  42. package/lib/types/components/HelpMenu.js +8 -3
  43. package/lib/types/components/HistorySearchDialog.d.ts +1 -1
  44. package/lib/types/components/HistorySearchDialog.d.ts.map +1 -1
  45. package/lib/types/components/HistorySearchDialog.js +21 -10
  46. package/lib/types/components/InterruptedByUser.d.ts +2 -2
  47. package/lib/types/components/InterruptedByUser.d.ts.map +1 -1
  48. package/lib/types/components/InterruptedByUser.js +4 -3
  49. package/lib/types/components/LoadedContextPanel.d.ts +1 -1
  50. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
  51. package/lib/types/components/LogoV2.d.ts.map +1 -1
  52. package/lib/types/components/LogoV2.js +2 -1
  53. package/lib/types/components/Markdown.d.ts +11 -11
  54. package/lib/types/components/Markdown.d.ts.map +1 -1
  55. package/lib/types/components/Markdown.js +63 -57
  56. package/lib/types/components/MarkdownTable.d.ts +1 -1
  57. package/lib/types/components/MarkdownTable.js +2 -2
  58. package/lib/types/components/MessageList.d.ts +10 -2
  59. package/lib/types/components/MessageList.d.ts.map +1 -1
  60. package/lib/types/components/MessageList.js +17 -10
  61. package/lib/types/components/ModelPicker.d.ts +4 -1
  62. package/lib/types/components/ModelPicker.d.ts.map +1 -1
  63. package/lib/types/components/ModelPicker.js +16 -4
  64. package/lib/types/components/OverlayAbove.d.ts +20 -0
  65. package/lib/types/components/OverlayAbove.d.ts.map +1 -0
  66. package/lib/types/components/OverlayAbove.js +18 -0
  67. package/lib/types/components/PresetPicker.d.ts +1 -1
  68. package/lib/types/components/PresetPicker.d.ts.map +1 -1
  69. package/lib/types/components/PresetPicker.js +2 -3
  70. package/lib/types/components/PromptInput.d.ts +5 -4
  71. package/lib/types/components/PromptInput.d.ts.map +1 -1
  72. package/lib/types/components/PromptInput.js +186 -39
  73. package/lib/types/components/ResumePicker.d.ts +15 -4
  74. package/lib/types/components/ResumePicker.d.ts.map +1 -1
  75. package/lib/types/components/ResumePicker.js +25 -9
  76. package/lib/types/components/RewindPicker.d.ts +1 -1
  77. package/lib/types/components/RewindPicker.d.ts.map +1 -1
  78. package/lib/types/components/RewindPicker.js +14 -5
  79. package/lib/types/components/SearchBox.d.ts +1 -1
  80. package/lib/types/components/SearchBox.js +1 -1
  81. package/lib/types/components/Spinner/GlimmerMessage.d.ts +1 -2
  82. package/lib/types/components/Spinner/GlimmerMessage.d.ts.map +1 -1
  83. package/lib/types/components/Spinner/GlimmerMessage.js +1 -2
  84. package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts +1 -1
  85. package/lib/types/components/Spinner/SpinnerAnimationRow.js +2 -2
  86. package/lib/types/components/Spinner/SpinnerGlyph.d.ts +1 -1
  87. package/lib/types/components/Spinner/SpinnerGlyph.js +1 -1
  88. package/lib/types/components/Spinner/spinnerUtils.d.ts +13 -18
  89. package/lib/types/components/Spinner/spinnerUtils.d.ts.map +1 -1
  90. package/lib/types/components/Spinner/spinnerUtils.js +67 -71
  91. package/lib/types/components/Spinner/useStalledAnimation.d.ts +1 -2
  92. package/lib/types/components/Spinner/useStalledAnimation.d.ts.map +1 -1
  93. package/lib/types/components/Spinner/useStalledAnimation.js +1 -2
  94. package/lib/types/components/StreamingMarkdown.d.ts +1 -1
  95. package/lib/types/components/StreamingMarkdown.js +1 -1
  96. package/lib/types/components/ThemePicker.d.ts +13 -9
  97. package/lib/types/components/ThemePicker.d.ts.map +1 -1
  98. package/lib/types/components/ThemePicker.js +21 -15
  99. package/lib/types/components/ThinkingToggle.d.ts +1 -1
  100. package/lib/types/components/ThinkingToggle.d.ts.map +1 -1
  101. package/lib/types/components/ThinkingToggle.js +8 -8
  102. package/lib/types/components/ToolUseLoader.d.ts +1 -1
  103. package/lib/types/components/ToolUseLoader.js +1 -1
  104. package/lib/types/components/WorkingSpinner.d.ts +2 -2
  105. package/lib/types/components/WorkingSpinner.js +2 -2
  106. package/lib/types/components/WorkspaceFlowPicker.d.ts +15 -0
  107. package/lib/types/components/WorkspaceFlowPicker.d.ts.map +1 -0
  108. package/lib/types/components/WorkspaceFlowPicker.js +19 -0
  109. package/lib/types/components/WorkspacePicker.d.ts +9 -0
  110. package/lib/types/components/WorkspacePicker.d.ts.map +1 -0
  111. package/lib/types/components/WorkspacePicker.js +13 -0
  112. package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
  113. package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
  114. package/lib/types/components/approvals/ApprovalPanel.js +2 -1
  115. package/lib/types/components/design-system/Byline.d.ts +1 -1
  116. package/lib/types/components/design-system/Byline.js +1 -1
  117. package/lib/types/components/design-system/Divider.d.ts +1 -1
  118. package/lib/types/components/design-system/Divider.js +1 -1
  119. package/lib/types/components/design-system/HintLine.d.ts +12 -0
  120. package/lib/types/components/design-system/HintLine.d.ts.map +1 -0
  121. package/lib/types/components/design-system/HintLine.js +15 -0
  122. package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +1 -1
  123. package/lib/types/components/design-system/KeyboardShortcutHint.js +1 -1
  124. package/lib/types/components/design-system/ListItem.d.ts +2 -2
  125. package/lib/types/components/design-system/ListItem.d.ts.map +1 -1
  126. package/lib/types/components/design-system/ListItem.js +35 -3
  127. package/lib/types/components/design-system/LoadingState.d.ts +1 -2
  128. package/lib/types/components/design-system/LoadingState.d.ts.map +1 -1
  129. package/lib/types/components/design-system/LoadingState.js +1 -2
  130. package/lib/types/components/design-system/Pane.d.ts +2 -2
  131. package/lib/types/components/design-system/Pane.js +2 -2
  132. package/lib/types/components/design-system/ProgressBar.d.ts +1 -2
  133. package/lib/types/components/design-system/ProgressBar.d.ts.map +1 -1
  134. package/lib/types/components/design-system/ProgressBar.js +1 -2
  135. package/lib/types/components/design-system/StatusIcon.d.ts +2 -2
  136. package/lib/types/components/design-system/StatusIcon.js +2 -2
  137. package/lib/types/components/design-system/ThemeProvider.d.ts +1 -1
  138. package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
  139. package/lib/types/components/design-system/ThemeProvider.js +87 -26
  140. package/lib/types/components/design-system/ThemedBox.d.ts +1 -1
  141. package/lib/types/components/design-system/ThemedBox.js +1 -1
  142. package/lib/types/components/design-system/ThemedText.d.ts +2 -2
  143. package/lib/types/components/design-system/ThemedText.js +2 -2
  144. package/lib/types/components/listWindow.d.ts +26 -0
  145. package/lib/types/components/listWindow.d.ts.map +1 -0
  146. package/lib/types/components/listWindow.js +47 -0
  147. package/lib/types/components/messages/AssistantTextMessage.d.ts +1 -2
  148. package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -1
  149. package/lib/types/components/messages/AssistantTextMessage.js +1 -2
  150. package/lib/types/components/messages/AssistantThinkingMessage.d.ts +2 -2
  151. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
  152. package/lib/types/components/messages/AssistantThinkingMessage.js +6 -6
  153. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +12 -4
  154. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  155. package/lib/types/components/messages/AssistantToolUseMessage.js +9 -5
  156. package/lib/types/components/messages/MessageMetadata.d.ts +1 -1
  157. package/lib/types/components/messages/MessageMetadata.js +1 -1
  158. package/lib/types/components/messages/UserPromptMessage.d.ts +1 -1
  159. package/lib/types/components/messages/UserPromptMessage.js +1 -1
  160. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -1
  161. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  162. package/lib/types/components/questions/AskUserQuestionPanel.js +11 -9
  163. package/lib/types/components/questions/PlanReviewPanel.d.ts +1 -1
  164. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  165. package/lib/types/components/questions/PlanReviewPanel.js +3 -2
  166. package/lib/types/components/trajectory/HotspotView.d.ts +14 -0
  167. package/lib/types/components/trajectory/HotspotView.d.ts.map +1 -0
  168. package/lib/types/components/trajectory/HotspotView.js +83 -0
  169. package/lib/types/components/trajectory/Inspector.d.ts +31 -0
  170. package/lib/types/components/trajectory/Inspector.d.ts.map +1 -0
  171. package/lib/types/components/trajectory/Inspector.js +67 -0
  172. package/lib/types/components/trajectory/Ledger.d.ts +20 -0
  173. package/lib/types/components/trajectory/Ledger.d.ts.map +1 -0
  174. package/lib/types/components/trajectory/Ledger.js +112 -0
  175. package/lib/types/components/trajectory/MiniWake.d.ts +24 -0
  176. package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -0
  177. package/lib/types/components/trajectory/MiniWake.js +99 -0
  178. package/lib/types/components/trajectory/WaveBand.d.ts +33 -0
  179. package/lib/types/components/trajectory/WaveBand.d.ts.map +1 -0
  180. package/lib/types/components/trajectory/WaveBand.js +145 -0
  181. package/lib/types/customTheme.d.ts +6 -6
  182. package/lib/types/customTheme.d.ts.map +1 -1
  183. package/lib/types/customTheme.js +15 -12
  184. package/lib/types/dsh-adapter/approvals.d.ts.map +1 -0
  185. package/lib/types/{channel.d.ts → dsh-adapter/channel.d.ts} +184 -43
  186. package/lib/types/dsh-adapter/channel.d.ts.map +1 -0
  187. package/lib/types/{channel.js → dsh-adapter/channel.js} +972 -201
  188. package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -0
  189. package/lib/types/{childStderr.js → dsh-adapter/childStderr.js} +1 -1
  190. package/lib/types/dsh-adapter/command-trees.d.ts +27 -0
  191. package/lib/types/dsh-adapter/command-trees.d.ts.map +1 -0
  192. package/lib/types/dsh-adapter/command-trees.js +42 -0
  193. package/lib/types/dsh-adapter/compat/index.d.ts +22 -0
  194. package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -0
  195. package/lib/types/{compat → dsh-adapter/compat}/index.js +7 -4
  196. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +86 -0
  197. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -0
  198. package/lib/types/dsh-adapter/compat/sessionLog.js +347 -0
  199. package/lib/types/dsh-adapter/contract.d.ts +20 -0
  200. package/lib/types/dsh-adapter/contract.d.ts.map +1 -0
  201. package/lib/types/dsh-adapter/contract.js +109 -0
  202. package/lib/types/dsh-adapter/index.d.ts +80 -0
  203. package/lib/types/dsh-adapter/index.d.ts.map +1 -0
  204. package/lib/types/dsh-adapter/index.js +45 -0
  205. package/lib/types/dsh-adapter/invariant.d.ts.map +1 -0
  206. package/lib/types/dsh-adapter/packaged-skills.d.ts.map +1 -0
  207. package/lib/types/{plugin.d.ts → dsh-adapter/plugin.d.ts} +17 -0
  208. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -0
  209. package/lib/types/{plugin.js → dsh-adapter/plugin.js} +280 -80
  210. package/lib/types/dsh-adapter/presets.d.ts.map +1 -0
  211. package/lib/types/dsh-adapter/providerWizard.d.ts +91 -0
  212. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -0
  213. package/lib/types/dsh-adapter/providerWizard.js +332 -0
  214. package/lib/types/{questions.d.ts → dsh-adapter/questions.d.ts} +7 -2
  215. package/lib/types/dsh-adapter/questions.d.ts.map +1 -0
  216. package/lib/types/{questions.js → dsh-adapter/questions.js} +15 -7
  217. package/lib/types/dsh-adapter/sideQuestion.d.ts +38 -0
  218. package/lib/types/dsh-adapter/sideQuestion.d.ts.map +1 -0
  219. package/lib/types/dsh-adapter/sideQuestion.js +69 -0
  220. package/lib/types/dsh-adapter/trajectory/aggregate.d.ts +46 -0
  221. package/lib/types/dsh-adapter/trajectory/aggregate.d.ts.map +1 -0
  222. package/lib/types/dsh-adapter/trajectory/aggregate.js +207 -0
  223. package/lib/types/dsh-adapter/trajectory/guards.d.ts +177 -0
  224. package/lib/types/dsh-adapter/trajectory/guards.d.ts.map +1 -0
  225. package/lib/types/dsh-adapter/trajectory/guards.js +235 -0
  226. package/lib/types/dsh-adapter/trajectory/index.d.ts +16 -0
  227. package/lib/types/dsh-adapter/trajectory/index.d.ts.map +1 -0
  228. package/lib/types/dsh-adapter/trajectory/index.js +15 -0
  229. package/lib/types/dsh-adapter/trajectory/inspect.d.ts +40 -0
  230. package/lib/types/dsh-adapter/trajectory/inspect.d.ts.map +1 -0
  231. package/lib/types/dsh-adapter/trajectory/inspect.js +160 -0
  232. package/lib/types/dsh-adapter/trajectory/projection.d.ts +128 -0
  233. package/lib/types/dsh-adapter/trajectory/projection.d.ts.map +1 -0
  234. package/lib/types/dsh-adapter/trajectory/projection.js +653 -0
  235. package/lib/types/dsh-adapter/trajectory/types.d.ts +232 -0
  236. package/lib/types/dsh-adapter/trajectory/types.d.ts.map +1 -0
  237. package/lib/types/dsh-adapter/trajectory/types.js +70 -0
  238. package/lib/types/dsh-adapter/trajectory/wave.d.ts +45 -0
  239. package/lib/types/dsh-adapter/trajectory/wave.d.ts.map +1 -0
  240. package/lib/types/dsh-adapter/trajectory/wave.js +210 -0
  241. package/lib/types/dsh-adapter/types.d.ts +23 -0
  242. package/lib/types/dsh-adapter/types.d.ts.map +1 -0
  243. package/lib/types/dsh-adapter/types.js +1 -0
  244. package/lib/types/dsh-adapter/workspace.d.ts +22 -0
  245. package/lib/types/dsh-adapter/workspace.d.ts.map +1 -0
  246. package/lib/types/dsh-adapter/workspace.js +16 -0
  247. package/lib/types/dsh-adapter/workspaces.d.ts +118 -0
  248. package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -0
  249. package/lib/types/dsh-adapter/workspaces.js +290 -0
  250. package/lib/types/effortPrefs.d.ts +1 -1
  251. package/lib/types/effortPrefs.js +3 -3
  252. package/lib/types/history.js +2 -2
  253. package/lib/types/hooks/useBlink.d.ts +1 -1
  254. package/lib/types/hooks/useBlink.js +1 -1
  255. package/lib/types/i18n.d.ts +977 -36
  256. package/lib/types/i18n.d.ts.map +1 -1
  257. package/lib/types/i18n.js +307 -30
  258. package/lib/types/index.d.ts +1 -69
  259. package/lib/types/index.d.ts.map +1 -1
  260. package/lib/types/index.js +3 -31
  261. package/lib/types/ink/components/App.d.ts.map +1 -1
  262. package/lib/types/ink/components/App.js +33 -19
  263. package/lib/types/ink/dom.d.ts +15 -0
  264. package/lib/types/ink/dom.d.ts.map +1 -1
  265. package/lib/types/ink/dom.js +32 -0
  266. package/lib/types/ink/hooks/use-input.d.ts.map +1 -1
  267. package/lib/types/ink/hooks/use-input.js +8 -0
  268. package/lib/types/ink/hooks/use-terminal-size.d.ts +1 -1
  269. package/lib/types/ink/hooks/use-terminal-size.js +1 -1
  270. package/lib/types/ink/ink.d.ts.map +1 -1
  271. package/lib/types/ink/ink.js +109 -28
  272. package/lib/types/ink/input-suppression.d.ts +20 -0
  273. package/lib/types/ink/input-suppression.d.ts.map +1 -0
  274. package/lib/types/ink/input-suppression.js +26 -0
  275. package/lib/types/ink/log-update.js +21 -6
  276. package/lib/types/ink/parse-keypress.d.ts +31 -0
  277. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  278. package/lib/types/ink/parse-keypress.js +442 -8
  279. package/lib/types/ink/terminal-querier.d.ts +5 -1
  280. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  281. package/lib/types/ink/terminal-querier.js +27 -3
  282. package/lib/types/ink/terminal.d.ts +18 -0
  283. package/lib/types/ink/terminal.d.ts.map +1 -1
  284. package/lib/types/ink/terminal.js +32 -4
  285. package/lib/types/ink/termio/csi.d.ts +10 -0
  286. package/lib/types/ink/termio/csi.d.ts.map +1 -1
  287. package/lib/types/ink/termio/csi.js +20 -0
  288. package/lib/types/ink/termio/tokenize.js +10 -0
  289. package/lib/types/modelPrefs.d.ts +1 -1
  290. package/lib/types/modelPrefs.js +3 -3
  291. package/lib/types/presetPrefs.d.ts +1 -1
  292. package/lib/types/presetPrefs.js +3 -3
  293. package/lib/types/screens/Chat.d.ts +20 -4
  294. package/lib/types/screens/Chat.d.ts.map +1 -1
  295. package/lib/types/screens/Chat.js +655 -55
  296. package/lib/types/screens/StatusLine.d.ts +17 -2
  297. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  298. package/lib/types/screens/StatusLine.js +12 -4
  299. package/lib/types/screens/TrajectoryScene.d.ts +16 -0
  300. package/lib/types/screens/TrajectoryScene.d.ts.map +1 -0
  301. package/lib/types/screens/TrajectoryScene.js +305 -0
  302. package/lib/types/sessionHistory.d.ts +9 -1
  303. package/lib/types/sessionHistory.d.ts.map +1 -1
  304. package/lib/types/sessionHistory.js +56 -16
  305. package/lib/types/sessionModes.d.ts +29 -0
  306. package/lib/types/sessionModes.d.ts.map +1 -0
  307. package/lib/types/sessionModes.js +45 -0
  308. package/lib/types/theme.d.ts +27 -3
  309. package/lib/types/theme.d.ts.map +1 -1
  310. package/lib/types/theme.js +48 -4
  311. package/lib/types/themePrefs.d.ts +3 -3
  312. package/lib/types/themePrefs.js +5 -5
  313. package/lib/types/trajectory/format.d.ts +100 -0
  314. package/lib/types/trajectory/format.d.ts.map +1 -0
  315. package/lib/types/trajectory/format.js +213 -0
  316. package/lib/types/trajectory/motion.d.ts +99 -0
  317. package/lib/types/trajectory/motion.d.ts.map +1 -0
  318. package/lib/types/trajectory/motion.js +143 -0
  319. package/lib/types/trajectory/query.d.ts +83 -0
  320. package/lib/types/trajectory/query.d.ts.map +1 -0
  321. package/lib/types/trajectory/query.js +187 -0
  322. package/lib/types/trajectoryPrefs.d.ts +36 -0
  323. package/lib/types/trajectoryPrefs.d.ts.map +1 -0
  324. package/lib/types/trajectoryPrefs.js +65 -0
  325. package/lib/types/update.d.ts +3 -3
  326. package/lib/types/update.d.ts.map +1 -1
  327. package/lib/types/update.js +18 -7
  328. package/lib/types/utils/clipboard.d.ts +101 -29
  329. package/lib/types/utils/clipboard.d.ts.map +1 -1
  330. package/lib/types/utils/clipboard.js +533 -55
  331. package/lib/types/utils/debug.d.ts +1 -1
  332. package/lib/types/utils/debug.js +2 -2
  333. package/lib/types/utils/execFileNoThrow.d.ts.map +1 -1
  334. package/lib/types/utils/execFileNoThrow.js +16 -6
  335. package/lib/types/utils/externalEditor.d.ts +115 -0
  336. package/lib/types/utils/externalEditor.d.ts.map +1 -0
  337. package/lib/types/utils/externalEditor.js +270 -0
  338. package/lib/types/utils/fullscreen.d.ts +2 -2
  339. package/lib/types/utils/fullscreen.js +3 -3
  340. package/lib/types/utils/loaded-context.d.ts +1 -1
  341. package/lib/types/utils/loaded-context.d.ts.map +1 -1
  342. package/lib/types/utils/modifiers.d.ts +24 -0
  343. package/lib/types/utils/modifiers.d.ts.map +1 -1
  344. package/lib/types/utils/modifiers.js +27 -0
  345. package/lib/types/utils/paths.d.ts +45 -0
  346. package/lib/types/utils/paths.d.ts.map +1 -0
  347. package/lib/types/utils/paths.js +69 -0
  348. package/lib/types/utils/shellQuote.d.ts +14 -0
  349. package/lib/types/utils/shellQuote.d.ts.map +1 -0
  350. package/lib/types/utils/shellQuote.js +39 -0
  351. package/lib/types/utils/workspaceRoot.d.ts +21 -0
  352. package/lib/types/utils/workspaceRoot.d.ts.map +1 -0
  353. package/lib/types/utils/workspaceRoot.js +47 -0
  354. package/lib/types/workspaces.d.ts +3 -0
  355. package/lib/types/workspaces.d.ts.map +1 -0
  356. package/lib/types/workspaces.js +4 -0
  357. package/package.json +25 -7
  358. package/lib/types/approvals.d.ts.map +0 -1
  359. package/lib/types/channel.d.ts.map +0 -1
  360. package/lib/types/childStderr.d.ts.map +0 -1
  361. package/lib/types/compat/index.d.ts +0 -20
  362. package/lib/types/compat/index.d.ts.map +0 -1
  363. package/lib/types/compat/sessionLog.d.ts +0 -40
  364. package/lib/types/compat/sessionLog.d.ts.map +0 -1
  365. package/lib/types/compat/sessionLog.js +0 -226
  366. package/lib/types/invariant.d.ts.map +0 -1
  367. package/lib/types/packaged-skills.d.ts.map +0 -1
  368. package/lib/types/plugin.d.ts.map +0 -1
  369. package/lib/types/presets.d.ts.map +0 -1
  370. package/lib/types/questions.d.ts.map +0 -1
  371. /package/lib/types/{approvals.d.ts → dsh-adapter/approvals.d.ts} +0 -0
  372. /package/lib/types/{approvals.js → dsh-adapter/approvals.js} +0 -0
  373. /package/lib/types/{childStderr.d.ts → dsh-adapter/childStderr.d.ts} +0 -0
  374. /package/lib/types/{invariant.d.ts → dsh-adapter/invariant.d.ts} +0 -0
  375. /package/lib/types/{invariant.js → dsh-adapter/invariant.js} +0 -0
  376. /package/lib/types/{packaged-skills.d.ts → dsh-adapter/packaged-skills.d.ts} +0 -0
  377. /package/lib/types/{packaged-skills.js → dsh-adapter/packaged-skills.js} +0 -0
  378. /package/lib/types/{presets.d.ts → dsh-adapter/presets.d.ts} +0 -0
  379. /package/lib/types/{presets.js → dsh-adapter/presets.js} +0 -0
@@ -1,70 +1,2 @@
1
- /**
2
- * dsh-tui plugin entry. The TUI implementation lives in `./plugin.tsx` (its
3
- * render path is JSX); this module owns the plugin surface (`name`/`inject`/
4
- * `Config`/`apply`) at the canonical `src/index.ts` location and delegates
5
- * `apply` through a dynamic import so entry-scanning tooling and the Loader
6
- * resolve a plain `.ts` module.
7
- * @module @deepseek-harness-tui/dsh-tui
8
- */
9
- import type { Context } from '@deepseek-ai/cordis';
10
- import Schema from '@deepseek-ai/schemastery';
11
- export declare const name = "dsh-tui";
12
- export declare const inject: string[];
13
- /**
14
- * dsh-tui plugin configuration: session attachment, model route, working
15
- * directory, and display preferences.
16
- */
17
- export interface Config {
18
- /** Existing session to attach; a fresh session is created when absent. */
19
- sessionId?: string;
20
- /** LLM provider route. The route resolves atomically (issue #67): when
21
- * cordis.yml names BOTH `provider` and `model`, that pair wins; otherwise
22
- * the `/model` choice persisted in `~/.dsh-cc/model.json` wins whole;
23
- * otherwise the harness defaults (`deepseek-official`). A provider-only
24
- * pin never half-overrides the persisted choice. */
25
- provider?: string;
26
- /** Model override passed to the agent; resolved together with `provider`
27
- * as one atomic route (see `provider`). Harness default model:
28
- * `deepseek-v4-flash`. */
29
- model?: string;
30
- /** Session working directory; defaults to the invoking directory. */
31
- cwd?: string;
32
- /** Reasoning effort applied to every request, validated against the live
33
- * route's adapter levels (an unlisted level is ignored and the adapter
34
- * default applies). Wins over the persisted Shift+Tab choice; also seeds
35
- * the startup status line until the first request header reports the
36
- * live value. */
37
- effort?: string;
38
- /** Show the dsh-working-activity live working line on the status bar
39
- * (consumes its log-only `activity/status` events; off hides it). */
40
- activity?: boolean;
41
- /** Working-activity indicator preset: `claude`/`moon`/`comet`/`dots`/…
42
- * or `random` (see activityFrames.ts). When absent, the `/activity`
43
- * choice persisted in `~/.dsh-cc/working-activity.json` wins, then the
44
- * `claude` default. */
45
- activityFrames?: string;
46
- /** Show the segmented context bar (the band under the input with the
47
- * `ctx used/window` readout) in the status footer; off hides that row
48
- * while the status/mode lines stay (issue #29). */
49
- contextBar?: boolean;
50
- /** Run in the terminal's alternate screen (Claude Code fullscreen layout). */
51
- fullscreen?: boolean;
52
- /** UI language: `en` / `zh`. When absent, the `CC_TUI_LANG` env var wins,
53
- * then the `/lang` choice persisted in `~/.dsh-cc/lang.json`, then `zh`. */
54
- lang?: string;
55
- /** Agent preset id new sessions compose from (standard/code/minimal/
56
- * cordis/… when the roster is mounted). When absent, the `/preset` choice
57
- * persisted in `~/.dsh-cc/agent-preset.json` wins, then the roster
58
- * default (`standard`). */
59
- preset?: string;
60
- }
61
- export declare const Config: Schema<Config>;
62
- /**
63
- * Start the interactive TUI front door, delegating to the JSX implementation
64
- * in `./plugin.tsx` (see its module doc for the full contract).
65
- * @param ctx - the plugin context.
66
- * @param config - the validated dsh-tui configuration.
67
- * @returns a promise settling when the TUI teardown completes.
68
- */
69
- export declare function apply(ctx: Context, config: Config): Promise<void>;
1
+ export * from './dsh-adapter/index.js';
70
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAE7C,eAAO,MAAM,IAAI,YAAY,CAAA;AAC7B,eAAO,MAAM,MAAM,UAAa,CAAA;AAEhC;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;yDAIqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;+BAE2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;sBAIkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;0EACsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;4BAGwB;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;wDAEoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;iFAC6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;gCAG4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,CAgBhC,CAAA;AAEF;;;;;;GAMG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAA"}
@@ -1,31 +1,3 @@
1
- import Schema from '@deepseek-ai/schemastery';
2
- export const name = 'dsh-tui';
3
- export const inject = ['agents'];
4
- export const Config = Schema.object({
5
- sessionId: Schema.string().required(false),
6
- // No schema defaults on the route: a `.default()` here would make an
7
- // unset key indistinguishable from an explicit cordis.yml choice and the
8
- // persisted `/model` preference could never win (issue #30). The defaults
9
- // live at the end of the fallback chain in modelRoute.ts instead.
10
- provider: Schema.string().required(false),
11
- model: Schema.string().required(false),
12
- cwd: Schema.string().required(false),
13
- effort: Schema.string().required(false),
14
- activity: Schema.boolean().default(true),
15
- activityFrames: Schema.string().required(false),
16
- contextBar: Schema.boolean().default(true),
17
- fullscreen: Schema.boolean().default(false),
18
- lang: Schema.string().required(false),
19
- preset: Schema.string().required(false),
20
- });
21
- /**
22
- * Start the interactive TUI front door, delegating to the JSX implementation
23
- * in `./plugin.tsx` (see its module doc for the full contract).
24
- * @param ctx - the plugin context.
25
- * @param config - the validated dsh-tui configuration.
26
- * @returns a promise settling when the TUI teardown completes.
27
- */
28
- export async function apply(ctx, config) {
29
- const { apply: ccTuiApply } = await import('./plugin.js');
30
- return ccTuiApply(ctx, config);
31
- }
1
+ // Re-export shim: the plugin factory lives in src/dsh-adapter/index.ts
2
+ // (the only module tree allowed to import official @deepseek-ai/* packages).
3
+ export * from './dsh-adapter/index.js';
@@ -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;AAUzB,OAAO,EAAE,eAAe,EAAa,MAAM,wBAAwB,CAAC;AAoBpE,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;I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AAM;IAClB,UAAU,SAAK;IAKf,qBAAqB,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAQ;IAInE,YAAY,SAAM;IAClB,YAAY,SAAM;IAKlB,aAAa,SAAc;IAQ3B,QAAQ,GAAI,MAAM,MAAM,KAAG,IAAI,CAE7B;IAGF,kBAAkB,IAAI,OAAO;IAGpB,MAAM;IA2CN,iBAAiB;IASjB,oBAAoB;IAwBpB,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAGvC,gBAAgB,GAAI,WAAW,OAAO,KAAG,IAAI,CA8F3C;IAGF,eAAe,QAAO,IAAI,CA0BxB;IAGF,YAAY,GAAI,OAAO,MAAM,GAAG,MAAM,GAAG,IAAI,KAAG,IAAI,CAsClD;IACF,cAAc,QAAO,IAAI,CAwCvB;IACF,WAAW,GAAI,OAAO,MAAM,GAAG,SAAS,KAAG,IAAI,CAS7C;IACF,UAAU,GAAI,QAAQ,KAAK,KAAG,IAAI,CAKhC;IACF,mBAAmB,GAAI,WAAW,OAAO,KAAG,IAAI,CAI9C;IACF,aAAa,QAAO,IAAI,CAiDtB;CACF;AAsFD,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,WAAW,GAAG,IAAI,CAsJ/D"}
@@ -12,10 +12,10 @@ import { TerminalFocusEvent } from "../events/terminal-focus-event.js";
12
12
  import { INITIAL_STATE, parseMultipleKeypresses, } from "../parse-keypress.js";
13
13
  import reconciler from "../reconciler.js";
14
14
  import { finishSelection, hasSelection, startSelection, } from "../selection.js";
15
- import { isXtermJs, setXtversionName, supportsExtendedKeys, } from "../terminal.js";
15
+ import { isXtermJs, setXtversionName, supportsExtendedKeys, supportsWin32InputMode, } from "../terminal.js";
16
16
  import { getTerminalFocused, setTerminalFocused, } from "../terminal-focus-state.js";
17
17
  import { TerminalQuerier, xtversion } from "../terminal-querier.js";
18
- import { DISABLE_KITTY_KEYBOARD, DISABLE_MODIFY_OTHER_KEYS, ENABLE_KITTY_KEYBOARD, ENABLE_MODIFY_OTHER_KEYS, FOCUS_IN, FOCUS_OUT, } from "../termio/csi.js";
18
+ import { DISABLE_KITTY_KEYBOARD, DISABLE_MODIFY_OTHER_KEYS, DISABLE_WIN32_INPUT_MODE, ENABLE_KITTY_KEYBOARD, ENABLE_MODIFY_OTHER_KEYS, ENABLE_WIN32_INPUT_MODE, FOCUS_IN, FOCUS_OUT, } from "../termio/csi.js";
19
19
  import { DBP, DFE, DISABLE_MOUSE_TRACKING, EBP, EFE, HIDE_CURSOR, SHOW_CURSOR, } from "../termio/dec.js";
20
20
  import AppContext from "./AppContext.js";
21
21
  import { ClockProvider } from "./ClockContext.js";
@@ -65,7 +65,7 @@ export default class App extends PureComponent {
65
65
  PASTE_TIMEOUT = 500; // Longer timeout for paste operations
66
66
  // Terminal query/response dispatch. Responses arrive on stdin (parsed
67
67
  // out by parse-keypress) and are routed to pending promise resolvers.
68
- querier = new TerminalQuerier(this.props.stdout);
68
+ querier = new TerminalQuerier(this.props.stdout, enabled => this.handleSetRawMode(enabled));
69
69
  // Multi-click tracking for double/triple-click text selection. A click
70
70
  // within MULTI_CLICK_TIMEOUT_MS and MULTI_CLICK_DISTANCE of the previous
71
71
  // click increments clickCount; otherwise it resets to 1.
@@ -139,9 +139,11 @@ export default class App extends PureComponent {
139
139
  clearImmediate(this.xtversionProbe);
140
140
  this.xtversionProbe = null;
141
141
  }
142
+ this.querier.dispose();
142
143
  // ignore calling setRawMode on an handle stdin it cannot be called
143
144
  if (this.isRawModeSupported()) {
144
- this.handleSetRawMode(false);
145
+ while (this.rawModeEnabledCount > 0)
146
+ this.handleSetRawMode(false);
145
147
  }
146
148
  }
147
149
  componentDidCatch(error) {
@@ -174,11 +176,18 @@ export default class App extends PureComponent {
174
176
  // Enable terminal focus reporting (DECSET 1004)
175
177
  this.props.stdout.write(EFE);
176
178
  // Enable extended key reporting so ctrl+shift+<letter> is
177
- // distinguishable from ctrl+<letter>. We write both the kitty stack
178
- // push (CSI >1u) and xterm modifyOtherKeys level 2 (CSI >4;2m) —
179
- // terminals honor whichever they implement (tmux only accepts the
180
- // latter).
181
- if (supportsExtendedKeys()) {
179
+ // distinguishable from ctrl+<letter>. On native Windows use
180
+ // win32-input-mode instead: kitty/modifyOtherKeys there never
181
+ // attach modifiers to Enter (microsoft/terminal#530), so
182
+ // Shift+Enter is only visible as a win32 INPUT_RECORD
183
+ // (issue #147). Elsewhere, write both the kitty stack push
184
+ // (CSI >1u) and xterm modifyOtherKeys level 2 (CSI >4;2m) —
185
+ // terminals honor whichever they implement (tmux only accepts
186
+ // the latter).
187
+ if (supportsWin32InputMode()) {
188
+ this.props.stdout.write(ENABLE_WIN32_INPUT_MODE);
189
+ }
190
+ else if (supportsExtendedKeys()) {
182
191
  this.props.stdout.write(ENABLE_KITTY_KEYBOARD);
183
192
  this.props.stdout.write(ENABLE_MODIFY_OTHER_KEYS);
184
193
  }
@@ -192,13 +201,9 @@ export default class App extends PureComponent {
192
201
  // tracking enable writes that may happen in the same render cycle.
193
202
  this.xtversionProbe = setImmediate(() => {
194
203
  this.xtversionProbe = null;
195
- // A short-lived raw-mode borrower (ThemeProvider's OSC 11 theme
196
- // probe) can acquire and release raw mode entirely within this
197
- // tick, so this deferred probe may fire after echo has already
198
- // been restored — the terminal's replies would then echo onto
199
- // the screen as visible garbage. Only query while raw mode is
200
- // still held; if it was released, the next acquisition (count
201
- // 0→1) queues a fresh probe.
204
+ // The original borrower may unmount before this callback runs.
205
+ // Once sent, TerminalQuerier keeps raw mode held until the reply
206
+ // and DA1 barrier arrive, so delayed responses cannot echo.
202
207
  if (this.rawModeEnabledCount === 0) {
203
208
  return;
204
209
  }
@@ -219,10 +224,15 @@ export default class App extends PureComponent {
219
224
  this.rawModeEnabledCount++;
220
225
  return;
221
226
  }
227
+ // Cleanups may race App unmount, which already drains every borrower.
228
+ if (this.rawModeEnabledCount === 0)
229
+ return;
222
230
  // Disable raw mode only when no components left that are using it
223
231
  if (--this.rawModeEnabledCount === 0) {
224
232
  this.props.stdout.write(DISABLE_MODIFY_OTHER_KEYS);
225
233
  this.props.stdout.write(DISABLE_KITTY_KEYBOARD);
234
+ // No-op on terminals that never entered win32-input-mode
235
+ this.props.stdout.write(DISABLE_WIN32_INPUT_MODE);
226
236
  // Disable terminal focus reporting (DECSET 1004)
227
237
  this.props.stdout.write(DFE);
228
238
  // Disable bracketed paste mode
@@ -274,9 +284,13 @@ export default class App extends PureComponent {
274
284
  if (this.incompleteEscapeTimer) {
275
285
  clearTimeout(this.incompleteEscapeTimer);
276
286
  }
277
- this.incompleteEscapeTimer = setTimeout(this.flushIncomplete, this.keyParseState.mode === "IN_PASTE"
278
- ? this.PASTE_TIMEOUT
279
- : this.NORMAL_TIMEOUT);
287
+ // win32Paste.active: a decomposed bracketed paste on classic
288
+ // conhost (markers arrive as win32 key records) gets the same
289
+ // long grace as token-level paste — a mid-paste flush would
290
+ // finalize early and turn the remaining body into real keys.
291
+ const inPaste = this.keyParseState.mode === "IN_PASTE" ||
292
+ this.keyParseState.win32Paste?.active === true;
293
+ this.incompleteEscapeTimer = setTimeout(this.flushIncomplete, inPaste ? this.PASTE_TIMEOUT : this.NORMAL_TIMEOUT);
280
294
  }
281
295
  };
282
296
  handleReadable = () => {
@@ -137,6 +137,21 @@ export declare const createTextNode: (text: string) => TextNode;
137
137
  * @param node - the node whose dirty chain to mark; a no-op when undefined.
138
138
  */
139
139
  export declare const markDirty: (node?: DOMNode) => void;
140
+ /**
141
+ * Invalidate cached layout for a whole subtree — the response to a viewport
142
+ * change.
143
+ *
144
+ * {@link markDirty} walks *upward* from the one node whose content changed,
145
+ * which is the right shape for every ordinary mutation: one node is new, its
146
+ * ancestors need to know. A resize is the opposite shape. Nothing in the tree
147
+ * changed, yet every measurement in it was taken against a width that no
148
+ * longer exists — so the invalidation has to run the other way, down to the
149
+ * leaves, or the nodes that were never touched keep answering with the sizes
150
+ * they computed for the old terminal.
151
+ *
152
+ * @param node - subtree root; a no-op when undefined.
153
+ */
154
+ export declare const markTreeDirty: (node?: DOMNode) => void;
140
155
  /**
141
156
  * Walk to the root and call its onRender (the throttled scheduleRender).
142
157
  * Use for DOM-level mutations (scrollTop changes) that should trigger an
@@ -1 +1 @@
1
- {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/ink/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAKlD,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAIrD,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,UAAU,GAAG,SAAS,CAAA;IAClC,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAA;AAC9B;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,SAAS,GACT,UAAU,GACV,kBAAkB,GAClB,UAAU,GACV,cAAc,GACd,cAAc,CAAA;AAElB;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAA;AAE/C;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,YAAY,CAAA;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IAC5C,UAAU,EAAE,OAAO,EAAE,CAAA;IACrB,UAAU,CAAC,EAAE,UAAU,CAAA;IAGvB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;IAE9B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAG5B,KAAK,EAAE,OAAO,CAAA;IAEd,QAAQ,CAAC,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AACH,eAAO,MAAM,YAAY,GACvB,MAAM,UAAU,EAChB,KAAK,MAAM,EACX,OAAO,gBAAgB,KACtB,IAaF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,OAAO,EAAE,OAAO,MAAM,KAAG,IAQvD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,MAAM,UAAU,EAChB,YAAY,UAAU,KACrB,IAUF,CAAA;AA6BD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,QAY7C,CAAA;AAoJD;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,IAoB1C,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,IAiB9C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,IAInD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,QAAQ,EAAE,MAAM,MAAM,KAAG,IAY/D,CAAA;AAMD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,MAAM,UAAU,GAAG,QAAQ,KAAG,IAOrE,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBzE"}
@@ -340,6 +340,38 @@ export const markDirty = (node) => {
340
340
  current = current.parentNode;
341
341
  }
342
342
  };
343
+ /**
344
+ * Invalidate cached layout for a whole subtree — the response to a viewport
345
+ * change.
346
+ *
347
+ * {@link markDirty} walks *upward* from the one node whose content changed,
348
+ * which is the right shape for every ordinary mutation: one node is new, its
349
+ * ancestors need to know. A resize is the opposite shape. Nothing in the tree
350
+ * changed, yet every measurement in it was taken against a width that no
351
+ * longer exists — so the invalidation has to run the other way, down to the
352
+ * leaves, or the nodes that were never touched keep answering with the sizes
353
+ * they computed for the old terminal.
354
+ *
355
+ * @param node - subtree root; a no-op when undefined.
356
+ */
357
+ export const markTreeDirty = (node) => {
358
+ const stack = node === undefined ? [] : [node];
359
+ while (stack.length > 0) {
360
+ const current = stack.pop();
361
+ if (current.nodeName === '#text')
362
+ continue;
363
+ const element = current;
364
+ element.dirty = true;
365
+ // markDirty() is only legal on yoga nodes that carry a measure function;
366
+ // those are exactly the two text node kinds (see createNode).
367
+ if ((current.nodeName === 'ink-text' || current.nodeName === 'ink-raw-ansi') &&
368
+ current.yogaNode) {
369
+ current.yogaNode.markDirty();
370
+ }
371
+ for (const child of element.childNodes)
372
+ stack.push(child);
373
+ }
374
+ };
343
375
  /**
344
376
  * Walk to the root and call its onRender (the throttled scheduleRender).
345
377
  * Use for DOM-level mutations (scrollTop changes) that should trigger an
@@ -1 +1 @@
1
- {"version":3,"file":"use-input.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-input.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAG/D,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;AAEnE,KAAK,OAAO,GAAG;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,QAAQ,GAAI,cAAc,OAAO,EAAE,UAAS,OAAY,KAAG,IAgDhE,CAAA;AAED,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"use-input.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-input.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAI/D,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;AAEnE,KAAK,OAAO,GAAG;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,QAAQ,GAAI,cAAc,OAAO,EAAE,UAAS,OAAY,KAAG,IAuDhE,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { useEffect, useLayoutEffect } from 'react';
2
2
  import { useEventCallback } from 'usehooks-ts';
3
+ import { isInputSuppressed } from '../input-suppression.js';
3
4
  import useStdin from './use-stdin.js';
4
5
  /**
5
6
  * This hook is used for handling user input.
@@ -55,6 +56,13 @@ const useInput = (inputHandler, options = {}) => {
55
56
  if (options.isActive === false) {
56
57
  return;
57
58
  }
59
+ // Post-handoff window (external editor restore): the byte burst the
60
+ // tty delivers right after stdin resumes is terminal chatter, not
61
+ // keystrokes — drop it here so NO listener sees it (a stray ESC would
62
+ // clear the prompt via Chat/PromptInput escape handling).
63
+ if (isInputSuppressed()) {
64
+ return;
65
+ }
58
66
  const { input, key } = event;
59
67
  // If app is not supposed to exit on Ctrl+C, then let input listener handle it
60
68
  // Note: discreteUpdates is called at the App level when emitting events,
@@ -1,5 +1,5 @@
1
1
  import { type TerminalSize } from '../components/TerminalSizeContext.js';
2
- /** Terminal dimensions from the Ink app shell (ported from the leak).
2
+ /** Terminal dimensions from the Ink app shell (from Claude Code).
3
3
  * @returns the current terminal dimensions.
4
4
  */
5
5
  export declare function useTerminalSize(): TerminalSize;
@@ -1,6 +1,6 @@
1
1
  import { useContext } from 'react';
2
2
  import { TerminalSizeContext, } from '../components/TerminalSizeContext.js';
3
- /** Terminal dimensions from the Ink app shell (ported from the leak).
3
+ /** Terminal dimensions from the Ink app shell (from Claude Code).
4
4
  * @returns the current terminal dimensions.
5
5
  */
6
6
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c,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAa5D;;;OAGG;IACH,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAEtD;;;;OAIG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIhC;;;;;;OAMG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI;IAc9D;;;;;OAKG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAanD,OAAO,CAAC,cAAc,CAGd;IACR,OAAO,CAAC,UAAU,CAAS;IAC3B,YAAY,IAAI,IAAI;IA8BpB,WAAW,IAAI,IAAI;IAoDnB,OAAO,CAAC,QAAQ;IAGhB,OAAO,CAAC,oBAAoB,CAK1B;IACF,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAa7B,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI;IAiFtC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAOpC,cAAc,IAAI,IAAI;IAYtB;;;;;;;OAOG;IACH,UAAU,IAAI,IAAI;IAUlB,YAAY,IAAI,MAAM,IAAI;IAqB1B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,WAAW;CAoCpB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAAgB,UAAU,CAAC,KAAK,GAAE,MAAM,CAAC,UAA0B,GAAG,IAAI,CAsDzE"}
@@ -19,6 +19,7 @@ import { FocusManager } from './focus.js';
19
19
  import { emptyFrame } from './frame.js';
20
20
  import { dispatchClick, dispatchHover } from './hit-test.js';
21
21
  import instances from './instances.js';
22
+ import { suppressInputFor } from './input-suppression.js';
22
23
  import { LogUpdate } from './log-update.js';
23
24
  import { nodeCache } from './node-cache.js';
24
25
  import { optimize } from './optimizer.js';
@@ -30,8 +31,8 @@ import createRenderer from './renderer.js';
30
31
  import { CharPool, cellAt, createScreen, HyperlinkPool, isEmptyCellAt, migrateScreenPools, StylePool } from './screen.js';
31
32
  import { applySearchHighlight } from './searchHighlight.js';
32
33
  import { applySelectionOverlay, captureScrolledRows, clearSelection, createSelectionState, extendSelection, findPlainTextUrlAt, getSelectedText, hasSelection, moveFocus, selectLineAt, selectWordAt, shiftAnchor, shiftSelection, shiftSelectionForFollow, startSelection, updateSelection } from './selection.js';
33
- import { SYNC_OUTPUT_SUPPORTED, supportsExtendedKeys, writeDiffToTerminal } from './terminal.js';
34
- import { CURSOR_HOME, cursorMove, cursorPosition, DISABLE_KITTY_KEYBOARD, DISABLE_MODIFY_OTHER_KEYS, ENABLE_KITTY_KEYBOARD, ENABLE_MODIFY_OTHER_KEYS, ERASE_SCREEN, SGR_RESET } from './termio/csi.js';
34
+ import { SYNC_OUTPUT_SUPPORTED, supportsExtendedKeys, supportsWin32InputMode, writeDiffToTerminal } from './terminal.js';
35
+ import { CURSOR_HOME, cursorMove, cursorPosition, DISABLE_KITTY_KEYBOARD, DISABLE_MODIFY_OTHER_KEYS, DISABLE_WIN32_INPUT_MODE, ENABLE_KITTY_KEYBOARD, ENABLE_MODIFY_OTHER_KEYS, ENABLE_WIN32_INPUT_MODE, ERASE_SCREEN, SGR_RESET } from './termio/csi.js';
35
36
  import { DBP, DFE, DISABLE_MOUSE_TRACKING, ENABLE_MOUSE_TRACKING, ENTER_ALT_SCREEN, EXIT_ALT_SCREEN, SHOW_CURSOR } from './termio/dec.js';
36
37
  import { CLEAR_ITERM2_PROGRESS, CLEAR_TAB_STATUS, setClipboard, supportsTabStatus, wrapForMultiplexer } from './termio/osc.js';
37
38
  import { TerminalWriteProvider } from './useTerminalNotification.js';
@@ -280,6 +281,15 @@ export default class Ink {
280
281
  this.terminalColumns = cols;
281
282
  this.terminalRows = rows;
282
283
  this.altScreenParkPatch = makeAltScreenParkPatch(this.terminalRows);
284
+ // Every cached measurement in the tree was taken against a width that no
285
+ // longer exists. Nothing here is "dirty" in the reconciler's sense — no
286
+ // props changed — so without an explicit sweep the text nodes keep
287
+ // answering with the sizes they computed for the old terminal, and the
288
+ // rows that depend on flex arbitration come out assembled from two
289
+ // different layouts. Setting the root's width alone does not reach them:
290
+ // markDirty walks upward from a changed node, and here the change is the
291
+ // constraint every node was measured against.
292
+ dom.markTreeDirty(this.rootNode);
283
293
  // Alt screen: reset frame buffers so the next render repaints from
284
294
  // scratch (prevFrameContaminated → every cell written, wrapped in
285
295
  // BSU/ESU — old content stays visible until the new frame swaps
@@ -322,7 +332,9 @@ export default class Ink {
322
332
  // Disable extended key reporting first — editors that don't speak
323
333
  // CSI-u (e.g. nano) show "Unknown sequence" for every Ctrl-<key> if
324
334
  // kitty/modifyOtherKeys stays active. exitAlternateScreen re-enables.
325
- DISABLE_KITTY_KEYBOARD + DISABLE_MODIFY_OTHER_KEYS + (this.altScreenMouseTracking ? DISABLE_MOUSE_TRACKING : '') + (
335
+ // win32-input-mode (native Windows) likewise must not leak into the
336
+ // editor — it would turn every key into INPUT_RECORD sequences.
337
+ DISABLE_WIN32_INPUT_MODE + DISABLE_KITTY_KEYBOARD + DISABLE_MODIFY_OTHER_KEYS + (this.altScreenMouseTracking ? DISABLE_MOUSE_TRACKING : '') + (
326
338
  // disable mouse (no-op if off)
327
339
  this.altScreenActive ? '' : '\x1b[?1049h') +
328
340
  // enter alt (already in alt if fullscreen)
@@ -350,33 +362,60 @@ export default class Ink {
350
362
  * returns, fullscreen scroll is dead.
351
363
  */
352
364
  exitAlternateScreen() {
353
- this.options.stdout.write((this.altScreenActive ? ENTER_ALT_SCREEN : '') +
354
- // re-enter alt — vim's rmcup dropped us to main
355
- '\x1b[2J' +
356
- // clear screen (now alt if fullscreen)
357
- '\x1b[H' + (
358
- // cursor home
359
- this.altScreenMouseTracking ? ENABLE_MOUSE_TRACKING : '') + (
360
- // re-enable mouse (skip if CLAUDE_CODE_DISABLE_MOUSE)
361
- this.altScreenActive ? '' : '\x1b[?1049l') +
362
- // exit alt (non-fullscreen only)
363
- '\x1b[?25l' // hide cursor (Ink manages)
364
- );
365
- this.resumeStdin();
366
365
  if (this.altScreenActive) {
366
+ // Fullscreen: re-enter alt FIRST — terminal editors (vim, nano, less)
367
+ // write smcup/rmcup, so the editor's rmcup on exit dropped us to the
368
+ // main screen; without re-entering, the 2J below would wipe the
369
+ // user's main-screen scrollback and later renders would land in main
370
+ // (native scroll returns, fullscreen scroll dies).
371
+ this.options.stdout.write(ENTER_ALT_SCREEN +
372
+ '\x1b[2J' +
373
+ // clear screen
374
+ '\x1b[H' + (
375
+ // cursor home
376
+ this.altScreenMouseTracking ? ENABLE_MOUSE_TRACKING : '') +
377
+ // re-enable mouse (skip if CLAUDE_CODE_DISABLE_MOUSE)
378
+ '\x1b[?25l' // hide cursor (Ink manages)
379
+ );
380
+ this.resumeStdin();
381
+ // Swallow the terminal's post-restore chatter (async CPR/DECRPM
382
+ // replies, mouse fragments): resumeStdin's drain only covers bytes
383
+ // already buffered, and a stray ESC would clear a non-empty prompt
384
+ // (issue #123 field report).
385
+ suppressInputFor(120);
367
386
  this.resetFramesForAltScreen();
387
+ this.resume();
368
388
  }
369
389
  else {
390
+ // Inline: pop alt FIRST (a no-op when the editor's rmcup already did
391
+ // it), THEN clear+home the main screen and force a full redraw from
392
+ // home — the same proven sequence as forceRedraw()/Ctrl+L. The
393
+ // previous order (2J before 1049l, plain repaint(), no contamination
394
+ // flag) erased the alt buffer or left the blit fast path copying
395
+ // from an empty frontFrame: the transcript stayed blank until the
396
+ // next message, and the desynced log-update cursor duplicated the
397
+ // frame below (issue #123 field report).
398
+ this.options.stdout.write('\x1b[?1049l' +
399
+ // exit alt before touching the main screen
400
+ SGR_RESET + ERASE_SCREEN + CURSOR_HOME +
401
+ // BCE-safe clear from home, cursor parked top-left for the redraw
402
+ '\x1b[?25l' // hide cursor (Ink manages)
403
+ );
404
+ this.resumeStdin();
405
+ suppressInputFor(120);
370
406
  this.repaint();
407
+ // repaint()'s fresh empty frontFrame would let the blit fast path
408
+ // copy blanks and diff to nothing — same flag forceRedraw() sets.
409
+ this.prevFrameContaminated = true;
410
+ this.resume();
371
411
  }
372
- this.resume();
373
412
  // Re-enable focus reporting and extended key reporting — terminal
374
413
  // editors (vim, nano, etc.) write their own modifyOtherKeys level on
375
414
  // entry and reset it on exit, leaving us unable to distinguish
376
415
  // ctrl+shift+<letter> from ctrl+<letter>. Pop-before-push keeps the
377
416
  // Kitty stack balanced (a well-behaved editor restores our entry, so
378
417
  // without the pop we'd accumulate depth on each editor round-trip).
379
- this.options.stdout.write('\x1b[?1004h' + (supportsExtendedKeys() ? DISABLE_KITTY_KEYBOARD + ENABLE_KITTY_KEYBOARD + ENABLE_MODIFY_OTHER_KEYS : ''));
418
+ this.options.stdout.write('\x1b[?1004h' + (supportsWin32InputMode() ? ENABLE_WIN32_INPUT_MODE : supportsExtendedKeys() ? DISABLE_KITTY_KEYBOARD + ENABLE_KITTY_KEYBOARD + ENABLE_MODIFY_OTHER_KEYS : ''));
380
419
  }
381
420
  onRender() {
382
421
  if (this.isUnmounted || this.isPaused) {
@@ -618,7 +657,7 @@ export default class Ink {
618
657
  y: rect.y + decl.relativeY
619
658
  } : null;
620
659
  const parked = this.displayCursor;
621
- // Diagnostics: the resolved park target per frame (CC_TUI_DEBUG only).
660
+ // Diagnostics: the resolved park target per frame (DSH_TUI_DEBUG only).
622
661
  // ConPTY's readback drops trailing cursor moves, so pty probes can't
623
662
  // observe the park position — this trace is the ground truth of where
624
663
  // the native cursor is being told to go.
@@ -865,8 +904,12 @@ export default class Ink {
865
904
  // Extended keys — re-assert if enabled (App.tsx enables these on
866
905
  // allowlisted terminals at raw-mode entry; a terminal reset clears them).
867
906
  // Pop-before-push keeps Kitty stack depth at 1 instead of accumulating
868
- // on each call.
869
- if (supportsExtendedKeys()) {
907
+ // on each call. win32-input-mode is a plain DEC private mode (no stack),
908
+ // so a bare re-set suffices.
909
+ if (supportsWin32InputMode()) {
910
+ this.options.stdout.write(ENABLE_WIN32_INPUT_MODE);
911
+ }
912
+ else if (supportsExtendedKeys()) {
870
913
  this.options.stdout.write(DISABLE_KITTY_KEYBOARD + ENABLE_KITTY_KEYBOARD + ENABLE_MODIFY_OTHER_KEYS);
871
914
  }
872
915
  if (!this.altScreenActive) {
@@ -909,6 +952,22 @@ export default class Ink {
909
952
  // Cancel any pending throttled render so it doesn't fire between
910
953
  // cleanupTerminalModes() and process.exit() and write to main screen.
911
954
  this.scheduleRender.cancel?.();
955
+ // Shutdown bypasses the normal unmount path, so release the process and
956
+ // stdout listeners here as well. Otherwise a SIGCONT or resize arriving
957
+ // while an updater is running can re-enter the alternate screen or render
958
+ // through this detached instance after terminal cleanup has completed.
959
+ this.unsubscribeTTYHandlers?.();
960
+ this.unsubscribeExit();
961
+ // `detachForShutdown()` deliberately makes later `unmount()` calls a
962
+ // no-op, so release process-level output patches here rather than relying
963
+ // on unmount() to do it. The shutdown continuation may run an updater
964
+ // (or report its failure) after this point; leaving stderr intercepted
965
+ // would silently route those messages to the debug log instead of the
966
+ // terminal.
967
+ if (typeof this.restoreConsole === 'function') {
968
+ this.restoreConsole();
969
+ }
970
+ this.restoreStderr?.();
912
971
  // Restore stdin from raw mode. unmount() used to do this via React
913
972
  // unmount (App.componentWillUnmount → handleSetRawMode(false)) but we're
914
973
  // short-circuiting that path. Must use this.options.stdin — NOT
@@ -917,7 +976,14 @@ export default class Ink {
917
976
  const stdin = this.options.stdin;
918
977
  this.drainStdin();
919
978
  if (stdin.isTTY && stdin.isRaw && stdin.setRawMode) {
920
- stdin.setRawMode(false);
979
+ try {
980
+ stdin.setRawMode(false);
981
+ }
982
+ catch {
983
+ // The TTY may have been revoked (for example after an SSH
984
+ // disconnect). Shutdown must continue even if raw-mode restoration
985
+ // is no longer possible.
986
+ }
921
987
  }
922
988
  }
923
989
  /** @see drainStdin */
@@ -1360,12 +1426,9 @@ export default class Ink {
1360
1426
  level: 'warn'
1361
1427
  });
1362
1428
  }
1363
- logForDebugging(`[stdin] resumeStdin: re-attaching ${this.stdinListeners.length} listener(s), wasRawMode=${this.wasRawMode}`);
1364
- this.stdinListeners.forEach(({ event, listener }) => {
1365
- stdin.addListener(event, listener);
1366
- });
1367
- this.stdinListeners = [];
1368
- // Re-enable raw mode if it was enabled before
1429
+ // Raw mode FIRST: the editor restored the tty to canonical mode on
1430
+ // exit, so keystrokes typed during the handoff window are sitting in
1431
+ // the kernel line buffer; setRawMode(true) makes them readable.
1369
1432
  if (this.wasRawMode) {
1370
1433
  const stdinWithRaw = stdin;
1371
1434
  if (stdinWithRaw.setRawMode) {
@@ -1373,6 +1436,22 @@ export default class Ink {
1373
1436
  }
1374
1437
  this.wasRawMode = false;
1375
1438
  }
1439
+ // Drain every already-buffered byte BEFORE the listeners come back:
1440
+ // line-buffer leftovers, editor exit-sequence replies (CPR/DECRPM),
1441
+ // mouse-event fragments. Parsed as input they are destructive — a
1442
+ // stray ESC clears a non-empty prompt, the rest lands as text garbage
1443
+ // (issue #123 field report). Bytes arriving LATE (async terminal
1444
+ // replies) are covered by the suppression window in
1445
+ // exitAlternateScreen.
1446
+ let chunk;
1447
+ while ((chunk = stdin.read()) !== null) {
1448
+ void chunk;
1449
+ }
1450
+ logForDebugging(`[stdin] resumeStdin: re-attaching ${this.stdinListeners.length} listener(s)`);
1451
+ this.stdinListeners.forEach(({ event, listener }) => {
1452
+ stdin.addListener(event, listener);
1453
+ });
1454
+ this.stdinListeners = [];
1376
1455
  }
1377
1456
  // Stable identity for TerminalWriteContext. An inline arrow here would
1378
1457
  // change on every render() call (initial mount + each resize), which
@@ -1433,6 +1512,8 @@ export default class Ink {
1433
1512
  // Disable extended key reporting (both kitty and modifyOtherKeys)
1434
1513
  writeSync(1, DISABLE_MODIFY_OTHER_KEYS);
1435
1514
  writeSync(1, DISABLE_KITTY_KEYBOARD);
1515
+ // Disable win32-input-mode (no-op where never enabled)
1516
+ writeSync(1, DISABLE_WIN32_INPUT_MODE);
1436
1517
  // Disable focus events (DECSET 1004)
1437
1518
  writeSync(1, DFE);
1438
1519
  // Disable bracketed paste mode