agentic-qe 3.9.29 → 3.9.31
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 +176 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/bridge/captured-experience-bridge.js +31 -2
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-CI2GZYME.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-EPRGXS5D.js → agent-booster-wasm-AQXZYWZY.js} +2 -2
- package/dist/cli/chunks/{agent-handler-LF6D64UE.js → agent-handler-7N4ZPXCY.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-XD3UQD6Y.js → agent-memory-branch-FLKF2JVX.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-KNQKALLI.js +2 -0
- package/dist/cli/chunks/{audit-MNJONFOL.js → audit-B4V4IKTA.js} +2 -2
- package/dist/cli/chunks/base-P7PRMQWY.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-PSQJ3C65.js → better-sqlite3-NYOVLWBG.js} +2 -2
- package/dist/cli/chunks/{brain-handler-SA2G3FDO.js → brain-handler-OOXJ2KYY.js} +4 -4
- package/dist/cli/chunks/{branch-enumerator-T7SZZTMH.js → branch-enumerator-LFKFW3A4.js} +2 -2
- package/dist/cli/chunks/{browser-OH5HUVOG.js → browser-F72IES2I.js} +3 -3
- package/dist/cli/chunks/browser-workflow-QUP4A763.js +2 -0
- package/dist/cli/chunks/{chunk-K7CFDRVW.js → chunk-2NLZXG6V.js} +1 -1
- package/dist/cli/chunks/{chunk-5Q26UGSU.js → chunk-35SFAIXE.js} +2 -2
- package/dist/cli/chunks/{chunk-UI6KM5PK.js → chunk-3VKB4HVT.js} +2 -2
- package/dist/cli/chunks/{chunk-UKYPDNQR.js → chunk-462MZLJB.js} +1 -1
- package/dist/cli/chunks/{chunk-WUKSEOUO.js → chunk-47QIAHUJ.js} +2 -2
- package/dist/cli/chunks/{chunk-R55RXPHB.js → chunk-4N736EES.js} +2 -2
- package/dist/cli/chunks/{chunk-5XRNUFEG.js → chunk-52D3CYE5.js} +2 -2
- package/dist/cli/chunks/{chunk-5MUYYPPW.js → chunk-5AMAJCZS.js} +3 -3
- package/dist/cli/chunks/{chunk-2JK43GR4.js → chunk-5G2L4XRU.js} +2 -2
- package/dist/cli/chunks/{chunk-C7MWQ4BI.js → chunk-5M4F3PAL.js} +1 -1
- package/dist/cli/chunks/{chunk-PYAITX6B.js → chunk-5WWQLPB4.js} +2 -2
- package/dist/cli/chunks/chunk-5Z6PYYWK.js +2 -0
- package/dist/cli/chunks/{chunk-VHJRWMZ5.js → chunk-62KYX5NH.js} +2 -2
- package/dist/cli/chunks/{chunk-667A24A4.js → chunk-7MXQV7RB.js} +12 -6
- package/dist/cli/chunks/{chunk-N5SS5YIS.js → chunk-7OVVBBOZ.js} +2 -2
- package/dist/cli/chunks/{chunk-TESFXE2W.js → chunk-7RPEBKQZ.js} +2 -2
- package/dist/cli/chunks/{chunk-3T4Q5V4B.js → chunk-7UHRT5AX.js} +2 -2
- package/dist/cli/chunks/{chunk-7PYHCYLJ.js → chunk-7V7TP242.js} +1 -1
- package/dist/cli/chunks/{chunk-IBSTVSKT.js → chunk-A424Z7LA.js} +1 -1
- package/dist/cli/chunks/{chunk-IX5LUHCN.js → chunk-AKFRM4IO.js} +2 -2
- package/dist/cli/chunks/{chunk-UGXYKPM4.js → chunk-AKJWBJDK.js} +2 -2
- package/dist/cli/chunks/{chunk-MBNFD2C3.js → chunk-AQN6PDHI.js} +1 -1
- package/dist/cli/chunks/{chunk-YCK464TF.js → chunk-BMS7WFDB.js} +1 -1
- package/dist/cli/chunks/{chunk-C7G7TA2H.js → chunk-BYHUGO73.js} +3 -3
- package/dist/cli/chunks/{chunk-ZZAZQKOA.js → chunk-CFLA2GBS.js} +2 -2
- package/dist/cli/chunks/{chunk-7AIVTUMM.js → chunk-CNKOIHF6.js} +2 -2
- package/dist/cli/chunks/{chunk-23B7TDPN.js → chunk-CQWZNVIM.js} +2 -2
- package/dist/cli/chunks/{chunk-REFFJUYT.js → chunk-CUSLB7MB.js} +2 -2
- package/dist/cli/chunks/chunk-CYUGE5ZQ.js +2 -0
- package/dist/cli/chunks/{chunk-BZ4OMPVJ.js → chunk-DMF4Z2M6.js} +2 -2
- package/dist/cli/chunks/{chunk-HEUAPPKE.js → chunk-DUF733Z7.js} +1 -1
- package/dist/cli/chunks/{chunk-VKJLHKLY.js → chunk-EAIPJSKH.js} +2 -2
- package/dist/cli/chunks/{chunk-GHBQVPJT.js → chunk-EJXRBAQF.js} +2 -2
- package/dist/cli/chunks/{chunk-N6A4XFUM.js → chunk-EKYPQ5DX.js} +1 -1
- package/dist/cli/chunks/{chunk-ZPFBEZV5.js → chunk-ENCFLC44.js} +2 -2
- package/dist/cli/chunks/{chunk-WQX2Q42U.js → chunk-FOAWHNOP.js} +2 -2
- package/dist/cli/chunks/{chunk-GBLW4QDV.js → chunk-FUHPLXJX.js} +1 -1
- package/dist/cli/chunks/{chunk-3E4VPGNW.js → chunk-G2U7Q6V6.js} +2 -2
- package/dist/cli/chunks/{chunk-7WRIYQG7.js → chunk-G3YKCZWQ.js} +3 -3
- package/dist/cli/chunks/{chunk-OLJLSLCY.js → chunk-GJSH4UZ3.js} +3 -3
- package/dist/cli/chunks/{chunk-XP5OUB2X.js → chunk-GN7FUCJH.js} +1 -1
- package/dist/cli/chunks/{chunk-UO3QSXYD.js → chunk-GQFAVT2I.js} +1 -1
- package/dist/cli/chunks/{chunk-AUE4QOT7.js → chunk-HHEIQHLQ.js} +2 -2
- package/dist/cli/chunks/{chunk-LRWREDZU.js → chunk-I3TFGMOQ.js} +1 -1
- package/dist/cli/chunks/{chunk-BUMNLVMC.js → chunk-IRRGUXAU.js} +1 -1
- package/dist/cli/chunks/{chunk-ZMZS6NKQ.js → chunk-IY4P35N3.js} +2 -2
- package/dist/cli/chunks/{chunk-SKIG6EOQ.js → chunk-JF3U456G.js} +2 -2
- package/dist/cli/chunks/{chunk-YEXQMYOM.js → chunk-JJRZOLDY.js} +2 -2
- package/dist/cli/chunks/{chunk-G426VZ5K.js → chunk-JKKV5KKS.js} +2 -2
- package/dist/cli/chunks/{chunk-I6PVI7R5.js → chunk-JMLOEW7Y.js} +2 -2
- package/dist/cli/chunks/chunk-JRIDPOEZ.js +95 -0
- package/dist/cli/chunks/{chunk-MCJRIW7M.js → chunk-K37CNLQZ.js} +1 -1
- package/dist/cli/chunks/{chunk-LIEKDXTS.js → chunk-K6MFAVXK.js} +2 -2
- package/dist/cli/chunks/{chunk-OPPASGEB.js → chunk-KJAIE7SL.js} +4 -4
- package/dist/cli/chunks/{chunk-ZWI5Z2SI.js → chunk-KXRDQQGN.js} +2 -2
- package/dist/cli/chunks/{chunk-Y7VPSAWH.js → chunk-L4JTTPU7.js} +2 -2
- package/dist/cli/chunks/{chunk-RXAJBMM7.js → chunk-L63KB63A.js} +2 -2
- package/dist/cli/chunks/{chunk-KX3XTWNR.js → chunk-L7DNPOAQ.js} +2 -2
- package/dist/cli/chunks/{chunk-LJDPZC6Q.js → chunk-LF5RO6WO.js} +1 -1
- package/dist/cli/chunks/{chunk-GWBI5IMK.js → chunk-LRWRFKQH.js} +1 -1
- package/dist/cli/chunks/{chunk-JXWZZTPN.js → chunk-M6RVKGIP.js} +2 -2
- package/dist/cli/chunks/{chunk-IQXDL7BX.js → chunk-MAJ5QFVY.js} +1 -1
- package/dist/cli/chunks/chunk-MYCVU3D3.js +14 -0
- package/dist/cli/chunks/{chunk-C7SJS5E4.js → chunk-N6P7ENG7.js} +2 -2
- package/dist/cli/chunks/{chunk-KQYKPEY6.js → chunk-N6SIKSCO.js} +2 -2
- package/dist/cli/chunks/{chunk-BP3KVVEM.js → chunk-NBKM7NKX.js} +2 -2
- package/dist/cli/chunks/{chunk-TZG7TJD5.js → chunk-NLUBN642.js} +2 -2
- package/dist/cli/chunks/{chunk-HCVIUAF2.js → chunk-NNF3GCGF.js} +2 -2
- package/dist/cli/chunks/{chunk-AYESXBSX.js → chunk-NTVJKQ5S.js} +2 -2
- package/dist/cli/chunks/{chunk-LPSIKIE2.js → chunk-NZQYNUGM.js} +2 -2
- package/dist/cli/chunks/{chunk-JX2AS6QZ.js → chunk-ONMJJ2C3.js} +1 -1
- package/dist/cli/chunks/{chunk-AOZ3JGJQ.js → chunk-OXOXNAEZ.js} +2 -2
- package/dist/cli/chunks/chunk-PSF6YQQM.js +180 -0
- package/dist/cli/chunks/{chunk-OW47RQEW.js → chunk-PTOTOBOU.js} +1 -1
- package/dist/cli/chunks/{chunk-FIMBLHR5.js → chunk-PUSZ4NBY.js} +2 -2
- package/dist/cli/chunks/chunk-PYYNY7RJ.js +2 -0
- package/dist/cli/chunks/{chunk-JXWJ6BLR.js → chunk-QEJBJST4.js} +1 -1
- package/dist/cli/chunks/{chunk-AQ4ZSM4D.js → chunk-QGLWFZVQ.js} +2 -2
- package/dist/cli/chunks/{chunk-ONFODTGV.js → chunk-QITO7E7Y.js} +1 -1
- package/dist/cli/chunks/{chunk-YWW6YPT5.js → chunk-QMSDKKYG.js} +1 -1
- package/dist/cli/chunks/{chunk-DCZV4QTP.js → chunk-RBDAHW2M.js} +2 -2
- package/dist/cli/chunks/{chunk-TLPIUYN3.js → chunk-RDJWUKIR.js} +2 -2
- package/dist/cli/chunks/{chunk-FDETLFX4.js → chunk-REJEFTWX.js} +1 -1
- package/dist/cli/chunks/{chunk-BVHLZ3TP.js → chunk-ROEIR3OD.js} +1 -1
- package/dist/cli/chunks/{chunk-GTJNB5B4.js → chunk-RTGNWRQI.js} +2 -2
- package/dist/cli/chunks/{chunk-XJJQZULZ.js → chunk-SL4TAJOE.js} +2 -2
- package/dist/cli/chunks/{chunk-ENJBAK7Y.js → chunk-T4DDCMKG.js} +113 -113
- package/dist/cli/chunks/{chunk-ZIX5MU4Q.js → chunk-TJGIIGKL.js} +2 -2
- package/dist/cli/chunks/{chunk-ZOORGOLY.js → chunk-TLCCM2AF.js} +1 -1
- package/dist/cli/chunks/{chunk-RBHWBTKA.js → chunk-TVHWI77X.js} +1 -1
- package/dist/cli/chunks/{chunk-P7HWW3VH.js → chunk-TYUIQSSF.js} +2 -2
- package/dist/cli/chunks/{chunk-YXMKMUQX.js → chunk-UIIEZMSM.js} +1 -1
- package/dist/cli/chunks/{chunk-VWDVQFEV.js → chunk-UIRTXM7C.js} +71 -71
- package/dist/cli/chunks/{chunk-2HUYG6Q6.js → chunk-UNXUSYRL.js} +3 -3
- package/dist/cli/chunks/chunk-VA45HLBF.js +2 -0
- package/dist/cli/chunks/{chunk-BMMXCDTH.js → chunk-VAIOZDG5.js} +1 -1
- package/dist/cli/chunks/{chunk-3YS4ZLL2.js → chunk-VLAGWLHF.js} +2 -2
- package/dist/cli/chunks/{chunk-SCXRYZ3U.js → chunk-VOOJDHLI.js} +14 -8
- package/dist/cli/chunks/{chunk-RRQH5BMQ.js → chunk-VSKABN3B.js} +29 -17
- package/dist/cli/chunks/{chunk-HHDPHHTX.js → chunk-VUL5HIKR.js} +2 -2
- package/dist/cli/chunks/{chunk-ZXWHKLZN.js → chunk-W7XVEWKQ.js} +1 -1
- package/dist/cli/chunks/{chunk-CZEQFAKE.js → chunk-WB6TI6Q3.js} +2 -2
- package/dist/cli/chunks/{chunk-YDBBXRH7.js → chunk-X2FLWV5C.js} +2 -2
- package/dist/cli/chunks/{chunk-G7LVJXZR.js → chunk-XE4YKDIM.js} +2 -2
- package/dist/cli/chunks/{chunk-A7ZCJ2XN.js → chunk-XGBIXRKD.js} +2 -2
- package/dist/cli/chunks/{chunk-B23E53WF.js → chunk-XMMWYQJK.js} +2 -2
- package/dist/cli/chunks/{chunk-3MFAU2JA.js → chunk-XNJ6DIEW.js} +2 -2
- package/dist/cli/chunks/{chunk-VJR2JIYP.js → chunk-XTWYCMAM.js} +2 -2
- package/dist/cli/chunks/{chunk-POV6V35B.js → chunk-XY3WUGD3.js} +2 -2
- package/dist/cli/chunks/{chunk-OU2FFOML.js → chunk-YEZJE2ZW.js} +4 -4
- package/dist/cli/chunks/{chunk-HDKXJMRS.js → chunk-YLEMSN46.js} +1 -1
- package/dist/cli/chunks/{chunk-SH7N3Y63.js → chunk-YMN4C32S.js} +3 -3
- package/dist/cli/chunks/{chunk-KIUJ4EI5.js → chunk-YN7HCVUP.js} +2 -2
- package/dist/cli/chunks/{chunk-WYSM5565.js → chunk-YQJBE6NX.js} +2 -2
- package/dist/cli/chunks/{chunk-QNIOQ4AR.js → chunk-ZBJRNCWX.js} +2 -2
- package/dist/cli/chunks/{chunk-NZIU2SEI.js → chunk-ZG4EKPGV.js} +1 -1
- package/dist/cli/chunks/{chunk-4ZAX5A6E.js → chunk-ZWSRIJ2T.js} +2 -2
- package/dist/cli/chunks/{ci-5BS5ALBZ.js → ci-LRTJSZHT.js} +2 -2
- package/dist/cli/chunks/{ci-output-I7CGW62R.js → ci-output-LISCHUKD.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-7P2V65XX.js → circuit-breaker-7PMP25KZ.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-EKRLBRCE.js → claude-flow-setup-DOW4QVMC.js} +2 -2
- package/dist/cli/chunks/client-XF6SJO2C.js +2 -0
- package/dist/cli/chunks/{cline-installer-U6KRJJHQ.js → cline-installer-2NXQGW73.js} +2 -2
- package/dist/cli/chunks/{code-I6PB6YM7.js → code-3X6RWAS7.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-NP7JW32L.js → code-index-extractor-4ABP5WCP.js} +2 -2
- package/dist/cli/chunks/{codex-installer-52W4TK27.js → codex-installer-V7PII6GL.js} +2 -2
- package/dist/cli/chunks/{completions-LTOAC3Y5.js → completions-Y7LNQ63I.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-RXAF5SX3.js → complexity-analyzer-XLYMAM6I.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-BNUOLW2M.js → continuedev-installer-GOT4TKNT.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-YXANWEVX.js → copilot-installer-D6BAQVIO.js} +2 -2
- package/dist/cli/chunks/{cost-tracker-EBAHKAGL.js → cost-tracker-VT7C5Q52.js} +2 -2
- package/dist/cli/chunks/{coverage-SWVKYJ6V.js → coverage-C62MRP4M.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-J2OFPM6R.js +2 -0
- package/dist/cli/chunks/{cursor-installer-QIZPJ5YQ.js → cursor-installer-WAWSS2K2.js} +2 -2
- package/dist/cli/chunks/{daemon-YPL4BMZX.js → daemon-CP2ETHRF.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-6XXECMF2.js → dag-attention-scheduler-SZIZWPV7.js} +2 -2
- package/dist/cli/chunks/{detect-GGTJLBM6.js → detect-AJX6NJEP.js} +2 -2
- package/dist/cli/chunks/{dist-node-B6P2AD27.js → dist-node-E5X47QTY.js} +2 -2
- package/dist/cli/chunks/{domain-handler-TSZJEND7.js → domain-handler-FN3PIP45.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-EBKK2ZKV.js → domain-transfer-N3TOJEMT.js} +2 -2
- package/dist/cli/chunks/dream-D5LD5SOZ.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-OMRWRS6V.js → embed-and-insert-pattern-PJI5TZKR.js} +2 -2
- package/dist/cli/chunks/{eval-Q5PAQA5O.js → eval-OS54TDQU.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-5MOUWAON.js → experience-capture-middleware-FBM4ANZW.js} +3 -3
- package/dist/cli/chunks/{fast-paths-32E3N4KU.js → fast-paths-2CVAAPQO.js} +2 -2
- package/dist/cli/chunks/{feature-flags-WRIWP5VL.js → feature-flags-A5KFWVFC.js} +2 -2
- package/dist/cli/chunks/{feature-flags-VERJA5SQ.js → feature-flags-GEXTW6OT.js} +2 -2
- package/dist/cli/chunks/{file-discovery-2X6CZSTB.js → file-discovery-KWLVC7KN.js} +2 -2
- package/dist/cli/chunks/{fleet-VB2JTP7P.js → fleet-MNKH356S.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-HNKBFKUD.js → gnn-wrapper-ALTWYFVZ.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-Y5GIRQNS.js → heartbeat-handler-MBMEPEGW.js} +4 -4
- package/dist/cli/chunks/{heartbeat-scheduler-UGB57DTJ.js → heartbeat-scheduler-OH3SS7MH.js} +2 -2
- package/dist/cli/chunks/hnsw-adapter-M2MMM3N6.js +2 -0
- package/dist/cli/chunks/hnsw-index-JO7KNF7M.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-A6G6GPMS.js → hnsw-legacy-bridge-WTD5PR5V.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-XT27JRMH.js → hnswlib-node-WENGW3YX.js} +2 -2
- package/dist/cli/chunks/hooks-ELHGEBFK.js +248 -0
- package/dist/cli/chunks/{hybrid-router-LTAQGTNR.js → hybrid-router-D6ZMIZCE.js} +2 -2
- package/dist/cli/chunks/{hypergraph-engine-IRTPRX6K.js → hypergraph-engine-JOQ6TERZ.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-6IVDHP2K.js → hypergraph-handler-HX45YWWN.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-ROQL4J7P.js +2 -0
- package/dist/cli/chunks/{init-handler-NNLOQN2F.js → init-handler-TNVU6NQ6.js} +6 -6
- package/dist/cli/chunks/init-wizard-4BDFZX4M.js +2 -0
- package/dist/cli/chunks/kernel-37Y63WKR.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-Q5A6WBX2.js → kilocode-installer-YC5RJIY4.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-ZVOLX6AX.js → kiro-installer-EAB26M55.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-V3DX6ZCX.js +2 -0
- package/dist/cli/chunks/learning-A2OB7D2B.js +117 -0
- package/dist/cli/chunks/{llm-router-EFIOXD3E.js → llm-router-KEG6PA7C.js} +4 -4
- package/dist/cli/chunks/{load-7HYD5K5T.js → load-D6ZDLVA3.js} +2 -2
- package/dist/cli/chunks/load-test-HPBA2CMT.js +2 -0
- package/dist/cli/chunks/{mcp-TQEPJY5L.js → mcp-ERJHZ6FN.js} +2 -2
- package/dist/cli/chunks/{memory-2P5KRDUP.js → memory-GSRIJIVR.js} +5 -5
- package/dist/cli/chunks/memory-backend-DODDBB46.js +2 -0
- package/dist/cli/chunks/memory-handlers-MFLCRS7V.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-Z74ALKIH.js → multi-model-executor-GK3V7ERC.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-2NICPXQZ.js → opencode-installer-6TTN26RG.js} +2 -2
- package/dist/cli/chunks/{orchestrator-ZPVU3M4M.js → orchestrator-YVTSM6QW.js} +37 -18
- package/dist/cli/chunks/{pipeline-B55E7S5P.js → pipeline-EWLJCY5G.js} +2 -2
- package/dist/cli/chunks/{platform-6FY6335Y.js → platform-2ULHQQME.js} +2 -2
- package/dist/cli/chunks/{plugin-F23VOSIL.js → plugin-PYN2KOXA.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-LL7WPCNW.js → prime-radiant-advanced-wasm-IULCTOGZ.js} +2 -2
- package/dist/cli/chunks/protocol-executor-D56OYMCJ.js +2 -0
- package/dist/cli/chunks/{protocol-handler-JWPPGEUR.js → protocol-handler-FZYI2SBP.js} +2 -2
- package/dist/cli/chunks/{prove-S4PD63BK.js → prove-DN7S74SP.js} +2 -2
- package/dist/cli/chunks/{provider-manager-R7YYUTO3.js → provider-manager-FT3MCROB.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-KXROIEK7.js +2 -0
- package/dist/cli/chunks/{quality-UIG6G2BR.js → quality-ITBU6LGC.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-XOGATERL.js +2 -0
- package/dist/cli/chunks/{real-embeddings-7GJEWY4C.js → real-embeddings-PZUZ5RXJ.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-Y5YVCVVS.js → roocode-installer-2LMVZOUZ.js} +2 -2
- package/dist/cli/chunks/router-3EHNUCOM.js +2 -0
- package/dist/cli/chunks/routing-feedback-ZHKGET22.js +2 -0
- package/dist/cli/chunks/{routing-handler-YFBT7LZH.js → routing-handler-5RB73UCF.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-7WCRMBWZ.js → ruvector-commands-VBN4APMG.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-PPZ5AVFW.js → rvf-dual-writer-BNY4AUWT.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-SVW4AKVC.js → rvf-migration-adapter-73MKPBGV.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-TNCPU743.js → rvf-migration-coordinator-SGVB7ZAZ.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-4YC5IQUW.js +2 -0
- package/dist/cli/chunks/safe-db-PLJRHQIC.js +2 -0
- package/dist/cli/chunks/schedule-7DGELVJE.js +2 -0
- package/dist/cli/chunks/scheduler-VWASEC2J.js +2 -0
- package/dist/cli/chunks/{security-22YXZGU3.js → security-XUH4H7R3.js} +3 -3
- package/dist/cli/chunks/shared-rvf-adapter-DCVDY2XW.js +2 -0
- package/dist/cli/chunks/{shared-rvf-dual-writer-Q5OSQNW5.js → shared-rvf-dual-writer-GML4EDYF.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-CTEBGVOW.js +2 -0
- package/dist/cli/chunks/{status-handler-CTEEZTVQ.js → status-handler-XI7GJF6Z.js} +2 -2
- package/dist/cli/chunks/{structural-health-S72DLFPZ.js → structural-health-WPCYKOXV.js} +2 -2
- package/dist/cli/chunks/{sync-2AJ5S27F.js → sync-SFKTCRZC.js} +10 -10
- package/dist/cli/chunks/{task-handler-XQCQAUM3.js → task-handler-FZB55IEG.js} +2 -2
- package/dist/cli/chunks/{task-handlers-U6DXLSYJ.js → task-handlers-EXZGFH7F.js} +3 -3
- package/dist/cli/chunks/{test-K7C4CWFH.js → test-XYRN4OVU.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-WQBR6C3V.js → test-scheduling-FLVOPGOT.js} +5 -5
- package/dist/cli/chunks/{token-bootstrap-IRZHAD7N.js → token-bootstrap-FDCFVRHM.js} +2 -2
- package/dist/cli/chunks/{token-usage-DIK6QRD5.js → token-usage-MHNZF3DM.js} +2 -2
- package/dist/cli/chunks/{transformers-RPUPJLSR.js → transformers-4CRVTMWY.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-A45KH4YZ.js → tree-sitter-wasm-parser-CI3V4AND.js} +2 -2
- package/dist/cli/chunks/{types-LO5DGIJC.js → types-RKCD4BNL.js} +2 -2
- package/dist/cli/chunks/unified-memory-YDKXKW3D.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-6N7YZCLR.js +2 -0
- package/dist/cli/chunks/unified-persistence-UTWLPUQI.js +2 -0
- package/dist/cli/chunks/{upgrade-QZNMQOBY.js → upgrade-463W7VKH.js} +2 -2
- package/dist/cli/chunks/{validate-675K5FDZ.js → validate-LENSMEAY.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-TJXJFTT4.js → validate-swarm-4FEBNAWA.js} +2 -2
- package/dist/cli/chunks/{vibium-2FFU5KPE.js → vibium-TXNVIVWJ.js} +2 -2
- package/dist/cli/chunks/visual-security-DGXSOFKD.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-VX55VO25.js → web-tree-sitter-BZEGWID4.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-A7FNN7RB.js → windsurf-installer-7AFXJTPU.js} +2 -2
- package/dist/cli/chunks/{witness-chain-QLIBCLCH.js → witness-chain-G6SUZOZG.js} +2 -2
- package/dist/cli/chunks/witness-chain-VP4MF6EU.js +2 -0
- package/dist/cli/chunks/{workflow-LQDA5VYM.js → workflow-EVQPO6FH.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-VXSYAKQY.js +2 -0
- package/dist/cli/chunks/{wrappers-KE6AZMO6.js → wrappers-HR6RUDI2.js} +2 -2
- package/dist/cli/commands/hooks-handlers/editing-hooks.js +9 -3
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +16 -24
- package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +1 -1
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +8 -1
- package/dist/cli/commands/hooks-handlers/routing-hooks.js +15 -3
- package/dist/cli/commands/hooks-handlers/task-hooks.js +37 -46
- package/dist/cli/commands/learning.js +194 -0
- package/dist/cli/commands/sync.js +3 -0
- package/dist/domains/requirements-validation/services/quality-criteria/quality-criteria-service.js +4 -1
- package/dist/init/phases/07-hooks.js +4 -1
- package/dist/init/phases/10-workers.js +24 -2
- package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.js +15 -12
- package/dist/integrations/n8n/agent-factory.js +4 -1
- package/dist/integrations/n8n/n8n-adapter.js +4 -1
- package/dist/kernel/interfaces.d.ts +12 -0
- package/dist/kernel/kernel.d.ts +1 -0
- package/dist/kernel/kernel.js +57 -0
- package/dist/kernel/unified-memory-schemas.d.ts +1 -1
- package/dist/kernel/unified-memory-schemas.js +7 -1
- package/dist/learning/agent-routing.d.ts +134 -1
- package/dist/learning/agent-routing.js +185 -2
- package/dist/learning/dream/dream-insights-pruner.d.ts +49 -0
- package/dist/learning/dream/dream-insights-pruner.js +53 -0
- package/dist/learning/dream/dream-scheduler.js +17 -0
- package/dist/learning/loop-health.d.ts +84 -0
- package/dist/learning/loop-health.js +91 -0
- package/dist/learning/pattern-usage-recorder.d.ts +58 -0
- package/dist/learning/pattern-usage-recorder.js +72 -0
- package/dist/learning/qe-reasoning-bank-types.d.ts +11 -0
- package/dist/learning/qe-reasoning-bank.d.ts +11 -0
- package/dist/learning/qe-reasoning-bank.js +86 -3
- package/dist/learning/routing-topology-gate.d.ts +40 -0
- package/dist/learning/routing-topology-gate.js +55 -0
- package/dist/learning/sqlite-persistence.d.ts +6 -1
- package/dist/learning/sqlite-persistence.js +14 -20
- package/dist/mcp/bundle.js +3833 -3807
- package/dist/mcp/handlers/domain-handler-configs.js +72 -13
- package/dist/mcp/protocol-server.d.ts +6 -0
- package/dist/mcp/protocol-server.js +91 -2
- package/dist/mcp/tools/coherence/collapse.d.ts +4 -0
- package/dist/mcp/tools/coherence/collapse.js +48 -21
- package/dist/mcp/tools/embeddings/embedding.js +5 -2
- package/dist/routing/routing-feedback.js +7 -3
- package/dist/routing/routing-outcomes-migration.d.ts +31 -0
- package/dist/routing/routing-outcomes-migration.js +60 -0
- package/dist/test-scheduling/pipeline.d.ts +1 -1
- package/dist/test-scheduling/pipeline.js +8 -2
- package/dist/workers/workers/learning-consolidation.d.ts +28 -0
- package/dist/workers/workers/learning-consolidation.js +204 -0
- package/dist/workflows/browser/workflow-loader.js +4 -1
- package/package.json +1 -1
- package/dist/cli/chunks/adapter-4NVP2SYD.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-ZTR5KIGB.js +0 -2
- package/dist/cli/chunks/base-2M65XYDE.js +0 -2
- package/dist/cli/chunks/browser-workflow-7EXB6DUF.js +0 -2
- package/dist/cli/chunks/chunk-6ZJROHI3.js +0 -2
- package/dist/cli/chunks/chunk-J3CLEYJP.js +0 -14
- package/dist/cli/chunks/chunk-SRSL5OFF.js +0 -180
- package/dist/cli/chunks/chunk-WLPP7V3W.js +0 -95
- package/dist/cli/chunks/chunk-YXS6SHB2.js +0 -2
- package/dist/cli/chunks/client-KTEVHNVO.js +0 -2
- package/dist/cli/chunks/cross-domain-router-23RTLMQL.js +0 -2
- package/dist/cli/chunks/dream-KNO2ZF24.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-JQHOAYXA.js +0 -2
- package/dist/cli/chunks/hnsw-index-AIUQDZLY.js +0 -2
- package/dist/cli/chunks/hooks-Z4U7DCTP.js +0 -259
- package/dist/cli/chunks/impact-analyzer-ULJRGNBM.js +0 -2
- package/dist/cli/chunks/init-wizard-R2WC5V2W.js +0 -2
- package/dist/cli/chunks/kernel-ZDQG4UWQ.js +0 -2
- package/dist/cli/chunks/knowledge-graph-RLCAQW6I.js +0 -2
- package/dist/cli/chunks/learning-NZLHSX4F.js +0 -107
- package/dist/cli/chunks/load-test-KH35UZSW.js +0 -2
- package/dist/cli/chunks/memory-backend-NOYRJTBH.js +0 -2
- package/dist/cli/chunks/memory-handlers-YEQ4LSIX.js +0 -2
- package/dist/cli/chunks/protocol-executor-OL36TRHK.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-C4QW56VE.js +0 -2
- package/dist/cli/chunks/queen-coordinator-FDDIA6BW.js +0 -2
- package/dist/cli/chunks/router-RRKX62UE.js +0 -2
- package/dist/cli/chunks/routing-feedback-NRJJVC35.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-TQLQYN7Y.js +0 -2
- package/dist/cli/chunks/safe-db-COFZGOYL.js +0 -2
- package/dist/cli/chunks/schedule-QAMKOCVJ.js +0 -2
- package/dist/cli/chunks/scheduler-RFETEEGY.js +0 -2
- package/dist/cli/chunks/shared-rvf-adapter-QNA66NKB.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-43TV2RI3.js +0 -2
- package/dist/cli/chunks/unified-memory-VSSMXGHP.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-ZV324XYA.js +0 -2
- package/dist/cli/chunks/unified-persistence-EE2UVIXW.js +0 -2
- package/dist/cli/chunks/visual-security-LWH7LME7.js +0 -2
- package/dist/cli/chunks/witness-chain-3YAV5SLZ.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-4UG2CNYN.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.31");process.exit(0)}
|
|
2
|
+
import{d as k,f as we}from"./chunk-X2FLWV5C.js";import{b as C,d as Z}from"./chunk-WB6TI6Q3.js";import{a as ye}from"./chunk-5Z6PYYWK.js";import{c as Q}from"./chunk-NZQYNUGM.js";import{a as V,c as De}from"./chunk-K6MFAVXK.js";import{a as J,b as Xe}from"./chunk-CFLA2GBS.js";import{a as ee,d as D,e as te,f as ne}from"./chunk-N6SIKSCO.js";import{a as v,e as be}from"./chunk-7OVVBBOZ.js";import{c as R,e as ve}from"./chunk-BMS7WFDB.js";function O(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 b,se,oe,ie,ae,ce,Te,Ee,de,ue,le,pe,ge=R(()=>{"use strict";we();b=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,
|
|
@@ -502,7 +502,8 @@ import{d as k,f as we}from"./chunk-YDBBXRH7.js";import{a as ye}from"./chunk-6ZJR
|
|
|
502
502
|
CREATE INDEX IF NOT EXISTS idx_test_outcomes_domain ON test_outcomes(domain);
|
|
503
503
|
CREATE INDEX IF NOT EXISTS idx_test_outcomes_created ON test_outcomes(created_at);
|
|
504
504
|
|
|
505
|
-
-- Routing outcomes (ADR-022: Adaptive QE Agent Routing, ADR-092: advisor_consultation_json
|
|
505
|
+
-- Routing outcomes (ADR-022: Adaptive QE Agent Routing, ADR-092: advisor_consultation_json,
|
|
506
|
+
-- ADR-095: exploration / criticality / q_weight for \u03B5-greedy routing telemetry)
|
|
506
507
|
CREATE TABLE IF NOT EXISTS routing_outcomes (
|
|
507
508
|
id TEXT PRIMARY KEY,
|
|
508
509
|
task_json TEXT NOT NULL,
|
|
@@ -515,11 +516,16 @@ import{d as k,f as we}from"./chunk-YDBBXRH7.js";import{a as ye}from"./chunk-6ZJR
|
|
|
515
516
|
error TEXT,
|
|
516
517
|
model_tier TEXT,
|
|
517
518
|
advisor_consultation_json TEXT,
|
|
519
|
+
-- ADR-095: routing exploration telemetry
|
|
520
|
+
exploration INTEGER NOT NULL DEFAULT 0,
|
|
521
|
+
criticality REAL,
|
|
522
|
+
q_weight REAL,
|
|
518
523
|
created_at TEXT DEFAULT (datetime('now'))
|
|
519
524
|
);
|
|
520
525
|
CREATE INDEX IF NOT EXISTS idx_routing_outcomes_agent ON routing_outcomes(used_agent);
|
|
521
526
|
CREATE INDEX IF NOT EXISTS idx_routing_outcomes_created ON routing_outcomes(created_at);
|
|
522
527
|
CREATE INDEX IF NOT EXISTS idx_routing_outcomes_tier ON routing_outcomes(model_tier);
|
|
528
|
+
CREATE INDEX IF NOT EXISTS idx_routing_outcomes_exploration ON routing_outcomes(exploration);
|
|
523
529
|
|
|
524
530
|
-- Coverage sessions (ADR-023: Coverage Learning)
|
|
525
531
|
CREATE TABLE IF NOT EXISTS coverage_sessions (
|
|
@@ -545,7 +551,7 @@ import{d as k,f as we}from"./chunk-YDBBXRH7.js";import{a as ye}from"./chunk-6ZJR
|
|
|
545
551
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_technique ON coverage_sessions(technique);
|
|
546
552
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_agent ON coverage_sessions(agent_id);
|
|
547
553
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_created ON coverage_sessions(created_at);
|
|
548
|
-
`,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:()=>b,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();be();De();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 b("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 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!
|
|
549
555
|
Expected: ${this.config.dbPath}
|
|
550
556
|
Found ${o.length} backup(s), newest: ${a.path} (${(a.size/1024/1024).toFixed(1)}MB)
|
|
551
557
|
Restoring from backup to prevent data loss...`),g.copyFileSync(a.path,this.config.dbPath);for(let l of["-wal","-shm"]){let E=this.config.dbPath+l;g.existsSync(E)&&g.unlinkSync(E)}c=a.size}}if(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"),await this.runMigrations(),n&&c>1e6)try{let o=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get();if(o&&o.cnt===0){let a=g.statSync(this.config.dbPath).size;a<c*.1&&console.error(`[UnifiedMemory] CRITICAL: Possible data loss detected!
|
|
@@ -554,7 +560,7 @@ import{d as k,f as we}from"./chunk-YDBBXRH7.js";import{a as ye}from"./chunk-6ZJR
|
|
|
554
560
|
Check backups in ${t} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(e){throw this.initPromise=null,new Error(`Failed to initialize UnifiedMemoryManager: ${V(e)}`)}}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),l=g.statSync(a);return{path:a,size:l.size,mtime:l.mtimeMs}}).filter(o=>o.size>1e6).sort((o,a)=>a.mtime-o.mtime),c=f.join(e,"backups");if(g.existsSync(c)){let o=g.readdirSync(c);for(let a of o)if(a.endsWith(".db")){let l=f.join(c,a),E=g.statSync(l);E.size>1e6&&n.push({path:l,size:E.size,mtime:E.mtimeMs})}n.sort((a,l)=>l.mtime-a.mtime)}return n}catch{return[]}}warnIfDuplicateDatabases(){try{let e=G(),t=f.resolve(this.config.dbPath),c=[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));c.length>0&&console.warn(`[UnifiedMemory] WARNING: Duplicate database(s) detected!
|
|
555
561
|
Canonical: ${t}
|
|
556
562
|
Duplicates: ${c.join(", ")}
|
|
557
|
-
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=O(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:c}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,n)){let a=O(t);try{this.db.exec(`ALTER TABLE ${a} ADD COLUMN ${n} ${c}`),console.log(`[UnifiedMemory] Added column ${n} to ${t} (safe migration)`)}catch(l){console.log(`[UnifiedMemory] Column ${n} on ${t}: ${l instanceof Error?l.message:String(l)}`)}}}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<
|
|
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=O(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:c}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,n)){let a=O(t);try{this.db.exec(`ALTER TABLE ${a} ADD COLUMN ${n} ${c}`),console.log(`[UnifiedMemory] Added column ${n} to ${t} (safe migration)`)}catch(l){console.log(`[UnifiedMemory] Column ${n} on ${t}: ${l instanceof Error?l.message:String(l)}`)}}}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<b&&(console.log(`[UnifiedMemory] Migrating from v${t} to v${b}`),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(`
|
|
558
564
|
CREATE VIRTUAL TABLE IF NOT EXISTS qe_patterns_fts USING fts5(
|
|
559
565
|
name, description, pattern_type, qe_domain,
|
|
560
566
|
content='qe_patterns',
|
|
@@ -583,7 +589,7 @@ import{d as k,f as we}from"./chunk-YDBBXRH7.js";import{a as ye}from"./chunk-6ZJR
|
|
|
583
589
|
`)),this.db.prepare(`
|
|
584
590
|
INSERT OR REPLACE INTO schema_version (id, version, migrated_at)
|
|
585
591
|
VALUES (1, ?, datetime('now'))
|
|
586
|
-
`).run(
|
|
592
|
+
`).run(b)})(),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",c){this.ensureInitialized();let o=c?Date.now()+c*1e3:null,a=JSON.stringify(t);this.db.prepare(`
|
|
587
593
|
INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
|
|
588
594
|
VALUES (?, ?, ?, ?)
|
|
589
595
|
`).run(e,n,a,o)}async kvGet(e,t="default"){this.ensureInitialized();let n=this.db.prepare(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.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.31");process.exit(0)}
|
|
2
|
+
import{c as T}from"./chunk-BMS7WFDB.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,3 +1,3 @@
|
|
|
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 L}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.31");process.exit(0)}
|
|
2
|
+
import{a as L}from"./chunk-IRRGUXAU.js";import*as w from"fs";var R={"aqe test generate":{domain:"test-generation",action:"generateTests"},"aqe test execute":{domain:"test-execution",action:"execute"},"aqe coverage analyze":{domain:"coverage-analysis",action:"analyze"},"aqe coverage gaps":{domain:"coverage-analysis",action:"detectGaps"},"aqe quality gate":{domain:"quality-assessment",action:"evaluateGate"},"aqe quality assess":{domain:"quality-assessment",action:"analyzeQuality"},"aqe security scan":{domain:"security-compliance",action:"runSASTScan"},"aqe security audit":{domain:"security-compliance",action:"runAudit"},"aqe defect predict":{domain:"defect-intelligence",action:"predictDefects"},"aqe code index":{domain:"code-intelligence",action:"index"},"aqe code impact":{domain:"code-intelligence",action:"analyzeImpact"},"aqe contract validate":{domain:"contract-testing",action:"validateContract"},"aqe chaos test":{domain:"chaos-resilience",action:"runChaosTest"},"aqe requirements validate":{domain:"requirements-validation",action:"validateRequirements"},"aqe visual test":{domain:"visual-accessibility",action:"runVisualTest"},"aqe accessibility test":{domain:"visual-accessibility",action:"runAccessibilityTest"},"aqe learn optimize":{domain:"learning-optimization",action:"optimizeAllStrategies"}},D={daily:"0 0 * * *",weekly:"0 0 * * 0",hourly:"0 * * * *",minutely:"* * * * *"},S=1e4,x=20,M=1e4,W=["__proto__","constructor","prototype"];function v(t){return!W.includes(t)}function C(t){let n=t.split(`
|
|
3
3
|
`);if(n.length>S)throw new Error(`YAML content exceeds maximum allowed lines (${S}). File has ${n.length} lines.`);for(let i=0;i<n.length;i++)if(n[i].length>M)throw new Error(`YAML line ${i+1} exceeds maximum allowed length (${M} characters).`);let a={};for(let i=0;i<n.length;i++){let e=n[i];if(e.trim()===""||e.trim().startsWith("#")||e.search(/\S/)!==0)continue;let o=e.match(/^([\w_-]+):\s*(.+)$/);if(o){let[,c,u]=o;v(c)&&(a[c]=f(u))}}let r=["tags","stages","triggers"];for(let i of r){let e=new RegExp(`^${i}:\\s*$`),s=-1;for(let l=0;l<n.length;l++){let d=n[l];if(!(d.trim()===""||d.trim().startsWith("#"))&&e.test(d.trim())){s=l;break}}if(s===-1)continue;let o=[];a[i]=o;let c=n[s].search(/\S/),u=s+1;for(;u<n.length;){let l=n[u];if(l.trim()===""||l.trim().startsWith("#")){u++;continue}let d=l.search(/\S/),p=l.trim();if(d<=c&&!p.startsWith("-"))break;if(p.startsWith("- ")){let m=p.slice(2).trim();if(!m.includes(":")){o.push(f(m)),u++;continue}let g={},k=m.match(/^([\w_-]+):\s*(.*)$/);if(k){let[,h,y]=k;g[h]=f(y)}let T=d;for(u++;u<n.length;){let h=n[u];if(h.trim()===""||h.trim().startsWith("#")){u++;continue}let y=h.search(/\S/),q=h.trim();if(y<=T)break;let _=q.match(/^([\w_-]+):\s*(.*)$/);if(_){let[,A,$]=_;if($===""){let b=E(n,u+1,y,1);g[A]=b.value,u=b.nextLine;continue}else g[A]=f($)}u++}o.push(g)}else u++}}return a}function E(t,n,a,r=0){if(r>x)throw new Error(`YAML nesting exceeds maximum allowed depth (${x}).`);let i={},e=null,s=null,o=n;for(;o<t.length;){let u=t[o];if(u.trim()===""||u.trim().startsWith("#")){o++;continue}let l=u.search(/\S/),d=u.trim();if(l<=a)break;if(d.startsWith("- ")){let m=d.slice(2).trim();s&&!Array.isArray(i[s])&&(i[s]=[]),s?i[s].push(f(m)):(e||(e=[]),e.push(f(m))),o++;continue}let p=d.match(/^([\w_-]+):\s*(.*)$/);if(p){let[,m,g]=p;if(!v(m)){o++;continue}g===""?(s=m,i[m]=[]):(i[m]=f(g),s=null)}o++}if(e&&Object.keys(i).length===0)return{value:e,nextLine:o};let c=Object.keys(i);return c.length===1&&Array.isArray(i[c[0]])?{value:i[c[0]],nextLine:o}:{value:i,nextLine:o}}function f(t){if(t==="")return"";if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t==="true")return!0;if(t==="false")return!1;if(t==="null"||t==="~")return null;let n=Number(t);return!isNaN(n)&&t!==""?n:t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1).split(",").map(r=>f(r.trim())):t}function K(t){let n=[];if(!w.existsSync(t))return{success:!1,errors:[`File not found: ${t}`]};let a;try{a=w.readFileSync(t,"utf-8")}catch(r){return{success:!1,errors:[`Failed to read file: ${r}`]}}return Y(a,t)}function Y(t,n){let a=[],r;try{r=C(t)}catch(s){return{success:!1,errors:[`Invalid YAML syntax: ${s}`]}}if((!r.name||typeof r.name!="string")&&a.push('Pipeline must have a "name" field'),(!r.stages||!Array.isArray(r.stages))&&a.push('Pipeline must have a "stages" array'),a.length>0)return{success:!1,errors:a};let i={name:r.name,description:r.description,version:r.version||"1.0.0",schedule:r.schedule,stages:r.stages.map((s,o)=>{let c=s;return{name:c.name||`stage-${o}`,command:c.command,params:c.params,depends_on:c.depends_on,condition:c.condition,timeout:c.timeout,retry:c.retry,continue_on_failure:c.continue_on_failure}}),triggers:r.triggers,tags:r.tags,timeout:r.timeout};for(let s=0;s<i.stages.length;s++){let o=i.stages[s];o.command||a.push(`Stage ${s+1} (${o.name}) must have a "command" field`)}if(a.length>0)return{success:!1,pipeline:i,errors:a};let e=O(i,n);return{success:!0,pipeline:i,workflow:e,errors:[]}}function O(t,n){let a=`pipeline-${t.name.replace(/\s+/g,"-").toLowerCase()}`,r=t.stages.map((e,s)=>{let o=P(e.command),c={};if(e.params)for(let[l,d]of Object.entries(e.params))v(l)&&(c[l]=`input.${l}`);let u={id:`stage-${e.name.replace(/\s+/g,"-").toLowerCase()}`,name:e.name,domain:o.domain,action:o.action,inputMapping:Object.keys(c).length>0?c:void 0,dependsOn:e.depends_on?.map(l=>`stage-${l.replace(/\s+/g,"-").toLowerCase()}`),timeout:e.timeout?e.timeout*1e3:void 0,continueOnFailure:e.continue_on_failure};return e.condition&&(u.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),e.retry&&(u.retry={maxAttempts:e.retry.max_attempts||3,backoffMs:(e.retry.backoff_seconds||1)*1e3}),u}),i=t.triggers?.map(e=>{let s={eventType:I(e),sourceDomain:e.source_domain};return e.condition&&(s.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),s});return{id:a,name:t.name,description:t.description||`Pipeline from ${n||"inline YAML"}`,version:t.version||"1.0.0",steps:r,triggers:i,tags:t.tags,timeout:t.timeout?t.timeout*1e3:void 0}}function P(t){let n=t.trim().replace(/\s+/g," ").toLowerCase();for(let[a,r]of Object.entries(R))if(n.startsWith(a.toLowerCase()))return r;return n.includes("test")&&n.includes("generate")?{domain:"test-generation",action:"generateTests"}:n.includes("test")&&(n.includes("execute")||n.includes("run"))?{domain:"test-execution",action:"execute"}:n.includes("coverage")?{domain:"coverage-analysis",action:"analyze"}:n.includes("quality")||n.includes("gate")?{domain:"quality-assessment",action:"evaluateGate"}:n.includes("security")||n.includes("scan")?{domain:"security-compliance",action:"runSASTScan"}:n.includes("defect")||n.includes("predict")?{domain:"defect-intelligence",action:"predictDefects"}:{domain:"learning-optimization",action:"runLearningCycle"}}function I(t){let n=t.event.toLowerCase();return n==="push"?"code-intelligence.CodePushed":n==="pull_request"||n==="pr"?"code-intelligence.PullRequestOpened":n==="schedule"?"workflow.ScheduleTrigger":n==="quality_gate"?"quality-assessment.QualityGateEvaluated":n==="test_complete"?"test-execution.TestRunCompleted":n}function F(t){let n=[],a=[];if(t.name||n.push({path:"name",message:"Pipeline name is required",severity:"error"}),!t.stages||t.stages.length===0)n.push({path:"stages",message:"Pipeline must have at least one stage",severity:"error"});else{let r=new Set;for(let e=0;e<t.stages.length;e++){let s=t.stages[e],o=`stages[${e}]`;if(r.has(s.name)&&n.push({path:`${o}.name`,message:`Duplicate stage name: ${s.name}`,severity:"error"}),r.add(s.name),s.command?P(s.command).domain==="learning-optimization"&&!s.command.toLowerCase().includes("learn")&&a.push({path:`${o}.command`,message:`Command "${s.command}" not recognized, will default to learning-optimization domain`,severity:"warning"}):n.push({path:`${o}.command`,message:"Stage must have a command",severity:"error"}),s.depends_on)for(let c of s.depends_on)t.stages.some(u=>u.name===c)||n.push({path:`${o}.depends_on`,message:`Unknown dependency: ${c}`,severity:"error"});s.timeout!==void 0&&s.timeout<=0&&n.push({path:`${o}.timeout`,message:"Timeout must be a positive number",severity:"error"}),s.retry&&s.retry.max_attempts!==void 0&&s.retry.max_attempts<1&&n.push({path:`${o}.retry.max_attempts`,message:"max_attempts must be at least 1",severity:"error"})}let i=N(t.stages);i&&n.push({path:"stages",message:`Circular dependency detected: ${i}`,severity:"error"})}if(t.schedule&&(z(t.schedule)||n.push({path:"schedule",message:`Invalid cron expression: ${t.schedule}`,severity:"error"})),t.triggers)for(let r=0;r<t.triggers.length;r++){let i=t.triggers[r],e=`triggers[${r}]`;i.event||n.push({path:`${e}.event`,message:"Trigger must have an event type",severity:"error"}),i.source_domain&&!L.includes(i.source_domain)&&a.push({path:`${e}.source_domain`,message:`Unknown domain: ${i.source_domain}`,severity:"warning"})}return{valid:n.length===0,errors:n,warnings:a}}function N(t){let n=new Set,a=new Set,r=(i,e)=>{if(a.has(i))return[...e,i].join(" -> ");if(n.has(i))return null;n.add(i),a.add(i);let s=t.find(o=>o.name===i);if(s?.depends_on)for(let o of s.depends_on){let c=r(o,[...e,i]);if(c)return c}return a.delete(i),null};for(let i of t){let e=r(i.name,[]);if(e)return e}return null}function z(t){if(Object.keys(D).includes(t))return!0;let n=t.trim().split(/\s+/);if(n.length!==5)return!1;let a=[/^(\*|[0-5]?\d)(-[0-5]?\d)?(\/\d+)?$/,/^(\*|1?\d|2[0-3])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|[12]\d|3[01])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|1[0-2])(-\d+)?(\/\d+)?$/,/^(\*|[0-7])(-[0-7])?(\/\d+)?$/];for(let r=0;r<5;r++){let i=n[r].split(",");for(let e of i)if(!a[r].test(e)&&e!=="*")return!1}return!0}function G(t){let n={"@daily":"Daily at midnight","@weekly":"Weekly on Sunday at midnight","@hourly":"Every hour","@minutely":"Every minute"};if(n[t])return n[t];if(Object.keys(D).includes(t))return{daily:"Daily at midnight",weekly:"Weekly on Sunday at midnight",hourly:"Every hour",minutely:"Every minute"}[t]||t;let a=t.trim().split(/\s+/);if(a.length!==5)return t;let[r,i,e,s,o]=a;return r==="0"&&i==="0"&&e==="*"&&s==="*"&&o==="*"?"Daily at midnight":r==="0"&&e==="*"&&s==="*"&&o==="*"?`Daily at ${i}:00`:r!=="*"&&i!=="*"&&e==="*"&&s==="*"?`Daily at ${i}:${r.padStart(2,"0")}`:i==="*"&&r==="0"?"Every hour":r!=="*"&&i==="*"?`Every hour at minute ${r}`:t}function H(t,n=new Date){let a=t.trim().split(/\s+/);if(a.length!==5)return new Date(n.getTime()+1440*60*1e3);let[r,i]=a,e=new Date(n);return i!=="*"&&r!=="*"?(e.setHours(parseInt(i,10),parseInt(r,10),0,0),e<=n&&e.setDate(e.getDate()+1)):i!=="*"?(e.setHours(parseInt(i,10),0,0,0),e<=n&&e.setDate(e.getDate()+1)):r!=="*"?(e.setMinutes(parseInt(r,10),0,0),e<=n&&e.setHours(e.getHours()+1)):(e.setSeconds(0,0),e.setMinutes(e.getMinutes()+1)),e}export{C as a,K as b,F as c,G as d,H 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.
|
|
2
|
-
import{
|
|
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.31");process.exit(0)}
|
|
2
|
+
import{b as p,d as C}from"./chunk-WB6TI6Q3.js";import{a as b}from"./chunk-5Z6PYYWK.js";import{c as k}from"./chunk-NZQYNUGM.js";C();b();var m=k.create("skill-validation-learner"),v=class{constructor(e){this.reasoningBank=e}reasoningBank;memoryNamespace="skill-validation";feedbackLoop=null;connectFeedbackLoop(e){this.feedbackLoop=e}async recordValidationOutcome(e){await this.reasoningBank.storeQEPattern({patternType:"test-template",name:`${e.skillName}-validation-${e.validationLevel}`,description:`Validation outcome for ${e.skillName} at level ${e.validationLevel}`,context:{tags:["skill-validation",e.skillName,e.model,e.validationLevel],testType:"integration"},template:{type:"config",content:JSON.stringify({outcome:{skillName:e.skillName,trustTier:e.trustTier,validationLevel:e.validationLevel,model:e.model,passed:e.passed,score:e.score,testCaseCount:e.testCaseResults.length,passedTests:e.testCaseResults.filter(s=>s.passed).length,avgReasoningQuality:this.calculateAvgReasoningQuality(e.testCaseResults),timestamp:e.timestamp.toISOString(),runId:e.runId,metadata:e.metadata}}),variables:[]}}),await this.updateSkillConfidence(e),e.validationLevel==="eval"&&await this.trackCrossModelBehavior(e),this.feedbackLoop&&e.runId&&await this.recordToFeedbackLoop(e)}async updateSkillConfidence(e){let s=`skill-confidence-${e.skillName}`,n=await this.reasoningBank.searchQEPatterns(s,{limit:1}),t;if(n.success&&n.value.length>0)try{let r=n.value[0].pattern.template?.content;if(r){let i=p(r);i&&typeof i=="object"&&Array.isArray(i.outcomes)?t=i:t=this.createEmptyConfidence(e.skillName)}else t=this.createEmptyConfidence(e.skillName)}catch(a){m.debug("Confidence history parse failed",{skill:e.skillName,error:a instanceof Error?a.message:String(a)}),t=this.createEmptyConfidence(e.skillName)}else t=this.createEmptyConfidence(e.skillName);t.outcomes.push({score:e.score,timestamp:e.timestamp,model:e.model,validationLevel:e.validationLevel,passed:e.passed}),t.outcomes.length>100&&(t.outcomes=t.outcomes.slice(-100)),t.avgScore=t.outcomes.reduce((a,r)=>a+r.score,0)/t.outcomes.length,t.lastUpdated=new Date,t.trend=this.calculateTrend(t.outcomes),t.byLevel=this.calculateConfidenceByLevel(t.outcomes),await this.reasoningBank.storeQEPattern({patternType:"test-template",name:s,description:`Skill confidence tracking for ${e.skillName}`,context:{tags:["skill-confidence",e.skillName]},template:{type:"config",content:JSON.stringify(t),variables:[]}})}async trackCrossModelBehavior(e){let s=`cross-model-${e.skillName}`,n=await this.reasoningBank.searchQEPatterns(s,{limit:1}),t;if(n.success&&n.value.length>0)try{let c=n.value[0].pattern.template?.content;if(c){let l=p(c);l&&typeof l=="object"&&typeof l.models=="object"?t=l:t=this.createEmptyCrossModelAnalysis()}else t=this.createEmptyCrossModelAnalysis()}catch(o){m.debug("Cross-model analysis parse failed",{error:o instanceof Error?o.message:String(o)}),t=this.createEmptyCrossModelAnalysis()}else t=this.createEmptyCrossModelAnalysis();t.models||(t.models={}),t.models[e.model]||(t.models[e.model]={scores:[],passRate:0,avgReasoningQuality:0,sampleCount:0});let a=t.models[e.model];a.scores.push(e.score),a.sampleCount++,a.scores.length>50&&(a.scores=a.scores.slice(-50));let r=this.calculateAvgReasoningQuality(e.testCaseResults);a.passRate=a.scores.filter(o=>o>=.9).length/a.scores.length,a.avgReasoningQuality=(a.avgReasoningQuality*(a.sampleCount-1)+r)/a.sampleCount;let i=Object.values(t.models).map(o=>o.passRate);if(i.length>1){let o=i.reduce((l,d)=>l+d,0)/i.length,c=i.reduce((l,d)=>l+Math.pow(d-o,2),0)/i.length;t.variance=c,t.hasAnomalies=c>.04,t.anomalies=[];for(let[l,d]of Object.entries(t.models))Math.abs(d.passRate-o)>.2&&t.anomalies.push({model:l,type:d.passRate<o?"low_performance":"high_variance",description:`Model ${l} has ${((d.passRate-o)*100).toFixed(1)}% difference from average`})}t.lastUpdated=new Date,await this.reasoningBank.storeQEPattern({patternType:"test-template",name:s,description:`Cross-model behavior tracking for ${e.skillName}`,context:{tags:["cross-model",e.skillName]},template:{type:"config",content:JSON.stringify(t),variables:[]}})}async recordToFeedbackLoop(e){if(!this.feedbackLoop)return;let s={taskId:e.runId,taskDescription:`Skill validation: ${e.skillName} (${e.validationLevel})`,recommendedAgent:"skill-validator",usedAgent:"skill-validator",followedRecommendation:!0,success:e.passed,qualityScore:e.score,durationMs:e.metadata?.duration||0,timestamp:e.timestamp};await this.feedbackLoop.recordRoutingOutcome(s)}async getSkillConfidence(e){let s=`skill-confidence-${e}`,n=await this.reasoningBank.searchQEPatterns(s,{limit:1});if(n.success&&n.value.length>0)try{let t=n.value[0].pattern.template?.content;if(t)return p(t)}catch(t){m.debug("Skill confidence pattern content invalid",{skill:e,error:t instanceof Error?t.message:String(t)})}return null}async getCrossModelAnalysis(e){let s=`cross-model-${e}`,n=await this.reasoningBank.searchQEPatterns(s,{limit:1});if(n.success&&n.value.length>0)try{let t=n.value[0].pattern.template?.content;if(t)return p(t)}catch(t){m.debug("Cross-model pattern content invalid",{skill:e,error:t instanceof Error?t.message:String(t)})}return null}async queryValidationPatterns(e,s=10){let n=await this.reasoningBank.searchQEPatterns(`${e} validation`,{limit:s});return n.success?n.value.filter(t=>t.pattern.context?.tags?.includes("skill-validation")).map(t=>t.pattern):[]}async getValidationTrends(e){let s=await this.getSkillConfidence(e),n=await this.getCrossModelAnalysis(e);if(!s)return null;let t={};if(n)for(let i of Object.keys(n.models)){let o=s.outcomes.filter(c=>c.model===i).map(c=>({score:c.score}));t[i]=this.calculateTrend(o)}let a=s.outcomes.slice(-20),r=a.filter(i=>i.passed).length/a.length;return{overall:s.trend||"stable",byModel:t,recentPassRate:r}}async extractLearnedPatterns(e){let s=await this.queryValidationPatterns(e,50),n=[],t=new Map;for(let a of s)try{let i=p(a.template?.content||"{}").outcome?.metadata?.category||"general";t.has(i)||t.set(i,[]),t.get(i).push(a)}catch(r){m.debug("Invalid pattern during category grouping",{error:r instanceof Error?r.message:String(r)})}for(let[a,r]of Array.from(t.entries())){let i=new Set,o=new Set,c=new Set,l=0;for(let d of r)try{let f=p(d.template?.content||"{}").outcome;if(!f)continue;c.add(f.model),l+=f.score;let h=d.context?.tags||[];f.passed?h.filter(g=>!["skill-validation",e].includes(g)).forEach(g=>i.add(g)):h.filter(g=>!["skill-validation",e].includes(g)).forEach(g=>o.add(g))}catch(u){m.debug("Invalid pattern during category extraction",{error:u instanceof Error?u.message:String(u)})}r.length>0&&n.push({id:`${e}-${a}`,skillName:e,category:a,successIndicators:Array.from(i),failureIndicators:Array.from(o),models:Array.from(c),confidence:l/r.length,observationCount:r.length})}return n}createEmptyConfidence(e){return{skillName:e,avgScore:0,outcomes:[],lastUpdated:new Date}}createEmptyCrossModelAnalysis(){return{models:{},variance:0,hasAnomalies:!1,lastUpdated:new Date}}calculateAvgReasoningQuality(e){return e.length===0?0:e.reduce((s,n)=>s+n.reasoningQuality,0)/e.length}calculateTrend(e){if(e.length<5)return"stable";let s=e.slice(-10),n=e.slice(-20,-10);if(n.length===0)return"stable";let t=s.reduce((i,o)=>i+o.score,0)/s.length,a=n.reduce((i,o)=>i+o.score,0)/n.length,r=t-a;return r>.05?"improving":r<-.05?"declining":"stable"}calculateConfidenceByLevel(e){let s={schema:[],validator:[],eval:[]};for(let t of e)t.validationLevel&&s[t.validationLevel].push(t.score);let n={};for(let[t,a]of Object.entries(s))a.length>0&&(n[t]=a.reduce((r,i)=>r+i,0)/a.length);return n}};function L(y){return new v(y)}export{L as a};
|
|
@@ -1 +1 @@
|
|
|
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.31");process.exit(0)}
|
|
@@ -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.31");process.exit(0)}
|
|
2
2
|
function M(u){let e=u|0;return()=>{e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}var A=2,y=10,x=200,p=1e-8,b=class{epsilon;seed;constructor(e){if(this.epsilon=e?.epsilon??.3,this.seed=e?.seed,this.epsilon<=0||this.epsilon>=1)throw new Error("SparsifierConfig.epsilon must be in (0, 1)")}sparsify(e){if(e.nodeCount<=0||e.edges.length===0)return{nodeCount:e.nodeCount,edges:[]};let n=this.seed!==void 0?M(this.seed):Math.random,t=this.approximateEffectiveResistances(e),i=e.nodeCount,r=e.edges.length,o=Math.max(1,Math.log(i)),m=this.epsilon*this.epsilon,l=Math.min(r,Math.max(i-1,A*(i-1)*(1-this.epsilon))),s=new Float64Array(r),c=0;for(let a=0;a<r;a++){let d=e.edges[a][2];s[a]=d*t[a],c+=s[a]}if(c<=0)return{nodeCount:e.nodeCount,edges:[]};let f=[];for(let a=0;a<r;a++){let[d,C,E]=e.edges[a],g=Math.min(1,s[a]/c*l);if(n()<g){let w=E/g;f.push([d,C,w])}}return{nodeCount:e.nodeCount,edges:f}}validateSpectral(e,n){let t=Math.min(y,Math.max(1,e.nodeCount-1)),i=this.computeLaplacian(e),r=this.computeLaplacian(n),o=this.computeTopEigenvalues(i,t),m=this.computeTopEigenvalues(r,t),l=[],s=!0,c=this.epsilon;for(let f=0;f<o.length;f++){if(o[f]<1e-10)continue;let a=m[f]/o[f];l.push(a),(a<1-c||a>1+c)&&(s=!1)}return{isValid:s,eigenvalueRatios:l,originalEdgeCount:e.edges.length,sparsifiedEdgeCount:n.edges.length,compressionRatio:e.edges.length>0?n.edges.length/e.edges.length:0}}computeLaplacian(e){let n=e.nodeCount,t=Array.from({length:n},()=>new Array(n).fill(0));for(let[i,r,o]of e.edges)i<0||i>=n||r<0||r>=n||(t[i][i]+=o,t[r][r]+=o,t[i][r]-=o,t[r][i]-=o);return t}computeTopEigenvalues(e,n){let t=e.length;if(t===0)return[];let i=[],r=[],o=e.map(m=>[...m]);for(let m=0;m<Math.min(n,t);m++){let l=this.powerIteration(o,t,r);if(l===null)break;i.push(l.eigenvalue),r.push(l.eigenvector),V(o,l.eigenvalue,l.eigenvector)}return i}approximateEffectiveResistances(e){let n=e.nodeCount,t=new Float64Array(n);for(let[r,o,m]of e.edges)r>=0&&r<n&&(t[r]+=m),o>=0&&o<n&&(t[o]+=m);let i=new Array(e.edges.length);for(let r=0;r<e.edges.length;r++){let[o,m]=e.edges[r],l=t[o]||1,s=t[m]||1;i[r]=1/l+1/s}return i}powerIteration(e,n,t){let i=0;for(let s=0;s<n;s++)for(let c=0;c<n;c++)i+=e[s][c]*e[s][c];if(i<p*p)return null;let r=t.length,o=new Array(n);for(let s=0;s<n;s++)o[s]=Math.sin((s+1)*(r+1)*1.618033988749895)+.1*(s-n/2);for(let s of t)h(o,s);if(R(o)<p)return null;let l=0;for(let s=0;s<x;s++){let c=L(e,o);for(let d of t)h(c,d);let f=S(c,o),a=v(c);if(a<p)return{eigenvalue:0,eigenvector:o};for(let d=0;d<n;d++)o[d]=c[d]/a;if(Math.abs(f-l)<p){l=f;break}l=f}return{eigenvalue:Math.abs(l),eigenvector:o}}};function L(u,e){let n=u.length,t=new Array(n).fill(0);for(let i=0;i<n;i++){let r=0;for(let o=0;o<n;o++)r+=u[i][o]*e[o];t[i]=r}return t}function v(u){let e=0;for(let n=0;n<u.length;n++)e+=u[n]*u[n];return Math.sqrt(e)}function R(u){let e=v(u);if(e>0)for(let n=0;n<u.length;n++)u[n]/=e;return e}function S(u,e){let n=0;for(let t=0;t<u.length;t++)n+=u[t]*e[t];return n}function h(u,e){let n=S(u,e);for(let t=0;t<u.length;t++)u[t]-=n*e[t]}function V(u,e,n){let t=n.length;for(let i=0;i<t;i++)for(let r=0;r<t;r++)u[i][r]-=e*n[i]*n[r]}export{b 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.
|
|
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.31");process.exit(0)}
|
|
2
|
+
import{c as s,e as t}from"./chunk-BMS7WFDB.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{a as M}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.31");process.exit(0)}
|
|
2
|
+
import{a as M}from"./chunk-EAIPJSKH.js";import{f as y,o as T}from"./chunk-7MXQV7RB.js";import{a as p,c as S}from"./chunk-K6MFAVXK.js";import{i as b}from"./chunk-GQFAVT2I.js";T();S();import*as c from"path";import*as d from"fs";var m=null,u=null,l=null;function R(o){l=o}async function P(){return m||u||(u=(async()=>{let o=y(),e=c.join(o,".agentic-qe");d.existsSync(e)||d.mkdirSync(e,{recursive:!0});let r=new M({sqlite:{path:c.join(e,"memory.db"),walMode:!0,poolSize:3,busyTimeout:5e3},enableFallback:!0,defaultNamespace:"mcp-tools"});return await r.initialize(),m=r,r})(),u)}function $(){if(l)try{l()}catch{}m&&(m.dispose().catch(()=>{}),m=null),u=null}async function D(o){return o?.memory?o.memory:P()}var C={info:(o,e)=>console.log(`[MCP-TOOL] ${o}`,e||""),warn:(o,e)=>console.warn(`[MCP-TOOL] \u26A0\uFE0F ${o}`,e||""),error:(o,e)=>console.error(`[MCP-TOOL] \u274C ${o}`,e||"")},h=class{logger=C;currentDataSource="real";setLogger(e){this.logger=e}markAsDemoData(e,r){this.currentDataSource=e.demoMode?"demo":"fallback",this.logger.warn(`${this.config.name} returning ${this.currentDataSource} data`,{reason:r,requestId:e.requestId,demoMode:e.demoMode})}markAsRealData(){this.currentDataSource="real"}isDemoMode(e){return e.demoMode===!0}validate(e){let r=[];if(typeof e!="object"||e===null)return{valid:!1,errors:["Parameters must be an object"]};let t=e,{properties:a,required:n}=this.config.schema;if(n)for(let i of n)i in t||r.push(`Missing required field: ${i}`);for(let[i,s]of Object.entries(t)){let g=a[i];if(!g)continue;let f=this.validateType(i,s,g);f&&r.push(f)}return{valid:r.length===0,errors:r}}validateType(e,r,t){if(r==null)return null;let a=Array.isArray(r)?"array":typeof r;if(t.type==="array"&&!Array.isArray(r))return`${e} must be an array`;if(t.type!=="array"&&a!==t.type)return`${e} must be of type ${t.type}, got ${a}`;if(t.enum&&!t.enum.includes(r))return`${e} must be one of: ${t.enum.join(", ")}`;if(t.type==="number"){let n=r;if(t.minimum!==void 0&&n<t.minimum)return`${e} must be >= ${t.minimum}`;if(t.maximum!==void 0&&n>t.maximum)return`${e} must be <= ${t.maximum}`}if(t.type==="string"){let n=r;if(t.minLength!==void 0&&n.length<t.minLength)return`${e} must be at least ${t.minLength} characters`;if(t.maxLength!==void 0&&n.length>t.maxLength)return`${e} must be at most ${t.maxLength} characters`}return null}async invoke(e,r={}){let t=Date.now(),a=b();this.currentDataSource="real";let n=this.validate(e);if(!n.valid)return{success:!1,error:`Validation failed: ${n.errors.join("; ")}`,metadata:this.createMetadata(t,a)};let i={requestId:a,startTime:t,streaming:r.streaming,onStream:r.onStream,abortSignal:r.abortSignal,demoMode:r.demoMode};try{let s=await this.execute(e,i);return{...s,metadata:{...s.metadata,...this.createMetadata(t,a)}}}catch(s){return{success:!1,error:p(s),metadata:this.createMetadata(t,a)}}}createMetadata(e,r){return{executionTime:Date.now()-e,timestamp:new Date().toISOString(),requestId:r,domain:this.config.domain,toolName:this.config.name,dataSource:this.currentDataSource}}emitStream(e,r){e.streaming&&e.onStream&&e.onStream(r)}isAborted(e){return e.abortSignal?.aborted??!1}get name(){return this.config.name}get description(){return this.config.description}get domain(){return this.config.domain}getSchema(){return this.config.schema}get timeout(){return this.config.timeout??6e4}get supportsStreaming(){return this.config.streaming??!1}resetInstanceCache(){}};export{R as a,P as b,$ as c,D as d,C as e,h as f};
|
|
@@ -1,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.31");process.exit(0)}
|
|
2
2
|
var i=class{s0;s1;s2;s3;constructor(s){this.s0=this.splitmix32(s),this.s1=this.splitmix32(this.s0),this.s2=this.splitmix32(this.s1),this.s3=this.splitmix32(this.s2)}splitmix32(s){return s=s+2654435769|0,s=Math.imul(s^s>>>16,2246822507),s=Math.imul(s^s>>>13,3266489909),(s^s>>>16)>>>0}next(){let s=this.s3,t=this.s0;return this.s3=this.s2,this.s2=this.s1,this.s1=t,t^=t<<11,t^=t>>>8,this.s0=t^s^s>>>19,this.s0>>>0}nextFloat(){return this.next()/4294967296}nextGaussian(){let s=this.nextFloat()||1e-10,t=this.nextFloat();return Math.sqrt(-2*Math.log(s))*Math.cos(2*Math.PI*t)}};export{i 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.31");process.exit(0)}
|
|
2
2
|
var h=Object.create;var e=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')}),n=a=>b=>{var c=a[b];if(c)return c();throw new Error("Module not found in bundle: "+b)};var o=(a,b)=>()=>(a&&(b=a(a=0)),b);var p=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),q=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})},g=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of j(b))!l.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=i(b,d))||f.enumerable});return a};var r=(a,b,c)=>(c=a!=null?h(k(a)):{},g(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c,a)),s=a=>g(e({},"__esModule",{value:!0}),a);export{m as a,n as b,o as c,p as d,q as e,r as f,s as g};
|
|
@@ -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 ye}from"./chunk-6ZJROHI3.js";import{c as oe,d as ce,e as fe}from"./chunk-LPSIKIE2.js";import{b as N,d as le}from"./chunk-CZEQFAKE.js";import{b as w,c as L}from"./chunk-BUMNLVMC.js";import{a as j,b as D,c as V}from"./chunk-LIEKDXTS.js";ye();import{createRequire as be}from"module";var O;function W(){if(!O){let h=be(import.meta.url);try{O=h("typescript")}catch{try{O=h("typescript/lib/typescript.js")}catch{O=new Proxy({},{get(e,t){if(!(t==="__esModule"||typeof t=="symbol"))throw new Error("TypeScript is required for code analysis. Install it: npm install -g typescript")}})}}}return O}var p=new Proxy({},{get(h,e){return W()[e]},has(h,e){return e in W()},ownKeys(){return Object.keys(W())},getOwnPropertyDescriptor(h,e){let t=W()[e];if(t!==void 0)return{configurable:!0,enumerable:!0,value:t}}});var F=class{parseFile(e,t){return p.createSourceFile(e,t,p.ScriptTarget.Latest,!0,this.getScriptKind(e))}extractFunctions(e){let t=[],s=n=>{p.isFunctionDeclaration(n)&&n.name?t.push(this.extractFunctionDeclaration(n,e)):p.isVariableStatement(n)&&this.extractArrowFunctions(n,e,t),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractClasses(e){let t=[],s=n=>{p.isClassDeclaration(n)&&n.name&&t.push(this.extractClassDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractImports(e){let t=[],s=n=>{p.isImportDeclaration(n)&&t.push(this.extractImportDeclaration(n)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractExports(e){let t=[],s=n=>{if(p.isExportDeclaration(n))this.extractExportDeclaration(n,t);else if(p.isExportAssignment(n))t.push({name:this.getExportAssignmentName(n),type:"unknown",isDefault:!0,isReexport:!1,sourceModule:void 0});else if(p.isFunctionDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"function",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isClassDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"class",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isVariableStatement(n)&&this.hasExportModifier(n))for(let r of n.declarationList.declarations)p.isIdentifier(r.name)&&t.push({name:r.name.text,type:"variable",isDefault:!1,isReexport:!1,sourceModule:void 0});else p.isInterfaceDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"interface",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isTypeAliasDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"type",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isEnumDeclaration(n)&&this.hasExportModifier(n)&&t.push({name:n.name.text,type:"enum",isDefault:!1,isReexport:!1,sourceModule:void 0});p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractInterfaces(e){let t=[],s=n=>{p.isInterfaceDeclaration(n)&&t.push(this.extractInterfaceDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractEntities(e,t){let s=this.parseFile(t,e),n=[],r=this.extractFunctions(s);for(let a of r)n.push({name:a.name,type:"function",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:a.isAsync,isExported:a.isExported,parameters:a.parameters,returnType:a.returnType});let o=this.extractClasses(s);for(let a of o)n.push({name:a.name,type:"class",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported,extends:a.extends,implements:a.implements});let i=this.extractInterfaces(s);for(let a of i)n.push({name:a.name,type:"interface",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported});return n}getScriptKind(e){return e.endsWith(".tsx")?p.ScriptKind.TSX:e.endsWith(".ts")?p.ScriptKind.TS:e.endsWith(".jsx")?p.ScriptKind.JSX:e.endsWith(".js")?p.ScriptKind.JS:p.ScriptKind.TS}extractFunctionDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:e.name?.text??"anonymous",parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,startLine:s+1,endLine:n+1,isAsync:this.hasAsyncModifier(e),isExported:this.hasExportModifier(e),isGenerator:!!e.asteriskToken,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractArrowFunctions(e,t,s){for(let n of e.declarationList.declarations)if(p.isIdentifier(n.name)&&n.initializer&&p.isArrowFunction(n.initializer)){let r=n.initializer,{line:o}=t.getLineAndCharacterOfPosition(e.getStart()),{line:i}=t.getLineAndCharacterOfPosition(e.getEnd());s.push({name:n.name.text,parameters:this.extractParameters(r.parameters),returnType:r.type?r.type.getText(t):void 0,startLine:o+1,endLine:i+1,isAsync:this.hasAsyncModifier(r),isExported:this.hasExportModifier(e),isGenerator:!1,typeParameters:this.extractTypeParameters(r.typeParameters)})}}extractClassDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let c of e.members)p.isMethodDeclaration(c)&&c.name?r.push(this.extractMethodDeclaration(c,t)):p.isPropertyDeclaration(c)&&c.name?o.push(this.extractPropertyDeclaration(c,t)):p.isConstructorDeclaration(c)&&(r.push(this.extractConstructor(c,t)),this.extractParameterProperties(c,o,t));let i,a=[];if(e.heritageClauses){for(let c of e.heritageClauses)if(c.token===p.SyntaxKind.ExtendsKeyword)i=c.types[0]?.expression.getText(t);else if(c.token===p.SyntaxKind.ImplementsKeyword)for(let l of c.types)a.push(l.expression.getText(t))}return{name:e.name?.text??"anonymous",methods:r,properties:o,extends:i,implements:a,isAbstract:this.hasAbstractModifier(e),isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractMethodDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:this.getPropertyName(e.name,t),parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,isAsync:this.hasAsyncModifier(e),isStatic:this.hasStaticModifier(e),isAbstract:this.hasAbstractModifier(e),visibility:this.getVisibility(e),startLine:s+1,endLine:n+1}}extractConstructor(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:"constructor",parameters:this.extractParameters(e.parameters),returnType:void 0,isAsync:!1,isStatic:!1,isAbstract:!1,visibility:"public",startLine:s+1,endLine:n+1}}extractParameterProperties(e,t,s){for(let n of e.parameters)this.isParameterProperty(n)&&t.push({name:p.isIdentifier(n.name)?n.name.text:n.name.getText(s),type:n.type?n.type.getText(s):void 0,isStatic:!1,isReadonly:this.hasReadonlyModifier(n),visibility:this.getVisibility(n),hasInitializer:!!n.initializer})}isParameterProperty(e){return!!e.modifiers?.some(t=>t.kind===p.SyntaxKind.PublicKeyword||t.kind===p.SyntaxKind.PrivateKeyword||t.kind===p.SyntaxKind.ProtectedKeyword||t.kind===p.SyntaxKind.ReadonlyKeyword)}extractPropertyDeclaration(e,t){return{name:this.getPropertyName(e.name,t),type:e.type?e.type.getText(t):void 0,isStatic:this.hasStaticModifier(e),isReadonly:this.hasReadonlyModifier(e),visibility:this.getVisibility(e),hasInitializer:!!e.initializer}}extractImportDeclaration(e){let t=e.moduleSpecifier.text,s=[],n,r,o=e.importClause?.isTypeOnly??!1;if(e.importClause&&(e.importClause.name&&(n=e.importClause.name.text),e.importClause.namedBindings)){if(p.isNamespaceImport(e.importClause.namedBindings))r=e.importClause.namedBindings.name.text;else if(p.isNamedImports(e.importClause.namedBindings))for(let i of e.importClause.namedBindings.elements)s.push({name:i.propertyName?.text??i.name.text,alias:i.propertyName?i.name.text:void 0})}return{module:t,namedImports:s,defaultImport:n,namespaceImport:r,isTypeOnly:o}}extractExportDeclaration(e,t){let s=e.moduleSpecifier?e.moduleSpecifier.text:void 0;if(e.exportClause&&p.isNamedExports(e.exportClause))for(let n of e.exportClause.elements)t.push({name:n.name.text,type:"unknown",isDefault:!1,isReexport:!!s,sourceModule:s});else!e.exportClause&&s&&t.push({name:"*",type:"unknown",isDefault:!1,isReexport:!0,sourceModule:s})}extractInterfaceDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let a of e.members)p.isPropertySignature(a)&&a.name?r.push({name:this.getPropertyName(a.name,t),type:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken,isReadonly:this.hasReadonlyModifier(a)}):p.isMethodSignature(a)&&a.name&&o.push({name:this.getPropertyName(a.name,t),parameters:this.extractParameters(a.parameters),returnType:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken});let i=[];if(e.heritageClauses){for(let a of e.heritageClauses)if(a.token===p.SyntaxKind.ExtendsKeyword)for(let c of a.types)i.push(c.expression.getText(t))}return{name:e.name.text,properties:r,methods:o,extends:i,isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractParameters(e){return e.map(t=>{let s=t.getSourceFile();return{name:p.isIdentifier(t.name)?t.name.text:t.name.getText(s),type:t.type?t.type.getText(s):void 0,isOptional:!!t.questionToken||!!t.initializer,isRest:!!t.dotDotDotToken,defaultValue:t.initializer?t.initializer.getText(s):void 0}})}extractTypeParameters(e){return e?e.map(t=>t.name.text):[]}getPropertyName(e,t){return p.isIdentifier(e)||p.isStringLiteral(e)||p.isNumericLiteral(e)?e.text:e.getText(t)}getExportAssignmentName(e){return p.isIdentifier(e.expression)?e.expression.text:"default"}hasExportModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ExportKeyword)}hasDefaultModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.DefaultKeyword)}hasAsyncModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AsyncKeyword)}hasStaticModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.StaticKeyword)}hasAbstractModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AbstractKeyword)}hasReadonlyModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ReadonlyKeyword)}getVisibility(e){if(!p.canHaveModifiers(e))return"public";let t=p.getModifiers(e);return t?t.some(s=>s.kind===p.SyntaxKind.PrivateKeyword)?"private":t.some(s=>s.kind===p.SyntaxKind.ProtectedKeyword)?"protected":"public":"public"}},Me=new F,q=class{language="typescript";supportedExtensions=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];parser=new F;async parseFile(e,t){let s=this.parser.parseFile(t,e),n=this.parser.extractFunctions(s),r=this.parser.extractClasses(s),o=this.parser.extractImports(s);return{functions:n.map(i=>this.mapFunction(i)),classes:r.map(i=>this.mapClass(i)),imports:o.map(i=>this.mapImport(i)),language:t.endsWith(".js")||t.endsWith(".jsx")||t.endsWith(".mjs")||t.endsWith(".cjs")?"javascript":"typescript",filePath:t}}mapFunction(e){return{name:e.name,parameters:e.parameters.map(t=>({name:t.name,type:t.type,isOptional:t.isOptional,defaultValue:t.defaultValue})),returnType:e.returnType,isAsync:e.isAsync,isPublic:e.isExported,complexity:1,decorators:[],genericParams:e.typeParameters,startLine:e.startLine,endLine:e.endLine}}mapClass(e){return{name:e.name,methods:e.methods.map(t=>({name:t.name,parameters:t.parameters.map(s=>({name:s.name,type:s.type,isOptional:s.isOptional,defaultValue:s.defaultValue})),returnType:t.returnType,isAsync:t.isAsync,isPublic:t.visibility==="public",complexity:1,decorators:[],genericParams:[],startLine:t.startLine,endLine:t.endLine})),properties:e.properties.map(t=>this.mapProperty(t)),isPublic:e.isExported,implements:e.implements,extends:e.extends,decorators:[],startLine:e.startLine,endLine:e.endLine}}mapProperty(e){return{name:e.name,type:e.type,isPublic:e.visibility==="public",isReadonly:e.isReadonly}}mapImport(e){return{module:e.module,namedImports:e.namedImports.map(t=>t.alias||t.name),isTypeOnly:e.isTypeOnly}}},Se=new q;fe();var E=1e3;function I(h){let e=h.split(`
|
|
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.31");process.exit(0)}
|
|
2
|
+
import{b as N,d as le}from"./chunk-WB6TI6Q3.js";import{a as ye}from"./chunk-5Z6PYYWK.js";import{c as oe,d as ce,e as fe}from"./chunk-NZQYNUGM.js";import{b as w,c as L}from"./chunk-IRRGUXAU.js";import{a as j,b as D,c as V}from"./chunk-K6MFAVXK.js";ye();import{createRequire as be}from"module";var O;function W(){if(!O){let h=be(import.meta.url);try{O=h("typescript")}catch{try{O=h("typescript/lib/typescript.js")}catch{O=new Proxy({},{get(e,t){if(!(t==="__esModule"||typeof t=="symbol"))throw new Error("TypeScript is required for code analysis. Install it: npm install -g typescript")}})}}}return O}var p=new Proxy({},{get(h,e){return W()[e]},has(h,e){return e in W()},ownKeys(){return Object.keys(W())},getOwnPropertyDescriptor(h,e){let t=W()[e];if(t!==void 0)return{configurable:!0,enumerable:!0,value:t}}});var F=class{parseFile(e,t){return p.createSourceFile(e,t,p.ScriptTarget.Latest,!0,this.getScriptKind(e))}extractFunctions(e){let t=[],s=n=>{p.isFunctionDeclaration(n)&&n.name?t.push(this.extractFunctionDeclaration(n,e)):p.isVariableStatement(n)&&this.extractArrowFunctions(n,e,t),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractClasses(e){let t=[],s=n=>{p.isClassDeclaration(n)&&n.name&&t.push(this.extractClassDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractImports(e){let t=[],s=n=>{p.isImportDeclaration(n)&&t.push(this.extractImportDeclaration(n)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractExports(e){let t=[],s=n=>{if(p.isExportDeclaration(n))this.extractExportDeclaration(n,t);else if(p.isExportAssignment(n))t.push({name:this.getExportAssignmentName(n),type:"unknown",isDefault:!0,isReexport:!1,sourceModule:void 0});else if(p.isFunctionDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"function",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isClassDeclaration(n)&&n.name&&this.hasExportModifier(n))t.push({name:n.name.text,type:"class",isDefault:this.hasDefaultModifier(n),isReexport:!1,sourceModule:void 0});else if(p.isVariableStatement(n)&&this.hasExportModifier(n))for(let r of n.declarationList.declarations)p.isIdentifier(r.name)&&t.push({name:r.name.text,type:"variable",isDefault:!1,isReexport:!1,sourceModule:void 0});else p.isInterfaceDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"interface",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isTypeAliasDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"type",isDefault:!1,isReexport:!1,sourceModule:void 0}):p.isEnumDeclaration(n)&&this.hasExportModifier(n)&&t.push({name:n.name.text,type:"enum",isDefault:!1,isReexport:!1,sourceModule:void 0});p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractInterfaces(e){let t=[],s=n=>{p.isInterfaceDeclaration(n)&&t.push(this.extractInterfaceDeclaration(n,e)),p.forEachChild(n,s)};return p.forEachChild(e,s),t}extractEntities(e,t){let s=this.parseFile(t,e),n=[],r=this.extractFunctions(s);for(let a of r)n.push({name:a.name,type:"function",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:a.isAsync,isExported:a.isExported,parameters:a.parameters,returnType:a.returnType});let o=this.extractClasses(s);for(let a of o)n.push({name:a.name,type:"class",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported,extends:a.extends,implements:a.implements});let i=this.extractInterfaces(s);for(let a of i)n.push({name:a.name,type:"interface",line:a.startLine,endLine:a.endLine,visibility:a.isExported?"public":"internal",isAsync:!1,isExported:a.isExported});return n}getScriptKind(e){return e.endsWith(".tsx")?p.ScriptKind.TSX:e.endsWith(".ts")?p.ScriptKind.TS:e.endsWith(".jsx")?p.ScriptKind.JSX:e.endsWith(".js")?p.ScriptKind.JS:p.ScriptKind.TS}extractFunctionDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:e.name?.text??"anonymous",parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,startLine:s+1,endLine:n+1,isAsync:this.hasAsyncModifier(e),isExported:this.hasExportModifier(e),isGenerator:!!e.asteriskToken,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractArrowFunctions(e,t,s){for(let n of e.declarationList.declarations)if(p.isIdentifier(n.name)&&n.initializer&&p.isArrowFunction(n.initializer)){let r=n.initializer,{line:o}=t.getLineAndCharacterOfPosition(e.getStart()),{line:i}=t.getLineAndCharacterOfPosition(e.getEnd());s.push({name:n.name.text,parameters:this.extractParameters(r.parameters),returnType:r.type?r.type.getText(t):void 0,startLine:o+1,endLine:i+1,isAsync:this.hasAsyncModifier(r),isExported:this.hasExportModifier(e),isGenerator:!1,typeParameters:this.extractTypeParameters(r.typeParameters)})}}extractClassDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let c of e.members)p.isMethodDeclaration(c)&&c.name?r.push(this.extractMethodDeclaration(c,t)):p.isPropertyDeclaration(c)&&c.name?o.push(this.extractPropertyDeclaration(c,t)):p.isConstructorDeclaration(c)&&(r.push(this.extractConstructor(c,t)),this.extractParameterProperties(c,o,t));let i,a=[];if(e.heritageClauses){for(let c of e.heritageClauses)if(c.token===p.SyntaxKind.ExtendsKeyword)i=c.types[0]?.expression.getText(t);else if(c.token===p.SyntaxKind.ImplementsKeyword)for(let l of c.types)a.push(l.expression.getText(t))}return{name:e.name?.text??"anonymous",methods:r,properties:o,extends:i,implements:a,isAbstract:this.hasAbstractModifier(e),isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractMethodDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:this.getPropertyName(e.name,t),parameters:this.extractParameters(e.parameters),returnType:e.type?e.type.getText(t):void 0,isAsync:this.hasAsyncModifier(e),isStatic:this.hasStaticModifier(e),isAbstract:this.hasAbstractModifier(e),visibility:this.getVisibility(e),startLine:s+1,endLine:n+1}}extractConstructor(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd());return{name:"constructor",parameters:this.extractParameters(e.parameters),returnType:void 0,isAsync:!1,isStatic:!1,isAbstract:!1,visibility:"public",startLine:s+1,endLine:n+1}}extractParameterProperties(e,t,s){for(let n of e.parameters)this.isParameterProperty(n)&&t.push({name:p.isIdentifier(n.name)?n.name.text:n.name.getText(s),type:n.type?n.type.getText(s):void 0,isStatic:!1,isReadonly:this.hasReadonlyModifier(n),visibility:this.getVisibility(n),hasInitializer:!!n.initializer})}isParameterProperty(e){return!!e.modifiers?.some(t=>t.kind===p.SyntaxKind.PublicKeyword||t.kind===p.SyntaxKind.PrivateKeyword||t.kind===p.SyntaxKind.ProtectedKeyword||t.kind===p.SyntaxKind.ReadonlyKeyword)}extractPropertyDeclaration(e,t){return{name:this.getPropertyName(e.name,t),type:e.type?e.type.getText(t):void 0,isStatic:this.hasStaticModifier(e),isReadonly:this.hasReadonlyModifier(e),visibility:this.getVisibility(e),hasInitializer:!!e.initializer}}extractImportDeclaration(e){let t=e.moduleSpecifier.text,s=[],n,r,o=e.importClause?.isTypeOnly??!1;if(e.importClause&&(e.importClause.name&&(n=e.importClause.name.text),e.importClause.namedBindings)){if(p.isNamespaceImport(e.importClause.namedBindings))r=e.importClause.namedBindings.name.text;else if(p.isNamedImports(e.importClause.namedBindings))for(let i of e.importClause.namedBindings.elements)s.push({name:i.propertyName?.text??i.name.text,alias:i.propertyName?i.name.text:void 0})}return{module:t,namedImports:s,defaultImport:n,namespaceImport:r,isTypeOnly:o}}extractExportDeclaration(e,t){let s=e.moduleSpecifier?e.moduleSpecifier.text:void 0;if(e.exportClause&&p.isNamedExports(e.exportClause))for(let n of e.exportClause.elements)t.push({name:n.name.text,type:"unknown",isDefault:!1,isReexport:!!s,sourceModule:s});else!e.exportClause&&s&&t.push({name:"*",type:"unknown",isDefault:!1,isReexport:!0,sourceModule:s})}extractInterfaceDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),r=[],o=[];for(let a of e.members)p.isPropertySignature(a)&&a.name?r.push({name:this.getPropertyName(a.name,t),type:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken,isReadonly:this.hasReadonlyModifier(a)}):p.isMethodSignature(a)&&a.name&&o.push({name:this.getPropertyName(a.name,t),parameters:this.extractParameters(a.parameters),returnType:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken});let i=[];if(e.heritageClauses){for(let a of e.heritageClauses)if(a.token===p.SyntaxKind.ExtendsKeyword)for(let c of a.types)i.push(c.expression.getText(t))}return{name:e.name.text,properties:r,methods:o,extends:i,isExported:this.hasExportModifier(e),startLine:s+1,endLine:n+1,typeParameters:this.extractTypeParameters(e.typeParameters)}}extractParameters(e){return e.map(t=>{let s=t.getSourceFile();return{name:p.isIdentifier(t.name)?t.name.text:t.name.getText(s),type:t.type?t.type.getText(s):void 0,isOptional:!!t.questionToken||!!t.initializer,isRest:!!t.dotDotDotToken,defaultValue:t.initializer?t.initializer.getText(s):void 0}})}extractTypeParameters(e){return e?e.map(t=>t.name.text):[]}getPropertyName(e,t){return p.isIdentifier(e)||p.isStringLiteral(e)||p.isNumericLiteral(e)?e.text:e.getText(t)}getExportAssignmentName(e){return p.isIdentifier(e.expression)?e.expression.text:"default"}hasExportModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ExportKeyword)}hasDefaultModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.DefaultKeyword)}hasAsyncModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AsyncKeyword)}hasStaticModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.StaticKeyword)}hasAbstractModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.AbstractKeyword)}hasReadonlyModifier(e){return p.canHaveModifiers(e)&&!!p.getModifiers(e)?.some(t=>t.kind===p.SyntaxKind.ReadonlyKeyword)}getVisibility(e){if(!p.canHaveModifiers(e))return"public";let t=p.getModifiers(e);return t?t.some(s=>s.kind===p.SyntaxKind.PrivateKeyword)?"private":t.some(s=>s.kind===p.SyntaxKind.ProtectedKeyword)?"protected":"public":"public"}},Me=new F,q=class{language="typescript";supportedExtensions=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];parser=new F;async parseFile(e,t){let s=this.parser.parseFile(t,e),n=this.parser.extractFunctions(s),r=this.parser.extractClasses(s),o=this.parser.extractImports(s);return{functions:n.map(i=>this.mapFunction(i)),classes:r.map(i=>this.mapClass(i)),imports:o.map(i=>this.mapImport(i)),language:t.endsWith(".js")||t.endsWith(".jsx")||t.endsWith(".mjs")||t.endsWith(".cjs")?"javascript":"typescript",filePath:t}}mapFunction(e){return{name:e.name,parameters:e.parameters.map(t=>({name:t.name,type:t.type,isOptional:t.isOptional,defaultValue:t.defaultValue})),returnType:e.returnType,isAsync:e.isAsync,isPublic:e.isExported,complexity:1,decorators:[],genericParams:e.typeParameters,startLine:e.startLine,endLine:e.endLine}}mapClass(e){return{name:e.name,methods:e.methods.map(t=>({name:t.name,parameters:t.parameters.map(s=>({name:s.name,type:s.type,isOptional:s.isOptional,defaultValue:s.defaultValue})),returnType:t.returnType,isAsync:t.isAsync,isPublic:t.visibility==="public",complexity:1,decorators:[],genericParams:[],startLine:t.startLine,endLine:t.endLine})),properties:e.properties.map(t=>this.mapProperty(t)),isPublic:e.isExported,implements:e.implements,extends:e.extends,decorators:[],startLine:e.startLine,endLine:e.endLine}}mapProperty(e){return{name:e.name,type:e.type,isPublic:e.visibility==="public",isReadonly:e.isReadonly}}mapImport(e){return{module:e.module,namedImports:e.namedImports.map(t=>t.alias||t.name),isTypeOnly:e.isTypeOnly}}},Se=new q;fe();var E=1e3;function I(h){let e=h.split(`
|
|
3
3
|
`),t=[],s=[],n="",r=0,o=0,i=0,a=0;for(let c=0;c<e.length;c++){let l=e[c],d=l.trim();if(d===""||d.startsWith("//")||d.startsWith("#")||d.startsWith("*")){if(n){n+=" "+d;continue}t.push(l),s.push(c+1);continue}n||(r=c+1),n=n?n+" "+d:l;for(let u of d)u==="("?o++:u===")"?o=Math.max(0,o-1):u==="<"?i++:u===">"?i=Math.max(0,i-1):u==="["?a++:u==="]"&&(a=Math.max(0,a-1));o===0&&i===0&&a===0&&(t.push(n),s.push(r),n="")}return n&&(t.push(n),s.push(r)),{logicalLines:t,lineMap:s}}function G(h,e,t="<",s=">"){if(h[e]!==t)return;let n=1,r=e+1;for(;r<h.length&&n>0;)h[r]===t?n++:h[r]===s&&n--,r++;if(n===0)return h.substring(e+1,r-1)}function R(h,e,t){let s=[];for(let n=e-1;n>=0;n--){let r=h[n].trim();if(r.startsWith(t))s.unshift(r);else{if(r===""||r.startsWith("//")||r.startsWith("*")||r.startsWith("#"))continue;break}}return s}function S(h){let e=[],t=0,s="";for(let n of h)n==="<"||n==="("?t++:(n===">"||n===")")&&t--,n===","&&t===0?(e.push(s.trim()),s=""):s+=n;return s.trim()&&e.push(s.trim()),e}function re(h){let e=0,t=!1,s="";for(let n=0;n<h.length;n++){let r=h[n];if(t){r===s&&h[n-1]!=="\\"&&(t=!1);continue}r==='"'||r==="'"||r==="`"?(t=!0,s=r):r==="{"?e++:r==="}"&&e--}return e}var H=class{language="python";supportedExtensions=[".py"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"python",filePath:t}}extractFunctions(e){let t=[],s=e.split(`
|
|
4
4
|
`),{logicalLines:n,lineMap:r}=I(e),o=/^(\s*)(async\s+)?def\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*([^:]*\S))?\s*:/;for(let i=0;i<n.length;i++){if(n[i].length>E)continue;let a=n[i].match(o);if(a){let c=a[1].length,l=!!a[2],d=a[3],u=a[4],m=a[5]?.trim(),g=r[i]-1,f=g+1;for(let y=g+1;y<s.length;y++){let b=s[y];if(b.trim()===""||b.trim().startsWith("#"))continue;if((b.match(/^(\s*)/)?.[1].length??0)<=c&&b.trim()!==""){f=y;break}f=y+1}let x=R(s,g,"@");t.push({name:d,parameters:this.parseParams(u),returnType:m,isAsync:l,isPublic:!d.startsWith("_"),complexity:1,decorators:x,genericParams:[],startLine:r[i],endLine:f})}}return t}extractClasses(e){let t=[],s=e.split(`
|
|
5
5
|
`),{logicalLines:n,lineMap:r}=I(e),o=/^(\s*)class\s+(\w+)(?:\(([^)]*)\))?\s*:/;for(let i=0;i<n.length;i++){let a=n[i].match(o);if(a){let c=a[1].length,l=a[2],d=a[3]?a[3].split(",").map(y=>y.trim()):[],u=r[i]-1,m=u+1;for(let y=u+1;y<s.length;y++){let b=s[y];if(b.trim()===""||b.trim().startsWith("#"))continue;if((b.match(/^(\s*)/)?.[1].length??0)<=c&&b.trim()!==""){m=y;break}m=y+1}let g=s.slice(u+1,m).join(`
|
|
@@ -20,7 +20,7 @@ import{a as ye}from"./chunk-6ZJROHI3.js";import{c as oe,d as ce,e as fe}from"./c
|
|
|
20
20
|
`),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected|internal)?\s*(suspend)?\s*fun\s+(?:<[^{]*> +)?(\w+)\s*\(([^)]*)\)(?:\s*:\s*([^{=\s]+(?:\s+[^{=\s]+)*))?\s*/,i=0;for(let a=0;a<n.length;a++){let c=n[a];if(c.length>E){i+=(c.match(/\{/g)?.length??0)-(c.match(/\}/g)?.length??0);continue}let l=c.match(o);if(l&&i<=1){let d=l[1]||"public",u=!!l[2],m=l[3],g=l[4],f=l[5]?.trim();if(f&&f.includes("<")){let b=f.indexOf("<"),P=G(f,b);P!==void 0&&(f=f.substring(0,b)+"<"+P+">")}let x=r[a]-1,y=R(s,x,"@");t.push({name:m,parameters:this.parseParams(g),returnType:f,isAsync:u,isPublic:d==="public",complexity:1,decorators:y,genericParams:[],startLine:r[a],endLine:r[a]})}i+=re(c),i<0&&(i=0)}return t}extractClasses(e){let t=[],s=e.split(`
|
|
21
21
|
`),{logicalLines:n,lineMap:r}=I(e),o=/^\s*(public|private|protected|internal)?\s*(data|sealed|abstract|open)?\s*class\s+(\w+)(?:<[^{]*>)?(?:\s*(?:\([^)]*\))?\s*:\s*([^{\s]+(?:\s+[^{\s]+)*))?\s*\{?/;for(let i=0;i<n.length;i++){if(n[i].length>E)continue;let a=n[i].match(o);if(a){let c=a[3],l=a[4]?a[4].split(",").map(m=>m.trim().split("(")[0].trim()):[],d=r[i]-1,u=R(s,d,"@");t.push({name:c,methods:[],properties:[],isPublic:(a[1]||"public")==="public",implements:l.slice(1),extends:l[0]||void 0,decorators:u,startLine:r[i],endLine:r[i]})}}return t}extractImports(e){let t=[],s=e.split(`
|
|
22
22
|
`);for(let n of s){let r=n.match(/^\s*import\s+([^\s]+)/);r&&t.push({module:r[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){return e.trim()?S(e).map(t=>{let s=t.indexOf(":");if(s===-1)return{name:t.replace("val ","").replace("var ","").trim(),type:void 0,isOptional:!1,defaultValue:void 0};let n=t.substring(0,s).replace("val ","").replace("var ","").trim(),r=t.substring(s+1).trim(),o=r.indexOf("="),i=o>=0?r.substring(0,o).trim():r,a=o>=0;return{name:n,type:i,isOptional:a||i?.endsWith("?")||!1,defaultValue:void 0}}):[]}},te=class{language="dart";supportedExtensions=[".dart"];async parseFile(e,t){return{functions:this.extractFunctions(e),classes:this.extractClasses(e),imports:this.extractImports(e),language:"dart",filePath:t}}extractFunctions(e){let t=[],{logicalLines:s,lineMap:n}=I(e),r=/^\s*([\w<>,.?]+(?:\s+[\w<>,.?]+)*)\s+(\w+)\s*\(([^)]*)\)(?:\s*(async))?\s*\{/;for(let o=0;o<s.length;o++){let i=s[o];if(i.includes(" class ")||i.length>E)continue;let a=i.match(r);if(a){let c=a[1].trim(),l=c;if(c&&c.includes("<")){let g=c.indexOf("<"),f=G(c,g);f!==void 0&&(l=c.substring(0,g)+"<"+f+">")}let d=a[2],u=a[3],m=!!a[4]||l.includes("Future");t.push({name:d,parameters:this.parseParams(u),returnType:l==="void"?void 0:l,isAsync:m,isPublic:!d.startsWith("_"),complexity:1,decorators:[],genericParams:[],startLine:n[o],endLine:n[o]})}}return t}extractClasses(e){let t=[],{logicalLines:s,lineMap:n}=I(e),r=/^\s*(abstract +)?class\s+(\w+)(?:<[^{]*>)?(?:\s+extends\s+(\w+))?(?:\s+(?:with|implements)\s+([^{\s]+(?:\s+[^{\s]+)*))?\s*\{/;for(let o=0;o<s.length;o++){if(s[o].length>E)continue;let i=s[o].match(r);if(i){let a=i[2],c=i[3],l=i[4]?i[4].split(",").map(d=>d.trim()):[];t.push({name:a,methods:[],properties:[],isPublic:!a.startsWith("_"),implements:l,extends:c,decorators:[],startLine:n[o],endLine:n[o]})}}return t}extractImports(e){let t=[],s=e.split(`
|
|
23
|
-
`);for(let n of s){let r=n.match(/^\s*import\s+'([^']+)'/);r&&t.push({module:r[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){if(!e.trim())return[];let t=e.replace(/[{}[\]]/g,"");return S(t).map(s=>s.trim()).filter(s=>s).map(s=>{let n=s.replace("required ","").trim().split(/\s+/),r=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:r,type:o,isOptional:s.includes("?")||s.includes("{"),defaultValue:void 0}})}},$=ce("ParserRegistry"),de=["python","java","csharp","rust","swift"],se=class h{language;supportedExtensions;wasmParser;regexParser;wasmFailCount=0;static MAX_WASM_RETRIES=3;constructor(e,t){this.wasmParser=e,this.regexParser=t,this.language=e.language,this.supportedExtensions=e.supportedExtensions}async parseFile(e,t){if(this.wasmFailCount<h.MAX_WASM_RETRIES)try{return await this.wasmParser.parseFile(e,t)}catch(s){this.wasmFailCount++;let n=s instanceof Error?s.message:String(s),r=this.wasmFailCount>=h.MAX_WASM_RETRIES;$.warn(`[${this.language}] tree-sitter WASM parser failed (attempt ${this.wasmFailCount}/${h.MAX_WASM_RETRIES}): ${n}. Falling back to regex parser (~97-98% accuracy). `+(r?"Set AQE_PARSER_REGEX_ONLY=1 to silence this warning.":"Will retry WASM on next parse."))}return this.regexParser.parseFile(e,t)}},ne=class{parsers=new Map;_wasmInitPromise=null;constructor(){this.register(new H),this.register(new J),this.register(new Q),this.register(new X),this.register(new Y),this.register(new Z),this.register(new ee),this.register(new te),this._wasmInitPromise=this._tryLoadWasmParsers()}async _tryLoadWasmParsers(){try{let e=await import("./tree-sitter-wasm-parser-A45KH4YZ.js");if(!e.isWasmAvailable()){$.info("tree-sitter WASM parsers disabled or unavailable. Using regex parsers (~97-98% accuracy). Set AQE_PARSER_REGEX_ONLY=0 or ensure web-tree-sitter is installed to enable WASM.");return}let t=e.createWasmParsers();for(let s of de){let n=t.get(s),r=this.parsers.get(s);n&&r&&this.parsers.set(s,new se(n,r))}$.info("tree-sitter WASM parsers available for: "+de.join(", "))}catch{$.info("tree-sitter WASM parser module not available. Using regex parsers for all languages.")}}register(e){this.parsers.set(e.language,e)}getParser(e){return this.parsers.get(e)}async parseFile(e,t,s){this._wasmInitPromise&&(await this._wasmInitPromise,this._wasmInitPromise=null);let n=this.parsers.get(s);if(n)return n.parseFile(e,t)}getSupportedLanguages(){return Array.from(this.parsers.keys())}supportsLanguage(e){return this.parsers.has(e)}},De=new ne;import*as M from"node:fs/promises";import*as C from"node:path";var xe=[/\.\./,/%2e%2e/i,/%252e%252e/i,/\.\.%2f/i,/%2f\.\./i,/\.\.%5c/i,/\.\.\\/,/%c0%ae/i,/%c0%2f/i,/%c1%9c/i,/\0/,/%00/i],ve=[/^\/etc\//i,/^\/proc\//i,/^\/sys\//i,/^\/dev\//i,/^\/root\//i,/^\/home\/.+\/\./i,/^[A-Z]:\\Windows/i,/^[A-Z]:\\System/i,/^[A-Z]:\\Users\\.+\\AppData/i],ie=class{name="path-traversal";getRiskLevel(){return"critical"}validate(e,t={}){let{basePath:s="",allowAbsolute:n=!1,allowedExtensions:r=[],deniedExtensions:o=[".exe",".bat",".cmd",".sh",".ps1",".dll",".so"],maxDepth:i=10,maxLength:a=4096}=t;if(e.length>a)return{valid:!1,error:`Path exceeds maximum length of ${a}`,riskLevel:"medium"};for(let g of xe)if(g.test(e))return{valid:!1,error:"Path traversal attempt detected",riskLevel:"critical"};if(!n&&(e.startsWith("/")||/^[A-Z]:/i.test(e)))return{valid:!1,error:"Absolute paths are not allowed",riskLevel:"high"};for(let g of ve)if(g.test(e))return{valid:!1,error:"Access to system paths is not allowed",riskLevel:"critical"};let c=this.normalizePath(e);if(c.includes(".."))return{valid:!1,error:"Path traversal detected after normalization",riskLevel:"critical"};if(c.split("/").filter(Boolean).length>i)return{valid:!1,error:`Path depth exceeds maximum of ${i}`,riskLevel:"low"};let d=this.getExtension(c);if(d){let g=`.${d.toLowerCase()}`,f=d.toLowerCase();if(o.length>0&&o.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not allowed`,riskLevel:"high"};if(r.length>0&&!r.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not in allowed list`,riskLevel:"medium"}}let u=s?this.joinPathsAbsolute(s,c):c,m=s.startsWith("/")?`/${this.normalizePath(s)}`:this.normalizePath(s);return s&&!u.startsWith(m)?{valid:!1,error:"Path escapes base directory",riskLevel:"critical"}:{valid:!0,normalizedPath:u,riskLevel:"none"}}normalizePath(e){let t=e.replace(/\\/g,"/");t=t.replace(/\/+/g,"/");let s=t.split("/"),n=[];for(let r of s)r==="."||r===""||(r===".."?n.length>0&&n[n.length-1]!==".."&&n.pop():n.push(r));return n.join("/")}joinPaths(...e){return e.length===0?"":e.map(t=>t.replace(/^\/+/,"").replace(/\/+$/,"")).filter(Boolean).join("/")}joinPathsAbsolute(...e){if(e.length===0)return"";let t=e[0].startsWith("/"),s=e.map(n=>{for(;n.startsWith("/");)n=n.slice(1);for(;n.endsWith("/");)n=n.slice(0,-1);return n}).filter(Boolean).join("/");return t?`/${s}`:s}getExtension(e){let t=e.match(/\.([^./\\]+)$/);return t?t[1]:null}},Ee=new ie,pe=(h,e)=>Ee.validate(h,e);le();var A=class extends Error{constructor(t,s,n,r){super(t);this.filePath=s;this.code=n;this.cause=r;this.name="FileReadError"}filePath;code;cause},z=class extends Error{constructor(t,s,n){super(t);this.filePath=s;this.cause=n;this.name="JsonParseError"}filePath;cause},T=class extends Error{constructor(t,s,n){super(`Path traversal detected: ${s.join(", ")}`);this.requestedPath=t;this.issues=s;this.riskLevel=n;this.name="PathTraversalError"}requestedPath;issues;riskLevel},ae=class{constructor(e,t){this.maxSize=e;this.ttlMs=t}maxSize;ttlMs;cache=new Map;accessOrder=[];get(e){let t=this.cache.get(e);if(t){if(Date.now()-t.timestamp>this.ttlMs){this.delete(e);return}return this.updateAccessOrder(e),t.value}}set(e,t,s){for(this.cache.has(e)&&this.delete(e);this.cache.size>=this.maxSize&&this.accessOrder.length>0;){let n=this.accessOrder.shift();n&&this.cache.delete(n)}this.cache.set(e,{value:t,timestamp:Date.now(),size:s}),this.accessOrder.push(e)}delete(e){let t=this.cache.delete(e);if(t){let s=this.accessOrder.indexOf(e);s>-1&&this.accessOrder.splice(s,1)}return t}clear(){this.cache.clear(),this.accessOrder=[]}get size(){return this.cache.size}get totalBytes(){let e=0;return this.cache.forEach(t=>{e+=t.size}),e}updateAccessOrder(e){let t=this.accessOrder.indexOf(e);t>-1&&(this.accessOrder.splice(t,1),this.accessOrder.push(e))}prune(){let e=Date.now(),t=0,s=[];return this.cache.forEach((n,r)=>{e-n.timestamp>this.ttlMs&&s.push(r)}),s.forEach(n=>{this.delete(n),t++}),t}};function Ie(h){let e="",t=0;for(;t<h.length;){let s=h[t],n=h[t+1];s==="*"&&n==="*"?h[t+2]==="/"?(e+="(?:.*/)?",t+=3):(e+=".*",t+=2):s==="*"?(e+="[^/]*",t++):s==="?"?(e+="[^/]",t++):".+^${}()|[]\\".includes(s)?(e+="\\"+s,t++):(e+=s,t++)}return new RegExp("^"+e+"$")}async function ue(h,e,t,s){try{let n=await M.readdir(h,{withFileTypes:!0});for(let r of n){let o=C.join(h,r.name),i=C.relative(s,o);if(r.isDirectory())r.name!=="node_modules"&&!r.name.startsWith(".")&&await ue(o,e,t,s);else if(r.isFile()){let a=i.replace(/\\/g,"/");e.test(a)&&t.push(o)}}}catch(n){console.debug("[FileReader] Directory read error:",n instanceof Error?n.message:n)}}var k=class{basePath;cache;enableCache;stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:0,cacheEntries:0};constructor(e={}){this.basePath=e.basePath??process.cwd(),this.enableCache=e.enableCache??!0,this.cache=new ae(e.maxCacheSize??100,e.cacheTtlMs??300*1e3)}resolvePath(e){let t=C.isAbsolute(e),s=pe(e,{basePath:t?"":this.basePath,allowAbsolute:!0,deniedExtensions:[".exe",".bat",".cmd",".ps1",".dll",".so"]});if(!s.valid)throw new T(e,[s.error||"Path validation failed"],s.riskLevel);if(t&&this.basePath){let n=C.resolve(this.basePath),r=C.resolve(e);if(!r.startsWith(n))throw new T(e,["Path escapes base directory"],"critical");return r}return s.normalizedPath?s.normalizedPath:t?e:C.resolve(this.basePath,e)}async readFile(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}if(this.stats.totalReads++,this.enableCache){let s=this.cache.get(t);if(s!==void 0)return this.stats.cacheHits++,this.updateCacheStats(),w(s);this.stats.cacheMisses++}try{let s=await M.readFile(t,"utf-8");return this.enableCache&&(this.cache.set(t,s,Buffer.byteLength(s,"utf-8")),this.updateCacheStats()),w(s)}catch(s){let n=s,r;switch(n.code){case"ENOENT":r="File not found: "+t;break;case"EACCES":r="Permission denied: "+t;break;case"EISDIR":r="Path is a directory: "+t;break;default:r="Failed to read file: "+t}return L(new A(r,t,n.code,n))}}async readJSON(e){let t=await this.readFile(e);if(!t.success)return t;try{let s=N(t.value);return w(s)}catch(s){let n=s,r=e;try{r=this.resolvePath(e)}catch{}return L(new z("Invalid JSON in file: "+r+" - "+n.message,r,n))}}async fileExists(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}try{return await M.access(t,M.constants.F_OK),w(!0)}catch(s){let n=s;return n.code==="ENOENT"?w(!1):L(new A("Cannot check file existence: "+t,t,n.code,n))}}async listFiles(e,t){let s;try{s=t?this.resolvePath(t):this.basePath}catch(n){if(n instanceof T)return L(n);throw n}try{if(!(await M.stat(s)).isDirectory())return L(new A("Base path is not a directory: "+s,s,"ENOTDIR"));let r=Ie(e),o=[];return await ue(s,r,o,s),o.sort(),w(o)}catch(n){let r=n;return L(new A("Failed to list files in: "+s,s,r.code,r))}}invalidateCache(e){let t=this.resolvePath(e);this.cache.delete(t),this.updateCacheStats()}clearCache(){this.cache.clear(),this.updateCacheStats()}pruneCache(){let e=this.cache.prune();return this.updateCacheStats(),e}getStats(){return{...this.stats}}resetStats(){this.stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:this.cache.totalBytes,cacheEntries:this.cache.size}}updateCacheStats(){this.stats.cacheSize=this.cache.totalBytes,this.stats.cacheEntries=this.cache.size}};V();var v={MODEL:"all-MiniLM-L6-v2",DIMENSIONS:384,CONTEXT_WINDOW:8192,BATCH_SIZE:100,MAX_RETRIES:3,RETRY_DELAY_MS:1e3,TIMEOUT_MS:3e4,DEFAULT_OLLAMA_URL:"http://localhost:11434"};var K=class{baseUrl;maxRetries;retryDelayMs;timeoutMs;constructor(e=v.DEFAULT_OLLAMA_URL,t=v.MAX_RETRIES,s=v.RETRY_DELAY_MS,n=v.TIMEOUT_MS){this.baseUrl=e.replace(/\/$/,""),this.maxRetries=t,this.retryDelayMs=s,this.timeoutMs=n}async healthCheck(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);if(!e.ok)return!1;let t=await e.json();return t.models?t.models.some(s=>s.name?.startsWith(v.MODEL)||s.model?.startsWith(v.MODEL)):!1}catch{return!1}}async generateEmbedding(e){let t={model:v.MODEL,prompt:e},s=null;for(let n=0;n<this.maxRetries;n++)try{let r=await this.fetchWithTimeout(`${this.baseUrl}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},this.timeoutMs);if(!r.ok){let i=await r.text();throw new Error(`Ollama API error (${r.status}): ${i}`)}let o=await r.json();if(o.embedding.length!==v.DIMENSIONS)throw new Error(`Invalid embedding dimensions: expected ${v.DIMENSIONS}, got ${o.embedding.length}`);return o.embedding}catch(r){if(s=D(r),s.message.includes("Invalid embedding dimensions"))throw s;if(n<this.maxRetries-1){let o=this.retryDelayMs*Math.pow(2,n);await this.sleep(o)}}throw new Error(`Failed to generate embedding after ${this.maxRetries} attempts: ${s?.message}`)}async fetchWithTimeout(e,t,s){let n=new AbortController,r=setTimeout(()=>n.abort(),s);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(r)}}sleep(e){return new Promise(t=>setTimeout(t,e))}async getServerInfo(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);return e.ok?await e.json():null}catch{return null}}async ensureModelAvailable(){if(!await this.healthCheck())throw new Error(`Ollama model '${v.MODEL}' is not available. Please run: ollama pull ${v.MODEL}`)}};import{createHash as Pe}from"crypto";var U=class{cache;maxSize;hits;misses;constructor(e=1e4){this.cache=new Map,this.maxSize=e,this.hits=0,this.misses=0}hashContent(e,t){return Pe("sha256").update(`${t}:${e}`).digest("hex")}get(e,t){let s=this.hashContent(e,t),n=this.cache.get(s);return n?(this.hits++,this.cache.delete(s),this.cache.set(s,n),n.embedding):(this.misses++,null)}set(e,t,s){let n=this.hashContent(e,t);if(this.cache.size>=this.maxSize&&!this.cache.has(n)){let o=this.cache.keys().next().value;o&&this.cache.delete(o)}let r={embedding:s,timestamp:Date.now(),model:t};this.cache.set(n,r)}has(e,t){let s=this.hashContent(e,t);return this.cache.has(s)}getStats(){let e=this.hits+this.misses,t=e>0?this.hits/e:0;return{size:this.cache.size,hitRate:t,hits:this.hits,misses:this.misses}}clear(){this.cache.clear(),this.hits=0,this.misses=0}evictOlderThan(e){let s=Date.now()-e,n=0;for(let[r,o]of this.cache.entries())o.timestamp<s&&(this.cache.delete(r),n++);return n}getMemoryUsageEstimate(){return this.cache.size*3172}export(){return Array.from(this.cache.entries()).map(([e,t])=>({key:e,entry:t}))}import(e){this.cache.clear();for(let{key:t,entry:s}of e)this.cache.size<this.maxSize&&this.cache.set(t,s)}};V();var _=class{client;cache;batchSize;enableFallback;ollamaAvailable=null;constructor(e={}){this.client=new K(e.ollamaBaseUrl),this.cache=e.cache??new U(e.maxCacheSize),this.batchSize=e.batchSize??v.BATCH_SIZE,this.enableFallback=e.enableFallback??!0}async embed(e){let t=this.cache.get(e,v.MODEL);if(t)return t;let s;if(await this.isOllamaAvailable())s=await this.client.generateEmbedding(e);else if(this.enableFallback)s=this.generatePseudoEmbedding(e);else throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);return this.cache.set(e,v.MODEL,s),s}formatForEmbedding(e){let t=[];e.language&&t.push(e.language),e.type&&t.push(e.type),e.name&&t.push(e.name);let s=t.length>0?`${t.join(" ")}: `:"",n=v.CONTEXT_WINDOW*4,r=e.content.trim();if(s.length+r.length>n){let o=n-s.length-3;r=r.substring(0,o)+"..."}return s+r}async embedBatch(e){let t=[];for(let s of e){let n=await this.embed(s);t.push(n)}return t}async embedCodeChunks(e,t){let s=Date.now(),n=[],r=0,o=0,i=await this.isOllamaAvailable();if(i)await this.client.ensureModelAvailable();else if(!this.enableFallback)throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);for(let c=0;c<e.length;c+=this.batchSize){let l=e.slice(c,Math.min(c+this.batchSize,e.length)),d=await this.processBatch(l,i);n.push(...d);for(let u of d)u.cached?r++:o++;if(t){let u=c+l.length,m=e.length,f=(Date.now()-s)/u,y=(m-u)*f;t({current:u,total:m,percentage:u/m*100,estimatedTimeRemainingMs:y})}}let a=Date.now()-s;return{results:n,stats:{totalChunks:e.length,cachedHits:r,computedNew:o,totalTimeMs:a,avgTimePerChunk:a/e.length}}}async processBatch(e,t){let s=[],n=e.map(async o=>{let i=this.formatForEmbedding(o),a=Date.now(),c=this.cache.get(i,v.MODEL);if(c)return{chunkId:o.id,embedding:c,model:v.MODEL,cached:!0,computeTimeMs:Date.now()-a};try{let l;return t?l=await this.client.generateEmbedding(i):l=this.generatePseudoEmbedding(i),this.cache.set(i,v.MODEL,l),{chunkId:o.id,embedding:l,model:t?v.MODEL:"pseudo-embedding",cached:!1,computeTimeMs:Date.now()-a}}catch(l){throw new Error(`Failed to generate embedding for chunk ${o.id}: ${j(l)}`)}}),r=await Promise.all(n);return s.push(...r),s}async isOllamaAvailable(){return this.ollamaAvailable!==null?this.ollamaAvailable:(this.ollamaAvailable=await this.client.healthCheck(),this.ollamaAvailable)}resetOllamaCheck(){this.ollamaAvailable=null}generatePseudoEmbedding(e){let t=new Array(v.DIMENSIONS).fill(0),s=e.split(/\s+|[^\w]+/).filter(o=>o.length>0);for(let o=0;o<s.length;o++){let i=s[o];for(let a=0;a<i.length&&a<t.length;a++)t[(o+a)%t.length]+=i.charCodeAt(a)/1e3}let n=[[/class\s+\w+/,0],[/function\s+\w+/,1],[/async\s+|await\s+|Promise/,2],[/interface\s+\w+/,3],[/export\s+/,4],[/import\s+/,5],[/try\s*{/,6],[/\.(map|filter|reduce)\(/,7]];for(let[o,i]of n)o.test(e)&&(t[i]+=.5);let r=Math.sqrt(t.reduce((o,i)=>o+i*i,0))||1;return t.map(o=>o/r)}clearCache(){this.cache.clear()}getCacheStats(){return this.cache.getStats()}async healthCheck(){return await this.client.healthCheck()}async getServerInfo(){return await this.client.getServerInfo()}getDimensions(){return v.DIMENSIONS}getConfig(){return{model:v.MODEL,dimensions:v.DIMENSIONS,contextWindow:v.CONTEXT_WINDOW,batchSize:this.batchSize,maxRetries:v.MAX_RETRIES,enableFallback:this.enableFallback}}};V();le();var we={maxNodes:1e5,maxEdgesPerNode:500,namespace:"code-intelligence:kg",enableVectorEmbeddings:!0,embeddingDimension:384,enableLLMExtraction:!0,llmModelTier:2,llmMaxTokens:2048},me=oe.create("code-intelligence/knowledge-graph"),he=class{config;memory;nodeCache=new Map;edgeIndex=new Map;tsParser;fileReader;embedder;llmRouter;constructor(e,t={}){this.config={...we,...t},this.isKnowledgeGraphDependencies(e)?(this.memory=e.memory,this.llmRouter=e.llmRouter):(this.memory=e,this.llmRouter=void 0),this.tsParser=new F,this.fileReader=new k,this.embedder=new _({enableFallback:!0})}isKnowledgeGraphDependencies(e){return e.memory!==void 0}async index(e){let t=Date.now(),s=[],n=0,r=0;try{let{paths:o,incremental:i=!1,includeTests:a=!0,languages:c}=e;i||await this.clear();for(let d of o)try{if(c&&c.length>0){let m=this.getFileExtension(d);if(!this.matchesLanguage(m,c))continue}if(!a&&this.isTestFile(d))continue;let u=await this.indexFile(d);n+=u.nodes,r+=u.edges}catch(u){s.push({file:d,error:j(u)})}let l=Date.now()-t;return await this.storeIndexMetadata({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,indexedAt:new Date().toISOString()}),w({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,errors:s})}catch(o){return L(D(o))}}async query(e){try{let{query:t,type:s,limit:n=100}=e;return s==="cypher"?this.executeCypherQuery(t,n):this.executeNaturalLanguageQuery(t,n)}catch(t){return L(D(t))}}async mapDependencies(e){try{let{files:t,direction:s,depth:n=3}=e,r=[],o=[],i=new Set,a=[];for(let l of t)await this.traverseDependencies(l,s,n,i,r,o,[],a);let c=this.calculateDependencyMetrics(r,o);return w({nodes:r,edges:o,cycles:a,metrics:c})}catch(t){return L(D(t))}}async getNode(e){if(this.nodeCache.has(e))return this.nodeCache.get(e);let t=`${this.config.namespace}:node:${e}`,s=await this.memory.get(t);return s&&this.nodeCache.set(e,s),s}async getEdges(e,t){let s=[],n=this.edgeIndex.get(e);if(n)return this.filterEdgesByDirection(n,e,t);let r=`${this.config.namespace}:edge:*`,o=await this.memory.search(r,this.config.maxEdgesPerNode*2);for(let i of o){let a=await this.memory.get(i);a&&(t!=="outgoing"&&a.target===e||t!=="incoming"&&a.source===e)&&s.push(a)}return s}async clear(){this.nodeCache.clear(),this.edgeIndex.clear()}isLLMExtractionAvailable(){return this.config.enableLLMExtraction===!0&&this.llmRouter!==void 0}getModelForTier(e){switch(e){case 1:return"claude-haiku-4-5-20251001";case 2:return"claude-sonnet-4-6";case 3:return"claude-sonnet-4-6";case 4:return"claude-opus-4-7";default:return"claude-sonnet-4-6"}}async extractRelationshipsWithLLM(e,t){if(!this.llmRouter)return{semanticRelationships:[],designPatterns:[],architecturalBoundaries:[],dependencyImpacts:[]};try{let s=this.buildRelationshipExtractionPrompt(e,t),n=this.getModelForTier(this.config.llmModelTier??2),r=await this.llmRouter.chat({messages:[{role:"system",content:`You are an expert software architect analyzing code structure. Extract:
|
|
23
|
+
`);for(let n of s){let r=n.match(/^\s*import\s+'([^']+)'/);r&&t.push({module:r[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){if(!e.trim())return[];let t=e.replace(/[{}[\]]/g,"");return S(t).map(s=>s.trim()).filter(s=>s).map(s=>{let n=s.replace("required ","").trim().split(/\s+/),r=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:r,type:o,isOptional:s.includes("?")||s.includes("{"),defaultValue:void 0}})}},$=ce("ParserRegistry"),de=["python","java","csharp","rust","swift"],se=class h{language;supportedExtensions;wasmParser;regexParser;wasmFailCount=0;static MAX_WASM_RETRIES=3;constructor(e,t){this.wasmParser=e,this.regexParser=t,this.language=e.language,this.supportedExtensions=e.supportedExtensions}async parseFile(e,t){if(this.wasmFailCount<h.MAX_WASM_RETRIES)try{return await this.wasmParser.parseFile(e,t)}catch(s){this.wasmFailCount++;let n=s instanceof Error?s.message:String(s),r=this.wasmFailCount>=h.MAX_WASM_RETRIES;$.warn(`[${this.language}] tree-sitter WASM parser failed (attempt ${this.wasmFailCount}/${h.MAX_WASM_RETRIES}): ${n}. Falling back to regex parser (~97-98% accuracy). `+(r?"Set AQE_PARSER_REGEX_ONLY=1 to silence this warning.":"Will retry WASM on next parse."))}return this.regexParser.parseFile(e,t)}},ne=class{parsers=new Map;_wasmInitPromise=null;constructor(){this.register(new H),this.register(new J),this.register(new Q),this.register(new X),this.register(new Y),this.register(new Z),this.register(new ee),this.register(new te),this._wasmInitPromise=this._tryLoadWasmParsers()}async _tryLoadWasmParsers(){try{let e=await import("./tree-sitter-wasm-parser-CI3V4AND.js");if(!e.isWasmAvailable()){$.info("tree-sitter WASM parsers disabled or unavailable. Using regex parsers (~97-98% accuracy). Set AQE_PARSER_REGEX_ONLY=0 or ensure web-tree-sitter is installed to enable WASM.");return}let t=e.createWasmParsers();for(let s of de){let n=t.get(s),r=this.parsers.get(s);n&&r&&this.parsers.set(s,new se(n,r))}$.info("tree-sitter WASM parsers available for: "+de.join(", "))}catch{$.info("tree-sitter WASM parser module not available. Using regex parsers for all languages.")}}register(e){this.parsers.set(e.language,e)}getParser(e){return this.parsers.get(e)}async parseFile(e,t,s){this._wasmInitPromise&&(await this._wasmInitPromise,this._wasmInitPromise=null);let n=this.parsers.get(s);if(n)return n.parseFile(e,t)}getSupportedLanguages(){return Array.from(this.parsers.keys())}supportsLanguage(e){return this.parsers.has(e)}},De=new ne;import*as M from"node:fs/promises";import*as C from"node:path";var xe=[/\.\./,/%2e%2e/i,/%252e%252e/i,/\.\.%2f/i,/%2f\.\./i,/\.\.%5c/i,/\.\.\\/,/%c0%ae/i,/%c0%2f/i,/%c1%9c/i,/\0/,/%00/i],ve=[/^\/etc\//i,/^\/proc\//i,/^\/sys\//i,/^\/dev\//i,/^\/root\//i,/^\/home\/.+\/\./i,/^[A-Z]:\\Windows/i,/^[A-Z]:\\System/i,/^[A-Z]:\\Users\\.+\\AppData/i],ie=class{name="path-traversal";getRiskLevel(){return"critical"}validate(e,t={}){let{basePath:s="",allowAbsolute:n=!1,allowedExtensions:r=[],deniedExtensions:o=[".exe",".bat",".cmd",".sh",".ps1",".dll",".so"],maxDepth:i=10,maxLength:a=4096}=t;if(e.length>a)return{valid:!1,error:`Path exceeds maximum length of ${a}`,riskLevel:"medium"};for(let g of xe)if(g.test(e))return{valid:!1,error:"Path traversal attempt detected",riskLevel:"critical"};if(!n&&(e.startsWith("/")||/^[A-Z]:/i.test(e)))return{valid:!1,error:"Absolute paths are not allowed",riskLevel:"high"};for(let g of ve)if(g.test(e))return{valid:!1,error:"Access to system paths is not allowed",riskLevel:"critical"};let c=this.normalizePath(e);if(c.includes(".."))return{valid:!1,error:"Path traversal detected after normalization",riskLevel:"critical"};if(c.split("/").filter(Boolean).length>i)return{valid:!1,error:`Path depth exceeds maximum of ${i}`,riskLevel:"low"};let d=this.getExtension(c);if(d){let g=`.${d.toLowerCase()}`,f=d.toLowerCase();if(o.length>0&&o.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not allowed`,riskLevel:"high"};if(r.length>0&&!r.some(y=>y.toLowerCase()===g||y.toLowerCase()===f))return{valid:!1,error:`File extension '${d}' is not in allowed list`,riskLevel:"medium"}}let u=s?this.joinPathsAbsolute(s,c):c,m=s.startsWith("/")?`/${this.normalizePath(s)}`:this.normalizePath(s);return s&&!u.startsWith(m)?{valid:!1,error:"Path escapes base directory",riskLevel:"critical"}:{valid:!0,normalizedPath:u,riskLevel:"none"}}normalizePath(e){let t=e.replace(/\\/g,"/");t=t.replace(/\/+/g,"/");let s=t.split("/"),n=[];for(let r of s)r==="."||r===""||(r===".."?n.length>0&&n[n.length-1]!==".."&&n.pop():n.push(r));return n.join("/")}joinPaths(...e){return e.length===0?"":e.map(t=>t.replace(/^\/+/,"").replace(/\/+$/,"")).filter(Boolean).join("/")}joinPathsAbsolute(...e){if(e.length===0)return"";let t=e[0].startsWith("/"),s=e.map(n=>{for(;n.startsWith("/");)n=n.slice(1);for(;n.endsWith("/");)n=n.slice(0,-1);return n}).filter(Boolean).join("/");return t?`/${s}`:s}getExtension(e){let t=e.match(/\.([^./\\]+)$/);return t?t[1]:null}},Ee=new ie,pe=(h,e)=>Ee.validate(h,e);le();var A=class extends Error{constructor(t,s,n,r){super(t);this.filePath=s;this.code=n;this.cause=r;this.name="FileReadError"}filePath;code;cause},z=class extends Error{constructor(t,s,n){super(t);this.filePath=s;this.cause=n;this.name="JsonParseError"}filePath;cause},T=class extends Error{constructor(t,s,n){super(`Path traversal detected: ${s.join(", ")}`);this.requestedPath=t;this.issues=s;this.riskLevel=n;this.name="PathTraversalError"}requestedPath;issues;riskLevel},ae=class{constructor(e,t){this.maxSize=e;this.ttlMs=t}maxSize;ttlMs;cache=new Map;accessOrder=[];get(e){let t=this.cache.get(e);if(t){if(Date.now()-t.timestamp>this.ttlMs){this.delete(e);return}return this.updateAccessOrder(e),t.value}}set(e,t,s){for(this.cache.has(e)&&this.delete(e);this.cache.size>=this.maxSize&&this.accessOrder.length>0;){let n=this.accessOrder.shift();n&&this.cache.delete(n)}this.cache.set(e,{value:t,timestamp:Date.now(),size:s}),this.accessOrder.push(e)}delete(e){let t=this.cache.delete(e);if(t){let s=this.accessOrder.indexOf(e);s>-1&&this.accessOrder.splice(s,1)}return t}clear(){this.cache.clear(),this.accessOrder=[]}get size(){return this.cache.size}get totalBytes(){let e=0;return this.cache.forEach(t=>{e+=t.size}),e}updateAccessOrder(e){let t=this.accessOrder.indexOf(e);t>-1&&(this.accessOrder.splice(t,1),this.accessOrder.push(e))}prune(){let e=Date.now(),t=0,s=[];return this.cache.forEach((n,r)=>{e-n.timestamp>this.ttlMs&&s.push(r)}),s.forEach(n=>{this.delete(n),t++}),t}};function Ie(h){let e="",t=0;for(;t<h.length;){let s=h[t],n=h[t+1];s==="*"&&n==="*"?h[t+2]==="/"?(e+="(?:.*/)?",t+=3):(e+=".*",t+=2):s==="*"?(e+="[^/]*",t++):s==="?"?(e+="[^/]",t++):".+^${}()|[]\\".includes(s)?(e+="\\"+s,t++):(e+=s,t++)}return new RegExp("^"+e+"$")}async function ue(h,e,t,s){try{let n=await M.readdir(h,{withFileTypes:!0});for(let r of n){let o=C.join(h,r.name),i=C.relative(s,o);if(r.isDirectory())r.name!=="node_modules"&&!r.name.startsWith(".")&&await ue(o,e,t,s);else if(r.isFile()){let a=i.replace(/\\/g,"/");e.test(a)&&t.push(o)}}}catch(n){console.debug("[FileReader] Directory read error:",n instanceof Error?n.message:n)}}var k=class{basePath;cache;enableCache;stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:0,cacheEntries:0};constructor(e={}){this.basePath=e.basePath??process.cwd(),this.enableCache=e.enableCache??!0,this.cache=new ae(e.maxCacheSize??100,e.cacheTtlMs??300*1e3)}resolvePath(e){let t=C.isAbsolute(e),s=pe(e,{basePath:t?"":this.basePath,allowAbsolute:!0,deniedExtensions:[".exe",".bat",".cmd",".ps1",".dll",".so"]});if(!s.valid)throw new T(e,[s.error||"Path validation failed"],s.riskLevel);if(t&&this.basePath){let n=C.resolve(this.basePath),r=C.resolve(e);if(!r.startsWith(n))throw new T(e,["Path escapes base directory"],"critical");return r}return s.normalizedPath?s.normalizedPath:t?e:C.resolve(this.basePath,e)}async readFile(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}if(this.stats.totalReads++,this.enableCache){let s=this.cache.get(t);if(s!==void 0)return this.stats.cacheHits++,this.updateCacheStats(),w(s);this.stats.cacheMisses++}try{let s=await M.readFile(t,"utf-8");return this.enableCache&&(this.cache.set(t,s,Buffer.byteLength(s,"utf-8")),this.updateCacheStats()),w(s)}catch(s){let n=s,r;switch(n.code){case"ENOENT":r="File not found: "+t;break;case"EACCES":r="Permission denied: "+t;break;case"EISDIR":r="Path is a directory: "+t;break;default:r="Failed to read file: "+t}return L(new A(r,t,n.code,n))}}async readJSON(e){let t=await this.readFile(e);if(!t.success)return t;try{let s=N(t.value);return w(s)}catch(s){let n=s,r=e;try{r=this.resolvePath(e)}catch{}return L(new z("Invalid JSON in file: "+r+" - "+n.message,r,n))}}async fileExists(e){let t;try{t=this.resolvePath(e)}catch(s){if(s instanceof T)return L(s);throw s}try{return await M.access(t,M.constants.F_OK),w(!0)}catch(s){let n=s;return n.code==="ENOENT"?w(!1):L(new A("Cannot check file existence: "+t,t,n.code,n))}}async listFiles(e,t){let s;try{s=t?this.resolvePath(t):this.basePath}catch(n){if(n instanceof T)return L(n);throw n}try{if(!(await M.stat(s)).isDirectory())return L(new A("Base path is not a directory: "+s,s,"ENOTDIR"));let r=Ie(e),o=[];return await ue(s,r,o,s),o.sort(),w(o)}catch(n){let r=n;return L(new A("Failed to list files in: "+s,s,r.code,r))}}invalidateCache(e){let t=this.resolvePath(e);this.cache.delete(t),this.updateCacheStats()}clearCache(){this.cache.clear(),this.updateCacheStats()}pruneCache(){let e=this.cache.prune();return this.updateCacheStats(),e}getStats(){return{...this.stats}}resetStats(){this.stats={cacheHits:0,cacheMisses:0,totalReads:0,cacheSize:this.cache.totalBytes,cacheEntries:this.cache.size}}updateCacheStats(){this.stats.cacheSize=this.cache.totalBytes,this.stats.cacheEntries=this.cache.size}};V();var v={MODEL:"all-MiniLM-L6-v2",DIMENSIONS:384,CONTEXT_WINDOW:8192,BATCH_SIZE:100,MAX_RETRIES:3,RETRY_DELAY_MS:1e3,TIMEOUT_MS:3e4,DEFAULT_OLLAMA_URL:"http://localhost:11434"};var K=class{baseUrl;maxRetries;retryDelayMs;timeoutMs;constructor(e=v.DEFAULT_OLLAMA_URL,t=v.MAX_RETRIES,s=v.RETRY_DELAY_MS,n=v.TIMEOUT_MS){this.baseUrl=e.replace(/\/$/,""),this.maxRetries=t,this.retryDelayMs=s,this.timeoutMs=n}async healthCheck(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);if(!e.ok)return!1;let t=await e.json();return t.models?t.models.some(s=>s.name?.startsWith(v.MODEL)||s.model?.startsWith(v.MODEL)):!1}catch{return!1}}async generateEmbedding(e){let t={model:v.MODEL,prompt:e},s=null;for(let n=0;n<this.maxRetries;n++)try{let r=await this.fetchWithTimeout(`${this.baseUrl}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},this.timeoutMs);if(!r.ok){let i=await r.text();throw new Error(`Ollama API error (${r.status}): ${i}`)}let o=await r.json();if(o.embedding.length!==v.DIMENSIONS)throw new Error(`Invalid embedding dimensions: expected ${v.DIMENSIONS}, got ${o.embedding.length}`);return o.embedding}catch(r){if(s=D(r),s.message.includes("Invalid embedding dimensions"))throw s;if(n<this.maxRetries-1){let o=this.retryDelayMs*Math.pow(2,n);await this.sleep(o)}}throw new Error(`Failed to generate embedding after ${this.maxRetries} attempts: ${s?.message}`)}async fetchWithTimeout(e,t,s){let n=new AbortController,r=setTimeout(()=>n.abort(),s);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(r)}}sleep(e){return new Promise(t=>setTimeout(t,e))}async getServerInfo(){try{let e=await this.fetchWithTimeout(`${this.baseUrl}/api/tags`,{method:"GET",headers:{"Content-Type":"application/json"}},5e3);return e.ok?await e.json():null}catch{return null}}async ensureModelAvailable(){if(!await this.healthCheck())throw new Error(`Ollama model '${v.MODEL}' is not available. Please run: ollama pull ${v.MODEL}`)}};import{createHash as Pe}from"crypto";var U=class{cache;maxSize;hits;misses;constructor(e=1e4){this.cache=new Map,this.maxSize=e,this.hits=0,this.misses=0}hashContent(e,t){return Pe("sha256").update(`${t}:${e}`).digest("hex")}get(e,t){let s=this.hashContent(e,t),n=this.cache.get(s);return n?(this.hits++,this.cache.delete(s),this.cache.set(s,n),n.embedding):(this.misses++,null)}set(e,t,s){let n=this.hashContent(e,t);if(this.cache.size>=this.maxSize&&!this.cache.has(n)){let o=this.cache.keys().next().value;o&&this.cache.delete(o)}let r={embedding:s,timestamp:Date.now(),model:t};this.cache.set(n,r)}has(e,t){let s=this.hashContent(e,t);return this.cache.has(s)}getStats(){let e=this.hits+this.misses,t=e>0?this.hits/e:0;return{size:this.cache.size,hitRate:t,hits:this.hits,misses:this.misses}}clear(){this.cache.clear(),this.hits=0,this.misses=0}evictOlderThan(e){let s=Date.now()-e,n=0;for(let[r,o]of this.cache.entries())o.timestamp<s&&(this.cache.delete(r),n++);return n}getMemoryUsageEstimate(){return this.cache.size*3172}export(){return Array.from(this.cache.entries()).map(([e,t])=>({key:e,entry:t}))}import(e){this.cache.clear();for(let{key:t,entry:s}of e)this.cache.size<this.maxSize&&this.cache.set(t,s)}};V();var _=class{client;cache;batchSize;enableFallback;ollamaAvailable=null;constructor(e={}){this.client=new K(e.ollamaBaseUrl),this.cache=e.cache??new U(e.maxCacheSize),this.batchSize=e.batchSize??v.BATCH_SIZE,this.enableFallback=e.enableFallback??!0}async embed(e){let t=this.cache.get(e,v.MODEL);if(t)return t;let s;if(await this.isOllamaAvailable())s=await this.client.generateEmbedding(e);else if(this.enableFallback)s=this.generatePseudoEmbedding(e);else throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);return this.cache.set(e,v.MODEL,s),s}formatForEmbedding(e){let t=[];e.language&&t.push(e.language),e.type&&t.push(e.type),e.name&&t.push(e.name);let s=t.length>0?`${t.join(" ")}: `:"",n=v.CONTEXT_WINDOW*4,r=e.content.trim();if(s.length+r.length>n){let o=n-s.length-3;r=r.substring(0,o)+"..."}return s+r}async embedBatch(e){let t=[];for(let s of e){let n=await this.embed(s);t.push(n)}return t}async embedCodeChunks(e,t){let s=Date.now(),n=[],r=0,o=0,i=await this.isOllamaAvailable();if(i)await this.client.ensureModelAvailable();else if(!this.enableFallback)throw new Error(`Ollama is not available and fallback is disabled. Please run: ollama pull ${v.MODEL}`);for(let c=0;c<e.length;c+=this.batchSize){let l=e.slice(c,Math.min(c+this.batchSize,e.length)),d=await this.processBatch(l,i);n.push(...d);for(let u of d)u.cached?r++:o++;if(t){let u=c+l.length,m=e.length,f=(Date.now()-s)/u,y=(m-u)*f;t({current:u,total:m,percentage:u/m*100,estimatedTimeRemainingMs:y})}}let a=Date.now()-s;return{results:n,stats:{totalChunks:e.length,cachedHits:r,computedNew:o,totalTimeMs:a,avgTimePerChunk:a/e.length}}}async processBatch(e,t){let s=[],n=e.map(async o=>{let i=this.formatForEmbedding(o),a=Date.now(),c=this.cache.get(i,v.MODEL);if(c)return{chunkId:o.id,embedding:c,model:v.MODEL,cached:!0,computeTimeMs:Date.now()-a};try{let l;return t?l=await this.client.generateEmbedding(i):l=this.generatePseudoEmbedding(i),this.cache.set(i,v.MODEL,l),{chunkId:o.id,embedding:l,model:t?v.MODEL:"pseudo-embedding",cached:!1,computeTimeMs:Date.now()-a}}catch(l){throw new Error(`Failed to generate embedding for chunk ${o.id}: ${j(l)}`)}}),r=await Promise.all(n);return s.push(...r),s}async isOllamaAvailable(){return this.ollamaAvailable!==null?this.ollamaAvailable:(this.ollamaAvailable=await this.client.healthCheck(),this.ollamaAvailable)}resetOllamaCheck(){this.ollamaAvailable=null}generatePseudoEmbedding(e){let t=new Array(v.DIMENSIONS).fill(0),s=e.split(/\s+|[^\w]+/).filter(o=>o.length>0);for(let o=0;o<s.length;o++){let i=s[o];for(let a=0;a<i.length&&a<t.length;a++)t[(o+a)%t.length]+=i.charCodeAt(a)/1e3}let n=[[/class\s+\w+/,0],[/function\s+\w+/,1],[/async\s+|await\s+|Promise/,2],[/interface\s+\w+/,3],[/export\s+/,4],[/import\s+/,5],[/try\s*{/,6],[/\.(map|filter|reduce)\(/,7]];for(let[o,i]of n)o.test(e)&&(t[i]+=.5);let r=Math.sqrt(t.reduce((o,i)=>o+i*i,0))||1;return t.map(o=>o/r)}clearCache(){this.cache.clear()}getCacheStats(){return this.cache.getStats()}async healthCheck(){return await this.client.healthCheck()}async getServerInfo(){return await this.client.getServerInfo()}getDimensions(){return v.DIMENSIONS}getConfig(){return{model:v.MODEL,dimensions:v.DIMENSIONS,contextWindow:v.CONTEXT_WINDOW,batchSize:this.batchSize,maxRetries:v.MAX_RETRIES,enableFallback:this.enableFallback}}};V();le();var we={maxNodes:1e5,maxEdgesPerNode:500,namespace:"code-intelligence:kg",enableVectorEmbeddings:!0,embeddingDimension:384,enableLLMExtraction:!0,llmModelTier:2,llmMaxTokens:2048},me=oe.create("code-intelligence/knowledge-graph"),he=class{config;memory;nodeCache=new Map;edgeIndex=new Map;tsParser;fileReader;embedder;llmRouter;constructor(e,t={}){this.config={...we,...t},this.isKnowledgeGraphDependencies(e)?(this.memory=e.memory,this.llmRouter=e.llmRouter):(this.memory=e,this.llmRouter=void 0),this.tsParser=new F,this.fileReader=new k,this.embedder=new _({enableFallback:!0})}isKnowledgeGraphDependencies(e){return e.memory!==void 0}async index(e){let t=Date.now(),s=[],n=0,r=0;try{let{paths:o,incremental:i=!1,includeTests:a=!0,languages:c}=e;i||await this.clear();for(let d of o)try{if(c&&c.length>0){let m=this.getFileExtension(d);if(!this.matchesLanguage(m,c))continue}if(!a&&this.isTestFile(d))continue;let u=await this.indexFile(d);n+=u.nodes,r+=u.edges}catch(u){s.push({file:d,error:j(u)})}let l=Date.now()-t;return await this.storeIndexMetadata({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,indexedAt:new Date().toISOString()}),w({filesIndexed:o.length-s.length,nodesCreated:n,edgesCreated:r,duration:l,errors:s})}catch(o){return L(D(o))}}async query(e){try{let{query:t,type:s,limit:n=100}=e;return s==="cypher"?this.executeCypherQuery(t,n):this.executeNaturalLanguageQuery(t,n)}catch(t){return L(D(t))}}async mapDependencies(e){try{let{files:t,direction:s,depth:n=3}=e,r=[],o=[],i=new Set,a=[];for(let l of t)await this.traverseDependencies(l,s,n,i,r,o,[],a);let c=this.calculateDependencyMetrics(r,o);return w({nodes:r,edges:o,cycles:a,metrics:c})}catch(t){return L(D(t))}}async getNode(e){if(this.nodeCache.has(e))return this.nodeCache.get(e);let t=`${this.config.namespace}:node:${e}`,s=await this.memory.get(t);return s&&this.nodeCache.set(e,s),s}async getEdges(e,t){let s=[],n=this.edgeIndex.get(e);if(n)return this.filterEdgesByDirection(n,e,t);let r=`${this.config.namespace}:edge:*`,o=await this.memory.search(r,this.config.maxEdgesPerNode*2);for(let i of o){let a=await this.memory.get(i);a&&(t!=="outgoing"&&a.target===e||t!=="incoming"&&a.source===e)&&s.push(a)}return s}async clear(){this.nodeCache.clear(),this.edgeIndex.clear()}isLLMExtractionAvailable(){return this.config.enableLLMExtraction===!0&&this.llmRouter!==void 0}getModelForTier(e){switch(e){case 1:return"claude-haiku-4-5-20251001";case 2:return"claude-sonnet-4-6";case 3:return"claude-sonnet-4-6";case 4:return"claude-opus-4-7";default:return"claude-sonnet-4-6"}}async extractRelationshipsWithLLM(e,t){if(!this.llmRouter)return{semanticRelationships:[],designPatterns:[],architecturalBoundaries:[],dependencyImpacts:[]};try{let s=this.buildRelationshipExtractionPrompt(e,t),n=this.getModelForTier(this.config.llmModelTier??2),r=await this.llmRouter.chat({messages:[{role:"system",content:`You are an expert software architect analyzing code structure. Extract:
|
|
24
24
|
1. Semantic relationships between code entities (inheritance, composition, dependency, collaboration)
|
|
25
25
|
2. Design patterns used (Factory, Singleton, Observer, Strategy, etc.)
|
|
26
26
|
3. Architectural boundaries (layers, modules, domains)
|
|
@@ -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 t,q as r}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.31");process.exit(0)}
|
|
2
|
+
import{a as t,q as r}from"./chunk-EJXRBAQF.js";import{c as l}from"./chunk-BMS7WFDB.js";function m(s,e){let o=e?.readonly??!1,n=e?.fileMustExist??!1,i=e?.busyTimeout??5e3,b=e?.walMode??!o,a=new t(s,{readonly:o,fileMustExist:n});return a.pragma(`busy_timeout = ${i}`),b&&a.pragma("journal_mode = WAL"),a}var u=l(()=>{r()});export{m as a,u as b};
|
|
@@ -1,3 +1,3 @@
|
|
|
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{b as c,d as p}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.31");process.exit(0)}
|
|
2
|
+
import{b as c,d as p}from"./chunk-WB6TI6Q3.js";import{a as f}from"./chunk-BMS7WFDB.js";p();import{existsSync as l,readFileSync as i}from"node:fs";import{join as a}from"node:path";import{execSync as m}from"node:child_process";var s=null,d=0,g=6e4;function S(){s=null,d=0}function b(e){if(s&&Date.now()-d<g)return s;let n=w(e);return s=n,d=Date.now(),n}function w(e){let n=h(e);if(n)return n;let r=v(e);if(r)return r;let t=k(e);return t||{available:!1}}function h(e){let n=a(e,".mcp.json");if(l(n))try{let o=c(i(n,"utf-8"));if(o.mcpServers?.ruflo||o.mcpServers?.["claude-flow"])return{available:!0,method:"mcp-config"}}catch{}let r=a(e,".claude","mcp.json");if(l(r))try{let o=c(i(r,"utf-8"));if(o.mcpServers?.ruflo||o.mcpServers?.["claude-flow"])return{available:!0,method:"mcp-config"}}catch{}let t=a(e,".claude","settings.json");if(l(t))try{let o=c(i(t,"utf-8")),u=o.mcpServers||o.mcp?.servers||{};if(u.ruflo||u["claude-flow"]||u["@anthropic/claude-flow"])return{available:!0,method:"mcp-config"}}catch{}return null}function v(e){let n=a(e,"package.json");if(!l(n))return null;try{let r=c(i(n,"utf-8")),t={...r.dependencies,...r.devDependencies};if(t.ruflo||t["@claude-flow/cli"]||t["claude-flow"])return{available:!0,method:"npm-dependency"}}catch{}return null}function k(e){for(let n of["ruflo","@claude-flow/cli"])try{return{available:!0,method:"npx-cached",version:m(`npx --no-install ${n} --version`,{encoding:"utf-8",timeout:5e3,cwd:e,stdio:["pipe","pipe","pipe"]}).trim().match(/\d+\.\d+\.\d+[\w.-]*/)?.[0]}}catch{}return null}function x(){for(let e of["ruflo","@claude-flow/cli"])try{return f.resolve(`${e}/package.json`),e}catch{}return"ruflo"}function P(){return[" Claude Flow not found \u2014 running in standalone mode.",""," Claude Flow adds optional features:"," - SONA trajectory tracking (reinforcement learning)"," - 3-tier model routing (haiku / sonnet / opus)"," - Codebase pretrain analysis",""," To install later:"," npm install -g ruflo"," claude mcp add ruflo -- npx -y ruflo@3.5.18"," aqe init --auto --with-claude-flow"].join(`
|
|
3
3
|
`)}export{S as a,b,x as c,P as d};
|