agentic-qe 3.15.11 → 3.15.13
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/hooks/aqe-hook.cjs +38 -2
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +267 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/cli/bundle.js +6 -6
- package/dist/cli/chunks/adapter-KCQDVYY2.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-TIDSQ3ZK.js → agent-booster-wasm-6RRQWMNE.js} +2 -2
- package/dist/cli/chunks/{agent-handler-G3EPBVA7.js → agent-handler-AOH6TV7W.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-ARC5C7GW.js → agent-memory-branch-2P54SF5N.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-SAQOHSGN.js +2 -0
- package/dist/cli/chunks/{arena-K4I4QDXB.js → arena-NSVFCAF5.js} +2 -2
- package/dist/cli/chunks/{arena-36DTATJV.js → arena-X6MOGQHA.js} +4 -4
- package/dist/cli/chunks/{audit-WQSJSJZF.js → audit-27DJLQNM.js} +3 -3
- package/dist/cli/chunks/base-WCACU3FN.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-BB4K67MT.js → better-sqlite3-BU5GXILS.js} +2 -2
- package/dist/cli/chunks/{brain-handler-CU3GOIU3.js → brain-handler-GTQNHHZS.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-NJQX7ZNB.js → branch-enumerator-5CLULOCU.js} +2 -2
- package/dist/cli/chunks/{browser-6YJF4FQW.js → browser-R4DMU3LN.js} +2 -2
- package/dist/cli/chunks/browser-workflow-G6IASEAP.js +2 -0
- package/dist/cli/chunks/{chunk-G4FAPO57.js → chunk-2G7TVT6W.js} +2 -2
- package/dist/cli/chunks/{chunk-HDNWSKHA.js → chunk-32ZMWEP3.js} +2 -2
- package/dist/cli/chunks/{chunk-FWSGPE3V.js → chunk-3AN5TNGD.js} +3 -3
- package/dist/cli/chunks/{chunk-X4J73KP3.js → chunk-3LJ7LQMV.js} +1 -1
- package/dist/cli/chunks/{chunk-3RHOPP7A.js → chunk-3QZEGE67.js} +1 -1
- package/dist/cli/chunks/{chunk-RBZCA7SD.js → chunk-3RZV5DGO.js} +2 -2
- package/dist/cli/chunks/{chunk-DDEOZPWJ.js → chunk-3Y2ROSCL.js} +2 -2
- package/dist/cli/chunks/{chunk-LD5CFK53.js → chunk-3Y7TJFHU.js} +2 -2
- package/dist/cli/chunks/{chunk-I36CRDHF.js → chunk-3YNLWPBF.js} +2 -2
- package/dist/cli/chunks/{chunk-ZMC543GI.js → chunk-42J34YG4.js} +2 -2
- package/dist/cli/chunks/{chunk-YNOCQ2SL.js → chunk-4OVC4RIL.js} +1 -1
- package/dist/cli/chunks/{chunk-2KFFEKSI.js → chunk-526QYFJU.js} +2 -2
- package/dist/cli/chunks/{chunk-LBX7M4LW.js → chunk-5FKWCZNF.js} +2 -2
- package/dist/cli/chunks/{chunk-OH5V5EJW.js → chunk-5K26BEYB.js} +2 -2
- package/dist/cli/chunks/{chunk-TCYSBC7Y.js → chunk-5MDERQH3.js} +1 -1
- package/dist/cli/chunks/{chunk-V5AADCBC.js → chunk-5VMAV6T6.js} +1 -1
- package/dist/cli/chunks/{chunk-YBBT3YYG.js → chunk-5ZGM3RMH.js} +1 -1
- package/dist/cli/chunks/{chunk-RTY7VSZB.js → chunk-6KATY3KS.js} +2 -2
- package/dist/cli/chunks/{chunk-LPU6PAJE.js → chunk-6Z7PRBSG.js} +2 -2
- package/dist/cli/chunks/{chunk-6NA3KZZT.js → chunk-72ASBE35.js} +7 -7
- package/dist/cli/chunks/{chunk-GBFUANTC.js → chunk-756CGMEH.js} +1 -1
- package/dist/cli/chunks/{chunk-UTTSH4NH.js → chunk-75RDHBAX.js} +3 -3
- package/dist/cli/chunks/{chunk-XGPTZUKQ.js → chunk-7CMTY45A.js} +2 -2
- package/dist/cli/chunks/{chunk-NC6K7SCQ.js → chunk-7JUC2MVZ.js} +2 -2
- package/dist/cli/chunks/{chunk-RTFKTKSO.js → chunk-7NA7JXNB.js} +2 -2
- package/dist/cli/chunks/{chunk-GWJWSLDA.js → chunk-7PLIEBY7.js} +2 -2
- package/dist/cli/chunks/{chunk-OURITHFV.js → chunk-7YTGHGK4.js} +2 -2
- package/dist/cli/chunks/{chunk-ITL3IN2E.js → chunk-A64JFBWI.js} +2 -2
- package/dist/cli/chunks/{chunk-OHR7C777.js → chunk-AL6FBH3E.js} +2 -2
- package/dist/cli/chunks/{chunk-5N25I53C.js → chunk-AQSVJNEH.js} +2 -2
- package/dist/cli/chunks/{chunk-FL32MTKT.js → chunk-ARJW4I2O.js} +2 -2
- package/dist/cli/chunks/{chunk-ZQHDA4O7.js → chunk-ASQYASNV.js} +1 -1
- package/dist/cli/chunks/{chunk-4HJKQIX5.js → chunk-BEGR4D6N.js} +2 -2
- package/dist/cli/chunks/{chunk-G77MLBDF.js → chunk-BK577VL7.js} +2 -2
- package/dist/cli/chunks/{chunk-NPZOBSAN.js → chunk-BLSLEVDI.js} +2 -2
- package/dist/cli/chunks/{chunk-R5LGV6GZ.js → chunk-BTVEYBW2.js} +2 -2
- package/dist/cli/chunks/{chunk-2CW7VRPH.js → chunk-C6JTLKG7.js} +5 -5
- package/dist/cli/chunks/{chunk-EWPUQCN4.js → chunk-C7JM7CD3.js} +2 -2
- package/dist/cli/chunks/{chunk-325QCVDI.js → chunk-CCMKSHAT.js} +2 -2
- package/dist/cli/chunks/{chunk-V7DA4HAK.js → chunk-CE7B5LU7.js} +1 -1
- package/dist/cli/chunks/{chunk-4RAQ7PJA.js → chunk-CM4LSLKR.js} +2 -2
- package/dist/cli/chunks/chunk-CRWPZT74.js +62 -0
- package/dist/cli/chunks/{chunk-U3LJNNVJ.js → chunk-CT6SAVXQ.js} +2 -2
- package/dist/cli/chunks/chunk-CV77DMDQ.js +2 -0
- package/dist/cli/chunks/{chunk-UMVSWQNB.js → chunk-DFUASIKA.js} +2 -2
- package/dist/cli/chunks/{chunk-KSE5TDM5.js → chunk-DLD7RUZ4.js} +2 -2
- package/dist/cli/chunks/{chunk-4MUBW4RT.js → chunk-DNDL7SOS.js} +2 -2
- package/dist/cli/chunks/{chunk-EJPK7OTR.js → chunk-DVGRPK7A.js} +2 -2
- package/dist/cli/chunks/{chunk-WCVCOT4E.js → chunk-E56B6IDX.js} +2 -2
- package/dist/cli/chunks/{chunk-7HEMJHPP.js → chunk-E7CLYGS7.js} +1 -1
- package/dist/cli/chunks/{chunk-R5GRABPQ.js → chunk-EXGMJFAT.js} +1 -1
- package/dist/cli/chunks/chunk-F3YS57NF.js +21 -0
- package/dist/cli/chunks/{chunk-I4K2HTQU.js → chunk-FZ76G4QJ.js} +1 -1
- package/dist/cli/chunks/{chunk-4UX35V7P.js → chunk-G2Q66Z23.js} +2 -2
- package/dist/cli/chunks/{chunk-KJCIMNHS.js → chunk-G6WDYBLQ.js} +1 -1
- package/dist/cli/chunks/{chunk-VWUZSNVC.js → chunk-G77ERMUD.js} +1 -1
- package/dist/cli/chunks/{chunk-FZHSG75I.js → chunk-GB6HBNH2.js} +2 -2
- package/dist/cli/chunks/{chunk-KDI5JOYZ.js → chunk-GHM6MQNK.js} +2 -2
- package/dist/cli/chunks/{chunk-H7BLYMNU.js → chunk-GHY6Z6KO.js} +5 -5
- package/dist/cli/chunks/{chunk-TFW7CCKS.js → chunk-GII6UM3F.js} +1 -1
- package/dist/cli/chunks/{chunk-DOBZPSKE.js → chunk-GU5HNCWI.js} +1 -1
- package/dist/cli/chunks/{chunk-AFFN6E6Q.js → chunk-H4GG2NLO.js} +2 -2
- package/dist/cli/chunks/{chunk-7R5HC56U.js → chunk-H4H2YSFH.js} +1 -1
- package/dist/cli/chunks/{chunk-J4JMCZVA.js → chunk-HD7YIFOI.js} +2 -2
- package/dist/cli/chunks/{chunk-5MTWCCZJ.js → chunk-HOAJUIBQ.js} +2 -2
- package/dist/cli/chunks/{chunk-T5KHJ3J7.js → chunk-HQZGPJYG.js} +2 -2
- package/dist/cli/chunks/{chunk-VEEYL2CZ.js → chunk-HZ5NXFXH.js} +2 -2
- package/dist/cli/chunks/{chunk-LQ4NUC6Q.js → chunk-I3C7JOXC.js} +2 -2
- package/dist/cli/chunks/{chunk-Z2EA7A4Z.js → chunk-IC3TQEOA.js} +1 -1
- package/dist/cli/chunks/{chunk-E44NNCEU.js → chunk-IJUHSJ2U.js} +2 -2
- package/dist/cli/chunks/{chunk-EH2S6AOR.js → chunk-J2ZIFFM6.js} +2 -2
- package/dist/cli/chunks/{chunk-GVKVJJQX.js → chunk-JGZ722G3.js} +2 -2
- package/dist/cli/chunks/{chunk-EK5GMOSO.js → chunk-JQGMW45H.js} +1 -1
- package/dist/cli/chunks/{chunk-XGBU3KEM.js → chunk-JRRXCODW.js} +2 -2
- package/dist/cli/chunks/{chunk-5WYZHDIZ.js → chunk-K3TLLJMX.js} +1 -1
- package/dist/cli/chunks/{chunk-LXQ3B4RY.js → chunk-K4CZA77U.js} +2 -2
- package/dist/cli/chunks/chunk-K65CGKLD.js +8 -0
- package/dist/cli/chunks/{chunk-HFFPYC4G.js → chunk-KADFXPPN.js} +2 -2
- package/dist/cli/chunks/{chunk-APPZATXA.js → chunk-KB56CPU4.js} +2 -2
- package/dist/cli/chunks/{chunk-25P77WA5.js → chunk-KCW47QR5.js} +1 -1
- package/dist/cli/chunks/{chunk-WM3SRRA6.js → chunk-KDNJ4F3P.js} +2 -2
- package/dist/cli/chunks/{chunk-5ERFHEEE.js → chunk-KDVZND5Q.js} +1 -1
- package/dist/cli/chunks/{chunk-YOCULVHR.js → chunk-KUAKV3IW.js} +1 -1
- package/dist/cli/chunks/{chunk-M5XYIQYZ.js → chunk-KV4T4MXK.js} +2 -2
- package/dist/cli/chunks/{chunk-MIK4RBEH.js → chunk-KWYH3FI4.js} +1 -1
- package/dist/cli/chunks/{chunk-UKKYMW3S.js → chunk-LFJALJOA.js} +2 -2
- package/dist/cli/chunks/{chunk-K7V2WZNF.js → chunk-LL7LDPXS.js} +1 -1
- package/dist/cli/chunks/{chunk-55CH76ZO.js → chunk-LUZNKJE6.js} +3 -3
- package/dist/cli/chunks/{chunk-OV5RPLKV.js → chunk-LWR3FV3Y.js} +2 -2
- package/dist/cli/chunks/{chunk-SMVVAVN2.js → chunk-LZYQHVD4.js} +2 -2
- package/dist/cli/chunks/{chunk-672XOJDG.js → chunk-M6AAGIG7.js} +1 -1
- package/dist/cli/chunks/{chunk-WCAVIJ64.js → chunk-MAMQA43L.js} +1 -1
- package/dist/cli/chunks/chunk-MB46UBGY.js +3 -0
- package/dist/cli/chunks/{chunk-AP3ADWDK.js → chunk-MFW5HSG4.js} +2 -2
- package/dist/cli/chunks/{chunk-NKTWKYHB.js → chunk-MGZ5FJUW.js} +2 -2
- package/dist/cli/chunks/{chunk-ERN43HOX.js → chunk-MVVB7C2E.js} +410 -410
- package/dist/cli/chunks/{chunk-57LNKSW7.js → chunk-N4CYAKOX.js} +2 -2
- package/dist/cli/chunks/chunk-NT4DBXSX.js +2 -0
- package/dist/cli/chunks/{chunk-BZPE3LDO.js → chunk-NU3W5WFT.js} +2 -2
- package/dist/cli/chunks/chunk-NURIILUB.js +2 -0
- package/dist/cli/chunks/{chunk-ITPGWGQS.js → chunk-NW7IBHJA.js} +4 -4
- package/dist/cli/chunks/{chunk-OD5D4LSZ.js → chunk-NZ3GUMB2.js} +2 -2
- package/dist/cli/chunks/{chunk-35M2X3C5.js → chunk-NZD4DPSU.js} +2 -2
- package/dist/cli/chunks/{chunk-EIDJNT5C.js → chunk-O6FGXMHD.js} +1 -1
- package/dist/cli/chunks/{chunk-OYJC3YON.js → chunk-OCAEXYFA.js} +2 -2
- package/dist/cli/chunks/{chunk-Y7B5EUIJ.js → chunk-OFACHK5O.js} +2 -2
- package/dist/cli/chunks/{chunk-5MNASJOH.js → chunk-P7A4NKTZ.js} +2 -2
- package/dist/cli/chunks/{chunk-M7XFBSIK.js → chunk-PB6J6HAA.js} +2 -2
- package/dist/cli/chunks/{chunk-5HQP4SLM.js → chunk-PHP5UBT4.js} +2 -2
- package/dist/cli/chunks/{chunk-KXS3Y2AX.js → chunk-PIDQVU3L.js} +2 -2
- package/dist/cli/chunks/{chunk-4UBVAJFO.js → chunk-PSFSPGUD.js} +2 -2
- package/dist/cli/chunks/chunk-PT4FMJPQ.js +3 -0
- package/dist/cli/chunks/{chunk-HDJUYAZG.js → chunk-Q3UDLV5Z.js} +1 -1
- package/dist/cli/chunks/{chunk-CIAL4YRY.js → chunk-QDEJ4CI2.js} +2 -2
- package/dist/cli/chunks/{chunk-S6IYEBAI.js → chunk-QPNG5ZN2.js} +2 -2
- package/dist/cli/chunks/{chunk-YPX2TV3M.js → chunk-R7SYRCRP.js} +1 -1
- package/dist/cli/chunks/{chunk-XNLIWQYE.js → chunk-RF7HWBHN.js} +2 -2
- package/dist/cli/chunks/{chunk-5YLOLACR.js → chunk-RFNW2LGD.js} +2 -2
- package/dist/cli/chunks/{chunk-2VLYUF7U.js → chunk-S5AZCIZS.js} +2 -2
- package/dist/cli/chunks/{chunk-ETVAYGCB.js → chunk-SE4VNN4I.js} +3 -3
- package/dist/cli/chunks/{chunk-E6PF35JZ.js → chunk-SG3NX7QE.js} +2 -2
- package/dist/cli/chunks/{chunk-VYTILW4R.js → chunk-SSU73QAX.js} +2 -2
- package/dist/cli/chunks/{chunk-ZP75ASUU.js → chunk-SVLQRAMF.js} +1 -1
- package/dist/cli/chunks/{chunk-JGJXXAS6.js → chunk-SYV2V3PL.js} +4 -4
- package/dist/cli/chunks/{chunk-4RH5I24Q.js → chunk-T3PGQFDI.js} +2 -2
- package/dist/cli/chunks/{chunk-O4JAKWWM.js → chunk-TCBBNUBP.js} +17 -17
- package/dist/cli/chunks/{chunk-QDESWOZP.js → chunk-TOQWL2ZF.js} +2 -2
- package/dist/cli/chunks/{chunk-NTB342NJ.js → chunk-TSQC2KKZ.js} +4 -4
- package/dist/cli/chunks/{chunk-NQZNMCZU.js → chunk-TWDW32W2.js} +2 -2
- package/dist/cli/chunks/{chunk-CO3DX2AX.js → chunk-TWJTK4CC.js} +2 -2
- package/dist/cli/chunks/{chunk-FUYOOKTH.js → chunk-U2FUXDDJ.js} +3 -3
- package/dist/cli/chunks/{chunk-XDI5X3FR.js → chunk-UDQSYWVF.js} +1 -1
- package/dist/cli/chunks/chunk-UOC3O6RP.js +5 -0
- package/dist/cli/chunks/chunk-UT2VZ33P.js +2 -0
- package/dist/cli/chunks/{chunk-IOZRKXR5.js → chunk-UTRV7T2N.js} +2 -2
- package/dist/cli/chunks/{chunk-ZMHCMJ4J.js → chunk-UXZSUMEA.js} +2 -2
- package/dist/cli/chunks/{chunk-G4CKPWF6.js → chunk-VRHRBAEM.js} +1 -1
- package/dist/cli/chunks/{chunk-AUUJBXWX.js → chunk-VRVMIPTM.js} +2 -2
- package/dist/cli/chunks/{chunk-IENZSO3K.js → chunk-VTDFVFST.js} +2 -2
- package/dist/cli/chunks/{chunk-JFLU7L3W.js → chunk-VTOBUZL6.js} +2 -2
- package/dist/cli/chunks/{chunk-KKYO2NKV.js → chunk-VU5TBX2V.js} +2 -2
- package/dist/cli/chunks/{chunk-XS2XF3YG.js → chunk-W26B7ERY.js} +1 -1
- package/dist/cli/chunks/{chunk-DOFREOPQ.js → chunk-W2QWSQVE.js} +2 -2
- package/dist/cli/chunks/{chunk-KSLLHFVY.js → chunk-W3INMZZ6.js} +1 -1
- package/dist/cli/chunks/{chunk-FLU5FDSC.js → chunk-W3PPFHI5.js} +59 -59
- package/dist/cli/chunks/chunk-WKGTGOYS.js +13 -0
- package/dist/cli/chunks/{chunk-4X4MWMHB.js → chunk-WNQS4WTS.js} +2 -2
- package/dist/cli/chunks/{chunk-XJKZ7FTR.js → chunk-WO274FRI.js} +2 -2
- package/dist/cli/chunks/{chunk-76SNL7GU.js → chunk-WOCGL4QP.js} +2 -2
- package/dist/cli/chunks/{chunk-HYXUN7BW.js → chunk-WQL7WCIZ.js} +1 -1
- package/dist/cli/chunks/{chunk-BTVWA35P.js → chunk-X2Z7F4EU.js} +2 -2
- package/dist/cli/chunks/{chunk-VBK2YAYY.js → chunk-X7N2JF2X.js} +2 -2
- package/dist/cli/chunks/{chunk-NT7JRHMH.js → chunk-XEAEYC6Y.js} +1 -1
- package/dist/cli/chunks/{chunk-G2IJFNZS.js → chunk-XNBOGCF3.js} +2 -2
- package/dist/cli/chunks/{chunk-LCVEEII4.js → chunk-XPRVF4YE.js} +2 -2
- package/dist/cli/chunks/{chunk-AMZKAJLJ.js → chunk-YBQH2VOP.js} +2 -2
- package/dist/cli/chunks/{chunk-JUMICXM6.js → chunk-YQFLQE53.js} +2 -2
- package/dist/cli/chunks/{chunk-M5RQ6U3G.js → chunk-YSZ5OE3Z.js} +2 -2
- package/dist/cli/chunks/{chunk-RQMCZQN2.js → chunk-YXRASAPI.js} +2 -2
- package/dist/cli/chunks/{chunk-X3PZCXWG.js → chunk-YZEXYO4W.js} +1 -1
- package/dist/cli/chunks/{chunk-TL6OFMXF.js → chunk-YZWBNBTW.js} +2 -2
- package/dist/cli/chunks/{chunk-CFWGGRE7.js → chunk-ZAKQLAHT.js} +1 -1
- package/dist/cli/chunks/ci-ENOASTYB.js +81 -0
- package/dist/cli/chunks/{ci-config-J665XNOX.js → ci-config-B26OXHQM.js} +2 -2
- package/dist/cli/chunks/{ci-output-PEQQQWVD.js → ci-output-JTCLLNOQ.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-HHB2JSKH.js → circuit-breaker-23JMFNM5.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-JKUJRWPN.js → claude-flow-setup-ON6L462G.js} +2 -2
- package/dist/cli/chunks/client-TV3V2YZ5.js +2 -0
- package/dist/cli/chunks/{cline-installer-Y77BWTAN.js → cline-installer-OWQ4D2FQ.js} +2 -2
- package/dist/cli/chunks/{code-LV2HAGJY.js → code-2ZRL7SEU.js} +19 -18
- package/dist/cli/chunks/{code-index-extractor-4GKKSETB.js → code-index-extractor-JXSQVM67.js} +2 -2
- package/dist/cli/chunks/{codex-installer-WMKBYE5Y.js → codex-installer-7LXZYBSQ.js} +2 -2
- package/dist/cli/chunks/{completions-SBGFAOIJ.js → completions-C2LR623C.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-AQHFIJXC.js → complexity-analyzer-TGQLHCYJ.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-26AYFS2E.js → continuedev-installer-RUGD24D2.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-4UD3DK55.js → copilot-installer-ZLFVLEJP.js} +2 -2
- package/dist/cli/chunks/core-handlers-PZT4OLWR.js +2 -0
- package/dist/cli/chunks/{cost-tracker-TP4NZCG4.js → cost-tracker-RT4QL745.js} +2 -2
- package/dist/cli/chunks/{coverage-B2KIXHAI.js → coverage-NV3C4IMM.js} +11 -10
- package/dist/cli/chunks/cross-domain-router-QOFCZ7G4.js +2 -0
- package/dist/cli/chunks/{cursor-installer-AVZEQZ4W.js → cursor-installer-LJKLNFF6.js} +2 -2
- package/dist/cli/chunks/{daemon-XM2A7LQU.js → daemon-BMDXCQT5.js} +3 -3
- package/dist/cli/chunks/{daemon-P574WWBW.js → daemon-FBH3IRYN.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-MIWOZ6ET.js → dag-attention-scheduler-JGDED55I.js} +2 -2
- package/dist/cli/chunks/{detect-TYR7HT23.js → detect-SZIHIVCJ.js} +2 -2
- package/dist/cli/chunks/{dist-node-2DGVQGLS.js → dist-node-FV3KWXQ6.js} +2 -2
- package/dist/cli/chunks/{domain-handler-RRA4ZOMF.js → domain-handler-GI5JWQOV.js} +2 -2
- package/dist/cli/chunks/{domain-plugins-IVZEZ5RB.js → domain-plugins-BUWY36TL.js} +2 -2
- package/dist/cli/chunks/domain-transfer-GCY7W5DA.js +2 -0
- package/dist/cli/chunks/dream-TRFBGDSQ.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-VNIEOVPO.js → embed-and-insert-pattern-GPRR3ZGD.js} +2 -2
- package/dist/cli/chunks/{eval-QV4LVPUF.js → eval-XPB3IGAP.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-DAPKT763.js → experience-capture-middleware-2E554UB3.js} +3 -3
- package/dist/cli/chunks/{fast-paths-WVRFPHX7.js → fast-paths-ZSMWZPUC.js} +2 -2
- package/dist/cli/chunks/{feature-flags-DEFTUIYT.js → feature-flags-GIWVDVVC.js} +2 -2
- package/dist/cli/chunks/{feature-flags-O7ZXDDCD.js → feature-flags-N7EOGE5P.js} +2 -2
- package/dist/cli/chunks/file-discovery-WCKGMSPZ.js +2 -0
- package/dist/cli/chunks/fleet-HCHDOUCX.js +44 -0
- package/dist/cli/chunks/{gnn-wrapper-LS4LZJDR.js → gnn-wrapper-CZNCNXXZ.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-RFTERD4K.js → heartbeat-handler-6YUIF2YQ.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-P44A2OX3.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-ZJQIQJKC.js +2 -0
- package/dist/cli/chunks/hnsw-index-HMG2GH3Z.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-GPKGFFHY.js → hnsw-legacy-bridge-J3M3IK24.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-PHL3F2PR.js → hnswlib-node-ULGTGDZW.js} +2 -2
- package/dist/cli/chunks/{hooks-GYJ6D4QM.js → hooks-C4BUGYUQ.js} +28 -28
- package/dist/cli/chunks/hybrid-backend-B7M74PZG.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-YGEQPCKJ.js → hypergraph-engine-WINGVMPG.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-ZIMM647V.js → hypergraph-handler-GADMWKAU.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-PZYOVKQO.js +2 -0
- package/dist/cli/chunks/{init-guard-VOMBXJXG.js → init-guard-K2T4QWAO.js} +2 -2
- package/dist/cli/chunks/{init-handler-PSMUBWK5.js → init-handler-PCZTDZYI.js} +6 -6
- package/dist/cli/chunks/init-wizard-TZDJQK3U.js +2 -0
- package/dist/cli/chunks/kernel-Y6RRIOKW.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-2YNTFBWJ.js → kilocode-installer-XENXNEIU.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-XHJDPVAZ.js → kiro-installer-3PG2TJ67.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-BVD5Z66M.js +2 -0
- package/dist/cli/chunks/{learning-GNSIDRNG.js → learning-6KDH7FK4.js} +3 -3
- package/dist/cli/chunks/{llm-router-LQDM7IU2.js → llm-router-RKVDEWU2.js} +4 -4
- package/dist/cli/chunks/llm-router-service-KHCAMSUU.js +2 -0
- package/dist/cli/chunks/{load-YATHI72E.js → load-ITHC564X.js} +2 -2
- package/dist/cli/chunks/load-test-RUF7DZA5.js +2 -0
- package/dist/cli/chunks/{mcp-4Y6GDLYK.js → mcp-TCL5UW3N.js} +2 -2
- package/dist/cli/chunks/{memory-OUW3L7H2.js → memory-BKDAY2N2.js} +5 -5
- package/dist/cli/chunks/memory-backend-7ZLFOVGG.js +2 -0
- package/dist/cli/chunks/{memory-handlers-G3LFF53U.js → memory-handlers-WN4FXFOA.js} +2 -2
- package/dist/cli/chunks/{multi-model-executor-UBZJXAD2.js → multi-model-executor-VHAT7ZPF.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-AMMNWVH5.js → opencode-installer-E3VM3EEY.js} +2 -2
- package/dist/cli/chunks/{orchestrator-Y44WDOER.js → orchestrator-BMQ6X762.js} +58 -20
- package/dist/cli/chunks/pattern-null-store-RY6CVYHP.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-ESR42RME.js → pattern-usage-recorder-GOOR2BV5.js} +2 -2
- package/dist/cli/chunks/{pipeline-EDTS6OSC.js → pipeline-5NSFQQIX.js} +2 -2
- package/dist/cli/chunks/{platform-5WONJSUX.js → platform-SQM34J5G.js} +2 -2
- package/dist/cli/chunks/{plugin-IJXPCLD4.js → plugin-UQJZRMZG.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-5ECKGZK6.js → prime-radiant-advanced-wasm-WMDJOL4S.js} +2 -2
- package/dist/cli/chunks/project-root-IO5KRNGL.js +2 -0
- package/dist/cli/chunks/protocol-executor-U2CUDWDE.js +2 -0
- package/dist/cli/chunks/{protocol-handler-DRD3GVNW.js → protocol-handler-OBDCVY6X.js} +2 -2
- package/dist/cli/chunks/{prove-KTGW2HMJ.js → prove-XDC7I4XT.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-DQSSX2IP.js +2 -0
- package/dist/cli/chunks/{quality-DV2WPRRS.js → quality-L4GQ6WX4.js} +2 -2
- package/dist/cli/chunks/{quality-gate-HFUAFVZC.js → quality-gate-MJG66LKN.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-6FN4BZIX.js +2 -0
- package/dist/cli/chunks/real-embeddings-HW4G2LWL.js +2 -0
- package/dist/cli/chunks/{ref-validation-QWSKS5OY.js → ref-validation-FC7JOJ2C.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-RBAYRCHX.js → roocode-installer-KWS4CEIC.js} +2 -2
- package/dist/cli/chunks/router-YUO3I7RU.js +2 -0
- package/dist/cli/chunks/routing-feedback-36SLQGJE.js +2 -0
- package/dist/cli/chunks/{routing-handler-FMPP3XKO.js → routing-handler-QF4WVB2S.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-KZZT4HWF.js → ruvector-commands-2MTCOUK6.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-FRYZH3WZ.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-XXNITL5I.js +2 -0
- package/dist/cli/chunks/{rvf-migration-coordinator-7CHEV35N.js → rvf-migration-coordinator-BREJCXWN.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-D2WWKJIV.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-Q2TH52SN.js → rvf-store-integrity-KKC6HOJD.js} +2 -2
- package/dist/cli/chunks/safe-db-4RRIGRXD.js +2 -0
- package/dist/cli/chunks/schedule-25RTO4DQ.js +2 -0
- package/dist/cli/chunks/scheduler-BPIOJZ5P.js +2 -0
- package/dist/cli/chunks/{security-CUEA3UIM.js → security-OSAE7VAP.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-DROMBRV2.js → shared-rvf-adapter-COUOS665.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-DBNABOP7.js → shared-rvf-dual-writer-YXMPZKQE.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-EDF47DDX.js +2 -0
- package/dist/cli/chunks/{standalone-memory-IAHA3M6B.js → standalone-memory-E6JBMOIL.js} +2 -2
- package/dist/cli/chunks/{status-handler-AFUCASTX.js → status-handler-AFTCIYIX.js} +2 -2
- package/dist/cli/chunks/{structural-health-AQRV6JJ6.js → structural-health-2FROCEI4.js} +2 -2
- package/dist/cli/chunks/{sync-XW5TLZ7M.js → sync-VAYTOWDC.js} +2 -2
- package/dist/cli/chunks/{sync-GX7FMJHL.js → sync-YIQYOFGW.js} +2 -2
- package/dist/cli/chunks/task-handler-KVQHDEX3.js +62 -0
- package/dist/cli/chunks/task-handlers-MVVECQA6.js +9 -0
- package/dist/cli/chunks/{test-D2XDJNDX.js → test-5JSVTOMY.js} +4 -4
- package/dist/cli/chunks/test-runner-process-LEPF2OSS.js +2 -0
- package/dist/cli/chunks/{test-scheduling-TS6I2PR7.js → test-scheduling-HBOHVLI3.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-HBBLPCZ3.js → token-bootstrap-5VEPTPFA.js} +2 -2
- package/dist/cli/chunks/{token-usage-3MBUX4PR.js → token-usage-TBJHDLY6.js} +2 -2
- package/dist/cli/chunks/{transformers-ZWMQO3L2.js → transformers-VAWYMHMZ.js} +2 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-TSZTCMFV.js +2 -0
- package/dist/cli/chunks/{types-5YEMGPSQ.js → types-R5SDZU2E.js} +2 -2
- package/dist/cli/chunks/unified-memory-TLGSSLMI.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-MSUR7ZOO.js +2 -0
- package/dist/cli/chunks/unified-persistence-VFFOTWK7.js +2 -0
- package/dist/cli/chunks/{upgrade-2TPBKIHI.js → upgrade-K5PIHXRB.js} +2 -2
- package/dist/cli/chunks/{validate-XRAXXFW6.js → validate-RPTS7RYJ.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-IYSCS3BZ.js → validate-swarm-B2ZL556X.js} +2 -2
- package/dist/cli/chunks/visual-security-6Q44XNLB.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-PZQ3ZG2P.js → web-tree-sitter-K4DUJC32.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-U6XWFRVT.js → windsurf-installer-OK2AJN35.js} +2 -2
- package/dist/cli/chunks/witness-chain-KDOMXDQX.js +2 -0
- package/dist/cli/chunks/witness-chain-N3OY2RMH.js +2 -0
- package/dist/cli/chunks/{witness-chain-repair-K7YX2AO6.js → witness-chain-repair-L6Y5RFXR.js} +2 -2
- package/dist/cli/chunks/{witness-chain-verifier-GUTC3W7N.js → witness-chain-verifier-N4CW7FZX.js} +2 -2
- package/dist/cli/chunks/{witness-key-manager-YBNKMOP6.js → witness-key-manager-TDNPS3WD.js} +2 -2
- package/dist/cli/chunks/{workflow-UAJUILFQ.js → workflow-XRZA3YCY.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-CVNNT2RJ.js +2 -0
- package/dist/cli/chunks/{wrappers-AVZ3GPAL.js → wrappers-5JIFWKN6.js} +2 -2
- package/dist/cli/commands/ci.js +7 -0
- package/dist/cli/commands/code.js +6 -0
- package/dist/cli/commands/coverage.js +7 -1
- package/dist/cli/commands/fleet-run.d.ts +12 -0
- package/dist/cli/commands/fleet-run.js +175 -0
- package/dist/cli/commands/fleet.js +2 -117
- package/dist/cli/commands/hooks-handlers/stats-hooks.d.ts +4 -3
- package/dist/cli/commands/hooks-handlers/stats-hooks.js +22 -4
- package/dist/cli/handlers/task-handler.d.ts +5 -0
- package/dist/cli/handlers/task-handler.js +26 -0
- package/dist/cli/utils/coverage-verdict.d.ts +11 -2
- package/dist/cli/utils/coverage-verdict.js +26 -6
- package/dist/cli/utils/fleet-operation.d.ts +10 -2
- package/dist/cli/utils/fleet-operation.js +20 -3
- package/dist/cli/utils/fleet-result.d.ts +20 -4
- package/dist/cli/utils/fleet-result.js +32 -21
- package/dist/cli/utils/fleet-shard.d.ts +36 -0
- package/dist/cli/utils/fleet-shard.js +110 -0
- package/dist/coordination/handlers/code-intelligence-handlers.js +21 -1
- package/dist/coordination/handlers/coverage-collection.d.ts +2 -0
- package/dist/coordination/handlers/coverage-collection.js +2 -1
- package/dist/coordination/handlers/coverage-evidence.d.ts +75 -0
- package/dist/coordination/handlers/coverage-evidence.js +159 -0
- package/dist/coordination/handlers/coverage-handlers.js +16 -3
- package/dist/coordination/handlers/coverage-scope.d.ts +40 -0
- package/dist/coordination/handlers/coverage-scope.js +321 -0
- package/dist/coordination/handlers/coverage-target.d.ts +9 -0
- package/dist/coordination/handlers/coverage-target.js +15 -5
- package/dist/coordination/handlers/handler-types.d.ts +2 -2
- package/dist/coordination/handlers/handler-utils.d.ts +11 -0
- package/dist/coordination/handlers/handler-utils.js +22 -8
- package/dist/coordination/handlers/misc-handlers.js +5 -2
- package/dist/coordination/handlers/quality-handlers.js +2 -2
- package/dist/coordination/handlers/security-handlers.js +12 -2
- package/dist/coordination/protocols/security-audit.js +11 -1
- package/dist/coordination/task-executor.js +7 -2
- package/dist/domains/code-intelligence/coordinator-gnn.d.ts +2 -16
- package/dist/domains/code-intelligence/coordinator-gnn.js +1 -62
- package/dist/domains/code-intelligence/coordinator.d.ts +12 -6
- package/dist/domains/code-intelligence/coordinator.js +24 -27
- package/dist/domains/code-intelligence/interfaces.d.ts +9 -0
- package/dist/domains/code-intelligence/services/metric-collector/listing-process-owner.js +4 -1
- package/dist/domains/code-intelligence/services/semantic-analyzer.d.ts +51 -5
- package/dist/domains/code-intelligence/services/semantic-analyzer.js +144 -78
- package/dist/domains/coverage-analysis/collected-metrics.d.ts +10 -0
- package/dist/domains/coverage-analysis/collected-metrics.js +29 -0
- package/dist/domains/coverage-analysis/services/coverage-analyzer.js +11 -3
- package/dist/domains/coverage-analysis/services/coverage-parser.d.ts +2 -0
- package/dist/domains/coverage-analysis/services/coverage-parser.js +18 -2
- package/dist/domains/quality-assessment/coherence/gate-controller.js +16 -4
- package/dist/domains/quality-assessment/coherence/lambda-calculator.d.ts +8 -0
- package/dist/domains/quality-assessment/coherence/lambda-calculator.js +57 -14
- package/dist/domains/quality-assessment/coherence/types.d.ts +12 -7
- package/dist/domains/quality-assessment/coordinator-gate-evaluation.js +3 -1
- package/dist/domains/quality-assessment/coordinator-reports.d.ts +30 -10
- package/dist/domains/quality-assessment/coordinator-reports.js +93 -57
- package/dist/domains/quality-assessment/coordinator.d.ts +14 -40
- package/dist/domains/quality-assessment/coordinator.js +10 -4
- package/dist/domains/quality-assessment/interfaces.d.ts +2 -0
- package/dist/domains/quality-assessment/services/coherence-gate.js +15 -2
- package/dist/domains/quality-assessment/services/quality-gate.js +6 -4
- package/dist/domains/security-compliance/index.d.ts +1 -1
- package/dist/domains/security-compliance/interfaces.d.ts +46 -5
- package/dist/domains/security-compliance/services/scanners/dast-auth-testing.d.ts +3 -3
- package/dist/domains/security-compliance/services/scanners/dast-auth-testing.js +15 -14
- package/dist/domains/security-compliance/services/scanners/dast-helpers.d.ts +8 -9
- package/dist/domains/security-compliance/services/scanners/dast-helpers.js +19 -44
- package/dist/domains/security-compliance/services/scanners/dast-injection-testing.d.ts +3 -3
- package/dist/domains/security-compliance/services/scanners/dast-injection-testing.js +13 -9
- package/dist/domains/security-compliance/services/scanners/dast-requests.d.ts +54 -0
- package/dist/domains/security-compliance/services/scanners/dast-requests.js +125 -0
- package/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts +5 -1
- package/dist/domains/security-compliance/services/scanners/dast-scanner.js +125 -155
- package/dist/domains/security-compliance/services/scanners/index.d.ts +1 -1
- package/dist/domains/security-compliance/services/scanners/index.js +1 -1
- package/dist/domains/security-compliance/services/scanners/scanner-types.d.ts +2 -2
- package/dist/domains/security-compliance/services/security-auditor-dast.js +183 -212
- package/dist/domains/security-compliance/services/security-auditor-reports.js +5 -1
- package/dist/domains/security-compliance/services/security-auditor.d.ts +11 -3
- package/dist/domains/security-compliance/services/security-auditor.js +106 -65
- package/dist/domains/test-execution/coordinator.d.ts +2 -1
- package/dist/domains/test-execution/coordinator.js +33 -27
- package/dist/domains/test-execution/interfaces.d.ts +5 -0
- package/dist/domains/test-execution/services/test-executor.d.ts +6 -0
- package/dist/domains/test-execution/services/test-executor.js +16 -4
- package/dist/domains/visual-accessibility/coordinator.js +34 -9
- package/dist/domains/visual-accessibility/interfaces.d.ts +27 -0
- package/dist/domains/visual-accessibility/plugin.js +5 -0
- package/dist/domains/visual-accessibility/services/accessibility-tester-heuristics.d.ts +13 -21
- package/dist/domains/visual-accessibility/services/accessibility-tester-heuristics.js +13 -297
- package/dist/domains/visual-accessibility/services/accessibility-tester.d.ts +13 -5
- package/dist/domains/visual-accessibility/services/accessibility-tester.js +96 -73
- package/dist/init/phases/10-workers.js +42 -4
- package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.d.ts +23 -1
- package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js +50 -15
- package/dist/integrations/agentic-flow/reasoning-bank/index.d.ts +7 -2
- package/dist/integrations/agentic-flow/reasoning-bank/index.js +8 -0
- package/dist/integrations/embeddings/index/HNSWIndex.js +8 -4
- package/dist/integrations/ruvector/transfer-coherence-stub.js +5 -10
- package/dist/learning/embedder-endpoint-client.d.ts +8 -0
- package/dist/learning/embedder-endpoint-client.js +20 -0
- package/dist/learning/embedder-recovery.d.ts +63 -0
- package/dist/learning/embedder-recovery.js +94 -0
- package/dist/learning/qe-reasoning-bank-types.d.ts +5 -0
- package/dist/learning/qe-reasoning-bank.d.ts +21 -0
- package/dist/learning/qe-reasoning-bank.js +54 -8
- package/dist/learning/real-embeddings.d.ts +23 -0
- package/dist/learning/real-embeddings.js +69 -2
- package/dist/learning/real-qe-reasoning-bank.d.ts +24 -4
- package/dist/learning/real-qe-reasoning-bank.js +58 -20
- package/dist/logging/redaction.js +142 -12
- package/dist/mcp/bundle.js +509 -497
- package/dist/mcp/daemon-mode.d.ts +126 -0
- package/dist/mcp/daemon-mode.js +257 -0
- package/dist/mcp/entry.d.ts +4 -0
- package/dist/mcp/entry.js +50 -2
- package/dist/mcp/handlers/domain-handler-configs.d.ts +8 -0
- package/dist/mcp/handlers/domain-handler-configs.js +14 -2
- package/dist/mcp/handlers/handler-factory.js +3 -0
- package/dist/mcp/handlers/model-route-handlers.d.ts +107 -0
- package/dist/mcp/handlers/model-route-handlers.js +139 -0
- package/dist/mcp/handlers/orchestrate-routes.d.ts +6 -1
- package/dist/mcp/handlers/orchestrate-routes.js +94 -3
- package/dist/mcp/handlers/task-handlers.d.ts +3 -242
- package/dist/mcp/handlers/task-handlers.js +11 -788
- package/dist/mcp/handlers/task-inference.d.ts +26 -0
- package/dist/mcp/handlers/task-inference.js +156 -0
- package/dist/mcp/handlers/task-learning-handlers.d.ts +92 -0
- package/dist/mcp/handlers/task-learning-handlers.js +230 -0
- package/dist/mcp/handlers/task-orchestrate-handler.d.ts +73 -0
- package/dist/mcp/handlers/task-orchestrate-handler.js +361 -0
- package/dist/mcp/protocol-server.js +15 -2
- package/dist/mcp/services/reasoning-bank-service.d.ts +6 -1
- package/dist/mcp/services/reasoning-bank-service.js +9 -0
- package/dist/mcp/tools/code-intelligence/analyze.js +3 -6
- package/dist/mcp/tools/coverage-analysis/index.d.ts +4 -0
- package/dist/mcp/tools/coverage-analysis/index.js +8 -2
- package/dist/mcp/tools/visual-accessibility/index.d.ts +7 -0
- package/dist/mcp/tools/visual-accessibility/index.js +29 -13
- package/dist/mcp/types.d.ts +14 -0
- package/dist/routing/advisor/redaction.js +22 -2
- package/dist/shared/events/domain-events.d.ts +2 -0
- package/dist/shared/llm/providers/response-deadline.js +16 -2
- package/dist/shared/metrics/code-metrics.js +21 -3
- package/dist/shared/parsers/typescript-parser.d.ts +6 -0
- package/dist/shared/parsers/typescript-parser.js +13 -1
- package/dist/shared/types/index.js +3 -1
- package/dist/strange-loop/infra-healing/infra-aware-agent-provider.js +8 -1
- package/package.json +3 -3
- package/dist/cli/chunks/adapter-V4GSGOOK.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-6WQTM5YR.js +0 -2
- package/dist/cli/chunks/base-AK7BXBX2.js +0 -2
- package/dist/cli/chunks/browser-workflow-VTDFBW7T.js +0 -2
- package/dist/cli/chunks/chunk-2DTX7YAZ.js +0 -6
- package/dist/cli/chunks/chunk-72ZBJD2E.js +0 -3
- package/dist/cli/chunks/chunk-EBPJY4DI.js +0 -3
- package/dist/cli/chunks/chunk-H43AFUKL.js +0 -2
- package/dist/cli/chunks/chunk-HJ3XNTTJ.js +0 -2
- package/dist/cli/chunks/chunk-IO5537OM.js +0 -2
- package/dist/cli/chunks/chunk-IW6WDGHM.js +0 -2
- package/dist/cli/chunks/chunk-K2HBNYAZ.js +0 -62
- package/dist/cli/chunks/chunk-LRL56ZYL.js +0 -21
- package/dist/cli/chunks/chunk-VLD7Z2ED.js +0 -13
- package/dist/cli/chunks/chunk-VO3DRK4P.js +0 -3
- package/dist/cli/chunks/ci-6GUFAZMJ.js +0 -81
- package/dist/cli/chunks/client-HL2COSFM.js +0 -2
- package/dist/cli/chunks/core-handlers-IX7ATLM6.js +0 -2
- package/dist/cli/chunks/cross-domain-router-YYKLAPJO.js +0 -2
- package/dist/cli/chunks/domain-transfer-DOBI67K6.js +0 -2
- package/dist/cli/chunks/dream-T6EP7B3F.js +0 -2
- package/dist/cli/chunks/file-discovery-JYMVTDMU.js +0 -2
- package/dist/cli/chunks/fleet-FVAUMKUT.js +0 -46
- package/dist/cli/chunks/heartbeat-scheduler-4N5MUJ7S.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-ZPAJDSLR.js +0 -2
- package/dist/cli/chunks/hnsw-index-4CTH6RHB.js +0 -2
- package/dist/cli/chunks/hybrid-backend-AW6UTXQS.js +0 -2
- package/dist/cli/chunks/impact-analyzer-MZK3JMSV.js +0 -2
- package/dist/cli/chunks/init-wizard-FUC7KDVX.js +0 -2
- package/dist/cli/chunks/kernel-ZCPMCVMW.js +0 -2
- package/dist/cli/chunks/knowledge-graph-NUJKEDNF.js +0 -2
- package/dist/cli/chunks/llm-router-service-B2BFBQ76.js +0 -2
- package/dist/cli/chunks/load-test-ZHQ2MUGO.js +0 -2
- package/dist/cli/chunks/memory-backend-AAMQG6WH.js +0 -2
- package/dist/cli/chunks/pattern-null-store-RFNVA46O.js +0 -2
- package/dist/cli/chunks/project-root-7QL4KP5C.js +0 -2
- package/dist/cli/chunks/protocol-executor-2NW5BD4R.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-G2JZOGKD.js +0 -2
- package/dist/cli/chunks/queen-coordinator-GRG5FT2A.js +0 -2
- package/dist/cli/chunks/real-embeddings-RQRVOKVM.js +0 -2
- package/dist/cli/chunks/router-LQB5SWAF.js +0 -2
- package/dist/cli/chunks/routing-feedback-OEEXA55N.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-BZK4M7BO.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-EZZUJL2E.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-6COXTQZ3.js +0 -2
- package/dist/cli/chunks/safe-db-PE6G3L55.js +0 -2
- package/dist/cli/chunks/schedule-OLKQ6QYW.js +0 -2
- package/dist/cli/chunks/scheduler-LSGBDFAT.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-HH4DNTYH.js +0 -2
- package/dist/cli/chunks/task-handler-TFKVUTNF.js +0 -60
- package/dist/cli/chunks/task-handlers-SS4ZDXNF.js +0 -9
- package/dist/cli/chunks/test-runner-process-PSSBNNGR.js +0 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-TYRQRJ2W.js +0 -2
- package/dist/cli/chunks/unified-memory-AGDZQ5XD.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-X5TJ3JDE.js +0 -2
- package/dist/cli/chunks/unified-persistence-UCV7YETW.js +0 -2
- package/dist/cli/chunks/visual-security-ZLXRIQZV.js +0 -2
- package/dist/cli/chunks/witness-chain-CVIWYTD2.js +0 -2
- package/dist/cli/chunks/witness-chain-VBKORKOX.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-3ZN7MVCE.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.15.
|
|
2
|
-
import{
|
|
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.15.13");process.exit(0)}
|
|
2
|
+
import{s as g}from"./chunk-WKGTGOYS.js";var m={0:"sqlite-only",1:"hybrid",2:"dual-write-sqlite-primary",3:"dual-write-rvf-primary",4:"rvf-primary"},b=class{config;db=null;rvfStore=null;totalWrites=0;totalReads=0;rvfWriteFailures=0;rvfReadFailures=0;fallbacksUsed=0;sqliteLatencies=[];rvfLatencies=[];sqliteWriteLatencies=[];rvfWriteLatencies=[];constructor(e){this.config={rvfPath:".agentic-qe/patterns.rvf",dimensions:384,enableFallback:!0,...e}}setSqliteDb(e){this.db=e}setRvfStore(e){this.rvfStore=e}get stage(){return this.config.stage}setStage(e){this.config={...this.config,stage:e}}write(e,t){this.totalWrites++;let r={sqliteSuccess:!1,rvfSuccess:!1,stage:this.config.stage,fallbackUsed:!1},n=this.db?this.db.prepare("PRAGMA table_info('qe_pattern_embeddings')").all().some(s=>s.name==="space_id"):!1,c=g()?.spaceId??this.config.embeddingSpaceId;if(!n||!c)return r;let o=this.config.stage<4,i=this.config.stage>=2;if(o&&this.db){let s=performance.now();try{let a=Buffer.from(t instanceof Float32Array?t.buffer:new Float32Array(t).buffer);n?this.db.prepare(`
|
|
3
3
|
INSERT INTO qe_pattern_embeddings (pattern_id, embedding, dimension, model, space_id, created_at)
|
|
4
4
|
VALUES (?, ?, ?, 'all-MiniLM-L6-v2', ?, datetime('now'))
|
|
5
5
|
ON CONFLICT(pattern_id) DO UPDATE SET
|
|
@@ -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.15.
|
|
2
|
-
import{a as u,e as I}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.15.13");process.exit(0)}
|
|
2
|
+
import{a as u,e as I}from"./chunk-3Y2ROSCL.js";import{a as p,q as D}from"./chunk-WO274FRI.js";import{b as E}from"./chunk-ZAKQLAHT.js";import{existsSync as l,renameSync as m,copyFileSync as O,readdirSync as F,statSync as N,openSync as j,readSync as B,closeSync as U,writeFileSync as C,rmSync as S}from"node:fs";import{join as _,dirname as Q}from"node:path";function $(e){if(!l(e))return!0;let t;try{t=N(e).size}catch{return!1}if(t===0)return!0;if(t<g.length)return!1;let n;try{n=j(e,"r");let r=Buffer.alloc(g.length);return B(n,r,0,g.length,0),r.equals(g)}catch{return!1}finally{if(n!==void 0)try{U(n)}catch{}}}function W(e){let t;try{return t=new p(e,{readonly:!0,fileMustExist:!0}),t.pragma("integrity_check",{simple:!0})==="ok"}catch{return!1}finally{try{t?.close()}catch{}}}function q(e){return _(Q(e),"backups","verified")}function G(e){if(!l(e))return null;let t=F(e).filter(n=>n.startsWith("memory-")&&n.endsWith(".db")).map(n=>{let r=_(e,n);return{path:r,mtime:N(r).mtimeMs}}).sort((n,r)=>r.mtime-n.mtime);for(let n of t)if(W(n.path))return n.path;return null}function v(e,t){if($(e))return{restored:!1,reason:"healthy"};let n=t?.backupDir??q(e),r=G(n);if(!r)return{restored:!1,reason:"no-verified-backup"};let o=`${e}.restore.lock`;try{C(o,String(process.pid),{flag:"wx"})}catch{return{restored:!1,reason:"restore-in-progress"}}try{if($(e))return{restored:!1,reason:"healthy"};let f=t?.now??Date.now(),a=`${e}.corrupt-${f}`;try{l(e)&&m(e,a);for(let i of["-wal","-shm"])l(e+i)&&m(e+i,a+i)}catch{return{restored:!1,reason:"park-failed"}}let c=`${e}.restoring-${f}`;try{O(r,c),m(c,e)}catch{try{l(c)&&S(c,{force:!0}),!l(e)&&l(a)&&m(a,e)}catch{}return{restored:!1,reason:"copy-failed"}}return{restored:!0,reason:"restored-from-backup",backupUsed:r,parkedTo:a}}finally{try{S(o,{force:!0})}catch{}}}var g,R=E(()=>{"use strict";D();g=Buffer.concat([Buffer.from("SQLite format 3","latin1"),Buffer.from([0])])});function H(e){let t=[],n=e;for(let r=0;n!=null&&r<5;r++){t.push(u(n));let o=n.code;typeof o=="string"&&t.push(o),n=n.cause}return t.join(`
|
|
3
3
|
`)}function Y(e){let t=e.split(`
|
|
4
4
|
`)[0].trim();return t.endsWith("Tried:")?t.slice(0,-6).trimEnd():t}function A(e,t="better-sqlite3"){if(e==null)return null;let n=H(e),r=Y(u(e));return K.some(o=>o.test(n))?{moduleName:t,reason:"missing-binding",detail:r}:V.some(o=>o.test(n))?{moduleName:t,reason:"abi-mismatch",detail:r}:z.some(o=>o.test(n))?{moduleName:t,reason:"load-failed",detail:r}:null}function Z(e){let{moduleName:t}=e;return[`${t} ${h}: ${X[e.reason]}`," Fix a global install (reinstall, naming the package):",` npm install -g agentic-qe --allow-scripts=${J}`," Or rebuild just the native module in an existing global install:",` npm rebuild -g ${t} --allow-scripts=${t}`," For a project-local install (devDependency), run in the project:",` npm install-scripts approve ${t} && npm rebuild ${t}`,` Original error: ${e.detail}`].join(`
|
|
5
5
|
`)}function M(e,t="better-sqlite3"){if(e instanceof d||u(e).includes(h))return e;let n=A(e,t);return n?new d(n,e):e}function se(e){return e instanceof d||u(e).includes(h)||A(e)!==null}var h,J,K,V,z,X,d,x=E(()=>{"use strict";I();h="native module could not be loaded",J="agentic-qe,better-sqlite3,hnswlib-node",K=[/Could not locate the bindings file/i],V=[/NODE_MODULE_VERSION/,/compiled against a different Node\.js version/i,/Module did not self-register/i],z=[/ERR_DLOPEN_FAILED/,/invalid ELF header/i,/wrong ELF class/i,/incompatible architecture/i,/mach-o file, but is an incompatible architecture/i,/\.node: cannot open shared object file/i,/is not a valid Win32 application/i];X={"missing-binding":"its compiled binary is missing. Its install script never ran \u2014 npm 12+ blocks dependency install scripts unless they are allowed (allowScripts).","abi-mismatch":`it was built for a different Node.js version than the one running now (${process.version}). Rebuild it after switching Node versions.`,"load-failed":"the binary exists but the OS refused to load it (wrong platform/architecture or a corrupt build)."};d=class extends Error{moduleName;reason;constructor(t,n){super(Z(t),{cause:n}),this.name="NativeModuleLoadError",this.moduleName=t.moduleName,this.reason=t.reason}}});import{basename as P}from"node:path";function fe(e,t){let n=t?.readonly??!1,r=t?.fileMustExist??!1,o=t?.busyTimeout??5e3,f=t?.walMode??!n;if(t?.autoRestore&&!n){let s=v(e,{backupDir:t.backupDir});s.restored?console.warn(`[safe-db] memory DB at ${e} was malformed; auto-restored from ${s.backupUsed}. Corrupt original parked at ${s.parkedTo}.`):s.reason==="no-verified-backup"&&console.error(`[safe-db] memory DB at ${e} appears malformed and NO verified backup was found to restore from. Leaving it in place for manual inspection.`)}let a=(process.env.AQE_JOURNAL_MODE??"").trim().toUpperCase(),c=process.env.AQE_DISABLE_WAL==="1"||a==="DELETE"||a==="TRUNCATE",i;try{i=new p(e,{readonly:n,fileMustExist:r})}catch(s){throw M(s)}if(i.pragma(`busy_timeout = ${o}`),c){if(!n){let s=(a||"DELETE").toUpperCase(),y=String(i.pragma("journal_mode",{simple:!0})??"").toUpperCase();if(y!==s){try{i.pragma(`journal_mode = ${s}`)}catch(b){let k=b?.code;if(i.close(),k!=="SQLITE_BUSY"&&k!=="SQLITE_LOCKED")throw b;let T=P(e),L=process.env.AQE_DISABLE_WAL==="1"?"AQE_DISABLE_WAL=1":`AQE_JOURNAL_MODE=${a}`;throw new Error(`[safe-db] cannot switch ${e} from '${y}' to '${s}' \u2014 another process holds the database open. ${L} declares WAL unsafe on this filesystem, so writing in '${y}' is NOT safe and this open is refused. Find the holder with:
|
|
@@ -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.15.
|
|
2
|
-
import{b 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.15.13");process.exit(0)}
|
|
2
|
+
import{b as h}from"./chunk-ZAKQLAHT.js";function i(t,r){if(t.length!==r.length)throw new Error(`Vector length mismatch: ${t.length} vs ${r.length}`);let e=0,o=0,l=0;for(let n=0;n<t.length;n++)e+=t[n]*r[n],o+=t[n]*t[n],l+=r[n]*r[n];let u=Math.sqrt(o)*Math.sqrt(l);return u===0?0:e/u}function c(t){let r=Math.sqrt(t.reduce((e,o)=>e+o*o,0));return r===0?t.slice():t.map(e=>e/r)}function g(t){let r=0;for(let e=0;e<t.length;e++)r+=t[e]*t[e];return Math.sqrt(r)}var m=h(()=>{"use strict"});export{i as a,c as b,g as c,m as d};
|
|
@@ -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.15.
|
|
2
|
-
import{d as s}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.15.13");process.exit(0)}
|
|
2
|
+
import{d as s}from"./chunk-VTOBUZL6.js";s();
|
|
@@ -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.15.
|
|
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.15.13");process.exit(0)}
|
|
2
2
|
var s={"test-generation":/test|spec|describe|it\(|expect|assert|mock|stub|fixture|tdd|bdd/i,"test-execution":/run|execute|parallel|retry|flaky|timeout|worker|orchestrat/i,"coverage-analysis":/coverage|branch|line|uncovered|gap|untested|percentage|sublinear/i,"quality-assessment":/quality|gate|deploy|readiness|metric|threshold|sla|score/i,"defect-intelligence":/defect|bug|predict|root.?cause|regression|failure|incident/i,"requirements-validation":/requirement|bdd|gherkin|testabil|accept|criteri|scenario/i,"code-intelligence":/semantic|knowledge|graph|ast|symbol|reference|impact|depend/i,"security-compliance":/vuln|cve|owasp|xss|sqli|injection|csrf|auth|secret|compliance|sast|dast/i,"contract-testing":/contract|pact|openapi|swagger|graphql|schema|endpoint|api/i,"visual-accessibility":/screenshot|visual|snapshot|pixel|percy|a11y|aria|wcag|screen.?reader|accessible|contrast/i,"chaos-resilience":/chaos|resilience|fault|inject|blast|recover|latency|failure|stress|load/i,"learning-optimization":/learn|pattern|optim|neural|embedding|vector|memory|adapt|train/i};function m(e){for(let[t,a]of Object.entries(s))if(a.test(e))return t;return null}function d(e){let t=[];for(let[a,n]of Object.entries(s))n.test(e)&&t.push(a);return t}function u(e){return e}function p(e){let t=Math.min(e.usageCount/100,1);return e.confidence*.3+t*.2+e.successRate*.5}var c=3,l=.7;function y(e,t,a=.4){let n=e.tier==="short-term"&&e.successfulUses>=c,r=e.successRate>=l&&e.confidence>=.6,i=t===void 0||t<a,o;return n?r?i||(o="coherence_violation"):o="low_quality":o="insufficient_usage",{meetsUsageCriteria:n,meetsQualityCriteria:r,meetsCoherenceCriteria:i,blockReason:o}}function f(e){let t=[];if(e.id||t.push("Pattern ID is required"),e.patternType||t.push("Pattern type is required"),e.qeDomain||t.push("QE domain is required"),e.name||t.push("Pattern name is required"),e.template?.content||t.push("Template content is required"),e.confidence!==void 0&&(e.confidence<0||e.confidence>1)&&t.push("Confidence must be between 0 and 1"),e.successRate!==void 0&&(e.successRate<0||e.successRate>1)&&t.push("Success rate must be between 0 and 1"),e.template?.variables){let a=new Set;for(let n of e.template.variables)a.has(n.name)&&t.push(`Duplicate variable name: ${n.name}`),a.add(n.name),e.template.content.includes(`{{${n.name}}}`)||t.push(`Variable ${n.name} not referenced in template`)}return{valid:t.length===0,errors:t}}function g(e,t){let a=e.content;for(let n of e.variables){let r=(Object.hasOwn(t,n.name)?t[n.name]:void 0)??n.defaultValue;if(n.required&&r===void 0)throw new Error(`Required variable ${n.name} not provided`);if(r!==void 0){let i=`{{${n.name}}}`,o=typeof r=="object"?JSON.stringify(r):String(r);a=a.split(i).join(o)}}return a}var b=Object.keys(s);export{m as a,d as b,u as c,p as d,c as e,l as f,y as g,f as h,g as i,b as j};
|
|
@@ -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.15.
|
|
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.15.13");process.exit(0)}
|
|
2
2
|
import{createHash as o}from"node:crypto";import a from"node:fs";function c(r){let n=[...r].sort((e,t)=>e.id.localeCompare(t.id)).map(e=>({id:e.id,inputUnderTest:e.inputUnderTest,moduleName:e.moduleName,referenceImpl:e.referenceImpl,requirements:e.requirements,expectedMutants:e.expectedMutants}));return JSON.stringify(n)}function s(r){return o("sha256").update(c(r)).digest("hex")}function h(r){return i(a.readFileSync(r,"utf8"),r)}function i(r,n){let e=JSON.parse(r),t=s(e.items);if(t!==e.contentHash)throw new Error(`Anchor set hash drift at ${n}: recorded ${e.contentHash}, recomputed ${t}. Refusing to load a mutated frozen anchor (ADR-117). A legitimate change must be a versioned re-freeze (qe-anchor-v2), never an in-place edit.`);if(e.items.length===0)throw new Error(`Anchor set at ${n} has no items \u2014 a frozen anchor must be non-empty.`);return e}function p(r,n,e){return r>=n-e}export{h as a,i as b,p as c};
|
|
@@ -0,0 +1,21 @@
|
|
|
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.15.13");process.exit(0)}
|
|
2
|
+
import{a as Z}from"./chunk-CE7B5LU7.js";import{a as C,e as x,f as X}from"./chunk-CT6SAVXQ.js";import{a as O}from"./chunk-UDQSYWVF.js";import{a as F,b as H,c as G,d as j,e as V,f as Y,h as K}from"./chunk-TSQC2KKZ.js";import{c as $,d as J}from"./chunk-SYV2V3PL.js";import{a as W,b as _,g as z,j as U}from"./chunk-E7CLYGS7.js";import{i as B}from"./chunk-VRVMIPTM.js";import{b as w,d as re}from"./chunk-VTOBUZL6.js";import{b as D,h as q,j as M,l as L,m as v,s as A}from"./chunk-WKGTGOYS.js";import{i as N}from"./chunk-H4H2YSFH.js";import{c as p,d as h}from"./chunk-NURIILUB.js";import{a as ie}from"./chunk-UT2VZ33P.js";import{c as T}from"./chunk-GB6HBNH2.js";import{a as b,b as y,e as ne}from"./chunk-3Y2ROSCL.js";ie();ne();re();var o=T.create("RealQEReasoningBank"),ae={sqlite:{dbPath:".agentic-qe/memory.db",walMode:!0,useUnified:!0},embeddings:{modelName:"Xenova/all-MiniLM-L6-v2",quantized:!0,enableCache:!0},enableLearning:!0,enableRouting:!0,enableGuidance:!0,hnsw:{M:16,efConstruction:200,efSearch:100},routingWeights:{similarity:.3,performance:.4,capabilities:.3},coherenceThreshold:.4,embedderRetryIntervalMs:6e4},k=class{constructor(e={},t){this.coherenceService=t;this.qeConfig={...ae,...e},this.sqliteStore=B(this.qeConfig.sqlite),this.asymmetricEngine=new Z,this.embedderRecovery=new Y({retryIntervalMs:this.qeConfig.embedderRetryIntervalMs,probe:()=>this.probeEmbedderForRetry(),onRecovered:()=>o.info("Embedder available again: pattern search uses vectors"),onRetryFailed:n=>o.debug("Embedder still unavailable",{error:b(n)})})}coherenceService;qeConfig;sqliteStore;hnswIndex=null;patternIdMap=new Map;initialized=!1;embedderRecovery;stats={routingRequests:0,totalRoutingLatency:0,learningOutcomes:0,successfulOutcomes:0};routingLatencies=new O(1e3);asymmetricEngine;agentCapabilities={"qe-test-generator":{domains:["test-generation"],capabilities:["test-generation","tdd","bdd","unit-test","integration-test"],performanceScore:.85},"qe-coverage-analyzer":{domains:["coverage-analysis"],capabilities:["coverage-analysis","gap-detection","risk-scoring"],performanceScore:.92},"qe-coverage-specialist":{domains:["coverage-analysis"],capabilities:["sublinear-analysis","branch-coverage","mutation-testing"],performanceScore:.88},"qe-test-architect":{domains:["test-generation","coverage-analysis"],capabilities:["test-strategy","test-pyramid","architecture"],performanceScore:.9},"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}};async initialize(){if(this.initialized)return;let e=performance.now();await this.sqliteStore.initialize(),o.info("SQLite persistence initialized");try{await q(D,this.qeConfig.embeddings)}catch(i){this.embedderRecovery.markUnavailable(b(i)),o.warn("No embedding runtime: patterns are stored without vectors (pending `aqe learning backfill-embeddings`) and searched by text matching only",{reason:this.embedderRecovery.unavailableReason})}this.embedderRecovery.unavailableReason===null&&(await this.initializeHNSW(),o.info("HNSW index initialized"),await this.loadPatternsIntoHNSW()),this.sqliteStore.getStats().totalPatterns===0&&(this.sqliteStore.hasAnyHistoricalData?.()??!1?o.error("qe_patterns table is EMPTY but historical data exists \u2014 possible data loss! Restore from backup instead of loading seed patterns. Skipping foundational pattern load to avoid masking data loss."):await this.loadFoundationalPatterns()),this.initialized=!0;let n=performance.now()-e;o.info("Fully initialized",{durationMs:Math.round(n)})}getPatternSearchStatus(){let e=this.embedderRecovery.unavailableReason;return e===null?{mode:"vector"}:{mode:"lexical-only",reason:e}}async embedOrUndefined(e){if(this.embedderRecovery.isAvailable())try{return await q(e,this.qeConfig.embeddings)}catch(t){let n=`Embedder failed at runtime: ${b(t)}`;this.embedderRecovery.markUnavailable(n)&&o.warn("Embedder failed: patterns are stored without vectors and searched by text matching only until it recovers",{reason:n});return}}async probeEmbedderForRetry(){await V(this.qeConfig.embeddings),this.hnswIndex||(await this.initializeHNSW(),await this.loadPatternsIntoHNSW())}async initializeHNSW(){try{let e=await import("./hnswlib-node-ULGTGDZW.js"),n=e.default?.HierarchicalNSW||e.HierarchicalNSW;if(typeof n!="function")throw new Error("HierarchicalNSW not found in hnswlib-node module");let i=n,r=v();this.hnswIndex=new i("cosine",r),this.hnswIndex.initIndex(1e5,this.qeConfig.hnsw.M,this.qeConfig.hnsw.efConstruction),this.hnswIndex.setEf(this.qeConfig.hnsw.efSearch),o.info("HNSW initialized",{dimension:r,M:this.qeConfig.hnsw.M})}catch(e){throw o.error("HNSW initialization failed",e instanceof Error?e:void 0),e}}async loadPatternsIntoHNSW(){if(!this.hnswIndex)return;let e=this.sqliteStore.getAllEmbeddings(),t=v(),n=0,i=0,r=A()?.spaceId;for(let{patternId:s,embedding:a,spaceId:l}of e){if(!r||l!==r||!a||!Array.isArray(a)||a.length!==t){i++;continue}let c=this.hnswIndex.getCurrentCount();this.hnswIndex.addPoint(a,c),this.patternIdMap.set(c,s),n++}i>0&&o.warn("Skipped invalid embeddings",{skipped:i,expectedDim:t}),o.info("Loaded patterns into HNSW index",{count:n})}async loadFoundationalPatterns(){let e=[{patternType:"test-template",name:"AAA Unit Test",description:"Arrange-Act-Assert pattern for clear, maintainable unit tests",template:{type:"code",content:`describe('{{className}}', () => {
|
|
3
|
+
describe('{{methodName}}', () => {
|
|
4
|
+
it('should {{expectedBehavior}}', {{async}} () => {
|
|
5
|
+
// Arrange
|
|
6
|
+
{{arrangeCode}}
|
|
7
|
+
|
|
8
|
+
// Act
|
|
9
|
+
{{actCode}}
|
|
10
|
+
|
|
11
|
+
// Assert
|
|
12
|
+
{{assertCode}}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
});`,variables:[{name:"className",type:"string",required:!0},{name:"methodName",type:"string",required:!0},{name:"expectedBehavior",type:"string",required:!0}]},context:{testType:"unit",tags:["unit-test","aaa","best-practice"]}},{patternType:"coverage-strategy",name:"Risk-Based Coverage",description:"Prioritize coverage by code risk and complexity",template:{type:"prompt",content:"Analyze coverage gaps focusing on critical business logic, error handling, and high-complexity functions.",variables:[]},context:{tags:["coverage","risk-based"]}}];for(let t of e)try{await this.storeQEPattern(t)}catch(n){o.warn("Failed to load foundational pattern",{name:t.name,error:n})}o.info("Loaded foundational patterns",{count:e.length})}async storeQEPattern(e){try{let t=`${e.name} ${e.description||""} ${e.context?.tags?.join(" ")||""}`,n=await this.embedOrUndefined(t),i=W(t)||"test-generation";if(C())try{let a=X(e.name,{description:e.description,template:e.template,patternType:e.patternType},i,{tags:e.context?.tags}),l=await x.evaluateWrite(a);if(!l.allowed&&(o.warn("Pattern blocked by MemoryWriteGate",{name:e.name,reason:l.reason,conflicts:l.conflictingPatterns?.join(", ")||"none"}),l.reason?.includes("strict")))return h(new Error(`Pattern blocked by governance: ${l.reason}`))}catch(a){o.warn("MemoryWriteGate check error (continuing)",{error:a})}let r=N(),s={id:r,patternType:e.patternType,qeDomain:i,domain:i,name:e.name,description:e.description||"",confidence:.5,usageCount:0,successRate:0,qualityScore:0,tier:"short-term",template:e.template,context:{tags:[],...e.context},createdAt:new Date,lastUsedAt:new Date,successfulUses:0,embedding:n,reusable:!1,reuseCount:0,averageTokenSavings:0};if(this.sqliteStore.storePattern(s,n),this.hnswIndex&&n){let a=this.hnswIndex.getCurrentCount();this.hnswIndex.addPoint(n,a),this.patternIdMap.set(a,r)}if(C())try{x.registerPattern({key:r,value:{name:s.name,description:s.description,patternType:s.patternType},domain:s.domain})}catch(a){o.warn("Pattern registration with MemoryWriteGate failed",{error:a})}return p(s)}catch(t){return h(y(t))}}async searchQEPatterns(e,t={}){let n=performance.now();try{let i=t.limit||10,r=[],s=await this.embedOrUndefined(e);if(s){if(!this.hnswIndex)return h(new Error("HNSW index not available"));this.collectVectorMatches(s,i,t,r)}let a=new Map(r.map(c=>[c.pattern.id,c]));for(let c of this.sqliteStore.searchFTS(e,i*2)){let d=a.get(c.id);if(d){d.score=J(d.score,c.ftsScore*c.coverage);continue}if(t.minSimilarity!==void 0)continue;let u=this.sqliteStore.getPattern(c.id);!u||t.domain&&u.qeDomain!==t.domain||r.push({pattern:u,score:.5*c.ftsScore*c.coverage,similarity:0,matchType:"lexical",canReuse:!1})}r.sort((c,d)=>d.score-c.score);let l=performance.now()-n;return l>10&&o.warn("Slow search",{searchTimeMs:Number(l.toFixed(1))}),p(r.slice(0,i))}catch(i){return h(y(i))}}collectVectorMatches(e,t,n,i){let r=this.hnswIndex.searchKnn(e,t*2);for(let s=0;s<r.neighbors.length;s++){let a=r.neighbors[s],c=1-r.distances[s];if(n.minSimilarity!==void 0&&c<n.minSimilarity)continue;let d=this.patternIdMap.get(a);if(!d)continue;let u=this.sqliteStore.getPattern(d);if(!u||n.domain&&u.qeDomain!==n.domain)continue;let m=$.reuseOptimization,g=(Date.now()-new Date(u.lastUsedAt).getTime())/864e5;i.push({pattern:u,similarity:c,score:c,matchType:"vector",canReuse:!!(u.reusable&&c>=m.minSimilarityForReuse&&u.successRate>=m.minSuccessRateForReuse&&g<=m.maxAgeForReuse)})}}async routeTask(e){let t=performance.now();this.stats.routingRequests++;try{let n=e.domain?[e.domain]:_(e.task);n.length===0&&n.push("test-generation");let i=await this.searchQEPatterns(e.task,{limit:10,domain:n[0]}),r=i.success?i.value.map(m=>m.pattern):[],s=[];for(let[m,g]of Object.entries(this.agentCapabilities)){let f=0,P=[],I=n.filter(S=>g.domains.includes(S)).length,E=I>0?I/n.length*.4:0;if(f+=E*this.qeConfig.routingWeights.similarity,E>0&&P.push(`Domain: ${(E*100).toFixed(0)}%`),e.capabilities&&e.capabilities.length>0){let S=e.capabilities.filter(ee=>g.capabilities.some(te=>te.toLowerCase().includes(ee.toLowerCase()))).length,R=S>0?S/e.capabilities.length*.3:0;f+=R*this.qeConfig.routingWeights.capabilities,R>0&&P.push(`Caps: ${(R*100).toFixed(0)}%`)}else f+=.15*this.qeConfig.routingWeights.capabilities;f+=g.performanceScore*.3*this.qeConfig.routingWeights.performance,P.push(`Perf: ${(g.performanceScore*100).toFixed(0)}%`),s.push({agent:m,score:f,reasoning:P})}s.sort((m,g)=>g.score-m.score);let a=s[0],l=s.slice(1,4),c=[];if(this.qeConfig.enableGuidance&&n.length>0){let m=H(n[0],{framework:e.context?.framework,language:e.context?.language,includeAntiPatterns:!0});c.push(...m.slice(0,5))}let d=performance.now()-t;this.stats.totalRoutingLatency+=d,this.routingLatencies.push(d);let u={recommendedAgent:a.agent,confidence:a.score,alternatives:l.map(m=>({agent:m.agent,score:m.score})),domains:n,patterns:r,guidance:c,reasoning:a.reasoning.join("; "),latencyMs:d};return p(K(e.includePatternGuidance,u,i.success?i.value:[]))}catch(n){return h(y(n))}}async recordOutcome(e){if(!this.qeConfig.enableLearning)return p(void 0);try{this.sqliteStore.recordUsage(e.patternId,e.success,e.metrics,e.feedback),this.stats.learningOutcomes++,e.success&&this.stats.successfulOutcomes++;let t=this.sqliteStore.getPattern(e.patternId);if(t){let n=t.qeDomain,i=this.asymmetricEngine.computeConfidenceUpdate(t.confidence,e.success?"success":"failure",n);this.asymmetricEngine.shouldQuarantine(i,n).shouldQuarantine&&o.info("Pattern quarantined (asymmetric drop)",{name:t.name}),this.sqliteStore.updatePattern(e.patternId,{confidence:i}),await this.checkPatternPromotionWithCoherence(t)&&(this.sqliteStore.promotePattern(e.patternId),o.info("Pattern promoted to long-term",{name:t.name}))}return p(void 0)}catch(t){return h(y(t))}}async checkPatternPromotionWithCoherence(e){let t=z(e);if(!t.meetsUsageCriteria||!t.meetsQualityCriteria)return!1;if(this.coherenceService&&this.coherenceService.isInitialized()){let r=[...await this.getLongTermPatterns(),e].map(a=>({id:a.id,embedding:a.embedding||[],weight:a.confidence,metadata:{name:a.name,domain:a.qeDomain}})),s=await this.coherenceService.checkCoherence(r);if(s.energy>=(this.qeConfig.coherenceThreshold||.4))return o.info("Pattern promotion blocked due to coherence violation",{name:e.name,energy:s.energy}),s.contradictions&&s.contradictions.length>0&&o.info("Conflicts with existing patterns",{conflictingNodeIds:s.contradictions.map(a=>a.nodeIds).flat()}),!1}return!0}async getLongTermPatterns(){return this.sqliteStore.getPatterns({limit:1e3}).filter(t=>t.tier==="long-term")}shouldPromote(e){return e.tier==="short-term"&&e.successfulUses>=3&&e.successRate>=.7&&e.confidence>=.6}getQEGuidance(e){return F(e)}generateQEContext(e,t){return j(e,t||{})}checkQEAntiPatterns(e,t){return G(e,t)}async getQEStats(){let e=this.sqliteStore.getStats(),t=this.routingLatencies.percentile(95)||0,n={};for(let i of U)n[i]=e.byDomain[i]||0;return{totalPatterns:e.totalPatterns,byDomain:n,byTier:e.byTier,routingRequests:this.stats.routingRequests,avgRoutingLatencyMs:this.stats.routingRequests>0?this.stats.totalRoutingLatency/this.stats.routingRequests:0,p95RoutingLatencyMs:t,learningOutcomes:this.stats.learningOutcomes,patternSuccessRate:this.stats.learningOutcomes>0?this.stats.successfulOutcomes/this.stats.learningOutcomes:0,embeddingCacheSize:0,transformerAvailable:L(),patternSearch:this.getPatternSearchStatus(),embeddingDimension:v(),sqliteDbPath:this.qeConfig.sqlite.dbPath||".agentic-qe/memory.db",asymmetricLearning:{failurePenaltyRatio:"10:1",quarantinedPatterns:this.sqliteStore.getPatterns({limit:1e4}).filter(i=>i.quarantined===!0).length,rehabilitatedPatterns:this.sqliteStore.getPatterns({limit:1e4}).filter(i=>i.quarantined===!1&&i.quarantinedAt).length,avgConfidenceDelta:this.stats.learningOutcomes>0?this.stats.successfulOutcomes/this.stats.learningOutcomes-.5:0}}}async storeLoopPattern(e){try{let t=await this.storeQEPattern({patternType:"anti-pattern",name:`loop-detection:${e.toolCallSignature}`,description:`Tool call loop detected for agent ${e.agentId} during ${e.taskType}. Steering: ${e.steeringUsed}. Resolved: ${e.resolved}`,template:{type:"prompt",content:e.steeringUsed,variables:[]},context:{tags:["anti-pattern","loop-detection","learning-optimization",e.taskType]}});return t.success?{success:!0,patternId:t.value.id}:{success:!1,error:t.error?.message??"Unknown error"}}catch(t){return{success:!1,error:b(t)}}}async recordPatternOutcome(e,t,n){let i=this.sqliteStore.getPattern(e);if(!i)return;let r=i.usageCount+1,s=t?i.successfulUses+1:i.successfulUses,a=s/r,l=.3,c=(1-l)*i.qualityScore+l*n,d=Math.min(1,.5+r*.05+a*.3);this.sqliteStore.updatePattern(e,{usageCount:r,successfulUses:s,successRate:a,qualityScore:c,confidence:d})}async checkPatternPromotion(e,t,n,i){let r=this.sqliteStore.getPattern(e);return r?r.tier==="short-term"?t>=3&&n>=.6&&i>=.5:r.tier==="long-term"?t>=10&&n>=.75&&i>=.7:!1:!1}async promotePattern(e){this.sqliteStore.promotePattern(e)}async demotePattern(e){let t=this.sqliteStore.getPattern(e);if(!t)return;let n=["short-term","working","long-term"],i=n.indexOf(t.tier);if(i>0){let r=n[i-1];this.sqliteStore.updatePattern(e,{tier:r}),o.info("Pattern demoted",{name:t.name,newTier:r})}}cleanupPatternIdMap(){if(!this.initialized)return 0;let e=0,t=this.sqliteStore.getPatterns({limit:1e5}),n=new Set(t.map(i=>i.id));for(let[i,r]of Array.from(this.patternIdMap.entries()))n.has(r)||(this.patternIdMap.delete(i),e++);return e>0&&o.info("Cleaned stale patternIdMap entries",{count:e}),e}removePatternFromHNSW(e){for(let[t,n]of Array.from(this.patternIdMap.entries()))if(n===e)return this.patternIdMap.delete(t),o.info("Removed pattern from HNSW mapping",{patternId:e}),!0;return!1}getMemoryStats(){return{patternIdMapSize:this.patternIdMap.size,routingLatenciesSize:this.routingLatencies.length,hnswIndexCount:this.hnswIndex?.getCurrentCount()??0}}async storeTrajectory(e){return this.sqliteStore.getDb().prepare(`
|
|
16
|
+
INSERT OR REPLACE INTO qe_trajectories (
|
|
17
|
+
id, task, agent, domain, started_at, ended_at, success, steps_json, metadata_json
|
|
18
|
+
) VALUES (?, ?, ?, ?, datetime('now'), datetime('now'), ?, ?, ?)
|
|
19
|
+
`).run(e.id,e.task,e.agent??null,e.domain??null,e.success?1:0,JSON.stringify(e.steps),JSON.stringify(e.metrics??{})),e.id}async getTrajectories(e,t=50){let n=this.sqliteStore.getDb(),i="SELECT * FROM qe_trajectories",r=[];return e&&(i+=" WHERE domain = ?",r.push(e)),i+=" ORDER BY ended_at DESC LIMIT ?",r.push(t),n.prepare(i).all(...r).map(a=>({id:a.id,task:a.task,agent:a.agent??void 0,domain:a.domain,success:a.success===1,steps:w(a.steps_json||"[]"),metrics:a.metadata_json?w(a.metadata_json):void 0}))}async linkPatternToTrajectory(e,t){let n=this.sqliteStore.getDb(),i=this.sqliteStore.getPattern(e);if(i){let r={...i.context,sourceTrajectoryId:t};n.prepare(`
|
|
20
|
+
UPDATE qe_patterns SET context_json = ?, updated_at = datetime('now') WHERE id = ?
|
|
21
|
+
`).run(JSON.stringify(r),e)}}async getEnhancedAdapter(){return{message:"Use EnhancedReasoningBankAdapter for full agentic-flow integration",importPath:"../integrations/agentic-flow/reasoning-bank/index.js"}}async dispose(){this.sqliteStore.close(),M(),this.hnswIndex=null,this.patternIdMap.clear(),this.routingLatencies.clear(),this.stats.routingRequests=0,this.stats.totalRoutingLatency=0,this.stats.learningOutcomes=0,this.stats.successfulOutcomes=0,this.initialized=!1,o.info("Disposed")}async destroy(){return this.dispose()}};function Ie(Q={},e){return new k(Q,e)}export{Ie as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
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.15.
|
|
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.15.13");process.exit(0)}
|
|
2
2
|
var i={copilot:{id:"copilot",name:"GitHub Copilot",configPath:".vscode/mcp.json",configFormat:"json",configKey:"servers",rulesPath:".github/copilot-instructions.md",rulesFormat:"markdown",supportsAutoApprove:!1,supportsCustomModes:!1,globalConfig:!1},cursor:{id:"cursor",name:"Cursor",configPath:".cursor/mcp.json",configFormat:"json",configKey:"mcpServers",rulesPath:".cursorrules",rulesFormat:"markdown",supportsAutoApprove:!1,supportsCustomModes:!1,globalConfig:!1},cline:{id:"cline",name:"Cline",configPath:".vscode/cline_mcp_settings.json",configFormat:"json",configKey:"mcpServers",rulesPath:".vscode/cline_custom_modes.json",rulesFormat:"json",supportsAutoApprove:!0,supportsCustomModes:!0,globalConfig:!1},kilocode:{id:"kilocode",name:"Kilo Code",configPath:".kilocode/mcp.json",configFormat:"json",configKey:"mcpServers",rulesPath:".kilocode/modes.json",rulesFormat:"json",supportsAutoApprove:!0,supportsCustomModes:!0,globalConfig:!1},roocode:{id:"roocode",name:"Roo Code",configPath:".roo/mcp.json",configFormat:"json",configKey:"mcpServers",rulesPath:".roo/modes.json",rulesFormat:"json",supportsAutoApprove:!0,supportsCustomModes:!0,globalConfig:!1},codex:{id:"codex",name:"OpenAI Codex CLI",configPath:".codex/config.toml",configFormat:"toml",configKey:"mcp_servers",rulesPath:"AGENTS.md",rulesFormat:"markdown",supportsAutoApprove:!1,supportsCustomModes:!1,globalConfig:!1},windsurf:{id:"windsurf",name:"Windsurf",configPath:".windsurf/mcp_config.json",configFormat:"json",configKey:"mcpServers",rulesPath:".windsurfrules",rulesFormat:"markdown",supportsAutoApprove:!1,supportsCustomModes:!1,globalConfig:!1},continuedev:{id:"continuedev",name:"Continue.dev",configPath:".continue/config.yaml",configFormat:"yaml",configKey:"mcpServers",rulesPath:".continue/rules/aqe-qe-standards.yaml",rulesFormat:"yaml",supportsAutoApprove:!1,supportsCustomModes:!1,globalConfig:!1}},l=["fleet_init","fleet_status","fleet_health","agent_list","agent_metrics","agent_status","team_list","team_health","task_list","task_status","test_generate_enhanced","coverage_analyze_sublinear","quality_assess","defect_predict","code_index","memory_store","memory_retrieve","memory_query","memory_usage","model_route","routing_metrics","aqe_health"];function u(t){return t?{AQE_MEMORY_BACKEND:"memory",AQE_V3_MODE:"true"}:{AQE_MEMORY_PATH:".agentic-qe/memory.db",AQE_V3_MODE:"true"}}function m(t,o){let e={command:"npx",args:["-y","agentic-qe@latest","mcp"],env:u(o)};return t&&(e.disabled=!1,e.alwaysAllow=l),e}function g(t,o){let e=m(t.supportsAutoApprove,o);if(t.id==="copilot"){let r={[t.configKey]:{"agentic-qe":{type:"stdio",...e}}};return JSON.stringify(r,null,2)+`
|
|
3
3
|
`}let n={[t.configKey]:{"agentic-qe":e}};return JSON.stringify(n,null,2)+`
|
|
4
4
|
`}function f(t){return`# Agentic QE MCP Server
|
|
@@ -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.15.
|
|
2
|
-
import{S as f,b as p}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.15.13");process.exit(0)}
|
|
2
|
+
import{S as f,b as p}from"./chunk-WOCGL4QP.js";f();var y={predictionWindowSize:10,compressionThreshold:.3,maxConcurrentStreams:8,oscillationFrequencyMs:100};function d(s){try{return JSON.stringify(s).length}catch{return 0}}function w(s,t){let e={},n=!1;for(let r of Object.keys(t))JSON.stringify(s[r])!==JSON.stringify(t[r])&&(e[r]=t[r],n=!0);for(let r of Object.keys(s))r in t||(e[r]=void 0,n=!0);return n?e:null}function v(s,t){let e={...s};for(let[n,r]of Object.entries(t))r===void 0?delete e[n]:e[n]=r;return e}var l=class{windowSize;windows=new Map;constructor(t){this.windowSize=Math.max(1,t)}predict(t){let e=this.windows.get(t);if(!e||e.length===0)return null;let n=e[e.length-1];return typeof n!="object"||n===null||Array.isArray(n)?null:{...n}}record(t,e){let n=this.windows.get(t);n||(n=[],this.windows.set(t,n)),n.push(e),n.length>this.windowSize&&n.shift()}removeStream(t){this.windows.delete(t)}},h=class{maxStreams;cycleMs;streamIds=[];currentIndex=0;constructor(t,e){this.maxStreams=Math.max(1,t),this.cycleMs=Math.max(1,e)}addStream(t){return this.streamIds.includes(t)||this.streamIds.length>=this.maxStreams?!1:(this.streamIds.push(t),!0)}removeStream(t){let e=this.streamIds.indexOf(t);return e===-1?!1:(this.streamIds.splice(e,1),this.currentIndex>=this.streamIds.length&&(this.currentIndex=0),!0)}nextStream(){if(this.streamIds.length===0)return null;let t=this.streamIds[this.currentIndex];return this.currentIndex=(this.currentIndex+1)%this.streamIds.length,t}getActiveStreams(){return[...this.streamIds]}get activeCount(){return this.streamIds.length}},g=class{config;predictor;router;lastPayloads=new Map;totalMessages=0;compressedMessages=0;totalOriginalBytes=0;totalCompressedBytes=0;constructor(t){this.config={...y,...t},this.predictor=new l(this.config.predictionWindowSize),this.router=new h(this.config.maxConcurrentStreams,this.config.oscillationFrequencyMs)}send(t,e,n,r){this.totalMessages++;let i=d(r);this.totalOriginalBytes+=i;let c=!1,o=r,a=i;if(typeof r=="object"&&r!==null&&!Array.isArray(r)){let m=this.predictor.predict(t);if(m){let u=w(m,r);u?1-d(u)/Math.max(i,1)>=this.config.compressionThreshold&&(o={__delta:!0,__changes:u},a=d(o),c=!0,this.compressedMessages++):(o={__delta:!0,__changes:{}},a=d(o),c=!0,this.compressedMessages++)}}return this.totalCompressedBytes+=a,this.predictor.record(t,r),this.lastPayloads.set(t,r),{streamId:t,senderId:e,receiverId:n,payload:o,compressed:c,originalSize:i,compressedSize:a,timestamp:Date.now()}}receive(t){if(!t.compressed||typeof t.payload!="object"||t.payload===null)return this.lastPayloads.set(t.streamId,t.payload),this.predictor.record(t.streamId,t.payload),t.payload;let e=t.payload;if(!e.__delta)return this.lastPayloads.set(t.streamId,t.payload),this.predictor.record(t.streamId,t.payload),t.payload;let n=this.predictor.predict(t.streamId),r=e.__changes??{};if(!n)return r;let i=v(n,r);return this.predictor.record(t.streamId,i),this.lastPayloads.set(t.streamId,i),i}getStats(){let t=this.totalOriginalBytes-this.totalCompressedBytes;return{totalMessages:this.totalMessages,compressedMessages:this.compressedMessages,bandwidthSavedBytes:Math.max(0,t),bandwidthReductionPercent:this.totalOriginalBytes>0?Math.max(0,t)/this.totalOriginalBytes*100:0,activeStreams:this.router.activeCount}}addStream(t){this.router.addStream(t)}removeStream(t){this.router.removeStream(t),this.predictor.removeStream(t),this.lastPayloads.delete(t)}};function M(s){return S()?new g(s):null}function S(){return p().useCognitiveRouting}export{M as a,S as b};
|
|
@@ -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.15.
|
|
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.15.13");process.exit(0)}
|
|
2
2
|
import{readFileSync as l,writeFileSync as c,mkdirSync as m,renameSync as u}from"node:fs";import{join as d,dirname as h}from"node:path";import{homedir as p}from"node:os";var C={maxCallsPerSession:10},S=d(p(),".agentic-qe","advisor","circuit-breaker.json"),x=1440*60*1e3,n=class{maxCalls;statePath;constructor(t){this.maxCalls=t?.maxCallsPerSession??C.maxCallsPerSession,this.statePath=t?.statePath??S}acquire(t){let e=this.load(),a=e.sessions[t]?.count??0;if(a>=this.maxCalls)throw new i(`Advisor circuit breaker tripped: ${a} calls in session "${t}" (max: ${this.maxCalls}). Do not retry \u2014 continue without the advisor.`,t,a,this.maxCalls);let r=a+1;return e.sessions[t]={count:r,lastUpdated:new Date().toISOString()},this.save(e),{sessionId:t,callCount:r,maxCalls:this.maxCalls,remaining:this.maxCalls-r,tripped:!1}}getState(t){let s=this.load().sessions[t]?.count??0;return{sessionId:t,callCount:s,maxCalls:this.maxCalls,remaining:this.maxCalls-s,tripped:s>=this.maxCalls}}reset(t){if(t){let e=this.load();delete e.sessions[t],this.save(e)}else this.save({sessions:{}})}load(){try{let t=l(this.statePath,"utf-8"),e=JSON.parse(t);return this.evictStale(e),e}catch{return{sessions:{}}}}save(t){try{m(h(this.statePath),{recursive:!0});let e=this.statePath+".tmp."+process.pid;c(e,JSON.stringify(t,null,2)),u(e,this.statePath)}catch{}}evictStale(t){let e=Date.now();for(let[s,a]of Object.entries(t.sessions))e-new Date(a.lastUpdated).getTime()>x&&delete t.sessions[s]}},i=class extends Error{constructor(e,s,a,r){super(e);this.sessionId=s;this.callCount=a;this.maxCalls=r;this.name="AdvisorCircuitBreakerError"}sessionId;callCount;maxCalls;exitCode=3};export{n as a,i as b};
|
|
@@ -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.15.
|
|
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.15.13");process.exit(0)}
|
|
2
2
|
import t from"chalk";function l(e){switch(e){case"healthy":case"completed":return t.green(e);case"idle":return t.cyan(e);case"degraded":case"running":return t.yellow(e);case"unhealthy":case"failed":return t.red(e);default:return t.gray(e)}}function c(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${(e/6e4).toFixed(1)}m`:`${(e/36e5).toFixed(1)}h`}function d(e){let r=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),o=Math.floor(e%6e4/1e3);return`${r}h ${n}m ${o}s`}export{l as a,c as b,d as c};
|
|
@@ -1,3 +1,3 @@
|
|
|
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.15.
|
|
2
|
-
import{a as f,b as u,d as m}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.15.13");process.exit(0)}
|
|
2
|
+
import{a as f,b as u,d as m}from"./chunk-UOC3O6RP.js";import{b as c}from"./chunk-ZAKQLAHT.js";function v(s){switch(s.toUpperCase()){case"DEBUG":return 0;case"INFO":return 1;case"WARN":case"WARNING":return 2;case"ERROR":return 3;case"SILENT":case"NONE":case"OFF":return 4;default:return 1}}var d,l=c(()=>{"use strict";d={0:"DEBUG",1:"INFO",2:"WARN",3:"ERROR",4:"SILENT"}});var a,r,g,h=c(()=>{"use strict";l();m();a={includeTimestamp:!0,includeLevel:!0,timestampFormat:"short",prettyPrint:!1,maxContextDepth:3},r=class s{domain;level;config;inheritedContext;constructor(e,t=1,n={},o={}){this.domain=e,this.level=t,this.config={...a,...n},this.inheritedContext=o}debug(e,t){this.level<=0&&this.output(0,e,t)}info(e,t){this.level<=1&&this.output(1,e,t)}warn(e,t){this.level<=2&&this.output(2,e,t)}error(e,t,n){if(this.level<=3){let o={...n};if(t){o.errorName=t.name,o.errorMessage=t.message,t.stack&&(o.stack=t.stack);let i=t;i.cause!==void 0&&(o.cause=i.cause)}this.output(3,e,o)}}isEnabled(e){return this.level<=e}getDomain(){return this.domain}child(e){return new s(this.domain,this.level,this.config,{...this.inheritedContext,...e})}output(e,t,n){let o=this.format(e,t,n);switch(e){case 0:console.debug(o);break;case 1:console.info(o);break;case 2:console.warn(o);break;case 3:console.error(o);break}}format(e,t,n){let o=[];this.config.includeTimestamp&&o.push(this.formatTimestamp()),this.config.includeLevel&&o.push(this.formatLevel(e)),o.push(`[${this.domain}]`),o.push(f(t));let i=this.mergeContext(n);return i&&Object.keys(i).length>0&&o.push(this.formatContext(i)),o.join(" ")}formatTimestamp(){let e=new Date;if(this.config.timestampFormat==="iso")return`[${e.toISOString()}]`;let t=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0"),i=String(e.getMilliseconds()).padStart(3,"0");return`[${t}:${n}:${o}.${i}]`}formatLevel(e){return`[${d[e].padEnd(5)}]`}mergeContext(e){if(!(!e&&Object.keys(this.inheritedContext).length===0))return{...this.inheritedContext,...e}}formatContext(e){try{let t=u(e,{maxDepth:this.config.maxContextDepth+1});return this.config.prettyPrint?`
|
|
3
3
|
`+JSON.stringify(t,null,2):JSON.stringify(t)}catch{return"[unserializable context]"}}},g=class{domain;constructor(e="null"){this.domain=e}debug(e,t){}info(e,t){}warn(e,t){}error(e,t,n){}isEnabled(e){return!1}getDomain(){return this.domain}child(e){return this}}});function w(s,e){return L.create(s,e)}var C,L,x=c(()=>{"use strict";l();h();C={defaultLevel:1,domainLevels:new Map,consoleConfig:a,silent:!1},L=class{static config={...C};static customProvider=null;static instances=new Map;static setLevel(e){this.config.defaultLevel=e,this.instances.clear()}static setLevelFromString(e){this.setLevel(v(e))}static getLevel(){return this.config.defaultLevel}static setDomainLevel(e,t){this.config.domainLevels.set(e,t),this.instances.delete(e)}static getDomainLevel(e){return this.config.domainLevels.get(e)??this.config.defaultLevel}static clearDomainLevel(e){this.config.domainLevels.delete(e),this.instances.delete(e)}static configure(e){this.config.consoleConfig={...this.config.consoleConfig,...e},this.instances.clear()}static setSilent(e){this.config.silent=e,this.instances.clear()}static isSilent(){return this.config.silent}static setProvider(e){this.customProvider=e,this.instances.clear()}static create(e,t){if(!t&&this.instances.has(e))return this.instances.get(e);let n=this.getDomainLevel(e),o;return this.config.silent?o=new g(e):this.customProvider?o=this.customProvider(e,n,t):o=new r(e,n,this.config.consoleConfig,t),t||this.instances.set(e,o),o}static getLogger(e,t){return this.create(e,t)}static reset(){this.config={defaultLevel:1,domainLevels:new Map,consoleConfig:{...a},silent:!1},this.customProvider=null,this.instances.clear()}static initFromEnv(){let e=process.env.LOG_LEVEL;e&&this.setLevelFromString(e);let t=process.env.LOG_TIMESTAMP;t!==void 0&&this.configure({includeTimestamp:t.toLowerCase()==="true"});let n=process.env.LOG_PRETTY;n!==void 0&&this.configure({prettyPrint:n.toLowerCase()==="true"})}static getStats(){return{cachedLoggers:this.instances.size,domains:Array.from(this.instances.keys()),domainOverrides:this.config.domainLevels.size,currentLevel:this.config.defaultLevel,silent:this.config.silent}}}});export{l as a,h as b,L as c,w as d,x as e};
|
|
@@ -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.15.
|
|
2
|
-
import{c as k,d as p}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.15.13");process.exit(0)}
|
|
2
|
+
import{c as k,d as p}from"./chunk-J2ZIFFM6.js";p();import{generateKeyPairSync as g,createPrivateKey as v,createPublicKey as I,sign as m,verify as D,createHash as b}from"crypto";import{existsSync as d,mkdirSync as P,writeFileSync as y,readFileSync as o,readdirSync as w}from"fs";import{join as n}from"path";var f=class{keys=new Map;activeKeyId=null;keyDir;constructor(e={}){this.keyDir=e.keyDir??null,this.keyDir&&this.loadFromDisk(),e.autoGenerate!==!1&&this.keys.size===0&&this.generateKeyPair()}generateKeyPair(){let{publicKey:e,privateKey:i}=g("ed25519"),r=e.export({type:"spki",format:"der"}),t=b("sha256").update(r).digest("hex").slice(0,16),s={keyId:t,publicKey:e,privateKey:i,createdAt:new Date().toISOString(),retired:!1};return this.keys.set(t,s),this.activeKeyId=t,this.keyDir&&(this.saveKeyPairToDisk(s),this.saveActiveKeyId()),{keyId:t,publicKey:r}}sign(e,i){let r=i??this.activeKeyId;if(!r)throw new Error("No active key available for signing");let t=this.keys.get(r);if(!t)throw new Error(`Key not found: ${r}`);return{signature:m(null,e,t.privateKey),keyId:r}}verify(e,i,r){let t=this.keys.get(r);if(!t)return!1;try{return D(null,e,t.publicKey,i)}catch{return!1}}rotateKey(){let e=this.activeKeyId;if(!e)throw new Error("No active key to rotate");let i=this.keys.get(e);i&&(i.retired=!0,this.keyDir&&this.saveKeyPairToDisk(i));let{keyId:r}=this.generateKeyPair();return{oldKeyId:e,newKeyId:r}}getActiveKeyId(){if(!this.activeKeyId)throw new Error("No active key");return this.activeKeyId}hasKey(e){return this.keys.has(e)}getKeyCount(){return this.keys.size}saveKeyPairToDisk(e){if(!this.keyDir)return;d(this.keyDir)||P(this.keyDir,{recursive:!0});let i=n(this.keyDir,e.keyId);y(`${i}.pub.pem`,e.publicKey.export({type:"spki",format:"pem"}),"utf-8"),y(`${i}.key.pem`,e.privateKey.export({type:"pkcs8",format:"pem"}),{encoding:"utf-8",mode:384}),y(`${i}.meta.json`,JSON.stringify({keyId:e.keyId,createdAt:e.createdAt,retired:e.retired}),"utf-8")}saveActiveKeyId(){!this.keyDir||!this.activeKeyId||y(n(this.keyDir,"active-key-id"),this.activeKeyId,"utf-8")}loadFromDisk(){if(!this.keyDir||!d(this.keyDir))return;let i=w(this.keyDir).filter(t=>t.endsWith(".meta.json"));for(let t of i)try{let s=JSON.parse(o(n(this.keyDir,t),"utf-8")),a=n(this.keyDir,s.keyId),l=o(`${a}.pub.pem`,"utf-8"),K=o(`${a}.key.pem`,"utf-8"),h={keyId:s.keyId,publicKey:I(l),privateKey:v(K),createdAt:s.createdAt,retired:s.retired};this.keys.set(s.keyId,h)}catch{}let r=n(this.keyDir,"active-key-id");if(d(r)){let t=o(r,"utf-8").trim();this.keys.has(t)&&(this.activeKeyId=t)}if(!this.activeKeyId){let t=[...this.keys.values()].filter(s=>!s.retired).sort((s,a)=>a.createdAt.localeCompare(s.createdAt));t.length>0&&(this.activeKeyId=t[0].keyId)}}},c=null;function F(){if(!c){let u=n(k(),".agentic-qe","witness-keys");c=new f({keyDir:u})}return c}function O(){c=null}export{f as a,F as b,O 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.15.
|
|
2
|
-
import{a as Le,c as Re}from"./chunk-M7XFBSIK.js";import{g as Se}from"./chunk-OD5D4LSZ.js";import{d as Ce}from"./chunk-SMVVAVN2.js";import{a as Pe,b as $e}from"./chunk-S6IYEBAI.js";import{m as Ie,n as je}from"./chunk-5MNASJOH.js";import{b as D,d as we}from"./chunk-JFLU7L3W.js";import{c as R,d as I}from"./chunk-IW6WDGHM.js";import{a as ke}from"./chunk-IO5537OM.js";import{c as xe,d as ve,e as Oe}from"./chunk-FZHSG75I.js";import{c as Ee,d as _e}from"./chunk-EH2S6AOR.js";import{a as G,b as A,e as Y}from"./chunk-DDEOZPWJ.js";ke();import{createRequire as Ke}from"module";var O;function W(){if(!O){let u=Ke(import.meta.url);try{O=u("typescript")}catch{try{O=u("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 m=new Proxy({},{get(u,e){return W()[e]},has(u,e){return e in W()},ownKeys(){return Object.keys(W())},getOwnPropertyDescriptor(u,e){let t=W()[e];if(t!==void 0)return{configurable:!0,enumerable:!0,value:t}}});var N=class{parseFile(e,t){return m.createSourceFile(e,t,m.ScriptTarget.Latest,!0,this.getScriptKind(e))}extractFunctions(e){let t=[],s=n=>{m.isFunctionDeclaration(n)&&n.name?t.push(this.extractFunctionDeclaration(n,e)):m.isVariableStatement(n)&&this.extractArrowFunctions(n,e,t),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractClasses(e){let t=[],s=n=>{m.isClassDeclaration(n)&&n.name&&t.push(this.extractClassDeclaration(n,e)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractImports(e){let t=[],s=n=>{m.isImportDeclaration(n)&&t.push(this.extractImportDeclaration(n)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractExports(e){let t=[],s=n=>{if(m.isExportDeclaration(n))this.extractExportDeclaration(n,t);else if(m.isExportAssignment(n))t.push({name:this.getExportAssignmentName(n),type:"unknown",isDefault:!0,isReexport:!1,sourceModule:void 0});else if(m.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(m.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(m.isVariableStatement(n)&&this.hasExportModifier(n))for(let i of n.declarationList.declarations)m.isIdentifier(i.name)&&t.push({name:i.name.text,type:"variable",isDefault:!1,isReexport:!1,sourceModule:void 0});else m.isInterfaceDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"interface",isDefault:!1,isReexport:!1,sourceModule:void 0}):m.isTypeAliasDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"type",isDefault:!1,isReexport:!1,sourceModule:void 0}):m.isEnumDeclaration(n)&&this.hasExportModifier(n)&&t.push({name:n.name.text,type:"enum",isDefault:!1,isReexport:!1,sourceModule:void 0});m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractInterfaces(e){let t=[],s=n=>{m.isInterfaceDeclaration(n)&&t.push(this.extractInterfaceDeclaration(n,e)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractEntities(e,t){let s=this.parseFile(t,e),n=[],i=this.extractFunctions(s);for(let a of i)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 r=this.extractInterfaces(s);for(let a of r)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")?m.ScriptKind.TSX:e.endsWith(".ts")?m.ScriptKind.TS:e.endsWith(".jsx")?m.ScriptKind.JSX:e.endsWith(".js")?m.ScriptKind.JS:m.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(m.isIdentifier(n.name)&&n.initializer&&m.isArrowFunction(n.initializer)){let i=n.initializer,{line:o}=t.getLineAndCharacterOfPosition(e.getStart()),{line:r}=t.getLineAndCharacterOfPosition(e.getEnd());s.push({name:n.name.text,parameters:this.extractParameters(i.parameters),returnType:i.type?i.type.getText(t):void 0,startLine:o+1,endLine:r+1,isAsync:this.hasAsyncModifier(i),isExported:this.hasExportModifier(e),isGenerator:!1,typeParameters:this.extractTypeParameters(i.typeParameters)})}}extractClassDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),i=[],o=[];for(let c of e.members)m.isMethodDeclaration(c)&&c.name?i.push(this.extractMethodDeclaration(c,t)):m.isPropertyDeclaration(c)&&c.name?o.push(this.extractPropertyDeclaration(c,t)):m.isConstructorDeclaration(c)&&(i.push(this.extractConstructor(c,t)),this.extractParameterProperties(c,o,t));let r,a=[];if(e.heritageClauses){for(let c of e.heritageClauses)if(c.token===m.SyntaxKind.ExtendsKeyword)r=c.types[0]?.expression.getText(t);else if(c.token===m.SyntaxKind.ImplementsKeyword)for(let l of c.types)a.push(l.expression.getText(t))}return{name:e.name?.text??"anonymous",methods:i,properties:o,extends:r,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:m.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===m.SyntaxKind.PublicKeyword||t.kind===m.SyntaxKind.PrivateKeyword||t.kind===m.SyntaxKind.ProtectedKeyword||t.kind===m.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,i,o=e.importClause?.isTypeOnly??!1;if(e.importClause&&(e.importClause.name&&(n=e.importClause.name.text),e.importClause.namedBindings)){if(m.isNamespaceImport(e.importClause.namedBindings))i=e.importClause.namedBindings.name.text;else if(m.isNamedImports(e.importClause.namedBindings))for(let r of e.importClause.namedBindings.elements)s.push({name:r.propertyName?.text??r.name.text,alias:r.propertyName?r.name.text:void 0})}return{module:t,namedImports:s,defaultImport:n,namespaceImport:i,isTypeOnly:o}}extractExportDeclaration(e,t){let s=e.moduleSpecifier?e.moduleSpecifier.text:void 0;if(e.exportClause&&m.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()),i=[],o=[];for(let a of e.members)m.isPropertySignature(a)&&a.name?i.push({name:this.getPropertyName(a.name,t),type:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken,isReadonly:this.hasReadonlyModifier(a)}):m.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 r=[];if(e.heritageClauses){for(let a of e.heritageClauses)if(a.token===m.SyntaxKind.ExtendsKeyword)for(let c of a.types)r.push(c.expression.getText(t))}return{name:e.name.text,properties:i,methods:o,extends:r,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:m.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 m.isIdentifier(e)||m.isStringLiteral(e)||m.isNumericLiteral(e)?e.text:e.getText(t)}getExportAssignmentName(e){return m.isIdentifier(e.expression)?e.expression.text:"default"}hasExportModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.ExportKeyword)}hasDefaultModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.DefaultKeyword)}hasAsyncModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.AsyncKeyword)}hasStaticModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.StaticKeyword)}hasAbstractModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.AbstractKeyword)}hasReadonlyModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.ReadonlyKeyword)}getVisibility(e){if(!m.canHaveModifiers(e))return"public";let t=m.getModifiers(e);return t?t.some(s=>s.kind===m.SyntaxKind.PrivateKeyword)?"private":t.some(s=>s.kind===m.SyntaxKind.ProtectedKeyword)?"protected":"public":"public"}},it=new N,Z=class{language="typescript";supportedExtensions=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];parser=new N;async parseFile(e,t){let s=this.parser.parseFile(t,e),n=this.parser.extractFunctions(s),i=this.parser.extractClasses(s),o=this.parser.extractImports(s);return{functions:n.map(r=>this.mapFunction(r)),classes:i.map(r=>this.mapClass(r)),imports:o.map(r=>this.mapImport(r)),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}}},rt=new Z;Oe();var P=1e3;function L(u){let e=u.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.15.13");process.exit(0)}
|
|
2
|
+
import{a as Le,c as Re}from"./chunk-PB6J6HAA.js";import{g as Se}from"./chunk-NZ3GUMB2.js";import{d as Ce}from"./chunk-LZYQHVD4.js";import{a as Pe,b as $e}from"./chunk-QPNG5ZN2.js";import{m as Ie,n as je}from"./chunk-P7A4NKTZ.js";import{b as D,d as we}from"./chunk-VTOBUZL6.js";import{c as R,d as I}from"./chunk-NURIILUB.js";import{a as ke}from"./chunk-UT2VZ33P.js";import{c as xe,d as ve,e as Oe}from"./chunk-GB6HBNH2.js";import{c as Ee,d as _e}from"./chunk-J2ZIFFM6.js";import{a as G,b as A,e as Y}from"./chunk-3Y2ROSCL.js";ke();import{createRequire as Ke}from"module";var O;function W(){if(!O){let u=Ke(import.meta.url);try{O=u("typescript")}catch{try{O=u("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 m=new Proxy({},{get(u,e){return W()[e]},has(u,e){return e in W()},ownKeys(){return Object.keys(W())},getOwnPropertyDescriptor(u,e){let t=W()[e];if(t!==void 0)return{configurable:!0,enumerable:!0,value:t}}});var N=class{parseFile(e,t){return m.createSourceFile(e,t,m.ScriptTarget.Latest,!0,this.getScriptKind(e))}countSyntaxErrors(e){let t={noLib:!0,noResolve:!0,allowJs:!0,types:[]},s=m.createCompilerHost(t);return s.getSourceFile=()=>e,m.createProgram({rootNames:[e.fileName],options:t,host:s}).getSyntacticDiagnostics(e).length}extractFunctions(e){let t=[],s=n=>{m.isFunctionDeclaration(n)&&n.name?t.push(this.extractFunctionDeclaration(n,e)):m.isVariableStatement(n)&&this.extractArrowFunctions(n,e,t),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractClasses(e){let t=[],s=n=>{m.isClassDeclaration(n)&&n.name&&t.push(this.extractClassDeclaration(n,e)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractImports(e){let t=[],s=n=>{m.isImportDeclaration(n)&&t.push(this.extractImportDeclaration(n)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractExports(e){let t=[],s=n=>{if(m.isExportDeclaration(n))this.extractExportDeclaration(n,t);else if(m.isExportAssignment(n))t.push({name:this.getExportAssignmentName(n),type:"unknown",isDefault:!0,isReexport:!1,sourceModule:void 0});else if(m.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(m.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(m.isVariableStatement(n)&&this.hasExportModifier(n))for(let i of n.declarationList.declarations)m.isIdentifier(i.name)&&t.push({name:i.name.text,type:"variable",isDefault:!1,isReexport:!1,sourceModule:void 0});else m.isInterfaceDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"interface",isDefault:!1,isReexport:!1,sourceModule:void 0}):m.isTypeAliasDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"type",isDefault:!1,isReexport:!1,sourceModule:void 0}):m.isEnumDeclaration(n)&&this.hasExportModifier(n)&&t.push({name:n.name.text,type:"enum",isDefault:!1,isReexport:!1,sourceModule:void 0});m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractInterfaces(e){let t=[],s=n=>{m.isInterfaceDeclaration(n)&&t.push(this.extractInterfaceDeclaration(n,e)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractEntities(e,t){let s=this.parseFile(t,e),n=[],i=this.extractFunctions(s);for(let a of i)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 r=this.extractInterfaces(s);for(let a of r)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")?m.ScriptKind.TSX:e.endsWith(".ts")?m.ScriptKind.TS:e.endsWith(".jsx")?m.ScriptKind.JSX:/\.(js|mjs|cjs)$/.test(e)?m.ScriptKind.JS:m.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(m.isIdentifier(n.name)&&n.initializer&&m.isArrowFunction(n.initializer)){let i=n.initializer,{line:o}=t.getLineAndCharacterOfPosition(e.getStart()),{line:r}=t.getLineAndCharacterOfPosition(e.getEnd());s.push({name:n.name.text,parameters:this.extractParameters(i.parameters),returnType:i.type?i.type.getText(t):void 0,startLine:o+1,endLine:r+1,isAsync:this.hasAsyncModifier(i),isExported:this.hasExportModifier(e),isGenerator:!1,typeParameters:this.extractTypeParameters(i.typeParameters)})}}extractClassDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),i=[],o=[];for(let c of e.members)m.isMethodDeclaration(c)&&c.name?i.push(this.extractMethodDeclaration(c,t)):m.isPropertyDeclaration(c)&&c.name?o.push(this.extractPropertyDeclaration(c,t)):m.isConstructorDeclaration(c)&&(i.push(this.extractConstructor(c,t)),this.extractParameterProperties(c,o,t));let r,a=[];if(e.heritageClauses){for(let c of e.heritageClauses)if(c.token===m.SyntaxKind.ExtendsKeyword)r=c.types[0]?.expression.getText(t);else if(c.token===m.SyntaxKind.ImplementsKeyword)for(let l of c.types)a.push(l.expression.getText(t))}return{name:e.name?.text??"anonymous",methods:i,properties:o,extends:r,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:m.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===m.SyntaxKind.PublicKeyword||t.kind===m.SyntaxKind.PrivateKeyword||t.kind===m.SyntaxKind.ProtectedKeyword||t.kind===m.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,i,o=e.importClause?.isTypeOnly??!1;if(e.importClause&&(e.importClause.name&&(n=e.importClause.name.text),e.importClause.namedBindings)){if(m.isNamespaceImport(e.importClause.namedBindings))i=e.importClause.namedBindings.name.text;else if(m.isNamedImports(e.importClause.namedBindings))for(let r of e.importClause.namedBindings.elements)s.push({name:r.propertyName?.text??r.name.text,alias:r.propertyName?r.name.text:void 0})}return{module:t,namedImports:s,defaultImport:n,namespaceImport:i,isTypeOnly:o}}extractExportDeclaration(e,t){let s=e.moduleSpecifier?e.moduleSpecifier.text:void 0;if(e.exportClause&&m.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()),i=[],o=[];for(let a of e.members)m.isPropertySignature(a)&&a.name?i.push({name:this.getPropertyName(a.name,t),type:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken,isReadonly:this.hasReadonlyModifier(a)}):m.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 r=[];if(e.heritageClauses){for(let a of e.heritageClauses)if(a.token===m.SyntaxKind.ExtendsKeyword)for(let c of a.types)r.push(c.expression.getText(t))}return{name:e.name.text,properties:i,methods:o,extends:r,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:m.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 m.isIdentifier(e)||m.isStringLiteral(e)||m.isNumericLiteral(e)?e.text:e.getText(t)}getExportAssignmentName(e){return m.isIdentifier(e.expression)?e.expression.text:"default"}hasExportModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.ExportKeyword)}hasDefaultModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.DefaultKeyword)}hasAsyncModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.AsyncKeyword)}hasStaticModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.StaticKeyword)}hasAbstractModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.AbstractKeyword)}hasReadonlyModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.ReadonlyKeyword)}getVisibility(e){if(!m.canHaveModifiers(e))return"public";let t=m.getModifiers(e);return t?t.some(s=>s.kind===m.SyntaxKind.PrivateKeyword)?"private":t.some(s=>s.kind===m.SyntaxKind.ProtectedKeyword)?"protected":"public":"public"}},it=new N,Z=class{language="typescript";supportedExtensions=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];parser=new N;async parseFile(e,t){let s=this.parser.parseFile(t,e),n=this.parser.extractFunctions(s),i=this.parser.extractClasses(s),o=this.parser.extractImports(s);return{functions:n.map(r=>this.mapFunction(r)),classes:i.map(r=>this.mapClass(r)),imports:o.map(r=>this.mapImport(r)),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}}},rt=new Z;Oe();var P=1e3;function L(u){let e=u.split(`
|
|
3
3
|
`),t=[],s=[],n="",i=0,o=0,r=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||(i=c+1),n=n?n+" "+d:l;for(let p of d)p==="("?o++:p===")"?o=Math.max(0,o-1):p==="<"?r++:p===">"?r=Math.max(0,r-1):p==="["?a++:p==="]"&&(a=Math.max(0,a-1));o===0&&r===0&&a===0&&(t.push(n),s.push(i),n="")}return n&&(t.push(n),s.push(i)),{logicalLines:t,lineMap:s}}function B(u,e,t="<",s=">"){if(u[e]!==t)return;let n=1,i=e+1;for(;i<u.length&&n>0;)u[i]===t?n++:u[i]===s&&n--,i++;if(n===0)return u.substring(e+1,i-1)}function M(u,e,t){let s=[];for(let n=e-1;n>=0;n--){let i=u[n].trim();if(i.startsWith(t))s.unshift(i);else{if(i===""||i.startsWith("//")||i.startsWith("*")||i.startsWith("#"))continue;break}}return s}function T(u){let e=[],t=0,s="";for(let n of u)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 de(u){let e=0,t=!1,s="";for(let n=0;n<u.length;n++){let i=u[n];if(t){i===s&&u[n-1]!=="\\"&&(t=!1);continue}i==='"'||i==="'"||i==="`"?(t=!0,s=i):i==="{"?e++:i==="}"&&e--}return e}var ee=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:i}=L(e),o=/^(\s*)(async\s+)?def\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*([^:]*\S))?\s*:/;for(let r=0;r<n.length;r++){if(n[r].length>P)continue;let a=n[r].match(o);if(a){let c=a[1].length,l=!!a[2],d=a[3],p=a[4],h=a[5]?.trim(),f=i[r]-1,y=f+1;for(let g=f+1;g<s.length;g++){let x=s[g];if(x.trim()===""||x.trim().startsWith("#"))continue;if((x.match(/^(\s*)/)?.[1].length??0)<=c&&x.trim()!==""){y=g;break}y=g+1}let b=M(s,f,"@");t.push({name:d,parameters:this.parseParams(p),returnType:h,isAsync:l,isPublic:!d.startsWith("_"),complexity:1,decorators:b,genericParams:[],startLine:i[r],endLine:y})}}return t}extractClasses(e){let t=[],s=e.split(`
|
|
5
5
|
`),{logicalLines:n,lineMap:i}=L(e),o=/^(\s*)class\s+(\w+)(?:\(([^)]*)\))?\s*:/;for(let r=0;r<n.length;r++){let a=n[r].match(o);if(a){let c=a[1].length,l=a[2],d=a[3]?a[3].split(",").map(g=>g.trim()):[],p=i[r]-1,h=p+1;for(let g=p+1;g<s.length;g++){let x=s[g];if(x.trim()===""||x.trim().startsWith("#"))continue;if((x.match(/^(\s*)/)?.[1].length??0)<=c&&x.trim()!==""){h=g;break}h=g+1}let f=s.slice(p+1,h).join(`
|
|
@@ -20,7 +20,7 @@ import{a as Le,c as Re}from"./chunk-M7XFBSIK.js";import{g as Se}from"./chunk-OD5
|
|
|
20
20
|
`),{logicalLines:n,lineMap:i}=L(e),o=/^\s*(public|private|protected|internal)?\s*(suspend)?\s*fun\s+(?:<[^{]*> +)?(\w+)\s*\(([^)]*)\)(?:\s*:\s*([^{=\s]+(?:\s+[^{=\s]+)*))?\s*/,r=0;for(let a=0;a<n.length;a++){let c=n[a];if(c.length>P){r+=(c.match(/\{/g)?.length??0)-(c.match(/\}/g)?.length??0);continue}let l=c.match(o);if(l&&r<=1){let d=l[1]||"public",p=!!l[2],h=l[3],f=l[4],y=l[5]?.trim();if(y&&y.includes("<")){let x=y.indexOf("<"),w=B(y,x);w!==void 0&&(y=y.substring(0,x)+"<"+w+">")}let b=i[a]-1,g=M(s,b,"@");t.push({name:h,parameters:this.parseParams(f),returnType:y,isAsync:p,isPublic:d==="public",complexity:1,decorators:g,genericParams:[],startLine:i[a],endLine:i[a]})}r+=de(c),r<0&&(r=0)}return t}extractClasses(e){let t=[],s=e.split(`
|
|
21
21
|
`),{logicalLines:n,lineMap:i}=L(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 r=0;r<n.length;r++){if(n[r].length>P)continue;let a=n[r].match(o);if(a){let c=a[3],l=a[4]?a[4].split(",").map(h=>h.trim().split("(")[0].trim()):[],d=i[r]-1,p=M(s,d,"@");t.push({name:c,methods:[],properties:[],isPublic:(a[1]||"public")==="public",implements:l.slice(1),extends:l[0]||void 0,decorators:p,startLine:i[r],endLine:i[r]})}}return t}extractImports(e){let t=[],s=e.split(`
|
|
22
22
|
`);for(let n of s){let i=n.match(/^\s*import\s+([^\s]+)/);i&&t.push({module:i[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){return e.trim()?T(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(),i=t.substring(s+1).trim(),o=i.indexOf("="),r=o>=0?i.substring(0,o).trim():i,a=o>=0;return{name:n,type:r,isOptional:a||r?.endsWith("?")||!1,defaultValue:void 0}}):[]}},oe=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}=L(e),i=/^\s*([\w<>,.?]+(?:\s+[\w<>,.?]+)*)\s+(\w+)\s*\(([^)]*)\)(?:\s*(async))?\s*\{/;for(let o=0;o<s.length;o++){let r=s[o];if(r.includes(" class ")||r.length>P)continue;let a=r.match(i);if(a){let c=a[1].trim(),l=c;if(c&&c.includes("<")){let f=c.indexOf("<"),y=B(c,f);y!==void 0&&(l=c.substring(0,f)+"<"+y+">")}let d=a[2],p=a[3],h=!!a[4]||l.includes("Future");t.push({name:d,parameters:this.parseParams(p),returnType:l==="void"?void 0:l,isAsync:h,isPublic:!d.startsWith("_"),complexity:1,decorators:[],genericParams:[],startLine:n[o],endLine:n[o]})}}return t}extractClasses(e){let t=[],{logicalLines:s,lineMap:n}=L(e),i=/^\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>P)continue;let r=s[o].match(i);if(r){let a=r[2],c=r[3],l=r[4]?r[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 i=n.match(/^\s*import\s+'([^']+)'/);i&&t.push({module:i[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){if(!e.trim())return[];let t=e.replace(/[{}[\]]/g,"");return T(t).map(s=>s.trim()).filter(s=>s).map(s=>{let n=s.replace("required ","").trim().split(/\s+/),i=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:i,type:o,isOptional:s.includes("?")||s.includes("{"),defaultValue:void 0}})}},z=ve("ParserRegistry"),Me=["python","java","csharp","rust","swift"],ce=class u{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<u.MAX_WASM_RETRIES)try{return await this.wasmParser.parseFile(e,t)}catch(s){this.wasmFailCount++;let n=s instanceof Error?s.message:String(s),i=this.wasmFailCount>=u.MAX_WASM_RETRIES;z.warn(`[${this.language}] tree-sitter WASM parser failed (attempt ${this.wasmFailCount}/${u.MAX_WASM_RETRIES}): ${n}. Falling back to regex parser (~97-98% accuracy). `+(i?"Set AQE_PARSER_REGEX_ONLY=1 to silence this warning.":"Will retry WASM on next parse."))}return this.regexParser.parseFile(e,t)}},le=class{parsers=new Map;_wasmInitPromise=null;constructor(){this.register(new ee),this.register(new te),this.register(new se),this.register(new ne),this.register(new ie),this.register(new re),this.register(new ae),this.register(new oe),this._wasmInitPromise=this._tryLoadWasmParsers()}async _tryLoadWasmParsers(){try{let e=await import("./tree-sitter-wasm-parser-TYRQRJ2W.js");if(!e.isWasmAvailable()){z.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 Me){let n=t.get(s),i=this.parsers.get(s);n&&i&&this.parsers.set(s,new ce(n,i))}z.info("tree-sitter WASM parsers available for: "+Me.join(", "))}catch{z.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)}},ct=new le;import*as C from"node:fs/promises";import*as E from"node:path";var Ue=[/\.\./,/%2e%2e/i,/%252e%252e/i,/\.\.%2f/i,/%2f\.\./i,/\.\.%5c/i,/\.\.\\/,/%c0%ae/i,/%c0%2f/i,/%c1%9c/i,/\0/,/%00/i],Ge=[/^\/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],pe=class{name="path-traversal";getRiskLevel(){return"critical"}validate(e,t={}){let{basePath:s="",allowAbsolute:n=!1,allowedExtensions:i=[],deniedExtensions:o=[".exe",".bat",".cmd",".sh",".ps1",".dll",".so"],maxDepth:r=10,maxLength:a=4096}=t;if(e.length>a)return{valid:!1,error:`Path exceeds maximum length of ${a}`,riskLevel:"medium"};for(let f of Ue)if(f.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 f of Ge)if(f.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>r)return{valid:!1,error:`Path depth exceeds maximum of ${r}`,riskLevel:"low"};let d=this.getExtension(c);if(d){let f=`.${d.toLowerCase()}`,y=d.toLowerCase();if(o.length>0&&o.some(g=>g.toLowerCase()===f||g.toLowerCase()===y))return{valid:!1,error:`File extension '${d}' is not allowed`,riskLevel:"high"};if(i.length>0&&!i.some(g=>g.toLowerCase()===f||g.toLowerCase()===y))return{valid:!1,error:`File extension '${d}' is not in allowed list`,riskLevel:"medium"}}let p=s?this.joinPathsAbsolute(s,c):c,h=s.startsWith("/")?`/${this.normalizePath(s)}`:this.normalizePath(s);return s&&!p.startsWith(h)?{valid:!1,error:"Path escapes base directory",riskLevel:"critical"}:{valid:!0,normalizedPath:p,riskLevel:"none"}}normalizePath(e){let t=e.replace(/\\/g,"/");t=t.replace(/\/+/g,"/");let s=t.split("/"),n=[];for(let i of s)i==="."||i===""||(i===".."?n.length>0&&n[n.length-1]!==".."&&n.pop():n.push(i));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}},We=new pe,Te=(u,e)=>We.validate(u,e);we();var Fe=[".exe",".bat",".cmd",".ps1",".dll",".so"],F=class extends Error{constructor(t,s,n,i){super(t);this.filePath=s;this.code=n;this.cause=i;this.name="FileReadError"}filePath;code;cause},V=class extends Error{constructor(t,s,n){super(t);this.filePath=s;this.cause=n;this.name="JsonParseError"}filePath;cause},S=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};function ue(u,e){let t=u,s;switch(t.code){case"ENOENT":s="File not found: "+e;break;case"EACCES":s="Permission denied: "+e;break;case"EISDIR":s="Path is a directory: "+e;break;default:s="Failed to read file: "+e}return new F(s,e,t.code,t)}function ze(u,e){let t=E.relative(u,e);return t===""||!t.startsWith(`..${E.sep}`)&&t!==".."&&!E.isAbsolute(t)}var me=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,i)=>{e-n.timestamp>this.ttlMs&&s.push(i)}),s.forEach(n=>{this.delete(n),t++}),t}};function Be(u){let e="",t=0;for(;t<u.length;){let s=u[t],n=u[t+1];s==="*"&&n==="*"?u[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 Ae(u,e,t,s){try{let n=await C.readdir(u,{withFileTypes:!0});for(let i of n){let o=E.join(u,i.name),r=E.relative(s,o);if(i.isDirectory())i.name!=="node_modules"&&!i.name.startsWith(".")&&await Ae(o,e,t,s);else if(i.isFile()){let a=r.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;projectRoot;projectRootReal;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.projectRoot=e.projectRoot?E.resolve(e.projectRoot):void 0,this.cache=new me(e.maxCacheSize??100,e.cacheTtlMs??300*1e3)}resolvePath(e){let t=E.isAbsolute(e),s=E.resolve(this.basePath),n=E.resolve(s,e),i=E.relative(s,n);if(this.basePath&&(i===".."||i.startsWith(`..${E.sep}`)||E.isAbsolute(i)))throw new S(e,["Path escapes base directory"],"critical");let o=this.basePath?s.split(/[\\/]/).filter(Boolean).length:0,r=Te(e,{basePath:t?"":this.basePath,allowAbsolute:!0,maxDepth:10+(t?o:0),deniedExtensions:Fe});if(!r.valid)throw new S(e,[r.error||"Path validation failed"],r.riskLevel);return t?n:r.normalizedPath?r.normalizedPath:t?e:E.resolve(this.basePath,e)}async inProjectRoot(e){if(!this.projectRoot)return;if(e.includes("\0"))throw new S(e,["Null byte in path"],"critical");let t=E.resolve(this.basePath,e);if(!ze(this.projectRoot,t))return;if(Fe.includes(E.extname(t).toLowerCase()))throw new S(e,[`File extension '${E.extname(t)}' is not allowed`],"high");this.projectRootReal??=C.realpath(this.projectRoot).catch(()=>null);let s=await this.projectRootReal;if(s)return{lexical:t,rootReal:s}}async readContained(e,t,s){this.stats.totalReads++;try{return R(await Re(t,{projectRoot:this.projectRoot??s}))}catch(n){return n instanceof Le?n.reason==="outside-project-root"?I(new S(e,["Path resolves outside the project root"],"critical")):n.reason==="not-a-file"?I(new F("Not a regular file: "+t,t,n.code==="NOT_A_FILE"?"EISDIR":n.code)):I(ue({code:n.reason==="not-found"?"ENOENT":n.code},t)):I(ue(n,t))}}async readFile(e){let t;try{let s=await this.inProjectRoot(e);if(s)return this.readContained(e,s.lexical,s.rootReal);t=this.resolvePath(e)}catch(s){if(s instanceof S)return I(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(),R(s);this.stats.cacheMisses++}try{let s=await C.readFile(t,"utf-8");return this.enableCache&&(this.cache.set(t,s,Buffer.byteLength(s,"utf-8")),this.updateCacheStats()),R(s)}catch(s){return I(ue(s,t))}}async readJSON(e){let t=await this.readFile(e);if(!t.success)return t;try{let s=D(t.value);return R(s)}catch(s){let n=s,i=e;try{i=this.resolvePath(e)}catch{}return I(new V("Invalid JSON in file: "+i+" - "+n.message,i,n))}}async fileExists(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof S)return I(s);throw s}try{return await C.access(t,C.constants.F_OK),R(!0)}catch(s){let n=s;return n.code==="ENOENT"?R(!1):I(new F("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 S)return I(n);throw n}try{if(!(await C.stat(s)).isDirectory())return I(new F("Base path is not a directory: "+s,s,"ENOTDIR"));let i=Be(e),o=[];return await Ae(s,i,o,s),o.sort(),R(o)}catch(n){let i=n;return I(new F("Failed to list files in: "+s,s,i.code,i))}}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}};Y();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"};$e();var _=class{baseUrl;maxRetries;retryDelayMs;timeoutMs;constructor(e=Pe(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{return await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3,async e=>{if(!e.ok)return!1;let t=await e.json();return t.models?t.models.some(s=>s.name===v.MODEL||s.name?.startsWith(`${v.MODEL}:`)||s.model===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 i=await this.fetchWithTimeout(`${this.baseUrl}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},this.timeoutMs,async o=>{if(!o.ok){let r=await o.text();throw new Error(`Ollama API error (${o.status}): ${r}`)}return await o.json()});if(i.embedding.length!==v.DIMENSIONS)throw new Error(`Invalid embedding dimensions: expected ${v.DIMENSIONS}, got ${i.embedding.length}`);return i.embedding}catch(i){if(s=A(i),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,n){let i=new AbortController,o=setTimeout(()=>i.abort(),s);try{let r=await fetch(e,{...t,signal:i.signal});return await n(r)}finally{clearTimeout(o)}}sleep(e){return new Promise(t=>setTimeout(t,e))}async getServerInfo(){try{return await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3,async e=>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 Ve}from"crypto";var j=class{cache;maxSize;hits;misses;constructor(e=1e4){this.cache=new Map,this.maxSize=e,this.hits=0,this.misses=0}hashContent(e,t,s){return Ve("sha256").update(JSON.stringify(s===void 0?[t,e]:[t,s,e])).digest("hex")}get(e,t,s){let n=this.hashContent(e,t,s),i=this.cache.get(n);return i?(this.hits++,this.cache.delete(n),this.cache.set(n,i),[...i.embedding]):(this.misses++,null)}set(e,t,s,n){let i=this.hashContent(e,t,n);if(this.cache.size>=this.maxSize&&!this.cache.has(i)){let r=this.cache.keys().next().value;r&&this.cache.delete(r)}let o={embedding:[...s],timestamp:Date.now(),model:t};this.cache.set(i,o)}has(e,t,s){let n=this.hashContent(e,t,s);return this.cache.has(n)}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[i,o]of this.cache.entries())o.timestamp<s&&(this.cache.delete(i),n++);return n}getMemoryUsageEstimate(){return this.cache.size*3172}export(){return Array.from(this.cache.entries()).map(([e,t])=>({key:e,entry:{...t,embedding:[...t.embedding]}}))}import(e){this.cache.clear();for(let{key:t,entry:s}of e)this.cache.size<this.maxSize&&this.cache.set(t,{...s,embedding:[...s.embedding]})}};Y();var q="pseudo-embedding",he="verified-backend-v1",H=u=>u===v.MODEL?he:void 0,$=class{client;cache;batchSize;enableFallback;ollamaAvailable=null;constructor(e={}){this.client=new _(e.ollamaBaseUrl),this.cache=e.cache??new j(e.maxCacheSize),this.batchSize=e.batchSize??v.BATCH_SIZE,this.enableFallback=e.enableFallback??!0}async embed(e){let t=this.cache.has(e,v.MODEL,he)||await this.isOllamaAvailable()||!this.enableFallback?v.MODEL:q,s=this.cache.get(e,t,H(t));if(s)return s;let n;if(await this.isOllamaAvailable())t=v.MODEL,n=await this.client.generateEmbedding(e);else if(this.enableFallback)t=q,n=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,t,n,H(t)),n}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,i=e.content.trim();if(s.length+i.length>n){let o=n-s.length-3;i=i.substring(0,o)+"..."}return s+i}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=[],i=0,o=0,r=await this.isOllamaAvailable();if(r)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,r);n.push(...d);for(let p of d)p.cached?i++:o++;if(t){let p=c+l.length,h=e.length,y=(Date.now()-s)/p,g=(h-p)*y;t({current:p,total:h,percentage:p/h*100,estimatedTimeRemainingMs:g})}}let a=Date.now()-s;return{results:n,stats:{totalChunks:e.length,cachedHits:i,computedNew:o,totalTimeMs:a,avgTimePerChunk:a/e.length}}}async processBatch(e,t){let s=[],n=e.map(async o=>{let r=this.formatForEmbedding(o),a=Date.now(),c=t||this.cache.has(r,v.MODEL,he)?v.MODEL:q,l=this.cache.get(r,c,H(c));if(l)return{chunkId:o.id,embedding:l,model:c,cached:!0,computeTimeMs:Date.now()-a};try{let d;t?d=await this.client.generateEmbedding(r):d=this.generatePseudoEmbedding(r);let p=t?v.MODEL:q;return this.cache.set(r,p,d,H(p)),{chunkId:o.id,embedding:d,model:p,cached:!1,computeTimeMs:Date.now()-a}}catch(d){throw new Error(`Failed to generate embedding for chunk ${o.id}: ${G(d)}`)}}),i=await Promise.all(n);return s.push(...i),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 r=s[o];for(let a=0;a<r.length&&a<t.length;a++)t[(o+a)%t.length]+=r.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,r]of n)o.test(e)&&(t[r]+=.5);let i=Math.sqrt(t.reduce((o,r)=>o+r*r,0))||1;return t.map(o=>o/i)}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}}};_e();Y();we();import{existsSync as Je,statSync as Qe}from"fs";import{dirname as Ye,resolve as Ze,join as X}from"path";function qe(u){switch(u){case"ts":case"mts":case"cts":return"tree-sitter-typescript.wasm";case"tsx":return"tree-sitter-tsx.wasm";case"js":case"jsx":case"mjs":case"cjs":return"tree-sitter-javascript.wasm";default:return null}}var K=u=>u.startPosition.row+1,U=(u,e)=>u.childForFieldName(e)?.text??"";function ge(u){for(let e=0;e<u.childCount;e++){let t=u.child(e);if(t){if(t.type==="async")return!0;if(t.type==="function"||t.type==="function_declaration")break}}return!1}function He(u){for(let e=0;e<u.childCount;e++)if(u.child(e)?.type==="accessibility_modifier"){let s=u.child(e).text;if(s==="private")return"private";if(s==="protected")return"protected"}return"public"}function Xe(u){let e=U(u,"name")||"(anonymous)",t=u.childForFieldName("body"),s=[];if(t)for(let n=0;n<t.childCount;n++){let i=t.child(n);i&&i.type==="method_definition"&&s.push({name:U(i,"name"),startLine:K(i),isAsync:ge(i),visibility:He(i)})}return{name:e,startLine:K(u),methods:s}}function fe(u){return u.replace(/^['"`]|['"`]$/g,"")}async function ye(u,e){let t=qe(e);if(!t)return null;let s=await Ce(t);if(!s)return null;let n=null;try{let i=s.parse(u);n=i;let o=i.rootNode;if(!o)return null;let r={functions:[],classes:[],interfaces:[],imports:[]},a=[o];for(;a.length;){let c=a.pop(),l=!0;switch(c.type){case"function_declaration":case"generator_function_declaration":r.functions.push({name:U(c,"name"),startLine:K(c),isAsync:ge(c),visibility:"public"}),l=!1;break;case"class_declaration":case"class":r.classes.push(Xe(c)),l=!1;break;case"interface_declaration":r.interfaces.push({name:U(c,"name"),startLine:K(c)}),l=!1;break;case"lexical_declaration":case"variable_declaration":{for(let d=0;d<c.childCount;d++){let p=c.child(d);if(!p||p.type!=="variable_declarator")continue;let h=p.childForFieldName("value");if(h&&(h.type==="arrow_function"||h.type==="function"||h.type==="function_expression"))r.functions.push({name:U(p,"name"),startLine:K(p),isAsync:ge(h),visibility:"public"});else if(h&&h.type==="call_expression"&&h.child(0)?.text==="require"){let f=h.childForFieldName("arguments")?.child(1);f&&f.type==="string"&&r.imports.push(fe(f.text))}}l=!1;break}case"import_statement":{let d=c.childForFieldName("source");d&&r.imports.push(fe(d.text)),l=!1;break}case"call_expression":{let d=c.child(0);if(d&&d.text==="require"){let h=c.childForFieldName("arguments")?.child(1);h&&h.type==="string"&&r.imports.push(fe(h.text))}break}}if(l)for(let d=c.childCount-1;d>=0;d--){let p=c.child(d);p&&a.push(p)}}return r}catch{return null}finally{n?.delete?.()}}je();var et={maxNodes:1e5,maxEdgesPerNode:500,namespace:"code-intelligence:kg",enableVectorEmbeddings:!0,embeddingDimension:384,enableLLMExtraction:!0,llmModelTier:2,llmMaxTokens:2048},be=xe.create("code-intelligence/knowledge-graph"),J=new Set(["ts","tsx","js","jsx"]),Ne=class{config;memory;nodeCache=new Map;edgeIndex=new Map;allEdgesCache;tsParser;fileReader;projectRoot;embedder;llmRouter;constructor(e,t={}){this.config={...et,...t},this.isKnowledgeGraphDependencies(e)?(this.memory=e.memory,this.llmRouter=e.llmRouter):(this.memory=e,this.llmRouter=void 0),this.tsParser=new N,this.projectRoot=this.config.projectRoot??this.config.basePath??Ee(),this.fileReader=new k({...this.config.basePath?{basePath:this.config.basePath}:{},projectRoot:this.projectRoot}),this.embedder=new $({enableFallback:!0})}isKnowledgeGraphDependencies(e){return e.memory!==void 0}get nsOpts(){return{namespace:this.config.namespace}}async index(e){let t=Date.now(),s=[],n=0,i=0,o=new Map;try{let{paths:r,incremental:a=!1,includeTests:c=!0,languages:l}=e,{accepted:d,skipped:p}=await Se(r,this.projectRoot,this.config.basePath??process.cwd()),h=0;if(!a)await this.clear();else for(let b of p)b.reason==="not-found"&&await this.removeFileFromGraph(b.path);for(let b of d)try{if(l&&l.length>0){let w=this.getFileExtension(b);if(!this.matchesLanguage(w,l)){p.push({path:b,reason:"excluded-by-language"});continue}}if(!c&&this.isTestFile(b)){p.push({path:b,reason:"excluded-test-file"});continue}let g=this.getFileExtension(b);J.has(g)||o.set(g||"(none)",(o.get(g||"(none)")??0)+1);let x=await this.indexFile(b,a);n+=x.nodes,i+=x.edges,h++}catch(g){s.push({file:b,error:G(g)})}let f=Date.now()-t,y=[];if(o.size>0){let b=Array.from(J).join(", ");for(let[g,x]of o){let w=`${x} file(s) with extension '.${g}' were indexed as plain nodes: no dependency extractor for this language, so 'deps'/'impact' will report 0 edges for them. Supported: ${b}.`;y.push(w),be.warn(w)}}return await this.storeIndexMetadata({filesIndexed:h,nodesCreated:n,edgesCreated:i,duration:f,indexedAt:new Date().toISOString()}),R({filesIndexed:h,nodesCreated:n,edgesCreated:i,duration:f,errors:s,warnings:y,skipped:p})}catch(r){return I(A(r))}}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 I(A(t))}}async mapDependencies(e){try{let{files:t,direction:s,depth:n=3}=e,i=[],o=[],r=new Set,a=[];for(let l of t)await this.traverseDependencies(l,s,n,r,i,o,[],a);let c=this.calculateDependencyMetrics(i,o);return R({nodes:i,edges:o,cycles:a,metrics:c})}catch(t){return I(A(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,this.nsOpts);return s&&this.nodeCache.set(e,s),s}async getEdges(e,t){let s=await this.loadAllEdges();return this.filterEdgesByDirection(s,e,t)}async loadAllEdges(){if(this.allEdgesCache)return this.allEdgesCache;let e=[],t=`${this.config.namespace}:edge:*`,s=await this.memory.search(t,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let n of s){let i=await this.memory.get(n,this.nsOpts);i&&e.push(i)}return this.allEdgesCache=e,e}async clear(){this.nodeCache.clear(),this.edgeIndex.clear(),this.allEdgesCache=void 0;for(let e of[`${this.config.namespace}:node:`,`${this.config.namespace}:edge:`]){let t=await this.memory.search(`${e}*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let s of t)await this.memory.delete(s,this.nsOpts)}}async removeFileFromGraph(e){let t=this.pathToNodeId(e),s=this.config.namespace,n=await this.memory.search(`${s}:node:${t}*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let o of n)await this.memory.delete(o,this.nsOpts),this.nodeCache.delete(o.slice(`${s}:node:`.length));let i=await this.memory.search(`${s}:edge:*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let o of i){let r=await this.memory.get(o,this.nsOpts);r&&(r.source===t||r.source.startsWith(`${t}:`))&&await this.memory.delete(o,this.nsOpts)}this.edgeIndex.delete(t),this.allEdgesCache=void 0}isLLMExtractionAvailable(){return this.config.enableLLMExtraction===!0&&this.llmRouter!==void 0}getModelForTier(e){return Ie(e)}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),i=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 i=n.match(/^\s*import\s+'([^']+)'/);i&&t.push({module:i[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){if(!e.trim())return[];let t=e.replace(/[{}[\]]/g,"");return T(t).map(s=>s.trim()).filter(s=>s).map(s=>{let n=s.replace("required ","").trim().split(/\s+/),i=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:i,type:o,isOptional:s.includes("?")||s.includes("{"),defaultValue:void 0}})}},z=ve("ParserRegistry"),Me=["python","java","csharp","rust","swift"],ce=class u{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<u.MAX_WASM_RETRIES)try{return await this.wasmParser.parseFile(e,t)}catch(s){this.wasmFailCount++;let n=s instanceof Error?s.message:String(s),i=this.wasmFailCount>=u.MAX_WASM_RETRIES;z.warn(`[${this.language}] tree-sitter WASM parser failed (attempt ${this.wasmFailCount}/${u.MAX_WASM_RETRIES}): ${n}. Falling back to regex parser (~97-98% accuracy). `+(i?"Set AQE_PARSER_REGEX_ONLY=1 to silence this warning.":"Will retry WASM on next parse."))}return this.regexParser.parseFile(e,t)}},le=class{parsers=new Map;_wasmInitPromise=null;constructor(){this.register(new ee),this.register(new te),this.register(new se),this.register(new ne),this.register(new ie),this.register(new re),this.register(new ae),this.register(new oe),this._wasmInitPromise=this._tryLoadWasmParsers()}async _tryLoadWasmParsers(){try{let e=await import("./tree-sitter-wasm-parser-TSZTCMFV.js");if(!e.isWasmAvailable()){z.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 Me){let n=t.get(s),i=this.parsers.get(s);n&&i&&this.parsers.set(s,new ce(n,i))}z.info("tree-sitter WASM parsers available for: "+Me.join(", "))}catch{z.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)}},ct=new le;import*as C from"node:fs/promises";import*as E from"node:path";var Ue=[/\.\./,/%2e%2e/i,/%252e%252e/i,/\.\.%2f/i,/%2f\.\./i,/\.\.%5c/i,/\.\.\\/,/%c0%ae/i,/%c0%2f/i,/%c1%9c/i,/\0/,/%00/i],Ge=[/^\/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],pe=class{name="path-traversal";getRiskLevel(){return"critical"}validate(e,t={}){let{basePath:s="",allowAbsolute:n=!1,allowedExtensions:i=[],deniedExtensions:o=[".exe",".bat",".cmd",".sh",".ps1",".dll",".so"],maxDepth:r=10,maxLength:a=4096}=t;if(e.length>a)return{valid:!1,error:`Path exceeds maximum length of ${a}`,riskLevel:"medium"};for(let f of Ue)if(f.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 f of Ge)if(f.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>r)return{valid:!1,error:`Path depth exceeds maximum of ${r}`,riskLevel:"low"};let d=this.getExtension(c);if(d){let f=`.${d.toLowerCase()}`,y=d.toLowerCase();if(o.length>0&&o.some(g=>g.toLowerCase()===f||g.toLowerCase()===y))return{valid:!1,error:`File extension '${d}' is not allowed`,riskLevel:"high"};if(i.length>0&&!i.some(g=>g.toLowerCase()===f||g.toLowerCase()===y))return{valid:!1,error:`File extension '${d}' is not in allowed list`,riskLevel:"medium"}}let p=s?this.joinPathsAbsolute(s,c):c,h=s.startsWith("/")?`/${this.normalizePath(s)}`:this.normalizePath(s);return s&&!p.startsWith(h)?{valid:!1,error:"Path escapes base directory",riskLevel:"critical"}:{valid:!0,normalizedPath:p,riskLevel:"none"}}normalizePath(e){let t=e.replace(/\\/g,"/");t=t.replace(/\/+/g,"/");let s=t.split("/"),n=[];for(let i of s)i==="."||i===""||(i===".."?n.length>0&&n[n.length-1]!==".."&&n.pop():n.push(i));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}},We=new pe,Te=(u,e)=>We.validate(u,e);we();var Fe=[".exe",".bat",".cmd",".ps1",".dll",".so"],F=class extends Error{constructor(t,s,n,i){super(t);this.filePath=s;this.code=n;this.cause=i;this.name="FileReadError"}filePath;code;cause},V=class extends Error{constructor(t,s,n){super(t);this.filePath=s;this.cause=n;this.name="JsonParseError"}filePath;cause},S=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};function ue(u,e){let t=u,s;switch(t.code){case"ENOENT":s="File not found: "+e;break;case"EACCES":s="Permission denied: "+e;break;case"EISDIR":s="Path is a directory: "+e;break;default:s="Failed to read file: "+e}return new F(s,e,t.code,t)}function ze(u,e){let t=E.relative(u,e);return t===""||!t.startsWith(`..${E.sep}`)&&t!==".."&&!E.isAbsolute(t)}var me=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,i)=>{e-n.timestamp>this.ttlMs&&s.push(i)}),s.forEach(n=>{this.delete(n),t++}),t}};function Be(u){let e="",t=0;for(;t<u.length;){let s=u[t],n=u[t+1];s==="*"&&n==="*"?u[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 Ae(u,e,t,s){try{let n=await C.readdir(u,{withFileTypes:!0});for(let i of n){let o=E.join(u,i.name),r=E.relative(s,o);if(i.isDirectory())i.name!=="node_modules"&&!i.name.startsWith(".")&&await Ae(o,e,t,s);else if(i.isFile()){let a=r.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;projectRoot;projectRootReal;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.projectRoot=e.projectRoot?E.resolve(e.projectRoot):void 0,this.cache=new me(e.maxCacheSize??100,e.cacheTtlMs??300*1e3)}resolvePath(e){let t=E.isAbsolute(e),s=E.resolve(this.basePath),n=E.resolve(s,e),i=E.relative(s,n);if(this.basePath&&(i===".."||i.startsWith(`..${E.sep}`)||E.isAbsolute(i)))throw new S(e,["Path escapes base directory"],"critical");let o=this.basePath?s.split(/[\\/]/).filter(Boolean).length:0,r=Te(e,{basePath:t?"":this.basePath,allowAbsolute:!0,maxDepth:10+(t?o:0),deniedExtensions:Fe});if(!r.valid)throw new S(e,[r.error||"Path validation failed"],r.riskLevel);return t?n:r.normalizedPath?r.normalizedPath:t?e:E.resolve(this.basePath,e)}async inProjectRoot(e){if(!this.projectRoot)return;if(e.includes("\0"))throw new S(e,["Null byte in path"],"critical");let t=E.resolve(this.basePath,e);if(!ze(this.projectRoot,t))return;if(Fe.includes(E.extname(t).toLowerCase()))throw new S(e,[`File extension '${E.extname(t)}' is not allowed`],"high");this.projectRootReal??=C.realpath(this.projectRoot).catch(()=>null);let s=await this.projectRootReal;if(s)return{lexical:t,rootReal:s}}async readContained(e,t,s){this.stats.totalReads++;try{return R(await Re(t,{projectRoot:this.projectRoot??s}))}catch(n){return n instanceof Le?n.reason==="outside-project-root"?I(new S(e,["Path resolves outside the project root"],"critical")):n.reason==="not-a-file"?I(new F("Not a regular file: "+t,t,n.code==="NOT_A_FILE"?"EISDIR":n.code)):I(ue({code:n.reason==="not-found"?"ENOENT":n.code},t)):I(ue(n,t))}}async readFile(e){let t;try{let s=await this.inProjectRoot(e);if(s)return this.readContained(e,s.lexical,s.rootReal);t=this.resolvePath(e)}catch(s){if(s instanceof S)return I(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(),R(s);this.stats.cacheMisses++}try{let s=await C.readFile(t,"utf-8");return this.enableCache&&(this.cache.set(t,s,Buffer.byteLength(s,"utf-8")),this.updateCacheStats()),R(s)}catch(s){return I(ue(s,t))}}async readJSON(e){let t=await this.readFile(e);if(!t.success)return t;try{let s=D(t.value);return R(s)}catch(s){let n=s,i=e;try{i=this.resolvePath(e)}catch{}return I(new V("Invalid JSON in file: "+i+" - "+n.message,i,n))}}async fileExists(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof S)return I(s);throw s}try{return await C.access(t,C.constants.F_OK),R(!0)}catch(s){let n=s;return n.code==="ENOENT"?R(!1):I(new F("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 S)return I(n);throw n}try{if(!(await C.stat(s)).isDirectory())return I(new F("Base path is not a directory: "+s,s,"ENOTDIR"));let i=Be(e),o=[];return await Ae(s,i,o,s),o.sort(),R(o)}catch(n){let i=n;return I(new F("Failed to list files in: "+s,s,i.code,i))}}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}};Y();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"};$e();var _=class{baseUrl;maxRetries;retryDelayMs;timeoutMs;constructor(e=Pe(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{return await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3,async e=>{if(!e.ok)return!1;let t=await e.json();return t.models?t.models.some(s=>s.name===v.MODEL||s.name?.startsWith(`${v.MODEL}:`)||s.model===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 i=await this.fetchWithTimeout(`${this.baseUrl}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},this.timeoutMs,async o=>{if(!o.ok){let r=await o.text();throw new Error(`Ollama API error (${o.status}): ${r}`)}return await o.json()});if(i.embedding.length!==v.DIMENSIONS)throw new Error(`Invalid embedding dimensions: expected ${v.DIMENSIONS}, got ${i.embedding.length}`);return i.embedding}catch(i){if(s=A(i),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,n){let i=new AbortController,o=setTimeout(()=>i.abort(),s);try{let r=await fetch(e,{...t,signal:i.signal});return await n(r)}finally{clearTimeout(o)}}sleep(e){return new Promise(t=>setTimeout(t,e))}async getServerInfo(){try{return await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3,async e=>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 Ve}from"crypto";var j=class{cache;maxSize;hits;misses;constructor(e=1e4){this.cache=new Map,this.maxSize=e,this.hits=0,this.misses=0}hashContent(e,t,s){return Ve("sha256").update(JSON.stringify(s===void 0?[t,e]:[t,s,e])).digest("hex")}get(e,t,s){let n=this.hashContent(e,t,s),i=this.cache.get(n);return i?(this.hits++,this.cache.delete(n),this.cache.set(n,i),[...i.embedding]):(this.misses++,null)}set(e,t,s,n){let i=this.hashContent(e,t,n);if(this.cache.size>=this.maxSize&&!this.cache.has(i)){let r=this.cache.keys().next().value;r&&this.cache.delete(r)}let o={embedding:[...s],timestamp:Date.now(),model:t};this.cache.set(i,o)}has(e,t,s){let n=this.hashContent(e,t,s);return this.cache.has(n)}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[i,o]of this.cache.entries())o.timestamp<s&&(this.cache.delete(i),n++);return n}getMemoryUsageEstimate(){return this.cache.size*3172}export(){return Array.from(this.cache.entries()).map(([e,t])=>({key:e,entry:{...t,embedding:[...t.embedding]}}))}import(e){this.cache.clear();for(let{key:t,entry:s}of e)this.cache.size<this.maxSize&&this.cache.set(t,{...s,embedding:[...s.embedding]})}};Y();var q="pseudo-embedding",he="verified-backend-v1",H=u=>u===v.MODEL?he:void 0,$=class{client;cache;batchSize;enableFallback;ollamaAvailable=null;constructor(e={}){this.client=new _(e.ollamaBaseUrl),this.cache=e.cache??new j(e.maxCacheSize),this.batchSize=e.batchSize??v.BATCH_SIZE,this.enableFallback=e.enableFallback??!0}async embed(e){let t=this.cache.has(e,v.MODEL,he)||await this.isOllamaAvailable()||!this.enableFallback?v.MODEL:q,s=this.cache.get(e,t,H(t));if(s)return s;let n;if(await this.isOllamaAvailable())t=v.MODEL,n=await this.client.generateEmbedding(e);else if(this.enableFallback)t=q,n=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,t,n,H(t)),n}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,i=e.content.trim();if(s.length+i.length>n){let o=n-s.length-3;i=i.substring(0,o)+"..."}return s+i}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=[],i=0,o=0,r=await this.isOllamaAvailable();if(r)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,r);n.push(...d);for(let p of d)p.cached?i++:o++;if(t){let p=c+l.length,h=e.length,y=(Date.now()-s)/p,g=(h-p)*y;t({current:p,total:h,percentage:p/h*100,estimatedTimeRemainingMs:g})}}let a=Date.now()-s;return{results:n,stats:{totalChunks:e.length,cachedHits:i,computedNew:o,totalTimeMs:a,avgTimePerChunk:a/e.length}}}async processBatch(e,t){let s=[],n=e.map(async o=>{let r=this.formatForEmbedding(o),a=Date.now(),c=t||this.cache.has(r,v.MODEL,he)?v.MODEL:q,l=this.cache.get(r,c,H(c));if(l)return{chunkId:o.id,embedding:l,model:c,cached:!0,computeTimeMs:Date.now()-a};try{let d;t?d=await this.client.generateEmbedding(r):d=this.generatePseudoEmbedding(r);let p=t?v.MODEL:q;return this.cache.set(r,p,d,H(p)),{chunkId:o.id,embedding:d,model:p,cached:!1,computeTimeMs:Date.now()-a}}catch(d){throw new Error(`Failed to generate embedding for chunk ${o.id}: ${G(d)}`)}}),i=await Promise.all(n);return s.push(...i),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 r=s[o];for(let a=0;a<r.length&&a<t.length;a++)t[(o+a)%t.length]+=r.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,r]of n)o.test(e)&&(t[r]+=.5);let i=Math.sqrt(t.reduce((o,r)=>o+r*r,0))||1;return t.map(o=>o/i)}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}}};_e();Y();we();import{existsSync as Xe,statSync as Qe}from"fs";import{dirname as Ye,resolve as Ze,join as J}from"path";function qe(u){switch(u){case"ts":case"mts":case"cts":return"tree-sitter-typescript.wasm";case"tsx":return"tree-sitter-tsx.wasm";case"js":case"jsx":case"mjs":case"cjs":return"tree-sitter-javascript.wasm";default:return null}}var K=u=>u.startPosition.row+1,U=(u,e)=>u.childForFieldName(e)?.text??"";function ge(u){for(let e=0;e<u.childCount;e++){let t=u.child(e);if(t){if(t.type==="async")return!0;if(t.type==="function"||t.type==="function_declaration")break}}return!1}function He(u){for(let e=0;e<u.childCount;e++)if(u.child(e)?.type==="accessibility_modifier"){let s=u.child(e).text;if(s==="private")return"private";if(s==="protected")return"protected"}return"public"}function Je(u){let e=U(u,"name")||"(anonymous)",t=u.childForFieldName("body"),s=[];if(t)for(let n=0;n<t.childCount;n++){let i=t.child(n);i&&i.type==="method_definition"&&s.push({name:U(i,"name"),startLine:K(i),isAsync:ge(i),visibility:He(i)})}return{name:e,startLine:K(u),methods:s}}function fe(u){return u.replace(/^['"`]|['"`]$/g,"")}async function ye(u,e){let t=qe(e);if(!t)return null;let s=await Ce(t);if(!s)return null;let n=null;try{let i=s.parse(u);n=i;let o=i.rootNode;if(!o)return null;let r={functions:[],classes:[],interfaces:[],imports:[]},a=[o];for(;a.length;){let c=a.pop(),l=!0;switch(c.type){case"function_declaration":case"generator_function_declaration":r.functions.push({name:U(c,"name"),startLine:K(c),isAsync:ge(c),visibility:"public"}),l=!1;break;case"class_declaration":case"class":r.classes.push(Je(c)),l=!1;break;case"interface_declaration":r.interfaces.push({name:U(c,"name"),startLine:K(c)}),l=!1;break;case"lexical_declaration":case"variable_declaration":{for(let d=0;d<c.childCount;d++){let p=c.child(d);if(!p||p.type!=="variable_declarator")continue;let h=p.childForFieldName("value");if(h&&(h.type==="arrow_function"||h.type==="function"||h.type==="function_expression"))r.functions.push({name:U(p,"name"),startLine:K(p),isAsync:ge(h),visibility:"public"});else if(h&&h.type==="call_expression"&&h.child(0)?.text==="require"){let f=h.childForFieldName("arguments")?.child(1);f&&f.type==="string"&&r.imports.push(fe(f.text))}}l=!1;break}case"import_statement":{let d=c.childForFieldName("source");d&&r.imports.push(fe(d.text)),l=!1;break}case"call_expression":{let d=c.child(0);if(d&&d.text==="require"){let h=c.childForFieldName("arguments")?.child(1);h&&h.type==="string"&&r.imports.push(fe(h.text))}break}}if(l)for(let d=c.childCount-1;d>=0;d--){let p=c.child(d);p&&a.push(p)}}return r}catch{return null}finally{n?.delete?.()}}je();var et={maxNodes:1e5,maxEdgesPerNode:500,namespace:"code-intelligence:kg",enableVectorEmbeddings:!0,embeddingDimension:384,enableLLMExtraction:!0,llmModelTier:2,llmMaxTokens:2048},be=xe.create("code-intelligence/knowledge-graph"),X=new Set(["ts","tsx","js","jsx"]),Ne=class{config;memory;nodeCache=new Map;edgeIndex=new Map;allEdgesCache;tsParser;fileReader;projectRoot;embedder;llmRouter;constructor(e,t={}){this.config={...et,...t},this.isKnowledgeGraphDependencies(e)?(this.memory=e.memory,this.llmRouter=e.llmRouter):(this.memory=e,this.llmRouter=void 0),this.tsParser=new N,this.projectRoot=this.config.projectRoot??this.config.basePath??Ee(),this.fileReader=new k({...this.config.basePath?{basePath:this.config.basePath}:{},projectRoot:this.projectRoot}),this.embedder=new $({enableFallback:!0})}isKnowledgeGraphDependencies(e){return e.memory!==void 0}get nsOpts(){return{namespace:this.config.namespace}}async index(e){let t=Date.now(),s=[],n=0,i=0,o=new Map;try{let{paths:r,incremental:a=!1,includeTests:c=!0,languages:l}=e,{accepted:d,skipped:p}=await Se(r,this.projectRoot,this.config.basePath??process.cwd()),h=0;if(!a)await this.clear();else for(let b of p)b.reason==="not-found"&&await this.removeFileFromGraph(b.path);for(let b of d)try{if(l&&l.length>0){let w=this.getFileExtension(b);if(!this.matchesLanguage(w,l)){p.push({path:b,reason:"excluded-by-language"});continue}}if(!c&&this.isTestFile(b)){p.push({path:b,reason:"excluded-test-file"});continue}let g=this.getFileExtension(b);X.has(g)||o.set(g||"(none)",(o.get(g||"(none)")??0)+1);let x=await this.indexFile(b,a);n+=x.nodes,i+=x.edges,h++}catch(g){s.push({file:b,error:G(g)})}let f=Date.now()-t,y=[];if(o.size>0){let b=Array.from(X).join(", ");for(let[g,x]of o){let w=`${x} file(s) with extension '.${g}' were indexed as plain nodes: no dependency extractor for this language, so 'deps'/'impact' will report 0 edges for them. Supported: ${b}.`;y.push(w),be.warn(w)}}return await this.storeIndexMetadata({filesIndexed:h,nodesCreated:n,edgesCreated:i,duration:f,indexedAt:new Date().toISOString()}),R({filesIndexed:h,nodesCreated:n,edgesCreated:i,duration:f,errors:s,warnings:y,skipped:p})}catch(r){return I(A(r))}}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 I(A(t))}}async mapDependencies(e){try{let{files:t,direction:s,depth:n=3}=e,i=[],o=[],r=new Set,a=[];for(let l of t)await this.traverseDependencies(l,s,n,r,i,o,[],a);let c=this.calculateDependencyMetrics(i,o);return R({nodes:i,edges:o,cycles:a,metrics:c})}catch(t){return I(A(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,this.nsOpts);return s&&this.nodeCache.set(e,s),s}async getEdges(e,t){let s=await this.loadAllEdges();return this.filterEdgesByDirection(s,e,t)}async loadAllEdges(){if(this.allEdgesCache)return this.allEdgesCache;let e=[],t=`${this.config.namespace}:edge:*`,s=await this.memory.search(t,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let n of s){let i=await this.memory.get(n,this.nsOpts);i&&e.push(i)}return this.allEdgesCache=e,e}async clear(){this.nodeCache.clear(),this.edgeIndex.clear(),this.allEdgesCache=void 0;for(let e of[`${this.config.namespace}:node:`,`${this.config.namespace}:edge:`]){let t=await this.memory.search(`${e}*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let s of t)await this.memory.delete(s,this.nsOpts)}}async removeFileFromGraph(e){let t=this.pathToNodeId(e),s=this.config.namespace,n=await this.memory.search(`${s}:node:${t}*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let o of n)await this.memory.delete(o,this.nsOpts),this.nodeCache.delete(o.slice(`${s}:node:`.length));let i=await this.memory.search(`${s}:edge:*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let o of i){let r=await this.memory.get(o,this.nsOpts);r&&(r.source===t||r.source.startsWith(`${t}:`))&&await this.memory.delete(o,this.nsOpts)}this.edgeIndex.delete(t),this.allEdgesCache=void 0}isLLMExtractionAvailable(){return this.config.enableLLMExtraction===!0&&this.llmRouter!==void 0}getModelForTier(e){return Ie(e)}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),i=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)
|
|
@@ -55,5 +55,5 @@ ${e}
|
|
|
55
55
|
Return JSON: { "rankedIds": ["id1", "id2", ...], "insights": ["insight1", "insight2", ...] }`},{role:"user",content:`Query: "${e}"
|
|
56
56
|
|
|
57
57
|
Results:
|
|
58
|
-
${JSON.stringify(t.map(i=>({id:i.id,label:i.label,properties:i.properties})),null,2)}`}],model:s,maxTokens:1024,temperature:.3,agentType:"qe-code-intelligence"});if(n.content)try{let i=n.content.match(/\{[\s\S]*\}/);if(i){let o=D(i[0]),r=o.rankedIds||[],a=o.insights||[],c=new Map(t.map(d=>[d.id,d])),l=[];for(let d of r){let p=c.get(d);p&&(l.push(p),c.delete(d))}return l.push(...Array.from(c.values())),{enhancedResults:l,insights:a}}}catch{}return{enhancedResults:t,insights:[]}}catch{return be.warn("LLM query enhancement failed:"),{enhancedResults:t,insights:[]}}}async indexFile(e,t=!1){let s=0,n=0;try{this.fileReader.invalidateCache(e)}catch{}let i=await this.fileReader.readFile(e);if(!i.success)throw i.error;t&&await this.removeFileFromGraph(e);let o=await this.createFileNode(e);s++;let r=await this.extractEntities(e);for(let c of r){let l=await this.createEntityNode(c,e);s++,await this.createEdge(o.id,l.id,"contains"),n++}let a=await this.extractImports(e);for(let c of a){let l=this.resolveImportPath(c,e),d=this.pathToNodeId(l);await this.createEdge(o.id,d,"import"),n++}if(this.isLLMExtractionAvailable()){let c=await this.fileReader.readFile(e);if(c.success){let l=await this.extractRelationshipsWithLLM(c.value,r);n+=await this.storeLLMRelationships(o.id,l)}}return{nodes:s,edges:n}}async storeLLMRelationships(e,t){let s=0;for(let i of t.semanticRelationships){let o=`${e}:*:${i.source}`,r=`${e}:*:${i.target}`;await this.createEdge(o,r,i.type),s++}let n=this.nodeCache.get(e);return n&&(t.designPatterns.length>0&&(n.properties.designPatterns=t.designPatterns),t.architecturalBoundaries.length>0&&(n.properties.architecturalBoundaries=t.architecturalBoundaries),t.dependencyImpacts.length>0&&(n.properties.dependencyImpacts=t.dependencyImpacts),this.nodeCache.set(e,n)),s}async createFileNode(e){let s={id:this.pathToNodeId(e),label:"File",properties:{path:e,name:this.getFileName(e),extension:this.getFileExtension(e),type:this.getFileType(e)}};return await this.storeNode(s),s}async createEntityNode(e,t){let s=`${this.pathToNodeId(t)}:${e.type}:${e.name}`,n={id:s,label:e.type,properties:{name:e.name,file:t,line:e.line,visibility:e.visibility,async:e.isAsync}};if(await this.storeNode(n),this.config.enableVectorEmbeddings){let i=await this.generateEmbedding(e);await this.memory.storeVector(`${this.config.namespace}:node:${s}`,i,{nodeId:s,type:e.type,name:e.name})}return n}async createEdge(e,t,s){let n=`${e}--${s}-->${t}`,i={source:e,target:t,type:s},o=this.edgeIndex.get(e)||[];return o.push(i),this.edgeIndex.set(e,o),await this.memory.set(`${this.config.namespace}:edge:${n}`,i,this.nsOpts),this.allEdgesCache=void 0,i}async storeNode(e){if(this.nodeCache.size>=this.config.maxNodes){let t=this.nodeCache.keys().next().value;t&&(this.nodeCache.delete(t),this.edgeIndex.delete(t))}this.nodeCache.set(e.id,e),await this.memory.set(`${this.config.namespace}:node:${e.id}`,e,this.nsOpts)}async extractEntities(e){let t=this.getFileExtension(e),s=[];if(
|
|
59
|
-
`),r=/^class\s+(\w+)\s*(?:\([^)]*\))?\s*:/,a=/^(async\s+)?def\s+(\w+)\s*\(/,c=null,l=0;for(let d=0;d<o.length;d++){let p=o[d],h=d+1,f=p.trimStart(),y=p.length-f.length;c&&y<=l&&(c=null);let b=f.match(r);if(b){let x=b[1];s.push({type:"class",name:x,line:h,visibility:x.startsWith("_")?"private":"public",isAsync:!1}),c=x,l=y;continue}let g=f.match(a);if(g){let x=!!g[1],w=g[2],De=c!==null&&y>l,Q="public";w.startsWith("__")&&!w.endsWith("__")?Q="private":w.startsWith("_")&&(Q="protected"),s.push({type:"function",name:De?`${c}.${w}`:w,line:h,visibility:Q,isAsync:x})}}s.length===0&&s.push({type:"module",name:this.getFileName(e).replace(".py",""),line:1,visibility:"public",isAsync:!1})}else s.push({type:"module",name:this.getFileName(e).replace(".py",""),line:1,visibility:"public",isAsync:!1})}return s}async extractImports(e){let t=this.getFileExtension(e),s=[];if(
|
|
58
|
+
${JSON.stringify(t.map(i=>({id:i.id,label:i.label,properties:i.properties})),null,2)}`}],model:s,maxTokens:1024,temperature:.3,agentType:"qe-code-intelligence"});if(n.content)try{let i=n.content.match(/\{[\s\S]*\}/);if(i){let o=D(i[0]),r=o.rankedIds||[],a=o.insights||[],c=new Map(t.map(d=>[d.id,d])),l=[];for(let d of r){let p=c.get(d);p&&(l.push(p),c.delete(d))}return l.push(...Array.from(c.values())),{enhancedResults:l,insights:a}}}catch{}return{enhancedResults:t,insights:[]}}catch{return be.warn("LLM query enhancement failed:"),{enhancedResults:t,insights:[]}}}async indexFile(e,t=!1){let s=0,n=0;try{this.fileReader.invalidateCache(e)}catch{}let i=await this.fileReader.readFile(e);if(!i.success)throw i.error;t&&await this.removeFileFromGraph(e);let o=await this.createFileNode(e);s++;let r=await this.extractEntities(e);for(let c of r){let l=await this.createEntityNode(c,e);s++,await this.createEdge(o.id,l.id,"contains"),n++}let a=await this.extractImports(e);for(let c of a){let l=this.resolveImportPath(c,e),d=this.pathToNodeId(l);await this.createEdge(o.id,d,"import"),n++}if(this.isLLMExtractionAvailable()){let c=await this.fileReader.readFile(e);if(c.success){let l=await this.extractRelationshipsWithLLM(c.value,r);n+=await this.storeLLMRelationships(o.id,l)}}return{nodes:s,edges:n}}async storeLLMRelationships(e,t){let s=0;for(let i of t.semanticRelationships){let o=`${e}:*:${i.source}`,r=`${e}:*:${i.target}`;await this.createEdge(o,r,i.type),s++}let n=this.nodeCache.get(e);return n&&(t.designPatterns.length>0&&(n.properties.designPatterns=t.designPatterns),t.architecturalBoundaries.length>0&&(n.properties.architecturalBoundaries=t.architecturalBoundaries),t.dependencyImpacts.length>0&&(n.properties.dependencyImpacts=t.dependencyImpacts),this.nodeCache.set(e,n)),s}async createFileNode(e){let s={id:this.pathToNodeId(e),label:"File",properties:{path:e,name:this.getFileName(e),extension:this.getFileExtension(e),type:this.getFileType(e)}};return await this.storeNode(s),s}async createEntityNode(e,t){let s=`${this.pathToNodeId(t)}:${e.type}:${e.name}`,n={id:s,label:e.type,properties:{name:e.name,file:t,line:e.line,visibility:e.visibility,async:e.isAsync}};if(await this.storeNode(n),this.config.enableVectorEmbeddings){let i=await this.generateEmbedding(e);await this.memory.storeVector(`${this.config.namespace}:node:${s}`,i,{nodeId:s,type:e.type,name:e.name})}return n}async createEdge(e,t,s){let n=`${e}--${s}-->${t}`,i={source:e,target:t,type:s},o=this.edgeIndex.get(e)||[];return o.push(i),this.edgeIndex.set(e,o),await this.memory.set(`${this.config.namespace}:edge:${n}`,i,this.nsOpts),this.allEdgesCache=void 0,i}async storeNode(e){if(this.nodeCache.size>=this.config.maxNodes){let t=this.nodeCache.keys().next().value;t&&(this.nodeCache.delete(t),this.edgeIndex.delete(t))}this.nodeCache.set(e.id,e),await this.memory.set(`${this.config.namespace}:node:${e.id}`,e,this.nsOpts)}async extractEntities(e){let t=this.getFileExtension(e),s=[];if(X.has(t)){let n=await this.fileReader.readFile(e),i=this.getFileName(e);if(n.success){let o=!1;try{let r=await ye(n.value,t);if(r){for(let a of r.functions)s.push({type:"function",name:a.name,line:a.startLine,visibility:a.visibility,isAsync:a.isAsync});for(let a of r.classes){s.push({type:"class",name:a.name,line:a.startLine,visibility:"public",isAsync:!1});for(let c of a.methods)s.push({type:"function",name:`${a.name}.${c.name}`,line:c.startLine,visibility:c.visibility,isAsync:c.isAsync})}for(let a of r.interfaces)s.push({type:"interface",name:a.name,line:a.startLine,visibility:"public",isAsync:!1});o=!0}}catch{}if(!o)try{let r=this.tsParser.parseFile(i,n.value);for(let a of this.tsParser.extractFunctions(r))s.push({type:"function",name:a.name,line:a.startLine,visibility:"public",isAsync:a.isAsync});for(let a of this.tsParser.extractClasses(r)){s.push({type:"class",name:a.name,line:a.startLine,visibility:"public",isAsync:!1});for(let c of a.methods)s.push({type:"function",name:`${a.name}.${c.name}`,line:c.startLine,visibility:c.visibility,isAsync:c.isAsync})}for(let a of this.tsParser.extractInterfaces(r))s.push({type:"interface",name:a.name,line:a.startLine,visibility:"public",isAsync:!1})}catch{}s.length===0&&s.push({type:"module",name:i.replace(/\.[^.]+$/,""),line:1,visibility:"public",isAsync:!1})}else s.push({type:"module",name:this.getFileName(e).replace(/\.[^.]+$/,""),line:1,visibility:"public",isAsync:!1})}else if(t==="py"){let n=await this.fileReader.readFile(e);if(n.success){let o=n.value.split(`
|
|
59
|
+
`),r=/^class\s+(\w+)\s*(?:\([^)]*\))?\s*:/,a=/^(async\s+)?def\s+(\w+)\s*\(/,c=null,l=0;for(let d=0;d<o.length;d++){let p=o[d],h=d+1,f=p.trimStart(),y=p.length-f.length;c&&y<=l&&(c=null);let b=f.match(r);if(b){let x=b[1];s.push({type:"class",name:x,line:h,visibility:x.startsWith("_")?"private":"public",isAsync:!1}),c=x,l=y;continue}let g=f.match(a);if(g){let x=!!g[1],w=g[2],De=c!==null&&y>l,Q="public";w.startsWith("__")&&!w.endsWith("__")?Q="private":w.startsWith("_")&&(Q="protected"),s.push({type:"function",name:De?`${c}.${w}`:w,line:h,visibility:Q,isAsync:x})}}s.length===0&&s.push({type:"module",name:this.getFileName(e).replace(".py",""),line:1,visibility:"public",isAsync:!1})}else s.push({type:"module",name:this.getFileName(e).replace(".py",""),line:1,visibility:"public",isAsync:!1})}return s}async extractImports(e){let t=this.getFileExtension(e),s=[];if(X.has(t)){let n=await this.fileReader.readFile(e);if(n.success){let i=this.getFileName(e),o=null;try{let r=await ye(n.value,t);r&&(o=r.imports)}catch{o=null}if(o===null)try{let r=this.tsParser.parseFile(i,n.value);o=this.tsParser.extractImports(r).map(a=>a.module)}catch{o=[]}for(let r of o)r.startsWith("node:")||s.push(r)}}return s}async executeCypherQuery(e,t){let s=[],n=[],i=new Map,o=/MATCH\s+\((\w+):(\w+)\)\s*-\[(\w+)?:?(\w+)?\]\s*->\s*\((\w+):(\w+)\)/i.exec(e);if(o){let[,a,c,,l,d,p]=o,h=await this.findNodesByLabel(c,t*2);i.set(a,h);for(let f of h.slice(0,t)){let y=await this.getEdges(f.id,"outgoing");for(let b of y){if(l&&b.type!==l)continue;let g=await this.getNode(b.target);g&&g.label===p&&(s.some(x=>x.id===f.id)||s.push(f),s.some(x=>x.id===g.id)||s.push(g),n.some(x=>x.source===b.source&&x.target===b.target&&x.type===b.type)||n.push(b))}}d&&i.set(d,s.filter(f=>f.label===p))}else{let a=/MATCH\s+\((\w+):(\w+)\)/i.exec(e);if(a){let[,c,l]=a,d=await this.findNodesByLabel(l,t);i.set(c,d),s.push(...d)}}let r=/WHERE\s+(\w+)\.(\w+)\s*=\s*['"]?([^'")\s]+)['"]?/i.exec(e);if(r){let[,a,c,l]=r,p=(i.get(a)||s).filter(y=>{let b=y.properties[c];return b!==void 0&&String(b)===l});s.length=0,s.push(...p.slice(0,t));let h=new Set(s.map(y=>y.id)),f=n.filter(y=>h.has(y.source)&&h.has(y.target));n.length=0,n.push(...f)}return R({nodes:s.slice(0,t),edges:n,metadata:{query:e,type:"cypher",resultCount:s.length,edgeCount:n.length}})}async findNodesByLabel(e,t){let s=[],n=`${this.config.namespace}:node:*`,i=await this.memory.search(n,t*2,this.nsOpts);for(let o of i){let r=await this.memory.get(o,this.nsOpts);if(r&&r.label===e&&(s.push(r),s.length>=t))break}return s}async executeNaturalLanguageQuery(e,t){if(this.config.enableVectorEmbeddings){let r=await this.generateQueryEmbedding(e),a=await this.memory.vectorSearch(r,t),c=[];for(let l of a){let d=l.metadata?.nodeId;if(d){let p=await this.getNode(d);p&&c.push(p)}}return R({nodes:c,edges:[],metadata:{query:e,type:"natural-language",resultCount:c.length,searchScores:a.map(l=>l.score)}})}let s=e.toLowerCase().split(/\s+/),n=`${this.config.namespace}:node:*`,i=await this.memory.search(n,t*3,this.nsOpts),o=[];for(let r of i){let a=await this.memory.get(r,this.nsOpts);if(a){let c=JSON.stringify(a.properties).toLowerCase();if(s.some(l=>c.includes(l))&&(o.push(a),o.length>=t))break}}return R({nodes:o,edges:[],metadata:{query:e,type:"keyword",resultCount:o.length}})}async traverseDependencies(e,t,s,n,i,o,r,a){if(s<=0||n.has(e)){let f=r.indexOf(e);f>=0&&a.push([...r.slice(f),e]);return}n.add(e),r.push(e);let c=this.pathToNodeId(e),l=new Set(["import","call","extends","implements"]),d=(await this.getEdges(c,t)).filter(f=>l.has(f.type)),p=d.filter(f=>f.target===c).length,h=d.filter(f=>f.source===c).length;i.push({id:c,path:e,type:"file",inDegree:p,outDegree:h});for(let f of d){let y={source:f.source,target:f.target,type:f.type};if(o.some(g=>g.source===y.source&&g.target===y.target)||o.push(y),f.source!==c)continue;let b=this.nodeIdToPath(f.target);b&&await this.traverseDependencies(b,t,s-1,n,i,o,r,a)}r.pop()}calculateDependencyMetrics(e,t){let s=e.length,n=t.length,i=s>0?e.reduce((a,c)=>a+c.inDegree+c.outDegree,0)/s:0,o=0;if(e.length>0){let a=new Map;for(let l of t){let d=a.get(l.source)||[];d.push(l.target),a.set(l.source,d)}let c=new Map;for(let l of e)c.has(l.id)||this.bfsDepth(l.id,a,c),o=Math.max(o,c.get(l.id)||0)}let r=n-s+2;return{totalNodes:s,totalEdges:n,avgDegree:Math.round(i*100)/100,maxDepth:o,cyclomaticComplexity:Math.max(1,r)}}bfsDepth(e,t,s){let n=[{id:e,depth:0}];for(;n.length>0;){let i=n.shift(),o=s.get(i.id)??-1;i.depth>o&&s.set(i.id,i.depth);let r=t.get(i.id)||[];for(let a of r)(!s.has(a)||(s.get(a)??0)<i.depth+1)&&n.push({id:a,depth:i.depth+1})}}filterEdgesByDirection(e,t,s){return e.filter(n=>s==="incoming"?n.target===t:s==="outgoing"?n.source===t:n.source===t||n.target===t)}async storeIndexMetadata(e){}async generateEmbedding(e){let t=`${e.type} ${e.name} ${e.visibility}${e.isAsync?" async":""}`;try{return await this.embedder.embed(t)}catch{return this.fallbackEmbedding(t)}}async generateQueryEmbedding(e){try{return await this.embedder.embed(e)}catch{return this.fallbackEmbedding(e)}}fallbackEmbedding(e){let t=new Array(this.config.embeddingDimension).fill(0),s=e.toLowerCase().split(/\s+/);for(let i=0;i<s.length;i++){let o=s[i];for(let r=0;r<o.length&&r<t.length;r++)t[(i+r)%t.length]+=o.charCodeAt(r)/1e3}let n=Math.sqrt(t.reduce((i,o)=>i+o*o,0))||1;return t.map(i=>i/n)}pathToNodeId(e){return e.replace(/[/\\]/g,":").replace(/\./g,"_")}resolveImportPath(e,t){if(!e.startsWith("."))return e;let s=Ze(Ye(t),e),n=[s,`${s}.ts`,`${s}.tsx`,`${s}.js`,`${s}.jsx`,`${s}.mjs`,`${s}.cjs`,J(s,"index.ts"),J(s,"index.tsx"),J(s,"index.js"),J(s,"index.jsx")];for(let i of n)try{if(Xe(i)&&Qe(i).isFile())return i}catch{}return`${s}.ts`}nodeIdToPath(e){let t=e.replace(/:/g,"/").replace(/_(?=[^_]*$)/,".");return t.includes("/")?t:null}getFileName(e){return e.split(/[/\\]/).pop()||e}getFileExtension(e){let s=this.getFileName(e).split(".");return s.length>1?s.pop():""}getFileType(e){let t=this.getFileExtension(e);return{ts:"typescript",tsx:"typescript-react",js:"javascript",jsx:"javascript-react",py:"python",go:"go",java:"java",rs:"rust",rb:"ruby",cs:"csharp",swift:"swift"}[t]||"unknown"}matchesLanguage(e,t){let s={typescript:["ts","tsx"],javascript:["js","jsx"],python:["py"],go:["go"],java:["java"],rust:["rs"],csharp:["cs"],swift:["swift"]};return t.some(n=>(s[n.toLowerCase()]||[n]).includes(e))}isTestFile(e){return[/\.test\.[tj]sx?$/,/\.spec\.[tj]sx?$/,/_test\.[tj]sx?$/,/test_.*\.py$/,/.*_test\.py$/,/.*_test\.go$/].some(s=>s.test(e))}destroy(){this.nodeCache.clear(),this.edgeIndex.clear()}};export{m as a,ct as b,v as c,$ as d,N as e,S as f,k as g,Ne as h};
|
|
@@ -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.15.
|
|
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.15.13");process.exit(0)}
|
|
2
2
|
function r(e,f){if(e==null)return e;let n={...e};for(let t of f){let o=n[t];typeof o=="string"&&(n[t]=new Date(o))}return n}export{r as a};
|
|
@@ -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.15.
|
|
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.15.13");process.exit(0)}
|
|
2
2
|
var l=class m{vertices=new Map;edges=new Map;adjacencyList=new Map;totalWeight=0;addVertex(e){if(this.vertices.has(e.id)){this.vertices.set(e.id,e);return}this.vertices.set(e.id,e),this.adjacencyList.set(e.id,[])}removeVertex(e){if(!this.vertices.has(e))return!1;let t=this.adjacencyList.get(e)||[];for(let r of t)this.removeEdge(e,r.neighborId);for(let[,r]of this.adjacencyList){let n=r.findIndex(i=>i.neighborId===e);n!==-1&&(this.totalWeight-=r[n].weight,r.splice(n,1))}return this.vertices.delete(e),this.adjacencyList.delete(e),!0}getVertex(e){return this.vertices.get(e)}hasVertex(e){return this.vertices.has(e)}getVertices(){return Array.from(this.vertices.values())}getVertexIds(){return Array.from(this.vertices.keys())}getVerticesByDomain(e){return this.getVertices().filter(t=>t.domain===e)}getVerticesByType(e){return this.getVertices().filter(t=>t.type===e)}addEdge(e){if(!this.vertices.has(e.source))throw new Error(`Source vertex ${e.source} does not exist`);if(!this.vertices.has(e.target))throw new Error(`Target vertex ${e.target} does not exist`);let t=this.edgeKey(e.source,e.target);if(this.edges.has(t)){let r=this.edges.get(t);this.totalWeight-=r.weight,this.removeFromAdjacency(e.source,e.target),r.bidirectional&&this.removeFromAdjacency(e.target,e.source)}this.edges.set(t,e),this.totalWeight+=e.weight,this.addToAdjacency(e.source,e.target,e.weight,e),e.bidirectional&&this.addToAdjacency(e.target,e.source,e.weight,e)}removeEdge(e,t){let r=this.edgeKey(e,t),n=this.edges.get(r);return n?(this.totalWeight-=n.weight,this.edges.delete(r),this.removeFromAdjacency(e,t),n.bidirectional&&this.removeFromAdjacency(t,e),!0):!1}getEdge(e,t){return this.edges.get(this.edgeKey(e,t))}hasEdge(e,t){return this.edges.has(this.edgeKey(e,t))}getEdges(){return Array.from(this.edges.values())}getEdgesForVertex(e){return(this.adjacencyList.get(e)||[]).map(r=>r.edge)}degree(e){return this.adjacencyList.get(e)?.length||0}weightedDegree(e){let t=this.adjacencyList.get(e);return t?t.reduce((r,n)=>r+n.weight,0):0}neighbors(e){return(this.adjacencyList.get(e)||[]).map(r=>({vertex:this.vertices.get(r.neighborId),weight:r.weight})).filter(r=>r.vertex!==void 0)}neighborIds(e){return(this.adjacencyList.get(e)||[]).map(r=>r.neighborId)}getStats(){let e=this.vertices.size,t=this.edges.size,r=0;for(let[,s]of this.adjacencyList)r+=s.length;let n=e>0?r/e:0,i=e>1?e*(e-1)/2:0,a=i>0?t/i:0,o=this.countConnectedComponents(),c=o===1&&e>0;return{vertexCount:e,edgeCount:t,totalWeight:this.totalWeight,averageDegree:n,density:a,isConnected:c,componentCount:o}}countConnectedComponents(){let e=new Set,t=0;for(let r of this.vertices.keys())e.has(r)||(this.dfs(r,e),t++);return t}dfs(e,t){t.add(e);let r=this.adjacencyList.get(e)||[];for(let n of r)t.has(n.neighborId)||this.dfs(n.neighborId,t)}isConnected(){if(this.vertices.size===0||this.vertices.size===1)return!0;let e=new Set,t=this.vertices.keys().next().value;return t===void 0?!0:(this.dfs(t,e),e.size===this.vertices.size)}getConnectedComponent(e){if(!this.vertices.has(e))return[];let t=new Set;return this.dfs(e,t),Array.from(t)}snapshot(){return{timestamp:new Date,vertices:this.getVertices(),edges:this.getEdges(),stats:this.getStats()}}clone(){let e=new m;for(let t of this.vertices.values())e.addVertex({...t});for(let t of this.edges.values())e.addEdge({...t});return e}static fromSnapshot(e){let t=new m;for(let r of e.vertices)t.addVertex(r);for(let r of e.edges)t.addEdge(r);return t}clear(){this.vertices.clear(),this.edges.clear(),this.adjacencyList.clear(),this.totalWeight=0}get vertexCount(){return this.vertices.size}get edgeCount(){return this.edges.size}isEmpty(){return this.vertices.size===0}edgeKey(e,t){return e<t?`${e}:${t}`:`${t}:${e}`}addToAdjacency(e,t,r,n){let i=this.adjacencyList.get(e);i&&(i.find(o=>o.neighborId===t)||i.push({neighborId:t,weight:r,edge:n}))}removeFromAdjacency(e,t){let r=this.adjacencyList.get(e);if(r){let n=r.findIndex(i=>i.neighborId===t);n!==-1&&r.splice(n,1)}}};function p(){return new l}var f=class{approxMinCut(e){let t=Date.now();if(e.isEmpty())return this.emptyResult(t,"weighted-degree");let r=e.getVertexIds(),n=1/0,i=null;for(let o of r){let c=e.weightedDegree(o);c<n&&(n=c,i=o)}if(i===null||r.length===1)return this.emptyResult(t,"weighted-degree");let a=e.getEdgesForVertex(i);return{value:n,sourceSide:[i],targetSide:r.filter(o=>o!==i),cutEdges:a,calculatedAt:new Date,algorithm:"weighted-degree",durationMs:Date.now()-t}}findWeakVertices(e,t){if(e.isEmpty())return[];let r=e.getVertices(),n=[],i=new Map,a=0;for(let g of r){let h=e.weightedDegree(g.id);i.set(g.id,h),a+=h}let o=a/r.length,c=0;for(let g of i.values())c+=(g-o)**2;let s=Math.sqrt(c/r.length),d=1/0;for(let g of i.values())g<d&&(d=g);let u=t??o-s;for(let g of r){let h=i.get(g.id);if(h<=u){let w=this.calculateRiskScore(h,o,s,d),y=this.determineWeakReason(g,h,o,e),v=this.generateStrengtheningActions(g,e,h);n.push({vertexId:g.id,vertex:g,weightedDegree:h,riskScore:w,reason:y,suggestions:v})}}return n.sort((g,h)=>h.riskScore-g.riskScore),n}getMinCutValue(e){if(e.isEmpty())return 0;let t=1/0;for(let r of e.getVertexIds()){let n=e.weightedDegree(r);n<t&&(t=n)}return t===1/0?0:t}isConnectivityCritical(e,t){return this.getMinCutValue(e)<t}getMinDegreeVertex(e){if(e.isEmpty())return null;let t=1/0,r=null;for(let n of e.getVertexIds()){let i=e.weightedDegree(n);i<t&&(t=i,r=n)}return r?{vertexId:r,degree:t}:null}getLocalMinCut(e,t){return e.hasVertex(t)?e.weightedDegree(t):0}findPartitioningPoints(e){if(e.isEmpty()||e.vertexCount<2)return[];let t=this.findArticulationPoints(e),r=[];for(let n of e.getVertices()){let i=this.getLocalMinCut(e,n.id);r.push({vertexId:n.id,localMinCut:i,wouldDisconnect:t.has(n.id)&&e.vertexCount>2})}return r.sort((n,i)=>n.localMinCut-i.localMinCut),r}findArticulationPoints(e){let t=new Map,r=new Map,n=new Map,i=new Set,a=0,o=e.getVertexIds();for(let s of o)t.set(s,-1),r.set(s,-1),n.set(s,null);let c=s=>{let d=0;t.set(s,a),r.set(s,a),a++;for(let u of e.neighborIds(s))t.get(u)===-1?(d++,n.set(u,s),c(u),r.set(s,Math.min(r.get(s),r.get(u))),n.get(s)===null&&d>1&&i.add(s),n.get(s)!==null&&r.get(u)>=t.get(s)&&i.add(s)):u!==n.get(s)&&r.set(s,Math.min(r.get(s),t.get(u)))};for(let s of o)t.get(s)===-1&&c(s);return i}suggestEdgeAdditions(e,t){let r=this.findWeakVertices(e),n=[],i=0,a=e.getVertices().map(o=>({vertex:o,degree:e.weightedDegree(o.id)})).sort((o,c)=>c.degree-o.degree);for(let o of r){if(i>=t)break;let c=new Set(e.neighborIds(o.vertexId));for(let{vertex:s}of a){if(s.id===o.vertexId||c.has(s.id))continue;let d={source:o.vertexId,target:s.id,weight:1,type:"coordination",bidirectional:!0};n.push(d),i+=1;break}}return n}emptyResult(e,t){return{value:0,sourceSide:[],targetSide:[],cutEdges:[],calculatedAt:new Date,algorithm:t,durationMs:Date.now()-e}}calculateRiskScore(e,t,r,n){if(r===0)return .5;let i=(t-e)/r,a=1/(1+Math.exp(-i)),o=n>0?n/e:1;return Math.min(1,a*o)}determineWeakReason(e,t,r,n){return t===0?"Isolated vertex with no connections":n.degree(e.id)===1?"Single connection point (leaf node)":t<r*.5?`Low connectivity (${(t/r*100).toFixed(0)}% of average)`:"Below average connectivity threshold"}generateStrengtheningActions(e,t,r){let n=[],i=new Set(t.neighborIds(e.id)),a=t.getStats().averageDegree,o=Math.max(a,3),c=Math.ceil(o-r),s=t.getVertices().filter(d=>d.id!==e.id&&!i.has(d.id)).sort((d,u)=>t.weightedDegree(u.id)-t.weightedDegree(d.id)).slice(0,c);for(let d of s)n.push({type:"add_edge",targetVertex:d.id,priority:"high",estimatedImprovement:1});return e.type==="agent"&&e.domain&&r<1&&n.push({type:"spawn_agent",domain:e.domain,priority:"critical",estimatedImprovement:2}),i.size>0&&i.size<3&&n.push({type:"increase_weight",weightDelta:.5,priority:"medium",estimatedImprovement:.5*i.size}),n}};function x(){return new f}export{l as a,p as b,f as c,x as d};
|