scip-query 0.23.0 → 0.26.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 +491 -2
- package/README.md +111 -122
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-PRVFAGTQ.js +2 -0
- package/dist/call-graph-DVPAQV2F.js +2 -0
- package/dist/call-graph-evidence-CUtj8V2I.d.ts +19 -0
- package/dist/chunk-2FSBGL5P.js +2 -0
- package/dist/chunk-2HLAFUCY.js +2 -0
- package/dist/chunk-2IWUT6CJ.js +3 -0
- package/dist/chunk-2KNN7GTQ.js +2 -0
- package/dist/chunk-2LHXRE2B.js +8 -0
- package/dist/{chunk-EG2CPZMJ.js → chunk-2YXE77TJ.js} +2 -2
- package/dist/chunk-36SGVCGX.js +2 -0
- package/dist/chunk-3ABBFPTP.js +2 -0
- package/dist/chunk-3IVFU4FD.js +3 -0
- package/dist/chunk-3JIQS44J.js +7 -0
- package/dist/chunk-3ZRB6DNK.js +7 -0
- package/dist/{chunk-6YTSKJJ3.js → chunk-42EOW5VI.js} +1 -1
- package/dist/{chunk-6I6L7Z62.js → chunk-4BHGBMNO.js} +2 -2
- package/dist/chunk-4BP3UBDG.js +2 -0
- package/dist/chunk-4D6RO7G4.js +2 -0
- package/dist/chunk-4FEWQ6RH.js +2 -0
- package/dist/chunk-4IGEOBG7.js +2 -0
- package/dist/chunk-4QZXBUKC.js +2 -0
- package/dist/chunk-4WBDEVX2.js +4 -0
- package/dist/chunk-4WCUBZU3.js +8 -0
- package/dist/chunk-4WTUBQ36.js +40 -0
- package/dist/chunk-4XQ4O6IM.js +3 -0
- package/dist/chunk-55UQAMZO.js +4 -0
- package/dist/chunk-5D2LVK7O.js +125 -0
- package/dist/chunk-5IYJ56TT.js +2 -0
- package/dist/chunk-5PLMJC7Q.js +2 -0
- package/dist/chunk-5TNQJUR2.js +5 -0
- package/dist/chunk-62BDNPMI.js +2 -0
- package/dist/chunk-64DZ5TXR.js +7 -0
- package/dist/chunk-65245JCM.js +2 -0
- package/dist/chunk-6FFVZZL4.js +2 -0
- package/dist/chunk-6KO5JHAR.js +2 -0
- package/dist/chunk-6LRXOOSX.js +2 -0
- package/dist/chunk-6LSEIIF7.js +2 -0
- package/dist/chunk-6YMNWD3H.js +6 -0
- package/dist/chunk-72AD6ZRR.js +5 -0
- package/dist/chunk-73AAKPUC.js +4 -0
- package/dist/chunk-76CZ77DF.js +2 -0
- package/dist/chunk-7VPEEAAG.js +2 -0
- package/dist/chunk-7WTPQ4NX.js +14 -0
- package/dist/chunk-7Y5T6XDP.js +2 -0
- package/dist/chunk-A2IIGFMJ.js +5 -0
- package/dist/chunk-AB5KCTEV.js +2 -0
- package/dist/chunk-AC566WBP.js +6 -0
- package/dist/chunk-AGWFSTXC.js +3 -0
- package/dist/chunk-AOSIYPTA.js +2 -0
- package/dist/chunk-AUVEWPIF.js +2 -0
- package/dist/chunk-B56T42J3.js +25 -0
- package/dist/chunk-BIQEF5NE.js +2 -0
- package/dist/chunk-BL6XJKTA.js +3 -0
- package/dist/chunk-BMKOQJRI.js +2 -0
- package/dist/chunk-BOZ4EXBB.js +3 -0
- package/dist/chunk-BUTWYEPH.js +2 -0
- package/dist/chunk-BZB4QPIP.js +2 -0
- package/dist/{chunk-ILTDAWEF.js → chunk-CE357GEE.js} +4 -4
- package/dist/chunk-CFN45HFP.js +2 -0
- package/dist/chunk-CFYMZFXT.js +368 -0
- package/dist/chunk-CN5EH7O3.js +2 -0
- package/dist/chunk-D254DNNQ.js +4 -0
- package/dist/chunk-D3FDISIC.js +2 -0
- package/dist/chunk-D3NX5XIE.js +3 -0
- package/dist/chunk-DA7RPPDF.js +3 -0
- package/dist/chunk-DDMC3FON.js +3 -0
- package/dist/chunk-DIO3FUSG.js +2 -0
- package/dist/chunk-DJ2NNSUK.js +3 -0
- package/dist/chunk-DKYQIM3C.js +18 -0
- package/dist/{chunk-JTQVMR42.js → chunk-DOOEL2IV.js} +2 -2
- package/dist/chunk-DVFP6PZI.js +2 -0
- package/dist/chunk-E3FDPXZK.js +2 -0
- package/dist/chunk-E7YNJLCB.js +2 -0
- package/dist/chunk-EFGW5JPH.js +2 -0
- package/dist/chunk-EJVTR244.js +13 -0
- package/dist/chunk-EOV7RTRZ.js +2 -0
- package/dist/chunk-ETOIKRHO.js +2 -0
- package/dist/chunk-EYK3ZAO2.js +3 -0
- package/dist/chunk-F2V2LPET.js +52 -0
- package/dist/chunk-F4LUHJTF.js +2 -0
- package/dist/chunk-F4PUT6IT.js +2 -0
- package/dist/chunk-F56GCXXS.js +5 -0
- package/dist/chunk-FC2EVQRM.js +2 -0
- package/dist/chunk-FL7NBMHP.js +3 -0
- package/dist/chunk-FMRN2TRL.js +3 -0
- package/dist/chunk-FVULPZDF.js +20 -0
- package/dist/chunk-GCKCF5FL.js +43 -0
- package/dist/chunk-GH2PYF46.js +2 -0
- package/dist/chunk-GHJAGXIP.js +2 -0
- package/dist/{chunk-WIWY3CRX.js → chunk-GMVSHUKZ.js} +2 -2
- package/dist/chunk-GS6KDO4R.js +2 -0
- package/dist/chunk-GUUBXNN7.js +2 -0
- package/dist/chunk-GVWX5T43.js +80 -0
- package/dist/chunk-GZKFETP5.js +2 -0
- package/dist/chunk-H4EQHO6J.js +9 -0
- package/dist/chunk-H73WY2RM.js +2 -0
- package/dist/chunk-H75GSPRV.js +60 -0
- package/dist/chunk-HDR3AHSV.js +61 -0
- package/dist/chunk-HQBSL74Y.js +2 -0
- package/dist/chunk-HRRFKWPZ.js +2 -0
- package/dist/chunk-HXENDJC6.js +2 -0
- package/dist/chunk-IIBAZNSW.js +21 -0
- package/dist/chunk-INLMWEUU.js +12 -0
- package/dist/chunk-IWQPAF4F.js +2 -0
- package/dist/chunk-IZJ6YUKP.js +35 -0
- package/dist/chunk-J2TMAIN5.js +60 -0
- package/dist/chunk-J5FJMODQ.js +142 -0
- package/dist/chunk-J7HZPIO3.js +2 -0
- package/dist/chunk-JEVRKFRL.js +2 -0
- package/dist/chunk-JFXSGAEB.js +30 -0
- package/dist/chunk-JVRTHGFS.js +3 -0
- package/dist/chunk-JYWEX7RR.js +360 -0
- package/dist/chunk-K3YL22N6.js +2 -0
- package/dist/chunk-K4CN7GXK.js +12 -0
- package/dist/chunk-K5TBVXU4.js +30 -0
- package/dist/chunk-KDDIE2DP.js +9 -0
- package/dist/chunk-KHWRRPV4.js +2 -0
- package/dist/chunk-KI6NBKDY.js +14 -0
- package/dist/chunk-KU3QRSTH.js +2 -0
- package/dist/chunk-KZBJWZJB.js +2 -0
- package/dist/chunk-L7GFM3NP.js +3 -0
- package/dist/chunk-LMO6PK3V.js +35 -0
- package/dist/chunk-LN4YXJJU.js +2 -0
- package/dist/chunk-LOVIZBJ4.js +43 -0
- package/dist/chunk-LPCRK4A2.js +11 -0
- package/dist/chunk-MMHZKBFA.js +2 -0
- package/dist/{chunk-M2O5NY6W.js → chunk-MOQQBQRD.js} +2 -2
- package/dist/chunk-N2WN6I3L.js +2 -0
- package/dist/chunk-N3ORQT7L.js +2 -0
- package/dist/chunk-NAZ3RAIW.js +2 -0
- package/dist/chunk-NDUNO5JQ.js +2 -0
- package/dist/chunk-NEIWRNAZ.js +4 -0
- package/dist/chunk-NJJMVD65.js +2 -0
- package/dist/chunk-NLOQOBXI.js +20 -0
- package/dist/chunk-NOLZOVCU.js +2 -0
- package/dist/chunk-NOWINRRN.js +2 -0
- package/dist/chunk-NZAXKGRL.js +16 -0
- package/dist/chunk-O2C4UILI.js +2 -0
- package/dist/chunk-O3RHA6ZT.js +3 -0
- package/dist/chunk-O4UZSPPI.js +3 -0
- package/dist/chunk-OGFV2BUX.js +2 -0
- package/dist/chunk-OZCJXZK6.js +499 -0
- package/dist/chunk-P6ODM7BY.js +2 -0
- package/dist/{chunk-XBGWL66K.js → chunk-PAVGPRHJ.js} +2 -2
- package/dist/chunk-PH52RA7D.js +2 -0
- package/dist/chunk-PKN354TH.js +3 -0
- package/dist/chunk-PWOASWEG.js +11 -0
- package/dist/chunk-QIWXRW72.js +2 -0
- package/dist/chunk-QJRMOK5N.js +2 -0
- package/dist/{chunk-YXPUP5G2.js → chunk-QOIXNWQR.js} +2 -2
- package/dist/chunk-QXEUDXBT.js +3 -0
- package/dist/chunk-QYUVVBMR.js +6 -0
- package/dist/chunk-QZ7KQZRN.js +2 -0
- package/dist/chunk-R6LQBUDH.js +2 -0
- package/dist/chunk-RBS42E55.js +20 -0
- package/dist/chunk-RSJKPCFX.js +26 -0
- package/dist/chunk-S6CZA3MV.js +2 -0
- package/dist/chunk-STMVAHJP.js +2 -0
- package/dist/chunk-SYVPTTVW.js +2 -0
- package/dist/chunk-T3I6NHBH.js +2 -0
- package/dist/chunk-T6DK3ZP7.js +2 -0
- package/dist/chunk-TKD34PHN.js +4 -0
- package/dist/chunk-TNNQFH7W.js +2 -0
- package/dist/chunk-TNV7SSUF.js +2 -0
- package/dist/chunk-TO7ZR3EH.js +8 -0
- package/dist/chunk-TOU3CHK4.js +2 -0
- package/dist/chunk-TRBI4UKT.js +2 -0
- package/dist/chunk-TZCVNCAN.js +4 -0
- package/dist/chunk-U4LZA5LL.js +3 -0
- package/dist/chunk-U5RIG3JP.js +3 -0
- package/dist/chunk-UP5KXN2I.js +2 -0
- package/dist/chunk-UQFR3NDH.js +5 -0
- package/dist/chunk-UXYXF7GV.js +2 -0
- package/dist/chunk-VB3GOKOS.js +2 -0
- package/dist/chunk-VF5JZICY.js +2 -0
- package/dist/chunk-VTY3VK6E.js +2 -0
- package/dist/chunk-VX2O4RIS.js +2 -0
- package/dist/chunk-WKPV2TDZ.js +2 -0
- package/dist/chunk-WOFQ5DTB.js +2 -0
- package/dist/chunk-WS4C6TCK.js +2 -0
- package/dist/chunk-WXU3DGPU.js +2 -0
- package/dist/chunk-X6RMKHJQ.js +81 -0
- package/dist/{chunk-4ILJCCXV.js → chunk-XHMN6ZX7.js} +2 -2
- package/dist/chunk-XHTVFLWW.js +2 -0
- package/dist/chunk-XKIDJCIK.js +2 -0
- package/dist/chunk-XTYTYZPT.js +2 -0
- package/dist/chunk-Y2JHHTTA.js +2 -0
- package/dist/chunk-YGVRMGYN.js +4 -0
- package/dist/chunk-YNQCGEQE.js +2 -0
- package/dist/chunk-YOQVEXVE.js +14 -0
- package/dist/chunk-YRT2WLYY.js +2 -0
- package/dist/chunk-YTAP5Y2G.js +2 -0
- package/dist/chunk-YTYWI7VB.js +2 -0
- package/dist/chunk-YULZRALL.js +2 -0
- package/dist/chunk-Z33WQG4Q.js +2 -0
- package/dist/chunk-ZGTYGDMF.js +16 -0
- package/dist/chunk-ZHMRSZFD.js +43 -0
- package/dist/chunk-ZHSP366W.js +10 -0
- package/dist/chunk-ZIBYCYKK.js +7 -0
- package/dist/{chunk-GAS2LJMP.js → chunk-ZLADLUE6.js} +3 -3
- package/dist/chunk-ZO4YXUT6.js +4 -0
- package/dist/{chunk-HYO3NP5Q.js → chunk-ZR4HBC2H.js} +2 -2
- package/dist/cli-main.js +6 -6
- package/dist/cli.js +1 -1
- package/dist/{code-B17qEMbt.d.ts → code-BNyrCF3_.d.ts} +3 -2
- package/dist/code-IL5WH3NZ.js +2 -0
- package/dist/code-result-json-ANTBEDFP.js +4 -0
- package/dist/command-descriptors-HEEMDHTU.js +222 -0
- package/dist/deps-EOWFC6FD.js +2 -0
- package/dist/direct-navigation-Y5B6OSIQ.js +3 -0
- package/dist/{exploration-topology-BG4v30HZ.d.ts → exploration-topology-CSgEyAz-.d.ts} +3 -1
- package/dist/files-K4AI3JUM.js +2 -0
- package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
- package/dist/{health-CPp2Jf1Z.d.ts → health-BtfmNrfa.d.ts} +58 -74
- package/dist/hierarchy-6W5NDIFI.js +2 -0
- package/dist/imports-WH365QY4.js +2 -0
- package/dist/index.d.ts +13 -1
- package/dist/index.js +1 -1
- package/dist/members-K3PHMF5S.js +2 -0
- package/dist/methods-E7KVMBX4.js +2 -0
- package/dist/output-continuation-command-BJSY67SN.js +3 -0
- package/dist/output-pagination-UZJ5ACIX.js +24 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-EP24WT4X.js +3 -0
- package/dist/queries/affected.js +1 -1
- package/dist/queries/architecture.d.ts +15 -4
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +3 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -0
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +3 -3
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +20 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity.d.ts +6 -3
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +1 -7
- package/dist/queries/context.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dead.d.ts +2 -0
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/dependence-slice.d.ts +46 -22
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +1 -7
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +3 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +29 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +2 -4
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +121 -61
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- 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 +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -0
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +3 -3
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +17 -65
- package/dist/queries/index.js +1 -1
- package/dist/queries/locality-candidates.d.ts +4 -4
- 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.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -6
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +9 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +19 -3
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +22 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +17 -3
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +4 -14
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +4 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/review.d.ts +188 -0
- package/dist/queries/review.js +2 -0
- package/dist/queries/similar-files.d.ts +7 -10
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +19 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice-cohesion.d.ts +205 -0
- package/dist/queries/slice-cohesion.js +2 -0
- package/dist/queries/source-inspection.d.ts +6 -202
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +2 -3
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stats.d.ts +1 -0
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +4 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/twin-drift.d.ts +23 -7
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +3 -15
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/query-service-fastpath.js +5 -5
- package/dist/query-service-server.js +4 -4
- package/dist/refs-CCBJG7WK.js +2 -0
- package/dist/refs-pagination-DRNLVU4S.js +2 -0
- package/dist/reindex-worker.js +79 -29
- package/dist/reindex.js +45 -45
- package/dist/repository-cache-worker.js +2 -0
- package/dist/runtime.d.ts +8 -8
- package/dist/runtime.js +3 -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/service-queries-2WAJI7R6.js +6 -0
- package/dist/source-inspection-91U9zdO3.d.ts +341 -0
- package/dist/{source-search-types-Dwz8KeuW.d.ts → source-search-types-DWGYNg8M.d.ts} +15 -2
- package/dist/stats-G7DIV6VU.js +2 -0
- package/dist/surface-IO55UALI.js +2 -0
- package/dist/system-ZBMSHJXU.js +2 -0
- package/dist/{queries/trace.d.ts → trace-BMjw3prn.d.ts} +1 -18
- package/dist/typescript-indexer.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +3 -3
- package/docs/AGENT_GUIDE.md +19 -128
- package/docs/CLI_JSON_OUTPUT.md +21 -17
- package/docs/COMMAND_REFERENCE.md +34 -49
- package/docs/CURRENT_COMMANDS.md +123 -0
- package/docs/DETECTOR_EVIDENCE_CONTRACTS.md +0 -40
- package/docs/DETECTOR_GUIDE.md +55 -12
- package/docs/PRODUCT_VISION.md +135 -0
- package/docs/PROPERTY_TESTING.md +73 -0
- package/docs/REVIEW.md +76 -0
- package/docs/SKILLS.md +51 -0
- package/docs/WINDOWS_SIDECAR_RELEASE.md +12 -3
- package/docs/accuracy-audit-checklist.md +70 -13
- package/docs/analyzer-inventory.md +2 -2
- package/docs/locality-analyzer-design.md +9 -9
- package/package.json +18 -80
- package/scripts/evidence-product-contract.mjs +7 -3
- package/scripts/record-review-coverage.mjs +118 -0
- package/scripts/scip-windows-provenance.mjs +29 -19
- package/skills/scip-architecture-review/SKILL.md +57 -0
- package/skills/scip-architecture-review/agents/openai.yaml +4 -0
- package/skills/scip-architecture-review/references/design-checks.md +17 -0
- package/skills/scip-explore/SKILL.md +15 -59
- package/skills/scip-explore/agents/openai.yaml +3 -3
- package/skills/scip-explore/references/external-evidence.md +2 -2
- package/skills/scip-explore/references/information-model.md +26 -29
- package/skills/scip-explore/scripts/capture-evidence.mjs +68 -34
- package/skills/scip-integrity-audit/SKILL.md +53 -181
- package/skills/scip-integrity-audit/agents/openai.yaml +3 -3
- package/skills/scip-integrity-audit/references/integrity-probes.md +27 -0
- package/skills/scip-plan/SKILL.md +39 -65
- package/skills/scip-plan/agents/openai.yaml +2 -2
- package/skills/scip-query/SKILL.md +28 -81
- package/skills/scip-query/agents/openai.yaml +2 -2
- package/skills/scip-query/references/command-guide.md +169 -0
- package/skills/scip-setup/SKILL.md +4 -2
- package/skills/scip-setup/agents/openai.yaml +3 -3
- package/dist/by-kind-XI2CSWEY.js +0 -2
- package/dist/call-graph-UONR6JR5.js +0 -2
- package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
- package/dist/chunk-26CT72HM.js +0 -2
- package/dist/chunk-2E7CX53V.js +0 -2
- package/dist/chunk-2GRUZAQF.js +0 -43
- package/dist/chunk-2LDBDR6J.js +0 -29
- package/dist/chunk-2OOY75BW.js +0 -2
- package/dist/chunk-2R3V3PSD.js +0 -4
- package/dist/chunk-2WC2OEDO.js +0 -4
- package/dist/chunk-35NLDRZC.js +0 -2
- package/dist/chunk-3AF4TUFK.js +0 -3
- package/dist/chunk-3D3QG236.js +0 -2
- package/dist/chunk-3FHOF22C.js +0 -21
- package/dist/chunk-3JKSW6LJ.js +0 -2
- package/dist/chunk-3L2ZBPEX.js +0 -133
- package/dist/chunk-3PJABJSU.js +0 -2
- package/dist/chunk-3SVF22I5.js +0 -2
- package/dist/chunk-3WR4E3A3.js +0 -3
- package/dist/chunk-4FTZ4P5G.js +0 -2
- package/dist/chunk-4UX2F3JX.js +0 -2
- package/dist/chunk-4WNW27SX.js +0 -2
- package/dist/chunk-5ENOG4VP.js +0 -61
- package/dist/chunk-64BFSI5I.js +0 -2
- package/dist/chunk-66DVSJQG.js +0 -455
- package/dist/chunk-6HFCYNYE.js +0 -9
- package/dist/chunk-6PQNKL3G.js +0 -3
- package/dist/chunk-6V5CNXL6.js +0 -2
- package/dist/chunk-6VVV4WRR.js +0 -4
- package/dist/chunk-7BWFZPPZ.js +0 -2
- package/dist/chunk-7CYG22FH.js +0 -2
- package/dist/chunk-7F45LJKI.js +0 -2
- package/dist/chunk-7IWV2EG3.js +0 -3
- package/dist/chunk-7KCZELVM.js +0 -2
- package/dist/chunk-AFHTBORT.js +0 -2
- package/dist/chunk-AVRYW5OZ.js +0 -2
- package/dist/chunk-B3X6KU75.js +0 -2
- package/dist/chunk-B5D7QPBE.js +0 -4
- package/dist/chunk-BBCIS4DX.js +0 -16
- package/dist/chunk-BDUVI7TO.js +0 -3
- package/dist/chunk-BE7ZZTMC.js +0 -2
- package/dist/chunk-BHVUJOCQ.js +0 -3
- package/dist/chunk-BJT7LSPK.js +0 -3
- package/dist/chunk-BKVWUP7Y.js +0 -2
- package/dist/chunk-BQGB4HBD.js +0 -2
- package/dist/chunk-BRV7PIFF.js +0 -2
- package/dist/chunk-CEEZJXEF.js +0 -2
- package/dist/chunk-CIYLO6SI.js +0 -7
- package/dist/chunk-CJZXN4NU.js +0 -2
- package/dist/chunk-CNO7TOKL.js +0 -2
- package/dist/chunk-COF23M5F.js +0 -2
- package/dist/chunk-CWFP7GM5.js +0 -2
- package/dist/chunk-D2DHWI3D.js +0 -2
- package/dist/chunk-D4N5SQ2M.js +0 -4
- package/dist/chunk-DBRSYFXR.js +0 -2
- package/dist/chunk-DHUIOLDT.js +0 -2
- package/dist/chunk-DIRJWYBM.js +0 -6
- package/dist/chunk-DIUFNHRJ.js +0 -35
- package/dist/chunk-DRENNWRG.js +0 -2
- package/dist/chunk-DTZCKZEU.js +0 -4
- package/dist/chunk-DULC3QFP.js +0 -5
- package/dist/chunk-DYGHBZ2N.js +0 -16
- package/dist/chunk-E5R6AQ73.js +0 -40
- package/dist/chunk-E73UNJTF.js +0 -38
- package/dist/chunk-EKV5HX33.js +0 -2
- package/dist/chunk-EQHFIL6T.js +0 -3
- package/dist/chunk-ESIQ66Z7.js +0 -2
- package/dist/chunk-EVFUMY4R.js +0 -3
- package/dist/chunk-F7DY272B.js +0 -2
- package/dist/chunk-FBN2FGXG.js +0 -2
- package/dist/chunk-FDLOBR6P.js +0 -4
- package/dist/chunk-FESCRNVV.js +0 -5
- package/dist/chunk-FFRKR4EQ.js +0 -2
- package/dist/chunk-FGA2U4OR.js +0 -8
- package/dist/chunk-FIQRSHVM.js +0 -2
- package/dist/chunk-FPYLNQPT.js +0 -2
- package/dist/chunk-FRUSVINH.js +0 -2
- package/dist/chunk-GSP44ENC.js +0 -2
- package/dist/chunk-GUFSG5TX.js +0 -2
- package/dist/chunk-GYIZ4NXB.js +0 -2
- package/dist/chunk-GZIUDL6G.js +0 -2
- package/dist/chunk-H5EXS3HM.js +0 -2
- package/dist/chunk-HCXEQRFF.js +0 -18
- package/dist/chunk-HEHOQQKH.js +0 -2
- package/dist/chunk-HKGFPJ4T.js +0 -4
- package/dist/chunk-HLZTEXRA.js +0 -2
- package/dist/chunk-HOENASQM.js +0 -3
- package/dist/chunk-HVF5VBG6.js +0 -2
- package/dist/chunk-I55I7XXP.js +0 -2
- package/dist/chunk-IDFEUFKS.js +0 -2
- package/dist/chunk-IHGQTTVW.js +0 -2
- package/dist/chunk-IICPE7B2.js +0 -20
- package/dist/chunk-IL676XCC.js +0 -18
- package/dist/chunk-IW5XQG5G.js +0 -2
- package/dist/chunk-IZDPJ2QI.js +0 -2
- package/dist/chunk-J66VOFW6.js +0 -5
- package/dist/chunk-JFMEXGFE.js +0 -2
- package/dist/chunk-JGKUET5J.js +0 -3
- package/dist/chunk-JS4PGXMV.js +0 -3
- package/dist/chunk-JWTGMPIT.js +0 -80
- package/dist/chunk-JYR66JN5.js +0 -5
- package/dist/chunk-KFOYCQAJ.js +0 -9
- package/dist/chunk-KLFEXGQA.js +0 -2
- package/dist/chunk-KMVGRIO2.js +0 -2
- package/dist/chunk-KYSDI3GE.js +0 -5
- package/dist/chunk-L6PJPETJ.js +0 -29
- package/dist/chunk-LDVT66YM.js +0 -2
- package/dist/chunk-LEECKFCJ.js +0 -2
- package/dist/chunk-LMZ5PRUV.js +0 -2
- package/dist/chunk-LQRQN2XA.js +0 -2
- package/dist/chunk-LXABEJX3.js +0 -2
- package/dist/chunk-MNV5FSBW.js +0 -3
- package/dist/chunk-MPQ4OTBM.js +0 -2
- package/dist/chunk-MTDBHTSF.js +0 -2
- package/dist/chunk-MV3CDXPI.js +0 -38
- package/dist/chunk-MWN53KRN.js +0 -60
- package/dist/chunk-MXNGIEPU.js +0 -3
- package/dist/chunk-N2ZSIIGR.js +0 -117
- package/dist/chunk-N5B2NILC.js +0 -5
- package/dist/chunk-NJITK2GP.js +0 -2
- package/dist/chunk-NOGJXYFO.js +0 -2
- package/dist/chunk-NOYBFVJA.js +0 -554
- package/dist/chunk-NWQXSFFU.js +0 -3
- package/dist/chunk-ODDUPDP7.js +0 -13
- package/dist/chunk-OLIWTZI3.js +0 -3
- package/dist/chunk-OLNV6I6U.js +0 -2
- package/dist/chunk-OR2E3AGZ.js +0 -2
- package/dist/chunk-OSR2GEHQ.js +0 -2
- package/dist/chunk-OSSESPDX.js +0 -3
- package/dist/chunk-OWOOWNJ5.js +0 -7
- package/dist/chunk-P42EIXTA.js +0 -2
- package/dist/chunk-PJFGPYTU.js +0 -2
- package/dist/chunk-PP7KNN7L.js +0 -2
- package/dist/chunk-PU7T5QYQ.js +0 -2
- package/dist/chunk-PWWAJSKV.js +0 -74
- package/dist/chunk-PZL5T7SU.js +0 -73
- package/dist/chunk-QBE3YX64.js +0 -23
- package/dist/chunk-QGVTFRY2.js +0 -7
- package/dist/chunk-QOJONDS7.js +0 -2
- package/dist/chunk-QU5XRYB5.js +0 -4
- package/dist/chunk-QUU5OBVK.js +0 -11
- package/dist/chunk-RBLQNW26.js +0 -20
- package/dist/chunk-RTQ7NEKG.js +0 -81
- package/dist/chunk-SQXRS7BG.js +0 -4
- package/dist/chunk-SSK6LDPC.js +0 -2
- package/dist/chunk-SZHGTCPP.js +0 -7
- package/dist/chunk-T4N4P2K5.js +0 -16
- package/dist/chunk-TA3QKLLU.js +0 -2
- package/dist/chunk-TEBQMNVI.js +0 -43
- package/dist/chunk-TPFHAQ2G.js +0 -2
- package/dist/chunk-TQPCBMWT.js +0 -5
- package/dist/chunk-TQZV7KV4.js +0 -2
- package/dist/chunk-TRNAEQ6P.js +0 -3
- package/dist/chunk-TY7CRN3Z.js +0 -2
- package/dist/chunk-UHFYCMZO.js +0 -35
- package/dist/chunk-UICY4GTQ.js +0 -7
- package/dist/chunk-UVGEWT4Y.js +0 -26
- package/dist/chunk-UXW33INU.js +0 -29
- package/dist/chunk-VMPRET3I.js +0 -5
- package/dist/chunk-VNLGKHS6.js +0 -6
- package/dist/chunk-VQILFTEH.js +0 -2
- package/dist/chunk-VUPHCS7Y.js +0 -57
- package/dist/chunk-VVZSBTSU.js +0 -23
- package/dist/chunk-VZRNID6A.js +0 -2
- package/dist/chunk-W5OXRYGE.js +0 -7
- package/dist/chunk-W6STWDQI.js +0 -57
- package/dist/chunk-W7CXK74K.js +0 -2
- package/dist/chunk-WB3WYIRE.js +0 -4
- package/dist/chunk-WDNVY4E7.js +0 -20
- package/dist/chunk-WK46TNUM.js +0 -3
- package/dist/chunk-WNTFFKAX.js +0 -12
- package/dist/chunk-WOIKCX6A.js +0 -2
- package/dist/chunk-WUN6KBHV.js +0 -2
- package/dist/chunk-WYCTJDVR.js +0 -2
- package/dist/chunk-WYPL7GF7.js +0 -2
- package/dist/chunk-XDAUYDFT.js +0 -2
- package/dist/chunk-XDQMU3BT.js +0 -2
- package/dist/chunk-XFA4SSO3.js +0 -3
- package/dist/chunk-XGZEP6GR.js +0 -8
- package/dist/chunk-XPDPNWTQ.js +0 -368
- package/dist/chunk-XRYABF57.js +0 -8
- package/dist/chunk-YBGKCQIS.js +0 -2
- package/dist/chunk-YEN6CYC7.js +0 -16
- package/dist/chunk-YF5IB2LF.js +0 -2
- package/dist/chunk-YI2AWIHC.js +0 -3
- package/dist/chunk-YPWBKGFU.js +0 -2
- package/dist/chunk-YPWHBBIS.js +0 -2
- package/dist/chunk-YSH6U3L4.js +0 -3
- package/dist/chunk-YU5DZUZI.js +0 -10
- package/dist/chunk-YWO5DDRC.js +0 -16
- package/dist/chunk-Z4CDXYNQ.js +0 -2
- package/dist/chunk-ZF5KHH7C.js +0 -2
- package/dist/chunk-ZOHS7AQV.js +0 -21
- package/dist/chunk-ZTI4SBFV.js +0 -3
- package/dist/code-MI6F2TTU.js +0 -2
- package/dist/code-result-json-FXALY4HE.js +0 -2
- package/dist/command-descriptors-P34VABY5.js +0 -343
- package/dist/dataflow-4KEMJPC6.js +0 -2
- package/dist/dependence-slice-R7FPWD5M.js +0 -2
- package/dist/deps-7EMQUYUT.js +0 -2
- package/dist/direct-navigation-6YO234F2.js +0 -3
- package/dist/entry-map-KOOLR26E.js +0 -2
- package/dist/files-OPIPJIGZ.js +0 -2
- package/dist/graph-evidence-Bjyky2V4.d.ts +0 -126
- package/dist/hierarchy-QPD2CAER.js +0 -2
- package/dist/imports-M6HUXRXC.js +0 -2
- package/dist/members-I5MEFOCT.js +0 -2
- package/dist/methods-5JYGGHXA.js +0 -2
- package/dist/next-anchor-candidates-BwMczMvX.d.ts +0 -90
- package/dist/output-continuation-command-UPQAAKBP.js +0 -3
- package/dist/output-pagination-3OFL2MJV.js +0 -19
- package/dist/project-reindex-UKKQ5PLS.js +0 -3
- package/dist/queries/anchors.d.ts +0 -123
- package/dist/queries/anchors.js +0 -2
- package/dist/queries/complexity-hotspots.d.ts +0 -40
- package/dist/queries/complexity-hotspots.js +0 -2
- package/dist/queries/convergence.d.ts +0 -33
- package/dist/queries/convergence.js +0 -2
- package/dist/queries/dataflow.d.ts +0 -77
- package/dist/queries/dataflow.js +0 -2
- package/dist/queries/deep-chains.d.ts +0 -5
- package/dist/queries/deep-chains.js +0 -2
- package/dist/queries/extract-candidates.d.ts +0 -52
- package/dist/queries/extract-candidates.js +0 -2
- package/dist/queries/isolated.d.ts +0 -24
- package/dist/queries/isolated.js +0 -2
- package/dist/queries/plan-context.d.ts +0 -33
- package/dist/queries/plan-context.js +0 -2
- package/dist/queries/reference-neighborhood.d.ts +0 -4
- package/dist/queries/reference-neighborhood.js +0 -2
- package/dist/queries/reference-reachability.d.ts +0 -48
- package/dist/queries/reference-reachability.js +0 -2
- package/dist/queries/self-audit.d.ts +0 -63
- package/dist/queries/self-audit.js +0 -2
- package/dist/queries/similar-chains.d.ts +0 -48
- package/dist/queries/similar-chains.js +0 -2
- package/dist/queries/slice.d.ts +0 -4
- package/dist/queries/slice.js +0 -2
- package/dist/queries/stale-abstractions.d.ts +0 -72
- package/dist/queries/stale-abstractions.js +0 -2
- package/dist/queries/system-map.d.ts +0 -449
- package/dist/queries/system-map.js +0 -2
- package/dist/queries/trace.js +0 -2
- package/dist/queries/twin-ab.d.ts +0 -66
- package/dist/queries/twin-ab.js +0 -2
- package/dist/queries/value-flow.d.ts +0 -43
- package/dist/queries/value-flow.js +0 -2
- package/dist/queries/wrapper-candidates.d.ts +0 -34
- package/dist/queries/wrapper-candidates.js +0 -2
- package/dist/refs-PSU4JZZW.js +0 -2
- package/dist/refs-pagination-JG6CJMRC.js +0 -2
- package/dist/slice-HYRATV64.js +0 -2
- package/dist/source-snippet-_wrcgmZc.d.ts +0 -15
- package/dist/stats-OOJ74B32.js +0 -2
- package/dist/surface-VTGDYWF5.js +0 -2
- package/dist/symbol-resolution-WD5EU5JE.js +0 -2
- package/dist/system-LRQNFOR2.js +0 -2
- package/dist/trace-F4B6OLL4.js +0 -2
- package/dist/value-flow-VRPZY72V.js +0 -2
- package/skills/concrete-plan/SKILL.md +0 -8
- package/skills/concrete-plan/agents/openai.yaml +0 -4
package/dist/chunk-VUPHCS7Y.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import{a as Z}from"./chunk-WOIKCX6A.js";import{p as vt}from"./chunk-DYGHBZ2N.js";import{d as gt}from"./chunk-KK7GPALL.js";import{b as ht}from"./chunk-NJITK2GP.js";import{A as xe,t as _}from"./chunk-N2ZSIIGR.js";import{a as ge,f as be,g as k,h as D,j as M,k as lt,l as X,n as pt,r as mt,s as ft,x as yt,y as G}from"./chunk-ODDUPDP7.js";import{A as st,B as ut,D as O,E as ct,G as dt,N as Se,z as ve}from"./chunk-ZOHS7AQV.js";import{c as ie,e as ae,g as ot,h as he,i as Me}from"./chunk-FESCRNVV.js";import{c as Q,i as re}from"./chunk-JWTGMPIT.js";function Re(e){let t=e.replaceAll("\\","/");return ht(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}import yn from"better-sqlite3";var Ne="scip_query_runtime_boundaries",W="scip_query_runtime_observations",Be="scip_query_runtime_relation_groups",Ie="scip_query_runtime_relation_participants";function hn(e,t){let n=new yn(e);try{n.exec(`
|
|
2
|
-
CREATE TABLE IF NOT EXISTS ${Ne} (
|
|
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
|
-
`),vn(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${Ne} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${W}`).run(),n.prepare(`DELETE FROM ${Ie}`).run(),n.prepare(`DELETE FROM ${Be}`).run();let r=n.prepare(`INSERT INTO ${W}
|
|
9
|
-
(id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
|
|
10
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let s of t.observations)r.run(s.id,s.protocol,s.action,s.role,s.strength,s.sourceScope,s.resolution,s.source.file,s.source.startLine,s.source.endLine,s.owner.symbol,JSON.stringify(s));let i=n.prepare(`INSERT INTO ${Be} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),a=n.prepare(`INSERT INTO ${Ie} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let s of t.relationGroups){i.run(s.id,s.protocol,s.joinRule,s.normalizedKey,JSON.stringify(s));for(let o of s.producerIds)a.run(s.id,o,"producer");for(let o of s.consumerIds)a.run(s.id,o,"consumer");for(let o of s.declarationIds)a.run(s.id,o,"declaration")}})()}finally{n.close()}}function gn(e,t={}){if(!bn(e,W))return bt(e)?.observations??[];let n=[],r=[];return Ce(n,r,"protocol",t.protocols),Ce(n,r,"action",t.actions),Ce(n,r,"source_scope",t.sourceScopes),Ce(n,r,"file",t.files),e.all(`SELECT payload FROM ${W}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(a=>Sn(a.payload))}function vn(e){e.exec(`
|
|
11
|
-
CREATE TABLE IF NOT EXISTS ${W} (
|
|
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 ${W}(protocol, action, source_scope);
|
|
27
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_observations_file_line
|
|
28
|
-
ON ${W}(file, start_line);
|
|
29
|
-
|
|
30
|
-
CREATE TABLE IF NOT EXISTS ${Be} (
|
|
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 ${Be}(protocol, join_rule, normalized_key);
|
|
39
|
-
|
|
40
|
-
CREATE TABLE IF NOT EXISTS ${Ie} (
|
|
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 ${Ie}(observation_id, participant_role);
|
|
48
|
-
`)}function bn(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function Ce(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function Sn(e){try{return[JSON.parse(e)]}catch{return[]}}function bt(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",Ne))return null;let n=e.get(`SELECT schema_version, payload FROM ${Ne} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}import{createHash as fe}from"crypto";import{setImmediate as Yr}from"timers/promises";import{createRequire as Jr}from"module";import{createHash as Dn}from"crypto";var Pe=8;function ee(e,t,n){return Ge(St(e,t,Ue(n),0,new Set))}function ze(e,t,n){return He(e,t,n,0,new Set)}function St(e,t,n,r,i){if(r>Pe)return[];let a=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return a?xt(e,t,a[1],a[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?Rt(e,t,n,r,i):[]}function xt(e,t,n,r,i,a){let s=[];for(let o of He(e,t,n,i+1,new Set(a))){let l=M(o.initializer);for(let u of l.namedChildren){if(u.type==="pair"){let d=u.childForFieldName("key")??u.namedChild(0);if(Bn(d)!==r)continue;let c=u.childForFieldName("value")??u.namedChild(1);c&&s.push(...St(e,o.definition.relativePath,Ue(c.text),i+1,new Set(a)));continue}if(/(?:method|function)/u.test(u.type)){if((u.childForFieldName("name")??u.namedChild(0))?.text!==r)continue;let c=Cn(e,o.definition.relativePath,r,u);s.push(...c.length>0?c:[xn(o.definition,r,u)]);continue}if(u.type==="spread_element"){let d=u.namedChild(0);if(!d)continue;for(let c of He(e,o.definition.relativePath,Ue(d.text),i+1,new Set(a)))s.push(...xt(e,c.definition.relativePath,c.definition.leaf,r,i+1,new Set(a)))}}}return Ge(s)}function xn(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function He(e,t,n,r,i){return r>Pe||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:Rt(e,t,n,r,i).flatMap(a=>{let s=O(e,a.relativePath)?.rootNode,o=s?Nn(s,a.leaf):null;return o?[{definition:a,initializer:o}]:[]})}function Rt(e,t,n,r,i){if(r>Pe)return[];let a=`${t}\0${n}`;if(i.has(a))return[];i.add(a);let s=_(e,t).filter(u=>u.leaf===n);if(s.length>0)return s;let o=Rn(e,t,n);if(o.length>0)return o;let l=G(e,t).find(u=>u.localName===n&&u.sourcePath);if(l?.sourcePath){let u=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return Ve(e,l.sourcePath,u,r+1,new Set(i))}return Ve(e,t,n,r+1,new Set(i))}function Rn(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(pt(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function Ve(e,t,n,r,i){if(r>Pe)return[];let a=_(e,t).filter(s=>s.leaf===n);return a.length>0?a:Ge(yt(e,t).flatMap(s=>s.sourcePath?s.kind==="named"&&!s.names.includes(n)?[]:Ve(e,s.sourcePath,n,r+1,new Set(i)):[]))}function Cn(e,t,n,r){return _(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Nn(e,t){let n=null;return k(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Bn(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ue(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Ge(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}var In=8;function V(e,t){return t?te(e,t,0,new Set):null}function te(e,t,n,r){if(n>In)return U(t,"value-evaluation-depth");let i=M(t),a=_n(i);if(a)return $n(e.file,i,a.term,a.value,a.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(u=>te(e,u,n+1,new Set(r)));if(l.length>=2&&l.every(u=>u!==null)){let u={kind:"concat",parts:l.map(c=>c.term)},d=l.map(c=>c.value).join("");return Ln(e.file,i,u,d,l.some(c=>c.precision!=="literal")?"constrained-pattern":"literal",l)}}let s=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))return Fn(e,s,i,n,r);let o=kn(i);return o?Tn(e,o.base,o.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Pn(e,i,n,r):U(i,`unsupported-expression:${i.type}`)}function Pn(e,t,n,r){let a=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",s=wn(e,a);if(s.length!==1)return U(t,s.length===0?"call-target-unresolved":"call-target-ambiguous");let o=s[0],l=`${o.relativePath}\0${o.symbol}`;if(r.has(l))return U(t,"call-return-cycle");let u=O(e.db,o.relativePath)?.rootNode;if(!u)return U(t,"call-target-unparsed");let d=D(u,o.startLine,o.endLine);if(!d)return U(t,"call-target-syntax-unavailable");let c=En(d);if(!c)return U(t,"call-return-not-single-expression");let p=new Set(r);p.add(l);let m=te({db:e.db,file:o.relativePath,root:u},c,n+1,p);return m?we(t,"bounded-call-return",m,o.symbol):U(t,"call-return-unresolved")}function wn(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=_(e.db,e.file).filter(s=>s.isFunctionLike&&s.leaf===t);if(i.length>0)return i;let a=G(e.db,e.file).find(s=>s.localName===t&&s.sourcePath&&s.kind!=="namespace");return a?.sourcePath?Z(e.db,a.sourcePath,a.importedName==="default"?t:a.importedName).filter(s=>s.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=G(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?Z(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function En(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return Nt(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function Nt(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)Nt(e,r,n)}}function Fn(e,t,n,r,i){let a=`${e.file}\0${t}`;if(i.has(a))return U(n,"value-cycle");i.add(a);let s=je(e.root,t);if(s){let g=te(e,s,r+1,i);return g?we(n,"local-constant",g):U(n,"non-foldable-local")}let o=G(e.db,e.file).find(g=>g.localName===t&&g.sourcePath);if(!o?.sourcePath)return H(n,t,"unresolved-identifier");if(o.kind==="namespace")return H(n,t,"namespace-import-requires-property");let l=o.importedName==="default"?t:o.importedName,u=Z(e.db,o.sourcePath,l);if(u.length!==1)return H(n,t,u.length===0?"import-definition-missing":"import-definition-ambiguous");let d=u[0],c=O(e.db,d.relativePath)?.rootNode;if(!c)return H(n,d.symbol,"import-definition-unparsed");let p=je(c,d.leaf);if(!p)return H(n,d.symbol,"import-definition-non-value");let m=te({db:e.db,file:d.relativePath,root:c},p,r+1,i);return m?we(n,"imported-constant",m,d.symbol):H(n,d.symbol,"import-value-unresolved")}function Tn(e,t,n,r,i,a){let s=G(e.db,e.file).find(m=>m.localName===t&&m.sourcePath),o=e.file,l=t,u;if(s?.sourcePath){s.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=s.importedName==="default"?t:s.importedName;let m=Z(e.db,s.sourcePath,l);if(m.length!==1)return H(r,`${t}.${n.join(".")}`,m.length===0?"member-definition-missing":"member-definition-ambiguous");o=m[0].relativePath,l=m[0].leaf,u=m[0].symbol}let d=o===e.file?e.root:O(e.db,o)?.rootNode;if(!d)return H(r,u??t,"member-definition-unparsed");let c=je(d,l);if(!c)return H(r,u??t,"member-base-non-value");for(let m of n){let g=M(c);if(c=An(g,m),!c)return H(r,u??`${t}.${n.join(".")}`,`member-property-missing:${m}`)}let p=te({db:e.db,file:o,root:d},c,i+1,a);return p?we(r,"member-constant",p,u):H(r,u??t,"member-value-unresolved")}function _n(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],a=0,s=/\$\{([^}]*)\}/gu;for(let o of r.matchAll(s)){let l=o.index??0;l>a&&i.push({kind:"literal",value:r.slice(a,l)}),i.push({kind:"unknown",reason:`template-hole:${o[1]?.trim()||"expression"}`}),a=l+o[0].length}return a<r.length&&i.push({kind:"literal",value:r.slice(a)}),{term:{kind:"pattern",language:"template",value:r.replace(s,"{}")},value:r.replace(s,"{}"),precision:"constrained-pattern"}}function $n(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Ee("direct-literal","direct",e,t)}}function Ln(e,t,n,r,i,a){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Ee("constant-concatenation","mechanically-derived",e,t),inputFactIds:a.flatMap(s=>s.derivation.inputFactIds),sourceSpans:a.flatMap(s=>s.derivation.sourceSpans)}}}function we(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function H(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Ee(n,"heuristic","",e)}}function U(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Ee(t,"heuristic","",e)}}function Ee(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function kn(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}var Ct=new WeakMap;function On(e){let t=Ct.get(e);if(t)return t;let n=new Map;return k(e,r=>{if(r.type!=="variable_declarator")return;let a=(r.childForFieldName("name")??r.namedChild(0))?.text.trim();if(!a||n.has(a))return;let s=r.parent;if(!s||s.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(s.text))return;let o=r.childForFieldName("value")??r.namedChild(1);o&&n.set(a,o)}),Ct.set(e,n),n}function je(e,t){return On(e).get(t)??null}function An(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}var Mn=new WeakMap,_t=new Set(["delete","get","head","options","patch","post","put"]),Hn=/(?:^|\.)(?:app|router|server)$/u,Vn=new Set(["findFirst","findMany","findUnique","from","get","select"]),Un=new Set(["create","delete","insert","remove","update","upsert"]),zn=new Set(["execute","query","raw"]),Bt=/(?:\b(?:name|id)|['"`](?:name|id)['"`])\s*:/u,It=/(?:^\s*|[,{]\s*)(?:async\s+)?['"`]?(?:execute|handler|invoke|run)['"`]?\s*(?::|\([^)]*\)\s*\{)/mu,Pt=/\b[A-Za-z_$][\w$-]*[_-][\w$-]*\s*\(/u,wt=/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s+[A-Za-z_$][\w$-]*\s*\(/iu,Xe=[Kn(),qn(),Gn(),Xn(),Wn(),Yn(),Qn()],Ke=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function Gn(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=jn(e.source),n=[];return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=t.direct.get(i),s=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),o=s&&t.namespaces.has(s[1])?s[2]:null,l=a??o;if(!l||!Ke.has(l))return;let u=Y(r),d=A(u[0],e)??{value:u[0]?.text.trim()||"<missing>",evidence:"expression"},c=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(T(e,r,"builtin.node-child-process",c,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...d}],"exact","node-child-process-import"))}),n}}}function jn(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let l of e.matchAll(i))for(let u of(l[1]??"").split(",")){let d=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[1])}let a=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(a))for(let u of(l[1]??"").split(",")){let d=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[1])}let s=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(s))n.add(l[1]);let o=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(o))n.add(l[1]);return{direct:t,namespaces:n}}function L(e,t,n,r){let i=oe(r,"runtime-boundaries.context.ast",t,()=>n===void 0?O(e,t):ct(e,t,n));if(!i)return null;let a=i.rootNode;n!==void 0&&Mn.set(a,i);let s=n??he(e,t),o,l,u,d=()=>(l!==void 0||(l=oe(r,"runtime-boundaries.context.callable-sites",t,()=>{let c=ve(t);return(c?ft(a,c):null)??mt(e,t)})),l);return{db:e,file:t,source:s,root:a,get constants(){return u??=oe(r,"runtime-boundaries.context.constants",t,()=>ar(a)),u},ownerAt:c=>{let m=(o??=oe(r,"runtime-boundaries.context.definitions",t,()=>_(e,t,{rangeCorrectionEvidence:{source:s,callables:d()}},(f,y)=>oe(r,`runtime-boundaries.context.definitions.${f}`,t,y)))).filter(f=>f.startLine<=c&&f.endLine>=c).sort((f,y)=>f.endLine-f.startLine-(y.endLine-y.startLine)||f.startLine-y.startLine)[0];if(m)return{file:t,symbol:m.symbol,name:m.leaf,startLine:m.startLine,endLine:m.endLine};let b=(d()??[]).filter(f=>f.startLine<=c&&f.endLine>=c).sort((f,y)=>f.endLine-f.startLine-(y.endLine-y.startLine)||f.startLine-y.startLine)[0];return{file:t,symbol:null,name:b?.name??null,startLine:b?.startLine??c,endLine:b?.endLine??c}}}}function oe(e,t,n,r){return e?e(t,r,{file:n}):r()}function qn(){return{id:"builtin.effect-httpapi",supports:e=>se(e,"HttpApiEndpoint").size>0||se(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=se(e.source,"HttpApiEndpoint"),r=se(e.source,"HttpApiGroup"),i=se(e.source,"HttpApiBuilder");return q(e.root,"call_expression",a=>{let s=$t(a);if(!s)return;let o=Y(a);if(n.has(s.receiver)&&_t.has(s.member)){let b=A(o[0],e),f=A(o[1],e),y=Ft(a,r,"make",0,e);if(!b||!f||!y)return;let v=s.member.toUpperCase();t.push(T(e,a,"builtin.effect-httpapi","http.handle",[{name:"method",value:v,evidence:"literal"},{name:"path",...f}],z([{name:"path",...f}]),"effect-httpapi-endpoint-declaration")),t.push(T(e,a,"builtin.effect-httpapi","framework.declare",qe(y,b),z(qe(y,b)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(s.member))return;let l=Ft(a,i,"group",1,e),u=A(o[0],e),d=o[1];if(!l||!u||!d)return;let c=qe(l,u),p=ee(e.db,e.file,d.text),m=T(e,a,"builtin.effect-httpapi","framework.handle",c,p.length===1?z(c):"candidate","effect-httpapi-handler-registration"),g=p[0];p.length===1&&g&&(m.owner={file:g.relativePath,symbol:g.symbol,name:g.leaf,startLine:g.startLine,endLine:g.endLine}),t.push(m)}),t}}}function qe(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function se(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(r)){let s=a[2]??"";if(Et(s))for(let o of(a[1]??"").split(",")){let l=o.trim().replace(/^type\s+/u,""),u=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(l);u?.[1]===t&&n.add(u[2]??u[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(i)){let s=a[2]??"";s.endsWith(`/${t}`)&&Et(s)&&n.add(a[1])}return n}function Et(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function Ft(e,t,n,r,i){let a=e.parent;for(;a;){if(a.type==="call_expression"){let s=Tt(a,t,n,r,i);if(s)return s;let o=a.childForFieldName("function")??a.namedChild(0),l=null;if(o&&We(o,u=>{!l&&u.type==="call_expression"&&(l=Tt(u,t,n,r,i))}),l)return l}a=a.parent}return null}function Tt(e,t,n,r,i){let a=$t(e);return!a||a.member!==n||!t.has(a.receiver)?null:A(Y(e)[r],i)}function $t(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function Kn(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||le(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return q(e.root,["decorator","call_expression"],n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!le(e.source,["fastapi","flask"]))return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=ue(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",a=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",s=Y(n);if(i==="route"&&le(e.source,["axum"])){let p=A(s[0],e),m=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(s[1]?.text??"")?.[1];if(!p||!m)return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:m.toUpperCase(),evidence:"literal"},{name:"path",...p}],z([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=A(s[0],e);if(!p)return;let g=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(s[1]?.text??"")?.[1]?.toUpperCase()??(s[1]?null:"GET"),b=[...g?[{name:"method",value:g,evidence:"literal"}]:[],{name:"path",...p}];t.push(T(e,n,"builtin.http","http.request",b,g?z(b):"candidate","call-expression"));return}if(!_t.has(i))return;let o=A(s[0],e);if(!o)return;let l=i.toUpperCase();if(Hn.test(a)&&le(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"framework-adapter"));return}let d=nr(e.source,["axios"]),c=a.split(".")[0]??"";d.has(c)&&t.push(T(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"client-adapter"))}),t}}}function Xn(){return{id:"builtin.capability-registry",supports:e=>Bt.test(e)&&It.test(e)||Pt.test(e)||wt.test(e),extract:e=>{let t=[],n=new Set,r=[];return Bt.test(e.source)&&It.test(e.source)&&r.push("pair"),(Pt.test(e.source)||wt.test(e.source))&&r.push("string","string_literal","template_string"),q(e.root,r,i=>{if(i.type==="pair"){let s=i.childForFieldName("key")??i.namedChild(0),o=i.childForFieldName("value")??i.namedChild(1),l=s?.text.replace(/^['"`]|['"`]$/gu,"");if(l!=="name"&&l!=="id")return;let u=Lt(o,e),d=sr(i);if(!u||u.evidence!=="literal"||!d)return;let c=`handle\0${u.value}\0${d.startPosition.row}`;if(n.has(c))return;n.add(c),t.push(T(e,d,"builtin.capability-registry","registry.handle",[{name:"key",...u}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(i.type))return;let a=i.text.replace(/^['"`]|['"`]$/gu,"");for(let s of a.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let o=s[1];if(!Zn(a,o,s.index))continue;let l=`reference\0${o}\0${i.startPosition.row}`;n.has(l)||(n.add(l),t.push(T(e,i,"builtin.capability-registry","registry.reference",[{name:"key",value:o,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function Zn(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function Wn(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return q(e.root,["pair","call_expression"],n=>{if(n.type==="pair"){let a=or(n);if(!a)return;let s=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),l=Lt(s,e);if(!l||!o||!kt(o))return;let u=Ze(o)?"exact":"candidate";t.push(T(e,n,"builtin.registry","registry.handle",[{name:"registry",value:a,evidence:"identifier"},{name:"key",...l}],z([{name:"key",...l}],u),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(T(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function Yn(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=ur(e.root);return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=i.split("."),s=a.at(-1)??"",o=Y(r),l=o[0]?.text??"",u=lr(s,l);if(!u)return;let d=Ot(a,n);if(!d)return;let c=Jn(o[0],e)??cr(l),p=dr(d,a,s,c);if(!p)return;let m=s==="insert"?"persistence-insert":u==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(l)?"persistence-skip-locked-claim":"persistence-adapter";t.push(T(e,r,"builtin.persistence",u,[{name:"resource",...p}],z([{name:"resource",...p}]),m))}),t}}}function Jn(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:A(e,t)}function Qn(){return{id:"builtin.queue",supports:e=>le(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return q(e.root,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".").at(-1)??"",a=Y(n),s=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!s)return;let o=i==="send"||i==="subscribe"?rr(a[0],"topic",e):A(a[0],e);o&&t.push(T(e,n,"builtin.queue",s,[{name:"address",...o}],z([{name:"address",...o}]),"framework-adapter"))}),t}}}function T(e,t,n,r,i,a,s){let o=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${Dn("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:o,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:s,strength:a,protocol:r.split(".")[0]??r,role:er(r),executionDomain:tr(e.file),derivation:{kind:a==="candidate"?"heuristic":a==="derived"?"mechanically-derived":"direct",rule:s,ruleVersion:"1",inputFactIds:i.flatMap(u=>u.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(u=>u.derivation?.sourceSpans??[])]},valuePrecision:i.some(u=>u.evidence==="expression")?"unknown":i.some(u=>u.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:Re(e.file)}}function er(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function tr(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function le(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function nr(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),a=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let s of e.matchAll(a)){let o=s[1]??s[2];o&&n.add(o)}}return n}function Fe(e,t,n,r,i,a,s){return T(e,t,n,r,i,a,s)}function ue(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function Y(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function A(e,t){let n=V(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function rr(e,t,n){if(!e)return null;let r=e.namedChildren.find(a=>a.type!=="pair"?!1:(a.childForFieldName("key")??a.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return A(i,n)}function Lt(e,t){if(!e)return null;let n=A(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function z(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function ir(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function ar(e){let t=new Map;return We(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let a=ir(i);a!==null&&t.set(r.text,a)}),t}function or(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function Ze(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function kt(e){return Ze(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function sr(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),a=n.childForFieldName("value")??n.namedChild(1),s=i?.text.replace(/^['"`]|['"`]$/gu,"");if(s&&["execute","handler","invoke","run"].includes(s)&&a&&kt(a))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function Ot(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function lr(e,t){if(Vn.has(e))return"database.read";if(Un.has(e))return"database.write";if(!zn.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function ur(e){let t=new Set;return q(e,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!Ot(i)))for(let a of Y(n)){if(!Ze(a))continue;let o=(a.childForFieldName("parameters")??a.namedChildren.find(u=>/parameters/u.test(u.type)))?.namedChildren[0],l=o?lt(o):null;l&&t.add(l)}}),t}function cr(e){let t=At(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function dr(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let a=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return a?{value:a,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=At(r.value);return i?{value:i,evidence:r.evidence}:null}function At(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function We(e,t){t(e);for(let n of e.namedChildren)We(n,t)}function q(e,t,n){for(let r of be(e,t))n(r)}var pr=Q("resolved-call-syntax",{clearGroups:[]}),Ye=Q("resolved-call-sites",{clearGroups:[]}),mr=Q("resolved-call-sites-reference-evidence",{clearGroups:[]});function Je(e,t){return Ye.get(e,t.symbolId,()=>Mt(e,t,fr(e,t)))}function Dt(e,t){let n=[...new Map(t.map(a=>[a.symbolId,a])).values()],r=n.filter(a=>!Ye.has(e,a.symbolId)),i=Ht(e,r);return new Map(n.map(a=>[a.symbolId,Ye.get(e,a.symbolId,()=>Mt(e,a,i.get(a.symbolId)??[]))]))}function Mt(e,t,n){let r=[],i=[],a=new Set,s=new Set;for(let o of n){a.add(o.file);let l=pr.get(e,o.file,()=>hr(e,o.file));if(!l){i.push({callee:t,file:o.file,line:o.startLine,reason:"ast-unavailable",candidates:0,referenceProvenance:o.provenance});continue}let u=(l.byLeaf.get(t.leaf)??[]).filter(({callNode:p})=>p.startPosition.row<=o.endLine&&p.endPosition.row>=o.startLine);if(u.length!==1){i.push({callee:t,file:o.file,line:o.startLine,reason:u.length===0?"call-not-found":"ambiguous-call",candidates:u.length,referenceProvenance:o.provenance});continue}let d=u[0],c=`${o.file}\0${d.callNode.startIndex}\0${d.callNode.endIndex}`;s.has(c)||(s.add(c),r.push({callee:t,caller:xe(_(e,o.file),d.callNode.startPosition.row),file:o.file,line:d.callNode.startPosition.row,startLine:d.callNode.startPosition.row,endLine:d.callNode.endPosition.row,targetText:d.targetNode.text,callNode:d.callNode,targetNode:d.targetNode,arguments:d.arguments,referenceProvenance:o.provenance}))}return{sites:r,unresolved:i,filesVisited:a.size}}function fr(e,t){return Ht(e,[t]).get(t.symbolId)??[]}function Ht(e,t){if(!yr(e))return new Map(t.map(r=>[r.symbolId,vt(e,r,{semantic:!1}).map(i=>({file:i.file,startLine:i.line,endLine:i.line,provenance:i.provenance}))]));let n=new Map;for(let r of gt(e,t.map(i=>i.symbolId))){let i=n.get(r.symbol_id)??[];i.push({file:r.relative_path,startLine:r.chunk_start,endLine:r.chunk_end,provenance:"scip-reference-chunk"}),n.set(r.symbol_id,i)}return new Map(t.map(r=>[r.symbolId,n.get(r.symbolId)??[]]))}function yr(e){return mr.get(e,"project",()=>!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))}function hr(e,t){let n=O(e,t)?.rootNode;if(!n)return null;let r=new Map;for(let i of be(n,["call_expression","call"])){let a=i.childForFieldName("function")??i.namedChild(0);if(!a)continue;let s=dt(a);if(!s)continue;let o=i.childForFieldName("arguments")??i.namedChildren.find(d=>d.type==="arguments"),l={callNode:i,targetNode:a,arguments:o?.namedChildren??[]},u=r.get(s);u?u.push(l):r.set(s,[l])}return{byLeaf:r}}var gr=Q("call-parameter-value-flow",{clearGroups:[]});function ce(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return gr.get(e,n,()=>vr(e,t))}function de(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function vr(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-unavailable",proof:n}))};let r=O(e,t.caller.relativePath)?.rootNode,i=r?D(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let a=X(i),s=[],o=[];return t.arguments.forEach((l,u)=>{let d=l.text.trim(),c=a.indexOf(d);c>=0?s.push({calleePosition:u,callerPosition:c,argumentText:d,proof:n}):o.push({calleePosition:u,argumentText:d,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:s,unknown:o}}var br=8,Sr=8;function Ut(e,t,n=[]){let r=[],i=xr(e,n,r),a=i.summaries,s=Rr(e,t,a,r),o=Cr(e,t,r);return{observations:$r([...s.observations,...o]),bodySummaries:a.size,discriminatorSummaries:s.summaries,filesInspected:i.filesInspected,errors:r}}function xr(e,t,n){let r=new Map,i=[],a=new Map,s=o=>{if(a.has(o))return a.get(o)??null;let l=L(e,o);return a.set(o,l),l};for(let o of t){let l={...o,depth:0,proofSpans:[{file:o.definition.relativePath,startLine:o.definition.startLine,endLine:o.definition.endLine}]};r.set(o.definition.symbol,l),i.push(l)}for(;i.length>0;){let o=i.shift();if(!(o.depth>=br))try{for(let l of Je(e,o.definition).sites){if(!s(l.file))continue;let d=l.caller;if(!d)continue;let c=de(ce(e,l),o.parameterIndexes);if(c.length===0)continue;let p={definition:d,parameterIndexes:Xt(c),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]};Pr(r,p)&&i.push(r.get(d.symbol))}}catch(l){n.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{summaries:r,filesInspected:new Set(t.map(o=>o.definition.relativePath)).size}}function Rr(e,t,n,r){let i=new Map,a=[],s=[];for(let o of t){if(o.action!=="http.request"||o.strength==="candidate"||o.sourceScope!=="production")continue;let l=Gt(o);if(!l)continue;let u=L(e,o.source.file);if(!u)continue;let d=jt(u.root,o.source.startLine),c=d.find(v=>v.startPosition.row===o.source.startLine)??d[0];if(!c)continue;let p=et(c);if(!p)continue;let m=ee(e,o.source.file,p.text);if(m.length!==1)continue;let g=n.get(m[0].symbol);if(!g)continue;let b=o.owner.symbol?_(e,o.owner.file).find(v=>v.symbol===o.owner.symbol):null;if(!b)continue;let f=wr(u,b),y=Te(c);for(let v of g.parameterIndexes){let R=Fr(u,y[v]);if(R)for(let x of Tr(R)){let h=qt(x),S=Kt(x);if(!h||!S)continue;let B=f.indexOf(S.text.trim());if(B>=0){let N={definition:b,carrier:l,field:h,parameterIndex:B,depth:0,proofObservationIds:[o.id],proofSpans:[o.source,{file:o.source.file,startLine:x.startPosition.row,endLine:x.endPosition.row}]},F=Vt(N);i.has(F)||(i.set(F,N),a.push(N));continue}let I=V(u,S);!I||I.evidence==="expression"||s.push(Qe(u,x,"carrier.publish",l,h,I.value,[o.id]))}}}for(;a.length>0;){let o=a.shift();if(!(o.depth>=Sr))try{for(let l of Je(e,o.definition).sites){let u=L(e,l.file);if(!u)continue;let d=l.callNode,c=Te(d)[o.parameterIndex];if(!c)continue;let p=V(u,c);p&&p.evidence!=="expression"&&s.push(Qe(u,d,"carrier.publish",o.carrier,o.field,p.value,o.proofObservationIds));let m=l.caller;if(!m)continue;let g=ce(e,l).transfers.find(y=>y.calleePosition===o.parameterIndex)?.callerPosition;if(g===void 0)continue;let b={...o,definition:m,parameterIndex:g,depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},f=Vt(b);i.has(f)||(i.set(f,b),a.push(b))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{observations:s,summaries:i.size}}function Cr(e,t,n){let r=[],i=t.filter(a=>a.action==="registry.handle"&&a.strength!=="candidate"&&a.sourceScope==="production");for(let a of t){if(a.action!=="http.handle"||a.strength==="candidate"||a.sourceScope!=="production")continue;let s=Gt(a);if(!s)continue;let o=L(e,a.source.file);if(!o)continue;let l=jt(o.root,a.source.startLine)[0];if(l)for(let u of Te(l).slice(1)){let d=ee(e,a.source.file,u.text);for(let c of d)try{let p=L(e,c.relativePath);if(!p)continue;let m=D(p.root,c.startLine,c.endLine);if(!m)continue;k(m,g=>{if(g.type!=="call_expression")return;let b=et(g);if(!b)return;let f=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(b.text.trim());if(!f)return;let y=f[1],v=f[2],R=Br(e,p,c,v);if(!R)return;let x=Ir(e,c.relativePath,y);for(let h of i){let S=h.keyParts.find(F=>F.name==="registry")?.value,B=h.keyParts.find(F=>F.name==="key")?.value;if(!S||!B||!x.some(F=>F.file===h.source.file&&F.binding===S))continue;let I=L(e,h.source.file),N=I?Er(I.root,h.source.startLine):null;!I||!N||r.push(Qe(I,N,"carrier.consume",s,R,B,[a.id,h.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${c.relativePath}: ${tt(p)}`)}}}return r}function zt(e){let t=_(e.db,e.file),n=new Map;return k(e.root,r=>{if(r.type!=="pair"||qt(r)?.toLowerCase()!=="body")return;let i=Kt(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let a=xe(t,r.startPosition.row),s=Nr(r);if(!a||!s)return;let o=X(s),l=new Set;_r(i,o,l);let u=n.get(a.symbol)??new Set;o.forEach((d,c)=>{d&&l.has(d)&&u.add(c)}),u.size>0&&n.set(a.symbol,u)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[{definition:r,parameterIndexes:[...i].sort((a,s)=>a-s)}]:[]})}function Nr(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function Br(e,t,n,r){let i=D(t.root,n.startLine,n.endLine);if(!i)return null;let a=new RegExp(`\\.body\\??\\.${ge(r)}\\b`,"u");if(a.test(i.text))return r;let s=null;if(k(i,d=>{if(s||d.type!=="variable_declarator")return;let c=d.childForFieldName("name")??d.namedChild(0),p=d.childForFieldName("value")??d.namedChild(1);!c||!p||!new RegExp(`(?:^|[,{}])\\s*${ge(r)}\\s*(?:[,}]|$)`,"u").test(c.text)||p.type==="call_expression"&&(s=et(p)?.text??null)}),!s)return null;let o=ee(e,n.relativePath,s);if(o.length!==1)return null;let l=L(e,o[0].relativePath),u=l?D(l.root,o[0].startLine,o[0].endLine):null;return u&&a.test(u.text)&&new RegExp(`\\b${ge(r)}\\s*[,}]`,"u").test(u.text)?r:null}function Ir(e,t,n){let r=[];for(let i of ze(e,t,n)){let a=M(i.initializer);if(a.type==="call_expression")for(let s of Te(a)){let o=s.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(o))for(let l of ze(e,i.definition.relativePath,o))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Qe(e,t,n,r,i,a,s){let l=Fe(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:a,evidence:"constant",term:{kind:"literal",value:a}}],"derived","http-body-registry-discriminator");return l.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...s],sourceSpans:[l.source]},l}function Gt(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function Pr(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Xt([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function Vt(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function wr(e,t){let n=D(e.root,t.startLine,t.endLine);return n?X(n):[]}function Er(e,t){let n=null;return k(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function jt(e,t){let n=[];return k(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function et(e){return e.childForFieldName("function")??e.namedChild(0)}function Te(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Fr(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return M(t);let r=null;return k(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),r?M(r):M(t)}function Tr(e){let t=M(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function qt(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Kt(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function _r(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function Xt(e){return[...new Set(e)].sort((t,n)=>t-n)}function $r(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function tt(e){return e instanceof Error?e.message:String(e)}import{createHash as Lr}from"crypto";function Zt(e,t){let n=new Map;for(let a of t){if(a.action!=="http.handle"||a.sourceScope!=="production")continue;let s=n.get(a.source.file)??[];s.push(a),n.set(a.source.file,s)}let r=[],i=kr(e);for(let a of i.mounts)for(let s of a.targetFiles)for(let o of n.get(s)??[]){let l=o.keyParts.find(p=>p.name==="path");if(!l||l.evidence==="expression")continue;let u=Ar(a.prefix.value,l.value),d=o.keyParts.map(p=>p.name==="path"?{name:"path",value:u,evidence:"constant",term:{kind:"concat",parts:[a.prefix.term??{kind:"literal",value:a.prefix.value},l.term??{kind:"literal",value:l.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line},...a.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:p),c=`${o.id}\0${a.file}\0${a.line}\0${u}`;r.push({...o,id:`boundary:${Lr("sha256").update(c).digest("hex").slice(0,16)}`,keyParts:d,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line}]},resolution:"unresolved"}),o.strength="candidate",o.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function kr(e){let t=[],n=Se(e);for(let r of n){let i=he(e,r);if(!Dr(i))continue;let a=L(e,r);a&&Wt(a.root,s=>{if(s.type!=="call_expression")return;let o=s.childForFieldName("function")??s.namedChild(0);if(!o||!o.text.replace(/\s+/gu,"").endsWith(".use"))return;let l=Mr(s);if(l.length<2)return;let u=V(a,l[0]);if(!u||u.evidence==="expression")return;let d=Or(e,r,l[1]);d.length!==0&&t.push({file:r,line:s.startPosition.row,prefix:{value:u.value,evidence:u.evidence,term:u.term,derivation:u.derivation},targetFiles:d})})}return{mounts:t,filesInspected:n.length}}function Or(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let a=G(e,t).find(l=>l.localName===i&&l.sourcePath);if(!a?.sourcePath)return[t];if(a.kind==="namespace")return[a.sourcePath];let s=a.importedName==="default"?i:a.importedName,o=Z(e,a.sourcePath,s);return[...new Set(o.map(l=>l.relativePath))]}function Ar(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function Dr(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function Mr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Wt(e,t){t(e);for(let n of e.namedChildren)Wt(n,t)}import{createHash as Hr}from"crypto";function _e(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}var Le=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),Vr=8,Yt=ie({kind:"runtime-boundary-http-roles",invalidation:ae("runtime-boundary-http-roles"),serialize:jr,deserialize:qr});function en(e,t,n){let r=n??((f,y)=>y()),i=new Map,a=[],s=[],o=new Set,l=[],u=[],d=new Map,c=new Map,p=new Map,m=f=>{if(d.has(f))return d.get(f)??null;let y=L(e,f);return d.set(f,y),y},g=f=>{let y=c.get(f);if(y)return y;let v=_(e,f);return c.set(f,v),v},b=(f,y)=>{let v=p.get(f.file);if(!v){let h=re(e,f.file,f.source),S=Yt.read(e,f.file,h)??[];v={contentHash:h,roles:new Map(S.map(B=>[B.symbol,B])),dirty:!1},p.set(f.file,v)}let R=v.roles.get(y.symbol);if(R)return R;let x=Gr(f,y);return v.roles.set(y.symbol,{symbol:y.symbol,...x}),v.dirty=!0,x};for(r("runtime-boundaries.http-summary.seed",()=>{for(let f of t){if(f.action!=="http.request"||!f.owner.symbol||f.evidence!=="call-expression"&&f.evidence!=="client-adapter")continue;let y=g(f.owner.file).find(h=>h.symbol===f.owner.symbol);if(!y)continue;let v=m(y.relativePath);if(!v)continue;let R=b(v,y),x={definition:y,...R,constantMethods:f.keyParts.flatMap(h=>h.name==="method"&&h.evidence!=="expression"&&Le.has(h.value.toUpperCase())?[h.value.toUpperCase()]:[]),depth:0,proofObservationIds:[f.id],proofSpans:[f.source]};Qt(i,x)&&a.push(i.get(y.symbol))}});a.length>0;){let f=a.splice(0,a.length),y=r("runtime-boundaries.http-summary.resolve-call-sites",()=>Dt(e,f.map(v=>v.definition)),{batchSize:f.length});r("runtime-boundaries.http-summary.process-call-sites",()=>{for(let v of f)if(!(v.depth>=Vr))try{let R=y.get(v.definition.symbolId);if(!R)continue;u.push(...R.unresolved.map(x=>Ur(v,x)));for(let x of R.sites){let h=m(x.file);if(!h)continue;o.add(x.file);let S=x.callNode,B=zr(v,S,h);B&&s.push(B);let I=x.caller;if(!I)continue;let N=b(h,I),F=Kr(e,v,x),$={definition:I,pathParameterIndexes:$e([...N.pathParameterIndexes,...F.pathParameterIndexes]),methodParameterIndexes:$e([...N.methodParameterIndexes,...F.methodParameterIndexes]),constantMethods:ne([...v.constantMethods,...N.constantMethods]),depth:v.depth+1,proofObservationIds:ne([...v.proofObservationIds,...B?[B.id]:[]]),proofSpans:[...v.proofSpans,{file:x.file,startLine:x.startLine,endLine:x.endLine}]};Qt(i,$)&&a.push(i.get(I.symbol))}}catch(R){l.push(`builtin.http-summary failed for ${v.definition.relativePath}:${v.definition.startLine+1}: ${R instanceof Error?R.message:String(R)}`)}},{batchSize:f.length})}return Yt.writeBatch(e,[...p.entries()].flatMap(([f,y])=>y.dirty?[{relativePath:f,contentHash:y.contentHash,value:[...y.roles.values()].sort((v,R)=>v.symbol.localeCompare(R.symbol))}]:[])),{observations:s,frontiers:_e(u),summaries:i.size,filesInspected:o.size,errors:l}}function Ur(e,t){let n=ne([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${Hr("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:Re(t.file)}}function zr(e,t,n){let r=tn(t),i=e.pathParameterIndexes.flatMap(c=>{let p=V(n,r[c]);return p&&p.evidence!=="expression"&&Zr(p.value)?[{index:c,value:p}]:[]}),a=e.methodParameterIndexes.flatMap(c=>{let p=V(n,r[c]),m=p?.value.toUpperCase();return p&&m&&p.evidence!=="expression"&&Le.has(m)?[{index:c,value:{...p,value:m}}]:[]}),s=ne([...e.constantMethods,...a.map(c=>c.value.value)]);if(i.length!==1||s.length!==1)return null;let o=i[0].value,l=a.find(c=>c.value.value===s[0])?.value,u=[{name:"method",value:s[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:s[0]},derivation:l?.derivation},{name:"path",value:o.value,evidence:"constant",term:o.term,derivation:o.derivation}],d=Fe(n,t,"builtin.http-summary","http.request",u,"derived","compiler-resolved-http-summary");return d.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,d.source]},d}function Gr(e,t){let n=D(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=X(n),i=new Set,a=new Set,s=new Set;return k(n,o=>{if(o.type==="call_expression"&&((o.childForFieldName("function")??o.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let m=tn(o);pe(m[0],r,i);let g=Xr(m[1],"method");if(g){pe(g,r,a);let b=V(e,g),f=b?.value.toUpperCase();f&&b?.evidence!=="expression"&&Le.has(f)&&s.add(f)}else pe(m[1],r,a)}if(o.type!=="pair")return;let l=o.childForFieldName("key")??o.namedChild(0),u=o.childForFieldName("value")??o.namedChild(1),d=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(d==="url"||d==="path"||d==="endpoint")&&pe(u,r,i),(d==="init"||d==="requestinit"||d==="options")&&pe(u,r,a)}),{pathParameterIndexes:r.flatMap((o,l)=>o&&i.has(o)?[l]:[]),methodParameterIndexes:r.flatMap((o,l)=>o&&a.has(o)?[l]:[]),constantMethods:[...s].sort()}}function jr(e){return e.map(t=>[encodeURIComponent(t.symbol),t.pathParameterIndexes.join(","),t.methodParameterIndexes.join(","),t.constantMethods.join(",")].join(" ")).join(`
|
|
49
|
-
`)}function qr(e){if(!e)return[];let t=[];for(let n of e.split(`
|
|
50
|
-
`)){let r=n.split(" ");if(r.length!==4)return null;let i=Jt(r[1]),a=Jt(r[2]),s=r[3]?r[3].split(","):[];if(i===null||a===null||s.some(o=>!Le.has(o)))return null;t.push({symbol:decodeURIComponent(r[0]),pathParameterIndexes:i,methodParameterIndexes:a,constantMethods:s})}return t}function Jt(e){if(!e)return[];let t=e.split(",").map(Number);return t.every(n=>Number.isSafeInteger(n)&&n>=0)?t:null}function Kr(e,t,n){let r=ce(e,n);return{pathParameterIndexes:de(r,t.pathParameterIndexes),methodParameterIndexes:de(r,t.methodParameterIndexes)}}function Qt(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=$e([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=$e([...n.methodParameterIndexes,...t.methodParameterIndexes]),a=ne([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||a.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:a,depth:Math.min(n.depth,t.depth),proofObservationIds:ne([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function Xr(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function pe(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function tn(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Zr(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function $e(e){return[...new Set(e)].sort((t,n)=>t-n)}function ne(e){return[...new Set(e)].sort()}import{createHash as Wr}from"crypto";function an(e){let t=nn(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=nn(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?nt(r).flatMap(i=>{let a=t.get(i)?.[0];return a?[rn(r,a,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?nt(r).flatMap(i=>{let a=n.get(i)?.[0];return a?[rn(r,a,i,"queue.consume")]:[]}):[])}function nn(e){let t=new Map;for(let n of e)for(let r of nt(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function nt(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function rn(e,t,n,r){let i=`database:${n}`,a=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",s=[e.id,r,i,a].join("\0");return{...e,id:`boundary:${Wr("sha256").update(s).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:a,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var ye="runtime-boundaries-v19",Qr=Jr(import.meta.url),w=Qr("typescript"),ei=new Set([w.SyntaxKind.WhitespaceTrivia,w.SyntaxKind.NewLineTrivia,w.SyntaxKind.SingleLineCommentTrivia,w.SyntaxKind.MultiLineCommentTrivia]),ti=new Set([w.SyntaxKind.NoSubstitutionTemplateLiteral,w.SyntaxKind.TemplateHead,w.SyntaxKind.TemplateMiddle,w.SyntaxKind.TemplateTail]),Ae=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],ni=64,dn="builtin.http-summary",De={HTTP_HANDLE:"http.handle",HTTP_REQUEST:"http.request",REGISTRY_HANDLE:"registry.handle"},rt=new Set(Object.values(De));async function ri(e,t={}){let n=Se(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(Ni)),a=t.previousGraph?.fileCoverage,s=i.size>0&&t.previousGraph?.extractorVersion===ye&&a!==void 0&&a.length===t.previousGraph.coverage.filesScanned,o=s?a.filter(C=>r.has(C.file)&&!i.has(C.file)):[],l=new Set(o.flatMap(C=>C.observationIds)),u=s?t.previousGraph.observations.filter(C=>l.has(C.id)&&r.has(C.source.file)):[],d=s?n.filter(C=>i.has(C)):n,c=[],p=a?.reduce((C,P)=>C+P.observationIds.length,0)??0,m=performance.now(),g=await vi(e,d,t.profileSpan);j(c,"direct-extraction",m,d.length,g.observations.length,{filesVisited:d.length,filesReused:o.length,factsReused:u.length,factsInvalidated:Math.max(0,p-u.length)});let b=[...o,...g.fileCoverage].sort((C,P)=>C.file.localeCompare(P.file)),f=Ci(b),y=b.flatMap(C=>C.extractionErrors),v=me([...u,...g.observations]);if(s&&!t.forceDerivedRebuild&&t.previousGraph&&ii(a,g.fileCoverage,i)&&(!ci(e,t.previousGraph,i)||mi(a,g.fileCoverage,i)&&!fi(t.previousGraph,i))){for(let P of t.previousGraph.coverage.extractors)f.has(P.id)||f.set(P.id,P);let C=hi(t.previousGraph.coverage.phases);return c.push(...C),{...t.previousGraph,observations:t.previousGraph.observations,relationGroups:t.previousGraph.relationGroups,links:t.previousGraph.links,frontiers:t.previousGraph.frontiers,coverage:{filesScanned:n.length,filesWithAst:b.filter(P=>P.hasAst).length,filesWithoutAst:b.filter(P=>!P.hasAst).length,filesReused:o.length,extractors:[...f.values()],extractionErrors:t.previousGraph.coverage.extractionErrors,phases:c},fileCoverage:b}}let R=me([...v,...an(v)]),x=s&&t.previousGraph!==void 0?ai(t.previousGraph,a,g.fileCoverage,i,v):{reuse:!1,shapeUnchanged:!1,proofFilesUnchanged:!1,seedUnchanged:!1},h=x.reuse;t.profileSpan?.("runtime-boundaries.http-summary.reuse-decision",()=>{},x),m=performance.now();let S;if(h){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="http-summary"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.wrapper");S={observations:t.previousGraph.observations.filter(E=>E.extractor===dn),frontiers:t.previousGraph.frontiers.filter(E=>E.kind==="call-resolution"&&E.action===De.HTTP_REQUEST),summaries:0,filesInspected:C?.filesVisited??P?.applicableFiles??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.http-summary failed"))},j(c,"http-summary",m,R.length,S.observations.length,{filesVisited:0,filesReused:S.filesInspected,factsReused:S.observations.length+S.frontiers.length,factsInvalidated:0}),P&&f.set(P.id,P)}else S=en(e,R,t.profileSpan),j(c,"http-summary",m,R.length,S.observations.length,{filesVisited:S.filesInspected}),f.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:S.filesInspected,observations:S.observations.length,errors:S.errors.length});y.push(...S.errors);let B=me([...R,...S.observations]);m=performance.now();let I=Zt(e,B);j(c,"http-mount",m,B.length,I.observations.length,{filesVisited:I.filesInspected});let N=me([...B,...I.observations]);m=performance.now();let F=h&&t.previousGraph!==void 0&&oi(t.previousGraph,a,g.fileCoverage,i),$;if(F){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="carrier"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.carrier");$={observations:t.previousGraph.observations.filter(E=>E.extractor==="builtin.carrier"),bodySummaries:P?.applicableFiles??0,discriminatorSummaries:0,filesInspected:C?.filesVisited??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.carrier"))},j(c,"carrier",m,N.length,$.observations.length,{filesVisited:0,filesReused:$.filesInspected,factsReused:$.observations.length,factsInvalidated:0}),P&&f.set(P.id,P)}else $=Ut(e,N,b.flatMap(C=>C.bodySummaries??[])),j(c,"carrier",m,N.length,$.observations.length,{filesVisited:$.filesInspected}),f.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:$.bodySummaries,observations:$.observations.length,errors:$.errors.length});y.push(...$.errors);let K=me([...N,...$.observations]);m=performance.now();let J=Bi(K);j(c,"relations",m,K.length,J.length),m=performance.now();let it=Pi(K,J);j(c,"links",m,J.length,it.length),wi(K,J),m=performance.now();let at=_e([...Ei(K,J),...S.frontiers]);return j(c,"frontiers",m,K.length,at.length),{schemaVersion:2,extractorVersion:ye,observations:K,relationGroups:J,links:it,frontiers:at,coverage:{filesScanned:n.length,filesWithAst:b.filter(C=>C.hasAst).length,filesWithoutAst:b.filter(C=>!C.hasAst).length,...s?{filesReused:o.length}:{},extractors:[...f.values()],extractionErrors:y,phases:c},fileCoverage:b}}function ii(e,t,n){if(!e)return!1;let r=e.filter(a=>n.has(a.file)).filter(on).map(sn).sort((a,s)=>a.file.localeCompare(s.file)),i=t.filter(on).map(sn).sort((a,s)=>a.file.localeCompare(s.file));return JSON.stringify(r)===JSON.stringify(i)}function on(e){return e.observationIds.length>0||e.extractionErrors.length>0}function sn(e){let{syntaxHash:t,shapeHash:n,bodySummaries:r,...i}=e;return i}function ai(e,t,n,r,i){let a=li(t,n,r),s=ui(e),l=![...pn(t,n)].some(p=>s.has(p)),u=new Set((t??[]).filter(p=>r.has(p.file)).flatMap(p=>p.observationIds)),d=new Set(n.flatMap(p=>p.observationIds)),c=ln(e.observations,u)===ln(i,d);return{reuse:a&&l&&c,shapeUnchanged:a,proofFilesUnchanged:l,seedUnchanged:c}}function pn(e,t){let n=new Map(e?.map(r=>[r.file,r.syntaxHash])??[]);return new Set(t.filter(r=>r.syntaxHash===void 0||n.get(r.file)!==r.syntaxHash).map(r=>r.file))}function oi(e,t,n,r){if(!t)return!1;let i=t.filter(l=>r.has(l.file)).map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file)),a=n.map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file));if(JSON.stringify(i)!==JSON.stringify(a))return!1;let s=pn(t,n),o=si(e,"builtin.carrier");return![...s].some(l=>o.has(l))}function si(e,t){let n=new Set;for(let r of e.observations)if(r.extractor===t){n.add(r.source.file);for(let i of r.derivation.sourceSpans)n.add(i.file)}return n}function li(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.shapeHash]));return t.length===n.size&&t.every(i=>i.shapeHash!==void 0&&r.get(i.file)===i.shapeHash)}function ui(e){let t=new Set;for(let n of e.observations)if(n.extractor===dn){t.add(n.source.file);for(let r of n.derivation.sourceSpans)t.add(r.file)}for(let n of e.frontiers)n.kind==="call-resolution"&&n.action===De.HTTP_REQUEST&&n.source&&t.add(n.source.file);return t}function ln(e,t){return JSON.stringify(e.filter(n=>t.has(n.id)&&n.action===De.HTTP_REQUEST&&n.owner.symbol!==null&&(n.evidence==="call-expression"||n.evidence==="client-adapter")).map(n=>({ownerSymbol:n.owner.symbol,evidence:n.evidence,methods:n.keyParts.filter(r=>r.name==="method"&&r.evidence!=="expression").map(r=>r.value.toUpperCase()).sort()})).sort((n,r)=>`${n.ownerSymbol}\0${n.evidence}\0${n.methods.join(",")}`.localeCompare(`${r.ownerSymbol}\0${r.evidence}\0${r.methods.join(",")}`)))}function ci(e,t,n){let r=di(t),i=pi(t);if([...n].some(o=>r.has(o)))return!0;if(i.size===0||n.size===0)return!1;if(!!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))return!0;let s=[...n];for(let o=0;o<s.length;o+=750){let l=s.slice(o,o+750),u=l.map(()=>"?").join(",");if(e.all(`SELECT DISTINCT global_symbol.symbol
|
|
51
|
-
FROM mentions mention
|
|
52
|
-
JOIN chunks reference_chunk ON reference_chunk.id = mention.chunk_id
|
|
53
|
-
JOIN documents reference_document ON reference_document.id = reference_chunk.document_id
|
|
54
|
-
JOIN global_symbols global_symbol ON global_symbol.id = mention.symbol_id
|
|
55
|
-
WHERE mention.role != 1
|
|
56
|
-
AND reference_document.relative_path IN (${u})`,...l).some(c=>i.has(c.symbol)))return!0}return!1}function di(e){let t=new Set;for(let n of e.observations)if(rt.has(n.action)){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)!n.action||!rt.has(n.action)||!n.source||t.add(n.source.file);return t}function pi(e){return new Set(e.observations.flatMap(t=>rt.has(t.action)&&t.owner.symbol?[t.owner.symbol]:[]))}function mi(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.syntaxHash]));return t.length===n.size&&t.every(i=>i.syntaxHash!==void 0&&r.get(i.file)===i.syntaxHash)}function fi(e,t){let n=yi(e);return[...t].some(r=>n.has(r))}function yi(e){let t=new Set;for(let n of e.observations){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)n.source&&t.add(n.source.file);return t}function hi(e){return(e??[]).filter(t=>t.id!=="direct-extraction").map(t=>({...t,durationMs:0,filesVisited:0,filesReused:t.filesVisited??0,factsReused:t.outputFacts,factsInvalidated:0}))}function j(e,t,n,r,i,a={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...a})}var gi=256;async function vi(e,t,n){let r=[],i=[],a=n??((c,p)=>p()),s=[],o=[],l=new Map,u=c=>{let p=l.get(c);if(p!==void 0)return p;let m=re(e,c,Me(e,c));return l.set(c,m),m},d=0;for(let c of t){d+=1,d>=gi&&(d=0,ut(),await Yr());let p=a("runtime-boundaries.file.read",()=>Me(e,c)),m=re(e,c,p);l.set(c,m);let g=a("runtime-boundaries.file.direct-product",()=>{let h=cn.read(e,c,m);if(!h||h.extractorVersion!==ye)return null;for(let S of h.deps)if(u(S.path)!==S.contentHash)return null;return h});if(g){r.push(...g.observations),i.push(g.coverage);continue}let b=a("runtime-boundaries.file.supports",()=>Xe.filter(h=>h.supports(p))),f=/\bJSON\.stringify\s*\(/u.test(p)&&/\bbody\s*:/u.test(p),y=a("runtime-boundaries.file.hashes",()=>{let h=un.read(e,c,m);if(h)return h;let S=bi(c,p);return s.push({relativePath:c,contentHash:m,value:S}),S}),v=new Set,R=[],x=ot(h=>v.add(h),()=>{let h=b.length>0||f?L(e,c,p,n):null,S={file:c,hasAst:h!==null||Ri(c,p),syntaxHash:y.syntaxHash,shapeHash:y.shapeHash,bodySummaries:h&&f?zt(h):[],observationIds:[],extractors:[],extractionErrors:[]};if(h)for(let B of b){let I={id:B.id,applicableFiles:1,observations:0,errors:0};try{let N=xi(n,`runtime-boundaries.extractor.${B.id}`,c,()=>B.extract(h));I.observations=N.length,R.push(...N),S.observationIds.push(...N.map(F=>F.id))}catch(N){I.errors=1,S.extractionErrors.push(`${B.id} failed for ${c}: ${N instanceof Error?N.message:String(N)}`)}S.extractors.push(I)}return S});r.push(...R),i.push(x),x.extractionErrors.length===0&&(v.delete(c),o.push({relativePath:c,contentHash:m,value:{extractorVersion:ye,deps:[...v].sort().map(h=>({path:h,contentHash:u(h)})),observations:R,coverage:x}}))}return s.length>0&&un.writeBatch(e,s),o.length>0&&cn.writeBatch(e,o),{observations:r,fileCoverage:i}}var un=ie({kind:"runtime-boundary-source-hashes",invalidation:ae("runtime-boundary-source-hashes"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.syntaxHash=="string"&&typeof t.shapeHash=="string"?{syntaxHash:t.syntaxHash,shapeHash:t.shapeHash}:null}catch{return null}}}),cn=ie({kind:"runtime-boundary-direct-extraction",invalidation:ae("runtime-boundary-direct-extraction"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.extractorVersion!="string"||!Array.isArray(t.deps)||!Array.isArray(t.observations)||typeof t.coverage!="object"||t.coverage===null||!t.deps.every(n=>typeof n=="object"&&n!==null&&typeof n.path=="string"&&typeof n.contentHash=="string")?null:t}catch{return null}}});function bi(e,t){if(!/\.(?:[cm]?[jt]sx?)$/iu.test(e)){let u=fe("sha256").update(t).digest("hex");return{syntaxHash:u,shapeHash:u}}let n=/\.[jt]sx$/iu.test(e)?w.LanguageVariant.JSX:w.LanguageVariant.Standard,r=w.createScanner(w.ScriptTarget.Latest,!1,n,t),i=fe("sha256"),a=fe("sha256"),s=[],o=[0];for(let u=0;u<t.length;u+=1)t.charCodeAt(u)===10&&o.push(u+1);let l=0;for(let u=r.scan();u!==w.SyntaxKind.EndOfFileToken;u=r.scan()){if(u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)===0&&(u=r.reScanTemplateToken(!1)),ei.has(u))continue;let d=r.getTokenText();for(;o[l+1]!==void 0&&o[l+1]<=r.getTokenPos();)l+=1;i.update(String(u)),i.update("\0"),i.update(d),i.update("\0"),i.update(String(l)),i.update("\0"),a.update(String(u)),a.update("\0"),!ti.has(u)&&!Si(u,d)&&a.update(d),a.update("\0"),a.update(String(l)),a.update("\0"),u===w.SyntaxKind.TemplateHead?s.push(0):u===w.SyntaxKind.TemplateTail?s.pop():u===w.SyntaxKind.OpenBraceToken&&s.length>0?s[s.length-1]+=1:u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)>0&&(s[s.length-1]-=1)}return{syntaxHash:i.digest("hex"),shapeHash:a.digest("hex")}}function Si(e,t){if(e!==w.SyntaxKind.StringLiteral||t.length<2)return!1;let n=t.slice(1,-1);return n.startsWith("/")||n.includes("://")}function xi(e,t,n,r){return e?e(t,r,{file:n}):r()}function Ri(e,t){return t?st(e)?/<script\b/iu.test(t):ve(e)!==null:!1}function Ci(e){let t=new Map(Xe.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function Ni(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function Bi(e){let t=new Map;for(let n of Ae){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let a=Ti(i,n.keyNames);if(!a)continue;let s=a.map(c=>`${c.name}=${fn(c.name,c.value)}`).join("\0"),o=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${o}\0${s}`,u=`boundary-group:${fe("sha256").update(l).digest("hex").slice(0,16)}`,d=t.get(u)??{id:u,protocol:n.protocol,joinRule:n.id,normalizedKey:s,keyParts:a,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&d.producerIds.push(i.id),n.consumerActions.includes(i.action)&&d.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&d.declarationIds.push(i.id),d.derivation.inputFactIds.push(i.id),d.derivation.sourceSpans.push(i.source),t.set(u,d)}}return[...t.values()].map(Ii).sort($i)}function Ii(e){return{...e,producerIds:ke(e.producerIds),consumerIds:ke(e.consumerIds),declarationIds:ke(e.declarationIds),derivation:{...e.derivation,inputFactIds:ke(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function Pi(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let a=Ae.find(o=>o.id===i.joinRule);if(!a?.traversable)continue;let s=a.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(s.length===0||i.consumerIds.length===0)&&!(a.requireUniquePair&&(s.length!==1||i.consumerIds.length!==1))&&!(a.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(s.length*i.consumerIds.length>ni))for(let o of s)for(let l of i.consumerIds){let u=n.get(o),d=n.get(l);if(!u||!d||_i(u,d))continue;let c=u.strength==="derived"||d.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${o}\0${l}`,m={id:`boundary-link:${fe("sha256").update(p).digest("hex").slice(0,16)}`,from:o,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:c,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[o,l],sourceSpans:[u.source,d.source]}};r.set(m.id,m)}}return[...r.values()].sort(Li)}function wi(e,t){let n=new Set(t.filter(mn).flatMap(Oe)),r=new Set(t.filter(Fi).flatMap(Oe));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function Ei(e,t){let n=new Set(e.filter(a=>a.strength!=="candidate").map(a=>`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)),r=new Set(t.flatMap(Oe)),i=new Set(t.filter(mn).flatMap(Oe));return e.filter(a=>a.sourceScope==="production").filter(a=>a.strength!=="candidate"||!n.has(`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)).filter(a=>!i.has(a.id)).map(a=>{let s=a.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),o=s.length>0?`${a.extractor} observed ${a.action}, but ${s.join(", ")} remained symbolic or unknown.`:a.resolution==="ambiguous"?`${a.extractor} established the address for ${a.action}, but more than one indexed peer has the same runtime key.`:r.has(a.id)?`${a.extractor} established the address for ${a.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${a.extractor} observed ${a.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:a.id,reason:o,missingKeyParts:s,sourceScope:a.sourceScope}}).sort((a,s)=>a.observationId.localeCompare(s.observationId))}function Oe(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function mn(e){let t=Ae.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function Fi(e){let t=Ae.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function Ti(e,t){let n=[];for(let r of t){let i=e.keyParts.find(a=>a.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:fn(r,i.value)})}return n}function fn(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function _i(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function me(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function ke(e){return[...new Set(e)].sort()}function $i(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function Li(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}export{Re as a,V as b,Je as c,ce as d,ye as e,ri as f,hn as g,gn as h,bt as i};
|
|
57
|
-
//# sourceMappingURL=chunk-VUPHCS7Y.js.map
|
package/dist/chunk-VVZSBTSU.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{U as p}from"./chunk-3L2ZBPEX.js";import{a as c}from"./chunk-YXPUP5G2.js";import{a as f,c as g,e as d}from"./chunk-DRENNWRG.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
|
|
2
|
-
FROM defn_enclosing_ranges der
|
|
3
|
-
JOIN global_symbols gs ON der.symbol_id = gs.id
|
|
4
|
-
JOIN documents d ON der.document_id = d.id
|
|
5
|
-
WHERE gs.kind IS NOT NULL
|
|
6
|
-
AND gs.kind != 0
|
|
7
|
-
AND gs.symbol NOT LIKE '%#'
|
|
8
|
-
AND d.relative_path IN (${i})
|
|
9
|
-
GROUP BY gs.kind`,...e);for(let u of l)t.set(u.kind,(t.get(u.kind)??0)+u.count)}return t}function S(n,s){let t=[];for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", ");t.push(...n.all(`SELECT gs.symbol,
|
|
10
|
-
gs.kind,
|
|
11
|
-
gs.documentation,
|
|
12
|
-
gs.enclosing_symbol,
|
|
13
|
-
d.relative_path,
|
|
14
|
-
der.start_line,
|
|
15
|
-
der.end_line
|
|
16
|
-
FROM defn_enclosing_ranges der
|
|
17
|
-
JOIN global_symbols gs ON der.symbol_id = gs.id
|
|
18
|
-
JOIN documents d ON der.document_id = d.id
|
|
19
|
-
WHERE (gs.kind IS NULL OR gs.kind = 0 OR gs.symbol LIKE '%#')
|
|
20
|
-
${n.symbolNoiseFor("gs")}
|
|
21
|
-
AND d.relative_path IN (${i})
|
|
22
|
-
ORDER BY d.relative_path, der.start_line, der.end_line, gs.symbol`,...e))}return t}function N(n){let s=[];for(let t=0;t<n.length;t+=_)s.push(n.slice(t,t+_));return s}function R(n){return{symbol:n.symbol,kind:n.kind,documentation:n.documentation,enclosing_symbol:n.enclosingSymbol,relative_path:n.relativePath,start_line:n.startLine,end_line:n.endLine}}function k(n){return n.kind!==null&&n.kind!==0?D(n.kind,n.symbol,n.documentation):C(n.symbol,n.documentation,n.enclosing_symbol)}function D(n,s,t){let e=(t??"").toLowerCase();if(d(s)==="type"){if(e.includes("type "))return o.TypeAlias;if(e.includes("interface "))return o.Interface;if(e.includes("struct "))return o.Struct;if(e.includes("trait "))return o.Trait;if(e.includes("class "))return o.Class}return n}function C(n,s,t){let e=f(n);if("kind"in e)return null;let i=e.descriptors,l=i[i.length-2]??null,u=d(n),r=(s??"").toLowerCase();return u==="type"?r.includes("type ")?o.TypeAlias:r.includes("interface ")?o.Interface:r.includes("struct ")?o.Struct:r.includes("trait ")?o.Trait:r.includes("class ")?o.Class:o.Class:u==="method"?l?.suffix==="type"?o.Method:o.Function:u==="namespace"?o.Module:u!=="term"?null:r.includes("async def ")||r.includes("def ")?o.Function:(t?d(t):l?.suffix??null)==="type"?o.Field:o.Variable}export{v as a,T as b};
|
|
23
|
-
//# sourceMappingURL=chunk-VVZSBTSU.js.map
|
package/dist/chunk-VZRNID6A.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as R}from"./chunk-LMZ5PRUV.js";import{a as D}from"./chunk-F7DY272B.js";import{a as g}from"./chunk-FFRKR4EQ.js";import{a as F}from"./chunk-3JKSW6LJ.js";import{a as y}from"./chunk-6HFCYNYE.js";import{e as f}from"./chunk-TQPCBMWT.js";import{j as d}from"./chunk-N2ZSIIGR.js";import{O as h}from"./chunk-ZOHS7AQV.js";var A=.7,S=.62,C=.45;function J(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=y(i,{historyMode:t.historyMode}).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let r=P(s,e);if(r.size===0)return{available:!0,windowCommits:e,findings:[]};let b=B(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:r}).map(l=>O(l,s,e)).filter(l=>l!==null);b.sort((l,c)=>(l.kind===c.kind?0:l.kind==="echo"?-1:1)||c.similarity-l.similarity||l.echoFile.localeCompare(c.echoFile)||l.echoSymbol.localeCompare(c.echoSymbol)||l.domain.localeCompare(c.domain));let p=b.slice(0,n).map(M);return{available:!0,windowCommits:e,findings:p,rootCauseGroups:N(p)}}function B(i,t){let e=K(t.limit),n=[...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??A,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=h(i,{scope:t.scope});return a.react&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...T(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function k(i,t){return f(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).filter(e=>!d(e.symbolA)&&!d(e.symbolB)).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function E(i,t){return u(i,t,{query:g,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).filter(n=>e.acceptPair?.(n)??!0).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:G(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:F,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,acceptPair:w,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}var I=new Set(["useCallback","useEffect","useLayoutEffect","useMemo","useMutation","useQueries","useQuery","useQueryClient","useReducer","useRef","useState"]);function w(i){return i.sharedHooks.some(t=>!I.has(t))||i.sharedState.length>0||i.sharedHandlers.length>0||i.sharedHandlerVerbs.length>=2}function x(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function T(i,t){return u(i,t,{query:R,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function P(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function O(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let r=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:r?i.symbolA:i.symbolB,echoFile:r?i.fileA:i.fileB,echoAgeCommits:(r?n:a)??0,establishedSymbol:r?i.symbolB:i.symbolA,establishedFile:r?i.fileB:i.fileA,establishedAgeCommits:r?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function M(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:H(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let r of n.sharedEvidence)s.sharedEvidence.add(r)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function H(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function G(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{J as a};
|
|
2
|
-
//# sourceMappingURL=chunk-VZRNID6A.js.map
|
package/dist/chunk-W5OXRYGE.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{a as z}from"./chunk-XBGWL66K.js";import{b as C}from"./chunk-4FTZ4P5G.js";import{c as W}from"./chunk-EKV5HX33.js";import{b as U}from"./chunk-J66VOFW6.js";import{d as D}from"./chunk-MV3CDXPI.js";import{a as _}from"./chunk-MPQ4OTBM.js";import{a as k,b as j,e as A}from"./chunk-HOENASQM.js";import{C as I,K as O,T as h,Y as T,i as F,k as M,l as B}from"./chunk-3L2ZBPEX.js";import{c as S,d as w,l as $}from"./chunk-DRENNWRG.js";import{m as P}from"./chunk-KYSDI3GE.js";import{basename as me,extname as K}from"path";var oe=12,se=280;function y(n,e,t,o){let i=ae(n,e,t,o);if(i.size===0)return ce();let r=[],a=new Set,u=(l,d,c,f)=>{if(d===e&&c<=o&&f>=t)return;let m=`${d}:${c}:${f}:${l}`;a.has(m)||(a.add(m),r.push({name:l,relativePath:d,startLine:c,endLine:f}))};for(let l of h(n,e))i.has(l.leaf)&&u(l.leaf,l.relativePath,l.startLine,l.endLine);for(let l of O(n,e)){let d=l.localName;if(!d||!i.has(d)||!l.sourcePath||l.kind==="namespace")continue;let c=l.importedName==="default"?d:l.importedName;for(let f of _(n,l.sourcePath,c,{maxReexportDepth:3}))u(d,f.relativePath,f.startLine,f.endLine)}r.sort(H);let s=r.map(l=>{let d=le(n,l);return d?{...l,source:d}:null}).filter(l=>l!==null).slice(0,oe);return x(s)}function X(n,e=[]){return x(ue(n.flatMap(t=>t?.inline??[]),e))}function ae(n,e,t,o){let i=I(n,e),r=new Set;if(!i)return r;for(let a=t;a<=o;a+=1)for(let u of i.identifiersByLine[a]??[])r.add(u);return r}function le(n,e){if(e.startLine!==e.endLine)return null;let t=(B(n,e.relativePath)[e.startLine]??"").trim();if(!t||t.length>se)return null;let o=t.indexOf("=");if(o<0||t[o+1]===">")return null;let i=t.slice(o+1).replace(/(?:\/\/|#).*$/u,"").trim();if(!i||i.includes("${")||/\b(?:function|class|struct|interface|trait|enum|lambda)\b/u.test(i))return null;let a=i.replace(/(['"`])(?:\\.|(?!\1).)*\1/gu,"").replace(/\b(?:0[xX][\dA-Fa-f_]+|0[bB][01_]+|0[oO][0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d+)?)n?\b/gu,""),u=new Set(["true","false","null","undefined","None","True","False"]);return(a.match(/[A-Za-z_][A-Za-z0-9_]*/gu)??[]).some(l=>!u.has(l))?null:t}function ue(n,e){let t=new Map;for(let o of n){if(de(o,e))continue;let i=`${o.relativePath}:${o.startLine}:${o.endLine}:${o.name}`;t.has(i)||t.set(i,{...o})}return[...t.values()].sort(H)}function de(n,e){return e.some(t=>t.relativePath===n.relativePath&&t.startLine<=n.startLine&&t.endLine>=n.endLine)}function H(n,e){return n.relativePath.localeCompare(e.relativePath)||n.startLine-e.startLine||n.name.localeCompare(e.name)}function x(n){return{coverage:"indexed-project-literal-values",inline:n}}function ce(){return x([])}function G(n,e){let t=W(n,e);if(!t)return[];let o=T(n,[t],{sort:!0});if(o.length===0)return[];let i=Math.max(0,M(F(n,t)).length-1),r=o.map(s=>({symbol:s.symbol,shortName:s.shortName,startLine:s.startLine,endLine:Math.min(s.endLine,i),signature:s.signature,children:[]})),a=new Map;for(let s of r)a.set(s.symbol,s);let u=[];for(let s=0;s<o.length;s++){let l=o[s],d=r[s];if(l.enclosingSymbol&&a.has(l.enclosingSymbol)){a.get(l.enclosingSymbol).children.push(d);continue}let c=null,f=1/0;for(let m of r)if(m!==d&&m.startLine<=d.startLine&&m.endLine>=d.endLine){if(m.startLine===d.startLine&&m.endLine===d.endLine&&!$(m.symbol,d.symbol))continue;let g=m.endLine-m.startLine;g<f&&(f=g,c=m)}c?c.children.push(d):u.push(d)}return u}function Je(n,e,t={}){let{context:o=0}=t,i=ie(e);if(i)return re(n,i.filePath,i.startLine,i.endLine,o);let r=ne(n,e);if(r)return Y(n,r);let a=k(n,e);return a?p(n,a,o):null}function Qe(n,e,t={}){if(e.length===0)throw new RangeError("code requires at least one selector.");if(e.length>24)throw new RangeError(`code accepts at most ${24} selectors per complete packet; received ${e.length}.`);let o=t.context??0,i=t.members??"exported",r=e.map(s=>ge(n,s,o,i)),a=r.flatMap(s=>s.results),u=a.map(s=>({relativePath:s.relativePath,startLine:s.startLine,endLine:s.endLine}));return{requested:e.length,matched:r.filter(s=>s.status==="matched").length,ambiguous:r.filter(s=>s.status==="ambiguous").length,missing:r.filter(s=>s.status==="missing").length,entries:r,bindingClosure:X(a.map(s=>s.bindingClosure),u)}}function ge(n,e,t,o){let i=ie(e);if(i){let d=re(n,i.filePath,i.startLine,i.endLine,t);return d?he(n,e,d,t):R(n,e,"definition-source-unreadable")}let r=ne(n,e);if(r)return be(n,e,r,t,o);let a=j(n,e);if(!a.match)return R(n,e,"definition-not-found");let u=Ne(n,a),s=u.map(te);if(a.total>1){let d=a.total<=4&&u.length===a.total;return{selector:e,status:"ambiguous",kind:"source",totalCandidates:a.total,results:d?u.flatMap(c=>{let f=p(n,c,t);return f?[f]:[]}):[],definitions:[],candidates:s,omittedCandidates:Math.max(0,a.total-s.length),suggestions:[]}}let l=p(n,a.match,t);return l?Re(e,l):R(n,e,"definition-source-unreadable")}function he(n,e,t,o){let i=h(n,t.relativePath).filter(l=>!Z(l,t.relativePath)),r=pe(n,t,i),a=V(r.map(l=>p(n,l,o)).filter(l=>l!==null)).filter(l=>!ee(t,l)),u=new Set(a.map(l=>l.symbol)),s=r.filter(l=>!u.has(l.symbol)&&!(t.startLine<=l.startLine&&t.endLine>=l.endLine)).map(te);return{selector:e,status:"matched",kind:"source",totalCandidates:1,results:[t,...a],definitions:[],candidates:[],omittedCandidates:0,suggestions:[],rangeCoverage:{basis:"requested-range-and-same-file-call-closure",referencedDefinitions:r.length,returnedDefinitions:r.length-s.length,returnedBodies:a.length,omittedDefinitions:s.length,omittedLedger:s}}}function pe(n,e,t){if(!b(e.freshness))return[];if(t.length===0)return[];let o=D(n,t,{additive:!1,semantic:!1}),i=new Map;for(let a of t){let u=i.get(a.symbol)??[];u.push(a),i.set(a.symbol,u)}let r=new Map;for(let a of t)if(!(a.endLine<e.startLine||a.startLine>e.endLine)){for(let u of o.get(a.symbolId)??[])if(u.file===e.relativePath&&!(u.source==="ast-callsite"&&(u.chunkId<e.startLine||u.chunkId>e.endLine)))for(let s of i.get(u.symbol)??[])r.set(s.symbolId,s)}return Q(n,[...r.values()],t)}function be(n,e,t,o,i){let r=t.relativePath,a=ye(n,r),u=b(t.freshness)?h(n,r).filter(g=>!Z(g,r)):[],s=u.filter(g=>z(n,g)),l=s.length>0?s:Ce(a,u),d=i==="all"?[]:Q(n,l,u),c=i==="all"||u.length===0?[Y(n,t)]:V(d.map(g=>p(n,g,o)).filter(g=>g!==null)),f=ve(a,c),m=Se(r,a,c),v=De(a);return{selector:e,status:"matched",kind:"file-source",totalCandidates:1,results:c,definitions:[],candidates:[],omittedCandidates:0,suggestions:[],fileCoverage:{members:i,basis:i==="all"||u.length===0?"complete-file-source":s.length>0?"explicit-exports-and-same-file-reference-closure":"top-level-and-same-file-reference-closure",totalDefinitions:v,returnedDefinitions:f,returnedBodies:c.length,omittedDefinitions:Math.max(0,v-f),omittedLedger:m}}}function Ce(n,e){let t=new Set(n.map(o=>o.symbol));return e.filter(o=>t.has(o.symbol))}function ye(n,e){return G(n,e).flatMap(t=>Le(t,e)?t.children:[t])}function Z(n,e){return J(e).has(n.leaf)}function Le(n,e){return J(e).has(w(n.symbol))}function J(n){let e=me(n);return new Set([e,e.slice(0,Math.max(0,e.length-K(e).length))])}function Q(n,e,t){if(e.length===0)return[];let o=D(n,t,{additive:!0,semantic:!1}),i=new Map;for(let u of t){let s=i.get(u.symbol)??[];s.push(u),i.set(u.symbol,s)}let r=new Map,a=[...e];for(;a.length>0;){let u=a.shift();if(!r.has(u.symbolId)){r.set(u.symbolId,u);for(let s of o.get(u.symbolId)??[])for(let l of i.get(s.symbol)??[])r.has(l.symbolId)||a.push(l)}}return[...r.values()].sort(xe)}function V(n){let e=[...n].sort((o,i)=>o.relativePath.localeCompare(i.relativePath)||o.startLine-i.startLine||i.endLine-o.endLine),t=[];for(let o of e)t.some(i=>ee(i,o))||t.push(o);return t}function Y(n,e){let t=e.text.split(`
|
|
2
|
-
`);return{symbol:e.relativePath,shortName:e.relativePath,relativePath:e.relativePath,startLine:0,endLine:Math.max(0,t.length-1),language:n.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath)?.language??E(e.relativePath),source:e.text,freshness:e.freshness,...b(e.freshness)?{bindingClosure:y(n,e.relativePath,0,Math.max(0,t.length-1))}:{}}}function ve(n,e){return L(n).filter(t=>e.some(o=>N(t,o))).length}function Se(n,e,t){let o=[];return q(o,n,e,t,0),o}function q(n,e,t,o,i){for(let r of t){if(o.some(u=>N(r,u)))continue;let a=L(r.children).filter(u=>!o.some(s=>N(u,s))).length;n.push({symbol:r.symbol,shortName:r.shortName,relativePath:e,startLine:r.startLine,endLine:r.endLine,signature:r.signature,depth:i,nestedDefinitions:a}),q(n,e,r.children,o,i+1)}}function L(n){return n.flatMap(e=>[e,...L(e.children)])}function De(n){return L(n).length}function N(n,e){return e.startLine<=n.startLine&&e.endLine>=n.endLine}function ee(n,e){return n.relativePath===e.relativePath&&n.startLine<=e.startLine&&n.endLine>=e.endLine}function xe(n,e){return n.startLine-e.startLine||e.endLine-n.endLine||n.symbol.localeCompare(e.symbol)}function Re(n,e){return{selector:n,status:"matched",kind:"source",totalCandidates:1,results:[e],definitions:[],candidates:[],omittedCandidates:0,suggestions:[]}}function R(n,e,t){return{selector:e,status:"missing",kind:"source",totalCandidates:0,results:[],definitions:[],candidates:[],omittedCandidates:0,suggestions:A(n,e,5),reason:t}}function ne(n,e){try{return C(n,e)}catch(t){if(t instanceof P)return null;throw t}}function Ne(n,e){if(!e.match)return[];let t=[e.match];for(let i of e.candidates){let r=h(n,i.relativePath).find(a=>a.symbol===i.symbol&&a.startLine===i.startLine);r&&t.push(r)}let o=new Set;return t.filter(i=>{let r=`${i.relativePath}:${i.startLine}:${i.endLine}:${i.symbol}`;return o.has(r)?!1:(o.add(r),!0)})}function te(n){return{symbol:n.symbol,shortName:S(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine}}function ie(n){let e=n.match(/^(.+):(\d+)-(\d+)$/);if(!e)return null;let t=Number(e[2]),o=Number(e[3]);if(!Number.isSafeInteger(t)||t<1)throw new RangeError(`Source range start line must be a positive integer, got "${e[2]}".`);if(!Number.isSafeInteger(o)||o<t)throw new RangeError(`Source range end line must be an integer at or after ${t}, got "${e[3]}".`);return{filePath:e[1],startLine:t,endLine:o}}function p(n,e,t){let o=n.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),i=C(n,e.relativePath);if(!i)return null;let a=i.text.split(`
|
|
3
|
-
`),u=e.endLine<=e.startLine?U(n,e.relativePath,e.startLine,Number.MAX_SAFE_INTEGER):null,s=u?.unitType?u.unitStartLine:e.startLine,l=u?.unitType?u.unitEndLine:e.endLine,d=Math.max(0,s-t),c=Math.min(a.length-1,l+t),f=a.slice(d,c+1).join(`
|
|
4
|
-
`);return{symbol:e.symbol,shortName:S(e.symbol),relativePath:e.relativePath,startLine:d,endLine:c,language:o?.language??E(e.relativePath),source:f,freshness:i.freshness,...b(i.freshness)?{bindingClosure:y(n,e.relativePath,d,c)}:{}}}function re(n,e,t,o,i){let r=C(n,e);if(!r)return null;let a=n.get("SELECT language FROM documents WHERE relative_path = ?",r.relativePath),s=r.text.split(`
|
|
5
|
-
`);if(t>s.length)return null;let l=Math.max(0,t-1-i),d=Math.min(s.length-1,o-1+i),c=s.slice(l,d+1).join(`
|
|
6
|
-
`);return{symbol:`${r.relativePath}:${t}-${o}`,shortName:`${r.relativePath}:${t}-${o}`,relativePath:r.relativePath,startLine:l,endLine:d,language:a?.language??E(r.relativePath),source:c,freshness:r.freshness,...b(r.freshness)?{bindingClosure:y(n,r.relativePath,l,d)}:{}}}function b(n){return!!(n&&n.semantic.state!=="stale"&&n.semantic.basis!=="no-compiler-document")}function E(n){switch(K(n).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{G as a,Je as b,Qe as c};
|
|
7
|
-
//# sourceMappingURL=chunk-W5OXRYGE.js.map
|
package/dist/chunk-W6STWDQI.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import{a as Z}from"./chunk-MPQ4OTBM.js";import{b as ht}from"./chunk-FRUSVINH.js";import{q as vt}from"./chunk-YEN6CYC7.js";import{a as gt}from"./chunk-WRQXLNYE.js";import{c as Se}from"./chunk-BJT7LSPK.js";import{A as dt,C as pt,E as mt,F as ft,J as yt,K as G,T as _,_ as xe,a as ot,b as ie,d as ae,h as st,i as he,j as Me,n as ge,p as ve,q as lt,r as be,s as k,t as D,v as M,w as ut,x as X,y as O,z as ct}from"./chunk-3L2ZBPEX.js";import{c as re}from"./chunk-RTQ7NEKG.js";import{c as Q}from"./chunk-IW5XQG5G.js";function Re(e){let t=e.replaceAll("\\","/");return ht(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}import{createHash as fe}from"crypto";import{setImmediate as jr}from"timers/promises";import{createRequire as qr}from"module";import{createHash as _n}from"crypto";var Ce=8;function ee(e,t,n){return Ge(bt(e,t,Ue(n),0,new Set))}function ze(e,t,n){return He(e,t,n,0,new Set)}function bt(e,t,n,r,i){if(r>Ce)return[];let a=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return a?St(e,t,a[1],a[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?xt(e,t,n,r,i):[]}function St(e,t,n,r,i,a){let s=[];for(let o of He(e,t,n,i+1,new Set(a))){let l=M(o.initializer);for(let u of l.namedChildren){if(u.type==="pair"){let d=u.childForFieldName("key")??u.namedChild(0);if(bn(d)!==r)continue;let c=u.childForFieldName("value")??u.namedChild(1);c&&s.push(...bt(e,o.definition.relativePath,Ue(c.text),i+1,new Set(a)));continue}if(/(?:method|function)/u.test(u.type)){if((u.childForFieldName("name")??u.namedChild(0))?.text!==r)continue;let c=gn(e,o.definition.relativePath,r,u);s.push(...c.length>0?c:[yn(o.definition,r,u)]);continue}if(u.type==="spread_element"){let d=u.namedChild(0);if(!d)continue;for(let c of He(e,o.definition.relativePath,Ue(d.text),i+1,new Set(a)))s.push(...St(e,c.definition.relativePath,c.definition.leaf,r,i+1,new Set(a)))}}}return Ge(s)}function yn(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function He(e,t,n,r,i){return r>Ce||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:xt(e,t,n,r,i).flatMap(a=>{let s=O(e,a.relativePath)?.rootNode,o=s?vn(s,a.leaf):null;return o?[{definition:a,initializer:o}]:[]})}function xt(e,t,n,r,i){if(r>Ce)return[];let a=`${t}\0${n}`;if(i.has(a))return[];i.add(a);let s=_(e,t).filter(u=>u.leaf===n);if(s.length>0)return s;let o=hn(e,t,n);if(o.length>0)return o;let l=G(e,t).find(u=>u.localName===n&&u.sourcePath);if(l?.sourcePath){let u=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return Ve(e,l.sourcePath,u,r+1,new Set(i))}return Ve(e,t,n,r+1,new Set(i))}function hn(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(pt(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function Ve(e,t,n,r,i){if(r>Ce)return[];let a=_(e,t).filter(s=>s.leaf===n);return a.length>0?a:Ge(yt(e,t).flatMap(s=>s.sourcePath?s.kind==="named"&&!s.names.includes(n)?[]:Ve(e,s.sourcePath,n,r+1,new Set(i)):[]))}function gn(e,t,n,r){return _(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function vn(e,t){let n=null;return k(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function bn(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ue(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Ge(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}var Sn=8;function V(e,t){return t?te(e,t,0,new Set):null}function te(e,t,n,r){if(n>Sn)return U(t,"value-evaluation-depth");let i=M(t),a=In(i);if(a)return Pn(e.file,i,a.term,a.value,a.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(u=>te(e,u,n+1,new Set(r)));if(l.length>=2&&l.every(u=>u!==null)){let u={kind:"concat",parts:l.map(c=>c.term)},d=l.map(c=>c.value).join("");return wn(e.file,i,u,d,l.some(c=>c.precision!=="literal")?"constrained-pattern":"literal",l)}}let s=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))return Nn(e,s,i,n,r);let o=En(i);return o?Bn(e,o.base,o.properties,i,n,r):i.type==="call_expression"||i.type==="call"?xn(e,i,n,r):U(i,`unsupported-expression:${i.type}`)}function xn(e,t,n,r){let a=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",s=Rn(e,a);if(s.length!==1)return U(t,s.length===0?"call-target-unresolved":"call-target-ambiguous");let o=s[0],l=`${o.relativePath}\0${o.symbol}`;if(r.has(l))return U(t,"call-return-cycle");let u=O(e.db,o.relativePath)?.rootNode;if(!u)return U(t,"call-target-unparsed");let d=D(u,o.startLine,o.endLine);if(!d)return U(t,"call-target-syntax-unavailable");let c=Cn(d);if(!c)return U(t,"call-return-not-single-expression");let p=new Set(r);p.add(l);let m=te({db:e.db,file:o.relativePath,root:u},c,n+1,p);return m?Ne(t,"bounded-call-return",m,o.symbol):U(t,"call-return-unresolved")}function Rn(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=_(e.db,e.file).filter(s=>s.isFunctionLike&&s.leaf===t);if(i.length>0)return i;let a=G(e.db,e.file).find(s=>s.localName===t&&s.sourcePath&&s.kind!=="namespace");return a?.sourcePath?Z(e.db,a.sourcePath,a.importedName==="default"?t:a.importedName).filter(s=>s.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=G(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?Z(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function Cn(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return Ct(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function Ct(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)Ct(e,r,n)}}function Nn(e,t,n,r,i){let a=`${e.file}\0${t}`;if(i.has(a))return U(n,"value-cycle");i.add(a);let s=je(e.root,t);if(s){let g=te(e,s,r+1,i);return g?Ne(n,"local-constant",g):U(n,"non-foldable-local")}let o=G(e.db,e.file).find(g=>g.localName===t&&g.sourcePath);if(!o?.sourcePath)return H(n,t,"unresolved-identifier");if(o.kind==="namespace")return H(n,t,"namespace-import-requires-property");let l=o.importedName==="default"?t:o.importedName,u=Z(e.db,o.sourcePath,l);if(u.length!==1)return H(n,t,u.length===0?"import-definition-missing":"import-definition-ambiguous");let d=u[0],c=O(e.db,d.relativePath)?.rootNode;if(!c)return H(n,d.symbol,"import-definition-unparsed");let p=je(c,d.leaf);if(!p)return H(n,d.symbol,"import-definition-non-value");let m=te({db:e.db,file:d.relativePath,root:c},p,r+1,i);return m?Ne(n,"imported-constant",m,d.symbol):H(n,d.symbol,"import-value-unresolved")}function Bn(e,t,n,r,i,a){let s=G(e.db,e.file).find(m=>m.localName===t&&m.sourcePath),o=e.file,l=t,u;if(s?.sourcePath){s.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=s.importedName==="default"?t:s.importedName;let m=Z(e.db,s.sourcePath,l);if(m.length!==1)return H(r,`${t}.${n.join(".")}`,m.length===0?"member-definition-missing":"member-definition-ambiguous");o=m[0].relativePath,l=m[0].leaf,u=m[0].symbol}let d=o===e.file?e.root:O(e.db,o)?.rootNode;if(!d)return H(r,u??t,"member-definition-unparsed");let c=je(d,l);if(!c)return H(r,u??t,"member-base-non-value");for(let m of n){let g=M(c);if(c=Tn(g,m),!c)return H(r,u??`${t}.${n.join(".")}`,`member-property-missing:${m}`)}let p=te({db:e.db,file:o,root:d},c,i+1,a);return p?Ne(r,"member-constant",p,u):H(r,u??t,"member-value-unresolved")}function In(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],a=0,s=/\$\{([^}]*)\}/gu;for(let o of r.matchAll(s)){let l=o.index??0;l>a&&i.push({kind:"literal",value:r.slice(a,l)}),i.push({kind:"unknown",reason:`template-hole:${o[1]?.trim()||"expression"}`}),a=l+o[0].length}return a<r.length&&i.push({kind:"literal",value:r.slice(a)}),{term:{kind:"pattern",language:"template",value:r.replace(s,"{}")},value:r.replace(s,"{}"),precision:"constrained-pattern"}}function Pn(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Be("direct-literal","direct",e,t)}}function wn(e,t,n,r,i,a){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Be("constant-concatenation","mechanically-derived",e,t),inputFactIds:a.flatMap(s=>s.derivation.inputFactIds),sourceSpans:a.flatMap(s=>s.derivation.sourceSpans)}}}function Ne(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function H(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Be(n,"heuristic","",e)}}function U(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Be(t,"heuristic","",e)}}function Be(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 En(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}var Rt=new WeakMap;function Fn(e){let t=Rt.get(e);if(t)return t;let n=new Map;return k(e,r=>{if(r.type!=="variable_declarator")return;let a=(r.childForFieldName("name")??r.namedChild(0))?.text.trim();if(!a||n.has(a))return;let s=r.parent;if(!s||s.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(s.text))return;let o=r.childForFieldName("value")??r.namedChild(1);o&&n.set(a,o)}),Rt.set(e,n),n}function je(e,t){return Fn(e).get(t)??null}function Tn(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 $n=new WeakMap,Tt=new Set(["delete","get","head","options","patch","post","put"]),Ln=/(?:^|\.)(?:app|router|server)$/u,kn=new Set(["findFirst","findMany","findUnique","from","get","select"]),On=new Set(["create","delete","insert","remove","update","upsert"]),An=new Set(["execute","query","raw"]),Nt=/(?:\b(?:name|id)|['"`](?:name|id)['"`])\s*:/u,Bt=/(?:^\s*|[,{]\s*)(?:async\s+)?['"`]?(?:execute|handler|invoke|run)['"`]?\s*(?::|\([^)]*\)\s*\{)/mu,It=/\b[A-Za-z_$][\w$-]*[_-][\w$-]*\s*\(/u,Pt=/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s+[A-Za-z_$][\w$-]*\s*\(/iu,Xe=[Vn(),Hn(),Dn(),Un(),Gn(),jn(),Kn()],Ke=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function Dn(){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=Mn(e.source),n=[];return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=t.direct.get(i),s=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),o=s&&t.namespaces.has(s[1])?s[2]:null,l=a??o;if(!l||!Ke.has(l))return;let u=W(r),d=A(u[0],e)??{value:u[0]?.text.trim()||"<missing>",evidence:"expression"},c=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(T(e,r,"builtin.node-child-process",c,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...d}],"exact","node-child-process-import"))}),n}}}function Mn(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let l of e.matchAll(i))for(let u of(l[1]??"").split(",")){let d=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[1])}let a=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(a))for(let u of(l[1]??"").split(",")){let d=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[1])}let s=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(s))n.add(l[1]);let o=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(o))n.add(l[1]);return{direct:t,namespaces:n}}function L(e,t,n,r){let i=oe(r,"runtime-boundaries.context.ast",t,()=>n===void 0?O(e,t):ct(e,t,n));if(!i)return null;let a=i.rootNode;n!==void 0&&$n.set(a,i);let s=n??he(e,t),o,l,u,d=()=>(l!==void 0||(l=oe(r,"runtime-boundaries.context.callable-sites",t,()=>{let c=ve(t);return(c?ft(a,c):null)??mt(e,t)})),l);return{db:e,file:t,source:s,root:a,get constants(){return u??=oe(r,"runtime-boundaries.context.constants",t,()=>Qn(a)),u},ownerAt:c=>{let m=(o??=oe(r,"runtime-boundaries.context.definitions",t,()=>_(e,t,{rangeCorrectionEvidence:{source:s,callables:d()}},(f,y)=>oe(r,`runtime-boundaries.context.definitions.${f}`,t,y)))).filter(f=>f.startLine<=c&&f.endLine>=c).sort((f,y)=>f.endLine-f.startLine-(y.endLine-y.startLine)||f.startLine-y.startLine)[0];if(m)return{file:t,symbol:m.symbol,name:m.leaf,startLine:m.startLine,endLine:m.endLine};let b=(d()??[]).filter(f=>f.startLine<=c&&f.endLine>=c).sort((f,y)=>f.endLine-f.startLine-(y.endLine-y.startLine)||f.startLine-y.startLine)[0];return{file:t,symbol:null,name:b?.name??null,startLine:b?.startLine??c,endLine:b?.endLine??c}}}}function oe(e,t,n,r){return e?e(t,r,{file:n}):r()}function Hn(){return{id:"builtin.effect-httpapi",supports:e=>se(e,"HttpApiEndpoint").size>0||se(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=se(e.source,"HttpApiEndpoint"),r=se(e.source,"HttpApiGroup"),i=se(e.source,"HttpApiBuilder");return q(e.root,"call_expression",a=>{let s=_t(a);if(!s)return;let o=W(a);if(n.has(s.receiver)&&Tt.has(s.member)){let b=A(o[0],e),f=A(o[1],e),y=Et(a,r,"make",0,e);if(!b||!f||!y)return;let v=s.member.toUpperCase();t.push(T(e,a,"builtin.effect-httpapi","http.handle",[{name:"method",value:v,evidence:"literal"},{name:"path",...f}],z([{name:"path",...f}]),"effect-httpapi-endpoint-declaration")),t.push(T(e,a,"builtin.effect-httpapi","framework.declare",qe(y,b),z(qe(y,b)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(s.member))return;let l=Et(a,i,"group",1,e),u=A(o[0],e),d=o[1];if(!l||!u||!d)return;let c=qe(l,u),p=ee(e.db,e.file,d.text),m=T(e,a,"builtin.effect-httpapi","framework.handle",c,p.length===1?z(c):"candidate","effect-httpapi-handler-registration"),g=p[0];p.length===1&&g&&(m.owner={file:g.relativePath,symbol:g.symbol,name:g.leaf,startLine:g.startLine,endLine:g.endLine}),t.push(m)}),t}}}function qe(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function se(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(r)){let s=a[2]??"";if(wt(s))for(let o of(a[1]??"").split(",")){let l=o.trim().replace(/^type\s+/u,""),u=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(l);u?.[1]===t&&n.add(u[2]??u[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(i)){let s=a[2]??"";s.endsWith(`/${t}`)&&wt(s)&&n.add(a[1])}return n}function wt(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function Et(e,t,n,r,i){let a=e.parent;for(;a;){if(a.type==="call_expression"){let s=Ft(a,t,n,r,i);if(s)return s;let o=a.childForFieldName("function")??a.namedChild(0),l=null;if(o&&We(o,u=>{!l&&u.type==="call_expression"&&(l=Ft(u,t,n,r,i))}),l)return l}a=a.parent}return null}function Ft(e,t,n,r,i){let a=_t(e);return!a||a.member!==n||!t.has(a.receiver)?null:A(W(e)[r],i)}function _t(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function Vn(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||le(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return q(e.root,["decorator","call_expression"],n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!le(e.source,["fastapi","flask"]))return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=ue(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",a=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",s=W(n);if(i==="route"&&le(e.source,["axum"])){let p=A(s[0],e),m=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(s[1]?.text??"")?.[1];if(!p||!m)return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:m.toUpperCase(),evidence:"literal"},{name:"path",...p}],z([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=A(s[0],e);if(!p)return;let g=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(s[1]?.text??"")?.[1]?.toUpperCase()??(s[1]?null:"GET"),b=[...g?[{name:"method",value:g,evidence:"literal"}]:[],{name:"path",...p}];t.push(T(e,n,"builtin.http","http.request",b,g?z(b):"candidate","call-expression"));return}if(!Tt.has(i))return;let o=A(s[0],e);if(!o)return;let l=i.toUpperCase();if(Ln.test(a)&&le(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"framework-adapter"));return}let d=Wn(e.source,["axios"]),c=a.split(".")[0]??"";d.has(c)&&t.push(T(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"client-adapter"))}),t}}}function Un(){return{id:"builtin.capability-registry",supports:e=>Nt.test(e)&&Bt.test(e)||It.test(e)||Pt.test(e),extract:e=>{let t=[],n=new Set,r=[];return Nt.test(e.source)&&Bt.test(e.source)&&r.push("pair"),(It.test(e.source)||Pt.test(e.source))&&r.push("string","string_literal","template_string"),q(e.root,r,i=>{if(i.type==="pair"){let s=i.childForFieldName("key")??i.namedChild(0),o=i.childForFieldName("value")??i.namedChild(1),l=s?.text.replace(/^['"`]|['"`]$/gu,"");if(l!=="name"&&l!=="id")return;let u=$t(o,e),d=tr(i);if(!u||u.evidence!=="literal"||!d)return;let c=`handle\0${u.value}\0${d.startPosition.row}`;if(n.has(c))return;n.add(c),t.push(T(e,d,"builtin.capability-registry","registry.handle",[{name:"key",...u}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(i.type))return;let a=i.text.replace(/^['"`]|['"`]$/gu,"");for(let s of a.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let o=s[1];if(!zn(a,o,s.index))continue;let l=`reference\0${o}\0${i.startPosition.row}`;n.has(l)||(n.add(l),t.push(T(e,i,"builtin.capability-registry","registry.reference",[{name:"key",value:o,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function zn(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function Gn(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return q(e.root,["pair","call_expression"],n=>{if(n.type==="pair"){let a=er(n);if(!a)return;let s=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),l=$t(s,e);if(!l||!o||!Lt(o))return;let u=Ze(o)?"exact":"candidate";t.push(T(e,n,"builtin.registry","registry.handle",[{name:"registry",value:a,evidence:"identifier"},{name:"key",...l}],z([{name:"key",...l}],u),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(T(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function jn(){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=rr(e.root);return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=i.split("."),s=a.at(-1)??"",o=W(r),l=o[0]?.text??"",u=nr(s,l);if(!u)return;let d=kt(a,n);if(!d)return;let c=qn(o[0],e)??ir(l),p=ar(d,a,s,c);if(!p)return;let m=s==="insert"?"persistence-insert":u==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(l)?"persistence-skip-locked-claim":"persistence-adapter";t.push(T(e,r,"builtin.persistence",u,[{name:"resource",...p}],z([{name:"resource",...p}]),m))}),t}}}function qn(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:A(e,t)}function Kn(){return{id:"builtin.queue",supports:e=>le(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return q(e.root,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".").at(-1)??"",a=W(n),s=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!s)return;let o=i==="send"||i==="subscribe"?Yn(a[0],"topic",e):A(a[0],e);o&&t.push(T(e,n,"builtin.queue",s,[{name:"address",...o}],z([{name:"address",...o}]),"framework-adapter"))}),t}}}function T(e,t,n,r,i,a,s){let o=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${_n("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:o,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:s,strength:a,protocol:r.split(".")[0]??r,role:Xn(r),executionDomain:Zn(e.file),derivation:{kind:a==="candidate"?"heuristic":a==="derived"?"mechanically-derived":"direct",rule:s,ruleVersion:"1",inputFactIds:i.flatMap(u=>u.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(u=>u.derivation?.sourceSpans??[])]},valuePrecision:i.some(u=>u.evidence==="expression")?"unknown":i.some(u=>u.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:Re(e.file)}}function Xn(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 Zn(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function le(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function Wn(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),a=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let s of e.matchAll(a)){let o=s[1]??s[2];o&&n.add(o)}}return n}function Ie(e,t,n,r,i,a,s){return T(e,t,n,r,i,a,s)}function ue(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function W(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function A(e,t){let n=V(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function Yn(e,t,n){if(!e)return null;let r=e.namedChildren.find(a=>a.type!=="pair"?!1:(a.childForFieldName("key")??a.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return A(i,n)}function $t(e,t){if(!e)return null;let n=A(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function z(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function Jn(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 Qn(e){let t=new Map;return We(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let a=Jn(i);a!==null&&t.set(r.text,a)}),t}function er(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function Ze(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function Lt(e){return Ze(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function tr(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),a=n.childForFieldName("value")??n.namedChild(1),s=i?.text.replace(/^['"`]|['"`]$/gu,"");if(s&&["execute","handler","invoke","run"].includes(s)&&a&&Lt(a))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function kt(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function nr(e,t){if(kn.has(e))return"database.read";if(On.has(e))return"database.write";if(!An.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 rr(e){let t=new Set;return q(e,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!kt(i)))for(let a of W(n)){if(!Ze(a))continue;let o=(a.childForFieldName("parameters")??a.namedChildren.find(u=>/parameters/u.test(u.type)))?.namedChildren[0],l=o?ut(o):null;l&&t.add(l)}}),t}function ir(e){let t=Ot(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function ar(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let a=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return a?{value:a,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=Ot(r.value);return i?{value:i,evidence:r.evidence}:null}function Ot(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function We(e,t){t(e);for(let n of e.namedChildren)We(n,t)}function q(e,t,n){for(let r of be(e,t))n(r)}var or=Q("resolved-call-syntax",{clearGroups:[]}),Ye=Q("resolved-call-sites",{clearGroups:[]}),sr=Q("resolved-call-sites-reference-evidence",{clearGroups:[]});function Je(e,t){return Ye.get(e,t.symbolId,()=>Dt(e,t,lr(e,t)))}function At(e,t){let n=[...new Map(t.map(a=>[a.symbolId,a])).values()],r=n.filter(a=>!Ye.has(e,a.symbolId)),i=Mt(e,r);return new Map(n.map(a=>[a.symbolId,Ye.get(e,a.symbolId,()=>Dt(e,a,i.get(a.symbolId)??[]))]))}function Dt(e,t,n){let r=[],i=[],a=new Set,s=new Set;for(let o of n){a.add(o.file);let l=or.get(e,o.file,()=>cr(e,o.file));if(!l){i.push({callee:t,file:o.file,line:o.startLine,reason:"ast-unavailable",candidates:0,referenceProvenance:o.provenance});continue}let u=(l.byLeaf.get(t.leaf)??[]).filter(({callNode:p})=>p.startPosition.row<=o.endLine&&p.endPosition.row>=o.startLine);if(u.length!==1){i.push({callee:t,file:o.file,line:o.startLine,reason:u.length===0?"call-not-found":"ambiguous-call",candidates:u.length,referenceProvenance:o.provenance});continue}let d=u[0],c=`${o.file}\0${d.callNode.startIndex}\0${d.callNode.endIndex}`;s.has(c)||(s.add(c),r.push({callee:t,caller:xe(_(e,o.file),d.callNode.startPosition.row),file:o.file,line:d.callNode.startPosition.row,startLine:d.callNode.startPosition.row,endLine:d.callNode.endPosition.row,targetText:d.targetNode.text,callNode:d.callNode,targetNode:d.targetNode,arguments:d.arguments,referenceProvenance:o.provenance}))}return{sites:r,unresolved:i,filesVisited:a.size}}function lr(e,t){return Mt(e,[t]).get(t.symbolId)??[]}function Mt(e,t){if(!ur(e))return new Map(t.map(r=>[r.symbolId,vt(e,r,{semantic:!1}).map(i=>({file:i.file,startLine:i.line,endLine:i.line,provenance:i.provenance}))]));let n=new Map;for(let r of gt(e,t.map(i=>i.symbolId))){let i=n.get(r.symbol_id)??[];i.push({file:r.relative_path,startLine:r.chunk_start,endLine:r.chunk_end,provenance:"scip-reference-chunk"}),n.set(r.symbol_id,i)}return new Map(t.map(r=>[r.symbolId,n.get(r.symbolId)??[]]))}function ur(e){return sr.get(e,"project",()=>!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))}function cr(e,t){let n=O(e,t)?.rootNode;if(!n)return null;let r=new Map;for(let i of be(n,["call_expression","call"])){let a=i.childForFieldName("function")??i.namedChild(0);if(!a)continue;let s=dt(a);if(!s)continue;let o=i.childForFieldName("arguments")??i.namedChildren.find(d=>d.type==="arguments"),l={callNode:i,targetNode:a,arguments:o?.namedChildren??[]},u=r.get(s);u?u.push(l):r.set(s,[l])}return{byLeaf:r}}var dr=Q("call-parameter-value-flow",{clearGroups:[]});function ce(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return dr.get(e,n,()=>pr(e,t))}function de(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function pr(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-unavailable",proof:n}))};let r=O(e,t.caller.relativePath)?.rootNode,i=r?D(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let a=X(i),s=[],o=[];return t.arguments.forEach((l,u)=>{let d=l.text.trim(),c=a.indexOf(d);c>=0?s.push({calleePosition:u,callerPosition:c,argumentText:d,proof:n}):o.push({calleePosition:u,argumentText:d,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:s,unknown:o}}var mr=8,fr=8;function Vt(e,t,n=[]){let r=[],i=yr(e,n,r),a=i.summaries,s=hr(e,t,a,r),o=gr(e,t,r);return{observations:Pr([...s.observations,...o]),bodySummaries:a.size,discriminatorSummaries:s.summaries,filesInspected:i.filesInspected,errors:r}}function yr(e,t,n){let r=new Map,i=[],a=new Map,s=o=>{if(a.has(o))return a.get(o)??null;let l=L(e,o);return a.set(o,l),l};for(let o of t){let l={...o,depth:0,proofSpans:[{file:o.definition.relativePath,startLine:o.definition.startLine,endLine:o.definition.endLine}]};r.set(o.definition.symbol,l),i.push(l)}for(;i.length>0;){let o=i.shift();if(!(o.depth>=mr))try{for(let l of Je(e,o.definition).sites){if(!s(l.file))continue;let d=l.caller;if(!d)continue;let c=de(ce(e,l),o.parameterIndexes);if(c.length===0)continue;let p={definition:d,parameterIndexes:Kt(c),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]};xr(r,p)&&i.push(r.get(d.symbol))}}catch(l){n.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{summaries:r,filesInspected:new Set(t.map(o=>o.definition.relativePath)).size}}function hr(e,t,n,r){let i=new Map,a=[],s=[];for(let o of t){if(o.action!=="http.request"||o.strength==="candidate"||o.sourceScope!=="production")continue;let l=zt(o);if(!l)continue;let u=L(e,o.source.file);if(!u)continue;let d=Gt(u.root,o.source.startLine),c=d.find(v=>v.startPosition.row===o.source.startLine)??d[0];if(!c)continue;let p=et(c);if(!p)continue;let m=ee(e,o.source.file,p.text);if(m.length!==1)continue;let g=n.get(m[0].symbol);if(!g)continue;let b=o.owner.symbol?_(e,o.owner.file).find(v=>v.symbol===o.owner.symbol):null;if(!b)continue;let f=Rr(u,b),y=Pe(c);for(let v of g.parameterIndexes){let R=Nr(u,y[v]);if(R)for(let x of Br(R)){let h=jt(x),S=qt(x);if(!h||!S)continue;let B=f.indexOf(S.text.trim());if(B>=0){let N={definition:b,carrier:l,field:h,parameterIndex:B,depth:0,proofObservationIds:[o.id],proofSpans:[o.source,{file:o.source.file,startLine:x.startPosition.row,endLine:x.endPosition.row}]},F=Ht(N);i.has(F)||(i.set(F,N),a.push(N));continue}let I=V(u,S);!I||I.evidence==="expression"||s.push(Qe(u,x,"carrier.publish",l,h,I.value,[o.id]))}}}for(;a.length>0;){let o=a.shift();if(!(o.depth>=fr))try{for(let l of Je(e,o.definition).sites){let u=L(e,l.file);if(!u)continue;let d=l.callNode,c=Pe(d)[o.parameterIndex];if(!c)continue;let p=V(u,c);p&&p.evidence!=="expression"&&s.push(Qe(u,d,"carrier.publish",o.carrier,o.field,p.value,o.proofObservationIds));let m=l.caller;if(!m)continue;let g=ce(e,l).transfers.find(y=>y.calleePosition===o.parameterIndex)?.callerPosition;if(g===void 0)continue;let b={...o,definition:m,parameterIndex:g,depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},f=Ht(b);i.has(f)||(i.set(f,b),a.push(b))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{observations:s,summaries:i.size}}function gr(e,t,n){let r=[],i=t.filter(a=>a.action==="registry.handle"&&a.strength!=="candidate"&&a.sourceScope==="production");for(let a of t){if(a.action!=="http.handle"||a.strength==="candidate"||a.sourceScope!=="production")continue;let s=zt(a);if(!s)continue;let o=L(e,a.source.file);if(!o)continue;let l=Gt(o.root,a.source.startLine)[0];if(l)for(let u of Pe(l).slice(1)){let d=ee(e,a.source.file,u.text);for(let c of d)try{let p=L(e,c.relativePath);if(!p)continue;let m=D(p.root,c.startLine,c.endLine);if(!m)continue;k(m,g=>{if(g.type!=="call_expression")return;let b=et(g);if(!b)return;let f=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(b.text.trim());if(!f)return;let y=f[1],v=f[2],R=br(e,p,c,v);if(!R)return;let x=Sr(e,c.relativePath,y);for(let h of i){let S=h.keyParts.find(F=>F.name==="registry")?.value,B=h.keyParts.find(F=>F.name==="key")?.value;if(!S||!B||!x.some(F=>F.file===h.source.file&&F.binding===S))continue;let I=L(e,h.source.file),N=I?Cr(I.root,h.source.startLine):null;!I||!N||r.push(Qe(I,N,"carrier.consume",s,R,B,[a.id,h.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${c.relativePath}: ${tt(p)}`)}}}return r}function Ut(e){let t=_(e.db,e.file),n=new Map;return k(e.root,r=>{if(r.type!=="pair"||jt(r)?.toLowerCase()!=="body")return;let i=qt(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let a=xe(t,r.startPosition.row),s=vr(r);if(!a||!s)return;let o=X(s),l=new Set;Ir(i,o,l);let u=n.get(a.symbol)??new Set;o.forEach((d,c)=>{d&&l.has(d)&&u.add(c)}),u.size>0&&n.set(a.symbol,u)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[{definition:r,parameterIndexes:[...i].sort((a,s)=>a-s)}]:[]})}function vr(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function br(e,t,n,r){let i=D(t.root,n.startLine,n.endLine);if(!i)return null;let a=new RegExp(`\\.body\\??\\.${ge(r)}\\b`,"u");if(a.test(i.text))return r;let s=null;if(k(i,d=>{if(s||d.type!=="variable_declarator")return;let c=d.childForFieldName("name")??d.namedChild(0),p=d.childForFieldName("value")??d.namedChild(1);!c||!p||!new RegExp(`(?:^|[,{}])\\s*${ge(r)}\\s*(?:[,}]|$)`,"u").test(c.text)||p.type==="call_expression"&&(s=et(p)?.text??null)}),!s)return null;let o=ee(e,n.relativePath,s);if(o.length!==1)return null;let l=L(e,o[0].relativePath),u=l?D(l.root,o[0].startLine,o[0].endLine):null;return u&&a.test(u.text)&&new RegExp(`\\b${ge(r)}\\s*[,}]`,"u").test(u.text)?r:null}function Sr(e,t,n){let r=[];for(let i of ze(e,t,n)){let a=M(i.initializer);if(a.type==="call_expression")for(let s of Pe(a)){let o=s.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(o))for(let l of ze(e,i.definition.relativePath,o))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Qe(e,t,n,r,i,a,s){let l=Ie(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:a,evidence:"constant",term:{kind:"literal",value:a}}],"derived","http-body-registry-discriminator");return l.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...s],sourceSpans:[l.source]},l}function zt(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function xr(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Kt([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function Ht(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function Rr(e,t){let n=D(e.root,t.startLine,t.endLine);return n?X(n):[]}function Cr(e,t){let n=null;return k(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function Gt(e,t){let n=[];return k(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function et(e){return e.childForFieldName("function")??e.namedChild(0)}function Pe(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Nr(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return M(t);let r=null;return k(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),r?M(r):M(t)}function Br(e){let t=M(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function jt(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function qt(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function Ir(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function Kt(e){return[...new Set(e)].sort((t,n)=>t-n)}function Pr(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function tt(e){return e instanceof Error?e.message:String(e)}import{createHash as wr}from"crypto";function Xt(e,t){let n=new Map;for(let a of t){if(a.action!=="http.handle"||a.sourceScope!=="production")continue;let s=n.get(a.source.file)??[];s.push(a),n.set(a.source.file,s)}let r=[],i=Er(e);for(let a of i.mounts)for(let s of a.targetFiles)for(let o of n.get(s)??[]){let l=o.keyParts.find(p=>p.name==="path");if(!l||l.evidence==="expression")continue;let u=Tr(a.prefix.value,l.value),d=o.keyParts.map(p=>p.name==="path"?{name:"path",value:u,evidence:"constant",term:{kind:"concat",parts:[a.prefix.term??{kind:"literal",value:a.prefix.value},l.term??{kind:"literal",value:l.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line},...a.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:p),c=`${o.id}\0${a.file}\0${a.line}\0${u}`;r.push({...o,id:`boundary:${wr("sha256").update(c).digest("hex").slice(0,16)}`,keyParts:d,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line}]},resolution:"unresolved"}),o.strength="candidate",o.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function Er(e){let t=[],n=Se(e);for(let r of n){let i=he(e,r);if(!_r(i))continue;let a=L(e,r);a&&Zt(a.root,s=>{if(s.type!=="call_expression")return;let o=s.childForFieldName("function")??s.namedChild(0);if(!o||!o.text.replace(/\s+/gu,"").endsWith(".use"))return;let l=$r(s);if(l.length<2)return;let u=V(a,l[0]);if(!u||u.evidence==="expression")return;let d=Fr(e,r,l[1]);d.length!==0&&t.push({file:r,line:s.startPosition.row,prefix:{value:u.value,evidence:u.evidence,term:u.term,derivation:u.derivation},targetFiles:d})})}return{mounts:t,filesInspected:n.length}}function Fr(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let a=G(e,t).find(l=>l.localName===i&&l.sourcePath);if(!a?.sourcePath)return[t];if(a.kind==="namespace")return[a.sourcePath];let s=a.importedName==="default"?i:a.importedName,o=Z(e,a.sourcePath,s);return[...new Set(o.map(l=>l.relativePath))]}function Tr(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function _r(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function $r(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Zt(e,t){t(e);for(let n of e.namedChildren)Zt(n,t)}import{createHash as Lr}from"crypto";function we(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}var Fe=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),kr=8,Wt=ie({kind:"runtime-boundary-http-roles",invalidation:ae("runtime-boundary-http-roles"),serialize:Mr,deserialize:Hr});function Qt(e,t,n){let r=n??((f,y)=>y()),i=new Map,a=[],s=[],o=new Set,l=[],u=[],d=new Map,c=new Map,p=new Map,m=f=>{if(d.has(f))return d.get(f)??null;let y=L(e,f);return d.set(f,y),y},g=f=>{let y=c.get(f);if(y)return y;let v=_(e,f);return c.set(f,v),v},b=(f,y)=>{let v=p.get(f.file);if(!v){let h=re(e,f.file,f.source),S=Wt.read(e,f.file,h)??[];v={contentHash:h,roles:new Map(S.map(B=>[B.symbol,B])),dirty:!1},p.set(f.file,v)}let R=v.roles.get(y.symbol);if(R)return R;let x=Dr(f,y);return v.roles.set(y.symbol,{symbol:y.symbol,...x}),v.dirty=!0,x};for(r("runtime-boundaries.http-summary.seed",()=>{for(let f of t){if(f.action!=="http.request"||!f.owner.symbol||f.evidence!=="call-expression"&&f.evidence!=="client-adapter")continue;let y=g(f.owner.file).find(h=>h.symbol===f.owner.symbol);if(!y)continue;let v=m(y.relativePath);if(!v)continue;let R=b(v,y),x={definition:y,...R,constantMethods:f.keyParts.flatMap(h=>h.name==="method"&&h.evidence!=="expression"&&Fe.has(h.value.toUpperCase())?[h.value.toUpperCase()]:[]),depth:0,proofObservationIds:[f.id],proofSpans:[f.source]};Jt(i,x)&&a.push(i.get(y.symbol))}});a.length>0;){let f=a.splice(0,a.length),y=r("runtime-boundaries.http-summary.resolve-call-sites",()=>At(e,f.map(v=>v.definition)),{batchSize:f.length});r("runtime-boundaries.http-summary.process-call-sites",()=>{for(let v of f)if(!(v.depth>=kr))try{let R=y.get(v.definition.symbolId);if(!R)continue;u.push(...R.unresolved.map(x=>Or(v,x)));for(let x of R.sites){let h=m(x.file);if(!h)continue;o.add(x.file);let S=x.callNode,B=Ar(v,S,h);B&&s.push(B);let I=x.caller;if(!I)continue;let N=b(h,I),F=Vr(e,v,x),$={definition:I,pathParameterIndexes:Ee([...N.pathParameterIndexes,...F.pathParameterIndexes]),methodParameterIndexes:Ee([...N.methodParameterIndexes,...F.methodParameterIndexes]),constantMethods:ne([...v.constantMethods,...N.constantMethods]),depth:v.depth+1,proofObservationIds:ne([...v.proofObservationIds,...B?[B.id]:[]]),proofSpans:[...v.proofSpans,{file:x.file,startLine:x.startLine,endLine:x.endLine}]};Jt(i,$)&&a.push(i.get(I.symbol))}}catch(R){l.push(`builtin.http-summary failed for ${v.definition.relativePath}:${v.definition.startLine+1}: ${R instanceof Error?R.message:String(R)}`)}},{batchSize:f.length})}return Wt.writeBatch(e,[...p.entries()].flatMap(([f,y])=>y.dirty?[{relativePath:f,contentHash:y.contentHash,value:[...y.roles.values()].sort((v,R)=>v.symbol.localeCompare(R.symbol))}]:[])),{observations:s,frontiers:we(u),summaries:i.size,filesInspected:o.size,errors:l}}function Or(e,t){let n=ne([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${Lr("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:Re(t.file)}}function Ar(e,t,n){let r=en(t),i=e.pathParameterIndexes.flatMap(c=>{let p=V(n,r[c]);return p&&p.evidence!=="expression"&&zr(p.value)?[{index:c,value:p}]:[]}),a=e.methodParameterIndexes.flatMap(c=>{let p=V(n,r[c]),m=p?.value.toUpperCase();return p&&m&&p.evidence!=="expression"&&Fe.has(m)?[{index:c,value:{...p,value:m}}]:[]}),s=ne([...e.constantMethods,...a.map(c=>c.value.value)]);if(i.length!==1||s.length!==1)return null;let o=i[0].value,l=a.find(c=>c.value.value===s[0])?.value,u=[{name:"method",value:s[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:s[0]},derivation:l?.derivation},{name:"path",value:o.value,evidence:"constant",term:o.term,derivation:o.derivation}],d=Ie(n,t,"builtin.http-summary","http.request",u,"derived","compiler-resolved-http-summary");return d.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,d.source]},d}function Dr(e,t){let n=D(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=X(n),i=new Set,a=new Set,s=new Set;return k(n,o=>{if(o.type==="call_expression"&&((o.childForFieldName("function")??o.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let m=en(o);pe(m[0],r,i);let g=Ur(m[1],"method");if(g){pe(g,r,a);let b=V(e,g),f=b?.value.toUpperCase();f&&b?.evidence!=="expression"&&Fe.has(f)&&s.add(f)}else pe(m[1],r,a)}if(o.type!=="pair")return;let l=o.childForFieldName("key")??o.namedChild(0),u=o.childForFieldName("value")??o.namedChild(1),d=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(d==="url"||d==="path"||d==="endpoint")&&pe(u,r,i),(d==="init"||d==="requestinit"||d==="options")&&pe(u,r,a)}),{pathParameterIndexes:r.flatMap((o,l)=>o&&i.has(o)?[l]:[]),methodParameterIndexes:r.flatMap((o,l)=>o&&a.has(o)?[l]:[]),constantMethods:[...s].sort()}}function Mr(e){return e.map(t=>[encodeURIComponent(t.symbol),t.pathParameterIndexes.join(","),t.methodParameterIndexes.join(","),t.constantMethods.join(",")].join(" ")).join(`
|
|
2
|
-
`)}function Hr(e){if(!e)return[];let t=[];for(let n of e.split(`
|
|
3
|
-
`)){let r=n.split(" ");if(r.length!==4)return null;let i=Yt(r[1]),a=Yt(r[2]),s=r[3]?r[3].split(","):[];if(i===null||a===null||s.some(o=>!Fe.has(o)))return null;t.push({symbol:decodeURIComponent(r[0]),pathParameterIndexes:i,methodParameterIndexes:a,constantMethods:s})}return t}function Yt(e){if(!e)return[];let t=e.split(",").map(Number);return t.every(n=>Number.isSafeInteger(n)&&n>=0)?t:null}function Vr(e,t,n){let r=ce(e,n);return{pathParameterIndexes:de(r,t.pathParameterIndexes),methodParameterIndexes:de(r,t.methodParameterIndexes)}}function Jt(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Ee([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=Ee([...n.methodParameterIndexes,...t.methodParameterIndexes]),a=ne([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||a.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:a,depth:Math.min(n.depth,t.depth),proofObservationIds:ne([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function Ur(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function pe(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function en(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function zr(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function Ee(e){return[...new Set(e)].sort((t,n)=>t-n)}function ne(e){return[...new Set(e)].sort()}import{createHash as Gr}from"crypto";function rn(e){let t=tn(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=tn(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?nt(r).flatMap(i=>{let a=t.get(i)?.[0];return a?[nn(r,a,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?nt(r).flatMap(i=>{let a=n.get(i)?.[0];return a?[nn(r,a,i,"queue.consume")]:[]}):[])}function tn(e){let t=new Map;for(let n of e)for(let r of nt(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function nt(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function nn(e,t,n,r){let i=`database:${n}`,a=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",s=[e.id,r,i,a].join("\0");return{...e,id:`boundary:${Gr("sha256").update(s).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:a,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var ye="runtime-boundaries-v19",Kr=qr(import.meta.url),w=Kr("typescript"),Xr=new Set([w.SyntaxKind.WhitespaceTrivia,w.SyntaxKind.NewLineTrivia,w.SyntaxKind.SingleLineCommentTrivia,w.SyntaxKind.MultiLineCommentTrivia]),Zr=new Set([w.SyntaxKind.NoSubstitutionTemplateLiteral,w.SyntaxKind.TemplateHead,w.SyntaxKind.TemplateMiddle,w.SyntaxKind.TemplateTail]),$e=[{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}],Wr=64,cn="builtin.http-summary",Le={HTTP_HANDLE:"http.handle",HTTP_REQUEST:"http.request",REGISTRY_HANDLE:"registry.handle"},rt=new Set(Object.values(Le));async function Yr(e,t={}){let n=Se(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(vi)),a=t.previousGraph?.fileCoverage,s=i.size>0&&t.previousGraph?.extractorVersion===ye&&a!==void 0&&a.length===t.previousGraph.coverage.filesScanned,o=s?a.filter(C=>r.has(C.file)&&!i.has(C.file)):[],l=new Set(o.flatMap(C=>C.observationIds)),u=s?t.previousGraph.observations.filter(C=>l.has(C.id)&&r.has(C.source.file)):[],d=s?n.filter(C=>i.has(C)):n,c=[],p=a?.reduce((C,P)=>C+P.observationIds.length,0)??0,m=performance.now(),g=await pi(e,d,t.profileSpan);j(c,"direct-extraction",m,d.length,g.observations.length,{filesVisited:d.length,filesReused:o.length,factsReused:u.length,factsInvalidated:Math.max(0,p-u.length)});let b=[...o,...g.fileCoverage].sort((C,P)=>C.file.localeCompare(P.file)),f=gi(b),y=b.flatMap(C=>C.extractionErrors),v=me([...u,...g.observations]);if(s&&!t.forceDerivedRebuild&&t.previousGraph&&Jr(a,g.fileCoverage,i)&&(!ii(e,t.previousGraph,i)||si(a,g.fileCoverage,i)&&!li(t.previousGraph,i))){for(let P of t.previousGraph.coverage.extractors)f.has(P.id)||f.set(P.id,P);let C=ci(t.previousGraph.coverage.phases);return c.push(...C),{...t.previousGraph,observations:t.previousGraph.observations,relationGroups:t.previousGraph.relationGroups,links:t.previousGraph.links,frontiers:t.previousGraph.frontiers,coverage:{filesScanned:n.length,filesWithAst:b.filter(P=>P.hasAst).length,filesWithoutAst:b.filter(P=>!P.hasAst).length,filesReused:o.length,extractors:[...f.values()],extractionErrors:t.previousGraph.coverage.extractionErrors,phases:c},fileCoverage:b}}let R=me([...v,...rn(v)]),x=s&&t.previousGraph!==void 0?Qr(t.previousGraph,a,g.fileCoverage,i,v):{reuse:!1,shapeUnchanged:!1,proofFilesUnchanged:!1,seedUnchanged:!1},h=x.reuse;t.profileSpan?.("runtime-boundaries.http-summary.reuse-decision",()=>{},x),m=performance.now();let S;if(h){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="http-summary"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.wrapper");S={observations:t.previousGraph.observations.filter(E=>E.extractor===cn),frontiers:t.previousGraph.frontiers.filter(E=>E.kind==="call-resolution"&&E.action===Le.HTTP_REQUEST),summaries:0,filesInspected:C?.filesVisited??P?.applicableFiles??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.http-summary failed"))},j(c,"http-summary",m,R.length,S.observations.length,{filesVisited:0,filesReused:S.filesInspected,factsReused:S.observations.length+S.frontiers.length,factsInvalidated:0}),P&&f.set(P.id,P)}else S=Qt(e,R,t.profileSpan),j(c,"http-summary",m,R.length,S.observations.length,{filesVisited:S.filesInspected}),f.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:S.filesInspected,observations:S.observations.length,errors:S.errors.length});y.push(...S.errors);let B=me([...R,...S.observations]);m=performance.now();let I=Xt(e,B);j(c,"http-mount",m,B.length,I.observations.length,{filesVisited:I.filesInspected});let N=me([...B,...I.observations]);m=performance.now();let F=h&&t.previousGraph!==void 0&&ei(t.previousGraph,a,g.fileCoverage,i),$;if(F){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="carrier"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.carrier");$={observations:t.previousGraph.observations.filter(E=>E.extractor==="builtin.carrier"),bodySummaries:P?.applicableFiles??0,discriminatorSummaries:0,filesInspected:C?.filesVisited??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.carrier"))},j(c,"carrier",m,N.length,$.observations.length,{filesVisited:0,filesReused:$.filesInspected,factsReused:$.observations.length,factsInvalidated:0}),P&&f.set(P.id,P)}else $=Vt(e,N,b.flatMap(C=>C.bodySummaries??[])),j(c,"carrier",m,N.length,$.observations.length,{filesVisited:$.filesInspected}),f.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:$.bodySummaries,observations:$.observations.length,errors:$.errors.length});y.push(...$.errors);let K=me([...N,...$.observations]);m=performance.now();let J=bi(K);j(c,"relations",m,K.length,J.length),m=performance.now();let it=xi(K,J);j(c,"links",m,J.length,it.length),Ri(K,J),m=performance.now();let at=we([...Ci(K,J),...S.frontiers]);return j(c,"frontiers",m,K.length,at.length),{schemaVersion:2,extractorVersion:ye,observations:K,relationGroups:J,links:it,frontiers:at,coverage:{filesScanned:n.length,filesWithAst:b.filter(C=>C.hasAst).length,filesWithoutAst:b.filter(C=>!C.hasAst).length,...s?{filesReused:o.length}:{},extractors:[...f.values()],extractionErrors:y,phases:c},fileCoverage:b}}function Jr(e,t,n){if(!e)return!1;let r=e.filter(a=>n.has(a.file)).filter(an).map(on).sort((a,s)=>a.file.localeCompare(s.file)),i=t.filter(an).map(on).sort((a,s)=>a.file.localeCompare(s.file));return JSON.stringify(r)===JSON.stringify(i)}function an(e){return e.observationIds.length>0||e.extractionErrors.length>0}function on(e){let{syntaxHash:t,shapeHash:n,bodySummaries:r,...i}=e;return i}function Qr(e,t,n,r,i){let a=ni(t,n,r),s=ri(e),l=![...dn(t,n)].some(p=>s.has(p)),u=new Set((t??[]).filter(p=>r.has(p.file)).flatMap(p=>p.observationIds)),d=new Set(n.flatMap(p=>p.observationIds)),c=sn(e.observations,u)===sn(i,d);return{reuse:a&&l&&c,shapeUnchanged:a,proofFilesUnchanged:l,seedUnchanged:c}}function dn(e,t){let n=new Map(e?.map(r=>[r.file,r.syntaxHash])??[]);return new Set(t.filter(r=>r.syntaxHash===void 0||n.get(r.file)!==r.syntaxHash).map(r=>r.file))}function ei(e,t,n,r){if(!t)return!1;let i=t.filter(l=>r.has(l.file)).map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file)),a=n.map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file));if(JSON.stringify(i)!==JSON.stringify(a))return!1;let s=dn(t,n),o=ti(e,"builtin.carrier");return![...s].some(l=>o.has(l))}function ti(e,t){let n=new Set;for(let r of e.observations)if(r.extractor===t){n.add(r.source.file);for(let i of r.derivation.sourceSpans)n.add(i.file)}return n}function ni(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.shapeHash]));return t.length===n.size&&t.every(i=>i.shapeHash!==void 0&&r.get(i.file)===i.shapeHash)}function ri(e){let t=new Set;for(let n of e.observations)if(n.extractor===cn){t.add(n.source.file);for(let r of n.derivation.sourceSpans)t.add(r.file)}for(let n of e.frontiers)n.kind==="call-resolution"&&n.action===Le.HTTP_REQUEST&&n.source&&t.add(n.source.file);return t}function sn(e,t){return JSON.stringify(e.filter(n=>t.has(n.id)&&n.action===Le.HTTP_REQUEST&&n.owner.symbol!==null&&(n.evidence==="call-expression"||n.evidence==="client-adapter")).map(n=>({ownerSymbol:n.owner.symbol,evidence:n.evidence,methods:n.keyParts.filter(r=>r.name==="method"&&r.evidence!=="expression").map(r=>r.value.toUpperCase()).sort()})).sort((n,r)=>`${n.ownerSymbol}\0${n.evidence}\0${n.methods.join(",")}`.localeCompare(`${r.ownerSymbol}\0${r.evidence}\0${r.methods.join(",")}`)))}function ii(e,t,n){let r=ai(t),i=oi(t);if([...n].some(o=>r.has(o)))return!0;if(i.size===0||n.size===0)return!1;if(!!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))return!0;let s=[...n];for(let o=0;o<s.length;o+=750){let l=s.slice(o,o+750),u=l.map(()=>"?").join(",");if(e.all(`SELECT DISTINCT global_symbol.symbol
|
|
4
|
-
FROM mentions mention
|
|
5
|
-
JOIN chunks reference_chunk ON reference_chunk.id = mention.chunk_id
|
|
6
|
-
JOIN documents reference_document ON reference_document.id = reference_chunk.document_id
|
|
7
|
-
JOIN global_symbols global_symbol ON global_symbol.id = mention.symbol_id
|
|
8
|
-
WHERE mention.role != 1
|
|
9
|
-
AND reference_document.relative_path IN (${u})`,...l).some(c=>i.has(c.symbol)))return!0}return!1}function ai(e){let t=new Set;for(let n of e.observations)if(rt.has(n.action)){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)!n.action||!rt.has(n.action)||!n.source||t.add(n.source.file);return t}function oi(e){return new Set(e.observations.flatMap(t=>rt.has(t.action)&&t.owner.symbol?[t.owner.symbol]:[]))}function si(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.syntaxHash]));return t.length===n.size&&t.every(i=>i.syntaxHash!==void 0&&r.get(i.file)===i.syntaxHash)}function li(e,t){let n=ui(e);return[...t].some(r=>n.has(r))}function ui(e){let t=new Set;for(let n of e.observations){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)n.source&&t.add(n.source.file);return t}function ci(e){return(e??[]).filter(t=>t.id!=="direct-extraction").map(t=>({...t,durationMs:0,filesVisited:0,filesReused:t.filesVisited??0,factsReused:t.outputFacts,factsInvalidated:0}))}function j(e,t,n,r,i,a={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...a})}var di=256;async function pi(e,t,n){let r=[],i=[],a=n??((c,p)=>p()),s=[],o=[],l=new Map,u=c=>{let p=l.get(c);if(p!==void 0)return p;let m=re(e,c,Me(e,c));return l.set(c,m),m},d=0;for(let c of t){d+=1,d>=di&&(d=0,ot(),await jr());let p=a("runtime-boundaries.file.read",()=>Me(e,c)),m=re(e,c,p);l.set(c,m);let g=a("runtime-boundaries.file.direct-product",()=>{let h=un.read(e,c,m);if(!h||h.extractorVersion!==ye)return null;for(let S of h.deps)if(u(S.path)!==S.contentHash)return null;return h});if(g){r.push(...g.observations),i.push(g.coverage);continue}let b=a("runtime-boundaries.file.supports",()=>Xe.filter(h=>h.supports(p))),f=/\bJSON\.stringify\s*\(/u.test(p)&&/\bbody\s*:/u.test(p),y=a("runtime-boundaries.file.hashes",()=>{let h=ln.read(e,c,m);if(h)return h;let S=mi(c,p);return s.push({relativePath:c,contentHash:m,value:S}),S}),v=new Set,R=[],x=st(h=>v.add(h),()=>{let h=b.length>0||f?L(e,c,p,n):null,S={file:c,hasAst:h!==null||hi(c,p),syntaxHash:y.syntaxHash,shapeHash:y.shapeHash,bodySummaries:h&&f?Ut(h):[],observationIds:[],extractors:[],extractionErrors:[]};if(h)for(let B of b){let I={id:B.id,applicableFiles:1,observations:0,errors:0};try{let N=yi(n,`runtime-boundaries.extractor.${B.id}`,c,()=>B.extract(h));I.observations=N.length,R.push(...N),S.observationIds.push(...N.map(F=>F.id))}catch(N){I.errors=1,S.extractionErrors.push(`${B.id} failed for ${c}: ${N instanceof Error?N.message:String(N)}`)}S.extractors.push(I)}return S});r.push(...R),i.push(x),x.extractionErrors.length===0&&(v.delete(c),o.push({relativePath:c,contentHash:m,value:{extractorVersion:ye,deps:[...v].sort().map(h=>({path:h,contentHash:u(h)})),observations:R,coverage:x}}))}return s.length>0&&ln.writeBatch(e,s),o.length>0&&un.writeBatch(e,o),{observations:r,fileCoverage:i}}var ln=ie({kind:"runtime-boundary-source-hashes",invalidation:ae("runtime-boundary-source-hashes"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.syntaxHash=="string"&&typeof t.shapeHash=="string"?{syntaxHash:t.syntaxHash,shapeHash:t.shapeHash}:null}catch{return null}}}),un=ie({kind:"runtime-boundary-direct-extraction",invalidation:ae("runtime-boundary-direct-extraction"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.extractorVersion!="string"||!Array.isArray(t.deps)||!Array.isArray(t.observations)||typeof t.coverage!="object"||t.coverage===null||!t.deps.every(n=>typeof n=="object"&&n!==null&&typeof n.path=="string"&&typeof n.contentHash=="string")?null:t}catch{return null}}});function mi(e,t){if(!/\.(?:[cm]?[jt]sx?)$/iu.test(e)){let u=fe("sha256").update(t).digest("hex");return{syntaxHash:u,shapeHash:u}}let n=/\.[jt]sx$/iu.test(e)?w.LanguageVariant.JSX:w.LanguageVariant.Standard,r=w.createScanner(w.ScriptTarget.Latest,!1,n,t),i=fe("sha256"),a=fe("sha256"),s=[],o=[0];for(let u=0;u<t.length;u+=1)t.charCodeAt(u)===10&&o.push(u+1);let l=0;for(let u=r.scan();u!==w.SyntaxKind.EndOfFileToken;u=r.scan()){if(u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)===0&&(u=r.reScanTemplateToken(!1)),Xr.has(u))continue;let d=r.getTokenText();for(;o[l+1]!==void 0&&o[l+1]<=r.getTokenPos();)l+=1;i.update(String(u)),i.update("\0"),i.update(d),i.update("\0"),i.update(String(l)),i.update("\0"),a.update(String(u)),a.update("\0"),!Zr.has(u)&&!fi(u,d)&&a.update(d),a.update("\0"),a.update(String(l)),a.update("\0"),u===w.SyntaxKind.TemplateHead?s.push(0):u===w.SyntaxKind.TemplateTail?s.pop():u===w.SyntaxKind.OpenBraceToken&&s.length>0?s[s.length-1]+=1:u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)>0&&(s[s.length-1]-=1)}return{syntaxHash:i.digest("hex"),shapeHash:a.digest("hex")}}function fi(e,t){if(e!==w.SyntaxKind.StringLiteral||t.length<2)return!1;let n=t.slice(1,-1);return n.startsWith("/")||n.includes("://")}function yi(e,t,n,r){return e?e(t,r,{file:n}):r()}function hi(e,t){return t?lt(e)?/<script\b/iu.test(t):ve(e)!==null:!1}function gi(e){let t=new Map(Xe.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function vi(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function bi(e){let t=new Map;for(let n of $e){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let a=Bi(i,n.keyNames);if(!a)continue;let s=a.map(c=>`${c.name}=${mn(c.name,c.value)}`).join("\0"),o=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${o}\0${s}`,u=`boundary-group:${fe("sha256").update(l).digest("hex").slice(0,16)}`,d=t.get(u)??{id:u,protocol:n.protocol,joinRule:n.id,normalizedKey:s,keyParts:a,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&d.producerIds.push(i.id),n.consumerActions.includes(i.action)&&d.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&d.declarationIds.push(i.id),d.derivation.inputFactIds.push(i.id),d.derivation.sourceSpans.push(i.source),t.set(u,d)}}return[...t.values()].map(Si).sort(Pi)}function Si(e){return{...e,producerIds:Te(e.producerIds),consumerIds:Te(e.consumerIds),declarationIds:Te(e.declarationIds),derivation:{...e.derivation,inputFactIds:Te(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function xi(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let a=$e.find(o=>o.id===i.joinRule);if(!a?.traversable)continue;let s=a.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(s.length===0||i.consumerIds.length===0)&&!(a.requireUniquePair&&(s.length!==1||i.consumerIds.length!==1))&&!(a.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(s.length*i.consumerIds.length>Wr))for(let o of s)for(let l of i.consumerIds){let u=n.get(o),d=n.get(l);if(!u||!d||Ii(u,d))continue;let c=u.strength==="derived"||d.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${o}\0${l}`,m={id:`boundary-link:${fe("sha256").update(p).digest("hex").slice(0,16)}`,from:o,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:c,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[o,l],sourceSpans:[u.source,d.source]}};r.set(m.id,m)}}return[...r.values()].sort(wi)}function Ri(e,t){let n=new Set(t.filter(pn).flatMap(_e)),r=new Set(t.filter(Ni).flatMap(_e));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function Ci(e,t){let n=new Set(e.filter(a=>a.strength!=="candidate").map(a=>`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)),r=new Set(t.flatMap(_e)),i=new Set(t.filter(pn).flatMap(_e));return e.filter(a=>a.sourceScope==="production").filter(a=>a.strength!=="candidate"||!n.has(`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)).filter(a=>!i.has(a.id)).map(a=>{let s=a.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),o=s.length>0?`${a.extractor} observed ${a.action}, but ${s.join(", ")} remained symbolic or unknown.`:a.resolution==="ambiguous"?`${a.extractor} established the address for ${a.action}, but more than one indexed peer has the same runtime key.`:r.has(a.id)?`${a.extractor} established the address for ${a.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${a.extractor} observed ${a.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:a.id,reason:o,missingKeyParts:s,sourceScope:a.sourceScope}}).sort((a,s)=>a.observationId.localeCompare(s.observationId))}function _e(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function pn(e){let t=$e.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 Ni(e){let t=$e.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 Bi(e,t){let n=[];for(let r of t){let i=e.keyParts.find(a=>a.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:mn(r,i.value)})}return n}function mn(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 Ii(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function me(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function Te(e){return[...new Set(e)].sort()}function Pi(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function wi(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}import Ei from"better-sqlite3";var Oe="scip_query_runtime_boundaries",Y="scip_query_runtime_observations",Ae="scip_query_runtime_relation_groups",De="scip_query_runtime_relation_participants";function Fi(e,t){let n=new Ei(e);try{n.exec(`
|
|
10
|
-
CREATE TABLE IF NOT EXISTS ${Oe} (
|
|
11
|
-
singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
|
|
12
|
-
schema_version INTEGER NOT NULL,
|
|
13
|
-
extractor_version TEXT NOT NULL,
|
|
14
|
-
payload TEXT NOT NULL
|
|
15
|
-
)
|
|
16
|
-
`),_i(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${Oe} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${Y}`).run(),n.prepare(`DELETE FROM ${De}`).run(),n.prepare(`DELETE FROM ${Ae}`).run();let r=n.prepare(`INSERT INTO ${Y}
|
|
17
|
-
(id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
|
|
18
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let s of t.observations)r.run(s.id,s.protocol,s.action,s.role,s.strength,s.sourceScope,s.resolution,s.source.file,s.source.startLine,s.source.endLine,s.owner.symbol,JSON.stringify(s));let i=n.prepare(`INSERT INTO ${Ae} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),a=n.prepare(`INSERT INTO ${De} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let s of t.relationGroups){i.run(s.id,s.protocol,s.joinRule,s.normalizedKey,JSON.stringify(s));for(let o of s.producerIds)a.run(s.id,o,"producer");for(let o of s.consumerIds)a.run(s.id,o,"consumer");for(let o of s.declarationIds)a.run(s.id,o,"declaration")}})()}finally{n.close()}}function Ti(e,t={}){if(!$i(e,Y))return fn(e)?.observations??[];let n=[],r=[];return ke(n,r,"protocol",t.protocols),ke(n,r,"action",t.actions),ke(n,r,"source_scope",t.sourceScopes),ke(n,r,"file",t.files),e.all(`SELECT payload FROM ${Y}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(a=>Li(a.payload))}function _i(e){e.exec(`
|
|
19
|
-
CREATE TABLE IF NOT EXISTS ${Y} (
|
|
20
|
-
id TEXT PRIMARY KEY,
|
|
21
|
-
protocol TEXT NOT NULL,
|
|
22
|
-
action TEXT NOT NULL,
|
|
23
|
-
role TEXT NOT NULL,
|
|
24
|
-
strength TEXT NOT NULL,
|
|
25
|
-
source_scope TEXT NOT NULL,
|
|
26
|
-
resolution TEXT NOT NULL,
|
|
27
|
-
file TEXT NOT NULL,
|
|
28
|
-
start_line INTEGER NOT NULL,
|
|
29
|
-
end_line INTEGER NOT NULL,
|
|
30
|
-
owner_symbol TEXT,
|
|
31
|
-
payload TEXT NOT NULL
|
|
32
|
-
);
|
|
33
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_observations_protocol_action_scope
|
|
34
|
-
ON ${Y}(protocol, action, source_scope);
|
|
35
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_observations_file_line
|
|
36
|
-
ON ${Y}(file, start_line);
|
|
37
|
-
|
|
38
|
-
CREATE TABLE IF NOT EXISTS ${Ae} (
|
|
39
|
-
id TEXT PRIMARY KEY,
|
|
40
|
-
protocol TEXT NOT NULL,
|
|
41
|
-
join_rule TEXT NOT NULL,
|
|
42
|
-
normalized_key TEXT NOT NULL,
|
|
43
|
-
payload TEXT NOT NULL
|
|
44
|
-
);
|
|
45
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_groups_protocol_key
|
|
46
|
-
ON ${Ae}(protocol, join_rule, normalized_key);
|
|
47
|
-
|
|
48
|
-
CREATE TABLE IF NOT EXISTS ${De} (
|
|
49
|
-
group_id TEXT NOT NULL,
|
|
50
|
-
observation_id TEXT NOT NULL,
|
|
51
|
-
participant_role TEXT NOT NULL,
|
|
52
|
-
PRIMARY KEY (group_id, observation_id, participant_role)
|
|
53
|
-
);
|
|
54
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_participants_observation
|
|
55
|
-
ON ${De}(observation_id, participant_role);
|
|
56
|
-
`)}function $i(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function ke(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function Li(e){try{return[JSON.parse(e)]}catch{return[]}}function fn(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",Oe))return null;let n=e.get(`SELECT schema_version, payload FROM ${Oe} 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}}export{Re as a,V as b,Je as c,ce as d,ye as e,Yr as f,Fi as g,Ti as h,fn as i};
|
|
57
|
-
//# sourceMappingURL=chunk-W6STWDQI.js.map
|