agentic-qe 3.11.4 → 3.12.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 -0
- package/.claude/helpers/auto-memory-hook.mjs +35 -3
- package/.claude/helpers/brain-checkpoint.cjs +16 -1
- package/.claude/helpers/helpers.manifest.json +12 -0
- package/.claude/helpers/hook-handler.cjs +26 -5
- package/.claude/helpers/intelligence.cjs +14 -1
- package/.claude/hooks/aqe-hook.cjs +57 -10
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +110 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/adapters/a2a/auth/routes.js +59 -28
- package/dist/audit/witness-chain.d.ts +25 -0
- package/dist/audit/witness-chain.js +69 -22
- package/dist/audit/witness-key-manager.d.ts +11 -0
- package/dist/audit/witness-key-manager.js +24 -0
- package/dist/cli/brain-commands.js +2 -1
- package/dist/cli/bundle.js +6 -6
- package/dist/cli/chunks/adapter-6IWRIHF3.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-62I6ZNRW.js → agent-booster-wasm-IO54X6IQ.js} +2 -2
- package/dist/cli/chunks/{agent-handler-E2TZKKBS.js → agent-handler-A57SZUCW.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-JHAHC2NH.js → agent-memory-branch-BX7LRFGN.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-FSF5U67K.js +2 -0
- package/dist/cli/chunks/{arena-72ZV65BR.js → arena-UTC4YY6Y.js} +4 -4
- package/dist/cli/chunks/{arena-KLG3YSSR.js → arena-Y3XTX6O7.js} +2 -2
- package/dist/cli/chunks/audit-L4RL2AOY.js +3 -0
- package/dist/cli/chunks/base-2CKCJU3O.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-LAFK5QZ4.js → better-sqlite3-LRDXKYOJ.js} +2 -2
- package/dist/cli/chunks/brain-handler-OHDPI5TQ.js +89 -0
- package/dist/cli/chunks/{branch-enumerator-C7MPNYT7.js → branch-enumerator-ZRXE2CQ7.js} +2 -2
- package/dist/cli/chunks/{browser-UUDUDYLR.js → browser-NT33FG76.js} +2 -2
- package/dist/cli/chunks/browser-workflow-UGYJE64S.js +2 -0
- package/dist/cli/chunks/{chunk-7QTB5XIQ.js → chunk-27JCWG5J.js} +2 -2
- package/dist/cli/chunks/{chunk-3FJZMQJ7.js → chunk-2ALNNXFF.js} +2 -2
- package/dist/cli/chunks/{chunk-LMJUMUQJ.js → chunk-2AOOIAW3.js} +4 -4
- package/dist/cli/chunks/{chunk-CNF3ZWLM.js → chunk-2AR4B3DI.js} +2 -2
- package/dist/cli/chunks/{chunk-7ADD2ZQL.js → chunk-2KHDGC7N.js} +2 -2
- package/dist/cli/chunks/{chunk-P6S6ZVB5.js → chunk-2UMCB7AH.js} +1 -1
- package/dist/cli/chunks/{chunk-HH6NCBSP.js → chunk-335GHVJV.js} +22 -22
- package/dist/cli/chunks/{chunk-2WPSMQIL.js → chunk-36MPDANH.js} +1 -1
- package/dist/cli/chunks/{chunk-Y4AXOHW4.js → chunk-3AFNXU45.js} +1 -1
- package/dist/cli/chunks/{chunk-SL3SNOO2.js → chunk-3B4XXFKD.js} +2 -2
- package/dist/cli/chunks/{chunk-7IKWF2AD.js → chunk-4GU656WM.js} +1 -1
- package/dist/cli/chunks/{chunk-IQBZBUP5.js → chunk-4SALW7OT.js} +2 -2
- package/dist/cli/chunks/{chunk-TCVEKRPI.js → chunk-5FR5GBUT.js} +2 -2
- package/dist/cli/chunks/chunk-5VBPIJUZ.js +65 -0
- package/dist/cli/chunks/chunk-5XFX25AJ.js +4 -0
- package/dist/cli/chunks/{chunk-QSDIY3E2.js → chunk-5YGESYBC.js} +1 -1
- package/dist/cli/chunks/{chunk-5U2WHPXL.js → chunk-62RELCU6.js} +1 -1
- package/dist/cli/chunks/{chunk-QJ5NCYJ3.js → chunk-64M3FFM4.js} +2 -2
- package/dist/cli/chunks/{chunk-BMQDELPA.js → chunk-6JNNZGI2.js} +1 -1
- package/dist/cli/chunks/{chunk-U34OZXD6.js → chunk-6X3RJBA3.js} +2 -2
- package/dist/cli/chunks/{chunk-AE6HXMOG.js → chunk-72VZGAMJ.js} +1 -1
- package/dist/cli/chunks/{chunk-4JFH3MVA.js → chunk-7F7U2HUH.js} +1 -1
- package/dist/cli/chunks/{chunk-A4OMK3FO.js → chunk-7HJHXSYT.js} +2 -2
- package/dist/cli/chunks/chunk-7WX3MKRS.js +2 -0
- package/dist/cli/chunks/{chunk-O7PVZ32A.js → chunk-7ZIVDGSN.js} +1 -1
- package/dist/cli/chunks/{chunk-EZRHSHOQ.js → chunk-AAATFEIL.js} +2 -2
- package/dist/cli/chunks/{chunk-TQ373GGI.js → chunk-AEX75YGI.js} +2 -2
- package/dist/cli/chunks/chunk-BA6U7NSR.js +2 -0
- package/dist/cli/chunks/chunk-BB4OVXWF.js +14 -0
- package/dist/cli/chunks/{chunk-GRQ36XUH.js → chunk-BBC526PL.js} +2 -2
- package/dist/cli/chunks/{chunk-EONKMHKO.js → chunk-BGRJZH5Q.js} +2 -2
- package/dist/cli/chunks/{chunk-XQ6DW5FV.js → chunk-BUYPRUNY.js} +2 -2
- package/dist/cli/chunks/{chunk-TU6YN43Q.js → chunk-BZPF6GTL.js} +1 -1
- package/dist/cli/chunks/{chunk-TPMBFARK.js → chunk-C4SZSPXY.js} +67 -22
- package/dist/cli/chunks/{chunk-D6CKKNYC.js → chunk-C6GYLCTX.js} +2 -2
- package/dist/cli/chunks/{chunk-YNK6SUPU.js → chunk-CC5G3K4X.js} +2 -2
- package/dist/cli/chunks/{chunk-ADFKY3X2.js → chunk-CHO54B34.js} +2 -2
- package/dist/cli/chunks/{chunk-WQZ2WRO4.js → chunk-CMGYUCM7.js} +1 -1
- package/dist/cli/chunks/{chunk-QMC5MTBV.js → chunk-CSEEGX5T.js} +2 -2
- package/dist/cli/chunks/{chunk-FSGMRQFC.js → chunk-CVGXB7IX.js} +2 -2
- package/dist/cli/chunks/{chunk-5VSQAGA2.js → chunk-DQDFACYW.js} +1 -1
- package/dist/cli/chunks/chunk-DR7PCO3S.js +153 -0
- package/dist/cli/chunks/{chunk-D5S47YUS.js → chunk-DTOE3NYW.js} +3 -3
- package/dist/cli/chunks/{chunk-WZYNY3VF.js → chunk-DXOMRWDC.js} +1 -1
- package/dist/cli/chunks/{chunk-HJ24KMC2.js → chunk-EGH3H7QO.js} +1 -1
- package/dist/cli/chunks/{chunk-JFLSQH2X.js → chunk-EM2JIIAQ.js} +2 -2
- package/dist/cli/chunks/{chunk-MWFJC5HR.js → chunk-ESDGCTC4.js} +1 -1
- package/dist/cli/chunks/{chunk-SRVTNG6L.js → chunk-EZE2HRQB.js} +2 -2
- package/dist/cli/chunks/{chunk-ZFCVT43J.js → chunk-FEEMJDUF.js} +2 -2
- package/dist/cli/chunks/{chunk-HJO4RNOW.js → chunk-FI5SSLEF.js} +2 -2
- package/dist/cli/chunks/{chunk-XHRLBJTM.js → chunk-FKPUPQQT.js} +2 -2
- package/dist/cli/chunks/{chunk-ODZSQVEW.js → chunk-FOPS6DRZ.js} +1 -1
- package/dist/cli/chunks/{chunk-AQIEK4SY.js → chunk-FU5RNEXV.js} +2 -2
- package/dist/cli/chunks/{chunk-PQUXFSN6.js → chunk-FZIHOMGY.js} +2 -2
- package/dist/cli/chunks/{chunk-Z2REKBD6.js → chunk-FZRU73M4.js} +2 -2
- package/dist/cli/chunks/{chunk-NBBLPDJX.js → chunk-G5JQLUUO.js} +2 -2
- package/dist/cli/chunks/{chunk-4BFCLSDN.js → chunk-G6LR7FK7.js} +2 -2
- package/dist/cli/chunks/{chunk-QEVX4GWF.js → chunk-G6RKUEGL.js} +2 -2
- package/dist/cli/chunks/{chunk-HWBMYR5W.js → chunk-GCF42L7M.js} +5 -5
- package/dist/cli/chunks/{chunk-TSWF3AGQ.js → chunk-GGMQOEZZ.js} +2 -2
- package/dist/cli/chunks/{chunk-PFWJQPUC.js → chunk-HAEUPIKW.js} +2 -2
- package/dist/cli/chunks/{chunk-63QUN3JK.js → chunk-HDJMD6UH.js} +1 -1
- package/dist/cli/chunks/{chunk-JPENUVCI.js → chunk-HW62TB4T.js} +1 -1
- package/dist/cli/chunks/{chunk-WMIRAD3J.js → chunk-I6WHYRWB.js} +2 -2
- package/dist/cli/chunks/{chunk-YZ5EQR37.js → chunk-ICK3B24H.js} +2 -2
- package/dist/cli/chunks/{chunk-FRFVN6AA.js → chunk-IDLNLSQI.js} +2 -2
- package/dist/cli/chunks/{chunk-VQU7DMEY.js → chunk-IJUYHIKN.js} +2 -2
- package/dist/cli/chunks/{chunk-6JUOH6L4.js → chunk-IKVNYK7Y.js} +2 -2
- package/dist/cli/chunks/{chunk-ZKCKOQJI.js → chunk-JOBCMNTP.js} +2 -2
- package/dist/cli/chunks/{chunk-ARPBG6FQ.js → chunk-JYX7AZHE.js} +2 -2
- package/dist/cli/chunks/{chunk-SFDUT5WM.js → chunk-JYXSVSH2.js} +2 -2
- package/dist/cli/chunks/{chunk-VJGHRWMH.js → chunk-K5SN66B4.js} +2 -2
- package/dist/cli/chunks/{chunk-DNOU2HVQ.js → chunk-KDLYTJ5C.js} +2 -2
- package/dist/cli/chunks/{chunk-T76RFXQX.js → chunk-KI5BP4X5.js} +2 -2
- package/dist/cli/chunks/{chunk-7AWK43JN.js → chunk-KJWQ7ENF.js} +2 -2
- package/dist/cli/chunks/{chunk-BRLUNIR4.js → chunk-KN5GOEYK.js} +2 -2
- package/dist/cli/chunks/{chunk-VKJQAKYG.js → chunk-KZ37VHMJ.js} +2 -2
- package/dist/cli/chunks/{chunk-NV3TXXOW.js → chunk-KZMRU7DL.js} +2 -2
- package/dist/cli/chunks/{chunk-LLUPRGOR.js → chunk-L5ZLOW3K.js} +2 -2
- package/dist/cli/chunks/{chunk-THKZVOZV.js → chunk-LMJUQWR7.js} +1 -1
- package/dist/cli/chunks/{chunk-2KNFS3L5.js → chunk-MBF3Q7FQ.js} +1 -1
- package/dist/cli/chunks/chunk-MDT3LIXS.js +2 -0
- package/dist/cli/chunks/{chunk-B5XUWHKQ.js → chunk-MJPYNGZ7.js} +1 -1
- package/dist/cli/chunks/{chunk-UCYTY4LG.js → chunk-MK3J7JVZ.js} +2 -2
- package/dist/cli/chunks/{chunk-MCT4CD5M.js → chunk-MUAHFGIX.js} +2 -2
- package/dist/cli/chunks/{chunk-3SBUL72V.js → chunk-MUV56BPK.js} +2 -2
- package/dist/cli/chunks/{chunk-WNMDWP5A.js → chunk-NLHISTL2.js} +2 -2
- package/dist/cli/chunks/{chunk-UJMTKXPI.js → chunk-NNGCUJWQ.js} +2 -2
- package/dist/cli/chunks/chunk-NW7G57NR.js +27 -0
- package/dist/cli/chunks/{chunk-3SRPFBU7.js → chunk-O3C5RRDQ.js} +3 -3
- package/dist/cli/chunks/{chunk-AYGEWPN4.js → chunk-OHSVDMF7.js} +1 -1
- package/dist/cli/chunks/{chunk-AJXGGTX7.js → chunk-OPIWFXME.js} +1 -1
- package/dist/cli/chunks/{chunk-ZSBJNE35.js → chunk-P52YORQG.js} +2 -2
- package/dist/cli/chunks/chunk-PM566XEO.js +2 -0
- package/dist/cli/chunks/chunk-POKMJTD2.js +2 -0
- package/dist/cli/chunks/{chunk-GOQ4P2PB.js → chunk-PQMLIVGV.js} +2 -2
- package/dist/cli/chunks/{chunk-IB3ZPLFA.js → chunk-PT3FTGKZ.js} +2 -2
- package/dist/cli/chunks/{chunk-U3AVZGQA.js → chunk-Q5YRPS4P.js} +1 -1
- package/dist/cli/chunks/{chunk-5Z4FBCBK.js → chunk-QJ6H2HQQ.js} +1 -1
- package/dist/cli/chunks/{chunk-DRMHVY4T.js → chunk-RG552ROA.js} +4 -4
- package/dist/cli/chunks/{chunk-PEIQDQXN.js → chunk-RHC7TFPU.js} +2 -2
- package/dist/cli/chunks/{chunk-JNQN5DNS.js → chunk-RMFRFING.js} +1 -1
- package/dist/cli/chunks/{chunk-4YT5YN5G.js → chunk-RQN4HWGV.js} +2 -2
- package/dist/cli/chunks/{chunk-5P7Q5YNC.js → chunk-RYUSZ43T.js} +1 -1
- package/dist/cli/chunks/{chunk-O5NEJIHB.js → chunk-RZDNCTOA.js} +2 -2
- package/dist/cli/chunks/chunk-SCMXIBI7.js +2 -0
- package/dist/cli/chunks/{chunk-6545AS2J.js → chunk-SPEUF7ZL.js} +2 -2
- package/dist/cli/chunks/{chunk-LW5DHT3Z.js → chunk-SSXAW3ER.js} +2 -2
- package/dist/cli/chunks/{chunk-Q7ORVHJB.js → chunk-TC2JE5OK.js} +3 -3
- package/dist/cli/chunks/{chunk-MALOUGSF.js → chunk-TED4KOSK.js} +2 -2
- package/dist/cli/chunks/{chunk-ICCTQ5LO.js → chunk-TJ6N4CCX.js} +2 -2
- package/dist/cli/chunks/{chunk-6GYGAW53.js → chunk-TJEJ4UVX.js} +2 -2
- package/dist/cli/chunks/{chunk-VO6YJGB4.js → chunk-TO5PQSDD.js} +2 -2
- package/dist/cli/chunks/{chunk-LKURMUBU.js → chunk-TR5GOGH3.js} +37 -12
- package/dist/cli/chunks/{chunk-JCTCM6IR.js → chunk-UGJQJSPB.js} +1 -1
- package/dist/cli/chunks/{chunk-4RHNPRAP.js → chunk-USB44IHJ.js} +2 -2
- package/dist/cli/chunks/{chunk-JDFPAJGB.js → chunk-UUOXV3NS.js} +92 -92
- package/dist/cli/chunks/chunk-UVVKFBF7.js +2 -0
- package/dist/cli/chunks/{chunk-VCUCD3B5.js → chunk-V2MD5EDD.js} +2 -2
- package/dist/cli/chunks/{chunk-RFQBDMAP.js → chunk-VA7TEOPM.js} +1 -1
- package/dist/cli/chunks/{chunk-IF3HPQNV.js → chunk-VMP4M5PB.js} +1 -1
- package/dist/cli/chunks/{chunk-KUZMVH6N.js → chunk-VS4GMNJK.js} +3 -3
- package/dist/cli/chunks/{chunk-ZYZT2CDX.js → chunk-VWJSWXHG.js} +1 -1
- package/dist/cli/chunks/{chunk-54B6P2WS.js → chunk-VZ67ZDB3.js} +3 -3
- package/dist/cli/chunks/{chunk-NSPCZPTB.js → chunk-W2OMW6UU.js} +2 -2
- package/dist/cli/chunks/{chunk-3SKIZDKL.js → chunk-W766S4SK.js} +1 -1
- package/dist/cli/chunks/{chunk-N2BJN6AO.js → chunk-WJYTLRA5.js} +3 -3
- package/dist/cli/chunks/{chunk-X64BEXUY.js → chunk-WNASEUBW.js} +117 -113
- package/dist/cli/chunks/{chunk-HT6WAYIR.js → chunk-WT4ZDDFM.js} +1 -1
- package/dist/cli/chunks/chunk-XEYW3V5I.js +2 -0
- package/dist/cli/chunks/{chunk-6W3QHS45.js → chunk-XIFPIVZI.js} +2 -2
- package/dist/cli/chunks/{chunk-3E7D3A35.js → chunk-Y2MCIIJD.js} +1 -1
- package/dist/cli/chunks/{chunk-YUHM72VQ.js → chunk-YKOTOCO6.js} +2 -2
- package/dist/cli/chunks/{chunk-YKSWC7I4.js → chunk-Z3W3R4CW.js} +8 -20
- package/dist/cli/chunks/chunk-ZT2WHCVM.js +2 -0
- package/dist/cli/chunks/{chunk-G3TFNY4T.js → chunk-ZVPAFX4I.js} +2 -2
- package/dist/cli/chunks/{chunk-NFJT7XXR.js → chunk-ZWC6CM4R.js} +1 -1
- package/dist/cli/chunks/{ci-HQCRSCC7.js → ci-RJH5LAL3.js} +2 -2
- package/dist/cli/chunks/{ci-output-YBVXLA6O.js → ci-output-62SGMGB2.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-ULGMF2QN.js → circuit-breaker-QXTS5ZAW.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-MKZ2LJXK.js → claude-flow-setup-BBCCT5WV.js} +2 -2
- package/dist/cli/chunks/client-E2XUBCLK.js +2 -0
- package/dist/cli/chunks/{cline-installer-WZQ6XBWN.js → cline-installer-IZCUJJ3I.js} +2 -2
- package/dist/cli/chunks/{code-H3KGH45S.js → code-AWNVOZ7S.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-NUVEAJ7C.js → code-index-extractor-MX65BKMI.js} +2 -2
- package/dist/cli/chunks/{codex-installer-JQI6E6CV.js → codex-installer-EQT6JVLM.js} +2 -2
- package/dist/cli/chunks/{completions-NDF4PFE7.js → completions-WOJAM45W.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-XCZH66HG.js → complexity-analyzer-3DJB7V3K.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-Z4AJGZ7S.js → continuedev-installer-P4KWUTCJ.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-K4IPAL7C.js → copilot-installer-FFZWTMWQ.js} +2 -2
- package/dist/cli/chunks/core-handlers-46Z5VOO6.js +2 -0
- package/dist/cli/chunks/{cost-tracker-35KXAB23.js → cost-tracker-CYBOV3NI.js} +2 -2
- package/dist/cli/chunks/{coverage-QW5I4TYZ.js → coverage-GTZJBSC4.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-SXQ3HFRY.js +2 -0
- package/dist/cli/chunks/{cursor-installer-P4Z7RMIZ.js → cursor-installer-WZIVXGGB.js} +2 -2
- package/dist/cli/chunks/daemon-JWMHEJEN.js +10 -0
- package/dist/cli/chunks/{daemon-WQWTCYBM.js → daemon-MSFN2LXY.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-7XD2VGON.js → dag-attention-scheduler-4TWOTTQE.js} +2 -2
- package/dist/cli/chunks/{detect-GZ3P4DI7.js → detect-YZ6AGQPB.js} +2 -2
- package/dist/cli/chunks/{dist-node-6WWAW7OP.js → dist-node-3EM2XH54.js} +2 -2
- package/dist/cli/chunks/{domain-handler-3GTLWARQ.js → domain-handler-4XU5BINU.js} +2 -2
- package/dist/cli/chunks/domain-transfer-HUFC7I52.js +2 -0
- package/dist/cli/chunks/dream-R6MQQQ3N.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-BGIMA77V.js → embed-and-insert-pattern-J5ZFM6YX.js} +2 -2
- package/dist/cli/chunks/{eval-SXV6DRDD.js → eval-XYOA3EH2.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-TT6WCT2S.js → experience-capture-middleware-E3RYQB6Z.js} +3 -3
- package/dist/cli/chunks/{fast-paths-HTAZHEQP.js → fast-paths-DKIYN2YS.js} +2 -2
- package/dist/cli/chunks/{feature-flags-DIE3Z2B4.js → feature-flags-S2RNZATS.js} +2 -2
- package/dist/cli/chunks/{feature-flags-WBUKU54W.js → feature-flags-ZB63Z7N5.js} +2 -2
- package/dist/cli/chunks/{file-discovery-SKDETFS3.js → file-discovery-USJJLYQU.js} +2 -2
- package/dist/cli/chunks/{fleet-WCWEPAVU.js → fleet-4MUPHSF5.js} +4 -4
- package/dist/cli/chunks/{gnn-wrapper-KWZOWBYS.js → gnn-wrapper-PYOQZKX6.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-3AGYHVG2.js → heartbeat-handler-HLO5XCG7.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-OSDPJT6A.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-KMGSHBIN.js +2 -0
- package/dist/cli/chunks/hnsw-index-IMFRAOPE.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-6OJJDZHL.js → hnsw-legacy-bridge-FZEH2KLM.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-URULPKRF.js → hnswlib-node-VS6L5VUG.js} +2 -2
- package/dist/cli/chunks/{hooks-OXEBTLXV.js → hooks-R2757K57.js} +48 -52
- package/dist/cli/chunks/hybrid-router-57QSWSWC.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-NL74PRHD.js → hypergraph-engine-EAV3GJ5D.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-KZ54AEEL.js → hypergraph-handler-5ERXAVGH.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-OC4MPBGA.js +2 -0
- package/dist/cli/chunks/{init-handler-XKZXRXPG.js → init-handler-RXUSEMG7.js} +6 -6
- package/dist/cli/chunks/init-wizard-CDBRL4PO.js +2 -0
- package/dist/cli/chunks/kernel-CQ7R3AAV.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-WISQMJK7.js → kilocode-installer-ZUBVBHGT.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-O7TBB3GM.js → kiro-installer-TRTRQDGL.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-UXNH7RY4.js +2 -0
- package/dist/cli/chunks/{learning-6IZBGVRU.js → learning-UYXWAU5D.js} +3 -3
- package/dist/cli/chunks/{llm-router-QDMQPPQ7.js → llm-router-TB5OJPEV.js} +4 -4
- package/dist/cli/chunks/llm-router-service-UV34YXBE.js +2 -0
- package/dist/cli/chunks/{load-KLAJJGL5.js → load-ELPSUIPV.js} +2 -2
- package/dist/cli/chunks/load-test-2VEN3PQZ.js +2 -0
- package/dist/cli/chunks/{mcp-SZOPQZIZ.js → mcp-UX7TK3XV.js} +2 -2
- package/dist/cli/chunks/{memory-G3WY74C6.js → memory-W3LG6H6N.js} +5 -5
- package/dist/cli/chunks/memory-backend-TZL5U6F3.js +2 -0
- package/dist/cli/chunks/memory-handlers-BNXAYS2P.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-TDNQGTOT.js → multi-model-executor-227LWZRY.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-NGYGEDMV.js → opencode-installer-F4WKVWDL.js} +2 -2
- package/dist/cli/chunks/{orchestrator-KPI5DY2C.js → orchestrator-V4DBMGK6.js} +5 -5
- package/dist/cli/chunks/pattern-null-store-KLX2RNHM.js +2 -0
- package/dist/cli/chunks/pattern-usage-recorder-BY3HEWSU.js +2 -0
- package/dist/cli/chunks/{pipeline-CSDCC675.js → pipeline-3F5RIESX.js} +2 -2
- package/dist/cli/chunks/{platform-Q5XKEVKH.js → platform-KCGXTZO3.js} +2 -2
- package/dist/cli/chunks/{plugin-XKKR3GVL.js → plugin-2H552KOV.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-22QVNKEN.js → prime-radiant-advanced-wasm-EFKVL7VN.js} +2 -2
- package/dist/cli/chunks/protocol-executor-5HJKW6MC.js +2 -0
- package/dist/cli/chunks/{protocol-handler-REQKTJGG.js → protocol-handler-ELGYV7D2.js} +2 -2
- package/dist/cli/chunks/{prove-NOFUFSQN.js → prove-AYJCQYNI.js} +2 -2
- package/dist/cli/chunks/provider-manager-TRZSBXD3.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-RCEYSLVV.js +2 -0
- package/dist/cli/chunks/{quality-3DQ2H5TK.js → quality-HH7L5A7V.js} +2 -2
- package/dist/cli/chunks/quality-gate-NAQLXE4C.js +7 -0
- package/dist/cli/chunks/queen-coordinator-6JFZD54W.js +2 -0
- package/dist/cli/chunks/{real-embeddings-FCGNYWLL.js → real-embeddings-IO3F4ZFR.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-HX3CNRIR.js → roocode-installer-X4TU5HO4.js} +2 -2
- package/dist/cli/chunks/router-KRLC46NS.js +2 -0
- package/dist/cli/chunks/routing-feedback-WW26H6SA.js +2 -0
- package/dist/cli/chunks/{routing-handler-YRZ2LDCR.js → routing-handler-ZJKGDDMT.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-GCQVBJ4E.js → ruvector-commands-NXCSUBN2.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-B562P3ZC.js → rvf-dual-writer-JMA74SKP.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-NAGFKCMD.js → rvf-migration-adapter-BNTGH2KU.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-WWFBEJ5Q.js → rvf-migration-coordinator-7T2HHUOH.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-OVQKPQUH.js +2 -0
- package/dist/cli/chunks/safe-db-UQOCQIH2.js +2 -0
- package/dist/cli/chunks/schedule-EUX7ZQUK.js +2 -0
- package/dist/cli/chunks/scheduler-MALHQKNR.js +2 -0
- package/dist/cli/chunks/{security-IFOYTD75.js → security-XSK2QHB3.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-TYD5TQ35.js → shared-rvf-adapter-WLRKI7RY.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-YGOOVDQZ.js → shared-rvf-dual-writer-SZW3J7ZK.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-OBCLRP4L.js +2 -0
- package/dist/cli/chunks/status-handler-HGCKYJX2.js +46 -0
- package/dist/cli/chunks/{structural-health-KZI6YMKV.js → structural-health-4SJCFX63.js} +2 -2
- package/dist/cli/chunks/{sync-Z5BDDBMK.js → sync-7WAVNZGL.js} +2 -2
- package/dist/cli/chunks/{sync-ABZNNYRC.js → sync-ATR4DUSA.js} +2 -2
- package/dist/cli/chunks/{task-handler-5ACZEPJ7.js → task-handler-O6REL34Y.js} +2 -2
- package/dist/cli/chunks/{task-handlers-UZWDPL6A.js → task-handlers-WFV2ZYWW.js} +3 -3
- package/dist/cli/chunks/{test-APO3MCVV.js → test-4LXUVHEU.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-EFZA5G5C.js → test-scheduling-OTN3DMKY.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-J2OPLNUK.js → token-bootstrap-VA7T4P42.js} +2 -2
- package/dist/cli/chunks/{token-usage-VHWVNN4R.js → token-usage-TLT6OXXR.js} +2 -2
- package/dist/cli/chunks/{transformers-PX4HPO75.js → transformers-JI7LZRQ3.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-44HA2Z3F.js → tree-sitter-wasm-parser-QNIMHB4K.js} +2 -2
- package/dist/cli/chunks/{types-IMOP7F4R.js → types-DJNWOAC6.js} +2 -2
- package/dist/cli/chunks/unified-memory-A5BS3LGX.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-WJLJO5MY.js +2 -0
- package/dist/cli/chunks/unified-persistence-CFC2BKI5.js +2 -0
- package/dist/cli/chunks/{upgrade-OZ3O6ZZI.js → upgrade-VEW4FL23.js} +2 -2
- package/dist/cli/chunks/{validate-DRY5BMWX.js → validate-O3P6PF7B.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-QD3LYPUF.js → validate-swarm-M2HXHZVC.js} +2 -2
- package/dist/cli/chunks/{vibium-2J3H2ITD.js → vibium-GOU55LUO.js} +2 -2
- package/dist/cli/chunks/visual-security-VPB6KVYJ.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-KRNUOGKI.js → web-tree-sitter-MXOI4GH3.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-PQIPH3WP.js → windsurf-installer-6GKT53IH.js} +2 -2
- package/dist/cli/chunks/{witness-chain-HPLOYPS7.js → witness-chain-OXGQGL26.js} +2 -2
- package/dist/cli/chunks/witness-chain-ZZAUAXDY.js +2 -0
- package/dist/cli/chunks/witness-key-manager-PGFSQXUJ.js +2 -0
- package/dist/cli/chunks/{workflow-OAQ3FWCY.js → workflow-ENBWRMBA.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-S4LBFTYD.js +2 -0
- package/dist/cli/chunks/{wrappers-UPIU6S5S.js → wrappers-MHLNYANQ.js} +2 -2
- package/dist/cli/commands/audit.d.ts +12 -0
- package/dist/cli/commands/audit.js +64 -4
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +45 -19
- package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +13 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +38 -0
- package/dist/cli/commands/hooks-handlers/task-hooks.js +19 -1
- package/dist/cli/commands/quality-gate.d.ts +24 -0
- package/dist/cli/commands/quality-gate.js +135 -0
- package/dist/cli/handlers/status-handler.d.ts +18 -0
- package/dist/cli/handlers/status-handler.js +47 -0
- package/dist/cli/index.js +5 -0
- package/dist/coordination/mincut/dream-integration.d.ts +11 -0
- package/dist/coordination/mincut/dream-integration.js +39 -12
- package/dist/coordination/mincut/queen-integration.js +24 -7
- package/dist/coordination/protocol-executor.js +2 -1
- package/dist/coordination/queen-lifecycle.js +4 -1
- package/dist/domains/code-intelligence/coordinator.js +10 -6
- package/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -1
- package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +6 -0
- package/dist/domains/defect-intelligence/services/defect-predictor.js +21 -0
- package/dist/domains/learning-optimization/interfaces.d.ts +7 -0
- package/dist/domains/learning-optimization/plugin.js +5 -0
- package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +10 -0
- package/dist/domains/learning-optimization/services/learning-coordinator.js +57 -0
- package/dist/domains/test-execution/plugin.js +2 -2
- package/dist/domains/test-execution/services/flaky-detector.js +1 -1
- package/dist/domains/test-generation/coordinator.js +22 -8
- package/dist/domains/test-generation/interfaces.d.ts +3 -0
- package/dist/domains/test-generation/services/test-generator.js +9 -1
- package/dist/integrations/ruvector/delta-tracker.js +10 -1
- package/dist/integrations/ruvector/feature-flags.js +7 -0
- package/dist/integrations/ruvector/sona-persistence.d.ts +24 -0
- package/dist/integrations/ruvector/sona-persistence.js +76 -0
- package/dist/integrations/ruvector/sona-three-loop.d.ts +15 -0
- package/dist/integrations/ruvector/sona-three-loop.js +17 -0
- package/dist/kernel/unified-memory-schemas.d.ts +2 -2
- package/dist/kernel/unified-memory-schemas.js +48 -2
- package/dist/kernel/unified-memory.d.ts +22 -0
- package/dist/kernel/unified-memory.js +43 -0
- package/dist/learning/aqe-learning-engine.js +3 -1
- package/dist/learning/dream/concept-graph.d.ts +31 -1
- package/dist/learning/dream/concept-graph.js +109 -3
- package/dist/learning/dream/dream-engine.d.ts +13 -1
- package/dist/learning/dream/dream-engine.js +146 -10
- package/dist/learning/dream/index.d.ts +1 -1
- package/dist/learning/dream/types.d.ts +23 -0
- package/dist/learning/pattern-lifecycle.d.ts +16 -0
- package/dist/learning/pattern-lifecycle.js +77 -1
- package/dist/learning/pattern-store.d.ts +2 -2
- package/dist/learning/pattern-store.js +14 -3
- package/dist/learning/provenance-tier.d.ts +52 -0
- package/dist/learning/provenance-tier.js +64 -0
- package/dist/learning/qe-flywheel/corpus-scorer.d.ts +55 -0
- package/dist/learning/qe-flywheel/corpus-scorer.js +293 -0
- package/dist/learning/qe-flywheel/coupled-anchor.d.ts +91 -0
- package/dist/learning/qe-flywheel/coupled-anchor.js +181 -0
- package/dist/learning/qe-flywheel/generation.d.ts +121 -0
- package/dist/learning/qe-flywheel/generation.js +167 -0
- package/dist/learning/qe-flywheel/policy.d.ts +37 -0
- package/dist/learning/qe-flywheel/policy.js +66 -0
- package/dist/learning/qe-flywheel/receipt-store.d.ts +31 -0
- package/dist/learning/qe-flywheel/receipt-store.js +89 -0
- package/dist/learning/qe-flywheel/receipt.d.ts +62 -0
- package/dist/learning/qe-flywheel/receipt.js +97 -0
- package/dist/learning/qe-reasoning-bank.js +34 -31
- package/dist/learning/routing-topology-gate.d.ts +12 -2
- package/dist/learning/routing-topology-gate.js +15 -3
- package/dist/learning/rvf-pattern-store.d.ts +1 -1
- package/dist/learning/rvf-pattern-store.js +21 -8
- package/dist/learning/sqlite-persistence.js +12 -9
- package/dist/mcp/bundle.js +540 -460
- package/dist/mcp/qe-tool-bridge.js +7 -2
- package/dist/mcp/tools/base.d.ts +29 -0
- package/dist/mcp/tools/base.js +25 -0
- package/dist/mcp/tools/coverage-analysis/index.js +6 -4
- package/dist/mcp/tools/learning-optimization/dream.d.ts +4 -13
- package/dist/mcp/tools/learning-optimization/dream.js +10 -96
- package/dist/mcp/tools/planning/goap-execute.d.ts +13 -1
- package/dist/mcp/tools/planning/goap-execute.js +33 -18
- package/dist/mcp/tools/quality-assessment/gate.d.ts +38 -0
- package/dist/mcp/tools/quality-assessment/gate.js +86 -0
- package/dist/mcp/tools/registry.d.ts +1 -0
- package/dist/mcp/tools/registry.js +10 -2
- package/dist/persistence/rvf-migration-coordinator.js +2 -1
- package/dist/planning/actions/qe-action-library.js +124 -1
- package/dist/planning/goap-planner.d.ts +14 -2
- package/dist/planning/goap-planner.js +51 -9
- package/dist/planning/index.d.ts +1 -1
- package/dist/planning/plan-executor.d.ts +84 -4
- package/dist/planning/plan-executor.js +221 -56
- package/dist/planning/types.d.ts +27 -0
- package/dist/shared/events/domain-events.d.ts +2 -0
- package/dist/shared/safe-db.js +23 -4
- package/dist/validation/anchor-set.d.ts +74 -0
- package/dist/validation/anchor-set.js +78 -0
- package/dist/validation/frontier-judge.d.ts +99 -0
- package/dist/validation/frontier-judge.js +234 -0
- package/dist/validation/gate-reexecute.d.ts +165 -0
- package/dist/validation/gate-reexecute.js +255 -0
- package/dist/validation/quality-gate-runner.d.ts +49 -0
- package/dist/validation/quality-gate-runner.js +62 -0
- package/dist/validation/quality-verdict.d.ts +94 -0
- package/dist/validation/quality-verdict.js +120 -0
- package/dist/workers/workers/learning-consolidation.js +21 -1
- package/package.json +1 -1
- package/dist/cli/chunks/adapter-2HMUXHWY.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-M2NKRVRE.js +0 -2
- package/dist/cli/chunks/audit-EPB7ETMT.js +0 -3
- package/dist/cli/chunks/base-CCHC2DAC.js +0 -2
- package/dist/cli/chunks/brain-handler-FBMYEERK.js +0 -89
- package/dist/cli/chunks/browser-workflow-4DGHFYY3.js +0 -2
- package/dist/cli/chunks/chunk-37ZDGJ3H.js +0 -2
- package/dist/cli/chunks/chunk-5AQ7FXYG.js +0 -27
- package/dist/cli/chunks/chunk-KYTFIP6R.js +0 -2
- package/dist/cli/chunks/chunk-MYMIEQSZ.js +0 -65
- package/dist/cli/chunks/chunk-RCPD6F4R.js +0 -2
- package/dist/cli/chunks/chunk-TCWR6TDN.js +0 -2
- package/dist/cli/chunks/chunk-UQ72K44T.js +0 -149
- package/dist/cli/chunks/chunk-XXRTWG7O.js +0 -2
- package/dist/cli/chunks/chunk-ZSA6V5FH.js +0 -2
- package/dist/cli/chunks/client-2OVEDWGU.js +0 -2
- package/dist/cli/chunks/core-handlers-UXRRYP52.js +0 -2
- package/dist/cli/chunks/cross-domain-router-PV3VQVLO.js +0 -2
- package/dist/cli/chunks/daemon-ESUEM6VB.js +0 -10
- package/dist/cli/chunks/domain-transfer-TQYO3SVG.js +0 -2
- package/dist/cli/chunks/dream-UFUXVJQC.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-MBG3SARO.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-5HXA3QB3.js +0 -2
- package/dist/cli/chunks/hnsw-index-PZRQWBRG.js +0 -2
- package/dist/cli/chunks/hybrid-router-NQRIE2GG.js +0 -2
- package/dist/cli/chunks/impact-analyzer-46347ZDV.js +0 -2
- package/dist/cli/chunks/init-wizard-CJYP4WKO.js +0 -2
- package/dist/cli/chunks/kernel-22KQZ56U.js +0 -2
- package/dist/cli/chunks/knowledge-graph-KM3JDBGR.js +0 -2
- package/dist/cli/chunks/llm-router-service-IFO6GRRO.js +0 -2
- package/dist/cli/chunks/load-test-TTKCYAPB.js +0 -2
- package/dist/cli/chunks/memory-backend-ELHCX2ZT.js +0 -2
- package/dist/cli/chunks/memory-handlers-3SKYQZTL.js +0 -2
- package/dist/cli/chunks/pattern-null-store-TMXAYD43.js +0 -2
- package/dist/cli/chunks/protocol-executor-BPLR5EJC.js +0 -2
- package/dist/cli/chunks/provider-manager-4MMD5QKL.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-P7KNT3WZ.js +0 -2
- package/dist/cli/chunks/queen-coordinator-NBZZ4MGC.js +0 -2
- package/dist/cli/chunks/router-2RXR6J2Q.js +0 -2
- package/dist/cli/chunks/routing-feedback-AVAA76TK.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-X2YDJA55.js +0 -2
- package/dist/cli/chunks/safe-db-4PRU65BK.js +0 -2
- package/dist/cli/chunks/schedule-2AST5CHW.js +0 -2
- package/dist/cli/chunks/scheduler-SW6II7OU.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-OB5NEGAK.js +0 -2
- package/dist/cli/chunks/status-handler-HFPWSCBY.js +0 -45
- package/dist/cli/chunks/unified-memory-X7OJYGSD.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-O6HOD5YL.js +0 -2
- package/dist/cli/chunks/unified-persistence-C332CER2.js +0 -2
- package/dist/cli/chunks/visual-security-MPUG5HPI.js +0 -2
- package/dist/cli/chunks/witness-chain-Q4BZHPDF.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-4NDWECYK.js +0 -2
|
@@ -181,7 +181,7 @@ export class TestExecutionPlugin extends BaseDomainPlugin {
|
|
|
181
181
|
eventId: event.id,
|
|
182
182
|
timestamp: event.timestamp,
|
|
183
183
|
sourceFiles: payload.sourceFiles,
|
|
184
|
-
}, { namespace: 'test-execution', ttl:
|
|
184
|
+
}, { namespace: 'test-execution', ttl: 86400 } // 24 hours (ttl is in SECONDS — unified-memory.ts:607)
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
187
|
async handleQualityGateEvaluated(event) {
|
|
@@ -192,7 +192,7 @@ export class TestExecutionPlugin extends BaseDomainPlugin {
|
|
|
192
192
|
await this.memory.set(`quality-context:${payload.gateId}`, {
|
|
193
193
|
requiresRetry: true,
|
|
194
194
|
failedChecks: payload.checks.filter(c => !c.passed).map(c => c.name),
|
|
195
|
-
}, { namespace: 'test-execution', ttl:
|
|
195
|
+
}, { namespace: 'test-execution', ttl: 3600 } // 1 hour (ttl is in SECONDS — unified-memory.ts:607)
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
this.updateHealth({
|
|
@@ -92,7 +92,7 @@ export class FlakyDetectorService {
|
|
|
92
92
|
this.analysisCache.set(testId, cachedAnalysis);
|
|
93
93
|
await this.memory.set(`flaky-analysis:${testId}`, cachedAnalysis, {
|
|
94
94
|
namespace: 'test-execution',
|
|
95
|
-
ttl:
|
|
95
|
+
ttl: 3600, // 1 hour (ttl is in SECONDS — unified-memory.ts:607)
|
|
96
96
|
});
|
|
97
97
|
return ok(analysis);
|
|
98
98
|
}
|
|
@@ -350,7 +350,7 @@ export class TestGenerationCoordinator extends BaseDomainCoordinator {
|
|
|
350
350
|
if (this.config.publishEvents) {
|
|
351
351
|
await this.publishTestSuiteCreated(result.value, request);
|
|
352
352
|
for (const test of result.value.tests) {
|
|
353
|
-
await this.publishTestGenerated(test, request.framework ?? 'vitest');
|
|
353
|
+
await this.publishTestGenerated(test, request.framework ?? 'vitest', result.value.patternsUsed);
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
// Three-loop protocol: instantAdapt must precede recordOutcome
|
|
@@ -631,13 +631,14 @@ export class TestGenerationCoordinator extends BaseDomainCoordinator {
|
|
|
631
631
|
// ============================================================================
|
|
632
632
|
// Event Publishing Methods
|
|
633
633
|
// ============================================================================
|
|
634
|
-
async publishTestGenerated(test, framework) {
|
|
634
|
+
async publishTestGenerated(test, framework, patternsUsed) {
|
|
635
635
|
const payload = {
|
|
636
636
|
testId: test.id,
|
|
637
637
|
testFile: test.testFile,
|
|
638
638
|
framework,
|
|
639
639
|
sourceFile: test.sourceFile,
|
|
640
640
|
testType: test.type,
|
|
641
|
+
patternsUsed,
|
|
641
642
|
};
|
|
642
643
|
const event = createEvent(TestGenerationEvents.TestGenerated, 'test-generation', payload);
|
|
643
644
|
await this.eventBus.publish(event);
|
|
@@ -889,14 +890,27 @@ export class TestGenerationCoordinator extends BaseDomainCoordinator {
|
|
|
889
890
|
// Pattern Learning
|
|
890
891
|
// ============================================================================
|
|
891
892
|
async learnFromGeneration(tests) {
|
|
892
|
-
//
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
893
|
+
// A7: this was previously a no-op — the comment claimed usage tracking
|
|
894
|
+
// "is handled internally by recordPatternUsage" but nothing was ever
|
|
895
|
+
// called, and tests.patternsUsed (display names) wasn't even a valid
|
|
896
|
+
// pattern ID to begin with. Only called on the success path (coordinator
|
|
897
|
+
// line ~618), so success:true is honest here.
|
|
898
|
+
const patternIds = tests.patternIds ?? [];
|
|
899
|
+
if (patternIds.length === 0)
|
|
900
|
+
return;
|
|
901
|
+
try {
|
|
902
|
+
const { getUnifiedMemory } = await import('../../kernel/unified-memory.js');
|
|
903
|
+
const { recordPatternUsage } = await import('../../learning/pattern-usage-recorder.js');
|
|
904
|
+
const db = getUnifiedMemory().getDatabase();
|
|
905
|
+
for (const patternId of patternIds) {
|
|
906
|
+
recordPatternUsage(db, { patternId, success: true });
|
|
898
907
|
}
|
|
899
908
|
}
|
|
909
|
+
catch (error) {
|
|
910
|
+
logger.warn('Pattern usage recording skipped', {
|
|
911
|
+
error: error instanceof Error ? error.message : String(error),
|
|
912
|
+
});
|
|
913
|
+
}
|
|
900
914
|
}
|
|
901
915
|
// ============================================================================
|
|
902
916
|
// @ruvector Integration Methods (ADR-040)
|
|
@@ -42,7 +42,10 @@ export interface IGenerateTestsRequest {
|
|
|
42
42
|
export interface IGeneratedTests {
|
|
43
43
|
tests: IGeneratedTest[];
|
|
44
44
|
coverageEstimate: number;
|
|
45
|
+
/** Human-readable pattern names, for display (reports, CLI output). */
|
|
45
46
|
patternsUsed: string[];
|
|
47
|
+
/** Real qe_patterns.id values for the same patterns, for usage/ADR-110 tracking. */
|
|
48
|
+
patternIds?: string[];
|
|
46
49
|
}
|
|
47
50
|
export interface IGeneratedTest {
|
|
48
51
|
id: string;
|
|
@@ -302,11 +302,13 @@ Return a JSON array of test suggestions, each with: { "name": "test name", "desc
|
|
|
302
302
|
}
|
|
303
303
|
const tests = [];
|
|
304
304
|
const patternsUsed = [];
|
|
305
|
+
const patternIds = [];
|
|
305
306
|
for (const sourceFile of sourceFiles) {
|
|
306
307
|
const fileTests = await this.generateTestsForFile(sourceFile, testType, effectiveFramework, patterns, effectiveLanguage, request);
|
|
307
308
|
if (fileTests.success) {
|
|
308
309
|
tests.push(...fileTests.value.tests);
|
|
309
310
|
patternsUsed.push(...fileTests.value.patternsUsed);
|
|
311
|
+
patternIds.push(...fileTests.value.patternIds);
|
|
310
312
|
}
|
|
311
313
|
}
|
|
312
314
|
// ADR-062 Tier 2: Mark holdout tests when feature flag is enabled
|
|
@@ -323,6 +325,7 @@ Return a JSON array of test suggestions, each with: { "name": "test name", "desc
|
|
|
323
325
|
tests,
|
|
324
326
|
coverageEstimate,
|
|
325
327
|
patternsUsed: Array.from(new Set(patternsUsed)),
|
|
328
|
+
patternIds: Array.from(new Set(patternIds)),
|
|
326
329
|
});
|
|
327
330
|
}
|
|
328
331
|
catch (error) {
|
|
@@ -396,8 +399,13 @@ Return a JSON array of test suggestions, each with: { "name": "test name", "desc
|
|
|
396
399
|
async generateTestsForFile(sourceFile, testType, framework, patterns, effectiveLanguage, originalRequest) {
|
|
397
400
|
const testFile = this.getTestFilePath(sourceFile, framework);
|
|
398
401
|
const patternsUsed = [];
|
|
402
|
+
// Real qe_patterns.id values, parallel to patternsUsed (names) — feeds
|
|
403
|
+
// recordPatternUsage/ADR-110 appliedPatternIds, which would silently
|
|
404
|
+
// no-op against a display name instead of a real pattern ID.
|
|
405
|
+
const patternIds = [];
|
|
399
406
|
const applicablePatterns = await this.findApplicablePatterns(sourceFile, patterns);
|
|
400
407
|
patternsUsed.push(...applicablePatterns.map((p) => p.name));
|
|
408
|
+
patternIds.push(...applicablePatterns.map((p) => p.id));
|
|
401
409
|
let codeAnalysis = null;
|
|
402
410
|
let sourceContent = '';
|
|
403
411
|
try {
|
|
@@ -470,7 +478,7 @@ Return a JSON array of test suggestions, each with: { "name": "test name", "desc
|
|
|
470
478
|
if (this.qualityGate) {
|
|
471
479
|
test.qualityGateResult = this.qualityGate.validate(testCode, sourceFile, sourceContent || undefined);
|
|
472
480
|
}
|
|
473
|
-
return ok({ tests: [test], patternsUsed });
|
|
481
|
+
return ok({ tests: [test], patternsUsed, patternIds });
|
|
474
482
|
}
|
|
475
483
|
async generateTestForLines(file, lines, framework) {
|
|
476
484
|
if (lines.length === 0)
|
|
@@ -8,7 +8,16 @@
|
|
|
8
8
|
* @module integrations/ruvector/delta-tracker
|
|
9
9
|
*/
|
|
10
10
|
import { v4 as uuidv4 } from 'uuid';
|
|
11
|
-
import * as
|
|
11
|
+
import * as fastJsonPatchNs from 'fast-json-patch';
|
|
12
|
+
// fast-json-patch ships two entry points with different export shapes: its CJS
|
|
13
|
+
// entry (index.js) attaches named exports directly via Object.assign(exports,
|
|
14
|
+
// core), but its ESM entry (index.mjs) only exports a single default object
|
|
15
|
+
// bundling everything — it has no named `compare`/`applyPatch` exports. Which
|
|
16
|
+
// shape `import * as fastJsonPatchNs` lands on depends on the resolving
|
|
17
|
+
// loader/bundler, so `fastJsonPatchNs.compare` can be undefined even though
|
|
18
|
+
// the package is installed and working. Normalize once so callers don't care.
|
|
19
|
+
const fastJsonPatch = (fastJsonPatchNs.default
|
|
20
|
+
?? fastJsonPatchNs);
|
|
12
21
|
// ============================================================================
|
|
13
22
|
// Schema
|
|
14
23
|
// ============================================================================
|
|
@@ -441,6 +441,13 @@ export function isHyperbolicHnswEnabled() {
|
|
|
441
441
|
*/
|
|
442
442
|
export function initFeatureFlagsFromEnv() {
|
|
443
443
|
const envFlags = {};
|
|
444
|
+
// RVF-backed PatternStore (ADR-066). Was the only flag WITHOUT an env override,
|
|
445
|
+
// so an environment where RVF native init fails (e.g. `RVF error 0x0303:
|
|
446
|
+
// FsyncFailed` on a macOS virtiofs bind mount) had no runtime way to fall back
|
|
447
|
+
// to the SQLite HNSW PatternStore. Set RUVECTOR_USE_RVF_PATTERN_STORE=false there.
|
|
448
|
+
if (process.env.RUVECTOR_USE_RVF_PATTERN_STORE !== undefined) {
|
|
449
|
+
envFlags.useRVFPatternStore = process.env.RUVECTOR_USE_RVF_PATTERN_STORE === 'true';
|
|
450
|
+
}
|
|
444
451
|
if (process.env.RUVECTOR_USE_SONA !== undefined) {
|
|
445
452
|
envFlags.useQESONA = process.env.RUVECTOR_USE_SONA === 'true';
|
|
446
453
|
}
|
|
@@ -194,6 +194,11 @@ export declare class PersistentSONAEngine {
|
|
|
194
194
|
* @returns Adaptation result, or null if three-loop engine not initialized
|
|
195
195
|
*/
|
|
196
196
|
instantAdapt(requestFeatures: number[]): import('./sona-three-loop.js').AdaptationResult | null;
|
|
197
|
+
/**
|
|
198
|
+
* Get the three-loop engine's current request count (A10), or null if the
|
|
199
|
+
* three-loop engine is not active.
|
|
200
|
+
*/
|
|
201
|
+
getRequestCount(): number | null;
|
|
197
202
|
/**
|
|
198
203
|
* Record the outcome of a request for REINFORCE-style gradient estimation (Loop 1b).
|
|
199
204
|
*
|
|
@@ -356,6 +361,25 @@ export declare class PersistentSONAEngine {
|
|
|
356
361
|
* @returns true if a row was deleted
|
|
357
362
|
*/
|
|
358
363
|
deleteFisherMatrix(domain: string): boolean;
|
|
364
|
+
/**
|
|
365
|
+
* A10 fix: persist the three-loop engine's request counter independently
|
|
366
|
+
* of the Fisher row, in kv_store (namespace 'sona'). Consolidation (the
|
|
367
|
+
* thing that writes the FIRST Fisher row) requires requestCount to reach
|
|
368
|
+
* consolidationInterval — but requestCount previously only survived via
|
|
369
|
+
* restoreFisher(), which only runs once a Fisher row already exists.
|
|
370
|
+
* Fresh short-lived CLI/MCP processes doing ~1 instantAdapt() each could
|
|
371
|
+
* never accumulate past the threshold: cold-start deadlock. This lets the
|
|
372
|
+
* counter accumulate across process restarts before any consolidation
|
|
373
|
+
* has ever happened.
|
|
374
|
+
*/
|
|
375
|
+
saveRequestCount(domain: string, requestCount: number): void;
|
|
376
|
+
/** Load the persisted request counter for a domain, or null if never saved. */
|
|
377
|
+
loadRequestCount(domain: string): number | null;
|
|
378
|
+
/**
|
|
379
|
+
* Internal variant of loadRequestCount that skips ensureInitialized() —
|
|
380
|
+
* used during _doInitialize(), mirroring _loadFisherMatrixUnsafe.
|
|
381
|
+
*/
|
|
382
|
+
private _loadRequestCountUnsafe;
|
|
359
383
|
/**
|
|
360
384
|
* Set or update the server client for cross-process pattern sharing
|
|
361
385
|
*/
|
|
@@ -187,6 +187,23 @@ export class PersistentSONAEngine {
|
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
+
else {
|
|
191
|
+
// A10 fix: no Fisher row exists yet (the common case pre-first-
|
|
192
|
+
// consolidation), but the request counter may still have
|
|
193
|
+
// accumulated across prior short-lived processes — restore it
|
|
194
|
+
// independently so it isn't reset to 0 every time.
|
|
195
|
+
const savedCount = this._loadRequestCountUnsafe(this.config.domain);
|
|
196
|
+
if (savedCount !== null) {
|
|
197
|
+
const engine = this.baseEngine.getThreeLoopEngine();
|
|
198
|
+
if (engine) {
|
|
199
|
+
engine.restoreRequestCount(savedCount);
|
|
200
|
+
logger.info('Three-loop engine restored request count independently of Fisher state', {
|
|
201
|
+
domain: this.config.domain,
|
|
202
|
+
requestCount: savedCount,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
190
207
|
logger.info('Three-loop engine initialized with Fisher persistence', {
|
|
191
208
|
domain: this.config.domain,
|
|
192
209
|
});
|
|
@@ -569,6 +586,14 @@ export class PersistentSONAEngine {
|
|
|
569
586
|
this.ensureInitialized();
|
|
570
587
|
return this.baseEngine.instantAdapt(requestFeatures);
|
|
571
588
|
}
|
|
589
|
+
/**
|
|
590
|
+
* Get the three-loop engine's current request count (A10), or null if the
|
|
591
|
+
* three-loop engine is not active.
|
|
592
|
+
*/
|
|
593
|
+
getRequestCount() {
|
|
594
|
+
this.ensureInitialized();
|
|
595
|
+
return this.baseEngine.getThreeLoopEngine()?.getRequestCount() ?? null;
|
|
596
|
+
}
|
|
572
597
|
/**
|
|
573
598
|
* Record the outcome of a request for REINFORCE-style gradient estimation (Loop 1b).
|
|
574
599
|
*
|
|
@@ -771,6 +796,19 @@ export class PersistentSONAEngine {
|
|
|
771
796
|
}
|
|
772
797
|
this.pendingSaves.clear();
|
|
773
798
|
}
|
|
799
|
+
// A10 fix: checkpoint the request counter once per process lifetime
|
|
800
|
+
// (cheap — not on the instantAdapt hot path) so short-lived CLI/MCP
|
|
801
|
+
// processes accumulate progress toward consolidationInterval instead of
|
|
802
|
+
// resetting to 0 every time.
|
|
803
|
+
try {
|
|
804
|
+
const engine = this.baseEngine.getThreeLoopEngine();
|
|
805
|
+
if (engine && this.db) {
|
|
806
|
+
this.saveRequestCount(this.config.domain, engine.getRequestCount());
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
catch (err) {
|
|
810
|
+
console.warn('[PersistentSONAEngine] Request count checkpoint failed:', err instanceof Error ? err.message : err);
|
|
811
|
+
}
|
|
774
812
|
this.prepared.clear();
|
|
775
813
|
this.db = null;
|
|
776
814
|
this.persistence = null;
|
|
@@ -866,6 +904,44 @@ export class PersistentSONAEngine {
|
|
|
866
904
|
const result = stmt.run(domain);
|
|
867
905
|
return result.changes > 0;
|
|
868
906
|
}
|
|
907
|
+
/**
|
|
908
|
+
* A10 fix: persist the three-loop engine's request counter independently
|
|
909
|
+
* of the Fisher row, in kv_store (namespace 'sona'). Consolidation (the
|
|
910
|
+
* thing that writes the FIRST Fisher row) requires requestCount to reach
|
|
911
|
+
* consolidationInterval — but requestCount previously only survived via
|
|
912
|
+
* restoreFisher(), which only runs once a Fisher row already exists.
|
|
913
|
+
* Fresh short-lived CLI/MCP processes doing ~1 instantAdapt() each could
|
|
914
|
+
* never accumulate past the threshold: cold-start deadlock. This lets the
|
|
915
|
+
* counter accumulate across process restarts before any consolidation
|
|
916
|
+
* has ever happened.
|
|
917
|
+
*/
|
|
918
|
+
saveRequestCount(domain, requestCount) {
|
|
919
|
+
if (!this.db)
|
|
920
|
+
return;
|
|
921
|
+
this.db.prepare(`
|
|
922
|
+
INSERT INTO kv_store (namespace, key, value)
|
|
923
|
+
VALUES ('sona', ?, ?)
|
|
924
|
+
ON CONFLICT(namespace, key) DO UPDATE SET value = excluded.value
|
|
925
|
+
`).run(`request-count:${domain}`, String(requestCount));
|
|
926
|
+
}
|
|
927
|
+
/** Load the persisted request counter for a domain, or null if never saved. */
|
|
928
|
+
loadRequestCount(domain) {
|
|
929
|
+
this.ensureInitialized();
|
|
930
|
+
return this._loadRequestCountUnsafe(domain);
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Internal variant of loadRequestCount that skips ensureInitialized() —
|
|
934
|
+
* used during _doInitialize(), mirroring _loadFisherMatrixUnsafe.
|
|
935
|
+
*/
|
|
936
|
+
_loadRequestCountUnsafe(domain) {
|
|
937
|
+
if (!this.db)
|
|
938
|
+
return null;
|
|
939
|
+
const row = this.db.prepare(`SELECT value FROM kv_store WHERE namespace = 'sona' AND key = ?`).get(`request-count:${domain}`);
|
|
940
|
+
if (!row)
|
|
941
|
+
return null;
|
|
942
|
+
const parsed = Number(row.value);
|
|
943
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
944
|
+
}
|
|
869
945
|
// ==========================================================================
|
|
870
946
|
// Server Integration
|
|
871
947
|
// ==========================================================================
|
|
@@ -335,6 +335,21 @@ export declare class SONAThreeLoopEngine {
|
|
|
335
335
|
getEffectiveWeights(): Float32Array;
|
|
336
336
|
/** Get the total number of requests processed */
|
|
337
337
|
getRequestCount(): number;
|
|
338
|
+
/**
|
|
339
|
+
* Restore the request counter independently of Fisher state (A10 fix).
|
|
340
|
+
*
|
|
341
|
+
* Previously requestCount only survived process restarts via
|
|
342
|
+
* restoreFisher(), which only runs `if (saved)` — i.e. only after a
|
|
343
|
+
* Fisher row already exists. Since consolidation (the thing that WRITES
|
|
344
|
+
* the first Fisher row) requires requestCount to reach
|
|
345
|
+
* consolidationInterval (default 100), and each CLI/MCP invocation is a
|
|
346
|
+
* fresh short-lived process doing ~1 instantAdapt() call, requestCount
|
|
347
|
+
* could never accumulate across processes: cold-start deadlock, 0 rows
|
|
348
|
+
* in sona_fisher_matrices forever. Call this at init (independently of
|
|
349
|
+
* whether a Fisher row exists) so the counter accumulates across process
|
|
350
|
+
* restarts even before the first consolidation ever happens.
|
|
351
|
+
*/
|
|
352
|
+
restoreRequestCount(count: number): void;
|
|
338
353
|
/** Get the engine configuration */
|
|
339
354
|
getConfig(): ThreeLoopConfig;
|
|
340
355
|
/** Get the connected peer states */
|
|
@@ -712,6 +712,23 @@ export class SONAThreeLoopEngine {
|
|
|
712
712
|
getRequestCount() {
|
|
713
713
|
return this.requestCount;
|
|
714
714
|
}
|
|
715
|
+
/**
|
|
716
|
+
* Restore the request counter independently of Fisher state (A10 fix).
|
|
717
|
+
*
|
|
718
|
+
* Previously requestCount only survived process restarts via
|
|
719
|
+
* restoreFisher(), which only runs `if (saved)` — i.e. only after a
|
|
720
|
+
* Fisher row already exists. Since consolidation (the thing that WRITES
|
|
721
|
+
* the first Fisher row) requires requestCount to reach
|
|
722
|
+
* consolidationInterval (default 100), and each CLI/MCP invocation is a
|
|
723
|
+
* fresh short-lived process doing ~1 instantAdapt() call, requestCount
|
|
724
|
+
* could never accumulate across processes: cold-start deadlock, 0 rows
|
|
725
|
+
* in sona_fisher_matrices forever. Call this at init (independently of
|
|
726
|
+
* whether a Fisher row exists) so the counter accumulates across process
|
|
727
|
+
* restarts even before the first consolidation ever happens.
|
|
728
|
+
*/
|
|
729
|
+
restoreRequestCount(count) {
|
|
730
|
+
this.requestCount = count;
|
|
731
|
+
}
|
|
715
732
|
/** Get the engine configuration */
|
|
716
733
|
getConfig() {
|
|
717
734
|
return { ...this.config };
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
import { HYPERGRAPH_SCHEMA } from '../migrations/20260120_add_hypergraph_tables.js';
|
|
8
8
|
import { PATTERN_NULLS_SCHEMA } from '../migrations/20260611_add_pattern_nulls_table.js';
|
|
9
9
|
export { HYPERGRAPH_SCHEMA, PATTERN_NULLS_SCHEMA };
|
|
10
|
-
export declare const SCHEMA_VERSION =
|
|
10
|
+
export declare const SCHEMA_VERSION = 11;
|
|
11
11
|
export declare const SCHEMA_VERSION_TABLE = "\n CREATE TABLE IF NOT EXISTS schema_version (\n id INTEGER PRIMARY KEY CHECK (id = 1),\n version INTEGER NOT NULL,\n migrated_at TEXT DEFAULT (datetime('now'))\n );\n";
|
|
12
12
|
export declare const KV_STORE_SCHEMA = "\n -- Key-Value Store (v2 compatible - same schema as HybridBackend)\n CREATE TABLE IF NOT EXISTS kv_store (\n key TEXT NOT NULL,\n namespace TEXT NOT NULL,\n value TEXT NOT NULL,\n expires_at INTEGER,\n created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),\n PRIMARY KEY (namespace, key)\n );\n CREATE INDEX IF NOT EXISTS idx_kv_namespace ON kv_store(namespace);\n CREATE INDEX IF NOT EXISTS idx_kv_expires ON kv_store(expires_at) WHERE expires_at IS NOT NULL;\n";
|
|
13
13
|
export declare const VECTORS_SCHEMA = "\n -- Vector Embeddings (new in v3 - replaces in-memory AgentDB)\n CREATE TABLE IF NOT EXISTS vectors (\n id TEXT PRIMARY KEY,\n namespace TEXT NOT NULL DEFAULT 'default',\n embedding BLOB NOT NULL,\n dimensions INTEGER NOT NULL,\n metadata TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now'))\n );\n CREATE INDEX IF NOT EXISTS idx_vectors_namespace ON vectors(namespace);\n CREATE INDEX IF NOT EXISTS idx_vectors_dimensions ON vectors(dimensions);\n";
|
|
14
14
|
export declare const RL_QVALUES_SCHEMA = "\n -- Q-Values for RL algorithms (ADR-046)\n CREATE TABLE IF NOT EXISTS rl_q_values (\n id TEXT PRIMARY KEY,\n algorithm TEXT NOT NULL,\n agent_id TEXT NOT NULL,\n state_key TEXT NOT NULL,\n action_key TEXT NOT NULL,\n q_value REAL NOT NULL DEFAULT 0.0,\n visits INTEGER NOT NULL DEFAULT 0,\n last_reward REAL,\n domain TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n UNIQUE(algorithm, agent_id, state_key, action_key)\n );\n CREATE INDEX IF NOT EXISTS idx_qvalues_agent ON rl_q_values(agent_id);\n CREATE INDEX IF NOT EXISTS idx_qvalues_algorithm ON rl_q_values(algorithm);\n CREATE INDEX IF NOT EXISTS idx_qvalues_state ON rl_q_values(agent_id, state_key);\n CREATE INDEX IF NOT EXISTS idx_qvalues_domain ON rl_q_values(domain);\n CREATE INDEX IF NOT EXISTS idx_qvalues_updated ON rl_q_values(updated_at);\n";
|
|
15
|
-
export declare const GOAP_SCHEMA = "\n -- GOAP Goals\n CREATE TABLE IF NOT EXISTS goap_goals (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n description TEXT,\n conditions TEXT NOT NULL,\n priority INTEGER DEFAULT 3,\n qe_domain TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- GOAP Actions\n CREATE TABLE IF NOT EXISTS goap_actions (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n description TEXT,\n agent_type TEXT NOT NULL,\n preconditions TEXT NOT NULL,\n effects TEXT NOT NULL,\n cost REAL DEFAULT 1.0,\n estimated_duration_ms INTEGER,\n success_rate REAL DEFAULT 1.0,\n execution_count INTEGER DEFAULT 0,\n category TEXT NOT NULL,\n qe_domain TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now'))\n );\n\n -- GOAP Plans\n CREATE TABLE IF NOT EXISTS goap_plans (\n id TEXT PRIMARY KEY,\n goal_id TEXT,\n initial_state TEXT NOT NULL,\n goal_state TEXT NOT NULL,\n action_sequence TEXT NOT NULL,\n total_cost REAL,\n estimated_duration_ms INTEGER,\n status TEXT DEFAULT 'pending',\n reused_from TEXT,\n similarity_score REAL,\n created_at TEXT DEFAULT (datetime('now')),\n executed_at TEXT,\n completed_at TEXT,\n FOREIGN KEY (goal_id) REFERENCES goap_goals(id)\n );\n\n -- Plan Signatures (for similarity matching)\n CREATE TABLE IF NOT EXISTS goap_plan_signatures (\n id TEXT PRIMARY KEY,\n plan_id TEXT NOT NULL UNIQUE,\n goal_hash TEXT NOT NULL,\n state_vector TEXT NOT NULL,\n action_sequence TEXT NOT NULL,\n total_cost REAL NOT NULL,\n success_rate REAL DEFAULT 1.0,\n usage_count INTEGER DEFAULT 0,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- GOAP Indexes\n CREATE INDEX IF NOT EXISTS idx_goap_actions_category ON goap_actions(category);\n CREATE INDEX IF NOT EXISTS idx_goap_actions_agent ON goap_actions(agent_type);\n CREATE INDEX IF NOT EXISTS idx_goap_plans_status ON goap_plans(status);\n CREATE INDEX IF NOT EXISTS idx_goap_sig_goal ON goap_plan_signatures(goal_hash);\n";
|
|
15
|
+
export declare const GOAP_SCHEMA = "\n -- GOAP Goals\n CREATE TABLE IF NOT EXISTS goap_goals (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n description TEXT,\n conditions TEXT NOT NULL,\n priority INTEGER DEFAULT 3,\n qe_domain TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- GOAP Actions\n CREATE TABLE IF NOT EXISTS goap_actions (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n description TEXT,\n agent_type TEXT NOT NULL,\n preconditions TEXT NOT NULL,\n effects TEXT NOT NULL,\n cost REAL DEFAULT 1.0,\n estimated_duration_ms INTEGER,\n success_rate REAL DEFAULT 1.0,\n execution_count INTEGER DEFAULT 0,\n category TEXT NOT NULL,\n qe_domain TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n -- A14: real domain API method binding (kernel.getDomainAPI(qe_domain)[method](params)).\n -- method/implemented are NULL/0 for actions with no real backing yet \u2014\n -- GOAPExecutor must report those as \"not implemented\", never simulate them.\n method TEXT,\n params TEXT,\n implemented INTEGER DEFAULT 0\n );\n\n -- GOAP Plans\n CREATE TABLE IF NOT EXISTS goap_plans (\n id TEXT PRIMARY KEY,\n goal_id TEXT,\n initial_state TEXT NOT NULL,\n goal_state TEXT NOT NULL,\n action_sequence TEXT NOT NULL,\n total_cost REAL,\n estimated_duration_ms INTEGER,\n status TEXT DEFAULT 'pending',\n reused_from TEXT,\n similarity_score REAL,\n created_at TEXT DEFAULT (datetime('now')),\n executed_at TEXT,\n completed_at TEXT,\n FOREIGN KEY (goal_id) REFERENCES goap_goals(id)\n );\n\n -- Plan Signatures (for similarity matching)\n CREATE TABLE IF NOT EXISTS goap_plan_signatures (\n id TEXT PRIMARY KEY,\n plan_id TEXT NOT NULL UNIQUE,\n goal_hash TEXT NOT NULL,\n state_vector TEXT NOT NULL,\n action_sequence TEXT NOT NULL,\n total_cost REAL NOT NULL,\n success_rate REAL DEFAULT 1.0,\n usage_count INTEGER DEFAULT 0,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- A14: canonical per-step execution history (was previously undefined in\n -- this schema \u2014 plan-executor.ts invented its own parallel\n -- execution_results/executed_steps tables instead). One row per action\n -- step per execution attempt (execution_id groups steps from the same\n -- plan.execute() call, since a plan can be executed/retried more than\n -- once). Aggregate per-execution stats (steps completed/failed, total\n -- duration, final world state) are derived by querying this table rather\n -- than maintained in a separate denormalized summary table.\n CREATE TABLE IF NOT EXISTS goap_execution_steps (\n id TEXT PRIMARY KEY,\n plan_id TEXT NOT NULL,\n execution_id TEXT NOT NULL,\n action_id TEXT NOT NULL,\n step_order INTEGER NOT NULL,\n world_state_before TEXT,\n world_state_after TEXT,\n status TEXT NOT NULL DEFAULT 'pending',\n retries INTEGER DEFAULT 0,\n started_at TEXT,\n duration_ms INTEGER,\n agent_id TEXT,\n agent_output TEXT,\n error_message TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n -- Deliberately no FK to goap_plans/goap_actions: PlanExecutor.execute()\n -- can legitimately run an ad-hoc GOAPPlan/GOAPAction that was never\n -- saved via savePlan()/addAction() (e.g. programmatic orchestration\n -- bypassing the A* planner). unified-memory.ts enables the\n -- foreign_keys pragma, so an enforced FK here would reject that\n -- entirely legitimate usage, not just catch real corruption.\n );\n\n -- GOAP Indexes\n CREATE INDEX IF NOT EXISTS idx_goap_actions_category ON goap_actions(category);\n CREATE INDEX IF NOT EXISTS idx_goap_actions_agent ON goap_actions(agent_type);\n CREATE INDEX IF NOT EXISTS idx_goap_plans_status ON goap_plans(status);\n CREATE INDEX IF NOT EXISTS idx_goap_sig_goal ON goap_plan_signatures(goal_hash);\n CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_plan ON goap_execution_steps(plan_id);\n CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_action ON goap_execution_steps(action_id);\n -- idx_goap_exec_steps_execution is NOT created here: databases with a\n -- pre-existing narrower goap_execution_steps table (missing execution_id)\n -- would fail on \"no such column\" since CREATE TABLE IF NOT EXISTS above\n -- silently no-ops against them. unified-memory.ts's v11 migration creates\n -- this index only after confirming/backfilling the column.\n";
|
|
16
16
|
export declare const DREAM_SCHEMA = "\n -- Concept Graph Nodes (Dream Engine)\n CREATE TABLE IF NOT EXISTS concept_nodes (\n id TEXT PRIMARY KEY,\n concept_type TEXT NOT NULL,\n content TEXT NOT NULL,\n embedding BLOB,\n activation_level REAL DEFAULT 0.0,\n last_activated TEXT,\n pattern_id TEXT,\n metadata TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- Concept Edges\n CREATE TABLE IF NOT EXISTS concept_edges (\n id TEXT PRIMARY KEY,\n source TEXT NOT NULL,\n target TEXT NOT NULL,\n weight REAL NOT NULL DEFAULT 1.0,\n edge_type TEXT NOT NULL,\n evidence INTEGER DEFAULT 1,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (source) REFERENCES concept_nodes(id) ON DELETE CASCADE,\n FOREIGN KEY (target) REFERENCES concept_nodes(id) ON DELETE CASCADE\n );\n\n -- Dream Cycles\n CREATE TABLE IF NOT EXISTS dream_cycles (\n id TEXT PRIMARY KEY,\n start_time TEXT NOT NULL,\n end_time TEXT,\n duration_ms INTEGER,\n concepts_processed INTEGER DEFAULT 0,\n associations_found INTEGER DEFAULT 0,\n insights_generated INTEGER DEFAULT 0,\n status TEXT DEFAULT 'running',\n error TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- Dream Insights\n CREATE TABLE IF NOT EXISTS dream_insights (\n id TEXT PRIMARY KEY,\n cycle_id TEXT NOT NULL,\n insight_type TEXT NOT NULL,\n source_concepts TEXT NOT NULL,\n description TEXT NOT NULL,\n novelty_score REAL DEFAULT 0.5,\n confidence_score REAL DEFAULT 0.5,\n actionable INTEGER DEFAULT 0,\n applied INTEGER DEFAULT 0,\n suggested_action TEXT,\n pattern_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (cycle_id) REFERENCES dream_cycles(id) ON DELETE CASCADE\n );\n\n -- Dream Indexes\n CREATE INDEX IF NOT EXISTS idx_concept_type ON concept_nodes(concept_type);\n CREATE INDEX IF NOT EXISTS idx_concept_activation ON concept_nodes(activation_level);\n CREATE INDEX IF NOT EXISTS idx_concept_pattern ON concept_nodes(pattern_id);\n CREATE INDEX IF NOT EXISTS idx_edge_source ON concept_edges(source);\n CREATE INDEX IF NOT EXISTS idx_edge_target ON concept_edges(target);\n CREATE INDEX IF NOT EXISTS idx_edge_type ON concept_edges(edge_type);\n CREATE INDEX IF NOT EXISTS idx_edge_weight ON concept_edges(weight DESC);\n CREATE INDEX IF NOT EXISTS idx_insight_cycle ON dream_insights(cycle_id);\n CREATE INDEX IF NOT EXISTS idx_dream_status ON dream_cycles(status);\n";
|
|
17
17
|
export declare const QE_PATTERNS_SCHEMA = "\n -- QE Patterns table (unified from sqlite-persistence.ts)\n CREATE TABLE IF NOT EXISTS qe_patterns (\n id TEXT PRIMARY KEY,\n pattern_type TEXT NOT NULL,\n qe_domain TEXT NOT NULL,\n domain TEXT NOT NULL,\n name TEXT NOT NULL,\n description TEXT,\n confidence REAL DEFAULT 0.5,\n usage_count INTEGER DEFAULT 0,\n success_rate REAL DEFAULT 0.0,\n quality_score REAL DEFAULT 0.0,\n tier TEXT DEFAULT 'short-term',\n template_json TEXT,\n context_json TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n last_used_at TEXT,\n successful_uses INTEGER DEFAULT 0,\n tokens_used INTEGER,\n input_tokens INTEGER,\n output_tokens INTEGER,\n latency_ms REAL,\n reusable INTEGER DEFAULT 0,\n reuse_count INTEGER DEFAULT 0,\n average_token_savings REAL DEFAULT 0,\n total_tokens_saved INTEGER\n );\n\n -- Pattern embeddings table (BLOB storage for vectors)\n CREATE TABLE IF NOT EXISTS qe_pattern_embeddings (\n pattern_id TEXT PRIMARY KEY,\n embedding BLOB NOT NULL,\n dimension INTEGER NOT NULL,\n model TEXT DEFAULT 'all-MiniLM-L6-v2',\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (pattern_id) REFERENCES qe_patterns(id) ON DELETE CASCADE\n );\n\n -- Pattern usage history (no FK -- used as analytics log by hooks with synthetic IDs)\n CREATE TABLE IF NOT EXISTS qe_pattern_usage (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n pattern_id TEXT NOT NULL,\n success INTEGER NOT NULL,\n metrics_json TEXT,\n feedback TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- Learning trajectories\n CREATE TABLE IF NOT EXISTS qe_trajectories (\n id TEXT PRIMARY KEY,\n task TEXT NOT NULL,\n agent TEXT,\n domain TEXT,\n started_at TEXT DEFAULT (datetime('now')),\n ended_at TEXT,\n success INTEGER,\n steps_json TEXT,\n metadata_json TEXT\n );\n\n -- Embeddings table (unified from EmbeddingCache.ts)\n -- Renamed from 'embedding_cache' to 'embeddings' to match existing code\n CREATE TABLE IF NOT EXISTS embeddings (\n key TEXT NOT NULL,\n namespace TEXT NOT NULL,\n vector BLOB NOT NULL,\n dimension INTEGER NOT NULL,\n text TEXT NOT NULL,\n timestamp INTEGER NOT NULL,\n quantization TEXT NOT NULL,\n metadata TEXT,\n access_count INTEGER DEFAULT 1,\n last_access INTEGER NOT NULL,\n PRIMARY KEY (key, namespace)\n );\n\n -- Execution results table (unified from plan-executor.ts)\n CREATE TABLE IF NOT EXISTS execution_results (\n id TEXT PRIMARY KEY,\n plan_id TEXT NOT NULL,\n status TEXT NOT NULL,\n steps_completed INTEGER DEFAULT 0,\n steps_failed INTEGER DEFAULT 0,\n total_duration_ms INTEGER DEFAULT 0,\n final_world_state TEXT,\n error_message TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- Executed steps table (unified from plan-executor.ts)\n CREATE TABLE IF NOT EXISTS executed_steps (\n id TEXT PRIMARY KEY,\n execution_id TEXT NOT NULL,\n plan_id TEXT NOT NULL,\n action_id TEXT NOT NULL,\n step_order INTEGER NOT NULL,\n status TEXT NOT NULL,\n retries INTEGER DEFAULT 0,\n started_at TEXT NOT NULL,\n completed_at TEXT,\n duration_ms INTEGER,\n agent_id TEXT,\n agent_output TEXT,\n world_state_before TEXT,\n world_state_after TEXT,\n error_message TEXT,\n FOREIGN KEY (execution_id) REFERENCES execution_results(id)\n );\n\n -- FTS5 full-text search index for hybrid vector/text search\n CREATE VIRTUAL TABLE IF NOT EXISTS qe_patterns_fts USING fts5(\n name, description, pattern_type, qe_domain,\n content='qe_patterns',\n content_rowid='rowid'\n );\n\n -- FTS5 triggers to keep index in sync\n CREATE TRIGGER IF NOT EXISTS qe_patterns_fts_insert AFTER INSERT ON qe_patterns BEGIN\n INSERT INTO qe_patterns_fts(rowid, name, description, pattern_type, qe_domain)\n VALUES (new.rowid, new.name, new.description, new.pattern_type, new.qe_domain);\n END;\n\n CREATE TRIGGER IF NOT EXISTS qe_patterns_fts_delete AFTER DELETE ON qe_patterns BEGIN\n INSERT INTO qe_patterns_fts(qe_patterns_fts, rowid, name, description, pattern_type, qe_domain)\n VALUES ('delete', old.rowid, old.name, old.description, old.pattern_type, old.qe_domain);\n END;\n\n CREATE TRIGGER IF NOT EXISTS qe_patterns_fts_update AFTER UPDATE ON qe_patterns BEGIN\n INSERT INTO qe_patterns_fts(qe_patterns_fts, rowid, name, description, pattern_type, qe_domain)\n VALUES ('delete', old.rowid, old.name, old.description, old.pattern_type, old.qe_domain);\n INSERT INTO qe_patterns_fts(rowid, name, description, pattern_type, qe_domain)\n VALUES (new.rowid, new.name, new.description, new.pattern_type, new.qe_domain);\n END;\n\n -- QE Patterns indexes\n CREATE INDEX IF NOT EXISTS idx_qe_patterns_domain ON qe_patterns(qe_domain);\n CREATE INDEX IF NOT EXISTS idx_qe_patterns_type ON qe_patterns(pattern_type);\n CREATE INDEX IF NOT EXISTS idx_qe_patterns_tier ON qe_patterns(tier);\n CREATE INDEX IF NOT EXISTS idx_qe_patterns_quality ON qe_patterns(quality_score DESC);\n CREATE INDEX IF NOT EXISTS idx_qe_usage_pattern ON qe_pattern_usage(pattern_id);\n CREATE INDEX IF NOT EXISTS idx_qe_trajectories_domain ON qe_trajectories(domain);\n CREATE INDEX IF NOT EXISTS idx_embeddings_namespace ON embeddings(namespace);\n CREATE INDEX IF NOT EXISTS idx_embeddings_timestamp ON embeddings(timestamp);\n CREATE INDEX IF NOT EXISTS idx_execution_results_plan ON execution_results(plan_id);\n CREATE INDEX IF NOT EXISTS idx_execution_results_status ON execution_results(status);\n CREATE INDEX IF NOT EXISTS idx_executed_steps_execution ON executed_steps(execution_id);\n CREATE INDEX IF NOT EXISTS idx_executed_steps_action ON executed_steps(action_id);\n";
|
|
18
18
|
export declare const MINCUT_SCHEMA = "\n -- MinCut Graph Snapshots (ADR-047)\n CREATE TABLE IF NOT EXISTS mincut_snapshots (\n id TEXT PRIMARY KEY,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n vertex_count INTEGER NOT NULL,\n edge_count INTEGER NOT NULL,\n total_weight REAL NOT NULL DEFAULT 0.0,\n is_connected INTEGER NOT NULL DEFAULT 1,\n component_count INTEGER NOT NULL DEFAULT 1,\n vertices_json TEXT NOT NULL,\n edges_json TEXT NOT NULL,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- MinCut History (time-series MinCut values)\n CREATE TABLE IF NOT EXISTS mincut_history (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n mincut_value REAL NOT NULL,\n vertex_count INTEGER NOT NULL,\n edge_count INTEGER NOT NULL,\n algorithm TEXT NOT NULL DEFAULT 'weighted-degree',\n duration_ms INTEGER,\n snapshot_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Weak Vertices (detected bottlenecks)\n CREATE TABLE IF NOT EXISTS mincut_weak_vertices (\n id TEXT PRIMARY KEY,\n vertex_id TEXT NOT NULL,\n weighted_degree REAL NOT NULL,\n risk_score REAL NOT NULL,\n reason TEXT NOT NULL,\n domain TEXT,\n vertex_type TEXT NOT NULL,\n suggestions_json TEXT,\n detected_at TEXT NOT NULL DEFAULT (datetime('now')),\n resolved_at TEXT,\n snapshot_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Alerts\n CREATE TABLE IF NOT EXISTS mincut_alerts (\n id TEXT PRIMARY KEY,\n severity TEXT NOT NULL,\n message TEXT NOT NULL,\n mincut_value REAL NOT NULL,\n threshold REAL NOT NULL,\n affected_vertices_json TEXT,\n remediations_json TEXT,\n acknowledged INTEGER DEFAULT 0,\n acknowledged_at TEXT,\n acknowledged_by TEXT,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- MinCut Healing Actions (self-healing history)\n CREATE TABLE IF NOT EXISTS mincut_healing_actions (\n id TEXT PRIMARY KEY,\n action_type TEXT NOT NULL,\n action_params_json TEXT NOT NULL,\n success INTEGER NOT NULL,\n mincut_before REAL NOT NULL,\n mincut_after REAL NOT NULL,\n improvement REAL NOT NULL DEFAULT 0.0,\n error_message TEXT,\n duration_ms INTEGER NOT NULL,\n triggered_by TEXT,\n snapshot_before_id TEXT,\n snapshot_after_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_before_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL,\n FOREIGN KEY (snapshot_after_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Strange Loop Observations (P1: self-organizing)\n CREATE TABLE IF NOT EXISTS mincut_observations (\n id TEXT PRIMARY KEY,\n iteration INTEGER NOT NULL,\n mincut_value REAL NOT NULL,\n weak_vertex_count INTEGER NOT NULL DEFAULT 0,\n weak_vertices_json TEXT,\n snapshot_id TEXT,\n prediction_json TEXT,\n actual_vs_predicted_diff REAL,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Indexes\n CREATE INDEX IF NOT EXISTS idx_mincut_history_timestamp ON mincut_history(timestamp DESC);\n CREATE INDEX IF NOT EXISTS idx_mincut_history_value ON mincut_history(mincut_value);\n CREATE INDEX IF NOT EXISTS idx_mincut_weak_vertex ON mincut_weak_vertices(vertex_id);\n CREATE INDEX IF NOT EXISTS idx_mincut_weak_risk ON mincut_weak_vertices(risk_score DESC);\n CREATE INDEX IF NOT EXISTS idx_mincut_weak_resolved ON mincut_weak_vertices(resolved_at);\n CREATE INDEX IF NOT EXISTS idx_mincut_alerts_severity ON mincut_alerts(severity);\n CREATE INDEX IF NOT EXISTS idx_mincut_alerts_ack ON mincut_alerts(acknowledged);\n CREATE INDEX IF NOT EXISTS idx_mincut_healing_type ON mincut_healing_actions(action_type);\n CREATE INDEX IF NOT EXISTS idx_mincut_healing_success ON mincut_healing_actions(success);\n CREATE INDEX IF NOT EXISTS idx_mincut_observations_iter ON mincut_observations(iteration);\n";
|
|
@@ -11,7 +11,7 @@ export { HYPERGRAPH_SCHEMA, PATTERN_NULLS_SCHEMA };
|
|
|
11
11
|
// ============================================================================
|
|
12
12
|
// Schema Version for Migrations
|
|
13
13
|
// ============================================================================
|
|
14
|
-
export const SCHEMA_VERSION =
|
|
14
|
+
export const SCHEMA_VERSION = 11; // v11: adds goap_execution_steps — canonical GOAP execution history (A14)
|
|
15
15
|
export const SCHEMA_VERSION_TABLE = `
|
|
16
16
|
CREATE TABLE IF NOT EXISTS schema_version (
|
|
17
17
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
@@ -98,7 +98,13 @@ export const GOAP_SCHEMA = `
|
|
|
98
98
|
category TEXT NOT NULL,
|
|
99
99
|
qe_domain TEXT,
|
|
100
100
|
created_at TEXT DEFAULT (datetime('now')),
|
|
101
|
-
updated_at TEXT DEFAULT (datetime('now'))
|
|
101
|
+
updated_at TEXT DEFAULT (datetime('now')),
|
|
102
|
+
-- A14: real domain API method binding (kernel.getDomainAPI(qe_domain)[method](params)).
|
|
103
|
+
-- method/implemented are NULL/0 for actions with no real backing yet —
|
|
104
|
+
-- GOAPExecutor must report those as "not implemented", never simulate them.
|
|
105
|
+
method TEXT,
|
|
106
|
+
params TEXT,
|
|
107
|
+
implemented INTEGER DEFAULT 0
|
|
102
108
|
);
|
|
103
109
|
|
|
104
110
|
-- GOAP Plans
|
|
@@ -132,11 +138,50 @@ export const GOAP_SCHEMA = `
|
|
|
132
138
|
created_at TEXT DEFAULT (datetime('now'))
|
|
133
139
|
);
|
|
134
140
|
|
|
141
|
+
-- A14: canonical per-step execution history (was previously undefined in
|
|
142
|
+
-- this schema — plan-executor.ts invented its own parallel
|
|
143
|
+
-- execution_results/executed_steps tables instead). One row per action
|
|
144
|
+
-- step per execution attempt (execution_id groups steps from the same
|
|
145
|
+
-- plan.execute() call, since a plan can be executed/retried more than
|
|
146
|
+
-- once). Aggregate per-execution stats (steps completed/failed, total
|
|
147
|
+
-- duration, final world state) are derived by querying this table rather
|
|
148
|
+
-- than maintained in a separate denormalized summary table.
|
|
149
|
+
CREATE TABLE IF NOT EXISTS goap_execution_steps (
|
|
150
|
+
id TEXT PRIMARY KEY,
|
|
151
|
+
plan_id TEXT NOT NULL,
|
|
152
|
+
execution_id TEXT NOT NULL,
|
|
153
|
+
action_id TEXT NOT NULL,
|
|
154
|
+
step_order INTEGER NOT NULL,
|
|
155
|
+
world_state_before TEXT,
|
|
156
|
+
world_state_after TEXT,
|
|
157
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
158
|
+
retries INTEGER DEFAULT 0,
|
|
159
|
+
started_at TEXT,
|
|
160
|
+
duration_ms INTEGER,
|
|
161
|
+
agent_id TEXT,
|
|
162
|
+
agent_output TEXT,
|
|
163
|
+
error_message TEXT,
|
|
164
|
+
created_at TEXT DEFAULT (datetime('now'))
|
|
165
|
+
-- Deliberately no FK to goap_plans/goap_actions: PlanExecutor.execute()
|
|
166
|
+
-- can legitimately run an ad-hoc GOAPPlan/GOAPAction that was never
|
|
167
|
+
-- saved via savePlan()/addAction() (e.g. programmatic orchestration
|
|
168
|
+
-- bypassing the A* planner). unified-memory.ts enables the
|
|
169
|
+
-- foreign_keys pragma, so an enforced FK here would reject that
|
|
170
|
+
-- entirely legitimate usage, not just catch real corruption.
|
|
171
|
+
);
|
|
172
|
+
|
|
135
173
|
-- GOAP Indexes
|
|
136
174
|
CREATE INDEX IF NOT EXISTS idx_goap_actions_category ON goap_actions(category);
|
|
137
175
|
CREATE INDEX IF NOT EXISTS idx_goap_actions_agent ON goap_actions(agent_type);
|
|
138
176
|
CREATE INDEX IF NOT EXISTS idx_goap_plans_status ON goap_plans(status);
|
|
139
177
|
CREATE INDEX IF NOT EXISTS idx_goap_sig_goal ON goap_plan_signatures(goal_hash);
|
|
178
|
+
CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_plan ON goap_execution_steps(plan_id);
|
|
179
|
+
CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_action ON goap_execution_steps(action_id);
|
|
180
|
+
-- idx_goap_exec_steps_execution is NOT created here: databases with a
|
|
181
|
+
-- pre-existing narrower goap_execution_steps table (missing execution_id)
|
|
182
|
+
-- would fail on "no such column" since CREATE TABLE IF NOT EXISTS above
|
|
183
|
+
-- silently no-ops against them. unified-memory.ts's v11 migration creates
|
|
184
|
+
-- this index only after confirming/backfilling the column.
|
|
140
185
|
`;
|
|
141
186
|
export const DREAM_SCHEMA = `
|
|
142
187
|
-- Concept Graph Nodes (Dream Engine)
|
|
@@ -602,6 +647,7 @@ export const STATS_TABLES = [
|
|
|
602
647
|
'goap_goals',
|
|
603
648
|
'goap_plans',
|
|
604
649
|
'goap_plan_signatures',
|
|
650
|
+
'goap_execution_steps',
|
|
605
651
|
'concept_nodes',
|
|
606
652
|
'concept_edges',
|
|
607
653
|
'dream_cycles',
|
|
@@ -91,6 +91,28 @@ export declare class UnifiedMemoryManager {
|
|
|
91
91
|
private columnExists;
|
|
92
92
|
private handleV2SchemaIncompatibilities;
|
|
93
93
|
private runMigrations;
|
|
94
|
+
/**
|
|
95
|
+
* A14: create/backfill goap_execution_steps and goap_actions' real-method
|
|
96
|
+
* binding columns (method/params/implemented).
|
|
97
|
+
*
|
|
98
|
+
* Re-running GOAP_SCHEMA's `CREATE TABLE IF NOT EXISTS` alone is
|
|
99
|
+
* insufficient here: some databases (this project's own dev DB included)
|
|
100
|
+
* already have a `goap_execution_steps` table left over from an older,
|
|
101
|
+
* narrower schema version that predates unified-memory-schemas.ts
|
|
102
|
+
* tracking this table at all — `IF NOT EXISTS` silently no-ops against it,
|
|
103
|
+
* permanently missing the columns plan-executor.ts now needs. Likewise
|
|
104
|
+
* `goap_actions` already exists in every migrated database (it's been
|
|
105
|
+
* part of the schema since v3), so the new method/params/implemented
|
|
106
|
+
* columns need an explicit ALTER, not just GOAP_SCHEMA's CREATE TABLE.
|
|
107
|
+
*
|
|
108
|
+
* Note: this only adds the columns — it does NOT backfill real method
|
|
109
|
+
* bindings onto already-seeded action rows (those exist with random,
|
|
110
|
+
* non-deterministic ids assigned at seed time, not stable across the
|
|
111
|
+
* qe-action-library.ts source). That backfill is a planning-layer
|
|
112
|
+
* concern, keyed by action `name` against the current library
|
|
113
|
+
* definitions — see GOAPPlanner.backfillActionMethodBindings().
|
|
114
|
+
*/
|
|
115
|
+
private migrateToV11GoapExecutionSteps;
|
|
94
116
|
private loadVectorIndex;
|
|
95
117
|
kvSet(key: string, value: unknown, namespace?: string, ttl?: number): Promise<void>;
|
|
96
118
|
kvGet<T>(key: string, namespace?: string): Promise<T | undefined>;
|
|
@@ -479,6 +479,8 @@ export class UnifiedMemoryManager {
|
|
|
479
479
|
}
|
|
480
480
|
if (currentVersion < 10)
|
|
481
481
|
this.db.exec(PATTERN_NULLS_SCHEMA);
|
|
482
|
+
if (currentVersion < 11)
|
|
483
|
+
this.migrateToV11GoapExecutionSteps();
|
|
482
484
|
this.db.prepare(`
|
|
483
485
|
INSERT OR REPLACE INTO schema_version (id, version, migrated_at)
|
|
484
486
|
VALUES (1, ?, datetime('now'))
|
|
@@ -488,6 +490,47 @@ export class UnifiedMemoryManager {
|
|
|
488
490
|
console.log(`[UnifiedMemory] Migration complete`);
|
|
489
491
|
}
|
|
490
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* A14: create/backfill goap_execution_steps and goap_actions' real-method
|
|
495
|
+
* binding columns (method/params/implemented).
|
|
496
|
+
*
|
|
497
|
+
* Re-running GOAP_SCHEMA's `CREATE TABLE IF NOT EXISTS` alone is
|
|
498
|
+
* insufficient here: some databases (this project's own dev DB included)
|
|
499
|
+
* already have a `goap_execution_steps` table left over from an older,
|
|
500
|
+
* narrower schema version that predates unified-memory-schemas.ts
|
|
501
|
+
* tracking this table at all — `IF NOT EXISTS` silently no-ops against it,
|
|
502
|
+
* permanently missing the columns plan-executor.ts now needs. Likewise
|
|
503
|
+
* `goap_actions` already exists in every migrated database (it's been
|
|
504
|
+
* part of the schema since v3), so the new method/params/implemented
|
|
505
|
+
* columns need an explicit ALTER, not just GOAP_SCHEMA's CREATE TABLE.
|
|
506
|
+
*
|
|
507
|
+
* Note: this only adds the columns — it does NOT backfill real method
|
|
508
|
+
* bindings onto already-seeded action rows (those exist with random,
|
|
509
|
+
* non-deterministic ids assigned at seed time, not stable across the
|
|
510
|
+
* qe-action-library.ts source). That backfill is a planning-layer
|
|
511
|
+
* concern, keyed by action `name` against the current library
|
|
512
|
+
* definitions — see GOAPPlanner.backfillActionMethodBindings().
|
|
513
|
+
*/
|
|
514
|
+
migrateToV11GoapExecutionSteps() {
|
|
515
|
+
const db = this.db;
|
|
516
|
+
db.exec(GOAP_SCHEMA); // no-op for goap_goals/plans/signatures if already present; creates goap_execution_steps fresh if absent entirely; adds goap_actions if absent entirely (fresh installs only)
|
|
517
|
+
const addColumnIfMissing = (table, column, definition) => {
|
|
518
|
+
const cols = db.prepare(`SELECT name FROM pragma_table_info('${table}')`).all();
|
|
519
|
+
if (!cols.some((c) => c.name === column)) {
|
|
520
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
// Nullable even though new rows always populate them — ALTER TABLE can't
|
|
524
|
+
// retroactively backfill a NOT NULL value for a pre-existing table.
|
|
525
|
+
addColumnIfMissing('goap_execution_steps', 'execution_id', 'TEXT');
|
|
526
|
+
addColumnIfMissing('goap_execution_steps', 'retries', 'INTEGER DEFAULT 0');
|
|
527
|
+
addColumnIfMissing('goap_execution_steps', 'started_at', 'TEXT');
|
|
528
|
+
addColumnIfMissing('goap_execution_steps', 'agent_output', 'TEXT');
|
|
529
|
+
addColumnIfMissing('goap_actions', 'method', 'TEXT');
|
|
530
|
+
addColumnIfMissing('goap_actions', 'params', 'TEXT');
|
|
531
|
+
addColumnIfMissing('goap_actions', 'implemented', 'INTEGER DEFAULT 0');
|
|
532
|
+
db.exec('CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_execution ON goap_execution_steps(execution_id)');
|
|
533
|
+
}
|
|
491
534
|
async loadVectorIndex() {
|
|
492
535
|
if (this.vectorsLoaded)
|
|
493
536
|
return;
|
|
@@ -410,7 +410,9 @@ export class AQELearningEngine {
|
|
|
410
410
|
const key = `pattern-usage:search:${Date.now()}-${randomUUID().slice(0, 8)}`;
|
|
411
411
|
await this.memory.set(key, searchEvent, {
|
|
412
412
|
persist: true,
|
|
413
|
-
ttl
|
|
413
|
+
// ttl is in SECONDS, not ms (unified-memory.ts:607) — the extra
|
|
414
|
+
// * 1000 made this ~19,178 years instead of 7 days.
|
|
415
|
+
ttl: 7 * 24 * 60 * 60, // 7 days retention
|
|
414
416
|
});
|
|
415
417
|
}
|
|
416
418
|
catch (error) {
|