agentic-qe 3.10.7 → 3.10.8
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 +48 -0
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-PAMPC2X7.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-6I3JMU2M.js → agent-booster-wasm-4JSL6LF6.js} +2 -2
- package/dist/cli/chunks/{agent-handler-XWI7YM6R.js → agent-handler-6YOFH7KL.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-QFZKQN2L.js → agent-memory-branch-O3IBK4BY.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-DGKLEC6I.js +2 -0
- package/dist/cli/chunks/{arena-P4IUBKZP.js → arena-BLCAZNAY.js} +2 -2
- package/dist/cli/chunks/{arena-5HNPVTBZ.js → arena-KLGRZTTU.js} +4 -4
- package/dist/cli/chunks/{audit-PBSH25VZ.js → audit-FKKLR22S.js} +2 -2
- package/dist/cli/chunks/base-6HJR4VJT.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-ILDTCGLZ.js → better-sqlite3-MROES2Y7.js} +2 -2
- package/dist/cli/chunks/{brain-handler-EVYRCKXI.js → brain-handler-YTGYC2QW.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-SUDGYJQJ.js → branch-enumerator-KIIBEJ5S.js} +2 -2
- package/dist/cli/chunks/{browser-4UKMW2RE.js → browser-7YZLTV2C.js} +2 -2
- package/dist/cli/chunks/browser-workflow-OWNU5XK7.js +2 -0
- package/dist/cli/chunks/chunk-2B2RLPK3.js +2 -0
- package/dist/cli/chunks/{chunk-AKL5A3IZ.js → chunk-2F4VRCT6.js} +1 -1
- package/dist/cli/chunks/{chunk-NKYMHEHY.js → chunk-2KP5TJS2.js} +2 -2
- package/dist/cli/chunks/{chunk-4MJQJQLY.js → chunk-2RDWYJJY.js} +2 -2
- package/dist/cli/chunks/{chunk-2J4ZUUU5.js → chunk-2UL4UK6V.js} +2 -2
- package/dist/cli/chunks/{chunk-QMGNYRR5.js → chunk-33CLP2NE.js} +3 -3
- package/dist/cli/chunks/{chunk-INI3AGF5.js → chunk-34LWJDCM.js} +2 -2
- package/dist/cli/chunks/{chunk-FK4JHBG4.js → chunk-3AG2MM7U.js} +2 -2
- package/dist/cli/chunks/{chunk-UVUVWA4B.js → chunk-474ZUVGP.js} +1 -1
- package/dist/cli/chunks/{chunk-LEZ2MGHM.js → chunk-4AG2TQEF.js} +3 -3
- package/dist/cli/chunks/{chunk-LFSQSLNP.js → chunk-4B676LUC.js} +2 -2
- package/dist/cli/chunks/{chunk-OPLLH67G.js → chunk-4G2GTX2V.js} +1 -1
- package/dist/cli/chunks/{chunk-K6IU2MV4.js → chunk-4IGSL7CX.js} +1 -1
- package/dist/cli/chunks/{chunk-Z44VJC5U.js → chunk-4OHLPG6B.js} +2 -2
- package/dist/cli/chunks/{chunk-DPT37UHR.js → chunk-54PBHRRW.js} +4 -4
- package/dist/cli/chunks/{chunk-AY4IEMRI.js → chunk-5GPOSKGP.js} +2 -2
- package/dist/cli/chunks/{chunk-BU2I77YW.js → chunk-5KUINS3D.js} +3 -3
- package/dist/cli/chunks/{chunk-BPC6X6VR.js → chunk-6B32USSC.js} +2 -2
- package/dist/cli/chunks/{chunk-SG6O3PXZ.js → chunk-6B3COND2.js} +2 -2
- package/dist/cli/chunks/{chunk-262F3EMN.js → chunk-6R6RC6YJ.js} +2 -2
- package/dist/cli/chunks/{chunk-LJHCPN4E.js → chunk-77BVW2CT.js} +2 -2
- package/dist/cli/chunks/{chunk-LSHUPEQQ.js → chunk-7LHN6WBX.js} +2 -2
- package/dist/cli/chunks/{chunk-L2ZSYIDA.js → chunk-7NKVEEXD.js} +1 -1
- package/dist/cli/chunks/{chunk-3IJS52OS.js → chunk-AGQIJWAD.js} +2 -2
- package/dist/cli/chunks/{chunk-V7WBNB2S.js → chunk-ALFF4AAM.js} +2 -2
- package/dist/cli/chunks/{chunk-HARYQMWN.js → chunk-B3B5QZYN.js} +2 -2
- package/dist/cli/chunks/{chunk-MMR23KAO.js → chunk-BALWMVCX.js} +2 -2
- package/dist/cli/chunks/{chunk-C5CY5NSW.js → chunk-BMSMDD72.js} +2 -2
- package/dist/cli/chunks/{chunk-J5ETX2DG.js → chunk-C6TUX7YJ.js} +2 -2
- package/dist/cli/chunks/{chunk-M7SO5KNJ.js → chunk-CCUUTTTJ.js} +2 -2
- package/dist/cli/chunks/{chunk-HELQ7CXL.js → chunk-CDNXXNQM.js} +1 -1
- package/dist/cli/chunks/{chunk-CJTDQJ7E.js → chunk-CHPL7TA4.js} +1 -1
- package/dist/cli/chunks/{chunk-OMDV6GFP.js → chunk-CO6UY7ZU.js} +1 -1
- package/dist/cli/chunks/{chunk-I7M574IO.js → chunk-CP4CSI5R.js} +2 -2
- package/dist/cli/chunks/{chunk-AW3LGLC3.js → chunk-D7IH2A3C.js} +2 -2
- package/dist/cli/chunks/{chunk-2MLISLRR.js → chunk-D7ZVIL3C.js} +1 -1
- package/dist/cli/chunks/{chunk-QBVFONWU.js → chunk-DDMKCHYT.js} +2 -2
- package/dist/cli/chunks/{chunk-B5ZJV7GZ.js → chunk-DI7REPYC.js} +2 -2
- package/dist/cli/chunks/{chunk-MK73CCKO.js → chunk-DNC27OP7.js} +2 -2
- package/dist/cli/chunks/{chunk-K6A3AWUI.js → chunk-DNEYBK7X.js} +1 -1
- package/dist/cli/chunks/{chunk-DYSRMAZP.js → chunk-DPSLJ6IW.js} +1 -1
- package/dist/cli/chunks/{chunk-S7FNTWFM.js → chunk-E5GUTKET.js} +2 -2
- package/dist/cli/chunks/{chunk-HDLF6LGO.js → chunk-FPEFIJQ6.js} +3 -3
- package/dist/cli/chunks/{chunk-YB4GXJJG.js → chunk-FWQZZ22V.js} +1 -1
- package/dist/cli/chunks/{chunk-EWNJK2BU.js → chunk-FXPAGKVS.js} +1 -1
- package/dist/cli/chunks/{chunk-PY3HWJRJ.js → chunk-G2J7WGOG.js} +2 -2
- package/dist/cli/chunks/{chunk-222ZQTL5.js → chunk-G73PIM7X.js} +2 -2
- package/dist/cli/chunks/{chunk-CW7JQVXV.js → chunk-GDHJZPNC.js} +2 -2
- package/dist/cli/chunks/{chunk-S423UHYM.js → chunk-GHIHW3IE.js} +2 -2
- package/dist/cli/chunks/{chunk-MRLGQX7Y.js → chunk-GXKCRIHK.js} +2 -2
- package/dist/cli/chunks/{chunk-SLASYVNX.js → chunk-H35FNLQJ.js} +2 -2
- package/dist/cli/chunks/{chunk-SFW6IDMR.js → chunk-H73AA2JI.js} +10 -10
- package/dist/cli/chunks/{chunk-76JYG426.js → chunk-HE3KLHNO.js} +2 -2
- package/dist/cli/chunks/{chunk-JJELOEIY.js → chunk-HEC2UWY3.js} +4 -4
- package/dist/cli/chunks/{chunk-4I6FK67T.js → chunk-HVE3EH36.js} +3 -3
- package/dist/cli/chunks/{chunk-6F5KPT6U.js → chunk-HVFHPDXV.js} +1 -1
- package/dist/cli/chunks/{chunk-MOI74MMX.js → chunk-HWJEHXPQ.js} +2 -2
- package/dist/cli/chunks/{chunk-BRYYQQUV.js → chunk-IFQPGBKQ.js} +1 -1
- package/dist/cli/chunks/{chunk-FWLXK6AH.js → chunk-JFTRHS5V.js} +2 -2
- package/dist/cli/chunks/{chunk-UPDPD43T.js → chunk-JITZAJJN.js} +2 -2
- package/dist/cli/chunks/{chunk-6RG7ZJ2H.js → chunk-JQBD4JO2.js} +2 -2
- package/dist/cli/chunks/{chunk-LUZH2IZY.js → chunk-JZYXYHEE.js} +2 -2
- package/dist/cli/chunks/{chunk-MWRKNBSY.js → chunk-K5Y64X2U.js} +2 -2
- package/dist/cli/chunks/{chunk-RLXCFURS.js → chunk-KTBBSOZG.js} +2 -2
- package/dist/cli/chunks/{chunk-MDVJVY4C.js → chunk-KTEWRRDZ.js} +4 -4
- package/dist/cli/chunks/{chunk-L5UUUSSB.js → chunk-KWKGROPS.js} +1 -1
- package/dist/cli/chunks/{chunk-X6OJFP7G.js → chunk-LBR5FXPD.js} +2 -2
- package/dist/cli/chunks/{chunk-X3HRJV65.js → chunk-LCDMB5SP.js} +1 -1
- package/dist/cli/chunks/{chunk-TIUC5LRA.js → chunk-LIOK7WBX.js} +2 -2
- package/dist/cli/chunks/{chunk-BLFZFKT6.js → chunk-LJEO5R32.js} +2 -2
- package/dist/cli/chunks/{chunk-4RGV6Z2H.js → chunk-LT4OZHMK.js} +2 -2
- package/dist/cli/chunks/{chunk-6QBD64W3.js → chunk-LZVKR7HV.js} +2 -2
- package/dist/cli/chunks/{chunk-YLXUF5KW.js → chunk-M5PBVK3V.js} +3 -3
- package/dist/cli/chunks/{chunk-IXAABYGS.js → chunk-MSWBVPVQ.js} +2 -2
- package/dist/cli/chunks/{chunk-XWPUCPYW.js → chunk-MTWBYHMS.js} +2 -2
- package/dist/cli/chunks/{chunk-WCXQA24H.js → chunk-MWAEUJDC.js} +8 -8
- package/dist/cli/chunks/{chunk-6OLPKIYU.js → chunk-NFZY6ZVY.js} +1 -1
- package/dist/cli/chunks/{chunk-5QMIVHFT.js → chunk-NKKDO5W4.js} +2 -2
- package/dist/cli/chunks/{chunk-34NT5NBZ.js → chunk-NL4EKO2J.js} +2 -2
- package/dist/cli/chunks/{chunk-U7EGKKN3.js → chunk-NOP5ZJ7E.js} +2 -2
- package/dist/cli/chunks/{chunk-LHZYTNOQ.js → chunk-NSI3WL6P.js} +2 -2
- package/dist/cli/chunks/{chunk-IYZWEYWJ.js → chunk-NWIKNQLJ.js} +1 -1
- package/dist/cli/chunks/chunk-O75ODKCX.js +2 -0
- package/dist/cli/chunks/{chunk-TTLAWPEN.js → chunk-OIU6PKLF.js} +2 -2
- package/dist/cli/chunks/{chunk-R7KIC6TL.js → chunk-OK6CSJOX.js} +1 -1
- package/dist/cli/chunks/{chunk-HBWAMCVB.js → chunk-OLOKPY5O.js} +14 -14
- package/dist/cli/chunks/chunk-ON6C2OYG.js +2 -0
- package/dist/cli/chunks/{chunk-AKSCYNFH.js → chunk-OV3ESWN4.js} +2 -2
- package/dist/cli/chunks/{chunk-7NK2H7H5.js → chunk-OZDRAKFF.js} +2 -2
- package/dist/cli/chunks/{chunk-ISLI6D4K.js → chunk-PG7KISET.js} +2 -2
- package/dist/cli/chunks/{chunk-TXXRBNOB.js → chunk-PRYSWF6F.js} +1 -1
- package/dist/cli/chunks/{chunk-QLVZEEPR.js → chunk-PTPGYUT2.js} +2 -2
- package/dist/cli/chunks/{chunk-3XEL7XCA.js → chunk-Q32LITZL.js} +1 -1
- package/dist/cli/chunks/{chunk-CGBEI7UH.js → chunk-Q7B7T4YK.js} +2 -2
- package/dist/cli/chunks/{chunk-GUDOOOO6.js → chunk-QHGHWATK.js} +1 -1
- package/dist/cli/chunks/{chunk-DYNO72WD.js → chunk-QHLENBGB.js} +2 -2
- package/dist/cli/chunks/{chunk-32E2OPIE.js → chunk-QNNH5TDV.js} +3 -3
- package/dist/cli/chunks/{chunk-F5RZSNHI.js → chunk-R2LWUBET.js} +2 -2
- package/dist/cli/chunks/{chunk-L6NB4UHR.js → chunk-RNJRKFMX.js} +2 -2
- package/dist/cli/chunks/{chunk-VPBXVZWE.js → chunk-RXWPYY6H.js} +1 -1
- package/dist/cli/chunks/{chunk-R2B6EQQF.js → chunk-S6PGWJDK.js} +2 -2
- package/dist/cli/chunks/chunk-SDGRU6SG.js +2 -0
- package/dist/cli/chunks/{chunk-O4B6FFC5.js → chunk-SDVL5TZK.js} +1 -1
- package/dist/cli/chunks/{chunk-JNQVPTOM.js → chunk-SSRMFU4P.js} +2 -2
- package/dist/cli/chunks/{chunk-S4NNQE4L.js → chunk-T2Z3M6HA.js} +1 -1
- package/dist/cli/chunks/{chunk-4W5QWFU4.js → chunk-TXLLF7XR.js} +1 -1
- package/dist/cli/chunks/{chunk-QDBFB4XD.js → chunk-UU422SST.js} +2 -2
- package/dist/cli/chunks/{chunk-L3EQQMFI.js → chunk-VKLPSPPI.js} +2 -2
- package/dist/cli/chunks/{chunk-RJBCIN2G.js → chunk-VL4MSE3J.js} +2 -2
- package/dist/cli/chunks/{chunk-3W6QASVB.js → chunk-VM5C4DIV.js} +2 -2
- package/dist/cli/chunks/{chunk-OAXDI4XM.js → chunk-W72CUJRB.js} +1 -1
- package/dist/cli/chunks/{chunk-3O4Q4GAX.js → chunk-WDZT344G.js} +1 -1
- package/dist/cli/chunks/{chunk-64BSODHA.js → chunk-WKLI5Z3L.js} +2 -2
- package/dist/cli/chunks/{chunk-YMBPKBKG.js → chunk-WYAHOUK2.js} +1 -1
- package/dist/cli/chunks/{chunk-UURGDFGU.js → chunk-X3NEQ3SL.js} +1 -1
- package/dist/cli/chunks/{chunk-DU7Y54JI.js → chunk-X4CHPEOQ.js} +1 -1
- package/dist/cli/chunks/{chunk-JNXPRDNV.js → chunk-XKIVOADM.js} +3 -3
- package/dist/cli/chunks/{chunk-G7ISGLKP.js → chunk-XLQX77KP.js} +1 -1
- package/dist/cli/chunks/{chunk-76SUEI7S.js → chunk-XNFYQRJ2.js} +1 -1
- package/dist/cli/chunks/{chunk-6A2HRMTD.js → chunk-XPAH7SEX.js} +2 -2
- package/dist/cli/chunks/{chunk-HI4DA7Z3.js → chunk-XRJH5KXF.js} +2 -2
- package/dist/cli/chunks/{chunk-TY7XPI6R.js → chunk-XYXRO7VP.js} +2 -2
- package/dist/cli/chunks/{chunk-OW4LJ5HE.js → chunk-Y4XTPEAC.js} +2 -2
- package/dist/cli/chunks/chunk-YATW2RWQ.js +2 -0
- package/dist/cli/chunks/{chunk-KXENXRZE.js → chunk-YMJ5AVVU.js} +1 -1
- package/dist/cli/chunks/{chunk-2JWFS2K2.js → chunk-YQYTQRTR.js} +2 -2
- package/dist/cli/chunks/{chunk-OSETFZVE.js → chunk-YUK4KU2B.js} +2 -2
- package/dist/cli/chunks/{chunk-V3KNHI5B.js → chunk-Z4WAJ647.js} +2 -2
- package/dist/cli/chunks/{chunk-FQBNPSV2.js → chunk-Z57UERQZ.js} +2 -2
- package/dist/cli/chunks/{chunk-YBM4LUSF.js → chunk-Z7FWPSOK.js} +2 -2
- package/dist/cli/chunks/{chunk-QBVS4CXM.js → chunk-ZSMHQENA.js} +1 -1
- package/dist/cli/chunks/{ci-OO42YBET.js → ci-2G4BBIQD.js} +2 -2
- package/dist/cli/chunks/{ci-output-YXMTEX7Q.js → ci-output-SI3ME52L.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-EHA4N643.js → circuit-breaker-KTICF3EC.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-E6G6SLYI.js → claude-flow-setup-F44PULFU.js} +2 -2
- package/dist/cli/chunks/client-E6GK5NWT.js +2 -0
- package/dist/cli/chunks/{cline-installer-6JPWD64G.js → cline-installer-A7G7OXIS.js} +2 -2
- package/dist/cli/chunks/{code-Q3U6XDOO.js → code-EDLIBN77.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-BK2DC4MO.js → code-index-extractor-P4NBWGTV.js} +2 -2
- package/dist/cli/chunks/{codex-installer-DA3GBMLN.js → codex-installer-JB3ULDQP.js} +2 -2
- package/dist/cli/chunks/{completions-TZ5F33TA.js → completions-XPCXB5SR.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-N7U4V7ID.js → complexity-analyzer-LAL5RSB7.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-DDDJGW26.js → continuedev-installer-GSYBLQV7.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-JVFCE6GT.js → copilot-installer-7B56CNU2.js} +2 -2
- package/dist/cli/chunks/core-handlers-HJUORTFU.js +2 -0
- package/dist/cli/chunks/{cost-tracker-ZTIDLUFW.js → cost-tracker-EUJFKHGT.js} +2 -2
- package/dist/cli/chunks/{coverage-6G7T7TRQ.js → coverage-C75LPZYB.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-35WVZFAZ.js +2 -0
- package/dist/cli/chunks/{cursor-installer-JFNYGSDD.js → cursor-installer-WXQFM4KJ.js} +2 -2
- package/dist/cli/chunks/{daemon-5A4GD6XA.js → daemon-BPVBZZQO.js} +3 -3
- package/dist/cli/chunks/{daemon-KTXGJJRI.js → daemon-JR2MSTSK.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-4CUEQZD6.js → dag-attention-scheduler-I5H7DBNU.js} +2 -2
- package/dist/cli/chunks/{detect-I32JUSUE.js → detect-O5TMML24.js} +2 -2
- package/dist/cli/chunks/{dist-node-7ITNV6QS.js → dist-node-MDZ6UQ3V.js} +2 -2
- package/dist/cli/chunks/{domain-handler-LIFCXSZ4.js → domain-handler-BGBTZETG.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-67UWLHSK.js → domain-transfer-C2D2IEYV.js} +2 -2
- package/dist/cli/chunks/dream-QTZDMP6D.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-4WC5RUD6.js → embed-and-insert-pattern-UJREBJF5.js} +2 -2
- package/dist/cli/chunks/{eval-DLS2UAQ2.js → eval-BDD24HQC.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-VG5E6OJA.js → experience-capture-middleware-KLVXIIYH.js} +3 -3
- package/dist/cli/chunks/{fast-paths-262IVHDN.js → fast-paths-5HIKAQZ7.js} +2 -2
- package/dist/cli/chunks/{feature-flags-JJ3FHZGD.js → feature-flags-NM3S7OEW.js} +2 -2
- package/dist/cli/chunks/{feature-flags-L3K7DBN3.js → feature-flags-YE5SJPDS.js} +2 -2
- package/dist/cli/chunks/{file-discovery-Q3PBKVUW.js → file-discovery-PWRQZNJQ.js} +2 -2
- package/dist/cli/chunks/{fleet-LQ5S2YHG.js → fleet-UIPKNQX3.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-I33Z537H.js → gnn-wrapper-GWGKZRTO.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-RYIRAGZ7.js → heartbeat-handler-GQHJPNAY.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-N433NZCG.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-MR6W2OA4.js +2 -0
- package/dist/cli/chunks/hnsw-index-XC6EMJA2.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-SSENBBPR.js → hnsw-legacy-bridge-NE5JIRG3.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-F262IAGH.js → hnswlib-node-PNPV64M3.js} +2 -2
- package/dist/cli/chunks/{hooks-LR5KQMN5.js → hooks-3NBBUOB6.js} +10 -10
- package/dist/cli/chunks/hybrid-router-SH4IEAJA.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-NDZA2DKP.js → hypergraph-engine-6NRFVDV7.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-ADMWVHBT.js → hypergraph-handler-F3OOGTXF.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-RUTVXE7P.js +2 -0
- package/dist/cli/chunks/init-handler-DOTXTVUI.js +73 -0
- package/dist/cli/chunks/init-wizard-56NY5BSP.js +2 -0
- package/dist/cli/chunks/kernel-7JAN7WCO.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-DQVWZUKP.js → kilocode-installer-3AXYSZTO.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-TINLYZ22.js → kiro-installer-WBJDXY7Q.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-ST4LW3V4.js +2 -0
- package/dist/cli/chunks/{learning-KBT3S5WW.js → learning-BC5N4V3D.js} +3 -3
- package/dist/cli/chunks/{llm-router-2MX5LUAB.js → llm-router-T427WD6R.js} +4 -4
- package/dist/cli/chunks/llm-router-service-JNDF5MVJ.js +2 -0
- package/dist/cli/chunks/{load-IQWTGMLZ.js → load-M6SL2O3M.js} +2 -2
- package/dist/cli/chunks/load-test-I3P3DUS5.js +2 -0
- package/dist/cli/chunks/{mcp-GCTTJUBZ.js → mcp-F2V3KKG6.js} +2 -2
- package/dist/cli/chunks/{memory-XQVPI4UT.js → memory-FJAO3CSF.js} +5 -5
- package/dist/cli/chunks/memory-backend-27BBT57O.js +2 -0
- package/dist/cli/chunks/{memory-handlers-XD7MSFUN.js → memory-handlers-S3W6IQJL.js} +2 -2
- package/dist/cli/chunks/{multi-model-executor-JC63UCWG.js → multi-model-executor-FYOVZ4OH.js} +2 -2
- package/dist/cli/chunks/opencode-installer-APSBE4UR.js +15 -0
- package/dist/cli/chunks/{orchestrator-B75QWJUF.js → orchestrator-LN53EQ45.js} +16 -16
- package/dist/cli/chunks/pattern-null-store-SRBYJRNX.js +2 -0
- package/dist/cli/chunks/{pipeline-TCBQ2UTZ.js → pipeline-BYWXY2NO.js} +2 -2
- package/dist/cli/chunks/{platform-T43AYI3Z.js → platform-CZ774YPS.js} +2 -2
- package/dist/cli/chunks/{plugin-MSI3ZU3Z.js → plugin-72NXRX5Z.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-V62CWI6M.js → prime-radiant-advanced-wasm-G4DE6YKJ.js} +2 -2
- package/dist/cli/chunks/protocol-executor-WJLJHWO2.js +2 -0
- package/dist/cli/chunks/{protocol-handler-OH2INET2.js → protocol-handler-UH6CV63V.js} +2 -2
- package/dist/cli/chunks/{prove-6PTMXMUL.js → prove-V7FAT5HF.js} +2 -2
- package/dist/cli/chunks/provider-manager-UKUHSHAL.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-IMUECSFZ.js +2 -0
- package/dist/cli/chunks/{quality-PLNQN5GU.js → quality-N2K62FQM.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-EC4SVNMB.js +2 -0
- package/dist/cli/chunks/{real-embeddings-OW4OKR77.js → real-embeddings-TKHUE2RL.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-C32LCYAJ.js → roocode-installer-DFUA6FXW.js} +2 -2
- package/dist/cli/chunks/router-TVTOUQLL.js +2 -0
- package/dist/cli/chunks/routing-feedback-Y4WDXNXW.js +2 -0
- package/dist/cli/chunks/{routing-handler-CKFXXPMI.js → routing-handler-UUWD4IKG.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-GERRPTJL.js → ruvector-commands-B4WPTGCI.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-5FAB2QPA.js → rvf-dual-writer-MNRJGNIX.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-46COKWYB.js → rvf-migration-adapter-P2RDBFA4.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-AJVRWSNC.js → rvf-migration-coordinator-DFESZQSS.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-4YSC6QKO.js +2 -0
- package/dist/cli/chunks/safe-db-RGAY54O5.js +2 -0
- package/dist/cli/chunks/schedule-KJ4GWLPJ.js +2 -0
- package/dist/cli/chunks/scheduler-AONSLVA3.js +2 -0
- package/dist/cli/chunks/{security-Q622IVRB.js → security-MHLTNKFX.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-EST24R3R.js → shared-rvf-adapter-LR7E2EQI.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-CP6EXKBT.js → shared-rvf-dual-writer-RFFON2F3.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-7RZUEPM4.js +2 -0
- package/dist/cli/chunks/{status-handler-LLRQB4E2.js → status-handler-ROPTYGQC.js} +2 -2
- package/dist/cli/chunks/{structural-health-BUFWTNN2.js → structural-health-YGUFXGJ6.js} +2 -2
- package/dist/cli/chunks/{sync-JDG4SNT5.js → sync-6JTRTDL3.js} +2 -2
- package/dist/cli/chunks/{sync-RDL2RUOV.js → sync-NZZUMTKC.js} +2 -2
- package/dist/cli/chunks/{task-handler-KPP6ZXA6.js → task-handler-KYMV3AC6.js} +2 -2
- package/dist/cli/chunks/{task-handlers-MRK2BQWI.js → task-handlers-Z63YBQVU.js} +3 -3
- package/dist/cli/chunks/{test-7NYFTHRY.js → test-O6BQ7FGP.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-LGPKDMWD.js → test-scheduling-T3IOXEFI.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-H5JHB7TD.js → token-bootstrap-CTI2ULJF.js} +2 -2
- package/dist/cli/chunks/{token-usage-TWPDS5U3.js → token-usage-TNQTNAVT.js} +2 -2
- package/dist/cli/chunks/{transformers-GRNPPUHM.js → transformers-CJQDNQER.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-DOH5F6TO.js → tree-sitter-wasm-parser-RBZWLEVQ.js} +2 -2
- package/dist/cli/chunks/{types-NYV3YKE3.js → types-OMFCO364.js} +2 -2
- package/dist/cli/chunks/unified-memory-G3BYQ3WU.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-F7XUZMKW.js +2 -0
- package/dist/cli/chunks/unified-persistence-V35NXJSO.js +2 -0
- package/dist/cli/chunks/{upgrade-GDJMRYAT.js → upgrade-KRVOYWN3.js} +2 -2
- package/dist/cli/chunks/{validate-SIRFOPPM.js → validate-32FKHMKQ.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-XGMJYR6X.js → validate-swarm-45RPBPPH.js} +2 -2
- package/dist/cli/chunks/{vibium-NP6ENRKV.js → vibium-LCTNDCKK.js} +2 -2
- package/dist/cli/chunks/visual-security-K47U7KUM.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-YDBWPYZD.js → web-tree-sitter-FX2EFCLH.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-MFI6EAPH.js → windsurf-installer-I3TSJCNL.js} +2 -2
- package/dist/cli/chunks/witness-chain-G6GJXZD3.js +2 -0
- package/dist/cli/chunks/{witness-chain-YHLBWQQ3.js → witness-chain-YG2UWTYZ.js} +2 -2
- package/dist/cli/chunks/{workflow-TA6RY7R5.js → workflow-AEJ37RNV.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-SKF7GC5X.js +2 -0
- package/dist/cli/chunks/{wrappers-DS77IK4H.js → wrappers-GSU6VNU6.js} +2 -2
- package/dist/cli/handlers/init-handler.d.ts +2 -0
- package/dist/cli/handlers/init-handler.js +29 -1
- package/dist/coordination/result-saver.js +4 -0
- package/dist/domains/code-intelligence/coordinator-hypergraph.js +9 -4
- package/dist/domains/code-intelligence/coordinator.js +9 -4
- package/dist/init/opencode-installer.d.ts +39 -17
- package/dist/init/opencode-installer.js +166 -114
- package/dist/init/orchestrator.js +1 -0
- package/dist/init/phases/04-database.d.ts +5 -0
- package/dist/init/phases/04-database.js +7 -0
- package/dist/init/phases/05-learning.js +3 -0
- package/dist/init/phases/06-code-intelligence.js +6 -0
- package/dist/init/phases/09-assets.js +5 -1
- package/dist/init/phases/10-workers.js +4 -0
- package/dist/init/phases/12-verification.js +10 -5
- package/dist/init/phases/phase-interface.d.ts +6 -0
- package/dist/integrations/ruvector/rvf-native-adapter.js +8 -0
- package/dist/integrations/ruvector/shared-rvf-dual-writer.js +5 -0
- package/dist/kernel/kernel.js +4 -2
- package/dist/kernel/unified-memory.js +66 -48
- package/dist/learning/rvf-pattern-store.js +8 -0
- package/dist/mcp/bundle.js +327 -325
- package/dist/mcp/entry.js +42 -5
- package/dist/mcp/handlers/core-handlers.js +7 -2
- package/dist/mcp/protocol-server.js +10 -1
- package/dist/mcp/services/session-store.d.ts +1 -0
- package/dist/mcp/services/session-store.js +7 -0
- package/dist/mcp/tools/base.d.ts +6 -0
- package/dist/mcp/tools/base.js +16 -0
- package/package.json +6 -4
- package/dist/cli/chunks/adapter-TTIBYXH2.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-CTV5OLSN.js +0 -2
- package/dist/cli/chunks/base-ISNCJZ7A.js +0 -2
- package/dist/cli/chunks/browser-workflow-OD32QTTI.js +0 -2
- package/dist/cli/chunks/chunk-DF7V6X3N.js +0 -2
- package/dist/cli/chunks/chunk-I64BLAFS.js +0 -2
- package/dist/cli/chunks/chunk-LRRQEAP5.js +0 -2
- package/dist/cli/chunks/chunk-XCYPVJ34.js +0 -2
- package/dist/cli/chunks/chunk-XK7P7OXO.js +0 -2
- package/dist/cli/chunks/client-N4FQ6SMD.js +0 -2
- package/dist/cli/chunks/core-handlers-SFD5HCA3.js +0 -2
- package/dist/cli/chunks/cross-domain-router-7HGRUNLT.js +0 -2
- package/dist/cli/chunks/dream-HPGD5TLD.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-O6TI5E4P.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-TOVTN23J.js +0 -2
- package/dist/cli/chunks/hnsw-index-KCZ75V7K.js +0 -2
- package/dist/cli/chunks/hybrid-router-4JEPC4JZ.js +0 -2
- package/dist/cli/chunks/impact-analyzer-3MHIU3SE.js +0 -2
- package/dist/cli/chunks/init-handler-MGCYDX62.js +0 -70
- package/dist/cli/chunks/init-wizard-ERBO5JNA.js +0 -2
- package/dist/cli/chunks/kernel-XJPIIWET.js +0 -2
- package/dist/cli/chunks/knowledge-graph-NTJEG6ZE.js +0 -2
- package/dist/cli/chunks/llm-router-service-4T66BGB5.js +0 -2
- package/dist/cli/chunks/load-test-PM674TSK.js +0 -2
- package/dist/cli/chunks/memory-backend-53NQ5CG7.js +0 -2
- package/dist/cli/chunks/opencode-installer-6VJGEBIU.js +0 -3
- package/dist/cli/chunks/pattern-null-store-IF2RG2ON.js +0 -2
- package/dist/cli/chunks/protocol-executor-7AS75ZWT.js +0 -2
- package/dist/cli/chunks/provider-manager-AU2C4AET.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-WATQRCFO.js +0 -2
- package/dist/cli/chunks/queen-coordinator-IOCC4VQH.js +0 -2
- package/dist/cli/chunks/router-SCJMX6WA.js +0 -2
- package/dist/cli/chunks/routing-feedback-RWC7F553.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-W2RT6PTO.js +0 -2
- package/dist/cli/chunks/safe-db-HO2LCAO3.js +0 -2
- package/dist/cli/chunks/schedule-XENCR4MR.js +0 -2
- package/dist/cli/chunks/scheduler-WKZ3O2SS.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-IN6BOSCX.js +0 -2
- package/dist/cli/chunks/unified-memory-6MXOYRXZ.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-HY3JJD5Z.js +0 -2
- package/dist/cli/chunks/unified-persistence-LKQNQYRY.js +0 -2
- package/dist/cli/chunks/visual-security-7TBWICHP.js +0 -2
- package/dist/cli/chunks/witness-chain-24SVOWQL.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-XBDXCTLY.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
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.8");process.exit(0)}
|
|
2
2
|
var N="ffffffff-ffff-ffff-ffff-ffffffffffff";var _="00000000-0000-0000-0000-000000000000";var y=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function k(r){return typeof r=="string"&&y.test(r)}var u=k;function q(r){if(!u(r))throw TypeError("Invalid UUID");let n;return Uint8Array.of((n=parseInt(r.slice(0,8),16))>>>24,n>>>16&255,n>>>8&255,n&255,(n=parseInt(r.slice(9,13),16))>>>8,n&255,(n=parseInt(r.slice(14,18),16))>>>8,n&255,(n=parseInt(r.slice(19,23),16))>>>8,n&255,(n=parseInt(r.slice(24,36),16))/1099511627776&255,n/4294967296&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255)}var c=q;var x=[];for(let r=0;r<256;++r)x.push((r+256).toString(16).slice(1));function l(r,n=0){return(x[r[n+0]]+x[r[n+1]]+x[r[n+2]]+x[r[n+3]]+"-"+x[r[n+4]]+x[r[n+5]]+"-"+x[r[n+6]]+x[r[n+7]]+"-"+x[r[n+8]]+x[r[n+9]]+"-"+x[r[n+10]]+x[r[n+11]]+x[r[n+12]]+x[r[n+13]]+x[r[n+14]]+x[r[n+15]]).toLowerCase()}function C(r,n=0){let f=l(r,n);if(!u(f))throw TypeError("Stringified UUID is invalid");return f}var H=C;var v=new Uint8Array(16);function m(){return crypto.getRandomValues(v)}var g={};function X(r,n,f){let e,o=r?._v6??!1;if(r){let t=Object.keys(r);t.length===1&&t[0]==="_v6"&&(r=void 0)}if(r)e=E(r.random??r.rng?.()??m(),r.msecs,r.nsecs,r.clockseq,r.node,n,f);else{let t=Date.now(),i=m();j(g,t,i),e=E(i,g.msecs,g.nsecs,o?void 0:g.clockseq,o?void 0:g.node,n,f)}return n??l(e)}function j(r,n,f){return r.msecs??=-1/0,r.nsecs??=0,n===r.msecs?(r.nsecs++,r.nsecs>=1e4&&(r.node=void 0,r.nsecs=0)):n>r.msecs?r.nsecs=0:n<r.msecs&&(r.node=void 0),r.node||(r.node=f.slice(10,16),r.node[0]|=1,r.clockseq=(f[8]<<8|f[9])&16383),r.msecs=n,r}function E(r,n,f,e,o,t,i=0){if(r.length<16)throw new Error("Random bytes length must be >= 16");if(!t)t=new Uint8Array(16),i=0;else if(i<0||i+16>t.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);n??=Date.now(),f??=0,e??=(r[8]<<8|r[9])&16383,o??=r.slice(10,16),n+=122192928e5;let d=((n&268435455)*1e4+f)%4294967296;t[i++]=d>>>24&255,t[i++]=d>>>16&255,t[i++]=d>>>8&255,t[i++]=d&255;let a=n/4294967296*1e4&268435455;t[i++]=a>>>8&255,t[i++]=a&255,t[i++]=a>>>24&15|16,t[i++]=a>>>16&255,t[i++]=e>>>8|128,t[i++]=e&255;for(let p=0;p<6;++p)t[i++]=o[p];return t}var D=X;function U(r){let n=typeof r=="string"?c(r):r,f=G(n);return typeof r=="string"?l(f):f}function G(r){return Uint8Array.of((r[6]&15)<<4|r[7]>>4&15,(r[7]&15)<<4|(r[4]&240)>>4,(r[4]&15)<<4|(r[5]&240)>>4,(r[5]&15)<<4|(r[0]&240)>>4,(r[0]&15)<<4|(r[1]&240)>>4,(r[1]&15)<<4|(r[2]&240)>>4,96|r[2]&15,r[3],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}import{createHash as K}from"node:crypto";function M(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),K("md5").update(r).digest()}var T=M;function O(r){r=unescape(encodeURIComponent(r));let n=new Uint8Array(r.length);for(let f=0;f<r.length;++f)n[f]=r.charCodeAt(f);return n}var w="6ba7b810-9dad-11d1-80b4-00c04fd430c8",I="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function h(r,n,f,e,o,t){let i=typeof f=="string"?O(f):f,d=typeof e=="string"?c(e):e;if(typeof e=="string"&&(e=c(e)),e?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let a=new Uint8Array(16+i.length);if(a.set(d),a.set(i,d.length),a=n(a),a[6]=a[6]&15|r,a[8]=a[8]&63|128,o){if(t??=0,t<0||t+16>o.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let p=0;p<16;++p)o[t+p]=a[p];return o}return l(a)}function S(r,n,f,e){return h(48,T,r,n,f,e)}S.DNS=w;S.URL=I;var z=S;function F(r,n,f){return!n&&!r&&crypto.randomUUID?crypto.randomUUID():J(r,n,f)}function J(r,n,f){r=r||{};let e=r.random??r.rng?.()??m();if(e.length<16)throw new Error("Random bytes length must be >= 16");if(e[6]=e[6]&15|64,e[8]=e[8]&63|128,n){if(f=f||0,f<0||f+16>n.length)throw new RangeError(`UUID byte range ${f}:${f+15} is out of buffer bounds`);for(let o=0;o<16;++o)n[f+o]=e[o];return n}return l(e)}var P=F;import{createHash as Q}from"node:crypto";function W(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),Q("sha1").update(r).digest()}var V=W;function R(r,n,f,e){return h(80,V,r,n,f,e)}R.DNS=w;R.URL=I;var Y=R;function Z(r,n,f){r??={},f??=0;let e=D({...r,_v6:!0},new Uint8Array(16));if(e=U(e),n){if(f<0||f+16>n.length)throw new RangeError(`UUID byte range ${f}:${f+15} is out of buffer bounds`);for(let o=0;o<16;o++)n[f+o]=e[o];return n}return l(e)}var s=Z;function $(r){let n=typeof r=="string"?c(r):r,f=b(n);return typeof r=="string"?l(f):f}function b(r){return Uint8Array.of((r[3]&15)<<4|r[4]>>4&15,(r[4]&15)<<4|(r[5]&240)>>4,(r[5]&15)<<4|r[6]&15,r[7],(r[1]&15)<<4|(r[2]&240)>>4,(r[2]&15)<<4|(r[3]&240)>>4,16|(r[0]&240)>>4,(r[0]&15)<<4|(r[1]&240)>>4,r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}var A={};function B(r,n,f){let e;if(r)e=L(r.random??r.rng?.()??m(),r.msecs,r.seq,n,f);else{let o=Date.now(),t=m();r0(A,o,t),e=L(t,A.msecs,A.seq,n,f)}return n??l(e)}function r0(r,n,f){return r.msecs??=-1/0,r.seq??=0,n>r.msecs?(r.seq=f[6]<<23|f[7]<<16|f[8]<<8|f[9],r.msecs=n):(r.seq=r.seq+1|0,r.seq===0&&r.msecs++),r}function L(r,n,f,e,o=0){if(r.length<16)throw new Error("Random bytes length must be >= 16");if(!e)e=new Uint8Array(16),o=0;else if(o<0||o+16>e.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return n??=Date.now(),f??=r[6]*127<<24|r[7]<<16|r[8]<<8|r[9],e[o++]=n/1099511627776&255,e[o++]=n/4294967296&255,e[o++]=n/16777216&255,e[o++]=n/65536&255,e[o++]=n/256&255,e[o++]=n&255,e[o++]=112|f>>>28&15,e[o++]=f>>>20&255,e[o++]=128|f>>>14&63,e[o++]=f>>>6&255,e[o++]=f<<2&255|r[10]&3,e[o++]=r[11],e[o++]=r[12],e[o++]=r[13],e[o++]=r[14],e[o++]=r[15],e}var n0=B;function f0(r){if(!u(r))throw TypeError("Invalid UUID");return parseInt(r.slice(14,15),16)}var e0=f0;export{N as a,_ as b,u as c,c as d,H as e,D as f,U as g,z as h,P as i,Y as j,s as k,$ as l,n0 as m,e0 as n};
|
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
2
|
-
import{a as l}from"./chunk-
|
|
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.8");process.exit(0)}
|
|
2
|
+
import{a as l}from"./chunk-OK6CSJOX.js";import{a as m}from"./chunk-D7ZVIL3C.js";import{i as a}from"./chunk-NFZY6ZVY.js";var u=class{constructor(t,e){this.eventBus=t;this.maxHistorySize=e?.maxHistorySize??1e4,this.eventHistory=new l(this.maxHistorySize),this.correlationTimeout=e?.correlationTimeout??6e4,this.maxEventsPerCorrelation=e?.maxEventsPerCorrelation??100}eventBus;subscriptions=new Map;correlations=new Map;eventHistory;routes=[];domainSubscriptions=new Map;maxHistorySize;correlationTimeout;maxEventsPerCorrelation;initialized=!1;async initialize(){if(!this.initialized){for(let t of m){let e=this.eventBus.subscribeToChannel(t,async i=>{await this.handleIncomingEvent(i)});this.domainSubscriptions.set(t,e)}this.eventBus.subscribe("*",async t=>{m.includes(t.source)||await this.handleIncomingEvent(t)}),this.initialized=!0}}subscribeToDoamin(t,e){let i=`sub_domain_${a()}`;return this.subscriptions.set(i,{id:i,type:"domain",filter:t,handler:e,active:!0}),i}subscribeToEventType(t,e){let i=`sub_type_${a()}`;return this.subscriptions.set(i,{id:i,type:"eventType",filter:t,handler:e,active:!0}),i}unsubscribe(t){let e=this.subscriptions.get(t);return e?(e.active=!1,this.subscriptions.delete(t),!0):!1}async route(t){this.addToHistory(t),t.correlationId&&this.trackCorrelation(t);let i=this.findMatchingSubscriptions(t).map(async o=>{try{await o.handler(t)}catch(n){console.error(`Error in subscription handler ${o.id}:`,n instanceof Error?n.message:n)}}),r=await this.applyRoutes(t);await Promise.allSettled([...i,...r])}getCorrelation(t){let e=this.correlations.get(t);if(e)return{correlationId:e.correlationId,events:[...e.events],domains:new Set(e.domains),startedAt:e.startedAt,lastEventAt:e.lastEventAt,complete:e.complete}}trackCorrelation(t){if(!t.correlationId)return;let e=this.correlations.get(t.correlationId);e||(e={correlationId:t.correlationId,events:[],domains:new Set,startedAt:t.timestamp,lastEventAt:t.timestamp,complete:!1,timeout:null},this.correlations.set(t.correlationId,e)),e.events.length<this.maxEventsPerCorrelation&&(e.events.push(t),e.domains.add(t.source),e.lastEventAt=t.timestamp),e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(()=>{e.complete=!0,e.timeout=null},this.correlationTimeout)}aggregate(t,e){let i=this.eventHistory.toArray().filter(s=>s.timestamp>=t&&s.timestamp<=e),r=new Map,o=new Map;for(let s of i)r.set(s.type,(r.get(s.type)??0)+1),o.set(s.source,(o.get(s.source)??0)+1);let n={totalEvents:i.length,uniqueEventTypes:r.size,uniqueDomains:o.size,eventsPerSecond:i.length>0?i.length/((e.getTime()-t.getTime())/1e3):0};return{id:a(),windowStart:t,windowEnd:e,events:i,countByType:r,countByDomain:o,metrics:n}}getHistory(t){let e=this.eventHistory.toArray();return t&&(t.eventTypes?.length&&(e=e.filter(i=>t.eventTypes.includes(i.type))),t.domains?.length&&(e=e.filter(i=>t.domains.includes(i.source))),t.fromTimestamp&&(e=e.filter(i=>i.timestamp>=t.fromTimestamp)),t.toTimestamp&&(e=e.filter(i=>i.timestamp<=t.toTimestamp)),t.limit&&(e=e.slice(-t.limit))),e}addRoute(t){let e=t.priority??0,i=this.routes.findIndex(r=>(r.priority??0)<e);i===-1?this.routes.push(t):this.routes.splice(i,0,t)}removeRoute(t,e){let i=this.routes.findIndex(r=>r.eventPattern===t&&(e===void 0||r.source===e));return i!==-1?(this.routes.splice(i,1),!0):!1}async dispose(){this.subscriptions.clear();for(let t of this.domainSubscriptions.values())t.unsubscribe();this.domainSubscriptions.clear();for(let t of this.correlations.values())t.timeout&&clearTimeout(t.timeout);this.correlations.clear(),this.eventHistory.clear(),this.initialized=!1}async handleIncomingEvent(t){await this.route(t)}findMatchingSubscriptions(t){let e=[];for(let i of this.subscriptions.values())i.active&&(i.type==="domain"&&i.filter===t.source||i.type==="eventType"&&this.matchEventType(t.type,i.filter))&&e.push(i);return e}matchEventType(t,e){if(e==="*")return!0;let i=e.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(t)}async applyRoutes(t){let e=[];for(let i of this.routes){if(!(i.source==="*"||i.source===t.source||Array.isArray(i.source)&&i.source.includes(t.source))||!this.matchEventType(t.type,i.eventPattern)||i.filter&&!i.filter(t))continue;let o=i.transform?i.transform(t):t;for(let n of i.targets)n!==t.source&&e.push(this.eventBus.publish({...o,id:a(),correlationId:t.correlationId??t.id}))}return e}addToHistory(t){this.eventHistory.push(t)}};function y(c,t){return new u(c,t)}export{u as a,y as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
2
|
-
import{c as N,g as O,i as L}from"./chunk-
|
|
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.8");process.exit(0)}
|
|
2
|
+
import{c as N,g as O,i as L}from"./chunk-QNNH5TDV.js";import{i as R,m as D}from"./chunk-OLOKPY5O.js";import{b as g,d as w}from"./chunk-DDMKCHYT.js";import{a as p,c as q}from"./chunk-MTWBYHMS.js";import{i as h}from"./chunk-NFZY6ZVY.js";import{a as S,b as C}from"./chunk-4OHLPG6B.js";C();w();q();D();function y(E,e){let n=E.prepare("SELECT confidence, usage_count, successful_uses FROM qe_patterns WHERE id = ?").get(e.patternId);if(!n)return{updated:!1};let t=e.success?1:0,r=n.usage_count+1,a=n.successful_uses+t,s=a/r,i=Math.min(1,r/100),o=n.confidence*.3+i*.2+s*.5,c=E.prepare(`
|
|
3
3
|
INSERT INTO qe_pattern_usage (pattern_id, success, metrics_json, feedback)
|
|
4
4
|
VALUES (?, ?, ?, ?)
|
|
5
5
|
`),m=E.prepare(`
|
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
2
|
-
import{c as f}from"./chunk-
|
|
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.8");process.exit(0)}
|
|
2
|
+
import{c as f}from"./chunk-SDGRU6SG.js";import*as o from"fs";import*as n from"path";function u(){t=null}function g(c=process.cwd()){if(t)return t;if(process.env.AQE_PROJECT_ROOT)return t=process.env.AQE_PROJECT_ROOT,t;let l=c,a=n.parse(l).root,e=l,i=null,s=null,r=null;for(;e!==a;)o.existsSync(n.join(e,".agentic-qe"))&&i===null&&(i=e),o.existsSync(n.join(e,".git"))&&s===null&&(s=e),o.existsSync(n.join(e,"package.json"))&&(r=e),e=n.dirname(e);return i?t=i:s?t=s:r?t=r:t=process.cwd(),t}var t,p=f(()=>{"use strict";t=null});export{u as a,g as b,p as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
2
|
-
import{a as C,b as E}from"./chunk-
|
|
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.8");process.exit(0)}
|
|
2
|
+
import{a as C,b as E}from"./chunk-2UL4UK6V.js";import{a as T}from"./chunk-HEC2UWY3.js";import{a as _}from"./chunk-HVFHPDXV.js";import{l as D,m as F}from"./chunk-OLOKPY5O.js";import{a as R,c as A}from"./chunk-MTWBYHMS.js";import{g as O}from"./chunk-SDGRU6SG.js";import{createHash as M}from"crypto";var $={enabled:!0,maxEntries:500,ttlMs:3600*1e3,persistToDb:!0};function S(o){if(o==null||typeof o!="object")return JSON.stringify(o);if(Array.isArray(o))return"["+o.map(i=>S(i)).join(",")+"]";let e=o;return"{"+Object.keys(e).sort().map(i=>JSON.stringify(i)+":"+S(e[i])).join(",")+"}"}var x=class{cache=new Map;config;hits=0;misses=0;constructor(e){this.config={...$,...e}}computeFingerprint(e,t,r){let i=S({action:t,domain:e,input:r});return M("sha256").update(i).digest("hex").slice(0,16)}get(e){if(!this.config.enabled)return null;let t=this.cache.get(e);return t?Date.now()-t.cachedAt>this.config.ttlMs?(this.cache.delete(e),this.misses++,null):(t.hitCount++,t.lastHitAt=Date.now(),this.hits++,t):(this.misses++,null)}set(e,t,r,i,n){if(!this.config.enabled)return;this.cache.size>=this.config.maxEntries&&this.evictOldest();let s={fingerprint:e,domain:t,action:r,result:i,tokensSaved:n,cachedAt:Date.now(),hitCount:0,lastHitAt:0};this.cache.set(e,s),this.config.persistToDb&&this.persistEntry(s)}loadFromDb(){try{let e=w();if(!e)return;let t=Date.now()-this.config.ttlMs,r=e.prepare(`SELECT key, value FROM kv_store
|
|
3
3
|
WHERE namespace = 'session_cache'
|
|
4
4
|
AND created_at > ?
|
|
5
5
|
ORDER BY created_at DESC LIMIT ?`).all(t,this.config.maxEntries);for(let i of r)try{let n=JSON.parse(i.value);Date.now()-n.cachedAt<=this.config.ttlMs&&this.cache.set(n.fingerprint,n)}catch{}}catch{}}getStats(){let e=this.hits+this.misses,t=0;for(let r of this.cache.values())t+=r.tokensSaved*r.hitCount;return{size:this.cache.size,hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0,estimatedTokensSaved:t}}clear(){this.cache.clear(),this.hits=0,this.misses=0}evictOldest(){let e=null,t=1/0;for(let[r,i]of this.cache)i.cachedAt<t&&(t=i.cachedAt,e=r);e&&this.cache.delete(e)}persistEntry(e){try{let t=w();if(!t)return;t.prepare(`INSERT OR REPLACE INTO kv_store (key, namespace, value, created_at)
|
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
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.8");process.exit(0)}
|
|
2
2
|
var o=!1;function r(t){if(!o){for(let e of["ALTER TABLE routing_outcomes ADD COLUMN exploration INTEGER NOT NULL DEFAULT 0","ALTER TABLE routing_outcomes ADD COLUMN criticality REAL","ALTER TABLE routing_outcomes ADD COLUMN q_weight REAL"])try{t.prepare(e).run()}catch{}try{t.prepare("CREATE INDEX IF NOT EXISTS idx_routing_outcomes_exploration ON routing_outcomes(exploration)").run()}catch{}o=!0}}export{r as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
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.8");process.exit(0)}
|
|
2
|
+
import{c as h,e as v,g as T}from"./chunk-SDGRU6SG.js";var y={};v(y,{DotProductAttention:()=>z,FlashAttention:()=>k,HyperbolicAttention:()=>C,LinearAttention:()=>j,MoEAttention:()=>W,MultiHeadAttention:()=>F,RuvectorLayer:()=>O,SonaEngine:()=>K,TensorCompress:()=>E,default:()=>I,differentiableSearch:()=>L,getCompressionLevel:()=>B,hierarchicalForward:()=>V,init:()=>D,pipeline:()=>q});import{createRequire as A}from"module";var _,g,I,O,E,L,V,B,D,k,z,F,C,j,W,K,q,R=h(()=>{_=A(import.meta.url),g=_("@ruvector/rvf-node"),I=g,{RuvectorLayer:O,TensorCompress:E,differentiableSearch:L,hierarchicalForward:V,getCompressionLevel:B,init:D,FlashAttention:k,DotProductAttention:z,MultiHeadAttention:F,HyperbolicAttention:C,LinearAttention:j,MoEAttention:W,SonaEngine:K,pipeline:q}=g||{}});var Z={};v(Z,{createRvfStore:()=>$,isRvfNativeAvailable:()=>X,openRvfStore:()=>G,openRvfStoreReadonly:()=>U});import{readFileSync as J,writeFileSync as H,copyFileSync as Q,existsSync as Y}from"fs";function c(){if(S)return m;S=!0;try{let s=(R(),T(y));!s.RvfDatabase&&s.default&&s.default.RvfDatabase&&(s=s.default),m=s}catch{m=null}return m}function w(s){return`${s}.idmap.json`}function N(s){let e=w(s),t=new Map,n=new Map,i=1;if(Y(e))try{let r=JSON.parse(J(e,"utf-8"));i=r.nextLabel;for(let[a,p]of r.entries)t.set(a,p),n.set(p,a)}catch{}return{strToNum:t,numToStr:n,nextLabel:i}}function b(s,e,t){let n={nextLabel:t,entries:Array.from(e.entries())};H(w(s),JSON.stringify(n),"utf-8")}function $(s,e){let t=c();if(!t)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let n=t.RvfDatabase.create(s,{dimension:e}),i=n.dimension();return new d(n,s,i,new Map,new Map,1)}function G(s){let e=c();if(!e)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let t=e.RvfDatabase.open(s),n=t.dimension(),{strToNum:i,numToStr:r,nextLabel:a}=N(s);return new d(t,s,n,i,r,a)}function U(s){let e=c();if(!e)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let t=e.RvfDatabase.openReadonly(s),n=t.dimension(),{strToNum:i,numToStr:r,nextLabel:a}=N(s);return new d(t,s,n,i,r,a)}function X(){return process.env.AQE_MEMORY_BACKEND==="memory"?!1:c()!==null}var m,S,d,P=h(()=>{m=null,S=!1;d=class s{db;_path;_dimension;strToNum;numToStr;nextLabel;_open;constructor(e,t,n,i,r,a){this.db=e,this._path=t,this._dimension=n,this.strToNum=i,this.numToStr=r,this.nextLabel=a,this._open=!0}ingest(e){if(this.ensureOpen(),e.length===0)return{accepted:0,rejected:0};let t=this._dimension,n=new Float32Array(e.length*t),i=[],r=[];for(let o=0;o<e.length;o++){let{id:u,vector:f,metadata:x}=e[o],l=this.strToNum.get(u);l===void 0&&(l=this.nextLabel++,this.strToNum.set(u,l),this.numToStr.set(l,u)),i.push(l),r.push(x);let M=f instanceof Float32Array?f:new Float32Array(f);n.set(M.subarray(0,t),o*t)}let a;if(r.some(o=>o!==void 0)&&typeof this.db.ingestBatchWithMetadata=="function"){let o=r.map(u=>u?JSON.stringify(u):"");a=this.db.ingestBatchWithMetadata(n,i,o)}else a=this.db.ingestBatch(n,i);return this.persistIdMap(),{accepted:a.accepted,rejected:a.rejected}}search(e,t){this.ensureOpen();let n=e instanceof Float32Array?e:new Float32Array(e);return this.db.query(n,t).map(r=>{let a=this.numToStr.get(r.id);return a===void 0?null:{id:a,distance:r.distance,score:1/(1+r.distance)}}).filter(r=>r!==null)}delete(e){this.ensureOpen();let t=[];for(let i of e){let r=this.strToNum.get(i);r!==void 0&&t.push(r)}if(t.length===0)return 0;let n=this.db.delete(t);for(let i of e){let r=this.strToNum.get(i);r!==void 0&&(this.strToNum.delete(i),this.numToStr.delete(r))}return this.persistIdMap(),n.deleted}fork(e){this.ensureOpen(),Q(this._path,e);let t=new Map(this.strToNum),n=new Map(this.numToStr);b(e,t,this.nextLabel);let r=c().RvfDatabase.open(e);return new s(r,e,this._dimension,t,n,this.nextLabel)}status(){this.ensureOpen();let e=this.db.status(),n=this.db.segments().filter(i=>i.segType==="witness");return{totalVectors:e.totalVectors,totalSegments:e.totalSegments,fileSizeBytes:e.fileSize,epoch:e.currentEpoch,witnessValid:n.length>0,witnessEntries:n.length,deadSpaceRatio:typeof e.deadSpaceRatio=="number"?e.deadSpaceRatio:0}}dimension(){return this._dimension}size(){return this.ensureOpen(),this.db.status().totalVectors}compact(){this.ensureOpen();try{let e=this.db.compact();return e&&typeof e=="object"?{segmentsCompacted:typeof e.segmentsCompacted=="number"?e.segmentsCompacted:0,bytesReclaimed:typeof e.bytesReclaimed=="number"?e.bytesReclaimed:0,epoch:typeof e.epoch=="number"?e.epoch:0}:{segmentsCompacted:0,bytesReclaimed:0,epoch:0}}catch{return null}}close(){this._open&&(this.db.close(),this._open=!1)}isOpen(){return this._open}path(){return this._path}embedKernel(e){return this.ensureOpen(),this.db.embedKernel(0,99,0,e,0,"")}extractKernel(){return this.ensureOpen(),this.db.extractKernel()}verifyWitness(){this.ensureOpen();let e=this.tryNative("verifyWitness");return e?{valid:e.valid??!0,totalEntries:e.totalEntries??0,errors:Array.isArray(e.errors)?e.errors:[]}:{valid:!0,totalEntries:0,errors:[]}}sign(e){this.ensureOpen();let t=this.tryNative("sign",e);return typeof t=="string"?t:null}fileId(){this.ensureOpen();let e=this.tryNative("fileId");return typeof e=="string"?e:null}parentId(){this.ensureOpen();let e=this.tryNative("parentId");return typeof e=="string"?e:null}lineageDepth(){this.ensureOpen();let e=this.tryNative("lineageDepth");return typeof e=="number"?e:0}indexStats(){let e=this.status();return{totalVectors:e.totalVectors,dimension:this._dimension,totalSegments:e.totalSegments,fileSizeBytes:e.fileSizeBytes,epoch:e.epoch,witnessValid:e.witnessValid,witnessEntries:e.witnessEntries,idMapSize:this.strToNum.size}}freeze(){this.ensureOpen();let e=this.tryNative("freeze");return typeof e=="number"?e:0}derive(e){this.ensureOpen();let t=c();if(typeof this.db.derive=="function")try{let n=this.db.derive(e),i=new Map(this.strToNum),r=new Map(this.numToStr);return b(e,i,this.nextLabel),new s(n,e,this._dimension,i,r,this.nextLabel)}catch{}return this.fork(e)}ensureOpen(){if(!this._open)throw new Error("RVF database is closed")}tryNative(e,...t){if(typeof this.db[e]!="function")return null;try{return this.db[e](...t)}catch{return null}}persistIdMap(){b(this._path,this.strToNum,this.nextLabel)}}});export{$ as a,G as b,U as c,X as d,Z as e,P as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
2
|
-
import{a as ie,b as ae}from"./chunk-7NK2H7H5.js";import{S as oe,i as j,p as q}from"./chunk-76JYG426.js";import{c as g,e as D,g as $}from"./chunk-LRRQEAP5.js";var I,E=g(()=>{"use strict";I={dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}});function se(){if(z)return A!==null;try{let i=(ae(),$(ie));if(A=i.differentiableSearch,P=i.init,P)try{P()}catch{}return z=!0,!0}catch{return z=!0,!1}}function B(i){let e=0;for(let r=0;r<i.length;r++)e+=i[r]*i[r];return Math.sqrt(e)}function ce(i,e,r,t){let n=r*t;if(n===0)return 0;let a=0,o=Math.min(i.length,e.length);for(let c=0;c<o;c++)a+=i[c]*e[c];return a/n}function U(i,e){let r=0,t=Math.min(i.length,e.length);for(let n=0;n<t;n++){let a=i[n]-e[n];r+=a*a}return Math.sqrt(r)}function le(i,e){if(i.length===e)return i;let r=new Float32Array(e);if(i.length>e){let t=i.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*t),o=Math.floor((n+1)*t),c=0;for(let s=a;s<o;s++)c+=i[s];r[n]=c/(o-a)}}else for(let t=0;t<i.length;t++)r[t]=i[t];return r}var A,P,z,S,O=g(()=>{"use strict";E();A=null,P=null,z=!1;S=class{config;entries=[];idToIndex=new Map;hasRuvector=!1;loaded=!1;constructor(e){this.config={...I,...e}}ensureLoaded(){this.loaded||(this.hasRuvector=se(),this.loaded=!0)}normalizeVector(e){return e.length===this.config.dimensions?e:le(e,this.config.dimensions)}add(e,r,t){this.ensureLoaded();let n=this.normalizeVector(r),a=B(n);if(this.idToIndex.has(e)){let c=this.idToIndex.get(e);this.entries[c]={id:e,vector:n,norm:a,metadata:t};return}let o=this.entries.length;this.entries.push({id:e,vector:n,norm:a,metadata:t}),this.idToIndex.set(e,o)}search(e,r){if(this.ensureLoaded(),this.entries.length===0)return[];let t=this.normalizeVector(e),n=B(t),a=Math.min(r,this.entries.length),o=this.entries.length>0?this.entries[0].vector.length:0,c=t.length===o;if(this.config.metric==="cosine")return this.bruteForcSearch(t,n,a);if(this.hasRuvector&&c&&A)try{let s=this.entries.map(u=>u.vector),l=A(t,s,a,1).indices.map(u=>{let h=this.entries[u],m=-U(t,h.vector);return{id:h.id,score:m,metadata:h.metadata}});return l.sort((u,h)=>h.score-u.score),l}catch{}return this.bruteForcSearch(t,n,a)}bruteForcSearch(e,r,t){let n=[];for(let a of this.entries){let o;this.config.metric==="cosine"?o=ce(e,a.vector,r,a.norm):o=-U(e,a.vector),n.push({id:a.id,score:o,metadata:a.metadata})}return n.sort((a,o)=>o.score-a.score),n.slice(0,t)}remove(e){let r=this.idToIndex.get(e);if(r===void 0)return!1;let t=this.entries.length-1;if(r!==t){let n=this.entries[t];this.entries[r]=n,this.idToIndex.set(n.id,r)}return this.entries.pop(),this.idToIndex.delete(e),!0}size(){return this.entries.length}dimensions(){return this.config.dimensions}recall(){return this.hasRuvector,1}isRuvectorAvailable(){return this.ensureLoaded(),this.hasRuvector}getConfig(){return{...this.config}}clear(){this.entries=[],this.idToIndex.clear()}dispose(){this.clear()}}});import{createRequire as he}from"module";function de(){if(K){if(k)return k;throw new b(J??"Unknown load error")}K=!0;try{let i=ue("hnswlib-node");if(!i.HierarchicalNSW)throw new Error("hnswlib-node module missing HierarchicalNSW export");return k=i,k}catch(i){let e=i instanceof Error?i.message:String(i);throw J=e,new b(e)}}function me(i,e){if(i.length===e)return i;let r=new Float32Array(e);if(i.length>e){let t=i.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*t),o=Math.floor((n+1)*t),c=0;for(let s=a;s<o;s++)c+=i[s];r[n]=c/(o-a)}}else for(let t=0;t<i.length;t++)r[t]=i[t];return r}function Q(i){let e=new Array(i.length);for(let r=0;r<i.length;r++)e[r]=i[r];return e}var ue,b,k,K,J,X,w,Y=g(()=>{"use strict";E();ue=he(import.meta.url),b=class extends Error{constructor(e){super(`Native HNSW backend unavailable: ${e}`),this.name="NativeHnswUnavailableError"}},k=null,K=!1,J=null;X=1e4,w=class{config;nativeIndex=null;currentMaxElements=X;liveIds=new Set;metadataStore=new Map;_metrics={totalSearches:0,totalAdds:0,totalRemoves:0,avgSearchLatencyMs:0,maxSearchLatencyMs:0,lastSearchLatencyMs:0,fallbackSearchCount:0,bruteForceSearchCount:0,nativeSearchCount:0,fallbackRate:0,allSearchesBruteForce:!1};constructor(e){this.config={...I,...e},this.nativeIndex=this.createFreshIndex()}createFreshIndex(){let e=de(),r=this.config.metric==="euclidean"?"l2":"cosine";try{let t=new e.HierarchicalNSW(r,this.config.dimensions);return t.initIndex(this.currentMaxElements,this.config.M,this.config.efConstruction,100,!0),t.setEf(this.config.efSearch),t}catch(t){let n=t instanceof Error?t.message:String(t);throw new b(`HierarchicalNSW init failed: ${n}`)}}add(e,r,t){if(!this.nativeIndex)throw new Error("NativeHnswBackend has been disposed");let n=this.normalizeVector(r);if(!this.liveIds.has(e)&&this.liveIds.size>=this.currentMaxElements){let a=this.currentMaxElements*2;this.nativeIndex.resizeIndex(a),this.currentMaxElements=a}this.nativeIndex.addPoint(Q(n),e,!0),this.liveIds.add(e),t?this.metadataStore.set(e,t):this.metadataStore.delete(e),this._metrics.totalAdds++}search(e,r){if(!this.nativeIndex)throw new Error("NativeHnswBackend has been disposed");if(this.liveIds.size===0||r<=0)return[];let t=performance.now(),n=this.normalizeVector(e),a=Math.min(r,this.liveIds.size),o=Math.min(a*2,this.liveIds.size),c=this.nativeIndex.searchKnn(Q(n),o),s=this.config.metric==="cosine",d=new Map;for(let h=0;h<c.neighbors.length;h++){let m=c.neighbors[h];if(!this.liveIds.has(m))continue;let x=c.distances[h],f=s?1-x:-x,W=d.get(m);(W===void 0||f>W.score)&&d.set(m,{id:m,score:f,metadata:this.metadataStore.get(m)})}let l=Array.from(d.values());l.sort((h,m)=>m.score-h.score),l.length>a&&(l.length=a);let u=performance.now()-t;return this.updateSearchMetrics(u),this._metrics.nativeSearchCount=this._metrics.totalSearches,u>50&&console.warn(`[NativeHNSW] search took ${u.toFixed(1)}ms (k=${r}, results=${l.length})`),l}remove(e){if(!this.nativeIndex||!this.liveIds.has(e))return!1;try{this.nativeIndex.markDelete(e)}catch{return!1}return this.liveIds.delete(e),this.metadataStore.delete(e),this._metrics.totalRemoves++,!0}size(){return this.liveIds.size}dimensions(){return this.config.dimensions}recall(){return .99}getMetrics(){return{...this._metrics}}get lastSearchLatencyMs(){return this._metrics.lastSearchLatencyMs}getConfig(){return{...this.config}}clear(){this.nativeIndex&&(this.liveIds.clear(),this.metadataStore.clear(),this.currentMaxElements=X,this.nativeIndex=this.createFreshIndex())}dispose(){this.liveIds.clear(),this.metadataStore.clear(),this.nativeIndex=null}isNativeAvailable(){return this.nativeIndex!==null}normalizeVector(e){return e.length===this.config.dimensions?e:me(e,this.config.dimensions)}updateSearchMetrics(e){this._metrics.totalSearches++,this._metrics.lastSearchLatencyMs=e,e>this._metrics.maxSearchLatencyMs&&(this._metrics.maxSearchLatencyMs=e);let r=this._metrics.totalSearches;this._metrics.avgSearchLatencyMs=this._metrics.avgSearchLatencyMs*((r-1)/r)+e/r}}});function Z(i,e){let r=Array.from({length:e},()=>new Float64Array(e));for(let t=0;t<e;t++){let n=i[t].length;r[t][t]=n;for(let a of i[t])r[t][a]=-1}return r}function N(i,e){let r=e.length,t=new Float64Array(r);for(let n=0;n<r;n++){let a=i[n].length;t[n]=a*e[n];for(let o of i[n])t[n]-=e[o]}return t}function H(i){let e=0;for(let r=0;r<i.length;r++)e+=i[r]*i[r];return Math.sqrt(e)}function R(i){let e=H(i);if(e>0)for(let r=0;r<i.length;r++)i[r]/=e}function v(i,e){let r=0;for(let t=0;t<i.length;t++)r+=i[t]*e[t];for(let t=0;t<i.length;t++)i[t]-=r*e[t]}function y(i,e,r=100,t=1e-6){if(e<=1)return 0;if(e===2)return i[0].includes(1)?2:0;let n=new Float64Array(e).fill(1/Math.sqrt(e)),a=new Float64Array(e);for(let l=0;l<e;l++)a[l]=Math.random()-.5;v(a,n),R(a);let o=0;for(let l=0;l<30;l++){let u=N(i,a);if(v(u,n),o=H(u),o>0)for(let h=0;h<e;h++)a[h]=u[h]/o}if(o<t)return 0;let c=new Float64Array(e);for(let l=0;l<e;l++)c[l]=Math.random()-.5;v(c,n),R(c);let s=0;for(let l=0;l<r;l++){let u=N(i,c),h=new Float64Array(e);for(let f=0;f<e;f++)h[f]=o*c[f]-u[f];v(h,n);let m=H(h);if(m<t)break;let x=m;for(let f=0;f<e;f++)c[f]=h[f]/m;if(Math.abs(x-s)<t)break;s=x}let d=o-s;return Math.max(0,d)}function F(i,e,r=100,t=1e-6){return y(i,e,r,t)}function C(i,e,r=50,t){if(e<=1)return 0;let n=t??y(i,e);if(n<1e-10)return 1/0;let o=2*Math.max(...i.map(d=>d.length),1),s=2*(Math.log(o/n)/(o-n));return Math.max(0,s)}function M(i,e,r){let t=1-Math.exp(-i/.05),n=1-Math.exp(-e/.5),a=r===1/0?0:1/(1+r/5),o=.4*t+.3*n+.3*a;return Math.max(0,Math.min(1,o))}var _=g(()=>{"use strict"});var re={};D(re,{ALERT_THRESHOLDS:()=>fe,DEFAULT_HNSW_HEALTH_CONFIG:()=>ee,HnswHealthMonitor:()=>L,_resetNativeLoader:()=>be,approximateFiedlerValue:()=>y,approximateSpectralGap:()=>F,buildAdjacencyFromIndex:()=>te,buildLaplacian:()=>Z,computeCoherenceScore:()=>M,createHnswHealthMonitor:()=>ge,deflateVector:()=>v,estimateEffectiveResistance:()=>C,laplacianMultiply:()=>N,normalizeInPlace:()=>R,vectorNorm:()=>H});function pe(){return V?T:(V=!0,T=null,null)}function be(){T=null,V=!1}function te(i,e=16,r){let t=i.size();if(t===0)return{adjacency:[],nodeCount:0,adjacencySource:"approximate"};let n=Array.from({length:t},()=>[]),a=Math.min(e,t-1);if(a===0)return{adjacency:n,nodeCount:t,adjacencySource:"approximate"};if(r&&r.size>0){let o=Array.from(r.keys()).slice(0,t),c=new Map;for(let s=0;s<o.length;s++)c.set(o[s],s);for(let s=0;s<o.length;s++){let d=r.get(o[s]);if(!d)continue;let l=i.search(d,a+1);for(let u of l){if(u.id===o[s])continue;let h=c.get(u.id);h!==void 0&&(n[s].includes(h)||n[s].push(h),n[h].includes(s)||n[h].push(s))}}return{adjacency:n,nodeCount:t,adjacencySource:"actual-search"}}console.warn("[HnswHealthMonitor] No stored vectors provided \u2014 using approximate circular adjacency. Pass stored vectors for accurate health metrics.");for(let o=0;o<t;o++)for(let c=0;c<a;c++){let s=(o+c+1)%t;n[o].includes(s)||n[o].push(s),n[s].includes(o)||n[s].push(o)}return{adjacency:n,nodeCount:t,adjacencySource:"approximate"}}function ge(i){return new L(i)}var ee,fe,T,V,L,ne=g(()=>{"use strict";_();_();ee={fiedlerThreshold:.01,spectralGapThreshold:.1,resistanceThreshold:10,coherenceThreshold:.3,maxPowerIterations:100,convergenceTolerance:1e-6,resistanceSampleSize:50,maxHistoryEntries:200,minIndexSize:3},fe={FragileIndex:.01,PoorExpansion:.1,HighResistance:10,LowCoherence:.3},T=null,V=!1;L=class{config;alerts=[];history=[];lastReport=null;useNative=!1;nativeChecked=!1;constructor(e){this.config={...ee,...e}}checkHealth(e){let r=performance.now(),t=e.size();if(t<this.config.minIndexSize)return this.createSmallIndexReport(t,performance.now()-r);this.nativeChecked||(this.nativeChecked=!0,this.useNative=pe()!==null);let{adjacency:n,nodeCount:a,adjacencySource:o}=te(e),c=this.useNative?this.computeNativeMetrics(n):this.computeApproximateMetrics(n,a),s=this.generateAlerts(c);this.alerts.length=0,this.alerts.push(...s);let d=performance.now()-r,l={healthy:s.length===0,metrics:c,alerts:s,indexSize:t,usedNativeBackend:this.useNative,adjacencySource:o,checkDurationMs:d,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:c.coherenceScore,fiedlerValue:c.fiedlerValue,indexSize:t,healthy:l.healthy,timestamp:l.checkedAt}),this.lastReport=l,l}getAlerts(){return[...this.alerts]}getMetricsHistory(e){let r=[...this.history];return e!==void 0&&e<r.length?r.slice(-e):r}isHealthy(){return this.lastReport===null?!0:this.lastReport.healthy}getLastReport(){return this.lastReport}clearHistory(){this.history.length=0,this.alerts.length=0,this.lastReport=null}computeNativeMetrics(e){let r=T,t=r.computeFiedlerValue(e),n=r.computeSpectralGap(e),a=r.computeEffectiveResistance(e),o=M(t,n,a);return{fiedlerValue:t,spectralGap:n,effectiveResistance:a,coherenceScore:o}}computeApproximateMetrics(e,r){let t=y(e,r,this.config.maxPowerIterations,this.config.convergenceTolerance),n=F(e,r,this.config.maxPowerIterations,this.config.convergenceTolerance),a=C(e,r,this.config.resistanceSampleSize,t),o=M(t,n,a);return{fiedlerValue:t,spectralGap:n,effectiveResistance:a,coherenceScore:o}}generateAlerts(e){let r=[],t=new Date;return e.fiedlerValue<this.config.fiedlerThreshold&&r.push({type:"FragileIndex",message:`Fiedler value ${e.fiedlerValue.toFixed(6)} is below threshold ${this.config.fiedlerThreshold}. The index graph has weak algebraic connectivity.`,value:e.fiedlerValue,threshold:this.config.fiedlerThreshold,timestamp:t}),e.spectralGap<this.config.spectralGapThreshold&&r.push({type:"PoorExpansion",message:`Spectral gap ${e.spectralGap.toFixed(6)} is below threshold ${this.config.spectralGapThreshold}. The index graph has poor expansion properties.`,value:e.spectralGap,threshold:this.config.spectralGapThreshold,timestamp:t}),e.effectiveResistance>this.config.resistanceThreshold&&r.push({type:"HighResistance",message:`Average effective resistance ${e.effectiveResistance.toFixed(4)} exceeds threshold ${this.config.resistanceThreshold}. Nodes are poorly connected.`,value:e.effectiveResistance,threshold:this.config.resistanceThreshold,timestamp:t}),e.coherenceScore<this.config.coherenceThreshold&&r.push({type:"LowCoherence",message:`Coherence score ${e.coherenceScore.toFixed(4)} is below threshold ${this.config.coherenceThreshold}. Overall index health is degraded.`,value:e.coherenceScore,threshold:this.config.coherenceThreshold,timestamp:t}),r}createSmallIndexReport(e,r){let t={fiedlerValue:e>0?1:0,spectralGap:e>0?1:0,effectiveResistance:e>0?.5:0,coherenceScore:e>0?1:0},n={healthy:!0,metrics:t,alerts:[],indexSize:e,usedNativeBackend:!1,adjacencySource:"approximate",checkDurationMs:r,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:t.coherenceScore,fiedlerValue:t.fiedlerValue,indexSize:e,healthy:!0,timestamp:n.checkedAt}),this.lastReport=n,n}addHistoryPoint(e){this.history.push(e),this.history.length>this.config.maxHistoryEntries&&this.history.splice(0,this.history.length-this.config.maxHistoryEntries)}}});var ye={};D(ye,{HnswAdapter:()=>G});var ve,p,G,xe=g(()=>{O();Y();oe();ve={patterns:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},"qe-memory":{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},learning:{dimensions:384,M:16,efConstruction:200,efSearch:50,metric:"cosine"},coverage:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}},p=new Map,G=class i{backend;_isNativeBackend;indexName;stringToNumericId=new Map;numericToStringId=new Map;nextAutoId=0;healthMonitor=null;healthMonitorLoaded=!1;operationsSinceLastCheck=0;healthCheckFrequency=100;lastHealthReport=null;constructor(e,r){this.indexName=e;let n={...ve[e]??{},...r},{backend:a,isNative:o}=i.createBackend(n);this.backend=a,this._isNativeBackend=o}add(e,r,t){this.backend.add(e,r,t),this.maybeRunHealthCheck()}search(e,r){let t=performance.now(),n=this.backend.search(e,r),a=performance.now()-t;return a>50&&console.warn(`[HNSW] search took ${a.toFixed(1)}ms (k=${r}, results=${n.length})`),this._lastSearchLatencyMs=a,n}_lastSearchLatencyMs=0;get lastSearchLatencyMs(){return this._lastSearchLatencyMs}remove(e){return this.backend.remove(e)}size(){return this.backend.size()}dimensions(){return this.backend.dimensions()}recall(){return this.backend.recall()}addByStringId(e,r){let t=this.stringToNumericId.get(e);t!==void 0?this.backend.remove(t):(t=this.nextAutoId++,this.stringToNumericId.set(e,t),this.numericToStringId.set(t,e)),this.backend.add(t,new Float32Array(r))}searchByArray(e,r){return this.backend.search(new Float32Array(e),r).map(n=>({id:this.numericToStringId.get(n.id)??String(n.id),score:n.score}))}removeByStringId(e){let r=this.stringToNumericId.get(e);if(r===void 0)return!1;let t=this.backend.remove(r);return t&&(this.stringToNumericId.delete(e),this.numericToStringId.delete(r)),t}clear(){this.backend.clear?.(),this.stringToNumericId.clear(),this.numericToStringId.clear(),this.nextAutoId=0}dispose(){try{this.backend.dispose?.()}catch{}this.stringToNumericId.clear(),this.numericToStringId.clear(),this.nextAutoId=0}isRuvectorAvailable(){return this.backend instanceof S?this.backend.isRuvectorAvailable():this.backend instanceof w?this.backend.isNativeAvailable():!1}isNativeBackend(){return this._isNativeBackend}getName(){return this.indexName}setHealthCheckFrequency(e){this.healthCheckFrequency=Math.max(1,e)}getHealthCheckFrequency(){return this.healthCheckFrequency}getLastHealthReport(){return this.lastHealthReport}getHealthMonitor(){return this.healthMonitor}maybeRunHealthCheck(){if(q()&&(this.operationsSinceLastCheck++,!(this.operationsSinceLastCheck<this.healthCheckFrequency)&&(this.operationsSinceLastCheck=0,this.ensureHealthMonitor(),this.healthMonitor)))try{this.lastHealthReport=this.healthMonitor.checkHealth(this.backend),this.lastHealthReport.healthy||console.warn(`[HNSW-Health] Index "${this.indexName}" health check failed: ${this.lastHealthReport.alerts.length} alert(s). Coherence: ${this.lastHealthReport.metrics.coherenceScore.toFixed(3)}`)}catch(e){console.warn(`[HNSW-Health] Health check error for "${this.indexName}":`,e)}}ensureHealthMonitor(){if(!this.healthMonitorLoaded){this.healthMonitorLoaded=!0;try{let e=(ne(),$(re));this.healthMonitor=e.createHnswHealthMonitor()}catch(e){process.env.DEBUG&&console.debug("[HNSW-Health] Monitor module unavailable:",e instanceof Error?e.message:e),this.healthMonitor=null}}}static createBackend(e){if(j())try{return{backend:new w(e),isNative:!0}}catch(r){r instanceof b?console.info(`[HNSW] Native backend unavailable, falling back to JS: ${r.message}`):console.warn("[HNSW] Unexpected error creating native backend, falling back to JS:",r)}return{backend:new S(e),isNative:!1}}static create(e,r){let t=p.get(e);if(t instanceof i)return t;let n=new i(e,r);return p.set(e,n),n}static get(e){let r=p.get(e);return r instanceof i?r:void 0}static close(e){let r=p.get(e);r instanceof i&&r.dispose(),p.delete(e)}static closeAll(){for(let[e]of p)i.close(e);p.clear()}static listIndexes(){return Array.from(p.keys())}}});export{G as a,ye as b,xe as c};
|
|
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.8");process.exit(0)}
|
|
2
|
+
import{a as ie,b as ae}from"./chunk-OZDRAKFF.js";import{S as oe,i as j,p as q}from"./chunk-HE3KLHNO.js";import{c as g,e as D,g as $}from"./chunk-SDGRU6SG.js";var I,E=g(()=>{"use strict";I={dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}});function se(){if(z)return A!==null;try{let i=(ae(),$(ie));if(A=i.differentiableSearch,P=i.init,P)try{P()}catch{}return z=!0,!0}catch{return z=!0,!1}}function B(i){let e=0;for(let r=0;r<i.length;r++)e+=i[r]*i[r];return Math.sqrt(e)}function ce(i,e,r,t){let n=r*t;if(n===0)return 0;let a=0,o=Math.min(i.length,e.length);for(let c=0;c<o;c++)a+=i[c]*e[c];return a/n}function U(i,e){let r=0,t=Math.min(i.length,e.length);for(let n=0;n<t;n++){let a=i[n]-e[n];r+=a*a}return Math.sqrt(r)}function le(i,e){if(i.length===e)return i;let r=new Float32Array(e);if(i.length>e){let t=i.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*t),o=Math.floor((n+1)*t),c=0;for(let s=a;s<o;s++)c+=i[s];r[n]=c/(o-a)}}else for(let t=0;t<i.length;t++)r[t]=i[t];return r}var A,P,z,S,O=g(()=>{"use strict";E();A=null,P=null,z=!1;S=class{config;entries=[];idToIndex=new Map;hasRuvector=!1;loaded=!1;constructor(e){this.config={...I,...e}}ensureLoaded(){this.loaded||(this.hasRuvector=se(),this.loaded=!0)}normalizeVector(e){return e.length===this.config.dimensions?e:le(e,this.config.dimensions)}add(e,r,t){this.ensureLoaded();let n=this.normalizeVector(r),a=B(n);if(this.idToIndex.has(e)){let c=this.idToIndex.get(e);this.entries[c]={id:e,vector:n,norm:a,metadata:t};return}let o=this.entries.length;this.entries.push({id:e,vector:n,norm:a,metadata:t}),this.idToIndex.set(e,o)}search(e,r){if(this.ensureLoaded(),this.entries.length===0)return[];let t=this.normalizeVector(e),n=B(t),a=Math.min(r,this.entries.length),o=this.entries.length>0?this.entries[0].vector.length:0,c=t.length===o;if(this.config.metric==="cosine")return this.bruteForcSearch(t,n,a);if(this.hasRuvector&&c&&A)try{let s=this.entries.map(u=>u.vector),l=A(t,s,a,1).indices.map(u=>{let h=this.entries[u],m=-U(t,h.vector);return{id:h.id,score:m,metadata:h.metadata}});return l.sort((u,h)=>h.score-u.score),l}catch{}return this.bruteForcSearch(t,n,a)}bruteForcSearch(e,r,t){let n=[];for(let a of this.entries){let o;this.config.metric==="cosine"?o=ce(e,a.vector,r,a.norm):o=-U(e,a.vector),n.push({id:a.id,score:o,metadata:a.metadata})}return n.sort((a,o)=>o.score-a.score),n.slice(0,t)}remove(e){let r=this.idToIndex.get(e);if(r===void 0)return!1;let t=this.entries.length-1;if(r!==t){let n=this.entries[t];this.entries[r]=n,this.idToIndex.set(n.id,r)}return this.entries.pop(),this.idToIndex.delete(e),!0}size(){return this.entries.length}dimensions(){return this.config.dimensions}recall(){return this.hasRuvector,1}isRuvectorAvailable(){return this.ensureLoaded(),this.hasRuvector}getConfig(){return{...this.config}}clear(){this.entries=[],this.idToIndex.clear()}dispose(){this.clear()}}});import{createRequire as he}from"module";function de(){if(K){if(k)return k;throw new b(J??"Unknown load error")}K=!0;try{let i=ue("hnswlib-node");if(!i.HierarchicalNSW)throw new Error("hnswlib-node module missing HierarchicalNSW export");return k=i,k}catch(i){let e=i instanceof Error?i.message:String(i);throw J=e,new b(e)}}function me(i,e){if(i.length===e)return i;let r=new Float32Array(e);if(i.length>e){let t=i.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*t),o=Math.floor((n+1)*t),c=0;for(let s=a;s<o;s++)c+=i[s];r[n]=c/(o-a)}}else for(let t=0;t<i.length;t++)r[t]=i[t];return r}function Q(i){let e=new Array(i.length);for(let r=0;r<i.length;r++)e[r]=i[r];return e}var ue,b,k,K,J,X,w,Y=g(()=>{"use strict";E();ue=he(import.meta.url),b=class extends Error{constructor(e){super(`Native HNSW backend unavailable: ${e}`),this.name="NativeHnswUnavailableError"}},k=null,K=!1,J=null;X=1e4,w=class{config;nativeIndex=null;currentMaxElements=X;liveIds=new Set;metadataStore=new Map;_metrics={totalSearches:0,totalAdds:0,totalRemoves:0,avgSearchLatencyMs:0,maxSearchLatencyMs:0,lastSearchLatencyMs:0,fallbackSearchCount:0,bruteForceSearchCount:0,nativeSearchCount:0,fallbackRate:0,allSearchesBruteForce:!1};constructor(e){this.config={...I,...e},this.nativeIndex=this.createFreshIndex()}createFreshIndex(){let e=de(),r=this.config.metric==="euclidean"?"l2":"cosine";try{let t=new e.HierarchicalNSW(r,this.config.dimensions);return t.initIndex(this.currentMaxElements,this.config.M,this.config.efConstruction,100,!0),t.setEf(this.config.efSearch),t}catch(t){let n=t instanceof Error?t.message:String(t);throw new b(`HierarchicalNSW init failed: ${n}`)}}add(e,r,t){if(!this.nativeIndex)throw new Error("NativeHnswBackend has been disposed");let n=this.normalizeVector(r);if(!this.liveIds.has(e)&&this.liveIds.size>=this.currentMaxElements){let a=this.currentMaxElements*2;this.nativeIndex.resizeIndex(a),this.currentMaxElements=a}this.nativeIndex.addPoint(Q(n),e,!0),this.liveIds.add(e),t?this.metadataStore.set(e,t):this.metadataStore.delete(e),this._metrics.totalAdds++}search(e,r){if(!this.nativeIndex)throw new Error("NativeHnswBackend has been disposed");if(this.liveIds.size===0||r<=0)return[];let t=performance.now(),n=this.normalizeVector(e),a=Math.min(r,this.liveIds.size),o=Math.min(a*2,this.liveIds.size),c=this.nativeIndex.searchKnn(Q(n),o),s=this.config.metric==="cosine",d=new Map;for(let h=0;h<c.neighbors.length;h++){let m=c.neighbors[h];if(!this.liveIds.has(m))continue;let x=c.distances[h],f=s?1-x:-x,W=d.get(m);(W===void 0||f>W.score)&&d.set(m,{id:m,score:f,metadata:this.metadataStore.get(m)})}let l=Array.from(d.values());l.sort((h,m)=>m.score-h.score),l.length>a&&(l.length=a);let u=performance.now()-t;return this.updateSearchMetrics(u),this._metrics.nativeSearchCount=this._metrics.totalSearches,u>50&&console.warn(`[NativeHNSW] search took ${u.toFixed(1)}ms (k=${r}, results=${l.length})`),l}remove(e){if(!this.nativeIndex||!this.liveIds.has(e))return!1;try{this.nativeIndex.markDelete(e)}catch{return!1}return this.liveIds.delete(e),this.metadataStore.delete(e),this._metrics.totalRemoves++,!0}size(){return this.liveIds.size}dimensions(){return this.config.dimensions}recall(){return .99}getMetrics(){return{...this._metrics}}get lastSearchLatencyMs(){return this._metrics.lastSearchLatencyMs}getConfig(){return{...this.config}}clear(){this.nativeIndex&&(this.liveIds.clear(),this.metadataStore.clear(),this.currentMaxElements=X,this.nativeIndex=this.createFreshIndex())}dispose(){this.liveIds.clear(),this.metadataStore.clear(),this.nativeIndex=null}isNativeAvailable(){return this.nativeIndex!==null}normalizeVector(e){return e.length===this.config.dimensions?e:me(e,this.config.dimensions)}updateSearchMetrics(e){this._metrics.totalSearches++,this._metrics.lastSearchLatencyMs=e,e>this._metrics.maxSearchLatencyMs&&(this._metrics.maxSearchLatencyMs=e);let r=this._metrics.totalSearches;this._metrics.avgSearchLatencyMs=this._metrics.avgSearchLatencyMs*((r-1)/r)+e/r}}});function Z(i,e){let r=Array.from({length:e},()=>new Float64Array(e));for(let t=0;t<e;t++){let n=i[t].length;r[t][t]=n;for(let a of i[t])r[t][a]=-1}return r}function N(i,e){let r=e.length,t=new Float64Array(r);for(let n=0;n<r;n++){let a=i[n].length;t[n]=a*e[n];for(let o of i[n])t[n]-=e[o]}return t}function H(i){let e=0;for(let r=0;r<i.length;r++)e+=i[r]*i[r];return Math.sqrt(e)}function R(i){let e=H(i);if(e>0)for(let r=0;r<i.length;r++)i[r]/=e}function v(i,e){let r=0;for(let t=0;t<i.length;t++)r+=i[t]*e[t];for(let t=0;t<i.length;t++)i[t]-=r*e[t]}function y(i,e,r=100,t=1e-6){if(e<=1)return 0;if(e===2)return i[0].includes(1)?2:0;let n=new Float64Array(e).fill(1/Math.sqrt(e)),a=new Float64Array(e);for(let l=0;l<e;l++)a[l]=Math.random()-.5;v(a,n),R(a);let o=0;for(let l=0;l<30;l++){let u=N(i,a);if(v(u,n),o=H(u),o>0)for(let h=0;h<e;h++)a[h]=u[h]/o}if(o<t)return 0;let c=new Float64Array(e);for(let l=0;l<e;l++)c[l]=Math.random()-.5;v(c,n),R(c);let s=0;for(let l=0;l<r;l++){let u=N(i,c),h=new Float64Array(e);for(let f=0;f<e;f++)h[f]=o*c[f]-u[f];v(h,n);let m=H(h);if(m<t)break;let x=m;for(let f=0;f<e;f++)c[f]=h[f]/m;if(Math.abs(x-s)<t)break;s=x}let d=o-s;return Math.max(0,d)}function F(i,e,r=100,t=1e-6){return y(i,e,r,t)}function C(i,e,r=50,t){if(e<=1)return 0;let n=t??y(i,e);if(n<1e-10)return 1/0;let o=2*Math.max(...i.map(d=>d.length),1),s=2*(Math.log(o/n)/(o-n));return Math.max(0,s)}function M(i,e,r){let t=1-Math.exp(-i/.05),n=1-Math.exp(-e/.5),a=r===1/0?0:1/(1+r/5),o=.4*t+.3*n+.3*a;return Math.max(0,Math.min(1,o))}var _=g(()=>{"use strict"});var re={};D(re,{ALERT_THRESHOLDS:()=>fe,DEFAULT_HNSW_HEALTH_CONFIG:()=>ee,HnswHealthMonitor:()=>L,_resetNativeLoader:()=>be,approximateFiedlerValue:()=>y,approximateSpectralGap:()=>F,buildAdjacencyFromIndex:()=>te,buildLaplacian:()=>Z,computeCoherenceScore:()=>M,createHnswHealthMonitor:()=>ge,deflateVector:()=>v,estimateEffectiveResistance:()=>C,laplacianMultiply:()=>N,normalizeInPlace:()=>R,vectorNorm:()=>H});function pe(){return V?T:(V=!0,T=null,null)}function be(){T=null,V=!1}function te(i,e=16,r){let t=i.size();if(t===0)return{adjacency:[],nodeCount:0,adjacencySource:"approximate"};let n=Array.from({length:t},()=>[]),a=Math.min(e,t-1);if(a===0)return{adjacency:n,nodeCount:t,adjacencySource:"approximate"};if(r&&r.size>0){let o=Array.from(r.keys()).slice(0,t),c=new Map;for(let s=0;s<o.length;s++)c.set(o[s],s);for(let s=0;s<o.length;s++){let d=r.get(o[s]);if(!d)continue;let l=i.search(d,a+1);for(let u of l){if(u.id===o[s])continue;let h=c.get(u.id);h!==void 0&&(n[s].includes(h)||n[s].push(h),n[h].includes(s)||n[h].push(s))}}return{adjacency:n,nodeCount:t,adjacencySource:"actual-search"}}console.warn("[HnswHealthMonitor] No stored vectors provided \u2014 using approximate circular adjacency. Pass stored vectors for accurate health metrics.");for(let o=0;o<t;o++)for(let c=0;c<a;c++){let s=(o+c+1)%t;n[o].includes(s)||n[o].push(s),n[s].includes(o)||n[s].push(o)}return{adjacency:n,nodeCount:t,adjacencySource:"approximate"}}function ge(i){return new L(i)}var ee,fe,T,V,L,ne=g(()=>{"use strict";_();_();ee={fiedlerThreshold:.01,spectralGapThreshold:.1,resistanceThreshold:10,coherenceThreshold:.3,maxPowerIterations:100,convergenceTolerance:1e-6,resistanceSampleSize:50,maxHistoryEntries:200,minIndexSize:3},fe={FragileIndex:.01,PoorExpansion:.1,HighResistance:10,LowCoherence:.3},T=null,V=!1;L=class{config;alerts=[];history=[];lastReport=null;useNative=!1;nativeChecked=!1;constructor(e){this.config={...ee,...e}}checkHealth(e){let r=performance.now(),t=e.size();if(t<this.config.minIndexSize)return this.createSmallIndexReport(t,performance.now()-r);this.nativeChecked||(this.nativeChecked=!0,this.useNative=pe()!==null);let{adjacency:n,nodeCount:a,adjacencySource:o}=te(e),c=this.useNative?this.computeNativeMetrics(n):this.computeApproximateMetrics(n,a),s=this.generateAlerts(c);this.alerts.length=0,this.alerts.push(...s);let d=performance.now()-r,l={healthy:s.length===0,metrics:c,alerts:s,indexSize:t,usedNativeBackend:this.useNative,adjacencySource:o,checkDurationMs:d,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:c.coherenceScore,fiedlerValue:c.fiedlerValue,indexSize:t,healthy:l.healthy,timestamp:l.checkedAt}),this.lastReport=l,l}getAlerts(){return[...this.alerts]}getMetricsHistory(e){let r=[...this.history];return e!==void 0&&e<r.length?r.slice(-e):r}isHealthy(){return this.lastReport===null?!0:this.lastReport.healthy}getLastReport(){return this.lastReport}clearHistory(){this.history.length=0,this.alerts.length=0,this.lastReport=null}computeNativeMetrics(e){let r=T,t=r.computeFiedlerValue(e),n=r.computeSpectralGap(e),a=r.computeEffectiveResistance(e),o=M(t,n,a);return{fiedlerValue:t,spectralGap:n,effectiveResistance:a,coherenceScore:o}}computeApproximateMetrics(e,r){let t=y(e,r,this.config.maxPowerIterations,this.config.convergenceTolerance),n=F(e,r,this.config.maxPowerIterations,this.config.convergenceTolerance),a=C(e,r,this.config.resistanceSampleSize,t),o=M(t,n,a);return{fiedlerValue:t,spectralGap:n,effectiveResistance:a,coherenceScore:o}}generateAlerts(e){let r=[],t=new Date;return e.fiedlerValue<this.config.fiedlerThreshold&&r.push({type:"FragileIndex",message:`Fiedler value ${e.fiedlerValue.toFixed(6)} is below threshold ${this.config.fiedlerThreshold}. The index graph has weak algebraic connectivity.`,value:e.fiedlerValue,threshold:this.config.fiedlerThreshold,timestamp:t}),e.spectralGap<this.config.spectralGapThreshold&&r.push({type:"PoorExpansion",message:`Spectral gap ${e.spectralGap.toFixed(6)} is below threshold ${this.config.spectralGapThreshold}. The index graph has poor expansion properties.`,value:e.spectralGap,threshold:this.config.spectralGapThreshold,timestamp:t}),e.effectiveResistance>this.config.resistanceThreshold&&r.push({type:"HighResistance",message:`Average effective resistance ${e.effectiveResistance.toFixed(4)} exceeds threshold ${this.config.resistanceThreshold}. Nodes are poorly connected.`,value:e.effectiveResistance,threshold:this.config.resistanceThreshold,timestamp:t}),e.coherenceScore<this.config.coherenceThreshold&&r.push({type:"LowCoherence",message:`Coherence score ${e.coherenceScore.toFixed(4)} is below threshold ${this.config.coherenceThreshold}. Overall index health is degraded.`,value:e.coherenceScore,threshold:this.config.coherenceThreshold,timestamp:t}),r}createSmallIndexReport(e,r){let t={fiedlerValue:e>0?1:0,spectralGap:e>0?1:0,effectiveResistance:e>0?.5:0,coherenceScore:e>0?1:0},n={healthy:!0,metrics:t,alerts:[],indexSize:e,usedNativeBackend:!1,adjacencySource:"approximate",checkDurationMs:r,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:t.coherenceScore,fiedlerValue:t.fiedlerValue,indexSize:e,healthy:!0,timestamp:n.checkedAt}),this.lastReport=n,n}addHistoryPoint(e){this.history.push(e),this.history.length>this.config.maxHistoryEntries&&this.history.splice(0,this.history.length-this.config.maxHistoryEntries)}}});var ye={};D(ye,{HnswAdapter:()=>G});var ve,p,G,xe=g(()=>{O();Y();oe();ve={patterns:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},"qe-memory":{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},learning:{dimensions:384,M:16,efConstruction:200,efSearch:50,metric:"cosine"},coverage:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}},p=new Map,G=class i{backend;_isNativeBackend;indexName;stringToNumericId=new Map;numericToStringId=new Map;nextAutoId=0;healthMonitor=null;healthMonitorLoaded=!1;operationsSinceLastCheck=0;healthCheckFrequency=100;lastHealthReport=null;constructor(e,r){this.indexName=e;let n={...ve[e]??{},...r},{backend:a,isNative:o}=i.createBackend(n);this.backend=a,this._isNativeBackend=o}add(e,r,t){this.backend.add(e,r,t),this.maybeRunHealthCheck()}search(e,r){let t=performance.now(),n=this.backend.search(e,r),a=performance.now()-t;return a>50&&console.warn(`[HNSW] search took ${a.toFixed(1)}ms (k=${r}, results=${n.length})`),this._lastSearchLatencyMs=a,n}_lastSearchLatencyMs=0;get lastSearchLatencyMs(){return this._lastSearchLatencyMs}remove(e){return this.backend.remove(e)}size(){return this.backend.size()}dimensions(){return this.backend.dimensions()}recall(){return this.backend.recall()}addByStringId(e,r){let t=this.stringToNumericId.get(e);t!==void 0?this.backend.remove(t):(t=this.nextAutoId++,this.stringToNumericId.set(e,t),this.numericToStringId.set(t,e)),this.backend.add(t,new Float32Array(r))}searchByArray(e,r){return this.backend.search(new Float32Array(e),r).map(n=>({id:this.numericToStringId.get(n.id)??String(n.id),score:n.score}))}removeByStringId(e){let r=this.stringToNumericId.get(e);if(r===void 0)return!1;let t=this.backend.remove(r);return t&&(this.stringToNumericId.delete(e),this.numericToStringId.delete(r)),t}clear(){this.backend.clear?.(),this.stringToNumericId.clear(),this.numericToStringId.clear(),this.nextAutoId=0}dispose(){try{this.backend.dispose?.()}catch{}this.stringToNumericId.clear(),this.numericToStringId.clear(),this.nextAutoId=0}isRuvectorAvailable(){return this.backend instanceof S?this.backend.isRuvectorAvailable():this.backend instanceof w?this.backend.isNativeAvailable():!1}isNativeBackend(){return this._isNativeBackend}getName(){return this.indexName}setHealthCheckFrequency(e){this.healthCheckFrequency=Math.max(1,e)}getHealthCheckFrequency(){return this.healthCheckFrequency}getLastHealthReport(){return this.lastHealthReport}getHealthMonitor(){return this.healthMonitor}maybeRunHealthCheck(){if(q()&&(this.operationsSinceLastCheck++,!(this.operationsSinceLastCheck<this.healthCheckFrequency)&&(this.operationsSinceLastCheck=0,this.ensureHealthMonitor(),this.healthMonitor)))try{this.lastHealthReport=this.healthMonitor.checkHealth(this.backend),this.lastHealthReport.healthy||console.warn(`[HNSW-Health] Index "${this.indexName}" health check failed: ${this.lastHealthReport.alerts.length} alert(s). Coherence: ${this.lastHealthReport.metrics.coherenceScore.toFixed(3)}`)}catch(e){console.warn(`[HNSW-Health] Health check error for "${this.indexName}":`,e)}}ensureHealthMonitor(){if(!this.healthMonitorLoaded){this.healthMonitorLoaded=!0;try{let e=(ne(),$(re));this.healthMonitor=e.createHnswHealthMonitor()}catch(e){process.env.DEBUG&&console.debug("[HNSW-Health] Monitor module unavailable:",e instanceof Error?e.message:e),this.healthMonitor=null}}}static createBackend(e){if(j())try{return{backend:new w(e),isNative:!0}}catch(r){r instanceof b?console.info(`[HNSW] Native backend unavailable, falling back to JS: ${r.message}`):console.warn("[HNSW] Unexpected error creating native backend, falling back to JS:",r)}return{backend:new S(e),isNative:!1}}static create(e,r){let t=p.get(e);if(t instanceof i)return t;let n=new i(e,r);return p.set(e,n),n}static get(e){let r=p.get(e);return r instanceof i?r:void 0}static close(e){let r=p.get(e);r instanceof i&&r.dispose(),p.delete(e)}static closeAll(){for(let[e]of p)i.close(e);p.clear()}static listIndexes(){return Array.from(p.keys())}}});export{G as a,ye as b,xe as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
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.8");process.exit(0)}
|
|
2
2
|
var n=class{constructor(t){this.capacity=t;this.buffer=new Array(t)}capacity;buffer;head=0;tail=0;count=0;push(t){this.buffer[this.tail]=t,this.tail=(this.tail+1)%this.capacity,this.count<this.capacity?this.count++:this.head=(this.head+1)%this.capacity}toArray(){let t=[];for(let e=0;e<this.count;e++){let i=(this.head+e)%this.capacity;t.push(this.buffer[i])}return t}get length(){return this.count}get size(){return this.count}clear(){this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this.count=0}last(t){let e=[],i=Math.max(0,this.count-t);for(let s=i;s<this.count;s++){let r=(this.head+s)%this.capacity;e.push(this.buffer[r])}return e}percentile(t){if(this.count===0)return;let e=this.toArray().sort((s,r)=>Number(s)-Number(r)),i=Math.floor(t/100*(e.length-1));return e[i]}reduce(t,e){let i=e;for(let s=0;s<this.count;s++){let r=(this.head+s)%this.capacity;i=t(i,this.buffer[r])}return i}average(){return this.count===0?0:this.reduce((e,i)=>e+i,0)/this.count}};export{n as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
2
|
-
import{d as G,f as we}from"./chunk-
|
|
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.8");process.exit(0)}
|
|
2
|
+
import{d as G,f as we}from"./chunk-2RDWYJJY.js";import{a as ye}from"./chunk-2B2RLPK3.js";import{c as J}from"./chunk-G73PIM7X.js";import{a as q,b,c as Fe}from"./chunk-NOP5ZJ7E.js";import{b as L,d as ee}from"./chunk-DDMKCHYT.js";import{a as k,c as Ue}from"./chunk-R2LWUBET.js";import{a as Q,c as ve}from"./chunk-MTWBYHMS.js";import{a as Z,b as Xe}from"./chunk-4OHLPG6B.js";import{a as te,d as v,e as ne,f as re}from"./chunk-MSWBVPVQ.js";import{a as O,e as De}from"./chunk-GXKCRIHK.js";import{c as R,e as be}from"./chunk-SDGRU6SG.js";function I(i){if(!z.has(i))throw new Error(`Invalid table name: "${i}" is not in the allowlist`);return i}function Be(i){let e=i.split(".");if(e.length>2)throw new Error(`Invalid SQL identifier: "${i}" has too many parts (max: schema.table)`);for(let t of e)if(!se.test(t))throw new Error(`Invalid SQL identifier: "${i}" \u2014 part "${t}" does not match pattern ${se}`);return i}var z,se,j=R(()=>{"use strict";z=new Set(["schema_version","kv_store","vectors","rl_q_values","goap_goals","goap_actions","goap_plans","goap_plan_signatures","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","sona_patterns","sona_fisher_matrices","test_outcomes","routing_outcomes","coverage_sessions","patterns","hypergraph_nodes","hypergraph_edges","hypergraph_vertices","hypergraph_hyperedges","hypergraph_edge_vertices","hypergraph_vertex_properties","hypergraph_edge_properties","captured_experiences","experience_applications","witness_chain","witness_chain_receipts","witness_chain_archive","trajectories","trajectory_steps","pattern_evolution_events","pattern_relationships","pattern_versions","learning_daily_snapshots","metrics_outcomes","experience_consolidation_log","qe_pattern_reuse","qe_agent_co_execution"]);se=/^[a-z_][a-z0-9_]{0,62}$/});var D,oe,ie,ae,ce,Te,Ee,de,ue,le,pe,ge,me=R(()=>{"use strict";we();Ue();D=10,oe=`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS schema_version (
|
|
4
4
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
5
5
|
version INTEGER NOT NULL,
|
|
@@ -551,16 +551,16 @@ import{d as G,f as we}from"./chunk-4MJQJQLY.js";import{a as ye}from"./chunk-DF7V
|
|
|
551
551
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_technique ON coverage_sessions(technique);
|
|
552
552
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_agent ON coverage_sessions(agent_id);
|
|
553
553
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_created ON coverage_sessions(created_at);
|
|
554
|
-
`,ge=["kv_store","vectors","rl_q_values","goap_actions","goap_goals","goap_plans","goap_plan_signatures","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","hypergraph_nodes","hypergraph_edges","sona_patterns","witness_chain"]});function y(i,e,t){let n={value:e,timestamp:t??(e!==void 0?Date.now():0),nodeId:e!==void 0?i:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function E(o,c,u,d){return o!==u?o-u:c.localeCompare(d)}return{get(){return n.value},set(o,c){let u=c??Date.now();(n.timestamp===0||E(u,i,n.timestamp,n.nodeId)>0)&&(n={value:o,timestamp:u,nodeId:i,version:n.version+1,lastUpdated:Date.now()})},merge(o){let c=o.getState();this.applyState(c)},getState(){return{value:n.value,timestamp:n.timestamp,nodeId:n.nodeId,version:n.version,lastUpdated:n.lastUpdated}},applyState(o){(n.timestamp===0||E(o.timestamp,o.nodeId,n.timestamp,n.nodeId)>0)&&(n={value:o.value,timestamp:o.timestamp,nodeId:o.nodeId,version:Math.max(n.version,o.version)+1,lastUpdated:Date.now()})},getNodeId(){return i},getTimestamp(){return n.timestamp}}}function X(i,e){let t=y(i);return t.applyState(e),t}var B=R(()=>{"use strict"});function C(i){let e={counts:{},version:0,lastUpdated:Date.now()};return e.counts[i]=0,{get(){return Object.values(e.counts).reduce((t,n)=>t+n,0)},increment(t=1){if(t<0)throw new Error("G-Counter can only increment by positive values");t!==0&&(e.counts[i]=(e.counts[i]||0)+t,e.version++,e.lastUpdated=Date.now())},merge(t){let n=t.getState();this.applyState(n)},getState(){return{counts:{...e.counts},version:e.version,lastUpdated:e.lastUpdated}},applyState(t){let n=!1;for(let[E,o]of Object.entries(t.counts)){let c=e.counts[E]||0;o>c&&(e.counts[E]=o,n=!0)}n&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return i},getLocalCount(){return e.counts[i]||0}}}function w(i,e){let t=C(i);return t.applyState(e),t}var U=R(()=>{"use strict"});function F(i){let e=C(i),t=C(i),n=0,E=Date.now();return{get(){return e.get()-t.get()},increment(o=1){if(o<0)throw new Error("Use decrement() for negative values");o!==0&&(e.increment(o),n++,E=Date.now())},decrement(o=1){if(o<0)throw new Error("Use increment() for negative values");o!==0&&(t.increment(o),n++,E=Date.now())},merge(o){let c=o.getState();this.applyState(c)},getState(){return{positive:e.getState(),negative:t.getState(),version:n,lastUpdated:E}},applyState(o){let c=this.get();e.applyState(o.positive),t.applyState(o.negative);let u=this.get();c!==u&&(n=Math.max(n,o.version)+1,E=Date.now())},getNodeId(){return i}}}function x(i,e){let t=F(i);return t.applyState(e),t}var W=R(()=>{"use strict";U()});function xe(i,e){return`${i}:${Date.now()}:${e}`}function Y(i){return typeof i=="string"?`s:${i}`:typeof i=="number"?`n:${i}`:typeof i=="boolean"?`b:${i}`:`j:${JSON.stringify(i)}`}function Me(i){let e=i.substring(0,2),t=i.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return L(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function M(i){let e=new Map,t=new Map,n=0,E=Date.now(),o=0;function c(d){let T=e.get(d);if(!T||T.size===0)return!1;let l=t.get(d);if(!l||l.size===0)return!0;for(let g of T)if(!l.has(g))return!0;return!1}function u(d){let T=e.get(d);if(!T)return new Set;let l=t.get(d)||new Set,g=new Set;for(let p of T)l.has(p)||g.add(p);return g}return{has(d){let T=Y(d);return c(T)},values(){let d=[];for(let[T]of e)c(T)&&d.push(Me(T));return d},size(){let d=0;for(let[T]of e)c(T)&&d++;return d},add(d){let T=Y(d),l=xe(i,o++);e.has(T)||e.set(T,new Set),e.get(T).add(l),n++,E=Date.now()},remove(d){let T=Y(d),l=e.get(T);if(!l||l.size===0)return;t.has(T)||t.set(T,new Set);let g=t.get(T);for(let p of l)g.add(p);n++,E=Date.now()},merge(d){let T=d.getState();this.applyState(T)},getState(){let d={};for(let[l,g]of e)d[l]=Array.from(g);let T={};for(let[l,g]of t)g.size>0&&(T[l]=Array.from(g));return{elements:d,tombstones:T,version:n,lastUpdated:E}},applyState(d){let T=!1;for(let[l,g]of Object.entries(d.elements)){e.has(l)||e.set(l,new Set);let p=e.get(l);for(let f of g)p.has(f)||(p.add(f),T=!0)}for(let[l,g]of Object.entries(d.tombstones)){t.has(l)||t.set(l,new Set);let p=t.get(l);for(let f of g)p.has(f)||(p.add(f),T=!0)}T&&(n=Math.max(n,d.version)+1,E=Date.now())},getNodeId(){return i},clear(){for(let[d,T]of e){t.has(d)||t.set(d,new Set);let l=t.get(d);for(let g of T)l.add(g)}n++,E=Date.now()}}}function P(i,e){let t=M(i);return t.applyState(e),t}var H=R(()=>{"use strict";ee()});function $(i){let e={...Pe,...i},{nodeId:t,enableDeltaTracking:n,maxDeltaHistory:E}=e,o=new Map,c=new Map,u=new Map,d=new Map,T=0,l=[],g=new Set,p={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function f(s,r,a){let _={key:s,type:r,operation:a,timestamp:Date.now(),nodeId:t};for(let Ae of g)try{Ae(_)}catch(Oe){console.error("[CRDTStore] Error in change listener:",Oe)}}function N(s,r){T++,n&&p[s].add(r)}function V(){if(!n||!(p.registers.size>0||p.gCounters.size>0||p.pnCounters.size>0||p.sets.size>0))return;let r={fromVersion:l.length>0?l[l.length-1].toVersion:0,toVersion:T,timestamp:Date.now(),nodeId:t};if(p.registers.size>0){r.registers={};for(let a of p.registers){let _=o.get(a);_&&(r.registers[a]=_.getState())}p.registers.clear()}if(p.gCounters.size>0){r.gCounters={};for(let a of p.gCounters){let _=c.get(a);_&&(r.gCounters[a]=_.getState())}p.gCounters.clear()}if(p.pnCounters.size>0){r.pnCounters={};for(let a of p.pnCounters){let _=u.get(a);_&&(r.pnCounters[a]=_.getState())}p.pnCounters.clear()}if(p.sets.size>0){r.sets={};for(let a of p.sets){let _=d.get(a);_&&(r.sets[a]=_.getState())}p.sets.clear()}for(l.push(r);l.length>E;)l.shift()}let h={getRegister(s){return o.has(s)||o.set(s,y(t)),o.get(s)},setRegister(s,r){h.getRegister(s).set(r),N("registers",s),f(s,"lww-register","set")},hasRegister(s){return o.has(s)},deleteRegister(s){let r=o.delete(s);return r&&N("registers",s),r},getGCounter(s){return c.has(s)||c.set(s,C(t)),c.get(s)},incrementGCounter(s,r){h.getGCounter(s).increment(r),N("gCounters",s),f(s,"g-counter","increment")},hasGCounter(s){return c.has(s)},deleteGCounter(s){let r=c.delete(s);return r&&N("gCounters",s),r},getCounter(s){return u.has(s)||u.set(s,F(t)),u.get(s)},incrementCounter(s,r){h.getCounter(s).increment(r),N("pnCounters",s),f(s,"pn-counter","increment")},decrementCounter(s,r){h.getCounter(s).decrement(r),N("pnCounters",s),f(s,"pn-counter","decrement")},hasCounter(s){return u.has(s)},deleteCounter(s){let r=u.delete(s);return r&&N("pnCounters",s),r},getSet(s){return d.has(s)||d.set(s,M(t)),d.get(s)},addToSet(s,r){h.getSet(s).add(r),N("sets",s),f(s,"or-set","add")},removeFromSet(s,r){h.getSet(s).remove(r),N("sets",s),f(s,"or-set","remove")},hasSet(s){return d.has(s)},deleteSet(s){let r=d.delete(s);return r&&N("sets",s),r},merge(s){let r=s.getState();h.applyState(r)},getState(){V();let s={version:T,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[r,a]of o)s.registers[r]=a.getState();for(let[r,a]of c)s.gCounters[r]=a.getState();for(let[r,a]of u)s.pnCounters[r]=a.getState();for(let[r,a]of d)s.sets[r]=a.getState();return s},applyState(s){for(let[r,a]of Object.entries(s.registers))o.has(r)?o.get(r).applyState(a):o.set(r,X(t,a)),N("registers",r),f(r,"lww-register","merge");for(let[r,a]of Object.entries(s.gCounters))c.has(r)?c.get(r).applyState(a):c.set(r,w(t,a)),N("gCounters",r),f(r,"g-counter","merge");for(let[r,a]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(a):u.set(r,x(t,a)),N("pnCounters",r),f(r,"pn-counter","merge");for(let[r,a]of Object.entries(s.sets))d.has(r)?d.get(r).applyState(a):d.set(r,P(t,a)),N("sets",r),f(r,"or-set","merge");T=Math.max(T,s.version)+1},getDelta(s){if(V(),l.length===0)return s>=T,null;let r=l.filter(_=>_.toVersion>s);if(r.length===0)return null;let a={fromVersion:s,toVersion:T,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let _ of r)_.registers&&Object.assign(a.registers,_.registers),_.gCounters&&Object.assign(a.gCounters,_.gCounters),_.pnCounters&&Object.assign(a.pnCounters,_.pnCounters),_.sets&&Object.assign(a.sets,_.sets);return Object.keys(a.registers).length===0&&delete a.registers,Object.keys(a.gCounters).length===0&&delete a.gCounters,Object.keys(a.pnCounters).length===0&&delete a.pnCounters,Object.keys(a.sets).length===0&&delete a.sets,a},applyDelta(s){if(s.registers)for(let[r,a]of Object.entries(s.registers))o.has(r)?o.get(r).applyState(a):o.set(r,X(t,a)),N("registers",r),f(r,"lww-register","merge");if(s.gCounters)for(let[r,a]of Object.entries(s.gCounters))c.has(r)?c.get(r).applyState(a):c.set(r,w(t,a)),N("gCounters",r),f(r,"g-counter","merge");if(s.pnCounters)for(let[r,a]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(a):u.set(r,x(t,a)),N("pnCounters",r),f(r,"pn-counter","merge");if(s.sets)for(let[r,a]of Object.entries(s.sets))d.has(r)?d.get(r).applyState(a):d.set(r,P(t,a)),N("sets",r),f(r,"or-set","merge");T=Math.max(T,s.toVersion)+1},getVersion(){return T},getNodeId(){return t},on(s,r){if(s==="change")return g.add(r),()=>{g.delete(r)};throw new Error(`Unknown event type: ${s}`)},removeAllListeners(){g.clear()},keys(s){let r=[];return(!s||s==="lww-register")&&r.push(...Array.from(o.keys())),(!s||s==="g-counter")&&r.push(...Array.from(c.keys())),(!s||s==="pn-counter")&&r.push(...Array.from(u.keys())),(!s||s==="or-set")&&r.push(...Array.from(d.keys())),r},clear(){o.clear(),c.clear(),u.clear(),d.clear(),l.length=0,p.registers.clear(),p.gCounters.clear(),p.pnCounters.clear(),p.sets.clear(),T=0},getStats(){return{total:o.size+c.size+u.size+d.size,registers:o.size,gCounters:c.size,pnCounters:u.size,sets:d.size,version:T,nodeId:t,deltaHistorySize:l.length}}};return h}var Pe,_e=R(()=>{"use strict";B();U();W();H();Pe={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var fe=R(()=>{"use strict"});var Ne=R(()=>{"use strict";B();U();W();H();_e();fe()});var ze={};be(ze,{ALLOWED_TABLE_NAMES:()=>z,BinaryHeap:()=>te,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>Le,UnifiedHnswIndex:()=>v,UnifiedMemoryManager:()=>A,clearProjectRootCache:()=>q,createHnswIndex:()=>ne,findProjectRoot:()=>b,getDefaultDbPath:()=>he,getResolvedDefaultConfig:()=>Ce,getUnifiedMemory:()=>Ie,initializeUnifiedMemory:()=>Ge,resetUnifiedMemory:()=>ke,validateTableName:()=>I});import*as m from"fs";import*as Re from"os";import*as S from"path";function he(){let i=b();return S.join(i,".agentic-qe","memory.db")}function Ce(){return{...Le,dbPath:he()}}function Ie(i){return A.getInstance(i)}async function Ge(i){let e=Ie(i);return await e.initialize(),e}function ke(){A.resetInstance()}function qe(){if(Se)return;Se=!0;let i=()=>{try{let e=A.instance;e&&e.close()}catch(e){console.debug("[UnifiedMemory] Cleanup error:",e instanceof Error?e.message:e)}};process.on("beforeExit",i),process.on("SIGINT",()=>{i(),process.exit(0)}),process.on("SIGTERM",()=>{i(),process.exit(0)})}var K,Le,A,Se,je=R(()=>{Xe();ee();ve();De();ye();j();j();re();re();me();Ne();Fe();K=J.create("unified-memory");Le={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:O.MMAP_SIZE_BYTES,cacheSize:O.CACHE_SIZE_KB,busyTimeout:O.BUSY_TIMEOUT_MS,vectorDimensions:O.DEFAULT_VECTOR_DIMENSIONS};A=class i{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;preparedStatements=new Map;vectorIndex=new v("qe-memory");crdtStore=null;constructor(e){let t=Ce();if(this.config={...t,...e},!S.isAbsolute(this.config.dbPath)){let n=b();this.config.dbPath=S.join(n,this.config.dbPath)}}static getInstance(e){return i.instance||(i.instance=new i(e)),i.instance}static async getInstanceAsync(e){return i.instance?.initialized?i.instance:(i.instancePromise||(i.instancePromise=(async()=>{let t=i.getInstance(e);return await t.initialize(),t})()),i.instancePromise)}static resetInstance(){i.instance&&(i.instance.close(),i.instance=null),i.instancePromise=null,q()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=process.env.AQE_PROJECT_ROOT;if(t){let c=S.resolve(this.config.dbPath),u=S.resolve(t);!c.startsWith(u)&&!c.startsWith(Re.tmpdir())&&c.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${t}". Redirecting to test-safe path.`),this.config.dbPath=S.join(t,".agentic-qe","memory.db"))}let n=S.dirname(this.config.dbPath);m.existsSync(n)||m.mkdirSync(n,{recursive:!0});let E=m.existsSync(this.config.dbPath),o=0;if(E)o=m.statSync(this.config.dbPath).size;else if(m.existsSync(n)){let c=this.findRecentBackups(n);if(c.length>0){let u=c[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
|
|
554
|
+
`,ge=["kv_store","vectors","rl_q_values","goap_actions","goap_goals","goap_plans","goap_plan_signatures","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","hypergraph_nodes","hypergraph_edges","sona_patterns","witness_chain"]});function y(i,e,t){let n={value:e,timestamp:t??(e!==void 0?Date.now():0),nodeId:e!==void 0?i:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function d(o,T,u,c){return o!==u?o-u:T.localeCompare(c)}return{get(){return n.value},set(o,T){let u=T??Date.now();(n.timestamp===0||d(u,i,n.timestamp,n.nodeId)>0)&&(n={value:o,timestamp:u,nodeId:i,version:n.version+1,lastUpdated:Date.now()})},merge(o){let T=o.getState();this.applyState(T)},getState(){return{value:n.value,timestamp:n.timestamp,nodeId:n.nodeId,version:n.version,lastUpdated:n.lastUpdated}},applyState(o){(n.timestamp===0||d(o.timestamp,o.nodeId,n.timestamp,n.nodeId)>0)&&(n={value:o.value,timestamp:o.timestamp,nodeId:o.nodeId,version:Math.max(n.version,o.version)+1,lastUpdated:Date.now()})},getNodeId(){return i},getTimestamp(){return n.timestamp}}}function X(i,e){let t=y(i);return t.applyState(e),t}var B=R(()=>{"use strict"});function C(i){let e={counts:{},version:0,lastUpdated:Date.now()};return e.counts[i]=0,{get(){return Object.values(e.counts).reduce((t,n)=>t+n,0)},increment(t=1){if(t<0)throw new Error("G-Counter can only increment by positive values");t!==0&&(e.counts[i]=(e.counts[i]||0)+t,e.version++,e.lastUpdated=Date.now())},merge(t){let n=t.getState();this.applyState(n)},getState(){return{counts:{...e.counts},version:e.version,lastUpdated:e.lastUpdated}},applyState(t){let n=!1;for(let[d,o]of Object.entries(t.counts)){let T=e.counts[d]||0;o>T&&(e.counts[d]=o,n=!0)}n&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return i},getLocalCount(){return e.counts[i]||0}}}function w(i,e){let t=C(i);return t.applyState(e),t}var U=R(()=>{"use strict"});function F(i){let e=C(i),t=C(i),n=0,d=Date.now();return{get(){return e.get()-t.get()},increment(o=1){if(o<0)throw new Error("Use decrement() for negative values");o!==0&&(e.increment(o),n++,d=Date.now())},decrement(o=1){if(o<0)throw new Error("Use increment() for negative values");o!==0&&(t.increment(o),n++,d=Date.now())},merge(o){let T=o.getState();this.applyState(T)},getState(){return{positive:e.getState(),negative:t.getState(),version:n,lastUpdated:d}},applyState(o){let T=this.get();e.applyState(o.positive),t.applyState(o.negative);let u=this.get();T!==u&&(n=Math.max(n,o.version)+1,d=Date.now())},getNodeId(){return i}}}function x(i,e){let t=F(i);return t.applyState(e),t}var W=R(()=>{"use strict";U()});function xe(i,e){return`${i}:${Date.now()}:${e}`}function Y(i){return typeof i=="string"?`s:${i}`:typeof i=="number"?`n:${i}`:typeof i=="boolean"?`b:${i}`:`j:${JSON.stringify(i)}`}function Me(i){let e=i.substring(0,2),t=i.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return L(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function M(i){let e=new Map,t=new Map,n=0,d=Date.now(),o=0;function T(c){let E=e.get(c);if(!E||E.size===0)return!1;let l=t.get(c);if(!l||l.size===0)return!0;for(let g of E)if(!l.has(g))return!0;return!1}function u(c){let E=e.get(c);if(!E)return new Set;let l=t.get(c)||new Set,g=new Set;for(let p of E)l.has(p)||g.add(p);return g}return{has(c){let E=Y(c);return T(E)},values(){let c=[];for(let[E]of e)T(E)&&c.push(Me(E));return c},size(){let c=0;for(let[E]of e)T(E)&&c++;return c},add(c){let E=Y(c),l=xe(i,o++);e.has(E)||e.set(E,new Set),e.get(E).add(l),n++,d=Date.now()},remove(c){let E=Y(c),l=e.get(E);if(!l||l.size===0)return;t.has(E)||t.set(E,new Set);let g=t.get(E);for(let p of l)g.add(p);n++,d=Date.now()},merge(c){let E=c.getState();this.applyState(E)},getState(){let c={};for(let[l,g]of e)c[l]=Array.from(g);let E={};for(let[l,g]of t)g.size>0&&(E[l]=Array.from(g));return{elements:c,tombstones:E,version:n,lastUpdated:d}},applyState(c){let E=!1;for(let[l,g]of Object.entries(c.elements)){e.has(l)||e.set(l,new Set);let p=e.get(l);for(let f of g)p.has(f)||(p.add(f),E=!0)}for(let[l,g]of Object.entries(c.tombstones)){t.has(l)||t.set(l,new Set);let p=t.get(l);for(let f of g)p.has(f)||(p.add(f),E=!0)}E&&(n=Math.max(n,c.version)+1,d=Date.now())},getNodeId(){return i},clear(){for(let[c,E]of e){t.has(c)||t.set(c,new Set);let l=t.get(c);for(let g of E)l.add(g)}n++,d=Date.now()}}}function P(i,e){let t=M(i);return t.applyState(e),t}var H=R(()=>{"use strict";ee()});function $(i){let e={...Pe,...i},{nodeId:t,enableDeltaTracking:n,maxDeltaHistory:d}=e,o=new Map,T=new Map,u=new Map,c=new Map,E=0,l=[],g=new Set,p={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function f(s,r,a){let _={key:s,type:r,operation:a,timestamp:Date.now(),nodeId:t};for(let Ae of g)try{Ae(_)}catch(Oe){console.error("[CRDTStore] Error in change listener:",Oe)}}function N(s,r){E++,n&&p[s].add(r)}function V(){if(!n||!(p.registers.size>0||p.gCounters.size>0||p.pnCounters.size>0||p.sets.size>0))return;let r={fromVersion:l.length>0?l[l.length-1].toVersion:0,toVersion:E,timestamp:Date.now(),nodeId:t};if(p.registers.size>0){r.registers={};for(let a of p.registers){let _=o.get(a);_&&(r.registers[a]=_.getState())}p.registers.clear()}if(p.gCounters.size>0){r.gCounters={};for(let a of p.gCounters){let _=T.get(a);_&&(r.gCounters[a]=_.getState())}p.gCounters.clear()}if(p.pnCounters.size>0){r.pnCounters={};for(let a of p.pnCounters){let _=u.get(a);_&&(r.pnCounters[a]=_.getState())}p.pnCounters.clear()}if(p.sets.size>0){r.sets={};for(let a of p.sets){let _=c.get(a);_&&(r.sets[a]=_.getState())}p.sets.clear()}for(l.push(r);l.length>d;)l.shift()}let h={getRegister(s){return o.has(s)||o.set(s,y(t)),o.get(s)},setRegister(s,r){h.getRegister(s).set(r),N("registers",s),f(s,"lww-register","set")},hasRegister(s){return o.has(s)},deleteRegister(s){let r=o.delete(s);return r&&N("registers",s),r},getGCounter(s){return T.has(s)||T.set(s,C(t)),T.get(s)},incrementGCounter(s,r){h.getGCounter(s).increment(r),N("gCounters",s),f(s,"g-counter","increment")},hasGCounter(s){return T.has(s)},deleteGCounter(s){let r=T.delete(s);return r&&N("gCounters",s),r},getCounter(s){return u.has(s)||u.set(s,F(t)),u.get(s)},incrementCounter(s,r){h.getCounter(s).increment(r),N("pnCounters",s),f(s,"pn-counter","increment")},decrementCounter(s,r){h.getCounter(s).decrement(r),N("pnCounters",s),f(s,"pn-counter","decrement")},hasCounter(s){return u.has(s)},deleteCounter(s){let r=u.delete(s);return r&&N("pnCounters",s),r},getSet(s){return c.has(s)||c.set(s,M(t)),c.get(s)},addToSet(s,r){h.getSet(s).add(r),N("sets",s),f(s,"or-set","add")},removeFromSet(s,r){h.getSet(s).remove(r),N("sets",s),f(s,"or-set","remove")},hasSet(s){return c.has(s)},deleteSet(s){let r=c.delete(s);return r&&N("sets",s),r},merge(s){let r=s.getState();h.applyState(r)},getState(){V();let s={version:E,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[r,a]of o)s.registers[r]=a.getState();for(let[r,a]of T)s.gCounters[r]=a.getState();for(let[r,a]of u)s.pnCounters[r]=a.getState();for(let[r,a]of c)s.sets[r]=a.getState();return s},applyState(s){for(let[r,a]of Object.entries(s.registers))o.has(r)?o.get(r).applyState(a):o.set(r,X(t,a)),N("registers",r),f(r,"lww-register","merge");for(let[r,a]of Object.entries(s.gCounters))T.has(r)?T.get(r).applyState(a):T.set(r,w(t,a)),N("gCounters",r),f(r,"g-counter","merge");for(let[r,a]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(a):u.set(r,x(t,a)),N("pnCounters",r),f(r,"pn-counter","merge");for(let[r,a]of Object.entries(s.sets))c.has(r)?c.get(r).applyState(a):c.set(r,P(t,a)),N("sets",r),f(r,"or-set","merge");E=Math.max(E,s.version)+1},getDelta(s){if(V(),l.length===0)return s>=E,null;let r=l.filter(_=>_.toVersion>s);if(r.length===0)return null;let a={fromVersion:s,toVersion:E,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let _ of r)_.registers&&Object.assign(a.registers,_.registers),_.gCounters&&Object.assign(a.gCounters,_.gCounters),_.pnCounters&&Object.assign(a.pnCounters,_.pnCounters),_.sets&&Object.assign(a.sets,_.sets);return Object.keys(a.registers).length===0&&delete a.registers,Object.keys(a.gCounters).length===0&&delete a.gCounters,Object.keys(a.pnCounters).length===0&&delete a.pnCounters,Object.keys(a.sets).length===0&&delete a.sets,a},applyDelta(s){if(s.registers)for(let[r,a]of Object.entries(s.registers))o.has(r)?o.get(r).applyState(a):o.set(r,X(t,a)),N("registers",r),f(r,"lww-register","merge");if(s.gCounters)for(let[r,a]of Object.entries(s.gCounters))T.has(r)?T.get(r).applyState(a):T.set(r,w(t,a)),N("gCounters",r),f(r,"g-counter","merge");if(s.pnCounters)for(let[r,a]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(a):u.set(r,x(t,a)),N("pnCounters",r),f(r,"pn-counter","merge");if(s.sets)for(let[r,a]of Object.entries(s.sets))c.has(r)?c.get(r).applyState(a):c.set(r,P(t,a)),N("sets",r),f(r,"or-set","merge");E=Math.max(E,s.toVersion)+1},getVersion(){return E},getNodeId(){return t},on(s,r){if(s==="change")return g.add(r),()=>{g.delete(r)};throw new Error(`Unknown event type: ${s}`)},removeAllListeners(){g.clear()},keys(s){let r=[];return(!s||s==="lww-register")&&r.push(...Array.from(o.keys())),(!s||s==="g-counter")&&r.push(...Array.from(T.keys())),(!s||s==="pn-counter")&&r.push(...Array.from(u.keys())),(!s||s==="or-set")&&r.push(...Array.from(c.keys())),r},clear(){o.clear(),T.clear(),u.clear(),c.clear(),l.length=0,p.registers.clear(),p.gCounters.clear(),p.pnCounters.clear(),p.sets.clear(),E=0},getStats(){return{total:o.size+T.size+u.size+c.size,registers:o.size,gCounters:T.size,pnCounters:u.size,sets:c.size,version:E,nodeId:t,deltaHistorySize:l.length}}};return h}var Pe,_e=R(()=>{"use strict";B();U();W();H();Pe={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var fe=R(()=>{"use strict"});var Ne=R(()=>{"use strict";B();U();W();H();_e();fe()});var ze={};be(ze,{ALLOWED_TABLE_NAMES:()=>z,BinaryHeap:()=>te,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>Le,UnifiedHnswIndex:()=>v,UnifiedMemoryManager:()=>A,clearProjectRootCache:()=>q,createHnswIndex:()=>ne,findProjectRoot:()=>b,getDefaultDbPath:()=>he,getResolvedDefaultConfig:()=>Ce,getUnifiedMemory:()=>Ie,initializeUnifiedMemory:()=>Ge,resetUnifiedMemory:()=>ke,validateTableName:()=>I});import*as m from"fs";import*as Re from"os";import*as S from"path";function he(){let i=b();return S.join(i,".agentic-qe","memory.db")}function Ce(){return{...Le,dbPath:he()}}function Ie(i){return A.getInstance(i)}async function Ge(i){let e=Ie(i);return await e.initialize(),e}function ke(){A.resetInstance()}function qe(){if(Se)return;Se=!0;let i=()=>{try{let e=A.instance;e&&e.close()}catch(e){console.debug("[UnifiedMemory] Cleanup error:",e instanceof Error?e.message:e)}};process.on("beforeExit",i),process.on("SIGINT",()=>{i(),process.exit(0)}),process.on("SIGTERM",()=>{i(),process.exit(0)})}var K,Le,A,Se,je=R(()=>{Xe();ee();ve();De();ye();j();j();re();re();me();Ne();Fe();K=J.create("unified-memory");Le={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:O.MMAP_SIZE_BYTES,cacheSize:O.CACHE_SIZE_KB,busyTimeout:O.BUSY_TIMEOUT_MS,vectorDimensions:O.DEFAULT_VECTOR_DIMENSIONS};A=class i{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;preparedStatements=new Map;vectorIndex=new v("qe-memory");crdtStore=null;constructor(e){let t=Ce();if(this.config={...t,...e},process.env.AQE_MEMORY_BACKEND==="memory"){this.config.dbPath=":memory:";return}if(!S.isAbsolute(this.config.dbPath)){let n=b();this.config.dbPath=S.join(n,this.config.dbPath)}}static getInstance(e){return i.instance||(i.instance=new i(e)),i.instance}static async getInstanceAsync(e){return i.instance?.initialized?i.instance:(i.instancePromise||(i.instancePromise=(async()=>{let t=i.getInstance(e);return await t.initialize(),t})()),i.instancePromise)}static resetInstance(){i.instance&&(i.instance.close(),i.instance=null),i.instancePromise=null,q()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=this.config.dbPath===":memory:",n="",d=!1,o=0;if(!t){let T=process.env.AQE_PROJECT_ROOT;if(T){let u=S.resolve(this.config.dbPath),c=S.resolve(T);!u.startsWith(c)&&!u.startsWith(Re.tmpdir())&&u.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${T}". Redirecting to test-safe path.`),this.config.dbPath=S.join(T,".agentic-qe","memory.db"))}if(n=S.dirname(this.config.dbPath),m.existsSync(n)||m.mkdirSync(n,{recursive:!0}),d=m.existsSync(this.config.dbPath),d)o=m.statSync(this.config.dbPath).size;else if(m.existsSync(n)){let u=this.findRecentBackups(n);if(u.length>0){let c=u[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
|
|
555
555
|
Expected: ${this.config.dbPath}
|
|
556
|
-
Found ${
|
|
557
|
-
Restoring from backup to prevent data loss...`),m.copyFileSync(
|
|
556
|
+
Found ${u.length} backup(s), newest: ${c.path} (${(c.size/1024/1024).toFixed(1)}MB)
|
|
557
|
+
Restoring from backup to prevent data loss...`),m.copyFileSync(c.path,this.config.dbPath);for(let E of["-wal","-shm"]){let l=this.config.dbPath+E;m.existsSync(l)&&m.unlinkSync(l)}o=c.size}}}if(e?.throwIfAborted(),this.db=Z(this.config.dbPath,{walMode:this.config.walMode,busyTimeout:this.config.busyTimeout}),this.db.pragma(`mmap_size = ${this.config.mmapSize}`),this.db.pragma(`cache_size = ${this.config.cacheSize}`),this.db.pragma("foreign_keys = ON"),e?.aborted){try{this.db.close()}catch{}this.db=null,e.throwIfAborted()}if(await this.runMigrations(),e?.throwIfAborted(),d&&o>1e6)try{let T=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get();if(T&&T.cnt===0){let u=m.statSync(this.config.dbPath).size;u<o*.1&&console.error(`[UnifiedMemory] CRITICAL: Possible data loss detected!
|
|
558
558
|
DB was ${(o/1024/1024).toFixed(1)}MB, now ${(u/1024/1024).toFixed(1)}MB with 0 patterns.
|
|
559
559
|
This looks like the DB was replaced with an empty schema.
|
|
560
|
-
Check backups in ${n} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(t){throw this.initPromise=null,t instanceof Error&&(t.name==="AbortError"||(e?.aborted??!1))?t:new Error(`Failed to initialize UnifiedMemoryManager: ${Q(t)}`)}}}findRecentBackups(e){try{let n=m.readdirSync(e).filter(o=>o.startsWith("memory")&&o.endsWith(".db")&&o!=="memory.db").map(o=>{let
|
|
560
|
+
Check backups in ${n} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(t){throw this.initPromise=null,t instanceof Error&&(t.name==="AbortError"||(e?.aborted??!1))?t:new Error(`Failed to initialize UnifiedMemoryManager: ${Q(t)}`)}}}findRecentBackups(e){try{let n=m.readdirSync(e).filter(o=>o.startsWith("memory")&&o.endsWith(".db")&&o!=="memory.db").map(o=>{let T=S.join(e,o),u=m.statSync(T);return{path:T,size:u.size,mtime:u.mtimeMs}}).filter(o=>o.size>1e6).sort((o,T)=>T.mtime-o.mtime),d=S.join(e,"backups");if(m.existsSync(d)){let o=m.readdirSync(d);for(let T of o)if(T.endsWith(".db")){let u=S.join(d,T),c=m.statSync(u);c.size>1e6&&n.push({path:u,size:c.size,mtime:c.mtimeMs})}n.sort((T,u)=>u.mtime-T.mtime)}return n}catch{return[]}}warnIfDuplicateDatabases(){if(this.config.dbPath!==":memory:")try{let e=b(),t=S.resolve(this.config.dbPath),d=[S.join(e,".agentic-qe","memory.db"),S.join(e,"v3",".agentic-qe","memory.db")].map(o=>S.resolve(o)).filter(o=>o!==t&&m.existsSync(o));d.length>0&&console.warn(`[UnifiedMemory] WARNING: Duplicate database(s) detected!
|
|
561
561
|
Canonical: ${t}
|
|
562
|
-
Duplicates: ${
|
|
563
|
-
This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){K.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let n=I(e);return this.db.prepare(`PRAGMA table_info(${n})`).all().some(o=>o.name===t)}catch(n){return K.debug("Column existence check failed",{table:e,column:t,error:n instanceof Error?n.message:String(n)}),!1}}handleV2SchemaIncompatibilities(){if(!this.db)return;let e=[{table:"goap_plans",requiredColumn:"status",columnDef:"TEXT DEFAULT 'pending'"},{table:"goap_actions",requiredColumn:"agent_type",columnDef:"TEXT DEFAULT 'unknown'"},{table:"concept_nodes",requiredColumn:"concept_type",columnDef:"TEXT DEFAULT 'general'"},{table:"concept_edges",requiredColumn:"edge_type",columnDef:"TEXT DEFAULT 'related'"},{table:"dream_insights",requiredColumn:"cycle_id",columnDef:"TEXT DEFAULT ''"},{table:"rl_q_values",requiredColumn:"algorithm",columnDef:"TEXT DEFAULT 'q-learning'"}];for(let{table:t,requiredColumn:n,columnDef:
|
|
562
|
+
Duplicates: ${d.join(", ")}
|
|
563
|
+
This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){K.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let n=I(e);return this.db.prepare(`PRAGMA table_info(${n})`).all().some(o=>o.name===t)}catch(n){return K.debug("Column existence check failed",{table:e,column:t,error:n instanceof Error?n.message:String(n)}),!1}}handleV2SchemaIncompatibilities(){if(!this.db)return;let e=[{table:"goap_plans",requiredColumn:"status",columnDef:"TEXT DEFAULT 'pending'"},{table:"goap_actions",requiredColumn:"agent_type",columnDef:"TEXT DEFAULT 'unknown'"},{table:"concept_nodes",requiredColumn:"concept_type",columnDef:"TEXT DEFAULT 'general'"},{table:"concept_edges",requiredColumn:"edge_type",columnDef:"TEXT DEFAULT 'related'"},{table:"dream_insights",requiredColumn:"cycle_id",columnDef:"TEXT DEFAULT ''"},{table:"rl_q_values",requiredColumn:"algorithm",columnDef:"TEXT DEFAULT 'q-learning'"}];for(let{table:t,requiredColumn:n,columnDef:d}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,n)){let T=I(t);try{this.db.exec(`ALTER TABLE ${T} ADD COLUMN ${n} ${d}`),console.log(`[UnifiedMemory] Added column ${n} to ${t} (safe migration)`)}catch(u){console.log(`[UnifiedMemory] Column ${n} on ${t}: ${u instanceof Error?u.message:String(u)}`)}}}async runMigrations(){if(!this.db)throw new Error("Database not initialized");this.db.exec(oe),this.handleV2SchemaIncompatibilities();let t=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;t<D&&(console.log(`[UnifiedMemory] Migrating from v${t} to v${D}`),this.db.transaction(()=>{t<1&&this.db.exec(ie),t<2&&this.db.exec(ae),t<3&&(this.db.exec(ce),this.db.exec(Te),this.db.exec(Ee)),t<4&&this.db.exec(de),t<5&&this.db.exec(ue),t<6&&this.db.exec(G),t<7&&this.db.exec(le),t<8&&this.db.exec(pe),t<9&&(this.db.exec(`
|
|
564
564
|
CREATE VIRTUAL TABLE IF NOT EXISTS qe_patterns_fts USING fts5(
|
|
565
565
|
name, description, pattern_type, qe_domain,
|
|
566
566
|
content='qe_patterns',
|
|
@@ -589,23 +589,23 @@ import{d as G,f as we}from"./chunk-4MJQJQLY.js";import{a as ye}from"./chunk-DF7V
|
|
|
589
589
|
`)),t<10&&this.db.exec(k),this.db.prepare(`
|
|
590
590
|
INSERT OR REPLACE INTO schema_version (id, version, migrated_at)
|
|
591
591
|
VALUES (1, ?, datetime('now'))
|
|
592
|
-
`).run(D)})(),console.log("[UnifiedMemory] Migration complete"))}async loadVectorIndex(){if(this.vectorsLoaded)return;if(!this.db)throw new Error("Database not initialized");this.vectorIndex.clear();let e=this.db.prepare("SELECT id, embedding, dimensions FROM vectors").all();for(let t of e){let n=this.bufferToFloatArray(t.embedding,t.dimensions);this.vectorIndex.add(t.id,n)}this.vectorsLoaded=!0,console.log(`[UnifiedMemory] Loaded ${e.length} vectors into vector index (ruvector flat)`)}async kvSet(e,t,n="default",
|
|
592
|
+
`).run(D)})(),console.log("[UnifiedMemory] Migration complete"))}async loadVectorIndex(){if(this.vectorsLoaded)return;if(!this.db)throw new Error("Database not initialized");this.vectorIndex.clear();let e=this.db.prepare("SELECT id, embedding, dimensions FROM vectors").all();for(let t of e){let n=this.bufferToFloatArray(t.embedding,t.dimensions);this.vectorIndex.add(t.id,n)}this.vectorsLoaded=!0,console.log(`[UnifiedMemory] Loaded ${e.length} vectors into vector index (ruvector flat)`)}async kvSet(e,t,n="default",d){this.ensureInitialized();let o=d?Date.now()+d*1e3:null,T=JSON.stringify(t);this.db.prepare(`
|
|
593
593
|
INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
|
|
594
594
|
VALUES (?, ?, ?, ?)
|
|
595
|
-
`).run(e,n,
|
|
595
|
+
`).run(e,n,T,o)}async kvGet(e,t="default"){this.ensureInitialized();let n=this.db.prepare(`
|
|
596
596
|
SELECT value, expires_at FROM kv_store
|
|
597
597
|
WHERE key = ? AND namespace = ?
|
|
598
598
|
`).get(e,t);if(n){if(n.expires_at&&Date.now()>n.expires_at){this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t);return}return L(n.value)}}async kvDelete(e,t="default"){return this.ensureInitialized(),this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t).changes>0}async kvExists(e,t="default"){return this.ensureInitialized(),this.db.prepare(`
|
|
599
599
|
SELECT 1 FROM kv_store
|
|
600
600
|
WHERE key = ? AND namespace = ? AND (expires_at IS NULL OR expires_at > ?)
|
|
601
|
-
`).get(e,t,Date.now())!==void 0}async kvSearch(e,t="default",n=100){this.ensureInitialized();let
|
|
601
|
+
`).get(e,t,Date.now())!==void 0}async kvSearch(e,t="default",n=100){this.ensureInitialized();let d=e.replace(/\*/g,"%").replace(/\?/g,"_");return this.db.prepare(`
|
|
602
602
|
SELECT key FROM kv_store
|
|
603
603
|
WHERE namespace = ? AND key LIKE ?
|
|
604
604
|
AND (expires_at IS NULL OR expires_at > ?)
|
|
605
605
|
LIMIT ?
|
|
606
|
-
`).all(t,
|
|
606
|
+
`).all(t,d,Date.now(),n).map(T=>T.key)}async kvCleanupExpired(){return this.ensureInitialized(),this.db.prepare("DELETE FROM kv_store WHERE expires_at IS NOT NULL AND expires_at < ?").run(Date.now()).changes}async vectorStore(e,t,n="default",d){this.ensureInitialized();let o=this.floatArrayToBuffer(t),T=d?JSON.stringify(d):null;this.db.prepare(`
|
|
607
607
|
INSERT OR REPLACE INTO vectors (id, namespace, embedding, dimensions, metadata, updated_at)
|
|
608
608
|
VALUES (?, ?, ?, ?, ?, datetime('now'))
|
|
609
|
-
`).run(e,n,o,t.length,
|
|
609
|
+
`).run(e,n,o,t.length,T),this.vectorIndex.add(e,t)}async vectorGet(e){this.ensureInitialized();let t=this.db.prepare(`
|
|
610
610
|
SELECT embedding, dimensions, metadata FROM vectors WHERE id = ?
|
|
611
|
-
`).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?L(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e);return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,n){this.ensureInitialized(),this.vectorsLoaded||await this.loadVectorIndex();let
|
|
611
|
+
`).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?L(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e);return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,n){this.ensureInitialized(),this.vectorsLoaded||await this.loadVectorIndex();let d=this.vectorIndex.search(e,t*2);if(d.length===0)return[];let o=d.map(E=>E.id),T=o.map(()=>"?").join(","),u=this.db.prepare(`SELECT id, namespace, metadata FROM vectors WHERE id IN (${T})`).all(...o),c=new Map(u.map(E=>[E.id,E]));if(n){let E=[];for(let l of d){let g=c.get(l.id);if(g&&g.namespace===n&&(E.push({id:l.id,score:l.score,metadata:g.metadata?L(g.metadata):void 0}),E.length>=t))break}return E}return d.slice(0,t).map(E=>{let l=c.get(E.id);return{id:E.id,score:E.score,metadata:l?.metadata?L(l.metadata):void 0}})}async vectorCount(e){return this.ensureInitialized(),e?this.db.prepare("SELECT COUNT(*) as count FROM vectors WHERE namespace = ?").get(e).count:this.db.prepare("SELECT COUNT(*) as count FROM vectors").get().count}queryCount(e){this.ensureInitialized();let t=I(e);return this.db.prepare(`SELECT COUNT(*) as c FROM ${t}`).get().c}initializeCRDT(e){if(this.crdtStore){console.warn("[UnifiedMemory] CRDT store already initialized");return}this.crdtStore=$({nodeId:e}),console.log(`[UnifiedMemory] CRDT store initialized for node: ${e}`)}getCRDTStore(){return this.crdtStore}isCRDTInitialized(){return this.crdtStore!==null}async crdtSet(e,t,n="crdt"){this.ensureInitialized(),this.crdtStore&&this.crdtStore.setRegister(e,t),await this.kvSet(e,t,n)}async crdtGet(e,t="crdt"){if(this.crdtStore){let n=this.crdtStore.getRegister(e);if(n)return n.get()}return this.kvGet(e,t)}crdtIncrement(e,t=1){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");let n=this.crdtStore.getCounter(e);n||(this.crdtStore.incrementCounter(e,0),n=this.crdtStore.getCounter(e));for(let d=0;d<t;d++)this.crdtStore.incrementCounter(e)}crdtGetCounter(e){return this.crdtStore?this.crdtStore.getCounter(e)?.get()??0:0}crdtAddToSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.addToSet(e,t)}crdtRemoveFromSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.removeFromSet(e,t)}crdtGetSet(e){if(!this.crdtStore)return new Set;let t=this.crdtStore.getSet(e);return new Set(t.values())}crdtGetState(){return this.crdtStore?this.crdtStore.getState():null}crdtGetDelta(e){return this.crdtStore?this.crdtStore.getDelta(e??0):null}crdtMerge(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyState(e)}crdtApplyDelta(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyDelta(e)}async crdtPersist(){if(!this.crdtStore)return;let e=this.crdtStore.getState();await this.kvSet("__crdt_state__",e,"crdt-internal")}async crdtRestore(){if(!this.crdtStore)return!1;let e=await this.kvGet("__crdt_state__","crdt-internal");return e?(this.crdtStore.applyState(e),!0):!1}getDatabase(){if(!this.db||!this.initialized)throw new Error("UnifiedMemoryManager not initialized");return this.db}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(e,t){if(!this.db)throw new Error("Database not initialized");let n=this.preparedStatements.get(e);return n||(n=this.db.prepare(t),this.preparedStatements.set(e,n)),n}transaction(e){if(!this.db)throw new Error("Database not initialized");return this.db.transaction(e)()}getStats(){if(!this.db)throw new Error("Database not initialized");let e=ge.map(d=>{try{let o=this.db.prepare(`SELECT COUNT(*) as count FROM ${d}`).get();return{name:d,rowCount:o.count}}catch(o){return K.debug("Table row count query failed",{table:d,error:o instanceof Error?o.message:String(o)}),{name:d,rowCount:0}}}),t=0,n=0;try{m.existsSync(this.config.dbPath)&&(t=m.statSync(this.config.dbPath).size);let d=this.config.dbPath+"-wal";m.existsSync(d)&&(n=m.statSync(d).size)}catch(d){console.debug("[UnifiedMemory] File stat error:",d instanceof Error?d.message:d)}return{tables:e,fileSize:t,walSize:n,vectorIndexSize:this.vectorIndex.size()}}vacuum(){if(!this.db)throw new Error("Database not initialized");this.db.exec("VACUUM")}checkpoint(){if(!this.db)throw new Error("Database not initialized");this.db.pragma("wal_checkpoint(TRUNCATE)")}close(){this.db&&(this.preparedStatements.clear(),this.vectorIndex.clear(),this.db.close(),this.db=null,this.initialized=!1,console.log("[UnifiedMemory] Database closed"))}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("UnifiedMemoryManager not initialized. Call initialize() first.")}floatArrayToBuffer(e){let t=Buffer.alloc(e.length*4);for(let n=0;n<e.length;n++)t.writeFloatLE(e[n],n*4);return t}bufferToFloatArray(e,t){let n=new Float32Array(e.buffer,e.byteOffset,t);return Array.from(n)}};Se=!1;qe()});export{z as a,I as b,Be as c,j as d,he as e,Le as f,Ce as g,A as h,Ie as i,Ge as j,ke as k,ze as l,je as m};
|
|
@@ -0,0 +1,2 @@
|
|
|
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.8");process.exit(0)}
|
|
2
|
+
var e=null,f=null,t=null,u=!1;async function W(){return u&&!t?e:t||(t=(async()=>{try{if(process.env.AQE_RVF_MODE==="sqlite-only"||process.env.AQE_MEMORY_BACKEND==="memory")return null;let{isRvfNativeAvailable:d}=await import("./rvf-native-adapter-4YSC6QKO.js");if(!d())return null;let{getUnifiedMemory:v,findProjectRoot:p}=await import("./unified-memory-G3BYQ3WU.js"),o=v().getDatabase();if(!o)return null;let{join:m}=await import("node:path"),g=m(process.env.AQE_PROJECT_ROOT??p(),".agentic-qe","brain.rvf"),{RvfDualWriter:R}=await import("./rvf-dual-writer-MNRJGNIX.js"),l=new R(o,{rvfPath:g,mode:"dual-write",dimensions:384});await l.initialize(),e=l;try{let{getRvfMigrationStage:y}=await import("./feature-flags-NM3S7OEW.js"),a=y();if(a>=2){let{RvfMigrationAdapter:A}=await import("./rvf-migration-adapter-P2RDBFA4.js"),s=new A({stage:a});s.setSqliteDb(o);let{getSharedRvfAdapter:D}=await import("./shared-rvf-adapter-LR7E2EQI.js"),i=D();if(i){let h={ingest:n=>i.ingest(n),search:(n,M)=>i.search(n,M).map(c=>({id:c.id,score:c.score})),delete:n=>i.delete(n),status:()=>i.status(),close:()=>{}};s.setRvfStore(h)}f=s,console.log(`[RVF] Migration adapter active at stage ${a} (${["sqlite-only","hybrid","dual-sqlite","dual-rvf","rvf-primary"][a]})`)}}catch{}return l}catch(r){return(process.env.DEBUG||process.env.AQE_VERBOSE)&&console.debug("[RVF] Dual-writer init failed, degrading to sqlite-only:",r instanceof Error?r.message:r),null}finally{u=!0,t=null,import("./base-6HJR4VJT.js").then(({registerRvfResetFn:r})=>r(w)).catch(()=>{})}})(),t)}function S(){return e}function b(){return f}function w(){if(e){try{e.close()}catch{}e=null}f=null,t=null,u=!1}export{W as a,S as b,b as c,w as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
2
|
-
import{b as A,d as M}from"./chunk-
|
|
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.8");process.exit(0)}
|
|
2
|
+
import{b as A,d as M}from"./chunk-DDMKCHYT.js";import{a as S,b as D}from"./chunk-OZDRAKFF.js";import{S as Q,l as E}from"./chunk-HE3KLHNO.js";import{g as C}from"./chunk-SDGRU6SG.js";M();Q();var v=(1+Math.sqrt(5))/2,R=1/v;function k(t,e=0){if(t<0||!Number.isFinite(t))throw new Error(`Invalid dither sequence length: ${t}`);if(!Number.isFinite(e))throw new Error(`Invalid dither seed: ${e}`);let n=new Float32Array(t),r=(e*R%1+1)%1;for(let i=0;i<t;i++)n[i]=((r+(i+1)*v)%1+1)%1;return n}function I(t,e,n=0){if(!(t instanceof Float32Array))throw new Error("Input vector must be a Float32Array");if(t.length===0)return{quantized:new Int32Array(0),dequantized:new Float32Array(0),bitDepth:e,seed:n,stepSize:0,minValue:0,maxValue:0};if(e<1||e>32||!Number.isInteger(e))throw new Error(`Invalid bit depth: ${e}. Must be an integer in [1, 32].`);let r=t[0],i=t[0];for(let d=1;d<t.length;d++)t[d]<r&&(r=t[d]),t[d]>i&&(i=t[d]);let s=(1<<e)-1,a=i-r,o=a===0?1:a/s,m=k(t.length,n),l=new Int32Array(t.length),u=new Float32Array(t.length);for(let d=0;d<t.length;d++){if(a===0)l[d]=Math.round(s/2);else{let L=(t[d]-r)/o+(m[d]-.5);l[d]=Math.max(0,Math.min(s,Math.round(L)))}u[d]=l[d]*o+r}return{quantized:l,dequantized:u,bitDepth:e,seed:n,stepSize:o,minValue:r,maxValue:i}}var h=null,b=null,p=null,g=null,f=null,w=null,x=!1;try{let t=(D(),C(S));h=t.RuvectorLayer,b=t.TensorCompress,p=t.differentiableSearch,g=t.hierarchicalForward,f=t.getCompressionLevel,w=t.init,x=!0}catch{}function H(){return x}function c(){if(!x)throw new Error("@ruvector/gnn native module is not available on this platform. Install the appropriate optional dependency for your platform, or use a platform where pre-built binaries are available.")}var F=!1;function V(){if(!F){c();let t=w();return F=!0,t}return"@ruvector/gnn already initialized"}var y=class{indexes;config;nextId;gnnLayers;compressor;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.nextId=new Map,this.gnnLayers=new Map,c(),this.compressor=new b,V()}initializeIndex(e){this.indexes.has(e)||(this.indexes.set(e,new Map),this.nextId.set(e,0))}addEmbedding(e,n){let r=e.namespace;this.indexes.has(r)||this.initializeIndex(r);let i=this.indexes.get(r),s=n??this.nextId.get(r);return n===void 0&&this.nextId.set(r,s+1),i.set(s,e),s}addEmbeddingsBatch(e){let n=[];for(let r of e){let i=this.addEmbedding(r.embedding,r.id);n.push(i)}return n}search(e,n={}){let r=n.namespace||e.namespace;if(!this.indexes.has(r))return[];let i=this.indexes.get(r),s=n.limit||10,a=[];for(let[u,d]of i.entries())a.push({id:u,vector:Array.from(d.vector)});if(a.length===0)return[];let o=new Float32Array(e.vector),m=a.map(u=>new Float32Array(u.vector)),l=p(o,m,Math.min(s,a.length),1);return l.indices.map((u,d)=>({id:a[u]?.id??u,distance:1-l.weights[d]}))}differentiableSearchWithWeights(e,n,r,i=1){let s=new Float32Array(e.vector),a=n.map(m=>new Float32Array(m.embedding.vector)),o=p(s,a,Math.min(r,n.length),i);return{indices:o.indices.map(m=>n[m]?.id??m),weights:o.weights}}hierarchicalForward(e,n,r){let i=r.map(l=>`${l.inputDim}-${l.hiddenDim}`).join(",");if(!this.gnnLayers.has(i)){let l=[];for(let u of r){let d=new h(u.inputDim,u.hiddenDim,u.heads,u.dropout);l.push(d)}this.gnnLayers.set(i,l[0])}let a=this.gnnLayers.get(i).toJson(),o=new Float32Array(e),m=n.map(l=>l.map(u=>new Float32Array(u)));return Array.from(g(o,m,[a]))}compressEmbedding(e,n){let r=f(n),s={none:"none",half:"half",pq8:"pq8",pq4:"pq4",binary:"binary"}[r]??"none",a=new Float32Array(e.vector),o=this.compressor.compress(a,n);return{dimension:Array.from(e.vector).length,level:s,data:o,accessFreq:n}}decompressEmbedding(e){let n=this.compressor.decompress(e.data),r={none:"none",half:"fp16",pq8:"int8",pq4:"int8",binary:"binary"};return{vector:n,dimension:e.dimension,namespace:"code",text:"",timestamp:Date.now(),quantization:r[e.level]??"none"}}getCompressionLevelForFrequency(e){return c(),f(e)}getIndexStats(e){return this.indexes.has(e)?{size:this.indexes.get(e).size,maxElements:1e4,dimension:this.config.dimension,metric:this.config.metric}:null}clearIndex(e){this.indexes.delete(e),this.nextId.delete(e)}clearAll(){this.indexes.clear(),this.nextId.clear()}resizeIndex(e){}setEfSearch(e){this.config.efSearch=e}getConfig(){return{...this.config}}isInitialized(e){return this.indexes.has(e)}getInitializedNamespaces(){return Array.from(this.indexes.keys())}getSize(e){return this.indexes.get(e)?.size??0}async saveIndex(e,n){let r=this.indexes.get(e);if(!r)throw new Error(`Namespace ${e} not initialized`);let i=Array.from(r.entries()).map(([a,o])=>({id:a,vector:Array.from(o.vector),metadata:o.metadata}));await(await import("fs/promises")).writeFile(n,JSON.stringify(i,null,2))}async loadIndex(e,n){let i=await(await import("fs/promises")).readFile(n,"utf-8"),s=A(i);this.initializeIndex(e);for(let a of s){let o={vector:a.vector,dimension:a.vector.length,namespace:e,text:"",timestamp:Date.now(),quantization:"none",metadata:a.metadata};this.addEmbedding(o,a.id)}}},q=class{static instances=new Map;static getInstance(e,n){return this.instances.has(e)||this.instances.set(e,new y(n)),this.instances.get(e)}static closeInstance(e){let n=this.instances.get(e);n&&(n.clearAll(),this.instances.delete(e))}static closeAll(){for(let e of this.instances.values())e.clearAll();this.instances.clear()}},z=class{static layers=new Map;static getLayer(e){let n=`${e.inputDim}-${e.hiddenDim}-${e.heads}-${e.dropout}`;if(!this.layers.has(n)){c();let r=new h(e.inputDim,e.hiddenDim,e.heads,e.dropout);this.layers.set(n,r)}return this.layers.get(n)}static layerFromJson(e){return c(),h.fromJson(e)}static clearCache(){this.layers.clear()}},N=class{static _compressor=null;static get compressor(){return this._compressor||(c(),this._compressor=new b),this._compressor}static compressWithLevel(e,n){let r={levelType:n,scale:1,subvectors:n==="pq8"?8:n==="pq4"?16:void 0,centroids:n==="pq8"?256:void 0,outlierThreshold:n==="pq4"?3:void 0,threshold:n==="binary"?0:void 0},i=e instanceof Float32Array?e:new Float32Array(e);return this.compressor.compressWithLevel(i,r)}static decompress(e){return this.compressor.decompress(e)}static getLevel(e){return c(),f(e)}static compressWithDither(e,n,r){let i=e instanceof Float32Array?e:new Float32Array(e),s;if(E()){let o={none:32,half:16,pq8:8,pq4:4,binary:1},m=r?.bitDepth??o[n]??8,l=r?.seed??0;s=I(i,m,l)}return{compressed:this.compressWithLevel(s?s.dequantized:e,n),ditherResult:s}}};function G(){return c(),h}function J(){return c(),b}function O(){return c(),p}function j(){return c(),g}function B(){return c(),f}function K(){return c(),w}function U(t){return t instanceof Float32Array?t:"vector"in t?t.vector instanceof Float32Array?t.vector:new Float32Array(t.vector):new Float32Array(t)}function X(t){return"vector"in t?Array.from(t.vector):Array.from(t)}function Y(t,e="code"){return{vector:t,dimension:t.length,namespace:e,text:"",timestamp:Date.now(),quantization:"none"}}function Z(t,e,n,r=1){let i=[],s=e.map(a=>a instanceof Float32Array?a:new Float32Array(a));for(let a of t){let o=a instanceof Float32Array?a:new Float32Array(a),m=p(o,s,n,r);i.push({indices:m.indices,weights:m.weights})}return i}export{H as a,V as b,y as c,q as d,z as e,N as f,G as g,J as h,O as i,j,B as k,K as l,U as m,X as n,Y as o,Z as p};
|
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
2
|
-
import{c as t,e as o}from"./chunk-
|
|
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.8");process.exit(0)}
|
|
2
|
+
import{c as t,e as o}from"./chunk-SDGRU6SG.js";var L={};o(L,{DotProductAttention:()=>d,FlashAttention:()=>m,HyperbolicAttention:()=>f,LinearAttention:()=>h,MoEAttention:()=>_,MultiHeadAttention:()=>A,RuvectorLayer:()=>a,SonaEngine:()=>g,TensorCompress:()=>c,default:()=>i,differentiableSearch:()=>l,getCompressionLevel:()=>s,hierarchicalForward:()=>p,init:()=>u,pipeline:()=>v});import{createRequire as n}from"module";var r,e,i,a,c,l,p,s,u,m,d,A,f,h,_,g,v,b=t(()=>{r=n(import.meta.url),e=r("@ruvector/gnn"),i=e,{RuvectorLayer:a,TensorCompress:c,differentiableSearch:l,hierarchicalForward:p,getCompressionLevel:s,init:u,FlashAttention:m,DotProductAttention:d,MultiHeadAttention:A,HyperbolicAttention:f,LinearAttention:h,MoEAttention:_,SonaEngine:g,pipeline:v}=e||{}});export{L as a,b};
|