agentic-qe 3.9.32 → 3.9.34
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 +120 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-OXCJPHRI.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-WKS3E6KT.js → agent-booster-wasm-UD3YB7FC.js} +2 -2
- package/dist/cli/chunks/{agent-handler-LYCAWE7S.js → agent-handler-BNBGQS6N.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-XF7IOMRK.js → agent-memory-branch-NJHROVKY.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-HDAC5FJJ.js +2 -0
- package/dist/cli/chunks/{audit-D2AY3HFP.js → audit-4Y7M2S2O.js} +2 -2
- package/dist/cli/chunks/base-JY364ZUA.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-BWUH4OQT.js → better-sqlite3-4JUNP7IW.js} +2 -2
- package/dist/cli/chunks/{brain-handler-NNW4TAO2.js → brain-handler-VWRD34M6.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-OM5HNZKV.js → branch-enumerator-H4WLPOU3.js} +2 -2
- package/dist/cli/chunks/{browser-Y2FU2NV4.js → browser-Y7ZNFLEU.js} +2 -2
- package/dist/cli/chunks/browser-workflow-DAGIWFJE.js +2 -0
- package/dist/cli/chunks/{chunk-O5UGJ3OI.js → chunk-26BODPAN.js} +2 -2
- package/dist/cli/chunks/{chunk-OKEHGXIS.js → chunk-2C6LRXLU.js} +2 -2
- package/dist/cli/chunks/{chunk-WQ4MT74X.js → chunk-2MC2YH4J.js} +1 -1
- package/dist/cli/chunks/{chunk-M5PYPGBC.js → chunk-3K3QGBH7.js} +2 -2
- package/dist/cli/chunks/{chunk-5R5WOLZM.js → chunk-3OTG4IXK.js} +1 -1
- package/dist/cli/chunks/{chunk-PS6ISBED.js → chunk-3PRHEG4B.js} +2 -2
- package/dist/cli/chunks/{chunk-7PTW3M67.js → chunk-45SJSOSI.js} +2 -2
- package/dist/cli/chunks/{chunk-PPS6VN24.js → chunk-4AIJOXQJ.js} +1 -1
- package/dist/cli/chunks/{chunk-62UXGD5J.js → chunk-4FW4ZWPB.js} +5 -5
- package/dist/cli/chunks/{chunk-YVMJTBXB.js → chunk-4GHSIVTA.js} +3 -3
- package/dist/cli/chunks/{chunk-A6VI5BZU.js → chunk-4GSUSYZK.js} +4 -4
- package/dist/cli/chunks/{chunk-MEHNT37H.js → chunk-4JILSEZT.js} +2 -2
- package/dist/cli/chunks/{chunk-VKNCMGOJ.js → chunk-4K5KVC7R.js} +4 -4
- package/dist/cli/chunks/{chunk-HPQZSXED.js → chunk-4W2GGE4Z.js} +1 -1
- package/dist/cli/chunks/{chunk-EFEJLZDN.js → chunk-4YDLD5TW.js} +1 -1
- package/dist/cli/chunks/{chunk-PG5F2VHA.js → chunk-53Y6ZKPN.js} +2 -2
- package/dist/cli/chunks/{chunk-2L5GAOST.js → chunk-54HTQ3KQ.js} +2 -2
- package/dist/cli/chunks/{chunk-WTNM7NA4.js → chunk-5H44TVAY.js} +1 -1
- package/dist/cli/chunks/{chunk-3R4CMTWF.js → chunk-5Y3P6IAQ.js} +2 -2
- package/dist/cli/chunks/{chunk-XCUNQ3FK.js → chunk-67Y5HBMW.js} +2 -2
- package/dist/cli/chunks/{chunk-5XY6SULI.js → chunk-6FMMHW2R.js} +2 -2
- package/dist/cli/chunks/{chunk-XHQFVTFD.js → chunk-6FNPEC2I.js} +1 -1
- package/dist/cli/chunks/{chunk-A4UNK5SY.js → chunk-6UUNB4AW.js} +2 -2
- package/dist/cli/chunks/{chunk-VJL7DNUU.js → chunk-6XI7MNHH.js} +22 -16
- package/dist/cli/chunks/{chunk-SLH7LFVY.js → chunk-7AEFEPFH.js} +2 -2
- package/dist/cli/chunks/{chunk-ZIVOT3B7.js → chunk-7II46WAF.js} +2 -2
- package/dist/cli/chunks/chunk-7IUNZ653.js +9 -0
- package/dist/cli/chunks/{chunk-IGEZVFOM.js → chunk-7QTMWILQ.js} +2 -2
- package/dist/cli/chunks/{chunk-DFY7F4TE.js → chunk-7YM2AZXK.js} +1 -1
- package/dist/cli/chunks/{chunk-REW3W3ZW.js → chunk-7ZE5BXCN.js} +1 -1
- package/dist/cli/chunks/{chunk-FNQCWEVJ.js → chunk-A2FZAEIU.js} +2 -2
- package/dist/cli/chunks/{chunk-JDW6GN3A.js → chunk-AGHBG5E4.js} +2 -2
- package/dist/cli/chunks/{chunk-NW5FYGDE.js → chunk-AHEHD3AP.js} +2 -2
- package/dist/cli/chunks/{chunk-NZRJWK5H.js → chunk-AIQHS7D2.js} +9 -9
- package/dist/cli/chunks/{chunk-MIHQIAVK.js → chunk-ARKWPPBZ.js} +2 -2
- package/dist/cli/chunks/{chunk-7AISRWBS.js → chunk-AX7F6CNY.js} +2 -2
- package/dist/cli/chunks/{chunk-2Z2IQBIJ.js → chunk-AYLTFMTW.js} +1 -1
- package/dist/cli/chunks/{chunk-6EKXBWJD.js → chunk-BBULBXTO.js} +2 -2
- package/dist/cli/chunks/{chunk-BQML7B4W.js → chunk-BP45DZKL.js} +3 -3
- package/dist/cli/chunks/{chunk-PLGMPG7S.js → chunk-CKJGWNIS.js} +2 -2
- package/dist/cli/chunks/{chunk-Z2EDNMCQ.js → chunk-CWM5LSLQ.js} +2 -2
- package/dist/cli/chunks/{chunk-667I4RTC.js → chunk-DGEXLCOX.js} +1 -1
- package/dist/cli/chunks/{chunk-W3JB3G7C.js → chunk-DIX6AR2P.js} +2 -2
- package/dist/cli/chunks/{chunk-45N22VAB.js → chunk-DKA5WC6T.js} +2 -2
- package/dist/cli/chunks/chunk-DOKH4EJX.js +2 -0
- package/dist/cli/chunks/{chunk-ONNTJXU7.js → chunk-DXKZQYBK.js} +2 -2
- package/dist/cli/chunks/chunk-DXOFPU3A.js +2 -0
- package/dist/cli/chunks/{chunk-FWEYOD3S.js → chunk-E2IC6PHO.js} +2 -2
- package/dist/cli/chunks/{chunk-H7YKTJMY.js → chunk-EPETDHDV.js} +2 -2
- package/dist/cli/chunks/{chunk-G77CYF7H.js → chunk-EWVKCXV3.js} +3 -3
- package/dist/cli/chunks/{chunk-V6HM2BKJ.js → chunk-FAQSUNVC.js} +1 -1
- package/dist/cli/chunks/{chunk-JRYNHFZA.js → chunk-FCWQRUXQ.js} +1 -1
- package/dist/cli/chunks/{chunk-FFBF5BLQ.js → chunk-FW3EEASU.js} +1 -1
- package/dist/cli/chunks/{chunk-NVZHCAEB.js → chunk-GCMCU54O.js} +2 -2
- package/dist/cli/chunks/{chunk-OKRY4LNE.js → chunk-GW7T2ABB.js} +3 -3
- package/dist/cli/chunks/{chunk-KHZRNJ3A.js → chunk-GYJAPCP2.js} +1 -1
- package/dist/cli/chunks/{chunk-PQAYCK2U.js → chunk-HIZWO4J3.js} +2 -2
- package/dist/cli/chunks/{chunk-5WR42V5O.js → chunk-I74WDBHS.js} +2 -2
- package/dist/cli/chunks/{chunk-XB3SIYGU.js → chunk-IH5MVTLA.js} +2 -2
- package/dist/cli/chunks/{chunk-4VAZSCTZ.js → chunk-IPEUGCUK.js} +2 -2
- package/dist/cli/chunks/{chunk-6SYP7QX6.js → chunk-IPRUAUGV.js} +4 -4
- package/dist/cli/chunks/{chunk-I6Q6BPVH.js → chunk-IT7TOO52.js} +1 -1
- package/dist/cli/chunks/{chunk-ZESMMAKZ.js → chunk-IUZNVWCR.js} +2 -2
- package/dist/cli/chunks/{chunk-V7ZBPSVG.js → chunk-JFGKC6D4.js} +1 -1
- package/dist/cli/chunks/{chunk-PIXUX2NR.js → chunk-JH5HQ2HW.js} +2 -2
- package/dist/cli/chunks/{chunk-7IDPVSTF.js → chunk-JNLDMRUK.js} +1 -1
- package/dist/cli/chunks/{chunk-SRJ5N7LD.js → chunk-JNURLIOU.js} +2 -2
- package/dist/cli/chunks/{chunk-DBE2LIYG.js → chunk-JOOI3M6I.js} +2 -2
- package/dist/cli/chunks/{chunk-HR6NX6DW.js → chunk-JRCHYAB7.js} +2 -2
- package/dist/cli/chunks/{chunk-5DSANX6S.js → chunk-JZBBCQ7Y.js} +2 -2
- package/dist/cli/chunks/{chunk-3MHWBCSC.js → chunk-K5KL5MPG.js} +1 -1
- package/dist/cli/chunks/{chunk-G6VVOUUF.js → chunk-K7EU2KJF.js} +2 -2
- package/dist/cli/chunks/{chunk-PHRMWRXA.js → chunk-KN6QHR7J.js} +2 -2
- package/dist/cli/chunks/{chunk-S4M7U6CZ.js → chunk-L5W7KTBW.js} +2 -2
- package/dist/cli/chunks/{chunk-LTSNDM5N.js → chunk-LBKEWXMR.js} +2 -2
- package/dist/cli/chunks/{chunk-RZXAXWBD.js → chunk-LH372B74.js} +2 -2
- package/dist/cli/chunks/{chunk-W2VTHUDK.js → chunk-LIIG3F7K.js} +2 -2
- package/dist/cli/chunks/{chunk-MERMCKPG.js → chunk-LUU2O2AZ.js} +1 -1
- package/dist/cli/chunks/{chunk-EVSUZKD5.js → chunk-LYOAIGIT.js} +2 -2
- package/dist/cli/chunks/{chunk-5A6LBGRU.js → chunk-M6NSPXHR.js} +2 -2
- package/dist/cli/chunks/{chunk-IGQPGXP7.js → chunk-MIH7Y46H.js} +2 -2
- package/dist/cli/chunks/{chunk-ESNBKAT6.js → chunk-NKBLXHVM.js} +2 -2
- package/dist/cli/chunks/{chunk-6ZG6TBWF.js → chunk-O4DJLMRE.js} +4 -4
- package/dist/cli/chunks/{chunk-V5RLGPEW.js → chunk-P22YWOM2.js} +2 -2
- package/dist/cli/chunks/{chunk-OMOGD2NN.js → chunk-PMFV3ZFP.js} +2 -2
- package/dist/cli/chunks/{chunk-THYGFSTA.js → chunk-PYQ7VCH2.js} +13 -13
- package/dist/cli/chunks/{chunk-V7I6FTLG.js → chunk-QFBPVPYA.js} +1 -1
- package/dist/cli/chunks/{chunk-33PGBYTC.js → chunk-QPH72S4A.js} +2 -2
- package/dist/cli/chunks/{chunk-BBPOTFIY.js → chunk-QX74JLGO.js} +2 -2
- package/dist/cli/chunks/{chunk-YBUUAFKR.js → chunk-R7IYH6X2.js} +1 -1
- package/dist/cli/chunks/{chunk-6YGFAJ3X.js → chunk-RASEXZD3.js} +1 -1
- package/dist/cli/chunks/{chunk-YJV6TTCW.js → chunk-REVCXO2R.js} +2 -2
- package/dist/cli/chunks/{chunk-HHBFI3YA.js → chunk-RGQ2AOYV.js} +2 -2
- package/dist/cli/chunks/{chunk-O5NEZCTB.js → chunk-RJUWW4XE.js} +1 -1
- package/dist/cli/chunks/{chunk-MTOHV22P.js → chunk-RVG3DAU3.js} +1 -1
- package/dist/cli/chunks/{chunk-LI2IOJMM.js → chunk-RXQCDEDD.js} +1 -1
- package/dist/cli/chunks/{chunk-HGWQC7PR.js → chunk-RYFQYSVF.js} +2 -2
- package/dist/cli/chunks/{chunk-OPOGZAN5.js → chunk-S43X3HTH.js} +2 -2
- package/dist/cli/chunks/{chunk-YUSGT2CU.js → chunk-SLHE7BA3.js} +1 -1
- package/dist/cli/chunks/chunk-TH7BP4KG.js +2 -0
- package/dist/cli/chunks/{chunk-LR5VW3OS.js → chunk-TZFIBU6S.js} +2 -2
- package/dist/cli/chunks/{chunk-2XC4XVCI.js → chunk-UAKD7J72.js} +1 -1
- package/dist/cli/chunks/{chunk-UJMGNO6L.js → chunk-UCBDYSNE.js} +1 -1
- package/dist/cli/chunks/{chunk-4H4PEZUX.js → chunk-ULXDULD6.js} +2 -2
- package/dist/cli/chunks/{chunk-BGRC4676.js → chunk-UZZKBGGQ.js} +3 -3
- package/dist/cli/chunks/{chunk-SJETAUZA.js → chunk-VB2ZBN46.js} +1 -1
- package/dist/cli/chunks/{chunk-YUTSN5BK.js → chunk-VID5XDDQ.js} +2 -2
- package/dist/cli/chunks/{chunk-OK2TFTXP.js → chunk-VR65KHTH.js} +2 -2
- package/dist/cli/chunks/chunk-VSNLUVQI.js +15 -0
- package/dist/cli/chunks/{chunk-IJQJV7BC.js → chunk-WGEKHWCJ.js} +3 -3
- package/dist/cli/chunks/{chunk-BV3SGEV7.js → chunk-WGMA22FN.js} +1 -1
- package/dist/cli/chunks/{chunk-T5ADVYPH.js → chunk-WM6MDDHR.js} +1 -1
- package/dist/cli/chunks/{chunk-6R6QCGNU.js → chunk-WUDJA3B6.js} +2 -2
- package/dist/cli/chunks/{chunk-UUQ3SOKM.js → chunk-XK2IKEXP.js} +1 -1
- package/dist/cli/chunks/{chunk-TX2DBLTL.js → chunk-XLDGQJWP.js} +1 -1
- package/dist/cli/chunks/chunk-XM6CMEQK.js +2 -0
- package/dist/cli/chunks/chunk-XWD7QYS5.js +2 -0
- package/dist/cli/chunks/{chunk-QRTZ67BC.js → chunk-YG5HLQAB.js} +2 -2
- package/dist/cli/chunks/{chunk-MQQANXFS.js → chunk-YIVJD5IY.js} +2 -2
- package/dist/cli/chunks/{chunk-MMVSERJQ.js → chunk-Z6IQMLD7.js} +2 -2
- package/dist/cli/chunks/{chunk-LHDTXTS7.js → chunk-ZQZ4NYTM.js} +1 -1
- package/dist/cli/chunks/{chunk-BDXEL3GM.js → chunk-ZSOPY44S.js} +2 -2
- package/dist/cli/chunks/{chunk-RHXYZ6AZ.js → chunk-ZYF6F4MA.js} +145 -145
- package/dist/cli/chunks/{ci-NSF6OHB4.js → ci-SIPIBCBR.js} +2 -2
- package/dist/cli/chunks/{ci-output-ZPDJ42U3.js → ci-output-TDKJNSD4.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-Y2RUJDYG.js → circuit-breaker-4JC4THEE.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-OH6G6KM2.js → claude-flow-setup-7LCBF65N.js} +2 -2
- package/dist/cli/chunks/client-N53TFCGN.js +2 -0
- package/dist/cli/chunks/{cline-installer-IHH4F27G.js → cline-installer-X3RPF536.js} +2 -2
- package/dist/cli/chunks/{code-SFAHWFTX.js → code-QWSERFVQ.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-GXECMOM2.js → code-index-extractor-B6C35JTM.js} +2 -2
- package/dist/cli/chunks/{codex-installer-UPMSAFCQ.js → codex-installer-A427S2HR.js} +2 -2
- package/dist/cli/chunks/{completions-5TX6LDHY.js → completions-77KS3LAM.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-J2ZR3XZB.js → complexity-analyzer-SJUYVCGS.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-GWYZKB5A.js → continuedev-installer-HQMJQXFA.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-DQZMQWI7.js → copilot-installer-JVWVXFRV.js} +2 -2
- package/dist/cli/chunks/{cost-tracker-V7KIGCLZ.js → cost-tracker-ATJWY2ZJ.js} +2 -2
- package/dist/cli/chunks/{coverage-3X6LA2GZ.js → coverage-OVUELXVF.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-3TYSHECB.js +2 -0
- package/dist/cli/chunks/{cursor-installer-ENDG4JIU.js → cursor-installer-HMRQMVDC.js} +2 -2
- package/dist/cli/chunks/{daemon-4XVAO7GT.js → daemon-KSWTELMB.js} +3 -3
- package/dist/cli/chunks/{daemon-TC65CQFK.js → daemon-PJLXQV52.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-JOSCDRZC.js → dag-attention-scheduler-U2ENVYTQ.js} +2 -2
- package/dist/cli/chunks/{detect-KWZX3OMK.js → detect-TMMIVPON.js} +2 -2
- package/dist/cli/chunks/{dist-node-R4U2PJ47.js → dist-node-ELGZENVQ.js} +2 -2
- package/dist/cli/chunks/{domain-handler-BMYYZO2L.js → domain-handler-XERZXZL6.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-MSDBBDLC.js → domain-transfer-QRERMYSJ.js} +2 -2
- package/dist/cli/chunks/dream-EU6ZE7N7.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-MFINPOLS.js → embed-and-insert-pattern-Q2PARYU4.js} +2 -2
- package/dist/cli/chunks/{eval-OER6UNUY.js → eval-A2QR6KW4.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-F5I77ECG.js → experience-capture-middleware-CQWPD3DM.js} +3 -3
- package/dist/cli/chunks/{fast-paths-P3KT5DUQ.js → fast-paths-IAOUZHSJ.js} +2 -2
- package/dist/cli/chunks/{feature-flags-DYFZSQLV.js → feature-flags-3D74EHP5.js} +2 -2
- package/dist/cli/chunks/{feature-flags-5EBWQ5WU.js → feature-flags-CODLAMZU.js} +2 -2
- package/dist/cli/chunks/{file-discovery-MOBVABSM.js → file-discovery-ZUBZH4Q6.js} +2 -2
- package/dist/cli/chunks/{fleet-J3R3NQNC.js → fleet-TTADPVN2.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-QD76SULF.js → gnn-wrapper-ZFDW3ZAW.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-AJEWTPZ4.js → heartbeat-handler-IV67NVZW.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-JN775DB4.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-PHMYMEDW.js +2 -0
- package/dist/cli/chunks/hnsw-index-BS65TOXD.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-5VRM5N7K.js → hnsw-legacy-bridge-GMFHJ4OK.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-K2VWFDKT.js → hnswlib-node-3LBUPOTX.js} +2 -2
- package/dist/cli/chunks/{hooks-7PMVKQOE.js → hooks-DOGCENUA.js} +34 -34
- package/dist/cli/chunks/{hybrid-router-2K2LW45J.js → hybrid-router-LQO3U6IH.js} +2 -2
- package/dist/cli/chunks/{hypergraph-engine-2CQ735JO.js → hypergraph-engine-KHKAUWVL.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-AQ53GVIW.js → hypergraph-handler-T6X4F24T.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-BR25PT76.js +2 -0
- package/dist/cli/chunks/{init-handler-ZOVJPAWO.js → init-handler-JTXMI2GF.js} +13 -12
- package/dist/cli/chunks/init-wizard-42IYSTTD.js +2 -0
- package/dist/cli/chunks/kernel-JFSTL7NN.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-GWQCNLKI.js → kilocode-installer-P2WDAIOD.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-6KVES4MO.js → kiro-installer-CLTOWLVB.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-JYRFHKO2.js +2 -0
- package/dist/cli/chunks/{learning-6XMNWXRT.js → learning-CNDBY3JP.js} +3 -3
- package/dist/cli/chunks/{llm-router-GS4AZJJC.js → llm-router-SJOZ6EIJ.js} +4 -4
- package/dist/cli/chunks/load-GXZWRYTU.js +2 -0
- package/dist/cli/chunks/load-test-K7XFH5AD.js +2 -0
- package/dist/cli/chunks/{mcp-6V2H7EXU.js → mcp-LLMLANLC.js} +2 -2
- package/dist/cli/chunks/{memory-YLGPOB2H.js → memory-MEBFXR4C.js} +5 -5
- package/dist/cli/chunks/memory-backend-5O4Y5PKW.js +2 -0
- package/dist/cli/chunks/memory-handlers-46WKVXKK.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-SL2EKAH2.js → multi-model-executor-ZO35ZPDR.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-ADOJVGNA.js → opencode-installer-EG2MFPDZ.js} +2 -2
- package/dist/cli/chunks/{orchestrator-O4IWW2VU.js → orchestrator-PXA5IT5X.js} +5 -5
- package/dist/cli/chunks/{pipeline-5BD5YQNQ.js → pipeline-T3XOEAKT.js} +2 -2
- package/dist/cli/chunks/{platform-HXSUOOJH.js → platform-CPKBJ4I6.js} +2 -2
- package/dist/cli/chunks/{plugin-HOLH5CUH.js → plugin-YDP2IK3D.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-PJTL7OLS.js → prime-radiant-advanced-wasm-GDN5WBH2.js} +2 -2
- package/dist/cli/chunks/protocol-executor-VACEWXHI.js +2 -0
- package/dist/cli/chunks/{protocol-handler-K27YGLC7.js → protocol-handler-32QLWTY3.js} +2 -2
- package/dist/cli/chunks/{prove-MHCLHQQ6.js → prove-7JFRIBOM.js} +2 -2
- package/dist/cli/chunks/{provider-manager-3645PPXX.js → provider-manager-TNR7QM6Z.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-4A5MKOA5.js +2 -0
- package/dist/cli/chunks/{quality-NDE6EDOY.js → quality-G36Z4FD3.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-FF3W2BLZ.js +2 -0
- package/dist/cli/chunks/{real-embeddings-VD3EVV3U.js → real-embeddings-RYVIB5N2.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-63Y45UUG.js → roocode-installer-ZANTFQAH.js} +2 -2
- package/dist/cli/chunks/router-OTSEMLFG.js +2 -0
- package/dist/cli/chunks/routing-feedback-PHWP7EO3.js +2 -0
- package/dist/cli/chunks/{routing-handler-76XISU2E.js → routing-handler-6YNDHLBC.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-AEKOZZHZ.js → ruvector-commands-E42JA573.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-4DMUIZQF.js → rvf-dual-writer-SQDEXP45.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-YUTXFOZ3.js → rvf-migration-adapter-DMI4QBRX.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-XJ5N2W37.js → rvf-migration-coordinator-AUEOD5MP.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-E4XSLZPD.js +2 -0
- package/dist/cli/chunks/safe-db-ESTCAWF2.js +2 -0
- package/dist/cli/chunks/schedule-VJYEPFI4.js +2 -0
- package/dist/cli/chunks/scheduler-2SVKVACS.js +2 -0
- package/dist/cli/chunks/{security-6YS6GQGO.js → security-BJTKEGXZ.js} +3 -3
- package/dist/cli/chunks/shared-rvf-adapter-RWX6AAVO.js +2 -0
- package/dist/cli/chunks/{shared-rvf-dual-writer-MH2Y65HA.js → shared-rvf-dual-writer-PIZFXKKE.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-KGN5AIVX.js +2 -0
- package/dist/cli/chunks/{status-handler-57JQMPY5.js → status-handler-BSQJAFH2.js} +2 -2
- package/dist/cli/chunks/{structural-health-34D5VWRD.js → structural-health-ZL4KQNQX.js} +2 -2
- package/dist/cli/chunks/{sync-TTQ6ZB5D.js → sync-BM32HBUY.js} +2 -2
- package/dist/cli/chunks/{sync-HJD2US5P.js → sync-KH3IIPKB.js} +2 -2
- package/dist/cli/chunks/{task-handler-4RF57637.js → task-handler-SWMZVIZ5.js} +2 -2
- package/dist/cli/chunks/{task-handlers-BRSK7HDE.js → task-handlers-PJD6QWQP.js} +3 -3
- package/dist/cli/chunks/{test-GMUW2VR3.js → test-ACQ2N7AK.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-7LF24IFV.js → test-scheduling-BCSHQHZO.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-VYT4RTHU.js → token-bootstrap-7DAATWOU.js} +2 -2
- package/dist/cli/chunks/{token-usage-NFNCPQGW.js → token-usage-AYPCJN77.js} +2 -2
- package/dist/cli/chunks/{transformers-GGD5GIEY.js → transformers-ZYSRJRXA.js} +2 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-HXHBILDS.js +2 -0
- package/dist/cli/chunks/{types-WJ3ZTRD5.js → types-O5ODR3WQ.js} +2 -2
- package/dist/cli/chunks/unified-memory-UBGLIO43.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-BJMFYCFZ.js +2 -0
- package/dist/cli/chunks/unified-persistence-Q54OKOYY.js +2 -0
- package/dist/cli/chunks/{upgrade-IMBT4F6K.js → upgrade-ULP5J35D.js} +2 -2
- package/dist/cli/chunks/{validate-76OVF45Z.js → validate-JS6WD4S5.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-HH2ZYWXA.js → validate-swarm-NCO5QBTJ.js} +2 -2
- package/dist/cli/chunks/{vibium-74WQNDBX.js → vibium-RGRUK6EW.js} +2 -2
- package/dist/cli/chunks/visual-security-RRVHQBRP.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-W6RGE4SL.js → web-tree-sitter-NGX5C2HB.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-7DMSFCA2.js → windsurf-installer-KRAE3JB2.js} +2 -2
- package/dist/cli/chunks/witness-chain-2YIUBXAF.js +2 -0
- package/dist/cli/chunks/{witness-chain-BLZ4ZKAD.js → witness-chain-62V6YLTM.js} +2 -2
- package/dist/cli/chunks/{workflow-RNSDKRZ4.js → workflow-BVMZE2FE.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-VGNC5PFE.js +2 -0
- package/dist/cli/chunks/{wrappers-J7RXMIOY.js → wrappers-SEDAPKCG.js} +2 -2
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +12 -21
- package/dist/cli/handlers/init-handler.js +47 -0
- package/dist/domains/learning-optimization/coordinator-helpers.js +7 -1
- package/dist/domains/learning-optimization/coordinator.js +5 -1
- package/dist/domains/learning-optimization/services/learning-coordinator.js +6 -1
- package/dist/domains/learning-optimization/services/metrics-optimizer.js +4 -1
- package/dist/domains/learning-optimization/services/production-intel.js +14 -5
- package/dist/domains/learning-optimization/services/transfer-specialist.js +12 -4
- package/dist/integrations/embeddings/base/EmbeddingGenerator.d.ts +1 -1
- package/dist/integrations/embeddings/base/EmbeddingGenerator.js +14 -5
- package/dist/integrations/ruvector/rvf-dual-writer.d.ts +22 -0
- package/dist/integrations/ruvector/rvf-dual-writer.js +21 -0
- package/dist/integrations/ruvector/rvf-native-adapter.d.ts +18 -1
- package/dist/integrations/ruvector/rvf-native-adapter.js +15 -1
- package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +46 -1
- package/dist/integrations/ruvector/shared-rvf-adapter.js +137 -0
- package/dist/kernel/hybrid-backend.d.ts +14 -3
- package/dist/kernel/hybrid-backend.js +16 -3
- package/dist/kernel/unified-memory.d.ts +3 -1
- package/dist/kernel/unified-memory.js +28 -3
- package/dist/learning/dream/dream-scheduler.d.ts +18 -0
- package/dist/learning/dream/dream-scheduler.js +68 -0
- package/dist/learning/qe-reasoning-bank.js +19 -2
- package/dist/learning/real-embeddings.js +1 -1
- package/dist/learning/sqlite-persistence.d.ts +11 -0
- package/dist/learning/sqlite-persistence.js +30 -0
- package/dist/mcp/bundle.js +404 -398
- package/dist/shared/parsers/tree-sitter-wasm-parser.js +8 -3
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/shared/utils/index.js +1 -0
- package/dist/shared/utils/kv-date-rehydrate.d.ts +51 -0
- package/dist/shared/utils/kv-date-rehydrate.js +78 -0
- package/dist/workers/workers/learning-consolidation.js +7 -1
- package/package.json +21 -10
- package/dist/cli/chunks/adapter-CDQOF5TF.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-RZK22CJB.js +0 -2
- package/dist/cli/chunks/base-UGH6TVO4.js +0 -2
- package/dist/cli/chunks/browser-workflow-SGOL3FCJ.js +0 -2
- package/dist/cli/chunks/chunk-FIONYUVH.js +0 -2
- package/dist/cli/chunks/chunk-FV2MU6CY.js +0 -2
- package/dist/cli/chunks/chunk-G6AJMFWL.js +0 -15
- package/dist/cli/chunks/chunk-QPYNQSWD.js +0 -9
- package/dist/cli/chunks/chunk-VKCWWR6C.js +0 -2
- package/dist/cli/chunks/chunk-YVQ4PR4H.js +0 -2
- package/dist/cli/chunks/client-QQGRKAY7.js +0 -2
- package/dist/cli/chunks/cross-domain-router-3SHAGRVP.js +0 -2
- package/dist/cli/chunks/dream-OCZK42FM.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-EAVZR6TJ.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-BY4XB7FB.js +0 -2
- package/dist/cli/chunks/hnsw-index-657CZRG7.js +0 -2
- package/dist/cli/chunks/impact-analyzer-GI6UVAMT.js +0 -2
- package/dist/cli/chunks/init-wizard-HOH577MH.js +0 -2
- package/dist/cli/chunks/kernel-JDYBG5GE.js +0 -2
- package/dist/cli/chunks/knowledge-graph-RAQOWLG3.js +0 -2
- package/dist/cli/chunks/load-FEMEQNE6.js +0 -2
- package/dist/cli/chunks/load-test-3MEJ43U2.js +0 -2
- package/dist/cli/chunks/memory-backend-2A47ZRGO.js +0 -2
- package/dist/cli/chunks/memory-handlers-UBTBC7D2.js +0 -2
- package/dist/cli/chunks/protocol-executor-3FR7FBVM.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-CHNYPYQW.js +0 -2
- package/dist/cli/chunks/queen-coordinator-J6ZRYTBX.js +0 -2
- package/dist/cli/chunks/router-23HRN2Z6.js +0 -2
- package/dist/cli/chunks/routing-feedback-R6A4B6ZG.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-QINEJZM7.js +0 -2
- package/dist/cli/chunks/safe-db-YXMCSKFH.js +0 -2
- package/dist/cli/chunks/schedule-XVFD27P5.js +0 -2
- package/dist/cli/chunks/scheduler-NWH2IDEU.js +0 -2
- package/dist/cli/chunks/shared-rvf-adapter-FTZY35WI.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-BR6YJF5P.js +0 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-GKYG6NKT.js +0 -2
- package/dist/cli/chunks/unified-memory-AT3Z4CY7.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-6FOIGINN.js +0 -2
- package/dist/cli/chunks/unified-persistence-TCJB7MQS.js +0 -2
- package/dist/cli/chunks/visual-security-IBAUX2K5.js +0 -2
- package/dist/cli/chunks/witness-chain-GNNF23XU.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-S2YONHGM.js +0 -2
|
@@ -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.9.
|
|
2
|
-
import{d as k,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.9.34");process.exit(0)}
|
|
2
|
+
import{d as k,f as we}from"./chunk-DXKZQYBK.js";import{b as C,d as Z}from"./chunk-VR65KHTH.js";import{a as ye}from"./chunk-DXOFPU3A.js";import{c as Q}from"./chunk-PMFV3ZFP.js";import{a as V,c as ve}from"./chunk-I74WDBHS.js";import{a as J,b as Xe}from"./chunk-IPEUGCUK.js";import{a as ee,d as v,e as te,f as ne}from"./chunk-JH5HQ2HW.js";import{a as b,e as De}from"./chunk-QX74JLGO.js";import{c as R,e as be}from"./chunk-6FNPEC2I.js";function A(i){if(!q.has(i))throw new Error(`Invalid table name: "${i}" is not in the allowlist`);return i}function ze(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(!re.test(t))throw new Error(`Invalid SQL identifier: "${i}" \u2014 part "${t}" does not match pattern ${re}`);return i}var q,re,z=R(()=>{"use strict";q=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"]);re=/^[a-z_][a-z0-9_]{0,62}$/});var D,se,oe,ie,ae,ce,Te,Ee,de,ue,le,pe,ge=R(()=>{"use strict";we();D=9,se=`
|
|
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 k,f as we}from"./chunk-ONNTJXU7.js";import{b as C,d as Z}from"./chun
|
|
|
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
|
-
`,pe=["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 c(o,a,l,E){return o!==l?o-l:a.localeCompare(E)}return{get(){return n.value},set(o,a){let l=a??Date.now();(n.timestamp===0||c(l,i,n.timestamp,n.nodeId)>0)&&(n={value:o,timestamp:l,nodeId:i,version:n.version+1,lastUpdated:Date.now()})},merge(o){let a=o.getState();this.applyState(a)},getState(){return{value:n.value,timestamp:n.timestamp,nodeId:n.nodeId,version:n.version,lastUpdated:n.lastUpdated}},applyState(o){(n.timestamp===0||c(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 j=R(()=>{"use strict"});function I(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[c,o]of Object.entries(t.counts)){let a=e.counts[c]||0;o>a&&(e.counts[c]=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=I(i);return t.applyState(e),t}var U=R(()=>{"use strict"});function F(i){let e=I(i),t=I(i),n=0,c=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++,c=Date.now())},decrement(o=1){if(o<0)throw new Error("Use increment() for negative values");o!==0&&(t.increment(o),n++,c=Date.now())},merge(o){let a=o.getState();this.applyState(a)},getState(){return{positive:e.getState(),negative:t.getState(),version:n,lastUpdated:c}},applyState(o){let a=this.get();e.applyState(o.positive),t.applyState(o.negative);let l=this.get();a!==l&&(n=Math.max(n,o.version)+1,c=Date.now())},getNodeId(){return i}}}function x(i,e){let t=F(i);return t.applyState(e),t}var B=R(()=>{"use strict";U()});function Ue(i,e){return`${i}:${Date.now()}:${e}`}function W(i){return typeof i=="string"?`s:${i}`:typeof i=="number"?`n:${i}`:typeof i=="boolean"?`b:${i}`:`j:${JSON.stringify(i)}`}function Fe(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 C(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function M(i){let e=new Map,t=new Map,n=0,c=Date.now(),o=0;function a(E){let d=e.get(E);if(!d||d.size===0)return!1;let u=t.get(E);if(!u||u.size===0)return!0;for(let m of d)if(!u.has(m))return!0;return!1}function l(E){let d=e.get(E);if(!d)return new Set;let u=t.get(E)||new Set,m=new Set;for(let p of d)u.has(p)||m.add(p);return m}return{has(E){let d=W(E);return a(d)},values(){let E=[];for(let[d]of e)a(d)&&E.push(Fe(d));return E},size(){let E=0;for(let[d]of e)a(d)&&E++;return E},add(E){let d=W(E),u=Ue(i,o++);e.has(d)||e.set(d,new Set),e.get(d).add(u),n++,c=Date.now()},remove(E){let d=W(E),u=e.get(d);if(!u||u.size===0)return;t.has(d)||t.set(d,new Set);let m=t.get(d);for(let p of u)m.add(p);n++,c=Date.now()},merge(E){let d=E.getState();this.applyState(d)},getState(){let E={};for(let[u,m]of e)E[u]=Array.from(m);let d={};for(let[u,m]of t)m.size>0&&(d[u]=Array.from(m));return{elements:E,tombstones:d,version:n,lastUpdated:c}},applyState(E){let d=!1;for(let[u,m]of Object.entries(E.elements)){e.has(u)||e.set(u,new Set);let p=e.get(u);for(let S of m)p.has(S)||(p.add(S),d=!0)}for(let[u,m]of Object.entries(E.tombstones)){t.has(u)||t.set(u,new Set);let p=t.get(u);for(let S of m)p.has(S)||(p.add(S),d=!0)}d&&(n=Math.max(n,E.version)+1,c=Date.now())},getNodeId(){return i},clear(){for(let[E,d]of e){t.has(E)||t.set(E,new Set);let u=t.get(E);for(let m of d)u.add(m)}n++,c=Date.now()}}}function P(i,e){let t=M(i);return t.applyState(e),t}var Y=R(()=>{"use strict";Z()});function H(i){let e={...xe,...i},{nodeId:t,enableDeltaTracking:n,maxDeltaHistory:c}=e,o=new Map,a=new Map,l=new Map,E=new Map,d=0,u=[],m=new Set,p={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function S(s,r,T){let _={key:s,type:r,operation:T,timestamp:Date.now(),nodeId:t};for(let Oe of m)try{Oe(_)}catch(Ae){console.error("[CRDTStore] Error in change listener:",Ae)}}function N(s,r){d++,n&&p[s].add(r)}function K(){if(!n||!(p.registers.size>0||p.gCounters.size>0||p.pnCounters.size>0||p.sets.size>0))return;let r={fromVersion:u.length>0?u[u.length-1].toVersion:0,toVersion:d,timestamp:Date.now(),nodeId:t};if(p.registers.size>0){r.registers={};for(let T of p.registers){let _=o.get(T);_&&(r.registers[T]=_.getState())}p.registers.clear()}if(p.gCounters.size>0){r.gCounters={};for(let T of p.gCounters){let _=a.get(T);_&&(r.gCounters[T]=_.getState())}p.gCounters.clear()}if(p.pnCounters.size>0){r.pnCounters={};for(let T of p.pnCounters){let _=l.get(T);_&&(r.pnCounters[T]=_.getState())}p.pnCounters.clear()}if(p.sets.size>0){r.sets={};for(let T of p.sets){let _=E.get(T);_&&(r.sets[T]=_.getState())}p.sets.clear()}for(u.push(r);u.length>c;)u.shift()}let L={getRegister(s){return o.has(s)||o.set(s,y(t)),o.get(s)},setRegister(s,r){L.getRegister(s).set(r),N("registers",s),S(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 a.has(s)||a.set(s,I(t)),a.get(s)},incrementGCounter(s,r){L.getGCounter(s).increment(r),N("gCounters",s),S(s,"g-counter","increment")},hasGCounter(s){return a.has(s)},deleteGCounter(s){let r=a.delete(s);return r&&N("gCounters",s),r},getCounter(s){return l.has(s)||l.set(s,F(t)),l.get(s)},incrementCounter(s,r){L.getCounter(s).increment(r),N("pnCounters",s),S(s,"pn-counter","increment")},decrementCounter(s,r){L.getCounter(s).decrement(r),N("pnCounters",s),S(s,"pn-counter","decrement")},hasCounter(s){return l.has(s)},deleteCounter(s){let r=l.delete(s);return r&&N("pnCounters",s),r},getSet(s){return E.has(s)||E.set(s,M(t)),E.get(s)},addToSet(s,r){L.getSet(s).add(r),N("sets",s),S(s,"or-set","add")},removeFromSet(s,r){L.getSet(s).remove(r),N("sets",s),S(s,"or-set","remove")},hasSet(s){return E.has(s)},deleteSet(s){let r=E.delete(s);return r&&N("sets",s),r},merge(s){let r=s.getState();L.applyState(r)},getState(){K();let s={version:d,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[r,T]of o)s.registers[r]=T.getState();for(let[r,T]of a)s.gCounters[r]=T.getState();for(let[r,T]of l)s.pnCounters[r]=T.getState();for(let[r,T]of E)s.sets[r]=T.getState();return s},applyState(s){for(let[r,T]of Object.entries(s.registers))o.has(r)?o.get(r).applyState(T):o.set(r,X(t,T)),N("registers",r),S(r,"lww-register","merge");for(let[r,T]of Object.entries(s.gCounters))a.has(r)?a.get(r).applyState(T):a.set(r,w(t,T)),N("gCounters",r),S(r,"g-counter","merge");for(let[r,T]of Object.entries(s.pnCounters))l.has(r)?l.get(r).applyState(T):l.set(r,x(t,T)),N("pnCounters",r),S(r,"pn-counter","merge");for(let[r,T]of Object.entries(s.sets))E.has(r)?E.get(r).applyState(T):E.set(r,P(t,T)),N("sets",r),S(r,"or-set","merge");d=Math.max(d,s.version)+1},getDelta(s){if(K(),u.length===0)return s>=d,null;let r=u.filter(_=>_.toVersion>s);if(r.length===0)return null;let T={fromVersion:s,toVersion:d,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let _ of r)_.registers&&Object.assign(T.registers,_.registers),_.gCounters&&Object.assign(T.gCounters,_.gCounters),_.pnCounters&&Object.assign(T.pnCounters,_.pnCounters),_.sets&&Object.assign(T.sets,_.sets);return Object.keys(T.registers).length===0&&delete T.registers,Object.keys(T.gCounters).length===0&&delete T.gCounters,Object.keys(T.pnCounters).length===0&&delete T.pnCounters,Object.keys(T.sets).length===0&&delete T.sets,T},applyDelta(s){if(s.registers)for(let[r,T]of Object.entries(s.registers))o.has(r)?o.get(r).applyState(T):o.set(r,X(t,T)),N("registers",r),S(r,"lww-register","merge");if(s.gCounters)for(let[r,T]of Object.entries(s.gCounters))a.has(r)?a.get(r).applyState(T):a.set(r,w(t,T)),N("gCounters",r),S(r,"g-counter","merge");if(s.pnCounters)for(let[r,T]of Object.entries(s.pnCounters))l.has(r)?l.get(r).applyState(T):l.set(r,x(t,T)),N("pnCounters",r),S(r,"pn-counter","merge");if(s.sets)for(let[r,T]of Object.entries(s.sets))E.has(r)?E.get(r).applyState(T):E.set(r,P(t,T)),N("sets",r),S(r,"or-set","merge");d=Math.max(d,s.toVersion)+1},getVersion(){return d},getNodeId(){return t},on(s,r){if(s==="change")return m.add(r),()=>{m.delete(r)};throw new Error(`Unknown event type: ${s}`)},removeAllListeners(){m.clear()},keys(s){let r=[];return(!s||s==="lww-register")&&r.push(...Array.from(o.keys())),(!s||s==="g-counter")&&r.push(...Array.from(a.keys())),(!s||s==="pn-counter")&&r.push(...Array.from(l.keys())),(!s||s==="or-set")&&r.push(...Array.from(E.keys())),r},clear(){o.clear(),a.clear(),l.clear(),E.clear(),u.length=0,p.registers.clear(),p.gCounters.clear(),p.pnCounters.clear(),p.sets.clear(),d=0},getStats(){return{total:o.size+a.size+l.size+E.size,registers:o.size,gCounters:a.size,pnCounters:l.size,sets:E.size,version:d,nodeId:t,deltaHistorySize:u.length}}};return L}var xe,me=R(()=>{"use strict";j();U();B();Y();xe={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var _e=R(()=>{"use strict"});var fe=R(()=>{"use strict";j();U();B();Y();me();_e()});var ke={};ve(ke,{ALLOWED_TABLE_NAMES:()=>q,BinaryHeap:()=>ee,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>Le,UnifiedHnswIndex:()=>D,UnifiedMemoryManager:()=>A,clearProjectRootCache:()=>Re,createHnswIndex:()=>te,findProjectRoot:()=>G,getDefaultDbPath:()=>he,getResolvedDefaultConfig:()=>Ce,getUnifiedMemory:()=>Ie,initializeUnifiedMemory:()=>Me,resetUnifiedMemory:()=>Pe,validateTableName:()=>O});import*as g from"fs";import*as Ne from"os";import*as f from"path";function Re(){h=null}function G(i=process.cwd()){if(h)return h;if(process.env.AQE_PROJECT_ROOT)return h=process.env.AQE_PROJECT_ROOT,h;let e=i,t=f.parse(e).root,n=e,c=null,o=null,a=null;for(;n!==t;)g.existsSync(f.join(n,".agentic-qe"))&&(c=n),g.existsSync(f.join(n,".git"))&&o===null&&(o=n),g.existsSync(f.join(n,"package.json"))&&(a=n),n=f.dirname(n);return c?h=c:o?h=o:a?h=a:h=process.cwd(),h}function he(){let i=G();return f.join(i,".agentic-qe","memory.db")}function Ce(){return{...Le,dbPath:he()}}function Ie(i){return A.getInstance(i)}async function Me(i){let e=Ie(i);return await e.initialize(),e}function Pe(){A.resetInstance()}function Ge(){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 $,h,Le,A,Se,qe=R(()=>{Xe();Z();De();be();ye();z();z();ne();ne();ge();fe();$=Q.create("unified-memory"),h=null;Le={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:v.MMAP_SIZE_BYTES,cacheSize:v.CACHE_SIZE_KB,busyTimeout:v.BUSY_TIMEOUT_MS,vectorDimensions:v.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 D("qe-memory");crdtStore=null;constructor(e){let t=Ce();if(this.config={...t,...e},!f.isAbsolute(this.config.dbPath)){let n=G();this.config.dbPath=f.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,Re()}async initialize(){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize()),this.initPromise}async _doInitialize(){if(!this.initialized)try{let e=process.env.AQE_PROJECT_ROOT;if(e){let o=f.resolve(this.config.dbPath),a=f.resolve(e);!o.startsWith(a)&&!o.startsWith(Ne.tmpdir())&&o.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${e}". Redirecting to test-safe path.`),this.config.dbPath=f.join(e,".agentic-qe","memory.db"))}let t=f.dirname(this.config.dbPath);g.existsSync(t)||g.mkdirSync(t,{recursive:!0});let n=g.existsSync(this.config.dbPath),c=0;if(n)c=g.statSync(this.config.dbPath).size;else if(g.existsSync(t)){let o=this.findRecentBackups(t);if(o.length>0){let a=o[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
|
|
554
|
+
`,pe=["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 T(o,a,u,d){return o!==u?o-u:a.localeCompare(d)}return{get(){return n.value},set(o,a){let u=a??Date.now();(n.timestamp===0||T(u,i,n.timestamp,n.nodeId)>0)&&(n={value:o,timestamp:u,nodeId:i,version:n.version+1,lastUpdated:Date.now()})},merge(o){let a=o.getState();this.applyState(a)},getState(){return{value:n.value,timestamp:n.timestamp,nodeId:n.nodeId,version:n.version,lastUpdated:n.lastUpdated}},applyState(o){(n.timestamp===0||T(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 j=R(()=>{"use strict"});function I(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[T,o]of Object.entries(t.counts)){let a=e.counts[T]||0;o>a&&(e.counts[T]=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=I(i);return t.applyState(e),t}var U=R(()=>{"use strict"});function F(i){let e=I(i),t=I(i),n=0,T=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++,T=Date.now())},decrement(o=1){if(o<0)throw new Error("Use increment() for negative values");o!==0&&(t.increment(o),n++,T=Date.now())},merge(o){let a=o.getState();this.applyState(a)},getState(){return{positive:e.getState(),negative:t.getState(),version:n,lastUpdated:T}},applyState(o){let a=this.get();e.applyState(o.positive),t.applyState(o.negative);let u=this.get();a!==u&&(n=Math.max(n,o.version)+1,T=Date.now())},getNodeId(){return i}}}function x(i,e){let t=F(i);return t.applyState(e),t}var B=R(()=>{"use strict";U()});function Ue(i,e){return`${i}:${Date.now()}:${e}`}function W(i){return typeof i=="string"?`s:${i}`:typeof i=="number"?`n:${i}`:typeof i=="boolean"?`b:${i}`:`j:${JSON.stringify(i)}`}function Fe(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 C(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function M(i){let e=new Map,t=new Map,n=0,T=Date.now(),o=0;function a(d){let E=e.get(d);if(!E||E.size===0)return!1;let l=t.get(d);if(!l||l.size===0)return!0;for(let m of E)if(!l.has(m))return!0;return!1}function u(d){let E=e.get(d);if(!E)return new Set;let l=t.get(d)||new Set,m=new Set;for(let p of E)l.has(p)||m.add(p);return m}return{has(d){let E=W(d);return a(E)},values(){let d=[];for(let[E]of e)a(E)&&d.push(Fe(E));return d},size(){let d=0;for(let[E]of e)a(E)&&d++;return d},add(d){let E=W(d),l=Ue(i,o++);e.has(E)||e.set(E,new Set),e.get(E).add(l),n++,T=Date.now()},remove(d){let E=W(d),l=e.get(E);if(!l||l.size===0)return;t.has(E)||t.set(E,new Set);let m=t.get(E);for(let p of l)m.add(p);n++,T=Date.now()},merge(d){let E=d.getState();this.applyState(E)},getState(){let d={};for(let[l,m]of e)d[l]=Array.from(m);let E={};for(let[l,m]of t)m.size>0&&(E[l]=Array.from(m));return{elements:d,tombstones:E,version:n,lastUpdated:T}},applyState(d){let E=!1;for(let[l,m]of Object.entries(d.elements)){e.has(l)||e.set(l,new Set);let p=e.get(l);for(let S of m)p.has(S)||(p.add(S),E=!0)}for(let[l,m]of Object.entries(d.tombstones)){t.has(l)||t.set(l,new Set);let p=t.get(l);for(let S of m)p.has(S)||(p.add(S),E=!0)}E&&(n=Math.max(n,d.version)+1,T=Date.now())},getNodeId(){return i},clear(){for(let[d,E]of e){t.has(d)||t.set(d,new Set);let l=t.get(d);for(let m of E)l.add(m)}n++,T=Date.now()}}}function P(i,e){let t=M(i);return t.applyState(e),t}var Y=R(()=>{"use strict";Z()});function H(i){let e={...xe,...i},{nodeId:t,enableDeltaTracking:n,maxDeltaHistory:T}=e,o=new Map,a=new Map,u=new Map,d=new Map,E=0,l=[],m=new Set,p={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function S(s,r,c){let _={key:s,type:r,operation:c,timestamp:Date.now(),nodeId:t};for(let Ae of m)try{Ae(_)}catch(Oe){console.error("[CRDTStore] Error in change listener:",Oe)}}function N(s,r){E++,n&&p[s].add(r)}function K(){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 c of p.registers){let _=o.get(c);_&&(r.registers[c]=_.getState())}p.registers.clear()}if(p.gCounters.size>0){r.gCounters={};for(let c of p.gCounters){let _=a.get(c);_&&(r.gCounters[c]=_.getState())}p.gCounters.clear()}if(p.pnCounters.size>0){r.pnCounters={};for(let c of p.pnCounters){let _=u.get(c);_&&(r.pnCounters[c]=_.getState())}p.pnCounters.clear()}if(p.sets.size>0){r.sets={};for(let c of p.sets){let _=d.get(c);_&&(r.sets[c]=_.getState())}p.sets.clear()}for(l.push(r);l.length>T;)l.shift()}let L={getRegister(s){return o.has(s)||o.set(s,y(t)),o.get(s)},setRegister(s,r){L.getRegister(s).set(r),N("registers",s),S(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 a.has(s)||a.set(s,I(t)),a.get(s)},incrementGCounter(s,r){L.getGCounter(s).increment(r),N("gCounters",s),S(s,"g-counter","increment")},hasGCounter(s){return a.has(s)},deleteGCounter(s){let r=a.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){L.getCounter(s).increment(r),N("pnCounters",s),S(s,"pn-counter","increment")},decrementCounter(s,r){L.getCounter(s).decrement(r),N("pnCounters",s),S(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){L.getSet(s).add(r),N("sets",s),S(s,"or-set","add")},removeFromSet(s,r){L.getSet(s).remove(r),N("sets",s),S(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();L.applyState(r)},getState(){K();let s={version:E,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[r,c]of o)s.registers[r]=c.getState();for(let[r,c]of a)s.gCounters[r]=c.getState();for(let[r,c]of u)s.pnCounters[r]=c.getState();for(let[r,c]of d)s.sets[r]=c.getState();return s},applyState(s){for(let[r,c]of Object.entries(s.registers))o.has(r)?o.get(r).applyState(c):o.set(r,X(t,c)),N("registers",r),S(r,"lww-register","merge");for(let[r,c]of Object.entries(s.gCounters))a.has(r)?a.get(r).applyState(c):a.set(r,w(t,c)),N("gCounters",r),S(r,"g-counter","merge");for(let[r,c]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(c):u.set(r,x(t,c)),N("pnCounters",r),S(r,"pn-counter","merge");for(let[r,c]of Object.entries(s.sets))d.has(r)?d.get(r).applyState(c):d.set(r,P(t,c)),N("sets",r),S(r,"or-set","merge");E=Math.max(E,s.version)+1},getDelta(s){if(K(),l.length===0)return s>=E,null;let r=l.filter(_=>_.toVersion>s);if(r.length===0)return null;let c={fromVersion:s,toVersion:E,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let _ of r)_.registers&&Object.assign(c.registers,_.registers),_.gCounters&&Object.assign(c.gCounters,_.gCounters),_.pnCounters&&Object.assign(c.pnCounters,_.pnCounters),_.sets&&Object.assign(c.sets,_.sets);return Object.keys(c.registers).length===0&&delete c.registers,Object.keys(c.gCounters).length===0&&delete c.gCounters,Object.keys(c.pnCounters).length===0&&delete c.pnCounters,Object.keys(c.sets).length===0&&delete c.sets,c},applyDelta(s){if(s.registers)for(let[r,c]of Object.entries(s.registers))o.has(r)?o.get(r).applyState(c):o.set(r,X(t,c)),N("registers",r),S(r,"lww-register","merge");if(s.gCounters)for(let[r,c]of Object.entries(s.gCounters))a.has(r)?a.get(r).applyState(c):a.set(r,w(t,c)),N("gCounters",r),S(r,"g-counter","merge");if(s.pnCounters)for(let[r,c]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(c):u.set(r,x(t,c)),N("pnCounters",r),S(r,"pn-counter","merge");if(s.sets)for(let[r,c]of Object.entries(s.sets))d.has(r)?d.get(r).applyState(c):d.set(r,P(t,c)),N("sets",r),S(r,"or-set","merge");E=Math.max(E,s.toVersion)+1},getVersion(){return E},getNodeId(){return t},on(s,r){if(s==="change")return m.add(r),()=>{m.delete(r)};throw new Error(`Unknown event type: ${s}`)},removeAllListeners(){m.clear()},keys(s){let r=[];return(!s||s==="lww-register")&&r.push(...Array.from(o.keys())),(!s||s==="g-counter")&&r.push(...Array.from(a.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(),a.clear(),u.clear(),d.clear(),l.length=0,p.registers.clear(),p.gCounters.clear(),p.pnCounters.clear(),p.sets.clear(),E=0},getStats(){return{total:o.size+a.size+u.size+d.size,registers:o.size,gCounters:a.size,pnCounters:u.size,sets:d.size,version:E,nodeId:t,deltaHistorySize:l.length}}};return L}var xe,me=R(()=>{"use strict";j();U();B();Y();xe={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var _e=R(()=>{"use strict"});var fe=R(()=>{"use strict";j();U();B();Y();me();_e()});var ke={};be(ke,{ALLOWED_TABLE_NAMES:()=>q,BinaryHeap:()=>ee,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>Le,UnifiedHnswIndex:()=>v,UnifiedMemoryManager:()=>O,clearProjectRootCache:()=>Re,createHnswIndex:()=>te,findProjectRoot:()=>G,getDefaultDbPath:()=>he,getResolvedDefaultConfig:()=>Ce,getUnifiedMemory:()=>Ie,initializeUnifiedMemory:()=>Me,resetUnifiedMemory:()=>Pe,validateTableName:()=>A});import*as g from"fs";import*as Ne from"os";import*as f from"path";function Re(){h=null}function G(i=process.cwd()){if(h)return h;if(process.env.AQE_PROJECT_ROOT)return h=process.env.AQE_PROJECT_ROOT,h;let e=i,t=f.parse(e).root,n=e,T=null,o=null,a=null;for(;n!==t;)g.existsSync(f.join(n,".agentic-qe"))&&(T=n),g.existsSync(f.join(n,".git"))&&o===null&&(o=n),g.existsSync(f.join(n,"package.json"))&&(a=n),n=f.dirname(n);return T?h=T:o?h=o:a?h=a:h=process.cwd(),h}function he(){let i=G();return f.join(i,".agentic-qe","memory.db")}function Ce(){return{...Le,dbPath:he()}}function Ie(i){return O.getInstance(i)}async function Me(i){let e=Ie(i);return await e.initialize(),e}function Pe(){O.resetInstance()}function Ge(){if(Se)return;Se=!0;let i=()=>{try{let e=O.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 $,h,Le,O,Se,qe=R(()=>{Xe();Z();ve();De();ye();z();z();ne();ne();ge();fe();$=Q.create("unified-memory"),h=null;Le={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:b.MMAP_SIZE_BYTES,cacheSize:b.CACHE_SIZE_KB,busyTimeout:b.BUSY_TIMEOUT_MS,vectorDimensions:b.DEFAULT_VECTOR_DIMENSIONS};O=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},!f.isAbsolute(this.config.dbPath)){let n=G();this.config.dbPath=f.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,Re()}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 a=f.resolve(this.config.dbPath),u=f.resolve(t);!a.startsWith(u)&&!a.startsWith(Ne.tmpdir())&&a.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=f.join(t,".agentic-qe","memory.db"))}let n=f.dirname(this.config.dbPath);g.existsSync(n)||g.mkdirSync(n,{recursive:!0});let T=g.existsSync(this.config.dbPath),o=0;if(T)o=g.statSync(this.config.dbPath).size;else if(g.existsSync(n)){let a=this.findRecentBackups(n);if(a.length>0){let u=a[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...`),g.copyFileSync(
|
|
558
|
-
DB was ${(
|
|
556
|
+
Found ${a.length} backup(s), newest: ${u.path} (${(u.size/1024/1024).toFixed(1)}MB)
|
|
557
|
+
Restoring from backup to prevent data loss...`),g.copyFileSync(u.path,this.config.dbPath);for(let d of["-wal","-shm"]){let E=this.config.dbPath+d;g.existsSync(E)&&g.unlinkSync(E)}o=u.size}}if(e?.throwIfAborted(),this.db=J(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(),T&&o>1e6)try{let a=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get();if(a&&a.cnt===0){let u=g.statSync(this.config.dbPath).size;u<o*.1&&console.error(`[UnifiedMemory] CRITICAL: Possible data loss detected!
|
|
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 ${
|
|
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: ${V(t)}`)}}}findRecentBackups(e){try{let n=g.readdirSync(e).filter(o=>o.startsWith("memory")&&o.endsWith(".db")&&o!=="memory.db").map(o=>{let a=f.join(e,o),u=g.statSync(a);return{path:a,size:u.size,mtime:u.mtimeMs}}).filter(o=>o.size>1e6).sort((o,a)=>a.mtime-o.mtime),T=f.join(e,"backups");if(g.existsSync(T)){let o=g.readdirSync(T);for(let a of o)if(a.endsWith(".db")){let u=f.join(T,a),d=g.statSync(u);d.size>1e6&&n.push({path:u,size:d.size,mtime:d.mtimeMs})}n.sort((a,u)=>u.mtime-a.mtime)}return n}catch{return[]}}warnIfDuplicateDatabases(){try{let e=G(),t=f.resolve(this.config.dbPath),T=[f.join(e,".agentic-qe","memory.db"),f.join(e,"v3",".agentic-qe","memory.db")].map(o=>f.resolve(o)).filter(o=>o!==t&&g.existsSync(o));T.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){$.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let n=
|
|
562
|
+
Duplicates: ${T.join(", ")}
|
|
563
|
+
This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){$.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let n=A(e);return this.db.prepare(`PRAGMA table_info(${n})`).all().some(o=>o.name===t)}catch(n){return $.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:T}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,n)){let a=A(t);try{this.db.exec(`ALTER TABLE ${a} ADD COLUMN ${n} ${T}`),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(se),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(oe),t<2&&this.db.exec(ie),t<3&&(this.db.exec(ae),this.db.exec(ce),this.db.exec(Te)),t<4&&this.db.exec(Ee),t<5&&this.db.exec(de),t<6&&this.db.exec(k),t<7&&this.db.exec(ue),t<8&&this.db.exec(le),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,7 +589,7 @@ import{d as k,f as we}from"./chunk-ONNTJXU7.js";import{b as C,d as Z}from"./chun
|
|
|
589
589
|
`)),this.db.prepare(`
|
|
590
590
|
INSERT OR REPLACE INTO schema_version (id, version, migrated_at)
|
|
591
591
|
VALUES (1, ?, datetime('now'))
|
|
592
|
-
`).run(
|
|
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",T){this.ensureInitialized();let o=T?Date.now()+T*1e3:null,a=JSON.stringify(t);this.db.prepare(`
|
|
593
593
|
INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
|
|
594
594
|
VALUES (?, ?, ?, ?)
|
|
595
595
|
`).run(e,n,a,o)}async kvGet(e,t="default"){this.ensureInitialized();let n=this.db.prepare(`
|
|
@@ -598,14 +598,14 @@ import{d as k,f as we}from"./chunk-ONNTJXU7.js";import{b as C,d as Z}from"./chun
|
|
|
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 C(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 T=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,T,Date.now(),n).map(a=>a.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",T){this.ensureInitialized();let o=this.floatArrayToBuffer(t),a=T?JSON.stringify(T):null;this.db.prepare(`
|
|
607
607
|
INSERT OR REPLACE INTO vectors (id, namespace, embedding, dimensions, metadata, updated_at)
|
|
608
608
|
VALUES (?, ?, ?, ?, ?, datetime('now'))
|
|
609
609
|
`).run(e,n,o,t.length,a),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?C(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?C(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 T=this.vectorIndex.search(e,t*2);if(T.length===0)return[];let o=T.map(E=>E.id),a=o.map(()=>"?").join(","),u=this.db.prepare(`SELECT id, namespace, metadata FROM vectors WHERE id IN (${a})`).all(...o),d=new Map(u.map(E=>[E.id,E]));if(n){let E=[];for(let l of T){let m=d.get(l.id);if(m&&m.namespace===n&&(E.push({id:l.id,score:l.score,metadata:m.metadata?C(m.metadata):void 0}),E.length>=t))break}return E}return T.slice(0,t).map(E=>{let l=d.get(E.id);return{id:E.id,score:E.score,metadata:l?.metadata?C(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=A(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=H({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 T=0;T<t;T++)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=pe.map(T=>{try{let o=this.db.prepare(`SELECT COUNT(*) as count FROM ${T}`).get();return{name:T,rowCount:o.count}}catch(o){return $.debug("Table row count query failed",{table:T,error:o instanceof Error?o.message:String(o)}),{name:T,rowCount:0}}}),t=0,n=0;try{g.existsSync(this.config.dbPath)&&(t=g.statSync(this.config.dbPath).size);let T=this.config.dbPath+"-wal";g.existsSync(T)&&(n=g.statSync(T).size)}catch(T){console.debug("[UnifiedMemory] File stat error:",T instanceof Error?T.message:T)}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;Ge()});export{q as a,A as b,ze as c,z as d,Re as e,G as f,he as g,Le as h,Ce as i,O as j,Ie as k,Me as l,Pe as m,ke as n,qe as o};
|
|
@@ -1,4 +1,4 @@
|
|
|
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.9.
|
|
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.9.34");process.exit(0)}
|
|
2
2
|
var i={domain:"test-generation",bestPractices:["Follow Arrange-Act-Assert (AAA) pattern for clear test structure","One logical assertion per test - test one behavior at a time","Use descriptive test names: should_returnValue_when_condition","Mock external dependencies to isolate unit under test","Test edge cases and boundary conditions, not just happy paths","Keep tests deterministic - avoid time-dependent assertions","Use test data builders or factories for complex objects","Prefer integration tests for workflows, unit tests for logic","Maintain test independence - no shared mutable state between tests","Write failing test first (TDD Red) before implementation"],antiPatterns:[{name:"God Test",description:"A single test that verifies too many behaviors",reason:"Hard to diagnose failures, brittle, slow to run",alternative:"Split into focused tests, each verifying one behavior",detection:"expect.*expect.*expect.*expect.*expect"},{name:"Mystery Guest",description:"Test relies on external data files or state not visible in test",reason:"Tests are hard to understand and maintain",alternative:"Make test data explicit within the test or use fixtures"},{name:"Eager Test",description:"Test that verifies more than needed for the current behavior",reason:"Creates unnecessary coupling, breaks easily",alternative:"Only assert what is necessary for this specific test case"},{name:"Flaky Assertion",description:"Assertions that depend on timing, order, or external state",reason:"Creates unreliable test suite, erodes trust",alternative:"Use deterministic assertions, mock time/random",detection:"setTimeout|Date\\.now|Math\\.random"},{name:"Test Code Duplication",description:"Same setup or assertion code repeated across tests",reason:"Maintenance burden, inconsistency risk",alternative:"Extract to beforeEach, helpers, or fixtures"}],frameworkGuidance:{jest:["Use describe blocks to group related tests","Prefer toEqual for deep equality, toBe for primitives","Use jest.mock() at module level for consistent mocking","Use jest.spyOn for partial mocking of objects","Enable --coverage to track test coverage"],vitest:["Use vi.mock() for module mocking","Prefer vi.fn() over jest.fn() syntax","Use vitest/ui for interactive test debugging","Enable browser mode for component tests","Use inline snapshots for small expected values"],mocha:["Use beforeEach/afterEach for setup/teardown","Combine with chai for assertions","Use sinon for spies, stubs, and mocks","Set appropriate timeouts for async tests"],pytest:["Use fixtures for reusable test setup","Use parametrize for data-driven tests","Use conftest.py for shared fixtures","Use pytest.raises for exception testing","Use pytest-cov for coverage reporting"],junit:["Use @BeforeEach and @AfterEach for setup/teardown","Use @DisplayName for readable test names","Use @ParameterizedTest for data-driven tests","Use Mockito for mocking dependencies"],testng:["Use @BeforeMethod and @AfterMethod appropriately","Use @DataProvider for parameterized tests","Configure test groups for selective execution"],playwright:["Use page.locator() for resilient element selection","Use expect(locator) for auto-waiting assertions","Use page.waitForLoadState for navigation","Use test.describe for grouping tests","Use fixtures for reusable browser contexts"],cypress:["Use cy.intercept() for API mocking","Avoid conditional testing - use deterministic state","Use data-cy attributes for stable selectors","Use cy.within() for scoped queries","Prefer cy.contains() for text-based selection"],selenium:["Use explicit waits over implicit waits","Use Page Object Model for maintainability","Handle stale element references with retry logic","Clean up browser state between tests"]},languageGuidance:{typescript:["Use type assertions in tests for better IDE support","Create typed test fixtures and builders","Use satisfies operator for test data validation","Mock types with ts-mockito or typed mocking libs"],javascript:["Use JSDoc comments for test documentation","Consider TypeScript for larger test suites","Use ESLint with testing plugins"],python:["Use type hints in test functions","Use dataclasses for test data","Follow PEP 8 naming: test_should_do_something"],java:["Use AssertJ for fluent assertions","Use Lombok for test data classes","Follow naming: shouldDoSomething_whenCondition"],go:["Use table-driven tests for multiple cases","Use testify for assertions and mocking","Place tests in _test.go files"],rust:["Use #[test] attribute for test functions","Use assert!, assert_eq!, assert_ne! macros","Place unit tests in same file with #[cfg(test)]"],csharp:["Use xUnit or NUnit for testing","Use FluentAssertions for readable assertions","Use Moq for mocking interfaces"],kotlin:["Use kotest for BDD-style testing","Use MockK for Kotlin-first mocking","Use data classes for test fixtures"]},examples:[{title:"Unit Test Template (TypeScript + Vitest)",description:"Standard AAA pattern for unit tests",content:`describe('UserService', () => {
|
|
3
3
|
describe('createUser', () => {
|
|
4
4
|
it('should create user with valid data', async () => {
|
|
@@ -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.9.
|
|
2
|
-
import{c as s,e as t}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.9.34");process.exit(0)}
|
|
2
|
+
import{c as s,e as t}from"./chunk-6FNPEC2I.js";var K={};t(K,{DEFAULT_FEATURE_FLAGS:()=>r,getRuVectorFeatureFlags:()=>i,getRvfMigrationStage:()=>H,initFeatureFlagsFromEnv:()=>z,isAgentMemoryBranchingEnabled:()=>I,isCNNVisualRegressionEnabled:()=>b,isCognitiveRoutingEnabled:()=>Y,isCoherenceActionGateEnabled:()=>A,isCoherenceGateEnabled:()=>f,isColdTierGNNEnabled:()=>m,isCrossDomainTransferEnabled:()=>N,isCusumDriftDetectionEnabled:()=>M,isDAGAttentionEnabled:()=>g,isDeltaEventSourcingEnabled:()=>F,isDeterministicDitherEnabled:()=>C,isEpropOnlineLearningEnabled:()=>Q,isEwcPlusPlusEnabled:()=>L,isFlashAttentionEnabled:()=>E,isGNNIndexEnabled:()=>R,isGrangerCausalityEnabled:()=>B,isGraphMAEEnabled:()=>x,isHDCFingerprintingEnabled:()=>D,isHnswHealthMonitorEnabled:()=>U,isHopfieldMemoryEnabled:()=>h,isHyperbolicHnswEnabled:()=>k,isMetaLearningEnabled:()=>P,isMetadataFilteringEnabled:()=>S,isNativeHNSWEnabled:()=>_,isNeuralRoutingEnabled:()=>T,isRVFPatternStoreEnabled:()=>V,isReasoningQECEnabled:()=>v,isRegretTrackingEnabled:()=>O,isReservoirReplayEnabled:()=>w,isSONAEnabled:()=>a,isSONAThreeLoopEnabled:()=>p,isSpectralSparsificationEnabled:()=>W,isSublinearSolverEnabled:()=>y,isTemporalCompressionEnabled:()=>c,isUnifiedHnswEnabled:()=>G,isWitnessChainEnabled:()=>d,resetRuVectorFeatureFlags:()=>u,setRuVectorFeatureFlags:()=>o,shouldLogMigrationMetrics:()=>l});function i(){return{...e}}function o(n){e={...e,...n}}function u(){e={...r}}function a(){return e.useQESONA}function E(){return e.useQEFlashAttention}function R(){return e.useQEGNNIndex}function l(){return e.logMigrationMetrics}function _(){return e.useNativeHNSW}function c(){return e.useTemporalCompression}function S(){return e.useMetadataFiltering}function C(){return e.useDeterministicDither}function T(){return e.useNeuralRouting}function p(){return e.useSONAThreeLoop}function N(){return e.useCrossDomainTransfer}function U(){return e.useHnswHealthMonitor}function O(){return e.useRegretTracking}function f(){return e.useCoherenceGate}function d(){return e.useWitnessChain}function b(){return e.useCNNVisualRegression}function g(){return e.useDAGAttention}function A(){return e.useCoherenceActionGate}function v(){return e.useReasoningQEC}function V(){return e.useRVFPatternStore}function I(){return e.useAgentMemoryBranching}function G(){return e.useUnifiedHnsw}function H(){return e.rvfMigrationStage}function D(){return e.useHDCFingerprinting}function M(){return e.useCusumDriftDetection}function F(){return e.useDeltaEventSourcing}function L(){return e.useEwcPlusPlusRegularization}function x(){return e.useGraphMAEEmbeddings}function h(){return e.useHopfieldMemory}function m(){return e.useColdTierGNN}function P(){return e.useMetaLearningEnhancements}function y(){return e.useSublinearSolver}function W(){return e.useSpectralSparsification}function w(){return e.useReservoirReplay}function Q(){return e.useEpropOnlineLearning}function B(){return e.useGrangerCausality}function Y(){return e.useCognitiveRouting}function k(){return e.useHyperbolicHnsw}function z(){let n={};process.env.RUVECTOR_USE_SONA!==void 0&&(n.useQESONA=process.env.RUVECTOR_USE_SONA==="true"),process.env.RUVECTOR_USE_FLASH_ATTENTION!==void 0&&(n.useQEFlashAttention=process.env.RUVECTOR_USE_FLASH_ATTENTION==="true"),process.env.RUVECTOR_USE_GNN_INDEX!==void 0&&(n.useQEGNNIndex=process.env.RUVECTOR_USE_GNN_INDEX==="true"),process.env.RUVECTOR_LOG_MIGRATION_METRICS!==void 0&&(n.logMigrationMetrics=process.env.RUVECTOR_LOG_MIGRATION_METRICS==="true"),process.env.RUVECTOR_USE_NATIVE_HNSW!==void 0&&(n.useNativeHNSW=process.env.RUVECTOR_USE_NATIVE_HNSW==="true"),process.env.RUVECTOR_USE_TEMPORAL_COMPRESSION!==void 0&&(n.useTemporalCompression=process.env.RUVECTOR_USE_TEMPORAL_COMPRESSION==="true"),process.env.RUVECTOR_USE_METADATA_FILTERING!==void 0&&(n.useMetadataFiltering=process.env.RUVECTOR_USE_METADATA_FILTERING==="true"),process.env.RUVECTOR_USE_DETERMINISTIC_DITHER!==void 0&&(n.useDeterministicDither=process.env.RUVECTOR_USE_DETERMINISTIC_DITHER==="true"),process.env.RUVECTOR_USE_NEURAL_ROUTING!==void 0&&(n.useNeuralRouting=process.env.RUVECTOR_USE_NEURAL_ROUTING==="true"),process.env.RUVECTOR_USE_SONA_THREE_LOOP!==void 0&&(n.useSONAThreeLoop=process.env.RUVECTOR_USE_SONA_THREE_LOOP==="true"),process.env.RUVECTOR_USE_CROSS_DOMAIN_TRANSFER!==void 0&&(n.useCrossDomainTransfer=process.env.RUVECTOR_USE_CROSS_DOMAIN_TRANSFER==="true"),process.env.RUVECTOR_USE_HNSW_HEALTH_MONITOR!==void 0&&(n.useHnswHealthMonitor=process.env.RUVECTOR_USE_HNSW_HEALTH_MONITOR==="true"),process.env.RUVECTOR_USE_REGRET_TRACKING!==void 0&&(n.useRegretTracking=process.env.RUVECTOR_USE_REGRET_TRACKING==="true"),process.env.RUVECTOR_USE_COHERENCE_GATE!==void 0&&(n.useCoherenceGate=process.env.RUVECTOR_USE_COHERENCE_GATE==="true"),process.env.RUVECTOR_USE_WITNESS_CHAIN!==void 0&&(n.useWitnessChain=process.env.RUVECTOR_USE_WITNESS_CHAIN==="true"),process.env.RUVECTOR_USE_CNN_VISUAL_REGRESSION!==void 0&&(n.useCNNVisualRegression=process.env.RUVECTOR_USE_CNN_VISUAL_REGRESSION==="true"),process.env.RUVECTOR_USE_DAG_ATTENTION!==void 0&&(n.useDAGAttention=process.env.RUVECTOR_USE_DAG_ATTENTION==="true"),process.env.RUVECTOR_USE_COHERENCE_ACTION_GATE!==void 0&&(n.useCoherenceActionGate=process.env.RUVECTOR_USE_COHERENCE_ACTION_GATE==="true"),process.env.RUVECTOR_USE_REASONING_QEC!==void 0&&(n.useReasoningQEC=process.env.RUVECTOR_USE_REASONING_QEC==="true"),process.env.RUVECTOR_USE_HDC_FINGERPRINTING!==void 0&&(n.useHDCFingerprinting=process.env.RUVECTOR_USE_HDC_FINGERPRINTING==="true"),process.env.RUVECTOR_USE_CUSUM_DRIFT_DETECTION!==void 0&&(n.useCusumDriftDetection=process.env.RUVECTOR_USE_CUSUM_DRIFT_DETECTION==="true"),process.env.RUVECTOR_USE_DELTA_EVENT_SOURCING!==void 0&&(n.useDeltaEventSourcing=process.env.RUVECTOR_USE_DELTA_EVENT_SOURCING==="true"),process.env.RUVECTOR_USE_EWC_PLUS_PLUS!==void 0&&(n.useEwcPlusPlusRegularization=process.env.RUVECTOR_USE_EWC_PLUS_PLUS==="true"),process.env.RUVECTOR_USE_META_LEARNING!==void 0&&(n.useMetaLearningEnhancements=process.env.RUVECTOR_USE_META_LEARNING==="true"),process.env.RUVECTOR_USE_SUBLINEAR_SOLVER!==void 0&&(n.useSublinearSolver=process.env.RUVECTOR_USE_SUBLINEAR_SOLVER==="true"),process.env.RUVECTOR_USE_SPECTRAL_SPARSIFICATION!==void 0&&(n.useSpectralSparsification=process.env.RUVECTOR_USE_SPECTRAL_SPARSIFICATION==="true"),process.env.RUVECTOR_USE_RESERVOIR_REPLAY!==void 0&&(n.useReservoirReplay=process.env.RUVECTOR_USE_RESERVOIR_REPLAY==="true"),process.env.RUVECTOR_USE_EPROP_ONLINE_LEARNING!==void 0&&(n.useEpropOnlineLearning=process.env.RUVECTOR_USE_EPROP_ONLINE_LEARNING==="true"),process.env.RUVECTOR_USE_GRANGER_CAUSALITY!==void 0&&(n.useGrangerCausality=process.env.RUVECTOR_USE_GRANGER_CAUSALITY==="true"),process.env.RUVECTOR_USE_COGNITIVE_ROUTING!==void 0&&(n.useCognitiveRouting=process.env.RUVECTOR_USE_COGNITIVE_ROUTING==="true"),process.env.RUVECTOR_USE_HYPERBOLIC_HNSW!==void 0&&(n.useHyperbolicHnsw=process.env.RUVECTOR_USE_HYPERBOLIC_HNSW==="true"),o(n)}var r,e,X=s(()=>{r={useQESONA:!0,useQEFlashAttention:!0,useQEGNNIndex:!0,logMigrationMetrics:!0,useNativeHNSW:!0,useTemporalCompression:!0,useMetadataFiltering:!0,useDeterministicDither:!0,useNeuralRouting:!0,useSONAThreeLoop:!0,useCrossDomainTransfer:!0,useHnswHealthMonitor:!0,useRegretTracking:!0,useCoherenceGate:!0,useWitnessChain:!0,useCNNVisualRegression:!0,useDAGAttention:!0,useCoherenceActionGate:!0,useReasoningQEC:!0,useRVFPatternStore:!0,useAgentMemoryBranching:!0,useUnifiedHnsw:!0,rvfMigrationStage:2,useHDCFingerprinting:!0,useCusumDriftDetection:!0,useDeltaEventSourcing:!0,useEwcPlusPlusRegularization:!0,useGraphMAEEmbeddings:!0,useHopfieldMemory:!0,useColdTierGNN:!0,useMetaLearningEnhancements:!0,useSublinearSolver:!0,useSpectralSparsification:!0,useReservoirReplay:!0,useEpropOnlineLearning:!0,useGrangerCausality:!0,useCognitiveRouting:!1,useHyperbolicHnsw:!1},e={...r}});export{r as a,i as b,o as c,u as d,a as e,E as f,R as g,l as h,_ as i,c as j,S as k,C as l,T as m,p as n,N as o,U as p,O as q,f as r,d as s,b as t,g as u,A as v,v as w,V as x,I as y,G as z,H as A,D as B,M as C,F as D,L as E,x as F,h as G,m as H,P as I,y as J,W as K,w as L,Q as M,B as N,Y as O,k as P,z as Q,K as R,X as S};
|
|
@@ -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.9.
|
|
2
|
-
import{c as T}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.9.34");process.exit(0)}
|
|
2
|
+
import{c as T}from"./chunk-6FNPEC2I.js";var S,E,t,N,_=T(()=>{"use strict";S={MMAP_SIZE_BYTES:67108864,CACHE_SIZE_KB:-32e3,BUSY_TIMEOUT_MS:5e3,DEFAULT_VECTOR_DIMENSIONS:384,DEFAULT_SEARCH_LIMIT:100,CLEANUP_INTERVAL_MS:6e4,TTL_MULTIPLIER_MS:1e3},E={M_CONNECTIONS:16,EF_CONSTRUCTION:200,EF_SEARCH:100,DEFAULT_K_NEIGHBORS:10,COVERAGE_VECTOR_DIMENSION:384},t={MAX_CONCURRENT_AGENTS:15,DEFAULT_AGENT_TTL_MS:36e5,DEFAULT_AGENT_TIMEOUT_MS:12e4,MAX_POOL_SIZE:10},N={MAX_HISTORY_SIZE:1e4}});export{S as a,E as b,t as c,N as d,_ as e};
|
|
@@ -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.9.
|
|
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.9.34");process.exit(0)}
|
|
2
2
|
var t=["claude","openai","ollama","openrouter","gemini","azure-openai","bedrock","onnx"];var e={maxAttempts:3,delayMs:100,trySameProviderAlternateModel:!0,skipOpenCircuits:!0,retryableErrors:["RATE_LIMITED","TIMEOUT","NETWORK_ERROR","PROVIDER_UNAVAILABLE"]},r=[{provider:"claude",models:["claude-sonnet-4-6","claude-haiku-4-5-20251001"],enabled:!0,priority:100,maxAttempts:2,timeoutMs:3e4},{provider:"openai",models:["gpt-4o","gpt-4o-mini"],enabled:!0,priority:90,maxAttempts:2,timeoutMs:3e4},{provider:"openrouter",models:["anthropic/claude-sonnet-4","openai/gpt-4o"],enabled:!0,priority:85,maxAttempts:2,timeoutMs:3e4},{provider:"ollama",models:["llama3.1","mistral"],enabled:!0,priority:80,maxAttempts:2,timeoutMs:6e4},{provider:"onnx",models:["phi-4","all-MiniLM-L6-v2"],enabled:!0,priority:70,maxAttempts:1,timeoutMs:12e4}],o={id:"default-fallback-chain",entries:r,maxRetries:3,retryDelayMs:100,backoffMultiplier:2,maxDelayMs:5e3},n={mode:"rule-based",rules:[],defaultProvider:"claude",defaultModel:"claude-sonnet-4-6",fallbackChain:o,fallbackBehavior:e,providers:{claude:{enabled:!0,defaultModel:"claude-sonnet-4-6"},openai:{enabled:!0,defaultModel:"gpt-4o"},ollama:{enabled:!0,defaultModel:"llama3.1"},openrouter:{enabled:!0,defaultModel:"anthropic/claude-sonnet-4"},gemini:{enabled:!1,defaultModel:"gemini-pro"},"azure-openai":{enabled:!1},bedrock:{enabled:!1},onnx:{enabled:!0,defaultModel:"phi-4"}},enableMetrics:!0,metricsConfig:{enabled:!0,collectionIntervalMs:6e4,retentionMs:864e5,trackPerRequest:!0},maxDecisionTimeMs:10,cacheDecisions:!0,decisionCacheTtlMs:6e4,cacheConfig:{enabled:!0,ttlMs:6e4,maxEntries:1e3,keyStrategy:"agent-domain"},auditConfig:{enabled:!0,maxEntries:1e4,logContent:!1,logResponse:!1}},a=[{canonicalId:"claude-opus-4-7",canonicalName:"Claude Opus 4.7",providerIds:{claude:"claude-opus-4-7",openrouter:"anthropic/claude-opus-4.7",bedrock:"anthropic.claude-opus-4-7-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!0,supportsVision:!0,supportsExtendedThinking:!0,supportsJsonMode:!0,maxContextTokens:1e6,maxOutputTokens:128e3},tier:"flagship",family:"claude",inputCostPer1M:5,outputCostPer1M:25},{canonicalId:"claude-sonnet-4-6",canonicalName:"Claude Sonnet 4.6",providerIds:{claude:"claude-sonnet-4-6",openrouter:"anthropic/claude-sonnet-4.6",bedrock:"anthropic.claude-sonnet-4-6-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!0,supportsVision:!0,supportsExtendedThinking:!0,supportsJsonMode:!0,maxContextTokens:2e5,maxOutputTokens:64e3},tier:"advanced",family:"claude",inputCostPer1M:3,outputCostPer1M:15},{canonicalId:"claude-haiku-4-5",canonicalName:"Claude Haiku 4.5",providerIds:{claude:"claude-haiku-4-5-20251001",openrouter:"anthropic/claude-haiku-4.5",bedrock:"anthropic.claude-haiku-4-5-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!0,supportsJsonMode:!0,maxContextTokens:2e5,maxOutputTokens:16384},tier:"standard",family:"claude",inputCostPer1M:1,outputCostPer1M:5},{canonicalId:"gpt-4o",canonicalName:"GPT-4o",providerIds:{openai:"gpt-4o","azure-openai":"gpt-4o",openrouter:"openai/gpt-4o"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:128e3,maxOutputTokens:16384},tier:"advanced",family:"gpt",inputCostPer1M:2.5,outputCostPer1M:10},{canonicalId:"gpt-4o-mini",canonicalName:"GPT-4o Mini",providerIds:{openai:"gpt-4o-mini","azure-openai":"gpt-4o-mini",openrouter:"openai/gpt-4o-mini"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:128e3,maxOutputTokens:16384},tier:"standard",family:"gpt",inputCostPer1M:.15,outputCostPer1M:.6},{canonicalId:"gemini-pro",canonicalName:"Gemini 2.0 Pro",providerIds:{gemini:"gemini-2.0-pro",openrouter:"google/gemini-2.0-pro"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!0,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:2e6,maxOutputTokens:8192},tier:"advanced",family:"gemini",inputCostPer1M:1.25,outputCostPer1M:5},{canonicalId:"llama-3.1-70b",canonicalName:"LLaMA 3.1 70B",providerIds:{ollama:"llama3.1:70b",openrouter:"meta-llama/llama-3.1-70b",bedrock:"meta.llama3-1-70b-instruct-v1:0"},capabilities:{supportsStreaming:!0,supportsTools:!0,supportsMCP:!1,supportsVision:!1,supportsExtendedThinking:!1,supportsJsonMode:!0,maxContextTokens:128e3,maxOutputTokens:4096},tier:"advanced",family:"llama",inputCostPer1M:.9,outputCostPer1M:.9},{canonicalId:"phi-4",canonicalName:"Microsoft Phi-4",providerIds:{ollama:"phi4",onnx:"phi-4",openrouter:"microsoft/phi-4"},capabilities:{supportsStreaming:!0,supportsTools:!1,supportsMCP:!1,supportsVision:!1,supportsExtendedThinking:!1,supportsJsonMode:!1,maxContextTokens:16e3,maxOutputTokens:4096,requiresNetwork:!1},tier:"efficient",family:"phi",inputCostPer1M:0,outputCostPer1M:0}];export{t as a,n as b,a as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
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.9.
|
|
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.9.34");process.exit(0)}
|
|
2
2
|
var h={0:"sqlite-only",1:"hybrid",2:"dual-write-sqlite-primary",3:"dual-write-rvf-primary",4:"rvf-primary"},g=class{config;db=null;rvfStore=null;totalWrites=0;totalReads=0;rvfWriteFailures=0;rvfReadFailures=0;fallbacksUsed=0;sqliteLatencies=[];rvfLatencies=[];sqliteWriteLatencies=[];rvfWriteLatencies=[];constructor(e){this.config={rvfPath:".agentic-qe/patterns.rvf",dimensions:384,enableFallback:!0,...e}}setSqliteDb(e){this.db=e}setRvfStore(e){this.rvfStore=e}get stage(){return this.config.stage}setStage(e){this.config={...this.config,stage:e}}write(e,t){this.totalWrites++;let s={sqliteSuccess:!1,rvfSuccess:!1,stage:this.config.stage,fallbackUsed:!1},n=this.config.stage<4,o=this.config.stage>=2;if(n&&this.db){let i=performance.now();try{let r=Buffer.from(t instanceof Float32Array?t.buffer:new Float32Array(t).buffer);this.db.prepare(`
|
|
3
3
|
INSERT INTO qe_pattern_embeddings (pattern_id, embedding, dimension, model, created_at)
|
|
4
4
|
VALUES (?, ?, ?, 'all-MiniLM-L6-v2', datetime('now'))
|
|
@@ -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.9.
|
|
2
|
-
import{c as h}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.9.34");process.exit(0)}
|
|
2
|
+
import{c as h}from"./chunk-6FNPEC2I.js";function i(t,r){if(t.length!==r.length)throw new Error(`Vector length mismatch: ${t.length} vs ${r.length}`);let e=0,o=0,l=0;for(let n=0;n<t.length;n++)e+=t[n]*r[n],o+=t[n]*t[n],l+=r[n]*r[n];let u=Math.sqrt(o)*Math.sqrt(l);return u===0?0:e/u}function c(t){let r=Math.sqrt(t.reduce((e,o)=>e+o*o,0));return r===0?t.slice():t.map(e=>e/r)}function g(t){let r=0;for(let e=0;e<t.length;e++)r+=t[e]*t[e];return Math.sqrt(r)}var m=h(()=>{"use strict"});export{i as a,c as b,g as c,m 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.9.
|
|
2
|
-
import{a as n}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.9.34");process.exit(0)}
|
|
2
|
+
import{a as n}from"./chunk-VSNLUVQI.js";import{a as o}from"./chunk-AGHBG5E4.js";import{a,e as c}from"./chunk-QX74JLGO.js";c();var M=a.CLEANUP_INTERVAL_MS,y=".agentic-qe/memory.db";async function d(r,t=!0){let e;switch(r.type){case"memory":e=new o;break;case"sqlite":e=new n({sqlite:r.sqlite,enableFallback:!0});break;case"agentdb":e=new n({sqlite:{path:r.agentdb?.path??y},enableFallback:!0});break;case"hybrid":e=new n(r.hybrid);break;default:throw new Error(`Unknown memory backend type: ${r.type}`)}return t&&await e.initialize(),{backend:e,type:r.type,initialized:t}}async function u(r=!0){let t=process.env.AQE_MEMORY_BACKEND??"memory",e=process.env.AQE_MEMORY_PATH??".agentic-qe",i={type:t,sqlite:{path:`${e}/memory.db`,walMode:!0},agentdb:{path:`${e}/memory.db`},hybrid:{enableFallback:!0,sqlite:{path:`${e}/memory.db`}}};return d(i,r)}export{d as a,u as b};
|
|
@@ -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.9.
|
|
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.9.34");process.exit(0)}
|
|
2
2
|
var i=class r{constructor(e){this._value=e;if(!e||e.trim()==="")throw new Error("FilePath cannot be empty")}_value;get value(){return this._value}get extension(){let e=this._value.split(".");return e.length>1?e[e.length-1]:""}get directory(){let e=this._value.lastIndexOf("/");return e>0?this._value.substring(0,e):""}get filename(){let e=this._value.lastIndexOf("/");return e>=0?this._value.substring(e+1):this._value}equals(e){return this._value===e._value}static create(e){return new r(e)}};var s=class r{constructor(e){this._value=e;if(e<0||e>1)throw new Error("RiskScore must be between 0 and 1")}_value;get value(){return this._value}get percentage(){return this._value*100}get level(){return this._value>=.8?"critical":this._value>=.6?"high":this._value>=.3?"medium":"low"}isHigherThan(e){return this._value>e._value}equals(e){return this._value===e._value}static create(e){return new r(e)}static fromPercentage(e){return new r(e/100)}},u=class r{constructor(e,t){this._start=e;this._end=t;if(e>t)throw new Error("Start date cannot be after end date")}_start;_end;get start(){return this._start}get end(){return this._end}get durationMs(){return this._end.getTime()-this._start.getTime()}get durationSeconds(){return this.durationMs/1e3}contains(e){return e>=this._start&&e<=this._end}overlaps(e){return this._start<=e._end&&e._start<=this._end}equals(e){return this._start.getTime()===e._start.getTime()&&this._end.getTime()===e._end.getTime()}static create(e,t){return new r(e,t)}static lastNDays(e){let t=new Date,n=new Date(t.getTime()-e*24*60*60*1e3);return new r(n,t)}},o=class r{constructor(e,t,n,a){this._major=e;this._minor=t;this._patch=n;this._prerelease=a}_major;_minor;_patch;_prerelease;get major(){return this._major}get minor(){return this._minor}get patch(){return this._patch}get prerelease(){return this._prerelease}toString(){let e=`${this._major}.${this._minor}.${this._patch}`;return this._prerelease?`${e}-${this._prerelease}`:e}isNewerThan(e){return this._major!==e._major?this._major>e._major:this._minor!==e._minor?this._minor>e._minor:this._patch>e._patch}equals(e){return this._major===e._major&&this._minor===e._minor&&this._patch===e._patch&&this._prerelease===e._prerelease}static create(e,t,n,a){return new r(e,t,n,a)}static parse(e){let t=e.match(/^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/);if(!t)throw new Error(`Invalid version format: ${e}`);return new r(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),t[4])}};export{i as a,s as b,u as c,o as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
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.9.
|
|
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.9.34");process.exit(0)}
|
|
2
2
|
import*as h from"fs";import*as M from"path";var S=["coverage/coverage-final.json","coverage/coverage-summary.json",".coverage/coverage-final.json"];function x(s){for(let v of S){let i=M.join(s,v);if(h.existsSync(i))try{let n=JSON.parse(h.readFileSync(i,"utf-8"));if(n.total&&n.total.lines)return L(n,s);let o=new Map;for(let[r,C]of Object.entries(n)){let c=C,g=Object.keys(c.s),u=g.filter(a=>c.s[a]>0).length,b=Object.keys(c.b),p=0,m=0;for(let a of b)for(let y of c.b[a])p++,y>0&&m++;let e=Object.keys(c.f),t=e.filter(a=>c.f[a]>0).length,f=new Set,d=new Set;for(let a of g){let y=c.statementMap[a];for(let F=y.start.line;F<=y.end.line;F++)d.add(F),c.s[a]>0&&f.add(F)}let l=[...d].filter(a=>!f.has(a)).sort((a,y)=>a-y);o.set(r,{path:r,lines:{covered:f.size,total:d.size},branches:{covered:m,total:p},functions:{covered:t,total:e.length},statements:{covered:u,total:g.length},uncoveredLines:l,uncoveredBranches:l.slice(0,Math.floor(l.length/2))})}return o.size>0?o:null}catch{continue}}return null}function L(s,v){let i=new Map;for(let[n,o]of Object.entries(s)){if(n==="total")continue;let r=o;i.set(n,{path:n,lines:{covered:r.lines.covered,total:r.lines.total},branches:{covered:r.branches.covered,total:r.branches.total},functions:{covered:r.functions.covered,total:r.functions.total},statements:{covered:r.statements.covered,total:r.statements.total},uncoveredLines:[],uncoveredBranches:[]})}return i.size>0?i:null}function B(s,v){let n=v.split(`
|
|
3
3
|
`).length,r=[s.replace(".ts",".test.ts").replace("/src/","/tests/"),s.replace(".ts",".spec.ts").replace("/src/","/tests/"),s.replace(".ts",".test.ts"),s.replace("/src/","/test/").replace(".ts",".test.ts")].some(d=>h.existsSync(d)),C=(v.match(/\bexport\b/g)||[]).length,c=(v.match(/\b(function|=>)\b/g)||[]).length,g=(v.match(/\b(if|switch|case|\?\?|\|\|)\b/g)||[]).length,u;if(r){let d=Math.min(g*.005,.15),l=Math.min(n*1e-4,.1);u=.85-d-l}else u=.2+(C>5?.1:0);u=Math.max(.05,Math.min(.95,u));let b=Math.floor(n*u),p=Math.max(c,1),m=Math.max(g,1),e=Math.floor(b*.7),t=Math.floor(p*u*.9),f=Array.from({length:n-b},(d,l)=>l+b+1);return{path:s,lines:{covered:b,total:n},branches:{covered:Math.min(e,m),total:m},functions:{covered:Math.min(t,p),total:p},statements:{covered:b,total:n},uncoveredLines:f,uncoveredBranches:f.slice(0,Math.floor(f.length/2))}}function j(s,v){let i=v||process.cwd(),n=x(i),o=[],r=!1;if(n&&n.size>0){r=!0;for(let e of s){let t=M.resolve(e),f=n.get(t)||n.get(e)||n.get(M.relative(i,t));if(f)o.push({...f,path:e});else{let l=(h.existsSync(e)?h.readFileSync(e,"utf-8"):"").split(`
|
|
4
4
|
`).length;o.push({path:e,lines:{covered:0,total:l},branches:{covered:0,total:1},functions:{covered:0,total:1},statements:{covered:0,total:l},uncoveredLines:Array.from({length:l},(a,y)=>y+1),uncoveredBranches:[]})}}}else for(let e of s){let t=h.existsSync(e)?h.readFileSync(e,"utf-8"):"";o.push(B(e,t))}let C=o.reduce((e,t)=>e+t.lines.total,0),c=o.reduce((e,t)=>e+t.lines.covered,0),g=o.reduce((e,t)=>e+t.branches.total,0),u=o.reduce((e,t)=>e+t.branches.covered,0),b=o.reduce((e,t)=>e+t.functions.total,0),p=o.reduce((e,t)=>e+t.functions.covered,0),m=(e,t)=>t>0?Math.round(e/t*100):0;return{files:o,summary:{line:m(c,C),branch:m(u,g),function:m(p,b),statement:m(c,C),files:o.length},instrumented:r}}export{j as a};
|
|
@@ -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.9.
|
|
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.9.34");process.exit(0)}
|
|
2
2
|
import{randomUUID as v}from"crypto";var m={"claude-opus-4-7":{input:5,output:25,provider:"claude"},"claude-sonnet-4-6":{input:3,output:15,provider:"claude"},"claude-haiku-4-5-20251001":{input:1,output:5,provider:"claude"},"claude-opus-4-5-20251101":{input:15,output:75,provider:"claude"},"claude-sonnet-4-20250514":{input:3,output:15,provider:"claude"},"claude-3-5-haiku-20241022":{input:1,output:5,provider:"claude"},"claude-3-opus-20240229":{input:15,output:75,provider:"claude"},"claude-3-sonnet-20240229":{input:3,output:15,provider:"claude"},"claude-3-haiku-20240307":{input:.25,output:1.25,provider:"claude"},"gpt-4o":{input:5,output:15,provider:"openai"},"gpt-4o-mini":{input:.15,output:.6,provider:"openai"},"gpt-4-turbo":{input:10,output:30,provider:"openai"},"gpt-4":{input:30,output:60,provider:"openai"},"gpt-3.5-turbo":{input:.5,output:1.5,provider:"openai"},llama3:{input:0,output:0,provider:"ollama"},"llama3.1":{input:0,output:0,provider:"ollama"},codellama:{input:0,output:0,provider:"ollama"},mistral:{input:0,output:0,provider:"ollama"},mixtral:{input:0,output:0,provider:"ollama"},phi3:{input:0,output:0,provider:"ollama"},qwen2:{input:0,output:0,provider:"ollama"},"anthropic/claude-3.5-sonnet":{input:3,output:15,provider:"openrouter"},"anthropic/claude-3.5-sonnet:beta":{input:3,output:15,provider:"openrouter"},"anthropic/claude-3-opus":{input:15,output:75,provider:"openrouter"},"anthropic/claude-3-sonnet":{input:3,output:15,provider:"openrouter"},"anthropic/claude-3-haiku":{input:.25,output:1.25,provider:"openrouter"},"openai/gpt-4o":{input:5,output:15,provider:"openrouter"},"openai/gpt-4o-mini":{input:.15,output:.6,provider:"openrouter"},"openai/gpt-4-turbo":{input:10,output:30,provider:"openrouter"},"openai/gpt-3.5-turbo":{input:.5,output:1.5,provider:"openrouter"},"google/gemini-pro":{input:.125,output:.375,provider:"openrouter"},"google/gemini-pro-1.5":{input:3.5,output:10.5,provider:"openrouter"},"meta-llama/llama-3.1-70b-instruct":{input:.59,output:.79,provider:"openrouter"},"meta-llama/llama-3.1-8b-instruct":{input:.06,output:.06,provider:"openrouter"},"mistralai/mistral-large":{input:2,output:6,provider:"openrouter"},"mistralai/mixtral-8x7b-instruct":{input:.24,output:.24,provider:"openrouter"},"mistralai/mistral-7b-instruct":{input:.06,output:.06,provider:"openrouter"},"anthropic.claude-opus-4-5-v1:0":{input:15,output:75,provider:"bedrock"},"anthropic.claude-opus-4-v1:0":{input:15,output:75,provider:"bedrock"},"anthropic.claude-sonnet-4-5-v2:0":{input:3,output:15,provider:"bedrock"},"anthropic.claude-sonnet-4-v1:0":{input:3,output:15,provider:"bedrock"},"anthropic.claude-3-5-haiku-v1:0":{input:1,output:5,provider:"bedrock"},"anthropic.claude-3-opus-20240229-v1:0":{input:15,output:75,provider:"bedrock"},"anthropic.claude-3-sonnet-20240229-v1:0":{input:3,output:15,provider:"bedrock"},"anthropic.claude-3-haiku-20240307-v1:0":{input:.25,output:1.25,provider:"bedrock"},"anthropic.claude-3-5-sonnet-20241022-v2:0":{input:3,output:15,provider:"bedrock"},"azure/gpt-4o":{input:5,output:15,provider:"azure-openai"},"azure/gpt-4o-mini":{input:.15,output:.6,provider:"azure-openai"},"azure/gpt-4-turbo":{input:10,output:30,provider:"azure-openai"},"azure/gpt-4":{input:30,output:60,provider:"azure-openai"},"azure/gpt-35-turbo":{input:.5,output:1.5,provider:"azure-openai"},"azure/text-embedding-ada-002":{input:.1,output:0,provider:"azure-openai"},"azure/text-embedding-3-small":{input:.02,output:0,provider:"azure-openai"},"azure/text-embedding-3-large":{input:.13,output:0,provider:"azure-openai"},"gemini-pro":{input:.5,output:1.5,provider:"gemini"},"gemini-1.0-pro":{input:.5,output:1.5,provider:"gemini"},"gemini-1.5-pro":{input:3.5,output:10.5,provider:"gemini"},"gemini-1.5-pro-latest":{input:3.5,output:10.5,provider:"gemini"},"gemini-1.5-flash":{input:.075,output:.3,provider:"gemini"},"gemini-1.5-flash-latest":{input:.075,output:.3,provider:"gemini"},"gemini-2.0-flash-exp":{input:.075,output:.3,provider:"gemini"},"gemini-ultra":{input:7,output:21,provider:"gemini"},"gemini-1.0-ultra":{input:7,output:21,provider:"gemini"},"text-embedding-004":{input:.025,output:0,provider:"gemini"}},d=class c{records=[];alerts=[];maxRecords;alertCheckInterval;constructor(t=1e4){this.maxRecords=t}static calculateCost(t,r){let e=m[t];if(!e)return{inputCost:0,outputCost:0,totalCost:0,currency:"USD"};let i=r.promptTokens/1e6*e.input,o=r.completionTokens/1e6*e.output;return{inputCost:i,outputCost:o,totalCost:i+o,currency:"USD"}}static getCostPerToken(t){let r=m[t];return r?{input:r.input/1e6,output:r.output/1e6}:{input:0,output:0}}recordUsage(t,r,e,i,o){let n=c.calculateCost(r,e),p={timestamp:new Date,provider:t,model:r,usage:e,cost:n,requestId:i,metadata:o};return this.records.push(p),this.records.length>this.maxRecords&&(this.records=this.records.slice(-this.maxRecords)),this.checkAlerts(),n}getSummary(t){let r=new Date,e=this.getPeriodStart(r,t),i=r,o=this.records.filter(s=>s.timestamp>=e&&s.timestamp<=i),n={claude:0,openai:0,ollama:0,openrouter:0,bedrock:0,"azure-openai":0,gemini:0},p={},u=0,l=0;for(let s of o)u+=s.cost.totalCost,l+=s.usage.totalTokens,n[s.provider]+=s.cost.totalCost,p[s.model]=(p[s.model]||0)+s.cost.totalCost;return{period:t,periodStart:e,periodEnd:i,totalCost:u,byProvider:n,byModel:p,totalTokens:l,totalRequests:o.length}}getCurrentCost(t){return this.getSummary(t).totalCost}getTotalTokens(t){return this.getSummary(t).totalTokens}getUsageByProvider(t,r="all"){let e=this.getPeriodStart(new Date,r),i=this.records.filter(u=>u.provider===t&&u.timestamp>=e),o={},n=0,p=0;for(let u of i)n+=u.cost.totalCost,p+=u.usage.totalTokens,o[u.model]||(o[u.model]={cost:0,tokens:0,requests:0}),o[u.model].cost+=u.cost.totalCost,o[u.model].tokens+=u.usage.totalTokens,o[u.model].requests+=1;return{totalCost:n,totalTokens:p,totalRequests:i.length,models:o}}addAlert(t,r,e){let i=`alert-${Date.now()}-${v().slice(0,12)}`;return this.alerts.push({threshold:t,period:r,onThreshold:e,active:!0}),this.alertCheckInterval||(this.alertCheckInterval=setInterval(()=>this.checkAlerts(),6e4)),i}removeAlert(t){return t>=0&&t<this.alerts.length?(this.alerts.splice(t,1),this.alerts.length===0&&this.alertCheckInterval&&(clearInterval(this.alertCheckInterval),this.alertCheckInterval=void 0),!0):!1}getRecords(){return[...this.records]}importRecords(t){for(let r of t)r.timestamp=new Date(r.timestamp),this.records.push(r);this.records.length>this.maxRecords&&(this.records=this.records.slice(-this.maxRecords))}clear(){this.records=[]}getRecentRequests(t=10){return this.records.slice(-t)}estimateCost(t,r,e){return c.calculateCost(t,{promptTokens:r,completionTokens:e,totalTokens:r+e})}wouldExceedLimit(t,r,e,i,o){let n=this.getCurrentCost(o),p=this.estimateCost(t,r,e);return n+p.totalCost>i}dispose(){this.alertCheckInterval&&(clearInterval(this.alertCheckInterval),this.alertCheckInterval=void 0)}getPeriodStart(t,r){let e=new Date(t);switch(r){case"minute":e.setSeconds(0,0),e.setMinutes(e.getMinutes()-1);break;case"hour":e.setMinutes(0,0,0),e.setHours(e.getHours()-1);break;case"day":e.setHours(0,0,0,0);break;case"week":e.setHours(0,0,0,0),e.setDate(e.getDate()-7);break;case"month":e.setHours(0,0,0,0),e.setDate(1);break;case"all":return new Date(0)}return e}checkAlerts(){for(let t of this.alerts){if(!t.active)continue;let r=this.getSummary(t.period);if(r.totalCost>=t.threshold){t.active=!1;try{t.onThreshold(r)}catch(e){console.error("Cost alert callback error:",e)}}}}},a;function h(){return a||(a=new d),a}function b(){a&&(a.dispose(),a=void 0)}export{m as a,d as b,h as c,b 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.9.
|
|
2
|
-
import{a as ie,b as ae}from"./chunk-ZESMMAKZ.js";import{S as oe,i as j,p as q}from"./chunk-33PGBYTC.js";import{c as g,e as D,g as $}from"./chunk-XHQFVTFD.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,H,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,H=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 w(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=w(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=w(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=w(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:()=>w});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 H?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 H(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.9.34");process.exit(0)}
|
|
2
|
+
import{a as ie,b as ae}from"./chunk-IUZNVWCR.js";import{S as oe,i as j,p as q}from"./chunk-QPH72S4A.js";import{c as g,e as D,g as $}from"./chunk-6FNPEC2I.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,H,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,H=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 w(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=w(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=w(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=w(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:()=>w});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 H?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 H(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,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.9.
|
|
2
|
-
import{a as D}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.9.34");process.exit(0)}
|
|
2
|
+
import{a as D}from"./chunk-FAQSUNVC.js";import{c as x}from"./chunk-RXQCDEDD.js";import{a as _}from"./chunk-DIX6AR2P.js";import{k as w,o as I}from"./chunk-PYQ7VCH2.js";import{b as f,d as U}from"./chunk-VR65KHTH.js";import{a as g,c as q}from"./chunk-I74WDBHS.js";import{a as v}from"./chunk-6FNPEC2I.js";import{randomUUID as Q}from"crypto";I();U();q();var F={alpha:.1,minOutcomes:10,weightFloor:.2,weightCeiling:2},p=class{records=new Map;config;constructor(e){this.config={...F,...e}}recordOutcome(e,t,o){let{alpha:i,minOutcomes:r,weightFloor:s,weightCeiling:n}=this.config,c=this.records.get(e),d=t?1:0,a=Math.max(0,Math.min(1,o)),l,u;c?(l=i*d+(1-i)*c.emaAccuracy,u=i*a+(1-i)*c.emaQuality):(l=d,u=a);let h=(c?.totalOutcomes??0)+1,R;h>=r?R=Math.max(s,Math.min(n,l*2)):R=1;let k={agentId:e,emaAccuracy:l,emaQuality:u,calibratedWeight:R,totalOutcomes:h,lastUpdated:new Date};return this.records.set(e,k),k}getCalibration(e){return this.records.get(e)??null}getCalibratedWeight(e){let t=this.records.get(e);return!t||t.totalOutcomes<this.config.minOutcomes?1:t.calibratedWeight}getAllCalibrations(){return Array.from(this.records.values())}reset(e){e!==void 0?this.records.delete(e):this.records.clear()}serialize(){let e={};for(let[t,o]of this.records)e[t]={...o};return e}deserialize(e){this.records.clear();for(let[t,o]of Object.entries(e))this.records.set(t,{...o,lastUpdated:new Date(o.lastUpdated)})}};var P={escalateAfterFailures:2,deEscalateAfterSuccesses:5,maxTier:"opus",minTier:"haiku"},A=["booster","haiku","sonnet","opus"];function y(m){return A.indexOf(m)}var b=class{config;states=new Map;constructor(e){this.config={...P,...e}}recordOutcome(e,t,o){let i=this.states.get(e);i||(i={agentId:e,currentTier:o,baseTier:o,consecutiveFailures:0,consecutiveSuccesses:0,escalationCount:0,deEscalationCount:0,lastAction:"none",lastActionTimestamp:new Date},this.states.set(e,i));let r=i.currentTier;if(t){if(i.consecutiveSuccesses++,i.consecutiveFailures=0,i.consecutiveSuccesses>=this.config.deEscalateAfterSuccesses){let s=y(i.currentTier),n=y(this.config.minTier);if(s>n)return i.currentTier=A[s-1],i.deEscalationCount++,i.consecutiveSuccesses=0,i.lastAction="de-escalate",i.lastActionTimestamp=new Date,{action:"de-escalate",previousTier:r,newTier:i.currentTier}}}else if(i.consecutiveFailures++,i.consecutiveSuccesses=0,i.consecutiveFailures>=this.config.escalateAfterFailures){let s=y(i.currentTier),n=y(this.config.maxTier);if(s<n)return i.currentTier=A[s+1],i.escalationCount++,i.consecutiveFailures=0,i.lastAction="escalate",i.lastActionTimestamp=new Date,{action:"escalate",previousTier:r,newTier:i.currentTier}}return{action:"none",previousTier:r,newTier:i.currentTier}}getCurrentTier(e){return this.states.get(e)?.currentTier??null}getState(e){return this.states.get(e)??null}getAllStates(){return Array.from(this.states.values())}reset(e){e?this.states.delete(e):this.states.clear()}};var T={booster:{avgInputTokens:0,avgOutputTokens:0,costPerTask:0},haiku:{avgInputTokens:2e3,avgOutputTokens:1e3,costPerTask:.0035},sonnet:{avgInputTokens:2e3,avgOutputTokens:1e3,costPerTask:.021},opus:{avgInputTokens:2e3,avgOutputTokens:1e3,costPerTask:.105}},S=["booster","haiku","sonnet","opus"],E=T.opus.costPerTask,N={qualityWeight:.6,costWeight:.4,budgetPerHourUsd:0,budgetPerDayUsd:0,minQualityThreshold:.5,enabled:!0},L=.15,C=class{config;costTracker;tierQualityEstimates=new Map;tierOutcomeCounts=new Map;constructor(e,t){let o={...N,...t};o.qualityWeight=Math.max(0,Math.min(1,o.qualityWeight)),o.costWeight=Math.max(0,Math.min(1,o.costWeight)),o.minQualityThreshold=Math.max(0,Math.min(1,o.minQualityThreshold)),o.budgetPerHourUsd=Math.max(0,o.budgetPerHourUsd),o.budgetPerDayUsd=Math.max(0,o.budgetPerDayUsd);let i=o.qualityWeight+o.costWeight;i>0&&i!==1&&(o.qualityWeight/=i,o.costWeight/=i),this.config=o,this.costTracker=e,this.tierQualityEstimates.set("booster",.3),this.tierQualityEstimates.set("haiku",.55),this.tierQualityEstimates.set("sonnet",.75),this.tierQualityEstimates.set("opus",.9)}scoreTiers(e){let t=S.map(o=>{let i=this.getQualityEstimate(o,e),r=T[o].costPerTask,s=r>0?i/r:i>0?1/0:0,n=E>0?1-r/E:1,c=this.config.qualityWeight*i+this.config.costWeight*n;return{tier:o,qualityScore:i,estimatedCostUsd:r,qualityPerDollar:s,economicScore:c}});return t.sort((o,i)=>i.economicScore-o.economicScore),t}selectTier(e){let t=this.scoreTiers(e);for(let r of t)if(!(r.qualityScore<this.config.minQualityThreshold)&&!this.wouldExceedBudget(r.tier))return{tier:r.tier,reason:`Best economic score (${r.economicScore.toFixed(3)}): quality=${r.qualityScore.toFixed(2)}, cost=$${r.estimatedCostUsd.toFixed(4)}`,scores:t};let o=t.filter(r=>r.qualityScore>=this.config.minQualityThreshold);if(o.length>0){let r=[...o].sort((s,n)=>s.estimatedCostUsd-n.estimatedCostUsd)[0];return{tier:r.tier,reason:`Budget constrained fallback to ${r.tier}`,scores:t}}let i=[...t].sort((r,s)=>s.qualityScore-r.qualityScore)[0];return{tier:i.tier,reason:`No tier meets quality threshold ${this.config.minQualityThreshold}; using best quality: ${i.tier}`,scores:t}}wouldExceedBudget(e){let t=T[e].costPerTask;if(t===0)return!1;let o=this.costTracker.getCurrentCost("hour"),i=this.costTracker.getCurrentCost("day");return this.config.budgetPerHourUsd>0&&o+t>this.config.budgetPerHourUsd||this.config.budgetPerDayUsd>0&&i+t>this.config.budgetPerDayUsd}updateFromOutcome(e,t){let o=e.outcome.qualityScore,i=this.tierQualityEstimates.get(t)??.5,r=this.tierOutcomeCounts.get(t)??0,s=r<5?.4:L,n=i*(1-s)+o*s;this.tierQualityEstimates.set(t,n),this.tierOutcomeCounts.set(t,r+1)}getEconomicReport(){let e=this.scoreTiers(.5),t=this.costTracker.getCurrentCost("hour"),o=this.costTracker.getCurrentCost("day"),i={hourly:this.config.budgetPerHourUsd>0?Math.max(0,this.config.budgetPerHourUsd-t):null,daily:this.config.budgetPerDayUsd>0?Math.max(0,this.config.budgetPerDayUsd-o):null},r=null,s=[...e].sort((a,l)=>l.qualityPerDollar-a.qualityPerDollar),n=s.find(a=>a.estimatedCostUsd>0&&isFinite(a.qualityPerDollar)),c=[...s].reverse().find(a=>a.estimatedCostUsd>0&&isFinite(a.qualityPerDollar));if(n&&c&&n.tier!==c.tier){let a=c.estimatedCostUsd-n.estimatedCostUsd;a>0&&(r={usd:a,description:`Switch from ${c.tier} ($${c.estimatedCostUsd.toFixed(4)}/task) to ${n.tier} ($${n.estimatedCostUsd.toFixed(4)}/task) for comparable tasks to save ~$${a.toFixed(4)}/task`})}let d=this.generateRecommendation(e,i);return{tierEfficiency:e,currentHourlyCostUsd:t,currentDailyCostUsd:o,budgetRemaining:i,recommendation:d,savingsOpportunity:r}}computeCostAdjustedReward(e,t,o){let i=T[t].costPerTask;if(E===0)return e;let r=i/E,s=Math.max(0,o-this.config.minQualityThreshold),n=r*(1-s),c=e-n*this.config.costWeight;return Math.max(-1,Math.min(1,c))}serializeEstimates(){let e={};for(let t of S)e[t]={quality:this.tierQualityEstimates.get(t)??.5,count:this.tierOutcomeCounts.get(t)??0};return e}deserializeEstimates(e){for(let t of S)e[t]&&(this.tierQualityEstimates.set(t,e[t].quality),this.tierOutcomeCounts.set(t,e[t].count))}getConfig(){return{...this.config}}getQualityEstimate(e,t){let o=this.tierQualityEstimates.get(e)??.5,i=e==="booster"?t*.4:e==="haiku"?t*.2:0;return Math.max(0,Math.min(1,o-i))}generateRecommendation(e,t){if(t.hourly!==null&&t.hourly<.01)return"Hourly budget nearly exhausted. Consider increasing budget or routing to cheaper tiers.";if(t.daily!==null&&t.daily<.1)return"Daily budget nearly exhausted. Only critical tasks should use expensive tiers.";let o=e[0];return o?`Most cost-efficient tier: ${o.tier} (score=${o.economicScore.toFixed(3)}, quality=${o.qualityScore.toFixed(2)})`:"No economic data available yet."}};var O=class{outcomes=[];maxOutcomes;constructor(e=1e4){this.maxOutcomes=e}add(e){this.outcomes.push(e),this.outcomes.length>this.maxOutcomes&&(this.outcomes=this.outcomes.slice(-this.maxOutcomes))}getByAgent(e,t=100){return this.outcomes.filter(o=>o.usedAgent===e).slice(-t)}getAll(e=1e3){return this.outcomes.slice(-e)}getRecentOverrides(e=50){return this.outcomes.filter(t=>!t.followedRecommendation).slice(-e)}clear(){this.outcomes=[]}get size(){return this.outcomes.length}},M=class m{static schemaMigrated=!1;outcomeStore;router=null;db=null;calibrator=null;escalationTracker=null;economicModel=null;economicPersistCounter=0;static ECONOMIC_PERSIST_INTERVAL=10;persistCount=0;maxOutcomes;static RETENTION_CLEANUP_INTERVAL=100;constructor(e=1e4,t){this.maxOutcomes=e,this.outcomeStore=new O(e),t?.enableEMACalibration&&this.enableCalibration(),t?.enableAutoEscalation&&this.enableAutoEscalation()}async initialize(){try{this.db=w(),this.db.isInitialized()||await this.db.initialize(),await this.loadFromDb(),this.loadCalibratorState()}catch(e){console.warn("[RoutingFeedbackCollector] DB init failed, using memory-only:",g(e)),this.db=null}}async loadFromDb(){if(!this.db)return;let t=this.db.getDatabase().prepare(`
|
|
3
3
|
SELECT * FROM routing_outcomes ORDER BY created_at DESC LIMIT ?
|
|
4
4
|
`).all(this.maxOutcomes);for(let o of t.reverse()){let i={id:o.id,task:f(o.task_json),decision:f(o.decision_json),usedAgent:o.used_agent,followedRecommendation:!!o.followed_recommendation,outcome:{success:!!o.success,qualityScore:o.quality_score,durationMs:o.duration_ms,error:o.error||void 0},timestamp:new Date(o.created_at),advisorConsultation:o.advisor_consultation_json?f(o.advisor_consultation_json):void 0};this.outcomeStore.add(i)}t.length>0&&console.log(`[RoutingFeedbackCollector] Loaded ${t.length} outcomes from DB`)}persistOutcome(e){if(this.db)try{let t=this.db.getDatabase();if(!m.schemaMigrated){for(let r of["ALTER TABLE routing_outcomes ADD COLUMN model_tier TEXT","ALTER TABLE routing_outcomes ADD COLUMN advisor_consultation_json TEXT"])try{t.prepare(r).run()}catch{}D(t),m.schemaMigrated=!0}let o=this.inferTier(e.usedAgent),i=e.advisorConsultation?JSON.stringify(e.advisorConsultation):null;t.prepare(`
|
|
5
5
|
INSERT OR REPLACE INTO routing_outcomes (
|
|
@@ -1,4 +1,4 @@
|
|
|
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.9.
|
|
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.9.34");process.exit(0)}
|
|
2
2
|
import{writeFileSync as p,readFileSync as m}from"node:fs";import{resolve as f,dirname as c,join as d}from"node:path";import{mkdirSync as g}from"node:fs";import{fileURLToPath as h}from"node:url";function $(){try{let e=typeof __dirname<"u"?__dirname:c(h(import.meta.url));for(let t=0;t<5;t++){let n=d(e,"package.json");try{let r=JSON.parse(m(n,"utf-8"));if(r.version)return r.version}catch{}e=c(e)}}catch{}return"unknown"}var T=["-F, --format <format>","Output format (text|json|sarif|junit|markdown)","text"],x=["-o, --output <path>","Write output to file instead of stdout"];function C(e,t,n){if(t){let r=f(t);g(c(r),{recursive:!0}),p(r,e,"utf-8"),n&&console.log(n),console.log(`Output written to: ${r}`)}else console.log(e)}function R(e){return JSON.stringify(e,null,2)}var v="https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json";function w(e){let t=i=>{switch(i.toLowerCase()){case"critical":case"high":return"error";case"medium":return"warning";case"low":case"info":return"note";default:return"warning"}},n=new Map,r=[];for(let i of e.vulnerabilities){let o=i.ruleId||`AQE/${i.type.replace(/\s+/g,"-").toLowerCase()}`;n.has(o)||n.set(o,{id:o,name:i.type,shortDescription:i.type,...i.cweId?{helpUri:`https://cwe.mitre.org/data/definitions/${i.cweId.replace("CWE-","")}.html`}:{}}),r.push({ruleId:o,level:t(i.severity),message:{text:i.message},locations:[{physicalLocation:{artifactLocation:{uri:i.file,uriBaseId:"%SRCROOT%"},region:{startLine:i.line,startColumn:1}}}],...i.cweId?{taxa:[{id:i.cweId,toolComponent:{name:"CWE"}}]}:{}})}let s={$schema:v,version:"2.1.0",runs:[{tool:{driver:{name:"agentic-qe",version:$(),informationUri:"https://github.com/proffesor-for-testing/agentic-qe",rules:Array.from(n.values()).map(i=>({id:i.id,name:i.name,shortDescription:{text:i.shortDescription},...i.helpUri?{helpUri:i.helpUri}:{},defaultConfiguration:{level:"warning"}}))}},results:r,invocations:[{executionSuccessful:!0,commandLine:`aqe security --sast --format sarif -t ${e.target}`}]}]};return JSON.stringify(s,null,2)}function a(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function I(e){let t=e.tests||[],n=e.passed+e.failed+e.skipped,r=(e.duration/1e3).toFixed(3),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
3
|
`;if(s+=`<testsuites tests="${n}" failures="${e.failed}" errors="0" time="${r}">
|
|
4
4
|
`,s+=` <testsuite name="aqe-test-run" tests="${n}" failures="${e.failed}" errors="0" skipped="${e.skipped}" time="${r}" id="${a(e.runId)}">
|
|
@@ -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.9.34");process.exit(0)}
|
|
2
|
+
import{c as h,e as v,g as T}from"./chunk-6FNPEC2I.js";var y={};v(y,{DotProductAttention:()=>z,FlashAttention:()=>k,HyperbolicAttention:()=>C,LinearAttention:()=>j,MoEAttention:()=>W,MultiHeadAttention:()=>F,RuvectorLayer:()=>_,SonaEngine:()=>K,TensorCompress:()=>E,default:()=>O,differentiableSearch:()=>L,getCompressionLevel:()=>B,hierarchicalForward:()=>V,init:()=>D,pipeline:()=>q});import{createRequire as A}from"module";var I,g,O,_,E,L,V,B,D,k,z,F,C,j,W,K,q,R=h(()=>{I=A(import.meta.url),g=I("@ruvector/rvf-node"),O=g,{RuvectorLayer:_,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:()=>Q,isRvfNativeAvailable:()=>Y,openRvfStore:()=>U,openRvfStoreReadonly:()=>X});import{readFileSync as J,writeFileSync as H,copyFileSync as $,existsSync as G}from"fs";function c(){if(S)return m;S=!0;try{let i=(R(),T(y));!i.RvfDatabase&&i.default&&i.default.RvfDatabase&&(i=i.default),m=i}catch{m=null}return m}function w(i){return`${i}.idmap.json`}function N(i){let e=w(i),t=new Map,n=new Map,s=1;if(G(e))try{let r=JSON.parse(J(e,"utf-8"));s=r.nextLabel;for(let[a,p]of r.entries)t.set(a,p),n.set(p,a)}catch{}return{strToNum:t,numToStr:n,nextLabel:s}}function b(i,e,t){let n={nextLabel:t,entries:Array.from(e.entries())};H(w(i),JSON.stringify(n),"utf-8")}function Q(i,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(i,{dimension:e}),s=n.dimension();return new d(n,i,s,new Map,new Map,1)}function U(i){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(i),n=t.dimension(),{strToNum:s,numToStr:r,nextLabel:a}=N(i);return new d(t,i,n,s,r,a)}function X(i){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(i),n=t.dimension(),{strToNum:s,numToStr:r,nextLabel:a}=N(i);return new d(t,i,n,s,r,a)}function Y(){return c()!==null}var m,S,d,P=h(()=>{m=null,S=!1;d=class i{db;_path;_dimension;strToNum;numToStr;nextLabel;_open;constructor(e,t,n,s,r,a){this.db=e,this._path=t,this._dimension=n,this.strToNum=s,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),s=[],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)),s.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,s,o)}else a=this.db.ingestBatch(n,s);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 s of e){let r=this.strToNum.get(s);r!==void 0&&t.push(r)}if(t.length===0)return 0;let n=this.db.delete(t);for(let s of e){let r=this.strToNum.get(s);r!==void 0&&(this.strToNum.delete(s),this.numToStr.delete(r))}return this.persistIdMap(),n.deleted}fork(e){this.ensureOpen(),$(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 i(r,e,this._dimension,t,n,this.nextLabel)}status(){this.ensureOpen();let e=this.db.status(),n=this.db.segments().filter(s=>s.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),s=new Map(this.strToNum),r=new Map(this.numToStr);return b(e,s,this.nextLabel),new i(n,e,this._dimension,s,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{Q as a,U as b,X as c,Y as d,Z as e,P as f};
|