@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
package/src/tools/irc.ts CHANGED
@@ -27,6 +27,12 @@ export interface IrcMessage {
27
27
  * the broadcaster, mostly to say the message was not for it.
28
28
  */
29
29
  broadcast?: boolean;
30
+ /**
31
+ * Interim acknowledgement or progress on something the recipient asked
32
+ * (`agent://<id>?progress`): it neither answers that request nor asks one,
33
+ * so the recipient's `wait` keeps waiting for the actual reply.
34
+ */
35
+ progress?: boolean;
30
36
  }
31
37
 
32
38
  /** Delivery outcome for one peer recipient. */
@@ -190,10 +190,22 @@ function headlineGlance(view: JobWidgetView): JobWidgetGlance | undefined {
190
190
  };
191
191
  }
192
192
 
193
+ /** The meter's `140/190` when the headline only restates its numerator (`140`). */
194
+ function meterWhole(headline: JobWidgetGlance, view: JobWidgetView): string | undefined {
195
+ const meter = view.blocks.find((block): block is JobWidgetMeterBlock => block.kind === "meter");
196
+ const whole = meter ? plainLine(meter.text) : "";
197
+ return /^\s*\/\s*\S/.test(whole.slice(headline.text.trim().length)) && whole.startsWith(headline.text.trim())
198
+ ? whole
199
+ : undefined;
200
+ }
201
+
193
202
  /** What one glance at the widget reads: the headline, else the latest figure of its first spark or meter. */
194
203
  export function jobWidgetGlance(view: JobWidgetView): JobWidgetGlance | undefined {
195
204
  const headline = headlineGlance(view);
196
- if (headline) return headline;
205
+ if (headline) {
206
+ const whole = meterWhole(headline, view);
207
+ return whole ? { ...headline, text: whole } : headline;
208
+ }
197
209
  for (const block of view.blocks) {
198
210
  if (block.kind === "spark" && block.values.length > 0 && plainLine(block.last)) {
199
211
  return { text: plainLine(block.last), label: plainLine(block.label) };
@@ -12,6 +12,8 @@ export declare const JSON_TREE_MAX_LINES_EXPANDED = 200;
12
12
  export declare const JSON_TREE_SCALAR_LEN_COLLAPSED = 60;
13
13
  /** Maximum expanded JSON scalar width. */
14
14
  export declare const JSON_TREE_SCALAR_LEN_EXPANDED = 2000;
15
+ /** Characters a container's one-line form may take before a JSON tree lists its entries instead. */
16
+ export declare const JSON_TREE_INLINE_LEN = 60;
15
17
  /** Sanitization, string summary, and budgeting policy for inline JSON. */
16
18
  export interface InlineFormatOptions {
17
19
  sanitizeText?: (text: string) => string;
@@ -46,7 +48,8 @@ export interface JsonTreeRenderOptions {
46
48
  rootConnectors?: "hooked" | "siblings";
47
49
  }
48
50
  /**
49
- * Render a JSON value as bounded tree lines. The positional form remains the
51
+ * Render a JSON value as bounded tree lines, containers that fit
52
+ * {@link JSON_TREE_INLINE_LEN} on one row. The positional form remains the
50
53
  * public tool-renderer contract; the options form exposes sanitization and root
51
54
  * connector policy for specialized adapters such as nested task output.
52
55
  */
@@ -74,8 +77,24 @@ export interface JsonTreeDescribeOptions {
74
77
  onTruncated?: () => void;
75
78
  }
76
79
  /**
77
- * TSP `tree` of a JSON value: containers become expandable nodes labelled with
78
- * their key and size, scalars become `key: value` leaves styled by type.
79
- * Bounded by depth, node count and scalar length; no width math.
80
+ * TSP `tree` of a JSON value: containers that fit {@link JSON_TREE_INLINE_LEN}
81
+ * become `key: [1, "a"]` leaves, larger ones expandable nodes labelled with
82
+ * their key and size, scalars `key: value` leaves styled by type. Bounded by
83
+ * depth, node count and scalar length; no width math.
80
84
  */
81
85
  export declare function describeJsonTree(value: unknown, options?: JsonTreeDescribeOptions): NativeNode;
86
+ /** Options of {@link describeJsonValue}: the `json` node's own, plus the fallback tree's. */
87
+ export interface JsonValueDescribeOptions extends JsonTreeDescribeOptions {
88
+ /** The host draws the `json` kind (`cx.supports("json")`). */
89
+ native?: boolean;
90
+ /** `json` node: container levels expanded below the top-level entries (default 0). */
91
+ open?: number;
92
+ }
93
+ /**
94
+ * A JSON value for a TSP host: the terminal's own `json` viewer when it draws
95
+ * the kind, which folds and previews containers itself and never cuts (so
96
+ * `onTruncated` never fires), else {@link describeJsonTree} with the same
97
+ * options. Root keys the tree would hide are left out of the sent value too;
98
+ * strings are sanitized like the tree's labels.
99
+ */
100
+ export declare function describeJsonValue(value: unknown, options?: JsonValueDescribeOptions): NativeNode;
@@ -2,7 +2,7 @@
2
2
  * JSON tree rendering utilities shared across tool renderers.
3
3
  */
4
4
  import { INTENT_FIELD, type TspSpan, type TspTreeNode } from "@linxiraos/pi-wire";
5
- import { sanitizeText } from "@linxiraos/pi-utils";
5
+ import { isRecord, sanitizeText, sanitizeTextDeep } from "@linxiraos/pi-utils";
6
6
  import { TreeView, treeRowPrefix } from "../components/tree-view";
7
7
  import { truncateToWidth } from "../render/render-utils";
8
8
  import type { Theme, ThemeColor } from "../theme/theme";
@@ -22,6 +22,8 @@ export const JSON_TREE_MAX_LINES_EXPANDED = 200;
22
22
  export const JSON_TREE_SCALAR_LEN_COLLAPSED = 60;
23
23
  /** Maximum expanded JSON scalar width. */
24
24
  export const JSON_TREE_SCALAR_LEN_EXPANDED = 2000;
25
+ /** Characters a container's one-line form may take before a JSON tree lists its entries instead. */
26
+ export const JSON_TREE_INLINE_LEN = 60;
25
27
 
26
28
  const HIDDEN_ARG_KEYS = { [INTENT_FIELD]: 1, __partialJson: 1 };
27
29
  const DEFAULT_HIDDEN_ROOT_KEYS: readonly string[] = Object.keys(HIDDEN_ARG_KEYS);
@@ -33,10 +35,6 @@ const ARGS_INLINE_MORE_WIDTH = Bun.stringWidth(ARGS_INLINE_MORE);
33
35
  /** Minimal value footprint (quotes + a couple chars) reserved for each not-yet-rendered key. */
34
36
  const ARGS_INLINE_TAIL_VALUE_RESERVE = 4;
35
37
 
36
- function isRecord(value: unknown): value is Record<string, unknown> {
37
- return !!value && typeof value === "object" && !Array.isArray(value);
38
- }
39
-
40
38
  /** Sanitization, string summary, and budgeting policy for inline JSON. */
41
39
  export interface InlineFormatOptions {
42
40
  sanitizeText?: (text: string) => string;
@@ -83,7 +81,7 @@ export function formatArgsInline(
83
81
  const pairs: string[] = [];
84
82
  let length = 0;
85
83
  for (const key in args) {
86
- if (!Object.hasOwn(args, key)) continue;
84
+ if (!Object.hasOwn(args, key) || key in HIDDEN_ARG_KEYS) continue;
87
85
  const pair = `${options.sanitizeText?.(key) ?? key}=${formatScalar(args[key], 24, options)}`;
88
86
  const added = pair.length + (pairs.length > 0 ? 2 : 0);
89
87
  if (length + added > maxWidth && pairs.length > 0) {
@@ -155,6 +153,57 @@ export function formatOutputInline(data: unknown, maxWidth = 80): string {
155
153
  return `Output: ${formatArgsInline(data as Record<string, unknown>, maxWidth - "Output: ".length, options) || "{}"}`;
156
154
  }
157
155
 
156
+ /** Object keys a one-line JSON form shows unquoted. */
157
+ const BARE_KEY = /^[\w$-]+$/;
158
+
159
+ /** One styled run of a one-line JSON form. */
160
+ type InlineRun = readonly [text: string, color: ThemeColor];
161
+
162
+ /**
163
+ * A container's one-line form (`[[3, "vt"], 98]`, `{lines: 70, done: true}`)
164
+ * as styled runs, so tree rows show small containers whole instead of one row
165
+ * per value; undefined for a scalar or a form past {@link JSON_TREE_INLINE_LEN}
166
+ * characters. Keys stay bare unless {@link BARE_KEY} rejects them, strings are
167
+ * JSON-escaped, and `clean` sanitizes both first.
168
+ */
169
+ function inlineJson(value: unknown, clean: (text: string) => string): InlineRun[] | undefined {
170
+ if (!Array.isArray(value) && !isRecord(value)) return undefined;
171
+ const runs: InlineRun[] = [];
172
+ let length = 0;
173
+ // Every container pushes a bracket before descending, so cycles hit the cap too.
174
+ const push = (text: string, color: ThemeColor): boolean => {
175
+ length += text.length;
176
+ if (length > JSON_TREE_INLINE_LEN) return false;
177
+ const last = runs.at(-1);
178
+ if (last?.[1] === color) runs[runs.length - 1] = [last[0] + text, color];
179
+ else runs.push([text, color]);
180
+ return true;
181
+ };
182
+ const walk = (entry: unknown): boolean => {
183
+ if (Array.isArray(entry)) {
184
+ if (!push("[", "muted")) return false;
185
+ for (let index = 0; index < entry.length; index++) {
186
+ if ((index > 0 && !push(", ", "muted")) || !walk(entry[index])) return false;
187
+ }
188
+ return push("]", "muted");
189
+ }
190
+ if (isRecord(entry)) {
191
+ if (!push("{", "muted")) return false;
192
+ let sep = "";
193
+ for (const key in entry) {
194
+ const name = clean(key);
195
+ if (!push(`${sep}${BARE_KEY.test(name) ? name : JSON.stringify(name)}: `, "muted")) return false;
196
+ if (!walk(entry[key])) return false;
197
+ sep = ", ";
198
+ }
199
+ return push("}", "muted");
200
+ }
201
+ if (typeof entry === "string") return push(JSON.stringify(clean(entry)), "syntaxString");
202
+ return push(clean(formatScalar(entry, JSON_TREE_INLINE_LEN)), jsonScalarToken(entry));
203
+ };
204
+ return walk(value) ? runs : undefined;
205
+ }
206
+
158
207
  /** JSON hierarchy policy accepted by {@link renderJsonTreeLines}. */
159
208
  export interface JsonTreeRenderOptions {
160
209
  maxDepth: number;
@@ -176,7 +225,7 @@ export interface JsonTreeRenderOptions {
176
225
  rootConnectors?: "hooked" | "siblings";
177
226
  }
178
227
 
179
- type JsonTreeNodeKind = "array" | "object" | "scalar" | "placeholder";
228
+ type JsonTreeNodeKind = "array" | "object" | "inline" | "scalar" | "placeholder";
180
229
 
181
230
  interface JsonTreeNode {
182
231
  id: number;
@@ -184,6 +233,10 @@ interface JsonTreeNode {
184
233
  value: unknown;
185
234
  depth: number;
186
235
  kind: JsonTreeNodeKind;
236
+ /** The key's color: `dim` for array indices, else `muted`. */
237
+ keyColor?: ThemeColor;
238
+ /** The one-line form of an `inline` container. */
239
+ inline?: readonly InlineRun[];
187
240
  placeholder?: "…";
188
241
  children?: readonly JsonTreeNode[];
189
242
  }
@@ -195,7 +248,8 @@ function jsonNodeKind(value: unknown): JsonTreeNodeKind {
195
248
  }
196
249
 
197
250
  /**
198
- * Render a JSON value as bounded tree lines. The positional form remains the
251
+ * Render a JSON value as bounded tree lines, containers that fit
252
+ * {@link JSON_TREE_INLINE_LEN} on one row. The positional form remains the
199
253
  * public tool-renderer contract; the options form exposes sanitization and root
200
254
  * connector policy for specialized adapters such as nested task output.
201
255
  */
@@ -236,26 +290,18 @@ export function renderJsonTreeLines(
236
290
  const hookedRoots = (options.rootConnectors ?? "hooked") === "hooked";
237
291
  let nextId = 0;
238
292
 
239
- const node = (nodeValue: unknown, key: string | undefined, depth: number): JsonTreeNode => ({
240
- id: nextId++,
241
- key,
242
- value: nodeValue,
243
- depth,
244
- kind: jsonNodeKind(nodeValue),
245
- });
293
+ const node = (nodeValue: unknown, key: string | undefined, depth: number, keyColor?: ThemeColor): JsonTreeNode => {
294
+ const inline = inlineJson(nodeValue, sanitize);
295
+ const kind = inline ? "inline" : jsonNodeKind(nodeValue);
296
+ return { id: nextId++, key, value: nodeValue, depth, kind, keyColor, inline };
297
+ };
298
+ const entryNodes = (entries: readonly JsonEntry[], depth: number): JsonTreeNode[] =>
299
+ entries.map(([key, child, keyColor]) => node(child, key, depth, keyColor));
246
300
 
247
- let roots: readonly JsonTreeNode[];
248
- if (isRecord(value)) {
249
- const objectRoots: JsonTreeNode[] = [];
250
- for (const key in value) {
251
- if (!hiddenRootKeys.includes(key)) objectRoots.push(node(value[key], key, 1));
252
- }
253
- roots = objectRoots;
254
- } else if (Array.isArray(value)) {
255
- roots = value.map((child, index) => node(child, `[${index}]`, 1));
256
- } else {
257
- roots = [node(value, undefined, 0)];
258
- }
301
+ const roots: readonly JsonTreeNode[] =
302
+ Array.isArray(value) || isRecord(value)
303
+ ? entryNodes(jsonEntries(value, hiddenRootKeys), 1)
304
+ : [node(value, undefined, 0)];
259
305
 
260
306
  const prefixStyle = { vertical: (symbol: string) => symbol };
261
307
  const hook = theme.tree.hook;
@@ -288,7 +334,7 @@ export function renderJsonTreeLines(
288
334
  },
289
335
  ];
290
336
  } else {
291
- children = values.map((child, index) => node(child, `[${index}]`, item.depth + 1));
337
+ children = entryNodes(jsonEntries(values), item.depth + 1);
292
338
  }
293
339
  } else if (item.kind === "object" && isRecord(item.value)) {
294
340
  const record = item.value;
@@ -307,9 +353,7 @@ export function renderJsonTreeLines(
307
353
  } else if (keys.length === 0) {
308
354
  children = [];
309
355
  } else {
310
- const objectChildren: JsonTreeNode[] = [];
311
- for (const key in record) objectChildren.push(node(record[key], key, item.depth + 1));
312
- children = objectChildren;
356
+ children = entryNodes(jsonEntries(record), item.depth + 1);
313
357
  }
314
358
  }
315
359
  item.children = children;
@@ -331,11 +375,13 @@ export function renderJsonTreeLines(
331
375
  let body: readonly string[];
332
376
  const displayKey = item.key ? sanitize(item.key) : undefined;
333
377
  const label = theme.fg(
334
- "muted",
378
+ item.keyColor ?? "muted",
335
379
  displayKey || (item.kind === "array" ? "array" : item.kind === "object" ? "object" : "value"),
336
380
  );
337
381
  if (item.kind === "placeholder") {
338
382
  body = [theme.fg("dim", item.placeholder ?? "…")];
383
+ } else if (item.kind === "inline") {
384
+ body = [`${label}: ${(item.inline ?? []).map(([text, color]) => theme.fg(color, text)).join("")}`];
339
385
  } else if (item.kind === "array") {
340
386
  body = [`${label} ${theme.fg("dim", `[${(item.value as unknown[]).length}]`)}`];
341
387
  } else if (item.kind === "object") {
@@ -406,34 +452,42 @@ export interface JsonTreeDescribeOptions {
406
452
  onTruncated?: () => void;
407
453
  }
408
454
 
409
- type JsonEntry = readonly [key: string, value: unknown];
455
+ type JsonEntry = readonly [key: string, value: unknown, keyColor: ThemeColor];
410
456
 
411
457
  function clipScalar(value: string, maxLen: number): string {
412
458
  return value.length > maxLen ? `${value.slice(0, maxLen)}…` : value;
413
459
  }
414
460
 
461
+ /**
462
+ * `value`'s entries: an array's indices dim and right-aligned like line
463
+ * numbers, an object's keys (less `hidden`) muted.
464
+ */
415
465
  function jsonEntries(value: unknown[] | Record<string, unknown>, hidden?: readonly string[]): JsonEntry[] {
416
466
  const out: JsonEntry[] = [];
417
467
  if (Array.isArray(value)) {
418
- for (let index = 0; index < value.length; index++) out.push([`[${index}]`, value[index]]);
468
+ const width = String(value.length - 1).length;
469
+ for (let index = 0; index < value.length; index++) {
470
+ out.push([String(index).padStart(width), value[index], "dim"]);
471
+ }
419
472
  return out;
420
473
  }
421
474
  for (const key in value) {
422
- if (!hidden?.includes(key)) out.push([key, value[key]]);
475
+ if (!hidden?.includes(key)) out.push([key, value[key], "muted"]);
423
476
  }
424
477
  return out;
425
478
  }
426
479
 
427
- function jsonScalarToken(value: unknown): string {
480
+ function jsonScalarToken(value: unknown): ThemeColor {
428
481
  if (typeof value === "number" || typeof value === "bigint") return "syntaxNumber";
429
482
  if (typeof value === "boolean" || value === null || value === undefined) return "syntaxKeyword";
430
483
  return "dim";
431
484
  }
432
485
 
433
486
  /**
434
- * TSP `tree` of a JSON value: containers become expandable nodes labelled with
435
- * their key and size, scalars become `key: value` leaves styled by type.
436
- * Bounded by depth, node count and scalar length; no width math.
487
+ * TSP `tree` of a JSON value: containers that fit {@link JSON_TREE_INLINE_LEN}
488
+ * become `key: [1, "a"]` leaves, larger ones expandable nodes labelled with
489
+ * their key and size, scalars `key: value` leaves styled by type. Bounded by
490
+ * depth, node count and scalar length; no width math.
437
491
  */
438
492
  export function describeJsonTree(value: unknown, options: JsonTreeDescribeOptions = {}): NativeNode {
439
493
  const maxDepth = Math.max(0, options.maxDepth ?? JSON_TREE_MAX_DEPTH_EXPANDED);
@@ -452,26 +506,29 @@ export function describeJsonTree(value: unknown, options: JsonTreeDescribeOption
452
506
  out.push(leaf([span(`… ${entries.length - index} more`, "dim")]));
453
507
  break;
454
508
  }
455
- const [key, child] = entries[index];
456
- out.push(describeValue(key, child, depth));
509
+ out.push(describeValue(entries[index], depth));
457
510
  }
458
511
  return out;
459
512
  };
460
513
 
461
- const describeValue = (key: string | undefined, entry: unknown, depth: number): TspTreeNode => {
514
+ const describeValue = (
515
+ [key, entry, keyColor]: readonly [key: string | undefined, value: unknown, keyColor?: ThemeColor],
516
+ depth: number,
517
+ ): TspTreeNode => {
462
518
  budget--;
463
519
  const id = `${nextId++}`;
464
- const keySpans: TspSpan[] = key === undefined ? [] : [span(plainText(key), "muted")];
520
+ const keySpans: TspSpan[] = key === undefined ? [] : [span(plainText(key), keyColor)];
521
+ const prefix = keySpans.length > 0 ? [...keySpans, span(": ", "muted")] : [];
522
+ const inline = inlineJson(entry, plainText);
523
+ if (inline) return { id, label: [...prefix, ...inline.map(([text, color]) => span(text, color))] };
465
524
  if (Array.isArray(entry) || isRecord(entry)) {
466
525
  const entries = jsonEntries(entry);
467
526
  const size = Array.isArray(entry) ? `[${entry.length}]` : `{${entries.length}}`;
468
527
  const label = keySpans.length > 0 ? [...keySpans, span(` ${size}`, "dim")] : [span(size, "dim")];
469
- if (entries.length === 0) return { id, label };
470
528
  if (depth >= maxDepth) truncated = true;
471
529
  const children = depth >= maxDepth ? [leaf([span("…", "dim")])] : describeEntries(entries, depth + 1);
472
530
  return { id, label, open: depth < openDepth, children };
473
531
  }
474
- const prefix = keySpans.length > 0 ? [...keySpans, span(": ", "muted")] : [];
475
532
  if (typeof entry === "string") {
476
533
  const lines = plainText(entry).split("\n");
477
534
  if (lines.some(line => line.length > maxScalarLen)) truncated = true;
@@ -504,8 +561,37 @@ export function describeJsonTree(value: unknown, options: JsonTreeDescribeOption
504
561
  nodes =
505
562
  entries.length > 0 ? describeEntries(entries, 1) : [leaf([span(Array.isArray(value) ? "[]" : "{}", "dim")])];
506
563
  } else {
507
- nodes = [describeValue(undefined, value, 0)];
564
+ nodes = [describeValue([undefined, value], 0)];
508
565
  }
509
566
  if (truncated) options.onTruncated?.();
510
567
  return node("tree", { nodes });
511
568
  }
569
+
570
+ /** Options of {@link describeJsonValue}: the `json` node's own, plus the fallback tree's. */
571
+ export interface JsonValueDescribeOptions extends JsonTreeDescribeOptions {
572
+ /** The host draws the `json` kind (`cx.supports("json")`). */
573
+ native?: boolean;
574
+ /** `json` node: container levels expanded below the top-level entries (default 0). */
575
+ open?: number;
576
+ }
577
+
578
+ /**
579
+ * A JSON value for a TSP host: the terminal's own `json` viewer when it draws
580
+ * the kind, which folds and previews containers itself and never cuts (so
581
+ * `onTruncated` never fires), else {@link describeJsonTree} with the same
582
+ * options. Root keys the tree would hide are left out of the sent value too;
583
+ * strings are sanitized like the tree's labels.
584
+ */
585
+ export function describeJsonValue(value: unknown, options: JsonValueDescribeOptions = {}): NativeNode {
586
+ if (!options.native) return describeJsonTree(value, options);
587
+ let shown = value;
588
+ if (isRecord(value)) {
589
+ const hidden = options.hiddenRootKeys ?? DEFAULT_HIDDEN_ROOT_KEYS;
590
+ if (hidden.some(key => Object.hasOwn(value, key))) {
591
+ const kept: Record<string, unknown> = {};
592
+ for (const key in value) if (!hidden.includes(key)) kept[key] = value[key];
593
+ shown = kept;
594
+ }
595
+ }
596
+ return node("json", { value: sanitizeTextDeep(shown), open: options.open || undefined });
597
+ }
@@ -31,6 +31,8 @@ export interface FileDiagnosticsResult {
31
31
  summary: string;
32
32
  /** Whether there are any errors (severity 1) */
33
33
  errored: boolean;
34
+ /** Servers that sent no fresh report in time: the file is unverified for them, not clean. */
35
+ unreported?: string[];
34
36
  /** Whether the file was formatted */
35
37
  formatter?: FileFormatResult;
36
38
  }