agentic-qe 3.12.1 → 3.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +87 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-D657MKZY.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-P4VYM5KK.js → agent-booster-wasm-XFAQATTH.js} +2 -2
- package/dist/cli/chunks/{agent-handler-PBQ7L2TO.js → agent-handler-2ZV4CA3U.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-UPWO3X6V.js → agent-memory-branch-6WGP7F5T.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-AFR6OZJK.js +2 -0
- package/dist/cli/chunks/{arena-QYTP3FG6.js → arena-FWX7XZAE.js} +4 -4
- package/dist/cli/chunks/{arena-LEUTILZ7.js → arena-KJUNQK4N.js} +2 -2
- package/dist/cli/chunks/{audit-TB6M2YLK.js → audit-YFUDEOKN.js} +3 -3
- package/dist/cli/chunks/base-K5QRGZWE.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-62RTSHAY.js → better-sqlite3-FE55OGYB.js} +2 -2
- package/dist/cli/chunks/brain-handler-ZCK4WTPK.js +89 -0
- package/dist/cli/chunks/{branch-enumerator-WEIP3DXB.js → branch-enumerator-HTVINRYG.js} +2 -2
- package/dist/cli/chunks/{browser-HY6VLXHZ.js → browser-WUL2B77M.js} +2 -2
- package/dist/cli/chunks/browser-workflow-ZMMKCGYW.js +2 -0
- package/dist/cli/chunks/{chunk-NHRBKOYD.js → chunk-2CPJCXV6.js} +2 -2
- package/dist/cli/chunks/{chunk-D72N5V2S.js → chunk-2HCMRGMO.js} +2 -2
- package/dist/cli/chunks/{chunk-UBPJQKYS.js → chunk-2LNDU7AW.js} +2 -2
- package/dist/cli/chunks/{chunk-ONSNNY6J.js → chunk-2OX74DOO.js} +1 -1
- package/dist/cli/chunks/{chunk-QORWBION.js → chunk-2YDZXFO2.js} +2 -2
- package/dist/cli/chunks/{chunk-QJXUK54J.js → chunk-32L7DKNQ.js} +2 -2
- package/dist/cli/chunks/{chunk-UZXDYT6O.js → chunk-3YC4YUGB.js} +2 -2
- package/dist/cli/chunks/{chunk-NOCPO55P.js → chunk-4EHW4TNA.js} +2 -2
- package/dist/cli/chunks/{chunk-QZBPXJ5C.js → chunk-4HP7N6SP.js} +2 -2
- package/dist/cli/chunks/{chunk-XTAXSKPC.js → chunk-5FAWIIWF.js} +2 -2
- package/dist/cli/chunks/{chunk-YGB3MT3R.js → chunk-67BCEHU5.js} +1 -1
- package/dist/cli/chunks/{chunk-3W2FZXFD.js → chunk-6E47R27C.js} +1 -1
- package/dist/cli/chunks/{chunk-74VIADSJ.js → chunk-6HQDPDN5.js} +2 -2
- package/dist/cli/chunks/chunk-6SQ72FG7.js +2 -0
- package/dist/cli/chunks/{chunk-RJ7TU2MP.js → chunk-6SUSRXXF.js} +1 -1
- package/dist/cli/chunks/{chunk-FFSS3Y6W.js → chunk-72QQDR3Y.js} +2 -2
- package/dist/cli/chunks/{chunk-CP4GSICY.js → chunk-7Q74K3HZ.js} +1 -1
- package/dist/cli/chunks/{chunk-UEC53US3.js → chunk-7WF3TW3G.js} +4 -4
- package/dist/cli/chunks/chunk-7XUM4LBC.js +2 -0
- package/dist/cli/chunks/{chunk-UGPBL7LX.js → chunk-ADQFQBFJ.js} +2 -2
- package/dist/cli/chunks/{chunk-BALFQQB7.js → chunk-AIWRYWK2.js} +2 -2
- package/dist/cli/chunks/{chunk-XJTGLG7G.js → chunk-AZ24ONMX.js} +1 -1
- package/dist/cli/chunks/{chunk-LRWBOJ5Y.js → chunk-BDGKB2PT.js} +2 -2
- package/dist/cli/chunks/{chunk-NK2Z6FGF.js → chunk-BEPP57C2.js} +2 -2
- package/dist/cli/chunks/{chunk-HGKSU4QV.js → chunk-BQ2K4BPD.js} +2 -2
- package/dist/cli/chunks/{chunk-QOAI6ETC.js → chunk-BSNNTOHY.js} +3 -3
- package/dist/cli/chunks/chunk-CHFTHSMM.js +9 -0
- package/dist/cli/chunks/{chunk-IHWWZOHP.js → chunk-CL6SNCFF.js} +1 -1
- package/dist/cli/chunks/{chunk-7N2SCRWJ.js → chunk-CXMOIE7D.js} +2 -2
- package/dist/cli/chunks/{chunk-PZ3Q34OT.js → chunk-CYSBM52D.js} +2 -2
- package/dist/cli/chunks/{chunk-X2CEX4KC.js → chunk-D4GMAUTP.js} +10 -10
- package/dist/cli/chunks/{chunk-JDZIBSMY.js → chunk-DCYBV6HV.js} +1 -1
- package/dist/cli/chunks/chunk-DDYP6FBC.js +2 -0
- package/dist/cli/chunks/{chunk-SFQFBLWQ.js → chunk-DHUZHT5D.js} +1 -1
- package/dist/cli/chunks/{chunk-X2K3BTI4.js → chunk-DMD6WVJ2.js} +2 -2
- package/dist/cli/chunks/{chunk-GW3M7GQH.js → chunk-DTZFZ5M7.js} +2 -2
- package/dist/cli/chunks/{chunk-WBDV4V3H.js → chunk-DW7OI5IF.js} +2 -2
- package/dist/cli/chunks/{chunk-CYYT6YEV.js → chunk-DZ775UGW.js} +2 -2
- package/dist/cli/chunks/{chunk-BNMV5DCM.js → chunk-E2U3LTGM.js} +1 -1
- package/dist/cli/chunks/{chunk-KQV5644J.js → chunk-E53UR2EW.js} +3 -3
- package/dist/cli/chunks/{chunk-XYV6YUWS.js → chunk-EH7TSJPS.js} +2 -2
- package/dist/cli/chunks/{chunk-42GFB7VX.js → chunk-EHO52NKU.js} +2 -2
- package/dist/cli/chunks/{chunk-75AVUS5U.js → chunk-EOUJ6X5H.js} +1 -1
- package/dist/cli/chunks/{chunk-ZNITDSWL.js → chunk-FHHCH7WL.js} +1 -1
- package/dist/cli/chunks/{chunk-PQ4NSXZM.js → chunk-FJACKKRL.js} +2 -2
- package/dist/cli/chunks/{chunk-45QNHMTP.js → chunk-FTM562PF.js} +1 -1
- package/dist/cli/chunks/{chunk-4KI72C2E.js → chunk-FXOOOJQD.js} +1 -1
- package/dist/cli/chunks/chunk-G5OGKVLO.js +2 -0
- package/dist/cli/chunks/{chunk-42PYEEYQ.js → chunk-GGTCD4MA.js} +1 -1
- package/dist/cli/chunks/{chunk-GASACVTU.js → chunk-GMFFMJD6.js} +2 -2
- package/dist/cli/chunks/{chunk-JRNDFC23.js → chunk-GS6G7AVS.js} +2 -2
- package/dist/cli/chunks/{chunk-BKKJEKNT.js → chunk-GV2BS5NC.js} +2 -2
- package/dist/cli/chunks/{chunk-JRHRC2MP.js → chunk-HGJQSTQD.js} +1 -1
- package/dist/cli/chunks/{chunk-M5P5WNXA.js → chunk-HJ2LG5IH.js} +1 -1
- package/dist/cli/chunks/{chunk-UR655D4K.js → chunk-HJ4U64BL.js} +2 -2
- package/dist/cli/chunks/chunk-ILRKO6A5.js +43 -0
- package/dist/cli/chunks/{chunk-LZ6TJ7XL.js → chunk-IWQHQLT6.js} +2 -2
- package/dist/cli/chunks/{chunk-SHKOPOPD.js → chunk-J2RJOJ5Q.js} +1 -1
- package/dist/cli/chunks/{chunk-JIM4VSLF.js → chunk-KA4EAMMQ.js} +3 -3
- package/dist/cli/chunks/{chunk-6432JORM.js → chunk-KE3RK35K.js} +1 -1
- package/dist/cli/chunks/{chunk-VTFYY4SH.js → chunk-KGHSKDC7.js} +2 -2
- package/dist/cli/chunks/{chunk-3I3Z4C5X.js → chunk-KKOFH26C.js} +1 -1
- package/dist/cli/chunks/{chunk-AGWKCY42.js → chunk-KNWBRMLL.js} +2 -2
- package/dist/cli/chunks/{chunk-C7HGYLNF.js → chunk-KRS4KGX5.js} +2 -2
- package/dist/cli/chunks/{chunk-VHJCQBD2.js → chunk-KVHCWH4H.js} +2 -2
- package/dist/cli/chunks/{chunk-N3PSRG6F.js → chunk-KXKACV3E.js} +2 -2
- package/dist/cli/chunks/{chunk-BLU7OLQZ.js → chunk-L2X3BWMN.js} +2 -2
- package/dist/cli/chunks/{chunk-4U5MJX2H.js → chunk-L6GZGEFQ.js} +2 -2
- package/dist/cli/chunks/{chunk-DSNFOX22.js → chunk-LCM7TY76.js} +2 -2
- package/dist/cli/chunks/{chunk-NVXSM7UO.js → chunk-LGYEOYQJ.js} +2 -2
- package/dist/cli/chunks/{chunk-J4IAMQZI.js → chunk-LHAUFY4Y.js} +2 -2
- package/dist/cli/chunks/{chunk-OJORNYN3.js → chunk-LNIHLNW4.js} +3 -3
- package/dist/cli/chunks/{chunk-PRA73XZY.js → chunk-M32DTUZM.js} +2 -2
- package/dist/cli/chunks/{chunk-GGF5FZWS.js → chunk-M7W6VJ65.js} +1 -1
- package/dist/cli/chunks/{chunk-HZGFER4N.js → chunk-MB7TZQW3.js} +3 -3
- package/dist/cli/chunks/{chunk-RIASOMB2.js → chunk-MOX25RZQ.js} +2 -2
- package/dist/cli/chunks/{chunk-BPM7NEHS.js → chunk-MOXKKY5Q.js} +6 -6
- package/dist/cli/chunks/{chunk-UKF4V7LE.js → chunk-MS6VOSPY.js} +5 -5
- package/dist/cli/chunks/{chunk-QXZOUETY.js → chunk-MSDIIRLM.js} +2 -2
- package/dist/cli/chunks/{chunk-BBNQDHGF.js → chunk-MZ7SIO6R.js} +2 -2
- package/dist/cli/chunks/{chunk-HDI3FD4G.js → chunk-N4ML23ZG.js} +1 -1
- package/dist/cli/chunks/{chunk-7KHIOWBN.js → chunk-NAMJGRGC.js} +1 -1
- package/dist/cli/chunks/{chunk-IE6FDICX.js → chunk-NJDLJ3KD.js} +2 -2
- package/dist/cli/chunks/{chunk-4LKQZW2H.js → chunk-NKTLKMUB.js} +1 -1
- package/dist/cli/chunks/{chunk-CXUHD2O5.js → chunk-NLDLUHOF.js} +2 -2
- package/dist/cli/chunks/{chunk-XDRAU3W6.js → chunk-NOSQI2OW.js} +2 -2
- package/dist/cli/chunks/{chunk-ZCDGLNJ7.js → chunk-NT66CT73.js} +2 -2
- package/dist/cli/chunks/{chunk-JWZNWVLG.js → chunk-NX522PRH.js} +2 -2
- package/dist/cli/chunks/{chunk-O65OPAZH.js → chunk-OBL6W4Z5.js} +2 -2
- package/dist/cli/chunks/chunk-OPG2HV2W.js +2 -0
- package/dist/cli/chunks/{chunk-BCBITOMT.js → chunk-PDX7IYTJ.js} +2 -2
- package/dist/cli/chunks/{chunk-IC6SOVGO.js → chunk-PEHEANAM.js} +2 -2
- package/dist/cli/chunks/{chunk-J6ZCULWG.js → chunk-PPUDKQ4X.js} +2 -2
- package/dist/cli/chunks/{chunk-WPEGG6DX.js → chunk-PSDH7CIL.js} +1 -1
- package/dist/cli/chunks/{chunk-NTMN2ZJY.js → chunk-PTPN6HQ7.js} +2 -2
- package/dist/cli/chunks/{chunk-C2K4LQI5.js → chunk-PXCJDB7J.js} +1 -1
- package/dist/cli/chunks/{chunk-WPG5LXR7.js → chunk-QILF6BZH.js} +2 -2
- package/dist/cli/chunks/{chunk-BAHXVVX3.js → chunk-R6WMGSEK.js} +2 -2
- package/dist/cli/chunks/{chunk-2PQ7YADF.js → chunk-RE42RJYR.js} +2 -2
- package/dist/cli/chunks/{chunk-BWNMAXV7.js → chunk-RLBNAB6Y.js} +1 -1
- package/dist/cli/chunks/{chunk-BXIJY6SB.js → chunk-ROFCS47F.js} +1 -1
- package/dist/cli/chunks/{chunk-7KK6XSYK.js → chunk-RSZOCQOL.js} +2 -2
- package/dist/cli/chunks/{chunk-NEXJUTHF.js → chunk-S47YGWXK.js} +2 -2
- package/dist/cli/chunks/{chunk-5H5A74U2.js → chunk-SFS3UHNF.js} +1 -1
- package/dist/cli/chunks/{chunk-U5ITD7ZD.js → chunk-SGMJ277D.js} +1 -1
- package/dist/cli/chunks/{chunk-OXVAGR64.js → chunk-SPI4LUJ6.js} +2 -2
- package/dist/cli/chunks/{chunk-FBYFDD7L.js → chunk-SV7J5FDW.js} +2 -2
- package/dist/cli/chunks/{chunk-S42RFOZJ.js → chunk-TP3UAWMB.js} +2 -2
- package/dist/cli/chunks/{chunk-OEXSBR72.js → chunk-TXLPOXAN.js} +1 -1
- package/dist/cli/chunks/{chunk-R4A6PY5D.js → chunk-UAPUA6OY.js} +2 -2
- package/dist/cli/chunks/{chunk-55MQ2SFP.js → chunk-UGW23T6S.js} +2 -2
- package/dist/cli/chunks/{chunk-774X6OJY.js → chunk-UGXHMQ6P.js} +2 -2
- package/dist/cli/chunks/{chunk-GLO53MUQ.js → chunk-UIHZ34SJ.js} +2 -2
- package/dist/cli/chunks/{chunk-TMPRR3FZ.js → chunk-ULQCEM7K.js} +2 -2
- package/dist/cli/chunks/{chunk-YNXQMJGJ.js → chunk-UZ7FXVH5.js} +1 -1
- package/dist/cli/chunks/{chunk-LAJHHR3Q.js → chunk-VFYMWDSJ.js} +1 -1
- package/dist/cli/chunks/{chunk-XS6BIOPQ.js → chunk-VSD6JE2H.js} +2 -2
- package/dist/cli/chunks/{chunk-MIAY35K6.js → chunk-VUCVSKJC.js} +2 -2
- package/dist/cli/chunks/{chunk-I4BZLVFE.js → chunk-WBZNLFTV.js} +3 -3
- package/dist/cli/chunks/{chunk-PDS5P5QD.js → chunk-WFPGIP4N.js} +2 -2
- package/dist/cli/chunks/{chunk-PZZDAECU.js → chunk-WKE6WL5C.js} +3 -3
- package/dist/cli/chunks/{chunk-VFRWLSQO.js → chunk-WQASUQ5P.js} +1 -1
- package/dist/cli/chunks/{chunk-GXMNCW2M.js → chunk-WUE53ZPH.js} +1 -1
- package/dist/cli/chunks/{chunk-UBWSYDO5.js → chunk-XBOCRCC6.js} +1 -1
- package/dist/cli/chunks/{chunk-HHMTQQUE.js → chunk-XDHGCBTS.js} +2 -2
- package/dist/cli/chunks/chunk-XQ5JT7KM.js +3 -0
- package/dist/cli/chunks/{chunk-USTUWUCE.js → chunk-XUUVAAHV.js} +2 -2
- package/dist/cli/chunks/{chunk-6RX5QZMU.js → chunk-XZGOXLZH.js} +1 -1
- package/dist/cli/chunks/{chunk-DQ3J7ZT6.js → chunk-Y5L37K7X.js} +2 -2
- package/dist/cli/chunks/{chunk-5HMGDB7B.js → chunk-Y625LP6K.js} +3 -3
- package/dist/cli/chunks/{chunk-REJGZP27.js → chunk-Y6XNISHP.js} +2 -2
- package/dist/cli/chunks/{chunk-LF5XOYR7.js → chunk-YDYKFSD2.js} +11 -11
- package/dist/cli/chunks/{chunk-U55X2ZUM.js → chunk-YEC55GO5.js} +2 -2
- package/dist/cli/chunks/{chunk-6ONUCDVL.js → chunk-YOG5KQZF.js} +2 -2
- package/dist/cli/chunks/{chunk-6BCVKCG5.js → chunk-YUDGQZJN.js} +2 -2
- package/dist/cli/chunks/{chunk-EOBZJDJR.js → chunk-Z3SXMYVI.js} +3 -3
- package/dist/cli/chunks/chunk-ZFLE4D4X.js +18 -0
- package/dist/cli/chunks/{chunk-W52R3G22.js → chunk-ZGKQCUPB.js} +2 -2
- package/dist/cli/chunks/{chunk-MCUILJ33.js → chunk-ZTKCGEB6.js} +1 -1
- package/dist/cli/chunks/{ci-IU5HVUL5.js → ci-MMLUV6L6.js} +2 -2
- package/dist/cli/chunks/{ci-output-CLI4A43F.js → ci-output-25GS6RXR.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-ZR5OFMW7.js → circuit-breaker-4OWAN6R6.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-UBMA6ZHJ.js → claude-flow-setup-LR3SRBX6.js} +2 -2
- package/dist/cli/chunks/client-WI7RRUZO.js +2 -0
- package/dist/cli/chunks/{cline-installer-EWYELOBI.js → cline-installer-YSZWRZUI.js} +2 -2
- package/dist/cli/chunks/{code-YSPF4MXN.js → code-UUWUIXI7.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-WW5OKSTN.js → code-index-extractor-2LSPQORU.js} +2 -2
- package/dist/cli/chunks/{codex-installer-GLADK5PY.js → codex-installer-E5BVXZVA.js} +2 -2
- package/dist/cli/chunks/{completions-2KTWZ3AK.js → completions-YKXBKZSO.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-KMX4OWKB.js → complexity-analyzer-HNT2QRWB.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-4FHU4OEJ.js → continuedev-installer-AW5VCB66.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-AKR4WE7B.js → copilot-installer-B6SVZXQT.js} +2 -2
- package/dist/cli/chunks/core-handlers-T6URR57V.js +2 -0
- package/dist/cli/chunks/{cost-tracker-BUJ6WEWY.js → cost-tracker-POZMBN2V.js} +2 -2
- package/dist/cli/chunks/{coverage-OB6HVQS4.js → coverage-V5BGPN5Q.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-WHTTKHWM.js +2 -0
- package/dist/cli/chunks/{cursor-installer-3AOE4O3Q.js → cursor-installer-EYBI4QVK.js} +2 -2
- package/dist/cli/chunks/{daemon-4RAL5URG.js → daemon-CF6ENQB2.js} +3 -3
- package/dist/cli/chunks/{daemon-JGSPLYGO.js → daemon-HKARXY2W.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-DSBTHIMH.js → dag-attention-scheduler-XIL5IAP7.js} +2 -2
- package/dist/cli/chunks/{detect-6CVW2VUQ.js → detect-RRX2U2KK.js} +2 -2
- package/dist/cli/chunks/{dist-node-EWPKBTYA.js → dist-node-DOANNRCS.js} +2 -2
- package/dist/cli/chunks/{domain-handler-HLVIJU25.js → domain-handler-QMTJV5OR.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-7Y3BR3YU.js → domain-transfer-FSNH75XW.js} +2 -2
- package/dist/cli/chunks/dream-QUL6SURC.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-ZMJ3263X.js → embed-and-insert-pattern-NI7PGONV.js} +2 -2
- package/dist/cli/chunks/eval-6ZAF2RY3.js +17 -0
- package/dist/cli/chunks/{experience-capture-middleware-OGJ3JOSQ.js → experience-capture-middleware-JMXR7N5G.js} +3 -3
- package/dist/cli/chunks/{fast-paths-5XCY3Y6U.js → fast-paths-YB7XZZ76.js} +2 -2
- package/dist/cli/chunks/{feature-flags-R5V2FRJR.js → feature-flags-2RC4GFC4.js} +2 -2
- package/dist/cli/chunks/{feature-flags-VULQI6KY.js → feature-flags-KJSP7KR6.js} +2 -2
- package/dist/cli/chunks/{file-discovery-HW33C3HC.js → file-discovery-SUPBXFYI.js} +2 -2
- package/dist/cli/chunks/{fleet-NH3XR5OY.js → fleet-KSXFOLFW.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-L3XMLPTG.js → gnn-wrapper-DFZ5KPPK.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-TIQFBT4D.js → heartbeat-handler-G3EADK2H.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-VZNKE33K.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-LGWLDZLC.js +2 -0
- package/dist/cli/chunks/hnsw-index-66FOOI7U.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-YL2SUIPA.js → hnsw-legacy-bridge-MA676GER.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-IPKCAVLS.js → hnswlib-node-SKTT5KIH.js} +2 -2
- package/dist/cli/chunks/{hooks-UR2ZF54G.js → hooks-HTCPMZNZ.js} +10 -10
- package/dist/cli/chunks/hybrid-router-I5MEVQDF.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-NX45AOPY.js → hypergraph-engine-QPB3IH4A.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-LUM4YI4K.js → hypergraph-handler-GBFSVD7N.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-K6ANYIY3.js +2 -0
- package/dist/cli/chunks/{init-handler-YTKKNTVV.js → init-handler-XYBTBCPD.js} +6 -6
- package/dist/cli/chunks/init-wizard-URHGXJ32.js +2 -0
- package/dist/cli/chunks/kernel-OKI5ZY5P.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-ZW7DVH7T.js → kilocode-installer-LY6JOBFY.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-IA7INW4N.js → kiro-installer-JF6NXTJL.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-VQQSK7T5.js +2 -0
- package/dist/cli/chunks/{learning-4AZ5PGTT.js → learning-BIISN67N.js} +3 -3
- package/dist/cli/chunks/{llm-router-WQ4E3AOP.js → llm-router-YZUNVZQE.js} +5 -5
- package/dist/cli/chunks/llm-router-service-TISH33SY.js +2 -0
- package/dist/cli/chunks/{load-4FAH7CZO.js → load-MTWNBNLL.js} +2 -2
- package/dist/cli/chunks/load-test-KWKWC4Q7.js +2 -0
- package/dist/cli/chunks/{mcp-KLLHI6DG.js → mcp-37PYMNHQ.js} +2 -2
- package/dist/cli/chunks/{memory-Q5HLIUC6.js → memory-IXUUDCI3.js} +5 -5
- package/dist/cli/chunks/memory-backend-JSQQMXVS.js +2 -0
- package/dist/cli/chunks/memory-handlers-RM2VOFJX.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-ABI73AFV.js → multi-model-executor-RKKS5XYG.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-KRPQ6JOJ.js → opencode-installer-3VXI5MTR.js} +2 -2
- package/dist/cli/chunks/{orchestrator-SUPEONRG.js → orchestrator-UO3ZOGFZ.js} +5 -5
- package/dist/cli/chunks/pattern-null-store-SXBIUKE5.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-R4GKK6RZ.js → pattern-usage-recorder-YJKRL2GI.js} +2 -2
- package/dist/cli/chunks/{pipeline-LCUETNGD.js → pipeline-GJQJKXWX.js} +2 -2
- package/dist/cli/chunks/{platform-WJDIB4X3.js → platform-RHVCZK6C.js} +2 -2
- package/dist/cli/chunks/{plugin-2X5NY2RF.js → plugin-ZKAIW7O6.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-3T665QC6.js → prime-radiant-advanced-wasm-4X3DSKQV.js} +2 -2
- package/dist/cli/chunks/protocol-executor-D3Q5P3WY.js +2 -0
- package/dist/cli/chunks/{protocol-handler-JTXRF7GU.js → protocol-handler-KKYQZMB2.js} +2 -2
- package/dist/cli/chunks/{prove-BFPWWPOC.js → prove-OD6RPKWX.js} +2 -2
- package/dist/cli/chunks/provider-manager-2EIX7E5Q.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-ITOW2ZHC.js +2 -0
- package/dist/cli/chunks/{quality-F7UZU4RN.js → quality-ZRWBXCKO.js} +2 -2
- package/dist/cli/chunks/{quality-gate-R5L4UZIX.js → quality-gate-Y6BWQV7J.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-TO5X2EXL.js +2 -0
- package/dist/cli/chunks/{real-embeddings-LZD6HTQF.js → real-embeddings-YYEUO4P2.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-6TTG7VSH.js → roocode-installer-JBCPS3FK.js} +2 -2
- package/dist/cli/chunks/router-GZJQEJU3.js +2 -0
- package/dist/cli/chunks/routing-feedback-CRXSKFNS.js +2 -0
- package/dist/cli/chunks/{routing-handler-SW442GK7.js → routing-handler-KTPJOSBJ.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-CLFGKXMW.js → ruvector-commands-SCZZVRE7.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-EVPPXXXS.js → rvf-dual-writer-IP7GELQJ.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-NOHDIRIP.js → rvf-migration-adapter-WLFTDARU.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-BYJ3M7WZ.js → rvf-migration-coordinator-MGFDQ5WD.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-WHADT5HX.js +2 -0
- package/dist/cli/chunks/rvf-store-integrity-OTOAGT5W.js +2 -0
- package/dist/cli/chunks/safe-db-MIZ2OFWC.js +2 -0
- package/dist/cli/chunks/schedule-XFILYTYC.js +2 -0
- package/dist/cli/chunks/scheduler-EIPJ777A.js +2 -0
- package/dist/cli/chunks/{security-IXDKBPSG.js → security-B2CLZKRB.js} +3 -3
- package/dist/cli/chunks/shared-rvf-adapter-2PMFAQMN.js +2 -0
- package/dist/cli/chunks/{shared-rvf-dual-writer-FFKBKYNL.js → shared-rvf-dual-writer-B6P732AV.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-PFU3GSRD.js +2 -0
- package/dist/cli/chunks/status-handler-M6SN2W2D.js +47 -0
- package/dist/cli/chunks/{structural-health-55X6BTLT.js → structural-health-YCCTGI3K.js} +2 -2
- package/dist/cli/chunks/{sync-BUGDXW3Y.js → sync-3SDMVAIU.js} +2 -2
- package/dist/cli/chunks/{sync-NUG67HGK.js → sync-KSRF77ID.js} +2 -2
- package/dist/cli/chunks/{task-handler-T6ZKXV4S.js → task-handler-MIKRB2SL.js} +2 -2
- package/dist/cli/chunks/{task-handlers-H63TB2UI.js → task-handlers-YXKRUBQ4.js} +3 -3
- package/dist/cli/chunks/{test-VEK76SBT.js → test-MLOLQCB7.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-QZM6PNZH.js → test-scheduling-3KXESUZS.js} +3 -3
- package/dist/cli/chunks/token-bootstrap-6V2PMDBJ.js +2 -0
- package/dist/cli/chunks/{token-usage-OBY6UEUR.js → token-usage-DP6THJ3I.js} +2 -2
- package/dist/cli/chunks/{transformers-EFNY2MRX.js → transformers-QFOBOP2Y.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-EU2S5NVM.js → tree-sitter-wasm-parser-COK2XERS.js} +2 -2
- package/dist/cli/chunks/{types-3DYRKX23.js → types-PYHUCVOZ.js} +2 -2
- package/dist/cli/chunks/unified-memory-OUVCMFGK.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-YGQPOHXB.js +2 -0
- package/dist/cli/chunks/unified-persistence-GFRZVDOW.js +2 -0
- package/dist/cli/chunks/{upgrade-H5V53FRF.js → upgrade-ONP2HNGL.js} +2 -2
- package/dist/cli/chunks/{validate-IL22VB5I.js → validate-NWSICDAY.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-WZKECK3W.js → validate-swarm-KXS5P3U7.js} +2 -2
- package/dist/cli/chunks/{vibium-KKM23OTQ.js → vibium-TZSGZRCQ.js} +2 -2
- package/dist/cli/chunks/visual-security-LVOOYQ64.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-NJM5YBOY.js → web-tree-sitter-V2FADNRA.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-SLP43TVT.js → windsurf-installer-GQM7KWDC.js} +2 -2
- package/dist/cli/chunks/{witness-chain-XBEPT4XD.js → witness-chain-GTITDIA2.js} +2 -2
- package/dist/cli/chunks/witness-chain-QNFPV4UL.js +2 -0
- package/dist/cli/chunks/{witness-key-manager-DAAMNYOW.js → witness-key-manager-AHRM2M52.js} +2 -2
- package/dist/cli/chunks/{workflow-SZOOU6D3.js → workflow-XCGHEL3I.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-MIVBCALG.js +2 -0
- package/dist/cli/chunks/{wrappers-I2CBKWGF.js → wrappers-VGO2GO4J.js} +2 -2
- package/dist/cli/commands/eval.js +73 -3
- package/dist/cli/commands/llm-router.js +2 -0
- package/dist/cli/handlers/status-handler.d.ts +5 -0
- package/dist/cli/handlers/status-handler.js +35 -0
- package/dist/coordination/consensus/providers/index.js +11 -0
- package/dist/integrations/ruvector/brain-rvf-exporter.js +115 -13
- package/dist/integrations/ruvector/rvf-dual-writer.js +20 -3
- package/dist/integrations/ruvector/rvf-store-integrity.d.ts +49 -0
- package/dist/integrations/ruvector/rvf-store-integrity.js +137 -0
- package/dist/integrations/ruvector/shared-rvf-adapter.js +23 -5
- package/dist/learning/pattern-store.js +23 -5
- package/dist/learning/qe-flywheel/platform-signer.d.ts +32 -0
- package/dist/learning/qe-flywheel/platform-signer.js +60 -0
- package/dist/learning/qe-flywheel/receipt.js +9 -2
- package/dist/mcp/bundle.js +425 -406
- package/dist/shared/llm/billing-modes.d.ts +24 -0
- package/dist/shared/llm/billing-modes.js +56 -0
- package/dist/shared/llm/cost-tracker.js +2 -0
- package/dist/shared/llm/interfaces.d.ts +61 -3
- package/dist/shared/llm/provider-manager.d.ts +34 -0
- package/dist/shared/llm/provider-manager.js +152 -3
- package/dist/shared/llm/providers/claude-code.d.ts +57 -0
- package/dist/shared/llm/providers/claude-code.js +312 -0
- package/dist/shared/llm/providers/cognitum.d.ts +64 -0
- package/dist/shared/llm/providers/cognitum.js +369 -0
- package/dist/shared/llm/providers/index.d.ts +2 -0
- package/dist/shared/llm/providers/index.js +2 -0
- package/dist/shared/llm/router/config-store.d.ts +31 -11
- package/dist/shared/llm/router/config-store.js +82 -12
- package/dist/shared/llm/router/hybrid-router.js +16 -0
- package/dist/shared/llm/router/types.js +7 -0
- package/dist/shared/llm/spend-ledger.d.ts +64 -0
- package/dist/shared/llm/spend-ledger.js +115 -0
- package/dist/shared/llm/translation/message-formatter.js +2 -0
- package/dist/shared/llm/translation/prompt-translator.js +2 -0
- package/dist/shared/llm/translation/tool-translator.js +2 -0
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +2 -0
- package/dist/validation/provider-llm-executor.d.ts +45 -0
- package/dist/validation/provider-llm-executor.js +98 -0
- package/package.json +2 -2
- package/dist/cli/chunks/adapter-X4UEC6UJ.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-5FG7JCY7.js +0 -2
- package/dist/cli/chunks/base-CWPMFSZG.js +0 -2
- package/dist/cli/chunks/brain-handler-JF3OK35F.js +0 -89
- package/dist/cli/chunks/browser-workflow-A77OFBVY.js +0 -2
- package/dist/cli/chunks/chunk-CDVKFAYP.js +0 -18
- package/dist/cli/chunks/chunk-CJTXZI37.js +0 -2
- package/dist/cli/chunks/chunk-FNMEVLSN.js +0 -2
- package/dist/cli/chunks/chunk-P7G5LGUE.js +0 -3
- package/dist/cli/chunks/chunk-R7XEACKR.js +0 -2
- package/dist/cli/chunks/chunk-RAS7WRN5.js +0 -24
- package/dist/cli/chunks/chunk-TGIKKD43.js +0 -9
- package/dist/cli/chunks/client-KKCFGD7R.js +0 -2
- package/dist/cli/chunks/core-handlers-KRSSJEO5.js +0 -2
- package/dist/cli/chunks/cross-domain-router-27QGWU27.js +0 -2
- package/dist/cli/chunks/dream-M6K47Q4H.js +0 -2
- package/dist/cli/chunks/eval-73XW2WJD.js +0 -15
- package/dist/cli/chunks/heartbeat-scheduler-URXBF5RW.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-WWAGM6HK.js +0 -2
- package/dist/cli/chunks/hnsw-index-UFV2HSZE.js +0 -2
- package/dist/cli/chunks/hybrid-router-3U6Q6OTL.js +0 -2
- package/dist/cli/chunks/impact-analyzer-EUEX6ZRO.js +0 -2
- package/dist/cli/chunks/init-wizard-POKY2LRY.js +0 -2
- package/dist/cli/chunks/kernel-HPAONLZY.js +0 -2
- package/dist/cli/chunks/knowledge-graph-2WCUFG63.js +0 -2
- package/dist/cli/chunks/llm-router-service-D5VMG6SD.js +0 -2
- package/dist/cli/chunks/load-test-DHG26REU.js +0 -2
- package/dist/cli/chunks/memory-backend-GLWQ4DAL.js +0 -2
- package/dist/cli/chunks/memory-handlers-P72I4VV4.js +0 -2
- package/dist/cli/chunks/pattern-null-store-Y2YFTE3V.js +0 -2
- package/dist/cli/chunks/protocol-executor-HNT67NN5.js +0 -2
- package/dist/cli/chunks/provider-manager-5YGPZIEZ.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-Z5UGOA3F.js +0 -2
- package/dist/cli/chunks/queen-coordinator-P5LU5NWI.js +0 -2
- package/dist/cli/chunks/router-CRGHUAVR.js +0 -2
- package/dist/cli/chunks/routing-feedback-BVX5ZBCF.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-FZJSQOJM.js +0 -2
- package/dist/cli/chunks/safe-db-USYNEOC6.js +0 -2
- package/dist/cli/chunks/schedule-KCRCQ3PS.js +0 -2
- package/dist/cli/chunks/scheduler-CX3UHI4U.js +0 -2
- package/dist/cli/chunks/shared-rvf-adapter-VCOK3OVD.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-K23C4TFH.js +0 -2
- package/dist/cli/chunks/status-handler-M5W64S5U.js +0 -46
- package/dist/cli/chunks/token-bootstrap-W5IAMJW4.js +0 -2
- package/dist/cli/chunks/unified-memory-NCDBQLLF.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-T7NSGQ2H.js +0 -2
- package/dist/cli/chunks/unified-persistence-XUAYDCMM.js +0 -2
- package/dist/cli/chunks/visual-security-3TUC4GPP.js +0 -2
- package/dist/cli/chunks/witness-chain-QLOKUZXC.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-6JAYTZ7L.js +0 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 — LLM Spend Ledger (ADR-123)
|
|
3
|
+
*
|
|
4
|
+
* Issue #557: AQE declared budget caps (`maxCostPerHour/Day`,
|
|
5
|
+
* `COST_LIMIT_EXCEEDED`, `CostTracker.wouldExceedLimit`) but enforced none of
|
|
6
|
+
* them, and `CostTracker` is per-process in-memory — so a fleet of N agent
|
|
7
|
+
* processes each sees $0 cumulative spend and no cap can hold across them.
|
|
8
|
+
*
|
|
9
|
+
* This module persists every LLM charge to the unified `.agentic-qe/memory.db`
|
|
10
|
+
* (ADR: one DB, one schema — the `llm_spend` table is additive, never a new
|
|
11
|
+
* file) so a budget check reads the *shared* rolling-window spend across every
|
|
12
|
+
* process. When the unified DB is unavailable (e.g. a standalone eval script
|
|
13
|
+
* with no kernel), it degrades to an in-memory ledger that still enforces
|
|
14
|
+
* within the current process — never worse than today's behavior.
|
|
15
|
+
*
|
|
16
|
+
* better-sqlite3 is fully synchronous, so record/query are sync; multiple
|
|
17
|
+
* connections (one per process) to a WAL-mode DB is exactly the supported
|
|
18
|
+
* cross-process pattern.
|
|
19
|
+
*/
|
|
20
|
+
import type { Database as DatabaseType } from 'better-sqlite3';
|
|
21
|
+
import type { CostSource } from './interfaces';
|
|
22
|
+
/** A single persisted charge. */
|
|
23
|
+
export interface SpendEntry {
|
|
24
|
+
provider: string;
|
|
25
|
+
model: string;
|
|
26
|
+
costUsd: number;
|
|
27
|
+
costSource: CostSource;
|
|
28
|
+
promptTokens: number;
|
|
29
|
+
completionTokens: number;
|
|
30
|
+
requestId: string;
|
|
31
|
+
}
|
|
32
|
+
/** Cross-process spend ledger. */
|
|
33
|
+
export interface SpendLedger {
|
|
34
|
+
/** Persist a charge. Never throws for the caller — failures degrade silently. */
|
|
35
|
+
record(entry: SpendEntry): void;
|
|
36
|
+
/** Total USD charged within the last `windowMs` (rolling window ending now). */
|
|
37
|
+
spentSince(windowMs: number, nowMs?: number): number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* SQLite-backed ledger. Cross-process because every process opens its own
|
|
41
|
+
* connection to the same WAL-mode `memory.db`.
|
|
42
|
+
*/
|
|
43
|
+
export declare class SqliteSpendLedger implements SpendLedger {
|
|
44
|
+
private readonly db;
|
|
45
|
+
constructor(db: DatabaseType);
|
|
46
|
+
record(entry: SpendEntry): void;
|
|
47
|
+
spentSince(windowMs: number, nowMs?: number): number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* In-process fallback ledger. Used when no unified DB is available. Enforces
|
|
51
|
+
* within the current process only — no worse than the pre-ADR-123 behavior.
|
|
52
|
+
*/
|
|
53
|
+
export declare class InMemorySpendLedger implements SpendLedger {
|
|
54
|
+
private readonly entries;
|
|
55
|
+
record(entry: SpendEntry): void;
|
|
56
|
+
spentSince(windowMs: number, nowMs?: number): number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build the default ledger. Prefers the unified `memory.db` (cross-process);
|
|
60
|
+
* falls back to an in-memory ledger if the kernel DB can't be reached. Uses a
|
|
61
|
+
* dynamic import so the LLM layer stays statically decoupled from the kernel.
|
|
62
|
+
*/
|
|
63
|
+
export declare function createDefaultSpendLedger(): Promise<SpendLedger>;
|
|
64
|
+
//# sourceMappingURL=spend-ledger.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 — LLM Spend Ledger (ADR-123)
|
|
3
|
+
*
|
|
4
|
+
* Issue #557: AQE declared budget caps (`maxCostPerHour/Day`,
|
|
5
|
+
* `COST_LIMIT_EXCEEDED`, `CostTracker.wouldExceedLimit`) but enforced none of
|
|
6
|
+
* them, and `CostTracker` is per-process in-memory — so a fleet of N agent
|
|
7
|
+
* processes each sees $0 cumulative spend and no cap can hold across them.
|
|
8
|
+
*
|
|
9
|
+
* This module persists every LLM charge to the unified `.agentic-qe/memory.db`
|
|
10
|
+
* (ADR: one DB, one schema — the `llm_spend` table is additive, never a new
|
|
11
|
+
* file) so a budget check reads the *shared* rolling-window spend across every
|
|
12
|
+
* process. When the unified DB is unavailable (e.g. a standalone eval script
|
|
13
|
+
* with no kernel), it degrades to an in-memory ledger that still enforces
|
|
14
|
+
* within the current process — never worse than today's behavior.
|
|
15
|
+
*
|
|
16
|
+
* better-sqlite3 is fully synchronous, so record/query are sync; multiple
|
|
17
|
+
* connections (one per process) to a WAL-mode DB is exactly the supported
|
|
18
|
+
* cross-process pattern.
|
|
19
|
+
*/
|
|
20
|
+
const CREATE_TABLE_SQL = `
|
|
21
|
+
CREATE TABLE IF NOT EXISTS llm_spend (
|
|
22
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
23
|
+
ts INTEGER NOT NULL,
|
|
24
|
+
provider TEXT NOT NULL,
|
|
25
|
+
model TEXT NOT NULL,
|
|
26
|
+
cost_usd REAL NOT NULL,
|
|
27
|
+
cost_source TEXT NOT NULL,
|
|
28
|
+
prompt_tokens INTEGER NOT NULL DEFAULT 0,
|
|
29
|
+
completion_tokens INTEGER NOT NULL DEFAULT 0,
|
|
30
|
+
request_id TEXT
|
|
31
|
+
);
|
|
32
|
+
CREATE INDEX IF NOT EXISTS idx_llm_spend_ts ON llm_spend(ts);
|
|
33
|
+
`;
|
|
34
|
+
/**
|
|
35
|
+
* SQLite-backed ledger. Cross-process because every process opens its own
|
|
36
|
+
* connection to the same WAL-mode `memory.db`.
|
|
37
|
+
*/
|
|
38
|
+
export class SqliteSpendLedger {
|
|
39
|
+
db;
|
|
40
|
+
constructor(db) {
|
|
41
|
+
this.db = db;
|
|
42
|
+
// Additive schema only — CREATE TABLE/INDEX IF NOT EXISTS never drops data.
|
|
43
|
+
this.db.exec(CREATE_TABLE_SQL);
|
|
44
|
+
}
|
|
45
|
+
record(entry) {
|
|
46
|
+
try {
|
|
47
|
+
this.db
|
|
48
|
+
.prepare(`INSERT INTO llm_spend
|
|
49
|
+
(ts, provider, model, cost_usd, cost_source, prompt_tokens, completion_tokens, request_id)
|
|
50
|
+
VALUES (@ts, @provider, @model, @cost_usd, @cost_source, @prompt_tokens, @completion_tokens, @request_id)`)
|
|
51
|
+
.run({
|
|
52
|
+
ts: Date.now(),
|
|
53
|
+
provider: entry.provider,
|
|
54
|
+
model: entry.model,
|
|
55
|
+
cost_usd: entry.costUsd,
|
|
56
|
+
cost_source: entry.costSource,
|
|
57
|
+
prompt_tokens: entry.promptTokens,
|
|
58
|
+
completion_tokens: entry.completionTokens,
|
|
59
|
+
request_id: entry.requestId,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// A ledger write must never break a generation call.
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
spentSince(windowMs, nowMs = Date.now()) {
|
|
67
|
+
try {
|
|
68
|
+
const row = this.db
|
|
69
|
+
.prepare(`SELECT COALESCE(SUM(cost_usd), 0) AS total FROM llm_spend WHERE ts >= ?`)
|
|
70
|
+
.get(nowMs - windowMs);
|
|
71
|
+
return row?.total ?? 0;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* In-process fallback ledger. Used when no unified DB is available. Enforces
|
|
80
|
+
* within the current process only — no worse than the pre-ADR-123 behavior.
|
|
81
|
+
*/
|
|
82
|
+
export class InMemorySpendLedger {
|
|
83
|
+
entries = [];
|
|
84
|
+
record(entry) {
|
|
85
|
+
this.entries.push({ ts: Date.now(), costUsd: entry.costUsd });
|
|
86
|
+
}
|
|
87
|
+
spentSince(windowMs, nowMs = Date.now()) {
|
|
88
|
+
const cutoff = nowMs - windowMs;
|
|
89
|
+
let total = 0;
|
|
90
|
+
for (const e of this.entries) {
|
|
91
|
+
if (e.ts >= cutoff)
|
|
92
|
+
total += e.costUsd;
|
|
93
|
+
}
|
|
94
|
+
return total;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Build the default ledger. Prefers the unified `memory.db` (cross-process);
|
|
99
|
+
* falls back to an in-memory ledger if the kernel DB can't be reached. Uses a
|
|
100
|
+
* dynamic import so the LLM layer stays statically decoupled from the kernel.
|
|
101
|
+
*/
|
|
102
|
+
export async function createDefaultSpendLedger() {
|
|
103
|
+
try {
|
|
104
|
+
const mod = await import('../../kernel/unified-memory.js');
|
|
105
|
+
const mem = mod.getUnifiedMemory();
|
|
106
|
+
if (!mem.isInitialized()) {
|
|
107
|
+
await mem.initialize();
|
|
108
|
+
}
|
|
109
|
+
return new SqliteSpendLedger(mem.getDatabase());
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return new InMemorySpendLedger();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=spend-ledger.js.map
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
const SYSTEM_PROMPT_STRATEGIES = {
|
|
17
17
|
claude: 'native', // Anthropic supports separate system param
|
|
18
|
+
'claude-code': 'native', // ADR-123: passed via --append-system-prompt
|
|
18
19
|
openai: 'native', // OpenAI supports system role messages
|
|
19
20
|
ollama: 'native', // Ollama supports system role
|
|
20
21
|
openrouter: 'native', // OpenRouter passes through to underlying provider
|
|
21
22
|
gemini: 'native', // Gemini supports systemInstruction
|
|
22
23
|
'azure-openai': 'native', // Azure OpenAI same as OpenAI
|
|
23
24
|
bedrock: 'native', // Bedrock supports system for Claude
|
|
25
|
+
cognitum: 'native', // ADR-123: OpenAI-compatible system role
|
|
24
26
|
onnx: 'first-message', // ONNX models typically don't have system prompt support
|
|
25
27
|
};
|
|
26
28
|
/**
|
|
@@ -37,10 +37,12 @@ export function detectMessageFormat(messages) {
|
|
|
37
37
|
export function getTargetFormat(provider) {
|
|
38
38
|
switch (provider) {
|
|
39
39
|
case 'claude':
|
|
40
|
+
case 'claude-code': // ADR-123: Anthropic-native (runs via `claude -p`)
|
|
40
41
|
case 'bedrock':
|
|
41
42
|
return 'anthropic';
|
|
42
43
|
case 'openai':
|
|
43
44
|
case 'azure-openai':
|
|
45
|
+
case 'cognitum': // ADR-123: OpenAI-compatible gateway
|
|
44
46
|
return 'openai';
|
|
45
47
|
case 'gemini':
|
|
46
48
|
return 'gemini';
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
export function getToolSchemaFormat(provider) {
|
|
17
17
|
switch (provider) {
|
|
18
18
|
case 'claude':
|
|
19
|
+
case 'claude-code': // ADR-123: Anthropic-native
|
|
19
20
|
case 'bedrock':
|
|
20
21
|
return 'anthropic';
|
|
21
22
|
case 'openai':
|
|
@@ -23,6 +24,7 @@ export function getToolSchemaFormat(provider) {
|
|
|
23
24
|
case 'openrouter':
|
|
24
25
|
case 'ollama':
|
|
25
26
|
case 'onnx':
|
|
27
|
+
case 'cognitum': // ADR-123: OpenAI-compatible
|
|
26
28
|
return 'openai';
|
|
27
29
|
case 'gemini':
|
|
28
30
|
return 'gemini';
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
export { SwarmSkillValidator, createSwarmSkillValidator, DEFAULT_SWARM_VALIDATION_CONFIG, P0_SKILLS, DEFAULT_VALIDATION_MODELS, } from './swarm-skill-validator.js';
|
|
14
14
|
export type { SwarmValidationConfig, SwarmTopology, SwarmValidationResult, SwarmValidationSummary, SkillValidatorFn, } from './swarm-skill-validator.js';
|
|
15
15
|
export { ParallelEvalRunner, createParallelEvalRunner, DEFAULT_PARALLEL_EVAL_CONFIG, MockLLMExecutor, } from './parallel-eval-runner.js';
|
|
16
|
+
export { ProviderLLMExecutor, resolveEvalExecutor, type EvalExecutorResolution, } from './provider-llm-executor.js';
|
|
16
17
|
export type { ParallelEvalConfig, EvalTestCase, EvalTestCaseInput, EvalTestCaseExpectedOutput, EvalTestCaseValidation, EvalSuite, TestCaseTask, ParallelEvalResult, WorkerMessage, WorkerProgress, EvalProgress, LLMExecutor, } from './parallel-eval-runner.js';
|
|
17
18
|
export { CommandEvalRunner, createCommandEvalRunner, evalJsonPath, severityAtLeast, isCommandEvalSuite, validateCommandResult, } from './command-eval-runner.js';
|
|
18
19
|
export type { CommandEvalSuite, CommandEvalTestCase, CommandEvalExpected, CommandEvalResult, CommandEvalTestResult, CommandEvalRunnerOptions, CommandRunner, Severity, TestCasePriority, } from './command-eval-runner.js';
|
package/dist/validation/index.js
CHANGED
|
@@ -24,6 +24,8 @@ P0_SKILLS, DEFAULT_VALIDATION_MODELS, } from './swarm-skill-validator.js';
|
|
|
24
24
|
// Parallel Eval Runner (ADR-056 Phase 5)
|
|
25
25
|
// ============================================================================
|
|
26
26
|
export { ParallelEvalRunner, createParallelEvalRunner, DEFAULT_PARALLEL_EVAL_CONFIG, MockLLMExecutor, } from './parallel-eval-runner.js';
|
|
27
|
+
// Issue #557 follow-up: real (non-mock) eval executor.
|
|
28
|
+
export { ProviderLLMExecutor, resolveEvalExecutor, } from './provider-llm-executor.js';
|
|
27
29
|
// ============================================================================
|
|
28
30
|
// Command Eval Runner (ADR-091: qe-browser and other shell-based skills)
|
|
29
31
|
// ============================================================================
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 — Real LLM executor for the eval runner (issue #557 follow-up).
|
|
3
|
+
*
|
|
4
|
+
* `aqe eval run` historically defaulted to MockLLMExecutor (canned, keyword-
|
|
5
|
+
* matched responses), so LLM-mode eval suites scored fabricated output. This
|
|
6
|
+
* executor makes REAL model calls through the shared LLM layer, so eval
|
|
7
|
+
* inherits the ADR-123 guardrails automatically: enforced budget caps, the
|
|
8
|
+
* `AQE_LLM_PROVIDER` selector (including the claude-code subscription), the
|
|
9
|
+
* billing notice, and the cross-process spend ledger.
|
|
10
|
+
*/
|
|
11
|
+
import type { LLMExecutor } from './parallel-eval-runner';
|
|
12
|
+
import { ProviderManager } from '../shared/llm/provider-manager';
|
|
13
|
+
import type { LLMProviderType } from '../shared/llm/interfaces';
|
|
14
|
+
/** Real executor: delegates to ProviderManager.generate (budget-gated). */
|
|
15
|
+
export declare class ProviderLLMExecutor implements LLMExecutor {
|
|
16
|
+
private readonly manager;
|
|
17
|
+
readonly providerType: LLMProviderType;
|
|
18
|
+
constructor(manager: ProviderManager, providerType: LLMProviderType);
|
|
19
|
+
execute(prompt: string, model: string, options?: {
|
|
20
|
+
timeout?: number;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
output: string;
|
|
23
|
+
tokensUsed: number;
|
|
24
|
+
durationMs: number;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
export interface EvalExecutorResolution {
|
|
28
|
+
/** The real executor, or undefined when no provider is configured. */
|
|
29
|
+
executor?: ProviderLLMExecutor;
|
|
30
|
+
/** The provider chosen (for display), when resolved. */
|
|
31
|
+
providerType?: LLMProviderType;
|
|
32
|
+
/** Billing mode of the chosen provider (for the pre-run notice). */
|
|
33
|
+
billingMode?: string;
|
|
34
|
+
/** Manager to dispose when done (caller owns lifecycle). */
|
|
35
|
+
manager?: ProviderManager;
|
|
36
|
+
/** Why no executor could be built (for a clear CLI error). */
|
|
37
|
+
reason?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a real eval executor from the current environment/config. Honors
|
|
41
|
+
* `AQE_LLM_PROVIDER`. Returns `{ reason }` (no executor) when nothing is
|
|
42
|
+
* configured, so the CLI can hard-error instead of silently mocking.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveEvalExecutor(env?: NodeJS.ProcessEnv): Promise<EvalExecutorResolution>;
|
|
45
|
+
//# sourceMappingURL=provider-llm-executor.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 — Real LLM executor for the eval runner (issue #557 follow-up).
|
|
3
|
+
*
|
|
4
|
+
* `aqe eval run` historically defaulted to MockLLMExecutor (canned, keyword-
|
|
5
|
+
* matched responses), so LLM-mode eval suites scored fabricated output. This
|
|
6
|
+
* executor makes REAL model calls through the shared LLM layer, so eval
|
|
7
|
+
* inherits the ADR-123 guardrails automatically: enforced budget caps, the
|
|
8
|
+
* `AQE_LLM_PROVIDER` selector (including the claude-code subscription), the
|
|
9
|
+
* billing notice, and the cross-process spend ledger.
|
|
10
|
+
*/
|
|
11
|
+
import { ProviderManager } from '../shared/llm/provider-manager';
|
|
12
|
+
import { billingModeForType } from '../shared/llm/billing-modes';
|
|
13
|
+
import { loadRouterConfig, detectAvailableProvidersFromEnv, } from '../shared/llm/router/config-store';
|
|
14
|
+
import { ClaudeCodeProvider } from '../shared/llm/providers/claude-code';
|
|
15
|
+
import { OllamaProvider } from '../shared/llm/providers/ollama';
|
|
16
|
+
/** Real executor: delegates to ProviderManager.generate (budget-gated). */
|
|
17
|
+
export class ProviderLLMExecutor {
|
|
18
|
+
manager;
|
|
19
|
+
providerType;
|
|
20
|
+
constructor(manager, providerType) {
|
|
21
|
+
this.manager = manager;
|
|
22
|
+
this.providerType = providerType;
|
|
23
|
+
}
|
|
24
|
+
async execute(prompt, model, options) {
|
|
25
|
+
const response = await this.manager.generate(prompt, {
|
|
26
|
+
model,
|
|
27
|
+
timeoutMs: options?.timeout,
|
|
28
|
+
preferredProvider: this.providerType,
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
output: response.content,
|
|
32
|
+
tokensUsed: response.usage.totalTokens,
|
|
33
|
+
durationMs: response.latencyMs,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Non-billing readiness check: is this provider usable WITHOUT making a paid
|
|
39
|
+
* probe call? API providers need a key in env; claude-code needs the CLI on
|
|
40
|
+
* PATH; local providers (ollama) are treated as available when selected.
|
|
41
|
+
*/
|
|
42
|
+
async function isConfiguredCheaply(type, env) {
|
|
43
|
+
if (type === 'claude-code') {
|
|
44
|
+
// Free, local: just runs `claude --version`.
|
|
45
|
+
return new ClaudeCodeProvider().isAvailable();
|
|
46
|
+
}
|
|
47
|
+
if (type === 'ollama') {
|
|
48
|
+
// Local + free probe: only "configured" if the server actually answers,
|
|
49
|
+
// so a machine with no Ollama running falls through to the hard error
|
|
50
|
+
// (issue #557 choice: never silently pick a dead provider).
|
|
51
|
+
return new OllamaProvider().isAvailable();
|
|
52
|
+
}
|
|
53
|
+
// API providers: key presence only — never a billing probe.
|
|
54
|
+
return detectAvailableProvidersFromEnv(env).has(type);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolve a real eval executor from the current environment/config. Honors
|
|
58
|
+
* `AQE_LLM_PROVIDER`. Returns `{ reason }` (no executor) when nothing is
|
|
59
|
+
* configured, so the CLI can hard-error instead of silently mocking.
|
|
60
|
+
*/
|
|
61
|
+
export async function resolveEvalExecutor(env = process.env) {
|
|
62
|
+
const config = loadRouterConfig({ env });
|
|
63
|
+
// Candidate order: the resolved default provider first, then any other
|
|
64
|
+
// enabled provider, so an AQE_LLM_PROVIDER override wins.
|
|
65
|
+
const enabled = Object.entries(config.providers ?? {})
|
|
66
|
+
.filter(([, cfg]) => cfg?.enabled)
|
|
67
|
+
.map(([type]) => type);
|
|
68
|
+
const candidates = [
|
|
69
|
+
config.defaultProvider,
|
|
70
|
+
...enabled.filter((t) => t !== config.defaultProvider),
|
|
71
|
+
];
|
|
72
|
+
for (const type of candidates) {
|
|
73
|
+
if (await isConfiguredCheaply(type, env)) {
|
|
74
|
+
const pmConfig = {
|
|
75
|
+
primary: type,
|
|
76
|
+
fallbacks: [],
|
|
77
|
+
loadBalancing: 'round-robin',
|
|
78
|
+
providers: { [type]: config.providers?.[type] },
|
|
79
|
+
global: { enableCostTracking: true },
|
|
80
|
+
};
|
|
81
|
+
const manager = new ProviderManager(pmConfig);
|
|
82
|
+
await manager.initialize();
|
|
83
|
+
return {
|
|
84
|
+
executor: new ProviderLLMExecutor(manager, type),
|
|
85
|
+
providerType: type,
|
|
86
|
+
billingMode: billingModeForType(type),
|
|
87
|
+
manager,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
reason: 'No LLM provider is configured for real eval runs. Set a provider key ' +
|
|
93
|
+
'(e.g. ANTHROPIC_API_KEY, OPENAI_API_KEY, COGNITUM_API_KEY), or run on your ' +
|
|
94
|
+
'Claude subscription with AQE_LLM_PROVIDER=claude-code, or pass --mock to use ' +
|
|
95
|
+
'canned responses (offline testing only — results are not real).',
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=provider-llm-executor.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-qe",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.3",
|
|
4
4
|
"description": "Agentic Quality Engineering V3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 60 specialized QE agents, mathematical Coherence verification, deep Claude Flow integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"test:all": "npm test -- --run",
|
|
79
79
|
"test:mcp": "npm run test:unit:mcp",
|
|
80
80
|
"test:mcp:integration": "npm test -- --run tests/integration/mcp/",
|
|
81
|
-
"test:integration:fast": "NODE_OPTIONS='--max-old-space-size=2048 --expose-gc' vitest run tests/integration/mcp/fleet-init-wires-daemon.test.ts tests/integration/mcp/mcp-cli-inprocess.test.ts tests/integration/mcp/memory-delete-cache-invalidation.test.ts tests/integration/workers/workers-reach-domains.test.ts tests/integration/learning/coordinator-roundtrip.test.ts tests/integration/bridge/bridge-end-to-end.test.ts",
|
|
81
|
+
"test:integration:fast": "NODE_OPTIONS='--max-old-space-size=2048 --expose-gc' vitest run tests/integration/mcp/fleet-init-wires-daemon.test.ts tests/integration/mcp/mcp-cli-inprocess.test.ts tests/integration/mcp/memory-delete-cache-invalidation.test.ts tests/integration/workers/workers-reach-domains.test.ts tests/integration/learning/coordinator-roundtrip.test.ts tests/integration/bridge/bridge-end-to-end.test.ts tests/integration/rvf-corruption-recovery.integration.test.ts",
|
|
82
82
|
"test:integration": "NODE_OPTIONS='--max-old-space-size=4096 --expose-gc' vitest run tests/integration/ --exclude='**/browser/**' --exclude='**/browser-integration/**' --exclude='**/*.e2e.test.ts'",
|
|
83
83
|
"mcp:validate": "node scripts/smoke-mcp-protocol.mjs",
|
|
84
84
|
"mcp:parity": "node scripts/audit-mcp-tool-parity.mjs",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.1");process.exit(0)}
|
|
2
|
-
import{a,b,c}from"./chunk-QOAI6ETC.js";import"./chunk-C7HGYLNF.js";import"./chunk-RJ7TU2MP.js";import"./chunk-O65OPAZH.js";import"./chunk-UBPJQKYS.js";import"./chunk-U5ITD7ZD.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.1");process.exit(0)}
|
|
2
|
-
import{a,b,c,d,e,f}from"./chunk-OJORNYN3.js";import"./chunk-QJXUK54J.js";import"./chunk-PZZDAECU.js";import"./chunk-YGB3MT3R.js";import"./chunk-BPM7NEHS.js";import"./chunk-RIASOMB2.js";import"./chunk-42PYEEYQ.js";import"./chunk-3W2FZXFD.js";import"./chunk-JDZIBSMY.js";import"./chunk-CJTXZI37.js";import"./chunk-CYYT6YEV.js";import"./chunk-OXVAGR64.js";import"./chunk-QORWBION.js";import"./chunk-XS6BIOPQ.js";import"./chunk-EOBZJDJR.js";import"./chunk-XDRAU3W6.js";import"./chunk-PQ4NSXZM.js";import"./chunk-FNMEVLSN.js";import"./chunk-NOCPO55P.js";import"./chunk-IE6FDICX.js";import"./chunk-O65OPAZH.js";import"./chunk-M5P5WNXA.js";import"./chunk-NHRBKOYD.js";import"./chunk-QXZOUETY.js";import"./chunk-BLU7OLQZ.js";import"./chunk-4LKQZW2H.js";import"./chunk-UBPJQKYS.js";import"./chunk-75AVUS5U.js";import"./chunk-TMPRR3FZ.js";import"./chunk-R4A6PY5D.js";import"./chunk-JRNDFC23.js";import"./chunk-6BCVKCG5.js";import"./chunk-UR655D4K.js";import"./chunk-PZ3Q34OT.js";import"./chunk-CXUHD2O5.js";import"./chunk-IC6SOVGO.js";import"./chunk-USTUWUCE.js";import"./chunk-U5ITD7ZD.js";export{b as AQELearningEngine,a as DEFAULT_ENGINE_CONFIG,c as DEFAULT_META_LEARNING_CONFIG,d as MetaLearningEngine,e as createAQELearningEngine,f as createDefaultLearningEngine};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.1");process.exit(0)}
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-BALFQQB7.js";import"./chunk-LRWBOJ5Y.js";import"./chunk-XDRAU3W6.js";import"./chunk-PQ4NSXZM.js";import"./chunk-FNMEVLSN.js";import"./chunk-NOCPO55P.js";import"./chunk-IE6FDICX.js";import"./chunk-O65OPAZH.js";import"./chunk-BLU7OLQZ.js";import"./chunk-UBPJQKYS.js";import"./chunk-75AVUS5U.js";import"./chunk-4U5MJX2H.js";import"./chunk-TMPRR3FZ.js";import"./chunk-R4A6PY5D.js";import"./chunk-JRNDFC23.js";import"./chunk-6BCVKCG5.js";import"./chunk-UR655D4K.js";import"./chunk-PZ3Q34OT.js";import"./chunk-CXUHD2O5.js";import"./chunk-IC6SOVGO.js";import"./chunk-USTUWUCE.js";import"./chunk-U5ITD7ZD.js";export{l as MCPToolBase,k as defaultToolLogger,j as getKernel,i as getLLMRouter,e as getMemoryBackend,g as getSharedLLMRouter,c as getSharedMemoryBackend,a as isMemoryOnlyMode,b as registerRvfResetFn,h as resetSharedLLMRouter,d as resetSharedMemoryBackend,f as setSharedLLMRouter};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.1");process.exit(0)}
|
|
2
|
-
import{a as A,b as L,c as F,d as R,e as Y,f as T,g as P,h as C,i as j,j as X,k as V,l as ye,m as $,n as Z,o as be,p as _,q as J,r as U,s as W}from"./chunk-NTMN2ZJY.js";import{h as ge}from"./chunk-CYYT6YEV.js";import{b as pe}from"./chunk-OXVAGR64.js";import"./chunk-XDRAU3W6.js";import"./chunk-PQ4NSXZM.js";import"./chunk-FNMEVLSN.js";import"./chunk-NOCPO55P.js";import"./chunk-IE6FDICX.js";import{b as x,d as Q}from"./chunk-O65OPAZH.js";import{a as fe,b as me,c as ue,d as k,f as ze}from"./chunk-NHRBKOYD.js";import"./chunk-BLU7OLQZ.js";import"./chunk-UBPJQKYS.js";import{a as O,b as We}from"./chunk-TMPRR3FZ.js";import"./chunk-R4A6PY5D.js";import"./chunk-JRNDFC23.js";import"./chunk-6BCVKCG5.js";import"./chunk-UR655D4K.js";import"./chunk-PZ3Q34OT.js";import"./chunk-CXUHD2O5.js";import"./chunk-IC6SOVGO.js";import"./chunk-USTUWUCE.js";import"./chunk-U5ITD7ZD.js";import B from"path";import o from"chalk";We();Q();import{existsSync as z,mkdirSync as He,writeFileSync as Ke,readFileSync as ee}from"fs";import{join as E,resolve as ne}from"path";var Ge={rl_q_values:"includeQValues",dream_insights:"includeDreamInsights",dream_cycles:"includeDreamInsights",witness_chain:"includeWitnessChain",vectors:"includeVectors"};function Qe(e,n){let r=Ge[e.tableName];return!(r&&n[r]===!1)}var Ye=1e4;function Xe(e,n,r,t){if(!Qe(n,r))return Z(E(t,n.fileName),[]),{count:0,rows:[]};let[a,s]=n.domainColumn?$(r.domains,n.domainColumn):[void 0,[]];if(X(e,n.tableName,a,s)>=Ye){let d=n.blobColumns,c=d&&d.length>0?p=>T(p,d):void 0;return{count:be(E(t,n.fileName),ye(e,n.tableName,a,s),c)}}let i=V(e,n.tableName,a,s);return n.blobColumns&&n.blobColumns.length>0&&(i=i.map(d=>T(d,n.blobColumns))),Z(E(t,n.fileName),i),{count:i.length,rows:i}}function he(e){let n=[];for(let r of R){let t=E(e,r.fileName);z(t)?n.push(C(ee(t,"utf-8"))):n.push(C(""))}return C(n.join(":"))}function we(e,n,r="memory.db"){let t=ne(n.outputPath);z(t)||He(t,{recursive:!0});let a=0,s={},l=new Set;for(let u of R){let p=Xe(e,u,n,t);if(s[u.tableName]=p.count,a+=p.count,u.tableName==="qe_patterns"){if(p.rows)for(let f of p.rows)f.qe_domain&&l.add(f.qe_domain);else if(p.count>0){let[f,w]=u.domainColumn?$(n.domains,u.domainColumn):[void 0,[]],y=`SELECT DISTINCT qe_domain FROM qe_patterns ${f?`WHERE ${f} AND qe_domain IS NOT NULL`:"WHERE qe_domain IS NOT NULL"}`;try{let g=e.prepare(y).all(...w||[]);for(let v of g)l.add(v.qe_domain)}catch{}}}}let i=n.includeVectors!==!1?X(e,"vectors"):0,d=he(t),c={version:"3.0",exportedAt:new Date().toISOString(),sourceDb:r,stats:{patternCount:s.qe_patterns||0,vectorCount:i,qValueCount:s.rl_q_values||0,dreamInsightCount:s.dream_insights||0,witnessChainLength:s.witness_chain||0,totalRecords:a},domains:[...l].sort(),checksum:d,tableRecordCounts:s};return Ke(E(t,"manifest.json"),JSON.stringify(c,null,2),"utf-8"),c}var Ze=new Set(["qe_patterns","rl_q_values","dream_insights","witness_chain"]);function en(e){return e==="1.0"?R.filter(n=>Ze.has(n.tableName)):e==="3.0"?R:(console.warn(`[brain-import] Unknown manifest version '${e}'. Attempting full import \u2014 some files may be missing.`),R)}function ve(e,n,r){let t=ne(n),a=E(t,"manifest.json");if(!z(a))throw new Error(`Manifest not found at ${a}`);let s=x(ee(a,"utf-8")),l=he(t);if(l!==s.checksum)throw new Error(`Checksum mismatch: expected ${s.checksum}, got ${l}. The export may have been tampered with or corrupted.`);let i=en(s.version);if(r.dryRun){let f=0;for(let w of i){let m=_(E(t,w.fileName),x);f+=m.length}return{imported:f,skipped:0,conflicts:0}}W(e);let d=0,c=0,u=0;return e.transaction(()=>{for(let f of i){let w=E(t,f.fileName),m=_(w,x);f.blobColumns&&f.blobColumns.length>0&&(m=m.map(y=>P(y,f.blobColumns)));for(let y of m){let g;if(f.dedupColumns&&f.dedupColumns.length>0)g=U(e,f.tableName,y,f.dedupColumns);else{let v=A[f.tableName]||"id",b=F[f.tableName],I=L[f.tableName];g=J(e,f.tableName,y,v,r.mergeStrategy,b,I)}d+=g.imported,c+=g.skipped,u+=g.conflicts}}})(),{imported:d,skipped:c,conflicts:u}}function Re(e){let n=ne(e),r=E(n,"manifest.json");if(!z(r))throw new Error(`Manifest not found at ${r}`);return x(ee(r,"utf-8"))}ze();import{existsSync as H,statSync as nn,unlinkSync as Se,writeFileSync as tn}from"fs";import{resolve as te}from"path";function xe(e,n,r="memory.db"){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use --format jsonl instead.");let t=te(n.outputPath),a=n.dimension??384;H(t)&&Se(t);let s=`${t}.idmap.json`;H(s)&&Se(s);let l=fe(t,a);try{let i={},d=new Set,c=0;for(let S of R){let[h,ce]=S.domainColumn?$(n.domains,S.domainColumn):[void 0,[]],D=V(e,S.tableName,h,ce);if(S.tableName==="qe_patterns")for(let q of D)q.qe_domain&&d.add(q.qe_domain);let G=Y[S.tableName];G&&G.length>0&&(D=D.map(q=>T(q,G))),i[S.tableName]=D,c+=D.length}let u=0,p=[];if(j(e,"qe_pattern_embeddings")){let S=e.prepare("SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings").all();for(let h of S)h.embedding&&h.dimension===a&&p.push({id:`pe:${h.pattern_id}`,vector:new Float32Array(h.embedding.buffer,h.embedding.byteOffset,a),metadata:{tableName:"qe_pattern_embeddings"}})}if(j(e,"captured_experiences")){let S=e.prepare("SELECT id, embedding, embedding_dimension, domain, quality FROM captured_experiences WHERE embedding IS NOT NULL").all();for(let h of S)h.embedding_dimension===a&&p.push({id:`exp:${h.id}`,vector:new Float32Array(h.embedding.buffer,h.embedding.byteOffset,a),metadata:{tableName:"captured_experiences",domain:h.domain,confidence:h.quality}})}if(j(e,"sona_patterns")){let S=e.prepare("SELECT id, state_embedding, domain, confidence FROM sona_patterns WHERE state_embedding IS NOT NULL").all();for(let h of S)h.state_embedding.byteLength/4===a&&p.push({id:`sona:${h.id}`,vector:new Float32Array(h.state_embedding.buffer,h.state_embedding.byteOffset,a),metadata:{tableName:"sona_patterns",domain:h.domain,confidence:h.confidence}})}p.length>0&&(u=l.ingest(p).accepted);let f={version:"3.0",format:"rvf",exportedAt:new Date().toISOString(),sourceDb:r,domains:[...d].sort(),tables:i},w=JSON.stringify(f),m=C(w),y=Buffer.from(w);l.embedKernel(y);let g=n.sign?l.sign(y)??void 0:void 0,v=g?n.signerKeyId??"default":void 0,b=l.fileId(),I=b?{fileId:b,parentId:l.parentId(),lineageDepth:l.lineageDepth()}:void 0,N=l.status(),M={version:"3.0",format:"rvf",exportedAt:f.exportedAt,sourceDb:r,stats:{patternCount:(i.qe_patterns||[]).length,embeddingCount:u,qValueCount:(i.rl_q_values||[]).length,dreamInsightCount:(i.dream_insights||[]).length,witnessChainLength:(i.witness_chain||[]).length,totalRecords:c},domains:f.domains,checksum:m,rvfStatus:{totalVectors:N.totalVectors,totalSegments:N.totalSegments,fileSizeBytes:N.fileSizeBytes},...g?{signature:g,signerKeyId:v}:{},...I?{lineage:I}:{}};if(g)try{l.freeze()}catch{}let Ue=`${t}.manifest.json`;return tn(Ue,JSON.stringify(M,null,2),"utf-8"),M}finally{l.close()}}var rn={patterns:"qe_patterns",qValues:"rl_q_values",dreamInsights:"dream_insights",witnessChain:"witness_chain"};function Ce(e,n,r){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use JSONL format.");let t=te(n);if(!H(t))throw new Error(`RVF file not found: ${t}`);let a=me(t);try{let s=a.verifyWitness();if(!s.valid&&(s.totalEntries>0||s.errors.length>0)){let m=s.errors.length>0?s.errors.join("; "):"unknown integrity error";throw new Error(`RVF witness verification failed: ${m}`)}let l=a.extractKernel();if(!l||!l.image)throw new Error("No brain data found in RVF file (missing kernel segment)");let i;try{i=JSON.parse(l.image.toString("utf-8"))}catch(m){throw new Error(`Failed to parse brain kernel data as JSON: ${m instanceof Error?m.message:m}`)}if(r.dryRun){let m=0;if(i.tables)for(let y of Object.values(i.tables))m+=y?.length??0;else m=(i.patterns?.length??0)+(i.qValues?.length??0)+(i.dreamInsights?.length??0)+(i.witnessChain?.length??0);return{imported:m,skipped:0,conflicts:0,embeddingsRestored:0}}W(e);let d=0,c=0,u=0,p=0,f={};if(i.tables)Object.assign(f,i.tables);else for(let[m,y]of Object.entries(rn)){let g=i[m];Array.isArray(g)&&(f[y]=g)}if(e.transaction(()=>{for(let m of R){let y=f[m.tableName];if(!y||!Array.isArray(y))continue;let g=Y[m.tableName];if(g&&g.length>0){y=y.map(v=>P(v,g));for(let v of y)for(let b of g)v[b]instanceof Buffer&&p++}for(let v of y){let b;if(m.dedupColumns&&m.dedupColumns.length>0)b=U(e,m.tableName,v,m.dedupColumns);else{let I=A[m.tableName]||"id",N=F[m.tableName],M=L[m.tableName];b=J(e,m.tableName,v,I,r.mergeStrategy,N,M)}d+=b.imported,c+=b.skipped,u+=b.conflicts}}})(),u>0)try{a.compact()}catch{}return{imported:d,skipped:c,conflicts:u,embeddingsRestored:p}}finally{a.close()}}function K(e){if(!k())throw new Error("@ruvector/rvf-node is not available.");let n=te(e);if(!H(n))throw new Error(`RVF file not found: ${n}`);let r=ue(n);try{let t=r.extractKernel();if(!t||!t.image)throw new Error("No brain data found in RVF file");let a=t.image.toString("utf-8"),s;try{s=JSON.parse(a)}catch(w){throw new Error(`Failed to parse brain kernel data as JSON: ${w instanceof Error?w.message:w}`)}let l=r.status(),i=nn(n).size,d=s.tables,c=d?d.qe_patterns?.length??0:s.patterns?.length??0,u=d?d.rl_q_values?.length??0:s.qValues?.length??0,p=d?d.dream_insights?.length??0:s.dreamInsights?.length??0,f=d?d.witness_chain?.length??0:s.witnessChain?.length??0;return{version:"3.0",format:"rvf",exportedAt:s.exportedAt??"unknown",sourceDb:s.sourceDb??"unknown",stats:{patternCount:c,embeddingCount:l.totalVectors,qValueCount:u,dreamInsightCount:p,witnessChainLength:f},domains:s.domains??[],checksum:C(a),rvfStatus:{totalVectors:l.totalVectors,totalSegments:l.totalSegments,fileSizeBytes:i}}}finally{r.close()}}function re(){return k()}Q();import{existsSync as ae,readFileSync as on,statSync as an}from"fs";import{join as oe,resolve as Ee}from"path";function Oe(e,n,r={}){let t=Ee(e),a=Ee(n),s=Be(t),l=Be(a),i=_e(t,s),d=_e(a,l),c=s==="jsonl"&&l==="jsonl",u=dn({pathA:t,pathB:a,manifestA:i,manifestB:d,recordLevel:c,tableFilter:r.tableFilter,maxIdsPerBucket:r.maxIdsPerBucket??500}),p=new Set(i.domains),f=new Set(d.domains),w=i.domains.filter(b=>!f.has(b)),m=d.domains.filter(b=>!p.has(b)),y=i.checksum===d.checksum,g=i.version===d.version,v=y&&g&&u.every(b=>b.delta===0&&(b.added?.length??0)===0&&(b.removed?.length??0)===0&&(b.changed?.length??0)===0);return{pathA:t,pathB:a,formatA:s,formatB:l,manifestA:i,manifestB:d,checksumMatch:y,versionMatch:g,identical:v,recordLevel:c,tableDiffs:u,domainsOnlyInA:w,domainsOnlyInB:m}}function Be(e){if(!ae(e))throw new Error(`Path not found: ${e}`);if(e.endsWith(".rvf"))return"rvf";if(an(e).isFile())throw new Error(`Unsupported brain export: ${e} (expected a .rvf file or a JSONL directory)`);return"jsonl"}function _e(e,n){return n==="rvf"?ln(e):sn(e)}function sn(e){let n=oe(e,"manifest.json");if(!ae(n))throw new Error(`Manifest not found at ${n}`);let r=x(on(n,"utf-8"));return Ae(r,"jsonl")}function ln(e){let n=K(e);return Ae(n,"rvf")}function Ae(e,n){return{format:n,version:e.version??"unknown",exportedAt:e.exportedAt??"unknown",sourceDb:e.sourceDb??"unknown",checksum:e.checksum??"",totalRecords:e.stats?.totalRecords??0,domains:e.domains??[],tableRecordCounts:e.tableRecordCounts??{}}}function dn(e){let n=e.tableFilter?R.filter(t=>t.tableName===e.tableFilter):R;if(e.tableFilter&&n.length===0)throw new Error(`Unknown table: ${e.tableFilter}`);let r=[];for(let t of n){let a=e.manifestA.tableRecordCounts[t.tableName]??0,s=e.manifestB.tableRecordCounts[t.tableName]??0,l=s-a,i,d,c;if(e.recordLevel&&cn(t)){let u=fn(oe(e.pathA,t.fileName),oe(e.pathB,t.fileName),t,e.maxIdsPerBucket);i=u.added,d=u.removed,c=u.changed}r.push({tableName:t.tableName,countA:a,countB:s,delta:l,...i!==void 0?{added:i}:{},...d!==void 0?{removed:d}:{},...c!==void 0?{changed:c}:{}})}return r}function cn(e){return!0}function fn(e,n,r,t){let a=Ie(e,r),s=Ie(n,r),l=[],i=[],d=[];for(let[c,u]of a){let p=s.get(c);if(p===void 0)i.length<t&&i.push(c);else if(p!==u){if(r.dedupColumns&&r.dedupColumns.length>0)continue;d.length<t&&d.push(c)}}for(let c of s.keys())a.has(c)||l.length<t&&l.push(c);return l.sort(),i.sort(),d.sort(),{added:l,removed:i,changed:d}}function Ie(e,n){let r=new Map;if(!ae(e))return r;let t=_(e,x);for(let a of t){let s=mn(a,n);if(s===void 0)continue;let l=un(a);r.set(s,pn(l))}return r}function mn(e,n){if(n.dedupColumns&&n.dedupColumns.length>0){let a=[];for(let s of n.dedupColumns){let l=e[s];if(l==null)return;a.push(String(l))}return a.join("")}let r=A[n.tableName]??"id",t=e[r];if(t!=null)return String(t)}function un(e){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];return JSON.stringify(r)}function pn(e){return C(e)}Q();import{existsSync as ie,statSync as gn}from"fs";import{join as Ne,resolve as yn}from"path";var bn=20,hn="qe_patterns";function De(e,n={}){let r=yn(e);Rn(r);let t=n.table??hn,a=R.find(g=>g.tableName===t);if(!a)throw new Error(`Unknown table: ${t}`);let s=Ne(r,a.fileName);if(!ie(s))throw new Error(`Table file not found: ${a.fileName} (expected in ${r}). Was this export generated with --format jsonl?`);let l=_(s,x),i=a.domainColumn,d=Math.max(1,n.limit??bn),c=n.query?n.query.toLowerCase():void 0,u=n.domains&&n.domains.length>0?new Set(n.domains):void 0,p=n.since,f=n.until,w=n.patternType,m=0,y=[];for(let g of l)wn(g,{domainColumn:i,domains:u,patternType:w,since:p,until:f,queryLower:c})&&(m++,y.length<d&&y.push(vn(g,a.tableName,i)));return{table:t,inputPath:r,totalScanned:l.length,totalMatched:m,limit:d,hits:y,truncated:m>d}}function wn(e,n){if(n.domains){if(!n.domainColumn)return!1;let r=e[n.domainColumn];if(typeof r!="string"||!n.domains.has(r))return!1}if(n.patternType!==void 0&&e.pattern_type!==n.patternType)return!1;if(n.since!==void 0||n.until!==void 0){let r=ke(e);if(r===void 0||n.since!==void 0&&r<n.since||n.until!==void 0&&r>n.until)return!1}if(n.queryLower!==void 0){let r=typeof e.name=="string"?e.name.toLowerCase():"",t=typeof e.description=="string"?e.description.toLowerCase():"";if(!r.includes(n.queryLower)&&!t.includes(n.queryLower))return!1}return!0}function ke(e){for(let n of["updated_at","created_at","timestamp"]){let r=e[n];if(typeof r=="string"&&r.length>0)return r}}function vn(e,n,r){let t=(typeof e.id=="string"||typeof e.id=="number"?String(e.id):void 0)??`${n}:?`,a={name:typeof e.name=="string"?e.name:void 0,description:typeof e.description=="string"?e.description:void 0,domain:r&&typeof e[r]=="string"?e[r]:void 0,patternType:typeof e.pattern_type=="string"?e.pattern_type:void 0,confidence:typeof e.confidence=="number"?e.confidence:void 0,updatedAt:ke(e)};return{id:t,display:a,row:e}}function Rn(e){if(!ie(e))throw new Error(`Path not found: ${e}`);if(gn(e).isFile())throw e.endsWith(".rvf")?new Error("Brain search does not support RVF exports. Re-export with --format jsonl, or use `aqe brain info` for RVF summaries."):new Error(`Unsupported brain export: ${e} (expected a JSONL directory)`);let r=Ne(e,"manifest.json");if(!ie(r))throw new Error(`Manifest not found at ${r}. Is this a brain export directory?`)}function Te(e,n){if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_patterns'").get())return{created:0,skipped:0};e.exec(`
|
|
3
|
-
CREATE TEMP TABLE IF NOT EXISTS _covered_patterns (
|
|
4
|
-
pattern_id TEXT PRIMARY KEY
|
|
5
|
-
)
|
|
6
|
-
`),e.exec("DELETE FROM _covered_patterns"),e.exec(`
|
|
7
|
-
INSERT INTO _covered_patterns (pattern_id)
|
|
8
|
-
SELECT DISTINCT json_extract(action_data, '$.patternId')
|
|
9
|
-
FROM witness_chain
|
|
10
|
-
WHERE action_type = 'PATTERN_CREATE'
|
|
11
|
-
AND json_extract(action_data, '$.patternId') IS NOT NULL
|
|
12
|
-
`),e.exec(`
|
|
13
|
-
INSERT OR IGNORE INTO _covered_patterns (pattern_id)
|
|
14
|
-
SELECT DISTINCT json_extract(action_data, '$.pattern_id')
|
|
15
|
-
FROM witness_chain
|
|
16
|
-
WHERE action_type = 'PATTERN_CREATE'
|
|
17
|
-
AND json_extract(action_data, '$.pattern_id') IS NOT NULL
|
|
18
|
-
`);let t=e.prepare(`SELECT p.id, p.pattern_type, p.qe_domain, p.name, p.created_at
|
|
19
|
-
FROM qe_patterns p
|
|
20
|
-
LEFT JOIN _covered_patterns c ON p.id = c.pattern_id
|
|
21
|
-
WHERE c.pattern_id IS NULL
|
|
22
|
-
ORDER BY p.created_at ASC`).all(),s=e.prepare("SELECT COUNT(*) as count FROM qe_patterns").get().count-t.length,l=0;for(let i of t)n.append("PATTERN_CREATE",{patternId:i.id,patternType:i.pattern_type,qeDomain:i.qe_domain,name:i.name,originalCreatedAt:i.created_at,backfilled:!0},"system:backfill"),l++;return e.exec("DROP TABLE IF EXISTS _covered_patterns"),{created:l,skipped:s}}async function $e(e,n){if(Sn(n.format)==="rvf"){let a=O(e,{readonly:!0});try{return xe(a,{outputPath:n.outputPath,domains:n.domains},e)}finally{a.close()}}let t=O(e,{readonly:!0});try{return we(t,n,e)}finally{t.close()}}async function Me(e,n,r){if(je(n,r.format)==="rvf"){let s=O(e);try{return Ce(s,n,{mergeStrategy:r.mergeStrategy,dryRun:r.dryRun})}finally{s.close()}}let a=O(e);try{return ve(a,n,r)}finally{a.close()}}async function qe(e,n){return je(e,n)==="rvf"?K(e):Re(e)}async function Le(e,n,r={}){return Oe(e,n,r)}async function Fe(e,n={}){return De(e,n)}async function Pe(e){let n=O(e);try{let r=ge(n,pe());return await r.initialize(),Te(n,r)}finally{n.close()}}function Sn(e){if(e==="jsonl")return"jsonl";if(e==="rvf"){if(!re())throw new Error("RVF format requested but @ruvector/rvf-node is not available on this platform. Use --format jsonl instead.");return"rvf"}return re()?"rvf":"jsonl"}function je(e,n){return n==="rvf"?"rvf":n==="jsonl"?"jsonl":e.endsWith(".rvf")?"rvf":"jsonl"}var de=class{name="brain";description="Export, import, and inspect QE brain state";cleanupAndExit;ensureInitialized;constructor(n,r){this.cleanupAndExit=n,this.ensureInitialized=r}register(n,r){let t=n.command("brain").description(this.description);t.command("export").description("Export brain state to a portable directory").requiredOption("-o, --output <path>","Output directory path").option("--format <format>","Export format: rvf (default) or jsonl","rvf").option("--db <path>","Source database path").action(async a=>{await this.executeExport(a)}),t.command("import").description("Import brain state from an export directory").requiredOption("-i, --input <path>","Path to brain export directory").option("--strategy <strategy>","Merge strategy","skip-conflicts").option("--dry-run","Preview import without writing",!1).option("--db <path>","Target database path").action(async a=>{await this.executeImport(a)}),t.command("info").description("Show manifest info for a brain export").requiredOption("-i, --input <path>","Path to brain export directory").action(async a=>{await this.executeInfo(a)}),t.command("witness-backfill").description("Create witness chain entries for patterns that predate the witness chain").option("--db <path>","Database path").action(async a=>{await this.executeWitnessBackfill(a)}),t.command("diff").description("Compare two brain exports (JSONL directory or .rvf file)").argument("<a>","Path to first brain export").argument("<b>","Path to second brain export").option("--table <name>","Restrict comparison to a single table").option("--verbose","Show the IDs of added/removed/changed records",!1).option("--json","Emit the diff as JSON to stdout",!1).action(async(a,s,l)=>{await this.executeDiff(a,s,l)}),t.command("search").description("Search a JSONL brain export with filters").requiredOption("-i, --input <path>","Path to brain export directory (JSONL)").option("--table <name>","Table to search (default: qe_patterns)").option("--domain <name...>","Restrict to one or more domains").option("--pattern-type <type>","Restrict to a specific pattern_type (qe_patterns only)").option("--since <iso>","Include rows with timestamp \u2265 <iso>").option("--until <iso>","Include rows with timestamp \u2264 <iso>").option("-q, --query <text>","Substring match across name + description (case-insensitive)").option("-l, --limit <n>","Maximum results to return","20").option("--json","Emit results as JSON to stdout",!1).action(async a=>{await this.executeSearch(a)})}async executeExport(n){try{console.log(o.blue(`
|
|
23
|
-
Exporting brain state (format: ${n.format})...
|
|
24
|
-
`));let r=await se(n.db),t=await $e(r,{outputPath:B.resolve(n.output),format:n.format});if(console.log(o.green(" Export complete.")),console.log(` Format: ${o.cyan("format"in t?t.format??"jsonl":"jsonl")}`),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"embeddingCount"in t.stats?console.log(` Vectors: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`),"rvfStatus"in t){let a=t.rvfStatus;console.log(` RVF Size: ${o.cyan(Ve(a.fileSizeBytes))}`),console.log(` Segments: ${o.cyan(a.totalSegments)}`)}console.log(` Checksum: ${o.gray(t.checksum)}`),console.log(` Output: ${o.cyan(B.resolve(n.output))}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
25
|
-
Brain export failed:`),r),await this.cleanupAndExit(1)}}async executeImport(n){try{n.dryRun?console.log(o.yellow(`
|
|
26
|
-
Dry-run mode \u2014 no data will be written.
|
|
27
|
-
`)):console.log(o.blue(`
|
|
28
|
-
Importing brain state...
|
|
29
|
-
`));let r=await se(n.db),t=await Me(r,B.resolve(n.input),{mergeStrategy:n.strategy,dryRun:n.dryRun});console.log(o.green(" Import complete.")),console.log(` Imported: ${o.cyan(t.imported)}`),console.log(` Skipped: ${o.yellow(t.skipped)}`),console.log(` Conflicts: ${o.red(t.conflicts)}`),"embeddingsRestored"in t&&console.log(` Embeddings: ${o.cyan(t.embeddingsRestored)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
30
|
-
Brain import failed:`),r),await this.cleanupAndExit(1)}}async executeInfo(n){try{console.log(o.blue(`
|
|
31
|
-
Brain Export Info
|
|
32
|
-
`));let r=B.resolve(n.input),t=await qe(r),a="format"in t?t.format??"jsonl":"jsonl";if(console.log(` Version: ${o.cyan(t.version)}`),console.log(` Format: ${o.cyan(a)}`),console.log(` Exported: ${o.cyan(t.exportedAt)}`),console.log(` Source DB: ${o.cyan(t.sourceDb)}`),console.log(o.blue(`
|
|
33
|
-
Learning Data:`)),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"qValueCount"in t.stats&&console.log(` Q-Values: ${o.cyan(t.stats.qValueCount)}`),"dreamInsightCount"in t.stats){let i=t.stats.dreamInsightCount,c=("tableRecordCounts"in t?t.tableRecordCounts:void 0)?.dream_cycles,u=c!==void 0?` (${c} cycles)`:"";console.log(` Dream Insights: ${o.cyan(i)}${o.gray(u)}`)}"witnessChainLength"in t.stats&&console.log(` Witness Chain: ${o.cyan(t.stats.witnessChainLength)} entries`),"embeddingCount"in t.stats?console.log(` Embeddings: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`);let s="tableRecordCounts"in t?t.tableRecordCounts:void 0;if(s){let i=Object.entries(s).filter(([d,c])=>c>0&&!["qe_patterns","rl_q_values","dream_insights","dream_cycles","witness_chain","vectors","qe_pattern_embeddings"].includes(d));if(i.length>0)for(let[d,c]of i){let p=`${d.replace(/_/g," ").replace(/\b\w/g,f=>f.toUpperCase())}:`.padEnd(15);console.log(` ${p}${o.cyan(c)}`)}}let l="totalRecords"in t.stats?t.stats.totalRecords:void 0;if(l!==void 0&&(console.log(o.blue(`
|
|
34
|
-
Summary:`)),console.log(` Total Records: ${o.cyan(l)}`)),"domains"in t&&Array.isArray(t.domains)&&t.domains.length>0&&(l||console.log(o.blue(`
|
|
35
|
-
Summary:`)),console.log(` Domains: ${o.cyan(t.domains.join(", "))}`)),"rvfStatus"in t){let i=t.rvfStatus;console.log(o.blue(`
|
|
36
|
-
RVF Details:`)),console.log(` File Size: ${o.cyan(Ve(i.fileSizeBytes))}`),console.log(` Vectors: ${o.cyan(i.totalVectors)}`),console.log(` Segments: ${o.cyan(i.totalSegments)}`)}if("lineage"in t){let i=t.lineage;i&&(console.log(o.blue(`
|
|
37
|
-
Lineage:`)),console.log(` File ID: ${o.cyan(i.fileId)}`),console.log(` Parent ID: ${o.cyan(i.parentId??"none (root)")}`),console.log(` Depth: ${o.cyan(i.lineageDepth)}`))}if("signature"in t){let i=t.signature,d=t.signerKeyId;console.log(o.blue(`
|
|
38
|
-
Signature:`)),i?(console.log(` Status: ${o.green("Signed")}`),console.log(` Key ID: ${o.cyan(d??"unknown")}`),console.log(` Signature: ${o.gray(i.slice(0,32)+"...")}`)):console.log(` Status: ${o.yellow("Unsigned")}`)}console.log(`
|
|
39
|
-
Checksum: ${o.gray(t.checksum)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
40
|
-
Failed to read brain info:`),r),await this.cleanupAndExit(1)}}async executeDiff(n,r,t){try{let a=await Le(B.resolve(n),B.resolve(r),{tableFilter:t.table});if(t.json){process.stdout.write(JSON.stringify(a,null,2)+`
|
|
41
|
-
`),await this.cleanupAndExit(a.identical?0:1);return}En(a,t.verbose),await this.cleanupAndExit(a.identical?0:1)}catch(a){console.error(o.red(`
|
|
42
|
-
Brain diff failed:`),a),await this.cleanupAndExit(2)}}async executeSearch(n){try{let r=xn(n.limit),t=Cn(n.domain),a=await Fe(B.resolve(n.input),{table:n.table,domains:t,patternType:n.patternType,since:n.since,until:n.until,query:n.query,limit:r});if(n.json){process.stdout.write(JSON.stringify(a,null,2)+`
|
|
43
|
-
`),await this.cleanupAndExit(a.totalMatched>0?0:3);return}In(a),await this.cleanupAndExit(a.totalMatched>0?0:3)}catch(r){console.error(o.red(`
|
|
44
|
-
Brain search failed:`),r),await this.cleanupAndExit(2)}}async executeWitnessBackfill(n){try{console.log(o.blue(`
|
|
45
|
-
Running witness chain backfill...
|
|
46
|
-
`));let r=await se(n.db),t=await Pe(r);console.log(o.green(" Backfill complete.")),console.log(` Created: ${o.cyan(t.created)} new witness entries`),console.log(` Skipped: ${o.cyan(t.skipped)} (already witnessed)`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
47
|
-
Witness backfill failed:`),r),await this.cleanupAndExit(1)}}getHelp(){return`
|
|
48
|
-
Export, import, and inspect QE brain state.
|
|
49
|
-
|
|
50
|
-
Formats:
|
|
51
|
-
rvf \u2014 Single portable .rvf file (default, requires @ruvector/rvf-node)
|
|
52
|
-
jsonl \u2014 JSONL directory format (fallback when native not available)
|
|
53
|
-
|
|
54
|
-
Usage:
|
|
55
|
-
aqe brain export -o brain.rvf [--format rvf] [--db <path>]
|
|
56
|
-
aqe brain export -o ./brain-dir --format jsonl [--db <path>]
|
|
57
|
-
aqe brain import -i brain.rvf [--strategy skip-conflicts] [--dry-run] [--db <path>]
|
|
58
|
-
aqe brain info -i brain.rvf
|
|
59
|
-
|
|
60
|
-
Subcommands:
|
|
61
|
-
export Export brain state to a portable .rvf file or JSONL directory
|
|
62
|
-
import Import a brain export into the local database
|
|
63
|
-
info Show manifest metadata for an existing brain export
|
|
64
|
-
diff Compare two brain exports (manifest always; record-level for JSONL)
|
|
65
|
-
search Filtered search over a JSONL brain export
|
|
66
|
-
|
|
67
|
-
Examples:
|
|
68
|
-
aqe brain export -o .agentic-qe/brain.rvf
|
|
69
|
-
aqe brain export -o .agentic-qe/brain.rvf --format rvf
|
|
70
|
-
aqe brain export -o ./brain-export --format jsonl
|
|
71
|
-
aqe brain import -i .agentic-qe/brain.rvf --strategy latest-wins
|
|
72
|
-
aqe brain import -i .agentic-qe/brain.rvf --dry-run
|
|
73
|
-
aqe brain info -i .agentic-qe/brain.rvf
|
|
74
|
-
aqe brain diff ./brain-a ./brain-b --verbose
|
|
75
|
-
aqe brain search -i ./brain-export --query oauth --domain test-generation
|
|
76
|
-
aqe brain search -i ./brain-export --since 2026-03-01 --limit 50 --json
|
|
77
|
-
`}};async function se(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-NCDBQLLF.js");return B.join(n(),".agentic-qe","memory.db")}function Ve(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function xn(e){let n=Number.parseInt(e,10);return!Number.isFinite(n)||n<1?20:n}function Cn(e){if(e===void 0)return;let n=Array.isArray(e)?e:[e],r=[];for(let t of n)for(let a of t.split(",")){let s=a.trim();s&&r.push(s)}return r.length>0?r:void 0}function En(e,n){console.log(o.blue(`
|
|
78
|
-
Brain Diff
|
|
79
|
-
`)),console.log(` A: ${o.cyan(e.pathA)} (${e.formatA})`),console.log(` B: ${o.cyan(e.pathB)} (${e.formatB})`),console.log(` Versions: ${o.cyan(e.manifestA.version)} \u2192 ${o.cyan(e.manifestB.version)}`+(e.versionMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Checksums: ${o.gray(e.manifestA.checksum.slice(0,12))}\u2026 \u2192 ${o.gray(e.manifestB.checksum.slice(0,12))}\u2026`+(e.checksumMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Exported: ${o.gray(e.manifestA.exportedAt)} \u2192 ${o.gray(e.manifestB.exportedAt)}`),console.log(` Records: ${o.cyan(e.manifestA.totalRecords)} \u2192 ${o.cyan(e.manifestB.totalRecords)} `+Je(e.manifestB.totalRecords-e.manifestA.totalRecords)),(e.domainsOnlyInA.length>0||e.domainsOnlyInB.length>0)&&(console.log(o.blue(`
|
|
80
|
-
Domains:`)),e.domainsOnlyInA.length>0&&console.log(` Only in A: ${o.yellow(e.domainsOnlyInA.join(", "))}`),e.domainsOnlyInB.length>0&&console.log(` Only in B: ${o.yellow(e.domainsOnlyInB.join(", "))}`)),e.recordLevel||console.log(o.gray(`
|
|
81
|
-
Note: record-level diff is only available when both sides are JSONL exports.
|
|
82
|
-
Per-table counts shown below; re-export with --format jsonl for added/removed/changed IDs.`)),console.log(o.blue(`
|
|
83
|
-
Tables:`));let r=e.tableDiffs.filter(Bn);if(r.length===0)console.log(o.gray(" (no differences)"));else for(let t of r)console.log(` ${t.tableName.padEnd(28)} ${o.cyan(String(t.countA).padStart(7))} \u2192 ${o.cyan(String(t.countB).padStart(7))} ${Je(t.delta)}`+_n(t,n)),n&&(t.added&&t.added.length>0&&le("added",t.added),t.removed&&t.removed.length>0&&le("removed",t.removed),t.changed&&t.changed.length>0&&le("changed",t.changed));console.log(""),e.identical?console.log(o.green(` Result: identical
|
|
84
|
-
`)):console.log(o.yellow(` Result: differences found
|
|
85
|
-
`))}function Bn(e){return!!(e.delta!==0||e.added&&e.added.length>0||e.removed&&e.removed.length>0||e.changed&&e.changed.length>0)}function Je(e){return e===0?o.gray("(\xB10)"):e>0?o.green(`(+${e})`):o.red(`(${e})`)}function _n(e,n){let r=[];return e.added&&e.added.length>0&&r.push(o.green(`+${e.added.length}`)),e.removed&&e.removed.length>0&&r.push(o.red(`-${e.removed.length}`)),e.changed&&e.changed.length>0&&r.push(o.yellow(`~${e.changed.length}`)),r.length===0?"":n?" "+r.join(" "):" "+o.gray("[")+r.join(" ")+o.gray("]")}function le(e,n){let r=n.slice(0,10).join(", "),t=n.length>10?o.gray(` \u2026(+${n.length-10} more)`):"";console.log(` ${o.gray(e+":")} ${r}${t}`)}function In(e){if(console.log(o.blue(`
|
|
86
|
-
Brain Search
|
|
87
|
-
`)),console.log(` Input: ${o.cyan(e.inputPath)}`),console.log(` Table: ${o.cyan(e.table)}`),console.log(` Scanned: ${o.cyan(e.totalScanned)} Matched: ${o.cyan(e.totalMatched)} Shown: ${o.cyan(e.hits.length)}`+(e.truncated?o.yellow(` (truncated to limit ${e.limit})`):"")),e.hits.length===0){console.log(o.yellow(`
|
|
88
|
-
No matching rows.
|
|
89
|
-
`));return}console.log("");for(let n of e.hits){let r=o.cyan(n.id)+(n.display.patternType?o.gray(` ${n.display.patternType}`):"")+(n.display.domain?o.gray(` [${n.display.domain}]`):"")+(n.display.confidence!==void 0?o.gray(` conf=${n.display.confidence.toFixed(2)}`):"");if(console.log(` ${r}`),n.display.name&&console.log(` ${o.bold(n.display.name)}`),n.display.description){let t=n.display.description.length>200?n.display.description.slice(0,200)+"\u2026":n.display.description;console.log(` ${o.gray(t)}`)}n.display.updatedAt&&console.log(` ${o.gray(n.display.updatedAt)}`),console.log("")}}function dt(e,n){return new de(e,n)}export{de as BrainHandler,dt as createBrainHandler};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.1");process.exit(0)}
|
|
2
|
-
import{a}from"./chunk-774X6OJY.js";import"./chunk-BALFQQB7.js";import"./chunk-LRWBOJ5Y.js";import"./chunk-XDRAU3W6.js";import"./chunk-PQ4NSXZM.js";import"./chunk-FNMEVLSN.js";import"./chunk-NOCPO55P.js";import"./chunk-IE6FDICX.js";import"./chunk-O65OPAZH.js";import"./chunk-BLU7OLQZ.js";import"./chunk-UBPJQKYS.js";import"./chunk-75AVUS5U.js";import"./chunk-4U5MJX2H.js";import"./chunk-TMPRR3FZ.js";import"./chunk-R4A6PY5D.js";import"./chunk-JRNDFC23.js";import"./chunk-6BCVKCG5.js";import"./chunk-UR655D4K.js";import"./chunk-PZ3Q34OT.js";import"./chunk-CXUHD2O5.js";import"./chunk-IC6SOVGO.js";import"./chunk-USTUWUCE.js";import"./chunk-U5ITD7ZD.js";export{a as BrowserWorkflowTool};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.1");process.exit(0)}
|
|
2
|
-
import{a as T,c as N}from"./chunk-UBPJQKYS.js";import{b as D,c as L,d as V}from"./chunk-6BCVKCG5.js";N();V();import*as C from"fs";import*as v from"path";import*as W from"yaml";var q=5,H=4,Q=3e4,K=".claude/skills",B=5e3,J=500,$=100,Y=1e3,F=500,z=.8,X=.2,Z=.1,w=.1,ee=.1,te=.1,se=.1,re=200,ne=500,ae=300,ie=1,oe=.9,U={maxWorkers:q,batchSize:H,retryFailedTests:!0,timeout:Q,skillsDir:K,progressIntervalMs:B},S=class{async execute(e,r,t){let s=L($,J+$);return await new Promise(o=>setTimeout(o,s)),{output:this.generateMockResponse(e),tokensUsed:D(F,Y+F),durationMs:s}}generateMockResponse(e){let r=[];return e.includes("alt")&&r.push("alt","1.1.1","perceivable"),e.includes("contrast")&&r.push("contrast","1.4.3","4.5:1"),e.includes("keyboard")&&r.push("keyboard","2.1.1","operable","button"),e.includes("label")&&r.push("label","3.3.2","understandable"),e.includes("ARIA")&&r.push("ARIA","4.1.2","robust"),e.includes("focus")&&r.push("focus","2.4.7","outline"),e.includes("lang")&&r.push("lang","3.1.1","language"),e.includes("caption")&&r.push("caption","1.2.2","track"),e.includes("accessible")&&r.push("accessible","compliant"),r.length===0&&r.push("accessibility","WCAG","finding"),`Analysis complete. Found issues related to: ${r.join(", ")}.
|
|
3
|
-
Recommendations: Implement proper ${r[0]} attributes for better accessibility.
|
|
4
|
-
Severity: ${e.includes("critical")?"critical":"serious"}`}},M=class{constructor(e,r,t){this.executor=r;this.config=t;this.id=e}executor;config;id;status="idle";tasksCompleted=0;tasksFailed=0;lastHeartbeat=Date.now();async executeBatch(e){this.status="running";let r=[];for(let t of e){this.lastHeartbeat=Date.now();try{let s=await this.executeTestCase(t);if(r.push(s),s.passed)this.tasksCompleted++;else if(this.tasksFailed++,this.config.retryFailedTests&&!s.passed){let n=await this.executeTestCase(t,!0);n.passed&&(r[r.length-1]=n,this.tasksCompleted++,this.tasksFailed--)}}catch(s){this.tasksFailed++,r.push({testId:t.testCaseId,passed:!1,expectedPatterns:t.testCase.expected_output.must_contain||[],actualPatterns:[],reasoningQuality:0,category:t.testCase.category,priority:t.testCase.priority,error:T(s)})}}return this.status="idle",r}async executeTestCase(e,r=!1){let t=Date.now(),s=this.buildPrompt(e),n=await this.executor.execute(s,e.model,{timeout:this.config.timeout}),o=this.validateResponse(n.output,e.testCase.expected_output,e.testCase.validation);return{testId:e.testCaseId,passed:o.passed,expectedPatterns:e.testCase.expected_output.must_contain||[],actualPatterns:o.foundPatterns,reasoningQuality:o.reasoningQuality,executionTimeMs:Date.now()-t,category:e.testCase.category,priority:e.testCase.priority,error:o.error}}buildPrompt(e){let{testCase:r}=e,t=r.input.context;return`Analyze the following ${t.language||"HTML"} code for accessibility issues.
|
|
5
|
-
Context: ${t.description||r.description}
|
|
6
|
-
WCAG Level: ${t.wcagLevel||"AA"}
|
|
7
|
-
|
|
8
|
-
Code:
|
|
9
|
-
\`\`\`${t.language||"html"}
|
|
10
|
-
${r.input.code}
|
|
11
|
-
\`\`\`
|
|
12
|
-
|
|
13
|
-
Provide a detailed analysis including:
|
|
14
|
-
1. All accessibility issues found
|
|
15
|
-
2. WCAG success criteria violated
|
|
16
|
-
3. Severity classification (critical/serious/moderate/minor)
|
|
17
|
-
4. Remediation recommendations with code examples`}validateResponse(e,r,t){let s=[],n=[],o=r.must_contain||[],i=0;for(let p of o)new RegExp(p,"i").test(e)&&(s.push(p),i++);let l=r.must_not_contain||[];for(let p of l)new RegExp(p,"i").test(e)&&n.push(`Output should not contain: ${p}`);let u=r.must_match_regex||[];for(let p of u)new RegExp(p,"i").test(e)||n.push(`Output should match regex: ${p}`);let f=o.length>0?i/o.length:1,m=t?.keyword_match_threshold??z,g=f>=m,c=this.calculateReasoningQuality(e,t),_=t?.reasoning_quality_min??0,h=c>=_;return{passed:g&&h&&n.length===0,foundPatterns:s,reasoningQuality:c,error:n.length>0?n.join("; "):void 0}}calculateReasoningQuality(e,r){let t=0;if(e.length>re&&(t+=X),e.length>ne&&(t+=Z),e.includes(`
|
|
18
|
-
`)&&(t+=w),(e.includes("1.")||e.includes("-"))&&(t+=w),e.includes("```")&&(t+=w),e.includes("WCAG")&&(t+=ee),(e.includes("remediation")||e.includes("recommendation"))&&(t+=te),(e.includes("severity")||e.includes("critical"))&&(t+=se),r?.grading_rubric){let s=r.grading_rubric,n=0;s.completeness&&e.length>ae&&(n+=s.completeness),s.accuracy&&e.includes("WCAG")&&(n+=s.accuracy),s.actionability&&(e.includes("fix")||e.includes("change"))&&(n+=s.actionability),t=Math.max(t,n)}return Math.min(t,1)}getProgress(e){return{workerId:this.id,tasksCompleted:this.tasksCompleted,tasksTotal:e,elapsedMs:Date.now()-this.lastHeartbeat}}},P=class{constructor(e=U,r,t=new S){this.config=e;this.skillValidationLearner=r;this.executor=t;for(let s=0;s<e.maxWorkers;s++)this.workers.push(new M(s,t,e))}config;skillValidationLearner;executor;workers=[];progressCallback;onProgress(e){this.progressCallback=e}async runEvalParallel(e,r){let t=Date.now(),s=this.loadEvalSuite(e);if(!s)throw new Error(`Failed to load eval suite for skill: ${e}`);let n=this.createTasks(s,r),o=this.partitionTestCases(n,this.config.batchSize),i=n.length*(this.config.timeout/2),l=[],u=[];for(let d=0;d<o.length;d++){let b=this.workers[d%this.workers.length];u.push(b.executeBatch(o[d]))}let f=this.startProgressReporting(e,r,n.length,t);try{let d=await Promise.all(u);for(let b of d)l.push(...b)}finally{f&&clearInterval(f)}let m=Date.now()-t,g=l.filter(d=>d.passed).length,c=l.filter(d=>!d.passed).length,_=n.length-l.length,h=l.length>0?g/l.length:0,x=l.length>0?l.reduce((d,b)=>d+b.reasoningQuality,0)/l.length:0,p=m>0?i/m:1,y=h>=s.success_criteria.pass_rate&&x>=(s.success_criteria.avg_reasoning_quality??0);return await this.recordOutcome({skillName:e,trustTier:this.determineTrustTier(s),validationLevel:"eval",model:r,passed:y,score:h,testCaseResults:l,timestamp:new Date,runId:`${e}-${r}-${Date.now()}`,metadata:{duration:m,parallelSpeedup:p,workersUsed:this.config.maxWorkers,version:s.version}}),{skill:e,model:r,totalTests:n.length,passedTests:g,failedTests:c,skippedTests:_,passRate:h,testResults:l,totalDurationMs:m,parallelSpeedup:p,avgReasoningQuality:x,passed:y,workersUsed:this.config.maxWorkers,timestamp:new Date}}async runMultipleEvalsParallel(e,r){let t=new Map,s=[];for(let i of e){t.set(i,[]);for(let l of r)s.push({skill:i,model:l})}let n=s.map(async({skill:i,model:l})=>{let u=await this.runEvalParallel(i,l);return{skill:i,result:u}}),o=await Promise.all(n);for(let{skill:i,result:l}of o)t.get(i).push(l);return t}loadEvalSuite(e){let r=v.isAbsolute(this.config.skillsDir)?this.config.skillsDir:v.join(process.cwd(),this.config.skillsDir),t=v.join(r,e,"evals",`${e}.yaml`);if(!C.existsSync(t))return console.error(`Eval suite not found: ${t}`),null;try{let s=C.readFileSync(t,"utf-8");return W.parse(s)}catch(s){return console.error(`Failed to parse eval suite: ${s instanceof Error?s.message:s}`),null}}createTasks(e,r){return e.test_cases.map((t,s)=>({skillName:e.skill,testCaseId:t.id,testCase:t,model:r,batchId:Math.floor(s/this.config.batchSize),indexInBatch:s%this.config.batchSize}))}partitionTestCases(e,r){let t=[];for(let s=0;s<e.length;s+=r)t.push(e.slice(s,s+r));return t}determineTrustTier(e){let r=e.mcp_integration?.enabled??!1,t=e.learning?.cross_model_comparison??!1,s=e.success_criteria.critical_pass_rate??0;return r&&t&&s>=ie?3:r||s>=oe?2:1}startProgressReporting(e,r,t,s){return this.progressCallback?setInterval(()=>{let n=Date.now()-s,o=this.workers.reduce((c,_)=>c+_.tasksCompleted,0),i=this.workers.reduce((c,_)=>c+_.tasksFailed,0),l=this.workers.filter(c=>c.status==="running").length,u=n>0?o/n:0,f=t-o,m=u>0?f/u:0,g={skill:e,model:r,totalTasks:t,completedTasks:o,failedTasks:i,activeWorkers:l,elapsedMs:n,estimatedRemainingMs:m,workerProgress:this.workers.map(c=>c.getProgress(t))};this.progressCallback(g)},this.config.progressIntervalMs):null}async recordOutcome(e){await this.skillValidationLearner.recordValidationOutcome(e)}getWorkerStatus(){return this.workers.map(e=>({id:e.id,status:e.status,tasksCompleted:e.tasksCompleted,tasksFailed:e.tasksFailed}))}resetWorkers(){for(let e of this.workers)e.tasksCompleted=0,e.tasksFailed=0,e.status="idle"}};function fe(a,e={},r){let t={...U,...e};return new P(t,a,r)}N();import*as R from"node:fs";import*as E from"node:path";import*as j from"yaml";import{spawnSync as le}from"node:child_process";var G=["none","low","medium","high","critical"];function ce(a,e){if(typeof a!="string")return!1;let r=G.indexOf(a),t=G.indexOf(e);return r>=0&&t>=0&&r>=t}function A(a,e){if(typeof e!="string"||!e.startsWith("."))return;let r=e==="."?[]:e.slice(1).split("."),t=a;for(let s of r){if(t==null||typeof t!="object")return;t=t[s]}return t}var ue=(a,e)=>{let r=le("bash",["-c",a],{timeout:e.timeoutMs,cwd:e.cwd,encoding:"utf8",maxBuffer:16777216});return{status:r.status,stdout:typeof r.stdout=="string"?r.stdout:"",stderr:typeof r.stderr=="string"?r.stderr:"",error:r.error}};function de(a){if(!a||typeof a!="object")return!1;let e=a;return!Array.isArray(e.test_cases)||e.test_cases.length===0?!1:typeof e.test_cases[0]?.input?.command=="string"}function me(a,e,r){let t=[],s=a.expected||{};s.exit_code!==void 0&&e!==s.exit_code&&t.push(`exit_code: expected ${s.exit_code}, got ${e}`);let n=!!s.json_fields||s.severity_at_least!==void 0||s.candidate_count_at_least!==void 0,o=null;if(n)try{o=JSON.parse(r)}catch(i){return t.push(`stdout is not valid JSON: ${T(i)}`),{passed:!1,failures:t}}if(s.json_fields)for(let[i,l]of Object.entries(s.json_fields)){let u=A(o,i);I(u,l)||t.push(`json_fields ${i}: expected ${JSON.stringify(l)}, got ${JSON.stringify(u)}`)}if(s.severity_at_least!==void 0){let i=A(o,".output.checkInjection.severity");ce(i,s.severity_at_least)||t.push(`severity_at_least: expected >= ${s.severity_at_least}, got ${JSON.stringify(i)}`)}if(s.candidate_count_at_least!==void 0){let i=A(o,".output.intentScore.candidateCount");(typeof i=="number"?i:Number.NaN)>=s.candidate_count_at_least||t.push(`candidate_count_at_least: expected >= ${s.candidate_count_at_least}, got ${JSON.stringify(i)}`)}return{passed:t.length===0,failures:t}}function I(a,e){if(a===e)return!0;if(a==null||e==null)return a===e;if(typeof a!=typeof e)return!1;if(Array.isArray(a))return!Array.isArray(e)||a.length!==e.length?!1:a.every((r,t)=>I(r,e[t]));if(typeof a=="object"){if(typeof e!="object"||Array.isArray(e))return!1;let r=a,t=e,s=Object.keys(r),n=Object.keys(t);return s.length!==n.length?!1:s.every(o=>I(r[o],t[o]))}return!1}var O=class{skillsDir;timeoutMs;cwd;runner;constructor(e={}){this.skillsDir=e.skillsDir??".claude/skills",this.timeoutMs=e.timeoutMs??6e4,this.cwd=e.cwd??process.cwd(),this.runner=e.runner??ue}loadSuite(e){let r=E.isAbsolute(this.skillsDir)?this.skillsDir:E.join(this.cwd,this.skillsDir),t=E.join(r,e,"evals",`${e}.yaml`);if(!R.existsSync(t))return null;try{let s=j.parse(R.readFileSync(t,"utf-8"));return de(s)?s:null}catch{return null}}async run(e){let r=Date.now(),t=this.loadSuite(e);if(!t)throw new Error(`Command-eval suite not found or not command-mode at ${this.skillsDir}/${e}/evals/${e}.yaml`);let s=[];for(let c of t.test_cases)s.push(this.executeCase(c));let n=s.filter(c=>c.passed).length,o=s.length-n,i=s.length>0?n/s.length:0,l=t.validation?.required_pass_rate??.9,u=t.validation?.critical_must_pass??!0,m=s.filter(c=>c.priority==="critical").every(c=>c.passed),g=i>=l&&(!u||m);return{skill:e,passed:g,totalTests:s.length,passedTests:n,failedTests:o,passRate:i,criticalPassed:m,testResults:s,totalDurationMs:Date.now()-r,timestamp:new Date}}executeCase(e){let r=Date.now(),t=e.input?.setup??[];for(let o of t){let i=this.runner(o,{timeoutMs:this.timeoutMs,cwd:this.cwd});if(i.status!==0)return{testId:e.id,passed:!1,category:e.category,priority:e.priority,exitCode:i.status,stdoutSnippet:k(i.stdout),stderrSnippet:k(i.stderr),failures:[],setupFailure:`setup step failed (exit ${i.status}): ${o}`,durationMs:Date.now()-r}}let s=this.runner(e.input.command,{timeoutMs:this.timeoutMs,cwd:this.cwd}),n=me(e,s.status,s.stdout);return{testId:e.id,passed:n.passed,category:e.category,priority:e.priority,exitCode:s.status,stdoutSnippet:k(s.stdout),stderrSnippet:k(s.stderr),failures:n.failures,durationMs:Date.now()-r}}};function k(a,e=500){return a.length<=e?a:`${a.slice(0,e)}\u2026[truncated ${a.length-e}b]`}function be(a={}){return new O(a)}export{U as a,fe as b,de as c,be as d};
|