agentic-qe 3.10.0 → 3.10.2
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/hooks/README.txt +17 -0
- package/.claude/hooks/aqe-hook.cjs +98 -0
- package/.claude/hooks/cross-phase-memory.yaml +296 -0
- package/.claude/hooks/post-task-sync.sh +113 -0
- package/.claude/hooks/v3-domain-workers.json +121 -0
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +148 -0
- package/README.md +35 -8
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-CR6J5C76.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-5UDM2PWG.js → agent-booster-wasm-DHSIPFTH.js} +2 -2
- package/dist/cli/chunks/{agent-handler-JSYER5YC.js → agent-handler-FPQVHGGT.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-T2SAHI4F.js → agent-memory-branch-OLOF5ZHV.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-2MNTHMB6.js +2 -0
- package/dist/cli/chunks/{audit-HIBRVGXG.js → audit-ALRYPHGP.js} +2 -2
- package/dist/cli/chunks/base-AOQNGMTL.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-TA4DZV62.js → better-sqlite3-5BT5FO64.js} +2 -2
- package/dist/cli/chunks/{brain-handler-N6AWIMXG.js → brain-handler-ROZUHCOT.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-VYQGBVEJ.js → branch-enumerator-VK7G4NKJ.js} +2 -2
- package/dist/cli/chunks/{browser-2X4WKZPT.js → browser-Q2S75M2F.js} +2 -2
- package/dist/cli/chunks/browser-workflow-UJ4A2ZXO.js +2 -0
- package/dist/cli/chunks/{chunk-BQX5QDU5.js → chunk-2244IFZA.js} +1 -1
- package/dist/cli/chunks/{chunk-S33246T4.js → chunk-22D6VBPD.js} +1 -1
- package/dist/cli/chunks/{chunk-UGX4EHT5.js → chunk-24LUQICS.js} +2 -2
- package/dist/cli/chunks/{chunk-6HCHW5TS.js → chunk-2EDWGHDA.js} +2 -2
- package/dist/cli/chunks/{chunk-4WYGUTSF.js → chunk-2JDLQWSV.js} +2 -2
- package/dist/cli/chunks/{chunk-3QULDB7K.js → chunk-2OH3ALYB.js} +1 -1
- package/dist/cli/chunks/chunk-3RHHKYUR.js +2 -0
- package/dist/cli/chunks/{chunk-Z6JLPPAY.js → chunk-3Z4FHA2E.js} +1 -1
- package/dist/cli/chunks/{chunk-ZYZWBNKT.js → chunk-4BXGVM2C.js} +1 -1
- package/dist/cli/chunks/{chunk-6F3WJOU2.js → chunk-4F3ZTXHP.js} +2 -2
- package/dist/cli/chunks/{chunk-CU4IUJ2K.js → chunk-4GTDW2XL.js} +2 -2
- package/dist/cli/chunks/{chunk-4UUDFWOP.js → chunk-5HB54RUS.js} +2 -2
- package/dist/cli/chunks/{chunk-YHNEBCYQ.js → chunk-5PL7WTCU.js} +2 -2
- package/dist/cli/chunks/{chunk-MF3XRML3.js → chunk-5PRFFHFV.js} +2 -2
- package/dist/cli/chunks/{chunk-TEJPHJMW.js → chunk-5QHSLWLP.js} +2 -2
- package/dist/cli/chunks/{chunk-ZFBMBCKN.js → chunk-5WJ3FWL4.js} +2 -2
- package/dist/cli/chunks/{chunk-V5TRAL57.js → chunk-6KSCXPPL.js} +2 -2
- package/dist/cli/chunks/{chunk-P6XYFDXN.js → chunk-6NZHEM4V.js} +1 -1
- package/dist/cli/chunks/{chunk-HD6CZBZV.js → chunk-6ZFHIKQG.js} +2 -2
- package/dist/cli/chunks/{chunk-VEOQH4W6.js → chunk-7DKYCVJI.js} +2 -2
- package/dist/cli/chunks/{chunk-Y4I5JBOL.js → chunk-7IVQ6OVR.js} +2 -2
- package/dist/cli/chunks/chunk-7IZ2OPC2.js +2 -0
- package/dist/cli/chunks/{chunk-AFFYJSW2.js → chunk-7QRMARM7.js} +2 -2
- package/dist/cli/chunks/{chunk-L2AIES7X.js → chunk-7SJX4CFK.js} +1 -1
- package/dist/cli/chunks/{chunk-UCIJCRPB.js → chunk-7SWD3D6Y.js} +2 -2
- package/dist/cli/chunks/{chunk-FCSJ7GIZ.js → chunk-7V5UHLNY.js} +4 -4
- package/dist/cli/chunks/{chunk-5QJDH4Z5.js → chunk-7Z46RDDV.js} +2 -2
- package/dist/cli/chunks/{chunk-5RQT7EJP.js → chunk-A5RMQG4N.js} +3 -3
- package/dist/cli/chunks/{chunk-3BO7EKGO.js → chunk-AH7FXNFE.js} +3 -3
- package/dist/cli/chunks/chunk-AIUSZC6K.js +3 -0
- package/dist/cli/chunks/{chunk-MJBXQXSX.js → chunk-AOI67HA3.js} +1 -1
- package/dist/cli/chunks/{chunk-6H5MRVJS.js → chunk-AV7KYE5P.js} +7 -7
- package/dist/cli/chunks/{chunk-OGT45MZN.js → chunk-AWFIEGR3.js} +2 -2
- package/dist/cli/chunks/{chunk-J5RJYFRM.js → chunk-BQCSCAUC.js} +2 -2
- package/dist/cli/chunks/{chunk-OUJJ34JH.js → chunk-C2M74HCN.js} +1 -1
- package/dist/cli/chunks/{chunk-G2HA2O3R.js → chunk-CIRPP7RQ.js} +2 -2
- package/dist/cli/chunks/{chunk-LXHA55EB.js → chunk-CMACGG4Z.js} +1 -1
- package/dist/cli/chunks/{chunk-LRISVDVO.js → chunk-CTDLI2ON.js} +1 -1
- package/dist/cli/chunks/{chunk-DXV6NRG3.js → chunk-CV2SBMBW.js} +2 -2
- package/dist/cli/chunks/{chunk-WLLE54TA.js → chunk-DMQPO43S.js} +1 -1
- package/dist/cli/chunks/{chunk-I4E6CLC4.js → chunk-DRWGK3YO.js} +2 -2
- package/dist/cli/chunks/{chunk-Z2SCTEZD.js → chunk-DZZEHPSJ.js} +2 -2
- package/dist/cli/chunks/{chunk-DY7IRNE2.js → chunk-EA7ZSN3V.js} +1 -1
- package/dist/cli/chunks/{chunk-M4HDBRVJ.js → chunk-EQBEGDTG.js} +1 -1
- package/dist/cli/chunks/{chunk-HZPXOAFW.js → chunk-ETN5563K.js} +2 -2
- package/dist/cli/chunks/{chunk-OWMGD7FO.js → chunk-EVCOCGVJ.js} +3 -3
- package/dist/cli/chunks/{chunk-27ACATRH.js → chunk-FO43SQXP.js} +2 -2
- package/dist/cli/chunks/{chunk-DQJJS4AX.js → chunk-FO73PZVU.js} +2 -2
- package/dist/cli/chunks/{chunk-FEBXP74Y.js → chunk-FPAW77XV.js} +1 -1
- package/dist/cli/chunks/{chunk-KYLJERZ3.js → chunk-FY3CUPNN.js} +20 -17
- package/dist/cli/chunks/{chunk-LQ3TA22E.js → chunk-G5U6Q42D.js} +2 -2
- package/dist/cli/chunks/{chunk-JCKX2LEJ.js → chunk-HA63NBFK.js} +49 -49
- package/dist/cli/chunks/{chunk-NT4PI5HI.js → chunk-HHCYSAH3.js} +2 -2
- package/dist/cli/chunks/{chunk-GPKZ4MMH.js → chunk-HJME6G5M.js} +1 -1
- package/dist/cli/chunks/{chunk-TR7BZLB6.js → chunk-HJORBNXW.js} +1 -1
- package/dist/cli/chunks/{chunk-BXCS55GB.js → chunk-HO37VP4O.js} +1 -1
- package/dist/cli/chunks/{chunk-FX4SYT6Y.js → chunk-I677W5BT.js} +3 -3
- package/dist/cli/chunks/chunk-IAZEDWRX.js +2 -0
- package/dist/cli/chunks/{chunk-5UOV7T36.js → chunk-IICTTDAA.js} +2 -2
- package/dist/cli/chunks/{chunk-BQT4J3BD.js → chunk-JF53LRBL.js} +2 -2
- package/dist/cli/chunks/{chunk-S4CNA6Z5.js → chunk-KB5L5TTF.js} +3 -3
- package/dist/cli/chunks/{chunk-UE3XXKLN.js → chunk-L7VIX22Y.js} +2 -2
- package/dist/cli/chunks/{chunk-C5QESAYA.js → chunk-LQTWPSYL.js} +1 -1
- package/dist/cli/chunks/{chunk-2GL4GH52.js → chunk-LZCBSFAU.js} +4 -4
- package/dist/cli/chunks/{chunk-LDMG4372.js → chunk-MCOFJHSJ.js} +2 -2
- package/dist/cli/chunks/{chunk-ZCNVFULO.js → chunk-MCZHKXB4.js} +2 -2
- package/dist/cli/chunks/{chunk-VTIXFHZR.js → chunk-MEY43PIQ.js} +2 -2
- package/dist/cli/chunks/{chunk-PNDO4W4L.js → chunk-MMIQ5DMA.js} +2 -2
- package/dist/cli/chunks/{chunk-NWHSEXHA.js → chunk-MNUTRAUV.js} +1 -1
- package/dist/cli/chunks/{chunk-XFUU2RCA.js → chunk-MNV3E5KY.js} +2 -2
- package/dist/cli/chunks/{chunk-WVCIZIKH.js → chunk-MYWQTCS4.js} +1 -1
- package/dist/cli/chunks/{chunk-T7DLX3LS.js → chunk-NZO4WUSO.js} +3 -3
- package/dist/cli/chunks/{chunk-RF6QKV7M.js → chunk-OIEQF7PG.js} +2 -2
- package/dist/cli/chunks/{chunk-NLCUQMUR.js → chunk-OIRZJCZY.js} +2 -2
- package/dist/cli/chunks/{chunk-KOSKGZK4.js → chunk-ON4D4TJ4.js} +2 -2
- package/dist/cli/chunks/chunk-OPFN5LFT.js +95 -0
- package/dist/cli/chunks/{chunk-55JPAF56.js → chunk-ORF2UKQH.js} +1 -1
- package/dist/cli/chunks/{chunk-M73IL7FA.js → chunk-OWQ6HEYI.js} +2 -2
- package/dist/cli/chunks/{chunk-O3NAUNFC.js → chunk-OXCEUR5F.js} +2 -2
- package/dist/cli/chunks/{chunk-BTIVIWIG.js → chunk-PEK6NGVJ.js} +1 -1
- package/dist/cli/chunks/{chunk-ALCQRJDY.js → chunk-PIZYRPMT.js} +2 -2
- package/dist/cli/chunks/{chunk-L3IFZ4IX.js → chunk-PXTDEO65.js} +2 -2
- package/dist/cli/chunks/{chunk-3U77XX6J.js → chunk-PYIHZXCI.js} +12 -12
- package/dist/cli/chunks/{chunk-FQ5FT7IE.js → chunk-QBRHKTFT.js} +1 -1
- package/dist/cli/chunks/{chunk-I4T4JPR2.js → chunk-QEPFXY6G.js} +1 -1
- package/dist/cli/chunks/{chunk-X4U5NYB6.js → chunk-QJ2EHLJ2.js} +1 -1
- package/dist/cli/chunks/{chunk-JKVNZASH.js → chunk-QQNCSEZG.js} +2 -2
- package/dist/cli/chunks/{chunk-URVDWF2Y.js → chunk-QSE67XJO.js} +2 -2
- package/dist/cli/chunks/{chunk-RARSTEUO.js → chunk-R2O6OKT2.js} +1 -1
- package/dist/cli/chunks/{chunk-RGONSQ44.js → chunk-RLXTBL3H.js} +210 -210
- package/dist/cli/chunks/{chunk-RH3PHCJT.js → chunk-RNREAOY4.js} +2 -2
- package/dist/cli/chunks/{chunk-2POXDKUB.js → chunk-S3OZ7XSY.js} +1 -1
- package/dist/cli/chunks/{provider-manager-HV55NIIO.js → chunk-S3ZO7JXS.js} +13 -13
- package/dist/cli/chunks/{chunk-QWBO76AU.js → chunk-SJH3HYNC.js} +2 -2
- package/dist/cli/chunks/{chunk-WC6KZDPM.js → chunk-STEGWLH5.js} +2 -2
- package/dist/cli/chunks/{chunk-KCHFF4IE.js → chunk-SVYTN2GT.js} +2 -2
- package/dist/cli/chunks/{chunk-OKGK7DBT.js → chunk-SW4OKUTC.js} +2 -2
- package/dist/cli/chunks/{chunk-3OSCWD7Z.js → chunk-THRTUW4Z.js} +1 -1
- package/dist/cli/chunks/{chunk-U56TIYGP.js → chunk-TJKDATEU.js} +2 -2
- package/dist/cli/chunks/{chunk-4NQ6KANC.js → chunk-U3EUH6LX.js} +2 -2
- package/dist/cli/chunks/{chunk-7Y54QZKF.js → chunk-UUFOHMUG.js} +2 -2
- package/dist/cli/chunks/{chunk-W6U7SIIK.js → chunk-UVU7XLJY.js} +3 -3
- package/dist/cli/chunks/chunk-UWXH2UQK.js +2 -0
- package/dist/cli/chunks/{chunk-YYDHTBHE.js → chunk-UYYBPWU3.js} +1 -1
- package/dist/cli/chunks/{chunk-LYVFC7C7.js → chunk-VSUTI4G6.js} +2 -2
- package/dist/cli/chunks/{chunk-SGONA5GS.js → chunk-WDMPJ2M2.js} +2 -2
- package/dist/cli/chunks/{chunk-66GIKUI2.js → chunk-WNR2KAUH.js} +2 -2
- package/dist/cli/chunks/{chunk-M3M7HXDH.js → chunk-WSVUSIAZ.js} +2 -2
- package/dist/cli/chunks/{chunk-SCYF5CQA.js → chunk-WZJUMJ2S.js} +1 -1
- package/dist/cli/chunks/{chunk-WG6I7YF3.js → chunk-X2VAOIUY.js} +1 -1
- package/dist/cli/chunks/{chunk-7ZIRDBXH.js → chunk-XDSA7YUQ.js} +1 -1
- package/dist/cli/chunks/{chunk-HIWBW4IQ.js → chunk-XDU624HU.js} +1 -1
- package/dist/cli/chunks/{chunk-JUICZG3T.js → chunk-XGBAHAGC.js} +2 -2
- package/dist/cli/chunks/{chunk-DQLEZBWV.js → chunk-XMJTTF5N.js} +2 -2
- package/dist/cli/chunks/{chunk-KNL3QWVA.js → chunk-XPCNUX2U.js} +2 -2
- package/dist/cli/chunks/{chunk-VTO5O7DA.js → chunk-XRJECWZE.js} +1 -1
- package/dist/cli/chunks/{chunk-HD5NQDOL.js → chunk-XTCUN36Z.js} +2 -2
- package/dist/cli/chunks/{chunk-KDFW7MVM.js → chunk-Y63MBMOV.js} +2 -2
- package/dist/cli/chunks/{chunk-L4N6PTIC.js → chunk-YACT5WFC.js} +2 -2
- package/dist/cli/chunks/{chunk-QU54GUEA.js → chunk-YI6GNRQM.js} +2 -2
- package/dist/cli/chunks/chunk-YNNOY3XN.js +62 -0
- package/dist/cli/chunks/{chunk-GXCD7GNH.js → chunk-YWZHMXTO.js} +2 -2
- package/dist/cli/chunks/{chunk-XFMSHTXG.js → chunk-ZDHMZPSL.js} +1 -1
- package/dist/cli/chunks/{chunk-F363JJUI.js → chunk-ZGNZJJFF.js} +1 -1
- package/dist/cli/chunks/{chunk-UCXQQCIP.js → chunk-ZK2BH23O.js} +2 -2
- package/dist/cli/chunks/{chunk-IQNR662U.js → chunk-ZQUXNG5X.js} +2 -2
- package/dist/cli/chunks/{chunk-IBXNBLGM.js → chunk-ZXTO4C7R.js} +2 -2
- package/dist/cli/chunks/{ci-7TR4NQ5I.js → ci-PYCRCL7G.js} +2 -2
- package/dist/cli/chunks/{ci-output-SLTICF3O.js → ci-output-EKQQFE2D.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-7GVVTMBY.js → circuit-breaker-RH3Q2MJO.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-TYCWYEMM.js → claude-flow-setup-DUDXB4VV.js} +2 -2
- package/dist/cli/chunks/client-RDPWGOSA.js +2 -0
- package/dist/cli/chunks/{cline-installer-ESIAJOLK.js → cline-installer-3Q4WIWUG.js} +2 -2
- package/dist/cli/chunks/{code-I42JGOVI.js → code-E4Q6DGOO.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-2CCXPCQW.js → code-index-extractor-2PCISUOW.js} +2 -2
- package/dist/cli/chunks/{codex-installer-HEZRDNUT.js → codex-installer-YNNNOLJ6.js} +2 -2
- package/dist/cli/chunks/{completions-44HLIZGI.js → completions-2F7TUFBD.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-SOCSFDVO.js → complexity-analyzer-2B6MHO7W.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-Q7O4HLIM.js → continuedev-installer-ENOKRU5M.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-GIWCVLCS.js → copilot-installer-6YD2KM5F.js} +2 -2
- package/dist/cli/chunks/{cost-tracker-G7BONKEV.js → cost-tracker-FCH4QOEA.js} +2 -2
- package/dist/cli/chunks/{coverage-5TWVP7KY.js → coverage-JTOXZE3T.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-4K5ZVZEZ.js +2 -0
- package/dist/cli/chunks/{cursor-installer-43EQZSB5.js → cursor-installer-QZFBUGLQ.js} +2 -2
- package/dist/cli/chunks/{daemon-ZXHFRDKG.js → daemon-K4QFB5FQ.js} +3 -3
- package/dist/cli/chunks/{daemon-QQZE4BU2.js → daemon-M422U3ZA.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-GOZAVAZQ.js → dag-attention-scheduler-BXAAW33V.js} +2 -2
- package/dist/cli/chunks/{detect-X777GVJ4.js → detect-UGSWIOAD.js} +2 -2
- package/dist/cli/chunks/{dist-node-EZZK46TB.js → dist-node-FN3HX3OK.js} +2 -2
- package/dist/cli/chunks/{domain-handler-ZT32DKYY.js → domain-handler-7PP7VYA7.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-LHQVSLJW.js → domain-transfer-XZM44W7I.js} +2 -2
- package/dist/cli/chunks/dream-RPNWM7VS.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-XFYPPWG7.js → embed-and-insert-pattern-JZVERJ5L.js} +2 -2
- package/dist/cli/chunks/{eval-V4NYJZUZ.js → eval-466NFF2D.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-HXX2W4GL.js → experience-capture-middleware-I7IQCC7V.js} +3 -3
- package/dist/cli/chunks/{fast-paths-RBPWQSFJ.js → fast-paths-34OICNZA.js} +2 -2
- package/dist/cli/chunks/{feature-flags-NX5EXRO3.js → feature-flags-6UBIVTAD.js} +2 -2
- package/dist/cli/chunks/{feature-flags-INJJZBMN.js → feature-flags-X5WBBWSO.js} +2 -2
- package/dist/cli/chunks/{file-discovery-SNFSG6NK.js → file-discovery-NLMDBWXX.js} +2 -2
- package/dist/cli/chunks/{fleet-6SDN4UWE.js → fleet-W7CYCHDI.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-2JDRTDDK.js → gnn-wrapper-K4VTAG5X.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-QLK6E7KA.js → heartbeat-handler-ZGKF2Z6T.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-JBCXMMZO.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-3SC2HZIG.js +2 -0
- package/dist/cli/chunks/hnsw-index-FQORAR6K.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-Q2ZEZQKB.js → hnsw-legacy-bridge-ELDRLKK5.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-Y6GX6CGB.js → hnswlib-node-ZGSUMHDC.js} +2 -2
- package/dist/cli/chunks/{hooks-D4YENHO2.js → hooks-T4CBINAV.js} +13 -13
- package/dist/cli/chunks/hybrid-router-6CBFDXPR.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-G72U446M.js → hypergraph-engine-UWFW3XP5.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-TRZ5FDRH.js → hypergraph-handler-PK2BI46K.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-SOEFVZWG.js +2 -0
- package/dist/cli/chunks/{init-handler-3ZD4GCT4.js → init-handler-HNG6KJOU.js} +6 -6
- package/dist/cli/chunks/init-wizard-3E4IU5M4.js +2 -0
- package/dist/cli/chunks/kernel-GFZP4G5J.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-AXSIW3XW.js → kilocode-installer-25V7FEJ4.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-JQGIFWBK.js → kiro-installer-7RMTTCQB.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-BKRKBU26.js +2 -0
- package/dist/cli/chunks/{learning-SPO7TGWX.js → learning-XQC2MG2R.js} +3 -3
- package/dist/cli/chunks/llm-router-6KTTONH4.js +36 -0
- package/dist/cli/chunks/llm-router-service-KE4IGZPP.js +2 -0
- package/dist/cli/chunks/{load-XIDDK64U.js → load-BV64P3AL.js} +2 -2
- package/dist/cli/chunks/load-test-VSYJV2AO.js +2 -0
- package/dist/cli/chunks/{mcp-3JXRGXO4.js → mcp-U5ZN77TA.js} +2 -2
- package/dist/cli/chunks/{memory-A66KRS2P.js → memory-WB5BNBK7.js} +5 -5
- package/dist/cli/chunks/memory-backend-B72RGHRF.js +2 -0
- package/dist/cli/chunks/memory-handlers-NWCH7AUO.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-XCDGUVCE.js → multi-model-executor-3X3W3UTY.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-GELXWLF2.js → opencode-installer-TTTMG7ZZ.js} +2 -2
- package/dist/cli/chunks/{orchestrator-CCS3K6NH.js → orchestrator-BLCGSHMZ.js} +18 -18
- package/dist/cli/chunks/{pipeline-Z5C72H5S.js → pipeline-DZPGMRG7.js} +2 -2
- package/dist/cli/chunks/{platform-4AK7XJ3Y.js → platform-EVMZAUNV.js} +2 -2
- package/dist/cli/chunks/{plugin-7RYBIZI7.js → plugin-OR55K4HT.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-E5PARKRX.js → prime-radiant-advanced-wasm-4ODV27HD.js} +2 -2
- package/dist/cli/chunks/protocol-executor-V3F37FPO.js +2 -0
- package/dist/cli/chunks/{protocol-handler-R6QJQFNL.js → protocol-handler-ZOTI5PID.js} +2 -2
- package/dist/cli/chunks/{prove-7ESQ2YAL.js → prove-DIMBYJ7V.js} +2 -2
- package/dist/cli/chunks/provider-manager-2PN72TT6.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-P665QNIR.js +2 -0
- package/dist/cli/chunks/{quality-4UE345QA.js → quality-7MX4VL6M.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-XD4F7BGB.js +2 -0
- package/dist/cli/chunks/{real-embeddings-TYIVN3N5.js → real-embeddings-YPUHWRN2.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-2KOANC47.js → roocode-installer-WG5AU4QM.js} +2 -2
- package/dist/cli/chunks/router-4SSNWDJC.js +2 -0
- package/dist/cli/chunks/routing-feedback-O2JSIBW6.js +2 -0
- package/dist/cli/chunks/{routing-handler-JFEYTN7T.js → routing-handler-LZB4MN2K.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-KSLSZRJX.js → ruvector-commands-YE4ADBMC.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-EPBL226J.js → rvf-dual-writer-QS5ATW4C.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-25KSI6SF.js → rvf-migration-adapter-YIGKSBD3.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-2XBYHPZP.js → rvf-migration-coordinator-2NDCWP7F.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-WIUHYXRB.js +2 -0
- package/dist/cli/chunks/safe-db-WL5Y7ZNS.js +2 -0
- package/dist/cli/chunks/schedule-U7QDGU5A.js +2 -0
- package/dist/cli/chunks/scheduler-LXKGQYXA.js +2 -0
- package/dist/cli/chunks/{security-4XWYKI4O.js → security-HT4SUT24.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-WRZ3HGDQ.js → shared-rvf-adapter-4IZOJL33.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-DX2N5STR.js → shared-rvf-dual-writer-ZKFO7CBY.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-4KFO3SEB.js +2 -0
- package/dist/cli/chunks/{status-handler-V75OSXMQ.js → status-handler-AMEMKBI4.js} +2 -2
- package/dist/cli/chunks/{structural-health-TLX3JHZ6.js → structural-health-RBADRLC3.js} +2 -2
- package/dist/cli/chunks/{sync-KGBEXUF7.js → sync-ARDDLQBS.js} +2 -2
- package/dist/cli/chunks/{sync-DXZFMVZQ.js → sync-PCB23M4K.js} +2 -2
- package/dist/cli/chunks/{task-handler-T3OJ6R7H.js → task-handler-J26FSCH5.js} +2 -2
- package/dist/cli/chunks/{task-handlers-NJYR54AS.js → task-handlers-AQRLR6BL.js} +3 -3
- package/dist/cli/chunks/{test-KMVDNNQA.js → test-YXWSIOSB.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-R5EQ2XGV.js → test-scheduling-XY532GI4.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-PFKVV3RO.js → token-bootstrap-KL2QIQ36.js} +2 -2
- package/dist/cli/chunks/{token-usage-ZLOGA6LR.js → token-usage-2MJVE4DT.js} +2 -2
- package/dist/cli/chunks/{transformers-TNPSPQI3.js → transformers-QSNTOD2Z.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-A2EEB5BF.js → tree-sitter-wasm-parser-QJOKHOIW.js} +2 -2
- package/dist/cli/chunks/{types-DIXPI4NR.js → types-RNKRSYMO.js} +2 -2
- package/dist/cli/chunks/unified-memory-7AS4LIEF.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-GREESNJX.js +2 -0
- package/dist/cli/chunks/unified-persistence-BPJOMZOA.js +2 -0
- package/dist/cli/chunks/{upgrade-LX5KP6VO.js → upgrade-EKJHIFWP.js} +2 -2
- package/dist/cli/chunks/{validate-3L6F7M36.js → validate-KS4T7LWC.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-FD42ZKAQ.js → validate-swarm-SKKWRP2H.js} +2 -2
- package/dist/cli/chunks/{vibium-GSBSJR53.js → vibium-FLUQO4IF.js} +2 -2
- package/dist/cli/chunks/visual-security-BW662FHQ.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-TXHMO4BW.js → web-tree-sitter-UMC63DWD.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-3EUZ6RD3.js → windsurf-installer-V3FQGJIQ.js} +2 -2
- package/dist/cli/chunks/{witness-chain-ONAUEJ4M.js → witness-chain-GE74TLSO.js} +2 -2
- package/dist/cli/chunks/witness-chain-OXVDLNVT.js +2 -0
- package/dist/cli/chunks/{workflow-E7A6BV4C.js → workflow-4YZ2RPWA.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-KKNR46XV.js +2 -0
- package/dist/cli/chunks/{wrappers-AHHAQJM3.js → wrappers-37NLMKPE.js} +2 -2
- package/dist/cli/commands/hooks-handlers/command-hooks.js +1 -1
- package/dist/cli/commands/hooks-handlers/routing-hooks.js +1 -1
- package/dist/cli/commands/hooks-handlers/task-hooks.js +1 -1
- package/dist/cli/commands/llm-router.js +83 -26
- package/dist/domains/chaos-resilience/coordinator.d.ts +2 -1
- package/dist/domains/chaos-resilience/coordinator.js +3 -2
- package/dist/domains/chaos-resilience/plugin.d.ts +4 -2
- package/dist/domains/chaos-resilience/plugin.js +8 -5
- package/dist/domains/code-intelligence/coordinator.d.ts +2 -1
- package/dist/domains/code-intelligence/coordinator.js +3 -2
- package/dist/domains/code-intelligence/plugin.d.ts +4 -2
- package/dist/domains/code-intelligence/plugin.js +8 -5
- package/dist/domains/contract-testing/coordinator.d.ts +2 -1
- package/dist/domains/contract-testing/coordinator.js +3 -2
- package/dist/domains/contract-testing/plugin.d.ts +4 -2
- package/dist/domains/contract-testing/plugin.js +8 -5
- package/dist/domains/coverage-analysis/coordinator.d.ts +2 -1
- package/dist/domains/coverage-analysis/coordinator.js +4 -3
- package/dist/domains/coverage-analysis/plugin.d.ts +3 -2
- package/dist/domains/coverage-analysis/plugin.js +4 -4
- package/dist/domains/defect-intelligence/coordinator.d.ts +2 -1
- package/dist/domains/defect-intelligence/coordinator.js +4 -3
- package/dist/domains/defect-intelligence/plugin.d.ts +4 -2
- package/dist/domains/defect-intelligence/plugin.js +9 -6
- package/dist/domains/learning-optimization/coordinator.d.ts +2 -1
- package/dist/domains/learning-optimization/coordinator.js +3 -2
- package/dist/domains/learning-optimization/plugin.d.ts +4 -2
- package/dist/domains/learning-optimization/plugin.js +8 -5
- package/dist/domains/quality-assessment/coordinator.d.ts +2 -1
- package/dist/domains/quality-assessment/coordinator.js +4 -3
- package/dist/domains/quality-assessment/plugin.d.ts +4 -2
- package/dist/domains/quality-assessment/plugin.js +10 -6
- package/dist/domains/requirements-validation/coordinator.d.ts +2 -1
- package/dist/domains/requirements-validation/coordinator.js +3 -2
- package/dist/domains/requirements-validation/plugin.d.ts +4 -2
- package/dist/domains/requirements-validation/plugin.js +8 -5
- package/dist/domains/security-compliance/coordinator.d.ts +2 -1
- package/dist/domains/security-compliance/coordinator.js +4 -2
- package/dist/domains/security-compliance/plugin.d.ts +4 -2
- package/dist/domains/security-compliance/plugin.js +11 -6
- package/dist/domains/test-execution/coordinator.d.ts +3 -2
- package/dist/domains/test-execution/coordinator.js +6 -5
- package/dist/domains/test-execution/plugin.d.ts +4 -2
- package/dist/domains/test-execution/plugin.js +6 -4
- package/dist/domains/test-generation/coordinator.d.ts +2 -1
- package/dist/domains/test-generation/coordinator.js +4 -3
- package/dist/domains/test-generation/plugin.d.ts +4 -2
- package/dist/domains/test-generation/plugin.js +12 -7
- package/dist/domains/visual-accessibility/coordinator.d.ts +2 -1
- package/dist/domains/visual-accessibility/coordinator.js +4 -3
- package/dist/domains/visual-accessibility/plugin.d.ts +4 -2
- package/dist/domains/visual-accessibility/plugin.js +9 -6
- package/dist/init/init-wizard-hooks.js +271 -271
- package/dist/init/phases/07-hooks.d.ts +7 -0
- package/dist/init/phases/07-hooks.js +132 -96
- package/dist/kernel/interfaces.d.ts +37 -0
- package/dist/kernel/kernel.d.ts +39 -0
- package/dist/kernel/kernel.js +157 -17
- package/dist/learning/agent-routing.d.ts +19 -0
- package/dist/learning/agent-routing.js +27 -1
- package/dist/learning/dream/dream-scheduler.d.ts +11 -36
- package/dist/learning/dream/dream-scheduler.js +44 -0
- package/dist/learning/experience-consolidation.d.ts +16 -0
- package/dist/learning/experience-consolidation.js +55 -11
- package/dist/learning/pattern-lifecycle.d.ts +21 -0
- package/dist/learning/pattern-lifecycle.js +70 -6
- package/dist/mcp/bundle.js +426 -401
- package/dist/mcp/protocol-server.js +13 -14
- package/dist/mcp/qe-tool-bridge.js +8 -1
- package/dist/mcp/tools/base.d.ts +56 -0
- package/dist/mcp/tools/base.js +104 -1
- package/dist/mcp/tools/chaos-resilience/inject.js +4 -2
- package/dist/mcp/tools/code-intelligence/analyze.js +5 -3
- package/dist/mcp/tools/contract-testing/validate.js +4 -2
- package/dist/mcp/tools/coverage-analysis/index.js +11 -5
- package/dist/mcp/tools/defect-intelligence/predict.js +5 -10
- package/dist/mcp/tools/learning-optimization/optimize.js +4 -2
- package/dist/mcp/tools/registry.js +8 -1
- package/dist/mcp/tools/test-generation/generate.js +10 -6
- package/dist/mcp/tools/visual-accessibility/index.js +7 -4
- package/dist/mcp/transport/stdio.d.ts +20 -0
- package/dist/mcp/transport/stdio.js +35 -2
- package/dist/shared/llm/llm-router-service.d.ts +77 -0
- package/dist/shared/llm/llm-router-service.js +166 -0
- package/dist/shared/llm/providers/gemini.js +5 -2
- package/dist/shared/llm/router/config-store.d.ts +89 -0
- package/dist/shared/llm/router/config-store.js +261 -0
- package/dist/shared/llm/router/hybrid-router.js +33 -11
- package/dist/shared/utils/rabitq.d.ts +133 -0
- package/dist/shared/utils/rabitq.js +201 -0
- package/package.json +8 -2
- package/dist/cli/chunks/adapter-WTE6UVGP.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-LCLEBU7D.js +0 -2
- package/dist/cli/chunks/base-73I73HBF.js +0 -2
- package/dist/cli/chunks/browser-workflow-2NSV5O6W.js +0 -2
- package/dist/cli/chunks/chunk-6MONUYQ5.js +0 -2
- package/dist/cli/chunks/chunk-QL3U5VSM.js +0 -62
- package/dist/cli/chunks/chunk-VMJXNTJT.js +0 -95
- package/dist/cli/chunks/chunk-X73CRYF4.js +0 -2
- package/dist/cli/chunks/client-7GB4WWUD.js +0 -2
- package/dist/cli/chunks/cross-domain-router-7HQ74TLE.js +0 -2
- package/dist/cli/chunks/dream-G5SEFHI4.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-NG7BY3FR.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-TDSLUI7K.js +0 -2
- package/dist/cli/chunks/hnsw-index-OWLQSOQH.js +0 -2
- package/dist/cli/chunks/hybrid-router-URU2XLBD.js +0 -2
- package/dist/cli/chunks/impact-analyzer-NMTN75KA.js +0 -2
- package/dist/cli/chunks/init-wizard-SHBFYGBV.js +0 -2
- package/dist/cli/chunks/kernel-7KVY2JGO.js +0 -2
- package/dist/cli/chunks/knowledge-graph-V4G5J5B7.js +0 -2
- package/dist/cli/chunks/llm-router-G6N2OKDA.js +0 -36
- package/dist/cli/chunks/load-test-N4RNPLG4.js +0 -2
- package/dist/cli/chunks/memory-backend-HPGJ5YDQ.js +0 -2
- package/dist/cli/chunks/memory-handlers-K33YVCVQ.js +0 -2
- package/dist/cli/chunks/protocol-executor-GNVWUJUP.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-DDSBHO6D.js +0 -2
- package/dist/cli/chunks/queen-coordinator-BQJ5O63C.js +0 -2
- package/dist/cli/chunks/router-C2RKWB7J.js +0 -2
- package/dist/cli/chunks/routing-feedback-RHATTSJ6.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-QG4CXHLL.js +0 -2
- package/dist/cli/chunks/safe-db-A4KQ2IDB.js +0 -2
- package/dist/cli/chunks/schedule-O7MLASQT.js +0 -2
- package/dist/cli/chunks/scheduler-HT7RNYQ2.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-4NNKJ6CQ.js +0 -2
- package/dist/cli/chunks/unified-memory-CMNJVHOJ.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-JQLU2KI6.js +0 -2
- package/dist/cli/chunks/unified-persistence-I25TEDIU.js +0 -2
- package/dist/cli/chunks/visual-security-AJJIEV5V.js +0 -2
- package/dist/cli/chunks/witness-chain-762QQBTN.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-ZGPYISKY.js +0 -2
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RaBitQ-style 1-bit sign signatures for fast vector retrieval.
|
|
3
|
+
*
|
|
4
|
+
* Ports ruflo's perf-M4 optimization: sign-random-projection + Hamming popcount
|
|
5
|
+
* as a cheap prefilter ahead of exact cosine reranking.
|
|
6
|
+
*
|
|
7
|
+
* ## Why this works
|
|
8
|
+
*
|
|
9
|
+
* For unit-normalized embeddings, the sign of each coordinate is a valid
|
|
10
|
+
* Locality-Sensitive Hash (LSH) for cosine similarity: the probability that two
|
|
11
|
+
* vectors agree on the sign of a random projection is `1 - theta/pi`, where
|
|
12
|
+
* `theta` is the angle between them (Charikar 2002, "SimHash"). The AQE
|
|
13
|
+
* canonical embedding dimension is 384 (patterns.rvf dim=384); the coordinate
|
|
14
|
+
* basis itself acts as the random projection family, so `bit_i = (vec[i] >= 0)`
|
|
15
|
+
* yields a Hamming distance that is monotonically related to cosine angle.
|
|
16
|
+
*
|
|
17
|
+
* We therefore use Hamming distance over packed 1-bit signatures as a *cheap*
|
|
18
|
+
* ranking proxy to shrink the candidate pool, then run *exact* cosine on the
|
|
19
|
+
* survivors. With a large enough rerank pool the final top-k is identical to a
|
|
20
|
+
* full exact scan — only the work is reduced.
|
|
21
|
+
*
|
|
22
|
+
* ## Memory
|
|
23
|
+
*
|
|
24
|
+
* A 384-dim Float32 vector costs 1536 bytes. Its sign signature costs 48 bytes
|
|
25
|
+
* (12 × uint32). That is a 32× index-memory reduction for the prefilter stage.
|
|
26
|
+
*
|
|
27
|
+
* Self-contained: no I/O, no side effects, pure functions + one ranking helper.
|
|
28
|
+
*
|
|
29
|
+
* @module shared/utils/rabitq
|
|
30
|
+
*/
|
|
31
|
+
/** AQE canonical embedding dimension (patterns.rvf dim=384). */
|
|
32
|
+
export declare const SIGNATURE_DIM = 384;
|
|
33
|
+
/**
|
|
34
|
+
* Bytes per signature for the canonical 384-dim embedding:
|
|
35
|
+
* ceil(384 / 32) = 12 words × 4 bytes = 48 bytes.
|
|
36
|
+
* (vs 384 × 4 = 1536 bytes for the raw Float32 vector → 32× reduction.)
|
|
37
|
+
*/
|
|
38
|
+
export declare const SIGNATURE_BYTES: number;
|
|
39
|
+
/**
|
|
40
|
+
* Build a 1-bit sign signature from a vector.
|
|
41
|
+
*
|
|
42
|
+
* `bit_i = (vec[i] >= 0)`. Bits are packed LSB-first into Uint32 words:
|
|
43
|
+
* coordinate `i` lives in word `i >> 5` at bit `i & 31`.
|
|
44
|
+
*
|
|
45
|
+
* For a 384-dim input this returns 12 words (48 bytes). Inputs of other
|
|
46
|
+
* dimensions are supported (signature length = ceil(dim / 32) words).
|
|
47
|
+
*
|
|
48
|
+
* @param vec Embedding vector (assumed unit-normalized for the LSH guarantee,
|
|
49
|
+
* but the function works on any real vector).
|
|
50
|
+
* @returns Packed sign bits as a Uint32Array.
|
|
51
|
+
*/
|
|
52
|
+
export declare function signSignature(vec: number[] | Float32Array): Uint32Array;
|
|
53
|
+
/**
|
|
54
|
+
* Hamming distance between two packed signatures: popcount(a XOR b) summed
|
|
55
|
+
* over all words.
|
|
56
|
+
*
|
|
57
|
+
* @throws If the two signatures have different word lengths.
|
|
58
|
+
*/
|
|
59
|
+
export declare function hammingDistance(a: Uint32Array, b: Uint32Array): number;
|
|
60
|
+
/**
|
|
61
|
+
* Hamming similarity in [0, 1]: `1 - hammingDistance / bits`.
|
|
62
|
+
*
|
|
63
|
+
* This is a monotonic proxy for cosine similarity (higher = closer). `bits`
|
|
64
|
+
* should be the true embedding dimension (e.g. 384), not `words × 32`, so that
|
|
65
|
+
* trailing padding bits — which are always 0 in both signatures and never
|
|
66
|
+
* contribute to the distance — don't deflate the normalization.
|
|
67
|
+
*/
|
|
68
|
+
export declare function hammingSimilarity(a: Uint32Array, b: Uint32Array, bits: number): number;
|
|
69
|
+
/** A retrieval candidate. `signature` is optional and lazily built if absent. */
|
|
70
|
+
export interface RaBitQCandidate {
|
|
71
|
+
id: string;
|
|
72
|
+
vector: number[] | Float32Array;
|
|
73
|
+
/** Precomputed sign signature; built on demand from `vector` if omitted. */
|
|
74
|
+
signature?: Uint32Array;
|
|
75
|
+
}
|
|
76
|
+
/** A scored result. `score` is the exact cosine similarity (or Hamming proxy). */
|
|
77
|
+
export interface RaBitQResult {
|
|
78
|
+
id: string;
|
|
79
|
+
score: number;
|
|
80
|
+
}
|
|
81
|
+
/** Tuning knobs for {@link topKBySignature}. */
|
|
82
|
+
export interface TopKOptions {
|
|
83
|
+
/**
|
|
84
|
+
* Below this candidate count, skip RaBitQ entirely and do an exact cosine
|
|
85
|
+
* top-k. RaBitQ's signature-build + Hamming-scan overhead is not worth it for
|
|
86
|
+
* small N. Default 100 (matches ruflo's gate).
|
|
87
|
+
*/
|
|
88
|
+
gateN?: number;
|
|
89
|
+
/**
|
|
90
|
+
* How many Hamming-ranked candidates to feed into the exact rerank.
|
|
91
|
+
*
|
|
92
|
+
* Larger pool → higher recall, more exact-cosine work. **Default is
|
|
93
|
+
* recall-aware**: `max(4 × k, ceil(0.4 × N))`.
|
|
94
|
+
*
|
|
95
|
+
* IMPORTANT — empirically measured tradeoff (384-dim, see
|
|
96
|
+
* scripts/benchmark-rabitq.ts): a 1-bit sign signature is a *coarse*
|
|
97
|
+
* quantization, so a small fixed pool (e.g. `4 × k = 40`) does NOT preserve
|
|
98
|
+
* recall@10 at scale — at N=1000 it captures only ~70-85% of the true top-10,
|
|
99
|
+
* and worse at N=5000. To keep recall@10 ≥ ~0.95 the pool must be a sizeable
|
|
100
|
+
* fraction of N (~40% empirically), which limits the achievable speedup.
|
|
101
|
+
* Callers that can tolerate lower recall may pass a smaller pool for more
|
|
102
|
+
* speed; callers that need exact output should not use RaBitQ at all.
|
|
103
|
+
*/
|
|
104
|
+
rerankPool?: number;
|
|
105
|
+
/**
|
|
106
|
+
* If true (default), run full cosineSimilarity on the Hamming-top pool and
|
|
107
|
+
* return the true top-k by cosine. If false, return the Hamming-only ranking
|
|
108
|
+
* (faster, approximate).
|
|
109
|
+
*/
|
|
110
|
+
exactRerank?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Retrieve the top-k candidates for a query using a RaBitQ Hamming prefilter
|
|
114
|
+
* followed by an exact cosine rerank.
|
|
115
|
+
*
|
|
116
|
+
* Behavior:
|
|
117
|
+
* - `candidates.length < gateN` → plain exact cosine top-k (gate; RaBitQ
|
|
118
|
+
* overhead not worth it for small N).
|
|
119
|
+
* - otherwise → build/reuse sign signatures, rank ALL candidates by Hamming
|
|
120
|
+
* distance (cheap), take the top `rerankPool`, then:
|
|
121
|
+
* - `exactRerank=true` (default): run FULL cosine on just that pool and
|
|
122
|
+
* return the true top-k. Output equals an exact scan whenever the true
|
|
123
|
+
* top-k all fall within the Hamming top-`rerankPool` — recall is
|
|
124
|
+
* preserved by the rerank, only speed changes.
|
|
125
|
+
* - `exactRerank=false`: return the Hamming-only top-k (approximate).
|
|
126
|
+
*
|
|
127
|
+
* @param query Query vector (same dimension as candidate vectors).
|
|
128
|
+
* @param candidates Candidate set.
|
|
129
|
+
* @param k Number of results to return.
|
|
130
|
+
* @param opts Tuning knobs (see {@link TopKOptions}).
|
|
131
|
+
*/
|
|
132
|
+
export declare function topKBySignature(query: number[] | Float32Array, candidates: RaBitQCandidate[], k: number, opts?: TopKOptions): RaBitQResult[];
|
|
133
|
+
//# sourceMappingURL=rabitq.d.ts.map
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RaBitQ-style 1-bit sign signatures for fast vector retrieval.
|
|
3
|
+
*
|
|
4
|
+
* Ports ruflo's perf-M4 optimization: sign-random-projection + Hamming popcount
|
|
5
|
+
* as a cheap prefilter ahead of exact cosine reranking.
|
|
6
|
+
*
|
|
7
|
+
* ## Why this works
|
|
8
|
+
*
|
|
9
|
+
* For unit-normalized embeddings, the sign of each coordinate is a valid
|
|
10
|
+
* Locality-Sensitive Hash (LSH) for cosine similarity: the probability that two
|
|
11
|
+
* vectors agree on the sign of a random projection is `1 - theta/pi`, where
|
|
12
|
+
* `theta` is the angle between them (Charikar 2002, "SimHash"). The AQE
|
|
13
|
+
* canonical embedding dimension is 384 (patterns.rvf dim=384); the coordinate
|
|
14
|
+
* basis itself acts as the random projection family, so `bit_i = (vec[i] >= 0)`
|
|
15
|
+
* yields a Hamming distance that is monotonically related to cosine angle.
|
|
16
|
+
*
|
|
17
|
+
* We therefore use Hamming distance over packed 1-bit signatures as a *cheap*
|
|
18
|
+
* ranking proxy to shrink the candidate pool, then run *exact* cosine on the
|
|
19
|
+
* survivors. With a large enough rerank pool the final top-k is identical to a
|
|
20
|
+
* full exact scan — only the work is reduced.
|
|
21
|
+
*
|
|
22
|
+
* ## Memory
|
|
23
|
+
*
|
|
24
|
+
* A 384-dim Float32 vector costs 1536 bytes. Its sign signature costs 48 bytes
|
|
25
|
+
* (12 × uint32). That is a 32× index-memory reduction for the prefilter stage.
|
|
26
|
+
*
|
|
27
|
+
* Self-contained: no I/O, no side effects, pure functions + one ranking helper.
|
|
28
|
+
*
|
|
29
|
+
* @module shared/utils/rabitq
|
|
30
|
+
*/
|
|
31
|
+
import { cosineSimilarity } from './vector-math.js';
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Constants
|
|
34
|
+
// ============================================================================
|
|
35
|
+
/** Bits packed per Uint32 word. */
|
|
36
|
+
const BITS_PER_WORD = 32;
|
|
37
|
+
/** AQE canonical embedding dimension (patterns.rvf dim=384). */
|
|
38
|
+
export const SIGNATURE_DIM = 384;
|
|
39
|
+
/**
|
|
40
|
+
* Bytes per signature for the canonical 384-dim embedding:
|
|
41
|
+
* ceil(384 / 32) = 12 words × 4 bytes = 48 bytes.
|
|
42
|
+
* (vs 384 × 4 = 1536 bytes for the raw Float32 vector → 32× reduction.)
|
|
43
|
+
*/
|
|
44
|
+
export const SIGNATURE_BYTES = Math.ceil(SIGNATURE_DIM / BITS_PER_WORD) * 4; // 48
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// Popcount (Brian-Kernighan)
|
|
47
|
+
// ============================================================================
|
|
48
|
+
/**
|
|
49
|
+
* Population count (number of set bits) of a 32-bit word.
|
|
50
|
+
*
|
|
51
|
+
* Uses the SWAR (SIMD-within-a-register) bit-twiddle which is branchless and
|
|
52
|
+
* faster than a per-byte table lookup for 32-bit words. The hdc-fingerprint
|
|
53
|
+
* module uses a 256-entry per-byte table + Brian-Kernighan for its Uint8Array
|
|
54
|
+
* vectors; here we operate on Uint32 words, so the SWAR variant is the natural
|
|
55
|
+
* fit and avoids importing/splitting words into bytes.
|
|
56
|
+
*/
|
|
57
|
+
function popcount32(n) {
|
|
58
|
+
// Force unsigned 32-bit semantics.
|
|
59
|
+
n = n >>> 0;
|
|
60
|
+
n = n - ((n >>> 1) & 0x55555555);
|
|
61
|
+
n = (n & 0x33333333) + ((n >>> 2) & 0x33333333);
|
|
62
|
+
n = (n + (n >>> 4)) & 0x0f0f0f0f;
|
|
63
|
+
return (Math.imul(n, 0x01010101) >>> 24) & 0xff;
|
|
64
|
+
}
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// Signature construction
|
|
67
|
+
// ============================================================================
|
|
68
|
+
/**
|
|
69
|
+
* Build a 1-bit sign signature from a vector.
|
|
70
|
+
*
|
|
71
|
+
* `bit_i = (vec[i] >= 0)`. Bits are packed LSB-first into Uint32 words:
|
|
72
|
+
* coordinate `i` lives in word `i >> 5` at bit `i & 31`.
|
|
73
|
+
*
|
|
74
|
+
* For a 384-dim input this returns 12 words (48 bytes). Inputs of other
|
|
75
|
+
* dimensions are supported (signature length = ceil(dim / 32) words).
|
|
76
|
+
*
|
|
77
|
+
* @param vec Embedding vector (assumed unit-normalized for the LSH guarantee,
|
|
78
|
+
* but the function works on any real vector).
|
|
79
|
+
* @returns Packed sign bits as a Uint32Array.
|
|
80
|
+
*/
|
|
81
|
+
export function signSignature(vec) {
|
|
82
|
+
const dim = vec.length;
|
|
83
|
+
const words = Math.ceil(dim / BITS_PER_WORD);
|
|
84
|
+
const sig = new Uint32Array(words);
|
|
85
|
+
for (let i = 0; i < dim; i++) {
|
|
86
|
+
if (vec[i] >= 0) {
|
|
87
|
+
sig[i >> 5] |= 1 << (i & 31);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return sig;
|
|
91
|
+
}
|
|
92
|
+
// ============================================================================
|
|
93
|
+
// Hamming distance / similarity
|
|
94
|
+
// ============================================================================
|
|
95
|
+
/**
|
|
96
|
+
* Hamming distance between two packed signatures: popcount(a XOR b) summed
|
|
97
|
+
* over all words.
|
|
98
|
+
*
|
|
99
|
+
* @throws If the two signatures have different word lengths.
|
|
100
|
+
*/
|
|
101
|
+
export function hammingDistance(a, b) {
|
|
102
|
+
if (a.length !== b.length) {
|
|
103
|
+
throw new Error(`Signature length mismatch: ${a.length} vs ${b.length} words`);
|
|
104
|
+
}
|
|
105
|
+
let dist = 0;
|
|
106
|
+
for (let i = 0; i < a.length; i++) {
|
|
107
|
+
dist += popcount32((a[i] ^ b[i]) >>> 0);
|
|
108
|
+
}
|
|
109
|
+
return dist;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Hamming similarity in [0, 1]: `1 - hammingDistance / bits`.
|
|
113
|
+
*
|
|
114
|
+
* This is a monotonic proxy for cosine similarity (higher = closer). `bits`
|
|
115
|
+
* should be the true embedding dimension (e.g. 384), not `words × 32`, so that
|
|
116
|
+
* trailing padding bits — which are always 0 in both signatures and never
|
|
117
|
+
* contribute to the distance — don't deflate the normalization.
|
|
118
|
+
*/
|
|
119
|
+
export function hammingSimilarity(a, b, bits) {
|
|
120
|
+
if (bits <= 0)
|
|
121
|
+
return 0;
|
|
122
|
+
return 1 - hammingDistance(a, b) / bits;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Exact cosine top-k over all candidates. Shared by the small-N gate and the
|
|
126
|
+
* rerank stage.
|
|
127
|
+
*/
|
|
128
|
+
function exactTopK(query, candidates, k) {
|
|
129
|
+
const scored = new Array(candidates.length);
|
|
130
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
131
|
+
scored[i] = {
|
|
132
|
+
id: candidates[i].id,
|
|
133
|
+
score: cosineSimilarity(query, candidates[i].vector),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
scored.sort((a, b) => b.score - a.score);
|
|
137
|
+
return scored.slice(0, k);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Retrieve the top-k candidates for a query using a RaBitQ Hamming prefilter
|
|
141
|
+
* followed by an exact cosine rerank.
|
|
142
|
+
*
|
|
143
|
+
* Behavior:
|
|
144
|
+
* - `candidates.length < gateN` → plain exact cosine top-k (gate; RaBitQ
|
|
145
|
+
* overhead not worth it for small N).
|
|
146
|
+
* - otherwise → build/reuse sign signatures, rank ALL candidates by Hamming
|
|
147
|
+
* distance (cheap), take the top `rerankPool`, then:
|
|
148
|
+
* - `exactRerank=true` (default): run FULL cosine on just that pool and
|
|
149
|
+
* return the true top-k. Output equals an exact scan whenever the true
|
|
150
|
+
* top-k all fall within the Hamming top-`rerankPool` — recall is
|
|
151
|
+
* preserved by the rerank, only speed changes.
|
|
152
|
+
* - `exactRerank=false`: return the Hamming-only top-k (approximate).
|
|
153
|
+
*
|
|
154
|
+
* @param query Query vector (same dimension as candidate vectors).
|
|
155
|
+
* @param candidates Candidate set.
|
|
156
|
+
* @param k Number of results to return.
|
|
157
|
+
* @param opts Tuning knobs (see {@link TopKOptions}).
|
|
158
|
+
*/
|
|
159
|
+
export function topKBySignature(query, candidates, k, opts = {}) {
|
|
160
|
+
const gateN = opts.gateN ?? 100;
|
|
161
|
+
const exactRerank = opts.exactRerank ?? true;
|
|
162
|
+
const n = candidates.length;
|
|
163
|
+
if (n === 0 || k <= 0)
|
|
164
|
+
return [];
|
|
165
|
+
// Recall-aware default pool: a 1-bit signature in high dimensions is coarse,
|
|
166
|
+
// so the pool must scale with N to keep recall high (see rerankPool docs).
|
|
167
|
+
const rerankPool = opts.rerankPool ?? Math.max(4 * k, Math.ceil(0.4 * n));
|
|
168
|
+
// Small-N gate: exact cosine, skip signature machinery entirely.
|
|
169
|
+
if (n < gateN) {
|
|
170
|
+
return exactTopK(query, candidates, Math.min(k, n));
|
|
171
|
+
}
|
|
172
|
+
const bits = query.length;
|
|
173
|
+
const querySig = signSignature(query);
|
|
174
|
+
// Rank ALL candidates by Hamming distance (cheap popcount scan).
|
|
175
|
+
const hammingRanked = new Array(n);
|
|
176
|
+
for (let i = 0; i < n; i++) {
|
|
177
|
+
const cand = candidates[i];
|
|
178
|
+
const sig = cand.signature ?? signSignature(cand.vector);
|
|
179
|
+
hammingRanked[i] = { idx: i, dist: hammingDistance(querySig, sig) };
|
|
180
|
+
}
|
|
181
|
+
// Ascending distance = descending similarity.
|
|
182
|
+
hammingRanked.sort((a, b) => a.dist - b.dist);
|
|
183
|
+
const poolSize = Math.min(rerankPool, n);
|
|
184
|
+
if (!exactRerank) {
|
|
185
|
+
// Hamming-only ranking: return the top-k by Hamming proxy similarity.
|
|
186
|
+
const topK = Math.min(k, n);
|
|
187
|
+
const out = new Array(topK);
|
|
188
|
+
for (let i = 0; i < topK; i++) {
|
|
189
|
+
const { idx, dist } = hammingRanked[i];
|
|
190
|
+
out[i] = { id: candidates[idx].id, score: 1 - dist / bits };
|
|
191
|
+
}
|
|
192
|
+
return out;
|
|
193
|
+
}
|
|
194
|
+
// Exact rerank: full cosine over the Hamming-top pool, return true top-k.
|
|
195
|
+
const pool = new Array(poolSize);
|
|
196
|
+
for (let i = 0; i < poolSize; i++) {
|
|
197
|
+
pool[i] = candidates[hammingRanked[i].idx];
|
|
198
|
+
}
|
|
199
|
+
return exactTopK(query, pool, Math.min(k, poolSize));
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=rabitq.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-qe",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.2",
|
|
4
4
|
"description": "Agentic Quality Engineering V3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 60 specialized QE agents, mathematical Coherence verification, deep Claude Flow integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -68,7 +68,8 @@
|
|
|
68
68
|
"test:mcp:integration": "npm test -- --run tests/integration/mcp/",
|
|
69
69
|
"test:integration:fast": "NODE_OPTIONS='--max-old-space-size=2048 --expose-gc' vitest run tests/integration/mcp/fleet-init-wires-daemon.test.ts tests/integration/workers/workers-reach-domains.test.ts tests/integration/learning/coordinator-roundtrip.test.ts tests/integration/bridge/bridge-end-to-end.test.ts",
|
|
70
70
|
"test:integration": "NODE_OPTIONS='--max-old-space-size=4096 --expose-gc' vitest run tests/integration/ --exclude='**/browser/**' --exclude='**/browser-integration/**' --exclude='**/*.e2e.test.ts'",
|
|
71
|
-
"mcp:validate": "
|
|
71
|
+
"mcp:validate": "node scripts/smoke-mcp-protocol.mjs",
|
|
72
|
+
"mcp:parity": "node scripts/audit-mcp-tool-parity.mjs",
|
|
72
73
|
"mcp:report": "echo 'MCP Report: uses vitest for test reporting' && exit 0",
|
|
73
74
|
"test:code-intelligence": "npm test -- --run tests/unit/domains/code-intelligence/ tests/unit/coordination/mincut/",
|
|
74
75
|
"verify:counts": "node -e \"const fs=require('fs'),g=require('glob'),p=require('path');const src=g.globSync('src/**/*.ts',{ignore:'src/**/*.test.ts'});const tests=g.globSync('tests/**/*.test.ts');const agents=g.globSync('.claude/agents/v3/qe-*.md');const skills=g.globSync('.claude/skills/**/*.md');const ok=src.length>500&&tests.length>300;const r={status:ok?'pass':'fail',srcFiles:src.length,testFiles:tests.length,agents:agents.length,skills:skills.length};fs.mkdirSync('reports',{recursive:true});fs.writeFileSync(p.join('reports','verification-counts.json'),JSON.stringify(r,null,2));console.log('Counts:',JSON.stringify(r));if(!ok)process.exit(1)\"",
|
|
@@ -85,6 +86,10 @@
|
|
|
85
86
|
"performance:gate": "npx tsx src/performance/run-gates.ts",
|
|
86
87
|
"test:integration:browser": "VIBIUM_REAL_TESTS=true vitest run tests/integrations/vibium/vibium-real.test.ts",
|
|
87
88
|
"benchmark:token-reduction": "vitest bench tests/benchmarks/code-intelligence-token-reduction.bench.ts",
|
|
89
|
+
"benchmark:self-learning": "tsx scripts/benchmark-self-learning.ts",
|
|
90
|
+
"benchmark:rabitq": "tsx scripts/benchmark-rabitq.ts",
|
|
91
|
+
"plugin:smoke": "bash plugins/agentic-qe-fleet/scripts/smoke.sh",
|
|
92
|
+
"pretrain:history": "tsx scripts/pretrain-from-history.ts",
|
|
88
93
|
"dev": "node dist/cli/bundle.js",
|
|
89
94
|
"start": "node dist/cli/bundle.js",
|
|
90
95
|
"typecheck": "tsc --noEmit",
|
|
@@ -256,6 +261,7 @@
|
|
|
256
261
|
".claude/skills",
|
|
257
262
|
".claude/commands",
|
|
258
263
|
".claude/helpers",
|
|
264
|
+
".claude/hooks",
|
|
259
265
|
".opencode/agents",
|
|
260
266
|
".opencode/skills",
|
|
261
267
|
".opencode/tools",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.0");process.exit(0)}
|
|
2
|
-
import{a,b,c}from"./chunk-T7DLX3LS.js";import"./chunk-OGT45MZN.js";import"./chunk-TR7BZLB6.js";import"./chunk-OKGK7DBT.js";import"./chunk-KNL3QWVA.js";import"./chunk-55JPAF56.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.0");process.exit(0)}
|
|
2
|
-
import{a,b,c,d,e,f}from"./chunk-OWMGD7FO.js";import"./chunk-5QJDH4Z5.js";import"./chunk-6H5MRVJS.js";import"./chunk-2GL4GH52.js";import"./chunk-C5QESAYA.js";import"./chunk-YHNEBCYQ.js";import"./chunk-WLLE54TA.js";import"./chunk-3OSCWD7Z.js";import"./chunk-F363JJUI.js";import"./chunk-VEOQH4W6.js";import"./chunk-LYVFC7C7.js";import"./chunk-U56TIYGP.js";import"./chunk-KCHFF4IE.js";import"./chunk-3BO7EKGO.js";import"./chunk-UE3XXKLN.js";import"./chunk-TEJPHJMW.js";import"./chunk-OKGK7DBT.js";import"./chunk-DXV6NRG3.js";import"./chunk-X73CRYF4.js";import"./chunk-BQT4J3BD.js";import"./chunk-FEBXP74Y.js";import"./chunk-KNL3QWVA.js";import"./chunk-MJBXQXSX.js";import"./chunk-ZCNVFULO.js";import"./chunk-QU54GUEA.js";import"./chunk-O3NAUNFC.js";import"./chunk-I4E6CLC4.js";import"./chunk-NT4PI5HI.js";import"./chunk-66GIKUI2.js";import"./chunk-SGONA5GS.js";import"./chunk-5UOV7T36.js";import"./chunk-KOSKGZK4.js";import"./chunk-55JPAF56.js";export{b as AQELearningEngine,a as DEFAULT_ENGINE_CONFIG,c as DEFAULT_META_LEARNING_CONFIG,d as MetaLearningEngine,e as createAQELearningEngine,f as createDefaultLearningEngine};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.0");process.exit(0)}
|
|
2
|
-
import{a,b,c,d,e,f}from"./chunk-6MONUYQ5.js";import"./chunk-LQ3TA22E.js";import"./chunk-UE3XXKLN.js";import"./chunk-TEJPHJMW.js";import"./chunk-OKGK7DBT.js";import"./chunk-X73CRYF4.js";import"./chunk-BQT4J3BD.js";import"./chunk-KNL3QWVA.js";import"./chunk-MJBXQXSX.js";import"./chunk-ZCNVFULO.js";import"./chunk-QU54GUEA.js";import"./chunk-O3NAUNFC.js";import"./chunk-I4E6CLC4.js";import"./chunk-NT4PI5HI.js";import"./chunk-66GIKUI2.js";import"./chunk-SGONA5GS.js";import"./chunk-5UOV7T36.js";import"./chunk-KOSKGZK4.js";import"./chunk-55JPAF56.js";export{f as MCPToolBase,e as defaultToolLogger,d as getMemoryBackend,b as getSharedMemoryBackend,a as registerRvfResetFn,c as resetSharedMemoryBackend};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.0");process.exit(0)}
|
|
2
|
-
import{a}from"./chunk-6F3WJOU2.js";import"./chunk-6MONUYQ5.js";import"./chunk-LQ3TA22E.js";import"./chunk-UE3XXKLN.js";import"./chunk-TEJPHJMW.js";import"./chunk-OKGK7DBT.js";import"./chunk-X73CRYF4.js";import"./chunk-BQT4J3BD.js";import"./chunk-KNL3QWVA.js";import"./chunk-MJBXQXSX.js";import"./chunk-ZCNVFULO.js";import"./chunk-QU54GUEA.js";import"./chunk-O3NAUNFC.js";import"./chunk-I4E6CLC4.js";import"./chunk-NT4PI5HI.js";import"./chunk-66GIKUI2.js";import"./chunk-SGONA5GS.js";import"./chunk-5UOV7T36.js";import"./chunk-KOSKGZK4.js";import"./chunk-55JPAF56.js";export{a as BrowserWorkflowTool};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.0");process.exit(0)}
|
|
2
|
-
import{a as M}from"./chunk-LQ3TA22E.js";import{f as y,o as T}from"./chunk-UE3XXKLN.js";import{a as p,c as S}from"./chunk-KNL3QWVA.js";import{i as b}from"./chunk-MJBXQXSX.js";T();S();import*as c from"path";import*as d from"fs";var m=null,u=null,l=null;function R(o){l=o}async function P(){return m||u||(u=(async()=>{let o=y(),e=c.join(o,".agentic-qe");d.existsSync(e)||d.mkdirSync(e,{recursive:!0});let r=new M({sqlite:{path:c.join(e,"memory.db"),walMode:!0,poolSize:3,busyTimeout:5e3},enableFallback:!0,defaultNamespace:"mcp-tools"});return await r.initialize(),m=r,r})(),u)}function $(){if(l)try{l()}catch{}m&&(m.dispose().catch(()=>{}),m=null),u=null}async function D(o){return o?.memory?o.memory:P()}var C={info:(o,e)=>console.log(`[MCP-TOOL] ${o}`,e||""),warn:(o,e)=>console.warn(`[MCP-TOOL] \u26A0\uFE0F ${o}`,e||""),error:(o,e)=>console.error(`[MCP-TOOL] \u274C ${o}`,e||"")},h=class{logger=C;currentDataSource="real";setLogger(e){this.logger=e}markAsDemoData(e,r){this.currentDataSource=e.demoMode?"demo":"fallback",this.logger.warn(`${this.config.name} returning ${this.currentDataSource} data`,{reason:r,requestId:e.requestId,demoMode:e.demoMode})}markAsRealData(){this.currentDataSource="real"}isDemoMode(e){return e.demoMode===!0}validate(e){let r=[];if(typeof e!="object"||e===null)return{valid:!1,errors:["Parameters must be an object"]};let t=e,{properties:a,required:n}=this.config.schema;if(n)for(let i of n)i in t||r.push(`Missing required field: ${i}`);for(let[i,s]of Object.entries(t)){let g=a[i];if(!g)continue;let f=this.validateType(i,s,g);f&&r.push(f)}return{valid:r.length===0,errors:r}}validateType(e,r,t){if(r==null)return null;let a=Array.isArray(r)?"array":typeof r;if(t.type==="array"&&!Array.isArray(r))return`${e} must be an array`;if(t.type!=="array"&&a!==t.type)return`${e} must be of type ${t.type}, got ${a}`;if(t.enum&&!t.enum.includes(r))return`${e} must be one of: ${t.enum.join(", ")}`;if(t.type==="number"){let n=r;if(t.minimum!==void 0&&n<t.minimum)return`${e} must be >= ${t.minimum}`;if(t.maximum!==void 0&&n>t.maximum)return`${e} must be <= ${t.maximum}`}if(t.type==="string"){let n=r;if(t.minLength!==void 0&&n.length<t.minLength)return`${e} must be at least ${t.minLength} characters`;if(t.maxLength!==void 0&&n.length>t.maxLength)return`${e} must be at most ${t.maxLength} characters`}return null}async invoke(e,r={}){let t=Date.now(),a=b();this.currentDataSource="real";let n=this.validate(e);if(!n.valid)return{success:!1,error:`Validation failed: ${n.errors.join("; ")}`,metadata:this.createMetadata(t,a)};let i={requestId:a,startTime:t,streaming:r.streaming,onStream:r.onStream,abortSignal:r.abortSignal,demoMode:r.demoMode};try{let s=await this.execute(e,i);return{...s,metadata:{...s.metadata,...this.createMetadata(t,a)}}}catch(s){return{success:!1,error:p(s),metadata:this.createMetadata(t,a)}}}createMetadata(e,r){return{executionTime:Date.now()-e,timestamp:new Date().toISOString(),requestId:r,domain:this.config.domain,toolName:this.config.name,dataSource:this.currentDataSource}}emitStream(e,r){e.streaming&&e.onStream&&e.onStream(r)}isAborted(e){return e.abortSignal?.aborted??!1}get name(){return this.config.name}get description(){return this.config.description}get domain(){return this.config.domain}getSchema(){return this.config.schema}get timeout(){return this.config.timeout??6e4}get supportsStreaming(){return this.config.streaming??!1}resetInstanceCache(){}};export{R as a,P as b,$ as c,D as d,C as e,h as f};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.0");process.exit(0)}
|
|
2
|
-
import{p as D,q as z}from"./chunk-J5RJYFRM.js";import{k as A,o as R}from"./chunk-UE3XXKLN.js";import{i as g}from"./chunk-MJBXQXSX.js";import{b as w,c as T}from"./chunk-SGONA5GS.js";import{g as S}from"./chunk-55JPAF56.js";R();var b=null;function I(){if(b)return b;let m=(z(),S(D));if(!m.HierarchicalNSW)throw new Error("hnswlib-node module missing HierarchicalNSW export");return b=m.HierarchicalNSW,b}function M(){return!0}var E=class{indexes;config;initialized;nextId;unifiedAdapters=null;useUnified;constructor(e={}){this.config={M:e.M||16,efConstruction:e.efConstruction||200,efSearch:e.efSearch||50,dimension:e.dimension||384,metric:e.metric||"cosine",quantization:e.quantization||"none"},this.indexes=new Map,this.initialized=new Set,this.nextId=new Map,this.useUnified=M(),this.useUnified&&(this.unifiedAdapters=new Map)}initializeIndex(e){if(this.initialized.has(e))return;if(this.useUnified&&this.unifiedAdapters)try{let{HnswAdapter:s}=(T(),S(w)),o=new s(`embedding-${e}`,{dimensions:this.config.dimension,M:this.config.M,efConstruction:this.config.efConstruction,efSearch:this.config.efSearch,metric:this.config.metric==="dotproduct"?"cosine":this.config.metric});this.unifiedAdapters.set(e,o),this.initialized.add(e),this.nextId.set(e,0);return}catch{}let t={cosine:"cosine",euclidean:"l2",dotproduct:"ip"}[this.config.metric]||"cosine",n=I(),r=new n(t,this.config.dimension);r.initIndex({maxElements:1e4,m:this.config.M,efConstruction:this.config.efConstruction}),this.indexes.set(e,r),this.initialized.add(e),this.nextId.set(e,0)}addEmbedding(e,i){let t=e.namespace;this.initialized.has(t)||this.initializeIndex(t);let n=i??this.nextId.get(t);i===void 0&&this.nextId.set(t,n+1);let r=this.unifiedAdapters?.get(t);if(r){let d=e.vector instanceof Float32Array?e.vector:new Float32Array(this.toFloatArray(e.vector));return r.add(n,d),n}let s=this.indexes.get(t),o=this.toFloatArray(e.vector);return s.addPoint(o,n),n}addEmbeddingsBatch(e){return e.map(i=>this.addEmbedding(i.embedding,i.id))}search(e,i={}){let t=i.namespace||e.namespace;if(!this.initialized.has(t))return[];let n=i.limit||10,r=this.unifiedAdapters?.get(t);if(r){let l=e.vector instanceof Float32Array?e.vector:new Float32Array(this.toFloatArray(e.vector));return r.search(l,n).map(a=>({id:a.id,distance:1-a.score}))}let s=this.indexes.get(t),o=this.toFloatArray(e.vector),d=s.searchKnn(o,n);return d.neighbors.map((l,h)=>({id:l,distance:d.distances[h]}))}getIndexStats(e){if(!this.initialized.has(e))return null;let i=this.unifiedAdapters?.get(e);return i?{size:i.size(),maxElements:1e4,dimension:i.dimensions(),metric:this.config.metric}:{size:this.indexes.get(e).getCurrentCount(),maxElements:1e4,dimension:this.config.dimension,metric:this.config.metric}}async saveIndex(e,i){if(!this.initialized.has(e))throw new Error(`Namespace ${e} not initialized`);if(this.unifiedAdapters?.has(e)){console.warn(`[HNSWEmbeddingIndex] saveIndex() is a no-op for namespace '${e}' \u2014 unified HnswAdapter manages persistence internally.`);return}await this.indexes.get(e).writeIndex(i)}async loadIndex(e,i){if(this.useUnified){console.warn(`[HNSWEmbeddingIndex] loadIndex() is a no-op for namespace '${e}' \u2014 unified HnswAdapter manages persistence internally. Initialize via initializeIndex() instead.`);return}let n={cosine:"cosine",euclidean:"l2",dotproduct:"ip"}[this.config.metric]||"cosine",r=I(),s=new r(n,this.config.dimension);await s.readIndex(i),this.indexes.set(e,s),this.initialized.add(e)}clearIndex(e){if(this.initialized.has(e)){let i=this.unifiedAdapters?.get(e);i&&(i.clear?.(),this.unifiedAdapters.delete(e)),this.indexes.delete(e),this.initialized.delete(e),this.nextId.delete(e)}}clearAll(){if(this.unifiedAdapters){for(let e of this.unifiedAdapters.values())e.clear?.();this.unifiedAdapters.clear()}this.indexes.clear(),this.initialized.clear(),this.nextId.clear()}resizeIndex(e,i){this.initialized.has(e)&&(this.clearIndex(e),this.initializeIndex(e))}setEfSearch(e){this.config.efSearch=e}toFloatArray(e){if(Array.isArray(e))return e;if(e instanceof Float32Array)return Array.from(e);if(e instanceof Int8Array){let i=new Array(e.length);for(let t=0;t<e.length;t++)i[t]=e[t]/128;return i}if(e instanceof Uint8Array){let i=new Array(e.length);for(let t=0;t<e.length;t++)i[t]=(e[t]-128)/128;return i}throw new Error(`Unsupported vector type: ${typeof e}`)}getConfig(){return{...this.config}}isInitialized(e){return this.initialized.has(e)}getInitializedNamespaces(){return Array.from(this.initialized)}getSize(e){if(!this.initialized.has(e))return 0;let i=this.unifiedAdapters?.get(e);return i?i.size():this.nextId.get(e)||0}};var H={mergeSimilarityThreshold:.85,maxMergesPerRun:50,softThreshold:400,hardThreshold:2e3,archiveMinAgeDays:30,archiveQualityThreshold:.15,mergeQualityBoost:.02},N=class{config;db=null;initialized=!1;constructor(e={}){this.config={...H,...e}}async initialize(e){if(!this.initialized){if(e)this.db=e;else{let i=A();await i.initialize(),this.db=i.getDatabase()}this.initialized=!0}}async consolidateAll(e){this.ensureInitialized();let i={merged:0,qualityUpdated:0,archived:0,hardDeleted:0,activeRemaining:0,domainsProcessed:[]},t=this.db.prepare("SELECT domain, COUNT(*) as cnt FROM captured_experiences WHERE consolidated_into IS NULL GROUP BY domain").all(),n=e?t.filter(s=>e.includes(s.domain)):t.filter(s=>s.cnt>this.config.softThreshold);for(let{domain:s,cnt:o}of n){let d=await this.consolidateDomain(s,o);i.merged+=d.merged,i.qualityUpdated+=d.qualityUpdated,i.archived+=d.archived,i.hardDeleted+=d.hardDeleted,i.domainsProcessed.push(s)}let r=this.db.prepare("SELECT COUNT(*) as cnt FROM captured_experiences WHERE consolidated_into IS NULL").get();return i.activeRemaining=r.cnt,(i.merged>0||i.archived>0)&&console.log(`[ExperienceConsolidator] Consolidated: ${i.merged} merged, ${i.archived} archived, ${i.activeRemaining} active`),i}async consolidateDomain(e,i){this.ensureInitialized();let t={merged:0,qualityUpdated:0,archived:0,hardDeleted:0,activeRemaining:0,domainsProcessed:[e]};t.merged=await this.clusterAndMerge(e),t.qualityUpdated=this.reinforceQuality(e),t.archived=this.archiveValueless(e);let n=this.db.prepare("SELECT COUNT(*) as cnt FROM captured_experiences WHERE domain = ? AND consolidated_into IS NULL").get(e).cnt,r=0;return n>this.config.hardThreshold&&(r=this.hardDeleteExcess(e,n),t.archived+=r),t.activeRemaining=n-r,t}async bootstrapDomain(e){if(this.ensureInitialized(),this.db.prepare("SELECT value FROM kv_store WHERE key = ?").get(`consolidation_bootstrap_${e}`))return console.log(`[ExperienceConsolidator] Domain ${e} already bootstrapped`),{merged:0,qualityUpdated:0,archived:0,hardDeleted:0,activeRemaining:0,domainsProcessed:[e]};let t={...this.config};this.config.mergeSimilarityThreshold=.8,this.config.maxMergesPerRun=200;let n=await this.consolidateDomain(e);Object.assign(this.config,t);try{this.db.prepare("INSERT OR REPLACE INTO kv_store (key, value, namespace) VALUES (?, ?, 'system')").run(`consolidation_bootstrap_${e}`,new Date().toISOString())}catch{}return console.log(`[ExperienceConsolidator] Bootstrap ${e}: ${n.merged} merged, ${n.archived} archived`),n}async clusterAndMerge(e){let i=this.db.prepare(`
|
|
3
|
-
SELECT id, task, domain, quality, success, application_count,
|
|
4
|
-
consolidation_count, reuse_success_count, reuse_failure_count,
|
|
5
|
-
embedding, embedding_dimension, started_at
|
|
6
|
-
FROM captured_experiences
|
|
7
|
-
WHERE domain = ? AND consolidated_into IS NULL AND embedding IS NOT NULL
|
|
8
|
-
ORDER BY quality DESC
|
|
9
|
-
`).all(e);if(i.length<2)return 0;let t=new E({dimension:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}),n=new Map,r=0;for(let a of i)if(a.embedding&&a.embedding_dimension){let x=this.bufferToFloatArray(a.embedding,a.embedding_dimension),p=r++;n.set(p,a.id);let y={vector:x,dimension:384,namespace:"experiences",text:a.id,timestamp:Date.now(),quantization:"none",metadata:{}};t.addEmbedding(y,p)}let s=new Set,o=0,d=this.db.prepare("UPDATE captured_experiences SET consolidated_into = ? WHERE id = ?"),l=this.db.prepare(`
|
|
10
|
-
UPDATE captured_experiences
|
|
11
|
-
SET consolidation_count = consolidation_count + ?,
|
|
12
|
-
quality = MIN(1.0, quality + ?),
|
|
13
|
-
quality_updated_at = datetime('now')
|
|
14
|
-
WHERE id = ?
|
|
15
|
-
`),h=this.db.prepare(`
|
|
16
|
-
INSERT INTO experience_consolidation_log (id, domain, action, source_ids, target_id, details, created_at)
|
|
17
|
-
VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
|
|
18
|
-
`);for(let a of i){if(o>=this.config.maxMergesPerRun)break;if(s.has(a.id)||!a.embedding||!a.embedding_dimension)continue;let p={vector:this.bufferToFloatArray(a.embedding,a.embedding_dimension),dimension:384,namespace:"experiences",text:a.id,timestamp:Date.now(),quantization:"none",metadata:{}},y=t.search(p,{limit:6,namespace:"experiences"}),u=[];for(let{id:v,distance:f}of y){if(o>=this.config.maxMergesPerRun)break;let c=n.get(v);if(!c||c===a.id||s.has(c)||1-f<this.config.mergeSimilarityThreshold)continue;let _=i.find(C=>C.id===c);_&&_.quality<=a.quality&&_.application_count===0&&(s.add(c),u.push(c),o++)}u.length>0&&this.db.transaction(()=>{for(let c of u)d.run(a.id,c);let f=this.config.mergeQualityBoost*u.length;l.run(u.length,f,a.id),h.run(g(),e,"merge",JSON.stringify(u),a.id,JSON.stringify({count:u.length,boost:f}))})()}return t.clearIndex("experiences"),o}reinforceQuality(e){let i=this.db.prepare(`
|
|
19
|
-
SELECT ce.id, ce.quality, ce.consolidation_count,
|
|
20
|
-
ce.reuse_success_count, ce.reuse_failure_count,
|
|
21
|
-
COALESCE(app.total, 0) as app_total,
|
|
22
|
-
COALESCE(app.successes, 0) as app_successes
|
|
23
|
-
FROM captured_experiences ce
|
|
24
|
-
LEFT JOIN (
|
|
25
|
-
SELECT experience_id,
|
|
26
|
-
COUNT(*) as total,
|
|
27
|
-
SUM(CASE WHEN success = 1 THEN 1 ELSE 0 END) as successes
|
|
28
|
-
FROM experience_applications
|
|
29
|
-
GROUP BY experience_id
|
|
30
|
-
) app ON app.experience_id = ce.id
|
|
31
|
-
WHERE ce.domain = ? AND ce.consolidated_into IS NULL
|
|
32
|
-
AND (app.total > 0 OR ce.reuse_success_count > 0 OR ce.reuse_failure_count > 0)
|
|
33
|
-
`).all(e);if(i.length===0)return 0;let t=this.db.prepare(`
|
|
34
|
-
UPDATE captured_experiences
|
|
35
|
-
SET quality = ?, quality_updated_at = datetime('now')
|
|
36
|
-
WHERE id = ?
|
|
37
|
-
`),n=0;return this.db.transaction(()=>{for(let s of i){let o=s.app_total+s.reuse_success_count+s.reuse_failure_count,d=s.app_successes+s.reuse_success_count,l=o>0?d/o:0,h=Math.min(s.consolidation_count,10)/10,a=Math.min(1,.4*s.quality+.4*l+.2*h);Math.abs(a-s.quality)>.01&&(t.run(a,s.id),n++)}})(),n}archiveValueless(e){let i=new Date;i.setDate(i.getDate()-this.config.archiveMinAgeDays);let t=i.toISOString().replace("T"," ").slice(0,19),n=this.db.prepare(`
|
|
38
|
-
UPDATE captured_experiences
|
|
39
|
-
SET consolidated_into = 'archived'
|
|
40
|
-
WHERE domain = ?
|
|
41
|
-
AND consolidated_into IS NULL
|
|
42
|
-
AND quality < ?
|
|
43
|
-
AND application_count = 0
|
|
44
|
-
AND success = 0
|
|
45
|
-
AND consolidation_count = 1
|
|
46
|
-
AND started_at < ?
|
|
47
|
-
`).run(e,this.config.archiveQualityThreshold,t);if(n.changes>0)try{this.db.prepare(`
|
|
48
|
-
INSERT INTO experience_consolidation_log (id, domain, action, source_ids, details, created_at)
|
|
49
|
-
VALUES (?, ?, 'archive', '[]', ?, datetime('now'))
|
|
50
|
-
`).run(g(),e,JSON.stringify({count:n.changes}))}catch{}return n.changes}hardDeleteExcess(e,i){let t=i-this.config.hardThreshold;if(t<=0)return 0;let r=this.db.prepare(`
|
|
51
|
-
UPDATE captured_experiences
|
|
52
|
-
SET consolidated_into = 'archived'
|
|
53
|
-
WHERE id IN (
|
|
54
|
-
SELECT id FROM captured_experiences
|
|
55
|
-
WHERE domain = ? AND consolidated_into IS NULL AND application_count = 0
|
|
56
|
-
ORDER BY quality ASC, started_at ASC
|
|
57
|
-
LIMIT ?
|
|
58
|
-
)
|
|
59
|
-
`).run(e,t).changes;if(r>0){try{this.db.prepare(`
|
|
60
|
-
INSERT INTO experience_consolidation_log (id, domain, action, source_ids, details, created_at)
|
|
61
|
-
VALUES (?, ?, 'safety-valve-archive', '[]', ?, datetime('now'))
|
|
62
|
-
`).run(g(),e,JSON.stringify({count:r,currentCount:i,hardThreshold:this.config.hardThreshold,note:"soft-archive replacement for legacy hard-delete safety valve"}))}catch{}console.warn(`[ExperienceConsolidator] Safety valve: soft-archived ${r} from ${e} (was ${i}, threshold ${this.config.hardThreshold})`)}return r}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("ExperienceConsolidator not initialized. Call initialize() first.")}bufferToFloatArray(e,i){let t=[];for(let n=0;n<i;n++)t.push(e.readFloatLE(n*4));return t}};export{E as a,N as b};
|