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
|
@@ -110,6 +110,25 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
|
|
|
110
110
|
? domainFilterForColumn(options.domains, config.domainColumn)
|
|
111
111
|
: [undefined, []];
|
|
112
112
|
let rows = queryAll(db, config.tableName, where, params);
|
|
113
|
+
if (options.domains && options.domains.length > 0) {
|
|
114
|
+
const manifestIds = new Set((allTableData.learning_evidence_manifests ?? []).map(row => row.id));
|
|
115
|
+
const patternIds = new Set((allTableData.qe_patterns ?? []).map(row => row.id));
|
|
116
|
+
if (['learning_evidence_segments', 'learning_segment_edges', 'learning_evidence_admissions'].includes(config.tableName)) {
|
|
117
|
+
rows = rows.filter(row => manifestIds.has(row.manifest_id));
|
|
118
|
+
}
|
|
119
|
+
else if (config.tableName === 'pattern_manifest_lineage') {
|
|
120
|
+
rows = rows.filter(row => {
|
|
121
|
+
const lineage = row;
|
|
122
|
+
return manifestIds.has(lineage.manifest_id) && patternIds.has(lineage.pattern_id);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
else if (config.tableName === 'pattern_segment_lineage') {
|
|
126
|
+
rows = rows.filter(row => {
|
|
127
|
+
const lineage = row;
|
|
128
|
+
return manifestIds.has(lineage.manifest_id) && patternIds.has(lineage.pattern_id);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
113
132
|
if (config.tableName === 'qe_patterns') {
|
|
114
133
|
for (const p of rows) {
|
|
115
134
|
if (p.qe_domain)
|
|
@@ -128,50 +147,28 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
|
|
|
128
147
|
let embeddingCount = 0;
|
|
129
148
|
const embeddingEntries = [];
|
|
130
149
|
if (tableExists(db, 'qe_pattern_embeddings')) {
|
|
131
|
-
const
|
|
150
|
+
const hasSpaceId = db.prepare("PRAGMA table_info('qe_pattern_embeddings')").all()
|
|
151
|
+
.some((column) => column.name === 'space_id');
|
|
152
|
+
const rows = db.prepare(`SELECT pattern_id, embedding, dimension, ${hasSpaceId ? 'space_id' : 'NULL'} AS space_id
|
|
153
|
+
FROM qe_pattern_embeddings`).all();
|
|
132
154
|
for (const row of rows) {
|
|
133
|
-
|
|
155
|
+
// Legacy vectors without executable provenance remain in the embedded
|
|
156
|
+
// SQLite kernel for re-embedding, but must never enter the portable ANN
|
|
157
|
+
// index where their space would be indistinguishable from query vectors.
|
|
158
|
+
if (row.embedding && row.dimension === dimension && row.space_id) {
|
|
134
159
|
embeddingEntries.push({
|
|
135
160
|
id: `pe:${row.pattern_id}`,
|
|
136
161
|
vector: new Float32Array(row.embedding.buffer, row.embedding.byteOffset, dimension),
|
|
137
|
-
metadata: { tableName: 'qe_pattern_embeddings' },
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (tableExists(db, 'captured_experiences')) {
|
|
143
|
-
const rows = db.prepare('SELECT id, embedding, embedding_dimension, domain, quality FROM captured_experiences WHERE embedding IS NOT NULL').all();
|
|
144
|
-
for (const row of rows) {
|
|
145
|
-
if (row.embedding_dimension === dimension) {
|
|
146
|
-
embeddingEntries.push({
|
|
147
|
-
id: `exp:${row.id}`,
|
|
148
|
-
vector: new Float32Array(row.embedding.buffer, row.embedding.byteOffset, dimension),
|
|
149
|
-
metadata: {
|
|
150
|
-
tableName: 'captured_experiences',
|
|
151
|
-
domain: row.domain,
|
|
152
|
-
confidence: row.quality,
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (tableExists(db, 'sona_patterns')) {
|
|
159
|
-
const rows = db.prepare('SELECT id, state_embedding, domain, confidence FROM sona_patterns WHERE state_embedding IS NOT NULL').all();
|
|
160
|
-
for (const row of rows) {
|
|
161
|
-
const dim = row.state_embedding.byteLength / 4;
|
|
162
|
-
if (dim === dimension) {
|
|
163
|
-
embeddingEntries.push({
|
|
164
|
-
id: `sona:${row.id}`,
|
|
165
|
-
vector: new Float32Array(row.state_embedding.buffer, row.state_embedding.byteOffset, dimension),
|
|
166
|
-
metadata: {
|
|
167
|
-
tableName: 'sona_patterns',
|
|
168
|
-
domain: row.domain,
|
|
169
|
-
confidence: row.confidence,
|
|
170
|
-
},
|
|
162
|
+
metadata: { tableName: 'qe_pattern_embeddings', spaceId: row.space_id },
|
|
171
163
|
});
|
|
172
164
|
}
|
|
173
165
|
}
|
|
174
166
|
}
|
|
167
|
+
// captured_experiences and sona_patterns are still included in the kernel
|
|
168
|
+
// below, but their schemas do not yet carry embedding-space provenance.
|
|
169
|
+
// Mixing them into this ANN index would violate #633 even when dimensions
|
|
170
|
+
// and model labels happen to match, so they are intentionally excluded
|
|
171
|
+
// until their own write paths persist a space_id.
|
|
175
172
|
if (embeddingEntries.length > 0) {
|
|
176
173
|
const result = rvf.ingest(embeddingEntries);
|
|
177
174
|
embeddingCount = result.accepted;
|
|
@@ -210,6 +207,7 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
|
|
|
210
207
|
dreamInsightCount: (allTableData['dream_insights'] || []).length,
|
|
211
208
|
witnessChainLength: (allTableData['witness_chain'] || []).length,
|
|
212
209
|
totalRecords,
|
|
210
|
+
tableCounts: Object.fromEntries(TABLE_CONFIGS.map(({ tableName }) => [tableName, allTableData[tableName]?.length ?? 0])),
|
|
213
211
|
},
|
|
214
212
|
domains: brainData.domains,
|
|
215
213
|
checksum,
|
|
@@ -235,6 +233,53 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
|
|
|
235
233
|
// sidecar, so renaming any earlier would publish an incomplete store.
|
|
236
234
|
rvf.close();
|
|
237
235
|
closed = true;
|
|
236
|
+
// Issue #629: a stage-2 mirror must not be destroyed when SQLite has just
|
|
237
|
+
// been recreated from seed data. Compare every mirrored table in the fully
|
|
238
|
+
// materialized candidate with the still-published store immediately before
|
|
239
|
+
// promotion. Inspection is fail-closed when the RVF itself remains readable
|
|
240
|
+
// but its kernel cannot yield a complete table inventory. A genuinely
|
|
241
|
+
// unreadable/corrupt RVF remains replaceable to preserve #563 recovery.
|
|
242
|
+
if (existsSync(outPath) && !options.allowOverwriteRicher) {
|
|
243
|
+
let existing;
|
|
244
|
+
try {
|
|
245
|
+
existing = brainInfoFromRvf(outPath);
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
if (hasReadableBrainKernel(outPath) || !isKnownUnusableRvfError(error)) {
|
|
249
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
250
|
+
throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: the existing mirror is readable but its ` +
|
|
251
|
+
`richness could not be established (${detail}). Preserve/import it before retrying, ` +
|
|
252
|
+
`or repeat with --force-overwrite-richer after preserving a backup.`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (existing) {
|
|
256
|
+
const existingCounts = existing.stats.tableCounts;
|
|
257
|
+
const candidateCounts = manifest.stats.tableCounts;
|
|
258
|
+
const missing = TABLE_CONFIGS
|
|
259
|
+
.map(({ tableName }) => tableName)
|
|
260
|
+
.filter((tableName) => !existingCounts || !Number.isSafeInteger(existingCounts[tableName]));
|
|
261
|
+
if (missing.length > 0) {
|
|
262
|
+
throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: existing mirror lacks trustworthy counts for ` +
|
|
263
|
+
`${missing.join(', ')}. Preserve/import it before retrying, or repeat with ` +
|
|
264
|
+
`--force-overwrite-richer after preserving a backup.`);
|
|
265
|
+
}
|
|
266
|
+
const richer = TABLE_CONFIGS
|
|
267
|
+
.map(({ tableName }) => ({
|
|
268
|
+
tableName,
|
|
269
|
+
existing: existingCounts[tableName],
|
|
270
|
+
candidate: candidateCounts[tableName],
|
|
271
|
+
}))
|
|
272
|
+
.filter(({ existing: existingCount, candidate }) => existingCount > candidate);
|
|
273
|
+
if (richer.length > 0) {
|
|
274
|
+
const differences = richer
|
|
275
|
+
.map(({ tableName, existing: existingCount, candidate }) => `${tableName} ${existingCount} -> ${candidate}`)
|
|
276
|
+
.join(', ');
|
|
277
|
+
throw new Error(`RVF_MIRROR_RICHER: refusing to replace richer mirrored tables: ${differences}. ` +
|
|
278
|
+
`Restore/import the mirror first, or repeat with --force-overwrite-richer after ` +
|
|
279
|
+
`preserving a backup.`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
238
283
|
// Promote tmp → final. The store itself goes last: until it lands, the
|
|
239
284
|
// previous store (if any) is still the one on disk, and a crash mid-promote
|
|
240
285
|
// leaves the old store readable rather than a half-written new one.
|
|
@@ -263,6 +308,36 @@ export function exportBrainToRvf(db, options, sourceDbLabel = 'memory.db') {
|
|
|
263
308
|
throw err;
|
|
264
309
|
}
|
|
265
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Distinguish a corrupt/unopenable store (#563, replaceable) from a readable
|
|
313
|
+
* store whose richness inspection failed (ambiguous, therefore protected).
|
|
314
|
+
*/
|
|
315
|
+
function hasReadableBrainKernel(rvfPath) {
|
|
316
|
+
let rvf;
|
|
317
|
+
try {
|
|
318
|
+
rvf = openRvfStoreReadonly(resolve(rvfPath));
|
|
319
|
+
const kernel = rvf.extractKernel();
|
|
320
|
+
return Boolean(kernel?.image);
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
finally {
|
|
326
|
+
try {
|
|
327
|
+
rvf?.close();
|
|
328
|
+
}
|
|
329
|
+
catch { /* best-effort probe cleanup */ }
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Only known structural corruption is replaceable without an operator
|
|
334
|
+
* override. Permission, locking, I/O, and programmer errors are ambiguous and
|
|
335
|
+
* must fail closed instead of being mistaken for disposable corruption.
|
|
336
|
+
*/
|
|
337
|
+
function isKnownUnusableRvfError(error) {
|
|
338
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
339
|
+
return /ManifestNotFound|InvalidMagic|ChecksumMismatch|CorruptStore/i.test(message);
|
|
340
|
+
}
|
|
266
341
|
/** Legacy field-to-table mapping for older RVF exports. */
|
|
267
342
|
const LEGACY_FIELD_MAP = {
|
|
268
343
|
patterns: 'qe_patterns',
|
|
@@ -359,7 +434,7 @@ export function importBrainFromRvf(db, rvfPath, options) {
|
|
|
359
434
|
for (const row of rows) {
|
|
360
435
|
let result;
|
|
361
436
|
if (config.dedupColumns && config.dedupColumns.length > 0) {
|
|
362
|
-
result = mergeAppendOnlyRow(db, config.tableName, row, config.dedupColumns);
|
|
437
|
+
result = mergeAppendOnlyRow(db, config.tableName, row, config.dedupColumns, config.preserveId);
|
|
363
438
|
}
|
|
364
439
|
else {
|
|
365
440
|
const idCol = PK_COLUMNS[config.tableName] || 'id';
|
|
@@ -418,6 +493,11 @@ export function brainInfoFromRvf(rvfPath) {
|
|
|
418
493
|
const qValueCount = t ? (t['rl_q_values']?.length ?? 0) : (brainData.qValues?.length ?? 0);
|
|
419
494
|
const dreamInsightCount = t ? (t['dream_insights']?.length ?? 0) : (brainData.dreamInsights?.length ?? 0);
|
|
420
495
|
const witnessChainLength = t ? (t['witness_chain']?.length ?? 0) : (brainData.witnessChain?.length ?? 0);
|
|
496
|
+
const tableCounts = t && typeof t === 'object' && !Array.isArray(t)
|
|
497
|
+
? Object.fromEntries(Object.entries(t)
|
|
498
|
+
.filter((entry) => Array.isArray(entry[1]))
|
|
499
|
+
.map(([tableName, rows]) => [tableName, rows.length]))
|
|
500
|
+
: undefined;
|
|
421
501
|
return {
|
|
422
502
|
version: '3.0',
|
|
423
503
|
format: 'rvf',
|
|
@@ -429,6 +509,7 @@ export function brainInfoFromRvf(rvfPath) {
|
|
|
429
509
|
qValueCount,
|
|
430
510
|
dreamInsightCount,
|
|
431
511
|
witnessChainLength,
|
|
512
|
+
...(tableCounts ? { tableCounts } : {}),
|
|
432
513
|
},
|
|
433
514
|
domains: brainData.domains ?? [],
|
|
434
515
|
checksum: sha256(brainJson),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Offline, read-only filtered search over a JSONL brain export directory.
|
|
5
5
|
* Useful for exploring what a snapshot contains without importing it.
|
|
6
6
|
*
|
|
7
|
-
* Defaults to searching qe_patterns but can target any of the
|
|
7
|
+
* Defaults to searching qe_patterns but can target any of the 31 exported
|
|
8
8
|
* tables via the `table` option. Supports filters by domain, pattern_type,
|
|
9
9
|
* date range, and a substring query that matches `name` + `description`.
|
|
10
10
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Offline, read-only filtered search over a JSONL brain export directory.
|
|
5
5
|
* Useful for exploring what a snapshot contains without importing it.
|
|
6
6
|
*
|
|
7
|
-
* Defaults to searching qe_patterns but can target any of the
|
|
7
|
+
* Defaults to searching qe_patterns but can target any of the 31 exported
|
|
8
8
|
* tables via the `table` option. Supports filters by domain, pattern_type,
|
|
9
9
|
* date range, and a substring query that matches `name` + `description`.
|
|
10
10
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This module owns:
|
|
8
8
|
* - Row type interfaces (PatternRow, QValueRow, DreamInsightRow, WitnessRow)
|
|
9
9
|
* - Merge result type and merge strategy type
|
|
10
|
-
* - TABLE_CONFIGS: data-driven list of all
|
|
10
|
+
* - TABLE_CONFIGS: data-driven list of all 31 exportable tables
|
|
11
11
|
* - All 4 legacy merge functions + generic mergeGenericRow / mergeAppendOnlyRow
|
|
12
12
|
* - All SQL insert/update helpers
|
|
13
13
|
* - Utility functions (sha256, tableExists, queryAll, domainFilter, countRows)
|
|
@@ -94,6 +94,8 @@ export interface TableExportConfig {
|
|
|
94
94
|
readonly blobColumns?: readonly string[];
|
|
95
95
|
/** For tables with AUTOINCREMENT PK, specify dedup columns. */
|
|
96
96
|
readonly dedupColumns?: readonly string[];
|
|
97
|
+
/** Preserve an `id` column when a deduplicated table does not use AUTOINCREMENT. */
|
|
98
|
+
readonly preserveId?: boolean;
|
|
97
99
|
}
|
|
98
100
|
/** PK column for tables with non-standard PK names. Default is 'id'. */
|
|
99
101
|
export declare const PK_COLUMNS: Record<string, string>;
|
|
@@ -138,7 +140,7 @@ export declare function mergeGenericRow(db: Database.Database, tableName: string
|
|
|
138
140
|
* Merge for append-only tables (AUTOINCREMENT PK).
|
|
139
141
|
* Deduplicates by checking composite columns; inserts if no match found.
|
|
140
142
|
*/
|
|
141
|
-
export declare function mergeAppendOnlyRow(db: Database.Database, tableName: string, row: Record<string, unknown>, dedupColumns: readonly string[]): MergeResult;
|
|
143
|
+
export declare function mergeAppendOnlyRow(db: Database.Database, tableName: string, row: Record<string, unknown>, dedupColumns: readonly string[], preserveId?: boolean): MergeResult;
|
|
142
144
|
export declare function mergePattern(db: Database.Database, pattern: PatternRow, strategy: MergeStrategy): MergeResult;
|
|
143
145
|
export declare function mergeQValue(db: Database.Database, qv: QValueRow, strategy: MergeStrategy): MergeResult;
|
|
144
146
|
export declare function mergeDreamInsight(db: Database.Database, insight: DreamInsightRow, strategy: MergeStrategy): MergeResult;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This module owns:
|
|
8
8
|
* - Row type interfaces (PatternRow, QValueRow, DreamInsightRow, WitnessRow)
|
|
9
9
|
* - Merge result type and merge strategy type
|
|
10
|
-
* - TABLE_CONFIGS: data-driven list of all
|
|
10
|
+
* - TABLE_CONFIGS: data-driven list of all 31 exportable tables
|
|
11
11
|
* - All 4 legacy merge functions + generic mergeGenericRow / mergeAppendOnlyRow
|
|
12
12
|
* - All SQL insert/update helpers
|
|
13
13
|
* - Utility functions (sha256, tableExists, queryAll, domainFilter, countRows)
|
|
@@ -40,7 +40,7 @@ export const TIMESTAMP_COLUMNS = {
|
|
|
40
40
|
goap_actions: 'updated_at',
|
|
41
41
|
concept_edges: 'updated_at',
|
|
42
42
|
};
|
|
43
|
-
// --- TABLE_CONFIGS: All
|
|
43
|
+
// --- TABLE_CONFIGS: All 31 exportable tables in FK-aware import order ---
|
|
44
44
|
export const TABLE_CONFIGS = [
|
|
45
45
|
{ tableName: 'qe_patterns', fileName: 'patterns.jsonl', domainColumn: 'qe_domain' },
|
|
46
46
|
{ tableName: 'rl_q_values', fileName: 'q-values.jsonl', domainColumn: 'domain' },
|
|
@@ -67,6 +67,12 @@ export const TABLE_CONFIGS = [
|
|
|
67
67
|
{ tableName: 'experience_applications', fileName: 'experience-applications.jsonl' },
|
|
68
68
|
{ tableName: 'execution_results', fileName: 'execution-results.jsonl' },
|
|
69
69
|
{ tableName: 'executed_steps', fileName: 'executed-steps.jsonl' },
|
|
70
|
+
{ tableName: 'learning_evidence_manifests', fileName: 'learning-evidence-manifests.jsonl', domainColumn: 'task_family' },
|
|
71
|
+
{ tableName: 'learning_evidence_segments', fileName: 'learning-evidence-segments.jsonl', dedupColumns: ['manifest_id', 'id'], preserveId: true },
|
|
72
|
+
{ tableName: 'learning_segment_edges', fileName: 'learning-segment-edges.jsonl', dedupColumns: ['manifest_id', 'parent_segment_id', 'child_segment_id', 'edge_kind'], preserveId: true },
|
|
73
|
+
{ tableName: 'learning_evidence_admissions', fileName: 'learning-evidence-admissions.jsonl' },
|
|
74
|
+
{ tableName: 'pattern_manifest_lineage', fileName: 'pattern-manifest-lineage.jsonl', dedupColumns: ['pattern_id', 'manifest_id', 'use_kind'], preserveId: true },
|
|
75
|
+
{ tableName: 'pattern_segment_lineage', fileName: 'pattern-segment-lineage.jsonl', dedupColumns: ['pattern_id', 'manifest_id', 'segment_id', 'use_kind'], preserveId: true },
|
|
70
76
|
];
|
|
71
77
|
// --- Derived BLOB column map (from TABLE_CONFIGS) ---
|
|
72
78
|
/** Maps table names to their BLOB columns. Derived from TABLE_CONFIGS for convenience. */
|
|
@@ -249,7 +255,7 @@ export function mergeGenericRow(db, tableName, row, idColumn, strategy, timestam
|
|
|
249
255
|
* Merge for append-only tables (AUTOINCREMENT PK).
|
|
250
256
|
* Deduplicates by checking composite columns; inserts if no match found.
|
|
251
257
|
*/
|
|
252
|
-
export function mergeAppendOnlyRow(db, tableName, row, dedupColumns) {
|
|
258
|
+
export function mergeAppendOnlyRow(db, tableName, row, dedupColumns, preserveId = false) {
|
|
253
259
|
const validated = validateTableName(tableName);
|
|
254
260
|
if (!tableExists(db, validated)) {
|
|
255
261
|
dynamicInsert(db, validated, row);
|
|
@@ -263,7 +269,8 @@ export function mergeAppendOnlyRow(db, tableName, row, dedupColumns) {
|
|
|
263
269
|
}
|
|
264
270
|
// Strip AUTOINCREMENT id column before insert
|
|
265
271
|
const insertRow = { ...row };
|
|
266
|
-
|
|
272
|
+
if (!preserveId)
|
|
273
|
+
delete insertRow.id;
|
|
267
274
|
dynamicInsert(db, validated, insertRow);
|
|
268
275
|
return { imported: 1, skipped: 0, conflicts: 0 };
|
|
269
276
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Brain Table DDL Definitions
|
|
3
3
|
*
|
|
4
|
-
* Contains CREATE TABLE statements for all
|
|
4
|
+
* Contains CREATE TABLE statements for all 31 brain-exportable tables.
|
|
5
5
|
* Separated from brain-shared.ts to keep each file under 500 lines.
|
|
6
6
|
*
|
|
7
7
|
* Tables are listed in FK-aware import order:
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import Database from 'better-sqlite3';
|
|
12
12
|
/**
|
|
13
|
-
* Ensure all
|
|
13
|
+
* Ensure all 31 brain-exportable tables exist in the target database.
|
|
14
14
|
* Creates tables in FK-aware order so parent tables come before children.
|
|
15
15
|
*/
|
|
16
16
|
export declare function ensureAllBrainTables(db: Database.Database): void;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Brain Table DDL Definitions
|
|
3
3
|
*
|
|
4
|
-
* Contains CREATE TABLE statements for all
|
|
4
|
+
* Contains CREATE TABLE statements for all 31 brain-exportable tables.
|
|
5
5
|
* Separated from brain-shared.ts to keep each file under 500 lines.
|
|
6
6
|
*
|
|
7
7
|
* Tables are listed in FK-aware import order:
|
|
8
8
|
* 1. Parent tables first (qe_patterns, dream_cycles, goap_goals, etc.)
|
|
9
9
|
* 2. Child tables after their parents (trajectory_steps after qe_trajectories, etc.)
|
|
10
10
|
*/
|
|
11
|
+
import { LEARNING_EVIDENCE_SCHEMA } from '../../migrations/20260830_add_learning_evidence_tables.js';
|
|
11
12
|
/**
|
|
12
13
|
* All DDL statements for brain-exportable tables, in FK-aware creation order.
|
|
13
14
|
* Uses CREATE TABLE IF NOT EXISTS for idempotency.
|
|
@@ -53,11 +54,12 @@ const BRAIN_TABLE_DDL = [
|
|
|
53
54
|
action_data TEXT, timestamp TEXT NOT NULL, actor TEXT NOT NULL,
|
|
54
55
|
hash_algo TEXT DEFAULT 'sha256', signature TEXT, signer_key_id TEXT
|
|
55
56
|
)`,
|
|
56
|
-
`CREATE TABLE IF NOT EXISTS qe_pattern_embeddings (
|
|
57
|
-
pattern_id TEXT PRIMARY KEY, embedding BLOB NOT NULL,
|
|
58
|
-
dimension INTEGER NOT NULL, model TEXT DEFAULT 'all-MiniLM-L6-v2',
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
`CREATE TABLE IF NOT EXISTS qe_pattern_embeddings (
|
|
58
|
+
pattern_id TEXT PRIMARY KEY, embedding BLOB NOT NULL,
|
|
59
|
+
dimension INTEGER NOT NULL, model TEXT DEFAULT 'all-MiniLM-L6-v2',
|
|
60
|
+
space_id TEXT,
|
|
61
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
62
|
+
FOREIGN KEY (pattern_id) REFERENCES qe_patterns(id) ON DELETE CASCADE
|
|
61
63
|
)`,
|
|
62
64
|
// --- Tier 1: New tables ---
|
|
63
65
|
`CREATE TABLE IF NOT EXISTS captured_experiences (
|
|
@@ -192,7 +194,7 @@ const BRAIN_TABLE_DDL = [
|
|
|
192
194
|
final_world_state TEXT, error_message TEXT,
|
|
193
195
|
created_at TEXT DEFAULT (datetime('now'))
|
|
194
196
|
)`,
|
|
195
|
-
`CREATE TABLE IF NOT EXISTS executed_steps (
|
|
197
|
+
`CREATE TABLE IF NOT EXISTS executed_steps (
|
|
196
198
|
id TEXT PRIMARY KEY, execution_id TEXT NOT NULL,
|
|
197
199
|
plan_id TEXT NOT NULL, action_id TEXT NOT NULL,
|
|
198
200
|
step_order INTEGER NOT NULL, status TEXT NOT NULL,
|
|
@@ -202,15 +204,22 @@ const BRAIN_TABLE_DDL = [
|
|
|
202
204
|
error_message TEXT,
|
|
203
205
|
FOREIGN KEY (execution_id) REFERENCES execution_results(id)
|
|
204
206
|
)`,
|
|
207
|
+
LEARNING_EVIDENCE_SCHEMA,
|
|
205
208
|
];
|
|
206
209
|
/**
|
|
207
|
-
* Ensure all
|
|
210
|
+
* Ensure all 31 brain-exportable tables exist in the target database.
|
|
208
211
|
* Creates tables in FK-aware order so parent tables come before children.
|
|
209
212
|
*/
|
|
210
213
|
export function ensureAllBrainTables(db) {
|
|
211
214
|
for (const ddl of BRAIN_TABLE_DDL) {
|
|
212
215
|
db.exec(ddl);
|
|
213
216
|
}
|
|
217
|
+
const embeddingColumns = db.prepare("PRAGMA table_info('qe_pattern_embeddings')")
|
|
218
|
+
.all();
|
|
219
|
+
if (!embeddingColumns.some((column) => column.name === 'space_id')) {
|
|
220
|
+
db.exec('ALTER TABLE qe_pattern_embeddings ADD COLUMN space_id TEXT');
|
|
221
|
+
}
|
|
222
|
+
db.exec('CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id)');
|
|
214
223
|
}
|
|
215
224
|
/** List of all table names in creation/import order. */
|
|
216
225
|
export const ALL_BRAIN_TABLE_NAMES = [
|
|
@@ -222,5 +231,8 @@ export const ALL_BRAIN_TABLE_NAMES = [
|
|
|
222
231
|
'qe_pattern_usage', 'pattern_evolution_events', 'pattern_relationships',
|
|
223
232
|
'pattern_versions', 'vectors', 'experience_applications',
|
|
224
233
|
'execution_results', 'executed_steps',
|
|
234
|
+
'learning_evidence_manifests', 'learning_evidence_segments',
|
|
235
|
+
'learning_segment_edges', 'learning_evidence_admissions',
|
|
236
|
+
'pattern_manifest_lineage', 'pattern_segment_lineage',
|
|
225
237
|
];
|
|
226
238
|
//# sourceMappingURL=brain-table-ddl.js.map
|
|
@@ -238,7 +238,7 @@ export class CognitiveContainer {
|
|
|
238
238
|
for (const row of processedRows) {
|
|
239
239
|
let result;
|
|
240
240
|
if (config.dedupColumns && config.dedupColumns.length > 0) {
|
|
241
|
-
result = mergeAppendOnlyRow(db, config.tableName, row, config.dedupColumns);
|
|
241
|
+
result = mergeAppendOnlyRow(db, config.tableName, row, config.dedupColumns, config.preserveId);
|
|
242
242
|
}
|
|
243
243
|
else {
|
|
244
244
|
const idCol = PK_COLUMNS[config.tableName] || 'id';
|
|
@@ -56,6 +56,8 @@ export interface DualWriteConfig {
|
|
|
56
56
|
mode: 'dual-write' | 'rvf-primary' | 'sqlite-only';
|
|
57
57
|
/** Whether to verify witness chain on startup */
|
|
58
58
|
verifyOnStartup?: boolean;
|
|
59
|
+
/** Runtime provenance for an injected embedding pipeline. */
|
|
60
|
+
embeddingSpaceId?: string;
|
|
59
61
|
}
|
|
60
62
|
export interface DualWriteResult {
|
|
61
63
|
sqliteSuccess: boolean;
|
|
@@ -76,6 +78,7 @@ export declare class RvfDualWriter {
|
|
|
76
78
|
private rvfStore;
|
|
77
79
|
private rvfAvailable;
|
|
78
80
|
constructor(db: unknown, config: DualWriteConfig);
|
|
81
|
+
private activeSpaceId;
|
|
79
82
|
/**
|
|
80
83
|
* Initialize the RVF store (create or open).
|
|
81
84
|
*
|
|
@@ -143,6 +146,7 @@ export declare class RvfDualWriter {
|
|
|
143
146
|
epoch: number;
|
|
144
147
|
} | null;
|
|
145
148
|
private shouldWriteRvf;
|
|
149
|
+
private hasCompatibleEmbeddingSpace;
|
|
146
150
|
private writeSqliteEmbedding;
|
|
147
151
|
private deleteSqliteEmbedding;
|
|
148
152
|
private getSqliteEmbeddingCount;
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* intercepting pattern embedding writes/deletes/searches and routing them
|
|
11
11
|
* to one or both backends depending on the configured mode.
|
|
12
12
|
*/
|
|
13
|
+
import { getActiveEmbeddingSpaceIdentity } from '../../learning/real-embeddings.js';
|
|
14
|
+
import { verifyOrCreateEmbeddingSpaceManifest } from '../../learning/embedding-space.js';
|
|
13
15
|
/**
|
|
14
16
|
* Wraps the real RvfNativeAdapter to conform to the simpler RvfStore interface.
|
|
15
17
|
*/
|
|
@@ -48,6 +50,10 @@ function tableExists(db, name) {
|
|
|
48
50
|
const row = db.prepare("SELECT COUNT(*) as cnt FROM sqlite_master WHERE type='table' AND name=?").get(name);
|
|
49
51
|
return (row?.cnt ?? 0) > 0;
|
|
50
52
|
}
|
|
53
|
+
function columnExists(db, table, column) {
|
|
54
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
55
|
+
return rows.some((row) => row.name === column);
|
|
56
|
+
}
|
|
51
57
|
// ============================================================================
|
|
52
58
|
// RvfDualWriter
|
|
53
59
|
// ============================================================================
|
|
@@ -62,6 +68,16 @@ export class RvfDualWriter {
|
|
|
62
68
|
...config,
|
|
63
69
|
dimensions: config.dimensions ?? 384,
|
|
64
70
|
};
|
|
71
|
+
if (tableExists(this.db, 'qe_pattern_embeddings') && !columnExists(this.db, 'qe_pattern_embeddings', 'space_id')) {
|
|
72
|
+
this.db.exec('ALTER TABLE qe_pattern_embeddings ADD COLUMN space_id TEXT');
|
|
73
|
+
this.db.exec('CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id)');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
activeSpaceId() {
|
|
77
|
+
// An injected writer belongs to the embedder that constructed it. A
|
|
78
|
+
// process-global identity may describe a different pipeline initialized by
|
|
79
|
+
// another subsystem, so it is only a fallback for legacy callers.
|
|
80
|
+
return this.config.embeddingSpaceId ?? getActiveEmbeddingSpaceIdentity()?.spaceId;
|
|
65
81
|
}
|
|
66
82
|
/**
|
|
67
83
|
* Initialize the RVF store (create or open).
|
|
@@ -104,6 +120,7 @@ export class RvfDualWriter {
|
|
|
104
120
|
}
|
|
105
121
|
}
|
|
106
122
|
this.rvfStore = wrapNativeAdapter(nativeAdapter, this.config.dimensions);
|
|
123
|
+
verifyOrCreateEmbeddingSpaceManifest(this.config.rvfPath, this.activeSpaceId() ?? null, this.rvfStore.status().totalVectors);
|
|
107
124
|
this.rvfAvailable = true;
|
|
108
125
|
}
|
|
109
126
|
catch (err) {
|
|
@@ -134,6 +151,10 @@ export class RvfDualWriter {
|
|
|
134
151
|
sqliteSuccess: false,
|
|
135
152
|
rvfSuccess: false,
|
|
136
153
|
};
|
|
154
|
+
const hasSpaceContract = columnExists(this.db, 'qe_pattern_embeddings', 'space_id');
|
|
155
|
+
if (!hasSpaceContract || !this.activeSpaceId()) {
|
|
156
|
+
return { ...result, divergence: 'VECTOR_SPACE_UNVERIFIED' };
|
|
157
|
+
}
|
|
137
158
|
// 1. Always write to SQLite qe_pattern_embeddings
|
|
138
159
|
try {
|
|
139
160
|
this.writeSqliteEmbedding(patternId, embedding);
|
|
@@ -198,6 +219,8 @@ export class RvfDualWriter {
|
|
|
198
219
|
* falls back to SQLite on error. Otherwise uses SQLite.
|
|
199
220
|
*/
|
|
200
221
|
search(query, k) {
|
|
222
|
+
if (!this.hasCompatibleEmbeddingSpace())
|
|
223
|
+
return [];
|
|
201
224
|
if (this.config.mode === 'rvf-primary' && this.rvfAvailable && this.rvfStore) {
|
|
202
225
|
try {
|
|
203
226
|
return this.rvfStore.search(query, k);
|
|
@@ -326,6 +349,19 @@ export class RvfDualWriter {
|
|
|
326
349
|
this.rvfAvailable &&
|
|
327
350
|
this.rvfStore !== null);
|
|
328
351
|
}
|
|
352
|
+
hasCompatibleEmbeddingSpace() {
|
|
353
|
+
if (!columnExists(this.db, 'qe_pattern_embeddings', 'space_id'))
|
|
354
|
+
return false;
|
|
355
|
+
const activeSpaceId = this.activeSpaceId();
|
|
356
|
+
if (!activeSpaceId)
|
|
357
|
+
return false;
|
|
358
|
+
const row = this.db.prepare(`
|
|
359
|
+
SELECT COUNT(*) AS incompatible
|
|
360
|
+
FROM qe_pattern_embeddings
|
|
361
|
+
WHERE space_id IS NULL OR space_id <> ?
|
|
362
|
+
`).get(activeSpaceId);
|
|
363
|
+
return (row?.incompatible ?? 0) === 0;
|
|
364
|
+
}
|
|
329
365
|
writeSqliteEmbedding(patternId, embedding) {
|
|
330
366
|
const blob = Buffer.from(embedding instanceof Float32Array
|
|
331
367
|
? embedding.buffer
|
|
@@ -333,14 +369,22 @@ export class RvfDualWriter {
|
|
|
333
369
|
const dimension = embedding.length;
|
|
334
370
|
// Upsert into qe_pattern_embeddings
|
|
335
371
|
if (tableExists(this.db, 'qe_pattern_embeddings')) {
|
|
336
|
-
this.
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
372
|
+
const spaceId = this.activeSpaceId();
|
|
373
|
+
if (columnExists(this.db, 'qe_pattern_embeddings', 'space_id')) {
|
|
374
|
+
if (!spaceId)
|
|
375
|
+
throw new Error('VECTOR_SPACE_UNVERIFIED: dual writer has no runtime provenance');
|
|
376
|
+
this.db.prepare(`
|
|
377
|
+
INSERT INTO qe_pattern_embeddings (pattern_id, embedding, dimension, model, space_id, created_at)
|
|
378
|
+
VALUES (?, ?, ?, 'all-MiniLM-L6-v2', ?, datetime('now'))
|
|
379
|
+
ON CONFLICT(pattern_id) DO UPDATE SET
|
|
380
|
+
embedding = excluded.embedding,
|
|
381
|
+
dimension = excluded.dimension,
|
|
382
|
+
space_id = excluded.space_id,
|
|
383
|
+
created_at = datetime('now')
|
|
384
|
+
`).run(patternId, blob, dimension, spaceId);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
throw new Error('VECTOR_SPACE_UNVERIFIED: canonical space_id column is unavailable');
|
|
344
388
|
}
|
|
345
389
|
}
|
|
346
390
|
deleteSqliteEmbedding(patternId) {
|
|
@@ -367,7 +411,11 @@ export class RvfDualWriter {
|
|
|
367
411
|
searchSqlite(query, k) {
|
|
368
412
|
if (!tableExists(this.db, 'qe_pattern_embeddings'))
|
|
369
413
|
return [];
|
|
370
|
-
const
|
|
414
|
+
const activeSpaceId = this.activeSpaceId();
|
|
415
|
+
const hasSpaceContract = columnExists(this.db, 'qe_pattern_embeddings', 'space_id');
|
|
416
|
+
if (!hasSpaceContract || !activeSpaceId)
|
|
417
|
+
return [];
|
|
418
|
+
const rows = this.db.prepare('SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings WHERE space_id = ?').all(activeSpaceId);
|
|
371
419
|
const queryArr = query instanceof Float32Array ? Array.from(query) : query;
|
|
372
420
|
const queryMag = Math.sqrt(queryArr.reduce((s, v) => s + v * v, 0));
|
|
373
421
|
if (queryMag === 0)
|
|
@@ -30,7 +30,7 @@ const LOCK_MAGIC = 'FLVR';
|
|
|
30
30
|
/** Byte offset of the owning pid within a lock record (u32 LE). */
|
|
31
31
|
const LOCK_PID_OFFSET = 4;
|
|
32
32
|
/** Sidecars that belong to a store and must be quarantined alongside it. */
|
|
33
|
-
const STORE_SIDECAR_SUFFIXES = ['', '.idmap.json', '.manifest.json'];
|
|
33
|
+
const STORE_SIDECAR_SUFFIXES = ['', '.idmap.json', '.manifest.json', '.space.json'];
|
|
34
34
|
/** Read the first `n` bytes of a file, or null if unreadable/shorter. */
|
|
35
35
|
function readHead(path, n) {
|
|
36
36
|
let fd;
|