@mrclrchtr/supi-code-intelligence 12.0.0 → 14.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 (307) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +7 -5
  3. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
  5. package/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  6. package/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  7. package/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  8. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +78 -13
  9. package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  10. package/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  11. package/node_modules/@mrclrchtr/supi-core/src/session.ts +3 -0
  12. package/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  13. package/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  14. package/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  15. package/node_modules/@mrclrchtr/supi-lsp/README.md +6 -2
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
  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 +78 -13
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +3 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  26. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  27. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  28. package/node_modules/@mrclrchtr/supi-lsp/package.json +8 -8
  29. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +1 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +102 -47
  31. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +8 -0
  32. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +20 -1
  33. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +4 -1
  34. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +14 -1
  35. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-typescript.ts +8 -1
  36. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +50 -4
  37. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-disk-stamp.ts +60 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +3 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +21 -1
  40. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +17 -3
  41. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +7 -1
  42. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +53 -4
  43. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +12 -3
  44. package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +24 -8
  45. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +5 -0
  46. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +2 -1
  47. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +2 -2
  48. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +17 -5
  49. package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-module.ts +17 -0
  50. package/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +64 -0
  51. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +42 -0
  52. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +2 -17
  53. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +3 -0
  54. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-removal-ledger.ts +52 -0
  55. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-typescript-coverage.ts +27 -2
  56. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +16 -112
  57. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +561 -103
  58. package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +6 -1
  59. package/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-collection.ts +163 -0
  60. package/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-row-limit.ts +72 -0
  61. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +6 -1
  62. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +13 -3
  63. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +11 -0
  64. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +11 -0
  65. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +1 -0
  66. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +53 -9
  67. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +11 -1
  68. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +2 -0
  69. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  70. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
  71. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +3 -1
  72. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
  73. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
  74. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +78 -13
  75. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  76. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
  77. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +3 -0
  78. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
  79. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  80. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
  81. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +50 -75
  82. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +2 -2
  83. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +50 -75
  84. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +2 -2
  85. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
  86. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +6 -6
  87. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
  88. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +50 -75
  89. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +2 -2
  90. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +7 -7
  91. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
  92. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +7 -7
  93. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
  94. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +50 -75
  95. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +2 -2
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
  97. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +5 -5
  98. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -5
  99. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +1 -1
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/latex/tree-sitter-latex.wasm.json +1 -1
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
  102. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +3 -3
  103. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +1 -1
  104. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +1 -1
  105. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +1 -1
  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 +32 -9
  230. package/src/analysis/health/signals.ts +1 -0
  231. package/src/analysis/instruction-files.ts +11 -7
  232. package/src/analysis/search/exclusions.ts +18 -4
  233. package/src/analysis/search/pattern.ts +3 -3
  234. package/src/analysis/target/anchored.ts +3 -6
  235. package/src/analysis/target/file-outline-omissions.ts +17 -2
  236. package/src/analysis/target/symbol-selection.ts +100 -0
  237. package/src/analysis/target/symbol.ts +83 -49
  238. package/src/analysis/target/types.ts +12 -10
  239. package/src/analysis/workspace/cmake-parser.ts +207 -0
  240. package/src/analysis/workspace/cmake.ts +141 -0
  241. package/src/analysis/workspace/maven.ts +310 -0
  242. package/src/analysis/workspace/membership.ts +100 -26
  243. package/src/analysis/workspace/metadata.ts +6 -1
  244. package/src/analysis/workspace/observe.ts +6 -0
  245. package/src/analysis/workspace/types.ts +11 -3
  246. package/src/app/app.ts +37 -21
  247. package/src/diagnostics/coverage.ts +49 -0
  248. package/src/diagnostics/evidence.ts +10 -2
  249. package/src/extension.ts +1 -2
  250. package/src/headless.ts +4 -2
  251. package/src/session/health-types.ts +2 -0
  252. package/src/session/health-workflow.ts +6 -0
  253. package/src/session/input/common.ts +1 -1
  254. package/src/session/orientation/collect.ts +42 -7
  255. package/src/session/orientation/context-facts.ts +3 -3
  256. package/src/session/orientation/context-sections.ts +13 -15
  257. package/src/session/orientation/facts.ts +5 -8
  258. package/src/session/orientation-types.ts +5 -0
  259. package/src/session/orientation-workflow.ts +12 -17
  260. package/src/session/target-workflow.ts +38 -25
  261. package/src/tool/code_find/render.ts +10 -11
  262. package/src/tool/code_find/result.ts +11 -8
  263. package/src/tool/code_graph/display.ts +5 -6
  264. package/src/tool/code_graph/format.ts +8 -24
  265. package/src/tool/code_graph/result.ts +16 -75
  266. package/src/tool/code_graph/section.ts +21 -33
  267. package/src/tool/code_graph/structured.ts +3 -0
  268. package/src/tool/code_graph/tui.ts +10 -5
  269. package/src/tool/code_health/diagnostic-tui.ts +49 -0
  270. package/src/tool/code_health/guidance.ts +27 -0
  271. package/src/tool/code_health/markdown.ts +63 -9
  272. package/src/tool/code_health/result.ts +20 -9
  273. package/src/tool/code_health/structured-schema.ts +15 -0
  274. package/src/tool/code_health/structured.ts +9 -1
  275. package/src/tool/code_health/tui.ts +33 -40
  276. package/src/tool/code_inspect/result.ts +23 -18
  277. package/src/tool/code_inspect/structured.ts +2 -19
  278. package/src/tool/code_orientation/markdown.ts +6 -1
  279. package/src/tool/code_orientation/result.ts +53 -100
  280. package/src/tool/code_orientation/structured-schema.ts +16 -12
  281. package/src/tool/code_orientation/structured-workspace.ts +13 -7
  282. package/src/tool/code_orientation/structured.ts +31 -39
  283. package/src/tool/code_orientation/workspace-format.ts +4 -10
  284. package/src/tool/code_orientation/workspace-instructions.ts +4 -5
  285. package/src/tool/code_orientation/workspace-observations.ts +2 -2
  286. package/src/tool/code_orientation/workspace-output.ts +16 -7
  287. package/src/tool/code_orientation/workspace-projects.ts +7 -10
  288. package/src/tool/code_orientation/workspace-sections.ts +13 -19
  289. package/src/tool/code_resolve/markdown.ts +4 -46
  290. package/src/tool/code_resolve/result.ts +45 -73
  291. package/src/tool/code_resolve/structured.ts +6 -1
  292. package/src/tool/infra/truncate.ts +2 -16
  293. package/src/tool/result/candidate-selection.ts +157 -0
  294. package/src/tool/result/display.ts +41 -45
  295. package/src/tool/result/errors.ts +1 -0
  296. package/src/tool/result/model-budget.ts +26 -1
  297. package/src/tool/result/refactor.ts +11 -8
  298. package/src/tool/result/structured.ts +2 -1
  299. package/src/tool/result/types.ts +9 -8
  300. package/src/tool/schemas.ts +15 -20
  301. package/src/ui/footer.ts +147 -44
  302. package/src/ui/status-overlay.ts +13 -8
  303. package/src/ui/status-presentation.ts +4 -7
  304. package/src/ui/tui/candidate-selection.ts +40 -95
  305. package/src/ui/tui/common.ts +16 -70
  306. package/src/ui/tui/display.ts +6 -24
  307. package/src/tool/result/candidate-row.ts +0 -49
@@ -3,7 +3,7 @@ import {
3
3
  startDebugTimer,
4
4
  truncateDebugIdentity as truncateIdentity,
5
5
  } from "@mrclrchtr/supi-core/debug";
6
- import { boundCwd } from "../debug-telemetry.ts";
6
+ import { boundCwd, RequestTimingBatch } from "../debug-telemetry.ts";
7
7
 
8
8
  type DiagnosticCollection =
9
9
  | "cache"
@@ -63,6 +63,12 @@ export interface DiagnosticTimingIdentity {
63
63
  */
64
64
  export class DiagnosticObserver {
65
65
  readonly #timer = startDebugTimer();
66
+ /**
67
+ * Completed protocol requests of a `refresh-open` pass. The pass sends one
68
+ * request per open document, so its event reports them as `requests` totals
69
+ * instead of one `request.timing` event each.
70
+ */
71
+ readonly requestTimings: RequestTimingBatch | undefined;
66
72
  #pull: "failed" | "not-supported" | "timed-out";
67
73
  #requestSource: DiagnosticRequestSource | undefined;
68
74
  #request: "failed" | "timed-out" | undefined;
@@ -74,6 +80,7 @@ export class DiagnosticObserver {
74
80
  readonly identity?: DiagnosticTimingIdentity,
75
81
  ) {
76
82
  this.#pull = hasDiagnosticRequestAdapter ? "failed" : "not-supported";
83
+ this.requestTimings = operation === "refresh-open" ? new RequestTimingBatch() : undefined;
77
84
  }
78
85
 
79
86
  synchronized(): void {
@@ -279,6 +286,7 @@ export class DiagnosticObserver {
279
286
  data: {
280
287
  operation: this.operation,
281
288
  ...data,
289
+ ...requestTotals(this.requestTimings),
282
290
  ...(this.identity?.server !== undefined
283
291
  ? { server: truncateIdentity(this.identity.server) }
284
292
  : {}),
@@ -292,6 +300,11 @@ export class DiagnosticObserver {
292
300
  }
293
301
  }
294
302
 
303
+ function requestTotals(batch: RequestTimingBatch | undefined): { requests?: object } {
304
+ const requests = batch?.snapshot();
305
+ return requests ? { requests } : {};
306
+ }
307
+
295
308
  /** Return whether a diagnostic failure represents a timeout without retaining its message. */
296
309
  export function isDiagnosticTimeout(error: unknown): boolean {
297
310
  return error instanceof Error && /\btimed? ?out\b|\btimeout\b/i.test(error.message);
@@ -6,6 +6,7 @@ import {
6
6
  } from "@mrclrchtr/supi-code-runtime/api";
7
7
  import { fileToUri, uriToFile } from "@mrclrchtr/supi-core/path";
8
8
  import type { Diagnostic, Position } from "../config/types.ts";
9
+ import type { RequestTimingBatch } from "../debug-telemetry.ts";
9
10
  import { raceRequestControl } from "../session/readiness.ts";
10
11
  import type {
11
12
  DiagnosticPullRequest,
@@ -38,7 +39,12 @@ export interface TypeScriptDiagnosticAdapterOptions {
38
39
  readonly sendRequestOwned: (
39
40
  method: string,
40
41
  params: unknown,
41
- options: { timeoutMs: number; deadline?: number; operationId?: string },
42
+ options: {
43
+ timeoutMs: number;
44
+ deadline?: number;
45
+ operationId?: string;
46
+ requestTimings?: RequestTimingBatch;
47
+ },
42
48
  ) => OwnedRequest;
43
49
  }
44
50
 
@@ -242,6 +248,7 @@ async function collectTypeScriptPhase(options: TypeScriptPhaseOptions): Promise<
242
248
  timeoutMs: remaining,
243
249
  deadline: collectionDeadline,
244
250
  ...(request.operationId !== undefined ? { operationId: request.operationId } : {}),
251
+ ...(request.requestTimings ? { requestTimings: request.requestTimings } : {}),
245
252
  },
246
253
  );
247
254
  options.setActiveSettled(execution.settled);
@@ -11,6 +11,7 @@ import {
11
11
  } from "@mrclrchtr/supi-code-runtime/api";
12
12
  import { fileToUri, uriToFile } from "@mrclrchtr/supi-core/path";
13
13
  import type { Diagnostic, TextDocumentItem } from "../config/types.ts";
14
+ import type { RequestTimingBatch } from "../debug-telemetry.ts";
14
15
  import type { DiagnosticEvidenceSummary } from "../diagnostics/evidence.ts";
15
16
  import { detectLanguageId } from "../utils.ts";
16
17
  import { applyPushDiagnostics, buildClientDiagnosticSnapshot } from "./client-diagnostic-cache.ts";
@@ -38,6 +39,7 @@ import {
38
39
  } from "./client-diagnostic-request.ts";
39
40
  import { DiagnosticObserver } from "./client-diagnostic-timing.ts";
40
41
  import { DiagnosticWaitRegistry } from "./client-diagnostic-waiters.ts";
42
+ import { type DiskStamp, statDiskStampSync } from "./client-disk-stamp.ts";
41
43
  import {
42
44
  type ClientDiagnosticSnapshot,
43
45
  type DiagnosticEntry,
@@ -136,18 +138,36 @@ export class ClientDiagnostics {
136
138
  return this.#inputAdmission.request(run, control, uri);
137
139
  }
138
140
 
139
- /** Read content only after admission; tracked-document changes never wait. */
140
- async openDocument(
141
+ /**
142
+ * Read content only after admission; tracked-document changes never wait.
143
+ *
144
+ * `readContent` reads the file from disk. The disk stamp taken directly
145
+ * before that read is recorded when the document then holds that content.
146
+ */
147
+ openDocument(
141
148
  filePath: string,
142
149
  readContent: () => string,
143
150
  control?: CodeRequestControl,
144
151
  protectInputs = false,
152
+ ): Promise<void> {
153
+ return this.#openDocument(filePath, readContent, control, { protectInputs, readsDisk: true });
154
+ }
155
+
156
+ async #openDocument(
157
+ filePath: string,
158
+ readContent: () => string,
159
+ control: CodeRequestControl | undefined,
160
+ { protectInputs, readsDisk }: { readonly protectInputs: boolean; readonly readsDisk: boolean },
145
161
  ): Promise<void> {
146
162
  throwIfCodeRequestInterrupted(control);
147
163
  const open = () => {
148
164
  throwIfCodeRequestInterrupted(control);
149
165
  if (!this.host.isOperational()) throw new Error("LSP client is not running.");
150
- this.didOpen(filePath, readContent());
166
+ // Stat inside the admitted closure, directly before the read.
167
+ const stamp = readsDisk ? statDiskStampSync(filePath) : undefined;
168
+ const content = readContent();
169
+ this.didOpen(filePath, content);
170
+ this.#recordDiskStampIfCurrent(fileToUri(filePath), content, stamp);
151
171
  };
152
172
  if (this.#openDocs.has(fileToUri(filePath))) {
153
173
  open();
@@ -274,6 +294,13 @@ export class ClientDiagnostics {
274
294
  this.#inputBarrier.forgetDocumentContent(uri);
275
295
  }
276
296
 
297
+ /** Record a pre-read stamp when the open document now holds exactly that read. */
298
+ #recordDiskStampIfCurrent(uri: string, content: string, stamp: DiskStamp | undefined): void {
299
+ if (!stamp) return;
300
+ if (this.#openDocs.get(uri)?.contentFingerprint !== fingerprintDocumentContent(content)) return;
301
+ this.#inputBarrier.recordDiskStamp(uri, stamp);
302
+ }
303
+
277
304
  async #ensureExplicitDocumentContent(
278
305
  filePath: string,
279
306
  content: string,
@@ -285,10 +312,12 @@ export class ClientDiagnostics {
285
312
  if (!document) {
286
313
  // A manager read can predate admission. Re-read disk after the wait;
287
314
  // explicit authoritative content retains its existing override semantics.
288
- await this.openDocument(
315
+ await this.#openDocument(
289
316
  filePath,
290
317
  () => (contentIsAuthoritative ? content : readFileSync(filePath, "utf-8")),
291
318
  control,
319
+ // Authoritative content is not a disk read and must not record a stamp.
320
+ { protectInputs: false, readsDisk: !contentIsAuthoritative },
292
321
  );
293
322
  return;
294
323
  }
@@ -434,6 +463,7 @@ export class ClientDiagnostics {
434
463
  if (!document) return;
435
464
 
436
465
  let content: string;
466
+ const stamp = statDiskStampSync(filePath);
437
467
  try {
438
468
  content = readFileSync(filePath, "utf-8");
439
469
  } catch {
@@ -443,6 +473,7 @@ export class ClientDiagnostics {
443
473
  if (document.contentFingerprint !== fingerprintDocumentContent(content)) {
444
474
  this.didChange(filePath, content);
445
475
  }
476
+ this.#recordDiskStampIfCurrent(uri, content, stamp);
446
477
  if (diskChanged) this.#noteExternalDiskChange(filePath, content);
447
478
  }
448
479
 
@@ -466,6 +497,10 @@ export class ClientDiagnostics {
466
497
  if (wasOpen && this.host.isOperational()) {
467
498
  sendDidCloseNotification(this.host, uri);
468
499
  }
500
+ // An intentional close of an existing file is not a removal.
501
+ if (hadState && getDiagnosticFileState(filePath) === "removed") {
502
+ this.host.onTrackedFileRemoved?.(filePath);
503
+ }
469
504
  }
470
505
 
471
506
  pruneMissingFiles(): string[] {
@@ -490,6 +525,7 @@ export class ClientDiagnostics {
490
525
  clearTrackedDocumentState(this.#openDocs, this.#diagnosticStore, this.#waiters, uri);
491
526
  removedFiles.push(filePath);
492
527
  if (wasOpen && this.host.isOperational()) sendDidCloseNotification(this.host, uri);
528
+ this.host.onTrackedFileRemoved?.(filePath);
493
529
  }
494
530
 
495
531
  return removedFiles;
@@ -506,6 +542,9 @@ export class ClientDiagnostics {
506
542
  getOpenDocumentVersion(filePath: string): number | null {
507
543
  return this.#openDocs.get(fileToUri(filePath))?.version ?? null;
508
544
  }
545
+ getOpenDocumentContent(filePath: string): string | null {
546
+ return this.#openDocs.get(fileToUri(filePath))?.content ?? null;
547
+ }
509
548
  getDiagnostics(filePath: string): Diagnostic[] {
510
549
  return this.#diagnosticStore.get(fileToUri(filePath))?.diagnostics ?? [];
511
550
  }
@@ -515,6 +554,7 @@ export class ClientDiagnostics {
515
554
  openDocuments: this.#openDocs,
516
555
  failedDocuments: this.#failedUris,
517
556
  evidenceRevision: this.#evidenceRevision,
557
+ observedDiskStamp: (uri) => this.#inputBarrier.getObservedDiskStamp(uri),
518
558
  });
519
559
  }
520
560
  getAllDiagnostics(): DiagnosticEntry[] {
@@ -642,6 +682,7 @@ export class ClientDiagnostics {
642
682
  nextSynchronizationId: () => ++this.#nextSynchronizationId,
643
683
  noteInputContentChange: () => this.#noteInputContentChange(),
644
684
  observeDiskContent: (uri, content) => this.#inputBarrier.observeDiskContent(uri, content),
685
+ recordDiskStamp: (uri, content, stamp) => this.#recordDiskStampIfCurrent(uri, content, stamp),
645
686
  noteExternalDiskChange: (uri, content) =>
646
687
  this.#noteExternalDiskChange(uriToFile(uri), content),
647
688
  invalidateEvidence: (uri) => {
@@ -663,6 +704,8 @@ export class ClientDiagnostics {
663
704
  this.#unversionedPushSyncMoments.delete(uri);
664
705
  this.#closedVersionedBarrier.add(uri);
665
706
  clearTrackedDocumentState(this.#openDocs, this.#diagnosticStore, this.#waiters, uri);
707
+ // Resynchronization clears only documents whose files were removed.
708
+ this.host.onTrackedFileRemoved?.(uriToFile(uri));
666
709
  },
667
710
  markUnversionedSyncMoment: (uri) => {
668
711
  this.#cancelDiagnosticRequest(uri);
@@ -680,6 +723,7 @@ export class ClientDiagnostics {
680
723
  },
681
724
  deadline: requestOptions.deadline,
682
725
  operationId: requestOptions.operationId,
726
+ requestTimings: requestOptions.requestTimings,
683
727
  }),
684
728
  options,
685
729
  publications: {
@@ -1040,6 +1084,7 @@ export class ClientDiagnostics {
1040
1084
  control?: CodeRequestControl;
1041
1085
  deadline?: number;
1042
1086
  operationId?: string;
1087
+ requestTimings?: RequestTimingBatch;
1043
1088
  }): Promise<boolean> {
1044
1089
  const adapter = this.host.diagnosticRequestAdapter;
1045
1090
  if (!adapter?.supports(options.request.uri)) return Promise.resolve(false);
@@ -1076,6 +1121,7 @@ export class ClientDiagnostics {
1076
1121
  timeoutMs: ownerTimeoutMs,
1077
1122
  signal: controller.signal,
1078
1123
  operationId: options.operationId,
1124
+ requestTimings: options.requestTimings,
1079
1125
  };
1080
1126
  const execution = startDiagnosticEvidenceFromAdapter({
1081
1127
  adapter,
@@ -0,0 +1,60 @@
1
+ import { statSync } from "node:fs";
2
+
3
+ /**
4
+ * File metadata that identifies one observed on-disk state of a document.
5
+ *
6
+ * A stamp can only withdraw diagnostic confirmation: a different stamp means
7
+ * the file may have changed since its content was last read. Only a content
8
+ * read restores confirmation. `ctimeNs` catches tools that restore mtime
9
+ * (`cp -p`, `rsync -t`, `touch -r`, tar); `ino` catches atomic replace.
10
+ * A same-size rewrite within one timestamp tick is not detected.
11
+ */
12
+ export interface DiskStamp {
13
+ readonly dev: bigint;
14
+ readonly ino: bigint;
15
+ readonly size: bigint;
16
+ readonly mtimeNs: bigint;
17
+ readonly ctimeNs: bigint;
18
+ }
19
+
20
+ interface BigIntStatLike {
21
+ readonly dev: bigint;
22
+ readonly ino: bigint;
23
+ readonly size: bigint;
24
+ readonly mtimeNs: bigint;
25
+ readonly ctimeNs: bigint;
26
+ }
27
+
28
+ /** Convert a bigint stat result into a stamp. */
29
+ export function toDiskStamp(stats: BigIntStatLike): DiskStamp {
30
+ return {
31
+ dev: stats.dev,
32
+ ino: stats.ino,
33
+ size: stats.size,
34
+ mtimeNs: stats.mtimeNs,
35
+ ctimeNs: stats.ctimeNs,
36
+ };
37
+ }
38
+
39
+ /**
40
+ * Stat one file before its content is read. Returns undefined on any failure;
41
+ * the following read decides whether the file is missing or unreadable.
42
+ */
43
+ export function statDiskStampSync(filePath: string): DiskStamp | undefined {
44
+ try {
45
+ return toDiskStamp(statSync(filePath, { bigint: true }));
46
+ } catch {
47
+ return undefined;
48
+ }
49
+ }
50
+
51
+ /** Compare two stamps field by field. */
52
+ export function sameDiskStamp(a: DiskStamp, b: DiskStamp): boolean {
53
+ return (
54
+ a.dev === b.dev &&
55
+ a.ino === b.ino &&
56
+ a.size === b.size &&
57
+ a.mtimeNs === b.mtimeNs &&
58
+ a.ctimeNs === b.ctimeNs
59
+ );
60
+ }
@@ -1,5 +1,6 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import type { Diagnostic } from "../config/types.ts";
3
+ import type { DiagnosticEvidenceReason } from "../diagnostics/evidence.ts";
3
4
  import { type DiagnosticCacheEntry, isTentativePushEntry } from "./client-diagnostic-evidence.ts";
4
5
 
5
6
  /** One file's stored diagnostics as consumed by manager-level collection. */
@@ -14,6 +15,8 @@ export interface ClientDiagnosticDocument {
14
15
  uri: string;
15
16
  current: boolean;
16
17
  status: "confirmed" | "unconfirmed" | "failed" | "removed";
18
+ /** Why an otherwise current document is unconfirmed. */
19
+ reason?: DiagnosticEvidenceReason;
17
20
  }
18
21
 
19
22
  /** One client's diagnostic snapshot, including empty cache freshness. */
@@ -5,6 +5,7 @@ import {
5
5
  } from "vscode-languageserver-protocol";
6
6
  import type { DiagnosticSynchronization } from "./client-diagnostic-evidence.ts";
7
7
  import type { DiagnosticWaitRegistry } from "./client-diagnostic-waiters.ts";
8
+ import { type DiskStamp, statDiskStampSync } from "./client-disk-stamp.ts";
8
9
  import { fingerprintDocumentContent, type OpenDocumentState } from "./client-document-state.ts";
9
10
  import { getDiagnosticFileState } from "./client-file-state.ts";
10
11
 
@@ -194,12 +195,16 @@ interface ResynchronizeDocumentsOptions {
194
195
  noteInputContentChange(): number;
195
196
  /** Record the verified disk content and report whether its baseline changed. */
196
197
  observeDiskContent(uri: string, content: string): boolean;
198
+ /** Record a pre-read disk stamp when the document now equals that read. */
199
+ recordDiskStamp(uri: string, content: string, stamp: DiskStamp | undefined): void;
197
200
  /** Send one save for an externally observed disk change. */
198
201
  noteExternalDiskChange(uri: string, content: string): void;
199
202
  sendNotification: NotificationSender;
200
203
  uriToFile(uri: string): string;
201
204
  /** Disk content already read by classification; avoids a second read. */
202
205
  preloadedContent?: ReadonlyMap<string, string>;
206
+ /** Stamps taken before the preloaded reads. */
207
+ preloadedStamps?: ReadonlyMap<string, DiskStamp>;
203
208
  clearFile(uri: string): void;
204
209
  invalidateEvidence(uri: string): void;
205
210
  markUnversionedSyncMoment(uri: string): void;
@@ -229,6 +234,20 @@ function noteObservedDiskChange(
229
234
  }
230
235
  }
231
236
 
237
+ /** Read one document, or reuse its preloaded read; the stamp precedes the read. */
238
+ function readDocumentForResynchronization(
239
+ options: Pick<ResynchronizeDocumentsOptions, "preloadedContent" | "preloadedStamps">,
240
+ uri: string,
241
+ filePath: string,
242
+ ): { content: string; stamp: DiskStamp | undefined } {
243
+ const preloaded = options.preloadedContent?.get(uri);
244
+ if (preloaded !== undefined) {
245
+ return { content: preloaded, stamp: options.preloadedStamps?.get(uri) };
246
+ }
247
+ const stamp = statDiskStampSync(filePath);
248
+ return { content: readFileSync(filePath, "utf-8"), stamp };
249
+ }
250
+
232
251
  /** Re-read and synchronize every existing open document. */
233
252
  export function resynchronizeOpenDocuments(
234
253
  options: ResynchronizeDocumentsOptions,
@@ -243,7 +262,7 @@ export function resynchronizeOpenDocuments(
243
262
  const filePath = options.uriToFile(uri);
244
263
  try {
245
264
  options.markUnversionedSyncMoment(uri);
246
- const content = options.preloadedContent?.get(uri) ?? readFileSync(filePath, "utf-8");
265
+ const { content, stamp } = readDocumentForResynchronization(options, uri, filePath);
247
266
  const contentChanged = fingerprintDocumentContent(content) !== document.contentFingerprint;
248
267
  if (contentChanged) {
249
268
  if (!inputChangeNoted) {
@@ -273,6 +292,7 @@ export function resynchronizeOpenDocuments(
273
292
  });
274
293
  }
275
294
  noteObservedDiskChange(options, uri, content);
295
+ options.recordDiskStamp(uri, content, stamp);
276
296
  options.clearFailedFile(uri);
277
297
  synchronizedUris.add(uri);
278
298
  if (contentChanged) resynchronizedUris.add(uri);
@@ -1,16 +1,30 @@
1
1
  import { accessSync, constants, statSync } from "node:fs";
2
+ import { type DiskStamp, toDiskStamp } from "./client-disk-stamp.ts";
2
3
 
3
4
  /** State used to distinguish deleted files from files that cannot be read. */
4
5
  export type DiagnosticFileState = "present" | "removed" | "unreadable";
5
6
 
7
+ /** File-system state plus the disk stamp of a present file. */
8
+ export interface DiagnosticFileStatus {
9
+ readonly state: DiagnosticFileState;
10
+ /** Set only for a present file. */
11
+ readonly stamp?: DiskStamp;
12
+ }
13
+
6
14
  /** Read the file-system state without treating access errors as deletion. */
7
15
  export function getDiagnosticFileState(filePath: string): DiagnosticFileState {
16
+ return getDiagnosticFileStatus(filePath).state;
17
+ }
18
+
19
+ /** Read the file-system state and, for a present file, its disk stamp. */
20
+ export function getDiagnosticFileStatus(filePath: string): DiagnosticFileStatus {
8
21
  try {
9
- if (!statSync(filePath).isFile()) return "unreadable";
22
+ const stats = statSync(filePath, { bigint: true });
23
+ if (!stats.isFile()) return { state: "unreadable" };
10
24
  accessSync(filePath, constants.R_OK);
11
- return "present";
25
+ return { state: "present", stamp: toDiskStamp(stats) };
12
26
  } catch (error) {
13
- return isMissingFileError(error) ? "removed" : "unreadable";
27
+ return { state: isMissingFileError(error) ? "removed" : "unreadable" };
14
28
  }
15
29
  }
16
30
 
@@ -4,7 +4,13 @@ import {
4
4
  throwIfCodeRequestInterrupted,
5
5
  } from "@mrclrchtr/supi-code-runtime/api";
6
6
 
7
- const MAX_PENDING_INPUT_OPERATIONS = 32;
7
+ /**
8
+ * Waiting operations per client. First opens dispatch one at a time, so the
9
+ * bound limits memory for a stalled server, not server load. It must exceed
10
+ * the first opens of several concurrent tool calls: candidate lists open one
11
+ * file per candidate.
12
+ */
13
+ export const MAX_PENDING_INPUT_OPERATIONS = 1024;
8
14
 
9
15
  type InputOperationKind = "request" | "enrollment" | "request-enrollment";
10
16
 
@@ -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
  }
@@ -576,6 +576,8 @@ export class LspClient {
576
576
  readonly cwd?: string,
577
577
  /** Immutable workspace association snapshot for document language IDs. */
578
578
  fileAssociations?: CFamilyFileAssociationResolver,
579
+ /** Observer for tracked files cleared because they no longer exist. */
580
+ onTrackedFileRemoved?: (filePath: string) => void,
579
581
  ) {
580
582
  this.name = name;
581
583
  this.root = root;
@@ -618,6 +620,7 @@ export class LspClient {
618
620
  if (!this.shouldSendDocumentNotification(method)) return;
619
621
  if (this.rpc) void this.rpc.sendNotification(method, params);
620
622
  },
623
+ onTrackedFileRemoved,
621
624
  });
622
625
  }
623
626
 
@@ -1018,6 +1021,11 @@ export class LspClient {
1018
1021
  return this.diagnostics.getOpenDocumentVersion(filePath);
1019
1022
  }
1020
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
+
1021
1029
  /** Return stored diagnostics for one file. */
1022
1030
  getDiagnostics(filePath: string): Diagnostic[] {
1023
1031
  return this.diagnostics.getDiagnostics(filePath);
@@ -1125,6 +1133,7 @@ export class LspClient {
1125
1133
  timeoutMs: request.timeoutMs,
1126
1134
  deadline: ownerDeadline,
1127
1135
  ...(request.operationId !== undefined ? { operationId: request.operationId } : {}),
1136
+ ...(request.requestTimings ? { requestTimings: request.requestTimings } : {}),
1128
1137
  },
1129
1138
  );
1130
1139
  activeSettled = owned.settled;
@@ -1767,7 +1776,7 @@ export class LspClient {
1767
1776
  }): void {
1768
1777
  recordDebugEvent({
1769
1778
  source: "lsp",
1770
- level: "debug",
1779
+ level: options.outcome === "exhausted" || options.outcome === "failed" ? "warning" : "debug",
1771
1780
  category: "request.retry",
1772
1781
  message: "LSP request retry",
1773
1782
  cwd: boundCwd(this.cwd),
@@ -2123,7 +2132,7 @@ export class LspClient {
2123
2132
  if (becameReady) this.publishLifecycle("readiness");
2124
2133
  recordDebugEvent({
2125
2134
  source: "lsp",
2126
- level: "info",
2135
+ level: becameReady ? "info" : "debug",
2127
2136
  category: "readiness.resolved",
2128
2137
  message: `LSP client ${this.name} is ready`,
2129
2138
  cwd: boundCwd(this.cwd),
@@ -2187,7 +2196,7 @@ export class LspClient {
2187
2196
  this.tokenTimeouts.delete(token);
2188
2197
  recordDebugEvent({
2189
2198
  source: "lsp",
2190
- level: "debug",
2199
+ level: "info",
2191
2200
  category: "readiness.token-timeout",
2192
2201
  message: `Readiness per-token timeout fired for ${this.name} after ${timeoutMs}ms`,
2193
2202
  cwd: boundCwd(this.cwd),