@quolu/lattice 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (769) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +20 -0
  3. package/bin/lattice-mcp.mjs +134 -0
  4. package/bin/lattice.mjs +78 -0
  5. package/package.json +47 -0
  6. package/sensor/LICENSE +21 -0
  7. package/sensor/NOTICE +30 -0
  8. package/sensor/dist/bin/codegraph.d.ts +26 -0
  9. package/sensor/dist/bin/codegraph.d.ts.map +1 -0
  10. package/sensor/dist/bin/codegraph.js +2279 -0
  11. package/sensor/dist/bin/codegraph.js.map +1 -0
  12. package/sensor/dist/bin/command-supervision.d.ts +49 -0
  13. package/sensor/dist/bin/command-supervision.d.ts.map +1 -0
  14. package/sensor/dist/bin/command-supervision.js +95 -0
  15. package/sensor/dist/bin/command-supervision.js.map +1 -0
  16. package/sensor/dist/bin/fatal-handler.d.ts +20 -0
  17. package/sensor/dist/bin/fatal-handler.d.ts.map +1 -0
  18. package/sensor/dist/bin/fatal-handler.js +118 -0
  19. package/sensor/dist/bin/fatal-handler.js.map +1 -0
  20. package/sensor/dist/bin/node-version-check.d.ts +37 -0
  21. package/sensor/dist/bin/node-version-check.d.ts.map +1 -0
  22. package/sensor/dist/bin/node-version-check.js +79 -0
  23. package/sensor/dist/bin/node-version-check.js.map +1 -0
  24. package/sensor/dist/bin/uninstall.d.ts +14 -0
  25. package/sensor/dist/bin/uninstall.d.ts.map +1 -0
  26. package/sensor/dist/bin/uninstall.js +36 -0
  27. package/sensor/dist/bin/uninstall.js.map +1 -0
  28. package/sensor/dist/context/formatter.d.ts +30 -0
  29. package/sensor/dist/context/formatter.d.ts.map +1 -0
  30. package/sensor/dist/context/formatter.js +263 -0
  31. package/sensor/dist/context/formatter.js.map +1 -0
  32. package/sensor/dist/context/index.d.ts +119 -0
  33. package/sensor/dist/context/index.d.ts.map +1 -0
  34. package/sensor/dist/context/index.js +1326 -0
  35. package/sensor/dist/context/index.js.map +1 -0
  36. package/sensor/dist/context/markers.d.ts +19 -0
  37. package/sensor/dist/context/markers.d.ts.map +1 -0
  38. package/sensor/dist/context/markers.js +22 -0
  39. package/sensor/dist/context/markers.js.map +1 -0
  40. package/sensor/dist/db/index.d.ts +264 -0
  41. package/sensor/dist/db/index.d.ts.map +1 -0
  42. package/sensor/dist/db/index.js +603 -0
  43. package/sensor/dist/db/index.js.map +1 -0
  44. package/sensor/dist/db/migrations.d.ts +44 -0
  45. package/sensor/dist/db/migrations.d.ts.map +1 -0
  46. package/sensor/dist/db/migrations.js +241 -0
  47. package/sensor/dist/db/migrations.js.map +1 -0
  48. package/sensor/dist/db/queries.d.ts +563 -0
  49. package/sensor/dist/db/queries.d.ts.map +1 -0
  50. package/sensor/dist/db/queries.js +2179 -0
  51. package/sensor/dist/db/queries.js.map +1 -0
  52. package/sensor/dist/db/schema.sql +196 -0
  53. package/sensor/dist/db/sqlite-adapter.d.ts +55 -0
  54. package/sensor/dist/db/sqlite-adapter.d.ts.map +1 -0
  55. package/sensor/dist/db/sqlite-adapter.js +135 -0
  56. package/sensor/dist/db/sqlite-adapter.js.map +1 -0
  57. package/sensor/dist/db/wal-valve.d.ts +106 -0
  58. package/sensor/dist/db/wal-valve.d.ts.map +1 -0
  59. package/sensor/dist/db/wal-valve.js +208 -0
  60. package/sensor/dist/db/wal-valve.js.map +1 -0
  61. package/sensor/dist/directory.d.ts +183 -0
  62. package/sensor/dist/directory.d.ts.map +1 -0
  63. package/sensor/dist/directory.js +797 -0
  64. package/sensor/dist/directory.js.map +1 -0
  65. package/sensor/dist/errors.d.ts +136 -0
  66. package/sensor/dist/errors.d.ts.map +1 -0
  67. package/sensor/dist/errors.js +219 -0
  68. package/sensor/dist/errors.js.map +1 -0
  69. package/sensor/dist/extraction/astro-extractor.d.ts +79 -0
  70. package/sensor/dist/extraction/astro-extractor.d.ts.map +1 -0
  71. package/sensor/dist/extraction/astro-extractor.js +320 -0
  72. package/sensor/dist/extraction/astro-extractor.js.map +1 -0
  73. package/sensor/dist/extraction/cfml-extractor.d.ts +107 -0
  74. package/sensor/dist/extraction/cfml-extractor.d.ts.map +1 -0
  75. package/sensor/dist/extraction/cfml-extractor.js +494 -0
  76. package/sensor/dist/extraction/cfml-extractor.js.map +1 -0
  77. package/sensor/dist/extraction/dfm-extractor.d.ts +31 -0
  78. package/sensor/dist/extraction/dfm-extractor.d.ts.map +1 -0
  79. package/sensor/dist/extraction/dfm-extractor.js +151 -0
  80. package/sensor/dist/extraction/dfm-extractor.js.map +1 -0
  81. package/sensor/dist/extraction/dynamic-import.d.ts +82 -0
  82. package/sensor/dist/extraction/dynamic-import.d.ts.map +1 -0
  83. package/sensor/dist/extraction/dynamic-import.js +313 -0
  84. package/sensor/dist/extraction/dynamic-import.js.map +1 -0
  85. package/sensor/dist/extraction/extraction-version.d.ts +25 -0
  86. package/sensor/dist/extraction/extraction-version.d.ts.map +1 -0
  87. package/sensor/dist/extraction/extraction-version.js +28 -0
  88. package/sensor/dist/extraction/extraction-version.js.map +1 -0
  89. package/sensor/dist/extraction/function-ref.d.ts +118 -0
  90. package/sensor/dist/extraction/function-ref.d.ts.map +1 -0
  91. package/sensor/dist/extraction/function-ref.js +727 -0
  92. package/sensor/dist/extraction/function-ref.js.map +1 -0
  93. package/sensor/dist/extraction/generated-detection.d.ts +30 -0
  94. package/sensor/dist/extraction/generated-detection.d.ts.map +1 -0
  95. package/sensor/dist/extraction/generated-detection.js +83 -0
  96. package/sensor/dist/extraction/generated-detection.js.map +1 -0
  97. package/sensor/dist/extraction/grammars.d.ts +138 -0
  98. package/sensor/dist/extraction/grammars.d.ts.map +1 -0
  99. package/sensor/dist/extraction/grammars.js +648 -0
  100. package/sensor/dist/extraction/grammars.js.map +1 -0
  101. package/sensor/dist/extraction/index.d.ts +251 -0
  102. package/sensor/dist/extraction/index.d.ts.map +1 -0
  103. package/sensor/dist/extraction/index.js +2563 -0
  104. package/sensor/dist/extraction/index.js.map +1 -0
  105. package/sensor/dist/extraction/kernel/decode.d.ts +9 -0
  106. package/sensor/dist/extraction/kernel/decode.d.ts.map +1 -0
  107. package/sensor/dist/extraction/kernel/decode.js +156 -0
  108. package/sensor/dist/extraction/kernel/decode.js.map +1 -0
  109. package/sensor/dist/extraction/kernel/index.d.ts +62 -0
  110. package/sensor/dist/extraction/kernel/index.d.ts.map +1 -0
  111. package/sensor/dist/extraction/kernel/index.js +165 -0
  112. package/sensor/dist/extraction/kernel/index.js.map +1 -0
  113. package/sensor/dist/extraction/kernel/layout.d.ts +92 -0
  114. package/sensor/dist/extraction/kernel/layout.d.ts.map +1 -0
  115. package/sensor/dist/extraction/kernel/layout.js +95 -0
  116. package/sensor/dist/extraction/kernel/layout.js.map +1 -0
  117. package/sensor/dist/extraction/kernel/loader.d.ts +61 -0
  118. package/sensor/dist/extraction/kernel/loader.d.ts.map +1 -0
  119. package/sensor/dist/extraction/kernel/loader.js +146 -0
  120. package/sensor/dist/extraction/kernel/loader.js.map +1 -0
  121. package/sensor/dist/extraction/languages/arkts.d.ts +3 -0
  122. package/sensor/dist/extraction/languages/arkts.d.ts.map +1 -0
  123. package/sensor/dist/extraction/languages/arkts.js +127 -0
  124. package/sensor/dist/extraction/languages/arkts.js.map +1 -0
  125. package/sensor/dist/extraction/languages/c-cpp.d.ts +111 -0
  126. package/sensor/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  127. package/sensor/dist/extraction/languages/c-cpp.js +878 -0
  128. package/sensor/dist/extraction/languages/c-cpp.js.map +1 -0
  129. package/sensor/dist/extraction/languages/cfquery.d.ts +12 -0
  130. package/sensor/dist/extraction/languages/cfquery.d.ts.map +1 -0
  131. package/sensor/dist/extraction/languages/cfquery.js +28 -0
  132. package/sensor/dist/extraction/languages/cfquery.js.map +1 -0
  133. package/sensor/dist/extraction/languages/cfscript.d.ts +3 -0
  134. package/sensor/dist/extraction/languages/cfscript.d.ts.map +1 -0
  135. package/sensor/dist/extraction/languages/cfscript.js +73 -0
  136. package/sensor/dist/extraction/languages/cfscript.js.map +1 -0
  137. package/sensor/dist/extraction/languages/cobol.d.ts +33 -0
  138. package/sensor/dist/extraction/languages/cobol.d.ts.map +1 -0
  139. package/sensor/dist/extraction/languages/cobol.js +499 -0
  140. package/sensor/dist/extraction/languages/cobol.js.map +1 -0
  141. package/sensor/dist/extraction/languages/csharp.d.ts +25 -0
  142. package/sensor/dist/extraction/languages/csharp.d.ts.map +1 -0
  143. package/sensor/dist/extraction/languages/csharp.js +175 -0
  144. package/sensor/dist/extraction/languages/csharp.js.map +1 -0
  145. package/sensor/dist/extraction/languages/dart.d.ts +3 -0
  146. package/sensor/dist/extraction/languages/dart.d.ts.map +1 -0
  147. package/sensor/dist/extraction/languages/dart.js +374 -0
  148. package/sensor/dist/extraction/languages/dart.js.map +1 -0
  149. package/sensor/dist/extraction/languages/erlang.d.ts +3 -0
  150. package/sensor/dist/extraction/languages/erlang.d.ts.map +1 -0
  151. package/sensor/dist/extraction/languages/erlang.js +350 -0
  152. package/sensor/dist/extraction/languages/erlang.js.map +1 -0
  153. package/sensor/dist/extraction/languages/go.d.ts +3 -0
  154. package/sensor/dist/extraction/languages/go.d.ts.map +1 -0
  155. package/sensor/dist/extraction/languages/go.js +111 -0
  156. package/sensor/dist/extraction/languages/go.js.map +1 -0
  157. package/sensor/dist/extraction/languages/index.d.ts +10 -0
  158. package/sensor/dist/extraction/languages/index.d.ts.map +1 -0
  159. package/sensor/dist/extraction/languages/index.js +71 -0
  160. package/sensor/dist/extraction/languages/index.js.map +1 -0
  161. package/sensor/dist/extraction/languages/java.d.ts +3 -0
  162. package/sensor/dist/extraction/languages/java.d.ts.map +1 -0
  163. package/sensor/dist/extraction/languages/java.js +315 -0
  164. package/sensor/dist/extraction/languages/java.js.map +1 -0
  165. package/sensor/dist/extraction/languages/javascript.d.ts +3 -0
  166. package/sensor/dist/extraction/languages/javascript.d.ts.map +1 -0
  167. package/sensor/dist/extraction/languages/javascript.js +106 -0
  168. package/sensor/dist/extraction/languages/javascript.js.map +1 -0
  169. package/sensor/dist/extraction/languages/kotlin.d.ts +3 -0
  170. package/sensor/dist/extraction/languages/kotlin.d.ts.map +1 -0
  171. package/sensor/dist/extraction/languages/kotlin.js +379 -0
  172. package/sensor/dist/extraction/languages/kotlin.js.map +1 -0
  173. package/sensor/dist/extraction/languages/lua.d.ts +3 -0
  174. package/sensor/dist/extraction/languages/lua.d.ts.map +1 -0
  175. package/sensor/dist/extraction/languages/lua.js +150 -0
  176. package/sensor/dist/extraction/languages/lua.js.map +1 -0
  177. package/sensor/dist/extraction/languages/luau.d.ts +3 -0
  178. package/sensor/dist/extraction/languages/luau.d.ts.map +1 -0
  179. package/sensor/dist/extraction/languages/luau.js +37 -0
  180. package/sensor/dist/extraction/languages/luau.js.map +1 -0
  181. package/sensor/dist/extraction/languages/nix.d.ts +3 -0
  182. package/sensor/dist/extraction/languages/nix.d.ts.map +1 -0
  183. package/sensor/dist/extraction/languages/nix.js +294 -0
  184. package/sensor/dist/extraction/languages/nix.js.map +1 -0
  185. package/sensor/dist/extraction/languages/objc.d.ts +3 -0
  186. package/sensor/dist/extraction/languages/objc.d.ts.map +1 -0
  187. package/sensor/dist/extraction/languages/objc.js +175 -0
  188. package/sensor/dist/extraction/languages/objc.js.map +1 -0
  189. package/sensor/dist/extraction/languages/pascal.d.ts +3 -0
  190. package/sensor/dist/extraction/languages/pascal.d.ts.map +1 -0
  191. package/sensor/dist/extraction/languages/pascal.js +77 -0
  192. package/sensor/dist/extraction/languages/pascal.js.map +1 -0
  193. package/sensor/dist/extraction/languages/php.d.ts +3 -0
  194. package/sensor/dist/extraction/languages/php.d.ts.map +1 -0
  195. package/sensor/dist/extraction/languages/php.js +196 -0
  196. package/sensor/dist/extraction/languages/php.js.map +1 -0
  197. package/sensor/dist/extraction/languages/python.d.ts +3 -0
  198. package/sensor/dist/extraction/languages/python.d.ts.map +1 -0
  199. package/sensor/dist/extraction/languages/python.js +56 -0
  200. package/sensor/dist/extraction/languages/python.js.map +1 -0
  201. package/sensor/dist/extraction/languages/r.d.ts +3 -0
  202. package/sensor/dist/extraction/languages/r.d.ts.map +1 -0
  203. package/sensor/dist/extraction/languages/r.js +314 -0
  204. package/sensor/dist/extraction/languages/r.js.map +1 -0
  205. package/sensor/dist/extraction/languages/ruby.d.ts +3 -0
  206. package/sensor/dist/extraction/languages/ruby.d.ts.map +1 -0
  207. package/sensor/dist/extraction/languages/ruby.js +149 -0
  208. package/sensor/dist/extraction/languages/ruby.js.map +1 -0
  209. package/sensor/dist/extraction/languages/rust.d.ts +3 -0
  210. package/sensor/dist/extraction/languages/rust.d.ts.map +1 -0
  211. package/sensor/dist/extraction/languages/rust.js +142 -0
  212. package/sensor/dist/extraction/languages/rust.js.map +1 -0
  213. package/sensor/dist/extraction/languages/scala.d.ts +3 -0
  214. package/sensor/dist/extraction/languages/scala.d.ts.map +1 -0
  215. package/sensor/dist/extraction/languages/scala.js +209 -0
  216. package/sensor/dist/extraction/languages/scala.js.map +1 -0
  217. package/sensor/dist/extraction/languages/solidity.d.ts +3 -0
  218. package/sensor/dist/extraction/languages/solidity.d.ts.map +1 -0
  219. package/sensor/dist/extraction/languages/solidity.js +293 -0
  220. package/sensor/dist/extraction/languages/solidity.js.map +1 -0
  221. package/sensor/dist/extraction/languages/swift.d.ts +3 -0
  222. package/sensor/dist/extraction/languages/swift.d.ts.map +1 -0
  223. package/sensor/dist/extraction/languages/swift.js +152 -0
  224. package/sensor/dist/extraction/languages/swift.js.map +1 -0
  225. package/sensor/dist/extraction/languages/terraform.d.ts +3 -0
  226. package/sensor/dist/extraction/languages/terraform.d.ts.map +1 -0
  227. package/sensor/dist/extraction/languages/terraform.js +641 -0
  228. package/sensor/dist/extraction/languages/terraform.js.map +1 -0
  229. package/sensor/dist/extraction/languages/typescript.d.ts +16 -0
  230. package/sensor/dist/extraction/languages/typescript.d.ts.map +1 -0
  231. package/sensor/dist/extraction/languages/typescript.js +167 -0
  232. package/sensor/dist/extraction/languages/typescript.js.map +1 -0
  233. package/sensor/dist/extraction/languages/vbnet.d.ts +11 -0
  234. package/sensor/dist/extraction/languages/vbnet.d.ts.map +1 -0
  235. package/sensor/dist/extraction/languages/vbnet.js +141 -0
  236. package/sensor/dist/extraction/languages/vbnet.js.map +1 -0
  237. package/sensor/dist/extraction/liquid-extractor.d.ts +59 -0
  238. package/sensor/dist/extraction/liquid-extractor.d.ts.map +1 -0
  239. package/sensor/dist/extraction/liquid-extractor.js +357 -0
  240. package/sensor/dist/extraction/liquid-extractor.js.map +1 -0
  241. package/sensor/dist/extraction/mybatis-extractor.d.ts +68 -0
  242. package/sensor/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  243. package/sensor/dist/extraction/mybatis-extractor.js +300 -0
  244. package/sensor/dist/extraction/mybatis-extractor.js.map +1 -0
  245. package/sensor/dist/extraction/parse-pool.d.ts +160 -0
  246. package/sensor/dist/extraction/parse-pool.d.ts.map +1 -0
  247. package/sensor/dist/extraction/parse-pool.js +402 -0
  248. package/sensor/dist/extraction/parse-pool.js.map +1 -0
  249. package/sensor/dist/extraction/parse-worker.d.ts +8 -0
  250. package/sensor/dist/extraction/parse-worker.d.ts.map +1 -0
  251. package/sensor/dist/extraction/parse-worker.js +138 -0
  252. package/sensor/dist/extraction/parse-worker.js.map +1 -0
  253. package/sensor/dist/extraction/razor-extractor.d.ts +42 -0
  254. package/sensor/dist/extraction/razor-extractor.d.ts.map +1 -0
  255. package/sensor/dist/extraction/razor-extractor.js +285 -0
  256. package/sensor/dist/extraction/razor-extractor.js.map +1 -0
  257. package/sensor/dist/extraction/spawn-invokes.d.ts +101 -0
  258. package/sensor/dist/extraction/spawn-invokes.d.ts.map +1 -0
  259. package/sensor/dist/extraction/spawn-invokes.js +327 -0
  260. package/sensor/dist/extraction/spawn-invokes.js.map +1 -0
  261. package/sensor/dist/extraction/store-worker.d.ts +24 -0
  262. package/sensor/dist/extraction/store-worker.d.ts.map +1 -0
  263. package/sensor/dist/extraction/store-worker.js +110 -0
  264. package/sensor/dist/extraction/store-worker.js.map +1 -0
  265. package/sensor/dist/extraction/store-writer.d.ts +63 -0
  266. package/sensor/dist/extraction/store-writer.d.ts.map +1 -0
  267. package/sensor/dist/extraction/store-writer.js +174 -0
  268. package/sensor/dist/extraction/store-writer.js.map +1 -0
  269. package/sensor/dist/extraction/svelte-extractor.d.ts +56 -0
  270. package/sensor/dist/extraction/svelte-extractor.d.ts.map +1 -0
  271. package/sensor/dist/extraction/svelte-extractor.js +275 -0
  272. package/sensor/dist/extraction/svelte-extractor.js.map +1 -0
  273. package/sensor/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  274. package/sensor/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  275. package/sensor/dist/extraction/tree-sitter-helpers.js +153 -0
  276. package/sensor/dist/extraction/tree-sitter-helpers.js.map +1 -0
  277. package/sensor/dist/extraction/tree-sitter-types.d.ts +258 -0
  278. package/sensor/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  279. package/sensor/dist/extraction/tree-sitter-types.js +10 -0
  280. package/sensor/dist/extraction/tree-sitter-types.js.map +1 -0
  281. package/sensor/dist/extraction/tree-sitter.d.ts +724 -0
  282. package/sensor/dist/extraction/tree-sitter.d.ts.map +1 -0
  283. package/sensor/dist/extraction/tree-sitter.js +6721 -0
  284. package/sensor/dist/extraction/tree-sitter.js.map +1 -0
  285. package/sensor/dist/extraction/vue-extractor.d.ts +51 -0
  286. package/sensor/dist/extraction/vue-extractor.d.ts.map +1 -0
  287. package/sensor/dist/extraction/vue-extractor.js +254 -0
  288. package/sensor/dist/extraction/vue-extractor.js.map +1 -0
  289. package/sensor/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  290. package/sensor/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  291. package/sensor/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  292. package/sensor/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  293. package/sensor/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  294. package/sensor/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  295. package/sensor/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  296. package/sensor/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  297. package/sensor/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  298. package/sensor/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  299. package/sensor/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  300. package/sensor/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  301. package/sensor/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  302. package/sensor/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  303. package/sensor/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  304. package/sensor/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  305. package/sensor/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  306. package/sensor/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
  307. package/sensor/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  308. package/sensor/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  309. package/sensor/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  310. package/sensor/dist/extraction/wasm-runtime-flags.d.ts +53 -0
  311. package/sensor/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  312. package/sensor/dist/extraction/wasm-runtime-flags.js +130 -0
  313. package/sensor/dist/extraction/wasm-runtime-flags.js.map +1 -0
  314. package/sensor/dist/graph/index.d.ts +8 -0
  315. package/sensor/dist/graph/index.d.ts.map +1 -0
  316. package/sensor/dist/graph/index.js +13 -0
  317. package/sensor/dist/graph/index.js.map +1 -0
  318. package/sensor/dist/graph/queries.d.ts +106 -0
  319. package/sensor/dist/graph/queries.d.ts.map +1 -0
  320. package/sensor/dist/graph/queries.js +339 -0
  321. package/sensor/dist/graph/queries.js.map +1 -0
  322. package/sensor/dist/graph/traversal.d.ts +127 -0
  323. package/sensor/dist/graph/traversal.d.ts.map +1 -0
  324. package/sensor/dist/graph/traversal.js +599 -0
  325. package/sensor/dist/graph/traversal.js.map +1 -0
  326. package/sensor/dist/index.d.ts +653 -0
  327. package/sensor/dist/index.d.ts.map +1 -0
  328. package/sensor/dist/index.js +1646 -0
  329. package/sensor/dist/index.js.map +1 -0
  330. package/sensor/dist/installer/beta-signup.d.ts +54 -0
  331. package/sensor/dist/installer/beta-signup.d.ts.map +1 -0
  332. package/sensor/dist/installer/beta-signup.js +178 -0
  333. package/sensor/dist/installer/beta-signup.js.map +1 -0
  334. package/sensor/dist/installer/config-writer.d.ts +28 -0
  335. package/sensor/dist/installer/config-writer.d.ts.map +1 -0
  336. package/sensor/dist/installer/config-writer.js +91 -0
  337. package/sensor/dist/installer/config-writer.js.map +1 -0
  338. package/sensor/dist/installer/index.d.ts +142 -0
  339. package/sensor/dist/installer/index.d.ts.map +1 -0
  340. package/sensor/dist/installer/index.js +622 -0
  341. package/sensor/dist/installer/index.js.map +1 -0
  342. package/sensor/dist/installer/instructions-template.d.ts +41 -0
  343. package/sensor/dist/installer/instructions-template.d.ts.map +1 -0
  344. package/sensor/dist/installer/instructions-template.js +53 -0
  345. package/sensor/dist/installer/instructions-template.js.map +1 -0
  346. package/sensor/dist/installer/targets/antigravity.d.ts +57 -0
  347. package/sensor/dist/installer/targets/antigravity.d.ts.map +1 -0
  348. package/sensor/dist/installer/targets/antigravity.js +308 -0
  349. package/sensor/dist/installer/targets/antigravity.js.map +1 -0
  350. package/sensor/dist/installer/targets/claude.d.ts +62 -0
  351. package/sensor/dist/installer/targets/claude.d.ts.map +1 -0
  352. package/sensor/dist/installer/targets/claude.js +454 -0
  353. package/sensor/dist/installer/targets/claude.js.map +1 -0
  354. package/sensor/dist/installer/targets/codex.d.ts +18 -0
  355. package/sensor/dist/installer/targets/codex.d.ts.map +1 -0
  356. package/sensor/dist/installer/targets/codex.js +185 -0
  357. package/sensor/dist/installer/targets/codex.js.map +1 -0
  358. package/sensor/dist/installer/targets/cursor.d.ts +35 -0
  359. package/sensor/dist/installer/targets/cursor.d.ts.map +1 -0
  360. package/sensor/dist/installer/targets/cursor.js +254 -0
  361. package/sensor/dist/installer/targets/cursor.js.map +1 -0
  362. package/sensor/dist/installer/targets/gemini.d.ts +26 -0
  363. package/sensor/dist/installer/targets/gemini.d.ts.map +1 -0
  364. package/sensor/dist/installer/targets/gemini.js +165 -0
  365. package/sensor/dist/installer/targets/gemini.js.map +1 -0
  366. package/sensor/dist/installer/targets/hermes.d.ts +18 -0
  367. package/sensor/dist/installer/targets/hermes.d.ts.map +1 -0
  368. package/sensor/dist/installer/targets/hermes.js +359 -0
  369. package/sensor/dist/installer/targets/hermes.js.map +1 -0
  370. package/sensor/dist/installer/targets/kiro.d.ts +27 -0
  371. package/sensor/dist/installer/targets/kiro.d.ts.map +1 -0
  372. package/sensor/dist/installer/targets/kiro.js +178 -0
  373. package/sensor/dist/installer/targets/kiro.js.map +1 -0
  374. package/sensor/dist/installer/targets/opencode.d.ts +38 -0
  375. package/sensor/dist/installer/targets/opencode.d.ts.map +1 -0
  376. package/sensor/dist/installer/targets/opencode.js +288 -0
  377. package/sensor/dist/installer/targets/opencode.js.map +1 -0
  378. package/sensor/dist/installer/targets/registry.d.ts +35 -0
  379. package/sensor/dist/installer/targets/registry.d.ts.map +1 -0
  380. package/sensor/dist/installer/targets/registry.js +91 -0
  381. package/sensor/dist/installer/targets/registry.js.map +1 -0
  382. package/sensor/dist/installer/targets/shared.d.ts +101 -0
  383. package/sensor/dist/installer/targets/shared.d.ts.map +1 -0
  384. package/sensor/dist/installer/targets/shared.js +264 -0
  385. package/sensor/dist/installer/targets/shared.js.map +1 -0
  386. package/sensor/dist/installer/targets/toml.d.ts +52 -0
  387. package/sensor/dist/installer/targets/toml.d.ts.map +1 -0
  388. package/sensor/dist/installer/targets/toml.js +147 -0
  389. package/sensor/dist/installer/targets/toml.js.map +1 -0
  390. package/sensor/dist/installer/targets/types.d.ts +108 -0
  391. package/sensor/dist/installer/targets/types.d.ts.map +1 -0
  392. package/sensor/dist/installer/targets/types.js +16 -0
  393. package/sensor/dist/installer/targets/types.js.map +1 -0
  394. package/sensor/dist/mcp/daemon-manager.d.ts +42 -0
  395. package/sensor/dist/mcp/daemon-manager.d.ts.map +1 -0
  396. package/sensor/dist/mcp/daemon-manager.js +129 -0
  397. package/sensor/dist/mcp/daemon-manager.js.map +1 -0
  398. package/sensor/dist/mcp/daemon-paths.d.ts +73 -0
  399. package/sensor/dist/mcp/daemon-paths.d.ts.map +1 -0
  400. package/sensor/dist/mcp/daemon-paths.js +170 -0
  401. package/sensor/dist/mcp/daemon-paths.js.map +1 -0
  402. package/sensor/dist/mcp/daemon-registry.d.ts +54 -0
  403. package/sensor/dist/mcp/daemon-registry.d.ts.map +1 -0
  404. package/sensor/dist/mcp/daemon-registry.js +241 -0
  405. package/sensor/dist/mcp/daemon-registry.js.map +1 -0
  406. package/sensor/dist/mcp/daemon.d.ts +290 -0
  407. package/sensor/dist/mcp/daemon.d.ts.map +1 -0
  408. package/sensor/dist/mcp/daemon.js +867 -0
  409. package/sensor/dist/mcp/daemon.js.map +1 -0
  410. package/sensor/dist/mcp/dynamic-boundaries.d.ts +41 -0
  411. package/sensor/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  412. package/sensor/dist/mcp/dynamic-boundaries.js +360 -0
  413. package/sensor/dist/mcp/dynamic-boundaries.js.map +1 -0
  414. package/sensor/dist/mcp/early-ppid.d.ts +26 -0
  415. package/sensor/dist/mcp/early-ppid.d.ts.map +1 -0
  416. package/sensor/dist/mcp/early-ppid.js +29 -0
  417. package/sensor/dist/mcp/early-ppid.js.map +1 -0
  418. package/sensor/dist/mcp/engine.d.ts +130 -0
  419. package/sensor/dist/mcp/engine.d.ts.map +1 -0
  420. package/sensor/dist/mcp/engine.js +375 -0
  421. package/sensor/dist/mcp/engine.js.map +1 -0
  422. package/sensor/dist/mcp/index.d.ts +113 -0
  423. package/sensor/dist/mcp/index.d.ts.map +1 -0
  424. package/sensor/dist/mcp/index.js +551 -0
  425. package/sensor/dist/mcp/index.js.map +1 -0
  426. package/sensor/dist/mcp/liveness-watchdog.d.ts +35 -0
  427. package/sensor/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  428. package/sensor/dist/mcp/liveness-watchdog.js +267 -0
  429. package/sensor/dist/mcp/liveness-watchdog.js.map +1 -0
  430. package/sensor/dist/mcp/ppid-watchdog.d.ts +62 -0
  431. package/sensor/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  432. package/sensor/dist/mcp/ppid-watchdog.js +64 -0
  433. package/sensor/dist/mcp/ppid-watchdog.js.map +1 -0
  434. package/sensor/dist/mcp/proxy.d.ts +99 -0
  435. package/sensor/dist/mcp/proxy.d.ts.map +1 -0
  436. package/sensor/dist/mcp/proxy.js +737 -0
  437. package/sensor/dist/mcp/proxy.js.map +1 -0
  438. package/sensor/dist/mcp/query-pool.d.ts +108 -0
  439. package/sensor/dist/mcp/query-pool.d.ts.map +1 -0
  440. package/sensor/dist/mcp/query-pool.js +315 -0
  441. package/sensor/dist/mcp/query-pool.js.map +1 -0
  442. package/sensor/dist/mcp/query-worker.d.ts +24 -0
  443. package/sensor/dist/mcp/query-worker.d.ts.map +1 -0
  444. package/sensor/dist/mcp/query-worker.js +87 -0
  445. package/sensor/dist/mcp/query-worker.js.map +1 -0
  446. package/sensor/dist/mcp/server-instructions.d.ts +34 -0
  447. package/sensor/dist/mcp/server-instructions.d.ts.map +1 -0
  448. package/sensor/dist/mcp/server-instructions.js +106 -0
  449. package/sensor/dist/mcp/server-instructions.js.map +1 -0
  450. package/sensor/dist/mcp/session.d.ts +92 -0
  451. package/sensor/dist/mcp/session.d.ts.map +1 -0
  452. package/sensor/dist/mcp/session.js +355 -0
  453. package/sensor/dist/mcp/session.js.map +1 -0
  454. package/sensor/dist/mcp/startup-handshake.d.ts +44 -0
  455. package/sensor/dist/mcp/startup-handshake.d.ts.map +1 -0
  456. package/sensor/dist/mcp/startup-handshake.js +73 -0
  457. package/sensor/dist/mcp/startup-handshake.js.map +1 -0
  458. package/sensor/dist/mcp/stdin-teardown.d.ts +27 -0
  459. package/sensor/dist/mcp/stdin-teardown.d.ts.map +1 -0
  460. package/sensor/dist/mcp/stdin-teardown.js +49 -0
  461. package/sensor/dist/mcp/stdin-teardown.js.map +1 -0
  462. package/sensor/dist/mcp/tools.d.ts +651 -0
  463. package/sensor/dist/mcp/tools.d.ts.map +1 -0
  464. package/sensor/dist/mcp/tools.js +4574 -0
  465. package/sensor/dist/mcp/tools.js.map +1 -0
  466. package/sensor/dist/mcp/transport.d.ts +188 -0
  467. package/sensor/dist/mcp/transport.d.ts.map +1 -0
  468. package/sensor/dist/mcp/transport.js +377 -0
  469. package/sensor/dist/mcp/transport.js.map +1 -0
  470. package/sensor/dist/mcp/version.d.ts +30 -0
  471. package/sensor/dist/mcp/version.d.ts.map +1 -0
  472. package/sensor/dist/mcp/version.js +85 -0
  473. package/sensor/dist/mcp/version.js.map +1 -0
  474. package/sensor/dist/project-config.d.ts +94 -0
  475. package/sensor/dist/project-config.d.ts.map +1 -0
  476. package/sensor/dist/project-config.js +374 -0
  477. package/sensor/dist/project-config.js.map +1 -0
  478. package/sensor/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
  479. package/sensor/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  480. package/sensor/dist/resolution/c-fnptr-synthesizer.js +1070 -0
  481. package/sensor/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  482. package/sensor/dist/resolution/callback-synthesizer.d.ts +59 -0
  483. package/sensor/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  484. package/sensor/dist/resolution/callback-synthesizer.js +3961 -0
  485. package/sensor/dist/resolution/callback-synthesizer.js.map +1 -0
  486. package/sensor/dist/resolution/cooperative-yield.d.ts +40 -0
  487. package/sensor/dist/resolution/cooperative-yield.d.ts.map +1 -0
  488. package/sensor/dist/resolution/cooperative-yield.js +44 -0
  489. package/sensor/dist/resolution/cooperative-yield.js.map +1 -0
  490. package/sensor/dist/resolution/frameworks/astro.d.ts +9 -0
  491. package/sensor/dist/resolution/frameworks/astro.d.ts.map +1 -0
  492. package/sensor/dist/resolution/frameworks/astro.js +169 -0
  493. package/sensor/dist/resolution/frameworks/astro.js.map +1 -0
  494. package/sensor/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  495. package/sensor/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  496. package/sensor/dist/resolution/frameworks/cargo-workspace.js +225 -0
  497. package/sensor/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  498. package/sensor/dist/resolution/frameworks/cics.d.ts +20 -0
  499. package/sensor/dist/resolution/frameworks/cics.d.ts.map +1 -0
  500. package/sensor/dist/resolution/frameworks/cics.js +90 -0
  501. package/sensor/dist/resolution/frameworks/cics.js.map +1 -0
  502. package/sensor/dist/resolution/frameworks/csharp.d.ts +8 -0
  503. package/sensor/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  504. package/sensor/dist/resolution/frameworks/csharp.js +241 -0
  505. package/sensor/dist/resolution/frameworks/csharp.js.map +1 -0
  506. package/sensor/dist/resolution/frameworks/drupal.d.ts +51 -0
  507. package/sensor/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  508. package/sensor/dist/resolution/frameworks/drupal.js +367 -0
  509. package/sensor/dist/resolution/frameworks/drupal.js.map +1 -0
  510. package/sensor/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  511. package/sensor/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  512. package/sensor/dist/resolution/frameworks/expo-modules.js +148 -0
  513. package/sensor/dist/resolution/frameworks/expo-modules.js.map +1 -0
  514. package/sensor/dist/resolution/frameworks/express.d.ts +8 -0
  515. package/sensor/dist/resolution/frameworks/express.d.ts.map +1 -0
  516. package/sensor/dist/resolution/frameworks/express.js +308 -0
  517. package/sensor/dist/resolution/frameworks/express.js.map +1 -0
  518. package/sensor/dist/resolution/frameworks/fabric.d.ts +3 -0
  519. package/sensor/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  520. package/sensor/dist/resolution/frameworks/fabric.js +354 -0
  521. package/sensor/dist/resolution/frameworks/fabric.js.map +1 -0
  522. package/sensor/dist/resolution/frameworks/go.d.ts +8 -0
  523. package/sensor/dist/resolution/frameworks/go.d.ts.map +1 -0
  524. package/sensor/dist/resolution/frameworks/go.js +184 -0
  525. package/sensor/dist/resolution/frameworks/go.js.map +1 -0
  526. package/sensor/dist/resolution/frameworks/goframe.d.ts +41 -0
  527. package/sensor/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  528. package/sensor/dist/resolution/frameworks/goframe.js +112 -0
  529. package/sensor/dist/resolution/frameworks/goframe.js.map +1 -0
  530. package/sensor/dist/resolution/frameworks/index.d.ts +50 -0
  531. package/sensor/dist/resolution/frameworks/index.d.ts.map +1 -0
  532. package/sensor/dist/resolution/frameworks/index.js +175 -0
  533. package/sensor/dist/resolution/frameworks/index.js.map +1 -0
  534. package/sensor/dist/resolution/frameworks/java.d.ts +8 -0
  535. package/sensor/dist/resolution/frameworks/java.d.ts.map +1 -0
  536. package/sensor/dist/resolution/frameworks/java.js +517 -0
  537. package/sensor/dist/resolution/frameworks/java.js.map +1 -0
  538. package/sensor/dist/resolution/frameworks/laravel.d.ts +13 -0
  539. package/sensor/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  540. package/sensor/dist/resolution/frameworks/laravel.js +257 -0
  541. package/sensor/dist/resolution/frameworks/laravel.js.map +1 -0
  542. package/sensor/dist/resolution/frameworks/nestjs.d.ts +26 -0
  543. package/sensor/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  544. package/sensor/dist/resolution/frameworks/nestjs.js +698 -0
  545. package/sensor/dist/resolution/frameworks/nestjs.js.map +1 -0
  546. package/sensor/dist/resolution/frameworks/play.d.ts +19 -0
  547. package/sensor/dist/resolution/frameworks/play.d.ts.map +1 -0
  548. package/sensor/dist/resolution/frameworks/play.js +111 -0
  549. package/sensor/dist/resolution/frameworks/play.js.map +1 -0
  550. package/sensor/dist/resolution/frameworks/python.d.ts +10 -0
  551. package/sensor/dist/resolution/frameworks/python.d.ts.map +1 -0
  552. package/sensor/dist/resolution/frameworks/python.js +400 -0
  553. package/sensor/dist/resolution/frameworks/python.js.map +1 -0
  554. package/sensor/dist/resolution/frameworks/react-native.d.ts +3 -0
  555. package/sensor/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  556. package/sensor/dist/resolution/frameworks/react-native.js +410 -0
  557. package/sensor/dist/resolution/frameworks/react-native.js.map +1 -0
  558. package/sensor/dist/resolution/frameworks/react.d.ts +8 -0
  559. package/sensor/dist/resolution/frameworks/react.d.ts.map +1 -0
  560. package/sensor/dist/resolution/frameworks/react.js +334 -0
  561. package/sensor/dist/resolution/frameworks/react.js.map +1 -0
  562. package/sensor/dist/resolution/frameworks/ruby.d.ts +8 -0
  563. package/sensor/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  564. package/sensor/dist/resolution/frameworks/ruby.js +302 -0
  565. package/sensor/dist/resolution/frameworks/ruby.js.map +1 -0
  566. package/sensor/dist/resolution/frameworks/rust.d.ts +8 -0
  567. package/sensor/dist/resolution/frameworks/rust.d.ts.map +1 -0
  568. package/sensor/dist/resolution/frameworks/rust.js +304 -0
  569. package/sensor/dist/resolution/frameworks/rust.js.map +1 -0
  570. package/sensor/dist/resolution/frameworks/svelte.d.ts +9 -0
  571. package/sensor/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  572. package/sensor/dist/resolution/frameworks/svelte.js +253 -0
  573. package/sensor/dist/resolution/frameworks/svelte.js.map +1 -0
  574. package/sensor/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  575. package/sensor/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  576. package/sensor/dist/resolution/frameworks/swift-objc.js +252 -0
  577. package/sensor/dist/resolution/frameworks/swift-objc.js.map +1 -0
  578. package/sensor/dist/resolution/frameworks/swift.d.ts +10 -0
  579. package/sensor/dist/resolution/frameworks/swift.d.ts.map +1 -0
  580. package/sensor/dist/resolution/frameworks/swift.js +400 -0
  581. package/sensor/dist/resolution/frameworks/swift.js.map +1 -0
  582. package/sensor/dist/resolution/frameworks/terraform.d.ts +38 -0
  583. package/sensor/dist/resolution/frameworks/terraform.d.ts.map +1 -0
  584. package/sensor/dist/resolution/frameworks/terraform.js +277 -0
  585. package/sensor/dist/resolution/frameworks/terraform.js.map +1 -0
  586. package/sensor/dist/resolution/frameworks/vue.d.ts +9 -0
  587. package/sensor/dist/resolution/frameworks/vue.d.ts.map +1 -0
  588. package/sensor/dist/resolution/frameworks/vue.js +303 -0
  589. package/sensor/dist/resolution/frameworks/vue.js.map +1 -0
  590. package/sensor/dist/resolution/go-module.d.ts +26 -0
  591. package/sensor/dist/resolution/go-module.d.ts.map +1 -0
  592. package/sensor/dist/resolution/go-module.js +78 -0
  593. package/sensor/dist/resolution/go-module.js.map +1 -0
  594. package/sensor/dist/resolution/goframe-synthesizer.d.ts +29 -0
  595. package/sensor/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  596. package/sensor/dist/resolution/goframe-synthesizer.js +163 -0
  597. package/sensor/dist/resolution/goframe-synthesizer.js.map +1 -0
  598. package/sensor/dist/resolution/import-resolver.d.ts +84 -0
  599. package/sensor/dist/resolution/import-resolver.d.ts.map +1 -0
  600. package/sensor/dist/resolution/import-resolver.js +2172 -0
  601. package/sensor/dist/resolution/import-resolver.js.map +1 -0
  602. package/sensor/dist/resolution/index.d.ts +309 -0
  603. package/sensor/dist/resolution/index.d.ts.map +1 -0
  604. package/sensor/dist/resolution/index.js +2050 -0
  605. package/sensor/dist/resolution/index.js.map +1 -0
  606. package/sensor/dist/resolution/lru-cache.d.ts +24 -0
  607. package/sensor/dist/resolution/lru-cache.d.ts.map +1 -0
  608. package/sensor/dist/resolution/lru-cache.js +62 -0
  609. package/sensor/dist/resolution/lru-cache.js.map +1 -0
  610. package/sensor/dist/resolution/name-matcher.d.ts +126 -0
  611. package/sensor/dist/resolution/name-matcher.d.ts.map +1 -0
  612. package/sensor/dist/resolution/name-matcher.js +1968 -0
  613. package/sensor/dist/resolution/name-matcher.js.map +1 -0
  614. package/sensor/dist/resolution/path-aliases.d.ts +68 -0
  615. package/sensor/dist/resolution/path-aliases.d.ts.map +1 -0
  616. package/sensor/dist/resolution/path-aliases.js +238 -0
  617. package/sensor/dist/resolution/path-aliases.js.map +1 -0
  618. package/sensor/dist/resolution/resolver-pool.d.ts +66 -0
  619. package/sensor/dist/resolution/resolver-pool.d.ts.map +1 -0
  620. package/sensor/dist/resolution/resolver-pool.js +244 -0
  621. package/sensor/dist/resolution/resolver-pool.js.map +1 -0
  622. package/sensor/dist/resolution/resolver-worker.d.ts +17 -0
  623. package/sensor/dist/resolution/resolver-worker.d.ts.map +1 -0
  624. package/sensor/dist/resolution/resolver-worker.js +114 -0
  625. package/sensor/dist/resolution/resolver-worker.js.map +1 -0
  626. package/sensor/dist/resolution/strip-comments.d.ts +27 -0
  627. package/sensor/dist/resolution/strip-comments.d.ts.map +1 -0
  628. package/sensor/dist/resolution/strip-comments.js +492 -0
  629. package/sensor/dist/resolution/strip-comments.js.map +1 -0
  630. package/sensor/dist/resolution/swift-objc-bridge.d.ts +134 -0
  631. package/sensor/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  632. package/sensor/dist/resolution/swift-objc-bridge.js +256 -0
  633. package/sensor/dist/resolution/swift-objc-bridge.js.map +1 -0
  634. package/sensor/dist/resolution/types.d.ts +265 -0
  635. package/sensor/dist/resolution/types.d.ts.map +1 -0
  636. package/sensor/dist/resolution/types.js +8 -0
  637. package/sensor/dist/resolution/types.js.map +1 -0
  638. package/sensor/dist/resolution/workspace-packages.d.ts +58 -0
  639. package/sensor/dist/resolution/workspace-packages.d.ts.map +1 -0
  640. package/sensor/dist/resolution/workspace-packages.js +346 -0
  641. package/sensor/dist/resolution/workspace-packages.js.map +1 -0
  642. package/sensor/dist/search/identifier-segments.d.ts +60 -0
  643. package/sensor/dist/search/identifier-segments.d.ts.map +1 -0
  644. package/sensor/dist/search/identifier-segments.js +176 -0
  645. package/sensor/dist/search/identifier-segments.js.map +1 -0
  646. package/sensor/dist/search/query-parser.d.ts +57 -0
  647. package/sensor/dist/search/query-parser.d.ts.map +1 -0
  648. package/sensor/dist/search/query-parser.js +177 -0
  649. package/sensor/dist/search/query-parser.js.map +1 -0
  650. package/sensor/dist/search/query-utils.d.ts +87 -0
  651. package/sensor/dist/search/query-utils.d.ts.map +1 -0
  652. package/sensor/dist/search/query-utils.js +449 -0
  653. package/sensor/dist/search/query-utils.js.map +1 -0
  654. package/sensor/dist/sync/git-hooks.d.ts +45 -0
  655. package/sensor/dist/sync/git-hooks.d.ts.map +1 -0
  656. package/sensor/dist/sync/git-hooks.js +227 -0
  657. package/sensor/dist/sync/git-hooks.js.map +1 -0
  658. package/sensor/dist/sync/index.d.ts +19 -0
  659. package/sensor/dist/sync/index.d.ts.map +1 -0
  660. package/sensor/dist/sync/index.js +35 -0
  661. package/sensor/dist/sync/index.js.map +1 -0
  662. package/sensor/dist/sync/watch-policy.d.ts +48 -0
  663. package/sensor/dist/sync/watch-policy.d.ts.map +1 -0
  664. package/sensor/dist/sync/watch-policy.js +124 -0
  665. package/sensor/dist/sync/watch-policy.js.map +1 -0
  666. package/sensor/dist/sync/watcher.d.ts +372 -0
  667. package/sensor/dist/sync/watcher.d.ts.map +1 -0
  668. package/sensor/dist/sync/watcher.js +879 -0
  669. package/sensor/dist/sync/watcher.js.map +1 -0
  670. package/sensor/dist/sync/worktree.d.ts +63 -0
  671. package/sensor/dist/sync/worktree.d.ts.map +1 -0
  672. package/sensor/dist/sync/worktree.js +182 -0
  673. package/sensor/dist/sync/worktree.js.map +1 -0
  674. package/sensor/dist/telemetry/index.d.ts +157 -0
  675. package/sensor/dist/telemetry/index.d.ts.map +1 -0
  676. package/sensor/dist/telemetry/index.js +556 -0
  677. package/sensor/dist/telemetry/index.js.map +1 -0
  678. package/sensor/dist/types.d.ts +458 -0
  679. package/sensor/dist/types.d.ts.map +1 -0
  680. package/sensor/dist/types.js +117 -0
  681. package/sensor/dist/types.js.map +1 -0
  682. package/sensor/dist/ui/color.d.ts +21 -0
  683. package/sensor/dist/ui/color.d.ts.map +1 -0
  684. package/sensor/dist/ui/color.js +42 -0
  685. package/sensor/dist/ui/color.js.map +1 -0
  686. package/sensor/dist/ui/glyphs.d.ts +67 -0
  687. package/sensor/dist/ui/glyphs.d.ts.map +1 -0
  688. package/sensor/dist/ui/glyphs.js +125 -0
  689. package/sensor/dist/ui/glyphs.js.map +1 -0
  690. package/sensor/dist/ui/shimmer-progress.d.ts +11 -0
  691. package/sensor/dist/ui/shimmer-progress.d.ts.map +1 -0
  692. package/sensor/dist/ui/shimmer-progress.js +164 -0
  693. package/sensor/dist/ui/shimmer-progress.js.map +1 -0
  694. package/sensor/dist/ui/shimmer-worker.d.ts +2 -0
  695. package/sensor/dist/ui/shimmer-worker.d.ts.map +1 -0
  696. package/sensor/dist/ui/shimmer-worker.js +126 -0
  697. package/sensor/dist/ui/shimmer-worker.js.map +1 -0
  698. package/sensor/dist/ui/types.d.ts +15 -0
  699. package/sensor/dist/ui/types.d.ts.map +1 -0
  700. package/sensor/dist/ui/types.js +3 -0
  701. package/sensor/dist/ui/types.js.map +1 -0
  702. package/sensor/dist/upgrade/index.d.ts +171 -0
  703. package/sensor/dist/upgrade/index.d.ts.map +1 -0
  704. package/sensor/dist/upgrade/index.js +659 -0
  705. package/sensor/dist/upgrade/index.js.map +1 -0
  706. package/sensor/dist/upgrade/remove-binary.d.ts +87 -0
  707. package/sensor/dist/upgrade/remove-binary.d.ts.map +1 -0
  708. package/sensor/dist/upgrade/remove-binary.js +289 -0
  709. package/sensor/dist/upgrade/remove-binary.js.map +1 -0
  710. package/sensor/dist/upgrade/update-check.d.ts +92 -0
  711. package/sensor/dist/upgrade/update-check.d.ts.map +1 -0
  712. package/sensor/dist/upgrade/update-check.js +258 -0
  713. package/sensor/dist/upgrade/update-check.js.map +1 -0
  714. package/sensor/dist/utils.d.ts +224 -0
  715. package/sensor/dist/utils.d.ts.map +1 -0
  716. package/sensor/dist/utils.js +583 -0
  717. package/sensor/dist/utils.js.map +1 -0
  718. package/sensor/package.json +61 -0
  719. package/src/artifact-contracts-v2.mjs +325 -0
  720. package/src/artifact-contracts.mjs +895 -0
  721. package/src/bootstrap.mjs +88 -0
  722. package/src/boundary-compiler.mjs +712 -0
  723. package/src/boundary-observation-compiler-v2.mjs +339 -0
  724. package/src/codegraph-adapter.mjs +422 -0
  725. package/src/control-compiler.mjs +532 -0
  726. package/src/factory-diagnostics.mjs +187 -0
  727. package/src/isolation-runner.mjs +333 -0
  728. package/src/node-version-guard.mjs +43 -0
  729. package/src/rc1-black-box-oracle.mjs +906 -0
  730. package/src/rc1-comparison.mjs +154 -0
  731. package/src/rc1-evidence-bundle.mjs +456 -0
  732. package/src/rc1-v4-campaign.mjs +707 -0
  733. package/src/rc1-v4-transform.mjs +467 -0
  734. package/src/rc1-v5-artifact-set.mjs +855 -0
  735. package/src/rc1-v5-behavior-evidence.mjs +594 -0
  736. package/src/rc1-v5-campaign.mjs +796 -0
  737. package/src/rc1-v5-transform.mjs +421 -0
  738. package/src/rc1-v6-artifact-set.mjs +807 -0
  739. package/src/rc1-v6-behavior-evidence.mjs +273 -0
  740. package/src/rc1-v6-campaign.mjs +623 -0
  741. package/src/rc1-v6-causal-binding.mjs +471 -0
  742. package/src/rc1-v6-measurement.mjs +331 -0
  743. package/src/rc2-artifact-set.mjs +1579 -0
  744. package/src/rc2-campaign.mjs +1520 -0
  745. package/src/rc2-delivery-policy-front-end.mjs +1079 -0
  746. package/src/rc2-delivery-policy-oracle.mjs +134 -0
  747. package/src/rc2-delivery-policy-transform.mjs +1127 -0
  748. package/src/rc2-rc1-transfer-front-end.mjs +511 -0
  749. package/src/rc3-actual-dogfood.mjs +648 -0
  750. package/src/rc3-dogfood-scaffold.mjs +310 -0
  751. package/src/rc3-scripted-campaign.mjs +1301 -0
  752. package/src/rc4-stage1-dogfood.mjs +652 -0
  753. package/src/runtime-cli.mjs +504 -0
  754. package/src/runtime-contracts.mjs +631 -0
  755. package/src/runtime-decision-verifier.mjs +607 -0
  756. package/src/runtime-diff-observer.mjs +265 -0
  757. package/src/runtime-engine.mjs +674 -0
  758. package/src/runtime-errors.mjs +356 -0
  759. package/src/runtime-event-store.mjs +217 -0
  760. package/src/runtime-front-end.mjs +764 -0
  761. package/src/runtime-hold-recompile.mjs +606 -0
  762. package/src/runtime-projection.mjs +180 -0
  763. package/src/runtime-scripted-executor.mjs +163 -0
  764. package/src/runtime-worktree-executor.mjs +199 -0
  765. package/src/schedulability-compiler-v2.mjs +303 -0
  766. package/src/schedulability-verifier-v2.mjs +317 -0
  767. package/src/seam-transform.mjs +554 -0
  768. package/src/treatment-compiler.mjs +728 -0
  769. package/src/treatment-runner.mjs +658 -0
@@ -0,0 +1,1070 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.cFnPointerDispatchEdges = cFnPointerDispatchEdges;
37
+ /**
38
+ * C/C++ function-pointer dispatch synthesis (#932).
39
+ *
40
+ * C/C++ polymorphism is the function pointer: a struct carries a fn-pointer
41
+ * field (`int (*fn)(int)`, or a fn-pointer-typedef field `hook_func func`),
42
+ * concrete functions are *registered* into it through a table
43
+ * (`static struct cmd cmds[] = {{"add", cmd_add}, …}`, a designated
44
+ * `.fn = cmd_add`, or `x->fn = cmd_add`), and the dispatcher calls through it
45
+ * indirectly (`p->fn(argv)`). Static extraction captures neither the
46
+ * registration→field binding nor the indirect call, so the dispatcher→handler
47
+ * edge is missing and `git`'s `run_builtin` looks like it calls nothing, the
48
+ * hooks in `hook_demo.c` are unreachable, etc.
49
+ *
50
+ * This bridges it, keyed by **(struct type, fn-pointer field)**:
51
+ * • registrations — a function bound to `S.field` via a positional
52
+ * initializer (matched by field index), a designated `.field = fn`, or a
53
+ * direct `x.field = fn` / `x->field = fn` assignment;
54
+ * • dispatch — `recv->field(…)` / `recv.field(…)` where `recv` resolves to a
55
+ * value of struct type `S` (from the enclosing function's params / locals,
56
+ * or by walking a chained/array receiver `c->cmd->proc` across field types),
57
+ * falling back to the field name when it is unique to one struct;
58
+ * • field←field propagation — `a->f = b->g` merges `B.g`'s handlers into
59
+ * `A.f`, so a generic single-slot hook that is reassigned from a registry
60
+ * (the `hook_demo.c` shape: `h->func = found->fn`) still resolves.
61
+ *
62
+ * Also handles **macro-built tables** (#991) — the dominant real-world shape,
63
+ * e.g. redis' command table, sqlite's builtin functions, and vim's `:ex` /
64
+ * normal-mode commands. The fn-pointer arg lives inside a macro call
65
+ * (`MAKE_CMD(…,proc,…)` / `FUNCTION(…,xFunc)` / `EXCMD(…,fn,…)`) in a generated
66
+ * or `#include`-d file; the table's struct type may itself be an object-macro
67
+ * alias; the field may use a function-TYPE typedef; the struct may be defined
68
+ * INLINE with the array; and the whole thing may sit behind `#ifdef` switched on
69
+ * by the includer. The registration pass reads each `#include`-d file as a unit
70
+ * with the includer's effective macro env (own + headers) in scope, evaluates
71
+ * its `#ifdef`s against the includer's defined set, expands object/function
72
+ * macros, peels a brace-wrapped element, and parses an inline struct in place —
73
+ * then reads the positional/designated bindings. Dispatch additionally resolves
74
+ * an array subscript through a file-scope table (`(cmdnames[i].cmd_func)(…)`).
75
+ *
76
+ * Also bridges **bare arrays of function pointers** (no struct, no field) —
77
+ * `opcode_t *opcodes[256] = {nop,…}` dispatched `opcodes[op](…)` (SameBoy's CPU),
78
+ * `zend_rc_dtor_func_t t[] = {[IS_STRING]=(cast)fn,…}` dispatched `t[GC_TYPE(p)](…)`
79
+ * (php's Zend) — keyed by the array VARIABLE name. The element type must be a
80
+ * function typedef (the precision gate), entries are literal function names, and
81
+ * the same-file table wins on a name collision (two file-local `opcodes[256]`).
82
+ *
83
+ * Whole-graph pass after base resolution; all edges are `provenance:'heuristic'`
84
+ * (`synthesizedBy:'fn-pointer-dispatch'`). High precision via the (type, field)
85
+ * key + a real-function gate; a project with no fn-pointer dispatch is a no-op.
86
+ */
87
+ const path = __importStar(require("node:path"));
88
+ const lru_cache_1 = require("./lru-cache");
89
+ const strip_comments_1 = require("./strip-comments");
90
+ const C_CPP_EXT = /\.(c|h|cc|cpp|cxx|hpp|hh|hxx|cppm|ipp|inl|tcc)$/i;
91
+ const FN_KINDS = new Set(['function', 'method']);
92
+ const FANOUT_CAP = 300; // a real command table (git ~150) is legitimate fan-out; this only stops pathological cases.
93
+ function sliceLines(content, startLine, endLine) {
94
+ if (!startLine)
95
+ return '';
96
+ return content.split('\n').slice(startLine - 1, endLine ?? startLine).join('\n');
97
+ }
98
+ /** Index of the `}` matching the `{` at `open` (which must point at a `{`). -1 if unbalanced. */
99
+ function matchBrace(src, open) {
100
+ let depth = 0;
101
+ for (let i = open; i < src.length; i++) {
102
+ const c = src[i];
103
+ if (c === '{')
104
+ depth++;
105
+ else if (c === '}') {
106
+ depth--;
107
+ if (depth === 0)
108
+ return i;
109
+ }
110
+ }
111
+ return -1;
112
+ }
113
+ /** Split `body` on `sep` at brace/paren/bracket depth 0 (commas inside `{…}` / `(…)` stay together). */
114
+ function splitTopLevel(body, sep) {
115
+ const out = [];
116
+ let depth = 0;
117
+ let start = 0;
118
+ for (let i = 0; i < body.length; i++) {
119
+ const c = body[i];
120
+ if (c === '{' || c === '(' || c === '[')
121
+ depth++;
122
+ else if (c === '}' || c === ')' || c === ']')
123
+ depth--;
124
+ else if (c === sep && depth === 0) {
125
+ out.push(body.slice(start, i));
126
+ start = i + 1;
127
+ }
128
+ }
129
+ out.push(body.slice(start));
130
+ return out;
131
+ }
132
+ /** Index of the `)` matching the `(` at `open` (which must point at a `(`). -1 if unbalanced. */
133
+ function matchParen(src, open) {
134
+ let depth = 0;
135
+ for (let i = open; i < src.length; i++) {
136
+ const c = src[i];
137
+ if (c === '(')
138
+ depth++;
139
+ else if (c === ')') {
140
+ depth--;
141
+ if (depth === 0)
142
+ return i;
143
+ }
144
+ }
145
+ return -1;
146
+ }
147
+ /**
148
+ * Collect function-like macros from (comment-stripped) source, joining
149
+ * `\`-continuations first. Only object/positional table macros matter here, so
150
+ * variadic macros are skipped. Used to expand registration tables built through
151
+ * a macro (redis' `MAKE_CMD(…)`) before reading the struct-field bindings.
152
+ */
153
+ function parseFunctionMacros(stripped) {
154
+ const out = new Map();
155
+ if (!stripped.includes('#define') && !stripped.includes('# define'))
156
+ return out;
157
+ const joined = stripped.replace(/\\\r?\n/g, ' ');
158
+ const RE = /^[ \t]*#[ \t]*define[ \t]+(\w+)\(([^)]*)\)\s+(.+)$/gm;
159
+ let m;
160
+ while ((m = RE.exec(joined))) {
161
+ const params = m[2].split(',').map((p) => p.trim()).filter(Boolean);
162
+ if (params.some((p) => p === '...' || p.endsWith('...')))
163
+ continue; // variadic — skip
164
+ out.set(m[1], { params, expansion: m[3].trim() });
165
+ }
166
+ return out;
167
+ }
168
+ /**
169
+ * Collect object-like macros `#define NAME value` (NAME not immediately followed
170
+ * by `(`). redis aliases the table's struct type this way:
171
+ * `#define COMMAND_STRUCT redisCommand`, used as `struct COMMAND_STRUCT table[]`.
172
+ */
173
+ function parseObjectMacros(stripped) {
174
+ const out = new Map();
175
+ if (!stripped.includes('#define') && !stripped.includes('# define'))
176
+ return out;
177
+ const joined = stripped.replace(/\\\r?\n/g, ' ');
178
+ const RE = /^[ \t]*#[ \t]*define[ \t]+(\w+)[ \t]+(\S[^\n]*)$/gm;
179
+ let m;
180
+ while ((m = RE.exec(joined)))
181
+ out.set(m[1], m[2].trim());
182
+ return out;
183
+ }
184
+ /** All macro names a file `#define`s (value-ful or not) — the "defined" set for #ifdef. */
185
+ function parseDefinedNames(stripped) {
186
+ const out = new Set();
187
+ if (!stripped.includes('#define') && !stripped.includes('# define'))
188
+ return out;
189
+ const RE = /^[ \t]*#[ \t]*define[ \t]+(\w+)/gm;
190
+ let m;
191
+ while ((m = RE.exec(stripped)))
192
+ out.add(m[1]);
193
+ return out;
194
+ }
195
+ /**
196
+ * Drop the inactive arms of `#ifdef`/`#ifndef`/`#if defined(X)`/`#else`/`#elif`/
197
+ * `#endif` given a set of defined macro names, keeping line offsets (inactive
198
+ * lines are blanked, not removed). A conditional whose expression we can't
199
+ * evaluate (`#if SOME_EXPR`) keeps its body — better to over-keep than to drop
200
+ * live code. This is what makes a header included with a switch macro defined
201
+ * (vim's `ex_cmds.h` under `DO_DECLARE_EXCMD`) expose only its active table.
202
+ */
203
+ function evalConditionals(text, defined) {
204
+ if (!/#\s*if/.test(text))
205
+ return text;
206
+ const lines = text.split('\n');
207
+ // stack frame: parentActive = enclosing kept?; active = this arm kept?; taken = any arm taken yet
208
+ const stack = [];
209
+ const activeNow = () => (stack.length === 0 ? true : stack[stack.length - 1].active);
210
+ const condDefined = (expr) => {
211
+ let mm = expr.match(/^defined\s*\(?\s*(\w+)\s*\)?$/);
212
+ if (mm)
213
+ return defined.has(mm[1]);
214
+ mm = expr.match(/^!\s*defined\s*\(?\s*(\w+)\s*\)?$/);
215
+ if (mm)
216
+ return !defined.has(mm[1]);
217
+ return null; // unevaluable
218
+ };
219
+ for (let i = 0; i < lines.length; i++) {
220
+ const t = lines[i].trim();
221
+ let mm;
222
+ if ((mm = t.match(/^#\s*ifdef\s+(\w+)/))) {
223
+ const pa = activeNow();
224
+ const cond = defined.has(mm[1]);
225
+ stack.push({ parentActive: pa, active: pa && cond, taken: cond });
226
+ lines[i] = '';
227
+ continue;
228
+ }
229
+ if ((mm = t.match(/^#\s*ifndef\s+(\w+)/))) {
230
+ const pa = activeNow();
231
+ const cond = !defined.has(mm[1]);
232
+ stack.push({ parentActive: pa, active: pa && cond, taken: cond });
233
+ lines[i] = '';
234
+ continue;
235
+ }
236
+ if ((mm = t.match(/^#\s*if\s+(.+)$/))) {
237
+ const pa = activeNow();
238
+ const c = condDefined(mm[1].trim());
239
+ const cond = c === null ? true : c; // unevaluable → keep
240
+ stack.push({ parentActive: pa, active: pa && cond, taken: cond });
241
+ lines[i] = '';
242
+ continue;
243
+ }
244
+ if (/^#\s*elif\b/.test(t)) {
245
+ const top = stack[stack.length - 1];
246
+ if (top) {
247
+ top.active = top.parentActive && !top.taken;
248
+ top.taken = true;
249
+ }
250
+ lines[i] = '';
251
+ continue;
252
+ }
253
+ if (/^#\s*else\b/.test(t)) {
254
+ const top = stack[stack.length - 1];
255
+ if (top) {
256
+ top.active = top.parentActive && !top.taken;
257
+ top.taken = true;
258
+ }
259
+ lines[i] = '';
260
+ continue;
261
+ }
262
+ if (/^#\s*endif\b/.test(t)) {
263
+ stack.pop();
264
+ lines[i] = '';
265
+ continue;
266
+ }
267
+ if (!activeNow())
268
+ lines[i] = ''; // blank an inactive line (keep the newline)
269
+ }
270
+ return lines.join('\n');
271
+ }
272
+ /** Resolve a type token through object-like macro aliases (transitive, capped). */
273
+ function resolveTypeName(name, objEnv) {
274
+ let n = name;
275
+ for (let i = 0; objEnv && i < 5; i++) {
276
+ const v = objEnv.get(n);
277
+ const t = v?.trim().match(/^(?:struct\s+)?(\w+)$/);
278
+ if (!t)
279
+ break;
280
+ n = t[1];
281
+ }
282
+ return n;
283
+ }
284
+ /** Substitute call args for the macro's params (whole-token) in its expansion. */
285
+ function substituteMacro(def, args) {
286
+ const map = new Map();
287
+ def.params.forEach((p, i) => map.set(p, args[i] ?? ''));
288
+ return def.expansion.replace(/\b\w+\b/g, (tok) => (map.has(tok) ? map.get(tok) : tok));
289
+ }
290
+ /**
291
+ * Expand known function-like macro calls in `text` to a fixpoint (depth-capped).
292
+ * `MAKE_CMD("get",…,getCommand,…)` → the positional value list whose slots line
293
+ * up with the struct's fields, so the existing positional registration can read
294
+ * `getCommand` straight out of the `proc` slot.
295
+ */
296
+ function expandMacroCalls(text, env) {
297
+ if (env.size === 0)
298
+ return text;
299
+ let out = text;
300
+ for (let pass = 0; pass < 6; pass++) {
301
+ let changed = false;
302
+ const RE = /\b(\w+)\s*\(/g;
303
+ let m;
304
+ while ((m = RE.exec(out))) {
305
+ const def = env.get(m[1]);
306
+ if (!def)
307
+ continue;
308
+ const open = m.index + m[0].length - 1; // index of the `(`
309
+ const close = matchParen(out, open);
310
+ if (close < 0)
311
+ continue;
312
+ const args = splitTopLevel(out.slice(open + 1, close), ',').map((a) => a.trim());
313
+ out = out.slice(0, m.index) + substituteMacro(def, args) + out.slice(close + 1);
314
+ changed = true;
315
+ break; // restart scan — offsets shifted
316
+ }
317
+ if (!changed)
318
+ break;
319
+ }
320
+ return out;
321
+ }
322
+ /** A fn-pointer field looks like `… (*name)(…)` — capture `name`. A
323
+ * calling-convention / attribute macro may precede the `*`
324
+ * (`(ZEND_FASTCALL *name)`), so allow leading word tokens. */
325
+ const FNPTR_DECL_RE = /\(\s*(?:\w+\s+)*\*\s*(\w+)\s*\)\s*\(/;
326
+ /** `typedef RET (*NAME)(…)` — a function-pointer typedef (CC/attr macro before
327
+ * the `*` allowed, as in php's `typedef void (ZEND_FASTCALL *fn_t)(…)`). */
328
+ const FNPTR_TYPEDEF_RE = /\btypedef\b[^;{}]*?\(\s*(?:\w+\s+)*\*\s*(\w+)\s*\)\s*\(/g;
329
+ /** A whole brace-free `typedef … ;` statement — capture the guts to spot the
330
+ * function-TYPE form `typedef RET NAME(params)` (no `(*name)` pointer form). */
331
+ const FNTYPE_TYPEDEF_STMT_RE = /\btypedef\b([^;{}]*);/g;
332
+ /** Return-type keywords that must never be mistaken for the typedef's name. */
333
+ const C_TYPE_KEYWORDS = new Set([
334
+ 'void', 'int', 'char', 'short', 'long', 'unsigned', 'signed', 'float', 'double',
335
+ 'const', 'struct', 'union', 'enum', 'static', 'volatile', 'register', 'inline',
336
+ ]);
337
+ /** `#include "local/header"` — captured from RAW source (string contents survive). */
338
+ const INCLUDE_RE = /#[ \t]*include[ \t]+"([^"\n]+)"/g;
339
+ /** Included files worth scanning for registration tables (e.g. a generated `.def`). */
340
+ const INCLUDABLE_EXT = /\.(def|inc|h|hh|hpp|hxx|c|cc|cpp|cxx|ipp|tcc|tbl)$/i;
341
+ async function cFnPointerDispatchEdges(_queries, ctx, onYield, onFraction) {
342
+ let scannedFiles = 0;
343
+ const files = ctx.getAllFiles().filter((f) => C_CPP_EXT.test(f));
344
+ if (files.length === 0)
345
+ return [];
346
+ // Within-pass progress: this is the pass that parks the "Linking dynamic
347
+ // dispatch" bar on C-heavy repos, so it reports a real fraction of its
348
+ // dominant work. `files` is swept once per file loop below (passes A, C, D,
349
+ // E — pass B is node-bound and comparatively brief), reported at the same
350
+ // per-16-files cadence as the cooperative yield.
351
+ const FILE_SWEEPS = 4;
352
+ const tick = async () => {
353
+ if ((++scannedFiles & 15) === 0) {
354
+ onFraction?.(scannedFiles / (files.length * FILE_SWEEPS));
355
+ await onYield();
356
+ }
357
+ };
358
+ // Cache raw + stripped source per file, LRU-BOUNDED. The old unbounded Maps
359
+ // retained every C/C++ file's raw AND stripped text for the whole pass —
360
+ // multiple GB on the Linux kernel, one of the two OOM culprits in #1212.
361
+ // Every sweep below iterates in `files` order, and node-kind scans return
362
+ // rows in file-commit order, so access is near-sequential and a small LRU
363
+ // hits; a miss just re-reads + re-strips.
364
+ const rawCache = new lru_cache_1.LRUCache(128);
365
+ const raw = (file) => {
366
+ if (rawCache.has(file))
367
+ return rawCache.get(file);
368
+ const r = ctx.readFile(file);
369
+ rawCache.set(file, r);
370
+ return r;
371
+ };
372
+ const srcCache = new lru_cache_1.LRUCache(128);
373
+ const src = (file) => {
374
+ // A cached '' (empty or unreadable file) returns '' where the miss path
375
+ // returns null for unreadable — every caller falsy-checks, so the two are
376
+ // interchangeable.
377
+ const hit = srcCache.get(file);
378
+ if (hit !== undefined)
379
+ return hit;
380
+ const r = raw(file);
381
+ const s = r == null ? '' : (0, strip_comments_1.stripCommentsForRegex)(r, 'c');
382
+ srcCache.set(file, s);
383
+ return r == null ? null : s;
384
+ };
385
+ // Resolve a quoted include relative to the includer's directory, then the
386
+ // project root. Returns a project-root-relative path that exists on disk
387
+ // (even if it was never indexed — e.g. redis' generated `commands.def`).
388
+ const resolveInclude = (includer, inc) => {
389
+ const dir = path.posix.dirname(includer.replace(/\\/g, '/'));
390
+ const cand = path.posix.normalize(path.posix.join(dir, inc));
391
+ if (ctx.fileExists(cand))
392
+ return cand;
393
+ if (ctx.fileExists(inc))
394
+ return inc;
395
+ return null;
396
+ };
397
+ // ---- Pass A: function-pointer AND function-type typedefs (cross-file) ----
398
+ // fn-pointer: typedef RET (*NAME)(…) → a field `NAME f` is a fn ptr
399
+ // fn-type: typedef RET NAME(params) → a field `NAME *f` is a fn ptr
400
+ // The fn-type form is redis' command idiom: `typedef void redisCommandProc(client*)`
401
+ // declared as `redisCommandProc *proc;`. Without this, `proc` reads as data.
402
+ const fnPtrTypedefs = new Set();
403
+ const fnTypeTypedefs = new Set();
404
+ for (const file of files) {
405
+ await tick();
406
+ const s = src(file);
407
+ if (!s || !s.includes('typedef'))
408
+ continue;
409
+ FNPTR_TYPEDEF_RE.lastIndex = 0;
410
+ let m;
411
+ while ((m = FNPTR_TYPEDEF_RE.exec(s)))
412
+ fnPtrTypedefs.add(m[1]);
413
+ FNTYPE_TYPEDEF_STMT_RE.lastIndex = 0;
414
+ while ((m = FNTYPE_TYPEDEF_STMT_RE.exec(s))) {
415
+ const guts = m[1];
416
+ if (guts.includes('(*') || guts.includes('( *'))
417
+ continue; // pointer form — handled above
418
+ const fm = guts.match(/\b(\w+)\s*\(/); // last identifier before the param list
419
+ if (fm && !C_TYPE_KEYWORDS.has(fm[1]))
420
+ fnTypeTypedefs.add(fm[1]);
421
+ }
422
+ }
423
+ // ---- Pass B: struct field layouts ----
424
+ // structLayout: struct name → ordered fields, for structs with ≥1 fn-pointer
425
+ // field (drives positional registration + dispatch).
426
+ // allStructFields: EVERY struct name → ALL its field layouts (a name can be
427
+ // reused across files — e.g. redis has two unrelated `client` structs), used
428
+ // to walk a chained receiver's field types (`c->cmd->proc`: client.cmd →
429
+ // redisCommand). The walk searches every same-named layout for the field.
430
+ // fieldToStructs: fn-pointer field name → set of struct names that declare it.
431
+ const structLayout = new Map();
432
+ const allStructFields = new Map();
433
+ const fieldToStructs = new Map();
434
+ // Parse a struct body (the text between its `{` and `}`) into ordered fields.
435
+ const parseStructFields = (inner) => {
436
+ const fields = [];
437
+ let idx = 0;
438
+ for (const rawDecl of splitTopLevel(inner, ';')) {
439
+ const decl = rawDecl.trim();
440
+ if (!decl)
441
+ continue;
442
+ // A field decl can declare several names sharing a leading type:
443
+ // `struct redisCommand *cmd, *lastcmd;`. Each declarator is its own
444
+ // positional slot and carries that type (so `client.cmd → redisCommand`).
445
+ const parts = splitTopLevel(decl, ',');
446
+ const firstTyped = parts[0].match(/(\w+)\s+\**\s*(\w+)\s*$/);
447
+ const sharedType = firstTyped ? firstTyped[1] : '';
448
+ for (let pi = 0; pi < parts.length; pi++) {
449
+ const p = parts[pi].trim();
450
+ let name = null;
451
+ let type = '';
452
+ let isFnPtr = false;
453
+ const ptr = p.match(FNPTR_DECL_RE);
454
+ if (ptr) {
455
+ name = ptr[1]; // `… (*name)(…)` — a function pointer
456
+ isFnPtr = true;
457
+ }
458
+ else if (pi === 0) {
459
+ if (firstTyped) {
460
+ name = firstTyped[2];
461
+ type = sharedType;
462
+ }
463
+ }
464
+ else {
465
+ // a subsequent declarator: `*name` / `**name` / `name`
466
+ const dm = p.match(/^\**\s*(\w+)/);
467
+ if (dm) {
468
+ name = dm[1];
469
+ type = sharedType;
470
+ }
471
+ }
472
+ if (!ptr && type)
473
+ isFnPtr = fnPtrTypedefs.has(type) || fnTypeTypedefs.has(type);
474
+ // Always advance the positional index. An unparsed field (anonymous
475
+ // union, exotic declarator) still occupies one slot, and macro-expanded
476
+ // positional tables (redis' MAKE_CMD) only align if every field counts.
477
+ fields.push({ name: name ?? '', index: idx, isFnPtr: !!name && isFnPtr, type });
478
+ idx++;
479
+ }
480
+ }
481
+ return fields;
482
+ };
483
+ // Register a parsed struct under `name` into the three indexes.
484
+ const registerStructLayout = (name, fields) => {
485
+ if (!allStructFields.has(name))
486
+ allStructFields.set(name, []);
487
+ allStructFields.get(name).push(fields);
488
+ for (const f of fields) {
489
+ if (f.name && f.isFnPtr) {
490
+ if (!fieldToStructs.has(f.name))
491
+ fieldToStructs.set(f.name, new Set());
492
+ fieldToStructs.get(f.name).add(name);
493
+ }
494
+ }
495
+ if (fields.some((f) => f.isFnPtr))
496
+ structLayout.set(name, fields);
497
+ };
498
+ for (const st of (ctx.iterateNodesByKind?.('struct') ?? ctx.getNodesByKind('struct'))) {
499
+ if ((++scannedFiles & 255) === 0)
500
+ await onYield();
501
+ if (!C_CPP_EXT.test(st.filePath))
502
+ continue;
503
+ const s = src(st.filePath);
504
+ if (!s)
505
+ continue;
506
+ const body = sliceLines(s, st.startLine, st.endLine);
507
+ const open = body.indexOf('{');
508
+ const close = open >= 0 ? matchBrace(body, open) : -1;
509
+ if (open < 0 || close < 0)
510
+ continue;
511
+ registerStructLayout(st.name, parseStructFields(body.slice(open + 1, close)));
512
+ }
513
+ // NB: no early return on an empty structLayout here — an inline `struct TAG
514
+ // { … } var[]` table whose struct never became a node (vim's `cmdname`, broken
515
+ // up by `#ifdef`) is discovered later during the unit scan. The `reg.size === 0`
516
+ // guard after registration still short-circuits when nothing bridges.
517
+ const fnPtrFieldOf = (struct, field) => !!structLayout.get(struct)?.some((f) => f.name === field && f.isFnPtr);
518
+ // C/C++ function + method nodes are STREAMED per sweep (see passes D/E) —
519
+ // the old materialized `cFns` array held every function node on the repo
520
+ // (O(nodes) memory, part of the #1212 kernel OOM).
521
+ // ---- function-name → node resolution (prefer a function in the same file) ----
522
+ const resolveFn = (name, preferFile) => {
523
+ const cands = ctx.getNodesByName(name).filter((n) => FN_KINDS.has(n.kind));
524
+ if (cands.length === 0)
525
+ return null;
526
+ if (cands.length === 1)
527
+ return cands[0];
528
+ if (preferFile) {
529
+ const same = cands.find((n) => n.filePath === preferFile);
530
+ if (same)
531
+ return same;
532
+ }
533
+ return cands[0];
534
+ };
535
+ // ---- Pass C: registrations — Map<"struct.field", Set<funcNodeId>> ----
536
+ // Ids only — retaining the full Node per registration (the old `idToNode`)
537
+ // was write-only dead weight at O(registrations) memory.
538
+ const reg = new Map();
539
+ const addReg = (struct, field, fn) => {
540
+ const key = `${struct}.${field}`;
541
+ if (!reg.has(key))
542
+ reg.set(key, new Set());
543
+ reg.get(key).add(fn.id);
544
+ };
545
+ // Bare arrays-of-fn-pointers (no struct): array VARIABLE name → per-file sets
546
+ // of registered function ids. Multi-entry because a file-scope `static` table
547
+ // name can recur across files (SameBoy declares `static opcode_t *opcodes[256]`
548
+ // in BOTH sm83_cpu.c and sm83_disassembler.c), so dispatch resolves same-file.
549
+ const arrayReg = new Map();
550
+ const addArrayReg = (name, file, fn) => {
551
+ let entries = arrayReg.get(name);
552
+ if (!entries) {
553
+ entries = [];
554
+ arrayReg.set(name, entries);
555
+ }
556
+ let e = entries.find((x) => x.file === file);
557
+ if (!e) {
558
+ e = { file, ids: new Set() };
559
+ entries.push(e);
560
+ }
561
+ e.ids.add(fn.id);
562
+ };
563
+ // A struct value `{ … }` (one element) — register its function entries to the
564
+ // struct's fields, by `.field = fn` designators or by positional slot.
565
+ const registerStructValue = (struct, valueBody, file, env) => {
566
+ const layout = structLayout.get(struct);
567
+ if (!layout)
568
+ return;
569
+ if (env && env.size)
570
+ valueBody = expandMacroCalls(valueBody, env);
571
+ // A macro can expand to a whole brace-wrapped element (sqlite's
572
+ // `FUNCTION(…)` → `{nArg, …, xFunc, …}`); peel one outer layer so the
573
+ // positional slots are visible.
574
+ valueBody = valueBody.trim();
575
+ if (valueBody.startsWith('{')) {
576
+ const e = matchBrace(valueBody, 0);
577
+ if (e > 0 && valueBody.slice(e + 1).trim() === '')
578
+ valueBody = valueBody.slice(1, e);
579
+ }
580
+ const items = splitTopLevel(valueBody, ',');
581
+ let pos = 0;
582
+ for (const rawItem of items) {
583
+ const item = rawItem.trim();
584
+ if (!item)
585
+ continue;
586
+ const des = item.match(/^\.\s*(\w+)\s*=\s*(?:&\s*)?(\w+)\s*$/);
587
+ if (des) {
588
+ const field = des[1];
589
+ if (fnPtrFieldOf(struct, field)) {
590
+ const fn = resolveFn(des[2], file);
591
+ if (fn)
592
+ addReg(struct, field, fn);
593
+ }
594
+ // a designated item does not advance positional counting
595
+ continue;
596
+ }
597
+ const field = layout.find((f) => f.index === pos);
598
+ if (field?.isFnPtr) {
599
+ const id = item.match(/^&?\s*(\w+)\s*$/);
600
+ if (id) {
601
+ const fn = resolveFn(id[1], file);
602
+ if (fn)
603
+ addReg(struct, field.name, fn);
604
+ }
605
+ }
606
+ pos++;
607
+ }
608
+ };
609
+ // Collect the literal function entries of an array-of-fn-pointers initializer
610
+ // and register them under the array's variable name. Entries may be positional
611
+ // (`fn`, `&fn`), designated by index (`[OP] = fn`), or cast-wrapped
612
+ // (`(handler_t)fn`, as in php's Zend dtor table). Non-identifier entries
613
+ // (`NULL`, `0`, a nested expression) are skipped — a miss, never a wrong edge.
614
+ // No index tracking: a runtime subscript fans the dispatch out to the whole
615
+ // set, exactly like a command table reaches every command.
616
+ const registerArrayValue = (name, body, file, env) => {
617
+ if (env && env.size)
618
+ body = expandMacroCalls(body, env);
619
+ for (const rawItem of splitTopLevel(body, ',')) {
620
+ let item = rawItem.trim();
621
+ if (!item)
622
+ continue;
623
+ const des = item.match(/^\[[^\]]*\]\s*=\s*([\s\S]*)$/); // `[IDX] = …` designator
624
+ if (des)
625
+ item = des[1].trim();
626
+ item = item.replace(/^\((?:[\w\s*]+)\)\s*/, '').replace(/^&\s*/, '').trim(); // (cast) / &
627
+ const id = item.match(/^(\w+)$/);
628
+ if (!id)
629
+ continue;
630
+ const fn = resolveFn(id[1], file);
631
+ if (fn)
632
+ addArrayReg(name, file, fn);
633
+ }
634
+ };
635
+ // Per-file macro + include parsing (any file, indexed or not), cached.
636
+ // Derived per-file caches, LRU-bounded like the content caches (#1212).
637
+ const fnMacroCache = new lru_cache_1.LRUCache(256);
638
+ const fileFnMacros = (file) => {
639
+ let m = fnMacroCache.get(file);
640
+ if (!m) {
641
+ m = parseFunctionMacros(src(file) ?? '');
642
+ fnMacroCache.set(file, m);
643
+ }
644
+ return m;
645
+ };
646
+ const objMacroCache = new lru_cache_1.LRUCache(256);
647
+ const fileObjMacros = (file) => {
648
+ let m = objMacroCache.get(file);
649
+ if (!m) {
650
+ m = parseObjectMacros(src(file) ?? '');
651
+ objMacroCache.set(file, m);
652
+ }
653
+ return m;
654
+ };
655
+ const definedCache = new lru_cache_1.LRUCache(256);
656
+ const fileDefinedNames = (file) => {
657
+ let d = definedCache.get(file);
658
+ if (!d) {
659
+ d = parseDefinedNames(src(file) ?? '');
660
+ definedCache.set(file, d);
661
+ }
662
+ return d;
663
+ };
664
+ const includeCache = new lru_cache_1.LRUCache(1024);
665
+ const localIncludesOf = (file) => {
666
+ let out = includeCache.get(file);
667
+ if (out)
668
+ return out;
669
+ out = [];
670
+ const rawText = raw(file);
671
+ if (rawText && rawText.includes('include')) {
672
+ INCLUDE_RE.lastIndex = 0;
673
+ let im;
674
+ while ((im = INCLUDE_RE.exec(rawText))) {
675
+ if (!INCLUDABLE_EXT.test(im[1]))
676
+ continue;
677
+ const t = resolveInclude(file, im[1]);
678
+ if (t)
679
+ out.push(t);
680
+ }
681
+ }
682
+ includeCache.set(file, out);
683
+ return out;
684
+ };
685
+ // A file's effective macro environment = its own #defines PLUS those of the
686
+ // headers it #includes (redis' `MAKE_CMD` sits beside the table; sqlite's
687
+ // `FUNCTION` lives in `sqliteInt.h`, included by the file with the table).
688
+ // First writer wins, so the file's own defs override included ones; depth-2
689
+ // covers a macro defined in a header-of-a-header.
690
+ const buildEnv = (file, depth, seen, fn, obj, def) => {
691
+ if (depth < 0 || seen.has(file))
692
+ return;
693
+ seen.add(file);
694
+ for (const [k, v] of fileFnMacros(file))
695
+ if (!fn.has(k))
696
+ fn.set(k, v);
697
+ for (const [k, v] of fileObjMacros(file))
698
+ if (!obj.has(k))
699
+ obj.set(k, v);
700
+ for (const n of fileDefinedNames(file))
701
+ def.add(n);
702
+ for (const inc of localIncludesOf(file))
703
+ buildEnv(inc, depth - 1, seen, fn, obj, def);
704
+ };
705
+ const indexedSet = new Set(files);
706
+ const seenInclude = new Set();
707
+ // Global variable → struct type, for resolving a dispatch through a file-scope
708
+ // table by subscript (`cmdnames[i].cmd_func(…)`).
709
+ const globalVarType = new Map();
710
+ // Process a `{ … }` initializer body (array of elements or a single struct).
711
+ const processInit = (struct, body, isArray, file, env) => {
712
+ if (isArray) {
713
+ for (const el of splitTopLevel(body, ',')) {
714
+ const t = el.trim();
715
+ if (t.startsWith('{')) {
716
+ const e = matchBrace(t, 0);
717
+ if (e > 0)
718
+ registerStructValue(struct, t.slice(1, e), file, env);
719
+ }
720
+ else if (t) {
721
+ // an element built by a macro (`MAKE_CMD(…)`/`FUNCTION(…)`) or a bare value
722
+ registerStructValue(struct, t, file, env);
723
+ }
724
+ }
725
+ }
726
+ else {
727
+ registerStructValue(struct, body, file, env);
728
+ }
729
+ };
730
+ // `(?:struct )?TYPE name[opt] = {` initializers, where TYPE is a struct that
731
+ // has ≥1 fn-pointer field. Handles both single (`= {…}`) and array
732
+ // (`[] = { {…}, {…} }`) forms. Macro calls inside an element are expanded first.
733
+ const INIT_RE = /(?:^|[;{}])\s*(?:(?:static|const|extern|register|volatile)\s+)*(?:struct\s+)?(\w+)\s+(\w+)\s*(\[[^\]]*\])?\s*=\s*\{/g;
734
+ // `struct TAG { … } var[opt] [= {…}]` — the struct is defined INLINE with the
735
+ // table (vim's `cmdname`/`nv_cmd`); its layout never became a node, so parse it
736
+ // here and register it before reading the entries. No leading anchor: a
737
+ // `struct TAG {` with a brace body is always a definition (it may be preceded
738
+ // by a `#define …` line ending in a digit, as in vim), and the trailing
739
+ // `var … = {` check below is what distinguishes a TABLE from a plain type.
740
+ const INLINE_STRUCT_RE = /\bstruct\s+(\w+)\s*\{/g;
741
+ // `(?:static …)* ELEMTYPE [*] name[…] = { … }` — a bare array of function
742
+ // pointers (no struct wrapper). The optional `*` covers a function-TYPE
743
+ // typedef element (`opcode_t *opcodes[]`); a function-pointer typedef element
744
+ // (`zend_rc_dtor_func_t t[]`) needs none. The typedef-set membership gate
745
+ // (below) is what separates this from a plain data/struct array.
746
+ const ARRAY_TABLE_RE = /(?:^|[;{}])\s*(?:(?:static|const|extern|register|volatile)\s+)*(\w+)\s+(\*\s*)?(\w+)\s*\[[^\]]*\]\s*=\s*\{/g;
747
+ // Process ONE unit's text and discard it. The old shape built every unit up
748
+ // front (`const units: Unit[]`) — the full text of every C file plus its
749
+ // expanded includes held simultaneously, gigabytes on the kernel (#1212).
750
+ const processUnit = (unit) => {
751
+ const s = unit.text;
752
+ if (!s || !s.includes('{'))
753
+ return;
754
+ INLINE_STRUCT_RE.lastIndex = 0;
755
+ let im;
756
+ while ((im = INLINE_STRUCT_RE.exec(s))) {
757
+ const tag = im[1];
758
+ const sOpen = im.index + im[0].length - 1; // the struct body's `{`
759
+ const sClose = matchBrace(s, sOpen);
760
+ if (sClose < 0)
761
+ continue;
762
+ // After `}`, expect `var [opt] [= {…}]` to be a table; else it's a plain type.
763
+ const after = s.slice(sClose + 1);
764
+ const vm = after.match(/^\s*(\w+)\s*(\[[^\]]*\])?\s*(=\s*\{)?/);
765
+ if (!vm || !vm[1])
766
+ continue;
767
+ const fields = parseStructFields(s.slice(sOpen + 1, sClose));
768
+ if (!fields.some((f) => f.isFnPtr))
769
+ continue; // only tables of fn pointers matter
770
+ if (!structLayout.has(tag))
771
+ registerStructLayout(tag, fields);
772
+ globalVarType.set(vm[1], tag);
773
+ if (vm[3]) {
774
+ const aOpen = sClose + 1 + after.indexOf('{', vm[0].length - 1);
775
+ const aClose = matchBrace(s, aOpen);
776
+ if (aClose > 0) {
777
+ processInit(tag, s.slice(aOpen + 1, aClose), !!vm[2], unit.file, unit.env);
778
+ INLINE_STRUCT_RE.lastIndex = aClose;
779
+ }
780
+ }
781
+ }
782
+ if (!s.includes('='))
783
+ return;
784
+ INIT_RE.lastIndex = 0;
785
+ let m;
786
+ while ((m = INIT_RE.exec(s))) {
787
+ let struct = m[1];
788
+ if (!structLayout.has(struct))
789
+ struct = resolveTypeName(struct, unit.objEnv);
790
+ if (!structLayout.has(struct))
791
+ continue;
792
+ const isArray = !!m[3];
793
+ const open = m.index + m[0].length - 1; // points at the `{`
794
+ const close = matchBrace(s, open);
795
+ if (close < 0)
796
+ continue;
797
+ globalVarType.set(m[2], struct);
798
+ processInit(struct, s.slice(open + 1, close), isArray, unit.file, unit.env);
799
+ INIT_RE.lastIndex = close;
800
+ }
801
+ // Bare arrays-of-function-pointers (no struct, no field). Gated on the
802
+ // element type being a function typedef — a fn-TYPE typedef needs the `*`
803
+ // (array of pointers to it), a fn-pointer typedef does not. A data or
804
+ // struct array's element type is never in these sets, so it never fires.
805
+ ARRAY_TABLE_RE.lastIndex = 0;
806
+ let am;
807
+ while ((am = ARRAY_TABLE_RE.exec(s))) {
808
+ const elemType = am[1];
809
+ const hasStar = !!am[2];
810
+ if (!((fnTypeTypedefs.has(elemType) && hasStar) || fnPtrTypedefs.has(elemType)))
811
+ continue;
812
+ const open = am.index + am[0].length - 1; // the `{`
813
+ const close = matchBrace(s, open);
814
+ if (close < 0)
815
+ continue;
816
+ registerArrayValue(am[3], s.slice(open + 1, close), unit.file, unit.env);
817
+ ARRAY_TABLE_RE.lastIndex = close;
818
+ }
819
+ };
820
+ // ---- Pass C: registrations — stream each file (and its qualifying local
821
+ // includes) through processUnit, one at a time.
822
+ for (const file of files) {
823
+ await tick();
824
+ const env = new Map();
825
+ const objEnv = new Map();
826
+ const defined = new Set();
827
+ buildEnv(file, 2, new Set(), env, objEnv, defined);
828
+ const s = src(file);
829
+ if (s)
830
+ processUnit({ text: s, file, env, objEnv });
831
+ for (const target of localIncludesOf(file)) {
832
+ if (seenInclude.has(`${file}>${target}`))
833
+ continue;
834
+ const incSrc = src(target);
835
+ if (!incSrc)
836
+ continue;
837
+ if (indexedSet.has(target)) {
838
+ // Re-scan an indexed header only when this includer unlocks guarded code.
839
+ const ownDef = fileDefinedNames(target);
840
+ const adds = [...defined].some((n) => !ownDef.has(n));
841
+ if (!adds || !/#\s*if/.test(incSrc))
842
+ continue;
843
+ }
844
+ seenInclude.add(`${file}>${target}`);
845
+ // The include is pasted into the includer — evaluate its conditionals in
846
+ // the includer's defined set (a no-op when it has none). Re-parse the
847
+ // included file's OWN macros from that resolved text so a macro it defines
848
+ // conditionally (vim's `EXCMD`, whose plain last-wins parse picks the enum
849
+ // arm) overrides with the ARM THAT IS ACTUALLY ACTIVE here.
850
+ const text = evalConditionals(incSrc, defined);
851
+ const incEnv = new Map(env);
852
+ for (const [k, v] of parseFunctionMacros(text))
853
+ incEnv.set(k, v);
854
+ const incObjEnv = new Map(objEnv);
855
+ for (const [k, v] of parseObjectMacros(text))
856
+ incObjEnv.set(k, v);
857
+ processUnit({ text, file: target, env: incEnv, objEnv: incObjEnv });
858
+ }
859
+ }
860
+ // ---- receiver-type resolution within a function's source ----
861
+ // `(?:struct )?TYPE [*]recv` declared in the params or body → TYPE (if a known
862
+ // fn-pointer-bearing struct).
863
+ const recvTypeIn = (fnSrc, recv) => {
864
+ const re = new RegExp(`(?:struct\\s+)?(\\w+)\\s*\\*?\\s*\\b${recv}\\b\\s*(?:[,)=;]|\\[)`, 'g');
865
+ let m;
866
+ while ((m = re.exec(fnSrc))) {
867
+ if (structLayout.has(m[1]))
868
+ return m[1];
869
+ }
870
+ return null;
871
+ };
872
+ // Declared type of a local/param `v` — ANY type token, not just fn-pointer
873
+ // structs (the base of a chained receiver needn't carry a fn pointer itself).
874
+ // Falls back to a file-scope table variable (`cmdnames` in `cmdnames[i].fn()`).
875
+ const escapeRe = (x) => x.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
876
+ const varTypeIn = (fnSrc, v) => {
877
+ const re = new RegExp(`(?:struct\\s+)?(\\w+)\\s*\\*?\\s*\\b${escapeRe(v)}\\b\\s*(?:[,)=;]|\\[)`, 'g');
878
+ let m;
879
+ while ((m = re.exec(fnSrc))) {
880
+ if (!C_TYPE_KEYWORDS.has(m[1]))
881
+ return m[1];
882
+ }
883
+ return globalVarType.get(v) ?? null;
884
+ };
885
+ // Resolve a member-access chain (`c->cmd`, or just `p`) to a struct type,
886
+ // walking each segment's declared field type. `c->cmd->proc` dispatch:
887
+ // base chain `c->cmd` → client.cmd's type `redisCommand`, the proc owner.
888
+ // Array subscripts (`cmdnames[i]`) are stripped — an index yields one element.
889
+ const resolveChainType = (fnSrc, chain) => {
890
+ const segs = chain.replace(/\s*\[[^\]]*\]/g, '').split(/\s*(?:->|\.)\s*/).filter(Boolean);
891
+ if (segs.length === 0)
892
+ return null;
893
+ let t = varTypeIn(fnSrc, segs[0]);
894
+ for (let i = 1; t && i < segs.length; i++) {
895
+ let next = null;
896
+ for (const fields of allStructFields.get(t) ?? []) {
897
+ const f = fields.find((fl) => fl.name === segs[i] && fl.type);
898
+ if (f) {
899
+ next = f.type;
900
+ break;
901
+ }
902
+ }
903
+ t = next;
904
+ }
905
+ return t;
906
+ };
907
+ // ---- Pass D: field←field propagation (`a->f = b->g`) ----
908
+ // Collected as (targetStruct.field ← sourceStruct.field) pairs, then merged to
909
+ // a fixpoint so a hook slot inherits a registry field's handlers.
910
+ const FIELD_ASSIGN_RE = /(\w+)\s*(?:->|\.)\s*(\w+)\s*=\s*(\w+)\s*(?:->|\.)\s*(\w+)/g;
911
+ const propagations = [];
912
+ for (const file of files) {
913
+ await tick();
914
+ const s = src(file);
915
+ if (!s || !s.includes('='))
916
+ continue;
917
+ for (const fn of ctx.getNodesInFile(file)) {
918
+ if (!FN_KINDS.has(fn.kind))
919
+ continue;
920
+ const body = sliceLines(s, fn.startLine, fn.endLine);
921
+ if (!body.includes('='))
922
+ continue;
923
+ FIELD_ASSIGN_RE.lastIndex = 0;
924
+ let m;
925
+ while ((m = FIELD_ASSIGN_RE.exec(body))) {
926
+ const [, lrecv, lfield, rrecv, rfield] = m;
927
+ const lt = recvTypeIn(body, lrecv);
928
+ const rt = recvTypeIn(body, rrecv);
929
+ if (lt && rt && fnPtrFieldOf(lt, lfield) && fnPtrFieldOf(rt, rfield)) {
930
+ propagations.push({ to: `${lt}.${lfield}`, from: `${rt}.${rfield}` });
931
+ }
932
+ }
933
+ }
934
+ }
935
+ for (let pass = 0; pass < 3 && propagations.length; pass++) {
936
+ let changed = false;
937
+ for (const { to, from } of propagations) {
938
+ const fromSet = reg.get(from);
939
+ if (!fromSet)
940
+ continue;
941
+ if (!reg.has(to))
942
+ reg.set(to, new Set());
943
+ const toSet = reg.get(to);
944
+ for (const id of fromSet) {
945
+ if (!toSet.has(id)) {
946
+ toSet.add(id);
947
+ changed = true;
948
+ }
949
+ }
950
+ }
951
+ if (!changed)
952
+ break;
953
+ }
954
+ if (reg.size === 0 && arrayReg.size === 0)
955
+ return [];
956
+ // ---- Pass E: dispatch sites → edges ----
957
+ // `base->…->field(` or `base.…field(` where `field` is a known fn-pointer field.
958
+ // The base may be a chain (`c->cmd->proc`) or carry array subscripts
959
+ // (`cmdnames[i].cmd_func`). An optional `)` before the call covers the
960
+ // parenthesized form `(cmdnames[i].cmd_func)(&ea)` vim uses.
961
+ const DISPATCH_RE = /((?:\w+(?:\s*\[[^\][]*\])?\s*(?:->|\.)\s*)+)(\w+)\s*\)?\s*\(/g;
962
+ // Bare-array dispatch: `tbl[i](…)` or the explicit-deref `(*tbl[i])(…)`. The
963
+ // subscript may itself contain a call (`tbl[GC_TYPE(p)](…)`), so the index
964
+ // class excludes only brackets. Precision comes from the `arrayReg` gate below
965
+ // — this fires only when `tbl` is a known fn-pointer array.
966
+ const ARRAY_DISPATCH_RE = /(?:\(\s*\*\s*)?\b(\w+)\s*\[[^\][]*\]\s*\)?\s*\(/g;
967
+ const edges = [];
968
+ const seen = new Set();
969
+ for (const file of files) {
970
+ await tick();
971
+ const s = src(file);
972
+ if (!s)
973
+ continue;
974
+ for (const fn of ctx.getNodesInFile(file)) {
975
+ if (!FN_KINDS.has(fn.kind))
976
+ continue;
977
+ const body = sliceLines(s, fn.startLine, fn.endLine);
978
+ DISPATCH_RE.lastIndex = 0;
979
+ let m;
980
+ let added = 0;
981
+ while ((m = DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
982
+ const baseChain = m[1].replace(/\s*(?:->|\.)\s*$/, '').trim(); // receiver, minus the trailing arrow
983
+ const field = m[2];
984
+ const owners = fieldToStructs.get(field);
985
+ if (!owners || owners.size === 0)
986
+ continue;
987
+ // 1) resolve the receiver chain's struct type precisely (handles c->cmd->proc);
988
+ // 2) else the last segment as a simple local/param of a fn-pointer-bearing struct;
989
+ // 3) else fall back to a field name that belongs to exactly one struct.
990
+ let struct = resolveChainType(body, baseChain);
991
+ if (!struct || !owners.has(struct)) {
992
+ const lastSeg = baseChain.replace(/\s*\[[^\]]*\]/g, '').split(/\s*(?:->|\.)\s*/).pop();
993
+ const t = recvTypeIn(body, lastSeg);
994
+ struct = t && owners.has(t) ? t : null;
995
+ }
996
+ if (!struct || !owners.has(struct))
997
+ struct = owners.size === 1 ? [...owners][0] : null;
998
+ if (!struct)
999
+ continue;
1000
+ const targets = reg.get(`${struct}.${field}`);
1001
+ if (!targets)
1002
+ continue;
1003
+ const line = fn.startLine + body.slice(0, m.index).split('\n').length - 1;
1004
+ for (const tid of targets) {
1005
+ if (tid === fn.id)
1006
+ continue;
1007
+ const key = `${fn.id}>${tid}`;
1008
+ if (seen.has(key))
1009
+ continue;
1010
+ seen.add(key);
1011
+ edges.push({
1012
+ source: fn.id,
1013
+ target: tid,
1014
+ kind: 'calls',
1015
+ line,
1016
+ provenance: 'heuristic',
1017
+ metadata: {
1018
+ synthesizedBy: 'fn-pointer-dispatch',
1019
+ via: `${struct}.${field}`,
1020
+ registeredAt: `${fn.filePath}:${line}`,
1021
+ },
1022
+ });
1023
+ if (++added >= FANOUT_CAP)
1024
+ break;
1025
+ }
1026
+ }
1027
+ // ---- bare array-of-fn-pointers dispatch (`tbl[i](…)`) ----
1028
+ if (arrayReg.size && added < FANOUT_CAP) {
1029
+ ARRAY_DISPATCH_RE.lastIndex = 0;
1030
+ while ((m = ARRAY_DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
1031
+ const entries = arrayReg.get(m[1]);
1032
+ if (!entries)
1033
+ continue;
1034
+ // Same-file table wins on a name collision (two file-local `opcodes`);
1035
+ // a unique name resolves cross-file; otherwise ambiguous — bail.
1036
+ const ids = entries.length === 1
1037
+ ? entries[0].ids
1038
+ : (entries.find((e) => e.file === fn.filePath)?.ids ?? null);
1039
+ if (!ids)
1040
+ continue;
1041
+ const line = fn.startLine + body.slice(0, m.index).split('\n').length - 1;
1042
+ for (const tid of ids) {
1043
+ if (tid === fn.id)
1044
+ continue;
1045
+ const key = `${fn.id}>${tid}`;
1046
+ if (seen.has(key))
1047
+ continue;
1048
+ seen.add(key);
1049
+ edges.push({
1050
+ source: fn.id,
1051
+ target: tid,
1052
+ kind: 'calls',
1053
+ line,
1054
+ provenance: 'heuristic',
1055
+ metadata: {
1056
+ synthesizedBy: 'fn-pointer-dispatch',
1057
+ via: `${m[1]}[]`,
1058
+ registeredAt: `${fn.filePath}:${line}`,
1059
+ },
1060
+ });
1061
+ if (++added >= FANOUT_CAP)
1062
+ break;
1063
+ }
1064
+ }
1065
+ }
1066
+ }
1067
+ }
1068
+ return edges;
1069
+ }
1070
+ //# sourceMappingURL=c-fnptr-synthesizer.js.map