agentic-qe 3.10.4 → 3.10.5
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/qcsd-development-swarm/SKILL.md +27 -6
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +71 -0
- package/dist/arena/arena.d.ts +68 -0
- package/dist/arena/arena.js +169 -0
- package/dist/arena/mutator.d.ts +23 -0
- package/dist/arena/mutator.js +112 -0
- package/dist/arena/rng.d.ts +15 -0
- package/dist/arena/rng.js +34 -0
- package/dist/arena/runner.d.ts +44 -0
- package/dist/arena/runner.js +79 -0
- package/dist/cli/bundle.js +7 -7
- package/dist/cli/chunks/adapter-XZVL3DHO.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-EJPDSWON.js → agent-booster-wasm-3BC5LIEB.js} +2 -2
- package/dist/cli/chunks/{agent-handler-2DZB7LGI.js → agent-handler-QLXWVZZF.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-SSFYAVIK.js → agent-memory-branch-3U5PDYW7.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-YIL25K6W.js +2 -0
- package/dist/cli/chunks/arena-BMJQK4RD.js +18 -0
- package/dist/cli/chunks/arena-XENAGV4I.js +4 -0
- package/dist/cli/chunks/{audit-42XG5JFB.js → audit-WPIRUJNZ.js} +2 -2
- package/dist/cli/chunks/base-YCYV23Q3.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-3TZFES5I.js → better-sqlite3-6AGIBSVE.js} +2 -2
- package/dist/cli/chunks/{brain-handler-LFHX2TYP.js → brain-handler-PHSWG5PR.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-AX7DKGV7.js → branch-enumerator-LNSYT34I.js} +2 -2
- package/dist/cli/chunks/{browser-4NYLZ7FA.js → browser-M5BVQMBI.js} +2 -2
- package/dist/cli/chunks/browser-workflow-ALCOCRA2.js +2 -0
- package/dist/cli/chunks/{chunk-Q53M4LI7.js → chunk-24A7KD3D.js} +1 -1
- package/dist/cli/chunks/{chunk-HTLAPMTK.js → chunk-253TDTPH.js} +1 -1
- package/dist/cli/chunks/{chunk-EGTOSQZK.js → chunk-2RLRPKCG.js} +2 -2
- package/dist/cli/chunks/{chunk-2G2PVVQG.js → chunk-2UQWVF4P.js} +2 -2
- package/dist/cli/chunks/{chunk-KGPAWNNR.js → chunk-2Z7HIT5I.js} +1 -1
- package/dist/cli/chunks/{chunk-KJ56OXH4.js → chunk-3BGGNHHZ.js} +1 -1
- package/dist/cli/chunks/{chunk-VJ2D6FST.js → chunk-3JWV4GE6.js} +2 -2
- package/dist/cli/chunks/{chunk-XBFEHVBO.js → chunk-3KGUP2SD.js} +2 -2
- package/dist/cli/chunks/{chunk-JRBGHWAM.js → chunk-3WOQY6UL.js} +2 -2
- package/dist/cli/chunks/{chunk-V5G3SMAJ.js → chunk-4FTO3TPH.js} +2 -2
- package/dist/cli/chunks/{chunk-L6VNEEN6.js → chunk-4K7T6AKM.js} +1 -1
- package/dist/cli/chunks/{chunk-WIYWDON4.js → chunk-4Z7XH4JE.js} +2 -2
- package/dist/cli/chunks/{chunk-ISRTT4I7.js → chunk-54IPDQIZ.js} +8 -8
- package/dist/cli/chunks/{chunk-IYFMDIYZ.js → chunk-56RA6YPN.js} +2 -2
- package/dist/cli/chunks/{chunk-M4ARHDY4.js → chunk-5D7GLMT3.js} +1 -1
- package/dist/cli/chunks/{chunk-6SCIX2W2.js → chunk-66LOFIBP.js} +2 -2
- package/dist/cli/chunks/{chunk-K7K4TFJM.js → chunk-6SAU7GXO.js} +1 -1
- package/dist/cli/chunks/{chunk-KUFC4DBX.js → chunk-75MP7JMV.js} +1 -1
- package/dist/cli/chunks/{chunk-PISW5HUX.js → chunk-7DU35D4M.js} +1 -1
- package/dist/cli/chunks/{chunk-MIQBRVK2.js → chunk-7JZCEQFR.js} +1 -1
- package/dist/cli/chunks/{chunk-XVA56PXZ.js → chunk-A3BDPU5F.js} +4 -4
- package/dist/cli/chunks/{chunk-DAIM72HV.js → chunk-A7HGS7FW.js} +2 -2
- package/dist/cli/chunks/{chunk-EWI37TJA.js → chunk-AMBIOEMO.js} +1 -1
- package/dist/cli/chunks/{chunk-IPAQ4HVX.js → chunk-AVQD7KEN.js} +2 -2
- package/dist/cli/chunks/{chunk-FDFJJFQT.js → chunk-AZCKTAUI.js} +2 -2
- package/dist/cli/chunks/{chunk-JYR3X4OC.js → chunk-B4F5EPNR.js} +1 -1
- package/dist/cli/chunks/{chunk-LYKSIOOT.js → chunk-BB7MEGXD.js} +2 -2
- package/dist/cli/chunks/{chunk-N4CXUGXE.js → chunk-BSRCL6RU.js} +2 -2
- package/dist/cli/chunks/{chunk-IAK76TIZ.js → chunk-CS3UB2OL.js} +1 -1
- package/dist/cli/chunks/{chunk-RUC3FCRK.js → chunk-CTG3GJIM.js} +2 -2
- package/dist/cli/chunks/{chunk-AMW27FSS.js → chunk-CUAM34RQ.js} +3 -3
- package/dist/cli/chunks/{chunk-M2PSXKTG.js → chunk-CUY2EUSQ.js} +2 -2
- package/dist/cli/chunks/{chunk-3UGUX34A.js → chunk-D3Q4443B.js} +1 -1
- package/dist/cli/chunks/{chunk-NJYI7HX7.js → chunk-D4WDJ4ZF.js} +2 -2
- package/dist/cli/chunks/{chunk-U27GVYXA.js → chunk-D7NKRCIL.js} +2 -2
- package/dist/cli/chunks/{chunk-7BQXEYRV.js → chunk-DBR4TQPK.js} +2 -2
- package/dist/cli/chunks/{chunk-USB7GCIC.js → chunk-DIJ74M7V.js} +1 -1
- package/dist/cli/chunks/{chunk-XJXCSCCP.js → chunk-DJQYZ4RZ.js} +1 -1
- package/dist/cli/chunks/{chunk-VJOPNK2L.js → chunk-DN65ILSI.js} +2 -2
- package/dist/cli/chunks/{chunk-Y2EDDV5U.js → chunk-DWLGFYXV.js} +2 -2
- package/dist/cli/chunks/{chunk-OKKTDHHF.js → chunk-EIL7FQC4.js} +4 -4
- package/dist/cli/chunks/{chunk-GDMH7NPV.js → chunk-FE3FGMNB.js} +2 -2
- package/dist/cli/chunks/{chunk-SXMGNMFL.js → chunk-FLYFNNSN.js} +3 -3
- package/dist/cli/chunks/{chunk-N244P4MM.js → chunk-FNJZBIR3.js} +2 -2
- package/dist/cli/chunks/{chunk-PZCSJZVJ.js → chunk-FPWA73N6.js} +2 -2
- package/dist/cli/chunks/{chunk-MQ5WMWUK.js → chunk-FW3C4LWU.js} +2 -2
- package/dist/cli/chunks/{chunk-YSLE6NNG.js → chunk-G4GX6YKX.js} +2 -2
- package/dist/cli/chunks/{chunk-F34OO2Q7.js → chunk-G5UIGH4C.js} +3 -3
- package/dist/cli/chunks/{chunk-UXJVR323.js → chunk-G6FP3S3G.js} +2 -2
- package/dist/cli/chunks/{chunk-SZKFT6CD.js → chunk-GDUGW6FZ.js} +2 -2
- package/dist/cli/chunks/{chunk-ZM4QGYGK.js → chunk-GKG6IQP6.js} +3 -3
- package/dist/cli/chunks/{chunk-F77X5DAF.js → chunk-GMU7P5O3.js} +2 -2
- package/dist/cli/chunks/{chunk-EMZ3DXMG.js → chunk-GTVXVYKE.js} +2 -2
- package/dist/cli/chunks/{chunk-KCXE2LZU.js → chunk-HHEHGERJ.js} +2 -2
- package/dist/cli/chunks/{chunk-GILL32E2.js → chunk-HKJ3LG3N.js} +2 -2
- package/dist/cli/chunks/{chunk-E6CGBOZY.js → chunk-HNYSBE5J.js} +2 -2
- package/dist/cli/chunks/{chunk-UWAUYDW4.js → chunk-HPKYIK7R.js} +2 -2
- package/dist/cli/chunks/{chunk-3ISX5B77.js → chunk-HRORJ352.js} +2 -2
- package/dist/cli/chunks/{chunk-PLD4IGDL.js → chunk-IIFCTJOF.js} +2 -2
- package/dist/cli/chunks/{chunk-C2446H7G.js → chunk-IOE6LDPF.js} +2 -2
- package/dist/cli/chunks/{chunk-UFKVKNAA.js → chunk-IRS4HKAR.js} +1 -1
- package/dist/cli/chunks/{chunk-4BX72XG4.js → chunk-IT7CEHAJ.js} +2 -2
- package/dist/cli/chunks/{chunk-GLMDRGJD.js → chunk-IUKERFLT.js} +1 -1
- package/dist/cli/chunks/{chunk-LKK3NIHC.js → chunk-IVKSZNMI.js} +1 -1
- package/dist/cli/chunks/{chunk-WI5WXYIS.js → chunk-IWRORKD7.js} +2 -2
- package/dist/cli/chunks/{chunk-5T2HDET6.js → chunk-J533CJUN.js} +3 -3
- package/dist/cli/chunks/{chunk-OO7KJ34Y.js → chunk-JPOEI7CJ.js} +2 -2
- package/dist/cli/chunks/{chunk-B6CT4ILU.js → chunk-JY7T2AQQ.js} +4 -4
- package/dist/cli/chunks/{chunk-TBJ566KV.js → chunk-K5KKZWED.js} +2 -2
- package/dist/cli/chunks/{chunk-RJKYPWFD.js → chunk-KIMJPTHD.js} +2 -2
- package/dist/cli/chunks/{chunk-MHWYQHGN.js → chunk-MEN3UW7W.js} +1 -1
- package/dist/cli/chunks/{chunk-KWZEBHAP.js → chunk-MFQIJ3HV.js} +2 -2
- package/dist/cli/chunks/{chunk-MDWJXSBA.js → chunk-MGCW5FWH.js} +2 -2
- package/dist/cli/chunks/{chunk-TWAWEP4X.js → chunk-MIMJVKJJ.js} +3 -3
- package/dist/cli/chunks/{chunk-N3MM4Z33.js → chunk-MJRYHHOG.js} +2 -2
- package/dist/cli/chunks/{chunk-K7CW2X6U.js → chunk-MRXKIXVV.js} +2 -2
- package/dist/cli/chunks/{chunk-XDZXLEJK.js → chunk-MWPFUBXS.js} +2 -2
- package/dist/cli/chunks/{chunk-ND6YSW5N.js → chunk-N2TJXGHG.js} +1 -1
- package/dist/cli/chunks/{chunk-6WF2MOQB.js → chunk-NGSA53GC.js} +2 -2
- package/dist/cli/chunks/{chunk-AIBE3J4A.js → chunk-NKW7VOZV.js} +1 -1
- package/dist/cli/chunks/{chunk-D7IWGQTW.js → chunk-O5OOUMBB.js} +2 -2
- package/dist/cli/chunks/{chunk-O3SG32PS.js → chunk-OATHXZYW.js} +1 -1
- package/dist/cli/chunks/{chunk-QPMAXDJ2.js → chunk-OJNG6ZXG.js} +2 -2
- package/dist/cli/chunks/{chunk-LHPR7ROV.js → chunk-PGNQR2VM.js} +1 -1
- package/dist/cli/chunks/{chunk-M3MKP5VN.js → chunk-PPM5D7LH.js} +1 -1
- package/dist/cli/chunks/{chunk-MKZQBBCU.js → chunk-PYBVFG6T.js} +2 -2
- package/dist/cli/chunks/{chunk-BEFRQOLH.js → chunk-Q6BKJZTG.js} +2 -2
- package/dist/cli/chunks/chunk-QAW6RVAR.js +699 -0
- package/dist/cli/chunks/{chunk-MQIAN57O.js → chunk-QTDZS4U6.js} +2 -2
- package/dist/cli/chunks/{chunk-NZGLDOU4.js → chunk-R573V37S.js} +2 -2
- package/dist/cli/chunks/{chunk-OV4BLIKJ.js → chunk-RCAIOTIF.js} +2 -2
- package/dist/cli/chunks/{chunk-TCV5DASI.js → chunk-RFNEEDPQ.js} +2 -2
- package/dist/cli/chunks/{chunk-M5DBKHM4.js → chunk-RFVZMNYX.js} +2 -2
- package/dist/cli/chunks/{chunk-MWV4KPOB.js → chunk-RLU7764Y.js} +2 -2
- package/dist/cli/chunks/chunk-RLZDXQNM.js +2 -0
- package/dist/cli/chunks/{chunk-6OLHPWSN.js → chunk-RONMVGCT.js} +2 -2
- package/dist/cli/chunks/{chunk-STMMZXS6.js → chunk-RR55MLD4.js} +1 -1
- package/dist/cli/chunks/{chunk-VDKMBOUK.js → chunk-RUQV3BTV.js} +1 -1
- package/dist/cli/chunks/{chunk-OIFJH7TF.js → chunk-RZ7D5SHS.js} +1 -1
- package/dist/cli/chunks/{chunk-2B6ETC7C.js → chunk-S73KENCH.js} +2 -2
- package/dist/cli/chunks/{chunk-4FTLYIMW.js → chunk-S7FGTHFE.js} +2 -2
- package/dist/cli/chunks/{chunk-SVILIQQQ.js → chunk-S7HQOGVD.js} +1 -1
- package/dist/cli/chunks/{chunk-Z4BTPQLG.js → chunk-SK6YRNXI.js} +2 -2
- package/dist/cli/chunks/{chunk-GS33ZRJH.js → chunk-SXQIH2QA.js} +2 -2
- package/dist/cli/chunks/{chunk-MU4P4P4E.js → chunk-TISBFSDJ.js} +1 -1
- package/dist/cli/chunks/{chunk-5Q3L4QEE.js → chunk-TMD6IC6D.js} +2 -2
- package/dist/cli/chunks/{chunk-LOFA3U4X.js → chunk-TMTLWSSA.js} +1 -1
- package/dist/cli/chunks/{chunk-UW3ZSFFB.js → chunk-UOIT5JZ6.js} +2 -2
- package/dist/cli/chunks/{chunk-FQ7I4JBQ.js → chunk-UTORITJT.js} +2 -2
- package/dist/cli/chunks/{chunk-AZJYDM2K.js → chunk-VB7DZVCI.js} +1 -1
- package/dist/cli/chunks/{chunk-VRE2EBFI.js → chunk-VC256KH2.js} +2 -2
- package/dist/cli/chunks/{chunk-WYMQ6FZR.js → chunk-VESYE5YO.js} +3 -3
- package/dist/cli/chunks/{chunk-DPKECIKN.js → chunk-VKWDMOR4.js} +2 -2
- package/dist/cli/chunks/{chunk-SC6UFGJ6.js → chunk-VWN66V7U.js} +2 -2
- package/dist/cli/chunks/{chunk-2TYO4VZH.js → chunk-W5C7R2LS.js} +3 -3
- package/dist/cli/chunks/{chunk-D7PI4CYZ.js → chunk-W7KGHW4T.js} +2 -2
- package/dist/cli/chunks/{chunk-7VO5IEJ2.js → chunk-WFZ4DRIC.js} +2 -2
- package/dist/cli/chunks/{chunk-NSRDP7RD.js → chunk-WFZUKXV5.js} +2 -2
- package/dist/cli/chunks/{chunk-SJC7OKF3.js → chunk-X4B3R3ZZ.js} +2 -2
- package/dist/cli/chunks/{chunk-5FNNCVXR.js → chunk-XI6ZZMX7.js} +1 -1
- package/dist/cli/chunks/{chunk-K72J52JO.js → chunk-YEO2Z3UX.js} +2 -2
- package/dist/cli/chunks/{chunk-PMWWWYUM.js → chunk-YZD4VIE5.js} +1 -1
- package/dist/cli/chunks/{chunk-F6QPAVWS.js → chunk-YZFNPTGN.js} +2 -2
- package/dist/cli/chunks/{chunk-5T4J3IPG.js → chunk-ZCYKWEAM.js} +2 -2
- package/dist/cli/chunks/{chunk-PWJZZCHJ.js → chunk-ZG3DSWUA.js} +1 -1
- package/dist/cli/chunks/{chunk-2L5VFVCG.js → chunk-ZS4BGJJV.js} +1 -1
- package/dist/cli/chunks/{chunk-ICF5RPQU.js → chunk-ZT7JSFGT.js} +2 -2
- package/dist/cli/chunks/{chunk-MFWWPRBV.js → chunk-ZTC64OJE.js} +2 -2
- package/dist/cli/chunks/{chunk-G5FPWH5O.js → chunk-ZUBJBAUD.js} +15 -15
- package/dist/cli/chunks/{ci-2BLMQNX3.js → ci-M2BSQBLL.js} +2 -2
- package/dist/cli/chunks/{ci-output-XK4PPSN7.js → ci-output-Z4TMK6GZ.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-W7X4NPFE.js → circuit-breaker-E3G4GGWB.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-GLBLSYNJ.js → claude-flow-setup-MASRQU54.js} +2 -2
- package/dist/cli/chunks/client-RPB6RYVY.js +2 -0
- package/dist/cli/chunks/{cline-installer-7WX7DBGI.js → cline-installer-P3BWAKQA.js} +2 -2
- package/dist/cli/chunks/{code-SP3HAQWG.js → code-7HY5HQAV.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-44HH36UG.js → code-index-extractor-MBVKLOEU.js} +2 -2
- package/dist/cli/chunks/{codex-installer-LMXRWLPU.js → codex-installer-WZ6QO2PH.js} +2 -2
- package/dist/cli/chunks/{completions-GL5FTZAN.js → completions-TOJC2UFP.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-CQMYGETL.js → complexity-analyzer-QYVDIAAW.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-CYVYS5B7.js → continuedev-installer-J72CV7P4.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-M7XVII2A.js → copilot-installer-ACDA3GEA.js} +2 -2
- package/dist/cli/chunks/core-handlers-QFJT5NX6.js +2 -0
- package/dist/cli/chunks/{cost-tracker-S4ET4FH3.js → cost-tracker-BAYQJELE.js} +2 -2
- package/dist/cli/chunks/{coverage-DFVSSQ4A.js → coverage-QD3XJV6W.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-5GJ7WZKX.js +2 -0
- package/dist/cli/chunks/{cursor-installer-KWDSQPQC.js → cursor-installer-SPGZ4TQM.js} +2 -2
- package/dist/cli/chunks/{daemon-2HD54QVO.js → daemon-3EVOL2UH.js} +3 -3
- package/dist/cli/chunks/{daemon-CRX46BBO.js → daemon-N4JKD5SO.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-SCP6WPZB.js → dag-attention-scheduler-3BVLL3L5.js} +2 -2
- package/dist/cli/chunks/{detect-XS2GDCEX.js → detect-SWACKB45.js} +2 -2
- package/dist/cli/chunks/{dist-node-U43MVQ3F.js → dist-node-LU4E7PI6.js} +2 -2
- package/dist/cli/chunks/{domain-handler-HITMDULH.js → domain-handler-5AKKAC43.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-TJF7DNI4.js → domain-transfer-LB6H7RPX.js} +2 -2
- package/dist/cli/chunks/dream-C6VNLTON.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-JKG33YZK.js → embed-and-insert-pattern-7RBA5NDK.js} +2 -2
- package/dist/cli/chunks/{eval-NF5Y4W37.js → eval-ZZFPRENX.js} +5 -5
- package/dist/cli/chunks/{experience-capture-middleware-VMMFYJ4D.js → experience-capture-middleware-HRO3EGIW.js} +3 -3
- package/dist/cli/chunks/{fast-paths-W2Q53IR2.js → fast-paths-IRRNQBTY.js} +2 -2
- package/dist/cli/chunks/{feature-flags-B4PBMQJO.js → feature-flags-R5N5IWI2.js} +2 -2
- package/dist/cli/chunks/{feature-flags-PVI7A4RE.js → feature-flags-W54ABAUA.js} +2 -2
- package/dist/cli/chunks/{file-discovery-E4L3I33I.js → file-discovery-6CIDLVID.js} +2 -2
- package/dist/cli/chunks/{fleet-LE5SHVLK.js → fleet-YTFN64WE.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-MWWJBLOH.js → gnn-wrapper-RXMPLMV2.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-XOUVNPQK.js → heartbeat-handler-HQQWEEQQ.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-4SBO27BG.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-W7G6VNXW.js +2 -0
- package/dist/cli/chunks/hnsw-index-LENA5QML.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-W3T5ZDDP.js → hnsw-legacy-bridge-GPZIKYFD.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-PX5JM3DG.js → hnswlib-node-P6HSEFLW.js} +2 -2
- package/dist/cli/chunks/hooks-AYLAGFOK.js +285 -0
- package/dist/cli/chunks/hybrid-router-IXHIC45P.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-VDFK3JYH.js → hypergraph-engine-56FMXI3T.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-EUDGEF25.js → hypergraph-handler-APEVT5IE.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-DKGVMYU6.js +2 -0
- package/dist/cli/chunks/{init-handler-MZEAJOZK.js → init-handler-5DWF4REQ.js} +6 -6
- package/dist/cli/chunks/init-wizard-BBY3LY3F.js +2 -0
- package/dist/cli/chunks/kernel-7CUW7G62.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-ECBYWT6M.js → kilocode-installer-XKAUA5VA.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-KYFCSYTG.js → kiro-installer-NI2KIYJE.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-Q5CP47IP.js +2 -0
- package/dist/cli/chunks/{learning-4RAFMDSB.js → learning-ZIUMUNXZ.js} +3 -3
- package/dist/cli/chunks/{llm-router-JHBNLYP3.js → llm-router-IL52EF2V.js} +4 -4
- package/dist/cli/chunks/llm-router-service-MTXCX7TO.js +2 -0
- package/dist/cli/chunks/{load-4DVQML7P.js → load-B5LFYD6O.js} +2 -2
- package/dist/cli/chunks/load-test-YBWXASBO.js +2 -0
- package/dist/cli/chunks/{mcp-LCWMU4GZ.js → mcp-K6GZLWBC.js} +2 -2
- package/dist/cli/chunks/{memory-3DTJAURT.js → memory-NCQRVSN6.js} +5 -5
- package/dist/cli/chunks/memory-backend-52LANEA3.js +2 -0
- package/dist/cli/chunks/{memory-handlers-BL6E3XAK.js → memory-handlers-KFW3HYAP.js} +2 -2
- package/dist/cli/chunks/{multi-model-executor-AVR5SZOO.js → multi-model-executor-R4LBSJWK.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-DW2426QM.js → opencode-installer-I6CBR3PV.js} +2 -2
- package/dist/cli/chunks/{orchestrator-AHF4W5GS.js → orchestrator-5FXUCES6.js} +10 -10
- package/dist/cli/chunks/{pipeline-N6THEWYE.js → pipeline-GDKCTXJH.js} +2 -2
- package/dist/cli/chunks/{platform-MRCFQF7X.js → platform-ZFY3F4T3.js} +2 -2
- package/dist/cli/chunks/{plugin-6YKUN5QM.js → plugin-HQMEN3OS.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-2YPAHSVS.js → prime-radiant-advanced-wasm-LSJGF4CV.js} +2 -2
- package/dist/cli/chunks/protocol-executor-TRYUS77M.js +2 -0
- package/dist/cli/chunks/{protocol-handler-Y2NMUKWQ.js → protocol-handler-BMDNIGPP.js} +2 -2
- package/dist/cli/chunks/{prove-DZUNWBFD.js → prove-ABVGAG4Z.js} +2 -2
- package/dist/cli/chunks/provider-manager-6XQQN7FX.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-3IUPE4DJ.js +2 -0
- package/dist/cli/chunks/{quality-AIFQMGUV.js → quality-ENJXPNP5.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-VWPH4XPX.js +2 -0
- package/dist/cli/chunks/{real-embeddings-5XL4LOG2.js → real-embeddings-W3GNAEJO.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-LV3WONT5.js → roocode-installer-4FJNQ7PU.js} +2 -2
- package/dist/cli/chunks/router-OIB6ODHA.js +2 -0
- package/dist/cli/chunks/routing-feedback-EKYPCZYG.js +2 -0
- package/dist/cli/chunks/{routing-handler-WSMUILGD.js → routing-handler-GFS5FA4F.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-BCEIDTW3.js → ruvector-commands-GBMYNJKN.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-LRSPC6H3.js → rvf-dual-writer-STUAQT6U.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-QHNX6353.js → rvf-migration-adapter-LO6DBNJH.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-SLNB3XPW.js → rvf-migration-coordinator-I5AD4VJ2.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-7RXP2Q4Q.js +2 -0
- package/dist/cli/chunks/safe-db-MNKFEPBX.js +2 -0
- package/dist/cli/chunks/schedule-AJXABVXX.js +2 -0
- package/dist/cli/chunks/scheduler-LDWYHIAW.js +2 -0
- package/dist/cli/chunks/{security-CYY6TECQ.js → security-X3WCA5K5.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-U6JE4O6A.js → shared-rvf-adapter-Z4FSPWNP.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-PJBSNBRV.js → shared-rvf-dual-writer-QOPOIRIC.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-A6GKDMOJ.js +2 -0
- package/dist/cli/chunks/{status-handler-W723LXX5.js → status-handler-B2B5QBVK.js} +2 -2
- package/dist/cli/chunks/{structural-health-WZUPZBB5.js → structural-health-KT47LBVH.js} +2 -2
- package/dist/cli/chunks/{sync-ZLMF53TB.js → sync-CKID22IW.js} +2 -2
- package/dist/cli/chunks/{sync-UA22CKUS.js → sync-VWD6OOUR.js} +2 -2
- package/dist/cli/chunks/{task-handler-SENTEEXZ.js → task-handler-X5JT5YBF.js} +2 -2
- package/dist/cli/chunks/{task-handlers-FGVUZOCC.js → task-handlers-IW4GQDW4.js} +3 -3
- package/dist/cli/chunks/{test-Q37C3WI2.js → test-MBZSUASD.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-E6SPIBTH.js → test-scheduling-E5KHKRZS.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-HQFFMZUF.js → token-bootstrap-TIDPJ5IG.js} +2 -2
- package/dist/cli/chunks/{token-usage-JHNWTZ7L.js → token-usage-ECJSPOQB.js} +2 -2
- package/dist/cli/chunks/{transformers-TEXDUVNI.js → transformers-UZJAQ7OZ.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-MWSS52H6.js → tree-sitter-wasm-parser-H6BU2E5R.js} +2 -2
- package/dist/cli/chunks/{types-YQRKHYH3.js → types-PM7NT3MH.js} +2 -2
- package/dist/cli/chunks/unified-memory-27QJHABO.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-76VUXR4H.js +2 -0
- package/dist/cli/chunks/unified-persistence-QRCGDEXH.js +2 -0
- package/dist/cli/chunks/{upgrade-JKMEDURI.js → upgrade-FS2XYC2P.js} +2 -2
- package/dist/cli/chunks/{validate-URO7G6OE.js → validate-4Y2BNN3A.js} +3 -3
- package/dist/cli/chunks/{validate-swarm-VZVJ56Z5.js → validate-swarm-Z7QXZSUE.js} +4 -4
- package/dist/cli/chunks/{vibium-G5WZILL6.js → vibium-VZ6L3O2G.js} +2 -2
- package/dist/cli/chunks/visual-security-KB27O7BE.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-LECH5T6H.js → web-tree-sitter-H7P37W5U.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-2NPLC2YW.js → windsurf-installer-IB2VHSZS.js} +2 -2
- package/dist/cli/chunks/{witness-chain-X347C36A.js → witness-chain-C4DISYJN.js} +2 -2
- package/dist/cli/chunks/witness-chain-EYPXHRDV.js +2 -0
- package/dist/cli/chunks/{workflow-V4ALYZ73.js → workflow-IGM7KVIO.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-6AQZ3USU.js +2 -0
- package/dist/cli/chunks/{wrappers-QXOPRPR4.js → wrappers-PQXC263L.js} +2 -2
- package/dist/cli/commands/arena.d.ts +10 -0
- package/dist/cli/commands/arena.js +129 -0
- package/dist/cli/commands/hooks-handlers/command-hooks.js +38 -2
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.d.ts +4 -0
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +66 -3
- package/dist/cli/commands/hooks-handlers/nesting-provenance.d.ts +27 -0
- package/dist/cli/commands/hooks-handlers/nesting-provenance.js +46 -0
- package/dist/cli/commands/hooks-handlers/task-hooks.js +22 -1
- package/dist/cli/commands/hooks-handlers/tool-loop-guardrail.d.ts +71 -0
- package/dist/cli/commands/hooks-handlers/tool-loop-guardrail.js +142 -0
- package/dist/cli/index.js +17 -0
- package/dist/contracts/verdicts.d.ts +297 -0
- package/dist/contracts/verdicts.js +178 -0
- package/dist/coordination/queen-types.d.ts +4 -0
- package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js +15 -6
- package/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.js +12 -0
- package/dist/mcp/bundle.js +368 -368
- package/dist/mcp/handlers/core-handlers.d.ts +20 -0
- package/dist/mcp/handlers/core-handlers.js +28 -0
- package/dist/mcp/handlers/domain-handler-configs.d.ts +3 -0
- package/dist/mcp/handlers/domain-handler-configs.js +22 -10
- package/dist/shared/llm/cost-tracker.js +6 -2
- package/dist/shared/llm/interfaces.d.ts +4 -0
- package/dist/shared/llm/providers/claude.js +16 -2
- package/dist/shared/reasoning-scrub.d.ts +29 -0
- package/dist/shared/reasoning-scrub.js +75 -0
- package/package.json +1 -1
- package/dist/cli/chunks/adapter-A62ETL5C.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-MTCRAV6N.js +0 -2
- package/dist/cli/chunks/base-KKEBUHZC.js +0 -2
- package/dist/cli/chunks/browser-workflow-XHYAJUB6.js +0 -2
- package/dist/cli/chunks/chunk-HPYGMKZF.js +0 -2
- package/dist/cli/chunks/chunk-PZ4PRZXN.js +0 -699
- package/dist/cli/chunks/client-C6CJOCRN.js +0 -2
- package/dist/cli/chunks/cross-domain-router-I3GEA5G6.js +0 -2
- package/dist/cli/chunks/dream-JCQMG2RL.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-FBHE4ZWH.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-EOOA4WXD.js +0 -2
- package/dist/cli/chunks/hnsw-index-TD3KRPND.js +0 -2
- package/dist/cli/chunks/hooks-RUPQVIUM.js +0 -250
- package/dist/cli/chunks/hybrid-router-64O6PXZ2.js +0 -2
- package/dist/cli/chunks/impact-analyzer-ITQHXGTM.js +0 -2
- package/dist/cli/chunks/init-wizard-DZ4IKGQI.js +0 -2
- package/dist/cli/chunks/kernel-HSVY4ZYK.js +0 -2
- package/dist/cli/chunks/knowledge-graph-H32TXXX4.js +0 -2
- package/dist/cli/chunks/llm-router-service-3FKESBUX.js +0 -2
- package/dist/cli/chunks/load-test-LKHURZGZ.js +0 -2
- package/dist/cli/chunks/memory-backend-XRJRZ6CK.js +0 -2
- package/dist/cli/chunks/protocol-executor-KABPB6PQ.js +0 -2
- package/dist/cli/chunks/provider-manager-U7EBM3FA.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-64O2OQIW.js +0 -2
- package/dist/cli/chunks/queen-coordinator-SV3COGIL.js +0 -2
- package/dist/cli/chunks/router-QARRPMED.js +0 -2
- package/dist/cli/chunks/routing-feedback-KD2JFTPK.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-4LLGF5AY.js +0 -2
- package/dist/cli/chunks/safe-db-RAX3H2P7.js +0 -2
- package/dist/cli/chunks/schedule-RQZGLLUY.js +0 -2
- package/dist/cli/chunks/scheduler-ACWTN4LN.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-SWNBO257.js +0 -2
- package/dist/cli/chunks/unified-memory-QG3FDRKR.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-KOR4EOIG.js +0 -2
- package/dist/cli/chunks/unified-persistence-J6NIRYKM.js +0 -2
- package/dist/cli/chunks/visual-security-RAWV6YLN.js +0 -2
- package/dist/cli/chunks/witness-chain-ZO7FIM35.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-7SKITNIJ.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-S7FGTHFE.js";import"./chunk-S7HQOGVD.js";q();export{a as DEFAULT_FEATURE_FLAGS,n as configureForCI,o as configureForDevelopment,p as configureForHeuristicMode,b as getVibiumFeatureFlags,m as initVibiumFeatureFlagsFromEnv,j as isAutoRetryEnabled,l as isAxeCoreEnabled,e as isBrowserModeEnabled,i as isDefaultHeadless,h as isE2EExecutionEnabled,f as isScreenshotCaptureEnabled,g as isVisualRegressionEnabled,d as resetVibiumFeatureFlags,c as setVibiumFeatureFlags,k as shouldLogPerformanceMetrics};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.
|
|
2
|
-
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,S as R,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,S as R,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";R();export{a as DEFAULT_FEATURE_FLAGS,b as getRuVectorFeatureFlags,A as getRvfMigrationStage,Q as initFeatureFlagsFromEnv,y as isAgentMemoryBranchingEnabled,t as isCNNVisualRegressionEnabled,O as isCognitiveRoutingEnabled,v as isCoherenceActionGateEnabled,r as isCoherenceGateEnabled,H as isColdTierGNNEnabled,o as isCrossDomainTransferEnabled,C as isCusumDriftDetectionEnabled,u as isDAGAttentionEnabled,D as isDeltaEventSourcingEnabled,l as isDeterministicDitherEnabled,M as isEpropOnlineLearningEnabled,E as isEwcPlusPlusEnabled,f as isFlashAttentionEnabled,g as isGNNIndexEnabled,N as isGrangerCausalityEnabled,F as isGraphMAEEnabled,B as isHDCFingerprintingEnabled,p as isHnswHealthMonitorEnabled,G as isHopfieldMemoryEnabled,P as isHyperbolicHnswEnabled,I as isMetaLearningEnabled,k as isMetadataFilteringEnabled,i as isNativeHNSWEnabled,m as isNeuralRoutingEnabled,x as isRVFPatternStoreEnabled,w as isReasoningQECEnabled,q as isRegretTrackingEnabled,L as isReservoirReplayEnabled,e as isSONAEnabled,n as isSONAThreeLoopEnabled,K as isSpectralSparsificationEnabled,J as isSublinearSolverEnabled,j as isTemporalCompressionEnabled,z as isUnifiedHnswEnabled,s as isWitnessChainEnabled,d as resetRuVectorFeatureFlags,c as setRuVectorFeatureFlags,h as shouldLogMigrationMetrics};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.
|
|
2
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a,b}from"./chunk-AMBIOEMO.js";import"./chunk-S7HQOGVD.js";export{a as SOURCE_EXTENSIONS,b as walkSourceFiles};
|
|
@@ -1,8 +1,8 @@
|
|
|
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.10.
|
|
2
|
-
import{a as k,b as K,c as x,d as T,e as H,f as F,g as Q,j as _}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a as k,b as K,c as x,d as T,e as H,f as F,g as Q,j as _}from"./chunk-TISBFSDJ.js";import{c as C,d as S}from"./chunk-75MP7JMV.js";import{a as v,b as V}from"./chunk-X4B3R3ZZ.js";import{a as G}from"./chunk-JY7T2AQQ.js";import"./chunk-3JWV4GE6.js";import"./chunk-ZG3DSWUA.js";import"./chunk-B4F5EPNR.js";import{a as W}from"./chunk-2RLRPKCG.js";import{a as E}from"./chunk-GDUGW6FZ.js";import{d as j}from"./chunk-VESYE5YO.js";import"./chunk-4K7T6AKM.js";import"./chunk-ZS4BGJJV.js";import"./chunk-CTG3GJIM.js";import{b as N}from"./chunk-HKJ3LG3N.js";import"./chunk-VKWDMOR4.js";import{v as q}from"./chunk-54IPDQIZ.js";import"./chunk-D3Q4443B.js";import"./chunk-FLYFNNSN.js";import"./chunk-MGCW5FWH.js";import"./chunk-PPM5D7LH.js";import"./chunk-VB7DZVCI.js";import"./chunk-IVKSZNMI.js";import"./chunk-RR55MLD4.js";import"./chunk-RLU7764Y.js";import"./chunk-SK6YRNXI.js";import"./chunk-YZD4VIE5.js";import"./chunk-7JZCEQFR.js";import"./chunk-G5UIGH4C.js";import"./chunk-S7FGTHFE.js";import"./chunk-A3BDPU5F.js";import"./chunk-66LOFIBP.js";import{c as L}from"./chunk-IT7CEHAJ.js";import"./chunk-FE3FGMNB.js";import"./chunk-BSRCL6RU.js";import"./chunk-IOE6LDPF.js";import"./chunk-RFVZMNYX.js";import"./chunk-MIMJVKJJ.js";import"./chunk-DN65ILSI.js";import"./chunk-NGSA53GC.js";import"./chunk-3WOQY6UL.js";import"./chunk-4FTO3TPH.js";import"./chunk-ZUBJBAUD.js";import"./chunk-Q6BKJZTG.js";import"./chunk-JPOEI7CJ.js";import"./chunk-DJQYZ4RZ.js";import"./chunk-MEN3UW7W.js";import"./chunk-CS3UB2OL.js";import"./chunk-K5KKZWED.js";import"./chunk-FPWA73N6.js";import"./chunk-UOIT5JZ6.js";import"./chunk-AZCKTAUI.js";import"./chunk-W5C7R2LS.js";import"./chunk-TMD6IC6D.js";import"./chunk-CUAM34RQ.js";import"./chunk-EIL7FQC4.js";import"./chunk-IUKERFLT.js";import"./chunk-VWN66V7U.js";import"./chunk-RUQV3BTV.js";import"./chunk-RZ7D5SHS.js";import"./chunk-2Z7HIT5I.js";import"./chunk-QTDZS4U6.js";import"./chunk-G4GX6YKX.js";import"./chunk-3KGUP2SD.js";import"./chunk-W7KGHW4T.js";import"./chunk-MWPFUBXS.js";import"./chunk-CUY2EUSQ.js";import"./chunk-RFNEEDPQ.js";import"./chunk-J533CJUN.js";import"./chunk-R573V37S.js";import"./chunk-YEO2Z3UX.js";import"./chunk-D7NKRCIL.js";import"./chunk-56RA6YPN.js";import"./chunk-MFQIJ3HV.js";import"./chunk-MRXKIXVV.js";import"./chunk-RLZDXQNM.js";import"./chunk-VC256KH2.js";import{a as I}from"./chunk-IRS4HKAR.js";import{a as B,c as ee}from"./chunk-S73KENCH.js";import"./chunk-7DU35D4M.js";import"./chunk-HHEHGERJ.js";import{a as z,b as te}from"./chunk-KIMJPTHD.js";import"./chunk-2UQWVF4P.js";import"./chunk-HPKYIK7R.js";import{c as $,d as ne}from"./chunk-MJRYHHOG.js";import"./chunk-RONMVGCT.js";import"./chunk-IWRORKD7.js";import"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";ne();import{Command as ie}from"commander";import t from"chalk";ee();te();import h from"chalk";import{existsSync as oe}from"fs";import{join as P}from"path";var R=class{projectRoot;options;orchestrator;constructor(e){this.options=e,this.projectRoot=e.projectRoot}async checkCodeIntelligence(){if(this.options.skipCodeScan)return console.log(h.yellow(" Code intelligence scan skipped (--skip-code-scan flag)")),{codeIntelligence:{hasIndex:!1,entryCount:0,wasPrompted:!1,scanRequested:!1},shouldProceed:!0,skipReason:"skip-flag"};if(await this.hasCodeIntelligenceIndex()){let i=await this.getKGEntryCount();return console.log(h.green(` \u2713 Code intelligence index found (${i} entries)`)),{codeIntelligence:{hasIndex:!0,entryCount:i,wasPrompted:!1,scanRequested:!1},shouldProceed:!0}}return!this.options.nonInteractive&&(console.log(h.yellow(`
|
|
3
3
|
\u26A0 No code intelligence index found`)),console.log(h.gray(" Building a knowledge graph improves agent accuracy by 80%")),console.log(h.gray(" This is a one-time operation and can be run later with:")),console.log(h.cyan(` aqe code-intelligence index
|
|
4
4
|
`)),await this.promptScan())?{codeIntelligence:{hasIndex:!1,entryCount:0,wasPrompted:!0,scanRequested:!0},shouldProceed:!1,skipReason:"scan-requested"}:(console.log(h.gray(" Continuing without code intelligence index")),{codeIntelligence:{hasIndex:!1,entryCount:0,wasPrompted:!this.options.nonInteractive,scanRequested:!1},shouldProceed:!0})}async runCodeIntelligenceScan(){try{if(console.log(h.blue(`
|
|
5
|
-
Building code intelligence knowledge graph...`)),this.orchestrator||(this.orchestrator=new G({projectRoot:this.projectRoot,autoMode:!0,...this.options.initOptions})),await this.hasCodeIntelligenceIndex()){let s=await this.getKGEntryCount();return console.log(h.green(` \u2713 Index already exists (${s} entries)`)),{success:!0,entries:s}}let{KnowledgeGraphService:i}=await import("./knowledge-graph-
|
|
5
|
+
Building code intelligence knowledge graph...`)),this.orchestrator||(this.orchestrator=new G({projectRoot:this.projectRoot,autoMode:!0,...this.options.initOptions})),await this.hasCodeIntelligenceIndex()){let s=await this.getKGEntryCount();return console.log(h.green(` \u2713 Index already exists (${s} entries)`)),{success:!0,entries:s}}let{KnowledgeGraphService:i}=await import("./knowledge-graph-Q5CP47IP.js"),{InMemoryBackend:c}=await import("./memory-backend-52LANEA3.js"),m=new c;await m.initialize();let n=new i(m,{namespace:"code-intelligence:kg",enableVectorEmbeddings:!0}),g=await(await import("fast-glob")).default(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx","**/*.py"],{cwd:this.projectRoot,ignore:["node_modules/**","dist/**","coverage/**",".agentic-qe/**"]});console.log(h.gray(` Indexing ${g.length} files...`));let o=await n.index({paths:g.map(s=>P(this.projectRoot,s)),incremental:!1,includeTests:!0});if(n.destroy(),o.success){let s=o.value.nodesCreated+o.value.edgesCreated;return console.log(h.green(` \u2713 Indexed ${s} knowledge graph entries`)),{success:!0,entries:s}}return console.log(h.yellow(" \u26A0 Code intelligence scan completed with warnings")),{success:!1,entries:0}}catch(e){return console.error(h.red(" \u2717 Code intelligence scan failed:"),B(e)),{success:!1,entries:0}}}async getStatusForAgents(){let e=await this.hasCodeIntelligenceIndex(),i=e?await this.getKGEntryCount():0;return{codeIntelligenceAvailable:e,knowledgeGraphSize:i,recommendedCapabilities:e?["semantic-search","code-analysis","context-aware"]:["basic-analysis"]}}async hasCodeIntelligenceIndex(){let e=P(this.projectRoot,".agentic-qe","memory.db");if(!oe(e))return!1;try{let i=z(e),c=i.prepare(`
|
|
6
6
|
SELECT COUNT(*) as count FROM kv_store
|
|
7
7
|
WHERE namespace = 'code-intelligence:kg'
|
|
8
8
|
`).get();return i.close(),c.count>0}catch{return!1}}async getKGEntryCount(){let e=P(this.projectRoot,".agentic-qe","memory.db");try{let i=z(e),c=i.prepare(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"./chunk-IOE6LDPF.js";import"./chunk-56RA6YPN.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";export{e as GNNLayerFactory,c as QEGNNEmbeddingIndex,d as QEGNNIndexFactory,f as TensorCompressionFactory,p as batchDifferentiableSearch,i as getDifferentiableSearch,k as getGetCompressionLevel,j as getHierarchicalForward,l as getInit,g as getRuvectorLayer,h as getTensorCompress,b as initGNN,a as isGNNAvailable,m as toFloat32Array,o as toIEmbedding,n as toNumberArray};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.
|
|
2
|
-
import{b as d}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{b as d}from"./chunk-3BGGNHHZ.js";import{a as c,c as f}from"./chunk-S73KENCH.js";import"./chunk-S7HQOGVD.js";import*as s from"fs";import*as l from"path";import e from"chalk";f();var h=class{name="heartbeat";description="Manage the token-free heartbeat scheduler";cleanupAndExit;worker;constructor(t){this.cleanupAndExit=t}async getWorker(){if(!this.worker){let{HeartbeatSchedulerWorker:t}=await import("./heartbeat-scheduler-4SBO27BG.js");this.worker=new t}return this.worker}register(t,o){let a=t.command("heartbeat").description(this.description);a.command("status").description("Show heartbeat worker status, health, and schedule").action(async()=>{await this.executeStatus()}),a.command("run-now").description("Trigger an immediate heartbeat cycle").option("-t, --timeout <ms>","Timeout in milliseconds (default: worker built-in 60s)").action(async n=>{let i=n.timeout?parseInt(n.timeout,10):void 0;await this.executeRunNow(i)}),a.command("history").description("Show recent heartbeat results").option("-n, --count <count>","Number of entries to show","10").action(async n=>{await this.executeHistory(parseInt(n.count,10)||10)}),a.command("log").description("Show today's daily log entries").option("-d, --date <date>","Show log for specific date (YYYY-MM-DD)").action(async n=>{await this.executeLog(n.date)}),a.command("pause").description("Pause the heartbeat worker").action(async()=>{await this.executePause()}),a.command("resume").description("Resume the heartbeat worker").action(async()=>{await this.executeResume()})}async executeStatus(){try{this.worker=await this.getWorker(),await this.worker.initialize();let t=this.worker.getHealth(),o=this.worker.lastResult;if(console.log(e.blue(`
|
|
3
3
|
Heartbeat Scheduler Status`)),console.log(e.gray(" "+"\u2500".repeat(35))),console.log(` Status: ${x(t.status)}`),console.log(` Health Score: ${y(t.healthScore)}${e.gray("/100")}`),this.worker.lastRunAt){let n=p(this.worker.lastRunAt);console.log(` Last Run: ${e.cyan(this.worker.lastRunAt.toISOString().replace("T"," ").slice(0,19))} ${e.gray(`(${n})`)}`)}else console.log(` Last Run: ${e.gray("never")}`);if(this.worker.nextRunAt){let n=p(this.worker.nextRunAt,!0);console.log(` Next Run: ${e.cyan(this.worker.nextRunAt.toISOString().replace("T"," ").slice(0,19))} ${e.gray(`(${n})`)}`)}console.log(` Total Runs: ${e.cyan(String(t.totalExecutions))}`);let a=t.totalExecutions>0?(t.successfulExecutions/t.totalExecutions*100).toFixed(1):"100.0";if(console.log(` Success Rate: ${e.cyan(a+"%")}`),o?.metrics?.domainMetrics){let n=o.metrics.domainMetrics;console.log(""),console.log(e.blue(" Last Result:")),console.log(` Promoted: ${e.cyan(String(n.promoted??0))} patterns`),console.log(` Deprecated: ${e.cyan(String(n.deprecated??0))} patterns`),console.log(` Decayed: ${e.cyan(String(n.decayed??0))} patterns`),console.log(` Pending Exp: ${e.cyan(String(n.pendingExperiences??0))}`),console.log(` Avg Conf: ${e.cyan(String(n.avgConfidence??0))}`)}console.log(""),await this.cleanupAndExit(0)}catch(t){console.error(e.red(`
|
|
4
4
|
Failed to get heartbeat status:`),c(t)),await this.cleanupAndExit(1)}}async executeRunNow(t){try{this.worker=await this.getWorker(),console.log(e.blue(`
|
|
5
5
|
Triggering heartbeat cycle...
|
|
@@ -8,7 +8,7 @@ import{b as d}from"./chunk-KJ56OXH4.js";import{a as c,c as f}from"./chunk-2B6ETC
|
|
|
8
8
|
Heartbeat History (last ${o.length})`)),console.log(e.gray(" "+"\u2500".repeat(60)));for(let a of o){let n=a.success?e.green("OK"):e.red("FAIL"),i=a.timestamp.slice(0,19).replace("T"," "),u=a.domainMetrics||{};console.log(` ${e.gray(i)} ${n} score:${e.cyan(String(a.healthScore))} +${u.promoted??0}/-${u.deprecated??0} ${e.gray(d(a.durationMs))}`)}console.log(""),await this.cleanupAndExit(0)}catch(o){console.error(e.red(`
|
|
9
9
|
Failed to load history:`),c(o)),await this.cleanupAndExit(1)}}async executeLog(t){try{let o=t||new Date().toISOString().split("T")[0];if(!/^\d{4}-\d{2}-\d{2}$/.test(o)){console.error(e.red(`
|
|
10
10
|
Invalid date format: "${o}". Use YYYY-MM-DD.
|
|
11
|
-
`)),await this.cleanupAndExit(1);return}let{findProjectRoot:a}=await import("./unified-memory-
|
|
11
|
+
`)),await this.cleanupAndExit(1);return}let{findProjectRoot:a}=await import("./unified-memory-27QJHABO.js"),n=l.join(a(),".agentic-qe","logs"),i=l.join(n,`${o}.md`);if(!s.existsSync(i)){console.log(e.yellow(`
|
|
12
12
|
No daily log found for ${o}.
|
|
13
13
|
`)),await this.cleanupAndExit(0);return}let u=s.readFileSync(i,"utf-8");console.log(e.blue(`
|
|
14
14
|
Daily Log \u2014 ${o}`)),console.log(e.gray(" "+"\u2500".repeat(40)));for(let g of u.split(`
|
|
@@ -45,4 +45,4 @@ Examples:
|
|
|
45
45
|
aqe heartbeat log --date 2026-03-25
|
|
46
46
|
aqe heartbeat pause
|
|
47
47
|
aqe heartbeat resume
|
|
48
|
-
`}},m=100;async function w(){let{findProjectRoot:r}=await import("./unified-memory-
|
|
48
|
+
`}},m=100;async function w(){let{findProjectRoot:r}=await import("./unified-memory-27QJHABO.js");return l.join(r(),".agentic-qe","heartbeat-history.json")}async function b(r){try{let t=await w(),o=l.dirname(t);s.existsSync(o)||s.mkdirSync(o,{recursive:!0});let a=[];if(s.existsSync(t))try{a=JSON.parse(s.readFileSync(t,"utf-8"))}catch{a=[]}a.unshift({timestamp:r.timestamp.toISOString(),success:r.success,durationMs:r.durationMs,healthScore:r.metrics.healthScore,domainMetrics:r.metrics.domainMetrics}),a.length>m&&(a=a.slice(0,m)),s.writeFileSync(t,JSON.stringify(a,null,2))}catch{}}async function S(r){try{let t=await w();return s.existsSync(t)?JSON.parse(s.readFileSync(t,"utf-8")).slice(0,r):[]}catch{return[]}}function x(r){switch(r){case"idle":return e.cyan(r);case"running":return e.yellow(r);case"paused":return e.yellow(r);case"stopped":return e.gray(r);case"error":return e.red(r);default:return e.white(r)}}function y(r){return r>=80?e.green(String(r)):r>=50?e.yellow(String(r)):e.red(String(r))}function k(r){switch(r){case"improving":return e.green(r);case"stable":return e.cyan(r);case"degrading":return e.red(r);default:return e.gray(r)}}function p(r,t=!1){let o=t?r.getTime()-Date.now():Date.now()-r.getTime();return o<0?t?"now":"just now":o<6e4?`${Math.floor(o/1e3)}s ${t?"from now":"ago"}`:o<36e5?`${Math.floor(o/6e4)}m ${t?"from now":"ago"}`:`${Math.floor(o/36e5)}h ${t?"from now":"ago"}`}function A(r){return new h(r)}export{h as HeartbeatHandler,A as createHeartbeatHandler};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{b as a}from"./chunk-OJNG6ZXG.js";import"./chunk-PYBVFG6T.js";import"./chunk-PGNQR2VM.js";import"./chunk-RZ7D5SHS.js";import"./chunk-R573V37S.js";import"./chunk-YEO2Z3UX.js";import"./chunk-D7NKRCIL.js";import"./chunk-56RA6YPN.js";import"./chunk-RLZDXQNM.js";import"./chunk-VC256KH2.js";import"./chunk-S73KENCH.js";import"./chunk-KIMJPTHD.js";import"./chunk-2UQWVF4P.js";import"./chunk-HPKYIK7R.js";import"./chunk-MJRYHHOG.js";import"./chunk-RONMVGCT.js";import"./chunk-IWRORKD7.js";import"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";export{a as HeartbeatSchedulerWorker};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a,c as b}from"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";b();export{a as HnswAdapter};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a,b,c,d}from"./chunk-MRXKIXVV.js";import"./chunk-RLZDXQNM.js";import"./chunk-VC256KH2.js";import"./chunk-MJRYHHOG.js";import"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";export{a as DEFAULT_HNSW_CONFIG,b as HNSWIndex,d as benchmarkHNSW,c as createHNSWIndex};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import"./chunk-S7HQOGVD.js";var s=class{adapter;metadataMap=new Map;insertCount=0;constructor(e){this.adapter=e}async initialize(){}async insert(e,t,r){this.adapter.addByStringId(e,t),this.insertCount++,r&&this.metadataMap.set(e,r)}async search(e,t){return this.adapter.searchByArray(e,t).map(a=>({key:a.id,score:a.score,distance:1-a.score,metadata:this.metadataMap.get(a.id)}))}async batchInsert(e){for(let t of e)await this.insert(t.key,t.vector,t.metadata)}async delete(e){let t=this.adapter.removeByStringId(e);return t&&this.metadataMap.delete(e),t}async getStats(){return{nativeHNSW:!0,backendType:"ruvector-gnn",vectorCount:this.adapter.size(),indexSizeBytes:this.adapter.size()*this.adapter.dimensions()*4,avgSearchLatencyMs:this.adapter.lastSearchLatencyMs,p95SearchLatencyMs:0,p99SearchLatencyMs:0,searchOperations:0,insertOperations:this.insertCount}}async clear(){this.adapter.clear(),this.metadataMap.clear(),this.insertCount=0}isNativeAvailable(){return!0}};export{s as HnswLegacyBridge};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q as p}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q as p}from"./chunk-A7HGS7FW.js";import"./chunk-S7HQOGVD.js";p();export{i as DotProductAttention,h as FlashAttention,k as HyperbolicAttention,l as LinearAttention,m as MoEAttention,j as MultiHeadAttention,b as RuvectorLayer,n as SonaEngine,c as TensorCompress,a as default,d as differentiableSearch,f as getCompressionLevel,e as hierarchicalForward,g as init,o as pipeline};
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
3
|
+
import{a as K}from"./chunk-5D7GLMT3.js";import{a as v,b as fe,c as he}from"./chunk-FLYFNNSN.js";import{a as ue}from"./chunk-K5KKZWED.js";import{a as pe,b as ge}from"./chunk-TMD6IC6D.js";import{d as z,h as ne}from"./chunk-CUAM34RQ.js";import"./chunk-EIL7FQC4.js";import"./chunk-IUKERFLT.js";import"./chunk-VWN66V7U.js";import"./chunk-RUQV3BTV.js";import{b as X}from"./chunk-RZ7D5SHS.js";import"./chunk-2Z7HIT5I.js";import"./chunk-QTDZS4U6.js";import"./chunk-G4GX6YKX.js";import{a as me}from"./chunk-RFNEEDPQ.js";import"./chunk-J533CJUN.js";import{i as j,m as M}from"./chunk-R573V37S.js";import"./chunk-YEO2Z3UX.js";import{b as R}from"./chunk-D7NKRCIL.js";import{b as le,d as $e}from"./chunk-56RA6YPN.js";import"./chunk-MFQIJ3HV.js";import{a as xe}from"./chunk-RLZDXQNM.js";import{c as de}from"./chunk-VC256KH2.js";import"./chunk-IRS4HKAR.js";import"./chunk-S73KENCH.js";import"./chunk-7DU35D4M.js";import"./chunk-KIMJPTHD.js";import"./chunk-2UQWVF4P.js";import"./chunk-HPKYIK7R.js";import"./chunk-MJRYHHOG.js";import"./chunk-RONMVGCT.js";import"./chunk-IWRORKD7.js";import"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";import{Command as st}from"commander";import x from"chalk";import ke from"node:path";M();import{randomUUID as U}from"crypto";import H from"chalk";var F="dream-scheduler:hook-state";async function D(o){try{let e=await o.get(F);return e||(e={lastDreamTime:null,experienceCount:0,sessionStartTime:new Date().toISOString(),totalDreamsThisSession:0}),e.experienceCount++,await o.set(F,e),e.experienceCount}catch{return 0}}async function G(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-27QJHABO.js"),t=e();t.isInitialized()||await t.initialize();let{initializeExperienceCapture:n}=await import("./experience-capture-middleware-HRO3EGIW.js");await n();let r=t.getDatabase();try{r.pragma("busy_timeout = 60000")}catch{}let s=`cli-${Date.now()}-${U().slice(0,8)}`,a=o.durationMs||0,c;if(o.success){let i=a>0&&a<5e3?.1:0,h=o.source.includes("post-task")?.1:o.source.includes("post-edit")?.05:0;c=Math.min(.95,.7+i+h)}else{let i=o.source.includes("post-task")?.15:o.source.includes("post-edit")?.1:0;c=Math.min(.6,.3+i)}r.prepare(`
|
|
4
|
+
INSERT OR REPLACE INTO captured_experiences
|
|
5
|
+
(id, task, agent, domain, success, quality, duration_ms,
|
|
6
|
+
started_at, completed_at, source)
|
|
7
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, datetime('now'), datetime('now'), ?)
|
|
8
|
+
`).run(s,o.task.slice(0,500),o.agent,o.domain,o.success?1:0,c,a,o.source),(async()=>{try{let{computeRealEmbedding:i}=await import("./real-embeddings-W3GNAEJO.js"),h=`${o.domain}: ${o.task}`.slice(0,512),l=await i(h);r.prepare("UPDATE captured_experiences SET embedding = ?, embedding_dimension = ? WHERE id = ?").run(Buffer.from(new Float32Array(l).buffer),l.length,s)}catch{}})()}catch(e){console.error(H.dim(`[hooks] persistCommandExperience: ${e instanceof Error?e.message:"unknown"}`))}}async function oe(o){let{getUnifiedMemory:e}=await import("./unified-memory-27QJHABO.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}try{n.exec(`
|
|
9
|
+
CREATE TABLE IF NOT EXISTS captured_experiences (
|
|
10
|
+
id TEXT PRIMARY KEY,
|
|
11
|
+
task TEXT NOT NULL,
|
|
12
|
+
agent TEXT NOT NULL,
|
|
13
|
+
domain TEXT NOT NULL DEFAULT '',
|
|
14
|
+
success INTEGER NOT NULL DEFAULT 0,
|
|
15
|
+
quality REAL NOT NULL DEFAULT 0.5,
|
|
16
|
+
duration_ms INTEGER NOT NULL DEFAULT 0,
|
|
17
|
+
model_tier INTEGER,
|
|
18
|
+
routing_json TEXT,
|
|
19
|
+
steps_json TEXT,
|
|
20
|
+
result_json TEXT,
|
|
21
|
+
error TEXT,
|
|
22
|
+
started_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
23
|
+
completed_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
24
|
+
source TEXT DEFAULT 'middleware',
|
|
25
|
+
application_count INTEGER DEFAULT 0,
|
|
26
|
+
avg_token_savings REAL DEFAULT 0,
|
|
27
|
+
embedding BLOB,
|
|
28
|
+
embedding_dimension INTEGER,
|
|
29
|
+
tags TEXT,
|
|
30
|
+
last_applied_at TEXT
|
|
31
|
+
);
|
|
32
|
+
CREATE TABLE IF NOT EXISTS experience_applications (
|
|
33
|
+
id TEXT PRIMARY KEY,
|
|
34
|
+
experience_id TEXT NOT NULL,
|
|
35
|
+
task TEXT NOT NULL,
|
|
36
|
+
success INTEGER NOT NULL,
|
|
37
|
+
tokens_saved INTEGER DEFAULT 0,
|
|
38
|
+
feedback TEXT,
|
|
39
|
+
applied_at TEXT DEFAULT (datetime('now')),
|
|
40
|
+
FOREIGN KEY (experience_id) REFERENCES captured_experiences(id) ON DELETE CASCADE
|
|
41
|
+
);
|
|
42
|
+
CREATE INDEX IF NOT EXISTS idx_exp_apps_experience ON experience_applications(experience_id);
|
|
43
|
+
`)}catch{}try{let u=n.prepare("PRAGMA table_info(qe_trajectories)").all();u.length>0&&!u.some(E=>E.name==="metadata_json")&&n.exec("ALTER TABLE qe_trajectories ADD COLUMN metadata_json TEXT")}catch{}let r=`exp-${Date.now()}-${U().slice(0,8)}`,s=`${o.agent}:${o.taskId}`,a=o.durationMs??0,c=o.success?1:0,i=a<100?1:a<500?.8:a<2e3?.6:a<5e3?.4:a<1e4?.2:.1,h=.25*c+.325+.1*i,l=null,p=0,d=0,k=n.transaction(()=>{n.prepare(`
|
|
44
|
+
INSERT INTO captured_experiences
|
|
45
|
+
(id, task, agent, domain, success, quality, duration_ms,
|
|
46
|
+
model_tier, started_at, completed_at, source)
|
|
47
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, NULL, datetime('now'), datetime('now'), ?)
|
|
48
|
+
`).run(r,s.slice(0,500),o.agent,o.domain??"general",o.success?1:0,h,a,"cli-hook-post-task"),n.prepare(`
|
|
49
|
+
INSERT INTO experience_applications
|
|
50
|
+
(id, experience_id, task, success, tokens_saved, feedback, applied_at)
|
|
51
|
+
VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
|
|
52
|
+
`).run(`app-${Date.now()}-${U().slice(0,8)}`,r,s,o.success?1:0,Math.round(h*100),`[Patch 060] post-task outcome: ${o.success?"success":"failure"}`);try{let m=n.prepare(`
|
|
53
|
+
SELECT key, value FROM kv_store
|
|
54
|
+
WHERE namespace = 'task-bridge'
|
|
55
|
+
AND (expires_at IS NULL OR expires_at > strftime('%s','now') * 1000)
|
|
56
|
+
ORDER BY created_at DESC
|
|
57
|
+
LIMIT 1
|
|
58
|
+
`).get();if(m?.value)try{l=JSON.parse(m.value)}catch{l=null}if(l&&Array.isArray(l.selectedPatternIds)&&l.selectedPatternIds.length>0){let T=l.estimatedTokenSavings&&l.selectedPatternIds.length?Math.round(l.estimatedTokenSavings/l.selectedPatternIds.length):0,I=n.prepare(`
|
|
59
|
+
INSERT INTO experience_applications
|
|
60
|
+
(id, experience_id, task, success, tokens_saved, feedback, applied_at)
|
|
61
|
+
VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
|
|
62
|
+
`),L=n.prepare(`
|
|
63
|
+
SELECT tier, successful_uses, success_rate, confidence
|
|
64
|
+
FROM qe_patterns
|
|
65
|
+
WHERE id = ?
|
|
66
|
+
`),P=n.prepare(`
|
|
67
|
+
UPDATE qe_patterns
|
|
68
|
+
SET tier = 'long-term', updated_at = datetime('now')
|
|
69
|
+
WHERE id = ?
|
|
70
|
+
AND tier = 'short-term'
|
|
71
|
+
AND successful_uses >= 3
|
|
72
|
+
AND success_rate >= 0.7
|
|
73
|
+
AND confidence >= 0.6
|
|
74
|
+
`);for(let S of l.selectedPatternIds){I.run(`app-${Date.now()}-${U().slice(0,8)}`,r,`${s}:pattern:${S}`,o.success?1:0,T,`[Patch 160+300] task-bridge pattern_id=${S} ts=${T}`);try{me(n,{patternId:S,success:o.success,metrics:{tokens_saved:T,source:"cli-hook-post-task",experience_id:r},feedback:`[Patch 160+300] task-bridge pattern_id=${S} ts=${T}`})}catch{}try{let q=L.get(S);q?.tier==="short-term"&&q.successful_uses>=3&&q.success_rate>=.7&&q.confidence>=.6&&P.run(S)}catch{}}m&&n.prepare("DELETE FROM kv_store WHERE namespace='task-bridge' AND key = ?").run(m.key)}}catch(m){console.error(H.dim(`[hooks] post-task bridge: ${m instanceof Error?m.message:"unknown"}`))}let u=`traj-${Date.now()}-${U().slice(0,8)}`,E=o.parentAgentId!==void 0||o.depth!==void 0?JSON.stringify({...o.parentAgentId!==void 0?{parentAgentId:o.parentAgentId}:{},...o.depth!==void 0?{depth:o.depth}:{}}):null;n.prepare(`
|
|
75
|
+
INSERT INTO qe_trajectories (id, task, agent, domain, started_at, ended_at, success, steps_json, metadata_json)
|
|
76
|
+
VALUES (?, ?, ?, ?, datetime('now'), datetime('now'), ?, ?, ?)
|
|
77
|
+
`).run(u,s,o.agent,o.domain??"general",o.success?1:0,JSON.stringify([{step:1,task:o.taskId,success:o.success}]),E);try{let m=n.prepare(`
|
|
78
|
+
SELECT id, task, agent, success, started_at, completed_at
|
|
79
|
+
FROM captured_experiences
|
|
80
|
+
WHERE consolidated_into IS NULL
|
|
81
|
+
AND task LIKE ?
|
|
82
|
+
AND started_at > datetime('now', '-1 hour')
|
|
83
|
+
ORDER BY started_at ASC
|
|
84
|
+
`).all(`%:${o.taskId}`);if(m.length>=2){let T=`traj-multi-${Date.now()}-${U().slice(0,8)}`,I=JSON.stringify(m.map((S,q)=>({step:q+1,task:S.task,agent:S.agent,success:!!S.success,started_at:S.started_at,completed_at:S.completed_at}))),L=m.every(S=>!!S.success);n.prepare(`
|
|
85
|
+
INSERT INTO qe_trajectories (id, task, agent, domain, started_at, ended_at, success, steps_json)
|
|
86
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
87
|
+
`).run(T,`multi:${o.taskId}`,o.agent,o.domain??"general",m[0].started_at,m[m.length-1].completed_at,L?1:0,I);let P=m.map(()=>"?").join(",");n.prepare(`UPDATE captured_experiences SET consolidated_into = ? WHERE id IN (${P})`).run(T,...m.map(S=>S.id)),p=m.length}}catch(m){console.error(H.dim(`[hooks] post-task stitch: ${m instanceof Error?m.message:"unknown"}`))}if(o.success)try{d=n.prepare(`
|
|
88
|
+
UPDATE dream_insights
|
|
89
|
+
SET applied = COALESCE(applied, 0) + 1
|
|
90
|
+
WHERE id IN (
|
|
91
|
+
SELECT id FROM dream_insights
|
|
92
|
+
WHERE actionable = 1
|
|
93
|
+
ORDER BY created_at DESC
|
|
94
|
+
LIMIT 3
|
|
95
|
+
)
|
|
96
|
+
`).run().changes??0}catch{}});try{k()}catch(u){console.error(H.dim(`[hooks] persistTaskOutcome txn: ${u instanceof Error?u.message:"unknown"}`))}return(async()=>{try{let{computeRealEmbedding:u}=await import("./real-embeddings-W3GNAEJO.js"),E=`${o.domain??"general"}: ${s}`.slice(0,512),m=await u(E);n.prepare("UPDATE captured_experiences SET embedding = ?, embedding_dimension = ? WHERE id = ?").run(Buffer.from(new Float32Array(m).buffer),m.length,r)}catch{}})(),{experienceId:r,qualityScore:h,bridge:l,stitchedSiblings:p,insightsApplied:d}}async function W(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-27QJHABO.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}let r=`${o.taskType}|${o.priority}|${o.domain||"any"}`,s=o.agent,a=`q-learning:aqe-hook-router:${r}:${s}`,c=o.success?.1:-1,i=.1,h=.9,l=n.prepare(`
|
|
97
|
+
SELECT q_value FROM rl_q_values WHERE id = ?
|
|
98
|
+
`).get(a),p=l&&typeof l.q_value=="number"?l.q_value:0,d=n.prepare(`
|
|
99
|
+
SELECT MAX(q_value) AS m FROM rl_q_values WHERE state_key = ?
|
|
100
|
+
`).get(r),k=d&&typeof d.m=="number"?d.m:0,u=p+i*(c+h*k-p);n.prepare(`
|
|
101
|
+
INSERT INTO rl_q_values
|
|
102
|
+
(id, algorithm, agent_id, state_key, action_key, q_value, visits, last_reward, domain, created_at, updated_at)
|
|
103
|
+
VALUES (?, 'q-learning', 'aqe-hook-router', ?, ?, ?, 1, ?, ?, datetime('now'), datetime('now'))
|
|
104
|
+
ON CONFLICT(algorithm, agent_id, state_key, action_key) DO UPDATE SET
|
|
105
|
+
q_value = excluded.q_value,
|
|
106
|
+
visits = visits + 1,
|
|
107
|
+
last_reward = excluded.last_reward,
|
|
108
|
+
updated_at = datetime('now')
|
|
109
|
+
`).run(a,r,s,u,c,o.domain||"any")}catch(e){console.error(H.dim(`[hooks] q-learning update: ${e instanceof Error?e.message:"unknown"}`))}}async function re(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-27QJHABO.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}n.prepare(`
|
|
110
|
+
UPDATE routing_outcomes
|
|
111
|
+
SET success = ?, quality_score = ?, duration_ms = ?
|
|
112
|
+
WHERE id IN (
|
|
113
|
+
SELECT id FROM routing_outcomes
|
|
114
|
+
WHERE quality_score = -1
|
|
115
|
+
AND task_json LIKE '%"taskId"%'
|
|
116
|
+
AND created_at > datetime('now', '-30 minutes')
|
|
117
|
+
ORDER BY (CASE WHEN used_agent = ? THEN 0 ELSE 1 END), created_at DESC
|
|
118
|
+
LIMIT 1
|
|
119
|
+
)
|
|
120
|
+
`).run(o.success?1:0,o.qualityScore,o.durationMs,o.agent)}catch(e){console.error(H.dim(`[hooks] routing UPDATE: ${e instanceof Error?e.message:"unknown"}`))}}async function se(){let{getUnifiedMemory:o}=await import("./unified-memory-27QJHABO.js"),e=o();e.isInitialized()||await e.initialize();let t=e.getDatabase();try{t.pragma("busy_timeout = 60000")}catch{}let n=new Set(t.prepare("PRAGMA table_info(captured_experiences)").all().map(i=>i.name)),r=[["consolidated_into","TEXT DEFAULT NULL"],["consolidation_count","INTEGER DEFAULT 1"],["quality_updated_at","TEXT DEFAULT NULL"],["reuse_success_count","INTEGER DEFAULT 0"],["reuse_failure_count","INTEGER DEFAULT 0"]];for(let[i,h]of r)n.has(i)||t.exec(`ALTER TABLE captured_experiences ADD COLUMN ${i} ${h}`);let s=t.prepare(`
|
|
121
|
+
SELECT
|
|
122
|
+
domain,
|
|
123
|
+
agent,
|
|
124
|
+
COUNT(*) as cnt,
|
|
125
|
+
AVG(quality) as avg_quality,
|
|
126
|
+
SUM(success) as successes,
|
|
127
|
+
CAST(SUM(success) AS REAL) / COUNT(*) as success_rate,
|
|
128
|
+
AVG(duration_ms) as avg_duration,
|
|
129
|
+
GROUP_CONCAT(DISTINCT source) as sources
|
|
130
|
+
FROM captured_experiences
|
|
131
|
+
WHERE application_count = 0
|
|
132
|
+
GROUP BY domain, agent
|
|
133
|
+
HAVING cnt >= 3 AND avg_quality >= 0.5 AND success_rate >= 0.6
|
|
134
|
+
ORDER BY avg_quality DESC
|
|
135
|
+
LIMIT 50
|
|
136
|
+
`).all();if(s.length===0)return 0;let{v4:a}=await import("./dist-node-LU4E7PI6.js"),c=0;for(let i of s)try{let h=new Date().toISOString().slice(0,7),l=`${i.agent}-${i.domain}-${h}`,p=t.prepare(`
|
|
137
|
+
SELECT id FROM qe_patterns
|
|
138
|
+
WHERE qe_domain = ? AND name = ?
|
|
139
|
+
LIMIT 1
|
|
140
|
+
`).get(i.domain,l);if(p)t.prepare(`
|
|
141
|
+
UPDATE qe_patterns
|
|
142
|
+
SET usage_count = usage_count + ?,
|
|
143
|
+
successful_uses = successful_uses + ?,
|
|
144
|
+
confidence = MIN(0.99, confidence + 0.01),
|
|
145
|
+
quality_score = MIN(0.99, quality_score + 0.005),
|
|
146
|
+
updated_at = datetime('now')
|
|
147
|
+
WHERE id = ?
|
|
148
|
+
`).run(i.cnt,i.successes,p.id);else{let d=a(),k=Math.min(.95,i.avg_quality*.8+i.success_rate*.2),u=k*.3+Math.min(i.cnt,100)/100*.2+i.success_rate*.5,E=`Auto-consolidated from ${i.cnt} experiences. Agent: ${i.agent}, success rate: ${(i.success_rate*100).toFixed(0)}%`,m=(i.sources||"").split(",").filter(Boolean);t.prepare(`
|
|
149
|
+
INSERT INTO qe_patterns (
|
|
150
|
+
id, pattern_type, qe_domain, domain, name, description,
|
|
151
|
+
confidence, usage_count, success_rate, quality_score, tier,
|
|
152
|
+
template_json, context_json, created_at, successful_uses
|
|
153
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now'), ?)
|
|
154
|
+
`).run(d,"workflow",i.domain,i.domain,l,E,k,i.cnt,i.success_rate,u,"short-term",JSON.stringify({type:"workflow",content:`${i.agent} pattern for ${i.domain}`,variables:[]}),JSON.stringify({tags:m,sourceType:"session-consolidation",extractedAt:new Date().toISOString()}),i.successes);let{ensurePatternEmbedding:T}=await import("./embed-and-insert-pattern-7RBA5NDK.js");await T(t,d,l,E,m),c++}t.prepare(`
|
|
155
|
+
UPDATE captured_experiences
|
|
156
|
+
SET application_count = application_count + 1
|
|
157
|
+
WHERE domain = ? AND agent = ? AND application_count = 0
|
|
158
|
+
`).run(i.domain,i.agent)}catch{}return c}var g={reasoningBank:null,hookRegistry:null,coherenceService:null,sessionId:null,initialized:!1,initializationPromise:null};async function _(){if(g.initializationPromise&&await g.initializationPromise,g.initialized&&g.reasoningBank&&g.hookRegistry)return{reasoningBank:g.reasoningBank,hookRegistry:g.hookRegistry};if(g.initializationPromise=Ie(),await g.initializationPromise,g.initializationPromise=null,!g.reasoningBank||!g.hookRegistry)throw new Error("Failed to initialize hooks system");return{reasoningBank:g.reasoningBank,hookRegistry:g.hookRegistry}}async function Ie(){if(!g.initialized)try{let o=R(),e=ke.join(o,".agentic-qe"),t=await O(e);try{g.coherenceService=await pe(ge),console.log(x.dim("[hooks] CoherenceService initialized with WASM engines"))}catch(a){console.log(x.dim(`[hooks] CoherenceService WASM unavailable, using fallback: ${a instanceof Error?a.message:"unknown"}`))}g.reasoningBank=ne(t,void 0,{enableLearning:!0,enableGuidance:!0,enableRouting:!0,embeddingDimension:384,useONNXEmbeddings:!0},g.coherenceService??void 0);let n=1e4,r=new AbortController,s=setTimeout(()=>r.abort(new Error("ReasoningBank init timeout")),n);try{await g.reasoningBank.initialize({signal:r.signal})}finally{clearTimeout(s)}try{let{getSharedRvfDualWriter:a}=await import("./shared-rvf-dual-writer-QOPOIRIC.js"),c=await a();c&&g.reasoningBank.setRvfDualWriter(c)}catch(a){process.env.DEBUG&&console.debug("[hooks] RVF wiring skipped:",a instanceof Error?a.message:a)}g.hookRegistry=he(g.reasoningBank),g.initialized=!0,console.log(x.dim("[hooks] System initialized"))}catch(o){console.warn(x.yellow(`[hooks] Using fallback mode: ${o instanceof Error?o.message:"unknown error"}`));let e=Le();g.reasoningBank=ne(e,void 0,{enableLearning:!0,enableGuidance:!0,enableRouting:!0}),g.hookRegistry=new fe,g.hookRegistry.initialize(g.reasoningBank),g.initialized=!0}}function C(o){try{o.pragma("busy_timeout = 60000")}catch{}}async function O(o){let t=new ue({sqlite:{path:ke.join(o,"memory.db"),walMode:!0,poolSize:3,busyTimeout:6e4},enableFallback:!0,defaultNamespace:"qe-patterns"}),n=new AbortController,r=setTimeout(()=>n.abort(new Error("Backend init timeout")),5e3);try{await t.initialize({signal:n.signal})}finally{clearTimeout(r)}return t}function Le(){let o=new Map;return{initialize:async()=>{},dispose:async()=>{o.clear()},get:async e=>{let t=o.get(e);return t?t.value:void 0},set:async(e,t,n)=>{o.set(e,{value:t})},delete:async e=>o.delete(e),has:async e=>o.has(e),search:async(e,t)=>{let n=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(n.replace(/\*/g,".*"));return Array.from(o.keys()).filter(s=>r.test(s))},vectorSearch:async(e,t)=>[],storeVector:async(e,t,n)=>{},count:async e=>{let t=0,n=`${e}:`;for(let r of o.keys())r.startsWith(n)&&t++;return t},hasCodeIntelligenceIndex:async()=>{let e="code-intelligence:kg:";for(let t of o.keys())if(t.startsWith(e))return!0;return!1}}}function f(o){console.log(JSON.stringify(o,null,2))}function N(o){console.log(x.green("\u2713"),o)}function b(o){console.error(x.red("\u2717"),o)}function Y(o){if(o.length===0){console.log(x.dim(" No specific guidance"));return}o.forEach((e,t)=>{console.log(x.cyan(` ${t+1}.`),e)})}async function Z(o=500){return process.stdin.isTTY?"":new Promise(e=>{let t="",n=setTimeout(()=>{process.stdin.removeAllListeners(),process.stdin.pause(),e(t)},o);process.stdin.setEncoding("utf8"),process.stdin.on("data",r=>{t+=r}),process.stdin.on("end",()=>{clearTimeout(n),e(t)}),process.stdin.on("error",()=>{clearTimeout(n),e(t)}),process.stdin.resume()})}function ye(o){if(!o.trim())return"";let e;try{e=JSON.parse(o)}catch{return""}let t=e.tool_input,n=e.toolInput,r=[t?.file_path,t?.filePath,n?.file_path,n?.filePath,e.file_path,e.filePath];for(let s of r)if(typeof s=="string"&&s.trim())return s;return""}import $ from"chalk";import Pe from"node:path";M();function Ee(o){o.command("pre-edit").description("Get context and guidance before editing a file").requiredOption("-f, --file <path>","File path to edit").option("-o, --operation <type>","Operation type: create, update, delete, refactor","update").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),r=(await t.emit(v.PreTestGeneration,{targetFile:e.file,testType:"unit",operation:e.operation}))[0]||{success:!0,guidance:[],routing:null};if(e.json){let s=r.guidance||[],c=[r.routing?.recommendedAgent?`Recommended agent: ${r.routing.recommendedAgent} (${(r.routing.confidence*100).toFixed(0)}% confidence).`:"",...s.map(i=>i)].filter(Boolean).join(" ");f({hookSpecificOutput:{hookEventName:"PreToolUse",additionalContext:c||void 0},file:e.file,operation:e.operation,patterns:r.routing?.patterns?.length||0})}else console.log($.bold(`
|
|
159
|
+
\u{1F4DD} Pre-Edit Analysis`)),console.log($.dim(` File: ${e.file}`)),console.log($.dim(` Operation: ${e.operation}`)),r.routing&&(console.log($.bold(`
|
|
160
|
+
\u{1F3AF} Recommended Agent:`),$.cyan(r.routing.recommendedAgent)),console.log($.dim(` Confidence: ${(r.routing.confidence*100).toFixed(1)}%`))),console.log($.bold(`
|
|
161
|
+
\u{1F4A1} Guidance:`)),Y(r.guidance||[]);return}catch(t){throw b(`pre-edit failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("post-edit").description("Record editing outcome for pattern learning").requiredOption("-f, --file <path>","File path that was edited").option("--success","Edit was successful").option("--failure","Edit failed").option("--pattern-id <id>","Pattern ID that was applied").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n=e.success||!e.failure,r=e.file||"";if(!r.trim())try{let p=await Z();r=ye(p)}catch{}let s=r.split("/").pop()||"unknown",c=/\.(test|spec)\.(ts|js|tsx|jsx)$/.test(s)?"test-generation":"code-intelligence",i=e.patternId||`edit:${c}:${s}`,l=(await t.emit(v.PostTestGeneration,{targetFile:r,success:n,patternId:i,generatedTests:null,testCount:0}))[0]||{success:!0,patternsLearned:0};try{let{reasoningBank:p}=await _();await p.recordOutcome({patternId:i,success:n,metrics:{executionTimeMs:0},feedback:`Edit ${n?"succeeded":"failed"}: ${r}`})}catch{}try{await G({task:`edit: ${r}`,agent:"cli-hook",domain:c,success:n,source:"cli-hook-post-edit"})}catch{}try{let p=R(),d=Pe.join(p,".agentic-qe"),k=await O(d);await D(k)}catch{}e.json?f({success:!0,file:r,editSuccess:n,patternsLearned:l.patternsLearned||0,dreamTriggered:!1,dreamReason:"deferred-to-kernel"}):(N(`Recorded edit outcome for ${r||"(unknown file)"}`),l.patternsLearned&&console.log($.green(` Patterns learned: ${l.patternsLearned}`)));return}catch(t){throw b(`post-edit failed: ${t instanceof Error?t.message:"unknown"}`),t}})}import{randomUUID as Ce}from"crypto";M();import A from"chalk";import qe from"node:path";function je(o){if(!o.trim())return"";let e;try{e=JSON.parse(o)}catch{return o.trim()}let t=[e.prompt,e.user_prompt,e.command,e.tool_input?.prompt,e.tool_input?.description,e.toolInput?.prompt,e.toolInput?.description];for(let n of t)if(typeof n=="string"&&n.trim())return n;return""}function Te(o){o.command("route").description("Route a task to the optimal QE agent").option("-t, --task <description>","Task description (falls back to stdin event JSON)").option("-d, --domain <domain>","Target QE domain hint").option("-c, --capabilities <caps...>","Required capabilities").option("--json","Output as JSON").action(async e=>{try{let t=e.task??"";if(!t.trim()){let c=await Z();t=je(c)}if(!t.trim())throw new Error("No task provided. Pass --task <description> or pipe a Claude Code hook event JSON to stdin.");let{reasoningBank:n}=await _(),r={task:t,domain:e.domain,capabilities:e.capabilities},s=await n.routeTask(r);if(!s.success)throw new Error(s.error.message);let a=s.value;e.json?f({recommendedAgent:a.recommendedAgent,confidence:a.confidence,alternatives:a.alternatives,domains:a.domains,patternCount:a.patterns.length,guidance:a.guidance,reasoning:a.reasoning,exploration:a.exploration??!1,criticality:a.criticality??null,qWeight:a.qWeight??null}):(console.log(A.bold(`
|
|
162
|
+
\u{1F3AF} Task Routing Result`)),console.log(A.dim(` Task: "${t}"`)),console.log(A.bold(`
|
|
163
|
+
\u{1F464} Recommended Agent:`),A.cyan(a.recommendedAgent)),console.log(A.dim(` Confidence: ${(a.confidence*100).toFixed(1)}%`)),a.alternatives.length>0&&(console.log(A.bold(`
|
|
164
|
+
\u{1F504} Alternatives:`)),a.alternatives.forEach(c=>{console.log(A.dim(` - ${c.agent}: ${(c.score*100).toFixed(1)}%`))})),console.log(A.bold(`
|
|
165
|
+
\u{1F4C2} Detected Domains:`),a.domains.join(", ")),console.log(A.bold(`
|
|
166
|
+
\u{1F4A1} Guidance:`)),Y(a.guidance),console.log(A.bold(`
|
|
167
|
+
\u{1F4D6} Reasoning:`),A.dim(a.reasoning)));try{let{getUnifiedMemory:c}=await import("./unified-memory-27QJHABO.js"),i=c();i.isInitialized()||await i.initialize();let h=i.getDatabase();C(h),K(h);let l=`route-${Date.now()}-${Ce().slice(0,8)}`,p=a.confidence<.5,d=a;h.prepare(`
|
|
168
|
+
INSERT OR REPLACE INTO routing_outcomes (
|
|
169
|
+
id, task_json, decision_json, used_agent,
|
|
170
|
+
followed_recommendation, success, quality_score,
|
|
171
|
+
duration_ms, error,
|
|
172
|
+
exploration, criticality, q_weight
|
|
173
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
174
|
+
`).run(l,JSON.stringify({description:t,domain:e.domain}),JSON.stringify({recommended:a.recommendedAgent,confidence:a.confidence,alternatives:a.alternatives,lowConfidence:p,exploration:d.exploration??!1,criticality:d.criticality??null,qWeight:d.qWeight??null}),a.recommendedAgent,1,0,-1,0,p?"low-confidence":null,d.exploration?1:0,d.criticality??null,d.qWeight??null);let k=R(),u=qe.join(k,".agentic-qe"),E=await O(u);await D(E)}catch(c){console.error(A.dim(`[hooks] route persist: ${c instanceof Error?c.message:"unknown"}`))}return}catch(t){throw b(`route failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("post-route").description("Close the most-recent route sentinel from a Stop hook (#451)").option("--success [bool]","Whether the turn completed successfully","true").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0,n=.325+(t?.25:0)+.1,r=j();r.isInitialized()||await r.initialize();let s=r.getDatabase();C(s);let a=s.prepare(`
|
|
175
|
+
SELECT id, task_json, used_agent FROM routing_outcomes
|
|
176
|
+
WHERE quality_score = -1
|
|
177
|
+
AND task_json NOT LIKE '%"taskId"%'
|
|
178
|
+
ORDER BY created_at DESC
|
|
179
|
+
LIMIT 1
|
|
180
|
+
`).get(),c=a?s.prepare(`
|
|
181
|
+
UPDATE routing_outcomes
|
|
182
|
+
SET success = ?, quality_score = ?, duration_ms = 0, error = NULL
|
|
183
|
+
WHERE id = ?
|
|
184
|
+
`).run(t?1:0,n,a.id):{changes:0};if(a)try{let h=JSON.parse(a.task_json),l=String(h.description??"");l&&await W({taskType:z(l),priority:"normal",domain:X(l)[0]??"any",agent:a.used_agent,success:t})}catch{}let i=s.prepare(`
|
|
185
|
+
UPDATE routing_outcomes
|
|
186
|
+
SET success = 0,
|
|
187
|
+
quality_score = 0.325,
|
|
188
|
+
duration_ms = 0,
|
|
189
|
+
error = 'stale-sentinel'
|
|
190
|
+
WHERE quality_score = -1
|
|
191
|
+
AND task_json NOT LIKE '%"taskId"%'
|
|
192
|
+
AND created_at < datetime('now', '-300 seconds')
|
|
193
|
+
`).run();e.json?f({success:!0,resolved:c.changes>0,staleSwept:i.changes,qualityScore:n,turnSuccess:t}):i.changes>0&&console.log(A.dim(`[hooks] post-route: swept ${i.changes} stale sentinel(s)`));return}catch(t){e.json?f({success:!1,error:t instanceof Error?t.message:"unknown"}):console.error(A.dim(`[hooks] post-route: ${t instanceof Error?t.message:"unknown"}`));return}})}import y from"chalk";$e();function _e(o){o.command("stats").description("Display hooks system statistics").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=await t.getStats();if(e.json)f(n);else{console.log(y.bold(`
|
|
194
|
+
\u{1F4CA} Hooks System Statistics
|
|
195
|
+
`)),console.log(y.bold("Patterns:")),console.log(` Total: ${y.cyan(n.totalPatterns)}`),console.log(` Short-term: ${n.patternStoreStats.byTier.shortTerm}`),console.log(` Long-term: ${n.patternStoreStats.byTier.longTerm}`),console.log(y.bold(`
|
|
196
|
+
By Domain:`));for(let[r,s]of Object.entries(n.byDomain))s>0&&console.log(` ${r}: ${s}`);console.log(y.bold(`
|
|
197
|
+
Routing:`)),console.log(` Requests: ${n.routingRequests}`),console.log(` Avg Confidence: ${(n.avgRoutingConfidence*100).toFixed(1)}%`),console.log(y.bold(`
|
|
198
|
+
Learning:`)),console.log(` Outcomes: ${n.learningOutcomes}`),console.log(` Success Rate: ${(n.patternSuccessRate*100).toFixed(1)}%`),console.log(y.bold(`
|
|
199
|
+
Search Performance:`)),console.log(` Operations: ${n.patternStoreStats.searchOperations}`),console.log(` Avg Latency: ${n.patternStoreStats.avgSearchLatencyMs.toFixed(2)}ms`),console.log(` HNSW Native: ${n.patternStoreStats.hnswStats.nativeAvailable?"\u2713":"\u2717"}`)}}catch(t){throw b(`stats failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("list").description("List all registered QE hook events").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n=t.getRegisteredEvents();if(e.json)f({events:n,totalEvents:Object.keys(v).length,registeredEvents:n.length});else{console.log(y.bold(`
|
|
200
|
+
\u{1F4CB} Registered QE Hook Events
|
|
201
|
+
`)),console.log(y.bold("All Available Events:"));for(let[r,s]of Object.entries(v)){let c=n.includes(s)?y.green("\u2713"):y.dim("\u25CB");console.log(` ${c} ${r}: ${y.dim(s)}`)}console.log(y.dim(`
|
|
202
|
+
Registered: ${n.length}/${Object.keys(v).length}`))}}catch(t){throw b(`list failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("emit").description("Emit a QE hook event").requiredOption("-e, --event <name>","Event name (e.g., qe:pattern-applied)").option("-d, --data <json>","Event data as JSON","{}").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n;try{n=le(e.data)}catch{throw new Error(`Invalid JSON data: ${e.data}`)}let r=await t.emit(e.event,n);e.json?f({event:e.event,results:r}):(console.log(y.bold(`
|
|
203
|
+
\u{1F4E1} Hook Event Emitted`)),console.log(y.dim(` Event: ${e.event}`)),console.log(y.dim(` Handlers: ${r.length}`)),r.forEach((s,a)=>{let c=s.success?y.green("\u2713"):y.red("\u2717");console.log(` ${c} Handler ${a+1}: ${s.success?"success":s.error}`),s.patternsLearned&&console.log(y.green(` Patterns learned: ${s.patternsLearned}`))}))}catch(t){throw b(`emit failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("learn").description("Store a new pattern in the reasoning bank").requiredOption("-n, --name <name>","Pattern name").requiredOption("-d, --description <desc>","Pattern description").option("-t, --type <type>","Pattern type","test-template").option("--domain <domain>","QE domain").option("--tags <tags...>","Pattern tags").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=await t.storePattern({patternType:e.type,name:e.name,description:e.description,template:{type:"prompt",content:e.description,variables:[]},context:{tags:e.tags||[]}});if(!n.success)throw new Error(n.error.message);let r=n.value;e.json?f({success:!0,pattern:{id:r.id,name:r.name,type:r.patternType,domain:r.qeDomain}}):(N(`Pattern stored: ${r.name}`),console.log(y.dim(` ID: ${r.id}`)),console.log(y.dim(` Domain: ${r.qeDomain}`)),console.log(y.dim(` Tier: ${r.tier}`)))}catch(t){throw b(`learn failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("search").description("Search for patterns in the reasoning bank").requiredOption("-q, --query <query>","Search query").option("-l, --limit <n>","Maximum results","10").option("-d, --domain <domain>","Filter by domain").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=await t.searchPatterns(e.query,{limit:parseInt(e.limit,10),domain:e.domain});if(!n.success)throw new Error(n.error.message);let r=n.value;e.json?f({query:e.query,total:r.length,patterns:r.map(s=>({id:s.pattern.id,name:s.pattern.name,score:s.score,domain:s.pattern.qeDomain,matchType:s.matchType}))}):(console.log(y.bold(`
|
|
204
|
+
\u{1F50D} Search Results for "${e.query}"
|
|
205
|
+
`)),r.length===0?console.log(y.dim(" No patterns found")):r.forEach((s,a)=>{console.log(`${y.cyan(`${a+1}.`)} ${s.pattern.name} ${y.dim(`(${(s.score*100).toFixed(1)}%)`)}`),console.log(y.dim(` Domain: ${s.pattern.qeDomain}`)),console.log(y.dim(` Match: ${s.matchType}`)),console.log(y.dim(` ID: ${s.pattern.id}`)),console.log()}),console.log(y.dim(`Found ${r.length} pattern(s)`)))}catch(t){throw b(`search failed: ${t instanceof Error?t.message:"unknown"}`),t}})}M();import J from"chalk";import Me from"node:path";function Se(o){o.command("session-start").description("Initialize session state when Claude Code session starts").option("-s, --session-id <id>","Session ID").option("--json","Output as JSON").action(async e=>{try{let t=e.sessionId||`session-${Date.now()}`;g.sessionId=t;let{reasoningBank:n}=await _(),r=await n.getStats(),s=R(),a=Me.join(s,".agentic-qe"),c=await O(a),i=await c.get(F),h=!i||!i.sessionStartTime;i?(i.sessionStartTime=new Date().toISOString(),i.totalDreamsThisSession=0):i={lastDreamTime:null,experienceCount:0,sessionStartTime:new Date().toISOString(),totalDreamsThisSession:0},await c.set(F,i);let l=[];l.push(`AQE Learning: ${r.totalPatterns} patterns loaded`);let p=Object.entries(r.byDomain).filter(([,k])=>k>0).sort(([,k],[,u])=>u-k).slice(0,5);p.length>0&&l.push(`Top domains: ${p.map(([k,u])=>`${k}(${u})`).join(", ")}`),r.patternSuccessRate>0&&l.push(`Pattern success rate: ${(r.patternSuccessRate*100).toFixed(0)}%`),r.routingRequests>0&&l.push(`Routing confidence: ${(r.avgRoutingConfidence*100).toFixed(0)}% across ${r.routingRequests} requests`);let d=l.join(". ")+".";e.json?f({hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:d},sessionId:t,initialized:!0,patternsLoaded:r.totalPatterns,dreamScheduler:{enabled:!0,lastDreamTime:i.lastDreamTime,pendingExperiences:i.experienceCount}}):(N(`Session started: ${t}`),console.log(J.dim(` Patterns loaded: ${r.totalPatterns}`)),console.log(J.dim(` Dream scheduler: enabled (${i.experienceCount} pending experiences)`)));return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}}),o.command("session-end").description("Save session state when Claude Code session ends").option("--save-state","Save learning state to disk").option("--export-metrics","Export session metrics").option("--json","Output as JSON").action(async e=>{try{let t=g.sessionId||"unknown",n=null;if(g.initialized&&g.reasoningBank)try{n=await g.reasoningBank.getStats()}catch{}let r=0;try{r=await se()}catch{}if(e.json){let s=n?`Session complete: ${n.totalPatterns} patterns, ${n.routingRequests} routings, ${(n.patternSuccessRate*100).toFixed(0)}% success rate`:"Session complete";f({continue:!0,sessionId:t,stateSaved:e.saveState||!1,metricsExported:e.exportMetrics||!1,patternsConsolidated:r,finalStats:n?{patternsLearned:n.totalPatterns,routingRequests:n.routingRequests,successRate:n.patternSuccessRate}:null})}else N(`Session ended: ${t}`),n&&(console.log(J.dim(` Patterns: ${n.totalPatterns}`)),console.log(J.dim(` Routing requests: ${n.routingRequests}`))),r>0&&console.log(J.dim(` Patterns consolidated: ${r}`));return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}})}import{createHash as We,randomUUID as Je}from"node:crypto";import w from"chalk";import Qe from"node:path";M();xe();import{readFileSync as Ue}from"node:fs";import{homedir as He}from"node:os";var ee=de.create("nagual-client");function Fe(){try{let o=Ue(`${He()}/.nagual/cloud-hooks.env`,"utf8");for(let e of o.split(`
|
|
206
|
+
`)){let t=e.match(/^(?:export\s+)?NAGUAL_CLOUD_KEY=(.+)/);if(t)return t[1].trim().replace(/^['"]|['"]$/g,"")}}catch{}}var Be="http://localhost:3333",be=3e3,ze=5e3;var ie=class{baseUrl;token;enabled;constructor(){this.baseUrl=process.env.NAGUAL_URL??Be,this.token=process.env.NAGUAL_CLOUD_KEY??process.env.NAGUAL_API_TOKEN??Fe(),this.enabled=!0}async search(e,t,n=5){try{let r=await fetch(`${this.baseUrl}/api/patterns/search`,{method:"POST",headers:this.headers(),body:JSON.stringify({query:e,domain:t,limit:n}),signal:AbortSignal.timeout(be)});return r.ok?(await r.json()).patterns??[]:[]}catch{return[]}}async recordOutcome(e,t){try{let n=await fetch(`${this.baseUrl}/api/patterns/${encodeURIComponent(e)}/outcome`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),signal:AbortSignal.timeout(be)});n.ok||ee.debug("nagual recordOutcome non-OK",{patternId:e,status:n.status})}catch(n){ee.debug("nagual recordOutcome failed (non-fatal)",{patternId:e,err:n})}}async promotePattern(e){let t={problem:e.problem,solution:e.solution,domain:e.domain,reward:e.reward*.8,tags:[...e.tags??[],"source:aqe",e.source_project?`project:${e.source_project}`:null].filter(n=>n!==null)};try{let n=await fetch(`${this.baseUrl}/api/patterns`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),signal:AbortSignal.timeout(ze)});n.ok||ee.debug("nagual promotePattern non-OK",{status:n.status})}catch(n){ee.debug("nagual promotePattern failed (non-fatal)",{err:n})}}headers(){let e={"Content-Type":"application/json"};return this.token&&(e.Authorization=`Bearer ${this.token}`),e}},ae;function we(){return ae||(ae=new ie),ae}var Ge=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/;function Re(o,e){let t={};if(o!==void 0){if(!Ge.test(o))return{error:`Invalid --parent-agent-id "${o}": must start with a letter or digit and contain only letters, digits, "_", ".", ":", "-" (max 128 chars)`};t.parentAgentId=o}if(e!==void 0){let n=typeof e=="number"?e:Number(e);if(!Number.isInteger(n))return{error:`Invalid --depth "${e}": must be an integer`};if(n<0)return{error:`Invalid --depth ${n}: must be >= 0`};if(n>32)return{error:`Invalid --depth ${n}: must be <= 32`};t.depth=n}return t}var Ve="task-bridge",Xe=6e5,Ae=.5;function Ke(o){return We("sha256").update(o).digest("hex").slice(0,16)}var Ye=new Set(["test-generation","coverage-analysis","defect-intelligence","security-compliance","quality-assessment","requirements-validation"]),Ze=80;async function et(o,e){return!process.env.NAGUAL_URL&&!process.env.NAGUAL_CLOUD_URL&&!process.env.NAGUAL_CLOUD_KEY?[]:o.length<Ze?[]:e&&!Ye.has(e)?[]:we().search(o.slice(0,300),e,3)}function ve(o){o.command("pre-task").description("Get context and guidance before spawning a Task agent").option("--task-id <id>","Task identifier").option("-d, --description <desc>","Task description").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=null;if(e.description){let d=await t.routeTask({task:e.description});d.success&&(n=d.value)}let r=(n?.patterns??[]).slice(0,5).map(d=>d?.id).filter(d=>typeof d=="string"),s=n?.domains?.[0],a=e.description?await et(String(e.description),s):[],c=null,i=[],h=0,l=null;try{let d=j();d.isInitialized()||await d.initialize();let k=d.getDatabase();C(k);try{let u=k.prepare(`
|
|
207
|
+
SELECT used_agent AS agent,
|
|
208
|
+
ROUND(AVG(quality_score), 3) AS avgQuality,
|
|
209
|
+
COUNT(*) AS n
|
|
210
|
+
FROM routing_outcomes
|
|
211
|
+
WHERE success = 1 AND quality_score >= 0
|
|
212
|
+
GROUP BY used_agent
|
|
213
|
+
ORDER BY avgQuality DESC, n DESC
|
|
214
|
+
LIMIT 1
|
|
215
|
+
`).get();u&&(c=u)}catch{}try{i=k.prepare(`
|
|
216
|
+
SELECT key, value
|
|
217
|
+
FROM kv_store
|
|
218
|
+
WHERE namespace = 'verdicts'
|
|
219
|
+
AND created_at > datetime('now', '-7 days')
|
|
220
|
+
ORDER BY created_at DESC
|
|
221
|
+
LIMIT 3
|
|
222
|
+
`).all().map(E=>({key:E.key,summary:String(E.value).slice(0,200)}))}catch{}if(r.length>0)try{let u=r.map(()=>"?").join(","),E=k.prepare(`
|
|
223
|
+
SELECT COALESCE(SUM(average_token_savings), 0) AS sum
|
|
224
|
+
FROM qe_patterns
|
|
225
|
+
WHERE id IN (${u})
|
|
226
|
+
`).get(...r);h=Math.max(0,Math.round(E?.sum??0))}catch{}if(e.description)try{let u=String(e.description),E=z(u),m="normal",T=n?.domains?.[0]??"any",I=Math.max(0,Math.min(10,Math.round(Math.min(u.length/200,1)*10)));l=`task:${Ke(u)}`;let L=JSON.stringify({selectedPatternIds:r,agent:n?.recommendedAgent??null,description:u.slice(0,200),taskType:E,priority:m,domain:T,complexityBucket:I,estimatedTokenSavings:h,ts:Date.now()}),P=Date.now()+Xe;k.prepare(`
|
|
227
|
+
INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at, created_at)
|
|
228
|
+
VALUES (?, ?, ?, ?, strftime('%s','now')*1000)
|
|
229
|
+
`).run(l,Ve,L,P)}catch(u){console.error(w.dim(`[hooks] pre-task bridge: ${u instanceof Error?u.message:"unknown"}`))}if(n?.recommendedAgent)try{K(k);let u=e.taskId||`hook-${Date.now()}`,E=`route-${Date.now()}-${Je().slice(0,8)}`,m=n.confidence<Ae,T=n;k.prepare(`
|
|
230
|
+
INSERT INTO routing_outcomes (
|
|
231
|
+
id, task_json, decision_json, used_agent,
|
|
232
|
+
followed_recommendation, success, quality_score,
|
|
233
|
+
duration_ms, error,
|
|
234
|
+
exploration, criticality, q_weight
|
|
235
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
236
|
+
`).run(E,JSON.stringify({description:e.description,taskId:u}),JSON.stringify({recommended:n.recommendedAgent,confidence:n.confidence,alternatives:n.alternatives,lowConfidence:m,exploration:T.exploration??!1,criticality:T.criticality??null,qWeight:T.qWeight??null}),n.recommendedAgent,1,0,-1,0,m?"low-confidence":null,T.exploration?1:0,T.criticality??null,T.qWeight??null)}catch(u){console.error(w.dim(`[hooks] pre-task sentinel: ${u instanceof Error?u.message:"unknown"}`))}}catch(d){console.error(w.dim(`[hooks] pre-task memory: ${d instanceof Error?d.message:"unknown"}`))}let p=n?n.confidence<Ae:!1;if(e.json)f({success:!0,taskId:e.taskId,description:e.description,recommendedAgent:n?.recommendedAgent,confidence:n?.confidence,guidance:n?.guidance||[],selectedPatternIds:r,historicalBest:c,priorVerdicts:i,estimatedTokenSavings:h,lowConfidence:p,bridgeKey:l,nagualPatterns:a.map(d=>({id:d.id,problem:d.problem,solution:d.solution.slice(0,400),domain:d.domain,reward:d.reward}))});else if(console.log(w.bold(`
|
|
237
|
+
\u{1F680} Pre-Task Analysis`)),console.log(w.dim(` Task ID: ${e.taskId||"N/A"}`)),n&&(console.log(w.bold(`
|
|
238
|
+
\u{1F3AF} Recommended:`),w.cyan(n.recommendedAgent)),console.log(w.dim(` Confidence: ${(n.confidence*100).toFixed(1)}%`)),p&&console.log(w.yellow(" \u26A0 Low confidence \u2014 consider providing more context"))),a.length>0){console.log(w.bold(`
|
|
239
|
+
\u{1F4DA} Nagual context (cross-project):`));for(let d of a)console.log(w.dim(` [${d.domain}] ${d.problem.slice(0,80)} (reward: ${d.reward.toFixed(2)})`))}return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}}),o.command("post-task").description("Record task outcome for pattern learning").option("--task-id <id>","Task identifier").option("--success [bool]","Whether task succeeded","true").option("--agent <name>","Agent that executed the task").option("--duration <ms>","Task duration in milliseconds").option("-d, --description <desc>","Task description \u2014 fallback Q-state source when pre-task bridge is absent (issue #499)").option("--parent-agent-id <id>","Agent that spawned this task (ADR-101 nesting provenance)").option("--depth <n>","Nesting depth of this task, 0 = top-level (ADR-101)").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0,n=Re(e.parentAgentId,e.depth);if(n.error){e.json?console.log(JSON.stringify({success:!1,error:n.error})):console.error(w.red(` \u2717 ${n.error}`)),process.exitCode=1;return}let r=0;try{let{hookRegistry:s,reasoningBank:a}=await _();r=(await s.emit(v.QEAgentCompletion,{taskId:e.taskId,success:t,agent:e.agent,duration:e.duration?parseInt(e.duration,10):void 0,timestamp:Date.now()})).reduce((p,d)=>p+(d.patternsLearned||0),0);{let p=e.taskId||`hook-${Date.now()}`,d=e.agent||"unknown",k=e.duration?parseInt(e.duration,10):0,u=(n.parentAgentId?`, Parent: ${n.parentAgentId}`:"")+(n.depth!==void 0?`, Depth: ${n.depth}`:"");await a.recordOutcome({patternId:`task:${d}:${p}`,success:t,metrics:{executionTimeMs:k},feedback:`Agent: ${d}, Task: ${p}${u}`});let E=await oe({taskId:p,agent:d,durationMs:k,success:t,parentAgentId:n.parentAgentId,depth:n.depth}),m=d==="unknown"&&E.bridge?.agent?E.bridge.agent:d;await re({agent:m,success:t,durationMs:k,qualityScore:E.qualityScore});let T=String(e.description??"");if(E.bridge||T){let I=E.bridge?.taskType??z(T),L=E.bridge?.priority??"normal",P=E.bridge?.domain??X(T)[0]??"any";await W({taskType:I,priority:L,domain:P,agent:m,success:t})}}let i=R(),h=Qe.join(i,".agentic-qe"),l=await O(h);await D(l)}catch(s){console.error(w.dim(`[hooks] Learning init: ${s instanceof Error?s.message:"unknown"}`))}e.json?f({success:!0,taskId:e.taskId,taskSuccess:t,patternsLearned:r,dreamTriggered:!1,dreamReason:"deferred-to-kernel"}):(N(`Task completed: ${e.taskId||"unknown"}`),console.log(w.dim(` Success: ${t}`)),r>0&&console.log(w.green(` Patterns learned: ${r}`)));return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}})}import{existsSync as tt,readFileSync as nt}from"node:fs";import{randomUUID as Oe}from"node:crypto";import V from"chalk";import Ne from"node:path";M();import*as B from"fs";import*as te from"path";var Q=class o{statePath;warnThreshold;blockThreshold;halfOpenAfterMs;staleAfterMs;constructor(e){this.statePath=e.statePath,this.warnThreshold=e.warnThreshold??3,this.blockThreshold=e.blockThreshold??5,this.halfOpenAfterMs=e.halfOpenAfterMs??12e4,this.staleAfterMs=e.staleAfterMs??30*6e4}static signature(e){return e.trim().replace(/\s+/g," ").slice(0,200)}check(e,t=Date.now()){let n=o.signature(e);if(!n)return{verdict:"allow",consecutiveFailures:0,halfOpen:!1};let r=this.readState()[n];if(!r||r.consecutiveFailures<this.warnThreshold)return{verdict:"allow",consecutiveFailures:r?.consecutiveFailures??0,halfOpen:!1};let s=r.consecutiveFailures;return s>=this.blockThreshold?t-r.lastFailureAt>=this.halfOpenAfterMs?{verdict:"warn",consecutiveFailures:s,halfOpen:!0,hint:`This command has failed ${s}x consecutively; allowing one probe attempt. If it fails again it will be flagged immediately.`}:{verdict:"block",consecutiveFailures:s,halfOpen:!1,hint:`The same command failed ${s}x consecutively. Re-running it unchanged is unlikely to succeed \u2014 inspect the error output, change the approach, or fix the underlying problem first. (A successful run resets this breaker.)`}:{verdict:"warn",consecutiveFailures:s,halfOpen:!1,hint:`This command has failed ${s}x consecutively \u2014 consider changing approach before retrying.`}}record(e,t,n=Date.now()){let r=o.signature(e);if(r)try{let s=this.readState();if(t){s[r]&&(delete s[r],this.writeState(s,n));return}let a=s[r]??{consecutiveFailures:0,lastFailureAt:n};a.consecutiveFailures+=1,a.lastFailureAt=n,s[r]=a,this.writeState(s,n)}catch{}}static isStrict(e=process.env){return e.AQE_STRICT_TOOL_LOOP==="1"||e.AQE_STRICT_TOOL_LOOP==="true"}readState(){try{let e=B.readFileSync(this.statePath,"utf8"),t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}writeState(e,t){for(let[n,r]of Object.entries(e))t-r.lastFailureAt>this.staleAfterMs&&delete e[n];B.mkdirSync(te.dirname(this.statePath),{recursive:!0}),B.writeFileSync(this.statePath,JSON.stringify(e))}};function ce(o){return new Q({statePath:te.join(o,".agentic-qe","tool-loop-state.json")})}function ot(o){return/\bjest\b/i.test(o)?"jest":/\bvitest\b/i.test(o)?"vitest":/\bpytest\b/i.test(o)?"pytest":/\bmocha\b/i.test(o)?"mocha":null}async function rt(o){try{let e=j();e.isInitialized()||await e.initialize();let t=e.getDatabase();C(t);let n=o.framework==="pytest"?"python":"javascript",r=o.command.split(/\s+/).slice(0,3).join("-").slice(0,80);t.prepare(`
|
|
240
|
+
INSERT INTO test_outcomes (
|
|
241
|
+
id, test_id, test_name, generated_by, framework, language, domain,
|
|
242
|
+
passed, execution_time_ms, maintainability_score, created_at
|
|
243
|
+
) VALUES (?, ?, ?, 'cli-hook-post-command', ?, ?, 'test-execution',
|
|
244
|
+
?, ?, 0.5, datetime('now'))
|
|
245
|
+
`).run(`to-${Date.now()}-${Oe().slice(0,8)}`,`cmd:${r}`,o.command.slice(0,200),o.framework,n,o.success?1:0,o.durationMs);try{let s=Ne.join(process.cwd(),"coverage","coverage-summary.json");if(tt(s)){let c=JSON.parse(nt(s,"utf-8")).total??{},i=Number(c.lines?.pct??0),h=Number(c.branches?.pct??0),l=Number(c.functions?.pct??0),p=t.prepare(`
|
|
246
|
+
SELECT after_lines, after_branches, after_functions
|
|
247
|
+
FROM coverage_sessions
|
|
248
|
+
WHERE target_path = ?
|
|
249
|
+
ORDER BY created_at DESC
|
|
250
|
+
LIMIT 1
|
|
251
|
+
`).get(process.cwd()),d=new Date().toISOString();t.prepare(`
|
|
252
|
+
INSERT INTO coverage_sessions (
|
|
253
|
+
id, target_path, agent_id, technique,
|
|
254
|
+
before_lines, before_branches, before_functions,
|
|
255
|
+
after_lines, after_branches, after_functions,
|
|
256
|
+
tests_generated, tests_passed, duration_ms,
|
|
257
|
+
started_at, completed_at
|
|
258
|
+
) VALUES (?, ?, 'cli-hook-post-command', ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?)
|
|
259
|
+
`).run(`cs-${Date.now()}-${Oe().slice(0,8)}`,process.cwd(),o.framework,p?.after_lines??0,p?.after_branches??0,p?.after_functions??0,i,h,l,o.success?1:0,o.durationMs,d,d)}}catch(s){console.error(V.dim(`[hooks] coverage_sessions: ${s instanceof Error?s.message:"unknown"}`))}}catch(e){console.error(V.dim(`[hooks] test_outcomes: ${e instanceof Error?e.message:"unknown"}`))}}function De(o){o.command("guard").description("File guardian - block edits to protected files").requiredOption("-f, --file <path>","File path to check").option("--json","Output as JSON (required for hook API)").action(async e=>{try{let t=e.file||"",n=t.replace(/\\/g,"/"),s=[{pattern:/^\.env($|\.)/,reason:"Environment file contains secrets"},{pattern:/\.env\.[a-zA-Z]+$/,reason:"Environment file contains secrets"},{pattern:/\.lock$/,reason:"Lock files are auto-generated"},{pattern:/(^|\/)node_modules\//,reason:"node_modules is managed by package manager"},{pattern:/(^|\/)\.agentic-qe\/memory\.db/,reason:"AQE memory database must not be directly edited"},{pattern:/(^|\/)\.agentic-qe\/memory\.db-wal$/,reason:"AQE WAL file must not be directly edited"},{pattern:/(^|\/)\.agentic-qe\/memory\.db-shm$/,reason:"AQE shared memory file must not be directly edited"}].find(a=>a.pattern.test(n));s?e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Protected file: ${s.reason} (${t})`}}):b(`Blocked: ${s.reason} (${t})`):e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}}):N(`Allowed: ${t}`);return}catch{e.json&&f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}});return}}),o.command("pre-command").description("Get context before executing a Bash command").option("-c, --command <cmd>","Command to be executed").option("--json","Output as JSON").action(async e=>{try{let t=e.command||"",n=[{pattern:/rm\s+(-[a-zA-Z]*f[a-zA-Z]*\s+)?-[a-zA-Z]*r[a-zA-Z]*\s+\/(?!\w)/,reason:"Recursive delete of root filesystem"},{pattern:/rm\s+(-[a-zA-Z]*r[a-zA-Z]*\s+)?-[a-zA-Z]*f[a-zA-Z]*\s+\/(?!\w)/,reason:"Recursive delete of root filesystem"},{pattern:/rm\s+-rf\s+~/,reason:"Recursive delete of home directory"},{pattern:/DROP\s+(TABLE|DATABASE|SCHEMA)/i,reason:"Destructive SQL operation"},{pattern:/git\s+push\s+.*--force(?!-)/,reason:"Force push can overwrite remote history"},{pattern:/git\s+reset\s+--hard/,reason:"Hard reset discards uncommitted changes"},{pattern:/>\s*\/dev\/sd[a-z]/,reason:"Direct write to block device"},{pattern:/dd\s+if=.*of=\/dev\/sd/,reason:"Direct disk write via dd"},{pattern:/chmod\s+777\s/,reason:"World-writable permissions are a security risk"},{pattern:/:\(\)\s*\{\s*:\|\s*:&\s*\}\s*;?\s*:/,reason:"Fork bomb detected"},{pattern:/mkfs\./,reason:"Filesystem format operation"},{pattern:/>\s*\/dev\/null\s*2>&1\s*&\s*disown/,reason:"Stealth background process"}],r=[{pattern:/\.agentic-qe.*rm/,reason:"Deleting AQE data files"},{pattern:/rm\s+-rf\s/,reason:"Recursive force delete"},{pattern:/git\s+clean\s+-[a-zA-Z]*f/,reason:"Force cleaning untracked files"}],s=n.find(i=>i.pattern.test(t)),a=r.filter(i=>i.pattern.test(t)).map(i=>i.reason),c=null;try{c=ce(R()).check(t)}catch{}if(c&&c.verdict==="block"&&Q.isStrict()){e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Tool-loop breaker (AQE_STRICT_TOOL_LOOP): ${c.hint}`}}):b(`Blocked by tool-loop breaker: ${c.hint}`);return}if(c&&c.verdict==="block"?a.push(`\u{1F6D1} TOOL-LOOP BREAKER: ${c.hint}`):c&&c.verdict==="warn"&&a.push(`Tool-loop breaker: ${c.hint}`),s)e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Dangerous command blocked: ${s.reason}`}}):b(`Blocked: ${s.reason}`);else if(e.json){let i={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};a.length>0&&(i.hookSpecificOutput.additionalContext=`Warnings: ${a.join("; ")}`),f(i)}else a.length>0&&(console.log(V.yellow(`
|
|
260
|
+
\u26A0\uFE0F Command Warnings:`)),a.forEach(i=>console.log(V.yellow(` - ${i}`))));return}catch{e.json&&f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}});return}}),o.command("post-command").description("Record Bash command outcome").option("-c, --command <cmd>","Command that was executed").option("--success [bool]","Whether command succeeded","true").option("--exit-code <code>","Command exit code").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0,n=e.exitCode?parseInt(e.exitCode,10):t?0:1,r=(e.command||"").substring(0,200);try{ce(R()).record(r,t)}catch{}let s=/\b(test|vitest|jest|pytest|mocha)\b/i.test(r),a=/\b(build|compile|tsc)\b/i.test(r),c=/\b(lint|eslint|prettier)\b/i.test(r),i=0,h=!1;try{let{reasoningBank:l}=await _();if(s){let{hookRegistry:T}=await _();await T.emit(v.TestExecutionResult,{runId:`cmd-${Date.now()}`,patternId:`cmd:test:${r.split(/\s+/).slice(0,3).join("-")}`,passed:t?1:0,failed:t?0:1,duration:0,flaky:!1})}let p=r.replace(/[^a-zA-Z0-9]/g,"-").slice(0,80),d=s?"test-execution":a?"code-intelligence":c?"quality-assessment":"code-intelligence";await l.recordOutcome({patternId:`cmd:${p}`,success:t,metrics:{executionTimeMs:0},feedback:`Command: ${r}, exit: ${n}`}),i=1,(s||a||c)&&(await G({task:`bash: ${r}`,agent:"cli-hook",domain:d,success:t,source:"cli-hook-post-command"}),h=!0);let k=ot(r);k&&await rt({command:r,framework:k,success:t,durationMs:0});let u=R(),E=Ne.join(u,".agentic-qe"),m=await O(E);await D(m)}catch(l){console.error(V.dim(`[hooks] post-command learning: ${l instanceof Error?l.message:"unknown"}`))}e.json&&f({success:!0,command:r.substring(0,100),commandSuccess:t,exitCode:n,patternsLearned:i,experienceRecorded:h});return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}})}function xn(){let o=new st("hooks").description("Self-learning QE hooks for pattern recognition and guidance").addHelpText("after",`
|
|
261
|
+
Examples:
|
|
262
|
+
# File editing hooks (learning from edits)
|
|
263
|
+
aqe hooks pre-edit --file src/utils.ts --operation create
|
|
264
|
+
aqe hooks post-edit --file src/utils.ts --success
|
|
265
|
+
|
|
266
|
+
# Task routing and guidance
|
|
267
|
+
aqe hooks route --task "Generate tests for UserService"
|
|
268
|
+
aqe hooks pre-task --description "Generate tests" --json
|
|
269
|
+
aqe hooks post-task --task-id "task-123" --success true
|
|
270
|
+
aqe hooks post-route --success true --json # Stop hook (#451)
|
|
271
|
+
|
|
272
|
+
# Bash command hooks
|
|
273
|
+
aqe hooks pre-command --command "npm test" --json
|
|
274
|
+
aqe hooks post-command --command "npm test" --success true
|
|
275
|
+
|
|
276
|
+
# Session lifecycle (Stop hook)
|
|
277
|
+
aqe hooks session-start --session-id "session-123"
|
|
278
|
+
aqe hooks session-end --save-state --json
|
|
279
|
+
|
|
280
|
+
# Pattern management
|
|
281
|
+
aqe hooks learn --name "test-pattern" --description "A test pattern"
|
|
282
|
+
aqe hooks search --query "authentication"
|
|
283
|
+
aqe hooks stats
|
|
284
|
+
aqe hooks list
|
|
285
|
+
`);return Ee(o),Te(o),_e(o),Se(o),ve(o),De(o),o}export{v as QE_HOOK_EVENTS,xn as createHooksCommand,_ as getHooksSystem,g as hooksState};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a,b,c}from"./chunk-JPOEI7CJ.js";import"./chunk-DJQYZ4RZ.js";import"./chunk-MEN3UW7W.js";import"./chunk-CS3UB2OL.js";import"./chunk-MWPFUBXS.js";import"./chunk-S73KENCH.js";import"./chunk-7DU35D4M.js";import"./chunk-S7HQOGVD.js";export{a as HybridRouter,b as createHybridRouter,c as createQERouter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.
|
|
2
|
-
import{a,b,c,d,e}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a,b,c,d,e}from"./chunk-NGSA53GC.js";import"./chunk-YEO2Z3UX.js";import"./chunk-56RA6YPN.js";import"./chunk-S73KENCH.js";import"./chunk-7DU35D4M.js";import"./chunk-S7HQOGVD.js";export{a as DEFAULT_HYPERGRAPH_ENGINE_CONFIG,b as HypergraphEngine,c as createHypergraphEngine,d as createHypergraphEngineSync,e as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import"./chunk-S7HQOGVD.js";import e from"chalk";import{join as m,resolve as h}from"path";import{existsSync as y}from"fs";var c=class{name="hypergraph";description="Query the code knowledge hypergraph";cleanupAndExit;ensureInitialized;constructor(n,r){this.cleanupAndExit=n,this.ensureInitialized=r}register(n,r){let s=n.command("hypergraph").alias("hg").description(this.description);s.command("stats").description("Show hypergraph statistics (node/edge counts by type)").option("--db <path>","Database path").action(async t=>{await this.executeStats(t)}),s.command("untested").description("Find functions with no test coverage").option("--db <path>","Database path").option("--limit <number>","Max results","20").action(async t=>{await this.executeUntested(t)}),s.command("impacted <files...>").description("Find tests impacted by changed files").option("--db <path>","Database path").action(async(t,i)=>{await this.executeImpacted(t,i)}),s.command("gaps").description("Find functions with low coverage").option("--db <path>","Database path").option("--max-coverage <number>","Coverage threshold (%)","50").option("--limit <number>","Max results","20").action(async t=>{await this.executeGaps(t)})}async executeStats(n){if(!await this.ensureInitialized())return;let{engine:r,close:s}=await this.openEngine(n.db);try{let t=await r.getStats();if(console.log(e.blue(`
|
|
3
3
|
Hypergraph Statistics
|
|
4
4
|
`)),console.log(e.white(` Total nodes: ${t.totalNodes}`)),console.log(e.white(` Total edges: ${t.totalEdges}`)),t.totalNodes>0){console.log(e.gray(`
|
|
5
5
|
Nodes by type:`));for(let[i,o]of Object.entries(t.nodesByType))o>0&&console.log(e.gray(` ${i}: ${o}`));console.log(e.gray(`
|
|
@@ -15,7 +15,7 @@ import"./chunk-SVILIQQQ.js";import e from"chalk";import{join as m,resolve as h}f
|
|
|
15
15
|
`))}finally{i()}await this.cleanupAndExit(0)}async executeGaps(n){if(!await this.ensureInitialized())return;let{engine:r,close:s}=await this.openEngine(n.db);try{let t=parseInt(n.maxCoverage,10)||50,i=parseInt(n.limit,10)||20,o=await r.findCoverageGaps(t),a=o.slice(0,i);if(console.log(e.blue(`
|
|
16
16
|
Coverage Gaps (<= ${t}%) \u2014 ${o.length} total
|
|
17
17
|
`)),a.length===0)console.log(e.green(" No coverage gaps found!"));else{for(let l of a){let d=l.coverage!==void 0?e.red(` ${l.coverage}%`):"",p=l.complexity?e.yellow(` complexity=${l.complexity}`):"";console.log(e.white(` ${l.name}`)+d+e.gray(` ${l.filePath||""}`)+p)}o.length>i&&console.log(e.gray(`
|
|
18
|
-
... and ${o.length-i} more (use --limit to show more)`))}console.log("")}finally{s()}await this.cleanupAndExit(0)}async openEngine(n){let{findProjectRoot:r}=await import("./unified-memory-
|
|
18
|
+
... and ${o.length-i} more (use --limit to show more)`))}console.log("")}finally{s()}await this.cleanupAndExit(0)}async openEngine(n){let{findProjectRoot:r}=await import("./unified-memory-27QJHABO.js"),{openDatabase:s}=await import("./safe-db-MNKFEPBX.js"),{createHypergraphEngine:t}=await import("./hypergraph-engine-56FMXI3T.js"),i=r(),o=n||m(i,".agentic-qe","memory.db");if(!y(o))throw new Error(`Database not found: ${o}
|
|
19
19
|
Run "aqe init --auto" first.`);let a=s(o);try{return{engine:await t({db:a,maxTraversalDepth:10,maxQueryResults:1e3,enableVectorSearch:!1}),close:()=>{try{a.close()}catch{}}}}catch(l){try{a.close()}catch{}throw l}}getHelp(){return`
|
|
20
20
|
Query the code knowledge hypergraph for untested functions,
|
|
21
21
|
impacted tests, and coverage gaps.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
|
|
2
|
+
import{a}from"./chunk-RFVZMNYX.js";import"./chunk-MIMJVKJJ.js";import"./chunk-DN65ILSI.js";import"./chunk-56RA6YPN.js";import"./chunk-RLZDXQNM.js";import"./chunk-VC256KH2.js";import"./chunk-IRS4HKAR.js";import"./chunk-S73KENCH.js";import"./chunk-7DU35D4M.js";import"./chunk-S7HQOGVD.js";export{a as ImpactAnalyzerService};
|