@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
@@ -4,6 +4,7 @@ import {
4
4
  throwIfCodeRequestInterrupted,
5
5
  } from "@mrclrchtr/supi-code-runtime/api";
6
6
  import { raceRequestControl } from "../session/readiness.ts";
7
+ import { type DiskStamp, statDiskStampSync } from "./client-disk-stamp.ts";
7
8
  import { fingerprintDocumentContent } from "./client-document-state.ts";
8
9
  import {
9
10
  type SemanticInputChangeKind,
@@ -51,10 +52,16 @@ export interface SemanticInputBarrierHost {
51
52
  markUnreadableDocument(filePath: string): void;
52
53
  }
53
54
 
54
- /** Optional read bound and test seam for one input barrier. */
55
+ /** Optional read bound and test seams for one input barrier. */
55
56
  export interface SemanticInputBarrierOptions {
56
57
  readonly maxConcurrentReads?: number;
57
58
  readonly readFile?: SemanticInputFileReader;
59
+ /**
60
+ * Synchronous stat taken directly before each read. A failure returns
61
+ * undefined and keeps the previous stamp. Synchronous so the stat adds no
62
+ * I/O turn to the shared read pass.
63
+ */
64
+ readonly statFile?: (filePath: string) => DiskStamp | undefined;
58
65
  }
59
66
 
60
67
  /** Revision token used to check one semantic input generation. */
@@ -70,7 +77,7 @@ export interface SemanticInputSnapshot extends SemanticInputRevision {
70
77
  interface OpenDocumentRead {
71
78
  readonly document: SemanticInputDocument;
72
79
  readonly result:
73
- | { readonly kind: "content"; readonly content: string }
80
+ | { readonly kind: "content"; readonly content: string; readonly stamp?: DiskStamp }
74
81
  | { readonly kind: "error"; readonly error: unknown };
75
82
  }
76
83
 
@@ -78,6 +85,8 @@ interface SynchronizationPlan {
78
85
  readonly updates: SemanticInputUpdate[];
79
86
  readonly externalDiskChanges: Array<{ readonly filePath: string; readonly content: string }>;
80
87
  readonly observedDiskFingerprints: Map<string, string | undefined>;
88
+ /** Stamps whose read matched the resulting document content. */
89
+ readonly observedDiskStamps: Map<string, DiskStamp>;
81
90
  }
82
91
 
83
92
  interface PendingSynchronization {
@@ -102,8 +111,14 @@ export class SemanticInputBarrier {
102
111
  readonly #host: SemanticInputBarrierHost;
103
112
  readonly #maxConcurrentReads: number;
104
113
  readonly #readFile: SemanticInputFileReader;
114
+ readonly #statFile: (filePath: string) => DiskStamp | undefined;
105
115
  /** Last verified disk fingerprint for each URI; undefined means observed missing. */
106
116
  readonly #observedDiskFingerprints = new Map<string, string | undefined>();
117
+ /**
118
+ * Disk stamp of the last read whose content equaled the document content.
119
+ * Passive snapshots compare it with a fresh stat; only a content read writes it.
120
+ */
121
+ readonly #observedDiskStamps = new Map<string, DiskStamp>();
107
122
  #revision = 0;
108
123
  /** Latest non-enrollment change, used to classify stale snapshots. */
109
124
  #lastNonEnrollmentChange:
@@ -118,6 +133,7 @@ export class SemanticInputBarrier {
118
133
  Math.floor(options.maxConcurrentReads ?? DEFAULT_MAX_CONCURRENT_READS),
119
134
  );
120
135
  this.#readFile = options.readFile ?? defaultSemanticInputFileReader;
136
+ this.#statFile = options.statFile ?? statDiskStampSync;
121
137
  }
122
138
 
123
139
  /** Read and apply all open inputs, sharing work for one input generation. */
@@ -218,6 +234,21 @@ export class SemanticInputBarrier {
218
234
  /** Seed the initial disk baseline from the content used to open a document. */
219
235
  initializeDocumentContent(uri: string, content: string): void {
220
236
  this.#observedDiskFingerprints.set(uri, fingerprintDocumentContent(content));
237
+ // A new open starts without a stamp; the opener records one only for a disk read.
238
+ this.#observedDiskStamps.delete(uri);
239
+ }
240
+
241
+ /**
242
+ * Record the stamp of a disk read whose content now equals the document.
243
+ * The stat must precede that read. An undefined stamp keeps the previous one.
244
+ */
245
+ recordDiskStamp(uri: string, stamp: DiskStamp | undefined): void {
246
+ if (stamp) this.#observedDiskStamps.set(uri, stamp);
247
+ }
248
+
249
+ /** Return the stamp of the last verified disk read, when one exists. */
250
+ getObservedDiskStamp(uri: string): DiskStamp | undefined {
251
+ return this.#observedDiskStamps.get(uri);
221
252
  }
222
253
 
223
254
  /** Record content read from disk and report a changed known baseline. */
@@ -232,11 +263,13 @@ export class SemanticInputBarrier {
232
263
  /** Forget a document's last observed disk content. */
233
264
  forgetDocumentContent(uri: string): void {
234
265
  this.#observedDiskFingerprints.delete(uri);
266
+ this.#observedDiskStamps.delete(uri);
235
267
  }
236
268
 
237
269
  /** Stop pending work and discard observed input fingerprints. */
238
270
  clear(): void {
239
271
  this.#observedDiskFingerprints.clear();
272
+ this.#observedDiskStamps.clear();
240
273
  this.noteInputChange("lifecycle");
241
274
  }
242
275
 
@@ -363,13 +396,17 @@ export class SemanticInputBarrier {
363
396
  const updates: SemanticInputUpdate[] = [];
364
397
  const externalDiskChanges: Array<{ readonly filePath: string; readonly content: string }> = [];
365
398
  const observedDiskFingerprints = new Map<string, string | undefined>();
399
+ const observedDiskStamps = new Map<string, DiskStamp>();
366
400
  for (const read of reads) {
367
401
  const planned = this.#planDocumentRead(pending, read);
368
402
  observedDiskFingerprints.set(read.document.uri, planned.observedDiskFingerprint);
403
+ if (planned.observedDiskStamp) {
404
+ observedDiskStamps.set(read.document.uri, planned.observedDiskStamp);
405
+ }
369
406
  if (planned.update) updates.push(planned.update);
370
407
  if (planned.externalDiskChange) externalDiskChanges.push(planned.externalDiskChange);
371
408
  }
372
- return { updates, externalDiskChanges, observedDiskFingerprints };
409
+ return { updates, externalDiskChanges, observedDiskFingerprints, observedDiskStamps };
373
410
  }
374
411
 
375
412
  #planDocumentRead(
@@ -377,6 +414,7 @@ export class SemanticInputBarrier {
377
414
  read: OpenDocumentRead,
378
415
  ): {
379
416
  observedDiskFingerprint: string | undefined;
417
+ observedDiskStamp?: DiskStamp;
380
418
  update?: SemanticInputUpdate;
381
419
  externalDiskChange?: { readonly filePath: string; readonly content: string };
382
420
  } {
@@ -401,8 +439,12 @@ export class SemanticInputBarrier {
401
439
  ? read.document.content
402
440
  : read.result.content);
403
441
  const contentFingerprint = fingerprintDocumentContent(content);
442
+ // Record the stamp only when the resulting document equals the disk read.
443
+ // A kept document or an override that differs from disk stays unstamped.
444
+ const stamp = contentFingerprint === diskFingerprint ? read.result.stamp : undefined;
404
445
  return {
405
446
  observedDiskFingerprint: diskFingerprint,
447
+ ...(stamp ? { observedDiskStamp: stamp } : {}),
406
448
  ...(externalDiskChange ? { externalDiskChange } : {}),
407
449
  ...(read.document.contentFingerprint !== contentFingerprint
408
450
  ? { update: { document: read.document, content } }
@@ -437,6 +479,7 @@ export class SemanticInputBarrier {
437
479
  this.#advanceRevision("content");
438
480
  }
439
481
  this.#rememberObservedDiskFingerprints(plan.observedDiskFingerprints);
482
+ for (const [uri, stamp] of plan.observedDiskStamps) this.#observedDiskStamps.set(uri, stamp);
440
483
  for (const change of plan.externalDiskChanges) {
441
484
  this.#host.noteExternalDiskChange?.(change.filePath, change.content);
442
485
  }
@@ -475,8 +518,14 @@ export class SemanticInputBarrier {
475
518
  const document = documents[index];
476
519
  if (!document) return;
477
520
  try {
521
+ // Stat before the read: a change between both leaves an older stamp,
522
+ // so the next passive comparison fails closed.
523
+ const stamp = this.#statFile(document.filePath);
478
524
  const content = await this.#readFile(document.filePath, signal);
479
- reads[index] = { document, result: { kind: "content", content } };
525
+ reads[index] = {
526
+ document,
527
+ result: stamp ? { kind: "content", content, stamp } : { kind: "content", content },
528
+ };
480
529
  } catch (error) {
481
530
  reads[index] = { document, result: { kind: "error", error } };
482
531
  }
@@ -23,6 +23,7 @@ import { CodeActionTriggerKind } from "vscode-languageserver-types";
23
23
  import { CLIENT_CAPABILITIES } from "../config/capabilities.ts";
24
24
  import {
25
25
  getServerOperationSupport,
26
+ isCodeActionKindWithin,
26
27
  supportsCodeActionResolve,
27
28
  supportsCodeActions,
28
29
  supportsPrepareRename,
@@ -32,6 +33,7 @@ import {
32
33
  import type {
33
34
  CodeAction,
34
35
  CodeActionContext,
36
+ Command,
35
37
  Diagnostic,
36
38
  DidChangeWatchedFilesParams,
37
39
  DocumentDiagnosticReport,
@@ -71,6 +73,11 @@ import { createTypeScriptDiagnosticRequestAdapter } from "./client-diagnostic-ty
71
73
  import { ClientDiagnostics } from "./client-diagnostics.ts";
72
74
  import type { ClientDiagnosticSnapshot, DiagnosticEntry } from "./client-document-state.ts";
73
75
  import { type NormalizedDocumentSync, normalizeDocumentSync } from "./client-document-sync.ts";
76
+ import {
77
+ type CommandEditCaptureResult,
78
+ EditCaptureWindow,
79
+ runCommandEditCapture,
80
+ } from "./client-edit-capture.ts";
74
81
  import {
75
82
  SemanticInputRequestRetryGuard,
76
83
  type SemanticInputRequestRetryReason,
@@ -244,13 +251,6 @@ function isLazyCodeAction(value: unknown): value is CodeAction {
244
251
  );
245
252
  }
246
253
 
247
- function codeActionKindMatchesFilter(kind: unknown, filter: string): boolean {
248
- return (
249
- filter === "" ||
250
- (typeof kind === "string" && (kind === filter || kind.startsWith(`${filter}.`)))
251
- );
252
- }
253
-
254
254
  function isValidCommand(value: unknown): value is NonNullable<CodeAction["command"]> {
255
255
  const command = isRecord(value) ? value : null;
256
256
  return (
@@ -546,8 +546,11 @@ export class LspClient {
546
546
  private readonly settingsSnapshot: JsonObject | undefined;
547
547
  private readonly diagnosticRequestAdapter: DiagnosticRequestAdapter;
548
548
  private readonly diagnostics: ClientDiagnostics;
549
+ private readonly editCapture = new EditCaptureWindow();
549
550
  /** Dynamic capability registrations for this client instance only. */
550
551
  private readonly dynamicRegistrations = new ClientDynamicRegistrations();
552
+ /** Workspace association snapshot shared by `didOpen` and selector matching. */
553
+ private readonly fileAssociations: CFamilyFileAssociationResolver | undefined;
551
554
 
552
555
  // ── Readiness (work-done-progress) ──────────────────────────────────
553
556
  private trackedTokens = new Map<ProgressToken, "created" | "active" | "ended">();
@@ -573,9 +576,12 @@ export class LspClient {
573
576
  readonly cwd?: string,
574
577
  /** Immutable workspace association snapshot for document language IDs. */
575
578
  fileAssociations?: CFamilyFileAssociationResolver,
579
+ /** Observer for tracked files cleared because they no longer exist. */
580
+ onTrackedFileRemoved?: (filePath: string) => void,
576
581
  ) {
577
582
  this.name = name;
578
583
  this.root = root;
584
+ this.fileAssociations = fileAssociations;
579
585
  this.settingsSnapshot = cloneSettings(config.settings);
580
586
  const nativeDiagnosticAdapter: DiagnosticRequestAdapter = {
581
587
  supports: (uri) => this.hasApplicableDiagnosticProvider(uri),
@@ -614,6 +620,7 @@ export class LspClient {
614
620
  if (!this.shouldSendDocumentNotification(method)) return;
615
621
  if (this.rpc) void this.rpc.sendNotification(method, params);
616
622
  },
623
+ onTrackedFileRemoved,
617
624
  });
618
625
  }
619
626
 
@@ -1014,6 +1021,11 @@ export class LspClient {
1014
1021
  return this.diagnostics.getOpenDocumentVersion(filePath);
1015
1022
  }
1016
1023
 
1024
+ /** Return the text last synchronized to the server, or null when the document is not open. */
1025
+ getOpenDocumentContent(filePath: string): string | null {
1026
+ return this.diagnostics.getOpenDocumentContent(filePath);
1027
+ }
1028
+
1017
1029
  /** Return stored diagnostics for one file. */
1018
1030
  getDiagnostics(filePath: string): Diagnostic[] {
1019
1031
  return this.diagnostics.getDiagnostics(filePath);
@@ -1053,12 +1065,18 @@ export class LspClient {
1053
1065
  if (
1054
1066
  staticRecord !== undefined &&
1055
1067
  isValidDiagnosticOptions(staticRecord) &&
1056
- isDocumentSelectorApplicable(staticRecord.documentSelector, uri)
1068
+ isDocumentSelectorApplicable(staticRecord.documentSelector, uri, this.fileAssociations)
1057
1069
  ) {
1058
1070
  return staticRecord;
1059
1071
  }
1060
1072
  for (const registration of this.dynamicRegistrations.get(DOCUMENT_DIAGNOSTIC_METHOD)) {
1061
- if (isDocumentSelectorApplicable(registration.options.documentSelector, uri)) {
1073
+ if (
1074
+ isDocumentSelectorApplicable(
1075
+ registration.options.documentSelector,
1076
+ uri,
1077
+ this.fileAssociations,
1078
+ )
1079
+ ) {
1062
1080
  return registration.options;
1063
1081
  }
1064
1082
  }
@@ -1239,6 +1257,37 @@ export class LspClient {
1239
1257
  return result.kind === "completed" ? readTypeScriptProjectMembership(result.data) : "unknown";
1240
1258
  }
1241
1259
 
1260
+ /**
1261
+ * Run one server command and capture the single edit it pushes through
1262
+ * `workspace/applyEdit`. Every pushed edit is refused, so no file changes.
1263
+ * Open documents the edit touches are re-sent afterwards under new versions.
1264
+ */
1265
+ async captureCommandEdits(
1266
+ command: Command,
1267
+ options: {
1268
+ timeoutMs: number;
1269
+ graceMs?: number;
1270
+ drainMs?: number;
1271
+ control?: CodeRequestControl;
1272
+ },
1273
+ ): Promise<CommandEditCaptureResult> {
1274
+ const rpc = this.rpc;
1275
+ if (!rpc || this._status !== "running") {
1276
+ return {
1277
+ kind: "unavailable",
1278
+ reason: "The server command is unavailable because the client is not running.",
1279
+ };
1280
+ }
1281
+ return runCommandEditCapture({
1282
+ command,
1283
+ ...options,
1284
+ window: this.editCapture,
1285
+ sendRequestOwned: (method, params, requestOptions) =>
1286
+ rpc.sendRequestOwned(method, params, requestOptions),
1287
+ resynchronize: (file) => this.diagnostics.resynchronizeOpenDocument(file),
1288
+ });
1289
+ }
1290
+
1242
1291
  async workspaceSymbol(
1243
1292
  query: string,
1244
1293
  control?: CodeRequestControl,
@@ -1430,7 +1479,17 @@ export class LspClient {
1430
1479
  control: CodeRequestControl | undefined,
1431
1480
  only: readonly string[] | undefined,
1432
1481
  ): Promise<CodeAction[]> {
1433
- const candidates = raw.map((value) => {
1482
+ // Servers may still return kinds that `only` excludes (typescript-language-server
1483
+ // adds quickfixes). Drop those before validation so they cannot fail the request.
1484
+ const requested = only
1485
+ ? raw.filter(
1486
+ (value) =>
1487
+ !isRecord(value) ||
1488
+ typeof value.kind !== "string" ||
1489
+ only.some((filter) => isCodeActionKindWithin(value.kind, filter)),
1490
+ )
1491
+ : raw;
1492
+ const candidates = requested.map((value) => {
1434
1493
  const candidate = normalizeCodeActionResponseEntry(value);
1435
1494
  if (!candidate)
1436
1495
  throw new Error("LSP server returned a malformed code action response entry.");
@@ -1443,7 +1502,7 @@ export class LspClient {
1443
1502
  !this.supportsCodeActionResolve ||
1444
1503
  !lazyAction ||
1445
1504
  (only !== undefined &&
1446
- !only.some((filter) => codeActionKindMatchesFilter(lazyAction.kind, filter)))
1505
+ !only.some((filter) => isCodeActionKindWithin(lazyAction.kind, filter)))
1447
1506
  ) {
1448
1507
  actions.push(action);
1449
1508
  continue;
@@ -1716,7 +1775,7 @@ export class LspClient {
1716
1775
  }): void {
1717
1776
  recordDebugEvent({
1718
1777
  source: "lsp",
1719
- level: "debug",
1778
+ level: options.outcome === "exhausted" || options.outcome === "failed" ? "warning" : "debug",
1720
1779
  category: "request.retry",
1721
1780
  message: "LSP request retry",
1722
1781
  cwd: boundCwd(this.cwd),
@@ -1773,6 +1832,8 @@ export class LspClient {
1773
1832
 
1774
1833
  private handleServerRequest(method: string, params: unknown): unknown {
1775
1834
  switch (method) {
1835
+ case "workspace/applyEdit":
1836
+ return this.editCapture.handleApplyEdit(params);
1776
1837
  case "workspace/configuration":
1777
1838
  return this.buildWorkspaceConfigurationResult(params);
1778
1839
  case "workspace/workspaceFolders":
@@ -2070,7 +2131,7 @@ export class LspClient {
2070
2131
  if (becameReady) this.publishLifecycle("readiness");
2071
2132
  recordDebugEvent({
2072
2133
  source: "lsp",
2073
- level: "info",
2134
+ level: becameReady ? "info" : "debug",
2074
2135
  category: "readiness.resolved",
2075
2136
  message: `LSP client ${this.name} is ready`,
2076
2137
  cwd: boundCwd(this.cwd),
@@ -2134,7 +2195,7 @@ export class LspClient {
2134
2195
  this.tokenTimeouts.delete(token);
2135
2196
  recordDebugEvent({
2136
2197
  source: "lsp",
2137
- level: "debug",
2198
+ level: "info",
2138
2199
  category: "readiness.token-timeout",
2139
2200
  message: `Readiness per-token timeout fired for ${this.name} after ${timeoutMs}ms`,
2140
2201
  cwd: boundCwd(this.cwd),
@@ -42,15 +42,20 @@ export const CLIENT_CAPABILITIES: ClientCapabilities = {
42
42
  "refactor.extract.constant",
43
43
  "refactor.extract.variable",
44
44
  "refactor.inline",
45
+ "refactor.move",
45
46
  "refactor.rewrite",
46
47
  "source",
47
48
  "source.organizeImports",
48
49
  "source.fixAll",
49
50
  "source.removeUnused",
51
+ "source.removeUnusedImports",
52
+ "source.sortImports",
50
53
  ],
51
54
  },
52
55
  },
53
56
  dataSupport: true,
57
+ // Never advertise `workspace.workspaceEdit.snippetEditSupport` (LSP 3.18):
58
+ // snippet edits cannot become exact previewable text plans.
54
59
  // SuPi resolves only the edit property. Commands and other fields
55
60
  // must remain server-owned and are never advertised as resolvable.
56
61
  resolveSupport: { properties: ["edit"] },
@@ -72,6 +77,9 @@ export const CLIENT_CAPABILITIES: ClientCapabilities = {
72
77
  workDoneProgress: true,
73
78
  },
74
79
  workspace: {
80
+ // Servers may push edits through workspace/applyEdit. SuPi records them
81
+ // only while previewing one command and always replies applied: false.
82
+ applyEdit: true,
75
83
  configuration: true,
76
84
  workspaceFolders: true,
77
85
  workspaceEdit: {
@@ -4,10 +4,8 @@ import type { ServerCapabilities } from "vscode-languageserver-protocol";
4
4
  export type ServerOperationName =
5
5
  | "rename_symbol"
6
6
  | "prepare_rename"
7
- | "extract_function"
8
- | "extract_variable"
9
- | "update_imports"
10
- | "delete_dead_code"
7
+ | "code_action"
8
+ | "source_action"
11
9
  | "code_action_resolve";
12
10
 
13
11
  /** Whether a server advertises one operation in its negotiated capabilities. */
@@ -19,6 +17,13 @@ export interface ServerOperationSupport {
19
17
  readonly supi: "supported" | "limited" | "unsupported";
20
18
  /** A stable explanation for a SuPi planning limitation or deferral. */
21
19
  readonly reason?: string;
20
+ /** Advertised CodeActionKinds in this operation's family (`refactor*` or `source*`). */
21
+ readonly kinds?: readonly string[];
22
+ /**
23
+ * The server may return kinds beyond `kinds`: it advertises CodeActionKind.Empty
24
+ * (`""`) or does not narrow `codeActionKinds` at all.
25
+ */
26
+ readonly anyKind?: boolean;
22
27
  }
23
28
 
24
29
  /** Operation support projected onto a project-server health entry. */
@@ -26,23 +31,6 @@ export type ServerOperationSupportMap = Partial<
26
31
  Record<ServerOperationName, ServerOperationSupport>
27
32
  >;
28
33
 
29
- const REMOVE_UNUSED_KIND = "source.removeUnused";
30
- const REMOVE_UNUSED_IMPORTS_KIND = "source.removeUnusedImports";
31
-
32
- /** Code-action kinds requested by each operation-specific planner. */
33
- export const REFACTOR_CODE_ACTION_KINDS = {
34
- extract_function: ["refactor.extract.function"],
35
- extract_variable: ["refactor.extract.constant", "refactor.extract.variable"],
36
- update_imports: ["source.organizeImports"],
37
- delete_dead_code: [REMOVE_UNUSED_KIND, REMOVE_UNUSED_IMPORTS_KIND],
38
- } as const satisfies Record<
39
- "extract_function" | "extract_variable" | "update_imports" | "delete_dead_code",
40
- readonly string[]
41
- >;
42
-
43
- const EXTRACTION_NAME_LIMITATION =
44
- "Standard LSP code actions do not provide a safe exact extraction-name contract.";
45
-
46
34
  function isRecord(value: unknown): value is Record<string, unknown> {
47
35
  return typeof value === "object" && value !== null && !Array.isArray(value);
48
36
  }
@@ -95,6 +83,22 @@ export function supportsCodeActionResolve(capabilities: ServerCapabilities | nul
95
83
  return codeActionOptions(capabilities)?.resolveProvider === true;
96
84
  }
97
85
 
86
+ /**
87
+ * Test whether a returned CodeActionKind falls under a requested kind: the same
88
+ * kind or a dotted descendant. The empty kind requests every kind.
89
+ */
90
+ export function isCodeActionKindWithin(kind: unknown, requested: string): boolean {
91
+ if (requested === "") return true;
92
+ return typeof kind === "string" && (kind === requested || kind.startsWith(`${requested}.`));
93
+ }
94
+
95
+ /** Return the negotiated `codeActionKinds`, or undefined when the server did not narrow them. */
96
+ export function advertisedCodeActionKinds(
97
+ capabilities: ServerCapabilities | null,
98
+ ): readonly string[] | undefined {
99
+ return codeActionOptions(capabilities)?.kinds;
100
+ }
101
+
98
102
  /** Test the documented hierarchical relationship between two code-action kinds. */
99
103
  export function isCodeActionKindInRange(kind: string, requested: string): boolean {
100
104
  if (kind === "" || requested === "") return true;
@@ -118,46 +122,30 @@ export function supportsRequestedCodeActionKinds(
118
122
  );
119
123
  }
120
124
 
121
- function codeActionAdvertisement(
122
- capabilities: ServerCapabilities | null,
123
- requested: readonly string[],
124
- ): ServerAdvertisement {
125
- if (capabilities === null) return "unknown";
126
- const options = codeActionOptions(capabilities);
127
- if (!options) return "not-advertised";
128
- if (requested.length === 0 || !options.kinds) return "unknown";
129
- if (!supportsRequestedCodeActionKinds(capabilities, requested)) return "not-advertised";
130
-
131
- // A generic parent or the empty kind proves eligibility, but it does not
132
- // prove that this exact operation is implemented by the server.
133
- const exactOrChild = requested.some((wanted) =>
134
- options.kinds?.some(
135
- (kind) => kind === wanted || (wanted !== "" && kind.startsWith(`${wanted}.`)),
136
- ),
137
- );
138
- return exactOrChild ? "advertised" : "unknown";
125
+ function supportedOperation(server: ServerAdvertisement): ServerOperationSupport {
126
+ return { server, supi: "supported" };
139
127
  }
140
128
 
141
- function supportedOperation(
142
- server: ServerAdvertisement,
143
- supi: ServerOperationSupport["supi"] = "supported",
144
- reason?: string,
129
+ /** Project advertised kinds for one CodeActionKind family, such as `refactor` or `source`. */
130
+ function codeActionFamilySupport(
131
+ capabilities: ServerCapabilities | null,
132
+ family: "refactor" | "source",
145
133
  ): ServerOperationSupport {
146
- return { server, supi, ...(reason ? { reason } : {}) };
147
- }
148
-
149
- function deleteDeadCodeSupport(capabilities: ServerCapabilities | null): ServerOperationSupport {
150
- const server = codeActionAdvertisement(capabilities, REFACTOR_CODE_ACTION_KINDS.delete_dead_code);
151
- const importsOnly =
152
- codeActionAdvertisement(capabilities, [REMOVE_UNUSED_KIND]) !== "advertised" &&
153
- codeActionAdvertisement(capabilities, [REMOVE_UNUSED_IMPORTS_KIND]) === "advertised";
154
- return importsOnly
155
- ? supportedOperation(
156
- server,
157
- "limited",
158
- "Only unused-import removal is supported by this mapping, not arbitrary unused declarations.",
159
- )
160
- : supportedOperation(server);
134
+ if (capabilities === null) return supportedOperation("unknown");
135
+ const options = codeActionOptions(capabilities);
136
+ if (!options) return supportedOperation("not-advertised");
137
+ // An unnarrowed provider or the empty kind may return kinds it does not list.
138
+ const anyKind = !options.kinds || options.kinds.includes("");
139
+ const kinds = (options.kinds ?? []).filter(
140
+ (kind) => kind !== "" && isCodeActionKindWithin(kind, family),
141
+ );
142
+ if (kinds.length === 0 && !anyKind) return supportedOperation("not-advertised");
143
+ return {
144
+ server: "advertised",
145
+ supi: "supported",
146
+ ...(kinds.length > 0 ? { kinds } : {}),
147
+ ...(anyKind ? { anyKind } : {}),
148
+ };
161
149
  }
162
150
 
163
151
  /** Build the honest operation-support projection for one negotiated server. */
@@ -185,27 +173,8 @@ export function getServerOperationSupport(
185
173
  return {
186
174
  rename_symbol: supportedOperation(renameServer),
187
175
  prepare_rename: supportedOperation(prepareServer),
188
- extract_function: supportedOperation(
189
- codeActionAdvertisement(capabilities, REFACTOR_CODE_ACTION_KINDS.extract_function),
190
- "limited",
191
- EXTRACTION_NAME_LIMITATION,
192
- ),
193
- extract_variable: supportedOperation(
194
- codeActionAdvertisement(capabilities, REFACTOR_CODE_ACTION_KINDS.extract_variable),
195
- "limited",
196
- EXTRACTION_NAME_LIMITATION,
197
- ),
198
- update_imports: supportedOperation(
199
- codeActionAdvertisement(capabilities, REFACTOR_CODE_ACTION_KINDS.update_imports),
200
- ),
201
- delete_dead_code: deleteDeadCodeSupport(capabilities),
176
+ code_action: codeActionFamilySupport(capabilities, "refactor"),
177
+ source_action: codeActionFamilySupport(capabilities, "source"),
202
178
  code_action_resolve: supportedOperation(resolveServer),
203
179
  };
204
180
  }
205
-
206
- /** Get the exact operation-specific kinds used in a code-action request. */
207
- export function codeActionKindsForOperation(
208
- operation: keyof typeof REFACTOR_CODE_ACTION_KINDS,
209
- ): readonly string[] {
210
- return REFACTOR_CODE_ACTION_KINDS[operation];
211
- }
@@ -1,6 +1,6 @@
1
1
  import * as path from "node:path";
2
- import ts from "typescript";
3
2
  import { normalizeTsconfigPath as normalizePath } from "./tsconfig-path.ts";
3
+ import { getTypeScript } from "./typescript-module.ts";
4
4
 
5
5
  /**
6
6
  * Collect recognized local project configs declared by `extends`, including
@@ -15,6 +15,7 @@ export function collectExtendedProjectConfigs(configPath: string): Set<string> {
15
15
  if (visited.has(normalizedConfigPath)) return;
16
16
  visited.add(normalizedConfigPath);
17
17
 
18
+ const ts = getTypeScript();
18
19
  const config = ts.readConfigFile(currentConfigPath, ts.sys.readFile).config;
19
20
  if (!config || typeof config !== "object") return;
20
21
 
@@ -1,8 +1,8 @@
1
1
  import * as path from "node:path";
2
- import ts from "typescript";
2
+ import { getTypeScript } from "./typescript-module.ts";
3
3
 
4
4
  /** Normalize a path for tsconfig cache keys and comparisons. */
5
5
  export function normalizeTsconfigPath(target: string): string {
6
6
  const resolved = path.resolve(target).replaceAll("\\", "/");
7
- return ts.sys.useCaseSensitiveFileNames ? resolved : resolved.toLowerCase();
7
+ return getTypeScript().sys.useCaseSensitiveFileNames ? resolved : resolved.toLowerCase();
8
8
  }