@mrclrchtr/supi-code-intelligence 12.0.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 (268) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +4 -2
  3. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  5. package/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  6. package/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  7. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
  8. package/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  9. package/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
  10. package/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  11. package/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  12. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  13. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  14. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  15. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  21. package/node_modules/@mrclrchtr/supi-lsp/package.json +8 -8
  22. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +1 -0
  23. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +102 -47
  24. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +8 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +15 -1
  26. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +1 -1
  27. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +46 -4
  28. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-disk-stamp.ts +60 -0
  29. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +3 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +21 -1
  31. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +17 -3
  32. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +53 -4
  33. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +11 -3
  34. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +2 -1
  35. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +2 -2
  36. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +14 -5
  37. package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-module.ts +17 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +42 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +2 -17
  40. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-removal-ledger.ts +52 -0
  41. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +40 -20
  42. package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +6 -1
  43. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +6 -1
  44. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +13 -3
  45. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +11 -0
  46. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +1 -0
  47. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +17 -2
  48. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +11 -1
  49. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +2 -0
  50. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  51. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  52. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  53. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  54. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
  55. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  56. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
  57. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  58. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  59. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +50 -75
  60. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +2 -2
  61. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +50 -75
  62. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +2 -2
  63. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
  64. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +6 -6
  65. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
  66. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +50 -75
  67. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +2 -2
  68. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +7 -7
  69. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
  70. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +7 -7
  71. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
  72. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +50 -75
  73. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +2 -2
  74. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
  75. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +5 -5
  76. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -5
  77. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +1 -1
  78. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/latex/tree-sitter-latex.wasm.json +1 -1
  79. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +1 -1
  80. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +1 -1
  81. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +1 -1
  82. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +1 -1
  83. package/node_modules/fast-xml-parser/CHANGELOG.md +886 -0
  84. package/node_modules/fast-xml-parser/LICENSE +21 -0
  85. package/node_modules/fast-xml-parser/README.md +204 -0
  86. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
  87. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
  88. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
  89. package/node_modules/fast-xml-parser/lib/fxp.d.cts +774 -0
  90. package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
  91. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
  92. package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
  93. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
  94. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
  95. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
  96. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/README.md +92 -0
  97. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/package.json +57 -0
  98. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityDecoder.js +644 -0
  99. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityEncoder.js +239 -0
  100. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/all-entities.js +53 -0
  101. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entities.js +1139 -0
  102. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entityTries.js +60 -0
  103. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.d.ts +358 -0
  104. package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.js +29 -0
  105. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/CHANGELOG.md +52 -0
  106. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/LICENSE +21 -0
  107. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/README.md +77 -0
  108. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
  109. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
  110. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
  111. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
  112. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/package.json +77 -0
  113. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
  114. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.js +609 -0
  115. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
  116. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/orderedJs2Xml.js +360 -0
  117. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/prettifyJs2Xml.js +0 -0
  118. package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/util.js +23 -0
  119. package/node_modules/fast-xml-parser/node_modules/is-unsafe/LICENSE +21 -0
  120. package/node_modules/fast-xml-parser/node_modules/is-unsafe/README.md +632 -0
  121. package/node_modules/fast-xml-parser/node_modules/is-unsafe/package.json +56 -0
  122. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/html.js +102 -0
  123. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/log.js +98 -0
  124. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/nosql.js +114 -0
  125. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/redos.js +60 -0
  126. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/shell.js +105 -0
  127. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql-strict.js +47 -0
  128. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql.js +95 -0
  129. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/svg.js +81 -0
  130. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/xml.js +79 -0
  131. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.cjs +27 -0
  132. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.d.ts +103 -0
  133. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.js +292 -0
  134. package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/util/decode-entities.js +48 -0
  135. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/LICENSE +21 -0
  136. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/README.md +947 -0
  137. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
  138. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.d.cts +725 -0
  139. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
  140. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
  141. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/package.json +79 -0
  142. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Expression.js +232 -0
  143. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/ExpressionSet.js +225 -0
  144. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Matcher.js +663 -0
  145. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.d.ts +589 -0
  146. package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.js +30 -0
  147. package/node_modules/fast-xml-parser/node_modules/strnum/CHANGELOG.md +63 -0
  148. package/node_modules/fast-xml-parser/node_modules/strnum/LICENSE +21 -0
  149. package/node_modules/fast-xml-parser/node_modules/strnum/README.md +113 -0
  150. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/LICENSE +21 -0
  151. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/README.md +142 -0
  152. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/anynum.js +135 -0
  153. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/digitTable.js +116 -0
  154. package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/package.json +42 -0
  155. package/node_modules/fast-xml-parser/node_modules/strnum/package.json +36 -0
  156. package/node_modules/fast-xml-parser/node_modules/strnum/strnum.js +176 -0
  157. package/node_modules/fast-xml-parser/node_modules/xml-naming/LICENSE +21 -0
  158. package/node_modules/fast-xml-parser/node_modules/xml-naming/README.md +287 -0
  159. package/node_modules/fast-xml-parser/node_modules/xml-naming/package.json +56 -0
  160. package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.d.ts +108 -0
  161. package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.js +382 -0
  162. package/node_modules/fast-xml-parser/package.json +93 -0
  163. package/node_modules/fast-xml-parser/src/cli/cli.js +97 -0
  164. package/node_modules/fast-xml-parser/src/cli/man.js +17 -0
  165. package/node_modules/fast-xml-parser/src/cli/read.js +43 -0
  166. package/node_modules/fast-xml-parser/src/fxp.d.ts +754 -0
  167. package/node_modules/fast-xml-parser/src/fxp.js +14 -0
  168. package/node_modules/fast-xml-parser/src/ignoreAttributes.js +18 -0
  169. package/node_modules/fast-xml-parser/src/util.js +61 -0
  170. package/node_modules/fast-xml-parser/src/v6/CharsSymbol.js +16 -0
  171. package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +106 -0
  172. package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +61 -0
  173. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +69 -0
  174. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +103 -0
  175. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +100 -0
  176. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +154 -0
  177. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +94 -0
  178. package/node_modules/fast-xml-parser/src/v6/Report.js +0 -0
  179. package/node_modules/fast-xml-parser/src/v6/TagPath.js +81 -0
  180. package/node_modules/fast-xml-parser/src/v6/TagPathMatcher.js +13 -0
  181. package/node_modules/fast-xml-parser/src/v6/XMLParser.js +83 -0
  182. package/node_modules/fast-xml-parser/src/v6/Xml2JsParser.js +235 -0
  183. package/node_modules/fast-xml-parser/src/v6/XmlPartReader.js +210 -0
  184. package/node_modules/fast-xml-parser/src/v6/XmlSpecialTagsReader.js +111 -0
  185. package/node_modules/fast-xml-parser/src/v6/inputSource/BufferSource.js +116 -0
  186. package/node_modules/fast-xml-parser/src/v6/inputSource/StringSource.js +121 -0
  187. package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +105 -0
  188. package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParser.js +22 -0
  189. package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParserExt.js +19 -0
  190. package/node_modules/fast-xml-parser/src/v6/valueParsers/currency.js +38 -0
  191. package/node_modules/fast-xml-parser/src/v6/valueParsers/join.js +13 -0
  192. package/node_modules/fast-xml-parser/src/v6/valueParsers/number.js +14 -0
  193. package/node_modules/fast-xml-parser/src/v6/valueParsers/trim.js +6 -0
  194. package/node_modules/fast-xml-parser/src/validator.js +518 -0
  195. package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +6 -0
  196. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +426 -0
  197. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +164 -0
  198. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +907 -0
  199. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +77 -0
  200. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +177 -0
  201. package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +54 -0
  202. package/package.json +10 -8
  203. package/src/analysis/evidence.ts +331 -73
  204. package/src/analysis/health/diagnostics.ts +66 -18
  205. package/src/analysis/health/evidence-reason.ts +44 -0
  206. package/src/analysis/search/pattern.ts +3 -3
  207. package/src/analysis/target/anchored.ts +3 -6
  208. package/src/analysis/target/symbol.ts +41 -47
  209. package/src/analysis/target/types.ts +4 -9
  210. package/src/analysis/workspace/cmake-parser.ts +207 -0
  211. package/src/analysis/workspace/cmake.ts +141 -0
  212. package/src/analysis/workspace/maven.ts +310 -0
  213. package/src/analysis/workspace/membership.ts +100 -26
  214. package/src/analysis/workspace/metadata.ts +6 -1
  215. package/src/analysis/workspace/observe.ts +6 -0
  216. package/src/analysis/workspace/types.ts +11 -3
  217. package/src/diagnostics/coverage.ts +49 -0
  218. package/src/diagnostics/evidence.ts +10 -2
  219. package/src/session/health-workflow.ts +6 -0
  220. package/src/session/input/common.ts +1 -1
  221. package/src/session/orientation/collect.ts +42 -7
  222. package/src/session/orientation/context-facts.ts +3 -3
  223. package/src/session/orientation/context-sections.ts +13 -15
  224. package/src/session/orientation/facts.ts +5 -8
  225. package/src/session/orientation-workflow.ts +4 -19
  226. package/src/session/target-workflow.ts +25 -18
  227. package/src/tool/code_find/result.ts +5 -7
  228. package/src/tool/code_graph/display.ts +5 -6
  229. package/src/tool/code_graph/format.ts +8 -24
  230. package/src/tool/code_graph/result.ts +16 -75
  231. package/src/tool/code_graph/section.ts +21 -33
  232. package/src/tool/code_graph/tui.ts +10 -5
  233. package/src/tool/code_health/diagnostic-tui.ts +49 -0
  234. package/src/tool/code_health/guidance.ts +27 -0
  235. package/src/tool/code_health/markdown.ts +60 -8
  236. package/src/tool/code_health/result.ts +20 -9
  237. package/src/tool/code_health/structured-schema.ts +14 -0
  238. package/src/tool/code_health/structured.ts +7 -1
  239. package/src/tool/code_health/tui.ts +33 -40
  240. package/src/tool/code_inspect/result.ts +23 -18
  241. package/src/tool/code_inspect/structured.ts +2 -19
  242. package/src/tool/code_orientation/result.ts +53 -100
  243. package/src/tool/code_orientation/structured-schema.ts +16 -12
  244. package/src/tool/code_orientation/structured-workspace.ts +13 -7
  245. package/src/tool/code_orientation/structured.ts +31 -39
  246. package/src/tool/code_orientation/workspace-format.ts +4 -10
  247. package/src/tool/code_orientation/workspace-instructions.ts +4 -5
  248. package/src/tool/code_orientation/workspace-observations.ts +2 -2
  249. package/src/tool/code_orientation/workspace-output.ts +16 -7
  250. package/src/tool/code_orientation/workspace-projects.ts +7 -10
  251. package/src/tool/code_orientation/workspace-sections.ts +13 -19
  252. package/src/tool/code_resolve/markdown.ts +4 -46
  253. package/src/tool/code_resolve/result.ts +43 -72
  254. package/src/tool/infra/truncate.ts +2 -16
  255. package/src/tool/result/candidate-selection.ts +141 -0
  256. package/src/tool/result/display.ts +41 -45
  257. package/src/tool/result/errors.ts +1 -0
  258. package/src/tool/result/model-budget.ts +26 -1
  259. package/src/tool/result/refactor.ts +11 -8
  260. package/src/tool/result/structured.ts +2 -1
  261. package/src/tool/result/types.ts +9 -8
  262. package/src/tool/schemas.ts +15 -20
  263. package/src/ui/footer.ts +2 -4
  264. package/src/ui/status-presentation.ts +4 -7
  265. package/src/ui/tui/candidate-selection.ts +40 -95
  266. package/src/ui/tui/common.ts +16 -70
  267. package/src/ui/tui/display.ts +6 -24
  268. package/src/tool/result/candidate-row.ts +0 -49
@@ -173,7 +173,7 @@ export function parseTargetInput(
173
173
  "A target selector must contain exactly one of `handle`, `anchor`, `symbol`, or `file`.",
174
174
  );
175
175
  }
176
- const branch = selected[0];
176
+ const branch: TargetBranch = selected[0];
177
177
  if (!allowed.includes(branch)) return invalid(`This workflow does not support target.${branch}.`);
178
178
 
179
179
  switch (branch) {
@@ -9,6 +9,7 @@ import {
9
9
  createEvidenceList,
10
10
  createPartialEvidenceList,
11
11
  type EvidenceListMetadata,
12
+ toEvidenceListFacts,
12
13
  } from "../../analysis/evidence.ts";
13
14
  import {
14
15
  type ReadNextItem,
@@ -237,19 +238,34 @@ function targetContextFacts(
237
238
  : { file: toDisplayPath(cwd, uri) }),
238
239
  range: publicRange(range),
239
240
  })),
240
- collectedCount: treeContext.definition.length,
241
- omittedCount: Math.max(0, treeContext.definition.length - limit),
241
+ evidence: sourceEvidence(
242
+ "context.definitions",
243
+ treeContext.operations.definition,
244
+ treeContext.definition,
245
+ limit,
246
+ ),
242
247
  }
243
248
  : {}),
244
249
  },
245
250
  sourceContext: {
246
- outline: sourceSelection(treeContext.operations.outline, treeContext.outline, limit),
251
+ outline: sourceSelection(
252
+ "context.outline",
253
+ treeContext.operations.outline,
254
+ treeContext.outline,
255
+ limit,
256
+ ),
247
257
  imports: sourceSelection(
258
+ "context.imports",
248
259
  treeContext.operations.imports,
249
260
  treeContext.imports.map(({ moduleSpecifier }) => ({ moduleSpecifier })),
250
261
  limit,
251
262
  ),
252
- exports: sourceSelection(treeContext.operations.exports, treeContext.exports, limit),
263
+ exports: sourceSelection(
264
+ "context.exports",
265
+ treeContext.operations.exports,
266
+ treeContext.exports,
267
+ limit,
268
+ ),
253
269
  },
254
270
  }
255
271
  : {};
@@ -675,8 +691,9 @@ function publicRange(range: SourceRange): SourceRange {
675
691
  };
676
692
  }
677
693
 
678
- /** These best-effort lists preserve availability separately from collected counts. */
694
+ /** These best-effort lists preserve availability separately from their Evidence list. */
679
695
  function sourceSelection<T>(
696
+ key: string,
680
697
  status: { status: "complete" | "partial" | "unavailable"; reason: string | null },
681
698
  entries: readonly T[],
682
699
  limit: number,
@@ -684,11 +701,29 @@ function sourceSelection<T>(
684
701
  return {
685
702
  ...status,
686
703
  entries: entries.slice(0, limit),
687
- collectedCount: entries.length,
688
- omittedCount: Math.max(0, entries.length - limit),
704
+ evidence: sourceEvidence(key, status, entries, limit),
689
705
  };
690
706
  }
691
707
 
708
+ /** A partial observation counts its collected atoms; more may exist. */
709
+ function sourceEvidence<T>(
710
+ key: string,
711
+ status: { status: string; reason: string | null },
712
+ entries: readonly T[],
713
+ limit: number,
714
+ ) {
715
+ const params = { key, items: entries, maxResults: limit };
716
+ return toEvidenceListFacts(
717
+ status.status === "complete"
718
+ ? createEvidenceList(params).metadata
719
+ : createPartialEvidenceList({
720
+ ...params,
721
+ partialReason: "provider-limited",
722
+ ...(status.reason ? { partialMessage: status.reason } : {}),
723
+ }).metadata,
724
+ );
725
+ }
726
+
692
727
  function uniqueRecoveryRanges(
693
728
  recovery: readonly { errorRanges: readonly SourceRange[] }[],
694
729
  ): SourceRange[] {
@@ -9,7 +9,7 @@ import type {
9
9
  ModuleInfo,
10
10
  } from "../../analysis/architecture/model.ts";
11
11
  import { findModuleForPath } from "../../analysis/architecture/model.ts";
12
- import type { EvidencePartialReason } from "../../analysis/evidence.ts";
12
+ import type { CollectionPartialReason } from "../../analysis/evidence.ts";
13
13
  import type { CodeProvider } from "../../analysis/provider.ts";
14
14
  import type { OrientationProvenance, OrientationResultData } from "../orientation-types.ts";
15
15
  import {
@@ -290,7 +290,7 @@ function appendRelationshipFacts(
290
290
  edges: readonly DependencyEdge[];
291
291
  status: "complete" | "partial" | "unavailable";
292
292
  reason: string | null;
293
- partialReason: EvidencePartialReason | undefined;
293
+ partialReason: CollectionPartialReason | undefined;
294
294
  },
295
295
  ): void {
296
296
  if (input.status === "unavailable") return;
@@ -318,7 +318,7 @@ function appendRelationshipFacts(
318
318
  });
319
319
  }
320
320
 
321
- function topologyPartialReason(model: ArchitectureModel): EvidencePartialReason | undefined {
321
+ function topologyPartialReason(model: ArchitectureModel): CollectionPartialReason | undefined {
322
322
  if (model.topology.status !== "partial") return undefined;
323
323
  return model.topology.failedPackageManifestCount > 0 ? "filesystem-error" : "configuration-error";
324
324
  }
@@ -9,8 +9,11 @@ import {
9
9
  } from "@mrclrchtr/supi-code-runtime/api";
10
10
  import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
11
11
  import type { WorkspaceLspRuntimeState } from "@mrclrchtr/supi-lsp/api";
12
- import type { EvidenceListMetadata, EvidencePartialReason } from "../../analysis/evidence.ts";
13
- import { createEvidenceList } from "../../analysis/evidence.ts";
12
+ import {
13
+ type CollectionPartialReason,
14
+ createEvidenceList,
15
+ createPartialEvidenceList,
16
+ } from "../../analysis/evidence.ts";
14
17
  import type { CodeProvider } from "../../analysis/provider.ts";
15
18
  import { toDisplayPath } from "../../analysis/search/paths.ts";
16
19
  import type {
@@ -38,7 +41,7 @@ export interface ListSectionInput<T> {
38
41
  readonly status?: "complete" | "partial";
39
42
  readonly reason?: string | null;
40
43
  readonly unknownRemainder?: boolean;
41
- readonly partialReason?: EvidencePartialReason;
44
+ readonly partialReason?: CollectionPartialReason;
42
45
  readonly errorRanges?: readonly SourceRange[];
43
46
  readonly facts?: (items: readonly T[]) => import("./facts.ts").OrientationFacts;
44
47
  }
@@ -58,19 +61,14 @@ export function appendList<T>(
58
61
  builder: ContextOrientationBuilder,
59
62
  input: ListSectionInput<T>,
60
63
  ): void {
61
- const list = createEvidenceList({
62
- key: input.key,
63
- items: [...input.items],
64
- maxResults: builder.maxResults,
65
- });
66
- const metadata: EvidenceListMetadata = input.unknownRemainder
67
- ? {
68
- ...list.metadata,
69
- totalCount: null,
64
+ const params = { key: input.key, items: [...input.items], maxResults: builder.maxResults };
65
+ const list = input.unknownRemainder
66
+ ? createPartialEvidenceList({
67
+ ...params,
70
68
  partialReason: input.partialReason ?? "filesystem-error",
71
69
  ...(input.reason ? { partialMessage: input.reason } : {}),
72
- }
73
- : list.metadata;
70
+ })
71
+ : createEvidenceList(params);
74
72
  builder.sections.push({
75
73
  key: input.key,
76
74
  title: input.title,
@@ -78,7 +76,7 @@ export function appendList<T>(
78
76
  reason: input.reason ?? null,
79
77
  confidence: input.confidence,
80
78
  provenance: input.provenance,
81
- evidenceLists: [{ ...metadata, key: input.key }],
79
+ evidenceLists: [list.metadata],
82
80
  items: list.items.map((item) => ({ kind: "list-item", text: input.render(item) })),
83
81
  ...(input.facts ? { facts: input.facts(list.items) } : {}),
84
82
  ...(input.errorRanges ? { errorRanges: [...input.errorRanges] } : {}),
@@ -1,4 +1,5 @@
1
1
  import type { SourceRange } from "@mrclrchtr/supi-code-runtime/api";
2
+ import type { EvidenceListFacts } from "../../analysis/evidence.ts";
2
3
 
3
4
  /** Named, selected observations retained independently of their text rendering. */
4
5
  export interface OrientationFacts {
@@ -84,8 +85,7 @@ export interface OrientationFacts {
84
85
  readonly reason: string;
85
86
  }
86
87
  )[];
87
- readonly collectedCount?: number;
88
- readonly omittedCount?: number;
88
+ readonly evidence?: EvidenceListFacts;
89
89
  };
90
90
  readonly recovery?: readonly {
91
91
  readonly operation: string;
@@ -103,22 +103,19 @@ export interface OrientationFacts {
103
103
  readonly startLine: number;
104
104
  readonly endLine: number;
105
105
  }[];
106
- readonly collectedCount: number;
107
- readonly omittedCount: number;
106
+ readonly evidence: EvidenceListFacts;
108
107
  };
109
108
  readonly imports: {
110
109
  readonly status: "complete" | "partial" | "unavailable";
111
110
  readonly reason: string | null;
112
111
  readonly entries: readonly { readonly moduleSpecifier: string }[];
113
- readonly collectedCount: number;
114
- readonly omittedCount: number;
112
+ readonly evidence: EvidenceListFacts;
115
113
  };
116
114
  readonly exports: {
117
115
  readonly status: "complete" | "partial" | "unavailable";
118
116
  readonly reason: string | null;
119
117
  readonly entries: readonly { readonly name: string; readonly kind: string }[];
120
- readonly collectedCount: number;
121
- readonly omittedCount: number;
118
+ readonly evidence: EvidenceListFacts;
122
119
  };
123
120
  };
124
121
  readonly documentation?: readonly string[];
@@ -3,6 +3,7 @@
3
3
  import { existsSync, statSync } from "node:fs";
4
4
  import { buildArchitectureModel } from "../analysis/architecture/discovery.ts";
5
5
  import type { ArchitectureModel } from "../analysis/architecture/model.ts";
6
+ import { createEvidenceList } from "../analysis/evidence.ts";
6
7
  import {
7
8
  collectInstructionFiles,
8
9
  findInstructionFilesForDirectory,
@@ -148,19 +149,9 @@ async function orientTarget(options: {
148
149
  kind: "kind-mismatch",
149
150
  requestedKind: target.requestedKind,
150
151
  candidates,
151
- totalCount: target.totalCount,
152
- omittedCount: target.omittedCount,
153
- partialReason: target.partialReason,
154
- partialMessage: target.partialMessage,
152
+ candidateEvidence: target.candidateEvidence,
155
153
  }
156
- : {
157
- kind: "disambiguation",
158
- candidates,
159
- totalCount: target.totalCount,
160
- omittedCount: target.omittedCount,
161
- partialReason: target.partialReason,
162
- partialMessage: target.partialMessage,
163
- };
154
+ : { kind: "disambiguation", candidates, candidateEvidence: target.candidateEvidence };
164
155
  }
165
156
  if (target.kind !== "resolved") return target;
166
157
  throwIfAborted(control);
@@ -280,13 +271,7 @@ function addInstructionFiles(
280
271
  confidence: "unavailable",
281
272
  provenance: [{ source: "filesystem", detail: "configured instruction files" }],
282
273
  evidenceLists: [
283
- {
284
- key: "instructions.files",
285
- totalCount: collected.files.length,
286
- shownCount: collected.files.length,
287
- omittedCount: 0,
288
- partialReason: null,
289
- },
274
+ createEvidenceList({ key: "instructions.files", items: collected.files }).metadata,
290
275
  ],
291
276
  items,
292
277
  };
@@ -7,6 +7,11 @@
7
7
  // biome-ignore lint/style/noExcessiveLinesPerFile: target workflow keeps anchored, symbol, and file resolution together.
8
8
  import { existsSync } from "node:fs";
9
9
  import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
10
+ import {
11
+ createEvidenceList,
12
+ createPartialEvidenceList,
13
+ type EvidenceListMetadata,
14
+ } from "../analysis/evidence.ts";
10
15
  import { withSemanticRequestControl, withStructuralRequestControl } from "../analysis/provider.ts";
11
16
  import { normalizePath, resolveScope } from "../analysis/search/paths.ts";
12
17
  import { resolveAnchoredSymbolTarget } from "../analysis/target/anchored.ts";
@@ -63,8 +68,8 @@ export type TargetWorkflowOutcome =
63
68
  confidence: ResolvedTargetData["confidence"];
64
69
  discoveryProvenance: FileOutlineData["discoveryProvenance"];
65
70
  targets: ReadonlyArray<Readonly<TargetStoreEntry>>;
66
- totalCount: number;
67
- omittedCount: number;
71
+ /** Declaration Evidence list: exact total, visible handles only. */
72
+ targetEvidence: EvidenceListMetadata;
68
73
  unknownLevelCount: number;
69
74
  partial?: FileOutlineData["partial"];
70
75
  notListed: FileOutlineData["notListed"];
@@ -328,19 +333,9 @@ function toWorkflowOutcome(
328
333
  kind: "kind-mismatch",
329
334
  requestedKind: outcome.requestedKind,
330
335
  candidates,
331
- totalCount: outcome.totalCount,
332
- omittedCount: outcome.omittedCount,
333
- partialReason: outcome.partialReason,
334
- partialMessage: outcome.partialMessage,
336
+ candidateEvidence: outcome.candidateEvidence,
335
337
  }
336
- : {
337
- kind: "disambiguation",
338
- candidates,
339
- totalCount: outcome.totalCount,
340
- omittedCount: outcome.omittedCount,
341
- partialReason: outcome.partialReason,
342
- partialMessage: outcome.partialMessage,
343
- };
338
+ : { kind: "disambiguation", candidates, candidateEvidence: outcome.candidateEvidence };
344
339
  }
345
340
 
346
341
  function registerFileOutline(
@@ -348,8 +343,21 @@ function registerFileOutline(
348
343
  deps: TargetWorkflowDeps,
349
344
  maxResults: number,
350
345
  ): TargetWorkflowOutcome {
351
- const totalCount = outline.targets.length;
352
- const visibleTargets = outline.targets.slice(0, Math.max(0, maxResults));
346
+ // A partial outline enumerated what syntax recovery exposed; more may exist.
347
+ const visible = outline.partial
348
+ ? createPartialEvidenceList({
349
+ key: "resolve.targets",
350
+ items: outline.targets,
351
+ maxResults: Math.max(0, maxResults),
352
+ partialReason: "provider-limited",
353
+ partialMessage: outline.partial.reason,
354
+ })
355
+ : createEvidenceList({
356
+ key: "resolve.targets",
357
+ items: outline.targets,
358
+ maxResults: Math.max(0, maxResults),
359
+ });
360
+ const visibleTargets = visible.items;
353
361
  const fingerprint = computeFileFingerprint(outline.file);
354
362
  const fileFingerprint = fingerprint.kind === "ok" ? fingerprint.fingerprint : "unfingerprinted";
355
363
  const targets = visibleTargets.map((target) =>
@@ -361,8 +369,7 @@ function registerFileOutline(
361
369
  confidence: outline.confidence,
362
370
  discoveryProvenance: Object.freeze([...outline.discoveryProvenance]),
363
371
  targets: Object.freeze(targets),
364
- totalCount,
365
- omittedCount: totalCount - targets.length,
372
+ targetEvidence: visible.metadata,
366
373
  unknownLevelCount: outline.unknownLevelCount,
367
374
  ...(outline.partial ? { partial: outline.partial } : {}),
368
375
  notListed: outline.notListed,
@@ -65,11 +65,9 @@ export function assembleFindWorkflowResult(
65
65
  createToolDisplaySection({
66
66
  key: `find.${outcome.data.kind}`,
67
67
  title: outcome.data.kind === "semantic" ? "Symbols" : "Matches",
68
- items: findItems(outcome.data),
69
- totalCount: evidence.metadata.totalCount,
70
- omittedCount: evidence.metadata.omittedCount,
71
- partialReason: evidence.metadata.partialReason,
72
- format: (item) => formatFindDisplayItem(outcome.data.kind, item),
68
+ items: findItems(outcome.data).slice(0, evidence.metadata.shownCount),
69
+ evidence: evidence.metadata,
70
+ format: (item: unknown) => formatFindDisplayItem(outcome.data.kind, item),
73
71
  }),
74
72
  ];
75
73
 
@@ -79,8 +77,8 @@ export function assembleFindWorkflowResult(
79
77
  key: "find.excludedPaths",
80
78
  title: "Excluded path examples",
81
79
  items: exclusion.examples,
82
- totalCount: exclusion.examples.length,
83
- omittedCount: 0,
80
+ evidence: createEvidenceList({ key: "find.excludedPaths", items: exclusion.examples })
81
+ .metadata,
84
82
  format: describeExcludedPath,
85
83
  }),
86
84
  );
@@ -1,3 +1,4 @@
1
+ import { createEvidenceList } from "../../analysis/evidence.ts";
1
2
  import type { CallEntry, ReferenceEntry } from "../../analysis/relations/types.ts";
2
3
  import { toDisplayPath } from "../../analysis/search/paths.ts";
3
4
  import { createToolDisplaySection } from "../result/display.ts";
@@ -20,6 +21,7 @@ export function graphDisplaySection(
20
21
  key: `graph.${section.rel}`,
21
22
  title: section.rel,
22
23
  items: [],
24
+ evidence: createEvidenceList({ key: `graph.${section.rel}`, items: [] }).metadata,
23
25
  format: () => "",
24
26
  }),
25
27
  fileGroups: [],
@@ -30,11 +32,8 @@ export function graphDisplaySection(
30
32
  key: `graph.${section.rel}`,
31
33
  title: section.rel,
32
34
  items,
33
- totalCount: section.evidence.metadata.totalCount,
34
- omittedCount: section.evidence.metadata.omittedCount,
35
- partialReason: section.evidence.metadata.partialReason,
36
- partialMessage: section.evidence.metadata.partialMessage,
37
- format: (item) => {
35
+ evidence: section.evidence.metadata,
36
+ format: (item: CallEntry | ReferenceEntry) => {
38
37
  const site = `L${item.line}:${item.character}`;
39
38
  if (section.rel !== "callees") return site;
40
39
  const call = item as CallEntry;
@@ -42,7 +41,7 @@ export function graphDisplaySection(
42
41
  },
43
42
  });
44
43
  const groups = new Map<string, string[]>();
45
- for (let index = 0; index < display.shownCount; index++) {
44
+ for (let index = 0; index < display.lines.length; index++) {
46
45
  const file = toDisplayPath(cwd, items[index].file);
47
46
  const rows = groups.get(file) ?? [];
48
47
  rows.push(display.lines[index]);
@@ -1,38 +1,22 @@
1
- import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
1
+ import { describeEvidenceList, type EvidenceListFacts } from "../../analysis/evidence.ts";
2
2
 
3
- /** Format graph counts and all known limits in one place. */
3
+ /** Canonical evidence phrase for one graph list, plus its external-location count. */
4
4
  export function formatGraphEvidence(
5
- metadata: Omit<EvidenceListMetadata, "partialReason"> & { partialReason: string | null },
6
- noun: "locations" | "call sites" | "candidates",
5
+ facts: EvidenceListFacts,
6
+ noun: "locations" | "call sites",
7
7
  externalCount = 0,
8
8
  ): string {
9
- const { shownCount, totalCount, omittedCount, partialReason, invalidLocationCount } = metadata;
10
- const count = totalCount ?? shownCount;
11
- const label = count === 1 ? singularGraphNoun(noun) : noun;
12
- let text =
13
- totalCount === null
14
- ? `${shownCount} ${label} shown${omittedCount ? `; ${omittedCount} collected omitted` : ""}; more may exist — ${partialReason}`
15
- : omittedCount
16
- ? `${shownCount} of ${totalCount} ${label} shown; ${omittedCount} omitted`
17
- : `${totalCount} ${label}`;
18
- if (externalCount > 0)
19
- text += `; ${externalCount} external location${externalCount === 1 ? "" : "s"}`;
20
- if (metadata.partialMessage) text += ` — ${metadata.partialMessage}`;
21
- if (invalidLocationCount) {
22
- const invalidNoun = invalidLocationCount === 1 ? "location" : "locations";
23
- text += `; ${invalidLocationCount} invalid provider ${invalidNoun} omitted (invalid-provider-location)`;
24
- }
25
- return text;
9
+ const text = describeEvidenceList(facts, { one: singularGraphNoun(noun), other: noun });
10
+ if (externalCount === 0) return text;
11
+ return `${text}; ${externalCount} external location${externalCount === 1 ? "" : "s"}`;
26
12
  }
27
13
 
28
- function singularGraphNoun(noun: "locations" | "call sites" | "candidates"): string {
14
+ function singularGraphNoun(noun: "locations" | "call sites"): string {
29
15
  switch (noun) {
30
16
  case "locations":
31
17
  return "location";
32
18
  case "call sites":
33
19
  return "call site";
34
- case "candidates":
35
- return "candidate";
36
20
  }
37
21
  }
38
22
 
@@ -1,5 +1,5 @@
1
1
  import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
2
- import type { EvidenceList, EvidenceListMetadata } from "../../analysis/evidence.ts";
2
+ import type { EvidenceList } from "../../analysis/evidence.ts";
3
3
  import { toDisplayPath } from "../../analysis/search/paths.ts";
4
4
  import type { GraphSection } from "../../session/graph-types.ts";
5
5
  import {
@@ -8,12 +8,9 @@ import {
8
8
  type ResultProvenance,
9
9
  type ToolResultAssembly,
10
10
  } from "../result/assembly.ts";
11
- import { formatCandidateRow, formatPartialCandidateDisclosure } from "../result/candidate-row.ts";
12
- import { createToolDisplaySection } from "../result/display.ts";
13
11
  import type { ToolDisplaySection } from "../result/types.ts";
14
12
  import type { GraphDetails, GraphFileGroup, GraphSectionDetails } from "./details.ts";
15
13
  import { graphDisplaySection } from "./display.ts";
16
- import { formatGraphEvidence } from "./format.ts";
17
14
  import { graphReadNext } from "./read-next.ts";
18
15
  import { type AssembledGraphSection, assembleGraphSection } from "./section.ts";
19
16
  import { structuredGraphCandidates, structuredGraphResult } from "./structured.ts";
@@ -155,6 +152,7 @@ function graphConfidence(sections: readonly AssembledGraphSection[]): Confidence
155
152
  }
156
153
 
157
154
  import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
155
+ import { assembleCandidateSelection } from "../result/candidate-selection.ts";
158
156
  import { searchErrorResult } from "../result/errors.ts";
159
157
  import { renderGraphResult } from "./markdown.ts";
160
158
 
@@ -203,88 +201,31 @@ export function finishGraphResult(outcome: GraphOutcome, cwd: string): CodeIntel
203
201
  }
204
202
 
205
203
  function finishGraphCandidates(
206
- input: Extract<GraphOutcome, { kind: "disambiguation" | "kind-mismatch" }>,
204
+ outcome: Extract<GraphOutcome, { kind: "disambiguation" | "kind-mismatch" }>,
207
205
  cwd: string,
208
206
  ): CodeIntelResult {
209
- const outcome = {
210
- ...input,
211
- candidates: input.candidates.map((candidate) => ({
212
- ...candidate,
213
- file: toDisplayPath(cwd, candidate.file),
214
- })),
215
- };
216
- const lines = [
217
- outcome.kind === "kind-mismatch"
218
- ? `**No target matched provider kind \`${outcome.requestedKind}\`. Near matches:**`
219
- : "**Target is ambiguous. Choose one candidate handle:**",
220
- "",
221
- ];
222
- for (const candidate of outcome.candidates) {
223
- lines.push(
224
- `- \`${candidate.targetId}\` — ${candidate.name} (\`${candidate.kind ?? "unknown"}\`) at ${candidate.file}:${candidate.line}:${candidate.character}`,
225
- );
226
- }
227
- const evidence = graphCandidateEvidence(outcome);
228
- lines.push(
229
- "",
230
- formatPartialCandidateDisclosure(evidence) ?? formatGraphEvidence(evidence, "candidates"),
231
- );
232
- if (outcome.kind === "kind-mismatch") {
233
- lines.push(
234
- "",
235
- "Retry without `symbolKind`, use an observed provider kind, or choose a handle.",
236
- );
237
- }
238
- const displaySections = [
239
- createToolDisplaySection({
240
- key: "graph.candidates",
241
- title: "Candidates",
242
- items: outcome.candidates,
243
- totalCount: evidence.totalCount,
244
- omittedCount: evidence.omittedCount,
245
- partialReason: evidence.partialReason,
246
- partialMessage: evidence.partialMessage,
247
- format: (candidate) => formatCandidateRow(candidate, "handle-first"),
248
- }),
249
- ];
250
- const nextQueries =
251
- outcome.kind === "kind-mismatch"
252
- ? ["Retry without symbolKind, use an observed provider kind, or choose a near-match handle"]
253
- : ["Choose one candidate handle, or narrow the symbol selector with scope or symbolKind"];
254
- const message =
255
- outcome.kind === "kind-mismatch"
256
- ? `No target matched provider kind ${outcome.requestedKind}.`
257
- : "The target is ambiguous.";
207
+ const selection = assembleCandidateSelection({ outcome, key: "graph.candidates", cwd });
208
+ const nextQueries = [...selection.nextQueries];
258
209
  return {
259
- ...searchErrorResult(lines.join("\n"), {
210
+ ...searchErrorResult(selection.content, {
260
211
  confidence: "semantic",
261
- evidenceLists: [evidence],
212
+ evidenceLists: [selection.evidence],
262
213
  nextQueries,
263
- status: outcome.kind === "disambiguation" ? "disambiguation" : "invalid-input",
264
- message,
265
- displaySections,
214
+ status: selection.status,
215
+ message: selection.message,
216
+ displaySections: selection.displaySections,
266
217
  }),
267
- structuredContent: structuredGraphCandidates(outcome, evidence, { message, nextQueries }),
268
- };
269
- }
270
-
271
- function graphCandidateEvidence(
272
- outcome: Extract<GraphOutcome, { kind: "disambiguation" | "kind-mismatch" }>,
273
- ): EvidenceListMetadata {
274
- return {
275
- key: "graph.candidates",
276
- totalCount: outcome.totalCount,
277
- shownCount: outcome.candidates.length,
278
- omittedCount: outcome.omittedCount,
279
- partialReason: outcome.partialReason,
280
- partialMessage: outcome.partialMessage,
218
+ structuredContent: structuredGraphCandidates(
219
+ { ...outcome, candidates: [...selection.candidates] },
220
+ selection.evidence,
221
+ { message: selection.message, nextQueries },
222
+ ),
281
223
  };
282
224
  }
283
225
 
284
226
  function hasHiddenDisplayEvidence(assembly: GraphResultAssembly): boolean {
285
227
  return assembly.sections.some(
286
228
  (section, index) =>
287
- section.kind === "ok" &&
288
- assembly.displaySections[index].shownCount < section.evidence.items.length,
229
+ section.kind === "ok" && assembly.displaySections[index].displayOmittedCount > 0,
289
230
  );
290
231
  }
@@ -61,29 +61,21 @@ export function assembleGraphSection(
61
61
  };
62
62
  }
63
63
  case "callees": {
64
- const evidence = section.data.recovery
65
- ? createPartialEvidenceList({
66
- key: "callees.calls",
67
- items: [...section.data.calls],
68
- maxResults,
69
- partialReason: "provider-limited",
70
- })
71
- : createEvidenceList({
72
- key: "callees.calls",
73
- items: [...section.data.calls],
74
- maxResults,
75
- });
76
64
  return {
77
65
  ...section,
78
66
  evidence: section.data.recovery
79
- ? {
80
- ...evidence,
81
- metadata: {
82
- ...evidence.metadata,
83
- partialMessage: recoveryMessage(section.data.recovery, cwd),
84
- },
85
- }
86
- : evidence,
67
+ ? createPartialEvidenceList({
68
+ key: "callees.calls",
69
+ items: [...section.data.calls],
70
+ maxResults,
71
+ partialReason: "provider-limited",
72
+ partialMessage: recoveryMessage(section.data.recovery, cwd),
73
+ })
74
+ : createEvidenceList({
75
+ key: "callees.calls",
76
+ items: [...section.data.calls],
77
+ maxResults,
78
+ }),
87
79
  };
88
80
  }
89
81
  case "implements":
@@ -109,20 +101,16 @@ function createRelationEvidenceList<T>(params: {
109
101
  partialReason: RelationLocationPartialReason | null;
110
102
  partialMessage: string | null;
111
103
  }): EvidenceList<T> {
112
- const evidence =
113
- params.partialReason === "provider-limited"
114
- ? createPartialEvidenceList({ ...params, partialReason: params.partialReason })
115
- : createEvidenceList(params);
116
- if (params.partialReason === null) return evidence;
117
- return {
118
- ...evidence,
119
- metadata: {
120
- ...evidence.metadata,
121
- partialReason: params.partialReason,
122
- invalidLocationCount: params.invalidLocationCount,
123
- ...(params.partialMessage ? { partialMessage: params.partialMessage } : {}),
124
- },
104
+ const common = {
105
+ key: params.key,
106
+ items: params.items,
107
+ maxResults: params.maxResults,
108
+ invalidLocationCount: params.invalidLocationCount,
109
+ ...(params.partialMessage ? { partialMessage: params.partialMessage } : {}),
125
110
  };
111
+ return params.partialReason === "provider-limited"
112
+ ? createPartialEvidenceList({ ...common, partialReason: "provider-limited" })
113
+ : createEvidenceList(common);
126
114
  }
127
115
 
128
116
  function recoveryMessage(