agentic-qe 3.8.14 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +60 -0
- package/dist/adapters/a2ui/integration/agui-sync.js +2 -1
- package/dist/audit/witness-chain.d.ts +1 -1
- package/dist/boot/fast-paths.d.ts +24 -0
- package/dist/boot/fast-paths.js +43 -0
- package/dist/boot/parallel-prefetch.d.ts +26 -0
- package/dist/boot/parallel-prefetch.js +36 -0
- package/dist/cli/bundle.js +12 -9431
- package/dist/cli/chunks/adapter-NTM4ZH3P.js +2 -0
- package/dist/cli/chunks/agent-booster-wasm-UH2J6BNA.js +2 -0
- package/dist/cli/chunks/agent-handler-ZCBWQE3X.js +33 -0
- package/dist/cli/chunks/agent-memory-branch-2BAVI7UW.js +2 -0
- package/dist/cli/chunks/aqe-learning-engine-RVX6MPYK.js +2 -0
- package/dist/cli/chunks/audit-G5UIJBSQ.js +3 -0
- package/dist/cli/chunks/base-7HKNQ6UP.js +2 -0
- package/dist/cli/chunks/better-sqlite3-YHIAPPVT.js +2 -0
- package/dist/cli/chunks/brain-handler-5EE3J5PR.js +68 -0
- package/dist/cli/chunks/branch-enumerator-OV54PID5.js +7 -0
- package/dist/cli/chunks/browser-7RZGKOEO.js +4 -0
- package/dist/cli/chunks/browser-workflow-UOFSQK7X.js +2 -0
- package/dist/cli/chunks/chunk-24E47G3D.js +604 -0
- package/dist/cli/chunks/chunk-35H73OPP.js +2 -0
- package/dist/cli/chunks/chunk-36X2O3BL.js +3 -0
- package/dist/cli/chunks/chunk-3JESHZQM.js +2 -0
- package/dist/cli/chunks/chunk-3VAKR43Z.js +2 -0
- package/dist/cli/chunks/chunk-3WQNW6CH.js +2 -0
- package/dist/cli/chunks/chunk-43M6Y6VF.js +15 -0
- package/dist/cli/chunks/chunk-4BHOAQJH.js +2 -0
- package/dist/cli/chunks/chunk-4LWXZCSD.js +146 -0
- package/dist/cli/chunks/chunk-4TNXEANY.js +2 -0
- package/dist/cli/chunks/chunk-4XBY5JDT.js +4 -0
- package/dist/cli/chunks/chunk-4XREPCBZ.js +2 -0
- package/dist/cli/chunks/chunk-5GPTM2RV.js +2 -0
- package/dist/cli/chunks/chunk-5KBQQP3X.js +7 -0
- package/dist/cli/chunks/chunk-5LDBKZ6P.js +2 -0
- package/dist/cli/chunks/chunk-6BSJNG2S.js +2 -0
- package/dist/cli/chunks/chunk-6YC24TPL.js +27 -0
- package/dist/cli/chunks/chunk-7ATLJCSG.js +2 -0
- package/dist/cli/chunks/chunk-7JQTHPCD.js +2 -0
- package/dist/cli/chunks/chunk-7YUOUVN7.js +2 -0
- package/dist/cli/chunks/chunk-7ZNINH6J.js +59 -0
- package/dist/cli/chunks/chunk-A57BEPL7.js +3 -0
- package/dist/cli/chunks/chunk-AFPMCMVX.js +45 -0
- package/dist/cli/chunks/chunk-AREIP4FX.js +3 -0
- package/dist/cli/chunks/chunk-B2I7BJLL.js +3 -0
- package/dist/cli/chunks/chunk-BEHP3DEF.js +66 -0
- package/dist/cli/chunks/chunk-C24ZDUCM.js +30 -0
- package/dist/cli/chunks/chunk-D4PSFWND.js +2 -0
- package/dist/cli/chunks/chunk-D55PSO5D.js +81 -0
- package/dist/cli/chunks/chunk-DC3HPOOJ.js +2 -0
- package/dist/cli/chunks/chunk-DMGLX76J.js +180 -0
- package/dist/cli/chunks/chunk-E33KQBMW.js +2 -0
- package/dist/cli/chunks/chunk-EQFZQPFN.js +2 -0
- package/dist/cli/chunks/chunk-FPRL6UDF.js +2 -0
- package/dist/cli/chunks/chunk-FRNB4CH2.js +2 -0
- package/dist/cli/chunks/chunk-FWDKVTK4.js +2 -0
- package/dist/cli/chunks/chunk-GFNUESMU.js +2 -0
- package/dist/cli/chunks/chunk-GJW6V35N.js +2 -0
- package/dist/cli/chunks/chunk-GLIFZWV2.js +2 -0
- package/dist/cli/chunks/chunk-GNUUBTSX.js +14 -0
- package/dist/cli/chunks/chunk-HAUXLXKZ.js +2 -0
- package/dist/cli/chunks/chunk-HTXSUTWL.js +9 -0
- package/dist/cli/chunks/chunk-I5WZ2NM2.js +95 -0
- package/dist/cli/chunks/chunk-I7TA453K.js +2 -0
- package/dist/cli/chunks/chunk-IF6GW6IY.js +27 -0
- package/dist/cli/chunks/chunk-IHWSNYL2.js +5 -0
- package/dist/cli/chunks/chunk-IJKYJGJL.js +2 -0
- package/dist/cli/chunks/chunk-IQPXANCE.js +14 -0
- package/dist/cli/chunks/chunk-JCEY7RLP.js +2 -0
- package/dist/cli/chunks/chunk-JSOBRKMA.js +2 -0
- package/dist/cli/chunks/chunk-KIGRLIU4.js +2 -0
- package/dist/cli/chunks/chunk-L4H54Z27.js +21 -0
- package/dist/cli/chunks/chunk-LCOEBFAB.js +2 -0
- package/dist/cli/chunks/chunk-MZ54VM6A.js +2 -0
- package/dist/cli/chunks/chunk-NB47YT6A.js +167 -0
- package/dist/cli/chunks/chunk-NG3BKE7V.js +2 -0
- package/dist/cli/chunks/chunk-NG4TE3OW.js +2 -0
- package/dist/cli/chunks/chunk-O636JKJR.js +18 -0
- package/dist/cli/chunks/chunk-O6QQ4HLS.js +2 -0
- package/dist/cli/chunks/chunk-OFNIQCGX.js +2 -0
- package/dist/cli/chunks/chunk-OTSJU5LH.js +2 -0
- package/dist/cli/chunks/chunk-POLFT2PQ.js +15 -0
- package/dist/cli/chunks/chunk-QAYTL6KC.js +2 -0
- package/dist/cli/chunks/chunk-QMFP5OKH.js +2 -0
- package/dist/cli/chunks/chunk-RAJO7VML.js +2 -0
- package/dist/cli/chunks/chunk-RKIGOARX.js +2 -0
- package/dist/cli/chunks/chunk-RU6Q5HOC.js +3 -0
- package/dist/cli/chunks/chunk-RV6SGDET.js +2 -0
- package/dist/cli/chunks/chunk-RWXI7XAR.js +2 -0
- package/dist/cli/chunks/chunk-RXVYOXDB.js +2 -0
- package/dist/cli/chunks/chunk-SGRN6JFB.js +2 -0
- package/dist/cli/chunks/chunk-SVNX4UWR.js +3029 -0
- package/dist/cli/chunks/chunk-TL7ABIMP.js +2 -0
- package/dist/cli/chunks/chunk-TOLYWONQ.js +2 -0
- package/dist/cli/chunks/chunk-TPXYS3WG.js +3 -0
- package/dist/cli/chunks/chunk-U5JQGRHZ.js +2 -0
- package/dist/cli/chunks/chunk-UB7RGVKO.js +2 -0
- package/dist/cli/chunks/chunk-UBKK7KCR.js +70 -0
- package/dist/cli/chunks/chunk-UMGWGX7C.js +2 -0
- package/dist/cli/chunks/chunk-UN4PA4M2.js +2 -0
- package/dist/cli/chunks/chunk-US7INRP2.js +314 -0
- package/dist/cli/chunks/chunk-UWDBFPHQ.js +750 -0
- package/dist/cli/chunks/chunk-UZZCWWIG.js +2 -0
- package/dist/cli/chunks/chunk-V4HM4QAO.js +24 -0
- package/dist/cli/chunks/chunk-V4U3CTS2.js +180 -0
- package/dist/cli/chunks/chunk-VCCMCFDU.js +2 -0
- package/dist/cli/chunks/chunk-VEWIT6VN.js +4 -0
- package/dist/cli/chunks/chunk-VNYGVG4Y.js +2 -0
- package/dist/cli/chunks/chunk-VO3OVD5D.js +4 -0
- package/dist/cli/chunks/chunk-VY74OMGQ.js +6 -0
- package/dist/cli/chunks/chunk-WDJBGXC2.js +2 -0
- package/dist/cli/chunks/chunk-WDV6TN7E.js +65 -0
- package/dist/cli/chunks/chunk-WLXEDOG4.js +2 -0
- package/dist/cli/chunks/chunk-WXXAAXNS.js +12 -0
- package/dist/cli/chunks/chunk-X4MZYBOU.js +256 -0
- package/dist/cli/chunks/chunk-XE2YAYU5.js +12 -0
- package/dist/cli/chunks/chunk-XP6XKBNW.js +2 -0
- package/dist/cli/chunks/chunk-XPB6ZVQY.js +2 -0
- package/dist/cli/chunks/chunk-XRVUSKQV.js +1 -0
- package/dist/cli/chunks/chunk-XSITQBYB.js +20 -0
- package/dist/cli/chunks/chunk-XTLA4F5Z.js +91 -0
- package/dist/cli/chunks/chunk-XU6L2VJY.js +2 -0
- package/dist/cli/chunks/chunk-XUFHYPZK.js +2 -0
- package/dist/cli/chunks/chunk-Y2ZEDXTV.js +16 -0
- package/dist/cli/chunks/chunk-YQWB4QUP.js +316 -0
- package/dist/cli/chunks/chunk-YUQIXT3G.js +79 -0
- package/dist/cli/chunks/chunk-YYYB2JN5.js +2 -0
- package/dist/cli/chunks/chunk-ZEUVPLGX.js +2 -0
- package/dist/cli/chunks/chunk-ZSRQHJEW.js +3 -0
- package/dist/cli/chunks/ci-N4NTYAAI.js +81 -0
- package/dist/cli/chunks/ci-output-XYR2PSYH.js +2 -0
- package/dist/cli/chunks/claude-flow-setup-FX7PRBJV.js +2 -0
- package/dist/cli/chunks/client-CRRENRK4.js +2 -0
- package/dist/cli/chunks/cline-installer-GTHQOK7U.js +4 -0
- package/dist/cli/chunks/code-4G6ZHVNI.js +38 -0
- package/dist/cli/chunks/code-index-extractor-MKJTP5AK.js +3 -0
- package/dist/cli/chunks/codex-installer-UGS773DT.js +8 -0
- package/dist/cli/chunks/completions-B3BXNXAU.js +1364 -0
- package/dist/cli/chunks/complexity-analyzer-PMN77CUP.js +2 -0
- package/dist/cli/chunks/continuedev-installer-3DYKSIP3.js +14 -0
- package/dist/cli/chunks/copilot-installer-IUC5HDHD.js +3 -0
- package/dist/cli/chunks/cost-tracker-GSGQ7O5T.js +2 -0
- package/dist/cli/chunks/coverage-PO72QC3P.js +27 -0
- package/dist/cli/chunks/cross-domain-router-FSCGJG3B.js +2 -0
- package/dist/cli/chunks/cursor-installer-FK53S3ZL.js +3 -0
- package/dist/cli/chunks/daemon-4UIQTQ73.js +19 -0
- package/dist/cli/chunks/dag-attention-scheduler-ZGIMLECE.js +2 -0
- package/dist/cli/chunks/detect-XXHLTLL7.js +2 -0
- package/dist/cli/chunks/domain-handler-PPGFP7P4.js +25 -0
- package/dist/cli/chunks/domain-transfer-Q5UAE65W.js +2 -0
- package/dist/cli/chunks/dream-PONKQULG.js +2 -0
- package/dist/cli/chunks/esm-node-XLWDJRBX.js +2 -0
- package/dist/cli/chunks/eval-JVJKHSTQ.js +15 -0
- package/dist/cli/chunks/fast-paths-3KX4ZV66.js +2 -0
- package/dist/cli/chunks/feature-flags-2NOVE7DL.js +2 -0
- package/dist/cli/chunks/feature-flags-GKHHG2I2.js +2 -0
- package/dist/cli/chunks/file-discovery-XFSGQNM3.js +2 -0
- package/dist/cli/chunks/fleet-FOIDAXLR.js +43 -0
- package/dist/cli/chunks/gnn-wrapper-HPCQREKP.js +2 -0
- package/dist/cli/chunks/heartbeat-handler-HTR3EFFV.js +48 -0
- package/dist/cli/chunks/heartbeat-scheduler-NZQWN7CH.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-BNA5WUAB.js +2 -0
- package/dist/cli/chunks/hnsw-index-RQIIAE7S.js +2 -0
- package/dist/cli/chunks/hnsw-legacy-bridge-H6OA3AA3.js +2 -0
- package/dist/cli/chunks/hnswlib-node-FF27BDMD.js +2 -0
- package/dist/cli/chunks/hooks-63NZQ7NH.js +101 -0
- package/dist/cli/chunks/hypergraph-engine-XMSLA4XH.js +2 -0
- package/dist/cli/chunks/hypergraph-handler-ID6J6GS2.js +35 -0
- package/dist/cli/chunks/impact-analyzer-FS2UNVP4.js +2 -0
- package/dist/cli/chunks/init-handler-CIKZGGAY.js +68 -0
- package/dist/cli/chunks/init-wizard-TUU5PPY6.js +2 -0
- package/dist/cli/chunks/kernel-XFG42WAG.js +2 -0
- package/dist/cli/chunks/kilocode-installer-N7NLISYY.js +4 -0
- package/dist/cli/chunks/kiro-installer-U6XIPAT3.js +74 -0
- package/dist/cli/chunks/knowledge-graph-XV7FPU2T.js +2 -0
- package/dist/cli/chunks/learning-NKOF7KDJ.js +107 -0
- package/dist/cli/chunks/llm-router-34WHT3PH.js +30 -0
- package/dist/cli/chunks/load-ZW4Z3YLT.js +2 -0
- package/dist/cli/chunks/load-test-F4L7RTXJ.js +2 -0
- package/dist/cli/chunks/mcp-6R7SVGKO.js +2 -0
- package/dist/cli/chunks/memory-OUYCBU4M.js +32 -0
- package/dist/cli/chunks/memory-backend-DTJD2DWF.js +2 -0
- package/dist/cli/chunks/memory-handlers-WNXKZRNM.js +2 -0
- package/dist/cli/chunks/opencode-installer-FR75GHFU.js +3 -0
- package/dist/cli/chunks/orchestrator-AK7ZMVNH.js +371 -0
- package/dist/cli/chunks/pipeline-CFOPG7EM.js +19 -0
- package/dist/cli/chunks/platform-NY3ULBR7.js +2 -0
- package/dist/cli/chunks/plugin-LRANQYUR.js +27 -0
- package/dist/cli/chunks/prime-radiant-advanced-wasm-6KEIU55P.js +2 -0
- package/dist/cli/chunks/protocol-executor-6W4PS2D4.js +2 -0
- package/dist/cli/chunks/protocol-handler-ESSZGJ7R.js +20 -0
- package/dist/cli/chunks/prove-EF2PPY65.js +3 -0
- package/dist/cli/chunks/qe-reasoning-bank-7G3TZLEA.js +2 -0
- package/dist/cli/chunks/quality-AYBXB635.js +7 -0
- package/dist/cli/chunks/queen-coordinator-NFPKGMQN.js +2 -0
- package/dist/cli/chunks/real-embeddings-QPBXE7MA.js +2 -0
- package/dist/cli/chunks/roocode-installer-UF6MMBH6.js +4 -0
- package/dist/cli/chunks/router-F4B7Q66G.js +2 -0
- package/dist/cli/chunks/routing-feedback-5CIDDW7P.js +2 -0
- package/dist/cli/chunks/routing-handler-5TVKFU7V.js +20 -0
- package/dist/cli/chunks/ruvector-commands-E33VXFIA.js +8 -0
- package/dist/cli/chunks/rvf-dual-writer-O3AZKD24.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-IKEUZ2HX.js +2 -0
- package/dist/cli/chunks/rvf-migration-coordinator-M4H7W4RN.js +2 -0
- package/dist/cli/chunks/rvf-native-adapter-UX3WAPIP.js +2 -0
- package/dist/cli/chunks/safe-db-QBBNXEVK.js +2 -0
- package/dist/cli/chunks/schedule-GFT4NN6Z.js +2 -0
- package/dist/cli/chunks/scheduler-CQ56T7DB.js +2 -0
- package/dist/cli/chunks/security-ZLWT7IU3.js +14 -0
- package/dist/cli/chunks/shared-rvf-adapter-EXACQ2PT.js +2 -0
- package/dist/cli/chunks/shared-rvf-dual-writer-G43LQDIV.js +2 -0
- package/dist/cli/chunks/sqlite-persistence-JHSUZPAW.js +2 -0
- package/dist/cli/chunks/status-handler-7P23CXUI.js +45 -0
- package/dist/cli/chunks/structural-health-SCNBNL7K.js +2 -0
- package/dist/cli/chunks/sync-BYZBBH65.js +23 -0
- package/dist/cli/chunks/task-handler-DWJQXZ2K.js +49 -0
- package/dist/cli/chunks/task-handlers-35JIXVRW.js +2 -0
- package/dist/cli/chunks/test-2JSS4XW7.js +33 -0
- package/dist/cli/chunks/test-scheduling-TWJ5I7N3.js +15 -0
- package/dist/cli/chunks/token-bootstrap-LLLNJT5V.js +2 -0
- package/dist/cli/chunks/token-usage-EQ4HM4EZ.js +25 -0
- package/dist/cli/chunks/transformers-PBIR5U5S.js +2 -0
- package/dist/cli/chunks/tree-sitter-wasm-parser-X3L2GXUX.js +2 -0
- package/dist/cli/chunks/types-OD43K2NP.js +2 -0
- package/dist/cli/chunks/unified-memory-YPHONR2T.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-HJS4OXWM.js +2 -0
- package/dist/cli/chunks/unified-persistence-EFZRO6AW.js +2 -0
- package/dist/cli/chunks/validate-POMLT2KU.js +21 -0
- package/dist/cli/chunks/validate-swarm-UOC4JGZT.js +14 -0
- package/dist/cli/chunks/vibium-5JF6LAXI.js +2 -0
- package/dist/cli/chunks/visual-security-7KWFLYNB.js +2 -0
- package/dist/cli/chunks/web-tree-sitter-R7WR7J7B.js +2 -0
- package/dist/cli/chunks/windsurf-installer-ZSPEUBKR.js +7 -0
- package/dist/cli/chunks/witness-chain-CFSPCXHG.js +2 -0
- package/dist/cli/chunks/witness-chain-RWU6WT37.js +2 -0
- package/dist/cli/chunks/workflow-YNQT3OW2.js +51 -0
- package/dist/cli/chunks/workflow-orchestrator-Z6TAVMQP.js +2 -0
- package/dist/cli/chunks/wrappers-BP4FODVH.js +2 -0
- package/dist/cli/commands/daemon.d.ts +13 -0
- package/dist/cli/commands/daemon.js +224 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +2 -1
- package/dist/cli/commands/plugin.d.ts +12 -0
- package/dist/cli/commands/plugin.js +135 -0
- package/dist/cli/commands/ruvector-commands.js +14 -2
- package/dist/cli/commands/workflow.d.ts +10 -0
- package/dist/cli/commands/workflow.js +587 -0
- package/dist/cli/handlers/brain-handler.js +13 -8
- package/dist/cli/handlers/heartbeat-handler.d.ts +1 -0
- package/dist/cli/handlers/heartbeat-handler.js +20 -10
- package/dist/cli/handlers/hypergraph-handler.js +3 -3
- package/dist/cli/handlers/init-handler.js +10 -9
- package/dist/cli/handlers/interfaces.d.ts +4 -4
- package/dist/cli/index.js +159 -638
- package/dist/cli/lazy-registry.d.ts +27 -0
- package/dist/cli/lazy-registry.js +70 -0
- package/dist/context/compaction/context-budget.d.ts +71 -0
- package/dist/context/compaction/context-budget.js +120 -0
- package/dist/context/compaction/index.d.ts +96 -0
- package/dist/context/compaction/index.js +259 -0
- package/dist/context/compaction/llm-caller-adapter.d.ts +14 -0
- package/dist/context/compaction/llm-caller-adapter.js +47 -0
- package/dist/context/compaction/tier1-microcompact.d.ts +33 -0
- package/dist/context/compaction/tier1-microcompact.js +47 -0
- package/dist/context/compaction/tier2-session-summary.d.ts +72 -0
- package/dist/context/compaction/tier2-session-summary.js +172 -0
- package/dist/context/compaction/tier3-llm-compact.d.ts +65 -0
- package/dist/context/compaction/tier3-llm-compact.js +166 -0
- package/dist/context/compaction/tier4-reactive.d.ts +54 -0
- package/dist/context/compaction/tier4-reactive.js +129 -0
- package/dist/coordination/agent-memory-branch.d.ts +117 -0
- package/dist/coordination/agent-memory-branch.js +213 -0
- package/dist/coordination/agent-teams/mailbox.d.ts +43 -0
- package/dist/coordination/agent-teams/mailbox.js +130 -4
- package/dist/coordination/consensus/providers/claude-provider.d.ts +1 -0
- package/dist/coordination/consensus/providers/claude-provider.js +23 -3
- package/dist/coordination/handlers/handler-utils.d.ts +1 -0
- package/dist/coordination/handlers/handler-utils.js +9 -2
- package/dist/coordination/handlers/quality-handlers.js +7 -1
- package/dist/domains/contract-testing/coordinator.js +11 -0
- package/dist/domains/quality-assessment/coherence/gate-controller.d.ts +20 -1
- package/dist/domains/quality-assessment/coherence/gate-controller.js +64 -0
- package/dist/domains/quality-assessment/coherence/index.d.ts +3 -3
- package/dist/domains/quality-assessment/coherence/index.js +2 -2
- package/dist/domains/quality-assessment/coherence/types.d.ts +39 -0
- package/dist/domains/quality-assessment/coherence/types.js +11 -0
- package/dist/domains/quality-assessment/coordinator.d.ts +14 -0
- package/dist/domains/quality-assessment/coordinator.js +92 -0
- package/dist/domains/test-execution/coordinator.d.ts +19 -0
- package/dist/domains/test-execution/coordinator.js +102 -5
- package/dist/domains/test-generation/coordinator.js +11 -0
- package/dist/domains/test-generation/interfaces.d.ts +2 -0
- package/dist/domains/test-generation/services/test-generator.d.ts +9 -0
- package/dist/domains/test-generation/services/test-generator.js +37 -0
- package/dist/hooks/cross-phase-hooks.d.ts +11 -0
- package/dist/hooks/cross-phase-hooks.js +73 -9
- package/dist/hooks/security/config-snapshot.d.ts +21 -0
- package/dist/hooks/security/config-snapshot.js +33 -0
- package/dist/hooks/security/exit-codes.d.ts +28 -0
- package/dist/hooks/security/exit-codes.js +33 -0
- package/dist/hooks/security/index.d.ts +15 -0
- package/dist/hooks/security/index.js +15 -0
- package/dist/hooks/security/ssrf-guard.d.ts +25 -0
- package/dist/hooks/security/ssrf-guard.js +69 -0
- package/dist/init/agents-installer.d.ts +5 -3
- package/dist/init/agents-installer.js +17 -43
- package/dist/init/find-package-root.d.ts +22 -0
- package/dist/init/find-package-root.js +46 -0
- package/dist/init/n8n-installer.d.ts +4 -2
- package/dist/init/n8n-installer.js +23 -23
- package/dist/init/opencode-installer.d.ts +0 -5
- package/dist/init/opencode-installer.js +12 -39
- package/dist/init/skills-installer.d.ts +5 -2
- package/dist/init/skills-installer.js +15 -37
- package/dist/integrations/embeddings/index/HNSWIndex.d.ts +9 -2
- package/dist/integrations/embeddings/index/HNSWIndex.js +110 -35
- package/dist/integrations/ruvector/cognitive-routing.d.ts +67 -0
- package/dist/integrations/ruvector/cognitive-routing.js +208 -0
- package/dist/integrations/ruvector/feature-flags.d.ts +84 -0
- package/dist/integrations/ruvector/feature-flags.js +59 -0
- package/dist/integrations/ruvector/hdc-fingerprint.d.ts +76 -0
- package/dist/integrations/ruvector/hdc-fingerprint.js +217 -0
- package/dist/integrations/ruvector/hyperbolic-hnsw.d.ts +59 -0
- package/dist/integrations/ruvector/hyperbolic-hnsw.js +194 -0
- package/dist/integrations/ruvector/index.d.ts +5 -2
- package/dist/integrations/ruvector/index.js +13 -2
- package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +24 -0
- package/dist/integrations/ruvector/shared-rvf-adapter.js +55 -0
- package/dist/integrations/ruvector/shared-rvf-dual-writer.d.ts +6 -0
- package/dist/integrations/ruvector/shared-rvf-dual-writer.js +38 -0
- package/dist/integrations/ruvector/sona-persistence.d.ts +8 -0
- package/dist/integrations/ruvector/sona-persistence.js +10 -0
- package/dist/integrations/ruvector/vector-delta-tracker.d.ts +96 -0
- package/dist/integrations/ruvector/vector-delta-tracker.js +226 -0
- package/dist/kernel/agent-coordinator.d.ts +75 -1
- package/dist/kernel/agent-coordinator.js +250 -1
- package/dist/kernel/hnsw-legacy-bridge.d.ts +38 -0
- package/dist/kernel/hnsw-legacy-bridge.js +88 -0
- package/dist/kernel/hnsw-shadow-validator.d.ts +91 -0
- package/dist/kernel/hnsw-shadow-validator.js +139 -0
- package/dist/kernel/index.d.ts +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/kernel/interfaces.d.ts +39 -0
- package/dist/kernel/kernel.d.ts +23 -0
- package/dist/kernel/kernel.js +141 -1
- package/dist/kernel/memory-backend.js +3 -1
- package/dist/kernel/unified-memory.d.ts +1 -1
- package/dist/kernel/unified-memory.js +7 -3
- package/dist/learning/aqe-learning-engine.d.ts +65 -0
- package/dist/learning/aqe-learning-engine.js +134 -0
- package/dist/learning/dream/dream-engine.d.ts +6 -1
- package/dist/learning/dream/dream-engine.js +37 -2
- package/dist/learning/dream/dream-scheduler.d.ts +25 -0
- package/dist/learning/dream/dream-scheduler.js +120 -0
- package/dist/learning/dream/rvcow-branch-manager.d.ts +6 -3
- package/dist/learning/dream/rvcow-branch-manager.js +60 -5
- package/dist/learning/experience-capture.d.ts +3 -3
- package/dist/learning/hyperbolic-pattern-index.d.ts +82 -0
- package/dist/learning/hyperbolic-pattern-index.js +142 -0
- package/dist/learning/index.d.ts +3 -3
- package/dist/learning/index.js +1 -1
- package/dist/learning/metrics-tracker.d.ts +44 -0
- package/dist/learning/metrics-tracker.js +37 -0
- package/dist/learning/pattern-promotion.d.ts +3 -3
- package/dist/learning/pattern-store.d.ts +45 -2
- package/dist/learning/pattern-store.js +217 -4
- package/dist/learning/qe-patterns.d.ts +1 -1
- package/dist/learning/qe-reasoning-bank.js +1 -1
- package/dist/learning/rvf-pattern-migration.d.ts +50 -0
- package/dist/learning/rvf-pattern-migration.js +106 -0
- package/dist/learning/rvf-pattern-store.d.ts +66 -0
- package/dist/learning/rvf-pattern-store.js +447 -0
- package/dist/mcp/bundle.js +1937 -1793
- package/dist/mcp/entry.js +132 -77
- package/dist/mcp/handlers/index.d.ts +1 -0
- package/dist/mcp/handlers/index.js +2 -0
- package/dist/mcp/handlers/migration-handlers.d.ts +52 -0
- package/dist/mcp/handlers/migration-handlers.js +85 -0
- package/dist/mcp/middleware/batch-executor.d.ts +46 -0
- package/dist/mcp/middleware/batch-executor.js +150 -0
- package/dist/mcp/middleware/microcompact.d.ts +97 -0
- package/dist/mcp/middleware/microcompact.js +179 -0
- package/dist/mcp/middleware/middleware-chain.d.ts +37 -0
- package/dist/mcp/middleware/middleware-chain.js +60 -0
- package/dist/mcp/protocol-server.d.ts +12 -0
- package/dist/mcp/protocol-server.js +192 -36
- package/dist/mcp/services/session-durability-middleware.d.ts +22 -0
- package/dist/mcp/services/session-durability-middleware.js +64 -0
- package/dist/mcp/services/session-resume.d.ts +29 -0
- package/dist/mcp/services/session-resume.js +221 -0
- package/dist/mcp/services/session-store.d.ts +84 -0
- package/dist/mcp/services/session-store.js +163 -0
- package/dist/mcp/tool-registry.d.ts +9 -0
- package/dist/mcp/tool-registry.js +30 -1
- package/dist/mcp/types.d.ts +2 -1
- package/dist/optimization/early-exit-token-optimizer.d.ts +7 -7
- package/dist/optimization/early-exit-token-optimizer.js +3 -3
- package/dist/persistence/rvf-consistency-validator.d.ts +85 -0
- package/dist/persistence/rvf-consistency-validator.js +182 -0
- package/dist/persistence/rvf-migration-adapter.d.ts +125 -0
- package/dist/persistence/rvf-migration-adapter.js +303 -0
- package/dist/persistence/rvf-migration-coordinator.d.ts +115 -0
- package/dist/persistence/rvf-migration-coordinator.js +224 -0
- package/dist/persistence/rvf-stage-gate.d.ts +70 -0
- package/dist/persistence/rvf-stage-gate.js +163 -0
- package/dist/plugins/cache.d.ts +44 -0
- package/dist/plugins/cache.js +149 -0
- package/dist/plugins/index.d.ts +15 -0
- package/dist/plugins/index.js +15 -0
- package/dist/plugins/lifecycle.d.ts +67 -0
- package/dist/plugins/lifecycle.js +175 -0
- package/dist/plugins/manifest.d.ts +45 -0
- package/dist/plugins/manifest.js +173 -0
- package/dist/plugins/resolver.d.ts +37 -0
- package/dist/plugins/resolver.js +80 -0
- package/dist/plugins/security.d.ts +23 -0
- package/dist/plugins/security.js +125 -0
- package/dist/plugins/sources/github.d.ts +17 -0
- package/dist/plugins/sources/github.js +77 -0
- package/dist/plugins/sources/local.d.ts +20 -0
- package/dist/plugins/sources/local.js +32 -0
- package/dist/plugins/sources/npm.d.ts +18 -0
- package/dist/plugins/sources/npm.js +82 -0
- package/dist/shared/llm/retry.d.ts +5 -2
- package/dist/shared/llm/retry.js +7 -3
- package/dist/shared/prompt-cache-latch.d.ts +41 -0
- package/dist/shared/prompt-cache-latch.js +63 -0
- package/dist/shared/retry-engine.d.ts +77 -0
- package/dist/shared/retry-engine.js +194 -0
- package/dist/workers/daemon.d.ts +8 -0
- package/dist/workers/daemon.js +13 -0
- package/dist/workers/quality-daemon/ci-monitor.d.ts +55 -0
- package/dist/workers/quality-daemon/ci-monitor.js +147 -0
- package/dist/workers/quality-daemon/coverage-delta.d.ts +72 -0
- package/dist/workers/quality-daemon/coverage-delta.js +135 -0
- package/dist/workers/quality-daemon/git-watcher.d.ts +51 -0
- package/dist/workers/quality-daemon/git-watcher.js +209 -0
- package/dist/workers/quality-daemon/index.d.ts +119 -0
- package/dist/workers/quality-daemon/index.js +343 -0
- package/dist/workers/quality-daemon/nightly-consolidation.d.ts +74 -0
- package/dist/workers/quality-daemon/nightly-consolidation.js +136 -0
- package/dist/workers/quality-daemon/notification-service.d.ts +67 -0
- package/dist/workers/quality-daemon/notification-service.js +178 -0
- package/dist/workers/quality-daemon/persistent-memory.d.ts +31 -0
- package/dist/workers/quality-daemon/persistent-memory.js +30 -0
- package/dist/workers/quality-daemon/priority-queue.d.ts +97 -0
- package/dist/workers/quality-daemon/priority-queue.js +126 -0
- package/dist/workers/quality-daemon/test-suggester.d.ts +50 -0
- package/dist/workers/quality-daemon/test-suggester.js +121 -0
- package/dist/workers/worker-manager.js +2 -1
- package/package.json +10 -10
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RVF-Backed Pattern Store (ADR-066)
|
|
3
|
+
*
|
|
4
|
+
* Implements IPatternStore using @ruvector/rvf-node for persistent HNSW
|
|
5
|
+
* vector indexing. Eliminates cold-start index rebuild (SQLite BLOB →
|
|
6
|
+
* in-memory HNSW) by storing vectors in the RVF native format with
|
|
7
|
+
* progressive 3-layer indexing.
|
|
8
|
+
*
|
|
9
|
+
* Pattern metadata remains in SQLite (via the existing SQLitePatternStore);
|
|
10
|
+
* only vector storage and search moves to RVF.
|
|
11
|
+
*
|
|
12
|
+
* @module learning/rvf-pattern-store
|
|
13
|
+
*/
|
|
14
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
15
|
+
import { ok, err } from '../shared/types/index.js';
|
|
16
|
+
import { toErrorMessage } from '../shared/error-utils.js';
|
|
17
|
+
import { calculateQualityScore, validateQEPattern, mapQEDomainToAQE, PROMOTION_THRESHOLD, } from './qe-patterns.js';
|
|
18
|
+
import { DEFAULT_PATTERN_STORE_CONFIG } from './pattern-store.js';
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// RVF Pattern Store Implementation
|
|
21
|
+
// ============================================================================
|
|
22
|
+
/**
|
|
23
|
+
* Pattern store backed by @ruvector/rvf-node for persistent HNSW.
|
|
24
|
+
*
|
|
25
|
+
* Vectors live in a .rvf file (persistent HNSW, no cold-start rebuild).
|
|
26
|
+
* Metadata (pattern fields, FTS5) lives in SQLite via sqliteStore delegate.
|
|
27
|
+
*/
|
|
28
|
+
export class RvfPatternStore {
|
|
29
|
+
createAdapter;
|
|
30
|
+
config;
|
|
31
|
+
rvfPath;
|
|
32
|
+
adapter = null;
|
|
33
|
+
sqliteStore = null;
|
|
34
|
+
initialized = false;
|
|
35
|
+
rvfInitError = null;
|
|
36
|
+
searchOps = 0;
|
|
37
|
+
totalSearchMs = 0;
|
|
38
|
+
constructor(createAdapter, config) {
|
|
39
|
+
this.createAdapter = createAdapter;
|
|
40
|
+
this.config = config?.base ?? DEFAULT_PATTERN_STORE_CONFIG;
|
|
41
|
+
this.rvfPath = config?.rvfPath ?? '.agentic-qe/patterns.rvf';
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Attach SQLite persistence for metadata (pattern fields, FTS5).
|
|
45
|
+
* Must be called before initialize() if SQLite metadata is desired.
|
|
46
|
+
*/
|
|
47
|
+
setSqliteStore(store) {
|
|
48
|
+
this.sqliteStore = store;
|
|
49
|
+
}
|
|
50
|
+
/** Get the underlying RVF adapter (for COW branching, migration, etc.) */
|
|
51
|
+
getAdapter() {
|
|
52
|
+
return this.adapter;
|
|
53
|
+
}
|
|
54
|
+
// --------------------------------------------------------------------------
|
|
55
|
+
// IPatternStore — Lifecycle
|
|
56
|
+
// --------------------------------------------------------------------------
|
|
57
|
+
async initialize() {
|
|
58
|
+
if (this.initialized)
|
|
59
|
+
return;
|
|
60
|
+
try {
|
|
61
|
+
this.adapter = this.createAdapter(this.rvfPath, this.config.embeddingDimension);
|
|
62
|
+
this.initialized = true;
|
|
63
|
+
console.log(`[RvfPatternStore] Initialized: ${this.rvfPath} (dim=${this.config.embeddingDimension})`);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
// Do NOT silently swallow — the user chose useRVFPatternStore=true,
|
|
67
|
+
// so they need to know RVF is not working. Log a clear error, set
|
|
68
|
+
// adapter to null, and mark nativeAvailable=false in stats.
|
|
69
|
+
this.rvfInitError = toErrorMessage(error);
|
|
70
|
+
console.error(`[RvfPatternStore] ERROR: RVF native init failed — vector search is DISABLED. ` +
|
|
71
|
+
`Cause: ${this.rvfInitError}. ` +
|
|
72
|
+
`Fix: install @ruvector/rvf-node native bindings, or set useRVFPatternStore=false to use SQLite HNSW.`);
|
|
73
|
+
this.adapter = null;
|
|
74
|
+
this.initialized = true; // mark initialized to prevent retry loops
|
|
75
|
+
}
|
|
76
|
+
// Auto-attach SQLitePatternStore if not explicitly set.
|
|
77
|
+
// This ensures metadata persistence and FTS5 search work even when
|
|
78
|
+
// the RVF adapter is unavailable (e.g. native bindings not installed).
|
|
79
|
+
if (!this.sqliteStore) {
|
|
80
|
+
try {
|
|
81
|
+
const { createSQLitePatternStore } = await import('./sqlite-persistence.js');
|
|
82
|
+
const store = createSQLitePatternStore();
|
|
83
|
+
await store.initialize();
|
|
84
|
+
this.sqliteStore = store;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
// SQLite auto-attach is best-effort
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async dispose() {
|
|
92
|
+
if (this.adapter) {
|
|
93
|
+
try {
|
|
94
|
+
this.adapter.close();
|
|
95
|
+
}
|
|
96
|
+
catch { /* best effort */ }
|
|
97
|
+
this.adapter = null;
|
|
98
|
+
}
|
|
99
|
+
this.initialized = false;
|
|
100
|
+
}
|
|
101
|
+
// --------------------------------------------------------------------------
|
|
102
|
+
// IPatternStore — Write operations
|
|
103
|
+
// --------------------------------------------------------------------------
|
|
104
|
+
async store(pattern) {
|
|
105
|
+
await this.ensureInitialized();
|
|
106
|
+
const validation = validateQEPattern(pattern);
|
|
107
|
+
if (!validation.valid) {
|
|
108
|
+
return err(new Error(`Invalid pattern: ${validation.errors.join(', ')}`));
|
|
109
|
+
}
|
|
110
|
+
if (pattern.confidence < this.config.minConfidence) {
|
|
111
|
+
return err(new Error(`Pattern confidence ${pattern.confidence} below threshold ${this.config.minConfidence}`));
|
|
112
|
+
}
|
|
113
|
+
// Persist metadata to SQLite
|
|
114
|
+
if (this.sqliteStore) {
|
|
115
|
+
try {
|
|
116
|
+
this.sqliteStore.storePattern(pattern, pattern.embedding);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
console.warn(`[RvfPatternStore] SQLite persist failed for ${pattern.id}:`, toErrorMessage(error));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Ingest vector into RVF
|
|
123
|
+
if (pattern.embedding && this.adapter) {
|
|
124
|
+
try {
|
|
125
|
+
const vec = pattern.embedding instanceof Float32Array
|
|
126
|
+
? pattern.embedding
|
|
127
|
+
: new Float32Array(pattern.embedding);
|
|
128
|
+
this.adapter.ingest([{ id: pattern.id, vector: vec }]);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
console.warn(`[RvfPatternStore] RVF ingest failed for ${pattern.id}:`, toErrorMessage(error));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return ok(pattern.id);
|
|
135
|
+
}
|
|
136
|
+
async create(options) {
|
|
137
|
+
const confidence = options.confidence ?? 0.5;
|
|
138
|
+
const qeDomain = options.qeDomain ?? 'test-generation';
|
|
139
|
+
const pattern = {
|
|
140
|
+
id: uuidv4(),
|
|
141
|
+
patternType: options.patternType,
|
|
142
|
+
qeDomain,
|
|
143
|
+
domain: mapQEDomainToAQE(qeDomain),
|
|
144
|
+
name: options.name,
|
|
145
|
+
description: options.description,
|
|
146
|
+
confidence,
|
|
147
|
+
usageCount: 0,
|
|
148
|
+
successRate: 0,
|
|
149
|
+
qualityScore: calculateQualityScore({ confidence, usageCount: 0, successRate: 0 }),
|
|
150
|
+
context: { tags: [], ...options.context },
|
|
151
|
+
template: { example: '', ...options.template },
|
|
152
|
+
embedding: options.embedding,
|
|
153
|
+
tier: 'short-term',
|
|
154
|
+
createdAt: new Date(),
|
|
155
|
+
lastUsedAt: new Date(),
|
|
156
|
+
successfulUses: 0,
|
|
157
|
+
reusable: false,
|
|
158
|
+
reuseCount: 0,
|
|
159
|
+
averageTokenSavings: 0,
|
|
160
|
+
};
|
|
161
|
+
const result = await this.store(pattern);
|
|
162
|
+
if (!result.success) {
|
|
163
|
+
return err(result.error);
|
|
164
|
+
}
|
|
165
|
+
return ok(pattern);
|
|
166
|
+
}
|
|
167
|
+
// --------------------------------------------------------------------------
|
|
168
|
+
// IPatternStore — Read operations
|
|
169
|
+
// --------------------------------------------------------------------------
|
|
170
|
+
async get(id) {
|
|
171
|
+
if (this.sqliteStore) {
|
|
172
|
+
try {
|
|
173
|
+
return this.sqliteStore.getPattern(id) ?? null;
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
async search(query, options = {}) {
|
|
182
|
+
await this.ensureInitialized();
|
|
183
|
+
const startTime = performance.now();
|
|
184
|
+
const limit = options.limit ?? 10;
|
|
185
|
+
const results = [];
|
|
186
|
+
// Vector search via RVF native HNSW
|
|
187
|
+
if (Array.isArray(query) && this.adapter) {
|
|
188
|
+
try {
|
|
189
|
+
const queryVec = query instanceof Float32Array
|
|
190
|
+
? query
|
|
191
|
+
: new Float32Array(query);
|
|
192
|
+
const rvfResults = this.adapter.search(queryVec, limit * 2);
|
|
193
|
+
for (const hit of rvfResults) {
|
|
194
|
+
const pattern = await this.get(hit.id);
|
|
195
|
+
if (pattern && this.matchesFilters(pattern, options)) {
|
|
196
|
+
const reuseInfo = this.calculateReuseInfo(pattern, hit.score);
|
|
197
|
+
results.push({
|
|
198
|
+
pattern,
|
|
199
|
+
score: hit.score,
|
|
200
|
+
matchType: 'vector',
|
|
201
|
+
similarity: hit.score,
|
|
202
|
+
canReuse: reuseInfo.canReuse,
|
|
203
|
+
estimatedTokenSavings: reuseInfo.estimatedTokenSavings,
|
|
204
|
+
reuseConfidence: reuseInfo.reuseConfidence,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
console.warn('[RvfPatternStore] RVF search failed:', toErrorMessage(error));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Fallback: when query is a vector but RVF adapter is unavailable,
|
|
214
|
+
// compute cosine similarity over SQLite-stored embeddings in memory.
|
|
215
|
+
// Uses getPattern(id) which joins the embedding from qe_pattern_embeddings.
|
|
216
|
+
if (Array.isArray(query) && !this.adapter && this.sqliteStore && results.length === 0) {
|
|
217
|
+
try {
|
|
218
|
+
const allPatterns = this.sqliteStore.getPatterns({ limit: limit * 4 });
|
|
219
|
+
const qArr = query;
|
|
220
|
+
const qMag = Math.sqrt(qArr.reduce((s, v) => s + v * v, 0));
|
|
221
|
+
if (qMag > 0) {
|
|
222
|
+
for (const pat of allPatterns) {
|
|
223
|
+
if (!this.matchesFilters(pat, options))
|
|
224
|
+
continue;
|
|
225
|
+
// getPattern() joins the embedding; getPatterns() does not
|
|
226
|
+
const full = this.sqliteStore.getPattern(pat.id);
|
|
227
|
+
const emb = full?.embedding;
|
|
228
|
+
if (!emb || emb.length !== qArr.length)
|
|
229
|
+
continue;
|
|
230
|
+
let dot = 0, eMag = 0;
|
|
231
|
+
for (let i = 0; i < qArr.length; i++) {
|
|
232
|
+
dot += qArr[i] * emb[i];
|
|
233
|
+
eMag += emb[i] * emb[i];
|
|
234
|
+
}
|
|
235
|
+
eMag = Math.sqrt(eMag);
|
|
236
|
+
if (eMag === 0)
|
|
237
|
+
continue;
|
|
238
|
+
const score = dot / (qMag * eMag);
|
|
239
|
+
const reuseInfo = this.calculateReuseInfo(full, score);
|
|
240
|
+
results.push({
|
|
241
|
+
pattern: full,
|
|
242
|
+
score,
|
|
243
|
+
matchType: 'vector',
|
|
244
|
+
similarity: score,
|
|
245
|
+
canReuse: reuseInfo.canReuse,
|
|
246
|
+
estimatedTokenSavings: reuseInfo.estimatedTokenSavings,
|
|
247
|
+
reuseConfidence: reuseInfo.reuseConfidence,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch { /* SQLite fallback best-effort */ }
|
|
253
|
+
}
|
|
254
|
+
// Empty string query = return all patterns sorted by quality score
|
|
255
|
+
if (typeof query === 'string' && !query.trim() && this.sqliteStore) {
|
|
256
|
+
try {
|
|
257
|
+
const allPatterns = this.sqliteStore.getPatterns({ limit: limit * 2 });
|
|
258
|
+
const existingIds = new Set(results.map(r => r.pattern.id));
|
|
259
|
+
for (const pattern of allPatterns) {
|
|
260
|
+
if (existingIds.has(pattern.id))
|
|
261
|
+
continue;
|
|
262
|
+
if (!this.matchesFilters(pattern, options))
|
|
263
|
+
continue;
|
|
264
|
+
const reuseInfo = this.calculateReuseInfo(pattern, pattern.confidence);
|
|
265
|
+
results.push({
|
|
266
|
+
pattern,
|
|
267
|
+
score: pattern.confidence,
|
|
268
|
+
matchType: 'exact',
|
|
269
|
+
similarity: pattern.confidence,
|
|
270
|
+
canReuse: reuseInfo.canReuse,
|
|
271
|
+
estimatedTokenSavings: reuseInfo.estimatedTokenSavings,
|
|
272
|
+
reuseConfidence: reuseInfo.reuseConfidence,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
catch { /* SQLite unavailable */ }
|
|
277
|
+
}
|
|
278
|
+
// FTS5 text search fallback via SQLite
|
|
279
|
+
if (typeof query === 'string' && query.trim() && this.sqliteStore) {
|
|
280
|
+
try {
|
|
281
|
+
const ftsResults = this.sqliteStore.searchFTS(query, limit * 2);
|
|
282
|
+
const existingIds = new Set(results.map(r => r.pattern.id));
|
|
283
|
+
for (const ftsResult of ftsResults) {
|
|
284
|
+
if (existingIds.has(ftsResult.id))
|
|
285
|
+
continue;
|
|
286
|
+
const pattern = await this.get(ftsResult.id);
|
|
287
|
+
if (pattern && this.matchesFilters(pattern, options)) {
|
|
288
|
+
const reuseInfo = this.calculateReuseInfo(pattern, ftsResult.ftsScore);
|
|
289
|
+
results.push({
|
|
290
|
+
pattern,
|
|
291
|
+
score: 0.5 * ftsResult.ftsScore,
|
|
292
|
+
matchType: 'exact',
|
|
293
|
+
similarity: ftsResult.ftsScore,
|
|
294
|
+
canReuse: reuseInfo.canReuse,
|
|
295
|
+
estimatedTokenSavings: reuseInfo.estimatedTokenSavings,
|
|
296
|
+
reuseConfidence: reuseInfo.reuseConfidence,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
catch { /* FTS5 unavailable */ }
|
|
302
|
+
}
|
|
303
|
+
// Sort by score descending, apply limit
|
|
304
|
+
results.sort((a, b) => b.score - a.score);
|
|
305
|
+
const elapsed = performance.now() - startTime;
|
|
306
|
+
this.searchOps++;
|
|
307
|
+
this.totalSearchMs += elapsed;
|
|
308
|
+
return ok(results.slice(0, limit));
|
|
309
|
+
}
|
|
310
|
+
// --------------------------------------------------------------------------
|
|
311
|
+
// IPatternStore — Mutation operations
|
|
312
|
+
// --------------------------------------------------------------------------
|
|
313
|
+
async recordUsage(id, success) {
|
|
314
|
+
if (!this.sqliteStore) {
|
|
315
|
+
return err(new Error('No SQLite store attached'));
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
this.sqliteStore.recordUsage(id, success);
|
|
319
|
+
return ok(undefined);
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
return err(new Error(`recordUsage failed: ${toErrorMessage(error)}`));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
async promote(id) {
|
|
326
|
+
if (!this.sqliteStore) {
|
|
327
|
+
return err(new Error('No SQLite store attached'));
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
this.sqliteStore.promotePattern(id);
|
|
331
|
+
return ok(undefined);
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
return err(new Error(`promote failed: ${toErrorMessage(error)}`));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
async delete(id) {
|
|
338
|
+
// Delete from RVF
|
|
339
|
+
if (this.adapter) {
|
|
340
|
+
try {
|
|
341
|
+
this.adapter.delete([id]);
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
console.warn(`[RvfPatternStore] RVF delete failed for ${id}:`, toErrorMessage(error));
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
// Delete from SQLite
|
|
348
|
+
if (this.sqliteStore) {
|
|
349
|
+
try {
|
|
350
|
+
this.sqliteStore.deletePattern(id);
|
|
351
|
+
}
|
|
352
|
+
catch (error) {
|
|
353
|
+
return err(new Error(`SQLite delete failed: ${toErrorMessage(error)}`));
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return ok(undefined);
|
|
357
|
+
}
|
|
358
|
+
async getStats() {
|
|
359
|
+
const rvfStatus = this.adapter?.status();
|
|
360
|
+
// Get pattern count from RVF if available, otherwise fall back to SQLite
|
|
361
|
+
let totalPatterns = rvfStatus?.totalVectors ?? 0;
|
|
362
|
+
if (totalPatterns === 0 && this.sqliteStore) {
|
|
363
|
+
try {
|
|
364
|
+
totalPatterns = this.sqliteStore.getStats().totalPatterns;
|
|
365
|
+
}
|
|
366
|
+
catch { /* best effort */ }
|
|
367
|
+
}
|
|
368
|
+
return {
|
|
369
|
+
totalPatterns,
|
|
370
|
+
byTier: { shortTerm: 0, longTerm: 0 },
|
|
371
|
+
byDomain: {},
|
|
372
|
+
byType: {},
|
|
373
|
+
avgConfidence: 0,
|
|
374
|
+
avgQualityScore: 0,
|
|
375
|
+
avgSuccessRate: 0,
|
|
376
|
+
searchOperations: this.searchOps,
|
|
377
|
+
avgSearchLatencyMs: this.searchOps > 0
|
|
378
|
+
? this.totalSearchMs / this.searchOps
|
|
379
|
+
: 0,
|
|
380
|
+
hnswStats: {
|
|
381
|
+
nativeAvailable: this.adapter !== null,
|
|
382
|
+
vectorCount: rvfStatus?.totalVectors ?? 0,
|
|
383
|
+
indexSizeBytes: rvfStatus?.fileSizeBytes ?? 0,
|
|
384
|
+
...(this.rvfInitError ? { rvfInitError: this.rvfInitError } : {}),
|
|
385
|
+
},
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
async cleanup() {
|
|
389
|
+
if (!this.sqliteStore) {
|
|
390
|
+
return { removed: 0, promoted: 0 };
|
|
391
|
+
}
|
|
392
|
+
let removed = 0;
|
|
393
|
+
let promoted = 0;
|
|
394
|
+
try {
|
|
395
|
+
// Scan patterns and remove low-quality, promote high-quality
|
|
396
|
+
const patterns = this.sqliteStore.getPatterns({ limit: 10000 });
|
|
397
|
+
for (const pattern of patterns) {
|
|
398
|
+
if (pattern.confidence < this.config.minConfidence && pattern.usageCount > 3) {
|
|
399
|
+
await this.delete(pattern.id);
|
|
400
|
+
removed++;
|
|
401
|
+
}
|
|
402
|
+
else if (pattern.tier === 'short-term'
|
|
403
|
+
&& pattern.successfulUses >= PROMOTION_THRESHOLD) {
|
|
404
|
+
await this.promote(pattern.id);
|
|
405
|
+
promoted++;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
catch (error) {
|
|
410
|
+
console.warn('[RvfPatternStore] Cleanup error:', toErrorMessage(error));
|
|
411
|
+
}
|
|
412
|
+
return { removed, promoted };
|
|
413
|
+
}
|
|
414
|
+
// --------------------------------------------------------------------------
|
|
415
|
+
// Private helpers
|
|
416
|
+
// --------------------------------------------------------------------------
|
|
417
|
+
async ensureInitialized() {
|
|
418
|
+
if (!this.initialized) {
|
|
419
|
+
await this.initialize();
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
matchesFilters(pattern, options) {
|
|
423
|
+
if (options.patternType && pattern.patternType !== options.patternType)
|
|
424
|
+
return false;
|
|
425
|
+
if (options.domain && pattern.qeDomain !== options.domain)
|
|
426
|
+
return false;
|
|
427
|
+
if (options.tier && pattern.tier !== options.tier)
|
|
428
|
+
return false;
|
|
429
|
+
if (options.minConfidence && pattern.confidence < options.minConfidence)
|
|
430
|
+
return false;
|
|
431
|
+
if (options.minQualityScore && pattern.qualityScore < options.minQualityScore)
|
|
432
|
+
return false;
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
calculateReuseInfo(pattern, similarity) {
|
|
436
|
+
const reuseCfg = this.config.reuseOptimization;
|
|
437
|
+
const canReuse = reuseCfg.enabled
|
|
438
|
+
&& similarity >= reuseCfg.minSimilarityForReuse
|
|
439
|
+
&& pattern.successRate >= reuseCfg.minSuccessRateForReuse;
|
|
440
|
+
return {
|
|
441
|
+
canReuse,
|
|
442
|
+
estimatedTokenSavings: canReuse ? 500 : 0,
|
|
443
|
+
reuseConfidence: canReuse ? similarity * pattern.successRate : 0,
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
//# sourceMappingURL=rvf-pattern-store.js.map
|