@colbymchenry/codegraph-win32-arm64 1.6.0 → 1.6.1

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 (622) hide show
  1. package/bin/codegraph +5 -0
  2. package/lib/dist/.test-build-engine.json +1 -0
  3. package/lib/dist/.test-build-viewer.json +1 -0
  4. package/lib/dist/bin/codegraph.d.ts +1 -0
  5. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  6. package/lib/dist/bin/codegraph.js +599 -291
  7. package/lib/dist/bin/codegraph.js.map +1 -1
  8. package/lib/dist/bin/viewer-gate.d.ts +17 -0
  9. package/lib/dist/bin/viewer-gate.d.ts.map +1 -0
  10. package/lib/dist/bin/viewer-gate.js +31 -0
  11. package/lib/dist/bin/viewer-gate.js.map +1 -0
  12. package/lib/dist/context/index.d.ts.map +1 -1
  13. package/lib/dist/context/index.js +43 -2
  14. package/lib/dist/context/index.js.map +1 -1
  15. package/lib/dist/db/index.d.ts +21 -2
  16. package/lib/dist/db/index.d.ts.map +1 -1
  17. package/lib/dist/db/index.js +86 -31
  18. package/lib/dist/db/index.js.map +1 -1
  19. package/lib/dist/db/migrations.d.ts +1 -1
  20. package/lib/dist/db/migrations.d.ts.map +1 -1
  21. package/lib/dist/db/migrations.js +40 -1
  22. package/lib/dist/db/migrations.js.map +1 -1
  23. package/lib/dist/db/queries.d.ts +423 -3
  24. package/lib/dist/db/queries.d.ts.map +1 -1
  25. package/lib/dist/db/queries.js +1026 -33
  26. package/lib/dist/db/queries.js.map +1 -1
  27. package/lib/dist/db/schema.sql +11 -1
  28. package/lib/dist/db/sqlite-adapter.d.ts +2 -0
  29. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  30. package/lib/dist/db/sqlite-adapter.js +56 -7
  31. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  32. package/lib/dist/db/synthesis-stage.d.ts +12 -0
  33. package/lib/dist/db/synthesis-stage.d.ts.map +1 -0
  34. package/lib/dist/db/synthesis-stage.js +89 -0
  35. package/lib/dist/db/synthesis-stage.js.map +1 -0
  36. package/lib/dist/db/wal-valve.d.ts +32 -12
  37. package/lib/dist/db/wal-valve.d.ts.map +1 -1
  38. package/lib/dist/db/wal-valve.js +65 -22
  39. package/lib/dist/db/wal-valve.js.map +1 -1
  40. package/lib/dist/db/wsl-shared-index.d.ts +53 -0
  41. package/lib/dist/db/wsl-shared-index.d.ts.map +1 -0
  42. package/lib/dist/db/wsl-shared-index.js +121 -0
  43. package/lib/dist/db/wsl-shared-index.js.map +1 -0
  44. package/lib/dist/directory.d.ts +101 -2
  45. package/lib/dist/directory.d.ts.map +1 -1
  46. package/lib/dist/directory.js +254 -23
  47. package/lib/dist/directory.js.map +1 -1
  48. package/lib/dist/errors.d.ts +14 -0
  49. package/lib/dist/errors.d.ts.map +1 -1
  50. package/lib/dist/errors.js +16 -1
  51. package/lib/dist/errors.js.map +1 -1
  52. package/lib/dist/extraction/cfml-extractor.d.ts +1 -0
  53. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
  54. package/lib/dist/extraction/cfml-extractor.js +15 -3
  55. package/lib/dist/extraction/cfml-extractor.js.map +1 -1
  56. package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -1
  57. package/lib/dist/extraction/dfm-extractor.js +14 -10
  58. package/lib/dist/extraction/dfm-extractor.js.map +1 -1
  59. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  60. package/lib/dist/extraction/extraction-version.js +1 -1
  61. package/lib/dist/extraction/function-ref.d.ts +6 -4
  62. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  63. package/lib/dist/extraction/function-ref.js +35 -14
  64. package/lib/dist/extraction/function-ref.js.map +1 -1
  65. package/lib/dist/extraction/grammars.d.ts +38 -0
  66. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  67. package/lib/dist/extraction/grammars.js +77 -1
  68. package/lib/dist/extraction/grammars.js.map +1 -1
  69. package/lib/dist/extraction/index.d.ts +113 -15
  70. package/lib/dist/extraction/index.d.ts.map +1 -1
  71. package/lib/dist/extraction/index.js +599 -132
  72. package/lib/dist/extraction/index.js.map +1 -1
  73. package/lib/dist/extraction/languages/c-cpp.d.ts +58 -0
  74. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  75. package/lib/dist/extraction/languages/c-cpp.js +291 -15
  76. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  77. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  78. package/lib/dist/extraction/languages/dart.js +8 -3
  79. package/lib/dist/extraction/languages/dart.js.map +1 -1
  80. package/lib/dist/extraction/languages/javascript.js +1 -1
  81. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  82. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  83. package/lib/dist/extraction/languages/kotlin.js +169 -36
  84. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  85. package/lib/dist/extraction/languages/lua.d.ts.map +1 -1
  86. package/lib/dist/extraction/languages/lua.js +4 -1
  87. package/lib/dist/extraction/languages/lua.js.map +1 -1
  88. package/lib/dist/extraction/languages/python.d.ts.map +1 -1
  89. package/lib/dist/extraction/languages/python.js +71 -0
  90. package/lib/dist/extraction/languages/python.js.map +1 -1
  91. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  92. package/lib/dist/extraction/languages/rust.js +3 -0
  93. package/lib/dist/extraction/languages/rust.js.map +1 -1
  94. package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
  95. package/lib/dist/extraction/languages/scala.js +18 -3
  96. package/lib/dist/extraction/languages/scala.js.map +1 -1
  97. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  98. package/lib/dist/extraction/languages/typescript.js +9 -2
  99. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  100. package/lib/dist/extraction/liquid-extractor.d.ts +18 -0
  101. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  102. package/lib/dist/extraction/liquid-extractor.js +98 -22
  103. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  104. package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
  105. package/lib/dist/extraction/mybatis-extractor.js +6 -4
  106. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  107. package/lib/dist/extraction/syntax-tokens.d.ts +103 -0
  108. package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -0
  109. package/lib/dist/extraction/syntax-tokens.js +381 -0
  110. package/lib/dist/extraction/syntax-tokens.js.map +1 -0
  111. package/lib/dist/extraction/tree-sitter-helpers.d.ts +5 -0
  112. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  113. package/lib/dist/extraction/tree-sitter-helpers.js +17 -0
  114. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  115. package/lib/dist/extraction/tree-sitter-types.d.ts +29 -3
  116. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  117. package/lib/dist/extraction/tree-sitter.d.ts +96 -17
  118. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  119. package/lib/dist/extraction/tree-sitter.js +820 -82
  120. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  121. package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  122. package/lib/dist/file-limits.d.ts +40 -0
  123. package/lib/dist/file-limits.d.ts.map +1 -0
  124. package/lib/dist/file-limits.js +147 -0
  125. package/lib/dist/file-limits.js.map +1 -0
  126. package/lib/dist/graph/branch-guards.d.ts +248 -0
  127. package/lib/dist/graph/branch-guards.d.ts.map +1 -0
  128. package/lib/dist/graph/branch-guards.js +2231 -0
  129. package/lib/dist/graph/branch-guards.js.map +1 -0
  130. package/lib/dist/graph/dead-code.d.ts +251 -0
  131. package/lib/dist/graph/dead-code.d.ts.map +1 -0
  132. package/lib/dist/graph/dead-code.js +776 -0
  133. package/lib/dist/graph/dead-code.js.map +1 -0
  134. package/lib/dist/graph/dynamic-boundary-report.d.ts +121 -0
  135. package/lib/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
  136. package/lib/dist/graph/dynamic-boundary-report.js +283 -0
  137. package/lib/dist/graph/dynamic-boundary-report.js.map +1 -0
  138. package/lib/dist/graph/index.d.ts +4 -0
  139. package/lib/dist/graph/index.d.ts.map +1 -1
  140. package/lib/dist/graph/index.js +16 -1
  141. package/lib/dist/graph/index.js.map +1 -1
  142. package/lib/dist/graph/named-symbol-flow.d.ts +125 -0
  143. package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -0
  144. package/lib/dist/graph/named-symbol-flow.js +552 -0
  145. package/lib/dist/graph/named-symbol-flow.js.map +1 -0
  146. package/lib/dist/graph/symbol-lookup.d.ts +83 -0
  147. package/lib/dist/graph/symbol-lookup.d.ts.map +1 -0
  148. package/lib/dist/graph/symbol-lookup.js +181 -0
  149. package/lib/dist/graph/symbol-lookup.js.map +1 -0
  150. package/lib/dist/graph/traversal.d.ts +9 -0
  151. package/lib/dist/graph/traversal.d.ts.map +1 -1
  152. package/lib/dist/graph/traversal.js +61 -35
  153. package/lib/dist/graph/traversal.js.map +1 -1
  154. package/lib/dist/graph/type-hierarchy.d.ts +155 -0
  155. package/lib/dist/graph/type-hierarchy.d.ts.map +1 -0
  156. package/lib/dist/graph/type-hierarchy.js +382 -0
  157. package/lib/dist/graph/type-hierarchy.js.map +1 -0
  158. package/lib/dist/index.d.ts +251 -11
  159. package/lib/dist/index.d.ts.map +1 -1
  160. package/lib/dist/index.js +395 -34
  161. package/lib/dist/index.js.map +1 -1
  162. package/lib/dist/installer/index.d.ts.map +1 -1
  163. package/lib/dist/installer/index.js +3 -2
  164. package/lib/dist/installer/index.js.map +1 -1
  165. package/lib/dist/installer/targets/antigravity.d.ts.map +1 -1
  166. package/lib/dist/installer/targets/antigravity.js +14 -2
  167. package/lib/dist/installer/targets/antigravity.js.map +1 -1
  168. package/lib/dist/installer/targets/claude.d.ts +3 -0
  169. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  170. package/lib/dist/installer/targets/claude.js +35 -7
  171. package/lib/dist/installer/targets/claude.js.map +1 -1
  172. package/lib/dist/installer/targets/codex.d.ts +2 -1
  173. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  174. package/lib/dist/installer/targets/codex.js +14 -4
  175. package/lib/dist/installer/targets/codex.js.map +1 -1
  176. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
  177. package/lib/dist/installer/targets/copilot-cli.js +7 -1
  178. package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
  179. package/lib/dist/installer/targets/opencode.d.ts +16 -5
  180. package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
  181. package/lib/dist/installer/targets/opencode.js +73 -22
  182. package/lib/dist/installer/targets/opencode.js.map +1 -1
  183. package/lib/dist/installer/targets/shared.d.ts +14 -3
  184. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  185. package/lib/dist/installer/targets/shared.js +39 -11
  186. package/lib/dist/installer/targets/shared.js.map +1 -1
  187. package/lib/dist/installer/targets/types.d.ts +7 -0
  188. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  189. package/lib/dist/mcp/answer-freshness.d.ts +10 -0
  190. package/lib/dist/mcp/answer-freshness.d.ts.map +1 -0
  191. package/lib/dist/mcp/answer-freshness.js +68 -0
  192. package/lib/dist/mcp/answer-freshness.js.map +1 -0
  193. package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
  194. package/lib/dist/mcp/daemon-manager.js +16 -0
  195. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  196. package/lib/dist/mcp/daemon-paths.d.ts +2 -0
  197. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  198. package/lib/dist/mcp/daemon-paths.js +12 -3
  199. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  200. package/lib/dist/mcp/daemon-registry.d.ts +7 -4
  201. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  202. package/lib/dist/mcp/daemon-registry.js +91 -29
  203. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  204. package/lib/dist/mcp/daemon.d.ts +17 -7
  205. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  206. package/lib/dist/mcp/daemon.js +116 -24
  207. package/lib/dist/mcp/daemon.js.map +1 -1
  208. package/lib/dist/mcp/dynamic-boundaries.d.ts +1 -10
  209. package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
  210. package/lib/dist/mcp/dynamic-boundaries.js +46 -42
  211. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  212. package/lib/dist/mcp/engine.d.ts +28 -9
  213. package/lib/dist/mcp/engine.d.ts.map +1 -1
  214. package/lib/dist/mcp/engine.js +146 -62
  215. package/lib/dist/mcp/engine.js.map +1 -1
  216. package/lib/dist/mcp/explore-dedup.d.ts +5 -2
  217. package/lib/dist/mcp/explore-dedup.d.ts.map +1 -1
  218. package/lib/dist/mcp/explore-dedup.js +8 -5
  219. package/lib/dist/mcp/explore-dedup.js.map +1 -1
  220. package/lib/dist/mcp/index-freshness-worker.d.ts +2 -0
  221. package/lib/dist/mcp/index-freshness-worker.d.ts.map +1 -0
  222. package/lib/dist/mcp/index-freshness-worker.js +30 -0
  223. package/lib/dist/mcp/index-freshness-worker.js.map +1 -0
  224. package/lib/dist/mcp/index-freshness.d.ts +7 -0
  225. package/lib/dist/mcp/index-freshness.d.ts.map +1 -0
  226. package/lib/dist/mcp/index-freshness.js +94 -0
  227. package/lib/dist/mcp/index-freshness.js.map +1 -0
  228. package/lib/dist/mcp/index.d.ts +3 -1
  229. package/lib/dist/mcp/index.d.ts.map +1 -1
  230. package/lib/dist/mcp/index.js +95 -11
  231. package/lib/dist/mcp/index.js.map +1 -1
  232. package/lib/dist/mcp/liveness-watchdog.d.ts +4 -1
  233. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  234. package/lib/dist/mcp/liveness-watchdog.js +11 -2
  235. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  236. package/lib/dist/mcp/project-lifecycle.d.ts +9 -0
  237. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -0
  238. package/lib/dist/mcp/project-lifecycle.js +181 -0
  239. package/lib/dist/mcp/project-lifecycle.js.map +1 -0
  240. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  241. package/lib/dist/mcp/proxy.js +9 -0
  242. package/lib/dist/mcp/proxy.js.map +1 -1
  243. package/lib/dist/mcp/query-pool.d.ts +2 -2
  244. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  245. package/lib/dist/mcp/query-pool.js +9 -7
  246. package/lib/dist/mcp/query-pool.js.map +1 -1
  247. package/lib/dist/mcp/query-worker.js +2 -2
  248. package/lib/dist/mcp/query-worker.js.map +1 -1
  249. package/lib/dist/mcp/server-instructions.d.ts +1 -1
  250. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  251. package/lib/dist/mcp/server-instructions.js +6 -3
  252. package/lib/dist/mcp/server-instructions.js.map +1 -1
  253. package/lib/dist/mcp/startup-handshake.d.ts +3 -1
  254. package/lib/dist/mcp/startup-handshake.d.ts.map +1 -1
  255. package/lib/dist/mcp/startup-handshake.js +10 -2
  256. package/lib/dist/mcp/startup-handshake.js.map +1 -1
  257. package/lib/dist/mcp/tools.d.ts +276 -36
  258. package/lib/dist/mcp/tools.d.ts.map +1 -1
  259. package/lib/dist/mcp/tools.js +2295 -980
  260. package/lib/dist/mcp/tools.js.map +1 -1
  261. package/lib/dist/mcp/writer-lock.d.ts +61 -0
  262. package/lib/dist/mcp/writer-lock.d.ts.map +1 -0
  263. package/lib/dist/mcp/writer-lock.js +260 -0
  264. package/lib/dist/mcp/writer-lock.js.map +1 -0
  265. package/lib/dist/resolution/alias-binding.d.ts +56 -0
  266. package/lib/dist/resolution/alias-binding.d.ts.map +1 -0
  267. package/lib/dist/resolution/alias-binding.js +127 -0
  268. package/lib/dist/resolution/alias-binding.js.map +1 -0
  269. package/lib/dist/resolution/callback-synthesizer.d.ts +23 -1
  270. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  271. package/lib/dist/resolution/callback-synthesizer.js +291 -143
  272. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  273. package/lib/dist/resolution/cpp-constructor.d.ts +4 -0
  274. package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -0
  275. package/lib/dist/resolution/cpp-constructor.js +123 -0
  276. package/lib/dist/resolution/cpp-constructor.js.map +1 -0
  277. package/lib/dist/resolution/cpp-macro-visibility.d.ts +12 -0
  278. package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -0
  279. package/lib/dist/resolution/cpp-macro-visibility.js +342 -0
  280. package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -0
  281. package/lib/dist/resolution/expo-router-synthesizer.d.ts +32 -0
  282. package/lib/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
  283. package/lib/dist/resolution/expo-router-synthesizer.js +189 -0
  284. package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -0
  285. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  286. package/lib/dist/resolution/frameworks/csharp.js +96 -2
  287. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  288. package/lib/dist/resolution/frameworks/expo-router.d.ts +189 -0
  289. package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
  290. package/lib/dist/resolution/frameworks/expo-router.js +785 -0
  291. package/lib/dist/resolution/frameworks/expo-router.js.map +1 -0
  292. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  293. package/lib/dist/resolution/frameworks/express.js +251 -16
  294. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  295. package/lib/dist/resolution/frameworks/index.d.ts +5 -0
  296. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  297. package/lib/dist/resolution/frameworks/index.js +29 -1
  298. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  299. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  300. package/lib/dist/resolution/frameworks/java.js +79 -47
  301. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  302. package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
  303. package/lib/dist/resolution/frameworks/nestjs.js +6 -14
  304. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
  305. package/lib/dist/resolution/frameworks/nextjs.d.ts +76 -0
  306. package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
  307. package/lib/dist/resolution/frameworks/nextjs.js +328 -0
  308. package/lib/dist/resolution/frameworks/nextjs.js.map +1 -0
  309. package/lib/dist/resolution/frameworks/object-literal.d.ts +32 -0
  310. package/lib/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
  311. package/lib/dist/resolution/frameworks/object-literal.js +139 -0
  312. package/lib/dist/resolution/frameworks/object-literal.js.map +1 -0
  313. package/lib/dist/resolution/frameworks/package-deps.d.ts +14 -0
  314. package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
  315. package/lib/dist/resolution/frameworks/package-deps.js +78 -0
  316. package/lib/dist/resolution/frameworks/package-deps.js.map +1 -0
  317. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
  318. package/lib/dist/resolution/frameworks/python.js +166 -0
  319. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  320. package/lib/dist/resolution/frameworks/react-native.d.ts +26 -0
  321. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  322. package/lib/dist/resolution/frameworks/react-native.js +153 -14
  323. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  324. package/lib/dist/resolution/frameworks/react-router.d.ts +46 -0
  325. package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -0
  326. package/lib/dist/resolution/frameworks/react-router.js +187 -0
  327. package/lib/dist/resolution/frameworks/react-router.js.map +1 -0
  328. package/lib/dist/resolution/frameworks/react.d.ts +2 -1
  329. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  330. package/lib/dist/resolution/frameworks/react.js +188 -139
  331. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  332. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  333. package/lib/dist/resolution/frameworks/svelte.js +6 -1
  334. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  335. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
  336. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
  337. package/lib/dist/resolution/frameworks/sveltekit-router.js +156 -0
  338. package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
  339. package/lib/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
  340. package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
  341. package/lib/dist/resolution/frameworks/tanstack-router.js +437 -0
  342. package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -0
  343. package/lib/dist/resolution/frameworks/vue-router.d.ts +82 -0
  344. package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
  345. package/lib/dist/resolution/frameworks/vue-router.js +377 -0
  346. package/lib/dist/resolution/frameworks/vue-router.js.map +1 -0
  347. package/lib/dist/resolution/import-resolver.d.ts +38 -0
  348. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  349. package/lib/dist/resolution/import-resolver.js +376 -26
  350. package/lib/dist/resolution/import-resolver.js.map +1 -1
  351. package/lib/dist/resolution/index.d.ts +89 -25
  352. package/lib/dist/resolution/index.d.ts.map +1 -1
  353. package/lib/dist/resolution/index.js +552 -145
  354. package/lib/dist/resolution/index.js.map +1 -1
  355. package/lib/dist/resolution/js-builtins.d.ts +13 -0
  356. package/lib/dist/resolution/js-builtins.d.ts.map +1 -0
  357. package/lib/dist/resolution/js-builtins.js +46 -0
  358. package/lib/dist/resolution/js-builtins.js.map +1 -0
  359. package/lib/dist/resolution/name-matcher.d.ts +69 -22
  360. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  361. package/lib/dist/resolution/name-matcher.js +1902 -87
  362. package/lib/dist/resolution/name-matcher.js.map +1 -1
  363. package/lib/dist/resolution/next-router-synthesizer.d.ts +27 -0
  364. package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
  365. package/lib/dist/resolution/next-router-synthesizer.js +113 -0
  366. package/lib/dist/resolution/next-router-synthesizer.js.map +1 -0
  367. package/lib/dist/resolution/react-router-synthesizer.d.ts +33 -0
  368. package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
  369. package/lib/dist/resolution/react-router-synthesizer.js +126 -0
  370. package/lib/dist/resolution/react-router-synthesizer.js.map +1 -0
  371. package/lib/dist/resolution/resolver-pool.d.ts +2 -0
  372. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
  373. package/lib/dist/resolution/resolver-pool.js +4 -0
  374. package/lib/dist/resolution/resolver-pool.js.map +1 -1
  375. package/lib/dist/resolution/strip-comments.d.ts +6 -0
  376. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  377. package/lib/dist/resolution/strip-comments.js +58 -0
  378. package/lib/dist/resolution/strip-comments.js.map +1 -1
  379. package/lib/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
  380. package/lib/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
  381. package/lib/dist/resolution/sveltekit-synthesizer.js +173 -0
  382. package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -0
  383. package/lib/dist/resolution/synth-utils.d.ts +26 -0
  384. package/lib/dist/resolution/synth-utils.d.ts.map +1 -0
  385. package/lib/dist/resolution/synth-utils.js +75 -0
  386. package/lib/dist/resolution/synth-utils.js.map +1 -0
  387. package/lib/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
  388. package/lib/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
  389. package/lib/dist/resolution/tanstack-router-synthesizer.js +114 -0
  390. package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
  391. package/lib/dist/resolution/tier-synthesizer.d.ts +49 -0
  392. package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -0
  393. package/lib/dist/resolution/tier-synthesizer.js +931 -0
  394. package/lib/dist/resolution/tier-synthesizer.js.map +1 -0
  395. package/lib/dist/resolution/types.d.ts +78 -2
  396. package/lib/dist/resolution/types.d.ts.map +1 -1
  397. package/lib/dist/resolution/types.js +64 -0
  398. package/lib/dist/resolution/types.js.map +1 -1
  399. package/lib/dist/resolution/vue-router-synthesizer.d.ts +30 -0
  400. package/lib/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
  401. package/lib/dist/resolution/vue-router-synthesizer.js +115 -0
  402. package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -0
  403. package/lib/dist/search/query-paths.d.ts +50 -1
  404. package/lib/dist/search/query-paths.d.ts.map +1 -1
  405. package/lib/dist/search/query-paths.js +227 -12
  406. package/lib/dist/search/query-paths.js.map +1 -1
  407. package/lib/dist/search/query-utils.d.ts +15 -0
  408. package/lib/dist/search/query-utils.d.ts.map +1 -1
  409. package/lib/dist/search/query-utils.js +35 -7
  410. package/lib/dist/search/query-utils.js.map +1 -1
  411. package/lib/dist/sync/watch-policy.d.ts +14 -0
  412. package/lib/dist/sync/watch-policy.d.ts.map +1 -1
  413. package/lib/dist/sync/watch-policy.js +19 -0
  414. package/lib/dist/sync/watch-policy.js.map +1 -1
  415. package/lib/dist/sync/watcher.d.ts +52 -35
  416. package/lib/dist/sync/watcher.d.ts.map +1 -1
  417. package/lib/dist/sync/watcher.js +236 -100
  418. package/lib/dist/sync/watcher.js.map +1 -1
  419. package/lib/dist/telemetry/index.d.ts +4 -2
  420. package/lib/dist/telemetry/index.d.ts.map +1 -1
  421. package/lib/dist/telemetry/index.js +92 -41
  422. package/lib/dist/telemetry/index.js.map +1 -1
  423. package/lib/dist/types.d.ts +1 -1
  424. package/lib/dist/types.d.ts.map +1 -1
  425. package/lib/dist/types.js +1 -0
  426. package/lib/dist/types.js.map +1 -1
  427. package/lib/dist/ui-server/api/deadcode.d.ts +84 -0
  428. package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -0
  429. package/lib/dist/ui-server/api/deadcode.js +136 -0
  430. package/lib/dist/ui-server/api/deadcode.js.map +1 -0
  431. package/lib/dist/ui-server/api/effects.d.ts +87 -0
  432. package/lib/dist/ui-server/api/effects.d.ts.map +1 -0
  433. package/lib/dist/ui-server/api/effects.js +499 -0
  434. package/lib/dist/ui-server/api/effects.js.map +1 -0
  435. package/lib/dist/ui-server/api/entrypoints.d.ts +86 -0
  436. package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -0
  437. package/lib/dist/ui-server/api/entrypoints.js +279 -0
  438. package/lib/dist/ui-server/api/entrypoints.js.map +1 -0
  439. package/lib/dist/ui-server/api/events.d.ts +183 -0
  440. package/lib/dist/ui-server/api/events.d.ts.map +1 -0
  441. package/lib/dist/ui-server/api/events.js +430 -0
  442. package/lib/dist/ui-server/api/events.js.map +1 -0
  443. package/lib/dist/ui-server/api/file.d.ts +66 -0
  444. package/lib/dist/ui-server/api/file.d.ts.map +1 -0
  445. package/lib/dist/ui-server/api/file.js +235 -0
  446. package/lib/dist/ui-server/api/file.js.map +1 -0
  447. package/lib/dist/ui-server/api/filecode.d.ts +126 -0
  448. package/lib/dist/ui-server/api/filecode.d.ts.map +1 -0
  449. package/lib/dist/ui-server/api/filecode.js +205 -0
  450. package/lib/dist/ui-server/api/filecode.js.map +1 -0
  451. package/lib/dist/ui-server/api/flow.d.ts +226 -0
  452. package/lib/dist/ui-server/api/flow.d.ts.map +1 -0
  453. package/lib/dist/ui-server/api/flow.js +612 -0
  454. package/lib/dist/ui-server/api/flow.js.map +1 -0
  455. package/lib/dist/ui-server/api/hierarchy.d.ts +81 -0
  456. package/lib/dist/ui-server/api/hierarchy.d.ts.map +1 -0
  457. package/lib/dist/ui-server/api/hierarchy.js +92 -0
  458. package/lib/dist/ui-server/api/hierarchy.js.map +1 -0
  459. package/lib/dist/ui-server/api/index.d.ts +90 -0
  460. package/lib/dist/ui-server/api/index.d.ts.map +1 -0
  461. package/lib/dist/ui-server/api/index.js +332 -0
  462. package/lib/dist/ui-server/api/index.js.map +1 -0
  463. package/lib/dist/ui-server/api/map.d.ts +238 -0
  464. package/lib/dist/ui-server/api/map.d.ts.map +1 -0
  465. package/lib/dist/ui-server/api/map.js +681 -0
  466. package/lib/dist/ui-server/api/map.js.map +1 -0
  467. package/lib/dist/ui-server/api/node.d.ts +81 -0
  468. package/lib/dist/ui-server/api/node.d.ts.map +1 -0
  469. package/lib/dist/ui-server/api/node.js +388 -0
  470. package/lib/dist/ui-server/api/node.js.map +1 -0
  471. package/lib/dist/ui-server/api/nodes.d.ts +25 -0
  472. package/lib/dist/ui-server/api/nodes.d.ts.map +1 -0
  473. package/lib/dist/ui-server/api/nodes.js +45 -0
  474. package/lib/dist/ui-server/api/nodes.js.map +1 -0
  475. package/lib/dist/ui-server/api/program.d.ts +139 -0
  476. package/lib/dist/ui-server/api/program.d.ts.map +1 -0
  477. package/lib/dist/ui-server/api/program.js +315 -0
  478. package/lib/dist/ui-server/api/program.js.map +1 -0
  479. package/lib/dist/ui-server/api/respond.d.ts +76 -0
  480. package/lib/dist/ui-server/api/respond.d.ts.map +1 -0
  481. package/lib/dist/ui-server/api/respond.js +186 -0
  482. package/lib/dist/ui-server/api/respond.js.map +1 -0
  483. package/lib/dist/ui-server/api/route-roots.d.ts +39 -0
  484. package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -0
  485. package/lib/dist/ui-server/api/route-roots.js +96 -0
  486. package/lib/dist/ui-server/api/route-roots.js.map +1 -0
  487. package/lib/dist/ui-server/api/routes.d.ts +59 -0
  488. package/lib/dist/ui-server/api/routes.d.ts.map +1 -0
  489. package/lib/dist/ui-server/api/routes.js +108 -0
  490. package/lib/dist/ui-server/api/routes.js.map +1 -0
  491. package/lib/dist/ui-server/api/screens.d.ts +117 -0
  492. package/lib/dist/ui-server/api/screens.d.ts.map +1 -0
  493. package/lib/dist/ui-server/api/screens.js +611 -0
  494. package/lib/dist/ui-server/api/screens.js.map +1 -0
  495. package/lib/dist/ui-server/api/search.d.ts +29 -0
  496. package/lib/dist/ui-server/api/search.d.ts.map +1 -0
  497. package/lib/dist/ui-server/api/search.js +232 -0
  498. package/lib/dist/ui-server/api/search.js.map +1 -0
  499. package/lib/dist/ui-server/api/session.d.ts +52 -0
  500. package/lib/dist/ui-server/api/session.d.ts.map +1 -0
  501. package/lib/dist/ui-server/api/session.js +196 -0
  502. package/lib/dist/ui-server/api/session.js.map +1 -0
  503. package/lib/dist/ui-server/api/source.d.ts +200 -0
  504. package/lib/dist/ui-server/api/source.d.ts.map +1 -0
  505. package/lib/dist/ui-server/api/source.js +422 -0
  506. package/lib/dist/ui-server/api/source.js.map +1 -0
  507. package/lib/dist/ui-server/api/stats.d.ts +27 -0
  508. package/lib/dist/ui-server/api/stats.d.ts.map +1 -0
  509. package/lib/dist/ui-server/api/stats.js +164 -0
  510. package/lib/dist/ui-server/api/stats.js.map +1 -0
  511. package/lib/dist/ui-server/api/steps.d.ts +274 -0
  512. package/lib/dist/ui-server/api/steps.d.ts.map +1 -0
  513. package/lib/dist/ui-server/api/steps.js +1446 -0
  514. package/lib/dist/ui-server/api/steps.js.map +1 -0
  515. package/lib/dist/ui-server/api/trail-store.d.ts +142 -0
  516. package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -0
  517. package/lib/dist/ui-server/api/trail-store.js +323 -0
  518. package/lib/dist/ui-server/api/trail-store.js.map +1 -0
  519. package/lib/dist/ui-server/api/trails.d.ts +163 -0
  520. package/lib/dist/ui-server/api/trails.d.ts.map +1 -0
  521. package/lib/dist/ui-server/api/trails.js +369 -0
  522. package/lib/dist/ui-server/api/trails.js.map +1 -0
  523. package/lib/dist/ui-server/api/when.d.ts +125 -0
  524. package/lib/dist/ui-server/api/when.d.ts.map +1 -0
  525. package/lib/dist/ui-server/api/when.js +251 -0
  526. package/lib/dist/ui-server/api/when.js.map +1 -0
  527. package/lib/dist/ui-server/api/wire.d.ts +179 -0
  528. package/lib/dist/ui-server/api/wire.d.ts.map +1 -0
  529. package/lib/dist/ui-server/api/wire.js +231 -0
  530. package/lib/dist/ui-server/api/wire.js.map +1 -0
  531. package/lib/dist/ui-server/assets.d.ts +40 -0
  532. package/lib/dist/ui-server/assets.d.ts.map +1 -0
  533. package/lib/dist/ui-server/assets.js +110 -0
  534. package/lib/dist/ui-server/assets.js.map +1 -0
  535. package/lib/dist/ui-server/constants.d.ts +32 -0
  536. package/lib/dist/ui-server/constants.d.ts.map +1 -0
  537. package/lib/dist/ui-server/constants.js +35 -0
  538. package/lib/dist/ui-server/constants.js.map +1 -0
  539. package/lib/dist/ui-server/highlight/index.d.ts +113 -0
  540. package/lib/dist/ui-server/highlight/index.d.ts.map +1 -0
  541. package/lib/dist/ui-server/highlight/index.js +307 -0
  542. package/lib/dist/ui-server/highlight/index.js.map +1 -0
  543. package/lib/dist/ui-server/highlight/languages.d.ts +36 -0
  544. package/lib/dist/ui-server/highlight/languages.d.ts.map +1 -0
  545. package/lib/dist/ui-server/highlight/languages.js +50 -0
  546. package/lib/dist/ui-server/highlight/languages.js.map +1 -0
  547. package/lib/dist/ui-server/index.d.ts +92 -0
  548. package/lib/dist/ui-server/index.d.ts.map +1 -0
  549. package/lib/dist/ui-server/index.js +399 -0
  550. package/lib/dist/ui-server/index.js.map +1 -0
  551. package/lib/dist/ui-server/open-browser.d.ts +31 -0
  552. package/lib/dist/ui-server/open-browser.d.ts.map +1 -0
  553. package/lib/dist/ui-server/open-browser.js +79 -0
  554. package/lib/dist/ui-server/open-browser.js.map +1 -0
  555. package/lib/dist/ui-server/security.d.ts +127 -0
  556. package/lib/dist/ui-server/security.d.ts.map +1 -0
  557. package/lib/dist/ui-server/security.js +332 -0
  558. package/lib/dist/ui-server/security.js.map +1 -0
  559. package/lib/dist/ui-server/static.d.ts +45 -0
  560. package/lib/dist/ui-server/static.d.ts.map +1 -0
  561. package/lib/dist/ui-server/static.js +165 -0
  562. package/lib/dist/ui-server/static.js.map +1 -0
  563. package/lib/dist/utils.d.ts +14 -2
  564. package/lib/dist/utils.d.ts.map +1 -1
  565. package/lib/dist/utils.js +25 -10
  566. package/lib/dist/utils.js.map +1 -1
  567. package/lib/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  568. package/lib/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  569. package/lib/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  570. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
  571. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
  572. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  573. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  574. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  575. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  576. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  577. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  578. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
  579. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
  580. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  581. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  582. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  583. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  584. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  585. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  586. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
  587. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
  588. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  589. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  590. package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  591. package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  592. package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  593. package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  594. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
  595. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
  596. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  597. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  598. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  599. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  600. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  601. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  602. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
  603. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
  604. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  605. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  606. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  607. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  608. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  609. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  610. package/lib/dist/viewer/assets/index-CF9yvio6.css +1 -0
  611. package/lib/dist/viewer/assets/index-D4S7YUPf.js +97 -0
  612. package/lib/dist/viewer/index.html +16 -0
  613. package/lib/kernel/codegraph-kernel.node +2 -2
  614. package/lib/node_modules/.package-lock.json +4 -4
  615. package/lib/node_modules/picomatch/README.md +56 -51
  616. package/lib/node_modules/picomatch/lib/constants.js +4 -0
  617. package/lib/node_modules/picomatch/lib/parse.js +341 -1
  618. package/lib/node_modules/picomatch/lib/picomatch.js +25 -5
  619. package/lib/node_modules/picomatch/lib/scan.js +30 -18
  620. package/lib/node_modules/picomatch/package.json +4 -4
  621. package/lib/package.json +9 -2
  622. package/package.json +1 -1
@@ -45,21 +45,40 @@ exports.ReferenceResolver = void 0;
45
45
  exports.createResolver = createResolver;
46
46
  const fs = __importStar(require("fs"));
47
47
  const path = __importStar(require("path"));
48
+ const synthesis_stage_1 = require("../db/synthesis-stage");
49
+ const types_1 = require("./types");
48
50
  const name_matcher_1 = require("./name-matcher");
51
+ const cpp_macro_visibility_1 = require("./cpp-macro-visibility");
52
+ const cpp_constructor_1 = require("./cpp-constructor");
49
53
  const import_resolver_1 = require("./import-resolver");
50
54
  const resolver_pool_1 = require("./resolver-pool");
55
+ const alias_binding_1 = require("./alias-binding");
51
56
  const frameworks_1 = require("./frameworks");
52
57
  const callback_synthesizer_1 = require("./callback-synthesizer");
53
58
  const cooperative_yield_1 = require("./cooperative-yield");
59
+ const file_limits_1 = require("../file-limits");
54
60
  const path_aliases_1 = require("./path-aliases");
55
61
  const go_module_1 = require("./go-module");
56
62
  const workspace_packages_1 = require("./workspace-packages");
57
63
  const errors_1 = require("../errors");
64
+ const utils_1 = require("../utils");
58
65
  const lru_cache_1 = require("./lru-cache");
66
+ const js_builtins_1 = require("./js-builtins");
59
67
  /** Node kinds that can declare supertypes (extends/implements). */
60
68
  const SUPERTYPE_BEARING_KINDS = new Set([
61
69
  'class', 'struct', 'interface', 'trait', 'protocol', 'enum',
62
70
  ]);
71
+ /**
72
+ * The only edges resolving a reference reads (getSupertypes' walk). The batch
73
+ * loop commits a batch that made any of these before the next batch fans out;
74
+ * its other edges land while that batch resolves. A resolution strategy that
75
+ * reads another edge kind must be added here.
76
+ */
77
+ const RESOLUTION_READ_EDGE_KINDS = ['implements', 'extends'];
78
+ // SUPERTYPE_TARGET_KINDS (the kinds an extends/implements edge may TARGET)
79
+ // lives in ./types — the name-matcher needs the same set to restrict its
80
+ // candidate pool before ranking. It is deliberately wider than
81
+ // SUPERTYPE_BEARING_KINDS above, which is about the DECLARING side.
63
82
  /**
64
83
  * Languages whose chained static-factory/fluent calls defer to the conformance
65
84
  * second pass. Dotted-receiver languages resolve via matchDottedCallChain; the
@@ -92,13 +111,6 @@ function resolveCacheLimit() {
92
111
  // Re-export types
93
112
  __exportStar(require("./types"), exports);
94
113
  // Pre-built Sets for O(1) built-in lookups (allocated once, shared across all instances)
95
- const JS_BUILT_INS = new Set([
96
- 'console', 'window', 'document', 'global', 'process',
97
- 'Promise', 'Array', 'Object', 'String', 'Number', 'Boolean',
98
- 'Date', 'Math', 'JSON', 'RegExp', 'Error', 'Map', 'Set',
99
- 'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',
100
- 'fetch', 'require', 'module', 'exports', '__dirname', '__filename',
101
- ]);
102
114
  const REACT_HOOKS = new Set([
103
115
  'useState', 'useEffect', 'useContext', 'useReducer', 'useCallback',
104
116
  'useMemo', 'useRef', 'useLayoutEffect', 'useImperativeHandle', 'useDebugValue',
@@ -219,8 +231,9 @@ class ReferenceResolver {
219
231
  context;
220
232
  frameworks = [];
221
233
  // Chained static-factory/fluent call refs the first pass couldn't resolve,
222
- // collected in-memory (the batched resolver deletes unresolved refs from the
223
- // DB, so they can't be re-read). Drained by resolveChainedCallsViaConformance
234
+ // collected in-memory and left pending in the DB until the post-pass
235
+ // finishes, so a restart can recover the queue (#1577). Drained by
236
+ // resolveChainedCallsViaConformance
224
237
  // once implements/extends edges exist, to resolve methods on a supertype the
225
238
  // receiver conforms to (#750).
226
239
  deferredChainRefs = [];
@@ -229,6 +242,7 @@ class ReferenceResolver {
229
242
  // same reason as deferredChainRefs and drained by
230
243
  // resolveDeferredThisMemberRefs once implements/extends edges exist (#808).
231
244
  deferredThisMemberRefs = [];
245
+ deferredRowIds = new Set();
232
246
  // Per-`.razor`/`.cshtml`-file `@using` namespace set (own directives + folder
233
247
  // `_Imports.razor`, cascading to the project root). Used to disambiguate a
234
248
  // markup type ref to the right C# namespace.
@@ -244,6 +258,12 @@ class ReferenceResolver {
244
258
  lowerNameCache; // lower(name) → nodes cache
245
259
  qualifiedNameCache; // qualified_name → nodes cache
246
260
  fileLinesCache; // file → split lines cache
261
+ // id → node for the resolver's own point reads. Every resolved reference
262
+ // re-reads its target a few times (kind gate, language gate, alias
263
+ // following, edge creation) and targets recur ~5× on large repos; the query
264
+ // layer's cache is too small for that working set. Same stable window as the
265
+ // name caches above; absent ids are not cached.
266
+ nodeByIdCache;
247
267
  methodMatchCache; // lang\0Type::method → matching method nodes
248
268
  // Per-(language, methodName) owner index for getMethodMatches: buckets a
249
269
  // method name's candidates by their qualifiedName's last two segments so a
@@ -280,6 +300,8 @@ class ReferenceResolver {
280
300
  // resolution pass (same lifetime assumption as nameCache); clearCaches() resets
281
301
  // it between passes. Callers must treat the returned array as read-only.
282
302
  nodesByKindCache = new Map();
303
+ // Filesystem existence probes behind context.fileExists (paths not in knownFiles).
304
+ fileExistsMemo = new Map();
283
305
  knownNames = null; // all known symbol names for fast pre-filtering
284
306
  knownFiles = null;
285
307
  cachesWarmed = false;
@@ -308,6 +330,7 @@ class ReferenceResolver {
308
330
  // Split-lines arrays are heavier than content strings; refs arrive
309
331
  // file-ordered, so a small cache still hits nearly always.
310
332
  this.fileLinesCache = new lru_cache_1.LRUCache(contentLimit);
333
+ this.nodeByIdCache = new lru_cache_1.LRUCache(Math.max(limit * 4, 20_000));
311
334
  this.methodMatchCache = new lru_cache_1.LRUCache(limit);
312
335
  this.context = this.createContext();
313
336
  }
@@ -386,6 +409,16 @@ class ReferenceResolver {
386
409
  this.knownNames = names;
387
410
  this.cachesWarmed = true;
388
411
  }
412
+ /** `queries.getNodeById` through the resolver's own id → node cache. */
413
+ nodeById(id) {
414
+ const cached = this.nodeByIdCache.get(id);
415
+ if (cached !== undefined)
416
+ return cached;
417
+ const node = this.queries.getNodeById(id);
418
+ if (node)
419
+ this.nodeByIdCache.set(id, node);
420
+ return node;
421
+ }
389
422
  /**
390
423
  * Clear internal caches
391
424
  */
@@ -398,11 +431,13 @@ class ReferenceResolver {
398
431
  this.lowerNameCache.clear();
399
432
  this.qualifiedNameCache.clear();
400
433
  this.fileLinesCache.clear();
434
+ this.nodeByIdCache.clear();
401
435
  this.methodMatchCache.clear();
402
436
  this.methodOwnerIndexCache.clear();
403
437
  this.supertypeMemo.clear();
404
438
  this.supertypeGen++;
405
439
  this.nodesByKindCache.clear();
440
+ this.fileExistsMemo.clear();
406
441
  this.knownNames = null;
407
442
  this.knownFiles = null;
408
443
  this.cachesWarmed = false;
@@ -411,6 +446,7 @@ class ReferenceResolver {
411
446
  if (this.context) {
412
447
  (0, import_resolver_1.clearImportResolverMemos)(this.context);
413
448
  (0, name_matcher_1.clearNameMatcherMemos)(this.context);
449
+ (0, cpp_macro_visibility_1.clearCppMacroVisibility)(this.context);
414
450
  }
415
451
  }
416
452
  /** `readFile` through the LRU content cache (null = read failed, also cached). */
@@ -420,6 +456,14 @@ class ReferenceResolver {
420
456
  }
421
457
  const fullPath = path.join(this.projectRoot, filePath);
422
458
  try {
459
+ // Import resolvers may follow package metadata to an archive (`file:*.har`,
460
+ // for example). Reject anything extraction would not accept before UTF-8
461
+ // decoding can multiply a large binary blob into gigabytes of V8 heap.
462
+ const stats = fs.statSync(fullPath);
463
+ if (!stats.isFile() || stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
464
+ this.fileCache.set(filePath, null);
465
+ return null;
466
+ }
423
467
  const content = fs.readFileSync(fullPath, 'utf-8');
424
468
  this.fileCache.set(filePath, content);
425
469
  return content;
@@ -430,17 +474,49 @@ class ReferenceResolver {
430
474
  return null;
431
475
  }
432
476
  }
477
+ /**
478
+ * `readFileCached(filePath)?.includes(needle)` for an ASCII needle, searched
479
+ * in the raw bytes: an ASCII byte sequence survives UTF-8 decoding
480
+ * unchanged, and decoding is most of reading a file nobody keeps.
481
+ */
482
+ fileContains(filePath, needle) {
483
+ if (this.fileCache.has(filePath))
484
+ return this.fileCache.get(filePath)?.includes(needle) ?? false;
485
+ const fullPath = path.join(this.projectRoot, filePath);
486
+ try {
487
+ const stats = fs.statSync(fullPath);
488
+ if (!stats.isFile() || stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES)
489
+ return false;
490
+ return fs.readFileSync(fullPath).includes(needle);
491
+ }
492
+ catch {
493
+ return false;
494
+ }
495
+ }
433
496
  /**
434
497
  * Create the resolution context
435
498
  */
436
499
  createContext() {
437
500
  return {
501
+ resolveImport: (ref) => (0, import_resolver_1.resolveViaImport)(ref, this.context),
438
502
  getNodesInFile: (filePath) => {
439
503
  if (!this.nodeCache.has(filePath)) {
440
504
  this.nodeCache.set(filePath, this.queries.getNodesByFile(filePath));
441
505
  }
442
506
  return this.nodeCache.get(filePath);
443
507
  },
508
+ fileHasExportedNode: (filePath) => {
509
+ const cached = this.nodeCache.get(filePath);
510
+ return cached !== undefined ? cached.some((n) => n.isExported) : this.queries.fileHasExportedNode(filePath);
511
+ },
512
+ getExportedNodesInFile: (filePath) => {
513
+ const cached = this.nodeCache.get(filePath);
514
+ return cached !== undefined ? cached.filter((n) => n.isExported) : this.queries.getExportedNodesByFile(filePath);
515
+ },
516
+ getNodesInFileNamed: (filePath, name) => {
517
+ const cached = this.nodeCache.get(filePath);
518
+ return cached !== undefined ? cached.filter((n) => n.name === name) : this.queries.getNodesByFileAndName(filePath, name);
519
+ },
444
520
  getNodesByName: (name) => {
445
521
  const cached = this.nameCache.get(name);
446
522
  if (cached !== undefined)
@@ -471,7 +547,7 @@ class ReferenceResolver {
471
547
  for (const m of candidates) {
472
548
  if (m.kind !== 'method')
473
549
  continue;
474
- if (m.language !== language)
550
+ if (!(0, name_matcher_1.sameLanguageFamily)(m.language, language))
475
551
  continue;
476
552
  const qn = m.qualifiedName;
477
553
  if (qn === want || qn.endsWith(`::${want}`))
@@ -498,7 +574,7 @@ class ReferenceResolver {
498
574
  for (const m of candidates) {
499
575
  if (m.kind !== 'method')
500
576
  continue;
501
- if (m.language !== language)
577
+ if (!(0, name_matcher_1.sameLanguageFamily)(m.language, language))
502
578
  continue;
503
579
  const qn = m.qualifiedName;
504
580
  const i2 = qn.lastIndexOf('::');
@@ -548,17 +624,40 @@ class ReferenceResolver {
548
624
  return true;
549
625
  }
550
626
  }
551
- // Fall back to filesystem for files not yet indexed
552
- const fullPath = path.join(this.projectRoot, filePath);
553
- try {
554
- return fs.existsSync(fullPath);
555
- }
556
- catch (error) {
557
- (0, errors_1.logDebug)('Error checking file existence', { filePath, error: String(error) });
558
- return false;
627
+ // Fall back to filesystem for files not yet indexed. `path.join` does
628
+ // not clamp, and relative-import resolution hands us paths carrying
629
+ // `../` segments, so the probe has to be contained (#1631): a path
630
+ // outside the root can never be an indexed project file, and the
631
+ // `knownFiles` check above already answered for everything that is.
632
+ // Lexical containment only: this is a per-candidate hot path, and the
633
+ // symlink half of `validatePathWithinRoot` costs two `realpathSync`
634
+ // calls per probe (~70x slower here). It would also be wrong to apply
635
+ // — indexing deliberately follows in-root symlinks whose targets live
636
+ // outside the root (#935), so only the `../` escape is refused.
637
+ // Memoized: import resolution probes the same candidate paths (every
638
+ // extension of a specifier) from every file that imports it, and the
639
+ // tree does not change within a resolution pass (same window as the
640
+ // file-content cache; dropped by clearCaches).
641
+ const probed = this.fileExistsMemo.get(filePath);
642
+ if (probed !== undefined)
643
+ return probed;
644
+ const fullPath = (0, utils_1.lexicalPathWithinRoot)(this.projectRoot, filePath);
645
+ let exists = false;
646
+ if (fullPath !== null) {
647
+ try {
648
+ exists = fs.existsSync(fullPath);
649
+ }
650
+ catch (error) {
651
+ (0, errors_1.logDebug)('Error checking file existence', { filePath, error: String(error) });
652
+ }
559
653
  }
654
+ if (this.fileExistsMemo.size >= 200_000)
655
+ this.fileExistsMemo.clear();
656
+ this.fileExistsMemo.set(filePath, exists);
657
+ return exists;
560
658
  },
561
659
  readFile: (filePath) => this.readFileCached(filePath),
660
+ fileContains: (filePath, needle) => this.fileContains(filePath, needle),
562
661
  getFileLines: (filePath) => {
563
662
  const cached = this.fileLinesCache.get(filePath);
564
663
  if (cached !== undefined)
@@ -599,7 +698,7 @@ class ReferenceResolver {
599
698
  return result;
600
699
  },
601
700
  getNodeById: (id) => {
602
- return this.queries.getNodeById(id);
701
+ return this.nodeById(id);
603
702
  },
604
703
  getSupertypes: (typeName, language) => {
605
704
  // Union the `implements`/`extends` targets of every same-named type node.
@@ -616,7 +715,9 @@ class ReferenceResolver {
616
715
  return hit.supers;
617
716
  const typeNodes = this.context
618
717
  .getNodesByName(typeName)
619
- .filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) && n.language === language);
718
+ // Scala singletons can inherit members even though they cannot be parents.
719
+ .filter((n) => n.language === language && (SUPERTYPE_BEARING_KINDS.has(n.kind) ||
720
+ (n.language === 'scala' && n.kind === 'module')));
620
721
  let supers;
621
722
  if (typeNodes.length === 0) {
622
723
  supers = [];
@@ -624,8 +725,8 @@ class ReferenceResolver {
624
725
  else {
625
726
  const supertypes = new Set();
626
727
  for (const tn of typeNodes) {
627
- for (const edge of this.queries.getOutgoingEdges(tn.id, ['implements', 'extends'])) {
628
- const target = this.queries.getNodeById(edge.target);
728
+ for (const edge of this.queries.getOutgoingEdges(tn.id, RESOLUTION_READ_EDGE_KINDS)) {
729
+ const target = this.nodeById(edge.target);
629
730
  if (target?.name && target.name !== typeName)
630
731
  supertypes.add(target.name);
631
732
  }
@@ -699,6 +800,7 @@ class ReferenceResolver {
699
800
  resolveAll(unresolvedRefs, onProgress) {
700
801
  // Pre-load all nodes into memory for fast lookups
701
802
  this.warmCaches();
803
+ this.advanceSupertypeGeneration();
702
804
  const resolved = [];
703
805
  const unresolved = [];
704
806
  const byMethod = {};
@@ -844,9 +946,46 @@ class ReferenceResolver {
844
946
  return false;
845
947
  }
846
948
  /**
847
- * Resolve a single reference
949
+ * Resolve a single reference.
950
+ *
951
+ * Thin decorator over `resolveOneInner` so every strategy — framework,
952
+ * import, name-match, chain, CFML component path — passes through the
953
+ * inheritance target-kind gate at ONE seam. Filtering inside the
954
+ * name-matcher would have covered `matchByExactName` only.
955
+ * Calls that land on an alias binding then forward once to the callable
956
+ * the alias names (see ./alias-binding), regardless of the strategy.
848
957
  */
849
958
  resolveOne(ref) {
959
+ // A C/C++ "call" whose name is a function-like macro visible in this
960
+ // translation unit is a macro expansion, not a call — it must never bind
961
+ // to a same-named function in another file (#1838).
962
+ if ((0, cpp_macro_visibility_1.isVisibleCppMacro)(ref, this.context))
963
+ return null;
964
+ const candidate = this.gateTargetKind(this.resolveOneInner(ref), ref);
965
+ const resolved = candidate?.resolvedBy === 'framework'
966
+ ? this.gateFrameworkLanguage(candidate, ref)
967
+ : this.gateLanguage(candidate, ref);
968
+ if (!resolved || ref.referenceKind !== 'calls')
969
+ return resolved;
970
+ const target = this.nodeById(resolved.targetNodeId);
971
+ if (!target)
972
+ return resolved;
973
+ const dot = ref.referenceName.lastIndexOf('.');
974
+ const memberName = dot >= 0 ? ref.referenceName.slice(dot + 1) : null;
975
+ const forwarded = (0, alias_binding_1.resolveAliasBinding)(target, memberName, this.context);
976
+ if (!forwarded || forwarded.id === resolved.targetNodeId)
977
+ return resolved;
978
+ return this.gateLanguage({
979
+ ...resolved,
980
+ targetNodeId: forwarded.id,
981
+ confidence: Math.min(resolved.confidence, 0.85),
982
+ }, ref);
983
+ }
984
+ resolveOneInner(ref) {
985
+ // A local C++ object construction (`T obj(args)`, ref `ns::T::T/1`)
986
+ // resolves ONLY to a constructor of the lexically nearest `T` (#1839).
987
+ if ((0, cpp_constructor_1.isCppConstructorRef)(ref))
988
+ return (0, cpp_constructor_1.matchCppConstructor)(ref, this.context);
850
989
  // Skip built-in/external references
851
990
  if (this.isBuiltInOrExternal(ref)) {
852
991
  return null;
@@ -891,7 +1030,7 @@ class ReferenceResolver {
891
1030
  if (this.profileStages)
892
1031
  this.stageAdd('preFilter', ref, preFilterPass, tPre);
893
1032
  if (!preFilterPass) {
894
- return null;
1033
+ return this.gateLanguage((0, name_matcher_1.matchJsStoreBindingCall)(ref, this.context), ref);
895
1034
  }
896
1035
  // Function-as-value refs (#756) get a dedicated, strictly-gated path:
897
1036
  // import-based resolution first (an imported callback resolves through its
@@ -904,9 +1043,12 @@ class ReferenceResolver {
904
1043
  if (ref.referenceName.startsWith('this.')) {
905
1044
  return this.gateLanguage(this.resolveThisMemberFnRef(ref), ref);
906
1045
  }
1046
+ if ((ref.language === 'python' || ref.language === 'go') && ref.referenceName.includes('.')) {
1047
+ return this.gateLanguage((0, name_matcher_1.matchFunctionRef)(ref, this.context), ref);
1048
+ }
907
1049
  const viaImport = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
908
1050
  if (viaImport) {
909
- const target = this.queries.getNodeById(viaImport.targetNodeId);
1051
+ const target = this.nodeById(viaImport.targetNodeId);
910
1052
  if (target &&
911
1053
  (target.kind === 'function' ||
912
1054
  target.kind === 'method' ||
@@ -938,12 +1080,16 @@ class ReferenceResolver {
938
1080
  if (razorResult)
939
1081
  return razorResult;
940
1082
  }
1083
+ // An explicit PHP class import owns its static calls, including an
1084
+ // unavailable method. Do not let same-name fallbacks change the receiver
1085
+ // to an unrelated Service/Repository type (#1545).
1086
+ const phpStaticImport = (0, import_resolver_1.resolvePhpImportedStaticCall)(ref, this.context);
1087
+ if (phpStaticImport !== undefined)
1088
+ return this.gateLanguage(phpStaticImport, ref);
941
1089
  const candidates = [];
942
1090
  // Strategy 1: Try framework-specific resolution. Cross-language bridges
943
1091
  // are deliberately preserved (Drupal `routing.yml` → PHP controller, RN
944
- // JS → native `calls`) — `gateFrameworkLanguage` only drops a type/import
945
- // edge between two KNOWN families (see its doc), never a `calls` bridge or
946
- // a config↔code edge.
1092
+ // JS → native `calls`); other code references obey the shared family gate.
947
1093
  const tFw = this.profileStages ? process.hrtime.bigint() : 0n;
948
1094
  let fwEarly = null;
949
1095
  for (const framework of this.frameworks) {
@@ -960,7 +1106,21 @@ class ReferenceResolver {
960
1106
  this.stageAdd('frameworks', ref, fwEarly !== null, tFw);
961
1107
  if (fwEarly)
962
1108
  return fwEarly;
1109
+ // A retained untyped chain supplies effect/call-site evidence only. In
1110
+ // particular, importing its root does not make the root its call target.
1111
+ if ((0, name_matcher_1.isUnresolvedJsMemberCall)(ref))
1112
+ return null;
963
1113
  // Strategy 2: Try import-based resolution
1114
+ // A TS/JS/Python call-receiver chain (`useStore.getState().reset`, #1683)
1115
+ // names the ROOT's import, not the method's: letting resolveViaImport see
1116
+ // it binds the call to the imported store constant and the method is
1117
+ // never looked up. The name-matcher owns the chain shape for these
1118
+ // languages — the Java/Kotlin/C++ chains keep their existing path.
1119
+ if (ref.referenceKind === 'calls' &&
1120
+ CHAIN_SHAPE.test(ref.referenceName) &&
1121
+ (ref.language === 'typescript' || ref.language === 'javascript' || ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'python')) {
1122
+ return this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
1123
+ }
964
1124
  const tImp = this.profileStages ? process.hrtime.bigint() : 0n;
965
1125
  const importResult = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
966
1126
  if (this.profileStages)
@@ -997,8 +1157,15 @@ class ReferenceResolver {
997
1157
  // matcher would link each `mkOption` call to whichever file's inherit
998
1158
  // binding it happened to pick. Same-file matches only.
999
1159
  if (nameResult) {
1000
- const target = this.queries.getNodeById(nameResult.targetNodeId);
1001
- if (ref.language === 'nix') {
1160
+ const target = this.nodeById(nameResult.targetNodeId);
1161
+ // A definition its language makes file-local — a C `static`, a Kotlin
1162
+ // `private fun`, a Go unexported name in another package, a Rust
1163
+ // non-`pub` item outside its module subtree — cannot be what a name in
1164
+ // another file means, whichever strategy chose it (#1730).
1165
+ if (target && !(0, name_matcher_1.isVisibleAcrossFiles)(target, ref, this.context)) {
1166
+ nameResult = null;
1167
+ }
1168
+ else if (ref.language === 'nix') {
1002
1169
  if (!target || target.filePath !== ref.filePath) {
1003
1170
  nameResult = null;
1004
1171
  }
@@ -1021,7 +1188,7 @@ class ReferenceResolver {
1021
1188
  if (ref.referenceKind === 'calls' &&
1022
1189
  CHAIN_LANGUAGES.has(ref.language) &&
1023
1190
  CHAIN_SHAPE.test(ref.referenceName)) {
1024
- this.deferredChainRefs.push(ref);
1191
+ this.deferReference(ref, this.deferredChainRefs);
1025
1192
  }
1026
1193
  else if (
1027
1194
  // PHP `$this->prop->method()` (encoded `this->prop.method`): its method
@@ -1030,7 +1197,7 @@ class ReferenceResolver {
1030
1197
  ref.referenceKind === 'calls' &&
1031
1198
  ref.language === 'php' &&
1032
1199
  PHP_PROP_SHAPE.test(ref.referenceName)) {
1033
- this.deferredChainRefs.push(ref);
1200
+ this.deferReference(ref, this.deferredChainRefs);
1034
1201
  }
1035
1202
  return null;
1036
1203
  }
@@ -1041,18 +1208,19 @@ class ReferenceResolver {
1041
1208
  * Create edges from resolved references
1042
1209
  */
1043
1210
  createEdges(resolved) {
1044
- return resolved.map((ref) => {
1211
+ return resolved.flatMap((ref) => {
1045
1212
  // `function_ref` (#756) is internal-only: it persists as a `references`
1046
1213
  // edge (the registration site depends on the callback), distinguishable
1047
1214
  // by metadata.resolvedBy === 'function-ref'. callers/impact already
1048
1215
  // traverse `references`, so registration sites surface with no
1049
1216
  // graph-layer changes.
1050
- let kind = ref.original.referenceKind === 'function_ref' ? 'references' : ref.original.referenceKind;
1217
+ let kind = ref.edgeKind ??
1218
+ (ref.original.referenceKind === 'function_ref' ? 'references' : ref.original.referenceKind);
1051
1219
  // Promote "extends" to "implements" when a class/struct targets an interface
1052
1220
  if (kind === 'extends') {
1053
- const targetNode = this.queries.getNodeById(ref.targetNodeId);
1221
+ const targetNode = this.nodeById(ref.targetNodeId);
1054
1222
  if (targetNode && (targetNode.kind === 'interface' || targetNode.kind === 'protocol')) {
1055
- const sourceNode = this.queries.getNodeById(ref.original.fromNodeId);
1223
+ const sourceNode = this.nodeById(ref.original.fromNodeId);
1056
1224
  if (sourceNode && sourceNode.kind !== 'interface' && sourceNode.kind !== 'protocol') {
1057
1225
  kind = 'implements';
1058
1226
  }
@@ -1064,19 +1232,27 @@ class ReferenceResolver {
1064
1232
  // apart from a function call without symbol info, but resolution
1065
1233
  // can: if `Foo` resolves to a class, the call IS an instantiation.
1066
1234
  if (kind === 'calls') {
1067
- const targetNode = this.queries.getNodeById(ref.targetNodeId);
1235
+ const targetNode = this.nodeById(ref.targetNodeId);
1068
1236
  if (targetNode &&
1069
1237
  (targetNode.kind === 'class' || targetNode.kind === 'struct' || targetNode.kind === 'union')) {
1070
1238
  kind = 'instantiates';
1071
1239
  }
1072
1240
  }
1073
- return {
1241
+ // One reference can name several targets — a navigation whose
1242
+ // destination is a conditional reaches every arm. Each becomes its own
1243
+ // edge, sharing this resolution's kind and confidence.
1244
+ const targets = [
1245
+ { targetNodeId: ref.targetNodeId, metadata: ref.metadata },
1246
+ ...(ref.alsoTargets ?? []),
1247
+ ];
1248
+ return targets.map((t) => ({
1074
1249
  source: ref.original.fromNodeId,
1075
- target: ref.targetNodeId,
1250
+ target: t.targetNodeId,
1076
1251
  kind,
1077
1252
  line: ref.original.line,
1078
1253
  column: ref.original.column,
1079
1254
  metadata: {
1255
+ ...(t.metadata ?? {}),
1080
1256
  confidence: ref.confidence,
1081
1257
  resolvedBy: ref.resolvedBy,
1082
1258
  // The ORIGINAL reference text (and kind, when edge-kind promotion
@@ -1097,7 +1273,7 @@ class ReferenceResolver {
1097
1273
  // exactly the edges this feature added.
1098
1274
  ...(ref.original.referenceKind === 'function_ref' ? { fnRef: true } : {}),
1099
1275
  },
1100
- };
1276
+ }));
1101
1277
  });
1102
1278
  }
1103
1279
  /**
@@ -1146,10 +1322,25 @@ class ReferenceResolver {
1146
1322
  }
1147
1323
  return { byRowId, legacyKeys };
1148
1324
  }
1325
+ /** A deferred attempt is unfinished work, not a final failure (#1577). */
1326
+ nonDeferredFailures(unresolved) {
1327
+ return unresolved.filter((ref) => ref.rowId == null || !this.deferredRowIds.has(ref.rowId));
1328
+ }
1329
+ deferReference(ref, queue) {
1330
+ queue.push(ref);
1331
+ if (ref.rowId != null)
1332
+ this.deferredRowIds.add(ref.rowId);
1333
+ }
1149
1334
  /**
1150
1335
  * Resolve and persist edges to database
1151
1336
  */
1152
1337
  resolveAndPersist(unresolvedRefs, onProgress) {
1338
+ const prerequisites = unresolvedRefs.filter(ReferenceResolver.isPrerequisite);
1339
+ if (prerequisites.length > 0 && prerequisites.length < unresolvedRefs.length) {
1340
+ const first = this.resolveAndPersist(prerequisites, (current) => onProgress?.(current, unresolvedRefs.length));
1341
+ const rest = this.resolveAndPersist(unresolvedRefs.filter((ref) => !ReferenceResolver.isPrerequisite(ref)), (current) => onProgress?.(prerequisites.length + current, unresolvedRefs.length));
1342
+ return ReferenceResolver.mergeResults(first, rest);
1343
+ }
1153
1344
  const result = this.resolveAll(unresolvedRefs, onProgress);
1154
1345
  // Create edges from resolved references
1155
1346
  const edges = this.createEdges(result.resolved);
@@ -1173,7 +1364,7 @@ class ReferenceResolver {
1173
1364
  // is still 'pending', so any pending row at rest belongs to an
1174
1365
  // interrupted run and the sweep can key off the pending count.
1175
1366
  if (result.unresolved.length > 0) {
1176
- const { byRowId, legacyKeys } = ReferenceResolver.partitionFailedCleanup(result.unresolved);
1367
+ const { byRowId, legacyKeys } = ReferenceResolver.partitionFailedCleanup(this.nonDeferredFailures(result.unresolved));
1177
1368
  this.queries.markReferencesFailedByRowIds(byRowId);
1178
1369
  this.queries.markReferencesFailed(legacyKeys);
1179
1370
  }
@@ -1189,8 +1380,18 @@ class ReferenceResolver {
1189
1380
  * a large edit lands many popular symbol names at once.
1190
1381
  */
1191
1382
  async resolveAndPersistListYielding(refs) {
1383
+ const prerequisites = refs.filter(ReferenceResolver.isPrerequisite);
1384
+ if (prerequisites.length > 0 && prerequisites.length < refs.length) {
1385
+ const first = await this.resolveAndPersistListYielding(prerequisites);
1386
+ const rest = await this.resolveAndPersistListYielding(refs.filter((ref) => !ReferenceResolver.isPrerequisite(ref)));
1387
+ return ReferenceResolver.mergeResults(first, rest);
1388
+ }
1192
1389
  const maybeYield = (0, cooperative_yield_1.createYielder)();
1193
1390
  const result = await this.resolveBatchYielding(refs, maybeYield);
1391
+ await this.persistResolutionResult(result, maybeYield);
1392
+ return result;
1393
+ }
1394
+ async persistResolutionResult(result, maybeYield) {
1194
1395
  const PERSIST_CHUNK = 1000;
1195
1396
  const edges = this.createEdges(result.resolved);
1196
1397
  for (let i = 0; i < edges.length; i += PERSIST_CHUNK) {
@@ -1206,7 +1407,7 @@ class ReferenceResolver {
1206
1407
  this.queries.deleteSpecificResolvedReferences(resolvedCleanup.legacyKeys.slice(i, i + PERSIST_CHUNK));
1207
1408
  await maybeYield();
1208
1409
  }
1209
- const failedCleanup = ReferenceResolver.partitionFailedCleanup(result.unresolved);
1410
+ const failedCleanup = ReferenceResolver.partitionFailedCleanup(this.nonDeferredFailures(result.unresolved));
1210
1411
  for (let i = 0; i < failedCleanup.byRowId.length; i += PERSIST_CHUNK) {
1211
1412
  this.queries.markReferencesFailedByRowIds(failedCleanup.byRowId.slice(i, i + PERSIST_CHUNK));
1212
1413
  await maybeYield();
@@ -1215,7 +1416,43 @@ class ReferenceResolver {
1215
1416
  this.queries.markReferencesFailed(failedCleanup.legacyKeys.slice(i, i + PERSIST_CHUNK));
1216
1417
  await maybeYield();
1217
1418
  }
1218
- return result;
1419
+ return edges.length;
1420
+ }
1421
+ /** Finalize the durable queue only AFTER its edges have been inserted. */
1422
+ async persistDeferredReferences(deferred, resolved) {
1423
+ for (const ref of deferred)
1424
+ if (ref.rowId != null)
1425
+ this.deferredRowIds.delete(ref.rowId);
1426
+ const matched = new Set(resolved.map((ref) => ref.original));
1427
+ const unresolved = deferred.filter((ref) => !matched.has(ref));
1428
+ const count = await this.persistResolutionResult({
1429
+ resolved,
1430
+ unresolved,
1431
+ stats: { total: deferred.length, resolved: resolved.length, unresolved: unresolved.length, byMethod: {} },
1432
+ }, (0, cooperative_yield_1.createYielder)());
1433
+ if (count > 0)
1434
+ this.clearCaches();
1435
+ return count;
1436
+ }
1437
+ /** Same two phases as the bounded DB reader: persist wiring before calls. */
1438
+ static isPrerequisite(ref) {
1439
+ return ref.referenceKind === 'imports' || ref.referenceKind === 'extends' || ref.referenceKind === 'implements';
1440
+ }
1441
+ static mergeResults(first, rest) {
1442
+ const byMethod = { ...first.stats.byMethod };
1443
+ for (const [method, count] of Object.entries(rest.stats.byMethod)) {
1444
+ byMethod[method] = (byMethod[method] ?? 0) + count;
1445
+ }
1446
+ return {
1447
+ resolved: first.resolved.concat(rest.resolved),
1448
+ unresolved: first.unresolved.concat(rest.unresolved),
1449
+ stats: {
1450
+ total: first.stats.total + rest.stats.total,
1451
+ resolved: first.stats.resolved + rest.stats.resolved,
1452
+ unresolved: first.stats.unresolved + rest.stats.unresolved,
1453
+ byMethod,
1454
+ },
1455
+ };
1219
1456
  }
1220
1457
  /**
1221
1458
  * Second resolution pass for chained static-factory / fluent calls whose
@@ -1259,14 +1496,7 @@ class ReferenceResolver {
1259
1496
  resolved.push(match);
1260
1497
  await maybeYield();
1261
1498
  }
1262
- if (resolved.length === 0)
1263
- return 0;
1264
- const edges = this.createEdges(resolved);
1265
- if (edges.length > 0) {
1266
- this.queries.insertEdges(edges);
1267
- this.clearCaches();
1268
- }
1269
- return edges.length;
1499
+ return this.persistDeferredReferences(deferred, resolved);
1270
1500
  }
1271
1501
  /**
1272
1502
  * Resolve one batch with a yield checkpoint between EVERY ref so the #850
@@ -1418,6 +1648,7 @@ class ReferenceResolver {
1418
1648
  unresolved.push(ref);
1419
1649
  }
1420
1650
  }
1651
+ this.deferredRowIds.clear(); // the admission side now owns both queues
1421
1652
  return {
1422
1653
  resolved,
1423
1654
  unresolved,
@@ -1440,8 +1671,10 @@ class ReferenceResolver {
1440
1671
  * would have.
1441
1672
  */
1442
1673
  appendDeferredFromWorkers(deferredChain, deferredThisMember) {
1443
- this.deferredChainRefs.push(...deferredChain);
1444
- this.deferredThisMemberRefs.push(...deferredThisMember);
1674
+ for (const ref of deferredChain)
1675
+ this.deferReference(ref, this.deferredChainRefs);
1676
+ for (const ref of deferredThisMember)
1677
+ this.deferReference(ref, this.deferredThisMemberRefs);
1445
1678
  }
1446
1679
  /**
1447
1680
  * Resolve and persist in batches to keep memory bounded.
@@ -1460,7 +1693,7 @@ class ReferenceResolver {
1460
1693
  // the valve's timer-driven passive passes stay perpetually partial against
1461
1694
  // the pool's continuous reads, which is how a kernel-scale resolution grew
1462
1695
  // a 22GB WAL on a 4.6GB DB (migration plan §7a.1).
1463
- parallel) {
1696
+ parallel, synthesize = true) {
1464
1697
  // Resolution runs on the indexer's MAIN thread, and the #850 liveness
1465
1698
  // watchdog SIGKILLs a process whose event loop stalls past its window (60s
1466
1699
  // by default). A single dense batch's resolveAll — or the synthesis pass
@@ -1615,8 +1848,26 @@ class ReferenceResolver {
1615
1848
  }
1616
1849
  try {
1617
1850
  try {
1851
+ // Orphans retain interruption/re-extraction order, not clean-index order.
1852
+ // A caller can precede its imports or supertypes by many batches (#1577).
1853
+ // Drain those prerequisites first, then start a fresh keyset cursor over
1854
+ // the remaining kinds. The disjoint filters let us prefetch across the
1855
+ // phase boundary before cleanup without re-reading the current batch.
1856
+ let prerequisites = true;
1857
+ let afterRowId = 0;
1858
+ const readNextBatch = () => {
1859
+ let next = this.queries.getUnresolvedReferencesBatchAfter(afterRowId, batchSize, prerequisites);
1860
+ if (next.length === 0 && prerequisites) {
1861
+ prerequisites = false;
1862
+ afterRowId = 0;
1863
+ next = this.queries.getUnresolvedReferencesBatchAfter(afterRowId, batchSize, prerequisites);
1864
+ }
1865
+ if (next.length > 0)
1866
+ afterRowId = next[next.length - 1].rowId;
1867
+ return next;
1868
+ };
1618
1869
  tLp = Date.now();
1619
- let batch = this.queries.getUnresolvedReferencesBatchAfter(0, batchSize);
1870
+ let batch = readNextBatch();
1620
1871
  lp('read', tLp);
1621
1872
  let inFlight = batch.length > 0 ? beginBatch(batch) : null;
1622
1873
  while (batch.length > 0 && inFlight) {
@@ -1626,7 +1877,7 @@ class ReferenceResolver {
1626
1877
  // enumeration yields the following batch (keyset — OFFSET re-walked the
1627
1878
  // accumulated failed prefix every read, 54.6s at kernel scale, §7a.2).
1628
1879
  tLp = Date.now();
1629
- const nextBatch = this.queries.getUnresolvedReferencesBatchAfter(batch[batch.length - 1].rowId, batchSize);
1880
+ const nextBatch = readNextBatch();
1630
1881
  lp('read', tLp);
1631
1882
  const tBatch = Date.now();
1632
1883
  const result = await settleBatch(inFlight, batch);
@@ -1699,27 +1950,36 @@ class ReferenceResolver {
1699
1950
  // the remainder idempotently on the next run/sweep (#1187).
1700
1951
  const PERSIST_CHUNK = 1000;
1701
1952
  const tPersist = Date.now();
1702
- // Persist edges BEFORE fanning out the next batch: later batches read
1703
- // this batch's edges — resolveMethodOnType walks supertype chains over
1704
- // `extends`/`implements` edges that earlier batches resolved, so a
1705
- // receiver typed as a subclass only reaches a method declared on its
1706
- // base class if those edges are visible. (Validated on dubbo: fanning
1707
- // out first downgraded exactly those supertype-method resolutions from
1708
- // the 0.9 typed-receiver path to the 0.65 word-overlap fallback.)
1953
+ // A batch that made `extends`/`implements` edges persists them BEFORE
1954
+ // fanning out the next batch: later batches read them —
1955
+ // resolveMethodOnType walks supertype chains over edges that earlier
1956
+ // batches resolved, so a receiver typed as a subclass only reaches a
1957
+ // method declared on its base class if those edges are visible.
1958
+ // (Validated on dubbo: fanning out first downgraded exactly those
1959
+ // supertype-method resolutions from the 0.9 typed-receiver path to the
1960
+ // 0.65 word-overlap fallback.) They are the only edges resolution reads
1961
+ // (RESOLUTION_READ_EDGE_KINDS), so a batch that made none — every batch
1962
+ // after the prerequisite phase readNextBatch drains first — fans the
1963
+ // next batch out now and inserts while it resolves: the same writes in
1964
+ // the same order, and nothing the workers read differs.
1709
1965
  tLp = Date.now();
1710
1966
  const edges = this.createEdges(result.resolved);
1711
1967
  lp('createEdges', tLp);
1968
+ const readEdge = edges.some((e) => RESOLUTION_READ_EDGE_KINDS.includes(e.kind));
1969
+ let nextInFlight = !readEdge && nextBatch.length > 0 ? beginBatch(nextBatch) : null;
1712
1970
  tLp = Date.now();
1713
1971
  for (let i = 0; i < edges.length; i += PERSIST_CHUNK) {
1714
1972
  this.queries.insertEdges(edges.slice(i, i + PERSIST_CHUNK));
1715
1973
  await maybeYield();
1716
1974
  }
1717
1975
  lp('insertEdges', tLp);
1718
- // NOW fan the next batch out — workers see exactly the edge state the
1719
- // sequential baseline would (every batch ≤ this one committed), while
1720
- // the main thread spends the REST of the persist (ref deletes + failed
1721
- // parking below) overlapped with their resolution — the double-buffer.
1722
- const nextInFlight = nextBatch.length > 0 ? beginBatch(nextBatch) : null;
1976
+ // NOW fan the next batch out (if not already) — workers see exactly the
1977
+ // edge state the sequential baseline would (every batch ≤ this one
1978
+ // committed), while the main thread spends the REST of the persist (ref
1979
+ // deletes + failed parking below) overlapped with their resolution —
1980
+ // the double-buffer.
1981
+ if (!nextInFlight && nextBatch.length > 0)
1982
+ nextInFlight = beginBatch(nextBatch);
1723
1983
  // Clean up resolved refs so they don't appear in the next batch —
1724
1984
  // by row id, so a same-key sibling ref in a LATER batch (same caller
1725
1985
  // calling the same callee at another line) is left pending for its own
@@ -1741,7 +2001,9 @@ class ReferenceResolver {
1741
2001
  // only see pending rows) but stay retryable when a later sync adds a
1742
2002
  // symbol that could satisfy them (#1240).
1743
2003
  tLp = Date.now();
1744
- const failedCleanup = ReferenceResolver.partitionFailedCleanup(result.unresolved);
2004
+ const failures = this.nonDeferredFailures(result.unresolved);
2005
+ const deferredCount = result.unresolved.length - failures.length;
2006
+ const failedCleanup = ReferenceResolver.partitionFailedCleanup(failures);
1745
2007
  for (let i = 0; i < failedCleanup.byRowId.length; i += PERSIST_CHUNK) {
1746
2008
  removedThisBatch += this.queries.markReferencesFailedByRowIds(failedCleanup.byRowId.slice(i, i + PERSIST_CHUNK));
1747
2009
  await maybeYield();
@@ -1771,17 +2033,11 @@ class ReferenceResolver {
1771
2033
  // first 5000 refs are all external/stdlib calls, resolution stopped at
1772
2034
  // batch one and left the rest of the table as permanent orphans (#1187).
1773
2035
  // The count-based guard below catches the true no-progress case.
1774
- // Non-progress guard (defense-in-depth). Each iteration enumerates from
1775
- // the head of the pending set, so the PENDING population MUST shrink
1776
- // every iteration — resolved refs are deleted and unresolvable ones are
1777
- // marked failed above, and both leave the pending set the batch reader
1778
- // sees. If it didn't shrink, a resolver returned a match whose
1779
- // `original.referenceName` differs from the stored row, so the keyed
1780
- // delete/update no-ops, and we'd re-read + re-resolve + re-insert the
1781
- // same rows forever (the runaway that grew a 99-file repo to 5M edges /
1782
- // 1.4 GB before the Go-fallback fix). Stop rather than grow the graph
1783
- // without bound. (An in-flight prefetched batch is abandoned unsettled —
1784
- // fan-out has no side effects until settleBatch appends its results.)
2036
+ // Non-progress guard (defense-in-depth). Ordinary attempts must leave
2037
+ // the pending set; a mismatched original reference can make legacy-key
2038
+ // cleanup a no-op. Keep the guard against that broken persistence even
2039
+ // though keyset pagination now advances independently of row cleanup.
2040
+ // An abandoned prefetched batch has no side effects until settleBatch.
1785
2041
  // Non-progress signal, now O(1): `changes` summed across this batch's
1786
2042
  // deletes + failed-parks is the DIRECT evidence the guard's old count
1787
2043
  // diff inferred — a resolver returning a mismatched name makes the keyed
@@ -1791,7 +2047,9 @@ class ReferenceResolver {
1791
2047
  // runs only on the suspicious path (claimed-work batch removed nothing —
1792
2048
  // e.g. every row was a sibling a legacy-key sweep already consumed),
1793
2049
  // where it arbitrates stop-vs-continue exactly as before.
1794
- if (removedThisBatch <= 0 && batch.length > 0) {
2050
+ // Deferred refs legitimately remain pending for the post-pass. The
2051
+ // keyset cursor advances past them; they must not trigger this guard.
2052
+ if (removedThisBatch + deferredCount <= 0 && batch.length > 0) {
1795
2053
  tLp = Date.now();
1796
2054
  const remaining = this.queries.getUnresolvedReferencesCount();
1797
2055
  lp('countGuard', tLp);
@@ -1828,6 +2086,21 @@ class ReferenceResolver {
1828
2086
  await bp;
1829
2087
  }
1830
2088
  }
2089
+ // Indexes the bulk-edge window's end deferred: built once, while the pool
2090
+ // is busy with synthesis when it is, and in any case before this returns.
2091
+ let deferredBuilt = !bulkEdgesActive || !parallel?.bulkEdgeLoad?.deferred;
2092
+ const buildDeferredIndexes = () => {
2093
+ if (deferredBuilt)
2094
+ return;
2095
+ deferredBuilt = true;
2096
+ const tDeferred = Date.now();
2097
+ try {
2098
+ parallel.bulkEdgeLoad.deferred();
2099
+ }
2100
+ catch { /* healed by schema.sql on the next open, like a crash in the window */ }
2101
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2102
+ console.error(`[phase-timing] deferred-edge-index: ${Date.now() - tDeferred}ms`);
2103
+ };
1831
2104
  // Dynamic-edge synthesis: now that all base `calls` edges are persisted,
1832
2105
  // synthesize observer/callback dispatch edges (dispatcher → registered
1833
2106
  // callbacks) that static parsing leaves out. Best-effort — never fail the
@@ -1837,11 +2110,13 @@ class ReferenceResolver {
1837
2110
  // loop. See docs/design/callback-edge-synthesis.md.
1838
2111
  const tSynth = Date.now();
1839
2112
  try {
1840
- aggregateStats.byMethod['callback-synthesis'] = await (0, callback_synthesizer_1.synthesizeCallbackEdges)(this.queries, this.context, onSynthesisProgress, pool, parallel?.backpressure);
2113
+ if (synthesize)
2114
+ aggregateStats.byMethod['callback-synthesis'] = await (0, callback_synthesizer_1.synthesizeCallbackEdges)(this.queries, this.context, onSynthesisProgress, pool, parallel?.backpressure, buildDeferredIndexes);
1841
2115
  }
1842
2116
  catch {
1843
2117
  // synthesis is additive and optional; ignore failures
1844
2118
  }
2119
+ buildDeferredIndexes();
1845
2120
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
1846
2121
  console.error(`[phase-timing] callback-synthesis: ${Date.now() - tSynth}ms`);
1847
2122
  }
@@ -1860,12 +2135,63 @@ class ReferenceResolver {
1860
2135
  stats: aggregateStats,
1861
2136
  };
1862
2137
  }
2138
+ /** Replace synthesis only after every base-resolution pass has finished. */
2139
+ async refreshSynthesis(dbPath, onProgress, backpressure) {
2140
+ this.clearCaches();
2141
+ const stage = new synthesis_stage_1.SynthesisStage(dbPath);
2142
+ try {
2143
+ const fresh = new ReferenceResolver(this.projectRoot, stage.queries);
2144
+ const count = await (0, callback_synthesizer_1.synthesizeCallbackEdges)(stage.queries, fresh.context, onProgress, null, backpressure);
2145
+ await stage.publish(backpressure);
2146
+ return count;
2147
+ }
2148
+ finally {
2149
+ stage.close();
2150
+ this.clearCaches();
2151
+ }
2152
+ }
1863
2153
  /**
1864
2154
  * Get detected frameworks
1865
2155
  */
1866
2156
  getDetectedFrameworks() {
1867
2157
  return this.frameworks.map((f) => f.name);
1868
2158
  }
2159
+ /**
2160
+ * True when `receiver` is a local name bound by an import that resolves to a
2161
+ * file IN THIS PROJECT — the only case where letting a python
2162
+ * built-in-method name through the filter is safe (#1681).
2163
+ *
2164
+ * Asking only whether SOME import bound the local name is not enough: every
2165
+ * import produces a mapping, stdlib and PyPI included, so that would also be
2166
+ * true for `os`, `requests`, `np`. Opening the filter for them lets
2167
+ * resolveViaImport find no project file, fall through to bare-name matching,
2168
+ * and bind `os.remove(p)` to whatever project method happens to be named
2169
+ * `remove` — reintroducing, through its own escape hatch, the fabricated-edge
2170
+ * class this filter exists to prevent.
2171
+ *
2172
+ * Resolving the specifier is the same question resolveViaImport will ask
2173
+ * next, so a receiver that passes here is one the qualified path can actually
2174
+ * serve; anything else stays a silent miss rather than a wrong edge.
2175
+ */
2176
+ isPythonProjectModule(ref, receiver) {
2177
+ for (const imp of this.context.getImportMappings(ref.filePath, ref.language)) {
2178
+ if (imp.localName !== receiver)
2179
+ continue;
2180
+ // `import pkg.mod` / `import pkg.mod as m` binds the module `source`
2181
+ // names. `from pkg import mod` binds `pkg.mod`, and `from . import mod`
2182
+ // binds `.mod` — join without doubling the dot that makes `.` mean the
2183
+ // current package.
2184
+ const specifier = imp.isNamespace
2185
+ ? imp.source
2186
+ : imp.source.endsWith('.')
2187
+ ? `${imp.source}${imp.exportedName}`
2188
+ : `${imp.source}.${imp.exportedName}`;
2189
+ if ((0, import_resolver_1.resolveImportPath)(specifier, ref.filePath, ref.language, this.context)) {
2190
+ return true;
2191
+ }
2192
+ }
2193
+ return false;
2194
+ }
1869
2195
  /**
1870
2196
  * Check if reference is to a built-in or external symbol
1871
2197
  */
@@ -1874,7 +2200,7 @@ class ReferenceResolver {
1874
2200
  const isJsTs = ref.language === 'typescript' || ref.language === 'javascript'
1875
2201
  || ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'arkts';
1876
2202
  // JavaScript/TypeScript built-ins
1877
- if (isJsTs && JS_BUILT_INS.has(name)) {
2203
+ if (isJsTs && js_builtins_1.JS_BUILT_INS.has(name)) {
1878
2204
  return true;
1879
2205
  }
1880
2206
  // ArkTS resource-reference intrinsics — `$r('app.string.x')` /
@@ -1908,10 +2234,27 @@ class ReferenceResolver {
1908
2234
  }
1909
2235
  // Filter built-in methods on non-class receivers
1910
2236
  // (e.g., items.append where items is a local list variable)
1911
- // But allow if the capitalized receiver matches a known codebase class
2237
+ // But allow if the capitalized receiver matches a known codebase class,
2238
+ // OR the receiver is itself an imported project module — a module can
2239
+ // export a top-level function sharing a common collection-method name
2240
+ // (`ledger.append`, `from . import ledger`), and that call is a real
2241
+ // project dependency, not `list.append` (#1681). Without this, the
2242
+ // qualified ref never reaches resolveViaImport / resolvePythonModuleMember.
1912
2243
  if (PYTHON_BUILT_IN_METHODS.has(method)) {
2244
+ // A module-scope collection binding is stronger evidence than a
2245
+ // coincidentally matching class name (#1652). Only use this file's
2246
+ // binding: an unrelated module may reuse the receiver for a collection.
2247
+ const isCollection = this.context.getNodesByName(receiver).some((node) => node.language === 'python' && node.filePath === ref.filePath &&
2248
+ (node.kind === 'variable' || node.kind === 'constant') &&
2249
+ node.qualifiedName === receiver &&
2250
+ /^=\s*(?:[\[{]|(?:dict|list|set|tuple|frozenset)\s*\(|\(\s*\)|\([^()]*,)/.test(node.signature ?? ''));
2251
+ if (isCollection)
2252
+ return true;
1913
2253
  const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
1914
- if (!this.knownNames?.has(capitalized)) {
2254
+ const isKnownClass = this.context.getNodesByName(capitalized).some((node) => node.language === 'python' &&
2255
+ (node.kind === 'class' || node.kind === 'struct' || node.kind === 'interface'));
2256
+ const isProjectModule = !isKnownClass && this.isPythonProjectModule(ref, receiver);
2257
+ if (!isKnownClass && !isProjectModule) {
1915
2258
  return true;
1916
2259
  }
1917
2260
  }
@@ -1919,9 +2262,8 @@ class ReferenceResolver {
1919
2262
  // A bare name colliding with a builtin method (index, get, update, count…)
1920
2263
  // is only a builtin when NOTHING in the codebase declares it. A declared
1921
2264
  // symbol with that exact name — e.g. a Flask/FastAPI view `def index()` or
1922
- // `def get()` — is a real reference target. Mirrors the knownNames guard on
1923
- // the dotted branch above; without it, every handler named after a builtin
1924
- // method silently loses its route→handler edge.
2265
+ // `def get()` — is a real reference target. Without this guard, every
2266
+ // handler named after a builtin method silently loses its route→handler edge.
1925
2267
  if (PYTHON_BUILT_IN_METHODS.has(name) && !this.knownNames?.has(name)) {
1926
2268
  return true;
1927
2269
  }
@@ -1972,28 +2314,16 @@ class ReferenceResolver {
1972
2314
  * Get file path from node ID
1973
2315
  */
1974
2316
  getFilePathFromNodeId(nodeId) {
1975
- const node = this.queries.getNodeById(nodeId);
2317
+ const node = this.nodeById(nodeId);
1976
2318
  return node?.filePath || '';
1977
2319
  }
1978
2320
  /**
1979
2321
  * Get language from node ID
1980
2322
  */
1981
2323
  getLanguageFromNodeId(nodeId) {
1982
- const node = this.queries.getNodeById(nodeId);
2324
+ const node = this.nodeById(nodeId);
1983
2325
  return node?.language || 'unknown';
1984
2326
  }
1985
- /**
1986
- * Drop an import/name-strategy resolution that crosses a language family.
1987
- * Two regimes (mirrors `applyLanguageGate`'s candidate filter):
1988
- * - `references` (type usage): STRICT — a `Type.member` static read names a
1989
- * same-family type, never a coincidentally same-named symbol in another
1990
- * language. Drops any non-same-family target.
1991
- * - `imports` (import binding / `#include`): both-known — a C++ `#include
1992
- * "X.h"` must not resolve to a same-named ObjC header on another platform
1993
- * (basename collision), but a singleton-family / SFC language (`vue` →
1994
- * `.ts`) importing across is left alone.
1995
- * Applies to the import (strategy 2) + name-match (strategy 3) results.
1996
- */
1997
2327
  /**
1998
2328
  * Collect the `@using` namespaces in scope for a `.razor`/`.cshtml` file: its
1999
2329
  * own `@using` directives plus every `_Imports.razor` from the file's folder up
@@ -2151,7 +2481,7 @@ class ReferenceResolver {
2151
2481
  const member = ref.referenceName.slice('this.'.length);
2152
2482
  if (!member)
2153
2483
  return null;
2154
- const fromNode = this.queries.getNodeById(ref.fromNodeId);
2484
+ const fromNode = this.nodeById(ref.fromNodeId);
2155
2485
  if (!fromNode)
2156
2486
  return null;
2157
2487
  // A hook declared at class-body level (Ruby `before_action :authenticate`)
@@ -2176,7 +2506,7 @@ class ReferenceResolver {
2176
2506
  // Not on the class itself — possibly INHERITED. implements/extends
2177
2507
  // edges don't exist yet in this pass, so retry in the supertype pass
2178
2508
  // (resolveDeferredThisMemberRefs) instead of giving up.
2179
- this.deferredThisMemberRefs.push(ref);
2509
+ this.deferReference(ref, this.deferredThisMemberRefs);
2180
2510
  return null;
2181
2511
  }
2182
2512
  const target = candidates.reduce((a, b) => (a.startLine <= b.startLine ? a : b));
@@ -2207,10 +2537,41 @@ class ReferenceResolver {
2207
2537
  // periodically so the #850 liveness watchdog heartbeat can fire (#1091).
2208
2538
  const maybeYield = (0, cooperative_yield_1.createYielder)();
2209
2539
  const resolved = [];
2540
+ // Refs share supertypes (every `this.dispose` walks the same chain), and
2541
+ // nothing is written until the loop ends: read each type's supertype
2542
+ // edges, and each supertype's callable members by name, once.
2543
+ const supertypeEdges = new Map();
2544
+ const callableMembers = new Map();
2545
+ const supertypesOf = (id) => {
2546
+ let edges = supertypeEdges.get(id);
2547
+ if (!edges) {
2548
+ edges = this.queries.getOutgoingEdges(id, ['implements', 'extends']);
2549
+ supertypeEdges.set(id, edges);
2550
+ }
2551
+ return edges;
2552
+ };
2553
+ const callableMembersOf = (id) => {
2554
+ let byName = callableMembers.get(id);
2555
+ if (!byName) {
2556
+ byName = new Map();
2557
+ for (const c of this.queries.getOutgoingEdges(id, ['contains'])) {
2558
+ const m = this.nodeById(c.target);
2559
+ if (!m || (m.kind !== 'function' && m.kind !== 'method'))
2560
+ continue;
2561
+ const list = byName.get(m.name);
2562
+ if (list)
2563
+ list.push(m);
2564
+ else
2565
+ byName.set(m.name, [m]);
2566
+ }
2567
+ callableMembers.set(id, byName);
2568
+ }
2569
+ return byName;
2570
+ };
2210
2571
  for (const ref of deferred) {
2211
2572
  await maybeYield();
2212
2573
  const member = ref.referenceName.slice('this.'.length);
2213
- const fromNode = this.queries.getNodeById(ref.fromNodeId);
2574
+ const fromNode = this.nodeById(ref.fromNodeId);
2214
2575
  if (!fromNode || !member)
2215
2576
  continue;
2216
2577
  // Class-body-level hooks (Ruby) attribute to the CLASS node itself.
@@ -2250,24 +2611,18 @@ class ReferenceResolver {
2250
2611
  for (let depth = 0; depth < 5 && frontierNodes.length > 0 && !target; depth++) {
2251
2612
  const next = [];
2252
2613
  for (const typeNode of frontierNodes) {
2253
- for (const edge of this.queries.getOutgoingEdges(typeNode.id, ['implements', 'extends'])) {
2254
- const superNode = this.queries.getNodeById(edge.target);
2614
+ for (const edge of supertypesOf(typeNode.id)) {
2615
+ const superNode = this.nodeById(edge.target);
2255
2616
  if (!superNode || seenNodes.has(superNode.id))
2256
2617
  continue;
2257
2618
  seenNodes.add(superNode.id);
2258
2619
  if (!SUPERTYPE_BEARING_KINDS.has(superNode.kind))
2259
2620
  continue;
2260
2621
  // Member lookup anchored on the supertype's contains edges.
2261
- for (const c of this.queries.getOutgoingEdges(superNode.id, ['contains'])) {
2262
- const m = this.queries.getNodeById(c.target);
2263
- if (m &&
2264
- m.name === member &&
2265
- (m.kind === 'function' || m.kind === 'method') &&
2266
- (0, name_matcher_1.sameLanguageFamily)(m.language, ref.language)) {
2267
- target = m;
2268
- break;
2269
- }
2270
- }
2622
+ target =
2623
+ callableMembersOf(superNode.id)
2624
+ .get(member)
2625
+ ?.find((m) => (0, name_matcher_1.sameLanguageFamily)(m.language, ref.language)) ?? null;
2271
2626
  if (target)
2272
2627
  break;
2273
2628
  next.push(superNode);
@@ -2286,47 +2641,99 @@ class ReferenceResolver {
2286
2641
  });
2287
2642
  }
2288
2643
  }
2289
- if (resolved.length === 0)
2290
- return 0;
2291
- const edges = this.createEdges(resolved);
2292
- if (edges.length > 0) {
2293
- this.queries.insertEdges(edges);
2294
- this.clearCaches();
2295
- }
2296
- return edges.length;
2644
+ return this.persistDeferredReferences(deferred, resolved);
2297
2645
  }
2298
- gateLanguage(result, ref) {
2646
+ /**
2647
+ * Drop a resolution whose target cannot be what the reference names.
2648
+ * Applied at the `resolveOne` seam so it covers every strategy uniformly —
2649
+ * framework, import, name-match, chain, CFML component path.
2650
+ *
2651
+ * For `imports`: the target must be importable. A member that only exists
2652
+ * inside a type never is.
2653
+ *
2654
+ * For `extends`/`implements`, it cannot be describing a real supertype when:
2655
+ *
2656
+ * 1. The target's kind can never be a supertype (an enum member, a method,
2657
+ * a variable). `matchByExactName` additionally narrows its candidate
2658
+ * pool by the same set, so a legitimate supertype outranks a same-named
2659
+ * non-type rather than merely losing its edge.
2660
+ * 2. The name is imported from outside the repo, so NO local node is the
2661
+ * referent. Without this, filtering by kind alone just relocates the
2662
+ * false edge onto the next same-named local type.
2663
+ *
2664
+ * One exception to (1): a TypeScript VALUE that shares its name with a type
2665
+ * in the same file. `export const IFoo = createDecorator<IFoo>('foo')` beside
2666
+ * `export interface IFoo` is how VS Code declares every service, and an
2667
+ * import of `IFoo` resolves to the file with both — a strategy that takes the
2668
+ * first export of that name gets the value. The strategy found the right
2669
+ * file and name; the type declared there is the supertype, so the edge moves
2670
+ * to it rather than being dropped (dropping it lost ~900 `implements` edges
2671
+ * on vscode).
2672
+ *
2673
+ * Otherwise this only ever REMOVES an edge, never adds one. A dropped ref
2674
+ * stays in `unresolved_refs` as `failed`, which is the honest record for a
2675
+ * supertype that lives outside the repo — silent beats wrong.
2676
+ */
2677
+ gateTargetKind(result, ref) {
2299
2678
  if (!result)
2300
2679
  return result;
2301
- const tgt = this.getLanguageFromNodeId(result.targetNodeId);
2302
- if (!tgt || !ref.language)
2680
+ // A `#define` is a value, never a callee (#1838): a macro defined only in
2681
+ // an unrelated file is not what `NAME(x)` here expands to either.
2682
+ if (ref.referenceKind === 'calls') {
2683
+ const target = this.nodeById(result.targetNodeId);
2684
+ if (target?.kind === 'constant' && types_1.CPP_DEFINE_SIGNATURE.test(target.signature ?? ''))
2685
+ return null;
2686
+ }
2687
+ // An `imports` reference names something importable — never a member that
2688
+ // only exists inside a type.
2689
+ if (ref.referenceKind === 'imports') {
2690
+ const target = this.nodeById(result.targetNodeId);
2691
+ return target && !(0, types_1.isImportableKind)(target.kind) ? null : result;
2692
+ }
2693
+ if (!(0, types_1.isInheritanceRef)(ref))
2303
2694
  return result;
2304
- if ((ref.referenceKind === 'references' || ref.referenceKind === 'function_ref') && !(0, name_matcher_1.sameLanguageFamily)(tgt, ref.language))
2305
- return null;
2306
- if (ref.referenceKind === 'imports' && (0, name_matcher_1.crossesKnownFamily)(tgt, ref.language))
2695
+ const target = this.nodeById(result.targetNodeId);
2696
+ if (target && !(0, types_1.isSupertypeTarget)(target)) {
2697
+ const type = this.sameNamedTypeOfValue(target);
2698
+ if (!type)
2699
+ return null;
2700
+ result = { ...result, targetNodeId: type.id };
2701
+ }
2702
+ if ((0, import_resolver_1.isBoundToOutOfRepoImport)(ref, this.context))
2307
2703
  return null;
2308
2704
  return result;
2309
2705
  }
2706
+ /** The one supertype-kind node a TypeScript value shares its name and file with. */
2707
+ sameNamedTypeOfValue(value) {
2708
+ if (value.kind !== 'constant' && value.kind !== 'variable')
2709
+ return null;
2710
+ if (value.language !== 'typescript' && value.language !== 'tsx')
2711
+ return null;
2712
+ const types = this.context
2713
+ .getNodesInFile(value.filePath)
2714
+ .filter((n) => n.name === value.name && (0, types_1.isSupertypeTarget)(n));
2715
+ return types.length === 1 ? types[0] : null;
2716
+ }
2717
+ gateLanguage(result, ref) {
2718
+ if (!result)
2719
+ return result;
2720
+ return (0, name_matcher_1.gateLanguageMatch)(result, ref, this.context);
2721
+ }
2310
2722
  /**
2311
- * Drop a FRAMEWORK-strategy resolution that crosses two *known* language
2312
- * families for a type-usage (`references`) or import-binding (`imports`)
2313
- * edge. The framework strategy is intentionally ungated for cross-language
2314
- * bridges, but those legitimate bridges are either `calls` edges (RN/Expo
2315
- * JS → native) or config↔code edges whose config side (`yaml`/`blade`/…) is
2316
- * not a known programming-language family. A `references`/`imports` edge
2317
- * between two *known* families is always a coincidental name collision — the
2318
- * React/Svelte/Vue PascalCase component resolvers name-match `getNodesByName`
2319
- * without a language check, so a TS `<TestRunner>` ref happily matched a
2320
- * Kotlin `class TestRunner`. Gating only the both-known-cross-family case
2321
- * lets config bridges and `calls` bridges through untouched.
2723
+ * Framework calls carry bridge evidence (RN/Expo JS → native). Other
2724
+ * framework results obey the same code-family boundary as name matches;
2725
+ * markup/config transitions remain open.
2322
2726
  */
2323
2727
  gateFrameworkLanguage(result, ref) {
2324
2728
  if (!result)
2325
2729
  return result;
2326
- if (ref.referenceKind !== 'references' && ref.referenceKind !== 'imports')
2730
+ if (ref.referenceKind === 'calls')
2327
2731
  return result;
2328
2732
  const tgt = this.getLanguageFromNodeId(result.targetNodeId);
2329
- if (tgt && ref.language && (0, name_matcher_1.crossesKnownFamily)(tgt, ref.language))
2733
+ // Package imports cannot target prose found by a framework's name lookup.
2734
+ if (ref.referenceKind === 'imports' && tgt === 'markdown' && ref.language !== 'markdown')
2735
+ return null;
2736
+ if (tgt && ref.language && (0, name_matcher_1.crossesCodeBoundary)(tgt, ref.language))
2330
2737
  return null;
2331
2738
  return result;
2332
2739
  }