agentic-qe 3.9.33 → 3.9.35
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/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +104 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/audit/witness-chain.d.ts +7 -0
- package/dist/audit/witness-chain.js +9 -0
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-JUISYMI3.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-DUOP4SS6.js → agent-booster-wasm-4PJZ34PF.js} +2 -2
- package/dist/cli/chunks/{agent-handler-6AHMQ5OK.js → agent-handler-OB5JATVT.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-77WTL4KU.js → agent-memory-branch-ZEHRWZ5R.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-DEIUPULJ.js +2 -0
- package/dist/cli/chunks/{audit-ZRSUAGID.js → audit-PWFRSBBW.js} +2 -2
- package/dist/cli/chunks/base-7SMQWXHT.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-SDVX3I7F.js → better-sqlite3-XEIBI22V.js} +2 -2
- package/dist/cli/chunks/{brain-handler-EPNKL22C.js → brain-handler-6SMUCFO7.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-VVPWHTZ4.js → branch-enumerator-U6ROQR4O.js} +2 -2
- package/dist/cli/chunks/{browser-NNQ6UHFJ.js → browser-BMM57TA3.js} +2 -2
- package/dist/cli/chunks/browser-workflow-4DGHRZLS.js +2 -0
- package/dist/cli/chunks/{chunk-KQDWD34T.js → chunk-2FTSVPVG.js} +1 -1
- package/dist/cli/chunks/{chunk-JHFQJKTW.js → chunk-2ICMLI2T.js} +2 -2
- package/dist/cli/chunks/{chunk-IQ5OS342.js → chunk-2UY3X3KE.js} +9 -9
- package/dist/cli/chunks/{chunk-2NRCDJBB.js → chunk-3BDZSWCA.js} +2 -2
- package/dist/cli/chunks/{chunk-DLUEORKO.js → chunk-3R6YQEQY.js} +4 -4
- package/dist/cli/chunks/{chunk-TGMZ7K72.js → chunk-3UGY4ZQB.js} +1 -1
- package/dist/cli/chunks/{chunk-FRS4DYHG.js → chunk-3YIVRMQB.js} +1 -1
- package/dist/cli/chunks/{chunk-54B5QL4A.js → chunk-42QMNST6.js} +2 -2
- package/dist/cli/chunks/{chunk-4HJAUI2N.js → chunk-4HJVTKJD.js} +1 -1
- package/dist/cli/chunks/{chunk-LFPYLTNN.js → chunk-4NVDPO7L.js} +2 -2
- package/dist/cli/chunks/{chunk-LAPIIGZ2.js → chunk-4UZ7G2KT.js} +2 -2
- package/dist/cli/chunks/{chunk-4MRVNLCT.js → chunk-4YKHVRQH.js} +3 -3
- package/dist/cli/chunks/{chunk-JEGTTVTL.js → chunk-56O5V5MP.js} +2 -2
- package/dist/cli/chunks/{chunk-SR2EV7PQ.js → chunk-5CZDHJZX.js} +1 -1
- package/dist/cli/chunks/{chunk-VJHKNSOC.js → chunk-5Q7X5SDB.js} +2 -2
- package/dist/cli/chunks/{chunk-KF3R6OCB.js → chunk-5XXZQCHS.js} +1 -1
- package/dist/cli/chunks/{chunk-6DBS53L7.js → chunk-6CCKOU2U.js} +2 -2
- package/dist/cli/chunks/{chunk-KLTN2AVK.js → chunk-6SN55CMC.js} +2 -2
- package/dist/cli/chunks/{chunk-TIEXYJMS.js → chunk-6TYWIS4R.js} +2 -2
- package/dist/cli/chunks/{chunk-H5AQHFIA.js → chunk-6WZNRHJJ.js} +1 -1
- package/dist/cli/chunks/{chunk-LERCHSFI.js → chunk-72HXOVRN.js} +1 -1
- package/dist/cli/chunks/{chunk-JF4SWEMU.js → chunk-7RNLOYAP.js} +2 -2
- package/dist/cli/chunks/{chunk-C2XCETKV.js → chunk-A5LZVQQL.js} +3 -3
- package/dist/cli/chunks/chunk-A7QP5E46.js +2 -0
- package/dist/cli/chunks/{chunk-JMSQW6KN.js → chunk-AAVOYIKA.js} +1 -1
- package/dist/cli/chunks/chunk-ACL5JFJR.js +2 -0
- package/dist/cli/chunks/{chunk-CCSISDAP.js → chunk-BBHTM2RF.js} +1 -1
- package/dist/cli/chunks/chunk-BCD2IMXF.js +9 -0
- package/dist/cli/chunks/{chunk-LXWXZPEB.js → chunk-BEJAUYFA.js} +2 -2
- package/dist/cli/chunks/{chunk-GVO53VR5.js → chunk-BKF3E3UJ.js} +1 -1
- package/dist/cli/chunks/{chunk-ZUFM5K7F.js → chunk-BSM7YJBY.js} +1 -1
- package/dist/cli/chunks/{chunk-PIINM2PD.js → chunk-BTPDHALG.js} +2 -2
- package/dist/cli/chunks/{chunk-3J4TTZP7.js → chunk-BTQA2E2Y.js} +2 -2
- package/dist/cli/chunks/{chunk-23VQRQCC.js → chunk-BXBUUSJN.js} +3 -3
- package/dist/cli/chunks/{chunk-BLNISJ3M.js → chunk-C7QVMFCJ.js} +3 -3
- package/dist/cli/chunks/{chunk-GLA2TD4M.js → chunk-CMKNLC3Q.js} +4 -4
- package/dist/cli/chunks/{chunk-7HRE2VTG.js → chunk-CROIRPKG.js} +2 -2
- package/dist/cli/chunks/{chunk-MZ6GBVQY.js → chunk-CTU4V32J.js} +2 -2
- package/dist/cli/chunks/{chunk-L77OGJVK.js → chunk-D2ITP3ON.js} +2 -2
- package/dist/cli/chunks/{chunk-Q5JL7NZG.js → chunk-DEJW6GYF.js} +2 -2
- package/dist/cli/chunks/{chunk-LKEQBIX2.js → chunk-E7N6CRFV.js} +1 -1
- package/dist/cli/chunks/{chunk-IWBJ7KB7.js → chunk-F6R2TGNS.js} +2 -2
- package/dist/cli/chunks/{chunk-IXWIABRJ.js → chunk-FMAUTL26.js} +2 -2
- package/dist/cli/chunks/{chunk-7ZMRQKO2.js → chunk-FMV22K3J.js} +2 -2
- package/dist/cli/chunks/{chunk-AVQS5H7Y.js → chunk-FMZ7I4XV.js} +1 -1
- package/dist/cli/chunks/{chunk-LJBVPR3Z.js → chunk-FPPV7TYI.js} +2 -2
- package/dist/cli/chunks/{chunk-UBOH75WQ.js → chunk-FXITHMQB.js} +4 -4
- package/dist/cli/chunks/{chunk-EYCV6IYA.js → chunk-G6BJ5I57.js} +1 -1
- package/dist/cli/chunks/{chunk-WRPQJZSP.js → chunk-GHMIADYW.js} +2 -2
- package/dist/cli/chunks/{chunk-JGCTXHHZ.js → chunk-GQCIW2ZZ.js} +1 -1
- package/dist/cli/chunks/{chunk-B4N7XODV.js → chunk-GR732YA3.js} +2 -2
- package/dist/cli/chunks/{chunk-CG2IM6IA.js → chunk-GWROZUWK.js} +1 -1
- package/dist/cli/chunks/{chunk-JTXZ3MMZ.js → chunk-GWXP36YP.js} +2 -2
- package/dist/cli/chunks/{chunk-KGA5XCHX.js → chunk-H7V3ZQT7.js} +2 -2
- package/dist/cli/chunks/{chunk-MI5TV5HT.js → chunk-HAOGVFKR.js} +2 -2
- package/dist/cli/chunks/{chunk-BD6BS2AL.js → chunk-HGJGU625.js} +2 -2
- package/dist/cli/chunks/{chunk-GBMKXJKW.js → chunk-HKQ23RPJ.js} +5 -5
- package/dist/cli/chunks/{chunk-HCAWQ7ZD.js → chunk-HMIRBSTI.js} +2 -2
- package/dist/cli/chunks/{chunk-JJY6K3OI.js → chunk-HSR7EHVN.js} +1 -1
- package/dist/cli/chunks/{chunk-QCFJQZXN.js → chunk-I5XEXLBF.js} +1 -1
- package/dist/cli/chunks/{chunk-TNQW3FUW.js → chunk-I7XQT6YM.js} +2 -2
- package/dist/cli/chunks/{chunk-6TC6UCDL.js → chunk-ICYM7H6T.js} +2 -2
- package/dist/cli/chunks/{chunk-SFNSMZGU.js → chunk-II6DIMY6.js} +2 -2
- package/dist/cli/chunks/{chunk-OPC4ZVSN.js → chunk-INCNWH3R.js} +2 -2
- package/dist/cli/chunks/{chunk-YDIHYU7V.js → chunk-IQ363U37.js} +2 -2
- package/dist/cli/chunks/{chunk-46LV5MI3.js → chunk-IXOGBA7C.js} +13 -13
- package/dist/cli/chunks/{chunk-EVDEFUJG.js → chunk-J2LOP3GE.js} +2 -2
- package/dist/cli/chunks/{chunk-BIXDUMZ4.js → chunk-JNK742DP.js} +1 -1
- package/dist/cli/chunks/{chunk-473YM6LV.js → chunk-JW4N25B5.js} +2 -2
- package/dist/cli/chunks/{chunk-NCTSH4T6.js → chunk-KAEWFVGD.js} +2 -2
- package/dist/cli/chunks/{chunk-HVC3F4IM.js → chunk-M4BCSFVN.js} +1 -1
- package/dist/cli/chunks/{chunk-C5UGKQUG.js → chunk-M7TDNJMZ.js} +1 -1
- package/dist/cli/chunks/{chunk-QYIGUM3F.js → chunk-MHUPY3YO.js} +2 -2
- package/dist/cli/chunks/{chunk-GU5DISHT.js → chunk-MSEG7GKM.js} +1 -1
- package/dist/cli/chunks/chunk-NAVH552F.js +15 -0
- package/dist/cli/chunks/{chunk-F6WQ3ES6.js → chunk-NFIOKKA6.js} +2 -2
- package/dist/cli/chunks/{chunk-63SAZCUH.js → chunk-NJUNYXMH.js} +2 -2
- package/dist/cli/chunks/{chunk-N44DNZTM.js → chunk-NPUMPLL7.js} +1 -1
- package/dist/cli/chunks/{chunk-V7GV54AY.js → chunk-NS4P3VRA.js} +2 -2
- package/dist/cli/chunks/{chunk-IYDZ4NWA.js → chunk-NWWXVXXG.js} +2 -2
- package/dist/cli/chunks/{chunk-UDJLIERV.js → chunk-NZB2JE2D.js} +2 -2
- package/dist/cli/chunks/{chunk-5RILQ3EG.js → chunk-O3MTYRBX.js} +1 -1
- package/dist/cli/chunks/{chunk-ZGR5LFER.js → chunk-OJ5GBEXU.js} +2 -2
- package/dist/cli/chunks/{chunk-FQQJUIN7.js → chunk-OPD6AENV.js} +2 -2
- package/dist/cli/chunks/chunk-PHJK33IV.js +2 -0
- package/dist/cli/chunks/{chunk-24M7JF3G.js → chunk-PK3NAZQI.js} +2 -2
- package/dist/cli/chunks/{chunk-6S5H34AN.js → chunk-PY7PJT2Y.js} +2 -2
- package/dist/cli/chunks/{chunk-YCD3EBQJ.js → chunk-QOAVXGAU.js} +2 -2
- package/dist/cli/chunks/{chunk-FHSCCEHZ.js → chunk-RP5SDWCL.js} +22 -16
- package/dist/cli/chunks/{chunk-MFMPTRZW.js → chunk-RPRFDO23.js} +1 -1
- package/dist/cli/chunks/{chunk-AL54ARD4.js → chunk-RZDMSTAQ.js} +2 -2
- package/dist/cli/chunks/{chunk-GJKTHVFE.js → chunk-S3QU54ZQ.js} +1 -1
- package/dist/cli/chunks/{chunk-DEXOYNIQ.js → chunk-SBDRHY3I.js} +2 -2
- package/dist/cli/chunks/{chunk-NFFA2UKL.js → chunk-SI6VUQSI.js} +3 -3
- package/dist/cli/chunks/{chunk-RP2RRUKT.js → chunk-SMPMLODT.js} +1 -1
- package/dist/cli/chunks/{chunk-VVGXCLJF.js → chunk-SSJV4AZ7.js} +5 -5
- package/dist/cli/chunks/{chunk-HRE4TFMN.js → chunk-T26ENWX5.js} +8 -8
- package/dist/cli/chunks/{chunk-MAP6IAOP.js → chunk-T2QVCK56.js} +1 -1
- package/dist/cli/chunks/{chunk-NNFWNI6A.js → chunk-T4HZLBM4.js} +2 -2
- package/dist/cli/chunks/{chunk-FEJCPLXV.js → chunk-TE27EK44.js} +2 -2
- package/dist/cli/chunks/{chunk-U5L7FALK.js → chunk-TLBIFZM4.js} +2 -2
- package/dist/cli/chunks/{chunk-OXGZKXSI.js → chunk-UDKBQAAH.js} +2 -2
- package/dist/cli/chunks/{chunk-AGMHJ3GS.js → chunk-UJTI5MRE.js} +2 -2
- package/dist/cli/chunks/{chunk-3B5ZAFB2.js → chunk-UQ6JC3UY.js} +3 -3
- package/dist/cli/chunks/{chunk-K5YL3O22.js → chunk-VLZ3LC6L.js} +2 -2
- package/dist/cli/chunks/{chunk-MULV6D5J.js → chunk-VMMPOLUV.js} +2 -2
- package/dist/cli/chunks/{chunk-R3U7DSLA.js → chunk-WFVBK7N3.js} +2 -2
- package/dist/cli/chunks/{chunk-UYMA75Y4.js → chunk-WGWOCTQW.js} +1 -1
- package/dist/cli/chunks/{chunk-JPJURL4N.js → chunk-WSJN6HFR.js} +2 -2
- package/dist/cli/chunks/{chunk-KD2B54EH.js → chunk-WU3RGTLV.js} +1 -1
- package/dist/cli/chunks/{chunk-VSV6PV47.js → chunk-X27VMOIH.js} +1 -1
- package/dist/cli/chunks/{chunk-GY2G2YYH.js → chunk-X3GKTB6R.js} +1 -1
- package/dist/cli/chunks/{chunk-CAZQL4G2.js → chunk-XMCMLPXY.js} +2 -2
- package/dist/cli/chunks/{chunk-TLVEBQCX.js → chunk-XUZ73S3Y.js} +2 -2
- package/dist/cli/chunks/{chunk-VK7AXSAI.js → chunk-YBGQT3OS.js} +2 -2
- package/dist/cli/chunks/{chunk-BOHAND5J.js → chunk-YL56FMCJ.js} +1 -1
- package/dist/cli/chunks/{chunk-QSH4Y5E6.js → chunk-YLYKRAGZ.js} +2 -2
- package/dist/cli/chunks/{chunk-LYWA4OU6.js → chunk-YPJ2O3TE.js} +2 -2
- package/dist/cli/chunks/{chunk-HJETZJJO.js → chunk-YQRABKOC.js} +2 -2
- package/dist/cli/chunks/{chunk-LICFVB4C.js → chunk-YTB7DDLE.js} +1 -1
- package/dist/cli/chunks/{chunk-JYDWDNNZ.js → chunk-YYKZVBIG.js} +2 -2
- package/dist/cli/chunks/{chunk-TH2BBFJ6.js → chunk-Z6NUCGQA.js} +1 -1
- package/dist/cli/chunks/{chunk-ZSDK26IP.js → chunk-ZAGCKWOC.js} +1 -1
- package/dist/cli/chunks/{ci-WZ4E35B6.js → ci-GXSOJB6I.js} +2 -2
- package/dist/cli/chunks/{ci-output-WMYWSAHI.js → ci-output-GNUGZD2F.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-4E4ZZ47P.js → circuit-breaker-LAW2AAHF.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-Q37FECGF.js → claude-flow-setup-VF5NUUJZ.js} +2 -2
- package/dist/cli/chunks/client-OSUT6W6W.js +2 -0
- package/dist/cli/chunks/{cline-installer-O7GPSWES.js → cline-installer-H7RPYI3G.js} +2 -2
- package/dist/cli/chunks/{code-AEIXP2UD.js → code-COHRPYF6.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-5RXCWE5W.js → code-index-extractor-353PWY6B.js} +2 -2
- package/dist/cli/chunks/{codex-installer-HDPSP2IN.js → codex-installer-DIXHDH63.js} +2 -2
- package/dist/cli/chunks/{completions-LYTPZCND.js → completions-NGPREB6E.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-WBRRBUIA.js → complexity-analyzer-BO3QCTWT.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-6KICDS72.js → continuedev-installer-SG4HUNX6.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-2YI4SWDH.js → copilot-installer-RC6ZFHQG.js} +2 -2
- package/dist/cli/chunks/{cost-tracker-YEVYFYK5.js → cost-tracker-Q76KFISR.js} +2 -2
- package/dist/cli/chunks/{coverage-MO2TU62L.js → coverage-PT23ZOGU.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-X5EEGWMA.js +2 -0
- package/dist/cli/chunks/{cursor-installer-AO2JNN27.js → cursor-installer-ZDS65WC6.js} +2 -2
- package/dist/cli/chunks/{daemon-WCSJ3HS2.js → daemon-M32BWOES.js} +4 -4
- package/dist/cli/chunks/{daemon-6DWF4GAR.js → daemon-ZRDBUK4Q.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-NI6TAE7Y.js → dag-attention-scheduler-GUPZT7PR.js} +2 -2
- package/dist/cli/chunks/{detect-3MTKRZEI.js → detect-PZNLC2CO.js} +2 -2
- package/dist/cli/chunks/{dist-node-32YFXCS3.js → dist-node-QO5MMHVF.js} +2 -2
- package/dist/cli/chunks/{domain-handler-TFVVUKSC.js → domain-handler-OH2YSZCT.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-7HWX6PVA.js → domain-transfer-TVTK2YX5.js} +2 -2
- package/dist/cli/chunks/dream-CP4VOPNU.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-GGNDGEHX.js → embed-and-insert-pattern-2ARE7NCX.js} +2 -2
- package/dist/cli/chunks/{eval-T2KWZU2L.js → eval-64RXRKM4.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-JHQPDNVK.js → experience-capture-middleware-TH7JERGY.js} +3 -3
- package/dist/cli/chunks/{fast-paths-KJQ56NG6.js → fast-paths-IAWNSJFU.js} +2 -2
- package/dist/cli/chunks/{feature-flags-DJU7Z6UH.js → feature-flags-22FDDEFG.js} +2 -2
- package/dist/cli/chunks/{feature-flags-IPK5DUQM.js → feature-flags-TAKLIOWM.js} +2 -2
- package/dist/cli/chunks/{file-discovery-G5I7VV34.js → file-discovery-QWEHC5VO.js} +2 -2
- package/dist/cli/chunks/{fleet-BRKXQGTC.js → fleet-5PQX4H2Q.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-F44UEMIK.js → gnn-wrapper-RR5EYGCL.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-4EJQ3VWP.js → heartbeat-handler-QOVPD6JV.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-MX7EHYU5.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-B7FZYZGZ.js +2 -0
- package/dist/cli/chunks/hnsw-index-7OVB67MX.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-HVFM7LAR.js → hnsw-legacy-bridge-RRTRMCEL.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-QOENX3WX.js → hnswlib-node-XEOLAMMR.js} +2 -2
- package/dist/cli/chunks/{hooks-QFQSVB2C.js → hooks-DTEIDS42.js} +34 -34
- package/dist/cli/chunks/{hybrid-router-TZPIYG3I.js → hybrid-router-E36GZC7Q.js} +2 -2
- package/dist/cli/chunks/{hypergraph-engine-HXG5GI27.js → hypergraph-engine-7VTF3N6A.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-R4LFFQ3Z.js → hypergraph-handler-CTUGX3DL.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-TG34YBHU.js +2 -0
- package/dist/cli/chunks/{init-handler-NJKVTURQ.js → init-handler-HRSUGKSE.js} +6 -6
- package/dist/cli/chunks/init-wizard-MS3A2X5C.js +2 -0
- package/dist/cli/chunks/kernel-J4IW4DA6.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-T6CMAQ6P.js → kilocode-installer-UGB5UY5B.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-IOAHUSWU.js → kiro-installer-7SAM5O2F.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-4LCYX5AN.js +2 -0
- package/dist/cli/chunks/{learning-2AH5KAFV.js → learning-GBRPEBXN.js} +3 -3
- package/dist/cli/chunks/{llm-router-I3YBDMC7.js → llm-router-YP2RW2QC.js} +4 -4
- package/dist/cli/chunks/{load-MTLOPMP4.js → load-3TRJPJBJ.js} +2 -2
- package/dist/cli/chunks/load-test-TFBVT7V3.js +2 -0
- package/dist/cli/chunks/{mcp-EEINX3NP.js → mcp-U7ZYZTEU.js} +2 -2
- package/dist/cli/chunks/{memory-OBDYP5P7.js → memory-CLBPDAAE.js} +5 -5
- package/dist/cli/chunks/memory-backend-E7OCG27P.js +2 -0
- package/dist/cli/chunks/{memory-handlers-TTMZ2JK6.js → memory-handlers-JEOU6AOR.js} +2 -2
- package/dist/cli/chunks/{multi-model-executor-OCANACFF.js → multi-model-executor-MPPD63KI.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-4PNJOOKX.js → opencode-installer-DIMXI5PK.js} +2 -2
- package/dist/cli/chunks/{orchestrator-DGIKNLST.js → orchestrator-YKOSNTFS.js} +5 -5
- package/dist/cli/chunks/{pipeline-4DZ3FRRT.js → pipeline-SDCM3CNA.js} +2 -2
- package/dist/cli/chunks/{platform-A27VETGX.js → platform-7UH4BXN7.js} +2 -2
- package/dist/cli/chunks/{plugin-SAIG2MCN.js → plugin-KIVAXJ3P.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-XBCJETFT.js → prime-radiant-advanced-wasm-PONLGWM6.js} +2 -2
- package/dist/cli/chunks/protocol-executor-MYFH7ZP4.js +2 -0
- package/dist/cli/chunks/{protocol-handler-NDOZLFK7.js → protocol-handler-6RYLLDOG.js} +2 -2
- package/dist/cli/chunks/{prove-XVUI5VJL.js → prove-PDFFRQQW.js} +2 -2
- package/dist/cli/chunks/{provider-manager-W6CZHTWY.js → provider-manager-I6R4EQGK.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-G46PVD2U.js +2 -0
- package/dist/cli/chunks/{quality-MRCQ7SDM.js → quality-KQVKAGWL.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-ZQRKBBUH.js +2 -0
- package/dist/cli/chunks/{real-embeddings-3NBKHQSF.js → real-embeddings-VQXMPAH6.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-FPWTSZG7.js → roocode-installer-RYPQ25JO.js} +2 -2
- package/dist/cli/chunks/router-UBQULTOO.js +2 -0
- package/dist/cli/chunks/routing-feedback-3VBS3SYD.js +2 -0
- package/dist/cli/chunks/{routing-handler-SYAT3QTK.js → routing-handler-U4FEWPIN.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-Y3JV2RC4.js → ruvector-commands-YID52EZ6.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-4IS5JKSA.js → rvf-dual-writer-HABBORJW.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-FPEUOS55.js → rvf-migration-adapter-JE5NWU3J.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-FR4NHRNG.js → rvf-migration-coordinator-FBIFWTAD.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-NDKSHCMG.js +2 -0
- package/dist/cli/chunks/safe-db-ZPGX4NYW.js +2 -0
- package/dist/cli/chunks/schedule-JZUKDE6O.js +2 -0
- package/dist/cli/chunks/scheduler-7YIQOOW3.js +2 -0
- package/dist/cli/chunks/{security-EPJBWOM2.js → security-22ERFMD6.js} +3 -3
- package/dist/cli/chunks/shared-rvf-adapter-YU7XN6ND.js +2 -0
- package/dist/cli/chunks/{shared-rvf-dual-writer-MSUS3ROX.js → shared-rvf-dual-writer-G5VIQHSN.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-4STSI5SJ.js +2 -0
- package/dist/cli/chunks/{status-handler-7T6ZWWSG.js → status-handler-5B3FP2DN.js} +2 -2
- package/dist/cli/chunks/{structural-health-IT5COKMM.js → structural-health-6YSKVKQG.js} +2 -2
- package/dist/cli/chunks/{sync-MVC5LKWT.js → sync-2YCW23XX.js} +2 -2
- package/dist/cli/chunks/{sync-CYTAJ62F.js → sync-OFSJUYBU.js} +2 -2
- package/dist/cli/chunks/{task-handler-R5T6DQ62.js → task-handler-6OIPFSXX.js} +2 -2
- package/dist/cli/chunks/{task-handlers-BQDACRA4.js → task-handlers-6QY5Q5IH.js} +3 -3
- package/dist/cli/chunks/{test-JQ6DNHJU.js → test-VR6EP23Y.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-47CCXYB3.js → test-scheduling-OI7N5QBA.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-THINRRHA.js → token-bootstrap-HZES3TAA.js} +2 -2
- package/dist/cli/chunks/{token-usage-AQOWJPTG.js → token-usage-2NSXSNS7.js} +2 -2
- package/dist/cli/chunks/{transformers-KRVEZU55.js → transformers-4U4PX5YQ.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-UDOTWN4W.js → tree-sitter-wasm-parser-NQ3JYKHC.js} +2 -2
- package/dist/cli/chunks/{types-YZSDKHGD.js → types-YGTXBQ4T.js} +2 -2
- package/dist/cli/chunks/unified-memory-R72C7IBY.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-A4LOFKDQ.js +2 -0
- package/dist/cli/chunks/unified-persistence-MYD2R4LE.js +2 -0
- package/dist/cli/chunks/{upgrade-UX6VHS4H.js → upgrade-GS4EJOHW.js} +2 -2
- package/dist/cli/chunks/{validate-SUS7IEZG.js → validate-4X7OETYQ.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-E2YE6GY2.js → validate-swarm-RSVPLHZQ.js} +2 -2
- package/dist/cli/chunks/{vibium-UZMTKRTE.js → vibium-SN2J4QEA.js} +2 -2
- package/dist/cli/chunks/visual-security-CUKQ5N37.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-XXU37FYS.js → web-tree-sitter-ZO6DPXRC.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-WRTVYD3Y.js → windsurf-installer-RGSOOJSH.js} +2 -2
- package/dist/cli/chunks/{witness-chain-6OSAEH67.js → witness-chain-7XBKRDAW.js} +2 -2
- package/dist/cli/chunks/witness-chain-S7ADS6TA.js +2 -0
- package/dist/cli/chunks/{workflow-7XKEQVKT.js → workflow-H7KG5R6L.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-3GIDXU43.js +2 -0
- package/dist/cli/chunks/{wrappers-2HDILUDI.js → wrappers-3YCDNHDG.js} +2 -2
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +12 -21
- package/dist/integrations/ruvector/rvf-dual-writer.d.ts +22 -0
- package/dist/integrations/ruvector/rvf-dual-writer.js +21 -0
- package/dist/integrations/ruvector/rvf-native-adapter.d.ts +18 -1
- package/dist/integrations/ruvector/rvf-native-adapter.js +15 -1
- package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +46 -1
- package/dist/integrations/ruvector/shared-rvf-adapter.js +137 -0
- package/dist/kernel/hybrid-backend.d.ts +14 -3
- package/dist/kernel/hybrid-backend.js +16 -3
- package/dist/kernel/unified-memory.d.ts +3 -1
- package/dist/kernel/unified-memory.js +28 -3
- package/dist/learning/dream/dream-scheduler.d.ts +18 -0
- package/dist/learning/dream/dream-scheduler.js +68 -0
- package/dist/learning/qe-reasoning-bank.js +19 -2
- package/dist/learning/sqlite-persistence.d.ts +11 -0
- package/dist/learning/sqlite-persistence.js +30 -0
- package/dist/mcp/bundle.js +352 -346
- package/package.json +6 -2
- package/dist/cli/chunks/adapter-PSHWPJGO.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-2WOSQ42V.js +0 -2
- package/dist/cli/chunks/base-QZ6CGEZG.js +0 -2
- package/dist/cli/chunks/browser-workflow-T74U33BJ.js +0 -2
- package/dist/cli/chunks/chunk-AE7P7VDM.js +0 -9
- package/dist/cli/chunks/chunk-LVCQ4LSA.js +0 -2
- package/dist/cli/chunks/chunk-MCONVCB6.js +0 -15
- package/dist/cli/chunks/chunk-ND33EKHX.js +0 -2
- package/dist/cli/chunks/chunk-SHAXRSWJ.js +0 -2
- package/dist/cli/chunks/client-3YW2WA67.js +0 -2
- package/dist/cli/chunks/cross-domain-router-2MAV2XPY.js +0 -2
- package/dist/cli/chunks/dream-4N3YBX36.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-5KZS7T6Q.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-A4XK3GZU.js +0 -2
- package/dist/cli/chunks/hnsw-index-TI7LZBWF.js +0 -2
- package/dist/cli/chunks/impact-analyzer-NQZBRTZH.js +0 -2
- package/dist/cli/chunks/init-wizard-UZR2AKQA.js +0 -2
- package/dist/cli/chunks/kernel-2HFKLNTS.js +0 -2
- package/dist/cli/chunks/knowledge-graph-GHICW2ZM.js +0 -2
- package/dist/cli/chunks/load-test-DUOZJLRA.js +0 -2
- package/dist/cli/chunks/memory-backend-AMPSDQR7.js +0 -2
- package/dist/cli/chunks/protocol-executor-4HZSMKVG.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-OGPCKVDP.js +0 -2
- package/dist/cli/chunks/queen-coordinator-ETWOFJGR.js +0 -2
- package/dist/cli/chunks/router-OMWLL5V3.js +0 -2
- package/dist/cli/chunks/routing-feedback-SULO56IE.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-PFMHXYDR.js +0 -2
- package/dist/cli/chunks/safe-db-V34EBOPG.js +0 -2
- package/dist/cli/chunks/schedule-WJALMS5B.js +0 -2
- package/dist/cli/chunks/scheduler-CBWMQLTY.js +0 -2
- package/dist/cli/chunks/shared-rvf-adapter-KOZOSWBO.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-7RV55RNF.js +0 -2
- package/dist/cli/chunks/unified-memory-FHP2C2NF.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-MI27GSUL.js +0 -2
- package/dist/cli/chunks/unified-persistence-67RJXTNL.js +0 -2
- package/dist/cli/chunks/visual-security-JF6AGYOT.js +0 -2
- package/dist/cli/chunks/witness-chain-HNY2ED2G.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-OPUU4TNV.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.
|
|
2
|
-
import{b as N,d as le}from"./chunk-AL54ARD4.js";import{a as ye}from"./chunk-LVCQ4LSA.js";import{c as oe,d as ce,e as fe}from"./chunk-PIINM2PD.js";import{b as w,c as L}from"./chunk-H5AQHFIA.js";import{a as j,b as D,c as V}from"./chunk-Q5JL7NZG.js";ye();import{createRequire as be}from"module";var O;function W(){if(!O){let h=be(import.meta.url);try{O=h("typescript")}catch{try{O=h("typescript/lib/typescript.js")}catch{O=new Proxy({},{get(e,t){if(!(t==="__esModule"||typeof t=="symbol"))throw new Error("TypeScript is required for code analysis. Install it: npm install -g typescript")}})}}}return O}var p=new Proxy({},{get(h,e){return W()[e]},has(h,e){return e in W()},ownKeys(){return Object.keys(W())},getOwnPropertyDescriptor(h,e){let t=W()[e];if(t!==void 0)return{configurable:!0,enumerable:!0,value:t}}});var F=class{parseFile(e,t){return p.createSourceFile(e,t,p.ScriptTarget.Latest,!0,this.getScriptKind(e))}extractFunctions(e){let t=[],s=n=>{p.isFunctionDeclaration(n)&&n.name?t.push(this.extractFunctionDeclaration(n,e)):p.isVariableStatement(n)&&this.extractArrowFunctions(n,e,t),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractClasses(e){let t=[],s=n=>{p.isClassDeclaration(n)&&n.name&&t.push(this.extractClassDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractImports(e){let t=[],s=n=>{p.isImportDeclaration(n)&&t.push(this.extractImportDeclaration(n)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractExports(e){let t=[],s=n=>{if(p.isExportDeclaration(n))this.extractExportDeclaration(n,t);else if(p.isExportAssignment(n))t.push({name:this.getExportAssignmentName(n),type:"unknown",isDefault:!0,isReexport:!1,sourceModule:void 0});else if(p.isFunctionDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"function",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isClassDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"class",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isVariableStatement(n)&&this.hasExportModifier(n))for(let r of n.declarationList.declarations)p.isIdentifier(r.name)&&t.push({name:r.name.text,type:"variable",isDefault:!1,isReexport:!1,sourceModule:void 0});else p.isInterfaceDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"interface",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isTypeAliasDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"type",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isEnumDeclaration(n)&&this.hasExportModifier(n)&&t.push({name:n.name.text,type:"enum",isDefault:!1,isReexport:!1,sourceModule:void 0});p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractInterfaces(e){let t=[],s=n=>{p.isInterfaceDeclaration(n)&&t.push(this.extractInterfaceDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractEntities(e,t){let s=this.parseFile(t,e),n=[],r=this.extractFunctions(s);for(let a of r)n.push({name:a.name,type:"function",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:a.isAsync,isExported:a.isExported,parameters:a.parameters,returnType:a.returnType});let o=this.extractClasses(s);for(let a of o)n.push({name:a.name,type:"class",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported,extends:a.extends,implements:a.implements});let i=this.extractInterfaces(s);for(let a of i)n.push({name:a.name,type:"interface",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported});return n}getScriptKind(e){return e.endsWith(".tsx")?p.ScriptKind.TSX:e.endsWith(".ts")?p.ScriptKind.TS:e.endsWith(".jsx")?p.ScriptKind.JSX:e.endsWith(".js")?p.ScriptKind.JS:p.ScriptKind.TS}extractFunctionDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:e.name?.text??"anonymous",parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,startLine:s+1,endLine:n+1,isAsync:this.hasAsyncModifier(e),isExported:this.hasExportModifier(e),isGenerator:!!e.asteriskToken,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractArrowFunctions(e,t,s){for(let n of e.declarationList.declarations)if(p.isIdentifier(n.name)&&n.initializer&&p.isArrowFunction(n.initializer)){let r=n.initializer,{line:o}=t.getLineAndCharacterOfPosition(e.getStart()),{line:i}=t.getLineAndCharacterOfPosition(e.getEnd());s.push({name:n.name.text,parameters:this.extractParameters(r.parameters),returnType:r.type?r.type.getText(t):void 0,startLine:o+1,endLine:i+1,isAsync:this.hasAsyncModifier(r),isExported:this.hasExportModifier(e),isGenerator:!1,typeParameters:this.extractTypeParameters(r.typeParameters)})}}extractClassDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let c of e.members)p.isMethodDeclaration(c)&&c.name?r.push(this.extractMethodDeclaration(c,t)):p.isPropertyDeclaration(c)&&c.name?o.push(this.extractPropertyDeclaration(c,t)):p.isConstructorDeclaration(c)&&(r.push(this.extractConstructor(c,t)),this.extractParameterProperties(c,o,t));let i,a=[];if(e.heritageClauses){for(let c of e.heritageClauses)if(c.token===p.SyntaxKind.ExtendsKeyword)i=c.types[0]?.expression.getText(t);else if(c.token===p.SyntaxKind.ImplementsKeyword)for(let l of c.types)a.push(l.expression.getText(t))}return{name:e.name?.text??"anonymous",methods:r,properties:o,extends:i,implements:a,isAbstract:this.hasAbstractModifier(e),isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractMethodDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:this.getPropertyName(e.name,t),parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,isAsync:this.hasAsyncModifier(e),isStatic:this.hasStaticModifier(e),isAbstract:this.hasAbstractModifier(e),visibility:this.getVisibility(e),startLine:s+1,endLine:n+1}}extractConstructor(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:"constructor",parameters:this.extractParameters(e.parameters),returnType:void 0,isAsync:!1,isStatic:!1,isAbstract:!1,visibility:"public",startLine:s+1,endLine:n+1}}extractParameterProperties(e,t,s){for(let n of e.parameters)this.isParameterProperty(n)&&t.push({name:p.isIdentifier(n.name)?n.name.text:n.name.getText(s),type:n.type?n.type.getText(s):void 0,isStatic:!1,isReadonly:this.hasReadonlyModifier(n),visibility:this.getVisibility(n),hasInitializer:!!n.initializer})}isParameterProperty(e){return!!e.modifiers?.some(t=>t.kind===p.SyntaxKind.PublicKeyword||t.kind===p.SyntaxKind.PrivateKeyword||t.kind===p.SyntaxKind.ProtectedKeyword||t.kind===p.SyntaxKind.ReadonlyKeyword)}extractPropertyDeclaration(e,t){return{name:this.getPropertyName(e.name,t),type:e.type?e.type.getText(t):void 0,isStatic:this.hasStaticModifier(e),isReadonly:this.hasReadonlyModifier(e),visibility:this.getVisibility(e),hasInitializer:!!e.initializer}}extractImportDeclaration(e){let t=e.moduleSpecifier.text,s=[],n,r,o=e.importClause?.isTypeOnly??!1;if(e.importClause&&(e.importClause.name&&(n=e.importClause.name.text),e.importClause.namedBindings)){if(p.isNamespaceImport(e.importClause.namedBindings))r=e.importClause.namedBindings.name.text;else if(p.isNamedImports(e.importClause.namedBindings))for(let i of e.importClause.namedBindings.elements)s.push({name:i.propertyName?.text??i.name.text,alias:i.propertyName?i.name.text:void 0})}return{module:t,namedImports:s,defaultImport:n,namespaceImport:r,isTypeOnly:o}}extractExportDeclaration(e,t){let s=e.moduleSpecifier?e.moduleSpecifier.text:void 0;if(e.exportClause&&p.isNamedExports(e.exportClause))for(let n of e.exportClause.elements)t.push({name:n.name.text,type:"unknown",isDefault:!1,isReexport:!!s,sourceModule:s});else!e.exportClause&&s&&t.push({name:"*",type:"unknown",isDefault:!1,isReexport:!0,sourceModule:s})}extractInterfaceDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let a of e.members)p.isPropertySignature(a)&&a.name?r.push({name:this.getPropertyName(a.name,t),type:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken,isReadonly:this.hasReadonlyModifier(a)}):p.isMethodSignature(a)&&a.name&&o.push({name:this.getPropertyName(a.name,t),parameters:this.extractParameters(a.parameters),returnType:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken});let i=[];if(e.heritageClauses){for(let a of e.heritageClauses)if(a.token===p.SyntaxKind.ExtendsKeyword)for(let c of a.types)i.push(c.expression.getText(t))}return{name:e.name.text,properties:r,methods:o,extends:i,isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractParameters(e){return e.map(t=>{let s=t.getSourceFile();return{name:p.isIdentifier(t.name)?t.name.text:t.name.getText(s),type:t.type?t.type.getText(s):void 0,isOptional:!!t.questionToken||!!t.initializer,isRest:!!t.dotDotDotToken,defaultValue:t.initializer?t.initializer.getText(s):void 0}})}extractTypeParameters(e){return e?e.map(t=>t.name.text):[]}getPropertyName(e,t){return p.isIdentifier(e)||p.isStringLiteral(e)||p.isNumericLiteral(e)?e.text:e.getText(t)}getExportAssignmentName(e){return p.isIdentifier(e.expression)?e.expression.text:"default"}hasExportModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ExportKeyword)}hasDefaultModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.DefaultKeyword)}hasAsyncModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AsyncKeyword)}hasStaticModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.StaticKeyword)}hasAbstractModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AbstractKeyword)}hasReadonlyModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ReadonlyKeyword)}getVisibility(e){if(!p.canHaveModifiers(e))return"public";let t=p.getModifiers(e);return t?t.some(s=>s.kind===p.SyntaxKind.PrivateKeyword)?"private":t.some(s=>s.kind===p.SyntaxKind.ProtectedKeyword)?"protected":"public":"public"}},Me=new F,q=class{language="typescript";supportedExtensions=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];parser=new F;async parseFile(e,t){let s=this.parser.parseFile(t,e),n=this.parser.extractFunctions(s),r=this.parser.extractClasses(s),o=this.parser.extractImports(s);return{functions:n.map(i=>this.mapFunction(i)),classes:r.map(i=>this.mapClass(i)),imports:o.map(i=>this.mapImport(i)),language:t.endsWith(".js")||t.endsWith(".jsx")||t.endsWith(".mjs")||t.endsWith(".cjs")?"javascript":"typescript",filePath:t}}mapFunction(e){return{name:e.name,parameters:e.parameters.map(t=>({name:t.name,type:t.type,isOptional:t.isOptional,defaultValue:t.defaultValue})),returnType:e.returnType,isAsync:e.isAsync,isPublic:e.isExported,complexity:1,decorators:[],genericParams:e.typeParameters,startLine:e.startLine,endLine:e.endLine}}mapClass(e){return{name:e.name,methods:e.methods.map(t=>({name:t.name,parameters:t.parameters.map(s=>({name:s.name,type:s.type,isOptional:s.isOptional,defaultValue:s.defaultValue})),returnType:t.returnType,isAsync:t.isAsync,isPublic:t.visibility==="public",complexity:1,decorators:[],genericParams:[],startLine:t.startLine,endLine:t.endLine})),properties:e.properties.map(t=>this.mapProperty(t)),isPublic:e.isExported,implements:e.implements,extends:e.extends,decorators:[],startLine:e.startLine,endLine:e.endLine}}mapProperty(e){return{name:e.name,type:e.type,isPublic:e.visibility==="public",isReadonly:e.isReadonly}}mapImport(e){return{module:e.module,namedImports:e.namedImports.map(t=>t.alias||t.name),isTypeOnly:e.isTypeOnly}}},Se=new q;fe();var E=1e3;function I(h){let e=h.split(`
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.35");process.exit(0)}
|
|
2
|
+
import{b as N,d as le}from"./chunk-RZDMSTAQ.js";import{a as ye}from"./chunk-PHJK33IV.js";import{c as oe,d as ce,e as fe}from"./chunk-BTPDHALG.js";import{b as w,c as L}from"./chunk-6WZNRHJJ.js";import{a as j,b as D,c as V}from"./chunk-DEJW6GYF.js";ye();import{createRequire as be}from"module";var O;function W(){if(!O){let h=be(import.meta.url);try{O=h("typescript")}catch{try{O=h("typescript/lib/typescript.js")}catch{O=new Proxy({},{get(e,t){if(!(t==="__esModule"||typeof t=="symbol"))throw new Error("TypeScript is required for code analysis. Install it: npm install -g typescript")}})}}}return O}var p=new Proxy({},{get(h,e){return W()[e]},has(h,e){return e in W()},ownKeys(){return Object.keys(W())},getOwnPropertyDescriptor(h,e){let t=W()[e];if(t!==void 0)return{configurable:!0,enumerable:!0,value:t}}});var F=class{parseFile(e,t){return p.createSourceFile(e,t,p.ScriptTarget.Latest,!0,this.getScriptKind(e))}extractFunctions(e){let t=[],s=n=>{p.isFunctionDeclaration(n)&&n.name?t.push(this.extractFunctionDeclaration(n,e)):p.isVariableStatement(n)&&this.extractArrowFunctions(n,e,t),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractClasses(e){let t=[],s=n=>{p.isClassDeclaration(n)&&n.name&&t.push(this.extractClassDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractImports(e){let t=[],s=n=>{p.isImportDeclaration(n)&&t.push(this.extractImportDeclaration(n)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractExports(e){let t=[],s=n=>{if(p.isExportDeclaration(n))this.extractExportDeclaration(n,t);else if(p.isExportAssignment(n))t.push({name:this.getExportAssignmentName(n),type:"unknown",isDefault:!0,isReexport:!1,sourceModule:void 0});else if(p.isFunctionDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"function",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isClassDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"class",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isVariableStatement(n)&&this.hasExportModifier(n))for(let r of n.declarationList.declarations)p.isIdentifier(r.name)&&t.push({name:r.name.text,type:"variable",isDefault:!1,isReexport:!1,sourceModule:void 0});else p.isInterfaceDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"interface",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isTypeAliasDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"type",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isEnumDeclaration(n)&&this.hasExportModifier(n)&&t.push({name:n.name.text,type:"enum",isDefault:!1,isReexport:!1,sourceModule:void 0});p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractInterfaces(e){let t=[],s=n=>{p.isInterfaceDeclaration(n)&&t.push(this.extractInterfaceDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractEntities(e,t){let s=this.parseFile(t,e),n=[],r=this.extractFunctions(s);for(let a of r)n.push({name:a.name,type:"function",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:a.isAsync,isExported:a.isExported,parameters:a.parameters,returnType:a.returnType});let o=this.extractClasses(s);for(let a of o)n.push({name:a.name,type:"class",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported,extends:a.extends,implements:a.implements});let i=this.extractInterfaces(s);for(let a of i)n.push({name:a.name,type:"interface",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported});return n}getScriptKind(e){return e.endsWith(".tsx")?p.ScriptKind.TSX:e.endsWith(".ts")?p.ScriptKind.TS:e.endsWith(".jsx")?p.ScriptKind.JSX:e.endsWith(".js")?p.ScriptKind.JS:p.ScriptKind.TS}extractFunctionDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:e.name?.text??"anonymous",parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,startLine:s+1,endLine:n+1,isAsync:this.hasAsyncModifier(e),isExported:this.hasExportModifier(e),isGenerator:!!e.asteriskToken,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractArrowFunctions(e,t,s){for(let n of e.declarationList.declarations)if(p.isIdentifier(n.name)&&n.initializer&&p.isArrowFunction(n.initializer)){let r=n.initializer,{line:o}=t.getLineAndCharacterOfPosition(e.getStart()),{line:i}=t.getLineAndCharacterOfPosition(e.getEnd());s.push({name:n.name.text,parameters:this.extractParameters(r.parameters),returnType:r.type?r.type.getText(t):void 0,startLine:o+1,endLine:i+1,isAsync:this.hasAsyncModifier(r),isExported:this.hasExportModifier(e),isGenerator:!1,typeParameters:this.extractTypeParameters(r.typeParameters)})}}extractClassDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let c of e.members)p.isMethodDeclaration(c)&&c.name?r.push(this.extractMethodDeclaration(c,t)):p.isPropertyDeclaration(c)&&c.name?o.push(this.extractPropertyDeclaration(c,t)):p.isConstructorDeclaration(c)&&(r.push(this.extractConstructor(c,t)),this.extractParameterProperties(c,o,t));let i,a=[];if(e.heritageClauses){for(let c of e.heritageClauses)if(c.token===p.SyntaxKind.ExtendsKeyword)i=c.types[0]?.expression.getText(t);else if(c.token===p.SyntaxKind.ImplementsKeyword)for(let l of c.types)a.push(l.expression.getText(t))}return{name:e.name?.text??"anonymous",methods:r,properties:o,extends:i,implements:a,isAbstract:this.hasAbstractModifier(e),isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractMethodDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:this.getPropertyName(e.name,t),parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,isAsync:this.hasAsyncModifier(e),isStatic:this.hasStaticModifier(e),isAbstract:this.hasAbstractModifier(e),visibility:this.getVisibility(e),startLine:s+1,endLine:n+1}}extractConstructor(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:"constructor",parameters:this.extractParameters(e.parameters),returnType:void 0,isAsync:!1,isStatic:!1,isAbstract:!1,visibility:"public",startLine:s+1,endLine:n+1}}extractParameterProperties(e,t,s){for(let n of e.parameters)this.isParameterProperty(n)&&t.push({name:p.isIdentifier(n.name)?n.name.text:n.name.getText(s),type:n.type?n.type.getText(s):void 0,isStatic:!1,isReadonly:this.hasReadonlyModifier(n),visibility:this.getVisibility(n),hasInitializer:!!n.initializer})}isParameterProperty(e){return!!e.modifiers?.some(t=>t.kind===p.SyntaxKind.PublicKeyword||t.kind===p.SyntaxKind.PrivateKeyword||t.kind===p.SyntaxKind.ProtectedKeyword||t.kind===p.SyntaxKind.ReadonlyKeyword)}extractPropertyDeclaration(e,t){return{name:this.getPropertyName(e.name,t),type:e.type?e.type.getText(t):void 0,isStatic:this.hasStaticModifier(e),isReadonly:this.hasReadonlyModifier(e),visibility:this.getVisibility(e),hasInitializer:!!e.initializer}}extractImportDeclaration(e){let t=e.moduleSpecifier.text,s=[],n,r,o=e.importClause?.isTypeOnly??!1;if(e.importClause&&(e.importClause.name&&(n=e.importClause.name.text),e.importClause.namedBindings)){if(p.isNamespaceImport(e.importClause.namedBindings))r=e.importClause.namedBindings.name.text;else if(p.isNamedImports(e.importClause.namedBindings))for(let i of e.importClause.namedBindings.elements)s.push({name:i.propertyName?.text??i.name.text,alias:i.propertyName?i.name.text:void 0})}return{module:t,namedImports:s,defaultImport:n,namespaceImport:r,isTypeOnly:o}}extractExportDeclaration(e,t){let s=e.moduleSpecifier?e.moduleSpecifier.text:void 0;if(e.exportClause&&p.isNamedExports(e.exportClause))for(let n of e.exportClause.elements)t.push({name:n.name.text,type:"unknown",isDefault:!1,isReexport:!!s,sourceModule:s});else!e.exportClause&&s&&t.push({name:"*",type:"unknown",isDefault:!1,isReexport:!0,sourceModule:s})}extractInterfaceDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let a of e.members)p.isPropertySignature(a)&&a.name?r.push({name:this.getPropertyName(a.name,t),type:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken,isReadonly:this.hasReadonlyModifier(a)}):p.isMethodSignature(a)&&a.name&&o.push({name:this.getPropertyName(a.name,t),parameters:this.extractParameters(a.parameters),returnType:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken});let i=[];if(e.heritageClauses){for(let a of e.heritageClauses)if(a.token===p.SyntaxKind.ExtendsKeyword)for(let c of a.types)i.push(c.expression.getText(t))}return{name:e.name.text,properties:r,methods:o,extends:i,isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractParameters(e){return e.map(t=>{let s=t.getSourceFile();return{name:p.isIdentifier(t.name)?t.name.text:t.name.getText(s),type:t.type?t.type.getText(s):void 0,isOptional:!!t.questionToken||!!t.initializer,isRest:!!t.dotDotDotToken,defaultValue:t.initializer?t.initializer.getText(s):void 0}})}extractTypeParameters(e){return e?e.map(t=>t.name.text):[]}getPropertyName(e,t){return p.isIdentifier(e)||p.isStringLiteral(e)||p.isNumericLiteral(e)?e.text:e.getText(t)}getExportAssignmentName(e){return p.isIdentifier(e.expression)?e.expression.text:"default"}hasExportModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ExportKeyword)}hasDefaultModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.DefaultKeyword)}hasAsyncModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AsyncKeyword)}hasStaticModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.StaticKeyword)}hasAbstractModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AbstractKeyword)}hasReadonlyModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ReadonlyKeyword)}getVisibility(e){if(!p.canHaveModifiers(e))return"public";let t=p.getModifiers(e);return t?t.some(s=>s.kind===p.SyntaxKind.PrivateKeyword)?"private":t.some(s=>s.kind===p.SyntaxKind.ProtectedKeyword)?"protected":"public":"public"}},Me=new F,q=class{language="typescript";supportedExtensions=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];parser=new F;async parseFile(e,t){let s=this.parser.parseFile(t,e),n=this.parser.extractFunctions(s),r=this.parser.extractClasses(s),o=this.parser.extractImports(s);return{functions:n.map(i=>this.mapFunction(i)),classes:r.map(i=>this.mapClass(i)),imports:o.map(i=>this.mapImport(i)),language:t.endsWith(".js")||t.endsWith(".jsx")||t.endsWith(".mjs")||t.endsWith(".cjs")?"javascript":"typescript",filePath:t}}mapFunction(e){return{name:e.name,parameters:e.parameters.map(t=>({name:t.name,type:t.type,isOptional:t.isOptional,defaultValue:t.defaultValue})),returnType:e.returnType,isAsync:e.isAsync,isPublic:e.isExported,complexity:1,decorators:[],genericParams:e.typeParameters,startLine:e.startLine,endLine:e.endLine}}mapClass(e){return{name:e.name,methods:e.methods.map(t=>({name:t.name,parameters:t.parameters.map(s=>({name:s.name,type:s.type,isOptional:s.isOptional,defaultValue:s.defaultValue})),returnType:t.returnType,isAsync:t.isAsync,isPublic:t.visibility==="public",complexity:1,decorators:[],genericParams:[],startLine:t.startLine,endLine:t.endLine})),properties:e.properties.map(t=>this.mapProperty(t)),isPublic:e.isExported,implements:e.implements,extends:e.extends,decorators:[],startLine:e.startLine,endLine:e.endLine}}mapProperty(e){return{name:e.name,type:e.type,isPublic:e.visibility==="public",isReadonly:e.isReadonly}}mapImport(e){return{module:e.module,namedImports:e.namedImports.map(t=>t.alias||t.name),isTypeOnly:e.isTypeOnly}}},Se=new q;fe();var E=1e3;function I(h){let e=h.split(`
|
|
3
3
|
`),t=[],s=[],n="",r=0,o=0,i=0,a=0;for(let c=0;c<e.length;c++){let l=e[c],d=l.trim();if(d===""||d.startsWith("//")||d.startsWith("#")||d.startsWith("*")){if(n){n+=" "+d;continue}t.push(l),s.push(c+1);continue}n||(r=c+1),n=n?n+" "+d:l;for(let u of d)u==="("?o++:u===")"?o=Math.max(0,o-1):u==="<"?i++:u===">"?i=Math.max(0,i-1):u==="["?a++:u==="]"&&(a=Math.max(0,a-1));o===0&&i===0&&a===0&&(t.push(n),s.push(r),n="")}return n&&(t.push(n),s.push(r)),{logicalLines:t,lineMap:s}}function G(h,e,t="<",s=">"){if(h[e]!==t)return;let n=1,r=e+1;for(;r<h.length&&n>0;)h[r]===t?n++:h[r]===s&&n--,r++;if(n===0)return h.substring(e+1,r-1)}function R(h,e,t){let s=[];for(let n=e-1;n>=0;n--){let r=h[n].trim();if(r.startsWith(t))s.unshift(r);else{if(r===""||r.startsWith("//")||r.startsWith("*")||r.startsWith("#"))continue;break}}return s}function S(h){let e=[],t=0,s="";for(let n of h)n==="<"||n==="("?t++:(n===">"||n===")")&&t--,n===","&&t===0?(e.push(s.trim()),s=""):s+=n;return s.trim()&&e.push(s.trim()),e}function re(h){let e=0,t=!1,s="";for(let n=0;n<h.length;n++){let r=h[n];if(t){r===s&&h[n-1]!=="\\"&&(t=!1);continue}r==='"'||r==="'"||r==="`"?(t=!0,s=r):r==="{"?e++:r==="}"&&e--}return e}var H=class{language="python";supportedExtensions=[".py"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"python",filePath:t}}extractFunctions(e){let t=[],s=e.split(`
|
|
4
4
|
`),{logicalLines:n,lineMap:r}=I(e),o=/^(\s*)(async\s+)?def\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*([^:]*\S))?\s*:/;for(let i=0;i<n.length;i++){if(n[i].length>E)continue;let a=n[i].match(o);if(a){let c=a[1].length,l=!!a[2],d=a[3],u=a[4],m=a[5]?.trim(),g=r[i]-1,f=g+1;for(let y=g+1;y<s.length;y++){let b=s[y];if(b.trim()===""||b.trim().startsWith("#"))continue;if((b.match(/^(\s*)/)?.[1].length??0)<=c&&b.trim()!==""){f=y;break}f=y+1}let x=R(s,g,"@");t.push({name:d,parameters:this.parseParams(u),returnType:m,isAsync:l,isPublic:!d.startsWith("_"),complexity:1,decorators:x,genericParams:[],startLine:r[i],endLine:f})}}return t}extractClasses(e){let t=[],s=e.split(`
|
|
5
5
|
`),{logicalLines:n,lineMap:r}=I(e),o=/^(\s*)class\s+(\w+)(?:\(([^)]*)\))?\s*:/;for(let i=0;i<n.length;i++){let a=n[i].match(o);if(a){let c=a[1].length,l=a[2],d=a[3]?a[3].split(",").map(y=>y.trim()):[],u=r[i]-1,m=u+1;for(let y=u+1;y<s.length;y++){let b=s[y];if(b.trim()===""||b.trim().startsWith("#"))continue;if((b.match(/^(\s*)/)?.[1].length??0)<=c&&b.trim()!==""){m=y;break}m=y+1}let g=s.slice(u+1,m).join(`
|
|
@@ -20,7 +20,7 @@ import{b as N,d as le}from"./chunk-AL54ARD4.js";import{a as ye}from"./chunk-LVCQ
|
|
|
20
20
|
`),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected|internal)?\s*(suspend)?\s*fun\s+(?:<[^{]*> +)?(\w+)\s*\(([^)]*)\)(?:\s*:\s*([^{=\s]+(?:\s+[^{=\s]+)*))?\s*/,i=0;for(let a=0;a<n.length;a++){let c=n[a];if(c.length>E){i+=(c.match(/\{/g)?.length??0)-(c.match(/\}/g)?.length??0);continue}let l=c.match(o);if(l&&i<=1){let d=l[1]||"public",u=!!l[2],m=l[3],g=l[4],f=l[5]?.trim();if(f&&f.includes("<")){let b=f.indexOf("<"),P=G(f,b);P!==void 0&&(f=f.substring(0,b)+"<"+P+">")}let x=r[a]-1,y=R(s,x,"@");t.push({name:m,parameters:this.parseParams(g),returnType:f,isAsync:u,isPublic:d==="public",complexity:1,decorators:y,genericParams:[],startLine:r[a],endLine:r[a]})}i+=re(c),i<0&&(i=0)}return t}extractClasses(e){let t=[],s=e.split(`
|
|
21
21
|
`),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected|internal)?\s*(data|sealed|abstract|open)?\s*class\s+(\w+)(?:<[^{]*>)?(?:\s*(?:\([^)]*\))?\s*:\s*([^{\s]+(?:\s+[^{\s]+)*))?\s*\{?/;for(let i=0;i<n.length;i++){if(n[i].length>E)continue;let a=n[i].match(o);if(a){let c=a[3],l=a[4]?a[4].split(",").map(m=>m.trim().split("(")[0].trim()):[],d=r[i]-1,u=R(s,d,"@");t.push({name:c,methods:[],properties:[],isPublic:(a[1]||"public")==="public",implements:l.slice(1),extends:l[0]||void 0,decorators:u,startLine:r[i],endLine:r[i]})}}return t}extractImports(e){let t=[],s=e.split(`
|
|
22
22
|
`);for(let n of s){let r=n.match(/^\s*import\s+([^\s]+)/);r&&t.push({module:r[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){return e.trim()?S(e).map(t=>{let s=t.indexOf(":");if(s===-1)return{name:t.replace("val ","").replace("var ","").trim(),type:void 0,isOptional:!1,defaultValue:void 0};let n=t.substring(0,s).replace("val ","").replace("var ","").trim(),r=t.substring(s+1).trim(),o=r.indexOf("="),i=o>=0?r.substring(0,o).trim():r,a=o>=0;return{name:n,type:i,isOptional:a||i?.endsWith("?")||!1,defaultValue:void 0}}):[]}},te=class{language="dart";supportedExtensions=[".dart"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"dart",filePath:t}}extractFunctions(e){let t=[],{logicalLines:s,lineMap:n}=I(e),r=/^\s*([\w<>,.?]+(?:\s+[\w<>,.?]+)*)\s+(\w+)\s*\(([^)]*)\)(?:\s*(async))?\s*\{/;for(let o=0;o<s.length;o++){let i=s[o];if(i.includes(" class ")||i.length>E)continue;let a=i.match(r);if(a){let c=a[1].trim(),l=c;if(c&&c.includes("<")){let g=c.indexOf("<"),f=G(c,g);f!==void 0&&(l=c.substring(0,g)+"<"+f+">")}let d=a[2],u=a[3],m=!!a[4]||l.includes("Future");t.push({name:d,parameters:this.parseParams(u),returnType:l==="void"?void 0:l,isAsync:m,isPublic:!d.startsWith("_"),complexity:1,decorators:[],genericParams:[],startLine:n[o],endLine:n[o]})}}return t}extractClasses(e){let t=[],{logicalLines:s,lineMap:n}=I(e),r=/^\s*(abstract +)?class\s+(\w+)(?:<[^{]*>)?(?:\s+extends\s+(\w+))?(?:\s+(?:with|implements)\s+([^{\s]+(?:\s+[^{\s]+)*))?\s*\{/;for(let o=0;o<s.length;o++){if(s[o].length>E)continue;let i=s[o].match(r);if(i){let a=i[2],c=i[3],l=i[4]?i[4].split(",").map(d=>d.trim()):[];t.push({name:a,methods:[],properties:[],isPublic:!a.startsWith("_"),implements:l,extends:c,decorators:[],startLine:n[o],endLine:n[o]})}}return t}extractImports(e){let t=[],s=e.split(`
|
|
23
|
-
`);for(let n of s){let r=n.match(/^\s*import\s+'([^']+)'/);r&&t.push({module:r[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){if(!e.trim())return[];let t=e.replace(/[{}[\]]/g,"");return S(t).map(s=>s.trim()).filter(s=>s).map(s=>{let n=s.replace("required ","").trim().split(/\s+/),r=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:r,type:o,isOptional:s.includes("?")||s.includes("{"),defaultValue:void 0}})}},$=ce("ParserRegistry"),de=["python","java","csharp","rust","swift"],se=class h{language;supportedExtensions;wasmParser;regexParser;wasmFailCount=0;static MAX_WASM_RETRIES=3;constructor(e,t){this.wasmParser=e,this.regexParser=t,this.language=e.language,this.supportedExtensions=e.supportedExtensions}async parseFile(e,t){if(this.wasmFailCount<h.MAX_WASM_RETRIES)try{return await this.wasmParser.parseFile(e,t)}catch(s){this.wasmFailCount++;let n=s instanceof Error?s.message:String(s),r=this.wasmFailCount>=h.MAX_WASM_RETRIES;$.warn(`[${this.language}] tree-sitter WASM parser failed (attempt ${this.wasmFailCount}/${h.MAX_WASM_RETRIES}): ${n}. Falling back to regex parser (~97-98% accuracy). `+(r?"Set AQE_PARSER_REGEX_ONLY=1 to silence this warning.":"Will retry WASM on next parse."))}return this.regexParser.parseFile(e,t)}},ne=class{parsers=new Map;_wasmInitPromise=null;constructor(){this.register(new H),this.register(new J),this.register(new Q),this.register(new X),this.register(new Y),this.register(new Z),this.register(new ee),this.register(new te),this._wasmInitPromise=this._tryLoadWasmParsers()}async _tryLoadWasmParsers(){try{let e=await import("./tree-sitter-wasm-parser-UDOTWN4W.js");if(!e.isWasmAvailable()){$.info("tree-sitter WASM parsers disabled or unavailable. Using regex parsers (~97-98% accuracy). Set AQE_PARSER_REGEX_ONLY=0 or ensure web-tree-sitter is installed to enable WASM.");return}let t=e.createWasmParsers();for(let s of de){let n=t.get(s),r=this.parsers.get(s);n&&r&&this.parsers.set(s,new se(n,r))}$.info("tree-sitter WASM parsers available for: "+de.join(", "))}catch{$.info("tree-sitter WASM parser module not available. Using regex parsers for all languages.")}}register(e){this.parsers.set(e.language,e)}getParser(e){return this.parsers.get(e)}async parseFile(e,t,s){this._wasmInitPromise&&(await this._wasmInitPromise,this._wasmInitPromise=null);let n=this.parsers.get(s);if(n)return n.parseFile(e,t)}getSupportedLanguages(){return Array.from(this.parsers.keys())}supportsLanguage(e){return this.parsers.has(e)}},De=new ne;import*as M from"node:fs/promises";import*as C from"node:path";var xe=[/\.\./,/%2e%2e/i,/%252e%252e/i,/\.\.%2f/i,/%2f\.\./i,/\.\.%5c/i,/\.\.\\/,/%c0%ae/i,/%c0%2f/i,/%c1%9c/i,/\0/,/%00/i],ve=[/^\/etc\//i,/^\/proc\//i,/^\/sys\//i,/^\/dev\//i,/^\/root\//i,/^\/home\/.+\/\./i,/^[A-Z]:\\Windows/i,/^[A-Z]:\\System/i,/^[A-Z]:\\Users\\.+\\AppData/i],ie=class{name="path-traversal";getRiskLevel(){return"critical"}validate(e,t={}){let{basePath:s="",allowAbsolute:n=!1,allowedExtensions:r=[],deniedExtensions:o=[".exe",".bat",".cmd",".sh",".ps1",".dll",".so"],maxDepth:i=10,maxLength:a=4096}=t;if(e.length>a)return{valid:!1,error:`Path exceeds maximum length of ${a}`,riskLevel:"medium"};for(let g of xe)if(g.test(e))return{valid:!1,error:"Path traversal attempt detected",riskLevel:"critical"};if(!n&&(e.startsWith("/")||/^[A-Z]:/i.test(e)))return{valid:!1,error:"Absolute paths are not allowed",riskLevel:"high"};for(let g of ve)if(g.test(e))return{valid:!1,error:"Access to system paths is not allowed",riskLevel:"critical"};let c=this.normalizePath(e);if(c.includes(".."))return{valid:!1,error:"Path traversal detected after normalization",riskLevel:"critical"};if(c.split("/").filter(Boolean).length>i)return{valid:!1,error:`Path depth exceeds maximum of ${i}`,riskLevel:"low"};let d=this.getExtension(c);if(d){let g=`.${d.toLowerCase()}`,f=d.toLowerCase();if(o.length>0&&o.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not allowed`,riskLevel:"high"};if(r.length>0&&!r.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not in allowed list`,riskLevel:"medium"}}let u=s?this.joinPathsAbsolute(s,c):c,m=s.startsWith("/")?`/${this.normalizePath(s)}`:this.normalizePath(s);return s&&!u.startsWith(m)?{valid:!1,error:"Path escapes base directory",riskLevel:"critical"}:{valid:!0,normalizedPath:u,riskLevel:"none"}}normalizePath(e){let t=e.replace(/\\/g,"/");t=t.replace(/\/+/g,"/");let s=t.split("/"),n=[];for(let r of s)r==="."||r===""||(r===".."?n.length>0&&n[n.length-1]!==".."&&n.pop():n.push(r));return n.join("/")}joinPaths(...e){return e.length===0?"":e.map(t=>t.replace(/^\/+/,"").replace(/\/+$/,"")).filter(Boolean).join("/")}joinPathsAbsolute(...e){if(e.length===0)return"";let t=e[0].startsWith("/"),s=e.map(n=>{for(;n.startsWith("/");)n=n.slice(1);for(;n.endsWith("/");)n=n.slice(0,-1);return n}).filter(Boolean).join("/");return t?`/${s}`:s}getExtension(e){let t=e.match(/\.([^./\\]+)$/);return t?t[1]:null}},Ee=new ie,pe=(h,e)=>Ee.validate(h,e);le();var A=class extends Error{constructor(t,s,n,r){super(t);this.filePath=s;this.code=n;this.cause=r;this.name="FileReadError"}filePath;code;cause},z=class extends Error{constructor(t,s,n){super(t);this.filePath=s;this.cause=n;this.name="JsonParseError"}filePath;cause},T=class extends Error{constructor(t,s,n){super(`Path traversal detected: ${s.join(", ")}`);this.requestedPath=t;this.issues=s;this.riskLevel=n;this.name="PathTraversalError"}requestedPath;issues;riskLevel},ae=class{constructor(e,t){this.maxSize=e;this.ttlMs=t}maxSize;ttlMs;cache=new Map;accessOrder=[];get(e){let t=this.cache.get(e);if(t){if(Date.now()-t.timestamp>this.ttlMs){this.delete(e);return}return this.updateAccessOrder(e),t.value}}set(e,t,s){for(this.cache.has(e)&&this.delete(e);this.cache.size>=this.maxSize&&this.accessOrder.length>0;){let n=this.accessOrder.shift();n&&this.cache.delete(n)}this.cache.set(e,{value:t,timestamp:Date.now(),size:s}),this.accessOrder.push(e)}delete(e){let t=this.cache.delete(e);if(t){let s=this.accessOrder.indexOf(e);s>-1&&this.accessOrder.splice(s,1)}return t}clear(){this.cache.clear(),this.accessOrder=[]}get size(){return this.cache.size}get totalBytes(){let e=0;return this.cache.forEach(t=>{e+=t.size}),e}updateAccessOrder(e){let t=this.accessOrder.indexOf(e);t>-1&&(this.accessOrder.splice(t,1),this.accessOrder.push(e))}prune(){let e=Date.now(),t=0,s=[];return this.cache.forEach((n,r)=>{e-n.timestamp>this.ttlMs&&s.push(r)}),s.forEach(n=>{this.delete(n),t++}),t}};function Ie(h){let e="",t=0;for(;t<h.length;){let s=h[t],n=h[t+1];s==="*"&&n==="*"?h[t+2]==="/"?(e+="(?:.*/)?",t+=3):(e+=".*",t+=2):s==="*"?(e+="[^/]*",t++):s==="?"?(e+="[^/]",t++):".+^${}()|[]\\".includes(s)?(e+="\\"+s,t++):(e+=s,t++)}return new RegExp("^"+e+"$")}async function ue(h,e,t,s){try{let n=await M.readdir(h,{withFileTypes:!0});for(let r of n){let o=C.join(h,r.name),i=C.relative(s,o);if(r.isDirectory())r.name!=="node_modules"&&!r.name.startsWith(".")&&await ue(o,e,t,s);else if(r.isFile()){let a=i.replace(/\\/g,"/");e.test(a)&&t.push(o)}}}catch(n){console.debug("[FileReader] Directory read error:",n instanceof Error?n.message:n)}}var k=class{basePath;cache;enableCache;stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:0,cacheEntries:0};constructor(e={}){this.basePath=e.basePath??process.cwd(),this.enableCache=e.enableCache??!0,this.cache=new ae(e.maxCacheSize??100,e.cacheTtlMs??300*1e3)}resolvePath(e){let t=C.isAbsolute(e),s=pe(e,{basePath:t?"":this.basePath,allowAbsolute:!0,deniedExtensions:[".exe",".bat",".cmd",".ps1",".dll",".so"]});if(!s.valid)throw new T(e,[s.error||"Path validation failed"],s.riskLevel);if(t&&this.basePath){let n=C.resolve(this.basePath),r=C.resolve(e);if(!r.startsWith(n))throw new T(e,["Path escapes base directory"],"critical");return r}return s.normalizedPath?s.normalizedPath:t?e:C.resolve(this.basePath,e)}async readFile(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}if(this.stats.totalReads++,this.enableCache){let s=this.cache.get(t);if(s!==void 0)return this.stats.cacheHits++,this.updateCacheStats(),w(s);this.stats.cacheMisses++}try{let s=await M.readFile(t,"utf-8");return this.enableCache&&(this.cache.set(t,s,Buffer.byteLength(s,"utf-8")),this.updateCacheStats()),w(s)}catch(s){let n=s,r;switch(n.code){case"ENOENT":r="File not found: "+t;break;case"EACCES":r="Permission denied: "+t;break;case"EISDIR":r="Path is a directory: "+t;break;default:r="Failed to read file: "+t}return L(new A(r,t,n.code,n))}}async readJSON(e){let t=await this.readFile(e);if(!t.success)return t;try{let s=N(t.value);return w(s)}catch(s){let n=s,r=e;try{r=this.resolvePath(e)}catch{}return L(new z("Invalid JSON in file: "+r+" - "+n.message,r,n))}}async fileExists(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}try{return await M.access(t,M.constants.F_OK),w(!0)}catch(s){let n=s;return n.code==="ENOENT"?w(!1):L(new A("Cannot check file existence: "+t,t,n.code,n))}}async listFiles(e,t){let s;try{s=t?this.resolvePath(t):this.basePath}catch(n){if(n instanceof T)return L(n);throw n}try{if(!(await M.stat(s)).isDirectory())return L(new A("Base path is not a directory: "+s,s,"ENOTDIR"));let r=Ie(e),o=[];return await ue(s,r,o,s),o.sort(),w(o)}catch(n){let r=n;return L(new A("Failed to list files in: "+s,s,r.code,r))}}invalidateCache(e){let t=this.resolvePath(e);this.cache.delete(t),this.updateCacheStats()}clearCache(){this.cache.clear(),this.updateCacheStats()}pruneCache(){let e=this.cache.prune();return this.updateCacheStats(),e}getStats(){return{...this.stats}}resetStats(){this.stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:this.cache.totalBytes,cacheEntries:this.cache.size}}updateCacheStats(){this.stats.cacheSize=this.cache.totalBytes,this.stats.cacheEntries=this.cache.size}};V();var v={MODEL:"all-MiniLM-L6-v2",DIMENSIONS:384,CONTEXT_WINDOW:8192,BATCH_SIZE:100,MAX_RETRIES:3,RETRY_DELAY_MS:1e3,TIMEOUT_MS:3e4,DEFAULT_OLLAMA_URL:"http://localhost:11434"};var K=class{baseUrl;maxRetries;retryDelayMs;timeoutMs;constructor(e=v.DEFAULT_OLLAMA_URL,t=v.MAX_RETRIES,s=v.RETRY_DELAY_MS,n=v.TIMEOUT_MS){this.baseUrl=e.replace(/\/$/,""),this.maxRetries=t,this.retryDelayMs=s,this.timeoutMs=n}async healthCheck(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);if(!e.ok)return!1;let t=await e.json();return t.models?t.models.some(s=>s.name?.startsWith(v.MODEL)||s.model?.startsWith(v.MODEL)):!1}catch{return!1}}async generateEmbedding(e){let t={model:v.MODEL,prompt:e},s=null;for(let n=0;n<this.maxRetries;n++)try{let r=await this.fetchWithTimeout(`${this.baseUrl}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},this.timeoutMs);if(!r.ok){let i=await r.text();throw new Error(`Ollama API error (${r.status}): ${i}`)}let o=await r.json();if(o.embedding.length!==v.DIMENSIONS)throw new Error(`Invalid embedding dimensions: expected ${v.DIMENSIONS}, got ${o.embedding.length}`);return o.embedding}catch(r){if(s=D(r),s.message.includes("Invalid embedding dimensions"))throw s;if(n<this.maxRetries-1){let o=this.retryDelayMs*Math.pow(2,n);await this.sleep(o)}}throw new Error(`Failed to generate embedding after ${this.maxRetries} attempts: ${s?.message}`)}async fetchWithTimeout(e,t,s){let n=new AbortController,r=setTimeout(()=>n.abort(),s);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(r)}}sleep(e){return new Promise(t=>setTimeout(t,e))}async getServerInfo(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);return e.ok?await e.json():null}catch{return null}}async ensureModelAvailable(){if(!await this.healthCheck())throw new Error(`Ollama model '${v.MODEL}' is not available. Please run: ollama pull ${v.MODEL}`)}};import{createHash as Pe}from"crypto";var U=class{cache;maxSize;hits;misses;constructor(e=1e4){this.cache=new Map,this.maxSize=e,this.hits=0,this.misses=0}hashContent(e,t){return Pe("sha256").update(`${t}:${e}`).digest("hex")}get(e,t){let s=this.hashContent(e,t),n=this.cache.get(s);return n?(this.hits++,this.cache.delete(s),this.cache.set(s,n),n.embedding):(this.misses++,null)}set(e,t,s){let n=this.hashContent(e,t);if(this.cache.size>=this.maxSize&&!this.cache.has(n)){let o=this.cache.keys().next().value;o&&this.cache.delete(o)}let r={embedding:s,timestamp:Date.now(),model:t};this.cache.set(n,r)}has(e,t){let s=this.hashContent(e,t);return this.cache.has(s)}getStats(){let e=this.hits+this.misses,t=e>0?this.hits/e:0;return{size:this.cache.size,hitRate:t,hits:this.hits,misses:this.misses}}clear(){this.cache.clear(),this.hits=0,this.misses=0}evictOlderThan(e){let s=Date.now()-e,n=0;for(let[r,o]of this.cache.entries())o.timestamp<s&&(this.cache.delete(r),n++);return n}getMemoryUsageEstimate(){return this.cache.size*3172}export(){return Array.from(this.cache.entries()).map(([e,t])=>({key:e,entry:t}))}import(e){this.cache.clear();for(let{key:t,entry:s}of e)this.cache.size<this.maxSize&&this.cache.set(t,s)}};V();var _=class{client;cache;batchSize;enableFallback;ollamaAvailable=null;constructor(e={}){this.client=new K(e.ollamaBaseUrl),this.cache=e.cache??new U(e.maxCacheSize),this.batchSize=e.batchSize??v.BATCH_SIZE,this.enableFallback=e.enableFallback??!0}async embed(e){let t=this.cache.get(e,v.MODEL);if(t)return t;let s;if(await this.isOllamaAvailable())s=await this.client.generateEmbedding(e);else if(this.enableFallback)s=this.generatePseudoEmbedding(e);else throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);return this.cache.set(e,v.MODEL,s),s}formatForEmbedding(e){let t=[];e.language&&t.push(e.language),e.type&&t.push(e.type),e.name&&t.push(e.name);let s=t.length>0?`${t.join(" ")}: `:"",n=v.CONTEXT_WINDOW*4,r=e.content.trim();if(s.length+r.length>n){let o=n-s.length-3;r=r.substring(0,o)+"..."}return s+r}async embedBatch(e){let t=[];for(let s of e){let n=await this.embed(s);t.push(n)}return t}async embedCodeChunks(e,t){let s=Date.now(),n=[],r=0,o=0,i=await this.isOllamaAvailable();if(i)await this.client.ensureModelAvailable();else if(!this.enableFallback)throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);for(let c=0;c<e.length;c+=this.batchSize){let l=e.slice(c,Math.min(c+this.batchSize,e.length)),d=await this.processBatch(l,i);n.push(...d);for(let u of d)u.cached?r++:o++;if(t){let u=c+l.length,m=e.length,f=(Date.now()-s)/u,y=(m-u)*f;t({current:u,total:m,percentage:u/m*100,estimatedTimeRemainingMs:y})}}let a=Date.now()-s;return{results:n,stats:{totalChunks:e.length,cachedHits:r,computedNew:o,totalTimeMs:a,avgTimePerChunk:a/e.length}}}async processBatch(e,t){let s=[],n=e.map(async o=>{let i=this.formatForEmbedding(o),a=Date.now(),c=this.cache.get(i,v.MODEL);if(c)return{chunkId:o.id,embedding:c,model:v.MODEL,cached:!0,computeTimeMs:Date.now()-a};try{let l;return t?l=await this.client.generateEmbedding(i):l=this.generatePseudoEmbedding(i),this.cache.set(i,v.MODEL,l),{chunkId:o.id,embedding:l,model:t?v.MODEL:"pseudo-embedding",cached:!1,computeTimeMs:Date.now()-a}}catch(l){throw new Error(`Failed to generate embedding for chunk ${o.id}: ${j(l)}`)}}),r=await Promise.all(n);return s.push(...r),s}async isOllamaAvailable(){return this.ollamaAvailable!==null?this.ollamaAvailable:(this.ollamaAvailable=await this.client.healthCheck(),this.ollamaAvailable)}resetOllamaCheck(){this.ollamaAvailable=null}generatePseudoEmbedding(e){let t=new Array(v.DIMENSIONS).fill(0),s=e.split(/\s+|[^\w]+/).filter(o=>o.length>0);for(let o=0;o<s.length;o++){let i=s[o];for(let a=0;a<i.length&&a<t.length;a++)t[(o+a)%t.length]+=i.charCodeAt(a)/1e3}let n=[[/class\s+\w+/,0],[/function\s+\w+/,1],[/async\s+|await\s+|Promise/,2],[/interface\s+\w+/,3],[/export\s+/,4],[/import\s+/,5],[/try\s*{/,6],[/\.(map|filter|reduce)\(/,7]];for(let[o,i]of n)o.test(e)&&(t[i]+=.5);let r=Math.sqrt(t.reduce((o,i)=>o+i*i,0))||1;return t.map(o=>o/r)}clearCache(){this.cache.clear()}getCacheStats(){return this.cache.getStats()}async healthCheck(){return await this.client.healthCheck()}async getServerInfo(){return await this.client.getServerInfo()}getDimensions(){return v.DIMENSIONS}getConfig(){return{model:v.MODEL,dimensions:v.DIMENSIONS,contextWindow:v.CONTEXT_WINDOW,batchSize:this.batchSize,maxRetries:v.MAX_RETRIES,enableFallback:this.enableFallback}}};V();le();var we={maxNodes:1e5,maxEdgesPerNode:500,namespace:"code-intelligence:kg",enableVectorEmbeddings:!0,embeddingDimension:384,enableLLMExtraction:!0,llmModelTier:2,llmMaxTokens:2048},me=oe.create("code-intelligence/knowledge-graph"),he=class{config;memory;nodeCache=new Map;edgeIndex=new Map;tsParser;fileReader;embedder;llmRouter;constructor(e,t={}){this.config={...we,...t},this.isKnowledgeGraphDependencies(e)?(this.memory=e.memory,this.llmRouter=e.llmRouter):(this.memory=e,this.llmRouter=void 0),this.tsParser=new F,this.fileReader=new k,this.embedder=new _({enableFallback:!0})}isKnowledgeGraphDependencies(e){return e.memory!==void 0}async index(e){let t=Date.now(),s=[],n=0,r=0;try{let{paths:o,incremental:i=!1,includeTests:a=!0,languages:c}=e;i||await this.clear();for(let d of o)try{if(c&&c.length>0){let m=this.getFileExtension(d);if(!this.matchesLanguage(m,c))continue}if(!a&&this.isTestFile(d))continue;let u=await this.indexFile(d);n+=u.nodes,r+=u.edges}catch(u){s.push({file:d,error:j(u)})}let l=Date.now()-t;return await this.storeIndexMetadata({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,indexedAt:new Date().toISOString()}),w({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,errors:s})}catch(o){return L(D(o))}}async query(e){try{let{query:t,type:s,limit:n=100}=e;return s==="cypher"?this.executeCypherQuery(t,n):this.executeNaturalLanguageQuery(t,n)}catch(t){return L(D(t))}}async mapDependencies(e){try{let{files:t,direction:s,depth:n=3}=e,r=[],o=[],i=new Set,a=[];for(let l of t)await this.traverseDependencies(l,s,n,i,r,o,[],a);let c=this.calculateDependencyMetrics(r,o);return w({nodes:r,edges:o,cycles:a,metrics:c})}catch(t){return L(D(t))}}async getNode(e){if(this.nodeCache.has(e))return this.nodeCache.get(e);let t=`${this.config.namespace}:node:${e}`,s=await this.memory.get(t);return s&&this.nodeCache.set(e,s),s}async getEdges(e,t){let s=[],n=this.edgeIndex.get(e);if(n)return this.filterEdgesByDirection(n,e,t);let r=`${this.config.namespace}:edge:*`,o=await this.memory.search(r,this.config.maxEdgesPerNode*2);for(let i of o){let a=await this.memory.get(i);a&&(t!=="outgoing"&&a.target===e||t!=="incoming"&&a.source===e)&&s.push(a)}return s}async clear(){this.nodeCache.clear(),this.edgeIndex.clear()}isLLMExtractionAvailable(){return this.config.enableLLMExtraction===!0&&this.llmRouter!==void 0}getModelForTier(e){switch(e){case 1:return"claude-haiku-4-5-20251001";case 2:return"claude-sonnet-4-6";case 3:return"claude-sonnet-4-6";case 4:return"claude-opus-4-7";default:return"claude-sonnet-4-6"}}async extractRelationshipsWithLLM(e,t){if(!this.llmRouter)return{semanticRelationships:[],designPatterns:[],architecturalBoundaries:[],dependencyImpacts:[]};try{let s=this.buildRelationshipExtractionPrompt(e,t),n=this.getModelForTier(this.config.llmModelTier??2),r=await this.llmRouter.chat({messages:[{role:"system",content:`You are an expert software architect analyzing code structure. Extract:
|
|
23
|
+
`);for(let n of s){let r=n.match(/^\s*import\s+'([^']+)'/);r&&t.push({module:r[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){if(!e.trim())return[];let t=e.replace(/[{}[\]]/g,"");return S(t).map(s=>s.trim()).filter(s=>s).map(s=>{let n=s.replace("required ","").trim().split(/\s+/),r=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:r,type:o,isOptional:s.includes("?")||s.includes("{"),defaultValue:void 0}})}},$=ce("ParserRegistry"),de=["python","java","csharp","rust","swift"],se=class h{language;supportedExtensions;wasmParser;regexParser;wasmFailCount=0;static MAX_WASM_RETRIES=3;constructor(e,t){this.wasmParser=e,this.regexParser=t,this.language=e.language,this.supportedExtensions=e.supportedExtensions}async parseFile(e,t){if(this.wasmFailCount<h.MAX_WASM_RETRIES)try{return await this.wasmParser.parseFile(e,t)}catch(s){this.wasmFailCount++;let n=s instanceof Error?s.message:String(s),r=this.wasmFailCount>=h.MAX_WASM_RETRIES;$.warn(`[${this.language}] tree-sitter WASM parser failed (attempt ${this.wasmFailCount}/${h.MAX_WASM_RETRIES}): ${n}. Falling back to regex parser (~97-98% accuracy). `+(r?"Set AQE_PARSER_REGEX_ONLY=1 to silence this warning.":"Will retry WASM on next parse."))}return this.regexParser.parseFile(e,t)}},ne=class{parsers=new Map;_wasmInitPromise=null;constructor(){this.register(new H),this.register(new J),this.register(new Q),this.register(new X),this.register(new Y),this.register(new Z),this.register(new ee),this.register(new te),this._wasmInitPromise=this._tryLoadWasmParsers()}async _tryLoadWasmParsers(){try{let e=await import("./tree-sitter-wasm-parser-NQ3JYKHC.js");if(!e.isWasmAvailable()){$.info("tree-sitter WASM parsers disabled or unavailable. Using regex parsers (~97-98% accuracy). Set AQE_PARSER_REGEX_ONLY=0 or ensure web-tree-sitter is installed to enable WASM.");return}let t=e.createWasmParsers();for(let s of de){let n=t.get(s),r=this.parsers.get(s);n&&r&&this.parsers.set(s,new se(n,r))}$.info("tree-sitter WASM parsers available for: "+de.join(", "))}catch{$.info("tree-sitter WASM parser module not available. Using regex parsers for all languages.")}}register(e){this.parsers.set(e.language,e)}getParser(e){return this.parsers.get(e)}async parseFile(e,t,s){this._wasmInitPromise&&(await this._wasmInitPromise,this._wasmInitPromise=null);let n=this.parsers.get(s);if(n)return n.parseFile(e,t)}getSupportedLanguages(){return Array.from(this.parsers.keys())}supportsLanguage(e){return this.parsers.has(e)}},De=new ne;import*as M from"node:fs/promises";import*as C from"node:path";var xe=[/\.\./,/%2e%2e/i,/%252e%252e/i,/\.\.%2f/i,/%2f\.\./i,/\.\.%5c/i,/\.\.\\/,/%c0%ae/i,/%c0%2f/i,/%c1%9c/i,/\0/,/%00/i],ve=[/^\/etc\//i,/^\/proc\//i,/^\/sys\//i,/^\/dev\//i,/^\/root\//i,/^\/home\/.+\/\./i,/^[A-Z]:\\Windows/i,/^[A-Z]:\\System/i,/^[A-Z]:\\Users\\.+\\AppData/i],ie=class{name="path-traversal";getRiskLevel(){return"critical"}validate(e,t={}){let{basePath:s="",allowAbsolute:n=!1,allowedExtensions:r=[],deniedExtensions:o=[".exe",".bat",".cmd",".sh",".ps1",".dll",".so"],maxDepth:i=10,maxLength:a=4096}=t;if(e.length>a)return{valid:!1,error:`Path exceeds maximum length of ${a}`,riskLevel:"medium"};for(let g of xe)if(g.test(e))return{valid:!1,error:"Path traversal attempt detected",riskLevel:"critical"};if(!n&&(e.startsWith("/")||/^[A-Z]:/i.test(e)))return{valid:!1,error:"Absolute paths are not allowed",riskLevel:"high"};for(let g of ve)if(g.test(e))return{valid:!1,error:"Access to system paths is not allowed",riskLevel:"critical"};let c=this.normalizePath(e);if(c.includes(".."))return{valid:!1,error:"Path traversal detected after normalization",riskLevel:"critical"};if(c.split("/").filter(Boolean).length>i)return{valid:!1,error:`Path depth exceeds maximum of ${i}`,riskLevel:"low"};let d=this.getExtension(c);if(d){let g=`.${d.toLowerCase()}`,f=d.toLowerCase();if(o.length>0&&o.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not allowed`,riskLevel:"high"};if(r.length>0&&!r.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not in allowed list`,riskLevel:"medium"}}let u=s?this.joinPathsAbsolute(s,c):c,m=s.startsWith("/")?`/${this.normalizePath(s)}`:this.normalizePath(s);return s&&!u.startsWith(m)?{valid:!1,error:"Path escapes base directory",riskLevel:"critical"}:{valid:!0,normalizedPath:u,riskLevel:"none"}}normalizePath(e){let t=e.replace(/\\/g,"/");t=t.replace(/\/+/g,"/");let s=t.split("/"),n=[];for(let r of s)r==="."||r===""||(r===".."?n.length>0&&n[n.length-1]!==".."&&n.pop():n.push(r));return n.join("/")}joinPaths(...e){return e.length===0?"":e.map(t=>t.replace(/^\/+/,"").replace(/\/+$/,"")).filter(Boolean).join("/")}joinPathsAbsolute(...e){if(e.length===0)return"";let t=e[0].startsWith("/"),s=e.map(n=>{for(;n.startsWith("/");)n=n.slice(1);for(;n.endsWith("/");)n=n.slice(0,-1);return n}).filter(Boolean).join("/");return t?`/${s}`:s}getExtension(e){let t=e.match(/\.([^./\\]+)$/);return t?t[1]:null}},Ee=new ie,pe=(h,e)=>Ee.validate(h,e);le();var A=class extends Error{constructor(t,s,n,r){super(t);this.filePath=s;this.code=n;this.cause=r;this.name="FileReadError"}filePath;code;cause},z=class extends Error{constructor(t,s,n){super(t);this.filePath=s;this.cause=n;this.name="JsonParseError"}filePath;cause},T=class extends Error{constructor(t,s,n){super(`Path traversal detected: ${s.join(", ")}`);this.requestedPath=t;this.issues=s;this.riskLevel=n;this.name="PathTraversalError"}requestedPath;issues;riskLevel},ae=class{constructor(e,t){this.maxSize=e;this.ttlMs=t}maxSize;ttlMs;cache=new Map;accessOrder=[];get(e){let t=this.cache.get(e);if(t){if(Date.now()-t.timestamp>this.ttlMs){this.delete(e);return}return this.updateAccessOrder(e),t.value}}set(e,t,s){for(this.cache.has(e)&&this.delete(e);this.cache.size>=this.maxSize&&this.accessOrder.length>0;){let n=this.accessOrder.shift();n&&this.cache.delete(n)}this.cache.set(e,{value:t,timestamp:Date.now(),size:s}),this.accessOrder.push(e)}delete(e){let t=this.cache.delete(e);if(t){let s=this.accessOrder.indexOf(e);s>-1&&this.accessOrder.splice(s,1)}return t}clear(){this.cache.clear(),this.accessOrder=[]}get size(){return this.cache.size}get totalBytes(){let e=0;return this.cache.forEach(t=>{e+=t.size}),e}updateAccessOrder(e){let t=this.accessOrder.indexOf(e);t>-1&&(this.accessOrder.splice(t,1),this.accessOrder.push(e))}prune(){let e=Date.now(),t=0,s=[];return this.cache.forEach((n,r)=>{e-n.timestamp>this.ttlMs&&s.push(r)}),s.forEach(n=>{this.delete(n),t++}),t}};function Ie(h){let e="",t=0;for(;t<h.length;){let s=h[t],n=h[t+1];s==="*"&&n==="*"?h[t+2]==="/"?(e+="(?:.*/)?",t+=3):(e+=".*",t+=2):s==="*"?(e+="[^/]*",t++):s==="?"?(e+="[^/]",t++):".+^${}()|[]\\".includes(s)?(e+="\\"+s,t++):(e+=s,t++)}return new RegExp("^"+e+"$")}async function ue(h,e,t,s){try{let n=await M.readdir(h,{withFileTypes:!0});for(let r of n){let o=C.join(h,r.name),i=C.relative(s,o);if(r.isDirectory())r.name!=="node_modules"&&!r.name.startsWith(".")&&await ue(o,e,t,s);else if(r.isFile()){let a=i.replace(/\\/g,"/");e.test(a)&&t.push(o)}}}catch(n){console.debug("[FileReader] Directory read error:",n instanceof Error?n.message:n)}}var k=class{basePath;cache;enableCache;stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:0,cacheEntries:0};constructor(e={}){this.basePath=e.basePath??process.cwd(),this.enableCache=e.enableCache??!0,this.cache=new ae(e.maxCacheSize??100,e.cacheTtlMs??300*1e3)}resolvePath(e){let t=C.isAbsolute(e),s=pe(e,{basePath:t?"":this.basePath,allowAbsolute:!0,deniedExtensions:[".exe",".bat",".cmd",".ps1",".dll",".so"]});if(!s.valid)throw new T(e,[s.error||"Path validation failed"],s.riskLevel);if(t&&this.basePath){let n=C.resolve(this.basePath),r=C.resolve(e);if(!r.startsWith(n))throw new T(e,["Path escapes base directory"],"critical");return r}return s.normalizedPath?s.normalizedPath:t?e:C.resolve(this.basePath,e)}async readFile(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}if(this.stats.totalReads++,this.enableCache){let s=this.cache.get(t);if(s!==void 0)return this.stats.cacheHits++,this.updateCacheStats(),w(s);this.stats.cacheMisses++}try{let s=await M.readFile(t,"utf-8");return this.enableCache&&(this.cache.set(t,s,Buffer.byteLength(s,"utf-8")),this.updateCacheStats()),w(s)}catch(s){let n=s,r;switch(n.code){case"ENOENT":r="File not found: "+t;break;case"EACCES":r="Permission denied: "+t;break;case"EISDIR":r="Path is a directory: "+t;break;default:r="Failed to read file: "+t}return L(new A(r,t,n.code,n))}}async readJSON(e){let t=await this.readFile(e);if(!t.success)return t;try{let s=N(t.value);return w(s)}catch(s){let n=s,r=e;try{r=this.resolvePath(e)}catch{}return L(new z("Invalid JSON in file: "+r+" - "+n.message,r,n))}}async fileExists(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}try{return await M.access(t,M.constants.F_OK),w(!0)}catch(s){let n=s;return n.code==="ENOENT"?w(!1):L(new A("Cannot check file existence: "+t,t,n.code,n))}}async listFiles(e,t){let s;try{s=t?this.resolvePath(t):this.basePath}catch(n){if(n instanceof T)return L(n);throw n}try{if(!(await M.stat(s)).isDirectory())return L(new A("Base path is not a directory: "+s,s,"ENOTDIR"));let r=Ie(e),o=[];return await ue(s,r,o,s),o.sort(),w(o)}catch(n){let r=n;return L(new A("Failed to list files in: "+s,s,r.code,r))}}invalidateCache(e){let t=this.resolvePath(e);this.cache.delete(t),this.updateCacheStats()}clearCache(){this.cache.clear(),this.updateCacheStats()}pruneCache(){let e=this.cache.prune();return this.updateCacheStats(),e}getStats(){return{...this.stats}}resetStats(){this.stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:this.cache.totalBytes,cacheEntries:this.cache.size}}updateCacheStats(){this.stats.cacheSize=this.cache.totalBytes,this.stats.cacheEntries=this.cache.size}};V();var v={MODEL:"all-MiniLM-L6-v2",DIMENSIONS:384,CONTEXT_WINDOW:8192,BATCH_SIZE:100,MAX_RETRIES:3,RETRY_DELAY_MS:1e3,TIMEOUT_MS:3e4,DEFAULT_OLLAMA_URL:"http://localhost:11434"};var K=class{baseUrl;maxRetries;retryDelayMs;timeoutMs;constructor(e=v.DEFAULT_OLLAMA_URL,t=v.MAX_RETRIES,s=v.RETRY_DELAY_MS,n=v.TIMEOUT_MS){this.baseUrl=e.replace(/\/$/,""),this.maxRetries=t,this.retryDelayMs=s,this.timeoutMs=n}async healthCheck(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);if(!e.ok)return!1;let t=await e.json();return t.models?t.models.some(s=>s.name?.startsWith(v.MODEL)||s.model?.startsWith(v.MODEL)):!1}catch{return!1}}async generateEmbedding(e){let t={model:v.MODEL,prompt:e},s=null;for(let n=0;n<this.maxRetries;n++)try{let r=await this.fetchWithTimeout(`${this.baseUrl}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},this.timeoutMs);if(!r.ok){let i=await r.text();throw new Error(`Ollama API error (${r.status}): ${i}`)}let o=await r.json();if(o.embedding.length!==v.DIMENSIONS)throw new Error(`Invalid embedding dimensions: expected ${v.DIMENSIONS}, got ${o.embedding.length}`);return o.embedding}catch(r){if(s=D(r),s.message.includes("Invalid embedding dimensions"))throw s;if(n<this.maxRetries-1){let o=this.retryDelayMs*Math.pow(2,n);await this.sleep(o)}}throw new Error(`Failed to generate embedding after ${this.maxRetries} attempts: ${s?.message}`)}async fetchWithTimeout(e,t,s){let n=new AbortController,r=setTimeout(()=>n.abort(),s);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(r)}}sleep(e){return new Promise(t=>setTimeout(t,e))}async getServerInfo(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);return e.ok?await e.json():null}catch{return null}}async ensureModelAvailable(){if(!await this.healthCheck())throw new Error(`Ollama model '${v.MODEL}' is not available. Please run: ollama pull ${v.MODEL}`)}};import{createHash as Pe}from"crypto";var U=class{cache;maxSize;hits;misses;constructor(e=1e4){this.cache=new Map,this.maxSize=e,this.hits=0,this.misses=0}hashContent(e,t){return Pe("sha256").update(`${t}:${e}`).digest("hex")}get(e,t){let s=this.hashContent(e,t),n=this.cache.get(s);return n?(this.hits++,this.cache.delete(s),this.cache.set(s,n),n.embedding):(this.misses++,null)}set(e,t,s){let n=this.hashContent(e,t);if(this.cache.size>=this.maxSize&&!this.cache.has(n)){let o=this.cache.keys().next().value;o&&this.cache.delete(o)}let r={embedding:s,timestamp:Date.now(),model:t};this.cache.set(n,r)}has(e,t){let s=this.hashContent(e,t);return this.cache.has(s)}getStats(){let e=this.hits+this.misses,t=e>0?this.hits/e:0;return{size:this.cache.size,hitRate:t,hits:this.hits,misses:this.misses}}clear(){this.cache.clear(),this.hits=0,this.misses=0}evictOlderThan(e){let s=Date.now()-e,n=0;for(let[r,o]of this.cache.entries())o.timestamp<s&&(this.cache.delete(r),n++);return n}getMemoryUsageEstimate(){return this.cache.size*3172}export(){return Array.from(this.cache.entries()).map(([e,t])=>({key:e,entry:t}))}import(e){this.cache.clear();for(let{key:t,entry:s}of e)this.cache.size<this.maxSize&&this.cache.set(t,s)}};V();var _=class{client;cache;batchSize;enableFallback;ollamaAvailable=null;constructor(e={}){this.client=new K(e.ollamaBaseUrl),this.cache=e.cache??new U(e.maxCacheSize),this.batchSize=e.batchSize??v.BATCH_SIZE,this.enableFallback=e.enableFallback??!0}async embed(e){let t=this.cache.get(e,v.MODEL);if(t)return t;let s;if(await this.isOllamaAvailable())s=await this.client.generateEmbedding(e);else if(this.enableFallback)s=this.generatePseudoEmbedding(e);else throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);return this.cache.set(e,v.MODEL,s),s}formatForEmbedding(e){let t=[];e.language&&t.push(e.language),e.type&&t.push(e.type),e.name&&t.push(e.name);let s=t.length>0?`${t.join(" ")}: `:"",n=v.CONTEXT_WINDOW*4,r=e.content.trim();if(s.length+r.length>n){let o=n-s.length-3;r=r.substring(0,o)+"..."}return s+r}async embedBatch(e){let t=[];for(let s of e){let n=await this.embed(s);t.push(n)}return t}async embedCodeChunks(e,t){let s=Date.now(),n=[],r=0,o=0,i=await this.isOllamaAvailable();if(i)await this.client.ensureModelAvailable();else if(!this.enableFallback)throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);for(let c=0;c<e.length;c+=this.batchSize){let l=e.slice(c,Math.min(c+this.batchSize,e.length)),d=await this.processBatch(l,i);n.push(...d);for(let u of d)u.cached?r++:o++;if(t){let u=c+l.length,m=e.length,f=(Date.now()-s)/u,y=(m-u)*f;t({current:u,total:m,percentage:u/m*100,estimatedTimeRemainingMs:y})}}let a=Date.now()-s;return{results:n,stats:{totalChunks:e.length,cachedHits:r,computedNew:o,totalTimeMs:a,avgTimePerChunk:a/e.length}}}async processBatch(e,t){let s=[],n=e.map(async o=>{let i=this.formatForEmbedding(o),a=Date.now(),c=this.cache.get(i,v.MODEL);if(c)return{chunkId:o.id,embedding:c,model:v.MODEL,cached:!0,computeTimeMs:Date.now()-a};try{let l;return t?l=await this.client.generateEmbedding(i):l=this.generatePseudoEmbedding(i),this.cache.set(i,v.MODEL,l),{chunkId:o.id,embedding:l,model:t?v.MODEL:"pseudo-embedding",cached:!1,computeTimeMs:Date.now()-a}}catch(l){throw new Error(`Failed to generate embedding for chunk ${o.id}: ${j(l)}`)}}),r=await Promise.all(n);return s.push(...r),s}async isOllamaAvailable(){return this.ollamaAvailable!==null?this.ollamaAvailable:(this.ollamaAvailable=await this.client.healthCheck(),this.ollamaAvailable)}resetOllamaCheck(){this.ollamaAvailable=null}generatePseudoEmbedding(e){let t=new Array(v.DIMENSIONS).fill(0),s=e.split(/\s+|[^\w]+/).filter(o=>o.length>0);for(let o=0;o<s.length;o++){let i=s[o];for(let a=0;a<i.length&&a<t.length;a++)t[(o+a)%t.length]+=i.charCodeAt(a)/1e3}let n=[[/class\s+\w+/,0],[/function\s+\w+/,1],[/async\s+|await\s+|Promise/,2],[/interface\s+\w+/,3],[/export\s+/,4],[/import\s+/,5],[/try\s*{/,6],[/\.(map|filter|reduce)\(/,7]];for(let[o,i]of n)o.test(e)&&(t[i]+=.5);let r=Math.sqrt(t.reduce((o,i)=>o+i*i,0))||1;return t.map(o=>o/r)}clearCache(){this.cache.clear()}getCacheStats(){return this.cache.getStats()}async healthCheck(){return await this.client.healthCheck()}async getServerInfo(){return await this.client.getServerInfo()}getDimensions(){return v.DIMENSIONS}getConfig(){return{model:v.MODEL,dimensions:v.DIMENSIONS,contextWindow:v.CONTEXT_WINDOW,batchSize:this.batchSize,maxRetries:v.MAX_RETRIES,enableFallback:this.enableFallback}}};V();le();var we={maxNodes:1e5,maxEdgesPerNode:500,namespace:"code-intelligence:kg",enableVectorEmbeddings:!0,embeddingDimension:384,enableLLMExtraction:!0,llmModelTier:2,llmMaxTokens:2048},me=oe.create("code-intelligence/knowledge-graph"),he=class{config;memory;nodeCache=new Map;edgeIndex=new Map;tsParser;fileReader;embedder;llmRouter;constructor(e,t={}){this.config={...we,...t},this.isKnowledgeGraphDependencies(e)?(this.memory=e.memory,this.llmRouter=e.llmRouter):(this.memory=e,this.llmRouter=void 0),this.tsParser=new F,this.fileReader=new k,this.embedder=new _({enableFallback:!0})}isKnowledgeGraphDependencies(e){return e.memory!==void 0}async index(e){let t=Date.now(),s=[],n=0,r=0;try{let{paths:o,incremental:i=!1,includeTests:a=!0,languages:c}=e;i||await this.clear();for(let d of o)try{if(c&&c.length>0){let m=this.getFileExtension(d);if(!this.matchesLanguage(m,c))continue}if(!a&&this.isTestFile(d))continue;let u=await this.indexFile(d);n+=u.nodes,r+=u.edges}catch(u){s.push({file:d,error:j(u)})}let l=Date.now()-t;return await this.storeIndexMetadata({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,indexedAt:new Date().toISOString()}),w({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,errors:s})}catch(o){return L(D(o))}}async query(e){try{let{query:t,type:s,limit:n=100}=e;return s==="cypher"?this.executeCypherQuery(t,n):this.executeNaturalLanguageQuery(t,n)}catch(t){return L(D(t))}}async mapDependencies(e){try{let{files:t,direction:s,depth:n=3}=e,r=[],o=[],i=new Set,a=[];for(let l of t)await this.traverseDependencies(l,s,n,i,r,o,[],a);let c=this.calculateDependencyMetrics(r,o);return w({nodes:r,edges:o,cycles:a,metrics:c})}catch(t){return L(D(t))}}async getNode(e){if(this.nodeCache.has(e))return this.nodeCache.get(e);let t=`${this.config.namespace}:node:${e}`,s=await this.memory.get(t);return s&&this.nodeCache.set(e,s),s}async getEdges(e,t){let s=[],n=this.edgeIndex.get(e);if(n)return this.filterEdgesByDirection(n,e,t);let r=`${this.config.namespace}:edge:*`,o=await this.memory.search(r,this.config.maxEdgesPerNode*2);for(let i of o){let a=await this.memory.get(i);a&&(t!=="outgoing"&&a.target===e||t!=="incoming"&&a.source===e)&&s.push(a)}return s}async clear(){this.nodeCache.clear(),this.edgeIndex.clear()}isLLMExtractionAvailable(){return this.config.enableLLMExtraction===!0&&this.llmRouter!==void 0}getModelForTier(e){switch(e){case 1:return"claude-haiku-4-5-20251001";case 2:return"claude-sonnet-4-6";case 3:return"claude-sonnet-4-6";case 4:return"claude-opus-4-7";default:return"claude-sonnet-4-6"}}async extractRelationshipsWithLLM(e,t){if(!this.llmRouter)return{semanticRelationships:[],designPatterns:[],architecturalBoundaries:[],dependencyImpacts:[]};try{let s=this.buildRelationshipExtractionPrompt(e,t),n=this.getModelForTier(this.config.llmModelTier??2),r=await this.llmRouter.chat({messages:[{role:"system",content:`You are an expert software architect analyzing code structure. Extract:
|
|
24
24
|
1. Semantic relationships between code entities (inheritance, composition, dependency, collaboration)
|
|
25
25
|
2. Design patterns used (Factory, Singleton, Observer, Strategy, etc.)
|
|
26
26
|
3. Architectural boundaries (layers, modules, domains)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.35");process.exit(0)}
|
|
2
2
|
var t=["claude","openai","ollama","openrouter","gemini","azure-openai","bedrock","onnx"];var e={maxAttempts:3,delayMs:100,trySameProviderAlternateModel:!0,skipOpenCircuits:!0,retryableErrors:["RATE_LIMITED","TIMEOUT","NETWORK_ERROR","PROVIDER_UNAVAILABLE"]},r=[{provider:"claude",models:["claude-sonnet-4-6","claude-haiku-4-5-20251001"],enabled:!0,priority:100,maxAttempts:2,timeoutMs:3e4},{provider:"openai",models:["gpt-4o","gpt-4o-mini"],enabled:!0,priority:90,maxAttempts:2,timeoutMs:3e4},{provider:"openrouter",models:["anthropic/claude-sonnet-4","openai/gpt-4o"],enabled:!0,priority:85,maxAttempts:2,timeoutMs:3e4},{provider:"ollama",models:["llama3.1","mistral"],enabled:!0,priority:80,maxAttempts:2,timeoutMs:6e4},{provider:"onnx",models:["phi-4","all-MiniLM-L6-v2"],enabled:!0,priority:70,maxAttempts:1,timeoutMs:12e4}],o={id:"default-fallback-chain",entries:r,maxRetries:3,retryDelayMs:100,backoffMultiplier:2,maxDelayMs:5e3},n={mode:"rule-based",rules:[],defaultProvider:"claude",defaultModel:"claude-sonnet-4-6",fallbackChain:o,fallbackBehavior:e,providers:{claude:{enabled:!0,defaultModel:"claude-sonnet-4-6"},openai:{enabled:!0,defaultModel:"gpt-4o"},ollama:{enabled:!0,defaultModel:"llama3.1"},openrouter:{enabled:!0,defaultModel:"anthropic/claude-sonnet-4"},gemini:{enabled:!1,defaultModel:"gemini-pro"},"azure-openai":{enabled:!1},bedrock:{enabled:!1},onnx:{enabled:!0,defaultModel:"phi-4"}},enableMetrics:!0,metricsConfig:{enabled:!0,collectionIntervalMs:6e4,retentionMs:864e5,trackPerRequest:!0},maxDecisionTimeMs:10,cacheDecisions:!0,decisionCacheTtlMs:6e4,cacheConfig:{enabled:!0,ttlMs:6e4,maxEntries:1e3,keyStrategy:"agent-domain"},auditConfig:{enabled:!0,maxEntries:1e4,logContent:!1,logResponse:!1}},a=[{canonicalId:"claude-opus-4-7",canonicalName:"Claude Opus 4.7",providerIds:{claude:"claude-opus-4-7",openrouter:"anthropic/claude-opus-4.7",bedrock:"anthropic.claude-opus-4-7-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!0,supportsVision:!0,supportsExtendedThinking:!0,supportsJsonMode:!0,maxContextTokens:1e6,maxOutputTokens:128e3},tier:"flagship",family:"claude",inputCostPer1M:5,outputCostPer1M:25},{canonicalId:"claude-sonnet-4-6",canonicalName:"Claude Sonnet 4.6",providerIds:{claude:"claude-sonnet-4-6",openrouter:"anthropic/claude-sonnet-4.6",bedrock:"anthropic.claude-sonnet-4-6-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!0,supportsVision:!0,supportsExtendedThinking:!0,supportsJsonMode:!0,maxContextTokens:2e5,maxOutputTokens:64e3},tier:"advanced",family:"claude",inputCostPer1M:3,outputCostPer1M:15},{canonicalId:"claude-haiku-4-5",canonicalName:"Claude Haiku 4.5",providerIds:{claude:"claude-haiku-4-5-20251001",openrouter:"anthropic/claude-haiku-4.5",bedrock:"anthropic.claude-haiku-4-5-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!0,supportsJsonMode:!0,maxContextTokens:2e5,maxOutputTokens:16384},tier:"standard",family:"claude",inputCostPer1M:1,outputCostPer1M:5},{canonicalId:"gpt-4o",canonicalName:"GPT-4o",providerIds:{openai:"gpt-4o","azure-openai":"gpt-4o",openrouter:"openai/gpt-4o"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:128e3,maxOutputTokens:16384},tier:"advanced",family:"gpt",inputCostPer1M:2.5,outputCostPer1M:10},{canonicalId:"gpt-4o-mini",canonicalName:"GPT-4o Mini",providerIds:{openai:"gpt-4o-mini","azure-openai":"gpt-4o-mini",openrouter:"openai/gpt-4o-mini"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:128e3,maxOutputTokens:16384},tier:"standard",family:"gpt",inputCostPer1M:.15,outputCostPer1M:.6},{canonicalId:"gemini-pro",canonicalName:"Gemini 2.0 Pro",providerIds:{gemini:"gemini-2.0-pro",openrouter:"google/gemini-2.0-pro"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:2e6,maxOutputTokens:8192},tier:"advanced",family:"gemini",inputCostPer1M:1.25,outputCostPer1M:5},{canonicalId:"llama-3.1-70b",canonicalName:"LLaMA 3.1 70B",providerIds:{ollama:"llama3.1:70b",openrouter:"meta-llama/llama-3.1-70b",bedrock:"meta.llama3-1-70b-instruct-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!1,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:128e3,maxOutputTokens:4096},tier:"advanced",family:"llama",inputCostPer1M:.9,outputCostPer1M:.9},{canonicalId:"phi-4",canonicalName:"Microsoft Phi-4",providerIds:{ollama:"phi4",onnx:"phi-4",openrouter:"microsoft/phi-4"},capabilities:{supportsStreaming:!0,supportsTools:!1,supportsMCP:!1,supportsVision:!1,supportsExtendedThinking:!1,supportsJsonMode:!1,maxContextTokens:16e3,maxOutputTokens:4096,requiresNetwork:!1},tier:"efficient",family:"phi",inputCostPer1M:0,outputCostPer1M:0}];export{t as a,n as b,a as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.
|
|
2
|
-
import{a as H}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.35");process.exit(0)}
|
|
2
|
+
import{a as H}from"./chunk-3R6YQEQY.js";import{a as C,b as D,c as U,d as _}from"./chunk-5CZDHJZX.js";import{c as X,d as K,e as Y,f as J}from"./chunk-XUZ73S3Y.js";import{b as k,f as j,i as G}from"./chunk-NPUMPLL7.js";import{g as w}from"./chunk-HKQ23RPJ.js";import{e as $}from"./chunk-RP5SDWCL.js";import{k as z,o as me}from"./chunk-IXOGBA7C.js";import{a as B}from"./chunk-PHJK33IV.js";import{c as T}from"./chunk-BTPDHALG.js";import{b as q,c as x}from"./chunk-6WZNRHJJ.js";import{a as f,b as L,c as V}from"./chunk-DEJW6GYF.js";import{S as de,b as W}from"./chunk-5Q7X5SDB.js";B();V();var I={enableLearning:!0,enableGuidance:!0,enableRouting:!0,embeddingDimension:384,useONNXEmbeddings:!0,maxRoutingCandidates:10,routingWeights:{similarity:.3,performance:.4,capabilities:.3},coherenceThreshold:.4};var A=[{patternType:"test-template",name:"AAA Unit Test",description:"Arrange-Act-Assert pattern for clear, maintainable unit tests",template:{type:"code",content:`describe('{{className}}', () => {
|
|
3
3
|
describe('{{methodName}}', () => {
|
|
4
4
|
it('should {{expectedBehavior}}', {{async}} () => {
|
|
5
5
|
// Arrange
|
|
@@ -278,7 +278,7 @@ On promotion:
|
|
|
278
278
|
- Move from short-term to long-term tier
|
|
279
279
|
- Boost confidence by 10%
|
|
280
280
|
- Enable for cross-domain transfer to related domains
|
|
281
|
-
- Mark as reusable for token savings optimization`,variables:[{name:"patternName",type:"string",required:!0,description:"Pattern to evaluate for promotion"}]},context:{tags:["promotion","learning","quality","pipeline"]},confidence:.6}];import{randomInt as Z}from"crypto";var R={"qe-test-generator":{domains:["test-generation"],capabilities:["test-generation","tdd","bdd","unit-test","integration-test"],performanceScore:.85,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-analyzer":{domains:["coverage-analysis"],capabilities:["coverage-analysis","gap-detection","risk-scoring"],performanceScore:.92,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-specialist":{domains:["coverage-analysis"],capabilities:["sublinear-analysis","branch-coverage","mutation-testing"],performanceScore:.88,languages:["typescript","javascript"]},"qe-test-architect":{domains:["test-generation","coverage-analysis"],capabilities:["test-strategy","test-pyramid","architecture"],performanceScore:.9,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-api-contract-validator":{domains:["contract-testing"],capabilities:["contract-testing","openapi","graphql","pact"],performanceScore:.87},"qe-security-auditor":{domains:["security-compliance"],capabilities:["sast","dast","vulnerability","owasp"],performanceScore:.82},"qe-visual-tester":{domains:["visual-accessibility"],capabilities:["screenshot","visual-regression","percy","chromatic"],performanceScore:.8},"qe-a11y-ally":{domains:["visual-accessibility"],capabilities:["wcag","aria","screen-reader","contrast"],performanceScore:.85},"qe-performance-tester":{domains:["chaos-resilience"],capabilities:["load-testing","stress-testing","k6","artillery"],performanceScore:.83},"qe-flaky-investigator":{domains:["test-execution"],capabilities:["flaky-detection","test-stability","retry"],performanceScore:.78},"qe-chaos-engineer":{domains:["chaos-resilience"],capabilities:["chaos-testing","resilience","fault-injection"],performanceScore:.75}},ge=.4,fe=20;function he(n){return 1/(1+Math.exp(-n))}function ye(n,e){if(!e||e.visits===0)return{score:n,qWeight:0,qValue:0,qVisits:0};let r=Math.min(e.visits/fe,1)*ge,t=he(e.qValue);return{score:n*(1-r)+t*r,qWeight:r,qValue:e.qValue,qVisits:e.visits}}function ee(n){let e=n.envOverride,r=e!==void 0?Number.parseFloat(e):NaN,t=Number.isFinite(r)&&r>=0&&r<=1?r:.05,i=n.topologyCritical?.2:1;return{epsilon:Math.min(Math.max(t*i,0),1),baseEpsilon:t,safetyMultiplier:i}}function te(n,e){if(e<=0||n.length<2)return;let r=Math.round(e*1e6);if(r<=0||Z(0,1e6)>=r)return;let t=Math.min(4,n.length),i=Z(1,t),o=n[i];n[i]=n[0],n[0]=o,n[0].exploration=!0,n[0].reasoning=[...n[0].reasoning,"(exploration)"]}function re(n){let e=n.toLowerCase();return/\bgenerate[- ]?test|\btest[- ]?gen|\bgenerate.+spec/.test(e)?"test-generation":/\bcoverage|\banalyze.+cover/.test(e)?"coverage-analysis":/\bquality|\bassess|\baudit/.test(e)?"quality-assessment":/\bsecurity|\bvulnerab|\bcompliance/.test(e)?"security-compliance":/\bdefect|\bbug|\bdiagnos/.test(e)?"defect-intelligence":/\brequirement|\bspec\b/.test(e)?"requirements-validation":/\brefactor|\brewrite|\boptim/.test(e)?"refactoring":/\btest|\brun.+test/.test(e)?"test-execution":"unknown"}function ne(n){return`${n.taskType}|${n.priority??"normal"}|${n.domain??"any"}|${n.complexityBucket}`}function ie(n){return Math.max(0,Math.min(10,Math.round(Math.min(n.length/200,1)*10)))}function N(n,e,r,t,i=R,o,s){let a=[];for(let[c,u]of Object.entries(i)){let l=0,d=[],m=n.filter(h=>u.domains.includes(h)).length,y=m>0?m/n.length*.4:0;if(l+=y*t.similarity,y>0&&d.push(`Domain match: ${(y*100).toFixed(0)}%`),e&&e.length>0){let h=e.filter(v=>u.capabilities.some(P=>P.toLowerCase().includes(v.toLowerCase()))).length,p=h>0?h/e.length*.3:0;l+=p*t.capabilities,p>0&&d.push(`Capability match: ${(p*100).toFixed(0)}%`)}else l+=.15*t.capabilities;if(l+=u.performanceScore*.3*t.performance,d.push(`Performance score: ${(u.performanceScore*100).toFixed(0)}%`),o&&u.languages&&u.languages.length>0){let h=t.language??1,p=o.toLowerCase();if(u.languages.some(P=>P.toLowerCase()===p)){let P=.15*h;l+=P,d.push(`Language match: ${o}`)}}let b=r.get(c)||0;if(b>0){let h=Math.min(.1,b*.02);l+=h,d.push(`Pattern matches: ${b}`)}let
|
|
281
|
+
- Mark as reusable for token savings optimization`,variables:[{name:"patternName",type:"string",required:!0,description:"Pattern to evaluate for promotion"}]},context:{tags:["promotion","learning","quality","pipeline"]},confidence:.6}];import{randomInt as Z}from"crypto";var R={"qe-test-generator":{domains:["test-generation"],capabilities:["test-generation","tdd","bdd","unit-test","integration-test"],performanceScore:.85,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-analyzer":{domains:["coverage-analysis"],capabilities:["coverage-analysis","gap-detection","risk-scoring"],performanceScore:.92,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-specialist":{domains:["coverage-analysis"],capabilities:["sublinear-analysis","branch-coverage","mutation-testing"],performanceScore:.88,languages:["typescript","javascript"]},"qe-test-architect":{domains:["test-generation","coverage-analysis"],capabilities:["test-strategy","test-pyramid","architecture"],performanceScore:.9,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-api-contract-validator":{domains:["contract-testing"],capabilities:["contract-testing","openapi","graphql","pact"],performanceScore:.87},"qe-security-auditor":{domains:["security-compliance"],capabilities:["sast","dast","vulnerability","owasp"],performanceScore:.82},"qe-visual-tester":{domains:["visual-accessibility"],capabilities:["screenshot","visual-regression","percy","chromatic"],performanceScore:.8},"qe-a11y-ally":{domains:["visual-accessibility"],capabilities:["wcag","aria","screen-reader","contrast"],performanceScore:.85},"qe-performance-tester":{domains:["chaos-resilience"],capabilities:["load-testing","stress-testing","k6","artillery"],performanceScore:.83},"qe-flaky-investigator":{domains:["test-execution"],capabilities:["flaky-detection","test-stability","retry"],performanceScore:.78},"qe-chaos-engineer":{domains:["chaos-resilience"],capabilities:["chaos-testing","resilience","fault-injection"],performanceScore:.75}},ge=.4,fe=20;function he(n){return 1/(1+Math.exp(-n))}function ye(n,e){if(!e||e.visits===0)return{score:n,qWeight:0,qValue:0,qVisits:0};let r=Math.min(e.visits/fe,1)*ge,t=he(e.qValue);return{score:n*(1-r)+t*r,qWeight:r,qValue:e.qValue,qVisits:e.visits}}function ee(n){let e=n.envOverride,r=e!==void 0?Number.parseFloat(e):NaN,t=Number.isFinite(r)&&r>=0&&r<=1?r:.05,i=n.topologyCritical?.2:1;return{epsilon:Math.min(Math.max(t*i,0),1),baseEpsilon:t,safetyMultiplier:i}}function te(n,e){if(e<=0||n.length<2)return;let r=Math.round(e*1e6);if(r<=0||Z(0,1e6)>=r)return;let t=Math.min(4,n.length),i=Z(1,t),o=n[i];n[i]=n[0],n[0]=o,n[0].exploration=!0,n[0].reasoning=[...n[0].reasoning,"(exploration)"]}function re(n){let e=n.toLowerCase();return/\bgenerate[- ]?test|\btest[- ]?gen|\bgenerate.+spec/.test(e)?"test-generation":/\bcoverage|\banalyze.+cover/.test(e)?"coverage-analysis":/\bquality|\bassess|\baudit/.test(e)?"quality-assessment":/\bsecurity|\bvulnerab|\bcompliance/.test(e)?"security-compliance":/\bdefect|\bbug|\bdiagnos/.test(e)?"defect-intelligence":/\brequirement|\bspec\b/.test(e)?"requirements-validation":/\brefactor|\brewrite|\boptim/.test(e)?"refactoring":/\btest|\brun.+test/.test(e)?"test-execution":"unknown"}function ne(n){return`${n.taskType}|${n.priority??"normal"}|${n.domain??"any"}|${n.complexityBucket}`}function ie(n){return Math.max(0,Math.min(10,Math.round(Math.min(n.length/200,1)*10)))}function N(n,e,r,t,i=R,o,s){let a=[];for(let[c,u]of Object.entries(i)){let l=0,d=[],m=n.filter(h=>u.domains.includes(h)).length,y=m>0?m/n.length*.4:0;if(l+=y*t.similarity,y>0&&d.push(`Domain match: ${(y*100).toFixed(0)}%`),e&&e.length>0){let h=e.filter(v=>u.capabilities.some(P=>P.toLowerCase().includes(v.toLowerCase()))).length,p=h>0?h/e.length*.3:0;l+=p*t.capabilities,p>0&&d.push(`Capability match: ${(p*100).toFixed(0)}%`)}else l+=.15*t.capabilities;if(l+=u.performanceScore*.3*t.performance,d.push(`Performance score: ${(u.performanceScore*100).toFixed(0)}%`),o&&u.languages&&u.languages.length>0){let h=t.language??1,p=o.toLowerCase();if(u.languages.some(P=>P.toLowerCase()===p)){let P=.15*h;l+=P,d.push(`Language match: ${o}`)}}let b=r.get(c)||0;if(b>0){let h=Math.min(.1,b*.02);l+=h,d.push(`Pattern matches: ${b}`)}let S=l;if(s){let h=s(c),p=ye(S,h);l=p.score,p.qWeight>0&&d.push(`Q-bonus (w=${p.qWeight.toFixed(2)}, v=${p.qVisits})`),a.push({agent:c,score:l,reasoning:d,staticScore:S,qWeight:p.qWeight,qValue:p.qValue,qVisits:p.qVisits})}else a.push({agent:c,score:l,reasoning:d,staticScore:S})}return a.sort((c,u)=>u.score-c.score),a}var Q={"test-generation":["test-execution","coverage-analysis","requirements-validation"],"test-execution":["test-generation","coverage-analysis","quality-assessment"],"coverage-analysis":["test-generation","test-execution","quality-assessment"],"quality-assessment":["test-execution","coverage-analysis","defect-intelligence"],"defect-intelligence":["quality-assessment","code-intelligence"],"requirements-validation":["test-generation","quality-assessment"],"code-intelligence":["defect-intelligence","security-compliance"],"security-compliance":["code-intelligence","quality-assessment"],"contract-testing":["test-generation","test-execution"],"visual-accessibility":["quality-assessment"],"chaos-resilience":["test-execution","quality-assessment"],"learning-optimization":["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence"]};function ae(){try{return!J()||!Y()||X().isEmpty()?!1:K().isCritical()}catch{return!1}}me();function oe(n,e){if(n.length===e)return n;if(n.length>e){let r=n.length/e,t=new Array(e).fill(0);for(let i=0;i<e;i++){let o=Math.floor(i*r),s=Math.floor((i+1)*r),a=0;for(let c=o;c<s;c++)a+=n[c];t[i]=a/(s-o)}return M(t)}else{let r=new Array(e).fill(0),t=(n.length-1)/(e-1);for(let i=0;i<e;i++){let o=i*t,s=Math.floor(o),a=Math.min(s+1,n.length-1),c=o-s;r[i]=n[s]*(1-c)+n[a]*c}return M(r)}}function se(n,e){let r=new Array(e).fill(0),t=n.toLowerCase().trim();for(let i=0;i<3;i++)for(let o=0;o<t.length;o++){let s=t.charCodeAt(o),a=s*(o+1)*(i+1)%e;r[a]+=Math.sin(s*(i+1))/(o+1)}return M(r)}function M(n){let e=Math.sqrt(n.reduce((r,t)=>r+t*t,0));if(e>0)for(let r=0;r<n.length;r++)n[r]/=e;return n}B();V();de();var E=T.create("PatternPromotion");async function ce(n,e){let r=j(n);if(!r.meetsUsageCriteria||!r.meetsQualityCriteria)return!1;if(e.coherenceService&&e.coherenceService.isInitialized()){let t=await e.searchPatterns("",{tier:"long-term",limit:1e3}),s=[...t.success?t.value.map(c=>c.pattern):[],n].map(c=>({id:c.id,embedding:c.embedding||[],weight:c.confidence,metadata:{name:c.name,domain:c.qeDomain}})),a=await e.coherenceService.checkCoherence(s);if(a.energy>=e.coherenceThreshold){let c={patternId:n.id,patternName:n.name,reason:"coherence_violation",energy:a.energy,existingPatternConflicts:a.contradictions?.map(u=>u.nodeIds).flat()};return e.eventBus&&await e.eventBus.publish({id:`pattern-promotion-blocked-${n.id}`,type:"pattern:promotion_blocked",timestamp:new Date,source:"learning-optimization",payload:c}),E.info("Pattern promotion blocked due to coherence violation",{name:n.name,energy:a.energy}),!1}}return!0}async function le(n,e){let r=await e.patternStore.promote(n);if(r.success){try{e.getSqliteStore().promotePattern(n)}catch(t){E.warn("SQLite pattern promotion persist failed",{error:f(t)})}if(W().useSublinearSolver)try{let t=e.getSqliteStore().getDatabase?.();if(t){let i=new O(t),o=await e.getPattern(n);if(o){let s=await e.searchPatterns("",{domain:o.qeDomain,tier:"long-term",limit:20});if(s.success)for(let{pattern:a}of s.value)a.id!==n&&i.recordCoOccurrence(n,a.id)}}}catch(t){E.warn("Citation graph update failed (non-fatal)",{error:f(t)})}if(e.rvfDualWriter)try{let t=await e.getPattern(n);t?.embedding&&t.embedding.length>0&&e.rvfDualWriter.writePattern(n,t.embedding)}catch(t){E.warn("RVF dual-write on promote failed (non-fatal)",{patternId:n,error:f(t)})}w().then(t=>t.append("PATTERN_PROMOTE",{patternId:n},"reasoning-bank")).catch(t=>{E.warn("Witness chain PATTERN_PROMOTE failed",{error:f(t)})}),E.info("Promoted pattern to long-term",{patternId:n}),e.eventBus&&await e.eventBus.publish({id:`pattern-promoted-${n}`,type:"pattern:promoted",timestamp:new Date,source:"learning-optimization",payload:{patternId:n,newTier:"long-term"}})}else E.error("Failed to promote pattern",r.error,{patternId:n})}async function ue(n){let{signal:e}=n;e?.throwIfAborted();let r=await n.patternStore.getStats(),t=0,i=0;for(let[o,s]of Object.entries(Q)){e?.throwIfAborted();let a=o,c=r.byDomain[a]||0;if(c===0)continue;let u=await n.searchPatterns("",{domain:a,limit:50});if(u.success)for(let l of s){if(e?.throwIfAborted(),(r.byDomain[l]||0)>=c){i++;continue}for(let{pattern:m}of u.value){e?.throwIfAborted();let y=await n.searchPatterns(m.name,{domain:l,limit:1});if(y.success&&y.value.length>0&&y.value[0].score>.8){i++;continue}let b=Math.max(.3,(m.confidence||.5)*.8);(await n.storePattern({patternType:m.patternType,qeDomain:l,name:`${m.name} (from ${a})`,description:`${m.description} [Transferred from ${a} domain]`,template:m.template,context:{...m.context,relatedDomains:[a,l],tags:[...m.context.tags,"cross-domain-transfer",`source:${a}`]},confidence:b})).success?t++:i++}}}return E.info("Cross-domain transfer complete",{transferred:t,skipped:i}),{transferred:t,skipped:i}}var be=`
|
|
282
282
|
CREATE TABLE IF NOT EXISTS pattern_citations (
|
|
283
283
|
source_pattern_id TEXT NOT NULL,
|
|
284
284
|
target_pattern_id TEXT NOT NULL,
|
|
@@ -311,10 +311,10 @@ On promotion:
|
|
|
311
311
|
`).all(),c=this.db.prepare(`
|
|
312
312
|
INSERT OR IGNORE INTO pattern_citations (source_pattern_id, target_pattern_id, weight, relationship)
|
|
313
313
|
VALUES (?, ?, 2.0, 'derivation')
|
|
314
|
-
`);for(let u of a)c.run(u.source_pattern_id,u.target_pattern_id).changes>0&&e++;return e}getEdgeCount(){return this.ensureSchema(),this.db.prepare("SELECT COUNT(*) as cnt FROM pattern_citations").get().cnt}};var g=T.create("QEReasoningBank"),F=class{constructor(e,r,t={},i){this.memory=e;this.eventBus=r;this.coherenceService=i;this.config={...I,...t},t.rvfDualWriter&&(this.rvfDualWriter=t.rvfDualWriter),this.patternStore=H(e,{embeddingDimension:this.config.embeddingDimension,...t.patternStore})}memory;eventBus;coherenceService;config;patternStore;initialized=!1;sqliteStore=null;rvfDualWriter=null;getSqliteStore(){return this.sqliteStore||(this.sqliteStore=$(),this.sqliteStore.initialize().catch(e=>{g.warn("SQLitePatternStore init failed",{error:f(e)})})),this.sqliteStore}setRvfDualWriter(e){this.rvfDualWriter=e}stats={routingRequests:0,totalRoutingConfidence:0,learningOutcomes:0,successfulOutcomes:0};async initialize(e){if(this.initialized)return;let r=e?.signal;r?.throwIfAborted(),await this.patternStore.initialize(),r?.throwIfAborted();try{let t=this.getSqliteStore();await t.initialize(),this.patternStore.setSqliteStore?.(t)}catch(t){g.warn("Failed to wire SQLitePatternStore into PatternStore",{error:f(t)})}r?.throwIfAborted(),await this.loadPretrainedPatterns(r),r?.throwIfAborted(),this.initialized=!0;try{let t="reasoning-bank:cross-domain-seeded";if(!await this.memory.get(t))await this.memory.set(t,!0),await this.seedCrossDomainPatterns(r);else{let o=await this.patternStore.getStats();g.info("Cross-domain transfer already complete",{totalPatterns:o.totalPatterns})}}catch(t){if(r?.aborted)throw t;g.warn("Cross-domain seeding failed (non-fatal)",{error:t})}g.info("Initialized")}async loadPretrainedPatterns(e){e?.throwIfAborted();let r=await this.patternStore.getStats();if(r.totalPatterns>0){g.info("Found existing patterns",{totalPatterns:r.totalPatterns});let t=this.patternStore.getAdapter?.();if(t&&(t.status()?.totalVectors??0)===0)try{let
|
|
314
|
+
`);for(let u of a)c.run(u.source_pattern_id,u.target_pattern_id).changes>0&&e++;return e}getEdgeCount(){return this.ensureSchema(),this.db.prepare("SELECT COUNT(*) as cnt FROM pattern_citations").get().cnt}};var g=T.create("QEReasoningBank"),F=class{constructor(e,r,t={},i){this.memory=e;this.eventBus=r;this.coherenceService=i;this.config={...I,...t},t.rvfDualWriter&&(this.rvfDualWriter=t.rvfDualWriter),this.patternStore=H(e,{embeddingDimension:this.config.embeddingDimension,...t.patternStore})}memory;eventBus;coherenceService;config;patternStore;initialized=!1;sqliteStore=null;rvfDualWriter=null;getSqliteStore(){return this.sqliteStore||(this.sqliteStore=$(),this.sqliteStore.initialize().catch(e=>{g.warn("SQLitePatternStore init failed",{error:f(e)})})),this.sqliteStore}setRvfDualWriter(e){this.rvfDualWriter=e}stats={routingRequests:0,totalRoutingConfidence:0,learningOutcomes:0,successfulOutcomes:0};async initialize(e){if(this.initialized)return;let r=e?.signal;r?.throwIfAborted(),await this.patternStore.initialize(),r?.throwIfAborted();try{let t=this.getSqliteStore();await t.initialize(),this.patternStore.setSqliteStore?.(t)}catch(t){g.warn("Failed to wire SQLitePatternStore into PatternStore",{error:f(t)})}r?.throwIfAborted(),await this.loadPretrainedPatterns(r),r?.throwIfAborted(),this.initialized=!0;try{let t="reasoning-bank:cross-domain-seeded";if(!await this.memory.get(t))await this.memory.set(t,!0),await this.seedCrossDomainPatterns(r);else{let o=await this.patternStore.getStats();g.info("Cross-domain transfer already complete",{totalPatterns:o.totalPatterns})}}catch(t){if(r?.aborted)throw t;g.warn("Cross-domain seeding failed (non-fatal)",{error:t})}g.info("Initialized")}async loadPretrainedPatterns(e){e?.throwIfAborted();let r=await this.patternStore.getStats();if(r.totalPatterns>0){g.info("Found existing patterns",{totalPatterns:r.totalPatterns});let t=this.patternStore.getAdapter?.();if(t&&(t.status()?.totalVectors??0)===0)try{let i=(()=>{let a=process.env.AQE_RVF_BACKFILL_LIMIT,c=a?Number(a):NaN;return Number.isFinite(c)&&c>0?Math.floor(c):1e3})(),s=this.getSqliteStore().getRecentEmbeddings(i).filter(({embedding:a})=>a&&a.length>0).map(({patternId:a,embedding:c})=>({id:a,vector:c instanceof Float32Array?c:new Float32Array(c)}));if(s.length>0){let{accepted:a,rejected:c}=t.ingest(s);g.info("Backfilled RVF from SQLite",{requested:s.length,accepted:a,cap:i,truncated:s.length>=i}),c>0&&g.warn("RVF backfill partially rejected",{accepted:a,rejected:c})}}catch(i){g.warn("RVF backfill failed (non-fatal)",{error:f(i)})}return}for(let t of A){e?.throwIfAborted();try{await this.storePattern(t)}catch(i){if(e?.aborted)throw i;g.warn("Failed to load pattern",{name:t.name,error:i})}}g.info("Loaded foundational patterns",{count:A.length})}async seedCrossDomainPatterns(e){return this.initialized||await this.initialize({signal:e}),ue({searchPatterns:this.searchPatterns.bind(this),storePattern:this.storePattern.bind(this),patternStore:this.patternStore,signal:e})}async storePattern(e){if(this.initialized||await this.initialize(),!this.config.enableLearning)return x(new Error("Pattern learning is disabled"));if(!e.embedding){let t=await this.embed(`${e.name} ${e.description} ${e.context?.tags?.join(" ")||""}`);e={...e,embedding:t}}let r=await this.patternStore.create(e);if(r.success&&(w().then(t=>t.append("PATTERN_CREATE",{patternId:r.value.id,domain:r.value.qeDomain,confidence:r.value.confidence,name:r.value.name},"reasoning-bank")).catch(t=>{g.warn("Witness chain PATTERN_CREATE failed",{error:f(t)})}),this.rvfDualWriter&&r.value.embedding&&r.value.embedding.length>0))try{this.rvfDualWriter.writePattern(r.value.id,r.value.embedding)}catch(t){g.warn("RVF dual-write failed (non-fatal)",{patternId:r.value.id,error:f(t)})}return r}async searchPatterns(e,r){this.initialized||await this.initialize();let t=e,i=!0;return typeof e=="string"&&(e.trim()===""?(i=!1,t=""):t=await this.embed(e)),this.patternStore.search(t,{...r,useVectorSearch:i})}async getPattern(e){return this.initialized||await this.initialize(),this.patternStore.get(e)}async recordOutcome(e){if(this.initialized||await this.initialize(),!this.config.enableLearning)return q(void 0);let r=await this.patternStore.recordUsage(e.patternId,e.success);try{this.getSqliteStore().recordUsage(e.patternId,e.success,e.metrics,e.feedback)}catch(t){g.warn("SQLite pattern usage persist failed",{error:f(t)})}if(r.success){this.stats.learningOutcomes++,e.success&&this.stats.successfulOutcomes++,w().then(o=>o.append("PATTERN_UPDATE",{patternId:e.patternId,success:e.success},"reasoning-bank")).catch(o=>{g.warn("Witness chain PATTERN_UPDATE failed",{error:f(o)})});let t=await this.getPattern(e.patternId),i=this.getPromotionDeps();t&&await ce(t,i)&&(await le(e.patternId,i),g.info("Pattern promoted to long-term",{name:t.name}))}return r}getPromotionDeps(){return{patternStore:this.patternStore,coherenceService:this.coherenceService,eventBus:this.eventBus,coherenceThreshold:this.config.coherenceThreshold||.4,getSqliteStore:this.getSqliteStore.bind(this),rvfDualWriter:this.rvfDualWriter,searchPatterns:this.searchPatterns.bind(this),getPattern:this.getPattern.bind(this)}}async routeTask(e){if(this.initialized||await this.initialize(),!this.config.enableRouting)return x(new Error("Task routing is disabled"));this.stats.routingRequests++;try{let r=e.domain?[e.domain]:k(e.task);r.length===0&&r.push("test-generation");let t=await this.embed(e.task),i=await this.patternStore.search(t,{limit:this.config.maxRoutingCandidates,domain:r[0],useVectorSearch:!0}),o=i.success?i.value.map(p=>p.pattern):[],s=new Map;for(let[p,v]of Object.entries(R)){let P=o.filter(pe=>v.domains.includes(pe.qeDomain)).length;P>0&&s.set(p,P)}let a=ne({taskType:re(e.task),priority:"normal",domain:r[0],complexityBucket:ie(e.task)}),c=this.buildQValueLookup(a),u=N(r,e.capabilities,s,this.config.routingWeights,R,e.context?.language,c),l=1;try{let p=ae(),v=ee({envOverride:process.env.AQE_ROUTER_EXPLORATION_RATE,topologyCritical:p});l=v.safetyMultiplier,te(u,v.epsilon)}catch{}let d=u[0],m=u.slice(1,4),y=[];if(this.config.enableGuidance&&r.length>0){let p=D(r[0],{framework:e.context?.framework,language:e.context?.language,includeAntiPatterns:!0});y.push(...p.slice(0,5))}this.stats.totalRoutingConfidence+=d.score;let b=u.reduce((p,v)=>p+(v.qWeight??0),0),S=u.length>0?b/u.length:0,h={recommendedAgent:d.agent,confidence:d.score,alternatives:m.map(p=>({agent:p.agent,score:p.score})),domains:r,patterns:o,guidance:y,reasoning:d.reasoning.join("; "),exploration:d.exploration===!0,criticality:l,qWeight:S};return q(h)}catch(r){return x(L(r))}}buildQValueLookup(e){try{let r=z();if(!r.isInitialized())return()=>{};let t=r.getDatabase();if(!t.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='rl_q_values'").get())return()=>{};let o=t.prepare(`
|
|
315
315
|
SELECT q_value, visits FROM rl_q_values
|
|
316
316
|
WHERE algorithm = 'q-learning'
|
|
317
317
|
AND agent_id = 'aqe-hook-router'
|
|
318
318
|
AND state_key = ?
|
|
319
319
|
AND action_key = ?
|
|
320
|
-
`);return s=>{try{let a=o.get(e,s);return a?{qValue:a.q_value,visits:a.visits}:void 0}catch{return}}}catch{return()=>{}}}getGuidance(e,r){return C(e)}generateContext(e,r){return _(e,r||{})}checkAntiPatterns(e,r){return U(e,r)}async embed(e){if(this.config.useONNXEmbeddings)try{let{computeRealEmbedding:r}=await import("./real-embeddings-
|
|
320
|
+
`);return s=>{try{let a=o.get(e,s);return a?{qValue:a.q_value,visits:a.visits}:void 0}catch{return}}}catch{return()=>{}}}getGuidance(e,r){return C(e)}generateContext(e,r){return _(e,r||{})}checkAntiPatterns(e,r){return U(e,r)}async embed(e){if(this.config.useONNXEmbeddings)try{let{computeRealEmbedding:r}=await import("./real-embeddings-VQXMPAH6.js"),t=await r(e);return t.length!==this.config.embeddingDimension?oe(t,this.config.embeddingDimension):t}catch(r){process.env.DEBUG&&g.warn("ONNX embeddings unavailable, using hash fallback",{error:f(r)})}return se(e,this.config.embeddingDimension)}async getStats(){this.initialized||await this.initialize();let e=await this.patternStore.getStats(),r={};for(let a of G)r[a]=e.byDomain[a]||0;let t=this.stats.routingRequests,i=this.stats.routingRequests>0?this.stats.totalRoutingConfidence/this.stats.routingRequests:0,o=this.stats.learningOutcomes,s=this.stats.learningOutcomes>0?this.stats.successfulOutcomes/this.stats.learningOutcomes:0;if(t===0||o===0)try{let a=this.getSqliteStore().getAggregateOutcomeStats();t===0&&a.routingRequests>0&&(t=a.routingRequests,i=a.avgRoutingConfidence),o===0&&a.learningOutcomes>0&&(o=a.learningOutcomes,s=a.learningOutcomes>0?a.successfulOutcomes/a.learningOutcomes:a.avgPatternSuccessRate)}catch{}return{totalPatterns:e.totalPatterns,byDomain:r,routingRequests:t,avgRoutingConfidence:i,learningOutcomes:o,patternSuccessRate:s,patternStoreStats:e}}async dispose(){if(await this.patternStore.dispose(),this.sqliteStore&&(this.sqliteStore.close(),this.sqliteStore=null),this.rvfDualWriter){try{this.rvfDualWriter.close()}catch{}this.rvfDualWriter=null}this.initialized=!1}};function ft(n,e,r,t){return new F(n,e,r,t)}export{I as a,A as b,R as c,re as d,N as e,Q as f,F as g,ft as h};
|