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
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-restore for the unified `memory.db` (M3.2, inspired by ruflo v3.25.2's
|
|
3
|
+
* backup-auto-restore, adapted to better-sqlite3).
|
|
4
|
+
*
|
|
5
|
+
* Hardened after a qe-court review (ADR-124) surfaced three data-loss risks in
|
|
6
|
+
* the first cut:
|
|
7
|
+
* F3 — `isDbHealthy` via a readonly open + integrity_check FALSE-NEGATIVES a
|
|
8
|
+
* HEALTHY WAL db when `-shm` is zeroed/inaccessible over virtiofs (the
|
|
9
|
+
* exact documented failure mode), which would have parked a good DB and
|
|
10
|
+
* reverted to an older backup. FIX: the live-corruption signal is now the
|
|
11
|
+
* SQLite HEADER — a `-wal`/`-shm` problem does not corrupt the main file,
|
|
12
|
+
* so we only treat a missing/garbage header (zeroed/not-a-db) as corrupt.
|
|
13
|
+
* F2 — non-atomic `copyFileSync` + no lock let concurrent hook processes tear
|
|
14
|
+
* the restored image. FIX: copy to a temp in the same dir → atomic rename,
|
|
15
|
+
* under a best-effort exclusive lock so only one process restores.
|
|
16
|
+
* backup trust — a backup we are about to promote to the LIVE db still gets a
|
|
17
|
+
* FULL `integrity_check` (it is a static file, safe to open readonly).
|
|
18
|
+
*
|
|
19
|
+
* DATA-PROTECTION INVARIANTS (this file must never make things worse):
|
|
20
|
+
* - The corrupt original is RENAMED to `<db>.corrupt-<ts>`, NEVER deleted.
|
|
21
|
+
* - A header-valid main file is treated as HEALTHY — we never park a DB that
|
|
22
|
+
* might just have a transient `-wal`/`-shm` issue (a writable open rebuilds
|
|
23
|
+
* `-shm`). We prefer "manual restore" over "auto-destroy a healthy DB".
|
|
24
|
+
* - A backup is used only if it passes `PRAGMA integrity_check`.
|
|
25
|
+
* - If no verified backup exists, we do NOTHING (leave the DB for inspection).
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* True if the main DB file is structurally a database (or absent/empty = a fresh
|
|
29
|
+
* DB the caller will create). LIVE-corruption signal only: it deliberately does
|
|
30
|
+
* NOT open the DB or run integrity_check, because a `-wal`/`-shm` fault over
|
|
31
|
+
* virtiofs makes a HEALTHY db unreadable and we must not mistake that for
|
|
32
|
+
* corruption (F3). Only a missing/garbage header — the zeroed/not-a-db case —
|
|
33
|
+
* is "corrupt". A header-valid-but-page-corrupt file is left for MANUAL restore
|
|
34
|
+
* rather than risk auto-parking a healthy DB.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isDbHealthy(dbPath: string): boolean;
|
|
37
|
+
export interface RestoreResult {
|
|
38
|
+
restored: boolean;
|
|
39
|
+
reason: 'healthy' | 'no-verified-backup' | 'restored-from-backup' | 'restore-in-progress' | 'park-failed' | 'copy-failed';
|
|
40
|
+
backupUsed?: string;
|
|
41
|
+
parkedTo?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Default verified-backup directory (matches `scripts/aqe-db-backup.sh`). */
|
|
44
|
+
export declare function defaultBackupDir(dbPath: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* If `dbPath`'s main file is unambiguously corrupt (bad SQLite header), park it
|
|
47
|
+
* and atomically restore the newest verified backup. No-op (and non-destructive)
|
|
48
|
+
* when the DB is healthy, when no good backup exists, or when another process is
|
|
49
|
+
* already restoring.
|
|
50
|
+
*/
|
|
51
|
+
export declare function attemptAutoRestore(dbPath: string, opts?: {
|
|
52
|
+
backupDir?: string;
|
|
53
|
+
now?: number;
|
|
54
|
+
}): RestoreResult;
|
|
55
|
+
//# sourceMappingURL=db-recovery.d.ts.map
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-restore for the unified `memory.db` (M3.2, inspired by ruflo v3.25.2's
|
|
3
|
+
* backup-auto-restore, adapted to better-sqlite3).
|
|
4
|
+
*
|
|
5
|
+
* Hardened after a qe-court review (ADR-124) surfaced three data-loss risks in
|
|
6
|
+
* the first cut:
|
|
7
|
+
* F3 — `isDbHealthy` via a readonly open + integrity_check FALSE-NEGATIVES a
|
|
8
|
+
* HEALTHY WAL db when `-shm` is zeroed/inaccessible over virtiofs (the
|
|
9
|
+
* exact documented failure mode), which would have parked a good DB and
|
|
10
|
+
* reverted to an older backup. FIX: the live-corruption signal is now the
|
|
11
|
+
* SQLite HEADER — a `-wal`/`-shm` problem does not corrupt the main file,
|
|
12
|
+
* so we only treat a missing/garbage header (zeroed/not-a-db) as corrupt.
|
|
13
|
+
* F2 — non-atomic `copyFileSync` + no lock let concurrent hook processes tear
|
|
14
|
+
* the restored image. FIX: copy to a temp in the same dir → atomic rename,
|
|
15
|
+
* under a best-effort exclusive lock so only one process restores.
|
|
16
|
+
* backup trust — a backup we are about to promote to the LIVE db still gets a
|
|
17
|
+
* FULL `integrity_check` (it is a static file, safe to open readonly).
|
|
18
|
+
*
|
|
19
|
+
* DATA-PROTECTION INVARIANTS (this file must never make things worse):
|
|
20
|
+
* - The corrupt original is RENAMED to `<db>.corrupt-<ts>`, NEVER deleted.
|
|
21
|
+
* - A header-valid main file is treated as HEALTHY — we never park a DB that
|
|
22
|
+
* might just have a transient `-wal`/`-shm` issue (a writable open rebuilds
|
|
23
|
+
* `-shm`). We prefer "manual restore" over "auto-destroy a healthy DB".
|
|
24
|
+
* - A backup is used only if it passes `PRAGMA integrity_check`.
|
|
25
|
+
* - If no verified backup exists, we do NOTHING (leave the DB for inspection).
|
|
26
|
+
*/
|
|
27
|
+
import { existsSync, renameSync, copyFileSync, readdirSync, statSync, openSync, readSync, closeSync, writeFileSync, rmSync, } from 'node:fs';
|
|
28
|
+
import { join, dirname } from 'node:path';
|
|
29
|
+
import Database from 'better-sqlite3';
|
|
30
|
+
/** The 16-byte magic every valid SQLite database file starts with. */
|
|
31
|
+
const SQLITE_MAGIC = Buffer.concat([Buffer.from('SQLite format 3', 'latin1'), Buffer.from([0])]);
|
|
32
|
+
/**
|
|
33
|
+
* True if the main DB file is structurally a database (or absent/empty = a fresh
|
|
34
|
+
* DB the caller will create). LIVE-corruption signal only: it deliberately does
|
|
35
|
+
* NOT open the DB or run integrity_check, because a `-wal`/`-shm` fault over
|
|
36
|
+
* virtiofs makes a HEALTHY db unreadable and we must not mistake that for
|
|
37
|
+
* corruption (F3). Only a missing/garbage header — the zeroed/not-a-db case —
|
|
38
|
+
* is "corrupt". A header-valid-but-page-corrupt file is left for MANUAL restore
|
|
39
|
+
* rather than risk auto-parking a healthy DB.
|
|
40
|
+
*/
|
|
41
|
+
export function isDbHealthy(dbPath) {
|
|
42
|
+
if (!existsSync(dbPath))
|
|
43
|
+
return true;
|
|
44
|
+
let size;
|
|
45
|
+
try {
|
|
46
|
+
size = statSync(dbPath).size;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (size === 0)
|
|
52
|
+
return true; // freshly-created, not yet written — not corrupt
|
|
53
|
+
if (size < SQLITE_MAGIC.length)
|
|
54
|
+
return false; // too small to be a real db
|
|
55
|
+
let fd;
|
|
56
|
+
try {
|
|
57
|
+
fd = openSync(dbPath, 'r');
|
|
58
|
+
const header = Buffer.alloc(SQLITE_MAGIC.length);
|
|
59
|
+
readSync(fd, header, 0, SQLITE_MAGIC.length, 0);
|
|
60
|
+
return header.equals(SQLITE_MAGIC);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
if (fd !== undefined) {
|
|
67
|
+
try {
|
|
68
|
+
closeSync(fd);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
/* ignore */
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** Full integrity check for a backup we are about to promote to the live DB. */
|
|
77
|
+
function backupIsRestorable(path) {
|
|
78
|
+
let db;
|
|
79
|
+
try {
|
|
80
|
+
db = new Database(path, { readonly: true, fileMustExist: true });
|
|
81
|
+
return db.pragma('integrity_check', { simple: true }) === 'ok';
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
try {
|
|
88
|
+
db?.close();
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
/* ignore */
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Default verified-backup directory (matches `scripts/aqe-db-backup.sh`). */
|
|
96
|
+
export function defaultBackupDir(dbPath) {
|
|
97
|
+
return join(dirname(dbPath), 'backups', 'verified');
|
|
98
|
+
}
|
|
99
|
+
/** Newest `memory-*.db` in the backup dir that passes a full integrity_check, or null. */
|
|
100
|
+
function newestVerifiedBackup(backupDir) {
|
|
101
|
+
if (!existsSync(backupDir))
|
|
102
|
+
return null;
|
|
103
|
+
const candidates = readdirSync(backupDir)
|
|
104
|
+
.filter((f) => f.startsWith('memory-') && f.endsWith('.db'))
|
|
105
|
+
.map((f) => {
|
|
106
|
+
const path = join(backupDir, f);
|
|
107
|
+
return { path, mtime: statSync(path).mtimeMs };
|
|
108
|
+
})
|
|
109
|
+
.sort((a, b) => b.mtime - a.mtime);
|
|
110
|
+
for (const c of candidates) {
|
|
111
|
+
if (backupIsRestorable(c.path))
|
|
112
|
+
return c.path;
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* If `dbPath`'s main file is unambiguously corrupt (bad SQLite header), park it
|
|
118
|
+
* and atomically restore the newest verified backup. No-op (and non-destructive)
|
|
119
|
+
* when the DB is healthy, when no good backup exists, or when another process is
|
|
120
|
+
* already restoring.
|
|
121
|
+
*/
|
|
122
|
+
export function attemptAutoRestore(dbPath, opts) {
|
|
123
|
+
if (isDbHealthy(dbPath))
|
|
124
|
+
return { restored: false, reason: 'healthy' };
|
|
125
|
+
const backupDir = opts?.backupDir ?? defaultBackupDir(dbPath);
|
|
126
|
+
const good = newestVerifiedBackup(backupDir);
|
|
127
|
+
if (!good)
|
|
128
|
+
return { restored: false, reason: 'no-verified-backup' };
|
|
129
|
+
// F2: best-effort exclusive lock so concurrent processes don't both restore.
|
|
130
|
+
const lockPath = `${dbPath}.restore.lock`;
|
|
131
|
+
try {
|
|
132
|
+
writeFileSync(lockPath, String(process.pid), { flag: 'wx' });
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return { restored: false, reason: 'restore-in-progress' };
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
// Re-check under the lock: a peer may have just restored a healthy DB.
|
|
139
|
+
if (isDbHealthy(dbPath))
|
|
140
|
+
return { restored: false, reason: 'healthy' };
|
|
141
|
+
const ts = opts?.now ?? Date.now();
|
|
142
|
+
const parked = `${dbPath}.corrupt-${ts}`;
|
|
143
|
+
// Park the corrupt original + any stale WAL/shm. NEVER delete.
|
|
144
|
+
try {
|
|
145
|
+
if (existsSync(dbPath))
|
|
146
|
+
renameSync(dbPath, parked);
|
|
147
|
+
for (const suffix of ['-wal', '-shm']) {
|
|
148
|
+
if (existsSync(dbPath + suffix))
|
|
149
|
+
renameSync(dbPath + suffix, parked + suffix);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return { restored: false, reason: 'park-failed' };
|
|
154
|
+
}
|
|
155
|
+
// F2: restore atomically — copy to a temp on the same filesystem, then rename.
|
|
156
|
+
const tmp = `${dbPath}.restoring-${ts}`;
|
|
157
|
+
try {
|
|
158
|
+
copyFileSync(good, tmp);
|
|
159
|
+
renameSync(tmp, dbPath); // atomic on the same fs
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
try {
|
|
163
|
+
if (existsSync(tmp))
|
|
164
|
+
rmSync(tmp, { force: true });
|
|
165
|
+
if (!existsSync(dbPath) && existsSync(parked))
|
|
166
|
+
renameSync(parked, dbPath);
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
/* leave parked copy for manual recovery */
|
|
170
|
+
}
|
|
171
|
+
return { restored: false, reason: 'copy-failed' };
|
|
172
|
+
}
|
|
173
|
+
return { restored: true, reason: 'restored-from-backup', backupUsed: good, parkedTo: parked };
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
try {
|
|
177
|
+
rmSync(lockPath, { force: true });
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
/* ignore */
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=db-recovery.js.map
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
const BILLING_MODE_BY_TYPE = {
|
|
11
11
|
claude: 'metered-api',
|
|
12
12
|
'claude-code': 'subscription',
|
|
13
|
+
codex: 'subscription',
|
|
13
14
|
openai: 'metered-api',
|
|
14
15
|
openrouter: 'metered-api',
|
|
15
16
|
gemini: 'metered-api',
|
|
@@ -45,10 +46,12 @@ export function billingNotice(provider, mode) {
|
|
|
45
46
|
case 'metered-capped':
|
|
46
47
|
return (`ℹ️ LLM provider "${provider}" bills per-token but enforces a server-side ` +
|
|
47
48
|
`hard spend cap; it will pause at the cap rather than overspend.`);
|
|
48
|
-
case 'subscription':
|
|
49
|
-
|
|
49
|
+
case 'subscription': {
|
|
50
|
+
const sub = provider === 'codex' ? 'ChatGPT' : 'Claude Code';
|
|
51
|
+
return (`ℹ️ LLM provider "${provider}" runs on your ${sub} subscription ` +
|
|
50
52
|
`(shared plan usage). Worst case is hitting your plan's rate limit and pausing — ` +
|
|
51
53
|
`no per-token API charges.`);
|
|
54
|
+
}
|
|
52
55
|
case 'local':
|
|
53
56
|
return undefined;
|
|
54
57
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* Supported LLM provider types
|
|
13
13
|
*/
|
|
14
|
-
export type LLMProviderType = 'claude' | 'claude-code' | 'openai' | 'ollama' | 'openrouter' | 'bedrock' | 'azure-openai' | 'gemini' | 'cognitum';
|
|
14
|
+
export type LLMProviderType = 'claude' | 'claude-code' | 'codex' | 'openai' | 'ollama' | 'openrouter' | 'bedrock' | 'azure-openai' | 'gemini' | 'cognitum';
|
|
15
15
|
/**
|
|
16
16
|
* Message role in a conversation
|
|
17
17
|
*/
|
|
@@ -273,6 +273,18 @@ export interface ClaudeCodeConfig extends LLMConfig {
|
|
|
273
273
|
/** Tools to disallow in the headless session (safety). */
|
|
274
274
|
disallowedTools?: string[];
|
|
275
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Codex CLI (subscription) provider configuration (ADR-123 / ADR-124 M3.5).
|
|
278
|
+
* Runs on the user's ChatGPT subscription by shelling out to `codex exec`,
|
|
279
|
+
* mirroring the claude-code provider. Gives AQE a cross-vendor (GPT-family)
|
|
280
|
+
* engine for provider fallback and qe-court prosecutor/juror diversity.
|
|
281
|
+
*/
|
|
282
|
+
export interface CodexConfig extends LLMConfig {
|
|
283
|
+
/** Path to the `codex` binary (default: 'codex' on PATH). */
|
|
284
|
+
binaryPath?: string;
|
|
285
|
+
/** Max concurrent `codex exec` subprocesses. */
|
|
286
|
+
maxConcurrency?: number;
|
|
287
|
+
}
|
|
276
288
|
/**
|
|
277
289
|
* Cognitum provider configuration (ADR-123). OpenAI-compatible gateway with
|
|
278
290
|
* per-request cost receipts and a server-side hard spend cap.
|
|
@@ -294,6 +306,7 @@ export interface ProviderManagerConfig {
|
|
|
294
306
|
providers: {
|
|
295
307
|
claude?: ClaudeConfig;
|
|
296
308
|
'claude-code'?: ClaudeCodeConfig;
|
|
309
|
+
codex?: CodexConfig;
|
|
297
310
|
openai?: OpenAIConfig;
|
|
298
311
|
ollama?: OllamaConfig;
|
|
299
312
|
openrouter?: OpenRouterConfig;
|
|
@@ -70,7 +70,7 @@ export declare class ProviderManager {
|
|
|
70
70
|
*/
|
|
71
71
|
assertWithinBudget(input: string | Message[], options?: GenerateOptions | CompleteOptions): void;
|
|
72
72
|
/** ADR-123: public spend recorder for those same bypassing callers. */
|
|
73
|
-
recordResponseSpend(response: LLMResponse): void;
|
|
73
|
+
recordResponseSpend(response: LLMResponse, agent?: string): void;
|
|
74
74
|
/**
|
|
75
75
|
* Generate text using the best available provider
|
|
76
76
|
*/
|
|
@@ -18,6 +18,7 @@ import { createDefaultSpendLedger, InMemorySpendLedger, } from './spend-ledger';
|
|
|
18
18
|
import { resolveBillingMode, billingNotice } from './billing-modes';
|
|
19
19
|
import { ClaudeProvider } from './providers/claude';
|
|
20
20
|
import { ClaudeCodeProvider } from './providers/claude-code';
|
|
21
|
+
import { CodexProvider } from './providers/codex';
|
|
21
22
|
import { CognitumProvider } from './providers/cognitum';
|
|
22
23
|
import { OpenAIProvider } from './providers/openai';
|
|
23
24
|
import { OllamaProvider } from './providers/ollama';
|
|
@@ -169,7 +170,7 @@ export class ProviderManager {
|
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
172
|
/** ADR-123: persist a completed charge to the cross-process ledger. */
|
|
172
|
-
recordSpend(response) {
|
|
173
|
+
recordSpend(response, agent) {
|
|
173
174
|
if (!this.spendLedger)
|
|
174
175
|
return;
|
|
175
176
|
this.spendLedger.record({
|
|
@@ -180,6 +181,7 @@ export class ProviderManager {
|
|
|
180
181
|
promptTokens: response.usage.promptTokens,
|
|
181
182
|
completionTokens: response.usage.completionTokens,
|
|
182
183
|
requestId: response.requestId,
|
|
184
|
+
agent, // ADR-124 M2.3: per-agent attribution when the caller has context.
|
|
183
185
|
});
|
|
184
186
|
}
|
|
185
187
|
/**
|
|
@@ -192,8 +194,8 @@ export class ProviderManager {
|
|
|
192
194
|
this.enforceBudget(input, options);
|
|
193
195
|
}
|
|
194
196
|
/** ADR-123: public spend recorder for those same bypassing callers. */
|
|
195
|
-
recordResponseSpend(response) {
|
|
196
|
-
this.recordSpend(response);
|
|
197
|
+
recordResponseSpend(response, agent) {
|
|
198
|
+
this.recordSpend(response, agent);
|
|
197
199
|
}
|
|
198
200
|
/**
|
|
199
201
|
* Generate text using the best available provider
|
|
@@ -417,6 +419,8 @@ export class ProviderManager {
|
|
|
417
419
|
return new ClaudeProvider(this.config.providers.claude);
|
|
418
420
|
case 'claude-code':
|
|
419
421
|
return new ClaudeCodeProvider(this.config.providers['claude-code']);
|
|
422
|
+
case 'codex':
|
|
423
|
+
return new CodexProvider(this.config.providers.codex);
|
|
420
424
|
case 'cognitum':
|
|
421
425
|
return new CognitumProvider(this.config.providers.cognitum);
|
|
422
426
|
case 'openai':
|
|
@@ -285,10 +285,19 @@ export class ClaudeCodeProvider {
|
|
|
285
285
|
clearTimeout(timer);
|
|
286
286
|
resolve({ code: code ?? 0, stdout, stderr });
|
|
287
287
|
});
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
// EPIPE guard (qe-court finding): if `claude` exits before reading stdin,
|
|
289
|
+
// an unhandled 'error' on the stdin stream crashes the calling process. The
|
|
290
|
+
// 'close'/'error' handlers above already capture the real outcome.
|
|
291
|
+
child.stdin.on('error', () => { });
|
|
292
|
+
try {
|
|
293
|
+
if (stdin !== undefined) {
|
|
294
|
+
child.stdin.write(stdin);
|
|
295
|
+
}
|
|
296
|
+
child.stdin.end();
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
/* stream already torn down — process handlers report the failure */
|
|
290
300
|
}
|
|
291
|
-
child.stdin.end();
|
|
292
301
|
});
|
|
293
302
|
}
|
|
294
303
|
/** Simple semaphore so we don't spawn unbounded `claude` subprocesses. */
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 — Codex CLI (subscription) Provider (ADR-123 / ADR-124 M3.5)
|
|
3
|
+
*
|
|
4
|
+
* Runs QE analysis on the user's ChatGPT subscription by shelling out to the
|
|
5
|
+
* Codex CLI (`codex exec`) instead of calling the OpenAI API with a paid key.
|
|
6
|
+
* The CLI authenticates with the user's existing ChatGPT login (~/.codex/auth.json)
|
|
7
|
+
* and draws from the subscription allowance, so the worst case is "hit the plan
|
|
8
|
+
* limit and pause" rather than a per-token bill. Mirrors the claude-code provider.
|
|
9
|
+
*
|
|
10
|
+
* WHY: gives AQE a cross-vendor (GPT-family) engine — used as a provider fallback
|
|
11
|
+
* and, crucially, as an independent prosecutor/juror in qe-court (ADR-124), where
|
|
12
|
+
* a non-Claude, non-Cognitum brain is the strongest form of writer≠juror.
|
|
13
|
+
*
|
|
14
|
+
* LOAD-BEARING: the child process env has OPENAI_API_KEY / CODEX_API_KEY stripped.
|
|
15
|
+
* If present, the CLI could revert to API-key billing and this provider would be
|
|
16
|
+
* a lie. `parity` test coverage asserts the strip.
|
|
17
|
+
*/
|
|
18
|
+
import { LLMProvider, LLMProviderType, BillingMode, CodexConfig, Message, GenerateOptions, EmbedOptions, CompleteOptions, LLMResponse, EmbeddingResponse, CompletionResponse, HealthCheckResult } from '../interfaces';
|
|
19
|
+
export type { CodexConfig };
|
|
20
|
+
/** Env vars whose presence could flip the CLI from subscription to API billing. */
|
|
21
|
+
export declare const API_BILLING_ENV_VARS: readonly ["OPENAI_API_KEY", "CODEX_API_KEY"];
|
|
22
|
+
/** Sentinel meaning "let Codex use its own configured default model". */
|
|
23
|
+
export declare const CODEX_DEFAULT_MODEL = "default";
|
|
24
|
+
export declare const DEFAULT_CODEX_CONFIG: CodexConfig;
|
|
25
|
+
export declare class CodexProvider implements LLMProvider {
|
|
26
|
+
readonly type: LLMProviderType;
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly billingMode: BillingMode;
|
|
29
|
+
private config;
|
|
30
|
+
private requestId;
|
|
31
|
+
private availabilityCache?;
|
|
32
|
+
private active;
|
|
33
|
+
private readonly queue;
|
|
34
|
+
constructor(config?: Partial<CodexConfig>);
|
|
35
|
+
isAvailable(): Promise<boolean>;
|
|
36
|
+
healthCheck(): Promise<HealthCheckResult>;
|
|
37
|
+
generate(input: string | Message[], options?: GenerateOptions): Promise<LLMResponse>;
|
|
38
|
+
embed(_text: string, _options?: EmbedOptions): Promise<EmbeddingResponse>;
|
|
39
|
+
complete(prompt: string, options?: CompleteOptions): Promise<CompletionResponse>;
|
|
40
|
+
getConfig(): CodexConfig;
|
|
41
|
+
getSupportedModels(): string[];
|
|
42
|
+
getCostPerToken(): {
|
|
43
|
+
input: number;
|
|
44
|
+
output: number;
|
|
45
|
+
};
|
|
46
|
+
dispose(): Promise<void>;
|
|
47
|
+
private flatten;
|
|
48
|
+
private classifyError;
|
|
49
|
+
/**
|
|
50
|
+
* Build the child env with API-billing keys stripped (LOAD-BEARING).
|
|
51
|
+
* Exported logic tested by parity/env-strip tests.
|
|
52
|
+
*/
|
|
53
|
+
static childEnv(base?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
54
|
+
private runProcess;
|
|
55
|
+
/** Simple semaphore so we don't spawn unbounded `codex` subprocesses. */
|
|
56
|
+
private withConcurrency;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=codex.d.ts.map
|