scip-query 0.21.0 → 0.22.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.
- package/CHANGELOG.md +72 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-4IYG2SKW.js +2 -0
- package/dist/call-graph-WQNXMNNN.js +2 -0
- package/dist/{chunk-AQDWTCDC.js → chunk-25GWKRUZ.js} +2 -2
- package/dist/chunk-2BTJALUS.js +454 -0
- package/dist/chunk-2KVU55CW.js +11 -0
- package/dist/{chunk-BBWPOMGU.js → chunk-2OXVP5U5.js} +2 -2
- package/dist/{chunk-D5W4UZY5.js → chunk-2RE5OCHZ.js} +2 -2
- package/dist/{chunk-2I3RSUWX.js → chunk-2XCGSDIT.js} +2 -2
- package/dist/{chunk-V7LQZTTZ.js → chunk-2YC7YNKT.js} +2 -2
- package/dist/chunk-3QXC54FQ.js +3 -0
- package/dist/{chunk-32A42O5B.js → chunk-3TJY6M3B.js} +2 -2
- package/dist/chunk-42W3LFUK.js +13 -0
- package/dist/chunk-44T4DUAA.js +2 -0
- package/dist/chunk-4GAQ6FI4.js +43 -0
- package/dist/{chunk-4S4DF62J.js → chunk-4HE7MVWD.js} +2 -2
- package/dist/{chunk-TGWNNMPF.js → chunk-4TQU4TX2.js} +2 -2
- package/dist/{chunk-SKUMCCC5.js → chunk-56NQAEPJ.js} +2 -2
- package/dist/chunk-57N6LN2A.js +3 -0
- package/dist/{chunk-LPGDO2XA.js → chunk-5H5WTJSD.js} +2 -2
- package/dist/{chunk-EA4SH4U5.js → chunk-5YRQIE2B.js} +2 -2
- package/dist/{chunk-O2RM7E7L.js → chunk-5ZMBRQFC.js} +4 -4
- package/dist/{chunk-ICHBVITH.js → chunk-6HRZQLOI.js} +2 -2
- package/dist/{chunk-WULAPQUD.js → chunk-6NC3YSPY.js} +2 -2
- package/dist/{chunk-IDPLC3FI.js → chunk-6VEFRPTD.js} +2 -2
- package/dist/{chunk-IOKWFRFQ.js → chunk-7C26EKLZ.js} +2 -2
- package/dist/{chunk-S3RTPPLQ.js → chunk-7IQXARSQ.js} +2 -2
- package/dist/chunk-7JYHQAH2.js +22 -0
- package/dist/chunk-7KSO2OAP.js +2 -0
- package/dist/{chunk-2ZBMOQGG.js → chunk-7U2YQSDE.js} +2 -2
- package/dist/{chunk-EKZRF57O.js → chunk-7XA3OM44.js} +2 -2
- package/dist/{chunk-4EXFZP6H.js → chunk-7XZGZBSQ.js} +2 -2
- package/dist/chunk-7YQOCABQ.js +2 -0
- package/dist/chunk-A77SCPW2.js +3 -0
- package/dist/chunk-AK3PYTIK.js +5 -0
- package/dist/chunk-AMIMMNA4.js +11 -0
- package/dist/{chunk-MOBF2GH6.js → chunk-AQ2PORIO.js} +2 -2
- package/dist/{chunk-YUFWLWIC.js → chunk-ARVO6TTW.js} +2 -2
- package/dist/chunk-AUY5BL74.js +2 -0
- package/dist/{chunk-RGCJ4646.js → chunk-AYPDH2LU.js} +2 -2
- package/dist/{chunk-73Z33VFI.js → chunk-AZS7YPCB.js} +2 -2
- package/dist/{chunk-SYUNTKO2.js → chunk-BDGTPN27.js} +2 -2
- package/dist/{chunk-BATIVRU2.js → chunk-BDHFVH2M.js} +2 -2
- package/dist/chunk-BECZLYNU.js +8 -0
- package/dist/chunk-BJT7LSPK.js +3 -0
- package/dist/{chunk-6SWA6B24.js → chunk-BTVKZGWT.js} +2 -2
- package/dist/{chunk-QD7IFBCR.js → chunk-BUTEIZKP.js} +2 -2
- package/dist/{chunk-UZFCZ7SJ.js → chunk-BVFYEEBH.js} +2 -2
- package/dist/{chunk-ICUQONOG.js → chunk-BWVQP3LB.js} +2 -2
- package/dist/chunk-BYDAFMSR.js +57 -0
- package/dist/{chunk-BHE44MHT.js → chunk-C76O5MDS.js} +2 -2
- package/dist/chunk-C7IJMOFP.js +134 -0
- package/dist/{chunk-CN2WGM7D.js → chunk-CBBHFNLX.js} +2 -2
- package/dist/{chunk-COTMS5KM.js → chunk-CKRWA452.js} +2 -2
- package/dist/{chunk-ANWGXPPN.js → chunk-CLG6DWVS.js} +2 -2
- package/dist/chunk-D2MVJSP4.js +21 -0
- package/dist/chunk-D35XIZGN.js +2 -0
- package/dist/{chunk-U7DR7MJD.js → chunk-DEAB5TGT.js} +2 -2
- package/dist/{chunk-6GJAP4OE.js → chunk-DJAO2OZJ.js} +2 -2
- package/dist/chunk-DKM723YF.js +79 -0
- package/dist/{chunk-4IIMPWMR.js → chunk-DPWKKNKI.js} +2 -2
- package/dist/chunk-E44IVWIJ.js +367 -0
- package/dist/chunk-EDMB6SSO.js +7 -0
- package/dist/{chunk-KWARB5FZ.js → chunk-EELG7D3Q.js} +2 -2
- package/dist/chunk-EELPBR7E.js +3 -0
- package/dist/chunk-EETGXQY7.js +3 -0
- package/dist/chunk-ENWQWA2R.js +2 -0
- package/dist/{chunk-HUZNZ3H2.js → chunk-ERCYGVAM.js} +2 -2
- package/dist/{chunk-WSG3DK5H.js → chunk-EWWY2ZFL.js} +2 -2
- package/dist/chunk-F24G5NBE.js +3 -0
- package/dist/{chunk-XRXCANFQ.js → chunk-F24QUEQP.js} +2 -2
- package/dist/{chunk-KFK7GF5C.js → chunk-FBCVASUG.js} +2 -2
- package/dist/{chunk-35IW3P4H.js → chunk-FELGD32K.js} +2 -2
- package/dist/{chunk-UNORWZIJ.js → chunk-FFJQZG6J.js} +5 -5
- package/dist/{chunk-5SE323LF.js → chunk-FGNCOQUX.js} +2 -2
- package/dist/chunk-FKGQOTKD.js +2 -0
- package/dist/chunk-GDRJB3SB.js +3 -0
- package/dist/chunk-GH5YSGZL.js +5 -0
- package/dist/{chunk-X7PJJYKX.js → chunk-GIQ6CSL4.js} +2 -2
- package/dist/{chunk-2RP27XLR.js → chunk-GPGRZJ3R.js} +2 -2
- package/dist/{chunk-IYV2YBHM.js → chunk-GQIDEID3.js} +2 -2
- package/dist/chunk-GRX7JOXQ.js +2 -0
- package/dist/{chunk-H46QMB7E.js → chunk-GVOMSPGL.js} +2 -2
- package/dist/{chunk-KTRGJLY7.js → chunk-GY7CCCEZ.js} +2 -2
- package/dist/{chunk-VNKYRJKN.js → chunk-H7CG6LOE.js} +2 -2
- package/dist/chunk-HCVJR2V4.js +3 -0
- package/dist/chunk-HG722PO7.js +3 -0
- package/dist/{chunk-LHTT5C3Z.js → chunk-HISEUIL2.js} +2 -2
- package/dist/{chunk-K5MZYZV7.js → chunk-HXOU4XNH.js} +2 -2
- package/dist/chunk-I6UTXNHU.js +6 -0
- package/dist/{chunk-I7PFL5P3.js → chunk-IJMD6BRI.js} +2 -2
- package/dist/{chunk-XXJ7WL3F.js → chunk-IKVNEGTW.js} +2 -2
- package/dist/chunk-IMKZEXZG.js +2 -0
- package/dist/chunk-ISIQLPJ2.js +61 -0
- package/dist/{chunk-DEUGHURX.js → chunk-ISWFRGJ6.js} +2 -2
- package/dist/chunk-IW5XQG5G.js +2 -0
- package/dist/chunk-IXESDH3J.js +2 -0
- package/dist/{chunk-FGB567HK.js → chunk-JAT6C3VX.js} +2 -2
- package/dist/{chunk-7TWP3MCP.js → chunk-JFQBRL3J.js} +2 -2
- package/dist/{chunk-Q7HB7BFJ.js → chunk-JHH5SCZ3.js} +2 -2
- package/dist/{chunk-ZHSARYVS.js → chunk-JJ62MTQH.js} +2 -2
- package/dist/chunk-JT6XX7QY.js +8 -0
- package/dist/{chunk-5H7IWVXJ.js → chunk-JUN5DOAK.js} +2 -2
- package/dist/{chunk-DOPCR5BY.js → chunk-K3XFWJI2.js} +2 -2
- package/dist/{chunk-Y4XQ7LES.js → chunk-KFOYCQAJ.js} +1 -1
- package/dist/{chunk-N5C65OFK.js → chunk-KFVSJX25.js} +2 -2
- package/dist/chunk-KK7GPALL.js +28 -0
- package/dist/{chunk-DHKBIOXF.js → chunk-KQHJEU6V.js} +2 -2
- package/dist/{chunk-WB6LGCFB.js → chunk-KZYID5KV.js} +2 -2
- package/dist/{chunk-KW6B5OL4.js → chunk-LO5JSW2C.js} +2 -2
- package/dist/{chunk-ZW44MCJM.js → chunk-LRI5OMPE.js} +2 -2
- package/dist/{chunk-HG5YI7PV.js → chunk-LXQUF2RP.js} +2 -2
- package/dist/{chunk-TM5XEDDR.js → chunk-MHIEP7EG.js} +2 -2
- package/dist/{chunk-FHV7NMFU.js → chunk-MSR2QRUE.js} +2 -2
- package/dist/chunk-N7FP5H5U.js +57 -0
- package/dist/{chunk-3653GTR7.js → chunk-NEIQPFBI.js} +2 -2
- package/dist/chunk-NK3JMP22.js +2 -0
- package/dist/{chunk-7IOAZRVL.js → chunk-NRBNAECH.js} +2 -2
- package/dist/{chunk-HGKEAP7F.js → chunk-NVSZNESQ.js} +2 -2
- package/dist/{chunk-R2MOKIVO.js → chunk-OJNK5ALA.js} +2 -2
- package/dist/{chunk-RFWAUHVW.js → chunk-OPSAW5DT.js} +2 -2
- package/dist/chunk-OTSPRVNW.js +2 -0
- package/dist/chunk-OXYAWIEA.js +2 -0
- package/dist/chunk-OZETODHH.js +2 -0
- package/dist/chunk-PBUH2P5S.js +3 -0
- package/dist/{chunk-QBANU5BQ.js → chunk-PIFTZEEM.js} +2 -2
- package/dist/{chunk-CKDOY6JA.js → chunk-PLJUQFQN.js} +2 -2
- package/dist/{chunk-JVZNWJBH.js → chunk-PLYUVM4F.js} +2 -2
- package/dist/chunk-PXXYQK55.js +2 -0
- package/dist/{chunk-WZQFY5S7.js → chunk-Q55NF3ZG.js} +2 -2
- package/dist/{chunk-OVPS2ILI.js → chunk-Q5TA4OY4.js} +2 -2
- package/dist/{chunk-OUB4J26T.js → chunk-Q6T2CAJL.js} +2 -2
- package/dist/chunk-Q7GBK5T7.js +81 -0
- package/dist/chunk-QKT4UI2Y.js +2 -0
- package/dist/{chunk-PIZY2GX6.js → chunk-QLBSG7U5.js} +2 -2
- package/dist/chunk-QWKHW6VZ.js +2 -0
- package/dist/{chunk-E7BJXRNV.js → chunk-R6M456QG.js} +2 -2
- package/dist/{chunk-MJNV7OCG.js → chunk-RDULNRSJ.js} +2 -2
- package/dist/{chunk-SSSJO4RG.js → chunk-RHHCLWQ6.js} +2 -2
- package/dist/chunk-RNKPYYYE.js +4 -0
- package/dist/{chunk-IXJ26KJJ.js → chunk-RPL3ARU7.js} +2 -2
- package/dist/{chunk-3EX7DNBC.js → chunk-RYOYJMGF.js} +2 -2
- package/dist/chunk-SB25YMEQ.js +2 -0
- package/dist/chunk-SV2LEFVM.js +2 -0
- package/dist/{chunk-ZBNL3QCY.js → chunk-SVHTMVA4.js} +3 -3
- package/dist/{chunk-6IEVHGWG.js → chunk-SWK4XPUS.js} +2 -2
- package/dist/chunk-T6QD2ZQB.js +43 -0
- package/dist/{chunk-VETXXOYU.js → chunk-TAYD3AE7.js} +2 -2
- package/dist/chunk-TD7VKJ2Y.js +117 -0
- package/dist/{chunk-UQ7XPRWU.js → chunk-TH6IC56G.js} +2 -2
- package/dist/{chunk-XVDMJMES.js → chunk-TKDNDQA7.js} +2 -2
- package/dist/{chunk-CSDDOUA4.js → chunk-TNG2FYS5.js} +2 -2
- package/dist/chunk-TQZV7KV4.js +2 -0
- package/dist/{chunk-AJVMVE7X.js → chunk-TUQIPUDS.js} +2 -2
- package/dist/chunk-TUSPIVZ3.js +4 -0
- package/dist/{chunk-ORBKAUCH.js → chunk-U2N2KE7A.js} +2 -2
- package/dist/{chunk-3PII3JI5.js → chunk-UAQ4T73O.js} +2 -2
- package/dist/{chunk-OFY4HTMI.js → chunk-UDY7MIAW.js} +2 -2
- package/dist/{chunk-WKPZCQLI.js → chunk-URSGGIZX.js} +2 -2
- package/dist/{chunk-UL4VJUMD.js → chunk-UT7TADJX.js} +2 -2
- package/dist/chunk-V4NG5OMS.js +554 -0
- package/dist/{chunk-2H4IAJHO.js → chunk-VMWUV6WB.js} +2 -2
- package/dist/{chunk-46JLFIGA.js → chunk-VTCIYFEK.js} +2 -2
- package/dist/chunk-VU6LIWHT.js +2 -0
- package/dist/chunk-VUSKPCUB.js +2 -0
- package/dist/{chunk-URMZLV2N.js → chunk-VXJJTQYE.js} +2 -2
- package/dist/{chunk-IPAL6DP2.js → chunk-VZ7NXSHV.js} +2 -2
- package/dist/{chunk-FUG6RPYY.js → chunk-WHADK6OS.js} +2 -2
- package/dist/chunk-WN3TCGJ4.js +2 -0
- package/dist/{chunk-B7ECWJAZ.js → chunk-WOOAY3PA.js} +2 -2
- package/dist/chunk-WRQXLNYE.js +9 -0
- package/dist/chunk-WSLEJSFR.js +2 -0
- package/dist/chunk-WYZIHUPZ.js +16 -0
- package/dist/{chunk-ZYREOING.js → chunk-XE33FV5W.js} +2 -2
- package/dist/chunk-XFMVKFSF.js +2 -0
- package/dist/{chunk-BBEDPVPB.js → chunk-XGGBK66W.js} +2 -2
- package/dist/{chunk-OFUBXBYX.js → chunk-XJX6LGHL.js} +2 -2
- package/dist/{chunk-Z3GCK3PD.js → chunk-XN22RGSR.js} +2 -2
- package/dist/{chunk-HWLCBKFE.js → chunk-XSWYJCAK.js} +2 -2
- package/dist/{chunk-IGKKTHJR.js → chunk-XU75YQN4.js} +2 -2
- package/dist/{chunk-E4EJBGDZ.js → chunk-Y2VM4CJC.js} +2 -2
- package/dist/{chunk-U7LRSQG6.js → chunk-Y334QQU5.js} +2 -2
- package/dist/{chunk-APLKXICZ.js → chunk-YAGYMBEX.js} +2 -2
- package/dist/{chunk-XITQLISP.js → chunk-YIHNPKWD.js} +2 -2
- package/dist/chunk-YXPUP5G2.js +11 -0
- package/dist/{chunk-6BJ7SOY7.js → chunk-Z2AWCTN6.js} +2 -2
- package/dist/{chunk-PHSPBQM6.js → chunk-Z2PZVKPR.js} +2 -2
- package/dist/{chunk-QXR5QPSF.js → chunk-ZAZGGSM3.js} +2 -2
- package/dist/{chunk-5236NQV3.js → chunk-ZGW4HLPD.js} +2 -2
- package/dist/chunk-ZOXKSQQB.js +2 -0
- package/dist/{chunk-BD6CV7PN.js → chunk-ZPASRBLF.js} +2 -2
- package/dist/{chunk-DMUGTKMD.js → chunk-ZYM4HOFA.js} +2 -2
- package/dist/{chunk-4ILHWBYF.js → chunk-ZZ3Z7D56.js} +2 -2
- package/dist/cli-main.js +4 -4
- package/dist/{code-CczEvHui.d.ts → code-B17qEMbt.d.ts} +1 -1
- package/dist/code-EQJFDT6I.js +2 -0
- package/dist/code-result-json-7UWIWBOO.js +2 -0
- package/dist/command-descriptors-ORNTVNYV.js +342 -0
- package/dist/{config-types-Cm-VSEBb.d.ts → config-types-B9B60MiR.d.ts} +10 -0
- package/dist/dataflow-6VL54GX5.js +2 -0
- package/dist/{db-LKJXAlNS.d.ts → db-BwIVAYNB.d.ts} +1 -1
- package/dist/dependence-slice-DT2NUHD2.js +2 -0
- package/dist/deps-DB7H5IKC.js +2 -0
- package/dist/direct-navigation-O3LUAYWQ.js +3 -0
- package/dist/entry-map-6K62RV3D.js +2 -0
- package/dist/files-MSLD7MO6.js +2 -0
- package/dist/{graph-evidence-CbUPCSKV.d.ts → graph-evidence-Bjyky2V4.d.ts} +1 -1
- package/dist/{health-Wl5G_LRt.d.ts → health-CPp2Jf1Z.d.ts} +1 -1
- package/dist/hierarchy-IVBXAKFA.js +2 -0
- package/dist/imports-FRAVZ3Y2.js +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/members-KJOJDYGO.js +2 -0
- package/dist/methods-2AYABBT3.js +2 -0
- package/dist/output-continuation-command-JHMPH6NC.js +3 -0
- package/dist/{output-pagination-VAWOGX4R.js → output-pagination-3OFL2MJV.js} +2 -2
- package/dist/project-reindex-HYO4WD7Z.js +3 -0
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +2 -2
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.d.ts +2 -2
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +3 -3
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +13 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +2 -2
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +2 -2
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.d.ts +3 -3
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +2 -2
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +2 -2
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +3 -3
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +5 -5
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -2
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.d.ts +2 -2
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.d.ts +2 -2
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.d.ts +4 -4
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +2 -2
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +2 -2
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.d.ts +3 -3
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/query-service-fastpath.js +5 -5
- package/dist/query-service-server.js +2 -2
- package/dist/refs-ARMA6XUJ.js +2 -0
- package/dist/refs-pagination-VUGIWN6U.js +2 -0
- package/dist/reindex-worker.js +125 -66
- package/dist/reindex.d.ts +5 -3
- package/dist/reindex.js +135 -76
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +4 -4
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{scip-cli-CppzF5MK.d.ts → scip-cli-H-n59izO.d.ts} +1 -1
- package/dist/slice-YOB5YFAM.js +2 -0
- package/dist/surface-VY5EFWTW.js +2 -0
- package/dist/symbol-resolution-DGQN4XIV.js +2 -0
- package/dist/system-2KQ3QD2P.js +2 -0
- package/dist/trace-HTIPTXAE.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/value-flow-5FV3VQI7.js +2 -0
- package/dist/watch-server.js +3 -3
- package/docs/CLI_JSON_OUTPUT.md +2 -2
- package/docs/COMMAND_REFERENCE.md +2 -2
- package/docs/schemas/project-config.schema.json +11 -1
- package/package.json +6 -5
- package/skills/scip-explore/SKILL.md +73 -3
- package/skills/scip-explore/agents/openai.yaml +3 -3
- package/skills/scip-explore/references/delegated-exploration.md +51 -0
- package/skills/scip-explore/references/external-evidence.md +72 -0
- package/skills/scip-explore/references/information-model.md +51 -0
- package/skills/scip-explore/scripts/capture-evidence.mjs +666 -0
- package/skills/scip-query/SKILL.md +22 -1
- package/dist/by-kind-CI3O6PQG.js +0 -2
- package/dist/call-graph-6QTUTXH7.js +0 -2
- package/dist/chunk-2COFMIVK.js +0 -60
- package/dist/chunk-35ELD3RM.js +0 -2
- package/dist/chunk-3FQ3KMCD.js +0 -2
- package/dist/chunk-3VLJ2DCA.js +0 -2
- package/dist/chunk-4DCKBY6T.js +0 -5
- package/dist/chunk-4N6QSEMZ.js +0 -10
- package/dist/chunk-4OE2JO6I.js +0 -2
- package/dist/chunk-4UUCUASK.js +0 -554
- package/dist/chunk-54EOGFBR.js +0 -2
- package/dist/chunk-5IZTXSOL.js +0 -117
- package/dist/chunk-5ZJH6DDE.js +0 -2
- package/dist/chunk-63MBA7EG.js +0 -3
- package/dist/chunk-6T7H2AFY.js +0 -3
- package/dist/chunk-7COHFNJK.js +0 -38
- package/dist/chunk-7HU2IJ2T.js +0 -3
- package/dist/chunk-7PPYXENX.js +0 -2
- package/dist/chunk-AA7K3XLM.js +0 -21
- package/dist/chunk-AUP6YI5M.js +0 -2
- package/dist/chunk-CA5RE6H7.js +0 -2
- package/dist/chunk-CT5SI2I4.js +0 -2
- package/dist/chunk-D5EKVZPI.js +0 -2
- package/dist/chunk-DMQ7ZKJG.js +0 -81
- package/dist/chunk-ELNRLMC5.js +0 -29
- package/dist/chunk-F7WQ337U.js +0 -308
- package/dist/chunk-FEQIQ26E.js +0 -2
- package/dist/chunk-FN6EJM6Q.js +0 -2
- package/dist/chunk-FTSQNONX.js +0 -2
- package/dist/chunk-G2F6T5BV.js +0 -2
- package/dist/chunk-G6OGPXJW.js +0 -9
- package/dist/chunk-GFLTPNWV.js +0 -3
- package/dist/chunk-GTDP2SKQ.js +0 -2
- package/dist/chunk-HEOMG7IM.js +0 -8
- package/dist/chunk-I3U2FN2T.js +0 -13
- package/dist/chunk-IUJ3ZFEE.js +0 -7
- package/dist/chunk-LXLD46LH.js +0 -21
- package/dist/chunk-MEI3PTUK.js +0 -2
- package/dist/chunk-MO226P4Q.js +0 -4
- package/dist/chunk-MYUKI5VN.js +0 -4
- package/dist/chunk-OIRWZIYL.js +0 -38
- package/dist/chunk-OIVZ7PW6.js +0 -438
- package/dist/chunk-PNISDVYC.js +0 -3
- package/dist/chunk-PQOL42AW.js +0 -2
- package/dist/chunk-PUVZNFVY.js +0 -11
- package/dist/chunk-PZEI2TVL.js +0 -4
- package/dist/chunk-Q2J2VZZT.js +0 -2
- package/dist/chunk-QDCCHMVZ.js +0 -2
- package/dist/chunk-QLQBZOJH.js +0 -3
- package/dist/chunk-S73HBCGI.js +0 -11
- package/dist/chunk-SDPA5DKN.js +0 -210
- package/dist/chunk-SEUJVWT2.js +0 -3
- package/dist/chunk-SF7X6QNW.js +0 -2
- package/dist/chunk-SWFAFA4G.js +0 -49
- package/dist/chunk-T6FRID7Y.js +0 -3
- package/dist/chunk-TNOHGHZQ.js +0 -2
- package/dist/chunk-U2GPTA5U.js +0 -3
- package/dist/chunk-URTX2BEA.js +0 -6
- package/dist/chunk-VGRUM7JI.js +0 -3
- package/dist/chunk-VWLIOEEF.js +0 -11
- package/dist/chunk-WK4FD4PG.js +0 -2
- package/dist/chunk-X434XZAI.js +0 -2
- package/dist/chunk-YIEFEPG6.js +0 -16
- package/dist/chunk-YRVERHJR.js +0 -49
- package/dist/chunk-ZD3Z54IW.js +0 -2
- package/dist/chunk-ZDVDSDFG.js +0 -4
- package/dist/code-EQL6ZBLH.js +0 -2
- package/dist/code-result-json-6E4J6LGZ.js +0 -2
- package/dist/command-descriptors-QH3G2OVD.js +0 -346
- package/dist/dataflow-2BLMUZBP.js +0 -2
- package/dist/dependence-slice-MGAJDZXB.js +0 -2
- package/dist/deps-GQMUYVKW.js +0 -2
- package/dist/direct-navigation-6RUJKLAV.js +0 -3
- package/dist/entry-map-V2NQP5JU.js +0 -2
- package/dist/files-VM53I4IU.js +0 -2
- package/dist/hierarchy-D553WRSZ.js +0 -2
- package/dist/imports-DOZAJWLW.js +0 -2
- package/dist/members-HE67475K.js +0 -2
- package/dist/methods-K5JK4PPH.js +0 -2
- package/dist/output-continuation-command-LKBUTNRL.js +0 -3
- package/dist/project-reindex-4ARU6QCM.js +0 -3
- package/dist/refs-NBHKL4UQ.js +0 -2
- package/dist/refs-pagination-BBVTIHMH.js +0 -2
- package/dist/slice-U6S6LBSB.js +0 -2
- package/dist/surface-C7SS5CDQ.js +0 -2
- package/dist/symbol-resolution-3FVEKDTJ.js +0 -2
- package/dist/system-6K2NOO5C.js +0 -2
- package/dist/trace-II5K2TMH.js +0 -2
- package/dist/value-flow-MKFUUE5B.js +0 -2
package/dist/chunk-YIEFEPG6.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{a as On,b as Kn}from"./chunk-U7LRSQG6.js";import{a as ye}from"./chunk-3TNRNKAT.js";import{a as At,b as Dt}from"./chunk-B7ECWJAZ.js";import{a as _n}from"./chunk-VETXXOYU.js";import{b as Bn}from"./chunk-WB6LGCFB.js";import{a as $n,b as $t,c as An,e as Dn}from"./chunk-FEQIQ26E.js";import{b as Fn,c as Pn,d as kn}from"./chunk-TM5XEDDR.js";import{a as kt,b as Mn,c as Nn,d as Rn,i as Tn}from"./chunk-YRVERHJR.js";import{a as Cn}from"./chunk-7TWP3MCP.js";import{d as Ue}from"./chunk-BOJ5SVE2.js";import{c as wn}from"./chunk-JVZNWJBH.js";import{t as In,u as Ln}from"./chunk-ZDVDSDFG.js";import{a as Ft}from"./chunk-RGCJ4646.js";import{b as Pt}from"./chunk-LPGDO2XA.js";import{g as vn,i as En}from"./chunk-HEOMG7IM.js";import{b as st}from"./chunk-35IW3P4H.js";import{A as Be,d as te,i as re,t as we}from"./chunk-5IZTXSOL.js";import{l as Ee,w as Tt,x as xn}from"./chunk-I3U2FN2T.js";import{C as Te,I as it,a as Sn,b as hn}from"./chunk-AA7K3XLM.js";import{c as yn,x as bn,z as Rt}from"./chunk-DMQ7ZKJG.js";import{d as Nt}from"./chunk-MO226P4Q.js";function _e(e){return e.includes("symbol-anchor")?0:e.includes("literal-owner")?1:e.some(t=>t.startsWith("boundary-import:"))?2:e.includes("reference-owner")?3:4}function jn(e,t){return _e(e.origins)-_e(t.origins)||e.depth-t.depth||e.startLine-t.startLine||e.shortName.localeCompare(t.shortName)}var qn=["call","contract-symbol","import","reference","runtime-boundary"],ur={call:[{family:"control",subtype:"call"}],"contract-symbol":[{family:"contract",subtype:"uses-contract-symbol"}],import:[{family:"identity",subtype:"imports"}],reference:[{family:"identity",subtype:"references"}]},pr={"structural-membership":[{family:"identity",subtype:"contains"}],"boundary-observation":[{family:"identity",subtype:"owns-runtime-observation"}],"external-import":[{family:"identity",subtype:"imports-external"}]};function zn(e){if(e.kind!=="runtime-boundary")return Un(ur[e.kind]);let t=e.fromBoundaryParticipant?.protocol??e.toBoundaryParticipant?.protocol,n={crossesRuntimeBoundary:!0,...t?{protocol:t}:{},...e.runtimeBoundaryKey?{runtimeKey:e.runtimeBoundaryKey}:{}},o=[{family:"control",subtype:"runtime-handoff",context:n}];return e.evidence==="runtime-boundary:carrier.discriminator"&&(o.push({family:"control",subtype:"discriminator-dispatch",context:{...n},attributes:{joinRule:"carrier.discriminator",...e.fromBoundaryParticipant?.action?{producerAction:e.fromBoundaryParticipant.action}:{},...e.toBoundaryParticipant?.action?{consumerAction:e.toBoundaryParticipant.action}:{}}}),o.push({family:"data",subtype:"serialized-discriminator-transfer",context:{...n},attributes:{joinRule:"carrier.discriminator"}})),e.evidence==="runtime-boundary:queue.address"&&e.fromBoundaryParticipant?.action==="queue.send"&&e.toBoundaryParticipant?.action==="queue.consume"&&o.push({family:"temporal",subtype:"enqueue-before-consume",context:{...n},attributes:{producerAction:e.fromBoundaryParticipant.action,consumerAction:e.toBoundaryParticipant.action,retryPolicy:"unknown"}}),o}function at(e){return Un(pr[e])}function Un(e){return e.map(t=>({...t,...t.context?{context:{...t.context}}:{},...t.attributes?{attributes:{...t.attributes}}:{}}))}import{join as _r}from"path";import{createRequire as mr}from"module";import{resolve as He}from"path";var fr=mr(import.meta.url),Ge;function Hn(e,t,n){let o=gr();if(!o)return Bt("The TypeScript compiler runtime is unavailable.");let i=yr(o,e,t),s=i.getSourceFile(He(t))??i.getSourceFile(t);if(!s)return Bt(`The TypeScript compiler did not materialize ${t}.`);let r={ts:o,sourceFile:s,checker:i.getTypeChecker(),points:new Map,edges:new Map,unsupported:new Set,nextCfgId:0},a=hr(o,s,n);if(a.length===0)return Bt("No function-like construct intersects the selected source range.");let d=new Map(a.map(p=>[p,br(s,p)])),c=a.map(p=>vr(r,p,xr(o,p,d),d.get(p)));for(let p of c)Er(r,p),Cr(r,p),Rr(r,p);Fr(r,c);let l=[...r.unsupported].sort();return{points:[...r.points.values()].map(({node:p,...g})=>g).sort(Br),edges:[...r.edges.values()].sort((p,g)=>p.id.localeCompare(g.id)),coverage:{status:l.length===0?"complete":"partial",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:l}}}function gr(){if(Ge!==void 0)return Ge;try{Ge=fr("typescript")}catch{Ge=Ln()?.ts??null}return Ge}function yr(e,t,n){let o=He(n),i={target:e.ScriptTarget.ESNext,module:e.ModuleKind.NodeNext,moduleResolution:e.ModuleResolutionKind.NodeNext,skipLibCheck:!0,noResolve:!0},s=e.createSourceFile(o,t,i.target,!0,Sr(e,o)),r=e.createCompilerHost(i,!0),a=r.getSourceFile.bind(r),d=r.readFile.bind(r),c=r.fileExists.bind(r);return r.getSourceFile=(l,p,g,m)=>He(l)===o?s:a(l,p,g,m),r.readFile=l=>He(l)===o?t:d(l),r.fileExists=l=>He(l)===o||c(l),e.createProgram([o],i,r)}function Sr(e,t){return/\.tsx$/iu.test(t)?e.ScriptKind.TSX:/\.[cm]?js$/iu.test(t)?e.ScriptKind.JS:/\.jsx$/iu.test(t)?e.ScriptKind.JSX:e.ScriptKind.TS}function hr(e,t,n){let o=[],i=s=>{if(Wn(e,s)){let r=t.getLineAndCharacterOfPosition(s.getStart(t)).line,a=t.getLineAndCharacterOfPosition(s.getEnd()).line;(!n||r<=n.endLine&&a>=n.startLine)&&o.push(s)}s.forEachChild(i)};return t.forEachChild(i),o.sort((s,r)=>s.getStart(t)-r.getStart(t))}function Wn(e,t){return e.isFunctionLike(t)&&"body"in t&&t.body!==void 0}function br(e,t){return`callable:${encodeURIComponent(e.fileName)}:${t.getStart(e)}:${t.getEnd()}`}function xr(e,t,n){for(let o=t.parent;o;o=o.parent)if(Wn(e,o)&&n.has(o))return n.get(o);return null}function vr(e,t,n,o){let i=new Map,s=X(e,i,"exit",null),r=t.body,a=s.id;if(r&&e.ts.isBlock(r))a=_t(e,i,[...r.statements],s.id,{breakTarget:null,continueTarget:null});else if(r){let c=X(e,i,"statement",r);Y(i,c.id,s.id),a=c.id}let d=X(e,i,"entry",t);return Y(i,d.id,a),{id:o,node:t,parentId:n,cfg:i,entryId:d.id,exitId:s.id}}function _t(e,t,n,o,i){let s=o;for(let r=n.length-1;r>=0;r-=1)s=Fe(e,t,n[r],s,i);return s}function Fe(e,t,n,o,i){let s=e.ts;if(s.isBlock(n))return _t(e,t,[...n.statements],o,i);if(s.isIfStatement(n)){let a=X(e,t,"predicate",n.expression),d=Fe(e,t,n.thenStatement,o,i),c=n.elseStatement?Fe(e,t,n.elseStatement,o,i):o;return Y(t,a.id,d),Y(t,a.id,c),a.id}if(s.isWhileStatement(n)){let a=X(e,t,"predicate",n.expression),d=Fe(e,t,n.statement,a.id,{breakTarget:o,continueTarget:a.id});return Y(t,a.id,d),Y(t,a.id,o),a.id}if(s.isDoStatement(n)){let a=X(e,t,"predicate",n.expression),d=Fe(e,t,n.statement,a.id,{breakTarget:o,continueTarget:a.id});return Y(t,a.id,d),Y(t,a.id,o),d}if(s.isForStatement(n)){let a=X(e,t,"predicate",n.condition??n),d=n.incrementor?X(e,t,"statement",n.incrementor):null;d&&Y(t,d.id,a.id);let c=d?.id??a.id,l=Fe(e,t,n.statement,c,{breakTarget:o,continueTarget:c});if(Y(t,a.id,l),n.condition&&Y(t,a.id,o),!n.initializer)return a.id;let p=X(e,t,"statement",n.initializer);return Y(t,p.id,a.id),p.id}if(s.isForInStatement(n)||s.isForOfStatement(n)){e.unsupported.add("for-in/for-of iterator assignment is conservatively represented without iterable element flow.");let a=X(e,t,"predicate",n.expression),d=X(e,t,"statement",n.initializer),c=Fe(e,t,n.statement,a.id,{breakTarget:o,continueTarget:a.id});return Y(t,a.id,d.id),Y(t,a.id,o),Y(t,d.id,c),a.id}if(s.isSwitchStatement(n)){e.unsupported.add("switch fallthrough is represented conservatively; discriminant-to-case value refinement is unsupported.");let a=X(e,t,"predicate",n.expression),d=o,c=[];for(let l=n.caseBlock.clauses.length-1;l>=0;l-=1){let p=n.caseBlock.clauses[l];d=_t(e,t,[...p.statements],d,{...i,breakTarget:o}),c.push(d)}for(let l of c)Y(t,a.id,l);return Y(t,a.id,o),a.id}if(s.isReturnStatement(n)||s.isThrowStatement(n)){let a=X(e,t,"statement",n),d=[...t.values()].find(c=>c.kind==="exit");return Y(t,a.id,d.id),a.id}if(s.isBreakStatement(n)){let a=X(e,t,"statement",n);return i.breakTarget||e.unsupported.add("A break statement could not be attached to a structured target."),Y(t,a.id,i.breakTarget??o),a.id}if(s.isContinueStatement(n)){let a=X(e,t,"statement",n);return i.continueTarget||e.unsupported.add("A continue statement could not be attached to a structured target."),Y(t,a.id,i.continueTarget??o),a.id}if(s.isTryStatement(n)){e.unsupported.add("Exceptional control-flow and finally completion are not included in the local compiler CFG.");let a=X(e,t,"statement",n);return a.invalidatesAllDefinitions=!0,Y(t,a.id,o),a.id}let r=X(e,t,"statement",n);return Y(t,r.id,o),r.id}function X(e,t,n,o){let i={id:`cfg:${e.nextCfgId++}`,kind:n,ast:o,successors:new Set,predecessors:new Set,definitions:[],uses:[],displayPoint:null,invalidatesAllDefinitions:!1};return t.set(i.id,i),i}function Y(e,t,n){e.get(t).successors.add(n),e.get(n).predecessors.add(t)}function Er(e,t){let n=t.cfg.get(t.entryId);for(let o of t.node.parameters){let i=Pe(e,o.name);if(!i){e.unsupported.add("Destructured parameter definition-use is not implemented.");continue}n.definitions.push({point:ke(e,i.node,"parameter-definition",i.symbolKey,i.name,t.id),rhsUseIds:[]})}for(let o of t.cfg.values())!o.ast||o.kind==="entry"||o.kind==="exit"||(o.kind==="predicate"&&(o.displayPoint=ke(e,o.ast,"predicate",null,"predicate",t.id)),Ir(e,t,o,o.ast),!o.displayPoint&&o.definitions.length===0&&o.uses.length===0&&(o.displayPoint=ke(e,o.ast,"statement",null,kr(e,o.ast),t.id)))}function Ir(e,t,n,o){let i=e.ts;if(i.isTryStatement(o))return;let s=r=>{if(!(r!==o&&i.isFunctionLike(r))){if(i.isVariableDeclaration(r)){let a=r.initializer?lt(e,t.id,r.initializer,n):[];n.uses.push(...a);let d=Pe(e,r.name);d?n.definitions.push({point:ke(e,d.node,"definition",d.symbolKey,d.name,t.id),rhsUseIds:a.map(c=>c.point.id)}):(n.invalidatesAllDefinitions=!0,e.unsupported.add("Destructured variable reaching definitions are not implemented."));return}if(i.isBinaryExpression(r)&&Qn(i,r.operatorToken.kind)){let a=lt(e,t.id,r.right,n);r.operatorToken.kind!==i.SyntaxKind.EqualsToken&&a.push(...lt(e,t.id,r.left,n)),n.uses.push(...a);let d=Pe(e,r.left);d?n.definitions.push({point:ke(e,d.node,"definition",d.symbolKey,d.name,t.id),rhsUseIds:a.map(c=>c.point.id)}):(n.invalidatesAllDefinitions=!0,e.unsupported.add("Dynamic or destructured assignment targets are not included in reaching definitions."));return}if((i.isPrefixUnaryExpression(r)||i.isPostfixUnaryExpression(r))&&(r.operator===i.SyntaxKind.PlusPlusToken||r.operator===i.SyntaxKind.MinusMinusToken)){let a=lt(e,t.id,r.operand,n);n.uses.push(...a);let d=Pe(e,r.operand);d&&n.definitions.push({point:ke(e,d.node,"definition",d.symbolKey,d.name,t.id),rhsUseIds:a.map(c=>c.point.id)});return}if(!(i.isFunctionDeclaration(r)||i.isClassDeclaration(r)||i.isInterfaceDeclaration(r))){if(Vn(e,r)){let a=Yn(e,t.id,r);a&&n.uses.push(a),i.isPropertyAccessExpression(r)&&s(r.expression);return}r.forEachChild(s)}}};s(o),n.uses=Jn(n.uses)}function lt(e,t,n,o){let i=[],s=r=>{if(!e.ts.isFunctionLike(r)){if(e.ts.isBinaryExpression(r)&&Qn(e.ts,r.operatorToken.kind)){o.invalidatesAllDefinitions=!0,e.unsupported.add("Nested assignment expressions are not included in ordered local definition-use flow."),r.operatorToken.kind!==e.ts.SyntaxKind.EqualsToken&&s(r.left),s(r.right);return}if(Vn(e,r)){let a=Yn(e,t,r);a&&i.push(a),e.ts.isPropertyAccessExpression(r)&&s(r.expression);return}r.forEachChild(s)}};return s(n),Jn(i)}function Vn(e,t){if(e.ts.isPropertyAccessExpression(t))return!0;if(!e.ts.isIdentifier(t))return!1;let n=t.parent;return!(e.ts.isPropertyAccessExpression(n)&&n.name===t||"name"in n&&n.name===t&&Lr(e.ts,n)||e.ts.isPropertyAssignment(n)&&n.name===t||e.ts.isBindingElement(n)&&n.propertyName===t||e.ts.isLabeledStatement(n)||e.ts.isBreakOrContinueStatement(n)||wr(e.ts,t))}function Lr(e,t){return e.isVariableDeclaration(t)||e.isParameter(t)||e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isClassDeclaration(t)||e.isMethodDeclaration(t)||e.isPropertyDeclaration(t)||e.isInterfaceDeclaration(t)||e.isTypeAliasDeclaration(t)||e.isImportSpecifier(t)||e.isImportClause(t)||e.isNamespaceImport(t)}function wr(e,t){for(let n=t.parent;n;n=n.parent){if(e.isExpression(n)||e.isStatement(n)||e.isSourceFile(n))return!1;if(e.isTypeNode(n))return!0}return!1}function Yn(e,t,n){let o=Pe(e,n);return o?{point:ke(e,o.node,"use",o.symbolKey,o.name,t),property:e.ts.isPropertyAccessExpression(n)}:null}function Pe(e,t){let n=e.ts;if(n.isIdentifier(t)){let o=Gn(e,t);return o?{node:t,symbolKey:o,name:t.text}:null}if(n.isPropertyAccessExpression(t)){let o=Gn(e,t.name);return o?{node:t,symbolKey:o,name:t.getText(e.sourceFile)}:null}return n.isParenthesizedExpression(t)||n.isAsExpression(t)||n.isTypeAssertionExpression(t)||n.isNonNullExpression(t)?Pe(e,t.expression):((n.isArrayLiteralExpression(t)||n.isObjectLiteralExpression(t))&&e.unsupported.add("Heap aggregate identity and destructured assignment are not included in local points-to flow."),null)}function Gn(e,t){let n=e.checker.getSymbolAtLocation(t);if(!n)return null;if((n.flags&e.ts.SymbolFlags.Alias)!==0)try{n=e.checker.getAliasedSymbol(n)}catch{}let o=n.valueDeclaration??n.declarations?.[0];return o?`symbol:${encodeURIComponent(o.getSourceFile().fileName)}:${o.getStart()}:${n.getName()}`:`symbol:${n.getName()}`}function ke(e,t,n,o,i,s){let r=t.getStart(e.sourceFile),a=t.getEnd(),d=e.sourceFile.getLineAndCharacterOfPosition(r),c=`flow-point:${encodeURIComponent(e.sourceFile.fileName)}:${r}:${a}:${n}:${encodeURIComponent(o??i)}`,l=e.points.get(c);if(l)return l;let p={id:c,kind:n,name:i,symbolKey:o,callableId:s,start:r,end:a,line:d.line,column:d.character,node:t};return e.points.set(c,p),p}function Cr(e,t){let n=[...t.cfg.values()].flatMap(d=>d.definitions),o=new Map(n.map(d=>[d.point.id,d])),i=Mr(n),s=new Map,r=new Map;for(let d of t.cfg.values())s.set(d.id,new Set),r.set(d.id,new Set);let a=!0;for(;a;){a=!1;for(let d of t.cfg.values()){let c=Ar([...d.predecessors].map(g=>r.get(g))),l=new Set(c);d.invalidatesAllDefinitions&&l.clear();let p=Nr(d.definitions);for(let g of p){for(let m of i.get(g.point.symbolKey)??[])l.delete(m.point.id);l.add(g.point.id)}Ot(s.get(d.id),c)||(s.set(d.id,c),a=!0),Ot(r.get(d.id),l)||(r.set(d.id,l),a=!0)}}for(let d of t.cfg.values()){let c=s.get(d.id);for(let l of d.uses){let p=d.definitions.filter(m=>m.point.symbolKey===l.point.symbolKey&&m.point.start<l.point.start&&!m.rhsUseIds.includes(l.point.id)).sort((m,f)=>f.point.start-m.point.start)[0],g=p?[p.point.id]:c;for(let m of g){let f=o.get(m);f.point.symbolKey===l.point.symbolKey&&We(e,"reaching-definition",f.point.id,l.point.id,"exact","A CFG path reaches this use without an intervening definition.")}}for(let l of d.definitions)for(let p of l.rhsUseIds)We(e,"value-source",p,l.point.id,"exact","This right-hand-side use supplies the new definition.")}}function Mr(e){let t=new Map;for(let n of e){if(!n.point.symbolKey)continue;let o=t.get(n.point.symbolKey)??[];o.push(n),t.set(n.point.symbolKey,o)}return t}function Nr(e){let t=new Map;for(let n of e)n.point.symbolKey&&t.set(n.point.symbolKey,n);return[...t.values()]}function Rr(e,t){let n=Tr(t);for(let o of t.cfg.values()){if(o.successors.size<2||!o.displayPoint)continue;let i=n.get(o.id);for(let s of o.successors)for(let r of n.get(s)??[]){if(i.has(r)||r===t.exitId)continue;let a=t.cfg.get(r),d=[...a.definitions.map(c=>c.point),...a.uses.map(c=>c.point),...a.displayPoint?[a.displayPoint]:[]];for(let c of $r(d))We(e,"control-dependence",o.displayPoint.id,c.id,"exact","The target postdominates a branch successor but does not postdominate the predicate.")}}}function Tr(e){let t=[...e.cfg.keys()],n=new Set(t),o=new Map;for(let s of t)o.set(s,s===e.exitId?new Set([s]):new Set(n));let i=!0;for(;i;){i=!1;for(let s of e.cfg.values()){if(s.id===e.exitId)continue;let r=[...s.successors].map(d=>o.get(d)),a=new Set([s.id,...Dr(r)]);Ot(o.get(s.id),a)||(o.set(s.id,a),i=!0)}}return o}function Fr(e,t){let n=new Map(t.map(r=>[r.id,r.parentId])),o=t.flatMap(r=>[...r.cfg.values()].flatMap(a=>a.definitions.map(d=>d.point))),i=new Map;for(let r of o){if(!r.symbolKey)continue;let a=i.get(r.symbolKey)??[];a.push(r),i.set(r.symbolKey,a)}let s=new Set([...e.edges.values()].filter(r=>r.kind==="reaching-definition").map(r=>r.toPointId));for(let r of t)for(let a of[...r.cfg.values()].flatMap(d=>d.uses)){if(!a.point.symbolKey||s.has(a.point.id))continue;let d=i.get(a.point.symbolKey)??[];for(let c of d)Pr(c.callableId,a.point.callableId,n)?We(e,"closure-capture",c.id,a.point.id,"candidate","Compiler identity proves the captured binding, but invocation order can select among outer definitions."):a.property&&We(e,"field-definition-to-use",c.id,a.point.id,"candidate","Compiler identity matches the field; cross-callable receiver and execution order remain unresolved.")}[...e.edges.values()].some(r=>r.kind==="closure-capture")&&e.unsupported.add("Closure capture identity is known, but invocation order and intervening writes remain candidate flow."),[...e.edges.values()].some(r=>r.kind==="field-definition-to-use")&&e.unsupported.add("Cross-callable field flow lacks receiver points-to and invocation-order analysis.")}function Pr(e,t,n){for(let o=n.get(t)??null;o;o=n.get(o)??null)if(o===e)return!0;return!1}function We(e,t,n,o,i,s){let r=`local-flow-edge:${t}:${encodeURIComponent(n)}:${encodeURIComponent(o)}`;e.edges.set(r,{id:r,kind:t,fromPointId:n,toPointId:o,strength:i,reason:s})}function Qn(e,t){return t>=e.SyntaxKind.FirstAssignment&&t<=e.SyntaxKind.LastAssignment}function kr(e,t){let n=t.getText(e.sourceFile).replace(/\s+/gu," ").trim();return n.length>80?`${n.slice(0,77)}...`:n||e.ts.SyntaxKind[t.kind]||"statement"}function Jn(e){return[...new Map(e.map(t=>[t.point.id,t])).values()]}function $r(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function Ar(e){return new Set(e.flatMap(t=>[...t]))}function Dr(e){return e.length===0?new Set:new Set([...e[0]].filter(t=>e.slice(1).every(n=>n.has(t))))}function Ot(e,t){return e.size===t.size&&[...e].every(n=>t.has(n))}function Br(e,t){return e.start-t.start||e.kind.localeCompare(t.kind)||e.id.localeCompare(t.id)}function Bt(e){return{points:[],edges:[],coverage:{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:[e]}}}var Or=yn("typescript-local-flow",{clearGroups:["whole-project","source-file","semantic-provider"]});function Kt(e,t,n,o){if(!In(t))return null;let i=`${t}\0${n}\0${o}`;return Or.get(e,i,()=>{let s=bn(e,t);return s?Hn(s,_r(e.config.projectRoot,t),{startLine:n,endLine:o}):{points:[],edges:[],coverage:{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:[`Current source is unavailable for ${t}.`]}}})}function Kr(e,t=new Map){let n=new Map,o=new Map,i=[];for(let s of e.transfers){if(!e.caller)continue;let r=dt(e.caller,s.callerPosition),a=dt(e.callee,s.calleePosition);Ve(n,r),Ve(n,a),qt(o,e.caller,r),qt(o,e.callee,a);let d=ne("edge","data-transfer",s.proof.file,String(s.proof.startLine),String(s.callerPosition),String(s.calleePosition));o.set(d,{id:d,kind:"data-transfer",fromNodeId:r.id,toNodeId:a.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:"argument-to-parameter",attributes:{argumentText:s.argumentText,callerPosition:s.callerPosition,calleePosition:s.calleePosition}}],evidence:[{method:"compiler-callsite-direct-parameter-transfer",strength:"exact",identity:`${e.caller.symbol}:${s.callerPosition} -> ${e.callee.symbol}:${s.calleePosition}`,location:{file:s.proof.file,line:s.proof.startLine,endLine:s.proof.endLine}}]})}return e.unknown.forEach((s,r)=>{let a=dt(e.callee,s.calleePosition);Ve(n,a),qt(o,e.callee,a);let d=t.get(s.calleePosition);if(d&&Jr(d)){Qr(o,n,e,s.calleePosition,s.argumentText,d);return}let c=Vr(e,s.calleePosition,s.argumentText);Ve(n,c);let l=ne("edge","data-transfer-unsupported",s.proof.file,String(s.proof.startLine),String(s.calleePosition),String(r));o.set(l,{id:l,kind:"data-transfer",fromNodeId:c.id,toNodeId:a.id,directed:!0,disposition:"unsupported",semantics:[{family:"data",subtype:"argument-to-parameter",attributes:{argumentText:s.argumentText,calleePosition:s.calleePosition}}],evidence:[{method:"compiler-callsite-argument-expression",strength:"exact",identity:s.argumentText,location:{file:s.proof.file,line:s.proof.startLine,endLine:s.proof.endLine}}]}),i.push({id:ne("frontier","data-transfer",l),kind:"data-transfer",direction:"unresolved",fromNodeIds:[c.id],edgeIds:[l],memberNodeIds:[a.id],memberCount:1,disposition:"unsupported",reason:d?.derivation.rule??s.reason,expansion:null})}),{nodes:[...n.values()],edges:[...o.values()],frontiers:i,blindSpots:[]}}function Zn(e,t,n=[]){let o=eo(),i=new Map,s=new Set;for(let r of t){if(r.kind!=="call"||!r.fromSymbol||!r.toSymbol||r.line===null)continue;let a=Wr(i,e,r.toFile,r.toSymbol);if(!a)continue;let d=Nn(e,a),c=d.sites.filter(x=>x.file===r.fromFile&&x.startLine<=r.line&&x.endLine>=r.line&&x.caller?.symbol===r.fromSymbol);if(c.length!==1){let x=d.unresolved.find(b=>b.file===r.fromFile&&b.line===r.line);x&&o.blindSpots.push(`Parameter flow unresolved at ${r.fromFile}:${r.line+1}: ${x.reason}.`);continue}let l=c[0],p=`${l.file}\0${l.callNode.startIndex}\0${l.callNode.endIndex}\0${a.symbol}`;if(s.has(p))continue;s.add(p);let g=Rn(e,l),m=Te(e,l.file)?.rootNode,f=new Map;if(m)for(let x of g.unknown){let b=Mn({db:e,file:l.file,root:m},l.arguments[x.calleePosition]);b&&f.set(x.calleePosition,b)}Xn(o,Kr(g,f)),g.caller&&Gr(l.callNode)&&Hr(o,g,l.callNode)}for(let r of n){if(!r.location||!["source-construct","symbol"].includes(r.kind))continue;let a=r.location.endLine??r.location.line,d=Kt(e,r.location.file,r.location.line,a);if(d){Xn(o,jr(r,d.points,d.edges));for(let c of d.coverage.unsupported)o.blindSpots.push(`TypeScript local flow is partial for ${r.location.file}:${r.location.line+1}-${a+1}: ${c} Recover with: scip-query inspect --at '${r.location.file}:${r.location.line+1}-${a+1}' --view behavior.`)}}return o.blindSpots=[...new Set(o.blindSpots)].sort(),o}function jr(e,t,n){let o=eo(),i=new Map,s=new Map,r=new Map,a=e.location.file;for(let d of t){let c=qr(e,a,d);r.set(d.id,c.id),i.set(c.id,c),zr(s,e,c)}for(let d of n){let c=r.get(d.fromPointId),l=r.get(d.toPointId);if(!c||!l)continue;let p=Ur(d),g=ne("edge","typescript-local-flow",a,d.id);s.set(g,{id:g,kind:d.kind==="control-dependence"?"control-dependence":"data-transfer",fromNodeId:c,toNodeId:l,directed:!0,disposition:"folded",semantics:[p],evidence:[{method:"typescript-compiler-cfg-reaching-definitions",strength:d.strength,identity:d.reason,location:i.get(c)?.location??e.location}]})}return o.nodes=[...i.values()],o.edges=[...s.values()],o}function qr(e,t,n){return{id:ne("local-flow-point",t,String(n.start),String(n.end),n.kind,n.symbolKey??n.name),kind:n.kind==="parameter-definition"||n.kind==="definition"?"local-definition":n.kind==="use"?"local-use":n.kind==="predicate"?"control-predicate":"local-statement",label:n.name,disposition:"folded",location:{file:t,line:n.line,endLine:n.line},anchorIds:[],attributes:{ownerNodeId:e.id,pointKind:n.kind,callableId:n.callableId,symbolKey:n.symbolKey,column:n.column}}}function zr(e,t,n){let o=ne("edge","local-flow-owner",t.id,n.id);e.has(o)||e.set(o,{id:o,kind:"local-flow-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains"}],evidence:[{method:"typescript-compiler-local-flow-owner",strength:"exact",identity:t.id,location:n.location}]})}function Ur(e){switch(e.kind){case"reaching-definition":return{family:"data",subtype:"definition-to-use"};case"value-source":return{family:"data",subtype:"value-to-definition"};case"closure-capture":return{family:"data",subtype:"closure-capture"};case"field-definition-to-use":return{family:"data",subtype:"field-definition-to-use"};case"control-dependence":return{family:"control",subtype:"control-dependence"}}}function Gr(e){let t=e;for(;t.parent&&["await_expression","yield_expression","parenthesized_expression","as_expression","type_assertion"].includes(t.parent.type);)t=t.parent;return t.parent!==null&&t.parent.type!=="expression_statement"}function Hr(e,t,n){if(!t.caller)return;let o={id:ne("call-result",t.call.file,String(n.startIndex),String(n.endIndex),t.callee.symbol),kind:"call-result",label:`result of ${t.callee.leaf}`,disposition:"folded",location:{file:t.call.file,line:t.call.startLine,endLine:t.call.endLine},anchorIds:[],attributes:{calleeSymbol:t.callee.symbol,callerSymbol:t.caller.symbol}},i=ne("edge","return-to-call-result",t.callee.symbol,o.id),s=ne("edge","call-result-owner",t.caller.symbol,o.id);e.nodes.push(o),e.edges.push({id:i,kind:"data-transfer",fromNodeId:zt(t.callee.symbol),toNodeId:o.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:"return-to-call-result"}],evidence:[{method:"compiler-callsite-used-result",strength:"exact",identity:`${t.callee.symbol} -> ${t.caller.symbol}`,location:o.location}]},{id:s,kind:"call-result-owner",fromNodeId:zt(t.caller.symbol),toNodeId:o.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains-call-result"}],evidence:[{method:"compiler-call-result-owner",strength:"exact",identity:t.caller.symbol,location:o.location}]})}function eo(){return{nodes:[],edges:[],frontiers:[],blindSpots:[]}}function Xn(e,t){jt(e.nodes,t.nodes),jt(e.edges,t.edges),jt(e.frontiers,t.frontiers),e.blindSpots.push(...t.blindSpots)}function jt(e,t){let n=new Set(e.map(o=>o.id));for(let o of t)n.has(o.id)||(n.add(o.id),e.push(o))}function Wr(e,t,n,o){let i=`${n}\0${o}`,s=e.get(i);if(s!==void 0)return s;let r=we(t,n).find(a=>a.symbol===o)??null;return e.set(i,r),r}function dt(e,t){return{id:ei(e.symbol,t),kind:"parameter",label:`${e.leaf} parameter ${t}`,disposition:"folded",location:{file:e.relativePath,line:e.startLine,endLine:e.endLine},anchorIds:[],attributes:{ownerSymbol:e.symbol,position:t}}}function Vr(e,t,n){return{id:ne("argument-expression",e.call.file,String(e.call.startLine),String(e.call.endLine),String(t)),kind:"argument-expression",label:n,disposition:"unsupported",location:{file:e.call.file,line:e.call.startLine,endLine:e.call.endLine},anchorIds:[],attributes:{calleeSymbol:e.callee.symbol,position:t}}}function Yr(e,t,n){return{id:ne("static-value",e.call.file,String(e.call.startLine),String(e.call.endLine),String(t)),kind:"static-value",label:n.value,disposition:"folded",location:{file:e.call.file,line:e.call.startLine,endLine:e.call.endLine},anchorIds:[],attributes:{value:n.value,precision:n.precision,evidence:n.evidence,termKind:n.term.kind,derivationRule:n.derivation.rule}}}function Qr(e,t,n,o,i,s){let r=Yr(n,o,s),a=dt(n.callee,o);Ve(t,r);let d=ne("edge","static-value-transfer",n.call.file,String(n.call.startLine),String(o));e.set(d,{id:d,kind:"data-transfer",fromNodeId:r.id,toNodeId:a.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:Xr(s),attributes:{argumentText:i,calleePosition:o,value:s.value,precision:s.precision,derivationRule:s.derivation.rule}}],evidence:Zr(s,n)})}function Jr(e){return e.derivation.kind!=="heuristic"&&e.precision!=="symbolic"&&e.precision!=="unknown"}function Xr(e){return e.derivation.rule==="bounded-call-return"?"return-to-parameter":e.derivation.rule==="member-constant"||e.term.kind==="property"?"property-to-parameter":"constant-to-parameter"}function Zr(e,t){return(e.derivation.sourceSpans.length>0?e.derivation.sourceSpans:[t.call]).map(o=>({method:`static-value:${e.derivation.rule}`,strength:e.derivation.kind==="direct"?"exact":"derived",identity:e.derivation.inputFactIds.join(",")||e.value,location:{file:o.file,line:o.startLine,endLine:o.endLine}}))}function Ve(e,t){e.has(t.id)||e.set(t.id,t)}function qt(e,t,n){let o=ne("edge","parameter-owner",t.symbol,n.id);e.has(o)||e.set(o,{id:o,kind:"parameter-owner",fromNodeId:zt(t.symbol),toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains"}],evidence:[{method:"compiler-parameter-owner",strength:"exact",identity:t.symbol,location:{file:t.relativePath,line:t.startLine,endLine:t.endLine}}]})}function ei(e,t){return ne("parameter",e,String(t))}function zt(e){return ne("symbol",e)}function ne(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function to(e,t){let n=new Map,o=new Map,i=new Map,s=new Set;for(let r of t){if(!r.location||!["source-construct","symbol"].includes(r.kind))continue;let a=r.location.endLine??r.location.line,d=Pn(e,r.location.file,r.location.line,a);if(!d){s.add(`Control dependence unavailable for ${r.location.file}:${r.location.line+1}-${a+1}: no supported syntax tree or covering construct.`);continue}for(let c of d.facts){let l=Ut(r,c.controller),p=Ut(r,c.outcome);n.set(l.id,l),n.set(p.id,p),ti(o,r,l);let g=$e("edge","control-dependence",l.id,p.id,c.subtype);o.set(g,{id:g,kind:"control-dependence",fromNodeId:l.id,toNodeId:p.id,directed:!0,disposition:"folded",semantics:[{family:"control",subtype:c.subtype,attributes:{...c.attributes}}],evidence:[{method:"parser-control-dependence",strength:"exact",identity:`${r.location.file}:${c.controller.startLine+1}-${c.outcome.startLine+1}`,location:{file:r.location.file,line:c.controller.startLine,endLine:c.controller.endLine}}]})}for(let c of d.terminals){let l=Ut(r,c);n.set(l.id,l);let p=c.label.startsWith("throw")||c.label.startsWith("raise")?"throw":"return",g=$e("edge","control-terminal",r.id,l.id,p);o.set(g,{id:g,kind:"control-terminal",fromNodeId:r.id,toNodeId:l.id,directed:!0,disposition:"folded",semantics:[{family:"control",subtype:p==="throw"?"throws":"returns"}],evidence:[{method:"parser-terminal-statement",strength:"exact",identity:c.label,location:{file:r.location.file,line:c.startLine,endLine:c.endLine}}]})}for(let c of d.unsupported){let l=$e("control-unsupported",r.location.file,String(c.startLine),String(c.endLine),c.reason);n.set(l,{id:l,kind:"control-unsupported",label:c.reason,disposition:"unsupported",location:{file:r.location.file,line:c.startLine,endLine:c.endLine},anchorIds:[],attributes:{ownerNodeId:r.id}});let p=$e("edge","control-unsupported",r.id,l);o.set(p,{id:p,kind:"control-dependence",fromNodeId:r.id,toNodeId:l,directed:!0,disposition:"unsupported",semantics:[{family:"control",subtype:"unresolved-control-construct"}],evidence:[{method:"parser-control-construct",strength:"exact",identity:c.reason,location:{file:r.location.file,line:c.startLine,endLine:c.endLine}}]});let g=$e("frontier","control-dependence",l);i.set(g,{id:g,kind:"control-dependence",direction:"unresolved",fromNodeIds:[r.id],edgeIds:[p],memberNodeIds:[l],memberCount:1,disposition:"unsupported",reason:c.reason,expansion:null})}}return{nodes:[...n.values()],edges:[...o.values()],frontiers:[...i.values()],blindSpots:[...s].sort()}}function Ut(e,t){let n=e.location.file;return{id:$e(`control-${t.kind}`,n,String(t.startLine),String(t.endLine),t.label),kind:`control-${t.kind}`,label:t.label,disposition:"folded",location:{file:n,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,constructKind:t.kind,implicit:t.implicit}}}function ti(e,t,n){let o=$e("edge","control-owner",t.id,n.id);e.has(o)||e.set(o,{id:o,kind:"control-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains-control"}],evidence:[{method:"parser-control-owner",strength:"exact",identity:t.id,location:t.location}]})}function $e(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var ct=new Set(["arrow_function","constructor_declaration","function_declaration","function_definition","function_expression","generator_function","generator_function_declaration","function_item","lambda","lambda_expression","method","method_declaration","method_definition"]),Qe=new Set(["block","body","compound_statement","declaration_list","statement_block"]),ni=new Set(["assignment","assignment_expression","augmented_assignment_expression"]),Ht=new Set(["update_expression"]),io=new Set(["array_access","element_access_expression","subscript_expression"]),so=new Set(["attribute","field_access","field_expression","member_access_expression","member_expression","selector_expression"]),oi=new Set(["false","null","null_literal","number","number_literal","string","string_literal","template_string","true"]),ri=new Set(["call_expression","method_invocation","object_creation_expression"]),ii=new Set(["comment","else_clause","formal_parameters","parameters","type_parameters"]);function ao(e,t,n,o){let i=Te(e,t);if(!i)return null;let s=mi(i.rootNode,n,o);if(!s)return null;let r=[],a=[],d=[];return Ae(s,c=>{if(ni.has(c.type)||Ht.has(c.type)||co(c)){let l=si(c);l?r.push(l):d.push({family:"state",startLine:c.startPosition.row,endLine:c.endPosition.row,reason:`Mutation target ${be(c.text)} could not be resolved to an exact source resource.`})}}),Ae(s,c=>{if(!Qe.has(c.type))return;let l=ui(c);for(let p=0;p<l.length-1;p+=1)a.push({from:Ye(l[p]),to:Ye(l[p+1]),subtype:"lexical-successor",synchronizationScope:null,attributes:{sameScope:!0,executionConditional:!0}});for(let p=0;p<l.length;p+=1){let g=l[p],m=gi(g).filter(f=>f.type==="await_expression");for(let f of m){let x=Je("event",`await ${be(f.text.replace(/^await\s+/u,""))}`,f);a.push({from:Ye(g),to:x,subtype:"awaits-completion",synchronizationScope:null,attributes:{completionRequired:!0}});let b=l[p+1];b&&a.push({from:x,to:Ye(b),subtype:"await-completion-before",synchronizationScope:null,attributes:{continuationOnly:!0}})}}}),Ae(s,c=>{if(c.type!=="synchronized_statement")return;let l=c.childForFieldName("object")??c.childForFieldName("condition")??c.namedChildren.find(x=>!Qe.has(x.type)),p=c.childForFieldName("body")??c.namedChildren.find(x=>Qe.has(x.type));if(!l||!p){d.push({family:"temporal",startLine:c.startPosition.row,endLine:c.endPosition.row,reason:"Synchronized scope has no structurally resolved monitor or body."});return}let g=be(l.text).replace(/^\(|\)$/gu,""),m=Je("lock",g,l),f=fi(p).filter(x=>x.parent!==null&&uo(x));for(let x of pi(f))a.push({from:m,to:Ye(x),subtype:"inside-lock-scope",synchronizationScope:g,attributes:{syntaxNative:!0}})}),{mutations:r,temporal:a,unsupported:d}}function si(e){let t=co(e),n=e.childForFieldName("left")??e.childForFieldName("argument")??(t?e.namedChildren.at(-1)??null:e.namedChildren[0]??null);if(!n)return null;let o=ai(n);if(!o)return null;let i=t?"delete":Ht.has(e.type)||!ci(e,n).startsWith("=")?"update":"assign",s=t||Ht.has(e.type)?null:e.childForFieldName("right");return{event:Je("event",be(e.text),e),resource:{kind:"resource",label:o.name,startLine:n.startPosition.row,endLine:n.endPosition.row},operation:i,durabilityClass:"in-memory",recordIdentity:o.recordIdentity,value:s?Je("value",be(s.text),s):null,dataSubtype:s?li(s,e):null}}function ai(e){if(io.has(e.type)){let t=e.childForFieldName("object")??e.childForFieldName("array")??e.namedChildren[0]??null,n=e.childForFieldName("index")??e.childForFieldName("subscript")??e.namedChildren[1]??null;return!t||!n?null:{name:`${be(t.text)}[]`,recordIdentity:be(n.text)}}return so.has(e.type)?{name:be(e.text),recordIdentity:null}:/^(?:identifier|property_identifier|field_identifier)$/u.test(e.type)?{name:be(e.text),recordIdentity:null}:null}function li(e,t){return oi.has(e.type)||/(?:integer|float|decimal|boolean|character)_literal$/u.test(e.type)?"constant-to-state":ri.has(e.type)?"return-to-state":so.has(e.type)||io.has(e.type)?"property-to-state":/identifier$/u.test(e.type)?di(e.text,t)?"captured-value-to-state":"value-to-state":"expression-to-state"}function di(e,t){let n=Gt(t.parent);if(!n||no(n,e))return!1;let o=Gt(n.parent);for(;o;){if(no(o,e))return!0;o=Gt(o.parent)}return!1}function Gt(e){let t=e;for(;t;){if(ct.has(t.type))return t;t=t.parent}return null}function no(e,t){let n=e.childForFieldName("parameters")??e.namedChildren.find(s=>["formal_parameters","parameters"].includes(s.type));if(n&&oo(n,t))return!0;let o=e.childForFieldName("body")??e.namedChildren.find(s=>Qe.has(s.type));if(!o)return!1;let i=!1;return lo(o,e,s=>{if(i||!/(?:declarator|declaration|parameter)$/u.test(s.type))return;let r=s.childForFieldName("name")??s.childForFieldName("pattern")??s.namedChildren[0];r&&oo(r,t)&&(i=!0)}),i}function oo(e,t){let n=!1;return Ae(e,o=>{/identifier$/u.test(o.type)&&o.text===t&&(n=!0)}),n}function lo(e,t,n){n(e);for(let o of e.namedChildren)o!==t&&ct.has(o.type)||lo(o,t,n)}function ci(e,t){let n=e.childForFieldName("right"),o=Math.max(0,t.endIndex-e.startIndex),i=n?Math.max(o,n.startIndex-e.startIndex):e.text.length;return e.text.slice(o,i).trim()}function co(e){return(e.type==="delete_expression"||e.type==="unary_expression")&&/^delete\b/u.test(e.text.trim())}function ui(e){return e.namedChildren.filter(t=>uo(t))}function uo(e){return ii.has(e.type)||Qe.has(e.type)?!1:/(?:statement|declaration)$/u.test(e.type)||e.type==="expression_statement"||e.type==="local_variable_declaration"}function pi(e){let t=new Set(e);return e.filter(n=>{let o=n.parent;for(;o;){if(t.has(o))return!1;o=o.parent}return!0})}function Ye(e){return Je("event",be(e.text),e)}function Je(e,t,n){return{kind:e,label:t,startLine:n.startPosition.row,endLine:n.endPosition.row}}function mi(e,t,n){let o=[];return Ae(e,s=>{s.startPosition.row<=t&&s.endPosition.row>=n&&o.push(s)}),o.filter(s=>ct.has(s.type)).sort(ro)[0]??o.sort(ro)[0]??null}function ro(e,t){return e.endIndex-e.startIndex-(t.endIndex-t.startIndex)||e.startIndex-t.startIndex}function fi(e){let t=[];return Ae(e,n=>t.push(n)),t}function gi(e){let t=[],n=o=>{t.push(o);for(let i of o.namedChildren)i!==e&&ct.has(i.type)||n(i)};return n(e),t}function Ae(e,t){t(e);for(let n of e.namedChildren)Ae(n,t)}function be(e){return e.trim().replace(/\s+/gu," ")}function fo(e,t,n=[]){let o=new Map,i=new Map,s=new Map,r=new Set;for(let a of t){if(!a.location||!["source-construct","symbol"].includes(a.kind))continue;let d=a.location.endLine??a.location.line,c=ao(e,a.location.file,a.location.line,d);if(!c){r.add(`State and temporal analysis unavailable for ${a.location.file}:${a.location.line+1}-${d+1}: no supported syntax tree or covering construct.`);continue}for(let l of c.mutations){let p=pt(a,l.event),g=vi(a,l.resource,l.durabilityClass);if(o.set(p.id,p),o.set(g.id,g),mt(i,a,p,"contains-state-effect"),ft(i,{kind:"state-resource",from:p,to:g,semantics:[{family:"state",subtype:l.operation==="delete"?"deletes-resource":"writes-resource",attributes:{operation:l.operation,durabilityClass:l.durabilityClass,resource:l.resource.label,recordIdentity:l.recordIdentity,transactionMembership:"unknown"}}],method:"parser-state-mutation",identity:l.event.label}),l.value&&l.dataSubtype){let m=pt(a,l.value);o.set(m.id,m),ft(i,{kind:"data-to-state",from:m,to:g,semantics:[{family:"data",subtype:l.dataSubtype,attributes:{operation:l.operation,resource:l.resource.label,recordIdentity:l.recordIdentity,value:l.value.label}}],method:"parser-assignment-value",identity:`${l.value.label} -> ${l.resource.label}`})}}for(let l of c.temporal){let p=pt(a,l.from),g=pt(a,l.to);o.set(p.id,p),o.set(g.id,g),mt(i,a,p,l.from.kind==="lock"?"contains-lock-scope":"contains-event"),mt(i,a,g,"contains-event"),ft(i,{kind:"temporal-order",from:p,to:g,semantics:[{family:"temporal",subtype:l.subtype,context:l.synchronizationScope?{synchronizationScope:l.synchronizationScope}:void 0,attributes:{...l.attributes}}],method:l.subtype==="inside-lock-scope"?"parser-synchronized-scope":"parser-program-order",identity:`${l.from.label} -> ${l.to.label}`})}for(let l of c.unsupported){let p=Ie(`${l.family}-unsupported`,a.location.file,String(l.startLine),String(l.endLine),l.reason);o.set(p,{id:p,kind:`${l.family}-unsupported`,label:l.reason,disposition:"unsupported",location:{file:a.location.file,line:l.startLine,endLine:l.endLine},anchorIds:[],attributes:{ownerNodeId:a.id}});let g=Ie("edge",`${l.family}-unsupported`,a.id,p);i.set(g,{id:g,kind:`${l.family}-unsupported`,fromNodeId:a.id,toNodeId:p,directed:!0,disposition:"unsupported",semantics:[{family:l.family,subtype:`unresolved-${l.family}-construct`}],evidence:[{method:`parser-${l.family}-construct`,strength:"exact",identity:l.reason,location:{file:a.location.file,line:l.startLine,endLine:l.endLine}}]});let m=Ie("frontier",l.family,p);s.set(m,{id:m,kind:l.family,direction:"unresolved",fromNodeIds:[a.id],edgeIds:[g],memberNodeIds:[p],memberCount:1,disposition:"unsupported",reason:l.reason,expansion:null})}}for(let a of t.filter(d=>d.kind==="runtime-boundary-participant")){let d=ut(a,"protocol"),c=ut(a,"action"),l=ut(a,"address")??a.label;!d||!c||!mo(d,c)||po(o,i,a,{observationId:a.id,action:c,strength:"exact",file:a.location?.file??"",line:a.location?.line??0,address:l,protocol:d,role:ut(a,"role")??void 0,resolution:"locally-linked"})}for(let a of n){if(!a.protocol||!mo(a.protocol,a.action))continue;let d=bi(t,a.file,a.line,a.ownerShortName??null);if(!d){r.add(`State observation ${a.observationId} at ${a.file}:${a.line+1} has no materialized owner node.`);continue}po(o,i,d,a)}return{nodes:[...o.values()],edges:[...i.values()],frontiers:[...s.values()],blindSpots:[...r].sort()}}function po(e,t,n,o){let i=Si(o),r={id:Ie("runtime-state-event",o.observationId),kind:"runtime-state-event",label:`${o.action} ${i}`,disposition:"folded",location:{file:o.file,line:o.line},anchorIds:[],attributes:{action:o.action,protocol:o.protocol??null,modality:o.modality??null,resolution:o.resolution??null}},a=o.protocol==="database"?"external-durable-intent":"external",d={id:Ie("runtime-state-resource",o.protocol??"unknown",i),kind:"runtime-state-resource",label:i,disposition:"folded",location:{file:o.file,line:o.line},anchorIds:[],attributes:{protocol:o.protocol??null,durabilityClass:a}};e.set(r.id,r),e.set(d.id,d),mt(t,n,r,"contains-runtime-state-effect");let c=yi(o.action);ft(t,{kind:"runtime-state-resource",from:r,to:d,semantics:[{family:"state",subtype:c,context:{crossesRuntimeBoundary:!0,protocol:o.protocol},attributes:{operation:o.action,durabilityClass:a,resource:i,recordIdentity:hi(o),modality:o.modality??null,resolution:o.resolution??null,transactionMembership:"unknown",commitState:o.protocol==="database"?"unknown":null}}],method:`runtime-boundary-${o.strength}`,identity:o.observationId})}function yi(e){return e==="database.read"?"reads-resource":e==="queue.send"?"enqueues-resource":e==="queue.consume"?"consumes-resource":"writes-resource"}function Si(e){return(e.keyParts?.find(n=>["address","resource"].includes(n.name))?.value??e.address)||e.observationId}function hi(e){return e.keyParts?.find(n=>/^(?:id|key|record)$/u.test(n.name))?.value??null}function mo(e,t){return e==="database"&&["database.read","database.write"].includes(t)||e==="queue"&&["queue.consume","queue.send"].includes(t)}function ut(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function bi(e,t,n,o){let i=e.filter(r=>r.location?.file===t&&["source-construct","symbol"].includes(r.kind)),s=i.filter(r=>r.location.line<=n&&(r.location.endLine??r.location.line)>=n).sort(xi)[0];if(s)return s;if(o){let r=i.find(a=>a.label===o||a.label.endsWith(`.${o}`)||a.label.includes(o));if(r)return r}return i.length===1?i[0]:null}function xi(e,t){let n=(e.location?.endLine??e.location?.line??0)-(e.location?.line??0),o=(t.location?.endLine??t.location?.line??0)-(t.location?.line??0);return n-o}function pt(e,t){let n=e.location.file;return{id:Ie(`program-${t.kind}`,n,String(t.startLine),String(t.endLine),t.label),kind:`program-${t.kind}`,label:t.label,disposition:"folded",location:{file:n,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,constructKind:t.kind}}}function vi(e,t,n){let o=e.location.file;return{id:Ie("program-resource",o,e.id,t.label,n),kind:"program-resource",label:t.label,disposition:"folded",location:{file:o,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,durabilityClass:n}}}function mt(e,t,n,o){let i=Ie("edge","program-owner",t.id,n.id,o);e.has(i)||e.set(i,{id:i,kind:"program-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:o}],evidence:[{method:"parser-program-owner",strength:"exact",identity:t.id,location:n.location}]})}function ft(e,t){let n=Ie("edge",t.kind,t.from.id,t.to.id,t.semantics[0].subtype);e.set(n,{id:n,kind:t.kind,fromNodeId:t.from.id,toNodeId:t.to.id,directed:!0,disposition:"folded",semantics:t.semantics,evidence:[{method:t.method,strength:"exact",identity:t.identity,location:t.from.location}]})}function Ie(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var Ei=new Set(["control","data","state","temporal"]),gt=new Set(["contains-control","contains-event","contains-lock-scope","contains-state-effect","contains-runtime-state-effect","contains","owns-parameter","owns-runtime-observation"]),ho=new Set(["discriminator-dispatch","result-callback","returns","runtime-handoff","throws"]);function bo(e,t={}){let n=new Map(e.nodes.map(w=>[w.id,w])),o=Ri(e.nodes,t.focusLocations),i=Ti(e.edges,t.focusLocations),s=Fi(e.edges,i),r=new Set(e.paths.flatMap(w=>w.edgeIds)),a=Le(e.anchors.filter(w=>w.status==="matched").flatMap(w=>w.nodeIds)),c=e.edges.filter(So).filter(w=>Ii(w,o,i,r)),l=c.filter(w=>Mi(w,o,i,s,n,r)),p=go(a,l,"forward"),g=Ci(p,l),m=go(g,l,"backward"),f=new Set([...p].filter(w=>m.has(w)));for(let w of a)f.add(w);let x=new Set(l.filter(w=>f.has(w.fromNodeId)&&f.has(w.toNodeId)).map(w=>w.id)),b=new Set(f),k=new Set(x);Li(c,b,k,o,i);let B=e.frontiers.filter(w=>ki(w,b)),R=Le(B.filter(w=>w.disposition==="unsupported").map(w=>w.id)),F=Le(e.edges.filter(w=>!So(w)&&vo(w)&&Pi(w,b)).map(w=>w.id)),W=Le(B.map(w=>w.id)),$=[];a.length===0&&$.push("No matched anchor node starts the corridor."),g.length===0&&$.push("No proved mechanical outcome is reachable from a matched anchor."),R.length>0&&$.push(`${R.length} unsupported frontier(s) touch the protected corridor.`),F.length>0&&$.push(`${F.length} candidate or unknown edge(s) touch the protected corridor.`);let _=$.length===0?"complete":"incomplete";return{schemaVersion:1,status:_,startNodeIds:a,outcomeNodeIds:g,baseNodeIds:Le([...f]),baseEdgeIds:Le([...x]),nodeIds:Le([...b]),edgeIds:Le([...k]),accountedFrontierIds:W,unresolvedFrontierIds:R,unresolvedEdgeIds:F,coverage:{protectedNodes:b.size,protectedEdges:k.size,baseNodes:f.size,baseEdges:x.size,accountedFrontiers:W.length,unresolvedFrontiers:R.length,unresolvedEdges:F.length},explanation:_==="complete"?"Every proved anchor-to-outcome path is closed over its material causal facts within reported coverage.":$.join(" ")}}function Ii(e,t,n,o){return t===null||e.disposition==="emitted"||o.has(e.id)||n?.has(e.id)===!0?!0:(e.semantics??[]).some(i=>{if(i.family==="identity"&>.has(i.subtype))return t.has(e.toNodeId);if(i.family==="contract")return t.has(e.fromNodeId)&&t.has(e.toNodeId);if(i.family==="state")return t.has(e.fromNodeId);if(i.family==="data"||i.family==="temporal")return t.has(e.fromNodeId)||t.has(e.toNodeId);if(i.family==="control"){if(Eo(i))return t.has(e.fromNodeId);if(["returns","throws"].includes(i.subtype))return t.has(e.toNodeId);if(i.subtype==="completion-callback")return t.has(e.fromNodeId)||t.has(e.toNodeId)}return!1})}function Li(e,t,n,o,i){let s=!0;for(;s;){s=!1;for(let r of e)wi(r,t,o,i)&&(n.has(r.id)||(n.add(r.id),s=!0),t.has(r.fromNodeId)||(t.add(r.fromNodeId),s=!0),t.has(r.toNodeId)||(t.add(r.toNodeId),s=!0))}}function wi(e,t,n,o){let i=t.has(e.fromNodeId),s=t.has(e.toNodeId);return!i&&!s?!1:(e.semantics??[]).some(r=>r.family==="identity"?gt.has(r.subtype)&&(s||n===null||n.has(e.toNodeId)):r.family==="contract"?!0:r.family==="state"?i&&(n===null||n.has(e.fromNodeId)):r.family==="temporal"?r.subtype==="lexical-successor"?i&&s:!0:r.family==="data"?s&&(i||n===null||n.has(e.fromNodeId)||o?.has(e.id)===!0):r.family==="control"?xo(r)||["returns","throws"].includes(r.subtype)&&!s&&n!==null&&!n.has(e.toNodeId)?!1:ho.has(r.subtype)||Eo(r)||r.subtype==="completion-callback":!1)}function Ci(e,t){let n=new Set,o=new Map,i=new Map;for(let s of t)!e.has(s.fromNodeId)||!e.has(s.toNodeId)||(o.set(s.fromNodeId,(o.get(s.fromNodeId)??0)+1),i.set(s.toNodeId,(i.get(s.toNodeId)??0)+1),(s.semantics??[]).some(r=>r.family==="state"||r.family==="control"&&ho.has(r.subtype))&&n.add(s.toNodeId));for(let s of e)(i.get(s)??0)>0&&(o.get(s)??0)===0&&n.add(s);return Le([...n])}function go(e,t,n){let o=new Map;for(let r of t){let a=n==="forward"?r.fromNodeId:r.toNodeId,d=n==="forward"?r.toNodeId:r.fromNodeId,c=o.get(a)??[];c.push(d),o.set(a,c)}let i=new Set(e),s=[...e];for(;s.length>0;){let r=s.shift();for(let a of o.get(r)??[])i.has(a)||(i.add(a),s.push(a))}return i}function Mi(e,t,n,o,i,s){return(e.semantics??[]).some(r=>e.disposition==="emitted"||s.has(e.id)?!0:r.family==="identity"&>.has(r.subtype)?t===null||t.has(e.toNodeId)||o?.has(e.toNodeId)===!0:!Ei.has(r.family)||xo(r)?!1:r.family==="control"&&["returns","throws"].includes(r.subtype)&&t!==null?t.has(e.toNodeId):t===null?!0:r.family==="state"?t.has(e.fromNodeId):r.family==="data"?t.has(e.fromNodeId)||t.has(e.toNodeId)||n?.has(e.id)===!0:r.family==="temporal"?r.subtype==="lexical-successor"?t.has(e.fromNodeId)&&t.has(e.toNodeId):t.has(e.fromNodeId)||t.has(e.toNodeId):r.family==="control"?Ni(e,i)&&(t.has(e.fromNodeId)||t.has(e.toNodeId)):!1)}function xo(e){return e.family==="control"&&["call","discriminator-dispatch","result-callback","runtime-handoff"].includes(e.subtype)}function Ni(e,t){let n=t.get(e.fromNodeId),o=t.get(e.toNodeId);if(!n||!o)return!1;let i=yo(n,"ownerNodeId")??(n.kind==="symbol"?n.id:null),s=yo(o,"ownerNodeId")??(o.kind==="symbol"?o.id:null);return i!==null&&i===s}function Ri(e,t){if(!t)return null;let n=new Map;for(let o of t){let i=n.get(o.file)??[];i.push(o.line),n.set(o.file,i)}return new Set(e.filter(o=>{if(!o.location||o.kind==="parameter")return!1;let i=n.get(o.location.file)??[],s=o.location.endLine??o.location.line;return i.some(r=>r>=o.location.line&&r<=s)}).map(o=>o.id))}function Ti(e,t){if(!t)return null;let n=new Map;for(let o of t){let i=n.get(o.file)??[];i.push(o.line),n.set(o.file,i)}return new Set(e.filter(o=>o.evidence.some(i=>{if(!i.location)return!1;let s=n.get(i.location.file)??[],r=i.location.endLine??i.location.line;return s.some(a=>a>=i.location.line&&a<=r)})).map(o=>o.id))}function Fi(e,t){return t===null?null:new Set(e.filter(n=>t.has(n.id)).flatMap(n=>[n.fromNodeId,n.toNodeId]))}function yo(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function So(e){return e.disposition==="excluded"||e.disposition==="unsupported"||!vo(e)?!1:e.evidence.some(t=>t.strength==="exact"||t.strength==="derived")}function vo(e){return(e.semantics??[]).some(t=>t.family!=="identity"||gt.has(t.subtype))}function Eo(e){return e.subtype.startsWith("predicate-")||e.subtype.startsWith("loop-")||e.subtype.startsWith("exception-")||e.subtype.startsWith("finally-")||e.subtype.startsWith("handler-")}function Pi(e,t){return t.has(e.fromNodeId)||t.has(e.toNodeId)}function ki(e,t){return[...e.fromNodeIds,...e.memberNodeIds].some(n=>t.has(n))}function Le(e){return[...new Set(e)].sort()}import{createHash as $i}from"crypto";var yt=["identity","contract","control","data","state","temporal"],Ai=new Set(yt);function ht(e){let t=Ke(e.anchors,"anchor"),n=Ke(e.nodes,"node"),o=Ke(e.edges,"edge"),i=Ke(e.paths??[],"path"),s=Ke(e.frontiers??[],"frontier"),r=new Set(t.map(m=>m.id)),a=new Set(n.map(m=>m.id)),d=new Set(o.map(m=>m.id)),c=e.routeCatalog?{...e.routeCatalog,routes:Ke(e.routeCatalog.routes,"route"),selectedRouteIds:ie(e.routeCatalog.selectedRouteIds)}:void 0;for(let m of t)de(`anchor ${m.id}`,[...m.nodeIds,...m.candidateNodeIds],a,"node");for(let m of n)de(`node ${m.id}`,m.anchorIds,r,"anchor");for(let m of o){if(de(`edge ${m.id}`,[m.fromNodeId,m.toNodeId],a,"node"),m.evidence.length===0)throw new Error(`Exploration edge ${m.id} has no evidence source.`);_i(m)}for(let m of i)de(`path ${m.id}`,[m.fromAnchorId,m.toAnchorId],r,"anchor"),de(`path ${m.id}`,m.nodeIds,a,"node"),de(`path ${m.id}`,m.edgeIds,d,"edge");for(let m of s)if(de(`frontier ${m.id}`,m.fromNodeIds,a,"node"),de(`frontier ${m.id}`,m.edgeIds,d,"edge"),de(`frontier ${m.id}`,m.memberNodeIds,a,"node"),m.memberCount!==m.memberNodeIds.length)throw new Error(`Exploration frontier ${m.id} reports ${m.memberCount} member(s) but identifies ${m.memberNodeIds.length}.`);for(let m of c?.routes??[])de(`route ${m.id}`,m.nodeIds,a,"node"),de(`route ${m.id}`,m.edgeIds,d,"edge"),de(`route ${m.id}`,[m.anchorNodeId,m.endpointNodeId],a,"node");c&&de("route catalog selection",c.selectedRouteIds,new Set(c.routes.map(m=>m.id)),"route");let l=ie(e.incompleteReasons??[]),p=l.length===0?"accounted":"incomplete",g=t.reduce((m,f)=>m+f.omittedCandidates,0);return{schemaVersion:1,anchors:t,nodes:n,edges:o,paths:i,frontiers:s,coverage:{status:p,scope:e.scope,nodes:Fo(n),edges:Fo(o),matchedAnchors:t.filter(m=>m.status==="matched").length,ambiguousAnchors:t.filter(m=>m.status==="ambiguous").length,missingAnchors:t.filter(m=>m.status==="missing").length,omittedCandidates:g,frontierGroups:s.length,programEdges:Bi(o),blindSpots:ie(e.blindSpots??[]),explanation:p==="accounted"?"Every node and edge discovered within the declared query scope is emitted, folded with recoverable identity, explicitly excluded, or reported unsupported.":`The declared query scope is not fully accounted for: ${l.join("; ")}`},completion:ji(p,i,e.scope),...c?{routeCatalog:c}:{}}}function Di(e){return e.flatMap(t=>Oi(t.semantics??[]).map(n=>({id:Ki(t.id,n),sourceEdgeId:t.id,sourceKind:t.kind,fromNodeId:t.fromNodeId,toNodeId:t.toNodeId,directed:!0,disposition:t.disposition,evidence:[...t.evidence],family:n.family,subtype:n.subtype,...n.context?{context:{...n.context}}:{},...n.attributes?{attributes:{...n.attributes}}:{}}))).sort((t,n)=>t.id.localeCompare(n.id))}function Bi(e){let t=Di(e),n=new Set(t.map(r=>r.sourceEdgeId)),o=new Map(yt.map(r=>[r,new Set])),i=new Map(yt.map(r=>[r,new Set])),s=new Map(yt.map(r=>[r,0]));for(let r of t)o.get(r.family).add(r.sourceEdgeId),i.get(r.family).add(r.subtype),s.set(r.family,s.get(r.family)+1);return{sourceEdges:e.length,mappedSourceEdges:n.size,projectedEdges:t.length,unmappedSourceEdges:e.length-n.size,unsupportedSourceEdges:e.filter(r=>r.disposition==="unsupported").length,unmappedKinds:ie(e.filter(r=>!n.has(r.id)).map(r=>r.kind)),families:{identity:Oe("identity",o,s,i),contract:Oe("contract",o,s,i),control:Oe("control",o,s,i),data:Oe("data",o,s,i),state:Oe("state",o,s,i),temporal:Oe("temporal",o,s,i)}}}function Oe(e,t,n,o){return{sourceEdges:t.get(e)?.size??0,projectedEdges:n.get(e)??0,subtypes:[...o.get(e)??[]].sort()}}function _i(e){let t=new Set;for(let n of e.semantics??[]){if(!Ai.has(n.family))throw new Error(`Exploration edge ${e.id} has unknown program edge family: ${n.family}.`);if(n.subtype.trim().length===0)throw new Error(`Exploration edge ${e.id} has an empty program edge subtype.`);let o=Wt(n);if(t.has(o))throw new Error(`Exploration edge ${e.id} repeats program edge semantic ${o}.`);t.add(o)}}function Oi(e){return[...e].sort((t,n)=>Wt(t).localeCompare(Wt(n)))}function Wt(e){return`${e.family}:${e.subtype}`}function Ki(e,t){return`program:${encodeURIComponent(e)}:${t.family}:${encodeURIComponent(t.subtype)}`}function ji(e,t,n){return e==="incomplete"||t.some(o=>o.status!=="connected")?{status:"coverage-incomplete",scope:n,explanation:"The declared graph query has an ambiguous, missing, candidate-only, or disconnected anchor relationship."}:t.length>0?{status:"connector-complete",scope:n,explanation:"Every requested anchor pair has a selected path supported by proved repository relationships."}:{status:"frontier-accounted",scope:n,explanation:"Every discovered direction in the declared graph query is emitted or represented by an exact frontier."}}function Po(e,t={}){let n=t.maxSelectedNodes??24;if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`maxSelectedNodes must be a positive safe integer; received ${n}`);let o=new Set(e.anchors.flatMap(y=>[...y.nodeIds,...y.candidateNodeIds])),i=[],s=e.anchors.filter(y=>y.status!=="missing"&&y.nodeIds.length+y.candidateNodeIds.length>0);for(let y=0;y<s.length;y+=1)for(let P=y+1;P<s.length;P+=1){let V=s[y],q=s[P],Z=Mo(e,V,q,!1),Se=Z??Mo(e,V,q,!0);Se?(Se.nodeIds.forEach(De=>o.add(De)),i.push({id:St("path",V.id,q.id),fromAnchorId:V.id,toAnchorId:q.id,status:!Z||V.status==="ambiguous"||q.status==="ambiguous"?"candidate":"connected",nodeIds:Se.nodeIds,edgeIds:Se.edgeIds})):i.push({id:St("path",V.id,q.id),fromAnchorId:V.id,toAnchorId:q.id,status:"partial",nodeIds:[],edgeIds:[]})}let r=ie(t.routeIds??[]),a=qi(e,r),d=new Set(a.routes.map(y=>y.id)),c=r.filter(y=>!d.has(y));if(c.length>0)throw new Error(`Unknown exploration route id(s): ${c.join(", ")}`);let p=a.routes.filter(y=>r.includes(y.id)).map(y=>({anchorNodeId:y.anchorNodeId,endpointNodeId:y.endpointNodeId,endpointKind:y.endpointKind,endpointPriority:2,nodeIds:[...y.nodeIds].reverse(),edgeIds:[...y.edgeIds].reverse()}));for(let y of p)y.nodeIds.forEach(P=>o.add(P));let g=i.length===0||i.some(y=>y.edgeIds.length>0);g&&Ro(e,o,n);let m=To(e,o),f=new Set(t.expandedFrontierIds??[]),x=new Set(m.map(y=>y.id)),b=[...f].filter(y=>!x.has(y)).sort();if(b.length>0)throw new Error(`Unknown exploration frontier id(s): ${b.join(", ")}`);for(let y of m)f.has(y.id)&&y.memberNodeIds.forEach(P=>o.add(P));g&&Ro(e,o,n);let k=new Map(p.map(y=>[y.endpointNodeId,y.endpointKind])),B=new Set(p.flatMap(y=>y.nodeIds)),R=new Map;for(let y of p)for(let P=0;P<y.nodeIds.length;P+=1){let V=y.nodeIds[P],q=P;R.set(V,Math.max(R.get(V)??0,q))}let F=e.nodes.map(y=>{let P=k.get(y.id),V=B.has(y.id)?{upstreamCausalPath:!0,upstreamCausalDistance:R.get(y.id)??0,...P?{upstreamCausalEndpoint:P}:{}}:{};return{...y,attributes:{...y.attributes,...V},disposition:y.disposition==="excluded"||y.disposition==="unsupported"?y.disposition:o.has(y.id)?"emitted":"folded"}}),W=new Set([...i.flatMap(y=>y.edgeIds),...p.flatMap(y=>y.edgeIds)]),$=e.edges.map(y=>({...y,disposition:y.disposition==="excluded"||y.disposition==="unsupported"?y.disposition:W.has(y.id)||o.has(y.fromNodeId)&&o.has(y.toNodeId)?"emitted":"folded"})),_=ht({anchors:e.anchors,nodes:F,edges:$,paths:i,frontiers:[...e.frontiers.filter(y=>y.disposition!=="folded"),...To({...e,nodes:F,edges:$},o)],scope:e.coverage.scope,blindSpots:e.coverage.blindSpots,incompleteReasons:e.coverage.status==="incomplete"?[e.coverage.explanation]:[],routeCatalog:a}),w=new Set(_.frontiers.flatMap(y=>y.edgeIds)),U=_.edges.filter(y=>y.disposition==="folded"&&!w.has(y.id)).map(y=>y.id);if(U.length>0)throw new Error(`Folded exploration edge(s) are not frontier-accounted: ${U.sort().join(", ")}`);return _}var Io=10;function qi(e,t=[]){let n=new Map(e.nodes.map(b=>[b.id,b])),o=new Map(e.edges.map(b=>[b.id,b])),i=new Map;for(let b of e.edges){if(!zi(b))continue;let k=i.get(b.toNodeId)??[];k.push(b),i.set(b.toNodeId,k)}for(let b of i.values())b.sort((k,B)=>Number(Xe(B))-Number(Xe(k))||Co(B)-Co(k)||k.fromNodeId.localeCompare(B.fromNodeId)||k.id.localeCompare(B.id));let s=ie(e.anchors.filter(b=>b.status==="matched").flatMap(b=>b.nodeIds)),r=new Map,a=new Set,d=(b,k,B)=>{let R=k.nodeIds[k.nodeIds.length-1],F=n.get(R),W=n.get(b);if(!F?.location||!W)return;let $=[...k.nodeIds].reverse(),_=[...k.edgeIds].reverse(),w=new Set($),U=_.flatMap(Z=>{let oe=o.get(Z);return oe?[oe]:[]}),y=e.edges.filter(Z=>Z.disposition!=="excluded"&&Z.disposition!=="unsupported"&&(w.has(Z.fromNodeId)||w.has(Z.toNodeId))),P={id:St("route",b,R,B,..._),status:"proved",anchorNodeId:b,anchorLabel:W.label,endpointNodeId:R,endpointLabel:F.label,endpointLocation:{...F.location},endpointKind:B,nodeIds:$,edgeIds:_,evidenceStrengths:ie(U.flatMap(Z=>Z.evidence.map(oe=>oe.strength))),spineEdgeFamilies:Lo(U,!0),relatedEdgeFamilies:Lo(y,!1),crossesRuntimeBoundary:U.some(Xe)},V=`${b}\0${R}\0${B}`,q=r.get(V);(!q||wo(P,q)<0)&&r.set(V,P)};for(let b of s){n.get(b)?.attributes.publicEntry===!0&&d(b,{nodeIds:[b],edgeIds:[]},"public-entry");let k=[{nodeIds:[b],edgeIds:[]}],B=new Map([[b,0]]);for(let R=0;R<k.length;R+=1){let F=k[R],W=F.nodeIds[F.nodeIds.length-1];F.edgeIds.length>0&&n.get(W)?.location&&n.get(W)?.attributes.publicEntry===!0&&d(b,F,"public-entry");let $=i.get(W)??[];if(F.edgeIds.length>=Io){$.some(_=>!F.nodeIds.includes(_.fromNodeId))&&a.add(b);continue}for(let _ of $){if(F.nodeIds.includes(_.fromNodeId))continue;let w=F.edgeIds.length+1,U=B.get(_.fromNodeId);if(U!==void 0&&U<=w)continue;let y={nodeIds:[...F.nodeIds,_.fromNodeId],edgeIds:[...F.edgeIds,_.id]};if(B.set(_.fromNodeId,w),Xe(_)&&n.get(_.fromNodeId)?.location){d(b,y,"runtime-boundary");continue}k.push(y)}}}let c=[...r.values()].sort(wo),l=new Set(c.map(b=>b.id)),p=ie(t.filter(b=>l.has(b))),g=ie(c.map(b=>b.anchorNodeId)),m=s.filter(b=>!g.includes(b)),f=[...a].sort(),x=e.coverage.status==="accounted"&&f.length===0?"accounted":"incomplete";return{schemaVersion:1,routes:c,selectedRouteIds:p,coverage:{status:x,scope:"Distinct proved public-entry and runtime-boundary endpoints reachable upstream in the supplied topology.",enumeration:"one-shortest-proved-path-per-endpoint",maximumDepth:Io,anchorNodeIds:s,anchorsWithRoutes:g,anchorsWithoutRoutes:m,depthLimitedAnchorNodeIds:f,routeCount:c.length,explanation:x==="accounted"?"Every distinct proved upstream public/runtime endpoint in the supplied topology has one stable shortest route.":"Route enumeration is incomplete because the supplied topology has incomplete coverage or a traversal reached the route-depth bound."}}}function Lo(e,t){let n=e.flatMap(o=>o.semantics?.map(i=>i.family)??[]);return t&&e.length>0&&n.length===0&&n.push("control"),ie(n)}function wo(e,t){return e.anchorNodeId.localeCompare(t.anchorNodeId)||e.edgeIds.length-t.edgeIds.length||e.endpointKind.localeCompare(t.endpointKind)||e.endpointNodeId.localeCompare(t.endpointNodeId)||e.id.localeCompare(t.id)}function zi(e){return e.disposition!=="excluded"&&e.disposition!=="unsupported"&&Ui(e)&&e.evidence.some(t=>["exact","derived","mixed"].includes(t.strength))}function Ui(e){return Xe(e)||e.kind==="boundary-observation"||e.kind==="call"||e.kind==="compiler:call"}function Xe(e){return e.kind==="runtime-boundary"||e.kind.startsWith("runtime:")}function Co(e){let t={exact:5,derived:4,mixed:3,candidate:1,unknown:0};return Math.max(0,...e.evidence.map(n=>t[n.strength]))}function Mo(e,t,n,o){return No(e,t,n,o)??No(e,n,t,o)}function No(e,t,n,o){let i=[...t.nodeIds,...t.candidateNodeIds].sort(),s=new Set([...n.nodeIds,...n.candidateNodeIds]);if(i.some(l=>s.has(l)))return{nodeIds:[i.find(p=>s.has(p))],edgeIds:[]};let r=new Set(e.nodes.filter(l=>l.kind==="structural-region").map(l=>l.id)),a=new Map;for(let l of e.edges)l.disposition==="excluded"||l.disposition==="unsupported"||l.kind==="structural-membership"||r.has(l.fromNodeId)||r.has(l.toNodeId)||l.evidence.every(g=>["candidate","unknown"].includes(g.strength))&&!o||Gi(a,l.fromNodeId,l.toNodeId,l.id);for(let l of a.values())l.sort((p,g)=>p.nodeId.localeCompare(g.nodeId)||p.edgeId.localeCompare(g.edgeId));let d=i.map(l=>({nodeId:l,nodeIds:[l],edgeIds:[]})),c=new Set(i);for(let l=0;l<d.length;l+=1){let p=d[l];for(let g of a.get(p.nodeId)??[]){if(c.has(g.nodeId))continue;let m={nodeId:g.nodeId,nodeIds:[...p.nodeIds,g.nodeId],edgeIds:[...p.edgeIds,g.edgeId]};if(s.has(g.nodeId))return m;c.add(g.nodeId),d.push(m)}}return null}function Gi(e,t,n,o){let i=e.get(t)??[];i.push({nodeId:n,edgeId:o}),e.set(t,i)}function Hi(e,t,n){let o=new Map;for(let a of e.edges){let d=o.get(a.fromNodeId)??{incoming:0,outgoing:0},c=o.get(a.toNodeId)??{incoming:0,outgoing:0};d.outgoing+=1,c.incoming+=1,o.set(a.fromNodeId,d),o.set(a.toNodeId,c)}let i=new Set,s=new Map;for(let a of e.edges){let d=t.has(a.fromNodeId),c=t.has(a.toNodeId);if(d===c)continue;let l=d?a.toNodeId:a.fromNodeId,p=d?a.fromNodeId:a.toNodeId,g=e.nodes.find(x=>x.id===l);if(g?.kind==="structural-region")continue;let m=s.get(l)??new Set;m.add(p),s.set(l,m),(/(?:runtime-boundary|external)/u.test(a.kind)||g&&/(?:frontier|external)/u.test(g.kind))&&i.add(l)}let r=[...s].filter(([a,d])=>{if(i.has(a))return!0;let c=o.get(a)??{incoming:0,outgoing:0};return(c.incoming>1||c.outgoing>1)&&d.size>1}).sort(([a,d],[c,l])=>Number(i.has(c))-Number(i.has(a))||l.size-d.size||a.localeCompare(c)).map(([a])=>a);for(let a of r){if(t.size>=n)break;t.add(a)}}function Ro(e,t,n){let o=-1;for(;t.size!==o&&t.size<n;)o=t.size,Hi(e,t,n)}function To(e,t){let n=new Set(e.nodes.filter(r=>!t.has(r.id)&&r.disposition!=="excluded"&&r.disposition!=="unsupported").map(r=>r.id)),o=new Map;for(let r of e.edges){if(!n.has(r.fromNodeId)||!n.has(r.toNodeId))continue;let a=o.get(r.fromNodeId)??new Set,d=o.get(r.toNodeId)??new Set;a.add(r.toNodeId),d.add(r.fromNodeId),o.set(r.fromNodeId,a),o.set(r.toNodeId,d)}let i=[],s=new Set;for(let r of[...n].sort()){if(s.has(r))continue;let a=[],d=[r];s.add(r);for(let c=0;c<d.length;c+=1){let l=d[c];a.push(l);for(let p of[...o.get(l)??[]].sort())s.has(p)||(s.add(p),d.push(p))}i.push(a.sort())}return i.map(r=>{let a=new Set(r),d=e.edges.filter(f=>a.has(f.fromNodeId)||a.has(f.toNodeId)),c=d.filter(f=>a.has(f.fromNodeId)!==a.has(f.toNodeId)),l=ie(c.map(f=>a.has(f.fromNodeId)?f.toNodeId:f.fromNodeId)),p=new Set(c.map(f=>a.has(f.toNodeId)?"outgoing":"incoming")),g=ie(d.map(f=>f.id)),m=ie(c.map(f=>f.kind));return{id:St("frontier",...r,...g),kind:m.join("+")||"disconnected",direction:p.size===1?[...p][0]:"undirected",fromNodeIds:l,edgeIds:g,memberNodeIds:r,memberCount:r.length,disposition:"folded",reason:c.length>0?"Connected evidence is folded beyond the first edge leaving the selected connector graph.":"Discovered evidence is disconnected from every selected anchor connector under the declared relation scope.",expansion:null}})}function St(e,...t){let n=$i("sha256").update(t.join("\0")).digest("hex").slice(0,16);return`${e}:${n}`}function Ke(e,t){let n=[...e].sort((o,i)=>o.id.localeCompare(i.id));for(let o=1;o<n.length;o+=1)if(n[o-1].id===n[o].id)throw new Error(`Duplicate exploration ${t} id: ${n[o].id}`);return n}function de(e,t,n,o){let i=ie(t.filter(s=>!n.has(s)));if(i.length>0)throw new Error(`Exploration ${e} references missing ${o}(s): ${i.join(", ")}`)}function Fo(e){return{total:e.length,emitted:e.filter(t=>t.disposition==="emitted").length,folded:e.filter(t=>t.disposition==="folded").length,excluded:e.filter(t=>t.disposition==="excluded").length,unsupported:e.filter(t=>t.disposition==="unsupported").length}}function ie(e){return[...new Set(e)].sort()}var Wi=5,Vi=12,Yi=8,Qi=3,ko=8,Ji=6,Xi=12,$o=12,Zi=12,es=2,ts=new Set(["branch","loop","call","await","return","throw","mutation","catch","finally"]),ns=9e3,Ao=qn,Do=new WeakMap;function Sl(e,t){return Ho(e,t,"full")}function hl(e,t){return Ho(e,t,"topology")}function Ho(e,t,n){let o=Ue(t.searches??[]),i=Ue(t.symbols??[]),s=Ue(t.relations&&t.relations.length>0?t.relations:Ao),r=s.filter(u=>!Ao.includes(u));if(r.length>0)throw new Error(`Unsupported system-map relation kind(s): ${r.join(", ")}`);let a=new Set(s),d=t.evidenceFloor??"derived";if(d!=="exact"&&d!=="derived")throw new Error(`Unsupported system-map evidence floor: ${d}`);let c=Ue(t.sourceScopes&&t.sourceScopes.length>0?t.sourceScopes:["production"]),l=["production","test","fixture","example","generated","script","unknown"],p=c.filter(u=>!l.includes(u));if(p.length>0)throw new Error(`Unsupported system-map source scope(s): ${p.join(", ")}`);let g=new Set(c),m=u=>g.has(kt(u));if(o.length===0&&i.length===0)throw new Error("system-map requires at least one --search or --symbol anchor.");let f=t.maxDepth??Wi;if(!Number.isSafeInteger(f)||f<0)throw new RangeError(`maxDepth must be a non-negative safe integer; received ${f}`);let x=t.maxTopologyCharacters??ns;if(!Number.isSafeInteger(x)||x<=0)throw new RangeError(`maxTopologyCharacters must be a positive safe integer; received ${x}`);let b=new wn(e),{fileGraph:k,reverseFileGraph:B,workspaces:R,runtimeBoundaries:F}=Ws(e,b),W=new Map((F?.observations??[]).map(u=>[u.id,u])),$=new Set((F?.observations??[]).map(u=>`${u.source.file}\0${u.source.startLine}`)),_=new Set,w=new Map,U=new Map,y=new Map,P=new Map,V=[],q=new Map,Z=new Map,oe=[],Se=0,De=0,et=0,Zt=0,en=0,tn=0,nn=new Set,It=new Map,on=new Map,Xo=u=>{let E=on.get(u);if(E)return E;let C=$t(e,u,{excludeIndexedTargets:!1});return on.set(u,C),C},ve=(u,E,C,O,v=!1)=>{let S=U.get(u);if(S)return S.depth=Math.min(S.depth,E),S.primary||=O,S.promoteBoundaryImports||=v,S.origins.add(C),S;let L={file:u,depth:E,primary:O,promoteBoundaryImports:v,origins:new Set([C]),processed:!1};return U.set(u,L),L},ae=(u,E,C,O,v="none",S=!1)=>{let L=y.get(u.symbol);if(L)return L.depth=Math.min(L.depth,E),L.origins.add(C),O&&L.anchorQueries.add(O),L.referenceScope=Hs(L.referenceScope,v),ve(u.relativePath,E,C,!0,S),L;let N={definition:u,depth:E,origins:new Set([C]),anchorQueries:new Set(O?[O]:[]),referenceScope:v,processed:!1};return y.set(u.symbol,N),ve(u.relativePath,E,C,!0,S),N},Ne=(u,E,C,O,v=!1,S=!0)=>{let L=xe(u),N=P.get(L);if(N)return N.depth=Math.min(N.depth,E),N.origins.add(C),O&&N.anchorQueries.add(O),N.reverseCallExpansion||=v,N.traversalEligible||=S,ve(u.file,E,C,N.traversalEligible,!0),N;let I={...u,depth:E,origins:new Set([C]),anchorQueries:new Set(O?[O]:[]),reverseCallExpansion:v,traversalEligible:S};return P.set(L,I),ve(u.file,E,C,S,!0),I},rn=(u,E,C)=>{ve(u.source.file,E,C,!0,!0),u.owner.file!==u.source.file&&ve(u.owner.file,E,`${C}:owner`,!0,!0);let O=we(e,u.owner.file),v=u.owner.symbol?Ce(e,b,u.owner.symbol).matches.find(N=>N.relativePath===u.owner.file):null,S=(v&&!re(v.symbol)?v:null)??Be(O,u.source.startLine);if(S&&!re(S.symbol))return ae(S,E,C,void 0,"none",!0),S.symbol;u.owner.name&&Ne({file:u.owner.file,name:u.owner.name,startLine:u.owner.startLine,endLine:u.owner.endLine},E,`${C}:source-owner`,void 0,!0);let L=b.definitionsForFile(u.source.file).filter(N=>!!N.leaf&&Ft(e,u.source.file,N.leaf).some(I=>I>=u.source.startLine&&I<=u.source.endLine));if(L.length===1){let N=L[0];ae(N,E,`${C}:handler-identifier`,void 0,"none",!0),ce(q,{kind:"runtime-boundary",evidence:"runtime-boundary:handler-identifier",fromFile:u.source.file,fromSymbol:null,toFile:N.relativePath,toSymbol:N.symbol,fromBoundaryParticipant:je(u),line:u.source.startLine,strength:"derived"})}return null};for(let u of o){let E=Rs(e,b,u,$),C=E.filter(L=>$s(L,m)),O=!t.fullLiteralTraversal&&(E.length>Vi||C.length>Yi),v=O?[]:E,S=new Set((O?[]:t.fullLiteralTraversal?C:[...C].sort(Ts).slice(0,Qi)).map(jo));O&&(De+=1,et+=E.length);for(let L of v){let N=S.has(jo(L)),I=N&&!L.ownerSymbol&&L.ownerStartLine!==null&&L.ownerEndLine!==null;if(ve(L.relativePath,0,`${N?"literal-anchor":"literal-match"}:${u}`,I,I),I&&Ne({file:L.relativePath,name:L.ownerShortName??`${L.relativePath}:${L.ownerStartLine+1}`,startLine:L.ownerStartLine,endLine:L.ownerEndLine},0,`literal-source-owner:${u}`,u,!0),N&&L.ownerSymbol){let T=Ce(e,b,L.ownerSymbol).matches[0];T&&!re(T.symbol)&&ae(T,0,"literal-owner",u,"all",!0)}V.push({query:u,file:L.relativePath,line:L.line,ownerSymbol:L.ownerSymbol,ownerShortName:L.ownerShortName,ownerStartLine:L.ownerStartLine,ownerEndLine:L.ownerEndLine,sourceLine:L.sourceLine.trim(),matchKind:L.matchKind,traversalSeed:N})}oe.push({kind:"literal",query:u,status:E.length>0?"matched":"missing",matchedRegionIds:[],matchingLines:E.length,seedMatchingLines:O?0:S.size,matchOnlyLines:E.length-S.size,eligibleSeedMatchingLines:C.length,materializedMatchingLines:v.length,withheldMatchingLines:O?E.length:0,literalTraversal:O?"withheld-broad":"materialized",representativeMatches:O?As(u,E):void 0,narrowingCommands:O?Bs(u,E):void 0,exhaustiveTraversalCommand:O||S.size<C.length?`scip-query system-map --search ${H(u)} --full-literal-traversal`:void 0,seedRegionIds:[],matchOnlyRegionIds:[]})}for(let u of i){let E=Ce(e,b,u);Se+=E.omitted;let C=Fs(e,u),O=E.matches.filter(I=>!re(I.symbol)),v=C!==null&&O.length===0;v&&Ne(C,0,"source-construct-anchor",u,!0);let S=v?O:E.matches;for(let I of S)ae(I,0,"symbol-anchor",u,"all",!0);let L=v?Ps(C):null,N=v?1:E.total;oe.push({kind:"symbol",query:u,status:N===0?"missing":N===1?"matched":"ambiguous",matchedRegionIds:[],symbolCandidates:[...L?[L]:[],...S.map(qs)],totalSymbolCandidates:N,omittedSymbolCandidates:E.omitted})}for(let u=0;u<f;u+=1){if(a.has("call")){let v=[...P.values()].filter(S=>S.traversalEligible&&S.reverseCallExpansion&&S.depth<=u&&!nn.has(xe(S)));for(let S of v){nn.add(xe(S));let L=Ee(e,S.file);if((L?.callables??[]).filter(T=>T.name===S.name&&T.startLine<=S.endLine&&T.endLine>=S.startLine).length===1){let T=(L?.callSites??[]).filter(D=>D.calleeLeaf===S.name&&!D.memberAccess);for(let D of T){let G=u+1,A=Be(we(e,S.file),D.line),z=null,Q=null;if(A&&!re(A.symbol)){if(A.relativePath===S.file&&A.startLine<=S.endLine&&A.endLine>=S.startLine)continue;ae(A,G,"reverse-local-call-owner",void 0,"forward-regions",!0),z=A.symbol}else{let h=Vt(e,S.file,D.line);h&&xe(h)!==xe(S)&&(Q=Ne(h,G,"reverse-local-call-source-owner",void 0,!0))}!z&&!Q||ce(q,{kind:"call",evidence:"ast-callsite",fromFile:S.file,fromSymbol:z,toFile:S.file,toSymbol:null,fromSourceConstruct:Q?se(Q):void 0,toSourceConstruct:se(S),line:D.line,strength:"derived"})}}let I=new Set([...B.get(S.file)??[],...It.get(xe(S))??[],...$n(e,S.file).flatMap(T=>[...B.get(T)??[]])]);for(let T of I){if(!m(T))continue;let G=Xo(T).targets.filter(A=>A.targetFile===S.file&&A.targetStartLine<=S.endLine&&A.targetEndLine>=S.startLine);for(let A of G){let z=u+1,Q=Be(we(e,T),A.line),h=null,K=null;if(Q&&!re(Q.symbol))ae(Q,z,"reverse-member-call-owner",void 0,"cross-workspace-or-forward",!0),h=Q.symbol;else{let M=Vt(e,T,A.line);M&&(K=Ne(M,z,"reverse-member-call-source-owner",void 0,!0))}!h&&!K||ce(q,{kind:"call",evidence:"ast-service-member-callsite",fromFile:T,fromSymbol:h,toFile:S.file,toSymbol:null,fromSourceConstruct:K?se(K):void 0,toSourceConstruct:se(S),line:A.line,strength:A.strength==="exact"?"exact":"derived"})}}}}let E=[...y.values()].filter(v=>!v.processed&&v.depth<=u),C=a.has("call")?b.calleeMap(E.map(v=>v.definition),{additive:!1,semantic:!1}):new Map;for(let v of E){v.processed=!0;let S=v.definition;if(v.referenceScope!=="none"&&(a.has("call")||a.has("reference")||a.has("contract-symbol"))){let L=Os(e,b,S).filter(I=>m(I.file)&&Gs(v,I.file,U,R)),N=new Set(L.flatMap(I=>{if(!(a.has("call")&&Ee(e,I.file)?.callSites.some(G=>G.line===I.line&&Bo(e,I.file,G,S))===!0)||!I.enclosingSymbol)return[];let D=Ce(e,b,I.enclosingSymbol).matches[0];return D&&!re(D.symbol)?[{owner:D,site:I}]:[]}).sort((I,T)=>{let D=ue(S.relativePath,R).relativeDir,G=ue(I.owner.relativePath,R).relativeDir===D,A=ue(T.owner.relativePath,R).relativeDir===D,z=_o(e,I.owner),Q=_o(e,T.owner),h=I.owner.endLine-I.owner.startLine,K=T.owner.endLine-T.owner.startLine;return Number(A)-Number(G)||Q-z||h-K||I.owner.symbol.localeCompare(T.owner.symbol)}).filter((I,T,D)=>D.findIndex(G=>G.owner.symbol===I.owner.symbol)===T).reduce((I,T)=>{if(I.length>=es)return I;let D=ue(T.owner.relativePath,R).relativeDir;return I.some(G=>G.workspace===D)||I.push({symbol:T.owner.symbol,workspace:D}),I},[]).map(I=>I.symbol));for(let I of L){let T=u+1;ve(I.file,T,`reference:${te(S.symbol)}`,!0);let D=a.has("call")&&Ee(e,I.file)?.callSites.some(z=>z.line===I.line&&Bo(e,I.file,z,S))===!0,G=null,A=null;if(I.enclosingSymbol){let z=Ce(e,b,I.enclosingSymbol).matches[0];z&&!re(z.symbol)&&(ae(z,T,"reference-owner",void 0,D&&N.has(z.symbol)?v.referenceScope:"none"),G=z.symbol)}if(!G&&I.line!==null){let z=Vt(e,I.file,I.line);z&&(A=Ne(z,T,"reference-source-owner",void 0,D))}a.has("reference")&&ce(q,{kind:"reference",evidence:"indexed-or-source-reference",fromFile:I.file,fromSymbol:G,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:A?se(A):void 0,line:I.line,strength:"mixed"}),D&&ce(q,{kind:"call",evidence:"ast-callsite",fromFile:I.file,fromSymbol:G,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:A?se(A):void 0,line:I.line,strength:"derived"}),a.has("contract-symbol")&&ue(I.file,R).relativeDir!==ue(S.relativePath,R).relativeDir&&ce(q,{kind:"contract-symbol",evidence:"compiler-cross-workspace-symbol",fromFile:I.file,fromSymbol:G,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:A?se(A):void 0,line:I.line,strength:"exact"})}}for(let L of C.get(S.symbolId)??[]){let N=Ce(e,b,L.symbol).matches.find(T=>T.relativePath===L.file);if(!N||!m(N.relativePath))continue;if(!(N.relativePath===S.relativePath||(k.get(S.relativePath)??new Set).has(N.relativePath))){Zt+=1;continue}ae(N,u+1,`call:${te(S.symbol)}`,void 0,"none",!0),ce(q,{kind:"call",evidence:L.source,fromFile:S.relativePath,fromSymbol:S.symbol,toFile:N.relativePath,toSymbol:N.symbol,line:null,strength:Es(L.source)})}}let O=[...U.values()].filter(v=>!v.processed&&v.primary&&v.depth<=u);for(let v of O){v.processed=!0;let S=[...P.values()].filter(h=>h.traversalEligible&&h.file===v.file&&h.depth<=u),L=[...y.values()].filter(h=>h.definition.relativePath===v.file&&h.depth<=u).map(h=>{let K=At(e,v.file,h.definition.startLine);return{startLine:K?.startLine??h.definition.startLine,endLine:K?.endLine??h.definition.endLine}}),N=h=>[...y.values()].filter(K=>K.definition.relativePath===v.file&&K.definition.startLine<=h&&K.definition.endLine>=h).sort((K,M)=>K.definition.endLine-K.definition.startLine-(M.definition.endLine-M.definition.startLine)||K.definition.startLine-M.definition.startLine)[0],I=[...W.values()].filter(h=>h.source.file===v.file&&w.has(h.id)),T=[...S.map(h=>({startLine:h.startLine,endLine:h.endLine})),...I.map(h=>({...bt(e,h)}))],D=[...L,...T],G=(Ee(e,v.file)?.callSites??[]).filter(h=>D.some(K=>h.line>=K.startLine&&h.line<=K.endLine)),A=new Set;if(a.has("call"))for(let h of D){let K=An(e,v.file,h.startLine,h.endLine);for(let M of K.targets){if(!m(M.definition.relativePath))continue;let J=N(M.sourceLine),he=S.find(ge=>ge.startLine<=M.sourceLine&&ge.endLine>=M.sourceLine),le=I.find(ge=>{let ee=bt(e,ge);return ee.startLine<=M.sourceLine&&ee.endLine>=M.sourceLine});ae(M.definition,u+1,`scip-occurrence-call:${v.file}:${M.sourceLine+1}`,void 0,"none",!0),ce(q,{kind:"call",evidence:"scip-occurrence-callsite",fromFile:v.file,fromSymbol:J?.definition.symbol??null,toFile:M.definition.relativePath,toSymbol:M.definition.symbol,fromBoundaryParticipant:le?je(le):void 0,fromSourceConstruct:he?se(he):void 0,line:M.sourceLine,strength:"exact"}),A.add(`${M.sourceLine}\0${M.calleeLeaf}`)}}if(a.has("reference"))for(let h of D){let K=Dn(e,v.file,h.startLine,h.endLine);for(let M of K.targets){if(!m(M.definition.relativePath)||A.has(`${M.sourceLine}\0${M.calleeLeaf}`))continue;let J=N(M.sourceLine);if(J?.definition.symbol===M.definition.symbol)continue;let he=S.find(ge=>ge.startLine<=M.sourceLine&&ge.endLine>=M.sourceLine),le=I.find(ge=>{let ee=bt(e,ge);return ee.startLine<=M.sourceLine&&ee.endLine>=M.sourceLine});ae(M.definition,u+1,`scip-occurrence-reference:${v.file}:${M.sourceLine+1}`,void 0,"none",!0),ce(q,{kind:"reference",evidence:"scip-occurrence-reference",fromFile:v.file,fromSymbol:J?.definition.symbol??null,toFile:M.definition.relativePath,toSymbol:M.definition.symbol,fromBoundaryParticipant:le?je(le):void 0,fromSourceConstruct:he?se(he):void 0,line:M.sourceLine,strength:"exact"})}}let z=a.has("call")?$t(e,v.file,{ranges:D,excludeIndexedTargets:!1}):{targets:[],unresolvedCallsites:0};tn+=z.unresolvedCallsites;let Q=z.targets.filter(h=>!A.has(`${h.line}\0${h.calleeLeaf}`));en+=Q.filter(h=>h.strength!=="exact"&&(h.resolution!=="imported-service-object-member"||(h.resolutionAlternativeCount??0)>1)).length;for(let h of Q){let K=(h.resolutionAlternativeCount??1)===1,M=h.targetSymbol?we(e,h.targetFile).find(ee=>ee.symbol===h.targetSymbol):void 0,J=M?null:Ne({file:h.targetFile,name:h.calleeLeaf,startLine:h.targetStartLine,endLine:h.targetEndLine},u+1,`member-call:${v.file}`,void 0,h.resolution==="imported-service-object-member"&&K,K);if(J&&h.serviceFile){let ee=xe(J),ze=It.get(ee)??new Set;for(let cr of B.get(h.serviceFile)??[])ze.add(cr);It.set(ee,ze)}M&&ae(M,u+1,`member-call:${v.file}`,void 0,"none",!0);let he=S.find(ee=>ee.startLine<=h.line&&ee.endLine>=h.line),le=N(h.line),ge=I.find(ee=>{let ze=bt(e,ee);return ze.startLine<=h.line&&ze.endLine>=h.line});ce(q,{kind:"call",evidence:h.resolution==="constructed-member-receiver"?"ast-constructed-member-callsite":h.resolution==="factory-callback-member"?"ast-factory-callback-callsite":h.resolution==="imported-service-object-member"?"ast-service-member-callsite":"ast-member-import-candidate",fromFile:v.file,fromSymbol:le?.definition.symbol??null,toFile:h.targetFile,toSymbol:M?.symbol??null,fromBoundaryParticipant:ge?je(ge):void 0,fromSourceConstruct:he?se(he):void 0,toSourceConstruct:J?se(J):void 0,line:h.line,strength:h.resolution==="imported-service-object-member"?(h.resolutionAlternativeCount??0)===1?"derived":"candidate":h.strength??"candidate"})}for(let h of a.has("import")||a.has("call")?Ks(e,v.file):[]){if(!h.fromFile){if(a.has("import")){let M=Z.get(h.shortName)??{name:h.shortName,fromFiles:new Set};M.fromFiles.add(v.file),Z.set(h.shortName,M)}continue}if(!m(h.fromFile))continue;if(a.has("import")&&(ve(h.fromFile,u+1,`import:${v.file}`,!1),ce(q,{kind:"import",evidence:"indexed-or-source-import",fromFile:v.file,fromSymbol:null,toFile:h.fromFile,toSymbol:h.symbol,line:null,strength:"mixed"})),a.has("call")&&G.length>0){let M=(h.source==="compiler"?Ce(e,b,h.symbol).matches:Cn(e,h.fromFile,h.importedName)).filter(J=>!re(J.symbol));for(let J of M){let he=G.filter(le=>le.calleeLeaf===h.localName).map(le=>le.line);if(he.length!==0){ae(J,u+1,`source-call:${v.file}`,void 0,"none",!0);for(let le of he)ce(q,{kind:"call",evidence:"ast-callsite",fromFile:v.file,fromSymbol:null,toFile:J.relativePath,toSymbol:J.symbol,line:le,strength:"derived"})}}}if(!v.promoteBoundaryImports||!zs(v.file,h.fromFile,R))continue;let K=Ce(e,b,h.symbol);for(let M of K.matches)if(Us(M.relativePath,h.fromFile,R)&&!re(M.symbol)){let J=ue(v.file,R).relativeDir!==ue(M.relativePath,R).relativeDir;ae(M,u+1,`boundary-import:${v.file}`,void 0,J?"cross-workspace-or-forward":"forward-regions")}}}for(let v of a.has("runtime-boundary")?F?.links??[]:[]){if(v.strength==="candidate"||d==="exact"&&v.strength!=="exact"||_.has(v.id))continue;let S=W.get(v.from),L=W.get(v.to);if(!S||!L||!m(S.source.file)||!m(L.source.file))continue;let N=Uo(S,u,w,y,P),I=Uo(L,u,w,y,P);if(N===null&&I===null)continue;let T=u+1,D=rn(S,N??T,`runtime-boundary:${v.joinRule}`),G=rn(L,I??T,`runtime-boundary:${v.joinRule}`),A=D?null:zo(P,S),z=G?null:zo(P,L);w.set(S.id,N??T),w.set(L.id,I??T),ce(q,{kind:"runtime-boundary",evidence:`runtime-boundary:${v.joinRule}`,fromFile:S.source.file,fromSymbol:D,toFile:L.source.file,toSymbol:G,fromBoundaryParticipant:je(S),toBoundaryParticipant:je(L),fromSourceConstruct:A?se(A):void 0,toSourceConstruct:z?se(z):void 0,runtimeBoundaryKey:v.matchedKeyParts.map(Q=>`${Q.name}=${Q.value}`).join(" "),line:S.source.startLine,strength:v.strength}),_.add(v.id)}}let me=new Map;for(let u of U.keys())me.set(u,Ze(u,R));let tt=[...q.values()].filter(u=>me.has(u.fromFile)&&me.has(u.toFile)).map(u=>({...u,fromRegionId:me.get(u.fromFile).id,toRegionId:me.get(u.toFile).id})).sort(Qo),Lt=ta(tt),nt=new Set(t.expand??[]),Re=Js(U,y,V,tt,Lt,me,nt),sn=new Set([...U.values()].filter(u=>[...u.origins].some(E=>E.startsWith("literal-anchor:")||E==="literal-owner"||E==="symbol-anchor")).map(u=>me.get(u.file).id)),an=Cs(Re),Zo=new Set(Re.map(u=>u.id)),er=[...nt].filter(u=>!Zo.has(u)).sort();for(let u of oe)if(u.matchedRegionIds=oa(u,V,y,me),u.kind==="literal"){let E=V.filter(C=>C.query===u.query);u.seedRegionIds=j(E.filter(C=>C.traversalSeed).map(C=>me.get(C.file).id)),u.matchOnlyRegionIds=j(E.filter(C=>!C.traversalSeed).map(C=>me.get(C.file).id))}let ln=[...y.values()].filter(u=>!u.processed).length,dn=[...U.values()].filter(u=>u.primary&&!u.processed).length,cn=[...U.values()].filter(u=>!u.primary&&!u.processed).length,un=[...y.values()].filter(u=>u.processed),ot=(F?.frontiers??[]).flatMap(u=>{let E=W.get(u.observationId);return!E&&u.source&&u.action&&u.strength?!a.has("runtime-boundary")||!m(u.source.file)||d==="exact"||!U.has(u.source.file)?[]:[{observationId:u.observationId,action:u.action,strength:u.strength,file:u.source.file,line:u.source.startLine,ownerShortName:u.ownerShortName??null,address:u.address??u.missingKeyParts.join(", "),reason:u.reason}]:!a.has("runtime-boundary")||!E||!m(E.source.file)||d==="exact"&&E.strength!=="exact"||!U.has(E.source.file)?[]:[{observationId:E.id,action:E.action,strength:E.strength,file:E.source.file,line:E.source.startLine,ownerShortName:E.owner.name,address:Yo(E),reason:u.reason,protocol:E.protocol,role:E.role,modality:E.modality,resolution:E.resolution,sourceScope:E.sourceScope,keyParts:E.keyParts.map(C=>({name:C.name,value:C.value,evidence:C.evidence}))}]}).sort((u,E)=>u.file.localeCompare(E.file)||u.line-E.line),wt=(F?.links??[]).filter(u=>{if(!a.has("runtime-boundary")||d==="exact"&&u.strength!=="exact")return!1;let E=W.get(u.from),C=W.get(u.to);return!!(E&&C&&m(E.source.file)&&m(C.source.file)&&(U.has(E.source.file)||U.has(C.source.file)))}),tr=wt.filter(u=>u.strength==="exact").length,nr=wt.filter(u=>u.strength==="derived").length,or=wt.filter(u=>u.strength==="candidate").length,rr=F?.links.filter(u=>u.strength==="exact").length??0,ir=F?.links.filter(u=>u.strength==="derived").length??0,sr=F?.links.filter(u=>u.strength==="candidate").length??0,Ct=na(Z,me),Mt=Se===0?"accounted":"incomplete",pn=[...De>0?[`${De} broad literal anchor(s) withheld ${et} exact match(es) before graph traversal; representative identities and scoped search commands preserve recovery without treating every textual occurrence as relevant.`]:[],`Literal matches outside the included source scopes (${c.join(", ")}) remain visible as match-only evidence and do not seed traversal.`,F?"Built-in runtime-boundary extractors traverse direct and replayably derived links; heuristic candidates, unsupported frameworks, reflection, generated names, and dependency wiring not recoverable from compiler occurrences or constructor assignments remain disclosed frontiers.":"Runtime-boundary evidence is unavailable for this index; run scip-query reindex with this build to extract supported HTTP, event, registry, and persistence observations.","Reverse references do not recursively expand from discovered callers or callees.","Member calls use compiler occurrences, exact constructor-assigned fields, bounded unique service providers, direct factory-return members, and compiler-resolved object-literal callbacks when available. Ambiguous providers remain candidate frontiers; callback values routed through mutation, reflection, or unsupported dependency containers remain unrepresented.","Literal traversal is bounded to the smallest parser-delimited source construct; parser gaps may reduce an owner to one source line and leave its continuation untraversed.","Schema consumers stay within forward-flow regions; cross-workspace contracts may discover consumers in other workspaces. Add an explicit symbol anchor to widen either scope.",`Traversal stops after depth ${f}; nonzero frontier counts identify evidence that was discovered but not traversed.`,"Region labels are structural path groupings, not inferred runtime or architectural boundaries."],fe=gs({db:e,anchors:oe,regions:Re,symbolStates:y,sourceConstructStates:P,literalHits:V,relations:tt,externalBoundaries:Ct,boundaryFrontiers:ot,regionForFile:me,closureStatus:Mt,omittedSymbolCandidates:Se,maxDepth:f,requestedRelationKinds:s,evidenceFloor:d,includedSourceScopes:c,blindSpots:pn,topologyFrontiers:t.topologyFrontiers??[],routeIds:t.routeIds??[],expandedRegionIds:[...nt],maxTopologyCharacters:x,fullLiteralTraversal:t.fullLiteralTraversal??!1});if(n==="topology")return fe;let mn=(t.behaviorFocusLocations?.length??0)>0?new Set([...fe.anchors.flatMap(u=>u.nodeIds),...fe.paths.flatMap(u=>u.nodeIds)]).size:void 0,rt=Bn(e,fe,{focusLocations:t.behaviorFocusLocations,...mn?{maxSteps:mn}:{}});Kn(e,fe,rt);let ar=os(e,fe,rt,t.behaviorFocusLocations??[]);fe.corridor=bo(fe,{focusLocations:ar});let fn=On(e,fe,rt,{sourceAllowed:m,selectionTerms:t.selectionTerms}),gn=xs(fe),lr=Ls(o,i,f,s,d,c,t.fullLiteralTraversal??!1,x,Re,Lt,sn,nt,gn),dr=Is(o,i,f,Re.filter(u=>gn.has(u.id)),sn,s,d,c,t.fullLiteralTraversal??!1,x);return{anchors:oe,regions:Re,regionRelations:Lt,externalBoundaries:Ct,boundaryFrontiers:ot,unmatchedExpansions:er,expansion:dr,drilldown:an,presentation:lr,topology:fe,behavior:rt,nextAnchors:fn,closure:{status:Mt,emitted:{regions:Re.length,relations:tt.length,runtimeLinks:_.size},withheld:{symbols:ln,files:dn+cn,regions:fe.nodes.filter(u=>u.kind==="structural-region"&&u.disposition==="folded").length,drillAnchors:(an?.omittedAnchors??0)+fn.omittedAnchors,literalMatches:et},ambiguous:{anchors:oe.filter(u=>u.status==="ambiguous").length,omittedSymbolCandidates:Se},external:Ct.length,unresolved:ot.length,explanation:Mt==="accounted"?"Every fact reached under the declared anchors, relations, depth, evidence floor, source scopes, and installed analyzers is accounted for as emitted, withheld, ambiguous, external, or unresolved.":"Some ambiguous symbol candidates were not identified, so the declared query is not fully accounted for."},coverage:{explicitAnchorCount:oe.length,requestedRelationKinds:s,evidenceFloor:d,includedSourceScopes:c,matchedAnchorCount:oe.filter(u=>u.status!=="missing").length,literalSearchesComplete:!0,broadLiteralAnchors:De,withheldLiteralMatches:et,symbolCandidateSetsComplete:Se===0,omittedSymbolCandidates:Se,maxTraversalDepth:f,frontierSymbols:ln,frontierFiles:dn,supportFilesNotTraversed:cn,filteredUnverifiedCallEdges:Zt,memberCallCandidateEdges:en,unresolvedMemberCallsites:tn,runtimeBoundaryEvidenceAvailable:F!==null,runtimeBoundaryObservations:F?.observations.length??0,runtimeBoundaryExactLinks:tr,runtimeBoundaryDerivedLinks:nr,runtimeBoundaryCandidateLinks:or,repositoryRuntimeBoundaryExactLinks:rr,repositoryRuntimeBoundaryDerivedLinks:ir,repositoryRuntimeBoundaryCandidateLinks:sr,runtimeBoundaryTraversedLinks:_.size,runtimeBoundaryFrontiers:ot.length,referenceExpansionEligibleSymbols:un.filter(u=>u.referenceScope!=="none").length,referenceExpansionSkippedSymbols:un.filter(u=>u.referenceScope==="none").length,dynamicDispatchRepresented:F?.links.some(u=>u.joinRule==="carrier.discriminator"&&_.has(u.id))??!1,runtimeGeneratedLinksRepresented:F!==null,regionBoundariesAreStructural:!0,relationFamilies:{"literal-anchor":{evidence:"exact-source",scope:"all indexed documents for each explicit literal",completeWithinScope:!0},reference:{evidence:"compiler-graph",scope:"all cross-file indexed/source-attributed sites for explicit anchors and promoted non-module boundary symbols",completeWithinScope:!0},call:{evidence:"mixed",scope:"static callees plus exact SCIP call occurrences in traversed source ranges, exact constructor-assigned member receivers, and uniquely attributed direct-import member candidates",completeWithinScope:!0},"contract-symbol":{evidence:"compiler-graph",scope:"compiler-resolved symbol identities referenced across inferred workspace boundaries",completeWithinScope:!0},import:{evidence:"compiler-graph",scope:"all indexed or source-resolved imports of traversed primary files",completeWithinScope:!0},"runtime-boundary":{evidence:"exact-source",scope:"direct and mechanically derived links produced by grounded runtime adapters and factorized relation groups",completeWithinScope:!0}},blindSpots:pn}}}function os(e,t,n,o){let i=new Map,s=d=>{i.set(`${d.file}\0${d.line}`,d)};for(let d of o)s(d);let r=new Set(t.anchors.filter(d=>d.status==="matched").flatMap(d=>d.nodeIds));for(let d of n.steps)if(!(!d.location||!r.has(d.nodeId)||(d.behavior?.rawCharacters??1/0)>3e3))for(let c of d.behavior?.lines??[])c.signals.some(l=>ts.has(l))&&s({file:d.location.file,line:c.line,endLine:c.endLine});let a=t.edges.filter(d=>d.disposition==="emitted").flatMap(d=>d.evidence.flatMap(c=>c.location?[c.location]:[]));for(let d of a){s(d);let c=t.nodes.filter(p=>p.location?.file===d.file&&["symbol","source-construct","runtime-boundary-participant"].includes(p.kind)&&p.location.line<=d.line&&(p.location.endLine??p.location.line)>=d.line).sort((p,g)=>(p.location.endLine??p.location.line)-p.location.line-((g.location.endLine??g.location.line)-g.location.line)||p.id.localeCompare(g.id))[0];if(!c?.location)continue;let l=Fn(e,d.file,c.location.line,c.location.endLine??c.location.line,[d.line]);for(let p of l)s({file:d.file,line:p.line,endLine:p.endLine})}return[...i.values()].sort((d,c)=>d.file.localeCompare(c.file)||d.line-c.line)}function rs(e){if(e.ownerStartLine===null||e.ownerStartLine===void 0)throw new Error(`Literal hit ${e.file}:${e.line+1} has no source-owner start line.`);if(e.ownerEndLine===null||e.ownerEndLine===void 0)throw new Error(`Literal hit ${e.file}:${e.line+1} has no source-owner end line.`);return{file:e.file,name:e.ownerShortName??`${e.file}:${e.ownerStartLine+1}`,startLine:e.ownerStartLine,endLine:e.ownerEndLine}}function xe(e){return`${e.file}\0${e.startLine}\0${e.endLine}\0${e.name}`}function se(e){return{file:e.file,name:e.name,startLine:e.startLine,endLine:e.endLine}}function Bo(e,t,n,o){if(n.calleeLeaf===o.leaf)return!0;let i=xn(e,t,n.calleeLeaf);return i!==null&&i.importedName===o.leaf&&i.sourcePath!==null&&Nt(i.sourcePath,o.relativePath)}function xt(e,t){let n=it(Ee(e,t.file)?.callables??[],t.startLine);if(n&&n.endLine>=t.endLine)return{file:t.file,name:/^source@\d+$/u.test(n.name)&&!/^source@\d+$/u.test(t.name)?t.name:n.name,startLine:n.startLine,endLine:n.endLine};let o=Vo(e,t.file,t.startLine);return o&&o.endLine>=t.endLine?{file:t.file,name:o.name,startLine:o.startLine,endLine:o.endLine}:se(t)}function qe(e){return pe("source-construct",e.file,String(e.startLine),String(e.endLine),e.name)}function vt(e,t){let n=vn(e,t.symbol,t.relativePath),o=new Set(["package-surface-file","transitive-package-surface"]),i=n.filter(r=>!o.has(r)||_n(e,t)),s=i.some(r=>!o.has(r));return{evidence:i,priority:s||En(e,t.symbol,t.relativePath)?2:1}}function _o(e,t){let n=vt(e,t);return n.evidence.length>0?n.priority:0}function is(e,t){let n=we(e,t.file),o=n.filter(i=>i.startLine<=t.startLine&&i.endLine>=t.startLine).sort((i,s)=>i.endLine-i.startLine-(s.endLine-s.startLine)||i.startLine-s.startLine);for(let i of o){let s=vt(e,i);if(s.evidence.length>0)return s}for(let i of ss(e,t.file,t.startLine)){let s=n.filter(r=>r.leaf===i.name).sort((r,a)=>Math.abs(r.startLine-i.startLine)-Math.abs(a.startLine-i.startLine)||r.symbol.localeCompare(a.symbol));for(let r of s){let a=vt(e,r);if(a.evidence.length>0)return a}return{evidence:[],priority:0}}return{evidence:[],priority:0}}function ss(e,t,n){let o=Te(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return[];let i=[],s=Jt(o,n);for(;s;){if(s.type==="variable_declarator"||s.type==="function_declaration"||s.type==="generator_function_declaration"||s.type==="class_declaration"){let r=s.childForFieldName("name")??s.namedChild(0);(r?.type==="identifier"||r?.type==="type_identifier")&&i.push({name:r.text,startLine:s.startPosition.row})}s=s.parent}return i}function as(e){return[...new Map([...e.sourceConstructStates.values()].map(t=>xt(e.db,t)).map(t=>[xe(t),t])).values()].sort((t,n)=>t.file.localeCompare(n.file)||t.startLine-n.startLine||t.endLine-n.endLine)}function ls(e,t){return e.anchors.map((n,o)=>{let i=pe("anchor",String(o),n.kind,n.query),s=[...e.symbolStates.values()].filter(l=>l.anchorQueries.has(n.query)).flatMap(l=>{if(!re(l.definition.symbol))return[Me(l.definition.symbol)];let p=t.filter(g=>g.file===l.definition.relativePath).map(g=>qe(g));return p.length>0?p:[Me(l.definition.symbol)]}),r=[...e.sourceConstructStates.values()].filter(l=>l.anchorQueries.has(n.query)).map(l=>qe(xt(e.db,l))),a=e.literalHits.filter(l=>l.query===n.query&&l.traversalSeed===!0&&l.ownerSymbol&&e.symbolStates.has(l.ownerSymbol)).map(l=>Me(l.ownerSymbol)),d=e.literalHits.filter(l=>l.query===n.query&&l.traversalSeed===!0&&!l.ownerSymbol&&l.ownerStartLine!==null&&l.ownerStartLine!==void 0&&l.ownerEndLine!==null&&l.ownerEndLine!==void 0).map(l=>qe(xt(e.db,rs(l)))),c=j(n.kind==="symbol"?[...s,...r]:a.length+d.length>0?[...a,...d]:n.seedRegionIds??[]);return{id:i,kind:n.kind,query:n.query,status:n.status,nodeIds:n.status==="ambiguous"?[]:c,candidateNodeIds:n.status==="ambiguous"?c:[],omittedCandidates:n.omittedSymbolCandidates??0}})}function ds(e){let t=new Map;for(let n of e)for(let o of[...n.nodeIds,...n.candidateNodeIds]){let i=t.get(o)??[];i.push(n.id),t.set(o,i)}return t}function cs(e,t,n){let o=e.relations.flatMap(r=>[r.fromBoundaryParticipant,r.toBoundaryParticipant].flatMap(a=>a?.ownerName?[a]:[])),i=e.regions.map(r=>({id:r.id,kind:"structural-region",label:r.label,disposition:"folded",location:null,anchorIds:j(n.get(r.id)??[]),attributes:{workspace:r.workspace,structuralPath:r.structuralPath,minimumDepth:r.minDepth,files:r.fileCount,symbols:r.symbolCount,expanded:r.expanded}}));for(let r of e.symbolStates.values()){let a=e.regionForFile.get(r.definition.relativePath)?.id;if(!a)throw new Error(`System-map symbol ${r.definition.symbol} has no structural region.`);let d=Me(r.definition.symbol),c=vt(e.db,r.definition);i.push({id:d,kind:"symbol",label:te(r.definition.symbol),disposition:(n.get(d)?.length??0)>0?"emitted":"folded",location:{file:r.definition.relativePath,line:r.definition.startLine,endLine:r.definition.endLine},anchorIds:j(n.get(d)??[]),attributes:{regionId:a,depth:r.depth,leaf:r.definition.leaf??te(r.definition.symbol),referenceScope:r.referenceScope,...c.evidence.length>0?{publicEntry:!0,publicEntryPriority:c.priority,publicEntryEvidence:c.evidence.join(",")}:{}}})}for(let r of t){let a=e.regionForFile.get(r.file)?.id;if(!a)throw new Error(`Source construct ${r.name} has no structural region.`);let d=qe(r),l=o.find(g=>g.file===r.file&&g.line>=r.startLine&&g.line<=r.endLine)?.ownerName??r.name,p=is(e.db,r);i.push({id:d,kind:"source-construct",label:l,disposition:(n.get(d)?.length??0)>0?"emitted":"folded",location:{file:r.file,line:r.startLine,endLine:r.endLine},anchorIds:j(n.get(d)??[]),attributes:{regionId:a,leaf:l,sourceOwned:!0,...p.evidence.length>0?{publicEntry:!0,publicEntryPriority:p.priority,publicEntryEvidence:p.evidence.join(",")}:{}}})}let s=new Map;for(let r of e.relations)r.fromBoundaryParticipant&&s.set(r.fromBoundaryParticipant.observationId,r.fromBoundaryParticipant),r.toBoundaryParticipant&&s.set(r.toBoundaryParticipant.observationId,r.toBoundaryParticipant);for(let r of[...s.values()].sort((a,d)=>a.observationId.localeCompare(d.observationId))){let a=e.regionForFile.get(r.file)?.id;if(!a)throw new Error(`Runtime-boundary participant ${r.observationId} has no structural region.`);i.push({id:Xt(r.observationId),kind:"runtime-boundary-participant",label:r.address||r.ownerName||`${r.role} ${r.action}`,disposition:"folded",location:{file:r.file,line:r.line,endLine:r.endLine},anchorIds:[],attributes:{regionId:a,action:r.action,protocol:r.protocol,role:r.role,...r.address?{address:r.address}:{},ownerSymbol:r.ownerSymbol}})}return i}function us(e,t,n,o,i,s,r,a,d,c=!1){let l=o?Me(o):null;if(l&&t.has(l)&&!re(o))return l;let p=i?Xt(i.observationId):null;if(c&&p&&t.has(p))return p;let g=s?qe(xt(e,s)):null;if(g&&t.has(g))return g;if(p&&t.has(p))return p;let m=d===null?null:(n.get(a)??[]).filter(f=>f.startLine<=d&&f.endLine>=d).sort((f,x)=>f.endLine-f.startLine-(x.endLine-x.startLine)||f.startLine-x.startLine)[0]??null;return m?qe(m):l&&t.has(l)?l:r}function ps(e,t,n){let o=new Set(t.map(c=>c.id)),i=ye(n,c=>c.file),s=(c,l,p,g,m,f,x=!1)=>us(e.db,o,i,c,l,p,g,m,f,x),r=[];for(let c of e.symbolStates.values()){let l=e.regionForFile.get(c.definition.relativePath)?.id;if(!l)continue;let p=Me(c.definition.symbol);r.push({id:pe("edge","structural-membership",l,p),kind:"structural-membership",fromNodeId:l,toNodeId:p,directed:!0,disposition:"folded",semantics:at("structural-membership"),evidence:[{method:"indexed-definition-file",strength:"exact",identity:c.definition.symbol,location:{file:c.definition.relativePath,line:c.definition.startLine,endLine:c.definition.endLine}}]})}let a=ye(e.relations,c=>`${s(c.fromSymbol,c.fromBoundaryParticipant,c.fromSourceConstruct,c.fromRegionId,c.fromFile,c.line,c.kind==="runtime-boundary")}\0${s(c.toSymbol,c.toBoundaryParticipant,c.toSourceConstruct,c.toRegionId,c.toFile,null)}\0${c.kind}`),d=new Set;for(let c of a.values()){let l=c[0],p=s(l.fromSymbol,l.fromBoundaryParticipant,l.fromSourceConstruct,l.fromRegionId,l.fromFile,l.line,l.kind==="runtime-boundary"),g=s(l.toSymbol,l.toBoundaryParticipant,l.toSourceConstruct,l.toRegionId,l.toFile,null);if(l.kind==="runtime-boundary"&&l.fromBoundaryParticipant){let f=Xt(l.fromBoundaryParticipant.observationId),x=s(l.fromSymbol,void 0,l.fromSourceConstruct,l.fromRegionId,l.fromFile,l.line);x!==f&&!d.has(f)&&(d.add(f),r.push({id:pe("edge","boundary-observation",x,f),kind:"boundary-observation",fromNodeId:x,toNodeId:f,directed:!0,disposition:"folded",semantics:at("boundary-observation"),evidence:[{method:"runtime-boundary-observation-owner",strength:l.strength??"unknown",identity:l.fromBoundaryParticipant.observationId,location:{file:l.fromBoundaryParticipant.file,line:l.fromBoundaryParticipant.line,endLine:l.fromBoundaryParticipant.endLine}}]}))}(p===g?t.find(f=>f.id===p):null)?.kind!=="structural-region"&&r.push({id:pe("edge",l.kind,p,g),kind:l.kind,fromNodeId:p,toNodeId:g,directed:!0,disposition:"folded",semantics:zn(l),evidence:vs(c.map(f=>({method:f.evidence,strength:f.strength??"unknown",identity:f.kind==="runtime-boundary"&&f.runtimeBoundaryKey?f.runtimeBoundaryKey:`${f.fromSymbol??f.fromFile} -> ${f.toSymbol??f.toFile}`,location:f.line===null?null:{file:f.fromFile,line:f.line}})))})}return r}function ms(e,t,n){for(let i of e.externalBoundaries){let s=pe("external",i.kind,i.name),r=j(i.fromRegionIds);t.push({id:s,kind:i.kind,label:i.name,disposition:"folded",location:null,anchorIds:[],attributes:{}});for(let a of r)n.push({id:pe("edge",i.kind,a,s),kind:i.kind,fromNodeId:a,toNodeId:s,directed:!0,disposition:"folded",semantics:at("external-import"),evidence:[{method:"indexed-or-source-import",strength:"mixed",identity:`${a} -> ${i.name}`,location:null}]})}let o=[];return e.boundaryFrontiers.forEach((i,s)=>{let r=e.regionForFile.get(i.file)?.id;if(!r)throw new Error(`Runtime-boundary frontier ${i.observationId} has no system-map region.`);let a=pe("unsupported","runtime-boundary",i.observationId,String(s)),d=pe("edge","runtime-boundary-frontier",r,a);t.push({id:a,kind:"runtime-boundary-frontier",label:i.address,disposition:"unsupported",location:{file:i.file,line:i.line},anchorIds:[],attributes:{action:i.action,strength:i.strength,owner:i.ownerShortName}}),n.push({id:d,kind:"runtime-boundary-frontier",fromNodeId:r,toNodeId:a,directed:!0,disposition:"unsupported",evidence:[{method:"runtime-boundary-extractor",strength:i.strength,identity:i.observationId,location:{file:i.file,line:i.line}}]}),o.push({id:pe("frontier","runtime-boundary",i.observationId,String(s)),kind:"runtime-boundary",direction:"unresolved",fromNodeIds:[r],edgeIds:[d],memberNodeIds:[a],memberCount:1,disposition:"unsupported",reason:i.reason,expansion:null})}),o}function fs(e,t){let n=t.topologyFrontiers.some(f=>f==="frontier:program-facts"),o=Po(e,{expandedFrontierIds:t.topologyFrontiers.filter(f=>f!=="frontier:program-facts"),routeIds:t.routeIds}),i=o.nodes.filter(f=>f.disposition==="emitted"||o.anchors.some(x=>x.status==="matched"&&x.nodeIds.includes(f.id))),s=t.relations.filter(f=>i.some(x=>ys(f,x))),r=t.boundaryFrontiers.filter(f=>i.some(x=>Ss(f,x))),a=Zn(t.db,s,i),d=to(t.db,i),c=fo(t.db,i,r),l=[...a.nodes,...d.nodes,...c.nodes].map(f=>n&&f.disposition==="folded"?{...f,disposition:"emitted"}:f),p=[...a.edges,...d.edges,...c.edges].map(f=>n&&f.disposition==="folded"?{...f,disposition:"emitted"}:f),g=n?null:hs(i,l,p),m=ht({anchors:o.anchors,nodes:[...o.nodes,...l],edges:[...o.edges,...p],paths:o.paths,frontiers:[...o.frontiers,...a.frontiers,...d.frontiers,...c.frontiers,...g?[g]:[]],scope:o.coverage.scope,blindSpots:[...o.coverage.blindSpots,...a.blindSpots,...d.blindSpots,...c.blindSpots],incompleteReasons:o.coverage.status==="incomplete"?[o.coverage.explanation]:[],...o.routeCatalog?{routeCatalog:o.routeCatalog}:{}});m.completion=o.completion;for(let f of m.frontiers)f.disposition==="folded"&&(f.id.startsWith("frontier:program-facts:")||(f.expansion=bs(t,f.id)));return m}function gs(e){let t=as(e),n=ls(e,t),o=cs(e,t,ds(n)),i=ps(e,o,t),s=ms(e,o,i);return fs(ht({anchors:n,nodes:o,edges:i,paths:[],frontiers:s,scope:`explicit anchors; relations ${e.requestedRelationKinds.join(", ")}; depth ${e.maxDepth}; evidence floor ${e.evidenceFloor}; source scopes ${e.includedSourceScopes.join(", ")}`,blindSpots:[...e.blindSpots],incompleteReasons:e.closureStatus==="incomplete"?[`${e.omittedSymbolCandidates} ambiguous symbol candidate(s) were omitted`]:[]}),e)}function ys(e,t){if(e.fromSymbol&&t.id===Me(e.fromSymbol)||e.toSymbol&&t.id===Me(e.toSymbol))return!0;if(!t.location)return!1;let n=t.location.endLine??t.location.line;return t.location.file===e.fromFile&&e.line!==null&&e.line>=t.location.line&&e.line<=n||t.location.file===e.toFile}function Ss(e,t){if(!t.location||t.location.file!==e.file)return!1;let n=t.location.endLine??t.location.line;return e.line>=t.location.line&&e.line<=n||t.label===e.ownerShortName||typeof e.ownerShortName=="string"&&t.label.includes(e.ownerShortName)}function hs(e,t,n){let o=j(t.filter(s=>s.disposition==="folded").map(s=>s.id)),i=j(n.filter(s=>s.disposition==="folded").map(s=>s.id));return o.length===0&&i.length===0?null:{id:pe("frontier","program-facts"),kind:"program-facts",direction:"outgoing",fromNodeIds:j(e.map(s=>s.id)),edgeIds:i,memberNodeIds:o,memberCount:o.length,disposition:"folded",reason:"Control, data, state, and temporal facts are folded beneath the selected high-level owners.",expansion:null}}function bs(e,t){return`scip-query system-map ${[...e.anchors.flatMap(o=>o.kind==="literal"?[`--search ${H(o.query)}`]:[`--symbol ${H(o.query)}`]),`--depth ${e.maxDepth}`,...e.requestedRelationKinds.map(o=>`--relation ${H(o)}`),`--evidence-floor ${H(e.evidenceFloor)}`,...e.includedSourceScopes.map(o=>`--source-scope ${H(o)}`),...e.fullLiteralTraversal?["--full-literal-traversal"]:[],`--topology-characters ${e.maxTopologyCharacters}`,...e.expandedRegionIds.map(o=>`--expand ${H(o)}`),...e.topologyFrontiers.map(o=>`--frontier ${H(o)}`),...e.routeIds.map(o=>`--route ${H(o)}`),`--frontier ${H(t)}`].join(" ")}`}function xs(e){let t=new Set;for(let n of e.nodes){if(n.disposition!=="emitted")continue;n.kind==="structural-region"&&t.add(n.id);let o=n.attributes.regionId;typeof o=="string"&&t.add(o)}return t}function vs(e){let t=new Map;for(let n of e){let o=n.location?`${n.location.file}:${n.location.line}`:"";t.set(`${n.method}\0${n.strength}\0${n.identity??""}\0${o}`,n)}return[...t.values()].sort((n,o)=>n.method.localeCompare(o.method)||(n.identity??"").localeCompare(o.identity??"")||(n.location?.file??"").localeCompare(o.location?.file??"")||(n.location?.line??0)-(o.location?.line??0))}function pe(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function Me(e){return pe("symbol",e)}function Es(e){return e==="semantic-callee"||e==="scip-chunk"?"exact":"derived"}function Is(e,t,n,o,i,s,r,a,d,c){let l=[...o].sort((x,b)=>Wo(x,b,i)),g=l.slice(0,$o).map(x=>x.id),m=l.slice($o).map(x=>x.id),f=[...e.map(x=>`--search ${H(x)}`),...t.map(x=>`--symbol ${H(x)}`),`--depth ${n}`,...s.map(x=>`--relation ${H(x)}`),`--evidence-floor ${H(r)}`,...a.map(x=>`--source-scope ${H(x)}`),...d?["--full-literal-traversal"]:[],`--topology-characters ${c}`,...g.map(x=>`--expand ${H(x)}`)];return{command:g.length===0?null:`scip-query system-map ${f.join(" ")}`,regionCount:g.length,regionIds:g,candidateRegionCount:o.length,omittedRegionIds:m}}function Ls(e,t,n,o,i,s,r,a,d,c,l,p,g){let m=[...d].sort((y,P)=>Wo(y,P,l)).filter(y=>!g||g.has(y.id)||p.has(y.id)),f=c.length>0?Math.floor(a*.4):0,x=a-f,b=new Set,k=0;for(let y of m){let P=Oo(y);!p.has(y.id)&&b.size>0&&k+P>x||(b.add(y.id),k+=P)}let B=c.filter(y=>b.has(y.fromRegionId)&&b.has(y.toRegionId)).sort(ws),R=[];for(let y of B){let P=Ko(y);R.length>0&&k+P>a||(R.push(Et(y)),k+=P)}let F=d.filter(y=>!b.has(y.id)).map(y=>y.id).sort(),W=new Set(R),$=c.filter(y=>!W.has(Et(y))).length,_=d.reduce((y,P)=>y+Oo(P),0)+c.reduce((y,P)=>y+Ko(P),0),w=m.every(y=>b.has(y.id))&&R.length===B.length,U=[...e.map(y=>`--search ${H(y)}`),...t.map(y=>`--symbol ${H(y)}`),`--depth ${n}`,...o.map(y=>`--relation ${H(y)}`),`--evidence-floor ${H(i)}`,...s.map(y=>`--source-scope ${H(y)}`),...r?["--full-literal-traversal"]:[],`--topology-characters ${Math.max(a,_)}`];return{maxCharacters:a,estimatedCharacters:k,totalEstimatedCharacters:_,regionIds:[...b],omittedRegionIds:F,relationKeys:R,omittedRelations:$,complete:w,expansionCommand:w?null:`scip-query system-map ${U.join(" ")}`}}function Oo(e){return 120+e.id.length+e.anchorQueries.join(",").length+e.relationKinds.join(",").length+e.notableSymbols.slice(0,2).reduce((t,n)=>t+n.shortName.length+n.file.length,0)}function Ko(e){return 70+e.fromRegionId.length+e.toRegionId.length+e.kinds.join(",").length+e.evidence.join(",").length}function ws(e,t){let n=o=>o.kinds.includes("runtime-boundary")?0:o.kinds.includes("contract-symbol")?1:2;return n(e)-n(t)||t.relationCount-e.relationCount||Et(e).localeCompare(Et(t))}function Et(e){return`${e.fromRegionId}\0${e.toRegionId}`}function Wo(e,t,n){let o=a=>n.has(a.id)?0:1,i=a=>a.sourceFileCount===0?1:0,s=a=>a.symbolCount+a.literalHitCount>0?0:1,r=a=>[...a.incomingRegionIds,...a.outgoingRegionIds].filter(d=>n.has(d)).length;return o(e)-o(t)||s(e)-s(t)||i(e)-i(t)||e.minDepth-t.minDepth||r(t)-r(e)||t.literalHitCount-e.literalHitCount||e.testFileCount-t.testFileCount||e.label.localeCompare(t.label)}function Cs(e){let t=[],n=new Set;for(let i of e.filter(s=>s.expanded)){for(let d of i.symbols)d.origins.includes("symbol-anchor")&&n.add(d.file);let s=ye(i.symbols,d=>d.file),r=ye(i.literalHits,d=>d.file),a=[...i.files].sort((d,c)=>Ns(d,c,s,r));for(let d of a){let c=(s.get(d.file)??[]).sort(jn)[0];if(c){t.push({kind:"symbol",regionId:i.id,file:c.file,line:c.startLine,endLine:c.endLine,label:c.shortName});continue}let l=(r.get(d.file)??[]).sort(Jo)[0];l&&t.push({kind:"literal",regionId:i.id,file:l.file,line:l.line,endLine:null,label:l.ownerShortName??l.query})}}let o=Ms(t,n);return{command:o.length===0?null:`scip-query inspect ${o.map(i=>`--at ${H(`${i.file}:${i.line+1}`)}`).join(" ")} --view behavior`,definitionCommand:null,candidateAnchors:t.length,selectedAnchors:o.length,omittedAnchors:t.length-o.length,anchors:o}}function Ms(e,t){let n=[...ye(e,r=>r.regionId).values()],o=[],i=new Set,s=Math.min(Zi,24);for(let r of e)if(!(!t.has(r.file)||i.has(r.file))&&(o.push(r),i.add(r.file),o.length===s))return o;for(let r=0;o.length<s;r+=1){let a=!1;for(let d of n){let c=d[r];if(c&&(a=!0,!i.has(c.file)&&(o.push(c),i.add(c.file),o.length===s)))break}if(!a)break}return o}function Ns(e,t,n,o){let i=a=>a.kind==="test"?2:a.kind==="barrel"?1:0,s=a=>(o.get(a.file)??[]).some(d=>d.traversalSeed)?0:1,r=a=>{let d=n.get(a.file)??[];return Math.min(5,...d.map(c=>_e(c.origins)))};return i(e)-i(t)||s(e)-s(t)||r(e)-r(t)||e.depth-t.depth||e.file.localeCompare(t.file)}function H(e){return`'${e.replaceAll("'","'\\''")}'`}function Rs(e,t,n,o){let i=[];for(let s of Sn(e,{includeIgnored:!1})){let r=Rt(e,s);if(r.length===0)continue;let a=[];for(let l=0;l<r.length;l+=1){let p=r[l]??"";p.includes(n)&&a.push({line:l,sourceLine:p})}if(a.length===0)continue;let d=t.definitionsForFile(s),c=Ee(e,s)?.callables??[];for(let{line:l,sourceLine:p}of a){let g=Be(d,l),m=it(c,l),f=g&&!re(g.symbol)?g:null,x=f?.startLine??m?.startLine??g?.startLine??l,b=f?.endLine??m?.endLine??g?.endLine??l,k=Dt(e,s,l,x,b),B=o.has(`${s}\0${l}`),R=!!(f?.isFunctionLike||m);i.push({relativePath:s,line:l,sourceLine:p,ownerSymbol:f?.symbol??null,ownerShortName:f?te(f.symbol):m?.name??(g?te(g.symbol):null),ownerStartLine:k.startLine,ownerEndLine:k.endLine,matchKind:ks(p,n),seedPriority:B?0:R?1:2})}}return i}function Ts(e,t){let n={"exact-value":0,boundary:1,embedded:2};return e.seedPriority-t.seedPriority||n[e.matchKind]-n[t.matchKind]||e.relativePath.localeCompare(t.relativePath)||e.line-t.line}function jo(e){return`${e.relativePath}\0${e.line}`}function Vt(e,t,n){let i=it(Ee(e,t)?.callables??[],n)??Vo(e,t,n);if(!i)return null;let s=Dt(e,t,n,i.startLine,i.endLine);return{file:t,name:i.name,startLine:s.startLine,endLine:s.endLine}}function Vo(e,t,n){let o=Te(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return null;let i=Jt(o,n);for(;i;){if(i.type==="variable_declarator"){let r=i.childForFieldName("name")??i.namedChild(0),a=i.childForFieldName("value")??i.namedChild(1);if(r?.type==="identifier"&&a&&Yt(a,n))return{name:r.text,startLine:i.startPosition.row,endLine:i.endPosition.row}}if(i.type==="pair"){let r=i.childForFieldName("key")??i.namedChild(0),a=i.childForFieldName("value")??i.namedChild(1),d=r?.text.replace(/^(?:['"])(.*)(?:['"])$/u,"$1");if(d&&a&&/^[A-Za-z_$][\w$]*$/u.test(d)&&Yt(a,n))return{name:d,startLine:i.startPosition.row,endLine:i.endPosition.row}}i=i.parent}let s=At(e,t,n);return s?{name:`source@${n+1}`,startLine:s.startLine,endLine:s.endLine}:null}function Yt(e,t){return["arrow_function","function_expression","generator_function","generator_function_declaration"].includes(e.type)&&e.startPosition.row<=t&&e.endPosition.row>=t?!0:e.namedChildren.some(n=>n.startPosition.row<=t&&n.endPosition.row>=t&&Yt(n,t))}function Jt(e,t){let n=e.namedChildren.filter(o=>o.startPosition.row<=t&&o.endPosition.row>=t).sort((o,i)=>o.endIndex-o.startIndex-(i.endIndex-i.startIndex)||o.startPosition.row-i.startPosition.row)[0];return n?Jt(n,t):e}function Fs(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/u);if(!n)return null;let o=hn(e,n[1],{allowMultiple:!1})[0]?.relativePath;if(!o)return null;let i=Math.max(0,Number.parseInt(n[2],10)-1),s=n[3]?Math.max(i,Number.parseInt(n[3],10)-1):i,r=(Ee(e,o)?.callables??[]).filter(a=>a.startLine<=i&&a.endLine>=s).sort((a,d)=>a.endLine-a.startLine-(d.endLine-d.startLine)||a.startLine-d.startLine)[0];return r?{file:o,name:r.name,startLine:r.startLine,endLine:r.endLine}:null}function Ps(e){return{symbol:`source-construct:${e.file}:${e.startLine}:${e.endLine}:${e.name}`,shortName:e.name,relativePath:e.file,startLine:e.startLine,endLine:e.endLine}}function ks(e,t){let n=/[\p{L}\p{N}_$]/u,o=e.indexOf(t);for(;o>=0;){let i=e[o-1]??"",s=e[o+t.length]??"";if((i==="'"||i==='"'||i==="`")&&s===i)return"exact-value";if(!n.test(i)&&!n.test(s))return"boundary";o=e.indexOf(t,o+Math.max(1,t.length))}return"embedded"}function Qt(e){return st(e)==="test"?!1:!/(?:^|[/._-])(?:fixtures?|mocks?|previews?|demos?|examples?|stories)(?:[/._-]|$)/iu.test(e)}function $s(e,t){return e.matchKind!=="embedded"&&t(e.relativePath)&&(kt(e.relativePath)!=="production"||Qt(e.relativePath))}function As(e,t){let n=[...t].sort(Ds),o=[],i=new Set;for(let s of n)if(!i.has(s.relativePath)&&(o.push(s),i.add(s.relativePath),o.length>=ko))break;for(let s of n){if(o.length>=ko)break;o.includes(s)||o.push(s)}return o.map(s=>({query:e,file:s.relativePath,line:s.line,ownerSymbol:s.ownerSymbol,ownerShortName:s.ownerShortName,ownerStartLine:s.ownerStartLine,ownerEndLine:s.ownerEndLine,sourceLine:s.sourceLine.trim(),matchKind:s.matchKind,traversalSeed:!1}))}function Ds(e,t){let n={"exact-value":0,boundary:1,embedded:2};return n[e.matchKind]-n[t.matchKind]||+(t.ownerSymbol!==null)-+(e.ownerSymbol!==null)||+!Qt(e.relativePath)-+!Qt(t.relativePath)||e.relativePath.localeCompare(t.relativePath)||e.line-t.line}function Bs(e,t){let n=new Map;for(let o of t){let i=_s(o.relativePath);n.set(i,(n.get(i)??0)+1)}return[...n].sort(([o,i],[s,r])=>r-i||o.localeCompare(s)).slice(0,Ji).map(([o])=>`scip-query search ${H(e)} --scope ${H(o)}`)}function _s(e){let t=e.split("/").filter(Boolean);if(t.length<=1)return e;let n=t.slice(0,-1),o=n.lastIndexOf("src");return o>=0?n.slice(0,Math.min(n.length,o+3)).join("/"):n.slice(0,Math.min(n.length,3)).join("/")}function Os(e,t,n){let o=t.callerFileMap([n],{semantic:!1}).get(n.symbolId)??new Set,i=[];for(let s of[...o].sort()){let r=Tt(e,s).filter(l=>l.importedName===n.leaf&&l.sourcePath!==null&&Nt(l.sourcePath,n.relativePath)),a=new Set;if(r.length>0)for(let l of r)a.add(l.localName??l.importedName);else n.leaf&&a.add(n.leaf);let d=[...new Set([...a].flatMap(l=>Ft(e,s,l)))].sort((l,p)=>l-p);if(d.length===0){i.push({file:s,line:null,enclosingSymbol:null});continue}let c=t.definitionsForFile(s);for(let l of d)i.push({file:s,line:l,enclosingSymbol:Be(c,l)?.symbol??null})}return i}function Ks(e,t){let n=e.all(`SELECT DISTINCT gs.symbol, def_d.relative_path AS from_file
|
|
2
|
-
FROM mentions m
|
|
3
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
-
JOIN documents imp_d ON c.document_id = imp_d.id
|
|
5
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
-
LEFT JOIN (
|
|
7
|
-
SELECT m2.symbol_id, c2.document_id
|
|
8
|
-
FROM mentions m2
|
|
9
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
10
|
-
WHERE m2.role = 1
|
|
11
|
-
GROUP BY m2.symbol_id
|
|
12
|
-
) sym_def ON sym_def.symbol_id = gs.id
|
|
13
|
-
LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
14
|
-
WHERE imp_d.relative_path = ? AND m.role = 2
|
|
15
|
-
ORDER BY def_d.relative_path, gs.symbol`,t);return n.length>0?n.map(o=>({symbol:o.symbol,shortName:te(o.symbol),importedName:qo(te(o.symbol)),localName:qo(te(o.symbol)),fromFile:o.from_file,source:"compiler"})):Tt(e,t).map(o=>{let i=js(o.importedName,o.localName,o.kind),s=o.localName??o.importedName,r=o.importedName==="default"?s:o.importedName;return{symbol:i,shortName:i,importedName:r,localName:s,fromFile:o.sourcePath,source:"parsed-source"}})}function qo(e){return e.slice(e.lastIndexOf(":")+1).replace(/\(\)$/u,"")||e}function js(e,t,n){return n==="namespace"&&e==="*"&&t?`* as ${t}`:n==="default"&&t?`default as ${t}`:n==="side-effect"?"(side effect import)":t&&t!==e?`${e} as ${t}`:e}function Ce(e,t,n){let o=Pt(e,n);if(!o.match)return{matches:[],total:0,omitted:0};let i=[o.match,...o.candidates.map(r=>Pt(e,r.symbol).match)].filter(r=>r!==null),s=new Map;for(let r of i){let a=t.definitionsForFile(r.relativePath).find(d=>d.symbol===r.symbol);a&&s.set(a.symbol,a)}return{matches:[...s.values()],total:o.total,omitted:Math.max(0,o.total-s.size)}}function qs(e){return{symbol:e.symbol,shortName:te(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine}}function ce(e,t){let n=[t.kind,t.fromFile,t.fromSymbol??"",t.toFile,t.toSymbol??"",t.fromBoundaryParticipant?.observationId??"",t.toBoundaryParticipant?.observationId??"",t.fromSourceConstruct?xe(t.fromSourceConstruct):"",t.toSourceConstruct?xe(t.toSourceConstruct):"",t.runtimeBoundaryKey??"",t.line??""].join("\0");e.set(n,t)}function je(e){return{observationId:e.id,action:e.action,protocol:e.protocol,role:e.role,address:Yo(e),file:e.source.file,line:e.source.startLine,endLine:e.source.endLine,ownerName:e.owner.name,ownerSymbol:e.owner.symbol}}function bt(e,t){let n=Rt(e,t.source.file);return kn(e,t.source.file,0,Math.max(0,n.length-1),[t.source.startLine])}function zo(e,t){let n=[...e.values()];for(let o of[t.owner,t.source]){let i=n.filter(s=>s.file===o.file&&s.startLine<=o.startLine&&s.endLine>=o.startLine).sort((s,r)=>s.endLine-s.startLine-(r.endLine-r.startLine)||s.startLine-r.startLine)[0];if(i)return i}return null}function Uo(e,t,n,o,i){let s=[],r=n.get(e.id);r!==void 0&&r<=t&&s.push(r);for(let a of o.values()){if(a.depth>t)continue;let d=a.definition;Go(d,e)&&s.push(a.depth)}for(let a of i.values())a.depth>t||Go(a,e)&&s.push(a.depth);return s.length>0?Math.min(...s):null}function Go(e,t){let n=e.relativePath??e.file;return[t.owner,t.source].some(o=>n===o.file&&e.startLine<=o.startLine&&e.endLine>=o.startLine)}function Xt(e){return pe("runtime-boundary-participant",e)}function zs(e,t,n){let o=ue(e,n),i=ue(t,n);return o.relativeDir!==i.relativeDir?!0:/(?:^|\/)(?:contracts?|schemas?|db\/schema)(?:\/|$)/u.test(t)}function Us(e,t,n){return Ze(e,n).id===Ze(t,n).id}function Gs(e,t,n,o){if(e.referenceScope==="all")return!0;let i=Ze(t,o).id;return[...n.values()].some(r=>r.promoteBoundaryImports&&Ze(r.file,o).id===i)?!0:e.referenceScope!=="cross-workspace-or-forward"?!1:ue(t,o).relativeDir!==ue(e.definition.relativePath,o).relativeDir}function Hs(e,t){let n={none:0,"forward-regions":1,"cross-workspace-or-forward":2,all:3};return n[e]>=n[t]?e:t}function Ws(e,t){let n=Do.get(e);if(n)return n;let o=t.fileDependencyGraph(),i={fileGraph:o,reverseFileGraph:Vs(o),workspaces:Ys(t.sourceFiles()),runtimeBoundaries:Tn(e)};return Do.set(e,i),i}function Vs(e){let t=new Map;for(let[n,o]of e)for(let i of o){let s=t.get(i)??new Set;s.add(n),t.set(i,s)}return t}function ue(e,t){return t.find(n=>e===n.relativeDir||e.startsWith(`${n.relativeDir}/`))??{name:"root",relativeDir:""}}function Ys(e){let t=new Set(["apps","packages","services","crates","libs","tools"]),n=new Map;for(let o of e){let i=o.split("/").filter(Boolean);if(i.length<3||!t.has(i[0]))continue;let s=`${i[0]}/${i[1]}`;n.set(s,{name:i[1],relativeDir:s})}return[...n.values()].sort((o,i)=>i.relativeDir.length-o.relativeDir.length)}function Ze(e,t){let n=ue(e,t),i=(n.relativeDir?e.slice(n.relativeDir.length+1):e).split("/").filter(Boolean);i[0]==="src"&&i.shift();let s=Qs(i);return{id:`region:${n.relativeDir||"root"}:${s}`,label:`${n.name}:${s}`,workspace:n.name,structuralPath:s}}function Qs(e){if(e.length<=1)return"root";let t=e[0],n=e[1];return["components","features","modules"].includes(t)?`${t}/${n}`:t==="db"?`${t}/${n}`:["contracts","routes","services"].includes(t)?t:t==="tests"||t==="__tests__"?"tests":t}function Js(e,t,n,o,i,s,r){let a=ye([...e.values()],m=>s.get(m.file).id),d=ye([...t.values()],m=>s.get(m.definition.relativePath).id),c=ye(n,m=>s.get(m.file).id),l=new Map;for(let m of o)for(let f of new Set([m.fromRegionId,m.toRegionId])){let x=l.get(f)??[];x.push(m),l.set(f,x)}let p=ye(i,m=>m.toRegionId),g=ye(i,m=>m.fromRegionId);return[...a.entries()].map(([m,f])=>{let x=s.get(f[0].file),b=d.get(m)??[],k=c.get(m)??[],B=l.get(m)??[],R=r.has(m),F=b.map(ea).sort(ra).slice(0,Xi),W=f.filter($=>st($.file)==="test").length;return{id:m,label:x.label,workspace:x.workspace,structuralPath:x.structuralPath,minDepth:Math.min(...f.map($=>$.depth)),fileCount:f.length,sourceFileCount:f.length-W,testFileCount:W,symbolCount:b.length,literalHitCount:k.length,anchorQueries:j([...k.map($=>$.query),...b.flatMap($=>[...$.anchorQueries])]),relationKinds:j(B.map($=>$.kind)),incomingRegionIds:j((p.get(m)??[]).map($=>$.fromRegionId)),outgoingRegionIds:j((g.get(m)??[]).map($=>$.toRegionId)),memberCallCandidateRelationCount:B.filter($=>$.evidence==="ast-member-import-candidate").length,notableSymbols:F,omittedNotableSymbols:Math.max(0,b.length-F.length),expanded:R,files:R?f.map(Xs).sort(ia):[],symbols:R?b.map(Zs).sort(sa):[],literalHits:R?[...k].sort(Jo):[],relations:R?[...B].sort(Qo):[]}}).sort((m,f)=>m.minDepth-f.minDepth||m.label.localeCompare(f.label))}function Xs(e){return{file:e.file,kind:st(e.file),depth:e.depth,origins:j([...e.origins])}}function Zs(e){return{symbol:e.definition.symbol,shortName:te(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,depth:e.depth,origins:j([...e.origins]),anchorQueries:j([...e.anchorQueries]),referenceExpansion:e.referenceScope!=="none",referenceScope:e.referenceScope}}function ea(e){return{shortName:te(e.definition.symbol),file:e.definition.relativePath,origins:j([...e.origins])}}function ta(e){return[...ye(e.filter(n=>n.fromRegionId!==n.toRegionId),n=>`${n.fromRegionId}\0${n.toRegionId}`).values()].map(n=>({fromRegionId:n[0].fromRegionId,toRegionId:n[0].toRegionId,kinds:j(n.map(o=>o.kind)),relationCount:n.length,fromFiles:j(n.map(o=>o.fromFile)),toFiles:j(n.map(o=>o.toFile)),fromSymbols:j(n.flatMap(o=>o.fromSymbol?[te(o.fromSymbol)]:[])),toSymbols:j(n.flatMap(o=>o.toSymbol?[te(o.toSymbol)]:[])),evidence:j(n.map(o=>o.evidence)),strengths:j(n.map(o=>o.strength??"unknown"))})).sort((n,o)=>n.fromRegionId.localeCompare(o.fromRegionId)||n.toRegionId.localeCompare(o.toRegionId))}function na(e,t){return[...e.values()].map(n=>({kind:"external-import",name:n.name,fromRegionIds:j([...n.fromFiles].flatMap(o=>{let i=t.get(o);return i?[i.id]:[]})),fromFiles:j([...n.fromFiles])})).sort((n,o)=>n.name.localeCompare(o.name))}function oa(e,t,n,o){let i=e.kind==="literal"?t.filter(s=>s.query===e.query).map(s=>s.file):[...n.values()].filter(s=>s.anchorQueries.has(e.query)).map(s=>s.definition.relativePath);return j(i.map(s=>o.get(s)?.id).filter(s=>!!s))}function Yo(e){return e.keyParts.map(t=>`${t.name}=${t.value}`).join(" ")}function j(e){return[...new Set(e)].sort()}function Qo(e,t){return e.fromRegionId.localeCompare(t.fromRegionId)||e.toRegionId.localeCompare(t.toRegionId)||e.kind.localeCompare(t.kind)||e.fromFile.localeCompare(t.fromFile)||e.toFile.localeCompare(t.toFile)||(e.line??-1)-(t.line??-1)}function ra(e,t){return _e(e.origins)-_e(t.origins)||e.shortName.localeCompare(t.shortName)}function ia(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)}function sa(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)||e.symbol.localeCompare(t.symbol)}function Jo(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.query.localeCompare(t.query)}export{Sl as a,hl as b,Et as c};
|
|
16
|
-
//# sourceMappingURL=chunk-YIEFEPG6.js.map
|
package/dist/chunk-YRVERHJR.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import{a as U}from"./chunk-7TWP3MCP.js";import{p as et}from"./chunk-RGCJ4646.js";import{b as Qe}from"./chunk-35IW3P4H.js";import{A as ce,t as I}from"./chunk-5IZTXSOL.js";import{a as le,f as B,g as $,i as T,j as Ke,k as q,l as Ze,p as We,q as Ye,v as Je,w as V}from"./chunk-I3U2FN2T.js";import{A as Ge,C as R,F as Xe,M as X,z as ue}from"./chunk-AA7K3XLM.js";import{c as J,x as j}from"./chunk-DMQ7ZKJG.js";function de(e){let t=e.replaceAll("\\","/");return Qe(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}import Mt from"better-sqlite3";var me="scip_query_runtime_boundaries",H="scip_query_runtime_observations",fe="scip_query_runtime_relation_groups",ye="scip_query_runtime_relation_participants";function Vt(e,t){let n=new Mt(e);try{n.exec(`
|
|
2
|
-
CREATE TABLE IF NOT EXISTS ${me} (
|
|
3
|
-
singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
|
|
4
|
-
schema_version INTEGER NOT NULL,
|
|
5
|
-
extractor_version TEXT NOT NULL,
|
|
6
|
-
payload TEXT NOT NULL
|
|
7
|
-
)
|
|
8
|
-
`),zt(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${me} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${H}`).run(),n.prepare(`DELETE FROM ${ye}`).run(),n.prepare(`DELETE FROM ${fe}`).run();let r=n.prepare(`INSERT INTO ${H}
|
|
9
|
-
(id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
|
|
10
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let a of t.observations)r.run(a.id,a.protocol,a.action,a.role,a.strength,a.sourceScope,a.resolution,a.source.file,a.source.startLine,a.source.endLine,a.owner.symbol,JSON.stringify(a));let i=n.prepare(`INSERT INTO ${fe} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),o=n.prepare(`INSERT INTO ${ye} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let a of t.relationGroups){i.run(a.id,a.protocol,a.joinRule,a.normalizedKey,JSON.stringify(a));for(let s of a.producerIds)o.run(a.id,s,"producer");for(let s of a.consumerIds)o.run(a.id,s,"consumer");for(let s of a.declarationIds)o.run(a.id,s,"declaration")}})()}finally{n.close()}}function jt(e,t={}){if(!qt(e,H))return tt(e)?.observations??[];let n=[],r=[];return pe(n,r,"protocol",t.protocols),pe(n,r,"action",t.actions),pe(n,r,"source_scope",t.sourceScopes),pe(n,r,"file",t.files),e.all(`SELECT payload FROM ${H}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(o=>Ut(o.payload))}function zt(e){e.exec(`
|
|
11
|
-
CREATE TABLE IF NOT EXISTS ${H} (
|
|
12
|
-
id TEXT PRIMARY KEY,
|
|
13
|
-
protocol TEXT NOT NULL,
|
|
14
|
-
action TEXT NOT NULL,
|
|
15
|
-
role TEXT NOT NULL,
|
|
16
|
-
strength TEXT NOT NULL,
|
|
17
|
-
source_scope TEXT NOT NULL,
|
|
18
|
-
resolution TEXT NOT NULL,
|
|
19
|
-
file TEXT NOT NULL,
|
|
20
|
-
start_line INTEGER NOT NULL,
|
|
21
|
-
end_line INTEGER NOT NULL,
|
|
22
|
-
owner_symbol TEXT,
|
|
23
|
-
payload TEXT NOT NULL
|
|
24
|
-
);
|
|
25
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_observations_protocol_action_scope
|
|
26
|
-
ON ${H}(protocol, action, source_scope);
|
|
27
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_observations_file_line
|
|
28
|
-
ON ${H}(file, start_line);
|
|
29
|
-
|
|
30
|
-
CREATE TABLE IF NOT EXISTS ${fe} (
|
|
31
|
-
id TEXT PRIMARY KEY,
|
|
32
|
-
protocol TEXT NOT NULL,
|
|
33
|
-
join_rule TEXT NOT NULL,
|
|
34
|
-
normalized_key TEXT NOT NULL,
|
|
35
|
-
payload TEXT NOT NULL
|
|
36
|
-
);
|
|
37
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_groups_protocol_key
|
|
38
|
-
ON ${fe}(protocol, join_rule, normalized_key);
|
|
39
|
-
|
|
40
|
-
CREATE TABLE IF NOT EXISTS ${ye} (
|
|
41
|
-
group_id TEXT NOT NULL,
|
|
42
|
-
observation_id TEXT NOT NULL,
|
|
43
|
-
participant_role TEXT NOT NULL,
|
|
44
|
-
PRIMARY KEY (group_id, observation_id, participant_role)
|
|
45
|
-
);
|
|
46
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_participants_observation
|
|
47
|
-
ON ${ye}(observation_id, participant_role);
|
|
48
|
-
`)}function qt(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function pe(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function Ut(e){try{return[JSON.parse(e)]}catch{return[]}}function tt(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",me))return null;let n=e.get(`SELECT schema_version, payload FROM ${me} 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 At}from"crypto";import{createHash as ln}from"crypto";var he=8;function Z(e,t,n){return $e(nt(e,t,Re(n),0,new Set))}function Ee(e,t,n){return Be(e,t,n,0,new Set)}function nt(e,t,n,r,i){if(r>he)return[];let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return o?rt(e,t,o[1],o[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?it(e,t,n,r,i):[]}function rt(e,t,n,r,i,o){let a=[];for(let s of Be(e,t,n,i+1,new Set(o))){let l=T(s.initializer);for(let u of l.namedChildren){if(u.type==="pair"){let c=u.childForFieldName("key")??u.namedChild(0);if(Zt(c)!==r)continue;let d=u.childForFieldName("value")??u.namedChild(1);d&&a.push(...nt(e,s.definition.relativePath,Re(d.text),i+1,new Set(o)));continue}if(/(?:method|function)/u.test(u.type)){if((u.childForFieldName("name")??u.namedChild(0))?.text!==r)continue;let d=Kt(e,s.definition.relativePath,r,u);a.push(...d.length>0?d:[Ht(s.definition,r,u)]);continue}if(u.type==="spread_element"){let c=u.namedChild(0);if(!c)continue;for(let d of Be(e,s.definition.relativePath,Re(c.text),i+1,new Set(o)))a.push(...rt(e,d.definition.relativePath,d.definition.leaf,r,i+1,new Set(o)))}}}return $e(a)}function Ht(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function Be(e,t,n,r,i){return r>he||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:it(e,t,n,r,i).flatMap(o=>{let a=R(e,o.relativePath)?.rootNode,s=a?Xt(a,o.leaf):null;return s?[{definition:o,initializer:s}]:[]})}function it(e,t,n,r,i){if(r>he)return[];let o=`${t}\0${n}`;if(i.has(o))return[];i.add(o);let a=I(e,t).filter(u=>u.leaf===n);if(a.length>0)return a;let s=Gt(e,t,n);if(s.length>0)return s;let l=V(e,t).find(u=>u.localName===n&&u.sourcePath);if(l?.sourcePath){let u=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return Fe(e,l.sourcePath,u,r+1,new Set(i))}return Fe(e,t,n,r+1,new Set(i))}function Gt(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(Ze(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 Fe(e,t,n,r,i){if(r>he)return[];let o=I(e,t).filter(a=>a.leaf===n);return o.length>0?o:$e(Je(e,t).flatMap(a=>a.sourcePath?a.kind==="named"&&!a.names.includes(n)?[]:Fe(e,a.sourcePath,n,r+1,new Set(i)):[]))}function Kt(e,t,n,r){return I(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Xt(e,t){let n=null;return B(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Zt(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Re(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function $e(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}var Wt=8;function L(e,t){return t?W(e,t,0,new Set):null}function W(e,t,n,r){if(n>Wt)return A(t,"value-evaluation-depth");let i=T(t),o=nn(i);if(o)return rn(e.file,i,o.term,o.value,o.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(u=>W(e,u,n+1,new Set(r)));if(l.length>=2&&l.every(u=>u!==null)){let u={kind:"concat",parts:l.map(d=>d.term)},c=l.map(d=>d.value).join("");return on(e.file,i,u,c,l.some(d=>d.precision!=="literal")?"constrained-pattern":"literal",l)}}let a=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(a))return en(e,a,i,n,r);let s=an(i);return s?tn(e,s.base,s.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Yt(e,i,n,r):A(i,`unsupported-expression:${i.type}`)}function Yt(e,t,n,r){let o=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",a=Jt(e,o);if(a.length!==1)return A(t,a.length===0?"call-target-unresolved":"call-target-ambiguous");let s=a[0],l=`${s.relativePath}\0${s.symbol}`;if(r.has(l))return A(t,"call-return-cycle");let u=R(e.db,s.relativePath)?.rootNode;if(!u)return A(t,"call-target-unparsed");let c=$(u,s.startLine,s.endLine);if(!c)return A(t,"call-target-syntax-unavailable");let d=Qt(c);if(!d)return A(t,"call-return-not-single-expression");let p=new Set(r);p.add(l);let m=W({db:e.db,file:s.relativePath,root:u},d,n+1,p);return m?ge(t,"bounded-call-return",m,s.symbol):A(t,"call-return-unresolved")}function Jt(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=I(e.db,e.file).filter(a=>a.isFunctionLike&&a.leaf===t);if(i.length>0)return i;let o=V(e.db,e.file).find(a=>a.localName===t&&a.sourcePath&&a.kind!=="namespace");return o?.sourcePath?U(e.db,o.sourcePath,o.importedName==="default"?t:o.importedName).filter(a=>a.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=V(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?U(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function Qt(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return ot(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function ot(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)ot(e,r,n)}}function en(e,t,n,r,i){let o=`${e.file}\0${t}`;if(i.has(o))return A(n,"value-cycle");i.add(o);let a=Te(e.root,t);if(a){let y=W(e,a,r+1,i);return y?ge(n,"local-constant",y):A(n,"non-foldable-local")}let s=V(e.db,e.file).find(y=>y.localName===t&&y.sourcePath);if(!s?.sourcePath)return k(n,t,"unresolved-identifier");if(s.kind==="namespace")return k(n,t,"namespace-import-requires-property");let l=s.importedName==="default"?t:s.importedName,u=U(e.db,s.sourcePath,l);if(u.length!==1)return k(n,t,u.length===0?"import-definition-missing":"import-definition-ambiguous");let c=u[0],d=R(e.db,c.relativePath)?.rootNode;if(!d)return k(n,c.symbol,"import-definition-unparsed");let p=Te(d,c.leaf);if(!p)return k(n,c.symbol,"import-definition-non-value");let m=W({db:e.db,file:c.relativePath,root:d},p,r+1,i);return m?ge(n,"imported-constant",m,c.symbol):k(n,c.symbol,"import-value-unresolved")}function tn(e,t,n,r,i,o){let a=V(e.db,e.file).find(m=>m.localName===t&&m.sourcePath),s=e.file,l=t,u;if(a?.sourcePath){a.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=a.importedName==="default"?t:a.importedName;let m=U(e.db,a.sourcePath,l);if(m.length!==1)return k(r,`${t}.${n.join(".")}`,m.length===0?"member-definition-missing":"member-definition-ambiguous");s=m[0].relativePath,l=m[0].leaf,u=m[0].symbol}let c=s===e.file?e.root:R(e.db,s)?.rootNode;if(!c)return k(r,u??t,"member-definition-unparsed");let d=Te(c,l);if(!d)return k(r,u??t,"member-base-non-value");for(let m of n){let y=T(d);if(d=sn(y,m),!d)return k(r,u??`${t}.${n.join(".")}`,`member-property-missing:${m}`)}let p=W({db:e.db,file:s,root:c},d,i+1,o);return p?ge(r,"member-constant",p,u):k(r,u??t,"member-value-unresolved")}function nn(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],o=0,a=/\$\{([^}]*)\}/gu;for(let s of r.matchAll(a)){let l=s.index??0;l>o&&i.push({kind:"literal",value:r.slice(o,l)}),i.push({kind:"unknown",reason:`template-hole:${s[1]?.trim()||"expression"}`}),o=l+s[0].length}return o<r.length&&i.push({kind:"literal",value:r.slice(o)}),{term:{kind:"pattern",language:"template",value:r.replace(a,"{}")},value:r.replace(a,"{}"),precision:"constrained-pattern"}}function rn(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:ve("direct-literal","direct",e,t)}}function on(e,t,n,r,i,o){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...ve("constant-concatenation","mechanically-derived",e,t),inputFactIds:o.flatMap(a=>a.derivation.inputFactIds),sourceSpans:o.flatMap(a=>a.derivation.sourceSpans)}}}function ge(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 k(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:ve(n,"heuristic","",e)}}function A(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:ve(t,"heuristic","",e)}}function ve(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 an(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}function Te(e,t){let n=null;return B(e,r=>{if(n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t)return;let o=r.parent;!o||o.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(o.text)||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function sn(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}var mt=new Set(["delete","get","head","options","patch","post","put"]),un=/(?:^|\.)(?:app|router|server)$/u,cn=new Set(["findFirst","findMany","findUnique","from","get","select"]),dn=new Set(["create","delete","insert","remove","update","upsert"]),pn=new Set(["execute","query","raw"]),at=/(?:\b(?:name|id)|['"`](?:name|id)['"`])\s*:/u,st=/(?:^\s*|[,{]\s*)(?:async\s+)?['"`]?(?:execute|handler|invoke|run)['"`]?\s*(?::|\([^)]*\)\s*\{)/mu,lt=/\b[A-Za-z_$][\w$-]*[_-][\w$-]*\s*\(/u,ut=/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s+[A-Za-z_$][\w$-]*\s*\(/iu,_e=[hn(),yn(),mn(),gn(),bn(),Sn(),Nn()],Le=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function mn(){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=fn(e.source),n=[];return z(e.root,"call_expression",r=>{let i=ne(r);if(!i)return;let o=t.direct.get(i),a=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),s=a&&t.namespaces.has(a[1])?a[2]:null,l=o??s;if(!l||!Le.has(l))return;let u=G(r),c=E(u[0],e)??{value:u[0]?.text.trim()||"<missing>",evidence:"expression"},d=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(x(e,r,"builtin.node-child-process",d,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...c}],"exact","node-child-process-import"))}),n}}}function fn(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let l of e.matchAll(i))for(let u of(l[1]??"").split(",")){let c=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(u);c&&Le.has(c[1])&&t.set(c[2]??c[1],c[1])}let o=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(o))for(let u of(l[1]??"").split(",")){let c=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(u);c&&Le.has(c[1])&&t.set(c[2]??c[1],c[1])}let a=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(a))n.add(l[1]);let s=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(s))n.add(l[1]);return{direct:t,namespaces:n}}function N(e,t,n,r){let i=Q(r,"runtime-boundaries.context.ast",t,()=>R(e,t)?.rootNode);if(!i)return null;let o=n??j(e,t),a,s,l,u=()=>(s!==void 0||(s=Q(r,"runtime-boundaries.context.callable-sites",t,()=>{let c=ue(t);return(c?Ye(i,c):null)??We(e,t)})),s);return{db:e,file:t,source:o,root:i,get constants(){return l??=Q(r,"runtime-boundaries.context.constants",t,()=>Fn(i)),l},ownerAt:c=>{let p=(a??=Q(r,"runtime-boundaries.context.definitions",t,()=>I(e,t,{rangeCorrectionEvidence:{source:o,callables:u()}},(f,h)=>Q(r,`runtime-boundaries.context.definitions.${f}`,t,h)))).filter(f=>f.startLine<=c&&f.endLine>=c).sort((f,h)=>f.endLine-f.startLine-(h.endLine-h.startLine)||f.startLine-h.startLine)[0];if(p)return{file:t,symbol:p.symbol,name:p.leaf,startLine:p.startLine,endLine:p.endLine};let y=(u()??[]).filter(f=>f.startLine<=c&&f.endLine>=c).sort((f,h)=>f.endLine-f.startLine-(h.endLine-h.startLine)||f.startLine-h.startLine)[0];return{file:t,symbol:null,name:y?.name??null,startLine:y?.startLine??c,endLine:y?.endLine??c}}}}function Q(e,t,n,r){return e?e(t,r,{file:n}):r()}function yn(){return{id:"builtin.effect-httpapi",supports:e=>ee(e,"HttpApiEndpoint").size>0||ee(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=ee(e.source,"HttpApiEndpoint"),r=ee(e.source,"HttpApiGroup"),i=ee(e.source,"HttpApiBuilder");return z(e.root,"call_expression",o=>{let a=ft(o);if(!a)return;let s=G(o);if(n.has(a.receiver)&&mt.has(a.member)){let f=E(s[0],e),h=E(s[1],e),C=dt(o,r,"make",0,e);if(!f||!h||!C)return;let F=a.member.toUpperCase();t.push(x(e,o,"builtin.effect-httpapi","http.handle",[{name:"method",value:F,evidence:"literal"},{name:"path",...h}],O([{name:"path",...h}]),"effect-httpapi-endpoint-declaration")),t.push(x(e,o,"builtin.effect-httpapi","framework.declare",ke(C,f),O(ke(C,f)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(a.member))return;let l=dt(o,i,"group",1,e),u=E(s[0],e),c=s[1];if(!l||!u||!c)return;let d=ke(l,u),p=Z(e.db,e.file,c.text),m=x(e,o,"builtin.effect-httpapi","framework.handle",d,p.length===1?O(d):"candidate","effect-httpapi-handler-registration"),y=p[0];p.length===1&&y&&(m.owner={file:y.relativePath,symbol:y.symbol,name:y.leaf,startLine:y.startLine,endLine:y.endLine}),t.push(m)}),t}}}function ke(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function ee(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(r)){let a=o[2]??"";if(ct(a))for(let s of(o[1]??"").split(",")){let l=s.trim().replace(/^type\s+/u,""),u=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(l);u?.[1]===t&&n.add(u[2]??u[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(i)){let a=o[2]??"";a.endsWith(`/${t}`)&&ct(a)&&n.add(o[1])}return n}function ct(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function dt(e,t,n,r,i){let o=e.parent;for(;o;){if(o.type==="call_expression"){let a=pt(o,t,n,r,i);if(a)return a;let s=o.childForFieldName("function")??o.namedChild(0),l=null;if(s&&Oe(s,u=>{!l&&u.type==="call_expression"&&(l=pt(u,t,n,r,i))}),l)return l}o=o.parent}return null}function pt(e,t,n,r,i){let o=ft(e);return!o||o.member!==n||!t.has(o.receiver)?null:E(G(e)[r],i)}function ft(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 hn(){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)||te(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return z(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||!te(e.source,["fastapi","flask"]))return;t.push(x(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=ne(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",o=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",a=G(n);if(i==="route"&&te(e.source,["axum"])){let p=E(a[0],e),m=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(a[1]?.text??"")?.[1];if(!p||!m)return;t.push(x(e,n,"builtin.http","http.handle",[{name:"method",value:m.toUpperCase(),evidence:"literal"},{name:"path",...p}],O([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=E(a[0],e);if(!p)return;let y=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(a[1]?.text??"")?.[1]?.toUpperCase()??(a[1]?null:"GET"),f=[...y?[{name:"method",value:y,evidence:"literal"}]:[],{name:"path",...p}];t.push(x(e,n,"builtin.http","http.request",f,y?O(f):"candidate","call-expression"));return}if(!mt.has(i))return;let s=E(a[0],e);if(!s)return;let l=i.toUpperCase();if(un.test(o)&&te(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(x(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],O([{name:"path",...s}]),"framework-adapter"));return}let c=wn(e.source,["axios"]),d=o.split(".")[0]??"";c.has(d)&&t.push(x(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],O([{name:"path",...s}]),"client-adapter"))}),t}}}function gn(){return{id:"builtin.capability-registry",supports:e=>at.test(e)&&st.test(e)||lt.test(e)||ut.test(e),extract:e=>{let t=[],n=new Set,r=[];return at.test(e.source)&&st.test(e.source)&&r.push("pair"),(lt.test(e.source)||ut.test(e.source))&&r.push("string","string_literal","template_string"),z(e.root,r,i=>{if(i.type==="pair"){let a=i.childForFieldName("key")??i.namedChild(0),s=i.childForFieldName("value")??i.namedChild(1),l=a?.text.replace(/^['"`]|['"`]$/gu,"");if(l!=="name"&&l!=="id")return;let u=yt(s,e),c=En(i);if(!u||u.evidence!=="literal"||!c)return;let d=`handle\0${u.value}\0${c.startPosition.row}`;if(n.has(d))return;n.add(d),t.push(x(e,c,"builtin.capability-registry","registry.handle",[{name:"key",...u}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(i.type))return;let o=i.text.replace(/^['"`]|['"`]$/gu,"");for(let a of o.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let s=a[1];if(!vn(o,s,a.index))continue;let l=`reference\0${s}\0${i.startPosition.row}`;n.has(l)||(n.add(l),t.push(x(e,i,"builtin.capability-registry","registry.reference",[{name:"key",value:s,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function vn(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 bn(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return z(e.root,["pair","call_expression"],n=>{if(n.type==="pair"){let o=Rn(n);if(!o)return;let a=n.childForFieldName("key")??n.namedChild(0),s=n.childForFieldName("value")??n.namedChild(1),l=yt(a,e);if(!l||!s||!ht(s))return;let u=Ae(s)?"exact":"candidate";t.push(x(e,n,"builtin.registry","registry.handle",[{name:"registry",value:o,evidence:"identifier"},{name:"key",...l}],O([{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(x(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function Sn(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=Tn(e.root);return z(e.root,"call_expression",r=>{let i=ne(r);if(!i)return;let o=i.split("."),a=o.at(-1)??"",s=G(r),l=s[0]?.text??"",u=$n(a,l);if(!u)return;let c=gt(o,n);if(!c)return;let d=xn(s[0],e)??kn(l),p=Ln(c,o,a,d);if(!p)return;let m=a==="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(x(e,r,"builtin.persistence",u,[{name:"resource",...p}],O([{name:"resource",...p}]),m))}),t}}}function xn(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:E(e,t)}function Nn(){return{id:"builtin.queue",supports:e=>te(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return z(e.root,"call_expression",n=>{let r=ne(n);if(!r)return;let i=r.split(".").at(-1)??"",o=G(n),a=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!a)return;let s=i==="send"||i==="subscribe"?Pn(o[0],"topic",e):E(o[0],e);s&&t.push(x(e,n,"builtin.queue",a,[{name:"address",...s}],O([{name:"address",...s}]),"framework-adapter"))}),t}}}function x(e,t,n,r,i,o,a){let s=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${ln("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:s,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:a,strength:o,protocol:r.split(".")[0]??r,role:Cn(r),executionDomain:In(e.file),derivation:{kind:o==="candidate"?"heuristic":o==="derived"?"mechanically-derived":"direct",rule:a,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:de(e.file)}}function Cn(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 In(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function te(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 wn(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),o=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 a of e.matchAll(o)){let s=a[1]??a[2];s&&n.add(s)}}return n}function be(e,t,n,r,i,o,a){return x(e,t,n,r,i,o,a)}function ne(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function G(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function E(e,t){let n=L(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function Pn(e,t,n){if(!e)return null;let r=e.namedChildren.find(o=>o.type!=="pair"?!1:(o.childForFieldName("key")??o.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return E(i,n)}function yt(e,t){if(!e)return null;let n=E(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 O(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function Bn(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function Fn(e){let t=new Map;return Oe(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 o=Bn(i);o!==null&&t.set(r.text,o)}),t}function Rn(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function Ae(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function ht(e){return Ae(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function En(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),o=n.childForFieldName("value")??n.namedChild(1),a=i?.text.replace(/^['"`]|['"`]$/gu,"");if(a&&["execute","handler","invoke","run"].includes(a)&&o&&ht(o))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 gt(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 $n(e,t){if(cn.has(e))return"database.read";if(dn.has(e))return"database.write";if(!pn.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 Tn(e){let t=new Set;return z(e,"call_expression",n=>{let r=ne(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!gt(i)))for(let o of G(n)){if(!Ae(o))continue;let s=(o.childForFieldName("parameters")??o.namedChildren.find(u=>/parameters/u.test(u.type)))?.namedChildren[0],l=s?Ke(s):null;l&&t.add(l)}}),t}function kn(e){let t=vt(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function Ln(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let o=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return o?{value:o,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=vt(r.value);return i?{value:i,evidence:r.evidence}:null}function vt(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function Oe(e,t){t(e);for(let n of e.namedChildren)Oe(n,t)}function z(e,t,n){for(let r of e.descendantsOfType(t))n(r)}var _n=J("resolved-call-syntax",{clearGroups:[]}),An=J("resolved-call-sites",{clearGroups:[]});function re(e,t){return An.get(e,t.symbolId,()=>On(e,t))}function On(e,t){let n=[],r=[],i=new Set,o=new Set;for(let a of et(e,t,{semantic:!1})){i.add(a.file);let s=_n.get(e,a.file,()=>Dn(e,a.file));if(!s){r.push({callee:t,file:a.file,line:a.line,reason:"ast-unavailable",candidates:0,referenceProvenance:a.provenance});continue}let l=(s.byLeaf.get(t.leaf)??[]).filter(({callNode:d})=>d.startPosition.row<=a.line&&d.endPosition.row>=a.line);if(l.length!==1){r.push({callee:t,file:a.file,line:a.line,reason:l.length===0?"call-not-found":"ambiguous-call",candidates:l.length,referenceProvenance:a.provenance});continue}let u=l[0],c=`${a.file}\0${u.callNode.startIndex}\0${u.callNode.endIndex}`;o.has(c)||(o.add(c),n.push({callee:t,caller:ce(I(e,a.file),u.callNode.startPosition.row),file:a.file,line:a.line,startLine:u.callNode.startPosition.row,endLine:u.callNode.endPosition.row,targetText:u.targetNode.text,callNode:u.callNode,targetNode:u.targetNode,arguments:u.arguments,referenceProvenance:a.provenance}))}return{sites:n,unresolved:r,filesVisited:i.size}}function Dn(e,t){let n=R(e,t)?.rootNode;if(!n)return null;let r=new Map;return bt(n,i=>{if(i.type!=="call_expression"&&i.type!=="call")return;let o=i.childForFieldName("function")??i.namedChild(0);if(!o)return;let a=Xe(o);if(!a)return;let s=i.childForFieldName("arguments")??i.namedChildren.find(c=>c.type==="arguments"),l={callNode:i,targetNode:o,arguments:s?.namedChildren??[]},u=r.get(a);u?u.push(l):r.set(a,[l])}),{byLeaf:r}}function bt(e,t){t(e);for(let n of e.namedChildren)bt(n,t)}var Mn=J("call-parameter-value-flow",{clearGroups:[]});function ie(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return Mn.get(e,n,()=>Vn(e,t))}function oe(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 Vn(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=R(e,t.caller.relativePath)?.rootNode,i=r?$(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 o=q(i),a=[],s=[];return t.arguments.forEach((l,u)=>{let c=l.text.trim(),d=o.indexOf(c);d>=0?a.push({calleePosition:u,callerPosition:d,argumentText:c,proof:n}):s.push({calleePosition:u,argumentText:c,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:a,unknown:s}}var jn=8,zn=8;function xt(e,t){let n=[],r=qn(e,n),i=r.summaries,o=Un(e,t,i,n),a=Hn(e,t,n);return{observations:nr([...o.observations,...a]),bodySummaries:i.size,discriminatorSummaries:o.summaries,filesInspected:r.filesInspected,errors:n}}function qn(e,t){let n=new Map,r=[],i=X(e);for(let o of i){let a=j(e,o);if(!/\bJSON\.stringify\s*\(/u.test(a)||!/\bbody\s*:/u.test(a))continue;let s=N(e,o);if(s)for(let[l,u]of Gn(s)){let c={definition:l,parameterIndexes:u,depth:0,proofSpans:[{file:o,startLine:l.startLine,endLine:l.endLine}]};n.set(l.symbol,c),r.push(c)}}for(;r.length>0;){let o=r.shift();if(!(o.depth>=jn))try{for(let a of re(e,o.definition).sites){if(!N(e,a.file))continue;let l=a.caller;if(!l)continue;let u=oe(ie(e,a),o.parameterIndexes);if(u.length===0)continue;let c={definition:l,parameterIndexes:Pt(u),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:a.file,startLine:a.startLine,endLine:a.endLine}]};Wn(n,c)&&r.push(n.get(l.symbol))}}catch(a){t.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${Ve(a)}`)}}return{summaries:n,filesInspected:i.length}}function Un(e,t,n,r){let i=new Map,o=[],a=[];for(let s of t){if(s.action!=="http.request"||s.strength==="candidate"||s.sourceScope!=="production")continue;let l=Nt(s);if(!l)continue;let u=N(e,s.source.file);if(!u)continue;let c=Ct(u.root,s.source.startLine),d=c.find(F=>F.startPosition.row===s.source.startLine)??c[0];if(!d)continue;let p=Me(d);if(!p)continue;let m=Z(e,s.source.file,p.text);if(m.length!==1)continue;let y=n.get(m[0].symbol);if(!y)continue;let f=s.owner.symbol?I(e,s.owner.file).find(F=>F.symbol===s.owner.symbol):null;if(!f)continue;let h=Yn(u,f),C=Se(d);for(let F of y.parameterIndexes){let D=Qn(u,C[F]);if(D)for(let v of er(D)){let w=It(v),_=wt(v);if(!w||!_)continue;let M=h.indexOf(_.text.trim());if(M>=0){let P={definition:f,carrier:l,field:w,parameterIndex:M,depth:0,proofObservationIds:[s.id],proofSpans:[s.source,{file:s.source.file,startLine:v.startPosition.row,endLine:v.endPosition.row}]},S=St(P);i.has(S)||(i.set(S,P),o.push(P));continue}let b=L(u,_);!b||b.evidence==="expression"||a.push(De(u,v,"carrier.publish",l,w,b.value,[s.id]))}}}for(;o.length>0;){let s=o.shift();if(!(s.depth>=zn))try{for(let l of re(e,s.definition).sites){let u=N(e,l.file);if(!u)continue;let c=l.callNode,d=Se(c)[s.parameterIndex];if(!d)continue;let p=L(u,d);p&&p.evidence!=="expression"&&a.push(De(u,c,"carrier.publish",s.carrier,s.field,p.value,s.proofObservationIds));let m=l.caller;if(!m)continue;let y=ie(e,l).transfers.find(C=>C.calleePosition===s.parameterIndex)?.callerPosition;if(y===void 0)continue;let f={...s,definition:m,parameterIndex:y,depth:s.depth+1,proofSpans:[...s.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},h=St(f);i.has(h)||(i.set(h,f),o.push(f))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${s.definition.relativePath}: ${Ve(l)}`)}}return{observations:a,summaries:i.size}}function Hn(e,t,n){let r=[],i=t.filter(o=>o.action==="registry.handle"&&o.strength!=="candidate"&&o.sourceScope==="production");for(let o of t){if(o.action!=="http.handle"||o.strength==="candidate"||o.sourceScope!=="production")continue;let a=Nt(o);if(!a)continue;let s=N(e,o.source.file);if(!s)continue;let l=Ct(s.root,o.source.startLine)[0];if(l)for(let u of Se(l).slice(1)){let c=Z(e,o.source.file,u.text);for(let d of c)try{let p=N(e,d.relativePath);if(!p)continue;let m=$(p.root,d.startLine,d.endLine);if(!m)continue;B(m,y=>{if(y.type!=="call_expression")return;let f=Me(y);if(!f)return;let h=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(f.text.trim());if(!h)return;let C=h[1],F=h[2],D=Xn(e,p,d,F);if(!D)return;let v=Zn(e,d.relativePath,C);for(let w of i){let _=w.keyParts.find(S=>S.name==="registry")?.value,M=w.keyParts.find(S=>S.name==="key")?.value;if(!_||!M||!v.some(S=>S.file===w.source.file&&S.binding===_))continue;let b=N(e,w.source.file),P=b?Jn(b.root,w.source.startLine):null;!b||!P||r.push(De(b,P,"carrier.consume",a,D,M,[o.id,w.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${d.relativePath}: ${Ve(p)}`)}}}return r}function Gn(e){let t=I(e.db,e.file),n=new Map;return B(e.root,r=>{if(r.type!=="pair"||It(r)?.toLowerCase()!=="body")return;let i=wt(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let o=ce(t,r.startPosition.row),a=Kn(r);if(!o||!a)return;let s=q(a),l=new Set;tr(i,s,l);let u=n.get(o.symbol)??new Set;s.forEach((c,d)=>{c&&l.has(c)&&u.add(d)}),u.size>0&&n.set(o.symbol,u)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[[r,[...i].sort((o,a)=>o-a)]]:[]})}function Kn(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 Xn(e,t,n,r){let i=$(t.root,n.startLine,n.endLine);if(!i)return null;let o=new RegExp(`\\.body\\??\\.${le(r)}\\b`,"u");if(o.test(i.text))return r;let a=null;if(B(i,c=>{if(a||c.type!=="variable_declarator")return;let d=c.childForFieldName("name")??c.namedChild(0),p=c.childForFieldName("value")??c.namedChild(1);!d||!p||!new RegExp(`(?:^|[,{}])\\s*${le(r)}\\s*(?:[,}]|$)`,"u").test(d.text)||p.type==="call_expression"&&(a=Me(p)?.text??null)}),!a)return null;let s=Z(e,n.relativePath,a);if(s.length!==1)return null;let l=N(e,s[0].relativePath),u=l?$(l.root,s[0].startLine,s[0].endLine):null;return u&&o.test(u.text)&&new RegExp(`\\b${le(r)}\\s*[,}]`,"u").test(u.text)?r:null}function Zn(e,t,n){let r=[];for(let i of Ee(e,t,n)){let o=T(i.initializer);if(o.type==="call_expression")for(let a of Se(o)){let s=a.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))for(let l of Ee(e,i.definition.relativePath,s))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function De(e,t,n,r,i,o,a){let l=be(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:o,evidence:"constant",term:{kind:"literal",value:o}}],"derived","http-body-registry-discriminator");return l.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...a],sourceSpans:[l.source]},l}function Nt(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 Wn(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Pt([...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 St(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function Yn(e,t){let n=$(e.root,t.startLine,t.endLine);return n?q(n):[]}function Jn(e,t){let n=null;return B(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function Ct(e,t){let n=[];return B(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 Me(e){return e.childForFieldName("function")??e.namedChild(0)}function Se(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Qn(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return T(t);let r=null;return B(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?T(r):T(t)}function er(e){let t=T(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function It(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function wt(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 Pt(e){return[...new Set(e)].sort((t,n)=>t-n)}function nr(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function Ve(e){return e instanceof Error?e.message:String(e)}import{createHash as rr}from"crypto";function Bt(e,t){let n=new Map;for(let o of t){if(o.action!=="http.handle"||o.sourceScope!=="production")continue;let a=n.get(o.source.file)??[];a.push(o),n.set(o.source.file,a)}let r=[],i=ir(e);for(let o of i.mounts)for(let a of o.targetFiles)for(let s of n.get(a)??[]){let l=s.keyParts.find(p=>p.name==="path");if(!l||l.evidence==="expression")continue;let u=ar(o.prefix.value,l.value),c=s.keyParts.map(p=>p.name==="path"?{name:"path",value:u,evidence:"constant",term:{kind:"concat",parts:[o.prefix.term??{kind:"literal",value:o.prefix.value},l.term??{kind:"literal",value:l.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:o.file,startLine:o.line,endLine:o.line},...o.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:p),d=`${s.id}\0${o.file}\0${o.line}\0${u}`;r.push({...s,id:`boundary:${rr("sha256").update(d).digest("hex").slice(0,16)}`,keyParts:c,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:o.file,startLine:o.line,endLine:o.line}]},resolution:"unresolved"}),s.strength="candidate",s.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function ir(e){let t=[],n=X(e);for(let r of n){let i=j(e,r);if(!sr(i))continue;let o=N(e,r);o&&Ft(o.root,a=>{if(a.type!=="call_expression")return;let s=a.childForFieldName("function")??a.namedChild(0);if(!s||!s.text.replace(/\s+/gu,"").endsWith(".use"))return;let l=lr(a);if(l.length<2)return;let u=L(o,l[0]);if(!u||u.evidence==="expression")return;let c=or(e,r,l[1]);c.length!==0&&t.push({file:r,line:a.startPosition.row,prefix:{value:u.value,evidence:u.evidence,term:u.term,derivation:u.derivation},targetFiles:c})})}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 o=V(e,t).find(l=>l.localName===i&&l.sourcePath);if(!o?.sourcePath)return[t];if(o.kind==="namespace")return[o.sourcePath];let a=o.importedName==="default"?i:o.importedName,s=U(e,o.sourcePath,a);return[...new Set(s.map(l=>l.relativePath))]}function ar(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function sr(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function lr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Ft(e,t){t(e);for(let n of e.namedChildren)Ft(n,t)}import{createHash as ur}from"crypto";function xe(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}var je=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),cr=8;function $t(e,t){let n=new Map,r=[],i=[],o=new Set,a=[],s=[];for(let l of t){if(l.action!=="http.request"||!l.owner.symbol||l.evidence!=="call-expression"&&l.evidence!=="client-adapter")continue;let u=I(e,l.owner.file).find(m=>m.symbol===l.owner.symbol);if(!u)continue;let c=N(e,u.relativePath);if(!c)continue;let d=Rt(c,u),p={definition:u,...d,constantMethods:l.keyParts.flatMap(m=>m.name==="method"&&m.evidence!=="expression"&&je.has(m.value.toUpperCase())?[m.value.toUpperCase()]:[]),depth:0,proofObservationIds:[l.id],proofSpans:[l.source]};Et(n,p)&&r.push(n.get(u.symbol))}for(;r.length>0;){let l=r.shift();if(!(l.depth>=cr))try{let u=re(e,l.definition);s.push(...u.unresolved.map(c=>dr(l,c)));for(let c of u.sites){let d=N(e,c.file);if(!d)continue;o.add(c.file);let p=c.callNode,m=pr(l,p,d);m&&i.push(m);let y=c.caller;if(!y)continue;let f=Rt(d,y),h=mr(e,l,c),C={definition:y,pathParameterIndexes:Ne([...f.pathParameterIndexes,...h.pathParameterIndexes]),methodParameterIndexes:Ne([...f.methodParameterIndexes,...h.methodParameterIndexes]),constantMethods:Y([...l.constantMethods,...f.constantMethods]),depth:l.depth+1,proofObservationIds:Y([...l.proofObservationIds,...m?[m.id]:[]]),proofSpans:[...l.proofSpans,{file:c.file,startLine:c.startLine,endLine:c.endLine}]};Et(n,C)&&r.push(n.get(y.symbol))}}catch(u){a.push(`builtin.http-summary failed for ${l.definition.relativePath}:${l.definition.startLine+1}: ${u instanceof Error?u.message:String(u)}`)}}return{observations:i,frontiers:xe(s),summaries:n.size,filesInspected:o.size,errors:a}}function dr(e,t){let n=Y([...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:${ur("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:de(t.file)}}function pr(e,t,n){let r=Tt(t),i=e.pathParameterIndexes.flatMap(d=>{let p=L(n,r[d]);return p&&p.evidence!=="expression"&&yr(p.value)?[{index:d,value:p}]:[]}),o=e.methodParameterIndexes.flatMap(d=>{let p=L(n,r[d]),m=p?.value.toUpperCase();return p&&m&&p.evidence!=="expression"&&je.has(m)?[{index:d,value:{...p,value:m}}]:[]}),a=Y([...e.constantMethods,...o.map(d=>d.value.value)]);if(i.length!==1||a.length!==1)return null;let s=i[0].value,l=o.find(d=>d.value.value===a[0])?.value,u=[{name:"method",value:a[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:a[0]},derivation:l?.derivation},{name:"path",value:s.value,evidence:"constant",term:s.term,derivation:s.derivation}],c=be(n,t,"builtin.http-summary","http.request",u,"derived","compiler-resolved-http-summary");return c.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,c.source]},c}function Rt(e,t){let n=$(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=q(n),i=new Set,o=new Set,a=new Set;return B(n,s=>{if(s.type==="call_expression"&&((s.childForFieldName("function")??s.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let m=Tt(s);ae(m[0],r,i);let y=fr(m[1],"method");if(y){ae(y,r,o);let f=L(e,y),h=f?.value.toUpperCase();h&&f?.evidence!=="expression"&&je.has(h)&&a.add(h)}else ae(m[1],r,o)}if(s.type!=="pair")return;let l=s.childForFieldName("key")??s.namedChild(0),u=s.childForFieldName("value")??s.namedChild(1),c=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(c==="url"||c==="path"||c==="endpoint")&&ae(u,r,i),(c==="init"||c==="requestinit"||c==="options")&&ae(u,r,o)}),{pathParameterIndexes:r.flatMap((s,l)=>s&&i.has(s)?[l]:[]),methodParameterIndexes:r.flatMap((s,l)=>s&&o.has(s)?[l]:[]),constantMethods:[...a].sort()}}function mr(e,t,n){let r=ie(e,n);return{pathParameterIndexes:oe(r,t.pathParameterIndexes),methodParameterIndexes:oe(r,t.methodParameterIndexes)}}function Et(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Ne([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=Ne([...n.methodParameterIndexes,...t.methodParameterIndexes]),o=Y([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||o.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:o,depth:Math.min(n.depth,t.depth),proofObservationIds:Y([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function fr(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 ae(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 Tt(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function yr(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function Ne(e){return[...new Set(e)].sort((t,n)=>t-n)}function Y(e){return[...new Set(e)].sort()}import{createHash as hr}from"crypto";function _t(e){let t=kt(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=kt(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?ze(r).flatMap(i=>{let o=t.get(i)?.[0];return o?[Lt(r,o,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?ze(r).flatMap(i=>{let o=n.get(i)?.[0];return o?[Lt(r,o,i,"queue.consume")]:[]}):[])}function kt(e){let t=new Map;for(let n of e)for(let r of ze(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 ze(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function Lt(e,t,n,r){let i=`database:${n}`,o=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",a=[e.id,r,i,o].join("\0");return{...e,id:`boundary:${hr("sha256").update(a).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:o,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 qe="runtime-boundaries-v15",we=[{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}],gr=64;function vr(e,t={}){let n=X(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(Cr)),o=t.previousGraph?.fileCoverage,a=i.size>0&&t.previousGraph?.extractorVersion===qe&&o!==void 0&&o.length===t.previousGraph.coverage.filesScanned,s=a?o.filter(g=>r.has(g.file)&&!i.has(g.file)):[],l=new Set(s.flatMap(g=>g.observationIds)),u=a?t.previousGraph.observations.filter(g=>l.has(g.id)&&r.has(g.source.file)):[],c=a?n.filter(g=>i.has(g)):n,d=[],p=o?.reduce((g,Pe)=>g+Pe.observationIds.length,0)??0,m=performance.now(),y=br(e,c,t.profileSpan);K(d,"direct-extraction",m,c.length,y.observations.length,{filesVisited:c.length,filesReused:s.length,factsReused:u.length,factsInvalidated:Math.max(0,p-u.length)});let f=[...s,...y.fileCoverage].sort((g,Pe)=>g.file.localeCompare(Pe.file)),h=Nr(f),C=f.flatMap(g=>g.extractionErrors),F=se([...u,...y.observations]),D=se([...F,..._t(F)]);m=performance.now();let v=$t(e,D);K(d,"http-summary",m,D.length,v.observations.length,{filesVisited:v.filesInspected}),h.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:v.filesInspected,observations:v.observations.length,errors:v.errors.length}),C.push(...v.errors);let w=se([...D,...v.observations]);m=performance.now();let _=Bt(e,w);K(d,"http-mount",m,w.length,_.observations.length,{filesVisited:_.filesInspected});let M=se([...w,..._.observations]);m=performance.now();let b=xt(e,M);K(d,"carrier",m,M.length,b.observations.length,{filesVisited:b.filesInspected}),h.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:b.bodySummaries,observations:b.observations.length,errors:b.errors.length}),C.push(...b.errors);let P=se([...M,...b.observations]);m=performance.now();let S=Ir(P);K(d,"relations",m,P.length,S.length),m=performance.now();let Ue=Pr(P,S);K(d,"links",m,S.length,Ue.length),Br(P,S),m=performance.now();let He=xe([...Fr(P,S),...v.frontiers]);return K(d,"frontiers",m,P.length,He.length),{schemaVersion:2,extractorVersion:qe,observations:P,relationGroups:S,links:Ue,frontiers:He,coverage:{filesScanned:n.length,filesWithAst:f.filter(g=>g.hasAst).length,filesWithoutAst:f.filter(g=>!g.hasAst).length,...a?{filesReused:s.length}:{},extractors:[...h.values()],extractionErrors:C,phases:d},fileCoverage:f}}function K(e,t,n,r,i,o={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...o})}function br(e,t,n){let r=[],i=[];for(let o of t){let a=j(e,o),s=_e.filter(c=>c.supports(a)),l=s.length>0?N(e,o,a,n):null,u={file:o,hasAst:l!==null||xr(o,a),observationIds:[],extractors:[],extractionErrors:[]};if(l)for(let c of s){let d={id:c.id,applicableFiles:1,observations:0,errors:0};try{let p=Sr(n,`runtime-boundaries.extractor.${c.id}`,o,()=>c.extract(l));d.observations=p.length,r.push(...p),u.observationIds.push(...p.map(m=>m.id))}catch(p){d.errors=1,u.extractionErrors.push(`${c.id} failed for ${o}: ${p instanceof Error?p.message:String(p)}`)}u.extractors.push(d)}i.push(u)}return{observations:r,fileCoverage:i}}function Sr(e,t,n,r){return e?e(t,r,{file:n}):r()}function xr(e,t){return t?Ge(e)?/<script\b/iu.test(t):ue(e)!==null:!1}function Nr(e){let t=new Map(_e.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 Cr(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function Ir(e){let t=new Map;for(let n of we){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 o=Er(i,n.keyNames);if(!o)continue;let a=o.map(d=>`${d.name}=${Dt(d.name,d.value)}`).join("\0"),s=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${s}\0${a}`,u=`boundary-group:${At("sha256").update(l).digest("hex").slice(0,16)}`,c=t.get(u)??{id:u,protocol:n.protocol,joinRule:n.id,normalizedKey:a,keyParts:o,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&c.producerIds.push(i.id),n.consumerActions.includes(i.action)&&c.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&c.declarationIds.push(i.id),c.derivation.inputFactIds.push(i.id),c.derivation.sourceSpans.push(i.source),t.set(u,c)}}return[...t.values()].map(wr).sort(Tr)}function wr(e){return{...e,producerIds:Ce(e.producerIds),consumerIds:Ce(e.consumerIds),declarationIds:Ce(e.declarationIds),derivation:{...e.derivation,inputFactIds:Ce(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function Pr(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let o=we.find(s=>s.id===i.joinRule);if(!o?.traversable)continue;let a=o.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(a.length===0||i.consumerIds.length===0)&&!(o.requireUniquePair&&(a.length!==1||i.consumerIds.length!==1))&&!(o.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(a.length*i.consumerIds.length>gr))for(let s of a)for(let l of i.consumerIds){let u=n.get(s),c=n.get(l);if(!u||!c||$r(u,c))continue;let d=u.strength==="derived"||c.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${s}\0${l}`,m={id:`boundary-link:${At("sha256").update(p).digest("hex").slice(0,16)}`,from:s,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:d,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[s,l],sourceSpans:[u.source,c.source]}};r.set(m.id,m)}}return[...r.values()].sort(kr)}function Br(e,t){let n=new Set(t.filter(Ot).flatMap(Ie)),r=new Set(t.filter(Rr).flatMap(Ie));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function Fr(e,t){let n=new Set(e.filter(o=>o.strength!=="candidate").map(o=>`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)),r=new Set(t.flatMap(Ie)),i=new Set(t.filter(Ot).flatMap(Ie));return e.filter(o=>o.sourceScope==="production").filter(o=>o.strength!=="candidate"||!n.has(`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)).filter(o=>!i.has(o.id)).map(o=>{let a=o.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),s=a.length>0?`${o.extractor} observed ${o.action}, but ${a.join(", ")} remained symbolic or unknown.`:o.resolution==="ambiguous"?`${o.extractor} established the address for ${o.action}, but more than one indexed peer has the same runtime key.`:r.has(o.id)?`${o.extractor} established the address for ${o.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${o.extractor} observed ${o.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:o.id,reason:s,missingKeyParts:a,sourceScope:o.sourceScope}}).sort((o,a)=>o.observationId.localeCompare(a.observationId))}function Ie(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function Ot(e){let t=we.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 Rr(e){let t=we.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 Er(e,t){let n=[];for(let r of t){let i=e.keyParts.find(o=>o.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:Dt(r,i.value)})}return n}function Dt(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function $r(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function se(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 Ce(e){return[...new Set(e)].sort()}function Tr(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function kr(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}export{de as a,L as b,re as c,ie as d,qe as e,vr as f,Vt as g,jt as h,tt as i};
|
|
49
|
-
//# sourceMappingURL=chunk-YRVERHJR.js.map
|
package/dist/chunk-ZD3Z54IW.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as f,e as v,g as y}from"./chunk-SEUJVWT2.js";import{v as h,x as m,y as a}from"./chunk-SF7X6QNW.js";import{d as u}from"./chunk-DOPCR5BY.js";import{m as S}from"./chunk-G6OGPXJW.js";import{c as l}from"./chunk-3VLJ2DCA.js";import{n as d,o as p}from"./chunk-4DCKBY6T.js";import{randomUUID as j}from"crypto";import{resolve as b}from"path";var o=class{loadModule;discoverTsconfigs;createProjects;createProvider;db;module=null;projects=null;provider=null;stats={providerRequests:0,sessionsCreated:0,sessionsReused:0,sessionsRefreshed:0,sessionsReplaced:0,projectsCreated:0};constructor(t,e={}){this.db=t,this.loadModule=e.loadModule??h,this.discoverTsconfigs=e.discoverTsconfigs??v,this.createProjects=e.createProjects??m,this.createProvider=e.createProvider??((r,i,n)=>y(r,i,n,{reusedProjects:!0}))}semanticProvider(){return this.stats.providerRequests+=1,this.provider?(this.stats.sessionsReused+=1,this.provider):this.createSession()}advanceGeneration(t,e){let r=T(e);return this.provider?.dispose?.(),this.provider=null,this.db=t,this.projects?r.mode==="replace"?(this.projects=null,this.module=null,this.stats.sessionsReplaced+=1,r):(r.mode==="refresh"&&(M(this.projects,t.config.projectRoot,r),this.stats.sessionsRefreshed+=1),r):r}snapshotStats(){return{...this.stats}}dispose(){this.provider?.dispose?.(),this.provider=null,this.projects=null,this.module=null}createSession(){let t=this.module??this.loadModule();if(!t)return this.provider=a("ts-morph is not installed"),this.provider;if(this.module=t,!this.projects){let e=this.discoverTsconfigs(this.db);if(e.length===0)return this.provider=a("no tsconfig found"),this.provider;this.projects=this.createProjects(t,e),this.stats.projectsCreated+=this.projects.length}return this.provider=this.createProvider(this.db,t,this.projects),this.stats.sessionsCreated+=1,this.provider}};function T(s){let t=new Set;s.projectIdentityChanged&&t.add("project-identity-changed");for(let n of s.uncertainty)t.add(n);for(let n of s.changes)n.inputKind!=="source"&&t.add(`${n.inputKind}-input-changed`);if(t.size>0)return{mode:"replace",addedFiles:[],modifiedFiles:[],deletedFiles:[],reasons:[...t].sort()};let e=c(s.changes,"added"),r=c(s.changes,"modified"),i=c(s.changes,"deleted");return{mode:e.length+r.length+i.length===0?"reuse":"refresh",addedFiles:e,modifiedFiles:r,deletedFiles:i,reasons:[]}}function c(s,t){return s.filter(e=>e.kind===t).map(e=>e.path).sort()}function M(s,t,e){for(let r of s){for(let i of e.deletedFiles)r.project.getSourceFile(b(t,i))?.forget();for(let i of e.modifiedFiles){let n=r.project.getSourceFile(b(t,i));n&&n.refreshFromFileSystemSync()}e.addedFiles.length>0&&r.project.addSourceFilesFromTsConfig(r.tsconfigPath)}}var g=class{openDb;createHost;generationIdentity;readSnapshot;now;db=null;host=null;generation=null;snapshot=null;requests=0;lastRequestAtMs=null;lastError=null;available=null;constructor(t){this.openDb=t.openDb,this.createHost=t.createHost??(e=>new o(e)),this.generationIdentity=t.generationIdentity?e=>t.generationIdentity(e.config.dbPath):e=>e.generation.identity,this.readSnapshot=t.readSnapshot?e=>t.readSnapshot(e.config.dbPath):I,this.now=t.now??Date.now}handle(t,e){try{this.syncGeneration(t);let r=this.host.semanticProvider();switch(this.available=r.availability().available,this.requests+=1,this.lastRequestAtMs=this.now(),this.lastError=null,e.kind){case"availability":return r.availability();case"import-usage":return r.importUsage(e.file);case"references":return[...R(r,e.definitions,{exact:e.exact===!0})];case"reference-fragments":if(!r.referenceFragmentsForFiles)throw new Error("TypeScript provider does not support reference fragments.");return[...r.referenceFragmentsForFiles(e.files)];case"callees":return[...w(r,e.definitions)];case"signature":return r.signatureFor(e.definition);default:return E(e)}}catch(r){throw this.lastError=r instanceof Error?r.message:String(r),r}}status(t){let e=this.host?.snapshotStats();return{protocolVersion:f,state:this.lastError?"error":this.host?this.available?"ready":"unavailable":"idle",requests:this.requests,...this.lastRequestAtMs===null?{}:{lastRequestAt:new Date(this.lastRequestAtMs).toISOString()},...this.lastError?{lastError:this.lastError}:{},sessionsCreated:e?.sessionsCreated??0,sessionsReused:e?.sessionsReused??0,sessionsRefreshed:e?.sessionsRefreshed??0,sessionsReplaced:e?.sessionsReplaced??0,projectsCreated:e?.projectsCreated??0,...t?{mailbox:t}:{}}}closeTypeScriptService(){this.host?.dispose(),this.db?.close(),this.host=null,this.db=null,this.generation=null,this.snapshot=null,this.available=null}syncGeneration(t){if(this.generation===t&&this.host&&this.db)return;let e=this.openDb(),r=this.generationIdentity(e);if(!r||r!==t)throw e.close(),new Error("TypeScript semantic request does not match the currently published index generation.");let i=this.readSnapshot(e);if(!this.host||!this.db)this.db=e,this.host=this.createHost(e);else{let n=this.db;this.host.advanceGeneration(e,C(this.snapshot,i)),this.db=e,n.close()}this.generation=r,this.snapshot=i,this.available=null}};function z(s){S(s)}function R(s,t,e){return s.referencesForDefinitions?.(t,e)??new Map(t.map(r=>[r.symbolId,s.referencesFor(r)]))}function w(s,t){return s.calleesForDefinitions?.(t)??new Map(t.map(e=>[e.symbolId,s.calleesFor(e)]))}function I(s){if(!s.generation.metadataRaw)return null;let t=u(s.generation.metadataRaw);return t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache?null:d(t.metadata.fingerprint)}function C(s,t){return t?p(s,t):{version:1,changes:[],projectIdentityChanged:!0,uncertainty:["prior-snapshot-unavailable"]}}function E(s){throw new Error(`Unhandled TypeScript semantic request: ${JSON.stringify(s)}`)}var X=`typescript-semantic-${process.pid}-${j()}`,P=l(process.pid),K={pid:process.pid,...P?{processIdentity:P}:{}};export{g as a,z as b};
|
|
2
|
-
//# sourceMappingURL=chunk-ZD3Z54IW.js.map
|