@linxiraos/pi-tui 1.4.6 → 1.4.9

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 (399) hide show
  1. package/CHANGELOG.md +162 -244
  2. package/README.md +41 -35
  3. package/dist/types/app-keybindings.d.ts +20 -0
  4. package/dist/types/apps/session-picker.d.ts +5 -0
  5. package/dist/types/charts/chart-plan.d.ts +9 -7
  6. package/dist/types/charts/table-data.d.ts +4 -2
  7. package/dist/types/chat/assistant-message.d.ts +15 -3
  8. package/dist/types/chat/bash-execution.d.ts +6 -1
  9. package/dist/types/chat/display-preferences.d.ts +2 -0
  10. package/dist/types/chat/eval-execution.d.ts +2 -0
  11. package/dist/types/chat/execution-shared.d.ts +14 -8
  12. package/dist/types/chat/extension-types.d.ts +31 -0
  13. package/dist/types/chat/figure-markdown.d.ts +2 -0
  14. package/dist/types/chat/reply-write.d.ts +48 -0
  15. package/dist/types/chat/svg-figure.d.ts +5 -0
  16. package/dist/types/chat/table-chart.d.ts +6 -3
  17. package/dist/types/chat/tool-execution.d.ts +1 -2
  18. package/dist/types/chat/transcript-outline.d.ts +7 -0
  19. package/dist/types/chat/transcript-render-helpers.d.ts +13 -3
  20. package/dist/types/chrome/dynamic-border.d.ts +6 -0
  21. package/dist/types/chrome/index.d.ts +1 -0
  22. package/dist/types/chrome/transcript-notice.d.ts +35 -0
  23. package/dist/types/chrome/transcript-status.d.ts +21 -9
  24. package/dist/types/components/editor.d.ts +23 -6
  25. package/dist/types/components/image.d.ts +6 -0
  26. package/dist/types/components/loader.d.ts +2 -0
  27. package/dist/types/components/markdown.d.ts +7 -0
  28. package/dist/types/keybinding-matchers.d.ts +7 -0
  29. package/dist/types/native/blobs.d.ts +2 -1
  30. package/dist/types/native/describe.d.ts +4 -2
  31. package/dist/types/native/node.d.ts +2 -3
  32. package/dist/types/native/overlay.d.ts +42 -2
  33. package/dist/types/native/picker.d.ts +4 -4
  34. package/dist/types/native/state.d.ts +4 -0
  35. package/dist/types/overlays/annotation-overlay.d.ts +7 -1
  36. package/dist/types/overlays/annotation-types.d.ts +28 -0
  37. package/dist/types/overlays/btw-history-panel.d.ts +15 -0
  38. package/dist/types/overlays/btw-history.d.ts +24 -0
  39. package/dist/types/overlays/btw-inject.d.ts +22 -0
  40. package/dist/types/overlays/btw-panel.d.ts +7 -0
  41. package/dist/types/overlays/hook-editor.d.ts +2 -0
  42. package/dist/types/overlays/jobs-panel.d.ts +4 -0
  43. package/dist/types/overlays/login-dialog.d.ts +5 -1
  44. package/dist/types/overlays/model-browser.d.ts +11 -2
  45. package/dist/types/overlays/oauth-selector.d.ts +23 -0
  46. package/dist/types/overlays/plan-review-overlay.d.ts +2 -0
  47. package/dist/types/overlays/rewind-selector.d.ts +1 -1
  48. package/dist/types/overlays/session-selector.d.ts +33 -4
  49. package/dist/types/prompt/composer.d.ts +56 -5
  50. package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
  51. package/dist/types/render/extension-links.d.ts +65 -0
  52. package/dist/types/render/hyperlink.d.ts +25 -7
  53. package/dist/types/render/index.d.ts +1 -0
  54. package/dist/types/render/render-utils.d.ts +23 -1
  55. package/dist/types/setup/scenes/glyph.d.ts +1 -1
  56. package/dist/types/setup/scenes/model.d.ts +1 -1
  57. package/dist/types/setup/scenes/outro.d.ts +5 -4
  58. package/dist/types/setup/scenes/sign-in.d.ts +13 -8
  59. package/dist/types/setup/scenes/types.d.ts +16 -1
  60. package/dist/types/setup/startup-splash.d.ts +1 -1
  61. package/dist/types/setup/wizard-overlay.d.ts +11 -7
  62. package/dist/types/setup/wizard.d.ts +5 -1
  63. package/dist/types/status-line/component.d.ts +1 -1
  64. package/dist/types/status-line/context-usage.d.ts +28 -6
  65. package/dist/types/status-line/host.d.ts +6 -2
  66. package/dist/types/status-line/startup.d.ts +0 -15
  67. package/dist/types/terminal-capabilities.d.ts +1 -1
  68. package/dist/types/theme/symbols.d.ts +3 -1
  69. package/dist/types/theme/theme-class.d.ts +1 -0
  70. package/dist/types/theme/theme.d.ts +1 -24
  71. package/dist/types/theme/tui-adapters.d.ts +2 -0
  72. package/dist/types/thinking.d.ts +8 -6
  73. package/dist/types/tools/ast-grep.d.ts +2 -0
  74. package/dist/types/tools/bash-interactive.d.ts +6 -0
  75. package/dist/types/tools/bash.d.ts +2 -0
  76. package/dist/types/tools/default-renderer.d.ts +6 -4
  77. package/dist/types/tools/eval.d.ts +2 -0
  78. package/dist/types/tools/find.d.ts +1 -1
  79. package/dist/types/tools/grouped-file-output.d.ts +100 -19
  80. package/dist/types/tools/hashline-format.d.ts +5 -0
  81. package/dist/types/tools/irc.d.ts +6 -0
  82. package/dist/types/tools/json-tree.d.ts +23 -4
  83. package/dist/types/tools/lsp.d.ts +2 -0
  84. package/dist/types/tools/mcp.d.ts +6 -5
  85. package/dist/types/tools/native-view.d.ts +3 -1
  86. package/dist/types/tools/output-meta.d.ts +27 -0
  87. package/dist/types/tools/read.d.ts +14 -4
  88. package/dist/types/tools/renderer.d.ts +2 -0
  89. package/dist/types/tools/streaming-output.d.ts +11 -0
  90. package/dist/types/tools/task.d.ts +13 -4
  91. package/dist/types/tools/url-scheme-host.d.ts +17 -0
  92. package/dist/types/tools/wait.d.ts +2 -0
  93. package/dist/types/tools/yield.d.ts +1 -1
  94. package/dist/types/tui.d.ts +19 -2
  95. package/dist/types/utils.d.ts +4 -0
  96. package/package.json +10 -14
  97. package/src/app-keybindings.d.ts +20 -0
  98. package/src/app-keybindings.ts +20 -0
  99. package/src/apps/git/git-tui.ts +10 -17
  100. package/src/apps/git/sidebar.ts +21 -35
  101. package/src/apps/ps-top.ts +4 -12
  102. package/src/apps/session-picker.ts +7 -0
  103. package/src/charts/chart-plan.d.ts +9 -7
  104. package/src/charts/chart-plan.ts +20 -79
  105. package/src/charts/table-data.d.ts +4 -2
  106. package/src/charts/table-data.ts +55 -6
  107. package/src/chat/advisor-message.ts +2 -0
  108. package/src/chat/assistant-message.d.ts +15 -3
  109. package/src/chat/assistant-message.ts +137 -19
  110. package/src/chat/background-tan-message.ts +4 -0
  111. package/src/chat/bash-execution.d.ts +6 -1
  112. package/src/chat/bash-execution.ts +26 -9
  113. package/src/chat/chat-transcript-builder.ts +63 -30
  114. package/src/chat/compaction-summary-message.ts +2 -1
  115. package/src/chat/display-preferences.d.ts +2 -0
  116. package/src/chat/display-preferences.ts +3 -0
  117. package/src/chat/eval-execution.d.ts +2 -0
  118. package/src/chat/eval-execution.ts +14 -7
  119. package/src/chat/execution-shared.d.ts +14 -8
  120. package/src/chat/execution-shared.ts +39 -18
  121. package/src/chat/extension-types.d.ts +31 -0
  122. package/src/chat/extension-types.ts +34 -0
  123. package/src/chat/figure-markdown.d.ts +2 -0
  124. package/src/chat/figure-markdown.ts +6 -4
  125. package/src/chat/read-tool-group.ts +56 -36
  126. package/src/chat/reply-write.d.ts +48 -0
  127. package/src/chat/reply-write.ts +127 -0
  128. package/src/chat/svg-figure.d.ts +5 -0
  129. package/src/chat/svg-figure.ts +55 -16
  130. package/src/chat/table-chart.d.ts +6 -3
  131. package/src/chat/table-chart.ts +29 -6
  132. package/src/chat/tool-execution.d.ts +1 -2
  133. package/src/chat/tool-execution.ts +20 -13
  134. package/src/chat/transcript-outline.d.ts +7 -0
  135. package/src/chat/transcript-outline.ts +27 -0
  136. package/src/chat/transcript-render-helpers.d.ts +13 -3
  137. package/src/chat/transcript-render-helpers.ts +134 -44
  138. package/src/chrome/dynamic-border.d.ts +6 -0
  139. package/src/chrome/dynamic-border.ts +28 -2
  140. package/src/chrome/index.ts +1 -0
  141. package/src/chrome/transcript-notice.d.ts +35 -0
  142. package/src/chrome/transcript-notice.ts +83 -0
  143. package/src/chrome/transcript-status.d.ts +21 -9
  144. package/src/chrome/transcript-status.ts +32 -30
  145. package/src/components/editor.d.ts +23 -6
  146. package/src/components/editor.ts +133 -25
  147. package/src/components/image.d.ts +6 -0
  148. package/src/components/image.ts +13 -0
  149. package/src/components/key-value-list.ts +9 -9
  150. package/src/components/loader.d.ts +2 -0
  151. package/src/components/loader.ts +7 -0
  152. package/src/components/markdown.d.ts +7 -0
  153. package/src/components/markdown.ts +116 -6
  154. package/src/components/section.ts +1 -9
  155. package/src/components/table.ts +1 -9
  156. package/src/hotkeys-markdown.ts +1 -0
  157. package/src/keybinding-matchers.d.ts +7 -0
  158. package/src/keybinding-matchers.ts +13 -0
  159. package/src/native/backend.ts +10 -67
  160. package/src/native/blobs.d.ts +2 -1
  161. package/src/native/blobs.ts +3 -2
  162. package/src/native/describe.d.ts +4 -2
  163. package/src/native/describe.ts +9 -4
  164. package/src/native/node.d.ts +2 -3
  165. package/src/native/node.ts +2 -3
  166. package/src/native/overlay.d.ts +42 -2
  167. package/src/native/overlay.ts +124 -16
  168. package/src/native/picker.d.ts +4 -4
  169. package/src/native/picker.ts +4 -4
  170. package/src/native/state.d.ts +4 -0
  171. package/src/native/state.ts +25 -5
  172. package/src/overlays/advisor-config.ts +1 -10
  173. package/src/overlays/annotation-overlay.ts +125 -37
  174. package/src/overlays/annotation-types.ts +24 -0
  175. package/src/overlays/btw-history-panel.ts +106 -14
  176. package/src/overlays/btw-history.ts +65 -0
  177. package/src/overlays/btw-inject.ts +91 -0
  178. package/src/overlays/btw-panel.ts +53 -12
  179. package/src/overlays/extensions/extension-dashboard.ts +7 -8
  180. package/src/overlays/hook-editor.ts +6 -0
  181. package/src/overlays/hook-selector.ts +2 -2
  182. package/src/overlays/jobs-panel.ts +82 -22
  183. package/src/overlays/login-dialog.ts +39 -31
  184. package/src/overlays/mcp-add-wizard.ts +1 -1
  185. package/src/overlays/model-browser.ts +106 -10
  186. package/src/overlays/model-hub.ts +1 -7
  187. package/src/overlays/model-picker.ts +1 -10
  188. package/src/overlays/oauth-selector.ts +44 -6
  189. package/src/overlays/plan-review-overlay.ts +13 -2
  190. package/src/overlays/rewind-selector.ts +29 -12
  191. package/src/overlays/session-selector.ts +338 -47
  192. package/src/overlays/settings-defs.ts +2 -2
  193. package/src/overlays/tree-selector.ts +83 -27
  194. package/src/overlays/usage-dashboard.ts +9 -18
  195. package/src/prompt/composer.ts +233 -6
  196. package/src/prompt/custom-editor.ts +6 -1
  197. package/src/prompt/emoji-autocomplete.ts +0 -2
  198. package/src/prompt/interactive-context-helpers.ts +29 -4
  199. package/src/render/code-cell.ts +1 -1
  200. package/src/render/extension-links.d.ts +65 -0
  201. package/src/render/extension-links.ts +214 -0
  202. package/src/render/file-list.ts +4 -7
  203. package/src/render/hyperlink.d.ts +25 -7
  204. package/src/render/hyperlink.ts +65 -9
  205. package/src/render/index.d.ts +1 -0
  206. package/src/render/index.ts +1 -0
  207. package/src/render/render-utils.d.ts +23 -1
  208. package/src/render/render-utils.ts +38 -6
  209. package/src/setup/scenes/composer.ts +2 -0
  210. package/src/setup/scenes/glyph.ts +4 -2
  211. package/src/setup/scenes/model.ts +192 -29
  212. package/src/setup/scenes/outro.ts +33 -15
  213. package/src/setup/scenes/sign-in.ts +196 -400
  214. package/src/setup/scenes/theme.ts +2 -0
  215. package/src/setup/scenes/types.ts +18 -1
  216. package/src/setup/startup-splash.ts +8 -7
  217. package/src/setup/wizard-overlay.ts +164 -35
  218. package/src/setup/wizard.ts +11 -2
  219. package/src/status-line/component.ts +4 -10
  220. package/src/status-line/context-usage.ts +72 -21
  221. package/src/status-line/host.ts +6 -2
  222. package/src/status-line/startup.ts +36 -70
  223. package/src/terminal-capabilities.d.ts +1 -1
  224. package/src/terminal-capabilities.ts +5 -0
  225. package/src/terminal.ts +24 -2
  226. package/src/theme/defaults.json +1 -0
  227. package/src/theme/loader.ts +1 -1
  228. package/src/theme/symbols.d.ts +3 -1
  229. package/src/theme/symbols.ts +16 -9
  230. package/src/theme/theme-class.d.ts +1 -0
  231. package/src/theme/theme-class.ts +15 -3
  232. package/src/theme/theme.d.ts +1 -24
  233. package/src/theme/theme.ts +3 -75
  234. package/src/theme/tui-adapters.d.ts +2 -0
  235. package/src/theme/tui-adapters.ts +8 -3
  236. package/src/thinking.d.ts +8 -6
  237. package/src/thinking.ts +17 -11
  238. package/src/tmux.ts +1 -0
  239. package/src/tools/agent-tree.ts +13 -11
  240. package/src/tools/ask.ts +24 -37
  241. package/src/tools/ast-edit.ts +48 -93
  242. package/src/tools/ast-grep.d.ts +2 -0
  243. package/src/tools/ast-grep.ts +31 -67
  244. package/src/tools/bash-interactive.d.ts +49 -0
  245. package/src/tools/bash-interactive.ts +6 -1
  246. package/src/tools/bash.d.ts +2 -0
  247. package/src/tools/bash.ts +9 -0
  248. package/src/tools/default-renderer.d.ts +6 -4
  249. package/src/tools/default-renderer.ts +10 -7
  250. package/src/tools/edit.ts +50 -43
  251. package/src/tools/eval.d.ts +2 -0
  252. package/src/tools/eval.ts +16 -4
  253. package/src/tools/fetch.ts +2 -1
  254. package/src/tools/find.d.ts +1 -1
  255. package/src/tools/find.ts +13 -5
  256. package/src/tools/github.ts +14 -46
  257. package/src/tools/glob.ts +2 -1
  258. package/src/tools/grep.ts +47 -277
  259. package/src/tools/grouped-file-output.d.ts +100 -19
  260. package/src/tools/grouped-file-output.ts +414 -103
  261. package/src/tools/hashline-format.d.ts +5 -0
  262. package/src/tools/hashline-format.ts +5 -0
  263. package/src/tools/irc.d.ts +6 -0
  264. package/src/tools/irc.ts +6 -0
  265. package/src/tools/job-widget.ts +13 -1
  266. package/src/tools/json-tree.d.ts +23 -4
  267. package/src/tools/json-tree.ts +132 -46
  268. package/src/tools/lsp.d.ts +2 -0
  269. package/src/tools/lsp.ts +246 -47
  270. package/src/tools/mcp.d.ts +6 -5
  271. package/src/tools/mcp.ts +20 -12
  272. package/src/tools/native-view.d.ts +3 -1
  273. package/src/tools/native-view.ts +12 -6
  274. package/src/tools/output-meta.d.ts +27 -0
  275. package/src/tools/output-meta.ts +68 -4
  276. package/src/tools/proc-render.ts +3 -3
  277. package/src/tools/read.d.ts +14 -4
  278. package/src/tools/read.ts +20 -5
  279. package/src/tools/renderer.d.ts +2 -0
  280. package/src/tools/renderer.ts +2 -0
  281. package/src/tools/streaming-output.d.ts +11 -0
  282. package/src/tools/streaming-output.ts +41 -0
  283. package/src/tools/task.d.ts +13 -4
  284. package/src/tools/task.ts +100 -97
  285. package/src/tools/url-scheme-host.d.ts +17 -0
  286. package/src/tools/url-scheme-host.ts +21 -0
  287. package/src/tools/vibe.ts +4 -4
  288. package/src/tools/wait.d.ts +2 -0
  289. package/src/tools/wait.ts +8 -5
  290. package/src/tools/write.ts +17 -27
  291. package/src/tools/yield.d.ts +1 -1
  292. package/src/tools/yield.ts +19 -10
  293. package/src/tui.d.ts +19 -2
  294. package/src/tui.ts +134 -24
  295. package/src/utils.d.ts +4 -0
  296. package/src/utils.ts +10 -0
  297. package/dist/types/theme/defaults/index.d.ts +0 -10289
  298. package/src/theme/defaults/alabaster.json +0 -103
  299. package/src/theme/defaults/amethyst.json +0 -106
  300. package/src/theme/defaults/anthracite.json +0 -103
  301. package/src/theme/defaults/basalt.json +0 -101
  302. package/src/theme/defaults/birch.json +0 -105
  303. package/src/theme/defaults/dark-abyss.json +0 -101
  304. package/src/theme/defaults/dark-arctic.json +0 -114
  305. package/src/theme/defaults/dark-aurora.json +0 -105
  306. package/src/theme/defaults/dark-catppuccin.json +0 -117
  307. package/src/theme/defaults/dark-cavern.json +0 -101
  308. package/src/theme/defaults/dark-celestial.json +0 -116
  309. package/src/theme/defaults/dark-copper.json +0 -105
  310. package/src/theme/defaults/dark-cosmos.json +0 -100
  311. package/src/theme/defaults/dark-cyberpunk.json +0 -112
  312. package/src/theme/defaults/dark-dracula.json +0 -108
  313. package/src/theme/defaults/dark-eclipse.json +0 -101
  314. package/src/theme/defaults/dark-ember.json +0 -105
  315. package/src/theme/defaults/dark-equinox.json +0 -100
  316. package/src/theme/defaults/dark-forest.json +0 -106
  317. package/src/theme/defaults/dark-github.json +0 -115
  318. package/src/theme/defaults/dark-gruvbox.json +0 -122
  319. package/src/theme/defaults/dark-lavender.json +0 -105
  320. package/src/theme/defaults/dark-lunar.json +0 -99
  321. package/src/theme/defaults/dark-midnight.json +0 -105
  322. package/src/theme/defaults/dark-monochrome.json +0 -104
  323. package/src/theme/defaults/dark-monokai.json +0 -108
  324. package/src/theme/defaults/dark-nebula.json +0 -100
  325. package/src/theme/defaults/dark-neon-noir.json +0 -110
  326. package/src/theme/defaults/dark-nord.json +0 -108
  327. package/src/theme/defaults/dark-ocean.json +0 -111
  328. package/src/theme/defaults/dark-one.json +0 -110
  329. package/src/theme/defaults/dark-poimandres.json +0 -125
  330. package/src/theme/defaults/dark-rainforest.json +0 -101
  331. package/src/theme/defaults/dark-reef.json +0 -101
  332. package/src/theme/defaults/dark-retro.json +0 -102
  333. package/src/theme/defaults/dark-rose-pine.json +0 -106
  334. package/src/theme/defaults/dark-sakura.json +0 -105
  335. package/src/theme/defaults/dark-slate.json +0 -105
  336. package/src/theme/defaults/dark-solarized.json +0 -107
  337. package/src/theme/defaults/dark-solstice.json +0 -100
  338. package/src/theme/defaults/dark-starfall.json +0 -101
  339. package/src/theme/defaults/dark-sunset.json +0 -109
  340. package/src/theme/defaults/dark-swamp.json +0 -100
  341. package/src/theme/defaults/dark-synthwave.json +0 -113
  342. package/src/theme/defaults/dark-taiga.json +0 -101
  343. package/src/theme/defaults/dark-terminal.json +0 -105
  344. package/src/theme/defaults/dark-tokyo-night.json +0 -111
  345. package/src/theme/defaults/dark-tundra.json +0 -101
  346. package/src/theme/defaults/dark-twilight.json +0 -101
  347. package/src/theme/defaults/dark-volcanic.json +0 -101
  348. package/src/theme/defaults/graphite.json +0 -102
  349. package/src/theme/defaults/index.d.ts +0 -10289
  350. package/src/theme/defaults/index.ts +0 -203
  351. package/src/theme/defaults/light-arctic.json +0 -117
  352. package/src/theme/defaults/light-aurora-day.json +0 -101
  353. package/src/theme/defaults/light-canyon.json +0 -101
  354. package/src/theme/defaults/light-catppuccin.json +0 -116
  355. package/src/theme/defaults/light-cirrus.json +0 -100
  356. package/src/theme/defaults/light-coral.json +0 -105
  357. package/src/theme/defaults/light-cyberpunk.json +0 -106
  358. package/src/theme/defaults/light-dawn.json +0 -100
  359. package/src/theme/defaults/light-dunes.json +0 -101
  360. package/src/theme/defaults/light-eucalyptus.json +0 -105
  361. package/src/theme/defaults/light-forest.json +0 -110
  362. package/src/theme/defaults/light-frost.json +0 -105
  363. package/src/theme/defaults/light-github.json +0 -125
  364. package/src/theme/defaults/light-glacier.json +0 -101
  365. package/src/theme/defaults/light-gruvbox.json +0 -118
  366. package/src/theme/defaults/light-haze.json +0 -100
  367. package/src/theme/defaults/light-honeycomb.json +0 -105
  368. package/src/theme/defaults/light-lagoon.json +0 -101
  369. package/src/theme/defaults/light-lavender.json +0 -105
  370. package/src/theme/defaults/light-meadow.json +0 -101
  371. package/src/theme/defaults/light-mint.json +0 -105
  372. package/src/theme/defaults/light-monochrome.json +0 -111
  373. package/src/theme/defaults/light-ocean.json +0 -109
  374. package/src/theme/defaults/light-one.json +0 -109
  375. package/src/theme/defaults/light-opal.json +0 -101
  376. package/src/theme/defaults/light-orchard.json +0 -101
  377. package/src/theme/defaults/light-paper.json +0 -105
  378. package/src/theme/defaults/light-poimandres.json +0 -125
  379. package/src/theme/defaults/light-prism.json +0 -100
  380. package/src/theme/defaults/light-retro.json +0 -108
  381. package/src/theme/defaults/light-sand.json +0 -105
  382. package/src/theme/defaults/light-savanna.json +0 -101
  383. package/src/theme/defaults/light-solarized.json +0 -112
  384. package/src/theme/defaults/light-soleil.json +0 -100
  385. package/src/theme/defaults/light-sunset.json +0 -109
  386. package/src/theme/defaults/light-synthwave.json +0 -108
  387. package/src/theme/defaults/light-tokyo-night.json +0 -121
  388. package/src/theme/defaults/light-wetland.json +0 -101
  389. package/src/theme/defaults/light-zenith.json +0 -99
  390. package/src/theme/defaults/limestone.json +0 -104
  391. package/src/theme/defaults/mahogany.json +0 -107
  392. package/src/theme/defaults/marble.json +0 -103
  393. package/src/theme/defaults/obsidian.json +0 -101
  394. package/src/theme/defaults/onyx.json +0 -101
  395. package/src/theme/defaults/pearl.json +0 -103
  396. package/src/theme/defaults/porcelain.json +0 -101
  397. package/src/theme/defaults/quartz.json +0 -106
  398. package/src/theme/defaults/sandstone.json +0 -105
  399. package/src/theme/defaults/titanium.json +0 -100
@@ -17,7 +17,6 @@ import {
17
17
  formatErrorDetail,
18
18
  formatExpandHint,
19
19
  formatMoreItems,
20
- formatStatusIcon,
21
20
  PREVIEW_LIMITS,
22
21
  type RenderedStringCache,
23
22
  replaceTabs,
@@ -342,13 +341,12 @@ function formatStreamingContent(
342
341
  expanded: boolean,
343
342
  language: string | undefined,
344
343
  uiTheme: Theme,
345
- spinnerFrame?: number,
346
344
  cache?: RenderedStringCache,
347
345
  streamKey?: WriteStreamingPreviewStateCarrier,
348
346
  argsComplete?: boolean,
349
347
  ): string {
350
348
  if (!content) return "";
351
- const bodyText = cachedRenderedString(cache, uiTheme, expanded, language ?? "", content, () => {
349
+ return cachedRenderedString(cache, uiTheme, expanded, language ?? "", content, () => {
352
350
  const state = updateStreamingPreview(streamKey, content, language, uiTheme, argsComplete === true);
353
351
  let totalLines: number;
354
352
  let startIndex: number;
@@ -371,25 +369,17 @@ function formatStreamingContent(
371
369
  const hidden = startIndex;
372
370
  const lineNumberWidth = Math.max(WRITE_GUTTER_MIN_WIDTH, String(totalLines).length);
373
371
 
374
- let text = "\n\n";
372
+ const rows: string[] = [];
375
373
  if (hidden > 0) {
376
- text += `${uiTheme.fg("dim", `… (${hidden} earlier line${hidden === 1 ? "" : "s"})`)}\n`;
374
+ rows.push(uiTheme.fg("dim", `… (${hidden} earlier line${hidden === 1 ? "" : "s"})`));
377
375
  }
378
376
  for (let i = 0; i < visibleLines.length; i++) {
379
377
  const lineNum = startIndex + i + 1;
380
378
  const gutter = uiTheme.fg("dim", `${String(lineNum).padStart(lineNumberWidth, " ")} `);
381
- const body = replaceTabs(visibleLines[i] ?? "");
382
- text += `${gutter}${body}\n`;
379
+ rows.push(`${gutter}${replaceTabs(visibleLines[i] ?? "")}`);
383
380
  }
384
- return text;
381
+ return `\n\n${rows.join("\n")}`;
385
382
  });
386
- if (bodyText.length === 0) return "";
387
- // The animated glyph lives on this trailing line — inside the transcript's
388
- // volatile-tail holdback — never in the header: an animating head row pins
389
- // the native-scrollback commit boundary at the top of the block, so a long
390
- // expanded preview could never scroll-append mid-stream.
391
- const spinner = spinnerFrame !== undefined ? `${formatStatusIcon("running", uiTheme, spinnerFrame)} ` : "";
392
- return `${bodyText}${spinner}${uiTheme.fg("dim", `… (streaming)`)}`;
393
383
  }
394
384
 
395
385
  function wrapWritePreviewRows(lines: string[], width: number): string[] {
@@ -643,17 +633,6 @@ export const writeToolRenderer = {
643
633
  // rather than an archive member or database row selector.
644
634
  const pathDisplay =
645
635
  filePath && args.content !== undefined ? fileHyperlink(pendingFileLinkPath(rawPath), styledPath) : styledPath;
646
- // No status icon on the head row: it's the head of the framed block, and
647
- // native-scrollback commits are prefix-only — an animated glyph would pin
648
- // the commit boundary at the top, and the pending hourglass just adds
649
- // noise. The liveness cue rides the trailing "(streaming)" line instead.
650
- const header = renderStatusLine(
651
- {
652
- title: "Write",
653
- description: `${langIcon} ${pathDisplay}`,
654
- },
655
- uiTheme,
656
- );
657
636
  // Raw content, not normalizeDisplayText(args.content): the collapsed
658
637
  // streaming path normalizes only its tail window, so a full-payload
659
638
  // normalize on every reveal tick would re-introduce the O(n²) streaming
@@ -664,13 +643,22 @@ export const writeToolRenderer = {
664
643
  return framedToolCard(
665
644
  uiTheme,
666
645
  ({ contentWidth }) => {
646
+ // Only a live spinner fills the icon slot, as in Edit's call card.
647
+ const header = renderStatusLine(
648
+ {
649
+ icon: options?.spinnerFrame === undefined ? undefined : "running",
650
+ spinnerFrame: options?.spinnerFrame,
651
+ title: "Write",
652
+ description: `${langIcon} ${pathDisplay}`,
653
+ },
654
+ uiTheme,
655
+ );
667
656
  const body = content
668
657
  ? formatStreamingContent(
669
658
  content,
670
659
  Boolean(options?.expanded),
671
660
  lang,
672
661
  uiTheme,
673
- options?.spinnerFrame,
674
662
  streamingCache,
675
663
  // `options` is the ToolExecutionComponent's persistent
676
664
  // render-state object — a stable identity across reveal ticks
@@ -684,6 +672,8 @@ export const writeToolRenderer = {
684
672
  while (bodyLines.length > 0 && bodyLines[0].trim() === "") bodyLines.shift();
685
673
  return {
686
674
  header,
675
+ // The label ends with the args: once the content is complete the write is just running.
676
+ footerMeta: body && !options?.argsComplete ? uiTheme.fg("dim", "streaming") : undefined,
687
677
  sections: bodyLines.length > 0 ? [{ content: wrapWritePreviewRows(bodyLines, contentWidth) }] : [],
688
678
  phase: "pending",
689
679
  borderColor: "borderMuted",
@@ -15,7 +15,7 @@ export declare const yieldToolRenderer: {
15
15
  renderCall(args: YieldRenderArgs, options: RenderResultOptions, theme: Theme): Component;
16
16
  renderResult(result: ToolRenderResult<YieldItem>, options: RenderResultContextOptions, theme: Theme, args?: YieldRenderArgs): Component;
17
17
  describeCall(args: YieldRenderArgs, options: RenderResultOptions): NativeToolView;
18
- describeResult(result: ToolRenderResult<YieldItem>, _options: RenderResultContextOptions, args?: YieldRenderArgs): NativeToolView;
18
+ describeResult(result: ToolRenderResult<YieldItem>, options: RenderResultContextOptions, args?: YieldRenderArgs): NativeToolView;
19
19
  mergeCallAndResult: true;
20
20
  animatedPendingPreview: true;
21
21
  };
@@ -16,7 +16,7 @@ import type { Theme } from "../theme/theme";
16
16
  import type { Component } from "../tui";
17
17
  import { wrapTextWithAnsi } from "../utils";
18
18
  import {
19
- describeJsonTree,
19
+ describeJsonValue,
20
20
  JSON_TREE_MAX_DEPTH_COLLAPSED,
21
21
  JSON_TREE_MAX_DEPTH_EXPANDED,
22
22
  JSON_TREE_MAX_LINES_COLLAPSED,
@@ -98,15 +98,20 @@ function sizeMeta(data: unknown): string | undefined {
98
98
  return undefined;
99
99
  }
100
100
 
101
- function describeData(data: unknown, streaming: boolean): NativeChild | undefined {
101
+ function describeData(data: unknown, streaming: boolean, json: boolean): NativeChild | undefined {
102
102
  if (data === undefined) return undefined;
103
103
  if (typeof data === "string") return data.trim() ? md(data, { stream: streaming }) : noteText("(empty)");
104
104
  // Open to the depth cap: the data is the card's whole point, and the
105
105
  // collapsed card's preview clamp already bounds what shows.
106
- return describeJsonTree(data, { hiddenRootKeys: [], openDepth: JSON_TREE_MAX_DEPTH_EXPANDED });
106
+ return describeJsonValue(data, {
107
+ native: json,
108
+ open: JSON_TREE_MAX_DEPTH_EXPANDED - 1,
109
+ hiddenRootKeys: [],
110
+ openDepth: JSON_TREE_MAX_DEPTH_EXPANDED,
111
+ });
107
112
  }
108
113
 
109
- function describeSubmission(s: Submission, streaming: boolean): NativeToolView {
114
+ function describeSubmission(s: Submission, streaming: boolean, json: boolean): NativeToolView {
110
115
  const size = sizeMeta(s.data);
111
116
  return {
112
117
  tool: {
@@ -119,7 +124,7 @@ function describeSubmission(s: Submission, streaming: boolean): NativeToolView {
119
124
  tone: s.settled && s.error !== undefined ? "error" : undefined,
120
125
  body: compact([
121
126
  s.error !== undefined ? errorText(s.error) : undefined,
122
- describeData(s.data, streaming),
127
+ describeData(s.data, streaming, json),
123
128
  s.note ? noteText(s.note, "dim") : undefined,
124
129
  ]),
125
130
  };
@@ -161,7 +166,7 @@ function renderSubmission(s: Submission, options: RenderResultOptions, theme: Th
161
166
  const failed = s.settled && s.error !== undefined;
162
167
  const size = sizeMeta(s.data);
163
168
  const status: StatusLineOptions = {
164
- icon: !s.settled ? (running ? "running" : "pending") : failed ? "error" : "done",
169
+ icon: !s.settled ? (running ? "running" : "pending") : failed ? "error" : "success",
165
170
  spinnerFrame: options.spinnerFrame,
166
171
  title: TITLE,
167
172
  description: s.target,
@@ -207,16 +212,20 @@ export const yieldToolRenderer = {
207
212
 
208
213
  describeCall(args: YieldRenderArgs, options: RenderResultOptions): NativeToolView {
209
214
  const streaming = options.argsComplete === false;
210
- return callMemo.get(args, [streaming], () => describeSubmission(readSubmission(args, undefined), streaming));
215
+ const json = options.json === true;
216
+ return callMemo.get(args, [streaming, json], () =>
217
+ describeSubmission(readSubmission(args, undefined), streaming, json),
218
+ );
211
219
  },
212
220
 
213
221
  describeResult(
214
222
  result: ToolRenderResult<YieldItem>,
215
- _options: RenderResultContextOptions,
223
+ options: RenderResultContextOptions,
216
224
  args?: YieldRenderArgs,
217
225
  ): NativeToolView {
218
- return resultMemo.get(result.content, [args, result.details, result.isError], () =>
219
- describeSubmission(readSubmission(args, result), false),
226
+ const json = options.json === true;
227
+ return resultMemo.get(result.content, [args, result.details, result.isError, json], () =>
228
+ describeSubmission(readSubmission(args, result), false, json),
220
229
  );
221
230
  },
222
231
 
package/src/tui.d.ts CHANGED
@@ -80,7 +80,9 @@ export interface TUIStartOptions {
80
80
  * switches to raw input and replays the kernel-buffered keystrokes.
81
81
  *
82
82
  * A terminal expected to speak TSP needs raw input from the start, so it
83
- * gets it; its keystrokes are held instead (TSP events and the cell-size
83
+ * gets it. Plain typing (printable text, Backspace) still edits the focused
84
+ * component live, as the kernel echo shows it elsewhere; the first other key
85
+ * and every key after it are held instead (TSP events and the cell-size
84
86
  * reply still apply) until {@link TUI.releaseHeldInput} replays them.
85
87
  */
86
88
  deferInput?: boolean;
@@ -192,6 +194,18 @@ export interface Component {
192
194
  */
193
195
  dispose?(): void;
194
196
  }
197
+ /**
198
+ * A gutter component that can hand an external native renderer a semantic
199
+ * snapshot of the column it draws (see {@link TUI.setGutterComponent}). Such a
200
+ * component keeps rendering its ANSI rows — the snapshot only travels
201
+ * out-of-band — and a GUI that receives it draws the same content natively.
202
+ * Deliberately separate from {@link Component}: only a sidebar-shaped
203
+ * component describes itself for a whole external surface.
204
+ */
205
+ export interface NativeSnapshotSource {
206
+ /** JSON-serializable TSP node for an external native sidebar renderer. */
207
+ describeSnapshot(): NativeNode | null;
208
+ }
195
209
  /** Lets an overlay root delegate keyboard focus to components it owns. */
196
210
  export interface OverlayFocusOwner {
197
211
  /** Returns true when `component` is a focus target inside this overlay. */
@@ -525,7 +539,10 @@ export declare class TUI extends Container {
525
539
  * never come.
526
540
  */
527
541
  addStartListener(listener: StartListener): () => void;
528
- addInputListener(listener: InputListener): () => void;
542
+ /** Registers a key listener; `prepend` gives a foreground input owner first refusal over global shortcuts. */
543
+ addInputListener(listener: InputListener, options?: {
544
+ prepend?: boolean;
545
+ }): () => void;
529
546
  removeInputListener(listener: InputListener): void;
530
547
  stop(): void;
531
548
  /**
package/src/tui.ts CHANGED
@@ -21,7 +21,7 @@ import * as postmortem from "@linxiraos/pi-utils/postmortem";
21
21
  import type { TspFrame, TspNode, TspText } from "@linxiraos/pi-wire";
22
22
  import { DEFAULT_MAX_INLINE_IMAGES, ImageBudget } from "./components/image";
23
23
  import { TuiDebugServer } from "./debug-server";
24
- import { isKeyRelease, matchesKey } from "./keys";
24
+ import { extractPrintableText, isKeyRelease, matchesKey } from "./keys";
25
25
  import { KITTY_PLACEHOLDER } from "./kitty-graphics";
26
26
  import { LoopWatchdog } from "./loop-watchdog";
27
27
  import { assumedTspHello, NativeBackend, type NativeHost } from "./native/backend";
@@ -52,6 +52,7 @@ import {
52
52
  } from "./terminal-capabilities";
53
53
  import { onTerminalBackgroundFallbackChange } from "./theme/theme";
54
54
  import { compositeLineAt } from "./render/composite";
55
+ import { stripExtensionLinkMarkers } from "./render/extension-links";
55
56
  import { tmuxMultiplexer } from "./multiplexers/tmux";
56
57
  import {
57
58
  Ellipsis,
@@ -85,6 +86,15 @@ const LINE_FIT_SOURCE_WIDTH_MULTIPLIER = 64;
85
86
  // Zeta sidebar: the main area never composes narrower than this, even when a
86
87
  // gutter reservation is active — narrow terminals ignore the reservation.
87
88
  const MIN_MAIN_AREA_COLUMNS = 64;
89
+ // Zeta sidebar snapshot: the gutter column's semantic description travels
90
+ // out-of-band as an APC (`ESC _ zeta;sidebar; <base64 JSON> ESC \`) so a native
91
+ // GUI draws the same column from one frame's data. Unknown APCs are dropped by
92
+ // every terminal emulator, so the ANSI gutter stays the visible fallback.
93
+ const SIDEBAR_APC_PREFIX = "\x1b_zeta;sidebar;";
94
+ const SIDEBAR_APC_SUFFIX = "\x1b\\";
95
+ // Bound the payload per frame: a pathological snapshot falls back to the ANSI
96
+ // gutter instead of stalling the terminal's parser on a huge escape sequence.
97
+ const SIDEBAR_APC_MAX = 64 * 1024;
88
98
  // Hide the hardware cursor before each paint/move write. Ghostty-style bar
89
99
  // cursors can otherwise leave visual afterimages while the TUI repaints the
90
100
  // row under a visible cursor. Paint writes also disable terminal autowrap:
@@ -214,7 +224,9 @@ export interface TUIStartOptions {
214
224
  * switches to raw input and replays the kernel-buffered keystrokes.
215
225
  *
216
226
  * A terminal expected to speak TSP needs raw input from the start, so it
217
- * gets it; its keystrokes are held instead (TSP events and the cell-size
227
+ * gets it. Plain typing (printable text, Backspace) still edits the focused
228
+ * component live, as the kernel echo shows it elsewhere; the first other key
229
+ * and every key after it are held instead (TSP events and the cell-size
218
230
  * reply still apply) until {@link TUI.releaseHeldInput} replays them.
219
231
  */
220
232
  deferInput?: boolean;
@@ -354,6 +366,24 @@ export interface Component {
354
366
  dispose?(): void;
355
367
  }
356
368
 
369
+ /**
370
+ * A gutter component that can hand an external native renderer a semantic
371
+ * snapshot of the column it draws (see {@link TUI.setGutterComponent}). Such a
372
+ * component keeps rendering its ANSI rows — the snapshot only travels
373
+ * out-of-band — and a GUI that receives it draws the same content natively.
374
+ * Deliberately separate from {@link Component}: only a sidebar-shaped
375
+ * component describes itself for a whole external surface.
376
+ */
377
+ export interface NativeSnapshotSource {
378
+ /** JSON-serializable TSP node for an external native sidebar renderer. */
379
+ describeSnapshot(): NativeNode | null;
380
+ }
381
+
382
+ /** Whether `component` hands an out-of-band snapshot to a native renderer. */
383
+ function isSnapshotSource(component: Component): component is Component & NativeSnapshotSource {
384
+ return typeof (component as Partial<NativeSnapshotSource>).describeSnapshot === "function";
385
+ }
386
+
357
387
  /** Lets an overlay root delegate keyboard focus to components it owns. */
358
388
  export interface OverlayFocusOwner {
359
389
  /** Returns true when `component` is a focus target inside this overlay. */
@@ -926,6 +956,9 @@ export class TUI extends Container {
926
956
  // Zeta sidebar: right-hand gutter component and its last painted rows.
927
957
  #gutterComponent: Component | null = null;
928
958
  #paintedGutterRows: readonly string[] | null = null;
959
+ // Zeta sidebar snapshot: last APC payload written (`null` forces the next
960
+ // paint to write, even when the payload is the empty clear sequence).
961
+ #lastSidebarPayload: string | null = "";
929
962
  // Zeta sidebar: columns reserved for the gutter, or null for full width.
930
963
  #mainWidthOverride: number | null = null;
931
964
  #focusedComponent: Component | null = null;
@@ -1044,7 +1077,8 @@ export class TUI extends Container {
1044
1077
  #inputDeferred = false;
1045
1078
  /**
1046
1079
  * Keystrokes held since a TSP `deferInput` start, replayed by
1047
- * releaseHeldInput(); undefined when not holding.
1080
+ * releaseHeldInput(); undefined when not holding, empty while plain typing
1081
+ * still goes through live.
1048
1082
  */
1049
1083
  #heldInput: string[] | undefined;
1050
1084
  /**
@@ -1240,6 +1274,11 @@ export class TUI extends Container {
1240
1274
  if (this.#gutterComponent === component) return;
1241
1275
  this.#gutterComponent = component;
1242
1276
  this.#paintedGutterRows = null;
1277
+ // A replacement (or removed) component must never inherit the last column.
1278
+ // Force the next paint to publish its snapshot — or the clear payload — only
1279
+ // when a snapshot was actually published, so an ordinary gutter byte-stream
1280
+ // stays exactly as it was without a native renderer attached.
1281
+ if (this.#lastSidebarPayload !== "") this.#lastSidebarPayload = null;
1243
1282
  this.requestRender();
1244
1283
  }
1245
1284
 
@@ -1279,6 +1318,33 @@ export class TUI extends Container {
1279
1318
  seq += `\x1b[${restoreRow + 1};1H`;
1280
1319
  return seq;
1281
1320
  }
1321
+
1322
+ /**
1323
+ * The APC carrying this frame's sidebar snapshot (see
1324
+ * {@link NativeSnapshotSource}): `ESC _ zeta;sidebar; <base64(UTF-8 JSON)> ESC \`,
1325
+ * with an empty payload when there is no snapshot so a native renderer drops
1326
+ * the column. Returns "" while the payload is unchanged, so frames that only
1327
+ * repaint the same column write no extra bytes.
1328
+ */
1329
+ #sidebarApc(snapshot: NativeNode | null): string {
1330
+ let payload = "";
1331
+ if (snapshot !== null) {
1332
+ try {
1333
+ const json = JSON.stringify({ v: 1, node: snapshot });
1334
+ const encoded = Buffer.from(json, "utf8").toString("base64");
1335
+ // Oversized snapshots are dropped, not truncated: the ANSI gutter
1336
+ // already shows the same column.
1337
+ if (encoded.length <= SIDEBAR_APC_MAX) payload = encoded;
1338
+ } catch {
1339
+ // A component child or a property cycle cannot cross the snapshot
1340
+ // boundary; the frame falls back to the ANSI gutter.
1341
+ }
1342
+ }
1343
+ if (payload === this.#lastSidebarPayload) return "";
1344
+ this.#lastSidebarPayload = payload;
1345
+ return `${SIDEBAR_APC_PREFIX}${payload}${SIDEBAR_APC_SUFFIX}`;
1346
+ }
1347
+
1282
1348
  /** Return how settled resizes refresh native scrollback. */
1283
1349
  getResizeScrollback(): ResizeScrollbackMode {
1284
1350
  return this.#resizeScrollbackMode;
@@ -2549,8 +2615,13 @@ export class TUI extends Container {
2549
2615
  }
2550
2616
  }
2551
2617
 
2552
- addInputListener(listener: InputListener): () => void {
2553
- this.#inputListeners.add(listener);
2618
+ /** Registers a key listener; `prepend` gives a foreground input owner first refusal over global shortcuts. */
2619
+ addInputListener(listener: InputListener, options?: { prepend?: boolean }): () => void {
2620
+ if (options?.prepend) {
2621
+ this.#inputListeners = new Set([listener, ...this.#inputListeners]);
2622
+ } else {
2623
+ this.#inputListeners.add(listener);
2624
+ }
2554
2625
  return () => {
2555
2626
  this.#inputListeners.delete(listener);
2556
2627
  };
@@ -3069,7 +3140,11 @@ export class TUI extends Container {
3069
3140
  }
3070
3141
  if (data.length === 0) return;
3071
3142
 
3072
- if (this.#heldInput !== undefined && this.#focusedComponent === this.#heldFocus) {
3143
+ if (
3144
+ this.#heldInput !== undefined &&
3145
+ this.#focusedComponent === this.#heldFocus &&
3146
+ !this.#typesThroughHold(data)
3147
+ ) {
3073
3148
  this.#holdInput(data);
3074
3149
  return;
3075
3150
  }
@@ -3159,6 +3234,18 @@ export class TUI extends Container {
3159
3234
  return holder?.component === focused ? holder.preFocus : null;
3160
3235
  }
3161
3236
 
3237
+ /**
3238
+ * Whether a keystroke typed during a TSP startup hold edits the focused
3239
+ * component now: plain typing (printable text, Backspace) and key releases,
3240
+ * while nothing is queued ahead of them. The draft then grows as it is typed,
3241
+ * like a cooked tty's echo; a shortcut waits for the handlers that act on it,
3242
+ * and whatever follows it waits behind it to keep typing order.
3243
+ */
3244
+ #typesThroughHold(data: string): boolean {
3245
+ if (this.#heldInput!.length > 0) return false;
3246
+ return extractPrintableText(data) !== undefined || matchesKey(data, "backspace") || isKeyRelease(data);
3247
+ }
3248
+
3162
3249
  /**
3163
3250
  * Queue a keystroke typed before the app installed its key handlers; input
3164
3251
  * listeners see it once, on replay. The cell-size reply is a terminal report,
@@ -3570,16 +3657,36 @@ export class TUI extends Container {
3570
3657
  if (gutter) {
3571
3658
  const rows = gutter.render(rawWidth - mainWidth);
3572
3659
  const seq = this.#gutterPaintSequence(rows, rawWidth - mainWidth, mainWidth, viewportRows, 0);
3573
- if (seq) this.terminal.write(seq);
3660
+ // The snapshot rides the same write as the gutter paint, so both describe
3661
+ // this one frame; an APC never moves the cursor.
3662
+ let snapshot: NativeNode | null = null;
3663
+ if (isSnapshotSource(gutter)) {
3664
+ try {
3665
+ snapshot = gutter.describeSnapshot();
3666
+ } catch {
3667
+ // A throwing snapshot source must not take down the frame; the ANSI
3668
+ // gutter below already shows the column.
3669
+ snapshot = null;
3670
+ }
3671
+ }
3672
+ const apc = this.#sidebarApc(snapshot);
3673
+ if (seq || apc) this.terminal.write(seq + apc);
3574
3674
  this.#paintedGutterRows = rows;
3575
- } else if (this.#paintedGutterRows !== null) {
3576
- // Gutter removed: clear the margin column once via absolute EL per row.
3577
- const col = mainWidth + 1;
3578
- let seq = "";
3579
- for (let row = 0; row < height; row++) seq += `\x1b[${row + 1};${col}H\x1b[K`;
3580
- seq += "\x1b[H";
3581
- this.terminal.write(seq);
3582
- this.#paintedGutterRows = null;
3675
+ } else {
3676
+ // Overlay frame, no reservation, or no component: clear the native column
3677
+ // once so a GUI never keeps drawing a snapshot the ANSI frame dropped.
3678
+ const apc = this.#sidebarApc(null);
3679
+ if (this.#paintedGutterRows !== null) {
3680
+ // Gutter removed: clear the margin column once via absolute EL per row.
3681
+ const col = mainWidth + 1;
3682
+ let seq = "";
3683
+ for (let row = 0; row < height; row++) seq += `\x1b[${row + 1};${col}H\x1b[K`;
3684
+ seq += "\x1b[H";
3685
+ this.terminal.write(seq + apc);
3686
+ this.#paintedGutterRows = null;
3687
+ } else if (apc) {
3688
+ this.terminal.write(apc);
3689
+ }
3583
3690
  }
3584
3691
  }
3585
3692
  /**
@@ -4266,45 +4373,48 @@ export class TUI extends Container {
4266
4373
  LINE_FIT_MAX_SOURCE_CODE_UNITS,
4267
4374
  Math.max(LINE_FIT_MIN_SOURCE_CODE_UNITS, safeWidth * LINE_FIT_SOURCE_WIDTH_MULTIPLIER),
4268
4375
  );
4376
+ // Extension link markers exist only for hit-testing; the terminal must never get an openable
4377
+ // hyperlink. Strip before fitting (so a cut cannot split one) and before classifying.
4378
+ const output = stripExtensionLinkMarkers(raw);
4269
4379
 
4270
4380
  let source: string;
4271
4381
  let classification: LineClassification;
4272
- if (raw.length <= maxSourceLength) {
4382
+ if (output.length <= maxSourceLength) {
4273
4383
  // The overwhelmingly common path classifies image markers, OSC 8,
4274
4384
  // ANSI validity, OSC 66, non-ASCII, and exact ASCII width together.
4275
- classification = this.#classifyLine(raw, safeWidth);
4385
+ classification = this.#classifyLine(output, safeWidth);
4276
4386
  if (classification.isImage) {
4277
4387
  return {
4278
4388
  raw,
4279
4389
  width,
4280
4390
  widthEpoch,
4281
4391
  imageProtocol,
4282
- line: raw,
4283
- terminalContent: raw,
4392
+ line: output,
4393
+ terminalContent: output,
4284
4394
  asciiWidth: undefined,
4285
4395
  isImage: true,
4286
4396
  hasOsc8: false,
4287
4397
  };
4288
4398
  }
4289
- source = raw;
4399
+ source = output;
4290
4400
  } else {
4291
4401
  // Fitting a giant source can discard everything after the visible
4292
4402
  // prefix. Preserve image rows verbatim first, but do not scan the
4293
4403
  // entire source for width/OSC metadata that will immediately vanish.
4294
- if (TERMINAL.isImageLine(raw)) {
4404
+ if (TERMINAL.isImageLine(output)) {
4295
4405
  return {
4296
4406
  raw,
4297
4407
  width,
4298
4408
  widthEpoch,
4299
4409
  imageProtocol,
4300
- line: raw,
4301
- terminalContent: raw,
4410
+ line: output,
4411
+ terminalContent: output,
4302
4412
  asciiWidth: undefined,
4303
4413
  isImage: true,
4304
4414
  hasOsc8: false,
4305
4415
  };
4306
4416
  }
4307
- source = this.#lineFitSource(raw, safeWidth, maxSourceLength);
4417
+ source = this.#lineFitSource(output, safeWidth, maxSourceLength);
4308
4418
  // Preserve the former lineRewriteSequence classification: fitting can
4309
4419
  // move a marker from outside the raw scan window into the prepared
4310
4420
  // line's window, at which point terminal image dispatch owns it.
package/src/utils.d.ts CHANGED
@@ -36,6 +36,10 @@ export declare function truncateToWidth(text: string, maxWidth: number, ellipsis
36
36
  export declare function wrapTextWithAnsi(text: string, width: number): string[];
37
37
  export declare function extractSegments(line: string, beforeEnd: number, afterStart: number, afterLen: number, strictAfter: boolean): ExtractSegmentsResult;
38
38
  export declare function replaceTabs(text: string): string;
39
+ /** Tabs expanded and line breaks collapsed to spaces, for text confined to one rendered row. */
40
+ export declare function singleLine(text: string): string;
41
+ /** A non-negative integer cell width; non-finite input becomes `fallback`. */
42
+ export declare function finiteWidth(width: number, fallback?: number): number;
39
43
  /**
40
44
  * Returns a string of n spaces. Uses a pre-allocated buffer for efficiency.
41
45
  */
package/src/utils.ts CHANGED
@@ -221,6 +221,16 @@ export function replaceTabs(text: string): string {
221
221
  return text.replaceAll("\t", TAB_SPACES);
222
222
  }
223
223
 
224
+ /** Tabs expanded and line breaks collapsed to spaces, for text confined to one rendered row. */
225
+ export function singleLine(text: string): string {
226
+ return replaceTabs(text).replace(/[\r\n]+/g, " ");
227
+ }
228
+
229
+ /** A non-negative integer cell width; non-finite input becomes `fallback`. */
230
+ export function finiteWidth(width: number, fallback = 0): number {
231
+ return Number.isFinite(width) ? Math.max(0, Math.trunc(width)) : fallback;
232
+ }
233
+
224
234
  /**
225
235
  * Returns a string of n spaces. Uses a pre-allocated buffer for efficiency.
226
236
  */