scip-query 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +244 -1
- package/README.md +2 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-H3P6BR5G.js +2 -0
- package/dist/call-graph-VTG2CUOQ.js +2 -0
- package/dist/call-graph-evidence-BociKRpF.d.ts +19 -0
- package/dist/chunk-2BMSSRBH.js +2 -0
- package/dist/{chunk-WIWY3CRX.js → chunk-2GJSD5GY.js} +2 -2
- package/dist/{chunk-W5OXRYGE.js → chunk-2M2LSIMY.js} +3 -3
- package/dist/{chunk-2LDBDR6J.js → chunk-2N6WBNDC.js} +2 -2
- package/dist/{chunk-HOENASQM.js → chunk-2USA3S3P.js} +2 -2
- package/dist/chunk-2VAHDDLM.js +133 -0
- package/dist/chunk-2XWIUW5Z.js +455 -0
- package/dist/chunk-3D4BOXW6.js +20 -0
- package/dist/{chunk-BBCIS4DX.js → chunk-3LO4FST5.js} +2 -2
- package/dist/chunk-3WTY4LP2.js +3 -0
- package/dist/{chunk-UXW33INU.js → chunk-3Z5AMSK6.js} +2 -2
- package/dist/{chunk-4ILJCCXV.js → chunk-44IETFOU.js} +2 -2
- package/dist/chunk-4FR6GQIT.js +2 -0
- package/dist/chunk-4KBTHJLP.js +2 -0
- package/dist/{chunk-SSK6LDPC.js → chunk-5BIKR67W.js} +2 -2
- package/dist/{chunk-IHGQTTVW.js → chunk-5PROPLHI.js} +2 -2
- package/dist/{chunk-TA3QKLLU.js → chunk-5V7EPTII.js} +2 -2
- package/dist/{chunk-JS4PGXMV.js → chunk-62LPZCBQ.js} +2 -2
- package/dist/{chunk-DBRSYFXR.js → chunk-64O2JHQA.js} +2 -2
- package/dist/chunk-6D4F5VWG.js +10 -0
- package/dist/{chunk-BHVUJOCQ.js → chunk-6ERFBC3X.js} +2 -2
- package/dist/{chunk-ILTDAWEF.js → chunk-6ILKOOGH.js} +2 -2
- package/dist/chunk-6MFXCMZC.js +2 -0
- package/dist/chunk-6O7FACKB.js +2 -0
- package/dist/{chunk-XDQMU3BT.js → chunk-6TS3KOXR.js} +2 -2
- package/dist/{chunk-YI2AWIHC.js → chunk-76QOU4PK.js} +2 -2
- package/dist/{chunk-7CYG22FH.js → chunk-7DUI77BN.js} +2 -2
- package/dist/{chunk-IDFEUFKS.js → chunk-7F7T6DCR.js} +2 -2
- package/dist/chunk-7H6VHWWJ.js +2 -0
- package/dist/chunk-7HXT6YLU.js +5 -0
- package/dist/{chunk-DIRJWYBM.js → chunk-7R4V5ES6.js} +4 -4
- package/dist/{chunk-SZHGTCPP.js → chunk-7RIRIADH.js} +2 -2
- package/dist/chunk-7ZLWLOGT.js +2 -0
- package/dist/{chunk-M2O5NY6W.js → chunk-A4WEAK35.js} +2 -2
- package/dist/chunk-AADQLOQ4.js +38 -0
- package/dist/{chunk-OLNV6I6U.js → chunk-AN76MGUE.js} +2 -2
- package/dist/chunk-ANLNLY66.js +2 -0
- package/dist/chunk-ATXPTSEI.js +81 -0
- package/dist/{chunk-YPWBKGFU.js → chunk-AX7IDVFT.js} +2 -2
- package/dist/chunk-B7MPDEAK.js +3 -0
- package/dist/chunk-BBB5FBX4.js +2 -0
- package/dist/{chunk-6I6L7Z62.js → chunk-BHKK5RJY.js} +2 -2
- package/dist/chunk-BJWFVAA5.js +2 -0
- package/dist/{chunk-UHFYCMZO.js → chunk-BKZYTLGE.js} +2 -2
- package/dist/chunk-BL6DCHQP.js +2 -0
- package/dist/{chunk-TEBQMNVI.js → chunk-BOW7SSQH.js} +2 -2
- package/dist/{chunk-OWOOWNJ5.js → chunk-C4RHHCKL.js} +2 -2
- package/dist/{chunk-N2ZSIIGR.js → chunk-C7C6AKAT.js} +6 -6
- package/dist/chunk-CD6M6LS2.js +16 -0
- package/dist/chunk-CFE6PSG6.js +2 -0
- package/dist/{chunk-6V5CNXL6.js → chunk-CFNIGQMT.js} +2 -2
- package/dist/{chunk-GUFSG5TX.js → chunk-CKBUBRYD.js} +2 -2
- package/dist/{chunk-4WNW27SX.js → chunk-CZW5MZ5B.js} +2 -2
- package/dist/chunk-DBBZ63ZX.js +2 -0
- package/dist/{chunk-HCXEQRFF.js → chunk-DBN7DMJB.js} +2 -2
- package/dist/{chunk-6PQNKL3G.js → chunk-DUULLZHZ.js} +2 -2
- package/dist/{chunk-Z4CDXYNQ.js → chunk-DV5Y5NOS.js} +2 -2
- package/dist/chunk-DZOIKCTM.js +3 -0
- package/dist/chunk-E4PKTOL3.js +2 -0
- package/dist/{chunk-EG2CPZMJ.js → chunk-E65ELFKU.js} +2 -2
- package/dist/{chunk-CNO7TOKL.js → chunk-E7QR35ST.js} +2 -2
- package/dist/{chunk-3D3QG236.js → chunk-EFSXAINW.js} +2 -2
- package/dist/{chunk-IL676XCC.js → chunk-EHVEIEQN.js} +2 -2
- package/dist/{chunk-BE7ZZTMC.js → chunk-EHYDXE3Z.js} +2 -2
- package/dist/{chunk-LXABEJX3.js → chunk-EP63Y6LD.js} +2 -2
- package/dist/{chunk-QU5XRYB5.js → chunk-EPX6NQN6.js} +2 -2
- package/dist/{chunk-FESCRNVV.js → chunk-ETC674NS.js} +2 -2
- package/dist/{chunk-OSSESPDX.js → chunk-F5GSBHC6.js} +2 -2
- package/dist/chunk-FH3DGXC6.js +2 -0
- package/dist/{chunk-YEN6CYC7.js → chunk-FI7VGOR4.js} +2 -2
- package/dist/chunk-FJF6VO2P.js +2 -0
- package/dist/{chunk-FRUSVINH.js → chunk-FLMTCX5R.js} +2 -2
- package/dist/chunk-FVFDOIM3.js +2 -0
- package/dist/{chunk-PJFGPYTU.js → chunk-G2HU5WRN.js} +2 -2
- package/dist/{chunk-FIQRSHVM.js → chunk-G4ALYS4J.js} +2 -2
- package/dist/{chunk-UVGEWT4Y.js → chunk-G56I7K4W.js} +2 -2
- package/dist/{chunk-WOIKCX6A.js → chunk-GC4DG2V5.js} +2 -2
- package/dist/chunk-GG45PK4S.js +4 -0
- package/dist/{chunk-XBGWL66K.js → chunk-GHNPACNP.js} +2 -2
- package/dist/{chunk-IICPE7B2.js → chunk-GINH3YQU.js} +2 -2
- package/dist/{chunk-HLZTEXRA.js → chunk-GTZZVLKJ.js} +2 -2
- package/dist/chunk-GXXW5ZHH.js +2 -0
- package/dist/{chunk-B5D7QPBE.js → chunk-HAXXKRTD.js} +2 -2
- package/dist/chunk-HEZWBAZY.js +2 -0
- package/dist/chunk-HMEWLMML.js +2 -0
- package/dist/{chunk-QUU5OBVK.js → chunk-HOBOVYPO.js} +2 -2
- package/dist/{chunk-XGZEP6GR.js → chunk-HRFQ6GW5.js} +2 -2
- package/dist/{chunk-MPQ4OTBM.js → chunk-HX4X7KG3.js} +2 -2
- package/dist/{chunk-FDLOBR6P.js → chunk-HYT2R7LX.js} +2 -2
- package/dist/chunk-IKQVBVQL.js +40 -0
- package/dist/chunk-J6GLBBRK.js +4 -0
- package/dist/{chunk-ZTI4SBFV.js → chunk-J7A4PWFX.js} +2 -2
- package/dist/{chunk-OSR2GEHQ.js → chunk-JCSAZ35V.js} +2 -2
- package/dist/{chunk-ESIQ66Z7.js → chunk-JDU2IV3A.js} +2 -2
- package/dist/chunk-JFMI5SGB.js +4 -0
- package/dist/{chunk-W6STWDQI.js → chunk-JJP37RGX.js} +2 -2
- package/dist/chunk-JZ2A7LDM.js +5 -0
- package/dist/chunk-KNLQGXVH.js +80 -0
- package/dist/chunk-KVQCECPR.js +2 -0
- package/dist/{chunk-SQXRS7BG.js → chunk-KXXORBZ2.js} +2 -2
- package/dist/{chunk-DIUFNHRJ.js → chunk-L5KYH6U3.js} +2 -2
- package/dist/chunk-L6XHYJPZ.js +21 -0
- package/dist/{chunk-2GRUZAQF.js → chunk-L7KTFEAV.js} +2 -2
- package/dist/{chunk-QBE3YX64.js → chunk-LDXHR5EL.js} +2 -2
- package/dist/{chunk-HEHOQQKH.js → chunk-MHGDSBFX.js} +2 -2
- package/dist/{chunk-PWWAJSKV.js → chunk-MLQVVDG3.js} +2 -2
- package/dist/chunk-MOKUWRHO.js +3 -0
- package/dist/{chunk-VQILFTEH.js → chunk-MPYAPMNE.js} +2 -2
- package/dist/{chunk-UICY4GTQ.js → chunk-MV6SPXCR.js} +2 -2
- package/dist/{chunk-HYO3NP5Q.js → chunk-MZPXPSUJ.js} +2 -2
- package/dist/{chunk-VZRNID6A.js → chunk-N55KIE46.js} +2 -2
- package/dist/{chunk-YF5IB2LF.js → chunk-NB4D3BNM.js} +2 -2
- package/dist/{chunk-VVZSBTSU.js → chunk-NGKBOT6G.js} +2 -2
- package/dist/{chunk-NJITK2GP.js → chunk-NJGKXKQF.js} +2 -2
- package/dist/chunk-NJQISBL4.js +8 -0
- package/dist/{chunk-T4N4P2K5.js → chunk-NJT3ZEKY.js} +2 -2
- package/dist/{chunk-FPYLNQPT.js → chunk-NKMKZP6A.js} +2 -2
- package/dist/chunk-NODFZ6ED.js +2 -0
- package/dist/{chunk-BRV7PIFF.js → chunk-NSM5IEVW.js} +2 -2
- package/dist/{chunk-3WR4E3A3.js → chunk-NTGUVNR2.js} +2 -2
- package/dist/{chunk-VUPHCS7Y.js → chunk-NU3KFF2O.js} +2 -2
- package/dist/chunk-NWLVNU66.js +557 -0
- package/dist/{chunk-D4N5SQ2M.js → chunk-NYKZMCRC.js} +2 -2
- package/dist/{chunk-VNLGKHS6.js → chunk-O6BUXZEH.js} +2 -2
- package/dist/chunk-ODPDP7A4.js +3 -0
- package/dist/{chunk-JTQVMR42.js → chunk-OHIV323X.js} +2 -2
- package/dist/chunk-OIAPEKMT.js +3 -0
- package/dist/chunk-OIOC5EHF.js +3 -0
- package/dist/{chunk-YBGKCQIS.js → chunk-ONPPQM4G.js} +2 -2
- package/dist/{chunk-64BFSI5I.js → chunk-OUHEZBYI.js} +2 -2
- package/dist/{chunk-L6PJPETJ.js → chunk-OVGYW7UD.js} +2 -2
- package/dist/{chunk-I55I7XXP.js → chunk-OYKU4B3Y.js} +2 -2
- package/dist/{chunk-J66VOFW6.js → chunk-POBJ6FR2.js} +2 -2
- package/dist/{chunk-CWFP7GM5.js → chunk-PSZPMMWN.js} +2 -2
- package/dist/chunk-PXTRBKRK.js +3 -0
- package/dist/{chunk-HKGFPJ4T.js → chunk-Q5JRIHT3.js} +2 -2
- package/dist/{chunk-P42EIXTA.js → chunk-Q7ATHARX.js} +2 -2
- package/dist/{chunk-JYR66JN5.js → chunk-Q7CSKIDM.js} +2 -2
- package/dist/{chunk-TRNAEQ6P.js → chunk-QBQE7ZJ5.js} +2 -2
- package/dist/{chunk-DULC3QFP.js → chunk-QH22UIXP.js} +2 -2
- package/dist/chunk-QXCKQTKR.js +60 -0
- package/dist/{chunk-ODDUPDP7.js → chunk-RBAD4GJ2.js} +5 -5
- package/dist/{chunk-IZDPJ2QI.js → chunk-RMDPFPNW.js} +2 -2
- package/dist/chunk-ROPJDEJZ.js +4 -0
- package/dist/{chunk-EKV5HX33.js → chunk-RVZC6TJE.js} +2 -2
- package/dist/{chunk-XFA4SSO3.js → chunk-S4QZBKSR.js} +2 -2
- package/dist/{chunk-D2DHWI3D.js → chunk-SCPMZ73U.js} +2 -2
- package/dist/{chunk-PZL5T7SU.js → chunk-SIAP5RGI.js} +2 -2
- package/dist/{chunk-7IWV2EG3.js → chunk-SIX4RFR3.js} +2 -2
- package/dist/{chunk-DYGHBZ2N.js → chunk-SKKXTABJ.js} +2 -2
- package/dist/{chunk-F7DY272B.js → chunk-SSRFUQBD.js} +2 -2
- package/dist/chunk-SYVJEEUJ.js +3 -0
- package/dist/{chunk-FGA2U4OR.js → chunk-T3CZAZSI.js} +2 -2
- package/dist/chunk-T3I6NHBH.js +2 -0
- package/dist/{chunk-EQHFIL6T.js → chunk-T6DWDI5E.js} +2 -2
- package/dist/chunk-T6HRIROJ.js +7 -0
- package/dist/{chunk-GSP44ENC.js → chunk-TAA7HXHE.js} +2 -2
- package/dist/{chunk-BQGB4HBD.js → chunk-TJ2JQYT3.js} +2 -2
- package/dist/{chunk-XPDPNWTQ.js → chunk-TULNMD5T.js} +19 -19
- package/dist/chunk-U2FPY5XA.js +3 -0
- package/dist/chunk-U3SXIMII.js +38 -0
- package/dist/{chunk-NOGJXYFO.js → chunk-U6KCHXJ4.js} +2 -2
- package/dist/chunk-UH3XSKS5.js +9 -0
- package/dist/{chunk-AFHTBORT.js → chunk-UIFUZVCC.js} +2 -2
- package/dist/{chunk-7BWFZPPZ.js → chunk-UXKURIVI.js} +2 -2
- package/dist/{chunk-2E7CX53V.js → chunk-V2RBODHL.js} +2 -2
- package/dist/{chunk-KLFEXGQA.js → chunk-VBKUWB6N.js} +2 -2
- package/dist/{chunk-WUN6KBHV.js → chunk-VBV6ALJE.js} +2 -2
- package/dist/{chunk-GZIUDL6G.js → chunk-VDGFWCQV.js} +2 -2
- package/dist/chunk-VDSDOEWF.js +2 -0
- package/dist/{chunk-WDNVY4E7.js → chunk-VZPWVCLN.js} +2 -2
- package/dist/chunk-WDSFQDPN.js +2 -0
- package/dist/{chunk-CIYLO6SI.js → chunk-WFA35BGR.js} +2 -2
- package/dist/{chunk-LMZ5PRUV.js → chunk-WLMP3OCW.js} +2 -2
- package/dist/{chunk-3SVF22I5.js → chunk-WSA52GOR.js} +2 -2
- package/dist/{chunk-VMPRET3I.js → chunk-X3YVZAKZ.js} +2 -2
- package/dist/{chunk-GYIZ4NXB.js → chunk-X6OGVFIT.js} +2 -2
- package/dist/{chunk-6HFCYNYE.js → chunk-XKXTR6ZI.js} +2 -2
- package/dist/{chunk-6VVV4WRR.js → chunk-Y5DFAW5W.js} +2 -2
- package/dist/chunk-YSYPDRD5.js +3 -0
- package/dist/{chunk-TQPCBMWT.js → chunk-ZFVPWH62.js} +2 -2
- package/dist/chunk-ZGIHTH27.js +2 -0
- package/dist/{chunk-OR2E3AGZ.js → chunk-ZGIQN2SX.js} +2 -2
- package/dist/{chunk-WNTFFKAX.js → chunk-ZHG4WAHR.js} +2 -2
- package/dist/{chunk-DTZCKZEU.js → chunk-ZKB2XUEN.js} +2 -2
- package/dist/chunk-ZLMXIQLC.js +21 -0
- package/dist/chunk-ZMCQIHI4.js +2 -0
- package/dist/cli-main.js +2 -2
- package/dist/code-TAVIKWJI.js +2 -0
- package/dist/code-result-json-5FEFQCAQ.js +2 -0
- package/dist/{command-descriptors-P34VABY5.js → command-descriptors-7BKH53Y3.js} +124 -124
- package/dist/dataflow-GFBTVDH3.js +2 -0
- package/dist/dependence-slice-GWGQCODG.js +2 -0
- package/dist/deps-4QHVDPYA.js +2 -0
- package/dist/direct-navigation-4UBC6HNW.js +3 -0
- package/dist/entry-map-QCTF4RVY.js +2 -0
- package/dist/files-M2UBF5HJ.js +2 -0
- package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
- package/dist/{health-CPp2Jf1Z.d.ts → health-BI2a9WPy.d.ts} +60 -2
- package/dist/hierarchy-2UIHRLW4.js +2 -0
- package/dist/imports-WIE3YZOB.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/members-YKD636DA.js +2 -0
- package/dist/methods-VDF4IMYG.js +2 -0
- package/dist/output-continuation-command-4UMDOOLO.js +3 -0
- package/dist/output-pagination-2GME6OPY.js +19 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-XEQTRCV5.js +3 -0
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +1 -1
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -0
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +20 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -0
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +28 -1
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +1 -1
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +50 -23
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +4 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +9 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +19 -3
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +22 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +17 -3
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +7 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +1 -1
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +22 -6
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +16 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/query-service-fastpath.js +5 -5
- package/dist/query-service-server.js +2 -2
- package/dist/refs-JNK5CLM7.js +2 -0
- package/dist/refs-pagination-6BLRYGMV.js +2 -0
- package/dist/reindex-worker.js +10 -10
- package/dist/reindex.js +18 -18
- package/dist/runtime.js +4 -4
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/slice-PHPVNCWX.js +2 -0
- package/dist/surface-MQX5MPIV.js +2 -0
- package/dist/{symbol-resolution-WD5EU5JE.js → symbol-resolution-DBLVXLBC.js} +2 -2
- package/dist/system-JOPKV4OG.js +2 -0
- package/dist/trace-I2P2YFH4.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/value-flow-JJVMF7NP.js +2 -0
- package/dist/watch-server.js +3 -3
- package/docs/COMMAND_REFERENCE.md +2 -2
- package/docs/DETECTOR_GUIDE.md +51 -12
- package/docs/accuracy-audit-checklist.md +36 -13
- package/docs/locality-analyzer-design.md +9 -9
- package/package.json +2 -2
- package/skills/conductor/SKILL.md +110 -0
- package/skills/conductor/agents/openai.yaml +4 -0
- package/skills/principal-maintainability-review/SKILL.md +273 -0
- package/skills/principal-maintainability-review/agents/openai.yaml +4 -0
- package/skills/scip-calibrate/SKILL.md +102 -0
- package/skills/scip-calibrate/agents/openai.yaml +4 -0
- package/skills/scip-claim-audit/SKILL.md +113 -0
- package/skills/scip-claim-audit/agents/openai.yaml +4 -0
- package/skills/scip-probe-reachability/SKILL.md +93 -0
- package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
- package/skills/scip-root-cause/SKILL.md +160 -0
- package/skills/scip-root-cause/agents/openai.yaml +4 -0
- package/skills/scip-system-compression/SKILL.md +252 -0
- package/skills/scip-system-compression/agents/openai.yaml +4 -0
- package/skills/scip-system-compression/references/compression-atlas.md +116 -0
- package/skills/scip-system-compression/references/compression-patterns.md +87 -0
- package/skills/scip-twin-drift/SKILL.md +109 -0
- package/skills/scip-twin-drift/agents/openai.yaml +4 -0
- package/dist/by-kind-XI2CSWEY.js +0 -2
- package/dist/call-graph-UONR6JR5.js +0 -2
- package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
- package/dist/chunk-2R3V3PSD.js +0 -4
- package/dist/chunk-2WC2OEDO.js +0 -4
- package/dist/chunk-3FHOF22C.js +0 -21
- package/dist/chunk-3JKSW6LJ.js +0 -2
- package/dist/chunk-3L2ZBPEX.js +0 -133
- package/dist/chunk-3PJABJSU.js +0 -2
- package/dist/chunk-4FTZ4P5G.js +0 -2
- package/dist/chunk-4UX2F3JX.js +0 -2
- package/dist/chunk-5ENOG4VP.js +0 -61
- package/dist/chunk-66DVSJQG.js +0 -455
- package/dist/chunk-AVRYW5OZ.js +0 -2
- package/dist/chunk-BDUVI7TO.js +0 -3
- package/dist/chunk-CEEZJXEF.js +0 -2
- package/dist/chunk-CJZXN4NU.js +0 -2
- package/dist/chunk-COF23M5F.js +0 -2
- package/dist/chunk-DHUIOLDT.js +0 -2
- package/dist/chunk-DRENNWRG.js +0 -2
- package/dist/chunk-E5R6AQ73.js +0 -40
- package/dist/chunk-E73UNJTF.js +0 -38
- package/dist/chunk-EVFUMY4R.js +0 -3
- package/dist/chunk-FBN2FGXG.js +0 -2
- package/dist/chunk-FFRKR4EQ.js +0 -2
- package/dist/chunk-GAS2LJMP.js +0 -3
- package/dist/chunk-HVF5VBG6.js +0 -2
- package/dist/chunk-JGKUET5J.js +0 -3
- package/dist/chunk-JWTGMPIT.js +0 -80
- package/dist/chunk-KFOYCQAJ.js +0 -9
- package/dist/chunk-KYSDI3GE.js +0 -5
- package/dist/chunk-LDVT66YM.js +0 -2
- package/dist/chunk-LQRQN2XA.js +0 -2
- package/dist/chunk-MNV5FSBW.js +0 -3
- package/dist/chunk-MV3CDXPI.js +0 -38
- package/dist/chunk-N5B2NILC.js +0 -5
- package/dist/chunk-NOYBFVJA.js +0 -554
- package/dist/chunk-NWQXSFFU.js +0 -3
- package/dist/chunk-OLIWTZI3.js +0 -3
- package/dist/chunk-PP7KNN7L.js +0 -2
- package/dist/chunk-PU7T5QYQ.js +0 -2
- package/dist/chunk-QGVTFRY2.js +0 -7
- package/dist/chunk-QOJONDS7.js +0 -2
- package/dist/chunk-RBLQNW26.js +0 -20
- package/dist/chunk-RTQ7NEKG.js +0 -81
- package/dist/chunk-TPFHAQ2G.js +0 -2
- package/dist/chunk-TQZV7KV4.js +0 -2
- package/dist/chunk-TY7CRN3Z.js +0 -2
- package/dist/chunk-W7CXK74K.js +0 -2
- package/dist/chunk-WB3WYIRE.js +0 -4
- package/dist/chunk-WK46TNUM.js +0 -3
- package/dist/chunk-WYCTJDVR.js +0 -2
- package/dist/chunk-XRYABF57.js +0 -8
- package/dist/chunk-YPWHBBIS.js +0 -2
- package/dist/chunk-YSH6U3L4.js +0 -3
- package/dist/chunk-YU5DZUZI.js +0 -10
- package/dist/chunk-YWO5DDRC.js +0 -16
- package/dist/chunk-ZF5KHH7C.js +0 -2
- package/dist/chunk-ZOHS7AQV.js +0 -21
- package/dist/code-MI6F2TTU.js +0 -2
- package/dist/code-result-json-FXALY4HE.js +0 -2
- package/dist/dataflow-4KEMJPC6.js +0 -2
- package/dist/dependence-slice-R7FPWD5M.js +0 -2
- package/dist/deps-7EMQUYUT.js +0 -2
- package/dist/direct-navigation-6YO234F2.js +0 -3
- package/dist/entry-map-KOOLR26E.js +0 -2
- package/dist/files-OPIPJIGZ.js +0 -2
- package/dist/hierarchy-QPD2CAER.js +0 -2
- package/dist/imports-M6HUXRXC.js +0 -2
- package/dist/members-I5MEFOCT.js +0 -2
- package/dist/methods-5JYGGHXA.js +0 -2
- package/dist/output-continuation-command-UPQAAKBP.js +0 -3
- package/dist/output-pagination-3OFL2MJV.js +0 -19
- package/dist/project-reindex-UKKQ5PLS.js +0 -3
- package/dist/refs-PSU4JZZW.js +0 -2
- package/dist/refs-pagination-JG6CJMRC.js +0 -2
- package/dist/slice-HYRATV64.js +0 -2
- package/dist/surface-VTGDYWF5.js +0 -2
- package/dist/system-LRQNFOR2.js +0 -2
- package/dist/trace-F4B6OLL4.js +0 -2
- package/dist/value-flow-VRPZY72V.js +0 -2
package/dist/chunk-NWQXSFFU.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as te}from"./chunk-P5XHIJHI.js";import{A as St,B as gt,C as kn,a as vn,i as Dn,j as ge,k as Y,l as Ue,m as ne,n as re,o as Be,q as mt,r as qe,s as je,t as ie,u as Cn,v as Tn,w as We,x as Pn,y as yt}from"./chunk-WB3WYIRE.js";import{d as Mn}from"./chunk-KK7GPALL.js";import{a as Pe,b as ke,c as Ae,d as Fe,e as q,o as xn}from"./chunk-TRNAEQ6P.js";import{b as hn,e as $,f as Oe,h as In,j as Se,t as z,u as ee}from"./chunk-N2ZSIIGR.js";import{a as ye,n as Le,w as Rn,y as bn}from"./chunk-ODDUPDP7.js";import{D as gn,a as Ne,c as dn,d as mn,q as pt,z as Sn}from"./chunk-ZOHS7AQV.js";import{c as dt,d as me,e as V}from"./chunk-FESCRNVV.js";import{A as _e,a as ln,c as un,d as ut,h as ft,j as Z,s as fn,u as pn,v as _,x as yn,y as k}from"./chunk-JWTGMPIT.js";import{Aa as an,Ba as de,C as rn,D as H,E as we,Ea as cn,H as Ee,I as B,J as sn,O as ct,ca as lt,n as pe,q as N,wa as on}from"./chunk-N5B2NILC.js";import{randomUUID as Ni}from"crypto";import{existsSync as _i}from"fs";import{dirname as tr}from"path";function wn(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;if(typeof e.available!="boolean"||e.dependencyAvailable!==void 0&&typeof e.dependencyAvailable!="boolean"||e.tsconfigPath!==void 0&&typeof e.tsconfigPath!="string"||e.tsconfigPaths!==void 0&&(!Array.isArray(e.tsconfigPaths)||!e.tsconfigPaths.every(n=>typeof n=="string"))||e.resolvedBinary!==void 0&&typeof e.resolvedBinary!="string"||e.note!==void 0&&typeof e.note!="string")return null;if(e.available===!0){if(e.reason!==void 0)return null}else if(typeof e.reason!="string"||e.reason.length===0)return null;return e}import{performance as D}from"perf_hooks";function L(t,e,n){if(t.has(e))return t.get(e);let r=n();return t.set(e,r),r}import Fn from"path";import{realpathSync as En}from"fs";function ai(t,e){return t.getReferences().map(n=>{let r=n.getNode();return ze(r,e)})}function ci(t){let e=t;return typeof e.findReferences=="function"?e.findReferences():[]}function Nn(t,e,n,r){let i=[];for(let s of ci(t))for(let o of ai(s,r))o.file===e.relativePath&&o.line>=e.startLine&&o.line<=e.endLine||i.push(o);for(let s of n)i.push(s);return se(i)}function _n(t,e,n,r){let i=[],s=n?.getStart();for(let o of t.getReferences()){let a=o.getNode();oe(r,a.getSourceFile().getFilePath())===e&&(s!==void 0&&a.getStart()===s||i.push({location:ze(a,r),node:a}))}return i}function ze(t,e){let n=t.getSourceFile(),r=n.getLineAndColumnAtPos(t.getStart());return{file:oe(e,n.getFilePath())??n.getBaseName(),line:r.line-1,column:r.column-1}}function Ln(t,e,n){let r=t.getSourceFile(),i=bt(r,t),s=t.getText(),o=new RegExp(`\\b${ye(s)}\\b`,"g"),a=r.getFullText().split(`
|
|
2
|
-
`),l=[];for(let u=0;u<a.length;u++){if(u===i)continue;let f=a[u]??"";o.lastIndex=0;let c;for(;(c=o.exec(f))!==null;)l.push({file:e,line:u,column:c.index})}return se(l.filter(u=>oe(n,Fn.join(n,u.file))===e))}function Rt(t){for(let e=t;e;e=e.getParent()){let n=e.getKindName();if(n.includes("Type")||n==="InterfaceDeclaration"||n==="TypeAliasDeclaration")return!0;if(n==="CallExpression"||n==="NewExpression"||n==="ExpressionStatement")return!1}return!1}function bt(t,e){return t.getLineAndColumnAtPos(e.getStart()).line-1}function se(t){let e=new Set,n=[];for(let r of t){let i=`${r.file}:${r.line}:${r.column}`;e.has(i)||(e.add(i),n.push(r))}return n}function oe(t,e){let n=t||process.cwd(),r=An(n,e);if(r)return r;try{return An(En(n),En(e))}catch{return null}}function An(t,e){let n=Fn.relative(t,e).replace(/\\/g,"/");return!n||n===".."||n.startsWith("../")?null:n}function On(t,e,n,r){let i=li(e,r);return i.size===0?new Map:ui(t,n,i)}function li(t,e){let n=new Map;for(let r of z(t,e)){let i=$(r.symbol)??r.leaf;if(!i)continue;let s=n.get(i);s||(s=[],n.set(i,s)),s.push(r)}return n}function ui(t,e,n){let r=new Map,i=new Map;return e.forEachDescendant(s=>{for(let o of fi(t,s)){let a=n.get(o);if(!a)continue;let l=bt(e,s);for(let u of a){if(l<u.startLine-1||l>u.endLine+1)continue;let f=Math.abs(l-u.startLine),c=i.get(u.symbolId);c!==void 0&&c<=f||(i.set(u.symbolId,f),r.set(u.symbolId,s))}}}),r}function fi(t,e){let n=[],r=i=>{i&&!n.includes(i)&&n.push(i)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let i=e.getNameNode();r(i?.getText())}if("getName"in e&&typeof e.getName=="function"){let i=e.getName();r(i)}return t.Node.isIdentifier(e)&&r(e.getText()),n}var pi=un("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function Un(t,e,n,r){let i=Mt(t,e),s=ht(i.get(r)??[],n);if(s)return s;let o=[];for(let a of i.values())for(let l of a)((l.leaf||$(l.symbol)||"").includes(r)||l.symbol.includes(r))&&o.push(l);return ht(o,n)}function It(t,e,n,r){return ht(Mt(t,e).get(r)??[],n)}function Bn(t,e){let n=new Map;for(let[r,i]of Mt(t,e)){let s=i[0];s&&n.set(r,s)}return n}function Mt(t,e){return pi.get(t,e,()=>{let n=new Map;for(let r of z(t,e)){let i=r.leaf||$(r.symbol);if(!i)continue;let s=n.get(i);s||(s=[],n.set(i,s)),s.push({...r,leaf:i})}for(let r of n.values())r.sort((i,s)=>i.startLine-s.startLine||i.endLine-s.endLine||i.symbolId-s.symbolId);return n})}function ht(t,e){let n=null,r=Number.POSITIVE_INFINITY;for(let i of t){let s=Math.abs(i.startLine-e);(s<r||s===r&&n&&i.startLine<n.startLine)&&(n=i,r=s)}return n}import di from"path";import{realpathSync as mi}from"fs";function qn(t,e){let n=new Map,r=null,i=null,s=()=>(i??=Ne(t,{extensions:je}),i),o=()=>(r??=k("typescript.source-file-index",()=>yi(t.config.projectRoot,e,s()),()=>({projects:e.length,indexedDocuments:s().length})),r),a=l=>ie(l)?L(n,l,()=>{let u=jn(t.config.projectRoot,l);if(!u)return null;for(let{project:f,sourceFiles:c}of o()){let p=c.get(u)??null;if(p||(p=f.addSourceFileAtPathIfExists(u)??null,p&&vt(c,p)),p)return{project:f,sourceFile:p}}return null}):null;return{sourceFile:l=>a(l)?.sourceFile??null,sourceFileMatch:a,indexedTypeScriptLikeDocuments:s}}function yi(t,e,n){let r=e.map(({project:i})=>{let s=new Map;for(let o of i.getSourceFiles())vt(s,o);return{project:i,sourceFiles:s}});for(let i of n){let s=jn(t,i);if(s)for(let o of r){if(o.sourceFiles.has(s))break;let a=o.project.addSourceFileAtPathIfExists(s)??null;if(a){vt(o.sourceFiles,a);break}}}return r}function vt(t,e){let n=Dt(e.getFilePath());t.set(n,e);try{t.set(Dt(mi(n)),e)}catch(r){if(!de(r))throw r}}function jn(t,e){try{return Dt(on(t,e,{inputKind:"indexed TypeScript source file"}).absolutePath)}catch(n){if(!de(n))throw n;return null}}function Dt(t){return di.resolve(t)}function xt(t,e){for(let n of t)if(e===n.name||e.startsWith(`${n.name}/`))return n.name;return null}function Wn(t){let e=`${t.relativeDir}/src`;return[`${e}/index.ts`,`${e}/index.tsx`,`${e}/index.mts`,`${e}/index.cts`]}import{existsSync as Re}from"fs";import A from"path";var Ct=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function Tt(t,e){let r=e?A.dirname(A.join(t,e)):t,i=A.resolve(t);for(;r.startsWith(i);){for(let o of Ct){let a=A.join(r,o);if(Re(a))return a}let s=A.dirname(r);if(s===r)break;r=s}for(let s of Ct){let o=A.join(t,s);if(Re(o))return o}return null}function zn(t){let e=t.config.projectRoot,n=new Set(Si(e,t.config.semantic?.typescript?.tsconfigs)),r=Ne(t,{includeIgnored:!1,extensions:je});for(let i of r){let s=Tt(e,i);s&&n.add(A.resolve(s))}if(n.size===0){let i=Tt(e);i&&n.add(A.resolve(i))}return[...n].filter(i=>!Kn(e,i)).sort((i,s)=>i.localeCompare(s))}function Si(t,e=[]){let n=new Set;for(let r of e){let i=A.isAbsolute(r)?r:A.join(t,r);Re(i)&&n.add(A.resolve(i))}for(let r of gi(t))for(let i of Ct){let s=A.join(r,i);Re(s)&&n.add(A.resolve(s))}if(n.size===0){let r=Tt(t);r&&n.add(A.resolve(r))}return[...n].filter(r=>!Kn(t,r)).sort((r,i)=>r.localeCompare(i))}function gi(t){let e=A.join(t,"package.json");if(!Re(e))return[];let n;try{n=JSON.parse(sn(e,"project package manifest"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(i=>mn(t,i))}function Kn(t,e){let n=A.relative(t,e).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}var Ri=32;function Qn(t,e){let n=k("typescript.provider.load",()=>Cn());if(!n)return We("ts-morph is not installed");let r=k("typescript.provider.tsconfig-discovery",()=>zn(t));if(r.length===0)return We("no tsconfig found");try{let i=k("typescript.provider.project-bundles",()=>Tn(n,r),()=>({tsconfigs:r.length}));return bi(t,n,i)}catch(i){return We(i instanceof Error?i.message:String(i),r[0],r)}}function bi(t,e,n,r={}){return k("typescript.provider.construct",()=>new Pt(t,e,n),()=>({tsconfigs:n.length,reusedProjects:r.reusedProjects===!0}))}var Pt=class{constructor(e,n,r){this.db=e;this.tsMorph=n;this.projects=r;this.workspacePackages=dn(e.config.projectRoot),this.sourceFiles=qn(e,r)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return L(this.importUsageCache,e,()=>{let n=this.sourceFiles.sourceFile(e);if(!n)return[];let r=Ii();return k("typescript.import-usage.file",()=>this.importUsageForSourceFile(e,n,r),()=>({file:e,...r}))})}referencesFor(e){return L(this.referencesCache,e.symbolId,()=>{let n=this.nodeForDefinition(e);return this.referencesForDefinitionNode(e,n)})}referencesForDefinitions(e,n={}){let r=new Map,i=_(),s=[];for(let f of e){let c=this.referencesCache.get(f.symbolId);c?r.set(f.symbolId,c):s.push(f)}if(s.length===0)return r;let o=s,a=n.exact?[]:s.filter(f=>!Vn(f));if(a.length>=Ri){let f=this.referencesForDefinitionsBySymbolScan(a);for(let c of a){let p=f.get(c.symbolId)??[];this.referencesCache.set(c.symbolId,p),r.set(c.symbolId,p)}if(o=s.filter(c=>Vn(c)),o.length===0)return r}let l=new Map;for(let f of o){let c=l.get(f.relativePath);c?c.push(f):l.set(f.relativePath,[f])}let u=[];for(let[f,c]of l){let p=$n();k("typescript.references-map.file",()=>{let d=this.definitionNodesForFile(f);for(let y of c){i&&(p.cacheMisses+=1);let R=d.get(y.symbolId)??null;i&&(R?p.nodeHits+=1:p.nodeMisses+=1);try{let b=this.referencesForDefinitionNode(y,R,i?p:void 0);this.referencesCache.set(y.symbolId,b),r.set(y.symbolId,b)}catch{p.preciseSearchFailures+=1,u.push(y)}}},()=>({relativePath:f,definitions:c.length,...Jn(p)}))}if(u.length>0){let f=this.referencesForDefinitionsBySymbolScan(u);for(let c of u){let p=f.get(c.symbolId)??[];this.referencesCache.set(c.symbolId,p),r.set(c.symbolId,p)}}return r}referenceFragmentsForFiles(e){let n=ee(this.db).filter(s=>ie(s.relativePath)),r=e.filter(s=>this.sourceFiles.sourceFile(s)!==null),i=this.referencesForDefinitionsBySymbolScan(n,r);return Pn(n,i,r)}referencesForDefinitionsBySymbolScan(e,n){let r=_(),i=$n(),s=new Map,o=new Set(e.map(l=>l.symbolId)),a=new Map(e.map(l=>[l.symbolId,l]));for(let l of e)s.set(l.symbolId,[]);return k("typescript.references-map.inverted-scan",()=>{let l=r?D.now():0,u=n?this.packageImportReferencesForFiles(n):this.packageImportReferences();for(let b of e){let S=u.get(b.symbolId)??[];if(S.length>0){let M=s.get(b.symbolId)??[];M.push(...S),s.set(b.symbolId,M)}r&&(i.packageReferenceCount+=S.length)}r&&(i.packageRefsMs+=D.now()-l);let f=new Map,c=new Map,p=this.hierarchyTargetsForDefinitions(e),d=new Set(e.map(b=>b.leaf).filter(Boolean)),y=r?D.now():0;for(let b of n??this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(b))continue;let S=this.sourceFiles.sourceFile(b);S&&(r&&(i.scanFiles+=1),this.addReferencesFromSourceFileScan(S,b,o,a,p,d,f,c,s,r?i:void 0))}r&&(i.scanMs+=D.now()-y);let R=r?D.now():0;this.addHierarchyMemberReferences(e,s,r?i:void 0),r&&(i.hierarchyMs+=D.now()-R);for(let[b,S]of s){let M=se(S);s.set(b,M),r&&(i.referenceCount+=M.length)}},()=>({definitions:e.length,...Jn(i)})),s}addReferencesFromSourceFileScan(e,n,r,i,s,o,a,l,u,f){let c=this.compilerCheckerForSourceFile(e),p=e.compilerNode,d=Di(e),y=R=>{if(this.tsMorph.ts.isIdentifier(R)){if(f&&(f.identifiers+=1),!o.has(R.text)&&!d.has(R.text)){this.tsMorph.ts.forEachChild(R,y);return}let b=this.compilerReferenceSymbol(c,R,f);if(b){let S;a.has(b)?S=a.get(b)??null:(S=this.referenceDefinitionFromCompilerSymbol(b),a.set(b,S)),f&&(S?f.targetHits+=1:f.targetMisses+=1);let M=L(l,b,()=>this.compilerSymbolKeys(b)),w=null,h=null,C=S&&r.has(S.symbolId)?i.get(S.symbolId):void 0;if(C&&(w=Ke(p,R),!Hn(C,n,w))){let x=p.getLineAndCharacterOfPosition(R.getStart(p));h={file:n,line:x.line,column:x.character};let v=u.get(C.symbolId)??[];v.push(h),u.set(C.symbolId,v),f&&(f.requestedHits+=1)}for(let x of M)for(let v of s.get(x)?.values()??[]){if(w??=Ke(p,R),Hn(v,n,w))continue;if(!h){let m=p.getLineAndCharacterOfPosition(R.getStart(p));h={file:n,line:m.line,column:m.character}}let g=u.get(v.symbolId)??[];g.push(h),u.set(v.symbolId,g),f&&(f.requestedHits+=1)}}}this.tsMorph.ts.forEachChild(R,y)};y(p)}hierarchyTargetsMemo=null;hierarchyTargetsForDefinitions(e){let n=ki(e);if(this.hierarchyTargetsMemo?.key===n)return this.hierarchyTargetsMemo.targets;let r=Z(this.db),i=`definitions:${n}`,s=!1,o=k("typescript.references-map.hierarchy-targets",()=>{if(r){let l=Yn.read(this.db,i,r);if(l&&l.projectRoot===this.db.config.projectRoot)return s=!0,Pi(l,e)}let a=this.computeHierarchyTargets(e);return r&&Yn.write(this.db,i,r,{version:Xn,projectRoot:this.db.config.projectRoot,entries:[...a].map(([l,u])=>[l,[...u.values()].map(f=>f.symbol)])}),a},()=>({definitions:e.length,hit:s}));return this.hierarchyTargetsMemo={key:n,targets:o},o}computeHierarchyTargets(e){let n=new Map;for(let r of e){let i=this.nodeForDefinition(r),s=i?.compilerNode;if(!s||!this.isHierarchyMethod(s))continue;let o=s.parent;if(!this.isHierarchyContainer(o))continue;let a=this.compilerCheckerForSourceFile(i.getSourceFile()),l=a.getSymbolAtLocation(s.name);if(l)for(let u of this.hierarchyMemberSymbols(a,o,l))for(let f of this.compilerSymbolKeys(u)){let c=n.get(f)??new Map;c.set(r.symbolId,r),n.set(f,c)}}return n}hierarchyMemberSymbols(e,n,r){let i=new Set,s=new Set,o=(a,l,u)=>{if(!s.has(a)){s.add(a),i.add(l);for(let f of u){let c=f.getProperty(r.name);c&&o(f,c,this.hierarchyAncestorTypesForType(e,f))}}};return o(e.getTypeAtLocation(n),r,this.hierarchyAncestorTypes(e,n)),i}addHierarchyMemberReferences(e,n,r){let i=new Map;for(let s of e){let o=this.nodeForDefinition(s),a=o?.compilerNode;if(!a||!this.isHierarchyMethod(a))continue;let l=a.parent;if(!this.isHierarchyContainer(l))continue;let u=this.compilerCheckerForSourceFile(o.getSourceFile()),f=u.getSymbolAtLocation(a.name);if(!f)continue;let c=a.getSourceFile(),p=c.getLineAndCharacterOfPosition(a.name.getStart(c)),d={definition:s,location:{file:s.relativePath,line:p.line,column:p.character}},y=n.get(s.symbolId)??[];for(let b of this.hierarchyMemberSymbols(u,l,f))if(b!==f)for(let S of this.compilerSymbolLocations(b))y.push(S),r&&(r.hierarchyReferences+=1);n.set(s.symbolId,y);let R=this.hierarchyRootMemberSymbols(u,l,f);for(let b of R){let S=i.get(b)??new Map;S.set(s.symbolId,d),i.set(b,S)}r&&(r.hierarchyDefinitions+=1)}for(let s of i.values())if(!(s.size<2)){r&&(r.hierarchyFamilies+=1);for(let{definition:o}of s.values()){let a=n.get(o.symbolId)??[];for(let l of s.values())l.definition.symbolId!==o.symbolId&&(a.push(l.location),r&&(r.hierarchyReferences+=1));n.set(o.symbolId,a)}}}hierarchyRootMemberSymbols(e,n,r){let i=new Set,s=new Set,o=(a,l,u)=>{if(s.has(a))return;s.add(a);let f=!1;for(let c of u){let p=c.getProperty(r.name);p&&(f=!0,o(c,p,this.hierarchyAncestorTypesForType(e,c)))}if(!f)for(let c of this.compilerSymbolKeys(l))i.add(c)};return o(e.getTypeAtLocation(n),r,this.hierarchyAncestorTypes(e,n)),i}compilerSymbolKeys(e){return(e.declarations??[]).map(n=>{let r=n.getSourceFile();return`${r.fileName}\0${n.getStart(r)}\0${e.name}`})}compilerSymbolLocations(e){let n=[];for(let r of e.declarations??[]){let i=r.getSourceFile(),s=oe(this.db.config.projectRoot,i.fileName);if(!s)continue;let o=r.name,a=i.getLineAndCharacterOfPosition((o??r).getStart(i));n.push({file:s,line:a.line,column:a.character})}return n}baseTypes(e,n){try{return e.getBaseTypes(n)??[]}catch{return[]}}hierarchyAncestorTypes(e,n){let r=new Set(this.hierarchyAncestorTypesForType(e,e.getTypeAtLocation(n)));for(let i of n.heritageClauses??[])for(let s of i.types)r.add(e.getTypeAtLocation(s));return[...r]}hierarchyAncestorTypesForType(e,n){let r=new Set(this.baseTypes(e,n));for(let i of n.getSymbol()?.declarations??[])if(this.isHierarchyContainer(i))for(let s of i.heritageClauses??[])for(let o of s.types)r.add(e.getTypeAtLocation(o));return[...r]}isHierarchyMethod(e){return this.tsMorph.ts.isMethodDeclaration(e)||this.tsMorph.ts.isMethodSignature(e)}isHierarchyContainer(e){return this.tsMorph.ts.isClassDeclaration(e)||this.tsMorph.ts.isClassExpression(e)||this.tsMorph.ts.isInterfaceDeclaration(e)}compilerReferenceSymbol(e,n,r){r&&(r.symbolLookups+=1);let i=e.getSymbolAtLocation(n);if(i){if((i.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return i;try{return r&&(r.aliasResolutions+=1),e.getAliasedSymbol(i)}catch{return i}}}calleesFor(e){return L(this.calleesCache,e.symbolId,()=>L(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}calleesForDefinitions(e){let n=new Map,r=new Map;for(let i of e){let s=r.get(i.relativePath);s?s.push(i):r.set(i.relativePath,[i])}for(let[i,s]of r){let o=this.fileCalleesCache.get(i),a=new Set(s.map(u=>u.symbolId)),l=o??this.calleeMapForFile(i,a);for(let u of s){let f=l.get(u.symbolId)??[];this.calleesCache.set(u.symbolId,f),n.set(u.symbolId,f)}}return n}referencesForDefinitionNode(e,n,r){let i=r?D.now():0,s=this.packageImportReferencesForDefinition(e);if(r&&(r.packageRefsMs+=D.now()-i,r.packageReferenceCount+=s.length),!n)return s;let o=r?D.now():0,a=Nn(n,e,s,this.db.config.projectRoot);return r&&(r.semanticRefsMs+=D.now()-o,r.referenceCount+=a.length),a}signatureFor(e){return L(this.signatureCache,e.symbolId,()=>{let n=this.nodeForDefinition(e);if(!n||!this.tsMorph.Node.isFunctionDeclaration(n)&&!this.tsMorph.Node.isMethodDeclaration(n)&&!this.tsMorph.Node.isArrowFunction(n)&&!this.tsMorph.Node.isFunctionExpression(n)&&!this.tsMorph.Node.isConstructorDeclaration(n))return null;let r=n.getType().getCallSignatures()[0];if(!r)return null;let i=r.getParameters().map(o=>{let a=o.getDeclarations()[0],l=a?o.getTypeAtLocation(a).getText(a):o.getValueDeclaration()?.getType().getText()??"unknown";return Gn(l)}),s=r.getReturnType().getText(n);return`(${i.join(",")})=>${Gn(s)}`})}importUsageForSourceFile(e,n,r){let i=[],s=new Map;for(let o of n.getImportDeclarations()){r.declarations+=1;let a=pt(this.db,e,o.getModuleSpecifierValue()),l=o.getImportClause()?.isTypeOnly()??!1;for(let u of kt(o)){r.entries+=1;let f=l?null:u.identifier?.getSymbol()?.compilerSymbol??null;!l&&u.identifier&&(f?r.bindingSymbols+=1:r.missingBindingSymbols+=1);let c={sourcePath:a,entry:u,typeOnlyDeclaration:l,bindingSymbol:f,references:[]};if(i.push(c),l||!u.localName||!f)continue;let p=s.get(u.localName);p?p.push(c):s.set(u.localName,[c])}}return s.size>0&&n.forEachDescendant(o=>{if(o.getKindName()!=="Identifier")return;let a=s.get(o.getText());if(!a||Mi(o))return;r.scannedIdentifiers+=1;let l=o.getSymbol()?.compilerSymbol;if(r.symbolLookups+=1,!!l){for(let u of a)if(u.bindingSymbol===l){u.references.push({location:ze(o,this.db.config.projectRoot),node:o}),r.matchedReferences+=1;break}}}),i.map(o=>o.typeOnlyDeclaration?hi(e,o.sourcePath,o.entry):o.entry.identifier&&!o.bindingSymbol?(r.fallbackEntries+=1,this.valueImportUsageForEntry(e,o.sourcePath,o.entry)):this.valueImportUsageFromLocations(e,o.sourcePath,o.entry,o.references))}valueImportUsageForEntry(e,n,r){let i=r.identifier?r.identifier.findReferences():[],s=[];for(let o of i)for(let a of _n(o,e,r.identifier,this.db.config.projectRoot))s.push(a);return this.valueImportUsageFromLocations(e,n,r,s)}valueImportUsageFromLocations(e,n,r,i){let s=i.some(l=>!Rt(l.node)),o=i.some(l=>Rt(l.node)),a=r.isTypeOnly;return{importer:e,sourcePath:n,importedName:r.importedName,localName:r.localName,kind:r.kind,isTypeOnly:a,isUsed:a||i.length>0,isTypeUsed:a||o,isValueUsed:s,references:i.map(l=>l.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferencesForFiles(e){let n=new Map,r=new Set;for(let s of e){let o=this.sourceFiles.sourceFile(s);if(o)for(let a of o.getImportDeclarations()){let l=xt(this.workspacePackages,a.getModuleSpecifierValue());l&&r.add(l)}}if(r.size===0)return n;let i=this.packageExportsForNames(r);for(let s of e)this.addPackageImportReferencesForDocument(n,i,s);for(let[s,o]of n)n.set(s,se(o));return n}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,n=this.packageExports();for(let r of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,n,r);for(let[r,i]of e)e.set(r,se(i));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,n,r){if(this.db.isIgnored(r))return;let i=this.sourceFiles.sourceFileMatch(r);if(i)for(let s of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,n,r,s)}addPackageImportReferencesForDeclaration(e,n,r,i){let s=xt(this.workspacePackages,i.getModuleSpecifierValue());if(!s)return;let o=n.get(s);if(o)for(let a of kt(i)){if(a.kind!=="named"||!a.identifier)continue;let l=o.get(a.importedName);if(!l||l.size===0)continue;let u=Ln(a.identifier,r,this.db.config.projectRoot);u.length>0&&wi(e,l,u)}}packageExports(){return this.packageExportIndex?this.packageExportIndex:(this.packageExportIndex=this.packageExportsForNames(new Set(this.workspacePackages.map(e=>e.name))),this.packageExportIndex)}packageExportsForNames(e){let n=new Map;for(let r of this.workspacePackages){if(!e.has(r.name))continue;let i=new Map;for(let s of Wn(r))this.collectPackageExports(r,s,i,new Set);i.size>0&&n.set(r.name,i)}return n}collectPackageExports(e,n,r,i){if(i.has(n))return;i.add(n);let s=this.sourceFiles.sourceFile(n);if(s)for(let o of s.getExportDeclarations()){let a=o.getModuleSpecifierValue(),l=a?pt(this.db,n,a):n;if(!l||!l.startsWith(`${e.relativeDir}/src/`))continue;let u=o.getNamedExports();if(u.length===0){if(o.isNamespaceExport())continue;this.collectPackageExports(e,l,r,i);continue}for(let f of u){let c=f.getNameNode().getText(),p=f.getAliasNode()?.getText()??c,d=this.indexedDefinitionByLeaf(l,c);if(!d)continue;let y=r.get(p);y||(y=new Set,r.set(p,y)),y.add(d.symbolId)}}}indexedDefinitionByLeaf(e,n){return L(this.indexedDefinitionLeafCache,e,()=>Bn(this.db,e)).get(n)??null}nodeForDefinition(e){return L(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return L(this.fileDefinitionNodeCache,e,()=>{let n=this.sourceFiles.sourceFile(e);return n?On(this.tsMorph,this.db,n,e):new Map})}referenceDefinitionFromCompilerSymbol(e){return this.definitionFromCompilerSymbol(e,void 0,!0)}definitionFromCompilerSymbol(e,n,r=!1){let i=e.name,s=n?D.now():0,o=e.declarations??[];n&&(n.declarationsMs+=D.now()-s,n.declarationChecks+=o.length);for(let a of o){let l=n?D.now():0,u=a.getSourceFile(),f=oe(this.db.config.projectRoot,u.fileName),c=u.getLineAndCharacterOfPosition(a.getStart(u)).line;if(n&&(n.declarationLocationMs+=D.now()-l),!f||this.db.isIgnored(f))continue;let p=n?D.now():0,d=this.compilerDeclarationName(a),y=r?It(this.db,f,c,i)??(d&&d!==i?It(this.db,f,c,d):null):Un(this.db,f,c,i);if(n&&(n.indexedLookupMs+=D.now()-p),y)return{symbolId:y.symbolId,symbol:y.symbol,file:y.relativePath,line:y.startLine}}return null}compilerDeclarationName(e){let n=e.name;return n&&this.tsMorph.ts.isIdentifier(n)?n.text:null}calleeMapForFile(e,n){let r=_(),i=0,s=0,o=0,a=0,l=0,u=0,f=0,c=0,p=r?Ci():void 0;return k("typescript.callee-map.file",()=>{let d=r?D.now():0,y=this.sourceFiles.sourceFile(e);if(r&&(l=Math.round(D.now()-d)),!y)return new Map;let R=r?D.now():0,b=z(this.db,e).sort((g,m)=>g.startLine-m.startLine||m.endLine-g.endLine);if(r&&(u=Math.round(D.now()-R)),i=b.length,b.length===0)return new Map;let S=new Map,M=r?D.now():0,w=this.compilerCheckerForSourceFile(y),h=y.compilerNode;r&&(f=Math.round(D.now()-M));let C=new Map,x=g=>{if(this.tsMorph.ts.isCallExpression(g)||this.tsMorph.ts.isNewExpression(g)){r&&(s+=1);let m=this.semanticCalleeForCallNode(w,h,b,g,C,n,p);m&&(r&&(o+=1),vi(S,m.callerId,m.target))}this.tsMorph.ts.forEachChild(g,x)},v=r?D.now():0;x(h),r&&(c=Math.round(D.now()-v));for(let[g,m]of S)S.set(g,Ei(m));return a=S.size,S},()=>({relativePath:e,definitions:i,callNodes:s,resolvedCallees:o,outputRows:a,requestedDefinitions:n?.size??i,sourceFileLookupMs:l,definitionsLoadMs:u,checkerLookupMs:f,traversalMs:c,...p?Ti(p):{}}))}semanticCalleeForCallNode(e,n,r,i,s,o,a){let l=a?D.now():0,u=xi(r,Ke(n,i));if(a&&(a.callerLookupMs+=D.now()-l),!u)return null;if(o&&!o.has(u.symbolId))return a&&(a.skippedUnrequestedCallers+=1),null;let f=i.expression,c=this.compilerSymbolForExpression(e,f,a),p=null;if(c)if(a&&(a.targetSymbolHits+=1),s.has(c))a&&(a.compilerSymbolCacheHits+=1),p=s.get(c)??null;else{a&&(a.compilerSymbolCacheMisses+=1);let d=a?D.now():0;p=this.definitionFromCompilerSymbol(c,a),a&&(a.targetLookupMs+=D.now()-d),s.set(c,p)}else a&&(a.targetMisses+=1);return p?{callerId:u.symbolId,target:{symbol:p.symbol,file:p.file,line:p.line,callsiteLine:Ke(n,i)}}:null}compilerSymbolForExpression(e,n,r){let i=r?D.now():0,s=e.getSymbolAtLocation(n);if(r&&(r.expressionSymbolMs+=D.now()-i),s)return s;r&&(r.typeFallbacks+=1);let o=r?D.now():0,a=e.getTypeAtLocation(n).getSymbol();return r&&(r.typeSymbolMs+=D.now()-o),a}compilerCheckerForSourceFile(e){let n=e.getProject(),r=this.compilerCheckerCache.get(n);return r||(r=n.getTypeChecker().compilerObject,this.compilerCheckerCache.set(n,r)),r}};function kt(t){let e=[],n=t.getDefaultImport();n&&e.push({identifier:n,importedName:"default",localName:n.getText(),kind:"default",isTypeOnly:t.getImportClause()?.isTypeOnly()??!1});let r=t.getNamespaceImport();r&&e.push({identifier:r,importedName:"*",localName:r.getText(),kind:"namespace",isTypeOnly:t.getImportClause()?.isTypeOnly()??!1});for(let i of t.getNamedImports()){let s=i.getNameNode(),a=i.getAliasNode()??(s.getKindName()==="Identifier"?s:null);e.push({identifier:a,importedName:s.getText(),localName:a?.getText()??s.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(t.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function hi(t,e,n){return{importer:t,sourcePath:e,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ii(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function Mi(t){for(let e=t;e;e=e.getParent())if(e.getKindName()==="ImportDeclaration")return!0;return!1}function vi(t,e,n){let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}function Di(t){let e=new Set;for(let n of t.getImportDeclarations())for(let r of kt(n))r.localName&&e.add(r.localName);return e}function xi(t,e){let n=null;for(let r of t)e<r.startLine||e>r.endLine||(!n||r.startLine>=n.startLine)&&(n=r);return n}function Ke(t,e){return t.getLineAndCharacterOfPosition(e.getStart(t)).line}function Hn(t,e,n){return e===t.relativePath&&n>=t.startLine&&n<=t.endLine}function Vn(t){return t.symbol.includes("#")?Oe(t.symbol)==="type"&&t.relativePath.endsWith(".d.ts"):!1}function Ci(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function Ti(t){return{...t,callerLookupMs:Math.round(t.callerLookupMs),expressionSymbolMs:Math.round(t.expressionSymbolMs),typeSymbolMs:Math.round(t.typeSymbolMs),targetLookupMs:Math.round(t.targetLookupMs),declarationsMs:Math.round(t.declarationsMs),declarationLocationMs:Math.round(t.declarationLocationMs),indexedLookupMs:Math.round(t.indexedLookupMs)}}function $n(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0,preciseSearchFailures:0,hierarchyDefinitions:0,hierarchyFamilies:0,hierarchyReferences:0,hierarchyMs:0}}var Xn=1,Yn=me({kind:"typescript-hierarchy-targets",invalidation:V("typescript-hierarchy-targets"),serialize:t=>JSON.stringify(t),deserialize:t=>{try{let e=JSON.parse(t);return e.version!==Xn||typeof e.projectRoot!="string"||!Array.isArray(e.entries)?null:e}catch{return null}}});function Pi(t,e){let n=new Map(e.map(i=>[i.symbol,i])),r=new Map;for(let[i,s]of t.entries){let o=new Map;for(let a of s){let l=n.get(a);l&&o.set(l.symbolId,l)}o.size>0&&r.set(i,o)}return r}function ki(t){let e=2166136261;for(let n of t)e^=n.symbolId,e=Math.imul(e,16777619)>>>0;return`${t.length}:${e.toString(16)}`}function Jn(t){return{...t,scanMs:Math.round(t.scanMs),packageRefsMs:Math.round(t.packageRefsMs),semanticRefsMs:Math.round(t.semanticRefsMs),hierarchyMs:Math.round(t.hierarchyMs)}}function wi(t,e,n){for(let r of e){let i=t.get(r)??[];i.push(...n),t.set(r,i)}}function Ei(t){let e=new Set,n=[];for(let r of t){let i=`${r.symbol}|${r.file}|${r.line}|${r.callsiteLine??""}`;e.has(i)||(e.add(i),n.push(r))}return n}function Gn(t){return t.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}import{join as Ai}from"path";var He=3;var Fi="typescript-semantic";function Zn(t){let e=Ai(t,Fi),n=Ue(e);return{...n,requestDir:n.legacyRequestDir}}var Li=12e4,Oi=5;function nr(t,e,n={}){let r=new wt(t,n),i=null,s=null,o=process.env.SCIP_QUERY_SKIP_WATCH_SERVICE==="1",a=()=>(i??=Qn(t,e),i),l=(c,p,d)=>{if(o)return d();try{return p(r.request(c))}catch{return o=!0,d()}},u=(c,p)=>l({kind:"references",definitions:[...c],...p?.exact?{exact:!0}:{}},d=>er(d),()=>a().referencesForDefinitions?.(c,p)??new Map(c.map(d=>[d.symbolId,a().referencesFor(d)]))),f=c=>l({kind:"callees",definitions:[...c]},p=>er(p),()=>a().calleesForDefinitions?.(c)??new Map(c.map(p=>[p.symbolId,a().calleesFor(p)])));return{language:"typescript",availability:()=>(s??=l({kind:"availability"},qi,()=>a().availability()),s),importUsage:c=>l({kind:"import-usage",file:c},p=>p,()=>a().importUsage(c)),referencesFor:c=>u([c]).get(c.symbolId)??[],referencesForDefinitions:u,referenceFragmentsForFiles:c=>l({kind:"reference-fragments",files:[...c]},p=>Bi(p),()=>a().referenceFragmentsForFiles?.(c)??new Map),calleesFor:c=>f([c]).get(c.symbolId)??[],calleesForDefinitions:f,signatureFor:c=>l({kind:"signature",definition:c},ji,()=>a().signatureFor(c)),dispose:()=>i?.dispose?.()}}var wt=class{constructor(e,n={}){this.db=e;this.runtime=n.runtime??ir,this.timeoutMs=n.timeoutMs??Wi(),this.mailboxLimits=n.mailboxLimits??{},this.cacheDir=tr(e.config.dbPath),this.projectRoot=lt(e.config.projectRoot)}db;runtime;timeoutMs;cacheDir;projectRoot;mailboxLimits;request(e){let n=mt(this.cacheDir),r=Zn(this.cacheDir),i=qe(n.statePath);if(!Et(i,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript semantic service is not running.");let s=this.db.generation.identity;if(!s)throw new Error("Published TypeScript generation identity is unavailable.");let o=this.runtime.now(),a=o+this.timeoutMs,l=(this.runtime.monotonicNow??q)()+this.timeoutMs,u=yn(),f=ne("typescript-semantic-v3",{generation:s,profileEnvironment:u,request:e}),c=re(f),p=Be(r,{mailboxVersion:Y,operationKey:f,clientId:this.runtime.randomId(),enqueuedAtMs:o,deadlineAtMs:a,protocolVersion:He,id:c,generation:s,profileEnvironment:u,request:e},{nowMs:o,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??q)()<=l;){if(_i(p.responsePath))return Ui(B(p.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript semantic mailbox response"}),c,s,f);let d=qe(n.statePath);if(!Et(d,this.projectRoot,this.runtime))throw new Error("TypeScript semantic service stopped while processing a request.");this.runtime.sleep(Oi)}throw new Error(`TypeScript semantic service timed out after ${this.timeoutMs}ms.`)}};function rr(t){if(process.env.SCIP_QUERY_SKIP_WATCH_SERVICE==="1")return!1;try{let e=qe(mt(tr(t.config.dbPath)).statePath);return Et(e,lt(t.config.projectRoot),ir)}catch{return!1}}function Et(t,e,n){let r=t?.processIdentity?n.readProcessIdentity?.(t.pid):null;return t!==null&&t.projectRoot===e&&t.typescriptSemantic?.protocolVersion===He&&n.isProcessAlive(t.pid)&&(!t.processIdentity||r!=null&&ke(t.processIdentity,r))}function Ui(t,e,n,r){let i=JSON.parse(t);if(i.protocolVersion!==He||i.id!==e||i.operationKey!==r||i.ok===!0&&i.generation!==n)throw new Error("TypeScript semantic service wrote an incompatible response.");if(i.ok===!0)return i.response;throw new Error(typeof i.error=="string"?i.error:"TypeScript semantic service request failed.")}function er(t){if(!Array.isArray(t))throw new Error("TypeScript semantic service wrote an invalid numeric map.");return new Map(t)}function Bi(t){if(!Array.isArray(t))throw new Error("TypeScript semantic service wrote an invalid string map.");return new Map(t)}function qi(t){let e=wn(t);if(!e)throw new Error("TypeScript semantic service wrote invalid availability.");return e}function ji(t){if(t!==null&&typeof t!="string")throw new Error("TypeScript semantic service wrote an invalid signature.");return t}function Wi(){let t=Number(process.env.SCIP_TYPESCRIPT_SEMANTIC_TIMEOUT_MS);return Number.isInteger(t)&&t>0?t:Li}var ir={now:Date.now,monotonicNow:q,randomId:Ni,sleep(t){let e=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(e,0,0,t)},isProcessAlive:Fe,readProcessIdentity:Ae};function sr(t){let e=new Map,n=Ki(t),r=new Map;return i=>{let s=zi(i),o=r.get(s);if(o!==void 0)return o;if(!n.has(i.file))return r.set(s,i.symbol),i.symbol;let a=e.get(i.file);a||(a=Hi(z(t,i.file)),e.set(i.file,a));let l=Vi(a,i);return r.set(s,l),l}}function zi(t){return`${t.file}\0${t.symbol}\0${t.line}`}function Ki(t){return new Set(t.all("SELECT relative_path FROM documents").map(e=>e.relative_path))}function Hi(t){let e=new Map,n=new Map;for(let r of t){let i=e.get(r.leaf);i?i.push(r):e.set(r.leaf,[r]);let s=n.get(r.startLine);s?s.push(r):n.set(r.startLine,[r])}return{definitions:t,byLeaf:e,byStartLine:n}}function Vi(t,e){if(t.definitions.length===0)return e.symbol;let n=Ji(e.symbol),r=$i(t.byLeaf,n),i=Yi(r,e.line);if(i)return i.symbol;let s=t.byStartLine.get(e.line)??[];return s.length===1?s[0].symbol:e.symbol}function $i(t,e){let n=[],r=new Set;for(let i of e)for(let s of t.get(i)??[])r.has(s.symbolId)||(r.add(s.symbolId),n.push(s));return n}function Yi(t,e){let n=null;for(let r of t)if(!(r.startLine>e||r.endLine<e)){if(r.startLine===e)return r;(!n||r.endLine-r.startLine<n.endLine-n.startLine)&&(n=r)}return n}function Ji(t){let e=new Set([t]),r=t.split(/::|\.|#/).filter(Boolean).at(-1);return r&&e.add(r),e}function or(t,e){let r=bn(t,e).map(i=>Qi(e,i));return{usage:r,positions:Xi(t,e,r)}}function ar(t,e){return{importUsage(n){let r=t.importUsageFacts(n);if(!e||r.positions.length===0)return r.usage;let i=e.importDefinitionsForFile(n,r.positions);return i.available?Gi(r.usage,i.sourcePaths):r.usage}}}function Gi(t,e){return t.map((n,r)=>{let i=e.get(String(r));return i?{...n,sourcePath:i}:n})}function Qi(t,e){let n=e.isTypeOnly===!0,r=e.kind==="side-effect"||n||e.used;return{importer:t,sourcePath:e.sourcePath,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:n,isUsed:r,isTypeUsed:n,isValueUsed:e.kind==="side-effect"||!n&&e.used,references:[]}}function Xi(t,e,n){let r=gn(t,e);if(!r)return[];let i=Zi(r.rootNode),s=new Map;for(let a of i){let l=s.get(Ft(a.importedName,a.localName));l?l.push(a.position):s.set(Ft(a.importedName,a.localName),[a.position])}let o=[];return n.forEach((a,l)=>{let u=s.get(Ft(a.importedName,a.localName??a.importedName))?.shift();u&&o.push({...u,id:String(l),file:e})}),o}function Zi(t){let e=[];for(let n of t.descendantsOfType("use_declaration")){let r=n.namedChildren.find(i=>i.type!=="visibility_modifier");r&&e.push(...Ve(r,""))}return e.filter(n=>n.importedName!=="*")}function Ve(t,e){switch(t.type){case"identifier":case"super":case"self":case"crate":return[{importedName:t.text,localName:t.text,position:At(t,t.text)}];case"scoped_identifier":{let n=t.text.split("::").pop()??t.text;return[{importedName:n,localName:n,position:At(t,n)}]}case"scoped_use_list":{let n=t.namedChild(0),r=t.namedChild(1);if(!n||!r)return[];let i=Rn(e,n.text);return r.namedChildren.flatMap(s=>Ve(s,i))}case"use_list":return t.namedChildren.flatMap(n=>Ve(n,e));case"use_as_clause":{let n=t.namedChild(0),r=t.namedChild(1);return!n||!r?[]:Ve(n,e).map(i=>({...i,localName:r.text}))}case"use_wildcard":{let n=t.namedChild(0),r="*";return[{importedName:r,localName:r,position:At(n??t,r)}]}default:return[]}}function At(t,e){let n=Math.max(0,t.text.lastIndexOf(e));return{id:"",file:"",line:t.startPosition.row,column:t.startPosition.column+n+es(e)}}function es(t){return Math.max(0,Math.min(t.length-1,1))}function Ft(t,e){return`${t}\0${e}`}import{spawnSync as Kt}from"child_process";import{existsSync as Ht}from"fs";import{fileURLToPath as no}from"url";function $e(t){let e=Dn(vn,t),n=e.runnable;return n?{available:!0,dependencyAvailable:n,resolvedBinary:e.resolvedBinary??void 0,note:"rust-analyzer semantic reference queries are enabled."}:{available:!1,dependencyAvailable:n,resolvedBinary:e.resolvedBinary??void 0,reason:"rust-analyzer is not runnable; Rust semantic checks will use SCIP/source evidence only."}}import{existsSync as Bs,mkdtempSync as Er,rmSync as Bt}from"fs";import{tmpdir as Ar}from"os";import{join as qt}from"path";import{fileURLToPath as et,pathToFileURL as qs}from"url";import{SHARE_ENV as js,Worker as Ws}from"worker_threads";function K(t,e,n=new Set){let r=new Map;for(let i of t)n.has(i.symbolId)||r.set(i.symbolId,e.get(i.symbolId)??[]);return r}function J(t,e,n){let r=te(process.env.SCIP_RUST_SEMANTIC_BATCH_TIMEOUT_MS)??0;if(r>0)return r;let i=Math.max(1,Math.ceil(t/Math.max(1,n)));return Math.max(12e4,3e4+i*e)}import{spawn as bs}from"child_process";import{createHash as hs,randomUUID as Is}from"crypto";import{existsSync as Mr,realpathSync as Ms,rmSync as vs}from"fs";import{tmpdir as Ds}from"os";import{resolve as ce}from"path";import{execFileSync as cs}from"child_process";import{existsSync as ts}from"fs";import{deserializeSCIP as ns,SymbolRole as rs}from"@c4312/scip";import{realpathSync as yc}from"fs";import{basename as gc,dirname as Rc,join as bc,relative as hc,sep as Ic}from"path";import{fileURLToPath as vc,pathToFileURL as Dc}from"url";function Ye(t){let e=new Map;for(let n of t)e.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...e.values()].sort((n,r)=>{let i=n.file.localeCompare(r.file);return i!==0?i:n.line!==r.line?n.line-r.line:n.column-r.column})}var Nt=new WeakMap,is="SCIP_RUST_SCIP_OCCURRENCE_REFERENCE_MODE";function cr(t,e){let n=new Map,r=Je(),i=e.filter(o=>fr(o,r));if(i.length===0)return n;let s=pr(t);if(!s)return n;for(let o of i){let a=ur(s,o);a!==null&&n.set(o.symbolId,a)}return n}function lr(t,e){if(!fr(e,Je()))return null;let n=pr(t);return n?ur(n,e):null}function ur(t,e){return t.referencesBySymbol.get(e.symbol)??[]}function fr(t,e="safe"){if(!t.symbol.startsWith("rust-analyzer ")||!t.relativePath.endsWith(".rs")||Se(t.symbol)||/impl#\[[^\]]+\]\[Default\]default\(\)\.$/.test(t.symbol))return!1;if(e==="all")return!0;let n=Oe(t.symbol);if(n==="method")return!0;if(n!=="term")return!1;let r=hn(t.symbol);return"kind"in r?!1:!ss(r)}function ss(t){for(let e=0;e<t.descriptors.length-1;e+=1)if(t.descriptors[e]?.suffix==="type")return!0;return!1}function pr(t){if(Nt.has(t))return Nt.get(t)??null;let e=os(t);return Nt.set(t,e),e}function os(t){if(!t.generation.indexPath||!ts(t.generation.indexPath))return null;try{let e=ns(Ee(t.generation.indexPath,{inputKind:"SCIP occurrence-reference index",maxBytes:we})),n=new Map;for(let r of e.documents??[]){let i=r.relativePath;if(!(!i||t.isIgnored(i)))for(let s of r.occurrences??[]){if(!s.symbol||(s.symbolRoles&rs.Definition)!==0)continue;let o=as(i,s.range);if(!o)continue;let a=n.get(s.symbol)??[];a.push(o),n.set(s.symbol,a)}}for(let[r,i]of n)n.set(r,Ye(i));return{referencesBySymbol:n}}catch{return null}}function as(t,e){if(e.length<3)return null;let n=e[0],r=e[1];return!Number.isInteger(n)||!Number.isInteger(r)?null:{file:t,line:n,column:r}}function Je(){return process.env[is]==="all"?"all":"safe"}var dr=new Map;function _t(t){let n=$e(t).resolvedBinary??null;return{engine:"rust-analyzer",resolvedBinary:n,version:n?ls(t,n):"unavailable"}}function Lt(t){return{..._t(t),scipOccurrenceReferenceMode:Je()}}function ls(t,e){let n=`${t}\0${e}`,r=dr.get(n);if(r)return r;let i;try{i=cs(e,["--version"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim()}catch{i="unknown"}return dr.set(n,i),i}import{createHash as us}from"crypto";var fs=new Set(["Cargo.lock","Cargo.toml","rust-project.json","rust-toolchain","rust-toolchain.toml"]);function mr(t){let e=cn(t,{includePath:ps});return us("sha256").update(JSON.stringify(e)).digest("hex")}function ps(t){let e=t.replaceAll("\\","/"),n=e.split("/").at(-1)??e;return e.endsWith(".rs")||fs.has(n)?!0:e===".cargo/config"||e===".cargo/config.toml"||e.endsWith("/.cargo/config")||e.endsWith("/.cargo/config.toml")}import{createHash as ds}from"crypto";import{resolve as ms}from"path";var ae=3;function Ut(t){return ds("sha256").update(ge({kind:"scip-query-durable-rust-mailbox",protocolVersion:ae,sessionDir:ms(t)})).digest("hex")}function gr(t,e){return pe(t)?t.protocolVersion!==ae?Sr(t.protocolVersion===void 0?"helper wrote a prior uncorrelated response protocol":`helper wrote unsupported response protocol ${String(t.protocolVersion)}`):t.mailboxVersion!==Y||t.id!==e.requestId||t.operationKey!==e.operationKey||t.sessionIdentity!==e.sessionIdentity||t.deadlineAtMs!==e.deadlineAtMs?Sr("helper wrote an incompatible response identity"):typeof t.completedAtMs!="number"||!Number.isFinite(t.completedAtMs)||t.completedAtMs>e.deadlineAtMs||e.nowMs>e.deadlineAtMs?{ok:!1,code:"expired-request",error:"helper response arrived after the durable request deadline"}:t.ok===!1?typeof t.error!="string"||!Rs(t.errorCode)?Ot("helper wrote an invalid rejection response"):{ok:!1,code:t.errorCode,error:t.error}:t.ok!==!0||t.session!=="created"&&t.session!=="reused"&&t.session!=="invalidated"||!ys(t.response,e.requestKind)?Ot("helper wrote an invalid success response"):{ok:!0,session:t.session,response:t.response}:Ot("helper wrote an invalid response object")}function ys(t,e){return!pe(t)||typeof t.available!="boolean"||t.available===!1&&(typeof t.reason!="string"||t.reason.length===0)||t.available===!0&&t.reason!==void 0?!1:e==="import-definitions"?Array.isArray(t.sourcePaths)&&t.sourcePaths.every(n=>Array.isArray(n)&&n.length===2&&typeof n[0]=="string"&&(n[1]===null||typeof n[1]=="string")):yr(t.references,Ss)&&(t.incompleteReferenceSymbolIds===void 0||Array.isArray(t.incompleteReferenceSymbolIds)&&t.incompleteReferenceSymbolIds.every(n=>Number.isSafeInteger(n)))&&(t.callees===void 0||yr(t.callees,gs))&&(t.signatures===void 0||Array.isArray(t.signatures)&&t.signatures.every(n=>Array.isArray(n)&&n.length===2&&Number.isSafeInteger(n[0])&&(n[1]===null||typeof n[1]=="string")))}function yr(t,e){return Array.isArray(t)&&t.every(n=>Array.isArray(n)&&n.length===2&&Number.isSafeInteger(n[0])&&Array.isArray(n[1])&&n[1].every(e))}function Ss(t){return pe(t)&&typeof t.file=="string"&&N(t.line)&&N(t.column)}function gs(t){return pe(t)&&typeof t.symbol=="string"&&typeof t.file=="string"&&N(t.line)&&(t.callsiteLine===void 0||N(t.callsiteLine))}function Rs(t){return t==="unsupported-protocol"||t==="malformed-request"||t==="expired-request"||t==="handler-error"}function Ot(t){return{ok:!1,code:"malformed-response",error:t}}function Sr(t){return{ok:!1,code:"incompatible-response",error:t}}var xs=5e3,vr=10,Cs=3e4;function Rr(t,e,n,r=Pr){let i=r.engineIdentity(t),s={protocolVersion:ae,projectRoot:r.canonicalProjectRoot(t),projectFingerprint:r.projectFingerprint(t),engine:{engine:i.engine,resolvedBinary:i.resolvedBinary,version:i.version},workerFingerprint:r.fileFingerprint(e),environment:xr(r.environment())};return{key:kr(ge(s)),...s}}function Ge(t,e,n,r){if(t.protocolVersion!==ae||!n(t.pid))return!1;if(!t.processIdentity)return!0;let i=r?.(t.pid);return i!=null&&ke(t.processIdentity,i)}function Dr(t,e,n){let r;try{r=ct(e,{maxBytes:H,inputKind:"Rust semantic engine artifact"})}catch{r="missing"}let i=kr(ge({projectRoot:ce(t),serverPath:ce(e),serverFingerprint:r})).slice(0,20);return ce(n,`scip-query-rust-session-${i}`)}function br(t){let e=t===void 0?Number.NaN:Number(t);return Number.isInteger(e)&&e>=0?e:0}function xr(t){return Object.fromEntries(Object.entries(t).filter(([e])=>Tr(e)).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,n??null]))}function Cr(t,e){let n=e.runtime??As,r=e.identityRuntime??Pr,i=Dr(t,e.serverPath,e.tempRoot??Ds()),s=!1,o=(a,l)=>{if(s)throw new Error("Durable Rust semantic session was already disposed.");return Ps(i,e.serverPath,e.semanticWorkerPath,a,l,n,e.mailboxLimits)};return{requestSemantic(a,l){let u=Rr(t,e.semanticWorkerPath,a,r),{readinessDeadlineMs:f,...c}=a;return o({kind:"semantic",identityKey:u.key,workerEnvironment:Ir(),request:{...c,referenceRetryTimeoutMs:Ts(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,a.referenceRetryTimeoutMs),settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?a.settleDelayMs:br(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:l},l)},requestImportDefinitions(a,l){let u=Rr(t,e.semanticWorkerPath,a,r),{readinessDeadlineMs:f,...c}=a;return o({kind:"import-definitions",identityKey:u.key,workerEnvironment:Ir(),request:{...c,settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?a.settleDelayMs:br(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:l},l)},shutdown(){s=!0}}}function Ts(t,e){return e!==void 0?e:t===void 0?Cs:void 0}function Ps(t,e,n,r,i,s,o={}){let a=s.now(),l=a+i,u=(s.monotonicNow??q)(),f=u+i,c=ne("rust-semantic-v3",r),p=re(c),d=Ue(t),y=Ut(t),R=Be(d,{mailboxVersion:Y,protocolVersion:ae,id:p,operationKey:c,clientId:s.randomId(),enqueuedAtMs:a,deadlineAtMs:l,sessionIdentity:y,request:r},{nowMs:a,limits:o});for(hr(t,e,n,f,s);(s.monotonicNow??q)()<=f;){if(Mr(R.responsePath)){let S=ks(B(R.responsePath,{maxBytes:o.maxItemBytes??H,inputKind:"durable Rust semantic mailbox response"}),{requestId:p,operationKey:c,sessionIdentity:y,deadlineAtMs:R.authoritativeDeadlineAtMs,requestKind:r.kind,nowMs:s.now()});if(!S.ok)throw new Error(S.error);return _()&&_e({type:"span",name:"rust.semantic.durable-session.request",durationMs:(s.monotonicNow??q)()-u,ok:!0,session:S.session,kind:r.kind}),S.response}let b=Qe(t);(!b||!Ge(b,s.now(),s.isProcessAlive,s.readProcessIdentity))&&hr(t,e,n,f,s),s.sleep(vr)}throw new Error(`Durable Rust semantic session timed out after ${(i/1e3).toFixed(0)}s.`)}function hr(t,e,n,r,i){let s=Qe(t);if(s&&Ge(s,i.now(),i.isProcessAlive,i.readProcessIdentity))return;vs(ce(t,"server.json"),{force:!0}),i.spawnServer(e,t,n);let o=i.monotonicNow??q,a=Math.min(r,o()+xs);for(;o()<=a;){let l=Qe(t);if(l&&Ge(l,i.now(),i.isProcessAlive,i.readProcessIdentity))return;i.sleep(vr)}throw new Error("Durable Rust semantic session helper did not become ready within 5s.")}function Qe(t){try{let e=JSON.parse(B(ce(t,"server.json"),{maxBytes:rn,inputKind:"durable Rust session state"}));if(typeof e.protocolVersion!="number"||e.sessionIdentity!==void 0&&(typeof e.sessionIdentity!="string"||e.sessionIdentity!==Ut(t))||typeof e.pid!="number"||typeof e.heartbeatAtMs!="number"||e.busyUntilMs!==void 0&&typeof e.busyUntilMs!="number"||e.mailbox!==void 0&&!ws(e.mailbox))return null;let n=e.processIdentity===void 0?null:Pe(e.processIdentity);return e.processIdentity!==void 0&&(!n||n.pid!==e.pid)?null:{protocolVersion:e.protocolVersion,...e.sessionIdentity===void 0?{}:{sessionIdentity:e.sessionIdentity},pid:e.pid,...n?{processIdentity:n}:{},heartbeatAtMs:e.heartbeatAtMs,...e.busyUntilMs===void 0?{}:{busyUntilMs:e.busyUntilMs},...e.mailbox===void 0?{}:{mailbox:e.mailbox}}}catch{return null}}function ks(t,e){try{return gr(JSON.parse(t),e)}catch(n){return{ok:!1,code:"malformed-response",error:`helper wrote malformed JSON: ${n instanceof Error?n.message:String(n)}`}}}function ws(t){if(!t||typeof t!="object")return!1;let e=t;return N(e.pending)&&N(e.inflight)&&N(e.responses)&&N(e.deadLetters)&&N(e.invalid)&&N(e.totalItems)&&typeof e.totalBytes=="number"&&Number.isFinite(e.totalBytes)&&e.totalBytes>=0&&(e.oldestPendingAt===void 0||Number.isFinite(Date.parse(e.oldestPendingAt)))}function Ir(){return Object.fromEntries(Object.entries(process.env).filter(([t])=>Es(t)).sort(([t],[e])=>t.localeCompare(e)).map(([t,e])=>[t,e??null]))}function Tr(t){return t==="HOME"||t==="PATH"||t.startsWith("CARGO_")||t.startsWith("RA_")||t.startsWith("RUST")}function Es(t){return Tr(t)||t.startsWith("SCIP_RUST_")||t==="SCIP_QUERY_PROFILE"||t==="SCIP_QUERY_PROFILE_CACHE_STATE"||t==="SCIP_QUERY_PROFILE_COMMAND"||t==="SCIP_QUERY_PROFILE_OUT"||t==="SCIP_QUERY_PROFILE_RUN_ID"||t==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY"||t==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND"||t==="SCIP_QUERY_PROFILE_MIN_MS"}var Pr={canonicalProjectRoot(t){try{return Ms(t)}catch{return ce(t)}},projectFingerprint(t){return mr(t)},engineIdentity:_t,fileFingerprint(t){return ct(t,{maxBytes:H,inputKind:"Rust semantic engine artifact"})},environment(){return xr(process.env)}},As={now:Date.now,monotonicNow:q,randomId:Is,isProcessAlive:Fe,readProcessIdentity:Ae,spawnServer(t,e,n){if(!Mr(t))throw new Error(`Durable Rust semantic session helper was not found at ${t}. Run npm run build first.`);bs(process.execPath,[t,e,n],{detached:!0,stdio:"ignore"}).unref()},sleep(t){let e=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(e,0,0,t)}};function kr(t){return hs("sha256").update(t).digest("hex")}import{randomUUID as ml}from"crypto";import{readdirSync as Fs,rmSync as Sl,writeFileSync as gl}from"fs";import{join as Ns}from"path";var _s="rust-analyzer-owner-",Ls=".json",Os=16*1024;async function wr(t,e){if(!t)return[];let n;try{n=Fs(t)}catch{return[]}let r=n.filter(o=>o.startsWith(_s)&&o.endsWith(Ls)).map(o=>Ns(t,o)),i=[],s=[];for(let o of r){let a=Us(o);a?s.push(a):i.push({reaped:!1,reason:"identity-unavailable",detail:`Rust analyzer ownership record ${o} could not be validated.`})}return i.push(...await Promise.all(s.map(o=>xn(o,e)))),i}function Us(t){try{let e=B(t,{maxBytes:Os,inputKind:"rust-analyzer process ownership record"}),n=JSON.parse(e),r=Pe(n.rootIdentity);return n.version!==1||!r||typeof n.ownsProcessGroup!="boolean"?null:{rootPid:r.pid,rootIdentity:r,ownsProcessGroup:n.ownsProcessGroup,knownMembers:new Map([[r.pid,r]])}}catch{return null}}var Fr=15e3,Nr=8,Lr=5e3,zs=64,Ks=96,Wt=class{constructor(e,n,r={}){this.projectRoot=e;this.status=n;this.opts=r;this.requester=r.requester??Ys(e,process.env.SCIP_RUST_SEMANTIC_DURABLE_SESSION)}projectRoot;status;opts;requester;referencesForDefinitions(e){let n=this.status(this.projectRoot);if(!n.available||!n.resolvedBinary)return{available:!1,resolvedBinary:n.resolvedBinary,reason:he(n),references:Ie(e)};try{let r=this.requestSession(n.resolvedBinary,e,{includeReferences:!0});return{...be(r),resolvedBinary:n.resolvedBinary,references:K(e,new Map(r.references),new Set(r.incompleteReferenceSymbolIds??[]))}}catch(r){return this.opts.fallbackReferenceResolver?.referencesForDefinitions(e)??{available:!1,resolvedBinary:n.resolvedBinary,reason:r instanceof Error?r.message:String(r),references:Ie(e)}}}calleesForDefinitions(e){let n=this.status(this.projectRoot);if(!n.available||!n.resolvedBinary)return{available:!1,resolvedBinary:n.resolvedBinary,reason:he(n),callees:Me(e)};try{let r=this.requestSession(n.resolvedBinary,e,{includeReferences:!1,includeCallees:!0});return{...be(r),resolvedBinary:n.resolvedBinary,callees:jt(e,new Map(r.callees??[]))}}catch(r){return this.opts.fallbackCalleeResolver?.calleesForDefinitions(e)??{available:!1,resolvedBinary:n.resolvedBinary,reason:r instanceof Error?r.message:String(r),callees:Me(e)}}}referencesAndCalleesForDefinitions(e,n){let r=this.status(this.projectRoot);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:he(r),references:Ie(e),callees:Me(n)};let i=[...e,...n];try{let s=this.requestSession(r.resolvedBinary,i,{includeReferences:e.length>0,includeCallees:n.length>0,referenceDefinitions:e,calleeDefinitions:n});return{...be(s),resolvedBinary:r.resolvedBinary,references:K(e,new Map(s.references),new Set(s.incompleteReferenceSymbolIds??[])),callees:jt(n,new Map(s.callees??[]))}}catch(s){return this.fallbackReferencesAndCallees(r,e,n,s)}}signaturesForDefinitions(e){let n=this.status(this.projectRoot);if(!n.available||!n.resolvedBinary)return{available:!1,resolvedBinary:n.resolvedBinary,reason:he(n),signatures:_r(e)};try{let r=this.requestSession(n.resolvedBinary,e,{includeReferences:!1,includeCallees:!1,includeSignatures:!0});return{...be(r),resolvedBinary:n.resolvedBinary,signatures:Zs(e,new Map(r.signatures??[]))}}catch(r){return this.opts.fallbackSignatureResolver?.signaturesForDefinitions(e)??{available:!1,resolvedBinary:n.resolvedBinary,reason:r instanceof Error?r.message:String(r),signatures:_r(e)}}}importDefinitionsForFile(e,n){let r=this.status(this.projectRoot);if(n.length===0)return r.available?{available:!0,resolvedBinary:r.resolvedBinary,sourcePaths:new Map}:{available:!1,reason:r.reason,resolvedBinary:r.resolvedBinary,sourcePaths:new Map};if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:he(r),sourcePaths:new Map(n.map(i=>[i.id,null]))};try{let i=this.requestImportDefinitions(r.resolvedBinary,e,n);return{...be(i),resolvedBinary:r.resolvedBinary,sourcePaths:new Map(i.sourcePaths)}}catch(i){return{available:!1,resolvedBinary:r.resolvedBinary,reason:i instanceof Error?i.message:String(i),sourcePaths:new Map(n.map(s=>[s.id,null]))}}}dispose(){this.requester.shutdown()}requestSession(e,n,r){let i=Xe(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Fr),s=Ze(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),o=Xe(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Nr),a=Ze(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(i,1e4)),l=r.referenceDefinitions?[...r.referenceDefinitions]:void 0,u=r.calleeDefinitions?[...r.calleeDefinitions]:void 0,f=r.signatureDefinitions?[...r.signatureDefinitions]:void 0,c=ve(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,...r}),p={projectRoot:this.projectRoot,rustAnalyzerBinary:e,definitions:[...n],...l?{referenceDefinitions:l}:{},...u?{calleeDefinitions:u}:{},...f?{signatureDefinitions:f}:{},requestTimeoutMs:i,...r.includeReferences!==!1&&s>0?{referenceRetryTimeoutMs:s}:{},diagnosticsTimeoutMs:a,settleDelayMs:c,concurrency:o,includeReferences:r.includeReferences,includeCallees:r.includeCallees,includeSignatures:r.includeSignatures},d=eo(p);return k("rust.semantic.session.request",()=>this.requester.requestSemantic(p,J(d,zt(i,p.referenceRetryTimeoutMs),o)),()=>({definitions:n.length,operationDefinitions:d,referenceDefinitions:p.referenceDefinitions?.length,calleeDefinitions:p.calleeDefinitions?.length,signatureDefinitions:p.signatureDefinitions?.length,references:p.includeReferences!==!1,callees:p.includeCallees===!0,signatures:p.includeSignatures===!0,referenceRetryTimeoutMs:p.referenceRetryTimeoutMs}))}fallbackReferencesAndCallees(e,n,r,i){let s=n.length===0?{available:!0,resolvedBinary:e.resolvedBinary,references:Ie(n)}:this.opts.fallbackReferenceResolver?.referencesForDefinitions(n),o=r.length===0?{available:!0,resolvedBinary:e.resolvedBinary,callees:Me(r)}:this.opts.fallbackCalleeResolver?.calleesForDefinitions(r);if(s&&o){let a={resolvedBinary:s.resolvedBinary??o.resolvedBinary??e.resolvedBinary,references:K(n,s.references),callees:jt(r,o.callees)};return s.available&&o.available?{available:!0,...a}:{available:!1,reason:(s.available?void 0:s.reason)??(o.available?void 0:o.reason)??"Rust semantic fallback was unavailable.",...a}}return{available:!1,resolvedBinary:e.resolvedBinary,reason:i instanceof Error?i.message:String(i),references:Ie(n),callees:Me(r)}}requestImportDefinitions(e,n,r){let i=Xe(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Fr),s=Xe(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Nr),o=Ze(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(i,1e4)),a=Ze(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,Lr),l={projectRoot:this.projectRoot,rustAnalyzerBinary:e,file:n,positions:[...r],requestTimeoutMs:i,diagnosticsTimeoutMs:o,settleDelayMs:a,concurrency:s};return k("rust.semantic.import-definitions.session.request",()=>this.requester.requestImportDefinitions(l,J(r.length,i,s)),()=>({file:n,positions:r.length}))}};function be(t){return t.available?{available:!0}:{available:!1,reason:t.reason}}function he(t){return t.available?"rust-analyzer binary path is unavailable.":t.reason}function Or(t,e,n={}){return new Wt(t,e,n)}function ve(t,e){let n=Br(t);if(n!==null)return n;let r=e.includeReferences!==!1;return r&&e.includeCallees!==!0&&e.includeSignatures!==!0&&e.definitionCount<=zs||r&&e.includeCallees===!0&&e.includeSignatures!==!0&&e.definitionCount<=Ks?0:Lr}function Hs(t){let e=t?.trim().toLowerCase(),n=e==="0"||e==="false"||e==="off"||e==="worker",r=e==="1"||e==="true"||e==="on"||e==="durable",i=e===void 0||e==="";return{transport:n||!i&&!r?"worker":"durable",source:i?"default":"environment",fallback:"worker",valid:i||n||r,optOut:"SCIP_RUST_SEMANTIC_DURABLE_SESSION=0"}}function Vs(t){return Hs(t).transport}function $s(t,e){let n=null,r=!1,i=!1,s=!1,o=()=>n??=e(),a=()=>{i||(t.shutdown(),i=!0)},l=(f,c,p)=>{let d=Xs(f);r=!0;try{a()}catch{}_()&&_e({type:"span",name:"rust.semantic.durable-session.request",durationMs:p,ok:!1,kind:c,session:"worker-fallback",reason:d})},u=(f,c,p)=>{if(s)throw new Error("Rust semantic failover session was already disposed.");if(r)return p(o());let d=performance.now();try{return c(t)}catch(y){l(y,f,performance.now()-d)}return p(o())};return{requestSemantic(f,c){return u("semantic",p=>p.requestSemantic(f,c),p=>p.requestSemantic(f,c))},requestImportDefinitions(f,c){return u("import-definitions",p=>p.requestImportDefinitions(f,c),p=>p.requestImportDefinitions(f,c))},shutdown(){if(s)return;s=!0;let f=[];try{a()}catch(c){f.push(c)}try{n?.shutdown()}catch(c){f.push(c)}if(f.length>0)throw f[0]}}}function Ys(t,e,n={worker:()=>Js(),durable:()=>Cr(t,{serverPath:et(to()),semanticWorkerPath:et(Ur())})}){return Vs(e)==="durable"?$s(n.durable(),n.worker):n.worker()}function Js(t={}){let e=null,n=null,r=1,i=!1,s=null,o=null,a=c=>{c&&Bt(c,{recursive:!0,force:!0})},l=()=>{if(s)return;let c=e,p=n;e=null,n=null;let d=c?c.terminate():Promise.resolve(0);s=Promise.allSettled([d,wr(p,{gracefulMs:1e3,forceMs:1e3})]).then(([y,R])=>{let S=(R.status==="fulfilled"?R.value:[{reaped:!1,detail:String(R.reason)}]).filter(M=>!M.reaped);if(y.status==="rejected"||S.length>0){o=new Error(`Rust semantic worker cleanup did not complete; ownership evidence remains at ${p??"unknown"}.`);return}a(p)}).finally(()=>{s=null})},u=()=>{if(e)return e;if(s)throw new Error("The previous Rust semantic session worker is still terminating; retry the request.");if(o)throw o;let c=t.semanticWorkerPath?qs(t.semanticWorkerPath):Ur();if(!Bs(et(c)))throw new Error(`Rust semantic session worker was not found at ${et(c)}. Run npm run build before using built semantic Rust queries.`);return n=Er(qt(Ar(),"scip-query-rust-session-")),e=new Ws(c,t.shareEnvironment?{env:js}:void 0),e.unref(),e},f=()=>{let c=n??Er(qt(Ar(),"scip-query-rust-session-"));return n=c,qt(c,`${r++}.json`)};return{requestSemantic(c,p){if(i)throw new Error("Rust semantic session was already disposed.");let d=u(),y=f(),R=new SharedArrayBuffer(4),b=new Int32Array(R);if(d.postMessage({kind:"semantic",request:c,responsePath:y,sharedBuffer:R}),Atomics.wait(b,0,0,p)==="timed-out")throw l(),new Error(`Rust semantic session worker timed out after ${(p/1e3).toFixed(0)}s`);try{let M=Gs(B(y,{maxBytes:H,inputKind:"Rust semantic worker response"}));if(!M.ok)throw new Error(M.error);return M.response}finally{Bt(y,{force:!0})}},requestImportDefinitions(c,p){if(i)throw new Error("Rust semantic session was already disposed.");let d=u(),y=f(),R=new SharedArrayBuffer(4),b=new Int32Array(R);if(d.postMessage({kind:"import-definitions",request:c,responsePath:y,sharedBuffer:R}),Atomics.wait(b,0,0,p)==="timed-out")throw l(),new Error(`Rust semantic import-definition session worker timed out after ${(p/1e3).toFixed(0)}s`);try{let M=Qs(B(y,{maxBytes:H,inputKind:"Rust import-definition worker response"}));if(!M.ok)throw new Error(M.error);return M.response}finally{Bt(y,{force:!0})}},shutdown(){if(i)return;if(i=!0,!e){a(n),n=null;return}let c=f(),p=new SharedArrayBuffer(4),d=new Int32Array(p);e.postMessage({kind:"shutdown",responsePath:c,sharedBuffer:p}),Atomics.wait(d,0,0,5e3),l()}}}function Gs(t){let e=JSON.parse(t);if(!e||typeof e!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let n=e;return n.ok===!0&&"response"in n?{ok:!0,response:n.response}:{ok:!1,error:typeof e.error=="string"?e.error:"Rust semantic session worker failed."}}function Qs(t){let e=JSON.parse(t);if(!e||typeof e!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let n=e;return n.ok===!0&&"response"in n?{ok:!0,response:n.response}:{ok:!1,error:typeof e.error=="string"?e.error:"Rust semantic session worker failed."}}function Xs(t){let e=t instanceof Error?`${t.name} ${t.message}`.toLowerCase():String(t).toLowerCase();return e.includes("readiness")?"readiness":e.includes("timeout")||e.includes("timed out")?"timeout":e.includes("helper")?"helper":"request"}function Ie(t){return new Map(t.map(e=>[e.symbolId,[]]))}function Me(t){return new Map(t.map(e=>[e.symbolId,[]]))}function _r(t){return new Map(t.map(e=>[e.symbolId,null]))}function jt(t,e){return new Map(t.map(n=>[n.symbolId,e.get(n.symbolId)??[]]))}function Zs(t,e){return new Map(t.map(n=>[n.symbolId,e.get(n.symbolId)??null]))}function eo(t){let e=0;return t.includeReferences!==!1&&(e+=(t.referenceDefinitions??t.definitions).length),t.includeCallees===!0&&(e+=(t.calleeDefinitions??t.definitions).length),t.includeSignatures===!0&&(e+=(t.signatureDefinitions??t.definitions).length),Math.max(1,e)}function zt(t,e){return e&&e>0?Math.max(t,e):t}function Ur(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}function to(){return new URL("./rust-semantic-session-server.js",import.meta.url)}function Xe(t,e){return te(t)??e}function Ze(t,e){return Br(t)??e}function Br(t){if(!t)return null;let e=Number(t);return Number.isInteger(e)&&e>=0?e:null}var Vt=15e3,$t=8;function zr(t,e={}){let n=e.status??$e,r=so(t,n),i=oo(t,n),s=ao(t,n),o=e.referenceResolver||e.calleeResolver||e.signatureResolver||!ro(e)?null:Or(t,n,{fallbackReferenceResolver:r,fallbackCalleeResolver:i,fallbackSignatureResolver:s}),a=e.referenceResolver??o??r,l=e.calleeResolver??o??i,u=e.signatureResolver??o??s,f=e.importUsageResolver??ar(e.sourceImportUsageResolver??io(),e.importDefinitionResolver??o),c=e.calleeSymbolResolver,p=e.sourceZeroCalleeOracle,d=e.scipOccurrenceCalleeOracle,y=new Map,R=new Map,b=null,S=null,M=()=>(b??=n(t),b),w=()=>{let g=M();return g.dependencyAvailable?S??g:g},h=g=>{if(g.length===0)return new Map;let m=xe(g);try{let I=a.referencesForDefinitions(m),T=M();return S=tt(T,I),I.available?new Map(I.references):K(m,I.references)}catch(I){let T=M();return S=De(T,I),G(m)}},C=g=>{if(g.length===0)return new Map;let m=xe(g),I=m.filter(qr);if(I.length===0)return Q(m);let T=new Map,W=Wr(I,d),F=[];for(let P of I)R.has(P.symbolId)?T.set(P.symbolId,R.get(P.symbolId)??[]):W.has(P.symbolId)?T.set(P.symbolId,W.get(P.symbolId)??[]):jr(P,p)?T.set(P.symbolId,[]):F.push(P);if(F.length===0)return le(m,T,void 0);try{let P=l.calleesForDefinitions(F),U=M();S=tt(U,P);let E=le(F,P.callees,c);for(let[fe,st]of E)T.set(fe,st);return le(m,T,void 0)}catch(P){let U=M();return S=De(U,P),Q(m)}},x=(g,m)=>{let I=xe(g),T=xe(m),W=T.filter(qr),F=new Map,P=Wr(W,d),U=[];for(let E of W)P.has(E.symbolId)?F.set(E.symbolId,P.get(E.symbolId)??[]):jr(E,p)?F.set(E.symbolId,[]):U.push(E);if(I.length===0&&U.length===0)return{references:G(I),callees:le(T,F,void 0)};try{let E=o?o.referencesAndCalleesForDefinitions(I,U):fo(a,l,{referenceDefinitions:I,calleeDefinitions:U}),fe=M();S=tt(fe,E);let st=E.available?new Map(E.references):K(I,E.references);for(let[ot,at]of E.callees)F.set(ot,at);let nn=le(T,F,c);for(let[ot,at]of nn)R.set(ot,at);return{references:st,callees:nn}}catch(E){let fe=M();return S=De(fe,E),{references:G(I),callees:Q(T)}}},v=g=>{if(g.length===0)return new Map;let m=xe(g);try{let I=u.signaturesForDefinitions(m),T=M();return S=tt(T,I),Kr(m,I.signatures)}catch(I){let T=M();return S=De(T,I),nt(m)}};return{language:"rust",availability:w,dispose:()=>{o?.dispose()},importUsage:g=>{let m=y.get(g);if(m)return m;try{let I=f.importUsage(g);return y.set(g,I),I}catch(I){let T=M();return S=De(T,I),[]}},referencesFor:g=>h([g]).get(g.symbolId)??[],referencesForDefinitions:h,referencesAndCalleesForDefinitions:x,calleesFor:g=>C([g]).get(g.symbolId)??[],calleesForDefinitions:C,signatureFor:g=>v([g]).get(g.symbolId)??null}}function tt(t,e){let n={dependencyAvailable:t.dependencyAvailable,resolvedBinary:e.resolvedBinary??t.resolvedBinary,...t.note?{note:t.note}:{}};return e.available?{available:!0,...n}:{available:!1,reason:e.reason,...n}}function De(t,e){return{available:!1,dependencyAvailable:t.dependencyAvailable,resolvedBinary:t.resolvedBinary,...t.note?{note:t.note}:{},reason:e instanceof Error?e.message:String(e)}}function ro(t){if(t.usePersistentSession!==void 0)return t.usePersistentSession;let e=process.env.SCIP_RUST_SEMANTIC_SESSION;return e!=="0"&&e!=="false"}function io(){return{importUsageFacts:()=>({usage:[],positions:[]})}}function xe(t){return t.map(e=>{let n=e;return{...e,leaf:typeof n.leaf=="string"?n.leaf:$(e.symbol),parentTypeName:n.parentTypeName??null,isFunctionLike:typeof n.isFunctionLike=="boolean"?n.isFunctionLike:In(e.symbol),isTypeLike:n.isTypeLike??!1,kind:n.kind??null,documentation:n.documentation??null,enclosingSymbol:n.enclosingSymbol??null}})}function qr(t){return t.isFunctionLike}function jr(t,e){if(!e)return!1;try{return e(t)}catch{return!1}}function Wr(t,e){if(!e||t.length===0)return new Map;try{return e(t)}catch{return new Map}}function so(t,e){return{referencesForDefinitions:n=>co(t,e,n)}}function oo(t,e){return{calleesForDefinitions:n=>lo(t,e,n)}}function ao(t,e){return{signaturesForDefinitions:n=>uo(t,e,n)}}function co(t,e,n){let r=e(t);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Gt(r),references:G(n)};let i=Yt();if(!Ht(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,references:G(n)};let s=ue(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Vt),o=rt(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),a=ue(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,$t),l=rt(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),u=ve(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,includeReferences:!0}),f={projectRoot:t,rustAnalyzerBinary:r.resolvedBinary,definitions:[...n],requestTimeoutMs:s,...o>0?{referenceRetryTimeoutMs:o}:{},diagnosticsTimeoutMs:l,settleDelayMs:u,concurrency:a},c=Kt(process.execPath,[i],{cwd:t,input:JSON.stringify(f),encoding:"utf8",maxBuffer:50*1024*1024,timeout:J(n.length,zt(s,f.referenceRetryTimeoutMs),a)}),p=Qt(c.stdout);if(p)return{...Jt(p),resolvedBinary:r.resolvedBinary,references:K(n,new Map(p.references),new Set(p.incompleteReferenceSymbolIds??[]))};let d=c.error instanceof Error?c.error.message:c.stderr.trim()||`Rust semantic worker exited with status ${c.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:d,references:G(n)}}function lo(t,e,n){let r=e(t);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Gt(r),callees:Q(n)};let i=Yt();if(!Ht(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,callees:Q(n)};let s=ue(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Vt),o=ue(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,$t),a=rt(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),l=ve(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,includeReferences:!1,includeCallees:!0}),u={projectRoot:t,rustAnalyzerBinary:r.resolvedBinary,definitions:[...n],requestTimeoutMs:s,diagnosticsTimeoutMs:a,settleDelayMs:l,concurrency:o,includeReferences:!1,includeCallees:!0},f=Kt(process.execPath,[i],{cwd:t,input:JSON.stringify(u),encoding:"utf8",maxBuffer:50*1024*1024,timeout:J(n.length,s,o)}),c=Qt(f.stdout);if(c)return{...Jt(c),resolvedBinary:r.resolvedBinary,callees:le(n,new Map(c.callees??[]),void 0)};let p=f.error instanceof Error?f.error.message:f.stderr.trim()||`Rust semantic worker exited with status ${f.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:p,callees:Q(n)}}function uo(t,e,n){let r=e(t);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Gt(r),signatures:nt(n)};let i=Yt();if(!Ht(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,signatures:nt(n)};let s=ue(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Vt),o=ue(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,$t),a=rt(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),l=ve(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,includeReferences:!1,includeCallees:!1,includeSignatures:!0}),u={projectRoot:t,rustAnalyzerBinary:r.resolvedBinary,definitions:[...n],requestTimeoutMs:s,diagnosticsTimeoutMs:a,settleDelayMs:l,concurrency:o,includeReferences:!1,includeCallees:!1,includeSignatures:!0},f=Kt(process.execPath,[i],{cwd:t,input:JSON.stringify(u),encoding:"utf8",maxBuffer:50*1024*1024,timeout:J(n.length,s,o)}),c=Qt(f.stdout);if(c)return{...Jt(c),resolvedBinary:r.resolvedBinary,signatures:Kr(n,new Map(c.signatures??[]))};let p=f.error instanceof Error?f.error.message:f.stderr.trim()||`Rust semantic worker exited with status ${f.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:p,signatures:nt(n)}}function fo(t,e,n){let r=n.referenceDefinitions.length>0?t.referencesForDefinitions(n.referenceDefinitions):{available:!0,references:G(n.referenceDefinitions)},i=n.calleeDefinitions.length>0?e.calleesForDefinitions(n.calleeDefinitions):{available:!0,callees:Q(n.calleeDefinitions)},s={resolvedBinary:r.resolvedBinary??i.resolvedBinary,references:r.references,callees:i.callees};return r.available&&i.available?{available:!0,...s}:{available:!1,reason:(r.available?void 0:r.reason)??(i.available?void 0:i.reason)??"Rust semantic resolution was unavailable.",...s}}function G(t){return new Map(t.map(e=>[e.symbolId,[]]))}function Q(t){return new Map(t.map(e=>[e.symbolId,[]]))}function nt(t){return new Map(t.map(e=>[e.symbolId,null]))}function le(t,e,n){let r=0,i=0;return k("rust.semantic.callees.complete-map",()=>{let s=new Map;for(let o of t){let a=e.get(o.symbolId)??[];a.length>0&&(r+=1),i+=a.length,s.set(o.symbolId,a.map(l=>({...l,symbol:n?n(l):l.symbol})))}return s},()=>({definitions:t.length,rows:r,callees:i,resolveSymbols:!!n}))}function Kr(t,e){return new Map(t.map(n=>[n.symbolId,e.get(n.symbolId)??null]))}function Yt(){return no(new URL("./rust-semantic-worker.js",import.meta.url))}function Jt(t){return t.available?{available:!0}:{available:!1,reason:t.reason}}function Gt(t){return t.available?"rust-analyzer binary path is unavailable.":t.reason}function Qt(t){try{let e=JSON.parse(t);if(!e||typeof e!="object")return null;let n=e;if(typeof n.available!="boolean"||!Array.isArray(n.references)||n.available===!1&&typeof n.reason!="string"||n.available===!0&&n.reason!==void 0)return null;let r={references:n.references,incompleteReferenceSymbolIds:Array.isArray(n.incompleteReferenceSymbolIds)?n.incompleteReferenceSymbolIds.filter(i=>typeof i=="number"):void 0,callees:Array.isArray(n.callees)?n.callees:void 0,signatures:Array.isArray(n.signatures)?n.signatures:void 0};return n.available===!0?{available:!0,...r}:{available:!1,reason:String(n.reason),...r}}catch{return null}}function ue(t,e){return te(t)??e}function rt(t,e){if(!t)return e;let n=Number(t);return Number.isInteger(n)&&n>=0?n:e}import{existsSync as po}from"fs";import{deserializeSCIP as mo,SymbolRole as yo}from"@c4312/scip";var Xt=new WeakMap;function Vr(t,e){let n=e.filter(So);if(n.length===0)return new Map;let r=!1,i=0,s=0;return k("rust.scip-occurrence.callees",()=>{let o=bo(t);if(r=!!o,!o)return new Map;let a=new Map;for(let l of n){let u=go(t,o,l);u!==null&&(a.set(l.symbolId,u),i+=1,s+=u.length)}return a},()=>({definitions:e.length,candidates:n.length,indexAvailable:r,resolvedDefinitions:i,resolvedCallees:s}))}function So(t){return!(!t.symbol.startsWith("rust-analyzer ")||!t.relativePath.endsWith(".rs")||!t.isFunctionLike||t.leaf==="main"||Se(t.symbol))}function go(t,e,n){let r=Le(t,n.relativePath);if(!r||r.language!=="rust")return null;let i=r.callables.find(u=>u.startLine!==n.startLine||u.endLine!==n.endLine?!1:u.name===n.leaf||n.leaf.endsWith(u.name)||u.name.endsWith(n.leaf));if(!i)return null;let s=r.callSites.filter(u=>u.line>=i.startLine&&u.line<=i.endLine);if(s.length===0)return null;let o=(e.occurrencesByFile.get(n.relativePath)??[]).filter(u=>u.line>=i.startLine&&u.line<=i.endLine&&u.callee.symbol!==n.symbol);if(o.some(u=>u.traitImplMember)||!Ro(s,o))return null;let a=[],l=new Set;for(let u of o){let f=`${u.callee.symbol}\0${u.callee.file}\0${u.callee.line}`;l.has(f)||(l.add(f),a.push(u.callee))}return a}function Ro(t,e){let n=Hr(t),r=Hr(e);if(n.size!==r.size)return!1;for(let[i,s]of n)if(r.get(i)!==s)return!1;return!0}function Hr(t){let e=new Map;for(let n of t){let r=n.calleeLeaf??n.leaf;if(!r)continue;let i=`${n.line}\0${r}`;e.set(i,(e.get(i)??0)+1)}return e}function bo(t){if(Xt.has(t))return Xt.get(t)??null;let e=ho(t);return Xt.set(t,e),e}function ho(t){if(!t.generation.indexPath||!po(t.generation.indexPath))return null;try{let e=ee(t).filter(s=>s.symbol.startsWith("rust-analyzer ")&&s.relativePath.endsWith(".rs")&&s.isFunctionLike),n=new Map(e.map(s=>[s.symbol,s])),r=mo(Ee(t.generation.indexPath,{inputKind:"SCIP occurrence-callee index",maxBytes:we})),i=new Map;for(let s of r.documents??[]){let o=s.relativePath;if(!o||!o.endsWith(".rs")||t.isIgnored(o))continue;let a=[];for(let l of s.occurrences??[]){if(!l.symbol||(l.symbolRoles&yo.Definition)!==0)continue;let u=n.get(l.symbol);if(!u)continue;let f=l.range?.[0];Number.isInteger(f)&&a.push({line:f,leaf:u.leaf,traitImplMember:Se(u.symbol),callee:{symbol:u.symbol,file:u.relativePath,line:u.startLine,callsiteLine:f}})}i.set(o,a)}return{occurrencesByFile:i}}catch{return null}}var it=class{sessions=new WeakMap;getOrCreate(e,n,r){let i=Io(e,n),s=this.sessions.get(e);s||(s=new Map,this.sessions.set(e,s));let o=s.get(i);if(o)return o.hits+=1,o.lastUsedAtMs=Date.now(),o.provider;let a=Date.now(),l=r();return s.set(i,{key:i,language:n,projectRoot:e.config.projectRoot,provider:l,createdAtMs:a,lastUsedAtMs:a,hits:1}),l}sessionsFor(e){return[...this.sessions.get(e)?.values()??[]]}clear(e){let n=this.sessions.get(e);if(n)for(let r of n.values())r.provider.dispose?.();this.sessions.delete(e)}};function Io(t,e){return`${t.config.projectRoot}:${e}-workspace`}var $r=new it;ln({name:"semantic-provider",groups:["semantic-provider"],clearAll:t=>$r.clear(t)});function X(t,e){let n=O(e)??"typescript";return $r.getOrCreate(t,n,()=>n==="rust"?zr(t.config.projectRoot,{sourceImportUsageResolver:{importUsageFacts:r=>or(t,r)},calleeSymbolResolver:sr(t),sourceZeroCalleeOracle:r=>Mo(t,r),scipOccurrenceCalleeOracle:r=>Vr(t,r)}):nr(t,e))}function O(t){return t?Sn(t)==="rust"?"rust":ie(t)?"typescript":null:"typescript"}function Mo(t,e){let n=Le(t,e.relativePath);if(!n||n.language!=="rust")return!1;let r=n.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine&&i.name===e.leaf)??n.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine);return r?!n.callSites.some(i=>i.line>=r.startLine&&i.line<=r.endLine):!1}var vo=/^[A-Za-z_][A-Za-z0-9_]*$/,Yr=/\bDefault::default\b/g,Do=/^\.\.\s*Default::default\b/;function Jr(t,e){let n=new Map,r=new Map;for(let i of e){let s=Zt(t,i,r);s!==null&&n.set(i.symbolId,s)}return n}function Zt(t,e,n=new Map){let r=Co(e.symbol);if(!r)return null;let i=Mn(t,[e.symbolId]);if(i.length===0)return null;let s=new RegExp(`(^|[^A-Za-z0-9_])${ye(r)}::default\\b`,"g"),o=new RegExp(`(^|[^A-Za-z0-9_])${ye(r)}\\s*$`),a=xo(t,e.symbolId),l=[];for(let u of i){let f=To(t,u.relative_path,n);if(f===null)return null;let c=f.split(/\r?\n/),p=0,d=[],y=0;for(let R=u.chunk_start;R<=u.chunk_end&&R<c.length;R+=1){let S=c[R]??"",M=new Set;s.lastIndex=0;let w;for(;w=s.exec(S);)l.push({file:u.relative_path,line:R,column:w.index+w[1].length+r.length+2}),y+=1;for(let h=0;h<S.length;h+=1){let C=Do.exec(S.slice(h));if(C){if(a&&d.includes(p)){let v=h+C[0].lastIndexOf("default");l.push({file:u.relative_path,line:R,column:v}),M.add(v),y+=1}h+=C[0].length-1;continue}let x=S[h];if(x==="{"){let v=o.test(S.slice(0,h));p+=1,v&&d.push(p);continue}if(x==="}")for(p=Math.max(0,p-1);d.length>0&&d[d.length-1]>p;)d.pop()}for(Yr.lastIndex=0;w=Yr.exec(S);){let h=w.index+9;if(!M.has(h))return null}}if(y===0)return null}return Ye(l)}function xo(t,e){return t.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",e)?.present===1}function Co(t){let e=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(t)?.[1]??null;return!e||!vo.test(e)?null:e}function To(t,e,n){if(n.has(e))return n.get(e)??null;let r=t.get("SELECT text FROM documents WHERE relative_path = ?",e),i=typeof r?.text=="string"?r.text:Po(t,e);return n.set(e,i),i}function Po(t,e){try{return an(t.config.projectRoot,e,{inputKind:"indexed Rust source file"})}catch(n){if(!de(n))throw n;return null}}function Gr(t){let e=new Map;for(let n of t){let r=e.get(n.relativePath)??[];r.push(n),e.set(n.relativePath,r)}return e}var ko="typescript-import-usage-v1",wo="typescript-signatures-v1",en=ut("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),Qr=me({kind:"semantic-import-usage",invalidation:V("semantic-import-usage"),serialize:t=>JSON.stringify(t),deserialize:si}),Xr=me({kind:"semantic-signatures",invalidation:V("semantic-signatures"),serialize:t=>JSON.stringify(t),deserialize:zo}),Zr=dt({kind:"typescript-import-usage",invalidation:V("typescript-import-usage"),serialize:t=>JSON.stringify(t),deserialize:si}),ei=dt({kind:"typescript-signatures",invalidation:V("typescript-signatures"),serialize:t=>JSON.stringify(t),deserialize:Ko}),Eo=256;function Eu(t,e={}){let n=e.coldFragmentLimit??Eo,r=kn(t);return r===null||r.missing<=n?{ready:!0}:(e.serviceAvailable??rr)(t)?{ready:!0}:{ready:!1,reason:`TypeScript reference fragments are cold for ${r.missing} of ${r.files} files and no watch service is running; run \`scip-query health --full\` once or start the service with \`scip-query watch --daemon\`, then re-run this command.`}}var Ao=ut("typescript-reference-map",{clearGroups:["whole-project"]});function Fo(t){return Ao.get(t,()=>{let e=Z(t);if(!e)return null;let n=ee(t).filter(i=>O(i.relativePath)==="typescript"),r=gt(t,n,i=>X(t,i));return r?{projectFingerprint:e,references:r.references,files:r.files,cacheHits:r.cacheHits,cacheMisses:r.cacheMisses,computedFiles:r.computedFiles}:null})}function Te(t){let e=new Map,n=new Set;return{capability:(r,i)=>oi(t,r,i),importUsage:r=>_o(t,r),references:r=>ni(t,r),materializeReferences:(r,i)=>ri(t,r,e,n,i),callerMap:r=>Lo(t,r,e,n),calleeMap:r=>qo(t,r),signature:r=>jo(t,r)}}function No(t,e){if(e.size===0)return;let n=en.get(t,()=>new Map);for(let[r,i]of e)n.set(r,[...i])}function Au(t,e){if(!en.has(t))return{hits:[],misses:[...e]};let n=en.get(t,()=>new Map),r=[],i=[];for(let s of e)n.has(s.symbolId)?r.push({definition:s,callees:n.get(s.symbolId)??[]}):i.push(s);return{hits:r,misses:i}}function Fu(t,e){return Te(t).importUsage(e)}function _o(t,e){if(O(e)==="typescript"){let s="fallback",o=0,a=0,l=0,u=0;return k("typescript.import-usage.materialize",()=>{let f=yt(t,e,ko);if(f?.key){o=1;let p=Zr.read(t,e,f.key);if(p)return s="hit",a=1,p;l=1;let d=j(t,e);if(!d)return s="unavailable",[];let y=d.importUsage(e);return Zr.write(t,e,f.key,y),s="computed",y}u=1;let c=j(t,e);return c?(s="direct-fallback",c.importUsage(e)):(s="unavailable",[])},()=>({state:s,eligible:o,cacheHits:a,cacheMisses:l,fallbacks:u}))}let n=ii(t,"semantic-import-usage",e);if(n){let s=Qr.read(t,e,n);if(s)return s}let r=j(t,e);if(!r)return[];let i=r.importUsage(e);return n&&Qr.write(t,e,n,i),i}function Nu(t,e){return Te(t).references(e)}function ni(t,e){let n=Zt(t,e);if(n)return n;let r=lr(t,e);if(r)return r;let i=j(t,e.relativePath);return i?i.referencesFor(e):[]}function _u(t,e){return Te(t).callerMap(e)}function Lu(t,e){let n=new Map,r=[];for(let i of e){if(O(i.relativePath)==="typescript"){r.push(i);continue}tn(t,n,i,ni(t,i))}if(r.length>0){let s=gt(t,r,o=>X(t,o))?.references;if(!s){let o=j(t,r[0].relativePath);s=o?o.referencesForDefinitions?o.referencesForDefinitions(r,{exact:!0}):new Map(r.map(a=>[a.symbolId,o.referencesFor(a)])):new Map,o&&_()&&St(t,r,s,a=>X(t,a))}for(let o of r)tn(t,n,o,s.get(o.symbolId)??[])}return n}function Lo(t,e,n=new Map,r=new Set){let i=new Map,s=ri(t,e,n,r),o=0;return k("semantic.callers.from-references",()=>{for(let a of e)o+=tn(t,i,a,n.get(a.symbolId)??[])},()=>({definitions:e.length,materialized:s.definitions,inMemoryHits:s.inMemoryHits,incompleteInMemoryHits:s.incompleteInMemoryHits,resultRows:i.size,callerFiles:o})),i}function ri(t,e,n,r,i={}){let s=Z(t),o=[],a=[],l=[],u=0,f=0,c=0,p=0,d=0,y=0,R=0,b=0,S=0,M=0,w=0,h=0,C=[],x=new Map,v=e.filter(m=>O(m.relativePath)==="typescript"&&!n.has(m.symbolId)&&!r.has(m.symbolId)),g=v.length>0?Fo(t):null;if(g){S=v.length,M=g.cacheHits,w=g.cacheMisses,h=g.computedFiles;for(let m of v)n.set(m.symbolId,g.references.get(m.symbolId)??[])}if(k("semantic.references.cache-scan",()=>{for(let[m,I]of Gr(e)){let T=[];for(let P of I)n.has(P.symbolId)?f+=1:r.has(P.symbolId)?b+=1:T.push(P);if(T.length===0){R+=1;continue}let W=Oo(t,s,m);if(!W){for(let P of T)O(P.relativePath)||(u+=1),l.push(P);continue}y+=1;let F=fn(t,m,W);for(let P of T){let U=F.get(P.symbol)??null;if(U!==null){let E=Bo(U);if(E){c+=1,n.set(P.symbolId,E);continue}p+=1}a.push({definition:P,cacheFingerprint:W})}}},()=>({definitions:e.length,skippedUnsupportedLanguage:u,cacheHits:c,parseFailures:p,misses:a.length,unkeyed:l.length,inMemoryHits:f,incompleteInMemoryHits:b,fullyInMemoryFiles:R,cacheReadFiles:y})),a.length>0||l.length>0){C=[...l,...a.map(m=>m.definition)],x=k("semantic.references.compute-misses",()=>{let m=Uo(t,C,i);return d=m.size,m},()=>({definitions:C.length,misses:a.length,unkeyed:l.length,rows:d}));for(let m of C)x.has(m.symbolId)?(n.set(m.symbolId,x.get(m.symbolId)??[]),r.delete(m.symbolId)):r.add(m.symbolId);for(let{definition:m,cacheFingerprint:I}of a)x.has(m.symbolId)&&oi(t,"semantic-references",m.relativePath).available&&o.push({relativePath:m.relativePath,symbol:m.symbol,projectFingerprint:I,payload:JSON.stringify(x.get(m.symbolId)??[])})}return o.length>0&&k("semantic.references.cache-write",()=>pn(t,o),()=>({entries:o.length})),x.size>0&&St(t,C,x,m=>X(t,m)),{definitions:e.length,inMemoryHits:f,incompleteInMemoryHits:b,cacheHits:c,misses:a.length,unkeyed:l.length,skippedUnsupportedLanguage:u,parseFailures:p,computed:d,incomplete:r.size,cacheWrites:o.length,fragmentDefinitions:S,fragmentCacheHits:M,fragmentCacheMisses:w,fragmentComputedFiles:h}}function Oo(t,e,n){if(!e)return null;let r=O(n);return r==="typescript"?e:r==="rust"?ft(JSON.stringify({kind:"semantic-references",language:r,engine:Lt(t.config.projectRoot),projectFingerprint:e})):null}function Uo(t,e,n={}){let r=_(),i=new Map,s=0,o=0,a=0,l=0,u=0,f=0,c=0,p=0,d=0;return k("semantic.references.provider-loop",()=>{let y=Jr(t,e),R=cr(t,e),b=new Map,S=n.prefetchCallees?new Map:null,M=[];for(let h of e){let C,x=()=>(C??=j(t,h.relativePath),C);if(S){let I=x();if(I?.referencesAndCalleesForDefinitions){let T=S.get(I);T?T.push(h):S.set(I,[h]),d+=1}}let v=y.get(h.symbolId);if(v){a+=1,l+=v.length,Ce(i,h.symbolId,v,r,I=>{c+=1,p+=I});continue}let g=R.get(h.symbolId);if(g){u+=1,f+=g.length,Ce(i,h.symbolId,g,r,I=>{c+=1,p+=I});continue}let m=x();if(!m){r&&(o+=1);continue}if(r&&(s+=1),m.referencesForDefinitions){let I=b.get(m);I?I.push(h):b.set(m,[h])}else M.push({provider:m,definition:h})}let w=new Set;if(S)for(let[h,C]of S){if(!h.referencesAndCalleesForDefinitions)continue;let x=b.get(h)??[],v=h.referencesAndCalleesForDefinitions(x,C);w.add(h),No(t,v.callees);for(let g of x){if(!v.references.has(g.symbolId))continue;let m=v.references.get(g.symbolId)??[];Ce(i,g.symbolId,m,r,I=>{c+=1,p+=I})}}for(let[h,C]of b){if(w.has(h))continue;let x=h.referencesForDefinitions(C);for(let v of C){if(!x.has(v.symbolId))continue;let g=x.get(v.symbolId)??[];Ce(i,v.symbolId,g,r,m=>{c+=1,p+=m})}}for(let{provider:h,definition:C}of M){let x=h.referencesFor(C);Ce(i,C.symbolId,x,r,v=>{c+=1,p+=v})}return i},()=>({definitions:e.length,providerHits:s,providerMisses:o,rustDefaultFastPathRows:a,rustDefaultFastPathReferences:l,rustScipOccurrenceFastPathRows:u,rustScipOccurrenceFastPathReferences:f,prefetchCalleeDefinitions:d,definitionsWithReferences:c,referenceCount:p,rows:i.size}))}function Ce(t,e,n,r,i){t.set(e,n),r&&n.length>0&&i(n.length)}function tn(t,e,n,r){let i=0;for(let s of r){if(s.file===n.relativePath||t.isIgnored(s.file))continue;let o=e.get(n.symbolId);o||(o=new Set,e.set(n.symbolId,o));let a=o.size;o.add(s.file),o.size!==a&&(i+=1)}return i}function Bo(t){try{return JSON.parse(t)}catch{return null}}function Ou(t,e){return Te(t).calleeMap(e)}function qo(t,e){let n=_(),r=new Map,i=0,s=0,o=0,a=0;return k("semantic.callees.provider-loop",()=>{let l=new Map,u=[];for(let f of e){let c=j(t,f.relativePath);if(!c){n&&(s+=1);continue}n&&(i+=1);let p=f;if(c.calleesForDefinitions){let d=l.get(c);d?d.push(p):l.set(c,[p])}else u.push({provider:c,definition:p})}for(let[f,c]of l){let p=f.calleesForDefinitions(c);for(let d of c){let y=p.get(d.symbolId)??[];ti(r,d.symbolId,y,n,R=>{o+=1,a+=R})}}for(let{provider:f,definition:c}of u){let p=f.calleesFor(c);ti(r,c.symbolId,p,n,d=>{o+=1,a+=d})}return r},()=>({definitions:e.length,providerHits:i,providerMisses:s,definitionsWithCallees:o,calleeCount:a,rows:r.size}))}function ti(t,e,n,r,i){n.length>0&&(t.set(e,n),r&&i(n.length))}function Uu(t,e){return Te(t).signature(e)}function jo(t,e){if(O(e.relativePath)==="typescript"){let o="fallback",a=0,l=0,u=0,f=0;return k("typescript.signature.materialize",()=>{let c=yt(t,e.relativePath,wo);if(c?.key){a=1;let d=ei.read(t,e.relativePath,c.key)??{};if(Object.prototype.hasOwnProperty.call(d,e.symbol))return o="hit",l=1,d[e.symbol]??null;u=1;let y=j(t,e.relativePath);if(!y)return o="unavailable",null;let R=y.signatureFor(e);return ei.write(t,e.relativePath,c.key,{...d,[e.symbol]:R}),o="computed",R}f=1;let p=j(t,e.relativePath);return p?(o="direct-fallback",p.signatureFor(e)):(o="unavailable",null)},()=>({state:o,eligible:a,cacheHits:l,cacheMisses:u,fallbacks:f}))}let n=ii(t,"semantic-signatures",e.relativePath),r=Wo(e);if(n){let o=Xr.read(t,r,n);if(o)return o.signature}let i=j(t,e.relativePath);if(!i)return null;let s=i.signatureFor(e);return n&&Xr.write(t,r,n,{signature:s}),s}function ii(t,e,n){let r=Z(t);if(!r)return null;let i=O(n);return i!=="rust"?null:ft(JSON.stringify({kind:e,language:i,engine:Lt(t.config.projectRoot),projectFingerprint:r}))}function Wo(t){return`${t.relativePath}\0${t.symbol}`}function si(t){try{let e=JSON.parse(t);return Array.isArray(e)?e:null}catch{return null}}function zo(t){try{let e=JSON.parse(t);if(!e||typeof e!="object")return null;let n=e.signature;return n!==null&&typeof n!="string"?null:{signature:n}}catch{return null}}function Ko(t){try{let e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e))return null;for(let n of Object.values(e))if(n!==null&&typeof n!="string")return null;return e}catch{return null}}function oi(t,e,n){let r=O(n);if(!r)return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:e,language:r,...X(t,n).availability()}}catch(i){return{slot:e,language:r,available:!1,reason:i instanceof Error?i.message:String(i)}}}function j(t,e){if(!O(e))return null;let n=X(t,e);return n.availability().available?n:null}export{Gr as a,Lt as b,O as c,Eu as d,Te as e,Au as f,Fu as g,Nu as h,_u as i,Lu as j,Uo as k,Ou as l,Uu as m};
|
|
3
|
-
//# sourceMappingURL=chunk-NWQXSFFU.js.map
|
package/dist/chunk-OLIWTZI3.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{B as te,C as Ee}from"./chunk-NOYBFVJA.js";import{C as K,Fe as re,Ge as Ae,H as Re,He as ne,Ie as Pe,J as Ie,Je as xe,Ke as ie,M as Q,Md as S,Nd as We,Od as L,Pd as X,Qd as M,Wa as ke,Wd as k,X as Y,Xd as G,Y as C,Z as be,aa as w,ba as Ce,ca as we,ha as A,if as Te,jf as qe,ke as Z,le as ee,me as R,ne as $,oe as j,tf as _e,u as v,ya as P}from"./chunk-66DVSJQG.js";import{spawn as Tt}from"child_process";import{existsSync as qt,rmSync as Ue}from"fs";import{dirname as _t,resolve as z}from"path";import{fileURLToPath as Dt}from"url";import{createHash as gt,randomUUID as oe}from"crypto";import{existsSync as vt,linkSync as St,readdirSync as Rt,rmSync as W}from"fs";import{basename as It,dirname as bt,join as m}from"path";var I=1,Ct=10*6e4,wt=10080*6e4,F="requests",x="claims",N="completions",Oe="staging";function Le(e,t,r={}){let n=r.now?.()??new Date,i=Et(r.ttlMs),o=At(r.idempotencyKey),a=o?`key-${gt("sha256").update(o).digest("hex")}`:`request-${(r.randomId??oe)()}`,s={version:I,requestId:a,...o?{idempotencyKey:o}:{},createdAt:n.toISOString(),deadlineAt:new Date(n.getTime()+i).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},c=Fe(e,a),d=ae(e,c,s,r.onStage);if(d.published)return{disposition:"accepted",request:s,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let l=se(c);if(!l)throw new Error(`Watch refresh request identity ${a} exists but is malformed.`);return{disposition:"duplicate",request:l}}function sr(e,t={}){let r=t.now?.()??new Date,n=`claim-${(t.randomId??oe)()}`,i=Math.max(1,Math.floor(t.limit??64)),o=$e(e).sort(Pt),a=[];for(let s of o){if(a.length>=i)break;if(De(e,s.requestId))continue;if(Date.parse(s.deadlineAt)<=r.getTime()){Ge(e,{version:I,requestId:s.requestId,outcome:"expired",completedAt:r.toISOString()});continue}let c={version:I,requestId:s.requestId,claimId:n,claimedAt:r.toISOString()};if(ae(e,He(e,s.requestId),c).published){if(De(e,s.requestId)){je(e,s.requestId,n);continue}a.push(s)}}return{claimId:n,requests:a}}function ar(e,t,r=()=>new Date,n){let i=r().toISOString();for(let o of t.requests)Ge(e,{version:I,requestId:o.requestId,claimId:t.claimId,outcome:"completed",completedAt:i});n?.("after-completion"),kt(e,t),n?.("after-claim-release")}function kt(e,t){for(let r of t.requests)je(e,r.requestId,t.claimId)}function cr(e){let t=0;for(let r of b(m(e,x)))W(r,{force:!0}),t++;return t>0&&C(m(e,x)),Ne(e),t}function dr(e){let t=$e(e),r=new Map,n=Wt(m(e,F),se);for(let c of b(m(e,N))){let d=H(c);if(!d){n++;continue}r.set(d.requestId,d)}let i=new Set;for(let c of b(m(e,x))){let d=Me(c);if(!d){n++;continue}i.add(d.requestId)}let o=t.filter(c=>!r.has(c.requestId)&&!i.has(c.requestId)),a=[...r.values()].filter(c=>c.outcome==="completed").length,s=[...r.values()].filter(c=>c.outcome==="expired").length;return{pending:o.length,claimed:t.filter(c=>!r.has(c.requestId)&&i.has(c.requestId)).length,completed:a,expired:s,invalid:n,...o.length>0?{oldestPendingAt:o.map(c=>c.createdAt).reduce((c,d)=>xt(c,d))}:{}}}function lr(e,t={}){let r=(t.now?.()??new Date).getTime(),n=Math.max(0,t.retentionMs??wt),i=0;for(let o of b(m(e,N))){let a=H(o);!a||r-Date.parse(a.completedAt)<n||(W(o,{force:!0}),W(Fe(e,a.requestId),{force:!0}),i++)}return i>0&&(C(m(e,N)),C(m(e,F))),Ne(e),i}function se(e){return ce(e,t=>{let r=t;return r.version===I&&T(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&P(r.createdAt)&&P(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function Me(e){return ce(e,t=>{let r=t;return r.version===I&&T(r.requestId)&&T(r.claimId)&&P(r.claimedAt)})}function H(e){return ce(e,t=>{let r=t;return r.version===I&&T(r.requestId)&&(r.claimId===void 0||T(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&P(r.completedAt)})}function Ge(e,t){let r=Ve(e,t.requestId);if(ae(e,r,t).published)return;let n=H(r);if(!n||n.requestId!==t.requestId||n.outcome!==t.outcome)throw new Error(`Watch refresh completion ${t.requestId} conflicts with an existing record.`)}function ae(e,t,r,n){let i=m(e,Oe),o=bt(t),a=Y(i),s=Y(o),c=m(i,`${It(t)}.${process.pid}.${oe()}.tmp`);try{let d=G(c,r,{spacing:2,trailingNewline:!0});n?.("after-staged");try{St(c,t)}catch(u){if(u.code==="EEXIST")return{published:!1};throw u}let l=be(a,s,d.directorySync,C(o));return n?.("after-published"),{published:!0,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}finally{W(c,{force:!0})}}function $e(e){let t=[];for(let r of b(m(e,F))){let n=se(r);n&&t.push(n)}return t}function je(e,t,r){let n=He(e,t),i=Me(n);!i||i.claimId!==r||(W(n,{force:!0}),C(m(e,x)))}function Ne(e){for(let t of b(m(e,Oe),".tmp"))W(t,{force:!0})}function Wt(e,t){return b(e).filter(r=>!t(r)).length}function b(e,t=".json"){return vt(e)?Rt(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(t)).map(r=>m(e,r.name)).sort():[]}function ce(e,t){try{let r=JSON.parse(v(e,"watch refresh request record"));return t(r)?r:null}catch{return null}}function Fe(e,t){return m(e,F,`${t}.json`)}function He(e,t){return m(e,x,`${t}.json`)}function Ve(e,t){return m(e,N,`${t}.json`)}function De(e,t){return H(Ve(e,t))!==null}function Et(e){if(e===void 0)return Ct;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function At(e){let t=e?.trim();return t?t.slice(0,512):void 0}function T(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function Pt(e,t){return Date.parse(e.createdAt)-Date.parse(t.createdAt)||e.requestId.localeCompare(t.requestId)}function xt(e,t){return Date.parse(t)<Date.parse(e)?t:e}var Be=5e3,Ot=6e3,Lt=1e3,le=10,Mt=new Set(["capabilities","check-deps","config-validate","continue","doctor","init","install-skills","reindex","setup","setup-agent","status","suppress","uninstall","watch"]);function xr(e){let t=e.classification;if(t.kind!=="live")return;let{state:r}=t;return r.watcher.state==="idle"&&r.lastError===void 0?r.indexGeneration:void 0}function Gt(e,t=process.env){return t.SCIP_QUERY_SKIP_WATCH_SERVICE!=="1"&&!e.startsWith("__")&&!Mt.has(e)}function Tr(e){let t=e.env??process.env;if(t.SCIP_QUERY_SKIP_WATCH_SERVICE==="1")return{kind:"skipped",reason:"environment"};if(!Gt(e.commandName,t))return{kind:"skipped",reason:"excluded-command"};if(e.config.watch?.enabled!==!0)return{kind:"skipped",reason:"disabled"};if(e.config.watch.autoStart===!1)return{kind:"skipped",reason:"auto-start-disabled"};try{let r=$t({projectRoot:e.projectRoot,cacheDir:e.cacheDir,cliVersion:e.cliVersion,gitContext:e.gitContext,runtime:e.runtime});return{kind:r.disposition,state:r.state}}catch(r){return{kind:"failed",message:r instanceof Error?r.message:String(r)}}}function Qe(e,t,r){let n=Q(z(e));if(r&&Q(r.projectRoot)===n)return{projectRoot:n,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:t};let i=Re(n);if(i.kind==="error")throw new Error(`Could not establish Git worktree identity for ${n}: ${i.message}`);return i.kind==="non-git"?{projectRoot:n,worktreeKind:"non-git",cliVersion:t}:{projectRoot:n,worktreeKind:"git",worktreeId:i.identity.worktreeId,cliVersion:t}}function qr(e){return U(e,Qe(e.projectRoot,e.cliVersion,e.gitContext))}function U(e,t){let r=e.runtime??fe,n=R(e.cacheDir),i=$(n.statePath),o=he(n.lockPath);return{identity:t,classification:jt(i,t,r.now(),r.isProcessAlive),lock:o,lockIsLive:o!==null&&r.isProcessAlive(o.pid),paths:n}}function $t(e){let t=e.runtime??fe,r=Qe(e.projectRoot,e.cliVersion,e.gitContext),n=U(e,r),i=ue("ensure",n.classification);if(i.kind==="reuse")return V(n.paths.activityPath,t),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${i.state.pid} is still alive but its heartbeat is old. Refusing automatic replacement because civil-clock age alone cannot authorize a process signal.`);if(i.kind==="replace")pe(i.state,e,t),q(n.paths,i.state.pid,t);else if(i.kind==="start"){if(n.lockIsLive){let s=ze(e,r,t,Math.min(e.startupTimeoutMs??1e3,1e3));if(s)return V(n.paths.activityPath,t),{disposition:"reused",state:s};throw new Error(`scip-query watch is already running for ${z(e.projectRoot)} (pid ${n.lock?.pid}; lock: ${n.paths.lockPath}) without compatible daemon state. Stop the foreground watcher before starting the service.`)}n.classification.kind==="stale"&&q(n.paths,n.classification.state.pid,t)}else throw new Error(`Unexpected ensure action: ${i.kind}`);if(n=U(e,r),i=ue("ensure",n.classification),i.kind==="reuse")return V(n.paths.activityPath,t),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${i.state.pid} remains alive with an old heartbeat; automatic replacement is not authorized.`);let o=e.serverPath??Dt(new URL("./watch-server.js",import.meta.url));t.spawnServer(o,r.projectRoot,e.cliVersion,e.watchOverrides??{});let a=ze(e,r,t,e.startupTimeoutMs??Be);if(!a)throw new Error(`scip-query watch service did not become ready within ${e.startupTimeoutMs??Be}ms.`);return V(n.paths.activityPath,t),{disposition:"started",state:a}}function Ye(e){let t=e.runtime??fe,r=R(e.cacheDir),n=$(r.statePath),i=n?Je(n,t)?{kind:"live",state:n}:{kind:"stale",state:n,reason:"dead-process"}:{kind:"stopped"},o=ue("stop",i);if(o.kind==="signal-stop")return pe(o.state,e,t),q(r,o.state.pid,t),{disposition:"stopped",pid:o.state.pid};if(o.kind==="clean-stale")return q(r,o.state.pid,t),{disposition:"stopped",pid:o.state.pid};let a=he(r.lockPath);return o.kind==="already-stopped"&&a?(Je(a,t)&&pe(a,e,t),q(r,a.pid,t),{disposition:"stopped",pid:a.pid}):{disposition:"already-stopped"}}function _r(e,t,r={}){let{durability:n="durable",...i}=r;n==="durable"?G(e,t,i):k(e,t,i)}function Xe(e,t=Date.now()){k(e,{version:1,at:new Date(t).toISOString()})}function Dr(e,t,r=Date.now(),n={}){Le(R(_t(e)).refreshRequestsPath,t,{...n,now:()=>new Date(r)}),Xe(e,r)}function Or(e){try{let t=JSON.parse(v(e,"watch activity record"));return t.version!==1||!j(t.at)||t.refreshRequestedAt!==void 0&&!j(t.refreshRequestedAt)||t.refreshDetail!==void 0&&typeof t.refreshDetail!="string"?null:{atMs:Date.parse(t.at),...t.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(t.refreshRequestedAt)},...t.refreshDetail===void 0?{}:{refreshDetail:t.refreshDetail}}}catch{return null}}function Lr(e,t,r={}){let n=r.pid??process.pid,i=r.isProcessAlive??S,o=()=>{},a=r.readProcessIdentity??X,s=r.now??(()=>new Date),c={...re,wallNow:()=>s().getTime(),isProcessAlive:i,readProcessIdentity:a},d=Ae(e,{kind:"watch",pid:n,processIdentity:a(n),detail:{projectRoot:z(t)},parseLegacy:B,runtime:c});if(d.kind==="contended"){let l=Ze(d.observation);return{acquired:!1,lockPath:e,message:Nt(e,t,l),release:o}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function he(e){return Ze(ne(e,{parseLegacy:B}))}var B=e=>{let t=et(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function Ze(e){if(e.state==="valid"&&e.record?.kind==="watch"){let t=e.record.detail?.projectRoot;return typeof t!="string"?null:{version:1,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},projectRoot:t,startedAt:e.record.startedAt}}return et(e.parsed)}function et(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!j(t.startedAt))return null;let r=t.processIdentity===void 0?null:We(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,pid:t.pid,...r?{processIdentity:r}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function jt(e,t,r,n){if(!e)return{kind:"stopped"};if(e.protocolVersion!==Z)return{kind:"incompatible",state:e,reason:"protocol"};if(e.projectRoot!==t.projectRoot)return{kind:"incompatible",state:e,reason:"project"};let i=t.worktreeKind==="git"?t.worktreeId:void 0;if(e.worktreeId!==i)return{kind:"incompatible",state:e,reason:"worktree"};if(e.cliVersion!==t.cliVersion)return{kind:"incompatible",state:e,reason:"cli-version"};if(!n(e.pid))return{kind:"stale",state:e,reason:"dead-process"};let o=Date.parse(e.heartbeatAt);return r-o>ee?{kind:"stale",state:e,reason:"old-heartbeat"}:{kind:"live",state:e}}function ue(e,t){switch(e){case"status":return{kind:"report",classification:t};case"ensure":switch(t.kind){case"stopped":return{kind:"start"};case"stale":return t.reason==="old-heartbeat"?{kind:"refuse-replace",state:t.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:t.state};case"incompatible":return{kind:"replace",state:t.state};default:return de(t)}case"stop":switch(t.kind){case"stopped":return{kind:"already-stopped"};case"stale":return t.reason==="old-heartbeat"?{kind:"signal-stop",state:t.state}:{kind:"clean-stale",state:t.state};case"live":case"incompatible":return{kind:"signal-stop",state:t.state};default:return de(t)}default:return de(e)}}function Mr(e){return e.idleTimeoutMs===0||e.watcher.state!=="idle"?!1:e.nowMs-e.lastActivityAtMs>=e.idleTimeoutMs}function ze(e,t,r,n){let i=r.monotonicNow??M,o=i()+n;for(;i()<=o;){let a=U(e,t).classification;if(a.kind==="live")return a.state;r.sleep(le)}return null}function pe(e,t,r){let{pid:n}=e;if(!r.isProcessAlive(n))return;Ke(e,r),r.signalProcess(n);let i=t.stopTimeoutMs??Ot,o=r.monotonicNow??M,a=o()+i;for(;o()<=a;){if(!r.isProcessAlive(n))return;r.sleep(le)}if(!r.forceSignalProcess)throw new Error(`scip-query watch service pid ${n} did not stop within ${i}ms and forced termination is unavailable.`);Ke(e,r),r.forceSignalProcess(n);let s=t.forceStopTimeoutMs??Lt,c=o()+s;for(;o()<=c;){if(!r.isProcessAlive(n))return;let d=r.readProcessIdentity(n);if(e.processIdentity&&d&&!L(e.processIdentity,d))return;r.sleep(le)}throw new Error(`scip-query watch service pid ${n} remained alive ${s}ms after forced termination.`)}function q(e,t,r){if(Ue(e.statePath,{force:!0}),Ue(e.activityPath,{force:!0}),he(e.lockPath)?.pid===t){let i={...re,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},o=ne(e.lockPath,{parseLegacy:B,runtime:i});Pe(e.lockPath,o,{parseLegacy:B,runtime:i})}}function Je(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||L(e.processIdentity,r)}function Nt(e,t,r){return`error: scip-query watch is already running for ${z(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}function V(e,t){try{(t.recordActivity??Xe)(e,t.now())}catch(r){let n=Ft(r);if(n!=="EPERM"&&n!=="EACCES"&&n!=="EROFS")throw r}}function Ft(e){return e.code}var fe={now:Date.now,monotonicNow:M,isProcessAlive:S,readProcessIdentity:X,spawnServer(e,t,r,n){if(!qt(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);Tt(process.execPath,[e,t,r,JSON.stringify(n)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function Ke(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its ownership record has no process identity.`);let r=t.readProcessIdentity(e.pid);if(!r)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity is unavailable.`);if(!L(e.processIdentity,r))throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity does not match the ownership record.`)}function de(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}import{existsSync as J,lstatSync as _,readdirSync as nt,realpathSync as tt,rmSync as E,statSync as it}from"fs";import{join as p,resolve as D,sep as ot}from"path";var Ht=3600*1e3,Vt=2*1024*1024*1024,st=300*1e3,Ut="gc-state.json",Bt="gc.lock";function zt(e){let t=e.leases.filter(s=>s.managed&&!s.live&&!s.busy),r=at(e.leases,e.locks),n={};for(let s of e.generations)r.has(s.generationId)||(n[s.generationId]=s.unreferencedAt??e.nowMs);let i=e.generations.filter(s=>!r.has(s.generationId)).sort((s,c)=>n[s.generationId]-n[c.generationId]||s.generationId.localeCompare(c.generationId)),o=new Set;for(let s of i)e.nowMs-n[s.generationId]>=e.policy.generationTtlMs&&o.add(s.generationId);let a=e.generations.filter(s=>!o.has(s.generationId)).reduce((s,c)=>s+c.size,0);for(let s of i){if(a<=e.policy.budgetBytes)break;o.has(s.generationId)||(o.add(s.generationId),a-=s.size)}for(let s of o)delete n[s];return{deleteWorktrees:t,deleteGenerations:e.generations.filter(s=>o.has(s.generationId)),deleteLocks:e.locks.filter(s=>!s.live),deleteTemporaries:e.temporaries.filter(s=>!s.live),protectedGenerationIds:[...r].sort(),unreferencedSince:n}}function at(e,t){let r=new Set(e.filter(n=>n.managed&&(n.live||n.busy)).flatMap(n=>[n.lease.baseGenerationId,n.lease.activeGenerationId]).filter(n=>n!==void 0));for(let n of t)n.live&&r.add(n.generationId);return r}function Xr(e,t,r={}){if(!we())return{kind:"disabled"};let n=r.repositoryId===void 0?K(e)?.repositoryId:r.repositoryId;if(!n)return{kind:"unavailable"};let i=p(w(),"repositories",n),o=(r.now??Date.now)(),a=J(i)?ct(e,i,n,t,o,r):{kind:"unavailable"};return Jt(e,n,t,o,r),a}function ct(e,t,r,n,i,o){let a=p(t,"gc-state.json"),s=lt(a);if(!o.force&&s&&i-Date.parse(s.lastSweepAt)<st)return{kind:"throttled",sweptAt:s.lastSweepAt};let c=xe(t,{now:()=>i});if(!c)return{kind:"busy"};try{let d=dt(e,t,r,s?.unreferencedSince??{}),l=zt({nowMs:i,...d,policy:{generationTtlMs:o.policy?.generationTtlMs??Ht,budgetBytes:o.policy?.budgetBytes??Vt}}),u=0,f=0;for(let h of l.deleteWorktrees){if(!ge(h.lease))continue;if(!J(h.lease.localCacheDir)){E(h.leasePath,{force:!0}),f+=1;continue}if(!Qt(h.lease))continue;let Se=ie(p(h.lease.localCacheDir,"cache-lifecycle.lock"));if(Se)try{if(me(h.lease,!0))continue;try{Ye({projectRoot:h.lease.projectRoot,cacheDir:h.lease.localCacheDir,cliVersion:n})}catch{continue}if(me(h.lease,!0))continue;E(h.lease.localCacheDir,{recursive:!0,force:!0}),E(h.leasePath,{force:!0}),f+=1}finally{Se.release()}}for(let h of l.deleteLocks)E(h.path,{force:!0});for(let h of l.deleteTemporaries)E(h.path,{recursive:!0,force:!0});for(let h of l.deleteGenerations)E(h.path,{recursive:!0,force:!0}),u+=h.size;ke(p(t,"evidence.db"));let g={kind:"swept",sweptAt:new Date(i).toISOString(),deletedWorktrees:f,deletedGenerations:l.deleteGenerations.length,deletedBytes:u,protectedGenerations:l.protectedGenerationIds.length},y={version:1,lastSweepAt:g.sweptAt,unreferencedSince:l.unreferencedSince,lastResult:g};return k(a,y,{spacing:2,trailingNewline:!0}),g}catch(d){return{kind:"failed",error:d instanceof Error?d.message:String(d)}}finally{c.release()}}function Jt(e,t,r,n,i){let o=p(w(),"repositories");if(!J(o))return;let a=p(o,Ut),s=Xt(a);if(!i.force&&s!==void 0&&n-s<st)return;let c=ie(p(o,Bt));if(c)try{for(let d of O(o)){if(d===t||!/^[a-f0-9]{24}$/.test(d))continue;let l=p(o,d),u;try{u=_(l)}catch{continue}if(!u.isDirectory()||u.isSymbolicLink())continue;let f=Yt(l)??e;ct(f,l,d,r,n,i)}k(a,{version:1,lastSweepAt:new Date(n).toISOString()},{spacing:2,trailingNewline:!0})}finally{c.release()}}function Zr(e,t,r){let n=Te(e,r.dbPath,t);if(n)return{state:"bypassed",reason:n,localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let i=K(e);if(!i)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let o=p(w(),"repositories",i.repositoryId),a=ve(p(o,"worktrees",`${i.worktreeId}.json`)),s=lt(p(o,"gc-state.json")),c=dt(e,o,i.repositoryId,s?.unreferencedSince??{}),d=at(c.leases,c.locks),l=c.generations.filter(y=>!d.has(y.generationId)),u=c.generations.reduce((y,h)=>y+h.size,0),f=qe(e,t),g=0;return f&&(g=Kt(f)),{state:"managed",repositoryId:i.repositoryId,worktreeId:i.worktreeId,localCacheDir:r.cacheDir,...a?{baseGenerationId:a.baseGenerationId,activeGenerationId:a.activeGenerationId,lastAction:a.lastAction,reason:a.lastReason,lastSeenAt:a.lastSeenAt}:{},generations:c.generations.length,generationBytes:u,protectedGenerations:c.generations.filter(y=>d.has(y.generationId)).length,unreferencedGenerations:l.length,unreferencedBytes:l.reduce((y,h)=>y+h.size,0),temporaryGenerations:c.temporaries.length,sharedEvidence:{path:f,exists:g>0,bytes:g},cleanup:s?.lastResult}}function Kt(e){return[e,`${e}-wal`,`${e}-shm`].reduce((t,r)=>{try{return t+it(r).size}catch{return t}},0)}function dt(e,t,r,n){let i=new Set(Ie(e).map(d=>D(d.path))),o=[];for(let d of O(p(t,"worktrees"))){if(!d.endsWith(".json"))continue;let l=p(t,"worktrees",d),u=ve(l);if(!u)continue;let f=D(u.projectRoot);o.push({leasePath:l,lease:u,managed:u.repositoryId===r&&ge(u),live:i.has(f)||J(f),busy:me(u)})}let a=[];for(let d of O(p(t,"locks"))){let l=/^([a-f0-9]{64})\.lock$/.exec(d);if(!l)continue;let u=p(t,"locks",d),f=ye(u),g=f!==void 0&&S(f),y=l[1];a.push({generationId:y,path:u,live:g})}let s=[],c=[];for(let d of O(p(t,"generations"))){let l=/^\.tmp-(\d+)-/.exec(d);if(l){let g=p(t,"generations",d),y=Number(l[1]);try{c.push({path:g,size:rt(g),live:Number.isSafeInteger(y)&&S(y)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(d))continue;let u=p(t,"generations",d),f;try{f=_(u)}catch{continue}!f.isDirectory()||f.isSymbolicLink()||s.push({generationId:d,path:u,size:rt(u),...n[d]===void 0?{}:{unreferencedAt:n[d]}})}return{leases:o,generations:s,locks:a,temporaries:c}}function ge(e){if(e.ownershipChecksum!==_e(e)||A(e.localCacheDir)!==A(Ce(e.projectRoot)))return!1;let t=A(p(w(),"projects"));return A(e.localCacheDir).startsWith(`${t}${ot}`)}function Qt(e){if(!ge(e))return!1;let t=D(w()),r=D(p(t,"projects")),n=D(e.localCacheDir);try{let i=_(t),o=_(r),a=_(n);if(!i.isDirectory()||i.isSymbolicLink()||!o.isDirectory()||o.isSymbolicLink()||!a.isDirectory()||a.isSymbolicLink())return!1;let s=tt(r);return tt(n).startsWith(`${s}${ot}`)}catch{return!1}}function Yt(e){for(let t of O(p(e,"worktrees"))){if(!t.endsWith(".json"))continue;let r=ve(p(e,"worktrees",t));if(r)return r.projectRoot}}function me(e,t=!1){for(let n of t?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let i=ye(p(e.localCacheDir,n));if(i!==void 0&&S(i))return!0}let r=ye(R(e.localCacheDir).lockPath);return r!==void 0&&S(r)}function ve(e){try{let t=JSON.parse(v(e,"worktree cache lease"));return t.version!==1||typeof t.repositoryId!="string"||typeof t.worktreeId!="string"||typeof t.projectRoot!="string"||t.treeOid!==void 0&&typeof t.treeOid!="string"||typeof t.localCacheDir!="string"||t.baseGenerationId!==void 0&&typeof t.baseGenerationId!="string"||t.activeGenerationId!==void 0&&typeof t.activeGenerationId!="string"||typeof t.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(t.ownershipChecksum)||typeof t.lastAction!="string"||t.lastReason!==void 0&&typeof t.lastReason!="string"||typeof t.lastSeenAt!="string"?null:t}catch{return null}}function ye(e){try{let t=JSON.parse(v(e,"watch lock record"));return typeof t.pid=="number"&&Number.isSafeInteger(t.pid)&&t.pid>0?t.pid:void 0}catch{return}}function lt(e){try{let t=JSON.parse(v(e,"repository cache GC state"));return t.version!==1||typeof t.lastSweepAt!="string"||!Number.isFinite(Date.parse(t.lastSweepAt))||!t.unreferencedSince||typeof t.unreferencedSince!="object"||!t.lastResult?null:t}catch{return null}}function Xt(e){try{let t=JSON.parse(v(e,"global repository cache GC state"));if(t.version!==1||typeof t.lastSweepAt!="string")return;let r=Date.parse(t.lastSweepAt);return Number.isFinite(r)?r:void 0}catch{return}}function O(e){try{return nt(e)}catch{return[]}}function rt(e){let t=0,r=[e];for(;r.length>0;){let n=r.pop();for(let i of nt(n,{withFileTypes:!0})){let o=p(n,i.name);i.isDirectory()?r.push(o):i.isFile()&&(t+=it(o).size)}}return t}var ut=[{question:"Who can call or reach this?",family:"execution",direction:"incoming"},{question:"What can this call or reach?",family:"execution",direction:"outgoing"},{question:"Where can this value come from?",family:"dataflow",direction:"incoming"},{question:"Where can this value go?",family:"dataflow",direction:"outgoing"},{question:"Which producer and consumer rendezvous?",family:"runtime",direction:"both"},{question:"What resource is observed or changed?",family:"state",direction:"both"},{question:"What occurs before or after this?",family:"temporal",direction:"both"},{question:"What interface constrains this?",family:"contract",direction:"both"},{question:"Are these observations the same entity?",family:"identity",direction:"both"},{question:"What contains or owns this?",family:"ownership",direction:"both"},{question:"What does this statically rely on?",family:"dependencies",direction:"outgoing"}],pt={execution:{establishes:"Static may-call reachability between resolved program constructs.",nonClaims:["A may-call edge does not prove that a runtime invocation occurred."]},runtime:{establishes:"A source-grounded handoff between producer and consumer participants through a runtime mechanism.",nonClaims:["An unresolved or candidate join does not prove a runtime handoff."]},dataflow:{establishes:"A value, definition, argument, parameter, return, or statically resolved value may flow to another construct.",nonClaims:["Current partial providers do not establish general interprocedural definition-use coverage."]},state:{establishes:"A construct reads, writes, creates, deletes, or otherwise changes an identified state resource.",nonClaims:["A state edge does not prove transactionality, durability, or exclusive ownership unless qualified."]},temporal:{establishes:"One observed construct is locally ordered before or after another under the reported source evidence.",nonClaims:["Source order does not imply cross-process happens-before or durability."]},contract:{establishes:"A program construct implements, constrains, or is typed by an identified contract.",nonClaims:["Contract identity does not prove runtime invocation or conformance outside reported checks."]},identity:{establishes:"Two observations refer to the same compiler-owned or source-owned program entity.",nonClaims:["Shared identity does not establish execution or value transfer."]},ownership:{establishes:"A source construct, symbol, runtime observation, or state resource is contained or owned by another program entity.",nonClaims:["Structural ownership does not establish lifetime, singleton scope, or runtime execution unless qualified."]},dependencies:{establishes:"A file, module, or symbol statically relies on another indexed entity.",nonClaims:["A dependency edge does not establish that the depended-on code executes."]}};function ht(e){return te.flatMap(t=>t.relations.filter(r=>r.family===e).map(r=>({...r,providerId:t.id,providerLabel:t.label})))}function ft(e){return[...new Set(te.filter(t=>t.relations.some(r=>r.family===e)).map(t=>t.label))]}var nn=Ee.map(e=>({family:e,...pt[e],providers:ft(e),relations:ht(e)}));function mt(e){return{family:e,...pt[e],providers:ft(e),relations:ht(e)}}var an=["search","outline","entrypoints","evidence","inspect","code"];function cn(){return ut.map(e=>{let t=mt(e.family);return{...e,establishes:t.establishes,evidenceStrengths:yt(t.relations.flatMap(r=>r.evidenceStrengths)),supportCeilings:yt(t.relations.map(r=>r.supportCeiling)),nonClaim:t.nonClaims.join(" ")}})}function yt(e){return[...new Set(e)]}export{nn as a,Le as b,sr as c,ar as d,kt as e,cr as f,dr as g,lr as h,xr as i,Gt as j,Tr as k,Qe as l,qr as m,$t as n,Ye as o,_r as p,Dr as q,Or as r,Lr as s,he as t,Mr as u,st as v,Xr as w,Zr as x,an as y,cn as z};
|
|
3
|
-
//# sourceMappingURL=chunk-OLIWTZI3.js.map
|
package/dist/chunk-PP7KNN7L.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as x}from"./chunk-4UX2F3JX.js";import{f,g as p}from"./chunk-JGKUET5J.js";import{a as L}from"./chunk-CNO7TOKL.js";import{b as D}from"./chunk-BOJ5SVE2.js";import{c as v}from"./chunk-CJZXN4NU.js";import{a as E}from"./chunk-BGBBVSH4.js";import{a as C}from"./chunk-W7CXK74K.js";import{a as y}from"./chunk-E73UNJTF.js";import{b}from"./chunk-OSSESPDX.js";import{d as m,t as g}from"./chunk-N2ZSIIGR.js";import{c as u,n as h}from"./chunk-ODDUPDP7.js";var A=/^(?:validate|verify|check|assert)(?:[A-Z].*)?$/,N=/^(?:is|has)(?:[A-Z].*)?$/,k=/[{,]\s*(?:ok|success|valid|isValid)\s*:\s*false\b/,d=/\breturn\b/g,I=/\bfunction\b|=>|\)\s*(?::\s*[^{;=]+)?\s*\{/,_=/\.(?:addIssue|push)\s*\(/;function M(e,t={}){let{scope:n,limit:i=30,scanLimit:l}=t,a=new v(e),r=D(a.productionCallableDefinitions({scope:n,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),l),s=[];for(let o of r){let c=P(e,o);c&&s.push({symbol:o.symbol,shortName:m(o.symbol),file:o.relativePath,startLine:o.startLine,endLine:o.endLine,loc:E(o),...c})}return s.sort((o,c)=>o.file.localeCompare(c.file)||o.startLine-c.startLine||o.loc-c.loc),i?s.slice(0,i):s}function w(e){return A.test(e)?"imperative":N.test(e)?"predicate":null}function P(e,t){let n=w(t.leaf);if(!n||L(e,t))return null;let i=f(e,t);if(!i||!I.test(i))return null;let l=h(e,t.relativePath)?.callables.find(r=>r.startLine===t.startLine&&r.endLine===t.endLine);if(n==="predicate"&&l?.paramCount===0)return null;if(x(i)){let r=O(e,t);return!r||S(r.body,T(r.snippet))||R(r.body)?null:{nameKind:n,resolvedVia:"one-hop-delegate",delegateTarget:r.shortName}}let a=p(i);return S(a,T(i))||R(a)?null:{nameKind:n,resolvedVia:"direct"}}var F=new Set(["if","for","while","switch","catch","function"]);function R(e){let t=u(e);for(let n of t.matchAll(/\b([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\(/g))if(!F.has(n[1]))return!0;return!1}function T(e){let t=e.indexOf("=>");return t===-1?!1:!/^\s*\{/.test(e.slice(t+2))}function S(e,t){let n=u(e);if(/\bthrow\b/.test(n)||/\.reject\s*\(/.test(n)||k.test(n)||_.test(n))return!0;let i=K(n);if(t&&i.length===0){let l=n.trim();return l!==""&&l!=="true"}for(let l of i)if(l!==""&&l!=="true")return!0;return!1}function K(e){let t=[];d.lastIndex=0;let n;for(;n=d.exec(e);){let i=n.index+n[0].length,l=0,a=e.length;for(let r=i;r<e.length;r+=1){let s=e[r];if(s==="("||s==="["||s==="{")l+=1;else if(s===")"||s==="]"||s==="}"){if(l===0){a=r;break}l-=1}else if(s===";"&&l===0){a=r;break}}t.push(e.slice(i,a).trim()),d.lastIndex=a}return t}function O(e,t){let n=y(e,t,{callableOnly:!0,limit:3,semanticEvidence:C}),i=[...new Set(n.map(o=>o.symbol))].filter(o=>o!==t.symbol);if(i.length!==1)return null;let a=b(e,i[0]).match;if(!a)return null;let r=g(e,a.relativePath).find(o=>o.symbolId===a.symbolId);if(!r)return null;let s=f(e,r);return s?{body:p(s),snippet:s,shortName:m(r.symbol)}:null}export{M as a};
|
|
2
|
-
//# sourceMappingURL=chunk-PP7KNN7L.js.map
|
package/dist/chunk-PU7T5QYQ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk-QOJONDS7.js";import{a as d}from"./chunk-WIWY3CRX.js";import{a as P}from"./chunk-WUN6KBHV.js";import{a as v}from"./chunk-BOJ5SVE2.js";import{c as b}from"./chunk-CJZXN4NU.js";import{a as p}from"./chunk-BGBBVSH4.js";import{a as g,h}from"./chunk-XRYABF57.js";import{d as l,h as u}from"./chunk-N2ZSIIGR.js";import{p as f,q as m}from"./chunk-ODDUPDP7.js";import{basename as x,extname as L}from"path";function z(i,e){let{scope:r,maxLoc:n=15,limit:o=30,scanLimit:s}=e??{},a=new b(i);return P({candidates:()=>E(i,a,r,n),orderCandidates:v,scanLimit:s,profile:{name:"passthrough-candidates"},prepare:t=>a.calleeMap(t,{semantic:e?.semantic!==!1}),evaluate:(t,c)=>S(i,t,c.get(t.symbolId)??[]),orderResults:(t,c)=>t.loc-c.loc||t.file.localeCompare(c.file),limit:o})}function S(i,e,r){let n=w(r);if(n.size!==1||!f(i,e.relativePath,e.startLine,e.endLine))return null;let[,o]=[...n.entries()][0],s=D(i,e,o),a=T(i,e),t=s.length>0||a.length>0?"signal":"direct";return{symbol:e.symbol,shortName:l(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:p(e),forwardsTo:o.symbol,forwardsToShort:l(o.symbol),forwardsToFile:o.file,actionTier:t,boundaryEvidence:s,publicFacadeEvidence:a,recommendation:I(t,s,a)}}function D(i,e,r){return y(i,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:l(e.symbol)},{label:"callee name",value:l(r.symbol)},{label:"passthrough module",value:x(e.relativePath,L(e.relativePath))},{label:"callee module",value:x(r.file,L(r.file))}])}function I(i,e,r){if(i==="signal"){if(r.length>0)return`Review the public API before inlining; public-facade evidence: ${r.slice(0,2).join("; ")}.`;let n=e.filter(C);return n.length>0?`Review the public API before inlining; public-surface evidence: ${n.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(i,e){return d(i,e)?g(i,e.relativePath)?["exported passthrough is declared on the package public surface"]:h(i,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function C(i){return i.includes("public surface")}function w(i){let e=i.some(n=>u(n.symbol))?i.filter(n=>u(n.symbol)):i,r=new Map;for(let n of e)r.has(n.symbol)||r.set(n.symbol,n);return r}function E(i,e,r,n){return e.productionCallableDefinitions({scope:r,minLoc:3,maxLoc:n,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0}).filter(o=>!m(i,o))}export{z as a};
|
|
2
|
-
//# sourceMappingURL=chunk-PU7T5QYQ.js.map
|
package/dist/chunk-QGVTFRY2.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{a as R}from"./chunk-QOJONDS7.js";import{a as j,b as g,c as N}from"./chunk-HLZTEXRA.js";import{a as _}from"./chunk-WUN6KBHV.js";import{a as E}from"./chunk-BOJ5SVE2.js";import{b as C,c as P}from"./chunk-CJZXN4NU.js";import{a as k}from"./chunk-BGBBVSH4.js";import{b as w}from"./chunk-DYGHBZ2N.js";import{A as L,d,e as y,k as v}from"./chunk-N2ZSIIGR.js";import{q as S}from"./chunk-ODDUPDP7.js";import{y as x}from"./chunk-JWTGMPIT.js";import{basename as m,extname as b}from"path";function ae(t,n){let{scope:e,maxLoc:i=15,limit:a=30,scanLimit:o}=n??{},r=new P(t),s=z(r.fileDependencyGraph(e));return _({candidates:()=>B(t,r,e,i),orderCandidates:E,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:l=>({callerFileMap:A(t,r,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,u)=>O(t,r,l,u),orderResults:(l,u)=>u.callerFanIn-l.callerFanIn||u.loc-l.loc,limit:a})}function A(t,n,e,i){let a=j(t,n),o=g(a.forDefinitions(e,{semantic:!1,sourceFallback:!1})),r=[];i.semantic&&x("wrapper.semantic-candidates",()=>{r=e.filter(c=>F(t,n,c,o).length<=1)},()=>({symbols:e.length,semanticCandidates:r.length}));let s=r.length===0?new Map:g(a.forDefinitions(r,{semantic:!0,sourceFallback:!1})),l=s.size===0?o:C(o,s),u=new Map(e.map(c=>[c.symbolId,c])),f=new Map;for(let c of e){let I=F(t,n,c,l);if(I.length>1||(f.set(c.symbolId,c),I.length!==1))continue;let D=I[0],M=T(t,c.symbolId,D);if(!M)continue;let p=W(n,t,D,c.symbol,M);p?.isFunctionLike&&u.has(p.symbolId)&&f.set(p.symbolId,u.get(p.symbolId))}let h=[...f.values()];return h.length===0?l:C(l,g(a.forDefinitions(h,{semantic:!1,sourceFallback:!0})))}function O(t,n,e,i){let a=F(t,n,e,i.callerFileMap);if(a.length!==1)return null;let o=a[0],r=T(t,e.symbolId,o);if(!r)return null;let s=W(n,t,o,e.symbol,r);if(s&&v(s.symbol))return null;let{fanIn:l,source:u}=J(i.callerFileMap,i.reverseFanIn,o,s);if(u==="function"?l<=3:l<=5)return null;let f=H(t,e,o,s);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:k(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?d(s.symbol):m(o),callerFanIn:l,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function B(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(a=>!S(t,a))}function F(t,n,e,i){let a=m(e.relativePath,b(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>m(r,b(r))!==a).filter(r=>{let s=n.fileKind(r);return s!=="barrel"&&s!=="entry"&&s!=="test"});return N(t,e,o).realConsumers}function T(t,n,e){return t.get(`SELECT c.start_line, c.end_line
|
|
2
|
-
FROM mentions m
|
|
3
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
-
JOIN documents d ON c.document_id = d.id
|
|
5
|
-
WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
|
|
6
|
-
LIMIT 1`,n,e)}function W(t,n,e,i,a){let o=t.definitionsForFile(e),r=q(n,e,i,a.start_line,a.end_line);return L(o,r)}function J(t,n,e,i){if(i?.isFunctionLike){let a=[...t.get(i.symbolId)??[]].filter(o=>o!==i.relativePath);if(a.length>0)return{fanIn:a.length,source:"function"}}return{fanIn:G(n,e),source:"file"}}function q(t,n,e,i,a){let o=y(e);if(!o)return i;let r=w(t,n).get(o);if(!r||r.length===0)return i;for(let s of r)if(s>=i&&s<=a)return s;return i}function z(t){let n=new Map;for(let[e,i]of t){n.has(e)||n.set(e,n.get(e)??0);for(let a of i)n.set(a,(n.get(a)??0)+1)}return n}function G(t,n){let e=t.get(n)??0;if(e>0)return e;let i=m(n,b(n)),a=0;for(let[o,r]of t)o!==n&&m(o,b(o))===i&&r>a&&(a=r);return a}function H(t,n,e,i){return R(t,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:d(n.symbol)},{label:"caller name",value:i?.symbol?d(i.symbol):m(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{ae as a};
|
|
7
|
-
//# sourceMappingURL=chunk-QGVTFRY2.js.map
|
package/dist/chunk-QOJONDS7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{k as c,l}from"./chunk-FESCRNVV.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
|
|
2
|
-
//# sourceMappingURL=chunk-QOJONDS7.js.map
|
package/dist/chunk-RBLQNW26.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{Nb as q,Ob as N,Pb as ot,Qb as V,Sb as at,mc as it,oc as U,tc as L,uc as B}from"./chunk-NOYBFVJA.js";import{Ca as I,Ge as st,Md as et,Nd as nt,Od as rt,Pd as z,Wd as j,u as A}from"./chunk-66DVSJQG.js";import{createHash as T,randomBytes as lt}from"crypto";import{chmodSync as Wt,closeSync as x,fstatSync as ct,lstatSync as Xt,mkdirSync as yt,openSync as W,readSync as Yt,readdirSync as Ot,renameSync as wt,rmSync as X,statSync as Qt,writeSync as St}from"fs";import{tmpdir as Zt}from"os";import{dirname as Kt,join as _,resolve as te}from"path";import{StringDecoder as Y}from"string_decoder";import{InvalidArgumentError as pt}from"commander";var Gt=/^[A-Za-z0-9_@%+=:,./-]+$/u;function ut(t,e={}){return e.omitSafeQuotes&&Gt.test(t)?t:(e.platform??process.platform)==="win32"?`"${t.replaceAll("%","%%").replaceAll('"','\\"')}"`:`'${t.replaceAll("'",`'"'"'`)}'`}var vt="scip-query-output-page",bt=1,ee="continue",S=256,E=1e5,$=4096,l=32e6,Ct=64*1024*1024,ne=256*1024*1024,re=32,Pt=32768,It=16,se=V*It,R=4096,ht=Ct,Et=3600*1e3,oe="scip-query-json-export",ae=1,Tt=3;function xt(){return _(Zt(),`scip-query-output-pages-${typeof process.getuid=="function"?process.getuid():"user"}`)}var Q=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,_t=/^[A-Za-z0-9_][A-Za-z0-9_-]{11}$/u,ie=/^4\.([A-Za-z0-9_-]{22})\.([0-9a-z]{1,10})$/u,ue=/^([A-Za-z0-9_][A-Za-z0-9_-]{11})(?:\.([0-9a-z]{1,10}))?$/u,At=1,ce="quota.lock",pe=2e3,he=5,dt=1024*1024,de=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)),D,ge=Object.freeze({maxSnapshotBytes:Ct,maxAggregateBytes:ne,maxSnapshotCount:re});var Nt={writeStdout:t=>{process.stdout.write(t)},writeStderr:t=>{process.stderr.write(t)}};async function fe(t,e,n=Nt){return it({command:t.command,cwd:t.cwd,argv:t.argv,json:t.json,sessionEnabled:t.sourceSession,reemit:t.reemitSource},async()=>{try{await me(t,e,n)}finally{U(!1)}})}async function me(t,e,n){let s=t.pageSize??q,r=t.snapshotRoot??xt(),a=Pe(t.snapshotLimits),o=t.maxOutputCharacters??l;if(!Number.isSafeInteger(o)||o<=0)throw new Error("Output character safety limit must be a positive integer.");let i=Math.min(o,l,t.agentOutput?se:l);if(Ut(s),t.cursor!==void 0&&t.cursor.length>$)throw new Error(`Output cursor exceeds the ${$}-character limit. Run the command again without --output-cursor.`);if(t.jsonOutputPath!==void 0){if(!t.json)throw new Error("--json-output requires --json.");if(t.agentOutput||t.pageSize!==void 0||t.cursor!==void 0)throw new Error("--json-output cannot be combined with --agent-output or output pagination.");t.command==="system-map"&&B(t.cwd,t.sourceSession!==!1),await le(t,e,n,i);return}if(t.json&&!t.agentOutput&&t.pageSize===void 0&&t.cursor===void 0){t.command==="system-map"&&B(t.cwd,t.sourceSession!==!1),await Oe(t,e,n);return}let p=jt(t.argv),h=Dt(t.invocationPrefix),d=zt(t.command,t.cwd,h,p),g=t.cursor===void 0?void 0:Re(t.cursor,d);t.command==="system-map"&&!g&&B(t.cwd,t.sourceSession!==!1);let c=g?.snapshotId,u;if(g)try{u=Se(g,d,s,i,r,t.onSnapshotRead)}catch(y){let M=y instanceof Error?y.message:String(y);throw new Error(`${M} Restart with: ${qt(h,p,s)}`,{cause:y})}else{let y=new F(d,h,t.command,t.cwd,p,s,i,Le(t,h),r,a,t.agentOutput?It:Pt,!t.json,Z(i,t.agentOutput===!0)),M=Lt(k=>y.write(k)),tt=!1;try{await e(),tt=!0}finally{M(),tt||y.abort()}let P;try{P=y.complete()}catch(k){throw y.abort(),k}c=P.snapshotId,u={content:P.content,offset:0,pageIndex:0,pageCount:P.pageCount,totalCharacters:P.totalCharacters,outputHash:P.outputHash}}let w=u.offset+u.content.length,f=u.pageIndex+1>=u.pageCount,m=f?void 0:Ue({invocationPrefix:h,nextPageIndex:u.pageIndex+1,snapshotId:Ae(c)});if(L(t.command,t.cwd,f,t.sourceSession!==!1,m?.command),u.offset===0&&f&&t.cursor===void 0){n.writeStdout(u.content),U(!0),c&&b(c,r);return}let C={kind:vt,schemaVersion:bt,producer:{name:"scip-query",version:t.producerVersion},command:t.command,contentType:t.json?"application/json":"text/plain",agentInstruction:m?"INCOMPLETE EVIDENCE: do not draw conclusions or report completion from this partial page. Run page.continuation.command exactly, then repeat until page.complete is true.":"OUTPUT COMPLETE: all rendered characters have been retrieved. Evaluate the command result's own coverage separately.",page:m?{offset:u.offset,returnedCharacters:u.content.length,totalCharacters:u.totalCharacters,omittedCharacters:u.totalCharacters-u.content.length,remainingCharacters:u.totalCharacters-w,complete:!1,outputHash:u.outputHash,continuation:m}:{offset:u.offset,returnedCharacters:u.content.length,totalCharacters:u.totalCharacters,omittedCharacters:u.totalCharacters-u.content.length,remainingCharacters:u.totalCharacters-w,complete:!0,outputHash:u.outputHash},content:u.content};if(t.json){n.writeStdout(`${JSON.stringify(C)}
|
|
3
|
-
`),f&&c&&b(c,r);return}n.writeStdout(je(C)),f&&c&&b(c,r)}async function un(t,e,n=xt(),s=Nt){if(t.length>$)throw new Error(`Output cursor exceeds the ${$}-character limit.`);let r=kt(t);if(!r)throw new Error("Invalid output cursor. Run the original command again.");let a=Rt(r.snapshotId,n);await fe({command:a.command,producerVersion:e,invocationPrefix:a.invocationPrefix,argv:[...a.argv,"--output-page-size",String(a.pageSize),"--output-cursor",t],cwd:a.cwd,json:a.argv.some(o=>o==="--json"||o.startsWith("--json=")),sourceSession:!a.argv.some(o=>o==="--no-session"),agentOutput:a.argv.some(o=>o==="--agent-output"),pageSize:a.pageSize,cursor:t,snapshotRoot:n},()=>{throw new Error("Output continuation attempted to rerun the original command.")},s)}async function le(t,e,n,s){let r=t.jsonOutputPath;if(r===void 0||r.length===0||Buffer.byteLength(r)>R||r.includes("\0"))throw new Error(`--json-output requires a path from 1 through ${R} UTF-8 bytes.`);let a=te(t.cwd,r);if(Buffer.byteLength(a)>R)throw new Error(`The resolved --json-output path exceeds ${R} UTF-8 bytes.`);let o=new Y("utf8"),i=T("sha256"),p=0,h=0,d=m=>{if(h+=m.length,!Number.isSafeInteger(h)||h>s)throw new Error(Z(s,!1))};yt(Kt(a),{recursive:!0});let g=`${a}.tmp-${lt(12).toString("hex")}`,c=W(g,"wx",384),u=!0,w=Lt(m=>{let C=p+m.length;if(!Number.isSafeInteger(C)||C>ht)throw new Error(`JSON export exceeds the ${ht}-byte file safety limit. Narrow the query before retrying.`);if(d(o.write(m)),c===void 0)throw new Error("JSON export writer is closed.");ye(c,m),i.update(m),p=C});try{await e(),d(o.end()),w(),x(c),c=void 0,wt(g,a),u=!1}finally{if(w(),c!==void 0)try{x(c)}catch{}u&&X(g,{force:!0})}let f={kind:oe,schemaVersion:ae,producer:{name:"scip-query",version:t.producerVersion},command:t.command,path:a,bytes:p,sha256:i.digest("hex")};n.writeStdout(`${JSON.stringify(f)}
|
|
4
|
-
`),L(t.command,t.cwd,!0,t.sourceSession!==!1),U(!0)}function ye(t,e){let n=0;for(;n<e.length;){let s=St(t,e,n,e.length-n);if(s<=0)throw new Error("JSON export write made no forward progress.");n+=s}}function Z(t,e){let n=`Command output exceeds the ${t}-character safety limit. Narrow the query before retrying.`;return e?`${n} For the complete machine result, use --json --json-output <path> and inspect the file programmatically.`:n}function cn(t){if(!/^\d+$/u.test(t))throw new pt(`Output page size must be an integer from ${S} through ${E}.`);let e=Number(t);try{Ut(e)}catch{throw new pt(`Output page size must be an integer from ${S} through ${E}.`)}return e}function Ut(t){if(!Number.isSafeInteger(t)||t<S||t>E)throw new Error(`Output page size must be an integer from ${S} through ${E}.`)}async function Oe(t,e,n){let s=new J(N,t.maxOutputCharacters??l),r=process.stdout.write,a=!1,o=`${at(`scip-query: JSON output exceeds the ${N}-byte client-safe budget and may be truncated by the client. Do not use possibly partial client output as evidence. Read every page with: ${qt(Dt(t.invocationPrefix),ke(jt(t.argv)),q)}`)}
|
|
5
|
-
`;process.stdout.write=((i,p,h)=>{let d=s.push(i,p);return d!==void 0&&(a||(a=!0,n.writeStderr(o)),r.call(process.stdout,d)),Bt(p,h),!0});try{await e();let i=s.finish();i.crossedPageBoundary&&!a&&(a=!0,n.writeStderr(o)),i.bytes.length>0&&r.call(process.stdout,i.bytes),a&&n.writeStderr(o),L(t.command,t.cwd,!0,t.sourceSession!==!1)}finally{process.stdout.write=r}}function Lt(t){let e=process.stdout.write;return process.stdout.write=((n,s,r)=>{let a=we(n,s);return t(a),Bt(s,r),!0}),()=>{process.stdout.write=e}}function we(t,e){return typeof t=="string"?Buffer.from(t,typeof e=="string"?e:"utf8"):Buffer.from(t)}function Bt(t,e){let n=typeof t=="function"?t:e;typeof n=="function"&&n()}var J=class{constructor(e,n){this.byteLimit=e;this.maxOutputCharacters=n}byteLimit;maxOutputCharacters;decoder=new Y("utf8");chunks=[];overflowed=!1;totalCharacters=0;totalBytes=0;push(e,n){let s=typeof e=="string"?Buffer.from(e,typeof n=="string"?n:"utf8"):Buffer.from(e);if(this.totalBytes+=s.length,this.addCharacters(this.decoder.write(s)),this.overflowed)return s;if(this.chunks.push(s),this.totalBytes<=this.byteLimit)return;this.overflowed=!0;let r=Buffer.concat(this.chunks);return this.chunks.length=0,r}finish(){this.addCharacters(this.decoder.end());let e=this.totalBytes>this.byteLimit,n=Buffer.concat(this.chunks);return this.chunks.length=0,{bytes:n,crossedPageBoundary:e}}addCharacters(e){if(this.totalCharacters+=e.length,!Number.isSafeInteger(this.totalCharacters)||this.totalCharacters>this.maxOutputCharacters)throw new Error(`Command output exceeds the ${this.maxOutputCharacters}-character safety limit. Narrow the query before retrying.`)}},F=class{constructor(e,n,s,r,a,o,i,p,h,d,g,c,u=Z(i,!1)){this.invocationHash=e;this.invocationPrefix=n;this.command=s;this.cwd=r;this.argv=a;this.pageSize=o;this.maxOutputCharacters=i;this.pageContentByteLimit=p;this.snapshotRoot=h;this.limits=d;this.maxPages=g;this.preferLineBoundaries=c;this.overflowMessage=u;K(h);do this.snapshotId=lt(9).toString("base64url");while(this.snapshotId.startsWith("-"));this.temporaryPath=O(h,this.snapshotId,"tmp")}invocationHash;invocationPrefix;command;cwd;argv;pageSize;maxOutputCharacters;pageContentByteLimit;snapshotRoot;limits;maxPages;preferLineBoundaries;overflowMessage;snapshotId;temporaryPath;decoder=new Y("utf8");hash=T("sha256");pages=[];descriptor=null;pending="";firstPageContent="";totalCharacters=0;pageCharacterOffset=0;byteLength=0;reservedBytes=0;opened=!1;finished=!1;write(e){if(this.finished)throw new Error("Output snapshot writer is closed.");this.appendDecoded(this.decoder.write(e))}complete(){if(this.finished)throw new Error("Output snapshot writer is closed.");if(this.appendDecoded(this.decoder.end()),this.finished=!0,!this.opened){let r=this.pending,a=Buffer.from(r);return this.assertWithinByteLimit(a.length),this.hash.update(a),this.pending="",{content:r,totalCharacters:this.totalCharacters,outputHash:this.hash.digest("hex"),pageCount:1}}if((this.pending.length>0||this.pages.length===0)&&(this.flushPage(this.pending),this.pending=""),this.descriptor===null)throw new Error("Output snapshot writer is not open.");x(this.descriptor),this.descriptor=null;let e=this.hash.digest("hex"),n=O(this.snapshotRoot,this.snapshotId,"output"),s=O(this.snapshotRoot,this.snapshotId,"json");try{wt(this.temporaryPath,n);let r={version:Tt,snapshotId:this.snapshotId,invocationHash:this.invocationHash,invocationPrefix:[...this.invocationPrefix],command:this.command,cwd:this.cwd,argv:[...this.argv],outputHash:e,pageSize:this.pageSize,pages:this.pages,totalCharacters:this.totalCharacters,byteLength:this.byteLength,createdAtMs:Date.now()};return j(s,r),gt(this.snapshotRoot,this.snapshotId,this.byteLength,"complete",this.limits),this.reservedBytes=this.byteLength,{content:this.firstPageContent,totalCharacters:this.totalCharacters,outputHash:e,pageCount:this.pages.length,snapshotId:this.snapshotId}}catch(r){throw b(this.snapshotId,this.snapshotRoot),r}}abort(){this.descriptor!==null&&(x(this.descriptor),this.descriptor=null),this.finished=!0,b(this.snapshotId,this.snapshotRoot)}appendDecoded(e){if(e.length===0)return;let n=this.totalCharacters+e.length;if(!Number.isSafeInteger(n)||n>this.maxOutputCharacters)throw new Error(this.overflowMessage);for(this.totalCharacters=n,this.pending+=e,this.assertWithinByteLimit(this.byteLength+Buffer.byteLength(this.pending));this.pending.length>this.pageSize||Buffer.byteLength(this.pending)>this.pageContentByteLimit;){this.open();let s=Ne(this.pending,this.pageSize,this.pageContentByteLimit,this.preferLineBoundaries),r=this.pending.slice(0,s);this.pending=this.pending.slice(s),this.flushPage(r)}}open(){if(!this.opened){Ie(this.snapshotRoot,this.snapshotId,0,this.limits);try{this.descriptor=W(this.temporaryPath,"wx",384),this.opened=!0}catch(e){throw Ee(this.snapshotRoot,this.snapshotId),e}}}flushPage(e){if(this.descriptor===null)throw new Error("Output snapshot writer is not open.");if(this.pages.length>=this.maxPages)throw new Error(`Command output requires more than ${this.maxPages} snapshot pages. Retry with a larger --output-page-size, narrow the query, or use --json --json-output <path>.`);let n=Buffer.from(e),s=this.byteLength+n.length;if(this.assertWithinByteLimit(s),s>this.reservedBytes){let o=Math.min(this.limits.maxSnapshotBytes,Math.ceil(s/dt)*dt);gt(this.snapshotRoot,this.snapshotId,o,"active",this.limits),this.reservedBytes=o}let r=0;for(;r<n.length;){let o=St(this.descriptor,n,r,n.length-r);if(o<=0)throw new Error("Output snapshot write made no progress.");r+=o}let a={characterOffset:this.pageCharacterOffset,characterLength:e.length,byteOffset:this.byteLength,byteLength:n.length,hash:T("sha256").update(n).digest("hex")};this.pages.length===0&&(this.firstPageContent=e),this.pages.push(a),this.hash.update(n),this.pageCharacterOffset+=e.length,this.byteLength=s}assertWithinByteLimit(e){if(!Number.isSafeInteger(e)||e>this.limits.maxSnapshotBytes)throw new Error(`Command output exceeds the ${this.limits.maxSnapshotBytes}-byte snapshot limit. Narrow the query before retrying.`)}};function Se(t,e,n,s,r,a){K(r);let o=Rt(t.snapshotId,r);if(o.invocationHash!==e)throw new Error("This output cursor belongs to a different command, working directory, or argument set. Run again without --output-cursor.");if(o.snapshotId!==t.snapshotId||t.version===3&&(o.invocationHash!==t.invocationHash||o.outputHash!==t.outputHash))throw new Error("Output snapshot identity does not match this cursor.");if(o.pageSize!==n||t.version===3&&t.pageSize!==n)throw new Error(`Output page size changed after this cursor was issued; use ${o.pageSize}.`);let i=o.pages[t.pageIndex];if(!i)throw new Error("Output cursor points past the current result.");if(o.totalCharacters>s)throw new Error(`Output snapshot exceeds the ${s}-character safety limit.`);if(Date.now()-o.createdAtMs>Et)throw b(t.snapshotId,r),new Error("Output snapshot expired before all pages were read.");let p=O(r,t.snapshotId,"output"),h=W(p,"r");try{let d=ct(h);if(!d.isFile()||d.size!==o.byteLength)throw new Error("Output snapshot size or type changed.");let g=Buffer.allocUnsafe(i.byteLength),c=0;for(;c<g.length;){let f=Yt(h,g,c,g.length-c,i.byteOffset+c);if(f===0)break;c+=f,a?.(f)}let u=ct(h);if(u.dev!==d.dev||u.ino!==d.ino||u.size!==d.size||c!==i.byteLength)throw new Error("Output snapshot changed while it was being read.");if(T("sha256").update(g).digest("hex")!==i.hash)throw new Error("Output snapshot page no longer matches its metadata.");let w=g.toString("utf8");if(w.length!==i.characterLength)throw new Error("Output snapshot page character count changed.");return{content:w,offset:i.characterOffset,pageIndex:t.pageIndex,pageCount:o.pages.length,totalCharacters:o.totalCharacters,outputHash:o.outputHash}}catch(d){throw b(t.snapshotId,r),d}finally{x(h)}}function Rt(t,e){if(!v(t))throw new Error("Output snapshot identifier is invalid.");let n;try{n=JSON.parse(A(O(e,t,"json"),"output snapshot metadata"))}catch(s){throw new Error("Output snapshot is unavailable.",{cause:s})}if(!ve(n))throw new Error("Output snapshot metadata is invalid.");return n}function ve(t){if(!t||typeof t!="object")return!1;let e=t;return e.version===Tt&&typeof e.snapshotId=="string"&&v(e.snapshotId)&&I(e.invocationHash)&&Jt(e.invocationPrefix)&&typeof e.command=="string"&&e.command.length>0&&e.command.length<=256&&typeof e.cwd=="string"&&e.cwd.length>0&&e.cwd.length<=8192&&ze(e.argv)&&zt(e.command,e.cwd,e.invocationPrefix,e.argv)===e.invocationHash&&I(e.outputHash)&&Number.isSafeInteger(e.pageSize)&&(e.pageSize??0)>=S&&(e.pageSize??0)<=E&&Array.isArray(e.pages)&&e.pages.length>1&&e.pages.length<=Pt&&e.pages.every(be)&&Ce(e.pages)&&Number.isSafeInteger(e.totalCharacters)&&(e.totalCharacters??-1)>=0&&e.pages.reduce((n,s)=>n+s.characterLength,0)===e.totalCharacters&&Number.isSafeInteger(e.byteLength)&&(e.byteLength??-1)>=0&&e.pages.reduce((n,s)=>n+s.byteLength,0)===e.byteLength&&Number.isSafeInteger(e.createdAtMs)&&(e.createdAtMs??-1)>=0}function be(t){if(!t||typeof t!="object")return!1;let e=t;return Number.isSafeInteger(e.characterOffset)&&(e.characterOffset??-1)>=0&&Number.isSafeInteger(e.characterLength)&&(e.characterLength??0)>0&&Number.isSafeInteger(e.byteOffset)&&(e.byteOffset??-1)>=0&&Number.isSafeInteger(e.byteLength)&&(e.byteLength??0)>0&&I(e.hash)}function Ce(t){let e=0,n=0;for(let s of t){if(s.characterOffset!==e||s.byteOffset!==n)return!1;e+=s.characterLength,n+=s.byteLength}return!0}function K(t){yt(t,{recursive:!0,mode:448});let e=Xt(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Output snapshot root is not a private directory: ${t}`);if(typeof process.getuid=="function"&&e.uid!==process.getuid())throw new Error(`Output snapshot root is not owned by the current user: ${t}`);process.platform!=="win32"&&Wt(t,448)}function Pe(t){let e={...ge,...t};for(let[n,s]of Object.entries(e))if(!Number.isSafeInteger(s)||s<=0)throw new Error(`Output snapshot ${n} must be a positive integer.`);if(e.maxSnapshotBytes>e.maxAggregateBytes)throw new Error("Output snapshot maxSnapshotBytes cannot exceed maxAggregateBytes.");return e}function Ie(t,e,n,s){H(t,()=>{xe(t),$t(t,e,n,"active",s)})}function gt(t,e,n,s,r){if(!Number.isSafeInteger(n)||n<0||n>r.maxSnapshotBytes)throw new Error(`Command output exceeds the ${r.maxSnapshotBytes}-byte snapshot limit.`);H(t,()=>{$t(t,e,n,s,r)})}function $t(t,e,n,s,r){if(!Number.isSafeInteger(n)||n<0||n>r.maxSnapshotBytes)throw new Error(`Command output exceeds the ${r.maxSnapshotBytes}-byte snapshot limit.`);let a=Te(t),o=a.find(g=>g.snapshotId===e),i=a.reduce((g,c)=>g+c.reservedBytes,0)-(o?.reservedBytes??0)+n,p=a.length+(o?0:1);if(p>r.maxSnapshotCount||i>r.maxAggregateBytes)throw new Error(`Output snapshot capacity is full (${p}/${r.maxSnapshotCount} snapshots, ${i}/${r.maxAggregateBytes} bytes). Narrow the query or finish an existing pagination sequence before retrying.`);let h=Date.now(),d={version:At,snapshotId:e,pid:process.pid,...G()?{processIdentity:G()}:{},reservedBytes:n,state:s,createdAtMs:o?.createdAtMs??h,updatedAtMs:h};j(O(t,e,"reserve"),d)}function Ee(t,e){H(t,()=>{X(O(t,e,"reserve"),{force:!0})})}function Te(t){let e=[];for(let n of Ot(t,{withFileTypes:!0})){if(!n.isFile()||!n.name.endsWith(".reserve"))continue;let s=n.name.slice(0,-8);if(v(s))try{let r=JSON.parse(A(_(t,n.name),"output snapshot reservation"));if(!Ht(r)||r.snapshotId!==s)throw new Error("reservation identity is invalid");e.push(r)}catch(r){throw new Error(`Output snapshot reservation ${n.name} is invalid; retry after its owning process or snapshot expires.`,{cause:r})}}return e}function Ht(t){if(!t||typeof t!="object")return!1;let e=t;return e.version===At&&typeof e.snapshotId=="string"&&v(e.snapshotId)&&Number.isSafeInteger(e.pid)&&(e.pid??0)>0&&(e.processIdentity===void 0||nt(e.processIdentity)!==null&&e.processIdentity.pid===e.pid)&&Number.isSafeInteger(e.reservedBytes)&&(e.reservedBytes??-1)>=0&&(e.state==="active"||e.state==="complete")&&Number.isSafeInteger(e.createdAtMs)&&Number.isSafeInteger(e.updatedAtMs)}function xe(t){let e=Date.now();for(let n of Ot(t,{withFileTypes:!0})){if(!n.isFile()||!n.name.endsWith(".reserve"))continue;let s=n.name.slice(0,-8);if(!v(s))continue;let r=null;try{let p=JSON.parse(A(_(t,n.name),"output snapshot reservation"));r=Ht(p)?p:null}catch{r=null}let a=_e(O(t,s,"json")),o=r?.state==="active"&&et(r.pid)&&(r.processIdentity===void 0||(()=>{let p=z(r.pid);return p!==null&&rt(r.processIdentity,p)})()),i=r?e-r.updatedAtMs>Et:!1;o||a&&!i||!a&&r&&!i&&r.state==="complete"||Mt(s,t)}}function _e(t){try{return Qt(t),!0}catch{return!1}}function H(t,e){K(t);let n=_(t,ce),s=Date.now()+pe;for(;;){let r=st(n,{kind:"output-snapshot-quota",processIdentity:G()});if(r.kind==="acquired")try{return e()}finally{r.lock.release()}if(Date.now()>=s)throw new Error("Output snapshot quota is busy. Retry the command.");Atomics.wait(de,0,0,he)}}function G(){return D===void 0&&(D=z(process.pid)),D}function b(t,e){v(t)&&H(e,()=>Mt(t,e))}function Mt(t,e){for(let n of["json","output","tmp","reserve"])X(O(e,t,n),{force:!0})}function O(t,e,n){if(!v(e))throw new Error("Output snapshot identifier is invalid.");return _(t,`${e}.${n}`)}function Ae(t){if(!t)throw new Error("Incomplete output did not create a resumable snapshot.");return t}function ft(t){return t>=55296&&t<=56319}function Ne(t,e,n,s){let r=Math.min(t.length,e);if(ft(t.charCodeAt(r-1))&&(r-=1),Buffer.byteLength(t.slice(0,r))>n){let a=0,o=r;for(;a<o;){let i=Math.ceil((a+o)/2);Buffer.byteLength(t.slice(0,i))<=n?a=i:o=i-1}r=a,ft(t.charCodeAt(r-1))&&(r-=1)}if(r<=0)throw new Error("Output page byte limit cannot contain one UTF-8 character.");if(s){let a=t.lastIndexOf(`
|
|
6
|
-
`,r-1);if(a>=0)return a+1}return r}function Ue(t){let e=Be({pageIndex:t.nextPageIndex,snapshotId:t.snapshotId});return{cursor:e,command:Vt(t.invocationPrefix,e)}}function Le(t,e){let n="c".repeat(64),s={cursor:n,command:Vt(e,n)};if(!t.json){let o="9".repeat(String(l).length),i=`[scip-query output page: characters ${o}-${o} of ${o}]
|
|
7
|
-
|
|
8
|
-
[Incomplete: ${o} characters remain. Continue exactly:
|
|
9
|
-
${s.command}]
|
|
10
|
-
`;return mt(ot,Buffer.byteLength(i),1)}let r={kind:vt,schemaVersion:bt,producer:{name:"scip-query",version:t.producerVersion},command:t.command,contentType:"application/json",agentInstruction:"INCOMPLETE EVIDENCE: do not draw conclusions or report completion from this partial page. Run page.continuation.command exactly, then repeat until page.complete is true.",page:{offset:l,returnedCharacters:l,totalCharacters:l,omittedCharacters:l,remainingCharacters:l,complete:!1,outputHash:"f".repeat(64),continuation:s},content:""},a=Buffer.byteLength(`${JSON.stringify(r)}
|
|
11
|
-
`);return mt(V,a,2)}function mt(t,e,n){let s=Math.floor((N-e)/n);if(s<S)throw new Error(`The command invocation leaves fewer than ${S} bytes for client-safe output content. Use a shorter executable path.`);return Math.min(t,s)}function Be(t){return _t.test(t.snapshotId)?t.pageIndex===1?t.snapshotId:`${t.snapshotId}.${t.pageIndex.toString(36)}`:`4.${He(t.snapshotId)}.${t.pageIndex.toString(36)}`}function Re(t,e){let n=kt(t);if(!n)throw new Error("Invalid output cursor. Run the command again without --output-cursor.");if(n.version===3&&n.invocationHash!==e)throw new Error("This output cursor belongs to a different command, working directory, or argument set. Run again without --output-cursor.");return n}function kt(t){let e=ue.exec(t);if(e){let s=e[2]??"1",r=Number.parseInt(s,36);return Number.isSafeInteger(r)&&r>=1&&r.toString(36)===s?{version:4,pageIndex:r,snapshotId:e[1]}:null}let n=ie.exec(t);if(n){let s=Me(n[1]),r=Number.parseInt(n[2],36);return s&&Number.isSafeInteger(r)&&r>=1&&r.toString(36)===n[2]?{version:4,pageIndex:r,snapshotId:s}:null}try{let s=JSON.parse(Buffer.from(t,"base64url").toString("utf8"));return $e(s)?s:null}catch{return null}}function $e(t){if(!t||typeof t!="object")return!1;let e=t;return e.version===3&&I(e.invocationHash)&&Number.isSafeInteger(e.pageIndex)&&(e.pageIndex??-1)>=1&&Number.isSafeInteger(e.pageSize)&&(e.pageSize??0)>=S&&(e.pageSize??0)<=E&&I(e.outputHash)&&typeof e.snapshotId=="string"&&v(e.snapshotId)}function He(t){if(!Q.test(t))throw new Error("Output snapshot identifier is invalid.");return Buffer.from(t.replaceAll("-",""),"hex").toString("base64url")}function Me(t){let e=Buffer.from(t,"base64url");if(e.length!==16)return null;let n=e.toString("hex"),s=`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`;return Q.test(s)?s:null}function v(t){return typeof t=="string"&&(_t.test(t)||Q.test(t))}function zt(t,e,n,s){return T("sha256").update(JSON.stringify({command:t,cwd:e,invocationPrefix:n,argv:s})).digest("hex")}function jt(t){let e=[];for(let n=0;n<t.length;n+=1){let s=t[n];if(s==="--output-page-size"||s==="--output-cursor"){n+=1;continue}s.startsWith("--output-page-size=")||s.startsWith("--output-cursor=")||e.push(s)}return e}function ke(t){return t.filter(e=>e!=="--raw-json"&&e!=="--raw-json=true")}function qt(t,e,n){return Ft([...t,...e,"--output-page-size",String(n)])}function Vt(t,e){return Ft([...t,ee,e])}function Dt(t){let e=t===void 0?["scip-query"]:[...t];if(!Jt(e))throw new Error("Output pagination invocation prefix must contain one to sixteen non-empty shell arguments.");return e}function Jt(t){return Array.isArray(t)&&t.length>0&&t.length<=16&&t.every(e=>typeof e=="string"&&e.length>0&&e.length<=2048&&!e.includes("\0")&&!e.includes("\r")&&!e.includes(`
|
|
12
|
-
`))}function ze(t){return Array.isArray(t)&&t.length>0&&t.length<=256&&t.every(e=>typeof e=="string"&&e.length<=8192&&!e.includes("\0")&&!e.includes("\r")&&!e.includes(`
|
|
13
|
-
`))}function Ft(t){return t.map(e=>ut(e,{omitSafeQuotes:!0})).join(" ")}function je(t){let e=t.page.continuation,n=Math.max(t.page.offset,t.page.offset+t.page.returnedCharacters-1),s=`[scip-query output page: characters ${t.page.offset}-${n} of ${t.page.totalCharacters}]
|
|
14
|
-
`,r=e?`
|
|
15
|
-
[Incomplete: ${t.page.remainingCharacters} characters remain. Continue exactly:
|
|
16
|
-
${e.command}]
|
|
17
|
-
`:`
|
|
18
|
-
[scip-query transport complete; evaluate command coverage separately]
|
|
19
|
-
`;return`${s}${t.content}${r}`}export{ee as a,fe as b,un as c,cn as d};
|
|
20
|
-
//# sourceMappingURL=chunk-RBLQNW26.js.map
|
package/dist/chunk-RTQ7NEKG.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import{d as y}from"./chunk-GUFSG5TX.js";import{c as g}from"./chunk-IW5XQG5G.js";import{createHash as C}from"crypto";import{existsSync as A,mkdirSync as F}from"fs";import{dirname as T,join as b}from"path";import _ from"better-sqlite3";var O="evidence.db";var w=["source-facts","definition-exclusions","doc-path-tokens","react-component-behavior-profiles"],h=new Set(w),I=25e4,x=512*1024*1024,k=6e4,u=new WeakMap,M=g("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),j=g("evidence-project-fingerprint",{clearGroups:["whole-project"]}),s="evidence-v1",d="version NOT LIKE 'evidence-%'";function N(r){return C("sha256").update(r).digest("hex")}function Y(r,n,e){return M.get(r,n,()=>N(e))}function V(r){return j.get(r,"current",()=>{try{if(!r.generation.metadataRaw)return null;let n=y(r.generation.metadataRaw);if(n.kind!=="legacy"&&n.kind!=="supported"||!n.capabilities.usableForEvidenceCache)return null;let e=n.metadata,a=[...e.indexedLanguages??[]].sort();return N(JSON.stringify({fingerprint:e.fingerprint,indexedLanguages:a,status:e.status}))}catch(n){return E("project fingerprint unavailable",n),null}})}function E(r,n){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${r}: ${n instanceof Error?n.message:String(n)}`)}function o(r){if(u.has(r))return u.get(r)??null;let n=null;try{let e=new _(r.config.evidenceDbPath??b(T(r.config.dbPath),O));e.pragma("journal_mode = WAL"),e.pragma("busy_timeout = 5000"),e.pragma("synchronous = NORMAL"),e.exec(`
|
|
2
|
-
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
3
|
-
kind TEXT NOT NULL,
|
|
4
|
-
relative_path TEXT NOT NULL,
|
|
5
|
-
content_hash TEXT NOT NULL,
|
|
6
|
-
version TEXT NOT NULL,
|
|
7
|
-
payload TEXT NOT NULL,
|
|
8
|
-
PRIMARY KEY (kind, relative_path)
|
|
9
|
-
);
|
|
10
|
-
CREATE TABLE IF NOT EXISTS project_evidence (
|
|
11
|
-
kind TEXT NOT NULL,
|
|
12
|
-
cache_key TEXT NOT NULL,
|
|
13
|
-
project_fingerprint TEXT NOT NULL,
|
|
14
|
-
version TEXT NOT NULL,
|
|
15
|
-
payload TEXT NOT NULL,
|
|
16
|
-
PRIMARY KEY (kind, cache_key)
|
|
17
|
-
);
|
|
18
|
-
CREATE TABLE IF NOT EXISTS semantic_callees (
|
|
19
|
-
relative_path TEXT NOT NULL,
|
|
20
|
-
symbol TEXT NOT NULL,
|
|
21
|
-
content_hash TEXT NOT NULL,
|
|
22
|
-
deps_digest TEXT NOT NULL,
|
|
23
|
-
version TEXT NOT NULL,
|
|
24
|
-
payload TEXT NOT NULL,
|
|
25
|
-
PRIMARY KEY (relative_path, symbol)
|
|
26
|
-
);
|
|
27
|
-
CREATE TABLE IF NOT EXISTS semantic_references (
|
|
28
|
-
relative_path TEXT NOT NULL,
|
|
29
|
-
symbol TEXT NOT NULL,
|
|
30
|
-
project_fingerprint TEXT NOT NULL,
|
|
31
|
-
version TEXT NOT NULL,
|
|
32
|
-
payload TEXT NOT NULL,
|
|
33
|
-
PRIMARY KEY (relative_path, symbol)
|
|
34
|
-
);
|
|
35
|
-
`),n={evidence:e,shared:U(r.config.sharedEvidenceDbPath),readFileEvidence:e.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:e.prepare(`SELECT payload FROM file_evidence
|
|
36
|
-
WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${d}
|
|
37
|
-
ORDER BY version DESC
|
|
38
|
-
LIMIT 1`),existsFileEvidence:e.prepare("SELECT 1 AS present FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),existsLegacyFileEvidence:e.prepare(`SELECT 1 AS present FROM file_evidence
|
|
39
|
-
WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${d}
|
|
40
|
-
LIMIT 1`),writeFileEvidence:e.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),rekeyFileEvidence:e.prepare("UPDATE file_evidence SET content_hash = ?, version = ? WHERE kind = ? AND relative_path = ? AND content_hash = ?"),readProjectEvidence:e.prepare("SELECT payload FROM project_evidence WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND version = ?"),readLegacyProjectEvidence:e.prepare(`SELECT payload FROM project_evidence
|
|
41
|
-
WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${d}
|
|
42
|
-
ORDER BY version DESC
|
|
43
|
-
LIMIT 1`),writeProjectEvidence:e.prepare("INSERT OR REPLACE INTO project_evidence (kind, cache_key, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)"),rekeyProjectEvidenceKind:e.prepare("UPDATE project_evidence SET project_fingerprint = ?, version = ? WHERE kind = ? AND project_fingerprint = ?"),readCallees:e.prepare(`SELECT payload FROM semantic_callees
|
|
44
|
-
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:e.prepare(`SELECT payload FROM semantic_callees
|
|
45
|
-
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${d}
|
|
46
|
-
ORDER BY version DESC
|
|
47
|
-
LIMIT 1`),readCalleesForFile:e.prepare(`SELECT symbol, payload FROM semantic_callees
|
|
48
|
-
WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCalleesForFile:e.prepare(`SELECT symbol, payload FROM semantic_callees
|
|
49
|
-
WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${d}
|
|
50
|
-
ORDER BY symbol, version DESC`),writeCallees:e.prepare(`INSERT OR REPLACE INTO semantic_callees
|
|
51
|
-
(relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:e.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:e.prepare(`SELECT payload FROM semantic_references
|
|
52
|
-
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:e.prepare(`SELECT payload FROM semantic_references
|
|
53
|
-
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${d}
|
|
54
|
-
ORDER BY version DESC
|
|
55
|
-
LIMIT 1`),readReferencesForFile:e.prepare(`SELECT symbol, payload FROM semantic_references
|
|
56
|
-
WHERE relative_path = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferencesForFile:e.prepare(`SELECT symbol, payload FROM semantic_references
|
|
57
|
-
WHERE relative_path = ? AND project_fingerprint = ? AND ${d}
|
|
58
|
-
ORDER BY symbol, version DESC`),writeReferences:e.prepare(`INSERT OR REPLACE INTO semantic_references
|
|
59
|
-
(relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:e.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?")}}catch(e){E("disabled (open failed)",e)}return u.set(r,n),n}function l(r,n,e){E(`disabled (${n})`,e),u.set(r,null)}function U(r){if(!r)return null;try{F(T(r),{recursive:!0});let n=new _(r);return n.pragma("journal_mode = WAL"),n.pragma("busy_timeout = 250"),n.pragma("synchronous = NORMAL"),n.exec(`
|
|
60
|
-
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
61
|
-
kind TEXT NOT NULL,
|
|
62
|
-
relative_path TEXT NOT NULL,
|
|
63
|
-
content_hash TEXT NOT NULL,
|
|
64
|
-
version TEXT NOT NULL,
|
|
65
|
-
payload TEXT NOT NULL,
|
|
66
|
-
last_accessed_at INTEGER NOT NULL,
|
|
67
|
-
PRIMARY KEY (kind, relative_path, content_hash, version)
|
|
68
|
-
);
|
|
69
|
-
CREATE INDEX IF NOT EXISTS idx_file_evidence_lru
|
|
70
|
-
ON file_evidence(last_accessed_at, kind, relative_path, content_hash, version);
|
|
71
|
-
`),{evidence:n,readFileEvidence:n.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),existsFileEvidence:n.prepare("SELECT 1 AS present FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:n.prepare(`INSERT INTO file_evidence (kind, relative_path, content_hash, version, payload, last_accessed_at)
|
|
72
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
73
|
-
ON CONFLICT(kind, relative_path, content_hash, version)
|
|
74
|
-
DO UPDATE SET payload = excluded.payload, last_accessed_at = excluded.last_accessed_at`),touchFileEvidence:n.prepare(`UPDATE file_evidence
|
|
75
|
-
SET last_accessed_at = ?
|
|
76
|
-
WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?
|
|
77
|
-
AND last_accessed_at < ?`)}}catch(n){return E("shared cache disabled (open failed)",n),null}}function v(r,n,e){E(`shared cache disabled (${n})`,e);try{r.shared?.evidence.close()}catch{}r.shared=null}function $(r,n={}){if(!A(r))return null;let e;try{e=new _(r),e.pragma("busy_timeout = 50"),e.exec(`CREATE INDEX IF NOT EXISTS idx_file_evidence_lru
|
|
78
|
-
ON file_evidence(last_accessed_at, kind, relative_path, content_hash, version)`),e.pragma("wal_checkpoint(TRUNCATE)");let a=e.prepare("SELECT COUNT(*) AS count FROM file_evidence").get().count,t=n.maxRows??I,i=n.budgetBytes??x,c=Number(e.pragma("page_size",{simple:!0})),S=Number(e.pragma("page_count",{simple:!0})),R=Number(e.pragma("freelist_count",{simple:!0})),f=Math.max(0,S-R)*c,L=a>0&&f>i?Math.min(a,Math.ceil((f-i)/Math.max(1,f/a))):0,p=Math.max(a-t,L);return p>0&&(e.prepare(`DELETE FROM file_evidence WHERE rowid IN (
|
|
79
|
-
SELECT rowid FROM file_evidence ORDER BY last_accessed_at ASC, rowid ASC LIMIT ?
|
|
80
|
-
)`).run(p),e.pragma("wal_checkpoint(TRUNCATE)")),{deletedRows:p,remainingRows:a-p}}catch(a){return E("shared cache maintenance skipped",a),null}finally{try{e?.close()}catch{}}}function G(r,n,e,a){let t=o(r);if(!t)return null;try{let i=t.readFileEvidence.get(n,e,a,s)??t.readLegacyFileEvidence.get(n,e,a);if(i?.payload!==void 0)return i.payload;if(!h.has(n)||!t.shared)return null;try{let c=t.shared.readFileEvidence.get(n,e,a,s);return c?.payload!==void 0&&D(t.shared,n,e,a),c?.payload??null}catch(c){return v(t,"file_evidence read",c),null}}catch(i){return l(r,"file_evidence read",i),null}}function J(r,n,e,a){let t=o(r);if(!t)return!1;try{if((t.existsFileEvidence.get(n,e,a,s)??t.existsLegacyFileEvidence.get(n,e,a))?.present!==void 0)return!0;if(!h.has(n)||!t.shared)return!1;try{return t.shared.existsFileEvidence.get(n,e,a,s)?.present===void 0?!1:(D(t.shared,n,e,a),!0)}catch(c){return v(t,"file_evidence exists",c),!1}}catch(i){return l(r,"file_evidence exists",i),!1}}function D(r,n,e,a){let t=Date.now();try{r.touchFileEvidence.run(t,n,e,a,s,t-k)}catch(i){E("shared file_evidence recency touch skipped",i)}}function z(r,n,e,a,t){let i=o(r);if(i)try{if(i.writeFileEvidence.run(n,e,a,s,t),h.has(n)&&i.shared)try{i.shared.writeFileEvidence.run(n,e,a,s,t,Date.now())}catch(c){v(i,"file_evidence write",c)}}catch(c){l(r,"file_evidence write",c)}}function Q(r,n){if(n.length===0)return;let e=o(r);if(e)try{e.evidence.transaction(()=>{for(let t of n)e.writeFileEvidence.run(t.kind,t.relativePath,t.contentHash,s,t.payload)})();try{e.evidence.pragma("wal_checkpoint(TRUNCATE)")}catch{}let a=n.filter(t=>h.has(t.kind));if(a.length>0&&e.shared)try{e.shared.evidence.transaction(()=>{for(let t of a)e.shared.writeFileEvidence.run(t.kind,t.relativePath,t.contentHash,s,t.payload,Date.now())})()}catch(t){v(e,"file_evidence batch write",t)}}catch(a){l(r,"file_evidence batch write",a)}}function q(r,n,e,a){let t=o(r);if(!t)return null;try{return(t.readProjectEvidence.get(n,e,a,s)??t.readLegacyProjectEvidence.get(n,e,a))?.payload??null}catch(i){return l(r,"project_evidence read",i),null}}function Z(r,n,e,a,t){let i=o(r);if(i)try{i.writeProjectEvidence.run(n,e,a,s,t)}catch(c){l(r,"project_evidence write",c)}}function ee(r,n,e,a){if(e===a)return 0;let t=o(r);if(!t)return 0;try{return t.rekeyProjectEvidenceKind.run(a,s,n,e).changes}catch(i){return l(r,"project_evidence kind rekey",i),0}}function ne(r,n,e,a){let t=o(r);if(!t)return new Map;try{let i=t.readCalleesForFile.all(n,e,a,s),c=t.readLegacyCalleesForFile.all(n,e,a);return m([...c,...i])}catch(i){return l(r,"semantic_callees bulk read",i),new Map}}function te(r,n,e){let a=o(r);if(!a)return new Map;try{let t=a.readReferencesForFile.all(n,e,s),i=a.readLegacyReferencesForFile.all(n,e);return m([...i,...t])}catch(t){return l(r,"semantic_references bulk read",t),new Map}}function m(r){let n=new Map;for(let e of r)n.set(e.symbol,e.payload);return n}function re(r,n){if(n.length===0)return;let e=o(r);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let t of n){let i=`${t.relativePath}\0${t.contentHash}`;a.has(i)||(a.add(i),e.dropStaleCallees.run(t.relativePath,t.contentHash)),e.writeCallees.run(t.relativePath,t.symbol,t.contentHash,t.depsDigest,s,t.payload)}})()}catch(a){l(r,"semantic_callees write",a)}}function ae(r,n){if(n.length===0)return;let e=o(r);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let t of n){let i=`${t.relativePath}\0${t.projectFingerprint}`;a.has(i)||(a.add(i),e.dropStaleReferences.run(t.relativePath,t.projectFingerprint)),e.writeReferences.run(t.relativePath,t.symbol,t.projectFingerprint,s,t.payload)}})()}catch(a){l(r,"semantic_references write",a)}}function ce(r){return typeof r=="object"&&r!==null}function se(r){return Array.isArray(r)&&r.every(n=>typeof n=="string")?r:null}export{O as a,N as b,Y as c,V as d,$ as e,G as f,J as g,z as h,Q as i,q as j,Z as k,ee as l,ne as m,te as n,re as o,ae as p,ce as q,se as r};
|
|
81
|
-
//# sourceMappingURL=chunk-RTQ7NEKG.js.map
|
package/dist/chunk-TPFHAQ2G.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as D}from"./chunk-WOIKCX6A.js";import{d as H,e as J,f as ee,m as Z}from"./chunk-DYGHBZ2N.js";import{c as Y,t as T,u as U}from"./chunk-N2ZSIIGR.js";import{f as R,h as E,n as z,r as N,t as j,y as A}from"./chunk-ODDUPDP7.js";import{D as w}from"./chunk-ZOHS7AQV.js";import{h as X}from"./chunk-FESCRNVV.js";import{E as G,H as K,d as M}from"./chunk-N5B2NILC.js";var te=new WeakMap,ne=new WeakMap,re=new WeakMap,ie=new WeakMap,ae=new WeakMap;function qe(t,e){let n=ne.get(t);n||(n=new Map,ne.set(t,n));let r=n.get(e);if(r)return r;let i=w(t,e)?.rootNode;if(!i)return n.set(e,[]),[];let o=new Set;I(i,c=>{if(c.type!=="call_expression")return;let p=c.childForFieldName("function")??c.namedChild(0),s=/^([A-Za-z_$][\w$]*(?:\.Service)?)\.of$/u.exec(p?.text.replace(/\s+/gu,"")??"");s&&o.add(s[1])});let m=A(t,e).filter(c=>!!c.sourcePath),u=new Set;for(let c of o){let p=/^([A-Za-z_$][\w$]*)\.Service$/u.exec(c);if(p){for(let s of m)s.localName===p[1]&&u.add(s.sourcePath);continue}if(c==="Service"){T(t,e).some(s=>s.leaf==="Service")&&u.add(e);for(let s of m)(s.localName??s.importedName)==="Service"&&u.add(s.sourcePath)}}let l=Q([...u]).sort();return n.set(e,l),l}function Ge(t,e,n={}){let i=j(t,e)?.filter(a=>!n.ranges||n.ranges.some(d=>a.line>=d.startLine&&a.line<=d.endLine));if(!i)return{targets:[],unresolvedCallsites:0};let o=A(t,e).filter(a=>!!a.sourcePath),m=Fe(X(t,e)??""),u=w(t,e)?.rootNode??null,l=u?ge(u):se(),c=new Map,p=ee(t),s=[],f=0;for(let a of i){if(!a.memberAccess)continue;let d=H(e,p.get(a.calleeLeaf)??[]);if(n.excludeIndexedTargets!==!1&&J(t,e,d,!0,a.calleeQualifier))continue;let h=a.calleeQualifier,L=$e(t,e,a,o);if(L){s.push(L);continue}let S=pe(t,e,a,o,he(l,a.calleeQualifier,a.line));if(S.length>0){s.push(...S);continue}let x=ye(t,e,a);if(x.length>0){s.push(...x);continue}let y=h?m.get(h)??h:null,P=(y?Q(o.filter(g=>(g.localName??g.importedName)===y).map(g=>g.sourcePath)):[]).flatMap(g=>{let v=c.get(g);return v||(v=N(t,g)??[],c.set(g,v)),v.filter(b=>b.name===a.calleeLeaf).map(b=>({file:g,callable:b}))});if(P.length!==1){f+=1;continue}let _=P[0];s.push({calleeLeaf:a.calleeLeaf,line:a.line,sourceFile:e,targetFile:_.file,targetStartLine:_.callable.startLine,targetEndLine:_.callable.endLine,resolution:"direct-import-receiver",strength:"candidate"})}return{targets:s,unresolvedCallsites:f}}function pe(t,e,n,r,i){let o=n.calleeQualifier;if(!o||!/^[A-Za-z_$][\w$]*$/u.test(o))return[];if(i.size!==1)return[];let m=[...i][0],u=Q(r.filter(p=>p.localName===m||p.importedName===m).map(p=>p.sourcePath));if(u.length!==1)return[];let l=u[0],c=be(t,l,n.calleeLeaf);return c.map(p=>({calleeLeaf:p.name,line:n.line,sourceFile:e,targetFile:p.file,targetStartLine:p.startLine,targetEndLine:p.endLine,serviceFile:l,resolutionAlternativeCount:c.length,resolution:"imported-service-object-member",strength:"candidate"}))}function se(){return{declarations:new Map,callbacks:[]}}function ge(t){let e=se();return I(t,n=>{if(n.type==="variable_declarator"){let l=n.childForFieldName("name")??n.namedChild(0),c=n.childForFieldName("value")??n.namedChild(1);if(l?.type!=="identifier"||!c)return;let p=new Set;if(I(c,s=>{if(s.type!=="member_expression")return;let f=s.childForFieldName("object")??s.namedChild(0),a=s.childForFieldName("property")??s.namedChild(1);f?.type==="identifier"&&a?.text==="Service"&&p.add(f.text)}),p.size===1){let s=e.declarations.get(l.text)??[];s.push({line:n.startPosition.row,alias:[...p][0]}),e.declarations.set(l.text,s)}return}if(!["arrow_function","function_expression","generator_function"].includes(n.type))return;let r=n.childForFieldName("parameters")??n.childForFieldName("parameter");if(!r)return;let i=n.parent;for(;i&&i.type!=="call_expression";)i=i.parent;if(!i)return;let o=i.childForFieldName("function")??i.namedChild(0),m=/^([A-Za-z_$][\w$]*)\.Service\.use$/u.exec(o?.text??"");if(!m)return;let u=new Set;I(r,l=>{l.type==="identifier"&&u.add(l.text)}),u.size!==0&&e.callbacks.push({startLine:n.startPosition.row,endLine:n.endPosition.row,receivers:u,alias:m[1]})}),e}function he(t,e,n){if(!e||!/^[A-Za-z_$][\w$]*$/u.test(e))return new Set;let r=new Set((t.declarations.get(e)??[]).filter(i=>i.line<=n).map(i=>i.alias));for(let i of t.callbacks)i.startLine<=n&&i.endLine>=n&&i.receivers.has(e)&&r.add(i.alias);return r}function ye(t,e,n){let r=n.calleeQualifier;if(!r||!/^[A-Za-z_$][\w$]*$/u.test(r))return[];let i=w(t,e)?.rootNode;if(!i)return[];let o=Le(t,e,i,n.line,n.calleeLeaf,r),m=o?xe(o,r):null;if(!m)return[];if(!Se(m))return[];let u=(N(t,e)??[]).filter(a=>a.startLine<=m.startPosition.row&&a.endLine>=m.endPosition.row).sort((a,d)=>a.endLine-a.startLine-(d.endLine-d.startLine))[0];if(!u)return[];let l=T(t,e).filter(a=>a.isFunctionLike&&a.leaf===u.name);if(l.length!==1)return[];let c=l[0],p=ie.get(t);p||(p=new Map,ie.set(t,p));let s=`${c.symbol}\0${n.calleeLeaf}`,f=p.get(s);if(!f){let a=[];for(let d of Z(t,c)){let h=w(t,d.file)?.rootNode;if(!h)continue;let L=R(h,"call_expression").filter(y=>y.startPosition.row>d.line||y.endPosition.row<d.line?!1:(y.childForFieldName("function")??y.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,"").match(/[A-Za-z_$][\w$]*$/u)?.[0]===c.leaf);if(L.length!==1)continue;let x=L[0].childForFieldName("arguments")?.namedChildren.find(y=>F(y).type==="object");if(x)for(let y of F(x).namedChildren){if(y.type==="shorthand_property_identifier"&&y.text===n.calleeLeaf){a.push(...O(t,d.file,n.calleeLeaf,y,y));continue}if(y.type!=="pair")continue;let $=y.childForFieldName("key")??y.namedChild(0),P=y.childForFieldName("value")??y.namedChild(1);k($?.text)!==n.calleeLeaf||!P||a.push(...O(t,d.file,n.calleeLeaf,P,y))}}f=a.filter((d,h,L)=>L.findIndex(S=>S.file===d.file&&S.startLine===d.startLine&&S.endLine===d.endLine&&S.name===d.name)===h),p.set(s,f)}return f.map(a=>({calleeLeaf:a.name,line:n.line,sourceFile:e,targetFile:a.file,targetStartLine:a.startLine,targetEndLine:a.endLine,resolutionAlternativeCount:f.length,resolution:"factory-callback-member",strength:f.length===1?"exact":"candidate"}))}function Le(t,e,n,r,i,o){let m=re.get(t);m||(m=new Map,re.set(t,m));let u=m.get(e);if(!u){u=new Map;for(let l of R(n,"call_expression")){let c=l.childForFieldName("function")??l.namedChild(0),p=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(c?.text.replace(/\s+/gu,"")??"");if(p)for(let s=l.startPosition.row;s<=l.endPosition.row;s+=1){let f=`${s}\0${p[1]}\0${p[2]}`,a=u.get(f);(!a||l.endIndex-l.startIndex<a.endIndex-a.startIndex)&&u.set(f,l)}}m.set(e,u)}return u.get(`${r}\0${o}\0${i}`)??null}function Se(t){return t.descendantsOfType("return_statement").some(e=>{let n=e.childForFieldName("argument")??e.namedChild(0);return!!(n&&F(n).type==="object")})}function xe(t,e){let n=t.parent;for(;n;){if(/(?:function|method|lambda)/u.test(n.type)||n.type==="arrow_function"){let r=n.childForFieldName("parameters")??n.childForFieldName("parameter"),i=!1;if(r&&I(r,o=>{o.type==="identifier"&&o.text===e&&(i=!0)}),i)return n}n=n.parent}return null}function O(t,e,n,r,i){if(r.type==="identifier")return(N(t,e)??[]).filter(l=>l.name===r.text).map(l=>({...l,file:e}));let o=B(t,e,r.text);if(o.length>0)return o;if(!W(r))return[];let u=(N(t,e)??[]).filter(l=>l.startLine>=i.startPosition.row&&l.endLine<=i.endPosition.row&&(l.name===n||l.name.startsWith("source@"))).sort((l,c)=>l.endLine-l.startLine-(c.endLine-c.startLine))[0];return[u?{...u,file:e}:{name:n,file:e,startLine:i.startPosition.row,endLine:i.endPosition.row}]}function be(t,e,n){let r=ae.get(t);r||(r=new Map,ae.set(t,r));let i=`${e}\0${n}`,o=r.get(i);if(o)return o;let m=ve(t,e).flatMap(u=>Ce(t,u,e,n));return r.set(i,m),m}function Ce(t,e,n,r){let i=w(t,e)?.rootNode,o=N(t,e)??[];if(!i)return[];let m=we(t,e,n);if(m.size===0)return[];let u=new Set,l=[],c=[],p=[];return I(i,f=>{if(Ne(f,m)){if(f.type==="pair"){let a=f.childForFieldName("key")??f.namedChild(0),d=f.childForFieldName("value")??f.namedChild(1);if(k(a?.text)!==r||!d)return;if(d.type==="identifier")u.add(d.text);else if(W(d))l.push({name:r,startLine:f.startPosition.row,endLine:f.endPosition.row});else{let h=Ie(t,e,d.text),L=B(t,e,d.text);if(h.length>0)p.push(...h);else if(L.length>0)p.push(...L);else{let S=Pe(f);S&&c.push(S)}}return}f.type==="shorthand_property_identifier"&&f.text===r&&u.add(r)}}),[...o.filter(f=>u.has(f.name)).map(f=>({...f,file:e})),...l.map(f=>({...f,file:e})),...c.map(f=>({...f,file:e})),...p].filter((f,a,d)=>d.findIndex(h=>h.file===f.file&&h.name===f.name&&h.startLine===f.startLine&&h.endLine===f.endLine)===a)}function Ne(t,e){let n=t,r=null;for(;n;){if(n.type==="object"&&(r=n),n.type==="call_expression"){if(!r)return!1;let i=n.childForFieldName("function")??n.namedChild(0);return i?e.has(i.text.replace(/\.of$/u,""))&&i.text.endsWith(".of"):!1}n=n.parent}return!1}function ve(t,e){let n=te.get(t);n||(n=new Map,te.set(t,n));let r=n.get(e);if(r)return r;let i=new Set([e]),o=T(t,e).filter(u=>u.leaf==="Service"&&u.isTypeLike);for(let u of o)for(let l of Z(t,u))i.add(l.file);let m=[...i].sort();return n.set(e,m),m}function we(t,e,n){let r=new Set;M(e,n)&&r.add("Service");for(let i of A(t,e)){if(!i.sourcePath||!M(i.sourcePath,n))continue;if(i.kind==="namespace"&&i.localName){r.add(`${i.localName}.Service`);continue}(i.importedName==="default"?i.localName:i.importedName)==="Service"?r.add(i.localName??i.importedName):i.localName&&i.importedName!=="default"&&r.add(`${i.localName}.Service`)}return r}function B(t,e,n){let r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!r)return[];let i=w(t,e)?.rootNode;if(!i)return[];let o=oe(i,r[1]),m=o?le(o):null;if(!m)return[];let u=m.childForFieldName("function")??m.namedChild(0),l=u?ce(t,e,u.text):[];if(l.length!==1)return[];let c=l[0],p=w(t,c.relativePath)?.rootNode;if(!p)return[];let s=E(p,c.startLine,c.endLine);if(!s)return[];let f=[];for(let a of s.descendantsOfType("return_statement")){let d=a.childForFieldName("argument")??a.namedChild(0);if(!d)continue;let h=F(d);if(h.type==="object")for(let L of h.namedChildren){if(L.type==="shorthand_property_identifier"&&L.text===r[2]){for(let y of N(t,c.relativePath)??[])y.name===r[2]&&f.push({...y,file:c.relativePath});continue}if(L.type!=="pair")continue;let S=L.childForFieldName("key")??L.namedChild(0),x=L.childForFieldName("value")??L.namedChild(1);if(!(k(S?.text)!==r[2]||!x))if(x.type==="identifier")for(let y of N(t,c.relativePath)??[])y.name===x.text&&f.push({...y,file:c.relativePath});else W(x)&&f.push({name:r[2],startLine:L.startPosition.row,endLine:L.endPosition.row,file:c.relativePath})}}return f.filter((a,d,h)=>h.findIndex(L=>L.file===a.file&&L.name===a.name&&L.startLine===a.startLine&&L.endLine===a.endLine)===d)}function Ie(t,e,n){let r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!r)return[];let i=w(t,e)?.rootNode;if(!i)return[];let o=oe(i,r[1]),m=o?le(o):null,u=m?.childForFieldName("function")??m?.namedChild(0),l=u?ce(t,e,u.text):[];if(l.length!==1||!m)return[];let c=l[0],p=w(t,c.relativePath)?.rootNode;if(!p)return[];let s=E(p,c.startLine,c.endLine);if(!s)return[];let f=new Set,a=s.childForFieldName("parameters")??s.childForFieldName("parameter");if(a&&I(a,g=>{g.type==="identifier"&&f.add(g.text)}),f.size===0)return[];let d=B(t,e,n);if(d.length===0)return[];let h=(N(t,c.relativePath)??[]).filter(g=>g.startLine>=c.startLine&&g.endLine<=c.endLine),L=(j(t,c.relativePath)??[]).filter(g=>g.line>=c.startLine&&g.line<=c.endLine),S=new Set,x=d.map(g=>({name:g.name,startLine:g.startLine,endLine:g.endLine})),y=new Set;for(;x.length>0&&y.size<32;){let g=x.shift(),v=`${g.name}\0${g.startLine}\0${g.endLine}`;if(!y.has(v)){y.add(v);for(let b of L.filter(C=>C.line>=g.startLine&&C.line<=g.endLine)){if(b.memberAccess&&b.calleeQualifier&&f.has(b.calleeQualifier)){S.add(b.calleeLeaf);continue}if(b.memberAccess)continue;let C=h.filter(de=>de.name===b.calleeLeaf);C.length===1&&x.push(C[0])}}}if(S.size===0)return[];let P=m.childForFieldName("arguments")?.namedChildren.find(g=>F(g).type==="object");if(!P)return[];let _=[];for(let g of F(P).namedChildren){if(g.type==="shorthand_property_identifier"&&S.has(g.text)){_.push(...O(t,e,g.text,g,g));continue}if(g.type!=="pair")continue;let v=g.childForFieldName("key")??g.namedChild(0),b=g.childForFieldName("value")??g.namedChild(1),C=k(v?.text);!C||!S.has(C)||!b||_.push(...O(t,e,C,b,g))}return _.filter((g,v,b)=>b.findIndex(C=>C.file===g.file&&C.name===g.name&&C.startLine===g.startLine&&C.endLine===g.endLine)===v)}function oe(t,e){for(let n of R(t,"variable_declarator"))if((n.childForFieldName("name")??n.namedChild(0))?.text===e)return n.childForFieldName("value")??n.namedChild(1);return null}function le(t){return t.type==="call_expression"?t:t.descendantsOfType("call_expression")[0]??null}function ce(t,e,n){let r=n.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,""),i=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(r);if(i){let s=A(t,e).filter(d=>d.localName===i[1]&&d.sourcePath);if(s.length!==1||!s[0].sourcePath)return[];let f=s[0].sourcePath,a=D(t,f,i[2]).filter(d=>d.isFunctionLike);return a.length>0?a:(N(t,f)??[]).filter(d=>d.name===i[2]).map(d=>({...d,relativePath:f}))}if(!/^[A-Za-z_$][\w$]*$/u.test(r))return[];let o=T(t,e).filter(s=>s.leaf===r&&s.isFunctionLike);if(o.length>0)return o;let m=(N(t,e)??[]).filter(s=>s.name===r).map(s=>({...s,relativePath:e}));if(m.length>0)return m;let u=A(t,e).filter(s=>s.localName===r&&s.sourcePath&&s.kind!=="namespace");if(u.length!==1||!u[0].sourcePath)return[];let l=u[0].sourcePath,c=u[0].importedName==="default"?r:u[0].importedName,p=D(t,l,c).filter(s=>s.isFunctionLike);return p.length>0?p:(N(t,l)??[]).filter(s=>s.name===c).map(s=>({...s,relativePath:l}))}function W(t){return["arrow_function","function_expression","generator_function"].includes(t.type)||t.descendantsOfType(["arrow_function","function_expression","generator_function"]).length>0}function Pe(t){let e=t.parent;for(;e;){if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0);if(n?.type==="identifier")return{name:n.text,startLine:e.startPosition.row,endLine:e.endPosition.row}}e=e.parent}return null}function k(t){return t?t.replace(/^(?:['"])(.*)(?:['"])$/u,"$1"):null}function $e(t,e,n,r){let i=/^this\.([A-Za-z_$][\w$]*)$/u.exec(n.calleeQualifier??"");if(!i)return null;let o=w(t,e)?.rootNode;if(!o)return null;let m=_e(o,n.line);if(!m)return null;let u=new Set;if(I(m,h=>{if(h.type!=="assignment_expression")return;let L=h.childForFieldName("left")??h.namedChild(0),S=h.childForFieldName("right")??h.namedChild(h.namedChildCount-1);if(L?.text.replace(/\s+/gu,"")!==`this.${i[1]}`||!S)return;let x=F(S);if(x.type!=="new_expression")return;let $=(x.childForFieldName("constructor")??x.namedChild(0))?.text.match(/[A-Za-z_$][\w$]*$/u)?.[0];$&&u.add($)}),u.size!==1)return null;let l=[...u][0],c=r.filter(h=>h.localName===l);if(c.length!==1)return null;let p=c[0].importedName==="default"?l:c[0].importedName,s=c[0].importedName==="default"?D(t,c[0].sourcePath,l):[],f=s.length===1?s[0].leaf:p,a=T(t,c[0].sourcePath).filter(h=>h.isFunctionLike&&h.leaf===n.calleeLeaf&&Y(h.symbol)===f);if(a.length!==1)return null;let d=a[0];return{calleeLeaf:n.calleeLeaf,line:n.line,sourceFile:e,targetFile:d.relativePath,targetStartLine:d.startLine,targetEndLine:d.endLine,targetSymbol:d.symbol,resolution:"constructed-member-receiver",strength:"exact"}}function _e(t,e){let n=[];return I(t,r=>{["class","class_declaration","class_definition"].includes(r.type)&&r.startPosition.row<=e&&r.endPosition.row>=e&&n.push(r)}),n.sort((r,i)=>r.endPosition.row-r.startPosition.row-(i.endPosition.row-i.startPosition.row))[0]??null}function F(t){let e=t;for(;["parenthesized_expression","as_expression","type_assertion","satisfies_expression"].includes(e.type)&&e.namedChildCount===1;)e=e.namedChild(0);return e}function I(t,e){e(t);for(let n of t.namedChildren)I(n,e)}function Fe(t){let e=new Map,n=/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*;/gu;for(let r of t.matchAll(n)){let i=r[1],o=r[2];i&&o&&e.set(i,o)}return e}function Q(t){let e=[];for(let n of t)e.some(r=>M(r,n))||e.push(n);return e}import{existsSync as Te}from"fs";import{SymbolRole as Me}from"@c4312/scip";import{deserializeSCIP as Ae}from"@c4312/scip";function ue(t,e){return Ae(K(t,{inputKind:e,maxBytes:G}))}var V=new WeakMap;function rt(t,e,n,r){let i=z(t,e),o=(i?.callSites??[]).filter(a=>a.line>=n&&a.line<=r);if(!i||o.length===0)return{available:!!i,targets:[],resolvedCallsites:0,unresolvedCallsites:0};let m=q(t);if(!m)return{available:!1,targets:[],resolvedCallsites:0,unresolvedCallsites:o.length};let u=(m.byFile.get(e)??[]).filter(a=>a.sourceLine>=n&&a.sourceLine<=r).map(a=>({...a,calleeLeaf:a.definition.leaf})),l=fe(o.map(a=>({line:a.line,leaf:a.calleeLeaf}))),c=fe(u.map(a=>({line:a.sourceLine,leaf:a.calleeLeaf}))),p=new Set([...l].flatMap(([a,d])=>c.get(a)===d?[a]:[])),s=u.filter(a=>p.has(me(a.sourceLine,a.calleeLeaf))),f=[...p].reduce((a,d)=>a+(l.get(d)??0),0);return{available:!0,targets:s,resolvedCallsites:f,unresolvedCallsites:Math.max(0,o.length-f)}}function it(t,e,n,r){let i=q(t);return i?{available:!0,targets:(i.byFile.get(e)??[]).filter(o=>o.sourceLine>=n&&o.sourceLine<=r)}:{available:!1,targets:[]}}function at(t,e,n,r){let i=q(t);return i?{available:!0,targets:(i.byFile.get(e)??[]).filter(o=>o.sourceLine>=n&&o.sourceLine<=r&&De(t,o.definition)).map(o=>({...o,calleeLeaf:o.definition.leaf}))}:{available:!1,targets:[]}}function q(t){if(V.has(t))return V.get(t)??null;let e=Re(t);return V.set(t,e),e}function Re(t){if(!t.generation.indexPath||!Te(t.generation.indexPath))return null;try{let e=U(t),n=new Map(e.map(o=>[o.symbol,o])),r=ue(t.generation.indexPath,"SCIP source-range call-target index"),i=new Map;for(let o of r.documents??[]){let m=o.relativePath;if(!m||t.isIgnored(m))continue;let u=[];for(let l of o.occurrences??[]){if(!l.symbol||(l.symbolRoles&Me.Definition)!==0)continue;let c=n.get(l.symbol),p=l.range?.[0];!c||!Number.isInteger(p)||u.push({sourceLine:p,definition:c})}i.set(m,u)}return{byFile:i}}catch{return null}}function De(t,e){if(!e.isFunctionLike)return!1;let n=z(t,e.relativePath);return!n||n.callables.some(r=>r.name===e.leaf&&r.startLine===e.startLine&&r.endLine===e.endLine)?!0:Oe(e)}function Oe(t){let e=t.documentation;if(!e)return!1;let n=t.leaf.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`\\bfunction\\s+${n}\\s*(?:<[^>]*>)?\\s*\\(`,"u").test(e)||new RegExp(`\\b(?:const|let|var)\\s+${n}\\s*:\\s*(?:<[^>]*>\\s*)?\\([^\\n]*\\)\\s*=>`,"u").test(e)}function fe(t){let e=new Map;for(let n of t){let r=me(n.line,n.leaf);e.set(r,(e.get(r)??0)+1)}return e}function me(t,e){return`${t}\0${e}`}export{qe as a,Ge as b,rt as c,it as d,at as e,De as f};
|
|
2
|
-
//# sourceMappingURL=chunk-TPFHAQ2G.js.map
|