agentic-qe 3.13.11 → 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/helpers/.helpers-version +1 -1
- package/.claude/helpers/helpers.manifest.json +2 -2
- package/.claude/helpers/statusline.cjs +89 -40
- 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 +93 -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-5ARDZYNO.js → agent-booster-wasm-JZO6VUW4.js} +2 -2
- package/dist/cli/chunks/{agent-handler-SVKEPF7B.js → agent-handler-534KFGEJ.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-QDL7OVHC.js → agent-memory-branch-B7KWLWY4.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-NXRNKJNA.js +2 -0
- package/dist/cli/chunks/{arena-7OCKBN6O.js → arena-7CCD3S3I.js} +2 -2
- package/dist/cli/chunks/{arena-HQLSNQZ3.js → arena-OW5MELJX.js} +4 -4
- package/dist/cli/chunks/{audit-2EQJW5UE.js → audit-BHVKN4E2.js} +3 -3
- package/dist/cli/chunks/base-F6GMOKU2.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-OBFNNE4T.js → better-sqlite3-P5FA6WFK.js} +2 -2
- package/dist/cli/chunks/brain-handler-WNW5LOV7.js +90 -0
- package/dist/cli/chunks/{branch-enumerator-6B4L5O3D.js → branch-enumerator-TVZ2ODKH.js} +2 -2
- package/dist/cli/chunks/{browser-VDMGBWNK.js → browser-TCEB2W2F.js} +2 -2
- package/dist/cli/chunks/browser-workflow-QRDC46LR.js +2 -0
- package/dist/cli/chunks/{chunk-M3MRFZKD.js → chunk-2D7UBX5S.js} +1 -1
- package/dist/cli/chunks/{chunk-IZF3VLNW.js → chunk-2HYVOX6N.js} +1 -1
- package/dist/cli/chunks/{chunk-U6G6RUFI.js → chunk-2NO4H35K.js} +1 -1
- package/dist/cli/chunks/{chunk-4TJJU5Y2.js → chunk-2O4DDPEA.js} +19 -19
- package/dist/cli/chunks/{chunk-24XW7KUX.js → chunk-3EM2MK3Z.js} +2 -2
- package/dist/cli/chunks/chunk-3GUO4ERR.js +24 -0
- package/dist/cli/chunks/{chunk-YRCNWQBO.js → chunk-3JIJBR4V.js} +2 -2
- package/dist/cli/chunks/{chunk-2E2QCIGR.js → chunk-3QT6S3A3.js} +3 -3
- package/dist/cli/chunks/{chunk-W2T36CS5.js → chunk-3RYTAYR6.js} +1 -1
- package/dist/cli/chunks/chunk-43GPSYAL.js +14 -0
- package/dist/cli/chunks/{chunk-YYAJEPRD.js → chunk-4FEJEVG7.js} +1 -1
- package/dist/cli/chunks/{chunk-4DTBGQWA.js → chunk-4MK2G6TK.js} +2 -2
- package/dist/cli/chunks/{chunk-CK7ZLMD2.js → chunk-4XTHRAUV.js} +1 -1
- package/dist/cli/chunks/{chunk-LM727BVL.js → chunk-4ZVGSVHV.js} +4 -4
- package/dist/cli/chunks/{chunk-DPZ4AU6W.js → chunk-52DFCV57.js} +2 -2
- package/dist/cli/chunks/{chunk-PADCR4LY.js → chunk-5LEAGKX5.js} +2 -2
- package/dist/cli/chunks/{chunk-P736OKQN.js → chunk-5MZF4N4Q.js} +1 -1
- package/dist/cli/chunks/{chunk-XZI4QXJJ.js → chunk-5VDVYTO5.js} +2 -2
- package/dist/cli/chunks/chunk-5XGVSQS2.js +11 -0
- package/dist/cli/chunks/{chunk-AAPJG3WI.js → chunk-6AOZU3UN.js} +2 -2
- package/dist/cli/chunks/{chunk-NC7HTDH5.js → chunk-6AYO3IR2.js} +2 -2
- package/dist/cli/chunks/{chunk-TJ67B7S7.js → chunk-6DPAMYLU.js} +2 -2
- package/dist/cli/chunks/{chunk-PZHAPI47.js → chunk-6IJMD2ZL.js} +3 -3
- package/dist/cli/chunks/{chunk-RGUKQXKL.js → chunk-6IZQSLYZ.js} +2 -2
- package/dist/cli/chunks/{chunk-2E3PRDEX.js → chunk-6W42XWLL.js} +2 -2
- package/dist/cli/chunks/{chunk-ATRUE6CT.js → chunk-7BOPFN3Y.js} +2 -2
- package/dist/cli/chunks/{chunk-LIGDJP6H.js → chunk-7OUMJCJT.js} +1 -1
- package/dist/cli/chunks/{chunk-2Y3PW5EJ.js → chunk-7RAB2BZY.js} +160 -26
- package/dist/cli/chunks/{chunk-XEUUWOSS.js → chunk-7RVAHJQZ.js} +3 -3
- package/dist/cli/chunks/{chunk-HHEWINDL.js → chunk-A2WZEMWT.js} +1 -1
- package/dist/cli/chunks/{chunk-36ONUM43.js → chunk-A7SKM6JL.js} +1 -1
- package/dist/cli/chunks/chunk-AFGT26NR.js +2 -0
- package/dist/cli/chunks/{chunk-23E37MDA.js → chunk-AR6SATU3.js} +2 -2
- package/dist/cli/chunks/{chunk-IYMV4CU5.js → chunk-AVLA5PBJ.js} +2 -2
- package/dist/cli/chunks/{chunk-OLPJGYO5.js → chunk-B3H4K7CY.js} +2 -2
- package/dist/cli/chunks/{chunk-JWT675RM.js → chunk-BQCTO7UB.js} +2 -2
- package/dist/cli/chunks/{chunk-JKP2BUF5.js → chunk-BZ4QVFP2.js} +2 -2
- package/dist/cli/chunks/{chunk-WINYWMQP.js → chunk-CIUOC5F3.js} +1 -1
- package/dist/cli/chunks/{chunk-SJJFU7KK.js → chunk-CIZ6LSNV.js} +2 -2
- package/dist/cli/chunks/{chunk-2D7SBOZ4.js → chunk-DDPJUAXQ.js} +2 -2
- package/dist/cli/chunks/{chunk-H7QWOJF2.js → chunk-DJITEQYS.js} +2 -2
- package/dist/cli/chunks/{chunk-DMHQ4ZUZ.js → chunk-DOWCOZDO.js} +2 -2
- package/dist/cli/chunks/{chunk-PBJ5I2NS.js → chunk-E4NU4BJA.js} +2 -2
- package/dist/cli/chunks/{chunk-E54QUKAD.js → chunk-E722WNWC.js} +2 -2
- package/dist/cli/chunks/chunk-ECTPFCON.js +2 -0
- package/dist/cli/chunks/{chunk-MUAW4AJ6.js → chunk-EJ6IP7DE.js} +5 -5
- package/dist/cli/chunks/{chunk-NHL37QAZ.js → chunk-ENGKLFLY.js} +2 -2
- package/dist/cli/chunks/{chunk-VU3ARH4S.js → chunk-FF43SRP6.js} +1 -1
- package/dist/cli/chunks/{chunk-PJNIDDER.js → chunk-FOHYBR3O.js} +1 -1
- package/dist/cli/chunks/{chunk-LREIHR2A.js → chunk-FRL3X2QA.js} +2 -2
- package/dist/cli/chunks/{chunk-WYQM7GXW.js → chunk-GKNDP5VK.js} +2 -2
- package/dist/cli/chunks/{chunk-JK6ENS3J.js → chunk-GVEJP5T7.js} +2 -2
- package/dist/cli/chunks/{chunk-H3BHOIT6.js → chunk-H3YDDKBW.js} +3 -3
- package/dist/cli/chunks/{chunk-3SPYI7TS.js → chunk-H6NFDOMK.js} +1 -1
- package/dist/cli/chunks/{chunk-AZVV7POX.js → chunk-H76TV4UU.js} +3 -3
- package/dist/cli/chunks/{chunk-2HT5HRAA.js → chunk-HJIAVR6P.js} +2 -2
- package/dist/cli/chunks/{chunk-UZ7OWJ75.js → chunk-HLNQDRHA.js} +1 -1
- package/dist/cli/chunks/{chunk-IGW5L7YM.js → chunk-HNKPLVYS.js} +1 -1
- package/dist/cli/chunks/{chunk-Y2S6SS7M.js → chunk-HQ7243G3.js} +2 -2
- package/dist/cli/chunks/{chunk-TZA45FI7.js → chunk-HQHLHSJO.js} +2 -2
- package/dist/cli/chunks/{chunk-YEPJS4AM.js → chunk-I3VHXA2W.js} +2 -2
- package/dist/cli/chunks/{chunk-W2NQDAJZ.js → chunk-IE5LC7MB.js} +2 -2
- package/dist/cli/chunks/{chunk-TU4BYSXR.js → chunk-IL4AEB3J.js} +27 -25
- package/dist/cli/chunks/{chunk-JTQSXU6V.js → chunk-IL6QRXRP.js} +6 -6
- package/dist/cli/chunks/{chunk-UX5SM2PW.js → chunk-IQ3JFHZN.js} +1 -1
- package/dist/cli/chunks/{chunk-RAV2NJNX.js → chunk-IQLRA4FV.js} +1 -1
- package/dist/cli/chunks/{chunk-S3FNAHNC.js → chunk-J3XSHJGK.js} +2 -2
- package/dist/cli/chunks/{chunk-AHG2O5HT.js → chunk-JAK5UUWH.js} +2 -2
- package/dist/cli/chunks/{chunk-XDK2TPI5.js → chunk-JGROLJ33.js} +1 -1
- package/dist/cli/chunks/{chunk-MWTFFGU3.js → chunk-JMKMDSXG.js} +2 -2
- package/dist/cli/chunks/{chunk-BVKFBJX6.js → chunk-JRKEBESE.js} +2 -2
- package/dist/cli/chunks/{chunk-76NSSNB3.js → chunk-JTWJR2KY.js} +2 -2
- package/dist/cli/chunks/{chunk-QYHRDBKI.js → chunk-JY4VZ6BN.js} +2 -2
- package/dist/cli/chunks/{chunk-DLL3AJH7.js → chunk-K6CGQR5R.js} +1 -1
- package/dist/cli/chunks/{chunk-7HTYM6XY.js → chunk-KDIZQHG5.js} +2 -2
- package/dist/cli/chunks/{chunk-B646CE3C.js → chunk-KTSCZ7AW.js} +2 -2
- package/dist/cli/chunks/{chunk-LLP3UW62.js → chunk-L4C42WYI.js} +2 -2
- package/dist/cli/chunks/{chunk-H3AKF2HS.js → chunk-LCSVROU7.js} +10 -10
- package/dist/cli/chunks/{chunk-HZR4G6I3.js → chunk-LKR7T3OZ.js} +1 -1
- package/dist/cli/chunks/{chunk-Z5ARI4XT.js → chunk-LZHTCUCO.js} +2 -2
- package/dist/cli/chunks/{chunk-YDEYB6Z2.js → chunk-M3HUZD2I.js} +1 -1
- package/dist/cli/chunks/{chunk-GWTGBQ6X.js → chunk-MO7EITJK.js} +2 -2
- package/dist/cli/chunks/{chunk-5364DBZG.js → chunk-N2YAUDAV.js} +2 -2
- package/dist/cli/chunks/{chunk-XVFSZLRS.js → chunk-NDPQ2WPU.js} +1 -1
- package/dist/cli/chunks/{chunk-CTS545BF.js → chunk-NKWO2X3T.js} +1 -1
- package/dist/cli/chunks/{chunk-GPJDZFFV.js → chunk-NOPVFBQM.js} +2 -2
- package/dist/cli/chunks/{chunk-VNVGCJCS.js → chunk-NYARYONH.js} +1 -1
- package/dist/cli/chunks/{chunk-WRZ5WZG3.js → chunk-O2MZZL54.js} +2 -2
- package/dist/cli/chunks/{chunk-EKFKQGIT.js → chunk-OIYUSWHX.js} +1 -1
- package/dist/cli/chunks/{chunk-ZNGFSR5M.js → chunk-OONCRNFA.js} +2 -2
- package/dist/cli/chunks/{chunk-LUAXQB57.js → chunk-PEW6FZ47.js} +1 -1
- package/dist/cli/chunks/{chunk-W7BB4XLP.js → chunk-Q73RRTLE.js} +2 -2
- package/dist/cli/chunks/{chunk-JKPMV5VB.js → chunk-QKQZ4IJF.js} +5 -5
- package/dist/cli/chunks/{chunk-EHZQIXH6.js → chunk-QMMDN4WX.js} +3 -3
- package/dist/cli/chunks/chunk-QQCENKCX.js +2 -0
- package/dist/cli/chunks/{chunk-7YL7P5XG.js → chunk-QSPRQPEL.js} +2 -2
- package/dist/cli/chunks/{chunk-DXQMVATY.js → chunk-QZPFUFZG.js} +2 -2
- package/dist/cli/chunks/chunk-R2B6EE45.js +2 -0
- package/dist/cli/chunks/{chunk-VLW63UA2.js → chunk-R6WJF4D5.js} +2 -2
- package/dist/cli/chunks/{chunk-EWH7PFV6.js → chunk-RGVD6ZUX.js} +1 -1
- package/dist/cli/chunks/{chunk-UGFHEVG4.js → chunk-RKUYVVGJ.js} +2 -2
- package/dist/cli/chunks/{chunk-V7QZMOG3.js → chunk-S5YVLPXU.js} +2 -2
- package/dist/cli/chunks/{chunk-UDFTDQ6C.js → chunk-SROZXIMT.js} +37 -37
- package/dist/cli/chunks/{chunk-AFXMTSO3.js → chunk-SSV6KSFT.js} +1 -1
- package/dist/cli/chunks/{chunk-HGPMS6JL.js → chunk-SUSMHSXT.js} +2 -2
- package/dist/cli/chunks/{chunk-BL5BHBXR.js → chunk-T3BZAFLP.js} +1 -1
- package/dist/cli/chunks/{chunk-K652SCBA.js → chunk-TGOGCA74.js} +2 -2
- package/dist/cli/chunks/{chunk-VHNAN7E2.js → chunk-TKYEP7OR.js} +1 -1
- package/dist/cli/chunks/{chunk-OJUI65TR.js → chunk-TQJE7DNL.js} +2 -2
- package/dist/cli/chunks/{chunk-MS5CAEPA.js → chunk-TRDEULS7.js} +2 -2
- package/dist/cli/chunks/{chunk-YRV45WDT.js → chunk-U4GZWPKM.js} +2 -2
- package/dist/cli/chunks/{chunk-2BDTZYQN.js → chunk-UI6WSPEK.js} +3 -3
- package/dist/cli/chunks/{chunk-TMY2Y7SC.js → chunk-UUJ5VQJM.js} +1 -1
- package/dist/cli/chunks/{chunk-4CTKRLRX.js → chunk-VESOYP6A.js} +2 -2
- package/dist/cli/chunks/{chunk-UPMQHCC2.js → chunk-VOSISOFD.js} +1 -1
- package/dist/cli/chunks/{chunk-IZOWGVTU.js → chunk-VPVZHJSU.js} +2 -2
- package/dist/cli/chunks/{chunk-TBO64O56.js → chunk-VRRG66XB.js} +1 -1
- package/dist/cli/chunks/{chunk-WJB6YYMJ.js → chunk-VXU53F7Z.js} +2 -2
- package/dist/cli/chunks/{chunk-4TUGQESL.js → chunk-VYENTZ45.js} +2 -2
- package/dist/cli/chunks/chunk-WJXHE52V.js +65 -0
- package/dist/cli/chunks/{chunk-EN36AFRJ.js → chunk-WKNWRDA5.js} +1 -1
- package/dist/cli/chunks/{chunk-4X4GTEQY.js → chunk-WTHAVFIC.js} +1 -1
- package/dist/cli/chunks/{chunk-LPDT27EC.js → chunk-WWWX76QB.js} +2 -2
- package/dist/cli/chunks/{chunk-TCVEXQLL.js → chunk-XITTURP2.js} +2 -2
- package/dist/cli/chunks/{chunk-HV6LJ57R.js → chunk-XXFKN7LB.js} +1 -1
- package/dist/cli/chunks/{chunk-UJ2NRIAS.js → chunk-YEAC3DC6.js} +2 -2
- package/dist/cli/chunks/{chunk-FBASWZ7G.js → chunk-YKWMKRYB.js} +1 -1
- package/dist/cli/chunks/chunk-YKZV7O65.js +2 -0
- package/dist/cli/chunks/{chunk-PT6U3IIK.js → chunk-YW4RNZWT.js} +2 -2
- package/dist/cli/chunks/{chunk-H5DS7S4B.js → chunk-ZAAYOENS.js} +2 -2
- package/dist/cli/chunks/chunk-ZBKGX72B.js +13 -0
- package/dist/cli/chunks/{chunk-WVNLNXXI.js → chunk-ZBOWR4XT.js} +2 -2
- package/dist/cli/chunks/{chunk-FPX4JSFH.js → chunk-ZCVJCCQQ.js} +2 -2
- package/dist/cli/chunks/{chunk-OQWG7GOD.js → chunk-ZI3UO7QR.js} +8 -7
- package/dist/cli/chunks/{chunk-BPPEN7SS.js → chunk-ZNSMVQCG.js} +2 -2
- package/dist/cli/chunks/{chunk-EI4KYBNI.js → chunk-ZQSXG7FA.js} +2 -2
- package/dist/cli/chunks/{ci-M6WYL2XY.js → ci-B432UH6N.js} +2 -2
- package/dist/cli/chunks/{ci-output-JFC3WOHX.js → ci-output-GTHH7WYG.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-IMVBU6WP.js → circuit-breaker-VW75DLME.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-M5T5ZUXX.js → claude-flow-setup-RE3IVT7U.js} +2 -2
- package/dist/cli/chunks/client-HNBZUEVV.js +2 -0
- package/dist/cli/chunks/{cline-installer-LSFAUHXC.js → cline-installer-NUBZZ55N.js} +2 -2
- package/dist/cli/chunks/{code-N3SWJ3XL.js → code-K6JCWKNW.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-WPGRG36B.js → code-index-extractor-I4ILB5JN.js} +2 -2
- package/dist/cli/chunks/{codex-installer-LKRCSDU5.js → codex-installer-AKQ5BCHU.js} +2 -2
- package/dist/cli/chunks/{completions-E5TBZ5AB.js → completions-V3KJVJF4.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-3FOSOELK.js → complexity-analyzer-HRG7OOY3.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-ZSVFWMQB.js → continuedev-installer-CNTDONWG.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-POSKHPZM.js → copilot-installer-XPWWIWYA.js} +2 -2
- package/dist/cli/chunks/core-handlers-TB7NLYXL.js +2 -0
- package/dist/cli/chunks/{cost-tracker-3UWDCNGC.js → cost-tracker-MFNLQ56K.js} +2 -2
- package/dist/cli/chunks/{coverage-HPBO67JF.js → coverage-KOIK654V.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-MDSI553U.js +2 -0
- package/dist/cli/chunks/{cursor-installer-DSW3L62X.js → cursor-installer-S5MKLRQQ.js} +2 -2
- package/dist/cli/chunks/{daemon-2622ZCMJ.js → daemon-DUS6JYW6.js} +3 -3
- package/dist/cli/chunks/{daemon-33KTKDUM.js → daemon-Z7VPGWHY.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-YFT5JMM6.js → dag-attention-scheduler-7CQ3ARNI.js} +2 -2
- package/dist/cli/chunks/{detect-COR3Q6BE.js → detect-WORBCAYF.js} +2 -2
- package/dist/cli/chunks/{dist-node-5TRNTNWI.js → dist-node-KRNI6OYW.js} +2 -2
- package/dist/cli/chunks/{domain-handler-TZC4GCF6.js → domain-handler-KRUR2VQG.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-D2TENM3Y.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-5ID5D77H.js → eval-AYQ7BSUP.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-MT4Z74TD.js → experience-capture-middleware-AWQBL6LT.js} +3 -3
- package/dist/cli/chunks/{fast-paths-MACRZGSE.js → fast-paths-V5EL4BYJ.js} +2 -2
- package/dist/cli/chunks/{feature-flags-LFNL6BHS.js → feature-flags-BXX7BP22.js} +2 -2
- package/dist/cli/chunks/{feature-flags-JZX6ZBUX.js → feature-flags-P34BPRWU.js} +2 -2
- package/dist/cli/chunks/{file-discovery-DA5BEAO2.js → file-discovery-MS6BKQ2U.js} +2 -2
- package/dist/cli/chunks/{fleet-35I4F7D2.js → fleet-7WVVPA4W.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-2W3HM3ZI.js → gnn-wrapper-7WQ3LEPG.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-6O2D2FU2.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-GWBXEMQR.js → hnsw-legacy-bridge-Y3GAR3UP.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-TZ4VLARU.js → hnswlib-node-5QUXZQWQ.js} +2 -2
- package/dist/cli/chunks/{hooks-723GPTQ4.js → hooks-2D64KPRY.js} +10 -10
- package/dist/cli/chunks/{hypergraph-engine-ILRYFJM5.js → hypergraph-engine-5INXEZDP.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-523TSK4P.js → hypergraph-handler-YJJJ3ESZ.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-IBJ43GQL.js +2 -0
- package/dist/cli/chunks/{init-handler-RBDYIXNV.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-E2QSX7Z7.js → kilocode-installer-3N3QGTJU.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-EZZLT2R5.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-HBBULO65.js +37 -0
- package/dist/cli/chunks/llm-router-service-KF5ZALUQ.js +2 -0
- package/dist/cli/chunks/{load-QFQ3YOBQ.js → load-B5OFYB4H.js} +2 -2
- package/dist/cli/chunks/load-test-LHMBCNCH.js +2 -0
- package/dist/cli/chunks/{mcp-FPBBJJFY.js → mcp-FG3LNQR4.js} +2 -2
- package/dist/cli/chunks/{memory-RKN6KV75.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-OUNW3JM5.js → multi-model-executor-PUB7E6KH.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-FXETYGGY.js → opencode-installer-TGCSGVG2.js} +2 -2
- package/dist/cli/chunks/{orchestrator-35UTVXSP.js → orchestrator-S5FTJFGB.js} +10 -13
- package/dist/cli/chunks/pattern-null-store-UZSHCRL2.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-YEQDS7DN.js → pattern-usage-recorder-LCXXGRAB.js} +2 -2
- package/dist/cli/chunks/{pipeline-YDJMWCAR.js → pipeline-ENOSRHKW.js} +2 -2
- package/dist/cli/chunks/{platform-L3LPNVKT.js → platform-WCRBO3Z7.js} +2 -2
- package/dist/cli/chunks/{plugin-55EYFJH5.js → plugin-JZ5ODJSU.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-SUZT6RTM.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-QNBFRJNY.js → protocol-handler-IP4NLVY3.js} +2 -2
- package/dist/cli/chunks/{prove-3X5NQP4L.js → prove-P6FM4RU7.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-W74RSMMU.js +2 -0
- package/dist/cli/chunks/{quality-5ZONTNA6.js → quality-UHP4XO26.js} +2 -2
- package/dist/cli/chunks/{quality-gate-JPNREEVR.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-ZK73O2GD.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-2UN5GRHJ.js → routing-handler-IK7HYERQ.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-EQQUEVWN.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-66FEC3MD.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-H7PEUUCV.js → security-HN4UXFXX.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-XETNK4ID.js → shared-rvf-adapter-XJCPX5SN.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-PXD54BWJ.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-ZXANTHKT.js +47 -0
- package/dist/cli/chunks/{structural-health-EIFBDCRI.js → structural-health-LR6WI3AH.js} +2 -2
- package/dist/cli/chunks/{sync-PECWQ64K.js → sync-4OEI3BC2.js} +2 -2
- package/dist/cli/chunks/{sync-3SU4H6R3.js → sync-I5IUJF33.js} +2 -2
- package/dist/cli/chunks/{task-handler-ZTUAT6YF.js → task-handler-R3ATJKU5.js} +2 -2
- package/dist/cli/chunks/{task-handlers-4RIO7LJJ.js → task-handlers-4X357AEW.js} +3 -3
- package/dist/cli/chunks/{test-EV7BSUTI.js → test-PR2B5H2F.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-4WVI5DLE.js → test-scheduling-ZNOSQVLD.js} +3 -3
- package/dist/cli/chunks/token-bootstrap-LYXOI72S.js +2 -0
- package/dist/cli/chunks/{token-usage-FR3JOWYB.js → token-usage-R6EQZBX2.js} +2 -2
- package/dist/cli/chunks/{transformers-FENO33LA.js → transformers-COQWK27J.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-YFGJLSMB.js → tree-sitter-wasm-parser-LLIW2X3M.js} +2 -2
- package/dist/cli/chunks/{types-N3Y565RZ.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-33ZVVZFW.js → upgrade-DVIJ456A.js} +2 -2
- package/dist/cli/chunks/{validate-CS5PXGDF.js → validate-UYTSMJ5X.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-GRZPWYNM.js → validate-swarm-P32WCJR6.js} +2 -2
- package/dist/cli/chunks/{vibium-IO7N4VEE.js → vibium-JGVOLM6X.js} +2 -2
- package/dist/cli/chunks/visual-security-RJ7RTNGJ.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-UQXR5HHR.js → web-tree-sitter-5ZGNCTPN.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-BCKLSLZT.js → windsurf-installer-IILSSQAE.js} +2 -2
- package/dist/cli/chunks/{witness-chain-R3V26QWL.js → witness-chain-JZMXCG3B.js} +2 -2
- package/dist/cli/chunks/witness-chain-YXXXNGAM.js +2 -0
- package/dist/cli/chunks/{witness-key-manager-Y36HMPEM.js → witness-key-manager-UUTLNUIH.js} +2 -2
- package/dist/cli/chunks/{workflow-4TCIUUFQ.js → workflow-NS7HXVHZ.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-5KUAVSTH.js +2 -0
- package/dist/cli/chunks/{wrappers-MD4JRHJH.js → wrappers-XKEDSV5W.js} +2 -2
- package/dist/cli/commands/learning.js +44 -0
- package/dist/cli/commands/llm-router.js +62 -27
- package/dist/cli/handlers/brain-handler.js +2 -0
- package/dist/cli/handlers/status-handler.js +18 -2
- 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 +607 -443
- 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/billing-modes.d.ts +5 -0
- package/dist/shared/llm/billing-modes.js +42 -3
- package/dist/shared/llm/index.d.ts +4 -1
- package/dist/shared/llm/index.js +5 -1
- package/dist/shared/llm/interfaces.d.ts +34 -3
- package/dist/shared/llm/interfaces.js +17 -0
- package/dist/shared/llm/llm-router-service.d.ts +8 -0
- package/dist/shared/llm/llm-router-service.js +21 -3
- package/dist/shared/llm/provider-manager.js +8 -1
- package/dist/shared/llm/provider-registry.d.ts +135 -0
- package/dist/shared/llm/provider-registry.js +227 -0
- package/dist/shared/llm/providers/external-cli.d.ts +129 -0
- package/dist/shared/llm/providers/external-cli.js +385 -0
- package/dist/shared/llm/router/config-store.d.ts +14 -0
- package/dist/shared/llm/router/config-store.js +102 -14
- package/dist/shared/llm/router/external-provider-config.d.ts +47 -0
- package/dist/shared/llm/router/external-provider-config.js +105 -0
- package/dist/shared/llm/router/types.d.ts +50 -4
- package/dist/shared/llm/router/types.js +10 -0
- package/dist/shared/llm/translation/message-formatter.js +7 -1
- 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 +12 -3
- package/dist/cli/chunks/adapter-YBSKQFQ4.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-3H7DRDD4.js +0 -2
- package/dist/cli/chunks/base-ZTD6PFD7.js +0 -2
- package/dist/cli/chunks/brain-handler-FV2AJZ4A.js +0 -89
- package/dist/cli/chunks/browser-workflow-GKWDM25H.js +0 -2
- package/dist/cli/chunks/chunk-2CBEQV6R.js +0 -2
- package/dist/cli/chunks/chunk-4ZQOJ7Q2.js +0 -2
- package/dist/cli/chunks/chunk-CYQRZ645.js +0 -2
- package/dist/cli/chunks/chunk-FXKOHZBN.js +0 -2
- package/dist/cli/chunks/chunk-GJTGHVAX.js +0 -65
- package/dist/cli/chunks/chunk-GP5QBJVO.js +0 -3
- package/dist/cli/chunks/chunk-JGXP67BP.js +0 -2
- package/dist/cli/chunks/chunk-SW56PB22.js +0 -2
- package/dist/cli/chunks/chunk-T5M4TZRB.js +0 -12
- package/dist/cli/chunks/chunk-UDSNWQQI.js +0 -2
- package/dist/cli/chunks/chunk-VC77SDNH.js +0 -9
- package/dist/cli/chunks/chunk-WRMJWQUI.js +0 -12
- package/dist/cli/chunks/chunk-YXUFGDGS.js +0 -2
- package/dist/cli/chunks/client-4Q5JE7RY.js +0 -2
- package/dist/cli/chunks/core-handlers-4GKEYGPS.js +0 -2
- package/dist/cli/chunks/cross-domain-router-PBJ2ZGPJ.js +0 -2
- package/dist/cli/chunks/dream-4EXVFHUJ.js +0 -2
- package/dist/cli/chunks/embed-and-insert-pattern-COAZZGS6.js +0 -3
- package/dist/cli/chunks/heartbeat-scheduler-UNEYR3WR.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-JQG66H4L.js +0 -2
- package/dist/cli/chunks/hnsw-index-2NOROILM.js +0 -2
- package/dist/cli/chunks/hybrid-router-FXTAJATE.js +0 -2
- package/dist/cli/chunks/impact-analyzer-VHZSBWMT.js +0 -2
- package/dist/cli/chunks/init-wizard-EML4OET2.js +0 -2
- package/dist/cli/chunks/kernel-TMRJOEO2.js +0 -2
- package/dist/cli/chunks/knowledge-graph-FMKVCMJQ.js +0 -2
- package/dist/cli/chunks/learning-II2U3EV2.js +0 -119
- package/dist/cli/chunks/llm-router-WC66OXZH.js +0 -36
- package/dist/cli/chunks/llm-router-service-GOSVGMKM.js +0 -2
- package/dist/cli/chunks/load-test-WIRGDZIA.js +0 -2
- package/dist/cli/chunks/memory-backend-XBBIXDZU.js +0 -2
- package/dist/cli/chunks/memory-handlers-SQHNK3DK.js +0 -2
- package/dist/cli/chunks/pattern-null-store-PFLKHRVU.js +0 -2
- package/dist/cli/chunks/protocol-executor-GAMNY2JB.js +0 -2
- package/dist/cli/chunks/provider-manager-VTIG5AKU.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-KAX63PXV.js +0 -2
- package/dist/cli/chunks/queen-coordinator-UYW2MDKI.js +0 -2
- package/dist/cli/chunks/real-embeddings-HHR75AR5.js +0 -2
- package/dist/cli/chunks/router-NVDU7IIA.js +0 -2
- package/dist/cli/chunks/routing-feedback-KHR3J2J3.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-43L75WLF.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-Y5OVCYTO.js +0 -2
- package/dist/cli/chunks/rvf-migration-coordinator-NEPDFB3N.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-PQ4IOTZU.js +0 -2
- package/dist/cli/chunks/safe-db-QHSFV63M.js +0 -2
- package/dist/cli/chunks/schedule-JGZFHJGM.js +0 -2
- package/dist/cli/chunks/scheduler-NGCDQIW5.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-3JSNWL6I.js +0 -2
- package/dist/cli/chunks/status-handler-CTXOH3FX.js +0 -47
- package/dist/cli/chunks/token-bootstrap-3P22AYZ4.js +0 -2
- package/dist/cli/chunks/unified-memory-4VO5KSHP.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-ZR2FZXOB.js +0 -2
- package/dist/cli/chunks/unified-persistence-VFPW5MFM.js +0 -2
- package/dist/cli/chunks/visual-security-SNADRUPR.js +0 -2
- package/dist/cli/chunks/witness-chain-2TXUTEJE.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-ON6UYRVE.js +0 -2
|
@@ -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
|
/**
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { cosineSimilarity } from '../shared/utils/vector-math.js';
|
|
9
9
|
import { type EndpointIdentity } from './embedder-endpoint-client.js';
|
|
10
|
+
import { type EmbeddingSpaceIdentity } from './embedding-space.js';
|
|
10
11
|
/**
|
|
11
12
|
* Embedding model configuration
|
|
12
13
|
*/
|
|
@@ -83,4 +84,6 @@ export declare function isUsingEndpoint(): boolean;
|
|
|
83
84
|
* ADR-097: Returns the endpoint identity fingerprint, or null when not using an endpoint.
|
|
84
85
|
*/
|
|
85
86
|
export declare function getEndpointIdentity(): EndpointIdentity | null;
|
|
87
|
+
/** Runtime-backed identity of the initialized embedding space. */
|
|
88
|
+
export declare function getActiveEmbeddingSpaceIdentity(): EmbeddingSpaceIdentity | null;
|
|
86
89
|
//# sourceMappingURL=real-embeddings.d.ts.map
|
|
@@ -10,6 +10,7 @@ export { cosineSimilarity } from '../shared/utils/vector-math.js';
|
|
|
10
10
|
import { toErrorMessage } from '../shared/error-utils.js';
|
|
11
11
|
import { EmbedderEndpointClient, redactEndpoint, } from './embedder-endpoint-client.js';
|
|
12
12
|
import { loadEmbedderIdentity, resetEmbedderIdentityStore, saveEmbedderIdentity, } from './embedder-identity-store.js';
|
|
13
|
+
import { EMBEDDING_SPACE_CANARY, deriveEmbeddingSpaceIdentity, fingerprintEmbeddingRuntime, } from './embedding-space.js';
|
|
13
14
|
// Lazy-loaded transformer pipeline
|
|
14
15
|
let pipeline = null;
|
|
15
16
|
let embeddingModel = null;
|
|
@@ -22,6 +23,7 @@ let failureReason = '';
|
|
|
22
23
|
*/
|
|
23
24
|
let endpointClient = null;
|
|
24
25
|
let endpointIdentity = null;
|
|
26
|
+
let activeEmbeddingSpaceIdentity = null;
|
|
25
27
|
export const DEFAULT_EMBEDDING_CONFIG = {
|
|
26
28
|
modelName: 'Xenova/all-MiniLM-L6-v2',
|
|
27
29
|
quantized: true,
|
|
@@ -100,6 +102,16 @@ async function initializeModel(config = {}) {
|
|
|
100
102
|
});
|
|
101
103
|
// Probe + identity fingerprint. Fails loud on dim mismatch.
|
|
102
104
|
endpointIdentity = await endpointClient.probe();
|
|
105
|
+
activeEmbeddingSpaceIdentity = deriveEmbeddingSpaceIdentity({
|
|
106
|
+
provider: 'openai-compatible-endpoint',
|
|
107
|
+
model: fullConfig.modelName,
|
|
108
|
+
dimensions: endpointIdentity.dim,
|
|
109
|
+
pooling: 'mean',
|
|
110
|
+
normalized: true,
|
|
111
|
+
preprocessingVersion: 'aqe-text-v1',
|
|
112
|
+
implementation: endpointIdentity.endpoint,
|
|
113
|
+
runtimeFingerprint: endpointIdentity.fingerprint,
|
|
114
|
+
});
|
|
103
115
|
console.log(`[RealEmbeddings] Endpoint identity: dim=${endpointIdentity.dim} fingerprint=${endpointIdentity.fingerprint}`);
|
|
104
116
|
// Cross-run drift detection: compare against the last-known identity
|
|
105
117
|
// for this endpoint (memory.db kv_store, namespace _system). If the
|
|
@@ -136,9 +148,11 @@ async function initializeModel(config = {}) {
|
|
|
136
148
|
}
|
|
137
149
|
catch {
|
|
138
150
|
throw new Error('In-process embeddings require the optional package "@huggingface/transformers", ' +
|
|
139
|
-
'which is not installed.
|
|
140
|
-
'
|
|
141
|
-
'
|
|
151
|
+
'which is not installed. Configure an embedding endpoint ' +
|
|
152
|
+
'(EmbeddingConfig.endpoint / AQE_EMBEDDER_ENDPOINT) so no local model is loaded. ' +
|
|
153
|
+
'Installing @huggingface/transformers@4.2.0 is an explicit security opt-in: ' +
|
|
154
|
+
'its compatible dependency chain currently has unresolved HIGH advisories ' +
|
|
155
|
+
'GHSA-xcpc-8h2w-3j85 and GHSA-f88m-g3jw-g9cj.');
|
|
142
156
|
}
|
|
143
157
|
pipeline = transformers.pipeline;
|
|
144
158
|
console.log(`[RealEmbeddings] Loading model: ${fullConfig.modelName}`);
|
|
@@ -147,6 +161,24 @@ async function initializeModel(config = {}) {
|
|
|
147
161
|
embeddingModel = await pipeline('feature-extraction', fullConfig.modelName, {
|
|
148
162
|
quantized: fullConfig.quantized,
|
|
149
163
|
});
|
|
164
|
+
const initializedModel = embeddingModel;
|
|
165
|
+
if (!initializedModel)
|
|
166
|
+
throw new Error('Transformer pipeline returned no embedding model');
|
|
167
|
+
const canary = await initializedModel(EMBEDDING_SPACE_CANARY, {
|
|
168
|
+
pooling: 'mean',
|
|
169
|
+
normalize: true,
|
|
170
|
+
});
|
|
171
|
+
const canaryVector = Array.from(canary.data);
|
|
172
|
+
activeEmbeddingSpaceIdentity = deriveEmbeddingSpaceIdentity({
|
|
173
|
+
provider: 'huggingface-transformers',
|
|
174
|
+
model: fullConfig.modelName,
|
|
175
|
+
dimensions: canaryVector.length,
|
|
176
|
+
pooling: 'mean',
|
|
177
|
+
normalized: true,
|
|
178
|
+
preprocessingVersion: 'aqe-text-v1',
|
|
179
|
+
implementation: `transformers:${fullConfig.quantized ? 'quantized' : 'full'}`,
|
|
180
|
+
runtimeFingerprint: fingerprintEmbeddingRuntime(canaryVector),
|
|
181
|
+
});
|
|
150
182
|
const loadTime = performance.now() - startTime;
|
|
151
183
|
console.log(`[RealEmbeddings] Model loaded in ${loadTime.toFixed(0)}ms`);
|
|
152
184
|
}
|
|
@@ -356,6 +388,7 @@ export function resetInitialization() {
|
|
|
356
388
|
}
|
|
357
389
|
endpointClient = null;
|
|
358
390
|
endpointIdentity = null;
|
|
391
|
+
activeEmbeddingSpaceIdentity = null;
|
|
359
392
|
// Drop the identity-store's cached DB connection so tests that flip cwd or
|
|
360
393
|
// AQE_MEMORY_PATH between runs don't write into a stale handle.
|
|
361
394
|
resetEmbedderIdentityStore();
|
|
@@ -373,4 +406,8 @@ export function isUsingEndpoint() {
|
|
|
373
406
|
export function getEndpointIdentity() {
|
|
374
407
|
return endpointIdentity;
|
|
375
408
|
}
|
|
409
|
+
/** Runtime-backed identity of the initialized embedding space. */
|
|
410
|
+
export function getActiveEmbeddingSpaceIdentity() {
|
|
411
|
+
return activeEmbeddingSpaceIdentity;
|
|
412
|
+
}
|
|
376
413
|
//# sourceMappingURL=real-embeddings.js.map
|
|
@@ -19,8 +19,9 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
19
19
|
import { LoggerFactory } from '../logging/index.js';
|
|
20
20
|
import { toError, toErrorMessage } from '../shared/error-utils.js';
|
|
21
21
|
import { maybeEnhanceRoutingWithPatterns } from './pattern-routing-guidance.js';
|
|
22
|
+
import { EMBEDDING_SPACE_CANARY } from './embedding-space.js';
|
|
22
23
|
const logger = LoggerFactory.create('RealQEReasoningBank');
|
|
23
|
-
import { computeRealEmbedding, isTransformerAvailable, getEmbeddingDimension, clearEmbeddingCache, } from './real-embeddings.js';
|
|
24
|
+
import { computeRealEmbedding, isTransformerAvailable, getEmbeddingDimension, clearEmbeddingCache, getActiveEmbeddingSpaceIdentity, } from './real-embeddings.js';
|
|
24
25
|
import { createSQLitePatternStore, } from './sqlite-persistence.js';
|
|
25
26
|
import { detectQEDomain, detectQEDomains, mapQEDomainToAQE, QE_DOMAIN_LIST, shouldPromotePattern, } from './qe-patterns.js';
|
|
26
27
|
import { getGuidance, getCombinedGuidance, generateGuidanceContext, checkAntiPatterns, } from './qe-guidance.js';
|
|
@@ -164,6 +165,8 @@ export class RealQEReasoningBank {
|
|
|
164
165
|
// Initialize SQLite persistence
|
|
165
166
|
await this.sqliteStore.initialize();
|
|
166
167
|
logger.info('SQLite persistence initialized');
|
|
168
|
+
// Establish executable provenance before any persisted vectors enter ANN.
|
|
169
|
+
await computeRealEmbedding(EMBEDDING_SPACE_CANARY, this.qeConfig.embeddings);
|
|
167
170
|
// Initialize HNSW index
|
|
168
171
|
await this.initializeHNSW();
|
|
169
172
|
logger.info('HNSW index initialized');
|
|
@@ -228,9 +231,10 @@ export class RealQEReasoningBank {
|
|
|
228
231
|
const expectedDim = getEmbeddingDimension();
|
|
229
232
|
let loaded = 0;
|
|
230
233
|
let skipped = 0;
|
|
231
|
-
|
|
234
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId;
|
|
235
|
+
for (const { patternId, embedding, spaceId } of embeddings) {
|
|
232
236
|
// Skip invalid or corrupted embeddings
|
|
233
|
-
if (!embedding || !Array.isArray(embedding) || embedding.length !== expectedDim) {
|
|
237
|
+
if (!activeSpaceId || spaceId !== activeSpaceId || !embedding || !Array.isArray(embedding) || embedding.length !== expectedDim) {
|
|
234
238
|
skipped++;
|
|
235
239
|
continue;
|
|
236
240
|
}
|
|
@@ -33,6 +33,8 @@ export interface MigrationOptions {
|
|
|
33
33
|
dimension?: number;
|
|
34
34
|
/** Log progress every N patterns (default: 1000) */
|
|
35
35
|
progressInterval?: number;
|
|
36
|
+
/** Runtime embedding space that the destination RVF index is bound to. */
|
|
37
|
+
embeddingSpaceId?: string;
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
40
|
* Migrate pattern embeddings from SQLite to an RVF file.
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @module learning/rvf-pattern-migration
|
|
14
14
|
*/
|
|
15
|
+
import { getActiveEmbeddingSpaceIdentity } from './real-embeddings.js';
|
|
15
16
|
// ============================================================================
|
|
16
17
|
// Migration Function
|
|
17
18
|
// ============================================================================
|
|
@@ -52,10 +53,11 @@ export function migratePatterns(sqliteStore, rvfAdapter, options = {}) {
|
|
|
52
53
|
console.log(`[RVF Migration] Found ${allEmbeddings.length} embeddings to migrate (dim=${dimension})`);
|
|
53
54
|
// Process in batches
|
|
54
55
|
let batch = [];
|
|
56
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? options.embeddingSpaceId;
|
|
55
57
|
for (let i = 0; i < allEmbeddings.length; i++) {
|
|
56
|
-
const { patternId, embedding } = allEmbeddings[i];
|
|
57
|
-
//
|
|
58
|
-
if (embedding.length !== dimension) {
|
|
58
|
+
const { patternId, embedding, spaceId } = allEmbeddings[i];
|
|
59
|
+
// Never mix unknown or incompatible spaces in an ANN file.
|
|
60
|
+
if (!activeSpaceId || spaceId !== activeSpaceId || embedding.length !== dimension) {
|
|
59
61
|
result.totalSkipped++;
|
|
60
62
|
continue;
|
|
61
63
|
}
|
|
@@ -22,6 +22,8 @@ export interface RvfPatternStoreConfig {
|
|
|
22
22
|
base: PatternStoreConfig;
|
|
23
23
|
/** When true, dispose() will not close the adapter (shared singleton) */
|
|
24
24
|
skipCloseOnDispose?: boolean;
|
|
25
|
+
/** Runtime provenance for an injected embedder. */
|
|
26
|
+
embeddingSpaceId?: string;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Pattern store backed by @ruvector/rvf-node for persistent HNSW.
|
|
@@ -34,6 +36,7 @@ export declare class RvfPatternStore implements IPatternStore {
|
|
|
34
36
|
private readonly config;
|
|
35
37
|
private readonly rvfPath;
|
|
36
38
|
private readonly skipCloseOnDispose;
|
|
39
|
+
private readonly embeddingSpaceId?;
|
|
37
40
|
private adapter;
|
|
38
41
|
private sqliteStore;
|
|
39
42
|
private initialized;
|
|
@@ -16,6 +16,8 @@ import { ok, err } from '../shared/types/index.js';
|
|
|
16
16
|
import { toErrorMessage } from '../shared/error-utils.js';
|
|
17
17
|
import { calculateQualityScore, validateQEPattern, mapQEDomainToAQE, PROMOTION_THRESHOLD, } from './qe-patterns.js';
|
|
18
18
|
import { DEFAULT_PATTERN_STORE_CONFIG } from './pattern-store.js';
|
|
19
|
+
import { getActiveEmbeddingSpaceIdentity } from './real-embeddings.js';
|
|
20
|
+
import { verifyOrCreateEmbeddingSpaceManifest } from './embedding-space.js';
|
|
19
21
|
// ============================================================================
|
|
20
22
|
// RVF Pattern Store Implementation
|
|
21
23
|
// ============================================================================
|
|
@@ -30,6 +32,7 @@ export class RvfPatternStore {
|
|
|
30
32
|
config;
|
|
31
33
|
rvfPath;
|
|
32
34
|
skipCloseOnDispose;
|
|
35
|
+
embeddingSpaceId;
|
|
33
36
|
adapter = null;
|
|
34
37
|
sqliteStore = null;
|
|
35
38
|
initialized = false;
|
|
@@ -41,6 +44,7 @@ export class RvfPatternStore {
|
|
|
41
44
|
this.config = config?.base ?? DEFAULT_PATTERN_STORE_CONFIG;
|
|
42
45
|
this.rvfPath = config?.rvfPath ?? '.agentic-qe/patterns.rvf';
|
|
43
46
|
this.skipCloseOnDispose = config?.skipCloseOnDispose ?? false;
|
|
47
|
+
this.embeddingSpaceId = config?.embeddingSpaceId;
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* Attach SQLite persistence for metadata (pattern fields, FTS5).
|
|
@@ -69,6 +73,8 @@ export class RvfPatternStore {
|
|
|
69
73
|
}
|
|
70
74
|
try {
|
|
71
75
|
this.adapter = this.createAdapter(this.rvfPath, this.config.embeddingDimension);
|
|
76
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.embeddingSpaceId ?? null;
|
|
77
|
+
verifyOrCreateEmbeddingSpaceManifest(this.rvfPath, activeSpaceId, this.adapter.status()?.totalVectors ?? 0);
|
|
72
78
|
this.initialized = true;
|
|
73
79
|
console.log(`[RvfPatternStore] Initialized: ${this.rvfPath} (dim=${this.config.embeddingDimension})`);
|
|
74
80
|
}
|
|
@@ -77,6 +83,10 @@ export class RvfPatternStore {
|
|
|
77
83
|
// so they need to know RVF is not working. Log a clear error, set
|
|
78
84
|
// adapter to null, and mark nativeAvailable=false in stats.
|
|
79
85
|
this.rvfInitError = toErrorMessage(error);
|
|
86
|
+
try {
|
|
87
|
+
this.adapter?.close();
|
|
88
|
+
}
|
|
89
|
+
catch { /* best effort */ }
|
|
80
90
|
console.error(`[RvfPatternStore] ERROR: RVF native init failed — vector search is DISABLED. ` +
|
|
81
91
|
`Cause: ${this.rvfInitError}. ` +
|
|
82
92
|
`Fix: install @ruvector/rvf-node native bindings, or set useRVFPatternStore=false to use SQLite HNSW.`);
|
|
@@ -162,6 +172,10 @@ export class RvfPatternStore {
|
|
|
162
172
|
if (pattern.confidence < this.config.minConfidence) {
|
|
163
173
|
return err(new Error(`Pattern confidence ${pattern.confidence} below threshold ${this.config.minConfidence}`));
|
|
164
174
|
}
|
|
175
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.embeddingSpaceId;
|
|
176
|
+
if (pattern.embedding && !activeSpaceId) {
|
|
177
|
+
return err(new Error('VECTOR_SPACE_UNVERIFIED: refusing to persist or index an embedding without runtime provenance'));
|
|
178
|
+
}
|
|
165
179
|
// Persist metadata to SQLite. #447: capture the returned id — ON CONFLICT
|
|
166
180
|
// on (name, qe_domain, pattern_type) preserves the existing row's id, so
|
|
167
181
|
// we must align pattern.id with what's actually stored before ingesting
|
|
@@ -169,7 +183,7 @@ export class RvfPatternStore {
|
|
|
169
183
|
// with "Pattern not found" and qe_pattern_usage stays empty).
|
|
170
184
|
if (this.sqliteStore) {
|
|
171
185
|
try {
|
|
172
|
-
const actualId = this.sqliteStore.storePattern(pattern, pattern.embedding);
|
|
186
|
+
const actualId = this.sqliteStore.storePattern(pattern, pattern.embedding, activeSpaceId);
|
|
173
187
|
if (actualId && actualId !== pattern.id) {
|
|
174
188
|
// QEPattern.id is `readonly` for callers, but inside the store
|
|
175
189
|
// we own the lifecycle and must align it with the persisted row
|
|
@@ -245,6 +259,12 @@ export class RvfPatternStore {
|
|
|
245
259
|
const startTime = performance.now();
|
|
246
260
|
const limit = options.limit ?? 10;
|
|
247
261
|
const results = [];
|
|
262
|
+
if (Array.isArray(query)) {
|
|
263
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? this.embeddingSpaceId;
|
|
264
|
+
if (!activeSpaceId || options.embeddingSpaceId !== activeSpaceId) {
|
|
265
|
+
return err(new Error('VECTOR_SPACE_UNVERIFIED: pre-computed query vectors require the active embeddingSpaceId'));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
248
268
|
// Vector search via RVF native HNSW
|
|
249
269
|
if (Array.isArray(query) && this.adapter) {
|
|
250
270
|
try {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { type Database as DatabaseType } from 'better-sqlite3';
|
|
15
15
|
import type { QEPattern, QEDomain } from './qe-patterns.js';
|
|
16
|
+
import { type EmbeddingSpaceDiagnostics } from './embedding-space.js';
|
|
16
17
|
/**
|
|
17
18
|
* SQLite persistence configuration
|
|
18
19
|
*/
|
|
@@ -71,11 +72,12 @@ export declare class SQLitePatternStore {
|
|
|
71
72
|
/**
|
|
72
73
|
* Prepare commonly used statements
|
|
73
74
|
*/
|
|
75
|
+
private ensureEmbeddingSpaceSchema;
|
|
74
76
|
private prepareStatements;
|
|
75
77
|
/**
|
|
76
78
|
* Store a pattern
|
|
77
79
|
*/
|
|
78
|
-
storePattern(pattern: QEPattern, embedding?: number[]): string;
|
|
80
|
+
storePattern(pattern: QEPattern, embedding?: number[], embeddingSpaceId?: string): string;
|
|
79
81
|
/**
|
|
80
82
|
* Get a pattern by ID
|
|
81
83
|
*/
|
|
@@ -113,6 +115,7 @@ export declare class SQLitePatternStore {
|
|
|
113
115
|
getAllEmbeddings(): Array<{
|
|
114
116
|
patternId: string;
|
|
115
117
|
embedding: number[];
|
|
118
|
+
spaceId: string | null;
|
|
116
119
|
}>;
|
|
117
120
|
/**
|
|
118
121
|
* Get up to `limit` embeddings, most-recently-used first.
|
|
@@ -124,7 +127,9 @@ export declare class SQLitePatternStore {
|
|
|
124
127
|
getRecentEmbeddings(limit: number): Array<{
|
|
125
128
|
patternId: string;
|
|
126
129
|
embedding: number[];
|
|
130
|
+
spaceId: string | null;
|
|
127
131
|
}>;
|
|
132
|
+
getEmbeddingSpaceDiagnostics(activeSpaceId?: string | null): EmbeddingSpaceDiagnostics;
|
|
128
133
|
/**
|
|
129
134
|
* Record pattern usage.
|
|
130
135
|
*
|
|
@@ -191,7 +196,7 @@ export declare class SQLitePatternStore {
|
|
|
191
196
|
/**
|
|
192
197
|
* Store embedding for an existing pattern
|
|
193
198
|
*/
|
|
194
|
-
storePatternEmbedding(patternId: string, embedding: number[]): void;
|
|
199
|
+
storePatternEmbedding(patternId: string, embedding: number[], embeddingSpaceId?: string): void;
|
|
195
200
|
/**
|
|
196
201
|
* Record pattern reuse for metrics tracking (Phase 5.4)
|
|
197
202
|
*
|