agentic-qe 3.14.6 → 3.14.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +74 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/cli/bundle.js +8 -8
- package/dist/cli/chunks/adapter-TVQKH65T.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-2YGML6OU.js → agent-booster-wasm-AK2W76RG.js} +2 -2
- package/dist/cli/chunks/{agent-handler-D5SSQYNU.js → agent-handler-MGZCWHIY.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-YHPLTITV.js → agent-memory-branch-JZ54MCSP.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-ULGTVVWE.js +2 -0
- package/dist/cli/chunks/{arena-7BGOXGXO.js → arena-CUVH3V7H.js} +2 -2
- package/dist/cli/chunks/{arena-MCE6EU7K.js → arena-YSWTKBCL.js} +4 -4
- package/dist/cli/chunks/{audit-BMWTQECB.js → audit-LVU76QGA.js} +3 -3
- package/dist/cli/chunks/base-W42BURDL.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-PMUNGASU.js → better-sqlite3-DB3LOJQU.js} +2 -2
- package/dist/cli/chunks/{brain-handler-QPUFYX7F.js → brain-handler-SD63KOQ6.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-WKFDGRN4.js → branch-enumerator-4MNOPUC7.js} +2 -2
- package/dist/cli/chunks/{browser-VY5HKH5X.js → browser-OLPNTWQE.js} +2 -2
- package/dist/cli/chunks/browser-workflow-HKGHFFFT.js +2 -0
- package/dist/cli/chunks/{chunk-62N4NUJH.js → chunk-23CX7JNL.js} +2 -2
- package/dist/cli/chunks/{chunk-MW2GGZZ5.js → chunk-25P6JA6V.js} +1 -1
- package/dist/cli/chunks/{chunk-RSXXCL4A.js → chunk-2G63VIJE.js} +1 -1
- package/dist/cli/chunks/{chunk-3NIG7S5W.js → chunk-2IMSJ7IO.js} +1 -1
- package/dist/cli/chunks/{chunk-I33ERSGB.js → chunk-36VKMAMN.js} +2 -2
- package/dist/cli/chunks/{chunk-2TMWAQQ3.js → chunk-3M7J4U74.js} +3 -3
- package/dist/cli/chunks/{chunk-CM7U6TAX.js → chunk-3QJU4Q4R.js} +2 -2
- package/dist/cli/chunks/{chunk-H5BS5VH7.js → chunk-4EKV7PHB.js} +2 -2
- package/dist/cli/chunks/{chunk-IG5GNEC6.js → chunk-4INST4ZL.js} +1 -1
- package/dist/cli/chunks/{chunk-YHKEDEAA.js → chunk-53BXTTRO.js} +3 -3
- package/dist/cli/chunks/{chunk-ENGZ4D5V.js → chunk-5D7ZFWDS.js} +2 -2
- package/dist/cli/chunks/{chunk-DZ3AUAAB.js → chunk-5FSLMYAC.js} +2 -2
- package/dist/cli/chunks/{chunk-FBMN7B46.js → chunk-5GFKTJ65.js} +2 -2
- package/dist/cli/chunks/{chunk-NMAIY4PX.js → chunk-5U6N4V5M.js} +11 -11
- package/dist/cli/chunks/{chunk-B6D2CHEH.js → chunk-6EGS77BB.js} +1 -1
- package/dist/cli/chunks/{chunk-NQZ5AR3D.js → chunk-6PJPQGF4.js} +2 -2
- package/dist/cli/chunks/{chunk-ICTXTNQZ.js → chunk-6RD44SCE.js} +1 -1
- package/dist/cli/chunks/{chunk-2NPKIBAZ.js → chunk-74IOEOMH.js} +2 -2
- package/dist/cli/chunks/{chunk-RTFO5UQH.js → chunk-77QZHIVX.js} +2 -2
- package/dist/cli/chunks/{chunk-D45SG6CP.js → chunk-7EZ2Z2CK.js} +1 -1
- package/dist/cli/chunks/{chunk-UNFFDHER.js → chunk-7MIOK72I.js} +10 -32
- package/dist/cli/chunks/{chunk-HNFVJP4I.js → chunk-7QYOTUOX.js} +2 -2
- package/dist/cli/chunks/{chunk-Q7EAGKAE.js → chunk-A2VUCUTT.js} +2 -2
- package/dist/cli/chunks/{chunk-TVYY3OCX.js → chunk-A3DK3XNZ.js} +1 -1
- package/dist/cli/chunks/{chunk-RETBYIAC.js → chunk-A5MA7A23.js} +4 -4
- package/dist/cli/chunks/{chunk-DUYOVM5I.js → chunk-AEUEMVJK.js} +2 -2
- package/dist/cli/chunks/{chunk-6U7LNMWZ.js → chunk-AJUBT4NP.js} +2 -2
- package/dist/cli/chunks/{chunk-7CUQCCMD.js → chunk-B2YGVSOP.js} +2 -2
- package/dist/cli/chunks/{chunk-SNOBH4AZ.js → chunk-B4I43GE2.js} +2 -2
- package/dist/cli/chunks/{chunk-VMNWDJIZ.js → chunk-BD7FEUN3.js} +2 -2
- package/dist/cli/chunks/{chunk-HM6ZSCPI.js → chunk-BE4KALTE.js} +1 -1
- package/dist/cli/chunks/{chunk-WGM35YWL.js → chunk-BEFTQVEW.js} +2 -2
- package/dist/cli/chunks/{chunk-SMDN3BQZ.js → chunk-BLG7SH4A.js} +1 -1
- package/dist/cli/chunks/{chunk-AJRUJAAK.js → chunk-C3FXFU2T.js} +1 -1
- package/dist/cli/chunks/{chunk-IQO7UCFR.js → chunk-CBONQM5D.js} +2 -2
- package/dist/cli/chunks/{chunk-L4RUBPLR.js → chunk-CQNMGK6Y.js} +2 -2
- package/dist/cli/chunks/{chunk-NHWGMJAP.js → chunk-CVOQ6ESD.js} +2 -2
- package/dist/cli/chunks/{chunk-P6OYS755.js → chunk-DOBKEXMJ.js} +1 -1
- package/dist/cli/chunks/{chunk-QZANMBIT.js → chunk-DYTQHRUS.js} +1 -1
- package/dist/cli/chunks/{chunk-FZOBD67M.js → chunk-EADSQN5T.js} +1 -1
- package/dist/cli/chunks/{chunk-DHVX5UB2.js → chunk-EGOIIUBD.js} +2 -2
- package/dist/cli/chunks/{chunk-6OS76PHI.js → chunk-EIGRV3J6.js} +2 -2
- package/dist/cli/chunks/{chunk-CD542DNJ.js → chunk-EJ6MMYLK.js} +1 -1
- package/dist/cli/chunks/{chunk-ELLBS5RP.js → chunk-ENK44A6Q.js} +2 -2
- package/dist/cli/chunks/{chunk-VGFFFKGK.js → chunk-EYXE2XKP.js} +2 -2
- package/dist/cli/chunks/{chunk-72KXSMWI.js → chunk-F2OPFVQH.js} +1 -1
- package/dist/cli/chunks/{chunk-DK4XN4CU.js → chunk-FBZC4IGB.js} +2 -2
- package/dist/cli/chunks/{chunk-MUOG6QXR.js → chunk-FSSR6WBE.js} +2 -2
- package/dist/cli/chunks/{chunk-DPYSUDAO.js → chunk-FW4DJ4FJ.js} +1 -1
- package/dist/cli/chunks/{chunk-ZVWVV4EX.js → chunk-FYPX5WBJ.js} +1 -1
- package/dist/cli/chunks/{chunk-7J6QC567.js → chunk-G367W7XR.js} +3 -3
- package/dist/cli/chunks/{chunk-IAF6T27S.js → chunk-GLGKQX2V.js} +2 -2
- package/dist/cli/chunks/{chunk-JXGFRBUO.js → chunk-GV4DYPJP.js} +2 -2
- package/dist/cli/chunks/{chunk-BPEDWS6O.js → chunk-GVVFTFMB.js} +2 -2
- package/dist/cli/chunks/{chunk-CF2ISEOJ.js → chunk-H5RQPO3X.js} +2 -2
- package/dist/cli/chunks/{chunk-GSF6MB64.js → chunk-HPWWYT67.js} +2 -2
- package/dist/cli/chunks/{chunk-RG52OKAM.js → chunk-HXXHMLJ5.js} +1 -1
- package/dist/cli/chunks/{chunk-SESK3ARK.js → chunk-HYFQUWNB.js} +2 -2
- package/dist/cli/chunks/{chunk-7D3V65N5.js → chunk-HYOPJHHW.js} +1 -1
- package/dist/cli/chunks/{chunk-7LPR6HJG.js → chunk-HZY42OVU.js} +2 -2
- package/dist/cli/chunks/{chunk-SDRHUMJB.js → chunk-IAENZ2DR.js} +2 -2
- package/dist/cli/chunks/{chunk-B6MOJC3X.js → chunk-IEJ7ZV3M.js} +1 -1
- package/dist/cli/chunks/{chunk-UCFQALXO.js → chunk-IWFFO6VT.js} +2 -2
- package/dist/cli/chunks/chunk-J7AQZLIH.js +21 -0
- package/dist/cli/chunks/{chunk-H52HZ67P.js → chunk-JHJUSSAU.js} +2 -2
- package/dist/cli/chunks/{chunk-2YXGBZWV.js → chunk-JOZ47MV6.js} +1 -1
- package/dist/cli/chunks/{chunk-EAY2JMZG.js → chunk-JZT7BU44.js} +2 -2
- package/dist/cli/chunks/{chunk-BVR7RMC5.js → chunk-KD2BLA5Y.js} +1 -1
- package/dist/cli/chunks/{chunk-BAMN2CHI.js → chunk-KUHLTVWC.js} +1 -1
- package/dist/cli/chunks/{chunk-5QQSIGUA.js → chunk-LU2EDWQK.js} +2 -2
- package/dist/cli/chunks/{chunk-D6CJIGRU.js → chunk-LXZMP3VX.js} +54 -54
- package/dist/cli/chunks/{chunk-GPYVDFB3.js → chunk-LY7MFGBD.js} +196 -187
- package/dist/cli/chunks/{chunk-W6HXLH5G.js → chunk-MM56VPNE.js} +2 -2
- package/dist/cli/chunks/{chunk-E6G2RD5H.js → chunk-MNQN7UZX.js} +2 -2
- package/dist/cli/chunks/{chunk-ZCRTRYXK.js → chunk-MQZ53OR3.js} +2 -2
- package/dist/cli/chunks/{chunk-3HZS4M3O.js → chunk-MT7UNBZ7.js} +2 -2
- package/dist/cli/chunks/{chunk-XAS3XRYM.js → chunk-MZB2UV2O.js} +1 -1
- package/dist/cli/chunks/{chunk-GDSXITFH.js → chunk-MZMG6CUJ.js} +2 -2
- package/dist/cli/chunks/{chunk-6SQM2MUX.js → chunk-N5XOXPHZ.js} +2 -2
- package/dist/cli/chunks/{chunk-5OOMJGFN.js → chunk-NBLDBVAW.js} +1 -1
- package/dist/cli/chunks/{chunk-PI7TJS62.js → chunk-ND4QTZOL.js} +2 -2
- package/dist/cli/chunks/{chunk-H6ZM3PUT.js → chunk-NHUGHAY6.js} +1 -1
- package/dist/cli/chunks/{chunk-5VFPCSK7.js → chunk-NOHWJOBS.js} +1 -1
- package/dist/cli/chunks/{chunk-DBDPRORT.js → chunk-O5V7RHVG.js} +2 -2
- package/dist/cli/chunks/{chunk-UQ32JHES.js → chunk-O6MO5KMR.js} +2 -2
- package/dist/cli/chunks/{chunk-WO4QMXIG.js → chunk-OAZX6WFU.js} +2 -2
- package/dist/cli/chunks/{chunk-GGRHV6D7.js → chunk-OEPNNLR4.js} +1 -1
- package/dist/cli/chunks/{chunk-AIRGNL55.js → chunk-OIDWDGLG.js} +2 -2
- package/dist/cli/chunks/{chunk-V4DM6ELU.js → chunk-ON2UTP2U.js} +2 -2
- package/dist/cli/chunks/{chunk-MBRHSU6W.js → chunk-ONR2NXXD.js} +10 -10
- package/dist/cli/chunks/{chunk-WCJBU2KI.js → chunk-OXHF3L2T.js} +2 -2
- package/dist/cli/chunks/{chunk-AVBJYI5I.js → chunk-OZGIOKEA.js} +1 -1
- package/dist/cli/chunks/{chunk-YFBSPLJG.js → chunk-P2UPYSDJ.js} +1 -1
- package/dist/cli/chunks/{chunk-C6KWXUFJ.js → chunk-P7XSPP5D.js} +2 -2
- package/dist/cli/chunks/{chunk-QDFTT3RF.js → chunk-PCJQCEBA.js} +2 -2
- package/dist/cli/chunks/chunk-PELENDDQ.js +2 -0
- package/dist/cli/chunks/{chunk-257E2A5M.js → chunk-PYKY22GC.js} +5 -5
- package/dist/cli/chunks/{chunk-LL3IGZBI.js → chunk-Q3NSU24F.js} +2 -2
- package/dist/cli/chunks/{chunk-Y3LZ35OG.js → chunk-Q6NTEICT.js} +2 -2
- package/dist/cli/chunks/chunk-QFETNCNN.js +12 -0
- package/dist/cli/chunks/{chunk-SE4WIB26.js → chunk-QGOWNVVG.js} +1 -1
- package/dist/cli/chunks/{chunk-6RE3X4V5.js → chunk-QPLSYEWJ.js} +2 -2
- package/dist/cli/chunks/{chunk-FWASDOT2.js → chunk-QQFQDEUE.js} +2 -2
- package/dist/cli/chunks/{chunk-2JVWITNK.js → chunk-QUORH2MG.js} +55 -79
- package/dist/cli/chunks/{chunk-5J6W7SIA.js → chunk-QVH5Y7AP.js} +1 -1
- package/dist/cli/chunks/{chunk-YSLL6VSL.js → chunk-RC2A4JZ5.js} +2 -2
- package/dist/cli/chunks/{chunk-IB27QACC.js → chunk-RDGPXENG.js} +2 -2
- package/dist/cli/chunks/{chunk-PX5YDCRH.js → chunk-RKI3IQKQ.js} +2 -2
- package/dist/cli/chunks/{chunk-BMAPORJ7.js → chunk-RKUAWQOF.js} +2 -2
- package/dist/cli/chunks/chunk-RLW25X66.js +2 -0
- package/dist/cli/chunks/{chunk-RFNPJK6N.js → chunk-ROVZSZCS.js} +3 -3
- package/dist/cli/chunks/{chunk-MQROI74N.js → chunk-RT6O2HW2.js} +2 -2
- package/dist/cli/chunks/{chunk-Y3UOUNHM.js → chunk-SM2YJ2AL.js} +2 -2
- package/dist/cli/chunks/{chunk-BBT64TII.js → chunk-SRPLERER.js} +3 -3
- package/dist/cli/chunks/{chunk-YS4FCTWF.js → chunk-T77GZF4B.js} +1 -1
- package/dist/cli/chunks/{chunk-IV5UZOHH.js → chunk-TFK2AYIN.js} +2 -2
- package/dist/cli/chunks/chunk-TW3SR4TS.js +2 -0
- package/dist/cli/chunks/{chunk-7Z5LHRC3.js → chunk-TXSPBLBT.js} +2 -2
- package/dist/cli/chunks/chunk-UA7TDVL7.js +12 -0
- package/dist/cli/chunks/{chunk-3EZOZN25.js → chunk-UBJG3IHT.js} +2 -2
- package/dist/cli/chunks/{chunk-QW6VMTBR.js → chunk-UFSVUBTR.js} +2 -2
- package/dist/cli/chunks/{chunk-ZEV3YTO7.js → chunk-UOI6ULCH.js} +2 -2
- package/dist/cli/chunks/{chunk-JZOS5FCX.js → chunk-UYUJT6QO.js} +2 -2
- package/dist/cli/chunks/{chunk-3EA536JF.js → chunk-V5AK56DA.js} +2 -2
- package/dist/cli/chunks/{chunk-UKA2KOXE.js → chunk-V6RE4YRQ.js} +2 -2
- package/dist/cli/chunks/{chunk-RZZCUIAI.js → chunk-VW6FRMLW.js} +2 -2
- package/dist/cli/chunks/chunk-VXKWNRGA.js +2 -0
- package/dist/cli/chunks/{chunk-6SH5VZUD.js → chunk-VYDVI6FZ.js} +2 -2
- package/dist/cli/chunks/{chunk-BJTJLJRZ.js → chunk-WF6UISKW.js} +3 -3
- package/dist/cli/chunks/{chunk-ZL6SYKUK.js → chunk-WIH522AP.js} +1 -1
- package/dist/cli/chunks/{chunk-JIXUMYKZ.js → chunk-WOV6XI3A.js} +1 -1
- package/dist/cli/chunks/{chunk-JBTPOIAC.js → chunk-X7ADKL7T.js} +2 -2
- package/dist/cli/chunks/{chunk-JVNTSNWU.js → chunk-XBYQ2BS4.js} +2 -2
- package/dist/cli/chunks/{chunk-Z7WODOTH.js → chunk-XL5KIYE3.js} +2 -2
- package/dist/cli/chunks/{chunk-JMONHE4B.js → chunk-XWYELBZS.js} +1 -1
- package/dist/cli/chunks/{chunk-SJUXE4IC.js → chunk-XYLQZWF6.js} +2 -2
- package/dist/cli/chunks/{chunk-KNNISEDY.js → chunk-Y6AKKQIQ.js} +1 -1
- package/dist/cli/chunks/{chunk-CCK4BF76.js → chunk-YMW57PEL.js} +1 -1
- package/dist/cli/chunks/{chunk-64VGZQLB.js → chunk-YO4ESCB4.js} +1 -1
- package/dist/cli/chunks/{chunk-ZSPU4MOS.js → chunk-YRHTQZU4.js} +2 -2
- package/dist/cli/chunks/chunk-Z4Q5PCRZ.js +65 -0
- package/dist/cli/chunks/{chunk-Q5XTSMWR.js → chunk-ZELWDJXT.js} +2 -2
- package/dist/cli/chunks/{chunk-SPV2VKC5.js → chunk-ZQZD55MN.js} +2 -2
- package/dist/cli/chunks/{chunk-66VWCR67.js → chunk-ZS4XVJGV.js} +2 -2
- package/dist/cli/chunks/{chunk-6LIHFV7O.js → chunk-ZUB5YOCM.js} +2 -2
- package/dist/cli/chunks/chunk-ZUOVNFXK.js +2 -0
- package/dist/cli/chunks/{chunk-7NITCZWD.js → chunk-ZWEKAEEV.js} +1 -1
- package/dist/cli/chunks/{ci-W6K6G2KZ.js → ci-J3TDK5RA.js} +8 -8
- package/dist/cli/chunks/{ci-output-LDT24TS3.js → ci-output-RLS32FUY.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-F5V4KITU.js → circuit-breaker-MRCC7WCM.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-DT6WQQVD.js → claude-flow-setup-LIZCEKDF.js} +2 -2
- package/dist/cli/chunks/client-3BD2DI4N.js +2 -0
- package/dist/cli/chunks/{cline-installer-G7TJOAEX.js → cline-installer-T7H6R2RC.js} +2 -2
- package/dist/cli/chunks/{code-PGE6A42V.js → code-XMBLI7OF.js} +3 -3
- package/dist/cli/chunks/{code-index-extractor-RNITH372.js → code-index-extractor-QS7BYLEX.js} +2 -2
- package/dist/cli/chunks/{codex-installer-LBX77AI3.js → codex-installer-6PGT5FM6.js} +2 -2
- package/dist/cli/chunks/{completions-4AWLAARX.js → completions-2A3WRXY2.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-ZPNSS476.js → complexity-analyzer-23HOOGJ7.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-UAPWX6OA.js → continuedev-installer-4FSF7B3N.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-BJN2YJGI.js → copilot-installer-A5GRQQUU.js} +2 -2
- package/dist/cli/chunks/core-handlers-C3H2ZCS2.js +2 -0
- package/dist/cli/chunks/{cost-tracker-MHP2VJ63.js → cost-tracker-Z4STQ5VB.js} +2 -2
- package/dist/cli/chunks/{coverage-PQB4IEFG.js → coverage-NUPP6KZZ.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-JCQ7SWDP.js +2 -0
- package/dist/cli/chunks/{cursor-installer-ZXBWYAS3.js → cursor-installer-FVJ7ROPJ.js} +2 -2
- package/dist/cli/chunks/{daemon-N2BEGEFY.js → daemon-7ZZA2MMN.js} +4 -4
- package/dist/cli/chunks/{daemon-64C7R6OJ.js → daemon-D662EX5N.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-SPZDAPNL.js → dag-attention-scheduler-IB4TQ2KA.js} +2 -2
- package/dist/cli/chunks/{detect-LXJBSSZW.js → detect-LGLBZN4I.js} +2 -2
- package/dist/cli/chunks/{dist-node-U3TKZ2IZ.js → dist-node-Z3OL42YE.js} +2 -2
- package/dist/cli/chunks/{domain-handler-3DDWUVSR.js → domain-handler-L3CLNL7U.js} +2 -2
- package/dist/cli/chunks/{domain-plugins-JJVWI4OQ.js → domain-plugins-GQ3V5X6L.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-M36KUJ2U.js → domain-transfer-MFCI76IY.js} +2 -2
- package/dist/cli/chunks/dream-FTP33IJB.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-JPAR7TXX.js → embed-and-insert-pattern-UGD6USYH.js} +2 -2
- package/dist/cli/chunks/{eval-SOLG23EA.js → eval-3B7UIYGY.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-T7G2VOOD.js → experience-capture-middleware-3RQ4NYY3.js} +3 -3
- package/dist/cli/chunks/{fast-paths-32N3ELI4.js → fast-paths-QOSAEPYD.js} +2 -2
- package/dist/cli/chunks/{feature-flags-NAHKLDRN.js → feature-flags-3S5TH6P4.js} +2 -2
- package/dist/cli/chunks/{feature-flags-APJDQ4N7.js → feature-flags-TLF4NKOH.js} +2 -2
- package/dist/cli/chunks/{file-discovery-YKVM3MDB.js → file-discovery-AEVMJRNB.js} +2 -2
- package/dist/cli/chunks/{fleet-55M5CJS4.js → fleet-E6WTXWFL.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-UD6E6S6Z.js → gnn-wrapper-MCKH3AUU.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-OYVW3VSC.js → heartbeat-handler-U7XENHRR.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-HXBJVJL2.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-TU6WG2ME.js +2 -0
- package/dist/cli/chunks/hnsw-index-MS5KODD7.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-HBYIS3ZW.js → hnsw-legacy-bridge-5GW4SAEI.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-EQPM42OU.js → hnswlib-node-7BLZBK5T.js} +2 -2
- package/dist/cli/chunks/{hooks-5ZSSJWO6.js → hooks-F3O2SB6H.js} +10 -10
- package/dist/cli/chunks/hybrid-backend-HT45LBHC.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-XBGVQ4PD.js → hypergraph-engine-PV4EKXHB.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-CAWAQ673.js → hypergraph-handler-VOWO5ZTW.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-AP4AGTG5.js +2 -0
- package/dist/cli/chunks/{init-handler-PRHXSARK.js → init-handler-ENJ5ONJX.js} +16 -14
- package/dist/cli/chunks/init-wizard-I5DFZUQL.js +2 -0
- package/dist/cli/chunks/kernel-MISPSPPA.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-F7LXBM7I.js → kilocode-installer-HNNJOOPE.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-NM723ZRG.js → kiro-installer-UZBIQ3IC.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-L26JESGE.js +2 -0
- package/dist/cli/chunks/{learning-5QYIDHH3.js → learning-YMLCVFUT.js} +3 -3
- package/dist/cli/chunks/{llm-router-43HKWPSX.js → llm-router-YWTARCCT.js} +4 -4
- package/dist/cli/chunks/llm-router-service-MWGC43ZA.js +2 -0
- package/dist/cli/chunks/{load-5YDBWSCS.js → load-DKE3F3IP.js} +2 -2
- package/dist/cli/chunks/load-test-H5ISNNM5.js +2 -0
- package/dist/cli/chunks/{mcp-UMAPMNMY.js → mcp-5PSGIUCW.js} +2 -2
- package/dist/cli/chunks/{memory-FWCPCQFP.js → memory-3L3O6JMM.js} +5 -5
- package/dist/cli/chunks/memory-backend-HWDNOBKW.js +2 -0
- package/dist/cli/chunks/memory-handlers-ZFDVQZM5.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-2XTBGLE4.js → multi-model-executor-AEEO7IA4.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-GIXOJ6NS.js → opencode-installer-ABBO355U.js} +2 -2
- package/dist/cli/chunks/{orchestrator-VW6BKHLI.js → orchestrator-E36Q7MKE.js} +17 -17
- package/dist/cli/chunks/pattern-null-store-GQP6ICWK.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-7CEUC3J7.js → pattern-usage-recorder-H4XKSID4.js} +2 -2
- package/dist/cli/chunks/{pipeline-IGUQPPPO.js → pipeline-BGFEHXIN.js} +2 -2
- package/dist/cli/chunks/{platform-2P636I7B.js → platform-GK7ZVDJI.js} +2 -2
- package/dist/cli/chunks/{plugin-NY6SWDPE.js → plugin-CAH2CKI6.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-2UUDTIO2.js → prime-radiant-advanced-wasm-M5EYRONA.js} +2 -2
- package/dist/cli/chunks/{project-root-IOISG5KX.js → project-root-BSNZC243.js} +2 -2
- package/dist/cli/chunks/protocol-executor-AD5A4DAI.js +2 -0
- package/dist/cli/chunks/{protocol-handler-ZTPCRQ5W.js → protocol-handler-JDSSC2SF.js} +2 -2
- package/dist/cli/chunks/{prove-SQX5A3IG.js → prove-ANPTOZJE.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-W3Z2PKTR.js +2 -0
- package/dist/cli/chunks/{quality-DROILKRY.js → quality-SXWGYRQR.js} +2 -2
- package/dist/cli/chunks/{quality-gate-PWKWDJY2.js → quality-gate-GYNCA4ZY.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-HQRHLIJX.js +2 -0
- package/dist/cli/chunks/{real-embeddings-P5U3MGYC.js → real-embeddings-WSRYAOZM.js} +2 -2
- package/dist/cli/chunks/{ref-validation-KY73NQXD.js → ref-validation-AZ3LRWEK.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-6JPPRB3W.js → roocode-installer-2QKGFIEU.js} +2 -2
- package/dist/cli/chunks/router-MTP5LH4H.js +2 -0
- package/dist/cli/chunks/routing-feedback-GWETVB4L.js +2 -0
- package/dist/cli/chunks/{routing-handler-VTJIVFUO.js → routing-handler-UYDC5MMD.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-C6RPSJJO.js → ruvector-commands-QXADPVEY.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-4UE5S7WP.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-PHH3HF4Q.js +2 -0
- package/dist/cli/chunks/{rvf-migration-coordinator-R53URRIO.js → rvf-migration-coordinator-GD4NBFKT.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-KTLZBUWV.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-MMXN5TEJ.js → rvf-store-integrity-7SXG66IL.js} +2 -2
- package/dist/cli/chunks/safe-db-FWWGAPVE.js +2 -0
- package/dist/cli/chunks/schedule-TPA4V4D5.js +2 -0
- package/dist/cli/chunks/scheduler-5ZTEPNDD.js +2 -0
- package/dist/cli/chunks/{security-3B3R2NL4.js → security-YKB622PK.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-VIJB7JUS.js → shared-rvf-adapter-KMLAV7JK.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-UVWGDUWC.js → shared-rvf-dual-writer-OYY27DFV.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-HPTT624C.js +2 -0
- package/dist/cli/chunks/{standalone-memory-M4LWAAYZ.js → standalone-memory-2DOABVLC.js} +2 -2
- package/dist/cli/chunks/{status-handler-YYFV6OZL.js → status-handler-EXRKETV7.js} +2 -2
- package/dist/cli/chunks/{structural-health-27E6LLKB.js → structural-health-2SKK6DU6.js} +2 -2
- package/dist/cli/chunks/sync-DQ2YUNI6.js +2 -0
- package/dist/cli/chunks/{sync-J3LJ56WN.js → sync-UW7SX7GO.js} +2 -2
- package/dist/cli/chunks/{task-handler-4MCEBQZL.js → task-handler-LYQ6WYUY.js} +2 -2
- package/dist/cli/chunks/task-handlers-DIJO232S.js +9 -0
- package/dist/cli/chunks/test-WRHZMUCW.js +33 -0
- package/dist/cli/chunks/{test-scheduling-ZJBFRZ3J.js → test-scheduling-HI23RXFK.js} +3 -3
- package/dist/cli/chunks/token-bootstrap-23SA6SWZ.js +2 -0
- package/dist/cli/chunks/{token-usage-3X5WMTG2.js → token-usage-M7RRDPXO.js} +2 -2
- package/dist/cli/chunks/{transformers-MVL4C5IX.js → transformers-4TC35KKS.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-SLW65ZFO.js → tree-sitter-wasm-parser-F4LTKAWD.js} +2 -2
- package/dist/cli/chunks/{types-TG5P3CRS.js → types-NBXV6LXQ.js} +2 -2
- package/dist/cli/chunks/unified-memory-OVFEPRPS.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-KKRSCZHR.js +2 -0
- package/dist/cli/chunks/unified-persistence-7GLR4RI3.js +2 -0
- package/dist/cli/chunks/{upgrade-ETBHDEPY.js → upgrade-4BGOU5RM.js} +2 -2
- package/dist/cli/chunks/{validate-C2A73LZK.js → validate-EDWAR63H.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-67XN42ML.js → validate-swarm-VI72CPR7.js} +2 -2
- package/dist/cli/chunks/visual-security-2FUM5GLI.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-USJN77P4.js → web-tree-sitter-Y5XBRQXF.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-5GGZXGJW.js → windsurf-installer-VEX23WAF.js} +2 -2
- package/dist/cli/chunks/{witness-chain-IWS5ZHHL.js → witness-chain-3YNL6YGY.js} +2 -2
- package/dist/cli/chunks/witness-chain-MH6GA5L6.js +2 -0
- package/dist/cli/chunks/witness-chain-repair-MJZGZRWT.js +2 -0
- package/dist/cli/chunks/{witness-chain-verifier-3GEADWPE.js → witness-chain-verifier-TTJYXTBE.js} +2 -2
- package/dist/cli/chunks/{witness-key-manager-ZWEIK3VJ.js → witness-key-manager-EM6YXYOY.js} +2 -2
- package/dist/cli/chunks/{workflow-KHMVVBBA.js → workflow-2RBDOM7V.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-H6G65YKU.js +2 -0
- package/dist/cli/chunks/wrappers-5OTAVVOV.js +2 -0
- package/dist/cli/commands/ci.js +1 -1
- package/dist/cli/commands/test.js +18 -3
- package/dist/cli/handlers/init-handler.d.ts +2 -0
- package/dist/cli/handlers/init-handler.js +8 -2
- package/dist/cli/index.js +8 -0
- package/dist/coordination/handlers/test-execution-handlers.js +13 -8
- package/dist/coordination/index.d.ts +1 -1
- package/dist/coordination/queen-event-handlers.js +9 -6
- package/dist/coordination/result-saver.js +1 -1
- package/dist/coordination/services/index.d.ts +1 -1
- package/dist/coordination/services/task-audit-logger.d.ts +38 -13
- package/dist/coordination/services/task-audit-logger.js +33 -5
- package/dist/coordination/task-executor.d.ts +5 -0
- package/dist/coordination/task-executor.js +10 -5
- package/dist/domains/test-generation/coordinator.js +6 -5
- package/dist/domains/test-generation/interfaces.d.ts +11 -1
- package/dist/domains/test-generation/services/behavior-example-validation.d.ts +36 -0
- package/dist/domains/test-generation/services/behavior-example-validation.js +89 -0
- package/dist/domains/test-generation/services/behavior-examples.d.ts +8 -0
- package/dist/domains/test-generation/services/behavior-examples.js +65 -0
- package/dist/domains/test-generation/services/test-generator.d.ts +1 -1
- package/dist/domains/test-generation/services/test-generator.js +59 -30
- package/dist/domains/visual-accessibility/services/axe-core-audit.d.ts +0 -15
- package/dist/domains/visual-accessibility/services/axe-core-audit.js +12 -10
- package/dist/init/browser-engine-installer.d.ts +5 -5
- package/dist/init/browser-engine-installer.js +28 -6
- package/dist/init/init-wizard.d.ts +2 -0
- package/dist/init/orchestrator.js +1 -0
- package/dist/init/phases/09-assets.js +8 -18
- package/dist/init/phases/phase-interface.d.ts +2 -0
- package/dist/integrations/agentic-flow/reasoning-bank/index.d.ts +2 -5
- package/dist/integrations/vibium/client.d.ts +1 -0
- package/dist/integrations/vibium/client.js +24 -11
- package/dist/integrations/vibium/runtime.d.ts +14 -0
- package/dist/integrations/vibium/runtime.js +94 -0
- package/dist/kernel/pattern-fts-self-heal.d.ts +63 -0
- package/dist/kernel/pattern-fts-self-heal.js +193 -0
- package/dist/kernel/process-lifecycle.d.ts +60 -0
- package/dist/kernel/process-lifecycle.js +91 -0
- package/dist/kernel/unified-memory-schemas.d.ts +15 -1
- package/dist/kernel/unified-memory-schemas.js +53 -25
- package/dist/kernel/unified-memory.js +31 -34
- package/dist/kernel/unified-persistence.js +12 -6
- package/dist/learning/experience-capture.d.ts +2 -1
- package/dist/learning/experience-capture.js +23 -8
- package/dist/learning/pattern-store.d.ts +1 -1
- package/dist/learning/pattern-store.js +27 -30
- package/dist/learning/qe-patterns.d.ts +6 -0
- package/dist/learning/qe-reasoning-bank.d.ts +1 -0
- package/dist/learning/qe-reasoning-bank.js +14 -4
- package/dist/learning/real-qe-reasoning-bank.d.ts +9 -4
- package/dist/learning/real-qe-reasoning-bank.js +28 -4
- package/dist/learning/rvf-pattern-store.js +19 -19
- package/dist/learning/sqlite-persistence.js +9 -24
- package/dist/mcp/bundle.js +508 -545
- package/dist/mcp/entry.js +52 -6
- package/dist/mcp/handlers/domain-handler-configs.js +12 -4
- package/dist/mcp/handlers/task-handlers.js +11 -7
- package/dist/mcp/protocol-server.js +18 -3
- package/dist/mcp/services/reasoning-bank-service.d.ts +6 -1
- package/dist/mcp/services/reasoning-bank-service.js +5 -1
- package/dist/mcp/tools/test-execution/e2e-execute.js +9 -1
- package/dist/mcp/tools/test-generation/generate.d.ts +6 -1
- package/dist/mcp/tools/test-generation/generate.js +8 -0
- package/dist/mcp/types.d.ts +6 -2
- package/dist/shared/error-utils.d.ts +15 -0
- package/dist/shared/error-utils.js +21 -0
- package/dist/shared/events/domain-events.d.ts +2 -1
- package/package.json +10 -6
- package/dist/cli/chunks/adapter-UYOJPTOX.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-JR5AVQXR.js +0 -2
- package/dist/cli/chunks/base-DRZ2LS6X.js +0 -2
- package/dist/cli/chunks/browser-workflow-CJ7T3MXF.js +0 -2
- package/dist/cli/chunks/chunk-4N23RFDU.js +0 -2
- package/dist/cli/chunks/chunk-AHKELLIO.js +0 -12
- package/dist/cli/chunks/chunk-MJS53PRX.js +0 -2
- package/dist/cli/chunks/chunk-PZPWRQ2M.js +0 -21
- package/dist/cli/chunks/chunk-QGA55PFM.js +0 -12
- package/dist/cli/chunks/chunk-TCHGOB2N.js +0 -2
- package/dist/cli/chunks/chunk-Z6GGIRQQ.js +0 -65
- package/dist/cli/chunks/client-KHWJT6FB.js +0 -2
- package/dist/cli/chunks/core-handlers-HING5RRG.js +0 -2
- package/dist/cli/chunks/cross-domain-router-PQTD6AZN.js +0 -2
- package/dist/cli/chunks/dream-WUGRSNCV.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-33XX5XNQ.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-XQPERX3H.js +0 -2
- package/dist/cli/chunks/hnsw-index-2GNXTWHH.js +0 -2
- package/dist/cli/chunks/hybrid-backend-CCF7URKI.js +0 -2
- package/dist/cli/chunks/impact-analyzer-HGKAZWIG.js +0 -2
- package/dist/cli/chunks/init-wizard-72MFBI3G.js +0 -2
- package/dist/cli/chunks/kernel-BRCBVMSK.js +0 -2
- package/dist/cli/chunks/knowledge-graph-DG44IPEI.js +0 -2
- package/dist/cli/chunks/llm-router-service-24KXFX32.js +0 -2
- package/dist/cli/chunks/load-test-N4TAYJY3.js +0 -2
- package/dist/cli/chunks/memory-backend-NVYFYVAU.js +0 -2
- package/dist/cli/chunks/memory-handlers-UTWCNCHL.js +0 -2
- package/dist/cli/chunks/pattern-null-store-SBPNYDBR.js +0 -2
- package/dist/cli/chunks/protocol-executor-IBYEII5Q.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-7IETWW6W.js +0 -2
- package/dist/cli/chunks/queen-coordinator-NHUK2MWJ.js +0 -2
- package/dist/cli/chunks/router-SRSO3IHF.js +0 -2
- package/dist/cli/chunks/routing-feedback-PASRE5HY.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-4M4J67OU.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-TSXGT5LF.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-MOF3E7BR.js +0 -2
- package/dist/cli/chunks/safe-db-QJLFO33B.js +0 -2
- package/dist/cli/chunks/schedule-YIVXW5O2.js +0 -2
- package/dist/cli/chunks/scheduler-AON7DWSJ.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-75VHKKQB.js +0 -2
- package/dist/cli/chunks/sync-26CEGSTC.js +0 -2
- package/dist/cli/chunks/task-handlers-GYBAWKE2.js +0 -9
- package/dist/cli/chunks/test-MPC5HRH5.js +0 -33
- package/dist/cli/chunks/token-bootstrap-2Y2XITBX.js +0 -2
- package/dist/cli/chunks/unified-memory-UCQ6AB32.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-IXYUMKRR.js +0 -2
- package/dist/cli/chunks/unified-persistence-7E6JQ4FZ.js +0 -2
- package/dist/cli/chunks/vibium-NILGKHLN.js +0 -2
- package/dist/cli/chunks/visual-security-4VZXPEVG.js +0 -2
- package/dist/cli/chunks/witness-chain-JQA2VPZI.js +0 -2
- package/dist/cli/chunks/witness-chain-repair-4UA7IPS3.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-GI5NQH7C.js +0 -2
- package/dist/cli/chunks/wrappers-N6XIK5PT.js +0 -2
|
@@ -1,12 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{c as G,d as H}from"./chunk-CM7U6TAX.js";import{h as U}from"./chunk-MBRHSU6W.js";import{b as W}from"./chunk-Z6GGIRQQ.js";import{e as N}from"./chunk-CD542DNJ.js";import{e as F}from"./chunk-7D3V65N5.js";import{b as v,c as x}from"./chunk-3HZS4M3O.js";import{b as k,d as _}from"./chunk-AIRGNL55.js";import{c as b,d as E}from"./chunk-KNNISEDY.js";import{a as se}from"./chunk-TCHGOB2N.js";import{e as O}from"./chunk-FBMN7B46.js";import{a as y,c as I}from"./chunk-MJS53PRX.js";import{i as q}from"./chunk-DPYSUDAO.js";import{S as ae,b as z}from"./chunk-DUYOVM5I.js";import{randomUUID as ee}from"crypto";I();_();import{randomUUID as oe}from"node:crypto";var B=x(),P=class{constructor(e){this.options=e}options;claudeFlowAvailable=!1;localTrajectories=new Map;async initialize(){this.claudeFlowAvailable=await this.checkClaudeFlow()}async checkClaudeFlow(){return v(this.options.projectRoot).available}async startTrajectory(e,t){let i=`trajectory-${oe()}`;if(this.claudeFlowAvailable)try{let{execFileSync:r}=await import("child_process"),n=["--no-install",B,"hooks","intelligence","trajectory-start","--task",e];t&&n.push("--agent",t);let s=r("npx",n,{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot}).match(/trajectoryId[:\s]+["']?([^"'\s,}]+)/i);if(s?.[1])return s[1]}catch(r){console.debug("[TrajectoryBridge] Claude Flow trajectory start failed:",r instanceof Error?r.message:r)}return this.localTrajectories.set(i,{id:i,task:e,agent:t,steps:[],startedAt:Date.now()}),i}async recordStep(e,t,i,r){if(this.claudeFlowAvailable)try{let{execFileSync:a}=await import("child_process"),s=["--no-install",B,"hooks","intelligence","trajectory-step","--trajectory-id",e,"--action",t];i&&s.push("--result",i),r!==void 0&&s.push("--quality",String(r)),a("npx",s,{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot});return}catch(a){console.debug("[TrajectoryBridge] Claude Flow trajectory step failed:",a instanceof Error?a.message:a)}let n=this.localTrajectories.get(e);n&&n.steps.push({id:`step-${n.steps.length+1}`,action:t,result:i,quality:r,timestamp:Date.now()})}async endTrajectory(e,t,i){if(this.claudeFlowAvailable)try{let{execFileSync:n}=await import("child_process"),a=["--no-install",B,"hooks","intelligence","trajectory-end","--trajectory-id",e,"--success",String(t)];i&&a.push("--feedback",i),n("npx",a,{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot})}catch{}let r=this.localTrajectories.get(e);if(r)return r.success=t,r.feedback=i,r.completedAt=Date.now(),await this.persistTrajectory(r),r}getTrajectory(e){return this.localTrajectories.get(e)}isClaudeFlowAvailable(){return this.claudeFlowAvailable}async persistTrajectory(e){try{let{getUnifiedMemory:t}=await import("./unified-memory-UCQ6AB32.js"),i=t();i.isInitialized()||await i.initialize();let r=i.getDatabase();try{r.prepare("PRAGMA table_info(qe_trajectories)").all().some(o=>o.name==="feedback")||r.exec("ALTER TABLE qe_trajectories ADD COLUMN feedback TEXT")}catch{}let n=new Date(e.startedAt).toISOString(),a=e.completedAt?new Date(e.completedAt).toISOString():null;r.prepare(`
|
|
3
|
-
INSERT OR REPLACE INTO qe_trajectories
|
|
4
|
-
(id, task, agent, domain, started_at, ended_at, success, steps_json, feedback)
|
|
5
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
6
|
-
`).run(e.id,e.task,e.agent||null,null,n,a,e.success?1:0,JSON.stringify(e.steps),e.feedback||null)}catch(t){console.debug("[TrajectoryBridge] Trajectory persistence failed:",t instanceof Error?t.message:t)}}};var V=x(),J={low:[/simple/i,/basic/i,/fix typo/i,/rename/i,/format/i,/add comment/i,/lint/i,/minor/i,/quick/i],high:[/architect/i,/design/i,/complex/i,/security/i,/performance/i,/refactor.*large/i,/critical/i,/analysis/i,/multi.*file/i,/database.*migration/i,/distributed/i,/concurrent/i]},R=class{constructor(e){this.options=e}options;claudeFlowAvailable=!1;routingHistory=[];async initialize(){this.claudeFlowAvailable=await this.checkClaudeFlow()}async checkClaudeFlow(){return v(this.options.projectRoot).available}async routeTask(e){if(this.claudeFlowAvailable)try{let{execFileSync:t}=await import("child_process"),i=t("npx",["--no-install",V,"hooks","model-route","--task",e],{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot}),r=i.match(/model[:\s]+["']?(haiku|sonnet|opus)/i),n=i.match(/confidence[:\s]+([0-9.]+)/i),a=i.match(/reason(?:ing)?[:\s]+["']?([^"'\n]+)/i);if(r)return{model:r[1].toLowerCase(),confidence:n?parseFloat(n[1]):.7,reasoning:a?.[1]?.trim()}}catch(t){console.debug("[ModelRouterBridge] Claude Flow routing failed:",t instanceof Error?t.message:t)}return this.localRoute(e)}async recordOutcome(e){if(this.routingHistory.push(e),this.routingHistory.length>1e3&&(this.routingHistory=this.routingHistory.slice(-500)),this.claudeFlowAvailable)try{let{execFileSync:t}=await import("child_process");t("npx",["--no-install",V,"hooks","model-outcome","--task",e.task,"--model",e.model,"--outcome",e.outcome],{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot})}catch(t){console.debug("[ModelRouterBridge] Outcome recording failed:",t instanceof Error?t.message:t)}}getStats(){let e={totalRoutings:this.routingHistory.length,modelDistribution:{haiku:0,sonnet:0,opus:0},successRate:{haiku:0,sonnet:0,opus:0}},t={haiku:0,sonnet:0,opus:0};for(let i of this.routingHistory)e.modelDistribution[i.model]++,i.outcome==="success"&&t[i.model]++;for(let i of["haiku","sonnet","opus"]){let r=e.modelDistribution[i];e.successRate[i]=r>0?t[i]/r:0}return e}isClaudeFlowAvailable(){return this.claudeFlowAvailable}localRoute(e){let t=e.toLowerCase();for(let i of J.low)if(i.test(t))return{model:"haiku",confidence:.75,reasoning:"Low complexity task detected - using haiku for speed"};for(let i of J.high)if(i.test(t))return{model:"opus",confidence:.8,reasoning:"High complexity task detected - using opus for capability"};return e.length>500?{model:"opus",confidence:.65,reasoning:"Long task description - using opus for complex reasoning"}:e.length<50?{model:"haiku",confidence:.6,reasoning:"Short task description - using haiku for efficiency"}:{model:"sonnet",confidence:.7,reasoning:"Medium complexity task - using sonnet for balance"}}};_();I();var D=x(),S=class{constructor(e){this.options=e}options;claudeFlowAvailable=!1;analysisCache=new Map;async initialize(){this.claudeFlowAvailable=await this.checkClaudeFlow()}async checkClaudeFlow(){return v(this.options.projectRoot).available}async analyze(e,t="medium"){let i=e||this.options.projectRoot,r=`${i}:${t}`,n=this.analysisCache.get(r);if(n)return n;if(this.claudeFlowAvailable)try{let{execFileSync:a}=await import("child_process"),s=a("npx",["--no-install",D,"hooks","pretrain","--path",i,"--depth",t],{encoding:"utf-8",timeout:12e4,cwd:this.options.projectRoot});try{let o=k(s),p={success:!0,repositoryPath:i,depth:t,analysis:o.analysis||void 0,agentConfigs:o.agentConfigs};return this.analysisCache.set(r,p),p}catch{return{success:!0,repositoryPath:i,depth:t}}}catch(a){console.debug("[PretrainBridge] Claude Flow analyze failed, using local:",a instanceof Error?a.message:a)}return this.localAnalyze(i,t)}async generateAgentConfigs(e="yaml"){if(this.claudeFlowAvailable)try{let{execFileSync:t}=await import("child_process"),i=t("npx",["--no-install",D,"hooks","build-agents","--format",e],{encoding:"utf-8",timeout:6e4,cwd:this.options.projectRoot});try{return k(i)}catch(r){return console.debug("[PretrainBridge] Agent config parse error:",r instanceof Error?r.message:r),[]}}catch(t){console.debug("[PretrainBridge] Claude Flow generateAgentConfigs failed:",t instanceof Error?t.message:t)}return this.generateLocalAgentConfigs()}async transferPatterns(e,t=.7){if(this.claudeFlowAvailable)try{let{execFileSync:i}=await import("child_process"),r=i("npx",["--no-install",D,"hooks","transfer","--source-path",e,"--min-confidence",String(t)],{encoding:"utf-8",timeout:6e4,cwd:this.options.projectRoot}),n=r.match(/transferred[:\s]+(\d+)/i),a=r.match(/skipped[:\s]+(\d+)/i);return{transferred:n?parseInt(n[1]):0,skipped:a?parseInt(a[1]):0}}catch(i){console.debug("[PretrainBridge] Claude Flow transferPatterns failed:",i instanceof Error?i.message:i)}return{transferred:0,skipped:0}}isClaudeFlowAvailable(){return this.claudeFlowAvailable}async localAnalyze(e,t){try{let i=await import("fast-glob"),{existsSync:r,readFileSync:n}=await import("fs"),{join:a}=await import("path"),s=t==="shallow"?["*.ts","*.js","*.json"]:t==="medium"?["**/*.ts","**/*.js","**/*.json","**/*.py"]:["**/*"],o=["node_modules/**","dist/**","coverage/**",".git/**"],p=await i.default(s,{cwd:e,ignore:o,onlyFiles:!0}),u=new Set,g=new Set;for(let d of p.slice(0,100))(d.endsWith(".ts")||d.endsWith(".tsx"))&&u.add("typescript"),(d.endsWith(".js")||d.endsWith(".jsx"))&&u.add("javascript"),d.endsWith(".py")&&u.add("python"),d.endsWith(".go")&&u.add("go"),d.endsWith(".rs")&&u.add("rust");let w=a(e,"package.json");if(r(w))try{let d=k(n(w,"utf-8")),f={...d.dependencies,...d.devDependencies};f.react&&g.add("react"),f.vue&&g.add("vue"),f.angular&&g.add("angular"),f.vitest&&g.add("vitest"),f.jest&&g.add("jest"),f.playwright&&g.add("playwright"),f.express&&g.add("express"),f.fastify&&g.add("fastify")}catch(d){console.debug("[PretrainBridge] package.json parse error:",d instanceof Error?d.message:d)}let m={success:!0,repositoryPath:e,depth:t,analysis:{languages:Array.from(u),frameworks:Array.from(g),patterns:[],complexity:p.length>500?3:p.length>100?2:1}};return this.analysisCache.set(`${e}:${t}`,m),m}catch(i){return{success:!1,repositoryPath:e,depth:t,error:y(i)}}}generateLocalAgentConfigs(){return[{name:"qe-test-architect",type:"worker",capabilities:["test-generation","test-design"],model:"sonnet"},{name:"qe-coverage-specialist",type:"worker",capabilities:["coverage-analysis","gap-detection"],model:"haiku"},{name:"qe-quality-gate",type:"worker",capabilities:["quality-assessment","risk-scoring"],model:"sonnet"},{name:"qe-security-scanner",type:"worker",capabilities:["security-scanning","vulnerability-detection"],model:"opus"}]}};var M=class{constructor(e){this.options=e;this.trajectory=new P(e),this.modelRouter=new R(e),this.pretrain=new S(e)}options;trajectory;modelRouter;pretrain;initialized=!1;async initialize(){this.initialized||(await Promise.all([this.trajectory.initialize(),this.modelRouter.initialize(),this.pretrain.initialize()]),this.initialized=!0)}getStatus(){return{available:this.isAvailable(),features:{trajectories:this.trajectory.isClaudeFlowAvailable(),modelRouting:this.modelRouter.isClaudeFlowAvailable(),pretrain:this.pretrain.isClaudeFlowAvailable(),patternSearch:this.trajectory.isClaudeFlowAvailable()}}}isAvailable(){return this.trajectory.isClaudeFlowAvailable()||this.modelRouter.isClaudeFlowAvailable()||this.pretrain.isClaudeFlowAvailable()}};function X(l){return new M(l)}se();ae();var T=O.create("experience-capture"),K={"catches-bug":1,flaky:-1,"false-positive":-1,"new-coverage":.3,redundant:0,"code-smell":-.5,neutral:0},ce=new Set(Object.keys(K));function Z(l){return typeof l=="string"&&ce.has(l)}function le(l){if(Z(l))return K[l]}var ue={namespace:"qe-experiences",minQualityForPatternExtraction:.7,similarityThreshold:.85,promotionThreshold:F,maxExperiencesPerDomain:1e3,enableCrossDomainSharing:!0,autoCleanup:!0,cleanupIntervalMs:864e5},Q=class{constructor(e,t,i,r={}){this.memory=e;this.patternStore=t;this.eventBus=i;this.config={...ue,...r}}memory;patternStore;eventBus;config;initialized=!1;cleanupTimer;activeExperiences=new Map;stats={totalCaptured:0,successfulCaptures:0,patternsExtracted:0,patternsPromoted:0,byDomain:new Map};sessionCaptureCount=0;witnessChain;nullRecorder;setWitnessChain(e){this.witnessChain=e}setNullRecorder(e){this.nullRecorder=e}async initialize(){this.initialized||(await this.loadStats(),this.config.autoCleanup&&(this.cleanupTimer=setInterval(()=>this.cleanup(),this.config.cleanupIntervalMs)),this.initialized=!0,console.log("[ExperienceCapture] Initialized"))}startCapture(e,t){let i=`exp-${Date.now()}-${q().slice(0,8)}`,r={id:i,task:e,agent:t?.agent,domain:t?.domain,model:t?.model,startedAt:Date.now(),completedAt:0,durationMs:0,steps:[],success:!1,quality:0,trajectoryId:t?.trajectoryId,metadata:t?.metadata,appliedPatterns:t?.appliedPatterns};return this.activeExperiences.set(i,r),i}recordStep(e,t){let i=this.activeExperiences.get(e);if(!i){console.warn(`[ExperienceCapture] Experience not found: ${e}`);return}i.steps.push({...t,timestamp:Date.now()})}async completeCapture(e,t){let i=this.activeExperiences.get(e);if(!i)return E(new Error(`Experience not found: ${e}`));let r=Date.now();i.completedAt=r,i.durationMs=r-i.startedAt,i.success=t.success,i.feedback=t.feedback,t.quality!==void 0?i.quality=t.quality:i.quality=this.calculateQuality(i);let n=t.testOutcome??i.metadata?.testOutcome;if(n&&Z(n)&&(i.testOutcome=n,i.reward=le(n)),this.witnessChain&&z().useWitnessChain)try{let o=this.witnessChain.appendWitness({type:"experience-capture",decision:i.success?"PASS":"FAIL",context:{experienceId:i.id,task:i.task,quality:i.quality,domain:i.domain,reward:i.reward},evidence:i.reward});i.witnessHash=o.hash}catch(o){T.warn("Failed to create witness receipt for experience",{experienceId:i.id,error:o instanceof Error?o.message:String(o)})}this.activeExperiences.delete(e),await this.storeExperience(i),this.updateStats(i);let a=i.reward!==void 0?i.reward<0:!i.success;if(this.nullRecorder&&a&&i.appliedPatterns?.length){let o=`${i.domain??"unknown"}:${i.agent??"unknown"}`;for(let p of i.appliedPatterns)try{this.nullRecorder({patternId:p,contextFingerprint:o,failureMode:i.testOutcome??i.feedback??"task-failure",trajectoryRef:i.trajectoryId,evidenceClass:"EXECUTED"})}catch(u){T.warn("Failed to record pattern null",{patternId:p,error:u instanceof Error?u.message:String(u)})}}let s=i.reward===void 0||i.reward>0;if(i.success&&i.quality>=this.config.minQualityForPatternExtraction&&s){let o=await this.extractPattern(i);(o.newPattern||o.reinforced)&&(i.patterns=[o.patternId])}return this.emitExperienceCaptured(i),b(i)}getActiveExperience(e){return this.activeExperiences.get(e)}getPendingCount(){return this.activeExperiences.size}async flushPending(){let e=Array.from(this.activeExperiences.entries());if(e.length===0)return 0;let t=0;for(let[i,r]of e){let n=Date.now();r.completedAt=n,r.durationMs=n-r.startedAt,r.quality=r.quality||this.calculateQuality(r),r.metadata={...r.metadata,flushedByCompaction:!0},await this.storeExperience(r),this.updateStats(r),this.activeExperiences.delete(i),t++}return T.info(`Flushed ${t} pending experiences before compaction`),t}async getExperience(e){let t=`${this.config.namespace}:experience:${e}`;return await this.memory.get(t)??null}async searchExperiences(e={}){let t=e.limit||100,i=[],r;e.domain?r=await this.memory.search(`${this.config.namespace}:index:domain:${e.domain}:*`,t*2):r=await this.memory.search(`${this.config.namespace}:experience:*`,t*2);for(let n of r){if(i.length>=t)break;let a=n.includes(":index:")?await this.memory.get(n):null,s=a?await this.getExperience(a):await this.memory.get(n);s&&(e.agent&&s.agent!==e.agent||e.success!==void 0&&s.success!==e.success||e.minQuality!==void 0&&s.quality<e.minQuality||i.push(s))}return i}async getStats(){let e={};for(let[t,i]of this.stats.byDomain)e[t]=i;return{totalExperiences:this.stats.totalCaptured,byDomain:e,successRate:this.stats.totalCaptured>0?this.stats.successfulCaptures/this.stats.totalCaptured:0,avgQuality:await this.calculateAvgQuality(),patternsExtracted:this.stats.patternsExtracted,patternsPromoted:this.stats.patternsPromoted}}async extractPattern(e){if(!this.patternStore)return{newPattern:!1,reinforced:!1,promoted:!1};let t=await this.patternStore.search(e.task,{limit:1,domain:e.domain,useVectorSearch:!0});if(t.success&&t.value.length>0){let n=t.value[0];if(n.similarity>=this.config.similarityThreshold){let a=await this.patternStore.recordUsage(n.pattern.id,e.success),s=await this.patternStore.get(n.pattern.id),o=!1;return s&&s.tier==="short-term"&&s.usageCount>=this.config.promotionThreshold&&(await this.patternStore.promote(n.pattern.id)).success&&(o=!0,this.stats.patternsPromoted++,console.log(`[ExperienceCapture] Pattern promoted: ${n.pattern.id} (${s.usageCount} uses)`)),{newPattern:!1,patternId:n.pattern.id,reinforced:a.success,promoted:o}}}let i=this.experienceToPatternOptions(e),r=await this.patternStore.create(i);return r.success?(this.stats.patternsExtracted++,await this.patternStore.recordUsage(r.value.id,e.success),{newPattern:!0,patternId:r.value.id,reinforced:!1,promoted:!1}):{newPattern:!1,reinforced:!1,promoted:!1}}async shareAcrossDomains(e){if(!this.config.enableCrossDomainSharing||!e.domain)return;let t=this.getRelatedDomains(e.domain);for(let i of t){let r=`${this.config.namespace}:shared:${i}:${e.id}`;await this.memory.set(r,{sourceExperience:e.id,sourceDomain:e.domain,sharedAt:Date.now()},{persist:!0})}}async cleanup(){let t=0;for(let i of this.stats.byDomain.keys()){let r=this.stats.byDomain.get(i)||0;if(r>this.config.maxExperiencesPerDomain){let n=await this.searchExperiences({domain:i,limit:r});n.sort((s,o)=>s.quality-o.quality||s.startedAt-o.startedAt);let a=r-this.config.maxExperiencesPerDomain;for(let s=0;s<Math.min(a,n.length);s++){let o=n[s];await this.softDeleteExperience(o.id),t++}}}return console.log(`[ExperienceCapture] Cleanup: ${t} archived (0 destroyed)`),{removed:0,consolidated:0,archived:t}}async dispose(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=void 0),await this.saveStats(),this.sessionCaptureCount===0&&console.warn("[ExperienceCapture] WARNING: Zero experiences captured this session. Learning cannot improve without experience data. Ensure tasks call startCapture()/completeCapture() to feed the learning loop."),this.activeExperiences.clear(),this.initialized=!1}async storeExperience(e){let t=`${this.config.namespace}:experience:${e.id}`;if(await this.memory.set(t,e,{persist:!0}),e.domain){let i=`${this.config.namespace}:index:domain:${e.domain}:${e.id}`;await this.memory.set(i,e.id,{persist:!0})}if(e.agent){let i=`${this.config.namespace}:index:agent:${e.agent}:${e.id}`;await this.memory.set(i,e.id,{persist:!0})}}async deleteExperience(e){await this.softDeleteExperience(e)}async softDeleteExperience(e){let t=await this.getExperience(e);if(!t)return;let i=`${this.config.namespace}:experience:${e}`,r={...t,_archived:!0};await this.memory.set(i,r,{persist:!0})}calculateQuality(e){if(e.steps.length===0)return e.success?.5:.2;let t=e.steps.filter(r=>r.quality!==void 0);if(t.length===0)return e.success?.6:.3;let i=t.reduce((r,n)=>r+(n.quality||0),0)/t.length;return e.success?Math.min(1,i+.1):Math.max(0,i-.2)}updateStats(e){if(this.stats.totalCaptured++,this.sessionCaptureCount++,e.success&&this.stats.successfulCaptures++,e.domain){let t=this.stats.byDomain.get(e.domain)||0;this.stats.byDomain.set(e.domain,t+1)}}async calculateAvgQuality(){let e=await this.searchExperiences({limit:100});return e.length===0?0:e.reduce((i,r)=>i+r.quality,0)/e.length}experienceToPatternOptions(e){let t=this.detectPatternType(e.task),r=`Task: {{task}}
|
|
7
|
-
|
|
8
|
-
Steps:
|
|
9
|
-
${e.steps.map((n,a)=>`${a+1}. ${n.action}${n.result?` \u2192 ${n.result}`:""}`).join(`
|
|
10
|
-
`)}
|
|
11
|
-
|
|
12
|
-
Duration: ${e.durationMs}ms`;return{patternType:t,name:this.generatePatternName(e),description:`Pattern extracted from: ${e.task}`,context:{tags:this.extractTags(e),testType:this.detectTestType(e.task)},template:{type:"workflow",content:r,variables:[{name:"task",type:"string",description:"The task to execute",required:!0}]}}}detectPatternType(e){let t=e.toLowerCase();return t.includes("test")||t.includes("spec")?(t.includes("unit")||t.includes("integration")||t.includes("e2e"),"test-template"):t.includes("mock")||t.includes("stub")?"mock-pattern":t.includes("assert")||t.includes("expect")?"assertion-pattern":t.includes("coverage")?"coverage-strategy":t.includes("api")||t.includes("contract")?"api-contract":t.includes("visual")||t.includes("screenshot")?"visual-baseline":t.includes("accessibility")||t.includes("a11y")?"a11y-check":t.includes("performance")||t.includes("perf")?"perf-benchmark":t.includes("flaky")?"flaky-fix":t.includes("refactor")?"refactor-safe":t.includes("error")||t.includes("exception")?"error-handling":"test-template"}generatePatternName(e){let t=e.task.replace(/[^a-zA-Z0-9\s-]/g,"").slice(0,50).trim();return`${e.domain?`[${e.domain}] `:""}${t}`}extractTags(e){let t=[];e.domain&&t.push(e.domain),e.agent&&t.push(e.agent),e.model&&t.push(`model:${e.model}`);let i=e.task.toLowerCase().split(/\s+/),r=["unit","integration","e2e","api","mock","coverage","security"];for(let n of r)i.some(a=>a.includes(n))&&t.push(n);return t}detectTestType(e){let t=e.toLowerCase();if(t.includes("unit"))return"unit";if(t.includes("integration"))return"integration";if(t.includes("e2e")||t.includes("end-to-end"))return"e2e";if(t.includes("contract")||t.includes("api"))return"contract";if(t.includes("smoke"))return"smoke"}getRelatedDomains(e){return{"test-generation":["test-execution","coverage-analysis"],"test-execution":["test-generation","coverage-analysis","quality-assessment"],"coverage-analysis":["test-generation","test-execution"],"quality-assessment":["test-execution","defect-intelligence"],"defect-intelligence":["quality-assessment","code-intelligence"],"requirements-validation":["test-generation","quality-assessment"],"code-intelligence":["defect-intelligence","security-compliance"],"security-compliance":["code-intelligence","quality-assessment"],"contract-testing":["test-generation","test-execution"],"visual-accessibility":["quality-assessment","test-execution"],"chaos-resilience":["test-execution","quality-assessment"],"learning-optimization":[]}[e]||[]}emitExperienceCaptured(e){this.eventBus&&this.eventBus.publish({id:`exp-captured-${e.id}`,type:"learning.ExperienceCaptured",source:"learning-optimization",timestamp:new Date,payload:{experience:e,reward:e.reward,testOutcome:e.testOutcome}})}async loadStats(){try{let e=await this.memory.get(`${this.config.namespace}:stats`);e&&(this.stats.totalCaptured=e.totalCaptured,this.stats.successfulCaptures=e.successfulCaptures,this.stats.patternsExtracted=e.patternsExtracted,this.stats.patternsPromoted=e.patternsPromoted,this.stats.byDomain=new Map(e.byDomain))}catch(e){T.debug("Stats restoration failed, starting fresh",{error:e instanceof Error?e.message:String(e)})}}async saveStats(){try{await this.memory.set(`${this.config.namespace}:stats`,{totalCaptured:this.stats.totalCaptured,successfulCaptures:this.stats.successfulCaptures,patternsExtracted:this.stats.patternsExtracted,patternsPromoted:this.stats.patternsPromoted,byDomain:Array.from(this.stats.byDomain.entries())},{persist:!0})}catch(e){console.error("[ExperienceCapture] Failed to save stats:",e)}}};function Y(l,e,t,i){return new Q(l,e,t,i)}var de={enableClaudeFlow:!0,enableExperienceCapture:!0,enablePatternPromotion:!0,promotionThreshold:F},L=class{constructor(e,t,i){this.memory=e;this.eventBus=i;this.config={...de,...t}}memory;eventBus;config;reasoningBank;claudeFlowBridge;experienceCapture;patternStore;coherenceService;initialized=!1;_domainTransferEngine=null;_domainTransferInterval=null;activeTasks=new Map;completedTasks=0;claudeFlowErrors=0;async initialize(){if(!this.initialized){try{this.coherenceService=await G(H),this.coherenceService.isInitialized()&&console.log("[AQELearningEngine] CoherenceService initialized with WASM engines")}catch(e){console.log("[AQELearningEngine] CoherenceService WASM unavailable, using fallback:",y(e))}this.patternStore=W(this.memory,{promotionThreshold:this.config.promotionThreshold}),await this.patternStore.initialize(),this.reasoningBank=U(this.memory,this.eventBus,this.config.reasoningBank,this.coherenceService),await this.reasoningBank.initialize();try{let{getSharedRvfDualWriter:e}=await import("./shared-rvf-dual-writer-UVWGDUWC.js"),t=await e();t&&this.reasoningBank.setRvfDualWriter(t)}catch(e){process.env.DEBUG&&console.debug("[AQELearningEngine] RVF wiring skipped:",e instanceof Error?e.message:e)}if(this.config.enableExperienceCapture){this.experienceCapture=Y(this.memory,this.patternStore,this.eventBus,{promotionThreshold:this.config.promotionThreshold}),await this.experienceCapture.initialize();try{let{isWitnessChainFeatureEnabled:e}=await import("./witness-chain-IWS5ZHHL.js");if(e()){let{createPersistentWitnessChain:t,createWitnessChainSQLitePersistence:i}=await import("./witness-chain-IWS5ZHHL.js"),{getUnifiedPersistence:r}=await import("./unified-persistence-7E6JQ4FZ.js"),n=r();if(n.isInitialized()){let a=n.getDatabase(),s=i(a),o=t(s);this.experienceCapture.setWitnessChain(o)}}}catch(e){process.env.DEBUG&&console.debug("[AQELearningEngine] Witness chain wiring skipped:",e instanceof Error?e.message:e)}try{let{getUnifiedPersistence:e}=await import("./unified-persistence-7E6JQ4FZ.js"),t=e();if(t.isInitialized()){let{PatternNullStore:i}=await import("./pattern-null-store-SBPNYDBR.js"),r=new i(t.getDatabase());this.experienceCapture.setNullRecorder(n=>r.recordNull(n))}}catch(e){process.env.DEBUG&&console.debug("[AQELearningEngine] Null recorder wiring skipped:",e instanceof Error?e.message:e)}}try{let{isCrossDomainTransferEnabled:e}=await import("./feature-flags-NAHKLDRN.js");if(e()&&this.patternStore){let{createDomainTransferEngine:t}=await import("./domain-transfer-M36KUJ2U.js"),i=t(),r=this.patternStore,n=await r.getStats();this._domainTransferInterval=setInterval(async()=>{try{n=await r.getStats()}catch(a){process.env.DEBUG&&console.debug("[AQELearningEngine] Stats refresh failed:",a instanceof Error?a.message:a)}},6e4),this._domainTransferInterval.unref?.(),i.setPerformanceProvider(a=>{let s=n.byDomain?.[a]??0,o=n.totalPatterns??0;return{domain:a,successRate:o>0?s/o:.5,avgConfidence:n.avgConfidence??.5,patternCount:s,timestamp:Date.now()}}),this._domainTransferEngine=i}}catch(e){process.env.DEBUG&&console.debug("[AQELearningEngine] Domain transfer wiring skipped:",e instanceof Error?e.message:e)}if(this.config.enableClaudeFlow)try{this.claudeFlowBridge=X({projectRoot:this.config.projectRoot}),await this.claudeFlowBridge.initialize(),this.claudeFlowBridge.isAvailable()&&console.log("[AQELearningEngine] Claude Flow integration enabled")}catch(e){process.env.DEBUG&&console.log("[AQELearningEngine] Claude Flow not available, using standalone mode:",y(e))}this.initialized=!0,console.log("[AQELearningEngine] Initialized")}}getStatus(){let e=this.claudeFlowBridge?.getStatus();return{initialized:this.initialized,claudeFlowAvailable:e?.available??!1,features:{patternLearning:!0,vectorSearch:!0,taskRouting:!0,trajectories:e?.features.trajectories??!1,modelRouting:e?.features.modelRouting??!1,pretrain:e?.features.pretrain??!1}}}async getStats(){if(!this.initialized||!this.reasoningBank)throw new Error("Engine not initialized");let e=await this.reasoningBank.getStats(),t=this.experienceCapture?await this.experienceCapture.getStats():{totalExperiences:0,byDomain:{},successRate:0,avgQuality:0,patternsExtracted:0,patternsPromoted:0};return{...e,activeTasks:this.activeTasks.size,completedTasks:this.completedTasks,claudeFlowStatus:this.claudeFlowBridge?.getStatus()??{available:!1,features:{trajectories:!1,modelRouting:!1,pretrain:!1,patternSearch:!1}},claudeFlowErrors:this.claudeFlowErrors,experienceCapture:t}}async storePattern(e){return!this.initialized||!this.reasoningBank?E(new Error("Engine not initialized")):this.reasoningBank.storePattern(e)}async searchPatterns(e,t){return!this.initialized||!this.reasoningBank?E(new Error("Engine not initialized")):this.reasoningBank.searchPatterns(e,t)}async getPattern(e){return!this.initialized||!this.reasoningBank?null:this.reasoningBank.getPattern(e)}async recordOutcome(e){return!this.initialized||!this.reasoningBank?E(new Error("Engine not initialized")):this.reasoningBank.recordOutcome(e)}async routeTask(e){if(!this.initialized||!this.reasoningBank)return E(new Error("Engine not initialized"));let t=await this.searchPatternsForTask(e.task,{limit:5,minConfidence:.4,domain:e.domain,contextFingerprint:e.domain?`${e.domain}:router`:void 0});t.success&&t.value.length>0&&await this.trackPatternSearch(e.task,t.value);let i=await this.reasoningBank.routeTask(e);if(i.success&&this.claudeFlowBridge?.pretrain.isClaudeFlowAvailable(),i.success&&t.success){let r=N(i.value,t.value);return b(r)}return i}async route(e,t){let i=await this.routeTask({task:e,context:t});return i.success?i.value:null}async searchPatternsForTask(e,t={}){if(!this.reasoningBank)return b([]);try{return await this.reasoningBank.searchPatterns(e,{limit:t.limit||5,minConfidence:t.minConfidence||.4,domain:t.domain,contextFingerprint:t.contextFingerprint,useVectorSearch:!0})}catch(i){return console.warn("[AQELearningEngine] Pattern search failed:",y(i)),b([])}}async trackPatternSearch(e,t){let i={timestamp:Date.now(),task:e.slice(0,500),patternsFound:t.length,patternIds:t.map(r=>r.pattern.id),avgSimilarity:t.length>0?t.reduce((r,n)=>r+n.similarity,0)/t.length:0};try{let r=`pattern-usage:search:${Date.now()}-${ee().slice(0,8)}`;await this.memory.set(r,i,{persist:!0,ttl:10080*60})}catch(r){console.debug("[AQELearningEngine] Failed to track pattern search:",y(r))}}async recommendModel(e){if(this.claudeFlowBridge?.modelRouter.isClaudeFlowAvailable())try{return await this.claudeFlowBridge.modelRouter.routeTask(e)}catch(t){console.debug("[AQELearningEngine] Claude Flow model routing failed:",t instanceof Error?t.message:t)}return this.localModelRoute(e)}async recordModelOutcome(e,t,i){this.claudeFlowBridge?.modelRouter.isClaudeFlowAvailable()&&await this.claudeFlowBridge.modelRouter.recordOutcome({task:e,model:t,outcome:i})}localModelRoute(e){let t=e.toLowerCase(),i=[/simple/i,/basic/i,/fix typo/i,/rename/i,/format/i,/add comment/i,/lint/i,/minor/i,/quick/i,/small/i];for(let n of i)if(n.test(t))return{model:"haiku",confidence:.75,reasoning:"Low complexity task - using haiku for speed"};let r=[/architect/i,/design/i,/complex/i,/security/i,/performance/i,/refactor.*large/i,/critical/i,/analysis/i,/multi.*file/i,/distributed/i,/concurrent/i,/migration/i];for(let n of r)if(n.test(t))return{model:"opus",confidence:.8,reasoning:"High complexity task - using opus for capability"};return e.length>500?{model:"opus",confidence:.65,reasoning:"Long task description - using opus for complex reasoning"}:e.length<50?{model:"haiku",confidence:.6,reasoning:"Short task - using haiku for efficiency"}:{model:"sonnet",confidence:.7,reasoning:"Medium complexity - using sonnet for balance"}}async startTask(e,t,i){let r=`task-${Date.now()}-${ee().slice(0,8)}`,n=r;if(this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable())try{n=await this.claudeFlowBridge.trajectory.startTrajectory(e,t)}catch(u){this.claudeFlowErrors++,console.warn(`[AQELearningEngine] Claude Flow startTrajectory failed (${this.claudeFlowErrors} total errors):`,y(u))}let a=`${i??"unknown"}:${t??"unknown"}`,s;try{let u=await this.searchPatternsForTask(e,{domain:i,contextFingerprint:a});u.success&&u.value.length>0&&(s=u.value.map(g=>g.pattern.id))}catch{}let o;this.experienceCapture&&(o=this.experienceCapture.startCapture(e,{agent:t,domain:i,trajectoryId:n!==r?n:void 0,appliedPatterns:s}));let p={id:o||n,task:e,agent:t,startedAt:Date.now(),steps:[]};return this.activeTasks.set(p.id,p),p.id}async recordStep(e,t,i,r){if(this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable())try{await this.claudeFlowBridge.trajectory.recordStep(e,t,i,r)}catch(a){this.claudeFlowErrors++,console.warn(`[AQELearningEngine] Claude Flow recordStep failed (${this.claudeFlowErrors} total errors):`,y(a))}this.experienceCapture&&this.experienceCapture.recordStep(e,{action:t,result:i,quality:r});let n=this.activeTasks.get(e);n&&n.steps.push({action:t,result:i,quality:r,timestamp:Date.now()})}async endTask(e,t,i){if(this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable())try{await this.claudeFlowBridge.trajectory.endTrajectory(e,t,i)}catch(n){this.claudeFlowErrors++,console.warn(`[AQELearningEngine] Claude Flow endTrajectory failed (${this.claudeFlowErrors} total errors):`,y(n))}let r=this.activeTasks.get(e);if(r)return this.activeTasks.delete(e),this.completedTasks++,this.config.enableExperienceCapture&&t&&await this.captureExperience(r),r}getTask(e){return this.activeTasks.get(e)}async analyzeCodebase(e,t="medium"){let i=e||this.config.projectRoot;if(this.claudeFlowBridge?.pretrain.isClaudeFlowAvailable())try{return await this.claudeFlowBridge.pretrain.analyze(i,t)}catch(r){console.debug("[AQELearningEngine] Claude Flow pretrain analyze failed:",r instanceof Error?r.message:r)}return this.localAnalyze(i,t)}async generateAgentConfigs(e="yaml"){if(this.claudeFlowBridge?.pretrain.isClaudeFlowAvailable())try{return await this.claudeFlowBridge.pretrain.generateAgentConfigs(e)}catch(t){console.debug("[AQELearningEngine] Claude Flow agent config failed:",t instanceof Error?t.message:t)}return[{name:"qe-test-architect",type:"worker",capabilities:["test-generation","test-design"],model:"sonnet"},{name:"qe-coverage-specialist",type:"worker",capabilities:["coverage-analysis","gap-detection"],model:"haiku"},{name:"qe-security-scanner",type:"worker",capabilities:["security-scanning","vulnerability-detection"],model:"opus"}]}async captureExperience(e){if(!this.experienceCapture||!this.config.enableExperienceCapture)return;let t=e.steps.length>0?e.steps.reduce((r,n)=>r+(n.quality??.5),0)/e.steps.length:.5;await this.experienceCapture.completeCapture(e.id,{success:!0,quality:t});let i=await this.experienceCapture.getExperience(e.id);i&&i.quality>=.7&&await this.experienceCapture.shareAcrossDomains(i)}startExperienceCapture(e,t){if(this.experienceCapture)return this.experienceCapture.startCapture(e,t)}getExperienceCaptureService(){return this.experienceCapture}async localAnalyze(e,t){try{let i=await import("fast-glob"),{existsSync:r,readFileSync:n}=await import("fs"),{join:a}=await import("path"),s=t==="shallow"?["*.ts","*.js","*.json"]:t==="medium"?["**/*.ts","**/*.js","**/*.json","**/*.py"]:["**/*"],o=["node_modules/**","dist/**","coverage/**",".git/**"],p=await i.default(s,{cwd:e,ignore:o,onlyFiles:!0}),u=new Set,g=new Set;for(let m of p.slice(0,100))(m.endsWith(".ts")||m.endsWith(".tsx"))&&u.add("typescript"),(m.endsWith(".js")||m.endsWith(".jsx"))&&u.add("javascript"),m.endsWith(".py")&&u.add("python"),m.endsWith(".go")&&u.add("go"),m.endsWith(".rs")&&u.add("rust");let w=a(e,"package.json");if(r(w))try{let m=k(n(w,"utf-8")),d={...m.dependencies,...m.devDependencies};d.react&&g.add("react"),d.vue&&g.add("vue"),d.vitest&&g.add("vitest"),d.jest&&g.add("jest"),d.playwright&&g.add("playwright")}catch(m){console.debug("[AQELearningEngine] package.json parse failed:",m instanceof Error?m.message:m)}return{success:!0,repositoryPath:e,depth:t,analysis:{languages:Array.from(u),frameworks:Array.from(g),patterns:[],complexity:p.length>500?3:p.length>100?2:1}}}catch(i){return{success:!1,repositoryPath:e,depth:t,error:y(i)}}}getGuidance(e,t){if(!this.reasoningBank)throw new Error("Engine not initialized");return this.reasoningBank.getGuidance(e,t)}generateContext(e,t){if(!this.reasoningBank)throw new Error("Engine not initialized");return this.reasoningBank.generateContext(e,t)}checkAntiPatterns(e,t){if(!this.reasoningBank)throw new Error("Engine not initialized");return this.reasoningBank.checkAntiPatterns(e,t)}async dispose(){this._domainTransferInterval&&(clearInterval(this._domainTransferInterval),this._domainTransferInterval=null),this._domainTransferEngine=null,this.experienceCapture&&await this.experienceCapture.dispose(),this.patternStore&&await this.patternStore.dispose(),this.reasoningBank&&await this.reasoningBank.dispose(),this.activeTasks.clear(),this.initialized=!1}},pe={enabled:!1,snapshotIntervalMs:3e5,minSnapshotsForAnalysis:5,autoApplyThreshold:.8},te=class{config;constructor(e){this.config={...pe,...e}}runMetaLearningCycle(e){if(process.env.AQE_META_LEARNING_ENABLED!=="true")return[];if(!this.config.enabled)return[];if(e.length<this.config.minSnapshotsForAnalysis)return[];let t=Math.floor(e.length/2),i=e.slice(0,t),r=e.slice(t),n=[],a=Date.now(),s=h(i.map(c=>c.tokenMetrics.costUsd)),o=h(r.map(c=>c.tokenMetrics.costUsd)),p=h(i.map(c=>c.tokenMetrics.savingsUsd)),u=h(r.map(c=>c.tokenMetrics.savingsUsd));if(o>s*1.1&&u<=p*1.05){let c=Math.min(1,(o-s)/(s||1));n.push({id:`meta-tw-${a}`,type:"token-waste",description:`Token cost increased by ${((o/(s||1)-1)*100).toFixed(1)}% while savings remained flat`,confidence:A(c),suggestedAction:"Review cache configuration and increase pattern reuse thresholds",detectedAt:a})}let g=h(i.map(c=>c.qualityMetrics.gatePassRate)),w=h(r.map(c=>c.qualityMetrics.gatePassRate));Math.abs(w-g)<.02&&e.length>=this.config.minSnapshotsForAnalysis&&n.push({id:`meta-qp-${a}`,type:"quality-plateau",description:`Gate pass rate has been flat at ${(w*100).toFixed(1)}% across ${e.length} snapshots`,confidence:A(.6+(e.length-this.config.minSnapshotsForAnalysis)*.05),suggestedAction:"Consider reviewing quality thresholds or adding new test coverage domains",detectedAt:a});let d=h(i.map(c=>c.learningMetrics.patternCount)),f=h(r.map(c=>c.learningMetrics.patternCount)),ie=h(i.map(c=>c.learningMetrics.averageConfidence)),$=h(r.map(c=>c.learningMetrics.averageConfidence)),re=Math.abs(f-d),ne=Math.abs($-ie);re<1&&ne<.02&&n.push({id:`meta-ls-${a}`,type:"learning-stall",description:`Pattern count (~${Math.round(f)}) and confidence (~${$.toFixed(2)}) have stagnated`,confidence:A(.65+(e.length-this.config.minSnapshotsForAnalysis)*.04),suggestedAction:"Expand to new QE domains or lower pattern creation thresholds to encourage exploration",detectedAt:a});let C=h(i.map(c=>c.performanceMetrics.p95LatencyMs)),j=h(r.map(c=>c.performanceMetrics.p95LatencyMs));if(j>C*1.2&&C>0){let c=Math.min(1,(j-C)/(C||1));n.push({id:`meta-pr-${a}`,type:"performance-regression",description:`P95 latency increased from ${C.toFixed(0)}ms to ${j.toFixed(0)}ms`,confidence:A(c),suggestedAction:"Profile hot paths and consider HNSW index tuning or batch size reduction",detectedAt:a})}return n}shouldAutoApply(e,t){let i=(t??this.config).autoApplyThreshold;return e.confidence>=i}};function h(l){return l.length===0?0:l.reduce((e,t)=>e+t,0)/l.length}function A(l){return Math.max(0,Math.min(1,l))}function ge(l,e,t){return new L(l,e,t)}function it(l,e,t){return ge(l,{projectRoot:e},t)}export{de as a,L as b,pe as c,te as d,ge as e,it as f};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{b as r}from"./chunk-64VGZQLB.js";function o(n){return n instanceof Error?n.message:String(n)}function e(n){return n instanceof Error?n:new Error(String(n))}var t=r(()=>{"use strict"});export{o as a,e as b,t as c};
|
|
@@ -1,21 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a as Y}from"./chunk-AVBJYI5I.js";import{a as q,e as C,f as J}from"./chunk-NQZ5AR3D.js";import{a as D}from"./chunk-QZANMBIT.js";import{a as U,b as j,c as G,d as B,f as $}from"./chunk-CD542DNJ.js";import{a as O,b as z,g as _,j as H}from"./chunk-7D3V65N5.js";import{d as F}from"./chunk-UNFFDHER.js";import{a as M,e as P,g as A,i as N,j as S,n as W}from"./chunk-2TMWAQQ3.js";import{b as v,d as ee}from"./chunk-AIRGNL55.js";import{c as h,d as p}from"./chunk-KNNISEDY.js";import{a as Z}from"./chunk-TCHGOB2N.js";import{e as T}from"./chunk-FBMN7B46.js";import{a as I,b as f,c as X}from"./chunk-MJS53PRX.js";import{i as L}from"./chunk-DPYSUDAO.js";Z();X();ee();var o=T.create("RealQEReasoningBank"),te={sqlite:{dbPath:".agentic-qe/memory.db",walMode:!0,useUnified:!0},embeddings:{modelName:"Xenova/all-MiniLM-L6-v2",quantized:!0,enableCache:!0},enableLearning:!0,enableRouting:!0,enableGuidance:!0,hnsw:{M:16,efConstruction:200,efSearch:100},routingWeights:{similarity:.3,performance:.4,capabilities:.3},coherenceThreshold:.4},R=class{constructor(e={},t){this.coherenceService=t;this.qeConfig={...te,...e},this.sqliteStore=F(this.qeConfig.sqlite),this.asymmetricEngine=new Y}coherenceService;qeConfig;sqliteStore;hnswIndex=null;patternIdMap=new Map;initialized=!1;stats={routingRequests:0,totalRoutingLatency:0,learningOutcomes:0,successfulOutcomes:0};routingLatencies=new D(1e3);asymmetricEngine;agentCapabilities={"qe-test-generator":{domains:["test-generation"],capabilities:["test-generation","tdd","bdd","unit-test","integration-test"],performanceScore:.85},"qe-coverage-analyzer":{domains:["coverage-analysis"],capabilities:["coverage-analysis","gap-detection","risk-scoring"],performanceScore:.92},"qe-coverage-specialist":{domains:["coverage-analysis"],capabilities:["sublinear-analysis","branch-coverage","mutation-testing"],performanceScore:.88},"qe-test-architect":{domains:["test-generation","coverage-analysis"],capabilities:["test-strategy","test-pyramid","architecture"],performanceScore:.9},"qe-api-contract-validator":{domains:["contract-testing"],capabilities:["contract-testing","openapi","graphql","pact"],performanceScore:.87},"qe-security-auditor":{domains:["security-compliance"],capabilities:["sast","dast","vulnerability","owasp"],performanceScore:.82},"qe-visual-tester":{domains:["visual-accessibility"],capabilities:["screenshot","visual-regression","percy","chromatic"],performanceScore:.8},"qe-a11y-ally":{domains:["visual-accessibility"],capabilities:["wcag","aria","screen-reader","contrast"],performanceScore:.85},"qe-performance-tester":{domains:["chaos-resilience"],capabilities:["load-testing","stress-testing","k6","artillery"],performanceScore:.83},"qe-flaky-investigator":{domains:["test-execution"],capabilities:["flaky-detection","test-stability","retry"],performanceScore:.78},"qe-chaos-engineer":{domains:["chaos-resilience"],capabilities:["chaos-testing","resilience","fault-injection"],performanceScore:.75}};async initialize(){if(this.initialized)return;let e=performance.now();await this.sqliteStore.initialize(),o.info("SQLite persistence initialized"),await P(M,this.qeConfig.embeddings),await this.initializeHNSW(),o.info("HNSW index initialized"),await this.loadPatternsIntoHNSW(),this.sqliteStore.getStats().totalPatterns===0&&(this.sqliteStore.hasAnyHistoricalData?.()??!1?o.error("qe_patterns table is EMPTY but historical data exists \u2014 possible data loss! Restore from backup instead of loading seed patterns. Skipping foundational pattern load to avoid masking data loss."):await this.loadFoundationalPatterns()),this.initialized=!0;let i=performance.now()-e;o.info("Fully initialized",{durationMs:Math.round(i)})}async initializeHNSW(){try{let e=await import("./hnswlib-node-EQPM42OU.js"),i=e.default?.HierarchicalNSW||e.HierarchicalNSW;if(typeof i!="function")throw new Error("HierarchicalNSW not found in hnswlib-node module");let n=i,a=S();this.hnswIndex=new n("cosine",a),this.hnswIndex.initIndex(1e5,this.qeConfig.hnsw.M,this.qeConfig.hnsw.efConstruction),this.hnswIndex.setEf(this.qeConfig.hnsw.efSearch),o.info("HNSW initialized",{dimension:a,M:this.qeConfig.hnsw.M})}catch(e){throw o.error("HNSW initialization failed",e instanceof Error?e:void 0),e}}async loadPatternsIntoHNSW(){if(!this.hnswIndex)return;let e=this.sqliteStore.getAllEmbeddings(),t=S(),i=0,n=0,a=W()?.spaceId;for(let{patternId:s,embedding:r,spaceId:c}of e){if(!a||c!==a||!r||!Array.isArray(r)||r.length!==t){n++;continue}let m=this.hnswIndex.getCurrentCount();this.hnswIndex.addPoint(r,m),this.patternIdMap.set(m,s),i++}n>0&&o.warn("Skipped invalid embeddings",{skipped:n,expectedDim:t}),o.info("Loaded patterns into HNSW index",{count:i})}async loadFoundationalPatterns(){let e=[{patternType:"test-template",name:"AAA Unit Test",description:"Arrange-Act-Assert pattern for clear, maintainable unit tests",template:{type:"code",content:`describe('{{className}}', () => {
|
|
3
|
-
describe('{{methodName}}', () => {
|
|
4
|
-
it('should {{expectedBehavior}}', {{async}} () => {
|
|
5
|
-
// Arrange
|
|
6
|
-
{{arrangeCode}}
|
|
7
|
-
|
|
8
|
-
// Act
|
|
9
|
-
{{actCode}}
|
|
10
|
-
|
|
11
|
-
// Assert
|
|
12
|
-
{{assertCode}}
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
});`,variables:[{name:"className",type:"string",required:!0},{name:"methodName",type:"string",required:!0},{name:"expectedBehavior",type:"string",required:!0}]},context:{testType:"unit",tags:["unit-test","aaa","best-practice"]}},{patternType:"coverage-strategy",name:"Risk-Based Coverage",description:"Prioritize coverage by code risk and complexity",template:{type:"prompt",content:"Analyze coverage gaps focusing on critical business logic, error handling, and high-complexity functions.",variables:[]},context:{tags:["coverage","risk-based"]}}];for(let t of e)try{await this.storeQEPattern(t)}catch(i){o.warn("Failed to load foundational pattern",{name:t.name,error:i})}o.info("Loaded foundational patterns",{count:e.length})}async storeQEPattern(e){try{let t=`${e.name} ${e.description||""} ${e.context?.tags?.join(" ")||""}`,i=await P(t,this.qeConfig.embeddings),n=O(t)||"test-generation";if(q())try{let r=J(e.name,{description:e.description,template:e.template,patternType:e.patternType},n,{tags:e.context?.tags}),c=await C.evaluateWrite(r);if(!c.allowed&&(o.warn("Pattern blocked by MemoryWriteGate",{name:e.name,reason:c.reason,conflicts:c.conflictingPatterns?.join(", ")||"none"}),c.reason?.includes("strict")))return p(new Error(`Pattern blocked by governance: ${c.reason}`))}catch(r){o.warn("MemoryWriteGate check error (continuing)",{error:r})}let a=L(),s={id:a,patternType:e.patternType,qeDomain:n,domain:n,name:e.name,description:e.description||"",confidence:.5,usageCount:0,successRate:0,qualityScore:0,tier:"short-term",template:e.template,context:{tags:[],...e.context},createdAt:new Date,lastUsedAt:new Date,successfulUses:0,embedding:i,reusable:!1,reuseCount:0,averageTokenSavings:0};if(this.sqliteStore.storePattern(s,i),this.hnswIndex){let r=this.hnswIndex.getCurrentCount();this.hnswIndex.addPoint(i,r),this.patternIdMap.set(r,a)}if(q())try{C.registerPattern({key:a,value:{name:s.name,description:s.description,patternType:s.patternType},domain:s.domain})}catch(r){o.warn("Pattern registration with MemoryWriteGate failed",{error:r})}return h(s)}catch(t){return p(f(t))}}async searchQEPatterns(e,t={}){let i=performance.now();try{if(!this.hnswIndex)return p(new Error("HNSW index not available"));let n=await P(e,this.qeConfig.embeddings),a=t.limit||10,s=this.hnswIndex.searchKnn(n,a*2),r=[];for(let m=0;m<s.neighbors.length&&r.length<a;m++){let g=s.neighbors[m],l=1-s.distances[m];if(t.minSimilarity&&l<t.minSimilarity)continue;let d=this.patternIdMap.get(g);if(!d)continue;let u=this.sqliteStore.getPattern(d);u&&(t.domain&&u.qeDomain!==t.domain||r.push({pattern:u,similarity:l}))}let c=performance.now()-i;return c>10&&o.warn("Slow search",{searchTimeMs:Number(c.toFixed(1))}),h(r)}catch(n){return p(f(n))}}async routeTask(e){let t=performance.now();this.stats.routingRequests++;try{let i=e.domain?[e.domain]:z(e.task);i.length===0&&i.push("test-generation");let n=await this.searchQEPatterns(e.task,{limit:10,domain:i[0]}),a=n.success?n.value.map(l=>l.pattern):[],s=[];for(let[l,d]of Object.entries(this.agentCapabilities)){let u=0,b=[],Q=i.filter(y=>d.domains.includes(y)).length,E=Q>0?Q/i.length*.4:0;if(u+=E*this.qeConfig.routingWeights.similarity,E>0&&b.push(`Domain: ${(E*100).toFixed(0)}%`),e.capabilities&&e.capabilities.length>0){let y=e.capabilities.filter(K=>d.capabilities.some(V=>V.toLowerCase().includes(K.toLowerCase()))).length,w=y>0?y/e.capabilities.length*.3:0;u+=w*this.qeConfig.routingWeights.capabilities,w>0&&b.push(`Caps: ${(w*100).toFixed(0)}%`)}else u+=.15*this.qeConfig.routingWeights.capabilities;u+=d.performanceScore*.3*this.qeConfig.routingWeights.performance,b.push(`Perf: ${(d.performanceScore*100).toFixed(0)}%`),s.push({agent:l,score:u,reasoning:b})}s.sort((l,d)=>d.score-l.score);let r=s[0],c=s.slice(1,4),m=[];if(this.qeConfig.enableGuidance&&i.length>0){let l=j(i[0],{framework:e.context?.framework,language:e.context?.language,includeAntiPatterns:!0});m.push(...l.slice(0,5))}let g=performance.now()-t;this.stats.totalRoutingLatency+=g,this.routingLatencies.push(g);let x={recommendedAgent:r.agent,confidence:r.score,alternatives:c.map(l=>({agent:l.agent,score:l.score})),domains:i,patterns:a,guidance:m,reasoning:r.reasoning.join("; "),latencyMs:g};return h($(e.includePatternGuidance,x,n.success?n.value:[]))}catch(i){return p(f(i))}}async recordOutcome(e){if(!this.qeConfig.enableLearning)return h(void 0);try{this.sqliteStore.recordUsage(e.patternId,e.success,e.metrics,e.feedback),this.stats.learningOutcomes++,e.success&&this.stats.successfulOutcomes++;let t=this.sqliteStore.getPattern(e.patternId);if(t){let i=t.qeDomain,n=this.asymmetricEngine.computeConfidenceUpdate(t.confidence,e.success?"success":"failure",i);this.asymmetricEngine.shouldQuarantine(n,i).shouldQuarantine&&o.info("Pattern quarantined (asymmetric drop)",{name:t.name}),this.sqliteStore.updatePattern(e.patternId,{confidence:n}),await this.checkPatternPromotionWithCoherence(t)&&(this.sqliteStore.promotePattern(e.patternId),o.info("Pattern promoted to long-term",{name:t.name}))}return h(void 0)}catch(t){return p(f(t))}}async checkPatternPromotionWithCoherence(e){let t=_(e);if(!t.meetsUsageCriteria||!t.meetsQualityCriteria)return!1;if(this.coherenceService&&this.coherenceService.isInitialized()){let a=[...await this.getLongTermPatterns(),e].map(r=>({id:r.id,embedding:r.embedding||[],weight:r.confidence,metadata:{name:r.name,domain:r.qeDomain}})),s=await this.coherenceService.checkCoherence(a);if(s.energy>=(this.qeConfig.coherenceThreshold||.4))return o.info("Pattern promotion blocked due to coherence violation",{name:e.name,energy:s.energy}),s.contradictions&&s.contradictions.length>0&&o.info("Conflicts with existing patterns",{conflictingNodeIds:s.contradictions.map(r=>r.nodeIds).flat()}),!1}return!0}async getLongTermPatterns(){return this.sqliteStore.getPatterns({limit:1e3}).filter(t=>t.tier==="long-term")}shouldPromote(e){return e.tier==="short-term"&&e.successfulUses>=3&&e.successRate>=.7&&e.confidence>=.6}getQEGuidance(e){return U(e)}generateQEContext(e,t){return B(e,t||{})}checkQEAntiPatterns(e,t){return G(e,t)}async getQEStats(){let e=this.sqliteStore.getStats(),t=this.routingLatencies.percentile(95)||0,i={};for(let n of H)i[n]=e.byDomain[n]||0;return{totalPatterns:e.totalPatterns,byDomain:i,byTier:e.byTier,routingRequests:this.stats.routingRequests,avgRoutingLatencyMs:this.stats.routingRequests>0?this.stats.totalRoutingLatency/this.stats.routingRequests:0,p95RoutingLatencyMs:t,learningOutcomes:this.stats.learningOutcomes,patternSuccessRate:this.stats.learningOutcomes>0?this.stats.successfulOutcomes/this.stats.learningOutcomes:0,embeddingCacheSize:0,transformerAvailable:N(),embeddingDimension:S(),sqliteDbPath:this.qeConfig.sqlite.dbPath||".agentic-qe/memory.db",asymmetricLearning:{failurePenaltyRatio:"10:1",quarantinedPatterns:this.sqliteStore.getPatterns({limit:1e4}).filter(n=>n.quarantined===!0).length,rehabilitatedPatterns:this.sqliteStore.getPatterns({limit:1e4}).filter(n=>n.quarantined===!1&&n.quarantinedAt).length,avgConfidenceDelta:this.stats.learningOutcomes>0?this.stats.successfulOutcomes/this.stats.learningOutcomes-.5:0}}}async storeLoopPattern(e){try{let t=await this.storeQEPattern({patternType:"anti-pattern",name:`loop-detection:${e.toolCallSignature}`,description:`Tool call loop detected for agent ${e.agentId} during ${e.taskType}. Steering: ${e.steeringUsed}. Resolved: ${e.resolved}`,template:{type:"prompt",content:e.steeringUsed,variables:[]},context:{tags:["anti-pattern","loop-detection","learning-optimization",e.taskType]}});return t.success?{success:!0,patternId:t.value.id}:{success:!1,error:t.error?.message??"Unknown error"}}catch(t){return{success:!1,error:I(t)}}}async recordPatternOutcome(e,t,i){let n=this.sqliteStore.getPattern(e);if(!n)return;let a=n.usageCount+1,s=t?n.successfulUses+1:n.successfulUses,r=s/a,c=.3,m=(1-c)*n.qualityScore+c*i,g=Math.min(1,.5+a*.05+r*.3);this.sqliteStore.updatePattern(e,{usageCount:a,successfulUses:s,successRate:r,qualityScore:m,confidence:g})}async checkPatternPromotion(e,t,i,n){let a=this.sqliteStore.getPattern(e);return a?a.tier==="short-term"?t>=3&&i>=.6&&n>=.5:a.tier==="long-term"?t>=10&&i>=.75&&n>=.7:!1:!1}async promotePattern(e){this.sqliteStore.promotePattern(e)}async demotePattern(e){let t=this.sqliteStore.getPattern(e);if(!t)return;let i=["short-term","working","long-term"],n=i.indexOf(t.tier);if(n>0){let a=i[n-1];this.sqliteStore.updatePattern(e,{tier:a}),o.info("Pattern demoted",{name:t.name,newTier:a})}}cleanupPatternIdMap(){if(!this.initialized)return 0;let e=0,t=this.sqliteStore.getPatterns({limit:1e5}),i=new Set(t.map(n=>n.id));for(let[n,a]of Array.from(this.patternIdMap.entries()))i.has(a)||(this.patternIdMap.delete(n),e++);return e>0&&o.info("Cleaned stale patternIdMap entries",{count:e}),e}removePatternFromHNSW(e){for(let[t,i]of Array.from(this.patternIdMap.entries()))if(i===e)return this.patternIdMap.delete(t),o.info("Removed pattern from HNSW mapping",{patternId:e}),!0;return!1}getMemoryStats(){return{patternIdMapSize:this.patternIdMap.size,routingLatenciesSize:this.routingLatencies.length,hnswIndexCount:this.hnswIndex?.getCurrentCount()??0}}async storeTrajectory(e){return this.sqliteStore.getDb().prepare(`
|
|
16
|
-
INSERT OR REPLACE INTO qe_trajectories (
|
|
17
|
-
id, task, agent, domain, started_at, ended_at, success, steps_json, metadata_json
|
|
18
|
-
) VALUES (?, ?, ?, ?, datetime('now'), datetime('now'), ?, ?, ?)
|
|
19
|
-
`).run(e.id,e.task,e.agent??null,e.domain??null,e.success?1:0,JSON.stringify(e.steps),JSON.stringify(e.metrics??{})),e.id}async getTrajectories(e,t=50){let i=this.sqliteStore.getDb(),n="SELECT * FROM qe_trajectories",a=[];return e&&(n+=" WHERE domain = ?",a.push(e)),n+=" ORDER BY ended_at DESC LIMIT ?",a.push(t),i.prepare(n).all(...a).map(r=>({id:r.id,task:r.task,agent:r.agent??void 0,domain:r.domain,success:r.success===1,steps:v(r.steps_json||"[]"),metrics:r.metadata_json?v(r.metadata_json):void 0}))}async linkPatternToTrajectory(e,t){let i=this.sqliteStore.getDb(),n=this.sqliteStore.getPattern(e);if(n){let a={...n.context,sourceTrajectoryId:t};i.prepare(`
|
|
20
|
-
UPDATE qe_patterns SET context_json = ?, updated_at = datetime('now') WHERE id = ?
|
|
21
|
-
`).run(JSON.stringify(a),e)}}async getEnhancedAdapter(){return{message:"Use EnhancedReasoningBankAdapter for full agentic-flow integration",importPath:"../integrations/agentic-flow/reasoning-bank/index.js"}}async dispose(){this.sqliteStore.close(),A(),this.hnswIndex=null,this.patternIdMap.clear(),this.routingLatencies.clear(),this.stats.routingRequests=0,this.stats.totalRoutingLatency=0,this.stats.learningOutcomes=0,this.stats.successfulOutcomes=0,this.initialized=!1,o.info("Disposed")}async destroy(){return this.dispose()}};function qe(k={},e){return new R(k,e)}export{qe as a};
|
|
@@ -1,12 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{e as x,f as C,j as y,k as R,q as F}from"./chunk-SJUXE4IC.js";import{b as I,c as k}from"./chunk-MJS53PRX.js";import{b as w}from"./chunk-64VGZQLB.js";var P,S=w(()=>{"use strict";P={enabled:!0,headless:!0,timeout:3e4,retryAttempts:3,fallbackEnabled:!0,browserType:"chromium",viewport:{width:1280,height:720},userAgent:"",devtools:!1,slowMo:0,screenshotDir:".agentic-qe/screenshots"}});function B(i){return i instanceof o}function a(i,e="Unknown Vibium error"){return B(i)?i:i instanceof Error?new o(i.message||e,"UNKNOWN_ERROR",i):new o(typeof i=="string"?i:e,"UNKNOWN_ERROR")}var o,c,f,g,l,p,m,b,A=w(()=>{"use strict";o=class i extends Error{constructor(t,r,s){super(t);this.code=r;this.cause=s;this.name="VibiumError",Error.captureStackTrace&&Error.captureStackTrace(this,i),s?.stack&&(this.stack+=`
|
|
3
|
-
Caused by: ${s.stack}`)}code;cause},c=class extends o{constructor(e="Vibium MCP server is unavailable",t){super(e,"VIBIUM_UNAVAILABLE",t),this.name="VibiumUnavailableError"}},f=class extends o{constructor(e="Browser operation timed out",t){super(e,"VIBIUM_TIMEOUT",t),this.name="VibiumTimeoutError"}},g=class extends o{selector;constructor(e,t){super(`Element not found: ${e}`,"ELEMENT_NOT_FOUND",t),this.name="VibiumElementNotFoundError",this.selector=e}},l=class extends o{constructor(e="Failed to connect to browser",t){super(e,"CONNECTION_ERROR",t),this.name="VibiumConnectionError"}},p=class extends o{url;statusCode;constructor(e,t,r){let s=t?`Navigation failed: ${e} (HTTP ${t})`:`Navigation failed: ${e}`;super(s,"NAVIGATION_ERROR",r),this.name="VibiumNavigationError",this.url=e,this.statusCode=t}},m=class extends o{constructor(e="Failed to capture screenshot",t){super(e,"SCREENSHOT_ERROR",t),this.name="VibiumScreenshotError"}},b=class extends o{action;selector;constructor(e,t,r){super(`Failed to ${e} element: ${t}`,"INTERACTION_ERROR",r),this.name="VibiumInteractionError",this.action=e,this.selector=t}}});import{randomUUID as _}from"crypto";async function V(){if(v!==null)return v;try{return v=(await import("./vibium-NILGKHLN.js")).browser,O=!0,v}catch(i){return console.warn("[Vibium] Failed to load vibium package:",i),O=!1,null}}async function T(i,e,t){let r;for(let s=1;s<=e;s++)try{return await i()}catch(n){if(r=I(n),s<e){let u=Math.min(100*Math.pow(2,s-1),2e3);await new Promise(d=>setTimeout(d,u))}}throw new o(`${t} failed after ${e} attempts`,"RETRY_EXHAUSTED",r)}async function h(i,e){let t=Date.now();try{let r=await i();return R()&&console.log(`[Vibium] ${e}: ${Date.now()-t}ms`),r}catch(r){throw R()&&console.log(`[Vibium] ${e} failed: ${Date.now()-t}ms`,r),r}}var v,O,E,N,M=w(()=>{S();A();k();F();v=null,O=!1;E=class{config;currentSession=null;lastHealthCheck=null;_initialized=!1;_available=null;vibeInstance=null;constructor(e={}){this.config={...P,...e}}async isAvailable(){if(!this.config.enabled)return!1;if(this._available!==null)return this._available;try{let e=await V();return this._available=e!==null,this._available}catch{return this._available=!1,!1}}async getHealth(){let e=new Date;if(!this.config.enabled)return{status:"unavailable",features:["fallback-only"],lastChecked:e,error:"Vibium is disabled by configuration",sessionActive:!1};try{await this.isAvailable()?this.lastHealthCheck={status:this.vibeInstance?"connected":"disconnected",version:"0.1.2",browserType:this.config.browserType,features:["browser-launch","navigation","element-interaction","screenshots","script-evaluation","accessibility-testing"],latencyMs:10,lastChecked:e,sessionActive:this.vibeInstance!==null}:this.lastHealthCheck={status:"unavailable",features:["fallback-only"],lastChecked:e,error:"Vibium package not available - install with: npm install vibium",sessionActive:!1}}catch(t){this.lastHealthCheck={status:"error",features:["fallback-only"],lastChecked:e,error:t instanceof Error?t.message:"Unknown error",sessionActive:!1}}return this.lastHealthCheck}async getSession(){return this.currentSession}async launch(e){if(!x())return{success:!1,error:new c("Browser mode is disabled by feature flags")};let t=async()=>{let r=await V();if(!r)throw new c("Vibium package not available. Install with: npm install vibium");let s=e?.headless??this.config.headless;this.vibeInstance=await r.launch({headless:s});let n={id:this.generateSessionId(),browserType:this.config.browserType,launchedAt:new Date,status:"connected",viewport:e?.viewport??this.config.viewport,headless:s};return this.currentSession=n,n};try{return{success:!0,value:y()?await T(()=>h(t,"browser_launch"),this.config.retryAttempts,"browser_launch"):await h(t,"browser_launch")}}catch(r){return{success:!1,error:a(r,"Failed to launch browser")}}}async quit(){if(!this.vibeInstance)return{success:!1,error:new l("No active browser session")};let e=async()=>{this.vibeInstance&&(await this.vibeInstance.quit(),this.vibeInstance=null),this.currentSession=null};try{return await h(e,"browser_quit"),{success:!0,value:void 0}}catch(t){return{success:!1,error:a(t,"Failed to quit browser")}}}async navigate(e){this.ensureSession();let t=async()=>{let r=Date.now();await this.vibeInstance.go(e.url);let s="";try{s=await this.vibeInstance.evaluate("document.title")}catch{s="Unknown"}let n={url:e.url,statusCode:200,title:s,durationMs:Date.now()-r,success:!0};return this.currentSession&&(this.currentSession.currentUrl=e.url),n};try{return{success:!0,value:y()?await T(()=>h(t,"page_navigate"),this.config.retryAttempts,"page_navigate"):await h(t,"page_navigate")}}catch(r){return{success:!1,error:new p(e.url,void 0,r instanceof Error?r:void 0)}}}async getPageInfo(){this.ensureSession();try{let e=await this.vibeInstance.evaluate("window.location.href"),t=await this.vibeInstance.evaluate("document.title");return{success:!0,value:{url:e,title:t,viewport:this.config.viewport,loadState:"loaded"}}}catch(e){return{success:!1,error:a(e,"Failed to get page info")}}}async goBack(){this.ensureSession();try{return await this.vibeInstance.evaluate("window.history.back()"),{success:!0,value:void 0}}catch(e){return{success:!1,error:a(e,"Failed to go back")}}}async goForward(){this.ensureSession();try{return await this.vibeInstance.evaluate("window.history.forward()"),{success:!0,value:void 0}}catch(e){return{success:!1,error:a(e,"Failed to go forward")}}}async reload(){this.ensureSession();try{return await this.vibeInstance.evaluate("window.location.reload()"),{success:!0,value:void 0}}catch(e){return{success:!1,error:a(e,"Failed to reload page")}}}async findElement(e){this.ensureSession();try{let t=await this.vibeInstance.find(e.selector,{timeout:e.timeout??this.config.timeout});return{success:!0,value:{selector:e.selector,tagName:t.info.tag,textContent:t.info.text,attributes:{},boundingBox:t.info.box,visible:!0,enabled:!0}}}catch(t){return{success:!1,error:new g(e.selector,t instanceof Error?t:void 0)}}}async findElements(e){this.ensureSession();try{let t=e.selector.replace(/\\/g,"\\\\").replace(/'/g,"\\'");return{success:!0,value:(await this.vibeInstance.evaluate(`
|
|
4
|
-
Array.from(document.querySelectorAll('${t}'))
|
|
5
|
-
.map(el => ({
|
|
6
|
-
tag: el.tagName.toLowerCase(),
|
|
7
|
-
text: el.textContent?.trim() || ''
|
|
8
|
-
}))
|
|
9
|
-
`)).map((n,u)=>({selector:`${e.selector}:nth-child(${u+1})`,tagName:n.tag,textContent:n.text,attributes:{},visible:!0,enabled:!0}))}}catch(t){return{success:!1,error:a(t,"Failed to find elements")}}}async click(e){this.ensureSession();let t=Date.now();try{return await(await this.vibeInstance.find(e.selector,{timeout:e.timeout??this.config.timeout})).click({timeout:e.timeout??this.config.timeout}),{success:!0,value:{success:!0,durationMs:Date.now()-t}}}catch(r){return{success:!1,error:new b("click",e.selector,r instanceof Error?r:void 0)}}}async type(e){this.ensureSession();let t=Date.now();try{let r=await this.vibeInstance.find(e.selector,{timeout:e.timeout??this.config.timeout});if(e.clear){let n=e.selector.replace(/\\/g,"\\\\").replace(/'/g,"\\'");await this.vibeInstance.evaluate(`
|
|
10
|
-
const el = document.querySelector('${n}');
|
|
11
|
-
if (el) el.value = '';
|
|
12
|
-
`)}return await r.type(e.text,{timeout:e.timeout??this.config.timeout}),{success:!0,value:{success:!0,durationMs:Date.now()-t}}}catch(r){return{success:!1,error:new b("type",e.selector,r instanceof Error?r:void 0)}}}async getText(e){this.ensureSession();try{return{success:!0,value:await(await this.vibeInstance.find(e)).text()}}catch(t){return{success:!1,error:a(t,`Failed to get text from ${e}`)}}}async getAttribute(e,t){this.ensureSession();try{return{success:!0,value:await(await this.vibeInstance.find(e)).getAttribute(t)??""}}catch(r){return{success:!1,error:a(r,`Failed to get attribute ${t} from ${e}`)}}}async waitForElement(e,t){this.ensureSession();try{let r=await this.vibeInstance.find(e,{timeout:t?.timeout??this.config.timeout});return{success:!0,value:{selector:e,tagName:r.info.tag,textContent:r.info.text,attributes:{},boundingBox:r.info.box,visible:!0,enabled:!0}}}catch(r){return{success:!1,error:new f(`Element ${e} not found within timeout`,r instanceof Error?r:void 0)}}}async screenshot(e){if(this.ensureSession(),!C())return{success:!1,error:new m("Screenshot capture is disabled by feature flags")};try{let t=await this.vibeInstance.screenshot(),r=t.toString("base64");return e?.path&&await(await import("fs/promises")).writeFile(e.path,t),{success:!0,value:{base64:e?.path?void 0:r,path:e?.path,format:e?.format??"png",dimensions:this.config.viewport,sizeBytes:t.length,capturedAt:new Date}}}catch(t){return{success:!1,error:new m("Failed to capture screenshot",t instanceof Error?t:void 0)}}}async compareScreenshots(e,t,r=.01){try{let s=await import("fs/promises"),n=await s.readFile(e),u=await s.readFile(t),d=n.equals(u);return{success:!0,value:{matches:d,differencePercent:d?0:100,diffRegions:[],comparedAt:new Date}}}catch(s){return{success:!1,error:a(s,"Failed to compare screenshots")}}}async evaluate(e,t){this.ensureSession();try{return{success:!0,value:await this.vibeInstance.evaluate(e)}}catch(r){return{success:!1,error:a(r,"Failed to evaluate script")}}}async checkAccessibility(e){return this.ensureSession(),{success:!1,error:new o("Use axe-core-integration module for accessibility testing. Call injectAxeCore() then runAxeAudit() using client.evaluate().","USE_AXE_CORE_INTEGRATION")}}async initialize(){await V(),this._initialized=!0}async dispose(){if(this.vibeInstance){try{await this.vibeInstance.quit()}catch(e){console.debug("[VibiumClient] Disposal error:",e instanceof Error?e.message:e)}this.vibeInstance=null}this.currentSession=null,this._initialized=!1,this._available=null}ensureSession(){if(!this.vibeInstance)throw new l("No active browser session. Call launch() first.")}generateSessionId(){return`vibium-session-${Date.now()}-${_().slice(0,9)}`}},N=class i{static instance=null;client=null;config;constructor(e={}){this.config=e}static getInstance(e){return i.instance||(i.instance=new i(e)),i.instance}static resetInstance(){i.instance?.client&&i.instance.client.dispose(),i.instance=null}async getClient(){return this.client||(this.client=new E(this.config),await this.client.initialize()),this.client}getClientSync(){return this.client||(this.client=new E(this.config)),this.client}getConfig(){return{...this.config}}configure(e){this.config={...this.config,...e},this.client&&(this.client.dispose(),this.client=null)}async dispose(){this.client&&(await this.client.dispose(),this.client=null)}}});export{S as a,A as b,E as c,N as d,M as e};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a as e,c as r,d as g,g as t}from"./chunk-FBMN7B46.js";import{b as o}from"./chunk-64VGZQLB.js";var L=o(()=>{"use strict";e();g();t();r()});export{L as a};
|
|
@@ -1,65 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{d as W,e as V,g as ae,h as X}from"./chunk-7D3V65N5.js";import{a as ce}from"./chunk-YFBSPLJG.js";import{c as qe}from"./chunk-Y3LZ35OG.js";import{a as oe,b as He,d as Le,f as ht}from"./chunk-JVNTSNWU.js";import{c as G,e as ke,f as Ue}from"./chunk-SMDN3BQZ.js";import{a as le}from"./chunk-6U7LNMWZ.js";import{c as Me,n as C,o as j}from"./chunk-2TMWAQQ3.js";import{b as Ne,c as ut}from"./chunk-SDRHUMJB.js";import{c as b,d as v}from"./chunk-KNNISEDY.js";import{a as w,b as Oe,c as _e}from"./chunk-MJS53PRX.js";import{i as O}from"./chunk-DPYSUDAO.js";import{B as $,D as L,G as se,P as k,S as _,b as F}from"./chunk-DUYOVM5I.js";import{c as B,e as dt}from"./chunk-64VGZQLB.js";var Z=B(R=>{var Pt=R&&R.__extends||(function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)i.hasOwnProperty(s)&&(r[s]=i[s])},n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})();Object.defineProperty(R,"__esModule",{value:!0});var bt=Object.prototype.hasOwnProperty;function ge(n,e){return bt.call(n,e)}R.hasOwnProperty=ge;function Xe(n){if(Array.isArray(n)){for(var e=new Array(n.length),t=0;t<e.length;t++)e[t]=""+t;return e}if(Object.keys)return Object.keys(n);var r=[];for(var i in n)ge(n,i)&&r.push(i);return r}R._objectKeys=Xe;function Et(n){switch(typeof n){case"object":return JSON.parse(JSON.stringify(n));case"undefined":return null;default:return n}}R._deepClone=Et;function Rt(n){for(var e=0,t=n.length,r;e<t;){if(r=n.charCodeAt(e),r>=48&&r<=57){e++;continue}return!1}return!0}R.isInteger=Rt;function me(n){return n.indexOf("/")===-1&&n.indexOf("~")===-1?n:n.replace(/~/g,"~0").replace(/\//g,"~1")}R.escapePathComponent=me;function At(n){return n.replace(/~1/g,"/").replace(/~0/g,"~")}R.unescapePathComponent=At;function ye(n,e){var t;for(var r in n)if(ge(n,r)){if(n[r]===e)return me(r)+"/";if(typeof n[r]=="object"&&(t=ye(n[r],e),t!=""))return me(r)+"/"+t}return""}R._getPathRecursive=ye;function Tt(n,e){if(n===e)return"/";var t=ye(n,e);if(t==="")throw new Error("Object not found in root");return"/"+t}R.getPath=Tt;function pe(n){if(n===void 0)return!0;if(n){if(Array.isArray(n)){for(var e=0,t=n.length;e<t;e++)if(pe(n[e]))return!0}else if(typeof n=="object"){for(var r=Xe(n),i=r.length,s=0;s<i;s++)if(pe(n[r[s]]))return!0}}return!1}R.hasUndefined=pe;function Ve(n,e){var t=[n];for(var r in e){var i=typeof e[r]=="object"?JSON.stringify(e[r],null,2):e[r];typeof i<"u"&&t.push(r+": "+i)}return t.join(`
|
|
3
|
-
`)}var Ct=(function(n){Pt(e,n);function e(t,r,i,s,a){var l=this.constructor,d=n.call(this,Ve(t,{name:r,index:i,operation:s,tree:a}))||this;return d.name=r,d.index=i,d.operation=s,d.tree=a,Object.setPrototypeOf(d,l.prototype),d.message=Ve(t,{name:r,index:i,operation:s,tree:a}),d}return e})(Error);R.PatchError=Ct});var ve=B(y=>{Object.defineProperty(y,"__esModule",{value:!0});var T=Z();y.JsonPatchError=T.PatchError;y.deepClone=T._deepClone;var U={add:function(n,e,t){return n[e]=this.value,{newDocument:t}},remove:function(n,e,t){var r=n[e];return delete n[e],{newDocument:t,removed:r}},replace:function(n,e,t){var r=n[e];return n[e]=this.value,{newDocument:t,removed:r}},move:function(n,e,t){var r=ee(t,this.path);r&&(r=T._deepClone(r));var i=N(t,{op:"remove",path:this.from}).removed;return N(t,{op:"add",path:this.path,value:i}),{newDocument:t,removed:r}},copy:function(n,e,t){var r=ee(t,this.from);return N(t,{op:"add",path:this.path,value:T._deepClone(r)}),{newDocument:t}},test:function(n,e,t){return{newDocument:t,test:J(n[e],this.value)}},_get:function(n,e,t){return this.value=n[e],{newDocument:t}}},xt={add:function(n,e,t){return T.isInteger(e)?n.splice(e,0,this.value):n[e]=this.value,{newDocument:t,index:e}},remove:function(n,e,t){var r=n.splice(e,1);return{newDocument:t,removed:r[0]}},replace:function(n,e,t){var r=n[e];return n[e]=this.value,{newDocument:t,removed:r}},move:U.move,copy:U.copy,test:U.test,_get:U._get};function ee(n,e){if(e=="")return n;var t={op:"_get",path:e};return N(n,t),t.value}y.getValueByPointer=ee;function N(n,e,t,r,i,s){if(t===void 0&&(t=!1),r===void 0&&(r=!0),i===void 0&&(i=!0),s===void 0&&(s=0),t&&(typeof t=="function"?t(e,0,n,e.path):te(e,0)),e.path===""){var a={newDocument:n};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=n,a;if(e.op==="move"||e.op==="copy")return a.newDocument=ee(n,e.from),e.op==="move"&&(a.removed=n),a;if(e.op==="test"){if(a.test=J(n,e.value),a.test===!1)throw new y.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",s,e,n);return a.newDocument=n,a}else{if(e.op==="remove")return a.removed=n,a.newDocument=null,a;if(e.op==="_get")return e.value=n,a;if(t)throw new y.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,e,n);return a}}else{r||(n=T._deepClone(n));var l=e.path||"",d=l.split("/"),o=n,c=1,h=d.length,m=void 0,u=void 0,f=void 0;for(typeof t=="function"?f=t:f=te;;){if(u=d[c],u&&u.indexOf("~")!=-1&&(u=T.unescapePathComponent(u)),i&&(u=="__proto__"||u=="prototype"&&c>0&&d[c-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(t&&m===void 0&&(o[u]===void 0?m=d.slice(0,c).join("/"):c==h-1&&(m=e.path),m!==void 0&&f(e,0,n,m)),c++,Array.isArray(o)){if(u==="-")u=o.length;else{if(t&&!T.isInteger(u))throw new y.JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,e,n);T.isInteger(u)&&(u=~~u)}if(c>=h){if(t&&e.op==="add"&&u>o.length)throw new y.JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,e,n);var a=xt[e.op].call(e,o,u,n);if(a.test===!1)throw new y.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",s,e,n);return a}}else if(c>=h){var a=U[e.op].call(e,o,u,n);if(a.test===!1)throw new y.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",s,e,n);return a}if(o=o[u],t&&c<h&&(!o||typeof o!="object"))throw new y.JsonPatchError("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,e,n)}}}y.applyOperation=N;function Ge(n,e,t,r,i){if(r===void 0&&(r=!0),i===void 0&&(i=!0),t&&!Array.isArray(e))throw new y.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(n=T._deepClone(n));for(var s=new Array(e.length),a=0,l=e.length;a<l;a++)s[a]=N(n,e[a],t,!0,i,a),n=s[a].newDocument;return s.newDocument=n,s}y.applyPatch=Ge;function It(n,e,t){var r=N(n,e);if(r.test===!1)throw new y.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",t,e,n);return r.newDocument}y.applyReducer=It;function te(n,e,t,r){if(typeof n!="object"||n===null||Array.isArray(n))throw new y.JsonPatchError("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,n,t);if(U[n.op]){if(typeof n.path!="string")throw new y.JsonPatchError("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,n,t);if(n.path.indexOf("/")!==0&&n.path.length>0)throw new y.JsonPatchError('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,n,t);if((n.op==="move"||n.op==="copy")&&typeof n.from!="string")throw new y.JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,n,t);if((n.op==="add"||n.op==="replace"||n.op==="test")&&n.value===void 0)throw new y.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,n,t);if((n.op==="add"||n.op==="replace"||n.op==="test")&&T.hasUndefined(n.value))throw new y.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,n,t);if(t){if(n.op=="add"){var i=n.path.split("/").length,s=r.split("/").length;if(i!==s+1&&i!==s)throw new y.JsonPatchError("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,n,t)}else if(n.op==="replace"||n.op==="remove"||n.op==="_get"){if(n.path!==r)throw new y.JsonPatchError("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,n,t)}else if(n.op==="move"||n.op==="copy"){var a={op:"_get",path:n.from,value:void 0},l=Ye([a],t);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new y.JsonPatchError("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,n,t)}}}else throw new y.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,n,t)}y.validator=te;function Ye(n,e,t){try{if(!Array.isArray(n))throw new y.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)Ge(T._deepClone(e),T._deepClone(n),t||!0);else{t=t||te;for(var r=0;r<n.length;r++)t(n[r],r,e,void 0)}}catch(i){if(i instanceof y.JsonPatchError)return i;throw i}}y.validate=Ye;function J(n,e){if(n===e)return!0;if(n&&e&&typeof n=="object"&&typeof e=="object"){var t=Array.isArray(n),r=Array.isArray(e),i,s,a;if(t&&r){if(s=n.length,s!=e.length)return!1;for(i=s;i--!==0;)if(!J(n[i],e[i]))return!1;return!0}if(t!=r)return!1;var l=Object.keys(n);if(s=l.length,s!==Object.keys(e).length)return!1;for(i=s;i--!==0;)if(!e.hasOwnProperty(l[i]))return!1;for(i=s;i--!==0;)if(a=l[i],!J(n[a],e[a]))return!1;return!0}return n!==n&&e!==e}y._areEquals=J});var Ke=B(q=>{Object.defineProperty(q,"__esModule",{value:!0});var E=Z(),Dt=ve(),we=new WeakMap,Ft=(function(){function n(e){this.observers=new Map,this.obj=e}return n})(),Ot=(function(){function n(e,t){this.callback=e,this.observer=t}return n})();function _t(n){return we.get(n)}function Nt(n,e){return n.observers.get(e)}function Mt(n,e){n.observers.delete(e.callback)}function Ht(n,e){e.unobserve()}q.unobserve=Ht;function Lt(n,e){var t=[],r,i=_t(n);if(!i)i=new Ft(n),we.set(n,i);else{var s=Nt(i,e);r=s&&s.observer}if(r)return r;if(r={},i.value=E._deepClone(n),e){r.callback=e,r.next=null;var a=function(){Se(r)},l=function(){clearTimeout(r.next),r.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",l),window.addEventListener("keyup",l),window.addEventListener("mousedown",l),window.addEventListener("keydown",l),window.addEventListener("change",l))}return r.patches=t,r.object=n,r.unobserve=function(){Se(r),clearTimeout(r.next),Mt(i,r),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},i.observers.set(e,new Ot(e,r)),r}q.observe=Lt;function Se(n,e){e===void 0&&(e=!1);var t=we.get(n.object);Pe(t.value,n.object,n.patches,"",e),n.patches.length&&Dt.applyPatch(t.value,n.patches);var r=n.patches;return r.length>0&&(n.patches=[],n.callback&&n.callback(r)),r}q.generate=Se;function Pe(n,e,t,r,i){if(e!==n){typeof e.toJSON=="function"&&(e=e.toJSON());for(var s=E._objectKeys(e),a=E._objectKeys(n),l=!1,d=!1,o=a.length-1;o>=0;o--){var c=a[o],h=n[c];if(E.hasOwnProperty(e,c)&&!(e[c]===void 0&&h!==void 0&&Array.isArray(e)===!1)){var m=e[c];typeof h=="object"&&h!=null&&typeof m=="object"&&m!=null&&Array.isArray(h)===Array.isArray(m)?Pe(h,m,t,r+"/"+E.escapePathComponent(c),i):h!==m&&(l=!0,i&&t.push({op:"test",path:r+"/"+E.escapePathComponent(c),value:E._deepClone(h)}),t.push({op:"replace",path:r+"/"+E.escapePathComponent(c),value:E._deepClone(m)}))}else Array.isArray(n)===Array.isArray(e)?(i&&t.push({op:"test",path:r+"/"+E.escapePathComponent(c),value:E._deepClone(h)}),t.push({op:"remove",path:r+"/"+E.escapePathComponent(c)}),d=!0):(i&&t.push({op:"test",path:r,value:n}),t.push({op:"replace",path:r,value:e}),l=!0)}if(!(!d&&s.length==a.length))for(var o=0;o<s.length;o++){var c=s[o];!E.hasOwnProperty(n,c)&&e[c]!==void 0&&t.push({op:"add",path:r+"/"+E.escapePathComponent(c),value:E._deepClone(e[c])})}}}function kt(n,e,t){t===void 0&&(t=!1);var r=[];return Pe(n,e,r,"",t),r}q.compare=kt});var Ze=B(M=>{var Ut=ve();Object.assign(M,Ut);var qt=Ke();Object.assign(M,qt);var re=Z();M.JsonPatchError=re.PatchError;M.deepClone=re._deepClone;M.escapePathComponent=re.escapePathComponent;M.unescapePathComponent=re.unescapePathComponent});var A=class extends Error{patternId;disposition;cause;constructor(e,t,r){super(`${t}: pattern ${e}: ${r instanceof Error?r.message:String(r)}`),this.name="PatternMutationError",this.patternId=e,this.disposition=t,this.cause=r}};ut();import{existsSync as Yt}from"node:fs";import{join as ot}from"node:path";_e();var z=class{constructor(e,t){this.createAdapter=e;this.config=t?.base??Y,this.rvfPath=t?.rvfPath??".agentic-qe/patterns.rvf",this.skipCloseOnDispose=t?.skipCloseOnDispose??!1,this.embeddingSpaceId=t?.embeddingSpaceId}createAdapter;config;rvfPath;skipCloseOnDispose;embeddingSpaceId;adapter=null;sqliteStore=null;initialized=!1;rvfInitError=null;searchOps=0;totalSearchMs=0;setSqliteStore(e){this.sqliteStore=e}getAdapter(){return this.adapter}async initialize(){if(!this.initialized){if(this.rvfInitError=null,process.env.AQE_MEMORY_BACKEND==="memory"){this.adapter=null,this.initialized=!0;return}try{!this.embeddingSpaceId&&!C()&&await j(),this.adapter=this.createAdapter(this.rvfPath,this.config.embeddingDimension);let e=C()?.spaceId??this.embeddingSpaceId??null;Me(this.rvfPath,e,this.adapter.status()?.totalVectors??0),this.initialized=!0,console.log(`[RvfPatternStore] Initialized: ${this.rvfPath} (dim=${this.config.embeddingDimension})`)}catch(e){this.rvfInitError=w(e);try{this.adapter?.close()}catch{}console.error(`[RvfPatternStore] ERROR: RVF initialization failed \u2014 vector search is DISABLED. Cause: ${this.rvfInitError}. Fix: check the embedder endpoint and @ruvector/rvf-node binding, or set RUVECTOR_USE_RVF_PATTERN_STORE=false to use SQLite HNSW.`),this.adapter=null,this.initialized=!0}if(!this.sqliteStore)try{let{createSQLitePatternStore:e}=await import("./sqlite-persistence-75VHKKQB.js"),t=e();await t.initialize(),this.sqliteStore=t}catch{}await this.purgeOrphanedVectors()}}async purgeOrphanedVectors(){if(!(!this.adapter||!this.sqliteStore))try{let e=this.adapter.status()?.totalVectors??0,t=this.sqliteStore.getStats()?.totalPatterns??0;if(e<=t)return;let{readFileSync:r,existsSync:i}=await import("node:fs"),s=`${this.rvfPath}.idmap.json`;if(!i(s))return;let a=JSON.parse(r(s,"utf-8")),l=new Set((a.entries??[]).map(c=>Array.isArray(c)?c[0]:void 0).filter(c=>typeof c=="string")),d=new Set(this.sqliteStore.getPatterns({limit:1e4}).map(c=>c.id)),o=[...l].filter(c=>!d.has(c));if(o.length===0)return;this.adapter.delete(o),console.log(`[RvfPatternStore] Removed ${o.length} ghost vectors (index ${e} > DB ${t})`)}catch(e){console.warn(`[RvfPatternStore] orphan purge skipped: ${w(e)}`)}}async dispose(){if(this.adapter&&!this.skipCloseOnDispose)try{this.adapter.close()}catch{}this.adapter=null,this.initialized=!1}async store(e){await this.ensureInitialized();let t=X(e);if(!t.valid)return v(new Error(`Invalid pattern: ${t.errors.join(", ")}`));if(e.confidence<this.config.minConfidence)return v(new Error(`Pattern confidence ${e.confidence} below threshold ${this.config.minConfidence}`));if(!this.sqliteStore)return v(new A(e.id,"FAILED",new Error("authoritative SQLite pattern store is unavailable")));let r=C()?.spaceId??this.embeddingSpaceId;if(e.embedding&&!r)return v(new Error("VECTOR_SPACE_UNVERIFIED: refusing to persist or index an embedding without runtime provenance"));let i=!1;if(this.sqliteStore)try{let s=this.sqliteStore.storePattern(e,e.embedding,r);s&&s!==e.id&&(e.id=s),i=!0}catch(s){return v(new A(e.id,"FAILED",s))}if(e.embedding&&!this.adapter&&this.rvfInitError)return v(new A(e.id,i?"COMMITTED_PENDING_INDEX":"FAILED",new Error(`RVF unavailable ${i?"after":"before"} authoritative pattern commit: ${this.rvfInitError}`)));if(e.embedding&&this.adapter)try{let s=e.embedding instanceof Float32Array?e.embedding:new Float32Array(e.embedding),a=this.adapter.ingest([{id:e.id,vector:s}]);if(a.accepted!==1||a.rejected!==0)throw new Error(`RVF rejected pattern vector (accepted=${a.accepted}, rejected=${a.rejected})`)}catch(s){return v(new A(e.id,i?"COMMITTED_PENDING_INDEX":"FAILED",s))}return b(e.id)}async create(e){let t=e.confidence??.5,r=e.qeDomain??"test-generation",i={id:O(),patternType:e.patternType,qeDomain:r,domain:r,name:e.name,description:e.description,confidence:t,usageCount:0,successRate:0,qualityScore:W({confidence:t,usageCount:0,successRate:0}),context:{tags:[],...e.context},template:{example:"",...e.template},embedding:e.embedding,tier:"short-term",createdAt:new Date,lastUsedAt:new Date,successfulUses:0,reusable:!1,reuseCount:0,averageTokenSavings:0},s=await this.store(i);return s.success?b(i):v(s.error)}async get(e){if(this.sqliteStore)try{return this.sqliteStore.getPattern(e)??null}catch{return null}return null}async search(e,t={}){await this.ensureInitialized();let r=performance.now(),i=t.limit??10,s=[];if(Array.isArray(e)){let d=C()?.spaceId??this.embeddingSpaceId;if(!d||t.embeddingSpaceId!==d)return v(new Error("VECTOR_SPACE_UNVERIFIED: pre-computed query vectors require the active embeddingSpaceId"))}if(Array.isArray(e)&&this.adapter)try{let d=e instanceof Float32Array?e:new Float32Array(e),o=this.adapter.search(d,i*2);for(let c of o){let h=await this.get(c.id);if(h&&this.matchesFilters(h,t)){let m=this.calculateReuseInfo(h,c.score);s.push({pattern:h,score:c.score,matchType:"vector",similarity:c.score,canReuse:m.canReuse,estimatedTokenSavings:m.estimatedTokenSavings,reuseConfidence:m.reuseConfidence})}}}catch(d){console.warn("[RvfPatternStore] RVF search failed:",w(d))}if(Array.isArray(e)&&!this.adapter&&this.sqliteStore&&s.length===0)try{let d=this.sqliteStore.getPatterns({limit:i*4}),o=e,c=Math.sqrt(o.reduce((h,m)=>h+m*m,0));if(c>0)for(let h of d){if(!this.matchesFilters(h,t))continue;let m=this.sqliteStore.getPattern(h.id),u=m?.embedding;if(!u||u.length!==o.length)continue;let f=0,g=0;for(let P=0;P<o.length;P++)f+=o[P]*u[P],g+=u[P]*u[P];if(g=Math.sqrt(g),g===0)continue;let p=f/(c*g),S=this.calculateReuseInfo(m,p);s.push({pattern:m,score:p,matchType:"vector",similarity:p,canReuse:S.canReuse,estimatedTokenSavings:S.estimatedTokenSavings,reuseConfidence:S.reuseConfidence})}}catch{}if(typeof e=="string"&&!e.trim()&&this.sqliteStore)try{let d=this.sqliteStore.getPatterns({limit:i*2}),o=new Set(s.map(c=>c.pattern.id));for(let c of d){if(o.has(c.id)||!this.matchesFilters(c,t))continue;let h=this.calculateReuseInfo(c,c.confidence);s.push({pattern:c,score:c.confidence,matchType:"exact",similarity:c.confidence,canReuse:h.canReuse,estimatedTokenSavings:h.estimatedTokenSavings,reuseConfidence:h.reuseConfidence})}}catch{}let a=typeof e=="string"?e:t.textQuery;if(a?.trim()&&this.sqliteStore)try{let d=this.sqliteStore.searchFTS(a,i*2),o=new Set(s.map(h=>h.pattern.id)),c=new Map(d.map(h=>[h.id,h.ftsScore]));for(let h of s){let m=c.get(h.pattern.id);m!==void 0&&(h.score=de(h.score,m))}for(let h of d){if(o.has(h.id))continue;let m=await this.get(h.id);if(m&&this.matchesFilters(m,t)){let u=.5*h.ftsScore*h.coverage,f=h.phrase?h.ftsScore:u,g=this.calculateReuseInfo(m,f);s.push({pattern:m,score:u,matchType:"exact",similarity:f,canReuse:g.canReuse,estimatedTokenSavings:g.estimatedTokenSavings,reuseConfidence:g.reuseConfidence})}}}catch{}s.sort((d,o)=>o.score-d.score);let l=performance.now()-r;return this.searchOps++,this.totalSearchMs+=l,b(s.slice(0,i))}async recordUsage(e,t,r,i){if(!this.sqliteStore)return v(new Error("No SQLite store attached"));try{return this.sqliteStore.recordUsage(e,t,r,i),b(void 0)}catch(s){return v(new Error(`recordUsage failed: ${w(s)}`))}}async promote(e){if(!this.sqliteStore)return v(new Error("No SQLite store attached"));try{return this.sqliteStore.promotePattern(e),b(void 0)}catch(t){return v(new Error(`promote failed: ${w(t)}`))}}async delete(e){if(this.adapter)try{this.adapter.delete([e])}catch(t){console.warn(`[RvfPatternStore] RVF delete failed for ${e}:`,w(t))}if(this.sqliteStore)try{this.sqliteStore.deletePattern(e)}catch(t){return v(new Error(`SQLite delete failed: ${w(t)}`))}return b(void 0)}async getStats(){let e=this.adapter?.status(),t=0,r={},i={shortTerm:0,longTerm:0};if(this.sqliteStore)try{let s=this.sqliteStore.getStats();t=s.totalPatterns,r=s.byDomain,i={shortTerm:s.byTier["short-term"]??0,longTerm:s.byTier["long-term"]??0}}catch{}return{totalPatterns:t,byTier:i,byDomain:r,byType:{},avgConfidence:0,avgQualityScore:0,avgSuccessRate:0,searchOperations:this.searchOps,avgSearchLatencyMs:this.searchOps>0?this.totalSearchMs/this.searchOps:0,hnswStats:{nativeAvailable:this.adapter!==null,vectorCount:e?.totalVectors??0,indexSizeBytes:e?.fileSizeBytes??0,...this.rvfInitError?{rvfInitError:this.rvfInitError}:{}}}}async cleanup(){if(!this.sqliteStore)return{removed:0,promoted:0};let e=0,t=0;try{let r=this.sqliteStore.getPatterns({limit:1e4});for(let i of r)i.confidence<this.config.minConfidence&&i.usageCount>3?(await this.delete(i.id),e++):i.tier==="short-term"&&i.successfulUses>=V&&(await this.promote(i.id),t++)}catch(r){console.warn("[RvfPatternStore] Cleanup error:",w(r))}return{removed:e,promoted:t}}async ensureInitialized(){this.initialized||await this.initialize()}matchesFilters(e,t){return!(t.patternType&&e.patternType!==t.patternType||t.domain&&e.qeDomain!==t.domain||t.tier&&e.tier!==t.tier||t.minConfidence&&e.confidence<t.minConfidence||t.minQualityScore&&e.qualityScore<t.minQualityScore)}calculateReuseInfo(e,t){let r=this.config.reuseOptimization,i=r.enabled&&t>=r.minSimilarityForReuse&&e.successRate>=r.minSuccessRateForReuse;return{canReuse:i,estimatedTokenSavings:i?500:0,reuseConfidence:i?t*e.successRate:0}}};ht();_e();_();function mt(n,e){let r=[n.pattern,n];for(let i of r){let s=e.split("."),a=i;for(let l of s){if(a==null)break;if(typeof a=="object")a=a[l];else{a=void 0;break}}if(a!==void 0)return a}}function pt(n,e,t){switch(e){case"eq":return n===t;case"gt":return typeof n=="number"&&typeof t=="number"&&n>t;case"lt":return typeof n=="number"&&typeof t=="number"&&n<t;case"gte":return typeof n=="number"&&typeof t=="number"&&n>=t;case"lte":return typeof n=="number"&&typeof t=="number"&&n<=t;case"in":return Array.isArray(t)?t.includes(n):!1;case"contains":return Array.isArray(n)||typeof n=="string"&&typeof t=="string"?n.includes(t):!1;case"between":{if(typeof n!="number"||!Array.isArray(t)||t.length!==2){if(n instanceof Date&&Array.isArray(t)&&t.length===2){let s=n.getTime(),a=t[0]instanceof Date?t[0].getTime():Number(t[0]),l=t[1]instanceof Date?t[1].getTime():Number(t[1]);return s>=a&&s<=l}return!1}let[r,i]=t;return n>=r&&n<=i}default:return!1}}function K(n,e){switch(e.type){case"AND":return(e.children??[]).every(r=>K(n,r));case"OR":{let t=e.children??[];return t.length===0?!0:t.some(r=>K(n,r))}case"NOT":return e.child?!K(n,e.child):!0;case"FIELD":{if(!e.field||!e.operator)return!0;let t=mt(n,e.field);return pt(t,e.operator,e.value)}default:return!0}}function Qe(n,e){return e?n.filter(t=>K(t,e)):n}_();_();var ze=1e4,Je=2166136261;function Be(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}var fe=new Uint8Array(256);for(let n=0;n<256;n++){let e=0,t=n;for(;t;)e++,t&=t-1;fe[n]=e}var $e="0123456789abcdef";function gt(n){let e=Math.min(n.length,16),t="";for(let r=0;r<e;r++){let i=n[r];t+=$e[i>>4]+$e[i&15]}return t}function yt(n,e){if(n.length!==e.length)throw new Error(`Cannot bind vectors of different lengths: ${n.length} vs ${e.length}`);let t=new Uint8Array(n.length);for(let r=0;r<n.length;r++)t[r]=n[r]^e[r];return t}function vt(n){if(n.length===0)throw new Error("Cannot bundle zero vectors");let e=n[0].length;for(let i=1;i<n.length;i++)if(n[i].length!==e)throw new Error(`Vector length mismatch at index ${i}: expected ${e}, got ${n[i].length}`);let t=new Uint8Array(e),r=n.length/2;for(let i=0;i<e;i++){let s=0;for(let a=0;a<8;a++){let l=0,d=1<<a;for(let o=0;o<n.length;o++)n[o][i]&d&&l++;l>=r&&(s|=d)}t[i]=s}return t}function St(n,e,t){if(n.length!==e.length)throw new Error(`Cannot compute Hamming distance for vectors of different lengths: ${n.length} vs ${e.length}`);let r=0;for(let s=0;s<n.length;s++)r+=fe[n[s]^e[s]];let i=t??n.length*8;return i>0?r/i:0}function wt(n,e,t){return 1-St(n,e,t)}var ue=class{dimensions;baseSeed;byteLen;tokenCache=new Map;constructor(e){if(this.dimensions=e?.dimensions??ze,this.baseSeed=e?.seed??Je,this.byteLen=Math.ceil(this.dimensions/8),this.dimensions<=0)throw new Error(`HDC dimensions must be positive, got ${this.dimensions}`)}tokenToHypervector(e){let t=this.tokenCache.get(e);if(t)return new Uint8Array(t);let r=Be(e)^this.baseSeed,i=this.generateSeededVector(r);return this.tokenCache.set(e,i),new Uint8Array(i)}fingerprintPattern(e){if(e.length===0)return new Uint8Array(this.byteLen);let t=this.tokenToHypervector(e[0]);for(let r=1;r<e.length;r++)t=yt(t,this.tokenToHypervector(e[r]));return t}fingerprintWithContext(e,t){let r=this.fingerprintPattern(e);if(t.length===0)return r;let i=this.fingerprintPattern(t);return vt([r,i])}similarity(e,t){return wt(e,t,this.dimensions)}generateSeededVector(e){let t=new Uint8Array(this.byteLen),r=new ce(e),i=0;for(;i<this.byteLen;){let a=r.next(),l=Math.min(4,this.byteLen-i);for(let d=0;d<l;d++)t[i++]=a>>>d*8&255}let s=this.dimensions%8;return s>0&&(t[this.byteLen-1]&=(1<<s)-1),t}},he=class{dimensions;baseSeed;constructor(e){if(this.dimensions=e?.dimensions??ze,this.baseSeed=e?.seed??Je,this.dimensions<=0)throw new Error(`HDC dimensions must be positive, got ${this.dimensions}`)}fingerprint(e){let t=`${e.id}|${e.domain}|${e.type}|${e.content??""}`,r=Be(t)^this.baseSeed,i=this.generateVector(r);return{vector:i,dimensions:this.dimensions,hash:gt(i)}}compositionalBind(e,t){if(e.length!==t.length)throw new Error(`Cannot bind vectors of different lengths: ${e.length} vs ${t.length}`);let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e[i]^t[i];return r}hammingDistance(e,t){if(e.length!==t.length)throw new Error(`Cannot compute Hamming distance for vectors of different lengths: ${e.length} vs ${t.length}`);let r=0;for(let i=0;i<e.length;i++)r+=fe[e[i]^t[i]];return r}similarity(e,t){return 1-this.hammingDistance(e,t)/this.dimensions}batchFingerprint(e){return e.map(t=>this.fingerprint(t))}generateVector(e){let t=Math.ceil(this.dimensions/8),r=new Uint8Array(t),i=new ce(e),s=0;for(;s<t;){let l=i.next(),d=t-s,o=d<4?d:4;for(let c=0;c<o;c++)r[s++]=l>>>c*8&255}let a=this.dimensions%8;return a>0&&(r[t-1]&=(1<<a)-1),r}};function je(n){return new he(n)}function We(n){return $()?new ue(n):null}var Ee=dt(Ze(),1),be=Ee.default??Ee,Qt=`
|
|
4
|
-
CREATE TABLE IF NOT EXISTS pattern_deltas (
|
|
5
|
-
id TEXT PRIMARY KEY,
|
|
6
|
-
pattern_id TEXT NOT NULL,
|
|
7
|
-
version INTEGER NOT NULL,
|
|
8
|
-
timestamp INTEGER NOT NULL,
|
|
9
|
-
type TEXT NOT NULL CHECK (type IN ('genesis', 'update', 'rollback')),
|
|
10
|
-
patch TEXT NOT NULL DEFAULT '[]',
|
|
11
|
-
reverse_patch TEXT NOT NULL DEFAULT '[]',
|
|
12
|
-
metadata TEXT
|
|
13
|
-
);
|
|
14
|
-
CREATE INDEX IF NOT EXISTS idx_pattern_deltas_pid_version
|
|
15
|
-
ON pattern_deltas (pattern_id, version);
|
|
16
|
-
CREATE INDEX IF NOT EXISTS idx_pattern_deltas_timestamp
|
|
17
|
-
ON pattern_deltas (timestamp);
|
|
18
|
-
`;function et(n,e){let t=be.compare(n,e),r=be.compare(e,n);return{forward:t,reverse:r}}function $t(n,e){let t=JSON.parse(JSON.stringify(n));return be.applyPatch(t,e).newDocument}function tt(n){return{id:n.id,patternId:n.pattern_id,version:n.version,timestamp:n.timestamp,type:n.type,patch:JSON.parse(n.patch),reversePatch:JSON.parse(n.reverse_patch),metadata:n.metadata?JSON.parse(n.metadata):void 0}}var ne=class{db;config;prepared=new Map;initialized=!1;constructor(e,t){this.db=e,this.config={maxVersionsPerPattern:t?.maxVersionsPerPattern??100,compressDeltas:t?.compressDeltas??!1}}initialize(){this.initialized||(this.db.exec(Qt),this.prepareStatements(),this.initialized=!0)}prepareStatements(){this.prepared.set("insert",this.db.prepare(`
|
|
19
|
-
INSERT INTO pattern_deltas (id, pattern_id, version, timestamp, type, patch, reverse_patch, metadata)
|
|
20
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
21
|
-
`)),this.prepared.set("getHistory",this.db.prepare(`
|
|
22
|
-
SELECT * FROM pattern_deltas
|
|
23
|
-
WHERE pattern_id = ?
|
|
24
|
-
ORDER BY version ASC
|
|
25
|
-
`)),this.prepared.set("currentVersion",this.db.prepare(`
|
|
26
|
-
SELECT MAX(version) as max_version FROM pattern_deltas
|
|
27
|
-
WHERE pattern_id = ?
|
|
28
|
-
`)),this.prepared.set("incrementalSync",this.db.prepare(`
|
|
29
|
-
SELECT * FROM pattern_deltas
|
|
30
|
-
WHERE timestamp > ?
|
|
31
|
-
ORDER BY timestamp ASC
|
|
32
|
-
`)),this.prepared.set("countForPattern",this.db.prepare(`
|
|
33
|
-
SELECT COUNT(*) as cnt FROM pattern_deltas
|
|
34
|
-
WHERE pattern_id = ?
|
|
35
|
-
`)),this.prepared.set("deleteOldest",this.db.prepare(`
|
|
36
|
-
DELETE FROM pattern_deltas
|
|
37
|
-
WHERE pattern_id = ? AND version IN (
|
|
38
|
-
SELECT version FROM pattern_deltas
|
|
39
|
-
WHERE pattern_id = ?
|
|
40
|
-
ORDER BY version ASC
|
|
41
|
-
LIMIT ?
|
|
42
|
-
)
|
|
43
|
-
`))}ensureInitialized(){if(!this.initialized)throw new Error("DeltaTracker not initialized. Call initialize() first.")}createGenesis(e,t,r){this.ensureInitialized();let i=this.getCurrentVersion(e);if(i>=0)throw new Error(`Genesis already exists for pattern ${e} (current version: ${i})`);let s={id:O(),patternId:e,version:0,timestamp:Date.now(),type:"genesis",patch:[],reversePatch:[],metadata:{...r,snapshot:t}};return this.insertEvent(s),s}recordDelta(e,t,r,i){this.ensureInitialized();let s=this.getCurrentVersion(e);if(s<0)throw new Error(`No genesis found for pattern ${e}. Call createGenesis() first.`);let{forward:a,reverse:l}=et(t,r),d={id:O(),patternId:e,version:s+1,timestamp:Date.now(),type:"update",patch:a,reversePatch:l,metadata:i};return this.insertEvent(d),this.enforceRetention(e),d}rollback(e,t){this.ensureInitialized();let r=this.getHistory(e);if(r.length===0)throw new Error(`No history found for pattern ${e}`);let i=r[r.length-1].version;if(t<0||t>i)throw new Error(`Invalid rollback version ${t}. Valid range: 0-${i}`);if(t===i)return this.reconstructState(r,i);let s=this.reconstructState(r,t),a=this.reconstructState(r,i),{forward:l,reverse:d}=et(a,s),o={id:O(),patternId:e,version:i+1,timestamp:Date.now(),type:"rollback",patch:l,reversePatch:d,metadata:{rolledBackTo:t}};return this.insertEvent(o),this.enforceRetention(e),s}getHistory(e){return this.ensureInitialized(),this.prepared.get("getHistory").all(e).map(tt)}incrementalSync(e){return this.ensureInitialized(),this.prepared.get("incrementalSync").all(e).map(tt)}getCurrentVersion(e){return this.ensureInitialized(),this.prepared.get("currentVersion").get(e).max_version??-1}insertEvent(e){this.prepared.get("insert").run(e.id,e.patternId,e.version,e.timestamp,e.type,JSON.stringify(e.patch),JSON.stringify(e.reversePatch),e.metadata?JSON.stringify(e.metadata):null)}reconstructState(e,t){let r=e.find(s=>s.type==="genesis");if(!r||!r.metadata?.snapshot)throw new Error("Cannot reconstruct state: no genesis snapshot found");let i=JSON.parse(JSON.stringify(r.metadata.snapshot));for(let s of e)if(s.version!==0){if(s.version>t)break;i=$t(i,s.patch)}return i}enforceRetention(e){let{maxVersionsPerPattern:t}=this.config,i=this.prepared.get("countForPattern").get(e).cnt;if(i>t){let s=i-t;this.db.prepare(`DELETE FROM pattern_deltas
|
|
44
|
-
WHERE pattern_id = ? AND version != 0 AND id IN (
|
|
45
|
-
SELECT id FROM pattern_deltas
|
|
46
|
-
WHERE pattern_id = ? AND version != 0
|
|
47
|
-
ORDER BY version ASC
|
|
48
|
-
LIMIT ?
|
|
49
|
-
)`).run(e,e,s)}}};_();var zt={maxHistoryPerPattern:50,snapshotInterval:10,batchSize:20,epsilon:1e-7},Re=class{config;history=new Map;snapshots=new Map;versions=new Map;buffer=[];constructor(e){this.config={...zt,...e}}recordGenesis(e,t,r){if(this.versions.has(e))throw new Error(`Genesis already exists for pattern ${e} (version ${this.versions.get(e)})`);let i=this.computeSparseChanges(new Array(t.length).fill(0),t),s={patternId:e,version:0,timestamp:Date.now(),deltaType:"genesis",sparseChanges:i,metadata:r,compressedSize:i.length},a={patternId:e,version:0,fullVector:[...t],timestamp:s.timestamp};return this.versions.set(e,0),this.getOrCreate(this.history,e).push(s),this.getOrCreate(this.snapshots,e).push(a),this.buffer.push(s),s}recordDelta(e,t,r,i){let s=this.versions.get(e);if(s===void 0)throw new Error(`No genesis found for pattern ${e}. Call recordGenesis() first.`);let a=s+1,l=this.computeSparseChanges(t,r),d={patternId:e,version:a,timestamp:Date.now(),deltaType:"update",sparseChanges:l,metadata:i,compressedSize:l.length};return this.versions.set(e,a),this.getOrCreate(this.history,e).push(d),this.buffer.push(d),a%this.config.snapshotInterval===0&&this.getOrCreate(this.snapshots,e).push({patternId:e,version:a,fullVector:[...r],timestamp:d.timestamp}),this.enforceRetention(e),d}getHistory(e,t){let r=this.history.get(e);if(!r||r.length===0)return[];let i=[...r].reverse();return t!==void 0&&t>0?i.slice(0,t):i}rollback(e,t){let r=this.reconstructAtVersion(e,t);return r===null?null:{patternId:e,version:t,fullVector:r,timestamp:Date.now()}}getVersion(e){return this.versions.get(e)??-1}reconstructAtVersion(e,t){let r=this.history.get(e);if(!r||r.length===0)return null;let i=this.versions.get(e);if(t<0||t>i)return null;let s=this.snapshots.get(e)||[],a=null;for(let o=s.length-1;o>=0;o--)if(s[o].version<=t){a=s[o];break}if(!a)return null;let l=[...a.fullVector],d=a.version+1;for(let o of r)if(!(o.version<d)){if(o.version>t)break;this.applySparseForward(l,o.sparseChanges)}return l}pruneHistory(e,t){let r=t??this.config.maxHistoryPerPattern,i=this.history.get(e);if(!i||i.length<=r)return 0;let s=i.length-r,a=i.slice(0,s),l=i.slice(s),d=a.findIndex(h=>h.deltaType==="genesis");d>=0&&(l.unshift(a[d]),a.splice(d,1)),this.history.set(e,l);let o=l[0]?.version??0,c=this.snapshots.get(e);return c&&this.snapshots.set(e,c.filter(h=>h.version===0||h.version>=o)),a.length}getStats(){let e=0;for(let r of this.history.values())e+=r.length;let t=this.history.size;return{totalPatterns:t,totalDeltas:e,avgDeltasPerPattern:t>0?e/t:0}}flush(){let e=[...this.buffer];return this.buffer.length=0,e}getBufferSize(){return this.buffer.length}clear(){this.history.clear(),this.snapshots.clear(),this.versions.clear(),this.buffer.length=0}computeSparseChanges(e,t){let r=[],i=Math.max(e.length,t.length);for(let s=0;s<i;s++){let a=s<e.length?e[s]:0,l=s<t.length?t[s]:0;Math.abs(a-l)>this.config.epsilon&&r.push({index:s,oldValue:a,newValue:l})}return r}applySparseForward(e,t){for(let r of t){for(;e.length<=r.index;)e.push(0);e[r.index]=r.newValue}}enforceRetention(e){this.pruneHistory(e,this.config.maxHistoryPerPattern)}getOrCreate(e,t){let r=e.get(t);return r||(r=[],e.set(t,r)),r}};function rt(n){return L()?new Re(n):null}_();var Jt=128,Bt=8,jt=1e4,Ae=class{dimension;beta;maxPatterns;patterns;constructor(e){if(this.dimension=e?.dimension??Jt,this.beta=e?.beta??Bt,this.maxPatterns=e?.maxPatterns??jt,this.patterns=[],this.dimension<=0)throw new Error(`Hopfield dimension must be positive, got ${this.dimension}`);if(this.beta<=0)throw new Error(`Hopfield beta must be positive, got ${this.beta}`);if(this.maxPatterns<=0)throw new Error(`Hopfield maxPatterns must be positive, got ${this.maxPatterns}`)}store(e,t){if(this.assertEnabled(),e.length!==this.dimension)throw new Error(`Pattern dimension mismatch: expected ${this.dimension}, got ${e.length}`);if(this.dotProduct(e,e)===0)throw new Error("Cannot store zero-magnitude pattern in Hopfield memory");let i=this.normalize(e);this.patterns.length>=this.maxPatterns&&this.patterns.shift(),this.patterns.push({pattern:i,metadata:t??{},storedAt:Date.now()})}recall(e){if(this.assertEnabled(),e.length!==this.dimension)throw new Error(`Query dimension mismatch: expected ${this.dimension}, got ${e.length}`);if(this.patterns.length===0)return null;let t=this.normalize(e),r=new Float32Array(this.patterns.length);for(let c=0;c<this.patterns.length;c++)r[c]=this.beta*this.dotProduct(this.patterns[c].pattern,t);let i=this.softmax(r),s=0,a=i[0];for(let c=1;c<i.length;c++)i[c]>a&&(a=i[c],s=c);let l=this.patterns[s],d=this.getEnergy(t),o=this.cosineSimilarity(t,l.pattern);return{pattern:new Float32Array(l.pattern),metadata:{...l.metadata},energy:d,similarity:o}}batchRecall(e){return this.assertEnabled(),e.map(t=>this.recall(t))}getPatternCount(){return this.patterns.length}clear(){this.patterns.length=0}getEnergy(e){if(e.length!==this.dimension)throw new Error(`State dimension mismatch: expected ${this.dimension}, got ${e.length}`);let t=this.normalize(e);if(this.patterns.length===0)return .5*this.dotProduct(t,t);let r=new Float32Array(this.patterns.length);for(let o=0;o<this.patterns.length;o++)r[o]=this.dotProduct(this.patterns[o].pattern,t);let i=new Float32Array(this.patterns.length),s=-1/0;for(let o=0;o<this.patterns.length;o++)i[o]=this.beta*r[o],i[o]>s&&(s=i[o]);let a=0;for(let o=0;o<this.patterns.length;o++)a+=Math.exp(i[o]-s);let l=1/this.beta*(s+Math.log(a)),d=this.dotProduct(t,t);return-l+.5*d}softmax(e){let t=new Float32Array(e.length),r=-1/0;for(let s=0;s<e.length;s++)e[s]>r&&(r=e[s]);let i=0;for(let s=0;s<e.length;s++)t[s]=Math.exp(e[s]-r),i+=t[s];if(i>0)for(let s=0;s<t.length;s++)t[s]/=i;return t}dotProduct(e,t){let r=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i];return r}cosineSimilarity(e,t){let r=this.dotProduct(e,t),i=Math.sqrt(this.dotProduct(e,e)),s=Math.sqrt(this.dotProduct(t,t));return i===0||s===0?0:r/(i*s)}normalize(e){let t=Math.sqrt(this.dotProduct(e,e)),r=new Float32Array(e.length);if(t>0)for(let i=0;i<e.length;i++)r[i]=e[i]/t;return r}assertEnabled(){if(!F().useHopfieldMemory)throw new Error("Hopfield memory is disabled (useHopfieldMemory feature flag is false)")}};function nt(n){return new Ae(n)}_();var Wt={dimensions:32,curvature:-1,maxElements:1e4,efConstruction:200,M:16},H=1e-5,it=1-H;function Vt(n,e){let t=0;for(let r=0;r<n.length;r++)t+=n[r]*e[r];return t}function I(n){let e=0;for(let t=0;t<n.length;t++)e+=n[t]*n[t];return e}function Xt(n,e){let t=new Float32Array(n.length);for(let r=0;r<n.length;r++)t[r]=n[r]-e[r];return t}var D=class n{static poincareDistance(e,t){let r=I(Xt(e,t)),i=Math.max(H,1-I(e)),s=Math.max(H,1-I(t));return Math.acosh(Math.max(1,1+2*r/(i*s)))}static mobiusAdd(e,t){let r=Vt(e,t),i=I(e),s=I(t),a=Math.max(H,1+2*r+i*s),l=1+2*r+s,d=1-i,o=new Float32Array(e.length);for(let c=0;c<e.length;c++)o[c]=(l*e[c]+d*t[c])/a;return n.project(o)}static expMap(e,t){let r=2/Math.max(H,1-I(e)),i=Math.sqrt(I(t));if(i<H)return new Float32Array(e);let s=Math.tanh(r*i/2),a=new Float32Array(t.length);for(let l=0;l<t.length;l++)a[l]=s/i*t[l];return n.mobiusAdd(e,a)}static project(e){let t=Math.sqrt(I(e));if(t<=it)return new Float32Array(e);let r=it/t,i=new Float32Array(e.length);for(let s=0;s<e.length;s++)i[s]=e[s]*r;return i}static euclideanToHyperbolic(e){let t=Math.sqrt(I(e));if(t<H)return new Float32Array(e.length);let r=Math.tanh(t)/t,i=new Float32Array(e.length);for(let s=0;s<e.length;s++)i[s]=e[s]*r;return n.project(i)}},Te=class{config;points=new Map;constructor(e){if(this.config={...Wt,...e},this.config.dimensions<=0)throw new Error(`dimensions must be positive, got ${this.config.dimensions}`);if(this.config.curvature>=0)throw new Error(`curvature must be negative for hyperbolic space, got ${this.config.curvature}`);if(this.config.maxElements<=0)throw new Error(`maxElements must be positive, got ${this.config.maxElements}`)}insert(e,t,r){if(t.length!==this.config.dimensions)throw new Error(`Dimension mismatch: expected ${this.config.dimensions}, got ${t.length}`);if(this.points.size>=this.config.maxElements)throw new Error(`Maximum elements (${this.config.maxElements}) reached`);this.points.set(e,{id:e,coordinates:D.project(t),metadata:r?{...r}:void 0})}search(e,t){if(e.length!==this.config.dimensions)throw new Error(`Query dimension mismatch: expected ${this.config.dimensions}, got ${e.length}`);let r=D.project(e),i=[];for(let s of this.points.values())i.push({id:s.id,distance:D.poincareDistance(r,s.coordinates),point:s});return i.sort((s,a)=>s.distance-a.distance),i.slice(0,Math.max(0,t))}embedHierarchy(e){let t=new Map;if(e.length===0)return t;let r=this.config.dimensions,i=new Map,s=new Map,a=[];for(let d of e)if(s.set(d.id,d),!d.parentId)a.push(d.id);else{let o=i.get(d.parentId);o||(o=[],i.set(d.parentId,o)),o.push(d.id)}let l=a.map((d,o)=>({id:d,depth:0,angOff:2*Math.PI*o/Math.max(1,a.length),angSpan:2*Math.PI/Math.max(1,a.length)}));for(;l.length>0;){let{id:d,depth:o,angOff:c,angSpan:h}=l.shift(),m=Math.tanh(.3*(o+.1)),u=c+h/2,f=new Float32Array(r);f[0]=m*Math.cos(u),f[1]=m*Math.sin(u);let g=s.get(d);if(g&&g.features.length>0){let P=m*.1;for(let x=2;x<r&&x-2<g.features.length;x++)f[x]=g.features[x-2]*P}let p=D.project(f);t.set(d,p),this.points.set(d,{id:d,coordinates:p,metadata:{depth:o,parentId:g?.parentId}});let S=i.get(d)??[];for(let P=0;P<S.length;P++){let x=h/Math.max(1,S.length);l.push({id:S[P],depth:o+1,angOff:c+P*x,angSpan:x})}}return t}getStats(){return{elementCount:this.points.size,dimensions:this.config.dimensions,curvature:this.config.curvature}}};function st(n){return Gt()?new Te(n):null}function Gt(){return F().useHyperbolicHnsw}_();var Ce=class{index=null;initialized=!1;config;constructor(e){this.config=e??{}}ensureInitialized(){if(this.initialized)return this.index!==null;if(this.initialized=!0,!k())return!1;try{return this.index=st(this.config),this.index!==null}catch(e){return console.warn("[HyperbolicPatternIndex] Failed to create HyperbolicHNSW:",e instanceof Error?e.message:e),this.index=null,!1}}get isAvailable(){return this.index!==null}indexPattern(e,t,r){if(!(!this.ensureInitialized()||!this.index))try{let i=t instanceof Float32Array?t:new Float32Array(t),s=D.euclideanToHyperbolic(i);this.index.insert(e,s,r)}catch(i){console.debug(`[HyperbolicPatternIndex] Failed to index pattern ${e}:`,i instanceof Error?i.message:i)}}search(e,t){if(!this.ensureInitialized()||!this.index)return[];try{let r=e instanceof Float32Array?e:new Float32Array(e),i=D.euclideanToHyperbolic(r);return this.index.search(i,t).map(a=>({patternId:a.id,distance:a.distance,metadata:a.point.metadata}))}catch(r){return console.warn("[HyperbolicPatternIndex] Search failed:",r instanceof Error?r.message:r),[]}}getStats(){return this.index?this.index.getStats():null}reset(){this.index=null,this.initialized=!1}};function at(n){return new Ce(n)}var xe=null;function ct(){return xe||(xe=je({dimensions:1e4})),xe}var Ie;function Kt(){return Ie===void 0&&(Ie=We()),Ie}var Q=null,De=0;function lt(n){return(!Q||De!==n)&&(Q=nt({dimension:n,maxPatterns:1e4}),De=n),Q}var Y={namespace:"qe-patterns",embeddingDimension:384,hnsw:{M:16,efConstruction:200,efSearch:100,maxElements:5e4},promotionThreshold:V,minConfidence:.3,maxPatternsPerDomain:5e3,autoCleanup:!0,cleanupIntervalMs:36e5,tokenTracking:{enabled:!0,trackInputOutput:!0,estimateCosts:!0,costPerInputToken:3e-6,costPerOutputToken:15e-6},reuseOptimization:{enabled:!0,minSimilarityForReuse:.85,minSuccessRateForReuse:.9,maxAgeForReuse:7}},Fe=class{constructor(e,t={}){this.memory=e;this.config={...Y,...t}}memory;config;initialized=!1;cleanupTimer;sqliteStore=null;nullStore=null;loadingPromise=null;patternCache=new Map;domainIndex=new Map;typeIndex=new Map;tierIndex=new Map;hnswIndex=null;hnswSpaceId=null;hnswAvailable=!1;hnswInitPromise=null;hdcCache=new Map;hdcTokenCache=new Map;deltaTracker=null;vectorDeltaTracker=void 0;hyperbolicIndex=null;stats={searchOperations:0,searchLatencies:[]};setSqliteStore(e){if(this.sqliteStore=e,L()&&!this.deltaTracker)try{let t=e.getDb();this.deltaTracker=new ne(t),this.deltaTracker.initialize(),console.log("[PatternStore] Delta event sourcing initialized")}catch(t){console.warn("[PatternStore] Delta tracker init failed:",t instanceof Error?t.message:t)}this.initialized&&(this.loadingPromise=this.loadPatterns().catch(t=>console.warn("[PatternStore] Failed to load patterns after setSqliteStore:",t)).finally(()=>{this.loadingPromise=null}))}async initialize(){this.initialized||(this.tierIndex.set("short-term",new Set),this.tierIndex.set("long-term",new Set),await this.loadPatterns(),this.config.autoCleanup&&(this.cleanupTimer=setInterval(()=>this.cleanup(),this.config.cleanupIntervalMs)),this.initialized=!0)}async ensureHNSW(){if(this.hnswIndex!==null){let e=C()?.spaceId??this.config.embeddingSpaceId??null;return this.hnswSpaceId!==e?(console.warn("[PatternStore] VECTOR_SPACE_MISMATCH: active embedder changed; semantic index disabled"),null):this.hnswIndex}return this.hnswAvailable===!1&&this.hnswInitPromise===null&&!(this.hnswIndex===null&&this.hnswAvailable===!1)?null:this.hnswInitPromise?(await this.hnswInitPromise,this.hnswIndex):(this.hnswInitPromise=this.initializeHNSWInternal(),await this.hnswInitPromise,this.hnswInitPromise=null,this.hnswIndex)}async initializeHNSWInternal(){try{if(!C()&&!this.config.embeddingSpaceId&&await j(),this.hnswSpaceId=C()?.spaceId??this.config.embeddingSpaceId??null,!this.hnswSpaceId)throw new Error("VECTOR_SPACE_UNVERIFIED: cannot initialize HNSW without runtime provenance");if(F().useUnifiedHnsw)try{let{HnswLegacyBridge:a}=await import("./hnsw-legacy-bridge-HBYIS3ZW.js"),{HnswAdapter:l}=await import("./hnsw-adapter-XQPERX3H.js"),d=new l("patterns",{dimensions:this.config.embeddingDimension,M:this.config.hnsw.M,efConstruction:this.config.hnsw.efConstruction,efSearch:this.config.hnsw.efSearch,metric:"cosine"});this.hnswIndex=new a(d),this.hnswAvailable=!0,console.log("[PatternStore] Using unified HNSW via HnswLegacyBridge (ADR-071)"),await this.loadEmbeddingsIntoHNSW();return}catch(a){console.warn("[PatternStore] Unified HNSW bridge failed, falling back:",a)}let{HNSWIndex:t}=await import("./hnsw-index-2GNXTWHH.js");this.hnswIndex=new t(this.memory,{dimensions:this.config.embeddingDimension,M:this.config.hnsw.M,efConstruction:this.config.hnsw.efConstruction,efSearch:this.config.hnsw.efSearch,maxElements:this.config.hnsw.maxElements,namespace:`${this.config.namespace}:hnsw`,metric:"cosine"});let r=5e3,i=this.hnswIndex.initialize(),s=new Promise((a,l)=>setTimeout(()=>l(new Error("HNSW init timeout")),r));await Promise.race([i,s]),this.hnswAvailable=this.hnswIndex.isNativeAvailable(),await this.loadEmbeddingsIntoHNSW(),console.log(`[PatternStore] HNSW lazy-initialized (native: ${this.hnswAvailable})`)}catch(e){console.warn("[PatternStore] HNSW not available, using memory backend search:",w(e)),this.hnswIndex=null,this.hnswAvailable=!1}}async loadEmbeddingsIntoHNSW(){if(!(!this.hnswIndex||!this.sqliteStore))try{let e=this.sqliteStore.getAllEmbeddings(),t=this.config.hnsw.maxElements,r=0,i=0,s=C()?.spaceId??this.config.embeddingSpaceId;for(let{patternId:a,embedding:l,spaceId:d}of e){if(r>=t)break;if(!s||d!==s||!l||l.length!==this.config.embeddingDimension){i++;continue}let o=this.patternCache.get(a);if(!o){i++;continue}try{await this.hnswIndex.insert(a,l,{filePath:o.patternType,lineCoverage:o.confidence*100,branchCoverage:o.qualityScore*100,functionCoverage:0,statementCoverage:0,uncoveredLineCount:0,uncoveredBranchCount:0,riskScore:1-o.confidence,lastUpdated:Date.now(),totalLines:0}),r++}catch{i++}}r>0&&console.log(`[PatternStore] Loaded ${r} embeddings into HNSW (skipped ${i})`)}catch(e){console.warn("[PatternStore] Failed to load SQLite embeddings into HNSW:",w(e))}}getVectorDeltaTracker(){return this.vectorDeltaTracker===void 0&&(this.vectorDeltaTracker=rt()),this.vectorDeltaTracker}async loadPatterns(){if(this.sqliteStore)try{let e=this.sqliteStore.getPatterns({limit:5e4});for(let t of e)this.indexPattern(t);e.length>0&&console.log(`[PatternStore] Loaded ${e.length} patterns from SQLite into memory cache`)}catch(e){console.warn("[PatternStore] Failed to load patterns from SQLite:",w(e))}}indexPattern(e){this.patternCache.set(e.id,e),this.domainIndex.has(e.qeDomain)||this.domainIndex.set(e.qeDomain,new Set),this.domainIndex.get(e.qeDomain).add(e.id),this.typeIndex.has(e.patternType)||this.typeIndex.set(e.patternType,new Set),this.typeIndex.get(e.patternType).add(e.id);let t=e.tier==="long-term"?"long-term":"short-term";e.tier!==t&&(e.tier=t),this.tierIndex.get(t).add(e.id)}unindexPattern(e){this.patternCache.delete(e.id),this.domainIndex.get(e.qeDomain)?.delete(e.id),this.typeIndex.get(e.patternType)?.delete(e.id),this.tierIndex.get(e.tier)?.delete(e.id),this.hdcCache.delete(e.id),this.hdcTokenCache.delete(e.id)}async store(e){this.initialized||await this.initialize(),this.loadingPromise&&await this.loadingPromise;let t=X(e);if(!t.valid)return v(new Error(`Invalid pattern: ${t.errors.join(", ")}`));if(e.confidence<this.config.minConfidence)return v(new Error(`Pattern confidence ${e.confidence} below threshold ${this.config.minConfidence}`));let r=(process.env.AQE_MEMORY_BACKEND??"memory")!=="memory";if(r&&!this.sqliteStore)return v(new A(e.id,"FAILED",new Error("authoritative SQLite pattern store is unavailable")));let i=C()?.spaceId??this.config.embeddingSpaceId;if(e.embedding&&!i)return v(new Error("VECTOR_SPACE_UNVERIFIED: refusing to persist or index an embedding without runtime provenance"));(this.domainIndex.get(e.qeDomain)?.size||0)>=this.config.maxPatternsPerDomain&&await this.cleanupDomain(e.qeDomain);let a=this.patternCache.get(e.id)??null,l=!1,d=()=>{this.unindexPattern(e),a&&this.indexPattern(a)};if(this.indexPattern(e),this.sqliteStore)try{let o=this.sqliteStore.storePattern(e,e.embedding,i);o&&o!==e.id&&(this.unindexPattern(e),e.id=o,this.indexPattern(e)),l=!0}catch(o){return d(),v(new A(e.id,"FAILED",o))}if(e.embedding){let o=await this.ensureHNSW();if(!o&&l)return v(new A(e.id,"COMMITTED_PENDING_INDEX",new Error("HNSW unavailable after authoritative pattern commit")));if(!o&&r)return d(),v(new A(e.id,"FAILED",new Error("HNSW unavailable before an authoritative pattern commit")));if(o)try{await o.insert(e.id,e.embedding,{filePath:e.patternType,lineCoverage:e.confidence*100,branchCoverage:e.qualityScore*100,functionCoverage:0,statementCoverage:0,uncoveredLineCount:0,uncoveredBranchCount:0,riskScore:1-e.confidence,lastUpdated:Date.now(),totalLines:0})}catch(c){return l||d(),v(new A(e.id,l?"COMMITTED_PENDING_INDEX":"FAILED",c))}}if($())try{let c=ct().fingerprint({id:e.id,domain:e.qeDomain,type:e.patternType,content:e.description});this.hdcCache.set(e.id,c.vector)}catch(o){console.debug(`[PatternStore] HDC fingerprint failed for ${e.id}:`,w(o))}try{let o=Kt();if(o){let c=[e.patternType,e.qeDomain];e.context?.tags&&c.push(...e.context.tags),e.name&&c.push(e.name);let h=o.fingerprintPattern(c);this.hdcTokenCache.set(e.id,h)}}catch(o){console.debug(`[PatternStore] HDC token fingerprint failed for ${e.id}:`,w(o))}if(se()&&e.embedding)try{lt(e.embedding.length).store(new Float32Array(e.embedding),{id:e.id,name:e.name,domain:e.qeDomain})}catch(o){console.debug(`[PatternStore] Hopfield store failed for ${e.id}:`,w(o))}if(L()&&this.deltaTracker)try{let o={id:e.id,name:e.name,confidence:e.confidence,qualityScore:e.qualityScore,usageCount:e.usageCount,successRate:e.successRate,tier:e.tier};this.deltaTracker.createGenesis(e.id,o)}catch(o){console.debug(`[PatternStore] Delta genesis for ${e.id}:`,w(o))}if(e.embedding)try{let o=this.getVectorDeltaTracker();o&&(a?.embedding?o.recordDelta(e.id,a.embedding,e.embedding):o.getVersion(e.id)<0&&o.recordGenesis(e.id,e.embedding))}catch(o){console.debug(`[PatternStore] VectorDeltaTracker for ${e.id}:`,w(o))}try{k()&&e.embedding&&this.indexHyperbolic(e.id,e.embedding,{domain:e.qeDomain,type:e.patternType,name:e.name})}catch{}return b(e.id)}async create(e){let t=new Date,r=e.qeDomain||this.detectDomainFromType(e.patternType),i={id:O(),patternType:e.patternType,qeDomain:r,domain:r,name:e.name,description:e.description,confidence:e.confidence??.5,usageCount:0,successRate:0,qualityScore:.25,context:{...e.context,tags:e.context?.tags||[]},template:{...e.template,example:void 0},embedding:e.embedding,tier:"short-term",createdAt:t,lastUsedAt:t,successfulUses:0,reusable:!1,reuseCount:0,averageTokenSavings:0},s=await this.store(i);return s.success?b(i):v(s.error)}detectDomainFromType(e){return{"test-template":"test-generation","assertion-pattern":"test-generation","mock-pattern":"test-generation","coverage-strategy":"coverage-analysis","mutation-strategy":"test-generation","api-contract":"contract-testing","visual-baseline":"visual-accessibility","a11y-check":"visual-accessibility","perf-benchmark":"chaos-resilience","flaky-fix":"test-execution","refactor-safe":"code-intelligence","error-handling":"test-generation","meta-optimization":"learning-optimization"}[e]||"test-generation"}async get(e){return this.initialized||await this.initialize(),this.loadingPromise&&await this.loadingPromise,this.patternCache.get(e)??null}async search(e,t={}){this.initialized||await this.initialize(),this.loadingPromise&&await this.loadingPromise;let r=performance.now(),i=t.limit||10,s=[];try{if(Array.isArray(e)&&se())try{let u=lt(e.length);if(u.getPatternCount()>0){let f=u.recall(new Float32Array(e));if(f&&f.similarity>.98){let g=f.metadata.id,p=await this.get(g);if(p&&this.matchesFilters(p,t)){let S=this.calculateReuseInfo(p,f.similarity);s.push({pattern:p,score:f.similarity,matchType:"vector",similarity:f.similarity,canReuse:S.canReuse,estimatedTokenSavings:S.estimatedTokenSavings,reuseConfidence:S.reuseConfidence})}}}}catch(u){console.debug("[PatternStore] Hopfield recall failed:",w(u))}if(Array.isArray(e)&&t.useVectorSearch!==!1){let u=C()?.spaceId??this.config.embeddingSpaceId;if(!u||t.embeddingSpaceId!==u)throw new Error("VECTOR_SPACE_UNVERIFIED: pre-computed query vectors require the active embeddingSpaceId");let f=await this.ensureHNSW();if(f){let g=await f.search(e,i*2);for(let p of g){let S=await this.get(p.key);if(S&&this.matchesFilters(S,t)){let P=this.calculateReuseInfo(S,p.score);s.push({pattern:S,score:p.score,matchType:"vector",similarity:p.score,canReuse:P.canReuse,estimatedTokenSavings:P.estimatedTokenSavings,reuseConfidence:P.reuseConfidence})}}}}let a=typeof e=="string"?e:t.textQuery;if(a?.trim()&&this.sqliteStore)try{let u=this.sqliteStore.searchFTS(a,i*2);if(u.length>0){let f=new Map(u.map(p=>[p.id,p.ftsScore])),g=new Set(s.map(p=>p.pattern.id));for(let p of s){let S=f.get(p.pattern.id);S!==void 0&&(p.score=de(p.score,S))}for(let p of u){if(g.has(p.id))continue;let S=await this.get(p.id);if(S&&this.matchesFilters(S,t)){let P=.5*p.ftsScore*p.coverage,x=p.phrase?p.ftsScore:P,ie=this.calculateReuseInfo(S,x);s.push({pattern:S,score:P,matchType:"exact",similarity:x,canReuse:ie.canReuse,estimatedTokenSavings:ie.estimatedTokenSavings,reuseConfidence:ie.reuseConfidence})}}}}catch{}if(typeof e=="string"||s.length<i){let u=await this.searchByText(a??"",t,i-s.length),f=new Set(s.map(g=>g.pattern.id));for(let g of u)f.has(g.pattern.id)||s.push(g)}let l=720*60*60*1e3,d=Date.now();for(let u of s){let f=u.pattern.lastUsedAt?.getTime()??u.pattern.createdAt.getTime(),g=d-f,p=Math.pow(.5,g/l),S=u.pattern.usageCount>0?p:.5;u.score=u.score*(.7+.3*S)}let o=this.sqliteStore?.getDatabase();if(o&&s.length>0)try{this.nullStore||(this.nullStore=new le(o));let u=this.nullStore.getNullSummaries(s.map(f=>f.pattern.id));for(let f of s){let g=u.get(f.pattern.id);g&&(f.nullSummary=g,f.score=le.applyNullDiscount(f.score,g,t.contextFingerprint))}}catch(u){console.debug("[PatternStore] null discount skipped:",w(u))}s.sort((u,f)=>f.score-u.score);let c=s;t.filter&&(c=Qe(s,t.filter));let h=c.slice(0,i),m=performance.now()-r;return this.recordSearchLatency(m),b(h)}catch(a){return v(Oe(a))}}async searchByText(e,t,r){let i=[],s=e.toLowerCase(),a;t.domain?a=this.domainIndex.get(t.domain)||new Set:t.patternType?a=this.typeIndex.get(t.patternType)||new Set:t.tier?a=this.tierIndex.get(t.tier)||new Set:a=new Set(this.patternCache.keys());let l=[...a];if($()&&s&&this.hdcCache.size>0)try{let d=ct(),o=d.fingerprint({id:"query",domain:t.domain??"unknown",type:t.patternType??"unknown",content:e}),c=l.filter(u=>this.hdcCache.has(u)).map(u=>({id:u,similarity:d.similarity(o.vector,this.hdcCache.get(u))}));c.sort((u,f)=>f.similarity-u.similarity);let h=c.map(u=>u.id),m=l.filter(u=>!this.hdcCache.has(u));l=[...h,...m]}catch{}for(let d of l){if(i.length>=r)break;let o=this.patternCache.get(d);if(!o||!this.matchesFilters(o,t))continue;let c=0;if(s){let h=o.name.toLowerCase(),m=o.description.toLowerCase();h.includes(s)&&(c+=.5),m.includes(s)&&(s.length/m.length>.3?c+=.5:c+=.3);for(let u of o.context.tags)if(u.toLowerCase().includes(s)){c+=.2;break}c=Math.min(c,1)}else c=o.qualityScore;if(c>0||!s){let h=this.calculateReuseInfo(o,c);i.push({pattern:o,score:c||o.qualityScore,matchType:s?"exact":"context",similarity:c||o.qualityScore,canReuse:h.canReuse,estimatedTokenSavings:h.estimatedTokenSavings,reuseConfidence:h.reuseConfidence})}}return i}calculateReuseInfo(e,t){let{reuseOptimization:r}=this.config,i=t>=r.minSimilarityForReuse,s=e.successRate>=r.minSuccessRateForReuse,a=e.lastUsedAt instanceof Date?e.lastUsedAt.getTime():new Date(e.lastUsedAt).getTime(),d=(Date.now()-a)/(1e3*60*60*24)<=r.maxAgeForReuse,o=r.enabled&&e.reusable&&i&&s&&d,c=o?e.averageTokenSavings>0?e.averageTokenSavings:e.tokensUsed||0:0,h=t,m=e.successRate,u=Math.min(e.reuseCount/10,1),f=o?h*.4+m*.4+u*.2:0;return{canReuse:o,estimatedTokenSavings:c,reuseConfidence:f}}matchesFilters(e,t){if(t.patternType&&e.patternType!==t.patternType||t.domain&&e.qeDomain!==t.domain||t.tier&&e.tier!==t.tier||t.minConfidence!==void 0&&e.confidence<t.minConfidence||t.minQualityScore!==void 0&&e.qualityScore<t.minQualityScore)return!1;if(t.context){let r=t.context;if(r.language&&e.context.language!==r.language||r.framework&&e.context.framework!==r.framework||r.testType&&e.context.testType!==r.testType)return!1}return!0}async recordUsage(e,t,r,i){let s=await this.get(e);if(!s)return v(new Error(`Pattern not found: ${e}`));let a=new Date,l=s.usageCount+1,d=s.successfulUses+(t?1:0),o=d/l,c=t?.02:-.01,h=Math.max(.1,Math.min(1,s.confidence+c)),m=W({confidence:h,usageCount:l,successRate:o}),u={...s,usageCount:l,successfulUses:d,successRate:o,confidence:h,qualityScore:m,lastUsedAt:a};if(this.sqliteStore)try{this.sqliteStore.recordUsage(e,t,r,i)}catch(p){console.warn(`[PatternStore] SQLite recordUsage failed for ${e}:`,w(p))}if(L()&&this.deltaTracker)try{let p={id:s.id,name:s.name,confidence:s.confidence,qualityScore:s.qualityScore,usageCount:s.usageCount,successRate:s.successRate,tier:s.tier},S={id:u.id,name:u.name,confidence:u.confidence,qualityScore:u.qualityScore,usageCount:u.usageCount,successRate:u.successRate,tier:u.tier};this.deltaTracker.recordDelta(e,p,S,{success:t})}catch(p){console.debug(`[PatternStore] Delta recordDelta for ${e}:`,w(p))}let f=ae(u);return f.meetsUsageCriteria&&f.meetsQualityCriteria&&f.meetsCoherenceCriteria&&u.tier==="short-term"?await this.promote(e):this.patternCache.set(e,u),b(void 0)}async promote(e){let t=await this.get(e);if(!t)return v(new Error(`Pattern not found: ${e}`));if(t.tier==="long-term")return b(void 0);let r={...t,tier:"long-term",confidence:Math.min(1,t.confidence+.1)};if(this.tierIndex.get("short-term")?.delete(e),this.tierIndex.get("long-term")?.add(e),this.patternCache.set(e,r),this.sqliteStore)try{this.sqliteStore.promotePattern(e)}catch(i){console.debug("[PatternStore] SQLite promotion error:",i instanceof Error?i.message:i)}return console.log(`[PatternStore] Promoted pattern ${e} (${t.name}) to long-term storage`),b(void 0)}async delete(e){let t=this.patternCache.get(e);if(!t)return v(new Error(`Pattern not found: ${e}`));if(this.unindexPattern(t),this.sqliteStore)try{this.sqliteStore.deletePattern(e)}catch(r){console.debug("[PatternStore] SQLite deletion error:",r instanceof Error?r.message:r)}if(this.hnswIndex!==null)try{await this.hnswIndex.delete(e)}catch(r){console.debug("[PatternStore] HNSW deletion error:",r instanceof Error?r.message:r)}return b(void 0)}async getStats(){let e={},t={};for(let[o,c]of this.domainIndex)e[o]=c.size;for(let[o,c]of this.typeIndex)t[o]=c.size;let r=0,i=0,s=0,a=0;for(let o of this.patternCache.values())r+=o.confidence,i+=o.qualityScore,s+=o.successRate,a++;let l=await this.ensureHNSW(),d=l!==null?await l.getStats():{nativeHNSW:!1,vectorCount:0,indexSizeBytes:0,lazyLoaded:!0};return{totalPatterns:this.patternCache.size,byTier:{shortTerm:this.tierIndex.get("short-term")?.size||0,longTerm:this.tierIndex.get("long-term")?.size||0},byDomain:e,byType:t,avgConfidence:a>0?r/a:0,avgQualityScore:a>0?i/a:0,avgSuccessRate:a>0?s/a:0,searchOperations:this.stats.searchOperations,avgSearchLatencyMs:this.calculateAvgLatency(),hnswStats:{nativeAvailable:d.nativeHNSW,vectorCount:d.vectorCount,indexSizeBytes:d.indexSizeBytes}}}async cleanup(){let e=0,t=0,r=[],i=[];for(let s of this.patternCache.values()){let a=ae(s);if(a.meetsUsageCriteria&&a.meetsQualityCriteria&&a.meetsCoherenceCriteria){i.push(s.id);continue}if(s.tier==="short-term"){let d=s.createdAt instanceof Date?s.createdAt.getTime():new Date(s.createdAt).getTime(),o=Date.now()-d,c=o>10080*60*1e3,h=s.qualityScore<.2,m=s.usageCount===0&&o>1440*60*1e3;(c&&h||m)&&r.push(s.id)}}for(let s of i)(await this.promote(s)).success&&t++;for(let s of r)(await this.delete(s)).success&&e++;return console.log(`[PatternStore] Cleanup: removed ${e}, promoted ${t}`),{removed:e,promoted:t}}async cleanupDomain(e){let t=this.domainIndex.get(e);if(!t||t.size<this.config.maxPatternsPerDomain)return;let r=[];for(let a of t){let l=this.patternCache.get(a);l&&r.push(l)}r.sort((a,l)=>a.qualityScore-l.qualityScore);let i=Math.ceil(r.length*.1),s=0;for(let a of r){if(s>=i)break;a.tier==="short-term"&&(await this.delete(a.id),s++)}}recordSearchLatency(e){this.stats.searchOperations++,this.stats.searchLatencies.push(e),this.stats.searchLatencies.length>1e3&&(this.stats.searchLatencies=this.stats.searchLatencies.slice(-1e3))}calculateAvgLatency(){return this.stats.searchLatencies.length===0?0:this.stats.searchLatencies.reduce((t,r)=>t+r,0)/this.stats.searchLatencies.length}async dispose(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=void 0),this.patternCache.clear(),this.domainIndex.clear(),this.typeIndex.clear(),this.tierIndex.clear(),this.hdcCache.clear(),this.deltaTracker=null,this.hyperbolicIndex&&(this.hyperbolicIndex.reset(),this.hyperbolicIndex=null),Q&&(Q.clear(),Q=null,De=0),this.initialized=!1}indexHyperbolic(e,t,r){if(k())try{this.hyperbolicIndex||(this.hyperbolicIndex=at({dimensions:this.config.embeddingDimension,maxElements:this.config.hnsw.maxElements})),this.hyperbolicIndex.indexPattern(e,t,r)}catch(i){console.debug(`[PatternStore] Hyperbolic indexing failed for ${e}:`,i instanceof Error?i.message:i)}}async searchHyperbolic(e,t=10){if(!k()||!this.hyperbolicIndex)return b([]);try{let r=this.hyperbolicIndex.search(e,t),i=[];for(let s of r){let a=await this.get(s.patternId);if(!a)continue;let l=Math.exp(-s.distance),d=this.calculateReuseInfo(a,l);i.push({pattern:a,score:l,matchType:"vector",similarity:l,canReuse:d.canReuse,estimatedTokenSavings:d.estimatedTokenSavings,reuseConfidence:d.reuseConfidence})}return b(i)}catch(r){return console.warn("[PatternStore] Hyperbolic search failed, returning empty results:",r instanceof Error?r.message:r),b([])}}};function de(n,e){return Math.max(n,.75*n+.25*e)}function cn(n,e){try{if(F().useRVFPatternStore&&Le()){let r=process.env.AQE_PROJECT_ROOT??Ne(),i=ot(r,".agentic-qe"),s=ot(i,"patterns.rvf");if(Yt(i)){let a={...Y,...e},l=!1;try{let d=qe(i,a.embeddingDimension);if(d){l=!0;let o=new z(()=>d,{rvfPath:s,base:a,skipCloseOnDispose:!0,embeddingSpaceId:a.embeddingSpaceId});return console.log("[PatternStore] Using RVF-backed store (ADR-066)"),o}}catch{}if(!l){let d=new z((o,c)=>{let h,m=()=>{try{return He(o)}catch(f){return h=f,null}},u=m();if(!u&&G(h)&&(!ke(o)||(u=m(),!u&&G(h))))throw h;if(u){let f=u.dimension();if(f!==c){try{u.close()}catch{}throw new Error(`RVF dimension mismatch (file=${f}, requested=${c})`)}return u}try{return oe(o,c)}catch(f){if(u=m(),u){if(u.dimension()!==c){let g=u.dimension();try{u.close()}catch{}throw new Error(`RVF dimension mismatch (file=${g}, requested=${c})`)}return u}if(G(h))throw h;if(Ue(o,f instanceof Error?f.message:String(f),h))return oe(o,c);throw f}},{rvfPath:s,base:a,embeddingSpaceId:a.embeddingSpaceId});return console.log("[PatternStore] Using RVF-backed store (ADR-066)"),d}}}}catch(t){console.warn("[PatternStore] RVF store unavailable, using in-memory HNSW:",t instanceof Error?t.message:t)}return new Fe(n,e)}export{A as a,cn as b};
|
|
50
|
-
/*! Bundled license information:
|
|
51
|
-
|
|
52
|
-
fast-json-patch/commonjs/helpers.js:
|
|
53
|
-
(*!
|
|
54
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
55
|
-
* (c) 2017-2022 Joachim Wester
|
|
56
|
-
* MIT licensed
|
|
57
|
-
*)
|
|
58
|
-
|
|
59
|
-
fast-json-patch/commonjs/duplex.js:
|
|
60
|
-
(*!
|
|
61
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
62
|
-
* (c) 2017-2021 Joachim Wester
|
|
63
|
-
* MIT license
|
|
64
|
-
*)
|
|
65
|
-
*/
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{c as a,d as b,e as c}from"./chunk-QGA55PFM.js";import"./chunk-SJUXE4IC.js";import"./chunk-MJS53PRX.js";import"./chunk-64VGZQLB.js";c();export{a as VibiumClientImpl,b as VibiumClientProvider};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l}from"./chunk-D6CJIGRU.js";import"./chunk-Q7EAGKAE.js";import"./chunk-VMNWDJIZ.js";import"./chunk-P6OYS755.js";import"./chunk-PZPWRQ2M.js";import"./chunk-IAF6T27S.js";import"./chunk-E6G2RD5H.js";import"./chunk-GPYVDFB3.js";import"./chunk-PX5YDCRH.js";import"./chunk-YHKEDEAA.js";import"./chunk-3NIG7S5W.js";import"./chunk-UCFQALXO.js";import"./chunk-LL3IGZBI.js";import"./chunk-7Z5LHRC3.js";import"./chunk-CF2ISEOJ.js";import"./chunk-AJRUJAAK.js";import"./chunk-ELLBS5RP.js";import"./chunk-AVBJYI5I.js";import"./chunk-HM6ZSCPI.js";import"./chunk-6OS76PHI.js";import"./chunk-XAS3XRYM.js";import"./chunk-DZ3AUAAB.js";import"./chunk-6LIHFV7O.js";import"./chunk-UQ32JHES.js";import"./chunk-ZEV3YTO7.js";import"./chunk-ZVWVV4EX.js";import"./chunk-RTFO5UQH.js";import"./chunk-5QQSIGUA.js";import"./chunk-JBTPOIAC.js";import"./chunk-7NITCZWD.js";import"./chunk-QGA55PFM.js";import"./chunk-SJUXE4IC.js";import"./chunk-UKA2KOXE.js";import"./chunk-VGFFFKGK.js";import"./chunk-257E2A5M.js";import"./chunk-3EA536JF.js";import"./chunk-AHKELLIO.js";import"./chunk-CM7U6TAX.js";import"./chunk-72KXSMWI.js";import"./chunk-2NPKIBAZ.js";import"./chunk-FWASDOT2.js";import"./chunk-Y3UOUNHM.js";import"./chunk-BVR7RMC5.js";import"./chunk-V4DM6ELU.js";import"./chunk-JIXUMYKZ.js";import"./chunk-5OOMJGFN.js";import"./chunk-JZOS5FCX.js";import"./chunk-BBT64TII.js";import"./chunk-QDFTT3RF.js";import"./chunk-NMAIY4PX.js";import"./chunk-FZOBD67M.js";import"./chunk-TVYY3OCX.js";import"./chunk-ZSPU4MOS.js";import"./chunk-NQZ5AR3D.js";import"./chunk-NHWGMJAP.js";import"./chunk-B6D2CHEH.js";import"./chunk-BPEDWS6O.js";import"./chunk-GSF6MB64.js";import"./chunk-DHVX5UB2.js";import"./chunk-JXGFRBUO.js";import"./chunk-QZANMBIT.js";import"./chunk-RFNPJK6N.js";import"./chunk-YSLL6VSL.js";import"./chunk-2YXGBZWV.js";import"./chunk-GDSXITFH.js";import"./chunk-MBRHSU6W.js";import"./chunk-Z6GGIRQQ.js";import"./chunk-CD542DNJ.js";import"./chunk-7LPR6HJG.js";import"./chunk-7D3V65N5.js";import"./chunk-CCK4BF76.js";import"./chunk-YFBSPLJG.js";import"./chunk-7CUQCCMD.js";import"./chunk-3HZS4M3O.js";import"./chunk-ZCRTRYXK.js";import"./chunk-MQROI74N.js";import"./chunk-ZL6SYKUK.js";import"./chunk-7J6QC567.js";import"./chunk-H5BS5VH7.js";import"./chunk-MUOG6QXR.js";import"./chunk-WGM35YWL.js";import"./chunk-3EZOZN25.js";import"./chunk-Z7WODOTH.js";import"./chunk-IV5UZOHH.js";import"./chunk-Y3LZ35OG.js";import"./chunk-JVNTSNWU.js";import"./chunk-SMDN3BQZ.js";import"./chunk-6U7LNMWZ.js";import"./chunk-6RE3X4V5.js";import"./chunk-I33ERSGB.js";import"./chunk-IG5GNEC6.js";import"./chunk-BMAPORJ7.js";import"./chunk-4N23RFDU.js";import"./chunk-UNFFDHER.js";import"./chunk-2TMWAQQ3.js";import"./chunk-2JVWITNK.js";import"./chunk-Q5XTSMWR.js";import"./chunk-AIRGNL55.js";import"./chunk-QW6VMTBR.js";import"./chunk-SDRHUMJB.js";import"./chunk-5J6W7SIA.js";import"./chunk-KNNISEDY.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-MJS53PRX.js";import"./chunk-DPYSUDAO.js";import"./chunk-WCJBU2KI.js";import"./chunk-PI7TJS62.js";import"./chunk-EAY2JMZG.js";import"./chunk-C6KWXUFJ.js";import"./chunk-IB27QACC.js";import"./chunk-6SH5VZUD.js";import"./chunk-SESK3ARK.js";import"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";export{c as adoptExternalFleet,e as assignAgentLevel,k as disposeFleet,f as getAgentLevel,g as getAllAgentLevels,a as getFleetState,d as getFleetTopology,l as handleAQEHealth,j as handleFleetHealth,h as handleFleetInit,i as handleFleetStatus,b as isFleetInitialized};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a,b}from"./chunk-JXGFRBUO.js";import"./chunk-QZANMBIT.js";import"./chunk-KNNISEDY.js";import"./chunk-DPYSUDAO.js";import"./chunk-64VGZQLB.js";export{a as CrossDomainEventRouter,b as createCrossDomainRouter};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t,v as u}from"./chunk-257E2A5M.js";import"./chunk-3EA536JF.js";import"./chunk-AHKELLIO.js";import"./chunk-CM7U6TAX.js";import"./chunk-MBRHSU6W.js";import"./chunk-Z6GGIRQQ.js";import"./chunk-CD542DNJ.js";import"./chunk-7LPR6HJG.js";import"./chunk-7D3V65N5.js";import"./chunk-CCK4BF76.js";import"./chunk-YFBSPLJG.js";import"./chunk-7CUQCCMD.js";import"./chunk-3HZS4M3O.js";import"./chunk-Y3LZ35OG.js";import"./chunk-JVNTSNWU.js";import"./chunk-SMDN3BQZ.js";import"./chunk-6U7LNMWZ.js";import"./chunk-I33ERSGB.js";import"./chunk-IG5GNEC6.js";import"./chunk-4N23RFDU.js";import"./chunk-UNFFDHER.js";import"./chunk-2TMWAQQ3.js";import"./chunk-2JVWITNK.js";import"./chunk-Q5XTSMWR.js";import"./chunk-AIRGNL55.js";import"./chunk-QW6VMTBR.js";import"./chunk-SDRHUMJB.js";import"./chunk-5J6W7SIA.js";import"./chunk-KNNISEDY.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-MJS53PRX.js";import"./chunk-DPYSUDAO.js";import"./chunk-PI7TJS62.js";import"./chunk-EAY2JMZG.js";import"./chunk-C6KWXUFJ.js";import"./chunk-IB27QACC.js";import"./chunk-6SH5VZUD.js";import"./chunk-SESK3ARK.js";import"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";export{q as BUILT_IN_STRATEGIES,b as ConceptGraph,g as DEFAULT_ACTIVATION_CONFIG,a as DEFAULT_CONCEPT_GRAPH_CONFIG,m as DEFAULT_DREAM_CONFIG,s as DEFAULT_DREAM_SCHEDULER_CONFIG,i as DEFAULT_INSIGHT_CONFIG,k as DEFAULT_VALIDATION_THRESHOLDS,n as DreamEngine,t as DreamScheduler,f as HISTORY_TRIM_TARGET_RATIO,j as InsightGenerator,d as MAX_ACTIVATION_HISTORY_ENTRIES,e as MAX_COACTIVATION_ENTRIES,l as RVCOWBranchManager,r as SpeculativeDreamer,h as SpreadingActivation,c as createConceptGraph,o as createDreamEngine,u as createDreamScheduler,p as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{b as a}from"./chunk-66VWCR67.js";import"./chunk-ELLBS5RP.js";import"./chunk-AVBJYI5I.js";import"./chunk-HM6ZSCPI.js";import"./chunk-7D3V65N5.js";import"./chunk-2JVWITNK.js";import"./chunk-Q5XTSMWR.js";import"./chunk-AIRGNL55.js";import"./chunk-QW6VMTBR.js";import"./chunk-SDRHUMJB.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-MJS53PRX.js";import"./chunk-PI7TJS62.js";import"./chunk-EAY2JMZG.js";import"./chunk-C6KWXUFJ.js";import"./chunk-IB27QACC.js";import"./chunk-6SH5VZUD.js";import"./chunk-SESK3ARK.js";import"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";export{a as HeartbeatSchedulerWorker};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a,b}from"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";b();export{a as HnswAdapter};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a,b,c,d}from"./chunk-6RE3X4V5.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-IB27QACC.js";import"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";export{a as DEFAULT_HNSW_CONFIG,b as HNSWIndex,d as benchmarkHNSW,c as createHNSWIndex};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a,b}from"./chunk-BMAPORJ7.js";import"./chunk-2JVWITNK.js";import"./chunk-Q5XTSMWR.js";import"./chunk-AIRGNL55.js";import"./chunk-QW6VMTBR.js";import"./chunk-SDRHUMJB.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-MJS53PRX.js";import"./chunk-PI7TJS62.js";import"./chunk-EAY2JMZG.js";import"./chunk-C6KWXUFJ.js";import"./chunk-IB27QACC.js";import"./chunk-6SH5VZUD.js";import"./chunk-SESK3ARK.js";import"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";export{a as HybridMemoryBackend,b as createKernelMemoryBackend};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a}from"./chunk-JZOS5FCX.js";import"./chunk-BBT64TII.js";import"./chunk-QDFTT3RF.js";import"./chunk-3EZOZN25.js";import"./chunk-IV5UZOHH.js";import"./chunk-AIRGNL55.js";import"./chunk-KNNISEDY.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-MJS53PRX.js";import"./chunk-DPYSUDAO.js";import"./chunk-64VGZQLB.js";export{a as ImpactAnalyzerService};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a,b,c,d}from"./chunk-RETBYIAC.js";import"./chunk-W6HXLH5G.js";import"./chunk-6SQM2MUX.js";import"./chunk-5VFPCSK7.js";import"./chunk-JIXUMYKZ.js";import"./chunk-TVYY3OCX.js";import"./chunk-7D3V65N5.js";import"./chunk-AIRGNL55.js";import"./chunk-KNNISEDY.js";import"./chunk-MJS53PRX.js";import"./chunk-PI7TJS62.js";import"./chunk-EAY2JMZG.js";import"./chunk-64VGZQLB.js";export{a as InitOrchestrator,b as createInitOrchestrator,d as formatInitResult,c as quickInit};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{A as b,z as a}from"./chunk-GPYVDFB3.js";import"./chunk-PX5YDCRH.js";import"./chunk-YHKEDEAA.js";import"./chunk-3NIG7S5W.js";import"./chunk-UCFQALXO.js";import"./chunk-LL3IGZBI.js";import"./chunk-7Z5LHRC3.js";import"./chunk-AJRUJAAK.js";import"./chunk-XAS3XRYM.js";import"./chunk-DZ3AUAAB.js";import"./chunk-ZVWVV4EX.js";import"./chunk-7NITCZWD.js";import"./chunk-QGA55PFM.js";import"./chunk-SJUXE4IC.js";import"./chunk-UKA2KOXE.js";import"./chunk-VGFFFKGK.js";import"./chunk-257E2A5M.js";import"./chunk-3EA536JF.js";import"./chunk-AHKELLIO.js";import"./chunk-CM7U6TAX.js";import"./chunk-72KXSMWI.js";import"./chunk-Y3UOUNHM.js";import"./chunk-BVR7RMC5.js";import"./chunk-V4DM6ELU.js";import"./chunk-JIXUMYKZ.js";import"./chunk-5OOMJGFN.js";import"./chunk-JZOS5FCX.js";import"./chunk-BBT64TII.js";import"./chunk-QDFTT3RF.js";import"./chunk-ZSPU4MOS.js";import"./chunk-NQZ5AR3D.js";import"./chunk-B6D2CHEH.js";import"./chunk-BPEDWS6O.js";import"./chunk-GSF6MB64.js";import"./chunk-DHVX5UB2.js";import"./chunk-QZANMBIT.js";import"./chunk-MBRHSU6W.js";import"./chunk-Z6GGIRQQ.js";import"./chunk-CD542DNJ.js";import"./chunk-7LPR6HJG.js";import"./chunk-7D3V65N5.js";import"./chunk-CCK4BF76.js";import"./chunk-YFBSPLJG.js";import"./chunk-7CUQCCMD.js";import"./chunk-3HZS4M3O.js";import"./chunk-ZCRTRYXK.js";import"./chunk-MQROI74N.js";import"./chunk-ZL6SYKUK.js";import"./chunk-7J6QC567.js";import"./chunk-H5BS5VH7.js";import"./chunk-MUOG6QXR.js";import"./chunk-WGM35YWL.js";import"./chunk-3EZOZN25.js";import"./chunk-Z7WODOTH.js";import"./chunk-IV5UZOHH.js";import"./chunk-Y3LZ35OG.js";import"./chunk-JVNTSNWU.js";import"./chunk-SMDN3BQZ.js";import"./chunk-6U7LNMWZ.js";import"./chunk-6RE3X4V5.js";import"./chunk-I33ERSGB.js";import"./chunk-IG5GNEC6.js";import"./chunk-BMAPORJ7.js";import"./chunk-4N23RFDU.js";import"./chunk-UNFFDHER.js";import"./chunk-2TMWAQQ3.js";import"./chunk-2JVWITNK.js";import"./chunk-Q5XTSMWR.js";import"./chunk-AIRGNL55.js";import"./chunk-QW6VMTBR.js";import"./chunk-SDRHUMJB.js";import"./chunk-5J6W7SIA.js";import"./chunk-KNNISEDY.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-MJS53PRX.js";import"./chunk-DPYSUDAO.js";import"./chunk-WCJBU2KI.js";import"./chunk-PI7TJS62.js";import"./chunk-EAY2JMZG.js";import"./chunk-C6KWXUFJ.js";import"./chunk-IB27QACC.js";import"./chunk-6SH5VZUD.js";import"./chunk-SESK3ARK.js";import"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";export{a as QEKernelImpl,b as createKernel};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{g as a}from"./chunk-BBT64TII.js";import"./chunk-QDFTT3RF.js";import"./chunk-3EZOZN25.js";import"./chunk-IV5UZOHH.js";import"./chunk-AIRGNL55.js";import"./chunk-KNNISEDY.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-MJS53PRX.js";import"./chunk-64VGZQLB.js";export{a as KnowledgeGraphService};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a,b,c,d}from"./chunk-MQROI74N.js";import"./chunk-ZL6SYKUK.js";import"./chunk-7J6QC567.js";import"./chunk-H5BS5VH7.js";import"./chunk-MUOG6QXR.js";import"./chunk-WGM35YWL.js";import"./chunk-3EZOZN25.js";import"./chunk-Z7WODOTH.js";import"./chunk-IV5UZOHH.js";import"./chunk-2JVWITNK.js";import"./chunk-Q5XTSMWR.js";import"./chunk-AIRGNL55.js";import"./chunk-QW6VMTBR.js";import"./chunk-SDRHUMJB.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-MJS53PRX.js";import"./chunk-DPYSUDAO.js";import"./chunk-PI7TJS62.js";import"./chunk-EAY2JMZG.js";import"./chunk-C6KWXUFJ.js";import"./chunk-IB27QACC.js";import"./chunk-6SH5VZUD.js";import"./chunk-SESK3ARK.js";import"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";export{a as createLLMRouterService,d as extractProviderConfigs,b as pickEnabledProviders,c as pickPrimaryAndFallbacks};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a}from"./chunk-UQ32JHES.js";import"./chunk-5QQSIGUA.js";import"./chunk-BMAPORJ7.js";import"./chunk-2JVWITNK.js";import"./chunk-Q5XTSMWR.js";import"./chunk-AIRGNL55.js";import"./chunk-QW6VMTBR.js";import"./chunk-SDRHUMJB.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import"./chunk-MJS53PRX.js";import"./chunk-DPYSUDAO.js";import"./chunk-WCJBU2KI.js";import"./chunk-PI7TJS62.js";import"./chunk-EAY2JMZG.js";import"./chunk-C6KWXUFJ.js";import"./chunk-IB27QACC.js";import"./chunk-6SH5VZUD.js";import"./chunk-SESK3ARK.js";import"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";export{a as LoadTestTool};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a}from"./chunk-WCJBU2KI.js";import"./chunk-6SH5VZUD.js";import"./chunk-SESK3ARK.js";import"./chunk-64VGZQLB.js";export{a as InMemoryBackend};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{c as S,d as b}from"./chunk-D6CJIGRU.js";import"./chunk-Q7EAGKAE.js";import"./chunk-VMNWDJIZ.js";import"./chunk-P6OYS755.js";import"./chunk-PZPWRQ2M.js";import"./chunk-IAF6T27S.js";import"./chunk-E6G2RD5H.js";import"./chunk-GPYVDFB3.js";import"./chunk-PX5YDCRH.js";import"./chunk-YHKEDEAA.js";import"./chunk-3NIG7S5W.js";import"./chunk-UCFQALXO.js";import"./chunk-LL3IGZBI.js";import"./chunk-7Z5LHRC3.js";import"./chunk-CF2ISEOJ.js";import"./chunk-AJRUJAAK.js";import"./chunk-ELLBS5RP.js";import"./chunk-AVBJYI5I.js";import"./chunk-HM6ZSCPI.js";import"./chunk-6OS76PHI.js";import"./chunk-XAS3XRYM.js";import"./chunk-DZ3AUAAB.js";import"./chunk-6LIHFV7O.js";import"./chunk-UQ32JHES.js";import"./chunk-ZEV3YTO7.js";import"./chunk-ZVWVV4EX.js";import"./chunk-RTFO5UQH.js";import"./chunk-5QQSIGUA.js";import"./chunk-JBTPOIAC.js";import"./chunk-7NITCZWD.js";import"./chunk-QGA55PFM.js";import"./chunk-SJUXE4IC.js";import"./chunk-UKA2KOXE.js";import"./chunk-VGFFFKGK.js";import"./chunk-257E2A5M.js";import"./chunk-3EA536JF.js";import"./chunk-AHKELLIO.js";import"./chunk-CM7U6TAX.js";import"./chunk-72KXSMWI.js";import"./chunk-2NPKIBAZ.js";import"./chunk-FWASDOT2.js";import"./chunk-Y3UOUNHM.js";import"./chunk-BVR7RMC5.js";import"./chunk-V4DM6ELU.js";import"./chunk-JIXUMYKZ.js";import"./chunk-5OOMJGFN.js";import"./chunk-JZOS5FCX.js";import"./chunk-BBT64TII.js";import"./chunk-QDFTT3RF.js";import"./chunk-NMAIY4PX.js";import"./chunk-FZOBD67M.js";import"./chunk-TVYY3OCX.js";import"./chunk-ZSPU4MOS.js";import{a as u,b as w,d as v,e as d,f as m,i as R}from"./chunk-NQZ5AR3D.js";import"./chunk-NHWGMJAP.js";import"./chunk-B6D2CHEH.js";import"./chunk-BPEDWS6O.js";import"./chunk-GSF6MB64.js";import"./chunk-DHVX5UB2.js";import"./chunk-JXGFRBUO.js";import"./chunk-QZANMBIT.js";import"./chunk-RFNPJK6N.js";import"./chunk-YSLL6VSL.js";import"./chunk-2YXGBZWV.js";import"./chunk-GDSXITFH.js";import"./chunk-MBRHSU6W.js";import"./chunk-Z6GGIRQQ.js";import"./chunk-CD542DNJ.js";import"./chunk-7LPR6HJG.js";import"./chunk-7D3V65N5.js";import"./chunk-CCK4BF76.js";import"./chunk-YFBSPLJG.js";import"./chunk-7CUQCCMD.js";import"./chunk-3HZS4M3O.js";import"./chunk-ZCRTRYXK.js";import"./chunk-MQROI74N.js";import"./chunk-ZL6SYKUK.js";import"./chunk-7J6QC567.js";import"./chunk-H5BS5VH7.js";import"./chunk-MUOG6QXR.js";import"./chunk-WGM35YWL.js";import"./chunk-3EZOZN25.js";import"./chunk-Z7WODOTH.js";import"./chunk-IV5UZOHH.js";import"./chunk-Y3LZ35OG.js";import"./chunk-JVNTSNWU.js";import"./chunk-SMDN3BQZ.js";import"./chunk-6U7LNMWZ.js";import"./chunk-6RE3X4V5.js";import"./chunk-I33ERSGB.js";import"./chunk-IG5GNEC6.js";import"./chunk-BMAPORJ7.js";import"./chunk-4N23RFDU.js";import"./chunk-UNFFDHER.js";import{e as M}from"./chunk-2TMWAQQ3.js";import"./chunk-2JVWITNK.js";import"./chunk-Q5XTSMWR.js";import"./chunk-AIRGNL55.js";import"./chunk-QW6VMTBR.js";import"./chunk-SDRHUMJB.js";import"./chunk-5J6W7SIA.js";import"./chunk-KNNISEDY.js";import"./chunk-TCHGOB2N.js";import"./chunk-FBMN7B46.js";import"./chunk-ENGZ4D5V.js";import{a as i,c as p}from"./chunk-MJS53PRX.js";import"./chunk-DPYSUDAO.js";import"./chunk-WCJBU2KI.js";import"./chunk-PI7TJS62.js";import"./chunk-EAY2JMZG.js";import"./chunk-C6KWXUFJ.js";import"./chunk-IB27QACC.js";import"./chunk-6SH5VZUD.js";import"./chunk-SESK3ARK.js";import"./chunk-SNOBH4AZ.js";import"./chunk-IQO7UCFR.js";import"./chunk-DUYOVM5I.js";import"./chunk-64VGZQLB.js";p();var P=null;function _(e){P=e}function c(){return b()?S().kernel.memory:P}async function V(e){let r=c();if(!r)return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let t=e.namespace||"default",o=`${t}:${e.key}`;if(u()){let s=m(e.key,e.value,t,{tags:e.metadata?.tags}),a=await d.evaluateWrite(s);if(!a.allowed){if(w()&&R.recordViolation({type:"contradiction",severity:"medium",gate:"memoryWriteGate",description:`Memory write blocked for key ${e.key}: ${a.reason}`,context:{key:e.key,namespace:t,reason:a.reason,conflictingPatterns:a.conflictingPatterns}}),v())return{success:!1,error:`Memory write blocked by governance: ${a.reason}`};console.warn(`[MemoryHandler] Write allowed with warning: ${a.reason}`)}}await r.set(o,e.value,{ttl:e.ttl});let n;try{let s=`${e.key} ${JSON.stringify(e.value)}`,a=await M(s);await r.storeVector(o,a,{key:e.key,namespace:t,storedAt:Date.now()}),n={status:"indexed"}}catch{let s="Semantic vector indexing is unavailable for this entry. Configure AQE_EMBEDDER_ENDPOINT for the recommended remote backend. The compatible local @huggingface/transformers@4.2.0 dependency chain currently has unresolved HIGH advisories GHSA-xcpc-8h2w-3j85 and GHSA-f88m-g3jw-g9cj.";console.warn(`[MemoryHandler] VECTOR_INDEX_UNAVAILABLE: ${s}`),n={status:"failed",error:{code:"VECTOR_INDEX_UNAVAILABLE",message:s}}}return u()&&d.registerPattern(m(e.key,e.value,t)),{success:!0,data:{stored:!0,key:e.key,namespace:t,timestamp:new Date().toISOString(),persisted:!0,vectorIndex:n}}}catch(t){return{success:!1,error:`Failed to store memory: ${i(t)}`}}}async function B(e){let r=c();if(!r)return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let o=`${e.namespace||"default"}:${e.key}`,n=await r.get(o);if(n===void 0)return{success:!0,data:{found:!1,key:e.key}};let s={found:!0,key:e.key,value:n,timestamp:new Date().toISOString()};return e.includeMetadata&&(s.metadata={}),{success:!0,data:s}}catch(t){return{success:!1,error:`Failed to retrieve memory: ${i(t)}`}}}function A(e){return e.includes(" ")&&!e.includes("*")&&!e.includes("?")}async function z(e){let r=c();if(!r)return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let t=e.namespace||"default",o=e.limit||100,n=e.offset||0;if((e.semantic===!0||e.semantic!==!1&&e.pattern&&A(e.pattern))&&e.pattern)try{let l=await M(e.pattern),y=t!=="default"?`${t}:`:void 0,h=await r.vectorSearch(l,o+n,y);return{success:!0,data:{entries:h.slice(n,n+o).map(k=>{let g=k.key.split(":");return{key:g.length>1?g.slice(1).join(":"):k.key,namespace:g.length>1?g[0]:t,score:k.score}}),total:h.length,hasMore:n+o<h.length,searchType:"semantic",searchProvenance:r.getVectorSearchProvenance?.()}}}catch(l){console.error(`[MemoryHandler] Semantic search failed, falling back to pattern: ${i(l)}`)}let a=e.pattern?`${t}:${e.pattern}`:`${t}:*`,f=await r.search(a,o+n);return{success:!0,data:{entries:f.slice(n,n+o).map(l=>{let y=l.split(":");return{key:y.slice(1).join(":"),namespace:y[0]}}),total:f.length,hasMore:n+o<f.length,searchType:"pattern"}}}catch(t){return{success:!1,error:`Failed to query memory: ${i(t)}`}}}async function N(e){let r=c();if(!r)return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let t=e.namespace||"default",o=`${t}:${e.key}`;return{success:!0,data:{deleted:await r.delete(o),key:e.key,namespace:t}}}catch(t){return{success:!1,error:`Failed to delete memory: ${i(t)}`}}}async function G(){let e=c();if(!e)return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let r=await e.search("*",1e4),t=0,o=1;try{let n=e;n.getVectorStats&&(t=(await n.getVectorStats())?.vectorCount??0);let s=new Set(r.map(a=>a.split(":")[0]).filter(Boolean));o=Math.max(1,s.size)}catch{}return{success:!0,data:{entries:r.length,vectors:t,namespaces:o,size:{current:r.length,limit:Number.MAX_SAFE_INTEGER,unit:"entries"}}}}catch(r){return{success:!1,error:`Failed to get memory usage: ${i(r)}`}}}async function H(e){let r=c();if(!r)return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let t=`shared:${e.knowledgeDomain}:${Date.now()}`,o={source:e.sourceAgentId,targets:e.targetAgentIds,domain:e.knowledgeDomain,content:e.knowledgeContent,timestamp:new Date().toISOString()};if(u()){let n=m(t,o,e.knowledgeDomain,{agentId:e.sourceAgentId}),s=await d.evaluateWrite(n);if(!s.allowed&&(w()&&R.recordViolation({type:"contradiction",severity:"medium",agentId:e.sourceAgentId,gate:"memoryWriteGate",description:`Shared knowledge blocked for domain ${e.knowledgeDomain}: ${s.reason}`,context:{sourceAgent:e.sourceAgentId,targetAgents:e.targetAgentIds,domain:e.knowledgeDomain,reason:s.reason}}),v()))return{success:!1,error:`Knowledge sharing blocked by governance: ${s.reason}`}}return await r.set(t,o,{namespace:"agent-knowledge"}),u()&&d.registerPattern(m(t,o,e.knowledgeDomain)),{success:!0,data:{shared:!0,sourceAgent:e.sourceAgentId,targetAgents:e.targetAgentIds,domain:e.knowledgeDomain}}}catch(t){return{success:!1,error:`Failed to share memory: ${i(t)}`}}}export{N as handleMemoryDelete,z as handleMemoryQuery,B as handleMemoryRetrieve,H as handleMemoryShare,V as handleMemoryStore,G as handleMemoryUsage,_ as setStandaloneMemoryBackend};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a}from"./chunk-6U7LNMWZ.js";import"./chunk-QW6VMTBR.js";import"./chunk-DPYSUDAO.js";import"./chunk-64VGZQLB.js";export{a as PatternNullStore};
|
|
@@ -1,2 +0,0 @@
|
|
|
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.14.6");process.exit(0)}
|
|
2
|
-
import{a,b}from"./chunk-JBTPOIAC.js";import"./chunk-7NITCZWD.js";import"./chunk-DHVX5UB2.js";import"./chunk-KNNISEDY.js";import"./chunk-MJS53PRX.js";import"./chunk-DPYSUDAO.js";import"./chunk-64VGZQLB.js";export{a as DefaultProtocolExecutor,b as createProtocolExecutor};
|