codebaseiq 0.1.0 → 0.3.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 (447) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/README.md +1 -1
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/{chunk-ZMI2JSX2.js → chunk-23C5AD3B.js} +2 -2
  5. package/dist/chunk-2E6OUPCF.js +2 -0
  6. package/dist/chunk-2EDX3JT5.js +3 -0
  7. package/dist/chunk-2I2UHZET.js +2 -0
  8. package/dist/{chunk-T3DGWPXM.js → chunk-2OMXFE64.js} +2 -2
  9. package/dist/chunk-2PRONPAS.js +3 -0
  10. package/dist/{chunk-GW6Z3WGY.js → chunk-356EZBIP.js} +2 -2
  11. package/dist/{chunk-UDS562V4.js → chunk-36JC5BG2.js} +2 -2
  12. package/dist/chunk-3RR2K7EZ.js +20 -0
  13. package/dist/{chunk-JE3WZ6II.js → chunk-3RSBGWGL.js} +2 -2
  14. package/dist/{chunk-VE5AVNMP.js → chunk-3VJ3OCRE.js} +2 -2
  15. package/dist/{chunk-FDGD5AB5.js → chunk-4LK5OIPW.js} +2 -2
  16. package/dist/chunk-5DSL3NT2.js +17 -0
  17. package/dist/chunk-5FWR5HLG.js +90 -0
  18. package/dist/chunk-5IC2WZAL.js +22 -0
  19. package/dist/{chunk-MVB3DAEY.js → chunk-5IZRKWTZ.js} +2 -2
  20. package/dist/{chunk-Q65CQ4XL.js → chunk-5LL4KEHO.js} +2 -2
  21. package/dist/chunk-5T44HG5Y.js +88 -0
  22. package/dist/{chunk-TRRC4ZJ7.js → chunk-5ZI2PPI7.js} +2 -2
  23. package/dist/{chunk-7XAN6GKB.js → chunk-67VJAYVR.js} +2 -2
  24. package/dist/{chunk-MOVBWNIP.js → chunk-6BF3VYEF.js} +2 -2
  25. package/dist/chunk-6JMAVFL4.js +3 -0
  26. package/dist/chunk-6O3KXIDL.js +2 -0
  27. package/dist/{chunk-JOIRNPPY.js → chunk-6VREELBC.js} +2 -2
  28. package/dist/chunk-6WAPPQ5F.js +82 -0
  29. package/dist/{chunk-FW53T7EB.js → chunk-75KJGYX7.js} +2 -2
  30. package/dist/chunk-7GAK2F3H.js +77 -0
  31. package/dist/{chunk-UBGWN7I4.js → chunk-7JELP5YE.js} +2 -2
  32. package/dist/chunk-7UCDGXRW.js +8 -0
  33. package/dist/{chunk-L57ZKWVG.js → chunk-AEXQYQD7.js} +2 -2
  34. package/dist/chunk-AQI4N64O.js +22 -0
  35. package/dist/{chunk-ICFDQHAM.js → chunk-AURCQHSG.js} +2 -2
  36. package/dist/{chunk-I2T2LLK2.js → chunk-BBP7HVBJ.js} +2 -2
  37. package/dist/{chunk-OFBE4NGP.js → chunk-BFBIMTCJ.js} +2 -2
  38. package/dist/{chunk-JEJLSICM.js → chunk-BGGB5N53.js} +2 -2
  39. package/dist/{chunk-TIIC3ZE7.js → chunk-BRQL7AFJ.js} +2 -2
  40. package/dist/{chunk-YSNONTJ2.js → chunk-BWL3PMPT.js} +2 -2
  41. package/dist/chunk-C6WKPKCF.js +127 -0
  42. package/dist/{chunk-YESXMKX3.js → chunk-C7OUW52M.js} +2 -2
  43. package/dist/chunk-C7QWUBR2.js +545 -0
  44. package/dist/{chunk-4WKDMDEW.js → chunk-CCIYWXX6.js} +2 -2
  45. package/dist/{chunk-FAJQ7LWY.js → chunk-CIYA2KZN.js} +2 -2
  46. package/dist/{chunk-VEXUL62T.js → chunk-CR3OG6SQ.js} +2 -2
  47. package/dist/{chunk-JSOYNVWH.js → chunk-CVHOQONG.js} +2 -2
  48. package/dist/{chunk-LU3BMVH2.js → chunk-CW6AXOLR.js} +2 -2
  49. package/dist/{chunk-TXXOEMZJ.js → chunk-D53LWANR.js} +2 -2
  50. package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
  51. package/dist/{chunk-N3IQCBCF.js → chunk-D7AZAOZX.js} +2 -2
  52. package/dist/{chunk-RDBI2RXU.js → chunk-D7DOB27N.js} +7 -7
  53. package/dist/chunk-DAKIGMIK.js +21 -0
  54. package/dist/chunk-DDN2F6GB.js +2 -0
  55. package/dist/chunk-DUKHVPU5.js +4 -0
  56. package/dist/chunk-DVWO7RBC.js +2 -0
  57. package/dist/{chunk-HKQUXIFO.js → chunk-E52K4L2W.js} +2 -2
  58. package/dist/chunk-EIBGSU2R.js +2 -0
  59. package/dist/chunk-EN4AHLL3.js +3 -0
  60. package/dist/chunk-EQNMD62X.js +51 -0
  61. package/dist/{chunk-ENCCHKM6.js → chunk-EXZ7VLRY.js} +4 -4
  62. package/dist/{chunk-NEDP5RFQ.js → chunk-F3QSL4W2.js} +2 -2
  63. package/dist/{chunk-O6QTXQPJ.js → chunk-F74LZWCE.js} +2 -2
  64. package/dist/{chunk-BH5F2Q4O.js → chunk-FEIZXBLH.js} +2 -2
  65. package/dist/chunk-FH5WG4LE.js +2 -0
  66. package/dist/{chunk-BVAJLC5A.js → chunk-FOZ74V56.js} +2 -2
  67. package/dist/{chunk-L4NRUAGJ.js → chunk-FQTIFWLR.js} +2 -2
  68. package/dist/chunk-FTTV7IRX.js +355 -0
  69. package/dist/chunk-FWQGH2N2.js +2 -0
  70. package/dist/{chunk-CAUCPUOF.js → chunk-GDHWOA57.js} +2 -2
  71. package/dist/{chunk-6MUIJMVL.js → chunk-GIDCP7KV.js} +2 -2
  72. package/dist/{chunk-ZV3JV5G5.js → chunk-GL6UTNUB.js} +2 -2
  73. package/dist/chunk-GP7C5VAE.js +2 -0
  74. package/dist/{chunk-FQKZWM4L.js → chunk-GQLDYCWS.js} +5 -5
  75. package/dist/chunk-GQXXOS55.js +2 -0
  76. package/dist/{chunk-H3LGFZVK.js → chunk-GUFPEFBG.js} +2 -2
  77. package/dist/{chunk-NNOKTMZT.js → chunk-GV2CEZCW.js} +2 -2
  78. package/dist/{chunk-FETNQCFO.js → chunk-GVAF222T.js} +2 -2
  79. package/dist/chunk-GWYZVVKY.js +21 -0
  80. package/dist/{chunk-7FND7D7N.js → chunk-HENP2O4A.js} +2 -2
  81. package/dist/{chunk-LZYFLFEH.js → chunk-HINZQKSY.js} +2 -2
  82. package/dist/{chunk-RR7SX44N.js → chunk-HQA7EBSK.js} +2 -2
  83. package/dist/{chunk-XMQ23E27.js → chunk-HVFB3PME.js} +2 -2
  84. package/dist/chunk-I22IZYDI.js +2 -0
  85. package/dist/chunk-ICUL7XRT.js +21 -0
  86. package/dist/{chunk-CQP3THUZ.js → chunk-IHSLIIL3.js} +2 -2
  87. package/dist/{chunk-34WBMAYK.js → chunk-ITSJMNUD.js} +2 -2
  88. package/dist/{chunk-PX4RYAAK.js → chunk-IZDPGOZR.js} +2 -2
  89. package/dist/chunk-J3GLP7Q5.js +3 -0
  90. package/dist/{chunk-CVYSU6BX.js → chunk-J7AMBVWF.js} +2 -2
  91. package/dist/{chunk-Y6KHROC3.js → chunk-JCMFBF4Z.js} +2 -2
  92. package/dist/chunk-JFIA2JI3.js +3 -0
  93. package/dist/chunk-JLZLLLW5.js +3 -0
  94. package/dist/{chunk-5PUWMSDU.js → chunk-JSNTHRLQ.js} +2 -2
  95. package/dist/{chunk-C6SBF2WH.js → chunk-JX6ZWDOS.js} +2 -2
  96. package/dist/{chunk-4XTAUQFD.js → chunk-JYI7CV25.js} +2 -2
  97. package/dist/chunk-K7JLSGCJ.js +8 -0
  98. package/dist/{chunk-XWUOUWYI.js → chunk-KPZGTB2O.js} +2 -2
  99. package/dist/{chunk-VXYS3FZD.js → chunk-LKUTSP4G.js} +2 -2
  100. package/dist/{chunk-GTXSJDCO.js → chunk-LMTSB3TB.js} +2 -2
  101. package/dist/chunk-LONKINMJ.js +543 -0
  102. package/dist/{chunk-WMPRTGH2.js → chunk-LQHYYIOB.js} +2 -2
  103. package/dist/{chunk-VUIYB2V3.js → chunk-LZSQ6X7E.js} +2 -2
  104. package/dist/{chunk-ST7V3SKN.js → chunk-M2Y6PCFE.js} +2 -2
  105. package/dist/chunk-MEUHIDI3.js +7 -0
  106. package/dist/{chunk-OZYRSMSH.js → chunk-MHWMEZDA.js} +2 -2
  107. package/dist/{chunk-RKEJ6VTF.js → chunk-MQW6SJ4P.js} +2 -2
  108. package/dist/{chunk-J77SU6VA.js → chunk-MSI3K7PJ.js} +2 -2
  109. package/dist/chunk-MVRGB4KJ.js +278 -0
  110. package/dist/{chunk-DQMDCD24.js → chunk-MZNMASFM.js} +2 -2
  111. package/dist/{chunk-ID63777H.js → chunk-NBCQZSGR.js} +2 -2
  112. package/dist/chunk-NBZKSTXP.js +2 -0
  113. package/dist/{chunk-SZD2KF7Q.js → chunk-NCJILOAK.js} +2 -2
  114. package/dist/{chunk-C7QOQX32.js → chunk-NDKOVQFG.js} +2 -2
  115. package/dist/{chunk-UNBY47BC.js → chunk-NEWHKGVD.js} +2 -2
  116. package/dist/{chunk-PYAB5SM6.js → chunk-O2M3VNDY.js} +2 -2
  117. package/dist/chunk-OFGOOL6U.js +3 -0
  118. package/dist/{chunk-SWHMHUKF.js → chunk-OQUCBKOI.js} +2 -2
  119. package/dist/{chunk-7MGU3HPH.js → chunk-P4NVCOM7.js} +2 -2
  120. package/dist/{chunk-ANFVSJWQ.js → chunk-PFC44E6D.js} +2 -2
  121. package/dist/{chunk-EZNMUY67.js → chunk-PHNCEUXX.js} +2 -2
  122. package/dist/{chunk-4FC325IF.js → chunk-PTQPPPG2.js} +2 -2
  123. package/dist/chunk-PUVNH4PO.js +3 -0
  124. package/dist/chunk-Q23IMHXS.js +343 -0
  125. package/dist/chunk-Q3ZCQY2Y.js +3 -0
  126. package/dist/{chunk-KMITESMT.js → chunk-Q4XEU3UH.js} +2 -2
  127. package/dist/{chunk-QKPLA6IC.js → chunk-QEOWONKY.js} +2 -2
  128. package/dist/{chunk-BJ6SQAEN.js → chunk-QMOZZ2VX.js} +2 -2
  129. package/dist/chunk-RCIGX23V.js +60 -0
  130. package/dist/{chunk-IOP6FWIM.js → chunk-RIYJ4L33.js} +2 -2
  131. package/dist/chunk-RJVAPMHF.js +14 -0
  132. package/dist/chunk-SB7NASHU.js +2 -0
  133. package/dist/{chunk-UZGZB3VB.js → chunk-SGMNWYTH.js} +2 -2
  134. package/dist/chunk-SMDIEDM4.js +27 -0
  135. package/dist/chunk-SV2LEFVM.js +2 -0
  136. package/dist/chunk-SX72EVMY.js +3 -0
  137. package/dist/chunk-T5X7DK6C.js +3 -0
  138. package/dist/{chunk-6NW7MU72.js → chunk-T6MQNNAC.js} +2 -2
  139. package/dist/chunk-T75DS2E6.js +21 -0
  140. package/dist/{chunk-HRWGYWRJ.js → chunk-TEANKHUU.js} +2 -2
  141. package/dist/chunk-TJBOJUVN.js +3 -0
  142. package/dist/{chunk-XLQ3GLWZ.js → chunk-TJWVT4DO.js} +2 -2
  143. package/dist/{chunk-7NVGT435.js → chunk-TNJGTQWO.js} +2 -2
  144. package/dist/{chunk-NE6IU5ZD.js → chunk-TOTWJZIX.js} +2 -2
  145. package/dist/{chunk-PBI2LFKH.js → chunk-TPO7XC5Z.js} +2 -2
  146. package/dist/{chunk-HPJRBHVT.js → chunk-U33PMPNW.js} +2 -2
  147. package/dist/{chunk-QHRNXP3C.js → chunk-U7NUXDQO.js} +2 -2
  148. package/dist/chunk-UC2FD2PS.js +4 -0
  149. package/dist/{chunk-PIOMTC27.js → chunk-UQE4XFSA.js} +2 -2
  150. package/dist/chunk-UQYQBLJX.js +5 -0
  151. package/dist/{chunk-KWVHSKHK.js → chunk-USOAJHY7.js} +2 -2
  152. package/dist/{chunk-GCHRX4YW.js → chunk-UW6KD57C.js} +2 -2
  153. package/dist/{chunk-PTAWHLVJ.js → chunk-VGWZ4MOY.js} +2 -2
  154. package/dist/{chunk-XME3HPXZ.js → chunk-VWYGCMV5.js} +2 -2
  155. package/dist/{chunk-AKB7V7TV.js → chunk-W7YLRXZE.js} +2 -2
  156. package/dist/{chunk-SYDJMPES.js → chunk-WK2IQJPK.js} +2 -2
  157. package/dist/{chunk-RBAS5ZHI.js → chunk-WWCV4E6J.js} +2 -2
  158. package/dist/{chunk-OL6KJP3N.js → chunk-XMJ53WG4.js} +2 -2
  159. package/dist/chunk-XN3EKMLI.js +4 -0
  160. package/dist/chunk-XQAVQVIL.js +3 -0
  161. package/dist/{chunk-IJ4HMYBE.js → chunk-XQPPURLQ.js} +2 -2
  162. package/dist/{chunk-OVTS4DKB.js → chunk-YHPG3S2U.js} +2 -2
  163. package/dist/{chunk-WOQBZPIF.js → chunk-YRKP7PM7.js} +2 -2
  164. package/dist/chunk-YT4DVWUV.js +11 -0
  165. package/dist/chunk-YTJHCGYB.js +61 -0
  166. package/dist/chunk-Z35GOVEH.js +2 -0
  167. package/dist/{chunk-OLF4MA5W.js → chunk-Z6RL7XOE.js} +4 -4
  168. package/dist/{chunk-UP3BUZR5.js → chunk-ZAFGY22Q.js} +2 -2
  169. package/dist/{chunk-CO5R3UNA.js → chunk-ZB4C5TTR.js} +2 -2
  170. package/dist/{chunk-ZZXSWSN6.js → chunk-ZNH33XIB.js} +2 -2
  171. package/dist/{chunk-EMNIHCRB.js → chunk-ZQ62NNKN.js} +2 -2
  172. package/dist/cli-context-FJL2JHOE.js +3 -0
  173. package/dist/cli-context-PQNWHMCQ.js +2 -0
  174. package/dist/cli-program-UO7PZD6V.js +7 -0
  175. package/dist/cli.js +1 -1
  176. package/dist/{code-DlqpBDd0.d.ts → code-DfX3xeWy.d.ts} +1 -1
  177. package/dist/code-viewer-KIXEYQNJ.js +12 -0
  178. package/dist/code-viewer-VHLBLIUM.js +11 -0
  179. package/dist/command-descriptors-F5P2V3NW.js +335 -0
  180. package/dist/command-descriptors-YCLATF5I.js +337 -0
  181. package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
  182. package/dist/{db-D7sauVFH.d.ts → db-BoG_PWYH.d.ts} +2 -2
  183. package/dist/direct-navigation-4XJTXIDT.js +2 -0
  184. package/dist/direct-navigation-J5MVYYAD.js +3 -0
  185. package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-D1jx1Cql.d.ts} +1 -1
  186. package/dist/{health-DJaZXg8I.d.ts → health-DkYBS5BI.d.ts} +1 -1
  187. package/dist/index.d.ts +2 -2
  188. package/dist/index.js +1 -1
  189. package/dist/invocation-command-descriptors-RWV4VAI4.js +2 -0
  190. package/dist/invocation-command-descriptors-U76PN7IY.js +3 -0
  191. package/dist/{scip-cli-B7N3haxa.d.ts → maintenance-types-CdL5eQii.d.ts} +2 -21
  192. package/dist/output-continuation-command-BL25S26S.js +3 -0
  193. package/dist/output-continuation-command-BTETTXEC.js +2 -0
  194. package/dist/postinstall.js +1 -1
  195. package/dist/project-reindex-CRJU3IFG.js +2 -0
  196. package/dist/project-reindex-TQFCOA2O.js +3 -0
  197. package/dist/queries/affected.d.ts +2 -2
  198. package/dist/queries/affected.js +1 -1
  199. package/dist/queries/anchors.d.ts +2 -2
  200. package/dist/queries/anchors.js +1 -1
  201. package/dist/queries/architecture.d.ts +2 -2
  202. package/dist/queries/architecture.js +1 -1
  203. package/dist/queries/bottlenecks.d.ts +2 -2
  204. package/dist/queries/bottlenecks.js +1 -1
  205. package/dist/queries/by-kind.d.ts +2 -2
  206. package/dist/queries/by-kind.js +1 -1
  207. package/dist/queries/call-graph.d.ts +2 -2
  208. package/dist/queries/call-graph.js +1 -1
  209. package/dist/queries/change-surface.d.ts +2 -2
  210. package/dist/queries/change-surface.js +1 -1
  211. package/dist/queries/cleanup-plan.d.ts +2 -2
  212. package/dist/queries/cleanup-plan.js +1 -1
  213. package/dist/queries/co-change.d.ts +2 -2
  214. package/dist/queries/co-change.js +1 -1
  215. package/dist/queries/code.d.ts +3 -3
  216. package/dist/queries/code.js +1 -1
  217. package/dist/queries/complexity-hotspots.d.ts +2 -2
  218. package/dist/queries/complexity-hotspots.js +1 -1
  219. package/dist/queries/complexity.d.ts +2 -2
  220. package/dist/queries/complexity.js +1 -1
  221. package/dist/queries/context.d.ts +2 -2
  222. package/dist/queries/context.js +1 -1
  223. package/dist/queries/convergence.d.ts +2 -2
  224. package/dist/queries/convergence.js +1 -1
  225. package/dist/queries/coupling.d.ts +2 -2
  226. package/dist/queries/coupling.js +1 -1
  227. package/dist/queries/cycles.d.ts +2 -2
  228. package/dist/queries/cycles.js +1 -1
  229. package/dist/queries/dataflow.d.ts +2 -2
  230. package/dist/queries/dataflow.js +1 -1
  231. package/dist/queries/dead.d.ts +2 -2
  232. package/dist/queries/dead.js +1 -1
  233. package/dist/queries/decorative-checkers.d.ts +2 -2
  234. package/dist/queries/decorative-checkers.js +1 -1
  235. package/dist/queries/deep-chains.d.ts +2 -2
  236. package/dist/queries/deep-chains.js +1 -1
  237. package/dist/queries/dependence-slice.d.ts +3 -3
  238. package/dist/queries/dependence-slice.js +1 -1
  239. package/dist/queries/dependency-depth.d.ts +2 -2
  240. package/dist/queries/dependency-depth.js +1 -1
  241. package/dist/queries/deps.d.ts +2 -2
  242. package/dist/queries/deps.js +1 -1
  243. package/dist/queries/diff-impact.d.ts +2 -2
  244. package/dist/queries/diff-impact.js +1 -1
  245. package/dist/queries/doc-drift.d.ts +2 -2
  246. package/dist/queries/doc-drift.js +1 -1
  247. package/dist/queries/drift.d.ts +2 -2
  248. package/dist/queries/drift.js +1 -1
  249. package/dist/queries/duplicate-bodies.d.ts +2 -2
  250. package/dist/queries/duplicate-bodies.js +1 -1
  251. package/dist/queries/entry-map.d.ts +2 -2
  252. package/dist/queries/entry-map.js +1 -1
  253. package/dist/queries/evidence.d.ts +3 -3
  254. package/dist/queries/evidence.js +1 -1
  255. package/dist/queries/extract-candidates.d.ts +2 -2
  256. package/dist/queries/extract-candidates.js +1 -1
  257. package/dist/queries/fan.d.ts +2 -2
  258. package/dist/queries/fan.js +1 -1
  259. package/dist/queries/files.d.ts +2 -2
  260. package/dist/queries/files.js +1 -1
  261. package/dist/queries/health.d.ts +3 -3
  262. package/dist/queries/health.js +1 -1
  263. package/dist/queries/hierarchy.d.ts +2 -2
  264. package/dist/queries/hierarchy.js +1 -1
  265. package/dist/queries/hotspots.d.ts +2 -2
  266. package/dist/queries/hotspots.js +1 -1
  267. package/dist/queries/imports.d.ts +2 -2
  268. package/dist/queries/imports.js +1 -1
  269. package/dist/queries/incomplete-migration.d.ts +2 -2
  270. package/dist/queries/incomplete-migration.js +1 -1
  271. package/dist/queries/index.d.ts +5 -5
  272. package/dist/queries/index.js +1 -1
  273. package/dist/queries/isolated.d.ts +2 -2
  274. package/dist/queries/isolated.js +1 -1
  275. package/dist/queries/locality-candidates.d.ts +2 -2
  276. package/dist/queries/locality-candidates.js +1 -1
  277. package/dist/queries/members.d.ts +2 -2
  278. package/dist/queries/members.js +1 -1
  279. package/dist/queries/methods.d.ts +2 -2
  280. package/dist/queries/methods.js +1 -1
  281. package/dist/queries/not-implemented.d.ts +2 -2
  282. package/dist/queries/not-implemented.js +1 -1
  283. package/dist/queries/outline.d.ts +2 -2
  284. package/dist/queries/outline.js +1 -1
  285. package/dist/queries/passthrough-candidates.d.ts +2 -2
  286. package/dist/queries/passthrough-candidates.js +1 -1
  287. package/dist/queries/plan-context.d.ts +2 -2
  288. package/dist/queries/plan-context.js +1 -1
  289. package/dist/queries/react-component-duplicates.d.ts +2 -2
  290. package/dist/queries/react-component-duplicates.js +1 -1
  291. package/dist/queries/react-hook-candidates.d.ts +2 -2
  292. package/dist/queries/react-hook-candidates.js +1 -1
  293. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  294. package/dist/queries/react-large-component-pressure.js +1 -1
  295. package/dist/queries/recent-duplicates.d.ts +2 -2
  296. package/dist/queries/recent-duplicates.js +1 -1
  297. package/dist/queries/redundant-reexports.d.ts +2 -2
  298. package/dist/queries/redundant-reexports.js +1 -1
  299. package/dist/queries/reference-neighborhood.d.ts +2 -2
  300. package/dist/queries/reference-neighborhood.js +1 -1
  301. package/dist/queries/reference-reachability.d.ts +2 -2
  302. package/dist/queries/reference-reachability.js +1 -1
  303. package/dist/queries/refs.d.ts +2 -2
  304. package/dist/queries/refs.js +1 -1
  305. package/dist/queries/self-audit.d.ts +2 -2
  306. package/dist/queries/self-audit.js +1 -1
  307. package/dist/queries/similar-chains.d.ts +2 -2
  308. package/dist/queries/similar-chains.js +1 -1
  309. package/dist/queries/similar-files.d.ts +2 -2
  310. package/dist/queries/similar-files.js +1 -1
  311. package/dist/queries/similar-signatures.d.ts +2 -2
  312. package/dist/queries/similar-signatures.js +1 -1
  313. package/dist/queries/similar.d.ts +2 -2
  314. package/dist/queries/similar.js +1 -1
  315. package/dist/queries/slice.d.ts +2 -2
  316. package/dist/queries/slice.js +1 -1
  317. package/dist/queries/source-inspection.d.ts +4 -4
  318. package/dist/queries/source-inspection.js +1 -1
  319. package/dist/queries/source-search.d.ts +2 -2
  320. package/dist/queries/source-search.js +1 -1
  321. package/dist/queries/stale-abstractions.d.ts +2 -2
  322. package/dist/queries/stale-abstractions.js +1 -1
  323. package/dist/queries/stats.d.ts +2 -2
  324. package/dist/queries/surface.d.ts +2 -2
  325. package/dist/queries/surface.js +1 -1
  326. package/dist/queries/symbols.d.ts +2 -2
  327. package/dist/queries/symbols.js +1 -1
  328. package/dist/queries/system-map.d.ts +2 -2
  329. package/dist/queries/system-map.js +1 -1
  330. package/dist/queries/system.d.ts +2 -2
  331. package/dist/queries/system.js +1 -1
  332. package/dist/queries/test-quality.d.ts +2 -2
  333. package/dist/queries/test-quality.js +1 -1
  334. package/dist/queries/trace.d.ts +2 -2
  335. package/dist/queries/trace.js +1 -1
  336. package/dist/queries/twin-ab.d.ts +2 -2
  337. package/dist/queries/twin-ab.js +1 -1
  338. package/dist/queries/twin-drift.d.ts +2 -2
  339. package/dist/queries/twin-drift.js +1 -1
  340. package/dist/queries/unused-imports.d.ts +2 -2
  341. package/dist/queries/unused-imports.js +1 -1
  342. package/dist/queries/unused-params.d.ts +2 -2
  343. package/dist/queries/unused-params.js +1 -1
  344. package/dist/queries/value-flow.d.ts +3 -3
  345. package/dist/queries/value-flow.js +1 -1
  346. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  347. package/dist/queries/vue-component-duplicates.js +1 -1
  348. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  349. package/dist/queries/vue-composable-candidates.js +1 -1
  350. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  351. package/dist/queries/vue-large-view-pressure.js +1 -1
  352. package/dist/queries/wrapper-candidates.d.ts +2 -2
  353. package/dist/queries/wrapper-candidates.js +1 -1
  354. package/dist/reindex-worker.js +2 -2
  355. package/dist/reindex.d.ts +3 -5
  356. package/dist/reindex.js +72 -33
  357. package/dist/runtime.d.ts +23 -4
  358. package/dist/runtime.js +3 -3
  359. package/dist/rust-semantic-session-server.js +1 -1
  360. package/dist/rust-semantic-session-worker.js +1 -1
  361. package/dist/rust-semantic-worker.js +1 -1
  362. package/dist/sentinel-ensure-command-OSWGCFFL.js +3 -0
  363. package/dist/sentinel-ensure-command-SPW7XQLB.js +2 -0
  364. package/dist/sentinel-hook.js +39 -0
  365. package/dist/sentinel-worker.js +16 -0
  366. package/dist/typescript-mailbox-worker.js +1 -1
  367. package/dist/watch-server.js +6 -6
  368. package/docs/COMMAND_REFERENCE.md +5 -3
  369. package/docs/INDEX_GENERATIONS.md +2 -2
  370. package/docs/NPM_RELEASE.md +323 -0
  371. package/docs/schemas/npm-release-state.schema.json +4 -13
  372. package/docs/schemas/project-config.schema.json +159 -0
  373. package/package.json +10 -14
  374. package/skills/codebaseiq/SKILL.md +1 -1
  375. package/skills/concrete-plan/SKILL.md +1 -1
  376. package/ui/view/api.js +450 -0
  377. package/ui/view/app.js +394 -0
  378. package/ui/view/builder.js +323 -0
  379. package/ui/view/file-panel.js +170 -0
  380. package/ui/view/focus.js +379 -0
  381. package/ui/view/index.html +54 -0
  382. package/ui/view/map.js +424 -0
  383. package/ui/view/styles.css +1125 -0
  384. package/dist/chunk-2Q2LW5JW.js +0 -14
  385. package/dist/chunk-2X7V4HS4.js +0 -88
  386. package/dist/chunk-3IER7Q6H.js +0 -12
  387. package/dist/chunk-3JSXXYTZ.js +0 -345
  388. package/dist/chunk-476NR5B7.js +0 -2
  389. package/dist/chunk-5VKBFZZU.js +0 -3
  390. package/dist/chunk-6BQ3DSPK.js +0 -2
  391. package/dist/chunk-6CS3UQTN.js +0 -3
  392. package/dist/chunk-6OAHRI2D.js +0 -6
  393. package/dist/chunk-ADTBPVUZ.js +0 -21
  394. package/dist/chunk-BFFZDZQV.js +0 -2
  395. package/dist/chunk-BMYOV5GP.js +0 -77
  396. package/dist/chunk-C74PPYLA.js +0 -3
  397. package/dist/chunk-CWONGW6P.js +0 -3
  398. package/dist/chunk-DDZ7VHWV.js +0 -20
  399. package/dist/chunk-DR2LURYU.js +0 -3
  400. package/dist/chunk-ECQBG7PW.js +0 -564
  401. package/dist/chunk-EF2R3WNQ.js +0 -2
  402. package/dist/chunk-FM5BPL4V.js +0 -60
  403. package/dist/chunk-G6XFR4ZL.js +0 -4
  404. package/dist/chunk-GTIYTDRE.js +0 -562
  405. package/dist/chunk-HOA5YGOH.js +0 -3
  406. package/dist/chunk-KUW32IRO.js +0 -2
  407. package/dist/chunk-LTA3BRZX.js +0 -2
  408. package/dist/chunk-NAUD7LCA.js +0 -2
  409. package/dist/chunk-NCZUNH3E.js +0 -109
  410. package/dist/chunk-NNJ2KZZG.js +0 -4
  411. package/dist/chunk-NNO6A2PO.js +0 -2
  412. package/dist/chunk-OGTFJ3XD.js +0 -2
  413. package/dist/chunk-Q5ELPRKQ.js +0 -2
  414. package/dist/chunk-Q72QSKXC.js +0 -308
  415. package/dist/chunk-QCN62RTF.js +0 -3
  416. package/dist/chunk-QW7EP6WI.js +0 -21
  417. package/dist/chunk-RU65DDUP.js +0 -215
  418. package/dist/chunk-SELM5MER.js +0 -2
  419. package/dist/chunk-SMRBZ6EC.js +0 -2
  420. package/dist/chunk-SNNWPCN7.js +0 -4
  421. package/dist/chunk-TFZB6XTM.js +0 -239
  422. package/dist/chunk-UCD3H3UZ.js +0 -5
  423. package/dist/chunk-UXM43C7T.js +0 -3
  424. package/dist/chunk-VFY6Y2H6.js +0 -61
  425. package/dist/chunk-WE5RZHZ7.js +0 -5
  426. package/dist/chunk-YMGZZEW4.js +0 -2
  427. package/dist/chunk-YVCIMIOC.js +0 -12
  428. package/dist/chunk-Z54RD7VL.js +0 -3
  429. package/dist/chunk-ZKX2FRS6.js +0 -15
  430. package/dist/cli-context-3SNLDYBM.js +0 -3
  431. package/dist/cli-context-T3B7W6GG.js +0 -2
  432. package/dist/cli-program-YNOXO72B.js +0 -7
  433. package/dist/command-descriptors-6AOUKWW7.js +0 -346
  434. package/dist/command-descriptors-ZFKJSRUP.js +0 -344
  435. package/dist/direct-navigation-DP4LVMRX.js +0 -3
  436. package/dist/direct-navigation-FLUS3BT6.js +0 -2
  437. package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
  438. package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
  439. package/dist/output-continuation-command-2V2SL4TD.js +0 -2
  440. package/dist/output-continuation-command-65J5IP3O.js +0 -3
  441. package/dist/project-reindex-5JOKXAXT.js +0 -2
  442. package/dist/project-reindex-UQBIKO4M.js +0 -3
  443. package/docs/WINDOWS_SIDECAR_RELEASE.md +0 -424
  444. package/docs/schemas/windows-sidecar-provenance.schema.json +0 -137
  445. package/scripts/build-codebaseiq-windows.mjs +0 -197
  446. package/scripts/codebaseiq-windows-provenance.mjs +0 -364
  447. package/scripts/verify-codebaseiq-windows.mjs +0 -29
@@ -0,0 +1,2 @@
1
+ import{a as R}from"./chunk-3VJ3OCRE.js";import{N as U}from"./chunk-SMDIEDM4.js";import{d as G,e as K,f as X,m as z}from"./chunk-J7AMBVWF.js";import{c as V,t as A,u as q}from"./chunk-GVAF222T.js";import{f as k,j as C,k as E,p as P}from"./chunk-F74LZWCE.js";import{C as w}from"./chunk-ICUL7XRT.js";import{w as W}from"./chunk-7GAK2F3H.js";import{d as M}from"./chunk-UC2FD2PS.js";var Y=new WeakMap,H=new WeakMap,J=new WeakMap,ee=new WeakMap,te=new WeakMap;function Ze(t,e){let n=H.get(t);n||(n=new Map,H.set(t,n));let r=n.get(e);if(r)return r;let i=w(t,e)?.rootNode;if(!i)return n.set(e,[]),[];let o=new Set;I(i,l=>{if(l.type!=="call_expression")return;let p=l.childForFieldName("function")??l.namedChild(0),s=/^([A-Za-z_$][\w$]*(?:\.Service)?)\.of$/u.exec(p?.text.replace(/\s+/gu,"")??"");s&&o.add(s[1])});let m=P(t,e).filter(l=>!!l.sourcePath),f=new Set;for(let l of o){let p=/^([A-Za-z_$][\w$]*)\.Service$/u.exec(l);if(p){for(let s of m)s.localName===p[1]&&f.add(s.sourcePath);continue}if(l==="Service"){A(t,e).some(s=>s.leaf==="Service")&&f.add(e);for(let s of m)(s.localName??s.importedName)==="Service"&&f.add(s.sourcePath)}}let c=B([...f]).sort();return n.set(e,c),c}function Be(t,e,n={}){let i=E(t,e)?.filter(a=>!n.ranges||n.ranges.some(d=>a.line>=d.startLine&&a.line<=d.endLine));if(!i)return{targets:[],unresolvedCallsites:0};let o=P(t,e).filter(a=>!!a.sourcePath),m=$e(W(t,e)??""),f=w(t,e)?.rootNode??null,c=f?de(f):ne(),l=new Map,p=X(t),s=[],u=0;for(let a of i){if(!a.memberAccess)continue;let d=G(e,p.get(a.calleeLeaf)??[]);if(n.excludeIndexedTargets!==!1&&K(t,e,d,!0,a.calleeQualifier))continue;let h=a.calleeQualifier,L=we(t,e,a,o);if(L){s.push(L);continue}let b=fe(t,e,a,o,me(c,a.calleeQualifier,a.line));if(b.length>0){s.push(...b);continue}let S=pe(t,e,a);if(S.length>0){s.push(...S);continue}let y=h?m.get(h)??h:null,$=(y?B(o.filter(g=>(g.localName??g.importedName)===y).map(g=>g.sourcePath)):[]).flatMap(g=>{let v=l.get(g);return v||(v=C(t,g)??[],l.set(g,v)),v.filter(x=>x.name===a.calleeLeaf).map(x=>({file:g,callable:x}))});if($.length!==1){u+=1;continue}let F=$[0];s.push({calleeLeaf:a.calleeLeaf,line:a.line,sourceFile:e,targetFile:F.file,targetStartLine:F.callable.startLine,targetEndLine:F.callable.endLine,resolution:"direct-import-receiver",strength:"candidate"})}return{targets:s,unresolvedCallsites:u}}function fe(t,e,n,r,i){let o=n.calleeQualifier;if(!o||!/^[A-Za-z_$][\w$]*$/u.test(o))return[];if(i.size!==1)return[];let m=[...i][0],f=B(r.filter(p=>p.localName===m||p.importedName===m).map(p=>p.sourcePath));if(f.length!==1)return[];let c=f[0],l=Le(t,c,n.calleeLeaf);return l.map(p=>({calleeLeaf:p.name,line:n.line,sourceFile:e,targetFile:p.file,targetStartLine:p.startLine,targetEndLine:p.endLine,serviceFile:c,resolutionAlternativeCount:l.length,resolution:"imported-service-object-member",strength:"candidate"}))}function ne(){return{declarations:new Map,callbacks:[]}}function de(t){let e=ne();return I(t,n=>{if(n.type==="variable_declarator"){let c=n.childForFieldName("name")??n.namedChild(0),l=n.childForFieldName("value")??n.namedChild(1);if(c?.type!=="identifier"||!l)return;let p=new Set;if(I(l,s=>{if(s.type!=="member_expression")return;let u=s.childForFieldName("object")??s.namedChild(0),a=s.childForFieldName("property")??s.namedChild(1);u?.type==="identifier"&&a?.text==="Service"&&p.add(u.text)}),p.size===1){let s=e.declarations.get(c.text)??[];s.push({line:n.startPosition.row,alias:[...p][0]}),e.declarations.set(c.text,s)}return}if(!["arrow_function","function_expression","generator_function"].includes(n.type))return;let r=n.childForFieldName("parameters")??n.childForFieldName("parameter");if(!r)return;let i=n.parent;for(;i&&i.type!=="call_expression";)i=i.parent;if(!i)return;let o=i.childForFieldName("function")??i.namedChild(0),m=/^([A-Za-z_$][\w$]*)\.Service\.use$/u.exec(o?.text??"");if(!m)return;let f=new Set;I(r,c=>{c.type==="identifier"&&f.add(c.text)}),f.size!==0&&e.callbacks.push({startLine:n.startPosition.row,endLine:n.endPosition.row,receivers:f,alias:m[1]})}),e}function me(t,e,n){if(!e||!/^[A-Za-z_$][\w$]*$/u.test(e))return new Set;let r=new Set((t.declarations.get(e)??[]).filter(i=>i.line<=n).map(i=>i.alias));for(let i of t.callbacks)i.startLine<=n&&i.endLine>=n&&i.receivers.has(e)&&r.add(i.alias);return r}function pe(t,e,n){let r=n.calleeQualifier;if(!r||!/^[A-Za-z_$][\w$]*$/u.test(r))return[];let i=w(t,e)?.rootNode;if(!i)return[];let o=ge(t,e,i,n.line,n.calleeLeaf,r),m=o?ye(o,r):null;if(!m)return[];if(!he(m))return[];let f=(C(t,e)??[]).filter(a=>a.startLine<=m.startPosition.row&&a.endLine>=m.endPosition.row).sort((a,d)=>a.endLine-a.startLine-(d.endLine-d.startLine))[0];if(!f)return[];let c=A(t,e).filter(a=>a.isFunctionLike&&a.leaf===f.name);if(c.length!==1)return[];let l=c[0],p=ee.get(t);p||(p=new Map,ee.set(t,p));let s=`${l.symbol}\0${n.calleeLeaf}`,u=p.get(s);if(!u){let a=[];for(let d of z(t,l)){let h=w(t,d.file)?.rootNode;if(!h)continue;let L=h.descendantsOfType("call_expression").filter(y=>y.startPosition.row>d.line||y.endPosition.row<d.line?!1:(y.childForFieldName("function")??y.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,"").match(/[A-Za-z_$][\w$]*$/u)?.[0]===l.leaf);if(L.length!==1)continue;let S=L[0].childForFieldName("arguments")?.namedChildren.find(y=>T(y).type==="object");if(S)for(let y of T(S).namedChildren){if(y.type==="shorthand_property_identifier"&&y.text===n.calleeLeaf){a.push(...D(t,d.file,n.calleeLeaf,y,y));continue}if(y.type!=="pair")continue;let _=y.childForFieldName("key")??y.namedChild(0),$=y.childForFieldName("value")??y.namedChild(1);O(_?.text)!==n.calleeLeaf||!$||a.push(...D(t,d.file,n.calleeLeaf,$,y))}}u=a.filter((d,h,L)=>L.findIndex(b=>b.file===d.file&&b.startLine===d.startLine&&b.endLine===d.endLine&&b.name===d.name)===h),p.set(s,u)}return u.map(a=>({calleeLeaf:a.name,line:n.line,sourceFile:e,targetFile:a.file,targetStartLine:a.startLine,targetEndLine:a.endLine,resolutionAlternativeCount:u.length,resolution:"factory-callback-member",strength:u.length===1?"exact":"candidate"}))}function ge(t,e,n,r,i,o){let m=J.get(t);m||(m=new Map,J.set(t,m));let f=m.get(e);if(!f){f=new Map;for(let c of n.descendantsOfType("call_expression")){let l=c.childForFieldName("function")??c.namedChild(0),p=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(l?.text.replace(/\s+/gu,"")??"");if(p)for(let s=c.startPosition.row;s<=c.endPosition.row;s+=1){let u=`${s}\0${p[1]}\0${p[2]}`,a=f.get(u);(!a||c.endIndex-c.startIndex<a.endIndex-a.startIndex)&&f.set(u,c)}}m.set(e,f)}return f.get(`${r}\0${o}\0${i}`)??null}function he(t){return t.descendantsOfType("return_statement").some(e=>{let n=e.childForFieldName("argument")??e.namedChild(0);return!!(n&&T(n).type==="object")})}function ye(t,e){let n=t.parent;for(;n;){if(/(?:function|method|lambda)/u.test(n.type)||n.type==="arrow_function"){let r=n.childForFieldName("parameters")??n.childForFieldName("parameter"),i=!1;if(r&&I(r,o=>{o.type==="identifier"&&o.text===e&&(i=!0)}),i)return n}n=n.parent}return null}function D(t,e,n,r,i){if(r.type==="identifier")return(C(t,e)??[]).filter(c=>c.name===r.text).map(c=>({...c,file:e}));let o=j(t,e,r.text);if(o.length>0)return o;if(!Z(r))return[];let f=(C(t,e)??[]).filter(c=>c.startLine>=i.startPosition.row&&c.endLine<=i.endPosition.row&&(c.name===n||c.name.startsWith("source@"))).sort((c,l)=>c.endLine-c.startLine-(l.endLine-l.startLine))[0];return[f?{...f,file:e}:{name:n,file:e,startLine:i.startPosition.row,endLine:i.endPosition.row}]}function Le(t,e,n){let r=te.get(t);r||(r=new Map,te.set(t,r));let i=`${e}\0${n}`,o=r.get(i);if(o)return o;let m=xe(t,e).flatMap(f=>be(t,f,e,n));return r.set(i,m),m}function be(t,e,n,r){let i=w(t,e)?.rootNode,o=C(t,e)??[];if(!i)return[];let m=Ne(t,e,n);if(m.size===0)return[];let f=new Set,c=[],l=[],p=[];return I(i,u=>{if(Se(u,m)){if(u.type==="pair"){let a=u.childForFieldName("key")??u.namedChild(0),d=u.childForFieldName("value")??u.namedChild(1);if(O(a?.text)!==r||!d)return;if(d.type==="identifier")f.add(d.text);else if(Z(d))c.push({name:r,startLine:u.startPosition.row,endLine:u.endPosition.row});else{let h=Ce(t,e,d.text),L=j(t,e,d.text);if(h.length>0)p.push(...h);else if(L.length>0)p.push(...L);else{let b=ve(u);b&&l.push(b)}}return}u.type==="shorthand_property_identifier"&&u.text===r&&f.add(r)}}),[...o.filter(u=>f.has(u.name)).map(u=>({...u,file:e})),...c.map(u=>({...u,file:e})),...l.map(u=>({...u,file:e})),...p].filter((u,a,d)=>d.findIndex(h=>h.file===u.file&&h.name===u.name&&h.startLine===u.startLine&&h.endLine===u.endLine)===a)}function Se(t,e){let n=t,r=null;for(;n;){if(n.type==="object"&&(r=n),n.type==="call_expression"){if(!r)return!1;let i=n.childForFieldName("function")??n.namedChild(0);return i?e.has(i.text.replace(/\.of$/u,""))&&i.text.endsWith(".of"):!1}n=n.parent}return!1}function xe(t,e){let n=Y.get(t);n||(n=new Map,Y.set(t,n));let r=n.get(e);if(r)return r;let i=new Set([e]),o=A(t,e).filter(f=>f.leaf==="Service"&&f.isTypeLike);for(let f of o)for(let c of z(t,f))i.add(c.file);let m=[...i].sort();return n.set(e,m),m}function Ne(t,e,n){let r=new Set;M(e,n)&&r.add("Service");for(let i of P(t,e)){if(!i.sourcePath||!M(i.sourcePath,n))continue;if(i.kind==="namespace"&&i.localName){r.add(`${i.localName}.Service`);continue}(i.importedName==="default"?i.localName:i.importedName)==="Service"?r.add(i.localName??i.importedName):i.localName&&i.importedName!=="default"&&r.add(`${i.localName}.Service`)}return r}function j(t,e,n){let r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!r)return[];let i=w(t,e)?.rootNode;if(!i)return[];let o=re(i,r[1]),m=o?ie(o):null;if(!m)return[];let f=m.childForFieldName("function")??m.namedChild(0),c=f?ae(t,e,f.text):[];if(c.length!==1)return[];let l=c[0],p=w(t,l.relativePath)?.rootNode;if(!p)return[];let s=se(p,l.startLine,l.endLine);if(!s)return[];let u=[];for(let a of s.descendantsOfType("return_statement")){let d=a.childForFieldName("argument")??a.namedChild(0);if(!d)continue;let h=T(d);if(h.type==="object")for(let L of h.namedChildren){if(L.type==="shorthand_property_identifier"&&L.text===r[2]){for(let y of C(t,l.relativePath)??[])y.name===r[2]&&u.push({...y,file:l.relativePath});continue}if(L.type!=="pair")continue;let b=L.childForFieldName("key")??L.namedChild(0),S=L.childForFieldName("value")??L.namedChild(1);if(!(O(b?.text)!==r[2]||!S))if(S.type==="identifier")for(let y of C(t,l.relativePath)??[])y.name===S.text&&u.push({...y,file:l.relativePath});else Z(S)&&u.push({name:r[2],startLine:L.startPosition.row,endLine:L.endPosition.row,file:l.relativePath})}}return u.filter((a,d,h)=>h.findIndex(L=>L.file===a.file&&L.name===a.name&&L.startLine===a.startLine&&L.endLine===a.endLine)===d)}function Ce(t,e,n){let r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!r)return[];let i=w(t,e)?.rootNode;if(!i)return[];let o=re(i,r[1]),m=o?ie(o):null,f=m?.childForFieldName("function")??m?.namedChild(0),c=f?ae(t,e,f.text):[];if(c.length!==1||!m)return[];let l=c[0],p=w(t,l.relativePath)?.rootNode;if(!p)return[];let s=se(p,l.startLine,l.endLine);if(!s)return[];let u=new Set,a=s.childForFieldName("parameters")??s.childForFieldName("parameter");if(a&&I(a,g=>{g.type==="identifier"&&u.add(g.text)}),u.size===0)return[];let d=j(t,e,n);if(d.length===0)return[];let h=(C(t,l.relativePath)??[]).filter(g=>g.startLine>=l.startLine&&g.endLine<=l.endLine),L=(E(t,l.relativePath)??[]).filter(g=>g.line>=l.startLine&&g.line<=l.endLine),b=new Set,S=d.map(g=>({name:g.name,startLine:g.startLine,endLine:g.endLine})),y=new Set;for(;S.length>0&&y.size<32;){let g=S.shift(),v=`${g.name}\0${g.startLine}\0${g.endLine}`;if(!y.has(v)){y.add(v);for(let x of L.filter(N=>N.line>=g.startLine&&N.line<=g.endLine)){if(x.memberAccess&&x.calleeQualifier&&u.has(x.calleeQualifier)){b.add(x.calleeLeaf);continue}if(x.memberAccess)continue;let N=h.filter(ue=>ue.name===x.calleeLeaf);N.length===1&&S.push(N[0])}}}if(b.size===0)return[];let $=m.childForFieldName("arguments")?.namedChildren.find(g=>T(g).type==="object");if(!$)return[];let F=[];for(let g of T($).namedChildren){if(g.type==="shorthand_property_identifier"&&b.has(g.text)){F.push(...D(t,e,g.text,g,g));continue}if(g.type!=="pair")continue;let v=g.childForFieldName("key")??g.namedChild(0),x=g.childForFieldName("value")??g.namedChild(1),N=O(v?.text);!N||!b.has(N)||!x||F.push(...D(t,e,N,x,g))}return F.filter((g,v,x)=>x.findIndex(N=>N.file===g.file&&N.name===g.name&&N.startLine===g.startLine&&N.endLine===g.endLine)===v)}function re(t,e){for(let n of t.descendantsOfType("variable_declarator"))if((n.childForFieldName("name")??n.namedChild(0))?.text===e)return n.childForFieldName("value")??n.namedChild(1);return null}function ie(t){return t.type==="call_expression"?t:t.descendantsOfType("call_expression")[0]??null}function ae(t,e,n){let r=n.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,""),i=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(r);if(i){let s=P(t,e).filter(d=>d.localName===i[1]&&d.sourcePath);if(s.length!==1||!s[0].sourcePath)return[];let u=s[0].sourcePath,a=R(t,u,i[2]).filter(d=>d.isFunctionLike);return a.length>0?a:(C(t,u)??[]).filter(d=>d.name===i[2]).map(d=>({...d,relativePath:u}))}if(!/^[A-Za-z_$][\w$]*$/u.test(r))return[];let o=A(t,e).filter(s=>s.leaf===r&&s.isFunctionLike);if(o.length>0)return o;let m=(C(t,e)??[]).filter(s=>s.name===r).map(s=>({...s,relativePath:e}));if(m.length>0)return m;let f=P(t,e).filter(s=>s.localName===r&&s.sourcePath&&s.kind!=="namespace");if(f.length!==1||!f[0].sourcePath)return[];let c=f[0].sourcePath,l=f[0].importedName==="default"?r:f[0].importedName,p=R(t,c,l).filter(s=>s.isFunctionLike);return p.length>0?p:(C(t,c)??[]).filter(s=>s.name===l).map(s=>({...s,relativePath:c}))}function se(t,e,n){let r=null;return I(t,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>e||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Z(t){return["arrow_function","function_expression","generator_function"].includes(t.type)||t.descendantsOfType(["arrow_function","function_expression","generator_function"]).length>0}function ve(t){let e=t.parent;for(;e;){if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0);if(n?.type==="identifier")return{name:n.text,startLine:e.startPosition.row,endLine:e.endPosition.row}}e=e.parent}return null}function O(t){return t?t.replace(/^(?:['"])(.*)(?:['"])$/u,"$1"):null}function we(t,e,n,r){let i=/^this\.([A-Za-z_$][\w$]*)$/u.exec(n.calleeQualifier??"");if(!i)return null;let o=w(t,e)?.rootNode;if(!o)return null;let m=Ie(o,n.line);if(!m)return null;let f=new Set;if(I(m,h=>{if(h.type!=="assignment_expression")return;let L=h.childForFieldName("left")??h.namedChild(0),b=h.childForFieldName("right")??h.namedChild(h.namedChildCount-1);if(L?.text.replace(/\s+/gu,"")!==`this.${i[1]}`||!b)return;let S=T(b);if(S.type!=="new_expression")return;let _=(S.childForFieldName("constructor")??S.namedChild(0))?.text.match(/[A-Za-z_$][\w$]*$/u)?.[0];_&&f.add(_)}),f.size!==1)return null;let c=[...f][0],l=r.filter(h=>h.localName===c);if(l.length!==1)return null;let p=l[0].importedName==="default"?c:l[0].importedName,s=l[0].importedName==="default"?R(t,l[0].sourcePath,c):[],u=s.length===1?s[0].leaf:p,a=A(t,l[0].sourcePath).filter(h=>h.isFunctionLike&&h.leaf===n.calleeLeaf&&V(h.symbol)===u);if(a.length!==1)return null;let d=a[0];return{calleeLeaf:n.calleeLeaf,line:n.line,sourceFile:e,targetFile:d.relativePath,targetStartLine:d.startLine,targetEndLine:d.endLine,targetSymbol:d.symbol,resolution:"constructed-member-receiver",strength:"exact"}}function Ie(t,e){let n=[];return I(t,r=>{["class","class_declaration","class_definition"].includes(r.type)&&r.startPosition.row<=e&&r.endPosition.row>=e&&n.push(r)}),n.sort((r,i)=>r.endPosition.row-r.startPosition.row-(i.endPosition.row-i.startPosition.row))[0]??null}function T(t){let e=t;for(;["parenthesized_expression","as_expression","type_assertion","satisfies_expression"].includes(e.type)&&e.namedChildCount===1;)e=e.namedChild(0);return e}function I(t,e){e(t);for(let n of t.namedChildren)I(n,e)}function $e(t){let e=new Map,n=/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*;/gu;for(let r of t.matchAll(n)){let i=r[1],o=r[2];i&&o&&e.set(i,o)}return e}function B(t){let e=[];for(let n of t)e.some(r=>M(r,n))||e.push(n);return e}var oe=new WeakMap;function Ke(t,e,n,r){let i=k(t,e),o=(i?.callSites??[]).filter(a=>a.line>=n&&a.line<=r);if(!i||o.length===0)return{available:!!i,targets:[],resolvedCallsites:0,unresolvedCallsites:0};let m=Q(t,e);if(!m)return{available:!1,targets:[],resolvedCallsites:0,unresolvedCallsites:o.length};let f=m.filter(a=>a.sourceLine>=n&&a.sourceLine<=r).map(a=>({...a,calleeLeaf:a.definition.leaf})),c=le(o.map(a=>({line:a.line,leaf:a.calleeLeaf}))),l=le(f.map(a=>({line:a.sourceLine,leaf:a.calleeLeaf}))),p=new Set([...c].flatMap(([a,d])=>l.get(a)===d?[a]:[])),s=f.filter(a=>p.has(ce(a.sourceLine,a.calleeLeaf))),u=[...p].reduce((a,d)=>a+(c.get(d)??0),0);return{available:!0,targets:s,resolvedCallsites:u,unresolvedCallsites:Math.max(0,o.length-u)}}function Xe(t,e,n,r){let i=Q(t,e);return i?{available:!0,targets:i.filter(o=>o.sourceLine>=n&&o.sourceLine<=r)}:{available:!1,targets:[]}}function Ue(t,e,n,r){let i=Q(t,e);return i?{available:!0,targets:i.filter(o=>o.sourceLine>=n&&o.sourceLine<=r&&Te(t,o.definition)).map(o=>({...o,calleeLeaf:o.definition.leaf}))}:{available:!1,targets:[]}}function Q(t,e){let n=_e(t);return n.byFile.has(e)||n.byFile.set(e,Fe(t,n,e)),n.byFile.get(e)??null}function _e(t){let e=oe.get(t);if(!e){let n=q(t);e={definitionBySymbol:new Map(n.map(r=>[r.symbol,r])),byFile:new Map},oe.set(t,e)}return e}function Fe(t,e,n){if(t.isIgnored(n))return[];let r=U(t,n);if(!r)return null;let i=[];for(let o of r){if((o.roles&1)!==0)continue;let m=e.definitionBySymbol.get(o.symbol);m&&i.push({sourceLine:o.range[0],definition:m})}return i}function Te(t,e){if(!e.isFunctionLike)return!1;let n=k(t,e.relativePath);return!n||n.callables.some(r=>r.name===e.leaf&&r.startLine===e.startLine&&r.endLine===e.endLine)?!0:Pe(e)}function Pe(t){let e=t.documentation;if(!e)return!1;let n=t.leaf.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`\\bfunction\\s+${n}\\s*(?:<[^>]*>)?\\s*\\(`,"u").test(e)||new RegExp(`\\b(?:const|let|var)\\s+${n}\\s*:\\s*(?:<[^>]*>\\s*)?\\([^\\n]*\\)\\s*=>`,"u").test(e)}function le(t){let e=new Map;for(let n of t){let r=ce(n.line,n.leaf);e.set(r,(e.get(r)??0)+1)}return e}function ce(t,e){return`${t}\0${e}`}export{Ze as a,Be as b,Ke as c,Xe as d,Ue as e,Te as f};
2
+ //# sourceMappingURL=chunk-FWQGH2N2.js.map
@@ -1,7 +1,7 @@
1
- import{a as A}from"./chunk-BJ6SQAEN.js";import{a as T,b,c as W}from"./chunk-SELM5MER.js";import{a as R}from"./chunk-DGXRDLV5.js";import{a as N}from"./chunk-B75HZHUP.js";import{b as C,c as j}from"./chunk-7FND7D7N.js";import{a as _}from"./chunk-BGBBVSH4.js";import{b as E}from"./chunk-CVYSU6BX.js";import{A as P,d,e as w,k}from"./chunk-FETNQCFO.js";import{i as L}from"./chunk-O6QTXQPJ.js";import{d as x}from"./chunk-3LCDIREB.js";import{basename as m,extname as I}from"path";function ce(t,n){let{scope:e,maxLoc:i=15,limit:r=30,scanLimit:o}=n??{},a=new j(t),l=K(a.fileDependencyGraph(e));return R({candidates:()=>z(t,a,e,i),orderCandidates:N,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:c=>({...J(t,a,c,{semantic:n?.semantic!==!1}),reverseFanIn:l}),evaluate:(c,u)=>q(t,a,c,u),orderResults:(c,u)=>u.callerFanIn-c.callerFanIn||u.loc-c.loc,limit:r})}function J(t,n,e,i){let r=T(t,n),o=b(r.forDefinitions(e,{semantic:!1,sourceFallback:!1})),a=[];i.semantic&&x("wrapper.semantic-candidates",()=>{a=e.filter(s=>y(t,n,s,o).length<=1)},()=>({symbols:e.length,semanticCandidates:a.length}));let l=r.forDefinitions(a,{semantic:!0,sourceFallback:!1}),c=b(l),u=new Set([...l.values()].filter(s=>s.semanticIncomplete).map(s=>s.definition.symbolId)),f=new Set([...l.values()].filter(s=>s.semanticUnavailable).map(s=>s.definition.symbolId)),g=c.size===0?o:C(o,c),h=new Map(e.map(s=>[s.symbolId,s])),S=new Map;for(let s of e){let F=y(t,n,s,g);if(F.length>1||(S.set(s.symbolId,s),F.length!==1))continue;let D=F[0],v=O(t,s.symbolId,D);if(!v)continue;let p=B(n,t,D,s.symbol,v);p?.isFunctionLike&&h.has(p.symbolId)&&S.set(p.symbolId,h.get(p.symbolId))}let M=[...S.values()];return{callerFileMap:M.length===0?g:C(g,b(r.forDefinitions(M,{semantic:!1,sourceFallback:!0}))),incompleteSymbolIds:u,unavailableSymbolIds:f}}function q(t,n,e,i){if(i.incompleteSymbolIds.has(e.symbolId)||i.unavailableSymbolIds.has(e.symbolId))return null;let r=y(t,n,e,i.callerFileMap);if(r.length!==1)return null;let o=r[0],a=O(t,e.symbolId,o);if(!a)return null;let l=B(n,t,o,e.symbol,a);if(l&&k(l.symbol))return null;let{fanIn:c,source:u}=G(i.callerFileMap,i.reverseFanIn,o,l);if(u==="function"?c<=3:c<=5)return null;let f=Q(t,e,o,l);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:_(e),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?d(l.symbol):m(o),callerFanIn:c,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function z(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(r=>!L(t,r))}function y(t,n,e,i){let r=m(e.relativePath,I(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(a=>a!==e.relativePath).filter(a=>m(a,I(a))!==r).filter(a=>{let l=n.fileKind(a);return l!=="barrel"&&l!=="entry"&&l!=="test"});return W(t,e,o).realConsumers}function O(t,n,e){return t.get(`SELECT c.start_line, c.end_line
1
+ import{a as A}from"./chunk-QMOZZ2VX.js";import{a as T,b,c as W}from"./chunk-NBZKSTXP.js";import{a as R}from"./chunk-DGXRDLV5.js";import{a as N}from"./chunk-B75HZHUP.js";import{b as C,c as j}from"./chunk-HENP2O4A.js";import{a as _}from"./chunk-BGBBVSH4.js";import{b as E}from"./chunk-J7AMBVWF.js";import{A as P,d,e as w,k}from"./chunk-GVAF222T.js";import{i as L}from"./chunk-F74LZWCE.js";import{d as x}from"./chunk-3LCDIREB.js";import{basename as m,extname as I}from"path";function ce(t,n){let{scope:e,maxLoc:i=15,limit:r=30,scanLimit:o}=n??{},a=new j(t),l=K(a.fileDependencyGraph(e));return R({candidates:()=>z(t,a,e,i),orderCandidates:N,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:c=>({...J(t,a,c,{semantic:n?.semantic!==!1}),reverseFanIn:l}),evaluate:(c,u)=>q(t,a,c,u),orderResults:(c,u)=>u.callerFanIn-c.callerFanIn||u.loc-c.loc,limit:r})}function J(t,n,e,i){let r=T(t,n),o=b(r.forDefinitions(e,{semantic:!1,sourceFallback:!1})),a=[];i.semantic&&x("wrapper.semantic-candidates",()=>{a=e.filter(s=>y(t,n,s,o).length<=1)},()=>({symbols:e.length,semanticCandidates:a.length}));let l=r.forDefinitions(a,{semantic:!0,sourceFallback:!1}),c=b(l),u=new Set([...l.values()].filter(s=>s.semanticIncomplete).map(s=>s.definition.symbolId)),f=new Set([...l.values()].filter(s=>s.semanticUnavailable).map(s=>s.definition.symbolId)),g=c.size===0?o:C(o,c),h=new Map(e.map(s=>[s.symbolId,s])),S=new Map;for(let s of e){let F=y(t,n,s,g);if(F.length>1||(S.set(s.symbolId,s),F.length!==1))continue;let D=F[0],v=O(t,s.symbolId,D);if(!v)continue;let p=B(n,t,D,s.symbol,v);p?.isFunctionLike&&h.has(p.symbolId)&&S.set(p.symbolId,h.get(p.symbolId))}let M=[...S.values()];return{callerFileMap:M.length===0?g:C(g,b(r.forDefinitions(M,{semantic:!1,sourceFallback:!0}))),incompleteSymbolIds:u,unavailableSymbolIds:f}}function q(t,n,e,i){if(i.incompleteSymbolIds.has(e.symbolId)||i.unavailableSymbolIds.has(e.symbolId))return null;let r=y(t,n,e,i.callerFileMap);if(r.length!==1)return null;let o=r[0],a=O(t,e.symbolId,o);if(!a)return null;let l=B(n,t,o,e.symbol,a);if(l&&k(l.symbol))return null;let{fanIn:c,source:u}=G(i.callerFileMap,i.reverseFanIn,o,l);if(u==="function"?c<=3:c<=5)return null;let f=Q(t,e,o,l);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:_(e),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?d(l.symbol):m(o),callerFanIn:c,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function z(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(r=>!L(t,r))}function y(t,n,e,i){let r=m(e.relativePath,I(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(a=>a!==e.relativePath).filter(a=>m(a,I(a))!==r).filter(a=>{let l=n.fileKind(a);return l!=="barrel"&&l!=="entry"&&l!=="test"});return W(t,e,o).realConsumers}function O(t,n,e){return t.get(`SELECT c.start_line, c.end_line
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d ON c.document_id = d.id
5
5
  WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
6
6
  LIMIT 1`,n,e)}function B(t,n,e,i,r){let o=t.definitionsForFile(e),a=H(n,e,i,r.start_line,r.end_line);return P(o,a)}function G(t,n,e,i){if(i?.isFunctionLike){let r=[...t.get(i.symbolId)??[]].filter(o=>o!==i.relativePath);if(r.length>0)return{fanIn:r.length,source:"function"}}return{fanIn:U(n,e),source:"file"}}function H(t,n,e,i,r){let o=w(e);if(!o)return i;let a=E(t,n).get(o);if(!a||a.length===0)return i;for(let l of a)if(l>=i&&l<=r)return l;return i}function K(t){let n=new Map;for(let[e,i]of t){n.has(e)||n.set(e,n.get(e)??0);for(let r of i)n.set(r,(n.get(r)??0)+1)}return n}function U(t,n){let e=t.get(n)??0;if(e>0)return e;let i=m(n,I(n)),r=0;for(let[o,a]of t)o!==n&&m(o,I(o))===i&&a>r&&(r=a);return r}function Q(t,n,e,i){return A(t,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:d(n.symbol)},{label:"caller name",value:i?.symbol?d(i.symbol):m(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{ce as a};
7
- //# sourceMappingURL=chunk-CAUCPUOF.js.map
7
+ //# sourceMappingURL=chunk-GDHWOA57.js.map
@@ -1,6 +1,6 @@
1
- import{a as le}from"./chunk-N3IQCBCF.js";import{a as re}from"./chunk-GCHRX4YW.js";import{b as _}from"./chunk-XME3HPXZ.js";import{a as se}from"./chunk-BFFZDZQV.js";import{b as ie}from"./chunk-ID63777H.js";import{a as ne,b as oe}from"./chunk-AKB7V7TV.js";import{b as ee}from"./chunk-LZYFLFEH.js";import{f as te}from"./chunk-T3DGWPXM.js";import{a as X}from"./chunk-KMITESMT.js";import{a as Z}from"./chunk-ANFVSJWQ.js";import{b as Q}from"./chunk-SWHMHUKF.js";import{a as J}from"./chunk-4WKDMDEW.js";import{d as V}from"./chunk-PTAWHLVJ.js";import{b as Y}from"./chunk-GTXSJDCO.js";import{a as W}from"./chunk-OL6KJP3N.js";import{a as D}from"./chunk-UDS562V4.js";import{b as q}from"./chunk-LU3BMVH2.js";import{a as H,c as K}from"./chunk-UZGZB3VB.js";import{a as G}from"./chunk-TIIC3ZE7.js";import{e as P,t as w}from"./chunk-FETNQCFO.js";import{d as z}from"./chunk-3LCDIREB.js";function ae(e){let t=new Set(e.filter(o=>o.definition?.isFunctionLike).map(o=>`${o.role}:${o.definition.relativePath}`));return e.flatMap(o=>o.definition?!o.definition.isFunctionLike&&t.has(`${o.role}:${o.definition.relativePath}`)?[]:[{definition:o.definition,role:o.role}]:[])}var pe=6,I=10,B=3,N=8,he=.7,ce=24,M=200,ye=12,ue=80,me=600;function Ve(e,t,o={}){let l=o.impactDepth??3,m=o.sliceDepth??3,u=o.semantic,c=Ee(t)?be(e,t):null,a=c?c.primary?.symbol??null:t,s=a!==null,d=s?f("trace",a,()=>ie(e,a,{semantic:u,referenceContext:ye}),i=>({definitions:i.definitions.length,references:i.referencedBy.length})):{definitions:[],referencedBy:[],claimSupport:null},g=s?f("call-graph",a,()=>X(e,a,{semantic:u}),i=>({callers:i?.callers.length??0,callees:i?.callees.length??0})):null,n=s?f("complexity",a,()=>W(e,a,{semantic:u}),i=>({callees:i?.calleeCount??0})):null,y=s?f("dataflow",a,()=>ee(e,a,{semantic:u}),i=>({references:i?.usageSites.length??0,producers:i?.producers.length??0,consumers:i?.consumers.length??0})):null,r=s?f("backward-slice",a,()=>_(e,a,{direction:"backward",maxDepth:m,semantic:u}),i=>({maxDepth:m,connectedSymbols:i?.connectedSymbols.length??0})):null,C=s?f("forward-slice",a,()=>_(e,a,{direction:"forward",maxDepth:m,semantic:u}),i=>({maxDepth:m,connectedSymbols:i?.connectedSymbols.length??0})):null,h=s?f("affected",a,()=>q(e,a,{maxDepth:l,scope:o.scope}),i=>({maxDepth:l,affectedSymbols:i.rows.length,coverage:i.coverage.status})):null,b=h?.rows??[],p=h?.coverage??null,S=s?f("reuse-candidates",a,()=>D(e,a,{minSimilarity:.4,limit:5,semantic:u,sourceCandidateMode:"target-pruned"}),i=>({candidates:i.length,direct:i.filter(Ce=>Ce.actionTier==="direct").length})):[],L=s?H(e,a)?.symbol??null:null,k=s?f("affected-consumer-reuse",a,()=>Re(d,L,i=>D(e,i,{minSimilarity:.4,limit:I,semantic:u,sourceCandidateMode:"target-pruned"}),{consumerLimit:pe,perConsumerSearchLimit:I,perConsumerCandidateLimit:B,candidateLimit:N}),i=>({totalConsumers:i.coverage.totalConsumers,analyzedConsumers:i.coverage.analyzedConsumers,candidates:i.candidates.length})):ve(),A=f("change-surface",t,()=>Z(e,t,{semantic:u}),i=>({symbols:i?.symbols.length??0,externalConsumers:i?.totalExternalConsumers??0})),R=f("system",t,()=>re(e,t),i=>({files:i.files.length,symbols:i.symbols.length})),T=R.files.length===1,F=f("deps",t,()=>T?R.dependsOn.map(i=>({relativePath:i,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):ne(e,t),i=>({files:i.length,reusedSystem:T})),O=f("rdeps",t,()=>T?R.dependedOnBy.map(i=>({relativePath:i,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):oe(e,t),i=>({files:i.length,reusedSystem:T})),U=f("surface",t,()=>le(e,t),i=>({consumers:i.length})),v={symbol:d.definitions.length>0||d.referencedBy.length>0||g!==null||n!==null||y!==null||r!==null||C!==null||b.length>0,file:A!==null||F.length>0||O.length>0,module:R.files.length>0||R.symbols.length>0||U.length>0},x=[];c&&!c.primary&&c.callableCount>1&&x.push(`File target has ${c.callableCount} callable symbols; use one callable name for compiler-resolved flow.`);let $=[...new Set(d.referencedBy.map(i=>i.relativePath))];$.length>0&&$.every(i=>G(i)==="test")&&x.push("Only test references were found for this target. For replacement or retirement work, map the currently wired owner or one production entry point before planning; this target does not describe the live affected surface."),!v.symbol&&!v.file&&!v.module&&x.push("No symbol, file, or module matched target."),p&&p.status!=="accounted"&&x.push(`Possible-impact coverage is ${p.status}: ${p.reasons.join(" ")}`);let j=A?.file??d.definitions[0]?.relativePath??null;return{target:t,...c?.primary?{primaryCallable:{symbol:c.primary.symbol,shortName:P(c.primary.symbol),file:c.primary.relativePath}}:{},matched:v,history:f("history",j??t,()=>Pe(e,j,o.gitHead)),trace:ge(d),callGraph:g,complexity:n,dataflow:y,backwardSlice:r,forwardSlice:C,affected:b,affectedCoverage:p,changeSurface:A,deps:F,rdeps:O,system:R,surface:U,reuseCandidates:S,affectedConsumerReuse:k,sourcePacket:Se(e,L,d,k,S),warnings:x}}function ge(e){return{definitions:e.definitions,referencedBy:e.referencedBy.map(t=>({relativePath:t.relativePath,line:t.line,enclosingSymbol:t.enclosingSymbol,enclosingShort:t.enclosingShort}))}}function be(e,t){let o=Y(e,t);if(o.length!==1)return{primary:null,callableCount:0};let l=w(e,o[0]).filter(c=>c.isFunctionLike),m=l.filter(c=>c.enclosingSymbol===null),u=m.length>0?m:l;return{primary:u.length===1?u[0]:null,callableCount:u.length}}function Se(e,t,o,l,m){let u=[...t?[{definition:fe(e,t),role:"target"}]:[],...[...l.candidates.map(n=>n.candidate),...m].map(n=>({definition:fe(e,n.symbolB),role:"reuse-candidate"}))],c=new Map;for(let n of ae(u)){if(c.has(n.definition.symbol))continue;let y=n.role==="target"?M:ue,r=n.definition.endLine<=n.definition.startLine?V(e,n.definition.relativePath,n.definition.startLine,y):null,C=r?.unitType?r.source:te(e,n.definition);if(!C)continue;let h=C.split(`
1
+ import{a as le}from"./chunk-D7AZAOZX.js";import{a as re}from"./chunk-UW6KD57C.js";import{b as _}from"./chunk-VWYGCMV5.js";import{a as se}from"./chunk-2E6OUPCF.js";import{b as ie}from"./chunk-NBCQZSGR.js";import{a as ne,b as oe}from"./chunk-W7YLRXZE.js";import{b as ee}from"./chunk-HINZQKSY.js";import{f as te}from"./chunk-2OMXFE64.js";import{a as X}from"./chunk-Q4XEU3UH.js";import{a as Z}from"./chunk-PFC44E6D.js";import{b as Q}from"./chunk-OQUCBKOI.js";import{a as J}from"./chunk-CCIYWXX6.js";import{d as V}from"./chunk-VGWZ4MOY.js";import{b as Y}from"./chunk-LMTSB3TB.js";import{a as W}from"./chunk-XMJ53WG4.js";import{a as D}from"./chunk-36JC5BG2.js";import{b as q}from"./chunk-CW6AXOLR.js";import{a as H,c as K}from"./chunk-SGMNWYTH.js";import{a as G}from"./chunk-BRQL7AFJ.js";import{e as P,t as w}from"./chunk-GVAF222T.js";import{d as z}from"./chunk-3LCDIREB.js";function ae(e){let t=new Set(e.filter(o=>o.definition?.isFunctionLike).map(o=>`${o.role}:${o.definition.relativePath}`));return e.flatMap(o=>o.definition?!o.definition.isFunctionLike&&t.has(`${o.role}:${o.definition.relativePath}`)?[]:[{definition:o.definition,role:o.role}]:[])}var pe=6,I=10,B=3,N=8,he=.7,ce=24,M=200,ye=12,ue=80,me=600;function Ve(e,t,o={}){let l=o.impactDepth??3,m=o.sliceDepth??3,u=o.semantic,c=Ee(t)?be(e,t):null,a=c?c.primary?.symbol??null:t,s=a!==null,d=s?f("trace",a,()=>ie(e,a,{semantic:u,referenceContext:ye}),i=>({definitions:i.definitions.length,references:i.referencedBy.length})):{definitions:[],referencedBy:[],claimSupport:null},g=s?f("call-graph",a,()=>X(e,a,{semantic:u}),i=>({callers:i?.callers.length??0,callees:i?.callees.length??0})):null,n=s?f("complexity",a,()=>W(e,a,{semantic:u}),i=>({callees:i?.calleeCount??0})):null,y=s?f("dataflow",a,()=>ee(e,a,{semantic:u}),i=>({references:i?.usageSites.length??0,producers:i?.producers.length??0,consumers:i?.consumers.length??0})):null,r=s?f("backward-slice",a,()=>_(e,a,{direction:"backward",maxDepth:m,semantic:u}),i=>({maxDepth:m,connectedSymbols:i?.connectedSymbols.length??0})):null,C=s?f("forward-slice",a,()=>_(e,a,{direction:"forward",maxDepth:m,semantic:u}),i=>({maxDepth:m,connectedSymbols:i?.connectedSymbols.length??0})):null,h=s?f("affected",a,()=>q(e,a,{maxDepth:l,scope:o.scope}),i=>({maxDepth:l,affectedSymbols:i.rows.length,coverage:i.coverage.status})):null,b=h?.rows??[],p=h?.coverage??null,S=s?f("reuse-candidates",a,()=>D(e,a,{minSimilarity:.4,limit:5,semantic:u,sourceCandidateMode:"target-pruned"}),i=>({candidates:i.length,direct:i.filter(Ce=>Ce.actionTier==="direct").length})):[],L=s?H(e,a)?.symbol??null:null,k=s?f("affected-consumer-reuse",a,()=>Re(d,L,i=>D(e,i,{minSimilarity:.4,limit:I,semantic:u,sourceCandidateMode:"target-pruned"}),{consumerLimit:pe,perConsumerSearchLimit:I,perConsumerCandidateLimit:B,candidateLimit:N}),i=>({totalConsumers:i.coverage.totalConsumers,analyzedConsumers:i.coverage.analyzedConsumers,candidates:i.candidates.length})):ve(),A=f("change-surface",t,()=>Z(e,t,{semantic:u}),i=>({symbols:i?.symbols.length??0,externalConsumers:i?.totalExternalConsumers??0})),R=f("system",t,()=>re(e,t),i=>({files:i.files.length,symbols:i.symbols.length})),T=R.files.length===1,F=f("deps",t,()=>T?R.dependsOn.map(i=>({relativePath:i,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):ne(e,t),i=>({files:i.length,reusedSystem:T})),O=f("rdeps",t,()=>T?R.dependedOnBy.map(i=>({relativePath:i,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):oe(e,t),i=>({files:i.length,reusedSystem:T})),U=f("surface",t,()=>le(e,t),i=>({consumers:i.length})),v={symbol:d.definitions.length>0||d.referencedBy.length>0||g!==null||n!==null||y!==null||r!==null||C!==null||b.length>0,file:A!==null||F.length>0||O.length>0,module:R.files.length>0||R.symbols.length>0||U.length>0},x=[];c&&!c.primary&&c.callableCount>1&&x.push(`File target has ${c.callableCount} callable symbols; use one callable name for compiler-resolved flow.`);let $=[...new Set(d.referencedBy.map(i=>i.relativePath))];$.length>0&&$.every(i=>G(i)==="test")&&x.push("Only test references were found for this target. For replacement or retirement work, map the currently wired owner or one production entry point before planning; this target does not describe the live affected surface."),!v.symbol&&!v.file&&!v.module&&x.push("No symbol, file, or module matched target."),p&&p.status!=="accounted"&&x.push(`Possible-impact coverage is ${p.status}: ${p.reasons.join(" ")}`);let j=A?.file??d.definitions[0]?.relativePath??null;return{target:t,...c?.primary?{primaryCallable:{symbol:c.primary.symbol,shortName:P(c.primary.symbol),file:c.primary.relativePath}}:{},matched:v,history:f("history",j??t,()=>Pe(e,j,o.gitHead)),trace:ge(d),callGraph:g,complexity:n,dataflow:y,backwardSlice:r,forwardSlice:C,affected:b,affectedCoverage:p,changeSurface:A,deps:F,rdeps:O,system:R,surface:U,reuseCandidates:S,affectedConsumerReuse:k,sourcePacket:Se(e,L,d,k,S),warnings:x}}function ge(e){return{definitions:e.definitions,referencedBy:e.referencedBy.map(t=>({relativePath:t.relativePath,line:t.line,enclosingSymbol:t.enclosingSymbol,enclosingShort:t.enclosingShort}))}}function be(e,t){let o=Y(e,t);if(o.length!==1)return{primary:null,callableCount:0};let l=w(e,o[0]).filter(c=>c.isFunctionLike),m=l.filter(c=>c.enclosingSymbol===null),u=m.length>0?m:l;return{primary:u.length===1?u[0]:null,callableCount:u.length}}function Se(e,t,o,l,m){let u=[...t?[{definition:fe(e,t),role:"target"}]:[],...[...l.candidates.map(n=>n.candidate),...m].map(n=>({definition:fe(e,n.symbolB),role:"reuse-candidate"}))],c=new Map;for(let n of ae(u)){if(c.has(n.definition.symbol))continue;let y=n.role==="target"?M:ue,r=n.definition.endLine<=n.definition.startLine?V(e,n.definition.relativePath,n.definition.startLine,y):null,C=r?.unitType?r.source:te(e,n.definition);if(!C)continue;let h=C.split(`
2
2
  `),b=Math.min(h.length,y),p=r?.unitType?r.startLine:n.definition.startLine;c.set(n.definition.symbol,{role:n.role,symbol:n.definition.symbol,shortName:P(n.definition.symbol),file:n.definition.relativePath,startLine:p,endLine:p+b-1,source:h.slice(0,b).join(`
3
3
  `),omittedLines:(r?.unitType?r.omittedLines:0)+Math.max(0,h.length-b)})}let a=new Map;for(let n of o.referencedBy){if(n.source===void 0||n.source===null||n.sourceStartLine===void 0||n.sourceStartLine===null||n.sourceEndLine===void 0||n.sourceEndLine===null)continue;let y=`${n.relativePath}:${n.sourceStartLine}-${n.sourceEndLine}`,r=a.get(y);if(r){r.focusLines=[...new Set([...r.focusLines??[],n.line])].sort((C,h)=>C-h);continue}a.set(y,{role:"consumer",symbol:n.enclosingSymbol??`${n.relativePath}:${n.line}`,shortName:n.enclosingShort,file:n.relativePath,startLine:n.sourceStartLine,endLine:n.sourceEndLine,source:n.source,omittedLines:0,focusLines:[n.line]})}let s=[...[...c.values()].filter(n=>n.role==="target"),...a.values(),...[...c.values()].filter(n=>n.role==="reuse-candidate")],d=[],g=me;for(let n of s){if(d.length>=ce||g<=0)break;let y=n.source.split(`
4
4
  `),r=Math.min(y.length,g);d.push({...n,endLine:n.startLine+r-1,source:y.slice(0,r).join(`
5
5
  `),omittedLines:n.omittedLines+Math.max(0,y.length-r),...n.focusLines?{focusLines:n.focusLines.filter(C=>C<=n.startLine+r-1)}:{}}),g-=r}return{slices:d,candidateSlices:s.length,omittedSlices:Math.max(0,s.length-d.length),maxSlices:ce,maxLinesPerSlice:M,maxTotalLines:me,targetLineLimit:M,consumerContextLines:ye,reuseLineLimit:ue}}function fe(e,t){let o=K(e,t);return o?w(e,o.relativePath).find(l=>l.symbol===t)??null:null}function Re(e,t,o,l={}){let m=E(l.consumerLimit,pe),u=E(l.perConsumerSearchLimit,I),c=E(l.perConsumerCandidateLimit,B),a=E(l.candidateLimit,N),s=xe(e),d=s.slice(0,m),g=new Set(s.map(r=>r.symbol));t&&g.add(t);let n=new Map;for(let r of d){let C=o(r.symbol).slice(0,u),h=0;for(let b of C){let p=Le(b,r.symbol);if(!p||g.has(p.symbolB))continue;let S=n.get(p.symbolB);if(S?(S.consumers.some(L=>L.symbol===r.symbol)||S.consumers.push(r),p.similarity>S.candidate.similarity&&(S.candidate=p)):n.set(p.symbolB,{candidate:p,consumers:[r]}),h+=1,h>=c)break}}let y=[...n.values()].filter(r=>r.candidate.actionTier==="direct"||r.candidate.similarity>=he||r.consumers.length>1).sort(Te).slice(0,a);return{candidates:y,coverage:{totalConsumers:s.length,analyzedConsumers:d.length,omittedConsumers:Math.max(0,s.length-d.length),perConsumerSearchLimit:u,perConsumerCandidateLimit:c,candidateLimit:a,returnedCandidates:y.length}}}function xe(e){let t=new Map;for(let o of e.referencedBy){if(!o.enclosingSymbol)continue;let l=t.get(o.enclosingSymbol);if(l){l.referenceCount+=1;continue}t.set(o.enclosingSymbol,{symbol:o.enclosingSymbol,shortName:P(o.enclosingSymbol)||o.enclosingShort,file:o.relativePath,referenceCount:1})}return[...t.values()].sort((o,l)=>l.referenceCount-o.referenceCount||o.symbol.localeCompare(l.symbol))}function Le(e,t){return e.symbolA===t?e:e.symbolB!==t?null:{...e,symbolA:e.symbolB,shortNameA:e.shortNameB,fileA:e.fileB,symbolB:e.symbolA,shortNameB:e.shortNameA,fileB:e.fileA,uniqueToA:e.uniqueToB,uniqueToB:e.uniqueToA}}function Te(e,t){let o=de(t.candidate.actionTier)-de(e.candidate.actionTier);if(o!==0)return o;let l=t.consumers.length-e.consumers.length;if(l!==0)return l;let m=t.candidate.similarity-e.candidate.similarity;return m!==0?m:e.candidate.symbolB.localeCompare(t.candidate.symbolB)}function de(e){return e==="direct"?1:0}function E(e,t){return typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.floor(e)):t}function ve(){return{candidates:[],coverage:{totalConsumers:0,analyzedConsumers:0,omittedConsumers:0,perConsumerSearchLimit:I,perConsumerCandidateLimit:B,candidateLimit:N,returnedCandidates:0}}}function f(e,t,o,l=()=>({})){let m;return z(`context.${e}`,()=>(m=o(),m),()=>({target:t,...l(m)}))}function Pe(e,t,o){let l={available:!1,file:t,churn:null,coChangePartners:[],suppressionsInFile:0};if(!t)return l;let m=J(e,o?{head:o}:{}),u=f("history.churn",t,()=>m.fileChurn(),s=>({files:s?.size??0}));if(!u)return l;let c=f("history.co-change",t,()=>Q(e,t,{limit:5,...o?{head:o}:{}}),s=>({commits:s.commitsAnalyzed,partners:s.findings.length})),a=f("history.suppressions",t,()=>se(e).byFile.get(t)??0,s=>({suppressions:s}));return{available:!0,file:t,churn:u.get(t)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:c.findings.map(s=>({file:s.fileA===t?s.fileB:s.fileA,together:s.together,confidence:s.confidence,subjectContext:s.subjectContext})),suppressionsInFile:a}}function Ee(e){return e.includes("/")||e.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(e)}export{Ve as a,Re as b};
6
- //# sourceMappingURL=chunk-6MUIJMVL.js.map
6
+ //# sourceMappingURL=chunk-GIDCP7KV.js.map
@@ -1,8 +1,8 @@
1
- import{a as D,c as L,i as H,k as O}from"./chunk-L4NRUAGJ.js";import{j as T,o as B}from"./chunk-UDS562V4.js";import{d as A}from"./chunk-NMTSZXCL.js";import{c as _}from"./chunk-7FND7D7N.js";import{d as u,e as F}from"./chunk-FETNQCFO.js";import{a as E}from"./chunk-O6QTXQPJ.js";var J=5;function le(e,n={}){let{base:o="HEAD",minContainment:a=.7,minCallees:l=3,minSiteCoverage:t=.4,maxHelpers:p=Number.POSITIVE_INFINITY,limit:c=20,scanLimit:g}=n,h=n.semantic!==!1,s=n.diffPlan??L(e,{base:o}),r={available:s.note!==D,base:o,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[],...s.note?{note:s.note}:{}};if(!r.available||s.changedFiles.length===0)return r;let k=new _(e),P=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from]));if(n.baseContentAt&&n.baseContentResultAt)throw new Error("Specify only one of baseContentAt or baseContentResultAt.");let z=n.baseContentResultAt?n.baseContentResultAt:n.baseContentAt?Q(n.baseContentAt):H({projectRoot:e.config.projectRoot,base:o,preloadPaths:O(s)}),f=Z(k,P,$,z);if(f.unavailable)return r.available=!1,r.note=`Base content unavailable: ${f.unavailable.reason}`,r;if(f.definitions.length===0)return r;let I=f.definitions.slice(0,p);f.definitions.length>p&&(r.note=`helper scoring capped at ${p} of ${f.definitions.length} new symbols`);let d=k.calleeEvidenceMap(I,{semantic:h}),q=I.filter(i=>!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)).map(i=>({def:i,callees:B((d.rows.get(i.symbolId)??[]).map(m=>m.symbol))}));for(let i of I)!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)||r.skipped.push({helperShortName:u(i.symbol),helperFile:i.relativePath,reason:"compiler-resolved callee evidence is incomplete or unavailable \u2014 unsafe to score"});let V=T(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,l),scanLimit:g,semantic:h}),M);for(let{def:i,callees:m}of q){let b=u(i.symbol);if(m.size<l){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:`fewer than ${l} meaningful callees \u2014 too small to score`});continue}let w=G(),N=Y(m,w);if(N===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let y=ee(e,i.symbolId);if(y.length===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}r.helpersChecked+=1;let v=K({candidateIndex:w,changed:P,helperCallees:m,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:a,minSiteCoverage:t,migratedFiles:y});v.length!==0&&(v.sort((C,S)=>j(S.migrationScope)-j(C.migrationScope)||S.containment-C.containment||S.siteCoverage-C.siteCoverage||C.file.localeCompare(S.file)),r.findings.push({helperSymbol:i.symbol,helperShortName:b,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:m.size,specificHelperCalleeCount:N,migratedFiles:y.sort(),leftovers:v.slice(0,J)}))}return r.findings.sort((i,m)=>(m.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(m.helperFile)),r.findings=r.findings.slice(0,c),r}function K(e){let n=[],o=U(e.helperSymbol,e.helperFile,e.migratedFiles),a=new Set;for(let l of e.helperCallees)for(let t of e.candidateIndex.candidateIndexesByCallee.get(l)??[])a.add(t);for(let l of a){let t=e.candidateIndex.corpus[l];if(t.symbol===e.helperSymbol||e.changed.has(t.file)||t.callees.has(e.helperSymbol))continue;let p=A(e.helperCallees,t.callees);if(p<e.minContainment)continue;let c=[...e.helperCallees].filter(s=>t.callees.has(s)),g=t.callees.size===0?0:c.length/t.callees.size;if(g<e.minSiteCoverage||!c.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let h=W(o,t.symbol,t.file);n.push({symbol:t.symbol,shortName:u(t.symbol),file:t.file,...h,containment:p,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,t.callees.size-c.length),sharedCallees:c.map(u).sort()})}return n}function j(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,n,o){let a=new Set([...R(n),...x(F(e))]);for(let l of o)for(let t of R(l))a.add(t);return a}function W(e,n,o){let a=new Set([...R(o),...x(F(n))]);if(e.size===0||a.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let l=[...a].filter(t=>e.has(t)).sort();return l.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${l.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function R(e){return x(e.replace(/\.[^.]+$/,""))}function x(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1&&!X.has(n))}function Y(e,n){let o=0;for(let a of e)(n.docFreq.get(a)??0)<=n.ubiquityThreshold&&(o+=1);return o}function Z(e,n,o,a){let l=[];for(let t of e.productionCallableDefinitions({files:[...n],requireFunctionLikeSymbol:!0})){if(!n.has(t.relativePath))continue;let p=o.get(t.relativePath)??t.relativePath,c=a(p);if(c.state==="unavailable")return{definitions:[],unavailable:c};(c.state==="absent"||!new RegExp(`\\b${E(t.leaf)}\\b`).test(c.content))&&l.push(t)}return{definitions:l}}function Q(e){return n=>{let o=e(n);return o===null?{state:"absent"}:{state:"present",content:o}}}function ee(e,n){return e.all(`SELECT DISTINCT ref_d.relative_path
1
+ import{a as D,c as L,i as H,k as O}from"./chunk-FQTIFWLR.js";import{j as T,o as B}from"./chunk-36JC5BG2.js";import{d as A}from"./chunk-NMTSZXCL.js";import{c as _}from"./chunk-HENP2O4A.js";import{d as u,e as F}from"./chunk-GVAF222T.js";import{a as E}from"./chunk-F74LZWCE.js";var J=5;function le(e,n={}){let{base:o="HEAD",minContainment:a=.7,minCallees:l=3,minSiteCoverage:t=.4,maxHelpers:p=Number.POSITIVE_INFINITY,limit:c=20,scanLimit:g}=n,h=n.semantic!==!1,s=n.diffPlan??L(e,{base:o}),r={available:s.note!==D,base:o,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[],...s.note?{note:s.note}:{}};if(!r.available||s.changedFiles.length===0)return r;let k=new _(e),P=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from]));if(n.baseContentAt&&n.baseContentResultAt)throw new Error("Specify only one of baseContentAt or baseContentResultAt.");let z=n.baseContentResultAt?n.baseContentResultAt:n.baseContentAt?Q(n.baseContentAt):H({projectRoot:e.config.projectRoot,base:o,preloadPaths:O(s)}),f=Z(k,P,$,z);if(f.unavailable)return r.available=!1,r.note=`Base content unavailable: ${f.unavailable.reason}`,r;if(f.definitions.length===0)return r;let I=f.definitions.slice(0,p);f.definitions.length>p&&(r.note=`helper scoring capped at ${p} of ${f.definitions.length} new symbols`);let d=k.calleeEvidenceMap(I,{semantic:h}),q=I.filter(i=>!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)).map(i=>({def:i,callees:B((d.rows.get(i.symbolId)??[]).map(m=>m.symbol))}));for(let i of I)!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)||r.skipped.push({helperShortName:u(i.symbol),helperFile:i.relativePath,reason:"compiler-resolved callee evidence is incomplete or unavailable \u2014 unsafe to score"});let V=T(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,l),scanLimit:g,semantic:h}),M);for(let{def:i,callees:m}of q){let b=u(i.symbol);if(m.size<l){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:`fewer than ${l} meaningful callees \u2014 too small to score`});continue}let w=G(),N=Y(m,w);if(N===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let y=ee(e,i.symbolId);if(y.length===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}r.helpersChecked+=1;let v=K({candidateIndex:w,changed:P,helperCallees:m,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:a,minSiteCoverage:t,migratedFiles:y});v.length!==0&&(v.sort((C,S)=>j(S.migrationScope)-j(C.migrationScope)||S.containment-C.containment||S.siteCoverage-C.siteCoverage||C.file.localeCompare(S.file)),r.findings.push({helperSymbol:i.symbol,helperShortName:b,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:m.size,specificHelperCalleeCount:N,migratedFiles:y.sort(),leftovers:v.slice(0,J)}))}return r.findings.sort((i,m)=>(m.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(m.helperFile)),r.findings=r.findings.slice(0,c),r}function K(e){let n=[],o=U(e.helperSymbol,e.helperFile,e.migratedFiles),a=new Set;for(let l of e.helperCallees)for(let t of e.candidateIndex.candidateIndexesByCallee.get(l)??[])a.add(t);for(let l of a){let t=e.candidateIndex.corpus[l];if(t.symbol===e.helperSymbol||e.changed.has(t.file)||t.callees.has(e.helperSymbol))continue;let p=A(e.helperCallees,t.callees);if(p<e.minContainment)continue;let c=[...e.helperCallees].filter(s=>t.callees.has(s)),g=t.callees.size===0?0:c.length/t.callees.size;if(g<e.minSiteCoverage||!c.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let h=W(o,t.symbol,t.file);n.push({symbol:t.symbol,shortName:u(t.symbol),file:t.file,...h,containment:p,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,t.callees.size-c.length),sharedCallees:c.map(u).sort()})}return n}function j(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,n,o){let a=new Set([...R(n),...x(F(e))]);for(let l of o)for(let t of R(l))a.add(t);return a}function W(e,n,o){let a=new Set([...R(o),...x(F(n))]);if(e.size===0||a.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let l=[...a].filter(t=>e.has(t)).sort();return l.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${l.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function R(e){return x(e.replace(/\.[^.]+$/,""))}function x(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1&&!X.has(n))}function Y(e,n){let o=0;for(let a of e)(n.docFreq.get(a)??0)<=n.ubiquityThreshold&&(o+=1);return o}function Z(e,n,o,a){let l=[];for(let t of e.productionCallableDefinitions({files:[...n],requireFunctionLikeSymbol:!0})){if(!n.has(t.relativePath))continue;let p=o.get(t.relativePath)??t.relativePath,c=a(p);if(c.state==="unavailable")return{definitions:[],unavailable:c};(c.state==="absent"||!new RegExp(`\\b${E(t.leaf)}\\b`).test(c.content))&&l.push(t)}return{definitions:l}}function Q(e){return n=>{let o=e(n);return o===null?{state:"absent"}:{state:"present",content:o}}}function ee(e,n){return e.all(`SELECT DISTINCT ref_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents ref_d ON c.document_id = ref_d.id
5
5
  WHERE m.symbol_id = ?
6
6
  AND m.role != 1
7
7
  ${e.pathExclusionsFor("ref_d")}`,n).map(a=>a.relative_path)}export{le as a};
8
- //# sourceMappingURL=chunk-ZV3JV5G5.js.map
8
+ //# sourceMappingURL=chunk-GL6UTNUB.js.map
@@ -0,0 +1,2 @@
1
+ var s=new Set(["code","outline","refs"]),c=["--symbol","--at","--search","--view","--edge","--direction","--subtype","--connecting","--inventory-only","--fold","--depth","--max-edges"];function d(e){if(e[2]!=="evidence")return;let t=e[3];if(!t||t.startsWith("-"))return;if(e.slice(4).some(i=>c.some(r=>i===r||i.startsWith(`${r}=`)))){e.splice(3,1,"--symbol",t);return}e[2]="evidence-source"}function a(e){return e!==void 0&&s.has(e)}async function p(e){if(e==="continue"){let{outputContinuationCommandDescriptor:n}=await import("./output-continuation-command-BTETTXEC.js");return[n]}if(e==="__sentinel-ensure-service"){let{sentinelEnsureCommandDescriptor:n}=await import("./sentinel-ensure-command-SPW7XQLB.js");return[n]}if(a(e)){let{directNavigationQueryCommandDescriptors:n}=await import("./direct-navigation-4XJTXIDT.js"),o=n.find(i=>i.id===e);if(!o)throw new Error(`Direct navigation command descriptor is unavailable: ${e}`);return[o]}let{commandDescriptors:t}=await import("./command-descriptors-F5P2V3NW.js");return t}export{d as a,a as b,p as c};
2
+ //# sourceMappingURL=chunk-GP7C5VAE.js.map
@@ -1,13 +1,13 @@
1
- import{a as z}from"./chunk-VE5AVNMP.js";import{p as Ze}from"./chunk-CVYSU6BX.js";import{a as Xe}from"./chunk-TIIC3ZE7.js";import{A as oe,t as I}from"./chunk-FETNQCFO.js";import{f as ae,o as Ke,p as D}from"./chunk-O6QTXQPJ.js";import{A as He,C as B,F as Ge,K as H,z as Ue}from"./chunk-ADTBPVUZ.js";import{e as Z,u as M}from"./chunk-BMYOV5GP.js";function se(e){let t=e.replaceAll("\\","/");return Xe(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}import Dt from"better-sqlite3";var ue="codebaseiq_runtime_boundaries",j="codebaseiq_runtime_observations",ce="codebaseiq_runtime_relation_groups",de="codebaseiq_runtime_relation_participants";function Mt(e,t){let n=new Dt(e);try{n.exec(`
1
+ import{a as z}from"./chunk-3VJ3OCRE.js";import{p as We}from"./chunk-J7AMBVWF.js";import{a as Ze}from"./chunk-BRQL7AFJ.js";import{A as oe,t as I}from"./chunk-GVAF222T.js";import{f as ae,o as Xe,p as D}from"./chunk-F74LZWCE.js";import{A as Ge,C as B,F as Ke,K as H,z as He}from"./chunk-ICUL7XRT.js";import{a as Ue,g as Z,w as M}from"./chunk-7GAK2F3H.js";function se(e){let t=e.replaceAll("\\","/");return Ze(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}import Mt from"better-sqlite3";var ue="codebaseiq_runtime_boundaries",j="codebaseiq_runtime_observations",ce="codebaseiq_runtime_relation_groups",de="codebaseiq_runtime_relation_participants";function Vt(e,t){let n=new Mt(Ue(e));try{n.exec(`
2
2
  CREATE TABLE IF NOT EXISTS ${ue} (
3
3
  singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
4
4
  schema_version INTEGER NOT NULL,
5
5
  extractor_version TEXT NOT NULL,
6
6
  payload TEXT NOT NULL
7
7
  )
8
- `),zt(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${ue} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${j}`).run(),n.prepare(`DELETE FROM ${de}`).run(),n.prepare(`DELETE FROM ${ce}`).run();let r=n.prepare(`INSERT INTO ${j}
8
+ `),jt(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${ue} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${j}`).run(),n.prepare(`DELETE FROM ${de}`).run(),n.prepare(`DELETE FROM ${ce}`).run();let r=n.prepare(`INSERT INTO ${j}
9
9
  (id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
10
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let o of t.observations)r.run(o.id,o.protocol,o.action,o.role,o.strength,o.sourceScope,o.resolution,o.source.file,o.source.startLine,o.source.endLine,o.owner.symbol,JSON.stringify(o));let i=n.prepare(`INSERT INTO ${ce} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),a=n.prepare(`INSERT INTO ${de} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let o of t.relationGroups){i.run(o.id,o.protocol,o.joinRule,o.normalizedKey,JSON.stringify(o));for(let s of o.producerIds)a.run(o.id,s,"producer");for(let s of o.consumerIds)a.run(o.id,s,"consumer");for(let s of o.declarationIds)a.run(o.id,s,"declaration")}})()}finally{n.close()}}function Vt(e,t={}){if(!jt(e,j))return We(e)?.observations??[];let n=[],r=[];return le(n,r,"protocol",t.protocols),le(n,r,"action",t.actions),le(n,r,"source_scope",t.sourceScopes),le(n,r,"file",t.files),e.all(`SELECT payload FROM ${j}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(a=>qt(a.payload))}function zt(e){e.exec(`
10
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let o of t.observations)r.run(o.id,o.protocol,o.action,o.role,o.strength,o.sourceScope,o.resolution,o.source.file,o.source.startLine,o.source.endLine,o.owner.symbol,JSON.stringify(o));let i=n.prepare(`INSERT INTO ${ce} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),a=n.prepare(`INSERT INTO ${de} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let o of t.relationGroups){i.run(o.id,o.protocol,o.joinRule,o.normalizedKey,JSON.stringify(o));for(let s of o.producerIds)a.run(o.id,s,"producer");for(let s of o.consumerIds)a.run(o.id,s,"consumer");for(let s of o.declarationIds)a.run(o.id,s,"declaration")}})()}finally{n.close()}}function zt(e,t={}){if(!qt(e,j))return Ye(e)?.observations??[];let n=[],r=[];return le(n,r,"protocol",t.protocols),le(n,r,"action",t.actions),le(n,r,"source_scope",t.sourceScopes),le(n,r,"file",t.files),e.all(`SELECT payload FROM ${j}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(a=>Ut(a.payload))}function jt(e){e.exec(`
11
11
  CREATE TABLE IF NOT EXISTS ${j} (
12
12
  id TEXT PRIMARY KEY,
13
13
  protocol TEXT NOT NULL,
@@ -45,5 +45,5 @@ import{a as z}from"./chunk-VE5AVNMP.js";import{p as Ze}from"./chunk-CVYSU6BX.js"
45
45
  );
46
46
  CREATE INDEX IF NOT EXISTS idx_runtime_participants_observation
47
47
  ON ${de}(observation_id, participant_role);
48
- `)}function jt(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function le(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function qt(e){try{return[JSON.parse(e)]}catch{return[]}}function We(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",ue))return null;let n=e.get(`SELECT schema_version, payload FROM ${ue} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}import{createHash as Tt}from"crypto";import{createHash as un}from"crypto";var pe=8;function G(e,t,n){return Pe(Ye(e,t,we(n),0,new Set))}function Fe(e,t,n){return Ce(e,t,n,0,new Set)}function Ye(e,t,n,r,i){if(r>pe)return[];let a=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return a?Je(e,t,a[1],a[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?Qe(e,t,n,r,i):[]}function Je(e,t,n,r,i,a){let o=[];for(let s of Ce(e,t,n,i+1,new Set(a))){let l=Xt(s.initializer);for(let u of l.namedChildren){if(u.type==="pair"){let c=u.childForFieldName("key")??u.namedChild(0);if(Zt(c)!==r)continue;let d=u.childForFieldName("value")??u.namedChild(1);d&&o.push(...Ye(e,s.definition.relativePath,we(d.text),i+1,new Set(a)));continue}if(/(?:method|function)/u.test(u.type)){if((u.childForFieldName("name")??u.namedChild(0))?.text!==r)continue;let d=Gt(e,s.definition.relativePath,r,u);o.push(...d.length>0?d:[Ut(s.definition,r,u)]);continue}if(u.type==="spread_element"){let c=u.namedChild(0);if(!c)continue;for(let d of Ce(e,s.definition.relativePath,we(c.text),i+1,new Set(a)))o.push(...Je(e,d.definition.relativePath,d.definition.leaf,r,i+1,new Set(a)))}}}return Pe(o)}function Ut(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function Ce(e,t,n,r,i){return r>pe||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:Qe(e,t,n,r,i).flatMap(a=>{let o=B(e,a.relativePath)?.rootNode,s=o?Kt(o,a.leaf):null;return s?[{definition:a,initializer:s}]:[]})}function Qe(e,t,n,r,i){if(r>pe)return[];let a=`${t}\0${n}`;if(i.has(a))return[];i.add(a);let o=I(e,t).filter(u=>u.leaf===n);if(o.length>0)return o;let s=Ht(e,t,n);if(s.length>0)return s;let l=D(e,t).find(u=>u.localName===n&&u.sourcePath);if(l?.sourcePath){let u=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return Ie(e,l.sourcePath,u,r+1,new Set(i))}return Ie(e,t,n,r+1,new Set(i))}function Ht(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(ae(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function Ie(e,t,n,r,i){if(r>pe)return[];let a=I(e,t).filter(o=>o.leaf===n);return a.length>0?a:Pe(Ke(e,t).flatMap(o=>o.sourcePath?o.kind==="named"&&!o.names.includes(n)?[]:Ie(e,o.sourcePath,n,r+1,new Set(i)):[]))}function Gt(e,t,n,r){return I(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Kt(e,t){let n=null;return et(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Xt(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function Zt(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function we(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Pe(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}function et(e,t){t(e);for(let n of e.namedChildren)et(n,t)}var Wt=8;function R(e,t){return t?K(e,t,0,new Set):null}function K(e,t,n,r){if(n>Wt)return _(t,"value-evaluation-depth");let i=nt(t),a=nn(i);if(a)return rn(e.file,i,a.term,a.value,a.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(u=>K(e,u,n+1,new Set(r)));if(l.length>=2&&l.every(u=>u!==null)){let u={kind:"concat",parts:l.map(d=>d.term)},c=l.map(d=>d.value).join("");return an(e.file,i,u,c,l.some(d=>d.precision!=="literal")?"constrained-pattern":"literal",l)}}let o=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(o))return en(e,o,i,n,r);let s=on(i);return s?tn(e,s.base,s.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Yt(e,i,n,r):_(i,`unsupported-expression:${i.type}`)}function Yt(e,t,n,r){let a=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",o=Jt(e,a);if(o.length!==1)return _(t,o.length===0?"call-target-unresolved":"call-target-ambiguous");let s=o[0],l=`${s.relativePath}\0${s.symbol}`;if(r.has(l))return _(t,"call-return-cycle");let u=B(e.db,s.relativePath)?.rootNode;if(!u)return _(t,"call-target-unparsed");let c=ln(u,s.startLine,s.endLine);if(!c)return _(t,"call-target-syntax-unavailable");let d=Qt(c);if(!d)return _(t,"call-return-not-single-expression");let m=new Set(r);m.add(l);let p=K({db:e.db,file:s.relativePath,root:u},d,n+1,m);return p?me(t,"bounded-call-return",p,s.symbol):_(t,"call-return-unresolved")}function Jt(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=I(e.db,e.file).filter(o=>o.isFunctionLike&&o.leaf===t);if(i.length>0)return i;let a=D(e.db,e.file).find(o=>o.localName===t&&o.sourcePath&&o.kind!=="namespace");return a?.sourcePath?z(e.db,a.sourcePath,a.importedName==="default"?t:a.importedName).filter(o=>o.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=D(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?z(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function Qt(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return tt(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function tt(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)tt(e,r,n)}}function en(e,t,n,r,i){let a=`${e.file}\0${t}`;if(i.has(a))return _(n,"value-cycle");i.add(a);let o=Be(e.root,t);if(o){let f=K(e,o,r+1,i);return f?me(n,"local-constant",f):_(n,"non-foldable-local")}let s=D(e.db,e.file).find(f=>f.localName===t&&f.sourcePath);if(!s?.sourcePath)return E(n,t,"unresolved-identifier");if(s.kind==="namespace")return E(n,t,"namespace-import-requires-property");let l=s.importedName==="default"?t:s.importedName,u=z(e.db,s.sourcePath,l);if(u.length!==1)return E(n,t,u.length===0?"import-definition-missing":"import-definition-ambiguous");let c=u[0],d=B(e.db,c.relativePath)?.rootNode;if(!d)return E(n,c.symbol,"import-definition-unparsed");let m=Be(d,c.leaf);if(!m)return E(n,c.symbol,"import-definition-non-value");let p=K({db:e.db,file:c.relativePath,root:d},m,r+1,i);return p?me(n,"imported-constant",p,c.symbol):E(n,c.symbol,"import-value-unresolved")}function tn(e,t,n,r,i,a){let o=D(e.db,e.file).find(p=>p.localName===t&&p.sourcePath),s=e.file,l=t,u;if(o?.sourcePath){o.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=o.importedName==="default"?t:o.importedName;let p=z(e.db,o.sourcePath,l);if(p.length!==1)return E(r,`${t}.${n.join(".")}`,p.length===0?"member-definition-missing":"member-definition-ambiguous");s=p[0].relativePath,l=p[0].leaf,u=p[0].symbol}let c=s===e.file?e.root:B(e.db,s)?.rootNode;if(!c)return E(r,u??t,"member-definition-unparsed");let d=Be(c,l);if(!d)return E(r,u??t,"member-base-non-value");for(let p of n){let f=nt(d);if(d=sn(f,p),!d)return E(r,u??`${t}.${n.join(".")}`,`member-property-missing:${p}`)}let m=K({db:e.db,file:s,root:c},d,i+1,a);return m?me(r,"member-constant",m,u):E(r,u??t,"member-value-unresolved")}function nn(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],a=0,o=/\$\{([^}]*)\}/gu;for(let s of r.matchAll(o)){let l=s.index??0;l>a&&i.push({kind:"literal",value:r.slice(a,l)}),i.push({kind:"unknown",reason:`template-hole:${s[1]?.trim()||"expression"}`}),a=l+s[0].length}return a<r.length&&i.push({kind:"literal",value:r.slice(a)}),{term:{kind:"pattern",language:"template",value:r.replace(o,"{}")},value:r.replace(o,"{}"),precision:"constrained-pattern"}}function rn(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:fe("direct-literal","direct",e,t)}}function an(e,t,n,r,i,a){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...fe("constant-concatenation","mechanically-derived",e,t),inputFactIds:a.flatMap(o=>o.derivation.inputFactIds),sourceSpans:a.flatMap(o=>o.derivation.sourceSpans)}}}function me(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function E(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:fe(n,"heuristic","",e)}}function _(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:fe(t,"heuristic","",e)}}function fe(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function on(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}function Be(e,t){let n=null;return $e(e,r=>{if(n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t)return;let a=r.parent;!a||a.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(a.text)||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function sn(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function nt(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function ln(e,t,n){let r=null;return $e(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function $e(e,t){t(e);for(let n of e.namedChildren)$e(n,t)}var ot=new Set(["delete","get","head","options","patch","post","put"]),cn=/(?:^|\.)(?:app|router|server)$/u,dn=new Set(["findFirst","findMany","findUnique","from","get","select"]),pn=new Set(["create","delete","insert","remove","update","upsert"]),mn=new Set(["execute","query","raw"]),ke=[gn(),hn(),fn(),vn(),xn(),Sn(),Cn()],Re=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function fn(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=yn(e.source),n=[];return k(e.root,r=>{if(r.type!=="call_expression")return;let i=J(r);if(!i)return;let a=t.direct.get(i),o=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),s=o&&t.namespaces.has(o[1])?o[2]:null,l=a??s;if(!l||!Re.has(l))return;let u=q(r),c=$(u[0],e)??{value:u[0]?.text.trim()||"<missing>",evidence:"expression"},d=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(S(e,r,"builtin.node-child-process",d,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...c}],"exact","node-child-process-import"))}),n}}}function yn(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let l of e.matchAll(i))for(let u of(l[1]??"").split(",")){let c=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(u);c&&Re.has(c[1])&&t.set(c[2]??c[1],c[1])}let a=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(a))for(let u of(l[1]??"").split(",")){let c=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(u);c&&Re.has(c[1])&&t.set(c[2]??c[1],c[1])}let o=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(o))n.add(l[1]);let s=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(s))n.add(l[1]);return{direct:t,namespaces:n}}function N(e,t){let n=B(e,t)?.rootNode;if(!n)return null;let r=M(e,t),i=I(e,t),a=ae(e,t)?.callables??[];return{db:e,file:t,source:r,root:n,constants:$n(n),ownerAt:o=>{let s=i.filter(u=>u.startLine<=o&&u.endLine>=o).sort((u,c)=>u.endLine-u.startLine-(c.endLine-c.startLine)||u.startLine-c.startLine)[0];if(s)return{file:t,symbol:s.symbol,name:s.leaf,startLine:s.startLine,endLine:s.endLine};let l=a.filter(u=>u.startLine<=o&&u.endLine>=o).sort((u,c)=>u.endLine-u.startLine-(c.endLine-c.startLine)||u.startLine-c.startLine)[0];return{file:t,symbol:null,name:l?.name??null,startLine:l?.startLine??o,endLine:l?.endLine??o}}}}function hn(){return{id:"builtin.effect-httpapi",supports:e=>W(e,"HttpApiEndpoint").size>0||W(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=W(e.source,"HttpApiEndpoint"),r=W(e.source,"HttpApiGroup"),i=W(e.source,"HttpApiBuilder");return k(e.root,a=>{if(a.type!=="call_expression")return;let o=st(a);if(!o)return;let s=q(a);if(n.has(o.receiver)&&ot.has(o.member)){let y=$(s[0],e),h=$(s[1],e),C=it(a,r,"make",0,e);if(!y||!h||!C)return;let P=o.member.toUpperCase();t.push(S(e,a,"builtin.effect-httpapi","http.handle",[{name:"method",value:P,evidence:"literal"},{name:"path",...h}],T([{name:"path",...h}]),"effect-httpapi-endpoint-declaration")),t.push(S(e,a,"builtin.effect-httpapi","framework.declare",Ee(C,y),T(Ee(C,y)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(o.member))return;let l=it(a,i,"group",1,e),u=$(s[0],e),c=s[1];if(!l||!u||!c)return;let d=Ee(l,u),m=G(e.db,e.file,c.text),p=S(e,a,"builtin.effect-httpapi","framework.handle",d,m.length===1?T(d):"candidate","effect-httpapi-handler-registration"),f=m[0];m.length===1&&f&&(p.owner={file:f.relativePath,symbol:f.symbol,name:f.leaf,startLine:f.startLine,endLine:f.endLine}),t.push(p)}),t}}}function Ee(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function W(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(r)){let o=a[2]??"";if(rt(o))for(let s of(a[1]??"").split(",")){let l=s.trim().replace(/^type\s+/u,""),u=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(l);u?.[1]===t&&n.add(u[2]??u[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(i)){let o=a[2]??"";o.endsWith(`/${t}`)&&rt(o)&&n.add(a[1])}return n}function rt(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function it(e,t,n,r,i){let a=e.parent;for(;a;){if(a.type==="call_expression"){let o=at(a,t,n,r,i);if(o)return o;let s=a.childForFieldName("function")??a.namedChild(0),l=null;if(s&&k(s,u=>{!l&&u.type==="call_expression"&&(l=at(u,t,n,r,i))}),l)return l}a=a.parent}return null}function at(e,t,n,r,i){let a=st(e);return!a||a.member!==n||!t.has(a.receiver)?null:$(q(e)[r],i)}function st(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function gn(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||Y(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return k(e.root,n=>{if(n.type==="decorator"){let m=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!m||!Y(e.source,["fastapi","flask"]))return;t.push(S(e,n,"builtin.http","http.handle",[{name:"method",value:m[1].toUpperCase(),evidence:"literal"},{name:"path",value:m[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=J(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",a=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",o=q(n);if(i==="route"&&Y(e.source,["axum"])){let m=$(o[0],e),p=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(o[1]?.text??"")?.[1];if(!m||!p)return;t.push(S(e,n,"builtin.http","http.handle",[{name:"method",value:p.toUpperCase(),evidence:"literal"},{name:"path",...m}],T([{name:"path",...m}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let m=$(o[0],e);if(!m)return;let f=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(o[1]?.text??"")?.[1]?.toUpperCase()??(o[1]?null:"GET"),y=[...f?[{name:"method",value:f,evidence:"literal"}]:[],{name:"path",...m}];t.push(S(e,n,"builtin.http","http.request",y,f?T(y):"candidate","call-expression"));return}if(!ot.has(i))return;let s=$(o[0],e);if(!s)return;let l=i.toUpperCase();if(cn.test(a)&&Y(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(S(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],T([{name:"path",...s}]),"framework-adapter"));return}let c=Fn(e.source,["axios"]),d=a.split(".")[0]??"";c.has(d)&&t.push(S(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],T([{name:"path",...s}]),"client-adapter"))}),t}}}function vn(){return{id:"builtin.capability-registry",supports:e=>/\b(?:execute|handler|invoke|run)\s*(?:[:(])/u.test(e)||/['"`][^'"`\n]{0,256}\b[A-Za-z_$][\w$-]*\s*\(/u.test(e),extract:e=>{let t=[],n=new Set;return k(e.root,r=>{if(r.type==="pair"){let a=r.childForFieldName("key")??r.namedChild(0),o=r.childForFieldName("value")??r.namedChild(1),s=a?.text.replace(/^['"`]|['"`]$/gu,"");if(s!=="name"&&s!=="id")return;let l=lt(o,e),u=Rn(r);if(!l||l.evidence!=="literal"||!u)return;let c=`handle\0${l.value}\0${u.startPosition.row}`;if(n.has(c))return;n.add(c),t.push(S(e,u,"builtin.capability-registry","registry.handle",[{name:"key",...l}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(r.type))return;let i=r.text.replace(/^['"`]|['"`]$/gu,"");for(let a of i.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let o=a[1];if(!bn(i,o,a.index))continue;let s=`reference\0${o}\0${r.startPosition.row}`;n.has(s)||(n.add(s),t.push(S(e,r,"builtin.capability-registry","registry.reference",[{name:"key",value:o,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function bn(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function xn(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return k(e.root,n=>{if(n.type==="pair"){let a=En(n);if(!a)return;let o=n.childForFieldName("key")??n.namedChild(0),s=n.childForFieldName("value")??n.namedChild(1),l=lt(o,e);if(!l||!s||!ut(s))return;let u=Le(s)?"exact":"candidate";t.push(S(e,n,"builtin.registry","registry.handle",[{name:"registry",value:a,evidence:"identifier"},{name:"key",...l}],T([{name:"key",...l}],u),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(S(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function Sn(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=Ln(e.root);return k(e.root,r=>{if(r.type!=="call_expression")return;let i=J(r);if(!i)return;let a=i.split("."),o=a.at(-1)??"",s=q(r),l=s[0]?.text??"",u=kn(o,l);if(!u)return;let c=ct(a,n);if(!c)return;let d=Nn(s[0],e)??_n(l),m=Tn(c,a,o,d);if(!m)return;let p=o==="insert"?"persistence-insert":u==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(l)?"persistence-skip-locked-claim":"persistence-adapter";t.push(S(e,r,"builtin.persistence",u,[{name:"resource",...m}],T([{name:"resource",...m}]),p))}),t}}}function Nn(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:$(e,t)}function Cn(){return{id:"builtin.queue",supports:e=>Y(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return k(e.root,n=>{if(n.type!=="call_expression")return;let r=J(n);if(!r)return;let i=r.split(".").at(-1)??"",a=q(n),o=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!o)return;let s=i==="send"||i==="subscribe"?Pn(a[0],"topic",e):$(a[0],e);s&&t.push(S(e,n,"builtin.queue",o,[{name:"address",...s}],T([{name:"address",...s}]),"framework-adapter"))}),t}}}function S(e,t,n,r,i,a,o){let s=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${un("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:s,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:o,strength:a,protocol:r.split(".")[0]??r,role:In(r),executionDomain:wn(e.file),derivation:{kind:a==="candidate"?"heuristic":a==="derived"?"mechanically-derived":"direct",rule:o,ruleVersion:"1",inputFactIds:i.flatMap(u=>u.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(u=>u.derivation?.sourceSpans??[])]},valuePrecision:i.some(u=>u.evidence==="expression")?"unknown":i.some(u=>u.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:se(e.file)}}function In(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function wn(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function Y(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function Fn(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),a=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let o of e.matchAll(a)){let s=o[1]??o[2];s&&n.add(s)}}return n}function ye(e,t,n,r,i,a,o){return S(e,t,n,r,i,a,o)}function J(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function q(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function $(e,t){let n=R(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function Pn(e,t,n){if(!e)return null;let r=e.namedChildren.find(a=>a.type!=="pair"?!1:(a.childForFieldName("key")??a.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return $(i,n)}function lt(e,t){if(!e)return null;let n=$(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function T(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function Bn(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function $n(e){let t=new Map;return k(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let a=Bn(i);a!==null&&t.set(r.text,a)}),t}function En(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function Le(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function ut(e){return Le(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function Rn(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),a=n.childForFieldName("value")??n.namedChild(1),o=i?.text.replace(/^['"`]|['"`]$/gu,"");if(o&&["execute","handler","invoke","run"].includes(o)&&a&&ut(a))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function ct(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function kn(e,t){if(dn.has(e))return"database.read";if(pn.has(e))return"database.write";if(!mn.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function Ln(e){let t=new Set;return k(e,n=>{if(n.type!=="call_expression")return;let r=J(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!ct(i)))for(let a of q(n)){if(!Le(a))continue;let s=(a.childForFieldName("parameters")??a.namedChildren.find(u=>/parameters/u.test(u.type)))?.namedChildren[0],l=s?dt(s):null;l&&t.add(l)}}),t}function dt(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?dt(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function _n(e){let t=pt(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function Tn(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let a=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return a?{value:a,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=pt(r.value);return i?{value:i,evidence:r.evidence}:null}function pt(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function k(e,t){t(e);for(let n of e.namedChildren)k(n,t)}var On=Z("resolved-call-syntax",{clearGroups:[]}),An=Z("resolved-call-sites",{clearGroups:[]});function Q(e,t){return An.get(e,t.symbolId,()=>Dn(e,t))}function Dn(e,t){let n=[],r=[],i=new Set,a=new Set;for(let o of Ze(e,t,{semantic:!1})){i.add(o.file);let s=On.get(e,o.file,()=>Mn(e,o.file));if(!s){r.push({callee:t,file:o.file,line:o.line,reason:"ast-unavailable",candidates:0,referenceProvenance:o.provenance});continue}let l=(s.byLeaf.get(t.leaf)??[]).filter(({callNode:d})=>d.startPosition.row<=o.line&&d.endPosition.row>=o.line);if(l.length!==1){r.push({callee:t,file:o.file,line:o.line,reason:l.length===0?"call-not-found":"ambiguous-call",candidates:l.length,referenceProvenance:o.provenance});continue}let u=l[0],c=`${o.file}\0${u.callNode.startIndex}\0${u.callNode.endIndex}`;a.has(c)||(a.add(c),n.push({callee:t,caller:oe(I(e,o.file),u.callNode.startPosition.row),file:o.file,line:o.line,startLine:u.callNode.startPosition.row,endLine:u.callNode.endPosition.row,targetText:u.targetNode.text,callNode:u.callNode,targetNode:u.targetNode,arguments:u.arguments,referenceProvenance:o.provenance}))}return{sites:n,unresolved:r,filesVisited:i.size}}function Mn(e,t){let n=B(e,t)?.rootNode;if(!n)return null;let r=new Map;return mt(n,i=>{if(i.type!=="call_expression"&&i.type!=="call")return;let a=i.childForFieldName("function")??i.namedChild(0);if(!a)return;let o=Ge(a);if(!o)return;let s=i.childForFieldName("arguments")??i.namedChildren.find(c=>c.type==="arguments"),l={callNode:i,targetNode:a,arguments:s?.namedChildren??[]},u=r.get(o);u?u.push(l):r.set(o,[l])}),{byLeaf:r}}function mt(e,t){t(e);for(let n of e.namedChildren)mt(n,t)}var Vn=Z("call-parameter-value-flow",{clearGroups:[]});function ee(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return Vn.get(e,n,()=>zn(e,t))}function te(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function zn(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-unavailable",proof:n}))};let r=B(e,t.caller.relativePath)?.rootNode,i=r?jn(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let a=qn(i),o=[],s=[];return t.arguments.forEach((l,u)=>{let c=l.text.trim(),d=a.indexOf(c);d>=0?o.push({calleePosition:u,callerPosition:d,argumentText:c,proof:n}):s.push({calleePosition:u,argumentText:c,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:o,unknown:s}}function jn(e,t,n){let r=null;return yt(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function qn(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(ft)??[]}function ft(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?ft(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function yt(e,t){t(e);for(let n of e.namedChildren)yt(n,t)}var Un=8,Hn=8;function gt(e,t){let n=[],r=Gn(e,n),i=r.summaries,a=Kn(e,t,i,n),o=Xn(e,t,n);return{observations:ar([...a.observations,...o]),bodySummaries:i.size,discriminatorSummaries:a.summaries,filesInspected:r.filesInspected,errors:n}}function Gn(e,t){let n=new Map,r=[],i=H(e);for(let a of i){let o=M(e,a);if(!/\bJSON\.stringify\s*\(/u.test(o)||!/\bbody\s*:/u.test(o))continue;let s=N(e,a);if(s)for(let[l,u]of Zn(s)){let c={definition:l,parameterIndexes:u,depth:0,proofSpans:[{file:a,startLine:l.startLine,endLine:l.endLine}]};n.set(l.symbol,c),r.push(c)}}for(;r.length>0;){let a=r.shift();if(!(a.depth>=Un))try{for(let o of Q(e,a.definition).sites){if(!N(e,o.file))continue;let l=o.caller;if(!l)continue;let u=te(ee(e,o),a.parameterIndexes);if(u.length===0)continue;let c={definition:l,parameterIndexes:It(u),depth:a.depth+1,proofSpans:[...a.proofSpans,{file:o.file,startLine:o.startLine,endLine:o.endLine}]};Qn(n,c)&&r.push(n.get(l.symbol))}}catch(o){t.push(`builtin.carrier body summary failed for ${a.definition.relativePath}: ${Ae(o)}`)}}return{summaries:n,filesInspected:i.length}}function Kn(e,t,n,r){let i=new Map,a=[],o=[];for(let s of t){if(s.action!=="http.request"||s.strength==="candidate"||s.sourceScope!=="production")continue;let l=vt(s);if(!l)continue;let u=N(e,s.source.file);if(!u)continue;let c=St(u.root,s.source.startLine),d=c.find(P=>P.startPosition.row===s.source.startLine)??c[0];if(!d)continue;let m=Oe(d);if(!m)continue;let p=G(e,s.source.file,m.text);if(p.length!==1)continue;let f=n.get(p[0].symbol);if(!f)continue;let y=s.owner.symbol?I(e,s.owner.file).find(P=>P.symbol===s.owner.symbol):null;if(!y)continue;let h=er(u,y),C=ge(d);for(let P of f.parameterIndexes){let O=nr(u,C[P]);if(O)for(let v of rr(O)){let w=Nt(v),L=Ct(v);if(!w||!L)continue;let A=h.indexOf(L.text.trim());if(A>=0){let F={definition:y,carrier:l,field:w,parameterIndex:A,depth:0,proofObservationIds:[s.id],proofSpans:[s.source,{file:s.source.file,startLine:v.startPosition.row,endLine:v.endPosition.row}]},x=ht(F);i.has(x)||(i.set(x,F),a.push(F));continue}let b=R(u,L);!b||b.evidence==="expression"||o.push(Te(u,v,"carrier.publish",l,w,b.value,[s.id]))}}}for(;a.length>0;){let s=a.shift();if(!(s.depth>=Hn))try{for(let l of Q(e,s.definition).sites){let u=N(e,l.file);if(!u)continue;let c=l.callNode,d=ge(c)[s.parameterIndex];if(!d)continue;let m=R(u,d);m&&m.evidence!=="expression"&&o.push(Te(u,c,"carrier.publish",s.carrier,s.field,m.value,s.proofObservationIds));let p=l.caller;if(!p)continue;let f=ee(e,l).transfers.find(C=>C.calleePosition===s.parameterIndex)?.callerPosition;if(f===void 0)continue;let y={...s,definition:p,parameterIndex:f,depth:s.depth+1,proofSpans:[...s.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},h=ht(y);i.has(h)||(i.set(h,y),a.push(y))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${s.definition.relativePath}: ${Ae(l)}`)}}return{observations:o,summaries:i.size}}function Xn(e,t,n){let r=[],i=t.filter(a=>a.action==="registry.handle"&&a.strength!=="candidate"&&a.sourceScope==="production");for(let a of t){if(a.action!=="http.handle"||a.strength==="candidate"||a.sourceScope!=="production")continue;let o=vt(a);if(!o)continue;let s=N(e,a.source.file);if(!s)continue;let l=St(s.root,a.source.startLine)[0];if(l)for(let u of ge(l).slice(1)){let c=G(e,a.source.file,u.text);for(let d of c)try{let m=N(e,d.relativePath);if(!m)continue;let p=he(m.root,d.startLine,d.endLine);if(!p)continue;V(p,f=>{if(f.type!=="call_expression")return;let y=Oe(f);if(!y)return;let h=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(y.text.trim());if(!h)return;let C=h[1],P=h[2],O=Yn(e,m,d,P);if(!O)return;let v=Jn(e,d.relativePath,C);for(let w of i){let L=w.keyParts.find(x=>x.name==="registry")?.value,A=w.keyParts.find(x=>x.name==="key")?.value;if(!L||!A||!v.some(x=>x.file===w.source.file&&x.binding===L))continue;let b=N(e,w.source.file),F=b?tr(b.root,w.source.startLine):null;!b||!F||r.push(Te(b,F,"carrier.consume",o,O,A,[a.id,w.id]))}})}catch(m){n.push(`builtin.carrier consumer analysis failed for ${d.relativePath}: ${Ae(m)}`)}}}return r}function Zn(e){let t=I(e.db,e.file),n=new Map;return V(e.root,r=>{if(r.type!=="pair"||Nt(r)?.toLowerCase()!=="body")return;let i=Ct(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let a=oe(t,r.startPosition.row),o=Wn(r);if(!a||!o)return;let s=bt(o),l=new Set;ir(i,s,l);let u=n.get(a.symbol)??new Set;s.forEach((c,d)=>{c&&l.has(c)&&u.add(d)}),u.size>0&&n.set(a.symbol,u)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[[r,[...i].sort((a,o)=>a-o)]]:[]})}function Wn(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function Yn(e,t,n,r){let i=he(t.root,n.startLine,n.endLine);if(!i)return null;let a=new RegExp(`\\.body\\??\\.${_e(r)}\\b`,"u");if(a.test(i.text))return r;let o=null;if(V(i,c=>{if(o||c.type!=="variable_declarator")return;let d=c.childForFieldName("name")??c.namedChild(0),m=c.childForFieldName("value")??c.namedChild(1);!d||!m||!new RegExp(`(?:^|[,{}])\\s*${_e(r)}\\s*(?:[,}]|$)`,"u").test(d.text)||m.type==="call_expression"&&(o=Oe(m)?.text??null)}),!o)return null;let s=G(e,n.relativePath,o);if(s.length!==1)return null;let l=N(e,s[0].relativePath),u=l?he(l.root,s[0].startLine,s[0].endLine):null;return u&&a.test(u.text)&&new RegExp(`\\b${_e(r)}\\s*[,}]`,"u").test(u.text)?r:null}function Jn(e,t,n){let r=[];for(let i of Fe(e,t,n)){let a=ne(i.initializer);if(a.type==="call_expression")for(let o of ge(a)){let s=o.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))for(let l of Fe(e,i.definition.relativePath,s))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Te(e,t,n,r,i,a,o){let l=ye(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:a,evidence:"constant",term:{kind:"literal",value:a}}],"derived","http-body-registry-discriminator");return l.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...o],sourceSpans:[l.source]},l}function vt(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function Qn(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=It([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function ht(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function er(e,t){let n=he(e.root,t.startLine,t.endLine);return n?bt(n):[]}function bt(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(xt)??[]}function xt(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?xt(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function he(e,t,n){let r=null;return V(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function tr(e,t){let n=null;return V(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function St(e,t){let n=[];return V(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function Oe(e){return e.childForFieldName("function")??e.namedChild(0)}function ge(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function nr(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return ne(t);let r=null;return V(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),ne(r||t)}function rr(e){let t=ne(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function Nt(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ct(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function ne(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function ir(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function It(e){return[...new Set(e)].sort((t,n)=>t-n)}function ar(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function Ae(e){return e instanceof Error?e.message:String(e)}function V(e,t){t(e);for(let n of e.namedChildren)V(n,t)}import{createHash as or}from"crypto";function wt(e,t){let n=new Map;for(let a of t){if(a.action!=="http.handle"||a.sourceScope!=="production")continue;let o=n.get(a.source.file)??[];o.push(a),n.set(a.source.file,o)}let r=[],i=sr(e);for(let a of i.mounts)for(let o of a.targetFiles)for(let s of n.get(o)??[]){let l=s.keyParts.find(m=>m.name==="path");if(!l||l.evidence==="expression")continue;let u=ur(a.prefix.value,l.value),c=s.keyParts.map(m=>m.name==="path"?{name:"path",value:u,evidence:"constant",term:{kind:"concat",parts:[a.prefix.term??{kind:"literal",value:a.prefix.value},l.term??{kind:"literal",value:l.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:a.file,startLine:a.line,endLine:a.line},...a.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:m),d=`${s.id}\0${a.file}\0${a.line}\0${u}`;r.push({...s,id:`boundary:${or("sha256").update(d).digest("hex").slice(0,16)}`,keyParts:c,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:a.file,startLine:a.line,endLine:a.line}]},resolution:"unresolved"}),s.strength="candidate",s.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function sr(e){let t=[],n=H(e);for(let r of n){let i=M(e,r);if(!cr(i))continue;let a=N(e,r);a&&Ft(a.root,o=>{if(o.type!=="call_expression")return;let s=o.childForFieldName("function")??o.namedChild(0);if(!s||!/\.use$/u.test(s.text.replace(/\s+/gu,"")))return;let l=dr(o);if(l.length<2)return;let u=R(a,l[0]);if(!u||u.evidence==="expression")return;let c=lr(e,r,l[1]);c.length!==0&&t.push({file:r,line:o.startPosition.row,prefix:{value:u.value,evidence:u.evidence,term:u.term,derivation:u.derivation},targetFiles:c})})}return{mounts:t,filesInspected:n.length}}function lr(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let a=D(e,t).find(l=>l.localName===i&&l.sourcePath);if(!a?.sourcePath)return[t];if(a.kind==="namespace")return[a.sourcePath];let o=a.importedName==="default"?i:a.importedName,s=z(e,a.sourcePath,o);return[...new Set(s.map(l=>l.relativePath))]}function ur(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function cr(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function dr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Ft(e,t){t(e);for(let n of e.namedChildren)Ft(n,t)}import{createHash as pr}from"crypto";var De=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),mr=8;function $t(e,t){let n=new Map,r=[],i=[],a=new Set,o=[],s=[];for(let l of t){if(l.action!=="http.request"||!l.owner.symbol||l.evidence!=="call-expression"&&l.evidence!=="client-adapter")continue;let u=I(e,l.owner.file).find(p=>p.symbol===l.owner.symbol);if(!u)continue;let c=N(e,u.relativePath);if(!c)continue;let d=Pt(c,u),m={definition:u,...d,constantMethods:l.keyParts.flatMap(p=>p.name==="method"&&p.evidence!=="expression"&&De.has(p.value.toUpperCase())?[p.value.toUpperCase()]:[]),depth:0,proofObservationIds:[l.id],proofSpans:[l.source]};Bt(n,m)&&r.push(n.get(u.symbol))}for(;r.length>0;){let l=r.shift();if(!(l.depth>=mr))try{let u=Q(e,l.definition);s.push(...u.unresolved.map(c=>fr(l,c)));for(let c of u.sites){let d=N(e,c.file);if(!d)continue;a.add(c.file);let m=c.callNode,p=hr(l,m,d);p&&i.push(p);let f=c.caller;if(!f)continue;let y=Pt(d,f),h=gr(e,l,c),C={definition:f,pathParameterIndexes:ve([...y.pathParameterIndexes,...h.pathParameterIndexes]),methodParameterIndexes:ve([...y.methodParameterIndexes,...h.methodParameterIndexes]),constantMethods:X([...l.constantMethods,...y.constantMethods]),depth:l.depth+1,proofObservationIds:X([...l.proofObservationIds,...p?[p.id]:[]]),proofSpans:[...l.proofSpans,{file:c.file,startLine:c.startLine,endLine:c.endLine}]};Bt(n,C)&&r.push(n.get(f.symbol))}}catch(u){o.push(`builtin.http-summary failed for ${l.definition.relativePath}:${l.definition.startLine+1}: ${u instanceof Error?u.message:String(u)}`)}}return{observations:i,frontiers:yr(s),summaries:n.size,filesInspected:a.size,errors:o}}function fr(e,t){let n=X([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${pr("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:se(t.file)}}function yr(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function hr(e,t,n){let r=Rt(t),i=e.pathParameterIndexes.flatMap(d=>{let m=R(n,r[d]);return m&&m.evidence!=="expression"&&Sr(m.value)?[{index:d,value:m}]:[]}),a=e.methodParameterIndexes.flatMap(d=>{let m=R(n,r[d]),p=m?.value.toUpperCase();return m&&p&&m.evidence!=="expression"&&De.has(p)?[{index:d,value:{...m,value:p}}]:[]}),o=X([...e.constantMethods,...a.map(d=>d.value.value)]);if(i.length!==1||o.length!==1)return null;let s=i[0].value,l=a.find(d=>d.value.value===o[0])?.value,u=[{name:"method",value:o[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:o[0]},derivation:l?.derivation},{name:"path",value:s.value,evidence:"constant",term:s.term,derivation:s.derivation}],c=ye(n,t,"builtin.http-summary","http.request",u,"derived","compiler-resolved-http-summary");return c.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,c.source]},c}function Pt(e,t){let n=xr(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=br(n),i=new Set,a=new Set,o=new Set;return Me(n,s=>{if(s.type==="call_expression"&&((s.childForFieldName("function")??s.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let p=Rt(s);re(p[0],r,i);let f=vr(p[1],"method");if(f){re(f,r,a);let y=R(e,f),h=y?.value.toUpperCase();h&&y?.evidence!=="expression"&&De.has(h)&&o.add(h)}else re(p[1],r,a)}if(s.type!=="pair")return;let l=s.childForFieldName("key")??s.namedChild(0),u=s.childForFieldName("value")??s.namedChild(1),c=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(c==="url"||c==="path"||c==="endpoint")&&re(u,r,i),(c==="init"||c==="requestinit"||c==="options")&&re(u,r,a)}),{pathParameterIndexes:r.flatMap((s,l)=>s&&i.has(s)?[l]:[]),methodParameterIndexes:r.flatMap((s,l)=>s&&a.has(s)?[l]:[]),constantMethods:[...o].sort()}}function gr(e,t,n){let r=ee(e,n);return{pathParameterIndexes:te(r,t.pathParameterIndexes),methodParameterIndexes:te(r,t.methodParameterIndexes)}}function Bt(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=ve([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=ve([...n.methodParameterIndexes,...t.methodParameterIndexes]),a=X([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||a.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:a,depth:Math.min(n.depth,t.depth),proofObservationIds:X([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function vr(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function re(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function br(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Et)??[]}function Et(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Et(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function xr(e,t,n){let r=null;return Me(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Rt(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Sr(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function ve(e){return[...new Set(e)].sort((t,n)=>t-n)}function X(e){return[...new Set(e)].sort()}function Me(e,t){t(e);for(let n of e.namedChildren)Me(n,t)}import{createHash as Nr}from"crypto";function _t(e){let t=kt(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=kt(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?Ve(r).flatMap(i=>{let a=t.get(i)?.[0];return a?[Lt(r,a,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?Ve(r).flatMap(i=>{let a=n.get(i)?.[0];return a?[Lt(r,a,i,"queue.consume")]:[]}):[])}function kt(e){let t=new Map;for(let n of e)for(let r of Ve(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function Ve(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function Lt(e,t,n,r){let i=`database:${n}`,a=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",o=[e.id,r,i,a].join("\0");return{...e,id:`boundary:${Nr("sha256").update(o).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:a,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var ze="runtime-boundaries-v15",Se=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],Cr=64;function Ir(e,t={}){let n=H(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(Br)),a=t.previousGraph?.fileCoverage,o=i.size>0&&t.previousGraph?.extractorVersion===ze&&a!==void 0&&a.length===t.previousGraph.coverage.filesScanned,s=o?a.filter(g=>r.has(g.file)&&!i.has(g.file)):[],l=new Set(s.flatMap(g=>g.observationIds)),u=o?t.previousGraph.observations.filter(g=>l.has(g.id)&&r.has(g.source.file)):[],c=o?n.filter(g=>i.has(g)):n,d=[],m=a?.reduce((g,Ne)=>g+Ne.observationIds.length,0)??0,p=performance.now(),f=wr(e,c);U(d,"direct-extraction",p,c.length,f.observations.length,{filesVisited:c.length,filesReused:s.length,factsReused:u.length,factsInvalidated:Math.max(0,m-u.length)});let y=[...s,...f.fileCoverage].sort((g,Ne)=>g.file.localeCompare(Ne.file)),h=Pr(y),C=y.flatMap(g=>g.extractionErrors),P=ie([...u,...f.observations]),O=ie([...P,..._t(P)]);p=performance.now();let v=$t(e,O);U(d,"http-summary",p,O.length,v.observations.length,{filesVisited:v.filesInspected}),h.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:v.filesInspected,observations:v.observations.length,errors:v.errors.length}),C.push(...v.errors);let w=ie([...O,...v.observations]);p=performance.now();let L=wt(e,w);U(d,"http-mount",p,w.length,L.observations.length,{filesVisited:L.filesInspected});let A=ie([...w,...L.observations]);p=performance.now();let b=gt(e,A);U(d,"carrier",p,A.length,b.observations.length,{filesVisited:b.filesInspected}),h.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:b.bodySummaries,observations:b.observations.length,errors:b.errors.length}),C.push(...b.errors);let F=ie([...A,...b.observations]);p=performance.now();let x=$r(F);U(d,"relations",p,F.length,x.length),p=performance.now();let je=Rr(F,x);U(d,"links",p,x.length,je.length),kr(F,x),p=performance.now();let qe=Tr([...Lr(F,x),...v.frontiers]);return U(d,"frontiers",p,F.length,qe.length),{schemaVersion:2,extractorVersion:ze,observations:F,relationGroups:x,links:je,frontiers:qe,coverage:{filesScanned:n.length,filesWithAst:y.filter(g=>g.hasAst).length,filesWithoutAst:y.filter(g=>!g.hasAst).length,...o?{filesReused:s.length}:{},extractors:[...h.values()],extractionErrors:C,phases:d},fileCoverage:y}}function U(e,t,n,r,i,a={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...a})}function wr(e,t){let n=[],r=[];for(let i of t){let a=M(e,i),o=ke.filter(u=>u.supports(a)),s=o.length>0?N(e,i):null,l={file:i,hasAst:s!==null||Fr(i,a),observationIds:[],extractors:[],extractionErrors:[]};if(s)for(let u of o){let c={id:u.id,applicableFiles:1,observations:0,errors:0};try{let d=u.extract(s);c.observations=d.length,n.push(...d),l.observationIds.push(...d.map(m=>m.id))}catch(d){c.errors=1,l.extractionErrors.push(`${u.id} failed for ${i}: ${d instanceof Error?d.message:String(d)}`)}l.extractors.push(c)}r.push(l)}return{observations:n,fileCoverage:r}}function Fr(e,t){return t?He(e)?/<script\b/iu.test(t):Ue(e)!==null:!1}function Pr(e){let t=new Map(ke.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function Br(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function $r(e){let t=new Map;for(let n of Se){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let a=Or(i,n.keyNames);if(!a)continue;let o=a.map(d=>`${d.name}=${At(d.name,d.value)}`).join("\0"),s=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${s}\0${o}`,u=`boundary-group:${Tt("sha256").update(l).digest("hex").slice(0,16)}`,c=t.get(u)??{id:u,protocol:n.protocol,joinRule:n.id,normalizedKey:o,keyParts:a,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&c.producerIds.push(i.id),n.consumerActions.includes(i.action)&&c.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&c.declarationIds.push(i.id),c.derivation.inputFactIds.push(i.id),c.derivation.sourceSpans.push(i.source),t.set(u,c)}}return[...t.values()].map(Er).sort(Dr)}function Er(e){return{...e,producerIds:be(e.producerIds),consumerIds:be(e.consumerIds),declarationIds:be(e.declarationIds),derivation:{...e.derivation,inputFactIds:be(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function Rr(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let a=Se.find(s=>s.id===i.joinRule);if(!a?.traversable)continue;let o=a.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(o.length===0||i.consumerIds.length===0)&&!(a.requireUniquePair&&(o.length!==1||i.consumerIds.length!==1))&&!(a.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(o.length*i.consumerIds.length>Cr))for(let s of o)for(let l of i.consumerIds){let u=n.get(s),c=n.get(l);if(!u||!c||Ar(u,c))continue;let d=u.strength==="derived"||c.strength==="derived"?"derived":"exact",m=`${i.joinRule}\0${s}\0${l}`,p={id:`boundary-link:${Tt("sha256").update(m).digest("hex").slice(0,16)}`,from:s,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:d,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[s,l],sourceSpans:[u.source,c.source]}};r.set(p.id,p)}}return[...r.values()].sort(Mr)}function kr(e,t){let n=new Set(t.filter(Ot).flatMap(xe)),r=new Set(t.filter(_r).flatMap(xe));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function Lr(e,t){let n=new Set(e.filter(a=>a.strength!=="candidate").map(a=>`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)),r=new Set(t.flatMap(xe)),i=new Set(t.filter(Ot).flatMap(xe));return e.filter(a=>a.sourceScope==="production").filter(a=>a.strength!=="candidate"||!n.has(`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)).filter(a=>!i.has(a.id)).map(a=>{let o=a.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),s=o.length>0?`${a.extractor} observed ${a.action}, but ${o.join(", ")} remained symbolic or unknown.`:a.resolution==="ambiguous"?`${a.extractor} established the address for ${a.action}, but more than one indexed peer has the same runtime key.`:r.has(a.id)?`${a.extractor} established the address for ${a.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${a.extractor} observed ${a.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:a.id,reason:s,missingKeyParts:o,sourceScope:a.sourceScope}}).sort((a,o)=>a.observationId.localeCompare(o.observationId))}function xe(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function Ot(e){let t=Se.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function _r(e){let t=Se.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function Tr(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function Or(e,t){let n=[];for(let r of t){let i=e.keyParts.find(a=>a.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:At(r,i.value)})}return n}function At(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function Ar(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function ie(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function be(e){return[...new Set(e)].sort()}function Dr(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function Mr(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}export{se as a,R as b,Q as c,ee as d,ze as e,Ir as f,Mt as g,Vt as h,We as i};
49
- //# sourceMappingURL=chunk-FQKZWM4L.js.map
48
+ `)}function qt(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function le(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function Ut(e){try{return[JSON.parse(e)]}catch{return[]}}function Ye(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",ue))return null;let n=e.get(`SELECT schema_version, payload FROM ${ue} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}import{createHash as Ot}from"crypto";import{createHash as cn}from"crypto";var pe=8;function G(e,t,n){return Pe(Je(e,t,we(n),0,new Set))}function Fe(e,t,n){return Ce(e,t,n,0,new Set)}function Je(e,t,n,r,i){if(r>pe)return[];let a=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return a?Qe(e,t,a[1],a[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?et(e,t,n,r,i):[]}function Qe(e,t,n,r,i,a){let o=[];for(let s of Ce(e,t,n,i+1,new Set(a))){let l=Zt(s.initializer);for(let u of l.namedChildren){if(u.type==="pair"){let c=u.childForFieldName("key")??u.namedChild(0);if(Wt(c)!==r)continue;let d=u.childForFieldName("value")??u.namedChild(1);d&&o.push(...Je(e,s.definition.relativePath,we(d.text),i+1,new Set(a)));continue}if(/(?:method|function)/u.test(u.type)){if((u.childForFieldName("name")??u.namedChild(0))?.text!==r)continue;let d=Kt(e,s.definition.relativePath,r,u);o.push(...d.length>0?d:[Ht(s.definition,r,u)]);continue}if(u.type==="spread_element"){let c=u.namedChild(0);if(!c)continue;for(let d of Ce(e,s.definition.relativePath,we(c.text),i+1,new Set(a)))o.push(...Qe(e,d.definition.relativePath,d.definition.leaf,r,i+1,new Set(a)))}}}return Pe(o)}function Ht(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function Ce(e,t,n,r,i){return r>pe||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:et(e,t,n,r,i).flatMap(a=>{let o=B(e,a.relativePath)?.rootNode,s=o?Xt(o,a.leaf):null;return s?[{definition:a,initializer:s}]:[]})}function et(e,t,n,r,i){if(r>pe)return[];let a=`${t}\0${n}`;if(i.has(a))return[];i.add(a);let o=I(e,t).filter(u=>u.leaf===n);if(o.length>0)return o;let s=Gt(e,t,n);if(s.length>0)return s;let l=D(e,t).find(u=>u.localName===n&&u.sourcePath);if(l?.sourcePath){let u=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return Ie(e,l.sourcePath,u,r+1,new Set(i))}return Ie(e,t,n,r+1,new Set(i))}function Gt(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(ae(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function Ie(e,t,n,r,i){if(r>pe)return[];let a=I(e,t).filter(o=>o.leaf===n);return a.length>0?a:Pe(Xe(e,t).flatMap(o=>o.sourcePath?o.kind==="named"&&!o.names.includes(n)?[]:Ie(e,o.sourcePath,n,r+1,new Set(i)):[]))}function Kt(e,t,n,r){return I(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Xt(e,t){let n=null;return tt(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Zt(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function Wt(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function we(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Pe(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}function tt(e,t){t(e);for(let n of e.namedChildren)tt(n,t)}var Yt=8;function R(e,t){return t?K(e,t,0,new Set):null}function K(e,t,n,r){if(n>Yt)return _(t,"value-evaluation-depth");let i=rt(t),a=rn(i);if(a)return an(e.file,i,a.term,a.value,a.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(u=>K(e,u,n+1,new Set(r)));if(l.length>=2&&l.every(u=>u!==null)){let u={kind:"concat",parts:l.map(d=>d.term)},c=l.map(d=>d.value).join("");return on(e.file,i,u,c,l.some(d=>d.precision!=="literal")?"constrained-pattern":"literal",l)}}let o=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(o))return tn(e,o,i,n,r);let s=sn(i);return s?nn(e,s.base,s.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Jt(e,i,n,r):_(i,`unsupported-expression:${i.type}`)}function Jt(e,t,n,r){let a=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",o=Qt(e,a);if(o.length!==1)return _(t,o.length===0?"call-target-unresolved":"call-target-ambiguous");let s=o[0],l=`${s.relativePath}\0${s.symbol}`;if(r.has(l))return _(t,"call-return-cycle");let u=B(e.db,s.relativePath)?.rootNode;if(!u)return _(t,"call-target-unparsed");let c=un(u,s.startLine,s.endLine);if(!c)return _(t,"call-target-syntax-unavailable");let d=en(c);if(!d)return _(t,"call-return-not-single-expression");let m=new Set(r);m.add(l);let p=K({db:e.db,file:s.relativePath,root:u},d,n+1,m);return p?me(t,"bounded-call-return",p,s.symbol):_(t,"call-return-unresolved")}function Qt(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=I(e.db,e.file).filter(o=>o.isFunctionLike&&o.leaf===t);if(i.length>0)return i;let a=D(e.db,e.file).find(o=>o.localName===t&&o.sourcePath&&o.kind!=="namespace");return a?.sourcePath?z(e.db,a.sourcePath,a.importedName==="default"?t:a.importedName).filter(o=>o.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=D(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?z(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function en(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return nt(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function nt(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)nt(e,r,n)}}function tn(e,t,n,r,i){let a=`${e.file}\0${t}`;if(i.has(a))return _(n,"value-cycle");i.add(a);let o=Be(e.root,t);if(o){let f=K(e,o,r+1,i);return f?me(n,"local-constant",f):_(n,"non-foldable-local")}let s=D(e.db,e.file).find(f=>f.localName===t&&f.sourcePath);if(!s?.sourcePath)return E(n,t,"unresolved-identifier");if(s.kind==="namespace")return E(n,t,"namespace-import-requires-property");let l=s.importedName==="default"?t:s.importedName,u=z(e.db,s.sourcePath,l);if(u.length!==1)return E(n,t,u.length===0?"import-definition-missing":"import-definition-ambiguous");let c=u[0],d=B(e.db,c.relativePath)?.rootNode;if(!d)return E(n,c.symbol,"import-definition-unparsed");let m=Be(d,c.leaf);if(!m)return E(n,c.symbol,"import-definition-non-value");let p=K({db:e.db,file:c.relativePath,root:d},m,r+1,i);return p?me(n,"imported-constant",p,c.symbol):E(n,c.symbol,"import-value-unresolved")}function nn(e,t,n,r,i,a){let o=D(e.db,e.file).find(p=>p.localName===t&&p.sourcePath),s=e.file,l=t,u;if(o?.sourcePath){o.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=o.importedName==="default"?t:o.importedName;let p=z(e.db,o.sourcePath,l);if(p.length!==1)return E(r,`${t}.${n.join(".")}`,p.length===0?"member-definition-missing":"member-definition-ambiguous");s=p[0].relativePath,l=p[0].leaf,u=p[0].symbol}let c=s===e.file?e.root:B(e.db,s)?.rootNode;if(!c)return E(r,u??t,"member-definition-unparsed");let d=Be(c,l);if(!d)return E(r,u??t,"member-base-non-value");for(let p of n){let f=rt(d);if(d=ln(f,p),!d)return E(r,u??`${t}.${n.join(".")}`,`member-property-missing:${p}`)}let m=K({db:e.db,file:s,root:c},d,i+1,a);return m?me(r,"member-constant",m,u):E(r,u??t,"member-value-unresolved")}function rn(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],a=0,o=/\$\{([^}]*)\}/gu;for(let s of r.matchAll(o)){let l=s.index??0;l>a&&i.push({kind:"literal",value:r.slice(a,l)}),i.push({kind:"unknown",reason:`template-hole:${s[1]?.trim()||"expression"}`}),a=l+s[0].length}return a<r.length&&i.push({kind:"literal",value:r.slice(a)}),{term:{kind:"pattern",language:"template",value:r.replace(o,"{}")},value:r.replace(o,"{}"),precision:"constrained-pattern"}}function an(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:fe("direct-literal","direct",e,t)}}function on(e,t,n,r,i,a){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...fe("constant-concatenation","mechanically-derived",e,t),inputFactIds:a.flatMap(o=>o.derivation.inputFactIds),sourceSpans:a.flatMap(o=>o.derivation.sourceSpans)}}}function me(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function E(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:fe(n,"heuristic","",e)}}function _(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:fe(t,"heuristic","",e)}}function fe(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function sn(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}function Be(e,t){let n=null;return $e(e,r=>{if(n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t)return;let a=r.parent;!a||a.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(a.text)||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function ln(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function rt(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function un(e,t,n){let r=null;return $e(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function $e(e,t){t(e);for(let n of e.namedChildren)$e(n,t)}var st=new Set(["delete","get","head","options","patch","post","put"]),dn=/(?:^|\.)(?:app|router|server)$/u,pn=new Set(["findFirst","findMany","findUnique","from","get","select"]),mn=new Set(["create","delete","insert","remove","update","upsert"]),fn=new Set(["execute","query","raw"]),ke=[vn(),gn(),yn(),bn(),Sn(),Nn(),In()],Re=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function yn(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=hn(e.source),n=[];return k(e.root,r=>{if(r.type!=="call_expression")return;let i=J(r);if(!i)return;let a=t.direct.get(i),o=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),s=o&&t.namespaces.has(o[1])?o[2]:null,l=a??s;if(!l||!Re.has(l))return;let u=q(r),c=$(u[0],e)??{value:u[0]?.text.trim()||"<missing>",evidence:"expression"},d=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(S(e,r,"builtin.node-child-process",d,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...c}],"exact","node-child-process-import"))}),n}}}function hn(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let l of e.matchAll(i))for(let u of(l[1]??"").split(",")){let c=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(u);c&&Re.has(c[1])&&t.set(c[2]??c[1],c[1])}let a=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(a))for(let u of(l[1]??"").split(",")){let c=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(u);c&&Re.has(c[1])&&t.set(c[2]??c[1],c[1])}let o=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(o))n.add(l[1]);let s=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(s))n.add(l[1]);return{direct:t,namespaces:n}}function N(e,t){let n=B(e,t)?.rootNode;if(!n)return null;let r=M(e,t),i=I(e,t),a=ae(e,t)?.callables??[];return{db:e,file:t,source:r,root:n,constants:En(n),ownerAt:o=>{let s=i.filter(u=>u.startLine<=o&&u.endLine>=o).sort((u,c)=>u.endLine-u.startLine-(c.endLine-c.startLine)||u.startLine-c.startLine)[0];if(s)return{file:t,symbol:s.symbol,name:s.leaf,startLine:s.startLine,endLine:s.endLine};let l=a.filter(u=>u.startLine<=o&&u.endLine>=o).sort((u,c)=>u.endLine-u.startLine-(c.endLine-c.startLine)||u.startLine-c.startLine)[0];return{file:t,symbol:null,name:l?.name??null,startLine:l?.startLine??o,endLine:l?.endLine??o}}}}function gn(){return{id:"builtin.effect-httpapi",supports:e=>W(e,"HttpApiEndpoint").size>0||W(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=W(e.source,"HttpApiEndpoint"),r=W(e.source,"HttpApiGroup"),i=W(e.source,"HttpApiBuilder");return k(e.root,a=>{if(a.type!=="call_expression")return;let o=lt(a);if(!o)return;let s=q(a);if(n.has(o.receiver)&&st.has(o.member)){let y=$(s[0],e),h=$(s[1],e),C=at(a,r,"make",0,e);if(!y||!h||!C)return;let P=o.member.toUpperCase();t.push(S(e,a,"builtin.effect-httpapi","http.handle",[{name:"method",value:P,evidence:"literal"},{name:"path",...h}],T([{name:"path",...h}]),"effect-httpapi-endpoint-declaration")),t.push(S(e,a,"builtin.effect-httpapi","framework.declare",Ee(C,y),T(Ee(C,y)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(o.member))return;let l=at(a,i,"group",1,e),u=$(s[0],e),c=s[1];if(!l||!u||!c)return;let d=Ee(l,u),m=G(e.db,e.file,c.text),p=S(e,a,"builtin.effect-httpapi","framework.handle",d,m.length===1?T(d):"candidate","effect-httpapi-handler-registration"),f=m[0];m.length===1&&f&&(p.owner={file:f.relativePath,symbol:f.symbol,name:f.leaf,startLine:f.startLine,endLine:f.endLine}),t.push(p)}),t}}}function Ee(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function W(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(r)){let o=a[2]??"";if(it(o))for(let s of(a[1]??"").split(",")){let l=s.trim().replace(/^type\s+/u,""),u=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(l);u?.[1]===t&&n.add(u[2]??u[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(i)){let o=a[2]??"";o.endsWith(`/${t}`)&&it(o)&&n.add(a[1])}return n}function it(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function at(e,t,n,r,i){let a=e.parent;for(;a;){if(a.type==="call_expression"){let o=ot(a,t,n,r,i);if(o)return o;let s=a.childForFieldName("function")??a.namedChild(0),l=null;if(s&&k(s,u=>{!l&&u.type==="call_expression"&&(l=ot(u,t,n,r,i))}),l)return l}a=a.parent}return null}function ot(e,t,n,r,i){let a=lt(e);return!a||a.member!==n||!t.has(a.receiver)?null:$(q(e)[r],i)}function lt(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function vn(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||Y(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return k(e.root,n=>{if(n.type==="decorator"){let m=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!m||!Y(e.source,["fastapi","flask"]))return;t.push(S(e,n,"builtin.http","http.handle",[{name:"method",value:m[1].toUpperCase(),evidence:"literal"},{name:"path",value:m[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=J(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",a=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",o=q(n);if(i==="route"&&Y(e.source,["axum"])){let m=$(o[0],e),p=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(o[1]?.text??"")?.[1];if(!m||!p)return;t.push(S(e,n,"builtin.http","http.handle",[{name:"method",value:p.toUpperCase(),evidence:"literal"},{name:"path",...m}],T([{name:"path",...m}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let m=$(o[0],e);if(!m)return;let f=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(o[1]?.text??"")?.[1]?.toUpperCase()??(o[1]?null:"GET"),y=[...f?[{name:"method",value:f,evidence:"literal"}]:[],{name:"path",...m}];t.push(S(e,n,"builtin.http","http.request",y,f?T(y):"candidate","call-expression"));return}if(!st.has(i))return;let s=$(o[0],e);if(!s)return;let l=i.toUpperCase();if(dn.test(a)&&Y(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(S(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],T([{name:"path",...s}]),"framework-adapter"));return}let c=Pn(e.source,["axios"]),d=a.split(".")[0]??"";c.has(d)&&t.push(S(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],T([{name:"path",...s}]),"client-adapter"))}),t}}}function bn(){return{id:"builtin.capability-registry",supports:e=>/\b(?:execute|handler|invoke|run)\s*(?:[:(])/u.test(e)||/['"`][^'"`\n]{0,256}\b[A-Za-z_$][\w$-]*\s*\(/u.test(e),extract:e=>{let t=[],n=new Set;return k(e.root,r=>{if(r.type==="pair"){let a=r.childForFieldName("key")??r.namedChild(0),o=r.childForFieldName("value")??r.namedChild(1),s=a?.text.replace(/^['"`]|['"`]$/gu,"");if(s!=="name"&&s!=="id")return;let l=ut(o,e),u=kn(r);if(!l||l.evidence!=="literal"||!u)return;let c=`handle\0${l.value}\0${u.startPosition.row}`;if(n.has(c))return;n.add(c),t.push(S(e,u,"builtin.capability-registry","registry.handle",[{name:"key",...l}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(r.type))return;let i=r.text.replace(/^['"`]|['"`]$/gu,"");for(let a of i.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let o=a[1];if(!xn(i,o,a.index))continue;let s=`reference\0${o}\0${r.startPosition.row}`;n.has(s)||(n.add(s),t.push(S(e,r,"builtin.capability-registry","registry.reference",[{name:"key",value:o,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function xn(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function Sn(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return k(e.root,n=>{if(n.type==="pair"){let a=Rn(n);if(!a)return;let o=n.childForFieldName("key")??n.namedChild(0),s=n.childForFieldName("value")??n.namedChild(1),l=ut(o,e);if(!l||!s||!ct(s))return;let u=Le(s)?"exact":"candidate";t.push(S(e,n,"builtin.registry","registry.handle",[{name:"registry",value:a,evidence:"identifier"},{name:"key",...l}],T([{name:"key",...l}],u),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(S(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function Nn(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=_n(e.root);return k(e.root,r=>{if(r.type!=="call_expression")return;let i=J(r);if(!i)return;let a=i.split("."),o=a.at(-1)??"",s=q(r),l=s[0]?.text??"",u=Ln(o,l);if(!u)return;let c=dt(a,n);if(!c)return;let d=Cn(s[0],e)??Tn(l),m=On(c,a,o,d);if(!m)return;let p=o==="insert"?"persistence-insert":u==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(l)?"persistence-skip-locked-claim":"persistence-adapter";t.push(S(e,r,"builtin.persistence",u,[{name:"resource",...m}],T([{name:"resource",...m}]),p))}),t}}}function Cn(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:$(e,t)}function In(){return{id:"builtin.queue",supports:e=>Y(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return k(e.root,n=>{if(n.type!=="call_expression")return;let r=J(n);if(!r)return;let i=r.split(".").at(-1)??"",a=q(n),o=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!o)return;let s=i==="send"||i==="subscribe"?Bn(a[0],"topic",e):$(a[0],e);s&&t.push(S(e,n,"builtin.queue",o,[{name:"address",...s}],T([{name:"address",...s}]),"framework-adapter"))}),t}}}function S(e,t,n,r,i,a,o){let s=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${cn("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:s,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:o,strength:a,protocol:r.split(".")[0]??r,role:wn(r),executionDomain:Fn(e.file),derivation:{kind:a==="candidate"?"heuristic":a==="derived"?"mechanically-derived":"direct",rule:o,ruleVersion:"1",inputFactIds:i.flatMap(u=>u.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(u=>u.derivation?.sourceSpans??[])]},valuePrecision:i.some(u=>u.evidence==="expression")?"unknown":i.some(u=>u.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:se(e.file)}}function wn(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function Fn(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function Y(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function Pn(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),a=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let o of e.matchAll(a)){let s=o[1]??o[2];s&&n.add(s)}}return n}function ye(e,t,n,r,i,a,o){return S(e,t,n,r,i,a,o)}function J(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function q(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function $(e,t){let n=R(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function Bn(e,t,n){if(!e)return null;let r=e.namedChildren.find(a=>a.type!=="pair"?!1:(a.childForFieldName("key")??a.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return $(i,n)}function ut(e,t){if(!e)return null;let n=$(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function T(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function $n(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function En(e){let t=new Map;return k(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let a=$n(i);a!==null&&t.set(r.text,a)}),t}function Rn(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function Le(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function ct(e){return Le(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function kn(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),a=n.childForFieldName("value")??n.namedChild(1),o=i?.text.replace(/^['"`]|['"`]$/gu,"");if(o&&["execute","handler","invoke","run"].includes(o)&&a&&ct(a))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function dt(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function Ln(e,t){if(pn.has(e))return"database.read";if(mn.has(e))return"database.write";if(!fn.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function _n(e){let t=new Set;return k(e,n=>{if(n.type!=="call_expression")return;let r=J(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!dt(i)))for(let a of q(n)){if(!Le(a))continue;let s=(a.childForFieldName("parameters")??a.namedChildren.find(u=>/parameters/u.test(u.type)))?.namedChildren[0],l=s?pt(s):null;l&&t.add(l)}}),t}function pt(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?pt(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Tn(e){let t=mt(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function On(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let a=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return a?{value:a,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=mt(r.value);return i?{value:i,evidence:r.evidence}:null}function mt(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function k(e,t){t(e);for(let n of e.namedChildren)k(n,t)}var An=Z("resolved-call-syntax",{clearGroups:[]}),Dn=Z("resolved-call-sites",{clearGroups:[]});function Q(e,t){return Dn.get(e,t.symbolId,()=>Mn(e,t))}function Mn(e,t){let n=[],r=[],i=new Set,a=new Set;for(let o of We(e,t,{semantic:!1})){i.add(o.file);let s=An.get(e,o.file,()=>Vn(e,o.file));if(!s){r.push({callee:t,file:o.file,line:o.line,reason:"ast-unavailable",candidates:0,referenceProvenance:o.provenance});continue}let l=(s.byLeaf.get(t.leaf)??[]).filter(({callNode:d})=>d.startPosition.row<=o.line&&d.endPosition.row>=o.line);if(l.length!==1){r.push({callee:t,file:o.file,line:o.line,reason:l.length===0?"call-not-found":"ambiguous-call",candidates:l.length,referenceProvenance:o.provenance});continue}let u=l[0],c=`${o.file}\0${u.callNode.startIndex}\0${u.callNode.endIndex}`;a.has(c)||(a.add(c),n.push({callee:t,caller:oe(I(e,o.file),u.callNode.startPosition.row),file:o.file,line:o.line,startLine:u.callNode.startPosition.row,endLine:u.callNode.endPosition.row,targetText:u.targetNode.text,callNode:u.callNode,targetNode:u.targetNode,arguments:u.arguments,referenceProvenance:o.provenance}))}return{sites:n,unresolved:r,filesVisited:i.size}}function Vn(e,t){let n=B(e,t)?.rootNode;if(!n)return null;let r=new Map;return ft(n,i=>{if(i.type!=="call_expression"&&i.type!=="call")return;let a=i.childForFieldName("function")??i.namedChild(0);if(!a)return;let o=Ke(a);if(!o)return;let s=i.childForFieldName("arguments")??i.namedChildren.find(c=>c.type==="arguments"),l={callNode:i,targetNode:a,arguments:s?.namedChildren??[]},u=r.get(o);u?u.push(l):r.set(o,[l])}),{byLeaf:r}}function ft(e,t){t(e);for(let n of e.namedChildren)ft(n,t)}var zn=Z("call-parameter-value-flow",{clearGroups:[]});function ee(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return zn.get(e,n,()=>jn(e,t))}function te(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function jn(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-unavailable",proof:n}))};let r=B(e,t.caller.relativePath)?.rootNode,i=r?qn(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let a=Un(i),o=[],s=[];return t.arguments.forEach((l,u)=>{let c=l.text.trim(),d=a.indexOf(c);d>=0?o.push({calleePosition:u,callerPosition:d,argumentText:c,proof:n}):s.push({calleePosition:u,argumentText:c,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:o,unknown:s}}function qn(e,t,n){let r=null;return ht(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Un(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(yt)??[]}function yt(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?yt(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function ht(e,t){t(e);for(let n of e.namedChildren)ht(n,t)}var Hn=8,Gn=8;function vt(e,t){let n=[],r=Kn(e,n),i=r.summaries,a=Xn(e,t,i,n),o=Zn(e,t,n);return{observations:or([...a.observations,...o]),bodySummaries:i.size,discriminatorSummaries:a.summaries,filesInspected:r.filesInspected,errors:n}}function Kn(e,t){let n=new Map,r=[],i=H(e);for(let a of i){let o=M(e,a);if(!/\bJSON\.stringify\s*\(/u.test(o)||!/\bbody\s*:/u.test(o))continue;let s=N(e,a);if(s)for(let[l,u]of Wn(s)){let c={definition:l,parameterIndexes:u,depth:0,proofSpans:[{file:a,startLine:l.startLine,endLine:l.endLine}]};n.set(l.symbol,c),r.push(c)}}for(;r.length>0;){let a=r.shift();if(!(a.depth>=Hn))try{for(let o of Q(e,a.definition).sites){if(!N(e,o.file))continue;let l=o.caller;if(!l)continue;let u=te(ee(e,o),a.parameterIndexes);if(u.length===0)continue;let c={definition:l,parameterIndexes:wt(u),depth:a.depth+1,proofSpans:[...a.proofSpans,{file:o.file,startLine:o.startLine,endLine:o.endLine}]};er(n,c)&&r.push(n.get(l.symbol))}}catch(o){t.push(`builtin.carrier body summary failed for ${a.definition.relativePath}: ${Ae(o)}`)}}return{summaries:n,filesInspected:i.length}}function Xn(e,t,n,r){let i=new Map,a=[],o=[];for(let s of t){if(s.action!=="http.request"||s.strength==="candidate"||s.sourceScope!=="production")continue;let l=bt(s);if(!l)continue;let u=N(e,s.source.file);if(!u)continue;let c=Nt(u.root,s.source.startLine),d=c.find(P=>P.startPosition.row===s.source.startLine)??c[0];if(!d)continue;let m=Oe(d);if(!m)continue;let p=G(e,s.source.file,m.text);if(p.length!==1)continue;let f=n.get(p[0].symbol);if(!f)continue;let y=s.owner.symbol?I(e,s.owner.file).find(P=>P.symbol===s.owner.symbol):null;if(!y)continue;let h=tr(u,y),C=ge(d);for(let P of f.parameterIndexes){let O=rr(u,C[P]);if(O)for(let v of ir(O)){let w=Ct(v),L=It(v);if(!w||!L)continue;let A=h.indexOf(L.text.trim());if(A>=0){let F={definition:y,carrier:l,field:w,parameterIndex:A,depth:0,proofObservationIds:[s.id],proofSpans:[s.source,{file:s.source.file,startLine:v.startPosition.row,endLine:v.endPosition.row}]},x=gt(F);i.has(x)||(i.set(x,F),a.push(F));continue}let b=R(u,L);!b||b.evidence==="expression"||o.push(Te(u,v,"carrier.publish",l,w,b.value,[s.id]))}}}for(;a.length>0;){let s=a.shift();if(!(s.depth>=Gn))try{for(let l of Q(e,s.definition).sites){let u=N(e,l.file);if(!u)continue;let c=l.callNode,d=ge(c)[s.parameterIndex];if(!d)continue;let m=R(u,d);m&&m.evidence!=="expression"&&o.push(Te(u,c,"carrier.publish",s.carrier,s.field,m.value,s.proofObservationIds));let p=l.caller;if(!p)continue;let f=ee(e,l).transfers.find(C=>C.calleePosition===s.parameterIndex)?.callerPosition;if(f===void 0)continue;let y={...s,definition:p,parameterIndex:f,depth:s.depth+1,proofSpans:[...s.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},h=gt(y);i.has(h)||(i.set(h,y),a.push(y))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${s.definition.relativePath}: ${Ae(l)}`)}}return{observations:o,summaries:i.size}}function Zn(e,t,n){let r=[],i=t.filter(a=>a.action==="registry.handle"&&a.strength!=="candidate"&&a.sourceScope==="production");for(let a of t){if(a.action!=="http.handle"||a.strength==="candidate"||a.sourceScope!=="production")continue;let o=bt(a);if(!o)continue;let s=N(e,a.source.file);if(!s)continue;let l=Nt(s.root,a.source.startLine)[0];if(l)for(let u of ge(l).slice(1)){let c=G(e,a.source.file,u.text);for(let d of c)try{let m=N(e,d.relativePath);if(!m)continue;let p=he(m.root,d.startLine,d.endLine);if(!p)continue;V(p,f=>{if(f.type!=="call_expression")return;let y=Oe(f);if(!y)return;let h=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(y.text.trim());if(!h)return;let C=h[1],P=h[2],O=Jn(e,m,d,P);if(!O)return;let v=Qn(e,d.relativePath,C);for(let w of i){let L=w.keyParts.find(x=>x.name==="registry")?.value,A=w.keyParts.find(x=>x.name==="key")?.value;if(!L||!A||!v.some(x=>x.file===w.source.file&&x.binding===L))continue;let b=N(e,w.source.file),F=b?nr(b.root,w.source.startLine):null;!b||!F||r.push(Te(b,F,"carrier.consume",o,O,A,[a.id,w.id]))}})}catch(m){n.push(`builtin.carrier consumer analysis failed for ${d.relativePath}: ${Ae(m)}`)}}}return r}function Wn(e){let t=I(e.db,e.file),n=new Map;return V(e.root,r=>{if(r.type!=="pair"||Ct(r)?.toLowerCase()!=="body")return;let i=It(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let a=oe(t,r.startPosition.row),o=Yn(r);if(!a||!o)return;let s=xt(o),l=new Set;ar(i,s,l);let u=n.get(a.symbol)??new Set;s.forEach((c,d)=>{c&&l.has(c)&&u.add(d)}),u.size>0&&n.set(a.symbol,u)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[[r,[...i].sort((a,o)=>a-o)]]:[]})}function Yn(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function Jn(e,t,n,r){let i=he(t.root,n.startLine,n.endLine);if(!i)return null;let a=new RegExp(`\\.body\\??\\.${_e(r)}\\b`,"u");if(a.test(i.text))return r;let o=null;if(V(i,c=>{if(o||c.type!=="variable_declarator")return;let d=c.childForFieldName("name")??c.namedChild(0),m=c.childForFieldName("value")??c.namedChild(1);!d||!m||!new RegExp(`(?:^|[,{}])\\s*${_e(r)}\\s*(?:[,}]|$)`,"u").test(d.text)||m.type==="call_expression"&&(o=Oe(m)?.text??null)}),!o)return null;let s=G(e,n.relativePath,o);if(s.length!==1)return null;let l=N(e,s[0].relativePath),u=l?he(l.root,s[0].startLine,s[0].endLine):null;return u&&a.test(u.text)&&new RegExp(`\\b${_e(r)}\\s*[,}]`,"u").test(u.text)?r:null}function Qn(e,t,n){let r=[];for(let i of Fe(e,t,n)){let a=ne(i.initializer);if(a.type==="call_expression")for(let o of ge(a)){let s=o.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))for(let l of Fe(e,i.definition.relativePath,s))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Te(e,t,n,r,i,a,o){let l=ye(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:a,evidence:"constant",term:{kind:"literal",value:a}}],"derived","http-body-registry-discriminator");return l.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...o],sourceSpans:[l.source]},l}function bt(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function er(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=wt([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function gt(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function tr(e,t){let n=he(e.root,t.startLine,t.endLine);return n?xt(n):[]}function xt(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(St)??[]}function St(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?St(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function he(e,t,n){let r=null;return V(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function nr(e,t){let n=null;return V(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function Nt(e,t){let n=[];return V(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function Oe(e){return e.childForFieldName("function")??e.namedChild(0)}function ge(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function rr(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return ne(t);let r=null;return V(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),ne(r||t)}function ir(e){let t=ne(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function Ct(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function It(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function ne(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function ar(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function wt(e){return[...new Set(e)].sort((t,n)=>t-n)}function or(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function Ae(e){return e instanceof Error?e.message:String(e)}function V(e,t){t(e);for(let n of e.namedChildren)V(n,t)}import{createHash as sr}from"crypto";function Ft(e,t){let n=new Map;for(let a of t){if(a.action!=="http.handle"||a.sourceScope!=="production")continue;let o=n.get(a.source.file)??[];o.push(a),n.set(a.source.file,o)}let r=[],i=lr(e);for(let a of i.mounts)for(let o of a.targetFiles)for(let s of n.get(o)??[]){let l=s.keyParts.find(m=>m.name==="path");if(!l||l.evidence==="expression")continue;let u=cr(a.prefix.value,l.value),c=s.keyParts.map(m=>m.name==="path"?{name:"path",value:u,evidence:"constant",term:{kind:"concat",parts:[a.prefix.term??{kind:"literal",value:a.prefix.value},l.term??{kind:"literal",value:l.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:a.file,startLine:a.line,endLine:a.line},...a.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:m),d=`${s.id}\0${a.file}\0${a.line}\0${u}`;r.push({...s,id:`boundary:${sr("sha256").update(d).digest("hex").slice(0,16)}`,keyParts:c,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:a.file,startLine:a.line,endLine:a.line}]},resolution:"unresolved"}),s.strength="candidate",s.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function lr(e){let t=[],n=H(e);for(let r of n){let i=M(e,r);if(!dr(i))continue;let a=N(e,r);a&&Pt(a.root,o=>{if(o.type!=="call_expression")return;let s=o.childForFieldName("function")??o.namedChild(0);if(!s||!/\.use$/u.test(s.text.replace(/\s+/gu,"")))return;let l=pr(o);if(l.length<2)return;let u=R(a,l[0]);if(!u||u.evidence==="expression")return;let c=ur(e,r,l[1]);c.length!==0&&t.push({file:r,line:o.startPosition.row,prefix:{value:u.value,evidence:u.evidence,term:u.term,derivation:u.derivation},targetFiles:c})})}return{mounts:t,filesInspected:n.length}}function ur(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let a=D(e,t).find(l=>l.localName===i&&l.sourcePath);if(!a?.sourcePath)return[t];if(a.kind==="namespace")return[a.sourcePath];let o=a.importedName==="default"?i:a.importedName,s=z(e,a.sourcePath,o);return[...new Set(s.map(l=>l.relativePath))]}function cr(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function dr(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function pr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Pt(e,t){t(e);for(let n of e.namedChildren)Pt(n,t)}import{createHash as mr}from"crypto";var De=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),fr=8;function Et(e,t){let n=new Map,r=[],i=[],a=new Set,o=[],s=[];for(let l of t){if(l.action!=="http.request"||!l.owner.symbol||l.evidence!=="call-expression"&&l.evidence!=="client-adapter")continue;let u=I(e,l.owner.file).find(p=>p.symbol===l.owner.symbol);if(!u)continue;let c=N(e,u.relativePath);if(!c)continue;let d=Bt(c,u),m={definition:u,...d,constantMethods:l.keyParts.flatMap(p=>p.name==="method"&&p.evidence!=="expression"&&De.has(p.value.toUpperCase())?[p.value.toUpperCase()]:[]),depth:0,proofObservationIds:[l.id],proofSpans:[l.source]};$t(n,m)&&r.push(n.get(u.symbol))}for(;r.length>0;){let l=r.shift();if(!(l.depth>=fr))try{let u=Q(e,l.definition);s.push(...u.unresolved.map(c=>yr(l,c)));for(let c of u.sites){let d=N(e,c.file);if(!d)continue;a.add(c.file);let m=c.callNode,p=gr(l,m,d);p&&i.push(p);let f=c.caller;if(!f)continue;let y=Bt(d,f),h=vr(e,l,c),C={definition:f,pathParameterIndexes:ve([...y.pathParameterIndexes,...h.pathParameterIndexes]),methodParameterIndexes:ve([...y.methodParameterIndexes,...h.methodParameterIndexes]),constantMethods:X([...l.constantMethods,...y.constantMethods]),depth:l.depth+1,proofObservationIds:X([...l.proofObservationIds,...p?[p.id]:[]]),proofSpans:[...l.proofSpans,{file:c.file,startLine:c.startLine,endLine:c.endLine}]};$t(n,C)&&r.push(n.get(f.symbol))}}catch(u){o.push(`builtin.http-summary failed for ${l.definition.relativePath}:${l.definition.startLine+1}: ${u instanceof Error?u.message:String(u)}`)}}return{observations:i,frontiers:hr(s),summaries:n.size,filesInspected:a.size,errors:o}}function yr(e,t){let n=X([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${mr("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:se(t.file)}}function hr(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function gr(e,t,n){let r=kt(t),i=e.pathParameterIndexes.flatMap(d=>{let m=R(n,r[d]);return m&&m.evidence!=="expression"&&Nr(m.value)?[{index:d,value:m}]:[]}),a=e.methodParameterIndexes.flatMap(d=>{let m=R(n,r[d]),p=m?.value.toUpperCase();return m&&p&&m.evidence!=="expression"&&De.has(p)?[{index:d,value:{...m,value:p}}]:[]}),o=X([...e.constantMethods,...a.map(d=>d.value.value)]);if(i.length!==1||o.length!==1)return null;let s=i[0].value,l=a.find(d=>d.value.value===o[0])?.value,u=[{name:"method",value:o[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:o[0]},derivation:l?.derivation},{name:"path",value:s.value,evidence:"constant",term:s.term,derivation:s.derivation}],c=ye(n,t,"builtin.http-summary","http.request",u,"derived","compiler-resolved-http-summary");return c.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,c.source]},c}function Bt(e,t){let n=Sr(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=xr(n),i=new Set,a=new Set,o=new Set;return Me(n,s=>{if(s.type==="call_expression"&&((s.childForFieldName("function")??s.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let p=kt(s);re(p[0],r,i);let f=br(p[1],"method");if(f){re(f,r,a);let y=R(e,f),h=y?.value.toUpperCase();h&&y?.evidence!=="expression"&&De.has(h)&&o.add(h)}else re(p[1],r,a)}if(s.type!=="pair")return;let l=s.childForFieldName("key")??s.namedChild(0),u=s.childForFieldName("value")??s.namedChild(1),c=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(c==="url"||c==="path"||c==="endpoint")&&re(u,r,i),(c==="init"||c==="requestinit"||c==="options")&&re(u,r,a)}),{pathParameterIndexes:r.flatMap((s,l)=>s&&i.has(s)?[l]:[]),methodParameterIndexes:r.flatMap((s,l)=>s&&a.has(s)?[l]:[]),constantMethods:[...o].sort()}}function vr(e,t,n){let r=ee(e,n);return{pathParameterIndexes:te(r,t.pathParameterIndexes),methodParameterIndexes:te(r,t.methodParameterIndexes)}}function $t(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=ve([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=ve([...n.methodParameterIndexes,...t.methodParameterIndexes]),a=X([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||a.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:a,depth:Math.min(n.depth,t.depth),proofObservationIds:X([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function br(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function re(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function xr(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Rt)??[]}function Rt(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Rt(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Sr(e,t,n){let r=null;return Me(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function kt(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Nr(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function ve(e){return[...new Set(e)].sort((t,n)=>t-n)}function X(e){return[...new Set(e)].sort()}function Me(e,t){t(e);for(let n of e.namedChildren)Me(n,t)}import{createHash as Cr}from"crypto";function Tt(e){let t=Lt(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=Lt(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?Ve(r).flatMap(i=>{let a=t.get(i)?.[0];return a?[_t(r,a,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?Ve(r).flatMap(i=>{let a=n.get(i)?.[0];return a?[_t(r,a,i,"queue.consume")]:[]}):[])}function Lt(e){let t=new Map;for(let n of e)for(let r of Ve(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function Ve(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function _t(e,t,n,r){let i=`database:${n}`,a=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",o=[e.id,r,i,a].join("\0");return{...e,id:`boundary:${Cr("sha256").update(o).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:a,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var ze="runtime-boundaries-v15",Se=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],Ir=64;function wr(e,t={}){let n=H(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map($r)),a=t.previousGraph?.fileCoverage,o=i.size>0&&t.previousGraph?.extractorVersion===ze&&a!==void 0&&a.length===t.previousGraph.coverage.filesScanned,s=o?a.filter(g=>r.has(g.file)&&!i.has(g.file)):[],l=new Set(s.flatMap(g=>g.observationIds)),u=o?t.previousGraph.observations.filter(g=>l.has(g.id)&&r.has(g.source.file)):[],c=o?n.filter(g=>i.has(g)):n,d=[],m=a?.reduce((g,Ne)=>g+Ne.observationIds.length,0)??0,p=performance.now(),f=Fr(e,c);U(d,"direct-extraction",p,c.length,f.observations.length,{filesVisited:c.length,filesReused:s.length,factsReused:u.length,factsInvalidated:Math.max(0,m-u.length)});let y=[...s,...f.fileCoverage].sort((g,Ne)=>g.file.localeCompare(Ne.file)),h=Br(y),C=y.flatMap(g=>g.extractionErrors),P=ie([...u,...f.observations]),O=ie([...P,...Tt(P)]);p=performance.now();let v=Et(e,O);U(d,"http-summary",p,O.length,v.observations.length,{filesVisited:v.filesInspected}),h.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:v.filesInspected,observations:v.observations.length,errors:v.errors.length}),C.push(...v.errors);let w=ie([...O,...v.observations]);p=performance.now();let L=Ft(e,w);U(d,"http-mount",p,w.length,L.observations.length,{filesVisited:L.filesInspected});let A=ie([...w,...L.observations]);p=performance.now();let b=vt(e,A);U(d,"carrier",p,A.length,b.observations.length,{filesVisited:b.filesInspected}),h.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:b.bodySummaries,observations:b.observations.length,errors:b.errors.length}),C.push(...b.errors);let F=ie([...A,...b.observations]);p=performance.now();let x=Er(F);U(d,"relations",p,F.length,x.length),p=performance.now();let je=kr(F,x);U(d,"links",p,x.length,je.length),Lr(F,x),p=performance.now();let qe=Or([..._r(F,x),...v.frontiers]);return U(d,"frontiers",p,F.length,qe.length),{schemaVersion:2,extractorVersion:ze,observations:F,relationGroups:x,links:je,frontiers:qe,coverage:{filesScanned:n.length,filesWithAst:y.filter(g=>g.hasAst).length,filesWithoutAst:y.filter(g=>!g.hasAst).length,...o?{filesReused:s.length}:{},extractors:[...h.values()],extractionErrors:C,phases:d},fileCoverage:y}}function U(e,t,n,r,i,a={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...a})}function Fr(e,t){let n=[],r=[];for(let i of t){let a=M(e,i),o=ke.filter(u=>u.supports(a)),s=o.length>0?N(e,i):null,l={file:i,hasAst:s!==null||Pr(i,a),observationIds:[],extractors:[],extractionErrors:[]};if(s)for(let u of o){let c={id:u.id,applicableFiles:1,observations:0,errors:0};try{let d=u.extract(s);c.observations=d.length,n.push(...d),l.observationIds.push(...d.map(m=>m.id))}catch(d){c.errors=1,l.extractionErrors.push(`${u.id} failed for ${i}: ${d instanceof Error?d.message:String(d)}`)}l.extractors.push(c)}r.push(l)}return{observations:n,fileCoverage:r}}function Pr(e,t){return t?Ge(e)?/<script\b/iu.test(t):He(e)!==null:!1}function Br(e){let t=new Map(ke.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function $r(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function Er(e){let t=new Map;for(let n of Se){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let a=Ar(i,n.keyNames);if(!a)continue;let o=a.map(d=>`${d.name}=${Dt(d.name,d.value)}`).join("\0"),s=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${s}\0${o}`,u=`boundary-group:${Ot("sha256").update(l).digest("hex").slice(0,16)}`,c=t.get(u)??{id:u,protocol:n.protocol,joinRule:n.id,normalizedKey:o,keyParts:a,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&c.producerIds.push(i.id),n.consumerActions.includes(i.action)&&c.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&c.declarationIds.push(i.id),c.derivation.inputFactIds.push(i.id),c.derivation.sourceSpans.push(i.source),t.set(u,c)}}return[...t.values()].map(Rr).sort(Mr)}function Rr(e){return{...e,producerIds:be(e.producerIds),consumerIds:be(e.consumerIds),declarationIds:be(e.declarationIds),derivation:{...e.derivation,inputFactIds:be(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function kr(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let a=Se.find(s=>s.id===i.joinRule);if(!a?.traversable)continue;let o=a.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(o.length===0||i.consumerIds.length===0)&&!(a.requireUniquePair&&(o.length!==1||i.consumerIds.length!==1))&&!(a.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(o.length*i.consumerIds.length>Ir))for(let s of o)for(let l of i.consumerIds){let u=n.get(s),c=n.get(l);if(!u||!c||Dr(u,c))continue;let d=u.strength==="derived"||c.strength==="derived"?"derived":"exact",m=`${i.joinRule}\0${s}\0${l}`,p={id:`boundary-link:${Ot("sha256").update(m).digest("hex").slice(0,16)}`,from:s,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:d,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[s,l],sourceSpans:[u.source,c.source]}};r.set(p.id,p)}}return[...r.values()].sort(Vr)}function Lr(e,t){let n=new Set(t.filter(At).flatMap(xe)),r=new Set(t.filter(Tr).flatMap(xe));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function _r(e,t){let n=new Set(e.filter(a=>a.strength!=="candidate").map(a=>`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)),r=new Set(t.flatMap(xe)),i=new Set(t.filter(At).flatMap(xe));return e.filter(a=>a.sourceScope==="production").filter(a=>a.strength!=="candidate"||!n.has(`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)).filter(a=>!i.has(a.id)).map(a=>{let o=a.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),s=o.length>0?`${a.extractor} observed ${a.action}, but ${o.join(", ")} remained symbolic or unknown.`:a.resolution==="ambiguous"?`${a.extractor} established the address for ${a.action}, but more than one indexed peer has the same runtime key.`:r.has(a.id)?`${a.extractor} established the address for ${a.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${a.extractor} observed ${a.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:a.id,reason:s,missingKeyParts:o,sourceScope:a.sourceScope}}).sort((a,o)=>a.observationId.localeCompare(o.observationId))}function xe(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function At(e){let t=Se.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function Tr(e){let t=Se.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function Or(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function Ar(e,t){let n=[];for(let r of t){let i=e.keyParts.find(a=>a.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:Dt(r,i.value)})}return n}function Dt(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function Dr(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function ie(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function be(e){return[...new Set(e)].sort()}function Mr(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function Vr(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}export{se as a,R as b,Q as c,ee as d,ze as e,wr as f,Vt as g,zt as h,Ye as i};
49
+ //# sourceMappingURL=chunk-GQLDYCWS.js.map
@@ -0,0 +1,2 @@
1
+ import{m as g,n as h,z as S}from"./chunk-GWYZVVKY.js";import{c as u,d as m,h as p,k as f}from"./chunk-PUVNH4PO.js";import{B as d}from"./chunk-MEUHIDI3.js";import{G as c,N as a,Y as l}from"./chunk-UQYQBLJX.js";import{statSync as y}from"fs";import{join as R,resolve as C}from"path";var D=3e3,v=250,P={env:process.env,cliVersion:c,loadConfig:d,cacheDir:(e,r)=>a(e,r).cacheDir,registryRecord:e=>p(u(),m(e)),isProcessAlive:f,configChangedAtMs:e=>y(R(e,".codebaseiq.json")).mtimeMs,refreshHookBinary:e=>{S(e)},ensure:g,stop:h,sleep:e=>new Promise(r=>setTimeout(r,e))};async function _(e,r=P){let n=l(C(e)),t=r.loadConfig(n);if(t.sentinel?.enabled!==!0)return"sentinel-disabled";if(r.refreshHookBinary(r.cliVersion),t.watch?.enabled!==!0)return"watch-disabled";if(r.env.CODEBASEIQ_SKIP_WATCH_SERVICE==="1")return"environment";if(E(r,n))return"already-running";let i={projectRoot:n,cacheDir:r.cacheDir(n,t),cliVersion:r.cliVersion,spawnEnv:{CODEBASEIQ_SENTINEL_ENSURE:"1"}},o=r.ensure(i);if(o.disposition==="started")return"started";for(let s=0;s<D;s+=v)if(await r.sleep(v),E(r,n))return"reused";return Date.parse(o.state.startedAt)>=r.configChangedAtMs(n)?"reused-without-sentinel":(r.stop(i),r.ensure(i),"restarted")}function E(e,r){let n=e.registryRecord(r);return n!==void 0&&e.isProcessAlive(n.pid)&&n.serviceVersion===e.cliVersion}async function j(e){if(typeof e!="string"||e.length===0)throw new Error("A project root is required.");await _(e)}var k={id:"__sentinel-ensure-service",command:"__sentinel-ensure-service <projectRoot>",hidden:!0,description:"Internal: start the resident service that hosts the trailing sentinel",renderShape:"custom",handler:j};export{_ as a,k as b};
2
+ //# sourceMappingURL=chunk-GQXXOS55.js.map