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
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executable embedding-space provenance (#633).
|
|
3
|
+
*
|
|
4
|
+
* Model names and dimensions are declarations, not proof that two vectors are
|
|
5
|
+
* comparable. An embedding space is therefore identified by canonical runtime
|
|
6
|
+
* configuration plus a fingerprint of a fixed canary vector.
|
|
7
|
+
*/
|
|
8
|
+
import { createHash } from 'node:crypto';
|
|
9
|
+
import { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { cosineSimilarity } from '../shared/utils/vector-math.js';
|
|
11
|
+
export const EMBEDDING_SPACE_CANARY = 'aqe embedding-space compatibility canary v1';
|
|
12
|
+
export const EMBEDDING_ROUND_TRIP_MIN_COSINE = 0.999;
|
|
13
|
+
export class EmbeddingSpaceError extends Error {
|
|
14
|
+
code;
|
|
15
|
+
constructor(code, message) {
|
|
16
|
+
super(`${code}: ${message}`);
|
|
17
|
+
this.code = code;
|
|
18
|
+
this.name = 'EmbeddingSpaceError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function canonicalIdentity(identity) {
|
|
22
|
+
return JSON.stringify({
|
|
23
|
+
provider: identity.provider,
|
|
24
|
+
model: identity.model,
|
|
25
|
+
dimensions: identity.dimensions,
|
|
26
|
+
pooling: identity.pooling ?? null,
|
|
27
|
+
normalized: identity.normalized,
|
|
28
|
+
preprocessingVersion: identity.preprocessingVersion ?? null,
|
|
29
|
+
implementation: identity.implementation ?? null,
|
|
30
|
+
runtimeFingerprint: identity.runtimeFingerprint,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** Fingerprint a normalized canary vector after stable int16 quantization. */
|
|
34
|
+
export function fingerprintEmbeddingRuntime(vector) {
|
|
35
|
+
const bytes = Buffer.alloc(vector.length * 2);
|
|
36
|
+
for (let i = 0; i < vector.length; i++) {
|
|
37
|
+
const quantized = Math.max(-32768, Math.min(32767, Math.round(vector[i] * 32767)));
|
|
38
|
+
bytes.writeInt16LE(quantized, i * 2);
|
|
39
|
+
}
|
|
40
|
+
return createHash('sha256').update(bytes).digest('hex').slice(0, 16);
|
|
41
|
+
}
|
|
42
|
+
export function deriveEmbeddingSpaceIdentity(identity) {
|
|
43
|
+
if (!identity.runtimeFingerprint) {
|
|
44
|
+
throw new Error('Embedding space identity requires executable runtime evidence');
|
|
45
|
+
}
|
|
46
|
+
const spaceId = createHash('sha256')
|
|
47
|
+
.update('aqe:embedding-space:v1\0')
|
|
48
|
+
.update(canonicalIdentity(identity))
|
|
49
|
+
.digest('hex');
|
|
50
|
+
return { ...identity, spaceId };
|
|
51
|
+
}
|
|
52
|
+
/** Execute the same-text write/read canary before semantic ranking is trusted. */
|
|
53
|
+
export async function verifyEmbeddingRoundTrip(writeEmbed, queryEmbed, minimumCosine = EMBEDDING_ROUND_TRIP_MIN_COSINE) {
|
|
54
|
+
const [written, queried] = await Promise.all([
|
|
55
|
+
writeEmbed(EMBEDDING_SPACE_CANARY),
|
|
56
|
+
queryEmbed(EMBEDDING_SPACE_CANARY),
|
|
57
|
+
]);
|
|
58
|
+
if (written.length !== queried.length) {
|
|
59
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_MISMATCH', `round-trip dimensions differ (${written.length} != ${queried.length})`);
|
|
60
|
+
}
|
|
61
|
+
const similarity = cosineSimilarity(written, queried);
|
|
62
|
+
if (!Number.isFinite(similarity) || similarity < minimumCosine) {
|
|
63
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_MISMATCH', `write/read canary cosine ${similarity.toFixed(6)} is below ${minimumCosine}`);
|
|
64
|
+
}
|
|
65
|
+
return similarity;
|
|
66
|
+
}
|
|
67
|
+
export function inspectEmbeddingSpaceRows(rows, activeSpaceId) {
|
|
68
|
+
const storedSpaceIds = [...new Set(rows.flatMap((row) => row.spaceId ? [row.spaceId] : []))].sort();
|
|
69
|
+
const unverifiedVectors = rows.filter((row) => !row.spaceId).length;
|
|
70
|
+
const verifiedVectors = activeSpaceId
|
|
71
|
+
? rows.filter((row) => row.spaceId === activeSpaceId).length
|
|
72
|
+
: 0;
|
|
73
|
+
const mismatchedVectors = activeSpaceId
|
|
74
|
+
? rows.filter((row) => row.spaceId !== null && row.spaceId !== activeSpaceId).length
|
|
75
|
+
: rows.length - unverifiedVectors;
|
|
76
|
+
const status = unverifiedVectors > 0 || !activeSpaceId
|
|
77
|
+
? 'unverified'
|
|
78
|
+
: mismatchedVectors > 0 || storedSpaceIds.length > 1
|
|
79
|
+
? 'vector_space_mismatch'
|
|
80
|
+
: 'healthy';
|
|
81
|
+
return {
|
|
82
|
+
status,
|
|
83
|
+
activeSpaceId,
|
|
84
|
+
storedSpaceIds,
|
|
85
|
+
verifiedVectors,
|
|
86
|
+
mismatchedVectors,
|
|
87
|
+
unverifiedVectors,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Sidecar path used to bind a persistent ANN index to one embedding space. */
|
|
91
|
+
export function embeddingSpaceManifestPath(indexPath) {
|
|
92
|
+
return `${indexPath}.space.json`;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Bind an empty persistent index to the active space, or verify an existing
|
|
96
|
+
* binding. A populated index without a manifest is legacy/unverified and must
|
|
97
|
+
* be rebuilt rather than silently adopted by the current runtime.
|
|
98
|
+
*/
|
|
99
|
+
export function verifyOrCreateEmbeddingSpaceManifest(indexPath, activeSpaceId, vectorCount) {
|
|
100
|
+
if (!activeSpaceId) {
|
|
101
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_UNVERIFIED', `cannot open ANN index ${indexPath} without runtime provenance`);
|
|
102
|
+
}
|
|
103
|
+
const manifestPath = embeddingSpaceManifestPath(indexPath);
|
|
104
|
+
if (existsSync(manifestPath)) {
|
|
105
|
+
let manifest;
|
|
106
|
+
try {
|
|
107
|
+
manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_UNVERIFIED', `ANN index manifest ${manifestPath} is unreadable`);
|
|
111
|
+
}
|
|
112
|
+
if (manifest.version !== 1 || !manifest.spaceId) {
|
|
113
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_UNVERIFIED', `ANN index manifest ${manifestPath} has no verified space`);
|
|
114
|
+
}
|
|
115
|
+
if (manifest.spaceId !== activeSpaceId) {
|
|
116
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_MISMATCH', `ANN index space ${manifest.spaceId} != active space ${activeSpaceId}`);
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (vectorCount > 0) {
|
|
121
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_UNVERIFIED', `populated ANN index ${indexPath} has no embedding-space manifest; rebuild required`);
|
|
122
|
+
}
|
|
123
|
+
const manifest = { version: 1, spaceId: activeSpaceId };
|
|
124
|
+
const temporaryPath = `${manifestPath}.${process.pid}.tmp`;
|
|
125
|
+
writeFileSync(temporaryPath, `${JSON.stringify(manifest)}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
126
|
+
renameSync(temporaryPath, manifestPath);
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=embedding-space.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Database as DatabaseType } from 'better-sqlite3';
|
|
2
|
+
import type { LearningAdmissionResult, LearningEvidenceManifest } from './learning-evidence-admission.js';
|
|
3
|
+
export interface PersistLearningEvidenceOptions {
|
|
4
|
+
patternId?: string;
|
|
5
|
+
policyVersion?: string;
|
|
6
|
+
policyHash?: string;
|
|
7
|
+
correlationGroup?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PersistedLearningEvidence {
|
|
10
|
+
manifestId: string;
|
|
11
|
+
admissionId: string;
|
|
12
|
+
disposition: 'admitted' | 'rejected' | 'review-required';
|
|
13
|
+
}
|
|
14
|
+
export declare function persistLearningEvidence(db: DatabaseType, manifest: LearningEvidenceManifest, admission: LearningAdmissionResult, options?: PersistLearningEvidenceOptions): PersistedLearningEvidence;
|
|
15
|
+
//# sourceMappingURL=evidence-admission-store.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
function evidenceClass(source) {
|
|
3
|
+
if (source === 'executed')
|
|
4
|
+
return 'EXECUTED';
|
|
5
|
+
if (source === 'static' || source === 'human-reviewed')
|
|
6
|
+
return 'STATIC';
|
|
7
|
+
return 'INFERRED';
|
|
8
|
+
}
|
|
9
|
+
export function persistLearningEvidence(db, manifest, admission, options = {}) {
|
|
10
|
+
if (!/^[a-f0-9]{64}$/.test(manifest.trajectoryHash)) {
|
|
11
|
+
throw new Error('trajectoryHash must be a lowercase SHA-256 digest');
|
|
12
|
+
}
|
|
13
|
+
const disposition = admission.disposition === 'admit'
|
|
14
|
+
? 'admitted'
|
|
15
|
+
: admission.disposition === 'reject' ? 'rejected' : 'review-required';
|
|
16
|
+
const admissionId = randomUUID();
|
|
17
|
+
const persist = db.transaction(() => {
|
|
18
|
+
db.prepare(`
|
|
19
|
+
INSERT INTO learning_evidence_manifests (
|
|
20
|
+
id, trajectory_id, trajectory_hash, manifest_hash, task_family,
|
|
21
|
+
task_identity, run_identity, correlation_group, dedupe_fingerprint,
|
|
22
|
+
revision, environment, outcome, oracle_refs_json, source_kind,
|
|
23
|
+
process_signals_json, manifest_version
|
|
24
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1)
|
|
25
|
+
`).run(manifest.trajectoryId, manifest.trajectoryId, manifest.trajectoryHash, manifest.trajectoryHash, manifest.taskFamily, manifest.trajectoryId, manifest.trajectoryId, options.correlationGroup ?? null, manifest.trajectoryHash, manifest.revision ?? null, manifest.environment ?? null, manifest.outcome, JSON.stringify(manifest.oracleRefs), manifest.sourceKind, JSON.stringify(manifest.processSignals));
|
|
26
|
+
const insertSegment = db.prepare(`
|
|
27
|
+
INSERT INTO learning_evidence_segments (
|
|
28
|
+
id, manifest_id, segment_order, kind, contribution,
|
|
29
|
+
evidence_refs_json, admit_for_learning, reasons_json
|
|
30
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
31
|
+
`);
|
|
32
|
+
manifest.segments.forEach((segment, index) => insertSegment.run(segment.id, manifest.trajectoryId, index, segment.kind, segment.contribution, JSON.stringify(segment.evidenceRefs), segment.admitForLearning ? 1 : 0, JSON.stringify(segment.reasons)));
|
|
33
|
+
const insertEdge = db.prepare(`
|
|
34
|
+
INSERT INTO learning_segment_edges (
|
|
35
|
+
manifest_id, parent_segment_id, child_segment_id, edge_kind
|
|
36
|
+
) VALUES (?, ?, ?, 'depends-on')
|
|
37
|
+
`);
|
|
38
|
+
for (const segment of manifest.segments) {
|
|
39
|
+
for (const parentId of segment.parentIds) {
|
|
40
|
+
insertEdge.run(manifest.trajectoryId, parentId, segment.id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
db.prepare(`
|
|
44
|
+
INSERT INTO learning_evidence_admissions (
|
|
45
|
+
id, manifest_id, decision_seq, disposition, reason_codes_json,
|
|
46
|
+
assessor_kind, evidence_class, policy_version, policy_hash
|
|
47
|
+
) VALUES (?, ?, 1, ?, ?, ?, ?, ?, ?)
|
|
48
|
+
`).run(admissionId, manifest.trajectoryId, disposition, JSON.stringify(admission.reasons), manifest.sourceKind, evidenceClass(manifest.sourceKind), options.policyVersion ?? null, options.policyHash ?? null);
|
|
49
|
+
if (options.patternId) {
|
|
50
|
+
db.prepare(`
|
|
51
|
+
INSERT INTO pattern_manifest_lineage (
|
|
52
|
+
pattern_id, manifest_id, use_kind
|
|
53
|
+
) VALUES (?, ?, ?)
|
|
54
|
+
`).run(options.patternId, manifest.trajectoryId, disposition === 'admitted' ? 'promotion-support' : 'rejection');
|
|
55
|
+
const insertSegmentLineage = db.prepare(`
|
|
56
|
+
INSERT INTO pattern_segment_lineage (
|
|
57
|
+
pattern_id, manifest_id, segment_id, use_kind
|
|
58
|
+
) VALUES (?, ?, ?, ?)
|
|
59
|
+
`);
|
|
60
|
+
for (const segmentId of admission.admittedSegmentIds) {
|
|
61
|
+
insertSegmentLineage.run(options.patternId, manifest.trajectoryId, segmentId, 'promotion-support');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
persist();
|
|
66
|
+
return { manifestId: manifest.trajectoryId, admissionId, disposition };
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=evidence-admission-store.js.map
|
package/dist/learning/index.d.ts
CHANGED
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
export { QEReasoningBank, createQEReasoningBank, DEFAULT_QE_REASONING_BANK_CONFIG, } from './qe-reasoning-bank.js';
|
|
43
43
|
export type { QEReasoningBankConfig, QERoutingRequest, QERoutingResult, LearningOutcome, IQEReasoningBank, QEReasoningBankStats, } from './qe-reasoning-bank.js';
|
|
44
44
|
export { QE_DOMAINS, QE_DOMAIN_LIST, QE_PATTERN_TYPES, detectQEDomain, detectQEDomains, mapQEDomainToAQE, calculateQualityScore, shouldPromotePattern, validateQEPattern, applyPatternTemplate, matchPatternContext, } from './qe-patterns.js';
|
|
45
|
+
export { admitLearningEvidence, countIndependentAdmissions, createLearningEvidenceManifest, } from './learning-evidence-admission.js';
|
|
46
|
+
export { persistLearningEvidence } from './evidence-admission-store.js';
|
|
47
|
+
export type { PersistLearningEvidenceOptions, PersistedLearningEvidence, } from './evidence-admission-store.js';
|
|
48
|
+
export type { LearningAdmissionResult, LearningContribution, LearningEvidenceManifest, LearningSegment, } from './learning-evidence-admission.js';
|
|
45
49
|
export type { QEDomain, QEPatternType, QEPattern, QEPatternContext, QEPatternTemplate, QETemplateVariable, ProgrammingLanguage, TestFramework, ComplexityLevel, CreateQEPatternOptions, PatternMatchResult, } from './qe-patterns.js';
|
|
46
50
|
export { QE_GUIDANCE_REGISTRY, TEST_GENERATION_GUIDANCE, COVERAGE_ANALYSIS_GUIDANCE, MUTATION_TESTING_GUIDANCE, API_TESTING_GUIDANCE, SECURITY_TESTING_GUIDANCE, VISUAL_TESTING_GUIDANCE, ACCESSIBILITY_GUIDANCE, PERFORMANCE_GUIDANCE, getGuidance, getFrameworkGuidance, getLanguageGuidance, getCombinedGuidance, checkAntiPatterns, generateGuidanceContext, } from './qe-guidance.js';
|
|
47
51
|
export type { QEGuidance, AntiPattern, GuidanceExample, } from './qe-guidance.js';
|
package/dist/learning/index.js
CHANGED
|
@@ -53,6 +53,8 @@ QE_DOMAINS, QE_DOMAIN_LIST,
|
|
|
53
53
|
QE_PATTERN_TYPES,
|
|
54
54
|
// Utility functions
|
|
55
55
|
detectQEDomain, detectQEDomains, mapQEDomainToAQE, calculateQualityScore, shouldPromotePattern, validateQEPattern, applyPatternTemplate, matchPatternContext, } from './qe-patterns.js';
|
|
56
|
+
export { admitLearningEvidence, countIndependentAdmissions, createLearningEvidenceManifest, } from './learning-evidence-admission.js';
|
|
57
|
+
export { persistLearningEvidence } from './evidence-admission-store.js';
|
|
56
58
|
// ============================================================================
|
|
57
59
|
// QE Guidance
|
|
58
60
|
// ============================================================================
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type LearningContribution = 'causal' | 'supporting' | 'irrelevant' | 'harmful' | 'unknown';
|
|
2
|
+
export interface LearningSegment {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly parentIds: readonly string[];
|
|
5
|
+
readonly kind: 'observe' | 'decide' | 'act' | 'verify' | 'recover' | 'other';
|
|
6
|
+
readonly contribution: LearningContribution;
|
|
7
|
+
readonly evidenceRefs: readonly string[];
|
|
8
|
+
readonly admitForLearning: boolean;
|
|
9
|
+
readonly reasons: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export interface LearningEvidenceManifest {
|
|
12
|
+
readonly trajectoryId: string;
|
|
13
|
+
readonly trajectoryHash: string;
|
|
14
|
+
readonly taskFamily: string;
|
|
15
|
+
readonly revision?: string;
|
|
16
|
+
readonly environment?: string;
|
|
17
|
+
readonly outcome: 'verified-success' | 'verified-failure' | 'unknown';
|
|
18
|
+
readonly oracleRefs: readonly string[];
|
|
19
|
+
readonly sourceKind: 'executed' | 'static' | 'human-reviewed' | 'inferred';
|
|
20
|
+
readonly processSignals: Readonly<{
|
|
21
|
+
observedBeforeActing: boolean;
|
|
22
|
+
verificationAfterActing: boolean;
|
|
23
|
+
toolSuccessRate: number;
|
|
24
|
+
repeatedNoProgressActions: number;
|
|
25
|
+
scopeDrift: boolean;
|
|
26
|
+
leakageOrShortcut: boolean;
|
|
27
|
+
weakenedOracle: boolean;
|
|
28
|
+
unsafeSideEffect: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
readonly segments: readonly LearningSegment[];
|
|
31
|
+
}
|
|
32
|
+
export interface LearningAdmissionResult {
|
|
33
|
+
readonly disposition: 'admit' | 'reject' | 'human-review';
|
|
34
|
+
readonly autoPromotable: boolean;
|
|
35
|
+
readonly admittedSegmentIds: readonly string[];
|
|
36
|
+
readonly rejectedSegmentIds: readonly string[];
|
|
37
|
+
readonly reasons: readonly string[];
|
|
38
|
+
}
|
|
39
|
+
type ManifestInput = Omit<LearningEvidenceManifest, 'trajectoryHash'>;
|
|
40
|
+
export declare function createLearningEvidenceManifest(input: ManifestInput): LearningEvidenceManifest;
|
|
41
|
+
export declare function admitLearningEvidence(manifest: LearningEvidenceManifest): LearningAdmissionResult;
|
|
42
|
+
export declare function countIndependentAdmissions(manifests: readonly LearningEvidenceManifest[]): number;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=learning-evidence-admission.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
function canonicalize(value) {
|
|
3
|
+
if (Array.isArray(value))
|
|
4
|
+
return `[${value.map(canonicalize).join(',')}]`;
|
|
5
|
+
if (value && typeof value === 'object') {
|
|
6
|
+
return `{${Object.entries(value)
|
|
7
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
8
|
+
.map(([key, entry]) => `${JSON.stringify(key)}:${canonicalize(entry)}`)
|
|
9
|
+
.join(',')}}`;
|
|
10
|
+
}
|
|
11
|
+
return JSON.stringify(value) ?? 'undefined';
|
|
12
|
+
}
|
|
13
|
+
function freezeManifest(manifest) {
|
|
14
|
+
Object.freeze(manifest.processSignals);
|
|
15
|
+
manifest.segments.forEach(segment => {
|
|
16
|
+
Object.freeze(segment.parentIds);
|
|
17
|
+
Object.freeze(segment.evidenceRefs);
|
|
18
|
+
Object.freeze(segment.reasons);
|
|
19
|
+
Object.freeze(segment);
|
|
20
|
+
});
|
|
21
|
+
Object.freeze(manifest.oracleRefs);
|
|
22
|
+
Object.freeze(manifest.segments);
|
|
23
|
+
return Object.freeze(manifest);
|
|
24
|
+
}
|
|
25
|
+
export function createLearningEvidenceManifest(input) {
|
|
26
|
+
const trajectoryHash = createHash('sha256').update(canonicalize(input)).digest('hex');
|
|
27
|
+
return freezeManifest({ ...input, trajectoryHash });
|
|
28
|
+
}
|
|
29
|
+
function expectedTrajectoryHash(manifest) {
|
|
30
|
+
const { trajectoryHash: _claimedHash, ...input } = manifest;
|
|
31
|
+
return createHash('sha256').update(canonicalize(input)).digest('hex');
|
|
32
|
+
}
|
|
33
|
+
export function admitLearningEvidence(manifest) {
|
|
34
|
+
const reasons = [];
|
|
35
|
+
if (manifest.trajectoryHash !== expectedTrajectoryHash(manifest))
|
|
36
|
+
reasons.push('integrity:trajectory-hash-mismatch');
|
|
37
|
+
if (manifest.outcome !== 'verified-success')
|
|
38
|
+
reasons.push(`outcome:${manifest.outcome}`);
|
|
39
|
+
if (manifest.sourceKind === 'inferred')
|
|
40
|
+
reasons.push('source:inferred');
|
|
41
|
+
if (manifest.oracleRefs.length === 0)
|
|
42
|
+
reasons.push('oracle:missing');
|
|
43
|
+
if (!manifest.processSignals.verificationAfterActing)
|
|
44
|
+
reasons.push('verification:missing-after-action');
|
|
45
|
+
if (!manifest.processSignals.observedBeforeActing)
|
|
46
|
+
reasons.push('process:acted-before-observation');
|
|
47
|
+
if (manifest.processSignals.toolSuccessRate < 0 || manifest.processSignals.toolSuccessRate > 1) {
|
|
48
|
+
reasons.push('process:invalid-tool-success-rate');
|
|
49
|
+
}
|
|
50
|
+
else if (manifest.processSignals.toolSuccessRate < 1) {
|
|
51
|
+
reasons.push('process:tool-failure');
|
|
52
|
+
}
|
|
53
|
+
if (manifest.processSignals.repeatedNoProgressActions > 0)
|
|
54
|
+
reasons.push('process:repeated-no-progress');
|
|
55
|
+
if (manifest.processSignals.scopeDrift)
|
|
56
|
+
reasons.push('process:scope-drift');
|
|
57
|
+
if (manifest.processSignals.weakenedOracle)
|
|
58
|
+
reasons.push('oracle:weakened');
|
|
59
|
+
if (manifest.processSignals.leakageOrShortcut)
|
|
60
|
+
reasons.push('process:leakage-or-shortcut');
|
|
61
|
+
if (manifest.processSignals.unsafeSideEffect)
|
|
62
|
+
reasons.push('process:unsafe-side-effect');
|
|
63
|
+
const admittedSegmentIds = manifest.segments
|
|
64
|
+
.filter(segment => segment.admitForLearning &&
|
|
65
|
+
(segment.contribution === 'causal' || segment.contribution === 'supporting'))
|
|
66
|
+
.map(segment => segment.id);
|
|
67
|
+
const rejectedSegmentIds = manifest.segments
|
|
68
|
+
.filter(segment => !admittedSegmentIds.includes(segment.id))
|
|
69
|
+
.map(segment => segment.id);
|
|
70
|
+
if (admittedSegmentIds.length === 0)
|
|
71
|
+
reasons.push('segments:no-admitted-contribution');
|
|
72
|
+
if (manifest.segments.some(segment => admittedSegmentIds.includes(segment.id) && segment.evidenceRefs.length === 0)) {
|
|
73
|
+
reasons.push('segments:admitted-without-evidence');
|
|
74
|
+
}
|
|
75
|
+
const hardReject = reasons.some(reason => reason === 'oracle:weakened' || reason === 'process:leakage-or-shortcut' ||
|
|
76
|
+
reason === 'process:unsafe-side-effect' || reason === 'integrity:trajectory-hash-mismatch' ||
|
|
77
|
+
reason === 'process:invalid-tool-success-rate' || reason.startsWith('outcome:'));
|
|
78
|
+
const disposition = hardReject ? 'reject' : reasons.length > 0 ? 'human-review' : 'admit';
|
|
79
|
+
return Object.freeze({
|
|
80
|
+
disposition,
|
|
81
|
+
autoPromotable: disposition === 'admit',
|
|
82
|
+
admittedSegmentIds: Object.freeze(admittedSegmentIds),
|
|
83
|
+
rejectedSegmentIds: Object.freeze(rejectedSegmentIds),
|
|
84
|
+
reasons: Object.freeze(reasons),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function countIndependentAdmissions(manifests) {
|
|
88
|
+
const identities = new Set();
|
|
89
|
+
for (const manifest of manifests) {
|
|
90
|
+
if (!admitLearningEvidence(manifest).autoPromotable)
|
|
91
|
+
continue;
|
|
92
|
+
const { trajectoryId: _runIdentity, trajectoryHash: _runHash, ...evidence } = manifest;
|
|
93
|
+
identities.add(canonicalize(evidence));
|
|
94
|
+
}
|
|
95
|
+
return identities.size;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=learning-evidence-admission.js.map
|
|
@@ -46,6 +46,8 @@ export interface PatternStoreConfig {
|
|
|
46
46
|
namespace: string;
|
|
47
47
|
/** Dimension of embedding vectors */
|
|
48
48
|
embeddingDimension: number;
|
|
49
|
+
/** Runtime-provided provenance override (primarily for injected embedders/tests). */
|
|
50
|
+
embeddingSpaceId?: string;
|
|
49
51
|
/** HNSW configuration */
|
|
50
52
|
hnsw: {
|
|
51
53
|
M: number;
|
|
@@ -124,6 +126,8 @@ export interface PatternSearchOptions {
|
|
|
124
126
|
context?: Partial<QEPatternContext>;
|
|
125
127
|
/** Include vector similarity search */
|
|
126
128
|
useVectorSearch?: boolean;
|
|
129
|
+
/** Provenance of a pre-computed query vector. Required for semantic ranking. */
|
|
130
|
+
embeddingSpaceId?: string;
|
|
127
131
|
/**
|
|
128
132
|
* Composable metadata filter expression (Task 1.2: ruvector-filter).
|
|
129
133
|
* Applied post-search to refine results by domain, severity,
|
|
@@ -212,6 +216,7 @@ export declare class PatternStore implements IPatternStore {
|
|
|
212
216
|
private typeIndex;
|
|
213
217
|
private tierIndex;
|
|
214
218
|
private hnswIndex;
|
|
219
|
+
private hnswSpaceId;
|
|
215
220
|
private hnswAvailable;
|
|
216
221
|
private hnswInitPromise;
|
|
217
222
|
private hdcCache;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* O(log n) approximate nearest neighbor search.
|
|
7
7
|
*/
|
|
8
8
|
import { v4 as uuidv4 } from 'uuid';
|
|
9
|
+
import { existsSync } from 'node:fs';
|
|
10
|
+
import { join as joinPath } from 'node:path';
|
|
9
11
|
// Issue #516: lightweight, sqlite-free project-root resolver (static import so it
|
|
10
12
|
// resolves under the test runner; avoids pulling unified-memory's sqlite graph).
|
|
11
13
|
import { findProjectRoot } from '../kernel/project-root.js';
|
|
@@ -28,6 +30,7 @@ import { createVectorDeltaTracker, } from '../integrations/ruvector/vector-delta
|
|
|
28
30
|
import { createHopfieldMemory } from '../integrations/ruvector/hopfield-memory.js';
|
|
29
31
|
import { createHyperbolicPatternIndex, } from './hyperbolic-pattern-index.js';
|
|
30
32
|
import { PatternNullStore } from './pattern-null-store.js';
|
|
33
|
+
import { getActiveEmbeddingSpaceIdentity } from './real-embeddings.js';
|
|
31
34
|
// ============================================================================
|
|
32
35
|
// R1: HDC Fingerprint Singleton (lazy-initialized)
|
|
33
36
|
// ============================================================================
|
|
@@ -120,6 +123,7 @@ export class PatternStore {
|
|
|
120
123
|
// HNSW index for vector search (lazy loaded - ADR-048)
|
|
121
124
|
// Using dynamic import type since HNSWIndex is lazily loaded
|
|
122
125
|
hnswIndex = null;
|
|
126
|
+
hnswSpaceId = null;
|
|
123
127
|
hnswAvailable = false;
|
|
124
128
|
hnswInitPromise = null;
|
|
125
129
|
// R1: HDC fingerprint cache (pattern ID -> fingerprint vector)
|
|
@@ -206,6 +210,11 @@ export class PatternStore {
|
|
|
206
210
|
async ensureHNSW() {
|
|
207
211
|
// Already initialized
|
|
208
212
|
if (this.hnswIndex !== null) {
|
|
213
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.config.embeddingSpaceId ?? null;
|
|
214
|
+
if (this.hnswSpaceId !== activeSpaceId) {
|
|
215
|
+
console.warn('[PatternStore] VECTOR_SPACE_MISMATCH: active embedder changed; semantic index disabled');
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
209
218
|
return this.hnswIndex;
|
|
210
219
|
}
|
|
211
220
|
// Already marked as unavailable
|
|
@@ -234,6 +243,10 @@ export class PatternStore {
|
|
|
234
243
|
*/
|
|
235
244
|
async initializeHNSWInternal() {
|
|
236
245
|
try {
|
|
246
|
+
this.hnswSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.config.embeddingSpaceId ?? null;
|
|
247
|
+
if (!this.hnswSpaceId) {
|
|
248
|
+
throw new Error('VECTOR_SPACE_UNVERIFIED: cannot initialize HNSW without runtime provenance');
|
|
249
|
+
}
|
|
237
250
|
// ADR-071: Use unified HNSW via bridge when flag is enabled
|
|
238
251
|
const unifiedFlags = getRuVectorFeatureFlags();
|
|
239
252
|
if (unifiedFlags.useUnifiedHnsw) {
|
|
@@ -302,10 +315,11 @@ export class PatternStore {
|
|
|
302
315
|
const maxBootstrap = this.config.hnsw.maxElements;
|
|
303
316
|
let loaded = 0;
|
|
304
317
|
let skipped = 0;
|
|
305
|
-
|
|
318
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.config.embeddingSpaceId;
|
|
319
|
+
for (const { patternId, embedding, spaceId } of embeddings) {
|
|
306
320
|
if (loaded >= maxBootstrap)
|
|
307
321
|
break;
|
|
308
|
-
if (!embedding || embedding.length !== this.config.embeddingDimension) {
|
|
322
|
+
if (!activeSpaceId || spaceId !== activeSpaceId || !embedding || embedding.length !== this.config.embeddingDimension) {
|
|
309
323
|
skipped++;
|
|
310
324
|
continue;
|
|
311
325
|
}
|
|
@@ -429,6 +443,10 @@ export class PatternStore {
|
|
|
429
443
|
if (pattern.confidence < this.config.minConfidence) {
|
|
430
444
|
return err(new Error(`Pattern confidence ${pattern.confidence} below threshold ${this.config.minConfidence}`));
|
|
431
445
|
}
|
|
446
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.config.embeddingSpaceId;
|
|
447
|
+
if (pattern.embedding && !activeSpaceId) {
|
|
448
|
+
return err(new Error('VECTOR_SPACE_UNVERIFIED: refusing to persist or index an embedding without runtime provenance'));
|
|
449
|
+
}
|
|
432
450
|
// Check domain limit
|
|
433
451
|
const domainCount = this.domainIndex.get(pattern.qeDomain)?.size || 0;
|
|
434
452
|
if (domainCount >= this.config.maxPatternsPerDomain) {
|
|
@@ -442,7 +460,7 @@ export class PatternStore {
|
|
|
442
460
|
// Persist to SQLite (pattern + embedding atomically)
|
|
443
461
|
if (this.sqliteStore) {
|
|
444
462
|
try {
|
|
445
|
-
const actualId = this.sqliteStore.storePattern(pattern, pattern.embedding);
|
|
463
|
+
const actualId = this.sqliteStore.storePattern(pattern, pattern.embedding, activeSpaceId);
|
|
446
464
|
// #447: ON CONFLICT(name, qe_domain, pattern_type) may preserve an
|
|
447
465
|
// existing row's id instead of the one we generated — realign the
|
|
448
466
|
// in-memory indices (and pattern.id itself) or every later
|
|
@@ -703,6 +721,10 @@ export class PatternStore {
|
|
|
703
721
|
}
|
|
704
722
|
// Vector search if query is embedding and HNSW available (lazy-load)
|
|
705
723
|
if (Array.isArray(query) && options.useVectorSearch !== false) {
|
|
724
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.config.embeddingSpaceId;
|
|
725
|
+
if (!activeSpaceId || options.embeddingSpaceId !== activeSpaceId) {
|
|
726
|
+
throw new Error('VECTOR_SPACE_UNVERIFIED: pre-computed query vectors require the active embeddingSpaceId');
|
|
727
|
+
}
|
|
706
728
|
const hnsw = await this.ensureHNSW();
|
|
707
729
|
if (hnsw) {
|
|
708
730
|
const hnswResults = await hnsw.search(query, limit * 2);
|
|
@@ -1410,8 +1432,6 @@ export function createPatternStore(memory, config) {
|
|
|
1410
1432
|
// Only use RVF if the data directory exists (created by kernel init).
|
|
1411
1433
|
// Issue #516: anchor to the project root so a subfolder cwd reads/writes
|
|
1412
1434
|
// the project's own .agentic-qe/ rather than a cwd-relative stray store.
|
|
1413
|
-
const { existsSync } = require('fs');
|
|
1414
|
-
const { join: joinPath } = require('path');
|
|
1415
1435
|
const projectRoot = process.env.AQE_PROJECT_ROOT ?? findProjectRoot();
|
|
1416
1436
|
const rvfDir = joinPath(projectRoot, '.agentic-qe');
|
|
1417
1437
|
const rvfPath = joinPath(rvfDir, 'patterns.rvf');
|
|
@@ -1431,7 +1451,12 @@ export function createPatternStore(memory, config) {
|
|
|
1431
1451
|
const shared = getSharedRvfAdapter(rvfDir, mergedConfig.embeddingDimension);
|
|
1432
1452
|
if (shared) {
|
|
1433
1453
|
useSharedAdapter = true;
|
|
1434
|
-
const store = new RvfPatternStore(() => shared, {
|
|
1454
|
+
const store = new RvfPatternStore(() => shared, {
|
|
1455
|
+
rvfPath,
|
|
1456
|
+
base: mergedConfig,
|
|
1457
|
+
skipCloseOnDispose: true,
|
|
1458
|
+
embeddingSpaceId: mergedConfig.embeddingSpaceId,
|
|
1459
|
+
});
|
|
1435
1460
|
console.log('[PatternStore] Using RVF-backed store (ADR-066)');
|
|
1436
1461
|
return store;
|
|
1437
1462
|
}
|
|
@@ -1487,7 +1512,11 @@ export function createPatternStore(memory, config) {
|
|
|
1487
1512
|
}
|
|
1488
1513
|
throw createErr;
|
|
1489
1514
|
}
|
|
1490
|
-
}, {
|
|
1515
|
+
}, {
|
|
1516
|
+
rvfPath,
|
|
1517
|
+
base: mergedConfig,
|
|
1518
|
+
embeddingSpaceId: mergedConfig.embeddingSpaceId,
|
|
1519
|
+
});
|
|
1491
1520
|
console.log('[PatternStore] Using RVF-backed store (ADR-066)');
|
|
1492
1521
|
return store;
|
|
1493
1522
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* (the LLM step is the metered part — bind it deliberately).
|
|
22
22
|
*/
|
|
23
23
|
import type { Database as DatabaseType } from 'better-sqlite3';
|
|
24
|
+
import { type EmbeddingSpaceIdentity } from '../embedding-space.js';
|
|
24
25
|
import type { RetrievalPolicy } from './policy.js';
|
|
25
26
|
import type { PolicyScorer } from './generation.js';
|
|
26
27
|
/** A pattern retrieved as a few-shot example for test generation. */
|
|
@@ -73,6 +74,13 @@ export interface SemanticRetrieverOptions {
|
|
|
73
74
|
db: DatabaseType;
|
|
74
75
|
/** Embed a query into the pattern-embedding space. Default: all-MiniLM-L6-v2. */
|
|
75
76
|
embed?: (text: string) => Promise<number[]>;
|
|
77
|
+
/** Storage-side embedding path used by the executable round-trip canary. */
|
|
78
|
+
writeEmbed?: (text: string) => Promise<number[]>;
|
|
79
|
+
/** Runtime identities for injected embedders. Defaults to the active AQE embedder. */
|
|
80
|
+
embeddingSpace?: EmbeddingSpaceIdentity;
|
|
81
|
+
writeEmbeddingSpace?: EmbeddingSpaceIdentity;
|
|
82
|
+
/** Explicit non-semantic fallback used when provenance cannot be verified. */
|
|
83
|
+
fallback?: RetrieveFn;
|
|
76
84
|
topK?: number;
|
|
77
85
|
}
|
|
78
86
|
/**
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* a real policy-weighted DB retriever + an LLM test generator in production
|
|
21
21
|
* (the LLM step is the metered part — bind it deliberately).
|
|
22
22
|
*/
|
|
23
|
-
import { computeRealEmbedding } from '../real-embeddings.js';
|
|
23
|
+
import { computeRealEmbedding, getActiveEmbeddingSpaceIdentity } from '../real-embeddings.js';
|
|
24
|
+
import { EmbeddingSpaceError, inspectEmbeddingSpaceRows, verifyEmbeddingRoundTrip, } from '../embedding-space.js';
|
|
24
25
|
import { evaluateOracle } from '../../validation/oracle-eval.js';
|
|
25
26
|
import { loadAnchorSet, anchorMean as meanOf } from '../../validation/anchor-set.js';
|
|
26
27
|
import { createCorpusScorer } from './corpus-scorer.js';
|
|
@@ -124,20 +125,62 @@ function cosine(a, b) {
|
|
|
124
125
|
export function createSemanticRetriever(opts) {
|
|
125
126
|
const embed = opts.embed ?? ((t) => computeRealEmbedding(t));
|
|
126
127
|
const topK = opts.topK ?? 3;
|
|
128
|
+
const hasSpaceId = opts.db.prepare("PRAGMA table_info('qe_pattern_embeddings')").all()
|
|
129
|
+
.some((column) => column.name === 'space_id');
|
|
127
130
|
const rows = opts.db.prepare(`SELECT p.id AS id, p.name AS name, COALESCE(p.description,'') AS body,
|
|
128
|
-
e.embedding AS embedding, e.dimension AS dimension
|
|
131
|
+
e.embedding AS embedding, e.dimension AS dimension, ${hasSpaceId ? 'e.space_id' : 'NULL'} AS space_id
|
|
129
132
|
FROM qe_patterns p JOIN qe_pattern_embeddings e ON e.pattern_id = p.id
|
|
130
133
|
WHERE p.deprecated_at IS NULL`).all();
|
|
131
134
|
const toks = (s) => new Set(s.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean));
|
|
132
135
|
const docs = rows.map((r) => ({
|
|
133
|
-
id: r.id, name: r.name, body: r.body,
|
|
136
|
+
id: r.id, name: r.name, body: r.body, spaceId: r.space_id,
|
|
134
137
|
vec: new Float32Array(r.embedding.buffer, r.embedding.byteOffset, r.dimension),
|
|
135
138
|
nameToks: toks(r.name), bodyToks: toks(r.body),
|
|
136
139
|
}));
|
|
137
140
|
const queryCache = new Map();
|
|
141
|
+
let compatibilityCheck = null;
|
|
138
142
|
return async (query, policy) => {
|
|
139
143
|
if (docs.length === 0)
|
|
140
144
|
return [];
|
|
145
|
+
try {
|
|
146
|
+
if (!opts.writeEmbed) {
|
|
147
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_UNVERIFIED', 'an independent storage-side embedder is required for the write/read canary');
|
|
148
|
+
}
|
|
149
|
+
if (!compatibilityCheck) {
|
|
150
|
+
compatibilityCheck = verifyEmbeddingRoundTrip(opts.writeEmbed, embed);
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
await compatibilityCheck;
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
compatibilityCheck = null;
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
const activeIdentity = opts.embeddingSpace ?? getActiveEmbeddingSpaceIdentity();
|
|
160
|
+
const writeIdentity = opts.writeEmbeddingSpace ?? activeIdentity;
|
|
161
|
+
if (!activeIdentity || !writeIdentity) {
|
|
162
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_UNVERIFIED', 'runtime embedding-space identity is unavailable');
|
|
163
|
+
}
|
|
164
|
+
if (writeIdentity.spaceId !== activeIdentity.spaceId) {
|
|
165
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_MISMATCH', `write space ${writeIdentity.spaceId} != query space ${activeIdentity.spaceId}`);
|
|
166
|
+
}
|
|
167
|
+
const invalidDimensions = docs.filter((doc) => doc.vec.length !== activeIdentity.dimensions);
|
|
168
|
+
if (invalidDimensions.length > 0) {
|
|
169
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_MISMATCH', `${invalidDimensions.length} stored vectors have dimensions incompatible with ${activeIdentity.dimensions}`);
|
|
170
|
+
}
|
|
171
|
+
const diagnostics = inspectEmbeddingSpaceRows(docs.map((doc) => ({ spaceId: doc.spaceId })), activeIdentity.spaceId);
|
|
172
|
+
if (diagnostics.unverifiedVectors > 0) {
|
|
173
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_UNVERIFIED', `${diagnostics.unverifiedVectors} stored vectors have no provenance`);
|
|
174
|
+
}
|
|
175
|
+
if (diagnostics.status === 'vector_space_mismatch') {
|
|
176
|
+
throw new EmbeddingSpaceError('VECTOR_SPACE_MISMATCH', `stored spaces [${diagnostics.storedSpaceIds.join(', ')}] do not match ${activeIdentity.spaceId}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
if (opts.fallback)
|
|
181
|
+
return opts.fallback(query, policy);
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
141
184
|
let qv = queryCache.get(query);
|
|
142
185
|
if (!qv) {
|
|
143
186
|
qv = new Float32Array(await embed(query));
|
|
@@ -22,6 +22,7 @@ import { getGuidance, getCombinedGuidance, generateGuidanceContext, checkAntiPat
|
|
|
22
22
|
import { createPatternStore, } from './pattern-store.js';
|
|
23
23
|
import { createSQLitePatternStore, } from './sqlite-persistence.js';
|
|
24
24
|
import { getWitnessChain } from '../audit/witness-chain.js';
|
|
25
|
+
import { getActiveEmbeddingSpaceIdentity } from './real-embeddings.js';
|
|
25
26
|
// Import extracted modules
|
|
26
27
|
import { DEFAULT_QE_REASONING_BANK_CONFIG } from './qe-reasoning-bank-types.js';
|
|
27
28
|
import { PRETRAINED_PATTERNS } from './pretrained-patterns.js';
|
|
@@ -323,6 +324,9 @@ export class QEReasoningBank {
|
|
|
323
324
|
return this.patternStore.search(searchQuery, {
|
|
324
325
|
...options,
|
|
325
326
|
useVectorSearch,
|
|
327
|
+
embeddingSpaceId: typeof query === 'string'
|
|
328
|
+
? getActiveEmbeddingSpaceIdentity()?.spaceId
|
|
329
|
+
: options?.embeddingSpaceId,
|
|
326
330
|
});
|
|
327
331
|
}
|
|
328
332
|
/**
|