@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/lsp.ts CHANGED
@@ -12,12 +12,15 @@ import type { NativeToolHead, NativeToolView, RenderResultOptions, ToolRenderer,
12
12
  import type { Component } from "../tui";
13
13
  import { Text } from "../components/text";
14
14
  import { getLanguageFromPath } from "../lang-from-path";
15
- import { highlightCode as highlightThemeCode, type Theme } from "../theme/theme";
15
+ import { highlightCode as highlightThemeCode, isHighlightLanguage, type Theme } from "../theme/theme";
16
16
  import {
17
+ formatCodeFrameLine,
17
18
  formatCount,
18
19
  formatExpandHint,
19
20
  formatMoreItems,
20
21
  formatStatusIcon,
22
+ formatStyledPath,
23
+ PREVIEW_LIMITS,
21
24
  type ParsedDiagnostic,
22
25
  parseDiagnosticMessage,
23
26
  replaceTabs,
@@ -34,8 +37,8 @@ import { ansi, code, col, compact, keyed, md, node, row, span, text } from "../n
34
37
  import type { NativeNode } from "../native/node";
35
38
  import { OwnerMemo } from "../native/memo";
36
39
  import { plainText } from "../native/spans";
37
- import { walkGroupedOutput } from "./grouped-file-output";
38
- import { diagnosticGlyph, fileHref, fileRow, inlineErrorView } from "./native-view";
40
+ import { numberedCode, walkGroupedOutput } from "./grouped-file-output";
41
+ import { diagnosticGlyph, displayPath, fileHref, fileRow, inlineErrorView } from "./native-view";
39
42
  import { activeThemeSymbol } from "../theme/active-symbols";
40
43
 
41
44
  /** Display arguments for an LSP tool request. */
@@ -83,6 +86,8 @@ export interface FileDiagnosticsResult {
83
86
  summary: string;
84
87
  /** Whether there are any errors (severity 1) */
85
88
  errored: boolean;
89
+ /** Servers that sent no fresh report in time: the file is unverified for them, not clean. */
90
+ unreported?: string[];
86
91
  /** Whether the file was formatted */
87
92
  formatter?: FileFormatResult;
88
93
  }
@@ -163,6 +168,29 @@ export function renderCall(args: LspParams, _options: RenderResultOptions, theme
163
168
  // Result Rendering
164
169
  // =============================================================================
165
170
 
171
+ /** A diagnostics status line for a file no server reported on in time: unverified, never "No issues". */
172
+ const UNREPORTED_LINE_RE = /\bno diagnostics report yet\b/;
173
+
174
+ /**
175
+ * Whether a line is one of the LSP tool's per-file status rows (`<glyph> <path>: …`).
176
+ * Only a row's start counts: response text such as source or hover content can hold
177
+ * the same characters (ASCII `[-]`).
178
+ */
179
+ function isStatusRow(line: string, glyph: string): boolean {
180
+ return line.startsWith(`${glyph} `);
181
+ }
182
+
183
+ /**
184
+ * Whether a result holds a status row drawn with `glyph`. Only the diagnostics action
185
+ * writes status rows; any other action's text is the server's (a `request` response
186
+ * verbatim), so a glyph there is content even at a line start. A result whose action
187
+ * is unknown keeps the inference.
188
+ */
189
+ function hasStatusRow(action: string | undefined, lines: readonly string[], glyph: string): boolean {
190
+ if (action !== undefined && action !== "diagnostics") return false;
191
+ return lines.some(line => isStatusRow(line, glyph));
192
+ }
193
+
166
194
  /**
167
195
  * Render LSP tool result with intelligent formatting based on result type.
168
196
  * Detects hover, diagnostics, references, symbols, etc. and formats accordingly.
@@ -183,19 +211,23 @@ export function renderResult(
183
211
  const text = content.text;
184
212
  const lines = text.split("\n");
185
213
 
186
- // Static type detection (result content doesn't change between renders)
187
- const codeBlockMatch = text.match(/```(\w*)\n([\s\S]*?)```/);
214
+ // Static type detection (result content doesn't change between renders). Locations are
215
+ // anchored at the response's first line, so they win over checks a source snippet could trip.
216
+ const locations = parseLspLocations(lines);
217
+ const codeBlockMatch = locations ? null : text.match(/```(\w*)\n([\s\S]*?)```/);
188
218
  const errorMatch = text.match(/(\d+)\s+error\(s\)/);
189
219
  const warningMatch = text.match(/(\d+)\s+warning\(s\)/);
190
220
  const refMatch = text.match(/(\d+)\s+reference\(s\)/);
191
221
  const symbolsMatch = text.match(/Symbols in (.+):/);
192
- const hasStatusError = text.includes(theme.status.error);
222
+ const unreportedCount = lines.filter(line => UNREPORTED_LINE_RE.test(line)).length;
193
223
 
194
224
  // Static request info
195
225
  const request = args ?? result.details?.request;
226
+ const action = request?.action ?? result.details?.action;
227
+ const hasStatusError = hasStatusRow(action, lines, theme.status.error);
196
228
  const requestLines: string[] = [];
197
229
  if (request?.file) {
198
- requestLines.push(theme.fg("toolOutput", request.file));
230
+ requestLines.push(formatStyledPath(request.file, theme));
199
231
  }
200
232
  if (request?.line !== undefined) {
201
233
  requestLines.push(theme.fg("dim", `line ${request.line}`));
@@ -211,6 +243,13 @@ export function renderResult(
211
243
  // and render it once per expanded state instead of on every spinner frame.
212
244
  const bodies: Array<LspResultBody | undefined> = [undefined, undefined];
213
245
  const renderBody = (expanded: boolean): LspResultBody => {
246
+ if (locations) {
247
+ return {
248
+ label: "Locations",
249
+ state: locations.count > 0 ? "success" : "warning",
250
+ bodyLines: renderLocations(locations, expanded, theme),
251
+ };
252
+ }
214
253
  if (codeBlockMatch) {
215
254
  return {
216
255
  label: "Hover",
@@ -218,12 +257,12 @@ export function renderResult(
218
257
  bodyLines: renderHover(codeBlockMatch, text, lines, expanded, theme),
219
258
  };
220
259
  }
221
- if (errorMatch || warningMatch || hasStatusError) {
260
+ if (errorMatch || warningMatch || hasStatusError || unreportedCount > 0) {
222
261
  const errorCount = errorMatch ? Number.parseInt(errorMatch[1], 10) : 0;
223
262
  const warnCount = warningMatch ? Number.parseInt(warningMatch[1], 10) : 0;
224
263
  return {
225
264
  label: "Diagnostics",
226
- state: errorCount > 0 ? "error" : warnCount > 0 ? "warning" : "success",
265
+ state: errorCount > 0 ? "error" : warnCount > 0 || unreportedCount > 0 ? "warning" : "success",
227
266
  bodyLines: renderDiagnostics(errorMatch, warningMatch, lines, expanded, theme),
228
267
  };
229
268
  }
@@ -244,7 +283,7 @@ export function renderResult(
244
283
  bodyLines: [`${theme.styledSymbol("tool.lsp", "accent")} ${theme.fg("dim", "OK")}`],
245
284
  };
246
285
  }
247
- return { label: "Response", state: "success", bodyLines: renderGeneric(text, lines, expanded, theme) };
286
+ return { label: "Response", state: "success", bodyLines: renderGeneric(text, lines, action, expanded, theme) };
248
287
  };
249
288
 
250
289
  return framedToolCard(theme, ({ contentWidth }) => {
@@ -267,6 +306,7 @@ export function renderResult(
267
306
 
268
307
  // Hover code hangs under its rail; expanded rows hang under their tree
269
308
  // connector or guide rails so Ctrl+O reveals full text instead of clipping.
309
+ // Collapsed source lines stop at the card's edge, one row each under their rail.
270
310
  const rail = ` ${theme.fg("mdCodeBlockBorder", theme.boxRound.vertical)} `;
271
311
  const contentLines = codeBlockMatch
272
312
  ? bodyLines.flatMap(line =>
@@ -274,7 +314,9 @@ export function renderResult(
274
314
  )
275
315
  : expanded
276
316
  ? bodyLines.flatMap(line => wrapGuidedLine(line, contentWidth, theme))
277
- : bodyLines;
317
+ : locations
318
+ ? clipCollapsedLocations(bodyLines, contentWidth, locations, theme)
319
+ : bodyLines;
278
320
  return {
279
321
  header,
280
322
  phase: isPartial ? "partial" : state,
@@ -366,10 +408,16 @@ function renderHover(
366
408
  // Diagnostics Rendering
367
409
  // =============================================================================
368
410
 
411
+ /** A diagnostic's location: the muted file-type icon, the styled path and the muted `:line:col`. */
369
412
  function formatDiagnosticLocation(file: string, line: number, col: number, theme: Theme): string {
370
413
  const lang = getLanguageFromPath(file);
371
414
  const icon = theme.fg("muted", theme.getLangIcon(lang));
372
- return `${icon} ${file}:${line}:${col}`;
415
+ return `${icon} ${formatStyledPath(file, theme)}${theme.fg("muted", `:${line}:${col}`)}`;
416
+ }
417
+
418
+ /** The `[severity]` tag in its severity's color: the path no longer carries it. */
419
+ function formatSeverityTag(severity: ParsedDiagnostic["severity"], theme: Theme): string {
420
+ return theme.fg(severityToColor(severity), `[${severity}]`);
373
421
  }
374
422
 
375
423
  /**
@@ -384,30 +432,36 @@ function renderDiagnostics(
384
432
  ): string[] {
385
433
  const errorCount = errorMatch ? Number.parseInt(errorMatch[1], 10) : 0;
386
434
  const warnCount = warningMatch ? Number.parseInt(warningMatch[1], 10) : 0;
435
+ const unreportedLines = lines.filter(line => UNREPORTED_LINE_RE.test(line));
387
436
 
388
437
  const icon =
389
438
  errorCount > 0
390
439
  ? theme.styledSymbol("status.error", "error")
391
- : warnCount > 0
440
+ : warnCount > 0 || unreportedLines.length > 0
392
441
  ? theme.styledSymbol("status.warning", "warning")
393
442
  : theme.styledSymbol("tool.lsp", "accent");
394
443
 
395
444
  const meta: string[] = [];
396
445
  if (errorCount > 0) meta.push(`${errorCount} error${errorCount !== 1 ? "s" : ""}`);
397
446
  if (warnCount > 0) meta.push(`${warnCount} warning${warnCount !== 1 ? "s" : ""}`);
447
+ if (unreportedLines.length > 0) meta.push(formatCount("unverified file", unreportedLines.length));
398
448
  if (meta.length === 0) meta.push("No issues");
399
449
 
400
- const diagLines = lines.filter(l => l.includes(theme.status.error) || /:\d+:\d+/.test(l));
450
+ const diagLines = lines.filter(l => isStatusRow(l, theme.status.error) || /:\d+:\d+/.test(l));
401
451
  const parsedDiagnostics = diagLines
402
452
  .map(line => parseDiagnosticMessage(line.trim()))
403
453
  .filter((diag): diag is ParsedDiagnostic => diag !== null);
404
454
  const fallbackDiagnostics: RawDiagnostic[] = diagLines.map(line => ({
405
455
  raw: sanitizeDiagnosticDisplayText(line.trim()),
406
456
  }));
457
+ // Unverified files lead: they are the rows a reader must not miss among diagnostics.
458
+ const items: DiagnosticItem[] = [
459
+ ...unreportedLines.map(line => ({ raw: sanitizeDiagnosticDisplayText(line.trim()) })),
460
+ ...(parsedDiagnostics.length > 0 ? parsedDiagnostics : fallbackDiagnostics),
461
+ ];
407
462
 
408
463
  if (expanded) {
409
464
  let output = `${icon} ${theme.fg("dim", meta.join(theme.sep.dot))}`;
410
- const items: DiagnosticItem[] = parsedDiagnostics.length > 0 ? parsedDiagnostics : fallbackDiagnostics;
411
465
  for (let i = 0; i < items.length; i++) {
412
466
  const item = items[i];
413
467
  const isLast = i === items.length - 1;
@@ -417,12 +471,8 @@ function renderDiagnostics(
417
471
  output += `\n ${theme.fg("dim", branch)} ${theme.fg("muted", item.raw)}`;
418
472
  continue;
419
473
  }
420
- const severityColor = severityToColor(item.severity);
421
474
  const location = formatDiagnosticLocation(item.filePath, item.line, item.col, theme);
422
- output += `\n ${theme.fg("dim", branch)} ${theme.fg(severityColor, location)} ${theme.fg(
423
- "dim",
424
- `[${item.severity}]`,
425
- )}`;
475
+ output += `\n ${theme.fg("dim", branch)} ${location} ${formatSeverityTag(item.severity, theme)}`;
426
476
  const message = formatDiagnosticMessage(item);
427
477
  if (message) {
428
478
  output += `\n ${theme.fg("dim", detailPrefix)}${theme.fg("muted", message)}`;
@@ -432,10 +482,8 @@ function renderDiagnostics(
432
482
  }
433
483
 
434
484
  // Collapsed view
435
- const previewItems: DiagnosticItem[] =
436
- parsedDiagnostics.length > 0 ? parsedDiagnostics.slice(0, 3) : fallbackDiagnostics.slice(0, 3);
437
- const remaining =
438
- (parsedDiagnostics.length > 0 ? parsedDiagnostics.length : fallbackDiagnostics.length) - previewItems.length;
485
+ const previewItems = items.slice(0, 3);
486
+ const remaining = items.length - previewItems.length;
439
487
  const clipped = previewItems.some(
440
488
  item => !("raw" in item) && visibleWidth(formatDiagnosticMessage(item)) > TRUNCATE_LENGTHS.CONTENT,
441
489
  );
@@ -449,13 +497,12 @@ function renderDiagnostics(
449
497
  output += `\n ${theme.fg("dim", branch)} ${theme.fg("muted", item.raw)}`;
450
498
  continue;
451
499
  }
452
- const severityColor = severityToColor(item.severity);
453
500
  const location = formatDiagnosticLocation(item.filePath, item.line, item.col, theme);
454
501
  const diagnosticMessage = formatDiagnosticMessage(item);
455
502
  const message = diagnosticMessage
456
503
  ? ` ${theme.fg("muted", truncateToWidth(diagnosticMessage, TRUNCATE_LENGTHS.CONTENT))}`
457
504
  : "";
458
- output += `\n ${theme.fg("dim", branch)} ${theme.fg(severityColor, location)}${message}`;
505
+ output += `\n ${theme.fg("dim", branch)} ${location} ${formatSeverityTag(item.severity, theme)}${message}`;
459
506
  }
460
507
  if (remaining > 0) {
461
508
  output += `\n ${theme.fg("dim", theme.tree.last)} ${theme.fg("muted", `… ${remaining} more`)}`;
@@ -505,7 +552,7 @@ function renderReferences(refMatch: RegExpMatchArray, lines: string[], expanded:
505
552
  const fileCont = isLastFile ? " " : `${theme.tree.vertical} `;
506
553
 
507
554
  const fileMeta = `${locs.length} reference${locs.length !== 1 ? "s" : ""}`;
508
- output += `\n ${theme.fg("dim", fileBranch)} ${theme.fg("accent", file)} ${theme.fg("dim", fileMeta)}`;
555
+ output += `\n ${theme.fg("dim", fileBranch)} ${formatStyledPath(file, theme)} ${theme.fg("dim", fileMeta)}`;
509
556
 
510
557
  if (maxLocsPerFile > 0) {
511
558
  const locsToShow = locs.slice(0, maxLocsPerFile);
@@ -519,10 +566,8 @@ function renderReferences(refMatch: RegExpMatchArray, lines: string[], expanded:
519
566
  `line ${line}, col ${col}`,
520
567
  )}`;
521
568
  if (expanded) {
522
- output += `\n ${theme.fg("dim", fileCont)}${theme.fg("dim", locCont)}${theme.fg(
523
- "muted",
524
- `at ${file}:${line}:${col}`,
525
- )}`;
569
+ const at = `${theme.fg("muted", "at ")}${formatStyledPath(file, theme)}${theme.fg("muted", `:${line}:${col}`)}`;
570
+ output += `\n ${theme.fg("dim", fileCont)}${theme.fg("dim", locCont)}${at}`;
526
571
  }
527
572
  }
528
573
  if (locs.length > maxLocsPerFile) {
@@ -547,6 +592,109 @@ function renderReferences(refMatch: RegExpMatchArray, lines: string[], expanded:
547
592
  return (expanded ? renderGrouped(files.length, Number.POSITIVE_INFINITY) : renderGrouped(3, 1)).split("\n");
548
593
  }
549
594
 
595
+ // =============================================================================
596
+ // Locations Rendering
597
+ // =============================================================================
598
+
599
+ /** One location of a definition-style response, with its numbered source context. */
600
+ interface LspLocation {
601
+ file: string;
602
+ line: number;
603
+ col: number;
604
+ /** Source lines around the location; the location's own line is `mark`ed. */
605
+ context: { n: number; text: string; mark: boolean }[];
606
+ }
607
+
608
+ /** A definition, type definition or implementation response. */
609
+ interface LspLocations {
610
+ /** `definition`, `type definition` or `implementation`. */
611
+ noun: string;
612
+ count: number;
613
+ locations: LspLocation[];
614
+ }
615
+
616
+ const LOCATIONS_HEADER_RE = /^Found (\d+) (definition|type definition|implementation)\(s\):$/;
617
+ /**
618
+ * ` file:line:col`, the path from column 2 on (it may itself start with whitespace). Context rows are
619
+ * ` N: source`; a row matching both is context of the current location.
620
+ */
621
+ const LOCATION_RE = /^ {2}(.+):(\d+):(\d+)$/;
622
+ const LOCATION_CONTEXT_RE = /^ {4}(\d+): ?(.*)$/;
623
+
624
+ /**
625
+ * Parse a `Found N definition(s):` response (also type definitions and
626
+ * implementations): ` file:line:col` rows, each followed by its
627
+ * ` N: source` context lines.
628
+ */
629
+ function parseLspLocations(lines: readonly string[]): LspLocations | undefined {
630
+ const header = LOCATIONS_HEADER_RE.exec(lines[0] ?? "");
631
+ if (!header) return undefined;
632
+ const locations: LspLocation[] = [];
633
+ for (const line of lines.slice(1)) {
634
+ const current = locations.at(-1);
635
+ const context = current ? LOCATION_CONTEXT_RE.exec(line) : null;
636
+ if (current && context) {
637
+ const n = Number(context[1]);
638
+ current.context.push({ n, text: context[2].trimEnd(), mark: n === current.line });
639
+ continue;
640
+ }
641
+ const location = LOCATION_RE.exec(line);
642
+ if (location) {
643
+ const [, file, lineNumber, column] = location;
644
+ locations.push({ file, line: Number(lineNumber), col: Number(column), context: [] });
645
+ }
646
+ }
647
+ return { noun: header[2], count: Number(header[1]), locations };
648
+ }
649
+
650
+ /**
651
+ * Render definitions, type definitions and implementations: each
652
+ * `file:line:col` over its source context, the location's line marked like a
653
+ * grep match.
654
+ */
655
+ function renderLocations(parsed: LspLocations, expanded: boolean, theme: Theme): string[] {
656
+ const { noun, count, locations } = parsed;
657
+ const shown = expanded ? locations : locations.slice(0, PREVIEW_LIMITS.LOCATIONS_COLLAPSED);
658
+ const hidden = locations.length - shown.length;
659
+ const icon = count > 0 ? theme.styledSymbol("tool.lsp", "accent") : theme.styledSymbol("status.warning", "warning");
660
+ const rows = [
661
+ `${icon} ${theme.fg("dim", formatCount(noun, count))}${formatExpandHint(theme, expanded, hidden > 0)}`,
662
+ ];
663
+
664
+ shown.forEach((location, index) => {
665
+ const isLast = index === shown.length - 1 && hidden === 0;
666
+ const branch = isLast ? theme.tree.last : theme.tree.branch;
667
+ const rail = isLast ? " " : `${theme.tree.vertical} `;
668
+ const position = theme.fg("muted", `:${location.line}:${location.col}`);
669
+ const file = formatStyledPath(replaceTabs(shortenPath(location.file)), theme);
670
+ rows.push(` ${theme.fg("dim", branch)} ${file}${position}`);
671
+
672
+ const numberWidth = location.context.reduce((width, line) => Math.max(width, String(line.n).length), 0);
673
+ for (const line of location.context) {
674
+ const frame = formatCodeFrameLine(line.mark ? "*" : "", line.n, replaceTabs(line.text), numberWidth);
675
+ rows.push(` ${theme.fg("dim", rail)}${theme.fg("toolOutput", frame)}`);
676
+ }
677
+ });
678
+
679
+ if (hidden > 0) {
680
+ rows.push(` ${theme.fg("dim", theme.tree.last)} ${theme.fg("muted", formatMoreItems(hidden, noun))}`);
681
+ }
682
+ return rows;
683
+ }
684
+
685
+ /**
686
+ * Collapsed location rows stop at the card's edge. When that clips a row and no hidden location already
687
+ * advertises Ctrl+O, the header gets the expand hint: the expanded view wraps the full text.
688
+ */
689
+ function clipCollapsedLocations(rows: string[], width: number, parsed: LspLocations, theme: Theme): string[] {
690
+ const clipped = rows.map(row => truncateToWidth(row, width));
691
+ const hinted = parsed.locations.length > PREVIEW_LIMITS.LOCATIONS_COLLAPSED;
692
+ if (!hinted && clipped.some((row, index) => row !== rows[index])) {
693
+ clipped[0] = truncateToWidth(`${rows[0]}${formatExpandHint(theme, false, true)}`, width);
694
+ }
695
+ return clipped;
696
+ }
697
+
550
698
  // =============================================================================
551
699
  // Symbols Rendering
552
700
  // =============================================================================
@@ -605,6 +753,13 @@ function renderSymbols(symbolsMatch: RegExpMatchArray, lines: string[], expanded
605
753
  };
606
754
 
607
755
  const topLevelCount = symbols.filter(s => s.indent === 0).length;
756
+ // The glyph keeps the accent; the name and signature read as code in the file's language.
757
+ const lang = getLanguageFromPath(fileName);
758
+ const symbolName = (name: string): string => {
759
+ const plain = replaceTabs(name);
760
+ if (!isHighlightLanguage(lang)) return theme.fg("accent", plain);
761
+ return highlightThemeCode(plain, lang, theme)[0] ?? plain;
762
+ };
608
763
 
609
764
  if (expanded) {
610
765
  let output = `${icon} ${theme.fg("dim", `in ${fileName}`)}`;
@@ -616,7 +771,7 @@ function renderSymbols(symbolsMatch: RegExpMatchArray, lines: string[], expanded
616
771
  const symIsLast = isLast[i];
617
772
  const branch = symIsLast ? theme.tree.last : theme.tree.branch;
618
773
  const detailPrefix = symIsLast ? " " : `${theme.tree.vertical} `;
619
- output += `\n${prefix}${theme.fg("dim", branch)} ${theme.fg("accent", sym.icon)} ${theme.fg("accent", sym.name)}`;
774
+ output += `\n${prefix}${theme.fg("dim", branch)} ${theme.fg("accent", sym.icon)} ${symbolName(sym.name)}`;
620
775
  output += `\n${prefix}${theme.fg("dim", detailPrefix)}${theme.fg("muted", `line ${sym.line}`)}`;
621
776
  }
622
777
  return output.split("\n");
@@ -631,7 +786,7 @@ function renderSymbols(symbolsMatch: RegExpMatchArray, lines: string[], expanded
631
786
  const sym = topLevel[i];
632
787
  const isLast = i === topLevel.length - 1 && topLevelCount <= 3;
633
788
  const branch = isLast ? theme.tree.last : theme.tree.branch;
634
- output += `\n ${theme.fg("dim", branch)} ${theme.fg("accent", sym.icon)} ${theme.fg("accent", sym.name)} ${theme.fg(
789
+ output += `\n ${theme.fg("dim", branch)} ${theme.fg("accent", sym.icon)} ${symbolName(sym.name)} ${theme.fg(
635
790
  "muted",
636
791
  `line ${sym.line}`,
637
792
  )}`;
@@ -650,9 +805,15 @@ function renderSymbols(symbolsMatch: RegExpMatchArray, lines: string[], expanded
650
805
  /**
651
806
  * Generic fallback rendering for unknown result types.
652
807
  */
653
- function renderGeneric(text: string, lines: string[], expanded: boolean, theme: Theme): string[] {
654
- const hasError = text.includes("Error:") || text.includes(theme.status.error);
655
- const hasSuccess = text.includes(theme.status.success) || text.includes("Applied");
808
+ function renderGeneric(
809
+ text: string,
810
+ lines: string[],
811
+ action: string | undefined,
812
+ expanded: boolean,
813
+ theme: Theme,
814
+ ): string[] {
815
+ const hasError = text.includes("Error:") || hasStatusRow(action, lines, theme.status.error);
816
+ const hasSuccess = hasStatusRow(action, lines, theme.status.success) || text.includes("Applied");
656
817
 
657
818
  const icon =
658
819
  hasError && !hasSuccess
@@ -788,13 +949,15 @@ interface LspDiagnosticsParse {
788
949
  diagnostics: ParsedDiagnostic[];
789
950
  failures: string[];
790
951
  warnings: string[];
952
+ /** Files a server sent no report for in time: unverified, never "No issues". */
953
+ unreported: string[];
791
954
  /** Lines neither a diagnostic nor a status line (kept verbatim). */
792
955
  other: string[];
793
956
  }
794
957
 
795
958
  const DIAGNOSTIC_AT_RE = /^\d+:\d+\s+\[/;
796
959
  const DIAGNOSTICS_SUMMARY_RE = /^\d+ \w+\(s\)(?:, \d+ \w+\(s\))*:?$/;
797
- /** A per-file status line's leading status glyph (`✘`, `⚠`, a Nerd Font glyph, ASCII `[!!]`). */
960
+ /** A per-file status line's leading status glyph (`✘`, `⚠`, a Nerd Font glyph, ASCII `[-]`). */
798
961
  const STATUS_GLYPH_RE = /^(?:\[[^\]\s]*\]|[^\p{L}\p{N}\s./~\\]+)\s+/u;
799
962
  /** Per-file summaries (`✗ a.ts: 2 error(s)`, `✓ a.ts: no issues`) repeat what the rows and head count. */
800
963
  const FILE_SUMMARY_RE = /: (?:no issues|\d+ \w+\(s\)(?:, \d+ \w+\(s\))*)$/;
@@ -803,10 +966,10 @@ const FILE_SUMMARY_RE = /: (?:no issues|\d+ \w+\(s\)(?:, \d+ \w+\(s\))*)$/;
803
966
  * Parse a diagnostics response: grouped (`# dir/`, `## file`, ` 12:5 [error] …`)
804
967
  * or flat (`file:12:5 [error] …`) diagnostic lines, and the per-file status
805
968
  * lines (`✗ file: all language servers failed (…)`, `⚠ …some servers failed`,
806
- * `✓ file: no issues`, `✗ file: 2 error(s)`).
969
+ * `⚠ file: no diagnostics report yet from …`, `✓ file: no issues`, `✗ file: 2 error(s)`).
807
970
  */
808
971
  function parseLspDiagnostics(lines: readonly string[]): LspDiagnosticsParse {
809
- const out: LspDiagnosticsParse = { diagnostics: [], failures: [], warnings: [], other: [] };
972
+ const out: LspDiagnosticsParse = { diagnostics: [], failures: [], warnings: [], unreported: [], other: [] };
810
973
  let file: string | undefined;
811
974
  for (const event of walkGroupedOutput(lines)) {
812
975
  if (event.kind !== "line") {
@@ -824,6 +987,10 @@ function parseLspDiagnostics(lines: readonly string[]): LspDiagnosticsParse {
824
987
  out.warnings.push(line.replace(STATUS_GLYPH_RE, ""));
825
988
  continue;
826
989
  }
990
+ if (UNREPORTED_LINE_RE.test(line)) {
991
+ out.unreported.push(line.replace(STATUS_GLYPH_RE, ""));
992
+ continue;
993
+ }
827
994
  if (FILE_SUMMARY_RE.test(line)) continue;
828
995
  const parsed = parseDiagnosticMessage(file && DIAGNOSTIC_AT_RE.test(line) ? `${file}:${line}` : line);
829
996
  if (parsed) out.diagnostics.push(parsed);
@@ -888,25 +1055,30 @@ function statusRow(message: string, tone: "error" | "warning", key: string): Nat
888
1055
  }
889
1056
 
890
1057
  /**
891
- * Diagnostics view: a card when there are diagnostics or failures (rows of
892
- * severity icon · `file:line:col` · source · message), an inline `No issues`
893
- * otherwise. A failed server is an error row, never "No issues".
1058
+ * Diagnostics view: a card when there are diagnostics, failures or unverified files
1059
+ * (rows of severity icon · `file:line:col` · source · message), an inline `No issues`
1060
+ * otherwise. A failed server or a missing report is a row, never "No issues".
894
1061
  */
895
1062
  function describeLspDiagnostics(request: Partial<LspParams> | undefined, fallbackAction: string, lines: string[]) {
896
1063
  const parsed = parseLspDiagnostics(lines);
897
1064
  const counts = diagnosticCounts(parsed.diagnostics);
898
1065
  const failed =
899
1066
  parsed.failures.length > 0 ? [span(formatCount("server failure", parsed.failures.length), "error")] : undefined;
1067
+ const unverified =
1068
+ parsed.unreported.length > 0
1069
+ ? [span(formatCount("unverified file", parsed.unreported.length), "warning")]
1070
+ : undefined;
900
1071
  const rows: NativeNode[] = [
901
1072
  ...parsed.failures.map((message, i) => statusRow(message, "error", `x${i}`)),
1073
+ ...parsed.unreported.map((message, i) => statusRow(message, "warning", `u${i}`)),
902
1074
  ...parsed.diagnostics.map((diag, i) => diagnosticRow(diag, `d${i}`)),
903
1075
  ...parsed.warnings.map((message, i) => statusRow(message, "warning", `w${i}`)),
904
1076
  ];
905
1077
  if (parsed.other.length > 0) rows.push(keyed(code(parsed.other.join("\n"), { wrap: true }), "other"));
906
1078
  const hasErrors = parsed.failures.length > 0 || parsed.diagnostics.some(d => d.severity === "error");
907
- const meta = compact<TspText>([counts, failed, !counts && !failed && "No issues"]);
1079
+ const meta = compact<TspText>([counts, failed, unverified, !counts && !failed && !unverified && "No issues"]);
908
1080
  const head = lspNativeHead(request, fallbackAction, meta);
909
- if (parsed.diagnostics.length === 0 && parsed.failures.length === 0) {
1081
+ if (parsed.diagnostics.length === 0 && parsed.failures.length === 0 && parsed.unreported.length === 0) {
910
1082
  return { tool: head, inline: true, body: rows.length > 0 ? rows : undefined } satisfies NativeToolView;
911
1083
  }
912
1084
  return {
@@ -978,15 +1150,42 @@ function describeLspSymbols(lines: string[]): NativeNode | undefined {
978
1150
  return roots.length > 0 ? node("tree", { nodes: roots }) : undefined;
979
1151
  }
980
1152
 
1153
+ /** Definition-style locations: a file row with `:line:col`, then the numbered source context. */
1154
+ function describeLspLocations(
1155
+ request: Partial<LspParams> | undefined,
1156
+ fallbackAction: string,
1157
+ parsed: LspLocations,
1158
+ ): NativeToolView {
1159
+ const body = parsed.locations.map(location => {
1160
+ const file = plainText(location.file);
1161
+ const context = location.context.map(line => ({ ...line, text: plainText(line.text) }));
1162
+ const range = `:${location.line}:${location.col}`;
1163
+ const code = numberedCode(context, { path: file });
1164
+ const header = fileRow(displayPath(file), { range, title: file });
1165
+ return keyed(col(code ? [header, code] : [header], { gap: "xs" }), `${file}${range}`);
1166
+ });
1167
+ return {
1168
+ tool: lspNativeHead(request, fallbackAction, [formatCount(parsed.noun, parsed.count)]),
1169
+ tone: parsed.count > 0 ? undefined : "warning",
1170
+ inline: true,
1171
+ body: body.length > 0 ? body : undefined,
1172
+ preview: { lines: PREVIEW_LIMITS.COLLAPSED_ITEMS },
1173
+ };
1174
+ }
1175
+
981
1176
  function describeLspResult(result: ToolRenderResult<LspToolDetails>, args: LspParams | undefined): NativeToolView {
982
1177
  const request = args ?? result.details?.request;
983
1178
  const fallbackAction = result.details?.action ?? "request";
1179
+ const action = request?.action ?? result.details?.action;
984
1180
  const content = result.content?.[0];
985
1181
  const text = content?.type === "text" ? (content.text ?? "") : "";
986
1182
  if (result.isError) return inlineErrorView(lspNativeHead(request, fallbackAction), text || "LSP request failed");
987
1183
  if (!text) return { tool: lspNativeHead(request, fallbackAction, ["No result"]), tone: "warning", inline: true };
988
1184
 
989
1185
  const lines = text.split("\n");
1186
+ const locations = parseLspLocations(lines);
1187
+ if (locations) return describeLspLocations(request, fallbackAction, locations);
1188
+
990
1189
  const statusError = activeThemeSymbol("status.error");
991
1190
  const refMatch = text.match(/(\d+)\s+reference\(s\)/);
992
1191
  const symbolsMatch = text.match(/Symbols in (.+):/);
@@ -996,7 +1195,7 @@ function describeLspResult(result: ToolRenderResult<LspToolDetails>, args: LspPa
996
1195
  }
997
1196
  if (
998
1197
  /\d+\s+(?:error|warning)\(s\)/.test(text) ||
999
- text.includes(statusError) ||
1198
+ hasStatusRow(action, lines, statusError) ||
1000
1199
  (request?.action ?? fallbackAction) === "diagnostics"
1001
1200
  ) {
1002
1201
  return describeLspDiagnostics(request, fallbackAction, lines);
@@ -1021,8 +1220,8 @@ function describeLspResult(result: ToolRenderResult<LspToolDetails>, args: LspPa
1021
1220
  preview: { lines: 8 },
1022
1221
  };
1023
1222
  }
1024
- const hasError = text.includes("Error:") || text.includes(statusError);
1025
- const hasSuccess = text.includes(activeThemeSymbol("status.success")) || text.includes("Applied");
1223
+ const hasError = text.includes("Error:") || hasStatusRow(action, lines, statusError);
1224
+ const hasSuccess = hasStatusRow(action, lines, activeThemeSymbol("status.success")) || text.includes("Applied");
1026
1225
  return {
1027
1226
  tool: lspNativeHead(request, fallbackAction),
1028
1227
  tone: hasError && !hasSuccess ? "error" : undefined,
@@ -23,11 +23,12 @@ export declare function renderMCPResult(result: {
23
23
  isError?: boolean;
24
24
  }, options: RenderResultOptions, theme: Theme, args?: Record<string, unknown>): Component;
25
25
  /** Native MCP call view: the head plus the folded args, inline while pending. */
26
- export declare function describeMCPCall(args: Record<string, unknown>, label: string): NativeToolView;
26
+ export declare function describeMCPCall(args: Record<string, unknown>, label: string, options?: RenderResultOptions): NativeToolView;
27
27
  /**
28
- * Native MCP result view: JSON output as a JSON tree, Markdown when the
29
- * preference is on, otherwise the raw text as tool output; the folded Args
30
- * section follows, so the collapsed preview still leads with the output.
28
+ * Native MCP result view: JSON output as the host's `json` viewer (when it
29
+ * draws one) or a JSON tree, Markdown when the preference is on, otherwise
30
+ * the raw text as tool output; the folded Args section follows, so the
31
+ * collapsed preview still leads with the output.
31
32
  */
32
33
  export declare function describeMCPResult(result: {
33
34
  content: Array<{
@@ -36,7 +37,7 @@ export declare function describeMCPResult(result: {
36
37
  }>;
37
38
  details?: MCPToolDetails;
38
39
  isError?: boolean;
39
- }, _options: RenderResultOptions, args?: Record<string, unknown>): NativeToolView | undefined;
40
+ }, options: RenderResultOptions, args?: Record<string, unknown>): NativeToolView | undefined;
40
41
  import type { OutputMeta } from "./output-meta";
41
42
  /** Set whether plain MCP text results render as Markdown. */
42
43
  export declare function setMcpRenderMarkdownResults(enabled: boolean): void;