scip-query 0.20.0 → 0.21.1
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 +81 -0
- package/README.md +255 -884
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-XXGZGNZ6.js +2 -0
- package/dist/call-graph-VGY3R4L3.js +2 -0
- package/dist/call-graph-evidence-lZa2dwQA.d.ts +11 -0
- package/dist/change-analysis-types-CCtoCHbC.d.ts +9 -0
- package/dist/chunk-26CT72HM.js +2 -0
- package/dist/chunk-27OUNZW5.js +3 -0
- package/dist/chunk-2LJLEM5B.js +2 -0
- package/dist/chunk-3KXFB2FM.js +2 -0
- package/dist/chunk-3T5U2EQ2.js +2 -0
- package/dist/chunk-3TNRNKAT.js +2 -0
- package/dist/{chunk-PXY7F6Y4.js → chunk-3XQLJG7V.js} +5 -5
- package/dist/chunk-3XZELASU.js +2 -0
- package/dist/chunk-3YETOKNO.js +4 -0
- package/dist/chunk-47WX6UC4.js +2 -0
- package/dist/{chunk-7SQQWSY3.js → chunk-4HQYNZ3P.js} +2 -2
- package/dist/chunk-4IASLUOP.js +3 -0
- package/dist/{chunk-KMKTIO2G.js → chunk-4KIPF45P.js} +2 -2
- package/dist/chunk-4SZJF4GK.js +2 -0
- package/dist/chunk-4TOU7HHQ.js +2 -0
- package/dist/chunk-4ZCLDH6T.js +11 -0
- package/dist/{chunk-DQGFVPUV.js → chunk-527HV7JY.js} +3 -3
- package/dist/{chunk-ZTETIQ35.js → chunk-5BJPJUXF.js} +2 -2
- package/dist/chunk-5J3A6RBZ.js +16 -0
- package/dist/chunk-5KIJMEPC.js +2 -0
- package/dist/{chunk-JDOEX4E6.js → chunk-5QM7QT5B.js} +2 -2
- package/dist/chunk-5Z2H76VD.js +11 -0
- package/dist/chunk-63TFRBMB.js +2 -0
- package/dist/chunk-67FK5KGV.js +3 -0
- package/dist/chunk-6DO3VBLV.js +2 -0
- package/dist/chunk-6LS3IG2I.js +13 -0
- package/dist/chunk-6QN4FYQW.js +2 -0
- package/dist/chunk-6X4KO5A7.js +11 -0
- package/dist/chunk-743MEVFJ.js +8 -0
- package/dist/chunk-7G2WIVIX.js +2 -0
- package/dist/chunk-7KCZELVM.js +2 -0
- package/dist/chunk-7MUHSZGN.js +3 -0
- package/dist/chunk-7YZGSLW6.js +3 -0
- package/dist/chunk-7Z4GMCHM.js +117 -0
- package/dist/{chunk-32LVLCLN.js → chunk-AAOEROT3.js} +3 -3
- package/dist/chunk-AFRS7WJU.js +26 -0
- package/dist/chunk-ANCHW2R4.js +57 -0
- package/dist/{chunk-SXP2MBJH.js → chunk-AQF35NGT.js} +2 -2
- package/dist/chunk-ARGPDW2Y.js +6 -0
- package/dist/chunk-B3AREUQK.js +16 -0
- package/dist/chunk-BCTCADNB.js +2 -0
- package/dist/chunk-BM4OTGSY.js +3 -0
- package/dist/chunk-BMKTDJI6.js +16 -0
- package/dist/chunk-BOJ5SVE2.js +2 -0
- package/dist/{chunk-WXZLAAWK.js → chunk-BVR44XXB.js} +2 -2
- package/dist/{chunk-RUJURYSV.js → chunk-BYXWXLKM.js} +2 -2
- package/dist/chunk-BZCRHP46.js +3 -0
- package/dist/chunk-BZYSGZRK.js +2 -0
- package/dist/chunk-C52Q3JEQ.js +2 -0
- package/dist/chunk-C7WSQA6A.js +21 -0
- package/dist/{chunk-BDCC2NPY.js → chunk-CNT4ND5O.js} +2 -2
- package/dist/chunk-CQVDALWQ.js +2 -0
- package/dist/chunk-CTO3TRX7.js +2 -0
- package/dist/chunk-CXT3GZSQ.js +2 -0
- package/dist/{chunk-JVYA47YU.js → chunk-DGM2RJ3I.js} +2 -2
- package/dist/{chunk-7PIO7NKH.js → chunk-DK6MB565.js} +2 -2
- package/dist/chunk-DNPETNXT.js +2 -0
- package/dist/chunk-DRENNWRG.js +2 -0
- package/dist/chunk-DUDUIT5P.js +2 -0
- package/dist/chunk-DXEJ4FLZ.js +21 -0
- package/dist/chunk-DXYMTQZ4.js +2 -0
- package/dist/chunk-DZA7MQMU.js +6 -0
- package/dist/{chunk-ZHXX42OH.js → chunk-DZNWXJN2.js} +4 -4
- package/dist/{chunk-CJST5ETY.js → chunk-E6N6YTVM.js} +2 -2
- package/dist/chunk-E7CJ6O72.js +2 -0
- package/dist/chunk-EJHNTAEE.js +2 -0
- package/dist/chunk-EPLE5O5O.js +2 -0
- package/dist/chunk-F4FNK44D.js +2 -0
- package/dist/chunk-FCGMQETU.js +2 -0
- package/dist/chunk-FIO44MVK.js +3 -0
- package/dist/chunk-FLSVYEPL.js +2 -0
- package/dist/chunk-FOP7HD6H.js +3 -0
- package/dist/chunk-FSPENGSU.js +4 -0
- package/dist/chunk-FUUDUAKM.js +2 -0
- package/dist/chunk-FYCH2EYQ.js +2 -0
- package/dist/{chunk-5E4WNAVD.js → chunk-G47MFF47.js} +2 -2
- package/dist/chunk-G6VV7ROY.js +2 -0
- package/dist/chunk-GBZCVYWA.js +2 -0
- package/dist/chunk-GSHTVE56.js +3 -0
- package/dist/chunk-GTZFKDP3.js +2 -0
- package/dist/{chunk-2HPVVXM5.js → chunk-H2RBDP5S.js} +2 -2
- package/dist/chunk-H5EXS3HM.js +2 -0
- package/dist/chunk-HR5JYLVV.js +4 -0
- package/dist/chunk-HW7FASEL.js +2 -0
- package/dist/chunk-HYU4W353.js +10 -0
- package/dist/{chunk-FKSELJQF.js → chunk-I2LY3KN7.js} +2 -2
- package/dist/chunk-IGBQVEHE.js +2 -0
- package/dist/{chunk-3G66UZBH.js → chunk-IH3K5J6K.js} +2 -2
- package/dist/chunk-IHGK3SZ7.js +29 -0
- package/dist/chunk-IM23CSG5.js +2 -0
- package/dist/chunk-IQMGNIGY.js +2 -0
- package/dist/chunk-ITF3CWS5.js +2 -0
- package/dist/chunk-IZKJQQCQ.js +3 -0
- package/dist/chunk-J4HUBIVF.js +5 -0
- package/dist/{chunk-AZJQQKDD.js → chunk-JGMD6JGB.js} +2 -2
- package/dist/chunk-JLZWYDCZ.js +4 -0
- package/dist/chunk-JO6FK3Q5.js +2 -0
- package/dist/chunk-JSHDCVUM.js +81 -0
- package/dist/chunk-K2DZCH2K.js +2 -0
- package/dist/chunk-K63CAPS2.js +23 -0
- package/dist/chunk-KBIC6JHJ.js +2 -0
- package/dist/chunk-KFFQURUZ.js +2 -0
- package/dist/chunk-KFOYCQAJ.js +9 -0
- package/dist/chunk-KGKCJFWZ.js +6 -0
- package/dist/chunk-KK7GPALL.js +28 -0
- package/dist/chunk-L7WRUNKJ.js +2 -0
- package/dist/{chunk-W4ETQAXM.js → chunk-LFWB7TOJ.js} +2 -2
- package/dist/chunk-LGVTIZPV.js +61 -0
- package/dist/chunk-LIWIV26I.js +29 -0
- package/dist/chunk-LJMWILX6.js +3 -0
- package/dist/{chunk-BPAPWKP6.js → chunk-LXMW6ZAX.js} +8 -8
- package/dist/chunk-MFBVUQJZ.js +2 -0
- package/dist/{chunk-O64IZ6UX.js → chunk-MLTKGHD2.js} +2 -2
- package/dist/chunk-MLTSTKXD.js +5 -0
- package/dist/chunk-MR4ZKWO6.js +57 -0
- package/dist/{chunk-EN3O7VJA.js → chunk-MRXBLYRE.js} +2 -2
- package/dist/chunk-MXNGIEPU.js +3 -0
- package/dist/chunk-N4EFQIRX.js +20 -0
- package/dist/chunk-ND3BWIVN.js +7 -0
- package/dist/chunk-NODZYYGC.js +2 -0
- package/dist/chunk-NP4JFCLE.js +133 -0
- package/dist/chunk-NQXWWE6S.js +8 -0
- package/dist/chunk-NSDPPUDY.js +7 -0
- package/dist/chunk-NT4NVEHU.js +18 -0
- package/dist/chunk-O2VY47Y5.js +325 -0
- package/dist/chunk-O3EX5STE.js +5 -0
- package/dist/chunk-O4PZFAXA.js +3 -0
- package/dist/chunk-OA2BO4DR.js +2 -0
- package/dist/chunk-OFZVFIDF.js +3 -0
- package/dist/{chunk-PQCI4SQX.js → chunk-OG5UK2K7.js} +2 -2
- package/dist/chunk-OMVNRPST.js +2 -0
- package/dist/{chunk-7BAVHKMJ.js → chunk-OU6SDWAM.js} +9 -9
- package/dist/{chunk-LY4WC4AD.js → chunk-OY7PCALC.js} +2 -2
- package/dist/{chunk-A73XVBCR.js → chunk-P3UFF22M.js} +2 -2
- package/dist/chunk-PAZSBPJR.js +3 -0
- package/dist/chunk-PJBYDCBQ.js +38 -0
- package/dist/chunk-PRLU3I7G.js +79 -0
- package/dist/chunk-PU6XDQ2X.js +16 -0
- package/dist/{chunk-3CLX5EOX.js → chunk-PWEQ6CZZ.js} +2 -2
- package/dist/{chunk-XSRF6Q77.js → chunk-PX6QNUYF.js} +2 -2
- package/dist/chunk-Q4MRRB3C.js +3 -0
- package/dist/chunk-QGVUPYBC.js +35 -0
- package/dist/chunk-QH5Q6M5C.js +2 -0
- package/dist/chunk-QLWZUFDT.js +2 -0
- package/dist/chunk-QN2AI3D2.js +3 -0
- package/dist/{chunk-JAYYFEQY.js → chunk-QZCACNV5.js} +2 -2
- package/dist/chunk-RNKRYK6B.js +4 -0
- package/dist/chunk-RSUH7G5T.js +29 -0
- package/dist/chunk-RZWBTKXO.js +5 -0
- package/dist/chunk-SBFDPHKH.js +4 -0
- package/dist/{chunk-HX4GQPZP.js → chunk-SGSPCEFC.js} +3 -3
- package/dist/chunk-SIGVQT43.js +2 -0
- package/dist/chunk-SRIZDEWX.js +4 -0
- package/dist/chunk-SV2LEFVM.js +2 -0
- package/dist/chunk-T2PBOVDI.js +3 -0
- package/dist/chunk-TP2X2C2Y.js +3 -0
- package/dist/chunk-U2MNECDU.js +2 -0
- package/dist/chunk-U7DOYZDH.js +2 -0
- package/dist/chunk-UAQQR55F.js +2 -0
- package/dist/chunk-UBETC3Q2.js +2 -0
- package/dist/chunk-UEQORB2A.js +2 -0
- package/dist/chunk-UM56ZET4.js +38 -0
- package/dist/chunk-UXNXOMXJ.js +2 -0
- package/dist/{chunk-6SHPK5ZE.js → chunk-V6XENWOF.js} +2 -2
- package/dist/chunk-VJAD5WX5.js +2 -0
- package/dist/chunk-VRJG7N3I.js +453 -0
- package/dist/chunk-W7HN6V4E.js +7 -0
- package/dist/chunk-WCIKJ2E3.js +3 -0
- package/dist/chunk-WEXQYJY3.js +5 -0
- package/dist/chunk-WOPZX5GM.js +2 -0
- package/dist/chunk-WRQXLNYE.js +9 -0
- package/dist/{chunk-XKWKXZKW.js → chunk-WV6R37XV.js} +2 -2
- package/dist/{chunk-N5W4YZMK.js → chunk-WZ7V4BQV.js} +2 -2
- package/dist/chunk-WZRNEVYC.js +2 -0
- package/dist/chunk-X5MWO4DM.js +7 -0
- package/dist/chunk-XDAUYDFT.js +2 -0
- package/dist/{chunk-L7AW2QB5.js → chunk-XDOEHEET.js} +2 -2
- package/dist/chunk-XDQX6LDT.js +4 -0
- package/dist/chunk-XFRHBAIT.js +2 -0
- package/dist/chunk-XIPGCT3D.js +5 -0
- package/dist/chunk-XKM5D2XS.js +16 -0
- package/dist/chunk-XNF5T4T2.js +4 -0
- package/dist/chunk-Y2S4YNLH.js +3 -0
- package/dist/chunk-YA72ZUKO.js +2 -0
- package/dist/chunk-YBWE6J32.js +43 -0
- package/dist/chunk-YCXQQ3YB.js +2 -0
- package/dist/chunk-YDTK77JP.js +43 -0
- package/dist/chunk-YF25RQER.js +4 -0
- package/dist/chunk-YKHL4J3G.js +2 -0
- package/dist/chunk-YLNCTPOI.js +4 -0
- package/dist/chunk-YR7VRWNX.js +2 -0
- package/dist/chunk-YT4IQBET.js +3 -0
- package/dist/chunk-YUKYB54I.js +1 -0
- package/dist/chunk-Z2KGMIL4.js +2 -0
- package/dist/chunk-Z2QB75BS.js +3 -0
- package/dist/chunk-Z67JOKRE.js +554 -0
- package/dist/chunk-ZGDHC5AT.js +2 -0
- package/dist/chunk-ZMS4YCY7.js +2 -0
- package/dist/chunk-ZNW5A5VX.js +3 -0
- package/dist/{chunk-TFRAYKN6.js → chunk-ZP2WUVZ5.js} +2 -2
- package/dist/chunk-ZQUNCTEZ.js +2 -0
- package/dist/cli-main.js +8 -0
- package/dist/cli.js +1 -3
- package/dist/code-AXLJBZ6T.js +2 -0
- package/dist/code-B17qEMbt.d.ts +121 -0
- package/dist/code-result-json-CTZHAQXJ.js +2 -0
- package/dist/command-descriptors-6INSCKLW.js +342 -0
- package/dist/{config-types-jVM3D7MA.d.ts → config-types-B9B60MiR.d.ts} +199 -23
- package/dist/dataflow-AFXY423Q.js +2 -0
- package/dist/{db-B5PM5yNk.d.ts → db-BwIVAYNB.d.ts} +1 -1
- package/dist/dependence-slice-2G4X6VSJ.js +2 -0
- package/dist/deps-LMCAV5DO.js +2 -0
- package/dist/direct-navigation-2ONV22Y2.js +3 -0
- package/dist/entry-map-ZOC3VXO5.js +2 -0
- package/dist/exploration-topology-BG4v30HZ.d.ts +256 -0
- package/dist/file-dep-graph-Bqg3t3Px.d.ts +4 -0
- package/dist/file-kind-BKCVMNUf.d.ts +10 -0
- package/dist/files-WJQJLHMH.js +2 -0
- package/dist/graph-evidence-Bjyky2V4.d.ts +126 -0
- package/dist/graph-exploration-contract-CqDsnPQL.d.ts +7 -0
- package/dist/{health-Do5TKSJI.d.ts → health-CPp2Jf1Z.d.ts} +33 -34
- package/dist/hierarchy-ASNIHAX4.js +2 -0
- package/dist/imports-JICEKDKK.js +2 -0
- package/dist/index.d.ts +4 -31
- package/dist/index.js +1 -1
- package/dist/members-C5H2K3MS.js +2 -0
- package/dist/methods-KZOZHSD4.js +2 -0
- package/dist/next-anchor-candidates-BwMczMvX.d.ts +90 -0
- package/dist/output-continuation-command-NX3RH3TP.js +3 -0
- package/dist/output-pagination-3OFL2MJV.js +19 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-A2SXUH2H.js +3 -0
- package/dist/queries/affected.d.ts +22 -4
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +123 -0
- package/dist/queries/anchors.js +2 -0
- package/dist/queries/architecture.d.ts +3 -2
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +26 -7
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +17 -3
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +5 -26
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +145 -0
- package/dist/queries/context.js +2 -0
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +8 -3
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +34 -7
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +40 -14
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +3 -3
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +4 -38
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.d.ts +47 -0
- package/dist/queries/dependence-slice.js +2 -0
- package/dist/queries/dependency-depth.d.ts +49 -0
- package/dist/queries/dependency-depth.js +2 -0
- package/dist/queries/deps.d.ts +4 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +3 -3
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +4 -4
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +121 -0
- package/dist/queries/entry-map.js +2 -0
- package/dist/queries/evidence.d.ts +70 -0
- package/dist/queries/evidence.js +2 -0
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +18 -5
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +4 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +5 -3
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +11 -5
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +4 -4
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +56 -136
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +3 -3
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +5 -9
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +27 -64
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.d.ts +4 -0
- package/dist/queries/reference-neighborhood.js +2 -0
- package/dist/queries/reference-reachability.d.ts +48 -0
- package/dist/queries/reference-reachability.js +2 -0
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +3 -36
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.d.ts +209 -0
- package/dist/queries/source-inspection.js +2 -0
- package/dist/queries/source-search.d.ts +13 -0
- package/dist/queries/source-search.js +2 -0
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +13 -4
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +449 -0
- package/dist/queries/system-map.js +2 -0
- package/dist/queries/system.d.ts +5 -3
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +47 -3
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +3 -3
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +3 -3
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.d.ts +43 -0
- package/dist/queries/value-flow.js +2 -0
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/query-service-fastpath.js +6 -0
- package/dist/query-service-server.js +5 -0
- package/dist/refs-ZOORVRQC.js +2 -0
- package/dist/refs-pagination-SRCUOYRD.js +2 -0
- package/dist/reindex-worker.js +85 -86
- package/dist/reindex.d.ts +64 -42
- package/dist/reindex.js +93 -77
- package/dist/repository-text-C0Q8VYdN.d.ts +19 -0
- package/dist/runtime.d.ts +287 -8
- package/dist/runtime.js +4 -3
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{scip-cli-BnEwZRLJ.d.ts → scip-cli-H-n59izO.d.ts} +33 -2
- package/dist/slice-NOTBWA7S.js +2 -0
- package/dist/source-search-types-Dwz8KeuW.d.ts +79 -0
- package/dist/source-snippet-_wrcgmZc.d.ts +15 -0
- package/dist/stats-OOJ74B32.js +2 -0
- package/dist/surface-BTBCLKNA.js +2 -0
- package/dist/symbol-resolution-SVSMX4RN.js +2 -0
- package/dist/system-2EIUFP6B.js +2 -0
- package/dist/trace-BB2GHQPG.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/value-flow-OA7AHSUG.js +2 -0
- package/dist/watch-server.js +3 -2
- package/docs/AGENT_GUIDE.md +133 -476
- package/docs/AI_FAILURE_MODES.md +30 -301
- package/docs/API.md +1 -1
- package/docs/API_EVOLUTION.md +6 -0
- package/docs/CLI_JSON_OUTPUT.md +207 -29
- package/docs/COMMAND_REFERENCE.md +255 -154
- package/docs/CONFIGURATION_WRITE_SAFETY.md +14 -13
- package/docs/DETECTOR_EVIDENCE_CONTRACTS.md +84 -0
- package/docs/DETECTOR_GUIDE.md +46 -138
- package/docs/DURABILITY.md +7 -1
- package/docs/INDEX_GENERATIONS.md +6 -0
- package/docs/LOCK_PROTOCOL.md +8 -0
- package/docs/REINDEX_METADATA_COMPATIBILITY.md +13 -3
- package/docs/SECURITY_MODEL.md +39 -42
- package/docs/accuracy-audit-checklist.md +4 -0
- package/docs/accuracy-hardening-goal.md +9 -2
- package/docs/analyzer-inventory.md +59 -264
- package/docs/analyzer-validation-protocol.md +62 -170
- package/docs/architecture-coherence-vision.md +18 -12
- package/docs/locality-analyzer-design.md +1 -1
- package/docs/schemas/cli-json-envelope.schema.json +212 -27
- package/docs/schemas/cli-json-export-receipt.schema.json +25 -0
- package/docs/schemas/cli-output-page.schema.json +1 -1
- package/docs/schemas/observation-receipt.schema.json +164 -0
- package/docs/schemas/project-config.schema.json +37 -45
- package/docs/schemas/suppression-record.schema.json +1 -34
- package/package.json +69 -11
- package/skills/concrete-plan/SKILL.md +8 -0
- package/skills/concrete-plan/agents/openai.yaml +4 -0
- package/skills/scip-explore/SKILL.md +49 -61
- package/skills/scip-explore/agents/openai.yaml +3 -3
- package/skills/scip-explore/references/delegated-exploration.md +51 -0
- package/skills/scip-explore/references/external-evidence.md +72 -0
- package/skills/scip-explore/references/information-model.md +51 -0
- package/skills/scip-explore/scripts/capture-evidence.mjs +666 -0
- package/skills/scip-integrity-audit/SKILL.md +185 -0
- package/skills/scip-integrity-audit/agents/openai.yaml +4 -0
- package/skills/scip-plan/SKILL.md +67 -49
- package/skills/scip-plan/agents/openai.yaml +3 -3
- package/skills/scip-query/SKILL.md +98 -77
- package/skills/scip-query/agents/openai.yaml +3 -3
- package/skills/scip-setup/SKILL.md +10 -102
- package/skills/scip-setup/agents/openai.yaml +3 -3
- package/dist/chunk-26QA6FAI.js +0 -8
- package/dist/chunk-2KAZEZ6M.js +0 -2
- package/dist/chunk-3ORVDL3H.js +0 -2
- package/dist/chunk-46XGSFNI.js +0 -2
- package/dist/chunk-4MAK2HOY.js +0 -6
- package/dist/chunk-4TURLRL5.js +0 -16
- package/dist/chunk-4UQVNCQE.js +0 -2
- package/dist/chunk-55Q3WLZX.js +0 -2
- package/dist/chunk-5I5G2QOX.js +0 -3
- package/dist/chunk-6LDJQXAH.js +0 -2
- package/dist/chunk-6O5TICIZ.js +0 -3
- package/dist/chunk-7O5IKBTZ.js +0 -16
- package/dist/chunk-7S5E7KWT.js +0 -2
- package/dist/chunk-7WPLAODU.js +0 -5
- package/dist/chunk-AFHORGLH.js +0 -42
- package/dist/chunk-AIE7TFJW.js +0 -9
- package/dist/chunk-AQOFWNQJ.js +0 -1
- package/dist/chunk-B2PX5I6M.js +0 -2
- package/dist/chunk-B75HZHUP.js +0 -2
- package/dist/chunk-B7PBSLZN.js +0 -2
- package/dist/chunk-BBW6JFHN.js +0 -2
- package/dist/chunk-BNXCIFVY.js +0 -2
- package/dist/chunk-BS2NMXQZ.js +0 -4
- package/dist/chunk-C3KV2II6.js +0 -2
- package/dist/chunk-C43RDDP4.js +0 -20
- package/dist/chunk-DAFAHMNB.js +0 -42
- package/dist/chunk-DQLPXMH6.js +0 -8
- package/dist/chunk-EKZTZXHZ.js +0 -117
- package/dist/chunk-EW2NTSFA.js +0 -18
- package/dist/chunk-F3Z4OUDS.js +0 -8
- package/dist/chunk-FJH2NW7J.js +0 -66
- package/dist/chunk-FTFP6O3L.js +0 -11
- package/dist/chunk-FYLK2DEJ.js +0 -2
- package/dist/chunk-GH74ASD6.js +0 -11
- package/dist/chunk-GMXWZP2B.js +0 -2
- package/dist/chunk-GOUBFH5O.js +0 -3
- package/dist/chunk-HLF2TX6R.js +0 -2
- package/dist/chunk-HX7M4BDI.js +0 -30
- package/dist/chunk-HZ72SESS.js +0 -128
- package/dist/chunk-IB2N4FIY.js +0 -10
- package/dist/chunk-IZYYAFN5.js +0 -2
- package/dist/chunk-JFGGXWQF.js +0 -947
- package/dist/chunk-JN4NMBEX.js +0 -8
- package/dist/chunk-JW56N3KI.js +0 -4
- package/dist/chunk-JZ2OXNWB.js +0 -2
- package/dist/chunk-KFZNKUNT.js +0 -2
- package/dist/chunk-L5GJNV2T.js +0 -8
- package/dist/chunk-L7JDSCDF.js +0 -4
- package/dist/chunk-LU47HG23.js +0 -14
- package/dist/chunk-LVY7NPF7.js +0 -2
- package/dist/chunk-MKCDWWGV.js +0 -4
- package/dist/chunk-MNE7YG56.js +0 -2
- package/dist/chunk-MRXBEXSY.js +0 -26
- package/dist/chunk-MV7OWDUX.js +0 -2
- package/dist/chunk-NGEXCJJW.js +0 -11
- package/dist/chunk-NIW6JDC5.js +0 -29
- package/dist/chunk-PBUQFCNB.js +0 -16
- package/dist/chunk-POAVPHH7.js +0 -2
- package/dist/chunk-QZ4JVECJ.js +0 -2
- package/dist/chunk-RDO52JGY.js +0 -2
- package/dist/chunk-RJT3TUUZ.js +0 -2
- package/dist/chunk-RVLDN63O.js +0 -4
- package/dist/chunk-RXOXSKY3.js +0 -2
- package/dist/chunk-S7OYBOCK.js +0 -2
- package/dist/chunk-SMNXQT5Z.js +0 -3
- package/dist/chunk-SRAFT254.js +0 -2
- package/dist/chunk-T7YQSHPQ.js +0 -3
- package/dist/chunk-UJCOIXDY.js +0 -2
- package/dist/chunk-UJPRPGCO.js +0 -13
- package/dist/chunk-WCCFZ7V7.js +0 -113
- package/dist/chunk-WUPW3UN3.js +0 -3
- package/dist/chunk-X54AGLVX.js +0 -2
- package/dist/chunk-Y2MVPNKY.js +0 -5
- package/dist/chunk-YKUU5AIC.js +0 -3
- package/dist/chunk-YLCJLTPL.js +0 -2
- package/dist/chunk-YTQVETEO.js +0 -2
- package/dist/chunk-Z4N3MZYA.js +0 -38
- package/dist/chunk-ZJOOT3BG.js +0 -2
- package/dist/chunk-ZK26BAQL.js +0 -2
- package/dist/command-descriptors-DSS46KXI.js +0 -642
- package/dist/diff-gate-types-B0QYpDv1.d.ts +0 -11
- package/dist/direct-navigation-6YHV6IB5.js +0 -3
- package/dist/queries/diff-gate.d.ts +0 -253
- package/dist/queries/diff-gate.js +0 -2
- package/docs/COMMITTED_RECORD_COMPATIBILITY.md +0 -154
- package/docs/analyzer-validation-ledger.md +0 -516
- package/docs/schemas/outcome-event-record.schema.json +0 -95
- package/skills/_shared/SKILL.md +0 -101
- package/skills/_shared/agents/openai.yaml +0 -4
- package/skills/_shared/references/agent-contract-catalog.md +0 -105
- package/skills/_shared/references/command-catalog.md +0 -118
- package/skills/_shared/references/detector-precision-and-diffgate.md +0 -59
- package/skills/_shared/references/evidence-and-dead-code.md +0 -25
- package/skills/scip-audit/SKILL.md +0 -77
- package/skills/scip-audit/agents/openai.yaml +0 -4
- package/skills/scip-audit/references/claims.md +0 -98
- package/skills/scip-audit/references/cleanup.md +0 -100
- package/skills/scip-audit/references/directory.md +0 -222
- package/skills/scip-audit/references/frontend.md +0 -130
- package/skills/scip-audit/references/integrity.md +0 -154
- package/skills/scip-audit/references/maintainability.md +0 -162
- package/skills/scip-audit/references/twin-drift.md +0 -104
- package/skills/scip-diagnose/SKILL.md +0 -52
- package/skills/scip-diagnose/agents/openai.yaml +0 -4
- package/skills/scip-diagnose/references/debug.md +0 -117
- package/skills/scip-diagnose/references/probe-reachability.md +0 -77
- package/skills/scip-diagnose/references/root-cause.md +0 -145
- package/skills/scip-diagnose/references/triage.md +0 -119
- package/skills/scip-explore/references/diagrams.md +0 -40
- package/skills/scip-explore/references/language-playbook.md +0 -49
- package/skills/scip-improve/SKILL.md +0 -56
- package/skills/scip-improve/agents/openai.yaml +0 -4
- package/skills/scip-improve/references/cleanup-batches.md +0 -53
- package/skills/scip-improve/references/directory-moves.md +0 -53
- package/skills/scip-improve/references/doc-reconcile.md +0 -30
- package/skills/scip-improve/references/frontend-extraction.md +0 -39
- package/skills/scip-improve/references/maintainability-mechanism.md +0 -43
- package/skills/scip-improve/references/twin-drift.md +0 -35
- package/skills/scip-plan/references/api-impact.md +0 -19
- package/skills/scip-plan/references/conductor.md +0 -41
- package/skills/scip-plan/references/high-assurance.md +0 -43
- package/skills/scip-plan/references/hyper-optimization.md +0 -50
- package/skills/scip-plan/references/tla-model.md +0 -88
- package/skills/scip-setup/references/bootstrap-workflow.md +0 -119
- package/skills/scip-setup/references/language-verification.md +0 -61
- package/skills/scip-setup/references/lifecycle-commands.md +0 -119
- package/skills/scip-setup/references/per-repo-triage.md +0 -24
- package/skills/scip-verify/SKILL.md +0 -229
- package/skills/scip-verify/agents/openai.yaml +0 -4
- package/skills/scip-verify/references/calibrate-detectors.md +0 -170
package/dist/runtime.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`}import{createHash as Q}from"crypto";import{closeSync as Ie,fstatSync as Z,openSync as Oe,rmSync as je}from"fs";import{dirname as Ne}from"path";var Me=2e3,Ae=10,$e=3,b=class extends Error{constructor(r,n,i){super(`Concurrent edit detected for ${r}; expected revision ${te(n)}, but found ${te(i)}. The latest file was left untouched.`);this.path=r;this.original=n;this.latest=i;this.name="FileRevisionConflictError"}path;original;latest};function re(e,t,r={}){let n=We(e,r.lockTimeoutMs??Me,r.monotonicNow??C);try{let i=Math.max(0,Math.floor(r.maxRetries??$e));for(let o=0;;o+=1){let s=x(e),a=t(s,o);if(a.kind==="unchanged")return{changed:!1,attempts:o+1,previous:s,current:s};r.onBeforeCommit?.({attempt:o,snapshot:s,mutation:a});let c=x(e);if(!De(s.revision,c.revision)){if(o<i)continue;throw new b(e,s.revision,c.revision)}try{Fe(e,a,s.revision)}catch(u){if(u.code==="EEXIST"){let p=x(e);if(o<i)continue;throw new b(e,s.revision,p.revision)}throw u}return{changed:!0,attempts:o+1,previous:s,current:x(e)}}}finally{n.release()}}function x(e){for(let t=0;t<4;t+=1){let r;try{r=Oe(e,"r");let n=ee(Z(r)),i=W(r,{maxBytes:A,inputKind:"revisioned text file"}),o=ee(Z(r));if(!ne(n,o))continue;return{path:e,text:i,revision:{exists:!0,hash:Q("sha256").update(i).digest("hex"),identity:o}}}catch(n){if(n.code==="ENOENT")return{path:e,text:"",revision:{exists:!1,hash:Q("sha256").update("").digest("hex")}};throw n}finally{r!==void 0&&Ie(r)}}throw new Error(`Could not read a stable revision of ${e}; the file is changing continuously.`)}function We(e,t,r){let n=`${e}.scip-query-write.lock`,i=r()+Math.max(0,t);for(;;){let o=F(n,{kind:"revisioned-file-mutation",detail:{target:e}});if(o.kind==="acquired")return o.lock;if(r()>=i)throw new Error(`Timed out after ${t}ms waiting to update ${e}; the file was left untouched.`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,Ae)}}function Fe(e,t,r){if(t.kind==="delete"){if(!r.exists)return;je(e),D(Ne(e));return}let n=t.mode??r.identity?.mode;r.exists?L(e,t.text,{durability:"durable",mode:n}):V(e,t.text,{durability:"durable",mode:n})}function De(e,t){return e.exists===t.exists&&e.hash===t.hash&&(e.identity===void 0?t.identity===void 0:t.identity!==void 0&&ne(e.identity,t.identity))}function ee(e){return{dev:e.dev,ino:e.ino,size:e.size,mtimeMs:e.mtimeMs,mode:e.mode&511}}function ne(e,t){return e.dev===t.dev&&e.ino===t.ino&&e.size===t.size&&e.mtimeMs===t.mtimeMs&&e.mode===t.mode}function te(e){return e.exists?e.hash.slice(0,12):"<absent>"}var S=".scipquery.json",oe=250,se=5e3,ae=10*6e4,Ve={enabled:!1,debounceMs:oe,cooldownMs:se,gitPollMs:2e3,idleTimeoutMs:ae,autoRefresh:!0,ignore:[]};var Bt=new Set(N);function T(e){let t=ie(e,S);if(!Le(t))return{};let r;try{r=$(t,{maxBytes:M,inputKind:"scip-query project config"})}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(`unable to read ${S} at ${t}: ${i}`,{cause:n})}return Je(z(r),t,"read").config}function ce(e){return{...Ve,...e.watch}}function Ge(e,t){return Ue(e,t).configPath}function Ue(e,t){let r=ie(e,S),n={languages:t,watch:{enabled:!0,debounceMs:oe,cooldownMs:se,gitPollMs:2e3,idleTimeoutMs:ae,autoRefresh:!0}},i=re(r,o=>o.revision.exists?{kind:"unchanged"}:{kind:"write",text:qe(n)});return{configPath:r,changed:i.changed}}function qe(e){return X(e)}function Je(e,t,r){if(e.kind==="legacy"||e.kind==="supported")return e;if(e.kind==="malformed"){let i=r==="read"?`invalid ${S} at ${t}: ${e.reason}`:`Cannot update ${t}: the latest project config is ${e.reason}.`;throw new Error(`${i} The file was left untouched.`)}let n=r==="read"?`invalid ${S} at ${t}`:`Cannot update ${t}: the latest project config is invalid`;throw new Error(`${n} (unsupported ${e.direction} schemaVersion ${e.schemaVersion}; this scip-query reads legacy v${h} and current v${g}). Upgrade scip-query before retrying; the file was left untouched.`)}import{statSync as He}from"fs";import{basename as Be,isAbsolute as Ke,join as Ye,relative as ze}from"path";import{watch as Xe}from"chokidar";import Qe from"ignore";var pe=5e3,_=class{projectRoot;config;watchConfig;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onReindexError;onRefreshSuppressed;onError;reindexRunner;subscriptionFactory;clock;activeOperation=null;stopPromise=null;stopInProgress=!1;status={state:"idle"};debounceTimer=null;cooldownTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];sourcePollingFallbackStarted=!1;gitPollTimer=null;lastGitState=null;gitignoreFilter;extraIgnore;stopped=!1;constructor(t){this.projectRoot=t.projectRoot,this.config=t.config,this.watchConfig=ce(t.config),this.languages=t.languages,this.pnpmWorkspaces=t.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=t.config.indexer?.typescript?.projectMode,this.typescriptProjects=t.config.indexer?.typescript?.projects,this.clojureConfigPath=t.config.indexer?.clojure?.configPath,this.indexerConcurrency=t.config.indexerConcurrency,this.onStatus=t.onStatus??(()=>{}),this.onReindexComplete=t.onReindexComplete??(()=>{}),this.onReindexError=t.onReindexError??(()=>{}),this.onRefreshSuppressed=t.onRefreshSuppressed??(()=>{}),this.onError=t.onError??(r=>console.error(r.message)),this.clock=t.clock??rt,he.set(this,lt(t.stopTimeoutMs??pe,"watcher stop timeout")),this.reindexRunner=t.reindexRunner??ge(),this.subscriptionFactory=t.subscriptionFactory??nt,this.gitignoreFilter=U(t.projectRoot),this.extraIgnore=Qe(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){if(this.stopInProgress)throw new Error("Cannot restart a watcher while its previous ownership is still draining.");this.stopped=!1,this.stopPromise=null,E(this).errors=[],this.sourcePollingFallbackStarted=!1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{this.startSourceWatcher()}catch(t){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(t)}`))}}stop(){if(this.stopPromise)return this.stopPromise;this.stopped=!0,this.stopInProgress=!0;let t=this.fsWatchers;this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearGitPollTimer();let r=this.activeOperation;r&&this.setStatus({state:"draining",startedAt:this.wallNow(),reason:"waiting for the active reindex worker to exit"});let n=[...E(this).closures],i=et(this),o=this.clock.now()+i;return this.stopPromise=this.finishStop(t,n,r,o,i).catch(s=>{throw this.stopInProgress=!1,s}),this.stopPromise}requestRefresh(t,r={}){if(!this.stopped){if(!r.immediate||this.reindexInFlight||this.status.state==="cooldown"){this.scheduleReindex(t);return}this.pendingTrigger=de(this.pendingTrigger,t),this.changedFiles+=1,this.clearDebounceTimer(),this.triggerReindex()}}startSourceWatcher(t=!1){let r=this.subscriptionFactory(this.projectRoot,{ignoreInitial:!0,ignored:(n,i)=>this.isIgnoredWatchPath(n,i?.isDirectory()??!1),usePolling:t,...t?{interval:500,binaryInterval:1e3}:{}});r.on("all",(n,i)=>{this.stopped||this.handleFileChange(i)}),r.on("error",n=>this.handleSourceWatcherError(r,n,t)),this.fsWatchers.push(r)}handleSourceWatcherError(t,r,n){if(n||this.sourcePollingFallbackStarted||!ct(r)||this.stopped){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(r)}`));return}this.sourcePollingFallbackStarted=!0,this.fsWatchers=this.fsWatchers.filter(i=>i!==t),tt(E(this),t,i=>this.onError(i));try{this.startSourceWatcher(!0)}catch(i){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(i)}`))}}isIgnoredWatchPath(t,r){let n=this.relativeWatchPath(t);if(!n)return!1;let i=r?`${n}/`:n;return i===".git/"||i.startsWith(".git/")?!0:this.gitignoreFilter.isIgnored(i)||this.extraIgnore.ignores(i)}handleFileChange(t){let r=this.relativeWatchPath(t);!r||r===".."||r.startsWith("../")||r===".git"||r.startsWith(".git/")||this.gitignoreFilter.isIgnored(r)||this.extraIgnore.ignores(r)||r.endsWith("index.db")||r.endsWith("index.scip")||r.endsWith("index.db.tmp")||Be(r).startsWith(q)||this.scheduleReindex({kind:"watch-source",detail:r})}relativeWatchPath(t){let r=Ke(t)?t:Ye(this.projectRoot,t);return ze(this.projectRoot,r).replaceAll("\\","/")}scheduleReindex(t){if(this.pendingTrigger=de(this.pendingTrigger,t),this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}this.clearDebounceTimer();let r=this.wallNow()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:r}),this.debounceTimer=this.clock.setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let t=this.clock.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&t<this.watchConfig.cooldownMs){let o=this.watchConfig.cooldownMs-t;this.dirty=!0;let s=this.wallNow()+o;this.setStatus({state:"cooldown",until:s,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},o);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let r=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let n=this.wallNow();this.setStatus({state:"indexing",startedAt:n});let i=this.reindexRunner.start(this.reindexRequest(r));this.activeOperation=i,i.completion.then(o=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let s=!1;try{s=this.onReindexComplete(o,r)===!0}catch(a){this.onError(a instanceof Error?a:new Error(String(a)))}if(this.dirty&&!this.stopped){if(s){let c=this.pendingTrigger??{kind:"unknown"};this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.onRefreshSuppressed(c),this.setStatus({state:"idle"});return}let a=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:a,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(o=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let s=o instanceof Error?o:new Error(String(o));this.onReindexError(s,r),this.onError(s),this.setStatus({state:"idle"})}).finally(()=>{this.activeOperation===i&&(this.activeOperation=null)})}async finishStop(t,r,n,i,o){let s=[],a=t.map(async d=>{try{await d.close()}catch(R){s.push(`watch subscription close failed: ${String(R)}`)}});a.push(...r),n&&a.push((async()=>{try{let d=await n.cancel();d.state==="degraded"&&s.push(d.reason)}catch(d){s.push(`reindex cancellation failed: ${d instanceof Error?d.message:String(d)}`)}})());let c=a.length,u=a.map(d=>d.finally(()=>{c-=1})),p=await Ze(u,i,this.clock),l=E(this);return s.push(...l.errors),l.errors=[],p?this.stopInProgress=!1:(s.push(`watch shutdown exceeded the ${o}ms deadline with ${c} operation(s) still pending`),Promise.all(u).then(()=>{this.stopInProgress=!1})),s.length>0?(this.setStatus({state:"draining",startedAt:this.wallNow(),reason:s.join("; ")}),{state:"degraded",reasons:s}):(this.setStatus({state:"idle"}),{state:"stopped"})}wallNow(){return this.clock.wallNow?.()??this.clock.now()}reindexRequest(t){return{projectRoot:this.projectRoot,config:this.config,languages:this.languages,pnpmWorkspaces:this.pnpmWorkspaces,typescriptProjectMode:this.typescriptProjectMode,typescriptProjects:this.typescriptProjects,clojureConfigPath:this.clojureConfigPath,indexerConcurrency:this.indexerConcurrency,trigger:t}}setStatus(t){this.status=t,this.onStatus(t)}clearDebounceTimer(){this.debounceTimer&&(this.clock.clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(this.clock.clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}startGitStatePolling(){this.lastGitState=this.readGitState(),this.lastGitState&&(this.gitPollTimer=this.clock.setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.())}pollGitState(){let t=this.lastGitState,r=this.readGitState();if(!t||!r||this.stopped){this.lastGitState=r;return}this.lastGitState=r;let n=t.head!==r.head,i=t.indexPath!==r.indexPath||t.indexMtimeMs!==r.indexMtimeMs||t.indexSize!==r.indexSize;n&&i?this.scheduleReindex({kind:"watch-git-state",detail:"HEAD and index changed"}):n?this.scheduleReindex({kind:"watch-git-head",detail:"HEAD changed"}):i&&this.scheduleReindex({kind:"watch-git-index",detail:r.indexPath??"index changed"})}readGitState(){let t=w(this.projectRoot,["rev-parse","--git-path","index"]);if(!t)return null;let r=G(this.projectRoot,t),n={head:w(this.projectRoot,["rev-parse","--verify","HEAD"]),indexPath:r};try{let i=He(r);n.indexMtimeMs=i.mtimeMs,n.indexSize=i.size}catch{n.indexMtimeMs=void 0,n.indexSize=void 0}return n}clearGitPollTimer(){this.gitPollTimer&&(this.clock.clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};async function Ze(e,t,r){if(e.length===0)return!0;let n=Promise.all(e).then(()=>!0),i=Math.max(0,t-r.now()),o=null,s=new Promise(c=>{o=r.setTimeout(()=>c(!1),i)}),a=await Promise.race([n,s]);return a&&o&&r.clearTimeout(o),a}var le=new WeakMap,he=new WeakMap;function E(e){let t=le.get(e);if(t)return t;let r={closures:new Set,errors:[]};return le.set(e,r),r}function et(e){return he.get(e)??pe}function tt(e,t,r){let n=Promise.resolve().then(()=>t.close()).catch(i=>{let o=`watch subscription close failed during polling fallback: ${String(i)}`;e.errors.push(o),r(new Error(o))});e.closures.add(n),n.then(()=>e.closures.delete(n))}function fe(e){let{projectRoot:t,config:r,languages:n,pnpmWorkspaces:i,typescriptProjectMode:o,typescriptProjects:s,clojureConfigPath:a,indexerConcurrency:c,trigger:u}=e,p=T(t),l=Object.keys(p).length>0?p:r,d=k(t,l),R=l.indexer?.typescript,we=l.indexer?.clojure;return{workerPath:new URL("./reindex-worker.js",import.meta.url).pathname,env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:t,SCIP_REINDEX_OUTPUT_SCIP:d.indexPath,SCIP_REINDEX_OUTPUT_DB:d.dbPath,SCIP_REINDEX_LANGUAGES:(l.languages??n)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(l.indexerConcurrency??c??""),SCIP_REINDEX_PNPM_WORKSPACES:R?.pnpmWorkspaces??i?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:R?.projectMode??o,projects:R?.projects??s??[]}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:we?.configPath??a??"",SCIP_REINDEX_TRIGGER_KIND:u.kind,SCIP_REINDEX_TRIGGER_DETAIL:u.detail??"",SCIP_REINDEX_PROCESS_GROUP_LEADER:"1"}}}var rt={now:C,wallNow:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},nt=(e,t)=>Xe(e,t),it=15*6e4,ot=1e3,st=64*1024;function at(){return{stdoutTail:"",stderrTail:"",stdoutTruncated:!1,stderrTruncated:!1}}function ue(e,t){let r=e instanceof Error?e.message:String(e),n=t.stderrTail.trim()||t.stdoutTail.trim();return n?`${r}
|
|
3
|
-
${
|
|
1
|
+
import{b as Ke,c as qe,e as sn,f as an,g as cn,l as Ye,o as Qe}from"./chunk-6X4KO5A7.js";import{c as Me,t as We,w as He}from"./chunk-LGVTIZPV.js";import{c as je,e as G,g as De,h as Le}from"./chunk-FOP7HD6H.js";import"./chunk-DHEQMPLW.js";import{C as _e,Ca as Ue,D as Te,I as Ae,J as O,K as Ne,S as Ve,W as $e,Z as ne,_ as Fe,ca as Ge,da as Je,g as te,ga as Be,i as we,la as J,n as p,p as g,q as w,r as j,s as Pe,t as m,v as M,x as ke}from"./chunk-WEXQYJY3.js";import{existsSync as Vn}from"fs";import{randomUUID as Dn}from"crypto";import{isAbsolute as br,join as ft,relative as vr,resolve as Rr}from"path";var x=1,P=2,dn="./node_modules/scip-query/docs/schemas/project-config.schema.json";function ie(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(a){return{kind:"malformed",reason:`invalid JSON: ${a instanceof Error?a.message:String(a)}`}}if(!p(t))return{kind:"malformed",reason:"project config must be a JSON object"};let n=t.schemaVersion;if(n!==void 0&&!Number.isInteger(n))return{kind:"malformed",reason:"schemaVersion must be an integer"};let i=n===void 0?x:n;if(i!==x&&i!==P)return{kind:"unsupported",schemaVersion:i,direction:i<x?"older":"future"};let r=t.$schema;if(r!==void 0&&(typeof r!="string"||r.trim()===""))return{kind:"malformed",reason:"$schema must be a non-empty string when present"};let o=B(t),s=i!==P||typeof t.$schema!="string";return i===x?{kind:"legacy",sourceVersion:x,config:o,needsMigration:s}:{kind:"supported",sourceVersion:P,config:o,needsMigration:s}}function B(e){let t=e,{$schema:n,schemaVersion:i,...r}=t;return{$schema:typeof n=="string"&&n.trim()!==""?n:dn,schemaVersion:P,...r}}function re(e){return`${JSON.stringify(B(e),null,2)}
|
|
2
|
+
`}import{createHash as un}from"crypto";var f=1,I=2,U=1,D=1,V="sha256",ae=1;function tt(e,t,n){if(!m(e)||!j(t))throw new Error("Observation identity requires a bounded projection name and positive projection version.");return{schemaVersion:U,canonicalizationVersion:D,hashAlgorithm:V,projection:{name:e,version:t},digest:un(V).update(ln(e,t,n)).digest("hex")}}function ln(e,t,n){return`{"canonicalizationVersion":${D},"projection":${JSON.stringify(e)},"projectionVersion":${t},"value":${JSON.stringify(n)}}`}function ce(e){if(!p(e))return{kind:"malformed",reason:"observation receipt must be an object"};let t=e.schemaVersion;if(!Number.isInteger(t))return{kind:"malformed",reason:"observation receipt schemaVersion must be an integer"};if(t===f)return yn(e)?{kind:"legacy",schemaVersion:f,receipt:e}:{kind:"malformed",reason:"observation receipt v1 fields are malformed or contradictory"};if(t===I)return Cn(e)?{kind:"supported",schemaVersion:I,receipt:e}:{kind:"malformed",reason:"observation receipt v2 facts are malformed or contradictory"};let n=t;return{kind:"unsupported",schemaVersion:n,direction:n<f?"older":"future"}}function H(e){let t=ce(e);return t.kind==="legacy"||t.kind==="supported"}function de(e,t){return{collaborationDomain:E(y(e,n=>n.facts.collaborationDomain),y(t,n=>n.facts.collaborationDomain)),repositoryLineage:E(y(e,n=>n.facts.repositoryLineage),y(t,n=>n.facts.repositoryLineage)),workspaceInstance:E(y(e,n=>n.facts.workspaceInstance),y(t,n=>n.facts.workspaceInstance)),wholeContent:E(y(e,n=>n.facts.wholeContent),y(t,n=>n.facts.wholeContent)),relevantInputs:pn(e,t),indexInput:E(y(e,n=>n.facts.index?.inputs),y(t,n=>n.facts.index?.inputs)),indexGeneration:hn(e,t),observationStability:mn(e,t)}}function K(e,t,n=de(e,t)){let i=[["collaborationDomain",n.collaborationDomain],["wholeContent",n.wholeContent],["observationStability",n.observationStability]],r=[];for(let[s,a]of i)a.state!=="established"&&r.push(`${s}:${a.state}`);for(let[s,a]of[["left",e],["right",t]]){let c=gn(a);c!=="not-applicable"&&c!=="established"&&r.push(`${s}IndexAlignment:${c}`)}let o=i.some(([,s])=>s.state==="disproven")||r.some(s=>s.endsWith(":disproven"));return{policyVersion:ae,authority:r.length===0?"completion":o?"none":"advisory",requiredRelationships:["collaborationDomain","wholeContent","observationStability"],reasons:r}}function nt(e){return e.schemaVersion===f?e.index?.generationIdentity:e.facts.index?.generation.digest}function it(e){return e.schemaVersion===f?void 0:e.facts.workspaceInstance?.digest}function rt(e){if(e.schemaVersion===f)return e.index?.alignment??"not-established";let t=e.stabilityProofs.filter(n=>n.source!=="process");return t.some(n=>n.kind==="invalidated")?"invalidated":t.length>0&&t.every(n=>n.kind==="immutable"||n.kind==="fixed-snapshot")?"fixed":t.some(n=>n.kind==="bracketed")?"bracketed":"not-established"}function pn(e,t){let n=Xe(e),i=Xe(t);return[...new Set([...n.keys(),...i.keys()])].sort().map(o=>{let s=n.get(o),a=i.get(o),c=s?.subject??a?.subject??o,d=s?.identity.projection.name??a?.identity.projection.name??o;return{subject:c,projection:d,judgment:E(s?.identity,a?.identity)}})}function Xe(e){return e.schemaVersion!==I?new Map:new Map((e.facts.relevantInputs??[]).map(t=>[`${t.subject}\0${t.identity.projection.name}`,t]))}function hn(e,t){return e.schemaVersion===f&&t.schemaVersion===f?fn(e.index?.generationIdentity,t.index?.generationIdentity):e.schemaVersion===f||t.schemaVersion===f?b("unknown",["legacy-fact-not-comparable"],Ze(e),Ze(t)):E(e.facts.index?.generation,t.facts.index?.generation)}function fn(e,t){let n=e?[{kind:"legacy-index-generation",value:e}]:[],i=t?[{kind:"legacy-index-generation",value:t}]:[];return e===void 0||t===void 0?ot(n,i):b(e===t?"established":"disproven",[e===t?"identities-equal":"identities-different"],n,i)}function E(e,t){let n=e?[{kind:"identity",identity:e}]:[],i=t?[{kind:"identity",identity:t}]:[];return!e||!t?ot(n,i):ue(e,t)?b(e.digest===t.digest?"established":"disproven",[e.digest===t.digest?"identities-equal":"identities-different"],n,i):b("unknown",["identity-projections-not-comparable"],n,i)}function mn(e,t){if(e.schemaVersion===f||t.schemaVersion===f)return b("unknown",["legacy-fact-not-comparable"],[],[]);let n=et(e),i=et(t),r=ze(e),o=ze(t);return r==="invalidated"||o==="invalidated"?b("disproven",[...r==="invalidated"?["left-observation-invalidated"]:[],...o==="invalidated"?["right-observation-invalidated"]:[]],n,i):r!=="fixed"||o!=="fixed"?b("unknown",[...r==="no-repository-source"?["left-observation-has-no-repository-source"]:r!=="fixed"?["left-observation-not-fixed"]:[],...o==="no-repository-source"?["right-observation-has-no-repository-source"]:o!=="fixed"?["right-observation-not-fixed"]:[]],n,i):b("established",["all-observed-sources-fixed"],n,i)}function ze(e){let t=e.observedSources.filter(i=>i.kind!=="process");if(t.length===0)return"no-repository-source";let n=new Map(e.stabilityProofs.map(i=>[i.source,i.kind]));return t.some(i=>n.get(i.kind)==="invalidated")?"invalidated":t.every(i=>{let r=n.get(i.kind);return r==="immutable"||r==="fixed-snapshot"})?"fixed":"unknown"}function gn(e){if(e.schemaVersion!==I)return e.index?"unknown":"not-applicable";if(!e.observedSources.some(i=>i.kind==="index-generation"))return"not-applicable";let t=e.facts.index?.inputs;if(!t)return"unknown";let n=(e.facts.relevantInputs??[]).find(i=>ue(i.identity,t))?.identity;return n?n.digest===t.digest?"established":"disproven":"unknown"}function y(e,t){return e.schemaVersion===I?t(e):void 0}function Ze(e){return e.schemaVersion===f&&e.index?[{kind:"legacy-index-generation",value:e.index.generationIdentity}]:e.schemaVersion===I&&e.facts.index?[{kind:"identity",identity:e.facts.index.generation}]:[]}function et(e){return e.stabilityProofs.map(t=>({kind:"stability",proof:t}))}function ot(e,t){let n=e.length===0&&t.length===0?"both-facts-missing":e.length===0?"left-fact-missing":"right-fact-missing";return b("unknown",[n],e,t)}function b(e,t,n,i){return{state:e,reasons:t,facts:{left:n,right:i}}}function ue(e,t){return e.schemaVersion===t.schemaVersion&&e.canonicalizationVersion===t.canonicalizationVersion&&e.hashAlgorithm===t.hashAlgorithm&&e.projection.name===t.projection.name&&e.projection.version===t.projection.version}function yn(e){if(!p(e))return!1;let t=e.index,n=e.worktree;return at(e.observedAt)&&m(e.projectIdentity)&&xn(e.authorityKind)&&(t===void 0||p(t)&&m(t.generationIdentity)&&(t.source==="immutable"||t.source==="legacy")&&(t.alignment==="not-certified"||t.alignment==="leased"))&&(n===void 0||p(n)&&m(n.identity)&&typeof n.clean=="boolean"&&(n.headCommit===void 0||m(n.headCommit))&&(n.treeOid===void 0||m(n.treeOid)))&&On(e.authorityKind,t,n)}function Cn(e){if(!p(e))return!1;let t=e.facts,n=e.observedSources,i=e.stabilityProofs;if(!at(e.observedAt)||!p(t)||!Array.isArray(n)||n.length===0||!n.every(vn)||!se(n,c=>c.kind)||!Array.isArray(i)||!i.every(Rn)||!se(i,c=>c.source)||i.some(c=>!n.some(d=>d.kind===c.source))||!i.every(c=>In(c,t))||["collaborationDomain","repositoryLineage","workspaceInstance","wholeContent"].some(c=>t[c]!==void 0&&!S(t[c])))return!1;let o=t.relevantInputs;if(o!==void 0&&(!Array.isArray(o)||!o.every(bn)||!se(o,c=>`${c.subject}\0${c.identity.projection.name}`)))return!1;let s=t.index;if(s!==void 0&&(!p(s)||!S(s.generation)||s.inputs!==void 0&&!S(s.inputs)||s.source!=="immutable"&&s.source!=="legacy"))return!1;let a=e.diagnostics;return(a===void 0||p(a)&&(a.clean===void 0||typeof a.clean=="boolean")&&(a.headCommit===void 0||m(a.headCommit))&&(a.treeOid===void 0||m(a.treeOid)))&&Sn(t,n)}function S(e){return!p(e)||!p(e.projection)?!1:e.schemaVersion===U&&e.canonicalizationVersion===D&&e.hashAlgorithm===V&&m(e.projection.name)&&j(e.projection.version)&&Pe(e.digest)}function bn(e){return p(e)&&m(e.subject)&&S(e.identity)}function vn(e){return p(e)&&st(e.kind)&&(e.identity===void 0||S(e.identity))}function Rn(e){return p(e)&&st(e.source)&&(e.kind==="immutable"||e.kind==="fixed-snapshot"||e.kind==="bracketed"||e.kind==="not-established"||e.kind==="invalidated")}function Sn(e,t){let n=e.index,i=t.find(c=>c.kind==="index-generation");if(i){if(!p(n)||!S(n.generation)||i.identity&&!oe(i.identity,n.generation))return!1}else if(n!==void 0)return!1;let r=e.workspaceInstance,o=t.find(c=>c.kind==="live-workspace");if(o?.identity&&(!S(r)||!oe(o.identity,r)))return!1;let s=e.wholeContent,a=t.find(c=>c.kind==="repository-snapshot");return!(a?.identity&&(!S(s)||!oe(a.identity,s)))}function In(e,t){return e.kind==="not-established"||e.kind==="invalidated"?!0:e.source==="index-generation"?e.kind==="immutable"&&p(t.index)&&t.index.source==="immutable":e.source==="repository-snapshot"?e.kind==="fixed-snapshot":e.source==="live-workspace"?e.kind==="bracketed":!1}function oe(e,t){return ue(e,t)&&e.digest===t.digest}function On(e,t,n){return e==="index-worktree"?t!==void 0&&n!==void 0:e==="index-only"?t!==void 0&&n===void 0:e==="worktree-only"?t===void 0&&n!==void 0:e==="process-local"&&t===void 0&&n===void 0}function xn(e){return e==="index-worktree"||e==="index-only"||e==="worktree-only"||e==="process-local"}function st(e){return e==="index-generation"||e==="repository-snapshot"||e==="live-workspace"||e==="process"}function at(e){return typeof e=="string"&&!Number.isNaN(Date.parse(e))}function se(e,t){return new Set(e.map(t)).size===e.length}import{createHash as ct}from"crypto";import{closeSync as En,fstatSync as dt,openSync as wn,rmSync as Pn}from"fs";import{dirname as kn}from"path";var _n=2e3,Tn=10,An=3,Y=class extends Error{constructor(n,i,r){super(`Concurrent edit detected for ${n}; expected revision ${lt(i)}, but found ${lt(r)}. The latest file was left untouched.`);this.path=n;this.original=i;this.latest=r;this.name="FileRevisionConflictError"}path;original;latest};function pt(e,t,n={}){let i=Nn(e,n.lockTimeoutMs??_n,n.monotonicNow??G);try{let r=Math.max(0,Math.floor(n.maxRetries??An));for(let o=0;;o+=1){let s=q(e),a=t(s,o);if(a.kind==="unchanged")return{changed:!1,attempts:o+1,previous:s,current:s};n.onBeforeCommit?.({attempt:o,snapshot:s,mutation:a});let c=q(e);if(!Mn(s.revision,c.revision)){if(o<r)continue;throw new Y(e,s.revision,c.revision)}try{jn(e,a,s.revision)}catch(d){if(d.code==="EEXIST"){let l=q(e);if(o<r)continue;throw new Y(e,s.revision,l.revision)}throw d}return{changed:!0,attempts:o+1,previous:s,current:q(e)}}}finally{i.release()}}function q(e){for(let t=0;t<4;t+=1){let n;try{n=wn(e,"r");let i=ut(dt(n)),r=Ne(n,{maxBytes:Te,inputKind:"revisioned text file"}),o=ut(dt(n));if(!ht(i,o))continue;return{path:e,text:r,revision:{exists:!0,hash:ct("sha256").update(r).digest("hex"),identity:o}}}catch(i){if(i.code==="ENOENT")return{path:e,text:"",revision:{exists:!1,hash:ct("sha256").update("").digest("hex")}};throw i}finally{n!==void 0&&En(n)}}throw new Error(`Could not read a stable revision of ${e}; the file is changing continuously.`)}function Nn(e,t,n){let i=`${e}.scip-query-write.lock`,r=n()+Math.max(0,t);for(;;){let o=Me(i,{kind:"revisioned-file-mutation",detail:{target:e}});if(o.kind==="acquired")return o.lock;if(n()>=r)throw new Error(`Timed out after ${t}ms waiting to update ${e}; the file was left untouched.`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,Tn)}}function jn(e,t,n){if(t.kind==="delete"){if(!n.exists)return;Pn(e),Ve(kn(e));return}let i=t.mode??n.identity?.mode;n.exists?De(e,t.text,{durability:"durable",mode:i}):Le(e,t.text,{durability:"durable",mode:i})}function Mn(e,t){return e.exists===t.exists&&e.hash===t.hash&&(e.identity===void 0?t.identity===void 0:t.identity!==void 0&&ht(e.identity,t.identity))}function ut(e){return{dev:e.dev,ino:e.ino,size:e.size,mtimeMs:e.mtimeMs,mode:e.mode&511}}function ht(e,t){return e.dev===t.dev&&e.ino===t.ino&&e.size===t.size&&e.mtimeMs===t.mtimeMs&&e.mode===t.mode}function lt(e){return e.exists?e.hash.slice(0,12):"<absent>"}var L=".scipquery.json",mt=2e3,gt=5e3,le=gt,yt=15*6e4,pe={enabled:!0,windowMs:15*6e4,maxRebuilds:2,maxEstimatedWriteBytes:1024*1024*1024},Ln={enabled:!1,autoStart:!1,allowExpensiveRebuild:!1,debounceMs:mt,cooldownMs:le,gitPollMs:2e3,idleTimeoutMs:yt,autoRefresh:!0,ignore:[],resourceBudget:pe};var Er=new Set(M);function Q(e){let t=ft(e,L);if(!Vn(t))return{};let n;try{n=Ae(t,{maxBytes:_e,inputKind:"scip-query project config"})}catch(i){let r=i instanceof Error?i.message:String(i);throw new Error(`unable to read ${L} at ${t}: ${r}`,{cause:i})}return bt(ie(n),t,"read").config}function Ct(e){return{...Ln,...e.watch,cooldownMs:Math.max(gt,e.watch?.cooldownMs??le),resourceBudget:{...pe,...e.watch?.resourceBudget}}}function Wn(e,t){return $n(e,t).configPath}function $n(e,t){let n=ft(e,L),i=Dn(),r={collaborationDomainId:i,languages:t,watch:{enabled:!0,debounceMs:mt,cooldownMs:le,gitPollMs:2e3,idleTimeoutMs:yt,autoRefresh:!0,resourceBudget:{...pe}}},o=pt(n,s=>{if(!s.revision.exists)return{kind:"write",text:re(r)};let a=Fn(s,r);return a.config.collaborationDomainId?{kind:"unchanged"}:{kind:"write",text:re({...a.config,collaborationDomainId:i})}});return{configPath:n,changed:o.changed}}function Fn(e,t){if(!e.revision.exists)return{config:B(t),needsMigration:!0};let n=bt(ie(e.text),e.path,"update");return{config:n.config,needsMigration:n.needsMigration}}function bt(e,t,n){if(e.kind==="legacy"||e.kind==="supported")return e;if(e.kind==="malformed"){let r=n==="read"?`invalid ${L} at ${t}: ${e.reason}`:`Cannot update ${t}: the latest project config is ${e.reason}.`;throw new Error(`${r} The file was left untouched.`)}let i=n==="read"?`invalid ${L} at ${t}`:`Cannot update ${t}: the latest project config is invalid`;throw new Error(`${i} (unsupported ${e.direction} schemaVersion ${e.schemaVersion}; this scip-query reads legacy v${x} and current v${P}). Upgrade scip-query before retrying; the file was left untouched.`)}import{existsSync as Ce,lstatSync as Jn,statSync as _t,watch as Bn}from"fs";import{EventEmitter as Un}from"events";import{basename as Hn,dirname as Kn,isAbsolute as be,join as C,relative as Tt,resolve as At}from"path";import{watch as qn}from"chokidar";import Yn from"ignore";function he(e){let t=JSON.stringify(e);return Buffer.byteLength(t)<=65536?t:void 0}var Nt=5e3,ge=class{projectRoot;config;watchConfig;outputDb;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onReindexError;onRefreshSuppressed;onError;reindexRunner;subscriptionFactory;budgetInspector;clock;activeOperation=null;stopPromise=null;stopInProgress=!1;status={state:"idle"};debounceTimer=null;cooldownTimer=null;budgetTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;pendingChanges=new Map;pendingChangesComplete=!0;pendingChangesIncompleteReason;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];sourcePollingFallbackStarted=!1;gitPollTimer=null;lastGitState=null;preferFilesystemGitState=!0;watchGitLayout=null;localCacheWatchPath;gitignoreFilter;extraIgnore;stopped=!1;constructor(t){this.projectRoot=t.projectRoot,this.config=t.config,this.watchConfig=Ct(t.config),this.outputDb=t.outputDb??C(Be(this.projectRoot,t.config),"index.db"),this.preferFilesystemGitState=t.gitReader===void 0,this.localCacheWatchPath=yi(this.projectRoot,Kn(this.outputDb)),this.languages=t.languages,this.pnpmWorkspaces=t.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=t.config.indexer?.typescript?.projectMode,this.typescriptProjects=t.config.indexer?.typescript?.projects,this.clojureConfigPath=t.config.indexer?.clojure?.configPath,this.indexerConcurrency=t.config.indexerConcurrency,this.onStatus=t.onStatus??(()=>{}),this.onReindexComplete=t.onReindexComplete??(()=>{}),this.onReindexError=t.onReindexError??(()=>{}),this.onRefreshSuppressed=t.onRefreshSuppressed??(()=>{}),this.onError=t.onError??(n=>console.error(n.message)),this.clock=t.clock??Zn,jt.set(this,Ci(t.stopTimeoutMs??Nt,"watcher stop timeout")),this.reindexRunner=t.reindexRunner??Lt(),this.subscriptionFactory=t.subscriptionFactory??ei,this.budgetInspector=t.budgetInspector??Qe,Mt.set(this,{projectRoot:t.projectRoot,config:t.config,gitReader:t.gitReader??$e,languages:Wt(t.languages??t.config.languages),typeScriptInputPaths:null,stagedIndexEntries:null}),this.gitignoreFilter=He(t.projectRoot),this.extraIgnore=Yn(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore),Pt(this)}start(){if(this.stopInProgress)throw new Error("Cannot restart a watcher while its previous ownership is still draining.");this.stopped=!1,this.stopPromise=null,z(this).errors=[],this.sourcePollingFallbackStarted=!1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{this.startSourceWatcher()}catch(t){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(t)}`))}}stop(){if(this.stopPromise)return this.stopPromise;this.stopped=!0,this.stopInProgress=!0;let t=this.fsWatchers;this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearBudgetTimer(),this.clearGitPollTimer();let n=this.activeOperation;n&&this.setStatus({state:"draining",startedAt:this.wallNow(),reason:"waiting for the active reindex worker to exit"});let i=[...z(this).closures],r=Xn(this),o=this.clock.now()+r;return this.stopPromise=this.finishStop(t,i,n,o,r).catch(s=>{throw this.stopInProgress=!1,s}),this.stopPromise}requestRefresh(t,n={}){if(!this.stopped){if(this.markPendingChangesIncomplete(`unstructured-trigger:${t.kind}`),!n.immediate||this.reindexInFlight||this.status.state==="cooldown"||this.status.state==="budget-paused"){this.scheduleReindex(t);return}this.pendingTrigger=fe(this.pendingTrigger,t),this.changedFiles+=1,this.clearDebounceTimer(),this.triggerReindex()}}startSourceWatcher(t=!1){let n=this.subscriptionFactory(this.projectRoot,{ignoreInitial:!0,ignored:(i,r)=>this.isIgnoredWatchPath(i,r?.isDirectory()??!1),usePolling:t,ignorePermissionErrors:!0,...t?{interval:5e3,binaryInterval:1e4}:{}});n.on("all",(i,r)=>{!this.stopped&&i!=="addDir"&&i!=="unlinkDir"&&this.handleFileChange(i,r)}),n.on("error",i=>this.handleSourceWatcherError(n,i,t)),this.fsWatchers.push(n)}handleSourceWatcherError(t,n,i){if(this.markPendingChangesIncomplete("source-watcher-error"),i||this.sourcePollingFallbackStarted||!pi(n)||this.stopped){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(n)}`));return}this.sourcePollingFallbackStarted=!0,this.fsWatchers=this.fsWatchers.filter(r=>r!==t),zn(z(this),t,r=>this.onError(r));try{this.startSourceWatcher(!0)}catch(r){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(r)}`))}}isIgnoredWatchPath(t,n){let i=this.relativeWatchPath(t);if(!i)return!1;if(It(i,this.localCacheWatchPath))return!0;let r=n?`${i}/`:i;return this.gitignoreFilter.isIgnored(r)||this.extraIgnore.ignores(r)}handleFileChange(t,n){let i=this.relativeWatchPath(n);if(!i||i===".."||i.startsWith("../")||It(i,this.localCacheWatchPath)||this.gitignoreFilter.isIgnored(i)||this.extraIgnore.ignores(i)||i.endsWith("index.db")||i.endsWith("index.scip")||i.endsWith("index.db.tmp")||Hn(i).startsWith(Ye))return;i===".scipquery.json"&&Et(this,this.projectRoot);let r=wt(this,t,i);r!==null&&(r||this.markPendingChangesIncomplete(`unsupported-source-event:${t}`),this.scheduleReindex({kind:"watch-source",detail:i},r?[{path:i,kind:r}]:void 0,r!==void 0))}relativeWatchPath(t){let n=be(t)?t:C(this.projectRoot,t);return Tt(this.projectRoot,n).replaceAll("\\","/")}scheduleReindex(t,n,i=!1){this.pendingTrigger=fe(this.pendingTrigger,t),i||this.markPendingChangesIncomplete(`unstructured-trigger:${t.kind}`);for(let o of n??[])this.recordPendingChange(o);if(this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});let o=this.activeOperation;o&&k.get(this)!==o&&(k.set(this,o),o.cancel().then(s=>{s.state==="degraded"&&!this.stopped&&this.onError(new Error(s.reason))},s=>{this.stopped||this.onError(s instanceof Error?s:new Error(String(s)))}));return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}if(this.status.state==="budget-paused"){this.dirty=!0,this.setStatus({...this.status,dirty:!0});return}this.clearDebounceTimer();let r=this.wallNow()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:r}),this.debounceTimer=this.clock.setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let t=this.inspectBudget(),n=this.watchConfig.allowExpensiveRebuild&&t.state!=="paused";if(t.state==="paused"&&t.reason!=="rebuild-count"){this.dirty=!0;let c=Math.max(this.wallNow()+1,t.until);this.setStatus({state:"budget-paused",until:c,dirty:!0,reason:t.detail,rebuilt:t.rebuilt,estimatedWriteBytes:t.estimatedWriteBytes}),this.clearBudgetTimer(),this.budgetTimer=this.clock.setTimeout(()=>{this.budgetTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},Math.min(2147483647,Math.max(1,c-this.wallNow())));return}let i=this.clock.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&i<this.watchConfig.cooldownMs){let c=this.watchConfig.cooldownMs-i;this.dirty=!0;let d=this.wallNow()+c;this.setStatus({state:"cooldown",until:d,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},c);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let r=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let o=this.consumePendingChangeJournal(),s=this.wallNow();this.setStatus({state:"indexing",startedAt:s});let a=this.reindexRunner.start(this.reindexRequest(r,n,o));this.activeOperation=a,a.completion.then(c=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),X.set(this,0),this.stopped)return;if(k.get(this)===a){if(this.restorePendingChangeJournal(o),this.dirty){let l=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:l,dirty:!0}),this.clearCooldownTimer(),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"});return}Pt(this);let d=!1;try{d=this.onReindexComplete(c,r,{pendingChanges:this.dirty})===!0}catch(l){this.onError(l instanceof Error?l:new Error(String(l)))}if(this.dirty&&!this.stopped){if(d){let u=this.pendingTrigger??{kind:"unknown"};this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.resetPendingChanges(),this.onRefreshSuppressed(u),this.setStatus({state:"idle"});return}let l=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:l,dirty:!0}),this.clearCooldownTimer(),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(c=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let d=c instanceof Error?c:new Error(String(c));this.restorePendingChangeJournal(o);let l=Dt(d),u=0;if(l?(u=(X.get(this)??0)+1,X.set(this,u),this.dirty=!0,this.pendingTrigger=fe(this.pendingTrigger,r)):X.set(this,0),!l&&k.get(this)!==a&&(this.onReindexError(d,r),this.onError(d)),this.dirty){let h=l?ci(this.watchConfig.cooldownMs,u):this.watchConfig.cooldownMs,R=this.wallNow()+h;this.setStatus({state:"cooldown",until:R,dirty:!0}),this.clearCooldownTimer(),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},h);return}this.setStatus({state:"idle"})}).finally(()=>{this.activeOperation===a&&(this.activeOperation=null),k.get(this)===a&&k.delete(this)})}async finishStop(t,n,i,r,o){let s=[],a=t.map(async h=>{try{await h.close()}catch(R){s.push(`watch subscription close failed: ${String(R)}`)}});a.push(...n),i&&a.push((async()=>{try{let h=await i.cancel();h.state==="degraded"&&s.push(h.reason)}catch(h){s.push(`reindex cancellation failed: ${h instanceof Error?h.message:String(h)}`)}})());let c=a.length,d=a.map(h=>h.finally(()=>{c-=1})),l=await Qn(d,r,this.clock),u=z(this);return s.push(...u.errors),u.errors=[],l?this.stopInProgress=!1:(s.push(`watch shutdown exceeded the ${o}ms deadline with ${c} operation(s) still pending`),Promise.all(d).then(()=>{this.stopInProgress=!1})),s.length>0?(this.setStatus({state:"draining",startedAt:this.wallNow(),reason:s.join("; ")}),{state:"degraded",reasons:s}):(this.setStatus({state:"idle"}),{state:"stopped"})}wallNow(){return this.clock.wallNow?.()??this.clock.now()}inspectBudget(){try{return this.budgetInspector(this.outputDb,this.watchConfig.resourceBudget,new Date(this.wallNow()))}catch(t){return{state:"paused",reason:"activity-evidence",until:this.wallNow()+this.watchConfig.resourceBudget.windowMs,rebuilt:0,estimatedWriteBytes:0,detail:`reindex activity evidence could not be read: ${t instanceof Error?t.message:String(t)}`}}}reindexRequest(t,n=!0,i){return{projectRoot:this.projectRoot,config:this.config,languages:this.languages,pnpmWorkspaces:this.pnpmWorkspaces,typescriptProjectMode:this.typescriptProjectMode,typescriptProjects:this.typescriptProjects,clojureConfigPath:this.clojureConfigPath,indexerConcurrency:this.indexerConcurrency,trigger:t,changeJournal:i,allowExpensiveRebuild:n}}setStatus(t){this.status=t,this.onStatus(t)}recordPendingChange(t){if(this.pendingChanges.size>=1024&&!this.pendingChanges.has(t.path)){this.pendingChanges.clear(),this.markPendingChangesIncomplete("change-entry-limit");return}let n=this.pendingChanges.get(t.path),i=ui(n,t.kind);i===null?this.pendingChanges.delete(t.path):this.pendingChanges.set(t.path,i)}markPendingChangesIncomplete(t){this.pendingChangesComplete=!1,this.pendingChangesIncompleteReason??=t}consumePendingChangeJournal(){let t=We(this.outputDb),n=[...this.pendingChanges.entries()].map(([s,a])=>({path:s,kind:a})).sort((s,a)=>s.path.localeCompare(a.path)),i=this.pendingChangesComplete,r=this.pendingChangesIncompleteReason;t||(i=!1,r??="accepted-generation-unavailable");let o={version:1,baseGeneration:t,complete:i,...r?{incompleteReason:r}:{},entries:n};return he(o)||(o={version:1,baseGeneration:t,complete:!1,incompleteReason:"change-journal-byte-limit",entries:[]}),this.resetPendingChanges(),o}restorePendingChangeJournal(t){let n=[...this.pendingChanges.entries()].map(([o,s])=>({path:o,kind:s})),i=this.pendingChangesComplete,r=this.pendingChangesIncompleteReason;this.resetPendingChanges(),t.complete||this.markPendingChangesIncomplete(t.incompleteReason??"failed-reindex");for(let o of t.entries)this.recordPendingChange(o);i||this.markPendingChangesIncomplete(r??"failed-reindex");for(let o of n)this.recordPendingChange(o)}resetPendingChanges(){this.pendingChanges.clear(),this.pendingChangesComplete=!0,this.pendingChangesIncompleteReason=void 0}clearDebounceTimer(){this.debounceTimer&&(this.clock.clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(this.clock.clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}clearBudgetTimer(){this.budgetTimer&&(this.clock.clearTimeout(this.budgetTimer),this.budgetTimer=null)}startGitStatePolling(){this.lastGitState=this.readGitState(),this.lastGitState&&(v(this).stagedIndexEntries=kt(this.projectRoot,v(this).gitReader),this.gitPollTimer=this.clock.setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.())}pollGitState(){if(this.reindexInFlight||this.stopped)return;let t=this.lastGitState,n=this.readGitState();if(!t||!n||this.stopped){this.lastGitState=n;return}this.lastGitState=n;let i=t.head!==n.head,r=t.indexPath!==n.indexPath||t.indexMtimeMs!==n.indexMtimeMs||t.indexSize!==n.indexSize;if(!i&&!r)return;let o=v(this),s=o.stagedIndexEntries,a=kt(this.projectRoot,o.gitReader);o.stagedIndexEntries=a;let c=Si(this.projectRoot,o.gitReader,t,n,s,a,i,r),d=null;if(c!==null&&(c.includes(".scipquery.json")&&Et(this,this.projectRoot),d=c.filter(u=>wt(this,"add",u)!==null),d.length===0))return;let l=d?.map(u=>({path:u,kind:Ce(C(this.projectRoot,u))?"change":"delete"}));i&&r?this.scheduleReindex({kind:"watch-git-state",detail:me("HEAD and index changed",d)},l,l!==void 0):i?this.scheduleReindex({kind:"watch-git-head",detail:me("HEAD changed",d)},l,l!==void 0):r&&this.scheduleReindex({kind:"watch-git-index",detail:me(n.indexPath??"index changed",d)},l,l!==void 0)}readGitState(){if(this.preferFilesystemGitState){let t=this.readFilesystemGitState();if(t)return t}return this.readGitStateFromGit()}readFilesystemGitState(){let t=this.watchGitLayout??hi(this.projectRoot);if(!t)return null;this.watchGitLayout=t;let n=fi(t.gitDir);return n?xt(n,t.indexPath):null}readGitStateFromGit(){let t=v(this).gitReader,n=ne(this.projectRoot,["rev-parse","--git-path","index"],t);if(!n)return null;let i=Fe(this.projectRoot,n);return xt(ne(this.projectRoot,["rev-parse","--verify","HEAD"],t),i)}clearGitPollTimer(){this.gitPollTimer&&(this.clock.clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};async function Qn(e,t,n){if(e.length===0)return!0;let i=Promise.all(e).then(()=>!0),r=Math.max(0,t-n.now()),o=null,s=new Promise(c=>{o=n.setTimeout(()=>c(!1),r)}),a=await Promise.race([i,s]);return a&&o&&n.clearTimeout(o),a}var Rt=new WeakMap,jt=new WeakMap,Mt=new WeakMap,k=new WeakMap,X=new WeakMap;function z(e){let t=Rt.get(e);if(t)return t;let n={closures:new Set,errors:[]};return Rt.set(e,n),n}function Xn(e){return jt.get(e)??Nt}function v(e){let t=Mt.get(e);if(!t)throw new Error("Watcher input state was not initialized.");return t}function zn(e,t,n){let i=Promise.resolve().then(()=>t.close()).catch(r=>{let o=`watch subscription close failed during polling fallback: ${String(r)}`;e.errors.push(o),n(new Error(o))});e.closures.add(i),i.then(()=>e.closures.delete(i))}function Vt(e,t=je){let{projectRoot:n,config:i,languages:r,pnpmWorkspaces:o,typescriptProjectMode:s,typescriptProjects:a,clojureConfigPath:c,indexerConcurrency:d,trigger:l}=e,u=Q(n),h=Object.keys(u).length>0?u:i,R=J(n,h),F=h.indexer?.typescript,on=h.indexer?.clojure,Ee=t(process.pid);if(!Ee)throw new Error(`Could not establish watcher process identity for reindex worker ownership (pid ${process.pid}).`);return{workerPath:new URL("./reindex-worker.js",import.meta.url).pathname,env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:n,SCIP_REINDEX_OUTPUT_SCIP:R.indexPath,SCIP_REINDEX_OUTPUT_DB:R.dbPath,SCIP_REINDEX_LANGUAGES:(h.languages??r)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(h.indexerConcurrency??d??""),SCIP_REINDEX_PNPM_WORKSPACES:F?.pnpmWorkspaces??o?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:F?.projectMode??s,projects:F?.projects??a??[],maxHeapMb:F?.maxHeapMb}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:on?.configPath??c??"",SCIP_REINDEX_TRIGGER_KIND:l.kind,SCIP_REINDEX_TRIGGER_DETAIL:l.detail??"",SCIP_REINDEX_CHANGE_JOURNAL:e.changeJournal?he(e.changeJournal)??"":"",SCIP_REINDEX_ALLOW_EXPENSIVE:e.allowExpensiveRebuild===!1?"0":"1",SCIP_REINDEX_PROCESS_GROUP_LEADER:"1",SCIP_REINDEX_PARENT_IDENTITY:JSON.stringify(Ee)}}}var Zn={now:G,wallNow:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ei=(e,t)=>ti(process.platform,t.usePolling)?new ye(e):qn(e,t);function ti(e,t){return e==="darwin"&&t!==!0}var W=class extends Error{constructor(t,n){super(t,n===void 0?void 0:{cause:n}),this.name="RecursiveSourceWatchError"}},ye=class{events=new Un;watcher;constructor(t){this.watcher=Bn(t,{recursive:!0},(n,i)=>{if(i===null){this.events.emit("error",new W("Recursive source watcher omitted the changed path."));return}let r=C(t,i.toString());this.events.emit("all",ni(n,r),r)}),this.watcher.on("error",n=>{this.events.emit("error",new W(`Recursive source watcher failed: ${n.message}`,n))})}on=(t,n)=>(this.events.on(t,n),this);close(){this.watcher.close()}};function ni(e,t){return e==="change"?"change":Ce(t)?_t(t).isDirectory()?"addDir":"add":"unlink"}var ii=15*6e4,ri=1e3,oi=64*1024;function si(){return{stdoutTail:"",stderrTail:"",stdoutTruncated:!1,stderrTruncated:!1}}function St(e,t){let n=e instanceof Error?e.message:String(e),i=t.stderrTail.trim()||t.stdoutTail.trim();return i?`${n}
|
|
3
|
+
${i}`:n}function ai(e,t){return Object.assign(new Error(e,t===void 0?void 0:{cause:t}),{retryable:!0})}function Dt(e){return e instanceof Error&&"retryable"in e&&e.retryable===!0}function ci(e,t){let n=e*2**Math.min(5,Math.max(0,t-1));return Math.max(e,Math.min(3e4,n))}function Lt(e={}){let t=e.timeoutMs??ii,n=e.terminationGraceMs??ri,i=e.maxOutputBytes??oi,r=e.resolveLaunch??Vt;return{start(o){let s=r(o),a=new AbortController,c=si(),d=!1,l=qe({command:process.execPath,args:[...process.execArgv,s.workerPath],label:"watch reindex worker",env:s.env,timeoutMs:t,terminationGraceMs:n,maxStdoutBytes:i,maxStderrBytes:i,outputLimitBehavior:"truncate-tail",signal:a.signal,detached:!0}).then(u=>{if(c={stdoutTail:u.stdout,stderrTail:u.stderr,stdoutTruncated:u.stdoutTruncated,stderrTruncated:u.stderrTruncated},u.status!==0){let h=St(new Error(`Reindex worker exited with ${u.signal?`signal ${u.signal}`:`code ${u.status}`}`),c);throw u.status===75?ai(h):new Error(h)}return u.durationMs}).catch(u=>{throw Dt(u)?u:(u instanceof Ke&&(c={stdoutTail:u.stdout,stderrTail:u.stderr,stdoutTruncated:u.stdoutTruncated,stderrTruncated:u.stderrTruncated}),new Error(St(u,c),{cause:u}))}).finally(()=>{d=!0});return{completion:l,async cancel(){d||a.abort();try{await l}catch{}return{state:"exited",diagnostics:c}},diagnostics:()=>c}}}}function fe(e,t){return e?e.kind===t.kind?e.detail===t.detail?e:{kind:e.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${e.kind}, ${t.kind}`}:t}function di(e){if(e==="add")return"add";if(e==="change")return"change";if(e==="unlink")return"delete"}function ui(e,t){return e?e==="add"?t==="delete"?null:"add":e==="delete"&&t==="add"?"change":t:t}function li(e){return e instanceof Error&&"code"in e&&e.code==="EMFILE"||String(e).includes("EMFILE: too many open files")}function pi(e){return e instanceof W||li(e)}var ve=/^[0-9a-f]{40,64}$/i;function It(e,t){return e===".git"||e.startsWith(".git/")||e==="node_modules"||e.startsWith("node_modules/")||e.endsWith("/node_modules")||e.includes("/node_modules/")?!0:t!==void 0&&(e===t||e.startsWith(`${t}/`))}function hi(e){let t=C(e,".git");try{let n=Jn(t),i;if(n.isDirectory())i=t;else if(n.isFile()){let r=/^gitdir:\s*(.+)\s*$/m.exec(O(t,"Git directory marker"));if(!r?.[1])return null;let o=r[1].trim();i=be(o)?o:At(e,o)}else return null;return Ce(i)?{gitDir:i,indexPath:C(i,"index")}:null}catch{return null}}function fi(e){let t;try{t=O(C(e,"HEAD"),"Git HEAD").trim()}catch{return}if(ve.test(t))return t.toLowerCase();let n=/^ref:\s*(.+)$/.exec(t)?.[1]?.trim();if(!n)return;let i=mi(e);return Ot(e,n)??Ot(i,n)??gi(i,n)}function mi(e){try{let t=O(C(e,"commondir"),"Git common-directory marker").trim();return t?be(t)?t:At(e,t):e}catch{return e}}function Ot(e,t){try{let n=O(C(e,t),"Git reference").trim();return ve.test(n)?n.toLowerCase():void 0}catch{return}}function gi(e,t){try{for(let n of O(C(e,"packed-refs"),"Git packed references").split(`
|
|
4
|
+
`)){if(n.startsWith("#")||n.startsWith("^"))continue;let i=n.indexOf(" ");if(i===-1)continue;let r=n.slice(0,i);if(n.slice(i+1).trim()===t&&ve.test(r))return r.toLowerCase()}}catch{return}}function xt(e,t){let n={head:e,indexPath:t};try{let i=_t(t);n.indexMtimeMs=i.mtimeMs,n.indexSize=i.size}catch{n.indexMtimeMs=void 0,n.indexSize=void 0}return n}function yi(e,t){let n=Tt(e,t).replaceAll("\\","/");if(!(!n||n===".."||n.startsWith("../")))return n}function Ci(e,t){if(!Number.isSafeInteger(e)||e<=0)throw new Error(`${t} must be a positive integer.`);return e}function Wt(e){return e&&e.length>0?[...e]:M}function Et(e,t){try{let n=v(e);n.config=Q(t),n.languages=Wt(n.config.languages)}catch{v(e).languages=M}}function wt(e,t,n){let i=v(e);if(te(n,i.languages)==="other")return null;let o=di(t);if(n===".scipquery.json"||Ge(n))return i.typeScriptInputPaths=null,o;if(!bi(n,i.languages))return o;let s=i.typeScriptInputPaths;if(!s)return o;let a=s.has(n);if(o!=="add")return a?o:null;if(a)return"change";let c=$t(e);return c?c.has(n)?"add":null:o}function Pt(e){let t=v(e);if(!t.languages.includes("typescript")){t.typeScriptInputPaths=null;return}let n=vi(t.projectRoot,t.config,t.languages);t.typeScriptInputPaths=n??$t(e)}function $t(e){let t=v(e);if(!t.languages.includes("typescript"))return t.typeScriptInputPaths=null,null;try{let n=t.config.indexer?.typescript,i=Je(t.projectRoot,n?.projectMode,n?.projects);return t.typeScriptInputPaths=i,i}catch{return t.typeScriptInputPaths=null,null}}function bi(e,t){if(!t.includes("typescript"))return!1;let n=te(e,["typescript","javascript"]);return n==="source"||n==="ambient"}function vi(e,t,n){try{let i=ke(O(J(e,t).metaPath,"reindex metadata"));if(i.kind!=="supported"&&i.kind!=="legacy")return null;let r=we(i.metadata.fingerprint);return!r||!Ri(r,n,t)?null:new Set(r.files.map(o=>o.path))}catch{return null}}function Ri(e,t,n){let i=Ue(t,{pnpmWorkspaces:n.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:n.indexer?.typescript?.projectMode,typescriptProjects:n.indexer?.typescript?.projects,clojureConfigPath:n.indexer?.clojure?.configPath});return e.version===i.version&&JSON.stringify([...e.languages].sort())===JSON.stringify(i.languages)&&e.pnpmWorkspaces===i.pnpmWorkspaces&&e.typescriptProjectMode===i.typescriptProjectMode&&JSON.stringify([...e.typescriptProjects].sort())===JSON.stringify(i.typescriptProjects)&&e.clojureConfigPath===i.clojureConfigPath}function Si(e,t,n,i,r,o,s,a){let c=new Set;if(s){if(!n.head||!i.head)return null;let d=t.runResult(e,["diff","--name-only","-z","--no-renames","--relative",n.head,i.head,"--"]);if(d.kind!=="success")return null;for(let l of Ii(d.output))c.add(l)}if(a){if(r===null||o===null)return null;for(let d of xi(r,o))c.add(d)}return[...c].sort()}function kt(e,t){let n=t.runResult(e,["diff","--cached","--raw","-z","--no-renames","--relative","--"]);return n.kind==="success"?Oi(n.output):null}function Ii(e){return e.split("\0").filter(t=>t.length>0)}function Oi(e){let t=e.split("\0");if(t.at(-1)===""&&t.pop(),t.length%2!==0)return null;let n=new Map;for(let i=0;i<t.length;i+=2){let r=t[i],o=t[i+1];if(!r.startsWith(":")||!o)return null;n.set(o,r)}return n}function xi(e,t){return[...new Set([...e.keys(),...t.keys()])].filter(i=>e.get(i)!==t.get(i))}function me(e,t){return t===null?`${e}; changed paths unavailable`:t.length===0?e:t.length===1?t[0]:`${t.length} compiler inputs changed`}import{existsSync as Re,mkdirSync as Ei,symlinkSync as wi,readlinkSync as Ft,unlinkSync as Gt,readdirSync as Pi}from"fs";import{join as _,dirname as Se,resolve as T,relative as ki,isAbsolute as _i}from"path";import{homedir as Ti,platform as Ai}from"os";import{fileURLToPath as Ni}from"url";var ji=Ai()==="win32";var Jt=["scip-query","scip-plan","scip-setup","scip-integrity-audit","scip-explore","concrete-plan"];function Mi(e={}){let t=e.quiet?()=>{}:console.log,n=Ni(import.meta.url),i=T(Se(n),"..","skills"),r=e.homeDir??process.env.SCIP_QUERY_SKILLS_HOME??Ti(),o=[_(r,".claude","skills"),_(r,".codex","skills"),_(r,".agents","skills")],s={installed:[],skipped:[],alreadyLinked:[],pruned:[]};for(let a of o){let c=Se(a);if(!Re(c))continue;Ei(a,{recursive:!0});let d=Li(a);Vi(a,i,d,s,t);for(let l of Jt){let u=_(i,l),h=_(a,l);if(!Re(u)){s.skipped.push(`${d}/${l}`);continue}if(Re(h)){try{let R=Ft(h);if(T(R)===T(u)){s.alreadyLinked.push(`${d}/${l}`),t(` ok: ${l} \u2192 ${d} (already linked)`);continue}}catch{s.skipped.push(`${d}/${l}`),t(` skip: ${l} \u2192 ${d} (exists, not a symlink)`);continue}Gt(h)}wi(u,h,ji?"junction":"dir"),s.installed.push(`${d}/${l}`),t(` done: ${l} \u2192 ${d}`)}}return s}function Vi(e,t,n,i,r){let o=new Set(Jt);for(let s of Pi(e)){if(o.has(s))continue;let a=_(e,s),c;try{c=T(Se(a),Ft(a))}catch{continue}Di(c,t)&&(Gt(a),i.pruned.push(`${n}/${s}`),r(` prune: ${s} \u2192 ${n} (removed stale scip-query skill link)`))}}function Di(e,t){let n=ki(T(t),T(e));return n===""||!n.startsWith("..")&&!_i(n)}function Li(e){return e.includes(".codex")?"Codex":e.includes(".agents")?"Agents":"Claude"}var Bt=["repository-observation","repository-preview","mutation","composite","environment-observation","tool-information"];function Wi(e,t=[]){return{defaultRole:e,...t.length>0?{rules:t}:{}}}function $i(e,t){for(let n of e.rules??[]){if(n.when.kind==="option-present"){let r=t.options[n.when.name];if(r!==void 0&&r!==!1)return n.role;continue}if((n.when.kind==="argument"?t.args[n.when.index]:t.options[n.when.name])===n.when.equals)return n.role}return e.defaultRole}function Fi(e){return[...new Set([e.defaultRole,...(e.rules??[]).map(t=>t.role)])]}function Z(e){return Bt.includes(e)}function Gi(e){return e==="repository-observation"||e==="repository-preview"||e==="composite"}var Ie=1,Oe=1,ee=["compiler-graph","semantic-analysis","repository-source","change-history","runtime-measurement","heuristic","mixed","unknown"],Ut=["complete","partial","unknown"],Ht=["validated","failed","not-evaluated","not-applicable"],Kt=["observe","advise","require-adjudication","block","not-established"],qt={policyId:"scip-query:unresolved-repository-policy",policyVersion:Oe,permission:"not-established",reasons:["No repository action policy was supplied for this claim."]};function Ji(e){return{schemaVersion:Ie,origin:e.contract.origin,coverage:Yt(e.coverage),producerValidation:e.contract.producerValidation,stateAuthority:K(e.receipt,e.receipt),repositoryPolicy:e.repositoryPolicy??qt,...e.contract.families?{families:e.contract.families}:{}}}function Yt(e){return e?e.complete===!0?{state:"complete",returned:e.returned,totalKnown:!0,total:e.total??e.returned,omitted:0}:e.totalKnown?{state:"partial",returned:e.returned,totalKnown:!0,...e.total===void 0?{}:{total:e.total},...e.omitted===void 0?{}:{omitted:e.omitted}}:{state:"unknown",returned:e.returned,totalKnown:!1}:{state:"unknown",returned:0,totalKnown:!1}}function Bi(e,t){let n=[];return $(n,"origin",t.origins,e.origin),$(n,"coverage",t.coverage,e.coverage.state),$(n,"producer-validation",t.producerValidation,e.producerValidation.status),$(n,"state-authority",t.stateAuthority,e.stateAuthority.authority),$(n,"action-permission",t.actionPermission,e.repositoryPolicy.permission),{satisfied:n.every(i=>i.satisfied),predicates:n}}function $(e,t,n,i){n&&e.push({predicate:t,satisfied:n.includes(i),required:n,actual:i})}function xe(e){return!p(e)||e.schemaVersion!==Ie||!A(e.origin,ee)||!Ui(e.coverage)||!Hi(e.producerValidation)||!Ki(e.stateAuthority)||!qi(e.repositoryPolicy)?!1:e.families===void 0||Yi(e.families)}function Ui(e){return!p(e)||!A(e.state,Ut)||!w(e.returned)||typeof e.totalKnown!="boolean"||e.total!==void 0&&!w(e.total)||e.omitted!==void 0&&!w(e.omitted)?!1:e.state==="complete"?e.totalKnown===!0&&e.total===e.returned&&e.omitted===0:e.state==="partial"?e.totalKnown===!0&&w(e.total)&&w(e.omitted)&&e.total===Number(e.returned)+Number(e.omitted):e.totalKnown===!1}function Hi(e){if(!p(e)||!A(e.status,Ht))return!1;let t=e.certification;return e.status==="validated"||e.status==="failed"?p(t)&&g(t.id)&&Number.isSafeInteger(t.version)&&Number(t.version)>0&&g(t.corpus):t===void 0}function Ki(e){return p(e)&&Number.isSafeInteger(e.policyVersion)&&(e.authority==="completion"||e.authority==="advisory"||e.authority==="none")&&Array.isArray(e.requiredRelationships)&&e.requiredRelationships.every(g)&&Array.isArray(e.reasons)&&e.reasons.every(g)}function qi(e){return p(e)&&g(e.policyId)&&e.policyVersion===Oe&&A(e.permission,Kt)&&Array.isArray(e.reasons)&&e.reasons.every(g)}function Yi(e){return Array.isArray(e)&&e.every(t=>p(t)&&g(t.id)&&g(t.selector)&&Qi(t.origin))}function Qi(e){return p(e)?e.kind==="fixed"?A(e.origin,ee)&&e.origin!=="mixed":e.kind!=="result-field"||!g(e.field)||!p(e.values)?!1:Object.values(e.values).every(t=>A(t,ee)&&t!=="mixed"):!1}function A(e,t){return typeof e=="string"&&t.includes(e)}var zt="scip-query-result",Zt=0,N=1,Xi=1,en=1,tn=1;function nn(e){if(!p(e))return{kind:"malformed",reason:"CLI JSON output must be an object."};let t=Object.hasOwn(e,"kind"),n=Object.hasOwn(e,"schemaVersion");if(!t&&!n){let s=Qt(e);return s?{kind:"malformed",reason:`Legacy CLI JSON envelope: ${s}`}:{kind:"legacy",schemaVersion:Zt,envelope:e}}if(!t||!n)return{kind:"malformed",reason:"CLI JSON envelope must contain both kind and schemaVersion."};if(e.kind!==zt)return{kind:"malformed",reason:`Unsupported CLI JSON envelope kind: ${tr(e.kind)}.`};let i=e.schemaVersion;if(!Number.isSafeInteger(i)||Number(i)<1)return{kind:"malformed",reason:"CLI JSON envelope schemaVersion must be a positive safe integer."};if(i!==N)return{kind:"unsupported",schemaVersion:Number(i),direction:Number(i)<N?"older":"future",...Xt(e.producer)?{producer:e.producer}:{}};let r=Qt(e);if(r)return{kind:"malformed",reason:`CLI JSON envelope v1: ${r}`};if(!Xt(e.producer))return{kind:"malformed",reason:"CLI JSON envelope v1: producer must identify scip-query and its non-empty version."};if(!j(e.resultSchemaVersion))return{kind:"malformed",reason:"CLI JSON envelope v1: resultSchemaVersion must be a positive safe integer."};if(e.resultProjection!==void 0&&e.resultProjection!=="agent")return{kind:"malformed",reason:'CLI JSON envelope v1: resultProjection must be "agent" when present.'};let o=rn(e.command);return o.includes(e.resultSchemaVersion)?e.evidenceContext!==void 0&&!er(e.evidenceContext)?{kind:"malformed",reason:"CLI JSON envelope v1: evidenceContext must contain a supported receipt and analysis manifest."}:e.operationRole!==void 0&&!Z(e.operationRole)?{kind:"malformed",reason:"CLI JSON envelope v1: operationRole must be a supported command operation role."}:p(e.evidenceContext)&&e.operationRole!==void 0&&e.evidenceContext.operationRole!==void 0&&e.operationRole!==e.evidenceContext.operationRole?{kind:"malformed",reason:"CLI JSON envelope v1: top-level and evidence-context operation roles must agree."}:{kind:"supported",schemaVersion:N,envelope:e}:{kind:"unsupported-result",schemaVersion:N,command:e.command,resultSchemaVersion:e.resultSchemaVersion,supportedResultSchemaVersions:o}}function zi(e){let t=nn(e);if(t.kind==="legacy"||t.kind==="supported")return t;if(t.kind==="unsupported"){let n=t.producer?` from ${t.producer.name}@${t.producer.version}`:"";throw new Error(`Unsupported scip-query CLI JSON schemaVersion ${t.schemaVersion}${n}; this consumer supports the legacy unversioned envelope and schemaVersion ${N}.`)}throw t.kind==="unsupported-result"?new Error(`Unsupported resultSchemaVersion ${t.resultSchemaVersion} for scip-query command ${JSON.stringify(t.command)}; this consumer supports ${t.supportedResultSchemaVersions.join(", ")}.`):new Error(`Malformed scip-query CLI JSON envelope: ${t.reason}`)}function rn(e){return Zi[e]??[Xi]}var Zi={};function Qt(e){return typeof e.command!="string"||e.command.length===0?"command must be a non-empty string.":Array.isArray(e.args)?p(e.options)?Object.hasOwn(e,"result")?null:"result is required.":"options must be an object.":"args must be an array."}function Xt(e){return p(e)&&e.name==="scip-query"&&typeof e.version=="string"&&e.version.length>0}function er(e){if(!p(e)||e.schemaVersion!==en||e.operationRole!==void 0&&!Z(e.operationRole)||!H(e.receipt))return!1;let t=e.analysisManifest;return p(t)&&t.schemaVersion===tn&&(t.evidence===void 0||t.evidence==="graph-fact"||t.evidence==="heuristic"||t.evidence==="mixed")&&(t.claimQualification===void 0||xe(t.claimQualification))}function tr(e){return typeof e=="string"?JSON.stringify(e):String(e)}export{Kt as CLAIM_ACTION_PERMISSIONS,Oe as CLAIM_ACTION_POLICY_VERSION,Ut as CLAIM_COVERAGE_STATES,ee as CLAIM_ORIGINS,Ie as CLAIM_QUALIFICATION_SCHEMA_VERSION,tn as CLI_ANALYSIS_MANIFEST_SCHEMA_VERSION,en as CLI_EVIDENCE_CONTEXT_SCHEMA_VERSION,zt as CLI_JSON_ENVELOPE_KIND,Bt as COMMAND_OPERATION_ROLES,N as CURRENT_CLI_JSON_ENVELOPE_SCHEMA_VERSION,qt as DEFAULT_REPOSITORY_POLICY_ACTION,Zt as LEGACY_CLI_JSON_ENVELOPE_SCHEMA_VERSION,f as LEGACY_OBSERVATION_RECEIPT_SCHEMA_VERSION,D as OBSERVATION_IDENTITY_CANONICALIZATION_VERSION,V as OBSERVATION_IDENTITY_HASH_ALGORITHM,U as OBSERVATION_IDENTITY_SCHEMA_VERSION,I as OBSERVATION_RECEIPT_SCHEMA_VERSION,ae as OBSERVATION_STATE_AUTHORITY_POLICY_VERSION,Ht as PRODUCER_VALIDATION_STATUSES,ge as Watcher,Wi as commandOperation,Fi as commandOperationRoles,de as compareObservationReceipts,tt as createObservationIdentity,Lt as createReindexRunner,nn as decodeCliJsonEnvelope,ce as decodeObservationReceipt,Yt as deriveClaimCoverage,Ji as deriveClaimQualification,K as deriveObservationStateAuthority,Bi as evaluateClaimQualification,an as getScipVersion,Wn as initProjectConfig,Mi as installSkills,xe as isClaimQualificationV1,Z as isCommandOperationRole,H as isObservationReceipt,sn as isScipInstalled,Q as loadProjectConfig,nt as observationReceiptGenerationIdentity,rt as observationReceiptStabilityLabel,it as observationReceiptWorkspaceIdentity,Gi as operationObservesRepository,cn as printScipInstallInstructions,zi as requireCompatibleCliJsonEnvelope,$i as resolveCommandOperationRole,J as resolveIndexStoragePaths,Vt as resolveReindexWorkerLaunch,rn as supportedCliResultSchemaVersions};
|
|
4
5
|
//# sourceMappingURL=runtime.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-P5XHIJHI.js";import{c as ie}from"./chunk-SMNXQT5Z.js";import"./chunk-IZYYAFN5.js";import{A as ee,B as ne,C as te,D as re,F as se,a as E,c as z,d as M,e as B,f as Y,l as q,n as J,r as Q,s as X,t as x,u as T,v as U,w as G,x as L,y as Z}from"./chunk-AIE7TFJW.js";import{a as $,g as H}from"./chunk-HGFDYOVB.js";import{a as D,d as k}from"./chunk-MNE7YG56.js";import{b as P,g as N}from"./chunk-46XGSFNI.js";import m from"process";import{randomUUID as Fe}from"crypto";import{rmSync as Ke}from"fs";import{resolve as _}from"path";import{pathToFileURL as je}from"url";import{spawn as Ee}from"child_process";import{createHash as we,randomUUID as ke}from"crypto";import{existsSync as Ae,realpathSync as Sn,rmSync as In}from"fs";import{tmpdir as Mn}from"os";import{resolve as hn}from"path";import{createHash as Se}from"crypto";import{resolve as Ie}from"path";var y=3;function v(e){return Se("sha256").update(x({kind:"scip-query-durable-rust-mailbox",protocolVersion:y,sessionDir:Ie(e)})).digest("hex")}function F(e,n){if(!E(e)||typeof e.id!="string"||!e.id)return A("Durable Rust semantic helper received an invalid mailbox request.");if(e.id!==n.claimRequestId)return A("Durable Rust semantic request identity does not match its mailbox path.");if(e.protocolVersion===void 0){if(e.mailboxVersion!==void 0||e.operationKey!==void 0||e.clientId!==void 0||e.enqueuedAtMs!==void 0||e.deadlineAtMs!==void 0||e.sessionIdentity!==void 0)return A("Durable Rust semantic helper received a partially versioned request without a protocol version.");let o=oe(e.request);if(!o)return A("Durable Rust semantic helper received an invalid legacy request kind or payload.");let c=n.nowMs+Math.max(1,o.timeoutMs);return{ok:!0,compatibility:"legacy-v2",value:{mailboxVersion:T,protocolVersion:y,id:e.id,operationKey:L("rust-semantic-v2",{id:e.id,request:o}),clientId:"legacy-v2",enqueuedAtMs:n.nowMs,deadlineAtMs:c,sessionIdentity:n.sessionIdentity,request:o}}}let t=ge(e,n);if(!t.ok)return t;if(e.protocolVersion!==y)return{ok:!1,code:"unsupported-protocol",error:`Durable Rust semantic helper does not support mailbox protocol ${String(e.protocolVersion)}.`,responseIdentity:t.responseIdentity};let l=oe(e.request);return l?t.operationKey!==L("rust-semantic-v3",l)?{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received a mismatched mailbox operation identity.",responseIdentity:t.responseIdentity}:t.deadlineAtMs-t.enqueuedAtMs!==l.timeoutMs?{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received a deadline that does not match the request timeout.",responseIdentity:t.responseIdentity}:t.deadlineAtMs<n.nowMs?{ok:!1,code:"expired-request",error:"Durable Rust semantic request expired before processing.",responseIdentity:t.responseIdentity}:{ok:!0,compatibility:t.priorSessionIdentity?"prior-v3":"current-v3",value:{mailboxVersion:T,protocolVersion:y,id:e.id,operationKey:t.operationKey,clientId:t.clientId,enqueuedAtMs:t.enqueuedAtMs,deadlineAtMs:t.deadlineAtMs,sessionIdentity:n.sessionIdentity,request:l}}:{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received an invalid request kind or payload.",responseIdentity:t.responseIdentity}}function ge(e,n){if(e.mailboxVersion!==T||typeof e.protocolVersion!="number"||!Number.isInteger(e.protocolVersion)||typeof e.operationKey!="string"||!ae(e.operationKey)||e.id!==Z(e.operationKey)||typeof e.clientId!="string"||!e.clientId||typeof e.enqueuedAtMs!="number"||!Number.isFinite(e.enqueuedAtMs)||typeof e.deadlineAtMs!="number"||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs||e.sessionIdentity!==void 0&&(typeof e.sessionIdentity!="string"||!ae(e.sessionIdentity))||e.sessionIdentity===void 0&&e.protocolVersion!==y)return A("Durable Rust semantic helper received an invalid mailbox lifecycle.");let t={id:n.claimRequestId,sessionIdentity:n.sessionIdentity,deadlineAtMs:e.deadlineAtMs};return e.sessionIdentity!==void 0&&e.sessionIdentity!==n.sessionIdentity?{ok:!1,code:"malformed-request",error:"Durable Rust semantic request belongs to a different mailbox session.",responseIdentity:t}:{ok:!0,responseIdentity:t,operationKey:e.operationKey,clientId:e.clientId,enqueuedAtMs:e.enqueuedAtMs,deadlineAtMs:e.deadlineAtMs,priorSessionIdentity:e.sessionIdentity===void 0}}function oe(e){return!E(e)||typeof e.identityKey!="string"||!e.identityKey||!B(e.timeoutMs)||e.workerEnvironment!==void 0&&!z(e.workerEnvironment)?null:e.kind==="semantic"&&Me(e.request)?{kind:"semantic",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:e.kind==="import-definitions"&&De(e.request)?{kind:"import-definitions",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:null}function Me(e){return!E(e)||!w(e.projectRoot)||!w(e.rustAnalyzerBinary)||!le(e.definitions)?!1:O(e.referenceDefinitions)&&O(e.calleeDefinitions)&&O(e.signatureDefinitions)&&I(e.requestTimeoutMs)&&I(e.readinessDeadlineMs)&&I(e.referenceRetryTimeoutMs)&&I(e.diagnosticsTimeoutMs)&&I(e.settleDelayMs)&&de(e.concurrency)&&W(e.includeReferences)&&W(e.includeCallees)&&W(e.includeSignatures)}function De(e){return!E(e)||!w(e.projectRoot)||!w(e.rustAnalyzerBinary)||!w(e.file)||!Array.isArray(e.positions)||!e.positions.every(n=>E(n)&&w(n.id)&&w(n.file)&&M(n.line)&&M(n.column))?!1:I(e.requestTimeoutMs)&&I(e.readinessDeadlineMs)&&I(e.diagnosticsTimeoutMs)&&I(e.settleDelayMs)&&de(e.concurrency)}function le(e){return Array.isArray(e)&&e.every(he)}function O(e){return e===void 0||le(e)}function he(e){return E(e)&&M(e.symbolId)&&M(e.documentId)&&M(e.startLine)&&ue(e.startChar)&&M(e.endLine)&&ue(e.endChar)&&typeof e.symbol=="string"&&typeof e.relativePath=="string"&&typeof e.leaf=="string"&&(e.parentTypeName===null||typeof e.parentTypeName=="string")&&typeof e.isFunctionLike=="boolean"&&typeof e.isTypeLike=="boolean"&&(e.kind===null||Number.isSafeInteger(e.kind))&&(e.documentation===null||typeof e.documentation=="string")&&(e.enclosingSymbol===null||typeof e.enclosingSymbol=="string")}function A(e){return{ok:!1,code:"malformed-request",error:e}}function ae(e){return/^[a-f0-9]{64}$/.test(e)}function w(e){return typeof e=="string"&&e.length>0}function de(e){return e===void 0||B(e)}function ue(e){return e===void 0||M(e)}function I(e){return e===void 0||Y(e)}function W(e){return e===void 0||typeof e=="boolean"}var C=class{constructor(n,t=xe){this.createRequester=n;this.applyEnvironment=t}createRequester;applyEnvironment;requester=null;identityKey=null;semanticResponseCache=null;handle(n){this.applyEnvironment(n.workerEnvironment??{});let t;if(this.requester?this.identityKey!==n.identityKey?(this.semanticResponseCache=null,this.requester.shutdown(),this.requester=this.createRequester(),this.identityKey=n.identityKey,t="invalidated"):t="reused":(this.requester=this.createRequester(),this.identityKey=n.identityKey,t="created"),n.kind==="semantic"){let l=_e(n.request),o=t==="reused"&&l!==null&&this.semanticResponseCache?.identityKey===n.identityKey&&this.semanticResponseCache.requestKey===l?this.semanticResponseCache.response:null;if(o)return ce(!0,n.request.definitions.length),{session:t,response:o};let c=this.requester.requestSemantic(n.request,n.timeoutMs);return l!==null&&qe(c)&&(this.semanticResponseCache={identityKey:n.identityKey,requestKey:l,response:c}),ce(!1,n.request.definitions.length),{session:t,response:c}}return{session:t,response:this.requester.requestImportDefinitions(n.request,n.timeoutMs)}}shutdown(){this.requester?.shutdown(),this.requester=null,this.identityKey=null,this.semanticResponseCache=null}};function _e(e){if(e.includeReferences===!1||e.includeCallees!==!0||e.includeSignatures===!0||(e.referenceDefinitions?.length??0)===0||(e.calleeDefinitions?.length??0)===0)return null;let{readinessDeadlineMs:n,...t}=e;return Ce(x(t))}function qe(e){return e.available&&Array.isArray(e.callees)&&(e.incompleteReferenceSymbolIds?.length??0)===0}function ce(e,n){$()&&H({type:"span",name:"rust.semantic.durable-session.response-cache",durationMs:0,ok:!0,hit:e,definitions:n})}function xe(e){for(let n of Object.keys(process.env))ve(n)&&delete process.env[n];for(let[n,t]of Object.entries(e))t!==null&&(process.env[n]=t)}function Te(e){return e==="HOME"||e==="PATH"||e.startsWith("CARGO_")||e.startsWith("RA_")||e.startsWith("RUST")}function ve(e){return Te(e)||e.startsWith("SCIP_RUST_")||e==="SCIP_QUERY_PROFILE"||e==="SCIP_QUERY_PROFILE_CACHE_STATE"||e==="SCIP_QUERY_PROFILE_COMMAND"||e==="SCIP_QUERY_PROFILE_OUT"||e==="SCIP_QUERY_PROFILE_RUN_ID"||e==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY"||e==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND"||e==="SCIP_QUERY_PROFILE_MIN_MS"}var qn={now:Date.now,monotonicNow:D,randomId:ke,isProcessAlive:q,readProcessIdentity:k,spawnServer(e,n,t){if(!Ae(e))throw new Error(`Durable Rust semantic session helper was not found at ${e}. Run npm run build first.`);Ee(process.execPath,[e,n,t],{detached:!0,stdio:"ignore"}).unref()},sleep(e){let n=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(n,0,0,e)}};function Ce(e){return we("sha256").update(e).digest("hex")}import{existsSync as Pe,mkdtempSync as pe,rmSync as K}from"fs";import{tmpdir as Re}from"os";import{join as j}from"path";import{fileURLToPath as fe,pathToFileURL as Ne}from"url";import{SHARE_ENV as Be,Worker as Ue}from"worker_threads";function me(e={}){let n=null,t=null,l=1,o=!1,c=null,g=null,h=r=>{r&&K(r,{recursive:!0,force:!0})},b=()=>{if(c)return;let r=n,a=t;n=null,t=null;let d=r?r.terminate():Promise.resolve(0);c=Promise.allSettled([d,ie(a,{gracefulMs:1e3,forceMs:1e3})]).then(([u,s])=>{let S=(s.status==="fulfilled"?s.value:[{reaped:!1,detail:String(s.reason)}]).filter(R=>!R.reaped);if(u.status==="rejected"||S.length>0){g=new Error(`Rust semantic worker cleanup did not complete; ownership evidence remains at ${a??"unknown"}.`);return}h(a)}).finally(()=>{c=null})},f=()=>{if(n)return n;if(c)throw new Error("The previous Rust semantic session worker is still terminating; retry the request.");if(g)throw g;let r=e.semanticWorkerPath?Ne(e.semanticWorkerPath):We();if(!Pe(fe(r)))throw new Error(`Rust semantic session worker was not found at ${fe(r)}. Run npm run build before using built semantic Rust queries.`);return t=pe(j(Re(),"scip-query-rust-session-")),n=new Ue(r,e.shareEnvironment?{env:Be}:void 0),n.unref(),n},i=()=>{let r=t??pe(j(Re(),"scip-query-rust-session-"));return t=r,j(r,`${l++}.json`)};return{requestSemantic(r,a){if(o)throw new Error("Rust semantic session was already disposed.");let d=f(),u=i(),s=new SharedArrayBuffer(4),p=new Int32Array(s);if(d.postMessage({kind:"semantic",request:r,responsePath:u,sharedBuffer:s}),Atomics.wait(p,0,0,a)==="timed-out")throw b(),new Error(`Rust semantic session worker timed out after ${(a/1e3).toFixed(0)}s`);try{let R=Le(N(u,{maxBytes:P,inputKind:"Rust semantic worker response"}));if(!R.ok)throw new Error(R.error);return R.response}finally{K(u,{force:!0})}},requestImportDefinitions(r,a){if(o)throw new Error("Rust semantic session was already disposed.");let d=f(),u=i(),s=new SharedArrayBuffer(4),p=new Int32Array(s);if(d.postMessage({kind:"import-definitions",request:r,responsePath:u,sharedBuffer:s}),Atomics.wait(p,0,0,a)==="timed-out")throw b(),new Error(`Rust semantic import-definition session worker timed out after ${(a/1e3).toFixed(0)}s`);try{let R=Oe(N(u,{maxBytes:P,inputKind:"Rust import-definition worker response"}));if(!R.ok)throw new Error(R.error);return R.response}finally{K(u,{force:!0})}},shutdown(){if(o)return;if(o=!0,!n){h(t),t=null;return}let r=i(),a=new SharedArrayBuffer(4),d=new Int32Array(a);n.postMessage({kind:"shutdown",responsePath:r,sharedBuffer:a}),Atomics.wait(d,0,0,5e3),b()}}}function Le(e){let n=JSON.parse(e);if(!n||typeof n!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=n;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof n.error=="string"?n.error:"Rust semantic session worker failed."}}function Oe(e){let n=JSON.parse(e);if(!n||typeof n!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=n;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof n.error=="string"?n.error:"Rust semantic session worker failed."}}function We(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}var Ve=10*6e4,ye=10,ze=250,Ye=1e3;function $e(e,n,t={}){let l=U(e),o=t.now??(t.nowMs===void 0?Date.now:()=>t.nowMs),c=o(),g=v(e),h=ee(l,{ownerId:t.ownerId??tn,nowMs:c,limits:t.limits,owner:rn,liveness:sn}),b=0;for(let f of h){let i=null,r,a="handler-error";try{let d=ne(f,t.limits),u;try{u=JSON.parse(d)}catch{throw a="malformed-request",new Error("Durable Rust semantic helper received malformed request JSON.")}let s=F(u,{claimRequestId:f.requestId,sessionIdentity:g,nowMs:o()});if(!s.ok)throw a=s.code,r=s.responseIdentity,new Error(s.error);i=s.value,r={id:i.id,sessionIdentity:i.sessionIdentity,deadlineAtMs:i.deadlineAtMs};let p=He(i.request,t.monotonicNowMs??D());t.beforeRequest?.(p);let S=n.handle(p),R=o();if(i.deadlineAtMs<R)throw a="expired-request",new Error("Durable Rust semantic request expired while the helper was processing it.");te(l,f,{ok:!0,protocolVersion:y,id:i.id,sessionIdentity:i.sessionIdentity,deadlineAtMs:i.deadlineAtMs,...S},{nowMs:R,limits:t.limits})}catch(d){let u=o(),s=r??(i?{id:i.id,sessionIdentity:i.sessionIdentity,deadlineAtMs:i.deadlineAtMs}:void 0),p=d instanceof Error?d.message:String(d);re(l,f,{ok:!1,protocolVersion:y,id:s?.id??f.requestId,...s?{sessionIdentity:s.sessionIdentity,deadlineAtMs:s.deadlineAtMs}:{},errorCode:a,error:p},p,{nowMs:u,limits:t.limits})}b+=1}return b}function He(e,n){let t=n+Math.max(1,e.timeoutMs-1e3);return{...e,request:{...e.request,readinessDeadlineMs:t}}}async function Je(e,n){let t=U(e);G(t);let l=_(e,"server.lock"),o=Ge(l);if(!o)return;let c=new C(()=>me({semanticWorkerPath:n,shareEnvironment:!0})),g=!1,h=D(),b=Number.NEGATIVE_INFINITY,f,i=0,r=k(m.pid),a=v(e),d=()=>{g=!0};m.once("SIGINT",d),m.once("SIGTERM",d);let u=(s=!1,p=s?"durable":"visibility")=>{let S=Date.now(),R=D();if(!s&&R-b<Ye)return;b=R;let V={protocolVersion:y,sessionIdentity:a,pid:m.pid,...r?{processIdentity:r}:{},heartbeatAtMs:S,...f===void 0?{}:{busyUntilMs:f},mailbox:se(t)};p==="durable"?X(_(e,"server.json"),V):Q(_(e,"server.json"),V)};try{u(!0);let s=Ze();for(;!g&&D()-h<s;){let p=$e(e,c,{beforeRequest(S){f=Date.now()+S.timeoutMs+5e3,u(!0,"visibility")}});p>0?(i=0,h=D(),f=void 0,u(!0,"visibility")):(i+=1,u()),await en(Qe(p,i))}}finally{c.shutdown(),Ke(_(e,"server.json"),{force:!0}),o.release()}}function Qe(e,n=1){if(e>0)return ye;let t=Math.max(0,Math.min(5,n-1));return Math.min(ze,ye*2**t)}var Xe=e=>{let n=Number(e);return Number.isInteger(n)&&n>0?{pid:n}:null};function Ge(e){let n=J(e,{kind:"rust-durable-session-server",parseLegacy:Xe});return n.kind==="acquired"?n.lock:null}function Ze(){let e=Number(m.env.SCIP_RUST_SEMANTIC_DURABLE_IDLE_MS);return Number.isInteger(e)&&e>=0?e:Ve}function en(e){return new Promise(n=>setTimeout(n,e))}var nn=m.argv[1]?je(_(m.argv[1])).href:null;if(nn===import.meta.url){let e=m.argv[2],n=m.argv[3];!e||!n?(console.error("durable-rust-session: expected <session-dir> <semantic-worker-path>"),m.exitCode=1):await Je(e,n)}var tn=`rust-semantic-${m.pid}-${Fe()}`,be=k(m.pid),rn={pid:m.pid,...be?{processIdentity:be}:{}},sn={isProcessAlive:q,readProcessIdentity:k};export{Ge as acquireDurableRustSessionServerLock,Qe as durableSessionLoopDelayMs,$e as processDurableRustSessionRequests};
|
|
1
|
+
import{j as O}from"./chunk-ND3BWIVN.js";import{e as E,f as A,g as C,h as V,m as F}from"./chunk-FLSVYEPL.js";import"./chunk-CTO3TRX7.js";import"./chunk-F4FNK44D.js";import"./chunk-67FK5KGV.js";import"./chunk-DRENNWRG.js";import"./chunk-4SZJF4GK.js";import{b as h}from"./chunk-O4PZFAXA.js";import{a as x,c as q,d as N,i as _,j as T,n as g,o as k,p as P,q as B,s as U}from"./chunk-NQXWWE6S.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import{c as L,d as b,e as v}from"./chunk-Z2KGMIL4.js";import"./chunk-XIPGCT3D.js";import n from"process";import{randomUUID as J}from"crypto";import{rmSync as W}from"fs";import{resolve as S}from"path";import{pathToFileURL as X}from"url";var G=10*6e4,j=10,z=250,Y=1e3;function $(e,t,o={}){let M=_(e),d=o.now??(o.nowMs===void 0?Date.now:()=>o.nowMs),f=d(),y=A(e),w=g(M,{ownerId:o.ownerId??re,nowMs:f,limits:o.limits,owner:ne,liveness:ie}),p=0;for(let i of w){let s=null,c,m="handler-error";try{let a=k(i,o.limits),u;try{u=JSON.parse(a)}catch{throw m="malformed-request",new Error("Durable Rust semantic helper received malformed request JSON.")}let r=C(u,{claimRequestId:i.requestId,sessionIdentity:y,nowMs:d()});if(!r.ok)throw m=r.code,c=r.responseIdentity,new Error(r.error);s=r.value,c={id:s.id,sessionIdentity:s.sessionIdentity,deadlineAtMs:s.deadlineAtMs};let l=K(s.request,o.monotonicNowMs??b());o.beforeRequest?.(l);let R=t.handle(l),I=d();if(s.deadlineAtMs<I)throw m="expired-request",new Error("Durable Rust semantic request expired while the helper was processing it.");P(M,i,{ok:!0,protocolVersion:E,id:s.id,sessionIdentity:s.sessionIdentity,deadlineAtMs:s.deadlineAtMs,...R},{nowMs:I,limits:o.limits})}catch(a){let u=d(),r=c??(s?{id:s.id,sessionIdentity:s.sessionIdentity,deadlineAtMs:s.deadlineAtMs}:void 0),l=a instanceof Error?a.message:String(a);B(M,i,{ok:!1,protocolVersion:E,id:r?.id??i.requestId,...r?{sessionIdentity:r.sessionIdentity,deadlineAtMs:r.deadlineAtMs}:{},errorCode:m,error:l},l,{nowMs:u,limits:o.limits})}p+=1}return p}function K(e,t){let o=t+Math.max(1,e.timeoutMs-1e3);return{...e,request:{...e.request,readinessDeadlineMs:o}}}async function Q(e,t){let o=_(e);T(o);let M=S(e,"server.lock"),d=te(M);if(!d)return;let f=new V(()=>F({semanticWorkerPath:t,shareEnvironment:!0})),y=!1,w=b(),p=Number.NEGATIVE_INFINITY,i,s=0,c=L(n.pid),m=A(e),a=()=>{y=!0};n.once("SIGINT",a),n.once("SIGTERM",a);let u=(r=!1,l=r?"durable":"visibility")=>{let R=Date.now(),I=b();if(!r&&I-p<Y)return;p=I;let D={protocolVersion:E,sessionIdentity:m,pid:n.pid,...c?{processIdentity:c}:{},heartbeatAtMs:R,...i===void 0?{}:{busyUntilMs:i},mailbox:U(o)};l==="durable"?N(S(e,"server.json"),D):q(S(e,"server.json"),D)};try{u(!0);let r=se();for(;!y&&b()-w<r;){let l=$(e,f,{beforeRequest(R){i=Date.now()+R.timeoutMs+5e3,u(!0,"visibility")}});l>0?(s=0,w=b(),i=void 0,u(!0,"visibility")):(s+=1,u()),await O(Z(l,s))}}finally{f.shutdown(),W(S(e,"server.json"),{force:!0}),d.release()}}function Z(e,t=1){return v(e,t,j,j,z,5)}var ee=e=>{let t=Number(e);return Number.isInteger(t)&&t>0?{pid:t}:null};function te(e){let t=h(e,{kind:"rust-durable-session-server",parseLegacy:ee});return t.kind==="acquired"?t.lock:null}function se(){let e=Number(n.env.SCIP_RUST_SEMANTIC_DURABLE_IDLE_MS);return Number.isInteger(e)&&e>=0?e:G}var oe=n.argv[1]?X(S(n.argv[1])).href:null;if(oe===import.meta.url){let e=n.argv[2],t=n.argv[3];!e||!t?(console.error("durable-rust-session: expected <session-dir> <semantic-worker-path>"),n.exitCode=1):await Q(e,t)}var re=`rust-semantic-${n.pid}-${J()}`,H=L(n.pid),ne={pid:n.pid,...H?{processIdentity:H}:{}},ie={isProcessAlive:x,readProcessIdentity:L};export{te as acquireDurableRustSessionServerLock,Z as durableSessionLoopDelayMs,$ as processDurableRustSessionRequests};
|
|
2
2
|
//# sourceMappingURL=rust-semantic-session-server.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A as me,B as pe,C as D,a as te,b as ie,c as C,d as N,e as G,f as E,g as B,h as F,i as se,j as re,k as oe,l as ae,n as H,o as U,p as K,q as W,r as le,u as ce,v as ue,w as de,x as fe,y as S}from"./chunk-DQLPXMH6.js";import{a as P,b as ne}from"./chunk-ILMHV3KM.js";import"./chunk-SMNXQT5Z.js";import"./chunk-IZYYAFN5.js";import{l as q,m as ee}from"./chunk-WUPW3UN3.js";import{a as j,f as d,g as M}from"./chunk-HGFDYOVB.js";import"./chunk-MNE7YG56.js";import"./chunk-46XGSFNI.js";import k from"process";import{existsSync as Te,writeFileSync as ve}from"fs";import{dirname as Ae,isAbsolute as Ie,resolve as Ce}from"path";import{performance as L}from"perf_hooks";import{parentPort as Ee}from"worker_threads";import{resolve as he}from"path";var ze=4,x=class{constructor(n=ze){this.capacity=n;if(!Number.isSafeInteger(n)||n<=0)throw new Error("Rust analyzer session capacity must be a positive safe integer.")}capacity;entries=new Map;get(n){let i=this.entries.get(n);if(i)return this.entries.delete(n),this.entries.set(n,i),i}async acquire(n,i,t){let s=this.get(n);if(s)return s;if(this.entries.size>=this.capacity){let o=this.entries.entries().next().value;if(!o)throw new Error("Rust analyzer session registry capacity accounting is inconsistent.");this.entries.delete(o[0]);try{await t(o[1])}catch(l){throw this.restoreOldest(o),l}}let r=await i();if(r.key!==n){try{await t(r)}catch(o){throw new AggregateError([o],`Rust analyzer session factory returned '${r.key}' for reserved key '${n}', and the mismatched session could not be reaped.`,{cause:o})}throw new Error(`Rust analyzer session factory returned '${r.key}' for reserved key '${n}'.`)}return this.entries.set(n,r),r}deleteIfSame(n){return this.entries.get(n.key)!==n?!1:this.entries.delete(n.key)}async shutdownAll(n){let i=[...this.entries.values()];this.entries.clear();let t=await Promise.allSettled(i.map(n)),s=[];for(let r=0;r<t.length;r+=1){let o=t[r];if(o.status==="fulfilled")continue;let l=i[r];s.push({session:l,reason:o.reason}),this.entries.set(l.key,l)}if(s.length>0)throw new AggregateError(s.map(r=>r.reason),`Failed to shut down ${s.length} retained rust-analyzer session(s).`)}get size(){return this.entries.size}restoreOldest(n){let i=[...this.entries.entries()];this.entries.clear(),this.entries.set(n[0],n[1]);for(let[t,s]of i)this.entries.set(t,s)}};function Re(e,n){let i=he(e);return[...new Set(n.map(t=>he(i,t)))].sort((t,s)=>t<s?-1:t>s?1:0)}function ye(e,n,i){return JSON.stringify({binary:e,sessionRoot:n,linkedProjects:i})}var Fe="SCIP_RUST_SEMANTIC_REFERENCE_TASK_PROFILE_MS",We="SCIP_RUST_SEMANTIC_CALLEE_TASK_PROFILE_MS",_=new x,ge=Promise.resolve(),Me;Ee?.on("message",e=>{ge=ge.then(()=>xe(e)).catch(()=>{})});async function xe(e){if(Me??=Ae(e.responsePath),e.kind==="shutdown"){await He(),g(e.responsePath,{ok:!0},e.sharedBuffer);return}if(e.kind==="import-definitions"){try{let n=await Le(e.request);g(e.responsePath,{ok:!0,response:n},e.sharedBuffer)}catch(n){let i=B(n);if(i){g(e.responsePath,i,e.sharedBuffer);return}let t={available:!1,reason:n instanceof Error?n.message:String(n),sourcePaths:e.request.positions.map(s=>[s.id,null])};g(e.responsePath,{ok:!0,response:t},e.sharedBuffer)}return}try{let n=await _e(e.request);g(e.responsePath,{ok:!0,response:n},e.sharedBuffer)}catch(n){let i=B(n);if(i){g(e.responsePath,i,e.sharedBuffer);return}let t=De(e.request,n instanceof Error?n.message:String(n));g(e.responsePath,{ok:!0,response:t},e.sharedBuffer)}}async function Le(e){let n={timeoutMs:e.requestTimeoutMs,deadlineMs:e.readinessDeadlineMs},i=await d("rust.semantic.worker.session",()=>Pe(e.projectRoot,e.rustAnalyzerBinary,[e.file],{requestTimeoutMs:e.requestTimeoutMs,readinessDeadlineMs:e.readinessDeadlineMs}),()=>({kind:"import-definitions",files:1,positions:e.positions.length}));if(!i.capabilities.definitionProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/definition support.",sourcePaths:e.positions.map(o=>[o.id,null])};let t=0;await E(()=>d("rust.semantic.worker.open-source-documents",async()=>{t=await Ne(i,e.projectRoot,[e.file],{diagnosticsTimeoutMs:e.diagnosticsTimeoutMs,settleDelayMs:e.settleDelayMs,readinessDeadlineMs:e.readinessDeadlineMs})},()=>({files:1,openedDocuments:t,positions:e.positions.length})),()=>ke(_,i,e.readinessDeadlineMs));let s=0;return{available:!0,sourcePaths:await d("rust.semantic.worker.import-definitions",()=>P(e.positions,e.concurrency??8,async o=>{let l=await i.client.definition({textDocument:{uri:F(e.projectRoot,o.file)},position:{line:o.line,character:o.column}},n),u=Ge(e.projectRoot,l);return u&&(s+=1),[o.id,u]}),()=>({positions:e.positions.length,resolvedPositions:s,concurrency:e.concurrency??8}))}}async function _e(e){let n={timeoutMs:e.requestTimeoutMs,deadlineMs:e.readinessDeadlineMs},i=e.includeReferences!==!1,t=e.includeCallees===!0,s=e.includeSignatures===!0,r=H(e),o=U(e),l=K(e),u=W(e),c=await d("rust.semantic.worker.session",()=>Oe(e),()=>({kind:"semantic",definitions:u.length,referenceDefinitions:r.length,calleeDefinitions:o.length,signatureDefinitions:l.length,references:i,callees:t,signatures:s})),p=Be(c.capabilities,{references:i,callees:t,signatures:s});if(p)return De(e,p);let f=0;await E(()=>d("rust.semantic.worker.open-definition-documents",async()=>{f=await je(c,e)},()=>({definitions:u.length,openedDocuments:f})),()=>ke(_,c,e.readinessDeadlineMs));let m=0,b=0,y=j(),$=y?new Map:null,z=y?we(k.env[Fe]):null,J=()=>i?d("rust.semantic.worker.references",()=>P(r,e.concurrency??8,async a=>{let w=y?L.now():0,R=await me(c.client,re(e.projectRoot,a,!1),{requestTimeoutMs:e.requestTimeoutMs,retryTimeoutMs:e.referenceRetryTimeoutMs,deadlineMs:e.readinessDeadlineMs}),h=ae(oe(e.projectRoot,R.locations)),I=y?Math.round(L.now()-w):0;return Ue($,a.relativePath,{durationMs:I,references:h.length,hasReferences:h.length>0,slow:z!==null&&I>=z}),z!==null&&I>=z&&M({type:"span",name:"rust.semantic.worker.reference-task",durationMs:I,ok:!0,symbolId:a.symbolId,relativePath:a.relativePath,leaf:a.leaf,kind:a.kind,startLine:a.startLine,endLine:a.endLine,references:h.length,complete:R.complete}),h.length>0&&(b+=1),m+=h.length,{symbolId:a.symbolId,references:h,complete:R.complete}}),()=>({definitions:r.length,concurrency:e.concurrency??8,definitionsWithReferences:b,references:m})):Promise.resolve(r.map(a=>({symbolId:a.symbolId,references:[],complete:!0}))),V=0,Y=0,T=j(),Z=T?new Map:null,v=T?we(k.env[We]):null,Q=()=>t?d("rust.semantic.worker.callees",()=>P(o,e.concurrency??8,async a=>{let w=T?L.now():0,R=await pe(c.client,e.projectRoot,a,n),h=T?Math.round(L.now()-w):0;return Je(Z,a.relativePath,{durationMs:h,callees:R.length,hasCallees:R.length>0,slow:v!==null&&h>=v}),v!==null&&h>=v&&M({type:"span",name:"rust.semantic.worker.callee-task",durationMs:h,ok:!0,symbolId:a.symbolId,relativePath:a.relativePath,leaf:a.leaf,kind:a.kind,startLine:a.startLine,endLine:a.endLine,callees:R.length}),R.length>0&&(Y+=1),V+=R.length,{symbolId:a.symbolId,callees:R}}),()=>({definitions:o.length,concurrency:e.concurrency??8,definitionsWithCallees:Y,callees:V})):Promise.resolve([]),A,O;i&&t&&r.length>0&&o.length>0&&Ze()?[A,O]=await ne([J(),Q()]):(A=await J(),O=await Q()),Ke($),Ve(Z);let X=0,be=s?await d("rust.semantic.worker.signatures",()=>P(l,e.concurrency??8,async a=>{let w=await le(c.client,e.projectRoot,a,n);return w&&(X+=1),{symbolId:a.symbolId,signature:w}}),()=>({definitions:l.length,concurrency:e.concurrency??8,signaturesFound:X})):[];return{available:!0,references:A.filter(a=>a.complete).map(a=>[a.symbolId,a.references]),incompleteReferenceSymbolIds:A.filter(a=>!a.complete).map(a=>a.symbolId),...t?{callees:O.map(a=>[a.symbolId,a.callees])}:{},...s?{signatures:be.map(a=>[a.symbolId,a.signature])}:{}}}async function Oe(e){return Pe(e.projectRoot,e.rustAnalyzerBinary,W(e).map(n=>n.relativePath),{requestTimeoutMs:e.requestTimeoutMs,readinessDeadlineMs:e.readinessDeadlineMs})}async function Pe(e,n,i,t){let s=Re(e,de(e,i.map(l=>({relativePath:l})))),r=ue(e,s),o=ye(n,r,s);return _.acquire(o,async()=>{let l=ce(s),u=new te(ie(n,r,k.env,Me),{requestTimeoutMs:t.requestTimeoutMs,configuration:l}),c=t.readinessDeadlineMs===void 0?null:{afterGeneration:u.serverStatusGeneration(),deadlineMs:t.readinessDeadlineMs},p=await E(()=>d("rust.semantic.worker.initialize",()=>u.initialize({processId:k.pid,rootUri:F(r,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},definition:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:l},{timeoutMs:t.requestTimeoutMs,deadlineMs:t.readinessDeadlineMs}),()=>({linkedProjects:s.length,relativePaths:i.length})),()=>u.shutdownAndReap({deadlineMs:t.readinessDeadlineMs}));return{key:o,client:u,capabilities:p.capabilities,openedPaths:new Set,initializationReadiness:c}},l=>l.client.shutdownAndReap({deadlineMs:t.readinessDeadlineMs}))}async function je(e,n){let i=W(n).filter(c=>e.openedPaths.has(c.relativePath)?!1:Te(Ce(n.projectRoot,c.relativePath)));if(i.length===0)return await Se(e),0;let t=e.initializationReadiness,s=n.readinessDeadlineMs===void 0?null:{statusSnapshot:t?null:e.client.serverStatusSnapshot(),initializationGeneration:t?.afterGeneration,deadlineMs:n.readinessDeadlineMs},r=fe(e.client,n.projectRoot,i);for(let c of i)e.openedPaths.add(c.relativePath);let o=n.diagnosticsTimeoutMs??1e4,l=o;await d("rust.semantic.worker.diagnostics",()=>s?G(c=>(l=c,S(e.client,r,c)),o,s.deadlineMs):S(e.client,r,o),()=>({openedDocuments:r.length,timeoutMs:l}));let u=n.settleDelayMs??5e3;if(!s)await d("rust.semantic.worker.settle",()=>D(u),()=>({openedDocuments:r.length,settleDelayMs:u}));else{let c;await d("rust.semantic.worker.readiness",async()=>{let p=m=>d("rust.semantic.worker.settle",()=>D(m),()=>({openedDocuments:r.length,settleDelayMs:m})),f=s.initializationGeneration===void 0?await N(e.client,s.statusSnapshot,r.length,s.deadlineMs,u,Date.now,p):await C(e.client,s.initializationGeneration,r.length,s.deadlineMs,u,Date.now,p);s.initializationGeneration!==void 0&&(e.initializationReadiness=null),c=f?.health},()=>({phase:s.initializationGeneration===void 0?"didOpen":"initialize+didOpen",openedDocuments:r.length,health:c}))}return r.length}async function Ne(e,n,i,t){let s=i.filter(f=>!e.openedPaths.has(f));if(s.length===0)return await Se(e),0;let r=e.initializationReadiness,o=t.readinessDeadlineMs===void 0?null:{statusSnapshot:r?null:e.client.serverStatusSnapshot(),initializationGeneration:r?.afterGeneration,deadlineMs:t.readinessDeadlineMs},l=[];for(let f of s)try{let m=F(n,f);e.client.didOpenTextDocument({uri:m,languageId:"rust",version:1,text:q(n,f,{inputKind:"indexed Rust source file"})}),e.openedPaths.add(f),l.push(m)}catch(m){if(!ee(m))throw m}let u=t.diagnosticsTimeoutMs??1e4,c=u;await d("rust.semantic.worker.diagnostics",()=>o?G(f=>(c=f,S(e.client,l,f)),u,o.deadlineMs):S(e.client,l,u),()=>({openedDocuments:l.length,timeoutMs:c}));let p=t.settleDelayMs??5e3;if(!o)await d("rust.semantic.worker.settle",()=>D(p),()=>({openedDocuments:l.length,settleDelayMs:p}));else{let f;await d("rust.semantic.worker.readiness",async()=>{let m=y=>d("rust.semantic.worker.settle",()=>D(y),()=>({openedDocuments:l.length,settleDelayMs:y})),b=o.initializationGeneration===void 0?await N(e.client,o.statusSnapshot,l.length,o.deadlineMs,p,Date.now,m):await C(e.client,o.initializationGeneration,l.length,o.deadlineMs,p,Date.now,m);o.initializationGeneration!==void 0&&(e.initializationReadiness=null),f=b?.health},()=>({phase:o.initializationGeneration===void 0?"didOpen":"initialize+didOpen",openedDocuments:l.length,health:f}))}return l.length}async function Se(e){let n=e.initializationReadiness;if(!n)return;let i;await d("rust.semantic.worker.readiness",async()=>{i=(await C(e.client,n.afterGeneration,0,n.deadlineMs,0)).health,e.initializationReadiness=null},()=>({phase:"initialize",openedDocuments:0,health:i}))}function Ge(e,n){for(let i of n){let t=se(e,i.uri);if(!(!t||t===".."||t.startsWith("../")||Ie(t)))return t}return null}function Be(e,n){return n.references&&!e.referencesProvider?"rust-analyzer initialized without textDocument/references support.":n.callees&&!e.callHierarchyProvider?"rust-analyzer initialized without call hierarchy support.":n.signatures&&!e.hoverProvider?"rust-analyzer initialized without hover support.":null}function De(e,n){let i=H(e),t=U(e),s=K(e);return{available:!1,reason:n,references:i.map(r=>[r.symbolId,[]]),...e.includeCallees?{callees:t.map(r=>[r.symbolId,[]])}:{},...e.includeSignatures?{signatures:s.map(r=>[r.symbolId,null])}:{}}}async function He(){await _.shutdownAll(e=>e.client.shutdownAndReap())}async function ke(e,n,i){e.deleteIfSame(n),await n.client.shutdownAndReap({deadlineMs:i})}function Ue(e,n,i){if(!e)return;let t=$e(e,n);t.definitions+=1,i.hasReferences&&(t.definitionsWithReferences+=1),t.references+=i.references,t.durationMs+=i.durationMs,t.maxDurationMs=Math.max(t.maxDurationMs,i.durationMs),i.slow&&(t.slowTasks+=1)}function Ke(e){if(!e)return;let n=[...e.entries()].sort(([i,t],[s,r])=>r.durationMs-t.durationMs||i.localeCompare(s));for(let[i,t]of n)M({type:"span",name:"rust.semantic.worker.references.by-file",durationMs:t.durationMs,ok:!0,relativePath:i,definitions:t.definitions,definitionsWithReferences:t.definitionsWithReferences,references:t.references,maxDurationMs:t.maxDurationMs,slowTasks:t.slowTasks,aggregate:"sum-task-duration"})}function $e(e,n){let i=e.get(n);if(i)return i;let t={definitions:0,definitionsWithReferences:0,references:0,durationMs:0,maxDurationMs:0,slowTasks:0};return e.set(n,t),t}function Je(e,n,i){if(!e)return;let t=Ye(e,n);t.definitions+=1,i.hasCallees&&(t.definitionsWithCallees+=1),t.callees+=i.callees,t.durationMs+=i.durationMs,t.maxDurationMs=Math.max(t.maxDurationMs,i.durationMs),i.slow&&(t.slowTasks+=1)}function Ve(e){if(!e)return;let n=[...e.entries()].sort(([i,t],[s,r])=>r.durationMs-t.durationMs||i.localeCompare(s));for(let[i,t]of n)M({type:"span",name:"rust.semantic.worker.callees.by-file",durationMs:t.durationMs,ok:!0,relativePath:i,definitions:t.definitions,definitionsWithCallees:t.definitionsWithCallees,callees:t.callees,maxDurationMs:t.maxDurationMs,slowTasks:t.slowTasks,aggregate:"sum-task-duration"})}function Ye(e,n){let i=e.get(n);if(i)return i;let t={definitions:0,definitionsWithCallees:0,callees:0,durationMs:0,maxDurationMs:0,slowTasks:0};return e.set(n,t),t}function we(e){if(e===void 0||e==="")return null;let n=Number(e);return Number.isInteger(n)&&n>=0?n:null}function Ze(){let e=k.env.SCIP_RUST_SEMANTIC_PARALLEL_OPERATIONS;return e!=="0"&&e!=="false"}function g(e,n,i){ve(e,JSON.stringify(n));let t=new Int32Array(i);Atomics.store(t,0,1),Atomics.notify(t,0)}export{ke as discardRustAnalyzerSession};
|
|
1
|
+
import{b as H,c as U,d as K,e as W,f as le,i as ce,j as ue,k as de,l as fe,m as D,o as me,p as pe}from"./chunk-Y2S4YNLH.js";import{a as P,b as ne}from"./chunk-ILMHV3KM.js";import{b as te,c as ie,d as C,e as N,f as G,h as E,i as B,j as S}from"./chunk-ND3BWIVN.js";import{d as F,e as se,f as re,g as oe,h as ae}from"./chunk-67FK5KGV.js";import"./chunk-4SZJF4GK.js";import{a as j,f as d,g as M}from"./chunk-HGFDYOVB.js";import"./chunk-Z2KGMIL4.js";import{ja as q,ka as ee}from"./chunk-XIPGCT3D.js";import k from"process";import{existsSync as Te,writeFileSync as ve}from"fs";import{dirname as Ae,isAbsolute as Ie,resolve as Ce}from"path";import{performance as L}from"perf_hooks";import{parentPort as Ee}from"worker_threads";import{resolve as he}from"path";var ze=4,x=class{constructor(n=ze){this.capacity=n;if(!Number.isSafeInteger(n)||n<=0)throw new Error("Rust analyzer session capacity must be a positive safe integer.")}capacity;entries=new Map;get(n){let i=this.entries.get(n);if(i)return this.entries.delete(n),this.entries.set(n,i),i}async acquire(n,i,t){let s=this.get(n);if(s)return s;if(this.entries.size>=this.capacity){let o=this.entries.entries().next().value;if(!o)throw new Error("Rust analyzer session registry capacity accounting is inconsistent.");this.entries.delete(o[0]);try{await t(o[1])}catch(l){throw this.restoreOldest(o),l}}let r=await i();if(r.key!==n){try{await t(r)}catch(o){throw new AggregateError([o],`Rust analyzer session factory returned '${r.key}' for reserved key '${n}', and the mismatched session could not be reaped.`,{cause:o})}throw new Error(`Rust analyzer session factory returned '${r.key}' for reserved key '${n}'.`)}return this.entries.set(n,r),r}deleteIfSame(n){return this.entries.get(n.key)!==n?!1:this.entries.delete(n.key)}async shutdownAll(n){let i=[...this.entries.values()];this.entries.clear();let t=await Promise.allSettled(i.map(n)),s=[];for(let r=0;r<t.length;r+=1){let o=t[r];if(o.status==="fulfilled")continue;let l=i[r];s.push({session:l,reason:o.reason}),this.entries.set(l.key,l)}if(s.length>0)throw new AggregateError(s.map(r=>r.reason),`Failed to shut down ${s.length} retained rust-analyzer session(s).`)}get size(){return this.entries.size}restoreOldest(n){let i=[...this.entries.entries()];this.entries.clear(),this.entries.set(n[0],n[1]);for(let[t,s]of i)this.entries.set(t,s)}};function Re(e,n){let i=he(e);return[...new Set(n.map(t=>he(i,t)))].sort((t,s)=>t<s?-1:t>s?1:0)}function ye(e,n,i){return JSON.stringify({binary:e,sessionRoot:n,linkedProjects:i})}var Fe="SCIP_RUST_SEMANTIC_REFERENCE_TASK_PROFILE_MS",We="SCIP_RUST_SEMANTIC_CALLEE_TASK_PROFILE_MS",_=new x,ge=Promise.resolve(),Me;Ee?.on("message",e=>{ge=ge.then(()=>xe(e)).catch(()=>{})});async function xe(e){if(Me??=Ae(e.responsePath),e.kind==="shutdown"){await He(),g(e.responsePath,{ok:!0},e.sharedBuffer);return}if(e.kind==="import-definitions"){try{let n=await Le(e.request);g(e.responsePath,{ok:!0,response:n},e.sharedBuffer)}catch(n){let i=B(n);if(i){g(e.responsePath,i,e.sharedBuffer);return}let t={available:!1,reason:n instanceof Error?n.message:String(n),sourcePaths:e.request.positions.map(s=>[s.id,null])};g(e.responsePath,{ok:!0,response:t},e.sharedBuffer)}return}try{let n=await _e(e.request);g(e.responsePath,{ok:!0,response:n},e.sharedBuffer)}catch(n){let i=B(n);if(i){g(e.responsePath,i,e.sharedBuffer);return}let t=De(e.request,n instanceof Error?n.message:String(n));g(e.responsePath,{ok:!0,response:t},e.sharedBuffer)}}async function Le(e){let n={timeoutMs:e.requestTimeoutMs,deadlineMs:e.readinessDeadlineMs},i=await d("rust.semantic.worker.session",()=>Pe(e.projectRoot,e.rustAnalyzerBinary,[e.file],{requestTimeoutMs:e.requestTimeoutMs,readinessDeadlineMs:e.readinessDeadlineMs}),()=>({kind:"import-definitions",files:1,positions:e.positions.length}));if(!i.capabilities.definitionProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/definition support.",sourcePaths:e.positions.map(o=>[o.id,null])};let t=0;await E(()=>d("rust.semantic.worker.open-source-documents",async()=>{t=await Ne(i,e.projectRoot,[e.file],{diagnosticsTimeoutMs:e.diagnosticsTimeoutMs,settleDelayMs:e.settleDelayMs,readinessDeadlineMs:e.readinessDeadlineMs})},()=>({files:1,openedDocuments:t,positions:e.positions.length})),()=>ke(_,i,e.readinessDeadlineMs));let s=0;return{available:!0,sourcePaths:await d("rust.semantic.worker.import-definitions",()=>P(e.positions,e.concurrency??8,async o=>{let l=await i.client.definition({textDocument:{uri:F(e.projectRoot,o.file)},position:{line:o.line,character:o.column}},n),u=Ge(e.projectRoot,l);return u&&(s+=1),[o.id,u]}),()=>({positions:e.positions.length,resolvedPositions:s,concurrency:e.concurrency??8}))}}async function _e(e){let n={timeoutMs:e.requestTimeoutMs,deadlineMs:e.readinessDeadlineMs},i=e.includeReferences!==!1,t=e.includeCallees===!0,s=e.includeSignatures===!0,r=H(e),o=U(e),l=K(e),u=W(e),c=await d("rust.semantic.worker.session",()=>Oe(e),()=>({kind:"semantic",definitions:u.length,referenceDefinitions:r.length,calleeDefinitions:o.length,signatureDefinitions:l.length,references:i,callees:t,signatures:s})),p=Be(c.capabilities,{references:i,callees:t,signatures:s});if(p)return De(e,p);let f=0;await E(()=>d("rust.semantic.worker.open-definition-documents",async()=>{f=await je(c,e)},()=>({definitions:u.length,openedDocuments:f})),()=>ke(_,c,e.readinessDeadlineMs));let m=0,b=0,y=j(),$=y?new Map:null,z=y?we(k.env[Fe]):null,J=()=>i?d("rust.semantic.worker.references",()=>P(r,e.concurrency??8,async a=>{let w=y?L.now():0,R=await me(c.client,re(e.projectRoot,a,!1),{requestTimeoutMs:e.requestTimeoutMs,retryTimeoutMs:e.referenceRetryTimeoutMs,deadlineMs:e.readinessDeadlineMs}),h=ae(oe(e.projectRoot,R.locations)),I=y?Math.round(L.now()-w):0;return Ue($,a.relativePath,{durationMs:I,references:h.length,hasReferences:h.length>0,slow:z!==null&&I>=z}),z!==null&&I>=z&&M({type:"span",name:"rust.semantic.worker.reference-task",durationMs:I,ok:!0,symbolId:a.symbolId,relativePath:a.relativePath,leaf:a.leaf,kind:a.kind,startLine:a.startLine,endLine:a.endLine,references:h.length,complete:R.complete}),h.length>0&&(b+=1),m+=h.length,{symbolId:a.symbolId,references:h,complete:R.complete}}),()=>({definitions:r.length,concurrency:e.concurrency??8,definitionsWithReferences:b,references:m})):Promise.resolve(r.map(a=>({symbolId:a.symbolId,references:[],complete:!0}))),V=0,Y=0,T=j(),Z=T?new Map:null,v=T?we(k.env[We]):null,Q=()=>t?d("rust.semantic.worker.callees",()=>P(o,e.concurrency??8,async a=>{let w=T?L.now():0,R=await pe(c.client,e.projectRoot,a,n),h=T?Math.round(L.now()-w):0;return Je(Z,a.relativePath,{durationMs:h,callees:R.length,hasCallees:R.length>0,slow:v!==null&&h>=v}),v!==null&&h>=v&&M({type:"span",name:"rust.semantic.worker.callee-task",durationMs:h,ok:!0,symbolId:a.symbolId,relativePath:a.relativePath,leaf:a.leaf,kind:a.kind,startLine:a.startLine,endLine:a.endLine,callees:R.length}),R.length>0&&(Y+=1),V+=R.length,{symbolId:a.symbolId,callees:R}}),()=>({definitions:o.length,concurrency:e.concurrency??8,definitionsWithCallees:Y,callees:V})):Promise.resolve([]),A,O;i&&t&&r.length>0&&o.length>0&&Ze()?[A,O]=await ne([J(),Q()]):(A=await J(),O=await Q()),Ke($),Ve(Z);let X=0,be=s?await d("rust.semantic.worker.signatures",()=>P(l,e.concurrency??8,async a=>{let w=await le(c.client,e.projectRoot,a,n);return w&&(X+=1),{symbolId:a.symbolId,signature:w}}),()=>({definitions:l.length,concurrency:e.concurrency??8,signaturesFound:X})):[];return{available:!0,references:A.filter(a=>a.complete).map(a=>[a.symbolId,a.references]),incompleteReferenceSymbolIds:A.filter(a=>!a.complete).map(a=>a.symbolId),...t?{callees:O.map(a=>[a.symbolId,a.callees])}:{},...s?{signatures:be.map(a=>[a.symbolId,a.signature])}:{}}}async function Oe(e){return Pe(e.projectRoot,e.rustAnalyzerBinary,W(e).map(n=>n.relativePath),{requestTimeoutMs:e.requestTimeoutMs,readinessDeadlineMs:e.readinessDeadlineMs})}async function Pe(e,n,i,t){let s=Re(e,de(e,i.map(l=>({relativePath:l})))),r=ue(e,s),o=ye(n,r,s);return _.acquire(o,async()=>{let l=ce(s),u=new te(ie(n,r,k.env,Me),{requestTimeoutMs:t.requestTimeoutMs,configuration:l}),c=t.readinessDeadlineMs===void 0?null:{afterGeneration:u.serverStatusGeneration(),deadlineMs:t.readinessDeadlineMs},p=await E(()=>d("rust.semantic.worker.initialize",()=>u.initialize({processId:k.pid,rootUri:F(r,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},definition:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:l},{timeoutMs:t.requestTimeoutMs,deadlineMs:t.readinessDeadlineMs}),()=>({linkedProjects:s.length,relativePaths:i.length})),()=>u.shutdownAndReap({deadlineMs:t.readinessDeadlineMs}));return{key:o,client:u,capabilities:p.capabilities,openedPaths:new Set,initializationReadiness:c}},l=>l.client.shutdownAndReap({deadlineMs:t.readinessDeadlineMs}))}async function je(e,n){let i=W(n).filter(c=>e.openedPaths.has(c.relativePath)?!1:Te(Ce(n.projectRoot,c.relativePath)));if(i.length===0)return await Se(e),0;let t=e.initializationReadiness,s=n.readinessDeadlineMs===void 0?null:{statusSnapshot:t?null:e.client.serverStatusSnapshot(),initializationGeneration:t?.afterGeneration,deadlineMs:n.readinessDeadlineMs},r=fe(e.client,n.projectRoot,i);for(let c of i)e.openedPaths.add(c.relativePath);let o=n.diagnosticsTimeoutMs??1e4,l=o;await d("rust.semantic.worker.diagnostics",()=>s?G(c=>(l=c,D(e.client,r,c)),o,s.deadlineMs):D(e.client,r,o),()=>({openedDocuments:r.length,timeoutMs:l}));let u=n.settleDelayMs??5e3;if(!s)await d("rust.semantic.worker.settle",()=>S(u),()=>({openedDocuments:r.length,settleDelayMs:u}));else{let c;await d("rust.semantic.worker.readiness",async()=>{let p=m=>d("rust.semantic.worker.settle",()=>S(m),()=>({openedDocuments:r.length,settleDelayMs:m})),f=s.initializationGeneration===void 0?await N(e.client,s.statusSnapshot,r.length,s.deadlineMs,u,Date.now,p):await C(e.client,s.initializationGeneration,r.length,s.deadlineMs,u,Date.now,p);s.initializationGeneration!==void 0&&(e.initializationReadiness=null),c=f?.health},()=>({phase:s.initializationGeneration===void 0?"didOpen":"initialize+didOpen",openedDocuments:r.length,health:c}))}return r.length}async function Ne(e,n,i,t){let s=i.filter(f=>!e.openedPaths.has(f));if(s.length===0)return await Se(e),0;let r=e.initializationReadiness,o=t.readinessDeadlineMs===void 0?null:{statusSnapshot:r?null:e.client.serverStatusSnapshot(),initializationGeneration:r?.afterGeneration,deadlineMs:t.readinessDeadlineMs},l=[];for(let f of s)try{let m=F(n,f);e.client.didOpenTextDocument({uri:m,languageId:"rust",version:1,text:q(n,f,{inputKind:"indexed Rust source file"})}),e.openedPaths.add(f),l.push(m)}catch(m){if(!ee(m))throw m}let u=t.diagnosticsTimeoutMs??1e4,c=u;await d("rust.semantic.worker.diagnostics",()=>o?G(f=>(c=f,D(e.client,l,f)),u,o.deadlineMs):D(e.client,l,u),()=>({openedDocuments:l.length,timeoutMs:c}));let p=t.settleDelayMs??5e3;if(!o)await d("rust.semantic.worker.settle",()=>S(p),()=>({openedDocuments:l.length,settleDelayMs:p}));else{let f;await d("rust.semantic.worker.readiness",async()=>{let m=y=>d("rust.semantic.worker.settle",()=>S(y),()=>({openedDocuments:l.length,settleDelayMs:y})),b=o.initializationGeneration===void 0?await N(e.client,o.statusSnapshot,l.length,o.deadlineMs,p,Date.now,m):await C(e.client,o.initializationGeneration,l.length,o.deadlineMs,p,Date.now,m);o.initializationGeneration!==void 0&&(e.initializationReadiness=null),f=b?.health},()=>({phase:o.initializationGeneration===void 0?"didOpen":"initialize+didOpen",openedDocuments:l.length,health:f}))}return l.length}async function Se(e){let n=e.initializationReadiness;if(!n)return;let i;await d("rust.semantic.worker.readiness",async()=>{i=(await C(e.client,n.afterGeneration,0,n.deadlineMs,0)).health,e.initializationReadiness=null},()=>({phase:"initialize",openedDocuments:0,health:i}))}function Ge(e,n){for(let i of n){let t=se(e,i.uri);if(!(!t||t===".."||t.startsWith("../")||Ie(t)))return t}return null}function Be(e,n){return n.references&&!e.referencesProvider?"rust-analyzer initialized without textDocument/references support.":n.callees&&!e.callHierarchyProvider?"rust-analyzer initialized without call hierarchy support.":n.signatures&&!e.hoverProvider?"rust-analyzer initialized without hover support.":null}function De(e,n){let i=H(e),t=U(e),s=K(e);return{available:!1,reason:n,references:i.map(r=>[r.symbolId,[]]),...e.includeCallees?{callees:t.map(r=>[r.symbolId,[]])}:{},...e.includeSignatures?{signatures:s.map(r=>[r.symbolId,null])}:{}}}async function He(){await _.shutdownAll(e=>e.client.shutdownAndReap())}async function ke(e,n,i){e.deleteIfSame(n),await n.client.shutdownAndReap({deadlineMs:i})}function Ue(e,n,i){if(!e)return;let t=$e(e,n);t.definitions+=1,i.hasReferences&&(t.definitionsWithReferences+=1),t.references+=i.references,t.durationMs+=i.durationMs,t.maxDurationMs=Math.max(t.maxDurationMs,i.durationMs),i.slow&&(t.slowTasks+=1)}function Ke(e){if(!e)return;let n=[...e.entries()].sort(([i,t],[s,r])=>r.durationMs-t.durationMs||i.localeCompare(s));for(let[i,t]of n)M({type:"span",name:"rust.semantic.worker.references.by-file",durationMs:t.durationMs,ok:!0,relativePath:i,definitions:t.definitions,definitionsWithReferences:t.definitionsWithReferences,references:t.references,maxDurationMs:t.maxDurationMs,slowTasks:t.slowTasks,aggregate:"sum-task-duration"})}function $e(e,n){let i=e.get(n);if(i)return i;let t={definitions:0,definitionsWithReferences:0,references:0,durationMs:0,maxDurationMs:0,slowTasks:0};return e.set(n,t),t}function Je(e,n,i){if(!e)return;let t=Ye(e,n);t.definitions+=1,i.hasCallees&&(t.definitionsWithCallees+=1),t.callees+=i.callees,t.durationMs+=i.durationMs,t.maxDurationMs=Math.max(t.maxDurationMs,i.durationMs),i.slow&&(t.slowTasks+=1)}function Ve(e){if(!e)return;let n=[...e.entries()].sort(([i,t],[s,r])=>r.durationMs-t.durationMs||i.localeCompare(s));for(let[i,t]of n)M({type:"span",name:"rust.semantic.worker.callees.by-file",durationMs:t.durationMs,ok:!0,relativePath:i,definitions:t.definitions,definitionsWithCallees:t.definitionsWithCallees,callees:t.callees,maxDurationMs:t.maxDurationMs,slowTasks:t.slowTasks,aggregate:"sum-task-duration"})}function Ye(e,n){let i=e.get(n);if(i)return i;let t={definitions:0,definitionsWithCallees:0,callees:0,durationMs:0,maxDurationMs:0,slowTasks:0};return e.set(n,t),t}function we(e){if(e===void 0||e==="")return null;let n=Number(e);return Number.isInteger(n)&&n>=0?n:null}function Ze(){let e=k.env.SCIP_RUST_SEMANTIC_PARALLEL_OPERATIONS;return e!=="0"&&e!=="false"}function g(e,n,i){ve(e,JSON.stringify(n));let t=new Int32Array(i);Atomics.store(t,0,1),Atomics.notify(t,0)}export{ke as discardRustAnalyzerSession};
|
|
2
2
|
//# sourceMappingURL=rust-semantic-session-worker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q}from"./chunk-Y2S4YNLH.js";import{a}from"./chunk-ILMHV3KM.js";import"./chunk-ND3BWIVN.js";import"./chunk-67FK5KGV.js";import"./chunk-4SZJF4GK.js";import"./chunk-Z2KGMIL4.js";import"./chunk-XIPGCT3D.js";export{q as calleesForDefinition,l as cargoManifestsForDefinitions,i as hoverToRustSignature,h as hoverWithRetry,m as openDefinitionDocuments,p as referencesWithCompletion,o as referencesWithRetry,b as runRustAnalyzerReferenceBatch,a as runWithConcurrency,j as rustAnalyzerInitializationOptions,k as rustAnalyzerSessionRoot,d as rustRequestCalleeDefinitions,c as rustRequestReferenceDefinitions,f as rustRequestSessionDefinitions,e as rustRequestSignatureDefinitions,g as signatureForDefinition,n as waitForOpenedDocuments};
|
|
2
2
|
//# sourceMappingURL=rust-semantic-worker.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SupportedLanguage } from './config-types-
|
|
1
|
+
import { a as SupportedLanguage } from './config-types-B9B60MiR.js';
|
|
2
2
|
|
|
3
3
|
type WatcherStatus = {
|
|
4
4
|
state: 'idle';
|
|
@@ -13,6 +13,13 @@ type WatcherStatus = {
|
|
|
13
13
|
state: 'cooldown';
|
|
14
14
|
until: number;
|
|
15
15
|
dirty: boolean;
|
|
16
|
+
} | {
|
|
17
|
+
state: 'budget-paused';
|
|
18
|
+
until: number;
|
|
19
|
+
dirty: boolean;
|
|
20
|
+
reason: string;
|
|
21
|
+
rebuilt: number;
|
|
22
|
+
estimatedWriteBytes: number;
|
|
16
23
|
} | {
|
|
17
24
|
state: 'draining';
|
|
18
25
|
startedAt: number;
|
|
@@ -38,6 +45,30 @@ interface LastRefreshMetadata {
|
|
|
38
45
|
error?: string;
|
|
39
46
|
}
|
|
40
47
|
|
|
48
|
+
/**
|
|
49
|
+
* A project-input change journal is a bounded record of filesystem events
|
|
50
|
+
* observed after one accepted SQLite generation. The generation identity and
|
|
51
|
+
* completeness flag are what let a reindexer use the paths as authoritative
|
|
52
|
+
* invalidation input instead of as advisory log text.
|
|
53
|
+
*/
|
|
54
|
+
declare const PROJECT_INPUT_CHANGE_JOURNAL_VERSION = 1;
|
|
55
|
+
type ProjectInputChangeKind = 'add' | 'change' | 'delete';
|
|
56
|
+
interface ProjectInputChangeEntry {
|
|
57
|
+
/** Normalized project-relative path. */
|
|
58
|
+
path: string;
|
|
59
|
+
kind: ProjectInputChangeKind;
|
|
60
|
+
}
|
|
61
|
+
interface ProjectInputChangeJournal {
|
|
62
|
+
version: typeof PROJECT_INPUT_CHANGE_JOURNAL_VERSION;
|
|
63
|
+
/** Immutable SQLite generation from which these changes were observed. */
|
|
64
|
+
baseGeneration: string | null;
|
|
65
|
+
/** False means the paths are diagnostic only and must not drive incremental reuse. */
|
|
66
|
+
complete: boolean;
|
|
67
|
+
/** Stable explanation for an incomplete journal. */
|
|
68
|
+
incompleteReason?: string;
|
|
69
|
+
entries: ProjectInputChangeEntry[];
|
|
70
|
+
}
|
|
71
|
+
|
|
41
72
|
/**
|
|
42
73
|
* Check if the `scip` CLI binary is available on PATH or packaged with scip-query.
|
|
43
74
|
*/
|
|
@@ -57,4 +88,4 @@ declare function printScipInstallInstructions(): void;
|
|
|
57
88
|
*/
|
|
58
89
|
declare function tryInstallScipCli(onStatus: (msg: string) => void): boolean;
|
|
59
90
|
|
|
60
|
-
export { type LastRefreshMetadata as L, type RefreshTrigger as R, type WatcherStatus as W, getScipVersion as g, isScipInstalled as i, printScipInstallInstructions as p, tryInstallScipCli as t };
|
|
91
|
+
export { type LastRefreshMetadata as L, type ProjectInputChangeJournal as P, type RefreshTrigger as R, type WatcherStatus as W, getScipVersion as g, isScipInstalled as i, printScipInstallInstructions as p, tryInstallScipCli as t };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-JO6FK3Q5.js";import"./chunk-SRIZDEWX.js";import"./chunk-BGBBVSH4.js";import"./chunk-PJBYDCBQ.js";import"./chunk-MTDBHTSF.js";import"./chunk-ZMS4YCY7.js";import"./chunk-IQMGNIGY.js";import"./chunk-MFBVUQJZ.js";import"./chunk-EPLE5O5O.js";import"./chunk-5J3A6RBZ.js";import"./chunk-WRQXLNYE.js";import"./chunk-YDTK77JP.js";import"./chunk-T2PBOVDI.js";import"./chunk-YUKYB54I.js";import"./chunk-4IASLUOP.js";import"./chunk-FLSVYEPL.js";import"./chunk-CTO3TRX7.js";import"./chunk-F4FNK44D.js";import"./chunk-67FK5KGV.js";import"./chunk-PAZSBPJR.js";import"./chunk-UAQQR55F.js";import"./chunk-NP4JFCLE.js";import"./chunk-5Z2H76VD.js";import"./chunk-DRENNWRG.js";import"./chunk-UXNXOMXJ.js";import"./chunk-4SZJF4GK.js";import"./chunk-DHEQMPLW.js";import"./chunk-DUDUIT5P.js";import"./chunk-PRLU3I7G.js";import"./chunk-DXYMTQZ4.js";import"./chunk-FYCH2EYQ.js";import"./chunk-NQXWWE6S.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import"./chunk-Z2KGMIL4.js";import"./chunk-XIPGCT3D.js";export{a as referenceReachability,b as slice};
|
|
2
|
+
//# sourceMappingURL=slice-NOTBWA7S.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { F as FileKind } from './file-kind-BKCVMNUf.js';
|
|
2
|
+
import { S as SourceObservationFreshness } from './repository-text-C0Q8VYdN.js';
|
|
3
|
+
import { S as SourceSnippet } from './source-snippet-_wrcgmZc.js';
|
|
4
|
+
|
|
5
|
+
interface SourceSearchIdentity {
|
|
6
|
+
relativePath: string;
|
|
7
|
+
focusLine: number;
|
|
8
|
+
ownerSymbol: string | null;
|
|
9
|
+
ownerShort: string | null;
|
|
10
|
+
ownerStartLine: number | null;
|
|
11
|
+
ownerEndLine: number | null;
|
|
12
|
+
fileKind: FileKind;
|
|
13
|
+
freshness?: SourceObservationFreshness;
|
|
14
|
+
}
|
|
15
|
+
interface SourceSearchMatch extends SourceSnippet {
|
|
16
|
+
ownerSymbol: string | null;
|
|
17
|
+
ownerShort: string | null;
|
|
18
|
+
ownerStartLine?: number | null;
|
|
19
|
+
ownerEndLine?: number | null;
|
|
20
|
+
fileKind?: FileKind;
|
|
21
|
+
freshness?: SourceObservationFreshness;
|
|
22
|
+
}
|
|
23
|
+
interface SourceSearchFileCoverage {
|
|
24
|
+
relativePath: string;
|
|
25
|
+
matchingLines: number;
|
|
26
|
+
returnedMatches: number;
|
|
27
|
+
freshness?: SourceObservationFreshness;
|
|
28
|
+
}
|
|
29
|
+
interface SourceSearchScopeHint {
|
|
30
|
+
scope: string;
|
|
31
|
+
matchingLines: number;
|
|
32
|
+
matchingFiles: number;
|
|
33
|
+
}
|
|
34
|
+
interface SourceSearchIdentityCoverage {
|
|
35
|
+
mode: 'complete' | 'bounded';
|
|
36
|
+
returned: number;
|
|
37
|
+
total: number;
|
|
38
|
+
omitted: number;
|
|
39
|
+
}
|
|
40
|
+
interface SourceSearchTextCoverage {
|
|
41
|
+
basis: 'current-project-text-files';
|
|
42
|
+
candidateFiles: number;
|
|
43
|
+
scannedTextFiles: number;
|
|
44
|
+
scannedBytes: number;
|
|
45
|
+
skippedBinaryPaths: string[];
|
|
46
|
+
skippedUnreadablePaths: string[];
|
|
47
|
+
skippedOversizedPaths: string[];
|
|
48
|
+
semanticFiles: {
|
|
49
|
+
aligned: number;
|
|
50
|
+
stale: number;
|
|
51
|
+
unavailable: number;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
interface SourceSearchResult {
|
|
55
|
+
pattern: string;
|
|
56
|
+
mode: 'literal' | 'regexp';
|
|
57
|
+
identities?: SourceSearchIdentity[];
|
|
58
|
+
identityManifest?: SourceSearchIdentity[];
|
|
59
|
+
identityCoverage?: SourceSearchIdentityCoverage;
|
|
60
|
+
matches: SourceSearchMatch[];
|
|
61
|
+
matchingLines: number;
|
|
62
|
+
matchingFiles?: number;
|
|
63
|
+
omittedMatches: number;
|
|
64
|
+
fileCoverage?: SourceSearchFileCoverage[];
|
|
65
|
+
scopeHints?: SourceSearchScopeHint[];
|
|
66
|
+
omittedScopeHints?: number;
|
|
67
|
+
scannedFiles: number;
|
|
68
|
+
textCoverage?: SourceSearchTextCoverage;
|
|
69
|
+
}
|
|
70
|
+
interface SourceSearchOptions {
|
|
71
|
+
scope?: string;
|
|
72
|
+
context?: number;
|
|
73
|
+
limit?: number;
|
|
74
|
+
regexp?: boolean;
|
|
75
|
+
ignoreCase?: boolean;
|
|
76
|
+
ranking?: 'structural';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type { SourceSearchFileCoverage as S, SourceSearchIdentity as a, SourceSearchIdentityCoverage as b, SourceSearchMatch as c, SourceSearchOptions as d, SourceSearchResult as e, SourceSearchScopeHint as f, SourceSearchTextCoverage as g };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface SourceSnippet {
|
|
2
|
+
relativePath: string;
|
|
3
|
+
startLine: number;
|
|
4
|
+
endLine: number;
|
|
5
|
+
focusLine: number;
|
|
6
|
+
source: string;
|
|
7
|
+
}
|
|
8
|
+
interface SourceUnitSnippet extends SourceSnippet {
|
|
9
|
+
unitType: string | null;
|
|
10
|
+
unitStartLine: number;
|
|
11
|
+
unitEndLine: number;
|
|
12
|
+
omittedLines: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type { SourceSnippet as S, SourceUnitSnippet as a };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-RSUH7G5T.js";import"./chunk-OMVNRPST.js";import"./chunk-SRIZDEWX.js";import"./chunk-BGBBVSH4.js";import"./chunk-PJBYDCBQ.js";import"./chunk-MTDBHTSF.js";import"./chunk-ZMS4YCY7.js";import"./chunk-IQMGNIGY.js";import"./chunk-MFBVUQJZ.js";import"./chunk-EPLE5O5O.js";import"./chunk-5J3A6RBZ.js";import"./chunk-WRQXLNYE.js";import"./chunk-YDTK77JP.js";import"./chunk-T2PBOVDI.js";import"./chunk-YUKYB54I.js";import"./chunk-4IASLUOP.js";import"./chunk-FLSVYEPL.js";import"./chunk-CTO3TRX7.js";import"./chunk-F4FNK44D.js";import"./chunk-67FK5KGV.js";import"./chunk-PAZSBPJR.js";import"./chunk-UAQQR55F.js";import"./chunk-NP4JFCLE.js";import"./chunk-5Z2H76VD.js";import"./chunk-DRENNWRG.js";import"./chunk-UXNXOMXJ.js";import"./chunk-4SZJF4GK.js";import"./chunk-DHEQMPLW.js";import"./chunk-DUDUIT5P.js";import"./chunk-PRLU3I7G.js";import"./chunk-DXYMTQZ4.js";import"./chunk-FYCH2EYQ.js";import"./chunk-NQXWWE6S.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import"./chunk-Z2KGMIL4.js";import"./chunk-XIPGCT3D.js";export{b as consumerSurface,a as surface};
|
|
2
|
+
//# sourceMappingURL=surface-BTBCLKNA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-YLNCTPOI.js";import{a as c}from"./chunk-26CT72HM.js";import{b as i,e as m}from"./chunk-T2PBOVDI.js";import"./chunk-NP4JFCLE.js";import"./chunk-5Z2H76VD.js";import{c as l}from"./chunk-DRENNWRG.js";import"./chunk-MXNGIEPU.js";import"./chunk-PRLU3I7G.js";import"./chunk-DXYMTQZ4.js";import"./chunk-FYCH2EYQ.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import"./chunk-XIPGCT3D.js";function g(o,t){let s=i(o,t),e=f(s);for(let n of e)console.log(n)}function R(o,t,s="No results found for resolved symbol."){return i(o,t).match?s:p(t,m(o,t,5))}function S(o,t,s,e){return{...a(o,t),[e]:s}}function p(o,t){let s=`No definition matched '${o}'.`;return t.length>0?`${s} Suggestions: ${t.join(", ")}`:s}function f(o){if(!o.match||o.total<=1)return[];let t=o.match,s=Math.max(0,o.total-1),e=[`Resolved: ${l(t.symbol)} (${t.relativePath}) -- ${s} other definition(s) share this name; qualify as <dir/leaf> to target another.`],n=o.candidates.slice(0,3);return n.length>0&&e.push(`Alternates: ${n.map(r=>`${r.shortName} (${r.relativePath}:${c(r.startLine)})`).join("; ")}`),e.push(""),e}export{p as noMatchMessage,g as symbolResolutionBefore,R as symbolResolutionEmptyMessage,a as symbolResolutionJson,S as withSymbolResolutionJson};
|
|
2
|
+
//# sourceMappingURL=symbol-resolution-SVSMX4RN.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-HR5JYLVV.js";import"./chunk-OMVNRPST.js";import"./chunk-YDTK77JP.js";import"./chunk-T2PBOVDI.js";import"./chunk-NP4JFCLE.js";import"./chunk-5Z2H76VD.js";import"./chunk-DRENNWRG.js";import"./chunk-PRLU3I7G.js";import"./chunk-DXYMTQZ4.js";import"./chunk-FYCH2EYQ.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import"./chunk-XIPGCT3D.js";export{b as moduleMap,a as system};
|
|
2
|
+
//# sourceMappingURL=system-2EIUFP6B.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b,c}from"./chunk-SBFDPHKH.js";import"./chunk-J4HUBIVF.js";import"./chunk-YF25RQER.js";import"./chunk-ZMS4YCY7.js";import"./chunk-IQMGNIGY.js";import"./chunk-MFBVUQJZ.js";import"./chunk-EPLE5O5O.js";import"./chunk-5J3A6RBZ.js";import"./chunk-WRQXLNYE.js";import"./chunk-YDTK77JP.js";import"./chunk-T2PBOVDI.js";import"./chunk-4IASLUOP.js";import"./chunk-FLSVYEPL.js";import"./chunk-CTO3TRX7.js";import"./chunk-F4FNK44D.js";import"./chunk-67FK5KGV.js";import"./chunk-PAZSBPJR.js";import"./chunk-UAQQR55F.js";import"./chunk-NP4JFCLE.js";import"./chunk-5Z2H76VD.js";import"./chunk-DRENNWRG.js";import"./chunk-UXNXOMXJ.js";import"./chunk-4SZJF4GK.js";import"./chunk-DUDUIT5P.js";import"./chunk-PRLU3I7G.js";import"./chunk-DXYMTQZ4.js";import"./chunk-FYCH2EYQ.js";import"./chunk-NQXWWE6S.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import"./chunk-Z2KGMIL4.js";import"./chunk-XIPGCT3D.js";export{c as qualifiedTraceEvidence,a as trace,b as traceEvidence};
|
|
2
|
+
//# sourceMappingURL=trace-BB2GHQPG.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{b as T}from"./chunk-UEQORB2A.js";import{a as M}from"./chunk-IM23CSG5.js";import{a as P,c as j}from"./chunk-PAZSBPJR.js";import"./chunk-P3UFF22M.js";import{c as b,e as v,f as l}from"./chunk-UAQQR55F.js";import"./chunk-NP4JFCLE.js";import"./chunk-5Z2H76VD.js";import"./chunk-DRENNWRG.js";import{d as g}from"./chunk-3KXFB2FM.js";import"./chunk-WOPZX5GM.js";import"./chunk-DHEQMPLW.js";import{a as w}from"./chunk-DUDUIT5P.js";import"./chunk-SIGVQT43.js";import"./chunk-PRLU3I7G.js";import{d as f}from"./chunk-DXYMTQZ4.js";import"./chunk-DK6MB565.js";import"./chunk-FYCH2EYQ.js";import"./chunk-O4PZFAXA.js";import"./chunk-NQXWWE6S.js";import"./chunk-H5EXS3HM.js";import{c as y,d}from"./chunk-HGFDYOVB.js";import{c as m}from"./chunk-Z2KGMIL4.js";import{n as h,q as S}from"./chunk-XIPGCT3D.js";import{parentPort as c,workerData as O}from"worker_threads";import{randomUUID as C}from"crypto";import{resolve as R}from"path";var a=class{loadModule;discoverTsconfigs;createProjects;createProvider;db;module=null;projects=null;provider=null;stats={providerRequests:0,sessionsCreated:0,sessionsReused:0,sessionsRefreshed:0,sessionsReplaced:0,projectsCreated:0};constructor(e,t={}){this.db=e,this.loadModule=t.loadModule??b,this.discoverTsconfigs=t.discoverTsconfigs??P,this.createProjects=t.createProjects??v,this.createProvider=t.createProvider??((i,s,o)=>j(i,s,o,{reusedProjects:!0}))}semanticProvider(){return this.stats.providerRequests+=1,this.provider?(this.stats.sessionsReused+=1,this.provider):this.createSession()}advanceGeneration(e,t){let i=q(t);return this.provider?.dispose?.(),this.provider=null,this.db=e,this.projects?i.mode==="replace"?(this.projects=null,this.module=null,this.stats.sessionsReplaced+=1,i):(i.mode==="refresh"&&(D(this.projects,e.config.projectRoot,i),this.stats.sessionsRefreshed+=1),i):i}snapshotStats(){return{...this.stats}}dispose(){this.provider?.dispose?.(),this.provider=null,this.projects=null,this.module=null}createSession(){let e=this.module??this.loadModule();if(!e)return this.provider=l("ts-morph is not installed"),this.provider;if(this.module=e,!this.projects){let t=this.discoverTsconfigs(this.db);if(t.length===0)return this.provider=l("no tsconfig found"),this.provider;this.projects=this.createProjects(e,t),this.stats.projectsCreated+=this.projects.length}return this.provider=this.createProvider(this.db,e,this.projects),this.stats.sessionsCreated+=1,this.provider}};function q(r){let e=new Set;r.projectIdentityChanged&&e.add("project-identity-changed");for(let o of r.uncertainty)e.add(o);for(let o of r.changes)o.inputKind!=="source"&&e.add(`${o.inputKind}-input-changed`);if(e.size>0)return{mode:"replace",addedFiles:[],modifiedFiles:[],deletedFiles:[],reasons:[...e].sort()};let t=u(r.changes,"added"),i=u(r.changes,"modified"),s=u(r.changes,"deleted");return{mode:t.length+i.length+s.length===0?"reuse":"refresh",addedFiles:t,modifiedFiles:i,deletedFiles:s,reasons:[]}}function u(r,e){return r.filter(t=>t.kind===e).map(t=>t.path).sort()}function D(r,e,t){for(let i of r){for(let s of t.deletedFiles)i.project.getSourceFile(R(e,s))?.forget();for(let s of t.modifiedFiles){let o=i.project.getSourceFile(R(e,s));o&&o.refreshFromFileSystemSync()}t.addedFiles.length>0&&i.project.addSourceFilesFromTsConfig(i.tsconfigPath)}}var p=class{openDb;createHost;generationIdentity;readSnapshot;now;db=null;host=null;generation=null;snapshot=null;requests=0;lastRequestAtMs=null;lastError=null;available=null;constructor(e){this.openDb=e.openDb,this.createHost=e.createHost??(t=>new a(t)),this.generationIdentity=e.generationIdentity?t=>e.generationIdentity(t.config.dbPath):t=>t.generation.identity,this.readSnapshot=e.readSnapshot?t=>e.readSnapshot(t.config.dbPath):H,this.now=e.now??Date.now}handle(e,t){try{this.syncGeneration(e);let i=this.host.semanticProvider();switch(this.available=i.availability().available,this.requests+=1,this.lastRequestAtMs=this.now(),this.lastError=null,t.kind){case"availability":return i.availability();case"import-usage":return i.importUsage(t.file);case"references":return[...F(i,t.definitions,{exact:t.exact===!0})];case"reference-fragments":if(!i.referenceFragmentsForFiles)throw new Error("TypeScript provider does not support reference fragments.");return[...i.referenceFragmentsForFiles(t.files)];case"callees":return[...A(i,t.definitions)];case"signature":return i.signatureFor(t.definition);default:return B(t)}}catch(i){throw this.lastError=i instanceof Error?i.message:String(i),i}}status(e){let t=this.host?.snapshotStats();return{protocolVersion:w,state:this.lastError?"error":this.host?this.available?"ready":"unavailable":"idle",requests:this.requests,...this.lastRequestAtMs===null?{}:{lastRequestAt:new Date(this.lastRequestAtMs).toISOString()},...this.lastError?{lastError:this.lastError}:{},sessionsCreated:t?.sessionsCreated??0,sessionsReused:t?.sessionsReused??0,sessionsRefreshed:t?.sessionsRefreshed??0,sessionsReplaced:t?.sessionsReplaced??0,projectsCreated:t?.projectsCreated??0,...e?{mailbox:e}:{}}}closeTypeScriptService(){this.host?.dispose(),this.db?.close(),this.host=null,this.db=null,this.generation=null,this.snapshot=null,this.available=null}syncGeneration(e){if(this.generation===e&&this.host&&this.db)return;let t=this.openDb(),i=this.generationIdentity(t);if(!i||i!==e)throw t.close(),new Error("TypeScript semantic request does not match the currently published index generation.");let s=this.readSnapshot(t);if(!this.host||!this.db)this.db=t,this.host=this.createHost(t);else{let o=this.db;this.host.advanceGeneration(t,N(this.snapshot,s)),this.db=t,o.close()}this.generation=i,this.snapshot=s,this.available=null}};function F(r,e,t){return r.referencesForDefinitions?.(e,t)??new Map(e.map(i=>[i.symbolId,r.referencesFor(i)]))}function A(r,e){return r.calleesForDefinitions?.(e)??new Map(e.map(t=>[t.symbolId,r.calleesFor(t)]))}function H(r){if(!r.generation.metadataRaw)return null;let e=f(r.generation.metadataRaw);return e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.usableForEvidenceCache?null:h(e.metadata.fingerprint)}function N(r,e){return e?S(r,e):{version:1,changes:[],projectIdentityChanged:!0,uncertainty:["prior-snapshot-unavailable"]}}function B(r){throw new Error(`Unhandled TypeScript semantic request: ${JSON.stringify(r)}`)}var Z=`typescript-semantic-${process.pid}-${C()}`,x=m(process.pid),ee={pid:process.pid,...x?{processIdentity:x}:{}};var n=L(O);if(!c)throw new Error("TypeScript mailbox worker requires a parent port.");if(n.kind==="index"){let r=new T({projectRoot:n.projectRoot,currentGeneration:()=>g(n.dbPath),...n.maxActiveSessions===void 0?{}:{maxActiveSessions:n.maxActiveSessions},...n.softMemoryLimitMb===void 0?{}:{softMemoryLimitMb:n.softMemoryLimitMb}});c.on("message",e=>{let t=k(e);I(t,()=>r.handle(t.payload.baseGeneration,t.payload.request),()=>r.status())})}else{let r=new p({openDb:()=>M(n.projectRoot)});c.on("message",e=>{let t=k(e),i=y();d(t.payload.profileEnvironment??{});try{I(t,()=>r.handle(t.payload.generation,t.payload.request),()=>r.status())}finally{d(i)}})}function I(r,e,t){let i;try{if(Date.now()>r.deadlineAtMs)throw new Error("TypeScript mailbox request expired before processing.");let s=e();if(Date.now()>r.deadlineAtMs)throw new Error("TypeScript mailbox request expired while the worker was processing it.");i={kind:"response",requestId:r.requestId,ok:!0,result:s,status:t()}}catch(s){i={kind:"response",requestId:r.requestId,ok:!1,error:s instanceof Error?s.message:String(s),status:t()}}c.postMessage(i)}function L(r){if(!r||typeof r!="object")throw new Error("TypeScript mailbox worker data is missing.");let e=r;if(e.kind==="index"&&typeof e.projectRoot=="string"&&typeof e.dbPath=="string"&&E(e.maxActiveSessions)&&E(e.softMemoryLimitMb))return{kind:"index",projectRoot:e.projectRoot,dbPath:e.dbPath,...e.maxActiveSessions===void 0?{}:{maxActiveSessions:e.maxActiveSessions},...e.softMemoryLimitMb===void 0?{}:{softMemoryLimitMb:e.softMemoryLimitMb}};if(e.kind==="semantic"&&typeof e.projectRoot=="string")return{kind:"semantic",projectRoot:e.projectRoot};throw new Error("TypeScript mailbox worker data is invalid.")}function E(r){return r===void 0||Number.isInteger(r)&&r>0}function k(r){if(!r||typeof r!="object")throw new Error("TypeScript mailbox worker request is missing.");let e=r;if(e.kind!=="request"||typeof e.requestId!="string"||!Number.isSafeInteger(e.deadlineAtMs)||typeof e.payload!="object"||e.payload===null)throw new Error("TypeScript mailbox worker request is invalid.");return e}
|
|
2
2
|
//# sourceMappingURL=typescript-mailbox-worker.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-YR7VRWNX.js";import"./chunk-DXEJ4FLZ.js";import"./chunk-3TNRNKAT.js";import"./chunk-7KCZELVM.js";import"./chunk-OFZVFIDF.js";import"./chunk-YF25RQER.js";import"./chunk-SRIZDEWX.js";import"./chunk-BGBBVSH4.js";import"./chunk-PJBYDCBQ.js";import"./chunk-MTDBHTSF.js";import"./chunk-ZMS4YCY7.js";import"./chunk-IQMGNIGY.js";import"./chunk-MR4ZKWO6.js";import"./chunk-XFRHBAIT.js";import"./chunk-MFBVUQJZ.js";import"./chunk-EPLE5O5O.js";import"./chunk-5J3A6RBZ.js";import"./chunk-WRQXLNYE.js";import"./chunk-YDTK77JP.js";import"./chunk-T2PBOVDI.js";import"./chunk-YUKYB54I.js";import"./chunk-4IASLUOP.js";import"./chunk-FLSVYEPL.js";import"./chunk-CTO3TRX7.js";import"./chunk-F4FNK44D.js";import"./chunk-67FK5KGV.js";import"./chunk-PAZSBPJR.js";import"./chunk-UAQQR55F.js";import"./chunk-NP4JFCLE.js";import"./chunk-5Z2H76VD.js";import"./chunk-DRENNWRG.js";import"./chunk-UXNXOMXJ.js";import"./chunk-4SZJF4GK.js";import"./chunk-DHEQMPLW.js";import"./chunk-DUDUIT5P.js";import"./chunk-PRLU3I7G.js";import"./chunk-DXYMTQZ4.js";import"./chunk-FYCH2EYQ.js";import"./chunk-NQXWWE6S.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import"./chunk-Z2KGMIL4.js";import"./chunk-XIPGCT3D.js";export{a as valueFlow};
|
|
2
|
+
//# sourceMappingURL=value-flow-OA7AHSUG.js.map
|