@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
@@ -116,7 +116,7 @@ export const TAB_LEADS: Record<SettingTab, string> = {
116
116
  */
117
117
  export const TAB_GROUPS: Record<SettingTab, readonly string[]> = {
118
118
  appearance: ["General", "Theme", "Composer", "Status Line", "Display", "Images"],
119
- model: ["Thinking", "Sampling", "Prompt", "Roles", "Retry & Fallback", "Advisor", "Prewalk", "Vision"],
119
+ model: ["Thinking", "Sampling", "Prompt", "Catalog", "Roles", "Retry & Fallback", "Advisor", "Prewalk", "Vision"],
120
120
  interaction: [
121
121
  "Input",
122
122
  "Approvals",
@@ -132,7 +132,7 @@ export const TAB_GROUPS: Record<SettingTab, readonly string[]> = {
132
132
  "Skills",
133
133
  ],
134
134
  context: ["General", "Compaction", "Zeta Context Cache", "Rules (TTSR)", "Experimental"],
135
- memory: ["General", "Auto-Learn", "Mnemopi", "Hindsight", "Sharpshooter"],
135
+ memory: ["General", "Taste", "Auto-Learn", "Mnemopi", "Hindsight", "Sharpshooter"],
136
136
  files: ["Editing", "Reading", "Read Summaries", "LSP", "Session Trash"],
137
137
  shell: ["Bash", "Eval & Runtimes"],
138
138
  tools: [
@@ -10,7 +10,7 @@ import {
10
10
  TruncatedText,
11
11
  truncateToWidth,
12
12
  } from "../index";
13
- import { isRecord, sanitizeText } from "@linxiraos/pi-utils";
13
+ import { isRecord, oklabDistance, sanitizeText } from "@linxiraos/pi-utils";
14
14
  /** Available session-tree display filters. */
15
15
  export const TREE_FILTER_MODES = ["default", "no-tools", "user-only", "labeled-only", "all"] as const;
16
16
  /** Session-tree display filter. */
@@ -94,10 +94,15 @@ interface AdvisorTreeDisplay {
94
94
  */
95
95
  function sanitizeTreeField(value: string): string {
96
96
  return sanitizeText(value)
97
- .replace(/[\n\t]/g, " ")
97
+ .replace(/[\r\n\t\u2028\u2029]/g, " ")
98
98
  .trim();
99
99
  }
100
100
 
101
+ /** Strip ANSI/control characters and fold line breaks for single-line tree rows and headers. */
102
+ function treeRowText(value: string): string {
103
+ return plainText(value.replace(/[\r\n\u2028\u2029]/g, " "));
104
+ }
105
+
101
106
  /**
102
107
  * Extract display metadata from an advisor custom-message's `details.notes`,
103
108
  * ignoring the model-facing `<advisory>` wrapper stored in `content`. Collects
@@ -165,10 +170,38 @@ function stripSystemWrapperTags(content: string): string {
165
170
  /** Per-message cap on text folded into the tree search index. */
166
171
  const SEARCH_TEXT_LIMIT = 200;
167
172
 
168
- /** One theme-colored piece of an entry's display text. */
173
+ /** One theme-colored piece of an entry's display text; `strong` draws it bold. */
169
174
  interface EntryPart {
170
175
  t: string;
171
176
  s?: ThemeColor;
177
+ strong?: boolean;
178
+ }
179
+
180
+ /** An entry part as a native span. */
181
+ function partSpan(part: EntryPart): TspSpan {
182
+ const style = part.strong ? (part.s ? `${part.s} strong` : "strong") : part.s;
183
+ return span(treeRowText(part.t), style);
184
+ }
185
+
186
+ /** OKLab distance under which two role colors read as the same color. */
187
+ const SAME_COLOR_DISTANCE = 0.05;
188
+
189
+ let assistantLabel: { theme: typeof theme; color: ThemeColor } | undefined;
190
+
191
+ /**
192
+ * The `assistant:` label color: `success`, unless it looks like the `user:` label's
193
+ * `accent` (`dark-terminal`, `*-poimandres`); then the path color, then `muted`.
194
+ */
195
+ function assistantLabelColor(): ThemeColor {
196
+ if (assistantLabel?.theme !== theme) {
197
+ const accent = theme.getColorHex("accent");
198
+ const color =
199
+ (["success", "statusLinePath"] as const).find(
200
+ c => oklabDistance(theme.getColorHex(c), accent) >= SAME_COLOR_DISTANCE,
201
+ ) ?? "muted";
202
+ assistantLabel = { theme, color };
203
+ }
204
+ return assistantLabel.color;
172
205
  }
173
206
 
174
207
  /** A cached native tree item and the inputs it was built from. */
@@ -234,6 +267,8 @@ class TreeList implements Component {
234
267
  | undefined;
235
268
  /** Bumped on every label edit: labels are item badges. */
236
269
  #labelVersion = 0;
270
+ /** Theme the native item caches were built under: labels bake in the `assistant:` color. */
271
+ #nativeTheme = theme;
237
272
  #pickerItems:
238
273
  | { rows: readonly TreeRow<TreeSelectorNode, string>[]; labels: number; items: TspPickerItem[] }
239
274
  | undefined;
@@ -703,6 +738,7 @@ class TreeList implements Component {
703
738
  * only `order` (the visible entries) and the selection.
704
739
  */
705
740
  pickerView(): TreePickerView {
741
+ this.#syncNativeTheme();
706
742
  const allRows = this.#tree.allRows;
707
743
  if (this.#pickerItems?.rows !== allRows || this.#pickerItems.labels !== this.#labelVersion) {
708
744
  // Real branch points get a disclosure; linear chains stay flat at their head's depth.
@@ -734,9 +770,7 @@ class TreeList implements Component {
734
770
  #pickerItem(row: TreeRow<TreeSelectorNode, string>, open: boolean): TspPickerItem {
735
771
  const item = row.item;
736
772
  const entry = item.entry;
737
- const label = this.#entryParts(item).map(part =>
738
- span(part.t.includes("\x1b") ? plainText(part.t) : part.t, part.s),
739
- );
773
+ const label = this.#entryParts(item).map(partSpan);
740
774
  let kind: TspPickerItem["node"] = "marker";
741
775
  let role: string | undefined;
742
776
  if (isUserRequestEntry(entry)) {
@@ -755,7 +789,7 @@ class TreeList implements Component {
755
789
  node: kind,
756
790
  ...(role ? { role } : {}),
757
791
  ...(open ? { open: true } : {}),
758
- ...(item.label ? { badges: [{ text: plainText(item.label), tone: "warning" as const }] } : {}),
792
+ ...(item.label ? { badges: [{ text: treeRowText(item.label), tone: "warning" as const }] } : {}),
759
793
  ...(this.#activePathIds.has(row.key) ? { dot: "accent" as const } : {}),
760
794
  };
761
795
  }
@@ -772,7 +806,7 @@ class TreeList implements Component {
772
806
  if (selected) {
773
807
  const entry = selected.entry;
774
808
  const parts = this.#entryParts(selected)
775
- .map(part => (part.t.includes("\x1b") ? plainText(part.t) : part.t))
809
+ .map(part => treeRowText(part.t))
776
810
  .join("");
777
811
  if (entry.type === "message" || entry.type === "custom_message") {
778
812
  const target: OutlineTarget = {
@@ -784,12 +818,16 @@ class TreeList implements Component {
784
818
  entries: [entry],
785
819
  };
786
820
  const copy = targetCopy(target, collectBlocks(target.entries));
787
- preview.push(text(`${copy.label[0]!.toUpperCase()}${copy.label.slice(1)}`, { role: "zeta.picker.title" }));
788
- if (selected.label) preview.push(text([span(plainText(selected.label), "warning")]));
821
+ preview.push(
822
+ text(treeRowText(`${copy.label[0]!.toUpperCase()}${copy.label.slice(1)}`), {
823
+ role: "zeta.picker.title",
824
+ }),
825
+ );
826
+ if (selected.label) preview.push(text([span(treeRowText(selected.label), "warning")]));
789
827
  preview.push(turnPreview(target, copy.content || parts));
790
828
  } else {
791
829
  preview.push(text(parts, { role: "zeta.picker.title" }));
792
- if (selected.label) preview.push(text([span(plainText(selected.label), "warning")]));
830
+ if (selected.label) preview.push(text([span(treeRowText(selected.label), "warning")]));
793
831
  }
794
832
  }
795
833
  this.#previewMemo = { node: selected, labels: this.#labelVersion, preview };
@@ -803,6 +841,7 @@ class TreeList implements Component {
803
841
  * instead of drawn tree connectors.
804
842
  */
805
843
  describeList(): NativeNode {
844
+ this.#syncNativeTheme();
806
845
  const rows = this.#tree.rows;
807
846
  let items = this.#itemsNative;
808
847
  if (items?.rows !== rows) {
@@ -852,6 +891,15 @@ class TreeList implements Component {
852
891
  ];
853
892
  }
854
893
 
894
+ /** Drop native items built under another theme. */
895
+ #syncNativeTheme(): void {
896
+ if (this.#nativeTheme === theme) return;
897
+ this.#nativeTheme = theme;
898
+ this.#pickerItems = undefined;
899
+ this.#itemsNative = undefined;
900
+ this.#itemCache.clear();
901
+ }
902
+
855
903
  #describeRow(row: TreeRow<TreeSelectorNode, string>): NativeNode {
856
904
  const item = row.item;
857
905
  const branch = row.parentKey !== undefined && row.siblingCount > 1;
@@ -859,10 +907,8 @@ class TreeList implements Component {
859
907
  if (cached !== undefined && cached.label === item.label && cached.branch === branch) return cached.node;
860
908
  const label: TspSpan[] = [];
861
909
  if (this.#activePathIds.has(row.key)) label.push(span(`${theme.md.bullet} `, "accent"));
862
- if (item.label) label.push(span(`[${plainText(item.label)}] `, "warning"));
863
- for (const part of this.#entryParts(item)) {
864
- label.push(span(part.t.includes("\x1b") ? plainText(part.t) : part.t, part.s));
865
- }
910
+ if (item.label) label.push(span(`[${treeRowText(item.label)}] `, "warning"));
911
+ for (const part of this.#entryParts(item)) label.push(partSpan(part));
866
912
  const described = node("item", { label, icon: branch ? "branch" : undefined }, undefined, row.key);
867
913
  this.#itemCache.set(row.key, { label: item.label, branch, node: described });
868
914
  return described;
@@ -954,7 +1000,7 @@ class TreeList implements Component {
954
1000
  // Active path marker - shown right before the entry text
955
1001
  const isOnActivePath = this.#activePathIds.has(node.entry.id);
956
1002
  const pathMarker = isOnActivePath ? theme.fg("accent", `${theme.md.bullet} `) : "";
957
- const label = node.label ? theme.fg("warning", `[${node.label}] `) : "";
1003
+ const label = node.label ? theme.fg("warning", `[${treeRowText(node.label)}] `) : "";
958
1004
  return `${pathMarker}${label}${this.#getEntryDisplayText(node, selected)}`;
959
1005
  }
960
1006
 
@@ -1050,7 +1096,13 @@ class TreeList implements Component {
1050
1096
 
1051
1097
  #getEntryDisplayText(node: TreeSelectorNode, isSelected: boolean): string {
1052
1098
  let result = "";
1053
- for (const part of this.#entryParts(node)) result += part.s ? theme.fg(part.s, part.t) : part.t;
1099
+ for (const part of this.#entryParts(node)) {
1100
+ let value = treeRowText(part.t);
1101
+ if (part.s) value = theme.fg(part.s, value);
1102
+ // A selected row is bolded whole; nested bold would close it early.
1103
+ if (part.strong && !isSelected) value = theme.bold(value);
1104
+ result += value;
1105
+ }
1054
1106
  return isSelected ? theme.bold(result) : result;
1055
1107
  }
1056
1108
 
@@ -1066,7 +1118,10 @@ class TreeList implements Component {
1066
1118
  if (role === "user") {
1067
1119
  const msgWithContent = msg as { content?: unknown };
1068
1120
  const content = normalize(this.#extractContent(msgWithContent.content));
1069
- return [{ t: "user: ", s: "accent" }, { t: content }];
1121
+ return [
1122
+ { t: "user: ", s: "accent", strong: true },
1123
+ { t: content, s: "accent", strong: true },
1124
+ ];
1070
1125
  }
1071
1126
  if (role === "developer") {
1072
1127
  const msgWithContent = msg as { content?: unknown };
@@ -1078,15 +1133,10 @@ class TreeList implements Component {
1078
1133
  }
1079
1134
  if (role === "assistant") {
1080
1135
  const presentation = resolveAssistantErrorPresentation(msg);
1081
- if (presentation.kind === "compact-recovered") {
1082
- return [
1083
- { t: "assistant: ", s: "success" },
1084
- { t: presentation.text, s: "dim" },
1085
- ];
1086
- }
1136
+ const head: EntryPart = { t: "assistant: ", s: assistantLabelColor() };
1137
+ if (presentation.kind === "compact-recovered") return [head, { t: presentation.text, s: "dim" }];
1087
1138
  const msgWithContent = msg as { content?: unknown; stopReason?: string; errorMessage?: string };
1088
1139
  const textContent = normalize(this.#extractContent(msgWithContent.content));
1089
- const head: EntryPart = { t: "assistant: ", s: "success" };
1090
1140
  if (textContent) return [head, { t: textContent }];
1091
1141
  if (presentation.kind === "full") {
1092
1142
  return [head, { t: normalize(presentation.text).slice(0, 80), s: "error" }];
@@ -1110,10 +1160,16 @@ class TreeList implements Component {
1110
1160
  if (entry.customType === "advisor") {
1111
1161
  const { qualifier, text } = advisorTreeDisplay(entry.details);
1112
1162
  const label = qualifier ? `advisor (${qualifier}): ` : "advisor: ";
1113
- return [{ t: label, s: "customMessageLabel" }, { t: normalize(text) }];
1163
+ return [
1164
+ { t: label, s: "customMessageLabel" },
1165
+ { t: normalize(text), s: "muted" },
1166
+ ];
1114
1167
  }
1115
1168
  const content = stripSystemWrapperTags(this.#joinTextContent(entry.content));
1116
- return [{ t: `[${entry.customType}]: `, s: "customMessageLabel" }, { t: normalize(content) }];
1169
+ return [
1170
+ { t: `[${entry.customType}]: `, s: "customMessageLabel" },
1171
+ { t: normalize(content), s: "muted" },
1172
+ ];
1117
1173
  }
1118
1174
  case "compaction": {
1119
1175
  const tokens = Math.round(entry.tokensBefore / 1000);
@@ -43,7 +43,7 @@ import { editorKey, editorKeys } from "../chrome/keybinding-hints";
43
43
  import type { TspSpan, TspTableColumn, TspText, TspTone } from "@linxiraos/pi-wire";
44
44
  import { col, elapsed, node, span, text } from "../native/describe";
45
45
  import { type DescribeContext, leafKey, type NativeChild, type NativeNode, type NativeUiEvent } from "../native/node";
46
- import { actionBar, actionButton } from "../native/overlay";
46
+ import { actionBar, actionButton, segmentedTabs } from "../native/overlay";
47
47
 
48
48
  /** Local calendar-day activity consumed by the usage heatmap. */
49
49
  export interface DailyActivityPoint {
@@ -435,22 +435,15 @@ function clockTime(date: Date): string {
435
435
  }
436
436
 
437
437
  /**
438
- * When a window resets, relative to `nowMs`: `resets 18:00` today, `resets
439
- * Tue 18:00` within the week, `resets 3 Oct` beyond; the title carries the
440
- * absolute date and the countdown.
438
+ * When a window resets, `resetMs` from `nowMs`: the countdown (`resets in
439
+ * 2h30m`), which reads the same in every time zone; the title carries the
440
+ * local date and time.
441
441
  */
442
442
  function resetLabel(nowMs: number, resetMs: number): { text: string; title: string } {
443
443
  const at = new Date(nowMs + resetMs);
444
- const now = new Date(nowMs);
445
- const sameDay = at.toDateString() === now.toDateString();
446
- const text = sameDay
447
- ? `resets ${clockTime(at)}`
448
- : resetMs < 6 * 86_400_000
449
- ? `resets ${WEEKDAY_NAMES[at.getDay()]} ${clockTime(at)}`
450
- : `resets ${at.getDate()} ${MONTH_NAMES[at.getMonth()]}`;
451
444
  return {
452
- text,
453
- title: `Resets ${shortDate(at)} ${at.getFullYear()}, ${clockTime(at)} (in ${formatDuration(resetMs)})`,
445
+ text: `resets in ${formatDuration(resetMs)}`,
446
+ title: `Resets ${shortDate(at)} ${at.getFullYear()}, ${clockTime(at)}`,
454
447
  };
455
448
  }
456
449
 
@@ -656,8 +649,8 @@ export interface UsageDashboardOptions {
656
649
  export function formatActivityErrorDetail(error: string, homeDir = os.homedir()): string {
657
650
  let text = replaceTabs(sanitizeText(error)).replace(/\s+/g, " ").trim();
658
651
  if (homeDir) {
659
- const escaped = homeDir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
660
- const forward = homeDir.replaceAll("\\", "/").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
652
+ const escaped = RegExp.escape(homeDir);
653
+ const forward = RegExp.escape(homeDir.replaceAll("\\", "/"));
661
654
  text = text.replace(new RegExp(`${escaped}|${forward}`, "gi"), "~");
662
655
  }
663
656
  return text.replace(/\.+$/, "");
@@ -1142,8 +1135,7 @@ export class UsageDashboardComponent implements Component {
1142
1135
  );
1143
1136
  }
1144
1137
  const children: NativeChild[] = [
1145
- node(
1146
- "tabs",
1138
+ segmentedTabs(
1147
1139
  {
1148
1140
  items: [
1149
1141
  { id: "overview", label: "Overview" },
@@ -1151,7 +1143,6 @@ export class UsageDashboardComponent implements Component {
1151
1143
  ],
1152
1144
  active: this.#view,
1153
1145
  },
1154
- undefined,
1155
1146
  "tabs",
1156
1147
  ),
1157
1148
  node("spacer", { grow: 1 }),
@@ -1,6 +1,8 @@
1
1
  import { getComposerStyle } from "../components/composer/registry";
2
2
  import { Spacer } from "../components/spacer";
3
3
  import type { StatusLineComponent } from "../status-line/component";
4
+ import { compositeLineAt } from "../render/composite";
5
+ import { type ExtensionLinkLabel, extensionLinkLabels, linkHintTags } from "../render/extension-links";
4
6
  import type { StatusLineSession } from "../status-line/host";
5
7
  import { createStartupStatusLine, type StatusLineStartupData } from "../status-line/startup";
6
8
  import { isInsideTerminalMultiplexer } from "../terminal-multiplexer";
@@ -101,6 +103,13 @@ export interface RuntimeChildrenOptions {
101
103
  * to the roots below the transcript in render order.
102
104
  */
103
105
  readonly nativeDock?: readonly Component[];
106
+ /**
107
+ * Below-transcript containers whose children continue `main` on a TSP
108
+ * terminal, one block each after the transcript's, instead of riding in the
109
+ * dock: output on its way into the transcript (shell runs deferred until the
110
+ * next prompt) reads as its tail, and keeps its block when it moves in.
111
+ */
112
+ readonly nativeTail?: readonly Container[];
104
113
  /**
105
114
  * Below-transcript roots the user opens and closes (the editor surface that
106
115
  * drafts and dialogs swap into, docked reports). Their rows never become
@@ -177,6 +186,46 @@ export function routeViewportClick(spans: readonly ViewportClickSpan[], index: n
177
186
  return [];
178
187
  }
179
188
 
189
+ /** An extension link label drawn on a mutable-viewport line: what a click or hint tag lands on. */
190
+ export interface ViewportLink {
191
+ readonly url: string;
192
+ /** Mutable-viewport line the label is drawn on. */
193
+ readonly row: number;
194
+ /** First cell of the label's part on that line. */
195
+ readonly start: number;
196
+ }
197
+
198
+ /** An extension link label tagged for picking by keyboard in link-hint mode. */
199
+ interface ViewportLinkHint {
200
+ readonly tag: string;
201
+ readonly link: ViewportLink;
202
+ }
203
+
204
+ /**
205
+ * Called once when link-hint mode ends; `reason` is `"crowded"` when a row held more links than
206
+ * their tags could fit side by side, so no tags were drawn.
207
+ */
208
+ export type LinkHintsEnd = (reason?: "crowded") => void;
209
+
210
+ /**
211
+ * The extension link labels drawn on `rows`, top to bottom, a wrapped label once at its first row:
212
+ * a row's first label continues the previous row's last label when that has the same marker id
213
+ * and ends its row.
214
+ */
215
+ function viewportLinkTargets(rows: readonly string[]): ViewportLink[] {
216
+ const targets: ViewportLink[] = [];
217
+ let previous: ExtensionLinkLabel | undefined;
218
+ for (let row = 0; row < rows.length; row++) {
219
+ const labels = extensionLinkLabels(rows[row]!);
220
+ for (const [index, label] of labels.entries()) {
221
+ if (index === 0 && previous?.endsRow && previous.id === label.id) continue;
222
+ targets.push({ url: label.url, row, start: label.start });
223
+ }
224
+ previous = labels.at(-1);
225
+ }
226
+ return targets;
227
+ }
228
+
180
229
  /**
181
230
  * Reserved click-candidate id for the pinned HUD expander row. Checked before
182
231
  * any registry lookup: its `@…:…` charset cannot collide with generated agent
@@ -224,6 +273,7 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
224
273
  #headerAfter: readonly Component[] = [];
225
274
  #runtimeChildren: readonly Component[] = [];
226
275
  #nativeDock: readonly Component[] | undefined;
276
+ #nativeTail: readonly Container[] = [];
227
277
  /** Cache-driven status line shown until {@link setStatusComponent} mounts the session's. */
228
278
  #startupStatus: StatusLineComponent | undefined;
229
279
  #runtimeMounted = false;
@@ -260,8 +310,18 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
260
310
  #retiredHeaderRows: readonly string[] | undefined;
261
311
  /** Click spans of the last `renderFrame` viewport, in viewport coordinates. */
262
312
  #lastClickSpans: ViewportClickSpan[] = [];
313
+ /** Rows of the last `renderFrame` viewport, before the hover band; read to hit-test extension links. */
314
+ #lastViewportRows: readonly string[] = [];
263
315
  /** Click-candidate id under the pointer, painted with the hover band. Id-anchored so it follows streaming rows. */
264
316
  #hoveredClickId: string | undefined;
317
+ /**
318
+ * Keyboard link-hint mode: the tags drawn over the extension links on screen (`undefined` until
319
+ * the first frame after `startLinkHints` assigns them), the letters typed so far, and what to run
320
+ * when the mode ends for any reason.
321
+ */
322
+ #linkHints: { hints: ViewportLinkHint[] | undefined; typed: string; onEnd: LinkHintsEnd } | undefined;
323
+ /** Width of the last painted viewport, which `#lastViewportRows` was laid out for. */
324
+ #lastViewportWidth = 0;
265
325
  // Hard-row prefix currently above the native viewport. The first resize
266
326
  // frame may pull part of it down before the normal buffer is borrowed.
267
327
  #retiredHeaderStart = 0;
@@ -403,6 +463,8 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
403
463
  const transcriptIndex = roots.findIndex(root => root instanceof TranscriptContainer);
404
464
  if (transcriptIndex < 0) {
405
465
  this.#lastClickSpans = [];
466
+ this.#lastViewportRows = [];
467
+ this.#syncLinkHints([], 0);
406
468
  const viewport: string[] = [];
407
469
  for (const root of roots) {
408
470
  const rendered = root.render(width);
@@ -512,20 +574,105 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
512
574
  for (const span of activeSpans) shift(span, before.length - drop);
513
575
  for (const span of afterSpans) shift(span, slack + before.length + active.length - drop);
514
576
  this.#lastClickSpans = spans;
577
+ this.#lastViewportRows = mutable;
578
+ this.#lastViewportWidth = width;
579
+ this.#syncLinkHints(mutable, width);
515
580
  if (history !== undefined && this.#offeredHistory?.source === "header") {
516
581
  const visibleHeaderRows = Math.max(0, rows - (mutable.length + drop));
517
582
  this.#retiredHeaderStart = Math.max(0, history.rows.length - visibleHeaderRows);
518
583
  }
519
- return { history, viewport: this.#paintHoverBand(mutable, spans) };
584
+ return { history, viewport: this.#paintLinkHints(this.#paintHoverBand(mutable, spans), width) };
585
+ }
586
+
587
+ /**
588
+ * Keep link-hint tags on what `rows` show. The first frame after `startLinkHints` tags its
589
+ * labels; later frames keep the tags while the tagged labels are still drawn first, in the same
590
+ * order and columns (rows may scroll, links may be added below), and otherwise end the mode, so a
591
+ * tag never picks a label no longer drawn under it. Every frame ends the mode as `"crowded"` when
592
+ * some row has more tag cells than `width` (a resize can narrow it), since tags drawn side by
593
+ * side could not all be read.
594
+ */
595
+ #syncLinkHints(rows: readonly string[], width: number): void {
596
+ const state = this.#linkHints;
597
+ if (state === undefined) return;
598
+ const targets = viewportLinkTargets(rows);
599
+ const hints = state.hints;
600
+ if (hints === undefined) {
601
+ state.hints = linkHintTags(targets.length).map((tag, index) => ({ tag, link: targets[index]! }));
602
+ if (state.hints.length === 0) {
603
+ this.#endLinkHints();
604
+ return;
605
+ }
606
+ } else {
607
+ const unchanged =
608
+ targets.length >= hints.length &&
609
+ hints.every(({ link }, index) => link.url === targets[index]!.url && link.start === targets[index]!.start);
610
+ if (!unchanged) {
611
+ this.#endLinkHints();
612
+ return;
613
+ }
614
+ state.hints = hints.map(({ tag }, index) => ({ tag, link: targets[index]! }));
615
+ }
616
+ const cells = new Map<number, number>();
617
+ for (const { tag, link } of state.hints) cells.set(link.row, (cells.get(link.row) ?? 0) + tag.length);
618
+ if ([...cells.values()].some(count => count > width)) this.#endLinkHints("crowded");
619
+ }
620
+
621
+ #endLinkHints(reason?: "crowded"): void {
622
+ const state = this.#linkHints;
623
+ if (state === undefined) return;
624
+ this.#linkHints = undefined;
625
+ state.onEnd(reason);
626
+ }
627
+
628
+ /**
629
+ * Draw every tag the typed letters still lead to over the start of its label. Tags on one row
630
+ * never overlap: one that would land on an earlier tag moves right, and tags that would run past
631
+ * the right edge move left, so each stays readable as long as the row has room for them all.
632
+ */
633
+ #paintLinkHints(viewport: string[], width: number): string[] {
634
+ const state = this.#linkHints;
635
+ if (state?.hints === undefined) return viewport;
636
+ const rows = new Map<number, { tag: string; col: number }[]>();
637
+ for (const { tag, link } of state.hints) {
638
+ if (viewport[link.row] === undefined || !tag.startsWith(state.typed)) continue;
639
+ let row = rows.get(link.row);
640
+ if (!row) rows.set(link.row, (row = []));
641
+ row.push({ tag, col: link.start });
642
+ }
643
+ const painted = [...viewport];
644
+ for (const [index, tags] of rows) {
645
+ tags.sort((a, b) => a.col - b.col);
646
+ let free = 0;
647
+ for (const placed of tags) {
648
+ placed.col = Math.max(placed.col, free);
649
+ free = placed.col + placed.tag.length;
650
+ }
651
+ let limit = width;
652
+ for (let i = tags.length - 1; i >= 0; i--) {
653
+ const placed = tags[i]!;
654
+ placed.col = Math.max(0, Math.min(placed.col, limit - placed.tag.length));
655
+ limit = placed.col;
656
+ }
657
+ let line = painted[index]!;
658
+ for (const { tag, col } of tags) {
659
+ // Raw SGR like the hover highlight: chalk's inverse/bold drop out when it detects no color.
660
+ const styled = `\x1b[1;7m${theme.fg("accent", tag)}\x1b[22;27m`;
661
+ line = compositeLineAt(line, styled, col, tag.length, width);
662
+ }
663
+ painted[index] = line;
664
+ }
665
+ return painted;
520
666
  }
521
667
 
522
668
  /**
523
669
  * Describe the whole surface for a TSP terminal. `main` is the flowing
524
670
  * document: the header (welcome, extras) and every transcript block as its
525
- * own component child. `dock` is the live chrome below the transcript in
526
- * render order: pending messages, HUDs, the working row, the editor and the
527
- * status line. There is no history/viewport split: retirement, resize
528
- * replay and hover bands are ANSI concerns.
671
+ * own component child, then the children of the
672
+ * {@link RuntimeChildrenOptions.nativeTail} roots. `dock` is the live chrome
673
+ * below the transcript in render order: pending messages, HUDs, the working
674
+ * row, the editor and the status line. There is no history/viewport split:
675
+ * retirement, resize replay and hover bands are ANSI concerns.
529
676
  */
530
677
  describeSurface(): NativeSurface {
531
678
  if (!this.#started || this.#stopped) return this.#nativeSurface;
@@ -542,7 +689,9 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
542
689
  } else {
543
690
  const transcript = roots[transcriptIndex] as TranscriptContainer;
544
691
  main.push(...roots.slice(0, transcriptIndex), ...transcript.nativeBlocks());
545
- dock.push(...(this.#nativeDock ?? roots.slice(transcriptIndex + 1)));
692
+ for (const root of this.#nativeTail) main.push(...root.children);
693
+ const tail: readonly Component[] = this.#nativeTail;
694
+ dock.push(...(this.#nativeDock ?? roots.slice(transcriptIndex + 1).filter(root => !tail.includes(root))));
546
695
  }
547
696
  }
548
697
  const previous = this.#nativeSurface;
@@ -635,6 +784,17 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
635
784
  return routeViewportClick(this.#lastClickSpans, index);
636
785
  }
637
786
 
787
+ /**
788
+ * The extension-owned link label drawn at cell `col` of a mutable-viewport line, or `undefined`.
789
+ * Only links whose scheme an extension registered match; see `extensionLinkLabels`.
790
+ */
791
+ viewportLinkAt(index: number, col: number): ViewportLink | undefined {
792
+ const line = this.#lastViewportRows[index];
793
+ if (line === undefined || col < 0) return undefined;
794
+ const label = extensionLinkLabels(line).find(label => col >= label.start && col < label.end);
795
+ return label && { url: label.url, row: index, start: label.start };
796
+ }
797
+
638
798
  /**
639
799
  * Point the hover band at a click-candidate id (or clear it). Takes effect
640
800
  * on the next frame; callers repaint only when the target actually changes.
@@ -643,6 +803,55 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
643
803
  this.#hoveredClickId = id;
644
804
  }
645
805
 
806
+ /** How many extension link labels the last frame drew; a label wrapped across rows counts once. */
807
+ viewportLinkCount(): number {
808
+ return viewportLinkTargets(this.#lastViewportRows).length;
809
+ }
810
+
811
+ /**
812
+ * Enter keyboard link-hint mode: the next frame draws a tag over each extension link label it
813
+ * shows. `onEnd` runs once when the mode ends: a pick, a cancel, a key no tag starts with, a
814
+ * repaint that no longer draws the tagged labels where they were, or (`"crowded"`) a row with
815
+ * too many links for their tags to fit side by side.
816
+ */
817
+ startLinkHints(onEnd: LinkHintsEnd): void {
818
+ this.#endLinkHints();
819
+ this.#linkHints = { hints: undefined, typed: "", onEnd };
820
+ }
821
+
822
+ /** Whether link-hint mode is on. */
823
+ get linkHintsActive(): boolean {
824
+ return this.#linkHints !== undefined;
825
+ }
826
+
827
+ /**
828
+ * Type one letter of a tag. Returns the link whose whole tag is now typed, `true` while the
829
+ * letters still lead to several tags, and `false` when none starts with them. The mode ends on
830
+ * a pick or a miss.
831
+ */
832
+ typeLinkHint(letter: string): ViewportLink | boolean {
833
+ const state = this.#linkHints;
834
+ if (state === undefined) return false;
835
+ // A key typed before the tags were first painted picks among the labels last drawn.
836
+ if (state.hints === undefined) this.#syncLinkHints(this.#lastViewportRows, this.#lastViewportWidth);
837
+ const hints = this.#linkHints?.hints;
838
+ if (hints === undefined) return false;
839
+ const typed = state.typed + letter.toLowerCase();
840
+ const matching = hints.filter(hint => hint.tag.startsWith(typed));
841
+ const picked = matching.length === 1 && matching[0]!.tag === typed ? matching[0]!.link : undefined;
842
+ if (matching.length === 0 || picked !== undefined) {
843
+ this.#endLinkHints();
844
+ return picked ?? false;
845
+ }
846
+ state.typed = typed;
847
+ return true;
848
+ }
849
+
850
+ /** Leave link-hint mode without picking a link. */
851
+ cancelLinkHints(): void {
852
+ this.#endLinkHints();
853
+ }
854
+
646
855
  /** Acknowledges one accepted header, replay, or transcript batch. */
647
856
  acknowledgeHistory(id: number): void {
648
857
  const offered = this.#offeredHistory;
@@ -940,6 +1149,9 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
940
1149
  start(options: ComposerStartOptions = {}): void {
941
1150
  if (this.#started || this.#stopped) return;
942
1151
  this.#started = true;
1152
+ // A TSP terminal keeps (and draws) what is typed until startup releases
1153
+ // the held input, standing in for the kernel echo other terminals give.
1154
+ this.#editor.nativeTypeahead = options.deferInput === true;
943
1155
  this.ui.start({ clearScrollback: options.clearScrollback === true, deferInput: options.deferInput === true });
944
1156
  if (options.playWelcomeIntro !== false) this.playWelcomeIntro();
945
1157
  // Deferred input identifies the CLI prepaint handoff. Flush the queued
@@ -1023,9 +1235,23 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
1023
1235
  /** Update the canonical editor reference after InteractiveMode remounts a custom editor. */
1024
1236
  setEditor(editor: CustomEditor): void {
1025
1237
  this.ui.replaceHeldFocus(this.#editor, editor);
1238
+ editor.nativeTypeahead = this.#editor.nativeTypeahead;
1026
1239
  this.#editor = editor;
1027
1240
  }
1028
1241
 
1242
+ /**
1243
+ * End the startup input hold once the app's handlers are wired: the TSP
1244
+ * terminal sends the typing it kept, and the keys the TUI held replay
1245
+ * ({@link TUI.releaseHeldInput}). Idempotent.
1246
+ */
1247
+ releaseHeldInput(): void {
1248
+ if (this.#editor.nativeTypeahead) {
1249
+ this.#editor.nativeTypeahead = false;
1250
+ this.ui.requestRender();
1251
+ }
1252
+ this.ui.releaseHeldInput();
1253
+ }
1254
+
1029
1255
  /**
1030
1256
  * Mount the session-aware status component into the slot below the editor,
1031
1257
  * retiring the startup status line; the caller installs the real top-border
@@ -1051,6 +1277,7 @@ export class Composer implements TerminalFrameProvider, NativeSurfaceProvider {
1051
1277
  this.#chromeFloorPromoted = false;
1052
1278
  this.#resetIdleChrome();
1053
1279
  this.#nativeDock = options.nativeDock;
1280
+ this.#nativeTail = options.nativeTail ?? [];
1054
1281
  this.#transientChrome = new Set(options.transientChrome);
1055
1282
  this.#selfClearingChrome = new Set(options.selfClearingChrome);
1056
1283
  this.#transientFloor = undefined;
@@ -1063,7 +1063,12 @@ export class CustomEditor extends Editor {
1063
1063
  /** Editing is available during bootstrap; atomic sends wait until submission is wired and enabled
1064
1064
  * and no dictation is still writing into the draft. */
1065
1065
  protected override get nativeSendable(): boolean {
1066
- return this.onSubmit !== undefined && !this.disableSubmit && !dictationHoldsDraft(this.composerState().dictation);
1066
+ return (
1067
+ !this.nativeKeyPassthrough &&
1068
+ this.onSubmit !== undefined &&
1069
+ !this.disableSubmit &&
1070
+ !dictationHoldsDraft(this.composerState().dictation)
1071
+ );
1067
1072
  }
1068
1073
  /** The quoted-title placeholder, kept while the title stands so the editor node stays reused. */
1069
1074
  #titlePlaceholder: { title: string; text: TspText } | undefined;