agentic-qe 3.15.1 → 3.15.3
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/helpers/brain-checkpoint.cjs +46 -6
- package/.claude/hooks/aqe-hook.cjs +280 -51
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +129 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/adapters/ag-ui/state-delta-cache.js +14 -5
- package/dist/adapters/trajectory-adapter.js +3 -1
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-WQSFQES5.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-XUHRLKWP.js → agent-booster-wasm-CYG3PKHH.js} +2 -2
- package/dist/cli/chunks/{agent-handler-CL7MJP5W.js → agent-handler-WTFYFZKL.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-F7RV72FC.js → agent-memory-branch-G6WE3ZXU.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-TDHBBADE.js +2 -0
- package/dist/cli/chunks/{arena-GRRNK7IN.js → arena-S72QW44C.js} +4 -4
- package/dist/cli/chunks/{arena-LHLVOQHW.js → arena-ZFXQEVUQ.js} +2 -2
- package/dist/cli/chunks/{audit-EOP2K34L.js → audit-KPYIEQJ3.js} +3 -3
- package/dist/cli/chunks/base-CZSB27VO.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-YERQ5DOL.js → better-sqlite3-L2M3TI5D.js} +2 -2
- package/dist/cli/chunks/{brain-handler-FBXBM5XE.js → brain-handler-FHKLQTB4.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-NWO6LNHB.js → branch-enumerator-3BSHOPOK.js} +2 -2
- package/dist/cli/chunks/{browser-EDCG7TNF.js → browser-JUIJPL6Y.js} +2 -2
- package/dist/cli/chunks/browser-workflow-AEMIS6PA.js +2 -0
- package/dist/cli/chunks/{chunk-ARWSPV2C.js → chunk-2GJJGO5D.js} +2 -2
- package/dist/cli/chunks/{chunk-SUFXUM6W.js → chunk-2M75CW5Q.js} +2 -2
- package/dist/cli/chunks/{chunk-ZX4I7IND.js → chunk-2MEWIXW4.js} +2 -2
- package/dist/cli/chunks/{chunk-VEKRK3R6.js → chunk-2TBHPYOU.js} +2 -2
- package/dist/cli/chunks/{chunk-OH4SKOAM.js → chunk-34Y4CIHD.js} +2 -2
- package/dist/cli/chunks/{chunk-JY6HWYC4.js → chunk-35VDOH4Y.js} +1 -1
- package/dist/cli/chunks/{chunk-NK2BR4QZ.js → chunk-366IBPZB.js} +2 -2
- package/dist/cli/chunks/{chunk-PZBYZV5M.js → chunk-3MNKYCLH.js} +1 -1
- package/dist/cli/chunks/chunk-3UUMGWHW.js +316 -0
- package/dist/cli/chunks/{chunk-REGPCPEJ.js → chunk-3Y4GX5FL.js} +2 -2
- package/dist/cli/chunks/{chunk-PGARKOE6.js → chunk-3ZTBV6M3.js} +1 -1
- package/dist/cli/chunks/{chunk-GUHJWBPN.js → chunk-4IYHYHTG.js} +2 -2
- package/dist/cli/chunks/{chunk-J2WALRWR.js → chunk-4JVVVKAX.js} +6 -6
- package/dist/cli/chunks/chunk-4N7YXTV3.js +4 -0
- package/dist/cli/chunks/{chunk-YM3GAJMN.js → chunk-4TM5K6EZ.js} +2 -2
- package/dist/cli/chunks/{chunk-IUGY6Z4Q.js → chunk-5LEUEWJY.js} +2 -2
- package/dist/cli/chunks/{chunk-Q7ONRZBD.js → chunk-5QUOM357.js} +1 -1
- package/dist/cli/chunks/{chunk-5B5TA3X4.js → chunk-5WOBFN2T.js} +2 -2
- package/dist/cli/chunks/{chunk-JEXPSOT2.js → chunk-6AKJ73X3.js} +2 -2
- package/dist/cli/chunks/{chunk-K4NB3MYN.js → chunk-6EQDA4EC.js} +2 -2
- package/dist/cli/chunks/{chunk-HU4QGCIJ.js → chunk-6TYTBQPV.js} +2 -2
- package/dist/cli/chunks/{chunk-RXKOZ6VS.js → chunk-6V6XVGCL.js} +3 -3
- package/dist/cli/chunks/{chunk-4KHSWNFW.js → chunk-6W6GZHQA.js} +6 -6
- package/dist/cli/chunks/{chunk-WTFVYFRZ.js → chunk-7IJVCDDC.js} +1 -1
- package/dist/cli/chunks/{chunk-T5K6ZCA6.js → chunk-7PDC4SKR.js} +1 -1
- package/dist/cli/chunks/{chunk-NF6SLLE6.js → chunk-7SWHW5AC.js} +20 -20
- package/dist/cli/chunks/{chunk-UE33MZOC.js → chunk-7TW5UGDP.js} +2 -2
- package/dist/cli/chunks/{chunk-4AEFJEZH.js → chunk-7UUSV2SK.js} +1 -1
- package/dist/cli/chunks/{chunk-WONHFDWF.js → chunk-A3IQU2ND.js} +2 -2
- package/dist/cli/chunks/{chunk-ALLABEUK.js → chunk-A5H7TF7C.js} +2 -2
- package/dist/cli/chunks/{chunk-C3BW3Q27.js → chunk-A6PII4R4.js} +1 -1
- package/dist/cli/chunks/{chunk-ZE6WJDXM.js → chunk-AEL4XJGJ.js} +2 -2
- package/dist/cli/chunks/{chunk-5QEXDXHQ.js → chunk-AOZJ6UUZ.js} +2 -2
- package/dist/cli/chunks/chunk-APV5UWTU.js +15 -0
- package/dist/cli/chunks/{chunk-YWX7KLNG.js → chunk-AQTQ24SK.js} +3 -3
- package/dist/cli/chunks/{chunk-PBWR2SKH.js → chunk-AS54N3H7.js} +2 -2
- package/dist/cli/chunks/chunk-ASUXS4N4.js +2 -0
- package/dist/cli/chunks/{chunk-JSHASVQ2.js → chunk-B23ROYST.js} +3 -3
- package/dist/cli/chunks/{chunk-NTLWHLAY.js → chunk-BDKQSEEY.js} +1 -1
- package/dist/cli/chunks/{chunk-VLL7ASGH.js → chunk-BO43BGHX.js} +2 -2
- package/dist/cli/chunks/{chunk-KP6LNSDO.js → chunk-CF3BPD2R.js} +161 -159
- package/dist/cli/chunks/{chunk-KTBA2HJC.js → chunk-CFXROOIU.js} +2 -2
- package/dist/cli/chunks/{chunk-SRXXPZVT.js → chunk-CNQUU6CF.js} +2 -2
- package/dist/cli/chunks/{chunk-OKS25EGZ.js → chunk-D5V6C3XG.js} +3 -3
- package/dist/cli/chunks/{chunk-ADEYBXAS.js → chunk-D6PUDLJ4.js} +2 -2
- package/dist/cli/chunks/{chunk-D3LREV4P.js → chunk-DE3QNPTG.js} +1 -1
- package/dist/cli/chunks/{chunk-TJCMG3QE.js → chunk-DH5NWHH2.js} +2 -2
- package/dist/cli/chunks/{chunk-GDSYJHVB.js → chunk-DLA3EHKJ.js} +1 -1
- package/dist/cli/chunks/{chunk-VGYLV6VD.js → chunk-DWG4TN6A.js} +1 -1
- package/dist/cli/chunks/{chunk-4KSCJ462.js → chunk-EBIMVSPH.js} +4 -4
- package/dist/cli/chunks/{chunk-4XEZ562Q.js → chunk-ED5HUPUR.js} +2 -2
- package/dist/cli/chunks/{chunk-CHX65QXY.js → chunk-EQGT4VLC.js} +1 -1
- package/dist/cli/chunks/{chunk-WFDDWRWY.js → chunk-F5BREV2Q.js} +8 -8
- package/dist/cli/chunks/{chunk-7FGSX4UD.js → chunk-FPFGN2Z5.js} +2 -2
- package/dist/cli/chunks/{chunk-3TZRJ5QD.js → chunk-FTUNC4EI.js} +3 -3
- package/dist/cli/chunks/chunk-FXTZXZCU.js +54 -0
- package/dist/cli/chunks/{chunk-DREYYJ7A.js → chunk-GJB3LPCS.js} +2 -2
- package/dist/cli/chunks/{chunk-4P7CGSRL.js → chunk-GPZH6OPP.js} +4 -4
- package/dist/cli/chunks/{chunk-NWNZMXNO.js → chunk-HR7RL4PB.js} +2 -2
- package/dist/cli/chunks/{chunk-NGDRSF6Y.js → chunk-HSR53REE.js} +2 -2
- package/dist/cli/chunks/{chunk-UOHZRR5C.js → chunk-HU474NXP.js} +1 -1
- package/dist/cli/chunks/{chunk-LI7N45GM.js → chunk-HV3ZVUHO.js} +1 -1
- package/dist/cli/chunks/{chunk-WPG6SW7C.js → chunk-HVIFA73X.js} +2 -2
- package/dist/cli/chunks/{chunk-6U6JQS4Z.js → chunk-HW4V7BVV.js} +2 -2
- package/dist/cli/chunks/{chunk-X6W35QXO.js → chunk-I5VJ3FBC.js} +2 -2
- package/dist/cli/chunks/{chunk-YTMWPGVR.js → chunk-IARE5VGI.js} +1 -1
- package/dist/cli/chunks/chunk-INVDDFJC.js +2 -0
- package/dist/cli/chunks/{chunk-RDI3W4H6.js → chunk-JJBTM4JO.js} +2 -2
- package/dist/cli/chunks/chunk-JVQK6NGI.js +14 -0
- package/dist/cli/chunks/{chunk-CFZJEOCD.js → chunk-K65X6CQA.js} +1 -1
- package/dist/cli/chunks/{chunk-6DF6X3SZ.js → chunk-KCBCYF7M.js} +2 -2
- package/dist/cli/chunks/{chunk-QOOADAT7.js → chunk-KGS6H2HB.js} +2 -2
- package/dist/cli/chunks/{chunk-TCJ65NPY.js → chunk-L6OSEWOS.js} +1 -1
- package/dist/cli/chunks/{chunk-BW7S6LIJ.js → chunk-LEB6O2IN.js} +2 -2
- package/dist/cli/chunks/{chunk-WHBDSJUE.js → chunk-LPZAB3N2.js} +3 -3
- package/dist/cli/chunks/{chunk-JYF3QF4C.js → chunk-M3ACHBC7.js} +2 -2
- package/dist/cli/chunks/{chunk-WQZR6DS6.js → chunk-M3ONCPSU.js} +2 -2
- package/dist/cli/chunks/{chunk-7B3XVVYP.js → chunk-MUSYQF53.js} +2 -2
- package/dist/cli/chunks/{chunk-6AVVC7Y3.js → chunk-MZDUBFLP.js} +1 -1
- package/dist/cli/chunks/{chunk-53HWWWFZ.js → chunk-NT6FYFJA.js} +2 -2
- package/dist/cli/chunks/{chunk-6WW6A6JM.js → chunk-O66D4NEJ.js} +2 -2
- package/dist/cli/chunks/{chunk-3NOSMJS4.js → chunk-OGARNKLS.js} +2 -2
- package/dist/cli/chunks/{chunk-KHVWIUAF.js → chunk-OKNMZLGB.js} +2 -2
- package/dist/cli/chunks/{chunk-XCVD57GW.js → chunk-OMHISPPF.js} +1 -1
- package/dist/cli/chunks/{chunk-N5OSH5JO.js → chunk-OT6SOPAL.js} +2 -2
- package/dist/cli/chunks/{chunk-ZZV6GR46.js → chunk-OTTTHNIT.js} +1 -1
- package/dist/cli/chunks/{chunk-XZGRHJGC.js → chunk-P36IODAM.js} +2 -2
- package/dist/cli/chunks/{chunk-JHKMUY4W.js → chunk-P6EGRAQG.js} +2 -2
- package/dist/cli/chunks/{chunk-5JJWVFUV.js → chunk-PBUWNMZ2.js} +1 -1
- package/dist/cli/chunks/{chunk-LQI5GVH7.js → chunk-POTVF6BY.js} +1 -1
- package/dist/cli/chunks/{chunk-N4HQ6FE2.js → chunk-POVP6O6K.js} +1 -1
- package/dist/cli/chunks/{chunk-P24ZBDZY.js → chunk-PPA53NJB.js} +2 -2
- package/dist/cli/chunks/{chunk-OABFAREV.js → chunk-PUPEKA2J.js} +2 -2
- package/dist/cli/chunks/{chunk-27S47AYK.js → chunk-QDQLL2QB.js} +2 -2
- package/dist/cli/chunks/{chunk-MEOAKMKF.js → chunk-QSVNVDA5.js} +1 -1
- package/dist/cli/chunks/{chunk-66HKJJFH.js → chunk-QUXX2DP7.js} +2 -2
- package/dist/cli/chunks/{chunk-TLUMENRZ.js → chunk-QVNMTMDJ.js} +2 -2
- package/dist/cli/chunks/{chunk-LDDIYDIP.js → chunk-QZBFMXO5.js} +54 -54
- package/dist/cli/chunks/{chunk-4THIRDBL.js → chunk-RDTR43YN.js} +2 -2
- package/dist/cli/chunks/{chunk-6MGJMGAD.js → chunk-RGD2CG23.js} +2 -2
- package/dist/cli/chunks/{chunk-V5RP2SU3.js → chunk-RQUSJEON.js} +2 -2
- package/dist/cli/chunks/{chunk-WYE3ICSL.js → chunk-RRSZ27A7.js} +2 -2
- package/dist/cli/chunks/{chunk-GUKBN3BS.js → chunk-RWLOERKK.js} +2 -2
- package/dist/cli/chunks/{chunk-5TEDVUEB.js → chunk-RWQDRPN5.js} +2 -2
- package/dist/cli/chunks/{chunk-2IPBCXTT.js → chunk-S7D4GD7H.js} +2 -2
- package/dist/cli/chunks/{chunk-FTHXV7N7.js → chunk-SKHP5WUP.js} +2 -2
- package/dist/cli/chunks/{chunk-QVTV47TM.js → chunk-SP2JO53K.js} +2 -2
- package/dist/cli/chunks/{chunk-UTFNHITI.js → chunk-SRDECRTL.js} +2 -2
- package/dist/cli/chunks/{chunk-HVAYG54D.js → chunk-TBVPNN65.js} +2 -2
- package/dist/cli/chunks/{chunk-JQVECGYL.js → chunk-U5AVZ3T2.js} +1 -1
- package/dist/cli/chunks/{chunk-EQ3BJS37.js → chunk-UCSGZVJX.js} +1 -1
- package/dist/cli/chunks/{chunk-5C4UYXQL.js → chunk-UGNTLSBL.js} +2 -2
- package/dist/cli/chunks/{chunk-W5NHBYYS.js → chunk-UTALYUMW.js} +2 -2
- package/dist/cli/chunks/{chunk-35XRY6ZW.js → chunk-UZDTRCVU.js} +9 -9
- package/dist/cli/chunks/{chunk-AVOYMVD6.js → chunk-V5NYGDSX.js} +2 -2
- package/dist/cli/chunks/{chunk-FQYXPSWD.js → chunk-VGN46ZT4.js} +2 -2
- package/dist/cli/chunks/{chunk-QMHWJBD3.js → chunk-VHBZADYK.js} +2 -2
- package/dist/cli/chunks/{chunk-54JYUOSR.js → chunk-VOKIUF7I.js} +1 -1
- package/dist/cli/chunks/{chunk-PDLVO3ZR.js → chunk-VRT736E3.js} +2 -2
- package/dist/cli/chunks/{chunk-DV7I6CRH.js → chunk-VUBLJBHQ.js} +2 -2
- package/dist/cli/chunks/{chunk-FRGNM6SW.js → chunk-VX7CQUO7.js} +2 -2
- package/dist/cli/chunks/{chunk-YDM2DPUU.js → chunk-W7EHNX3Y.js} +2 -2
- package/dist/cli/chunks/{chunk-W5HQQTVH.js → chunk-WI7I6LMM.js} +1 -1
- package/dist/cli/chunks/{chunk-46DUU44C.js → chunk-WLOHTLHO.js} +2 -2
- package/dist/cli/chunks/{chunk-W6K77PQR.js → chunk-WQZBKLAG.js} +1 -1
- package/dist/cli/chunks/{chunk-UGUZFUQG.js → chunk-WSND64RL.js} +2 -2
- package/dist/cli/chunks/{chunk-PNK5KHSI.js → chunk-WSUYEVSY.js} +1 -1
- package/dist/cli/chunks/{chunk-FIIHSEXP.js → chunk-WTMLRMKW.js} +2 -2
- package/dist/cli/chunks/{chunk-OPBPFNBO.js → chunk-WW4RJ6BH.js} +2 -2
- package/dist/cli/chunks/{chunk-KBK4GBJQ.js → chunk-X335K4SU.js} +2 -2
- package/dist/cli/chunks/{chunk-NS4RIZ4F.js → chunk-X33LID2T.js} +1 -1
- package/dist/cli/chunks/{chunk-L5GEWKR3.js → chunk-XTGVGZ4J.js} +3 -3
- package/dist/cli/chunks/{chunk-CTLHNFPM.js → chunk-XV2TIODR.js} +1 -1
- package/dist/cli/chunks/{chunk-GAKVCN3C.js → chunk-XXW4KFBB.js} +1 -1
- package/dist/cli/chunks/{chunk-CTK7NMSJ.js → chunk-YCGU2LI7.js} +2 -2
- package/dist/cli/chunks/chunk-YGEC3PSD.js +2 -0
- package/dist/cli/chunks/{chunk-ARGMYSDY.js → chunk-YGKU2QRC.js} +1 -1
- package/dist/cli/chunks/{chunk-6Q7PWKWV.js → chunk-YHZGFWJE.js} +2 -2
- package/dist/cli/chunks/{chunk-V3ISBQ5Q.js → chunk-YJH7UFA2.js} +2 -2
- package/dist/cli/chunks/{chunk-A5LOELVV.js → chunk-YQ3ZW47V.js} +2 -2
- package/dist/cli/chunks/{chunk-25IWHVMW.js → chunk-YTRGMILO.js} +2 -2
- package/dist/cli/chunks/chunk-YW4GM36K.js +2 -0
- package/dist/cli/chunks/{chunk-JW2HNT3J.js → chunk-Z7JPWXW2.js} +2 -2
- package/dist/cli/chunks/{chunk-PZDI7WQ3.js → chunk-Z7UGEQ4G.js} +1 -1
- package/dist/cli/chunks/{chunk-TBCQWD5A.js → chunk-ZATQLTYL.js} +1 -1
- package/dist/cli/chunks/{chunk-DKWB4ERY.js → chunk-ZI6NJEBY.js} +1 -1
- package/dist/cli/chunks/{chunk-B3DWOR5R.js → chunk-ZJW4HRUA.js} +1 -1
- package/dist/cli/chunks/{chunk-X4PGLEPQ.js → chunk-ZL2GYU7H.js} +2 -2
- package/dist/cli/chunks/{ci-K7DG4GSO.js → ci-JPISJ25U.js} +3 -3
- package/dist/cli/chunks/{ci-output-EBSUG6HP.js → ci-output-DPHTFIGX.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-P6N6YIRZ.js → circuit-breaker-PQ65VU2M.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-P6EZPQZT.js → claude-flow-setup-GKHVO7AD.js} +2 -2
- package/dist/cli/chunks/client-BS7I637W.js +2 -0
- package/dist/cli/chunks/{cline-installer-EVZZ3EFY.js → cline-installer-HWMQZJ64.js} +2 -2
- package/dist/cli/chunks/{code-3WLBG2XK.js → code-OTY7BF3D.js} +3 -3
- package/dist/cli/chunks/{code-index-extractor-ZP6D4WL2.js → code-index-extractor-FG3TMHHR.js} +2 -2
- package/dist/cli/chunks/{codex-installer-XAUI4SB7.js → codex-installer-63JARKKS.js} +2 -2
- package/dist/cli/chunks/{completions-RHFNDDG3.js → completions-4ZHONFML.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-DCW7Q3OR.js → complexity-analyzer-FYHTJW5Y.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-53SQA5T6.js → continuedev-installer-ZAWDSUR3.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-SXXMFB6T.js → copilot-installer-5QK565JX.js} +2 -2
- package/dist/cli/chunks/core-handlers-UG7RMTK5.js +2 -0
- package/dist/cli/chunks/cost-tracker-AWWMPPBJ.js +2 -0
- package/dist/cli/chunks/{coverage-AWCS2SP7.js → coverage-SMFQEGKE.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-NX7F6TOF.js +2 -0
- package/dist/cli/chunks/{cursor-installer-4TYF5V5J.js → cursor-installer-3BL7JACV.js} +2 -2
- package/dist/cli/chunks/{daemon-CTZXGN5V.js → daemon-OJ624POF.js} +4 -4
- package/dist/cli/chunks/{daemon-OOY4H6RJ.js → daemon-R6ULBHHF.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-3WG24Q33.js → dag-attention-scheduler-J6I3LTMY.js} +2 -2
- package/dist/cli/chunks/{detect-O7MUZ6NX.js → detect-5Q5W33UR.js} +2 -2
- package/dist/cli/chunks/{dist-node-H4XI7BAF.js → dist-node-GJNW56NA.js} +2 -2
- package/dist/cli/chunks/{domain-handler-FU4WZ23B.js → domain-handler-IZQY2G44.js} +2 -2
- package/dist/cli/chunks/{domain-plugins-XK26KYNJ.js → domain-plugins-PIGO3KI2.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-6B5NOVH6.js → domain-transfer-NU3B4FQG.js} +2 -2
- package/dist/cli/chunks/dream-GYEH57FW.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-XNZXPZNL.js → embed-and-insert-pattern-5QDDRPWV.js} +2 -2
- package/dist/cli/chunks/{eval-J3Q5TTI7.js → eval-TB5HOAUY.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-COKIGMXW.js → experience-capture-middleware-SIYVLKDE.js} +3 -3
- package/dist/cli/chunks/{fast-paths-IHWPJI6I.js → fast-paths-T7QELS6D.js} +2 -2
- package/dist/cli/chunks/{feature-flags-WUXFWZLR.js → feature-flags-T3CNNYMJ.js} +2 -2
- package/dist/cli/chunks/{feature-flags-G7ONDNTT.js → feature-flags-TNZ7ZAJV.js} +2 -2
- package/dist/cli/chunks/{file-discovery-JN3YMBOJ.js → file-discovery-M45P2ZCY.js} +2 -2
- package/dist/cli/chunks/{fleet-OUHUZJE4.js → fleet-DSBZPHBZ.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-PRH55ZT6.js → gnn-wrapper-EHODCF32.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-6YF35AQS.js → heartbeat-handler-V5DBVF7V.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-4TJ3T7LR.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-PHFK4EAP.js +2 -0
- package/dist/cli/chunks/hnsw-index-434XDDBH.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-7PAFSTJO.js → hnsw-legacy-bridge-IYKDYA2F.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-UETDZNNN.js → hnswlib-node-DKG4LW3X.js} +2 -2
- package/dist/cli/chunks/{hooks-QQNUKQAS.js → hooks-VKNMAILY.js} +10 -10
- package/dist/cli/chunks/hybrid-backend-DYVJQENQ.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-5GDGE3ET.js → hypergraph-engine-AXZVP7A7.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-C3F2OJYA.js → hypergraph-handler-6EO6JN4Z.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-CBAST6M2.js +2 -0
- package/dist/cli/chunks/init-handler-N3NG3RHN.js +86 -0
- package/dist/cli/chunks/init-wizard-DWIJW7HY.js +2 -0
- package/dist/cli/chunks/kernel-AQGCS4X2.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-VLJENC76.js → kilocode-installer-JICGAHLM.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-UYPYM6LA.js → kiro-installer-VYBFP6ZH.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-2ICXFUUV.js +2 -0
- package/dist/cli/chunks/{learning-SFIWIG6Z.js → learning-3BHEZEPK.js} +3 -3
- package/dist/cli/chunks/{llm-router-V633KAS5.js → llm-router-GPTEZCUN.js} +4 -4
- package/dist/cli/chunks/llm-router-service-C47RGTH6.js +2 -0
- package/dist/cli/chunks/{load-UWZV4JRA.js → load-W5BIRPU4.js} +2 -2
- package/dist/cli/chunks/load-test-LRDAW3N6.js +2 -0
- package/dist/cli/chunks/{mcp-XVFHUKCP.js → mcp-EBV4DZPG.js} +2 -2
- package/dist/cli/chunks/{memory-BQ5652VK.js → memory-7F6YYKNL.js} +5 -5
- package/dist/cli/chunks/memory-backend-UFBAYPQ6.js +2 -0
- package/dist/cli/chunks/memory-handlers-OGLJHAAJ.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-X6AQ7VVR.js → multi-model-executor-3ZIA2YOL.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-N3V2Z4EF.js → opencode-installer-2XRZUTLR.js} +2 -2
- package/dist/cli/chunks/{orchestrator-KNEKS4F7.js → orchestrator-VSZVJUJW.js} +87 -28
- package/dist/cli/chunks/pattern-null-store-27FCITT3.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-MZIM6XWU.js → pattern-usage-recorder-I2IGVHRL.js} +2 -2
- package/dist/cli/chunks/{pipeline-LNLBKSXR.js → pipeline-5G3O6WBY.js} +2 -2
- package/dist/cli/chunks/{platform-OMUDXHD3.js → platform-6GUFDIA3.js} +2 -2
- package/dist/cli/chunks/{plugin-HGY6KKZW.js → plugin-GYXE4CIC.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-LZBHLQYN.js → prime-radiant-advanced-wasm-THX6JLGZ.js} +2 -2
- package/dist/cli/chunks/{project-root-VPSCDBMD.js → project-root-QJRBKZQU.js} +2 -2
- package/dist/cli/chunks/protocol-executor-XWXXTMEW.js +2 -0
- package/dist/cli/chunks/{protocol-handler-LZXT3TXU.js → protocol-handler-B54LRU26.js} +2 -2
- package/dist/cli/chunks/{prove-I4VKQEYQ.js → prove-PCY2WQOD.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-3RMYXENE.js +2 -0
- package/dist/cli/chunks/{quality-VVAWK2DD.js → quality-LPVDZC7U.js} +2 -2
- package/dist/cli/chunks/{quality-gate-RGXLWYT6.js → quality-gate-L3KXL6WE.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-AS6DZ7UJ.js +2 -0
- package/dist/cli/chunks/{real-embeddings-WM66PMQ6.js → real-embeddings-N3H523PJ.js} +2 -2
- package/dist/cli/chunks/{ref-validation-ZIWJNI6M.js → ref-validation-6BKDPHZ7.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-QYSI3STC.js → roocode-installer-NSGGTWXE.js} +2 -2
- package/dist/cli/chunks/router-OVNLNGHO.js +2 -0
- package/dist/cli/chunks/routing-feedback-TBOWEB6H.js +2 -0
- package/dist/cli/chunks/{routing-handler-BID3EOLE.js → routing-handler-SRQNUBG3.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-DXIFMF4W.js → ruvector-commands-2IGULGDE.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-YJYRCYGT.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-VMRQ2SFO.js +2 -0
- package/dist/cli/chunks/{rvf-migration-coordinator-EV5E6SAO.js → rvf-migration-coordinator-ZD6WK5CK.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-B75L3ALW.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-IT6DCCJK.js → rvf-store-integrity-QULKUBBI.js} +2 -2
- package/dist/cli/chunks/safe-db-CRQHMCV6.js +2 -0
- package/dist/cli/chunks/schedule-L3DKJRXU.js +2 -0
- package/dist/cli/chunks/scheduler-VRHYUGY5.js +2 -0
- package/dist/cli/chunks/{security-AAFAEATQ.js → security-JW4EBARW.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-QIHSYHAF.js → shared-rvf-adapter-VQ7NJTGY.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-V7OZ6TBR.js → shared-rvf-dual-writer-SKTS52HK.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-JVAZETTL.js +2 -0
- package/dist/cli/chunks/{standalone-memory-ALZI6VPX.js → standalone-memory-3N4YJCSY.js} +2 -2
- package/dist/cli/chunks/{status-handler-DED5A3OW.js → status-handler-5BQ2IIDG.js} +2 -2
- package/dist/cli/chunks/{structural-health-CB7L3NWH.js → structural-health-WGYR2RJB.js} +2 -2
- package/dist/cli/chunks/{sync-QNPGETIO.js → sync-DLKSXTIR.js} +2 -2
- package/dist/cli/chunks/sync-R5OKUBTQ.js +2 -0
- package/dist/cli/chunks/{task-handler-CGHXYFIF.js → task-handler-Z5KNTSUX.js} +2 -2
- package/dist/cli/chunks/{task-handlers-A6BGQJIB.js → task-handlers-RZFMYFSC.js} +3 -3
- package/dist/cli/chunks/test-LHWKZJRN.js +34 -0
- package/dist/cli/chunks/test-scheduling-EN7WXUMS.js +15 -0
- package/dist/cli/chunks/token-bootstrap-4V3OO4EC.js +2 -0
- package/dist/cli/chunks/{token-usage-25BRFKJ5.js → token-usage-PFC2BYBS.js} +2 -2
- package/dist/cli/chunks/{transformers-TBVVSZMF.js → transformers-VZCC4SHC.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-N7KCOQT4.js → tree-sitter-wasm-parser-ZYDQXGKN.js} +2 -2
- package/dist/cli/chunks/{types-TFHWJGRK.js → types-I6AWHZZQ.js} +2 -2
- package/dist/cli/chunks/unified-memory-WOOCCIUM.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-PDDHFLUB.js +2 -0
- package/dist/cli/chunks/unified-persistence-6ETD3JSC.js +2 -0
- package/dist/cli/chunks/{upgrade-4VWQU7RD.js → upgrade-T7SG75PA.js} +2 -2
- package/dist/cli/chunks/{validate-FF7WVXMP.js → validate-YLYEHTY3.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-NRLH4EDC.js → validate-swarm-VTLTRUE3.js} +2 -2
- package/dist/cli/chunks/visual-security-O4OT2YPY.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-VVU3LULW.js → web-tree-sitter-JUM7ZY5M.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-Q2ZNWG2D.js → windsurf-installer-4KS2466T.js} +2 -2
- package/dist/cli/chunks/witness-chain-67JHPDCN.js +2 -0
- package/dist/cli/chunks/{witness-chain-FP3D4PQL.js → witness-chain-E4X6TOCT.js} +2 -2
- package/dist/cli/chunks/witness-chain-repair-MB53OZO6.js +2 -0
- package/dist/cli/chunks/{witness-chain-verifier-LACGL6BK.js → witness-chain-verifier-LBWJHO7Y.js} +2 -2
- package/dist/cli/chunks/{witness-key-manager-GQZIB5ZE.js → witness-key-manager-5IHVMXHJ.js} +2 -2
- package/dist/cli/chunks/{workflow-JPA5Y7L6.js → workflow-XUQXIRNE.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-ZVFSNRYZ.js +2 -0
- package/dist/cli/chunks/wrappers-YVF5SQUN.js +2 -0
- package/dist/cli/commands/test.js +42 -9
- package/dist/cli/handlers/init-flags.d.ts +45 -0
- package/dist/cli/handlers/init-flags.js +35 -0
- package/dist/cli/handlers/init-handler.d.ts +6 -0
- package/dist/cli/handlers/init-handler.js +24 -10
- package/dist/cli/utils/generated-test-writer.d.ts +35 -0
- package/dist/cli/utils/generated-test-writer.js +44 -0
- package/dist/context/compiler.js +4 -1
- package/dist/coordination/consensus/providers/ollama-provider.js +16 -27
- package/dist/coordination/consensus/providers/openrouter-provider.js +13 -24
- package/dist/coordination/handlers/test-execution-handlers.js +4 -2
- package/dist/coordination/protocols/defect-investigation.js +4 -1
- package/dist/coordination/task-executor.js +4 -2
- package/dist/domains/code-intelligence/services/metric-collector/test-counter.js +3 -3
- package/dist/domains/coverage-analysis/services/gap-detector.js +3 -1
- package/dist/domains/learning-optimization/services/learning-coordinator.js +4 -2
- package/dist/domains/test-execution/services/flaky-detector.js +8 -2
- package/dist/domains/test-execution/services/retry-handler.js +23 -20
- package/dist/domains/test-execution/services/test-executor.js +5 -2
- package/dist/domains/test-generation/services/test-generator.js +5 -2
- package/dist/governance/compliance-reporter.js +8 -7
- package/dist/governance/proof-envelope-integration.js +3 -1
- package/dist/init/claude-plugin-detection.d.ts +63 -0
- package/dist/init/claude-plugin-detection.js +118 -0
- package/dist/init/init-wizard-hooks.d.ts +6 -1
- package/dist/init/init-wizard-hooks.js +9 -1
- package/dist/init/init-wizard.d.ts +4 -0
- package/dist/init/init-wizard.js +3 -1
- package/dist/init/orchestrator.js +1 -0
- package/dist/init/phases/07-hooks.js +30 -4
- package/dist/init/phases/08-mcp.d.ts +7 -0
- package/dist/init/phases/08-mcp.js +22 -0
- package/dist/init/phases/10-workers.js +42 -6
- package/dist/init/phases/phase-interface.d.ts +5 -1
- package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.d.ts +4 -1
- package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.js +6 -2
- package/dist/integrations/browser/qe-dashboard/wasm-vector-store.js +2 -1
- package/dist/integrations/ruvector/coverage-router.d.ts +3 -1
- package/dist/integrations/ruvector/coverage-router.js +7 -6
- package/dist/integrations/ruvector/diff-risk-classifier.js +5 -4
- package/dist/integrations/ruvector/rvf-dual-writer.js +10 -1
- package/dist/integrations/vibium/runtime.js +2 -6
- package/dist/learning/dream/dream-engine.d.ts +5 -0
- package/dist/learning/dream/dream-engine.js +20 -3
- package/dist/learning/embedding-space.d.ts +18 -0
- package/dist/learning/embedding-space.js +33 -0
- package/dist/learning/rvf-pattern-store.js +19 -5
- package/dist/mcp/bundle.js +443 -441
- package/dist/mcp/handlers/domain-handler-configs.js +3 -1
- package/dist/mcp/handlers/handler-factory.js +7 -0
- package/dist/mcp/handlers/save-results-option.d.ts +97 -0
- package/dist/mcp/handlers/save-results-option.js +94 -0
- package/dist/mcp/protocol-server.js +23 -11
- package/dist/mcp/security/rate-limiter.d.ts +8 -1
- package/dist/mcp/security/rate-limiter.js +33 -4
- package/dist/mcp/services/session-resume.js +11 -0
- package/dist/mcp/services/session-store.d.ts +31 -2
- package/dist/mcp/services/session-store.js +84 -15
- package/dist/mcp/services/session-write-buffer.d.ts +55 -0
- package/dist/mcp/services/session-write-buffer.js +144 -0
- package/dist/mcp/types.d.ts +9 -0
- package/dist/memory/crdt/g-counter.js +10 -8
- package/dist/shared/embeddings/ollama-client.d.ts +1 -1
- package/dist/shared/embeddings/ollama-client.js +30 -31
- package/dist/shared/git/git-analyzer.d.ts +4 -1
- package/dist/shared/git/git-analyzer.js +9 -4
- package/dist/shared/llm/cost-tracker.js +8 -6
- package/dist/shared/llm/providers/azure-openai.js +5 -21
- package/dist/shared/llm/providers/bedrock.js +5 -21
- package/dist/shared/llm/providers/claude.js +5 -21
- package/dist/shared/llm/providers/cognitum.js +5 -17
- package/dist/shared/llm/providers/gemini.js +9 -23
- package/dist/shared/llm/providers/ollama.js +5 -21
- package/dist/shared/llm/providers/openai.js +5 -21
- package/dist/shared/llm/providers/openrouter.js +9 -23
- package/dist/shared/llm/providers/response-deadline.d.ts +3 -0
- package/dist/shared/llm/providers/response-deadline.js +100 -0
- package/dist/shared/llm/spend-ledger.js +3 -2
- package/dist/shared/metrics/code-metrics.d.ts +1 -0
- package/dist/shared/metrics/code-metrics.js +3 -44
- package/dist/shared/metrics/cognitive-complexity.d.ts +17 -0
- package/dist/shared/metrics/cognitive-complexity.js +108 -0
- package/dist/shared/npm-cli-invocation.d.ts +21 -0
- package/dist/shared/npm-cli-invocation.js +28 -0
- package/dist/shared/optional-module.js +24 -0
- package/dist/shared/test-runner-args.d.ts +42 -0
- package/dist/shared/test-runner-args.js +74 -0
- package/dist/shared/utils/safe-record.d.ts +18 -0
- package/dist/shared/utils/safe-record.js +28 -0
- package/dist/test-scheduling/executors/vitest-executor.js +23 -5
- package/dist/workers/quality-daemon/git-watcher.js +5 -0
- package/package.json +1 -1
- package/dist/adapters/ag-ui/json-patch-utils.d.ts +0 -136
- package/dist/adapters/ag-ui/json-patch-utils.js +0 -575
- package/dist/cli/chunks/adapter-Q6RPGMUE.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-JQPXIU7C.js +0 -2
- package/dist/cli/chunks/base-5SK64NXB.js +0 -2
- package/dist/cli/chunks/browser-workflow-WN7XNTCJ.js +0 -2
- package/dist/cli/chunks/chunk-2K3QFLX2.js +0 -2
- package/dist/cli/chunks/chunk-53C7TGC4.js +0 -4
- package/dist/cli/chunks/chunk-J4ULR4QR.js +0 -54
- package/dist/cli/chunks/chunk-R2ICZKQA.js +0 -2
- package/dist/cli/chunks/chunk-TR37Q7A6.js +0 -15
- package/dist/cli/chunks/chunk-XYZUBAR6.js +0 -316
- package/dist/cli/chunks/chunk-YDMPTCJ3.js +0 -14
- package/dist/cli/chunks/client-ZYH66YRI.js +0 -2
- package/dist/cli/chunks/core-handlers-XKSPHEHE.js +0 -2
- package/dist/cli/chunks/cost-tracker-CKLDQ5AZ.js +0 -2
- package/dist/cli/chunks/cross-domain-router-6VYNFQZA.js +0 -2
- package/dist/cli/chunks/dream-DRSSIHPP.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-FMICCNWK.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-4TGBNJEZ.js +0 -2
- package/dist/cli/chunks/hnsw-index-J4NSCPAZ.js +0 -2
- package/dist/cli/chunks/hybrid-backend-NKPA3QE7.js +0 -2
- package/dist/cli/chunks/impact-analyzer-MWX7XY7X.js +0 -2
- package/dist/cli/chunks/init-handler-C7ZBDAC5.js +0 -81
- package/dist/cli/chunks/init-wizard-EX5N5Q7X.js +0 -2
- package/dist/cli/chunks/kernel-EQLZDHDD.js +0 -2
- package/dist/cli/chunks/knowledge-graph-A3WSMQ6U.js +0 -2
- package/dist/cli/chunks/llm-router-service-A6XYWTL6.js +0 -2
- package/dist/cli/chunks/load-test-WF2PCXLI.js +0 -2
- package/dist/cli/chunks/memory-backend-BKGLI2RF.js +0 -2
- package/dist/cli/chunks/memory-handlers-PWI3G4P4.js +0 -2
- package/dist/cli/chunks/pattern-null-store-YTBLEH7D.js +0 -2
- package/dist/cli/chunks/protocol-executor-HFR2D54O.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-MYFBQUYV.js +0 -2
- package/dist/cli/chunks/queen-coordinator-CQQMOTIW.js +0 -2
- package/dist/cli/chunks/router-GKWLPA3N.js +0 -2
- package/dist/cli/chunks/routing-feedback-WA4D5JRF.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-H3ZXS5MA.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-J7MTCOQA.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-HXBY4VYI.js +0 -2
- package/dist/cli/chunks/safe-db-INVJ5LHR.js +0 -2
- package/dist/cli/chunks/schedule-XRIPPL52.js +0 -2
- package/dist/cli/chunks/scheduler-HBN3KPRW.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-6KNLT5Q2.js +0 -2
- package/dist/cli/chunks/sync-S6Z2U46T.js +0 -2
- package/dist/cli/chunks/test-IISTF5W6.js +0 -33
- package/dist/cli/chunks/test-scheduling-FKYX4OLF.js +0 -15
- package/dist/cli/chunks/token-bootstrap-OKO3JEKT.js +0 -2
- package/dist/cli/chunks/unified-memory-WVELSL6T.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-7P5MVKXD.js +0 -2
- package/dist/cli/chunks/unified-persistence-YLFCEWYY.js +0 -2
- package/dist/cli/chunks/visual-security-T5OM742H.js +0 -2
- package/dist/cli/chunks/witness-chain-D6X4OZP5.js +0 -2
- package/dist/cli/chunks/witness-chain-repair-3LG4BF7C.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-OORDDKT3.js +0 -2
- package/dist/cli/chunks/wrappers-2B5NHICD.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{d as W,f as
|
|
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.3");process.exit(0)}
|
|
2
|
+
import{d as W,f as Tt}from"./chunk-OGARNKLS.js";import{b as I,d as ge}from"./chunk-UGNTLSBL.js";import{a as $,b as K,c as V,d as Ne,e as dt}from"./chunk-ASUXS4N4.js";import{a as Y,c as Et}from"./chunk-UTALYUMW.js";import{a as _e,d as F,e as me,f as fe}from"./chunk-NT6FYFJA.js";import{a as X,b as pe,e as ct}from"./chunk-D6PUDLJ4.js";import{a as Se,c as he,d as ut}from"./chunk-WSND64RL.js";import{a as it}from"./chunk-INVDDFJC.js";import{e as ue}from"./chunk-FPFGN2Z5.js";import{a as O,e as de}from"./chunk-2GJJGO5D.js";import{a as H,b as y,c as ot}from"./chunk-YTRGMILO.js";import{a as le,b as at}from"./chunk-Z7JPWXW2.js";import{b as R,d as st}from"./chunk-WSUYEVSY.js";import{createHash as Ie}from"node:crypto";function gt(n){let e=Buffer.alloc(8);return e.writeBigUInt64LE(BigInt(n)),e}function pt(n){return typeof n=="string"?Buffer.from(n,"utf8"):n instanceof Uint8Array?Buffer.from(n):Buffer.from(Q(n),"utf8")}function Q(n){return n===null||typeof n!="object"?JSON.stringify(n)??"null":Array.isArray(n)?`[${n.map(Q).join(",")}]`:`{${Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${Q(n[t])}`).join(",")}}`}function Ce(...n){let e=Ie("sha256");for(let t of n)e.update(t);return e.digest()}function Le(n,e,t){return Ce(lt,n,e,gt(t))}var lt,Re,A,Oe=R(()=>{"use strict";lt=Buffer.from("ruvector:chain:"),Re=Ie("sha256").update("ruvector-proof-gate-v1").digest();A=class n{seq=0;prev=Re;chain=[];payloadHashes=[];admit(e){let t=Ce(pt(e)),r=Le(this.prev,t,this.seq);this.prev=r,this.chain.push(r),this.payloadHashes.push(t);let i={sequence:this.seq,payloadHash:t.toString("hex"),chainCommitment:r.toString("hex")};return this.seq+=1,i}verifyReceipt(e){return e.sequence>=0&&e.sequence<this.chain.length&&this.chain[e.sequence].toString("hex")===e.chainCommitment}chainRoot(){return this.prev.toString("hex")}get length(){return this.seq}get isEmpty(){return this.seq===0}verifyIntegrity(){if(this.chain.length!==this.payloadHashes.length)return!1;let e=Re;for(let t=0;t<this.chain.length;t++){if(!Le(e,this.payloadHashes[t],t).equals(this.chain[t]))return!1;e=this.chain[t]}return e.equals(this.prev)}toJSON(){return{seq:this.seq,head:this.prev.toString("hex"),chain:this.chain.map(e=>e.toString("hex")),payloadHashes:this.payloadHashes.map(e=>e.toString("hex"))}}static fromJSON(e){let t=new n;t.seq=e.seq,t.prev=Buffer.from(e.head,"hex");for(let r of e.chain)t.chain.push(Buffer.from(r,"hex"));for(let r of e.payloadHashes)t.payloadHashes.push(Buffer.from(r,"hex"));return t}}});function v(n){if(!J.has(n))throw new Error(`Invalid table name: "${n}" is not in the allowlist`);return n}function bt(n){let e=n.split(".");if(e.length>2)throw new Error(`Invalid SQL identifier: "${n}" has too many parts (max: schema.table)`);for(let t of e)if(!Ae.test(t))throw new Error(`Invalid SQL identifier: "${n}" \u2014 part "${t}" does not match pattern ${Ae}`);return n}var J,Ae,Z=R(()=>{"use strict";J=new Set(["schema_version","kv_store","vectors","rl_q_values","goap_goals","goap_actions","goap_plans","goap_plan_signatures","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","sona_patterns","sona_fisher_matrices","test_outcomes","routing_outcomes","coverage_sessions","patterns","hypergraph_nodes","hypergraph_edges","hypergraph_vertices","hypergraph_hyperedges","hypergraph_edge_vertices","hypergraph_vertex_properties","hypergraph_edge_properties","captured_experiences","experience_applications","witness_chain","witness_chain_receipts","witness_chain_archive","trajectories","trajectory_steps","pattern_evolution_events","pattern_relationships","pattern_versions","learning_daily_snapshots","metrics_outcomes","experience_consolidation_log","qe_pattern_reuse","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage","qe_agent_co_execution"]);Ae=/^[a-z_][a-z0-9_]{0,62}$/});function be(n){n.exec(ve),n.exec(`
|
|
3
3
|
INSERT OR IGNORE INTO learning_evidence_manifests (
|
|
4
4
|
id, trajectory_id, trajectory_hash, manifest_hash, task_family,
|
|
5
5
|
outcome, oracle_refs_json, source_kind, process_signals_json
|
|
@@ -23,7 +23,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
23
23
|
pattern_id, manifest_id, use_kind
|
|
24
24
|
)
|
|
25
25
|
SELECT id, 'legacy-pattern:' || id, 'legacy-context' FROM qe_patterns;
|
|
26
|
-
`)}var
|
|
26
|
+
`)}var ve,ee=R(()=>{"use strict";ve=`
|
|
27
27
|
CREATE TABLE IF NOT EXISTS learning_evidence_manifests (
|
|
28
28
|
id TEXT PRIMARY KEY,
|
|
29
29
|
trajectory_id TEXT,
|
|
@@ -131,13 +131,13 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
131
131
|
BEGIN SELECT RAISE(ABORT, 'learning evidence admissions are append-only'); END;
|
|
132
132
|
CREATE TRIGGER IF NOT EXISTS learning_admissions_no_delete BEFORE DELETE ON learning_evidence_admissions
|
|
133
133
|
BEGIN SELECT RAISE(ABORT, 'learning evidence admissions are append-only'); END;
|
|
134
|
-
`});var x,
|
|
134
|
+
`});var x,De,ye,Xe,Ue,te,Fe,ne,b,re,xe,we,Me,Ge,Pe,ke,qe,se=R(()=>{"use strict";Tt();Et();ee();x=13,De=`
|
|
135
135
|
CREATE TABLE IF NOT EXISTS schema_version (
|
|
136
136
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
137
137
|
version INTEGER NOT NULL,
|
|
138
138
|
migrated_at TEXT DEFAULT (datetime('now'))
|
|
139
139
|
);
|
|
140
|
-
`,
|
|
140
|
+
`,ye=`
|
|
141
141
|
-- Key-Value Store (v2 compatible - same schema as HybridBackend)
|
|
142
142
|
CREATE TABLE IF NOT EXISTS kv_store (
|
|
143
143
|
key TEXT NOT NULL,
|
|
@@ -149,7 +149,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
149
149
|
);
|
|
150
150
|
CREATE INDEX IF NOT EXISTS idx_kv_namespace ON kv_store(namespace);
|
|
151
151
|
CREATE INDEX IF NOT EXISTS idx_kv_expires ON kv_store(expires_at) WHERE expires_at IS NOT NULL;
|
|
152
|
-
`,
|
|
152
|
+
`,Xe=`
|
|
153
153
|
-- Vector Embeddings (new in v3 - replaces in-memory AgentDB)
|
|
154
154
|
CREATE TABLE IF NOT EXISTS vectors (
|
|
155
155
|
id TEXT PRIMARY KEY,
|
|
@@ -162,7 +162,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
162
162
|
);
|
|
163
163
|
CREATE INDEX IF NOT EXISTS idx_vectors_namespace ON vectors(namespace);
|
|
164
164
|
CREATE INDEX IF NOT EXISTS idx_vectors_dimensions ON vectors(dimensions);
|
|
165
|
-
`,
|
|
165
|
+
`,Ue=`
|
|
166
166
|
-- Q-Values for RL algorithms (ADR-046)
|
|
167
167
|
CREATE TABLE IF NOT EXISTS rl_q_values (
|
|
168
168
|
id TEXT PRIMARY KEY,
|
|
@@ -183,7 +183,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
183
183
|
CREATE INDEX IF NOT EXISTS idx_qvalues_state ON rl_q_values(agent_id, state_key);
|
|
184
184
|
CREATE INDEX IF NOT EXISTS idx_qvalues_domain ON rl_q_values(domain);
|
|
185
185
|
CREATE INDEX IF NOT EXISTS idx_qvalues_updated ON rl_q_values(updated_at);
|
|
186
|
-
`,
|
|
186
|
+
`,te=`
|
|
187
187
|
-- GOAP Goals
|
|
188
188
|
CREATE TABLE IF NOT EXISTS goap_goals (
|
|
189
189
|
id TEXT PRIMARY KEY,
|
|
@@ -294,7 +294,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
294
294
|
-- would fail on "no such column" since CREATE TABLE IF NOT EXISTS above
|
|
295
295
|
-- silently no-ops against them. unified-memory.ts's v11 migration creates
|
|
296
296
|
-- this index only after confirming/backfilling the column.
|
|
297
|
-
`,
|
|
297
|
+
`,Fe=`
|
|
298
298
|
-- Concept Graph Nodes (Dream Engine)
|
|
299
299
|
CREATE TABLE IF NOT EXISTS concept_nodes (
|
|
300
300
|
id TEXT PRIMARY KEY,
|
|
@@ -363,7 +363,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
363
363
|
CREATE INDEX IF NOT EXISTS idx_edge_weight ON concept_edges(weight DESC);
|
|
364
364
|
CREATE INDEX IF NOT EXISTS idx_insight_cycle ON dream_insights(cycle_id);
|
|
365
365
|
CREATE INDEX IF NOT EXISTS idx_dream_status ON dream_cycles(status);
|
|
366
|
-
`,
|
|
366
|
+
`,ne=`
|
|
367
367
|
CREATE VIRTUAL TABLE IF NOT EXISTS qe_patterns_fts USING fts5(
|
|
368
368
|
name, description, pattern_type, qe_domain,
|
|
369
369
|
content='qe_patterns',
|
|
@@ -386,7 +386,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
386
386
|
INSERT INTO qe_patterns_fts(rowid, name, description, pattern_type, qe_domain)
|
|
387
387
|
VALUES (new.rowid, new.name, new.description, new.pattern_type, new.qe_domain);
|
|
388
388
|
END;
|
|
389
|
-
`}),
|
|
389
|
+
`}),re=ne+Object.values(b).join(""),xe=n=>`
|
|
390
390
|
-- QE Patterns table (unified from sqlite-persistence.ts)
|
|
391
391
|
CREATE TABLE IF NOT EXISTS qe_patterns (
|
|
392
392
|
id TEXT PRIMARY KEY,
|
|
@@ -516,7 +516,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
516
516
|
CREATE INDEX IF NOT EXISTS idx_execution_results_status ON execution_results(status);
|
|
517
517
|
CREATE INDEX IF NOT EXISTS idx_executed_steps_execution ON executed_steps(execution_id);
|
|
518
518
|
CREATE INDEX IF NOT EXISTS idx_executed_steps_action ON executed_steps(action_id);
|
|
519
|
-
`,
|
|
519
|
+
`,we=xe(re),Me=xe(""),Ge=`
|
|
520
520
|
-- MinCut Graph Snapshots (ADR-047)
|
|
521
521
|
CREATE TABLE IF NOT EXISTS mincut_snapshots (
|
|
522
522
|
id TEXT PRIMARY KEY,
|
|
@@ -622,7 +622,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
622
622
|
CREATE INDEX IF NOT EXISTS idx_mincut_healing_type ON mincut_healing_actions(action_type);
|
|
623
623
|
CREATE INDEX IF NOT EXISTS idx_mincut_healing_success ON mincut_healing_actions(success);
|
|
624
624
|
CREATE INDEX IF NOT EXISTS idx_mincut_observations_iter ON mincut_observations(iteration);
|
|
625
|
-
`,
|
|
625
|
+
`,Pe=`
|
|
626
626
|
-- SONA Patterns table (ADR-046: Pattern Persistence for Neural Backbone)
|
|
627
627
|
CREATE TABLE IF NOT EXISTS sona_patterns (
|
|
628
628
|
id TEXT PRIMARY KEY,
|
|
@@ -648,7 +648,7 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
648
648
|
CREATE INDEX IF NOT EXISTS idx_sona_patterns_domain ON sona_patterns(domain);
|
|
649
649
|
CREATE INDEX IF NOT EXISTS idx_sona_patterns_confidence ON sona_patterns(confidence DESC);
|
|
650
650
|
CREATE INDEX IF NOT EXISTS idx_sona_patterns_updated ON sona_patterns(updated_at DESC);
|
|
651
|
-
`,
|
|
651
|
+
`,ke=`
|
|
652
652
|
-- Test outcomes (ADR-023: Quality Feedback Loop)
|
|
653
653
|
CREATE TABLE IF NOT EXISTS test_outcomes (
|
|
654
654
|
id TEXT PRIMARY KEY,
|
|
@@ -731,20 +731,20 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
731
731
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_technique ON coverage_sessions(technique);
|
|
732
732
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_agent ON coverage_sessions(agent_id);
|
|
733
733
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_created ON coverage_sessions(created_at);
|
|
734
|
-
`,
|
|
735
|
-
WHERE NOT EXISTS (SELECT 1 FROM qe_patterns_fts_docsize d WHERE d.id = p.rowid)`):0;return{hasTable:e,hasDocsize:t,missingTriggers:r,mismatchedTriggers:i,patterns:E,indexed:c,unindexed:T}}function Pe(n){return!n.hasTable||n.missingTriggers.length>0||n.mismatchedTriggers.length>0?!0:n.hasDocsize?n.indexed!==n.patterns||n.unindexed>0:!1}function lt(n){if(n.readonly)return!0;try{return Number(n.pragma("query_only",{simple:!0}))===1}catch{return!1}}function qe(n,e={}){let t=e.log??(o=>console.warn(o)),r=e.logPrefix??"[PatternFTS]",i={status:"healthy",createdTable:!1,recreatedTriggers:[],replacedTriggers:[],rebuilt:!1,patternsBefore:-1,indexedBefore:-1,indexedAfter:-1};try{if(!ne(n,"table","qe_patterns"))return i.status="no-patterns",i;if(lt(n))return i.status="readonly",i;let o=Ge(n);if(i.patternsBefore=o.patterns,i.indexedBefore=o.indexed,!Pe(o))return i;let E=n.transaction(()=>{let c=Ge(n);if(!Pe(c))return null;c.hasTable||n.exec(Z);for(let T of c.missingTriggers)n.exec(b[T]);for(let T of c.mismatchedTriggers)n.exec(`DROP TRIGGER IF EXISTS ${T}`),n.exec(b[T]);return n.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')"),{s:c,indexedAfter:w(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize")}}).immediate();if(E){let{s:c}=E;i.createdTable=!c.hasTable,i.recreatedTriggers=[...c.missingTriggers],i.replacedTriggers=[...c.mismatchedTriggers],i.patternsBefore=c.patterns,i.indexedBefore=c.indexed,i.indexedAfter=E.indexedAfter,i.rebuilt=!0}if(i.rebuilt){i.status="healed";let c=[];i.createdTable&&c.push("created qe_patterns_fts"),i.recreatedTriggers.length>0&&c.push(`recreated triggers [${i.recreatedTriggers.join(", ")}]`),i.replacedTriggers.length>0&&c.push(`replaced triggers [${i.replacedTriggers.join(", ")}]`);let T=i.indexedBefore<0?"n/a":String(i.indexedBefore);c.push(`rebuilt index (indexed ${T} -> ${i.indexedAfter}, qe_patterns ${i.patternsBefore})`),t(`${r} Healed qe_patterns FTS5 index: ${c.join("; ")}`)}return i}catch(o){i.status="failed",i.error=O(o);try{t(`${r} qe_patterns FTS5 self-heal skipped: ${i.error} (keyword search may be degraded; vector search unaffected)`)}catch{}return i}}var dt,ut,Be=R(()=>{"use strict";ce();te();dt=Object.keys(b);ut=Object.freeze(Object.fromEntries(Object.entries(b).map(([n,e])=>[n,ke(e)])))});function M(n,e,t){let r={value:e,timestamp:t??(e!==void 0?Date.now():0),nodeId:e!==void 0?n:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function i(o,E,c,T){return o!==c?o-c:E.localeCompare(T)}return{get(){return r.value},set(o,E){let c=E??Date.now();(r.timestamp===0||i(c,n,r.timestamp,r.nodeId)>0)&&(r={value:o,timestamp:c,nodeId:n,version:r.version+1,lastUpdated:Date.now()})},merge(o){let E=o.getState();this.applyState(E)},getState(){return{value:r.value,timestamp:r.timestamp,nodeId:r.nodeId,version:r.version,lastUpdated:r.lastUpdated}},applyState(o){(r.timestamp===0||i(o.timestamp,o.nodeId,r.timestamp,r.nodeId)>0)&&(r={value:o.value,timestamp:o.timestamp,nodeId:o.nodeId,version:Math.max(r.version,o.version)+1,lastUpdated:Date.now()})},getNodeId(){return n},getTimestamp(){return r.timestamp}}}function G(n,e){let t=M(n);return t.applyState(e),t}var re=R(()=>{"use strict"});function C(n){let e={counts:{},version:0,lastUpdated:Date.now()};return e.counts[n]=0,{get(){return Object.values(e.counts).reduce((t,r)=>t+r,0)},increment(t=1){if(t<0)throw new Error("G-Counter can only increment by positive values");t!==0&&(e.counts[n]=(e.counts[n]||0)+t,e.version++,e.lastUpdated=Date.now())},merge(t){let r=t.getState();this.applyState(r)},getState(){return{counts:{...e.counts},version:e.version,lastUpdated:e.lastUpdated}},applyState(t){let r=!1;for(let[i,o]of Object.entries(t.counts)){let E=e.counts[i]||0;o>E&&(e.counts[i]=o,r=!0)}r&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return n},getLocalCount(){return e.counts[n]||0}}}function P(n,e){let t=C(n);return t.applyState(e),t}var k=R(()=>{"use strict"});function q(n){let e=C(n),t=C(n),r=0,i=Date.now();return{get(){return e.get()-t.get()},increment(o=1){if(o<0)throw new Error("Use decrement() for negative values");o!==0&&(e.increment(o),r++,i=Date.now())},decrement(o=1){if(o<0)throw new Error("Use increment() for negative values");o!==0&&(t.increment(o),r++,i=Date.now())},merge(o){let E=o.getState();this.applyState(E)},getState(){return{positive:e.getState(),negative:t.getState(),version:r,lastUpdated:i}},applyState(o){let E=this.get();e.applyState(o.positive),t.applyState(o.negative);let c=this.get();E!==c&&(r=Math.max(r,o.version)+1,i=Date.now())},getNodeId(){return n}}}function B(n,e){let t=q(n);return t.applyState(e),t}var se=R(()=>{"use strict";k()});function gt(n,e){return`${n}:${Date.now()}:${e}`}function ie(n){return typeof n=="string"?`s:${n}`:typeof n=="number"?`n:${n}`:typeof n=="boolean"?`b:${n}`:`j:${JSON.stringify(n)}`}function pt(n){let e=n.substring(0,2),t=n.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return I(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function j(n){let e=new Map,t=new Map,r=0,i=Date.now(),o=0;function E(T){let u=e.get(T);if(!u||u.size===0)return!1;let l=t.get(T);if(!l||l.size===0)return!0;for(let m of u)if(!l.has(m))return!0;return!1}function c(T){let u=e.get(T);if(!u)return new Set;let l=t.get(T)||new Set,m=new Set;for(let p of u)l.has(p)||m.add(p);return m}return{has(T){let u=ie(T);return E(u)},values(){let T=[];for(let[u]of e)E(u)&&T.push(pt(u));return T},size(){let T=0;for(let[u]of e)E(u)&&T++;return T},add(T){let u=ie(T),l=gt(n,o++);e.has(u)||e.set(u,new Set),e.get(u).add(l),r++,i=Date.now()},remove(T){let u=ie(T),l=e.get(u);if(!l||l.size===0)return;t.has(u)||t.set(u,new Set);let m=t.get(u);for(let p of l)m.add(p);r++,i=Date.now()},merge(T){let u=T.getState();this.applyState(u)},getState(){let T={};for(let[l,m]of e)T[l]=Array.from(m);let u={};for(let[l,m]of t)m.size>0&&(u[l]=Array.from(m));return{elements:T,tombstones:u,version:r,lastUpdated:i}},applyState(T){let u=!1;for(let[l,m]of Object.entries(T.elements)){e.has(l)||e.set(l,new Set);let p=e.get(l);for(let g of m)p.has(g)||(p.add(g),u=!0)}for(let[l,m]of Object.entries(T.tombstones)){t.has(l)||t.set(l,new Set);let p=t.get(l);for(let g of m)p.has(g)||(p.add(g),u=!0)}u&&(r=Math.max(r,T.version)+1,i=Date.now())},getNodeId(){return n},clear(){for(let[T,u]of e){t.has(T)||t.set(T,new Set);let l=t.get(T);for(let m of u)l.add(m)}r++,i=Date.now()}}}function z(n,e){let t=j(n);return t.applyState(e),t}var oe=R(()=>{"use strict";de()});function ae(n){let e={..._t,...n},{nodeId:t,enableDeltaTracking:r,maxDeltaHistory:i}=e,o=new Map,E=new Map,c=new Map,T=new Map,u=0,l=[],m=new Set,p={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function g(a,s,d){let N={key:a,type:s,operation:d,timestamp:Date.now(),nodeId:t};for(let Je of m)try{Je(N)}catch(Ze){console.error("[CRDTStore] Error in change listener:",Ze)}}function _(a,s){u++,r&&p[a].add(s)}function L(){if(!r||!(p.registers.size>0||p.gCounters.size>0||p.pnCounters.size>0||p.sets.size>0))return;let s={fromVersion:l.length>0?l[l.length-1].toVersion:0,toVersion:u,timestamp:Date.now(),nodeId:t};if(p.registers.size>0){s.registers={};for(let d of p.registers){let N=o.get(d);N&&(s.registers[d]=N.getState())}p.registers.clear()}if(p.gCounters.size>0){s.gCounters={};for(let d of p.gCounters){let N=E.get(d);N&&(s.gCounters[d]=N.getState())}p.gCounters.clear()}if(p.pnCounters.size>0){s.pnCounters={};for(let d of p.pnCounters){let N=c.get(d);N&&(s.pnCounters[d]=N.getState())}p.pnCounters.clear()}if(p.sets.size>0){s.sets={};for(let d of p.sets){let N=T.get(d);N&&(s.sets[d]=N.getState())}p.sets.clear()}for(l.push(s);l.length>i;)l.shift()}let h={getRegister(a){return o.has(a)||o.set(a,M(t)),o.get(a)},setRegister(a,s){h.getRegister(a).set(s),_("registers",a),g(a,"lww-register","set")},hasRegister(a){return o.has(a)},deleteRegister(a){let s=o.delete(a);return s&&_("registers",a),s},getGCounter(a){return E.has(a)||E.set(a,C(t)),E.get(a)},incrementGCounter(a,s){h.getGCounter(a).increment(s),_("gCounters",a),g(a,"g-counter","increment")},hasGCounter(a){return E.has(a)},deleteGCounter(a){let s=E.delete(a);return s&&_("gCounters",a),s},getCounter(a){return c.has(a)||c.set(a,q(t)),c.get(a)},incrementCounter(a,s){h.getCounter(a).increment(s),_("pnCounters",a),g(a,"pn-counter","increment")},decrementCounter(a,s){h.getCounter(a).decrement(s),_("pnCounters",a),g(a,"pn-counter","decrement")},hasCounter(a){return c.has(a)},deleteCounter(a){let s=c.delete(a);return s&&_("pnCounters",a),s},getSet(a){return T.has(a)||T.set(a,j(t)),T.get(a)},addToSet(a,s){h.getSet(a).add(s),_("sets",a),g(a,"or-set","add")},removeFromSet(a,s){h.getSet(a).remove(s),_("sets",a),g(a,"or-set","remove")},hasSet(a){return T.has(a)},deleteSet(a){let s=T.delete(a);return s&&_("sets",a),s},merge(a){let s=a.getState();h.applyState(s)},getState(){L();let a={version:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[s,d]of o)a.registers[s]=d.getState();for(let[s,d]of E)a.gCounters[s]=d.getState();for(let[s,d]of c)a.pnCounters[s]=d.getState();for(let[s,d]of T)a.sets[s]=d.getState();return a},applyState(a){for(let[s,d]of Object.entries(a.registers))o.has(s)?o.get(s).applyState(d):o.set(s,G(t,d)),_("registers",s),g(s,"lww-register","merge");for(let[s,d]of Object.entries(a.gCounters))E.has(s)?E.get(s).applyState(d):E.set(s,P(t,d)),_("gCounters",s),g(s,"g-counter","merge");for(let[s,d]of Object.entries(a.pnCounters))c.has(s)?c.get(s).applyState(d):c.set(s,B(t,d)),_("pnCounters",s),g(s,"pn-counter","merge");for(let[s,d]of Object.entries(a.sets))T.has(s)?T.get(s).applyState(d):T.set(s,z(t,d)),_("sets",s),g(s,"or-set","merge");u=Math.max(u,a.version)+1},getDelta(a){if(L(),l.length===0)return a>=u,null;let s=l.filter(N=>N.toVersion>a);if(s.length===0)return null;let d={fromVersion:a,toVersion:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let N of s)N.registers&&Object.assign(d.registers,N.registers),N.gCounters&&Object.assign(d.gCounters,N.gCounters),N.pnCounters&&Object.assign(d.pnCounters,N.pnCounters),N.sets&&Object.assign(d.sets,N.sets);return Object.keys(d.registers).length===0&&delete d.registers,Object.keys(d.gCounters).length===0&&delete d.gCounters,Object.keys(d.pnCounters).length===0&&delete d.pnCounters,Object.keys(d.sets).length===0&&delete d.sets,d},applyDelta(a){if(a.registers)for(let[s,d]of Object.entries(a.registers))o.has(s)?o.get(s).applyState(d):o.set(s,G(t,d)),_("registers",s),g(s,"lww-register","merge");if(a.gCounters)for(let[s,d]of Object.entries(a.gCounters))E.has(s)?E.get(s).applyState(d):E.set(s,P(t,d)),_("gCounters",s),g(s,"g-counter","merge");if(a.pnCounters)for(let[s,d]of Object.entries(a.pnCounters))c.has(s)?c.get(s).applyState(d):c.set(s,B(t,d)),_("pnCounters",s),g(s,"pn-counter","merge");if(a.sets)for(let[s,d]of Object.entries(a.sets))T.has(s)?T.get(s).applyState(d):T.set(s,z(t,d)),_("sets",s),g(s,"or-set","merge");u=Math.max(u,a.toVersion)+1},getVersion(){return u},getNodeId(){return t},on(a,s){if(a==="change")return m.add(s),()=>{m.delete(s)};throw new Error(`Unknown event type: ${a}`)},removeAllListeners(){m.clear()},keys(a){let s=[];return(!a||a==="lww-register")&&s.push(...Array.from(o.keys())),(!a||a==="g-counter")&&s.push(...Array.from(E.keys())),(!a||a==="pn-counter")&&s.push(...Array.from(c.keys())),(!a||a==="or-set")&&s.push(...Array.from(T.keys())),s},clear(){o.clear(),E.clear(),c.clear(),T.clear(),l.length=0,p.registers.clear(),p.gCounters.clear(),p.pnCounters.clear(),p.sets.clear(),u=0},getStats(){return{total:o.size+E.size+c.size+T.size,registers:o.size,gCounters:E.size,pnCounters:c.size,sets:T.size,version:u,nodeId:t,deltaHistorySize:l.length}}};return h}var _t,je=R(()=>{"use strict";re();k();se();oe();_t={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var ze=R(()=>{"use strict"});var He=R(()=>{"use strict";re();k();se();oe();je();ze()});var St={};et(St,{ALLOWED_TABLE_NAMES:()=>K,BinaryHeap:()=>le,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>Ke,UnifiedHnswIndex:()=>F,UnifiedMemoryManager:()=>D,clearProjectRootCache:()=>H,createHnswIndex:()=>ge,findProjectRoot:()=>y,getDefaultDbPath:()=>$e,getResolvedDefaultConfig:()=>Ve,getUnifiedMemory:()=>Qe,initializeUnifiedMemory:()=>mt,resetUnifiedMemory:()=>ft,validateTableName:()=>v});import*as f from"fs";import*as Ye from"os";import*as S from"path";function $e(){let n=y();return S.join(n,".agentic-qe","memory.db")}function Ve(){return{...Ke,dbPath:$e()}}function Qe(n){return D.getInstance(n)}async function mt(n){let e=Qe(n);return await e.initialize(),e}function ft(){D.resetInstance()}function Nt(){if(We)return;We=!0;let n=()=>{try{let t=D.instance;t&&t.close()}catch(t){console.debug("[UnifiedMemory] Cleanup error:",t instanceof Error?t.message:t)}};process.on("beforeExit",n),_e(n);let e=t=>{me(t)||(n(),process.exit(0))};process.on("SIGINT",e),process.on("SIGTERM",e)}var U,Ke,D,We,ht=R(()=>{rt();de();ce();st();tt();Re();V();V();pe();pe();te();Be();Q();He();nt();at();U=Te.create("unified-memory");Ke={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:X.MMAP_SIZE_BYTES,cacheSize:X.CACHE_SIZE_KB,busyTimeout:X.BUSY_TIMEOUT_MS,vectorDimensions:X.DEFAULT_VECTOR_DIMENSIONS};D=class n{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;preparedStatements=new Map;vectorIndex=new F("qe-memory");crdtStore=null;proofGate=null;proofGateEnvChecked=!1;static PROOF_NS="__proofgate__";static PROOF_KEY="chain";constructor(e){let t=Ve();if(this.config={...t,...e},process.env.AQE_MEMORY_BACKEND==="memory"){this.config.dbPath=":memory:";return}if(this.config.dbPath!==":memory:"&&!S.isAbsolute(this.config.dbPath)){let r=y();this.config.dbPath=S.join(r,this.config.dbPath)}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.instance}static async getInstanceAsync(e){return n.instance?.initialized?n.instance:(n.instancePromise||(n.instancePromise=(async()=>{let t=n.getInstance(e);return await t.initialize(),t})()),n.instancePromise)}static resetInstance(){n.instance&&(n.instance.close(),n.instance=null),n.instancePromise=null,H()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=this.config.dbPath===":memory:",r="",i=!1,o=0;if(!t){let E=process.env.AQE_PROJECT_ROOT;if(E){let c=S.resolve(this.config.dbPath),T=S.resolve(E);!c.startsWith(T)&&!c.startsWith(Ye.tmpdir())&&c.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${E}". Redirecting to test-safe path.`),this.config.dbPath=S.join(E,".agentic-qe","memory.db"))}if(r=S.dirname(this.config.dbPath),f.existsSync(r)||f.mkdirSync(r,{recursive:!0}),i=f.existsSync(this.config.dbPath),i)o=f.statSync(this.config.dbPath).size;else if(f.existsSync(r)){let c=this.findRecentBackups(r);if(c.length>0){let T=c[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
|
|
734
|
+
`,qe=["kv_store","vectors","rl_q_values","goap_actions","goap_goals","goap_plans","goap_plan_signatures","goap_execution_steps","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","hypergraph_nodes","hypergraph_edges","sona_patterns","witness_chain","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage"]});function ie(n,e,t){return n.prepare("SELECT 1 FROM sqlite_master WHERE type = ? AND name = ?").get(e,t)!==void 0}function ze(n){return n.replace(/\s+/g," ").trim().replace(/^CREATE TRIGGER IF NOT EXISTS /i,"CREATE TRIGGER ").replace(/ ?;$/,"").toLowerCase()}function w(n,e){return n.prepare(e).get()?.n??0}function Be(n){let e=ie(n,"table","qe_patterns_fts"),t=e&&ie(n,"table","qe_patterns_fts_docsize"),r=[],i=[],o=n.prepare("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ?");for(let u of _t){let l=o.get(u);l===void 0?r.push(u):ze(l.sql??"")!==mt[u]&&i.push(u)}let E=w(n,"SELECT count(*) AS n FROM qe_patterns"),c=t?w(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize"):-1,T=t&&c===E?w(n,`SELECT count(*) AS n FROM qe_patterns p
|
|
735
|
+
WHERE NOT EXISTS (SELECT 1 FROM qe_patterns_fts_docsize d WHERE d.id = p.rowid)`):0;return{hasTable:e,hasDocsize:t,missingTriggers:r,mismatchedTriggers:i,patterns:E,indexed:c,unindexed:T}}function je(n){return!n.hasTable||n.missingTriggers.length>0||n.mismatchedTriggers.length>0?!0:n.hasDocsize?n.indexed!==n.patterns||n.unindexed>0:!1}function ft(n){if(n.readonly)return!0;try{return Number(n.pragma("query_only",{simple:!0}))===1}catch{return!1}}function He(n,e={}){let t=e.log??(o=>console.warn(o)),r=e.logPrefix??"[PatternFTS]",i={status:"healthy",createdTable:!1,recreatedTriggers:[],replacedTriggers:[],rebuilt:!1,patternsBefore:-1,indexedBefore:-1,indexedAfter:-1};try{if(!ie(n,"table","qe_patterns"))return i.status="no-patterns",i;if(ft(n))return i.status="readonly",i;let o=Be(n);if(i.patternsBefore=o.patterns,i.indexedBefore=o.indexed,!je(o))return i;let E=n.transaction(()=>{let c=Be(n);if(!je(c))return null;c.hasTable||n.exec(ne);for(let T of c.missingTriggers)n.exec(b[T]);for(let T of c.mismatchedTriggers)n.exec(`DROP TRIGGER IF EXISTS ${T}`),n.exec(b[T]);return n.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')"),{s:c,indexedAfter:w(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize")}}).immediate();if(E){let{s:c}=E;i.createdTable=!c.hasTable,i.recreatedTriggers=[...c.missingTriggers],i.replacedTriggers=[...c.mismatchedTriggers],i.patternsBefore=c.patterns,i.indexedBefore=c.indexed,i.indexedAfter=E.indexedAfter,i.rebuilt=!0}if(i.rebuilt){i.status="healed";let c=[];i.createdTable&&c.push("created qe_patterns_fts"),i.recreatedTriggers.length>0&&c.push(`recreated triggers [${i.recreatedTriggers.join(", ")}]`),i.replacedTriggers.length>0&&c.push(`replaced triggers [${i.replacedTriggers.join(", ")}]`);let T=i.indexedBefore<0?"n/a":String(i.indexedBefore);c.push(`rebuilt index (indexed ${T} -> ${i.indexedAfter}, qe_patterns ${i.patternsBefore})`),t(`${r} Healed qe_patterns FTS5 index: ${c.join("; ")}`)}return i}catch(o){i.status="failed",i.error=O(o);try{t(`${r} qe_patterns FTS5 self-heal skipped: ${i.error} (keyword search may be degraded; vector search unaffected)`)}catch{}return i}}var _t,mt,We=R(()=>{"use strict";de();se();_t=Object.keys(b);mt=Object.freeze(Object.fromEntries(Object.entries(b).map(([n,e])=>[n,ze(e)])))});function M(n,e,t){let r={value:e,timestamp:t??(e!==void 0?Date.now():0),nodeId:e!==void 0?n:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function i(o,E,c,T){return o!==c?o-c:E.localeCompare(T)}return{get(){return r.value},set(o,E){let c=E??Date.now();(r.timestamp===0||i(c,n,r.timestamp,r.nodeId)>0)&&(r={value:o,timestamp:c,nodeId:n,version:r.version+1,lastUpdated:Date.now()})},merge(o){let E=o.getState();this.applyState(E)},getState(){return{value:r.value,timestamp:r.timestamp,nodeId:r.nodeId,version:r.version,lastUpdated:r.lastUpdated}},applyState(o){(r.timestamp===0||i(o.timestamp,o.nodeId,r.timestamp,r.nodeId)>0)&&(r={value:o.value,timestamp:o.timestamp,nodeId:o.nodeId,version:Math.max(r.version,o.version)+1,lastUpdated:Date.now()})},getNodeId(){return n},getTimestamp(){return r.timestamp}}}function G(n,e){let t=M(n);return t.applyState(e),t}var oe=R(()=>{"use strict"});function C(n){let e={counts:$(),version:0,lastUpdated:Date.now()};return V(e.counts,n,0),{get(){return Object.values(e.counts).reduce((t,r)=>t+r,0)},increment(t=1){if(t<0)throw new Error("G-Counter can only increment by positive values");t!==0&&(Ne(e.counts,n,t),e.version++,e.lastUpdated=Date.now())},merge(t){let r=t.getState();this.applyState(r)},getState(){return{counts:Object.assign($(),e.counts),version:e.version,lastUpdated:e.lastUpdated}},applyState(t){let r=!1;for(let[i,o]of Object.entries(t.counts)){let E=K(e.counts,i)??0;o>E&&(V(e.counts,i,o),r=!0)}r&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return n},getLocalCount(){return K(e.counts,n)??0}}}function P(n,e){let t=C(n);return t.applyState(e),t}var k=R(()=>{"use strict";dt()});function q(n){let e=C(n),t=C(n),r=0,i=Date.now();return{get(){return e.get()-t.get()},increment(o=1){if(o<0)throw new Error("Use decrement() for negative values");o!==0&&(e.increment(o),r++,i=Date.now())},decrement(o=1){if(o<0)throw new Error("Use increment() for negative values");o!==0&&(t.increment(o),r++,i=Date.now())},merge(o){let E=o.getState();this.applyState(E)},getState(){return{positive:e.getState(),negative:t.getState(),version:r,lastUpdated:i}},applyState(o){let E=this.get();e.applyState(o.positive),t.applyState(o.negative);let c=this.get();E!==c&&(r=Math.max(r,o.version)+1,i=Date.now())},getNodeId(){return n}}}function B(n,e){let t=q(n);return t.applyState(e),t}var ae=R(()=>{"use strict";k()});function Nt(n,e){return`${n}:${Date.now()}:${e}`}function ce(n){return typeof n=="string"?`s:${n}`:typeof n=="number"?`n:${n}`:typeof n=="boolean"?`b:${n}`:`j:${JSON.stringify(n)}`}function St(n){let e=n.substring(0,2),t=n.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return I(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function j(n){let e=new Map,t=new Map,r=0,i=Date.now(),o=0;function E(T){let u=e.get(T);if(!u||u.size===0)return!1;let l=t.get(T);if(!l||l.size===0)return!0;for(let m of u)if(!l.has(m))return!0;return!1}function c(T){let u=e.get(T);if(!u)return new Set;let l=t.get(T)||new Set,m=new Set;for(let p of u)l.has(p)||m.add(p);return m}return{has(T){let u=ce(T);return E(u)},values(){let T=[];for(let[u]of e)E(u)&&T.push(St(u));return T},size(){let T=0;for(let[u]of e)E(u)&&T++;return T},add(T){let u=ce(T),l=Nt(n,o++);e.has(u)||e.set(u,new Set),e.get(u).add(l),r++,i=Date.now()},remove(T){let u=ce(T),l=e.get(u);if(!l||l.size===0)return;t.has(u)||t.set(u,new Set);let m=t.get(u);for(let p of l)m.add(p);r++,i=Date.now()},merge(T){let u=T.getState();this.applyState(u)},getState(){let T={};for(let[l,m]of e)T[l]=Array.from(m);let u={};for(let[l,m]of t)m.size>0&&(u[l]=Array.from(m));return{elements:T,tombstones:u,version:r,lastUpdated:i}},applyState(T){let u=!1;for(let[l,m]of Object.entries(T.elements)){e.has(l)||e.set(l,new Set);let p=e.get(l);for(let g of m)p.has(g)||(p.add(g),u=!0)}for(let[l,m]of Object.entries(T.tombstones)){t.has(l)||t.set(l,new Set);let p=t.get(l);for(let g of m)p.has(g)||(p.add(g),u=!0)}u&&(r=Math.max(r,T.version)+1,i=Date.now())},getNodeId(){return n},clear(){for(let[T,u]of e){t.has(T)||t.set(T,new Set);let l=t.get(T);for(let m of u)l.add(m)}r++,i=Date.now()}}}function z(n,e){let t=j(n);return t.applyState(e),t}var Te=R(()=>{"use strict";ge()});function Ee(n){let e={...ht,...n},{nodeId:t,enableDeltaTracking:r,maxDeltaHistory:i}=e,o=new Map,E=new Map,c=new Map,T=new Map,u=0,l=[],m=new Set,p={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function g(a,s,d){let N={key:a,type:s,operation:d,timestamp:Date.now(),nodeId:t};for(let nt of m)try{nt(N)}catch(rt){console.error("[CRDTStore] Error in change listener:",rt)}}function _(a,s){u++,r&&p[a].add(s)}function L(){if(!r||!(p.registers.size>0||p.gCounters.size>0||p.pnCounters.size>0||p.sets.size>0))return;let s={fromVersion:l.length>0?l[l.length-1].toVersion:0,toVersion:u,timestamp:Date.now(),nodeId:t};if(p.registers.size>0){s.registers={};for(let d of p.registers){let N=o.get(d);N&&(s.registers[d]=N.getState())}p.registers.clear()}if(p.gCounters.size>0){s.gCounters={};for(let d of p.gCounters){let N=E.get(d);N&&(s.gCounters[d]=N.getState())}p.gCounters.clear()}if(p.pnCounters.size>0){s.pnCounters={};for(let d of p.pnCounters){let N=c.get(d);N&&(s.pnCounters[d]=N.getState())}p.pnCounters.clear()}if(p.sets.size>0){s.sets={};for(let d of p.sets){let N=T.get(d);N&&(s.sets[d]=N.getState())}p.sets.clear()}for(l.push(s);l.length>i;)l.shift()}let h={getRegister(a){return o.has(a)||o.set(a,M(t)),o.get(a)},setRegister(a,s){h.getRegister(a).set(s),_("registers",a),g(a,"lww-register","set")},hasRegister(a){return o.has(a)},deleteRegister(a){let s=o.delete(a);return s&&_("registers",a),s},getGCounter(a){return E.has(a)||E.set(a,C(t)),E.get(a)},incrementGCounter(a,s){h.getGCounter(a).increment(s),_("gCounters",a),g(a,"g-counter","increment")},hasGCounter(a){return E.has(a)},deleteGCounter(a){let s=E.delete(a);return s&&_("gCounters",a),s},getCounter(a){return c.has(a)||c.set(a,q(t)),c.get(a)},incrementCounter(a,s){h.getCounter(a).increment(s),_("pnCounters",a),g(a,"pn-counter","increment")},decrementCounter(a,s){h.getCounter(a).decrement(s),_("pnCounters",a),g(a,"pn-counter","decrement")},hasCounter(a){return c.has(a)},deleteCounter(a){let s=c.delete(a);return s&&_("pnCounters",a),s},getSet(a){return T.has(a)||T.set(a,j(t)),T.get(a)},addToSet(a,s){h.getSet(a).add(s),_("sets",a),g(a,"or-set","add")},removeFromSet(a,s){h.getSet(a).remove(s),_("sets",a),g(a,"or-set","remove")},hasSet(a){return T.has(a)},deleteSet(a){let s=T.delete(a);return s&&_("sets",a),s},merge(a){let s=a.getState();h.applyState(s)},getState(){L();let a={version:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[s,d]of o)a.registers[s]=d.getState();for(let[s,d]of E)a.gCounters[s]=d.getState();for(let[s,d]of c)a.pnCounters[s]=d.getState();for(let[s,d]of T)a.sets[s]=d.getState();return a},applyState(a){for(let[s,d]of Object.entries(a.registers))o.has(s)?o.get(s).applyState(d):o.set(s,G(t,d)),_("registers",s),g(s,"lww-register","merge");for(let[s,d]of Object.entries(a.gCounters))E.has(s)?E.get(s).applyState(d):E.set(s,P(t,d)),_("gCounters",s),g(s,"g-counter","merge");for(let[s,d]of Object.entries(a.pnCounters))c.has(s)?c.get(s).applyState(d):c.set(s,B(t,d)),_("pnCounters",s),g(s,"pn-counter","merge");for(let[s,d]of Object.entries(a.sets))T.has(s)?T.get(s).applyState(d):T.set(s,z(t,d)),_("sets",s),g(s,"or-set","merge");u=Math.max(u,a.version)+1},getDelta(a){if(L(),l.length===0)return a>=u,null;let s=l.filter(N=>N.toVersion>a);if(s.length===0)return null;let d={fromVersion:a,toVersion:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let N of s)N.registers&&Object.assign(d.registers,N.registers),N.gCounters&&Object.assign(d.gCounters,N.gCounters),N.pnCounters&&Object.assign(d.pnCounters,N.pnCounters),N.sets&&Object.assign(d.sets,N.sets);return Object.keys(d.registers).length===0&&delete d.registers,Object.keys(d.gCounters).length===0&&delete d.gCounters,Object.keys(d.pnCounters).length===0&&delete d.pnCounters,Object.keys(d.sets).length===0&&delete d.sets,d},applyDelta(a){if(a.registers)for(let[s,d]of Object.entries(a.registers))o.has(s)?o.get(s).applyState(d):o.set(s,G(t,d)),_("registers",s),g(s,"lww-register","merge");if(a.gCounters)for(let[s,d]of Object.entries(a.gCounters))E.has(s)?E.get(s).applyState(d):E.set(s,P(t,d)),_("gCounters",s),g(s,"g-counter","merge");if(a.pnCounters)for(let[s,d]of Object.entries(a.pnCounters))c.has(s)?c.get(s).applyState(d):c.set(s,B(t,d)),_("pnCounters",s),g(s,"pn-counter","merge");if(a.sets)for(let[s,d]of Object.entries(a.sets))T.has(s)?T.get(s).applyState(d):T.set(s,z(t,d)),_("sets",s),g(s,"or-set","merge");u=Math.max(u,a.toVersion)+1},getVersion(){return u},getNodeId(){return t},on(a,s){if(a==="change")return m.add(s),()=>{m.delete(s)};throw new Error(`Unknown event type: ${a}`)},removeAllListeners(){m.clear()},keys(a){let s=[];return(!a||a==="lww-register")&&s.push(...Array.from(o.keys())),(!a||a==="g-counter")&&s.push(...Array.from(E.keys())),(!a||a==="pn-counter")&&s.push(...Array.from(c.keys())),(!a||a==="or-set")&&s.push(...Array.from(T.keys())),s},clear(){o.clear(),E.clear(),c.clear(),T.clear(),l.length=0,p.registers.clear(),p.gCounters.clear(),p.pnCounters.clear(),p.sets.clear(),u=0},getStats(){return{total:o.size+E.size+c.size+T.size,registers:o.size,gCounters:E.size,pnCounters:c.size,sets:T.size,version:u,nodeId:t,deltaHistorySize:l.length}}};return h}var ht,Ye=R(()=>{"use strict";oe();k();ae();Te();ht={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var $e=R(()=>{"use strict"});var Ke=R(()=>{"use strict";oe();k();ae();Te();Ye();$e()});var Ct={};st(Ct,{ALLOWED_TABLE_NAMES:()=>J,BinaryHeap:()=>_e,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>Ze,UnifiedHnswIndex:()=>F,UnifiedMemoryManager:()=>D,clearProjectRootCache:()=>H,createHnswIndex:()=>me,findProjectRoot:()=>y,getDefaultDbPath:()=>Je,getResolvedDefaultConfig:()=>et,getUnifiedMemory:()=>tt,initializeUnifiedMemory:()=>Rt,resetUnifiedMemory:()=>Lt,validateTableName:()=>v});import*as f from"fs";import*as Qe from"os";import*as S from"path";function Je(){let n=y();return S.join(n,".agentic-qe","memory.db")}function et(){return{...Ze,dbPath:Je()}}function tt(n){return D.getInstance(n)}async function Rt(n){let e=tt(n);return await e.initialize(),e}function Lt(){D.resetInstance()}function It(){if(Ve)return;Ve=!0;let n=()=>{try{let t=D.instance;t&&t.close()}catch(t){console.debug("[UnifiedMemory] Cleanup error:",t instanceof Error?t.message:t)}};process.on("beforeExit",n),Se(n);let e=t=>{he(t)||(n(),process.exit(0))};process.on("SIGINT",e),process.on("SIGTERM",e)}var U,Ze,D,Ve,Ot=R(()=>{at();ge();de();ct();it();Oe();Z();Z();fe();fe();se();We();ee();Ke();ot();ut();U=ue.create("unified-memory");Ze={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:X.MMAP_SIZE_BYTES,cacheSize:X.CACHE_SIZE_KB,busyTimeout:X.BUSY_TIMEOUT_MS,vectorDimensions:X.DEFAULT_VECTOR_DIMENSIONS};D=class n{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;preparedStatements=new Map;vectorIndex=new F("qe-memory");crdtStore=null;proofGate=null;proofGateEnvChecked=!1;static PROOF_NS="__proofgate__";static PROOF_KEY="chain";constructor(e){let t=et();if(this.config={...t,...e},process.env.AQE_MEMORY_BACKEND==="memory"){this.config.dbPath=":memory:";return}if(this.config.dbPath!==":memory:"&&!S.isAbsolute(this.config.dbPath)){let r=y();this.config.dbPath=S.join(r,this.config.dbPath)}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.instance}static async getInstanceAsync(e){return n.instance?.initialized?n.instance:(n.instancePromise||(n.instancePromise=(async()=>{let t=n.getInstance(e);return await t.initialize(),t})()),n.instancePromise)}static resetInstance(){n.instance&&(n.instance.close(),n.instance=null),n.instancePromise=null,H()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=this.config.dbPath===":memory:",r="",i=!1,o=0;if(!t){let E=process.env.AQE_PROJECT_ROOT;if(E){let c=S.resolve(this.config.dbPath),T=S.resolve(E);!c.startsWith(T)&&!c.startsWith(Qe.tmpdir())&&c.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${E}". Redirecting to test-safe path.`),this.config.dbPath=S.join(E,".agentic-qe","memory.db"))}if(r=S.dirname(this.config.dbPath),f.existsSync(r)||f.mkdirSync(r,{recursive:!0}),i=f.existsSync(this.config.dbPath),i)o=f.statSync(this.config.dbPath).size;else if(f.existsSync(r)){let c=this.findRecentBackups(r);if(c.length>0){let T=c[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
|
|
736
736
|
Expected: ${this.config.dbPath}
|
|
737
737
|
Found ${c.length} backup(s), newest: ${T.path} (${(T.size/1024/1024).toFixed(1)}MB)
|
|
738
|
-
Restoring from backup to prevent data loss...`),f.copyFileSync(T.path,this.config.dbPath);for(let u of["-wal","-shm"]){let l=this.config.dbPath+u;f.existsSync(l)&&f.unlinkSync(l)}o=T.size}}}if(e?.throwIfAborted(),this.db=
|
|
738
|
+
Restoring from backup to prevent data loss...`),f.copyFileSync(T.path,this.config.dbPath);for(let u of["-wal","-shm"]){let l=this.config.dbPath+u;f.existsSync(l)&&f.unlinkSync(l)}o=T.size}}}if(e?.throwIfAborted(),this.db=le(this.config.dbPath,{walMode:this.config.walMode,busyTimeout:this.config.busyTimeout,autoRestore:!0}),this.db.pragma(`mmap_size = ${this.config.mmapSize}`),this.db.pragma(`cache_size = ${this.config.cacheSize}`),this.db.pragma("foreign_keys = ON"),e?.aborted){try{this.db.close()}catch{}this.db=null,e.throwIfAborted()}if(await this.runMigrations(),He(this.db,{logPrefix:"[UnifiedMemory]"}),e?.throwIfAborted(),i&&o>1e6)try{let E=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get();if(E&&E.cnt===0){let c=f.statSync(this.config.dbPath).size;c<o*.1&&console.error(`[UnifiedMemory] CRITICAL: Possible data loss detected!
|
|
739
739
|
DB was ${(o/1024/1024).toFixed(1)}MB, now ${(c/1024/1024).toFixed(1)}MB with 0 patterns.
|
|
740
740
|
This looks like the DB was replaced with an empty schema.
|
|
741
741
|
Check backups in ${r} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(t){throw this.initPromise=null,t instanceof Error&&(t.name==="AbortError"||(e?.aborted??!1))?t:new Error(`Failed to initialize UnifiedMemoryManager: ${O(t)}`)}}}findRecentBackups(e){try{let r=f.readdirSync(e).filter(o=>o.startsWith("memory")&&o.endsWith(".db")&&o!=="memory.db").map(o=>{let E=S.join(e,o),c=f.statSync(E);return{path:E,size:c.size,mtime:c.mtimeMs}}).filter(o=>o.size>1e6).sort((o,E)=>E.mtime-o.mtime),i=S.join(e,"backups");if(f.existsSync(i)){let o=f.readdirSync(i);for(let E of o)if(E.endsWith(".db")){let c=S.join(i,E),T=f.statSync(c);T.size>1e6&&r.push({path:c,size:T.size,mtime:T.mtimeMs})}r.sort((E,c)=>c.mtime-E.mtime)}return r}catch{return[]}}warnIfDuplicateDatabases(){if(this.config.dbPath!==":memory:")try{let e=y(),t=S.resolve(this.config.dbPath),i=[S.join(e,".agentic-qe","memory.db"),S.join(e,"v3",".agentic-qe","memory.db")].map(o=>S.resolve(o)).filter(o=>o!==t&&f.existsSync(o));i.length>0&&console.warn(`[UnifiedMemory] WARNING: Duplicate database(s) detected!
|
|
742
742
|
Canonical: ${t}
|
|
743
743
|
Duplicates: ${i.join(", ")}
|
|
744
|
-
This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){U.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let r=v(e);return this.db.prepare(`PRAGMA table_info(${r})`).all().some(o=>o.name===t)}catch(r){return U.debug("Column existence check failed",{table:e,column:t,error:r instanceof Error?r.message:String(r)}),!1}}handleV2SchemaIncompatibilities(){if(!this.db)return;let e=[{table:"goap_plans",requiredColumn:"status",columnDef:"TEXT DEFAULT 'pending'"},{table:"goap_actions",requiredColumn:"agent_type",columnDef:"TEXT DEFAULT 'unknown'"},{table:"concept_nodes",requiredColumn:"concept_type",columnDef:"TEXT DEFAULT 'general'"},{table:"concept_edges",requiredColumn:"edge_type",columnDef:"TEXT DEFAULT 'related'"},{table:"dream_insights",requiredColumn:"cycle_id",columnDef:"TEXT DEFAULT ''"},{table:"rl_q_values",requiredColumn:"algorithm",columnDef:"TEXT DEFAULT 'q-learning'"}];for(let{table:t,requiredColumn:r,columnDef:i}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,r)){let E=v(t);try{this.db.exec(`ALTER TABLE ${E} ADD COLUMN ${r} ${i}`),console.log(`[UnifiedMemory] Added column ${r} to ${t} (safe migration)`)}catch(c){console.log(`[UnifiedMemory] Column ${r} on ${t}: ${c instanceof Error?c.message:String(c)}`)}}}async runMigrations(){if(!this.db)throw new Error("Database not initialized");this.db.exec(
|
|
744
|
+
This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){U.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let r=v(e);return this.db.prepare(`PRAGMA table_info(${r})`).all().some(o=>o.name===t)}catch(r){return U.debug("Column existence check failed",{table:e,column:t,error:r instanceof Error?r.message:String(r)}),!1}}handleV2SchemaIncompatibilities(){if(!this.db)return;let e=[{table:"goap_plans",requiredColumn:"status",columnDef:"TEXT DEFAULT 'pending'"},{table:"goap_actions",requiredColumn:"agent_type",columnDef:"TEXT DEFAULT 'unknown'"},{table:"concept_nodes",requiredColumn:"concept_type",columnDef:"TEXT DEFAULT 'general'"},{table:"concept_edges",requiredColumn:"edge_type",columnDef:"TEXT DEFAULT 'related'"},{table:"dream_insights",requiredColumn:"cycle_id",columnDef:"TEXT DEFAULT ''"},{table:"rl_q_values",requiredColumn:"algorithm",columnDef:"TEXT DEFAULT 'q-learning'"}];for(let{table:t,requiredColumn:r,columnDef:i}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,r)){let E=v(t);try{this.db.exec(`ALTER TABLE ${E} ADD COLUMN ${r} ${i}`),console.log(`[UnifiedMemory] Added column ${r} to ${t} (safe migration)`)}catch(c){console.log(`[UnifiedMemory] Column ${r} on ${t}: ${c instanceof Error?c.message:String(c)}`)}}}async runMigrations(){if(!this.db)throw new Error("Database not initialized");this.db.exec(De),this.handleV2SchemaIncompatibilities();let t=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;t<x&&(console.log(`[UnifiedMemory] Migrating from v${t} to v${x}`),this.db.transaction(()=>{t<1&&this.db.exec(ye),t<2&&this.db.exec(Xe),t<3&&(this.db.exec(Ue),this.db.exec(te),this.db.exec(Fe)),t<4&&this.db.exec(we),t<5&&this.db.exec(Ge),t<6&&this.db.exec(W),t<7&&this.db.exec(Pe),t<8&&this.db.exec(ke),t<9&&(this.db.exec(re),this.db.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')")),t<10&&this.db.exec(Y),t<11&&this.migrateToV11GoapExecutionSteps(),t<12&&be(this.db),t<13&&this.migrateToV13EmbeddingSpace(),this.db.prepare(`
|
|
745
745
|
INSERT OR REPLACE INTO schema_version (id, version, migrated_at)
|
|
746
746
|
VALUES (1, ?, datetime('now'))
|
|
747
|
-
`).run(x)})(),console.log("[UnifiedMemory] Migration complete"))}migrateToV11GoapExecutionSteps(){let e=this.db;e.exec(
|
|
747
|
+
`).run(x)})(),console.log("[UnifiedMemory] Migration complete"))}migrateToV11GoapExecutionSteps(){let e=this.db;e.exec(te);let t=(r,i,o)=>{e.prepare(`SELECT name FROM pragma_table_info('${r}')`).all().some(c=>c.name===i)||e.exec(`ALTER TABLE ${r} ADD COLUMN ${i} ${o}`)};t("goap_execution_steps","execution_id","TEXT"),t("goap_execution_steps","retries","INTEGER DEFAULT 0"),t("goap_execution_steps","started_at","TEXT"),t("goap_execution_steps","agent_output","TEXT"),t("goap_actions","method","TEXT"),t("goap_actions","params","TEXT"),t("goap_actions","implemented","INTEGER DEFAULT 0"),e.exec("CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_execution ON goap_execution_steps(execution_id)")}async loadVectorIndex(){if(this.vectorsLoaded)return;if(!this.db)throw new Error("Database not initialized");this.vectorIndex.clear();let e=this.db.prepare("SELECT id, embedding, dimensions FROM vectors").all();for(let t of e){let r=this.bufferToFloatArray(t.embedding,t.dimensions);this.vectorIndex.add(t.id,r)}this.vectorsLoaded=!0,console.log(`[UnifiedMemory] Loaded ${e.length} vectors into vector index (ruvector flat)`)}async kvSet(e,t,r="default",i){this.ensureInitialized();let o=i?Date.now()+i*1e3:null,E=JSON.stringify(t);this.db.prepare(`
|
|
748
748
|
INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
|
|
749
749
|
VALUES (?, ?, ?, ?)
|
|
750
750
|
`).run(e,r,E,o),this.auditWrite("kvSet",r,e,E)}async kvGet(e,t="default"){this.ensureInitialized();let r=this.db.prepare(`
|
|
@@ -768,4 +768,4 @@ import{d as W,f as it}from"./chunk-3NOSMJS4.js";import{b as I,d as de}from"./chu
|
|
|
768
768
|
VALUES (?, ?, ?, ?, ?, datetime('now'))
|
|
769
769
|
`).run(e,r,o,t.length,E),this.vectorIndex.add(e,t)}async vectorGet(e){this.ensureInitialized();let t=this.db.prepare(`
|
|
770
770
|
SELECT embedding, dimensions, metadata FROM vectors WHERE id = ?
|
|
771
|
-
`).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?I(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e);return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,r,i){if(this.ensureInitialized(),!Number.isInteger(t)||t<=0)return[];this.vectorsLoaded||await this.loadVectorIndex();let o=this.vectorIndex.size(),E=!!(r||i),c=Math.min(o,Math.max(E?t*2:t,1)),T=r?this.db.prepare("SELECT id, namespace, metadata FROM vectors WHERE namespace = ?").all(r):void 0,u=T?new Map(T.map(g=>[g.id,g])):void 0,l=this.vectorIndex.search(e,c);for(;E&&l.filter(g=>(!i||g.id.startsWith(i))&&(!u||u.has(g.id))).length<t&&c<o;)c=Math.min(o,c*2),l=this.vectorIndex.search(e,c);if(l.length===0)return[];let m=u??(()=>{let g=l.map(h=>h.id),_=g.map(()=>"?").join(","),L=this.db.prepare(`SELECT id, namespace, metadata FROM vectors WHERE id IN (${_})`).all(...g);return new Map(L.map(h=>[h.id,h]))})();if(r){let g=[];for(let _ of l){let L=m.get(_.id);if(L&&L.namespace===r&&(!i||_.id.startsWith(i))&&(g.push({id:_.id,score:_.score,metadata:L.metadata?I(L.metadata):void 0}),g.length>=t))break}return g}return(i?l.filter(g=>g.id.startsWith(i)).slice(0,t):l.slice(0,t)).map(g=>{let _=m.get(g.id);return{id:g.id,score:g.score,metadata:_?.metadata?I(_.metadata):void 0}})}migrateToV13EmbeddingSpace(){let e=this.db;if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_pattern_embeddings'").get()){e.exec(
|
|
771
|
+
`).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?I(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e);return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,r,i){if(this.ensureInitialized(),!Number.isInteger(t)||t<=0)return[];this.vectorsLoaded||await this.loadVectorIndex();let o=this.vectorIndex.size(),E=!!(r||i),c=Math.min(o,Math.max(E?t*2:t,1)),T=r?this.db.prepare("SELECT id, namespace, metadata FROM vectors WHERE namespace = ?").all(r):void 0,u=T?new Map(T.map(g=>[g.id,g])):void 0,l=this.vectorIndex.search(e,c);for(;E&&l.filter(g=>(!i||g.id.startsWith(i))&&(!u||u.has(g.id))).length<t&&c<o;)c=Math.min(o,c*2),l=this.vectorIndex.search(e,c);if(l.length===0)return[];let m=u??(()=>{let g=l.map(h=>h.id),_=g.map(()=>"?").join(","),L=this.db.prepare(`SELECT id, namespace, metadata FROM vectors WHERE id IN (${_})`).all(...g);return new Map(L.map(h=>[h.id,h]))})();if(r){let g=[];for(let _ of l){let L=m.get(_.id);if(L&&L.namespace===r&&(!i||_.id.startsWith(i))&&(g.push({id:_.id,score:_.score,metadata:L.metadata?I(L.metadata):void 0}),g.length>=t))break}return g}return(i?l.filter(g=>g.id.startsWith(i)).slice(0,t):l.slice(0,t)).map(g=>{let _=m.get(g.id);return{id:g.id,score:g.score,metadata:_?.metadata?I(_.metadata):void 0}})}migrateToV13EmbeddingSpace(){let e=this.db;if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_pattern_embeddings'").get()){e.exec(Me);return}e.prepare("PRAGMA table_info('qe_pattern_embeddings')").all().some(i=>i.name==="space_id")||e.exec("ALTER TABLE qe_pattern_embeddings ADD COLUMN space_id TEXT"),e.exec("CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id)")}getVectorSearchProvenance(){return this.vectorIndex.getProvider().isNativeBackend()?{backend:"native-hnsw",indexType:"hnsw",approximate:!0,estimatedRecall:this.vectorIndex.recall(),qualifiedMaxK:pe.EF_SEARCH}:{backend:"progressive-hnsw",indexType:"flat",approximate:!1,estimatedRecall:1}}async vectorCount(e){return this.ensureInitialized(),e?this.db.prepare("SELECT COUNT(*) as count FROM vectors WHERE namespace = ?").get(e).count:this.db.prepare("SELECT COUNT(*) as count FROM vectors").get().count}queryCount(e){this.ensureInitialized();let t=v(e);return this.db.prepare(`SELECT COUNT(*) as c FROM ${t}`).get().c}initializeCRDT(e){if(this.crdtStore){console.warn("[UnifiedMemory] CRDT store already initialized");return}this.crdtStore=Ee({nodeId:e}),console.log(`[UnifiedMemory] CRDT store initialized for node: ${e}`)}getCRDTStore(){return this.crdtStore}isCRDTInitialized(){return this.crdtStore!==null}async crdtSet(e,t,r="crdt"){this.ensureInitialized(),this.crdtStore&&this.crdtStore.setRegister(e,t),await this.kvSet(e,t,r)}async crdtGet(e,t="crdt"){if(this.crdtStore){let r=this.crdtStore.getRegister(e);if(r)return r.get()}return this.kvGet(e,t)}crdtIncrement(e,t=1){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");let r=this.crdtStore.getCounter(e);r||(this.crdtStore.incrementCounter(e,0),r=this.crdtStore.getCounter(e));for(let i=0;i<t;i++)this.crdtStore.incrementCounter(e)}crdtGetCounter(e){return this.crdtStore?this.crdtStore.getCounter(e)?.get()??0:0}crdtAddToSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.addToSet(e,t)}crdtRemoveFromSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.removeFromSet(e,t)}crdtGetSet(e){if(!this.crdtStore)return new Set;let t=this.crdtStore.getSet(e);return new Set(t.values())}crdtGetState(){return this.crdtStore?this.crdtStore.getState():null}crdtGetDelta(e){return this.crdtStore?this.crdtStore.getDelta(e??0):null}crdtMerge(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyState(e)}crdtApplyDelta(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyDelta(e)}async crdtPersist(){if(!this.crdtStore)return;let e=this.crdtStore.getState();await this.kvSet("__crdt_state__",e,"crdt-internal")}async crdtRestore(){if(!this.crdtStore)return!1;let e=await this.kvGet("__crdt_state__","crdt-internal");return e?(this.crdtStore.applyState(e),!0):!1}getDatabase(){if(!this.db||!this.initialized)throw new Error("UnifiedMemoryManager not initialized");return this.db}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(e,t){if(!this.db)throw new Error("Database not initialized");let r=this.preparedStatements.get(e);return r||(r=this.db.prepare(t),this.preparedStatements.set(e,r)),r}transaction(e){if(!this.db)throw new Error("Database not initialized");return this.db.transaction(e)()}getStats(){if(!this.db)throw new Error("Database not initialized");let e=qe.map(i=>{try{let o=this.db.prepare(`SELECT COUNT(*) as count FROM ${i}`).get();return{name:i,rowCount:o.count}}catch(o){return U.debug("Table row count query failed",{table:i,error:o instanceof Error?o.message:String(o)}),{name:i,rowCount:0}}}),t=0,r=0;try{f.existsSync(this.config.dbPath)&&(t=f.statSync(this.config.dbPath).size);let i=this.config.dbPath+"-wal";f.existsSync(i)&&(r=f.statSync(i).size)}catch(i){console.debug("[UnifiedMemory] File stat error:",i instanceof Error?i.message:i)}return{tables:e,fileSize:t,walSize:r,vectorIndexSize:this.vectorIndex.size()}}vacuum(){if(!this.db)throw new Error("Database not initialized");this.db.exec("VACUUM")}checkpoint(){if(!this.db)throw new Error("Database not initialized");this.db.pragma("wal_checkpoint(TRUNCATE)")}close(){this.db&&(this.preparedStatements.clear(),this.vectorIndex.clear(),this.db.close(),this.db=null,this.initialized=!1,console.log("[UnifiedMemory] Database closed"))}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("UnifiedMemoryManager not initialized. Call initialize() first.")}floatArrayToBuffer(e){let t=Buffer.alloc(e.length*4);for(let r=0;r<e.length;r++)t.writeFloatLE(e[r],r*4);return t}bufferToFloatArray(e,t){let r=new Float32Array(e.buffer,e.byteOffset,t);return Array.from(r)}};Ve=!1;It()});export{J as a,v as b,bt as c,Z as d,ve as e,ee as f,re as g,se as h,He as i,We as j,Je as k,Ze as l,et as m,D as n,tt as o,Rt as p,Lt as q,Ct as r,Ot as 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.
|
|
2
|
-
import{b as t}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.3");process.exit(0)}
|
|
2
|
+
import{b as t}from"./chunk-WSUYEVSY.js";import{randomInt as o}from"node:crypto";function a(){return Math.random()}function m(n,e){return o(n,e)}function c(n,e){return n+Math.random()*(e-n)}var r=t(()=>{"use strict"});export{a,m as b,c,r 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.
|
|
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.3");process.exit(0)}
|
|
2
2
|
async function o(n){await n.loadAll();let a=new Map;for(let i of n.getLoaded())a.set(i,await n.load(i));return a}export{o 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.
|
|
2
|
-
var e=null,f=null,t=null,u=!1;async function W(){return u&&!t?e:t||(t=(async()=>{try{if(process.env.AQE_RVF_MODE==="sqlite-only"||process.env.AQE_MEMORY_BACKEND==="memory")return null;let{isRvfNativeAvailable:d}=await import("./rvf-native-adapter-
|
|
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.3");process.exit(0)}
|
|
2
|
+
var e=null,f=null,t=null,u=!1;async function W(){return u&&!t?e:t||(t=(async()=>{try{if(process.env.AQE_RVF_MODE==="sqlite-only"||process.env.AQE_MEMORY_BACKEND==="memory")return null;let{isRvfNativeAvailable:d}=await import("./rvf-native-adapter-B75L3ALW.js");if(!d())return null;let{getUnifiedMemory:v,findProjectRoot:p}=await import("./unified-memory-WOOCCIUM.js"),o=v().getDatabase();if(!o)return null;let{join:m}=await import("node:path"),g=m(process.env.AQE_PROJECT_ROOT??p(),".agentic-qe","brain.rvf"),{RvfDualWriter:R}=await import("./rvf-dual-writer-YJYRCYGT.js"),l=new R(o,{rvfPath:g,mode:"dual-write",dimensions:384});await l.initialize(),e=l;try{let{getRvfMigrationStage:y}=await import("./feature-flags-TNZ7ZAJV.js"),a=y();if(a>=2){let{RvfMigrationAdapter:A}=await import("./rvf-migration-adapter-VMRQ2SFO.js"),s=new A({stage:a});s.setSqliteDb(o);let{getSharedRvfAdapter:D}=await import("./shared-rvf-adapter-VQ7NJTGY.js"),i=D();if(i){let h={ingest:n=>i.ingest(n),search:(n,M)=>i.search(n,M).map(c=>({id:c.id,score:c.score})),delete:n=>i.delete(n),status:()=>i.status(),close:()=>{}};s.setRvfStore(h)}f=s,console.log(`[RVF] Migration adapter active at stage ${a} (${["sqlite-only","hybrid","dual-sqlite","dual-rvf","rvf-primary"][a]})`)}}catch{}return l}catch(r){return(process.env.DEBUG||process.env.AQE_VERBOSE)&&console.debug("[RVF] Dual-writer init failed, degrading to sqlite-only:",r instanceof Error?r.message:r),null}finally{u=!0,t=null,import("./base-CZSB27VO.js").then(({registerRvfResetFn:r})=>r(w)).catch(()=>{})}})(),t)}function S(){return e}function b(){return f}function w(){if(e){try{e.close()}catch{}e=null}f=null,t=null,u=!1}export{W as a,S as b,b as c,w as d};
|
|
@@ -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{b as C,d as P}from"./chunk-5C4UYXQL.js";import{a as w,d as M}from"./chunk-UE33MZOC.js";import{a as T}from"./chunk-2K3QFLX2.js";import{e as S}from"./chunk-7FGSX4UD.js";import{a as b,e as $}from"./chunk-ARWSPV2C.js";$();M();import{randomUUID as A}from"crypto";var x={topology:"hierarchical",maxConcurrentSkills:10,maxConcurrentModels:3,timeout:3e5,continueOnFailure:!0,retry:{maxRetries:2,retryDelayMs:1e3}},R=class{config;learner;skillValidator=null;workers=new Map;taskQueue=[];isRunning=!1;constructor(e,t){this.config={...x,...e},this.learner=t}setSkillValidator(e){this.skillValidator=e}async validateSkillsParallel(e,t,i){let s=Date.now(),a=i?.trustTier??3,n=i?.validationLevel??"eval",c=this.determineTopology(e.length,t.length),r=this.createValidationTasks(e,t,a,n),o=await this.executeTasksParallel(r,c),l=new Map;for(let u of o){let p=l.get(u.skill)||[];p.push(u),l.set(u.skill,p)}return await this.recordOutcomesToLearner(o,a,n),l}async validateSkillCrossModel(e,t,i){return(await this.validateSkillsParallel([e],t,i)).get(e)||[]}getSummary(e){let t=[],i=new Map,s=new Map;for(let[c,r]of e){i.set(c,r);for(let o of r){t.push(o);let l=s.get(o.model)||[];l.push(o),s.set(o.model,l)}}let a=t.filter(c=>c.errors.length===0&&c.evalPassRate>=.9).length,n=t.reduce((c,r)=>c+r.durationMs,0);return{totalSkills:i.size,totalModels:s.size,successCount:a,failureCount:t.length-a,overallPassRate:t.length>0?a/t.length:0,totalDurationMs:n,avgDurationMs:t.length>0?n/t.length:0,topology:this.config.topology,bySkill:i,byModel:s,results:t}}determineTopology(e,t){if(this.config.topology){let i=e*t;return i>20&&this.config.topology==="mesh"&&console.warn(`[SwarmSkillValidator] Large workload (${i} tasks) may be more efficient with hierarchical topology`),this.config.topology}return e>5||e>t*2?"hierarchical":t>5&&e<=3?"mesh":"hierarchical"}createValidationTasks(e,t,i,s){let a=[];for(let n of e)for(let c of t)a.push({id:`${n}-${c}-${Date.now()}-${A().slice(0,8)}`,skill:n,model:c,trustTier:i,validationLevel:s,timeout:this.config.timeout,retryCount:0});return a}async executeTasksParallel(e,t){this.isRunning=!0,this.taskQueue=[...e];let i=[],s=t==="hierarchical"?this.config.maxConcurrentSkills:Math.min(this.config.maxConcurrentSkills*this.config.maxConcurrentModels,e.length),a=[];for(let n=0;n<Math.min(s,e.length);n++){let c=`worker-${n}`;this.workers.set(c,{id:c,task:null,status:"idle"}),a.push(this.runWorker(c,i))}return await Promise.all(a),this.isRunning=!1,this.workers.clear(),i}async runWorker(e,t){let i=this.workers.get(e);if(i){for(;this.taskQueue.length>0&&this.isRunning;){let s=this.taskQueue.shift();if(!s)break;i.task=s,i.status="running",i.startTime=Date.now();try{let a=await this.executeValidationTask(s);t.push(a),i.result=a,i.status="completed"}catch(a){let n=this.createErrorResult(s,a);this.config.retry&&s.retryCount<this.config.retry.maxRetries&&this.config.continueOnFailure?(s.retryCount++,this.taskQueue.push(s),await this.delay(this.config.retry.retryDelayMs)):(t.push(n),i.result=n,i.status="failed")}}i.task=null,i.status="idle"}}async executeValidationTask(e){let t=Date.now();if(!this.skillValidator)return this.createSimulatedResult(e,t);let i=new Promise((n,c)=>{setTimeout(()=>c(new Error(`Validation timeout after ${e.timeout}ms`)),e.timeout)}),s=await Promise.race([this.skillValidator(e.skill,e.model,{trustTier:e.trustTier,validationLevel:e.validationLevel,timeout:e.timeout}),i]),a=Date.now()-t;return this.outcomeToResult(s,e,a)}outcomeToResult(e,t,i){let s=e.testCaseResults.filter(c=>c.passed).length,a=e.testCaseResults.length,n=a>0?s/a:e.score;return{skill:t.skill,model:t.model,schemaValid:e.validationLevel!=="schema"||e.passed,validatorPassed:e.validationLevel!=="validator"||e.passed,evalPassRate:n,durationMs:i,errors:e.passed?[]:["Validation failed"],trustTier:t.trustTier,validationLevel:t.validationLevel,retryCount:t.retryCount,timestamp:new Date}}createSimulatedResult(e,t){let i=Date.now()-t+w()*100,s=.85+w()*.15;return{skill:e.skill,model:e.model,schemaValid:!0,validatorPassed:s>.8,evalPassRate:s,durationMs:i,errors:s>.8?[]:["Simulated validation failure"],trustTier:e.trustTier,validationLevel:e.validationLevel,retryCount:e.retryCount,timestamp:new Date}}createErrorResult(e,t){let i=b(t);return{skill:e.skill,model:e.model,schemaValid:!1,validatorPassed:!1,evalPassRate:0,durationMs:0,errors:[i],trustTier:e.trustTier,validationLevel:e.validationLevel,retryCount:e.retryCount,timestamp:new Date}}async recordOutcomesToLearner(e,t,i){for(let s of e){let a={skillName:s.skill,trustTier:s.trustTier||t,validationLevel:s.validationLevel||i,model:s.model,passed:s.errors.length===0&&s.evalPassRate>=.9,score:s.evalPassRate,testCaseResults:this.createTestCaseResults(s),timestamp:s.timestamp,runId:`swarm-${Date.now()}`,metadata:{duration:s.durationMs,retryCount:s.retryCount}};await this.learner.recordValidationOutcome(a)}}createTestCaseResults(e){return[{testId:`${e.skill}-${e.model}-aggregate`,passed:e.errors.length===0,expectedPatterns:["valid-output"],actualPatterns:e.errors.length===0?["valid-output"]:[],reasoningQuality:e.evalPassRate,executionTimeMs:e.durationMs,category:"swarm-validation",priority:"high",error:e.errors.length>0?e.errors.join("; "):void 0}]}delay(e){return new Promise(t=>setTimeout(t,e))}getConfig(){return{...this.config}}isValidationRunning(){return this.isRunning}getWorkerStatus(){return Array.from(this.workers.values())}cancel(){this.isRunning=!1,this.taskQueue=[]}};function D(y,e){return new R(y,e)}var F=["security-testing","accessibility-testing","api-testing","performance-testing","visual-regression-testing","mutation-testing","contract-testing","chaos-testing","compliance-testing","penetration-testing"],I=["claude-sonnet","claude-haiku","claude-opus"];P();import{readFileSync as E,writeFileSync as L,existsSync as N}from"fs";var O={varianceThreshold:.04,regressionThreshold:.1,minSamples:3,autoUpdateManifest:!1},k=class{constructor(e,t,i={}){this.learner=e;this.manifestPath=t;this.config={...O,...i}}learner;manifestPath;config;async aggregateResults(e){let t=`agg-${Date.now()}`,i=new Date,s=this.buildSkillResultsMap(e),a=this.calculateSummary(s,e),n=await this.detectCrossModelAnomalies(e),c=await this.detectRegressions(e,this.config.regressionThreshold),r=this.generateRecommendations(s,n,c),o={timestamp:i,runId:t,summary:a,skillResults:s,crossModelAnalysis:n,regressions:c,recommendations:r,metadata:{version:"1.0.0",environment:e[0]?.metadata?.environment,generatedBy:"ValidationResultAggregator",inputs:{runIds:e.map(l=>l.runId),models:[...new Set(e.map(l=>l.model))]}}};return this.config.autoUpdateManifest&&await this.updateManifest(o),o}buildSkillResultsMap(e){let t=new Map;for(let i of e)for(let s of i.outcomes){let a=s.skillName;t.has(a)||t.set(a,{skill:a,trustTier:s.trustTier,passRateByModel:new Map,avgPassRate:0,schemaValid:!0,validatorPassed:!0,evalPassed:!0,issues:[],executionTimeMs:0,testCount:0,passedTests:0,failedTests:0});let n=t.get(a),c=s.testCaseResults.filter(r=>r.passed).length/(s.testCaseResults.length||1);n.passRateByModel.set(i.model,c),n.testCount+=s.testCaseResults.length,n.passedTests+=s.testCaseResults.filter(r=>r.passed).length,n.failedTests+=s.testCaseResults.filter(r=>!r.passed).length,n.executionTimeMs+=s.metadata?.duration||0,s.validationLevel==="schema"&&!s.passed&&(n.schemaValid=!1),s.validationLevel==="validator"&&!s.passed&&(n.validatorPassed=!1),s.validationLevel==="eval"&&!s.passed&&(n.evalPassed=!1);for(let r of s.testCaseResults)!r.passed&&r.error&&n.issues.push({skill:a,model:i.model,severity:r.priority==="critical"?"critical":r.priority==="high"?"high":r.priority==="medium"?"medium":"low",type:this.categorizeIssueType(s.validationLevel,r.error),message:r.error,testId:r.testId})}for(let i of t.values()){let s=Array.from(i.passRateByModel.values());i.avgPassRate=s.length>0?s.reduce((a,n)=>a+n,0)/s.length:0}return t}categorizeIssueType(e,t){return t.toLowerCase().includes("timeout")?"timeout":e==="schema"?"schema_failure":e==="validator"?"validator_failure":e==="eval"?"eval_failure":"error"}calculateSummary(e,t){let i=Array.from(e.values()),s=i.filter(n=>n.avgPassRate>=.9).length,a=i.length>0?i.reduce((n,c)=>n+c.avgPassRate,0)/i.length:0;return{totalSkills:i.length,passedSkills:s,failedSkills:i.length-s,avgPassRate:a,totalDurationMs:t.reduce((n,c)=>n+c.durationMs,0),totalTests:i.reduce((n,c)=>n+c.testCount,0),passedTests:i.reduce((n,c)=>n+c.passedTests,0),failedTests:i.reduce((n,c)=>n+c.failedTests,0),modelsUsed:[...new Set(t.map(n=>n.model))]}}async detectCrossModelAnomalies(e){let t=new Map,i=new Map,s=new Map;for(let d of e){t.has(d.model)||(t.set(d.model,[]),i.set(d.model,{totalTests:0,passedTests:0,skillCount:0}));for(let g of d.outcomes){let h=g.testCaseResults.filter(m=>m.passed).length/(g.testCaseResults.length||1);t.get(d.model).push(h);let f=i.get(d.model);f.totalTests+=g.testCaseResults.length,f.passedTests+=g.testCaseResults.filter(m=>m.passed).length,f.skillCount++,s.has(g.skillName)||s.set(g.skillName,{passRates:[],models:[]}),s.get(g.skillName).passRates.push(h),s.get(g.skillName).models.push(d.model)}}let a=[];for(let d of t.values())a.push(...d);let n=a.length>0?a.reduce((d,g)=>d+g,0)/a.length:0,c=a.length>1?a.reduce((d,g)=>d+Math.pow(g-n,2),0)/a.length:0,r=Math.sqrt(c),o=[],l=new Map;for(let[d,g]of t.entries()){let h=g.reduce((v,V)=>v+V,0)/g.length,f=h-n,m=i.get(d);l.set(d,{avgPassRate:h,skillCount:m.skillCount,totalTests:m.totalTests}),Math.abs(f)>this.config.varianceThreshold*2&&o.push({model:d,type:f<0?"low_performance":"high_variance",description:`Model ${d} has ${(f*100).toFixed(1)}% difference from average`,passRate:h,avgPassRate:n,deviation:Math.abs(f)})}let u=[],p=[];for(let[d,g]of s.entries()){if(g.passRates.length<2)continue;let h=g.passRates.reduce((m,v)=>m+v,0)/g.passRates.length;g.passRates.reduce((m,v)=>m+Math.pow(v-h,2),0)/g.passRates.length<this.config.varianceThreshold?u.push(d):p.push(d)}return{variance:c,stdDeviation:r,anomalies:o,consistentSkills:u,inconsistentSkills:p,modelPerformance:l}}async detectRegressions(e,t){let i=[],s=new Set;for(let a of e)for(let n of a.outcomes){let c=`${n.skillName}-${a.model}`;if(s.has(c))continue;s.add(c);let r=await this.learner.getValidationTrends(n.skillName);if(!r)continue;let o=n.testCaseResults.filter(p=>p.passed).length/(n.testCaseResults.length||1),l=r.recentPassRate,u=l-o;u>=t&&i.push({skill:n.skillName,model:a.model,previousPassRate:l,currentPassRate:o,regressionAmount:u,trend:r.overall,possibleCauses:this.analyzePossibleCauses(n,u),severity:this.categorizeRegressionSeverity(u)})}return i.sort((a,n)=>{let c={critical:0,high:1,medium:2,low:3},r=c[a.severity]-c[n.severity];return r!==0?r:n.regressionAmount-a.regressionAmount})}analyzePossibleCauses(e,t){let i=[],s=e.testCaseResults.filter(c=>!c.passed);if(s.length>0){let c=[...new Set(s.map(r=>r.category).filter(Boolean))];c.length>0&&i.push(`Failures in categories: ${c.join(", ")}`)}let a=s.filter(c=>c.priority==="critical");a.length>0&&i.push(`${a.length} critical test(s) failing`);let n=e.testCaseResults.reduce((c,r)=>c+r.reasoningQuality,0)/(e.testCaseResults.length||1);return n<.7&&i.push(`Low reasoning quality score: ${(n*100).toFixed(1)}%`),t>.3&&i.push("Possible model behavior change or prompt drift"),i.length===0&&i.push("No specific cause identified - review test details"),i}categorizeRegressionSeverity(e){return e>=.5?"critical":e>=.3?"high":e>=.15?"medium":"low"}generateRecommendations(e,t,i){let s=[];if(t.inconsistentSkills.length>0&&s.push(`Review ${t.inconsistentSkills.length} skills with inconsistent cross-model behavior: `+t.inconsistentSkills.slice(0,3).join(", ")+(t.inconsistentSkills.length>3?` and ${t.inconsistentSkills.length-3} more`:"")),t.anomalies.some(r=>r.type==="low_performance")){let r=t.anomalies.filter(o=>o.type==="low_performance").map(o=>o.model);s.push(`Investigate low performance on model(s): ${r.join(", ")}`)}let a=i.filter(r=>r.severity==="critical");a.length>0&&s.push(`URGENT: ${a.length} critical regression(s) detected - immediate review required`);let n=Array.from(e.values()).filter(r=>r.avgPassRate<.9);if(n.length>0){let r=n.filter(l=>!l.schemaValid),o=n.filter(l=>!l.validatorPassed);r.length>0&&s.push(`Fix schema validation for: ${r.map(l=>l.skill).slice(0,3).join(", ")}`),o.length>0&&s.push(`Review validator scripts for: ${o.map(l=>l.skill).slice(0,3).join(", ")}`)}return Array.from(e.values()).reduce((r,o)=>r+o.avgPassRate,0)/e.size<.8&&s.push("Overall pass rate below 80% - consider reviewing skill definitions and test expectations"),s.length===0&&s.push("All validations passing - no immediate action required"),s}async updateManifest(e){if(!N(this.manifestPath))throw new Error(`Manifest file not found: ${this.manifestPath}`);let t=C(E(this.manifestPath,"utf-8"));for(let[s,a]of e.skillResults.entries())if(t.skills&&t.skills[s]){let n=t.skills[s];n.validation||(n.validation={}),n.validation.passRate=a.avgPassRate,n.validation.lastValidated=e.timestamp.toISOString(),n.validation.status=a.avgPassRate>=.9?"passing":"failing",n.validation.passRateByModel=Object.fromEntries(a.passRateByModel)}let i=Array.from(e.skillResults.values());t.validationStatus={passing:i.filter(s=>s.avgPassRate>=.9).length,failing:i.filter(s=>s.avgPassRate<.9).length,unknown:0,skipped:t.summary?.tier0||0},t.generatedAt=new Date().toISOString(),t.lastValidationRun={runId:e.runId,timestamp:e.timestamp.toISOString(),avgPassRate:e.summary.avgPassRate,modelsUsed:e.summary.modelsUsed},L(this.manifestPath,JSON.stringify(t,null,2))}generateMarkdownReport(e){let{summary:t,crossModelAnalysis:i,regressions:s,recommendations:a,skillResults:n}=e,c=(t.avgPassRate>=.9||t.avgPassRate>=.7,"`"),r=[];if(r.push(`# Validation Report
|
|
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.3");process.exit(0)}
|
|
2
|
+
import{b as C,d as P}from"./chunk-UGNTLSBL.js";import{a as w,d as M}from"./chunk-7TW5UGDP.js";import{a as T}from"./chunk-INVDDFJC.js";import{e as S}from"./chunk-FPFGN2Z5.js";import{a as b,e as $}from"./chunk-2GJJGO5D.js";$();M();import{randomUUID as A}from"crypto";var x={topology:"hierarchical",maxConcurrentSkills:10,maxConcurrentModels:3,timeout:3e5,continueOnFailure:!0,retry:{maxRetries:2,retryDelayMs:1e3}},R=class{config;learner;skillValidator=null;workers=new Map;taskQueue=[];isRunning=!1;constructor(e,t){this.config={...x,...e},this.learner=t}setSkillValidator(e){this.skillValidator=e}async validateSkillsParallel(e,t,i){let s=Date.now(),a=i?.trustTier??3,n=i?.validationLevel??"eval",c=this.determineTopology(e.length,t.length),r=this.createValidationTasks(e,t,a,n),o=await this.executeTasksParallel(r,c),l=new Map;for(let u of o){let p=l.get(u.skill)||[];p.push(u),l.set(u.skill,p)}return await this.recordOutcomesToLearner(o,a,n),l}async validateSkillCrossModel(e,t,i){return(await this.validateSkillsParallel([e],t,i)).get(e)||[]}getSummary(e){let t=[],i=new Map,s=new Map;for(let[c,r]of e){i.set(c,r);for(let o of r){t.push(o);let l=s.get(o.model)||[];l.push(o),s.set(o.model,l)}}let a=t.filter(c=>c.errors.length===0&&c.evalPassRate>=.9).length,n=t.reduce((c,r)=>c+r.durationMs,0);return{totalSkills:i.size,totalModels:s.size,successCount:a,failureCount:t.length-a,overallPassRate:t.length>0?a/t.length:0,totalDurationMs:n,avgDurationMs:t.length>0?n/t.length:0,topology:this.config.topology,bySkill:i,byModel:s,results:t}}determineTopology(e,t){if(this.config.topology){let i=e*t;return i>20&&this.config.topology==="mesh"&&console.warn(`[SwarmSkillValidator] Large workload (${i} tasks) may be more efficient with hierarchical topology`),this.config.topology}return e>5||e>t*2?"hierarchical":t>5&&e<=3?"mesh":"hierarchical"}createValidationTasks(e,t,i,s){let a=[];for(let n of e)for(let c of t)a.push({id:`${n}-${c}-${Date.now()}-${A().slice(0,8)}`,skill:n,model:c,trustTier:i,validationLevel:s,timeout:this.config.timeout,retryCount:0});return a}async executeTasksParallel(e,t){this.isRunning=!0,this.taskQueue=[...e];let i=[],s=t==="hierarchical"?this.config.maxConcurrentSkills:Math.min(this.config.maxConcurrentSkills*this.config.maxConcurrentModels,e.length),a=[];for(let n=0;n<Math.min(s,e.length);n++){let c=`worker-${n}`;this.workers.set(c,{id:c,task:null,status:"idle"}),a.push(this.runWorker(c,i))}return await Promise.all(a),this.isRunning=!1,this.workers.clear(),i}async runWorker(e,t){let i=this.workers.get(e);if(i){for(;this.taskQueue.length>0&&this.isRunning;){let s=this.taskQueue.shift();if(!s)break;i.task=s,i.status="running",i.startTime=Date.now();try{let a=await this.executeValidationTask(s);t.push(a),i.result=a,i.status="completed"}catch(a){let n=this.createErrorResult(s,a);this.config.retry&&s.retryCount<this.config.retry.maxRetries&&this.config.continueOnFailure?(s.retryCount++,this.taskQueue.push(s),await this.delay(this.config.retry.retryDelayMs)):(t.push(n),i.result=n,i.status="failed")}}i.task=null,i.status="idle"}}async executeValidationTask(e){let t=Date.now();if(!this.skillValidator)return this.createSimulatedResult(e,t);let i=new Promise((n,c)=>{setTimeout(()=>c(new Error(`Validation timeout after ${e.timeout}ms`)),e.timeout)}),s=await Promise.race([this.skillValidator(e.skill,e.model,{trustTier:e.trustTier,validationLevel:e.validationLevel,timeout:e.timeout}),i]),a=Date.now()-t;return this.outcomeToResult(s,e,a)}outcomeToResult(e,t,i){let s=e.testCaseResults.filter(c=>c.passed).length,a=e.testCaseResults.length,n=a>0?s/a:e.score;return{skill:t.skill,model:t.model,schemaValid:e.validationLevel!=="schema"||e.passed,validatorPassed:e.validationLevel!=="validator"||e.passed,evalPassRate:n,durationMs:i,errors:e.passed?[]:["Validation failed"],trustTier:t.trustTier,validationLevel:t.validationLevel,retryCount:t.retryCount,timestamp:new Date}}createSimulatedResult(e,t){let i=Date.now()-t+w()*100,s=.85+w()*.15;return{skill:e.skill,model:e.model,schemaValid:!0,validatorPassed:s>.8,evalPassRate:s,durationMs:i,errors:s>.8?[]:["Simulated validation failure"],trustTier:e.trustTier,validationLevel:e.validationLevel,retryCount:e.retryCount,timestamp:new Date}}createErrorResult(e,t){let i=b(t);return{skill:e.skill,model:e.model,schemaValid:!1,validatorPassed:!1,evalPassRate:0,durationMs:0,errors:[i],trustTier:e.trustTier,validationLevel:e.validationLevel,retryCount:e.retryCount,timestamp:new Date}}async recordOutcomesToLearner(e,t,i){for(let s of e){let a={skillName:s.skill,trustTier:s.trustTier||t,validationLevel:s.validationLevel||i,model:s.model,passed:s.errors.length===0&&s.evalPassRate>=.9,score:s.evalPassRate,testCaseResults:this.createTestCaseResults(s),timestamp:s.timestamp,runId:`swarm-${Date.now()}`,metadata:{duration:s.durationMs,retryCount:s.retryCount}};await this.learner.recordValidationOutcome(a)}}createTestCaseResults(e){return[{testId:`${e.skill}-${e.model}-aggregate`,passed:e.errors.length===0,expectedPatterns:["valid-output"],actualPatterns:e.errors.length===0?["valid-output"]:[],reasoningQuality:e.evalPassRate,executionTimeMs:e.durationMs,category:"swarm-validation",priority:"high",error:e.errors.length>0?e.errors.join("; "):void 0}]}delay(e){return new Promise(t=>setTimeout(t,e))}getConfig(){return{...this.config}}isValidationRunning(){return this.isRunning}getWorkerStatus(){return Array.from(this.workers.values())}cancel(){this.isRunning=!1,this.taskQueue=[]}};function D(y,e){return new R(y,e)}var F=["security-testing","accessibility-testing","api-testing","performance-testing","visual-regression-testing","mutation-testing","contract-testing","chaos-testing","compliance-testing","penetration-testing"],I=["claude-sonnet","claude-haiku","claude-opus"];P();import{readFileSync as E,writeFileSync as L,existsSync as N}from"fs";var O={varianceThreshold:.04,regressionThreshold:.1,minSamples:3,autoUpdateManifest:!1},k=class{constructor(e,t,i={}){this.learner=e;this.manifestPath=t;this.config={...O,...i}}learner;manifestPath;config;async aggregateResults(e){let t=`agg-${Date.now()}`,i=new Date,s=this.buildSkillResultsMap(e),a=this.calculateSummary(s,e),n=await this.detectCrossModelAnomalies(e),c=await this.detectRegressions(e,this.config.regressionThreshold),r=this.generateRecommendations(s,n,c),o={timestamp:i,runId:t,summary:a,skillResults:s,crossModelAnalysis:n,regressions:c,recommendations:r,metadata:{version:"1.0.0",environment:e[0]?.metadata?.environment,generatedBy:"ValidationResultAggregator",inputs:{runIds:e.map(l=>l.runId),models:[...new Set(e.map(l=>l.model))]}}};return this.config.autoUpdateManifest&&await this.updateManifest(o),o}buildSkillResultsMap(e){let t=new Map;for(let i of e)for(let s of i.outcomes){let a=s.skillName;t.has(a)||t.set(a,{skill:a,trustTier:s.trustTier,passRateByModel:new Map,avgPassRate:0,schemaValid:!0,validatorPassed:!0,evalPassed:!0,issues:[],executionTimeMs:0,testCount:0,passedTests:0,failedTests:0});let n=t.get(a),c=s.testCaseResults.filter(r=>r.passed).length/(s.testCaseResults.length||1);n.passRateByModel.set(i.model,c),n.testCount+=s.testCaseResults.length,n.passedTests+=s.testCaseResults.filter(r=>r.passed).length,n.failedTests+=s.testCaseResults.filter(r=>!r.passed).length,n.executionTimeMs+=s.metadata?.duration||0,s.validationLevel==="schema"&&!s.passed&&(n.schemaValid=!1),s.validationLevel==="validator"&&!s.passed&&(n.validatorPassed=!1),s.validationLevel==="eval"&&!s.passed&&(n.evalPassed=!1);for(let r of s.testCaseResults)!r.passed&&r.error&&n.issues.push({skill:a,model:i.model,severity:r.priority==="critical"?"critical":r.priority==="high"?"high":r.priority==="medium"?"medium":"low",type:this.categorizeIssueType(s.validationLevel,r.error),message:r.error,testId:r.testId})}for(let i of t.values()){let s=Array.from(i.passRateByModel.values());i.avgPassRate=s.length>0?s.reduce((a,n)=>a+n,0)/s.length:0}return t}categorizeIssueType(e,t){return t.toLowerCase().includes("timeout")?"timeout":e==="schema"?"schema_failure":e==="validator"?"validator_failure":e==="eval"?"eval_failure":"error"}calculateSummary(e,t){let i=Array.from(e.values()),s=i.filter(n=>n.avgPassRate>=.9).length,a=i.length>0?i.reduce((n,c)=>n+c.avgPassRate,0)/i.length:0;return{totalSkills:i.length,passedSkills:s,failedSkills:i.length-s,avgPassRate:a,totalDurationMs:t.reduce((n,c)=>n+c.durationMs,0),totalTests:i.reduce((n,c)=>n+c.testCount,0),passedTests:i.reduce((n,c)=>n+c.passedTests,0),failedTests:i.reduce((n,c)=>n+c.failedTests,0),modelsUsed:[...new Set(t.map(n=>n.model))]}}async detectCrossModelAnomalies(e){let t=new Map,i=new Map,s=new Map;for(let d of e){t.has(d.model)||(t.set(d.model,[]),i.set(d.model,{totalTests:0,passedTests:0,skillCount:0}));for(let g of d.outcomes){let h=g.testCaseResults.filter(m=>m.passed).length/(g.testCaseResults.length||1);t.get(d.model).push(h);let f=i.get(d.model);f.totalTests+=g.testCaseResults.length,f.passedTests+=g.testCaseResults.filter(m=>m.passed).length,f.skillCount++,s.has(g.skillName)||s.set(g.skillName,{passRates:[],models:[]}),s.get(g.skillName).passRates.push(h),s.get(g.skillName).models.push(d.model)}}let a=[];for(let d of t.values())a.push(...d);let n=a.length>0?a.reduce((d,g)=>d+g,0)/a.length:0,c=a.length>1?a.reduce((d,g)=>d+Math.pow(g-n,2),0)/a.length:0,r=Math.sqrt(c),o=[],l=new Map;for(let[d,g]of t.entries()){let h=g.reduce((v,V)=>v+V,0)/g.length,f=h-n,m=i.get(d);l.set(d,{avgPassRate:h,skillCount:m.skillCount,totalTests:m.totalTests}),Math.abs(f)>this.config.varianceThreshold*2&&o.push({model:d,type:f<0?"low_performance":"high_variance",description:`Model ${d} has ${(f*100).toFixed(1)}% difference from average`,passRate:h,avgPassRate:n,deviation:Math.abs(f)})}let u=[],p=[];for(let[d,g]of s.entries()){if(g.passRates.length<2)continue;let h=g.passRates.reduce((m,v)=>m+v,0)/g.passRates.length;g.passRates.reduce((m,v)=>m+Math.pow(v-h,2),0)/g.passRates.length<this.config.varianceThreshold?u.push(d):p.push(d)}return{variance:c,stdDeviation:r,anomalies:o,consistentSkills:u,inconsistentSkills:p,modelPerformance:l}}async detectRegressions(e,t){let i=[],s=new Set;for(let a of e)for(let n of a.outcomes){let c=`${n.skillName}-${a.model}`;if(s.has(c))continue;s.add(c);let r=await this.learner.getValidationTrends(n.skillName);if(!r)continue;let o=n.testCaseResults.filter(p=>p.passed).length/(n.testCaseResults.length||1),l=r.recentPassRate,u=l-o;u>=t&&i.push({skill:n.skillName,model:a.model,previousPassRate:l,currentPassRate:o,regressionAmount:u,trend:r.overall,possibleCauses:this.analyzePossibleCauses(n,u),severity:this.categorizeRegressionSeverity(u)})}return i.sort((a,n)=>{let c={critical:0,high:1,medium:2,low:3},r=c[a.severity]-c[n.severity];return r!==0?r:n.regressionAmount-a.regressionAmount})}analyzePossibleCauses(e,t){let i=[],s=e.testCaseResults.filter(c=>!c.passed);if(s.length>0){let c=[...new Set(s.map(r=>r.category).filter(Boolean))];c.length>0&&i.push(`Failures in categories: ${c.join(", ")}`)}let a=s.filter(c=>c.priority==="critical");a.length>0&&i.push(`${a.length} critical test(s) failing`);let n=e.testCaseResults.reduce((c,r)=>c+r.reasoningQuality,0)/(e.testCaseResults.length||1);return n<.7&&i.push(`Low reasoning quality score: ${(n*100).toFixed(1)}%`),t>.3&&i.push("Possible model behavior change or prompt drift"),i.length===0&&i.push("No specific cause identified - review test details"),i}categorizeRegressionSeverity(e){return e>=.5?"critical":e>=.3?"high":e>=.15?"medium":"low"}generateRecommendations(e,t,i){let s=[];if(t.inconsistentSkills.length>0&&s.push(`Review ${t.inconsistentSkills.length} skills with inconsistent cross-model behavior: `+t.inconsistentSkills.slice(0,3).join(", ")+(t.inconsistentSkills.length>3?` and ${t.inconsistentSkills.length-3} more`:"")),t.anomalies.some(r=>r.type==="low_performance")){let r=t.anomalies.filter(o=>o.type==="low_performance").map(o=>o.model);s.push(`Investigate low performance on model(s): ${r.join(", ")}`)}let a=i.filter(r=>r.severity==="critical");a.length>0&&s.push(`URGENT: ${a.length} critical regression(s) detected - immediate review required`);let n=Array.from(e.values()).filter(r=>r.avgPassRate<.9);if(n.length>0){let r=n.filter(l=>!l.schemaValid),o=n.filter(l=>!l.validatorPassed);r.length>0&&s.push(`Fix schema validation for: ${r.map(l=>l.skill).slice(0,3).join(", ")}`),o.length>0&&s.push(`Review validator scripts for: ${o.map(l=>l.skill).slice(0,3).join(", ")}`)}return Array.from(e.values()).reduce((r,o)=>r+o.avgPassRate,0)/e.size<.8&&s.push("Overall pass rate below 80% - consider reviewing skill definitions and test expectations"),s.length===0&&s.push("All validations passing - no immediate action required"),s}async updateManifest(e){if(!N(this.manifestPath))throw new Error(`Manifest file not found: ${this.manifestPath}`);let t=C(E(this.manifestPath,"utf-8"));for(let[s,a]of e.skillResults.entries())if(t.skills&&t.skills[s]){let n=t.skills[s];n.validation||(n.validation={}),n.validation.passRate=a.avgPassRate,n.validation.lastValidated=e.timestamp.toISOString(),n.validation.status=a.avgPassRate>=.9?"passing":"failing",n.validation.passRateByModel=Object.fromEntries(a.passRateByModel)}let i=Array.from(e.skillResults.values());t.validationStatus={passing:i.filter(s=>s.avgPassRate>=.9).length,failing:i.filter(s=>s.avgPassRate<.9).length,unknown:0,skipped:t.summary?.tier0||0},t.generatedAt=new Date().toISOString(),t.lastValidationRun={runId:e.runId,timestamp:e.timestamp.toISOString(),avgPassRate:e.summary.avgPassRate,modelsUsed:e.summary.modelsUsed},L(this.manifestPath,JSON.stringify(t,null,2))}generateMarkdownReport(e){let{summary:t,crossModelAnalysis:i,regressions:s,recommendations:a,skillResults:n}=e,c=(t.avgPassRate>=.9||t.avgPassRate>=.7,"`"),r=[];if(r.push(`# Validation Report
|
|
3
3
|
|
|
4
4
|
> ${c} Generated: ${e.timestamp.toISOString()}
|
|
5
5
|
> Run ID: ${e.runId}
|
|
@@ -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.3");process.exit(0)}
|
|
2
2
|
import r from"chalk";function s(e){switch(e){case"healthy":case"completed":return r.green(e);case"idle":return r.cyan(e);case"degraded":case"running":return r.yellow(e);case"unhealthy":case"failed":return r.red(e);default:return r.gray(e)}}function a(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 l(e){let t=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),o=Math.floor(e%6e4/1e3);return`${t}h ${n}m ${o}s`}export{s as a,a as b,l 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 q}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.3");process.exit(0)}
|
|
2
|
+
import{a as q}from"./chunk-DH5NWHH2.js";import{r as Q,s as V}from"./chunk-7SWHW5AC.js";import{i as N}from"./chunk-POTVF6BY.js";import{a as F,c as y,d}from"./chunk-Z7UGEQ4G.js";import{a as h,b as M,e as H}from"./chunk-2GJJGO5D.js";import{f as U}from"./chunk-WSUYEVSY.js";H();var v={WorkflowStarted:"workflow.WorkflowStarted",WorkflowCompleted:"workflow.WorkflowCompleted",WorkflowFailed:"workflow.WorkflowFailed",WorkflowCancelled:"workflow.WorkflowCancelled",StepStarted:"workflow.StepStarted",StepCompleted:"workflow.StepCompleted",StepFailed:"workflow.StepFailed",StepSkipped:"workflow.StepSkipped",StepAwaitingApproval:"workflow.StepAwaitingApproval",StepApproved:"workflow.StepApproved",StepRejected:"workflow.StepRejected"},T={maxConcurrentWorkflows:10,defaultStepTimeout:6e4,defaultWorkflowTimeout:6e5,enableEventTriggers:!0,persistExecutions:!0};import{createHash as K}from"node:crypto";function R(s){if(["__proto__","constructor","prototype"].includes(s.id))throw new Error(`parallel_output_invalid_path: unsafe step ID ${s.id}`);let e=[{stepId:s.id,path:s.id,segments:[s.id]}];for(let t of Object.values(s.outputMapping??{}).sort()){let i=t.split(".");if(i.some(r=>!r||["__proto__","constructor","prototype"].includes(r)))throw new Error(`parallel_output_invalid_path: ${s.id} maps to ${t}`);e.push({stepId:s.id,path:t,segments:i})}return e}function $(s){let e=s.flatMap(R),t=[];for(let i=0;i<e.length;i++)for(let r=i+1;r<e.length;r++){let o=e[i],a=e[r];if(o.stepId===a.stepId)continue;let n=Math.min(o.segments.length,a.segments.length);o.segments.slice(0,n).every((c,l)=>c===a.segments[l])&&t.push({pathA:o.path,stepA:o.stepId,pathB:a.path,stepB:a.stepId,kind:o.segments.length===a.segments.length?"exact":"ancestor-descendant"})}return t}function L(s){let e=[];for(let t of s){let i=[...Object.values(t.inputMapping??{}),t.condition?.path,t.skipCondition?.path].filter(r=>typeof r=="string");for(let r of i)for(let o of s){if(o.id===t.id)continue;if(r==="results"){e.push({stepId:t.id,sourcePath:r,otherStepId:o.id});continue}if(!r.startsWith("results."))continue;let a=r.slice(8).split(".");R(o).some(c=>{let l=Math.min(a.length,c.segments.length);return c.segments.slice(0,l).every((g,S)=>g===a[S])})&&e.push({stepId:t.id,sourcePath:r,otherStepId:o.id})}}return e}function E(s,e){if(s===null||typeof s=="string"||typeof s=="boolean")return s;if(typeof s=="number")return["number",String(s)];if(typeof s=="bigint")return["bigint",String(s)];if(s===void 0)return["undefined"];if(typeof s!="object")throw new Error("parallel_output_unhashable");if(e.has(s))throw new Error("parallel_output_cyclic");e.add(s);try{if(s instanceof Date)return["date",s.toISOString()];if(s instanceof ArrayBuffer)return["bytes",Buffer.from(s).toString("base64")];if(ArrayBuffer.isView(s))return["bytes",s.constructor.name,Buffer.from(s.buffer,s.byteOffset,s.byteLength).toString("base64")];if(Array.isArray(s))return["array",s.map(i=>E(i,e))];if(s instanceof Set)return["set",[...s].map(r=>E(r,e)).sort((r,o)=>JSON.stringify(r).localeCompare(JSON.stringify(o)))];if(s instanceof Map)return["map",[...s].map(([r,o])=>[E(r,e),E(o,e)]).sort((r,o)=>JSON.stringify(r).localeCompare(JSON.stringify(o)))];let t=s;return["object",Object.keys(t).sort().map(i=>[i,E(t[i],e)])]}finally{e.delete(s)}}function x(s){let e=JSON.stringify(E(s,new Set));return K("sha256").update(e).digest("hex")}function P(){try{let{getUnifiedMemory:s}=(V(),U(Q)),e=s();return e.isInitialized()?e.getDatabase():null}catch{return null}}var J={id:"quality-gate-check",domain:"quality-assessment",action:"gate-check",async execute(s){let e=typeof s.coverageMin=="number"?s.coverageMin:80,t=typeof s.testsPassingMin=="number"?s.testsPassingMin:90,i=typeof s.maxBugs=="number"?s.maxBugs:5,r=typeof s.currentCoverage=="number"?s.currentCoverage:null,o=typeof s.currentTestsPassingRate=="number"?s.currentTestsPassingRate:null,a=typeof s.currentBugs=="number"?s.currentBugs:null;if(r===null||o===null||a===null){let f=P();if(f)try{if(r===null&&(r=f.prepare("SELECT after_lines FROM coverage_sessions ORDER BY created_at DESC LIMIT 1").get()?.after_lines??0),o===null){let k=f.prepare(`SELECT COUNT(*) as total,
|
|
3
3
|
SUM(CASE WHEN passed = 1 THEN 1 ELSE 0 END) as passed
|
|
4
4
|
FROM test_outcomes
|
|
5
5
|
WHERE created_at > datetime('now', '-7 days')`).get();o=k&&k.total>0?k.passed/k.total*100:0}a===null&&(a=f.prepare(`SELECT COUNT(*) as bugs FROM test_outcomes
|
|
@@ -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{b as y}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.3");process.exit(0)}
|
|
2
|
+
import{b as y}from"./chunk-OT6SOPAL.js";import{a as R,c as N,d as m,e as f,f as A,j as I}from"./chunk-UCSGZVJX.js";import{o as g,s as O}from"./chunk-7SWHW5AC.js";O();var h=class{constructor(t,i){this.externalDb=t;this.keyManager=i??null}externalDb;db=null;initialized=!1;keyManager=null;async initialize(){if(!this.initialized){if(this.externalDb)this.db=this.externalDb;else{let t=g();await t.initialize(),this.db=t.getDatabase()}this.ensureTable(),this.initialized=!0}}getDatabase(){return this.db}getKeyManager(){return this.keyManager}ensureTable(){if(!this.db)throw new Error("Database not initialized");this.db.readonly||(this.db.exec(`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS witness_chain (
|
|
4
4
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
5
5
|
prev_hash TEXT NOT NULL, action_hash TEXT NOT NULL, action_type TEXT NOT NULL,
|