agentic-qe 3.13.12 → 3.14.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/skills/qe-court/SKILL.md +4 -4
- package/.claude/skills/qe-court/config-schema.json +38 -0
- package/.claude/skills/qe-court/evals/qe-court.yaml +8 -8
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +53 -0
- package/assets/skills/qe-court/SKILL.md +4 -4
- package/assets/skills/qe-court/config-schema.json +38 -0
- package/assets/skills/qe-court/evals/qe-court.yaml +8 -8
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/cli/brain-commands.d.ts +1 -0
- package/dist/cli/brain-commands.js +1 -0
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-3VBXL7DO.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-7I7LZFNC.js → agent-booster-wasm-JZO6VUW4.js} +2 -2
- package/dist/cli/chunks/{agent-handler-QZZT52BH.js → agent-handler-534KFGEJ.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-MLQS5Y26.js → agent-memory-branch-B7KWLWY4.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-NXRNKJNA.js +2 -0
- package/dist/cli/chunks/{arena-IM4CP6LP.js → arena-7CCD3S3I.js} +2 -2
- package/dist/cli/chunks/{arena-WRIY37EJ.js → arena-OW5MELJX.js} +4 -4
- package/dist/cli/chunks/{audit-BSAQ4EFN.js → audit-BHVKN4E2.js} +3 -3
- package/dist/cli/chunks/base-F6GMOKU2.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-X2XZUXWZ.js → better-sqlite3-P5FA6WFK.js} +2 -2
- package/dist/cli/chunks/brain-handler-WNW5LOV7.js +90 -0
- package/dist/cli/chunks/{branch-enumerator-NI4Q7DSJ.js → branch-enumerator-TVZ2ODKH.js} +2 -2
- package/dist/cli/chunks/{browser-PXBLORUZ.js → browser-TCEB2W2F.js} +2 -2
- package/dist/cli/chunks/browser-workflow-QRDC46LR.js +2 -0
- package/dist/cli/chunks/{chunk-4FVOJBEU.js → chunk-2D7UBX5S.js} +1 -1
- package/dist/cli/chunks/{chunk-NG6A7LCG.js → chunk-2HYVOX6N.js} +1 -1
- package/dist/cli/chunks/{chunk-MGKH4LCM.js → chunk-2NO4H35K.js} +1 -1
- package/dist/cli/chunks/{chunk-UC4EIULB.js → chunk-2O4DDPEA.js} +19 -19
- package/dist/cli/chunks/{chunk-IT5QIUUA.js → chunk-3EM2MK3Z.js} +2 -2
- package/dist/cli/chunks/chunk-3GUO4ERR.js +24 -0
- package/dist/cli/chunks/{chunk-XIKYUBIV.js → chunk-3JIJBR4V.js} +2 -2
- package/dist/cli/chunks/{chunk-NL2SCAGJ.js → chunk-3QT6S3A3.js} +3 -3
- package/dist/cli/chunks/{chunk-SOS37ECY.js → chunk-3RYTAYR6.js} +1 -1
- package/dist/cli/chunks/chunk-43GPSYAL.js +14 -0
- package/dist/cli/chunks/{chunk-IPDM3CAK.js → chunk-4FEJEVG7.js} +1 -1
- package/dist/cli/chunks/{chunk-M3354CE4.js → chunk-4MK2G6TK.js} +2 -2
- package/dist/cli/chunks/{chunk-AM42ROKZ.js → chunk-4XTHRAUV.js} +1 -1
- package/dist/cli/chunks/{chunk-LRO74LPA.js → chunk-4ZVGSVHV.js} +4 -4
- package/dist/cli/chunks/{chunk-I5SXLV7D.js → chunk-52DFCV57.js} +2 -2
- package/dist/cli/chunks/{chunk-WYFAPA2G.js → chunk-5LEAGKX5.js} +2 -2
- package/dist/cli/chunks/{chunk-OZ53BIY5.js → chunk-5MZF4N4Q.js} +1 -1
- package/dist/cli/chunks/{chunk-NDRZZSD5.js → chunk-5VDVYTO5.js} +2 -2
- package/dist/cli/chunks/chunk-5XGVSQS2.js +11 -0
- package/dist/cli/chunks/{chunk-SXFSJJZF.js → chunk-6AOZU3UN.js} +2 -2
- package/dist/cli/chunks/{chunk-2VTX4SYW.js → chunk-6AYO3IR2.js} +2 -2
- package/dist/cli/chunks/{chunk-4AITMWFZ.js → chunk-6DPAMYLU.js} +2 -2
- package/dist/cli/chunks/{chunk-WE3VKDMK.js → chunk-6IJMD2ZL.js} +3 -3
- package/dist/cli/chunks/{chunk-5E76HULA.js → chunk-6IZQSLYZ.js} +2 -2
- package/dist/cli/chunks/{chunk-VBHA4SDU.js → chunk-6W42XWLL.js} +2 -2
- package/dist/cli/chunks/{chunk-ASWWBNX2.js → chunk-7BOPFN3Y.js} +2 -2
- package/dist/cli/chunks/{chunk-SCQNISGS.js → chunk-7OUMJCJT.js} +1 -1
- package/dist/cli/chunks/{chunk-M73KM3AZ.js → chunk-7RAB2BZY.js} +160 -26
- package/dist/cli/chunks/{chunk-4ANJV6I4.js → chunk-7RVAHJQZ.js} +3 -3
- package/dist/cli/chunks/{chunk-VQCLSX7T.js → chunk-A2WZEMWT.js} +1 -1
- package/dist/cli/chunks/{chunk-YQOQVSYU.js → chunk-A7SKM6JL.js} +1 -1
- package/dist/cli/chunks/chunk-AFGT26NR.js +2 -0
- package/dist/cli/chunks/{chunk-JVFZAJ5N.js → chunk-AR6SATU3.js} +2 -2
- package/dist/cli/chunks/{chunk-YL2GOJF6.js → chunk-AVLA5PBJ.js} +2 -2
- package/dist/cli/chunks/{chunk-R7LGVJMZ.js → chunk-B3H4K7CY.js} +2 -2
- package/dist/cli/chunks/{chunk-UWZYXI3R.js → chunk-BQCTO7UB.js} +2 -2
- package/dist/cli/chunks/{chunk-HAJG44BD.js → chunk-BZ4QVFP2.js} +2 -2
- package/dist/cli/chunks/{chunk-NNLZAVFH.js → chunk-CIUOC5F3.js} +1 -1
- package/dist/cli/chunks/{chunk-KRZYWVS3.js → chunk-CIZ6LSNV.js} +2 -2
- package/dist/cli/chunks/{chunk-HQWFZQMJ.js → chunk-DDPJUAXQ.js} +2 -2
- package/dist/cli/chunks/{chunk-X3JNFQW2.js → chunk-DJITEQYS.js} +2 -2
- package/dist/cli/chunks/{chunk-TB2N3CAK.js → chunk-DOWCOZDO.js} +2 -2
- package/dist/cli/chunks/{chunk-GJJWXRAD.js → chunk-E4NU4BJA.js} +2 -2
- package/dist/cli/chunks/{chunk-H3GAR4SV.js → chunk-E722WNWC.js} +2 -2
- package/dist/cli/chunks/chunk-ECTPFCON.js +2 -0
- package/dist/cli/chunks/{chunk-4YFXF5AQ.js → chunk-EJ6IP7DE.js} +5 -5
- package/dist/cli/chunks/{chunk-AN5CGTTJ.js → chunk-ENGKLFLY.js} +2 -2
- package/dist/cli/chunks/{chunk-7A4WTRWI.js → chunk-FF43SRP6.js} +1 -1
- package/dist/cli/chunks/{chunk-52VGZJSD.js → chunk-FOHYBR3O.js} +1 -1
- package/dist/cli/chunks/{chunk-6KI6LAAZ.js → chunk-FRL3X2QA.js} +2 -2
- package/dist/cli/chunks/{chunk-3ASVQILY.js → chunk-GKNDP5VK.js} +2 -2
- package/dist/cli/chunks/{chunk-2VY7FL6A.js → chunk-GVEJP5T7.js} +2 -2
- package/dist/cli/chunks/{chunk-VD53LBF7.js → chunk-H3YDDKBW.js} +3 -3
- package/dist/cli/chunks/{chunk-Z6DSYLAG.js → chunk-H6NFDOMK.js} +1 -1
- package/dist/cli/chunks/{chunk-BZIPYXSW.js → chunk-H76TV4UU.js} +3 -3
- package/dist/cli/chunks/{chunk-XT473WPO.js → chunk-HJIAVR6P.js} +2 -2
- package/dist/cli/chunks/{chunk-MLXLGBQZ.js → chunk-HLNQDRHA.js} +1 -1
- package/dist/cli/chunks/{chunk-DGFINXUE.js → chunk-HNKPLVYS.js} +1 -1
- package/dist/cli/chunks/{chunk-WXU7FAEB.js → chunk-HQ7243G3.js} +2 -2
- package/dist/cli/chunks/{chunk-VA2ORJB5.js → chunk-HQHLHSJO.js} +2 -2
- package/dist/cli/chunks/{chunk-2W3D5A4R.js → chunk-I3VHXA2W.js} +2 -2
- package/dist/cli/chunks/{chunk-EG73WYAW.js → chunk-IE5LC7MB.js} +2 -2
- package/dist/cli/chunks/{chunk-S6WHYOWV.js → chunk-IL4AEB3J.js} +27 -25
- package/dist/cli/chunks/{chunk-TWUWLSGQ.js → chunk-IL6QRXRP.js} +6 -6
- package/dist/cli/chunks/{chunk-5PNQNBDZ.js → chunk-IQ3JFHZN.js} +1 -1
- package/dist/cli/chunks/{chunk-MB2KLJ6Q.js → chunk-IQLRA4FV.js} +1 -1
- package/dist/cli/chunks/{chunk-A5RWLPVT.js → chunk-J3XSHJGK.js} +2 -2
- package/dist/cli/chunks/{chunk-U5G6OC2C.js → chunk-JAK5UUWH.js} +2 -2
- package/dist/cli/chunks/{chunk-E67ZXRG6.js → chunk-JGROLJ33.js} +1 -1
- package/dist/cli/chunks/{chunk-VNODKACB.js → chunk-JMKMDSXG.js} +2 -2
- package/dist/cli/chunks/{chunk-LXVT6JXO.js → chunk-JRKEBESE.js} +2 -2
- package/dist/cli/chunks/{chunk-AKUDUB3O.js → chunk-JTWJR2KY.js} +2 -2
- package/dist/cli/chunks/{chunk-IOJ34SXJ.js → chunk-JY4VZ6BN.js} +2 -2
- package/dist/cli/chunks/{chunk-AYH3DMW2.js → chunk-K6CGQR5R.js} +1 -1
- package/dist/cli/chunks/{chunk-QXO35J6F.js → chunk-KDIZQHG5.js} +2 -2
- package/dist/cli/chunks/{chunk-7LATB5IR.js → chunk-KTSCZ7AW.js} +2 -2
- package/dist/cli/chunks/{chunk-M7CPJW53.js → chunk-L4C42WYI.js} +2 -2
- package/dist/cli/chunks/{chunk-QG5L2JM5.js → chunk-LCSVROU7.js} +10 -10
- package/dist/cli/chunks/{chunk-6BSZHNOC.js → chunk-LKR7T3OZ.js} +1 -1
- package/dist/cli/chunks/{chunk-GJUGG6UR.js → chunk-LZHTCUCO.js} +2 -2
- package/dist/cli/chunks/{chunk-7RVLVIAI.js → chunk-M3HUZD2I.js} +1 -1
- package/dist/cli/chunks/{chunk-RP5VFZJO.js → chunk-MO7EITJK.js} +2 -2
- package/dist/cli/chunks/{chunk-44NPKZGI.js → chunk-N2YAUDAV.js} +2 -2
- package/dist/cli/chunks/{chunk-G6FJHDUG.js → chunk-NDPQ2WPU.js} +1 -1
- package/dist/cli/chunks/{chunk-UBOGJHWC.js → chunk-NKWO2X3T.js} +1 -1
- package/dist/cli/chunks/{chunk-NJ3QXJ54.js → chunk-NOPVFBQM.js} +2 -2
- package/dist/cli/chunks/{chunk-AOOCV56W.js → chunk-NYARYONH.js} +1 -1
- package/dist/cli/chunks/{chunk-6KKVMPPR.js → chunk-O2MZZL54.js} +2 -2
- package/dist/cli/chunks/{chunk-2JAC57JE.js → chunk-OIYUSWHX.js} +1 -1
- package/dist/cli/chunks/{chunk-BODFJ3DC.js → chunk-OONCRNFA.js} +2 -2
- package/dist/cli/chunks/{chunk-ZMYV4R32.js → chunk-PEW6FZ47.js} +1 -1
- package/dist/cli/chunks/{chunk-42AS3HPO.js → chunk-Q73RRTLE.js} +2 -2
- package/dist/cli/chunks/{chunk-IQH2RDN3.js → chunk-QKQZ4IJF.js} +5 -5
- package/dist/cli/chunks/{chunk-MYVKTG55.js → chunk-QMMDN4WX.js} +3 -3
- package/dist/cli/chunks/chunk-QQCENKCX.js +2 -0
- package/dist/cli/chunks/{chunk-7PCIN7UN.js → chunk-QSPRQPEL.js} +2 -2
- package/dist/cli/chunks/{chunk-ZSAGRDXA.js → chunk-QZPFUFZG.js} +2 -2
- package/dist/cli/chunks/chunk-R2B6EE45.js +2 -0
- package/dist/cli/chunks/{chunk-33YZGOT6.js → chunk-R6WJF4D5.js} +2 -2
- package/dist/cli/chunks/{chunk-QM4Z7TQH.js → chunk-RGVD6ZUX.js} +1 -1
- package/dist/cli/chunks/{chunk-VQD2ELNL.js → chunk-RKUYVVGJ.js} +2 -2
- package/dist/cli/chunks/{chunk-5VSS2RBD.js → chunk-S5YVLPXU.js} +2 -2
- package/dist/cli/chunks/{chunk-IPZEBALY.js → chunk-SROZXIMT.js} +37 -37
- package/dist/cli/chunks/{chunk-GMLRIZ4E.js → chunk-SSV6KSFT.js} +1 -1
- package/dist/cli/chunks/{chunk-PVINNJ4P.js → chunk-SUSMHSXT.js} +2 -2
- package/dist/cli/chunks/{chunk-KXSUDN46.js → chunk-T3BZAFLP.js} +1 -1
- package/dist/cli/chunks/{chunk-MLFELTJX.js → chunk-TGOGCA74.js} +2 -2
- package/dist/cli/chunks/{chunk-G45AOQDZ.js → chunk-TKYEP7OR.js} +1 -1
- package/dist/cli/chunks/{chunk-KYJBJ56M.js → chunk-TQJE7DNL.js} +2 -2
- package/dist/cli/chunks/{chunk-5PI75QYP.js → chunk-TRDEULS7.js} +2 -2
- package/dist/cli/chunks/{chunk-OG3DBHIV.js → chunk-U4GZWPKM.js} +2 -2
- package/dist/cli/chunks/{chunk-NJ4YVAG7.js → chunk-UI6WSPEK.js} +3 -3
- package/dist/cli/chunks/{chunk-4M7YZ2X7.js → chunk-UUJ5VQJM.js} +1 -1
- package/dist/cli/chunks/{chunk-UJUK6T4V.js → chunk-VESOYP6A.js} +2 -2
- package/dist/cli/chunks/{chunk-7ZVO7I4Q.js → chunk-VOSISOFD.js} +1 -1
- package/dist/cli/chunks/{chunk-HRTSYT4N.js → chunk-VPVZHJSU.js} +2 -2
- package/dist/cli/chunks/{chunk-66OQ7AB3.js → chunk-VRRG66XB.js} +1 -1
- package/dist/cli/chunks/{chunk-4Z4X2ND4.js → chunk-VXU53F7Z.js} +2 -2
- package/dist/cli/chunks/{chunk-XM5I7J5S.js → chunk-VYENTZ45.js} +2 -2
- package/dist/cli/chunks/chunk-WJXHE52V.js +65 -0
- package/dist/cli/chunks/{chunk-3XVZHJQT.js → chunk-WKNWRDA5.js} +1 -1
- package/dist/cli/chunks/{chunk-DFLASG3B.js → chunk-WTHAVFIC.js} +1 -1
- package/dist/cli/chunks/{chunk-NTALX2YC.js → chunk-WWWX76QB.js} +2 -2
- package/dist/cli/chunks/{chunk-L3GBNX7B.js → chunk-XITTURP2.js} +2 -2
- package/dist/cli/chunks/{chunk-FI6J3UHJ.js → chunk-XXFKN7LB.js} +1 -1
- package/dist/cli/chunks/{chunk-RP2BRRLX.js → chunk-YEAC3DC6.js} +2 -2
- package/dist/cli/chunks/{chunk-JTYCOFTD.js → chunk-YKWMKRYB.js} +1 -1
- package/dist/cli/chunks/chunk-YKZV7O65.js +2 -0
- package/dist/cli/chunks/{chunk-N4OQ4D4V.js → chunk-YW4RNZWT.js} +2 -2
- package/dist/cli/chunks/{chunk-P6EFKHNI.js → chunk-ZAAYOENS.js} +2 -2
- package/dist/cli/chunks/chunk-ZBKGX72B.js +13 -0
- package/dist/cli/chunks/{chunk-TJVTV3HP.js → chunk-ZBOWR4XT.js} +2 -2
- package/dist/cli/chunks/{chunk-4THFPRFM.js → chunk-ZCVJCCQQ.js} +2 -2
- package/dist/cli/chunks/{chunk-X2SZCVDA.js → chunk-ZI3UO7QR.js} +8 -7
- package/dist/cli/chunks/{chunk-DCVFHVPR.js → chunk-ZNSMVQCG.js} +2 -2
- package/dist/cli/chunks/{chunk-Z56BBX77.js → chunk-ZQSXG7FA.js} +2 -2
- package/dist/cli/chunks/{ci-QAUD62WH.js → ci-B432UH6N.js} +2 -2
- package/dist/cli/chunks/{ci-output-TZDVTNE7.js → ci-output-GTHH7WYG.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-ZWPHJ7YJ.js → circuit-breaker-VW75DLME.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-SCB4EURN.js → claude-flow-setup-RE3IVT7U.js} +2 -2
- package/dist/cli/chunks/client-HNBZUEVV.js +2 -0
- package/dist/cli/chunks/{cline-installer-EHZLMLXF.js → cline-installer-NUBZZ55N.js} +2 -2
- package/dist/cli/chunks/{code-3N6PBJMK.js → code-K6JCWKNW.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-6DIKHNRI.js → code-index-extractor-I4ILB5JN.js} +2 -2
- package/dist/cli/chunks/{codex-installer-P7DPQMYL.js → codex-installer-AKQ5BCHU.js} +2 -2
- package/dist/cli/chunks/{completions-5MKWWCCE.js → completions-V3KJVJF4.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-TPM4IPEK.js → complexity-analyzer-HRG7OOY3.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-VXODKGVX.js → continuedev-installer-CNTDONWG.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-PVD5O56P.js → copilot-installer-XPWWIWYA.js} +2 -2
- package/dist/cli/chunks/core-handlers-TB7NLYXL.js +2 -0
- package/dist/cli/chunks/{cost-tracker-JOMZEQF3.js → cost-tracker-MFNLQ56K.js} +2 -2
- package/dist/cli/chunks/{coverage-HTXLEV3B.js → coverage-KOIK654V.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-MDSI553U.js +2 -0
- package/dist/cli/chunks/{cursor-installer-SHKDTDDZ.js → cursor-installer-S5MKLRQQ.js} +2 -2
- package/dist/cli/chunks/{daemon-FCFEWVVJ.js → daemon-DUS6JYW6.js} +3 -3
- package/dist/cli/chunks/{daemon-PN4FEPLE.js → daemon-Z7VPGWHY.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-PLOHU5SR.js → dag-attention-scheduler-7CQ3ARNI.js} +2 -2
- package/dist/cli/chunks/{detect-F3H4ZEZY.js → detect-WORBCAYF.js} +2 -2
- package/dist/cli/chunks/{dist-node-5TC665N6.js → dist-node-KRNI6OYW.js} +2 -2
- package/dist/cli/chunks/{domain-handler-ZIWVFXCU.js → domain-handler-KRUR2VQG.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-7Q5JYMYR.js → domain-transfer-VEOVLV54.js} +2 -2
- package/dist/cli/chunks/dream-X7ISHFEE.js +2 -0
- package/dist/cli/chunks/embed-and-insert-pattern-QU3NQVA5.js +3 -0
- package/dist/cli/chunks/{eval-E2K2T75A.js → eval-AYQ7BSUP.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-Z5SE2O53.js → experience-capture-middleware-AWQBL6LT.js} +3 -3
- package/dist/cli/chunks/{fast-paths-3H52RSUK.js → fast-paths-V5EL4BYJ.js} +2 -2
- package/dist/cli/chunks/{feature-flags-LUHSMHPS.js → feature-flags-BXX7BP22.js} +2 -2
- package/dist/cli/chunks/{feature-flags-ONIKUZVK.js → feature-flags-P34BPRWU.js} +2 -2
- package/dist/cli/chunks/{file-discovery-FLYSYSS4.js → file-discovery-MS6BKQ2U.js} +2 -2
- package/dist/cli/chunks/{fleet-6OJUAAKV.js → fleet-7WVVPA4W.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-PUL6B7KZ.js → gnn-wrapper-7WQ3LEPG.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-HGHHDUDY.js → heartbeat-handler-P7QD3BZH.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-2C5XGFQT.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-KCVMXLUL.js +2 -0
- package/dist/cli/chunks/hnsw-index-OGWZS6MP.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-NDZSNMYX.js → hnsw-legacy-bridge-Y3GAR3UP.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-PISLKSO2.js → hnswlib-node-5QUXZQWQ.js} +2 -2
- package/dist/cli/chunks/{hooks-WYG54MRI.js → hooks-2D64KPRY.js} +10 -10
- package/dist/cli/chunks/{hypergraph-engine-EDHKHZZ2.js → hypergraph-engine-5INXEZDP.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-OCHZAPPL.js → hypergraph-handler-YJJJ3ESZ.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-IBJ43GQL.js +2 -0
- package/dist/cli/chunks/{init-handler-5TCJ672H.js → init-handler-QSFYJN5Q.js} +6 -6
- package/dist/cli/chunks/init-wizard-6XMFD5LP.js +2 -0
- package/dist/cli/chunks/kernel-UDUMUPB3.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-SWUQRCTZ.js → kilocode-installer-3N3QGTJU.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-L22EBAM5.js → kiro-installer-GIWVTFZQ.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-JRYTUG3W.js +2 -0
- package/dist/cli/chunks/learning-SGO2DQ5Q.js +122 -0
- package/dist/cli/chunks/{llm-router-F2L4LFT2.js → llm-router-HBBULO65.js} +14 -14
- package/dist/cli/chunks/llm-router-service-KF5ZALUQ.js +2 -0
- package/dist/cli/chunks/{load-A4ZF2KHC.js → load-B5OFYB4H.js} +2 -2
- package/dist/cli/chunks/load-test-LHMBCNCH.js +2 -0
- package/dist/cli/chunks/{mcp-T2Z46NNK.js → mcp-FG3LNQR4.js} +2 -2
- package/dist/cli/chunks/{memory-PUC3J6XC.js → memory-SPS7ZWLC.js} +5 -5
- package/dist/cli/chunks/memory-backend-WZHKHBZK.js +2 -0
- package/dist/cli/chunks/memory-handlers-P7FTPWP3.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-U5L4FI4O.js → multi-model-executor-PUB7E6KH.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-UWI6KHYH.js → opencode-installer-TGCSGVG2.js} +2 -2
- package/dist/cli/chunks/{orchestrator-3BEI7R5D.js → orchestrator-S5FTJFGB.js} +10 -13
- package/dist/cli/chunks/pattern-null-store-UZSHCRL2.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-EGWUI5LU.js → pattern-usage-recorder-LCXXGRAB.js} +2 -2
- package/dist/cli/chunks/{pipeline-JG6M4RHD.js → pipeline-ENOSRHKW.js} +2 -2
- package/dist/cli/chunks/{platform-F76G6RUI.js → platform-WCRBO3Z7.js} +2 -2
- package/dist/cli/chunks/{plugin-EEGN3PMK.js → plugin-JZ5ODJSU.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-7KZAINFT.js → prime-radiant-advanced-wasm-DPJUPNCG.js} +2 -2
- package/dist/cli/chunks/protocol-executor-42NLVDTC.js +2 -0
- package/dist/cli/chunks/{protocol-handler-UCEHYK2R.js → protocol-handler-IP4NLVY3.js} +2 -2
- package/dist/cli/chunks/{prove-JSNG75VD.js → prove-P6FM4RU7.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-W74RSMMU.js +2 -0
- package/dist/cli/chunks/{quality-7SRM2HBM.js → quality-UHP4XO26.js} +2 -2
- package/dist/cli/chunks/{quality-gate-A5MPWHST.js → quality-gate-63DDBSGM.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-XELKSRMS.js +2 -0
- package/dist/cli/chunks/real-embeddings-6SO5MFRQ.js +2 -0
- package/dist/cli/chunks/{roocode-installer-UYQK64BZ.js → roocode-installer-WTWUOFCH.js} +2 -2
- package/dist/cli/chunks/router-GTW2EQZV.js +2 -0
- package/dist/cli/chunks/routing-feedback-NVOBWEMK.js +2 -0
- package/dist/cli/chunks/{routing-handler-PY3KPDTH.js → routing-handler-IK7HYERQ.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-GCAOUTYS.js → ruvector-commands-THLB4NIM.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-5OPVMXNL.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-5S4YFTX4.js +2 -0
- package/dist/cli/chunks/rvf-migration-coordinator-BUKCSHBD.js +2 -0
- package/dist/cli/chunks/rvf-native-adapter-LYSJHEVX.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-HNDKOM4L.js → rvf-store-integrity-ECTADZIN.js} +2 -2
- package/dist/cli/chunks/safe-db-AEB3JMLD.js +2 -0
- package/dist/cli/chunks/schedule-4QNPCQNT.js +2 -0
- package/dist/cli/chunks/scheduler-S3DFHX6A.js +2 -0
- package/dist/cli/chunks/{security-MQ2VB7PY.js → security-HN4UXFXX.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-TAZEU6QK.js → shared-rvf-adapter-XJCPX5SN.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-B7N6AOCY.js → shared-rvf-dual-writer-23X5PNY5.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-L2KISU2H.js +2 -0
- package/dist/cli/chunks/{status-handler-NZP7DFHE.js → status-handler-ZXANTHKT.js} +2 -2
- package/dist/cli/chunks/{structural-health-ALLUQ4X6.js → structural-health-LR6WI3AH.js} +2 -2
- package/dist/cli/chunks/{sync-WJJG5J6V.js → sync-4OEI3BC2.js} +2 -2
- package/dist/cli/chunks/{sync-MM7OCUYD.js → sync-I5IUJF33.js} +2 -2
- package/dist/cli/chunks/{task-handler-CAQUEEB4.js → task-handler-R3ATJKU5.js} +2 -2
- package/dist/cli/chunks/{task-handlers-25BJ7D3W.js → task-handlers-4X357AEW.js} +3 -3
- package/dist/cli/chunks/{test-HW7GVGVN.js → test-PR2B5H2F.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-HTMFJMSP.js → test-scheduling-ZNOSQVLD.js} +3 -3
- package/dist/cli/chunks/token-bootstrap-LYXOI72S.js +2 -0
- package/dist/cli/chunks/{token-usage-RJZDMBDP.js → token-usage-R6EQZBX2.js} +2 -2
- package/dist/cli/chunks/{transformers-3YFW3EUO.js → transformers-COQWK27J.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-U3PQPIK7.js → tree-sitter-wasm-parser-LLIW2X3M.js} +2 -2
- package/dist/cli/chunks/{types-7Q762WDO.js → types-MEYTZITK.js} +2 -2
- package/dist/cli/chunks/unified-memory-5KQMA7FV.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-PQRPTYOD.js +2 -0
- package/dist/cli/chunks/unified-persistence-YDONVPJB.js +2 -0
- package/dist/cli/chunks/{upgrade-F7MKJWBQ.js → upgrade-DVIJ456A.js} +2 -2
- package/dist/cli/chunks/{validate-B27AVRA6.js → validate-UYTSMJ5X.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-GYZR3GNL.js → validate-swarm-P32WCJR6.js} +2 -2
- package/dist/cli/chunks/{vibium-W4XQMPJP.js → vibium-JGVOLM6X.js} +2 -2
- package/dist/cli/chunks/visual-security-RJ7RTNGJ.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-I7CDCFJU.js → web-tree-sitter-5ZGNCTPN.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-UYLHFDHU.js → windsurf-installer-IILSSQAE.js} +2 -2
- package/dist/cli/chunks/{witness-chain-B66SYZKU.js → witness-chain-JZMXCG3B.js} +2 -2
- package/dist/cli/chunks/witness-chain-YXXXNGAM.js +2 -0
- package/dist/cli/chunks/{witness-key-manager-U4JPAHVW.js → witness-key-manager-UUTLNUIH.js} +2 -2
- package/dist/cli/chunks/{workflow-DYMO47FF.js → workflow-NS7HXVHZ.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-5KUAVSTH.js +2 -0
- package/dist/cli/chunks/{wrappers-7S6DQTEA.js → wrappers-XKEDSV5W.js} +2 -2
- package/dist/cli/commands/learning.js +44 -0
- package/dist/cli/commands/llm-router.js +27 -21
- package/dist/cli/handlers/brain-handler.js +2 -0
- package/dist/context/compaction/index.d.ts +1 -0
- package/dist/context/compaction/index.js +3 -0
- package/dist/context/compaction/instruction-provenance.d.ts +20 -0
- package/dist/context/compaction/instruction-provenance.js +18 -0
- package/dist/context/compaction/tier2-session-summary.d.ts +8 -0
- package/dist/context/compaction/tier2-session-summary.js +20 -0
- package/dist/context/compaction/tier3-llm-compact.d.ts +4 -0
- package/dist/context/compaction/tier3-llm-compact.js +32 -4
- package/dist/init/phases/07-hooks.js +0 -3
- package/dist/integrations/embeddings/base/EmbeddingGenerator.js +4 -2
- package/dist/integrations/ruvector/brain-exporter.d.ts +1 -1
- package/dist/integrations/ruvector/brain-exporter.js +15 -3
- package/dist/integrations/ruvector/brain-rvf-exporter.d.ts +4 -0
- package/dist/integrations/ruvector/brain-rvf-exporter.js +118 -37
- package/dist/integrations/ruvector/brain-search.d.ts +1 -1
- package/dist/integrations/ruvector/brain-search.js +1 -1
- package/dist/integrations/ruvector/brain-shared.d.ts +4 -2
- package/dist/integrations/ruvector/brain-shared.js +11 -4
- package/dist/integrations/ruvector/brain-table-ddl.d.ts +2 -2
- package/dist/integrations/ruvector/brain-table-ddl.js +20 -8
- package/dist/integrations/ruvector/cognitive-container.js +1 -1
- package/dist/integrations/ruvector/rvf-dual-writer.d.ts +4 -0
- package/dist/integrations/ruvector/rvf-dual-writer.js +57 -9
- package/dist/integrations/ruvector/rvf-store-integrity.js +1 -1
- package/dist/kernel/unified-memory-schemas.d.ts +4 -3
- package/dist/kernel/unified-memory-schemas.js +19 -9
- package/dist/kernel/unified-memory.d.ts +2 -0
- package/dist/kernel/unified-memory.js +19 -0
- package/dist/learning/embed-and-insert-pattern.js +6 -3
- package/dist/learning/embedding-space.d.ts +50 -0
- package/dist/learning/embedding-space.js +128 -0
- package/dist/learning/evidence-admission-store.d.ts +15 -0
- package/dist/learning/evidence-admission-store.js +68 -0
- package/dist/learning/index.d.ts +4 -0
- package/dist/learning/index.js +2 -0
- package/dist/learning/learning-evidence-admission.d.ts +44 -0
- package/dist/learning/learning-evidence-admission.js +97 -0
- package/dist/learning/pattern-store.d.ts +5 -0
- package/dist/learning/pattern-store.js +36 -7
- package/dist/learning/qe-flywheel/coupled-anchor.d.ts +8 -0
- package/dist/learning/qe-flywheel/coupled-anchor.js +46 -3
- package/dist/learning/qe-reasoning-bank.js +4 -0
- package/dist/learning/real-embeddings.d.ts +3 -0
- package/dist/learning/real-embeddings.js +40 -3
- package/dist/learning/real-qe-reasoning-bank.js +7 -3
- package/dist/learning/rvf-pattern-migration.d.ts +2 -0
- package/dist/learning/rvf-pattern-migration.js +5 -3
- package/dist/learning/rvf-pattern-store.d.ts +3 -0
- package/dist/learning/rvf-pattern-store.js +21 -1
- package/dist/learning/sqlite-persistence.d.ts +7 -2
- package/dist/learning/sqlite-persistence.js +58 -21
- package/dist/mcp/bundle.js +603 -447
- package/dist/mcp/handlers/memory-handlers.js +6 -2
- package/dist/migrations/20260830_add_learning_evidence_tables.d.ts +7 -0
- package/dist/migrations/20260830_add_learning_evidence_tables.js +173 -0
- package/dist/persistence/rvf-migration-adapter.d.ts +2 -0
- package/dist/persistence/rvf-migration-adapter.js +56 -12
- package/dist/shared/llm/llm-router-service.d.ts +8 -0
- package/dist/shared/llm/llm-router-service.js +21 -3
- package/dist/shared/sql-safety.js +4 -0
- package/dist/skills/qe-court/cli.d.ts +3 -0
- package/dist/skills/qe-court/cli.js +54 -0
- package/dist/verification/adversarial-verify/calibrate.d.ts +46 -2
- package/dist/verification/adversarial-verify/calibrate.js +104 -2
- package/dist/verification/adversarial-verify/index.d.ts +1 -1
- package/dist/verification/adversarial-verify/index.js +1 -1
- package/package.json +8 -3
- package/dist/cli/chunks/adapter-FUV6LBJT.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-QNFNA3J4.js +0 -2
- package/dist/cli/chunks/base-37W2XIXC.js +0 -2
- package/dist/cli/chunks/brain-handler-TVTTWZGP.js +0 -89
- package/dist/cli/chunks/browser-workflow-PDIUEK7B.js +0 -2
- package/dist/cli/chunks/chunk-EDRPTLAX.js +0 -2
- package/dist/cli/chunks/chunk-GEQWCK4F.js +0 -2
- package/dist/cli/chunks/chunk-GQLJYTXN.js +0 -2
- package/dist/cli/chunks/chunk-NLZUGANH.js +0 -11
- package/dist/cli/chunks/chunk-O4BWESH5.js +0 -2
- package/dist/cli/chunks/chunk-PGFCKE4G.js +0 -12
- package/dist/cli/chunks/chunk-RACWX2ZX.js +0 -9
- package/dist/cli/chunks/chunk-SNC73DWF.js +0 -2
- package/dist/cli/chunks/chunk-TDVMILKO.js +0 -2
- package/dist/cli/chunks/chunk-TK5XLF3Z.js +0 -65
- package/dist/cli/chunks/chunk-UQ4UCHO7.js +0 -2
- package/dist/cli/chunks/chunk-VZGP77YU.js +0 -12
- package/dist/cli/chunks/chunk-WA6CSEOX.js +0 -2
- package/dist/cli/chunks/chunk-WYIXNHPF.js +0 -2
- package/dist/cli/chunks/client-4W3KWTAU.js +0 -2
- package/dist/cli/chunks/core-handlers-BDU2XBLO.js +0 -2
- package/dist/cli/chunks/cross-domain-router-BPB6IHN4.js +0 -2
- package/dist/cli/chunks/dream-WFCZGFDY.js +0 -2
- package/dist/cli/chunks/embed-and-insert-pattern-VESJQSYD.js +0 -3
- package/dist/cli/chunks/heartbeat-scheduler-HWS4SHRM.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-7QOBHKRB.js +0 -2
- package/dist/cli/chunks/hnsw-index-6WUKYJH7.js +0 -2
- package/dist/cli/chunks/hybrid-router-525JTRA5.js +0 -2
- package/dist/cli/chunks/impact-analyzer-GG6CJEOK.js +0 -2
- package/dist/cli/chunks/init-wizard-4VFAOK4Y.js +0 -2
- package/dist/cli/chunks/kernel-N3FQGOST.js +0 -2
- package/dist/cli/chunks/knowledge-graph-I5QIHB4G.js +0 -2
- package/dist/cli/chunks/learning-TQOGG3CR.js +0 -119
- package/dist/cli/chunks/llm-router-service-NCJZYJLG.js +0 -2
- package/dist/cli/chunks/load-test-DCJEYIXD.js +0 -2
- package/dist/cli/chunks/memory-backend-O6KO2KTX.js +0 -2
- package/dist/cli/chunks/memory-handlers-4Z43WEKD.js +0 -2
- package/dist/cli/chunks/pattern-null-store-5WIJKX2K.js +0 -2
- package/dist/cli/chunks/protocol-executor-5TPNAZTB.js +0 -2
- package/dist/cli/chunks/provider-manager-3VMOZ6HV.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-BATV4NTT.js +0 -2
- package/dist/cli/chunks/queen-coordinator-EIHGYBUO.js +0 -2
- package/dist/cli/chunks/real-embeddings-ZBF5EQOG.js +0 -2
- package/dist/cli/chunks/router-EMVGY4HU.js +0 -2
- package/dist/cli/chunks/routing-feedback-JUP4OFB2.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-BUNP4SKD.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-VSOAPLMB.js +0 -2
- package/dist/cli/chunks/rvf-migration-coordinator-LSWEHAWX.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-LOC42TQ6.js +0 -2
- package/dist/cli/chunks/safe-db-WQ62IQKV.js +0 -2
- package/dist/cli/chunks/schedule-XJRP57TE.js +0 -2
- package/dist/cli/chunks/scheduler-EZH5SDIM.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-HPEVCTIB.js +0 -2
- package/dist/cli/chunks/token-bootstrap-F2DCLWGW.js +0 -2
- package/dist/cli/chunks/unified-memory-ATILROKR.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-XJXAX7DW.js +0 -2
- package/dist/cli/chunks/unified-persistence-3TN5PBWE.js +0 -2
- package/dist/cli/chunks/visual-security-VFWRBCNA.js +0 -2
- package/dist/cli/chunks/witness-chain-JC5LEXRV.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-TKQUF2KN.js +0 -2
|
@@ -1,11 +1,90 @@
|
|
|
1
1
|
import { adversarialVerify } from './verify.js';
|
|
2
|
+
const DEFAULT_QUALIFICATION = {
|
|
3
|
+
minSupport: 10,
|
|
4
|
+
minRecall: 0.8,
|
|
5
|
+
minPrecision: 0.8,
|
|
6
|
+
maxFalseKillRate: 0.1,
|
|
7
|
+
maxFalseKeepRate: 0.1,
|
|
8
|
+
criticalSeverities: ['critical', 'high'],
|
|
9
|
+
};
|
|
10
|
+
function wilson(successes, total) {
|
|
11
|
+
if (total === 0)
|
|
12
|
+
return { low: 0, high: 1, level: 0.95 };
|
|
13
|
+
const z = 1.959963984540054;
|
|
14
|
+
const p = successes / total;
|
|
15
|
+
const z2 = z * z;
|
|
16
|
+
const denominator = 1 + z2 / total;
|
|
17
|
+
const centre = (p + z2 / (2 * total)) / denominator;
|
|
18
|
+
const margin = z * Math.sqrt((p * (1 - p) + z2 / (4 * total)) / total) / denominator;
|
|
19
|
+
return { low: Math.max(0, centre - margin), high: Math.min(1, centre + margin), level: 0.95 };
|
|
20
|
+
}
|
|
21
|
+
function buildSlice(key, entries, policy) {
|
|
22
|
+
const real = entries.filter(entry => entry.label.isReal);
|
|
23
|
+
const falseEntries = entries.filter(entry => !entry.label.isReal);
|
|
24
|
+
const upheldReal = real.filter(entry => entry.verdict === 'upheld').length;
|
|
25
|
+
const upheldFalse = falseEntries.filter(entry => entry.verdict === 'upheld').length;
|
|
26
|
+
const falseKill = real.filter(entry => entry.verdict === 'refuted').length;
|
|
27
|
+
const falseKeep = upheldFalse;
|
|
28
|
+
const uncertain = entries.filter(entry => entry.verdict === 'uncertain').length;
|
|
29
|
+
const upheld = upheldReal + upheldFalse;
|
|
30
|
+
const precision = upheld ? upheldReal / upheld : 0;
|
|
31
|
+
const recall = real.length ? upheldReal / real.length : 0;
|
|
32
|
+
const falseKillRate = real.length ? falseKill / real.length : 0;
|
|
33
|
+
const falseKeepRate = falseEntries.length ? falseKeep / falseEntries.length : 0;
|
|
34
|
+
const intervals = {
|
|
35
|
+
precision: wilson(upheldReal, upheld),
|
|
36
|
+
recall: wilson(upheldReal, real.length),
|
|
37
|
+
falseKillRate: wilson(falseKill, real.length),
|
|
38
|
+
falseKeepRate: wilson(falseKeep, falseEntries.length),
|
|
39
|
+
};
|
|
40
|
+
let disposition = 'automate';
|
|
41
|
+
if (entries.length < policy.minSupport || real.length === 0)
|
|
42
|
+
disposition = 'abstain';
|
|
43
|
+
else if (intervals.recall.low < policy.minRecall
|
|
44
|
+
|| intervals.precision.low < policy.minPrecision
|
|
45
|
+
|| intervals.falseKillRate.high > policy.maxFalseKillRate
|
|
46
|
+
|| intervals.falseKeepRate.high > policy.maxFalseKeepRate) {
|
|
47
|
+
disposition = 'human-review';
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
key, support: entries.length, precision, recall, falseKillRate, falseKeepRate,
|
|
51
|
+
uncertainRate: entries.length ? uncertain / entries.length : 0,
|
|
52
|
+
intervals,
|
|
53
|
+
disposition,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function qualifyJudge(slices, criticalSliceKeys = []) {
|
|
57
|
+
const automatedSlices = slices.filter(s => s.disposition === 'automate').map(s => s.key);
|
|
58
|
+
const humanReviewSlices = slices.filter(s => s.disposition === 'human-review').map(s => s.key);
|
|
59
|
+
const abstainSlices = slices.filter(s => s.disposition === 'abstain').map(s => s.key);
|
|
60
|
+
const presentKeys = new Set(slices.map(s => s.key));
|
|
61
|
+
const missingCriticalKeys = criticalSliceKeys.filter(key => !presentKeys.has(key));
|
|
62
|
+
const criticalFailures = slices.filter(s => criticalSliceKeys.includes(s.key) && s.disposition !== 'automate');
|
|
63
|
+
const status = criticalFailures.length > 0 || missingCriticalKeys.length > 0
|
|
64
|
+
? 'unqualified'
|
|
65
|
+
: humanReviewSlices.length > 0 || abstainSlices.length > 0
|
|
66
|
+
? 'restricted'
|
|
67
|
+
: 'qualified';
|
|
68
|
+
return {
|
|
69
|
+
status, automatedSlices, humanReviewSlices, abstainSlices,
|
|
70
|
+
reasons: [
|
|
71
|
+
...criticalFailures.map(s => `Critical slice ${s.key} is ${s.disposition}`),
|
|
72
|
+
...missingCriticalKeys.map(key => `Critical slice ${key} is missing`),
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
2
76
|
/** Run the verifier over a labeled set and report the confusion vs ground truth. */
|
|
3
|
-
export async function calibrate(labeled, opts) {
|
|
77
|
+
export async function calibrate(labeled, opts, qualificationOptions = {}) {
|
|
4
78
|
const verdicts = await adversarialVerify(labeled.map((l) => l.finding), opts);
|
|
79
|
+
const policy = { ...DEFAULT_QUALIFICATION, ...qualificationOptions };
|
|
5
80
|
const r = {
|
|
6
81
|
total: labeled.length, realCount: 0, falseCount: 0,
|
|
7
82
|
falseKill: 0, falseKillRate: 0, falseKeep: 0, falseKeepRate: 0,
|
|
8
|
-
correctConfirm: 0, correctKill: 0, uncertain: 0,
|
|
83
|
+
correctConfirm: 0, correctKill: 0, uncertain: 0, slices: [],
|
|
84
|
+
qualification: {
|
|
85
|
+
status: 'restricted', automatedSlices: [], humanReviewSlices: [],
|
|
86
|
+
abstainSlices: [], reasons: [],
|
|
87
|
+
},
|
|
9
88
|
};
|
|
10
89
|
labeled.forEach((l, i) => {
|
|
11
90
|
const v = verdicts[i].verdict;
|
|
@@ -28,6 +107,29 @@ export async function calibrate(labeled, opts) {
|
|
|
28
107
|
});
|
|
29
108
|
r.falseKillRate = r.realCount ? r.falseKill / r.realCount : 0;
|
|
30
109
|
r.falseKeepRate = r.falseCount ? r.falseKeep / r.falseCount : 0;
|
|
110
|
+
const entries = labeled.map((label, index) => ({ label, verdict: verdicts[index].verdict }));
|
|
111
|
+
const groups = new Map();
|
|
112
|
+
const add = (key, entry) => {
|
|
113
|
+
const group = groups.get(key) ?? [];
|
|
114
|
+
group.push(entry);
|
|
115
|
+
groups.set(key, group);
|
|
116
|
+
};
|
|
117
|
+
entries.forEach(entry => {
|
|
118
|
+
add('overall', entry);
|
|
119
|
+
if (entry.label.failureType)
|
|
120
|
+
add(`failureType:${entry.label.failureType}`, entry);
|
|
121
|
+
if (entry.label.domain)
|
|
122
|
+
add(`domain:${entry.label.domain}`, entry);
|
|
123
|
+
const severity = entry.label.expectedSeverity ?? entry.label.finding.severity;
|
|
124
|
+
add(`severity:${severity}`, entry);
|
|
125
|
+
});
|
|
126
|
+
const criticalKeys = policy.criticalSeverities.map(severity => `severity:${severity}`);
|
|
127
|
+
for (const key of criticalKeys) {
|
|
128
|
+
if (!groups.has(key))
|
|
129
|
+
groups.set(key, []);
|
|
130
|
+
}
|
|
131
|
+
r.slices = [...groups.entries()].map(([key, group]) => buildSlice(key, group, policy));
|
|
132
|
+
r.qualification = qualifyJudge(r.slices, criticalKeys);
|
|
31
133
|
return r;
|
|
32
134
|
}
|
|
33
135
|
//# sourceMappingURL=calibrate.js.map
|
|
@@ -15,6 +15,6 @@ export type { Finding, FindingVerdict, FindingSeverity, FindingOutcome, RefuterV
|
|
|
15
15
|
export { adversarialVerify, partitionVerdicts } from './verify.js';
|
|
16
16
|
export { synthesizeVerdict, majorityKill, isFindingVerdict } from './synthesize.js';
|
|
17
17
|
export { refuterPrompt, DEFAULT_LENSES } from './prompts.js';
|
|
18
|
-
export { calibrate, type LabeledFinding, type
|
|
18
|
+
export { calibrate, qualifyJudge, type CalibrationReport, type ConfidenceInterval, type JudgeQualification, type LabeledFinding, type QualificationDisposition, type QualificationOptions, type QualificationSlice, } from './calibrate.js';
|
|
19
19
|
export { verifyGate, type VerifyGateOptions, type VerifyGateResult } from './gate.js';
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { adversarialVerify, partitionVerdicts } from './verify.js';
|
|
2
2
|
export { synthesizeVerdict, majorityKill, isFindingVerdict } from './synthesize.js';
|
|
3
3
|
export { refuterPrompt, DEFAULT_LENSES } from './prompts.js';
|
|
4
|
-
export { calibrate } from './calibrate.js';
|
|
4
|
+
export { calibrate, qualifyJudge, } from './calibrate.js';
|
|
5
5
|
export { verifyGate } from './gate.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-qe",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "Agentic Quality Engineering V3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 60 specialized QE agents, mathematical Coherence verification, deep Claude Flow integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,13 +52,18 @@
|
|
|
52
52
|
"./verification/adversarial-verify": {
|
|
53
53
|
"import": "./dist/verification/adversarial-verify/index.js",
|
|
54
54
|
"types": "./dist/verification/adversarial-verify/index.d.ts"
|
|
55
|
+
},
|
|
56
|
+
"./skills/qe-court/referee": {
|
|
57
|
+
"import": "./dist/skills/qe-court/referee.js",
|
|
58
|
+
"types": "./dist/skills/qe-court/referee.d.ts"
|
|
55
59
|
}
|
|
56
60
|
},
|
|
57
61
|
"bin": {
|
|
58
62
|
"agentic-qe": "./dist/cli/bundle.js",
|
|
59
63
|
"aqe": "./dist/cli/bundle.js",
|
|
60
64
|
"aqe-v3": "./dist/cli/bundle.js",
|
|
61
|
-
"aqe-mcp": "./dist/mcp/bundle.js"
|
|
65
|
+
"aqe-mcp": "./dist/mcp/bundle.js",
|
|
66
|
+
"aqe-court-referee": "./dist/skills/qe-court/cli.js"
|
|
62
67
|
},
|
|
63
68
|
"scripts": {
|
|
64
69
|
"preinstall": "node scripts/preinstall.cjs || true",
|
|
@@ -73,7 +78,7 @@
|
|
|
73
78
|
"mcp": "tsx src/mcp/entry.ts",
|
|
74
79
|
"test": "NODE_OPTIONS='--max-old-space-size=1024 --expose-gc' vitest run",
|
|
75
80
|
"test:unit": "npm run test:unit:fast && npm run test:unit:heavy && npm run test:unit:mcp",
|
|
76
|
-
"test:unit:fast": "vitest run --exclude='**/qe-reasoning-bank.test.ts' --exclude='**/qe-reasoning-bank-feedback-loop.test.ts' --exclude='**/aqe-learning-engine.test.ts' --exclude='**/aqe-learning-engine-patterns.test.ts' tests/unit/adapters tests/unit/shared tests/unit/cli tests/unit/learning tests/unit/kernel tests/unit/workers tests/unit/routing tests/unit/strange-loop tests/unit/sync tests/unit/feedback tests/unit/error-paths tests/unit/early-exit tests/unit/causal-discovery tests/unit/neural-optimizer tests/unit/test-scheduling tests/unit/logging tests/unit/validation tests/unit/memory tests/unit/performance tests/unit/scripts tests/unit/planning",
|
|
81
|
+
"test:unit:fast": "vitest run --exclude='**/qe-reasoning-bank.test.ts' --exclude='**/qe-reasoning-bank-feedback-loop.test.ts' --exclude='**/aqe-learning-engine.test.ts' --exclude='**/aqe-learning-engine-patterns.test.ts' tests/unit/adapters tests/unit/shared tests/unit/cli tests/unit/learning tests/unit/kernel tests/unit/workers tests/unit/routing tests/unit/strange-loop tests/unit/sync tests/unit/feedback tests/unit/error-paths tests/unit/early-exit tests/unit/causal-discovery tests/unit/neural-optimizer tests/unit/test-scheduling tests/unit/logging tests/unit/validation tests/unit/memory tests/unit/performance tests/unit/scripts tests/unit/planning tests/context",
|
|
77
82
|
"test:unit:heavy": "vitest run tests/unit/coordination tests/unit/domains tests/unit/integrations tests/unit/optimization tests/unit/init --exclude='**/browser/**' --exclude='**/*.e2e.test.ts' --exclude='**/vibium/**' --exclude='**/browser-swarm-coordinator.test.ts'",
|
|
78
83
|
"test:unit:mcp": "vitest run tests/unit/mcp --exclude='**/mcp/handlers/domain-handlers.test.ts' --fileParallelism=false",
|
|
79
84
|
"test:ci": "vitest run --exclude='**/browser/**' --exclude='**/*.e2e.test.ts' --exclude='**/vibium/**' --exclude='**/integration/browser/**' --exclude='**/browser-swarm-coordinator.test.ts' --exclude='**/mcp/handlers/domain-handlers.test.ts' --exclude='**/fixtures/init-corpus/**'",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{a,b,c}from"./chunk-NJ4YVAG7.js";import"./chunk-AKUDUB3O.js";import"./chunk-5PNQNBDZ.js";import"./chunk-VA2ORJB5.js";import"./chunk-L3GBNX7B.js";import"./chunk-ZMYV4R32.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{a,b,c,d,e,f}from"./chunk-NL2SCAGJ.js";import"./chunk-NJ3QXJ54.js";import"./chunk-TWUWLSGQ.js";import"./chunk-TK5XLF3Z.js";import"./chunk-4M7YZ2X7.js";import"./chunk-44NPKZGI.js";import"./chunk-OZ53BIY5.js";import"./chunk-YQOQVSYU.js";import"./chunk-GMLRIZ4E.js";import"./chunk-VNODKACB.js";import"./chunk-2W3D5A4R.js";import"./chunk-UWZYXI3R.js";import"./chunk-H3GAR4SV.js";import"./chunk-VQD2ELNL.js";import"./chunk-S6WHYOWV.js";import"./chunk-PGFCKE4G.js";import"./chunk-M73KM3AZ.js";import"./chunk-KRZYWVS3.js";import"./chunk-3ASVQILY.js";import"./chunk-GEQWCK4F.js";import"./chunk-IOJ34SXJ.js";import"./chunk-6KI6LAAZ.js";import"./chunk-VA2ORJB5.js";import"./chunk-7ZVO7I4Q.js";import"./chunk-HQWFZQMJ.js";import"./chunk-EDRPTLAX.js";import"./chunk-E67ZXRG6.js";import"./chunk-L3GBNX7B.js";import"./chunk-52VGZJSD.js";import"./chunk-Z56BBX77.js";import"./chunk-5E76HULA.js";import"./chunk-7LATB5IR.js";import"./chunk-4Z4X2ND4.js";import"./chunk-U5G6OC2C.js";import"./chunk-JVFZAJ5N.js";import"./chunk-2VTX4SYW.js";import"./chunk-N4OQ4D4V.js";import"./chunk-AN5CGTTJ.js";import"./chunk-ZMYV4R32.js";export{b as AQELearningEngine,a as DEFAULT_ENGINE_CONFIG,c as DEFAULT_META_LEARNING_CONFIG,d as MetaLearningEngine,e as createAQELearningEngine,f as createDefaultLearningEngine};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-XIKYUBIV.js";import"./chunk-IT5QIUUA.js";import"./chunk-M73KM3AZ.js";import"./chunk-KRZYWVS3.js";import"./chunk-3ASVQILY.js";import"./chunk-GEQWCK4F.js";import"./chunk-IOJ34SXJ.js";import"./chunk-6KI6LAAZ.js";import"./chunk-VA2ORJB5.js";import"./chunk-L3GBNX7B.js";import"./chunk-52VGZJSD.js";import"./chunk-XM5I7J5S.js";import"./chunk-Z56BBX77.js";import"./chunk-5E76HULA.js";import"./chunk-7LATB5IR.js";import"./chunk-4Z4X2ND4.js";import"./chunk-U5G6OC2C.js";import"./chunk-JVFZAJ5N.js";import"./chunk-2VTX4SYW.js";import"./chunk-N4OQ4D4V.js";import"./chunk-AN5CGTTJ.js";import"./chunk-ZMYV4R32.js";export{l as MCPToolBase,k as defaultToolLogger,j as getKernel,i as getLLMRouter,e as getMemoryBackend,g as getSharedLLMRouter,c as getSharedMemoryBackend,a as isMemoryOnlyMode,b as registerRvfResetFn,h as resetSharedLLMRouter,d as resetSharedMemoryBackend,f as setSharedLLMRouter};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");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-X2SZCVDA.js";import{h as be}from"./chunk-UWZYXI3R.js";import{b as ye}from"./chunk-H3GAR4SV.js";import"./chunk-M73KM3AZ.js";import"./chunk-KRZYWVS3.js";import"./chunk-3ASVQILY.js";import"./chunk-GEQWCK4F.js";import"./chunk-IOJ34SXJ.js";import"./chunk-6KI6LAAZ.js";import{b as x,d as X}from"./chunk-VA2ORJB5.js";import{a as ue,b as pe,c as ge,d as k,f as Ke}from"./chunk-HQWFZQMJ.js";import"./chunk-L3GBNX7B.js";import{a as A,b as He}from"./chunk-Z56BBX77.js";import"./chunk-5E76HULA.js";import"./chunk-7LATB5IR.js";import"./chunk-4Z4X2ND4.js";import"./chunk-U5G6OC2C.js";import"./chunk-JVFZAJ5N.js";import"./chunk-2VTX4SYW.js";import"./chunk-N4OQ4D4V.js";import"./chunk-AN5CGTTJ.js";import"./chunk-ZMYV4R32.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
|
-
CREATE TEMP TABLE IF NOT EXISTS _covered_patterns (
|
|
4
|
-
pattern_id TEXT PRIMARY KEY
|
|
5
|
-
)
|
|
6
|
-
`),e.exec("DELETE FROM _covered_patterns"),e.exec(`
|
|
7
|
-
INSERT INTO _covered_patterns (pattern_id)
|
|
8
|
-
SELECT DISTINCT json_extract(action_data, '$.patternId')
|
|
9
|
-
FROM witness_chain
|
|
10
|
-
WHERE action_type = 'PATTERN_CREATE'
|
|
11
|
-
AND json_extract(action_data, '$.patternId') IS NOT NULL
|
|
12
|
-
`),e.exec(`
|
|
13
|
-
INSERT OR IGNORE INTO _covered_patterns (pattern_id)
|
|
14
|
-
SELECT DISTINCT json_extract(action_data, '$.pattern_id')
|
|
15
|
-
FROM witness_chain
|
|
16
|
-
WHERE action_type = 'PATTERN_CREATE'
|
|
17
|
-
AND json_extract(action_data, '$.pattern_id') IS NOT NULL
|
|
18
|
-
`);let t=e.prepare(`SELECT p.id, p.pattern_type, p.qe_domain, p.name, p.created_at
|
|
19
|
-
FROM qe_patterns p
|
|
20
|
-
LEFT JOIN _covered_patterns c ON p.id = c.pattern_id
|
|
21
|
-
WHERE c.pattern_id IS NULL
|
|
22
|
-
ORDER BY p.created_at ASC`).all(),i=e.prepare("SELECT COUNT(*) as count FROM qe_patterns").get().count-t.length,d=0;for(let s of t)n.append("PATTERN_CREATE",{patternId:s.id,patternType:s.pattern_type,qeDomain:s.qe_domain,name:s.name,originalCreatedAt:s.created_at,backfilled:!0},"system:backfill"),d++;return e.exec("DROP TABLE IF EXISTS _covered_patterns"),{created:d,skipped:i}}async function Fe(e,n){if(Dn(n.format)==="rvf"){let a=A(e,{readonly:!0});try{return Be(a,{outputPath:n.outputPath,domains:n.domains},e)}finally{a.close()}}let t=A(e,{readonly:!0});try{return Re(t,n,e)}finally{t.close()}}async function Le(e,n,r){if(Ue(n,r.format)==="rvf"){let i=A(e);try{return _e(i,n,{mergeStrategy:r.mergeStrategy,dryRun:r.dryRun})}finally{i.close()}}let a=A(e);try{return Se(a,n,r)}finally{a.close()}}async function Pe(e,n){return Ue(e,n)==="rvf"?G(e):xe(e)}async function je(e,n,r={}){return De(e,n,r)}async function Ve(e,n={}){return Te(e,n)}async function Je(e){let n=A(e);try{let r=be(n,ye());return await r.initialize(),qe(n,r)}finally{n.close()}}function Dn(e){if(e==="jsonl")return"jsonl";if(e==="rvf"){if(!ae())throw new Error("RVF format requested but @ruvector/rvf-node is not available on this platform. Use --format jsonl instead.");return"rvf"}return ae()?"rvf":"jsonl"}function Ue(e,n){return n==="rvf"?"rvf":n==="jsonl"?"jsonl":e.endsWith(".rvf")?"rvf":"jsonl"}var fe=class{name="brain";description="Export, import, and inspect QE brain state";cleanupAndExit;ensureInitialized;constructor(n,r){this.cleanupAndExit=n,this.ensureInitialized=r}register(n,r){let t=n.command("brain").description(this.description);t.command("export").description("Export brain state to a portable directory").requiredOption("-o, --output <path>","Output directory path").option("--format <format>","Export format: rvf (default) or jsonl","rvf").option("--db <path>","Source database path").action(async a=>{await this.executeExport(a)}),t.command("import").description("Import brain state from an export directory").requiredOption("-i, --input <path>","Path to brain export directory").option("--strategy <strategy>","Merge strategy","skip-conflicts").option("--dry-run","Preview import without writing",!1).option("--db <path>","Target database path").action(async a=>{await this.executeImport(a)}),t.command("info").description("Show manifest info for a brain export").requiredOption("-i, --input <path>","Path to brain export directory").action(async a=>{await this.executeInfo(a)}),t.command("witness-backfill").description("Create witness chain entries for patterns that predate the witness chain").option("--db <path>","Database path").action(async a=>{await this.executeWitnessBackfill(a)}),t.command("diff").description("Compare two brain exports (JSONL directory or .rvf file)").argument("<a>","Path to first brain export").argument("<b>","Path to second brain export").option("--table <name>","Restrict comparison to a single table").option("--verbose","Show the IDs of added/removed/changed records",!1).option("--json","Emit the diff as JSON to stdout",!1).action(async(a,i,d)=>{await this.executeDiff(a,i,d)}),t.command("search").description("Search a JSONL brain export with filters").requiredOption("-i, --input <path>","Path to brain export directory (JSONL)").option("--table <name>","Table to search (default: qe_patterns)").option("--domain <name...>","Restrict to one or more domains").option("--pattern-type <type>","Restrict to a specific pattern_type (qe_patterns only)").option("--since <iso>","Include rows with timestamp \u2265 <iso>").option("--until <iso>","Include rows with timestamp \u2264 <iso>").option("-q, --query <text>","Substring match across name + description (case-insensitive)").option("-l, --limit <n>","Maximum results to return","20").option("--json","Emit results as JSON to stdout",!1).action(async a=>{await this.executeSearch(a)})}async executeExport(n){try{console.log(o.blue(`
|
|
23
|
-
Exporting brain state (format: ${n.format})...
|
|
24
|
-
`));let r=await de(n.db),t=await Fe(r,{outputPath:B.resolve(n.output),format:n.format});if(console.log(o.green(" Export complete.")),console.log(` Format: ${o.cyan("format"in t?t.format??"jsonl":"jsonl")}`),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"embeddingCount"in t.stats?console.log(` Vectors: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`),"rvfStatus"in t){let a=t.rvfStatus;console.log(` RVF Size: ${o.cyan(We(a.fileSizeBytes))}`),console.log(` Segments: ${o.cyan(a.totalSegments)}`)}console.log(` Checksum: ${o.gray(t.checksum)}`),console.log(` Output: ${o.cyan(B.resolve(n.output))}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
25
|
-
Brain export failed:`),r),await this.cleanupAndExit(1)}}async executeImport(n){try{n.dryRun?console.log(o.yellow(`
|
|
26
|
-
Dry-run mode \u2014 no data will be written.
|
|
27
|
-
`)):console.log(o.blue(`
|
|
28
|
-
Importing brain state...
|
|
29
|
-
`));let r=await de(n.db),t=await Le(r,B.resolve(n.input),{mergeStrategy:n.strategy,dryRun:n.dryRun});console.log(o.green(" Import complete.")),console.log(` Imported: ${o.cyan(t.imported)}`),console.log(` Skipped: ${o.yellow(t.skipped)}`),console.log(` Conflicts: ${o.red(t.conflicts)}`),"embeddingsRestored"in t&&console.log(` Embeddings: ${o.cyan(t.embeddingsRestored)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
30
|
-
Brain import failed:`),r),await this.cleanupAndExit(1)}}async executeInfo(n){try{console.log(o.blue(`
|
|
31
|
-
Brain Export Info
|
|
32
|
-
`));let r=B.resolve(n.input),t=await Pe(r),a="format"in t?t.format??"jsonl":"jsonl";if(console.log(` Version: ${o.cyan(t.version)}`),console.log(` Format: ${o.cyan(a)}`),console.log(` Exported: ${o.cyan(t.exportedAt)}`),console.log(` Source DB: ${o.cyan(t.sourceDb)}`),console.log(o.blue(`
|
|
33
|
-
Learning Data:`)),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"qValueCount"in t.stats&&console.log(` Q-Values: ${o.cyan(t.stats.qValueCount)}`),"dreamInsightCount"in t.stats){let s=t.stats.dreamInsightCount,f=("tableRecordCounts"in t?t.tableRecordCounts:void 0)?.dream_cycles,u=f!==void 0?` (${f} cycles)`:"";console.log(` Dream Insights: ${o.cyan(s)}${o.gray(u)}`)}"witnessChainLength"in t.stats&&console.log(` Witness Chain: ${o.cyan(t.stats.witnessChainLength)} entries`),"embeddingCount"in t.stats?console.log(` Embeddings: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`);let i="tableRecordCounts"in t?t.tableRecordCounts:void 0;if(i){let s=Object.entries(i).filter(([l,f])=>f>0&&!["qe_patterns","rl_q_values","dream_insights","dream_cycles","witness_chain","vectors","qe_pattern_embeddings"].includes(l));if(s.length>0)for(let[l,f]of s){let y=`${l.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase())}:`.padEnd(15);console.log(` ${y}${o.cyan(f)}`)}}let d="totalRecords"in t.stats?t.stats.totalRecords:void 0;if(d!==void 0&&(console.log(o.blue(`
|
|
34
|
-
Summary:`)),console.log(` Total Records: ${o.cyan(d)}`)),"domains"in t&&Array.isArray(t.domains)&&t.domains.length>0&&(d||console.log(o.blue(`
|
|
35
|
-
Summary:`)),console.log(` Domains: ${o.cyan(t.domains.join(", "))}`)),"rvfStatus"in t){let s=t.rvfStatus;console.log(o.blue(`
|
|
36
|
-
RVF Details:`)),console.log(` File Size: ${o.cyan(We(s.fileSizeBytes))}`),console.log(` Vectors: ${o.cyan(s.totalVectors)}`),console.log(` Segments: ${o.cyan(s.totalSegments)}`)}if("lineage"in t){let s=t.lineage;s&&(console.log(o.blue(`
|
|
37
|
-
Lineage:`)),console.log(` File ID: ${o.cyan(s.fileId)}`),console.log(` Parent ID: ${o.cyan(s.parentId??"none (root)")}`),console.log(` Depth: ${o.cyan(s.lineageDepth)}`))}if("signature"in t){let s=t.signature,l=t.signerKeyId;console.log(o.blue(`
|
|
38
|
-
Signature:`)),s?(console.log(` Status: ${o.green("Signed")}`),console.log(` Key ID: ${o.cyan(l??"unknown")}`),console.log(` Signature: ${o.gray(s.slice(0,32)+"...")}`)):console.log(` Status: ${o.yellow("Unsigned")}`)}console.log(`
|
|
39
|
-
Checksum: ${o.gray(t.checksum)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
40
|
-
Failed to read brain info:`),r),await this.cleanupAndExit(1)}}async executeDiff(n,r,t){try{let a=await je(B.resolve(n),B.resolve(r),{tableFilter:t.table});if(t.json){process.stdout.write(JSON.stringify(a,null,2)+`
|
|
41
|
-
`),await this.cleanupAndExit(a.identical?0:1);return}Tn(a,t.verbose),await this.cleanupAndExit(a.identical?0:1)}catch(a){console.error(o.red(`
|
|
42
|
-
Brain diff failed:`),a),await this.cleanupAndExit(2)}}async executeSearch(n){try{let r=$n(n.limit),t=kn(n.domain),a=await Ve(B.resolve(n.input),{table:n.table,domains:t,patternType:n.patternType,since:n.since,until:n.until,query:n.query,limit:r});if(n.json){process.stdout.write(JSON.stringify(a,null,2)+`
|
|
43
|
-
`),await this.cleanupAndExit(a.totalMatched>0?0:3);return}Fn(a),await this.cleanupAndExit(a.totalMatched>0?0:3)}catch(r){console.error(o.red(`
|
|
44
|
-
Brain search failed:`),r),await this.cleanupAndExit(2)}}async executeWitnessBackfill(n){try{console.log(o.blue(`
|
|
45
|
-
Running witness chain backfill...
|
|
46
|
-
`));let r=await de(n.db),t=await Je(r);console.log(o.green(" Backfill complete.")),console.log(` Created: ${o.cyan(t.created)} new witness entries`),console.log(` Skipped: ${o.cyan(t.skipped)} (already witnessed)`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
47
|
-
Witness backfill failed:`),r),await this.cleanupAndExit(1)}}getHelp(){return`
|
|
48
|
-
Export, import, and inspect QE brain state.
|
|
49
|
-
|
|
50
|
-
Formats:
|
|
51
|
-
rvf \u2014 Single portable .rvf file (default, requires @ruvector/rvf-node)
|
|
52
|
-
jsonl \u2014 JSONL directory format (fallback when native not available)
|
|
53
|
-
|
|
54
|
-
Usage:
|
|
55
|
-
aqe brain export -o brain.rvf [--format rvf] [--db <path>]
|
|
56
|
-
aqe brain export -o ./brain-dir --format jsonl [--db <path>]
|
|
57
|
-
aqe brain import -i brain.rvf [--strategy skip-conflicts] [--dry-run] [--db <path>]
|
|
58
|
-
aqe brain info -i brain.rvf
|
|
59
|
-
|
|
60
|
-
Subcommands:
|
|
61
|
-
export Export brain state to a portable .rvf file or JSONL directory
|
|
62
|
-
import Import a brain export into the local database
|
|
63
|
-
info Show manifest metadata for an existing brain export
|
|
64
|
-
diff Compare two brain exports (manifest always; record-level for JSONL)
|
|
65
|
-
search Filtered search over a JSONL brain export
|
|
66
|
-
|
|
67
|
-
Examples:
|
|
68
|
-
aqe brain export -o .agentic-qe/brain.rvf
|
|
69
|
-
aqe brain export -o .agentic-qe/brain.rvf --format rvf
|
|
70
|
-
aqe brain export -o ./brain-export --format jsonl
|
|
71
|
-
aqe brain import -i .agentic-qe/brain.rvf --strategy latest-wins
|
|
72
|
-
aqe brain import -i .agentic-qe/brain.rvf --dry-run
|
|
73
|
-
aqe brain info -i .agentic-qe/brain.rvf
|
|
74
|
-
aqe brain diff ./brain-a ./brain-b --verbose
|
|
75
|
-
aqe brain search -i ./brain-export --query oauth --domain test-generation
|
|
76
|
-
aqe brain search -i ./brain-export --since 2026-03-01 --limit 50 --json
|
|
77
|
-
`}};async function de(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-ATILROKR.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
|
-
Brain Diff
|
|
79
|
-
`)),console.log(` A: ${o.cyan(e.pathA)} (${e.formatA})`),console.log(` B: ${o.cyan(e.pathB)} (${e.formatB})`),console.log(` Versions: ${o.cyan(e.manifestA.version)} \u2192 ${o.cyan(e.manifestB.version)}`+(e.versionMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Checksums: ${o.gray(e.manifestA.checksum.slice(0,12))}\u2026 \u2192 ${o.gray(e.manifestB.checksum.slice(0,12))}\u2026`+(e.checksumMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Exported: ${o.gray(e.manifestA.exportedAt)} \u2192 ${o.gray(e.manifestB.exportedAt)}`),console.log(` Records: ${o.cyan(e.manifestA.totalRecords)} \u2192 ${o.cyan(e.manifestB.totalRecords)} `+ze(e.manifestB.totalRecords-e.manifestA.totalRecords)),(e.domainsOnlyInA.length>0||e.domainsOnlyInB.length>0)&&(console.log(o.blue(`
|
|
80
|
-
Domains:`)),e.domainsOnlyInA.length>0&&console.log(` Only in A: ${o.yellow(e.domainsOnlyInA.join(", "))}`),e.domainsOnlyInB.length>0&&console.log(` Only in B: ${o.yellow(e.domainsOnlyInB.join(", "))}`)),e.recordLevel||console.log(o.gray(`
|
|
81
|
-
Note: record-level diff is only available when both sides are JSONL exports.
|
|
82
|
-
Per-table counts shown below; re-export with --format jsonl for added/removed/changed IDs.`)),console.log(o.blue(`
|
|
83
|
-
Tables:`));let r=e.tableDiffs.filter(Mn);if(r.length===0)console.log(o.gray(" (no differences)"));else for(let t of r)console.log(` ${t.tableName.padEnd(28)} ${o.cyan(String(t.countA).padStart(7))} \u2192 ${o.cyan(String(t.countB).padStart(7))} ${ze(t.delta)}`+qn(t,n)),n&&(t.added&&t.added.length>0&&ce("added",t.added),t.removed&&t.removed.length>0&&ce("removed",t.removed),t.changed&&t.changed.length>0&&ce("changed",t.changed));console.log(""),e.identical?console.log(o.green(` Result: identical
|
|
84
|
-
`)):console.log(o.yellow(` Result: differences found
|
|
85
|
-
`))}function Mn(e){return!!(e.delta!==0||e.added&&e.added.length>0||e.removed&&e.removed.length>0||e.changed&&e.changed.length>0)}function ze(e){return e===0?o.gray("(\xB10)"):e>0?o.green(`(+${e})`):o.red(`(${e})`)}function qn(e,n){let r=[];return e.added&&e.added.length>0&&r.push(o.green(`+${e.added.length}`)),e.removed&&e.removed.length>0&&r.push(o.red(`-${e.removed.length}`)),e.changed&&e.changed.length>0&&r.push(o.yellow(`~${e.changed.length}`)),r.length===0?"":n?" "+r.join(" "):" "+o.gray("[")+r.join(" ")+o.gray("]")}function ce(e,n){let r=n.slice(0,10).join(", "),t=n.length>10?o.gray(` \u2026(+${n.length-10} more)`):"";console.log(` ${o.gray(e+":")} ${r}${t}`)}function Fn(e){if(console.log(o.blue(`
|
|
86
|
-
Brain Search
|
|
87
|
-
`)),console.log(` Input: ${o.cyan(e.inputPath)}`),console.log(` Table: ${o.cyan(e.table)}`),console.log(` Scanned: ${o.cyan(e.totalScanned)} Matched: ${o.cyan(e.totalMatched)} Shown: ${o.cyan(e.hits.length)}`+(e.truncated?o.yellow(` (truncated to limit ${e.limit})`):"")),e.hits.length===0){console.log(o.yellow(`
|
|
88
|
-
No matching rows.
|
|
89
|
-
`));return}console.log("");for(let n of e.hits){let r=o.cyan(n.id)+(n.display.patternType?o.gray(` ${n.display.patternType}`):"")+(n.display.domain?o.gray(` [${n.display.domain}]`):"")+(n.display.confidence!==void 0?o.gray(` conf=${n.display.confidence.toFixed(2)}`):"");if(console.log(` ${r}`),n.display.name&&console.log(` ${o.bold(n.display.name)}`),n.display.description){let t=n.display.description.length>200?n.display.description.slice(0,200)+"\u2026":n.display.description;console.log(` ${o.gray(t)}`)}n.display.updatedAt&&console.log(` ${o.gray(n.display.updatedAt)}`),console.log("")}}function wt(e,n){return new fe(e,n)}export{fe as BrainHandler,wt as createBrainHandler};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{a}from"./chunk-MLFELTJX.js";import"./chunk-XIKYUBIV.js";import"./chunk-IT5QIUUA.js";import"./chunk-M73KM3AZ.js";import"./chunk-KRZYWVS3.js";import"./chunk-3ASVQILY.js";import"./chunk-GEQWCK4F.js";import"./chunk-IOJ34SXJ.js";import"./chunk-6KI6LAAZ.js";import"./chunk-VA2ORJB5.js";import"./chunk-L3GBNX7B.js";import"./chunk-52VGZJSD.js";import"./chunk-XM5I7J5S.js";import"./chunk-Z56BBX77.js";import"./chunk-5E76HULA.js";import"./chunk-7LATB5IR.js";import"./chunk-4Z4X2ND4.js";import"./chunk-U5G6OC2C.js";import"./chunk-JVFZAJ5N.js";import"./chunk-2VTX4SYW.js";import"./chunk-N4OQ4D4V.js";import"./chunk-AN5CGTTJ.js";import"./chunk-ZMYV4R32.js";export{a as BrowserWorkflowTool};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{existsSync as i,openSync as c,readSync as s,closeSync as l,renameSync as a,unlinkSync as d}from"fs";var f="FLVR",u=4,b=["",".idmap.json",".manifest.json"];function p(n,e){let r;try{r=c(n,"r");let t=Buffer.alloc(e);return s(r,t,0,e,0)<e?null:t}catch{return null}finally{if(r!==void 0)try{l(r)}catch{}}}function y(n){try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}function S(n){let e=p(`${n}.lock`,u+4);if(!e||e.subarray(0,4).toString("latin1")!==f)return null;let r=e.readUInt32LE(u);return r>0?r:null}function $(n){let e=S(n);return e===null?!1:y(e)}function g(n,e){if(!i(n))return null;if($(n))return console.warn(`[RVF] ${n} is unusable but its lock is held by a live process \u2014 leaving it alone and degrading to SQLite for this run.`),null;let r=`${n}.corrupt-${process.pid}`;for(let t of b){let o=`${n}${t}`;if(i(o))try{a(o,`${r}${t}`)}catch{}}try{i(`${n}.lock`)&&d(`${n}.lock`)}catch{}return console.warn(`[RVF] Quarantined unusable store ${n} \u2192 ${r} (${e}). It is a derived cache and will be rebuilt from the unified DB. Please report a recurrence with the quarantined files (issue #563).`),r}export{S as a,$ as b,g as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{a as e,b as g,e as r}from"./chunk-IOJ34SXJ.js";import{c as o}from"./chunk-ZMYV4R32.js";var L=o(()=>{"use strict";e();g();r()});export{L as a};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{c as y,e as v,f as R}from"./chunk-NLZUGANH.js";import{d as u}from"./chunk-UC4EIULB.js";import{a as p,b as g,c as P,d as s}from"./chunk-WYIXNHPF.js";import{d as f,e as C}from"./chunk-IOJ34SXJ.js";C();var E=f("llm/router-service");function m(e){let r={};for(let[i,t]of Object.entries(e.providers??{}))t?.defaultModel&&(r[i]=t.defaultModel);p(e.agentOverrides,r);let o=g();if(o.length===0)return e;let n=e.rules.length>0?e.rules:P;return{...e,rules:[...o,...n]}}var T=["ollama","onnx","gemini","openrouter","openai","claude","azure-openai","bedrock"];async function F(e={}){if(e.providerManager){let a=m(v({projectRoot:e.projectRoot,override:e.override,env:e.env})),d=new s(e.providerManager,a);return await d.initialize(),{router:d,resolvedConfig:a,enabledProviders:x(a)}}if(!R({projectRoot:e.projectRoot,env:e.env}))return null;let r=m(v({projectRoot:e.projectRoot,override:e.override,env:e.env})),o=M(r,e.env??process.env);if(o.length===0)return null;let n=new Set(o);for(let[a,d]of Object.entries(r.agentOverrides??{}))d.provider&&!n.has(d.provider)&&E.warn(`[llm-config] agentOverrides["${a}"] routes to provider "${d.provider}", which is not enabled (no API key detected and not enabled in .agentic-qe/llm-config.json). This override will not take effect until that provider is available.`);let{primary:i,fallbacks:t}=L(r,o),l={primary:i,fallbacks:t,providers:k(r,o),loadBalancing:"round-robin",global:{enableCostTracking:!0,enableMetrics:!0}},b=new u(l),c=new s(b,r);return await c.initialize(),{router:c,resolvedConfig:r,enabledProviders:o}}function M(e,r=process.env){let o=y(r),n=[],i=t=>{n.includes(t)||!e.providers?.[t]?.enabled||o.has(t)&&n.push(t)};i(e.defaultProvider);for(let t of e.fallbackChain?.entries??[])i(t.provider);for(let t of T)i(t);return n}function x(e){let r=new Set([e.defaultProvider]);for(let o of e.fallbackChain?.entries??[])r.add(o.provider);return Array.from(r)}function L(e,r){if(r.length===0)throw new Error("pickPrimaryAndFallbacks: no enabled providers");let o=r.includes(e.defaultProvider)?e.defaultProvider:r[0],n=r.filter(i=>i!==o);return{primary:o,fallbacks:n}}function k(e,r){let o={};for(let n of r){let i=e.providers?.[n];i&&(o[n]=i)}return o}export{F as a,M as b,L as c};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{a as k,b as I,c as $,d as L,f as h}from"./chunk-WA6CSEOX.js";import{a as S,b as E,c as N}from"./chunk-TDVMILKO.js";import{b as g}from"./chunk-UQ4UCHO7.js";import{m as G}from"./chunk-M73KM3AZ.js";import{d as _,e as B}from"./chunk-IOJ34SXJ.js";import{b as M}from"./chunk-6KI6LAAZ.js";import{spawn as V}from"node:child_process";import{accessSync as q,constants as H,statSync as z}from"node:fs";import{delimiter as X,join as Q}from"node:path";var W=18e4,Z=2,b="default";function x(n,t){if(!t||typeof t!="object")return`externalProviders["${n}"] must be an object`;let e=t;if(e.kind!=="cli")return`externalProviders["${n}"].kind must be "cli" (got ${JSON.stringify(e.kind)})`;if(!Array.isArray(e.command)||e.command.length===0)return`externalProviders["${n}"].command must be a non-empty string array`;if(!e.command.every(r=>typeof r=="string"&&r.length>0))return`externalProviders["${n}"].command must contain only non-empty strings`;if(e.billingMode!==void 0&&!["subscription","metered-api","metered-capped","local"].includes(e.billingMode))return`externalProviders["${n}"].billingMode "${String(e.billingMode)}" is not a valid billing mode`;if(e.models!==void 0&&(!Array.isArray(e.models)||e.models.some(r=>typeof r!="string")))return`externalProviders["${n}"].models must be a string array`;if(e.timeoutMs!==void 0&&(typeof e.timeoutMs!="number"||e.timeoutMs<=0))return`externalProviders["${n}"].timeoutMs must be a positive number`;if(e.maxConcurrency!==void 0&&(typeof e.maxConcurrency!="number"||e.maxConcurrency<1))return`externalProviders["${n}"].maxConcurrency must be >= 1`;if(e.stripEnv!==void 0&&(!Array.isArray(e.stripEnv)||e.stripEnv.some(r=>typeof r!="string")))return`externalProviders["${n}"].stripEnv must be a string array`;if("apiKey"in e)return`externalProviders["${n}"] must not contain an apiKey \u2014 keys belong in the environment, not in llm-config.json`}var y=class n{type;name;billingMode;config;requestCounter=0;availabilityCache;active=0;queue=[];constructor(t,e){let r=x(t,e);if(r)throw g(r,"INVALID_REGISTRATION",{retryable:!1});this.type=t,this.config=e,this.name=e.displayName??t,this.billingMode=e.billingMode??"metered-api"}async isAvailable(){let t=Date.now();if(this.availabilityCache&&t-this.availabilityCache.at<6e4)return this.availabilityCache.available;let e=ee(this.config.command[0]);return this.availabilityCache={at:t,available:e},e}async healthCheck(){let t=Date.now(),e=await this.isAvailable(),r=Date.now()-t;return e?{healthy:!0,latencyMs:r,models:this.getSupportedModels(),details:{command:this.config.command[0],billing:this.billingMode,external:!0}}:{healthy:!1,latencyMs:r,error:`External provider "${this.type}" could not run "${this.config.command[0]}". Check that the host is installed and on PATH.`}}async generate(t,e){let r=e?.model??this.defaultModel(),i=`${this.type}-${++this.requestCounter}-${Date.now()}`,o=re(t,e?.systemPrompt),s=e?.timeoutMs??this.config.timeoutMs??W,l=[];this.config.modelFlag&&r&&r!==b&&l.push(this.config.modelFlag,r);let a=Date.now(),{code:d,stdout:c,stderr:m}=await this.withConcurrency(()=>this.spawnHost(l,o,s)),f=Date.now()-a,v=c.trim();if(d!==0&&!v)throw this.classifyError(m||`${this.type} exited with code ${d}`,r);let u=Math.ceil(o.length/4),w=Math.ceil(v.length/4),J={promptTokens:u,completionTokens:w,totalTokens:u+w};return{content:v,model:r,provider:this.type,usage:J,cost:{inputCost:0,outputCost:0,totalCost:0,currency:"USD",source:"local-estimate"},latencyMs:f,finishReason:"stop",cached:!1,requestId:i}}async embed(t,e){throw g(`External provider "${this.type}" does not support embeddings. Use a provider with an embeddings endpoint (openai, ollama, cognitum).`,"EMBEDDING_UNSUPPORTED",{provider:this.type,retryable:!1})}async complete(t,e){let r=await this.generate(t,{model:e?.model,temperature:e?.temperature,maxTokens:e?.maxTokens});return{completion:r.content,model:r.model,provider:this.type,usage:r.usage,latencyMs:r.latencyMs,cached:r.cached}}getConfig(){return{...this.config}}getSupportedModels(){return[...this.config.models??[b]]}getCostPerToken(){return{input:0,output:0}}async dispose(){}defaultModel(){return this.config.defaultModel??this.config.models?.[0]??b}static childEnv(t=[],e=process.env){let r={...e};for(let i of t)delete r[i];return r}classifyError(t,e){let r=t.toLowerCase();return r.includes("rate limit")||r.includes("usage limit")||r.includes("429")||r.includes("quota")?g(t,"RATE_LIMITED",{provider:this.type,model:e,retryable:!0,retryAfterMs:6e4}):g(t,"PROVIDER_UNAVAILABLE",{provider:this.type,model:e,retryable:!0})}spawnHost(t,e,r){let[i,...o]=this.config.command,s=[...o,...t];return new Promise((l,a)=>{let d=V(i,s,{env:n.childEnv(this.config.stripEnv),stdio:["pipe","pipe","pipe"]}),c="",m="",f=!1,v=setTimeout(()=>{f||(f=!0,d.kill("SIGKILL"),a(g(`${this.type} timed out after ${r}ms`,"TIMEOUT",{provider:this.type,retryable:!0})))},r);d.stdout.on("data",u=>c+=u.toString()),d.stderr.on("data",u=>m+=u.toString()),d.on("error",u=>{f||(f=!0,clearTimeout(v),a(g(`Failed to spawn "${i}" for provider "${this.type}": ${u.message}`,"PROVIDER_UNAVAILABLE",{provider:this.type,retryable:!1,cause:u})))}),d.on("close",u=>{f||(f=!0,clearTimeout(v),l({code:u??0,stdout:c,stderr:m}))}),d.stdin.on("error",()=>{});try{d.stdin.write(e),d.stdin.end()}catch{}})}async withConcurrency(t){let e=this.config.maxConcurrency??Z;this.active>=e&&await new Promise(r=>this.queue.push(r)),this.active++;try{return await t()}finally{this.active--;let r=this.queue.shift();r&&r()}}};function ee(n,t=process.env){let e=o=>{try{return q(o,H.X_OK),z(o).isFile()}catch{return!1}};if(n.includes("/")||n.includes("\\"))return e(n);let r=(t.PATH??"").split(X).filter(Boolean),i=process.platform==="win32"?["",...(t.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean)]:[""];return r.some(o=>i.some(s=>e(Q(o,n+s))))}function re(n,t){if(typeof n=="string")return t?`${t}
|
|
3
|
-
|
|
4
|
-
${n}`:n;let e=n.filter(o=>o.role==="system").map(o=>o.content);t&&e.unshift(t);let r=n.filter(o=>o.role!=="system").map(o=>`${o.role==="assistant"?"Assistant":"User"}: ${o.content}`).join(`
|
|
5
|
-
|
|
6
|
-
`);return`${e.length>0?`${e.join(`
|
|
7
|
-
|
|
8
|
-
`)}
|
|
9
|
-
|
|
10
|
-
`:""}${r}`}G();import*as p from"fs";import*as P from"path";var C=new Set;function j(n,t={}){let e=[],r=[],i=t.sourceDetail??".agentic-qe/llm-config.json",o=new Set(Object.keys(n??{}));for(let s of C)o.has(s)||$(s);C.clear();for(let[s,l]of Object.entries(n??{})){let a=k(s);if(a){r.push(`externalProviders["${s}"] ignored: ${a}`);continue}let d=x(s,l);if(d){r.push(`${d} \u2014 ignoring this entry.`);continue}let c=I(s,()=>new y(s,l),{billingMode:l.billingMode,displayName:l.displayName,models:l.models,config:l,source:"config",sourceDetail:i});if(c){r.push(`externalProviders["${s}"] ignored: ${c}`);continue}C.add(s),e.push(s)}return{registered:e,warnings:r}}function D(n){let t={},e=[];if(n===void 0)return{declarations:t,warnings:e};if(!n||typeof n!="object"||Array.isArray(n))return e.push("externalProviders must be an object keyed by provider type; ignoring it."),{declarations:t,warnings:e};for(let[r,i]of Object.entries(n)){if(!i||typeof i!="object"||Array.isArray(i)){e.push(`externalProviders["${r}"] must be an object; ignoring this entry.`);continue}t[r]=i}return{declarations:t,warnings:e}}B();var R=_("llm/router/config-store"),U="llm-config.json",te={claude:["ANTHROPIC_API_KEY","CLAUDE_API_KEY"],"claude-code":[],codex:[],openai:["OPENAI_API_KEY"],ollama:[],openrouter:["OPENROUTER_API_KEY"],gemini:["GOOGLE_AI_API_KEY","GEMINI_API_KEY","GOOGLE_API_KEY"],"azure-openai":["AZURE_OPENAI_API_KEY"],bedrock:["AWS_ACCESS_KEY_ID"],cognitum:["COGNITUM_API_KEY"],onnx:[]},ne=new Set(["claude","claude-code","codex","openai","ollama","openrouter","gemini","azure-openai","bedrock","cognitum"]);function F(n){return ne.has(n)||L(n)}function O(){return[...E,...h()]}function A(n){return S(n)?te[n]:[]}function T(n){let t=n??M();return P.join(t,".agentic-qe",U)}function oe(n=process.env){let t=new Set;for(let e of O()){if(!F(e))continue;let r=A(e);if(r.length===0){t.add(e);continue}r.some(i=>(n[i]??"").trim().length>0)&&t.add(e)}return t}function Y(n){let t=T(n);if(!p.existsSync(t))return{};let e=p.readFileSync(t,"utf8");if(!e.trim())return{};let r=JSON.parse(e);if(typeof r!="object"||r===null)throw new Error(`Invalid ${U}: expected object, got ${typeof r}`);return r}function Re(n,t){let e=T(t),r=P.dirname(e);p.existsSync(r)||p.mkdirSync(r,{recursive:!0});let i=ie(n),o=JSON.stringify(i,null,2)+`
|
|
11
|
-
`,s=e+".tmp-"+process.pid;p.writeFileSync(s,o,{encoding:"utf8",mode:384}),p.renameSync(s,e)}function ie(n){if(!n.providers)return JSON.parse(JSON.stringify(n));let t=JSON.parse(JSON.stringify(n)),e=[];if(t.providers)for(let r of Object.keys(t.providers)){let i=t.providers[r];i&&"apiKey"in i&&i.apiKey&&(delete i.apiKey,e.push(r))}return e.length>0&&console.warn(`[router-config] Refused to persist apiKey for: ${e.join(", ")}. API keys belong in environment variables (e.g. ANTHROPIC_API_KEY, GEMINI_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY), NOT in .agentic-qe/llm-config.json which may be checked into source control.`),t}function K(n,t){let e={...n,...t,providers:{...n.providers??{}}};if(t.providers)for(let[r,i]of Object.entries(t.providers)){if(!i)continue;let o=r;e.providers[o]={...n.providers?.[o]??{},...i}}if(n.externalProviders||t.externalProviders){e.externalProviders={...n.externalProviders??{}};for(let[r,i]of Object.entries(t.externalProviders??{}))i&&(e.externalProviders[r]={...n.externalProviders?.[r]??{},...i})}if(n.agentOverrides||t.agentOverrides){e.agentOverrides={...n.agentOverrides??{}};for(let[r,i]of Object.entries(t.agentOverrides??{}))i&&(e.agentOverrides[r]={...n.agentOverrides?.[r]??{},...i})}return e}function se(n){let t={},e=[];if(n==null)return{overrides:t,warnings:e};if(typeof n!="object"||Array.isArray(n))return e.push("`agentOverrides` must be an object keyed by agent type; ignoring it."),{overrides:t,warnings:e};for(let[r,i]of Object.entries(n)){if(!r.trim())continue;if(typeof i!="object"||i===null||Array.isArray(i)){e.push(`agentOverrides["${r}"] must be an object; ignoring it.`);continue}let o=i,s={};if(o.provider!==void 0){let a=o.provider,d=O();if(!d.includes(a)){e.push(`agentOverrides["${r}"].provider "${String(o.provider)}" is not a known provider (${d.join(", ")}); ignoring this entry.`);continue}if(!F(a)){e.push(`agentOverrides["${r}"].provider "${a}" cannot be instantiated at runtime yet; ignoring this entry.`);continue}s.provider=a}typeof o.model=="string"&&o.model.trim()&&(s.model=o.model.trim()),typeof o.temperature=="number"&&Number.isFinite(o.temperature)&&(s.temperature=o.temperature),typeof o.maxTokens=="number"&&Number.isFinite(o.maxTokens)&&(s.maxTokens=o.maxTokens),typeof o.priority=="number"&&Number.isFinite(o.priority)&&(s.priority=o.priority);let l=Object.keys(o).filter(a=>/^(api[-_]?key|key|token|secret|password|passwd|auth|authorization|bearer|credential)s?$/i.test(a));if(l.length>0&&e.push(`agentOverrides["${r}"] contained credential-shaped field(s) [${l.join(", ")}] \u2014 discarded, not persisted, not logged. Credentials belong in environment variables, never in .agentic-qe/llm-config.json.`),Object.keys(s).length===0){e.push(`agentOverrides["${r}"] had no usable fields; ignoring it.`);continue}t[r]=s}return{overrides:t,warnings:e}}function ae(n,t=process.env,e=new Set){let r=oe(t),i={...n,providers:{...n.providers??{}}};for(let o of r){if(A(o).length===0||e.has(o))continue;let l=i.providers[o]??{enabled:!1};l.enabled||(i.providers[o]={...l,enabled:!0})}return i}function de(n){let t=new Set;if(!n.providers)return t;for(let[e,r]of Object.entries(n.providers))r&&r.enabled===!1&&t.add(e);return t}function le(n=process.env){let t=(n.AQE_LLM_PROVIDER??"").trim().toLowerCase();if(!t)return;let e=t==="anthropic"?"claude":t,r=O();if(r.includes(e))return e;console.warn(`[router-config] Ignoring AQE_LLM_PROVIDER="${t}": not a known provider. Valid values: ${r.join(", ")}.`)}function Oe(n={}){let t=n.env??process.env,e=Y(n.projectRoot),{declarations:r,warnings:i}=D(e.externalProviders);for(let c of i)R.warn(`[llm-config] ${c}`);e.externalProviders=r;let o=j(r,{sourceDetail:T(n.projectRoot)});for(let c of o.warnings)R.warn(`[llm-config] ${c}`);if(e.agentOverrides!==void 0){let{overrides:c,warnings:m}=se(e.agentOverrides);for(let f of m)R.warn(`[llm-config] ${f}`);e.agentOverrides=c}let s=K(N,e),l=de(e),a=ae(s,t,l);for(let c of o.registered)l.has(c)||(a={...a,providers:{...a.providers,[c]:{...a.providers?.[c]??{},enabled:!0}}});let d=le(t);return d&&(a={...a,defaultProvider:d,providers:{...a.providers,[d]:{...a.providers?.[d]??{},enabled:!0}}}),n.override?K(a,n.override):a}function Ae(n={}){let t=n.env??process.env;if(h().length>0)return!0;for(let r of E){let i=A(r);if(i.length!==0&&i.some(o=>(t[o]??"").trim().length>0))return!0}let e=Y(n.projectRoot);if(e.providers){for(let r of Object.values(e.providers))if(r?.enabled)return!0}return!1}export{ee as a,O as b,oe as c,Re as d,Oe as e,Ae as f};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{f as s,i as o,k as c,m}from"./chunk-M73KM3AZ.js";import{a,c as d}from"./chunk-L3GBNX7B.js";import{a as r,e as l}from"./chunk-U5G6OC2C.js";d();m();l();var u={dbPath:s.dbPath,walMode:!0,mmapSize:r.MMAP_SIZE_BYTES,cacheSize:r.CACHE_SIZE_KB,busyTimeout:r.BUSY_TIMEOUT_MS},n=class e{static instance=null;static instancePromise=null;unifiedMemory=null;config;initialized=!1;initPromise=null;constructor(i){this.config={...u,...i}}static getInstance(i){return e.instance||(e.instance=new e(i)),e.instance}static async getInstanceAsync(i){return e.instance?.initialized?e.instance:(e.instancePromise||(e.instancePromise=(async()=>{let t=e.getInstance(i);return await t.initialize(),t})()),e.instancePromise)}static resetInstance(){e.instance&&(e.instance.close(),e.instance=null),e.instancePromise=null,c()}async initialize(){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize()),this.initPromise}async _doInitialize(){if(!this.initialized)try{let i={dbPath:this.config.dbPath,walMode:this.config.walMode,busyTimeout:this.config.busyTimeout,mmapSize:this.config.mmapSize,cacheSize:this.config.cacheSize};this.unifiedMemory=o(i),await this.unifiedMemory.initialize(),this.initialized=!0,console.log(`[UnifiedPersistence] Initialized via UnifiedMemoryManager: ${this.config.dbPath}`)}catch(i){throw this.initPromise=null,new Error(`Failed to initialize UnifiedPersistenceManager: ${a(i)}`)}}getDatabase(){if(!this.unifiedMemory||!this.initialized)throw new Error("UnifiedPersistenceManager not initialized");return this.unifiedMemory.getDatabase()}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(i,t){if(!this.unifiedMemory)throw new Error("Database not initialized");return this.unifiedMemory.prepare(i,t)}transaction(i){if(!this.unifiedMemory)throw new Error("Database not initialized");return this.unifiedMemory.transaction(i)}getStats(){if(!this.unifiedMemory)throw new Error("Database not initialized");let i=this.unifiedMemory.getStats();return{tables:i.tables,fileSize:i.fileSize,walSize:i.walSize}}vacuum(){this.getDatabase().exec("VACUUM")}checkpoint(){this.getDatabase().pragma("wal_checkpoint(TRUNCATE)")}close(){this.initialized=!1,console.log("[UnifiedPersistence] Facade closed")}};function g(e){return n.getInstance(e)}async function U(e){let i=g(e);return await i.initialize(),i}function z(){n.resetInstance()}var f=!1;function h(){if(f)return;f=!0;let e=()=>{try{let i=n.instance;i&&i.close()}catch(i){console.debug("[UnifiedPersistence] Cleanup error:",i instanceof Error?i.message:i)}};process.on("beforeExit",e),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("SIGTERM",()=>{e(),process.exit(0)})}h();export{u as a,n as b,g as c,U as d,z as e};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{a as S,c as ne}from"./chunk-L3GBNX7B.js";import{b as L,d as B}from"./chunk-JVFZAJ5N.js";B();ne();B();import*as x from"node:http";import*as R from"node:https";import{createHash as re}from"node:crypto";import{URL as W}from"node:url";var T={model:"Xenova/all-MiniLM-L6-v2",expectedDim:384,connectTimeoutMs:5e3,requestTimeoutMs:3e4,failureThreshold:3,failureWindowMs:6e4},ie="AQE embedder endpoint identity canary v1",oe="/v1/embeddings";function X(n){if(n.startsWith("unix:"))return n;try{let e=new W(n);return e.username||e.password?(e.username="",e.password="",e.toString().replace(/\/$/,"")):n}catch{return n}}function se(n){if(n.startsWith("unix:")){let r=n.slice(5);if(!r.startsWith("/"))throw new Error(`unix endpoint must be an absolute path: ${n}`);return{transport:"unix",socketPath:r,safeUrl:n}}let e=new W(n);if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`unsupported embedder endpoint protocol: ${e.protocol}`);return(e.username||e.password)&&(console.warn("[EmbedderEndpointClient] endpoint URL contained userinfo; stripping. Use AQE_EMBEDDER_TOKEN env var for credentials."),e.username="",e.password=""),{transport:e.protocol==="https:"?"https":"http",host:e.hostname,port:e.port?Number(e.port):e.protocol==="https:"?443:80,protocol:e.protocol,safeUrl:e.toString().replace(/\/$/,"")}}var $=class{constructor(e,t,r=()=>{}){this.threshold=e;this.windowMs=t;this.onRecover=r}threshold;windowMs;onRecover;failures=[];trippedAt=null;recordSuccess(){this.failures=[],this.trippedAt=null}recordFailure(){let e=Date.now();this.failures=this.failures.filter(t=>e-t<this.windowMs),this.failures.push(e),this.failures.length>=this.threshold&&(this.trippedAt=e)}isOpen(){return this.trippedAt===null?!1:Date.now()-this.trippedAt>=this.windowMs?(this.failures=[],this.trippedAt=null,this.onRecover(),!1):!0}getState(){return{open:this.isOpen(),failures:this.failures.length,trippedAt:this.trippedAt}}},P=class{parsed;agent;breaker;opts;cachedIdentity=null;probeInFlight=null;constructor(e){if(this.opts={endpoint:e.endpoint,token:e.token,model:e.model??T.model,expectedDim:e.expectedDim??T.expectedDim,connectTimeoutMs:e.connectTimeoutMs??T.connectTimeoutMs,requestTimeoutMs:e.requestTimeoutMs??T.requestTimeoutMs,failureThreshold:e.failureThreshold??T.failureThreshold,failureWindowMs:e.failureWindowMs??T.failureWindowMs,tlsOptions:e.tlsOptions},this.parsed=se(e.endpoint),this.parsed.transport==="https"){let t=e.tlsOptions??{};this.agent=new R.Agent({keepAlive:!0,ca:t.ca,cert:t.cert,key:t.key,rejectUnauthorized:t.rejectUnauthorized!==!1,servername:t.servername})}else this.agent=new x.Agent({keepAlive:!0});this.breaker=new $(this.opts.failureThreshold,this.opts.failureWindowMs,()=>{this.cachedIdentity=null})}getSafeEndpoint(){return this.parsed.safeUrl}async embed(e){if(e.length===0)return[];if(this.breaker.isOpen())throw new Error(`[EmbedderEndpointClient] circuit breaker open for ${this.parsed.safeUrl} \u2014 fast-failing`);this.cachedIdentity===null&&await this.ensureProbed();try{let t=await this.postEmbeddings(e),r=this.decodeAndNormalize(t,e.length);return this.breaker.recordSuccess(),r}catch(t){throw this.breaker.recordFailure(),t}}async probe(){return this.probeInFlight?this.probeInFlight:(this.probeInFlight=this.doProbe().finally(()=>{this.probeInFlight=null}),this.probeInFlight)}async ensureProbed(){return this.cachedIdentity?this.cachedIdentity:this.probe()}async doProbe(){let e;try{let s=await this.postEmbeddings([ie]);e=this.decodeAndNormalize(s,1)[0],this.breaker.recordSuccess()}catch(s){throw this.breaker.recordFailure(),s}if(!e||e.length!==this.opts.expectedDim)throw new Error(`[EmbedderEndpointClient] dim mismatch: expected ${this.opts.expectedDim}, got ${e?.length??0} from ${this.parsed.safeUrl}`);let t=Buffer.alloc(e.length*2);for(let s=0;s<e.length;s++){let i=Math.max(-32768,Math.min(32767,Math.round(e[s]*32767)));t.writeInt16LE(i,s*2)}let r=re("sha256").update(t).digest("hex").slice(0,16);return this.cachedIdentity={dim:e.length,fingerprint:r,endpoint:this.parsed.safeUrl},this.cachedIdentity}getCachedIdentity(){return this.cachedIdentity}getBreakerState(){return this.breaker.getState()}close(){this.agent.destroy()}decodeAndNormalize(e,t){if(!e||typeof e!="object"||!Array.isArray(e.data))throw new Error("[EmbedderEndpointClient] response missing data array");let r=e.data;if(r.length!==t)throw new Error(`[EmbedderEndpointClient] response count mismatch: expected ${t}, got ${r.length}`);let s=r.map((i,o)=>({idx:typeof i.index=="number"?i.index:o,embedding:i.embedding}));return s.sort((i,o)=>i.idx-o.idx),s.map(({embedding:i},o)=>{if(typeof i=="string")throw new Error(`[EmbedderEndpointClient] received base64 embedding at position ${o} \u2014 server ignored encoding_format=float. Configure the server to return float arrays.`);if(!Array.isArray(i))throw new Error(`[EmbedderEndpointClient] missing embedding at position ${o}`);if(i.length!==this.opts.expectedDim)throw new Error(`[EmbedderEndpointClient] dim mismatch at position ${o}: expected ${this.opts.expectedDim}, got ${i.length}`);return L(i)})}postEmbeddings(e){let t=JSON.stringify({model:this.opts.model,input:e,encoding_format:"float"});return this.request(oe,t)}request(e,t){let r={"content-type":"application/json","content-length":Buffer.byteLength(t),accept:"application/json"};this.opts.token&&(r.authorization=`Bearer ${this.opts.token}`);let s={method:"POST",path:e,headers:r,agent:this.agent},i,o;this.parsed.transport==="unix"?(i={...s,socketPath:this.parsed.socketPath},o=x.request):(i={...s,host:this.parsed.host,port:this.parsed.port,protocol:this.parsed.protocol},o=this.parsed.transport==="https"?R.request:x.request);let d=this.parsed.safeUrl,l=this.opts.connectTimeoutMs,C=this.opts.requestTimeoutMs;return new Promise((b,N)=>{let E=!1,M=a=>{E||(E=!0,b(a))},f=a=>{E||(E=!0,N(a))},y=o(i,a=>{let m=[];a.on("data",u=>m.push(Buffer.from(u))),a.on("end",()=>{let u=Buffer.concat(m).toString("utf-8");if(!a.statusCode||a.statusCode<200||a.statusCode>=300){f(new Error(`[EmbedderEndpointClient] HTTP ${a.statusCode} from ${d}: ${u.slice(0,200)}`));return}try{let g=JSON.parse(u);M(g)}catch(g){f(new Error(`[EmbedderEndpointClient] invalid JSON from ${d}: ${g.message}`))}}),a.on("error",u=>f(u))});y.on("socket",a=>{a.setTimeout(l);let m=()=>{a.setTimeout(C)};a.connecting?a.once("connect",m):m(),a.on("timeout",()=>{let u=a.connecting?"connect":"request",g=a.connecting?l:C,A=new Error(`[EmbedderEndpointClient] ${u} timeout after ${g}ms`);f(A),y.destroy(A)})}),y.on("error",a=>f(a)),y.write(t),y.end()})}};import{join as H}from"node:path";import{existsSync as ae,mkdirSync as de}from"node:fs";import{createRequire as le}from"node:module";var pe=le(import.meta.url);function ce(){let n=process.env.AQE_MEMORY_PATH;return n&&n.length>0?n:H(process.cwd(),".agentic-qe","memory.db")}var j="_system",K="embedder_identity:",v=null,_=!1;function G(){if(v)return v;if(_)return null;try{let n=pe("better-sqlite3"),e=ce(),t=H(e,"..");ae(t)||de(t,{recursive:!0});let r=new n(e);return r.pragma("journal_mode = WAL"),r.pragma("busy_timeout = 5000"),r.exec(`
|
|
3
|
-
CREATE TABLE IF NOT EXISTS kv_store (
|
|
4
|
-
key TEXT NOT NULL,
|
|
5
|
-
namespace TEXT NOT NULL,
|
|
6
|
-
value TEXT NOT NULL,
|
|
7
|
-
expires_at INTEGER,
|
|
8
|
-
created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
|
|
9
|
-
PRIMARY KEY (namespace, key)
|
|
10
|
-
);
|
|
11
|
-
CREATE INDEX IF NOT EXISTS idx_kv_namespace ON kv_store(namespace);
|
|
12
|
-
`),v=r,r}catch{return _=!0,null}}function Q(n){let e=G();if(!e)return null;try{let t=e.prepare("SELECT value FROM kv_store WHERE namespace = ? AND key = ?").get(j,K+n);if(!t)return null;let r=JSON.parse(t.value);return!r.fingerprint||typeof r.dim!="number"?null:{fingerprint:r.fingerprint,dim:r.dim,endpoint:r.endpoint}}catch{return null}}function J(n){let e=G();if(!e)return;let t={fingerprint:n.fingerprint,dim:n.dim,endpoint:n.endpoint,updatedAt:Date.now()};e.prepare("INSERT OR REPLACE INTO kv_store (key, namespace, value) VALUES (?, ?, ?)").run(K+n.endpoint,j,JSON.stringify(t))}function Y(){if(v)try{v.close()}catch{}v=null,_=!1}var z=null,h=null,I=null,k=!1,O="",w=null,c=null,F={modelName:"Xenova/all-MiniLM-L6-v2",quantized:!0,enableCache:!0,maxCacheSize:1e4,endpoint:process.env.AQE_EMBEDDER_ENDPOINT,endpointToken:process.env.AQE_EMBEDDER_TOKEN},p=new Map,V=36e5;function q(n){return c?`endpoint:${c.fingerprint}:${n}`:`inproc:${n}`}function Z(n){let e=n.trim();return!!(e.startsWith("{")&&/["']metrics["']/.test(e)||e.startsWith("[")&&e.endsWith("]")&&e.length>50||(e.match(/[a-zA-Z]/g)||[]).length/Math.max(e.length,1)<.3&&e.length>20)}async function ee(n={}){if(k)throw new Error(`Transformer initialization previously failed: ${O}`);if(I)return I;let e={...F,...n};return I=(async()=>{try{if(e.endpoint){let i=X(e.endpoint);console.log(`[RealEmbeddings] Using external embedder endpoint: ${i}`),w=new P({endpoint:e.endpoint,token:e.endpointToken,model:e.modelName,expectedDim:D()}),c=await w.probe(),console.log(`[RealEmbeddings] Endpoint identity: dim=${c.dim} fingerprint=${c.fingerprint}`);try{let o=Q(c.endpoint);o&&o.fingerprint!==c.fingerprint&&console.warn(`[RealEmbeddings] WARNING: endpoint identity changed since last run. Previous fingerprint=${o.fingerprint} dim=${o.dim}, current fingerprint=${c.fingerprint} dim=${c.dim}. Vectors written before this change may no longer be comparable.`),J(c)}catch(o){console.warn(`[RealEmbeddings] Could not persist endpoint identity: ${S(o)}`)}h=ue(w);return}let t;try{t=await import("./transformers-3YFW3EUO.js")}catch{throw new Error('In-process embeddings require the optional package "@huggingface/transformers", which is not installed. Either run `npm install @huggingface/transformers`, or configure an embedding endpoint (EmbeddingConfig.endpoint / AQE_EMBEDDER_ENDPOINT) so no local model is loaded.')}z=t.pipeline,console.log(`[RealEmbeddings] Loading model: ${e.modelName}`);let r=performance.now();h=await z("feature-extraction",e.modelName,{quantized:e.quantized});let s=performance.now()-r;console.log(`[RealEmbeddings] Model loaded in ${s.toFixed(0)}ms`)}catch(t){throw k=!0,O=S(t),new Error(`Failed to initialize transformer model: ${O}`)}})(),I}function ue(n){return async e=>{let t=Array.isArray(e)?e:[e],r=await n.embed(t),s=r[0]?.length??D(),i=new Float32Array(t.length*s);for(let o=0;o<r.length;o++)i.set(r[o],o*s);return{data:i,dims:[t.length,s]}}}async function Ie(n,e={}){let t={...F,...e};if(Z(n))return new Array(D()).fill(0);if(h||await ee(e),!h)throw new Error("Embedding model failed to initialize");let r=q(n);if(t.enableCache){let l=p.get(r);if(l&&Date.now()-l.timestamp<V)return l.embedding}let s=performance.now(),i=await h(n,{pooling:"mean",normalize:!0}),o=Array.from(i.data),d=performance.now()-s;if(d>500&&console.warn(`[RealEmbeddings] Slow embedding computation: ${d.toFixed(1)}ms for "${n.slice(0,50)}..."`),t.enableCache){if(p.size>=t.maxCacheSize){let l=p.keys().next().value;l&&p.delete(l)}p.set(r,{embedding:o,timestamp:Date.now()})}return o}async function Ce(n,e={}){let t={...F,...e},r=[],s=[],i=new Array(n.length).fill(null),o=[];for(let d=0;d<n.length;d++)Z(n[d])?i[d]=new Array(D()).fill(0):o.push(d);if(o.length===0)return i;if(h||await ee(e),!h)throw new Error("Embedding model failed to initialize");if(t.enableCache)for(let d of o){let l=p.get(q(n[d]));l&&Date.now()-l.timestamp<V?i[d]=l.embedding:(r.push(n[d]),s.push(d))}else for(let d of o)r.push(n[d]),s.push(d);if(r.length>0){let d=performance.now(),l=32;for(let b=0;b<r.length;b+=l){let N=Math.min(b+l,r.length),E=r.slice(b,N),M=await h(E,{pooling:"mean",normalize:!0}),f=M.dims||[E.length,384],y=f[0],a=f[1];for(let m=0;m<y;m++){let u=m*a,g=Array.from(M.data.slice(u,u+a)),A=b+m,te=s[A];if(i[te]=g,t.enableCache){if(p.size>=t.maxCacheSize){let U=p.keys().next().value;U&&p.delete(U)}p.set(q(r[A]),{embedding:g,timestamp:Date.now()})}}}let C=performance.now()-d;console.log(`[RealEmbeddings] Batch computed ${r.length} embeddings in ${C.toFixed(0)}ms`)}return i.filter(d=>d!==null)}function Me(){p.clear(),console.log("[RealEmbeddings] Cache cleared")}function Pe(){return{size:p.size,hitRate:0}}function Re(){return!k&&h!==null}function D(){return 384}function Oe(){z=null,h=null,I=null,k=!1,O="",p.clear(),w&&w.close(),w=null,c=null,Y()}function ke(){return w!==null}function De(){return c}export{F as a,Ie as b,Ce as c,Me as d,Pe as e,Re as f,D as g,Oe as h,ke as i,De as j};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
function b(n,t){return{ingest(e){n.ingest(e)},search(e,r){return n.search(e,r).map(i=>({id:i.id,score:i.score}))},delete(e){n.delete(e)},status(){let e=n.status();return{totalVectors:e.totalVectors,dimensions:t,totalSegments:e.totalSegments,fileSizeBytes:e.fileSizeBytes,epoch:e.epoch,witnessValid:e.witnessValid,witnessEntries:e.witnessEntries}},close(){n.close()},compact(){return n.compact()}}}function c(n,t){return(n.prepare("SELECT COUNT(*) as cnt FROM sqlite_master WHERE type='table' AND name=?").get(t)?.cnt??0)>0}var v=class{db;config;rvfStore=null;rvfAvailable=!1;constructor(t,e){this.db=t,this.config={...e,dimensions:e.dimensions??384}}async initialize(){if(this.config.mode==="sqlite-only"){this.rvfAvailable=!1;return}try{let t=await import("./rvf-native-adapter-LOC42TQ6.js");if(!t.isRvfNativeAvailable()){this.rvfAvailable=!1;return}let e;try{e=t.openRvfStore(this.config.rvfPath)}catch{try{e=t.createRvfStore(this.config.rvfPath,this.config.dimensions)}catch(r){let{quarantineUnusableStore:i}=await import("./rvf-store-integrity-HNDKOM4L.js");if(!i(this.config.rvfPath,r instanceof Error?r.message:String(r)))throw r;e=t.createRvfStore(this.config.rvfPath,this.config.dimensions)}}this.rvfStore=b(e,this.config.dimensions),this.rvfAvailable=!0}catch(t){this.rvfAvailable=!1,console.warn(`[RVF] Dual-writer disabled for ${this.config.rvfPath}; falling back to SQLite: ${t instanceof Error?t.message:String(t)}`)}}setRvfStore(t){this.rvfStore=t,this.rvfAvailable=!0}writePattern(t,e){let r={sqliteSuccess:!1,rvfSuccess:!1};try{this.writeSqliteEmbedding(t,e),r.sqliteSuccess=!0}catch{r.sqliteSuccess=!1}if(this.shouldWriteRvf())try{this.rvfStore.ingest([{id:t,vector:e instanceof Float32Array?Array.from(e):e}]),r.rvfSuccess=!0}catch{r.rvfSuccess=!1,r.divergence="rvf-write-failed"}return r}deletePattern(t){let e={sqliteSuccess:!1,rvfSuccess:!1};try{this.deleteSqliteEmbedding(t),e.sqliteSuccess=!0}catch{e.sqliteSuccess=!1}if(this.shouldWriteRvf())try{this.rvfStore.delete([t]),e.rvfSuccess=!0}catch{e.rvfSuccess=!1,e.divergence="rvf-delete-failed"}return e}search(t,e){if(this.config.mode==="rvf-primary"&&this.rvfAvailable&&this.rvfStore)try{return this.rvfStore.search(t,e)}catch{}return this.searchSqlite(t,e)}getDivergenceReport(){let t={totalChecked:0,divergences:0,details:[]},e=this.getSqliteEmbeddingCount();if(t.totalChecked=e,!this.rvfAvailable||!this.rvfStore)return this.config.mode!=="sqlite-only"&&e>0&&(t.divergences=1,t.details.push({patternId:"*",issue:"count-mismatch"})),t;let i=this.rvfStore.status().totalVectors;return e!==i&&(t.divergences=1,t.details.push({patternId:"*",issue:"count-mismatch"})),t}isPromotionSafe(){return this.getDivergenceReport().divergences===0}status(){let t=this.getSqlitePatternCount(),e=this.getSqliteEmbeddingCount(),r=null;if(this.rvfAvailable&&this.rvfStore)try{r=this.rvfStore.status()}catch{r=null}return{sqlite:{patternCount:t,vectorCount:e},rvf:r,mode:this.config.mode}}close(){if(this.rvfStore){try{this.rvfStore.close()}catch{}this.rvfStore=null,this.rvfAvailable=!1}}compact(){if(!this.rvfStore||!this.rvfAvailable||!this.rvfStore.compact)return null;try{return this.rvfStore.compact()??null}catch{return null}}shouldWriteRvf(){return(this.config.mode==="dual-write"||this.config.mode==="rvf-primary")&&this.rvfAvailable&&this.rvfStore!==null}writeSqliteEmbedding(t,e){let r=Buffer.from(e instanceof Float32Array?e.buffer:new Float32Array(e).buffer),i=e.length;c(this.db,"qe_pattern_embeddings")&&this.db.prepare(`
|
|
3
|
-
INSERT INTO qe_pattern_embeddings (pattern_id, embedding, dimension, model, created_at)
|
|
4
|
-
VALUES (?, ?, ?, 'all-MiniLM-L6-v2', datetime('now'))
|
|
5
|
-
ON CONFLICT(pattern_id) DO UPDATE SET
|
|
6
|
-
embedding = excluded.embedding,
|
|
7
|
-
dimension = excluded.dimension,
|
|
8
|
-
created_at = datetime('now')
|
|
9
|
-
`).run(t,r,i)}deleteSqliteEmbedding(t){c(this.db,"qe_pattern_embeddings")&&this.db.prepare("DELETE FROM qe_pattern_embeddings WHERE pattern_id = ?").run(t)}getSqliteEmbeddingCount(){return c(this.db,"qe_pattern_embeddings")?this.db.prepare("SELECT COUNT(*) as cnt FROM qe_pattern_embeddings").get()?.cnt??0:0}getSqlitePatternCount(){return c(this.db,"qe_patterns")?this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get()?.cnt??0:0}searchSqlite(t,e){if(!c(this.db,"qe_pattern_embeddings"))return[];let r=this.db.prepare("SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings").all(),i=t instanceof Float32Array?Array.from(t):t,f=Math.sqrt(i.reduce((s,o)=>s+o*o,0));if(f===0)return[];let d=[];for(let s of r){let o=new Float32Array(s.embedding.buffer,s.embedding.byteOffset,s.dimension),u=Array.from(o),m=0,l=0;for(let a=0;a<u.length&&a<i.length;a++)m+=u[a]*i[a],l+=u[a]*u[a];l=Math.sqrt(l);let h=l>0?m/(f*l):0;d.push({id:s.pattern_id,score:h})}return d.sort((s,o)=>o.score-s.score),d.slice(0,e)}};function g(n,t){return new v(n,t)}export{v as a,g as b};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{h as n}from"./chunk-WA6CSEOX.js";import{a as r}from"./chunk-UQ4UCHO7.js";var a={claude:"metered-api","claude-code":"subscription",codex:"subscription",openai:"metered-api",openrouter:"metered-api",gemini:"metered-api","azure-openai":"metered-api",bedrock:"metered-api",cognitum:"metered-capped",ollama:"local"};function o(e){return r(e)?a[e]:void 0}function p(e){return e.billingMode??o(e.type)??"metered-api"}function c(e){return o(e)??"metered-api"}function g(e,t){switch(t){case"metered-api":return`\u26A0\uFE0F LLM provider "${e}" bills a pay-per-token API key (not your Claude subscription) and has no server-side spend cap. Set a budget with --max-budget-usd / AQE_MAX_BUDGET_USD, or use AQE_LLM_PROVIDER=claude-code to run on your Claude Code subscription instead.`;case"metered-capped":return`\u2139\uFE0F LLM provider "${e}" bills per-token but enforces a server-side hard spend cap; it will pause at the cap rather than overspend.`;case"subscription":{let i=n(e);if(i){let d=i.detail?`declared by ${i.detail}`:`declared by ${i.source==="config"?"config":"the registering caller"}`;return`\u2139\uFE0F LLM provider "${e}" is an external provider that reports subscription billing (${d}) \u2014 AQE does not verify this. It draws on that host's own plan, not on your Claude Code or ChatGPT subscription.`}return`\u2139\uFE0F LLM provider "${e}" runs on your ${e==="codex"?"ChatGPT":"Claude Code"} subscription (shared plan usage). Worst case is hitting your plan's rate limit and pausing \u2014 no per-token API charges.`}case"local":return}}export{p as a,c as b,g as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.13.12");process.exit(0)}
|
|
2
|
-
import{a as r}from"./chunk-UQ4UCHO7.js";function y(e){return e==="onnx"||r(e)}var g=["claude","claude-code","codex","openai","ollama","openrouter","gemini","azure-openai","bedrock","cognitum","onnx"];var o={maxAttempts:3,delayMs:100,trySameProviderAlternateModel:!0,skipOpenCircuits:!0,retryableErrors:["RATE_LIMITED","TIMEOUT","NETWORK_ERROR","PROVIDER_UNAVAILABLE"]},t=[{provider:"claude",models:["claude-sonnet-4-6","claude-haiku-4-5-20251001"],enabled:!0,priority:100,maxAttempts:2,timeoutMs:3e4},{provider:"openai",models:["gpt-4o","gpt-4o-mini"],enabled:!0,priority:90,maxAttempts:2,timeoutMs:3e4},{provider:"openrouter",models:["anthropic/claude-sonnet-4","openai/gpt-4o"],enabled:!0,priority:85,maxAttempts:2,timeoutMs:3e4},{provider:"ollama",models:["llama3.1","mistral"],enabled:!0,priority:80,maxAttempts:2,timeoutMs:6e4},{provider:"onnx",models:["phi-4","all-MiniLM-L6-v2"],enabled:!0,priority:70,maxAttempts:1,timeoutMs:12e4}],n={id:"default-fallback-chain",entries:t,maxRetries:3,retryDelayMs:100,backoffMultiplier:2,maxDelayMs:5e3},b={mode:"rule-based",rules:[],defaultProvider:"claude",defaultModel:"claude-sonnet-4-6",fallbackChain:n,fallbackBehavior:o,providers:{claude:{enabled:!0,defaultModel:"claude-sonnet-4-6"},"claude-code":{enabled:!1,defaultModel:"claude-sonnet-4-6"},openai:{enabled:!0,defaultModel:"gpt-4o"},ollama:{enabled:!0,defaultModel:"llama3.1"},openrouter:{enabled:!0,defaultModel:"anthropic/claude-sonnet-4"},gemini:{enabled:!1,defaultModel:"gemini-pro"},"azure-openai":{enabled:!1},bedrock:{enabled:!1},cognitum:{enabled:!1,defaultModel:"cognitum-auto"},onnx:{enabled:!0,defaultModel:"phi-4"}},enableMetrics:!0,metricsConfig:{enabled:!0,collectionIntervalMs:6e4,retentionMs:864e5,trackPerRequest:!0},maxDecisionTimeMs:10,cacheDecisions:!0,decisionCacheTtlMs:6e4,cacheConfig:{enabled:!0,ttlMs:6e4,maxEntries:1e3,keyStrategy:"agent-domain"},auditConfig:{enabled:!0,maxEntries:1e4,logContent:!1,logResponse:!1}},x=[{canonicalId:"claude-opus-4-7",canonicalName:"Claude Opus 4.7",providerIds:{claude:"claude-opus-4-7",openrouter:"anthropic/claude-opus-4.7",bedrock:"anthropic.claude-opus-4-7-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!0,supportsVision:!0,supportsExtendedThinking:!0,supportsJsonMode:!0,maxContextTokens:1e6,maxOutputTokens:128e3},tier:"flagship",family:"claude",inputCostPer1M:5,outputCostPer1M:25},{canonicalId:"claude-sonnet-4-6",canonicalName:"Claude Sonnet 4.6",providerIds:{claude:"claude-sonnet-4-6",openrouter:"anthropic/claude-sonnet-4.6",bedrock:"anthropic.claude-sonnet-4-6-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!0,supportsVision:!0,supportsExtendedThinking:!0,supportsJsonMode:!0,maxContextTokens:2e5,maxOutputTokens:64e3},tier:"advanced",family:"claude",inputCostPer1M:3,outputCostPer1M:15},{canonicalId:"claude-haiku-4-5",canonicalName:"Claude Haiku 4.5",providerIds:{claude:"claude-haiku-4-5-20251001",openrouter:"anthropic/claude-haiku-4.5",bedrock:"anthropic.claude-haiku-4-5-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!0,supportsJsonMode:!0,maxContextTokens:2e5,maxOutputTokens:16384},tier:"standard",family:"claude",inputCostPer1M:1,outputCostPer1M:5},{canonicalId:"gpt-4o",canonicalName:"GPT-4o",providerIds:{openai:"gpt-4o","azure-openai":"gpt-4o",openrouter:"openai/gpt-4o"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:128e3,maxOutputTokens:16384},tier:"advanced",family:"gpt",inputCostPer1M:2.5,outputCostPer1M:10},{canonicalId:"gpt-4o-mini",canonicalName:"GPT-4o Mini",providerIds:{openai:"gpt-4o-mini","azure-openai":"gpt-4o-mini",openrouter:"openai/gpt-4o-mini"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:128e3,maxOutputTokens:16384},tier:"standard",family:"gpt",inputCostPer1M:.15,outputCostPer1M:.6},{canonicalId:"gemini-pro",canonicalName:"Gemini 2.0 Pro",providerIds:{gemini:"gemini-2.0-pro",openrouter:"google/gemini-2.0-pro"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:2e6,maxOutputTokens:8192},tier:"advanced",family:"gemini",inputCostPer1M:1.25,outputCostPer1M:5},{canonicalId:"llama-3.1-70b",canonicalName:"LLaMA 3.1 70B",providerIds:{ollama:"llama3.1:70b",openrouter:"meta-llama/llama-3.1-70b",bedrock:"meta.llama3-1-70b-instruct-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!1,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:128e3,maxOutputTokens:4096},tier:"advanced",family:"llama",inputCostPer1M:.9,outputCostPer1M:.9},{canonicalId:"phi-4",canonicalName:"Microsoft Phi-4",providerIds:{ollama:"phi4",onnx:"phi-4",openrouter:"microsoft/phi-4"},capabilities:{supportsStreaming:!0,supportsTools:!1,supportsMCP:!1,supportsVision:!1,supportsExtendedThinking:!1,supportsJsonMode:!1,maxContextTokens:16e3,maxOutputTokens:4096,requiresNetwork:!1},tier:"efficient",family:"phi",inputCostPer1M:0,outputCostPer1M:0}];export{y as a,g as b,b as c,x as d};
|