agentic-qe 3.11.4 → 3.12.0
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/helpers/.helpers-version +1 -0
- package/.claude/helpers/auto-memory-hook.mjs +35 -3
- package/.claude/helpers/brain-checkpoint.cjs +16 -1
- package/.claude/helpers/helpers.manifest.json +12 -0
- package/.claude/helpers/hook-handler.cjs +26 -5
- package/.claude/helpers/intelligence.cjs +14 -1
- package/.claude/hooks/aqe-hook.cjs +57 -10
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +110 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/adapters/a2a/auth/routes.js +59 -28
- package/dist/audit/witness-chain.d.ts +25 -0
- package/dist/audit/witness-chain.js +69 -22
- package/dist/audit/witness-key-manager.d.ts +11 -0
- package/dist/audit/witness-key-manager.js +24 -0
- package/dist/cli/brain-commands.js +2 -1
- package/dist/cli/bundle.js +6 -6
- package/dist/cli/chunks/adapter-6IWRIHF3.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-62I6ZNRW.js → agent-booster-wasm-IO54X6IQ.js} +2 -2
- package/dist/cli/chunks/{agent-handler-E2TZKKBS.js → agent-handler-A57SZUCW.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-JHAHC2NH.js → agent-memory-branch-BX7LRFGN.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-FSF5U67K.js +2 -0
- package/dist/cli/chunks/{arena-72ZV65BR.js → arena-UTC4YY6Y.js} +4 -4
- package/dist/cli/chunks/{arena-KLG3YSSR.js → arena-Y3XTX6O7.js} +2 -2
- package/dist/cli/chunks/audit-L4RL2AOY.js +3 -0
- package/dist/cli/chunks/base-2CKCJU3O.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-LAFK5QZ4.js → better-sqlite3-LRDXKYOJ.js} +2 -2
- package/dist/cli/chunks/brain-handler-OHDPI5TQ.js +89 -0
- package/dist/cli/chunks/{branch-enumerator-C7MPNYT7.js → branch-enumerator-ZRXE2CQ7.js} +2 -2
- package/dist/cli/chunks/{browser-UUDUDYLR.js → browser-NT33FG76.js} +2 -2
- package/dist/cli/chunks/browser-workflow-UGYJE64S.js +2 -0
- package/dist/cli/chunks/{chunk-7QTB5XIQ.js → chunk-27JCWG5J.js} +2 -2
- package/dist/cli/chunks/{chunk-3FJZMQJ7.js → chunk-2ALNNXFF.js} +2 -2
- package/dist/cli/chunks/{chunk-LMJUMUQJ.js → chunk-2AOOIAW3.js} +4 -4
- package/dist/cli/chunks/{chunk-CNF3ZWLM.js → chunk-2AR4B3DI.js} +2 -2
- package/dist/cli/chunks/{chunk-7ADD2ZQL.js → chunk-2KHDGC7N.js} +2 -2
- package/dist/cli/chunks/{chunk-P6S6ZVB5.js → chunk-2UMCB7AH.js} +1 -1
- package/dist/cli/chunks/{chunk-HH6NCBSP.js → chunk-335GHVJV.js} +22 -22
- package/dist/cli/chunks/{chunk-2WPSMQIL.js → chunk-36MPDANH.js} +1 -1
- package/dist/cli/chunks/{chunk-Y4AXOHW4.js → chunk-3AFNXU45.js} +1 -1
- package/dist/cli/chunks/{chunk-SL3SNOO2.js → chunk-3B4XXFKD.js} +2 -2
- package/dist/cli/chunks/{chunk-7IKWF2AD.js → chunk-4GU656WM.js} +1 -1
- package/dist/cli/chunks/{chunk-IQBZBUP5.js → chunk-4SALW7OT.js} +2 -2
- package/dist/cli/chunks/{chunk-TCVEKRPI.js → chunk-5FR5GBUT.js} +2 -2
- package/dist/cli/chunks/chunk-5VBPIJUZ.js +65 -0
- package/dist/cli/chunks/chunk-5XFX25AJ.js +4 -0
- package/dist/cli/chunks/{chunk-QSDIY3E2.js → chunk-5YGESYBC.js} +1 -1
- package/dist/cli/chunks/{chunk-5U2WHPXL.js → chunk-62RELCU6.js} +1 -1
- package/dist/cli/chunks/{chunk-QJ5NCYJ3.js → chunk-64M3FFM4.js} +2 -2
- package/dist/cli/chunks/{chunk-BMQDELPA.js → chunk-6JNNZGI2.js} +1 -1
- package/dist/cli/chunks/{chunk-U34OZXD6.js → chunk-6X3RJBA3.js} +2 -2
- package/dist/cli/chunks/{chunk-AE6HXMOG.js → chunk-72VZGAMJ.js} +1 -1
- package/dist/cli/chunks/{chunk-4JFH3MVA.js → chunk-7F7U2HUH.js} +1 -1
- package/dist/cli/chunks/{chunk-A4OMK3FO.js → chunk-7HJHXSYT.js} +2 -2
- package/dist/cli/chunks/chunk-7WX3MKRS.js +2 -0
- package/dist/cli/chunks/{chunk-O7PVZ32A.js → chunk-7ZIVDGSN.js} +1 -1
- package/dist/cli/chunks/{chunk-EZRHSHOQ.js → chunk-AAATFEIL.js} +2 -2
- package/dist/cli/chunks/{chunk-TQ373GGI.js → chunk-AEX75YGI.js} +2 -2
- package/dist/cli/chunks/chunk-BA6U7NSR.js +2 -0
- package/dist/cli/chunks/chunk-BB4OVXWF.js +14 -0
- package/dist/cli/chunks/{chunk-GRQ36XUH.js → chunk-BBC526PL.js} +2 -2
- package/dist/cli/chunks/{chunk-EONKMHKO.js → chunk-BGRJZH5Q.js} +2 -2
- package/dist/cli/chunks/{chunk-XQ6DW5FV.js → chunk-BUYPRUNY.js} +2 -2
- package/dist/cli/chunks/{chunk-TU6YN43Q.js → chunk-BZPF6GTL.js} +1 -1
- package/dist/cli/chunks/{chunk-TPMBFARK.js → chunk-C4SZSPXY.js} +67 -22
- package/dist/cli/chunks/{chunk-D6CKKNYC.js → chunk-C6GYLCTX.js} +2 -2
- package/dist/cli/chunks/{chunk-YNK6SUPU.js → chunk-CC5G3K4X.js} +2 -2
- package/dist/cli/chunks/{chunk-ADFKY3X2.js → chunk-CHO54B34.js} +2 -2
- package/dist/cli/chunks/{chunk-WQZ2WRO4.js → chunk-CMGYUCM7.js} +1 -1
- package/dist/cli/chunks/{chunk-QMC5MTBV.js → chunk-CSEEGX5T.js} +2 -2
- package/dist/cli/chunks/{chunk-FSGMRQFC.js → chunk-CVGXB7IX.js} +2 -2
- package/dist/cli/chunks/{chunk-5VSQAGA2.js → chunk-DQDFACYW.js} +1 -1
- package/dist/cli/chunks/chunk-DR7PCO3S.js +153 -0
- package/dist/cli/chunks/{chunk-D5S47YUS.js → chunk-DTOE3NYW.js} +3 -3
- package/dist/cli/chunks/{chunk-WZYNY3VF.js → chunk-DXOMRWDC.js} +1 -1
- package/dist/cli/chunks/{chunk-HJ24KMC2.js → chunk-EGH3H7QO.js} +1 -1
- package/dist/cli/chunks/{chunk-JFLSQH2X.js → chunk-EM2JIIAQ.js} +2 -2
- package/dist/cli/chunks/{chunk-MWFJC5HR.js → chunk-ESDGCTC4.js} +1 -1
- package/dist/cli/chunks/{chunk-SRVTNG6L.js → chunk-EZE2HRQB.js} +2 -2
- package/dist/cli/chunks/{chunk-ZFCVT43J.js → chunk-FEEMJDUF.js} +2 -2
- package/dist/cli/chunks/{chunk-HJO4RNOW.js → chunk-FI5SSLEF.js} +2 -2
- package/dist/cli/chunks/{chunk-XHRLBJTM.js → chunk-FKPUPQQT.js} +2 -2
- package/dist/cli/chunks/{chunk-ODZSQVEW.js → chunk-FOPS6DRZ.js} +1 -1
- package/dist/cli/chunks/{chunk-AQIEK4SY.js → chunk-FU5RNEXV.js} +2 -2
- package/dist/cli/chunks/{chunk-PQUXFSN6.js → chunk-FZIHOMGY.js} +2 -2
- package/dist/cli/chunks/{chunk-Z2REKBD6.js → chunk-FZRU73M4.js} +2 -2
- package/dist/cli/chunks/{chunk-NBBLPDJX.js → chunk-G5JQLUUO.js} +2 -2
- package/dist/cli/chunks/{chunk-4BFCLSDN.js → chunk-G6LR7FK7.js} +2 -2
- package/dist/cli/chunks/{chunk-QEVX4GWF.js → chunk-G6RKUEGL.js} +2 -2
- package/dist/cli/chunks/{chunk-HWBMYR5W.js → chunk-GCF42L7M.js} +5 -5
- package/dist/cli/chunks/{chunk-TSWF3AGQ.js → chunk-GGMQOEZZ.js} +2 -2
- package/dist/cli/chunks/{chunk-PFWJQPUC.js → chunk-HAEUPIKW.js} +2 -2
- package/dist/cli/chunks/{chunk-63QUN3JK.js → chunk-HDJMD6UH.js} +1 -1
- package/dist/cli/chunks/{chunk-JPENUVCI.js → chunk-HW62TB4T.js} +1 -1
- package/dist/cli/chunks/{chunk-WMIRAD3J.js → chunk-I6WHYRWB.js} +2 -2
- package/dist/cli/chunks/{chunk-YZ5EQR37.js → chunk-ICK3B24H.js} +2 -2
- package/dist/cli/chunks/{chunk-FRFVN6AA.js → chunk-IDLNLSQI.js} +2 -2
- package/dist/cli/chunks/{chunk-VQU7DMEY.js → chunk-IJUYHIKN.js} +2 -2
- package/dist/cli/chunks/{chunk-6JUOH6L4.js → chunk-IKVNYK7Y.js} +2 -2
- package/dist/cli/chunks/{chunk-ZKCKOQJI.js → chunk-JOBCMNTP.js} +2 -2
- package/dist/cli/chunks/{chunk-ARPBG6FQ.js → chunk-JYX7AZHE.js} +2 -2
- package/dist/cli/chunks/{chunk-SFDUT5WM.js → chunk-JYXSVSH2.js} +2 -2
- package/dist/cli/chunks/{chunk-VJGHRWMH.js → chunk-K5SN66B4.js} +2 -2
- package/dist/cli/chunks/{chunk-DNOU2HVQ.js → chunk-KDLYTJ5C.js} +2 -2
- package/dist/cli/chunks/{chunk-T76RFXQX.js → chunk-KI5BP4X5.js} +2 -2
- package/dist/cli/chunks/{chunk-7AWK43JN.js → chunk-KJWQ7ENF.js} +2 -2
- package/dist/cli/chunks/{chunk-BRLUNIR4.js → chunk-KN5GOEYK.js} +2 -2
- package/dist/cli/chunks/{chunk-VKJQAKYG.js → chunk-KZ37VHMJ.js} +2 -2
- package/dist/cli/chunks/{chunk-NV3TXXOW.js → chunk-KZMRU7DL.js} +2 -2
- package/dist/cli/chunks/{chunk-LLUPRGOR.js → chunk-L5ZLOW3K.js} +2 -2
- package/dist/cli/chunks/{chunk-THKZVOZV.js → chunk-LMJUQWR7.js} +1 -1
- package/dist/cli/chunks/{chunk-2KNFS3L5.js → chunk-MBF3Q7FQ.js} +1 -1
- package/dist/cli/chunks/chunk-MDT3LIXS.js +2 -0
- package/dist/cli/chunks/{chunk-B5XUWHKQ.js → chunk-MJPYNGZ7.js} +1 -1
- package/dist/cli/chunks/{chunk-UCYTY4LG.js → chunk-MK3J7JVZ.js} +2 -2
- package/dist/cli/chunks/{chunk-MCT4CD5M.js → chunk-MUAHFGIX.js} +2 -2
- package/dist/cli/chunks/{chunk-3SBUL72V.js → chunk-MUV56BPK.js} +2 -2
- package/dist/cli/chunks/{chunk-WNMDWP5A.js → chunk-NLHISTL2.js} +2 -2
- package/dist/cli/chunks/{chunk-UJMTKXPI.js → chunk-NNGCUJWQ.js} +2 -2
- package/dist/cli/chunks/chunk-NW7G57NR.js +27 -0
- package/dist/cli/chunks/{chunk-3SRPFBU7.js → chunk-O3C5RRDQ.js} +3 -3
- package/dist/cli/chunks/{chunk-AYGEWPN4.js → chunk-OHSVDMF7.js} +1 -1
- package/dist/cli/chunks/{chunk-AJXGGTX7.js → chunk-OPIWFXME.js} +1 -1
- package/dist/cli/chunks/{chunk-ZSBJNE35.js → chunk-P52YORQG.js} +2 -2
- package/dist/cli/chunks/chunk-PM566XEO.js +2 -0
- package/dist/cli/chunks/chunk-POKMJTD2.js +2 -0
- package/dist/cli/chunks/{chunk-GOQ4P2PB.js → chunk-PQMLIVGV.js} +2 -2
- package/dist/cli/chunks/{chunk-IB3ZPLFA.js → chunk-PT3FTGKZ.js} +2 -2
- package/dist/cli/chunks/{chunk-U3AVZGQA.js → chunk-Q5YRPS4P.js} +1 -1
- package/dist/cli/chunks/{chunk-5Z4FBCBK.js → chunk-QJ6H2HQQ.js} +1 -1
- package/dist/cli/chunks/{chunk-DRMHVY4T.js → chunk-RG552ROA.js} +4 -4
- package/dist/cli/chunks/{chunk-PEIQDQXN.js → chunk-RHC7TFPU.js} +2 -2
- package/dist/cli/chunks/{chunk-JNQN5DNS.js → chunk-RMFRFING.js} +1 -1
- package/dist/cli/chunks/{chunk-4YT5YN5G.js → chunk-RQN4HWGV.js} +2 -2
- package/dist/cli/chunks/{chunk-5P7Q5YNC.js → chunk-RYUSZ43T.js} +1 -1
- package/dist/cli/chunks/{chunk-O5NEJIHB.js → chunk-RZDNCTOA.js} +2 -2
- package/dist/cli/chunks/chunk-SCMXIBI7.js +2 -0
- package/dist/cli/chunks/{chunk-6545AS2J.js → chunk-SPEUF7ZL.js} +2 -2
- package/dist/cli/chunks/{chunk-LW5DHT3Z.js → chunk-SSXAW3ER.js} +2 -2
- package/dist/cli/chunks/{chunk-Q7ORVHJB.js → chunk-TC2JE5OK.js} +3 -3
- package/dist/cli/chunks/{chunk-MALOUGSF.js → chunk-TED4KOSK.js} +2 -2
- package/dist/cli/chunks/{chunk-ICCTQ5LO.js → chunk-TJ6N4CCX.js} +2 -2
- package/dist/cli/chunks/{chunk-6GYGAW53.js → chunk-TJEJ4UVX.js} +2 -2
- package/dist/cli/chunks/{chunk-VO6YJGB4.js → chunk-TO5PQSDD.js} +2 -2
- package/dist/cli/chunks/{chunk-LKURMUBU.js → chunk-TR5GOGH3.js} +37 -12
- package/dist/cli/chunks/{chunk-JCTCM6IR.js → chunk-UGJQJSPB.js} +1 -1
- package/dist/cli/chunks/{chunk-4RHNPRAP.js → chunk-USB44IHJ.js} +2 -2
- package/dist/cli/chunks/{chunk-JDFPAJGB.js → chunk-UUOXV3NS.js} +92 -92
- package/dist/cli/chunks/chunk-UVVKFBF7.js +2 -0
- package/dist/cli/chunks/{chunk-VCUCD3B5.js → chunk-V2MD5EDD.js} +2 -2
- package/dist/cli/chunks/{chunk-RFQBDMAP.js → chunk-VA7TEOPM.js} +1 -1
- package/dist/cli/chunks/{chunk-IF3HPQNV.js → chunk-VMP4M5PB.js} +1 -1
- package/dist/cli/chunks/{chunk-KUZMVH6N.js → chunk-VS4GMNJK.js} +3 -3
- package/dist/cli/chunks/{chunk-ZYZT2CDX.js → chunk-VWJSWXHG.js} +1 -1
- package/dist/cli/chunks/{chunk-54B6P2WS.js → chunk-VZ67ZDB3.js} +3 -3
- package/dist/cli/chunks/{chunk-NSPCZPTB.js → chunk-W2OMW6UU.js} +2 -2
- package/dist/cli/chunks/{chunk-3SKIZDKL.js → chunk-W766S4SK.js} +1 -1
- package/dist/cli/chunks/{chunk-N2BJN6AO.js → chunk-WJYTLRA5.js} +3 -3
- package/dist/cli/chunks/{chunk-X64BEXUY.js → chunk-WNASEUBW.js} +117 -113
- package/dist/cli/chunks/{chunk-HT6WAYIR.js → chunk-WT4ZDDFM.js} +1 -1
- package/dist/cli/chunks/chunk-XEYW3V5I.js +2 -0
- package/dist/cli/chunks/{chunk-6W3QHS45.js → chunk-XIFPIVZI.js} +2 -2
- package/dist/cli/chunks/{chunk-3E7D3A35.js → chunk-Y2MCIIJD.js} +1 -1
- package/dist/cli/chunks/{chunk-YUHM72VQ.js → chunk-YKOTOCO6.js} +2 -2
- package/dist/cli/chunks/{chunk-YKSWC7I4.js → chunk-Z3W3R4CW.js} +8 -20
- package/dist/cli/chunks/chunk-ZT2WHCVM.js +2 -0
- package/dist/cli/chunks/{chunk-G3TFNY4T.js → chunk-ZVPAFX4I.js} +2 -2
- package/dist/cli/chunks/{chunk-NFJT7XXR.js → chunk-ZWC6CM4R.js} +1 -1
- package/dist/cli/chunks/{ci-HQCRSCC7.js → ci-RJH5LAL3.js} +2 -2
- package/dist/cli/chunks/{ci-output-YBVXLA6O.js → ci-output-62SGMGB2.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-ULGMF2QN.js → circuit-breaker-QXTS5ZAW.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-MKZ2LJXK.js → claude-flow-setup-BBCCT5WV.js} +2 -2
- package/dist/cli/chunks/client-E2XUBCLK.js +2 -0
- package/dist/cli/chunks/{cline-installer-WZQ6XBWN.js → cline-installer-IZCUJJ3I.js} +2 -2
- package/dist/cli/chunks/{code-H3KGH45S.js → code-AWNVOZ7S.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-NUVEAJ7C.js → code-index-extractor-MX65BKMI.js} +2 -2
- package/dist/cli/chunks/{codex-installer-JQI6E6CV.js → codex-installer-EQT6JVLM.js} +2 -2
- package/dist/cli/chunks/{completions-NDF4PFE7.js → completions-WOJAM45W.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-XCZH66HG.js → complexity-analyzer-3DJB7V3K.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-Z4AJGZ7S.js → continuedev-installer-P4KWUTCJ.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-K4IPAL7C.js → copilot-installer-FFZWTMWQ.js} +2 -2
- package/dist/cli/chunks/core-handlers-46Z5VOO6.js +2 -0
- package/dist/cli/chunks/{cost-tracker-35KXAB23.js → cost-tracker-CYBOV3NI.js} +2 -2
- package/dist/cli/chunks/{coverage-QW5I4TYZ.js → coverage-GTZJBSC4.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-SXQ3HFRY.js +2 -0
- package/dist/cli/chunks/{cursor-installer-P4Z7RMIZ.js → cursor-installer-WZIVXGGB.js} +2 -2
- package/dist/cli/chunks/daemon-JWMHEJEN.js +10 -0
- package/dist/cli/chunks/{daemon-WQWTCYBM.js → daemon-MSFN2LXY.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-7XD2VGON.js → dag-attention-scheduler-4TWOTTQE.js} +2 -2
- package/dist/cli/chunks/{detect-GZ3P4DI7.js → detect-YZ6AGQPB.js} +2 -2
- package/dist/cli/chunks/{dist-node-6WWAW7OP.js → dist-node-3EM2XH54.js} +2 -2
- package/dist/cli/chunks/{domain-handler-3GTLWARQ.js → domain-handler-4XU5BINU.js} +2 -2
- package/dist/cli/chunks/domain-transfer-HUFC7I52.js +2 -0
- package/dist/cli/chunks/dream-R6MQQQ3N.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-BGIMA77V.js → embed-and-insert-pattern-J5ZFM6YX.js} +2 -2
- package/dist/cli/chunks/{eval-SXV6DRDD.js → eval-XYOA3EH2.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-TT6WCT2S.js → experience-capture-middleware-E3RYQB6Z.js} +3 -3
- package/dist/cli/chunks/{fast-paths-HTAZHEQP.js → fast-paths-DKIYN2YS.js} +2 -2
- package/dist/cli/chunks/{feature-flags-DIE3Z2B4.js → feature-flags-S2RNZATS.js} +2 -2
- package/dist/cli/chunks/{feature-flags-WBUKU54W.js → feature-flags-ZB63Z7N5.js} +2 -2
- package/dist/cli/chunks/{file-discovery-SKDETFS3.js → file-discovery-USJJLYQU.js} +2 -2
- package/dist/cli/chunks/{fleet-WCWEPAVU.js → fleet-4MUPHSF5.js} +4 -4
- package/dist/cli/chunks/{gnn-wrapper-KWZOWBYS.js → gnn-wrapper-PYOQZKX6.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-3AGYHVG2.js → heartbeat-handler-HLO5XCG7.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-OSDPJT6A.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-KMGSHBIN.js +2 -0
- package/dist/cli/chunks/hnsw-index-IMFRAOPE.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-6OJJDZHL.js → hnsw-legacy-bridge-FZEH2KLM.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-URULPKRF.js → hnswlib-node-VS6L5VUG.js} +2 -2
- package/dist/cli/chunks/{hooks-OXEBTLXV.js → hooks-R2757K57.js} +48 -52
- package/dist/cli/chunks/hybrid-router-57QSWSWC.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-NL74PRHD.js → hypergraph-engine-EAV3GJ5D.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-KZ54AEEL.js → hypergraph-handler-5ERXAVGH.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-OC4MPBGA.js +2 -0
- package/dist/cli/chunks/{init-handler-XKZXRXPG.js → init-handler-RXUSEMG7.js} +6 -6
- package/dist/cli/chunks/init-wizard-CDBRL4PO.js +2 -0
- package/dist/cli/chunks/kernel-CQ7R3AAV.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-WISQMJK7.js → kilocode-installer-ZUBVBHGT.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-O7TBB3GM.js → kiro-installer-TRTRQDGL.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-UXNH7RY4.js +2 -0
- package/dist/cli/chunks/{learning-6IZBGVRU.js → learning-UYXWAU5D.js} +3 -3
- package/dist/cli/chunks/{llm-router-QDMQPPQ7.js → llm-router-TB5OJPEV.js} +4 -4
- package/dist/cli/chunks/llm-router-service-UV34YXBE.js +2 -0
- package/dist/cli/chunks/{load-KLAJJGL5.js → load-ELPSUIPV.js} +2 -2
- package/dist/cli/chunks/load-test-2VEN3PQZ.js +2 -0
- package/dist/cli/chunks/{mcp-SZOPQZIZ.js → mcp-UX7TK3XV.js} +2 -2
- package/dist/cli/chunks/{memory-G3WY74C6.js → memory-W3LG6H6N.js} +5 -5
- package/dist/cli/chunks/memory-backend-TZL5U6F3.js +2 -0
- package/dist/cli/chunks/memory-handlers-BNXAYS2P.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-TDNQGTOT.js → multi-model-executor-227LWZRY.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-NGYGEDMV.js → opencode-installer-F4WKVWDL.js} +2 -2
- package/dist/cli/chunks/{orchestrator-KPI5DY2C.js → orchestrator-V4DBMGK6.js} +5 -5
- package/dist/cli/chunks/pattern-null-store-KLX2RNHM.js +2 -0
- package/dist/cli/chunks/pattern-usage-recorder-BY3HEWSU.js +2 -0
- package/dist/cli/chunks/{pipeline-CSDCC675.js → pipeline-3F5RIESX.js} +2 -2
- package/dist/cli/chunks/{platform-Q5XKEVKH.js → platform-KCGXTZO3.js} +2 -2
- package/dist/cli/chunks/{plugin-XKKR3GVL.js → plugin-2H552KOV.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-22QVNKEN.js → prime-radiant-advanced-wasm-EFKVL7VN.js} +2 -2
- package/dist/cli/chunks/protocol-executor-5HJKW6MC.js +2 -0
- package/dist/cli/chunks/{protocol-handler-REQKTJGG.js → protocol-handler-ELGYV7D2.js} +2 -2
- package/dist/cli/chunks/{prove-NOFUFSQN.js → prove-AYJCQYNI.js} +2 -2
- package/dist/cli/chunks/provider-manager-TRZSBXD3.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-RCEYSLVV.js +2 -0
- package/dist/cli/chunks/{quality-3DQ2H5TK.js → quality-HH7L5A7V.js} +2 -2
- package/dist/cli/chunks/quality-gate-NAQLXE4C.js +7 -0
- package/dist/cli/chunks/queen-coordinator-6JFZD54W.js +2 -0
- package/dist/cli/chunks/{real-embeddings-FCGNYWLL.js → real-embeddings-IO3F4ZFR.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-HX3CNRIR.js → roocode-installer-X4TU5HO4.js} +2 -2
- package/dist/cli/chunks/router-KRLC46NS.js +2 -0
- package/dist/cli/chunks/routing-feedback-WW26H6SA.js +2 -0
- package/dist/cli/chunks/{routing-handler-YRZ2LDCR.js → routing-handler-ZJKGDDMT.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-GCQVBJ4E.js → ruvector-commands-NXCSUBN2.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-B562P3ZC.js → rvf-dual-writer-JMA74SKP.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-NAGFKCMD.js → rvf-migration-adapter-BNTGH2KU.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-WWFBEJ5Q.js → rvf-migration-coordinator-7T2HHUOH.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-OVQKPQUH.js +2 -0
- package/dist/cli/chunks/safe-db-UQOCQIH2.js +2 -0
- package/dist/cli/chunks/schedule-EUX7ZQUK.js +2 -0
- package/dist/cli/chunks/scheduler-MALHQKNR.js +2 -0
- package/dist/cli/chunks/{security-IFOYTD75.js → security-XSK2QHB3.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-TYD5TQ35.js → shared-rvf-adapter-WLRKI7RY.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-YGOOVDQZ.js → shared-rvf-dual-writer-SZW3J7ZK.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-OBCLRP4L.js +2 -0
- package/dist/cli/chunks/status-handler-HGCKYJX2.js +46 -0
- package/dist/cli/chunks/{structural-health-KZI6YMKV.js → structural-health-4SJCFX63.js} +2 -2
- package/dist/cli/chunks/{sync-Z5BDDBMK.js → sync-7WAVNZGL.js} +2 -2
- package/dist/cli/chunks/{sync-ABZNNYRC.js → sync-ATR4DUSA.js} +2 -2
- package/dist/cli/chunks/{task-handler-5ACZEPJ7.js → task-handler-O6REL34Y.js} +2 -2
- package/dist/cli/chunks/{task-handlers-UZWDPL6A.js → task-handlers-WFV2ZYWW.js} +3 -3
- package/dist/cli/chunks/{test-APO3MCVV.js → test-4LXUVHEU.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-EFZA5G5C.js → test-scheduling-OTN3DMKY.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-J2OPLNUK.js → token-bootstrap-VA7T4P42.js} +2 -2
- package/dist/cli/chunks/{token-usage-VHWVNN4R.js → token-usage-TLT6OXXR.js} +2 -2
- package/dist/cli/chunks/{transformers-PX4HPO75.js → transformers-JI7LZRQ3.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-44HA2Z3F.js → tree-sitter-wasm-parser-QNIMHB4K.js} +2 -2
- package/dist/cli/chunks/{types-IMOP7F4R.js → types-DJNWOAC6.js} +2 -2
- package/dist/cli/chunks/unified-memory-A5BS3LGX.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-WJLJO5MY.js +2 -0
- package/dist/cli/chunks/unified-persistence-CFC2BKI5.js +2 -0
- package/dist/cli/chunks/{upgrade-OZ3O6ZZI.js → upgrade-VEW4FL23.js} +2 -2
- package/dist/cli/chunks/{validate-DRY5BMWX.js → validate-O3P6PF7B.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-QD3LYPUF.js → validate-swarm-M2HXHZVC.js} +2 -2
- package/dist/cli/chunks/{vibium-2J3H2ITD.js → vibium-GOU55LUO.js} +2 -2
- package/dist/cli/chunks/visual-security-VPB6KVYJ.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-KRNUOGKI.js → web-tree-sitter-MXOI4GH3.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-PQIPH3WP.js → windsurf-installer-6GKT53IH.js} +2 -2
- package/dist/cli/chunks/{witness-chain-HPLOYPS7.js → witness-chain-OXGQGL26.js} +2 -2
- package/dist/cli/chunks/witness-chain-ZZAUAXDY.js +2 -0
- package/dist/cli/chunks/witness-key-manager-PGFSQXUJ.js +2 -0
- package/dist/cli/chunks/{workflow-OAQ3FWCY.js → workflow-ENBWRMBA.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-S4LBFTYD.js +2 -0
- package/dist/cli/chunks/{wrappers-UPIU6S5S.js → wrappers-MHLNYANQ.js} +2 -2
- package/dist/cli/commands/audit.d.ts +12 -0
- package/dist/cli/commands/audit.js +64 -4
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +45 -19
- package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +13 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +38 -0
- package/dist/cli/commands/hooks-handlers/task-hooks.js +19 -1
- package/dist/cli/commands/quality-gate.d.ts +24 -0
- package/dist/cli/commands/quality-gate.js +135 -0
- package/dist/cli/handlers/status-handler.d.ts +18 -0
- package/dist/cli/handlers/status-handler.js +47 -0
- package/dist/cli/index.js +5 -0
- package/dist/coordination/mincut/dream-integration.d.ts +11 -0
- package/dist/coordination/mincut/dream-integration.js +39 -12
- package/dist/coordination/mincut/queen-integration.js +24 -7
- package/dist/coordination/protocol-executor.js +2 -1
- package/dist/coordination/queen-lifecycle.js +4 -1
- package/dist/domains/code-intelligence/coordinator.js +10 -6
- package/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -1
- package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +6 -0
- package/dist/domains/defect-intelligence/services/defect-predictor.js +21 -0
- package/dist/domains/learning-optimization/interfaces.d.ts +7 -0
- package/dist/domains/learning-optimization/plugin.js +5 -0
- package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +10 -0
- package/dist/domains/learning-optimization/services/learning-coordinator.js +57 -0
- package/dist/domains/test-execution/plugin.js +2 -2
- package/dist/domains/test-execution/services/flaky-detector.js +1 -1
- package/dist/domains/test-generation/coordinator.js +22 -8
- package/dist/domains/test-generation/interfaces.d.ts +3 -0
- package/dist/domains/test-generation/services/test-generator.js +9 -1
- package/dist/integrations/ruvector/delta-tracker.js +10 -1
- package/dist/integrations/ruvector/feature-flags.js +7 -0
- package/dist/integrations/ruvector/sona-persistence.d.ts +24 -0
- package/dist/integrations/ruvector/sona-persistence.js +76 -0
- package/dist/integrations/ruvector/sona-three-loop.d.ts +15 -0
- package/dist/integrations/ruvector/sona-three-loop.js +17 -0
- package/dist/kernel/unified-memory-schemas.d.ts +2 -2
- package/dist/kernel/unified-memory-schemas.js +48 -2
- package/dist/kernel/unified-memory.d.ts +22 -0
- package/dist/kernel/unified-memory.js +43 -0
- package/dist/learning/aqe-learning-engine.js +3 -1
- package/dist/learning/dream/concept-graph.d.ts +31 -1
- package/dist/learning/dream/concept-graph.js +109 -3
- package/dist/learning/dream/dream-engine.d.ts +13 -1
- package/dist/learning/dream/dream-engine.js +146 -10
- package/dist/learning/dream/index.d.ts +1 -1
- package/dist/learning/dream/types.d.ts +23 -0
- package/dist/learning/pattern-lifecycle.d.ts +16 -0
- package/dist/learning/pattern-lifecycle.js +77 -1
- package/dist/learning/pattern-store.d.ts +2 -2
- package/dist/learning/pattern-store.js +14 -3
- package/dist/learning/provenance-tier.d.ts +52 -0
- package/dist/learning/provenance-tier.js +64 -0
- package/dist/learning/qe-flywheel/corpus-scorer.d.ts +55 -0
- package/dist/learning/qe-flywheel/corpus-scorer.js +293 -0
- package/dist/learning/qe-flywheel/coupled-anchor.d.ts +91 -0
- package/dist/learning/qe-flywheel/coupled-anchor.js +181 -0
- package/dist/learning/qe-flywheel/generation.d.ts +121 -0
- package/dist/learning/qe-flywheel/generation.js +167 -0
- package/dist/learning/qe-flywheel/policy.d.ts +37 -0
- package/dist/learning/qe-flywheel/policy.js +66 -0
- package/dist/learning/qe-flywheel/receipt-store.d.ts +31 -0
- package/dist/learning/qe-flywheel/receipt-store.js +89 -0
- package/dist/learning/qe-flywheel/receipt.d.ts +62 -0
- package/dist/learning/qe-flywheel/receipt.js +97 -0
- package/dist/learning/qe-reasoning-bank.js +34 -31
- package/dist/learning/routing-topology-gate.d.ts +12 -2
- package/dist/learning/routing-topology-gate.js +15 -3
- package/dist/learning/rvf-pattern-store.d.ts +1 -1
- package/dist/learning/rvf-pattern-store.js +21 -8
- package/dist/learning/sqlite-persistence.js +12 -9
- package/dist/mcp/bundle.js +540 -460
- package/dist/mcp/qe-tool-bridge.js +7 -2
- package/dist/mcp/tools/base.d.ts +29 -0
- package/dist/mcp/tools/base.js +25 -0
- package/dist/mcp/tools/coverage-analysis/index.js +6 -4
- package/dist/mcp/tools/learning-optimization/dream.d.ts +4 -13
- package/dist/mcp/tools/learning-optimization/dream.js +10 -96
- package/dist/mcp/tools/planning/goap-execute.d.ts +13 -1
- package/dist/mcp/tools/planning/goap-execute.js +33 -18
- package/dist/mcp/tools/quality-assessment/gate.d.ts +38 -0
- package/dist/mcp/tools/quality-assessment/gate.js +86 -0
- package/dist/mcp/tools/registry.d.ts +1 -0
- package/dist/mcp/tools/registry.js +10 -2
- package/dist/persistence/rvf-migration-coordinator.js +2 -1
- package/dist/planning/actions/qe-action-library.js +124 -1
- package/dist/planning/goap-planner.d.ts +14 -2
- package/dist/planning/goap-planner.js +51 -9
- package/dist/planning/index.d.ts +1 -1
- package/dist/planning/plan-executor.d.ts +84 -4
- package/dist/planning/plan-executor.js +221 -56
- package/dist/planning/types.d.ts +27 -0
- package/dist/shared/events/domain-events.d.ts +2 -0
- package/dist/shared/safe-db.js +23 -4
- package/dist/validation/anchor-set.d.ts +74 -0
- package/dist/validation/anchor-set.js +78 -0
- package/dist/validation/frontier-judge.d.ts +99 -0
- package/dist/validation/frontier-judge.js +234 -0
- package/dist/validation/gate-reexecute.d.ts +165 -0
- package/dist/validation/gate-reexecute.js +255 -0
- package/dist/validation/quality-gate-runner.d.ts +49 -0
- package/dist/validation/quality-gate-runner.js +62 -0
- package/dist/validation/quality-verdict.d.ts +94 -0
- package/dist/validation/quality-verdict.js +120 -0
- package/dist/workers/workers/learning-consolidation.js +21 -1
- package/package.json +1 -1
- package/dist/cli/chunks/adapter-2HMUXHWY.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-M2NKRVRE.js +0 -2
- package/dist/cli/chunks/audit-EPB7ETMT.js +0 -3
- package/dist/cli/chunks/base-CCHC2DAC.js +0 -2
- package/dist/cli/chunks/brain-handler-FBMYEERK.js +0 -89
- package/dist/cli/chunks/browser-workflow-4DGHFYY3.js +0 -2
- package/dist/cli/chunks/chunk-37ZDGJ3H.js +0 -2
- package/dist/cli/chunks/chunk-5AQ7FXYG.js +0 -27
- package/dist/cli/chunks/chunk-KYTFIP6R.js +0 -2
- package/dist/cli/chunks/chunk-MYMIEQSZ.js +0 -65
- package/dist/cli/chunks/chunk-RCPD6F4R.js +0 -2
- package/dist/cli/chunks/chunk-TCWR6TDN.js +0 -2
- package/dist/cli/chunks/chunk-UQ72K44T.js +0 -149
- package/dist/cli/chunks/chunk-XXRTWG7O.js +0 -2
- package/dist/cli/chunks/chunk-ZSA6V5FH.js +0 -2
- package/dist/cli/chunks/client-2OVEDWGU.js +0 -2
- package/dist/cli/chunks/core-handlers-UXRRYP52.js +0 -2
- package/dist/cli/chunks/cross-domain-router-PV3VQVLO.js +0 -2
- package/dist/cli/chunks/daemon-ESUEM6VB.js +0 -10
- package/dist/cli/chunks/domain-transfer-TQYO3SVG.js +0 -2
- package/dist/cli/chunks/dream-UFUXVJQC.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-MBG3SARO.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-5HXA3QB3.js +0 -2
- package/dist/cli/chunks/hnsw-index-PZRQWBRG.js +0 -2
- package/dist/cli/chunks/hybrid-router-NQRIE2GG.js +0 -2
- package/dist/cli/chunks/impact-analyzer-46347ZDV.js +0 -2
- package/dist/cli/chunks/init-wizard-CJYP4WKO.js +0 -2
- package/dist/cli/chunks/kernel-22KQZ56U.js +0 -2
- package/dist/cli/chunks/knowledge-graph-KM3JDBGR.js +0 -2
- package/dist/cli/chunks/llm-router-service-IFO6GRRO.js +0 -2
- package/dist/cli/chunks/load-test-TTKCYAPB.js +0 -2
- package/dist/cli/chunks/memory-backend-ELHCX2ZT.js +0 -2
- package/dist/cli/chunks/memory-handlers-3SKYQZTL.js +0 -2
- package/dist/cli/chunks/pattern-null-store-TMXAYD43.js +0 -2
- package/dist/cli/chunks/protocol-executor-BPLR5EJC.js +0 -2
- package/dist/cli/chunks/provider-manager-4MMD5QKL.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-P7KNT3WZ.js +0 -2
- package/dist/cli/chunks/queen-coordinator-NBZZ4MGC.js +0 -2
- package/dist/cli/chunks/router-2RXR6J2Q.js +0 -2
- package/dist/cli/chunks/routing-feedback-AVAA76TK.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-X2YDJA55.js +0 -2
- package/dist/cli/chunks/safe-db-4PRU65BK.js +0 -2
- package/dist/cli/chunks/schedule-2AST5CHW.js +0 -2
- package/dist/cli/chunks/scheduler-SW6II7OU.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-OB5NEGAK.js +0 -2
- package/dist/cli/chunks/status-handler-HFPWSCBY.js +0 -45
- package/dist/cli/chunks/unified-memory-X7OJYGSD.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-O6HOD5YL.js +0 -2
- package/dist/cli/chunks/unified-persistence-C332CER2.js +0 -2
- package/dist/cli/chunks/visual-security-MPUG5HPI.js +0 -2
- package/dist/cli/chunks/witness-chain-Q4BZHPDF.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-4NDWECYK.js +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
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.
|
|
2
|
-
import{d as z,f as ke}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.12.0");process.exit(0)}
|
|
2
|
+
import{d as z,f as ke}from"./chunk-SSXAW3ER.js";import{a as Ge}from"./chunk-MDT3LIXS.js";import{c as te}from"./chunk-TJEJ4UVX.js";import{a as B,b,c as ze}from"./chunk-L5ZLOW3K.js";import{b as L,d as re}from"./chunk-K5SN66B4.js";import{a as j,c as qe}from"./chunk-W2OMW6UU.js";import{a as D,c as Fe}from"./chunk-RHC7TFPU.js";import{a as ne,b as Pe}from"./chunk-UVVKFBF7.js";import{a as se,d as X,e as oe,f as ie}from"./chunk-FZIHOMGY.js";import{a as v,e as Me}from"./chunk-V2MD5EDD.js";import{c as h,e as xe}from"./chunk-3AFNXU45.js";import{createHash as Te}from"node:crypto";function Be(o){let e=Buffer.alloc(8);return e.writeBigUInt64LE(BigInt(o)),e}function We(o){return typeof o=="string"?Buffer.from(o,"utf8"):o instanceof Uint8Array?Buffer.from(o):Buffer.from(W(o),"utf8")}function W(o){return o===null||typeof o!="object"?JSON.stringify(o)??"null":Array.isArray(o)?`[${o.map(W).join(",")}]`:`{${Object.keys(o).sort().map(t=>`${JSON.stringify(t)}:${W(o[t])}`).join(",")}}`}function de(...o){let e=Te("sha256");for(let t of o)e.update(t);return e.digest()}function ce(o,e,t){return de(je,o,e,Be(t))}var je,ae,I,Ee=h(()=>{"use strict";je=Buffer.from("ruvector:chain:"),ae=Te("sha256").update("ruvector-proof-gate-v1").digest();I=class o{seq=0;prev=ae;chain=[];payloadHashes=[];admit(e){let t=de(We(e)),n=ce(this.prev,t,this.seq);this.prev=n,this.chain.push(n),this.payloadHashes.push(t);let a={sequence:this.seq,payloadHash:t.toString("hex"),chainCommitment:n.toString("hex")};return this.seq+=1,a}verifyReceipt(e){return e.sequence>=0&&e.sequence<this.chain.length&&this.chain[e.sequence].toString("hex")===e.chainCommitment}chainRoot(){return this.prev.toString("hex")}get length(){return this.seq}get isEmpty(){return this.seq===0}verifyIntegrity(){if(this.chain.length!==this.payloadHashes.length)return!1;let e=ae;for(let t=0;t<this.chain.length;t++){if(!ce(e,this.payloadHashes[t],t).equals(this.chain[t]))return!1;e=this.chain[t]}return e.equals(this.prev)}toJSON(){return{seq:this.seq,head:this.prev.toString("hex"),chain:this.chain.map(e=>e.toString("hex")),payloadHashes:this.payloadHashes.map(e=>e.toString("hex"))}}static fromJSON(e){let t=new o;t.seq=e.seq,t.prev=Buffer.from(e.head,"hex");for(let n of e.chain)t.chain.push(Buffer.from(n,"hex"));for(let n of e.payloadHashes)t.payloadHashes.push(Buffer.from(n,"hex"));return t}}});function O(o){if(!H.has(o))throw new Error(`Invalid table name: "${o}" is not in the allowlist`);return o}function nt(o){let e=o.split(".");if(e.length>2)throw new Error(`Invalid SQL identifier: "${o}" has too many parts (max: schema.table)`);for(let t of e)if(!ue.test(t))throw new Error(`Invalid SQL identifier: "${o}" \u2014 part "${t}" does not match pattern ${ue}`);return o}var H,ue,Y=h(()=>{"use strict";H=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"]);ue=/^[a-z_][a-z0-9_]{0,62}$/});var w,pe,le,ge,me,$,_e,fe,Ne,Se,he,Re,Le=h(()=>{"use strict";ke();qe();w=11,pe=`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS schema_version (
|
|
4
4
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
5
5
|
version INTEGER NOT NULL,
|
|
6
6
|
migrated_at TEXT DEFAULT (datetime('now'))
|
|
7
7
|
);
|
|
8
|
-
`,
|
|
8
|
+
`,le=`
|
|
9
9
|
-- Key-Value Store (v2 compatible - same schema as HybridBackend)
|
|
10
10
|
CREATE TABLE IF NOT EXISTS kv_store (
|
|
11
11
|
key TEXT NOT NULL,
|
|
@@ -17,7 +17,7 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
17
17
|
);
|
|
18
18
|
CREATE INDEX IF NOT EXISTS idx_kv_namespace ON kv_store(namespace);
|
|
19
19
|
CREATE INDEX IF NOT EXISTS idx_kv_expires ON kv_store(expires_at) WHERE expires_at IS NOT NULL;
|
|
20
|
-
`,
|
|
20
|
+
`,ge=`
|
|
21
21
|
-- Vector Embeddings (new in v3 - replaces in-memory AgentDB)
|
|
22
22
|
CREATE TABLE IF NOT EXISTS vectors (
|
|
23
23
|
id TEXT PRIMARY KEY,
|
|
@@ -30,7 +30,7 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
30
30
|
);
|
|
31
31
|
CREATE INDEX IF NOT EXISTS idx_vectors_namespace ON vectors(namespace);
|
|
32
32
|
CREATE INDEX IF NOT EXISTS idx_vectors_dimensions ON vectors(dimensions);
|
|
33
|
-
`,
|
|
33
|
+
`,me=`
|
|
34
34
|
-- Q-Values for RL algorithms (ADR-046)
|
|
35
35
|
CREATE TABLE IF NOT EXISTS rl_q_values (
|
|
36
36
|
id TEXT PRIMARY KEY,
|
|
@@ -51,7 +51,7 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
51
51
|
CREATE INDEX IF NOT EXISTS idx_qvalues_state ON rl_q_values(agent_id, state_key);
|
|
52
52
|
CREATE INDEX IF NOT EXISTS idx_qvalues_domain ON rl_q_values(domain);
|
|
53
53
|
CREATE INDEX IF NOT EXISTS idx_qvalues_updated ON rl_q_values(updated_at);
|
|
54
|
-
|
|
54
|
+
`,$=`
|
|
55
55
|
-- GOAP Goals
|
|
56
56
|
CREATE TABLE IF NOT EXISTS goap_goals (
|
|
57
57
|
id TEXT PRIMARY KEY,
|
|
@@ -78,7 +78,13 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
78
78
|
category TEXT NOT NULL,
|
|
79
79
|
qe_domain TEXT,
|
|
80
80
|
created_at TEXT DEFAULT (datetime('now')),
|
|
81
|
-
updated_at TEXT DEFAULT (datetime('now'))
|
|
81
|
+
updated_at TEXT DEFAULT (datetime('now')),
|
|
82
|
+
-- A14: real domain API method binding (kernel.getDomainAPI(qe_domain)[method](params)).
|
|
83
|
+
-- method/implemented are NULL/0 for actions with no real backing yet \u2014
|
|
84
|
+
-- GOAPExecutor must report those as "not implemented", never simulate them.
|
|
85
|
+
method TEXT,
|
|
86
|
+
params TEXT,
|
|
87
|
+
implemented INTEGER DEFAULT 0
|
|
82
88
|
);
|
|
83
89
|
|
|
84
90
|
-- GOAP Plans
|
|
@@ -112,12 +118,51 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
112
118
|
created_at TEXT DEFAULT (datetime('now'))
|
|
113
119
|
);
|
|
114
120
|
|
|
121
|
+
-- A14: canonical per-step execution history (was previously undefined in
|
|
122
|
+
-- this schema \u2014 plan-executor.ts invented its own parallel
|
|
123
|
+
-- execution_results/executed_steps tables instead). One row per action
|
|
124
|
+
-- step per execution attempt (execution_id groups steps from the same
|
|
125
|
+
-- plan.execute() call, since a plan can be executed/retried more than
|
|
126
|
+
-- once). Aggregate per-execution stats (steps completed/failed, total
|
|
127
|
+
-- duration, final world state) are derived by querying this table rather
|
|
128
|
+
-- than maintained in a separate denormalized summary table.
|
|
129
|
+
CREATE TABLE IF NOT EXISTS goap_execution_steps (
|
|
130
|
+
id TEXT PRIMARY KEY,
|
|
131
|
+
plan_id TEXT NOT NULL,
|
|
132
|
+
execution_id TEXT NOT NULL,
|
|
133
|
+
action_id TEXT NOT NULL,
|
|
134
|
+
step_order INTEGER NOT NULL,
|
|
135
|
+
world_state_before TEXT,
|
|
136
|
+
world_state_after TEXT,
|
|
137
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
138
|
+
retries INTEGER DEFAULT 0,
|
|
139
|
+
started_at TEXT,
|
|
140
|
+
duration_ms INTEGER,
|
|
141
|
+
agent_id TEXT,
|
|
142
|
+
agent_output TEXT,
|
|
143
|
+
error_message TEXT,
|
|
144
|
+
created_at TEXT DEFAULT (datetime('now'))
|
|
145
|
+
-- Deliberately no FK to goap_plans/goap_actions: PlanExecutor.execute()
|
|
146
|
+
-- can legitimately run an ad-hoc GOAPPlan/GOAPAction that was never
|
|
147
|
+
-- saved via savePlan()/addAction() (e.g. programmatic orchestration
|
|
148
|
+
-- bypassing the A* planner). unified-memory.ts enables the
|
|
149
|
+
-- foreign_keys pragma, so an enforced FK here would reject that
|
|
150
|
+
-- entirely legitimate usage, not just catch real corruption.
|
|
151
|
+
);
|
|
152
|
+
|
|
115
153
|
-- GOAP Indexes
|
|
116
154
|
CREATE INDEX IF NOT EXISTS idx_goap_actions_category ON goap_actions(category);
|
|
117
155
|
CREATE INDEX IF NOT EXISTS idx_goap_actions_agent ON goap_actions(agent_type);
|
|
118
156
|
CREATE INDEX IF NOT EXISTS idx_goap_plans_status ON goap_plans(status);
|
|
119
157
|
CREATE INDEX IF NOT EXISTS idx_goap_sig_goal ON goap_plan_signatures(goal_hash);
|
|
120
|
-
|
|
158
|
+
CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_plan ON goap_execution_steps(plan_id);
|
|
159
|
+
CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_action ON goap_execution_steps(action_id);
|
|
160
|
+
-- idx_goap_exec_steps_execution is NOT created here: databases with a
|
|
161
|
+
-- pre-existing narrower goap_execution_steps table (missing execution_id)
|
|
162
|
+
-- would fail on "no such column" since CREATE TABLE IF NOT EXISTS above
|
|
163
|
+
-- silently no-ops against them. unified-memory.ts's v11 migration creates
|
|
164
|
+
-- this index only after confirming/backfilling the column.
|
|
165
|
+
`,_e=`
|
|
121
166
|
-- Concept Graph Nodes (Dream Engine)
|
|
122
167
|
CREATE TABLE IF NOT EXISTS concept_nodes (
|
|
123
168
|
id TEXT PRIMARY KEY,
|
|
@@ -186,7 +231,7 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
186
231
|
CREATE INDEX IF NOT EXISTS idx_edge_weight ON concept_edges(weight DESC);
|
|
187
232
|
CREATE INDEX IF NOT EXISTS idx_insight_cycle ON dream_insights(cycle_id);
|
|
188
233
|
CREATE INDEX IF NOT EXISTS idx_dream_status ON dream_cycles(status);
|
|
189
|
-
`,
|
|
234
|
+
`,fe=`
|
|
190
235
|
-- QE Patterns table (unified from sqlite-persistence.ts)
|
|
191
236
|
CREATE TABLE IF NOT EXISTS qe_patterns (
|
|
192
237
|
id TEXT PRIMARY KEY,
|
|
@@ -336,7 +381,7 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
336
381
|
CREATE INDEX IF NOT EXISTS idx_execution_results_status ON execution_results(status);
|
|
337
382
|
CREATE INDEX IF NOT EXISTS idx_executed_steps_execution ON executed_steps(execution_id);
|
|
338
383
|
CREATE INDEX IF NOT EXISTS idx_executed_steps_action ON executed_steps(action_id);
|
|
339
|
-
`,
|
|
384
|
+
`,Ne=`
|
|
340
385
|
-- MinCut Graph Snapshots (ADR-047)
|
|
341
386
|
CREATE TABLE IF NOT EXISTS mincut_snapshots (
|
|
342
387
|
id TEXT PRIMARY KEY,
|
|
@@ -442,7 +487,7 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
442
487
|
CREATE INDEX IF NOT EXISTS idx_mincut_healing_type ON mincut_healing_actions(action_type);
|
|
443
488
|
CREATE INDEX IF NOT EXISTS idx_mincut_healing_success ON mincut_healing_actions(success);
|
|
444
489
|
CREATE INDEX IF NOT EXISTS idx_mincut_observations_iter ON mincut_observations(iteration);
|
|
445
|
-
`,
|
|
490
|
+
`,Se=`
|
|
446
491
|
-- SONA Patterns table (ADR-046: Pattern Persistence for Neural Backbone)
|
|
447
492
|
CREATE TABLE IF NOT EXISTS sona_patterns (
|
|
448
493
|
id TEXT PRIMARY KEY,
|
|
@@ -551,16 +596,16 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
551
596
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_technique ON coverage_sessions(technique);
|
|
552
597
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_agent ON coverage_sessions(agent_id);
|
|
553
598
|
CREATE INDEX IF NOT EXISTS idx_coverage_sessions_created ON coverage_sessions(created_at);
|
|
554
|
-
`,Re=["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 U(o,e,t){let n={value:e,timestamp:t??(e!==void 0?Date.now():0),nodeId:e!==void 0?o:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function c(i,d,u,T){return i!==u?i-u:d.localeCompare(T)}return{get(){return n.value},set(i,d){let u=d??Date.now();(n.timestamp===0||c(u,o,n.timestamp,n.nodeId)>0)&&(n={value:i,timestamp:u,nodeId:o,version:n.version+1,lastUpdated:Date.now()})},merge(i){let d=i.getState();this.applyState(d)},getState(){return{value:n.value,timestamp:n.timestamp,nodeId:n.nodeId,version:n.version,lastUpdated:n.lastUpdated}},applyState(i){(n.timestamp===0||c(i.timestamp,i.nodeId,n.timestamp,n.nodeId)>0)&&(n={value:i.value,timestamp:i.timestamp,nodeId:i.nodeId,version:Math.max(n.version,i.version)+1,lastUpdated:Date.now()})},getNodeId(){return o},getTimestamp(){return n.timestamp}}}function F(o,e){let t=U(o);return t.applyState(e),t}var $=h(()=>{"use strict"});function C(o){let e={counts:{},version:0,lastUpdated:Date.now()};return e.counts[o]=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[o]=(e.counts[o]||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,i]of Object.entries(t.counts)){let d=e.counts[c]||0;i>d&&(e.counts[c]=i,n=!0)}n&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return o},getLocalCount(){return e.counts[o]||0}}}function x(o,e){let t=C(o);return t.applyState(e),t}var M=h(()=>{"use strict"});function P(o){let e=C(o),t=C(o),n=0,c=Date.now();return{get(){return e.get()-t.get()},increment(i=1){if(i<0)throw new Error("Use decrement() for negative values");i!==0&&(e.increment(i),n++,c=Date.now())},decrement(i=1){if(i<0)throw new Error("Use increment() for negative values");i!==0&&(t.increment(i),n++,c=Date.now())},merge(i){let d=i.getState();this.applyState(d)},getState(){return{positive:e.getState(),negative:t.getState(),version:n,lastUpdated:c}},applyState(i){let d=this.get();e.applyState(i.positive),t.applyState(i.negative);let u=this.get();d!==u&&(n=Math.max(n,i.version)+1,c=Date.now())},getNodeId(){return o}}}function G(o,e){let t=P(o);return t.applyState(e),t}var K=h(()=>{"use strict";M()});function He(o,e){return`${o}:${Date.now()}:${e}`}function V(o){return typeof o=="string"?`s:${o}`:typeof o=="number"?`n:${o}`:typeof o=="boolean"?`b:${o}`:`j:${JSON.stringify(o)}`}function Ye(o){let e=o.substring(0,2),t=o.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return L(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function k(o){let e=new Map,t=new Map,n=0,c=Date.now(),i=0;function d(T){let E=e.get(T);if(!E||E.size===0)return!1;let p=t.get(T);if(!p||p.size===0)return!0;for(let g of E)if(!p.has(g))return!0;return!1}function u(T){let E=e.get(T);if(!E)return new Set;let p=t.get(T)||new Set,g=new Set;for(let l of E)p.has(l)||g.add(l);return g}return{has(T){let E=V(T);return d(E)},values(){let T=[];for(let[E]of e)d(E)&&T.push(Ye(E));return T},size(){let T=0;for(let[E]of e)d(E)&&T++;return T},add(T){let E=V(T),p=He(o,i++);e.has(E)||e.set(E,new Set),e.get(E).add(p),n++,c=Date.now()},remove(T){let E=V(T),p=e.get(E);if(!p||p.size===0)return;t.has(E)||t.set(E,new Set);let g=t.get(E);for(let l of p)g.add(l);n++,c=Date.now()},merge(T){let E=T.getState();this.applyState(E)},getState(){let T={};for(let[p,g]of e)T[p]=Array.from(g);let E={};for(let[p,g]of t)g.size>0&&(E[p]=Array.from(g));return{elements:T,tombstones:E,version:n,lastUpdated:c}},applyState(T){let E=!1;for(let[p,g]of Object.entries(T.elements)){e.has(p)||e.set(p,new Set);let l=e.get(p);for(let _ of g)l.has(_)||(l.add(_),E=!0)}for(let[p,g]of Object.entries(T.tombstones)){t.has(p)||t.set(p,new Set);let l=t.get(p);for(let _ of g)l.has(_)||(l.add(_),E=!0)}E&&(n=Math.max(n,T.version)+1,c=Date.now())},getNodeId(){return o},clear(){for(let[T,E]of e){t.has(T)||t.set(T,new Set);let p=t.get(T);for(let g of E)p.add(g)}n++,c=Date.now()}}}function q(o,e){let t=k(o);return t.applyState(e),t}var Q=h(()=>{"use strict";ne()});function J(o){let e={...$e,...o},{nodeId:t,enableDeltaTracking:n,maxDeltaHistory:c}=e,i=new Map,d=new Map,u=new Map,T=new Map,E=0,p=[],g=new Set,l={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function _(s,r,a){let f={key:s,type:r,operation:a,timestamp:Date.now(),nodeId:t};for(let we of g)try{we(f)}catch(Ue){console.error("[CRDTStore] Error in change listener:",Ue)}}function S(s,r){E++,n&&l[s].add(r)}function Z(){if(!n||!(l.registers.size>0||l.gCounters.size>0||l.pnCounters.size>0||l.sets.size>0))return;let r={fromVersion:p.length>0?p[p.length-1].toVersion:0,toVersion:E,timestamp:Date.now(),nodeId:t};if(l.registers.size>0){r.registers={};for(let a of l.registers){let f=i.get(a);f&&(r.registers[a]=f.getState())}l.registers.clear()}if(l.gCounters.size>0){r.gCounters={};for(let a of l.gCounters){let f=d.get(a);f&&(r.gCounters[a]=f.getState())}l.gCounters.clear()}if(l.pnCounters.size>0){r.pnCounters={};for(let a of l.pnCounters){let f=u.get(a);f&&(r.pnCounters[a]=f.getState())}l.pnCounters.clear()}if(l.sets.size>0){r.sets={};for(let a of l.sets){let f=T.get(a);f&&(r.sets[a]=f.getState())}l.sets.clear()}for(p.push(r);p.length>c;)p.shift()}let R={getRegister(s){return i.has(s)||i.set(s,U(t)),i.get(s)},setRegister(s,r){R.getRegister(s).set(r),S("registers",s),_(s,"lww-register","set")},hasRegister(s){return i.has(s)},deleteRegister(s){let r=i.delete(s);return r&&S("registers",s),r},getGCounter(s){return d.has(s)||d.set(s,C(t)),d.get(s)},incrementGCounter(s,r){R.getGCounter(s).increment(r),S("gCounters",s),_(s,"g-counter","increment")},hasGCounter(s){return d.has(s)},deleteGCounter(s){let r=d.delete(s);return r&&S("gCounters",s),r},getCounter(s){return u.has(s)||u.set(s,P(t)),u.get(s)},incrementCounter(s,r){R.getCounter(s).increment(r),S("pnCounters",s),_(s,"pn-counter","increment")},decrementCounter(s,r){R.getCounter(s).decrement(r),S("pnCounters",s),_(s,"pn-counter","decrement")},hasCounter(s){return u.has(s)},deleteCounter(s){let r=u.delete(s);return r&&S("pnCounters",s),r},getSet(s){return T.has(s)||T.set(s,k(t)),T.get(s)},addToSet(s,r){R.getSet(s).add(r),S("sets",s),_(s,"or-set","add")},removeFromSet(s,r){R.getSet(s).remove(r),S("sets",s),_(s,"or-set","remove")},hasSet(s){return T.has(s)},deleteSet(s){let r=T.delete(s);return r&&S("sets",s),r},merge(s){let r=s.getState();R.applyState(r)},getState(){Z();let s={version:E,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[r,a]of i)s.registers[r]=a.getState();for(let[r,a]of d)s.gCounters[r]=a.getState();for(let[r,a]of u)s.pnCounters[r]=a.getState();for(let[r,a]of T)s.sets[r]=a.getState();return s},applyState(s){for(let[r,a]of Object.entries(s.registers))i.has(r)?i.get(r).applyState(a):i.set(r,F(t,a)),S("registers",r),_(r,"lww-register","merge");for(let[r,a]of Object.entries(s.gCounters))d.has(r)?d.get(r).applyState(a):d.set(r,x(t,a)),S("gCounters",r),_(r,"g-counter","merge");for(let[r,a]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(a):u.set(r,G(t,a)),S("pnCounters",r),_(r,"pn-counter","merge");for(let[r,a]of Object.entries(s.sets))T.has(r)?T.get(r).applyState(a):T.set(r,q(t,a)),S("sets",r),_(r,"or-set","merge");E=Math.max(E,s.version)+1},getDelta(s){if(Z(),p.length===0)return s>=E,null;let r=p.filter(f=>f.toVersion>s);if(r.length===0)return null;let a={fromVersion:s,toVersion:E,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let f of r)f.registers&&Object.assign(a.registers,f.registers),f.gCounters&&Object.assign(a.gCounters,f.gCounters),f.pnCounters&&Object.assign(a.pnCounters,f.pnCounters),f.sets&&Object.assign(a.sets,f.sets);return Object.keys(a.registers).length===0&&delete a.registers,Object.keys(a.gCounters).length===0&&delete a.gCounters,Object.keys(a.pnCounters).length===0&&delete a.pnCounters,Object.keys(a.sets).length===0&&delete a.sets,a},applyDelta(s){if(s.registers)for(let[r,a]of Object.entries(s.registers))i.has(r)?i.get(r).applyState(a):i.set(r,F(t,a)),S("registers",r),_(r,"lww-register","merge");if(s.gCounters)for(let[r,a]of Object.entries(s.gCounters))d.has(r)?d.get(r).applyState(a):d.set(r,x(t,a)),S("gCounters",r),_(r,"g-counter","merge");if(s.pnCounters)for(let[r,a]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(a):u.set(r,G(t,a)),S("pnCounters",r),_(r,"pn-counter","merge");if(s.sets)for(let[r,a]of Object.entries(s.sets))T.has(r)?T.get(r).applyState(a):T.set(r,q(t,a)),S("sets",r),_(r,"or-set","merge");E=Math.max(E,s.toVersion)+1},getVersion(){return E},getNodeId(){return t},on(s,r){if(s==="change")return g.add(r),()=>{g.delete(r)};throw new Error(`Unknown event type: ${s}`)},removeAllListeners(){g.clear()},keys(s){let r=[];return(!s||s==="lww-register")&&r.push(...Array.from(i.keys())),(!s||s==="g-counter")&&r.push(...Array.from(d.keys())),(!s||s==="pn-counter")&&r.push(...Array.from(u.keys())),(!s||s==="or-set")&&r.push(...Array.from(T.keys())),r},clear(){i.clear(),d.clear(),u.clear(),T.clear(),p.length=0,l.registers.clear(),l.gCounters.clear(),l.pnCounters.clear(),l.sets.clear(),E=0},getStats(){return{total:i.size+d.size+u.size+T.size,registers:i.size,gCounters:d.size,pnCounters:u.size,sets:T.size,version:E,nodeId:t,deltaHistorySize:p.length}}};return R}var $e,Ce=h(()=>{"use strict";$();M();K();Q();$e={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var Ie=h(()=>{"use strict"});var Oe=h(()=>{"use strict";$();M();K();Q();Ce();Ie()});var Je={};Fe(Je,{ALLOWED_TABLE_NAMES:()=>H,BinaryHeap:()=>re,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>ye,UnifiedHnswIndex:()=>X,UnifiedMemoryManager:()=>A,clearProjectRootCache:()=>B,createHnswIndex:()=>se,findProjectRoot:()=>b,getDefaultDbPath:()=>be,getResolvedDefaultConfig:()=>De,getUnifiedMemory:()=>Xe,initializeUnifiedMemory:()=>Ke,resetUnifiedMemory:()=>Ve,validateTableName:()=>O});import*as m from"fs";import*as ve from"os";import*as N from"path";function be(){let o=b();return N.join(o,".agentic-qe","memory.db")}function De(){return{...ye,dbPath:be()}}function Xe(o){return A.getInstance(o)}async function Ke(o){let e=Xe(o);return await e.initialize(),e}function Ve(){A.resetInstance()}function Qe(){if(Ae)return;Ae=!0;let o=()=>{try{let e=A.instance;e&&e.close()}catch(e){console.debug("[UnifiedMemory] Cleanup error:",e instanceof Error?e.message:e)}};process.on("beforeExit",o),process.on("SIGINT",()=>{o(),process.exit(0)}),process.on("SIGTERM",()=>{o(),process.exit(0)})}var y,ye,A,Ae,Ze=h(()=>{Ge();ne();xe();Me();Pe();de();Y();Y();oe();oe();Le();Oe();ze();y=ee.create("unified-memory");ye={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 o{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;preparedStatements=new Map;vectorIndex=new X("qe-memory");crdtStore=null;proofGate=null;proofGateEnvChecked=!1;static PROOF_NS="__proofgate__";static PROOF_KEY="chain";constructor(e){let t=De();if(this.config={...t,...e},process.env.AQE_MEMORY_BACKEND==="memory"){this.config.dbPath=":memory:";return}if(!N.isAbsolute(this.config.dbPath)){let n=b();this.config.dbPath=N.join(n,this.config.dbPath)}}static getInstance(e){return o.instance||(o.instance=new o(e)),o.instance}static async getInstanceAsync(e){return o.instance?.initialized?o.instance:(o.instancePromise||(o.instancePromise=(async()=>{let t=o.getInstance(e);return await t.initialize(),t})()),o.instancePromise)}static resetInstance(){o.instance&&(o.instance.close(),o.instance=null),o.instancePromise=null,B()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=this.config.dbPath===":memory:",n="",c=!1,i=0;if(!t){let d=process.env.AQE_PROJECT_ROOT;if(d){let u=N.resolve(this.config.dbPath),T=N.resolve(d);!u.startsWith(T)&&!u.startsWith(ve.tmpdir())&&u.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${d}". Redirecting to test-safe path.`),this.config.dbPath=N.join(d,".agentic-qe","memory.db"))}if(n=N.dirname(this.config.dbPath),m.existsSync(n)||m.mkdirSync(n,{recursive:!0}),c=m.existsSync(this.config.dbPath),c)i=m.statSync(this.config.dbPath).size;else if(m.existsSync(n)){let u=this.findRecentBackups(n);if(u.length>0){let T=u[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
|
|
599
|
+
`,Re=["kv_store","vectors","rl_q_values","goap_actions","goap_goals","goap_plans","goap_plan_signatures","goap_execution_steps","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 U(o,e,t){let n={value:e,timestamp:t??(e!==void 0?Date.now():0),nodeId:e!==void 0?o:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function a(i,d,u,T){return i!==u?i-u:d.localeCompare(T)}return{get(){return n.value},set(i,d){let u=d??Date.now();(n.timestamp===0||a(u,o,n.timestamp,n.nodeId)>0)&&(n={value:i,timestamp:u,nodeId:o,version:n.version+1,lastUpdated:Date.now()})},merge(i){let d=i.getState();this.applyState(d)},getState(){return{value:n.value,timestamp:n.timestamp,nodeId:n.nodeId,version:n.version,lastUpdated:n.lastUpdated}},applyState(i){(n.timestamp===0||a(i.timestamp,i.nodeId,n.timestamp,n.nodeId)>0)&&(n={value:i.value,timestamp:i.timestamp,nodeId:i.nodeId,version:Math.max(n.version,i.version)+1,lastUpdated:Date.now()})},getNodeId(){return o},getTimestamp(){return n.timestamp}}}function x(o,e){let t=U(o);return t.applyState(e),t}var K=h(()=>{"use strict"});function C(o){let e={counts:{},version:0,lastUpdated:Date.now()};return e.counts[o]=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[o]=(e.counts[o]||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[a,i]of Object.entries(t.counts)){let d=e.counts[a]||0;i>d&&(e.counts[a]=i,n=!0)}n&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return o},getLocalCount(){return e.counts[o]||0}}}function F(o,e){let t=C(o);return t.applyState(e),t}var M=h(()=>{"use strict"});function G(o){let e=C(o),t=C(o),n=0,a=Date.now();return{get(){return e.get()-t.get()},increment(i=1){if(i<0)throw new Error("Use decrement() for negative values");i!==0&&(e.increment(i),n++,a=Date.now())},decrement(i=1){if(i<0)throw new Error("Use increment() for negative values");i!==0&&(t.increment(i),n++,a=Date.now())},merge(i){let d=i.getState();this.applyState(d)},getState(){return{positive:e.getState(),negative:t.getState(),version:n,lastUpdated:a}},applyState(i){let d=this.get();e.applyState(i.positive),t.applyState(i.negative);let u=this.get();d!==u&&(n=Math.max(n,i.version)+1,a=Date.now())},getNodeId(){return o}}}function P(o,e){let t=G(o);return t.applyState(e),t}var V=h(()=>{"use strict";M()});function He(o,e){return`${o}:${Date.now()}:${e}`}function Q(o){return typeof o=="string"?`s:${o}`:typeof o=="number"?`n:${o}`:typeof o=="boolean"?`b:${o}`:`j:${JSON.stringify(o)}`}function Ye(o){let e=o.substring(0,2),t=o.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return L(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function k(o){let e=new Map,t=new Map,n=0,a=Date.now(),i=0;function d(T){let E=e.get(T);if(!E||E.size===0)return!1;let p=t.get(T);if(!p||p.size===0)return!0;for(let g of E)if(!p.has(g))return!0;return!1}function u(T){let E=e.get(T);if(!E)return new Set;let p=t.get(T)||new Set,g=new Set;for(let l of E)p.has(l)||g.add(l);return g}return{has(T){let E=Q(T);return d(E)},values(){let T=[];for(let[E]of e)d(E)&&T.push(Ye(E));return T},size(){let T=0;for(let[E]of e)d(E)&&T++;return T},add(T){let E=Q(T),p=He(o,i++);e.has(E)||e.set(E,new Set),e.get(E).add(p),n++,a=Date.now()},remove(T){let E=Q(T),p=e.get(E);if(!p||p.size===0)return;t.has(E)||t.set(E,new Set);let g=t.get(E);for(let l of p)g.add(l);n++,a=Date.now()},merge(T){let E=T.getState();this.applyState(E)},getState(){let T={};for(let[p,g]of e)T[p]=Array.from(g);let E={};for(let[p,g]of t)g.size>0&&(E[p]=Array.from(g));return{elements:T,tombstones:E,version:n,lastUpdated:a}},applyState(T){let E=!1;for(let[p,g]of Object.entries(T.elements)){e.has(p)||e.set(p,new Set);let l=e.get(p);for(let f of g)l.has(f)||(l.add(f),E=!0)}for(let[p,g]of Object.entries(T.tombstones)){t.has(p)||t.set(p,new Set);let l=t.get(p);for(let f of g)l.has(f)||(l.add(f),E=!0)}E&&(n=Math.max(n,T.version)+1,a=Date.now())},getNodeId(){return o},clear(){for(let[T,E]of e){t.has(T)||t.set(T,new Set);let p=t.get(T);for(let g of E)p.add(g)}n++,a=Date.now()}}}function q(o,e){let t=k(o);return t.applyState(e),t}var J=h(()=>{"use strict";re()});function Z(o){let e={...$e,...o},{nodeId:t,enableDeltaTracking:n,maxDeltaHistory:a}=e,i=new Map,d=new Map,u=new Map,T=new Map,E=0,p=[],g=new Set,l={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function f(s,r,c){let _={key:s,type:r,operation:c,timestamp:Date.now(),nodeId:t};for(let we of g)try{we(_)}catch(Ue){console.error("[CRDTStore] Error in change listener:",Ue)}}function N(s,r){E++,n&&l[s].add(r)}function ee(){if(!n||!(l.registers.size>0||l.gCounters.size>0||l.pnCounters.size>0||l.sets.size>0))return;let r={fromVersion:p.length>0?p[p.length-1].toVersion:0,toVersion:E,timestamp:Date.now(),nodeId:t};if(l.registers.size>0){r.registers={};for(let c of l.registers){let _=i.get(c);_&&(r.registers[c]=_.getState())}l.registers.clear()}if(l.gCounters.size>0){r.gCounters={};for(let c of l.gCounters){let _=d.get(c);_&&(r.gCounters[c]=_.getState())}l.gCounters.clear()}if(l.pnCounters.size>0){r.pnCounters={};for(let c of l.pnCounters){let _=u.get(c);_&&(r.pnCounters[c]=_.getState())}l.pnCounters.clear()}if(l.sets.size>0){r.sets={};for(let c of l.sets){let _=T.get(c);_&&(r.sets[c]=_.getState())}l.sets.clear()}for(p.push(r);p.length>a;)p.shift()}let R={getRegister(s){return i.has(s)||i.set(s,U(t)),i.get(s)},setRegister(s,r){R.getRegister(s).set(r),N("registers",s),f(s,"lww-register","set")},hasRegister(s){return i.has(s)},deleteRegister(s){let r=i.delete(s);return r&&N("registers",s),r},getGCounter(s){return d.has(s)||d.set(s,C(t)),d.get(s)},incrementGCounter(s,r){R.getGCounter(s).increment(r),N("gCounters",s),f(s,"g-counter","increment")},hasGCounter(s){return d.has(s)},deleteGCounter(s){let r=d.delete(s);return r&&N("gCounters",s),r},getCounter(s){return u.has(s)||u.set(s,G(t)),u.get(s)},incrementCounter(s,r){R.getCounter(s).increment(r),N("pnCounters",s),f(s,"pn-counter","increment")},decrementCounter(s,r){R.getCounter(s).decrement(r),N("pnCounters",s),f(s,"pn-counter","decrement")},hasCounter(s){return u.has(s)},deleteCounter(s){let r=u.delete(s);return r&&N("pnCounters",s),r},getSet(s){return T.has(s)||T.set(s,k(t)),T.get(s)},addToSet(s,r){R.getSet(s).add(r),N("sets",s),f(s,"or-set","add")},removeFromSet(s,r){R.getSet(s).remove(r),N("sets",s),f(s,"or-set","remove")},hasSet(s){return T.has(s)},deleteSet(s){let r=T.delete(s);return r&&N("sets",s),r},merge(s){let r=s.getState();R.applyState(r)},getState(){ee();let s={version:E,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[r,c]of i)s.registers[r]=c.getState();for(let[r,c]of d)s.gCounters[r]=c.getState();for(let[r,c]of u)s.pnCounters[r]=c.getState();for(let[r,c]of T)s.sets[r]=c.getState();return s},applyState(s){for(let[r,c]of Object.entries(s.registers))i.has(r)?i.get(r).applyState(c):i.set(r,x(t,c)),N("registers",r),f(r,"lww-register","merge");for(let[r,c]of Object.entries(s.gCounters))d.has(r)?d.get(r).applyState(c):d.set(r,F(t,c)),N("gCounters",r),f(r,"g-counter","merge");for(let[r,c]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(c):u.set(r,P(t,c)),N("pnCounters",r),f(r,"pn-counter","merge");for(let[r,c]of Object.entries(s.sets))T.has(r)?T.get(r).applyState(c):T.set(r,q(t,c)),N("sets",r),f(r,"or-set","merge");E=Math.max(E,s.version)+1},getDelta(s){if(ee(),p.length===0)return s>=E,null;let r=p.filter(_=>_.toVersion>s);if(r.length===0)return null;let c={fromVersion:s,toVersion:E,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let _ of r)_.registers&&Object.assign(c.registers,_.registers),_.gCounters&&Object.assign(c.gCounters,_.gCounters),_.pnCounters&&Object.assign(c.pnCounters,_.pnCounters),_.sets&&Object.assign(c.sets,_.sets);return Object.keys(c.registers).length===0&&delete c.registers,Object.keys(c.gCounters).length===0&&delete c.gCounters,Object.keys(c.pnCounters).length===0&&delete c.pnCounters,Object.keys(c.sets).length===0&&delete c.sets,c},applyDelta(s){if(s.registers)for(let[r,c]of Object.entries(s.registers))i.has(r)?i.get(r).applyState(c):i.set(r,x(t,c)),N("registers",r),f(r,"lww-register","merge");if(s.gCounters)for(let[r,c]of Object.entries(s.gCounters))d.has(r)?d.get(r).applyState(c):d.set(r,F(t,c)),N("gCounters",r),f(r,"g-counter","merge");if(s.pnCounters)for(let[r,c]of Object.entries(s.pnCounters))u.has(r)?u.get(r).applyState(c):u.set(r,P(t,c)),N("pnCounters",r),f(r,"pn-counter","merge");if(s.sets)for(let[r,c]of Object.entries(s.sets))T.has(r)?T.get(r).applyState(c):T.set(r,q(t,c)),N("sets",r),f(r,"or-set","merge");E=Math.max(E,s.toVersion)+1},getVersion(){return E},getNodeId(){return t},on(s,r){if(s==="change")return g.add(r),()=>{g.delete(r)};throw new Error(`Unknown event type: ${s}`)},removeAllListeners(){g.clear()},keys(s){let r=[];return(!s||s==="lww-register")&&r.push(...Array.from(i.keys())),(!s||s==="g-counter")&&r.push(...Array.from(d.keys())),(!s||s==="pn-counter")&&r.push(...Array.from(u.keys())),(!s||s==="or-set")&&r.push(...Array.from(T.keys())),r},clear(){i.clear(),d.clear(),u.clear(),T.clear(),p.length=0,l.registers.clear(),l.gCounters.clear(),l.pnCounters.clear(),l.sets.clear(),E=0},getStats(){return{total:i.size+d.size+u.size+T.size,registers:i.size,gCounters:d.size,pnCounters:u.size,sets:T.size,version:E,nodeId:t,deltaHistorySize:p.length}}};return R}var $e,Ce=h(()=>{"use strict";K();M();V();J();$e={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var Ie=h(()=>{"use strict"});var Oe=h(()=>{"use strict";K();M();V();J();Ce();Ie()});var Je={};xe(Je,{ALLOWED_TABLE_NAMES:()=>H,BinaryHeap:()=>se,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>ye,UnifiedHnswIndex:()=>X,UnifiedMemoryManager:()=>A,clearProjectRootCache:()=>B,createHnswIndex:()=>oe,findProjectRoot:()=>b,getDefaultDbPath:()=>be,getResolvedDefaultConfig:()=>De,getUnifiedMemory:()=>Xe,initializeUnifiedMemory:()=>Ke,resetUnifiedMemory:()=>Ve,validateTableName:()=>O});import*as m from"fs";import*as ve from"os";import*as S from"path";function be(){let o=b();return S.join(o,".agentic-qe","memory.db")}function De(){return{...ye,dbPath:be()}}function Xe(o){return A.getInstance(o)}async function Ke(o){let e=Xe(o);return await e.initialize(),e}function Ve(){A.resetInstance()}function Qe(){if(Ae)return;Ae=!0;let o=()=>{try{let e=A.instance;e&&e.close()}catch(e){console.debug("[UnifiedMemory] Cleanup error:",e instanceof Error?e.message:e)}};process.on("beforeExit",o),process.on("SIGINT",()=>{o(),process.exit(0)}),process.on("SIGTERM",()=>{o(),process.exit(0)})}var y,ye,A,Ae,Ze=h(()=>{Pe();re();Fe();Me();Ge();Ee();Y();Y();ie();ie();Le();Oe();ze();y=te.create("unified-memory");ye={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 o{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;preparedStatements=new Map;vectorIndex=new X("qe-memory");crdtStore=null;proofGate=null;proofGateEnvChecked=!1;static PROOF_NS="__proofgate__";static PROOF_KEY="chain";constructor(e){let t=De();if(this.config={...t,...e},process.env.AQE_MEMORY_BACKEND==="memory"){this.config.dbPath=":memory:";return}if(!S.isAbsolute(this.config.dbPath)){let n=b();this.config.dbPath=S.join(n,this.config.dbPath)}}static getInstance(e){return o.instance||(o.instance=new o(e)),o.instance}static async getInstanceAsync(e){return o.instance?.initialized?o.instance:(o.instancePromise||(o.instancePromise=(async()=>{let t=o.getInstance(e);return await t.initialize(),t})()),o.instancePromise)}static resetInstance(){o.instance&&(o.instance.close(),o.instance=null),o.instancePromise=null,B()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=this.config.dbPath===":memory:",n="",a=!1,i=0;if(!t){let d=process.env.AQE_PROJECT_ROOT;if(d){let u=S.resolve(this.config.dbPath),T=S.resolve(d);!u.startsWith(T)&&!u.startsWith(ve.tmpdir())&&u.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${d}". Redirecting to test-safe path.`),this.config.dbPath=S.join(d,".agentic-qe","memory.db"))}if(n=S.dirname(this.config.dbPath),m.existsSync(n)||m.mkdirSync(n,{recursive:!0}),a=m.existsSync(this.config.dbPath),a)i=m.statSync(this.config.dbPath).size;else if(m.existsSync(n)){let u=this.findRecentBackups(n);if(u.length>0){let T=u[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
|
|
555
600
|
Expected: ${this.config.dbPath}
|
|
556
601
|
Found ${u.length} backup(s), newest: ${T.path} (${(T.size/1024/1024).toFixed(1)}MB)
|
|
557
|
-
Restoring from backup to prevent data loss...`),m.copyFileSync(T.path,this.config.dbPath);for(let E of["-wal","-shm"]){let p=this.config.dbPath+E;m.existsSync(p)&&m.unlinkSync(p)}i=T.size}}}if(e?.throwIfAborted(),this.db=
|
|
602
|
+
Restoring from backup to prevent data loss...`),m.copyFileSync(T.path,this.config.dbPath);for(let E of["-wal","-shm"]){let p=this.config.dbPath+E;m.existsSync(p)&&m.unlinkSync(p)}i=T.size}}}if(e?.throwIfAborted(),this.db=ne(this.config.dbPath,{walMode:this.config.walMode,busyTimeout:this.config.busyTimeout}),this.db.pragma(`mmap_size = ${this.config.mmapSize}`),this.db.pragma(`cache_size = ${this.config.cacheSize}`),this.db.pragma("foreign_keys = ON"),e?.aborted){try{this.db.close()}catch{}this.db=null,e.throwIfAborted()}if(await this.runMigrations(),e?.throwIfAborted(),a&&i>1e6)try{let d=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get();if(d&&d.cnt===0){let u=m.statSync(this.config.dbPath).size;u<i*.1&&console.error(`[UnifiedMemory] CRITICAL: Possible data loss detected!
|
|
558
603
|
DB was ${(i/1024/1024).toFixed(1)}MB, now ${(u/1024/1024).toFixed(1)}MB with 0 patterns.
|
|
559
604
|
This looks like the DB was replaced with an empty schema.
|
|
560
|
-
Check backups in ${n} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(t){throw this.initPromise=null,t instanceof Error&&(t.name==="AbortError"||(e?.aborted??!1))?t:new Error(`Failed to initialize UnifiedMemoryManager: ${D(t)}`)}}}findRecentBackups(e){try{let n=m.readdirSync(e).filter(i=>i.startsWith("memory")&&i.endsWith(".db")&&i!=="memory.db").map(i=>{let d=
|
|
605
|
+
Check backups in ${n} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(t){throw this.initPromise=null,t instanceof Error&&(t.name==="AbortError"||(e?.aborted??!1))?t:new Error(`Failed to initialize UnifiedMemoryManager: ${D(t)}`)}}}findRecentBackups(e){try{let n=m.readdirSync(e).filter(i=>i.startsWith("memory")&&i.endsWith(".db")&&i!=="memory.db").map(i=>{let d=S.join(e,i),u=m.statSync(d);return{path:d,size:u.size,mtime:u.mtimeMs}}).filter(i=>i.size>1e6).sort((i,d)=>d.mtime-i.mtime),a=S.join(e,"backups");if(m.existsSync(a)){let i=m.readdirSync(a);for(let d of i)if(d.endsWith(".db")){let u=S.join(a,d),T=m.statSync(u);T.size>1e6&&n.push({path:u,size:T.size,mtime:T.mtimeMs})}n.sort((d,u)=>u.mtime-d.mtime)}return n}catch{return[]}}warnIfDuplicateDatabases(){if(this.config.dbPath!==":memory:")try{let e=b(),t=S.resolve(this.config.dbPath),a=[S.join(e,".agentic-qe","memory.db"),S.join(e,"v3",".agentic-qe","memory.db")].map(i=>S.resolve(i)).filter(i=>i!==t&&m.existsSync(i));a.length>0&&console.warn(`[UnifiedMemory] WARNING: Duplicate database(s) detected!
|
|
561
606
|
Canonical: ${t}
|
|
562
|
-
Duplicates: ${
|
|
563
|
-
This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){y.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(i=>i.name===t)}catch(n){return y.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:
|
|
607
|
+
Duplicates: ${a.join(", ")}
|
|
608
|
+
This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){y.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(i=>i.name===t)}catch(n){return y.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:a}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,n)){let d=O(t);try{this.db.exec(`ALTER TABLE ${d} ADD COLUMN ${n} ${a}`),console.log(`[UnifiedMemory] Added column ${n} to ${t} (safe migration)`)}catch(u){console.log(`[UnifiedMemory] Column ${n} on ${t}: ${u instanceof Error?u.message:String(u)}`)}}}async runMigrations(){if(!this.db)throw new Error("Database not initialized");this.db.exec(pe),this.handleV2SchemaIncompatibilities();let t=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;t<w&&(console.log(`[UnifiedMemory] Migrating from v${t} to v${w}`),this.db.transaction(()=>{t<1&&this.db.exec(le),t<2&&this.db.exec(ge),t<3&&(this.db.exec(me),this.db.exec($),this.db.exec(_e)),t<4&&this.db.exec(fe),t<5&&this.db.exec(Ne),t<6&&this.db.exec(z),t<7&&this.db.exec(Se),t<8&&this.db.exec(he),t<9&&(this.db.exec(`
|
|
564
609
|
CREATE VIRTUAL TABLE IF NOT EXISTS qe_patterns_fts USING fts5(
|
|
565
610
|
name, description, pattern_type, qe_domain,
|
|
566
611
|
content='qe_patterns',
|
|
@@ -586,10 +631,10 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
586
631
|
`),this.db.exec(`
|
|
587
632
|
INSERT INTO qe_patterns_fts(rowid, name, description, pattern_type, qe_domain)
|
|
588
633
|
SELECT rowid, name, description, pattern_type, qe_domain FROM qe_patterns;
|
|
589
|
-
`)),t<10&&this.db.exec(j),this.db.prepare(`
|
|
634
|
+
`)),t<10&&this.db.exec(j),t<11&&this.migrateToV11GoapExecutionSteps(),this.db.prepare(`
|
|
590
635
|
INSERT OR REPLACE INTO schema_version (id, version, migrated_at)
|
|
591
636
|
VALUES (1, ?, datetime('now'))
|
|
592
|
-
`).run(w)})(),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",
|
|
637
|
+
`).run(w)})(),console.log("[UnifiedMemory] Migration complete"))}migrateToV11GoapExecutionSteps(){let e=this.db;e.exec($);let t=(n,a,i)=>{e.prepare(`SELECT name FROM pragma_table_info('${n}')`).all().some(u=>u.name===a)||e.exec(`ALTER TABLE ${n} ADD COLUMN ${a} ${i}`)};t("goap_execution_steps","execution_id","TEXT"),t("goap_execution_steps","retries","INTEGER DEFAULT 0"),t("goap_execution_steps","started_at","TEXT"),t("goap_execution_steps","agent_output","TEXT"),t("goap_actions","method","TEXT"),t("goap_actions","params","TEXT"),t("goap_actions","implemented","INTEGER DEFAULT 0"),e.exec("CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_execution ON goap_execution_steps(execution_id)")}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",a){this.ensureInitialized();let i=a?Date.now()+a*1e3:null,d=JSON.stringify(t);this.db.prepare(`
|
|
593
638
|
INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
|
|
594
639
|
VALUES (?, ?, ?, ?)
|
|
595
640
|
`).run(e,n,d,i),this.auditWrite("kvSet",n,e,d)}async kvGet(e,t="default"){this.ensureInitialized();let n=this.db.prepare(`
|
|
@@ -598,19 +643,19 @@ import{d as z,f as ke}from"./chunk-LW5DHT3Z.js";import{a as Pe}from"./chunk-XXRT
|
|
|
598
643
|
`).get(e,t);if(n){if(n.expires_at&&Date.now()>n.expires_at){this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t);return}return L(n.value)}}async kvDelete(e,t="default"){this.ensureInitialized();let n=this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t);return n.changes>0&&this.auditWrite("kvDelete",t,e,""),n.changes>0}async kvExists(e,t="default"){return this.ensureInitialized(),this.db.prepare(`
|
|
599
644
|
SELECT 1 FROM kv_store
|
|
600
645
|
WHERE key = ? AND namespace = ? AND (expires_at IS NULL OR expires_at > ?)
|
|
601
|
-
`).get(e,t,Date.now())!==void 0}async kvSearch(e,t="default",n=100){this.ensureInitialized();let
|
|
646
|
+
`).get(e,t,Date.now())!==void 0}async kvSearch(e,t="default",n=100){this.ensureInitialized();let a=e.replace(/\*/g,"%").replace(/\?/g,"_");return this.db.prepare(`
|
|
602
647
|
SELECT key FROM kv_store
|
|
603
648
|
WHERE namespace = ? AND key LIKE ?
|
|
604
649
|
AND (expires_at IS NULL OR expires_at > ?)
|
|
605
650
|
LIMIT ?
|
|
606
|
-
`).all(t,
|
|
651
|
+
`).all(t,a,Date.now(),n).map(d=>d.key)}async kvCleanupExpired(){return this.ensureInitialized(),this.db.prepare("DELETE FROM kv_store WHERE expires_at IS NOT NULL AND expires_at < ?").run(Date.now()).changes}enableProofGate(){this.ensureInitialized(),this.proofGateEnvChecked=!0,!this.proofGate&&(this.proofGate=this.loadProofChain()??new I)}isProofGateEnabled(){return this.proofGate!==null}verifyMemoryIntegrity(){if(!this.proofGate)throw new Error("Proof-gate not enabled \u2014 call enableProofGate() or set AQE_PROOF_GATE=1");return this.proofGate.verifyIntegrity()}getProofChainRoot(){return this.proofGate?this.proofGate.chainRoot():null}getProofChainLength(){return this.proofGate?this.proofGate.length:0}auditWrite(e,t,n,a){if(!this.proofGate){if(this.proofGateEnvChecked||(this.proofGateEnvChecked=!0,process.env.AQE_PROOF_GATE!=="1"))return;this.proofGate=this.loadProofChain()??new I}if(t!==o.PROOF_NS)try{this.proofGate.admit({op:e,ns:t,key:n,value:a}),this.persistProofChain()}catch(i){y.warn(`proof-gate audit skipped for ${t}/${n}: ${D(i)}`)}}persistProofChain(){!this.proofGate||!this.db||this.db.prepare(`
|
|
607
652
|
INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
|
|
608
653
|
VALUES (?, ?, ?, NULL)
|
|
609
654
|
`).run(o.PROOF_KEY,o.PROOF_NS,JSON.stringify(this.proofGate.toJSON()))}loadProofChain(){if(!this.db)return null;let e=this.db.prepare(`
|
|
610
655
|
SELECT value FROM kv_store WHERE key = ? AND namespace = ?
|
|
611
|
-
`).get(o.PROOF_KEY,o.PROOF_NS);if(!e)return null;try{return I.fromJSON(JSON.parse(e.value))}catch(t){return y.warn(`proof-gate chain failed to load (starting fresh): ${D(t)}`),null}}async vectorStore(e,t,n="default",
|
|
656
|
+
`).get(o.PROOF_KEY,o.PROOF_NS);if(!e)return null;try{return I.fromJSON(JSON.parse(e.value))}catch(t){return y.warn(`proof-gate chain failed to load (starting fresh): ${D(t)}`),null}}async vectorStore(e,t,n="default",a){this.ensureInitialized();let i=this.floatArrayToBuffer(t),d=a?JSON.stringify(a):null;this.db.prepare(`
|
|
612
657
|
INSERT OR REPLACE INTO vectors (id, namespace, embedding, dimensions, metadata, updated_at)
|
|
613
658
|
VALUES (?, ?, ?, ?, ?, datetime('now'))
|
|
614
659
|
`).run(e,n,i,t.length,d),this.vectorIndex.add(e,t)}async vectorGet(e){this.ensureInitialized();let t=this.db.prepare(`
|
|
615
660
|
SELECT embedding, dimensions, metadata FROM vectors WHERE id = ?
|
|
616
|
-
`).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?L(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e);return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,n){this.ensureInitialized(),this.vectorsLoaded||await this.loadVectorIndex();let
|
|
661
|
+
`).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?L(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e);return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,n){this.ensureInitialized(),this.vectorsLoaded||await this.loadVectorIndex();let a=this.vectorIndex.search(e,t*2);if(a.length===0)return[];let i=a.map(E=>E.id),d=i.map(()=>"?").join(","),u=this.db.prepare(`SELECT id, namespace, metadata FROM vectors WHERE id IN (${d})`).all(...i),T=new Map(u.map(E=>[E.id,E]));if(n){let E=[];for(let p of a){let g=T.get(p.id);if(g&&g.namespace===n&&(E.push({id:p.id,score:p.score,metadata:g.metadata?L(g.metadata):void 0}),E.length>=t))break}return E}return a.slice(0,t).map(E=>{let p=T.get(E.id);return{id:E.id,score:E.score,metadata:p?.metadata?L(p.metadata):void 0}})}async vectorCount(e){return this.ensureInitialized(),e?this.db.prepare("SELECT COUNT(*) as count FROM vectors WHERE namespace = ?").get(e).count:this.db.prepare("SELECT COUNT(*) as count FROM vectors").get().count}queryCount(e){this.ensureInitialized();let t=O(e);return this.db.prepare(`SELECT COUNT(*) as c FROM ${t}`).get().c}initializeCRDT(e){if(this.crdtStore){console.warn("[UnifiedMemory] CRDT store already initialized");return}this.crdtStore=Z({nodeId:e}),console.log(`[UnifiedMemory] CRDT store initialized for node: ${e}`)}getCRDTStore(){return this.crdtStore}isCRDTInitialized(){return this.crdtStore!==null}async crdtSet(e,t,n="crdt"){this.ensureInitialized(),this.crdtStore&&this.crdtStore.setRegister(e,t),await this.kvSet(e,t,n)}async crdtGet(e,t="crdt"){if(this.crdtStore){let n=this.crdtStore.getRegister(e);if(n)return n.get()}return this.kvGet(e,t)}crdtIncrement(e,t=1){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");let n=this.crdtStore.getCounter(e);n||(this.crdtStore.incrementCounter(e,0),n=this.crdtStore.getCounter(e));for(let a=0;a<t;a++)this.crdtStore.incrementCounter(e)}crdtGetCounter(e){return this.crdtStore?this.crdtStore.getCounter(e)?.get()??0:0}crdtAddToSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.addToSet(e,t)}crdtRemoveFromSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.removeFromSet(e,t)}crdtGetSet(e){if(!this.crdtStore)return new Set;let t=this.crdtStore.getSet(e);return new Set(t.values())}crdtGetState(){return this.crdtStore?this.crdtStore.getState():null}crdtGetDelta(e){return this.crdtStore?this.crdtStore.getDelta(e??0):null}crdtMerge(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyState(e)}crdtApplyDelta(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyDelta(e)}async crdtPersist(){if(!this.crdtStore)return;let e=this.crdtStore.getState();await this.kvSet("__crdt_state__",e,"crdt-internal")}async crdtRestore(){if(!this.crdtStore)return!1;let e=await this.kvGet("__crdt_state__","crdt-internal");return e?(this.crdtStore.applyState(e),!0):!1}getDatabase(){if(!this.db||!this.initialized)throw new Error("UnifiedMemoryManager not initialized");return this.db}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(e,t){if(!this.db)throw new Error("Database not initialized");let n=this.preparedStatements.get(e);return n||(n=this.db.prepare(t),this.preparedStatements.set(e,n)),n}transaction(e){if(!this.db)throw new Error("Database not initialized");return this.db.transaction(e)()}getStats(){if(!this.db)throw new Error("Database not initialized");let e=Re.map(a=>{try{let i=this.db.prepare(`SELECT COUNT(*) as count FROM ${a}`).get();return{name:a,rowCount:i.count}}catch(i){return y.debug("Table row count query failed",{table:a,error:i instanceof Error?i.message:String(i)}),{name:a,rowCount:0}}}),t=0,n=0;try{m.existsSync(this.config.dbPath)&&(t=m.statSync(this.config.dbPath).size);let a=this.config.dbPath+"-wal";m.existsSync(a)&&(n=m.statSync(a).size)}catch(a){console.debug("[UnifiedMemory] File stat error:",a instanceof Error?a.message:a)}return{tables:e,fileSize:t,walSize:n,vectorIndexSize:this.vectorIndex.size()}}vacuum(){if(!this.db)throw new Error("Database not initialized");this.db.exec("VACUUM")}checkpoint(){if(!this.db)throw new Error("Database not initialized");this.db.pragma("wal_checkpoint(TRUNCATE)")}close(){this.db&&(this.preparedStatements.clear(),this.vectorIndex.clear(),this.db.close(),this.db=null,this.initialized=!1,console.log("[UnifiedMemory] Database closed"))}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("UnifiedMemoryManager not initialized. Call initialize() first.")}floatArrayToBuffer(e){let t=Buffer.alloc(e.length*4);for(let n=0;n<e.length;n++)t.writeFloatLE(e[n],n*4);return t}bufferToFloatArray(e,t){let n=new Float32Array(e.buffer,e.byteOffset,t);return Array.from(n)}};Ae=!1;Qe()});export{H as a,O as b,nt as c,Y as d,be as e,ye as f,De as g,A as h,Xe as i,Ke as j,Ve as k,Je as l,Ze as m};
|
|
@@ -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.
|
|
2
|
-
import{a as T}from"./chunk-XXRTWG7O.js";import{c as S}from"./chunk-6GYGAW53.js";import{b as C,d as P}from"./chunk-VJGHRWMH.js";import{a as b,c as $}from"./chunk-PEIQDQXN.js";import{a as w,d as A}from"./chunk-7AWK43JN.js";$();A();import{randomUUID as M}from"crypto";var V={topology:"hierarchical",maxConcurrentSkills:10,maxConcurrentModels:3,timeout:3e5,continueOnFailure:!0,retry:{maxRetries:2,retryDelayMs:1e3}},R=class{config;learner;skillValidator=null;workers=new Map;taskQueue=[];isRunning=!1;constructor(e,t){this.config={...V,...e},this.learner=t}setSkillValidator(e){this.skillValidator=e}async validateSkillsParallel(e,t,i){let s=Date.now(),a=i?.trustTier??3,n=i?.validationLevel??"eval",c=this.determineTopology(e.length,t.length),r=this.createValidationTasks(e,t,a,n),o=await this.executeTasksParallel(r,c),l=new Map;for(let u of o){let p=l.get(u.skill)||[];p.push(u),l.set(u.skill,p)}return await this.recordOutcomesToLearner(o,a,n),l}async validateSkillCrossModel(e,t,i){return(await this.validateSkillsParallel([e],t,i)).get(e)||[]}getSummary(e){let t=[],i=new Map,s=new Map;for(let[c,r]of e){i.set(c,r);for(let o of r){t.push(o);let l=s.get(o.model)||[];l.push(o),s.set(o.model,l)}}let a=t.filter(c=>c.errors.length===0&&c.evalPassRate>=.9).length,n=t.reduce((c,r)=>c+r.durationMs,0);return{totalSkills:i.size,totalModels:s.size,successCount:a,failureCount:t.length-a,overallPassRate:t.length>0?a/t.length:0,totalDurationMs:n,avgDurationMs:t.length>0?n/t.length:0,topology:this.config.topology,bySkill:i,byModel:s,results:t}}determineTopology(e,t){if(this.config.topology){let i=e*t;return i>20&&this.config.topology==="mesh"&&console.warn(`[SwarmSkillValidator] Large workload (${i} tasks) may be more efficient with hierarchical topology`),this.config.topology}return e>5||e>t*2?"hierarchical":t>5&&e<=3?"mesh":"hierarchical"}createValidationTasks(e,t,i,s){let a=[];for(let n of e)for(let c of t)a.push({id:`${n}-${c}-${Date.now()}-${M().slice(0,8)}`,skill:n,model:c,trustTier:i,validationLevel:s,timeout:this.config.timeout,retryCount:0});return a}async executeTasksParallel(e,t){this.isRunning=!0,this.taskQueue=[...e];let i=[],s=t==="hierarchical"?this.config.maxConcurrentSkills:Math.min(this.config.maxConcurrentSkills*this.config.maxConcurrentModels,e.length),a=[];for(let n=0;n<Math.min(s,e.length);n++){let c=`worker-${n}`;this.workers.set(c,{id:c,task:null,status:"idle"}),a.push(this.runWorker(c,i))}return await Promise.all(a),this.isRunning=!1,this.workers.clear(),i}async runWorker(e,t){let i=this.workers.get(e);if(i){for(;this.taskQueue.length>0&&this.isRunning;){let s=this.taskQueue.shift();if(!s)break;i.task=s,i.status="running",i.startTime=Date.now();try{let a=await this.executeValidationTask(s);t.push(a),i.result=a,i.status="completed"}catch(a){let n=this.createErrorResult(s,a);this.config.retry&&s.retryCount<this.config.retry.maxRetries&&this.config.continueOnFailure?(s.retryCount++,this.taskQueue.push(s),await this.delay(this.config.retry.retryDelayMs)):(t.push(n),i.result=n,i.status="failed")}}i.task=null,i.status="idle"}}async executeValidationTask(e){let t=Date.now();if(!this.skillValidator)return this.createSimulatedResult(e,t);let i=new Promise((n,c)=>{setTimeout(()=>c(new Error(`Validation timeout after ${e.timeout}ms`)),e.timeout)}),s=await Promise.race([this.skillValidator(e.skill,e.model,{trustTier:e.trustTier,validationLevel:e.validationLevel,timeout:e.timeout}),i]),a=Date.now()-t;return this.outcomeToResult(s,e,a)}outcomeToResult(e,t,i){let s=e.testCaseResults.filter(c=>c.passed).length,a=e.testCaseResults.length,n=a>0?s/a:e.score;return{skill:t.skill,model:t.model,schemaValid:e.validationLevel!=="schema"||e.passed,validatorPassed:e.validationLevel!=="validator"||e.passed,evalPassRate:n,durationMs:i,errors:e.passed?[]:["Validation failed"],trustTier:t.trustTier,validationLevel:t.validationLevel,retryCount:t.retryCount,timestamp:new Date}}createSimulatedResult(e,t){let i=Date.now()-t+w()*100,s=.85+w()*.15;return{skill:e.skill,model:e.model,schemaValid:!0,validatorPassed:s>.8,evalPassRate:s,durationMs:i,errors:s>.8?[]:["Simulated validation failure"],trustTier:e.trustTier,validationLevel:e.validationLevel,retryCount:e.retryCount,timestamp:new Date}}createErrorResult(e,t){let i=b(t);return{skill:e.skill,model:e.model,schemaValid:!1,validatorPassed:!1,evalPassRate:0,durationMs:0,errors:[i],trustTier:e.trustTier,validationLevel:e.validationLevel,retryCount:e.retryCount,timestamp:new Date}}async recordOutcomesToLearner(e,t,i){for(let s of e){let a={skillName:s.skill,trustTier:s.trustTier||t,validationLevel:s.validationLevel||i,model:s.model,passed:s.errors.length===0&&s.evalPassRate>=.9,score:s.evalPassRate,testCaseResults:this.createTestCaseResults(s),timestamp:s.timestamp,runId:`swarm-${Date.now()}`,metadata:{duration:s.durationMs,retryCount:s.retryCount}};await this.learner.recordValidationOutcome(a)}}createTestCaseResults(e){return[{testId:`${e.skill}-${e.model}-aggregate`,passed:e.errors.length===0,expectedPatterns:["valid-output"],actualPatterns:e.errors.length===0?["valid-output"]:[],reasoningQuality:e.evalPassRate,executionTimeMs:e.durationMs,category:"swarm-validation",priority:"high",error:e.errors.length>0?e.errors.join("; "):void 0}]}delay(e){return new Promise(t=>setTimeout(t,e))}getConfig(){return{...this.config}}isValidationRunning(){return this.isRunning}getWorkerStatus(){return Array.from(this.workers.values())}cancel(){this.isRunning=!1,this.taskQueue=[]}};function D(y,e){return new R(y,e)}var F=["security-testing","accessibility-testing","api-testing","performance-testing","visual-regression-testing","mutation-testing","contract-testing","chaos-testing","compliance-testing","penetration-testing"],I=["claude-sonnet","claude-haiku","claude-opus"];P();import{readFileSync as E,writeFileSync as L,existsSync as N}from"fs";var O={varianceThreshold:.04,regressionThreshold:.1,minSamples:3,autoUpdateManifest:!1},k=class{constructor(e,t,i={}){this.learner=e;this.manifestPath=t;this.config={...O,...i}}learner;manifestPath;config;async aggregateResults(e){let t=`agg-${Date.now()}`,i=new Date,s=this.buildSkillResultsMap(e),a=this.calculateSummary(s,e),n=await this.detectCrossModelAnomalies(e),c=await this.detectRegressions(e,this.config.regressionThreshold),r=this.generateRecommendations(s,n,c),o={timestamp:i,runId:t,summary:a,skillResults:s,crossModelAnalysis:n,regressions:c,recommendations:r,metadata:{version:"1.0.0",environment:e[0]?.metadata?.environment,generatedBy:"ValidationResultAggregator",inputs:{runIds:e.map(l=>l.runId),models:[...new Set(e.map(l=>l.model))]}}};return this.config.autoUpdateManifest&&await this.updateManifest(o),o}buildSkillResultsMap(e){let t=new Map;for(let i of e)for(let s of i.outcomes){let a=s.skillName;t.has(a)||t.set(a,{skill:a,trustTier:s.trustTier,passRateByModel:new Map,avgPassRate:0,schemaValid:!0,validatorPassed:!0,evalPassed:!0,issues:[],executionTimeMs:0,testCount:0,passedTests:0,failedTests:0});let n=t.get(a),c=s.testCaseResults.filter(r=>r.passed).length/(s.testCaseResults.length||1);n.passRateByModel.set(i.model,c),n.testCount+=s.testCaseResults.length,n.passedTests+=s.testCaseResults.filter(r=>r.passed).length,n.failedTests+=s.testCaseResults.filter(r=>!r.passed).length,n.executionTimeMs+=s.metadata?.duration||0,s.validationLevel==="schema"&&!s.passed&&(n.schemaValid=!1),s.validationLevel==="validator"&&!s.passed&&(n.validatorPassed=!1),s.validationLevel==="eval"&&!s.passed&&(n.evalPassed=!1);for(let r of s.testCaseResults)!r.passed&&r.error&&n.issues.push({skill:a,model:i.model,severity:r.priority==="critical"?"critical":r.priority==="high"?"high":r.priority==="medium"?"medium":"low",type:this.categorizeIssueType(s.validationLevel,r.error),message:r.error,testId:r.testId})}for(let i of t.values()){let s=Array.from(i.passRateByModel.values());i.avgPassRate=s.length>0?s.reduce((a,n)=>a+n,0)/s.length:0}return t}categorizeIssueType(e,t){return t.toLowerCase().includes("timeout")?"timeout":e==="schema"?"schema_failure":e==="validator"?"validator_failure":e==="eval"?"eval_failure":"error"}calculateSummary(e,t){let i=Array.from(e.values()),s=i.filter(n=>n.avgPassRate>=.9).length,a=i.length>0?i.reduce((n,c)=>n+c.avgPassRate,0)/i.length:0;return{totalSkills:i.length,passedSkills:s,failedSkills:i.length-s,avgPassRate:a,totalDurationMs:t.reduce((n,c)=>n+c.durationMs,0),totalTests:i.reduce((n,c)=>n+c.testCount,0),passedTests:i.reduce((n,c)=>n+c.passedTests,0),failedTests:i.reduce((n,c)=>n+c.failedTests,0),modelsUsed:[...new Set(t.map(n=>n.model))]}}async detectCrossModelAnomalies(e){let t=new Map,i=new Map,s=new Map;for(let d of e){t.has(d.model)||(t.set(d.model,[]),i.set(d.model,{totalTests:0,passedTests:0,skillCount:0}));for(let g of d.outcomes){let h=g.testCaseResults.filter(m=>m.passed).length/(g.testCaseResults.length||1);t.get(d.model).push(h);let f=i.get(d.model);f.totalTests+=g.testCaseResults.length,f.passedTests+=g.testCaseResults.filter(m=>m.passed).length,f.skillCount++,s.has(g.skillName)||s.set(g.skillName,{passRates:[],models:[]}),s.get(g.skillName).passRates.push(h),s.get(g.skillName).models.push(d.model)}}let a=[];for(let d of t.values())a.push(...d);let n=a.length>0?a.reduce((d,g)=>d+g,0)/a.length:0,c=a.length>1?a.reduce((d,g)=>d+Math.pow(g-n,2),0)/a.length:0,r=Math.sqrt(c),o=[],l=new Map;for(let[d,g]of t.entries()){let h=g.reduce((v,x)=>v+x,0)/g.length,f=h-n,m=i.get(d);l.set(d,{avgPassRate:h,skillCount:m.skillCount,totalTests:m.totalTests}),Math.abs(f)>this.config.varianceThreshold*2&&o.push({model:d,type:f<0?"low_performance":"high_variance",description:`Model ${d} has ${(f*100).toFixed(1)}% difference from average`,passRate:h,avgPassRate:n,deviation:Math.abs(f)})}let u=[],p=[];for(let[d,g]of s.entries()){if(g.passRates.length<2)continue;let h=g.passRates.reduce((m,v)=>m+v,0)/g.passRates.length;g.passRates.reduce((m,v)=>m+Math.pow(v-h,2),0)/g.passRates.length<this.config.varianceThreshold?u.push(d):p.push(d)}return{variance:c,stdDeviation:r,anomalies:o,consistentSkills:u,inconsistentSkills:p,modelPerformance:l}}async detectRegressions(e,t){let i=[],s=new Set;for(let a of e)for(let n of a.outcomes){let c=`${n.skillName}-${a.model}`;if(s.has(c))continue;s.add(c);let r=await this.learner.getValidationTrends(n.skillName);if(!r)continue;let o=n.testCaseResults.filter(p=>p.passed).length/(n.testCaseResults.length||1),l=r.recentPassRate,u=l-o;u>=t&&i.push({skill:n.skillName,model:a.model,previousPassRate:l,currentPassRate:o,regressionAmount:u,trend:r.overall,possibleCauses:this.analyzePossibleCauses(n,u),severity:this.categorizeRegressionSeverity(u)})}return i.sort((a,n)=>{let c={critical:0,high:1,medium:2,low:3},r=c[a.severity]-c[n.severity];return r!==0?r:n.regressionAmount-a.regressionAmount})}analyzePossibleCauses(e,t){let i=[],s=e.testCaseResults.filter(c=>!c.passed);if(s.length>0){let c=[...new Set(s.map(r=>r.category).filter(Boolean))];c.length>0&&i.push(`Failures in categories: ${c.join(", ")}`)}let a=s.filter(c=>c.priority==="critical");a.length>0&&i.push(`${a.length} critical test(s) failing`);let n=e.testCaseResults.reduce((c,r)=>c+r.reasoningQuality,0)/(e.testCaseResults.length||1);return n<.7&&i.push(`Low reasoning quality score: ${(n*100).toFixed(1)}%`),t>.3&&i.push("Possible model behavior change or prompt drift"),i.length===0&&i.push("No specific cause identified - review test details"),i}categorizeRegressionSeverity(e){return e>=.5?"critical":e>=.3?"high":e>=.15?"medium":"low"}generateRecommendations(e,t,i){let s=[];if(t.inconsistentSkills.length>0&&s.push(`Review ${t.inconsistentSkills.length} skills with inconsistent cross-model behavior: `+t.inconsistentSkills.slice(0,3).join(", ")+(t.inconsistentSkills.length>3?` and ${t.inconsistentSkills.length-3} more`:"")),t.anomalies.some(r=>r.type==="low_performance")){let r=t.anomalies.filter(o=>o.type==="low_performance").map(o=>o.model);s.push(`Investigate low performance on model(s): ${r.join(", ")}`)}let a=i.filter(r=>r.severity==="critical");a.length>0&&s.push(`URGENT: ${a.length} critical regression(s) detected - immediate review required`);let n=Array.from(e.values()).filter(r=>r.avgPassRate<.9);if(n.length>0){let r=n.filter(l=>!l.schemaValid),o=n.filter(l=>!l.validatorPassed);r.length>0&&s.push(`Fix schema validation for: ${r.map(l=>l.skill).slice(0,3).join(", ")}`),o.length>0&&s.push(`Review validator scripts for: ${o.map(l=>l.skill).slice(0,3).join(", ")}`)}return Array.from(e.values()).reduce((r,o)=>r+o.avgPassRate,0)/e.size<.8&&s.push("Overall pass rate below 80% - consider reviewing skill definitions and test expectations"),s.length===0&&s.push("All validations passing - no immediate action required"),s}async updateManifest(e){if(!N(this.manifestPath))throw new Error(`Manifest file not found: ${this.manifestPath}`);let t=C(E(this.manifestPath,"utf-8"));for(let[s,a]of e.skillResults.entries())if(t.skills&&t.skills[s]){let n=t.skills[s];n.validation||(n.validation={}),n.validation.passRate=a.avgPassRate,n.validation.lastValidated=e.timestamp.toISOString(),n.validation.status=a.avgPassRate>=.9?"passing":"failing",n.validation.passRateByModel=Object.fromEntries(a.passRateByModel)}let i=Array.from(e.skillResults.values());t.validationStatus={passing:i.filter(s=>s.avgPassRate>=.9).length,failing:i.filter(s=>s.avgPassRate<.9).length,unknown:0,skipped:t.summary?.tier0||0},t.generatedAt=new Date().toISOString(),t.lastValidationRun={runId:e.runId,timestamp:e.timestamp.toISOString(),avgPassRate:e.summary.avgPassRate,modelsUsed:e.summary.modelsUsed},L(this.manifestPath,JSON.stringify(t,null,2))}generateMarkdownReport(e){let{summary:t,crossModelAnalysis:i,regressions:s,recommendations:a,skillResults:n}=e,c=(t.avgPassRate>=.9||t.avgPassRate>=.7,"`"),r=[];if(r.push(`# Validation Report
|
|
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.12.0");process.exit(0)}
|
|
2
|
+
import{a as T}from"./chunk-MDT3LIXS.js";import{c as S}from"./chunk-TJEJ4UVX.js";import{b as C,d as P}from"./chunk-K5SN66B4.js";import{a as b,c as $}from"./chunk-RHC7TFPU.js";import{a as w,d as A}from"./chunk-KJWQ7ENF.js";$();A();import{randomUUID as M}from"crypto";var V={topology:"hierarchical",maxConcurrentSkills:10,maxConcurrentModels:3,timeout:3e5,continueOnFailure:!0,retry:{maxRetries:2,retryDelayMs:1e3}},R=class{config;learner;skillValidator=null;workers=new Map;taskQueue=[];isRunning=!1;constructor(e,t){this.config={...V,...e},this.learner=t}setSkillValidator(e){this.skillValidator=e}async validateSkillsParallel(e,t,i){let s=Date.now(),a=i?.trustTier??3,n=i?.validationLevel??"eval",c=this.determineTopology(e.length,t.length),r=this.createValidationTasks(e,t,a,n),o=await this.executeTasksParallel(r,c),l=new Map;for(let u of o){let p=l.get(u.skill)||[];p.push(u),l.set(u.skill,p)}return await this.recordOutcomesToLearner(o,a,n),l}async validateSkillCrossModel(e,t,i){return(await this.validateSkillsParallel([e],t,i)).get(e)||[]}getSummary(e){let t=[],i=new Map,s=new Map;for(let[c,r]of e){i.set(c,r);for(let o of r){t.push(o);let l=s.get(o.model)||[];l.push(o),s.set(o.model,l)}}let a=t.filter(c=>c.errors.length===0&&c.evalPassRate>=.9).length,n=t.reduce((c,r)=>c+r.durationMs,0);return{totalSkills:i.size,totalModels:s.size,successCount:a,failureCount:t.length-a,overallPassRate:t.length>0?a/t.length:0,totalDurationMs:n,avgDurationMs:t.length>0?n/t.length:0,topology:this.config.topology,bySkill:i,byModel:s,results:t}}determineTopology(e,t){if(this.config.topology){let i=e*t;return i>20&&this.config.topology==="mesh"&&console.warn(`[SwarmSkillValidator] Large workload (${i} tasks) may be more efficient with hierarchical topology`),this.config.topology}return e>5||e>t*2?"hierarchical":t>5&&e<=3?"mesh":"hierarchical"}createValidationTasks(e,t,i,s){let a=[];for(let n of e)for(let c of t)a.push({id:`${n}-${c}-${Date.now()}-${M().slice(0,8)}`,skill:n,model:c,trustTier:i,validationLevel:s,timeout:this.config.timeout,retryCount:0});return a}async executeTasksParallel(e,t){this.isRunning=!0,this.taskQueue=[...e];let i=[],s=t==="hierarchical"?this.config.maxConcurrentSkills:Math.min(this.config.maxConcurrentSkills*this.config.maxConcurrentModels,e.length),a=[];for(let n=0;n<Math.min(s,e.length);n++){let c=`worker-${n}`;this.workers.set(c,{id:c,task:null,status:"idle"}),a.push(this.runWorker(c,i))}return await Promise.all(a),this.isRunning=!1,this.workers.clear(),i}async runWorker(e,t){let i=this.workers.get(e);if(i){for(;this.taskQueue.length>0&&this.isRunning;){let s=this.taskQueue.shift();if(!s)break;i.task=s,i.status="running",i.startTime=Date.now();try{let a=await this.executeValidationTask(s);t.push(a),i.result=a,i.status="completed"}catch(a){let n=this.createErrorResult(s,a);this.config.retry&&s.retryCount<this.config.retry.maxRetries&&this.config.continueOnFailure?(s.retryCount++,this.taskQueue.push(s),await this.delay(this.config.retry.retryDelayMs)):(t.push(n),i.result=n,i.status="failed")}}i.task=null,i.status="idle"}}async executeValidationTask(e){let t=Date.now();if(!this.skillValidator)return this.createSimulatedResult(e,t);let i=new Promise((n,c)=>{setTimeout(()=>c(new Error(`Validation timeout after ${e.timeout}ms`)),e.timeout)}),s=await Promise.race([this.skillValidator(e.skill,e.model,{trustTier:e.trustTier,validationLevel:e.validationLevel,timeout:e.timeout}),i]),a=Date.now()-t;return this.outcomeToResult(s,e,a)}outcomeToResult(e,t,i){let s=e.testCaseResults.filter(c=>c.passed).length,a=e.testCaseResults.length,n=a>0?s/a:e.score;return{skill:t.skill,model:t.model,schemaValid:e.validationLevel!=="schema"||e.passed,validatorPassed:e.validationLevel!=="validator"||e.passed,evalPassRate:n,durationMs:i,errors:e.passed?[]:["Validation failed"],trustTier:t.trustTier,validationLevel:t.validationLevel,retryCount:t.retryCount,timestamp:new Date}}createSimulatedResult(e,t){let i=Date.now()-t+w()*100,s=.85+w()*.15;return{skill:e.skill,model:e.model,schemaValid:!0,validatorPassed:s>.8,evalPassRate:s,durationMs:i,errors:s>.8?[]:["Simulated validation failure"],trustTier:e.trustTier,validationLevel:e.validationLevel,retryCount:e.retryCount,timestamp:new Date}}createErrorResult(e,t){let i=b(t);return{skill:e.skill,model:e.model,schemaValid:!1,validatorPassed:!1,evalPassRate:0,durationMs:0,errors:[i],trustTier:e.trustTier,validationLevel:e.validationLevel,retryCount:e.retryCount,timestamp:new Date}}async recordOutcomesToLearner(e,t,i){for(let s of e){let a={skillName:s.skill,trustTier:s.trustTier||t,validationLevel:s.validationLevel||i,model:s.model,passed:s.errors.length===0&&s.evalPassRate>=.9,score:s.evalPassRate,testCaseResults:this.createTestCaseResults(s),timestamp:s.timestamp,runId:`swarm-${Date.now()}`,metadata:{duration:s.durationMs,retryCount:s.retryCount}};await this.learner.recordValidationOutcome(a)}}createTestCaseResults(e){return[{testId:`${e.skill}-${e.model}-aggregate`,passed:e.errors.length===0,expectedPatterns:["valid-output"],actualPatterns:e.errors.length===0?["valid-output"]:[],reasoningQuality:e.evalPassRate,executionTimeMs:e.durationMs,category:"swarm-validation",priority:"high",error:e.errors.length>0?e.errors.join("; "):void 0}]}delay(e){return new Promise(t=>setTimeout(t,e))}getConfig(){return{...this.config}}isValidationRunning(){return this.isRunning}getWorkerStatus(){return Array.from(this.workers.values())}cancel(){this.isRunning=!1,this.taskQueue=[]}};function D(y,e){return new R(y,e)}var F=["security-testing","accessibility-testing","api-testing","performance-testing","visual-regression-testing","mutation-testing","contract-testing","chaos-testing","compliance-testing","penetration-testing"],I=["claude-sonnet","claude-haiku","claude-opus"];P();import{readFileSync as E,writeFileSync as L,existsSync as N}from"fs";var O={varianceThreshold:.04,regressionThreshold:.1,minSamples:3,autoUpdateManifest:!1},k=class{constructor(e,t,i={}){this.learner=e;this.manifestPath=t;this.config={...O,...i}}learner;manifestPath;config;async aggregateResults(e){let t=`agg-${Date.now()}`,i=new Date,s=this.buildSkillResultsMap(e),a=this.calculateSummary(s,e),n=await this.detectCrossModelAnomalies(e),c=await this.detectRegressions(e,this.config.regressionThreshold),r=this.generateRecommendations(s,n,c),o={timestamp:i,runId:t,summary:a,skillResults:s,crossModelAnalysis:n,regressions:c,recommendations:r,metadata:{version:"1.0.0",environment:e[0]?.metadata?.environment,generatedBy:"ValidationResultAggregator",inputs:{runIds:e.map(l=>l.runId),models:[...new Set(e.map(l=>l.model))]}}};return this.config.autoUpdateManifest&&await this.updateManifest(o),o}buildSkillResultsMap(e){let t=new Map;for(let i of e)for(let s of i.outcomes){let a=s.skillName;t.has(a)||t.set(a,{skill:a,trustTier:s.trustTier,passRateByModel:new Map,avgPassRate:0,schemaValid:!0,validatorPassed:!0,evalPassed:!0,issues:[],executionTimeMs:0,testCount:0,passedTests:0,failedTests:0});let n=t.get(a),c=s.testCaseResults.filter(r=>r.passed).length/(s.testCaseResults.length||1);n.passRateByModel.set(i.model,c),n.testCount+=s.testCaseResults.length,n.passedTests+=s.testCaseResults.filter(r=>r.passed).length,n.failedTests+=s.testCaseResults.filter(r=>!r.passed).length,n.executionTimeMs+=s.metadata?.duration||0,s.validationLevel==="schema"&&!s.passed&&(n.schemaValid=!1),s.validationLevel==="validator"&&!s.passed&&(n.validatorPassed=!1),s.validationLevel==="eval"&&!s.passed&&(n.evalPassed=!1);for(let r of s.testCaseResults)!r.passed&&r.error&&n.issues.push({skill:a,model:i.model,severity:r.priority==="critical"?"critical":r.priority==="high"?"high":r.priority==="medium"?"medium":"low",type:this.categorizeIssueType(s.validationLevel,r.error),message:r.error,testId:r.testId})}for(let i of t.values()){let s=Array.from(i.passRateByModel.values());i.avgPassRate=s.length>0?s.reduce((a,n)=>a+n,0)/s.length:0}return t}categorizeIssueType(e,t){return t.toLowerCase().includes("timeout")?"timeout":e==="schema"?"schema_failure":e==="validator"?"validator_failure":e==="eval"?"eval_failure":"error"}calculateSummary(e,t){let i=Array.from(e.values()),s=i.filter(n=>n.avgPassRate>=.9).length,a=i.length>0?i.reduce((n,c)=>n+c.avgPassRate,0)/i.length:0;return{totalSkills:i.length,passedSkills:s,failedSkills:i.length-s,avgPassRate:a,totalDurationMs:t.reduce((n,c)=>n+c.durationMs,0),totalTests:i.reduce((n,c)=>n+c.testCount,0),passedTests:i.reduce((n,c)=>n+c.passedTests,0),failedTests:i.reduce((n,c)=>n+c.failedTests,0),modelsUsed:[...new Set(t.map(n=>n.model))]}}async detectCrossModelAnomalies(e){let t=new Map,i=new Map,s=new Map;for(let d of e){t.has(d.model)||(t.set(d.model,[]),i.set(d.model,{totalTests:0,passedTests:0,skillCount:0}));for(let g of d.outcomes){let h=g.testCaseResults.filter(m=>m.passed).length/(g.testCaseResults.length||1);t.get(d.model).push(h);let f=i.get(d.model);f.totalTests+=g.testCaseResults.length,f.passedTests+=g.testCaseResults.filter(m=>m.passed).length,f.skillCount++,s.has(g.skillName)||s.set(g.skillName,{passRates:[],models:[]}),s.get(g.skillName).passRates.push(h),s.get(g.skillName).models.push(d.model)}}let a=[];for(let d of t.values())a.push(...d);let n=a.length>0?a.reduce((d,g)=>d+g,0)/a.length:0,c=a.length>1?a.reduce((d,g)=>d+Math.pow(g-n,2),0)/a.length:0,r=Math.sqrt(c),o=[],l=new Map;for(let[d,g]of t.entries()){let h=g.reduce((v,x)=>v+x,0)/g.length,f=h-n,m=i.get(d);l.set(d,{avgPassRate:h,skillCount:m.skillCount,totalTests:m.totalTests}),Math.abs(f)>this.config.varianceThreshold*2&&o.push({model:d,type:f<0?"low_performance":"high_variance",description:`Model ${d} has ${(f*100).toFixed(1)}% difference from average`,passRate:h,avgPassRate:n,deviation:Math.abs(f)})}let u=[],p=[];for(let[d,g]of s.entries()){if(g.passRates.length<2)continue;let h=g.passRates.reduce((m,v)=>m+v,0)/g.passRates.length;g.passRates.reduce((m,v)=>m+Math.pow(v-h,2),0)/g.passRates.length<this.config.varianceThreshold?u.push(d):p.push(d)}return{variance:c,stdDeviation:r,anomalies:o,consistentSkills:u,inconsistentSkills:p,modelPerformance:l}}async detectRegressions(e,t){let i=[],s=new Set;for(let a of e)for(let n of a.outcomes){let c=`${n.skillName}-${a.model}`;if(s.has(c))continue;s.add(c);let r=await this.learner.getValidationTrends(n.skillName);if(!r)continue;let o=n.testCaseResults.filter(p=>p.passed).length/(n.testCaseResults.length||1),l=r.recentPassRate,u=l-o;u>=t&&i.push({skill:n.skillName,model:a.model,previousPassRate:l,currentPassRate:o,regressionAmount:u,trend:r.overall,possibleCauses:this.analyzePossibleCauses(n,u),severity:this.categorizeRegressionSeverity(u)})}return i.sort((a,n)=>{let c={critical:0,high:1,medium:2,low:3},r=c[a.severity]-c[n.severity];return r!==0?r:n.regressionAmount-a.regressionAmount})}analyzePossibleCauses(e,t){let i=[],s=e.testCaseResults.filter(c=>!c.passed);if(s.length>0){let c=[...new Set(s.map(r=>r.category).filter(Boolean))];c.length>0&&i.push(`Failures in categories: ${c.join(", ")}`)}let a=s.filter(c=>c.priority==="critical");a.length>0&&i.push(`${a.length} critical test(s) failing`);let n=e.testCaseResults.reduce((c,r)=>c+r.reasoningQuality,0)/(e.testCaseResults.length||1);return n<.7&&i.push(`Low reasoning quality score: ${(n*100).toFixed(1)}%`),t>.3&&i.push("Possible model behavior change or prompt drift"),i.length===0&&i.push("No specific cause identified - review test details"),i}categorizeRegressionSeverity(e){return e>=.5?"critical":e>=.3?"high":e>=.15?"medium":"low"}generateRecommendations(e,t,i){let s=[];if(t.inconsistentSkills.length>0&&s.push(`Review ${t.inconsistentSkills.length} skills with inconsistent cross-model behavior: `+t.inconsistentSkills.slice(0,3).join(", ")+(t.inconsistentSkills.length>3?` and ${t.inconsistentSkills.length-3} more`:"")),t.anomalies.some(r=>r.type==="low_performance")){let r=t.anomalies.filter(o=>o.type==="low_performance").map(o=>o.model);s.push(`Investigate low performance on model(s): ${r.join(", ")}`)}let a=i.filter(r=>r.severity==="critical");a.length>0&&s.push(`URGENT: ${a.length} critical regression(s) detected - immediate review required`);let n=Array.from(e.values()).filter(r=>r.avgPassRate<.9);if(n.length>0){let r=n.filter(l=>!l.schemaValid),o=n.filter(l=>!l.validatorPassed);r.length>0&&s.push(`Fix schema validation for: ${r.map(l=>l.skill).slice(0,3).join(", ")}`),o.length>0&&s.push(`Review validator scripts for: ${o.map(l=>l.skill).slice(0,3).join(", ")}`)}return Array.from(e.values()).reduce((r,o)=>r+o.avgPassRate,0)/e.size<.8&&s.push("Overall pass rate below 80% - consider reviewing skill definitions and test expectations"),s.length===0&&s.push("All validations passing - no immediate action required"),s}async updateManifest(e){if(!N(this.manifestPath))throw new Error(`Manifest file not found: ${this.manifestPath}`);let t=C(E(this.manifestPath,"utf-8"));for(let[s,a]of e.skillResults.entries())if(t.skills&&t.skills[s]){let n=t.skills[s];n.validation||(n.validation={}),n.validation.passRate=a.avgPassRate,n.validation.lastValidated=e.timestamp.toISOString(),n.validation.status=a.avgPassRate>=.9?"passing":"failing",n.validation.passRateByModel=Object.fromEntries(a.passRateByModel)}let i=Array.from(e.skillResults.values());t.validationStatus={passing:i.filter(s=>s.avgPassRate>=.9).length,failing:i.filter(s=>s.avgPassRate<.9).length,unknown:0,skipped:t.summary?.tier0||0},t.generatedAt=new Date().toISOString(),t.lastValidationRun={runId:e.runId,timestamp:e.timestamp.toISOString(),avgPassRate:e.summary.avgPassRate,modelsUsed:e.summary.modelsUsed},L(this.manifestPath,JSON.stringify(t,null,2))}generateMarkdownReport(e){let{summary:t,crossModelAnalysis:i,regressions:s,recommendations:a,skillResults:n}=e,c=(t.avgPassRate>=.9||t.avgPassRate>=.7,"`"),r=[];if(r.push(`# Validation Report
|
|
3
3
|
|
|
4
4
|
> ${c} Generated: ${e.timestamp.toISOString()}
|
|
5
5
|
> Run ID: ${e.runId}
|
|
@@ -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.
|
|
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.12.0");process.exit(0)}
|
|
2
|
+
import{b as c,d as p}from"./chunk-K5SN66B4.js";import{a as f}from"./chunk-3AFNXU45.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};
|
|
@@ -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.
|
|
2
|
-
import{a as h}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.0");process.exit(0)}
|
|
2
|
+
import{a as h}from"./chunk-MDT3LIXS.js";import{c as m}from"./chunk-TJEJ4UVX.js";h();var g=m.create("regret-tracker"),l=50,R=.9,d=1.1;function f(o,t){let e=o.length;if(e<2)return 0;let n=0,r=0,i=0,a=0;for(let s=0;s<e;s++)n+=o[s],r+=t[s],i+=o[s]*t[s],a+=o[s]*o[s];let u=e*a-n*n;return Math.abs(u)<1e-10?0:(e*i-n*r)/u}var c=class{domains=new Map;alertCallbacks=[];alerts=[];maxAlerts;recentWindow;constructor(t){this.maxAlerts=t?.maxAlerts??100,this.recentWindow=t?.recentWindow??20}recordDecision(t,e,n){let r=this.getOrCreateDomainState(t),i=Math.max(0,n-e);if(r.cumulativeRegret+=i,r.decisionCount++,r.points.push({decisionCount:r.decisionCount,cumulativeRegret:r.cumulativeRegret,timestamp:Date.now()}),r.decisionCount>=l){let a=this.classifyGrowthRate(r.points);r.lastGrowthRate!=="insufficient_data"&&a!==r.lastGrowthRate&&this.emitAlert(t,r.lastGrowthRate,a),r.lastGrowthRate=a}}getCumulativeRegret(t){return this.domains.get(t)?.cumulativeRegret??0}getRegretCurve(t){let e=this.domains.get(t);return e?[...e.points]:[]}getRegretGrowthRate(t){let e=this.domains.get(t);return e?this.classifyGrowthRate(e.points):"insufficient_data"}detectStagnation(t){let e=this.getRegretGrowthRate(t);return e==="linear"||e==="superlinear"}getHealthSummary(){let t=[];for(let[e,n]of this.domains){let r=this.classifyGrowthRate(n.points),i=this.computeLogLogSlope(n.points),a=this.computeRecentAvgRegret(n);t.push({domain:e,totalDecisions:n.decisionCount,cumulativeRegret:n.cumulativeRegret,growthRate:r,stagnating:r==="linear"||r==="superlinear",slope:i,recentAvgRegret:a})}return t.sort((e,n)=>e.domain.localeCompare(n.domain)),t}onAlert(t){this.alertCallbacks.push(t)}getAlerts(){return[...this.alerts]}getTrackedDomains(){return[...this.domains.keys()].sort()}getTotalDecisions(){let t=0;for(let e of this.domains.values())t+=e.decisionCount;return t}reset(t){t?this.domains.delete(t):(this.domains.clear(),this.alerts=[])}getOrCreateDomainState(t){let e=this.domains.get(t);return e||(e={points:[],cumulativeRegret:0,decisionCount:0,lastGrowthRate:"insufficient_data"},this.domains.set(t,e)),e}classifyGrowthRate(t){if(t.length<l)return"insufficient_data";let e=this.computeLogLogSlope(t);return e===void 0?"insufficient_data":e<R?"sublinear":e<=d?"linear":"superlinear"}computeLogLogSlope(t){if(t.length<l)return;let e=t.filter(i=>i.cumulativeRegret>0&&i.decisionCount>0);if(e.length<2)return;let n=e.map(i=>Math.log(i.decisionCount)),r=e.map(i=>Math.log(i.cumulativeRegret));return f(n,r)}computeRecentAvgRegret(t){if(t.points.length<2)return 0;let e=Math.min(this.recentWindow,t.points.length),n=t.points.slice(-e),r=n[0],i=n[n.length-1],a=i.cumulativeRegret-r.cumulativeRegret,u=i.decisionCount-r.decisionCount;return u<=0?0:a/u}emitAlert(t,e,n){let r={domain:t,previousRate:e,newRate:n,timestamp:Date.now(),message:`Domain "${t}" regret growth changed from ${e} to ${n}`};this.alerts.push(r),this.alerts.length>this.maxAlerts&&this.alerts.shift(),g.info("Regret growth rate transition",{domain:t,previousRate:e,newRate:n});for(let i of this.alertCallbacks)try{i(r)}catch(a){g.error("Alert callback error",a instanceof Error?a:void 0)}}};function b(o){return new c(o)}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.
|
|
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.12.0");process.exit(0)}
|
|
2
2
|
function r(e,f){if(e==null)return e;let n={...e};for(let t of f){let o=n[t];typeof o=="string"&&(n[t]=new Date(o))}return n}export{r as a};
|