scip-query 0.22.0 → 0.23.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 (386) hide show
  1. package/CHANGELOG.md +257 -0
  2. package/README.md +11 -0
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-XI2CSWEY.js +2 -0
  5. package/dist/call-graph-UONR6JR5.js +2 -0
  6. package/dist/{chunk-FGNCOQUX.js → chunk-2E7CX53V.js} +2 -2
  7. package/dist/chunk-2GRUZAQF.js +43 -0
  8. package/dist/{chunk-DPWKKNKI.js → chunk-2LDBDR6J.js} +2 -2
  9. package/dist/{chunk-JHH5SCZ3.js → chunk-2OOY75BW.js} +2 -2
  10. package/dist/{chunk-XGGBK66W.js → chunk-2R3V3PSD.js} +2 -2
  11. package/dist/chunk-2WC2OEDO.js +4 -0
  12. package/dist/{chunk-57N6LN2A.js → chunk-3AF4TUFK.js} +2 -2
  13. package/dist/{chunk-2RE5OCHZ.js → chunk-3D3QG236.js} +2 -2
  14. package/dist/{chunk-D2MVJSP4.js → chunk-3FHOF22C.js} +2 -2
  15. package/dist/{chunk-7XZGZBSQ.js → chunk-3JKSW6LJ.js} +2 -2
  16. package/dist/chunk-3L2ZBPEX.js +133 -0
  17. package/dist/{chunk-NVSZNESQ.js → chunk-3PJABJSU.js} +2 -2
  18. package/dist/{chunk-WOOAY3PA.js → chunk-3SVF22I5.js} +2 -2
  19. package/dist/{chunk-YAGYMBEX.js → chunk-3WR4E3A3.js} +2 -2
  20. package/dist/chunk-4FTZ4P5G.js +2 -0
  21. package/dist/{chunk-F24G5NBE.js → chunk-4ILJCCXV.js} +2 -2
  22. package/dist/chunk-4UX2F3JX.js +2 -0
  23. package/dist/chunk-4WNW27SX.js +2 -0
  24. package/dist/chunk-5ENOG4VP.js +61 -0
  25. package/dist/{chunk-RHHCLWQ6.js → chunk-64BFSI5I.js} +2 -2
  26. package/dist/chunk-66DVSJQG.js +455 -0
  27. package/dist/{chunk-ISWFRGJ6.js → chunk-6HFCYNYE.js} +2 -2
  28. package/dist/{chunk-Y2VM4CJC.js → chunk-6I6L7Z62.js} +2 -2
  29. package/dist/{chunk-CKRWA452.js → chunk-6PQNKL3G.js} +2 -2
  30. package/dist/{chunk-GPGRZJ3R.js → chunk-6V5CNXL6.js} +2 -2
  31. package/dist/chunk-6VVV4WRR.js +4 -0
  32. package/dist/{chunk-BDGTPN27.js → chunk-7BWFZPPZ.js} +2 -2
  33. package/dist/{chunk-25GWKRUZ.js → chunk-7CYG22FH.js} +2 -2
  34. package/dist/chunk-7F45LJKI.js +2 -0
  35. package/dist/{chunk-4TQU4TX2.js → chunk-7IWV2EG3.js} +2 -2
  36. package/dist/{chunk-UDY7MIAW.js → chunk-AFHTBORT.js} +2 -2
  37. package/dist/chunk-AVRYW5OZ.js +2 -0
  38. package/dist/chunk-B3PYOSCX.js +2 -0
  39. package/dist/{chunk-RNKPYYYE.js → chunk-B5D7QPBE.js} +2 -2
  40. package/dist/{chunk-FFJQZG6J.js → chunk-BBCIS4DX.js} +2 -2
  41. package/dist/chunk-BDUVI7TO.js +3 -0
  42. package/dist/{chunk-BVFYEEBH.js → chunk-BE7ZZTMC.js} +2 -2
  43. package/dist/{chunk-NEIQPFBI.js → chunk-BHVUJOCQ.js} +2 -2
  44. package/dist/chunk-BKVWUP7Y.js +2 -0
  45. package/dist/{chunk-IJMD6BRI.js → chunk-BQGB4HBD.js} +2 -2
  46. package/dist/{chunk-ERCYGVAM.js → chunk-BRV7PIFF.js} +2 -2
  47. package/dist/chunk-CEEZJXEF.js +2 -0
  48. package/dist/{chunk-BTVKZGWT.js → chunk-CIYLO6SI.js} +2 -2
  49. package/dist/chunk-CJZXN4NU.js +2 -0
  50. package/dist/{chunk-VXJJTQYE.js → chunk-CNO7TOKL.js} +2 -2
  51. package/dist/{chunk-ZZ3Z7D56.js → chunk-COF23M5F.js} +2 -2
  52. package/dist/{chunk-ZGW4HLPD.js → chunk-CWFP7GM5.js} +2 -2
  53. package/dist/chunk-D2DHWI3D.js +2 -0
  54. package/dist/{chunk-Q55NF3ZG.js → chunk-D4N5SQ2M.js} +2 -2
  55. package/dist/{chunk-LXQUF2RP.js → chunk-DBRSYFXR.js} +2 -2
  56. package/dist/{chunk-PXXYQK55.js → chunk-DHUIOLDT.js} +2 -2
  57. package/dist/{chunk-KZYID5KV.js → chunk-DIRJWYBM.js} +2 -2
  58. package/dist/{chunk-IKVNEGTW.js → chunk-DIUFNHRJ.js} +2 -2
  59. package/dist/{chunk-CLG6DWVS.js → chunk-DTZCKZEU.js} +2 -2
  60. package/dist/{chunk-Z2PZVKPR.js → chunk-DULC3QFP.js} +2 -2
  61. package/dist/{chunk-AYPDH2LU.js → chunk-DYGHBZ2N.js} +2 -2
  62. package/dist/{chunk-JJ62MTQH.js → chunk-E5R6AQ73.js} +2 -2
  63. package/dist/{chunk-BWVQP3LB.js → chunk-E73UNJTF.js} +2 -2
  64. package/dist/{chunk-GVOMSPGL.js → chunk-EG2CPZMJ.js} +2 -2
  65. package/dist/{chunk-56NQAEPJ.js → chunk-EKV5HX33.js} +2 -2
  66. package/dist/{chunk-GDRJB3SB.js → chunk-EQHFIL6T.js} +2 -2
  67. package/dist/{chunk-EWWY2ZFL.js → chunk-ESIQ66Z7.js} +2 -2
  68. package/dist/chunk-EVFUMY4R.js +3 -0
  69. package/dist/{chunk-ZYM4HOFA.js → chunk-F7DY272B.js} +2 -2
  70. package/dist/chunk-FBN2FGXG.js +2 -0
  71. package/dist/{chunk-AZS7YPCB.js → chunk-FDLOBR6P.js} +2 -2
  72. package/dist/chunk-FESCRNVV.js +5 -0
  73. package/dist/{chunk-URSGGIZX.js → chunk-FFRKR4EQ.js} +2 -2
  74. package/dist/chunk-FGA2U4OR.js +8 -0
  75. package/dist/{chunk-7YQOCABQ.js → chunk-FIQRSHVM.js} +2 -2
  76. package/dist/{chunk-KFVSJX25.js → chunk-FPYLNQPT.js} +2 -2
  77. package/dist/{chunk-FELGD32K.js → chunk-FRUSVINH.js} +2 -2
  78. package/dist/chunk-GAS2LJMP.js +3 -0
  79. package/dist/{chunk-OTSPRVNW.js → chunk-GSP44ENC.js} +2 -2
  80. package/dist/{chunk-K3XFWJI2.js → chunk-GUFSG5TX.js} +2 -2
  81. package/dist/chunk-GYIZ4NXB.js +2 -0
  82. package/dist/{chunk-2OXVP5U5.js → chunk-GZIUDL6G.js} +2 -2
  83. package/dist/chunk-HCXEQRFF.js +18 -0
  84. package/dist/{chunk-LO5JSW2C.js → chunk-HEHOQQKH.js} +2 -2
  85. package/dist/{chunk-U2N2KE7A.js → chunk-HKGFPJ4T.js} +2 -2
  86. package/dist/chunk-HLZTEXRA.js +2 -0
  87. package/dist/{chunk-EELPBR7E.js → chunk-HOENASQM.js} +2 -2
  88. package/dist/{chunk-VTCIYFEK.js → chunk-HVF5VBG6.js} +2 -2
  89. package/dist/{chunk-TH6IC56G.js → chunk-HYO3NP5Q.js} +2 -2
  90. package/dist/{chunk-OPSAW5DT.js → chunk-I55I7XXP.js} +2 -2
  91. package/dist/{chunk-DEAB5TGT.js → chunk-IDFEUFKS.js} +2 -2
  92. package/dist/{chunk-DJAO2OZJ.js → chunk-IHGQTTVW.js} +2 -2
  93. package/dist/{chunk-XU75YQN4.js → chunk-IICPE7B2.js} +2 -2
  94. package/dist/{chunk-GY7CCCEZ.js → chunk-IL676XCC.js} +2 -2
  95. package/dist/{chunk-4HE7MVWD.js → chunk-ILTDAWEF.js} +2 -2
  96. package/dist/chunk-IZDPJ2QI.js +2 -0
  97. package/dist/{chunk-5YRQIE2B.js → chunk-J66VOFW6.js} +2 -2
  98. package/dist/{chunk-SB25YMEQ.js → chunk-JFMEXGFE.js} +2 -2
  99. package/dist/{chunk-QLBSG7U5.js → chunk-JGKUET5J.js} +2 -2
  100. package/dist/{chunk-VZ7NXSHV.js → chunk-JS4PGXMV.js} +2 -2
  101. package/dist/{chunk-ZAZGGSM3.js → chunk-JTQVMR42.js} +2 -2
  102. package/dist/chunk-JWTGMPIT.js +80 -0
  103. package/dist/{chunk-5ZMBRQFC.js → chunk-JYR66JN5.js} +2 -2
  104. package/dist/chunk-KLFEXGQA.js +2 -0
  105. package/dist/chunk-KYSDI3GE.js +5 -0
  106. package/dist/{chunk-MSR2QRUE.js → chunk-L6PJPETJ.js} +2 -2
  107. package/dist/{chunk-VU6LIWHT.js → chunk-LDVT66YM.js} +2 -2
  108. package/dist/chunk-LEECKFCJ.js +2 -0
  109. package/dist/{chunk-H7CG6LOE.js → chunk-LMZ5PRUV.js} +2 -2
  110. package/dist/{chunk-ZPASRBLF.js → chunk-LQRQN2XA.js} +2 -2
  111. package/dist/{chunk-HISEUIL2.js → chunk-LXABEJX3.js} +2 -2
  112. package/dist/{chunk-WHADK6OS.js → chunk-M2O5NY6W.js} +2 -2
  113. package/dist/{chunk-Y334QQU5.js → chunk-MNV5FSBW.js} +2 -2
  114. package/dist/{chunk-RYOYJMGF.js → chunk-MPQ4OTBM.js} +2 -2
  115. package/dist/{chunk-6NC3YSPY.js → chunk-MV3CDXPI.js} +2 -2
  116. package/dist/{chunk-NRBNAECH.js → chunk-MWN53KRN.js} +2 -2
  117. package/dist/chunk-N2ZSIIGR.js +117 -0
  118. package/dist/chunk-N5B2NILC.js +5 -0
  119. package/dist/{chunk-Q6T2CAJL.js → chunk-NJITK2GP.js} +2 -2
  120. package/dist/{chunk-ENWQWA2R.js → chunk-NOGJXYFO.js} +2 -2
  121. package/dist/{chunk-V4NG5OMS.js → chunk-NOYBFVJA.js} +106 -106
  122. package/dist/chunk-NWQXSFFU.js +3 -0
  123. package/dist/chunk-ODDUPDP7.js +13 -0
  124. package/dist/{chunk-A77SCPW2.js → chunk-OLIWTZI3.js} +2 -2
  125. package/dist/{chunk-XFMVKFSF.js → chunk-OLNV6I6U.js} +2 -2
  126. package/dist/{chunk-QKT4UI2Y.js → chunk-OR2E3AGZ.js} +2 -2
  127. package/dist/chunk-OSR2GEHQ.js +2 -0
  128. package/dist/{chunk-5H5WTJSD.js → chunk-OSSESPDX.js} +2 -2
  129. package/dist/{chunk-KQHJEU6V.js → chunk-OWOOWNJ5.js} +2 -2
  130. package/dist/{chunk-GRX7JOXQ.js → chunk-P42EIXTA.js} +2 -2
  131. package/dist/{chunk-AQ2PORIO.js → chunk-PJFGPYTU.js} +2 -2
  132. package/dist/{chunk-LRI5OMPE.js → chunk-PP7KNN7L.js} +2 -2
  133. package/dist/{chunk-PLJUQFQN.js → chunk-PU7T5QYQ.js} +2 -2
  134. package/dist/{chunk-JUN5DOAK.js → chunk-PWWAJSKV.js} +2 -2
  135. package/dist/{chunk-7IQXARSQ.js → chunk-PZL5T7SU.js} +2 -2
  136. package/dist/{chunk-UAQ4T73O.js → chunk-QBE3YX64.js} +2 -2
  137. package/dist/{chunk-3TJY6M3B.js → chunk-QGVTFRY2.js} +2 -2
  138. package/dist/chunk-QOJONDS7.js +2 -0
  139. package/dist/chunk-QU5XRYB5.js +4 -0
  140. package/dist/{chunk-2KVU55CW.js → chunk-QUU5OBVK.js} +2 -2
  141. package/dist/{chunk-Q5TA4OY4.js → chunk-RBLQNW26.js} +2 -2
  142. package/dist/chunk-RTQ7NEKG.js +81 -0
  143. package/dist/{chunk-F24QUEQP.js → chunk-SQXRS7BG.js} +2 -2
  144. package/dist/chunk-SSK6LDPC.js +2 -0
  145. package/dist/chunk-SZHGTCPP.js +7 -0
  146. package/dist/chunk-T4N4P2K5.js +16 -0
  147. package/dist/chunk-TA3QKLLU.js +2 -0
  148. package/dist/chunk-TEBQMNVI.js +43 -0
  149. package/dist/{chunk-NK3JMP22.js → chunk-TPFHAQ2G.js} +2 -2
  150. package/dist/chunk-TQPCBMWT.js +5 -0
  151. package/dist/{chunk-HG722PO7.js → chunk-TRNAEQ6P.js} +2 -2
  152. package/dist/chunk-TY7CRN3Z.js +2 -0
  153. package/dist/{chunk-7XA3OM44.js → chunk-UHFYCMZO.js} +2 -2
  154. package/dist/{chunk-ARVO6TTW.js → chunk-UICY4GTQ.js} +2 -2
  155. package/dist/{chunk-SWK4XPUS.js → chunk-UVGEWT4Y.js} +2 -2
  156. package/dist/{chunk-GIQ6CSL4.js → chunk-UXW33INU.js} +2 -2
  157. package/dist/{chunk-RDULNRSJ.js → chunk-VMPRET3I.js} +2 -2
  158. package/dist/{chunk-I6UTXNHU.js → chunk-VNLGKHS6.js} +2 -2
  159. package/dist/{chunk-44T4DUAA.js → chunk-VQILFTEH.js} +2 -2
  160. package/dist/{chunk-N7FP5H5U.js → chunk-VUPHCS7Y.js} +8 -8
  161. package/dist/{chunk-JAT6C3VX.js → chunk-VVZSBTSU.js} +2 -2
  162. package/dist/{chunk-FBCVASUG.js → chunk-VZRNID6A.js} +2 -2
  163. package/dist/{chunk-TUQIPUDS.js → chunk-W5OXRYGE.js} +2 -2
  164. package/dist/chunk-W6STWDQI.js +57 -0
  165. package/dist/chunk-W7CXK74K.js +2 -0
  166. package/dist/chunk-WB3WYIRE.js +4 -0
  167. package/dist/{chunk-C76O5MDS.js → chunk-WDNVY4E7.js} +2 -2
  168. package/dist/{chunk-TAYD3AE7.js → chunk-WIWY3CRX.js} +2 -2
  169. package/dist/chunk-WK46TNUM.js +3 -0
  170. package/dist/chunk-WNTFFKAX.js +12 -0
  171. package/dist/{chunk-JFQBRL3J.js → chunk-WOIKCX6A.js} +2 -2
  172. package/dist/{chunk-PIFTZEEM.js → chunk-WUN6KBHV.js} +2 -2
  173. package/dist/chunk-WYCTJDVR.js +2 -0
  174. package/dist/chunk-WYPL7GF7.js +2 -0
  175. package/dist/{chunk-XN22RGSR.js → chunk-XBGWL66K.js} +2 -2
  176. package/dist/{chunk-R6M456QG.js → chunk-XDQMU3BT.js} +2 -2
  177. package/dist/{chunk-XJX6LGHL.js → chunk-XFA4SSO3.js} +2 -2
  178. package/dist/{chunk-2YC7YNKT.js → chunk-XGZEP6GR.js} +2 -2
  179. package/dist/chunk-XPDPNWTQ.js +368 -0
  180. package/dist/chunk-XRYABF57.js +8 -0
  181. package/dist/{chunk-YIHNPKWD.js → chunk-YBGKCQIS.js} +2 -2
  182. package/dist/{chunk-2XCGSDIT.js → chunk-YEN6CYC7.js} +2 -2
  183. package/dist/{chunk-VMWUV6WB.js → chunk-YF5IB2LF.js} +2 -2
  184. package/dist/{chunk-TNG2FYS5.js → chunk-YI2AWIHC.js} +2 -2
  185. package/dist/{chunk-EELG7D3Q.js → chunk-YPWBKGFU.js} +2 -2
  186. package/dist/{chunk-GQIDEID3.js → chunk-YPWHBBIS.js} +2 -2
  187. package/dist/{chunk-TKDNDQA7.js → chunk-YSH6U3L4.js} +2 -2
  188. package/dist/{chunk-BUTEIZKP.js → chunk-YU5DZUZI.js} +2 -2
  189. package/dist/chunk-YWO5DDRC.js +16 -0
  190. package/dist/{chunk-6HRZQLOI.js → chunk-Z4CDXYNQ.js} +2 -2
  191. package/dist/{chunk-XSWYJCAK.js → chunk-ZF5KHH7C.js} +2 -2
  192. package/dist/chunk-ZOHS7AQV.js +21 -0
  193. package/dist/{chunk-7U2YQSDE.js → chunk-ZTI4SBFV.js} +2 -2
  194. package/dist/cli-main.js +2 -2
  195. package/dist/code-MI6F2TTU.js +2 -0
  196. package/dist/code-result-json-FXALY4HE.js +2 -0
  197. package/dist/{command-descriptors-ORNTVNYV.js → command-descriptors-P34VABY5.js} +136 -135
  198. package/dist/dataflow-4KEMJPC6.js +2 -0
  199. package/dist/dependence-slice-R7FPWD5M.js +2 -0
  200. package/dist/deps-7EMQUYUT.js +2 -0
  201. package/dist/direct-navigation-6YO234F2.js +3 -0
  202. package/dist/entry-map-KOOLR26E.js +2 -0
  203. package/dist/files-OPIPJIGZ.js +2 -0
  204. package/dist/hierarchy-QPD2CAER.js +2 -0
  205. package/dist/imports-M6HUXRXC.js +2 -0
  206. package/dist/index.js +1 -1
  207. package/dist/members-I5MEFOCT.js +2 -0
  208. package/dist/methods-5JYGGHXA.js +2 -0
  209. package/dist/output-continuation-command-UPQAAKBP.js +3 -0
  210. package/dist/postinstall.js +1 -1
  211. package/dist/project-reindex-UKKQ5PLS.js +3 -0
  212. package/dist/queries/affected.js +1 -1
  213. package/dist/queries/anchors.js +1 -1
  214. package/dist/queries/architecture.js +1 -1
  215. package/dist/queries/bottlenecks.js +1 -1
  216. package/dist/queries/by-kind.js +1 -1
  217. package/dist/queries/call-graph.js +1 -1
  218. package/dist/queries/change-surface.js +1 -1
  219. package/dist/queries/cleanup-plan.js +1 -1
  220. package/dist/queries/co-change.js +1 -1
  221. package/dist/queries/code.js +1 -1
  222. package/dist/queries/complexity-hotspots.js +1 -1
  223. package/dist/queries/complexity.js +1 -1
  224. package/dist/queries/context.js +1 -1
  225. package/dist/queries/convergence.js +1 -1
  226. package/dist/queries/coupling.js +1 -1
  227. package/dist/queries/cycles.js +1 -1
  228. package/dist/queries/dataflow.js +1 -1
  229. package/dist/queries/dead.js +1 -1
  230. package/dist/queries/decorative-checkers.js +1 -1
  231. package/dist/queries/deep-chains.js +1 -1
  232. package/dist/queries/dependence-slice.js +1 -1
  233. package/dist/queries/dependency-depth.js +1 -1
  234. package/dist/queries/deps.js +1 -1
  235. package/dist/queries/diff-impact.d.ts +9 -0
  236. package/dist/queries/diff-impact.js +1 -1
  237. package/dist/queries/doc-drift.js +1 -1
  238. package/dist/queries/drift.js +1 -1
  239. package/dist/queries/duplicate-bodies.js +1 -1
  240. package/dist/queries/entry-map.js +1 -1
  241. package/dist/queries/evidence.js +1 -1
  242. package/dist/queries/extract-candidates.js +1 -1
  243. package/dist/queries/fan.js +1 -1
  244. package/dist/queries/files.js +1 -1
  245. package/dist/queries/health.js +1 -1
  246. package/dist/queries/hierarchy.js +1 -1
  247. package/dist/queries/hotspots.js +1 -1
  248. package/dist/queries/imports.js +1 -1
  249. package/dist/queries/incomplete-migration.js +1 -1
  250. package/dist/queries/index.js +1 -1
  251. package/dist/queries/isolated.js +1 -1
  252. package/dist/queries/locality-candidates.js +1 -1
  253. package/dist/queries/members.js +1 -1
  254. package/dist/queries/methods.js +1 -1
  255. package/dist/queries/not-implemented.js +1 -1
  256. package/dist/queries/outline.js +1 -1
  257. package/dist/queries/passthrough-candidates.js +1 -1
  258. package/dist/queries/plan-context.js +1 -1
  259. package/dist/queries/react-component-duplicates.js +1 -1
  260. package/dist/queries/react-hook-candidates.js +1 -1
  261. package/dist/queries/react-large-component-pressure.js +1 -1
  262. package/dist/queries/recent-duplicates.js +1 -1
  263. package/dist/queries/redundant-reexports.js +1 -1
  264. package/dist/queries/reference-neighborhood.js +1 -1
  265. package/dist/queries/reference-reachability.js +1 -1
  266. package/dist/queries/refs.js +1 -1
  267. package/dist/queries/self-audit.js +1 -1
  268. package/dist/queries/similar-chains.js +1 -1
  269. package/dist/queries/similar-files.js +1 -1
  270. package/dist/queries/similar-signatures.js +1 -1
  271. package/dist/queries/similar.js +1 -1
  272. package/dist/queries/slice.js +1 -1
  273. package/dist/queries/source-inspection.js +1 -1
  274. package/dist/queries/source-search.js +1 -1
  275. package/dist/queries/stale-abstractions.js +1 -1
  276. package/dist/queries/surface.js +1 -1
  277. package/dist/queries/symbols.js +1 -1
  278. package/dist/queries/system-map.js +1 -1
  279. package/dist/queries/system.js +1 -1
  280. package/dist/queries/test-quality.js +1 -1
  281. package/dist/queries/trace.js +1 -1
  282. package/dist/queries/twin-ab.js +1 -1
  283. package/dist/queries/twin-drift.js +1 -1
  284. package/dist/queries/unused-imports.js +1 -1
  285. package/dist/queries/unused-params.js +1 -1
  286. package/dist/queries/value-flow.js +1 -1
  287. package/dist/queries/vue-component-duplicates.js +1 -1
  288. package/dist/queries/vue-composable-candidates.js +1 -1
  289. package/dist/queries/vue-large-view-pressure.js +1 -1
  290. package/dist/queries/wrapper-candidates.js +1 -1
  291. package/dist/query-service-server.js +3 -3
  292. package/dist/refs-PSU4JZZW.js +2 -0
  293. package/dist/refs-pagination-JG6CJMRC.js +2 -0
  294. package/dist/reindex-worker.js +25 -25
  295. package/dist/reindex.d.ts +3 -2
  296. package/dist/reindex.js +35 -35
  297. package/dist/runtime.d.ts +34 -2
  298. package/dist/runtime.js +4 -4
  299. package/dist/rust-semantic-session-server.js +1 -1
  300. package/dist/rust-semantic-session-worker.js +1 -1
  301. package/dist/rust-semantic-worker.js +1 -1
  302. package/dist/{scip-cli-H-n59izO.d.ts → scip-cli-DOerTq-R.d.ts} +42 -4
  303. package/dist/slice-HYRATV64.js +2 -0
  304. package/dist/surface-VTGDYWF5.js +2 -0
  305. package/dist/symbol-resolution-WD5EU5JE.js +2 -0
  306. package/dist/system-LRQNFOR2.js +2 -0
  307. package/dist/trace-F4B6OLL4.js +2 -0
  308. package/dist/typescript-mailbox-worker.js +1 -1
  309. package/dist/value-flow-VRPZY72V.js +2 -0
  310. package/dist/watch-server.js +3 -3
  311. package/package.json +1 -1
  312. package/dist/by-kind-4IYG2SKW.js +0 -2
  313. package/dist/call-graph-WQNXMNNN.js +0 -2
  314. package/dist/chunk-2BTJALUS.js +0 -454
  315. package/dist/chunk-3QXC54FQ.js +0 -3
  316. package/dist/chunk-42W3LFUK.js +0 -13
  317. package/dist/chunk-4GAQ6FI4.js +0 -43
  318. package/dist/chunk-6VEFRPTD.js +0 -5
  319. package/dist/chunk-7C26EKLZ.js +0 -4
  320. package/dist/chunk-7JYHQAH2.js +0 -22
  321. package/dist/chunk-7KSO2OAP.js +0 -2
  322. package/dist/chunk-AK3PYTIK.js +0 -5
  323. package/dist/chunk-AMIMMNA4.js +0 -11
  324. package/dist/chunk-AUY5BL74.js +0 -2
  325. package/dist/chunk-BDHFVH2M.js +0 -18
  326. package/dist/chunk-BECZLYNU.js +0 -8
  327. package/dist/chunk-BYDAFMSR.js +0 -57
  328. package/dist/chunk-BZYSGZRK.js +0 -2
  329. package/dist/chunk-C7IJMOFP.js +0 -134
  330. package/dist/chunk-CBBHFNLX.js +0 -2
  331. package/dist/chunk-D35XIZGN.js +0 -2
  332. package/dist/chunk-DKM723YF.js +0 -79
  333. package/dist/chunk-E44IVWIJ.js +0 -367
  334. package/dist/chunk-EDMB6SSO.js +0 -7
  335. package/dist/chunk-EETGXQY7.js +0 -3
  336. package/dist/chunk-FKGQOTKD.js +0 -2
  337. package/dist/chunk-GH5YSGZL.js +0 -5
  338. package/dist/chunk-HCVJR2V4.js +0 -3
  339. package/dist/chunk-HXOU4XNH.js +0 -3
  340. package/dist/chunk-IMKZEXZG.js +0 -2
  341. package/dist/chunk-ISIQLPJ2.js +0 -61
  342. package/dist/chunk-IXESDH3J.js +0 -2
  343. package/dist/chunk-JT6XX7QY.js +0 -8
  344. package/dist/chunk-MHIEP7EG.js +0 -4
  345. package/dist/chunk-OJNK5ALA.js +0 -2
  346. package/dist/chunk-OXYAWIEA.js +0 -2
  347. package/dist/chunk-OZETODHH.js +0 -2
  348. package/dist/chunk-PBUH2P5S.js +0 -3
  349. package/dist/chunk-PLYUVM4F.js +0 -2
  350. package/dist/chunk-Q7GBK5T7.js +0 -81
  351. package/dist/chunk-QWKHW6VZ.js +0 -2
  352. package/dist/chunk-RPL3ARU7.js +0 -16
  353. package/dist/chunk-SVHTMVA4.js +0 -4
  354. package/dist/chunk-T6QD2ZQB.js +0 -43
  355. package/dist/chunk-TD7VKJ2Y.js +0 -117
  356. package/dist/chunk-TUSPIVZ3.js +0 -4
  357. package/dist/chunk-UT7TADJX.js +0 -2
  358. package/dist/chunk-VUSKPCUB.js +0 -2
  359. package/dist/chunk-WN3TCGJ4.js +0 -2
  360. package/dist/chunk-WSLEJSFR.js +0 -2
  361. package/dist/chunk-WYZIHUPZ.js +0 -16
  362. package/dist/chunk-XE33FV5W.js +0 -2
  363. package/dist/chunk-Z2AWCTN6.js +0 -2
  364. package/dist/chunk-ZOXKSQQB.js +0 -2
  365. package/dist/code-EQJFDT6I.js +0 -2
  366. package/dist/code-result-json-7UWIWBOO.js +0 -2
  367. package/dist/dataflow-6VL54GX5.js +0 -2
  368. package/dist/dependence-slice-DT2NUHD2.js +0 -2
  369. package/dist/deps-DB7H5IKC.js +0 -2
  370. package/dist/direct-navigation-O3LUAYWQ.js +0 -3
  371. package/dist/entry-map-6K62RV3D.js +0 -2
  372. package/dist/files-MSLD7MO6.js +0 -2
  373. package/dist/hierarchy-IVBXAKFA.js +0 -2
  374. package/dist/imports-FRAVZ3Y2.js +0 -2
  375. package/dist/members-KJOJDYGO.js +0 -2
  376. package/dist/methods-2AYABBT3.js +0 -2
  377. package/dist/output-continuation-command-JHMPH6NC.js +0 -3
  378. package/dist/project-reindex-HYO4WD7Z.js +0 -3
  379. package/dist/refs-ARMA6XUJ.js +0 -2
  380. package/dist/refs-pagination-VUGIWN6U.js +0 -2
  381. package/dist/slice-YOB5YFAM.js +0 -2
  382. package/dist/surface-VY5EFWTW.js +0 -2
  383. package/dist/symbol-resolution-DGQN4XIV.js +0 -2
  384. package/dist/system-2KQ3QD2P.js +0 -2
  385. package/dist/trace-HTIPTXAE.js +0 -2
  386. package/dist/value-flow-5FV3VQI7.js +0 -2
@@ -1,6 +1,6 @@
1
- import{a as ie}from"./chunk-GIQ6CSL4.js";import{a as oe}from"./chunk-AZS7YPCB.js";import{b as D}from"./chunk-BDGTPN27.js";import{a as te}from"./chunk-UT7TADJX.js";import{b as ne}from"./chunk-XGGBK66W.js";import{a as W,b as ee}from"./chunk-GVOMSPGL.js";import{b as Q}from"./chunk-ZGW4HLPD.js";import{f as V}from"./chunk-QLBSG7U5.js";import{a as H}from"./chunk-XSWYJCAK.js";import{a as q}from"./chunk-2KVU55CW.js";import{b as Y}from"./chunk-PXXYQK55.js";import{a as X}from"./chunk-ISWFRGJ6.js";import{d as Z}from"./chunk-WHADK6OS.js";import{b as K}from"./chunk-ERCYGVAM.js";import{a as J}from"./chunk-RPL3ARU7.js";import{a as w}from"./chunk-6VEFRPTD.js";import{a as G}from"./chunk-BUTEIZKP.js";import{a as j,c as z}from"./chunk-5H5WTJSD.js";import{b as $}from"./chunk-Q6T2CAJL.js";import{e as P,t as A}from"./chunk-TD7VKJ2Y.js";import{t as U}from"./chunk-Q7GBK5T7.js";function se(n){let e=new Set(n.filter(o=>o.definition?.isFunctionLike).map(o=>`${o.role}:${o.definition.relativePath}`));return n.flatMap(o=>o.definition?!o.definition.isFunctionLike&&e.has(`${o.role}:${o.definition.relativePath}`)?[]:[{definition:o.definition,role:o.role}]:[])}var me=6,I=10,M=3,T=8,de=.7,re=24,_=200,fe=12,le=80,ce=600;function Ze(n,e,o={}){let l=o.impactDepth??3,a=o.sliceDepth??3,u=o.semantic,c=Ee(e)?Ce(n,e):null,S=c?c.primary?.symbol??null:e,{traceResult:r,callGraphResult:C,complexityResult:R,dataflowResult:t,backwardSliceResult:d,forwardSliceResult:s,affectedResults:p,reuseCandidates:b,targetSymbol:i,affectedConsumerReuse:y}=ye(n,S,o,l,a),h=f("change-surface",e,()=>q(n,e,{semantic:u}),m=>({symbols:m?.symbols.length??0,externalConsumers:m?.totalExternalConsumers??0})),x=f("system",e,()=>oe(n,e),m=>({files:m.files.length,symbols:m.symbols.length})),L=x.files.length===1,B=f("deps",e,()=>L?x.dependsOn.map(m=>({relativePath:m,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):W(n,e),m=>({files:m.length,reusedSystem:L})),k=f("rdeps",e,()=>L?x.dependedOnBy.map(m=>({relativePath:m,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):ee(n,e),m=>({files:m.length,reusedSystem:L})),N=f("surface",e,()=>ie(n,e),m=>({consumers:m.length})),g={symbol:r.definitions.length>0||r.referencedBy.length>0||C!==null||R!==null||t!==null||d!==null||s!==null||p.length>0,file:h!==null||B.length>0||k.length>0,module:x.files.length>0||x.symbols.length>0||N.length>0},E=[];c&&!c.primary&&c.callableCount>1&&E.push(`File target has ${c.callableCount} callable symbols; use one callable name for compiler-resolved flow.`);let F=[...new Set(r.referencedBy.map(m=>m.relativePath))];F.length>0&&F.every(m=>$(m)==="test")&&E.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."),!g.symbol&&!g.file&&!g.module&&E.push("No symbol, file, or module matched target.");let O=h?.file??r.definitions[0]?.relativePath??null;return{target:e,...c?.primary?{primaryCallable:{symbol:c.primary.symbol,shortName:P(c.primary.symbol),file:c.primary.relativePath}}:{},matched:g,history:f("history",O??e,()=>ge(n,O,o.gitHead)),trace:pe(r),callGraph:C,complexity:R,dataflow:t,backwardSlice:d,forwardSlice:s,affected:p,changeSurface:h,deps:B,rdeps:k,system:x,surface:N,reuseCandidates:b,affectedConsumerReuse:y,sourcePacket:be(n,i,r,y,b),warnings:E}}function ye(n,e,o,l,a){let u=o.semantic,c=e?f("trace",e,()=>ne(n,e,{semantic:u,referenceContext:fe}),i=>({definitions:i.definitions.length,references:i.referencedBy.length})):{definitions:[],referencedBy:[],claimSupport:null},S=e?f("call-graph",e,()=>H(n,e,{semantic:u}),i=>({callers:i?.callers.length??0,callees:i?.callees.length??0})):null,r=e?f("complexity",e,()=>J(n,e,{semantic:u}),i=>({callees:i?.calleeCount??0})):null,C=e?f("dataflow",e,()=>Q(n,e,{semantic:u}),i=>({references:i?.usageSites.length??0,producers:i?.producers.length??0,consumers:i?.consumers.length??0})):null,R=e?f("backward-slice",e,()=>D(n,e,{direction:"backward",maxDepth:a,semantic:u}),i=>({maxDepth:a,connectedSymbols:i?.connectedSymbols.length??0})):null,t=e?f("forward-slice",e,()=>D(n,e,{direction:"forward",maxDepth:a,semantic:u}),i=>({maxDepth:a,connectedSymbols:i?.connectedSymbols.length??0})):null,d=e?f("affected",e,()=>G(n,e,{maxDepth:l,scope:o.scope}),i=>({maxDepth:l,affectedSymbols:i.length})):[],s=e?f("reuse-candidates",e,()=>w(n,e,{minSimilarity:.4,limit:5,semantic:u,sourceCandidateMode:"target-pruned"}),i=>({candidates:i.length,direct:i.filter(y=>y.actionTier==="direct").length})):[],p=e?j(n,e)?.symbol??null:null,b=e?f("affected-consumer-reuse",e,()=>Se(c,p,i=>w(n,i,{minSimilarity:.4,limit:I,semantic:u,sourceCandidateMode:"target-pruned"}),{consumerLimit:me,perConsumerSearchLimit:I,perConsumerCandidateLimit:M,candidateLimit:T}),i=>({totalConsumers:i.coverage.totalConsumers,analyzedConsumers:i.coverage.analyzedConsumers,candidates:i.candidates.length})):Le();return{traceResult:c,callGraphResult:S,complexityResult:r,dataflowResult:C,backwardSliceResult:R,forwardSliceResult:t,affectedResults:d,reuseCandidates:s,targetSymbol:p,affectedConsumerReuse:b}}function pe(n){return{definitions:n.definitions,referencedBy:n.referencedBy.map(e=>({relativePath:e.relativePath,line:e.line,enclosingSymbol:e.enclosingSymbol,enclosingShort:e.enclosingShort}))}}function Ce(n,e){let o=K(n,e);if(o.length!==1)return{primary:null,callableCount:0};let l=A(n,o[0]).filter(c=>c.isFunctionLike),a=l.filter(c=>c.enclosingSymbol===null),u=a.length>0?a:l;return{primary:u.length===1?u[0]:null,callableCount:u.length}}function be(n,e,o,l,a){let u=[...e?[{definition:ae(n,e),role:"target"}]:[],...[...l.candidates.map(t=>t.candidate),...a].map(t=>({definition:ae(n,t.symbolB),role:"reuse-candidate"}))],c=new Map;for(let t of se(u)){if(c.has(t.definition.symbol))continue;let d=t.role==="target"?_:le,s=t.definition.endLine<=t.definition.startLine?Z(n,t.definition.relativePath,t.definition.startLine,d):null,p=s?.unitType?s.source:V(n,t.definition);if(!p)continue;let b=p.split(`
1
+ import{a as ie}from"./chunk-2LDBDR6J.js";import{a as oe}from"./chunk-FDLOBR6P.js";import{b as D}from"./chunk-7BWFZPPZ.js";import{a as te}from"./chunk-D2DHWI3D.js";import{b as ne}from"./chunk-2R3V3PSD.js";import{a as W,b as ee}from"./chunk-EG2CPZMJ.js";import{b as Q}from"./chunk-CWFP7GM5.js";import{f as V}from"./chunk-JGKUET5J.js";import{a as H}from"./chunk-ZF5KHH7C.js";import{a as q}from"./chunk-QUU5OBVK.js";import{b as Y}from"./chunk-DHUIOLDT.js";import{a as X}from"./chunk-6HFCYNYE.js";import{d as Z}from"./chunk-M2O5NY6W.js";import{b as K}from"./chunk-BRV7PIFF.js";import{a as J}from"./chunk-T4N4P2K5.js";import{a as w}from"./chunk-TQPCBMWT.js";import{a as G}from"./chunk-YU5DZUZI.js";import{a as j,c as z}from"./chunk-OSSESPDX.js";import{b as $}from"./chunk-NJITK2GP.js";import{e as P,t as A}from"./chunk-N2ZSIIGR.js";import{y as U}from"./chunk-JWTGMPIT.js";function se(n){let e=new Set(n.filter(o=>o.definition?.isFunctionLike).map(o=>`${o.role}:${o.definition.relativePath}`));return n.flatMap(o=>o.definition?!o.definition.isFunctionLike&&e.has(`${o.role}:${o.definition.relativePath}`)?[]:[{definition:o.definition,role:o.role}]:[])}var me=6,I=10,M=3,T=8,de=.7,re=24,_=200,fe=12,le=80,ce=600;function Ze(n,e,o={}){let l=o.impactDepth??3,a=o.sliceDepth??3,u=o.semantic,c=Ee(e)?Ce(n,e):null,S=c?c.primary?.symbol??null:e,{traceResult:r,callGraphResult:C,complexityResult:R,dataflowResult:t,backwardSliceResult:d,forwardSliceResult:s,affectedResults:p,reuseCandidates:b,targetSymbol:i,affectedConsumerReuse:y}=ye(n,S,o,l,a),h=f("change-surface",e,()=>q(n,e,{semantic:u}),m=>({symbols:m?.symbols.length??0,externalConsumers:m?.totalExternalConsumers??0})),x=f("system",e,()=>oe(n,e),m=>({files:m.files.length,symbols:m.symbols.length})),L=x.files.length===1,B=f("deps",e,()=>L?x.dependsOn.map(m=>({relativePath:m,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):W(n,e),m=>({files:m.length,reusedSystem:L})),k=f("rdeps",e,()=>L?x.dependedOnBy.map(m=>({relativePath:m,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):ee(n,e),m=>({files:m.length,reusedSystem:L})),N=f("surface",e,()=>ie(n,e),m=>({consumers:m.length})),g={symbol:r.definitions.length>0||r.referencedBy.length>0||C!==null||R!==null||t!==null||d!==null||s!==null||p.length>0,file:h!==null||B.length>0||k.length>0,module:x.files.length>0||x.symbols.length>0||N.length>0},E=[];c&&!c.primary&&c.callableCount>1&&E.push(`File target has ${c.callableCount} callable symbols; use one callable name for compiler-resolved flow.`);let F=[...new Set(r.referencedBy.map(m=>m.relativePath))];F.length>0&&F.every(m=>$(m)==="test")&&E.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."),!g.symbol&&!g.file&&!g.module&&E.push("No symbol, file, or module matched target.");let O=h?.file??r.definitions[0]?.relativePath??null;return{target:e,...c?.primary?{primaryCallable:{symbol:c.primary.symbol,shortName:P(c.primary.symbol),file:c.primary.relativePath}}:{},matched:g,history:f("history",O??e,()=>ge(n,O,o.gitHead)),trace:pe(r),callGraph:C,complexity:R,dataflow:t,backwardSlice:d,forwardSlice:s,affected:p,changeSurface:h,deps:B,rdeps:k,system:x,surface:N,reuseCandidates:b,affectedConsumerReuse:y,sourcePacket:be(n,i,r,y,b),warnings:E}}function ye(n,e,o,l,a){let u=o.semantic,c=e?f("trace",e,()=>ne(n,e,{semantic:u,referenceContext:fe}),i=>({definitions:i.definitions.length,references:i.referencedBy.length})):{definitions:[],referencedBy:[],claimSupport:null},S=e?f("call-graph",e,()=>H(n,e,{semantic:u}),i=>({callers:i?.callers.length??0,callees:i?.callees.length??0})):null,r=e?f("complexity",e,()=>J(n,e,{semantic:u}),i=>({callees:i?.calleeCount??0})):null,C=e?f("dataflow",e,()=>Q(n,e,{semantic:u}),i=>({references:i?.usageSites.length??0,producers:i?.producers.length??0,consumers:i?.consumers.length??0})):null,R=e?f("backward-slice",e,()=>D(n,e,{direction:"backward",maxDepth:a,semantic:u}),i=>({maxDepth:a,connectedSymbols:i?.connectedSymbols.length??0})):null,t=e?f("forward-slice",e,()=>D(n,e,{direction:"forward",maxDepth:a,semantic:u}),i=>({maxDepth:a,connectedSymbols:i?.connectedSymbols.length??0})):null,d=e?f("affected",e,()=>G(n,e,{maxDepth:l,scope:o.scope}),i=>({maxDepth:l,affectedSymbols:i.length})):[],s=e?f("reuse-candidates",e,()=>w(n,e,{minSimilarity:.4,limit:5,semantic:u,sourceCandidateMode:"target-pruned"}),i=>({candidates:i.length,direct:i.filter(y=>y.actionTier==="direct").length})):[],p=e?j(n,e)?.symbol??null:null,b=e?f("affected-consumer-reuse",e,()=>Se(c,p,i=>w(n,i,{minSimilarity:.4,limit:I,semantic:u,sourceCandidateMode:"target-pruned"}),{consumerLimit:me,perConsumerSearchLimit:I,perConsumerCandidateLimit:M,candidateLimit:T}),i=>({totalConsumers:i.coverage.totalConsumers,analyzedConsumers:i.coverage.analyzedConsumers,candidates:i.candidates.length})):Le();return{traceResult:c,callGraphResult:S,complexityResult:r,dataflowResult:C,backwardSliceResult:R,forwardSliceResult:t,affectedResults:d,reuseCandidates:s,targetSymbol:p,affectedConsumerReuse:b}}function pe(n){return{definitions:n.definitions,referencedBy:n.referencedBy.map(e=>({relativePath:e.relativePath,line:e.line,enclosingSymbol:e.enclosingSymbol,enclosingShort:e.enclosingShort}))}}function Ce(n,e){let o=K(n,e);if(o.length!==1)return{primary:null,callableCount:0};let l=A(n,o[0]).filter(c=>c.isFunctionLike),a=l.filter(c=>c.enclosingSymbol===null),u=a.length>0?a:l;return{primary:u.length===1?u[0]:null,callableCount:u.length}}function be(n,e,o,l,a){let u=[...e?[{definition:ae(n,e),role:"target"}]:[],...[...l.candidates.map(t=>t.candidate),...a].map(t=>({definition:ae(n,t.symbolB),role:"reuse-candidate"}))],c=new Map;for(let t of se(u)){if(c.has(t.definition.symbol))continue;let d=t.role==="target"?_:le,s=t.definition.endLine<=t.definition.startLine?Z(n,t.definition.relativePath,t.definition.startLine,d):null,p=s?.unitType?s.source:V(n,t.definition);if(!p)continue;let b=p.split(`
2
2
  `),i=Math.min(b.length,d),y=s?.unitType?s.startLine:t.definition.startLine;c.set(t.definition.symbol,{role:t.role,symbol:t.definition.symbol,shortName:P(t.definition.symbol),file:t.definition.relativePath,startLine:y,endLine:y+i-1,source:b.slice(0,i).join(`
3
3
  `),omittedLines:(s?.unitType?s.omittedLines:0)+Math.max(0,b.length-i)})}let S=new Map;for(let t of o.referencedBy){if(t.source===void 0||t.source===null||t.sourceStartLine===void 0||t.sourceStartLine===null||t.sourceEndLine===void 0||t.sourceEndLine===null)continue;let d=`${t.relativePath}:${t.sourceStartLine}-${t.sourceEndLine}`,s=S.get(d);if(s){s.focusLines=[...new Set([...s.focusLines??[],t.line])].sort((p,b)=>p-b);continue}S.set(d,{role:"consumer",symbol:t.enclosingSymbol??`${t.relativePath}:${t.line}`,shortName:t.enclosingShort,file:t.relativePath,startLine:t.sourceStartLine,endLine:t.sourceEndLine,source:t.source,omittedLines:0,focusLines:[t.line]})}let r=[...[...c.values()].filter(t=>t.role==="target"),...S.values(),...[...c.values()].filter(t=>t.role==="reuse-candidate")],C=[],R=ce;for(let t of r){if(C.length>=re||R<=0)break;let d=t.source.split(`
4
4
  `),s=Math.min(d.length,R);C.push({...t,endLine:t.startLine+s-1,source:d.slice(0,s).join(`
5
5
  `),omittedLines:t.omittedLines+Math.max(0,d.length-s),...t.focusLines?{focusLines:t.focusLines.filter(p=>p<=t.startLine+s-1)}:{}}),R-=s}return{slices:C,candidateSlices:r.length,omittedSlices:Math.max(0,r.length-C.length),maxSlices:re,maxLinesPerSlice:_,maxTotalLines:ce,targetLineLimit:_,consumerContextLines:fe,reuseLineLimit:le}}function ae(n,e){let o=z(n,e);return o?A(n,o.relativePath).find(l=>l.symbol===e)??null:null}function Se(n,e,o,l={}){let a=v(l.consumerLimit,me),u=v(l.perConsumerSearchLimit,I),c=v(l.perConsumerCandidateLimit,M),S=v(l.candidateLimit,T),r=Re(n),C=r.slice(0,a),R=new Set(r.map(s=>s.symbol));e&&R.add(e);let t=new Map;for(let s of C){let p=o(s.symbol).slice(0,u),b=0;for(let i of p){let y=he(i,s.symbol);if(!y||R.has(y.symbolB))continue;let h=t.get(y.symbolB);if(h?(h.consumers.some(x=>x.symbol===s.symbol)||h.consumers.push(s),y.similarity>h.candidate.similarity&&(h.candidate=y)):t.set(y.symbolB,{candidate:y,consumers:[s]}),b+=1,b>=c)break}}let d=[...t.values()].filter(s=>s.candidate.actionTier==="direct"||s.candidate.similarity>=de||s.consumers.length>1).sort(xe).slice(0,S);return{candidates:d,coverage:{totalConsumers:r.length,analyzedConsumers:C.length,omittedConsumers:Math.max(0,r.length-C.length),perConsumerSearchLimit:u,perConsumerCandidateLimit:c,candidateLimit:S,returnedCandidates:d.length}}}function Re(n){let e=new Map;for(let o of n.referencedBy){if(!o.enclosingSymbol)continue;let l=e.get(o.enclosingSymbol);if(l){l.referenceCount+=1;continue}e.set(o.enclosingSymbol,{symbol:o.enclosingSymbol,shortName:P(o.enclosingSymbol)||o.enclosingShort,file:o.relativePath,referenceCount:1})}return[...e.values()].sort((o,l)=>l.referenceCount-o.referenceCount||o.symbol.localeCompare(l.symbol))}function he(n,e){return n.symbolA===e?n:n.symbolB!==e?null:{...n,symbolA:n.symbolB,shortNameA:n.shortNameB,fileA:n.fileB,symbolB:n.symbolA,shortNameB:n.shortNameA,fileB:n.fileA,uniqueToA:n.uniqueToB,uniqueToB:n.uniqueToA}}function xe(n,e){let o=ue(e.candidate.actionTier)-ue(n.candidate.actionTier);if(o!==0)return o;let l=e.consumers.length-n.consumers.length;if(l!==0)return l;let a=e.candidate.similarity-n.candidate.similarity;return a!==0?a:n.candidate.symbolB.localeCompare(e.candidate.symbolB)}function ue(n){return n==="direct"?1:0}function v(n,e){return typeof n=="number"&&Number.isFinite(n)?Math.max(1,Math.floor(n)):e}function Le(){return{candidates:[],coverage:{totalConsumers:0,analyzedConsumers:0,omittedConsumers:0,perConsumerSearchLimit:I,perConsumerCandidateLimit:M,candidateLimit:T,returnedCandidates:0}}}function f(n,e,o,l=()=>({})){let a;return U(`context.${n}`,()=>(a=o(),a),()=>({target:e,...l(a)}))}function ge(n,e,o){let l={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return l;let a=X(n,o?{head:o}:{}),u=f("history.churn",e,()=>a.fileChurn(),r=>({files:r?.size??0}));if(!u)return l;let c=f("history.co-change",e,()=>Y(n,e,{limit:5,...o?{head:o}:{}}),r=>({commits:r.commitsAnalyzed,partners:r.findings.length})),S=f("history.suppressions",e,()=>te(n).byFile.get(e)??0,r=>({suppressions:r}));return{available:!0,file:e,churn:u.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:c.findings.map(r=>({file:r.fileA===e?r.fileB:r.fileA,together:r.together,confidence:r.confidence,subjectContext:r.subjectContext})),suppressionsInFile:S}}function Ee(n){return n.includes("/")||n.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(n)}export{Ze as a,Se as b};
6
- //# sourceMappingURL=chunk-I6UTXNHU.js.map
6
+ //# sourceMappingURL=chunk-VNLGKHS6.js.map
@@ -1,2 +1,2 @@
1
- import{c as f}from"./chunk-PLYUVM4F.js";import{a as L}from"./chunk-5H5WTJSD.js";import{d as i,e as b,f as u,l as c}from"./chunk-TD7VKJ2Y.js";import{m as l}from"./chunk-42W3LFUK.js";import{z as a}from"./chunk-7JYHQAH2.js";function S(o,s){let t=L(o,s);if(!t)return[];let e=new f(o).definitionsForFile(t.relativePath).filter(r=>r.symbol!==t.symbol).filter(r=>c(t.symbol,r.symbol)).sort((r,m)=>r.startLine-m.startLine||r.endLine-m.endLine).map(r=>({symbol:r.symbol,shortName:i(r.symbol),startLine:r.startLine,endLine:r.endLine,kind:u(r.symbol)??"unknown"}));return a(t.relativePath)!=="clojure"?e:d(e,y(o,t))}function y(o,s){let t=b(s.symbol);if(!t)return[];let n=i(s.symbol);return(l(o,s.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({symbol:`${s.symbol}${e.memberName}().`,shortName:`${n}:${e.memberName}()`,startLine:e.startLine,endLine:e.endLine,kind:e.memberKind}))}function d(o,s){let t=new Map;for(let n of[...o,...s])t.set(`${n.shortName}:${n.startLine}:${n.endLine}`,n);return[...t.values()].sort((n,e)=>n.startLine-e.startLine||n.endLine-e.endLine)}export{S as a};
2
- //# sourceMappingURL=chunk-44T4DUAA.js.map
1
+ import{c as f}from"./chunk-CJZXN4NU.js";import{a as L}from"./chunk-OSSESPDX.js";import{d as i,e as b,f as u,l as c}from"./chunk-N2ZSIIGR.js";import{n as l}from"./chunk-ODDUPDP7.js";import{z as a}from"./chunk-ZOHS7AQV.js";function S(o,s){let t=L(o,s);if(!t)return[];let e=new f(o).definitionsForFile(t.relativePath).filter(r=>r.symbol!==t.symbol).filter(r=>c(t.symbol,r.symbol)).sort((r,m)=>r.startLine-m.startLine||r.endLine-m.endLine).map(r=>({symbol:r.symbol,shortName:i(r.symbol),startLine:r.startLine,endLine:r.endLine,kind:u(r.symbol)??"unknown"}));return a(t.relativePath)!=="clojure"?e:d(e,y(o,t))}function y(o,s){let t=b(s.symbol);if(!t)return[];let n=i(s.symbol);return(l(o,s.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({symbol:`${s.symbol}${e.memberName}().`,shortName:`${n}:${e.memberName}()`,startLine:e.startLine,endLine:e.endLine,kind:e.memberKind}))}function d(o,s){let t=new Map;for(let n of[...o,...s])t.set(`${n.shortName}:${n.startLine}:${n.endLine}`,n);return[...t.values()].sort((n,e)=>n.startLine-e.startLine||n.endLine-e.endLine)}export{S as a};
2
+ //# sourceMappingURL=chunk-VQILFTEH.js.map
@@ -1,13 +1,13 @@
1
- import{a as Z}from"./chunk-JFQBRL3J.js";import{p as gt}from"./chunk-AYPDH2LU.js";import{d as ht}from"./chunk-KK7GPALL.js";import{b as yt}from"./chunk-Q6T2CAJL.js";import{A as xe,t as _}from"./chunk-TD7VKJ2Y.js";import{a as ge,f as be,g as k,h as D,j as M,k as lt,l as X,m as dt,q as pt,r as ft,w as mt,x as j}from"./chunk-42W3LFUK.js";import{A as st,C as O,D as ut,G as ct,N as Se,z as ve}from"./chunk-7JYHQAH2.js";import{A as ot,B as he,C as Me,c as Q,i as re,w as ie,y as ae}from"./chunk-Q7GBK5T7.js";function Re(e){let t=e.replaceAll("\\","/");return yt(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 mn from"better-sqlite3";var Ne="scip_query_runtime_boundaries",W="scip_query_runtime_observations",Be="scip_query_runtime_relation_groups",Ie="scip_query_runtime_relation_participants";function yn(e,t){let n=new mn(e);try{n.exec(`
1
+ import{a as Z}from"./chunk-WOIKCX6A.js";import{p as vt}from"./chunk-DYGHBZ2N.js";import{d as gt}from"./chunk-KK7GPALL.js";import{b as ht}from"./chunk-NJITK2GP.js";import{A as xe,t as _}from"./chunk-N2ZSIIGR.js";import{a as ge,f as be,g as k,h as D,j as M,k as lt,l as X,n as pt,r as mt,s as ft,x as yt,y as G}from"./chunk-ODDUPDP7.js";import{A as st,B as ut,D as O,E as ct,G as dt,N as Se,z as ve}from"./chunk-ZOHS7AQV.js";import{c as ie,e as ae,g as ot,h as he,i as Me}from"./chunk-FESCRNVV.js";import{c as Q,i as re}from"./chunk-JWTGMPIT.js";function Re(e){let t=e.replaceAll("\\","/");return ht(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 yn from"better-sqlite3";var Ne="scip_query_runtime_boundaries",W="scip_query_runtime_observations",Be="scip_query_runtime_relation_groups",Ie="scip_query_runtime_relation_participants";function hn(e,t){let n=new yn(e);try{n.exec(`
2
2
  CREATE TABLE IF NOT EXISTS ${Ne} (
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
- `),gn(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${Ne} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${W}`).run(),n.prepare(`DELETE FROM ${Ie}`).run(),n.prepare(`DELETE FROM ${Be}`).run();let r=n.prepare(`INSERT INTO ${W}
8
+ `),vn(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${Ne} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${W}`).run(),n.prepare(`DELETE FROM ${Ie}`).run(),n.prepare(`DELETE FROM ${Be}`).run();let r=n.prepare(`INSERT INTO ${W}
9
9
  (id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
10
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let s of t.observations)r.run(s.id,s.protocol,s.action,s.role,s.strength,s.sourceScope,s.resolution,s.source.file,s.source.startLine,s.source.endLine,s.owner.symbol,JSON.stringify(s));let i=n.prepare(`INSERT INTO ${Be} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),a=n.prepare(`INSERT INTO ${Ie} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let s of t.relationGroups){i.run(s.id,s.protocol,s.joinRule,s.normalizedKey,JSON.stringify(s));for(let o of s.producerIds)a.run(s.id,o,"producer");for(let o of s.consumerIds)a.run(s.id,o,"consumer");for(let o of s.declarationIds)a.run(s.id,o,"declaration")}})()}finally{n.close()}}function hn(e,t={}){if(!vn(e,W))return vt(e)?.observations??[];let n=[],r=[];return Ce(n,r,"protocol",t.protocols),Ce(n,r,"action",t.actions),Ce(n,r,"source_scope",t.sourceScopes),Ce(n,r,"file",t.files),e.all(`SELECT payload FROM ${W}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(a=>bn(a.payload))}function gn(e){e.exec(`
10
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let s of t.observations)r.run(s.id,s.protocol,s.action,s.role,s.strength,s.sourceScope,s.resolution,s.source.file,s.source.startLine,s.source.endLine,s.owner.symbol,JSON.stringify(s));let i=n.prepare(`INSERT INTO ${Be} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),a=n.prepare(`INSERT INTO ${Ie} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let s of t.relationGroups){i.run(s.id,s.protocol,s.joinRule,s.normalizedKey,JSON.stringify(s));for(let o of s.producerIds)a.run(s.id,o,"producer");for(let o of s.consumerIds)a.run(s.id,o,"consumer");for(let o of s.declarationIds)a.run(s.id,o,"declaration")}})()}finally{n.close()}}function gn(e,t={}){if(!bn(e,W))return bt(e)?.observations??[];let n=[],r=[];return Ce(n,r,"protocol",t.protocols),Ce(n,r,"action",t.actions),Ce(n,r,"source_scope",t.sourceScopes),Ce(n,r,"file",t.files),e.all(`SELECT payload FROM ${W}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(a=>Sn(a.payload))}function vn(e){e.exec(`
11
11
  CREATE TABLE IF NOT EXISTS ${W} (
12
12
  id TEXT PRIMARY KEY,
13
13
  protocol TEXT NOT NULL,
@@ -45,13 +45,13 @@ import{a as Z}from"./chunk-JFQBRL3J.js";import{p as gt}from"./chunk-AYPDH2LU.js"
45
45
  );
46
46
  CREATE INDEX IF NOT EXISTS idx_runtime_participants_observation
47
47
  ON ${Ie}(observation_id, participant_role);
48
- `)}function vn(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function Ce(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function bn(e){try{return[JSON.parse(e)]}catch{return[]}}function vt(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",Ne))return null;let n=e.get(`SELECT schema_version, payload FROM ${Ne} 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 me}from"crypto";import{setImmediate as Wr}from"timers/promises";import{createRequire as Yr}from"module";import{createHash as An}from"crypto";var Pe=8;function ee(e,t,n){return je(bt(e,t,Ue(n),0,new Set))}function ze(e,t,n){return He(e,t,n,0,new Set)}function bt(e,t,n,r,i){if(r>Pe)return[];let a=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return a?St(e,t,a[1],a[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?xt(e,t,n,r,i):[]}function St(e,t,n,r,i,a){let s=[];for(let o of He(e,t,n,i+1,new Set(a))){let l=M(o.initializer);for(let u of l.namedChildren){if(u.type==="pair"){let d=u.childForFieldName("key")??u.namedChild(0);if(Nn(d)!==r)continue;let c=u.childForFieldName("value")??u.namedChild(1);c&&s.push(...bt(e,o.definition.relativePath,Ue(c.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 c=Rn(e,o.definition.relativePath,r,u);s.push(...c.length>0?c:[Sn(o.definition,r,u)]);continue}if(u.type==="spread_element"){let d=u.namedChild(0);if(!d)continue;for(let c of He(e,o.definition.relativePath,Ue(d.text),i+1,new Set(a)))s.push(...St(e,c.definition.relativePath,c.definition.leaf,r,i+1,new Set(a)))}}}return je(s)}function Sn(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 He(e,t,n,r,i){return r>Pe||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:xt(e,t,n,r,i).flatMap(a=>{let s=O(e,a.relativePath)?.rootNode,o=s?Cn(s,a.leaf):null;return o?[{definition:a,initializer:o}]:[]})}function xt(e,t,n,r,i){if(r>Pe)return[];let a=`${t}\0${n}`;if(i.has(a))return[];i.add(a);let s=_(e,t).filter(u=>u.leaf===n);if(s.length>0)return s;let o=xn(e,t,n);if(o.length>0)return o;let l=j(e,t).find(u=>u.localName===n&&u.sourcePath);if(l?.sourcePath){let u=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return Ve(e,l.sourcePath,u,r+1,new Set(i))}return Ve(e,t,n,r+1,new Set(i))}function xn(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(dt(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 Ve(e,t,n,r,i){if(r>Pe)return[];let a=_(e,t).filter(s=>s.leaf===n);return a.length>0?a:je(mt(e,t).flatMap(s=>s.sourcePath?s.kind==="named"&&!s.names.includes(n)?[]:Ve(e,s.sourcePath,n,r+1,new Set(i)):[]))}function Rn(e,t,n,r){return _(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Cn(e,t){let n=null;return k(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 Nn(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ue(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function je(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}var Bn=8;function V(e,t){return t?te(e,t,0,new Set):null}function te(e,t,n,r){if(n>Bn)return U(t,"value-evaluation-depth");let i=M(t),a=Tn(i);if(a)return _n(e.file,i,a.term,a.value,a.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(u=>te(e,u,n+1,new Set(r)));if(l.length>=2&&l.every(u=>u!==null)){let u={kind:"concat",parts:l.map(c=>c.term)},d=l.map(c=>c.value).join("");return $n(e.file,i,u,d,l.some(c=>c.precision!=="literal")?"constrained-pattern":"literal",l)}}let s=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))return En(e,s,i,n,r);let o=Ln(i);return o?Fn(e,o.base,o.properties,i,n,r):i.type==="call_expression"||i.type==="call"?In(e,i,n,r):U(i,`unsupported-expression:${i.type}`)}function In(e,t,n,r){let a=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",s=Pn(e,a);if(s.length!==1)return U(t,s.length===0?"call-target-unresolved":"call-target-ambiguous");let o=s[0],l=`${o.relativePath}\0${o.symbol}`;if(r.has(l))return U(t,"call-return-cycle");let u=O(e.db,o.relativePath)?.rootNode;if(!u)return U(t,"call-target-unparsed");let d=D(u,o.startLine,o.endLine);if(!d)return U(t,"call-target-syntax-unavailable");let c=wn(d);if(!c)return U(t,"call-return-not-single-expression");let p=new Set(r);p.add(l);let f=te({db:e.db,file:o.relativePath,root:u},c,n+1,p);return f?we(t,"bounded-call-return",f,o.symbol):U(t,"call-return-unresolved")}function Pn(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=_(e.db,e.file).filter(s=>s.isFunctionLike&&s.leaf===t);if(i.length>0)return i;let a=j(e.db,e.file).find(s=>s.localName===t&&s.sourcePath&&s.kind!=="namespace");return a?.sourcePath?Z(e.db,a.sourcePath,a.importedName==="default"?t:a.importedName).filter(s=>s.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=j(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 wn(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return Ct(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function Ct(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)Ct(e,r,n)}}function En(e,t,n,r,i){let a=`${e.file}\0${t}`;if(i.has(a))return U(n,"value-cycle");i.add(a);let s=Ge(e.root,t);if(s){let g=te(e,s,r+1,i);return g?we(n,"local-constant",g):U(n,"non-foldable-local")}let o=j(e.db,e.file).find(g=>g.localName===t&&g.sourcePath);if(!o?.sourcePath)return H(n,t,"unresolved-identifier");if(o.kind==="namespace")return H(n,t,"namespace-import-requires-property");let l=o.importedName==="default"?t:o.importedName,u=Z(e.db,o.sourcePath,l);if(u.length!==1)return H(n,t,u.length===0?"import-definition-missing":"import-definition-ambiguous");let d=u[0],c=O(e.db,d.relativePath)?.rootNode;if(!c)return H(n,d.symbol,"import-definition-unparsed");let p=Ge(c,d.leaf);if(!p)return H(n,d.symbol,"import-definition-non-value");let f=te({db:e.db,file:d.relativePath,root:c},p,r+1,i);return f?we(n,"imported-constant",f,d.symbol):H(n,d.symbol,"import-value-unresolved")}function Fn(e,t,n,r,i,a){let s=j(e.db,e.file).find(f=>f.localName===t&&f.sourcePath),o=e.file,l=t,u;if(s?.sourcePath){s.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=s.importedName==="default"?t:s.importedName;let f=Z(e.db,s.sourcePath,l);if(f.length!==1)return H(r,`${t}.${n.join(".")}`,f.length===0?"member-definition-missing":"member-definition-ambiguous");o=f[0].relativePath,l=f[0].leaf,u=f[0].symbol}let d=o===e.file?e.root:O(e.db,o)?.rootNode;if(!d)return H(r,u??t,"member-definition-unparsed");let c=Ge(d,l);if(!c)return H(r,u??t,"member-base-non-value");for(let f of n){let g=M(c);if(c=On(g,f),!c)return H(r,u??`${t}.${n.join(".")}`,`member-property-missing:${f}`)}let p=te({db:e.db,file:o,root:d},c,i+1,a);return p?we(r,"member-constant",p,u):H(r,u??t,"member-value-unresolved")}function Tn(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,s=/\$\{([^}]*)\}/gu;for(let o of r.matchAll(s)){let l=o.index??0;l>a&&i.push({kind:"literal",value:r.slice(a,l)}),i.push({kind:"unknown",reason:`template-hole:${o[1]?.trim()||"expression"}`}),a=l+o[0].length}return a<r.length&&i.push({kind:"literal",value:r.slice(a)}),{term:{kind:"pattern",language:"template",value:r.replace(s,"{}")},value:r.replace(s,"{}"),precision:"constrained-pattern"}}function _n(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Ee("direct-literal","direct",e,t)}}function $n(e,t,n,r,i,a){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Ee("constant-concatenation","mechanically-derived",e,t),inputFactIds:a.flatMap(s=>s.derivation.inputFactIds),sourceSpans:a.flatMap(s=>s.derivation.sourceSpans)}}}function we(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 H(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Ee(n,"heuristic","",e)}}function U(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Ee(t,"heuristic","",e)}}function Ee(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 Ln(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}var Rt=new WeakMap;function kn(e){let t=Rt.get(e);if(t)return t;let n=new Map;return k(e,r=>{if(r.type!=="variable_declarator")return;let a=(r.childForFieldName("name")??r.namedChild(0))?.text.trim();if(!a||n.has(a))return;let s=r.parent;if(!s||s.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(s.text))return;let o=r.childForFieldName("value")??r.namedChild(1);o&&n.set(a,o)}),Rt.set(e,n),n}function Ge(e,t){return kn(e).get(t)??null}function On(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}var Dn=new WeakMap,Tt=new Set(["delete","get","head","options","patch","post","put"]),Mn=/(?:^|\.)(?:app|router|server)$/u,Hn=new Set(["findFirst","findMany","findUnique","from","get","select"]),Vn=new Set(["create","delete","insert","remove","update","upsert"]),Un=new Set(["execute","query","raw"]),Nt=/(?:\b(?:name|id)|['"`](?:name|id)['"`])\s*:/u,Bt=/(?:^\s*|[,{]\s*)(?:async\s+)?['"`]?(?:execute|handler|invoke|run)['"`]?\s*(?::|\([^)]*\)\s*\{)/mu,It=/\b[A-Za-z_$][\w$-]*[_-][\w$-]*\s*\(/u,Pt=/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s+[A-Za-z_$][\w$-]*\s*\(/iu,Xe=[qn(),Gn(),zn(),Kn(),Zn(),Wn(),Jn()],Ke=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function zn(){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=jn(e.source),n=[];return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=t.direct.get(i),s=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),o=s&&t.namespaces.has(s[1])?s[2]:null,l=a??o;if(!l||!Ke.has(l))return;let u=Y(r),d=A(u[0],e)??{value:u[0]?.text.trim()||"<missing>",evidence:"expression"},c=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(T(e,r,"builtin.node-child-process",c,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...d}],"exact","node-child-process-import"))}),n}}}function jn(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 d=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[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 d=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[1])}let s=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(s))n.add(l[1]);let o=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(o))n.add(l[1]);return{direct:t,namespaces:n}}function L(e,t,n,r){let i=oe(r,"runtime-boundaries.context.ast",t,()=>n===void 0?O(e,t):ut(e,t,n));if(!i)return null;let a=i.rootNode;n!==void 0&&Dn.set(a,i);let s=n??he(e,t),o,l,u,d=()=>(l!==void 0||(l=oe(r,"runtime-boundaries.context.callable-sites",t,()=>{let c=ve(t);return(c?ft(a,c):null)??pt(e,t)})),l);return{db:e,file:t,source:s,root:a,get constants(){return u??=oe(r,"runtime-boundaries.context.constants",t,()=>ir(a)),u},ownerAt:c=>{let f=(o??=oe(r,"runtime-boundaries.context.definitions",t,()=>_(e,t,{rangeCorrectionEvidence:{source:s,callables:d()}},(m,y)=>oe(r,`runtime-boundaries.context.definitions.${m}`,t,y)))).filter(m=>m.startLine<=c&&m.endLine>=c).sort((m,y)=>m.endLine-m.startLine-(y.endLine-y.startLine)||m.startLine-y.startLine)[0];if(f)return{file:t,symbol:f.symbol,name:f.leaf,startLine:f.startLine,endLine:f.endLine};let b=(d()??[]).filter(m=>m.startLine<=c&&m.endLine>=c).sort((m,y)=>m.endLine-m.startLine-(y.endLine-y.startLine)||m.startLine-y.startLine)[0];return{file:t,symbol:null,name:b?.name??null,startLine:b?.startLine??c,endLine:b?.endLine??c}}}}function oe(e,t,n,r){return e?e(t,r,{file:n}):r()}function Gn(){return{id:"builtin.effect-httpapi",supports:e=>se(e,"HttpApiEndpoint").size>0||se(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=se(e.source,"HttpApiEndpoint"),r=se(e.source,"HttpApiGroup"),i=se(e.source,"HttpApiBuilder");return q(e.root,"call_expression",a=>{let s=_t(a);if(!s)return;let o=Y(a);if(n.has(s.receiver)&&Tt.has(s.member)){let b=A(o[0],e),m=A(o[1],e),y=Et(a,r,"make",0,e);if(!b||!m||!y)return;let v=s.member.toUpperCase();t.push(T(e,a,"builtin.effect-httpapi","http.handle",[{name:"method",value:v,evidence:"literal"},{name:"path",...m}],z([{name:"path",...m}]),"effect-httpapi-endpoint-declaration")),t.push(T(e,a,"builtin.effect-httpapi","framework.declare",qe(y,b),z(qe(y,b)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(s.member))return;let l=Et(a,i,"group",1,e),u=A(o[0],e),d=o[1];if(!l||!u||!d)return;let c=qe(l,u),p=ee(e.db,e.file,d.text),f=T(e,a,"builtin.effect-httpapi","framework.handle",c,p.length===1?z(c):"candidate","effect-httpapi-handler-registration"),g=p[0];p.length===1&&g&&(f.owner={file:g.relativePath,symbol:g.symbol,name:g.leaf,startLine:g.startLine,endLine:g.endLine}),t.push(f)}),t}}}function qe(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function se(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(r)){let s=a[2]??"";if(wt(s))for(let o of(a[1]??"").split(",")){let l=o.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 s=a[2]??"";s.endsWith(`/${t}`)&&wt(s)&&n.add(a[1])}return n}function wt(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function Et(e,t,n,r,i){let a=e.parent;for(;a;){if(a.type==="call_expression"){let s=Ft(a,t,n,r,i);if(s)return s;let o=a.childForFieldName("function")??a.namedChild(0),l=null;if(o&&We(o,u=>{!l&&u.type==="call_expression"&&(l=Ft(u,t,n,r,i))}),l)return l}a=a.parent}return null}function Ft(e,t,n,r,i){let a=_t(e);return!a||a.member!==n||!t.has(a.receiver)?null:A(Y(e)[r],i)}function _t(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 qn(){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)||le(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return q(e.root,["decorator","call_expression"],n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!le(e.source,["fastapi","flask"]))return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=ue(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",a=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",s=Y(n);if(i==="route"&&le(e.source,["axum"])){let p=A(s[0],e),f=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(s[1]?.text??"")?.[1];if(!p||!f)return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:f.toUpperCase(),evidence:"literal"},{name:"path",...p}],z([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=A(s[0],e);if(!p)return;let g=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(s[1]?.text??"")?.[1]?.toUpperCase()??(s[1]?null:"GET"),b=[...g?[{name:"method",value:g,evidence:"literal"}]:[],{name:"path",...p}];t.push(T(e,n,"builtin.http","http.request",b,g?z(b):"candidate","call-expression"));return}if(!Tt.has(i))return;let o=A(s[0],e);if(!o)return;let l=i.toUpperCase();if(Mn.test(a)&&le(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"framework-adapter"));return}let d=tr(e.source,["axios"]),c=a.split(".")[0]??"";d.has(c)&&t.push(T(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"client-adapter"))}),t}}}function Kn(){return{id:"builtin.capability-registry",supports:e=>Nt.test(e)&&Bt.test(e)||It.test(e)||Pt.test(e),extract:e=>{let t=[],n=new Set,r=[];return Nt.test(e.source)&&Bt.test(e.source)&&r.push("pair"),(It.test(e.source)||Pt.test(e.source))&&r.push("string","string_literal","template_string"),q(e.root,r,i=>{if(i.type==="pair"){let s=i.childForFieldName("key")??i.namedChild(0),o=i.childForFieldName("value")??i.namedChild(1),l=s?.text.replace(/^['"`]|['"`]$/gu,"");if(l!=="name"&&l!=="id")return;let u=$t(o,e),d=or(i);if(!u||u.evidence!=="literal"||!d)return;let c=`handle\0${u.value}\0${d.startPosition.row}`;if(n.has(c))return;n.add(c),t.push(T(e,d,"builtin.capability-registry","registry.handle",[{name:"key",...u}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(i.type))return;let a=i.text.replace(/^['"`]|['"`]$/gu,"");for(let s of a.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let o=s[1];if(!Xn(a,o,s.index))continue;let l=`reference\0${o}\0${i.startPosition.row}`;n.has(l)||(n.add(l),t.push(T(e,i,"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 Zn(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return q(e.root,["pair","call_expression"],n=>{if(n.type==="pair"){let a=ar(n);if(!a)return;let s=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),l=$t(s,e);if(!l||!o||!Lt(o))return;let u=Ze(o)?"exact":"candidate";t.push(T(e,n,"builtin.registry","registry.handle",[{name:"registry",value:a,evidence:"identifier"},{name:"key",...l}],z([{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(T(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 Wn(){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=lr(e.root);return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=i.split("."),s=a.at(-1)??"",o=Y(r),l=o[0]?.text??"",u=sr(s,l);if(!u)return;let d=kt(a,n);if(!d)return;let c=Yn(o[0],e)??ur(l),p=cr(d,a,s,c);if(!p)return;let f=s==="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(T(e,r,"builtin.persistence",u,[{name:"resource",...p}],z([{name:"resource",...p}]),f))}),t}}}function Yn(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}}:A(e,t)}function Jn(){return{id:"builtin.queue",supports:e=>le(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return q(e.root,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".").at(-1)??"",a=Y(n),s=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!s)return;let o=i==="send"||i==="subscribe"?nr(a[0],"topic",e):A(a[0],e);o&&t.push(T(e,n,"builtin.queue",s,[{name:"address",...o}],z([{name:"address",...o}]),"framework-adapter"))}),t}}}function T(e,t,n,r,i,a,s){let o=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${An("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:o,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:s,strength:a,protocol:r.split(".")[0]??r,role:Qn(r),executionDomain:er(e.file),derivation:{kind:a==="candidate"?"heuristic":a==="derived"?"mechanically-derived":"direct",rule:s,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:Re(e.file)}}function Qn(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 er(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function le(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 tr(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 s of e.matchAll(a)){let o=s[1]??s[2];o&&n.add(o)}}return n}function Fe(e,t,n,r,i,a,s){return T(e,t,n,r,i,a,s)}function ue(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function Y(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function A(e,t){let n=V(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function nr(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 A(i,n)}function $t(e,t){if(!e)return null;let n=A(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 z(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function rr(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 ir(e){let t=new Map;return We(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=rr(i);a!==null&&t.set(r.text,a)}),t}function ar(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 Ze(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function Lt(e){return Ze(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function or(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),s=i?.text.replace(/^['"`]|['"`]$/gu,"");if(s&&["execute","handler","invoke","run"].includes(s)&&a&&Lt(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 kt(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 sr(e,t){if(Hn.has(e))return"database.read";if(Vn.has(e))return"database.write";if(!Un.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 lr(e){let t=new Set;return q(e,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!kt(i)))for(let a of Y(n)){if(!Ze(a))continue;let o=(a.childForFieldName("parameters")??a.namedChildren.find(u=>/parameters/u.test(u.type)))?.namedChildren[0],l=o?lt(o):null;l&&t.add(l)}}),t}function ur(e){let t=Ot(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function cr(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=Ot(r.value);return i?{value:i,evidence:r.evidence}:null}function Ot(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function We(e,t){t(e);for(let n of e.namedChildren)We(n,t)}function q(e,t,n){for(let r of be(e,t))n(r)}var dr=Q("resolved-call-syntax",{clearGroups:[]}),Ye=Q("resolved-call-sites",{clearGroups:[]}),pr=Q("resolved-call-sites-reference-evidence",{clearGroups:[]});function Je(e,t){return Ye.get(e,t.symbolId,()=>Dt(e,t,fr(e,t)))}function At(e,t){let n=[...new Map(t.map(a=>[a.symbolId,a])).values()],r=n.filter(a=>!Ye.has(e,a.symbolId)),i=Mt(e,r);return new Map(n.map(a=>[a.symbolId,Ye.get(e,a.symbolId,()=>Dt(e,a,i.get(a.symbolId)??[]))]))}function Dt(e,t,n){let r=[],i=[],a=new Set,s=new Set;for(let o of n){a.add(o.file);let l=dr.get(e,o.file,()=>yr(e,o.file));if(!l){i.push({callee:t,file:o.file,line:o.startLine,reason:"ast-unavailable",candidates:0,referenceProvenance:o.provenance});continue}let u=(l.byLeaf.get(t.leaf)??[]).filter(({callNode:p})=>p.startPosition.row<=o.endLine&&p.endPosition.row>=o.startLine);if(u.length!==1){i.push({callee:t,file:o.file,line:o.startLine,reason:u.length===0?"call-not-found":"ambiguous-call",candidates:u.length,referenceProvenance:o.provenance});continue}let d=u[0],c=`${o.file}\0${d.callNode.startIndex}\0${d.callNode.endIndex}`;s.has(c)||(s.add(c),r.push({callee:t,caller:xe(_(e,o.file),d.callNode.startPosition.row),file:o.file,line:d.callNode.startPosition.row,startLine:d.callNode.startPosition.row,endLine:d.callNode.endPosition.row,targetText:d.targetNode.text,callNode:d.callNode,targetNode:d.targetNode,arguments:d.arguments,referenceProvenance:o.provenance}))}return{sites:r,unresolved:i,filesVisited:a.size}}function fr(e,t){return Mt(e,[t]).get(t.symbolId)??[]}function Mt(e,t){if(!mr(e))return new Map(t.map(r=>[r.symbolId,gt(e,r,{semantic:!1}).map(i=>({file:i.file,startLine:i.line,endLine:i.line,provenance:i.provenance}))]));let n=new Map;for(let r of ht(e,t.map(i=>i.symbolId))){let i=n.get(r.symbol_id)??[];i.push({file:r.relative_path,startLine:r.chunk_start,endLine:r.chunk_end,provenance:"scip-reference-chunk"}),n.set(r.symbol_id,i)}return new Map(t.map(r=>[r.symbolId,n.get(r.symbolId)??[]]))}function mr(e){return pr.get(e,"project",()=>!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))}function yr(e,t){let n=O(e,t)?.rootNode;if(!n)return null;let r=new Map;for(let i of be(n,["call_expression","call"])){let a=i.childForFieldName("function")??i.namedChild(0);if(!a)continue;let s=ct(a);if(!s)continue;let o=i.childForFieldName("arguments")??i.namedChildren.find(d=>d.type==="arguments"),l={callNode:i,targetNode:a,arguments:o?.namedChildren??[]},u=r.get(s);u?u.push(l):r.set(s,[l])}return{byLeaf:r}}var hr=Q("call-parameter-value-flow",{clearGroups:[]});function ce(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return hr.get(e,n,()=>gr(e,t))}function de(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 gr(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=O(e,t.caller.relativePath)?.rootNode,i=r?D(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=X(i),s=[],o=[];return t.arguments.forEach((l,u)=>{let d=l.text.trim(),c=a.indexOf(d);c>=0?s.push({calleePosition:u,callerPosition:c,argumentText:d,proof:n}):o.push({calleePosition:u,argumentText:d,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:s,unknown:o}}var vr=8,br=8;function Vt(e,t,n=[]){let r=[],i=Sr(e,n,r),a=i.summaries,s=xr(e,t,a,r),o=Rr(e,t,r);return{observations:_r([...s.observations,...o]),bodySummaries:a.size,discriminatorSummaries:s.summaries,filesInspected:i.filesInspected,errors:r}}function Sr(e,t,n){let r=new Map,i=[],a=new Map,s=o=>{if(a.has(o))return a.get(o)??null;let l=L(e,o);return a.set(o,l),l};for(let o of t){let l={...o,depth:0,proofSpans:[{file:o.definition.relativePath,startLine:o.definition.startLine,endLine:o.definition.endLine}]};r.set(o.definition.symbol,l),i.push(l)}for(;i.length>0;){let o=i.shift();if(!(o.depth>=vr))try{for(let l of Je(e,o.definition).sites){if(!s(l.file))continue;let d=l.caller;if(!d)continue;let c=de(ce(e,l),o.parameterIndexes);if(c.length===0)continue;let p={definition:d,parameterIndexes:Kt(c),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]};Ir(r,p)&&i.push(r.get(d.symbol))}}catch(l){n.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{summaries:r,filesInspected:new Set(t.map(o=>o.definition.relativePath)).size}}function xr(e,t,n,r){let i=new Map,a=[],s=[];for(let o of t){if(o.action!=="http.request"||o.strength==="candidate"||o.sourceScope!=="production")continue;let l=zt(o);if(!l)continue;let u=L(e,o.source.file);if(!u)continue;let d=jt(u.root,o.source.startLine),c=d.find(v=>v.startPosition.row===o.source.startLine)??d[0];if(!c)continue;let p=et(c);if(!p)continue;let f=ee(e,o.source.file,p.text);if(f.length!==1)continue;let g=n.get(f[0].symbol);if(!g)continue;let b=o.owner.symbol?_(e,o.owner.file).find(v=>v.symbol===o.owner.symbol):null;if(!b)continue;let m=Pr(u,b),y=Te(c);for(let v of g.parameterIndexes){let R=Er(u,y[v]);if(R)for(let x of Fr(R)){let h=Gt(x),S=qt(x);if(!h||!S)continue;let B=m.indexOf(S.text.trim());if(B>=0){let N={definition:b,carrier:l,field:h,parameterIndex:B,depth:0,proofObservationIds:[o.id],proofSpans:[o.source,{file:o.source.file,startLine:x.startPosition.row,endLine:x.endPosition.row}]},F=Ht(N);i.has(F)||(i.set(F,N),a.push(N));continue}let I=V(u,S);!I||I.evidence==="expression"||s.push(Qe(u,x,"carrier.publish",l,h,I.value,[o.id]))}}}for(;a.length>0;){let o=a.shift();if(!(o.depth>=br))try{for(let l of Je(e,o.definition).sites){let u=L(e,l.file);if(!u)continue;let d=l.callNode,c=Te(d)[o.parameterIndex];if(!c)continue;let p=V(u,c);p&&p.evidence!=="expression"&&s.push(Qe(u,d,"carrier.publish",o.carrier,o.field,p.value,o.proofObservationIds));let f=l.caller;if(!f)continue;let g=ce(e,l).transfers.find(y=>y.calleePosition===o.parameterIndex)?.callerPosition;if(g===void 0)continue;let b={...o,definition:f,parameterIndex:g,depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},m=Ht(b);i.has(m)||(i.set(m,b),a.push(b))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{observations:s,summaries:i.size}}function Rr(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 s=zt(a);if(!s)continue;let o=L(e,a.source.file);if(!o)continue;let l=jt(o.root,a.source.startLine)[0];if(l)for(let u of Te(l).slice(1)){let d=ee(e,a.source.file,u.text);for(let c of d)try{let p=L(e,c.relativePath);if(!p)continue;let f=D(p.root,c.startLine,c.endLine);if(!f)continue;k(f,g=>{if(g.type!=="call_expression")return;let b=et(g);if(!b)return;let m=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(b.text.trim());if(!m)return;let y=m[1],v=m[2],R=Nr(e,p,c,v);if(!R)return;let x=Br(e,c.relativePath,y);for(let h of i){let S=h.keyParts.find(F=>F.name==="registry")?.value,B=h.keyParts.find(F=>F.name==="key")?.value;if(!S||!B||!x.some(F=>F.file===h.source.file&&F.binding===S))continue;let I=L(e,h.source.file),N=I?wr(I.root,h.source.startLine):null;!I||!N||r.push(Qe(I,N,"carrier.consume",s,R,B,[a.id,h.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${c.relativePath}: ${tt(p)}`)}}}return r}function Ut(e){let t=_(e.db,e.file),n=new Map;return k(e.root,r=>{if(r.type!=="pair"||Gt(r)?.toLowerCase()!=="body")return;let i=qt(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let a=xe(t,r.startPosition.row),s=Cr(r);if(!a||!s)return;let o=X(s),l=new Set;Tr(i,o,l);let u=n.get(a.symbol)??new Set;o.forEach((d,c)=>{d&&l.has(d)&&u.add(c)}),u.size>0&&n.set(a.symbol,u)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[{definition:r,parameterIndexes:[...i].sort((a,s)=>a-s)}]:[]})}function Cr(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 Nr(e,t,n,r){let i=D(t.root,n.startLine,n.endLine);if(!i)return null;let a=new RegExp(`\\.body\\??\\.${ge(r)}\\b`,"u");if(a.test(i.text))return r;let s=null;if(k(i,d=>{if(s||d.type!=="variable_declarator")return;let c=d.childForFieldName("name")??d.namedChild(0),p=d.childForFieldName("value")??d.namedChild(1);!c||!p||!new RegExp(`(?:^|[,{}])\\s*${ge(r)}\\s*(?:[,}]|$)`,"u").test(c.text)||p.type==="call_expression"&&(s=et(p)?.text??null)}),!s)return null;let o=ee(e,n.relativePath,s);if(o.length!==1)return null;let l=L(e,o[0].relativePath),u=l?D(l.root,o[0].startLine,o[0].endLine):null;return u&&a.test(u.text)&&new RegExp(`\\b${ge(r)}\\s*[,}]`,"u").test(u.text)?r:null}function Br(e,t,n){let r=[];for(let i of ze(e,t,n)){let a=M(i.initializer);if(a.type==="call_expression")for(let s of Te(a)){let o=s.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(o))for(let l of ze(e,i.definition.relativePath,o))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Qe(e,t,n,r,i,a,s){let l=Fe(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:[...s],sourceSpans:[l.source]},l}function zt(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 Ir(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Kt([...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 Pr(e,t){let n=D(e.root,t.startLine,t.endLine);return n?X(n):[]}function wr(e,t){let n=null;return k(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function jt(e,t){let n=[];return k(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 et(e){return e.childForFieldName("function")??e.namedChild(0)}function Te(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Er(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return M(t);let r=null;return k(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),r?M(r):M(t)}function Fr(e){let t=M(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function Gt(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function qt(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function Tr(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 Kt(e){return[...new Set(e)].sort((t,n)=>t-n)}function _r(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function tt(e){return e instanceof Error?e.message:String(e)}import{createHash as $r}from"crypto";function Xt(e,t){let n=new Map;for(let a of t){if(a.action!=="http.handle"||a.sourceScope!=="production")continue;let s=n.get(a.source.file)??[];s.push(a),n.set(a.source.file,s)}let r=[],i=Lr(e);for(let a of i.mounts)for(let s of a.targetFiles)for(let o of n.get(s)??[]){let l=o.keyParts.find(p=>p.name==="path");if(!l||l.evidence==="expression")continue;let u=Or(a.prefix.value,l.value),d=o.keyParts.map(p=>p.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:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line},...a.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:p),c=`${o.id}\0${a.file}\0${a.line}\0${u}`;r.push({...o,id:`boundary:${$r("sha256").update(c).digest("hex").slice(0,16)}`,keyParts:d,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line}]},resolution:"unresolved"}),o.strength="candidate",o.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function Lr(e){let t=[],n=Se(e);for(let r of n){let i=he(e,r);if(!Ar(i))continue;let a=L(e,r);a&&Zt(a.root,s=>{if(s.type!=="call_expression")return;let o=s.childForFieldName("function")??s.namedChild(0);if(!o||!o.text.replace(/\s+/gu,"").endsWith(".use"))return;let l=Dr(s);if(l.length<2)return;let u=V(a,l[0]);if(!u||u.evidence==="expression")return;let d=kr(e,r,l[1]);d.length!==0&&t.push({file:r,line:s.startPosition.row,prefix:{value:u.value,evidence:u.evidence,term:u.term,derivation:u.derivation},targetFiles:d})})}return{mounts:t,filesInspected:n.length}}function kr(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let a=j(e,t).find(l=>l.localName===i&&l.sourcePath);if(!a?.sourcePath)return[t];if(a.kind==="namespace")return[a.sourcePath];let s=a.importedName==="default"?i:a.importedName,o=Z(e,a.sourcePath,s);return[...new Set(o.map(l=>l.relativePath))]}function Or(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function Ar(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 Zt(e,t){t(e);for(let n of e.namedChildren)Zt(n,t)}import{createHash as Mr}from"crypto";function _e(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}var Le=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),Hr=8,Wt=ie({kind:"runtime-boundary-http-roles",invalidation:ae("runtime-boundary-http-roles"),serialize:jr,deserialize:Gr});function Qt(e,t,n){let r=n??((m,y)=>y()),i=new Map,a=[],s=[],o=new Set,l=[],u=[],d=new Map,c=new Map,p=new Map,f=m=>{if(d.has(m))return d.get(m)??null;let y=L(e,m);return d.set(m,y),y},g=m=>{let y=c.get(m);if(y)return y;let v=_(e,m);return c.set(m,v),v},b=(m,y)=>{let v=p.get(m.file);if(!v){let h=re(e,m.file,m.source),S=Wt.read(e,m.file,h)??[];v={contentHash:h,roles:new Map(S.map(B=>[B.symbol,B])),dirty:!1},p.set(m.file,v)}let R=v.roles.get(y.symbol);if(R)return R;let x=zr(m,y);return v.roles.set(y.symbol,{symbol:y.symbol,...x}),v.dirty=!0,x};for(r("runtime-boundaries.http-summary.seed",()=>{for(let m of t){if(m.action!=="http.request"||!m.owner.symbol||m.evidence!=="call-expression"&&m.evidence!=="client-adapter")continue;let y=g(m.owner.file).find(h=>h.symbol===m.owner.symbol);if(!y)continue;let v=f(y.relativePath);if(!v)continue;let R=b(v,y),x={definition:y,...R,constantMethods:m.keyParts.flatMap(h=>h.name==="method"&&h.evidence!=="expression"&&Le.has(h.value.toUpperCase())?[h.value.toUpperCase()]:[]),depth:0,proofObservationIds:[m.id],proofSpans:[m.source]};Jt(i,x)&&a.push(i.get(y.symbol))}});a.length>0;){let m=a.splice(0,a.length),y=r("runtime-boundaries.http-summary.resolve-call-sites",()=>At(e,m.map(v=>v.definition)),{batchSize:m.length});r("runtime-boundaries.http-summary.process-call-sites",()=>{for(let v of m)if(!(v.depth>=Hr))try{let R=y.get(v.definition.symbolId);if(!R)continue;u.push(...R.unresolved.map(x=>Vr(v,x)));for(let x of R.sites){let h=f(x.file);if(!h)continue;o.add(x.file);let S=x.callNode,B=Ur(v,S,h);B&&s.push(B);let I=x.caller;if(!I)continue;let N=b(h,I),F=qr(e,v,x),$={definition:I,pathParameterIndexes:$e([...N.pathParameterIndexes,...F.pathParameterIndexes]),methodParameterIndexes:$e([...N.methodParameterIndexes,...F.methodParameterIndexes]),constantMethods:ne([...v.constantMethods,...N.constantMethods]),depth:v.depth+1,proofObservationIds:ne([...v.proofObservationIds,...B?[B.id]:[]]),proofSpans:[...v.proofSpans,{file:x.file,startLine:x.startLine,endLine:x.endLine}]};Jt(i,$)&&a.push(i.get(I.symbol))}}catch(R){l.push(`builtin.http-summary failed for ${v.definition.relativePath}:${v.definition.startLine+1}: ${R instanceof Error?R.message:String(R)}`)}},{batchSize:m.length})}return Wt.writeBatch(e,[...p.entries()].flatMap(([m,y])=>y.dirty?[{relativePath:m,contentHash:y.contentHash,value:[...y.roles.values()].sort((v,R)=>v.symbol.localeCompare(R.symbol))}]:[])),{observations:s,frontiers:_e(u),summaries:i.size,filesInspected:o.size,errors:l}}function Vr(e,t){let n=ne([...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:Re(t.file)}}function Ur(e,t,n){let r=en(t),i=e.pathParameterIndexes.flatMap(c=>{let p=V(n,r[c]);return p&&p.evidence!=="expression"&&Xr(p.value)?[{index:c,value:p}]:[]}),a=e.methodParameterIndexes.flatMap(c=>{let p=V(n,r[c]),f=p?.value.toUpperCase();return p&&f&&p.evidence!=="expression"&&Le.has(f)?[{index:c,value:{...p,value:f}}]:[]}),s=ne([...e.constantMethods,...a.map(c=>c.value.value)]);if(i.length!==1||s.length!==1)return null;let o=i[0].value,l=a.find(c=>c.value.value===s[0])?.value,u=[{name:"method",value:s[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:s[0]},derivation:l?.derivation},{name:"path",value:o.value,evidence:"constant",term:o.term,derivation:o.derivation}],d=Fe(n,t,"builtin.http-summary","http.request",u,"derived","compiler-resolved-http-summary");return d.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,d.source]},d}function zr(e,t){let n=D(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=X(n),i=new Set,a=new Set,s=new Set;return k(n,o=>{if(o.type==="call_expression"&&((o.childForFieldName("function")??o.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let f=en(o);pe(f[0],r,i);let g=Kr(f[1],"method");if(g){pe(g,r,a);let b=V(e,g),m=b?.value.toUpperCase();m&&b?.evidence!=="expression"&&Le.has(m)&&s.add(m)}else pe(f[1],r,a)}if(o.type!=="pair")return;let l=o.childForFieldName("key")??o.namedChild(0),u=o.childForFieldName("value")??o.namedChild(1),d=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(d==="url"||d==="path"||d==="endpoint")&&pe(u,r,i),(d==="init"||d==="requestinit"||d==="options")&&pe(u,r,a)}),{pathParameterIndexes:r.flatMap((o,l)=>o&&i.has(o)?[l]:[]),methodParameterIndexes:r.flatMap((o,l)=>o&&a.has(o)?[l]:[]),constantMethods:[...s].sort()}}function jr(e){return e.map(t=>[encodeURIComponent(t.symbol),t.pathParameterIndexes.join(","),t.methodParameterIndexes.join(","),t.constantMethods.join(",")].join(" ")).join(`
49
- `)}function Gr(e){if(!e)return[];let t=[];for(let n of e.split(`
50
- `)){let r=n.split(" ");if(r.length!==4)return null;let i=Yt(r[1]),a=Yt(r[2]),s=r[3]?r[3].split(","):[];if(i===null||a===null||s.some(o=>!Le.has(o)))return null;t.push({symbol:decodeURIComponent(r[0]),pathParameterIndexes:i,methodParameterIndexes:a,constantMethods:s})}return t}function Yt(e){if(!e)return[];let t=e.split(",").map(Number);return t.every(n=>Number.isSafeInteger(n)&&n>=0)?t:null}function qr(e,t,n){let r=ce(e,n);return{pathParameterIndexes:de(r,t.pathParameterIndexes),methodParameterIndexes:de(r,t.methodParameterIndexes)}}function Jt(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=$e([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=$e([...n.methodParameterIndexes,...t.methodParameterIndexes]),a=ne([...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:ne([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function Kr(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 pe(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 en(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Xr(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function $e(e){return[...new Set(e)].sort((t,n)=>t-n)}function ne(e){return[...new Set(e)].sort()}import{createHash as Zr}from"crypto";function rn(e){let t=tn(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=tn(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?nt(r).flatMap(i=>{let a=t.get(i)?.[0];return a?[nn(r,a,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?nt(r).flatMap(i=>{let a=n.get(i)?.[0];return a?[nn(r,a,i,"queue.consume")]:[]}):[])}function tn(e){let t=new Map;for(let n of e)for(let r of nt(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 nt(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function nn(e,t,n,r){let i=`database:${n}`,a=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",s=[e.id,r,i,a].join("\0");return{...e,id:`boundary:${Zr("sha256").update(s).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 ye="runtime-boundaries-v19",Jr=Yr(import.meta.url),w=Jr("typescript"),Qr=new Set([w.SyntaxKind.WhitespaceTrivia,w.SyntaxKind.NewLineTrivia,w.SyntaxKind.SingleLineCommentTrivia,w.SyntaxKind.MultiLineCommentTrivia]),ei=new Set([w.SyntaxKind.NoSubstitutionTemplateLiteral,w.SyntaxKind.TemplateHead,w.SyntaxKind.TemplateMiddle,w.SyntaxKind.TemplateTail]),Ae=[{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}],ti=64,cn="builtin.http-summary",De={HTTP_HANDLE:"http.handle",HTTP_REQUEST:"http.request",REGISTRY_HANDLE:"registry.handle"},rt=new Set(Object.values(De));async function ni(e,t={}){let n=Se(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(Ci)),a=t.previousGraph?.fileCoverage,s=i.size>0&&t.previousGraph?.extractorVersion===ye&&a!==void 0&&a.length===t.previousGraph.coverage.filesScanned,o=s?a.filter(C=>r.has(C.file)&&!i.has(C.file)):[],l=new Set(o.flatMap(C=>C.observationIds)),u=s?t.previousGraph.observations.filter(C=>l.has(C.id)&&r.has(C.source.file)):[],d=s?n.filter(C=>i.has(C)):n,c=[],p=a?.reduce((C,P)=>C+P.observationIds.length,0)??0,f=performance.now(),g=await gi(e,d,t.profileSpan);G(c,"direct-extraction",f,d.length,g.observations.length,{filesVisited:d.length,filesReused:o.length,factsReused:u.length,factsInvalidated:Math.max(0,p-u.length)});let b=[...o,...g.fileCoverage].sort((C,P)=>C.file.localeCompare(P.file)),m=Ri(b),y=b.flatMap(C=>C.extractionErrors),v=fe([...u,...g.observations]);if(s&&!t.forceDerivedRebuild&&t.previousGraph&&ri(a,g.fileCoverage,i)&&(!ui(e,t.previousGraph,i)||pi(a,g.fileCoverage,i)&&!fi(t.previousGraph,i))){for(let P of t.previousGraph.coverage.extractors)m.has(P.id)||m.set(P.id,P);let C=yi(t.previousGraph.coverage.phases);return c.push(...C),{...t.previousGraph,observations:t.previousGraph.observations,relationGroups:t.previousGraph.relationGroups,links:t.previousGraph.links,frontiers:t.previousGraph.frontiers,coverage:{filesScanned:n.length,filesWithAst:b.filter(P=>P.hasAst).length,filesWithoutAst:b.filter(P=>!P.hasAst).length,filesReused:o.length,extractors:[...m.values()],extractionErrors:t.previousGraph.coverage.extractionErrors,phases:c},fileCoverage:b}}let R=fe([...v,...rn(v)]),x=s&&t.previousGraph!==void 0?ii(t.previousGraph,a,g.fileCoverage,i,v):{reuse:!1,shapeUnchanged:!1,proofFilesUnchanged:!1,seedUnchanged:!1},h=x.reuse;t.profileSpan?.("runtime-boundaries.http-summary.reuse-decision",()=>{},x),f=performance.now();let S;if(h){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="http-summary"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.wrapper");S={observations:t.previousGraph.observations.filter(E=>E.extractor===cn),frontiers:t.previousGraph.frontiers.filter(E=>E.kind==="call-resolution"&&E.action===De.HTTP_REQUEST),summaries:0,filesInspected:C?.filesVisited??P?.applicableFiles??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.http-summary failed"))},G(c,"http-summary",f,R.length,S.observations.length,{filesVisited:0,filesReused:S.filesInspected,factsReused:S.observations.length+S.frontiers.length,factsInvalidated:0}),P&&m.set(P.id,P)}else S=Qt(e,R,t.profileSpan),G(c,"http-summary",f,R.length,S.observations.length,{filesVisited:S.filesInspected}),m.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:S.filesInspected,observations:S.observations.length,errors:S.errors.length});y.push(...S.errors);let B=fe([...R,...S.observations]);f=performance.now();let I=Xt(e,B);G(c,"http-mount",f,B.length,I.observations.length,{filesVisited:I.filesInspected});let N=fe([...B,...I.observations]);f=performance.now();let F=h&&t.previousGraph!==void 0&&ai(t.previousGraph,a,g.fileCoverage,i),$;if(F){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="carrier"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.carrier");$={observations:t.previousGraph.observations.filter(E=>E.extractor==="builtin.carrier"),bodySummaries:P?.applicableFiles??0,discriminatorSummaries:0,filesInspected:C?.filesVisited??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.carrier"))},G(c,"carrier",f,N.length,$.observations.length,{filesVisited:0,filesReused:$.filesInspected,factsReused:$.observations.length,factsInvalidated:0}),P&&m.set(P.id,P)}else $=Vt(e,N,b.flatMap(C=>C.bodySummaries??[])),G(c,"carrier",f,N.length,$.observations.length,{filesVisited:$.filesInspected}),m.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:$.bodySummaries,observations:$.observations.length,errors:$.errors.length});y.push(...$.errors);let K=fe([...N,...$.observations]);f=performance.now();let J=Ni(K);G(c,"relations",f,K.length,J.length),f=performance.now();let it=Ii(K,J);G(c,"links",f,J.length,it.length),Pi(K,J),f=performance.now();let at=_e([...wi(K,J),...S.frontiers]);return G(c,"frontiers",f,K.length,at.length),{schemaVersion:2,extractorVersion:ye,observations:K,relationGroups:J,links:it,frontiers:at,coverage:{filesScanned:n.length,filesWithAst:b.filter(C=>C.hasAst).length,filesWithoutAst:b.filter(C=>!C.hasAst).length,...s?{filesReused:o.length}:{},extractors:[...m.values()],extractionErrors:y,phases:c},fileCoverage:b}}function ri(e,t,n){if(!e)return!1;let r=e.filter(a=>n.has(a.file)).filter(an).map(on).sort((a,s)=>a.file.localeCompare(s.file)),i=t.filter(an).map(on).sort((a,s)=>a.file.localeCompare(s.file));return JSON.stringify(r)===JSON.stringify(i)}function an(e){return e.observationIds.length>0||e.extractionErrors.length>0}function on(e){let{syntaxHash:t,shapeHash:n,bodySummaries:r,...i}=e;return i}function ii(e,t,n,r,i){let a=si(t,n,r),s=li(e),l=![...dn(t,n)].some(p=>s.has(p)),u=new Set((t??[]).filter(p=>r.has(p.file)).flatMap(p=>p.observationIds)),d=new Set(n.flatMap(p=>p.observationIds)),c=sn(e.observations,u)===sn(i,d);return{reuse:a&&l&&c,shapeUnchanged:a,proofFilesUnchanged:l,seedUnchanged:c}}function dn(e,t){let n=new Map(e?.map(r=>[r.file,r.syntaxHash])??[]);return new Set(t.filter(r=>r.syntaxHash===void 0||n.get(r.file)!==r.syntaxHash).map(r=>r.file))}function ai(e,t,n,r){if(!t)return!1;let i=t.filter(l=>r.has(l.file)).map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file)),a=n.map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file));if(JSON.stringify(i)!==JSON.stringify(a))return!1;let s=dn(t,n),o=oi(e,"builtin.carrier");return![...s].some(l=>o.has(l))}function oi(e,t){let n=new Set;for(let r of e.observations)if(r.extractor===t){n.add(r.source.file);for(let i of r.derivation.sourceSpans)n.add(i.file)}return n}function si(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.shapeHash]));return t.length===n.size&&t.every(i=>i.shapeHash!==void 0&&r.get(i.file)===i.shapeHash)}function li(e){let t=new Set;for(let n of e.observations)if(n.extractor===cn){t.add(n.source.file);for(let r of n.derivation.sourceSpans)t.add(r.file)}for(let n of e.frontiers)n.kind==="call-resolution"&&n.action===De.HTTP_REQUEST&&n.source&&t.add(n.source.file);return t}function sn(e,t){return JSON.stringify(e.filter(n=>t.has(n.id)&&n.action===De.HTTP_REQUEST&&n.owner.symbol!==null&&(n.evidence==="call-expression"||n.evidence==="client-adapter")).map(n=>({ownerSymbol:n.owner.symbol,evidence:n.evidence,methods:n.keyParts.filter(r=>r.name==="method"&&r.evidence!=="expression").map(r=>r.value.toUpperCase()).sort()})).sort((n,r)=>`${n.ownerSymbol}\0${n.evidence}\0${n.methods.join(",")}`.localeCompare(`${r.ownerSymbol}\0${r.evidence}\0${r.methods.join(",")}`)))}function ui(e,t,n){let r=ci(t),i=di(t);if([...n].some(o=>r.has(o)))return!0;if(i.size===0||n.size===0)return!1;if(!!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))return!0;let s=[...n];for(let o=0;o<s.length;o+=750){let l=s.slice(o,o+750),u=l.map(()=>"?").join(",");if(e.all(`SELECT DISTINCT global_symbol.symbol
48
+ `)}function bn(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function Ce(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function Sn(e){try{return[JSON.parse(e)]}catch{return[]}}function bt(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",Ne))return null;let n=e.get(`SELECT schema_version, payload FROM ${Ne} 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 fe}from"crypto";import{setImmediate as Yr}from"timers/promises";import{createRequire as Jr}from"module";import{createHash as Dn}from"crypto";var Pe=8;function ee(e,t,n){return Ge(St(e,t,Ue(n),0,new Set))}function ze(e,t,n){return He(e,t,n,0,new Set)}function St(e,t,n,r,i){if(r>Pe)return[];let a=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return a?xt(e,t,a[1],a[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?Rt(e,t,n,r,i):[]}function xt(e,t,n,r,i,a){let s=[];for(let o of He(e,t,n,i+1,new Set(a))){let l=M(o.initializer);for(let u of l.namedChildren){if(u.type==="pair"){let d=u.childForFieldName("key")??u.namedChild(0);if(Bn(d)!==r)continue;let c=u.childForFieldName("value")??u.namedChild(1);c&&s.push(...St(e,o.definition.relativePath,Ue(c.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 c=Cn(e,o.definition.relativePath,r,u);s.push(...c.length>0?c:[xn(o.definition,r,u)]);continue}if(u.type==="spread_element"){let d=u.namedChild(0);if(!d)continue;for(let c of He(e,o.definition.relativePath,Ue(d.text),i+1,new Set(a)))s.push(...xt(e,c.definition.relativePath,c.definition.leaf,r,i+1,new Set(a)))}}}return Ge(s)}function xn(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 He(e,t,n,r,i){return r>Pe||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:Rt(e,t,n,r,i).flatMap(a=>{let s=O(e,a.relativePath)?.rootNode,o=s?Nn(s,a.leaf):null;return o?[{definition:a,initializer:o}]:[]})}function Rt(e,t,n,r,i){if(r>Pe)return[];let a=`${t}\0${n}`;if(i.has(a))return[];i.add(a);let s=_(e,t).filter(u=>u.leaf===n);if(s.length>0)return s;let o=Rn(e,t,n);if(o.length>0)return o;let l=G(e,t).find(u=>u.localName===n&&u.sourcePath);if(l?.sourcePath){let u=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return Ve(e,l.sourcePath,u,r+1,new Set(i))}return Ve(e,t,n,r+1,new Set(i))}function Rn(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(pt(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 Ve(e,t,n,r,i){if(r>Pe)return[];let a=_(e,t).filter(s=>s.leaf===n);return a.length>0?a:Ge(yt(e,t).flatMap(s=>s.sourcePath?s.kind==="named"&&!s.names.includes(n)?[]:Ve(e,s.sourcePath,n,r+1,new Set(i)):[]))}function Cn(e,t,n,r){return _(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Nn(e,t){let n=null;return k(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 Bn(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ue(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Ge(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}var In=8;function V(e,t){return t?te(e,t,0,new Set):null}function te(e,t,n,r){if(n>In)return U(t,"value-evaluation-depth");let i=M(t),a=_n(i);if(a)return $n(e.file,i,a.term,a.value,a.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(u=>te(e,u,n+1,new Set(r)));if(l.length>=2&&l.every(u=>u!==null)){let u={kind:"concat",parts:l.map(c=>c.term)},d=l.map(c=>c.value).join("");return Ln(e.file,i,u,d,l.some(c=>c.precision!=="literal")?"constrained-pattern":"literal",l)}}let s=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))return Fn(e,s,i,n,r);let o=kn(i);return o?Tn(e,o.base,o.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Pn(e,i,n,r):U(i,`unsupported-expression:${i.type}`)}function Pn(e,t,n,r){let a=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",s=wn(e,a);if(s.length!==1)return U(t,s.length===0?"call-target-unresolved":"call-target-ambiguous");let o=s[0],l=`${o.relativePath}\0${o.symbol}`;if(r.has(l))return U(t,"call-return-cycle");let u=O(e.db,o.relativePath)?.rootNode;if(!u)return U(t,"call-target-unparsed");let d=D(u,o.startLine,o.endLine);if(!d)return U(t,"call-target-syntax-unavailable");let c=En(d);if(!c)return U(t,"call-return-not-single-expression");let p=new Set(r);p.add(l);let m=te({db:e.db,file:o.relativePath,root:u},c,n+1,p);return m?we(t,"bounded-call-return",m,o.symbol):U(t,"call-return-unresolved")}function wn(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=_(e.db,e.file).filter(s=>s.isFunctionLike&&s.leaf===t);if(i.length>0)return i;let a=G(e.db,e.file).find(s=>s.localName===t&&s.sourcePath&&s.kind!=="namespace");return a?.sourcePath?Z(e.db,a.sourcePath,a.importedName==="default"?t:a.importedName).filter(s=>s.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=G(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 Fn(e,t,n,r,i){let a=`${e.file}\0${t}`;if(i.has(a))return U(n,"value-cycle");i.add(a);let s=je(e.root,t);if(s){let g=te(e,s,r+1,i);return g?we(n,"local-constant",g):U(n,"non-foldable-local")}let o=G(e.db,e.file).find(g=>g.localName===t&&g.sourcePath);if(!o?.sourcePath)return H(n,t,"unresolved-identifier");if(o.kind==="namespace")return H(n,t,"namespace-import-requires-property");let l=o.importedName==="default"?t:o.importedName,u=Z(e.db,o.sourcePath,l);if(u.length!==1)return H(n,t,u.length===0?"import-definition-missing":"import-definition-ambiguous");let d=u[0],c=O(e.db,d.relativePath)?.rootNode;if(!c)return H(n,d.symbol,"import-definition-unparsed");let p=je(c,d.leaf);if(!p)return H(n,d.symbol,"import-definition-non-value");let m=te({db:e.db,file:d.relativePath,root:c},p,r+1,i);return m?we(n,"imported-constant",m,d.symbol):H(n,d.symbol,"import-value-unresolved")}function Tn(e,t,n,r,i,a){let s=G(e.db,e.file).find(m=>m.localName===t&&m.sourcePath),o=e.file,l=t,u;if(s?.sourcePath){s.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=s.importedName==="default"?t:s.importedName;let m=Z(e.db,s.sourcePath,l);if(m.length!==1)return H(r,`${t}.${n.join(".")}`,m.length===0?"member-definition-missing":"member-definition-ambiguous");o=m[0].relativePath,l=m[0].leaf,u=m[0].symbol}let d=o===e.file?e.root:O(e.db,o)?.rootNode;if(!d)return H(r,u??t,"member-definition-unparsed");let c=je(d,l);if(!c)return H(r,u??t,"member-base-non-value");for(let m of n){let g=M(c);if(c=An(g,m),!c)return H(r,u??`${t}.${n.join(".")}`,`member-property-missing:${m}`)}let p=te({db:e.db,file:o,root:d},c,i+1,a);return p?we(r,"member-constant",p,u):H(r,u??t,"member-value-unresolved")}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);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],a=0,s=/\$\{([^}]*)\}/gu;for(let o of r.matchAll(s)){let l=o.index??0;l>a&&i.push({kind:"literal",value:r.slice(a,l)}),i.push({kind:"unknown",reason:`template-hole:${o[1]?.trim()||"expression"}`}),a=l+o[0].length}return a<r.length&&i.push({kind:"literal",value:r.slice(a)}),{term:{kind:"pattern",language:"template",value:r.replace(s,"{}")},value:r.replace(s,"{}"),precision:"constrained-pattern"}}function $n(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Ee("direct-literal","direct",e,t)}}function Ln(e,t,n,r,i,a){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Ee("constant-concatenation","mechanically-derived",e,t),inputFactIds:a.flatMap(s=>s.derivation.inputFactIds),sourceSpans:a.flatMap(s=>s.derivation.sourceSpans)}}}function we(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 H(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Ee(n,"heuristic","",e)}}function U(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Ee(t,"heuristic","",e)}}function Ee(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 kn(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}var Ct=new WeakMap;function On(e){let t=Ct.get(e);if(t)return t;let n=new Map;return k(e,r=>{if(r.type!=="variable_declarator")return;let a=(r.childForFieldName("name")??r.namedChild(0))?.text.trim();if(!a||n.has(a))return;let s=r.parent;if(!s||s.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(s.text))return;let o=r.childForFieldName("value")??r.namedChild(1);o&&n.set(a,o)}),Ct.set(e,n),n}function je(e,t){return On(e).get(t)??null}function An(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}var Mn=new WeakMap,_t=new Set(["delete","get","head","options","patch","post","put"]),Hn=/(?:^|\.)(?:app|router|server)$/u,Vn=new Set(["findFirst","findMany","findUnique","from","get","select"]),Un=new Set(["create","delete","insert","remove","update","upsert"]),zn=new Set(["execute","query","raw"]),Bt=/(?:\b(?:name|id)|['"`](?:name|id)['"`])\s*:/u,It=/(?:^\s*|[,{]\s*)(?:async\s+)?['"`]?(?:execute|handler|invoke|run)['"`]?\s*(?::|\([^)]*\)\s*\{)/mu,Pt=/\b[A-Za-z_$][\w$-]*[_-][\w$-]*\s*\(/u,wt=/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s+[A-Za-z_$][\w$-]*\s*\(/iu,Xe=[Kn(),qn(),Gn(),Xn(),Wn(),Yn(),Qn()],Ke=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function Gn(){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=jn(e.source),n=[];return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=t.direct.get(i),s=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),o=s&&t.namespaces.has(s[1])?s[2]:null,l=a??o;if(!l||!Ke.has(l))return;let u=Y(r),d=A(u[0],e)??{value:u[0]?.text.trim()||"<missing>",evidence:"expression"},c=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(T(e,r,"builtin.node-child-process",c,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...d}],"exact","node-child-process-import"))}),n}}}function jn(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 d=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[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 d=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[1])}let s=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(s))n.add(l[1]);let o=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(o))n.add(l[1]);return{direct:t,namespaces:n}}function L(e,t,n,r){let i=oe(r,"runtime-boundaries.context.ast",t,()=>n===void 0?O(e,t):ct(e,t,n));if(!i)return null;let a=i.rootNode;n!==void 0&&Mn.set(a,i);let s=n??he(e,t),o,l,u,d=()=>(l!==void 0||(l=oe(r,"runtime-boundaries.context.callable-sites",t,()=>{let c=ve(t);return(c?ft(a,c):null)??mt(e,t)})),l);return{db:e,file:t,source:s,root:a,get constants(){return u??=oe(r,"runtime-boundaries.context.constants",t,()=>ar(a)),u},ownerAt:c=>{let m=(o??=oe(r,"runtime-boundaries.context.definitions",t,()=>_(e,t,{rangeCorrectionEvidence:{source:s,callables:d()}},(f,y)=>oe(r,`runtime-boundaries.context.definitions.${f}`,t,y)))).filter(f=>f.startLine<=c&&f.endLine>=c).sort((f,y)=>f.endLine-f.startLine-(y.endLine-y.startLine)||f.startLine-y.startLine)[0];if(m)return{file:t,symbol:m.symbol,name:m.leaf,startLine:m.startLine,endLine:m.endLine};let b=(d()??[]).filter(f=>f.startLine<=c&&f.endLine>=c).sort((f,y)=>f.endLine-f.startLine-(y.endLine-y.startLine)||f.startLine-y.startLine)[0];return{file:t,symbol:null,name:b?.name??null,startLine:b?.startLine??c,endLine:b?.endLine??c}}}}function oe(e,t,n,r){return e?e(t,r,{file:n}):r()}function qn(){return{id:"builtin.effect-httpapi",supports:e=>se(e,"HttpApiEndpoint").size>0||se(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=se(e.source,"HttpApiEndpoint"),r=se(e.source,"HttpApiGroup"),i=se(e.source,"HttpApiBuilder");return q(e.root,"call_expression",a=>{let s=$t(a);if(!s)return;let o=Y(a);if(n.has(s.receiver)&&_t.has(s.member)){let b=A(o[0],e),f=A(o[1],e),y=Ft(a,r,"make",0,e);if(!b||!f||!y)return;let v=s.member.toUpperCase();t.push(T(e,a,"builtin.effect-httpapi","http.handle",[{name:"method",value:v,evidence:"literal"},{name:"path",...f}],z([{name:"path",...f}]),"effect-httpapi-endpoint-declaration")),t.push(T(e,a,"builtin.effect-httpapi","framework.declare",qe(y,b),z(qe(y,b)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(s.member))return;let l=Ft(a,i,"group",1,e),u=A(o[0],e),d=o[1];if(!l||!u||!d)return;let c=qe(l,u),p=ee(e.db,e.file,d.text),m=T(e,a,"builtin.effect-httpapi","framework.handle",c,p.length===1?z(c):"candidate","effect-httpapi-handler-registration"),g=p[0];p.length===1&&g&&(m.owner={file:g.relativePath,symbol:g.symbol,name:g.leaf,startLine:g.startLine,endLine:g.endLine}),t.push(m)}),t}}}function qe(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function se(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(r)){let s=a[2]??"";if(Et(s))for(let o of(a[1]??"").split(",")){let l=o.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 s=a[2]??"";s.endsWith(`/${t}`)&&Et(s)&&n.add(a[1])}return n}function Et(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function Ft(e,t,n,r,i){let a=e.parent;for(;a;){if(a.type==="call_expression"){let s=Tt(a,t,n,r,i);if(s)return s;let o=a.childForFieldName("function")??a.namedChild(0),l=null;if(o&&We(o,u=>{!l&&u.type==="call_expression"&&(l=Tt(u,t,n,r,i))}),l)return l}a=a.parent}return null}function Tt(e,t,n,r,i){let a=$t(e);return!a||a.member!==n||!t.has(a.receiver)?null:A(Y(e)[r],i)}function $t(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 Kn(){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)||le(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return q(e.root,["decorator","call_expression"],n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!le(e.source,["fastapi","flask"]))return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=ue(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",a=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",s=Y(n);if(i==="route"&&le(e.source,["axum"])){let p=A(s[0],e),m=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(s[1]?.text??"")?.[1];if(!p||!m)return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:m.toUpperCase(),evidence:"literal"},{name:"path",...p}],z([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=A(s[0],e);if(!p)return;let g=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(s[1]?.text??"")?.[1]?.toUpperCase()??(s[1]?null:"GET"),b=[...g?[{name:"method",value:g,evidence:"literal"}]:[],{name:"path",...p}];t.push(T(e,n,"builtin.http","http.request",b,g?z(b):"candidate","call-expression"));return}if(!_t.has(i))return;let o=A(s[0],e);if(!o)return;let l=i.toUpperCase();if(Hn.test(a)&&le(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"framework-adapter"));return}let d=nr(e.source,["axios"]),c=a.split(".")[0]??"";d.has(c)&&t.push(T(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"client-adapter"))}),t}}}function Xn(){return{id:"builtin.capability-registry",supports:e=>Bt.test(e)&&It.test(e)||Pt.test(e)||wt.test(e),extract:e=>{let t=[],n=new Set,r=[];return Bt.test(e.source)&&It.test(e.source)&&r.push("pair"),(Pt.test(e.source)||wt.test(e.source))&&r.push("string","string_literal","template_string"),q(e.root,r,i=>{if(i.type==="pair"){let s=i.childForFieldName("key")??i.namedChild(0),o=i.childForFieldName("value")??i.namedChild(1),l=s?.text.replace(/^['"`]|['"`]$/gu,"");if(l!=="name"&&l!=="id")return;let u=Lt(o,e),d=sr(i);if(!u||u.evidence!=="literal"||!d)return;let c=`handle\0${u.value}\0${d.startPosition.row}`;if(n.has(c))return;n.add(c),t.push(T(e,d,"builtin.capability-registry","registry.handle",[{name:"key",...u}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(i.type))return;let a=i.text.replace(/^['"`]|['"`]$/gu,"");for(let s of a.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let o=s[1];if(!Zn(a,o,s.index))continue;let l=`reference\0${o}\0${i.startPosition.row}`;n.has(l)||(n.add(l),t.push(T(e,i,"builtin.capability-registry","registry.reference",[{name:"key",value:o,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function Zn(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 Wn(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return q(e.root,["pair","call_expression"],n=>{if(n.type==="pair"){let a=or(n);if(!a)return;let s=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),l=Lt(s,e);if(!l||!o||!kt(o))return;let u=Ze(o)?"exact":"candidate";t.push(T(e,n,"builtin.registry","registry.handle",[{name:"registry",value:a,evidence:"identifier"},{name:"key",...l}],z([{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(T(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 Yn(){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=ur(e.root);return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=i.split("."),s=a.at(-1)??"",o=Y(r),l=o[0]?.text??"",u=lr(s,l);if(!u)return;let d=Ot(a,n);if(!d)return;let c=Jn(o[0],e)??cr(l),p=dr(d,a,s,c);if(!p)return;let m=s==="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(T(e,r,"builtin.persistence",u,[{name:"resource",...p}],z([{name:"resource",...p}]),m))}),t}}}function Jn(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}}:A(e,t)}function Qn(){return{id:"builtin.queue",supports:e=>le(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return q(e.root,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".").at(-1)??"",a=Y(n),s=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!s)return;let o=i==="send"||i==="subscribe"?rr(a[0],"topic",e):A(a[0],e);o&&t.push(T(e,n,"builtin.queue",s,[{name:"address",...o}],z([{name:"address",...o}]),"framework-adapter"))}),t}}}function T(e,t,n,r,i,a,s){let o=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${Dn("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:o,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:s,strength:a,protocol:r.split(".")[0]??r,role:er(r),executionDomain:tr(e.file),derivation:{kind:a==="candidate"?"heuristic":a==="derived"?"mechanically-derived":"direct",rule:s,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:Re(e.file)}}function er(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 tr(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function le(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 nr(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 s of e.matchAll(a)){let o=s[1]??s[2];o&&n.add(o)}}return n}function Fe(e,t,n,r,i,a,s){return T(e,t,n,r,i,a,s)}function ue(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function Y(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function A(e,t){let n=V(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function rr(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 A(i,n)}function Lt(e,t){if(!e)return null;let n=A(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 z(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function ir(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 ar(e){let t=new Map;return We(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=ir(i);a!==null&&t.set(r.text,a)}),t}function or(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 Ze(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function kt(e){return Ze(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function sr(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),s=i?.text.replace(/^['"`]|['"`]$/gu,"");if(s&&["execute","handler","invoke","run"].includes(s)&&a&&kt(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 Ot(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 lr(e,t){if(Vn.has(e))return"database.read";if(Un.has(e))return"database.write";if(!zn.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 ur(e){let t=new Set;return q(e,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!Ot(i)))for(let a of Y(n)){if(!Ze(a))continue;let o=(a.childForFieldName("parameters")??a.namedChildren.find(u=>/parameters/u.test(u.type)))?.namedChildren[0],l=o?lt(o):null;l&&t.add(l)}}),t}function cr(e){let t=At(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function dr(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=At(r.value);return i?{value:i,evidence:r.evidence}:null}function At(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function We(e,t){t(e);for(let n of e.namedChildren)We(n,t)}function q(e,t,n){for(let r of be(e,t))n(r)}var pr=Q("resolved-call-syntax",{clearGroups:[]}),Ye=Q("resolved-call-sites",{clearGroups:[]}),mr=Q("resolved-call-sites-reference-evidence",{clearGroups:[]});function Je(e,t){return Ye.get(e,t.symbolId,()=>Mt(e,t,fr(e,t)))}function Dt(e,t){let n=[...new Map(t.map(a=>[a.symbolId,a])).values()],r=n.filter(a=>!Ye.has(e,a.symbolId)),i=Ht(e,r);return new Map(n.map(a=>[a.symbolId,Ye.get(e,a.symbolId,()=>Mt(e,a,i.get(a.symbolId)??[]))]))}function Mt(e,t,n){let r=[],i=[],a=new Set,s=new Set;for(let o of n){a.add(o.file);let l=pr.get(e,o.file,()=>hr(e,o.file));if(!l){i.push({callee:t,file:o.file,line:o.startLine,reason:"ast-unavailable",candidates:0,referenceProvenance:o.provenance});continue}let u=(l.byLeaf.get(t.leaf)??[]).filter(({callNode:p})=>p.startPosition.row<=o.endLine&&p.endPosition.row>=o.startLine);if(u.length!==1){i.push({callee:t,file:o.file,line:o.startLine,reason:u.length===0?"call-not-found":"ambiguous-call",candidates:u.length,referenceProvenance:o.provenance});continue}let d=u[0],c=`${o.file}\0${d.callNode.startIndex}\0${d.callNode.endIndex}`;s.has(c)||(s.add(c),r.push({callee:t,caller:xe(_(e,o.file),d.callNode.startPosition.row),file:o.file,line:d.callNode.startPosition.row,startLine:d.callNode.startPosition.row,endLine:d.callNode.endPosition.row,targetText:d.targetNode.text,callNode:d.callNode,targetNode:d.targetNode,arguments:d.arguments,referenceProvenance:o.provenance}))}return{sites:r,unresolved:i,filesVisited:a.size}}function fr(e,t){return Ht(e,[t]).get(t.symbolId)??[]}function Ht(e,t){if(!yr(e))return new Map(t.map(r=>[r.symbolId,vt(e,r,{semantic:!1}).map(i=>({file:i.file,startLine:i.line,endLine:i.line,provenance:i.provenance}))]));let n=new Map;for(let r of gt(e,t.map(i=>i.symbolId))){let i=n.get(r.symbol_id)??[];i.push({file:r.relative_path,startLine:r.chunk_start,endLine:r.chunk_end,provenance:"scip-reference-chunk"}),n.set(r.symbol_id,i)}return new Map(t.map(r=>[r.symbolId,n.get(r.symbolId)??[]]))}function yr(e){return mr.get(e,"project",()=>!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))}function hr(e,t){let n=O(e,t)?.rootNode;if(!n)return null;let r=new Map;for(let i of be(n,["call_expression","call"])){let a=i.childForFieldName("function")??i.namedChild(0);if(!a)continue;let s=dt(a);if(!s)continue;let o=i.childForFieldName("arguments")??i.namedChildren.find(d=>d.type==="arguments"),l={callNode:i,targetNode:a,arguments:o?.namedChildren??[]},u=r.get(s);u?u.push(l):r.set(s,[l])}return{byLeaf:r}}var gr=Q("call-parameter-value-flow",{clearGroups:[]});function ce(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return gr.get(e,n,()=>vr(e,t))}function de(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 vr(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=O(e,t.caller.relativePath)?.rootNode,i=r?D(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=X(i),s=[],o=[];return t.arguments.forEach((l,u)=>{let d=l.text.trim(),c=a.indexOf(d);c>=0?s.push({calleePosition:u,callerPosition:c,argumentText:d,proof:n}):o.push({calleePosition:u,argumentText:d,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:s,unknown:o}}var br=8,Sr=8;function Ut(e,t,n=[]){let r=[],i=xr(e,n,r),a=i.summaries,s=Rr(e,t,a,r),o=Cr(e,t,r);return{observations:$r([...s.observations,...o]),bodySummaries:a.size,discriminatorSummaries:s.summaries,filesInspected:i.filesInspected,errors:r}}function xr(e,t,n){let r=new Map,i=[],a=new Map,s=o=>{if(a.has(o))return a.get(o)??null;let l=L(e,o);return a.set(o,l),l};for(let o of t){let l={...o,depth:0,proofSpans:[{file:o.definition.relativePath,startLine:o.definition.startLine,endLine:o.definition.endLine}]};r.set(o.definition.symbol,l),i.push(l)}for(;i.length>0;){let o=i.shift();if(!(o.depth>=br))try{for(let l of Je(e,o.definition).sites){if(!s(l.file))continue;let d=l.caller;if(!d)continue;let c=de(ce(e,l),o.parameterIndexes);if(c.length===0)continue;let p={definition:d,parameterIndexes:Xt(c),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]};Pr(r,p)&&i.push(r.get(d.symbol))}}catch(l){n.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{summaries:r,filesInspected:new Set(t.map(o=>o.definition.relativePath)).size}}function Rr(e,t,n,r){let i=new Map,a=[],s=[];for(let o of t){if(o.action!=="http.request"||o.strength==="candidate"||o.sourceScope!=="production")continue;let l=Gt(o);if(!l)continue;let u=L(e,o.source.file);if(!u)continue;let d=jt(u.root,o.source.startLine),c=d.find(v=>v.startPosition.row===o.source.startLine)??d[0];if(!c)continue;let p=et(c);if(!p)continue;let m=ee(e,o.source.file,p.text);if(m.length!==1)continue;let g=n.get(m[0].symbol);if(!g)continue;let b=o.owner.symbol?_(e,o.owner.file).find(v=>v.symbol===o.owner.symbol):null;if(!b)continue;let f=wr(u,b),y=Te(c);for(let v of g.parameterIndexes){let R=Fr(u,y[v]);if(R)for(let x of Tr(R)){let h=qt(x),S=Kt(x);if(!h||!S)continue;let B=f.indexOf(S.text.trim());if(B>=0){let N={definition:b,carrier:l,field:h,parameterIndex:B,depth:0,proofObservationIds:[o.id],proofSpans:[o.source,{file:o.source.file,startLine:x.startPosition.row,endLine:x.endPosition.row}]},F=Vt(N);i.has(F)||(i.set(F,N),a.push(N));continue}let I=V(u,S);!I||I.evidence==="expression"||s.push(Qe(u,x,"carrier.publish",l,h,I.value,[o.id]))}}}for(;a.length>0;){let o=a.shift();if(!(o.depth>=Sr))try{for(let l of Je(e,o.definition).sites){let u=L(e,l.file);if(!u)continue;let d=l.callNode,c=Te(d)[o.parameterIndex];if(!c)continue;let p=V(u,c);p&&p.evidence!=="expression"&&s.push(Qe(u,d,"carrier.publish",o.carrier,o.field,p.value,o.proofObservationIds));let m=l.caller;if(!m)continue;let g=ce(e,l).transfers.find(y=>y.calleePosition===o.parameterIndex)?.callerPosition;if(g===void 0)continue;let b={...o,definition:m,parameterIndex:g,depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},f=Vt(b);i.has(f)||(i.set(f,b),a.push(b))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{observations:s,summaries:i.size}}function Cr(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 s=Gt(a);if(!s)continue;let o=L(e,a.source.file);if(!o)continue;let l=jt(o.root,a.source.startLine)[0];if(l)for(let u of Te(l).slice(1)){let d=ee(e,a.source.file,u.text);for(let c of d)try{let p=L(e,c.relativePath);if(!p)continue;let m=D(p.root,c.startLine,c.endLine);if(!m)continue;k(m,g=>{if(g.type!=="call_expression")return;let b=et(g);if(!b)return;let f=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(b.text.trim());if(!f)return;let y=f[1],v=f[2],R=Br(e,p,c,v);if(!R)return;let x=Ir(e,c.relativePath,y);for(let h of i){let S=h.keyParts.find(F=>F.name==="registry")?.value,B=h.keyParts.find(F=>F.name==="key")?.value;if(!S||!B||!x.some(F=>F.file===h.source.file&&F.binding===S))continue;let I=L(e,h.source.file),N=I?Er(I.root,h.source.startLine):null;!I||!N||r.push(Qe(I,N,"carrier.consume",s,R,B,[a.id,h.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${c.relativePath}: ${tt(p)}`)}}}return r}function zt(e){let t=_(e.db,e.file),n=new Map;return k(e.root,r=>{if(r.type!=="pair"||qt(r)?.toLowerCase()!=="body")return;let i=Kt(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let a=xe(t,r.startPosition.row),s=Nr(r);if(!a||!s)return;let o=X(s),l=new Set;_r(i,o,l);let u=n.get(a.symbol)??new Set;o.forEach((d,c)=>{d&&l.has(d)&&u.add(c)}),u.size>0&&n.set(a.symbol,u)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[{definition:r,parameterIndexes:[...i].sort((a,s)=>a-s)}]:[]})}function Nr(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 Br(e,t,n,r){let i=D(t.root,n.startLine,n.endLine);if(!i)return null;let a=new RegExp(`\\.body\\??\\.${ge(r)}\\b`,"u");if(a.test(i.text))return r;let s=null;if(k(i,d=>{if(s||d.type!=="variable_declarator")return;let c=d.childForFieldName("name")??d.namedChild(0),p=d.childForFieldName("value")??d.namedChild(1);!c||!p||!new RegExp(`(?:^|[,{}])\\s*${ge(r)}\\s*(?:[,}]|$)`,"u").test(c.text)||p.type==="call_expression"&&(s=et(p)?.text??null)}),!s)return null;let o=ee(e,n.relativePath,s);if(o.length!==1)return null;let l=L(e,o[0].relativePath),u=l?D(l.root,o[0].startLine,o[0].endLine):null;return u&&a.test(u.text)&&new RegExp(`\\b${ge(r)}\\s*[,}]`,"u").test(u.text)?r:null}function Ir(e,t,n){let r=[];for(let i of ze(e,t,n)){let a=M(i.initializer);if(a.type==="call_expression")for(let s of Te(a)){let o=s.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(o))for(let l of ze(e,i.definition.relativePath,o))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Qe(e,t,n,r,i,a,s){let l=Fe(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:[...s],sourceSpans:[l.source]},l}function Gt(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 Pr(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Xt([...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 Vt(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function wr(e,t){let n=D(e.root,t.startLine,t.endLine);return n?X(n):[]}function Er(e,t){let n=null;return k(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function jt(e,t){let n=[];return k(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 et(e){return e.childForFieldName("function")??e.namedChild(0)}function Te(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Fr(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return M(t);let r=null;return k(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),r?M(r):M(t)}function Tr(e){let t=M(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function qt(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Kt(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function _r(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 Xt(e){return[...new Set(e)].sort((t,n)=>t-n)}function $r(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function tt(e){return e instanceof Error?e.message:String(e)}import{createHash as Lr}from"crypto";function Zt(e,t){let n=new Map;for(let a of t){if(a.action!=="http.handle"||a.sourceScope!=="production")continue;let s=n.get(a.source.file)??[];s.push(a),n.set(a.source.file,s)}let r=[],i=kr(e);for(let a of i.mounts)for(let s of a.targetFiles)for(let o of n.get(s)??[]){let l=o.keyParts.find(p=>p.name==="path");if(!l||l.evidence==="expression")continue;let u=Ar(a.prefix.value,l.value),d=o.keyParts.map(p=>p.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:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line},...a.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:p),c=`${o.id}\0${a.file}\0${a.line}\0${u}`;r.push({...o,id:`boundary:${Lr("sha256").update(c).digest("hex").slice(0,16)}`,keyParts:d,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line}]},resolution:"unresolved"}),o.strength="candidate",o.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function kr(e){let t=[],n=Se(e);for(let r of n){let i=he(e,r);if(!Dr(i))continue;let a=L(e,r);a&&Wt(a.root,s=>{if(s.type!=="call_expression")return;let o=s.childForFieldName("function")??s.namedChild(0);if(!o||!o.text.replace(/\s+/gu,"").endsWith(".use"))return;let l=Mr(s);if(l.length<2)return;let u=V(a,l[0]);if(!u||u.evidence==="expression")return;let d=Or(e,r,l[1]);d.length!==0&&t.push({file:r,line:s.startPosition.row,prefix:{value:u.value,evidence:u.evidence,term:u.term,derivation:u.derivation},targetFiles:d})})}return{mounts:t,filesInspected:n.length}}function Or(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let a=G(e,t).find(l=>l.localName===i&&l.sourcePath);if(!a?.sourcePath)return[t];if(a.kind==="namespace")return[a.sourcePath];let s=a.importedName==="default"?i:a.importedName,o=Z(e,a.sourcePath,s);return[...new Set(o.map(l=>l.relativePath))]}function Ar(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 Mr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Wt(e,t){t(e);for(let n of e.namedChildren)Wt(n,t)}import{createHash as Hr}from"crypto";function _e(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}var Le=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),Vr=8,Yt=ie({kind:"runtime-boundary-http-roles",invalidation:ae("runtime-boundary-http-roles"),serialize:jr,deserialize:qr});function en(e,t,n){let r=n??((f,y)=>y()),i=new Map,a=[],s=[],o=new Set,l=[],u=[],d=new Map,c=new Map,p=new Map,m=f=>{if(d.has(f))return d.get(f)??null;let y=L(e,f);return d.set(f,y),y},g=f=>{let y=c.get(f);if(y)return y;let v=_(e,f);return c.set(f,v),v},b=(f,y)=>{let v=p.get(f.file);if(!v){let h=re(e,f.file,f.source),S=Yt.read(e,f.file,h)??[];v={contentHash:h,roles:new Map(S.map(B=>[B.symbol,B])),dirty:!1},p.set(f.file,v)}let R=v.roles.get(y.symbol);if(R)return R;let x=Gr(f,y);return v.roles.set(y.symbol,{symbol:y.symbol,...x}),v.dirty=!0,x};for(r("runtime-boundaries.http-summary.seed",()=>{for(let f of t){if(f.action!=="http.request"||!f.owner.symbol||f.evidence!=="call-expression"&&f.evidence!=="client-adapter")continue;let y=g(f.owner.file).find(h=>h.symbol===f.owner.symbol);if(!y)continue;let v=m(y.relativePath);if(!v)continue;let R=b(v,y),x={definition:y,...R,constantMethods:f.keyParts.flatMap(h=>h.name==="method"&&h.evidence!=="expression"&&Le.has(h.value.toUpperCase())?[h.value.toUpperCase()]:[]),depth:0,proofObservationIds:[f.id],proofSpans:[f.source]};Qt(i,x)&&a.push(i.get(y.symbol))}});a.length>0;){let f=a.splice(0,a.length),y=r("runtime-boundaries.http-summary.resolve-call-sites",()=>Dt(e,f.map(v=>v.definition)),{batchSize:f.length});r("runtime-boundaries.http-summary.process-call-sites",()=>{for(let v of f)if(!(v.depth>=Vr))try{let R=y.get(v.definition.symbolId);if(!R)continue;u.push(...R.unresolved.map(x=>Ur(v,x)));for(let x of R.sites){let h=m(x.file);if(!h)continue;o.add(x.file);let S=x.callNode,B=zr(v,S,h);B&&s.push(B);let I=x.caller;if(!I)continue;let N=b(h,I),F=Kr(e,v,x),$={definition:I,pathParameterIndexes:$e([...N.pathParameterIndexes,...F.pathParameterIndexes]),methodParameterIndexes:$e([...N.methodParameterIndexes,...F.methodParameterIndexes]),constantMethods:ne([...v.constantMethods,...N.constantMethods]),depth:v.depth+1,proofObservationIds:ne([...v.proofObservationIds,...B?[B.id]:[]]),proofSpans:[...v.proofSpans,{file:x.file,startLine:x.startLine,endLine:x.endLine}]};Qt(i,$)&&a.push(i.get(I.symbol))}}catch(R){l.push(`builtin.http-summary failed for ${v.definition.relativePath}:${v.definition.startLine+1}: ${R instanceof Error?R.message:String(R)}`)}},{batchSize:f.length})}return Yt.writeBatch(e,[...p.entries()].flatMap(([f,y])=>y.dirty?[{relativePath:f,contentHash:y.contentHash,value:[...y.roles.values()].sort((v,R)=>v.symbol.localeCompare(R.symbol))}]:[])),{observations:s,frontiers:_e(u),summaries:i.size,filesInspected:o.size,errors:l}}function Ur(e,t){let n=ne([...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:${Hr("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:Re(t.file)}}function zr(e,t,n){let r=tn(t),i=e.pathParameterIndexes.flatMap(c=>{let p=V(n,r[c]);return p&&p.evidence!=="expression"&&Zr(p.value)?[{index:c,value:p}]:[]}),a=e.methodParameterIndexes.flatMap(c=>{let p=V(n,r[c]),m=p?.value.toUpperCase();return p&&m&&p.evidence!=="expression"&&Le.has(m)?[{index:c,value:{...p,value:m}}]:[]}),s=ne([...e.constantMethods,...a.map(c=>c.value.value)]);if(i.length!==1||s.length!==1)return null;let o=i[0].value,l=a.find(c=>c.value.value===s[0])?.value,u=[{name:"method",value:s[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:s[0]},derivation:l?.derivation},{name:"path",value:o.value,evidence:"constant",term:o.term,derivation:o.derivation}],d=Fe(n,t,"builtin.http-summary","http.request",u,"derived","compiler-resolved-http-summary");return d.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,d.source]},d}function Gr(e,t){let n=D(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=X(n),i=new Set,a=new Set,s=new Set;return k(n,o=>{if(o.type==="call_expression"&&((o.childForFieldName("function")??o.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let m=tn(o);pe(m[0],r,i);let g=Xr(m[1],"method");if(g){pe(g,r,a);let b=V(e,g),f=b?.value.toUpperCase();f&&b?.evidence!=="expression"&&Le.has(f)&&s.add(f)}else pe(m[1],r,a)}if(o.type!=="pair")return;let l=o.childForFieldName("key")??o.namedChild(0),u=o.childForFieldName("value")??o.namedChild(1),d=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(d==="url"||d==="path"||d==="endpoint")&&pe(u,r,i),(d==="init"||d==="requestinit"||d==="options")&&pe(u,r,a)}),{pathParameterIndexes:r.flatMap((o,l)=>o&&i.has(o)?[l]:[]),methodParameterIndexes:r.flatMap((o,l)=>o&&a.has(o)?[l]:[]),constantMethods:[...s].sort()}}function jr(e){return e.map(t=>[encodeURIComponent(t.symbol),t.pathParameterIndexes.join(","),t.methodParameterIndexes.join(","),t.constantMethods.join(",")].join(" ")).join(`
49
+ `)}function qr(e){if(!e)return[];let t=[];for(let n of e.split(`
50
+ `)){let r=n.split(" ");if(r.length!==4)return null;let i=Jt(r[1]),a=Jt(r[2]),s=r[3]?r[3].split(","):[];if(i===null||a===null||s.some(o=>!Le.has(o)))return null;t.push({symbol:decodeURIComponent(r[0]),pathParameterIndexes:i,methodParameterIndexes:a,constantMethods:s})}return t}function Jt(e){if(!e)return[];let t=e.split(",").map(Number);return t.every(n=>Number.isSafeInteger(n)&&n>=0)?t:null}function Kr(e,t,n){let r=ce(e,n);return{pathParameterIndexes:de(r,t.pathParameterIndexes),methodParameterIndexes:de(r,t.methodParameterIndexes)}}function Qt(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=$e([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=$e([...n.methodParameterIndexes,...t.methodParameterIndexes]),a=ne([...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:ne([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function Xr(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 pe(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 tn(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Zr(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function $e(e){return[...new Set(e)].sort((t,n)=>t-n)}function ne(e){return[...new Set(e)].sort()}import{createHash as Wr}from"crypto";function an(e){let t=nn(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=nn(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?nt(r).flatMap(i=>{let a=t.get(i)?.[0];return a?[rn(r,a,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?nt(r).flatMap(i=>{let a=n.get(i)?.[0];return a?[rn(r,a,i,"queue.consume")]:[]}):[])}function nn(e){let t=new Map;for(let n of e)for(let r of nt(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 nt(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function rn(e,t,n,r){let i=`database:${n}`,a=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",s=[e.id,r,i,a].join("\0");return{...e,id:`boundary:${Wr("sha256").update(s).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 ye="runtime-boundaries-v19",Qr=Jr(import.meta.url),w=Qr("typescript"),ei=new Set([w.SyntaxKind.WhitespaceTrivia,w.SyntaxKind.NewLineTrivia,w.SyntaxKind.SingleLineCommentTrivia,w.SyntaxKind.MultiLineCommentTrivia]),ti=new Set([w.SyntaxKind.NoSubstitutionTemplateLiteral,w.SyntaxKind.TemplateHead,w.SyntaxKind.TemplateMiddle,w.SyntaxKind.TemplateTail]),Ae=[{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}],ni=64,dn="builtin.http-summary",De={HTTP_HANDLE:"http.handle",HTTP_REQUEST:"http.request",REGISTRY_HANDLE:"registry.handle"},rt=new Set(Object.values(De));async function ri(e,t={}){let n=Se(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(Ni)),a=t.previousGraph?.fileCoverage,s=i.size>0&&t.previousGraph?.extractorVersion===ye&&a!==void 0&&a.length===t.previousGraph.coverage.filesScanned,o=s?a.filter(C=>r.has(C.file)&&!i.has(C.file)):[],l=new Set(o.flatMap(C=>C.observationIds)),u=s?t.previousGraph.observations.filter(C=>l.has(C.id)&&r.has(C.source.file)):[],d=s?n.filter(C=>i.has(C)):n,c=[],p=a?.reduce((C,P)=>C+P.observationIds.length,0)??0,m=performance.now(),g=await vi(e,d,t.profileSpan);j(c,"direct-extraction",m,d.length,g.observations.length,{filesVisited:d.length,filesReused:o.length,factsReused:u.length,factsInvalidated:Math.max(0,p-u.length)});let b=[...o,...g.fileCoverage].sort((C,P)=>C.file.localeCompare(P.file)),f=Ci(b),y=b.flatMap(C=>C.extractionErrors),v=me([...u,...g.observations]);if(s&&!t.forceDerivedRebuild&&t.previousGraph&&ii(a,g.fileCoverage,i)&&(!ci(e,t.previousGraph,i)||mi(a,g.fileCoverage,i)&&!fi(t.previousGraph,i))){for(let P of t.previousGraph.coverage.extractors)f.has(P.id)||f.set(P.id,P);let C=hi(t.previousGraph.coverage.phases);return c.push(...C),{...t.previousGraph,observations:t.previousGraph.observations,relationGroups:t.previousGraph.relationGroups,links:t.previousGraph.links,frontiers:t.previousGraph.frontiers,coverage:{filesScanned:n.length,filesWithAst:b.filter(P=>P.hasAst).length,filesWithoutAst:b.filter(P=>!P.hasAst).length,filesReused:o.length,extractors:[...f.values()],extractionErrors:t.previousGraph.coverage.extractionErrors,phases:c},fileCoverage:b}}let R=me([...v,...an(v)]),x=s&&t.previousGraph!==void 0?ai(t.previousGraph,a,g.fileCoverage,i,v):{reuse:!1,shapeUnchanged:!1,proofFilesUnchanged:!1,seedUnchanged:!1},h=x.reuse;t.profileSpan?.("runtime-boundaries.http-summary.reuse-decision",()=>{},x),m=performance.now();let S;if(h){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="http-summary"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.wrapper");S={observations:t.previousGraph.observations.filter(E=>E.extractor===dn),frontiers:t.previousGraph.frontiers.filter(E=>E.kind==="call-resolution"&&E.action===De.HTTP_REQUEST),summaries:0,filesInspected:C?.filesVisited??P?.applicableFiles??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.http-summary failed"))},j(c,"http-summary",m,R.length,S.observations.length,{filesVisited:0,filesReused:S.filesInspected,factsReused:S.observations.length+S.frontiers.length,factsInvalidated:0}),P&&f.set(P.id,P)}else S=en(e,R,t.profileSpan),j(c,"http-summary",m,R.length,S.observations.length,{filesVisited:S.filesInspected}),f.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:S.filesInspected,observations:S.observations.length,errors:S.errors.length});y.push(...S.errors);let B=me([...R,...S.observations]);m=performance.now();let I=Zt(e,B);j(c,"http-mount",m,B.length,I.observations.length,{filesVisited:I.filesInspected});let N=me([...B,...I.observations]);m=performance.now();let F=h&&t.previousGraph!==void 0&&oi(t.previousGraph,a,g.fileCoverage,i),$;if(F){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="carrier"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.carrier");$={observations:t.previousGraph.observations.filter(E=>E.extractor==="builtin.carrier"),bodySummaries:P?.applicableFiles??0,discriminatorSummaries:0,filesInspected:C?.filesVisited??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.carrier"))},j(c,"carrier",m,N.length,$.observations.length,{filesVisited:0,filesReused:$.filesInspected,factsReused:$.observations.length,factsInvalidated:0}),P&&f.set(P.id,P)}else $=Ut(e,N,b.flatMap(C=>C.bodySummaries??[])),j(c,"carrier",m,N.length,$.observations.length,{filesVisited:$.filesInspected}),f.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:$.bodySummaries,observations:$.observations.length,errors:$.errors.length});y.push(...$.errors);let K=me([...N,...$.observations]);m=performance.now();let J=Bi(K);j(c,"relations",m,K.length,J.length),m=performance.now();let it=Pi(K,J);j(c,"links",m,J.length,it.length),wi(K,J),m=performance.now();let at=_e([...Ei(K,J),...S.frontiers]);return j(c,"frontiers",m,K.length,at.length),{schemaVersion:2,extractorVersion:ye,observations:K,relationGroups:J,links:it,frontiers:at,coverage:{filesScanned:n.length,filesWithAst:b.filter(C=>C.hasAst).length,filesWithoutAst:b.filter(C=>!C.hasAst).length,...s?{filesReused:o.length}:{},extractors:[...f.values()],extractionErrors:y,phases:c},fileCoverage:b}}function ii(e,t,n){if(!e)return!1;let r=e.filter(a=>n.has(a.file)).filter(on).map(sn).sort((a,s)=>a.file.localeCompare(s.file)),i=t.filter(on).map(sn).sort((a,s)=>a.file.localeCompare(s.file));return JSON.stringify(r)===JSON.stringify(i)}function on(e){return e.observationIds.length>0||e.extractionErrors.length>0}function sn(e){let{syntaxHash:t,shapeHash:n,bodySummaries:r,...i}=e;return i}function ai(e,t,n,r,i){let a=li(t,n,r),s=ui(e),l=![...pn(t,n)].some(p=>s.has(p)),u=new Set((t??[]).filter(p=>r.has(p.file)).flatMap(p=>p.observationIds)),d=new Set(n.flatMap(p=>p.observationIds)),c=ln(e.observations,u)===ln(i,d);return{reuse:a&&l&&c,shapeUnchanged:a,proofFilesUnchanged:l,seedUnchanged:c}}function pn(e,t){let n=new Map(e?.map(r=>[r.file,r.syntaxHash])??[]);return new Set(t.filter(r=>r.syntaxHash===void 0||n.get(r.file)!==r.syntaxHash).map(r=>r.file))}function oi(e,t,n,r){if(!t)return!1;let i=t.filter(l=>r.has(l.file)).map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file)),a=n.map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file));if(JSON.stringify(i)!==JSON.stringify(a))return!1;let s=pn(t,n),o=si(e,"builtin.carrier");return![...s].some(l=>o.has(l))}function si(e,t){let n=new Set;for(let r of e.observations)if(r.extractor===t){n.add(r.source.file);for(let i of r.derivation.sourceSpans)n.add(i.file)}return n}function li(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.shapeHash]));return t.length===n.size&&t.every(i=>i.shapeHash!==void 0&&r.get(i.file)===i.shapeHash)}function ui(e){let t=new Set;for(let n of e.observations)if(n.extractor===dn){t.add(n.source.file);for(let r of n.derivation.sourceSpans)t.add(r.file)}for(let n of e.frontiers)n.kind==="call-resolution"&&n.action===De.HTTP_REQUEST&&n.source&&t.add(n.source.file);return t}function ln(e,t){return JSON.stringify(e.filter(n=>t.has(n.id)&&n.action===De.HTTP_REQUEST&&n.owner.symbol!==null&&(n.evidence==="call-expression"||n.evidence==="client-adapter")).map(n=>({ownerSymbol:n.owner.symbol,evidence:n.evidence,methods:n.keyParts.filter(r=>r.name==="method"&&r.evidence!=="expression").map(r=>r.value.toUpperCase()).sort()})).sort((n,r)=>`${n.ownerSymbol}\0${n.evidence}\0${n.methods.join(",")}`.localeCompare(`${r.ownerSymbol}\0${r.evidence}\0${r.methods.join(",")}`)))}function ci(e,t,n){let r=di(t),i=pi(t);if([...n].some(o=>r.has(o)))return!0;if(i.size===0||n.size===0)return!1;if(!!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))return!0;let s=[...n];for(let o=0;o<s.length;o+=750){let l=s.slice(o,o+750),u=l.map(()=>"?").join(",");if(e.all(`SELECT DISTINCT global_symbol.symbol
51
51
  FROM mentions mention
52
52
  JOIN chunks reference_chunk ON reference_chunk.id = mention.chunk_id
53
53
  JOIN documents reference_document ON reference_document.id = reference_chunk.document_id
54
54
  JOIN global_symbols global_symbol ON global_symbol.id = mention.symbol_id
55
55
  WHERE mention.role != 1
56
- AND reference_document.relative_path IN (${u})`,...l).some(c=>i.has(c.symbol)))return!0}return!1}function ci(e){let t=new Set;for(let n of e.observations)if(rt.has(n.action)){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)!n.action||!rt.has(n.action)||!n.source||t.add(n.source.file);return t}function di(e){return new Set(e.observations.flatMap(t=>rt.has(t.action)&&t.owner.symbol?[t.owner.symbol]:[]))}function pi(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.syntaxHash]));return t.length===n.size&&t.every(i=>i.syntaxHash!==void 0&&r.get(i.file)===i.syntaxHash)}function fi(e,t){let n=mi(e);return[...t].some(r=>n.has(r))}function mi(e){let t=new Set;for(let n of e.observations){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)n.source&&t.add(n.source.file);return t}function yi(e){return(e??[]).filter(t=>t.id!=="direct-extraction").map(t=>({...t,durationMs:0,filesVisited:0,filesReused:t.filesVisited??0,factsReused:t.outputFacts,factsInvalidated:0}))}function G(e,t,n,r,i,a={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...a})}var hi=256;async function gi(e,t,n){let r=[],i=[],a=n??((c,p)=>p()),s=[],o=[],l=new Map,u=c=>{let p=l.get(c);if(p!==void 0)return p;let f=re(e,c,Me(e,c));return l.set(c,f),f},d=0;for(let c of t){d+=1,d>=hi&&(d=0,await Wr());let p=a("runtime-boundaries.file.read",()=>Me(e,c)),f=re(e,c,p);l.set(c,f);let g=a("runtime-boundaries.file.direct-product",()=>{let h=un.read(e,c,f);if(!h||h.extractorVersion!==ye)return null;for(let S of h.deps)if(u(S.path)!==S.contentHash)return null;return h});if(g){r.push(...g.observations),i.push(g.coverage);continue}let b=a("runtime-boundaries.file.supports",()=>Xe.filter(h=>h.supports(p))),m=/\bJSON\.stringify\s*\(/u.test(p)&&/\bbody\s*:/u.test(p),y=a("runtime-boundaries.file.hashes",()=>{let h=ln.read(e,c,f);if(h)return h;let S=vi(c,p);return s.push({relativePath:c,contentHash:f,value:S}),S}),v=new Set,R=[],x=ot(h=>v.add(h),()=>{let h=b.length>0||m?L(e,c,p,n):null,S={file:c,hasAst:h!==null||xi(c,p),syntaxHash:y.syntaxHash,shapeHash:y.shapeHash,bodySummaries:h&&m?Ut(h):[],observationIds:[],extractors:[],extractionErrors:[]};if(h)for(let B of b){let I={id:B.id,applicableFiles:1,observations:0,errors:0};try{let N=Si(n,`runtime-boundaries.extractor.${B.id}`,c,()=>B.extract(h));I.observations=N.length,R.push(...N),S.observationIds.push(...N.map(F=>F.id))}catch(N){I.errors=1,S.extractionErrors.push(`${B.id} failed for ${c}: ${N instanceof Error?N.message:String(N)}`)}S.extractors.push(I)}return S});r.push(...R),i.push(x),x.extractionErrors.length===0&&(v.delete(c),o.push({relativePath:c,contentHash:f,value:{extractorVersion:ye,deps:[...v].sort().map(h=>({path:h,contentHash:u(h)})),observations:R,coverage:x}}))}return s.length>0&&ln.writeBatch(e,s),o.length>0&&un.writeBatch(e,o),{observations:r,fileCoverage:i}}var ln=ie({kind:"runtime-boundary-source-hashes",invalidation:ae("runtime-boundary-source-hashes"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.syntaxHash=="string"&&typeof t.shapeHash=="string"?{syntaxHash:t.syntaxHash,shapeHash:t.shapeHash}:null}catch{return null}}}),un=ie({kind:"runtime-boundary-direct-extraction",invalidation:ae("runtime-boundary-direct-extraction"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.extractorVersion!="string"||!Array.isArray(t.deps)||!Array.isArray(t.observations)||typeof t.coverage!="object"||t.coverage===null||!t.deps.every(n=>typeof n=="object"&&n!==null&&typeof n.path=="string"&&typeof n.contentHash=="string")?null:t}catch{return null}}});function vi(e,t){if(!/\.(?:[cm]?[jt]sx?)$/iu.test(e)){let u=me("sha256").update(t).digest("hex");return{syntaxHash:u,shapeHash:u}}let n=/\.[jt]sx$/iu.test(e)?w.LanguageVariant.JSX:w.LanguageVariant.Standard,r=w.createScanner(w.ScriptTarget.Latest,!1,n,t),i=me("sha256"),a=me("sha256"),s=[],o=[0];for(let u=0;u<t.length;u+=1)t.charCodeAt(u)===10&&o.push(u+1);let l=0;for(let u=r.scan();u!==w.SyntaxKind.EndOfFileToken;u=r.scan()){if(u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)===0&&(u=r.reScanTemplateToken(!1)),Qr.has(u))continue;let d=r.getTokenText();for(;o[l+1]!==void 0&&o[l+1]<=r.getTokenPos();)l+=1;i.update(String(u)),i.update("\0"),i.update(d),i.update("\0"),i.update(String(l)),i.update("\0"),a.update(String(u)),a.update("\0"),!ei.has(u)&&!bi(u,d)&&a.update(d),a.update("\0"),a.update(String(l)),a.update("\0"),u===w.SyntaxKind.TemplateHead?s.push(0):u===w.SyntaxKind.TemplateTail?s.pop():u===w.SyntaxKind.OpenBraceToken&&s.length>0?s[s.length-1]+=1:u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)>0&&(s[s.length-1]-=1)}return{syntaxHash:i.digest("hex"),shapeHash:a.digest("hex")}}function bi(e,t){if(e!==w.SyntaxKind.StringLiteral||t.length<2)return!1;let n=t.slice(1,-1);return n.startsWith("/")||n.includes("://")}function Si(e,t,n,r){return e?e(t,r,{file:n}):r()}function xi(e,t){return t?st(e)?/<script\b/iu.test(t):ve(e)!==null:!1}function Ri(e){let t=new Map(Xe.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 Ci(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function Ni(e){let t=new Map;for(let n of Ae){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=Fi(i,n.keyNames);if(!a)continue;let s=a.map(c=>`${c.name}=${fn(c.name,c.value)}`).join("\0"),o=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${o}\0${s}`,u=`boundary-group:${me("sha256").update(l).digest("hex").slice(0,16)}`,d=t.get(u)??{id:u,protocol:n.protocol,joinRule:n.id,normalizedKey:s,keyParts:a,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&d.producerIds.push(i.id),n.consumerActions.includes(i.action)&&d.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&d.declarationIds.push(i.id),d.derivation.inputFactIds.push(i.id),d.derivation.sourceSpans.push(i.source),t.set(u,d)}}return[...t.values()].map(Bi).sort(_i)}function Bi(e){return{...e,producerIds:ke(e.producerIds),consumerIds:ke(e.consumerIds),declarationIds:ke(e.declarationIds),derivation:{...e.derivation,inputFactIds:ke(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function Ii(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let a=Ae.find(o=>o.id===i.joinRule);if(!a?.traversable)continue;let s=a.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(s.length===0||i.consumerIds.length===0)&&!(a.requireUniquePair&&(s.length!==1||i.consumerIds.length!==1))&&!(a.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(s.length*i.consumerIds.length>ti))for(let o of s)for(let l of i.consumerIds){let u=n.get(o),d=n.get(l);if(!u||!d||Ti(u,d))continue;let c=u.strength==="derived"||d.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${o}\0${l}`,f={id:`boundary-link:${me("sha256").update(p).digest("hex").slice(0,16)}`,from:o,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:c,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[o,l],sourceSpans:[u.source,d.source]}};r.set(f.id,f)}}return[...r.values()].sort($i)}function Pi(e,t){let n=new Set(t.filter(pn).flatMap(Oe)),r=new Set(t.filter(Ei).flatMap(Oe));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function wi(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(Oe)),i=new Set(t.filter(pn).flatMap(Oe));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 s=a.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),o=s.length>0?`${a.extractor} observed ${a.action}, but ${s.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:o,missingKeyParts:s,sourceScope:a.sourceScope}}).sort((a,s)=>a.observationId.localeCompare(s.observationId))}function Oe(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function pn(e){let t=Ae.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 Ei(e){let t=Ae.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 Fi(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:fn(r,i.value)})}return n}function fn(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 Ti(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function fe(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 ke(e){return[...new Set(e)].sort()}function _i(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function $i(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}export{Re as a,V as b,Je as c,ce as d,ye as e,ni as f,yn as g,hn as h,vt as i};
57
- //# sourceMappingURL=chunk-N7FP5H5U.js.map
56
+ AND reference_document.relative_path IN (${u})`,...l).some(c=>i.has(c.symbol)))return!0}return!1}function di(e){let t=new Set;for(let n of e.observations)if(rt.has(n.action)){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)!n.action||!rt.has(n.action)||!n.source||t.add(n.source.file);return t}function pi(e){return new Set(e.observations.flatMap(t=>rt.has(t.action)&&t.owner.symbol?[t.owner.symbol]:[]))}function mi(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.syntaxHash]));return t.length===n.size&&t.every(i=>i.syntaxHash!==void 0&&r.get(i.file)===i.syntaxHash)}function fi(e,t){let n=yi(e);return[...t].some(r=>n.has(r))}function yi(e){let t=new Set;for(let n of e.observations){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)n.source&&t.add(n.source.file);return t}function hi(e){return(e??[]).filter(t=>t.id!=="direct-extraction").map(t=>({...t,durationMs:0,filesVisited:0,filesReused:t.filesVisited??0,factsReused:t.outputFacts,factsInvalidated:0}))}function j(e,t,n,r,i,a={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...a})}var gi=256;async function vi(e,t,n){let r=[],i=[],a=n??((c,p)=>p()),s=[],o=[],l=new Map,u=c=>{let p=l.get(c);if(p!==void 0)return p;let m=re(e,c,Me(e,c));return l.set(c,m),m},d=0;for(let c of t){d+=1,d>=gi&&(d=0,ut(),await Yr());let p=a("runtime-boundaries.file.read",()=>Me(e,c)),m=re(e,c,p);l.set(c,m);let g=a("runtime-boundaries.file.direct-product",()=>{let h=cn.read(e,c,m);if(!h||h.extractorVersion!==ye)return null;for(let S of h.deps)if(u(S.path)!==S.contentHash)return null;return h});if(g){r.push(...g.observations),i.push(g.coverage);continue}let b=a("runtime-boundaries.file.supports",()=>Xe.filter(h=>h.supports(p))),f=/\bJSON\.stringify\s*\(/u.test(p)&&/\bbody\s*:/u.test(p),y=a("runtime-boundaries.file.hashes",()=>{let h=un.read(e,c,m);if(h)return h;let S=bi(c,p);return s.push({relativePath:c,contentHash:m,value:S}),S}),v=new Set,R=[],x=ot(h=>v.add(h),()=>{let h=b.length>0||f?L(e,c,p,n):null,S={file:c,hasAst:h!==null||Ri(c,p),syntaxHash:y.syntaxHash,shapeHash:y.shapeHash,bodySummaries:h&&f?zt(h):[],observationIds:[],extractors:[],extractionErrors:[]};if(h)for(let B of b){let I={id:B.id,applicableFiles:1,observations:0,errors:0};try{let N=xi(n,`runtime-boundaries.extractor.${B.id}`,c,()=>B.extract(h));I.observations=N.length,R.push(...N),S.observationIds.push(...N.map(F=>F.id))}catch(N){I.errors=1,S.extractionErrors.push(`${B.id} failed for ${c}: ${N instanceof Error?N.message:String(N)}`)}S.extractors.push(I)}return S});r.push(...R),i.push(x),x.extractionErrors.length===0&&(v.delete(c),o.push({relativePath:c,contentHash:m,value:{extractorVersion:ye,deps:[...v].sort().map(h=>({path:h,contentHash:u(h)})),observations:R,coverage:x}}))}return s.length>0&&un.writeBatch(e,s),o.length>0&&cn.writeBatch(e,o),{observations:r,fileCoverage:i}}var un=ie({kind:"runtime-boundary-source-hashes",invalidation:ae("runtime-boundary-source-hashes"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.syntaxHash=="string"&&typeof t.shapeHash=="string"?{syntaxHash:t.syntaxHash,shapeHash:t.shapeHash}:null}catch{return null}}}),cn=ie({kind:"runtime-boundary-direct-extraction",invalidation:ae("runtime-boundary-direct-extraction"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.extractorVersion!="string"||!Array.isArray(t.deps)||!Array.isArray(t.observations)||typeof t.coverage!="object"||t.coverage===null||!t.deps.every(n=>typeof n=="object"&&n!==null&&typeof n.path=="string"&&typeof n.contentHash=="string")?null:t}catch{return null}}});function bi(e,t){if(!/\.(?:[cm]?[jt]sx?)$/iu.test(e)){let u=fe("sha256").update(t).digest("hex");return{syntaxHash:u,shapeHash:u}}let n=/\.[jt]sx$/iu.test(e)?w.LanguageVariant.JSX:w.LanguageVariant.Standard,r=w.createScanner(w.ScriptTarget.Latest,!1,n,t),i=fe("sha256"),a=fe("sha256"),s=[],o=[0];for(let u=0;u<t.length;u+=1)t.charCodeAt(u)===10&&o.push(u+1);let l=0;for(let u=r.scan();u!==w.SyntaxKind.EndOfFileToken;u=r.scan()){if(u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)===0&&(u=r.reScanTemplateToken(!1)),ei.has(u))continue;let d=r.getTokenText();for(;o[l+1]!==void 0&&o[l+1]<=r.getTokenPos();)l+=1;i.update(String(u)),i.update("\0"),i.update(d),i.update("\0"),i.update(String(l)),i.update("\0"),a.update(String(u)),a.update("\0"),!ti.has(u)&&!Si(u,d)&&a.update(d),a.update("\0"),a.update(String(l)),a.update("\0"),u===w.SyntaxKind.TemplateHead?s.push(0):u===w.SyntaxKind.TemplateTail?s.pop():u===w.SyntaxKind.OpenBraceToken&&s.length>0?s[s.length-1]+=1:u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)>0&&(s[s.length-1]-=1)}return{syntaxHash:i.digest("hex"),shapeHash:a.digest("hex")}}function Si(e,t){if(e!==w.SyntaxKind.StringLiteral||t.length<2)return!1;let n=t.slice(1,-1);return n.startsWith("/")||n.includes("://")}function xi(e,t,n,r){return e?e(t,r,{file:n}):r()}function Ri(e,t){return t?st(e)?/<script\b/iu.test(t):ve(e)!==null:!1}function Ci(e){let t=new Map(Xe.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 Ni(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function Bi(e){let t=new Map;for(let n of Ae){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=Ti(i,n.keyNames);if(!a)continue;let s=a.map(c=>`${c.name}=${fn(c.name,c.value)}`).join("\0"),o=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${o}\0${s}`,u=`boundary-group:${fe("sha256").update(l).digest("hex").slice(0,16)}`,d=t.get(u)??{id:u,protocol:n.protocol,joinRule:n.id,normalizedKey:s,keyParts:a,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&d.producerIds.push(i.id),n.consumerActions.includes(i.action)&&d.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&d.declarationIds.push(i.id),d.derivation.inputFactIds.push(i.id),d.derivation.sourceSpans.push(i.source),t.set(u,d)}}return[...t.values()].map(Ii).sort($i)}function Ii(e){return{...e,producerIds:ke(e.producerIds),consumerIds:ke(e.consumerIds),declarationIds:ke(e.declarationIds),derivation:{...e.derivation,inputFactIds:ke(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function Pi(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let a=Ae.find(o=>o.id===i.joinRule);if(!a?.traversable)continue;let s=a.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(s.length===0||i.consumerIds.length===0)&&!(a.requireUniquePair&&(s.length!==1||i.consumerIds.length!==1))&&!(a.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(s.length*i.consumerIds.length>ni))for(let o of s)for(let l of i.consumerIds){let u=n.get(o),d=n.get(l);if(!u||!d||_i(u,d))continue;let c=u.strength==="derived"||d.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${o}\0${l}`,m={id:`boundary-link:${fe("sha256").update(p).digest("hex").slice(0,16)}`,from:o,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:c,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[o,l],sourceSpans:[u.source,d.source]}};r.set(m.id,m)}}return[...r.values()].sort(Li)}function wi(e,t){let n=new Set(t.filter(mn).flatMap(Oe)),r=new Set(t.filter(Fi).flatMap(Oe));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function Ei(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(Oe)),i=new Set(t.filter(mn).flatMap(Oe));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 s=a.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),o=s.length>0?`${a.extractor} observed ${a.action}, but ${s.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:o,missingKeyParts:s,sourceScope:a.sourceScope}}).sort((a,s)=>a.observationId.localeCompare(s.observationId))}function Oe(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function mn(e){let t=Ae.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 Fi(e){let t=Ae.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 Ti(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:fn(r,i.value)})}return n}function fn(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 _i(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function me(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 ke(e){return[...new Set(e)].sort()}function $i(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function Li(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}export{Re as a,V as b,Je as c,ce as d,ye as e,ri as f,hn as g,gn as h,bt as i};
57
+ //# sourceMappingURL=chunk-VUPHCS7Y.js.map
@@ -1,4 +1,4 @@
1
- import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{S as p}from"./chunk-C7IJMOFP.js";import{a as c}from"./chunk-YXPUP5G2.js";import{a as f,c as g,e as d}from"./chunk-DRENNWRG.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
1
+ import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{U as p}from"./chunk-3L2ZBPEX.js";import{a as c}from"./chunk-YXPUP5G2.js";import{a as f,c as g,e as d}from"./chunk-DRENNWRG.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
2
2
  FROM defn_enclosing_ranges der
3
3
  JOIN global_symbols gs ON der.symbol_id = gs.id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -20,4 +20,4 @@ import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{S as p}from"./chunk
20
20
  ${n.symbolNoiseFor("gs")}
21
21
  AND d.relative_path IN (${i})
22
22
  ORDER BY d.relative_path, der.start_line, der.end_line, gs.symbol`,...e))}return t}function N(n){let s=[];for(let t=0;t<n.length;t+=_)s.push(n.slice(t,t+_));return s}function R(n){return{symbol:n.symbol,kind:n.kind,documentation:n.documentation,enclosing_symbol:n.enclosingSymbol,relative_path:n.relativePath,start_line:n.startLine,end_line:n.endLine}}function k(n){return n.kind!==null&&n.kind!==0?D(n.kind,n.symbol,n.documentation):C(n.symbol,n.documentation,n.enclosing_symbol)}function D(n,s,t){let e=(t??"").toLowerCase();if(d(s)==="type"){if(e.includes("type "))return o.TypeAlias;if(e.includes("interface "))return o.Interface;if(e.includes("struct "))return o.Struct;if(e.includes("trait "))return o.Trait;if(e.includes("class "))return o.Class}return n}function C(n,s,t){let e=f(n);if("kind"in e)return null;let i=e.descriptors,l=i[i.length-2]??null,u=d(n),r=(s??"").toLowerCase();return u==="type"?r.includes("type ")?o.TypeAlias:r.includes("interface ")?o.Interface:r.includes("struct ")?o.Struct:r.includes("trait ")?o.Trait:r.includes("class ")?o.Class:o.Class:u==="method"?l?.suffix==="type"?o.Method:o.Function:u==="namespace"?o.Module:u!=="term"?null:r.includes("async def ")||r.includes("def ")?o.Function:(t?d(t):l?.suffix??null)==="type"?o.Field:o.Variable}export{v as a,T as b};
23
- //# sourceMappingURL=chunk-JAT6C3VX.js.map
23
+ //# sourceMappingURL=chunk-VVZSBTSU.js.map
@@ -1,2 +1,2 @@
1
- import{a as R}from"./chunk-H7CG6LOE.js";import{a as D}from"./chunk-ZYM4HOFA.js";import{a as g}from"./chunk-URSGGIZX.js";import{a as F}from"./chunk-7XZGZBSQ.js";import{a as y}from"./chunk-ISWFRGJ6.js";import{e as f}from"./chunk-6VEFRPTD.js";import{j as d}from"./chunk-TD7VKJ2Y.js";import{O as h}from"./chunk-7JYHQAH2.js";var A=.7,S=.62,C=.45;function J(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=y(i,{historyMode:t.historyMode}).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let r=P(s,e);if(r.size===0)return{available:!0,windowCommits:e,findings:[]};let b=B(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:r}).map(l=>O(l,s,e)).filter(l=>l!==null);b.sort((l,c)=>(l.kind===c.kind?0:l.kind==="echo"?-1:1)||c.similarity-l.similarity||l.echoFile.localeCompare(c.echoFile)||l.echoSymbol.localeCompare(c.echoSymbol)||l.domain.localeCompare(c.domain));let p=b.slice(0,n).map(M);return{available:!0,windowCommits:e,findings:p,rootCauseGroups:N(p)}}function B(i,t){let e=K(t.limit),n=[...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??A,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=h(i,{scope:t.scope});return a.react&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...T(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function k(i,t){return f(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).filter(e=>!d(e.symbolA)&&!d(e.symbolB)).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function E(i,t){return u(i,t,{query:g,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).filter(n=>e.acceptPair?.(n)??!0).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:G(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:F,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,acceptPair:w,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}var I=new Set(["useCallback","useEffect","useLayoutEffect","useMemo","useMutation","useQueries","useQuery","useQueryClient","useReducer","useRef","useState"]);function w(i){return i.sharedHooks.some(t=>!I.has(t))||i.sharedState.length>0||i.sharedHandlers.length>0||i.sharedHandlerVerbs.length>=2}function x(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function T(i,t){return u(i,t,{query:R,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function P(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function O(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let r=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:r?i.symbolA:i.symbolB,echoFile:r?i.fileA:i.fileB,echoAgeCommits:(r?n:a)??0,establishedSymbol:r?i.symbolB:i.symbolA,establishedFile:r?i.fileB:i.fileA,establishedAgeCommits:r?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function M(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:H(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let r of n.sharedEvidence)s.sharedEvidence.add(r)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function H(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function G(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{J as a};
2
- //# sourceMappingURL=chunk-FBCVASUG.js.map
1
+ import{a as R}from"./chunk-LMZ5PRUV.js";import{a as D}from"./chunk-F7DY272B.js";import{a as g}from"./chunk-FFRKR4EQ.js";import{a as F}from"./chunk-3JKSW6LJ.js";import{a as y}from"./chunk-6HFCYNYE.js";import{e as f}from"./chunk-TQPCBMWT.js";import{j as d}from"./chunk-N2ZSIIGR.js";import{O as h}from"./chunk-ZOHS7AQV.js";var A=.7,S=.62,C=.45;function J(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=y(i,{historyMode:t.historyMode}).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let r=P(s,e);if(r.size===0)return{available:!0,windowCommits:e,findings:[]};let b=B(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:r}).map(l=>O(l,s,e)).filter(l=>l!==null);b.sort((l,c)=>(l.kind===c.kind?0:l.kind==="echo"?-1:1)||c.similarity-l.similarity||l.echoFile.localeCompare(c.echoFile)||l.echoSymbol.localeCompare(c.echoSymbol)||l.domain.localeCompare(c.domain));let p=b.slice(0,n).map(M);return{available:!0,windowCommits:e,findings:p,rootCauseGroups:N(p)}}function B(i,t){let e=K(t.limit),n=[...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??A,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=h(i,{scope:t.scope});return a.react&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...T(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function k(i,t){return f(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).filter(e=>!d(e.symbolA)&&!d(e.symbolB)).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function E(i,t){return u(i,t,{query:g,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).filter(n=>e.acceptPair?.(n)??!0).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:G(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:F,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,acceptPair:w,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}var I=new Set(["useCallback","useEffect","useLayoutEffect","useMemo","useMutation","useQueries","useQuery","useQueryClient","useReducer","useRef","useState"]);function w(i){return i.sharedHooks.some(t=>!I.has(t))||i.sharedState.length>0||i.sharedHandlers.length>0||i.sharedHandlerVerbs.length>=2}function x(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function T(i,t){return u(i,t,{query:R,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function P(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function O(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let r=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:r?i.symbolA:i.symbolB,echoFile:r?i.fileA:i.fileB,echoAgeCommits:(r?n:a)??0,establishedSymbol:r?i.symbolB:i.symbolA,establishedFile:r?i.fileB:i.fileA,establishedAgeCommits:r?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function M(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:H(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let r of n.sharedEvidence)s.sharedEvidence.add(r)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function H(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function G(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{J as a};
2
+ //# sourceMappingURL=chunk-VZRNID6A.js.map