@deepseek-harness-tui/dsh-tui 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/README.md +32 -15
  2. package/cordis.patch.yml +21 -2
  3. package/cordis.yml +12 -1
  4. package/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -0
  5. package/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -0
  6. package/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -0
  7. package/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -0
  8. package/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -0
  9. package/dsh-ecosystem-spec/protocols/tui-channel.js +166 -0
  10. package/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -0
  11. package/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -0
  12. package/dsh-ecosystem-spec/registry/README.md +14 -0
  13. package/dsh-ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
  14. package/dsh-ecosystem-spec/registry/contracts/scene-v1alpha1.json +13 -0
  15. package/dsh-ecosystem-spec/registry/contracts/settings-section-v1alpha1.json +13 -0
  16. package/dsh-ecosystem-spec/registry/contracts/tui-channel-v1alpha1.json +30 -0
  17. package/dsh-ecosystem-spec/registry/contracts/workspace-provider-v1alpha1.json +6 -0
  18. package/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
  19. package/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -0
  20. package/dsh-ecosystem-spec/registry/registry-0.15.json +149 -0
  21. package/dsh-ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
  22. package/dsh-ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
  23. package/dsh-ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
  24. package/lib/types/cc/figures.d.ts +4 -0
  25. package/lib/types/cc/figures.d.ts.map +1 -1
  26. package/lib/types/cc/figures.js +4 -0
  27. package/lib/types/command-trees.d.ts +2 -1
  28. package/lib/types/command-trees.d.ts.map +1 -1
  29. package/lib/types/command-trees.js +1 -1
  30. package/lib/types/commands.d.ts.map +1 -1
  31. package/lib/types/commands.js +2 -0
  32. package/lib/types/components/ExtensionDialog.d.ts +40 -0
  33. package/lib/types/components/ExtensionDialog.d.ts.map +1 -0
  34. package/lib/types/components/ExtensionDialog.js +210 -0
  35. package/lib/types/components/HelpMenu.js +1 -1
  36. package/lib/types/components/LoadedContextPanel.d.ts +5 -5
  37. package/lib/types/components/LoadedContextPanel.js +6 -6
  38. package/lib/types/components/LogoV2.d.ts.map +1 -1
  39. package/lib/types/components/LogoV2.js +16 -8
  40. package/lib/types/components/Markdown.d.ts +13 -1
  41. package/lib/types/components/Markdown.d.ts.map +1 -1
  42. package/lib/types/components/Markdown.js +15 -1
  43. package/lib/types/components/MessageList.d.ts +3 -1
  44. package/lib/types/components/MessageList.d.ts.map +1 -1
  45. package/lib/types/components/MessageList.js +111 -6
  46. package/lib/types/components/PromptInput.d.ts.map +1 -1
  47. package/lib/types/components/PromptInput.js +26 -12
  48. package/lib/types/components/RewindPicker.d.ts +13 -1
  49. package/lib/types/components/RewindPicker.d.ts.map +1 -1
  50. package/lib/types/components/RewindPicker.js +26 -2
  51. package/lib/types/components/StreamingMarkdown.d.ts +2 -8
  52. package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
  53. package/lib/types/components/StreamingMarkdown.js +51 -9
  54. package/lib/types/components/ToolUseLoader.d.ts +8 -3
  55. package/lib/types/components/ToolUseLoader.d.ts.map +1 -1
  56. package/lib/types/components/ToolUseLoader.js +43 -9
  57. package/lib/types/components/activityFrames.d.ts +1 -1
  58. package/lib/types/components/activityFrames.d.ts.map +1 -1
  59. package/lib/types/components/activityFrames.js +4 -1
  60. package/lib/types/components/messages/AssistantThinkingMessage.d.ts +5 -1
  61. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
  62. package/lib/types/components/messages/AssistantThinkingMessage.js +26 -3
  63. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  64. package/lib/types/components/messages/AssistantToolUseMessage.js +13 -2
  65. package/lib/types/dsh-adapter/channel.d.ts +61 -11
  66. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  67. package/lib/types/dsh-adapter/channel.js +767 -120
  68. package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -1
  69. package/lib/types/dsh-adapter/childStderr.js +10 -0
  70. package/lib/types/dsh-adapter/command-attribution.d.ts +51 -0
  71. package/lib/types/dsh-adapter/command-attribution.d.ts.map +1 -0
  72. package/lib/types/dsh-adapter/command-attribution.js +93 -0
  73. package/lib/types/dsh-adapter/command-errors.d.ts +42 -0
  74. package/lib/types/dsh-adapter/command-errors.d.ts.map +1 -0
  75. package/lib/types/dsh-adapter/command-errors.js +63 -0
  76. package/lib/types/dsh-adapter/command-trees.d.ts +7 -1
  77. package/lib/types/dsh-adapter/command-trees.d.ts.map +1 -1
  78. package/lib/types/dsh-adapter/command-trees.js +70 -20
  79. package/lib/types/dsh-adapter/component-identity.d.ts +33 -0
  80. package/lib/types/dsh-adapter/component-identity.d.ts.map +1 -0
  81. package/lib/types/dsh-adapter/component-identity.js +108 -0
  82. package/lib/types/dsh-adapter/contract.d.ts +1 -1
  83. package/lib/types/dsh-adapter/contract.js +2 -2
  84. package/lib/types/dsh-adapter/decision-guard.d.ts +84 -0
  85. package/lib/types/dsh-adapter/decision-guard.d.ts.map +1 -0
  86. package/lib/types/dsh-adapter/decision-guard.js +348 -0
  87. package/lib/types/dsh-adapter/dialogs.d.ts +145 -0
  88. package/lib/types/dsh-adapter/dialogs.d.ts.map +1 -0
  89. package/lib/types/dsh-adapter/dialogs.js +316 -0
  90. package/lib/types/dsh-adapter/effect-ledger.d.ts +91 -0
  91. package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -0
  92. package/lib/types/dsh-adapter/effect-ledger.js +251 -0
  93. package/lib/types/dsh-adapter/extension-events.d.ts +193 -0
  94. package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -0
  95. package/lib/types/dsh-adapter/extension-events.js +207 -0
  96. package/lib/types/dsh-adapter/extensions.d.ts +32 -0
  97. package/lib/types/dsh-adapter/extensions.d.ts.map +1 -0
  98. package/lib/types/dsh-adapter/extensions.js +42 -0
  99. package/lib/types/dsh-adapter/grants.d.ts +25 -0
  100. package/lib/types/dsh-adapter/grants.d.ts.map +1 -0
  101. package/lib/types/dsh-adapter/grants.js +213 -0
  102. package/lib/types/dsh-adapter/host-access.d.ts +37 -0
  103. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -0
  104. package/lib/types/dsh-adapter/host-access.js +652 -0
  105. package/lib/types/dsh-adapter/host-descriptor.d.ts +24 -0
  106. package/lib/types/dsh-adapter/host-descriptor.d.ts.map +1 -0
  107. package/lib/types/dsh-adapter/host-descriptor.js +169 -0
  108. package/lib/types/dsh-adapter/index.d.ts +4 -0
  109. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  110. package/lib/types/dsh-adapter/index.js +1 -0
  111. package/lib/types/dsh-adapter/message-observer.d.ts +173 -0
  112. package/lib/types/dsh-adapter/message-observer.d.ts.map +1 -0
  113. package/lib/types/dsh-adapter/message-observer.js +553 -0
  114. package/lib/types/dsh-adapter/plugin-host.d.ts +136 -0
  115. package/lib/types/dsh-adapter/plugin-host.d.ts.map +1 -0
  116. package/lib/types/dsh-adapter/plugin-host.js +365 -0
  117. package/lib/types/dsh-adapter/plugin-storage.d.ts +108 -0
  118. package/lib/types/dsh-adapter/plugin-storage.d.ts.map +1 -0
  119. package/lib/types/dsh-adapter/plugin-storage.js +397 -0
  120. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  121. package/lib/types/dsh-adapter/plugin.js +124 -14
  122. package/lib/types/dsh-adapter/plugins-info.d.ts +43 -0
  123. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -0
  124. package/lib/types/dsh-adapter/plugins-info.js +276 -0
  125. package/lib/types/dsh-adapter/promptDebug.d.ts +0 -6
  126. package/lib/types/dsh-adapter/promptDebug.d.ts.map +1 -1
  127. package/lib/types/dsh-adapter/promptDebug.js +13 -4
  128. package/lib/types/dsh-adapter/renderers.d.ts +57 -0
  129. package/lib/types/dsh-adapter/renderers.d.ts.map +1 -0
  130. package/lib/types/dsh-adapter/renderers.js +173 -0
  131. package/lib/types/dsh-adapter/sanitize.d.ts +36 -0
  132. package/lib/types/dsh-adapter/sanitize.d.ts.map +1 -0
  133. package/lib/types/dsh-adapter/sanitize.js +65 -0
  134. package/lib/types/dsh-adapter/scenes.d.ts +15 -5
  135. package/lib/types/dsh-adapter/scenes.d.ts.map +1 -1
  136. package/lib/types/dsh-adapter/scenes.js +149 -35
  137. package/lib/types/dsh-adapter/settings-sections.d.ts +7 -3
  138. package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
  139. package/lib/types/dsh-adapter/settings-sections.js +106 -26
  140. package/lib/types/dsh-adapter/shortcuts.d.ts +107 -0
  141. package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -0
  142. package/lib/types/dsh-adapter/shortcuts.js +340 -0
  143. package/lib/types/dsh-adapter/status.d.ts +74 -0
  144. package/lib/types/dsh-adapter/status.d.ts.map +1 -0
  145. package/lib/types/dsh-adapter/status.js +234 -0
  146. package/lib/types/dsh-adapter/workspaces.d.ts +16 -5
  147. package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -1
  148. package/lib/types/dsh-adapter/workspaces.js +287 -170
  149. package/lib/types/extensions.d.ts +13 -0
  150. package/lib/types/extensions.d.ts.map +1 -0
  151. package/lib/types/extensions.js +21 -0
  152. package/lib/types/force-production-react.d.ts +1 -0
  153. package/lib/types/force-production-react.d.ts.map +1 -0
  154. package/lib/types/force-production-react.js +12 -0
  155. package/lib/types/i18n.d.ts +174 -20
  156. package/lib/types/i18n.d.ts.map +1 -1
  157. package/lib/types/i18n.js +56 -6
  158. package/lib/types/index.d.ts +1 -0
  159. package/lib/types/index.d.ts.map +1 -1
  160. package/lib/types/index.js +1 -0
  161. package/lib/types/ink/components/App.d.ts +2 -0
  162. package/lib/types/ink/components/App.d.ts.map +1 -1
  163. package/lib/types/ink/components/App.js +4 -0
  164. package/lib/types/ink/ink.d.ts +31 -3
  165. package/lib/types/ink/ink.d.ts.map +1 -1
  166. package/lib/types/ink/ink.js +90 -5
  167. package/lib/types/ink/log-update.d.ts.map +1 -1
  168. package/lib/types/ink/log-update.js +225 -56
  169. package/lib/types/ink/output.d.ts +35 -2
  170. package/lib/types/ink/output.d.ts.map +1 -1
  171. package/lib/types/ink/output.js +281 -14
  172. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  173. package/lib/types/ink/render-node-to-output.js +14 -6
  174. package/lib/types/ink/screen.d.ts +39 -0
  175. package/lib/types/ink/screen.d.ts.map +1 -1
  176. package/lib/types/ink/screen.js +117 -0
  177. package/lib/types/ink/terminal.d.ts.map +1 -1
  178. package/lib/types/ink/terminal.js +26 -6
  179. package/lib/types/ink/wrapAnsi.d.ts +1 -1
  180. package/lib/types/ink/wrapAnsi.d.ts.map +1 -1
  181. package/lib/types/ink/wrapAnsi.js +29 -2
  182. package/lib/types/plugin-host.d.ts +15 -0
  183. package/lib/types/plugin-host.d.ts.map +1 -0
  184. package/lib/types/plugin-host.js +17 -0
  185. package/lib/types/plugin-spec/negotiate.d.ts +11 -0
  186. package/lib/types/plugin-spec/negotiate.d.ts.map +1 -0
  187. package/lib/types/plugin-spec/negotiate.js +97 -0
  188. package/lib/types/plugin-spec/permission-scope.d.ts +32 -0
  189. package/lib/types/plugin-spec/permission-scope.d.ts.map +1 -0
  190. package/lib/types/plugin-spec/permission-scope.js +90 -0
  191. package/lib/types/plugin-spec/registry.d.ts +23 -0
  192. package/lib/types/plugin-spec/registry.d.ts.map +1 -0
  193. package/lib/types/plugin-spec/registry.js +252 -0
  194. package/lib/types/plugin-spec/schema-check.d.ts +17 -0
  195. package/lib/types/plugin-spec/schema-check.d.ts.map +1 -0
  196. package/lib/types/plugin-spec/schema-check.js +165 -0
  197. package/lib/types/plugin-spec/tui-extension.d.ts +16 -0
  198. package/lib/types/plugin-spec/tui-extension.d.ts.map +1 -0
  199. package/lib/types/plugin-spec/tui-extension.js +79 -0
  200. package/lib/types/plugin-spec/types.d.ts +114 -0
  201. package/lib/types/plugin-spec/types.d.ts.map +1 -0
  202. package/lib/types/plugin-spec/types.js +10 -0
  203. package/lib/types/plugin-spec/validate.d.ts +21 -0
  204. package/lib/types/plugin-spec/validate.d.ts.map +1 -0
  205. package/lib/types/plugin-spec/validate.js +138 -0
  206. package/lib/types/scenes.d.ts +2 -1
  207. package/lib/types/scenes.d.ts.map +1 -1
  208. package/lib/types/scenes.js +1 -1
  209. package/lib/types/screens/Chat.d.ts +14 -1
  210. package/lib/types/screens/Chat.d.ts.map +1 -1
  211. package/lib/types/screens/Chat.js +173 -49
  212. package/lib/types/screens/SessionBrowser.d.ts.map +1 -1
  213. package/lib/types/screens/SessionBrowser.js +10 -3
  214. package/lib/types/sessions/view.d.ts +3 -2
  215. package/lib/types/sessions/view.d.ts.map +1 -1
  216. package/lib/types/sessions/view.js +18 -0
  217. package/lib/types/settings-sections.d.ts +2 -1
  218. package/lib/types/settings-sections.d.ts.map +1 -1
  219. package/lib/types/settings-sections.js +1 -1
  220. package/lib/types/theme.d.ts +5 -0
  221. package/lib/types/theme.d.ts.map +1 -1
  222. package/lib/types/theme.js +15 -0
  223. package/lib/types/update.d.ts +20 -0
  224. package/lib/types/update.d.ts.map +1 -1
  225. package/lib/types/update.js +54 -7
  226. package/lib/types/utils/execFileNoThrow.d.ts.map +1 -1
  227. package/lib/types/utils/execFileNoThrow.js +3 -0
  228. package/lib/types/utils/loaded-context.d.ts +8 -3
  229. package/lib/types/utils/loaded-context.d.ts.map +1 -1
  230. package/lib/types/utils/loaded-context.js +39 -3
  231. package/lib/types/utils/modifiers.d.ts.map +1 -1
  232. package/lib/types/utils/modifiers.js +3 -2
  233. package/lib/types/working-activity.d.ts +12 -0
  234. package/lib/types/working-activity.d.ts.map +1 -1
  235. package/lib/types/working-activity.js +13 -0
  236. package/lib/types/workspaces.d.ts +2 -1
  237. package/lib/types/workspaces.d.ts.map +1 -1
  238. package/lib/types/workspaces.js +1 -1
  239. package/node_modules/@dsh-std/command/CHANGELOG.md +8 -0
  240. package/node_modules/@dsh-std/command/LICENSE +21 -0
  241. package/node_modules/@dsh-std/command/README.md +26 -0
  242. package/node_modules/@dsh-std/command/README.zh.md +28 -0
  243. package/node_modules/@dsh-std/command/lib/index.d.ts +144 -0
  244. package/node_modules/@dsh-std/command/lib/index.d.ts.map +1 -0
  245. package/node_modules/@dsh-std/command/lib/index.js +252 -0
  246. package/node_modules/@dsh-std/command/lib/index.js.map +1 -0
  247. package/node_modules/@dsh-std/command/package.json +22 -0
  248. package/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
  249. package/node_modules/@dsh-std/connection/LICENSE +21 -0
  250. package/node_modules/@dsh-std/connection/README.md +42 -0
  251. package/node_modules/@dsh-std/connection/README.zh.md +42 -0
  252. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  253. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  254. package/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  255. package/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  256. package/node_modules/@dsh-std/connection/lib/index.js +158 -0
  257. package/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  258. package/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  259. package/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  260. package/node_modules/@dsh-std/connection/lib/memory.js +258 -0
  261. package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  262. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  263. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  264. package/node_modules/@dsh-std/connection/package.json +20 -0
  265. package/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  266. package/node_modules/@dsh-std/core/LICENSE +21 -0
  267. package/node_modules/@dsh-std/core/README.md +13 -0
  268. package/node_modules/@dsh-std/core/README.zh.md +13 -0
  269. package/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  270. package/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  271. package/node_modules/@dsh-std/core/lib/index.js +424 -0
  272. package/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  273. package/node_modules/@dsh-std/core/package.json +21 -0
  274. package/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
  275. package/node_modules/@dsh-std/manifest/LICENSE +21 -0
  276. package/node_modules/@dsh-std/manifest/README.md +5 -0
  277. package/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  278. package/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  279. package/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  280. package/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  281. package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  282. package/node_modules/@dsh-std/manifest/package.json +20 -0
  283. package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  284. package/node_modules/@dsh-std/messages/CHANGELOG.md +8 -0
  285. package/node_modules/@dsh-std/messages/LICENSE +21 -0
  286. package/node_modules/@dsh-std/messages/README.md +5 -0
  287. package/node_modules/@dsh-std/messages/README.zh.md +7 -0
  288. package/node_modules/@dsh-std/messages/lib/index.d.ts +50 -0
  289. package/node_modules/@dsh-std/messages/lib/index.d.ts.map +1 -0
  290. package/node_modules/@dsh-std/messages/lib/index.js +151 -0
  291. package/node_modules/@dsh-std/messages/lib/index.js.map +1 -0
  292. package/node_modules/@dsh-std/messages/package.json +20 -0
  293. package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -0
  294. package/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
  295. package/node_modules/@dsh-std/presentation/LICENSE +21 -0
  296. package/node_modules/@dsh-std/presentation/README.md +27 -0
  297. package/node_modules/@dsh-std/presentation/README.zh.md +29 -0
  298. package/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
  299. package/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
  300. package/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
  301. package/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
  302. package/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  303. package/node_modules/@dsh-std/presentation/lib/index.js +550 -0
  304. package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  305. package/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  306. package/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  307. package/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  308. package/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  309. package/node_modules/@dsh-std/presentation/package.json +25 -0
  310. package/node_modules/@dsh-std/storage/CHANGELOG.md +8 -0
  311. package/node_modules/@dsh-std/storage/LICENSE +21 -0
  312. package/node_modules/@dsh-std/storage/README.md +5 -0
  313. package/node_modules/@dsh-std/storage/README.zh.md +7 -0
  314. package/node_modules/@dsh-std/storage/lib/index.d.ts +48 -0
  315. package/node_modules/@dsh-std/storage/lib/index.d.ts.map +1 -0
  316. package/node_modules/@dsh-std/storage/lib/index.js +104 -0
  317. package/node_modules/@dsh-std/storage/lib/index.js.map +1 -0
  318. package/node_modules/@dsh-std/storage/package.json +20 -0
  319. package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -0
  320. package/package.json +110 -70
  321. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
  322. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -0
  323. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -0
  324. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -0
  325. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  326. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  327. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  328. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  329. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js +158 -0
  330. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  331. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  332. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  333. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js +258 -0
  334. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  335. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  336. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  337. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -0
  338. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  339. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -0
  340. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -0
  341. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -0
  342. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  343. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  344. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js +424 -0
  345. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  346. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -0
  347. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
  348. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -0
  349. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -0
  350. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  351. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  352. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  353. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  354. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  355. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -0
  356. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  357. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
  358. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -0
  359. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +27 -0
  360. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +29 -0
  361. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
  362. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
  363. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
  364. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
  365. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  366. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js +550 -0
  367. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  368. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  369. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  370. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  371. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  372. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +25 -0
  373. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  374. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -0
  375. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -0
  376. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -0
  377. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  378. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  379. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js +424 -0
  380. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  381. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -0
  382. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  383. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -0
  384. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -0
  385. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -0
  386. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  387. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  388. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js +424 -0
  389. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  390. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -0
  391. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  392. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -0
  393. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -0
  394. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -0
  395. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  396. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  397. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js +424 -0
  398. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  399. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -0
  400. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
  401. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -0
  402. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -0
  403. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -0
  404. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  405. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  406. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  407. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  408. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js +158 -0
  409. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  410. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  411. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  412. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js +258 -0
  413. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  414. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  415. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  416. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -0
  417. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  418. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -0
  419. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -0
  420. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -0
  421. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  422. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  423. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js +424 -0
  424. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  425. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -0
  426. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  427. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -0
  428. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -0
  429. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -0
  430. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  431. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  432. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js +424 -0
  433. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  434. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -0
@@ -1,10 +1,10 @@
1
- import { styledCharsFromTokens, tokenize, } from '@alcalzone/ansi-tokenize';
1
+ import { ansiCodesToString, styledCharsFromTokens, tokenize, } from '@alcalzone/ansi-tokenize';
2
2
  import { logForDebugging } from '../utils/debug.js';
3
3
  import { getGraphemeSegmenter } from '../utils/intl.js';
4
4
  import sliceAnsi from '../utils/sliceAnsi.js';
5
5
  import { reorderBidi } from './bidi.js';
6
6
  import { unionRect } from './layout/geometry.js';
7
- import { blitRegion, extractHyperlinkFromStyles, filterOutHyperlinkStyles, markNoSelectRegion, OSC8_PREFIX, resetScreen, setCellAt, shiftRows, } from './screen.js';
7
+ import { blitRegion, cellRunSpan, createCellRun, extractHyperlinkFromStyles, filterOutHyperlinkStyles, markNoSelectRegion, OSC8_PREFIX, recordCellRunEntry, recordSpacerRunEntry, replayCellRun, resetScreen, setCellAt, shiftRows, } from './screen.js';
8
8
  import { stringWidth } from './stringWidth.js';
9
9
  import { widestLine } from './widest-line.js';
10
10
  /**
@@ -29,6 +29,11 @@ import { widestLine } from './widest-line.js';
29
29
  const MAX_CACHEABLE_LINE = 500;
30
30
  const CHAR_CACHE_MAX_ENTRIES = 16384;
31
31
  const CHAR_CACHE_MAX_CHARS = 100_000;
32
+ /** Packed-run line cap: runs are three integers per cell (no per-char
33
+ * objects like charCache entries), so long ANSI-art lines (the whale
34
+ * logo, ~700 chars) are worth caching — they would otherwise
35
+ * re-tokenize and re-cluster every frame. */
36
+ const PACKED_MAX_LINE = 4000;
32
37
  /** Copy a string into a fresh flat string with no parent references. */
33
38
  function detachString(s) {
34
39
  // Buffer round-trip guarantees a newly allocated flat string; cheaper
@@ -41,28 +46,58 @@ function detachString(s) {
41
46
  * no caller can accidentally grow it unboundedly.
42
47
  */
43
48
  export class CharCache {
49
+ /**
50
+ * LRU of line → clustered characters. A full clear on overflow
51
+ * (the original behavior) thrashes during long-session streaming: the
52
+ * mounted window's static lines alone approach the char budget, so the
53
+ * streaming row's per-frame new keys tip it over every frame or two,
54
+ * nuking the cache and forcing ~1800 line re-tokenizations per frame
55
+ * (measured ~100ms/frame at a 175-row session). Evicting oldest-first
56
+ * keeps the hot mounted lines resident while streaming churn falls out
57
+ * the back. Recency is refreshed on hit (delete + re-insert) so lines
58
+ * read every frame are never evicted by one-shot churn.
59
+ */
44
60
  map = new Map();
45
61
  chars = 0;
46
62
  /**
47
- * Return the cached clustered characters for a line, if present.
63
+ * Return the cached clustered characters for a line, if present, and
64
+ * refresh the entry's recency.
48
65
  * @param line - the line to look up.
49
66
  * @returns the cached characters, or undefined on a miss.
50
67
  */
51
68
  get(line) {
52
- return this.map.get(line);
69
+ const hit = this.map.get(line);
70
+ if (hit !== undefined) {
71
+ this.map.delete(line);
72
+ this.map.set(line, hit);
73
+ }
74
+ return hit;
53
75
  }
54
76
  /**
55
- * Cache clustered characters for a line, enforcing the cache bounds.
77
+ * Cache clustered characters for a line, enforcing the cache bounds by
78
+ * evicting least-recently-used entries (never a full clear).
56
79
  * @param line - the line key.
57
80
  * @param characters - the clustered characters to cache.
58
81
  */
59
82
  set(line, characters) {
60
83
  if (line.length > MAX_CACHEABLE_LINE)
61
84
  return;
62
- if (this.map.size >= CHAR_CACHE_MAX_ENTRIES ||
85
+ if (this.map.has(line)) {
86
+ this.map.delete(line);
87
+ this.chars -= line.length;
88
+ }
89
+ // Evict oldest entries until the new one fits. A single line longer
90
+ // than the whole budget cannot fit even empty — skip caching it.
91
+ if (line.length > CHAR_CACHE_MAX_CHARS)
92
+ return;
93
+ while (this.map.size >= CHAR_CACHE_MAX_ENTRIES ||
63
94
  this.chars + line.length > CHAR_CACHE_MAX_CHARS) {
64
- this.map.clear();
65
- this.chars = 0;
95
+ const oldest = this.map.keys().next();
96
+ if (oldest.done === true)
97
+ break;
98
+ const oldestKey = oldest.value;
99
+ this.chars -= oldestKey.length;
100
+ this.map.delete(oldestKey);
66
101
  }
67
102
  this.map.set(detachString(line), characters);
68
103
  this.chars += line.length;
@@ -106,6 +141,128 @@ function minDefined(a, b) {
106
141
  return a;
107
142
  return Math.min(a, b);
108
143
  }
144
+ /**
145
+ * Slot-reuse ceiling: the clustered array is a second full memory image of
146
+ * the line, and pathological single-line output (base64 blobs, minified
147
+ * code) would pin it across frames on top of the string itself. Past this
148
+ * length every frame takes the full path — transient, GC-able.
149
+ */
150
+ const STREAMING_SLOT_MAX_LINE = 65_536;
151
+ /**
152
+ * Classify the tail of the line relative to its LAST ESC character.
153
+ * - 'none': no ESC at all
154
+ * - 'dangling': the last ESC starts an escape sequence that is cut off at
155
+ * end-of-line - next frame's continuation completes it, so the prefix
156
+ * clustering cannot be reused (the partial sequence was clustered as text)
157
+ * - 'bare': the last ESC's sequence is complete but ends exactly at
158
+ * end-of-line - the SGR state after it never applied to any character, so
159
+ * trailingStyles (derived from the last char) would be stale next frame
160
+ * - 'complete': last sequence terminated with plain text after it
161
+ */
162
+ function escapeTailState(line) {
163
+ const i = line.lastIndexOf('\x1b');
164
+ if (i === -1)
165
+ return 'none';
166
+ const rest = line.slice(i);
167
+ const c1 = rest[1];
168
+ if (c1 === undefined)
169
+ return 'dangling';
170
+ if (c1 === '[') {
171
+ for (let k = 2; k < rest.length; k++) {
172
+ const ch = rest.charCodeAt(k);
173
+ if (ch >= 0x40 && ch <= 0x7e)
174
+ return k === rest.length - 1 ? 'bare' : 'complete';
175
+ if (ch < 0x20 || ch > 0x3f)
176
+ return 'complete';
177
+ }
178
+ return 'dangling';
179
+ }
180
+ if (c1 === ']' || c1 === 'P' || c1 === '_' || c1 === '^' || c1 === 'X') {
181
+ for (let k = 2; k < rest.length; k++) {
182
+ if (rest[k] === '\x07')
183
+ return k === rest.length - 1 ? 'bare' : 'complete';
184
+ if (rest[k] === '\x1b' && rest[k + 1] === '\\') {
185
+ return k + 1 === rest.length - 1 ? 'bare' : 'complete';
186
+ }
187
+ }
188
+ return 'dangling';
189
+ }
190
+ // Two-character sequence ESC <0x30-0x7E>: rest.length >= 2 means complete.
191
+ return rest.length === 2 ? 'bare' : 'complete';
192
+ }
193
+ /** True when the line's last code point may continue into a multi-codepoint
194
+ * grapheme (ZWJ, variation selectors, combining marks, skin tones, regional
195
+ * indicators) - appending to it would change the last grapheme's clustering. */
196
+ function endsWithOpenGrapheme(line) {
197
+ const cp = line.codePointAt(line.length - 1);
198
+ if (cp === undefined)
199
+ return false;
200
+ return (cp === 0x200d ||
201
+ cp === 0xfe0f ||
202
+ cp === 0xfe0e ||
203
+ (cp >= 0x0300 && cp <= 0x036f) ||
204
+ (cp >= 0x1f3fb && cp <= 0x1f3ff) ||
205
+ (cp >= 0x1f1e6 && cp <= 0x1f1ff));
206
+ }
207
+ /** Hebrew / Arabic / Syriac and related RTL blocks - bidirectional reordering
208
+ * is line-global, so prefix-reuse (which reorders only the suffix) is not
209
+ * safe for these; take the full path. */
210
+ function hasRtlChars(text) {
211
+ return /[\u0590-\u05FF\u0600-\u06FF\u0700-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/.test(text);
212
+ }
213
+ /** Update (or clear) the streaming slot after a full-path build of `line`.
214
+ * The slot is only kept when the line can safely be extended next frame. */
215
+ function updateStreamingSlot(slot, line, clustered, chars) {
216
+ if (line.length <= MAX_CACHEABLE_LINE ||
217
+ line.length > STREAMING_SLOT_MAX_LINE ||
218
+ endsWithOpenGrapheme(line) ||
219
+ hasRtlChars(line)) {
220
+ // Short lines are served by CharCache; complex tails always take the
221
+ // full path. Drop a stale slot when the stream settles.
222
+ if (slot.current)
223
+ slot.current = null;
224
+ return;
225
+ }
226
+ const tail = escapeTailState(line);
227
+ if (tail === 'dangling' || tail === 'bare') {
228
+ if (slot.current)
229
+ slot.current = null;
230
+ return;
231
+ }
232
+ slot.current = {
233
+ line: detachString(line),
234
+ clustered,
235
+ trailingStyles: chars.length > 0 ? chars[chars.length - 1].styles : [],
236
+ };
237
+ }
238
+ /**
239
+ * Build the clustered characters for one line, taking the streaming-prefix
240
+ * fast path when possible. `slot` is the instance-level streaming slot;
241
+ * `prevChars`/`fullChars` wiring is handled by updateStreamingSlot.
242
+ */
243
+ function buildClusteredChars(line, stylePool, slot) {
244
+ const prev = slot.current;
245
+ if (prev &&
246
+ line.length > MAX_CACHEABLE_LINE &&
247
+ line.length > prev.line.length &&
248
+ line.startsWith(prev.line) &&
249
+ !endsWithOpenGrapheme(prev.line) &&
250
+ !hasRtlChars(line.slice(prev.line.length))) {
251
+ // Reuse the prefix clustering verbatim; tokenize only the appended
252
+ // suffix, replaying the line-end SGR state so new characters inherit
253
+ // the correct style. Bidi runs on the suffix alone (line verified RTL-free).
254
+ const suffix = line.slice(prev.line.length);
255
+ const replay = styledCharsFromTokens(tokenize(ansiCodesToString(prev.trailingStyles) + suffix));
256
+ const clustered = styledCharsWithGraphemeClustering(replay, stylePool);
257
+ const result = prev.clustered.concat(reorderBidi(clustered));
258
+ updateStreamingSlot(slot, line, result, replay);
259
+ return result;
260
+ }
261
+ const chars = styledCharsFromTokens(tokenize(line));
262
+ const clustered = reorderBidi(styledCharsWithGraphemeClustering(chars, stylePool));
263
+ updateStreamingSlot(slot, line, clustered, chars);
264
+ return clustered;
265
+ }
109
266
  /**
110
267
  * Collects write/blit/clear/clip operations from the render tree, then
111
268
  * applies them to a Screen buffer in get(). The Screen is what gets
@@ -120,6 +277,48 @@ export default class Output {
120
277
  screen;
121
278
  operations = [];
122
279
  charCache = new CharCache();
280
+ /**
281
+ * LRU of line → recorded packed cell run, mirroring charCache's bounds.
282
+ * The main-screen architecture repaints every settled line each frame;
283
+ * the recorded run replays as raw two-word stores (no interning, no
284
+ * packing, no guard branches) — the long-session streaming fix. Runs are
285
+ * validated against the screen they were interned on and die with it.
286
+ */
287
+ packedLines = new Map();
288
+ packedChars = 0;
289
+ /** Stable owner handle passed to writeLineToScreen (no per-call closure). */
290
+ packedOwner = {
291
+ lines: this.packedLines,
292
+ commit: (line, run) => {
293
+ this.setPackedLine(line, run);
294
+ },
295
+ };
296
+ /** Insert into the packed-lines LRU, evicting oldest entries on budget. */
297
+ setPackedLine(line, run) {
298
+ if (line.length > PACKED_MAX_LINE)
299
+ return;
300
+ if (this.packedLines.has(line)) {
301
+ this.packedLines.delete(line);
302
+ this.packedChars -= line.length;
303
+ }
304
+ while (this.packedLines.size >= CHAR_CACHE_MAX_ENTRIES ||
305
+ this.packedChars + line.length > CHAR_CACHE_MAX_CHARS) {
306
+ const oldest = this.packedLines.keys().next();
307
+ if (oldest.done === true)
308
+ break;
309
+ this.packedChars -= oldest.value.length;
310
+ this.packedLines.delete(oldest.value);
311
+ }
312
+ this.packedLines.set(detachString(line), run);
313
+ this.packedChars += line.length;
314
+ }
315
+ /**
316
+ * Streaming-tail slot, shared by every writeLineToScreen call of this
317
+ * Output (only one line grows per frame during streaming). Survives reset()
318
+ * like charCache - it is keyed by strict line extension, so stale entries
319
+ * can never produce a wrong hit.
320
+ */
321
+ streamingSlot = { current: null };
123
322
  constructor(options) {
124
323
  const { width, height, stylePool, screen } = options;
125
324
  this.width = width;
@@ -361,6 +560,12 @@ export default class Output {
361
560
  const from = x < clip.x1 ? clip.x1 - x : 0;
362
561
  const width = stringWidth(line);
363
562
  const to = x + width > clip.x2 ? clip.x2 - x : width;
563
+ // Fast path: the line sits entirely inside the clip — no
564
+ // slice needed. sliceAnsi re-tokenizes the line (the
565
+ // dominant per-frame cost of long sessions otherwise:
566
+ // every settled line, every frame).
567
+ if (from === 0 && to === width)
568
+ return line;
364
569
  let sliced = sliceAnsi(line, from, to);
365
570
  // Wide chars (CJK, emoji) occupy 2 cells. When `to` lands
366
571
  // on the first cell of a wide char, sliceAnsi includes the
@@ -403,7 +608,7 @@ export default class Output {
403
608
  if (lineY >= screenHeight) {
404
609
  break;
405
610
  }
406
- const contentEnd = writeLineToScreen(screen, line, x, lineY, screenWidth, this.stylePool, this.charCache);
611
+ const contentEnd = writeLineToScreen(screen, line, x, lineY, screenWidth, this.stylePool, this.charCache, this.streamingSlot, this.packedOwner);
407
612
  writeCells += contentEnd - x;
408
613
  // See Screen.softWrap docstring for the encoding. contentEnd
409
614
  // from writeLineToScreen is tab-expansion-aware, unlike
@@ -520,12 +725,45 @@ function flushBuffer(buffer, styles, stylePool, out) {
520
725
  * the caller can record it in screen.softWrap without re-walking the
521
726
  * line via stringWidth(). Caller computes the debug cell-count as end-x.
522
727
  */
523
- function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache) {
728
+ function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache, streamingSlot, packed) {
729
+ // Fast path: replay the recorded packed run for this exact line — two
730
+ // typed-array stores per cell, no interning/packing/guard work. The run
731
+ // dies with its screen; a width transition needs the slow path's guards
732
+ // and replayCellRun reports that.
733
+ if (packed !== undefined) {
734
+ const run = packed.lines.get(line);
735
+ if (run !== undefined &&
736
+ run.charPool === screen.charPool &&
737
+ x >= 0 &&
738
+ x + cellRunSpan(run) <= screenWidth) {
739
+ if (replayCellRun(screen, x, y, run)) {
740
+ // LRU refresh (chars budget unchanged: same key length).
741
+ packed.lines.delete(line);
742
+ packed.lines.set(line, run);
743
+ return x + cellRunSpan(run);
744
+ }
745
+ // fall through to the slow path for this line this frame
746
+ }
747
+ }
524
748
  let characters = charCache.get(line);
525
749
  if (!characters) {
526
- characters = reorderBidi(styledCharsWithGraphemeClustering(styledCharsFromTokens(tokenize(line)), stylePool));
750
+ characters = buildClusteredChars(line, stylePool, streamingSlot);
527
751
  charCache.set(line, characters);
528
752
  }
753
+ // Recording for the packed fast path: only plain single/wide char cells
754
+ // are recordable — control chars (tab expansion is x-relative), edge
755
+ // SpacerHead substitution, and y/x off-screen abort it. The packed-run
756
+ // limit is far above the charCache's MAX_CACHEABLE_LINE: a run costs
757
+ // three small integers per cell (no per-char objects), so even the
758
+ // ~700-char ANSI-art whale lines belong — without this they
759
+ // re-tokenize and re-cluster EVERY frame.
760
+ const recordable = packed !== undefined &&
761
+ line.length <= PACKED_MAX_LINE &&
762
+ x >= 0 &&
763
+ y >= 0 &&
764
+ y < screen.height;
765
+ let run = recordable ? createCellRun(screen) : undefined;
766
+ let runAlive = run !== undefined;
529
767
  let offsetX = x;
530
768
  for (let charIdx = 0; charIdx < characters.length; charIdx++) {
531
769
  const character = characters[charIdx];
@@ -534,6 +772,8 @@ function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache
534
772
  // mismatches. stringWidth treats these as width 0, but terminals may
535
773
  // move the cursor differently.
536
774
  if (codePoint !== undefined && codePoint <= 0x1f) {
775
+ // Not recordable: tab expansion is x-relative, ESC handling varies.
776
+ runAlive = false;
537
777
  // Tab (0x09): expand to spaces to reach next tab stop
538
778
  if (codePoint === 0x09) {
539
779
  const tabWidth = 8;
@@ -636,9 +876,10 @@ function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache
636
876
  }
637
877
  const isWideCharacter = charWidth >= 2;
638
878
  // Wide char at last column can't fit — terminal would wrap it to
639
- // the next line, desyncing our cursor model. Place a SpacerHead
640
- // to mark the blank column, matching terminal behavior.
879
+ // the next line, desyncing our cursor model. Place a SpacerHead to
880
+ // mark the blank column, matching terminal behavior.
641
881
  if (isWideCharacter && offsetX + 2 > screenWidth) {
882
+ runAlive = false;
642
883
  setCellAt(screen, offsetX, y, {
643
884
  char: ' ',
644
885
  styleId: stylePool.none,
@@ -651,13 +892,39 @@ function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache
651
892
  // styleId + hyperlink were precomputed during clustering (once per
652
893
  // style run, cached via charCache). Hot loop is now just property
653
894
  // reads — no intern, no extract, no filter per frame.
895
+ const cellWidth = isWideCharacter ? 1 /* CellWidth.Wide */ : 0 /* CellWidth.Narrow */;
654
896
  setCellAt(screen, offsetX, y, {
655
897
  char: character.value,
656
898
  styleId: character.styleId,
657
- width: isWideCharacter ? 1 /* CellWidth.Wide */ : 0 /* CellWidth.Narrow */,
899
+ width: cellWidth,
658
900
  hyperlink: character.hyperlink,
659
901
  });
902
+ if (runAlive && run !== undefined) {
903
+ recordCellRunEntry(run, screen, offsetX, {
904
+ char: character.value,
905
+ styleId: character.styleId,
906
+ width: cellWidth,
907
+ hyperlink: character.hyperlink,
908
+ });
909
+ // setCellAt also writes a SpacerTail after a wide char (when it
910
+ // fits); record that deterministic write too, or abort at the edge.
911
+ if (isWideCharacter) {
912
+ if (offsetX + 1 < screenWidth) {
913
+ recordSpacerRunEntry(run, offsetX + 1);
914
+ }
915
+ else {
916
+ runAlive = false;
917
+ }
918
+ }
919
+ }
660
920
  offsetX += isWideCharacter ? 2 : 1;
661
921
  }
922
+ // Commit the recording for the packed fast path. Complete NON-EMPTY
923
+ // runs only: an empty line ('' from split('\n'), zero-width-only lines)
924
+ // records zero entries and would commit a degenerate run whose replay
925
+ // writes NaN damage (gaps[0] undefined) and poisons the whole frame diff.
926
+ if (runAlive && run !== undefined && packed !== undefined && run.gaps.length > 0) {
927
+ packed.commit(line, run);
928
+ }
662
929
  return offsetX;
663
930
  }
@@ -1 +1 @@
1
- {"version":3,"file":"render-node-to-output.d.ts","sourceRoot":"","sources":["../../../src/ink/render-node-to-output.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAK1C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,wBAAwB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AAA;AAGD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,GAAG,IAAI,CAIzD;AAoFD;;;;;GAKG;AACH,iBAAS,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CASlE;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,wBAAwB,CAC/B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,aAAa,EAAE,EACzB,aAAa,EAAE,MAAM,EAAE,EACvB,aAAa,EAAE,MAAM,EACrB,WAAW,GAAE,OAAe,GAC3B,MAAM,CA0GR;AA+DD;;;;;;;;;GASG;AACH,iBAAS,kBAAkB,CACzB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAM9B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,wBAAwB,CAAC,EAAE,KAAK,CAAA;CACjC,GACA,IAAI,CA62BN;AAyOD,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,CAAA;AAE1D,eAAe,kBAAkB,CAAA"}
@@ -701,7 +701,9 @@ function renderNodeToOutput(node, output, options) {
701
701
  const pending = node.pendingScrollDelta;
702
702
  const cMin = node.scrollClampMin;
703
703
  const cMax = node.scrollClampMax;
704
- const haveClamp = cMin !== undefined && cMax !== undefined;
704
+ // Single-sided clamps are valid: sticky virtualization sets only the
705
+ // min (scroll-up protection during the sticky->manual transition)
706
+ // and leaves the max open for bottom-follow.
705
707
  if (pending !== undefined && pending !== 0) {
706
708
  // Drain continues even past the clamp — the render-clamp below
707
709
  // holds the VISUAL at the mounted edge regardless. Hard-stopping
@@ -715,8 +717,8 @@ function renderNodeToOutput(node, output, options) {
715
717
  // perceived stall at the edge). Past-clamp drain caps at ~4 rows/
716
718
  // frame, roughly matching React's slide rate so the gap stays
717
719
  // bounded and catch-up is quick once input stops.
718
- const pastClamp = haveClamp &&
719
- ((pending < 0 && cur < cMin) || (pending > 0 && cur > cMax));
720
+ const pastClamp = (pending < 0 && cMin !== undefined && cur < cMin) ||
721
+ (pending > 0 && cMax !== undefined && cur > cMax);
720
722
  const eff = pastClamp ? Math.min(4, innerHeight >> 3) : innerHeight;
721
723
  cur += isXtermJsHost()
722
724
  ? drainAdaptive(node, pending, eff)
@@ -739,9 +741,7 @@ function renderNodeToOutput(node, output, options) {
739
741
  // the right range. Not scheduling scrollDrainNode here keeps the
740
742
  // clamp passive — React's commit → resetAfterCommit → onRender will
741
743
  // paint again with fresh bounds.
742
- const clamped = haveClamp
743
- ? Math.max(cMin, Math.min(scrollTop, cMax))
744
- : scrollTop;
744
+ const clamped = Math.max(cMin ?? -Infinity, Math.min(scrollTop, cMax ?? Infinity));
745
745
  node.scrollTop = scrollTop;
746
746
  // Clamp hitting top/bottom consumes any remainder. Set drainPending
747
747
  // only after clamp so a wasted no-op frame isn't scheduled.
@@ -819,6 +819,14 @@ function renderNodeToOutput(node, output, options) {
819
819
  const scrollHeight = contentYoga.getComputedHeight();
820
820
  const prevHeight = contentCached?.height ?? scrollHeight;
821
821
  const heightDelta = scrollHeight - prevHeight;
822
+ // NOTE: scroll-up + streaming growth (delta < 0, heightDelta > 0)
823
+ // deliberately stays OUT of the fast path. Virtualization moves the
824
+ // topPad spacer on the same frame (every mounted row's yogaTop
825
+ // shifts), so the appended-content screen mapping is not derivable
826
+ // from prevHeight - a widened edge region misses rows and leaves
827
+ // blitted stale copies next to the new ones (content duplication).
828
+ // Upstream observed the same class of bug ("content bleeding
829
+ // through during scroll-up + streaming") and chose the full path.
822
830
  const safeForFastPath = !hint ||
823
831
  heightDelta === 0 ||
824
832
  (hint.delta > 0 && heightDelta === hint.delta);
@@ -339,6 +339,45 @@ export declare function charInCellAt(screen: Screen, x: number, y: number): stri
339
339
  * @param cell - the cell data to write.
340
340
  */
341
341
  export declare function setCellAt(screen: Screen, x: number, y: number, cell: Cell): void;
342
+ /** A recorded run of packed cell writes for one screen line. */
343
+ export interface CellRun {
344
+ /** Char pool the words were interned against. Screens ping-pong
345
+ * (front/back double buffering) but SHARE their pools for a whole
346
+ * session, so pool identity — not screen identity — is the validation
347
+ * token; runs survive the screen swap and die only with the pools
348
+ * (renderer recreation/resize). */
349
+ charPool: CharPool;
350
+ /** The shared stylePool.none — the spacer cells' style word. */
351
+ emptyStyleId: number;
352
+ /** Column gap from the previous written cell; the first entry's gap is
353
+ * 0 (its absolute column is the run's base). */
354
+ gaps: number[];
355
+ charIdxs: number[];
356
+ word1s: number[];
357
+ /** Absolute column of the first written cell (record time). */
358
+ baseX: number;
359
+ /** Absolute column of the last written cell (record time). */
360
+ lastX: number;
361
+ }
362
+ /** Begin recording a run for the given screen. */
363
+ export declare function createCellRun(screen: Screen): CellRun;
364
+ /** Record the cell the slow path is about to write at column x. */
365
+ export declare function recordCellRunEntry(run: CellRun, screen: Screen, x: number, cell: Cell): void;
366
+ /** Record the deterministic SpacerTail that setCellAt writes after a wide
367
+ * char at column x (only when x < screen.width - 1). */
368
+ export declare function recordSpacerRunEntry(run: CellRun, x: number): void;
369
+ /**
370
+ * Replay a recorded run at (x, y): plain two-word stores, with the damage
371
+ * rect extended over the written span. Mirrors setCellAt's guard-fire
372
+ * conditions exactly — a replay is only valid when none of the three
373
+ * state-dependent fixups (wide-overwrite spacer cleanup, spacer-tail
374
+ * orphan cleanup, wide's next-cell orphan cleanup) would trigger; any
375
+ * other width transition is a plain overwrite. Returns false so the
376
+ * caller falls back to the slow path when a guard WOULD fire.
377
+ */
378
+ export declare function replayCellRun(screen: Screen, x: number, y: number, run: CellRun): boolean;
379
+ /** Column just past the last written cell — the run's content end. */
380
+ export declare function cellRunSpan(run: CellRun): number;
342
381
  /**
343
382
  * Replace the styleId of a cell in-place without disturbing char, width,
344
383
  * or hyperlink. Preserves empty cells as-is (char stays ' '). Tracks damage
@@ -1 +1 @@
1
- {"version":3,"file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AAQ,EAAE,CAKvE;AAID;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC,EAAE,CAWtE;AAED,KAAK,YAAY,GAAG,CAClB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,OAAO,EAAE,IAAI,GAAG,SAAS,EACzB,KAAK,EAAE,IAAI,GAAG,SAAS,KACpB,OAAO,GAAG,IAAI,CAAA;AAEnB;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,YAAY,GACf,OAAO,CA8CT;AAmQD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,IAAI,CASN"}
@@ -721,6 +721,123 @@ export function setCellAt(screen, x, y, cell) {
721
721
  }
722
722
  }
723
723
  }
724
+ /** Begin recording a run for the given screen. */
725
+ export function createCellRun(screen) {
726
+ return {
727
+ charPool: screen.charPool,
728
+ emptyStyleId: screen.emptyStyleId,
729
+ gaps: [],
730
+ charIdxs: [],
731
+ word1s: [],
732
+ baseX: -1,
733
+ lastX: -1,
734
+ };
735
+ }
736
+ /** Record the cell the slow path is about to write at column x. */
737
+ export function recordCellRunEntry(run, screen, x, cell) {
738
+ if (run.baseX < 0)
739
+ run.baseX = x;
740
+ run.gaps.push(run.lastX < 0 ? 0 : x - run.lastX);
741
+ run.charIdxs.push(internCharString(screen, cell.char));
742
+ run.word1s.push(packWord1(cell.styleId, internHyperlink(screen, cell.hyperlink), cell.width));
743
+ run.lastX = x;
744
+ }
745
+ /** Record the deterministic SpacerTail that setCellAt writes after a wide
746
+ * char at column x (only when x < screen.width - 1). */
747
+ export function recordSpacerRunEntry(run, x) {
748
+ run.gaps.push(x - run.lastX);
749
+ run.charIdxs.push(SPACER_CHAR_INDEX);
750
+ run.word1s.push(packWord1(run.emptyStyleId, 0, 2 /* CellWidth.SpacerTail */));
751
+ run.lastX = x;
752
+ }
753
+ /**
754
+ * Replay a recorded run at (x, y): plain two-word stores, with the damage
755
+ * rect extended over the written span. Mirrors setCellAt's guard-fire
756
+ * conditions exactly — a replay is only valid when none of the three
757
+ * state-dependent fixups (wide-overwrite spacer cleanup, spacer-tail
758
+ * orphan cleanup, wide's next-cell orphan cleanup) would trigger; any
759
+ * other width transition is a plain overwrite. Returns false so the
760
+ * caller falls back to the slow path when a guard WOULD fire.
761
+ */
762
+ export function replayCellRun(screen, x, y, run) {
763
+ if (x < 0 || y < 0 || y >= screen.height || x >= screen.width)
764
+ return false;
765
+ // Defensive: an empty run has no cells and no span — its damage math
766
+ // would be NaN. Callers never cache empty runs, but a future one might.
767
+ if (run.gaps.length === 0)
768
+ return false;
769
+ const cells = screen.cells;
770
+ const width = screen.width;
771
+ let ox = x;
772
+ const gaps = run.gaps;
773
+ for (let i = 0; i < gaps.length; i++) {
774
+ ox += gaps[i];
775
+ if (ox >= width)
776
+ return false;
777
+ const ci = ((y * width) + ox) << 1;
778
+ const w1 = run.word1s[i];
779
+ const newW = w1 & WIDTH_MASK;
780
+ const prevW = cells[ci + 1] & WIDTH_MASK;
781
+ if (newW === 0 /* CellWidth.Narrow */) {
782
+ // G1 (prev Wide → narrow overwrite cleans the spacer at x+1) and
783
+ // G2 (prev SpacerTail → clears the orphan wide at x-1) would fire.
784
+ if (prevW !== 0 /* CellWidth.Narrow */)
785
+ return false;
786
+ }
787
+ else if (newW === 1 /* CellWidth.Wide */) {
788
+ // G2: a SpacerTail under a Wide write clears the orphan at x-1.
789
+ if (prevW === 2 /* CellWidth.SpacerTail */)
790
+ return false;
791
+ // G3: the spacer this write puts at x+1 would stomp a Wide cell
792
+ // and needs its orphan cleanup.
793
+ if (ox + 1 < width && (cells[ci + 3] & WIDTH_MASK) === 1 /* CellWidth.Wide */) {
794
+ return false;
795
+ }
796
+ }
797
+ else {
798
+ // SpacerTail: G1 fires when it overwrites a Wide cell; G2's
799
+ // SpacerHead variant (prev SpacerTail under a non-SpacerTail write)
800
+ // can't occur in a recorded run — SpacerHead is never recorded — but
801
+ // keep the guard honest for that day soft-wrap starts recording it.
802
+ if (prevW === 1 /* CellWidth.Wide */ ||
803
+ (newW !== 2 /* CellWidth.SpacerTail */ && prevW === 2 /* CellWidth.SpacerTail */)) {
804
+ return false;
805
+ }
806
+ }
807
+ cells[ci] = run.charIdxs[i];
808
+ cells[ci + 1] = w1;
809
+ }
810
+ // Damage: the full written span, matching what per-cell updates in
811
+ // setCellAt would have accumulated.
812
+ const firstX = x + gaps[0];
813
+ const endX = ox + 1;
814
+ const damage = screen.damage;
815
+ if (damage !== undefined) {
816
+ const right = damage.x + damage.width;
817
+ if (firstX < damage.x) {
818
+ damage.width += damage.x - firstX;
819
+ damage.x = firstX;
820
+ }
821
+ else if (endX > right) {
822
+ damage.width += endX - right;
823
+ }
824
+ if (y < damage.y) {
825
+ damage.height += damage.y - y;
826
+ damage.y = y;
827
+ }
828
+ else if (y >= damage.y + damage.height) {
829
+ damage.height = y - damage.y + 1;
830
+ }
831
+ }
832
+ else {
833
+ screen.damage = { x: firstX, y, width: endX - firstX, height: 1 };
834
+ }
835
+ return true;
836
+ }
837
+ /** Column just past the last written cell — the run's content end. */
838
+ export function cellRunSpan(run) {
839
+ return run.lastX - run.baseX + 1;
840
+ }
724
841
  /**
725
842
  * Replace the styleId of a cell in-place without disturbing char, width,
726
843
  * or hyperlink. Preserves empty cells as-is (char stays ' '). Tracks damage
@@ -1 +1 @@
1
- {"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,Q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