agentic-qe 3.12.3 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/helpers/.helpers-version +1 -1
- package/.claude/helpers/auto-memory-hook.mjs +430 -430
- package/.claude/helpers/helpers.manifest.json +6 -5
- package/.claude/helpers/hook-handler.cjs +565 -311
- package/.claude/helpers/intelligence.cjs +1058 -1058
- package/.claude/helpers/statusline.cjs +995 -682
- package/.claude/skills/qe-court/SKILL.md +186 -0
- package/.claude/skills/qe-court/config.json +27 -0
- package/.claude/skills/qe-court/evals/fixtures/seeded-mutant-delivery/README.md +38 -0
- package/.claude/skills/qe-court/evals/fixtures/seeded-mutant-delivery/budget.test.ts +21 -0
- package/.claude/skills/qe-court/evals/fixtures/seeded-mutant-delivery/budget.ts +25 -0
- package/.claude/skills/qe-court/evals/qe-court.yaml +70 -0
- package/.claude/skills/qe-court/schemas/output.json +92 -0
- package/.claude/skills/qe-court/scripts/validate-config.json +30 -0
- package/.claude/skills/skills-manifest.json +9 -8
- package/CHANGELOG.md +65 -0
- package/README.md +3 -3
- package/assets/skills/qe-court/SKILL.md +186 -0
- package/assets/skills/qe-court/config.json +27 -0
- package/assets/skills/qe-court/evals/fixtures/seeded-mutant-delivery/README.md +38 -0
- package/assets/skills/qe-court/evals/fixtures/seeded-mutant-delivery/budget.test.ts +21 -0
- package/assets/skills/qe-court/evals/fixtures/seeded-mutant-delivery/budget.ts +25 -0
- package/assets/skills/qe-court/evals/qe-court.yaml +70 -0
- package/assets/skills/qe-court/schemas/output.json +92 -0
- package/assets/skills/qe-court/scripts/validate-config.json +30 -0
- package/assets/skills/skills-manifest.json +9 -8
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-CWIMFWAI.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-XFAQATTH.js → agent-booster-wasm-ACX2DK7Y.js} +2 -2
- package/dist/cli/chunks/{agent-handler-2ZV4CA3U.js → agent-handler-B45WP4ZJ.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-6WGP7F5T.js → agent-memory-branch-QQLZDE56.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-OTXT2DLN.js +2 -0
- package/dist/cli/chunks/{arena-FWX7XZAE.js → arena-G3IKZAG5.js} +4 -4
- package/dist/cli/chunks/{arena-KJUNQK4N.js → arena-SDB7723R.js} +2 -2
- package/dist/cli/chunks/{audit-YFUDEOKN.js → audit-GY46XUZA.js} +3 -3
- package/dist/cli/chunks/base-O3SPSWBA.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-SKTT5KIH.js → better-sqlite3-DUZ6FFAH.js} +2 -2
- package/dist/cli/chunks/{brain-handler-ZCK4WTPK.js → brain-handler-347CYMPN.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-HTVINRYG.js → branch-enumerator-Z3ULBFSM.js} +2 -2
- package/dist/cli/chunks/{browser-WUL2B77M.js → browser-OYEIHD7F.js} +2 -2
- package/dist/cli/chunks/browser-workflow-MXS3ZKY2.js +2 -0
- package/dist/cli/chunks/{chunk-OBL6W4Z5.js → chunk-2DIT5AUU.js} +2 -2
- package/dist/cli/chunks/{chunk-IWQHQLT6.js → chunk-2NRZYQSF.js} +2 -2
- package/dist/cli/chunks/chunk-2VQVEQS4.js +153 -0
- package/dist/cli/chunks/{chunk-E2U3LTGM.js → chunk-32ZGV4Q4.js} +1 -1
- package/dist/cli/chunks/{chunk-VUCVSKJC.js → chunk-34PEINFS.js} +2 -2
- package/dist/cli/chunks/{chunk-XUUVAAHV.js → chunk-3GSYD5SL.js} +2 -2
- package/dist/cli/chunks/{chunk-MOX25RZQ.js → chunk-3JVUWKCO.js} +2 -2
- package/dist/cli/chunks/{chunk-RLBNAB6Y.js → chunk-3K4SF57Q.js} +1 -1
- package/dist/cli/chunks/{chunk-MSDIIRLM.js → chunk-3NOCK6ED.js} +2 -2
- package/dist/cli/chunks/{chunk-3YC4YUGB.js → chunk-3UHEZ5HZ.js} +2 -2
- package/dist/cli/chunks/{chunk-J2RJOJ5Q.js → chunk-4BDLD7V2.js} +1 -1
- package/dist/cli/chunks/{chunk-ZGKQCUPB.js → chunk-4BESADKE.js} +2 -2
- package/dist/cli/chunks/{chunk-PDX7IYTJ.js → chunk-54MFKCLT.js} +2 -2
- package/dist/cli/chunks/{chunk-TP3UAWMB.js → chunk-56WZFXTQ.js} +2 -2
- package/dist/cli/chunks/{chunk-WFPGIP4N.js → chunk-5EIOQCGN.js} +2 -2
- package/dist/cli/chunks/{chunk-32L7DKNQ.js → chunk-5FLTZ3KT.js} +2 -2
- package/dist/cli/chunks/{chunk-Y5L37K7X.js → chunk-5ICQL42E.js} +2 -2
- package/dist/cli/chunks/{chunk-Y625LP6K.js → chunk-5KAT6WBQ.js} +2 -2
- package/dist/cli/chunks/{chunk-UIHZ34SJ.js → chunk-6AOBLBR4.js} +2 -2
- package/dist/cli/chunks/{chunk-7WF3TW3G.js → chunk-6DTOGSDV.js} +4 -4
- package/dist/cli/chunks/{chunk-NAMJGRGC.js → chunk-6SXKCIN5.js} +2 -2
- package/dist/cli/chunks/{chunk-FTM562PF.js → chunk-7DMXCCSD.js} +1 -1
- package/dist/cli/chunks/{chunk-KE3RK35K.js → chunk-7UNY32PU.js} +1 -1
- package/dist/cli/chunks/{chunk-BSNNTOHY.js → chunk-7YXT6BXN.js} +3 -3
- package/dist/cli/chunks/{chunk-DZ775UGW.js → chunk-A4QLGPYO.js} +2 -2
- package/dist/cli/chunks/{chunk-SFS3UHNF.js → chunk-A7GLWWSE.js} +1 -1
- package/dist/cli/chunks/{chunk-WKE6WL5C.js → chunk-ANIDFJCT.js} +3 -3
- package/dist/cli/chunks/{chunk-XDHGCBTS.js → chunk-ANYYTWOQ.js} +2 -2
- package/dist/cli/chunks/{chunk-NLDLUHOF.js → chunk-AO7AHX6K.js} +2 -2
- package/dist/cli/chunks/{chunk-Z3SXMYVI.js → chunk-BCKTBGDM.js} +3 -3
- package/dist/cli/chunks/{chunk-UGW23T6S.js → chunk-BGYLNCL6.js} +2 -2
- package/dist/cli/chunks/{chunk-KVHCWH4H.js → chunk-BOVH6WSM.js} +2 -2
- package/dist/cli/chunks/{chunk-L2X3BWMN.js → chunk-BUGWPTMF.js} +2 -2
- package/dist/cli/chunks/{chunk-DTZFZ5M7.js → chunk-CFVEDUTW.js} +2 -2
- package/dist/cli/chunks/{chunk-CL6SNCFF.js → chunk-CPH5JP4L.js} +1 -1
- package/dist/cli/chunks/{chunk-AIWRYWK2.js → chunk-CQFT7H3F.js} +2 -2
- package/dist/cli/chunks/{chunk-BQ2K4BPD.js → chunk-CWUBOLKY.js} +2 -2
- package/dist/cli/chunks/{chunk-2LNDU7AW.js → chunk-CYL2FV23.js} +2 -2
- package/dist/cli/chunks/{chunk-YEC55GO5.js → chunk-D3MPV5G7.js} +2 -2
- package/dist/cli/chunks/{chunk-DMD6WVJ2.js → chunk-DRIJYTSK.js} +2 -2
- package/dist/cli/chunks/{chunk-PXCJDB7J.js → chunk-DYUC7WFA.js} +1 -1
- package/dist/cli/chunks/{chunk-EOUJ6X5H.js → chunk-E3B5XTXJ.js} +1 -1
- package/dist/cli/chunks/{chunk-PSDH7CIL.js → chunk-EECM5XKY.js} +1 -1
- package/dist/cli/chunks/{chunk-E53UR2EW.js → chunk-EFRESRLB.js} +3 -3
- package/dist/cli/chunks/{chunk-SGMJ277D.js → chunk-ES7WCYOU.js} +1 -1
- package/dist/cli/chunks/{chunk-DDYP6FBC.js → chunk-FAQLI3P5.js} +2 -2
- package/dist/cli/chunks/{chunk-CXMOIE7D.js → chunk-FBBZHATF.js} +2 -2
- package/dist/cli/chunks/{chunk-KKOFH26C.js → chunk-FL3BM54K.js} +1 -1
- package/dist/cli/chunks/{chunk-MB7TZQW3.js → chunk-FQLWQWRU.js} +3 -3
- package/dist/cli/chunks/{chunk-GMFFMJD6.js → chunk-FQY3UTGA.js} +2 -2
- package/dist/cli/chunks/{chunk-SPI4LUJ6.js → chunk-FUU32QY5.js} +2 -2
- package/dist/cli/chunks/{chunk-RSZOCQOL.js → chunk-G4GTE3RJ.js} +2 -2
- package/dist/cli/chunks/{chunk-NOSQI2OW.js → chunk-G5DFYX3J.js} +3 -3
- package/dist/cli/chunks/{chunk-OPG2HV2W.js → chunk-G7FMYFTN.js} +1 -1
- package/dist/cli/chunks/{chunk-N4ML23ZG.js → chunk-GFBLWFRV.js} +1 -1
- package/dist/cli/chunks/{chunk-LNIHLNW4.js → chunk-GJMZR7WU.js} +3 -3
- package/dist/cli/chunks/{chunk-PTPN6HQ7.js → chunk-GTUFX7AR.js} +2 -2
- package/dist/cli/chunks/{chunk-67BCEHU5.js → chunk-GUEZQOHL.js} +1 -1
- package/dist/cli/chunks/{chunk-RE42RJYR.js → chunk-HL2QMM4M.js} +2 -2
- package/dist/cli/chunks/{chunk-QILF6BZH.js → chunk-HOKON5EL.js} +2 -2
- package/dist/cli/chunks/{chunk-YOG5KQZF.js → chunk-HTPM3URI.js} +2 -2
- package/dist/cli/chunks/chunk-HVB2L52I.js +2 -0
- package/dist/cli/chunks/{chunk-DHUZHT5D.js → chunk-IHQTXJAQ.js} +1 -1
- package/dist/cli/chunks/{chunk-SV7J5FDW.js → chunk-IPHLXAMX.js} +2 -2
- package/dist/cli/chunks/{chunk-Y6XNISHP.js → chunk-IYDYJ33J.js} +2 -2
- package/dist/cli/chunks/{chunk-CYSBM52D.js → chunk-IZRLIWFN.js} +2 -2
- package/dist/cli/chunks/{chunk-MS6VOSPY.js → chunk-J3L52EA4.js} +5 -5
- package/dist/cli/chunks/{chunk-WQASUQ5P.js → chunk-JGM6XCCP.js} +1 -1
- package/dist/cli/chunks/chunk-JPIBPKBP.js +54 -0
- package/dist/cli/chunks/{chunk-TXLPOXAN.js → chunk-K5N6SLHO.js} +1 -1
- package/dist/cli/chunks/{chunk-R6WMGSEK.js → chunk-KSYLRM4Q.js} +2 -2
- package/dist/cli/chunks/{chunk-2CPJCXV6.js → chunk-KUA4HHU6.js} +2 -2
- package/dist/cli/chunks/{chunk-WUE53ZPH.js → chunk-KVL63BSU.js} +1 -1
- package/dist/cli/chunks/{chunk-6SUSRXXF.js → chunk-KZTBNDNE.js} +1 -1
- package/dist/cli/chunks/{chunk-M7W6VJ65.js → chunk-L2SFGFE6.js} +1 -1
- package/dist/cli/chunks/{chunk-XZGOXLZH.js → chunk-L4LLA5U7.js} +1 -1
- package/dist/cli/chunks/{chunk-AZ24ONMX.js → chunk-L4S722JD.js} +1 -1
- package/dist/cli/chunks/{chunk-HJ4U64BL.js → chunk-LBE2P6UC.js} +2 -2
- package/dist/cli/chunks/{chunk-KA4EAMMQ.js → chunk-LOXVVMS4.js} +3 -3
- package/dist/cli/chunks/{chunk-UGXHMQ6P.js → chunk-LWYLW7RX.js} +2 -2
- package/dist/cli/chunks/{chunk-HJ2LG5IH.js → chunk-LXPB7H2P.js} +1 -1
- package/dist/cli/chunks/{chunk-WBZNLFTV.js → chunk-MBCGI3M2.js} +3 -3
- package/dist/cli/chunks/{chunk-7XUM4LBC.js → chunk-MVI2QMRW.js} +1 -1
- package/dist/cli/chunks/{chunk-2OX74DOO.js → chunk-N5MMBA35.js} +1 -1
- package/dist/cli/chunks/{chunk-VSD6JE2H.js → chunk-N7VOOI3U.js} +2 -2
- package/dist/cli/chunks/{chunk-ROFCS47F.js → chunk-NETN3OUG.js} +1 -1
- package/dist/cli/chunks/chunk-NQNKKVNO.js +29 -0
- package/dist/cli/chunks/{chunk-NJDLJ3KD.js → chunk-NUQBJGGF.js} +2 -2
- package/dist/cli/chunks/chunk-OETDMOOE.js +2 -0
- package/dist/cli/chunks/{chunk-4EHW4TNA.js → chunk-OXXMVQDF.js} +2 -2
- package/dist/cli/chunks/{chunk-6HQDPDN5.js → chunk-OZR25R7W.js} +2 -2
- package/dist/cli/chunks/{chunk-UZ7FXVH5.js → chunk-PERJO2DY.js} +1 -1
- package/dist/cli/chunks/{chunk-XQ5JT7KM.js → chunk-PP2RYSHT.js} +3 -3
- package/dist/cli/chunks/{chunk-DCYBV6HV.js → chunk-Q7PBGNUD.js} +1 -1
- package/dist/cli/chunks/{chunk-LCM7TY76.js → chunk-QCEW4ZDW.js} +2 -2
- package/dist/cli/chunks/{chunk-NKTLKMUB.js → chunk-QI4CGJNK.js} +1 -1
- package/dist/cli/chunks/{chunk-NT66CT73.js → chunk-QQB55ZJJ.js} +2 -2
- package/dist/cli/chunks/{chunk-KRS4KGX5.js → chunk-QTU3CVOB.js} +2 -2
- package/dist/cli/chunks/{chunk-DW7OI5IF.js → chunk-QWYISZTN.js} +2 -2
- package/dist/cli/chunks/{chunk-KNWBRMLL.js → chunk-R3GEXYO4.js} +2 -2
- package/dist/cli/chunks/{chunk-YUDGQZJN.js → chunk-RDU4WTV2.js} +2 -2
- package/dist/cli/chunks/{chunk-VFYMWDSJ.js → chunk-RJZRWVL4.js} +1 -1
- package/dist/cli/chunks/{chunk-D4GMAUTP.js → chunk-RLCWR7TS.js} +10 -10
- package/dist/cli/chunks/{chunk-YDYKFSD2.js → chunk-RSFIOR2I.js} +10 -10
- package/dist/cli/chunks/{chunk-EHO52NKU.js → chunk-RVJPWRV6.js} +2 -2
- package/dist/cli/chunks/{chunk-KGHSKDC7.js → chunk-RVRBTOWX.js} +2 -2
- package/dist/cli/chunks/{chunk-2YDZXFO2.js → chunk-SHCTEXNH.js} +2 -2
- package/dist/cli/chunks/chunk-SNTUKW4Q.js +2 -0
- package/dist/cli/chunks/{chunk-MOXKKY5Q.js → chunk-SRQ3CPJE.js} +4 -4
- package/dist/cli/chunks/{chunk-GS6G7AVS.js → chunk-THBTN7XB.js} +2 -2
- package/dist/cli/chunks/{chunk-LHAUFY4Y.js → chunk-TNRIGQ6U.js} +2 -2
- package/dist/cli/chunks/{chunk-UAPUA6OY.js → chunk-TVMFH5N2.js} +2 -2
- package/dist/cli/chunks/{chunk-HGJQSTQD.js → chunk-TZ73SXQ5.js} +1 -1
- package/dist/cli/chunks/{chunk-CHFTHSMM.js → chunk-TZPKTRJB.js} +2 -2
- package/dist/cli/chunks/{chunk-GV2BS5NC.js → chunk-U2SW6KK5.js} +2 -2
- package/dist/cli/chunks/{chunk-BDGKB2PT.js → chunk-UIPPJKON.js} +2 -2
- package/dist/cli/chunks/{chunk-FXOOOJQD.js → chunk-UMG5URNV.js} +1 -1
- package/dist/cli/chunks/{chunk-7Q74K3HZ.js → chunk-UNIBND6A.js} +1 -1
- package/dist/cli/chunks/{chunk-LGYEOYQJ.js → chunk-USMDIIHY.js} +2 -2
- package/dist/cli/chunks/{chunk-2HCMRGMO.js → chunk-VC6EXDGY.js} +2 -2
- package/dist/cli/chunks/{chunk-5FAWIIWF.js → chunk-VHYMSZNF.js} +2 -2
- package/dist/cli/chunks/{chunk-ZTKCGEB6.js → chunk-VLBV2VL3.js} +1 -1
- package/dist/cli/chunks/{chunk-6E47R27C.js → chunk-VLNPJAVH.js} +1 -1
- package/dist/cli/chunks/{chunk-EH7TSJPS.js → chunk-VSNRPMAZ.js} +2 -2
- package/dist/cli/chunks/{chunk-FJACKKRL.js → chunk-W5YEIHIO.js} +2 -2
- package/dist/cli/chunks/{chunk-4HP7N6SP.js → chunk-WRYT4HTZ.js} +2 -2
- package/dist/cli/chunks/{chunk-ZFLE4D4X.js → chunk-XFCWYQHW.js} +2 -2
- package/dist/cli/chunks/{chunk-72QQDR3Y.js → chunk-XKFE3FLI.js} +2 -2
- package/dist/cli/chunks/{chunk-KXKACV3E.js → chunk-YFGAHNCG.js} +2 -2
- package/dist/cli/chunks/{chunk-S47YGWXK.js → chunk-YPTGE5NJ.js} +2 -2
- package/dist/cli/chunks/{chunk-PEHEANAM.js → chunk-YRQLVGCI.js} +2 -2
- package/dist/cli/chunks/{chunk-L6GZGEFQ.js → chunk-Z6QCOZ2H.js} +2 -2
- package/dist/cli/chunks/{chunk-GGTCD4MA.js → chunk-ZCFZ4USU.js} +1 -1
- package/dist/cli/chunks/{chunk-MZ7SIO6R.js → chunk-ZEIG5IQ4.js} +2 -2
- package/dist/cli/chunks/{chunk-XBOCRCC6.js → chunk-ZJG6N2OK.js} +1 -1
- package/dist/cli/chunks/{chunk-M32DTUZM.js → chunk-ZJIX5FGQ.js} +3 -3
- package/dist/cli/chunks/{chunk-ADQFQBFJ.js → chunk-ZLXBNNNT.js} +2 -2
- package/dist/cli/chunks/{chunk-BEPP57C2.js → chunk-ZOXWASCC.js} +2 -2
- package/dist/cli/chunks/{ci-MMLUV6L6.js → ci-74ZUCO5V.js} +2 -2
- package/dist/cli/chunks/{ci-output-25GS6RXR.js → ci-output-HD6IZNJA.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-4OWAN6R6.js → circuit-breaker-USZVMA42.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-LR3SRBX6.js → claude-flow-setup-S4XKNCD5.js} +2 -2
- package/dist/cli/chunks/client-33PGO5FA.js +2 -0
- package/dist/cli/chunks/{cline-installer-YSZWRZUI.js → cline-installer-6EW4CHAR.js} +2 -2
- package/dist/cli/chunks/{code-UUWUIXI7.js → code-TOLWD2XL.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-2LSPQORU.js → code-index-extractor-UA4QQ7B3.js} +2 -2
- package/dist/cli/chunks/{codex-installer-E5BVXZVA.js → codex-installer-C2CUP4FW.js} +2 -2
- package/dist/cli/chunks/{completions-YKXBKZSO.js → completions-KVUMQQ4K.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-HNT2QRWB.js → complexity-analyzer-DFH6LMK2.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-AW5VCB66.js → continuedev-installer-LYDQSAU7.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-B6SVZXQT.js → copilot-installer-7USXLZHZ.js} +2 -2
- package/dist/cli/chunks/core-handlers-CSNZIM3A.js +2 -0
- package/dist/cli/chunks/{cost-tracker-POZMBN2V.js → cost-tracker-JBDIUMKZ.js} +2 -2
- package/dist/cli/chunks/{coverage-V5BGPN5Q.js → coverage-RGO3K357.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-DRIBR5L3.js +2 -0
- package/dist/cli/chunks/{cursor-installer-EYBI4QVK.js → cursor-installer-YEZGD37F.js} +2 -2
- package/dist/cli/chunks/{daemon-CF6ENQB2.js → daemon-FVETQ3LL.js} +3 -3
- package/dist/cli/chunks/{daemon-HKARXY2W.js → daemon-LPEXHNYG.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-XIL5IAP7.js → dag-attention-scheduler-UKYE2FII.js} +2 -2
- package/dist/cli/chunks/{detect-RRX2U2KK.js → detect-WBG5P7ER.js} +2 -2
- package/dist/cli/chunks/{dist-node-DOANNRCS.js → dist-node-YW6YRBCU.js} +2 -2
- package/dist/cli/chunks/{domain-handler-QMTJV5OR.js → domain-handler-HH7J4A32.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-FSNH75XW.js → domain-transfer-V34GXD5I.js} +2 -2
- package/dist/cli/chunks/dream-WUNO723O.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-NI7PGONV.js → embed-and-insert-pattern-WYLRS3CL.js} +2 -2
- package/dist/cli/chunks/{eval-6ZAF2RY3.js → eval-EIMVXY5J.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-JMXR7N5G.js → experience-capture-middleware-QMZHRUKM.js} +3 -3
- package/dist/cli/chunks/{fast-paths-YB7XZZ76.js → fast-paths-NHLW6XS6.js} +2 -2
- package/dist/cli/chunks/{feature-flags-KJSP7KR6.js → feature-flags-N3UHMSZ3.js} +2 -2
- package/dist/cli/chunks/{feature-flags-2RC4GFC4.js → feature-flags-NE3MBL3P.js} +2 -2
- package/dist/cli/chunks/{file-discovery-SUPBXFYI.js → file-discovery-SI44X4YS.js} +2 -2
- package/dist/cli/chunks/{fleet-KSXFOLFW.js → fleet-MMYUXRRM.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-DFZ5KPPK.js → gnn-wrapper-RLYXYU2Q.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-G3EADK2H.js → heartbeat-handler-6EDRUYLV.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-VAFQDJLL.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-TIRPA7XE.js +2 -0
- package/dist/cli/chunks/hnsw-index-SSQBRQCQ.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-MA676GER.js → hnsw-legacy-bridge-RVM7EAIH.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-FE55OGYB.js → hnswlib-node-RJPBJU2Q.js} +2 -2
- package/dist/cli/chunks/{hooks-HTCPMZNZ.js → hooks-ZF4VKHEO.js} +10 -10
- package/dist/cli/chunks/hybrid-router-AKBWZOQ3.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-QPB3IH4A.js → hypergraph-engine-YWS66PGO.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-GBFSVD7N.js → hypergraph-handler-OQHVRPWB.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-46FQIZ6Y.js +2 -0
- package/dist/cli/chunks/{init-handler-XYBTBCPD.js → init-handler-YW74YF2V.js} +6 -6
- package/dist/cli/chunks/init-wizard-U3NHGYSS.js +2 -0
- package/dist/cli/chunks/kernel-ZDXHT6QF.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-LY6JOBFY.js → kilocode-installer-APWB2GMA.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-JF6NXTJL.js → kiro-installer-DICKFVNC.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-6XTW6WO6.js +2 -0
- package/dist/cli/chunks/{learning-BIISN67N.js → learning-MXHNYW5D.js} +3 -3
- package/dist/cli/chunks/{llm-router-YZUNVZQE.js → llm-router-LTFIX7NY.js} +5 -5
- package/dist/cli/chunks/llm-router-service-3F4E64SY.js +2 -0
- package/dist/cli/chunks/{load-MTWNBNLL.js → load-JUMIQ4LZ.js} +2 -2
- package/dist/cli/chunks/load-test-SWZNGEIY.js +2 -0
- package/dist/cli/chunks/{mcp-37PYMNHQ.js → mcp-WHIARJGO.js} +2 -2
- package/dist/cli/chunks/{memory-IXUUDCI3.js → memory-KAHS6Z5A.js} +5 -5
- package/dist/cli/chunks/memory-backend-PR74ZPBA.js +2 -0
- package/dist/cli/chunks/{memory-handlers-RM2VOFJX.js → memory-handlers-DG3RRXB6.js} +2 -2
- package/dist/cli/chunks/{multi-model-executor-RKKS5XYG.js → multi-model-executor-E3Y2RHMX.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-3VXI5MTR.js → opencode-installer-3RKGNGGE.js} +2 -2
- package/dist/cli/chunks/{orchestrator-UO3ZOGFZ.js → orchestrator-TXITUKWD.js} +5 -5
- package/dist/cli/chunks/pattern-null-store-EPE36BVT.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-YJKRL2GI.js → pattern-usage-recorder-EE2BUFZT.js} +2 -2
- package/dist/cli/chunks/{pipeline-GJQJKXWX.js → pipeline-AXTT6KZB.js} +2 -2
- package/dist/cli/chunks/{platform-RHVCZK6C.js → platform-TICPVKE2.js} +2 -2
- package/dist/cli/chunks/{plugin-ZKAIW7O6.js → plugin-VQKNV3EM.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-4X3DSKQV.js → prime-radiant-advanced-wasm-6GY5YY7D.js} +2 -2
- package/dist/cli/chunks/protocol-executor-IELENNST.js +2 -0
- package/dist/cli/chunks/{protocol-handler-KKYQZMB2.js → protocol-handler-YFWDR7UZ.js} +2 -2
- package/dist/cli/chunks/{prove-OD6RPKWX.js → prove-FUMRCXAA.js} +2 -2
- package/dist/cli/chunks/provider-manager-3R3KOBHG.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-S2R2PCBS.js +2 -0
- package/dist/cli/chunks/{quality-ZRWBXCKO.js → quality-2APISBW5.js} +2 -2
- package/dist/cli/chunks/{quality-gate-Y6BWQV7J.js → quality-gate-MCC3E5TM.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-2E23NEV4.js +2 -0
- package/dist/cli/chunks/{real-embeddings-YYEUO4P2.js → real-embeddings-CC5TNOTI.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-JBCPS3FK.js → roocode-installer-YAHTEVPI.js} +2 -2
- package/dist/cli/chunks/router-3FVLWO6S.js +2 -0
- package/dist/cli/chunks/routing-feedback-ZQLRNNR7.js +2 -0
- package/dist/cli/chunks/{routing-handler-KTPJOSBJ.js → routing-handler-6NQBW4TQ.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-SCZZVRE7.js → ruvector-commands-ZHXLHUPG.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-IP7GELQJ.js → rvf-dual-writer-5KF2DGCW.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-WLFTDARU.js → rvf-migration-adapter-BBU57BGF.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-MGFDQ5WD.js → rvf-migration-coordinator-VN4VRZA4.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-YFGLQNEB.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-OTOAGT5W.js → rvf-store-integrity-XCY2XQZA.js} +2 -2
- package/dist/cli/chunks/safe-db-4SBLBTW7.js +2 -0
- package/dist/cli/chunks/schedule-5Y3BGVAA.js +2 -0
- package/dist/cli/chunks/scheduler-DOID3QF3.js +2 -0
- package/dist/cli/chunks/{security-B2CLZKRB.js → security-PYP4H3KN.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-2PMFAQMN.js → shared-rvf-adapter-3CJHRNX6.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-B6P732AV.js → shared-rvf-dual-writer-MKSLKWDI.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-M4JEQO57.js +2 -0
- package/dist/cli/chunks/{status-handler-M6SN2W2D.js → status-handler-VYIZ3VJF.js} +2 -2
- package/dist/cli/chunks/{structural-health-YCCTGI3K.js → structural-health-MVV4OWXP.js} +2 -2
- package/dist/cli/chunks/{sync-KSRF77ID.js → sync-G47OYIQ3.js} +2 -2
- package/dist/cli/chunks/sync-VNX6L3TI.js +2 -0
- package/dist/cli/chunks/{task-handler-MIKRB2SL.js → task-handler-GOWF2GEH.js} +2 -2
- package/dist/cli/chunks/{task-handlers-YXKRUBQ4.js → task-handlers-J2WC6J37.js} +3 -3
- package/dist/cli/chunks/{test-MLOLQCB7.js → test-DMCJ3BXS.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-3KXESUZS.js → test-scheduling-TRFHHKFM.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-6V2PMDBJ.js → token-bootstrap-KEQ7AHFF.js} +2 -2
- package/dist/cli/chunks/{token-usage-DP6THJ3I.js → token-usage-B54FOFOF.js} +2 -2
- package/dist/cli/chunks/transformers-IACZG7IV.js +2 -0
- package/dist/cli/chunks/{tree-sitter-wasm-parser-COK2XERS.js → tree-sitter-wasm-parser-N7H4X37E.js} +2 -2
- package/dist/cli/chunks/{types-PYHUCVOZ.js → types-B3SHT4OD.js} +2 -2
- package/dist/cli/chunks/unified-memory-WNYWTGVX.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-YPAV7U4E.js +2 -0
- package/dist/cli/chunks/unified-persistence-TJ252S7L.js +2 -0
- package/dist/cli/chunks/{upgrade-ONP2HNGL.js → upgrade-A2PQ5EWK.js} +2 -2
- package/dist/cli/chunks/{validate-NWSICDAY.js → validate-UXV7UQUT.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-KXS5P3U7.js → validate-swarm-MMBU4FPP.js} +2 -2
- package/dist/cli/chunks/{vibium-TZSGZRCQ.js → vibium-R4GUVADA.js} +2 -2
- package/dist/cli/chunks/visual-security-VKYXEGJB.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-V2FADNRA.js → web-tree-sitter-MP6E6CJB.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-GQM7KWDC.js → windsurf-installer-Z6BWMUUO.js} +2 -2
- package/dist/cli/chunks/{witness-chain-GTITDIA2.js → witness-chain-EFLTABBA.js} +2 -2
- package/dist/cli/chunks/witness-chain-WVXRXKQP.js +2 -0
- package/dist/cli/chunks/{witness-key-manager-AHRM2M52.js → witness-key-manager-PN36TV43.js} +2 -2
- package/dist/cli/chunks/{workflow-XCGHEL3I.js → workflow-A2AX3RJU.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-GOWSPR3G.js +2 -0
- package/dist/cli/chunks/{wrappers-VGO2GO4J.js → wrappers-NA6FHA63.js} +2 -2
- package/dist/cli/commands/llm-router.js +1 -0
- package/dist/init/skills-installer.js +1 -0
- package/dist/integrations/embeddings/base/EmbeddingGenerator.js +13 -1
- package/dist/kernel/unified-memory.js +4 -0
- package/dist/learning/qe-flywheel/corpus-scorer.js +10 -7
- package/dist/learning/qe-flywheel/generation.d.ts +7 -0
- package/dist/learning/qe-flywheel/generation.js +5 -0
- package/dist/learning/qe-flywheel/witness-verify.d.ts +86 -0
- package/dist/learning/qe-flywheel/witness-verify.js +156 -0
- package/dist/mcp/bundle.js +397 -386
- package/dist/shared/db-recovery.d.ts +55 -0
- package/dist/shared/db-recovery.js +184 -0
- package/dist/shared/llm/billing-modes.js +5 -2
- package/dist/shared/llm/cost-tracker.js +1 -0
- package/dist/shared/llm/interfaces.d.ts +14 -1
- package/dist/shared/llm/provider-manager.d.ts +1 -1
- package/dist/shared/llm/provider-manager.js +7 -3
- package/dist/shared/llm/providers/claude-code.js +12 -3
- package/dist/shared/llm/providers/codex.d.ts +58 -0
- package/dist/shared/llm/providers/codex.js +305 -0
- package/dist/shared/llm/providers/index.d.ts +1 -0
- package/dist/shared/llm/providers/index.js +1 -0
- package/dist/shared/llm/router/config-store.js +5 -0
- package/dist/shared/llm/router/hybrid-router.js +2 -2
- package/dist/shared/llm/spend-ledger.d.ts +24 -0
- package/dist/shared/llm/spend-ledger.js +86 -15
- package/dist/shared/llm/translation/message-formatter.js +1 -0
- package/dist/shared/safe-db.d.ts +10 -0
- package/dist/shared/safe-db.js +17 -0
- package/dist/skills/qe-court/referee.d.ts +62 -0
- package/dist/skills/qe-court/referee.js +78 -0
- package/dist/validation/gate-reexecute.d.ts +9 -0
- package/dist/validation/gate-reexecute.js +61 -0
- package/dist/validation/paired-bootstrap.d.ts +36 -0
- package/dist/validation/paired-bootstrap.js +58 -0
- package/package.json +7 -3
- package/dist/cli/chunks/adapter-D657MKZY.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-AFR6OZJK.js +0 -2
- package/dist/cli/chunks/base-K5QRGZWE.js +0 -2
- package/dist/cli/chunks/browser-workflow-ZMMKCGYW.js +0 -2
- package/dist/cli/chunks/chunk-6SQ72FG7.js +0 -2
- package/dist/cli/chunks/chunk-FHHCH7WL.js +0 -2
- package/dist/cli/chunks/chunk-G5OGKVLO.js +0 -2
- package/dist/cli/chunks/chunk-ILRKO6A5.js +0 -43
- package/dist/cli/chunks/chunk-NX522PRH.js +0 -153
- package/dist/cli/chunks/chunk-PPUDKQ4X.js +0 -29
- package/dist/cli/chunks/chunk-ULQCEM7K.js +0 -2
- package/dist/cli/chunks/client-WI7RRUZO.js +0 -2
- package/dist/cli/chunks/core-handlers-T6URR57V.js +0 -2
- package/dist/cli/chunks/cross-domain-router-WHTTKHWM.js +0 -2
- package/dist/cli/chunks/dream-QUL6SURC.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-VZNKE33K.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-LGWLDZLC.js +0 -2
- package/dist/cli/chunks/hnsw-index-66FOOI7U.js +0 -2
- package/dist/cli/chunks/hybrid-router-I5MEVQDF.js +0 -2
- package/dist/cli/chunks/impact-analyzer-K6ANYIY3.js +0 -2
- package/dist/cli/chunks/init-wizard-URHGXJ32.js +0 -2
- package/dist/cli/chunks/kernel-OKI5ZY5P.js +0 -2
- package/dist/cli/chunks/knowledge-graph-VQQSK7T5.js +0 -2
- package/dist/cli/chunks/llm-router-service-TISH33SY.js +0 -2
- package/dist/cli/chunks/load-test-KWKWC4Q7.js +0 -2
- package/dist/cli/chunks/memory-backend-JSQQMXVS.js +0 -2
- package/dist/cli/chunks/pattern-null-store-SXBIUKE5.js +0 -2
- package/dist/cli/chunks/protocol-executor-D3Q5P3WY.js +0 -2
- package/dist/cli/chunks/provider-manager-2EIX7E5Q.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-ITOW2ZHC.js +0 -2
- package/dist/cli/chunks/queen-coordinator-TO5X2EXL.js +0 -2
- package/dist/cli/chunks/router-GZJQEJU3.js +0 -2
- package/dist/cli/chunks/routing-feedback-CRXSKFNS.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-WHADT5HX.js +0 -2
- package/dist/cli/chunks/safe-db-MIZ2OFWC.js +0 -2
- package/dist/cli/chunks/schedule-XFILYTYC.js +0 -2
- package/dist/cli/chunks/scheduler-EIPJ777A.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-PFU3GSRD.js +0 -2
- package/dist/cli/chunks/sync-3SDMVAIU.js +0 -2
- package/dist/cli/chunks/transformers-QFOBOP2Y.js +0 -2
- package/dist/cli/chunks/unified-memory-OUVCMFGK.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-YGQPOHXB.js +0 -2
- package/dist/cli/chunks/unified-persistence-GFRZVDOW.js +0 -2
- package/dist/cli/chunks/visual-security-LVOOYQ64.js +0 -2
- package/dist/cli/chunks/witness-chain-QNFPV4UL.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-MIVBCALG.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{a as x}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{a as x}from"./chunk-HVB2L52I.js";import{c as f}from"./chunk-OXXMVQDF.js";import"./chunk-ES7WCYOU.js";x();import{createRequire as w}from"module";var S=f.create("agent-booster-wasm"),t={JavaScript:0,TypeScript:1,Python:2,Rust:3,Go:4,Java:5,C:6,Cpp:7},l={ExactReplace:0,FuzzyReplace:1,InsertAfter:2,InsertBefore:3,Append:4},v={0:"JavaScript",1:"TypeScript",2:"Python",3:"Rust",4:"Go",5:"Java",6:"C",7:"Cpp"},a=null,u=null,p=null;async function g(){if(a)return!0;if(p)return!1;try{if(a=w(import.meta.url)("./agent_booster_wasm.js"),!a)throw new Error("WASM module loaded but is null");return u=new a.AgentBoosterWasm,!0}catch(e){return p=e,console.warn("[AgentBoosterWASM] Failed to load WASM module:",e),!1}}function A(e){return{".js":t.JavaScript,".mjs":t.JavaScript,".cjs":t.JavaScript,".jsx":t.JavaScript,".ts":t.TypeScript,".tsx":t.TypeScript,".mts":t.TypeScript,".cts":t.TypeScript,".py":t.Python,".rs":t.Rust,".go":t.Go,".java":t.Java,".c":t.C,".h":t.C,".cpp":t.Cpp,".cc":t.Cpp,".cxx":t.Cpp,".hpp":t.Cpp}[e.toLowerCase()]??t.JavaScript}var M=[{name:"var-to-const",detect:(e,r)=>e.includes("var ")&&r.includes("const "),apply:(e,r)=>e.replace(/\bvar\s+/g,"const ")},{name:"var-to-let",detect:(e,r)=>e.includes("var ")&&r.includes("let "),apply:(e,r)=>e.replace(/\bvar\s+/g,"let ")},{name:"add-types-function",detect:(e,r)=>e.includes("function")&&!e.includes(":")&&r.includes(":"),apply:(e,r)=>r},{name:"async-wrapper",detect:(e,r)=>!e.includes("async")&&r.includes("async")&&r.includes("await"),apply:(e,r)=>r},{name:"try-catch-wrapper",detect:(e,r)=>!e.includes("try {")&&r.includes("try {"),apply:(e,r)=>r},{name:"null-check",detect:(e,r)=>!e.includes("if (!")&&!e.includes("if (!")&&(r.includes("if (!")||r.includes("?.")),apply:(e,r)=>r},{name:"test-assertion",detect:(e,r)=>e.includes("test(")&&!e.includes("expect(")&&r.includes("expect("),apply:(e,r)=>r}];function y(e,r){for(let n of M)if(n.detect(e,r))try{return{success:!0,code:n.apply(e,r),pattern:n.name}}catch(s){S.debug("Pattern transform failed, trying next",{pattern:n.name,error:s instanceof Error?s.message:String(s)});continue}return{success:!1,code:r}}async function b(e,r,n,s={}){let o=performance.now(),{confidenceThreshold:T=.5,allowFallback:d=!0}=s;if(!e.trim())return{success:!0,mergedCode:r,confidence:1,strategy:l.Append,syntaxValid:!0,source:"fallback",latencyMs:performance.now()-o};if(await g()&&u&&a)try{let c=a.WasmLanguage[v[n]],i=u.apply_edit(e,r,c);return{success:!0,mergedCode:i.merged_code,confidence:i.confidence,strategy:i.strategy,syntaxValid:i.syntax_valid,source:"wasm",latencyMs:performance.now()-o}}catch(c){let i=c;if(d){let m=y(e,r);if(m.success)return{success:!0,mergedCode:m.code,confidence:.7,strategy:l.FuzzyReplace,syntaxValid:!0,source:"pattern",latencyMs:performance.now()-o}}return{success:!1,mergedCode:r,confidence:0,strategy:l.Append,syntaxValid:!1,source:"fallback",latencyMs:performance.now()-o,error:i.message}}if(d){let c=y(e,r);return{success:c.success,mergedCode:c.code,confidence:c.success?.7:0,strategy:l.FuzzyReplace,syntaxValid:!0,source:"pattern",latencyMs:performance.now()-o}}return{success:!1,mergedCode:r,confidence:0,strategy:l.Append,syntaxValid:!1,source:"fallback",latencyMs:performance.now()-o,error:p?.message??"WASM not available"}}async function W(e,r={}){return Promise.all(e.map(({original:n,edit:s,language:o})=>b(n,s,o,r)))}async function C(){return g()}async function L(){return await g()&&a?a.AgentBoosterWasm.version():"unavailable"}async function R(){if(await g(),u&&a)try{u.apply_edit("function x() {}","function x() {}",a.WasmLanguage.JavaScript)}catch(e){console.debug("[AgentBoosterWASM] Warmup error:",e instanceof Error?e.message:e)}}var _={transform:b,batchTransform:W,isWasmAvailable:C,getVersion:L,warmup:R,Language:t,MergeStrategy:l,languageFromExtension:A};export{t as Language,l as MergeStrategy,W as batchTransform,_ as default,L as getVersion,C as isWasmAvailable,A as languageFromExtension,b as transform,R as warmup};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{b as p}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{b as p}from"./chunk-3UHEZ5HZ.js";import{a as g}from"./chunk-7DMXCCSD.js";import"./chunk-2DIT5AUU.js";import"./chunk-ES7WCYOU.js";import s from"chalk";var l=class{name="agent";description="Manage QE agents";cleanupAndExit;ensureInitialized;constructor(n,t){this.cleanupAndExit=n,this.ensureInitialized=t}register(n,t){let a=n.command("agent").description(this.description);a.command("list").description("List all agents").option("-d, --domain <domain>","Filter by domain").option("-s, --status <status>","Filter by status").action(async e=>{await this.executeList(e,t)}),a.command("spawn <domain>").description("Spawn an agent in a domain").option("-t, --type <type>","Agent type","worker").option("-c, --capabilities <caps>","Comma-separated capabilities","general").option("--no-progress","Disable progress indicator").action(async(e,o)=>{await this.executeSpawn(e,o,t)})}async executeList(n,t){if(await this.ensureInitialized())try{let a=n.domain?t.queen.getAgentsByDomain(n.domain):t.queen.listAllAgents();if(n.status&&(a=a.filter(e=>e.status===n.status)),console.log(s.blue(`
|
|
3
3
|
Agents (${a.length})
|
|
4
4
|
`)),a.length===0)console.log(s.gray(" No agents found"));else{let e=new Map;for(let i of a)e.has(i.domain)||e.set(i.domain,[]),e.get(i.domain).push(i);let o=Array.from(e.entries());for(let[i,m]of o){console.log(s.cyan(` ${i}:`));for(let r of m)console.log(` ${r.id}`),console.log(` Type: ${r.type}`),console.log(` Status: ${g(r.status)}`),r.startedAt&&console.log(s.gray(` Started: ${r.startedAt.toISOString()}`));console.log("")}}}catch(a){console.error(s.red(`
|
|
5
5
|
Failed to list agents:`),a),await this.cleanupAndExit(1)}}async executeSpawn(n,t,a){if(await this.ensureInitialized())try{let e=t.capabilities.split(",");console.log(s.blue(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import"./chunk-ES7WCYOU.js";import{existsSync as i,mkdirSync as d,unlinkSync as s,readdirSync as p,statSync as f}from"fs";import{join as o,basename as l}from"path";var v={branchDir:".agentic-qe/branches",defaultStrategy:"child-wins",orphanMaxAgeMs:36e5},g=class{config;parentAdapter;activeBranches=new Map;witnessChain=null;constructor(t,e){this.parentAdapter=t,this.config={...v,...e}}setWitnessChain(t){this.witnessChain=t}createBranch(t){if(this.activeBranches.has(t))throw new Error(`Branch already exists for agent ${t}`);i(this.config.branchDir)||d(this.config.branchDir,{recursive:!0});let e=o(this.config.branchDir,`${t}.rvf`),r=this.parentAdapter.path(),n=this.parentAdapter.derive(e),a={agentId:t,childPath:e,parentPath:r,childAdapter:n,createdAt:Date.now(),ingestLog:[]};return this.activeBranches.set(t,a),a}recordIngest(t,e){let r=this.activeBranches.get(t);if(r)for(let n of e)r.ingestLog.push({id:n.id,vector:n.vector})}async mergeBranch(t,e){let r=e??this.config.defaultStrategy,n=performance.now(),a=0;if(r==="child-wins"&&t.ingestLog.length>0)try{a=this.parentAdapter.ingest(t.ingestLog).accepted}catch(c){console.warn(`[AgentMemoryBranch] Merge replay failed for ${t.agentId}:`,c)}return this.witnessChain?.append("BRANCH_MERGE",{agentId:t.agentId,strategy:r,vectorsMerged:a,branchPath:t.childPath},`agent-${t.agentId}`),this.cleanupBranchFile(t),this.activeBranches.delete(t.agentId),{vectorsMerged:a,strategy:r,durationMs:performance.now()-n}}discardBranch(t){this.witnessChain?.append("BRANCH_DISCARD",{agentId:t.agentId,action:"discard",branchPath:t.childPath},`agent-${t.agentId}`),this.cleanupBranchFile(t),this.activeBranches.delete(t.agentId)}getBranch(t){return this.activeBranches.get(t)}getActiveBranches(){return Array.from(this.activeBranches.values())}listBranchFiles(){return i(this.config.branchDir)?p(this.config.branchDir).filter(e=>e.endsWith(".rvf")).map(e=>{let r=o(this.config.branchDir,e),n=f(r);return{agentId:l(e,".rvf"),path:r,sizeBytes:n.size,modifiedAt:n.mtime}}):[]}cleanupOrphans(t){let e=t??this.config.orphanMaxAgeMs,r=Date.now(),n=0;for(let a of this.listBranchFiles())if(r-a.modifiedAt.getTime()>e&&!this.activeBranches.has(a.agentId))try{s(a.path);let h=`${a.path}.idmap.json`;i(h)&&s(h),n++}catch{}return n}cleanupBranchFile(t){try{t.childAdapter.close()}catch{}try{i(t.childPath)&&s(t.childPath);let e=`${t.childPath}.idmap.json`;i(e)&&s(e)}catch{}}};export{g as AgentMemoryBranch};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{a,b,c,d,e,f}from"./chunk-GJMZR7WU.js";import"./chunk-5FLTZ3KT.js";import"./chunk-ANIDFJCT.js";import"./chunk-SRQ3CPJE.js";import"./chunk-GUEZQOHL.js";import"./chunk-3JVUWKCO.js";import"./chunk-ZCFZ4USU.js";import"./chunk-VLNPJAVH.js";import"./chunk-Q7PBGNUD.js";import"./chunk-FAQLI3P5.js";import"./chunk-3NOCK6ED.js";import"./chunk-A4QLGPYO.js";import"./chunk-FUU32QY5.js";import"./chunk-SHCTEXNH.js";import"./chunk-N7VOOI3U.js";import"./chunk-BCKTBGDM.js";import"./chunk-G5DFYX3J.js";import"./chunk-W5YEIHIO.js";import"./chunk-BUGWPTMF.js";import"./chunk-HVB2L52I.js";import"./chunk-OXXMVQDF.js";import"./chunk-NUQBJGGF.js";import"./chunk-2DIT5AUU.js";import"./chunk-LXPB7H2P.js";import"./chunk-KUA4HHU6.js";import"./chunk-G7FMYFTN.js";import"./chunk-QI4CGJNK.js";import"./chunk-CYL2FV23.js";import"./chunk-E3B5XTXJ.js";import"./chunk-SNTUKW4Q.js";import"./chunk-TVMFH5N2.js";import"./chunk-THBTN7XB.js";import"./chunk-RDU4WTV2.js";import"./chunk-LBE2P6UC.js";import"./chunk-IZRLIWFN.js";import"./chunk-AO7AHX6K.js";import"./chunk-YRQLVGCI.js";import"./chunk-3GSYD5SL.js";import"./chunk-ES7WCYOU.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,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{a as c,c as f}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{a as c,c as f}from"./chunk-CYL2FV23.js";import"./chunk-ES7WCYOU.js";f();import{Command as $}from"commander";import r from"chalk";function x(v,g,p){let m=new $("arena").description("Competitive test-strategy tournaments (ADR-104)").addHelpText("after",`
|
|
3
3
|
Examples:
|
|
4
4
|
# Run a 4-strategy tournament against the demo fixture (reproducible under --seed)
|
|
5
5
|
aqe arena run --strategies 4 --target fixtures/arena-demo --seed 42
|
|
@@ -9,10 +9,10 @@ Examples:
|
|
|
9
9
|
|
|
10
10
|
# List persisted runs
|
|
11
11
|
aqe arena list
|
|
12
|
-
`);return m.command("run").description("Run a seeded strategy tournament against an arena fixture").requiredOption("--target <dir>","Arena fixture directory (src/*.mjs + tests/*.test.mjs)").option("--strategies <n>","Number of strategies","4").option("--seed <n>","RNG seed (same seed = same tournament)","42").option("--max-mutants <n>","Mutant sample cap","24").option("--evolve <steps>","Hill-climb steps from the winner","0").option("--json","Output the full arena-result@1 envelope as JSON").action(async a=>{try{let{runArena:i}=await import("./arena-
|
|
12
|
+
`);return m.command("run").description("Run a seeded strategy tournament against an arena fixture").requiredOption("--target <dir>","Arena fixture directory (src/*.mjs + tests/*.test.mjs)").option("--strategies <n>","Number of strategies","4").option("--seed <n>","RNG seed (same seed = same tournament)","42").option("--max-mutants <n>","Mutant sample cap","24").option("--evolve <steps>","Hill-climb steps from the winner","0").option("--json","Output the full arena-result@1 envelope as JSON").action(async a=>{try{let{runArena:i}=await import("./arena-SDB7723R.js"),t=i({target:a.target,strategies:parseInt(a.strategies,10),seed:parseInt(a.seed,10),maxMutants:parseInt(a.maxMutants,10),evolveSteps:parseInt(a.evolve,10),log:a.json?()=>{}:e=>console.error(r.dim(` ${e}`))});try{let{getUnifiedMemory:e}=await import("./unified-memory-WNYWTGVX.js"),s=e();s.isInitialized()||await s.initialize(),s.getDatabase().prepare("INSERT OR REPLACE INTO kv_store (namespace, key, value) VALUES ('arena', ?, ?)").run(`run:${t.seed}:${t.target}`,JSON.stringify(t))}catch(e){console.error(r.dim(` note: run not persisted (${c(e)})`))}if(a.json){console.log(JSON.stringify(t,null,2));return}let d=new Map(t.strategies.map(e=>[e.id,e]));console.log(r.blue(`
|
|
13
13
|
Arena: ${t.target} \xB7 seed ${t.seed} \xB7 ${t.mutantsTotal} mutants
|
|
14
14
|
`)),console.log(" rank id kill-rate coverage cost fitness groups"),t.ranking.forEach((e,s)=>{let n=d.get(e),u=n.coveragePct===null?" n/a":`${n.coveragePct.toFixed(2)}%`.padStart(7);console.log(` ${String(s+1).padEnd(5)}${n.id.padEnd(5)}${(n.killRate*100).toFixed(1).padStart(6)}% ${u} ${n.suiteCostRatio.toFixed(2).padEnd(6)}${n.fitness.toFixed(4).padEnd(9)}${n.name}`+(n.baselinePassed?"":r.red(" [baseline FAILED]")))}),console.log(`
|
|
15
15
|
competitive array (row beats column = 1):`);let o=t.strategies.map(e=>e.id);if(console.log(` ${o.map(e=>e.padEnd(4)).join("")}`),t.competitiveArray.forEach((e,s)=>{console.log(` ${o[s].padEnd(4)}${e.map(n=>String(n).padStart(2).padEnd(4)).join("")}`)}),t.evolution.length>0){console.log(`
|
|
16
16
|
evolution:`);for(let e of t.evolution)console.log(` step ${e.step}: [${e.groups.join("+")}] fitness ${e.fitness.toFixed(4)} ${e.accepted?r.green("accepted"):"rejected"}`)}let l=d.get(t.ranking[0]);console.log(r.green(`
|
|
17
17
|
winner: ${l.id} [${l.name}] \u2014 kill ${(l.killRate*100).toFixed(1)}%, fitness ${l.fitness.toFixed(4)}
|
|
18
|
-
`))}catch(i){console.error(r.red(` \u2717 ${c(i)}`)),await g(1)}}),m.command("list").description("List persisted arena runs").option("--json","Output as JSON").action(async a=>{if(await p())try{let{getUnifiedMemory:i}=await import("./unified-memory-
|
|
18
|
+
`))}catch(i){console.error(r.red(` \u2717 ${c(i)}`)),await g(1)}}),m.command("list").description("List persisted arena runs").option("--json","Output as JSON").action(async a=>{if(await p())try{let{getUnifiedMemory:i}=await import("./unified-memory-WNYWTGVX.js"),t=i();t.isInitialized()||await t.initialize();let d=t.getDatabase().prepare("SELECT key, value FROM kv_store WHERE namespace = 'arena' ORDER BY key").all();if(a.json){console.log(JSON.stringify(d.map(o=>({key:o.key,result:JSON.parse(o.value)})),null,2));return}if(d.length===0){console.log(r.yellow(" no persisted arena runs"));return}for(let o of d){let l=JSON.parse(o.value),e=l.strategies.find(s=>s.id===l.ranking[0]);console.log(` ${r.green(o.key)} \u2014 winner ${e?.id} [${e?.name}] fitness ${e?.fitness}`)}}catch(i){console.error(r.red(` \u2717 ${c(i)}`)),await g(1)}}),m}export{x as createArenaCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import"./chunk-ES7WCYOU.js";import*as K from"fs";import*as M from"path";function G(t){let r=t>>>0;return function(){r|=0,r=r+1831565813|0;let n=Math.imul(r^r>>>15,1|r);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function w(t,r){return Math.floor(t()*r)}var z=[["===","!=="],["!==","==="],["<=","<"],[">=",">"],["&&","||"],["||","&&"],["<","<="],[">",">="],["+","-"],["*","+"]];function H(t){let r=new Array(t.length).fill(!1),n=0,e="code";for(;n<t.length;){let s=t[n],i=t[n+1];e==="code"?(s==="'"?e="single":s==='"'?e="double":s==="`"?e="template":s==="/"&&i==="/"?e="line-comment":s==="/"&&i==="*"&&(e="block-comment"),e!=="code"&&(r[n]=!0)):(r[n]=!0,e==="single"&&s==="'"&&t[n-1]!=="\\"||e==="double"&&s==='"'&&t[n-1]!=="\\"||e==="template"&&s==="`"&&t[n-1]!=="\\"||e==="line-comment"&&s===`
|
|
3
3
|
`?e="code":e==="block-comment"&&s==="*"&&i==="/"&&(r[n+1]=!0,n++,e="code")),n++}return r}function E(t,r){let n=1;for(let e=0;e<r;e++)t[e]===`
|
|
4
4
|
`&&n++;return n}function A(t,r){let n=H(t),e=new Array(t.length).fill(!1),s=[];for(let[i,c]of z){let a=t.indexOf(i);for(;a!==-1;){let u=a+i.length,y=e.slice(a,u).some(Boolean),h=n.slice(a,u).some(Boolean),v=i===">"&&t[a-1]==="=",S=(i==="<"||i===">")&&(t[u]==="="||t[a-1]==="<"||t[a-1]===">");if(!y&&!h&&!v&&!S){for(let d=a;d<u;d++)e[d]=!0;s.push({id:`${r}:${E(t,a)}:${a}:${i}->${c}`,index:a,from:i,to:c,line:E(t,a)})}a=t.indexOf(i,a+1)}}return s.sort((i,c)=>i.index-c.index)}function W(t,r){return t.slice(0,r.index)+r.to+t.slice(r.index+r.from.length)}import*as m from"fs";import*as f from"path";import*as L from"os";import{spawnSync as J}from"child_process";function I(t){let r=f.resolve(t),n=f.join(r,"src"),e=f.join(r,"tests");if(!m.existsSync(n)||!m.existsSync(e))throw new Error(`not an arena fixture (expected src/ and tests/): ${r}`);let s=m.readdirSync(n).filter(c=>c.endsWith(".mjs")).sort().map(c=>f.join("src",c)),i={};for(let c of m.readdirSync(e).filter(a=>a.endsWith(".test.mjs")).sort())i[c.replace(".test.mjs","")]=f.join("tests",c);if(s.length===0||Object.keys(i).length===0)throw new Error(`fixture has no src/*.mjs or tests/*.test.mjs: ${r}`);return{root:r,sourceFiles:s,testGroups:i}}function T(t,r){let n=m.mkdtempSync(f.join(r,"arena-ws-"));m.mkdirSync(f.join(n,"src"),{recursive:!0}),m.mkdirSync(f.join(n,"tests"),{recursive:!0});for(let e of t.layout.sourceFiles){let s=t.mutatedFile&&t.mutatedFile.relPath===e?t.mutatedFile.content:m.readFileSync(f.join(t.layout.root,e),"utf8");m.writeFileSync(f.join(n,e),s)}for(let e of t.groups){let s=t.layout.testGroups[e];m.copyFileSync(f.join(t.layout.root,s),f.join(n,s))}return n}function $(t,r={}){let n=["--test"];r.coverage&&n.push("--experimental-test-coverage");let e=m.readdirSync(f.join(t,"tests")).filter(u=>u.endsWith(".test.mjs")).sort().map(u=>f.join("tests",u));n.push(...e);let s=process.hrtime.bigint(),i=J(process.execPath,n,{cwd:t,timeout:r.timeoutMs??12e4,encoding:"utf8"}),c=Number(process.hrtime.bigint()-s)/1e6,a=null;if(r.coverage){let u=/all files\s*\|\s*([\d.]+)/.exec(i.stdout??"");a=u?Number(u[1]):null}return{ok:i.status===0,durationMs:Math.round(c),coveragePct:a}}function N(){return m.mkdtempSync(f.join(L.tmpdir(),"qe-arena-"))}function B(t){m.rmSync(t,{recursive:!0,force:!0})}var k={kill:.6,coverage:.3,runtimePenalty:.1};function Q(t,r,n){let e=[...t].sort(),s=new Set([e.join("+")]),i=[{id:"s1",name:`all(${e.join("+")})`,groups:e}],c=0;for(;i.length<r&&c++<200;){let a=e.filter(()=>n()<.5);if(a.length===0)continue;let u=a.join("+");s.has(u)||(s.add(u),i.push({id:`s${i.length+1}`,name:u,groups:a}))}return i}function C(t,r,n){let e=r===null?0:r/100,s=k.kill*t+k.coverage*e-k.runtimePenalty*n;return Math.round(s*1e4)/1e4}function D(t,r,n,e){let s=T({layout:t,groups:r.groups},e),i=$(s,{coverage:!0});if(!i.ok)return{baselinePassed:!1,killed:0,total:0,coveragePct:i.coveragePct,runtimeMs:i.durationMs};let c=0,a=0;for(let u of n)for(let y of u.mutants){a++;let h=T({layout:t,groups:r.groups,mutatedFile:{relPath:u.relPath,content:W(u.source,y)}},e);$(h).ok||c++}return{baselinePassed:!0,killed:c,total:a,coveragePct:i.coveragePct,runtimeMs:i.durationMs}}function rt(t){let r=t.seed??42,n=t.log??(()=>{}),e=G(r),s=I(t.target),i=N();try{let c=t.maxMutants??24,a=s.sourceFiles.map(l=>{let o=K.readFileSync(M.join(s.root,l),"utf8");return{relPath:l,source:o,mutants:A(o,l)}}),u=a.flatMap(l=>l.mutants.map(o=>({file:l.relPath,m:o})));if(u.length>c){let l=new Set;for(;l.size<c;)l.add(u[w(e,u.length)].m.id);for(let o of a)o.mutants=o.mutants.filter(p=>l.has(p.id));u=a.flatMap(o=>o.mutants.map(p=>({file:o.relPath,m:p})))}n(`mutants: ${u.length} (of ${a.reduce((l,o)=>l+A(o.source,o.relPath).length,0)} enumerated)`);let y=Q(Object.keys(s.testGroups),t.strategies??4,e),h={},v=y.map(l=>{n(`evaluating ${l.id} [${l.name}] ...`);let o=D(s,l,a,i);return h[l.id]=o.runtimeMs,{s:l,e:o}}),S=Object.keys(s.testGroups).length,d=v.map(({s:l,e:o})=>{let p=o.total>0?Math.round(o.killed/o.total*1e4)/1e4:0,g=Math.round(l.groups.length/S*1e4)/1e4;return{...l,baselinePassed:o.baselinePassed,mutantsKilled:o.killed,mutantsTotal:o.total,killRate:p,coveragePct:o.coveragePct,suiteCostRatio:g,fitness:o.baselinePassed?C(p,o.coveragePct,g):0}}),P=[...d].sort((l,o)=>o.fitness-l.fitness||l.id.localeCompare(o.id)).map(l=>l.id),U=d.map(l=>d.map(o=>l.fitness>o.fitness?1:l.fitness<o.fitness?-1:0)),j=[];if(t.evolveSteps&&t.evolveSteps>0){let l=Object.keys(s.testGroups).sort(),o=d.find(g=>g.id===P[0]).groups,p=d.find(g=>g.id===P[0]).fitness;for(let g=1;g<=t.evolveSteps;g++){let R=l[w(e,l.length)],b=o.includes(R)?o.filter(q=>q!==R):[...o,R].sort();if(b.length===0){j.push({step:g,groups:b,fitness:0,accepted:!1});continue}let x=D(s,{id:`evo${g}`,name:b.join("+"),groups:b},a,i),_=x.total>0?x.killed/x.total:0,F=x.baselinePassed?C(_,x.coveragePct,b.length/l.length):0,O=F>p;j.push({step:g,groups:b,fitness:F,accepted:O}),O&&(o=b,p=F)}}return{contract:"arena-result@1",seed:r,target:M.relative(process.cwd(),s.root)||".",weights:{...k},mutantsTotal:u.length,strategies:d,ranking:P,competitiveArray:U,evolution:j,informational:{runtimesMs:h}}}finally{B(i)}}export{Q as buildStrategies,rt as runArena};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{d as f,e as g,f as m,g as y}from"./chunk-
|
|
3
|
-
`)}function V(){try{let n=l(),i=b.join(n,".agentic-qe","memory.db");if(!p(i))return null;let e=(w(),v(E)),t=new e(i),r=f(t),s=m(r);return t.close(),s}catch{return null}}async function O(n){let i=y(),t=(V()??g()).verifyChain(),r={featureEnabled:i,chainLength:t.length,integrity:t.valid,brokenAt:t.brokenAt,lastHash:t.lastHash,message:t.message};return n.format==="json"?console.log(JSON.stringify(r,null,2)):console.log(C(t,i)),r}async function j(n){let{WitnessChain:i,hashWith:e,serializeEntry:t}=await import("./witness-chain-
|
|
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.13.0");process.exit(0)}
|
|
2
|
+
import{d as f,e as g,f as m,g as y}from"./chunk-U2SW6KK5.js";import{m as L}from"./chunk-G5DFYX3J.js";import"./chunk-W5YEIHIO.js";import"./chunk-BUGWPTMF.js";import"./chunk-HVB2L52I.js";import"./chunk-OXXMVQDF.js";import{b as l}from"./chunk-NUQBJGGF.js";import"./chunk-2DIT5AUU.js";import"./chunk-CYL2FV23.js";import"./chunk-SNTUKW4Q.js";import{p as E,q as w}from"./chunk-TVMFH5N2.js";import"./chunk-THBTN7XB.js";import"./chunk-RDU4WTV2.js";import"./chunk-LBE2P6UC.js";import"./chunk-IZRLIWFN.js";import"./chunk-AO7AHX6K.js";import"./chunk-YRQLVGCI.js";import"./chunk-3GSYD5SL.js";import{g as v}from"./chunk-ES7WCYOU.js";import{Command as x}from"commander";import c from"chalk";L();import{existsSync as p}from"node:fs";import b from"node:path";function C(n,i){let e=[];e.push(c.bold("Witness Chain Audit Verification")),e.push("");let t=i?c.green("ENABLED"):c.yellow("DISABLED");e.push(` Feature Flag: ${t}`),e.push(` Chain Length: ${n.length} receipts`);let r=n.valid?c.green("VALID"):c.red("BROKEN");return e.push(` Integrity: ${r}`),n.length>0&&e.push(` Last Hash: ${n.lastHash.slice(0,16)}...`),!n.valid&&n.brokenAt>=0&&(e.push(""),e.push(c.red(` Break detected at index ${n.brokenAt}`)),e.push(c.red(` ${n.message}`))),e.push(""),e.join(`
|
|
3
|
+
`)}function V(){try{let n=l(),i=b.join(n,".agentic-qe","memory.db");if(!p(i))return null;let e=(w(),v(E)),t=new e(i),r=f(t),s=m(r);return t.close(),s}catch{return null}}async function O(n){let i=y(),t=(V()??g()).verifyChain(),r={featureEnabled:i,chainLength:t.length,integrity:t.valid,brokenAt:t.brokenAt,lastHash:t.lastHash,message:t.message};return n.format==="json"?console.log(JSON.stringify(r,null,2)):console.log(C(t,i)),r}async function j(n){let{WitnessChain:i,hashWith:e,serializeEntry:t}=await import("./witness-chain-WVXRXKQP.js"),r=l(),s=b.join(r,".agentic-qe","memory.db"),a;if(!p(s))a={featureEnabled:!0,chainLength:0,integrity:!0,brokenAt:-1,lastHash:"",message:`No database found at ${s} \u2014 nothing to verify`};else{let{default:A}=await import("./better-sqlite3-DUZ6FFAH.js"),h=new A(s,{readonly:!0});try{let d=new i(h);await d.initialize();let o=d.verify({includeArchive:!0,checkSignatures:!0}),u=h.prepare("SELECT * FROM witness_chain ORDER BY id DESC LIMIT 1").get(),k=u?e(u.hash_algo||"sha256",t(u)):"";a={featureEnabled:!0,chainLength:o.entriesChecked,integrity:o.valid,brokenAt:o.brokenAt??-1,lastHash:k,message:o.valid?`Audit chain verified: ${o.entriesChecked} entries checked, ${o.signatureFailures??0} signature failures`:`Audit chain BROKEN at id=${o.brokenAt} (${o.entriesChecked} entries checked before the break)`}}finally{h.close()}}return n.format==="json"?console.log(JSON.stringify(a,null,2)):console.log(C({valid:a.integrity,length:a.chainLength,brokenAt:a.brokenAt,lastHash:a.lastHash,message:a.message},a.featureEnabled)),a}function R(n,i,e){let t=new x("audit").description("Witness chain audit trail management");return t.command("verify").description("Verify witness chain integrity").option("-F, --format <format>","Output format (json|text)","text").option("-C, --chain <chain>","Which chain to verify: governance (29 decision receipts) or audit (full QE audit trail)","governance").action(async r=>{try{let s=r.format,a=r.chain==="audit"?await j({format:s}):await O({format:s});await i(a.integrity?0:1)}catch(s){console.error("Failed to verify witness chain:",s),await i(1)}}),t}export{R as createAuditCommand,C as formatVerificationText,j as handleAuditChainVerify,O as handleAuditVerify};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-CQFT7H3F.js";import"./chunk-UIPPJKON.js";import"./chunk-G5DFYX3J.js";import"./chunk-W5YEIHIO.js";import"./chunk-BUGWPTMF.js";import"./chunk-HVB2L52I.js";import"./chunk-OXXMVQDF.js";import"./chunk-NUQBJGGF.js";import"./chunk-2DIT5AUU.js";import"./chunk-CYL2FV23.js";import"./chunk-E3B5XTXJ.js";import"./chunk-Z6QCOZ2H.js";import"./chunk-SNTUKW4Q.js";import"./chunk-TVMFH5N2.js";import"./chunk-THBTN7XB.js";import"./chunk-RDU4WTV2.js";import"./chunk-LBE2P6UC.js";import"./chunk-IZRLIWFN.js";import"./chunk-AO7AHX6K.js";import"./chunk-YRQLVGCI.js";import"./chunk-3GSYD5SL.js";import"./chunk-ES7WCYOU.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,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q as p}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q as p}from"./chunk-TVMFH5N2.js";import"./chunk-ES7WCYOU.js";p();export{i as DotProductAttention,h as FlashAttention,k as HyperbolicAttention,l as LinearAttention,m as MoEAttention,j as MultiHeadAttention,b as RuvectorLayer,n as SonaEngine,c as TensorCompress,a as default,d as differentiableSearch,f as getCompressionLevel,e as hierarchicalForward,g as init,o as pipeline};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{a as N,b as P,c as j,d as S,e as Y,f as T,g as V,h as C,i as J,j as Z,k as U,l as he,m as M,n as ee,o as we,p as _,q as W,r as z,s as H}from"./chunk-PTPN6HQ7.js";import{h as be}from"./chunk-DZ775UGW.js";import{b as ye}from"./chunk-SPI4LUJ6.js";import"./chunk-NOSQI2OW.js";import"./chunk-FJACKKRL.js";import"./chunk-L2X3BWMN.js";import"./chunk-G5OGKVLO.js";import"./chunk-4EHW4TNA.js";import"./chunk-NJDLJ3KD.js";import{b as x,d as X}from"./chunk-OBL6W4Z5.js";import{a as ue,b as pe,c as ge,d as k,f as Ke}from"./chunk-2CPJCXV6.js";import"./chunk-2LNDU7AW.js";import{a as A,b as He}from"./chunk-ULQCEM7K.js";import"./chunk-UAPUA6OY.js";import"./chunk-GS6G7AVS.js";import"./chunk-YUDGQZJN.js";import"./chunk-HJ4U64BL.js";import"./chunk-CYSBM52D.js";import"./chunk-NLDLUHOF.js";import"./chunk-PEHEANAM.js";import"./chunk-XUUVAAHV.js";import"./chunk-SGMJ277D.js";import B from"path";import o from"chalk";He();X();import{existsSync as K,mkdirSync as Ge,writeFileSync as Qe,readFileSync as ne}from"fs";import{join as E,resolve as te}from"path";var Xe={rl_q_values:"includeQValues",dream_insights:"includeDreamInsights",dream_cycles:"includeDreamInsights",witness_chain:"includeWitnessChain",vectors:"includeVectors"};function Ye(e,n){let r=Xe[e.tableName];return!(r&&n[r]===!1)}var Ze=1e4;function en(e,n,r,t){if(!Ye(n,r))return ee(E(t,n.fileName),[]),{count:0,rows:[]};let[a,i]=n.domainColumn?M(r.domains,n.domainColumn):[void 0,[]];if(Z(e,n.tableName,a,i)>=Ze){let l=n.blobColumns,f=l&&l.length>0?y=>T(y,l):void 0;return{count:we(E(t,n.fileName),he(e,n.tableName,a,i),f)}}let s=U(e,n.tableName,a,i);return n.blobColumns&&n.blobColumns.length>0&&(s=s.map(l=>T(l,n.blobColumns))),ee(E(t,n.fileName),s),{count:s.length,rows:s}}function ve(e){let n=[];for(let r of S){let t=E(e,r.fileName);K(t)?n.push(C(ne(t,"utf-8"))):n.push(C(""))}return C(n.join(":"))}function Re(e,n,r="memory.db"){let t=te(n.outputPath);K(t)||Ge(t,{recursive:!0});let a=0,i={},d=new Set;for(let u of S){let y=en(e,u,n,t);if(i[u.tableName]=y.count,a+=y.count,u.tableName==="qe_patterns"){if(y.rows)for(let c of y.rows)c.qe_domain&&d.add(c.qe_domain);else if(y.count>0){let[c,w]=u.domainColumn?M(n.domains,u.domainColumn):[void 0,[]],p=`SELECT DISTINCT qe_domain FROM qe_patterns ${c?`WHERE ${c} AND qe_domain IS NOT NULL`:"WHERE qe_domain IS NOT NULL"}`;try{let g=e.prepare(p).all(...w||[]);for(let v of g)d.add(v.qe_domain)}catch{}}}}let s=n.includeVectors!==!1?Z(e,"vectors"):0,l=ve(t),f={version:"3.0",exportedAt:new Date().toISOString(),sourceDb:r,stats:{patternCount:i.qe_patterns||0,vectorCount:s,qValueCount:i.rl_q_values||0,dreamInsightCount:i.dream_insights||0,witnessChainLength:i.witness_chain||0,totalRecords:a},domains:[...d].sort(),checksum:l,tableRecordCounts:i};return Qe(E(t,"manifest.json"),JSON.stringify(f,null,2),"utf-8"),f}var nn=new Set(["qe_patterns","rl_q_values","dream_insights","witness_chain"]);function tn(e){return e==="1.0"?S.filter(n=>nn.has(n.tableName)):e==="3.0"?S:(console.warn(`[brain-import] Unknown manifest version '${e}'. Attempting full import \u2014 some files may be missing.`),S)}function Se(e,n,r){let t=te(n),a=E(t,"manifest.json");if(!K(a))throw new Error(`Manifest not found at ${a}`);let i=x(ne(a,"utf-8")),d=ve(t);if(d!==i.checksum)throw new Error(`Checksum mismatch: expected ${i.checksum}, got ${d}. The export may have been tampered with or corrupted.`);let s=tn(i.version);if(r.dryRun){let c=0;for(let w of s){let m=_(E(t,w.fileName),x);c+=m.length}return{imported:c,skipped:0,conflicts:0}}H(e);let l=0,f=0,u=0;return e.transaction(()=>{for(let c of s){let w=E(t,c.fileName),m=_(w,x);c.blobColumns&&c.blobColumns.length>0&&(m=m.map(p=>V(p,c.blobColumns)));for(let p of m){let g;if(c.dedupColumns&&c.dedupColumns.length>0)g=z(e,c.tableName,p,c.dedupColumns);else{let v=N[c.tableName]||"id",h=j[c.tableName],I=P[c.tableName];g=W(e,c.tableName,p,v,r.mergeStrategy,h,I)}l+=g.imported,f+=g.skipped,u+=g.conflicts}}})(),{imported:l,skipped:f,conflicts:u}}function xe(e){let n=te(e),r=E(n,"manifest.json");if(!K(r))throw new Error(`Manifest not found at ${r}`);return x(ne(r,"utf-8"))}Ke();import{existsSync as q,readdirSync as rn,renameSync as on,statSync as an,unlinkSync as re,writeFileSync as sn}from"fs";import{basename as ln,dirname as dn,join as cn,resolve as oe}from"path";var Ee=["",".idmap.json",".manifest.json"],fn=[...Ee,".lock"];function Ce(e){for(let n of fn)try{let r=`${e}${n}`;q(r)&&re(r)}catch{}}function mn(e){let n=dn(e),r=`${ln(e)}.tmp.`,t;try{t=rn(n)}catch{return}for(let a of t){if(!a.startsWith(r))continue;let i=Number.parseInt(a.slice(r.length).split(".")[0],10);if(!(!Number.isInteger(i)||i<=0)&&!(i!==process.pid&&un(i)))try{re(cn(n,a))}catch{}}}function un(e){try{return process.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function Be(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=oe(n.outputPath),a=n.dimension??384,i=`${t}.tmp.${process.pid}`;mn(t),Ce(i);let d=ue(i,a),s=!1;try{let l={},f=new Set,u=0;for(let R of S){let[b,O]=R.domainColumn?M(n.domains,R.domainColumn):[void 0,[]],$=U(e,R.tableName,b,O);if(R.tableName==="qe_patterns")for(let L of $)L.qe_domain&&f.add(L.qe_domain);let Q=Y[R.tableName];Q&&Q.length>0&&($=$.map(L=>T(L,Q))),l[R.tableName]=$,u+=$.length}let y=0,c=[];if(J(e,"qe_pattern_embeddings")){let R=e.prepare("SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings").all();for(let b of R)b.embedding&&b.dimension===a&&c.push({id:`pe:${b.pattern_id}`,vector:new Float32Array(b.embedding.buffer,b.embedding.byteOffset,a),metadata:{tableName:"qe_pattern_embeddings"}})}if(J(e,"captured_experiences")){let R=e.prepare("SELECT id, embedding, embedding_dimension, domain, quality FROM captured_experiences WHERE embedding IS NOT NULL").all();for(let b of R)b.embedding_dimension===a&&c.push({id:`exp:${b.id}`,vector:new Float32Array(b.embedding.buffer,b.embedding.byteOffset,a),metadata:{tableName:"captured_experiences",domain:b.domain,confidence:b.quality}})}if(J(e,"sona_patterns")){let R=e.prepare("SELECT id, state_embedding, domain, confidence FROM sona_patterns WHERE state_embedding IS NOT NULL").all();for(let b of R)b.state_embedding.byteLength/4===a&&c.push({id:`sona:${b.id}`,vector:new Float32Array(b.state_embedding.buffer,b.state_embedding.byteOffset,a),metadata:{tableName:"sona_patterns",domain:b.domain,confidence:b.confidence}})}c.length>0&&(y=d.ingest(c).accepted);let w={version:"3.0",format:"rvf",exportedAt:new Date().toISOString(),sourceDb:r,domains:[...f].sort(),tables:l},m=JSON.stringify(w),p=C(m),g=Buffer.from(m);d.embedKernel(g);let v=n.sign?d.sign(g)??void 0:void 0,h=v?n.signerKeyId??"default":void 0,I=d.fileId(),F=I?{fileId:I,parentId:d.parentId(),lineageDepth:d.lineageDepth()}:void 0,D=d.status(),me={version:"3.0",format:"rvf",exportedAt:w.exportedAt,sourceDb:r,stats:{patternCount:(l.qe_patterns||[]).length,embeddingCount:y,qValueCount:(l.rl_q_values||[]).length,dreamInsightCount:(l.dream_insights||[]).length,witnessChainLength:(l.witness_chain||[]).length,totalRecords:u},domains:w.domains,checksum:p,rvfStatus:{totalVectors:D.totalVectors,totalSegments:D.totalSegments,fileSizeBytes:D.fileSizeBytes},...v?{signature:v,signerKeyId:h}:{},...F?{lineage:F}:{}};if(v)try{d.freeze()}catch{}sn(`${i}.manifest.json`,JSON.stringify(me,null,2),"utf-8"),d.close(),s=!0;for(let R of[...Ee].reverse()){let b=`${i}${R}`,O=`${t}${R}`;q(b)?on(b,O):q(O)&&re(O)}return me}catch(l){if(!s)try{d.close()}catch{}throw Ce(i),l}}var pn={patterns:"qe_patterns",qValues:"rl_q_values",dreamInsights:"dream_insights",witnessChain:"witness_chain"};function _e(e,n,r){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use JSONL format.");let t=oe(n);if(!q(t))throw new Error(`RVF file not found: ${t}`);let a=pe(t);try{let i=a.verifyWitness();if(!i.valid&&(i.totalEntries>0||i.errors.length>0)){let m=i.errors.length>0?i.errors.join("; "):"unknown integrity error";throw new Error(`RVF witness verification failed: ${m}`)}let d=a.extractKernel();if(!d||!d.image)throw new Error("No brain data found in RVF file (missing kernel segment)");let s;try{s=JSON.parse(d.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(s.tables)for(let p of Object.values(s.tables))m+=p?.length??0;else m=(s.patterns?.length??0)+(s.qValues?.length??0)+(s.dreamInsights?.length??0)+(s.witnessChain?.length??0);return{imported:m,skipped:0,conflicts:0,embeddingsRestored:0}}H(e);let l=0,f=0,u=0,y=0,c={};if(s.tables)Object.assign(c,s.tables);else for(let[m,p]of Object.entries(pn)){let g=s[m];Array.isArray(g)&&(c[p]=g)}if(e.transaction(()=>{for(let m of S){let p=c[m.tableName];if(!p||!Array.isArray(p))continue;let g=Y[m.tableName];if(g&&g.length>0){p=p.map(v=>V(v,g));for(let v of p)for(let h of g)v[h]instanceof Buffer&&y++}for(let v of p){let h;if(m.dedupColumns&&m.dedupColumns.length>0)h=z(e,m.tableName,v,m.dedupColumns);else{let I=N[m.tableName]||"id",F=j[m.tableName],D=P[m.tableName];h=W(e,m.tableName,v,I,r.mergeStrategy,F,D)}l+=h.imported,f+=h.skipped,u+=h.conflicts}}})(),u>0)try{a.compact()}catch{}return{imported:l,skipped:f,conflicts:u,embeddingsRestored:y}}finally{a.close()}}function G(e){if(!k())throw new Error("@ruvector/rvf-node is not available.");let n=oe(e);if(!q(n))throw new Error(`RVF file not found: ${n}`);let r=ge(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"),i;try{i=JSON.parse(a)}catch(w){throw new Error(`Failed to parse brain kernel data as JSON: ${w instanceof Error?w.message:w}`)}let d=r.status(),s=an(n).size,l=i.tables,f=l?l.qe_patterns?.length??0:i.patterns?.length??0,u=l?l.rl_q_values?.length??0:i.qValues?.length??0,y=l?l.dream_insights?.length??0:i.dreamInsights?.length??0,c=l?l.witness_chain?.length??0:i.witnessChain?.length??0;return{version:"3.0",format:"rvf",exportedAt:i.exportedAt??"unknown",sourceDb:i.sourceDb??"unknown",stats:{patternCount:f,embeddingCount:d.totalVectors,qValueCount:u,dreamInsightCount:y,witnessChainLength:c},domains:i.domains??[],checksum:C(a),rvfStatus:{totalVectors:d.totalVectors,totalSegments:d.totalSegments,fileSizeBytes:s}}}finally{r.close()}}function ae(){return k()}X();import{existsSync as se,readFileSync as gn,statSync as yn}from"fs";import{join as ie,resolve as Ie}from"path";function De(e,n,r={}){let t=Ie(e),a=Ie(n),i=Oe(t),d=Oe(a),s=Ae(t,i),l=Ae(a,d),f=i==="jsonl"&&d==="jsonl",u=wn({pathA:t,pathB:a,manifestA:s,manifestB:l,recordLevel:f,tableFilter:r.tableFilter,maxIdsPerBucket:r.maxIdsPerBucket??500}),y=new Set(s.domains),c=new Set(l.domains),w=s.domains.filter(h=>!c.has(h)),m=l.domains.filter(h=>!y.has(h)),p=s.checksum===l.checksum,g=s.version===l.version,v=p&&g&&u.every(h=>h.delta===0&&(h.added?.length??0)===0&&(h.removed?.length??0)===0&&(h.changed?.length??0)===0);return{pathA:t,pathB:a,formatA:i,formatB:d,manifestA:s,manifestB:l,checksumMatch:p,versionMatch:g,identical:v,recordLevel:f,tableDiffs:u,domainsOnlyInA:w,domainsOnlyInB:m}}function Oe(e){if(!se(e))throw new Error(`Path not found: ${e}`);if(e.endsWith(".rvf"))return"rvf";if(yn(e).isFile())throw new Error(`Unsupported brain export: ${e} (expected a .rvf file or a JSONL directory)`);return"jsonl"}function Ae(e,n){return n==="rvf"?hn(e):bn(e)}function bn(e){let n=ie(e,"manifest.json");if(!se(n))throw new Error(`Manifest not found at ${n}`);let r=x(gn(n,"utf-8"));return $e(r,"jsonl")}function hn(e){let n=G(e);return $e(n,"rvf")}function $e(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 wn(e){let n=e.tableFilter?S.filter(t=>t.tableName===e.tableFilter):S;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,i=e.manifestB.tableRecordCounts[t.tableName]??0,d=i-a,s,l,f;if(e.recordLevel&&vn(t)){let u=Rn(ie(e.pathA,t.fileName),ie(e.pathB,t.fileName),t,e.maxIdsPerBucket);s=u.added,l=u.removed,f=u.changed}r.push({tableName:t.tableName,countA:a,countB:i,delta:d,...s!==void 0?{added:s}:{},...l!==void 0?{removed:l}:{},...f!==void 0?{changed:f}:{}})}return r}function vn(e){return!0}function Rn(e,n,r,t){let a=Ne(e,r),i=Ne(n,r),d=[],s=[],l=[];for(let[f,u]of a){let y=i.get(f);if(y===void 0)s.length<t&&s.push(f);else if(y!==u){if(r.dedupColumns&&r.dedupColumns.length>0)continue;l.length<t&&l.push(f)}}for(let f of i.keys())a.has(f)||d.length<t&&d.push(f);return d.sort(),s.sort(),l.sort(),{added:d,removed:s,changed:l}}function Ne(e,n){let r=new Map;if(!se(e))return r;let t=_(e,x);for(let a of t){let i=Sn(a,n);if(i===void 0)continue;let d=xn(a);r.set(i,Cn(d))}return r}function Sn(e,n){if(n.dedupColumns&&n.dedupColumns.length>0){let a=[];for(let i of n.dedupColumns){let d=e[i];if(d==null)return;a.push(String(d))}return a.join("")}let r=N[n.tableName]??"id",t=e[r];if(t!=null)return String(t)}function xn(e){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];return JSON.stringify(r)}function Cn(e){return C(e)}X();import{existsSync as le,statSync as En}from"fs";import{join as ke,resolve as Bn}from"path";var _n=20,In="qe_patterns";function Te(e,n={}){let r=Bn(e);Nn(r);let t=n.table??In,a=S.find(g=>g.tableName===t);if(!a)throw new Error(`Unknown table: ${t}`);let i=ke(r,a.fileName);if(!le(i))throw new Error(`Table file not found: ${a.fileName} (expected in ${r}). Was this export generated with --format jsonl?`);let d=_(i,x),s=a.domainColumn,l=Math.max(1,n.limit??_n),f=n.query?n.query.toLowerCase():void 0,u=n.domains&&n.domains.length>0?new Set(n.domains):void 0,y=n.since,c=n.until,w=n.patternType,m=0,p=[];for(let g of d)On(g,{domainColumn:s,domains:u,patternType:w,since:y,until:c,queryLower:f})&&(m++,p.length<l&&p.push(An(g,a.tableName,s)));return{table:t,inputPath:r,totalScanned:d.length,totalMatched:m,limit:l,hits:p,truncated:m>l}}function On(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=Me(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 Me(e){for(let n of["updated_at","created_at","timestamp"]){let r=e[n];if(typeof r=="string"&&r.length>0)return r}}function An(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:Me(e)};return{id:t,display:a,row:e}}function Nn(e){if(!le(e))throw new Error(`Path not found: ${e}`);if(En(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=ke(e,"manifest.json");if(!le(r))throw new Error(`Manifest not found at ${r}. Is this a brain export directory?`)}function qe(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(`
|
|
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.13.0");process.exit(0)}
|
|
2
|
+
import{a as N,b as P,c as j,d as S,e as Y,f as T,g as V,h as C,i as J,j as Z,k as U,l as he,m as M,n as ee,o as we,p as _,q as W,r as z,s as H}from"./chunk-GTUFX7AR.js";import{h as be}from"./chunk-A4QLGPYO.js";import{b as ye}from"./chunk-FUU32QY5.js";import"./chunk-G5DFYX3J.js";import"./chunk-W5YEIHIO.js";import"./chunk-BUGWPTMF.js";import"./chunk-HVB2L52I.js";import"./chunk-OXXMVQDF.js";import"./chunk-NUQBJGGF.js";import{b as x,d as X}from"./chunk-2DIT5AUU.js";import{a as ue,b as pe,c as ge,d as k,f as Ke}from"./chunk-KUA4HHU6.js";import"./chunk-CYL2FV23.js";import{a as A,b as He}from"./chunk-SNTUKW4Q.js";import"./chunk-TVMFH5N2.js";import"./chunk-THBTN7XB.js";import"./chunk-RDU4WTV2.js";import"./chunk-LBE2P6UC.js";import"./chunk-IZRLIWFN.js";import"./chunk-AO7AHX6K.js";import"./chunk-YRQLVGCI.js";import"./chunk-3GSYD5SL.js";import"./chunk-ES7WCYOU.js";import B from"path";import o from"chalk";He();X();import{existsSync as K,mkdirSync as Ge,writeFileSync as Qe,readFileSync as ne}from"fs";import{join as E,resolve as te}from"path";var Xe={rl_q_values:"includeQValues",dream_insights:"includeDreamInsights",dream_cycles:"includeDreamInsights",witness_chain:"includeWitnessChain",vectors:"includeVectors"};function Ye(e,n){let r=Xe[e.tableName];return!(r&&n[r]===!1)}var Ze=1e4;function en(e,n,r,t){if(!Ye(n,r))return ee(E(t,n.fileName),[]),{count:0,rows:[]};let[a,i]=n.domainColumn?M(r.domains,n.domainColumn):[void 0,[]];if(Z(e,n.tableName,a,i)>=Ze){let l=n.blobColumns,f=l&&l.length>0?y=>T(y,l):void 0;return{count:we(E(t,n.fileName),he(e,n.tableName,a,i),f)}}let s=U(e,n.tableName,a,i);return n.blobColumns&&n.blobColumns.length>0&&(s=s.map(l=>T(l,n.blobColumns))),ee(E(t,n.fileName),s),{count:s.length,rows:s}}function ve(e){let n=[];for(let r of S){let t=E(e,r.fileName);K(t)?n.push(C(ne(t,"utf-8"))):n.push(C(""))}return C(n.join(":"))}function Re(e,n,r="memory.db"){let t=te(n.outputPath);K(t)||Ge(t,{recursive:!0});let a=0,i={},d=new Set;for(let u of S){let y=en(e,u,n,t);if(i[u.tableName]=y.count,a+=y.count,u.tableName==="qe_patterns"){if(y.rows)for(let c of y.rows)c.qe_domain&&d.add(c.qe_domain);else if(y.count>0){let[c,w]=u.domainColumn?M(n.domains,u.domainColumn):[void 0,[]],p=`SELECT DISTINCT qe_domain FROM qe_patterns ${c?`WHERE ${c} AND qe_domain IS NOT NULL`:"WHERE qe_domain IS NOT NULL"}`;try{let g=e.prepare(p).all(...w||[]);for(let v of g)d.add(v.qe_domain)}catch{}}}}let s=n.includeVectors!==!1?Z(e,"vectors"):0,l=ve(t),f={version:"3.0",exportedAt:new Date().toISOString(),sourceDb:r,stats:{patternCount:i.qe_patterns||0,vectorCount:s,qValueCount:i.rl_q_values||0,dreamInsightCount:i.dream_insights||0,witnessChainLength:i.witness_chain||0,totalRecords:a},domains:[...d].sort(),checksum:l,tableRecordCounts:i};return Qe(E(t,"manifest.json"),JSON.stringify(f,null,2),"utf-8"),f}var nn=new Set(["qe_patterns","rl_q_values","dream_insights","witness_chain"]);function tn(e){return e==="1.0"?S.filter(n=>nn.has(n.tableName)):e==="3.0"?S:(console.warn(`[brain-import] Unknown manifest version '${e}'. Attempting full import \u2014 some files may be missing.`),S)}function Se(e,n,r){let t=te(n),a=E(t,"manifest.json");if(!K(a))throw new Error(`Manifest not found at ${a}`);let i=x(ne(a,"utf-8")),d=ve(t);if(d!==i.checksum)throw new Error(`Checksum mismatch: expected ${i.checksum}, got ${d}. The export may have been tampered with or corrupted.`);let s=tn(i.version);if(r.dryRun){let c=0;for(let w of s){let m=_(E(t,w.fileName),x);c+=m.length}return{imported:c,skipped:0,conflicts:0}}H(e);let l=0,f=0,u=0;return e.transaction(()=>{for(let c of s){let w=E(t,c.fileName),m=_(w,x);c.blobColumns&&c.blobColumns.length>0&&(m=m.map(p=>V(p,c.blobColumns)));for(let p of m){let g;if(c.dedupColumns&&c.dedupColumns.length>0)g=z(e,c.tableName,p,c.dedupColumns);else{let v=N[c.tableName]||"id",h=j[c.tableName],I=P[c.tableName];g=W(e,c.tableName,p,v,r.mergeStrategy,h,I)}l+=g.imported,f+=g.skipped,u+=g.conflicts}}})(),{imported:l,skipped:f,conflicts:u}}function xe(e){let n=te(e),r=E(n,"manifest.json");if(!K(r))throw new Error(`Manifest not found at ${r}`);return x(ne(r,"utf-8"))}Ke();import{existsSync as q,readdirSync as rn,renameSync as on,statSync as an,unlinkSync as re,writeFileSync as sn}from"fs";import{basename as ln,dirname as dn,join as cn,resolve as oe}from"path";var Ee=["",".idmap.json",".manifest.json"],fn=[...Ee,".lock"];function Ce(e){for(let n of fn)try{let r=`${e}${n}`;q(r)&&re(r)}catch{}}function mn(e){let n=dn(e),r=`${ln(e)}.tmp.`,t;try{t=rn(n)}catch{return}for(let a of t){if(!a.startsWith(r))continue;let i=Number.parseInt(a.slice(r.length).split(".")[0],10);if(!(!Number.isInteger(i)||i<=0)&&!(i!==process.pid&&un(i)))try{re(cn(n,a))}catch{}}}function un(e){try{return process.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function Be(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=oe(n.outputPath),a=n.dimension??384,i=`${t}.tmp.${process.pid}`;mn(t),Ce(i);let d=ue(i,a),s=!1;try{let l={},f=new Set,u=0;for(let R of S){let[b,O]=R.domainColumn?M(n.domains,R.domainColumn):[void 0,[]],$=U(e,R.tableName,b,O);if(R.tableName==="qe_patterns")for(let L of $)L.qe_domain&&f.add(L.qe_domain);let Q=Y[R.tableName];Q&&Q.length>0&&($=$.map(L=>T(L,Q))),l[R.tableName]=$,u+=$.length}let y=0,c=[];if(J(e,"qe_pattern_embeddings")){let R=e.prepare("SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings").all();for(let b of R)b.embedding&&b.dimension===a&&c.push({id:`pe:${b.pattern_id}`,vector:new Float32Array(b.embedding.buffer,b.embedding.byteOffset,a),metadata:{tableName:"qe_pattern_embeddings"}})}if(J(e,"captured_experiences")){let R=e.prepare("SELECT id, embedding, embedding_dimension, domain, quality FROM captured_experiences WHERE embedding IS NOT NULL").all();for(let b of R)b.embedding_dimension===a&&c.push({id:`exp:${b.id}`,vector:new Float32Array(b.embedding.buffer,b.embedding.byteOffset,a),metadata:{tableName:"captured_experiences",domain:b.domain,confidence:b.quality}})}if(J(e,"sona_patterns")){let R=e.prepare("SELECT id, state_embedding, domain, confidence FROM sona_patterns WHERE state_embedding IS NOT NULL").all();for(let b of R)b.state_embedding.byteLength/4===a&&c.push({id:`sona:${b.id}`,vector:new Float32Array(b.state_embedding.buffer,b.state_embedding.byteOffset,a),metadata:{tableName:"sona_patterns",domain:b.domain,confidence:b.confidence}})}c.length>0&&(y=d.ingest(c).accepted);let w={version:"3.0",format:"rvf",exportedAt:new Date().toISOString(),sourceDb:r,domains:[...f].sort(),tables:l},m=JSON.stringify(w),p=C(m),g=Buffer.from(m);d.embedKernel(g);let v=n.sign?d.sign(g)??void 0:void 0,h=v?n.signerKeyId??"default":void 0,I=d.fileId(),F=I?{fileId:I,parentId:d.parentId(),lineageDepth:d.lineageDepth()}:void 0,D=d.status(),me={version:"3.0",format:"rvf",exportedAt:w.exportedAt,sourceDb:r,stats:{patternCount:(l.qe_patterns||[]).length,embeddingCount:y,qValueCount:(l.rl_q_values||[]).length,dreamInsightCount:(l.dream_insights||[]).length,witnessChainLength:(l.witness_chain||[]).length,totalRecords:u},domains:w.domains,checksum:p,rvfStatus:{totalVectors:D.totalVectors,totalSegments:D.totalSegments,fileSizeBytes:D.fileSizeBytes},...v?{signature:v,signerKeyId:h}:{},...F?{lineage:F}:{}};if(v)try{d.freeze()}catch{}sn(`${i}.manifest.json`,JSON.stringify(me,null,2),"utf-8"),d.close(),s=!0;for(let R of[...Ee].reverse()){let b=`${i}${R}`,O=`${t}${R}`;q(b)?on(b,O):q(O)&&re(O)}return me}catch(l){if(!s)try{d.close()}catch{}throw Ce(i),l}}var pn={patterns:"qe_patterns",qValues:"rl_q_values",dreamInsights:"dream_insights",witnessChain:"witness_chain"};function _e(e,n,r){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use JSONL format.");let t=oe(n);if(!q(t))throw new Error(`RVF file not found: ${t}`);let a=pe(t);try{let i=a.verifyWitness();if(!i.valid&&(i.totalEntries>0||i.errors.length>0)){let m=i.errors.length>0?i.errors.join("; "):"unknown integrity error";throw new Error(`RVF witness verification failed: ${m}`)}let d=a.extractKernel();if(!d||!d.image)throw new Error("No brain data found in RVF file (missing kernel segment)");let s;try{s=JSON.parse(d.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(s.tables)for(let p of Object.values(s.tables))m+=p?.length??0;else m=(s.patterns?.length??0)+(s.qValues?.length??0)+(s.dreamInsights?.length??0)+(s.witnessChain?.length??0);return{imported:m,skipped:0,conflicts:0,embeddingsRestored:0}}H(e);let l=0,f=0,u=0,y=0,c={};if(s.tables)Object.assign(c,s.tables);else for(let[m,p]of Object.entries(pn)){let g=s[m];Array.isArray(g)&&(c[p]=g)}if(e.transaction(()=>{for(let m of S){let p=c[m.tableName];if(!p||!Array.isArray(p))continue;let g=Y[m.tableName];if(g&&g.length>0){p=p.map(v=>V(v,g));for(let v of p)for(let h of g)v[h]instanceof Buffer&&y++}for(let v of p){let h;if(m.dedupColumns&&m.dedupColumns.length>0)h=z(e,m.tableName,v,m.dedupColumns);else{let I=N[m.tableName]||"id",F=j[m.tableName],D=P[m.tableName];h=W(e,m.tableName,v,I,r.mergeStrategy,F,D)}l+=h.imported,f+=h.skipped,u+=h.conflicts}}})(),u>0)try{a.compact()}catch{}return{imported:l,skipped:f,conflicts:u,embeddingsRestored:y}}finally{a.close()}}function G(e){if(!k())throw new Error("@ruvector/rvf-node is not available.");let n=oe(e);if(!q(n))throw new Error(`RVF file not found: ${n}`);let r=ge(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"),i;try{i=JSON.parse(a)}catch(w){throw new Error(`Failed to parse brain kernel data as JSON: ${w instanceof Error?w.message:w}`)}let d=r.status(),s=an(n).size,l=i.tables,f=l?l.qe_patterns?.length??0:i.patterns?.length??0,u=l?l.rl_q_values?.length??0:i.qValues?.length??0,y=l?l.dream_insights?.length??0:i.dreamInsights?.length??0,c=l?l.witness_chain?.length??0:i.witnessChain?.length??0;return{version:"3.0",format:"rvf",exportedAt:i.exportedAt??"unknown",sourceDb:i.sourceDb??"unknown",stats:{patternCount:f,embeddingCount:d.totalVectors,qValueCount:u,dreamInsightCount:y,witnessChainLength:c},domains:i.domains??[],checksum:C(a),rvfStatus:{totalVectors:d.totalVectors,totalSegments:d.totalSegments,fileSizeBytes:s}}}finally{r.close()}}function ae(){return k()}X();import{existsSync as se,readFileSync as gn,statSync as yn}from"fs";import{join as ie,resolve as Ie}from"path";function De(e,n,r={}){let t=Ie(e),a=Ie(n),i=Oe(t),d=Oe(a),s=Ae(t,i),l=Ae(a,d),f=i==="jsonl"&&d==="jsonl",u=wn({pathA:t,pathB:a,manifestA:s,manifestB:l,recordLevel:f,tableFilter:r.tableFilter,maxIdsPerBucket:r.maxIdsPerBucket??500}),y=new Set(s.domains),c=new Set(l.domains),w=s.domains.filter(h=>!c.has(h)),m=l.domains.filter(h=>!y.has(h)),p=s.checksum===l.checksum,g=s.version===l.version,v=p&&g&&u.every(h=>h.delta===0&&(h.added?.length??0)===0&&(h.removed?.length??0)===0&&(h.changed?.length??0)===0);return{pathA:t,pathB:a,formatA:i,formatB:d,manifestA:s,manifestB:l,checksumMatch:p,versionMatch:g,identical:v,recordLevel:f,tableDiffs:u,domainsOnlyInA:w,domainsOnlyInB:m}}function Oe(e){if(!se(e))throw new Error(`Path not found: ${e}`);if(e.endsWith(".rvf"))return"rvf";if(yn(e).isFile())throw new Error(`Unsupported brain export: ${e} (expected a .rvf file or a JSONL directory)`);return"jsonl"}function Ae(e,n){return n==="rvf"?hn(e):bn(e)}function bn(e){let n=ie(e,"manifest.json");if(!se(n))throw new Error(`Manifest not found at ${n}`);let r=x(gn(n,"utf-8"));return $e(r,"jsonl")}function hn(e){let n=G(e);return $e(n,"rvf")}function $e(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 wn(e){let n=e.tableFilter?S.filter(t=>t.tableName===e.tableFilter):S;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,i=e.manifestB.tableRecordCounts[t.tableName]??0,d=i-a,s,l,f;if(e.recordLevel&&vn(t)){let u=Rn(ie(e.pathA,t.fileName),ie(e.pathB,t.fileName),t,e.maxIdsPerBucket);s=u.added,l=u.removed,f=u.changed}r.push({tableName:t.tableName,countA:a,countB:i,delta:d,...s!==void 0?{added:s}:{},...l!==void 0?{removed:l}:{},...f!==void 0?{changed:f}:{}})}return r}function vn(e){return!0}function Rn(e,n,r,t){let a=Ne(e,r),i=Ne(n,r),d=[],s=[],l=[];for(let[f,u]of a){let y=i.get(f);if(y===void 0)s.length<t&&s.push(f);else if(y!==u){if(r.dedupColumns&&r.dedupColumns.length>0)continue;l.length<t&&l.push(f)}}for(let f of i.keys())a.has(f)||d.length<t&&d.push(f);return d.sort(),s.sort(),l.sort(),{added:d,removed:s,changed:l}}function Ne(e,n){let r=new Map;if(!se(e))return r;let t=_(e,x);for(let a of t){let i=Sn(a,n);if(i===void 0)continue;let d=xn(a);r.set(i,Cn(d))}return r}function Sn(e,n){if(n.dedupColumns&&n.dedupColumns.length>0){let a=[];for(let i of n.dedupColumns){let d=e[i];if(d==null)return;a.push(String(d))}return a.join("")}let r=N[n.tableName]??"id",t=e[r];if(t!=null)return String(t)}function xn(e){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];return JSON.stringify(r)}function Cn(e){return C(e)}X();import{existsSync as le,statSync as En}from"fs";import{join as ke,resolve as Bn}from"path";var _n=20,In="qe_patterns";function Te(e,n={}){let r=Bn(e);Nn(r);let t=n.table??In,a=S.find(g=>g.tableName===t);if(!a)throw new Error(`Unknown table: ${t}`);let i=ke(r,a.fileName);if(!le(i))throw new Error(`Table file not found: ${a.fileName} (expected in ${r}). Was this export generated with --format jsonl?`);let d=_(i,x),s=a.domainColumn,l=Math.max(1,n.limit??_n),f=n.query?n.query.toLowerCase():void 0,u=n.domains&&n.domains.length>0?new Set(n.domains):void 0,y=n.since,c=n.until,w=n.patternType,m=0,p=[];for(let g of d)On(g,{domainColumn:s,domains:u,patternType:w,since:y,until:c,queryLower:f})&&(m++,p.length<l&&p.push(An(g,a.tableName,s)));return{table:t,inputPath:r,totalScanned:d.length,totalMatched:m,limit:l,hits:p,truncated:m>l}}function On(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=Me(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 Me(e){for(let n of["updated_at","created_at","timestamp"]){let r=e[n];if(typeof r=="string"&&r.length>0)return r}}function An(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:Me(e)};return{id:t,display:a,row:e}}function Nn(e){if(!le(e))throw new Error(`Path not found: ${e}`);if(En(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=ke(e,"manifest.json");if(!le(r))throw new Error(`Manifest not found at ${r}. Is this a brain export directory?`)}function qe(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
3
|
CREATE TEMP TABLE IF NOT EXISTS _covered_patterns (
|
|
4
4
|
pattern_id TEXT PRIMARY KEY
|
|
5
5
|
)
|
|
@@ -74,7 +74,7 @@ Examples:
|
|
|
74
74
|
aqe brain diff ./brain-a ./brain-b --verbose
|
|
75
75
|
aqe brain search -i ./brain-export --query oauth --domain test-generation
|
|
76
76
|
aqe brain search -i ./brain-export --since 2026-03-01 --limit 50 --json
|
|
77
|
-
`}};async function de(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-
|
|
77
|
+
`}};async function de(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-WNYWTGVX.js");return B.join(n(),".agentic-qe","memory.db")}function We(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function $n(e){let n=Number.parseInt(e,10);return!Number.isFinite(n)||n<1?20:n}function kn(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 i=a.trim();i&&r.push(i)}return r.length>0?r:void 0}function Tn(e,n){console.log(o.blue(`
|
|
78
78
|
Brain Diff
|
|
79
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)} `+ze(e.manifestB.totalRecords-e.manifestA.totalRecords)),(e.domainsOnlyInA.length>0||e.domainsOnlyInB.length>0)&&(console.log(o.blue(`
|
|
80
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(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import"./chunk-ES7WCYOU.js";var f=class{language;constructor(e="typescript"){this.language=e}enumerate(e,s){let r=[],n=e.split(`
|
|
3
3
|
`),l=!1;for(let i=0;i<n.length;i++){let d=n[i],t=d.trim(),c=i+1,u=d.length-d.trimStart().length+1;if(l){t.includes("*/")&&(l=!1);continue}if(t.startsWith("/*")){l=!t.includes("*/");continue}if(t.startsWith("//"))continue;if(/^\s*if\s*\(/.test(d)&&(this.findMatchingElse(n,i)||r.push({file:s,line:c,column:u,language:this.language,construct:"if-without-else",triggerCondition:"when condition is false",currentHandling:"falls through \u2014 no else branch",suggestedGuard:"Add else branch or document why falsy path is safe",severity:"medium"})),/^\s*switch\s*\(/.test(d)){let a=this.extractBlock(n,i);if(a&&!a.includes("default:")&&!a.includes("default :")&&r.push({file:s,line:c,column:u,language:this.language,construct:"switch-no-default",triggerCondition:"when value matches no case",currentHandling:"falls through \u2014 no default case",suggestedGuard:"Add default case with error handling or exhaustive check",severity:"high"}),a){let g=a.match(/case\s+[^:]+:/g)||[],h=a.match(/\b(break|return|throw|continue)\b/g)||[];g.length>0&&h.length<g.length&&r.push({file:s,line:c,column:u,language:this.language,construct:"switch-missing-break",triggerCondition:"when case falls through to next case",currentHandling:"fall-through \u2014 may execute unintended cases",suggestedGuard:"Add break/return to each case or add explicit // falls through comment",severity:"medium"})}}if(/\bcatch\s*\(/.test(t)||/\bcatch\s*\{/.test(t)){let a=this.extractBlock(n,i);if(a!==null){let g=a.replace(/[{}]/g,"").trim();(g.length===0||/^\s*\/\//.test(g))&&r.push({file:s,line:c,column:u,language:this.language,construct:"try-empty-catch",triggerCondition:"when exception is thrown",currentHandling:"exception silently swallowed",suggestedGuard:"Log the error or rethrow with context",severity:"high"})}}if(/\btry\s*\{/.test(t)&&this.extractBlock(n,i)&&(n.slice(i,Math.min(i+30,n.length)).join(`
|
|
4
4
|
`).includes("finally")||r.push({file:s,line:c,column:u,language:this.language,construct:"try-no-finally",triggerCondition:"when cleanup is needed regardless of success/failure",currentHandling:"no finally block \u2014 cleanup may be skipped on exception",suggestedGuard:"Add finally block for resource cleanup if applicable",severity:"low"})),t.includes("?.")){let a=t.match(/(\w+(?:\.\w+)*)\?\./g)||[];for(let g of a)if(!t.includes("??")&&!t.includes("|| ")&&!t.includes("if")){r.push({file:s,line:c,column:u,language:this.language,construct:"optional-chaining-null-path",triggerCondition:`when ${g.replace("?.","")} is null/undefined`,currentHandling:"returns undefined \u2014 may propagate",suggestedGuard:"Add ?? fallback or explicit null check",severity:"low"});break}}if(t.includes("??")&&!t.includes("?.")&&r.push({file:s,line:c,column:u,language:this.language,construct:"nullish-coalescing-fallback",triggerCondition:"when left side is null/undefined",currentHandling:"uses fallback value",suggestedGuard:"Verify fallback value is appropriate for all null cases",severity:"low"}),/\.\s*then\s*\(/.test(t)&&!t.includes(".catch")&&!t.includes("await")){let a=n.slice(i,Math.min(i+5,n.length)).join(" ");!a.includes(".catch")&&!a.includes("try")&&r.push({file:s,line:c,column:u,language:this.language,construct:"promise-no-catch",triggerCondition:"when promise rejects",currentHandling:"unhandled rejection \u2014 may crash process",suggestedGuard:"Add .catch() handler or use try/catch with await",severity:"high"})}let p=["map","filter","reduce","forEach","find","some","every","flatMap"];for(let a of p)if(new RegExp(`\\.${a}\\s*\\(`).test(t)){let h=n.slice(Math.max(0,i-3),i).join(" ");if(!h.includes(".length")&&!h.includes("if (")&&!h.includes("?.")){r.push({file:s,line:c,column:u,language:this.language,construct:"array-callback-empty",triggerCondition:`when array is empty before .${a}()`,currentHandling:a==="reduce"?"may throw without initial value":"returns empty result \u2014 may cause downstream issues",suggestedGuard:a==="reduce"?"Provide initial value or check array length":"Check array length or handle empty result",severity:a==="reduce"?"high":"low"});break}}/\|\|\s*['"`\d]/.test(t)&&!t.includes("??")&&r.push({file:s,line:c,column:u,language:this.language,construct:"logical-or-falsy",triggerCondition:'when left side is falsy (0, "", false, null, undefined)',currentHandling:'uses fallback \u2014 may unintentionally override 0, "", or false',suggestedGuard:"Use ?? instead of || if only null/undefined should trigger fallback",severity:"medium"}),/&&\s*\w+\s*\(/.test(t)&&!t.includes("if")&&!t.includes("while")&&r.push({file:s,line:c,column:u,language:this.language,construct:"logical-and-short-circuit",triggerCondition:"when left side is falsy \u2014 right side never executes",currentHandling:"short-circuits \u2014 function call skipped silently",suggestedGuard:"Use explicit if-statement for clarity when side effects matter",severity:"low"}),(t.match(/\?/g)||[]).length>=2&&t.includes(":")&&r.push({file:s,line:c,column:u,language:this.language,construct:"ternary-complex",triggerCondition:"when nested ternary conditions interact",currentHandling:"nested ternary \u2014 hard to read and maintain",suggestedGuard:"Refactor to if/else or switch for readability",severity:"medium"}),(/\btypeof\s+\w+\s*===?\s*['"]/.test(t)||/\binstanceof\b/.test(t))&&!t.includes("else")&&!this.findMatchingElse(n,i)&&r.push({file:s,line:c,column:u,language:this.language,construct:"type-guard-unhandled",triggerCondition:"when value does not match the guarded type",currentHandling:"unguarded type path \u2014 may cause runtime type errors",suggestedGuard:"Add else branch or exhaustive type checking",severity:"medium"})}return r}findMatchingElse(e,s){let r={depth:0};for(let n=s;n<Math.min(s+30,e.length);n++){let l=e[n];for(let i of l)i==="{"&&r.depth++,i==="}"&&r.depth--;if(r.depth===0&&n>s){if((e[n+1]?.trim()||"").startsWith("else")||e[n].trim().endsWith("else")||e[n].trim().endsWith("else {")||e[n].includes("} else"))return!0;break}}return!1}extractBlock(e,s){let r=0,n=!1,l=[];for(let i=s;i<Math.min(s+50,e.length);i++){let d=e[i];for(let t of d)t==="{"&&(r++,n=!0),t==="}"&&r--;if(n&&(l.push(d),r===0))return l.join(`
|
|
5
5
|
`)}return null}};function y(o,e,s){let r=Date.now(),n=s||(e.endsWith(".ts")||e.endsWith(".tsx")?"typescript":"javascript"),i=new f(n).enumerate(o,e);return{file:e,language:n,branches:i,totalConstructs:i.length,unhandledCount:i.length,duration:Date.now()-r}}function b(o){let e=[];if(e.push(`# Branch Enumeration Report: ${o.file}`),e.push(""),e.push(`**Language**: ${o.language} | **Branches**: ${o.unhandledCount} | **Duration**: ${o.duration}ms`),e.push(""),o.branches.length===0)return e.push("No unhandled branches detected."),e.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{a as p}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{a as p}from"./chunk-EECM5XKY.js";import"./chunk-ES7WCYOU.js";import{readFile as m,readdir as k}from"fs/promises";import{join as c,basename as y,dirname as W}from"path";import{fileURLToPath as v}from"url";import{parse as d}from"yaml";var b=v(import.meta.url),E=W(b),l=class{templatesDir;cache=new Map;constructor(r){this.templatesDir=r||c(E,"templates")}async load(r){if(this.cache.has(r))return this.cache.get(r);try{let e=c(this.templatesDir,`${r}.yaml`),n=await m(e,"utf-8"),o=d(n),i=await this.validate(o);if(!i.valid)throw new Error(`Invalid workflow template ${r}:
|
|
3
3
|
${i.errors.join(`
|
|
4
4
|
`)}`);return this.cache.set(r,o),o}catch(e){throw e.code==="ENOENT"?new Error(`Workflow template not found: ${r}`):e}}async list(){try{return(await k(this.templatesDir)).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).map(e=>y(e,e.endsWith(".yaml")?".yaml":".yml")).sort()}catch(r){if(r.code==="ENOENT")return[];throw r}}async validate(r){let e=[],n=[];if(r.name||e.push("Workflow must have a name"),r.version||e.push("Workflow must have a version"),r.description||n.push("Workflow should have a description"),Array.isArray(r.variables)?r.variables.forEach((o,i)=>{o.name||e.push(`Variable at index ${i} must have a name`),o.type||e.push(`Variable ${o.name} must have a type`),o.required===void 0&&n.push(`Variable ${o.name} should specify if it's required`)}):e.push("Workflow must have a variables array"),!Array.isArray(r.steps))e.push("Workflow must have a steps array");else if(r.steps.length===0)e.push("Workflow must have at least one step");else{r.steps.forEach((t,s)=>{t.name||e.push(`Step at index ${s} must have a name`),t.action||e.push(`Step ${t.name||s} must have an action`),(!t.config||typeof t.config!="object")&&e.push(`Step ${t.name||s} must have a config object`),t.assertions&&Array.isArray(t.assertions)&&t.assertions.forEach((f,u)=>{f.condition||e.push(`Assertion ${u} in step ${t.name||s} must have a condition`),f.message||n.push(`Assertion ${u} in step ${t.name||s} should have a message`)})});let o=r.steps.map(t=>t.name),i=o.filter((t,s)=>o.indexOf(t)!==s);i.length>0&&e.push(`Duplicate step names found: ${i.join(", ")}`)}return{valid:e.length===0,errors:e,warnings:n}}async createContext(r,e){let n=await this.load(r),o=n.variables.filter(t=>t.required&&!(t.name in e)).map(t=>t.name);if(o.length>0)throw new Error(`Missing required variables: ${o.join(", ")}`);let i={};return n.variables.forEach(t=>{t.name in e?i[t.name]=e[t.name]:"default"in t&&(i[t.name]=t.default)}),{variables:i,results:new Map,metadata:{startTime:Date.now(),workflow:n.name,templateName:r}}}async getMetadata(r){try{let e=c(this.templatesDir,`${r}.yaml`),n=await m(e,"utf-8"),o=d(n);return{name:o.name,version:o.version,description:o.description}}catch(e){throw e.code==="ENOENT"?new Error(`Workflow template not found: ${r}`):e}}clearCache(){this.cache.clear()}async reload(r){return this.cache.delete(r),this.load(r)}},x=new l;function w(a,r){return a.replace(/\{\{([^}]+)\}\}/g,(e,n)=>{let i=n.trim().split("."),t=r;for(let s of i)if(t&&typeof t=="object"&&s in t)t=t[s];else return e;return t!=null?String(t):e})}function T(a,r){let e={...r.variables,result:r.results.get("__last_result__")},n=w(a,e);return p(n,e,!1)}var g=["login-flow","oauth-flow","scraping-workflow","visual-regression","form-validation","navigation-flow","api-integration","performance-audit","accessibility-audit"],A={"login-flow":"Authentication testing workflow for login forms with credential validation","oauth-flow":"OAuth2/OIDC authentication testing workflow with provider integration","scraping-workflow":"Data extraction workflow for web scraping with pagination and structured output","visual-regression":"Screenshot comparison workflow for visual regression testing across breakpoints","form-validation":"Input validation testing workflow for form fields with error handling","navigation-flow":"Multi-page navigation workflow for testing user journeys and state persistence","api-integration":"Browser-API hybrid testing workflow for validating frontend-backend integration","performance-audit":"Lighthouse-style performance audit workflow with Core Web Vitals","accessibility-audit":"WCAG 2.1 Level AA compliance audit workflow with automated accessibility testing"},h={authentication:["login-flow","oauth-flow"],testing:["form-validation","navigation-flow","api-integration"],quality:["visual-regression","performance-audit","accessibility-audit"],automation:["scraping-workflow"]};function _(a){return h[a]}function P(a){return g.includes(a)}function L(){return g.map(a=>{let r=Object.entries(h).find(([e,n])=>n.includes(a))?.[0]||"other";return{name:a,description:A[a],category:r}})}export{h as WORKFLOW_CATEGORIES,A as WORKFLOW_DESCRIPTIONS,g as WORKFLOW_TEMPLATES,l as WorkflowLoader,x as defaultWorkflowLoader,T as evaluateCondition,L as getAllWorkflowTemplates,_ as getWorkflowsByCategory,w as interpolateVariables,P as isValidWorkflowTemplate};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{a}from"./chunk-LWYLW7RX.js";import"./chunk-CQFT7H3F.js";import"./chunk-UIPPJKON.js";import"./chunk-G5DFYX3J.js";import"./chunk-W5YEIHIO.js";import"./chunk-BUGWPTMF.js";import"./chunk-HVB2L52I.js";import"./chunk-OXXMVQDF.js";import"./chunk-NUQBJGGF.js";import"./chunk-2DIT5AUU.js";import"./chunk-CYL2FV23.js";import"./chunk-E3B5XTXJ.js";import"./chunk-Z6QCOZ2H.js";import"./chunk-SNTUKW4Q.js";import"./chunk-TVMFH5N2.js";import"./chunk-THBTN7XB.js";import"./chunk-RDU4WTV2.js";import"./chunk-LBE2P6UC.js";import"./chunk-IZRLIWFN.js";import"./chunk-AO7AHX6K.js";import"./chunk-YRQLVGCI.js";import"./chunk-3GSYD5SL.js";import"./chunk-ES7WCYOU.js";export{a as BrowserWorkflowTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{c as w,d as E,f as T}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{c as w,d as E,f as T}from"./chunk-ES7WCYOU.js";var d=E((b,u)=>{"use strict";var _=typeof Buffer<"u",a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,l=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function p(r,t,e){e==null&&t!==null&&typeof t=="object"&&(e=t,t=void 0),_&&Buffer.isBuffer(r)&&(r=r.toString()),r&&r.charCodeAt(0)===65279&&(r=r.slice(1));let o=JSON.parse(r,t);if(o===null||typeof o!="object")return o;let n=e&&e.protoAction||"error",c=e&&e.constructorAction||"error";if(n==="ignore"&&c==="ignore")return o;if(n!=="ignore"&&c!=="ignore"){if(a.test(r)===!1&&l.test(r)===!1)return o}else if(n!=="ignore"&&c==="ignore"){if(a.test(r)===!1)return o}else if(l.test(r)===!1)return o;return y(o,{protoAction:n,constructorAction:c,safe:e&&e.safe})}function y(r,{protoAction:t="error",constructorAction:e="error",safe:o}={}){let n=[r];for(;n.length;){let c=n;n=[];for(let s of c){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(o===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(e!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&s.constructor!==null&&typeof s.constructor=="object"&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(o===!0)return null;if(e==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(let h in s){let f=s[h];f&&typeof f=="object"&&n.push(f)}}}return r}function i(r,t,e){let{stackTraceLimit:o}=Error;Error.stackTraceLimit=0;try{return p(r,t,e)}finally{Error.stackTraceLimit=o}}function m(r,t){let{stackTraceLimit:e}=Error;Error.stackTraceLimit=0;try{return p(r,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=e}}u.exports=i;u.exports.default=i;u.exports.parse=i;u.exports.safeParse=m;u.exports.scan=y});function F(r){return g.default.parse(r,void 0,{protoAction:"remove",constructorAction:"remove"})}function j(r,t){try{return F(r)}catch(e){throw new Error(`Invalid JSON in --${t}: ${e instanceof Error?e.message:"Parse error"}`)}}var g,O=w(()=>{"use strict";g=T(d(),1)});export{d as a,F as b,j as c,O as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{a as b}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.0");process.exit(0)}
|
|
2
|
+
import{a as b}from"./chunk-HVB2L52I.js";import{c as k}from"./chunk-OXXMVQDF.js";import{b as p,d as C}from"./chunk-2DIT5AUU.js";C();b();var m=k.create("skill-validation-learner"),v=class{constructor(e){this.reasoningBank=e}reasoningBank;memoryNamespace="skill-validation";feedbackLoop=null;connectFeedbackLoop(e){this.feedbackLoop=e}async recordValidationOutcome(e){await this.reasoningBank.storeQEPattern({patternType:"test-template",name:`${e.skillName}-validation-${e.validationLevel}`,description:`Validation outcome for ${e.skillName} at level ${e.validationLevel}`,context:{tags:["skill-validation",e.skillName,e.model,e.validationLevel],testType:"integration"},template:{type:"config",content:JSON.stringify({outcome:{skillName:e.skillName,trustTier:e.trustTier,validationLevel:e.validationLevel,model:e.model,passed:e.passed,score:e.score,testCaseCount:e.testCaseResults.length,passedTests:e.testCaseResults.filter(s=>s.passed).length,avgReasoningQuality:this.calculateAvgReasoningQuality(e.testCaseResults),timestamp:e.timestamp.toISOString(),runId:e.runId,metadata:e.metadata}}),variables:[]}}),await this.updateSkillConfidence(e),e.validationLevel==="eval"&&await this.trackCrossModelBehavior(e),this.feedbackLoop&&e.runId&&await this.recordToFeedbackLoop(e)}async updateSkillConfidence(e){let s=`skill-confidence-${e.skillName}`,n=await this.reasoningBank.searchQEPatterns(s,{limit:1}),t;if(n.success&&n.value.length>0)try{let r=n.value[0].pattern.template?.content;if(r){let i=p(r);i&&typeof i=="object"&&Array.isArray(i.outcomes)?t=i:t=this.createEmptyConfidence(e.skillName)}else t=this.createEmptyConfidence(e.skillName)}catch(a){m.debug("Confidence history parse failed",{skill:e.skillName,error:a instanceof Error?a.message:String(a)}),t=this.createEmptyConfidence(e.skillName)}else t=this.createEmptyConfidence(e.skillName);t.outcomes.push({score:e.score,timestamp:e.timestamp,model:e.model,validationLevel:e.validationLevel,passed:e.passed}),t.outcomes.length>100&&(t.outcomes=t.outcomes.slice(-100)),t.avgScore=t.outcomes.reduce((a,r)=>a+r.score,0)/t.outcomes.length,t.lastUpdated=new Date,t.trend=this.calculateTrend(t.outcomes),t.byLevel=this.calculateConfidenceByLevel(t.outcomes),await this.reasoningBank.storeQEPattern({patternType:"test-template",name:s,description:`Skill confidence tracking for ${e.skillName}`,context:{tags:["skill-confidence",e.skillName]},template:{type:"config",content:JSON.stringify(t),variables:[]}})}async trackCrossModelBehavior(e){let s=`cross-model-${e.skillName}`,n=await this.reasoningBank.searchQEPatterns(s,{limit:1}),t;if(n.success&&n.value.length>0)try{let c=n.value[0].pattern.template?.content;if(c){let l=p(c);l&&typeof l=="object"&&typeof l.models=="object"?t=l:t=this.createEmptyCrossModelAnalysis()}else t=this.createEmptyCrossModelAnalysis()}catch(o){m.debug("Cross-model analysis parse failed",{error:o instanceof Error?o.message:String(o)}),t=this.createEmptyCrossModelAnalysis()}else t=this.createEmptyCrossModelAnalysis();t.models||(t.models={}),t.models[e.model]||(t.models[e.model]={scores:[],passRate:0,avgReasoningQuality:0,sampleCount:0});let a=t.models[e.model];a.scores.push(e.score),a.sampleCount++,a.scores.length>50&&(a.scores=a.scores.slice(-50));let r=this.calculateAvgReasoningQuality(e.testCaseResults);a.passRate=a.scores.filter(o=>o>=.9).length/a.scores.length,a.avgReasoningQuality=(a.avgReasoningQuality*(a.sampleCount-1)+r)/a.sampleCount;let i=Object.values(t.models).map(o=>o.passRate);if(i.length>1){let o=i.reduce((l,d)=>l+d,0)/i.length,c=i.reduce((l,d)=>l+Math.pow(d-o,2),0)/i.length;t.variance=c,t.hasAnomalies=c>.04,t.anomalies=[];for(let[l,d]of Object.entries(t.models))Math.abs(d.passRate-o)>.2&&t.anomalies.push({model:l,type:d.passRate<o?"low_performance":"high_variance",description:`Model ${l} has ${((d.passRate-o)*100).toFixed(1)}% difference from average`})}t.lastUpdated=new Date,await this.reasoningBank.storeQEPattern({patternType:"test-template",name:s,description:`Cross-model behavior tracking for ${e.skillName}`,context:{tags:["cross-model",e.skillName]},template:{type:"config",content:JSON.stringify(t),variables:[]}})}async recordToFeedbackLoop(e){if(!this.feedbackLoop)return;let s={taskId:e.runId,taskDescription:`Skill validation: ${e.skillName} (${e.validationLevel})`,recommendedAgent:"skill-validator",usedAgent:"skill-validator",followedRecommendation:!0,success:e.passed,qualityScore:e.score,durationMs:e.metadata?.duration||0,timestamp:e.timestamp};await this.feedbackLoop.recordRoutingOutcome(s)}async getSkillConfidence(e){let s=`skill-confidence-${e}`,n=await this.reasoningBank.searchQEPatterns(s,{limit:1});if(n.success&&n.value.length>0)try{let t=n.value[0].pattern.template?.content;if(t)return p(t)}catch(t){m.debug("Skill confidence pattern content invalid",{skill:e,error:t instanceof Error?t.message:String(t)})}return null}async getCrossModelAnalysis(e){let s=`cross-model-${e}`,n=await this.reasoningBank.searchQEPatterns(s,{limit:1});if(n.success&&n.value.length>0)try{let t=n.value[0].pattern.template?.content;if(t)return p(t)}catch(t){m.debug("Cross-model pattern content invalid",{skill:e,error:t instanceof Error?t.message:String(t)})}return null}async queryValidationPatterns(e,s=10){let n=await this.reasoningBank.searchQEPatterns(`${e} validation`,{limit:s});return n.success?n.value.filter(t=>t.pattern.context?.tags?.includes("skill-validation")).map(t=>t.pattern):[]}async getValidationTrends(e){let s=await this.getSkillConfidence(e),n=await this.getCrossModelAnalysis(e);if(!s)return null;let t={};if(n)for(let i of Object.keys(n.models)){let o=s.outcomes.filter(c=>c.model===i).map(c=>({score:c.score}));t[i]=this.calculateTrend(o)}let a=s.outcomes.slice(-20),r=a.filter(i=>i.passed).length/a.length;return{overall:s.trend||"stable",byModel:t,recentPassRate:r}}async extractLearnedPatterns(e){let s=await this.queryValidationPatterns(e,50),n=[],t=new Map;for(let a of s)try{let i=p(a.template?.content||"{}").outcome?.metadata?.category||"general";t.has(i)||t.set(i,[]),t.get(i).push(a)}catch(r){m.debug("Invalid pattern during category grouping",{error:r instanceof Error?r.message:String(r)})}for(let[a,r]of Array.from(t.entries())){let i=new Set,o=new Set,c=new Set,l=0;for(let d of r)try{let f=p(d.template?.content||"{}").outcome;if(!f)continue;c.add(f.model),l+=f.score;let h=d.context?.tags||[];f.passed?h.filter(g=>!["skill-validation",e].includes(g)).forEach(g=>i.add(g)):h.filter(g=>!["skill-validation",e].includes(g)).forEach(g=>o.add(g))}catch(u){m.debug("Invalid pattern during category extraction",{error:u instanceof Error?u.message:String(u)})}r.length>0&&n.push({id:`${e}-${a}`,skillName:e,category:a,successIndicators:Array.from(i),failureIndicators:Array.from(o),models:Array.from(c),confidence:l/r.length,observationCount:r.length})}return n}createEmptyConfidence(e){return{skillName:e,avgScore:0,outcomes:[],lastUpdated:new Date}}createEmptyCrossModelAnalysis(){return{models:{},variance:0,hasAnomalies:!1,lastUpdated:new Date}}calculateAvgReasoningQuality(e){return e.length===0?0:e.reduce((s,n)=>s+n.reasoningQuality,0)/e.length}calculateTrend(e){if(e.length<5)return"stable";let s=e.slice(-10),n=e.slice(-20,-10);if(n.length===0)return"stable";let t=s.reduce((i,o)=>i+o.score,0)/s.length,a=n.reduce((i,o)=>i+o.score,0)/n.length,r=t-a;return r>.05?"improving":r<-.05?"declining":"stable"}calculateConfidenceByLevel(e){let s={schema:[],validator:[],eval:[]};for(let t of e)t.validationLevel&&s[t.validationLevel].push(t.score);let n={};for(let[t,a]of Object.entries(s))a.length>0&&(n[t]=a.reduce((r,i)=>r+i,0)/a.length);return n}};function L(y){return new v(y)}export{L as a};
|
|
@@ -0,0 +1,153 @@
|
|
|
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.13.0");process.exit(0)}
|
|
2
|
+
import{a as P}from"./chunk-UMG5URNV.js";import{b as w}from"./chunk-KVL63BSU.js";import{e as S}from"./chunk-VLNPJAVH.js";import{a as H}from"./chunk-HVB2L52I.js";import{c as A}from"./chunk-OXXMVQDF.js";import{b as E,d as q}from"./chunk-2DIT5AUU.js";import{S as $,j as T}from"./chunk-3GSYD5SL.js";q();var W=["oracle:test-exec","judge:llm","proxy:structural"],d="proxy:structural";function j(n){return n&&W.includes(n)?n:d}function m(n,e={}){switch(j(n)){case"oracle:test-exec":return!0;case"judge:llm":return e.allowJudgeTier===!0;default:return!1}}import{createHash as O}from"node:crypto";function D(n,e){let t=n.length;if(t===0)return-1/0;let r=e?.iters??2e3,a=e?.alpha??.05,s=(e?.seed??2654435761)>>>0,o=()=>(s=Math.imul(s,1664525)+1013904223>>>0,s/4294967296),c=new Array(r);for(let u=0;u<r;u++){let l=0;for(let h=0;h<t;h++)l+=n[Math.floor(o()*t)];c[u]=l/t}c.sort((u,l)=>u-l);let i=Math.min(Math.floor(a*r),r-1);return c[i]}function L(n,e){let t=Math.min(n.length,e.length),r=new Array(t);for(let a=0;a<t;a++)r[a]=n[a]-e[a];return r}var U=n=>m(n.provenanceTier,{allowJudgeTier:n.allowJudgeTier})?n.candidateHeldOut>n.baselineHeldOut?w(n.candidateAnchorMean,n.baselineAnchorMean,n.anchorTol)?{promote:!0,reason:"held-out gain, no anchor regression, oracle-tier evidence"}:{promote:!1,reason:`anchor regression: ${n.candidateAnchorMean} < ${n.baselineAnchorMean} - ${n.anchorTol}`}:{promote:!1,reason:`held-out ${n.candidateHeldOut} did not beat baseline ${n.baselineHeldOut}`}:{promote:!1,reason:`provenance tier '${n.provenanceTier}' not allowed to promote`},C=8,x=1e-6,N=n=>n.reduce((e,t)=>e+t,0)/n.length,V=n=>{let e=U(n);if(!e.promote)return e;let t=n.candidateHeldOutSamples,r=n.baselineHeldOutSamples;if(!t||!r||t.length===0||t.length!==r.length)return{promote:!1,reason:"significance gate: missing/mismatched paired held-out samples (need equal-length candidate & baseline per-task vectors)"};if(t.length<C)return{promote:!1,reason:`significance gate: only ${t.length} paired samples (< ${C}) \u2014 a bootstrap CI is not meaningful; fail closed rather than certify noise`};if(Math.abs(N(t)-n.candidateHeldOut)>x||Math.abs(N(r)-n.baselineHeldOut)>x)return{promote:!1,reason:"significance gate: sealed sample means do not match the sealed held-out scalars \u2014 inconsistent/forged evaluation"};let a=D(L(t,r));return a>0?{promote:!0,reason:`${e.reason}; paired gain significant (CI low ${a.toFixed(4)} > 0)`}:{promote:!1,reason:`significance gate: paired held-out gain not significant (95% CI lower bound ${a.toFixed(4)} \u2264 0)`}},se=Object.freeze({"accept/v1":U,"accept/v1+sig":V});function _(n){if(n===null||typeof n!="object")return JSON.stringify(n)??"null";if(Array.isArray(n))return`[${n.map(_).join(",")}]`;let e=n;return`{${Object.keys(e).filter(r=>e[r]!==void 0).sort().map(r=>`${JSON.stringify(r)}:${_(e[r])}`).join(",")}}`}var Q="aqe:promotion-path-rule:v1+sig",J=n=>m(n.provenanceTier,{allowJudgeTier:n.allowJudgeTier})?n.reward===void 0||n.rewardThreshold===void 0||!(n.reward>=n.rewardThreshold)?{promote:!1,reason:`reward ${n.reward} below threshold ${n.rewardThreshold}`}:n.occurrences===void 0||n.occurrenceThreshold===void 0||!(n.occurrences>=n.occurrenceThreshold)?{promote:!1,reason:`occurrences ${n.occurrences} below threshold ${n.occurrenceThreshold}`}:n.successRate===void 0||n.successRateThreshold===void 0||!(n.successRate>=n.successRateThreshold)?{promote:!1,reason:`success rate ${n.successRate} below threshold ${n.successRateThreshold}`}:n.withinActivityWindow!==!0?{promote:!1,reason:"pattern outside promotion activity window (stale)"}:{promote:!0,reason:"tier allowed; reward/occurrence/success-rate thresholds met; within activity window"}:{promote:!1,reason:`provenance tier '${n.provenanceTier}' not allowed to promote`},G=n=>m(n.provenanceTier,{allowJudgeTier:n.allowJudgeTier})?n.insightConfidence===void 0||n.insightConfidenceThreshold===void 0||!(n.insightConfidence>=n.insightConfidenceThreshold)?{promote:!1,reason:`insight confidence ${n.insightConfidence} below threshold ${n.insightConfidenceThreshold}`}:n.insightActionable!==!0?{promote:!1,reason:"insight produced no actionable reorganization"}:{promote:!0,reason:"tier allowed; insight confidence meets threshold; actionable"}:{promote:!1,reason:`provenance tier '${n.provenanceTier}' not allowed to apply`},M=Object.freeze({"pattern-promote/v1":J,"dream-apply/v1":G});function b(n){return O("sha256").update(_(n)).digest("hex")}function y(n){if(!(n in M))throw new Error(`Unknown promotion-path rule version '${n}' \u2014 cannot fingerprint an unregistered rule.`);return O("sha256").update(Q).update("\0").update(n).digest("hex")}function R(n,e){let t=M[n];if(!t)throw new Error(`Unknown promotion-path rule version '${n}' \u2014 refusing to re-execute an unregistered rule.`);return t(e)}function I(n,e={}){let t=[],r=b(n.sealed)===n.sealedHash;r||t.push("sealIntact");let a=!1;try{let c=y(n.ruleVersion);a=n.ruleFingerprint===c&&(e.pinnedRuleFingerprint===void 0||n.ruleFingerprint===e.pinnedRuleFingerprint)}catch{a=!1}a||t.push("gateUnchanged");let s=!1;r&&a&&(s=(R(n.ruleVersion,n.sealed).promote?"promote":"reject")===n.recordedVerdict),s||t.push("gateReExecutes");let o=t.length===0;return{valid:o,checks:{sealIntact:r,gateUnchanged:a,gateReExecutes:s},failures:t,reason:o?"promotion verified: sealed inputs intact, rule unchanged, frozen rule re-execution reproduces the recorded verdict":`promotion INVALID (failed: ${t.join(", ")}) \u2014 the recorded verdict is not reproducible under the frozen rule`}}H();$();var p=A.create("pattern-lifecycle"),z={promotionRewardThreshold:.7,promotionMinOccurrences:S,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3,maxAgeForActivePatterns:90,promotionActivityWindowDays:30,asymmetricLearning:{},allowJudgeTierPromotion:!1},k=5,B=.9,X=2;function Y(n,e){return e<k||!Number.isFinite(n)?0:Math.min(Math.max(n,0),1)}var v=class{constructor(e,t={}){this.db=e;this.config={...z,...t},this.asymmetricEngine=new P(this.config.asymmetricLearning),this.ensureSchema()}db;config;asymmetricEngine;_witnessChain=null;set witnessChain(e){this._witnessChain=e}_compressionService=null;set compressionService(e){this._compressionService=e}ensureSchema(){try{this.db.prepare(`
|
|
3
|
+
SELECT deprecated_at FROM qe_patterns LIMIT 1
|
|
4
|
+
`).get()}catch(e){p.debug("Adding missing deprecated_at column",{error:e instanceof Error?e.message:String(e)}),this.db.exec(`
|
|
5
|
+
ALTER TABLE qe_patterns ADD COLUMN deprecated_at TEXT DEFAULT NULL
|
|
6
|
+
`),console.log("[PatternLifecycle] Added deprecated_at column to qe_patterns")}try{this.db.prepare(`
|
|
7
|
+
SELECT consecutive_failures FROM qe_patterns LIMIT 1
|
|
8
|
+
`).get()}catch(e){p.debug("Adding missing consecutive_failures column",{error:e instanceof Error?e.message:String(e)}),this.db.exec(`
|
|
9
|
+
ALTER TABLE qe_patterns ADD COLUMN consecutive_failures INTEGER DEFAULT 0
|
|
10
|
+
`),console.log("[PatternLifecycle] Added consecutive_failures column to qe_patterns")}try{this.db.prepare(`
|
|
11
|
+
SELECT promotion_date FROM qe_patterns LIMIT 1
|
|
12
|
+
`).get()}catch(e){p.debug("Adding missing promotion_date column",{error:e instanceof Error?e.message:String(e)}),this.db.exec(`
|
|
13
|
+
ALTER TABLE qe_patterns ADD COLUMN promotion_date TEXT DEFAULT NULL
|
|
14
|
+
`),console.log("[PatternLifecycle] Added promotion_date column to qe_patterns")}try{this.db.prepare(`
|
|
15
|
+
SELECT provenance_tier FROM qe_patterns LIMIT 1
|
|
16
|
+
`).get()}catch(e){p.debug("Adding missing provenance_tier column",{error:e instanceof Error?e.message:String(e)}),this.db.exec(`
|
|
17
|
+
ALTER TABLE qe_patterns ADD COLUMN provenance_tier TEXT DEFAULT '${d}'
|
|
18
|
+
`),console.log(`[PatternLifecycle] Added provenance_tier column to qe_patterns (backfilled '${d}')`)}}getRecentExperiences(e={}){let t=e.minReward??this.config.promotionRewardThreshold,r=e.limit??100,a=e.sinceDays??7;if(!this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='captured_experiences'").get())return p.debug("captured_experiences table not found"),[];let o=new Date(Date.now()-a*864e5).toISOString().replace("T"," ").slice(0,19);return this.db.prepare(`
|
|
19
|
+
SELECT
|
|
20
|
+
domain as task_type,
|
|
21
|
+
COUNT(*) as count,
|
|
22
|
+
AVG(quality) as avg_reward,
|
|
23
|
+
MAX(quality) as max_reward,
|
|
24
|
+
MIN(quality) as min_reward,
|
|
25
|
+
SUM(CASE WHEN quality >= ? THEN 1 ELSE 0 END) as success_count,
|
|
26
|
+
GROUP_CONCAT(DISTINCT agent) as actions,
|
|
27
|
+
MAX(started_at) as latest_at
|
|
28
|
+
FROM captured_experiences
|
|
29
|
+
WHERE started_at >= ?
|
|
30
|
+
AND quality >= ?
|
|
31
|
+
AND agent != 'cli-hook'
|
|
32
|
+
GROUP BY domain
|
|
33
|
+
HAVING COUNT(*) >= ?
|
|
34
|
+
ORDER BY avg_reward DESC
|
|
35
|
+
LIMIT ?
|
|
36
|
+
`).all(t,o,t*.5,this.config.promotionMinOccurrences,r).map(i=>({taskType:i.task_type,domain:this.taskTypeToQEDomain(i.task_type),count:i.count,avgReward:i.avg_reward,maxReward:i.max_reward,minReward:i.min_reward,actions:i.actions?i.actions.split(",").filter(Boolean):[],successCount:i.success_count,latestAt:new Date(i.latest_at)}))}taskTypeToQEDomain(e){let t={generate:"test-generation","test-generation":"test-generation",test:"test-generation",analyze:"coverage-analysis",coverage:"coverage-analysis","coverage-analysis":"coverage-analysis",run:"test-execution",execute:"test-execution","test-execution":"test-execution",report:"quality-assessment",quality:"quality-assessment",assessment:"quality-assessment",security:"security-compliance",sast:"security-compliance",audit:"security-compliance",defect:"defect-intelligence",predict:"defect-intelligence",bug:"defect-intelligence",requirements:"requirements-validation",validation:"requirements-validation",code:"code-intelligence",complexity:"code-intelligence",contract:"contract-testing",api:"contract-testing",visual:"visual-accessibility",a11y:"visual-accessibility",accessibility:"visual-accessibility",chaos:"chaos-resilience",resilience:"chaos-resilience",flaky:"chaos-resilience",learning:"learning-optimization",optimize:"learning-optimization"},r=e.toLowerCase();for(let[a,s]of Object.entries(t))if(r.includes(a))return s;return null}taskTypeToPatternType(e){let t={generate:"test-template",test:"test-template",coverage:"coverage-strategy",analyze:"coverage-strategy",mock:"mock-pattern",stub:"mock-pattern",assert:"assertion-pattern",expect:"assertion-pattern",security:"assertion-pattern",contract:"api-contract",api:"api-contract",visual:"visual-baseline",screenshot:"visual-baseline",a11y:"a11y-check",accessibility:"a11y-check",perf:"perf-benchmark",load:"perf-benchmark",stress:"perf-benchmark",flaky:"flaky-fix",retry:"flaky-fix",refactor:"refactor-safe",error:"error-handling",exception:"error-handling"},r=e.toLowerCase();for(let[a,s]of Object.entries(t))if(r.includes(a))return s;return"test-template"}findPatternCandidates(e){let t=[];for(let r of e){let a=r.avgReward>=this.config.promotionRewardThreshold,s=r.count>=this.config.promotionMinOccurrences,o=r.successCount/r.count,c=o>=this.config.promotionMinSuccessRate;if(a&&s&&c){let i=r.domain||"code-intelligence",u=this.taskTypeToPatternType(r.taskType);if(this.findExistingPattern(r.taskType,i))continue;t.push({name:`${r.taskType}-success-pattern`,domain:i,patternType:u,confidence:Math.min(.95,r.avgReward*.9),sourceExperiences:r.count,avgReward:r.avgReward,successRate:o,actions:r.actions.slice(0,5),templateContent:this.generateTemplateContent(r)})}}return t}findExistingPattern(e,t){let r=this.db.prepare(`
|
|
37
|
+
SELECT * FROM qe_patterns
|
|
38
|
+
WHERE name LIKE ? AND qe_domain = ? AND deprecated_at IS NULL
|
|
39
|
+
LIMIT 1
|
|
40
|
+
`).get(`%${e}%`,t);return r?this.rowToPattern(r):null}generateTemplateContent(e){let t=e.actions.map((r,a)=>`${a+1}. ${r}`).join(`
|
|
41
|
+
`);return`Task Type: ${e.taskType}
|
|
42
|
+
Domain: ${e.domain||"general"}
|
|
43
|
+
Average Reward: ${e.avgReward.toFixed(3)}
|
|
44
|
+
Success Rate: ${(e.successCount/e.count*100).toFixed(1)}%
|
|
45
|
+
|
|
46
|
+
Typical Actions:
|
|
47
|
+
${t||"N/A"}
|
|
48
|
+
|
|
49
|
+
Pattern extracted from ${e.count} successful experiences.`}getProvenanceTier(e){try{return this.db.prepare("SELECT provenance_tier FROM qe_patterns WHERE id = ?").get(e)?.provenance_tier??d}catch{return d}}checkPromotion(e){let t=this.getPattern(e);if(!t)return{shouldPromote:!1,meetsRewardThreshold:!1,meetsOccurrenceThreshold:!1,meetsSuccessRateThreshold:!1,meetsActivityWindow:!1,currentReward:0,currentOccurrences:0,currentSuccessRate:0,provenanceTier:d,meetsProvenanceTier:!1};let r=t.qualityScore,a=r>=this.config.promotionRewardThreshold,s=t.usageCount>=this.config.promotionMinOccurrences,o=t.successRate>=this.config.promotionMinSuccessRate,c=this.getProvenanceTier(e),i=m(c,{allowJudgeTier:this.config.allowJudgeTierPromotion}),u=this.config.promotionActivityWindowDays*24*60*60*1e3,l=t.lastUsedAt?.getTime()??t.createdAt.getTime(),h=Date.now()-l<u;return{shouldPromote:t.tier==="short-term"&&i&&a&&s&&o&&h,meetsRewardThreshold:a,meetsOccurrenceThreshold:s,meetsSuccessRateThreshold:o,meetsActivityWindow:h,provenanceTier:c,meetsProvenanceTier:i,currentReward:r,currentOccurrences:t.usageCount,currentSuccessRate:t.successRate}}promotePattern(e){let t=this.checkPromotion(e);if(!t.shouldPromote)return!1;let r={provenanceTier:t.provenanceTier,allowJudgeTier:this.config.allowJudgeTierPromotion,reward:t.currentReward,rewardThreshold:this.config.promotionRewardThreshold,occurrences:t.currentOccurrences,occurrenceThreshold:this.config.promotionMinOccurrences,successRate:t.currentSuccessRate,successRateThreshold:this.config.promotionMinSuccessRate,withinActivityWindow:t.meetsActivityWindow},a=R("pattern-promote/v1",r),s={ruleVersion:"pattern-promote/v1",ruleFingerprint:y("pattern-promote/v1"),sealedHash:b(r),sealed:r,recordedVerdict:a.promote?"promote":"reject"},o=I(s);return!o.valid||!a.promote?(console.warn(`[PatternLifecycle] Refusing to promote ${e}: ${a.reason} (${o.reason})`),!1):(this.db.prepare(`
|
|
50
|
+
UPDATE qe_patterns
|
|
51
|
+
SET tier = 'long-term',
|
|
52
|
+
promotion_date = datetime('now'),
|
|
53
|
+
confidence = MIN(1.0, confidence + 0.1),
|
|
54
|
+
updated_at = datetime('now')
|
|
55
|
+
WHERE id = ?
|
|
56
|
+
`).run(e),console.log(`[PatternLifecycle] Promoted pattern ${e} to long-term`),!0)}promoteEligiblePatterns(){let e=this.db.prepare(`
|
|
57
|
+
SELECT id FROM qe_patterns
|
|
58
|
+
WHERE tier = 'short-term' AND deprecated_at IS NULL
|
|
59
|
+
`).all(),t=0;for(let{id:r}of e)this.promotePattern(r)&&t++;return{promoted:t,checked:e.length}}runPromotionSweep(){return this.promoteEligiblePatterns()}checkDeprecation(e){let t=this.getPattern(e);if(!t)return{shouldDeprecate:!1,reason:null};if(t.deprecated_at)return{shouldDeprecate:!1,reason:null};let r=t.consecutive_failures||0;if(r>=this.config.deprecationFailureThreshold)return{shouldDeprecate:!0,reason:"failures",consecutiveFailures:r};let a=t.lastUsedAt instanceof Date?t.lastUsedAt.getTime():new Date(t.lastUsedAt).getTime(),s=(Date.now()-a)/(1e3*60*60*24),o=Y(t.successRate,t.usageCount),c=this.config.staleDaysThreshold*(1+o*X);if(s>=c)return{shouldDeprecate:!0,reason:"stale",daysSinceLastUse:s};if(t.confidence<this.config.minActiveConfidence)return{shouldDeprecate:!0,reason:"low_confidence",currentConfidence:t.confidence};let i=t.createdAt instanceof Date?t.createdAt.getTime():new Date(t.createdAt).getTime(),u=(Date.now()-i)/(1e3*60*60*24);return u>=this.config.maxAgeForActivePatterns&&t.usageCount<5?{shouldDeprecate:!0,reason:"age",ageInDays:u}:{shouldDeprecate:!1,reason:null}}deprecatePattern(e,t){let r=this.checkDeprecation(e);if(!r.shouldDeprecate&&!t)return!1;let a=t||r.reason||"manual";this.db.prepare(`
|
|
60
|
+
UPDATE qe_patterns
|
|
61
|
+
SET deprecated_at = datetime('now'),
|
|
62
|
+
updated_at = datetime('now')
|
|
63
|
+
WHERE id = ?
|
|
64
|
+
`).run(e);let s=this.getPattern(e);if(s){let o={deprecation_reason:a,deprecated_at:new Date().toISOString(),final_confidence:s.confidence,final_success_rate:s.successRate,total_usage:s.usageCount};this.db.prepare(`
|
|
65
|
+
UPDATE qe_patterns
|
|
66
|
+
SET context_json = json_patch(COALESCE(context_json, '{}'), ?)
|
|
67
|
+
WHERE id = ?
|
|
68
|
+
`).run(JSON.stringify({deprecation_metadata:o}),e)}return console.log(`[PatternLifecycle] Deprecated pattern ${e}: ${a}`),!0}deprecateStalePatterns(){let e=this.db.prepare(`
|
|
69
|
+
SELECT id FROM qe_patterns
|
|
70
|
+
WHERE deprecated_at IS NULL
|
|
71
|
+
`).all(),t=0;for(let{id:r}of e){let a=this.checkDeprecation(r);a.shouldDeprecate&&(this.deprecatePattern(r,a.reason||void 0),t++)}return{deprecated:t,checked:e.length}}applyConfidenceDecay(e=1){let t=this.config.confidenceDecayRate*e,r=Date.now()-e*24*60*60*1e3,a=this.db.prepare(`
|
|
72
|
+
UPDATE qe_patterns
|
|
73
|
+
SET confidence = MAX(?, confidence * (1 - ? * (1 - ? *
|
|
74
|
+
(CASE WHEN usage_count >= ?
|
|
75
|
+
THEN MIN(MAX(COALESCE(success_rate, 0.0), 0.0), 1.0)
|
|
76
|
+
ELSE 0.0 END)))),
|
|
77
|
+
updated_at = datetime('now')
|
|
78
|
+
WHERE deprecated_at IS NULL
|
|
79
|
+
AND (last_used_at IS NULL OR datetime(last_used_at) < datetime(?, 'unixepoch'))
|
|
80
|
+
`).run(this.config.minActiveConfidence,t,B,k,r/1e3);return{updated:a.changes,decayed:a.changes}}recordUsage(e,t){t?this.db.prepare(`
|
|
81
|
+
UPDATE qe_patterns
|
|
82
|
+
SET usage_count = usage_count + 1,
|
|
83
|
+
successful_uses = successful_uses + 1,
|
|
84
|
+
consecutive_failures = 0,
|
|
85
|
+
confidence = MIN(1.0, confidence + 0.02),
|
|
86
|
+
success_rate = CAST(successful_uses + 1 AS REAL) / CAST(usage_count + 1 AS REAL),
|
|
87
|
+
last_used_at = datetime('now'),
|
|
88
|
+
updated_at = datetime('now')
|
|
89
|
+
WHERE id = ?
|
|
90
|
+
`).run(e):this.db.prepare(`
|
|
91
|
+
UPDATE qe_patterns
|
|
92
|
+
SET usage_count = usage_count + 1,
|
|
93
|
+
consecutive_failures = consecutive_failures + 1,
|
|
94
|
+
confidence = MAX(0.1, confidence - 0.05),
|
|
95
|
+
success_rate = CAST(successful_uses AS REAL) / CAST(usage_count + 1 AS REAL),
|
|
96
|
+
last_used_at = datetime('now'),
|
|
97
|
+
updated_at = datetime('now')
|
|
98
|
+
WHERE id = ?
|
|
99
|
+
`).run(e),this.db.prepare(`
|
|
100
|
+
UPDATE qe_patterns
|
|
101
|
+
SET quality_score = confidence * 0.3 + (MIN(usage_count, 100) / 100.0) * 0.2 + success_rate * 0.5
|
|
102
|
+
WHERE id = ?
|
|
103
|
+
`).run(e)}recordAsymmetricOutcome(e,t,r){let a=this.getPattern(e);if(!a)return;let s=a.confidence,o=this.asymmetricEngine.computeConfidenceUpdate(s,t?"success":"failure",r);this.db.prepare(`
|
|
104
|
+
UPDATE qe_patterns
|
|
105
|
+
SET confidence = ?,
|
|
106
|
+
usage_count = usage_count + 1,
|
|
107
|
+
successful_uses = CASE WHEN ? THEN successful_uses + 1 ELSE successful_uses END,
|
|
108
|
+
consecutive_failures = CASE WHEN ? THEN 0 ELSE consecutive_failures + 1 END,
|
|
109
|
+
success_rate = CAST(CASE WHEN ? THEN successful_uses + 1 ELSE successful_uses END AS REAL) / CAST(usage_count + 1 AS REAL),
|
|
110
|
+
last_used_at = datetime('now'),
|
|
111
|
+
updated_at = datetime('now')
|
|
112
|
+
WHERE id = ?
|
|
113
|
+
`).run(o,t?1:0,t?1:0,t?1:0,e),this.asymmetricEngine.shouldQuarantine(o,r).shouldQuarantine&&this.quarantinePattern(e)}quarantinePattern(e){if(this.db.prepare(`
|
|
114
|
+
UPDATE qe_patterns
|
|
115
|
+
SET deprecated_at = datetime('now'),
|
|
116
|
+
updated_at = datetime('now')
|
|
117
|
+
WHERE id = ? AND deprecated_at IS NULL
|
|
118
|
+
`).run(e).changes>0){console.log(`[PatternLifecycle] Quarantined pattern ${e} (asymmetric confidence drop)`);try{this._witnessChain?.append("PATTERN_QUARANTINE",{patternId:e},"pattern-lifecycle")}catch{}return!0}return!1}checkRehabilitation(e,t){return this.asymmetricEngine.checkRehabilitation(t).canRehabilitate}rehabilitatePattern(e){return this.db.prepare(`
|
|
119
|
+
UPDATE qe_patterns
|
|
120
|
+
SET deprecated_at = NULL,
|
|
121
|
+
consecutive_failures = 0,
|
|
122
|
+
confidence = 0.5,
|
|
123
|
+
updated_at = datetime('now')
|
|
124
|
+
WHERE id = ?
|
|
125
|
+
`).run(e).changes>0?(console.log(`[PatternLifecycle] Rehabilitated pattern ${e} (10+ consecutive successes)`),!0):!1}getAsymmetricEngine(){return this.asymmetricEngine}compressPatternEmbedding(e){if(!T()||!this._compressionService)return null;let t=this.getPattern(e);if(!t||!t.embedding||t.embedding.length===0)return null;let r=t.lastUsedAt??t.createdAt,a=this._compressionService.classifyTier(r),s=new Float32Array(t.embedding),o=this._compressionService.compress(s,a);return p.debug("Compressed pattern embedding",{patternId:e,tier:a,ratio:(o.originalByteSize/o.compressedByteSize).toFixed(1)}),o}decompressPatternEmbedding(e){return this._compressionService?this._compressionService.decompress(e):null}compressAllPatternEmbeddings(){if(!T()||!this._compressionService)return 0;let e=this.db.prepare(`
|
|
126
|
+
SELECT id FROM qe_patterns
|
|
127
|
+
WHERE deprecated_at IS NULL
|
|
128
|
+
`).all(),t=0;for(let{id:r}of e)this.compressPatternEmbedding(r)&&t++;return p.info("Bulk pattern embedding compression complete",{total:e.length,compressed:t}),t}getStats(){let e=this.db.prepare(`
|
|
129
|
+
SELECT
|
|
130
|
+
COUNT(*) as total,
|
|
131
|
+
SUM(CASE WHEN deprecated_at IS NULL THEN 1 ELSE 0 END) as active,
|
|
132
|
+
SUM(CASE WHEN deprecated_at IS NOT NULL THEN 1 ELSE 0 END) as deprecated,
|
|
133
|
+
SUM(CASE WHEN tier = 'long-term' AND deprecated_at IS NULL THEN 1 ELSE 0 END) as promoted,
|
|
134
|
+
SUM(CASE WHEN tier = 'short-term' AND deprecated_at IS NULL THEN 1 ELSE 0 END) as short_term,
|
|
135
|
+
SUM(CASE WHEN tier = 'long-term' THEN 1 ELSE 0 END) as long_term,
|
|
136
|
+
AVG(CASE WHEN deprecated_at IS NULL THEN confidence ELSE NULL END) as avg_confidence,
|
|
137
|
+
AVG(CASE WHEN deprecated_at IS NULL THEN success_rate ELSE NULL END) as avg_success_rate
|
|
138
|
+
FROM qe_patterns
|
|
139
|
+
`).get(),t=this.db.prepare(`
|
|
140
|
+
SELECT COUNT(*) as count
|
|
141
|
+
FROM qe_patterns
|
|
142
|
+
WHERE deprecated_at IS NULL
|
|
143
|
+
AND (
|
|
144
|
+
consecutive_failures >= ?
|
|
145
|
+
OR confidence < ?
|
|
146
|
+
OR (julianday('now') - julianday(COALESCE(last_used_at, created_at))) >= ?
|
|
147
|
+
)
|
|
148
|
+
`).get(this.config.deprecationFailureThreshold-1,this.config.minActiveConfidence+.1,this.config.staleDaysThreshold-7);return{totalPatterns:e.total||0,activePatterns:e.active||0,deprecatedPatterns:e.deprecated||0,promotedPatterns:e.promoted||0,shortTermPatterns:e.short_term||0,longTermPatterns:e.long_term||0,avgConfidence:e.avg_confidence||0,avgSuccessRate:e.avg_success_rate||0,patternsNearDeprecation:t.count||0}}getPattern(e){let t=this.db.prepare(`
|
|
149
|
+
SELECT * FROM qe_patterns WHERE id = ?
|
|
150
|
+
`).get(e);return t?this.rowToPattern(t):null}rowToPattern(e){return{id:e.id,patternType:e.pattern_type,qeDomain:e.qe_domain,domain:e.domain,name:e.name,description:e.description||"",confidence:e.confidence,usageCount:e.usage_count,successRate:e.success_rate,qualityScore:e.quality_score,tier:e.tier,template:E(e.template_json||"{}"),context:E(e.context_json||"{}"),createdAt:new Date(e.created_at),lastUsedAt:e.last_used_at?new Date(e.last_used_at):new Date(e.created_at),successfulUses:e.successful_uses,reusable:e.reusable===1,reuseCount:e.reuse_count||0,averageTokenSavings:e.average_token_savings||0,deprecated_at:e.deprecated_at??null,consecutive_failures:e.consecutive_failures??0}}};function ge(n,e){return new v(n,e)}import*as g from"fs";import*as f from"path";var K={"pattern-learned":"\u{1F9E0}","pattern-promoted":"\u2B06\uFE0F","pattern-quarantined":"\u{1F512}","experience-captured":"\u{1F4F8}","search-performed":"\u{1F50D}","reward-assigned":"\u{1F3AF}"},F=class{config;buffer=[];flushTimer=null;constructor(e){this.config={logDir:e?.logDir??f.join(process.cwd(),".agentic-qe","logs"),enabled:e?.enabled??!0,maxEntriesPerDay:e?.maxEntriesPerDay??500}}log(e){this.config.enabled&&(this.buffer.push(e),this.buffer.length>=10&&this.flush())}flush(){if(this.buffer.length===0)return;let e=new Date().toISOString().split("T")[0],t=f.join(this.config.logDir,`${e}.md`);try{g.mkdirSync(this.config.logDir,{recursive:!0});let r=this.buffer.splice(0,this.buffer.length),a=[];g.existsSync(t)||(a.push(`# AQE Daily Log \u2014 ${e}
|
|
151
|
+
`),a.push("| Time | Event | Summary |"),a.push("|------|-------|---------|"));for(let s of r){let o=s.timestamp.toISOString().split("T")[1]?.slice(0,8)??"00:00:00",c=K[s.type]??"\u{1F4DD}",i=s.summary.replace(/\\/g,"\\\\").replace(/\|/g,"\\|").replace(/\n/g," ");a.push(`| ${o} | ${c} ${s.type} | ${i} |`)}g.appendFileSync(t,a.join(`
|
|
152
|
+
`)+`
|
|
153
|
+
`)}catch(r){console.debug("[DailyLog] Write failed:",r)}}getTodayLogPath(){let e=new Date().toISOString().split("T")[0];return f.join(this.config.logDir,`${e}.md`)}dispose(){this.flush(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}};export{ge as a,F as b};
|