@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
@@ -71,6 +71,7 @@ import {
71
71
  export type { EditorBorderStyle, EditorTopBorder };
72
72
 
73
73
  import { type SelectItem, SelectList, type SelectListLayoutOptions, type SelectListTheme } from "./select-list";
74
+ import { editorKey } from "../chrome/keybinding-hints";
74
75
 
75
76
  /** The TSP root an {@link Editor.describeLayout} hook builds around the `editor` node. */
76
77
  export interface NativeEditorLayout {
@@ -776,6 +777,14 @@ export class Editor implements Component, Focusable {
776
777
  describeDecorations: ((lines: readonly string[]) => readonly TspEditorDecoration[]) | undefined;
777
778
  /** TSP code language of the buffer (`python`, `bash`): the terminal highlights it in the mono face. */
778
779
  describeLanguage: (() => string | undefined) | undefined;
780
+ /** Label the TSP field to disable host-side editing while another input owner handles raw keys. */
781
+ nativeKeyPassthrough = false;
782
+ /**
783
+ * Ask the TSP terminal to keep what is typed into this field and draw it at
784
+ * the caret until this clears, then send it: set while startup cannot read
785
+ * input yet (the prompt composer's deferred-input start).
786
+ */
787
+ nativeTypeahead = false;
779
788
  /**
780
789
  * TSP chrome around the `editor` node (the prompt composer's chips, mode
781
790
  * chip, send/stop): the root role, the children with `input` placed where
@@ -858,9 +867,19 @@ export class Editor implements Component, Focusable {
858
867
  #autocompleteList?: SelectList;
859
868
  #autocompleteState: "regular" | "force" | "assist" | null = null;
860
869
  #textAssistReplacement:
861
- | { line: number; startCol: number; endCol: number; original: string; cursorOffset: number }
870
+ | {
871
+ line: number;
872
+ startCol: number;
873
+ endCol: number;
874
+ original: string;
875
+ cursorOffset: number;
876
+ /** The list offers {@link predictions} for the whole line rather than spelling replacements. */
877
+ prediction?: boolean;
878
+ }
862
879
  | undefined;
863
880
  #autocompletePrefix: string = "";
881
+ /** The line a prediction insert (Tab, Right, or the alternatives list) left in the buffer; any later edit clears it. */
882
+ #insertedPrediction: string | undefined;
864
883
  /** False while the popup's untouched top row is a description-only slash hit ({@link AutocompleteItem.descriptionMatch}): Enter then submits the typed text. */
865
884
  #enterAcceptsSelection = true;
866
885
  #autocompleteRequestId: number = 0;
@@ -937,12 +956,21 @@ export class Editor implements Component, Focusable {
937
956
  * cursor. The host styles it (ANSI allowed). Re-evaluated on every render, so hosts can derive
938
957
  * it from live state. */
939
958
  placeholder?: () => string | undefined;
940
- /** Whole-message prediction for the next prompt, painted as ghost text after the cursor while
941
- * the single-line buffer is a strict prefix of it, the cursor sits at its end, and no
942
- * autocomplete is open. A shown prediction replaces the {@link placeholder}; Tab or Right inserts
943
- * the rest without submitting. Must be a single line. Re-evaluated on every render, so hosts can
944
- * derive it from live state. */
945
- prediction?: () => string | undefined;
959
+ /** Whole-message predictions for the next prompt, most likely first. The first one the single-line
960
+ * buffer is a strict prefix of is painted as ghost text after the cursor while the cursor sits at
961
+ * its end and no autocomplete is open. A shown prediction replaces the {@link placeholder}; Tab or
962
+ * Right inserts the rest without submitting. A buffer the user typed keeps the ghost even when it
963
+ * equals a shorter prediction; once Tab, Right, or the list has inserted one of two or more
964
+ * predictions, no ghost extends it to a longer one, and Tab instead opens a list of all of them
965
+ * that swaps the whole line, also without submitting. Each must be a single line. Re-evaluated on
966
+ * every render, so hosts can derive them from live state. */
967
+ predictions?: () => readonly string[] | undefined;
968
+ /** Called with the prediction's index in {@link predictions} after Tab or Right inserts the rest of
969
+ * a shown prediction, or the alternatives list swaps a different one into the buffer. */
970
+ onPredictionAccepted?: (index: number) => void;
971
+ /** Called for each frame that paints a prediction as ghost text: a terminal frame that draws at
972
+ * least one cell of it, or a native frame that carries it as the editor's ghost. */
973
+ onPredictionShown?: () => void;
946
974
 
947
975
  // Custom top border (for status line integration). Either an eager `content`
948
976
  // (set once, reused every frame) or a `provider` that recomputes lazily just
@@ -1591,6 +1619,10 @@ export class Editor implements Component, Focusable {
1591
1619
  // against the cursor, or the placeholder flush right.
1592
1620
  const placeholder = this.#getPlaceholder();
1593
1621
  const inlineHint = placeholder ? null : this.#getInlineHint();
1622
+ // Whether the hint is the prediction, and how many of its cells this frame draws: a full row,
1623
+ // an unfocused hardware-cursor row, or the IME-safe layout can leave it unpainted.
1624
+ const hintIsPrediction = inlineHint !== null && inlineHint === this.#getPredictionSuffix();
1625
+ let hintCellsPainted = 0;
1594
1626
  const hintStyle = this.#theme.hintStyle ?? ((t: string) => `\x1b[2m${t}\x1b[0m`);
1595
1627
  const hintTail = (avail: number): { text: string; width: number } | undefined => {
1596
1628
  if (placeholder) {
@@ -1705,6 +1737,7 @@ export class Editor implements Component, Focusable {
1705
1737
  } else if (tail) {
1706
1738
  displayText = before + marker + tail.text;
1707
1739
  displayWidth += tail.width;
1740
+ hintCellsPainted += tail.width;
1708
1741
  } else if (after.length === 0 && !isSideBordered && displayWidth >= lineContentWidth) {
1709
1742
  displayText = this.#renderTerminalCursorMarker(before, marker, lineContentWidth);
1710
1743
  } else {
@@ -1751,6 +1784,7 @@ export class Editor implements Component, Focusable {
1751
1784
  const tail = hintTail(Math.max(0, lineContentWidth - displayWidth - overrideWidth));
1752
1785
  displayText = before + marker + this.cursorOverride + (tail?.text ?? "");
1753
1786
  displayWidth += overrideWidth + (tail?.width ?? 0);
1787
+ hintCellsPainted += tail?.width ?? 0;
1754
1788
  }
1755
1789
  } else {
1756
1790
  // Cursor is at the end - add thin cursor glyph
@@ -1765,6 +1799,7 @@ export class Editor implements Component, Focusable {
1765
1799
  const tail = hintTail(Math.max(0, lineContentWidth - displayWidth - cursorWidth));
1766
1800
  displayText = before + marker + cursor + (tail?.text ?? "");
1767
1801
  displayWidth += cursorWidth + (tail?.width ?? 0);
1802
+ hintCellsPainted += tail?.width ?? 0;
1768
1803
  }
1769
1804
  if (displayWidth > lineContentWidth && paddingX > 0) {
1770
1805
  cursorPaddingOverflow = displayWidth - lineContentWidth;
@@ -1807,6 +1842,7 @@ export class Editor implements Component, Focusable {
1807
1842
  }),
1808
1843
  );
1809
1844
  }
1845
+ if (hintIsPrediction && hintCellsPainted > 0) this.onPredictionShown?.();
1810
1846
 
1811
1847
  const bottomRow = style.renderBottom(chromeCtx);
1812
1848
  if (bottomRow !== undefined) result.push(bottomRow);
@@ -1871,6 +1907,7 @@ export class Editor implements Component, Focusable {
1871
1907
  : placeholder && plainText(placeholder).trim();
1872
1908
  const atLineEnd = cursorCol >= (lines[cursorLine]?.length ?? 0);
1873
1909
  const ghost = nativePlaceholder || !atLineEnd ? null : this.#getInlineHint();
1910
+ if (ghost && ghost === this.#getPredictionSuffix()) this.onPredictionShown?.();
1874
1911
  const vim = this.#vim;
1875
1912
  let anchor: number | null = null;
1876
1913
  if (vim?.visual && vim.anchor !== null) {
@@ -1894,9 +1931,10 @@ export class Editor implements Component, Focusable {
1894
1931
  decor: decor.decor,
1895
1932
  ghost: ghost ? plainText(ghost) : undefined,
1896
1933
  placeholder: nativePlaceholder || undefined,
1897
- mode: vim ? VIM_MODE_LABELS[vim.mode] : undefined,
1934
+ mode: this.nativeKeyPassthrough ? "PTY" : vim ? VIM_MODE_LABELS[vim.mode] : undefined,
1898
1935
  lang: this.describeLanguage?.(),
1899
1936
  maxLines: this.#maxHeight,
1937
+ typeahead: this.nativeTypeahead || undefined,
1900
1938
  };
1901
1939
  let editor = this.#nativeEditor;
1902
1940
  if (!editor || !sameProps(editor.props, props)) {
@@ -2126,7 +2164,7 @@ export class Editor implements Component, Focusable {
2126
2164
  kb.matchesCanonical(canonical, "tui.input.tab") ||
2127
2165
  rightArrowAccepts)
2128
2166
  ) {
2129
- this.#applySpellingSuggestion();
2167
+ this.#applyAssistReplacement();
2130
2168
  return;
2131
2169
  }
2132
2170
  // Let the autocomplete list handle navigation and selection
@@ -3256,6 +3294,7 @@ export class Editor implements Component, Focusable {
3256
3294
 
3257
3295
  #notifyChange(text?: string): void {
3258
3296
  this.#textRevision++;
3297
+ this.#insertedPrediction = undefined;
3259
3298
  this.onChange?.(text ?? this.getText());
3260
3299
  }
3261
3300
 
@@ -5073,7 +5112,7 @@ export class Editor implements Component, Focusable {
5073
5112
  // A pointer pick on the popup (TSP `select`/`activate`) accepts it like Tab.
5074
5113
  list.onSelect = item => {
5075
5114
  if (this.#autocompleteList !== list) return;
5076
- if (this.#autocompleteState === "assist") this.#applySpellingSuggestion();
5115
+ if (this.#autocompleteState === "assist") this.#applyAssistReplacement();
5077
5116
  else this.#acceptAutocompleteSelection(item);
5078
5117
  };
5079
5118
  return list;
@@ -5081,6 +5120,7 @@ export class Editor implements Component, Focusable {
5081
5120
 
5082
5121
  async #handleTabCompletion(): Promise<void> {
5083
5122
  if (this.#acceptPrediction()) return;
5123
+ if (this.#showPredictionAlternatives()) return;
5084
5124
  if (this.#acceptWordCompletion({ space: true })) return;
5085
5125
  if (!this.#autocompleteProvider) return;
5086
5126
 
@@ -5118,11 +5158,37 @@ export class Editor implements Component, Focusable {
5118
5158
  if (space) this.#lastAction = "accept-word";
5119
5159
  return true;
5120
5160
  }
5121
- /** Insert the rest of the shown {@link prediction}, if any. Never submits. */
5161
+ /** Insert the rest of the shown prediction, if any. Never submits. */
5122
5162
  #acceptPrediction(): boolean {
5123
- const suffix = this.#getPredictionSuffix();
5124
- if (!suffix) return false;
5125
- this.#insertTextAtCursor(suffix);
5163
+ const shown = this.#getShownPrediction();
5164
+ if (!shown) return false;
5165
+ this.#insertTextAtCursor(shown.suffix);
5166
+ this.#insertedPrediction = this.#state.lines[0];
5167
+ this.onPredictionAccepted?.(shown.index);
5168
+ return true;
5169
+ }
5170
+
5171
+ /** Open the list of every prediction over a buffer that equals one of them, that one selected. */
5172
+ #showPredictionAlternatives(): boolean {
5173
+ const alternatives = this.#getPredictionAlternatives();
5174
+ if (!alternatives) return false;
5175
+ const original = this.#state.lines[0] ?? "";
5176
+ this.#autocompletePrefix = original;
5177
+ this.#autocompleteList = this.#createAutocompleteList(
5178
+ "",
5179
+ alternatives.choices.map(value => ({ value, label: value })),
5180
+ );
5181
+ this.#autocompleteList.setSelectedIndex(alternatives.index);
5182
+ this.#autocompleteState = "assist";
5183
+ this.#textAssistReplacement = {
5184
+ line: 0,
5185
+ startCol: 0,
5186
+ endCol: original.length,
5187
+ original,
5188
+ cursorOffset: 0,
5189
+ prediction: true,
5190
+ };
5191
+ this.onAutocompleteUpdate?.();
5126
5192
  return true;
5127
5193
  }
5128
5194
 
@@ -5165,7 +5231,7 @@ export class Editor implements Component, Focusable {
5165
5231
  this.onAutocompleteUpdate?.();
5166
5232
  }
5167
5233
 
5168
- #applySpellingSuggestion(): void {
5234
+ #applyAssistReplacement(): void {
5169
5235
  const replacement = this.#textAssistReplacement;
5170
5236
  const selected = this.#autocompleteList?.getSelectedItem();
5171
5237
  if (!replacement || !selected) {
@@ -5173,8 +5239,13 @@ export class Editor implements Component, Focusable {
5173
5239
  return;
5174
5240
  }
5175
5241
  const line = this.#state.lines[replacement.line] ?? "";
5176
- if (line.slice(replacement.startCol, replacement.endCol) !== replacement.original) {
5242
+ // A mismatch means the list went stale; picking the prediction already in the buffer changes nothing.
5243
+ if (
5244
+ line.slice(replacement.startCol, replacement.endCol) !== replacement.original ||
5245
+ (replacement.prediction && selected.value === replacement.original)
5246
+ ) {
5177
5247
  this.#cancelAutocomplete();
5248
+ this.onAutocompleteUpdate?.();
5178
5249
  return;
5179
5250
  }
5180
5251
  this.#recordUndoState();
@@ -5186,6 +5257,11 @@ export class Editor implements Component, Focusable {
5186
5257
  this.#cancelAutocomplete();
5187
5258
  this.onAutocompleteUpdate?.();
5188
5259
  this.#notifyChange();
5260
+ if (replacement.prediction) {
5261
+ this.#insertedPrediction = selected.value;
5262
+ const index = this.predictions?.()?.indexOf(selected.value) ?? -1;
5263
+ if (index >= 0) this.onPredictionAccepted?.(index);
5264
+ }
5189
5265
  }
5190
5266
  async #handleSlashCommandCompletion(): Promise<void> {
5191
5267
  await this.#tryTriggerAutocomplete();
@@ -5391,7 +5467,8 @@ export class Editor implements Component, Focusable {
5391
5467
 
5392
5468
  /**
5393
5469
  * Get inline hint text to show as dim ghost text after the cursor.
5394
- * Checks the selected autocomplete item's hint first, then the prediction, then the provider.
5470
+ * Checks the selected autocomplete item's hint first, then the prediction and its alternatives,
5471
+ * then the provider.
5395
5472
  */
5396
5473
  #getInlineHint(): string | null {
5397
5474
  // Check selected autocomplete item for a hint
@@ -5402,7 +5479,12 @@ export class Editor implements Component, Focusable {
5402
5479
 
5403
5480
  const prediction = this.#getPredictionSuffix();
5404
5481
  if (prediction) return prediction;
5405
-
5482
+ const alternatives = this.#getPredictionAlternatives();
5483
+ if (alternatives) {
5484
+ // Tab opens the alternatives list from here; without a bound key there is nothing to hint.
5485
+ const tab = editorKey("tui.input.tab");
5486
+ if (tab) return ` ${tab} ${alternatives.choices.length - 1} more`;
5487
+ }
5406
5488
  // Fall back to provider's getInlineHint
5407
5489
  if (this.#autocompleteProvider?.getInlineHint) {
5408
5490
  const hint = this.#autocompleteProvider.getInlineHint(
@@ -5419,18 +5501,44 @@ export class Editor implements Component, Focusable {
5419
5501
  if (this.#autocompleteState || !this.#isEditorEmpty() || this.#getPredictionSuffix()) return undefined;
5420
5502
  return this.placeholder?.() || undefined;
5421
5503
  }
5422
- /** The part of {@link prediction} not yet typed, or `null` when no prediction is shown. */
5504
+ /** The part of the shown prediction not yet typed, or `null` when no prediction is shown. */
5423
5505
  #getPredictionSuffix(): string | null {
5506
+ return this.#getShownPrediction()?.suffix ?? null;
5507
+ }
5508
+ /**
5509
+ * The prediction painted as ghost text: the first one the single-line buffer is a strict prefix of,
5510
+ * with the cursor at its end and no autocomplete open. None while the buffer is a prediction insert
5511
+ * that equals one of two or more predictions, so Tab opens their list rather than extending to a
5512
+ * longer one; a buffer the user typed keeps its ghost.
5513
+ */
5514
+ #getShownPrediction(): { index: number; suffix: string } | null {
5424
5515
  if (this.#autocompleteState) return null;
5425
- const prediction = this.prediction?.();
5426
- if (!prediction) return null;
5516
+ const predictions = this.predictions?.();
5517
+ if (!predictions?.length) return null;
5427
5518
  const { lines, cursorCol } = this.#state;
5428
5519
  if (lines.length !== 1) return null;
5429
5520
  const typed = lines[0] ?? "";
5430
- if (cursorCol !== typed.length || typed.length >= prediction.length || !prediction.startsWith(typed)) {
5431
- return null;
5432
- }
5433
- return prediction.slice(typed.length);
5521
+ if (cursorCol !== typed.length) return null;
5522
+ if (predictions.length > 1 && typed === this.#insertedPrediction && predictions.includes(typed)) return null;
5523
+ const index = predictions.findIndex(
5524
+ prediction => typed.length < prediction.length && prediction.startsWith(typed),
5525
+ );
5526
+ return index < 0 ? null : { index, suffix: predictions[index]!.slice(typed.length) };
5527
+ }
5528
+ /**
5529
+ * Two or more predictions, and which one the single-line buffer equals with the cursor at its end:
5530
+ * Tab then opens the list of all of them.
5531
+ */
5532
+ #getPredictionAlternatives(): { choices: readonly string[]; index: number } | null {
5533
+ if (this.#autocompleteState) return null;
5534
+ const choices = this.predictions?.();
5535
+ if (!choices || choices.length < 2) return null;
5536
+ const { lines, cursorCol } = this.#state;
5537
+ if (lines.length !== 1) return null;
5538
+ const typed = lines[0] ?? "";
5539
+ if (cursorCol !== typed.length) return null;
5540
+ const index = choices.indexOf(typed);
5541
+ return index < 0 ? null : { choices, index };
5434
5542
  }
5435
5543
  /** Typing `typed` where it diverges from the shown ghost completion rejects that ghost. */
5436
5544
  #reportTypedPastWordCompletion(typed: string): void {
@@ -207,6 +207,12 @@ export declare class Image implements Component {
207
207
  /** Return source metadata without exposing the encoded image buffer. */
208
208
  debugState(): Record<string, unknown>;
209
209
  invalidate(): void;
210
+ /**
211
+ * Refit to a new row ceiling; a SIXEL reserves its rows until the off-thread
212
+ * encode lands. A demoted fallback keeps the height already drawn only
213
+ * within the new ceiling: the owner chose to shrink the block.
214
+ */
215
+ setMaxHeightCells(maxHeightCells: number): void;
210
216
  releaseRenderCaches(): void;
211
217
  /**
212
218
  * A native `image` backed by a content-addressed blob; the terminal fits
@@ -773,6 +773,19 @@ export class Image implements Component {
773
773
  this.#cachedWidth = undefined;
774
774
  }
775
775
 
776
+ /**
777
+ * Refit to a new row ceiling; a SIXEL reserves its rows until the off-thread
778
+ * encode lands. A demoted fallback keeps the height already drawn only
779
+ * within the new ceiling: the owner chose to shrink the block.
780
+ */
781
+ setMaxHeightCells(maxHeightCells: number): void {
782
+ if (this.#options.maxHeightCells === maxHeightCells) return;
783
+ this.#options.maxHeightCells = maxHeightCells;
784
+ this.#renderedGraphicRows = Math.min(this.#renderedGraphicRows, maxHeightCells);
785
+ this.#native = undefined;
786
+ this.invalidate();
787
+ }
788
+
776
789
  releaseRenderCaches(): void {
777
790
  this.#cachedLines = undefined;
778
791
  this.#cachedWidth = undefined;
@@ -2,7 +2,15 @@ import { compactText, styleSpans } from "../native/spans";
2
2
  import { node } from "../native/describe";
3
3
  import type { DescribeContext, NativeNode } from "../native/node";
4
4
  import type { Component } from "../tui";
5
- import { Ellipsis, getWidthConfigEpoch, replaceTabs, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "../utils";
5
+ import {
6
+ Ellipsis,
7
+ finiteWidth,
8
+ getWidthConfigEpoch,
9
+ singleLine,
10
+ truncateToWidth,
11
+ visibleWidth,
12
+ wrapTextWithAnsi,
13
+ } from "../utils";
6
14
 
7
15
  /** One label/value entry in a {@link KeyValueList}. */
8
16
  export interface KeyValueRow {
@@ -21,14 +29,6 @@ export interface KeyValueListOptions {
21
29
  readonly labelOverflow?: "allow" | "truncate";
22
30
  }
23
31
 
24
- function finiteWidth(width: number): number {
25
- return Number.isFinite(width) ? Math.max(0, Math.trunc(width)) : 0;
26
- }
27
-
28
- function singleLine(text: string): string {
29
- return replaceTabs(text).replace(/[\r\n]+/g, " ");
30
- }
31
-
32
32
  /** A bounded ANSI-aware label/value list with replaceable rows and aligned wrapped continuations. */
33
33
  export class KeyValueList implements Component {
34
34
  #rows: readonly KeyValueRow[];
@@ -71,6 +71,8 @@ export declare class Loader extends Text {
71
71
  stop(): void;
72
72
  /** Lifecycle teardown: stop the animation timer. Idempotent. */
73
73
  dispose(): void;
74
+ /** The current spinner frame and message as one styled line, for hosts that set it into their own chrome. */
75
+ inlineText(): string;
74
76
  /** Install a lazy right-docked suffix for the spinner row (e.g. a styled
75
77
  * session title). Re-evaluated every paint; dropped when the row leaves
76
78
  * less than a two-cell gap. */
@@ -325,6 +325,13 @@ export class Loader extends Text {
325
325
  dispose() {
326
326
  this.stop();
327
327
  }
328
+
329
+ /** The current spinner frame and message as one styled line, for hosts that set it into their own chrome. */
330
+ inlineText(): string {
331
+ const spinner = this.spinnerColorFn(this.#frames[this.#currentFrame]);
332
+ return `${spinner} ${this.messageColorFn(this.#resolveMessage())}`;
333
+ }
334
+
328
335
  /** Install a lazy right-docked suffix for the spinner row (e.g. a styled
329
336
  * session title). Re-evaluated every paint; dropped when the row leaves
330
337
  * less than a two-cell gap. */
@@ -10,6 +10,13 @@ import type { Component } from "../tui";
10
10
  * byte-identical to rendering `text`.
11
11
  */
12
12
  export declare function streamingMarkdownSource(text: string): string;
13
+ /**
14
+ * Whether `text` ends inside a code fence the source never closed. The
15
+ * renderer still draws such a fence's closing border, so a caller publishing a
16
+ * settled source prefix must drop that fabricated row: it is not a prefix of
17
+ * the live block, which reaches the border only once the closer arrives.
18
+ */
19
+ export declare function endsInsideOpenFence(text: string): boolean;
13
20
  /**
14
21
  * Streaming `md` source for a native terminal, minus a still-growing table row:
15
22
  * the unterminated last line when a GFM table (a run of pipe lines holding a