@mrclrchtr/supi-code-intelligence 11.4.0 → 13.0.0

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 (330) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +17 -9
  3. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
  5. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
  6. package/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  7. package/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  8. package/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  9. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
  10. package/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  11. package/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
  12. package/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  13. package/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  14. package/node_modules/@mrclrchtr/supi-lsp/README.md +21 -16
  15. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  21. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  26. package/node_modules/@mrclrchtr/supi-lsp/package.json +8 -8
  27. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +3 -2
  28. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +102 -47
  29. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +13 -3
  30. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +8 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +15 -1
  32. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +1 -1
  33. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +71 -13
  34. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-disk-stamp.ts +60 -0
  35. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +3 -0
  36. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +28 -6
  37. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-edit-capture.ts +258 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +17 -3
  39. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +53 -4
  40. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +75 -14
  41. package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +8 -0
  42. package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +48 -79
  43. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +2 -1
  44. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +2 -2
  45. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +14 -5
  46. package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-module.ts +17 -0
  47. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +42 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +2 -17
  49. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-removal-ledger.ts +52 -0
  50. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +43 -21
  51. package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +6 -1
  52. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +21 -35
  53. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +6 -1
  54. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-command-capture.ts +139 -0
  55. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +202 -47
  56. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +13 -3
  57. package/node_modules/@mrclrchtr/supi-lsp/src/session/route-boundary.ts +26 -0
  58. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +11 -0
  59. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +1 -0
  60. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +74 -14
  61. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +3 -0
  62. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +11 -1
  63. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +24 -1
  64. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  65. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
  66. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
  67. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  68. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  69. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  70. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
  71. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  72. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
  73. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  74. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  75. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +50 -75
  76. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +2 -2
  77. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +50 -75
  78. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +2 -2
  79. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
  80. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +6 -6
  81. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
  82. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +50 -75
  83. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +2 -2
  84. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +7 -7
  85. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
  86. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +7 -7
  87. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
  88. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +50 -75
  89. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +2 -2
  90. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
  91. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +5 -5
  92. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -5
  93. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +1 -1
  94. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/latex/tree-sitter-latex.wasm.json +1 -1
  95. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +1 -1
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +1 -1
  97. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +1 -1
  98. package/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +16 -2
  99. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +4 -3
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-errors.ts +2 -0
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-range.ts +94 -0
  102. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +26 -6
  103. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +6 -3
  104. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +13 -4
  105. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +1 -9
  106. package/node_modules/fast-xml-parser/CHANGELOG.md +886 -0
  107. package/node_modules/fast-xml-parser/LICENSE +21 -0
  108. package/node_modules/fast-xml-parser/README.md +204 -0
  109. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
  110. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
  111. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
  112. package/node_modules/fast-xml-parser/lib/fxp.d.cts +774 -0
  113. package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
  114. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
  115. package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
  116. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
  117. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
  118. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
  119. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/README.md +92 -0
  120. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/package.json +57 -0
  121. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityDecoder.js +644 -0
  122. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityEncoder.js +239 -0
  123. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/all-entities.js +53 -0
  124. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entities.js +1139 -0
  125. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entityTries.js +60 -0
  126. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.d.ts +358 -0
  127. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.js +29 -0
  128. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/CHANGELOG.md +52 -0
  129. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/LICENSE +21 -0
  130. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/README.md +77 -0
  131. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
  132. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
  133. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
  134. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
  135. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/package.json +77 -0
  136. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
  137. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.js +609 -0
  138. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
  139. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/orderedJs2Xml.js +360 -0
  140. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/prettifyJs2Xml.js +0 -0
  141. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/util.js +23 -0
  142. package/node_modules/fast-xml-parser/node_modules/is-unsafe/LICENSE +21 -0
  143. package/node_modules/fast-xml-parser/node_modules/is-unsafe/README.md +632 -0
  144. package/node_modules/fast-xml-parser/node_modules/is-unsafe/package.json +56 -0
  145. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/html.js +102 -0
  146. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/log.js +98 -0
  147. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/nosql.js +114 -0
  148. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/redos.js +60 -0
  149. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/shell.js +105 -0
  150. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql-strict.js +47 -0
  151. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql.js +95 -0
  152. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/svg.js +81 -0
  153. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/xml.js +79 -0
  154. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.cjs +27 -0
  155. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.d.ts +103 -0
  156. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.js +292 -0
  157. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/util/decode-entities.js +48 -0
  158. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/LICENSE +21 -0
  159. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/README.md +947 -0
  160. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
  161. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.d.cts +725 -0
  162. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
  163. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
  164. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/package.json +79 -0
  165. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Expression.js +232 -0
  166. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/ExpressionSet.js +225 -0
  167. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Matcher.js +663 -0
  168. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.d.ts +589 -0
  169. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.js +30 -0
  170. package/node_modules/fast-xml-parser/node_modules/strnum/CHANGELOG.md +63 -0
  171. package/node_modules/fast-xml-parser/node_modules/strnum/LICENSE +21 -0
  172. package/node_modules/fast-xml-parser/node_modules/strnum/README.md +113 -0
  173. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/LICENSE +21 -0
  174. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/README.md +142 -0
  175. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/anynum.js +135 -0
  176. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/digitTable.js +116 -0
  177. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/package.json +42 -0
  178. package/node_modules/fast-xml-parser/node_modules/strnum/package.json +36 -0
  179. package/node_modules/fast-xml-parser/node_modules/strnum/strnum.js +176 -0
  180. package/node_modules/fast-xml-parser/node_modules/xml-naming/LICENSE +21 -0
  181. package/node_modules/fast-xml-parser/node_modules/xml-naming/README.md +287 -0
  182. package/node_modules/fast-xml-parser/node_modules/xml-naming/package.json +56 -0
  183. package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.d.ts +108 -0
  184. package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.js +382 -0
  185. package/node_modules/fast-xml-parser/package.json +93 -0
  186. package/node_modules/fast-xml-parser/src/cli/cli.js +97 -0
  187. package/node_modules/fast-xml-parser/src/cli/man.js +17 -0
  188. package/node_modules/fast-xml-parser/src/cli/read.js +43 -0
  189. package/node_modules/fast-xml-parser/src/fxp.d.ts +754 -0
  190. package/node_modules/fast-xml-parser/src/fxp.js +14 -0
  191. package/node_modules/fast-xml-parser/src/ignoreAttributes.js +18 -0
  192. package/node_modules/fast-xml-parser/src/util.js +61 -0
  193. package/node_modules/fast-xml-parser/src/v6/CharsSymbol.js +16 -0
  194. package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +106 -0
  195. package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +61 -0
  196. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +69 -0
  197. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +103 -0
  198. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +100 -0
  199. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +154 -0
  200. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +94 -0
  201. package/node_modules/fast-xml-parser/src/v6/Report.js +0 -0
  202. package/node_modules/fast-xml-parser/src/v6/TagPath.js +81 -0
  203. package/node_modules/fast-xml-parser/src/v6/TagPathMatcher.js +13 -0
  204. package/node_modules/fast-xml-parser/src/v6/XMLParser.js +83 -0
  205. package/node_modules/fast-xml-parser/src/v6/Xml2JsParser.js +235 -0
  206. package/node_modules/fast-xml-parser/src/v6/XmlPartReader.js +210 -0
  207. package/node_modules/fast-xml-parser/src/v6/XmlSpecialTagsReader.js +111 -0
  208. package/node_modules/fast-xml-parser/src/v6/inputSource/BufferSource.js +116 -0
  209. package/node_modules/fast-xml-parser/src/v6/inputSource/StringSource.js +121 -0
  210. package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +105 -0
  211. package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParser.js +22 -0
  212. package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParserExt.js +19 -0
  213. package/node_modules/fast-xml-parser/src/v6/valueParsers/currency.js +38 -0
  214. package/node_modules/fast-xml-parser/src/v6/valueParsers/join.js +13 -0
  215. package/node_modules/fast-xml-parser/src/v6/valueParsers/number.js +14 -0
  216. package/node_modules/fast-xml-parser/src/v6/valueParsers/trim.js +6 -0
  217. package/node_modules/fast-xml-parser/src/validator.js +518 -0
  218. package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +6 -0
  219. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +426 -0
  220. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +164 -0
  221. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +907 -0
  222. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +77 -0
  223. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +177 -0
  224. package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +54 -0
  225. package/package.json +10 -8
  226. package/src/analysis/evidence.ts +331 -73
  227. package/src/analysis/health/diagnostics.ts +66 -18
  228. package/src/analysis/health/evidence-reason.ts +44 -0
  229. package/src/analysis/health/server-status.ts +41 -12
  230. package/src/analysis/search/pattern.ts +3 -3
  231. package/src/analysis/target/anchored-structural.ts +4 -1
  232. package/src/analysis/target/anchored.ts +3 -6
  233. package/src/analysis/target/symbol.ts +42 -48
  234. package/src/analysis/target/types.ts +4 -9
  235. package/src/analysis/workspace/cmake-parser.ts +207 -0
  236. package/src/analysis/workspace/cmake.ts +141 -0
  237. package/src/analysis/workspace/maven.ts +310 -0
  238. package/src/analysis/workspace/membership.ts +100 -26
  239. package/src/analysis/workspace/metadata.ts +6 -1
  240. package/src/analysis/workspace/observe.ts +6 -0
  241. package/src/analysis/workspace/types.ts +11 -3
  242. package/src/diagnostics/coverage.ts +49 -0
  243. package/src/diagnostics/evidence.ts +10 -2
  244. package/src/session/find-types.ts +8 -4
  245. package/src/session/find-workflow.ts +11 -16
  246. package/src/session/health-workflow.ts +6 -0
  247. package/src/session/input/common.ts +1 -1
  248. package/src/session/input/health-refactor.ts +48 -34
  249. package/src/session/input/workflows.ts +45 -46
  250. package/src/session/inspect/file-point.ts +2 -2
  251. package/src/session/inspect-types.ts +1 -1
  252. package/src/session/inspect-workflow.ts +3 -3
  253. package/src/session/orientation/collect.ts +42 -7
  254. package/src/session/orientation/context-facts.ts +3 -3
  255. package/src/session/orientation/context-sections.ts +13 -15
  256. package/src/session/orientation/facts.ts +5 -8
  257. package/src/session/orientation-workflow.ts +4 -19
  258. package/src/session/refactor-file-actions.ts +122 -0
  259. package/src/session/refactor-plan-pipeline.ts +152 -0
  260. package/src/session/refactor-plans.ts +18 -15
  261. package/src/session/refactor-types.ts +24 -12
  262. package/src/session/refactor-workflow.ts +68 -243
  263. package/src/session/target-workflow.ts +25 -18
  264. package/src/tool/code_find/execute.ts +6 -7
  265. package/src/tool/code_find/result.ts +5 -7
  266. package/src/tool/code_find/spec.ts +9 -16
  267. package/src/tool/code_find/tui.ts +12 -6
  268. package/src/tool/code_graph/display.ts +5 -6
  269. package/src/tool/code_graph/format.ts +8 -24
  270. package/src/tool/code_graph/result.ts +16 -75
  271. package/src/tool/code_graph/section.ts +21 -33
  272. package/src/tool/code_graph/spec.ts +6 -0
  273. package/src/tool/code_graph/tui.ts +10 -5
  274. package/src/tool/code_health/diagnostic-tui.ts +49 -0
  275. package/src/tool/code_health/guidance.ts +27 -0
  276. package/src/tool/code_health/markdown.ts +60 -8
  277. package/src/tool/code_health/result.ts +20 -9
  278. package/src/tool/code_health/spec.ts +6 -0
  279. package/src/tool/code_health/structured-schema.ts +18 -4
  280. package/src/tool/code_health/structured.ts +22 -18
  281. package/src/tool/code_health/tui.ts +33 -40
  282. package/src/tool/code_inspect/execute.ts +1 -1
  283. package/src/tool/code_inspect/markdown.ts +33 -6
  284. package/src/tool/code_inspect/result.ts +24 -19
  285. package/src/tool/code_inspect/spec.ts +14 -6
  286. package/src/tool/code_inspect/structured.ts +4 -21
  287. package/src/tool/code_inspect/tui.ts +2 -2
  288. package/src/tool/code_orientation/result.ts +53 -100
  289. package/src/tool/code_orientation/spec.ts +8 -0
  290. package/src/tool/code_orientation/structured-schema.ts +16 -12
  291. package/src/tool/code_orientation/structured-workspace.ts +13 -7
  292. package/src/tool/code_orientation/structured.ts +31 -39
  293. package/src/tool/code_orientation/workspace-format.ts +4 -10
  294. package/src/tool/code_orientation/workspace-instructions.ts +4 -5
  295. package/src/tool/code_orientation/workspace-observations.ts +2 -2
  296. package/src/tool/code_orientation/workspace-output.ts +16 -7
  297. package/src/tool/code_orientation/workspace-projects.ts +7 -10
  298. package/src/tool/code_orientation/workspace-sections.ts +13 -19
  299. package/src/tool/code_refactor_apply/result.ts +2 -1
  300. package/src/tool/code_refactor_apply/spec.ts +7 -0
  301. package/src/tool/code_refactor_plan/execute.ts +0 -2
  302. package/src/tool/code_refactor_plan/result.ts +23 -13
  303. package/src/tool/code_refactor_plan/spec.ts +8 -2
  304. package/src/tool/code_refactor_plan/structured.ts +59 -12
  305. package/src/tool/code_refactor_plan/tui.ts +14 -17
  306. package/src/tool/code_resolve/markdown.ts +5 -47
  307. package/src/tool/code_resolve/result.ts +43 -72
  308. package/src/tool/code_resolve/spec.ts +6 -0
  309. package/src/tool/infra/truncate.ts +2 -16
  310. package/src/tool/namespace.ts +14 -0
  311. package/src/tool/refactor-markdown.ts +55 -15
  312. package/src/tool/register.ts +3 -0
  313. package/src/tool/result/candidate-selection.ts +141 -0
  314. package/src/tool/result/display.ts +41 -45
  315. package/src/tool/result/errors.ts +1 -0
  316. package/src/tool/result/model-budget.ts +26 -1
  317. package/src/tool/result/refactor-preview.ts +118 -0
  318. package/src/tool/result/refactor-unavailable.ts +16 -0
  319. package/src/tool/result/refactor.ts +19 -10
  320. package/src/tool/result/structured.ts +2 -1
  321. package/src/tool/result/types.ts +9 -8
  322. package/src/tool/schemas.ts +76 -38
  323. package/src/tool/specs.ts +3 -0
  324. package/src/ui/footer.ts +2 -4
  325. package/src/ui/status-overlay.ts +1 -1
  326. package/src/ui/status-presentation.ts +4 -7
  327. package/src/ui/tui/candidate-selection.ts +40 -95
  328. package/src/ui/tui/common.ts +16 -70
  329. package/src/ui/tui/display.ts +6 -24
  330. package/src/tool/result/candidate-row.ts +0 -49
@@ -1,6 +1,6 @@
1
1
  import type { ConfidenceMode, SourceRange } from "@mrclrchtr/supi-code-runtime/api";
2
2
  import type { CapabilityWarningReport } from "../../analysis/capability/capability-warnings.ts";
3
- import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
3
+ import type { EvidenceListFacts, EvidenceListMetadata } from "../../analysis/evidence.ts";
4
4
  import type { InstructionFilesMetadata } from "../../analysis/instruction-files.ts";
5
5
  import type { ReadNextItem } from "../../analysis/read-next.ts";
6
6
  import type { AutomaticPathExclusionDisplay } from "../../analysis/search/exclusions.ts";
@@ -10,6 +10,7 @@ import type {
10
10
  StructuredScanSummary,
11
11
  } from "../../analysis/search/pattern.ts";
12
12
  import type { FileOutlineNotListed } from "../../analysis/target/types.ts";
13
+ import type { DiagnosticCoverage } from "../../diagnostics/coverage.ts";
13
14
  import type {
14
15
  HealthDiagnosticObservation,
15
16
  HealthRefreshState,
@@ -43,12 +44,10 @@ export interface ToolDisplaySection {
43
44
  key: string;
44
45
  title: string;
45
46
  lines: readonly string[];
46
- shownCount: number;
47
- totalCount: number | null;
48
- omittedCount: number | null;
49
- partialReason: string | null;
50
- /** Provider explanation for incomplete collection, when available. */
51
- partialMessage?: string;
47
+ /** Canonical Evidence list facts previewed by this section. */
48
+ evidence: EvidenceListFacts;
49
+ /** Rows hidden by the view cap; a Display omission, not an Evidence atom count. */
50
+ displayOmittedCount: number;
52
51
  /** Content counts are separate from canonical evidence when rows are grouped or framed. */
53
52
  preview?: {
54
53
  unit: "group" | "block";
@@ -143,7 +142,7 @@ export interface ResolveDetails {
143
142
  /** Strict provider kind that produced a near-match result. */
144
143
  requestedKind?: TargetSymbolKind;
145
144
  confidence: ConfidenceMode;
146
- /** Plain workflow failure message, present for invalid-input and unavailable results. */
145
+ /** Plain workflow message: the failure for invalid-input and unavailable, the selection reason for candidates. */
147
146
  message?: string;
148
147
  targetCount: number;
149
148
  omittedCount: number;
@@ -283,6 +282,8 @@ export interface HealthDetails {
283
282
  serverInventoryScope: "workspace";
284
283
  /** Diagnostic result scope and exact evidence boundary for this health call. */
285
284
  diagnosticObservation: HealthDiagnosticObservation;
285
+ /** Shared coverage classification of `diagnosticObservation`; null when not requested. */
286
+ diagnosticCoverage: DiagnosticCoverage | null;
286
287
  /** Current or most recent refresh, including typed maintenance scope and evidence. */
287
288
  refresh: HealthRefreshState;
288
289
  structuralAvailable: boolean;
@@ -4,40 +4,33 @@ import {
4
4
  type PublicRefactorOperationName,
5
5
  } from "../session/refactor-types.ts";
6
6
  import { TARGET_SYMBOL_KINDS } from "../session/target-input.ts";
7
+ import { CODE_FIND_AST_KINDS } from "./code_find/ast-kinds.ts";
7
8
 
8
9
  export const ScopeParam = Type.String({
9
10
  description: "Workspace-relative file or directory scope.",
10
11
  });
11
- export const FindScopeParam = Type.Array(
12
- Type.String({ description: "Workspace-relative search scope." }),
13
- {
14
- description: "One or more workspace-relative search scopes.",
15
- minItems: 1,
16
- },
17
- );
18
- const FileParam = Type.String({ description: "File path." });
12
+ export const FindScopesParam = Type.Array(Type.String(), {
13
+ description: "One or more workspace-relative search scopes.",
14
+ minItems: 1,
15
+ });
16
+ const FileParam = Type.String();
19
17
  export const QueryParam = Type.String({
20
18
  description: "Human or code reference to resolve or search for.",
21
19
  minLength: 1,
22
20
  });
23
- export const FindQueryParam = Type.String({
24
- description:
25
- "AST mode: name or import module-specifier substring. Semantic mode: workspace-symbol query.",
26
- minLength: 1,
27
- });
28
- const LineParam = Type.Integer({ description: "1-based line.", minimum: 1 });
29
- const CharacterParam = Type.Integer({
30
- description: "1-based UTF-16 column.",
31
- minimum: 1,
32
- });
21
+ const LineParam = Type.Integer({ minimum: 1 });
22
+ const CharacterParam = Type.Integer({ minimum: 1 });
33
23
  export const MaxResultsParam = Type.Integer({
34
24
  description: "Maximum displayed results.",
35
25
  minimum: 1,
36
26
  });
37
27
 
28
+ /** One home for the position convention; the leaf fields stay undescribed. */
29
+ const POSITION_DESCRIPTION = "1-based line and UTF-16 column.";
30
+
38
31
  export const SourcePointParam = Type.Object(
39
32
  { file: FileParam, line: LineParam, character: CharacterParam },
40
- { additionalProperties: false },
33
+ { additionalProperties: false, description: POSITION_DESCRIPTION },
41
34
  );
42
35
 
43
36
  const SymbolTargetParam = Type.Object(
@@ -51,10 +44,7 @@ const SymbolTargetParam = Type.Object(
51
44
  }),
52
45
  ),
53
46
  },
54
- {
55
- description: "Semantic symbol query.",
56
- additionalProperties: false,
57
- },
47
+ { additionalProperties: false },
58
48
  );
59
49
 
60
50
  /**
@@ -74,6 +64,29 @@ function exactOneSelector(properties: Record<string, TSchema>, description: stri
74
64
  });
75
65
  }
76
66
 
67
+ export const FindSearchParam = exactOneSelector(
68
+ {
69
+ ast: Type.Object(
70
+ {
71
+ kind: Type.Enum(CODE_FIND_AST_KINDS, {
72
+ type: "string",
73
+ description: "AST structure kind.",
74
+ }),
75
+ query: Type.String({
76
+ description: "Name or import module-specifier substring.",
77
+ minLength: 1,
78
+ }),
79
+ },
80
+ { additionalProperties: false, description: "Structural search over syntax trees." },
81
+ ),
82
+ semantic: Type.Object(
83
+ { query: Type.String({ description: "Workspace-symbol query.", minLength: 1 }) },
84
+ { additionalProperties: false, description: "Language-server workspace-symbol search." },
85
+ ),
86
+ },
87
+ "Exactly one search mode.",
88
+ );
89
+
77
90
  export const ResolveTargetParam = exactOneSelector(
78
91
  {
79
92
  anchor: SourcePointParam,
@@ -112,7 +125,7 @@ export const OrientationFocusParam = exactOneSelector(
112
125
  "Exactly one Orientation focus.",
113
126
  );
114
127
 
115
- export const RefactorTargetParam = exactOneSelector(
128
+ const RefactorTargetParam = exactOneSelector(
116
129
  {
117
130
  handle: Type.String({ description: "Target handle from a previous code tool result." }),
118
131
  anchor: SourcePointParam,
@@ -131,28 +144,53 @@ const RangeParam = Type.Object(
131
144
  { additionalProperties: false },
132
145
  ),
133
146
  },
134
- { additionalProperties: false },
147
+ {
148
+ additionalProperties: false,
149
+ description:
150
+ "Source range with 1-based lines and UTF-16 columns; end is exclusive. Equal start and end mark a cursor position.",
151
+ },
135
152
  );
136
153
 
137
- const NewNameParam = Type.String({ description: "New symbol name.", minLength: 1 });
154
+ const NewNameParam = Type.String({ minLength: 1 });
155
+ const ActionTitleParam = Type.String({
156
+ description:
157
+ "Exact action title from a previous ambiguous result; selects one of several matching actions.",
158
+ minLength: 1,
159
+ });
138
160
 
139
161
  const RefactorOperationProperties = {
140
- rename_symbol: Type.Object({ newName: NewNameParam }, { additionalProperties: false }),
141
- extract_function: Type.Object(
142
- { newName: NewNameParam, range: RangeParam },
143
- { additionalProperties: false },
144
- ),
145
- extract_variable: Type.Object(
146
- { newName: NewNameParam, range: RangeParam },
147
- { additionalProperties: false },
162
+ rename_symbol: Type.Object(
163
+ { target: RefactorTargetParam, newName: NewNameParam },
164
+ { additionalProperties: false, description: "Rename one symbol across the workspace." },
148
165
  ),
149
- update_imports: Type.Object({}, { additionalProperties: false }),
150
- delete_dead_code: Type.Object(
151
- {},
166
+ code_action: Type.Object(
167
+ {
168
+ file: FileParam,
169
+ range: RangeParam,
170
+ kind: Type.String({
171
+ description:
172
+ 'CodeActionKind prefix under "refactor", such as "refactor.extract" or "refactor.inline". Sub-kinds match.',
173
+ pattern: "^refactor(\\..+)?$",
174
+ }),
175
+ title: Type.Optional(ActionTitleParam),
176
+ },
152
177
  {
153
178
  additionalProperties: false,
154
- description: "Remove server-supported unused code; support may be limited to unused imports.",
179
+ description:
180
+ "Server refactor action for one range. Generated names (e.g. extracted variables) appear in the preview; rename them afterwards with rename_symbol.",
181
+ },
182
+ ),
183
+ source_action: Type.Object(
184
+ {
185
+ file: FileParam,
186
+ kind: Type.String({
187
+ description:
188
+ 'CodeActionKind prefix under "source", such as "source.organizeImports" or "source.fixAll". Sub-kinds match.',
189
+ pattern: "^source(\\..+)?$",
190
+ }),
191
+ title: Type.Optional(ActionTitleParam),
155
192
  },
193
+ { additionalProperties: false, description: "Server source action for one whole file." },
156
194
  ),
157
195
  } satisfies Record<PublicRefactorOperationName, TSchema>;
158
196
 
package/src/tool/specs.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ToolAnnotations } from "@earendil-works/pi-coding-agent";
1
2
  import type { Component } from "@earendil-works/pi-tui";
2
3
  import type { TSchema } from "typebox";
3
4
  import type {
@@ -27,6 +28,8 @@ export type CodeToolRendererFn = (...args: any[]) => Component;
27
28
  export interface CodeIntelligenceToolDefinitionSpec {
28
29
  name: CodeIntelligenceToolName;
29
30
  label: string;
31
+ /** Audited behavior hints for permission extensions (MCP tool-annotation semantics). */
32
+ annotations: ToolAnnotations;
30
33
  parameters: TSchema;
31
34
  /** Machine-readable success and recoverable-input outcomes for programmatic callers. */
32
35
  outputSchema?: TSchema;
package/src/ui/footer.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * LSP footer stats-end contribution for code-intelligence.
3
3
  *
4
- * Provides the persistent "| λ lsp • N ✓ • M open files" suffix on the
4
+ * Provides the persistent "λ lsp • N ✓ • M open files" suffix on the
5
5
  * footer stats line, after cost and context info. This was removed during the
6
6
  * supi-lsp → supi-code-intelligence migration.
7
7
  */
@@ -55,9 +55,7 @@ export function registerLspFooterContribution(
55
55
  placement: "stats-end",
56
56
  priority: 100,
57
57
  render: () => {
58
- const text = buildLspStatusText(lspState);
59
- if (!text) return "";
60
- return `| ${text}`;
58
+ return buildLspStatusText(lspState) ?? "";
61
59
  },
62
60
  });
63
61
 
@@ -618,7 +618,7 @@ export class CiStatusDialog {
618
618
  text(
619
619
  t.fg(
620
620
  "dim",
621
- ` ${operation}: server ${support.server}; SuPi ${support.supi}${support.reason ? ` — ${support.reason}` : ""}`,
621
+ ` ${operation}: server ${support.server}; SuPi ${support.supi}${support.kinds?.length ? `; kinds ${support.kinds.join(", ")}` : ""}${support.anyKind ? "; may return any kind" : ""}${support.reason ? ` — ${support.reason}` : ""}`,
622
622
  ),
623
623
  );
624
624
  }
@@ -1,5 +1,6 @@
1
1
  import { resolve } from "node:path";
2
2
  import type { DiagnosticEvidenceSummary } from "@mrclrchtr/supi-lsp/api";
3
+ import { classifyDiagnosticCoverage } from "../diagnostics/coverage.ts";
3
4
  import type {
4
5
  HealthDiagnosticObservation,
5
6
  HealthWorkflowOutcome,
@@ -21,16 +22,12 @@ export function presentDiagnosticEvidence(observation: HealthDiagnosticObservati
21
22
  return { summary: "Diagnostics not requested.", tone: "dim" };
22
23
  const evidence = observation.evidence;
23
24
  const counts = `${evidence.confirmed}/${evidence.requested} confirmed tracked files · ${evidence.unconfirmed} unconfirmed · ${evidence.failed} failed · ${evidence.removed} removed`;
25
+ const coverage = classifyDiagnosticCoverage(observation);
24
26
  if (observation.kind === "unavailable")
25
27
  return { counts, summary: `Diagnostics unavailable — ${observation.reason}`, tone: "warning" };
26
- if (evidence.requested === 0)
28
+ if (coverage === "none")
27
29
  return { counts, summary: "No tracked diagnostic evidence.", tone: "dim" };
28
- const confirmed =
29
- evidence.confirmed === evidence.requested &&
30
- evidence.unconfirmed === 0 &&
31
- evidence.failed === 0 &&
32
- evidence.removed === 0;
33
- if (!confirmed)
30
+ if (coverage === "incomplete")
34
31
  return {
35
32
  counts,
36
33
  summary: `Diagnostic evidence is incomplete${observation.kind === "partial" ? ` — ${observation.reason}` : "."}`,
@@ -2,10 +2,11 @@
2
2
  import type { Theme } from "@earendil-works/pi-coding-agent";
3
3
  import { type Component, Container, Spacer, Text } from "@earendil-works/pi-tui";
4
4
  import {
5
+ type CandidateSelectionKey,
5
6
  formatCandidateRow,
6
- formatPartialCandidateDisclosure,
7
- } from "../../tool/result/candidate-row.ts";
7
+ } from "../../tool/result/candidate-selection.ts";
8
8
  import {
9
+ describeDisplayOmission,
9
10
  MAX_TUI_DISPLAY_ITEMS,
10
11
  readToolDisplaySections,
11
12
  truncateDisplayText,
@@ -22,12 +23,6 @@ import {
22
23
  type ToolResult,
23
24
  } from "./common.ts";
24
25
 
25
- /** Display-section keys that identify candidate-selection results. */
26
- export type CandidateSelectionKey =
27
- | "graph.candidates"
28
- | "resolve.candidates"
29
- | "orientation.candidates";
30
-
31
26
  interface CandidateRow {
32
27
  targetId: string;
33
28
  name: string;
@@ -35,8 +30,6 @@ interface CandidateRow {
35
30
  file: string;
36
31
  line: number;
37
32
  character: number;
38
- rank: number;
39
- container: string | null;
40
33
  }
41
34
 
42
35
  interface CandidateSelectionData {
@@ -78,16 +71,17 @@ function readCandidateSelection(
78
71
 
79
72
  // A status or message alone is not a candidate-selection marker. Require a
80
73
  // candidate key or a structured candidate collection before changing views.
81
- if (!display && !evidence && !structuredCandidates) return null;
82
-
83
- const rows = candidateRowsFor(display, structuredCandidates, key);
84
- const selectionEvidence = candidateEvidenceFor({
85
- display,
86
- evidence,
87
- structuredCandidates,
88
- rows,
89
- key,
90
- });
74
+ // Older persisted entries keep their key but fail strict evidence parsing;
75
+ // they still select this view and use its bounded legacy body.
76
+ const keyed =
77
+ display ||
78
+ evidence ||
79
+ hasRawKey(result.details?.displaySections, key) ||
80
+ hasRawKey(data?.evidenceLists, key);
81
+ if (!keyed && !structuredCandidates) return null;
82
+
83
+ const rows = candidateRowsFor(display, structuredCandidates);
84
+ const selectionEvidence = candidateEvidenceFor({ display, evidence });
91
85
  const reason = selectionReason(result, data);
92
86
  const structuredGuidance = readStructuredNextQueries(data);
93
87
  const guidance = selectionGuidance(result, data, key);
@@ -110,57 +104,17 @@ function readCandidateSelection(
110
104
  function candidateRowsFor(
111
105
  display: ToolDisplaySection | null,
112
106
  structuredCandidates: CandidateRow[] | null,
113
- key: CandidateSelectionKey,
114
107
  ): string[] {
115
108
  if (display?.lines.length) return [...display.lines];
116
- return (structuredCandidates ?? []).map((candidate, index) =>
117
- formatCandidateRow(
118
- candidate,
119
- key === "graph.candidates" ? "handle-first" : "rank-first",
120
- index + 1,
121
- ),
122
- );
109
+ return (structuredCandidates ?? []).map((candidate) => formatCandidateRow(candidate));
123
110
  }
124
111
 
112
+ /** Prefer canonical details evidence; a display section carries the same facts. */
125
113
  function candidateEvidenceFor(input: {
126
114
  display: ToolDisplaySection | null;
127
115
  evidence: EvidenceEntry | null;
128
- structuredCandidates: CandidateRow[] | null;
129
- rows: string[];
130
- key: CandidateSelectionKey;
131
116
  }): EvidenceEntry | null {
132
- if (input.display?.lines.length) return displayEvidence(input.display, input.key);
133
- if (input.evidence && input.structuredCandidates?.length) {
134
- return evidenceForRows(input.evidence, input.rows.length);
135
- }
136
- if (input.display) return displayEvidence(input.display, input.key);
137
- return input.evidence;
138
- }
139
-
140
- function displayEvidence(display: ToolDisplaySection, key: CandidateSelectionKey): EvidenceEntry {
141
- const shownCount = display.lines.length;
142
- return {
143
- key,
144
- shownCount,
145
- totalCount: display.totalCount,
146
- omittedCount:
147
- display.totalCount === null
148
- ? unknownOmittedCount(display.omittedCount, Math.max(0, display.shownCount - shownCount))
149
- : Math.max(0, display.totalCount - shownCount),
150
- partialReason: display.partialReason,
151
- partialMessage: display.partialMessage,
152
- };
153
- }
154
-
155
- function evidenceForRows(evidence: EvidenceEntry, shownCount: number): EvidenceEntry {
156
- return {
157
- ...evidence,
158
- shownCount,
159
- omittedCount:
160
- evidence.totalCount === null
161
- ? unknownOmittedCount(evidence.omittedCount, Math.max(0, evidence.shownCount - shownCount))
162
- : Math.max(0, evidence.totalCount - shownCount),
163
- };
117
+ return input.evidence ?? input.display?.evidence ?? null;
164
118
  }
165
119
 
166
120
  function readCandidateRows(value: unknown): CandidateRow[] | null {
@@ -169,6 +123,7 @@ function readCandidateRows(value: unknown): CandidateRow[] | null {
169
123
  return rows.every((row): row is CandidateRow => row !== null) ? rows : null;
170
124
  }
171
125
 
126
+ /** Rejects malformed persisted rows, including invalid optional rank and container. */
172
127
  function readCandidateRow(value: unknown): CandidateRow | null {
173
128
  const record = asRecord(value);
174
129
  if (
@@ -192,8 +147,6 @@ function readCandidateRow(value: unknown): CandidateRow | null {
192
147
  file: record.file,
193
148
  line: record.line,
194
149
  character: record.character,
195
- rank: isCount(record.rank) ? record.rank : 0,
196
- container: typeof record.container === "string" ? record.container : null,
197
150
  };
198
151
  }
199
152
 
@@ -278,14 +231,14 @@ class CandidateSelectionComponent implements Component {
278
231
  invalidate(): void {}
279
232
 
280
233
  private renderCollapsed(container: Container, width: number): string[] {
281
- const disclosure = this.selection.evidence
282
- ? formatPartialCandidateDisclosure(this.selection.evidence)
283
- : null;
284
- if (disclosure) {
285
- container.addChild(new BoundedCandidateDisclosure(disclosure, false, this.theme));
286
- } else if (this.selection.evidence) {
287
- const summary = formatEvidenceEntry(this.selection.evidence);
288
- container.addChild(new Text(this.theme.fg("muted", summary), 0, 0));
234
+ if (this.selection.evidence) {
235
+ container.addChild(
236
+ new BoundedCandidateDisclosure(
237
+ formatEvidenceEntry(this.selection.evidence),
238
+ false,
239
+ this.theme,
240
+ ),
241
+ );
289
242
  }
290
243
  this.appendTruncation(container);
291
244
  return this.renderContainer(container, width);
@@ -316,16 +269,15 @@ class CandidateSelectionComponent implements Component {
316
269
  private appendStructuredSelection(container: Container): void {
317
270
  container.addChild(new Spacer(1));
318
271
  const title = this.selection.display?.title ?? "Candidates";
319
- const disclosure = this.selection.evidence
320
- ? formatPartialCandidateDisclosure(this.selection.evidence)
321
- : null;
322
- const bounds =
323
- !disclosure && this.selection.evidence ? formatSectionBounds(this.selection.evidence) : "";
324
- container.addChild(
325
- new Text(this.theme.fg("dim", `${title}${bounds ? ` (${bounds})` : ""}`), 0, 0),
326
- );
327
- if (disclosure) {
328
- container.addChild(new BoundedCandidateDisclosure(disclosure, true, this.theme));
272
+ container.addChild(new Text(this.theme.fg("dim", title), 0, 0));
273
+ if (this.selection.evidence) {
274
+ container.addChild(
275
+ new BoundedCandidateDisclosure(
276
+ `${formatEvidenceEntry(this.selection.evidence)}${hiddenRows(this.selection.display)}`,
277
+ true,
278
+ this.theme,
279
+ ),
280
+ );
329
281
  }
330
282
  for (const row of this.selection.rows) {
331
283
  container.addChild(new Text(this.theme.fg("muted", row), 0, 0));
@@ -350,20 +302,13 @@ class CandidateSelectionComponent implements Component {
350
302
  }
351
303
  }
352
304
 
353
- function formatSectionBounds(entry: EvidenceEntry): string {
354
- if (entry.totalCount === null) {
355
- const omitted = entry.omittedCount ? `; ${entry.omittedCount} collected omitted` : "";
356
- const reason = entry.partialReason ? `; more may exist — ${entry.partialReason}` : "; partial";
357
- return `${entry.shownCount}${omitted}${reason}`;
358
- }
359
- if (entry.omittedCount)
360
- return `${entry.shownCount} of ${entry.totalCount}; ${entry.omittedCount} omitted`;
361
- return `${entry.totalCount}`;
305
+ function hiddenRows(display: ToolDisplaySection | null): string {
306
+ const phrase = describeDisplayOmission(display?.displayOmittedCount ?? 0);
307
+ return phrase ? `; ${phrase}` : "";
362
308
  }
363
309
 
364
- function unknownOmittedCount(base: number | null, additional: number): number | null {
365
- const omitted = (base ?? 0) + additional;
366
- return base !== null || omitted > 0 ? omitted : null;
310
+ function hasRawKey(value: unknown, key: CandidateSelectionKey): boolean {
311
+ return Array.isArray(value) && value.some((entry) => asRecord(entry)?.key === key);
367
312
  }
368
313
 
369
314
  function asRecord(value: unknown): Record<string, unknown> | null {
@@ -9,7 +9,11 @@ import {
9
9
  type ToolRenderResultOptions,
10
10
  } from "@earendil-works/pi-coding-agent";
11
11
  import { type Component, Container, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
12
- import { formatEvidenceBadge } from "@mrclrchtr/supi-core/evidence-badge";
12
+ import {
13
+ describeEvidenceList,
14
+ type EvidenceListFacts,
15
+ readEvidenceListFacts,
16
+ } from "../../analysis/evidence.ts";
13
17
  import { truncateDisplayText } from "../../tool/result/display.ts";
14
18
  import { renderToolDisplaySections } from "./display.ts";
15
19
  import { renderExecutionError } from "./execution-error.ts";
@@ -72,86 +76,26 @@ export function evidenceLabel(key: string): string {
72
76
 
73
77
  // ── Serialized evidence ──────────────────────────────────────────
74
78
 
75
- /** Evidence metadata projected by result assembly into tool details. */
76
- export interface EvidenceEntry {
77
- key: string;
78
- shownCount: number;
79
- totalCount: number | null;
80
- omittedCount: number | null;
81
- partialReason: string | null;
82
- /** Provider explanation for incomplete collection, when available. */
83
- partialMessage?: string;
84
- invalidLocationCount?: number;
85
- }
79
+ /** Evidence list facts projected by result assembly into tool details. */
80
+ export type EvidenceEntry = EvidenceListFacts;
86
81
 
87
82
  /**
88
- * Read only complete serialized evidence metadata from tool details.
89
- *
90
- * Renderers intentionally discard malformed or absent entries rather than
91
- * reconstructing totals from candidate counts or omission hints.
83
+ * Read only complete, consistent serialized evidence facts from tool details.
84
+ * Renderers discard malformed entries rather than reconstructing totals.
92
85
  */
93
86
  export function readEvidenceEntries(value: unknown): EvidenceEntry[] {
94
87
  if (!Array.isArray(value)) return [];
95
88
  return value.flatMap((entry) => {
96
- const parsed = readEvidenceEntry(entry);
89
+ const parsed = readEvidenceListFacts(entry);
97
90
  return parsed ? [parsed] : [];
98
91
  });
99
92
  }
100
93
 
101
- function readEvidenceEntry(value: unknown): EvidenceEntry | null {
102
- if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
103
- const record = value as Record<string, unknown>;
104
- const { key, shownCount, totalCount, omittedCount, partialReason, invalidLocationCount } = record;
105
- if (
106
- typeof key !== "string" ||
107
- typeof shownCount !== "number" ||
108
- !isNullableNumber(totalCount) ||
109
- !isNullableNumber(omittedCount) ||
110
- !isNullableString(partialReason) ||
111
- !isOptionalCount(invalidLocationCount)
112
- ) {
113
- return null;
114
- }
115
- return {
116
- key,
117
- shownCount,
118
- totalCount,
119
- omittedCount,
120
- partialReason,
121
- ...(typeof record.partialMessage === "string" ? { partialMessage: record.partialMessage } : {}),
122
- ...(invalidLocationCount === undefined ? {} : { invalidLocationCount }),
123
- };
124
- }
125
-
126
- function isNullableNumber(value: unknown): value is number | null {
127
- return value === null || typeof value === "number";
128
- }
129
-
130
- function isNullableString(value: unknown): value is string | null {
131
- return value === null || typeof value === "string";
132
- }
133
-
134
- function isOptionalCount(value: unknown): value is number | undefined {
135
- return (
136
- value === undefined || (typeof value === "number" && Number.isInteger(value) && value >= 0)
137
- );
138
- }
139
-
140
- /** Format one assembled evidence list without recomputing its bounds. */
94
+ /** Format one assembled evidence list with the canonical phrase and its label. */
141
95
  export function formatEvidenceEntry(entry: EvidenceEntry): string {
142
96
  const label = evidenceLabel(entry.key);
143
- const singleCandidate = label === "candidates" && (entry.totalCount ?? entry.shownCount) === 1;
144
- const badge = formatEvidenceBadge({
145
- shownCount: entry.shownCount,
146
- totalCount: entry.totalCount,
147
- omittedCount: entry.omittedCount,
148
- partialReason: entry.partialReason,
149
- label: singleCandidate ? "candidate" : label,
150
- });
151
- if (!entry.invalidLocationCount) return badge;
152
- const noun = entry.invalidLocationCount === 1 ? "location" : "locations";
153
- const reason = entry.partialReason ? ` — ${entry.partialReason}` : "";
154
- return `${badge}; ${entry.invalidLocationCount} invalid provider ${noun} omitted${reason}`;
97
+ const singular = label === "candidates" ? "candidate" : label;
98
+ return describeEvidenceList(entry, { one: singular, other: label });
155
99
  }
156
100
 
157
101
  /** Append formatted evidence badge lines to a container. */
@@ -173,7 +117,9 @@ export function renderMarkdownDetail(
173
117
  source: MarkdownSource,
174
118
  theme: Theme,
175
119
  ): void {
176
- const markdownText = source.content?.find((c) => c.type === "text")?.text ?? "";
120
+ // Persisted content can hold malformed blocks; skip anything that is not a text block.
121
+ const block = source.content?.find((c) => c?.type === "text" && typeof c.text === "string");
122
+ const markdownText = block?.text ?? "";
177
123
  if (!markdownText) return;
178
124
  container.addChild(new Spacer(1));
179
125
  const divider = `${theme.fg("border", "────")} ${theme.fg("dim", "raw markdown")} ${theme.fg("border", "────")}`;