@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,57 +1,38 @@
1
1
  /** Session-owned refactor planning and apply workflows. */
2
2
 
3
- import type {
4
- RefactorOperation,
5
- RefactorResult,
6
- SemanticProvider,
7
- SourceRange,
8
- } from "@mrclrchtr/supi-code-runtime/api";
9
3
  import { toLspPosition } from "@mrclrchtr/supi-lsp/api";
10
- import { SEMANTIC_READINESS_TIMEOUT_REASON } from "../analysis/readiness.ts";
11
4
  import { applyWorkspaceEdit } from "../analysis/refactor/apply.ts";
12
5
  import {
13
6
  isLatexSectionTarget,
14
7
  refineLatexSectionRenameResult,
15
8
  } from "../analysis/refactor/latex-section-rename.ts";
16
- import {
17
- establishMutationAuthority,
18
- revalidateMutationAuthority,
19
- } from "../analysis/refactor/mutation-authority.ts";
9
+ import { revalidateMutationAuthority } from "../analysis/refactor/mutation-authority.ts";
20
10
  import { validateEdit } from "../analysis/refactor/safety.ts";
21
11
  import { normalizePath } from "../analysis/search/paths.ts";
22
- import type { CapabilityAdapter } from "./capability-adapter.ts";
23
12
  import {
24
13
  parseRefactorApplyWorkflowInput,
25
14
  parseRefactorPlanWorkflowInput,
26
15
  } from "./input/health-refactor.ts";
27
- import { collectFileFingerprints, dropIdentityEdits } from "./refactor-identity.ts";
28
- import {
29
- computeFileFingerprint,
30
- generatePlanId,
31
- isPlanFresh,
32
- type RefactorPlan,
33
- validateSynchronizedContentFingerprints,
34
- } from "./refactor-plans.ts";
16
+ import { planFileAction } from "./refactor-file-actions.ts";
35
17
  import {
36
- PUBLIC_REFACTOR_OPERATION_NAMES,
37
- type PublicSourceRange,
38
- type RefactorApplyWorkflowInput,
39
- type RefactorApplyWorkflowOutcome,
40
- type RefactorOperationInput,
41
- type RefactorPlanWorkflowInput,
42
- type RefactorPlanWorkflowOutcome,
18
+ ensureFileReadiness,
19
+ finishProviderPlan,
20
+ immutablePlan,
21
+ planWithProvider,
22
+ type RefactorWorkflowDeps,
23
+ } from "./refactor-plan-pipeline.ts";
24
+ import { computeFileFingerprint, isPlanFresh } from "./refactor-plans.ts";
25
+ import type {
26
+ RefactorApplyWorkflowInput,
27
+ RefactorApplyWorkflowOutcome,
28
+ RefactorOperationInput,
29
+ RefactorPlanWorkflowInput,
30
+ RefactorPlanWorkflowOutcome,
43
31
  } from "./refactor-types.ts";
44
32
  import type { TargetStoreEntry } from "./target-store.ts";
45
- import { resolveTargetWorkflow, type TargetWorkflowDeps } from "./target-workflow.ts";
33
+ import { resolveTargetWorkflow } from "./target-workflow.ts";
46
34
  import { reportProgress, throwIfAborted, type WorkflowControl } from "./workflow-control.ts";
47
35
 
48
- export interface RefactorWorkflowDeps extends TargetWorkflowDeps {
49
- readonly capability: CapabilityAdapter;
50
- readonly storePlan: (plan: RefactorPlan) => string;
51
- readonly getPlan: (id: string) => RefactorPlan | undefined;
52
- readonly removePlan: (id: string) => void;
53
- }
54
-
55
36
  /** Plan one precise refactor without mutating files. */
56
37
  export async function runRefactorPlanWorkflow(
57
38
  input: RefactorPlanWorkflowInput,
@@ -60,24 +41,27 @@ export async function runRefactorPlanWorkflow(
60
41
  ): Promise<RefactorPlanWorkflowOutcome> {
61
42
  const validatedInput = parseRefactorPlanWorkflowInput(input);
62
43
  if (validatedInput.kind === "invalid-input") return validatedInput;
63
- const request = validatedInput.value;
64
- const parsed = parseOperation(request.operation);
65
- if (parsed.kind === "invalid-input") return parsed;
66
- const rangeError = parsed.range ? validateRange(parsed.range) : null;
67
- if (rangeError) return { kind: "invalid-input", message: rangeError };
68
-
44
+ const { operation } = validatedInput.value;
69
45
  throwIfAborted(control);
46
+ if ("rename_symbol" in operation) {
47
+ return planRename(operation.rename_symbol, deps, control);
48
+ }
49
+ return planFileAction(operation, deps, control);
50
+ }
51
+
52
+ async function planRename(
53
+ input: Extract<RefactorOperationInput, { rename_symbol: unknown }>["rename_symbol"],
54
+ deps: RefactorWorkflowDeps,
55
+ control?: WorkflowControl,
56
+ ): Promise<RefactorPlanWorkflowOutcome> {
70
57
  reportProgress(control, {
71
58
  intent: "refactor-plan",
72
59
  phase: "target",
73
60
  message: "Resolving refactor target",
74
61
  });
75
62
  const target = await resolveTargetWorkflow(
76
- request.target,
77
- {
78
- fileLevelAllowed: false,
79
- nameAnchorRequired: parsed.operation === "rename_symbol",
80
- },
63
+ input.target,
64
+ { fileLevelAllowed: false, nameAnchorRequired: true },
81
65
  deps,
82
66
  control,
83
67
  );
@@ -86,28 +70,48 @@ export async function runRefactorPlanWorkflow(
86
70
  return {
87
71
  kind: "invalid-input",
88
72
  message:
89
- "Refactor planning requires one declaration, not a whole file. Pass one handle from the file outline as target.handle.",
73
+ "Rename requires one declaration, not a whole file. Pass one handle from the file outline as target.handle.",
90
74
  };
91
75
  }
92
76
  if (target.kind === "disambiguation" || target.kind === "kind-mismatch") {
93
77
  return {
94
78
  kind: "invalid-input",
95
- message: "Refactor planning requires one precise target handle or anchor.",
79
+ message: "Rename requires one precise target handle or anchor.",
96
80
  };
97
81
  }
98
82
  if (target.kind !== "resolved") return target;
99
83
 
100
- const readiness = await deps.capability.ensureSemanticReadiness(
101
- deps.cwd,
102
- { kind: "file", file: target.entry.file },
84
+ const file = normalizePath(target.entry.file, deps.cwd);
85
+ const readiness = await ensureFileReadiness(file, deps, control);
86
+ if (readiness) return readiness;
87
+ const sectionRename = await planWithLatexSafety({
88
+ newName: input.newName,
89
+ target: target.entry,
90
+ file,
91
+ deps,
103
92
  control,
104
- );
105
- if (readiness.kind === "timeout") {
106
- return { kind: "unavailable", reason: SEMANTIC_READINESS_TIMEOUT_REASON };
93
+ });
94
+ if (
95
+ sectionRename.result.kind === "precise" &&
96
+ sectionRename.sourceFingerprint &&
97
+ computeFileFingerprint(file) !== sectionRename.sourceFingerprint
98
+ ) {
99
+ return {
100
+ kind: "unavailable",
101
+ reason: "The LaTeX source changed before the title rename plan was stored.",
102
+ };
107
103
  }
108
- if (readiness.kind === "unavailable") return readiness;
109
- throwIfAborted(control);
110
- return planResolvedRefactor(parsed, target.entry, deps, control);
104
+ return finishProviderPlan(sectionRename.result, deps, {
105
+ operation: "rename_symbol",
106
+ file,
107
+ discriminator: `${target.entry.displayLine}:${target.entry.displayCharacter}:${input.newName}`,
108
+ fields: {
109
+ newName: input.newName,
110
+ target: { line: target.entry.displayLine, character: target.entry.displayCharacter },
111
+ },
112
+ evidenceSource: sectionRename.evidenceSource,
113
+ sourceFingerprint: sectionRename.sourceFingerprint,
114
+ });
111
115
  }
112
116
 
113
117
  /** Revalidate and apply one stored plan through the per-file mutation queue. */
@@ -157,94 +161,17 @@ export async function runRefactorApplyWorkflow(
157
161
  return { kind: "completed", plan: immutablePlan(plan), result };
158
162
  }
159
163
 
160
- type ParsedRefactorOperation = Extract<ReturnType<typeof parseOperation>, { kind: "ok" }>;
161
164
  type RefinedRefactorResult = Awaited<ReturnType<typeof refineLatexSectionRenameResult>>;
162
165
 
163
- async function planResolvedRefactor(
164
- parsed: ParsedRefactorOperation,
165
- target: Readonly<TargetStoreEntry>,
166
- deps: RefactorWorkflowDeps,
167
- control?: WorkflowControl,
168
- ): Promise<RefactorPlanWorkflowOutcome> {
169
- const file = normalizePath(target.file, deps.cwd);
170
- const sectionRename = await planWithLatexSafety({ parsed, target, file, deps, control });
171
- const result = sectionRename.result;
172
- if (result.kind === "unavailable") return result;
173
- if (result.kind === "ambiguous") {
174
- return { kind: "ambiguous", candidates: result.candidates };
175
- }
176
- if (
177
- sectionRename.sourceFingerprint &&
178
- computeFileFingerprint(file) !== sectionRename.sourceFingerprint
179
- ) {
180
- return {
181
- kind: "unavailable",
182
- reason: "The LaTeX source changed before the title rename plan was stored.",
183
- };
184
- }
185
-
186
- const validation = validateEdit(result.edits);
187
- if (!validation.safe) {
188
- return { kind: "invalid-input", message: `Refactor safety check failed: ${validation.reason}` };
189
- }
190
- const authority = establishMutationAuthority(
191
- result.edits.edits.map((edit) => edit.file),
192
- result.authorizedMutationRoots,
193
- );
194
- if (authority.kind === "unavailable") return authority;
195
- const fileFingerprints = collectFileFingerprints(
196
- result.edits.edits,
197
- sectionRename.sourceFingerprint
198
- ? { file, fingerprint: sectionRename.sourceFingerprint }
199
- : undefined,
200
- );
201
- const snapshotError = validateSynchronizedContentFingerprints(
202
- result.edits.documentPreconditions,
203
- fileFingerprints,
204
- deps.cwd,
205
- );
206
- if (snapshotError) return { kind: "unavailable", reason: snapshotError };
207
- const changed = dropIdentityEdits(result.edits, fileFingerprints);
208
- if (changed.kind === "unavailable") return changed;
209
- if (changed.edits.edits.length === 0) {
210
- return {
211
- kind: "invalid-input",
212
- message: `The ${parsed.operation} refactor produces no changes; every planned edit matches the current text.`,
213
- };
214
- }
215
-
216
- const plan: RefactorPlan = {
217
- id: generatePlanId(
218
- parsed.operation,
219
- file,
220
- target.displayLine,
221
- target.displayCharacter,
222
- parsed.newName,
223
- ),
224
- operation: parsed.operation,
225
- newName: parsed.newName,
226
- targetFile: file,
227
- targetLine: target.displayLine,
228
- targetCharacter: target.displayCharacter,
229
- edits: changed.edits,
230
- evidenceSource: sectionRename.evidenceSource,
231
- authorizedMutationRoots: authority.canonicalRoots,
232
- fileFingerprints: changed.fileFingerprints,
233
- createdAt: Date.now(),
234
- };
235
- deps.storePlan(plan);
236
- return { kind: "completed", plan: immutablePlan(plan) };
237
- }
238
-
239
166
  async function planWithLatexSafety(input: {
240
- readonly parsed: ParsedRefactorOperation;
167
+ readonly newName: string;
241
168
  readonly target: Readonly<TargetStoreEntry>;
242
169
  readonly file: string;
243
170
  readonly deps: RefactorWorkflowDeps;
244
171
  readonly control?: WorkflowControl;
245
172
  }): Promise<RefinedRefactorResult> {
246
- const { parsed, target, file, deps, control } = input;
247
- const isLatexRename = parsed.operation === "rename_symbol" && isLatexSectionTarget(target);
173
+ const { newName, target, file, deps, control } = input;
174
+ const isLatexRename = isLatexSectionTarget(target);
248
175
  if (isLatexRename && computeFileFingerprint(file) !== target.fileFingerprint) {
249
176
  return {
250
177
  result: {
@@ -258,11 +185,10 @@ async function planWithLatexSafety(input: {
258
185
  const result = await planWithProvider(
259
186
  deps.capability.getSemanticProvider(deps.cwd),
260
187
  {
261
- operation: parsed.operation,
188
+ operation: "rename_symbol",
262
189
  file,
263
190
  position: toLspPosition(target.displayLine, target.displayCharacter),
264
- range: parsed.range ? toLspRange(parsed.range) : undefined,
265
- newName: parsed.newName,
191
+ newName,
266
192
  },
267
193
  control,
268
194
  );
@@ -276,11 +202,11 @@ async function planWithLatexSafety(input: {
276
202
  };
277
203
  }
278
204
  return refineLatexSectionRenameResult({
279
- operation: parsed.operation,
205
+ operation: "rename_symbol",
280
206
  result,
281
207
  target,
282
208
  file,
283
- newName: parsed.newName,
209
+ newName,
284
210
  structural: deps.capability.getStructuralProvider(deps.cwd),
285
211
  documentVersionReader: getDocumentVersionReader(deps),
286
212
  control,
@@ -295,104 +221,3 @@ function getDocumentVersionReader(
295
221
  if (typeof state.runtime.getOpenDocumentVersion !== "function") return undefined;
296
222
  return (file) => state.runtime.getOpenDocumentVersion(file);
297
223
  }
298
-
299
- function parseOperation(input: RefactorOperationInput):
300
- | {
301
- kind: "ok";
302
- operation: RefactorOperation;
303
- newName?: string;
304
- range?: PublicSourceRange;
305
- }
306
- | { kind: "invalid-input"; message: string } {
307
- const keys = PUBLIC_REFACTOR_OPERATION_NAMES.filter((key) => key in input);
308
- if (keys.length !== 1) {
309
- return { kind: "invalid-input", message: "Select exactly one refactor operation." };
310
- }
311
- if ("rename_symbol" in input) {
312
- return {
313
- kind: "ok",
314
- operation: "rename_symbol",
315
- newName: input.rename_symbol.newName,
316
- };
317
- }
318
- if ("extract_function" in input) {
319
- return {
320
- kind: "ok",
321
- operation: "extract_function",
322
- newName: input.extract_function.newName,
323
- range: input.extract_function.range,
324
- };
325
- }
326
- if ("extract_variable" in input) {
327
- return {
328
- kind: "ok",
329
- operation: "extract_variable",
330
- newName: input.extract_variable.newName,
331
- range: input.extract_variable.range,
332
- };
333
- }
334
- return {
335
- kind: "ok",
336
- operation: "update_imports" in input ? "update_imports" : "delete_dead_code",
337
- };
338
- }
339
-
340
- function validateRange(range: PublicSourceRange): string | null {
341
- if (
342
- range.end.line < range.start.line ||
343
- (range.end.line === range.start.line && range.end.character <= range.start.character)
344
- ) {
345
- return "range.end must be after range.start.";
346
- }
347
- return null;
348
- }
349
-
350
- function toLspRange(range: PublicSourceRange): SourceRange {
351
- return {
352
- start: toLspPosition(range.start.line, range.start.character),
353
- end: toLspPosition(range.end.line, range.end.character),
354
- };
355
- }
356
-
357
- async function planWithProvider(
358
- provider: SemanticProvider | null,
359
- request: {
360
- operation: RefactorOperation;
361
- file: string;
362
- position: { line: number; character: number };
363
- range?: SourceRange;
364
- newName?: string;
365
- },
366
- control?: WorkflowControl,
367
- ): Promise<RefactorResult> {
368
- if (!provider) return { kind: "unavailable", reason: "No semantic provider is active." };
369
- if (provider.refactor) return provider.refactor(request, control);
370
- if (request.operation === "rename_symbol" && request.newName !== undefined && provider.rename) {
371
- return provider.rename(request.file, request.position, request.newName, control);
372
- }
373
- return {
374
- kind: "unavailable",
375
- reason: `The semantic provider cannot plan ${request.operation}.`,
376
- };
377
- }
378
-
379
- function immutablePlan(plan: RefactorPlan): Readonly<RefactorPlan> {
380
- return Object.freeze({
381
- ...plan,
382
- edits: Object.freeze({
383
- ...plan.edits,
384
- edits: Object.freeze(plan.edits.edits.map((edit) => Object.freeze({ ...edit }))),
385
- documentPreconditions: plan.edits.documentPreconditions
386
- ? Object.freeze(
387
- plan.edits.documentPreconditions.map((precondition) =>
388
- Object.freeze({ ...precondition }),
389
- ),
390
- )
391
- : undefined,
392
- }),
393
- authorizedMutationRoots: Object.freeze([...plan.authorizedMutationRoots]),
394
- fileFingerprints: Object.freeze(
395
- plan.fileFingerprints.map((fingerprint) => Object.freeze({ ...fingerprint })),
396
- ),
397
- }) as Readonly<RefactorPlan>;
398
- }
@@ -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,
@@ -1,16 +1,13 @@
1
1
  /** Thin Pi adapter for the session-owned code_find workflow. */
2
2
 
3
- import type { FindMode, FindWorkflowInput } from "../../session/find-types.ts";
3
+ import type { FindSearchInput, FindWorkflowInput } from "../../session/find-types.ts";
4
4
  import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
5
5
  import { toWorkflowControl } from "../infra/workflow-control.ts";
6
- import type { CodeFindAstKind } from "./ast-kinds.ts";
7
6
  import { finishFindResult } from "./result.ts";
8
7
 
9
8
  export interface CodeFindToolParams {
10
- query: string;
11
- scope?: string[];
12
- mode: FindMode;
13
- kind?: CodeFindAstKind;
9
+ search: FindSearchInput;
10
+ scopes?: string[];
14
11
  maxResults?: number;
15
12
  }
16
13
 
@@ -19,5 +16,7 @@ export async function executeFindTool(
19
16
  ctx: CodeIntelToolExecCtx,
20
17
  ): Promise<CodeIntelResult> {
21
18
  const outcome = await ctx.session.find(params as FindWorkflowInput, toWorkflowControl(ctx));
22
- return finishFindResult(outcome, ctx.cwd, params.scope, params.mode);
19
+ const semantic =
20
+ typeof params.search === "object" && params.search !== null && "semantic" in params.search;
21
+ return finishFindResult(outcome, ctx.cwd, params.scopes, semantic ? "semantic" : "ast");
23
22
  }
@@ -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,9 +1,7 @@
1
1
  import { Type } from "typebox";
2
2
  import type { CodeIntelToolExecCtx } from "../../types/index.ts";
3
- import { FindQueryParam, FindScopeParam, MaxResultsParam } from "../schemas.ts";
4
- import { CODE_FIND_AST_KINDS } from "./ast-kinds.ts";
3
+ import { FindScopesParam, FindSearchParam, MaxResultsParam } from "../schemas.ts";
5
4
  import { executeFindTool } from "./execute.ts";
6
- import { CODE_FIND_MODES } from "./modes.ts";
7
5
  import { FindOutputSchema } from "./structured.ts";
8
6
  import { renderFindCall, renderFindResult } from "./tui.ts";
9
7
 
@@ -14,22 +12,17 @@ export const CODE_FIND_TOOL_LABEL = "Code Find";
14
12
  export const codeFindSpec = {
15
13
  name: CODE_FIND_TOOL_NAME,
16
14
  label: CODE_FIND_TOOL_LABEL,
15
+ annotations: {
16
+ readOnlyHint: true,
17
+ destructiveHint: false,
18
+ idempotentHint: true,
19
+ openWorldHint: false,
20
+ },
17
21
  outputSchema: FindOutputSchema,
18
22
  parameters: Type.Object(
19
23
  {
20
- query: FindQueryParam,
21
- scope: Type.Optional(FindScopeParam),
22
- mode: Type.Enum(CODE_FIND_MODES, {
23
- type: "string",
24
- description:
25
- "Required code-aware search mode. AST mode requires `kind`; semantic mode rejects `kind`.",
26
- }),
27
- kind: Type.Optional(
28
- Type.Enum(CODE_FIND_AST_KINDS, {
29
- type: "string",
30
- description: 'AST structure kind; required only for mode:"ast".',
31
- }),
32
- ),
24
+ search: FindSearchParam,
25
+ scopes: Type.Optional(FindScopesParam),
33
26
  maxResults: Type.Optional(MaxResultsParam),
34
27
  },
35
28
  { additionalProperties: false },
@@ -8,7 +8,7 @@ import {
8
8
  type ToolRendererContext,
9
9
  type ToolResult,
10
10
  } from "../../ui/tui/common.ts";
11
- import type { CodeFindToolParams } from "./execute.ts";
11
+ import { CODE_FIND_MODES } from "./modes.ts";
12
12
 
13
13
  /** Render the compact code_find call header. */
14
14
  export function renderFindCall(
@@ -16,15 +16,21 @@ export function renderFindCall(
16
16
  theme: Theme,
17
17
  _context: ToolRendererContext | undefined,
18
18
  ): Text {
19
- const params = (args ?? {}) as Partial<CodeFindToolParams>;
20
- const mode = formatCallValue(params.mode, 20) ?? "mode?";
19
+ // Streaming calls arrive partial, so every level is read defensively.
20
+ const search = ((args ?? {}) as { search?: unknown }).search;
21
+ const branches = (search && typeof search === "object" ? search : {}) as Record<
22
+ string,
23
+ { query?: unknown; kind?: unknown } | undefined
24
+ >;
25
+ const mode = CODE_FIND_MODES.find((candidate) => branches[candidate] !== undefined);
26
+ const branch = (mode ? branches[mode] : undefined) ?? {};
21
27
 
22
28
  let content = theme.fg("toolTitle", "code_find");
23
- const query = formatCallValue(params.query);
29
+ const query = formatCallValue(branch.query);
24
30
  if (query) content += ` ${theme.fg("accent", JSON.stringify(query))}`;
25
- content += ` ${theme.fg("muted", mode)}`;
31
+ content += ` ${theme.fg("muted", mode ?? "mode?")}`;
26
32
 
27
- const kind = formatCallValue(params.kind, 30);
33
+ const kind = formatCallValue(branch.kind, 30);
28
34
  if (kind) content += theme.fg("dim", ` [${kind}]`);
29
35
 
30
36
  return new Text(content, 0, 0);
@@ -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]);