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
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { createHash } from 'crypto';
|
|
9
9
|
import { getUnifiedMemory } from '../kernel/unified-memory.js';
|
|
10
|
+
import { getDefaultWitnessKeyManager } from './witness-key-manager.js';
|
|
10
11
|
// --- Constants & Hash Functions ---
|
|
11
12
|
const GENESIS_PREV_HASH = '0'.repeat(64);
|
|
12
13
|
function sha256(data) {
|
|
@@ -128,43 +129,87 @@ export class WitnessChain {
|
|
|
128
129
|
hash_algo: algo, signature, signer_key_id: signerKeyId,
|
|
129
130
|
};
|
|
130
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Find the entry with the given id, checking the live table first and then
|
|
134
|
+
* the archive. Used to recover a predecessor that array-adjacency can't
|
|
135
|
+
* see directly (it was archived, possibly by an earlier archival run than
|
|
136
|
+
* the one that affects the entry currently being checked).
|
|
137
|
+
*/
|
|
138
|
+
findEntryById(id) {
|
|
139
|
+
if (!this.db)
|
|
140
|
+
return undefined;
|
|
141
|
+
return this.db.prepare('SELECT * FROM witness_chain WHERE id = ?').get(id)
|
|
142
|
+
?? this.db.prepare('SELECT * FROM witness_chain_archive WHERE id = ?').get(id);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Check one entry's self-hash and chain link. `arrayAdjacent` is whatever
|
|
146
|
+
* entry sits immediately before `current` in the array currently being
|
|
147
|
+
* scanned (undefined at the start of that array) — it's tried first since
|
|
148
|
+
* it's free (already fetched); a cross-table lookup by id only runs on a
|
|
149
|
+
* mismatch, e.g. because the true predecessor was moved to the archive by
|
|
150
|
+
* a *different* archival run than the one this scan is walking.
|
|
151
|
+
*/
|
|
152
|
+
checkEntryLink(current, arrayAdjacent) {
|
|
153
|
+
const algo = current.hash_algo || 'sha256';
|
|
154
|
+
if (current.action_hash !== hashWith(algo, current.action_data))
|
|
155
|
+
return false;
|
|
156
|
+
if (current.id === 1)
|
|
157
|
+
return current.prev_hash === GENESIS_PREV_HASH; // genesis, never archived
|
|
158
|
+
if (arrayAdjacent && current.prev_hash === hashWith(algo, serializeEntry(arrayAdjacent))) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
const predecessor = this.findEntryById(current.id - 1);
|
|
162
|
+
return predecessor !== undefined && current.prev_hash === hashWith(algo, serializeEntry(predecessor));
|
|
163
|
+
}
|
|
131
164
|
/** Verify chain integrity. Supports mixed SHA-256/SHAKE-256 and optional signature checks. */
|
|
132
165
|
verify(options) {
|
|
133
166
|
if (!this.db)
|
|
134
167
|
throw new Error('WitnessChain not initialized');
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
168
|
+
const live = this.db.prepare('SELECT * FROM witness_chain ORDER BY id ASC').all();
|
|
169
|
+
if (live.length === 0)
|
|
137
170
|
return { valid: true, entriesChecked: 0 };
|
|
138
171
|
let signatureFailures = 0;
|
|
139
172
|
const checkSigs = options?.checkSignatures === true && this.keyManager !== null;
|
|
140
|
-
|
|
141
|
-
const current = entries[i];
|
|
142
|
-
const algo = current.hash_algo || 'sha256';
|
|
143
|
-
if (current.action_hash !== hashWith(algo, current.action_data)) {
|
|
144
|
-
return { valid: false, brokenAt: current.id, entriesChecked: i + 1, signatureFailures };
|
|
145
|
-
}
|
|
146
|
-
if (i === 0) {
|
|
147
|
-
if (current.prev_hash !== GENESIS_PREV_HASH) {
|
|
148
|
-
return { valid: false, brokenAt: current.id, entriesChecked: 1, signatureFailures };
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
const expectedPrevHash = hashWith(algo, serializeEntry(entries[i - 1]));
|
|
153
|
-
if (current.prev_hash !== expectedPrevHash) {
|
|
154
|
-
return { valid: false, brokenAt: current.id, entriesChecked: i + 1, signatureFailures };
|
|
155
|
-
}
|
|
156
|
-
}
|
|
173
|
+
const checkSignature = (current) => {
|
|
157
174
|
if (checkSigs && current.signature && current.signer_key_id) {
|
|
158
175
|
const sigData = Buffer.from(current.prev_hash + current.action_hash + current.action_type + current.timestamp + current.actor, 'utf-8');
|
|
159
176
|
if (!this.keyManager.verify(Buffer.from(sigData), Buffer.from(current.signature, 'hex'), current.signer_key_id)) {
|
|
160
177
|
signatureFailures++;
|
|
161
178
|
}
|
|
162
179
|
}
|
|
180
|
+
};
|
|
181
|
+
// Live table: always its own valid chain, since append() always chains
|
|
182
|
+
// to whatever the live tail is at write time — array-adjacency is right
|
|
183
|
+
// by construction *except* at a boundary where the true predecessor has
|
|
184
|
+
// since been archived, which checkEntryLink()'s fallback covers.
|
|
185
|
+
for (let i = 0; i < live.length; i++) {
|
|
186
|
+
const current = live[i];
|
|
187
|
+
if (!this.checkEntryLink(current, i > 0 ? live[i - 1] : undefined)) {
|
|
188
|
+
return { valid: false, brokenAt: current.id, entriesChecked: i + 1, signatureFailures };
|
|
189
|
+
}
|
|
190
|
+
checkSignature(current);
|
|
191
|
+
}
|
|
192
|
+
let entriesChecked = live.length;
|
|
193
|
+
if (options?.includeArchive) {
|
|
194
|
+
// The archived segment is its own contiguous slice of history (by id)
|
|
195
|
+
// and is checked the same way — NOT by merging archive+live into one
|
|
196
|
+
// id-sorted array, which would wrongly treat an archived row as the
|
|
197
|
+
// predecessor of a live row that was actually appended (and correctly
|
|
198
|
+
// chained to the live tail) well after that row was archived.
|
|
199
|
+
const archived = this.db.prepare('SELECT * FROM witness_chain_archive ORDER BY id ASC').all();
|
|
200
|
+
for (let i = 0; i < archived.length; i++) {
|
|
201
|
+
const current = archived[i];
|
|
202
|
+
if (!this.checkEntryLink(current, i > 0 ? archived[i - 1] : undefined)) {
|
|
203
|
+
return { valid: false, brokenAt: current.id, entriesChecked: entriesChecked + i + 1, signatureFailures };
|
|
204
|
+
}
|
|
205
|
+
checkSignature(current);
|
|
206
|
+
}
|
|
207
|
+
entriesChecked += archived.length;
|
|
163
208
|
}
|
|
164
209
|
const valid = signatureFailures === 0;
|
|
165
210
|
return {
|
|
166
|
-
valid, entriesChecked
|
|
167
|
-
...(signatureFailures > 0 ? { brokenAt:
|
|
211
|
+
valid, entriesChecked, signatureFailures,
|
|
212
|
+
...(signatureFailures > 0 ? { brokenAt: live[0].id } : {}),
|
|
168
213
|
};
|
|
169
214
|
}
|
|
170
215
|
/** Query entries with optional filters. */
|
|
@@ -259,7 +304,9 @@ export class WitnessChain {
|
|
|
259
304
|
let _instance = null;
|
|
260
305
|
export async function getWitnessChain() {
|
|
261
306
|
if (!_instance) {
|
|
262
|
-
|
|
307
|
+
// ADR-070 Phase 6.2: sign with the persistent, project-wide default key
|
|
308
|
+
// manager so entries get real signatures that survive process restarts.
|
|
309
|
+
_instance = new WitnessChain(undefined, getDefaultWitnessKeyManager());
|
|
263
310
|
await _instance.initialize();
|
|
264
311
|
}
|
|
265
312
|
return _instance;
|
|
@@ -97,4 +97,15 @@ export declare class WitnessKeyManager {
|
|
|
97
97
|
/** Load all key pairs from PEM files in keyDir. */
|
|
98
98
|
private loadFromDisk;
|
|
99
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Get the process-wide default WitnessKeyManager, backed by a persistent
|
|
102
|
+
* `.agentic-qe/witness-keys/` directory under the project root. Every
|
|
103
|
+
* production `WitnessChain` construction site should use this (instead of
|
|
104
|
+
* an ephemeral in-memory-only manager) so a signature created by one process
|
|
105
|
+
* can still be verified by a later one — an ephemeral key dies with the
|
|
106
|
+
* process that made it, permanently orphaning every signature it produced.
|
|
107
|
+
*/
|
|
108
|
+
export declare function getDefaultWitnessKeyManager(): WitnessKeyManager;
|
|
109
|
+
/** Test-only: reset the default key manager singleton between test files. */
|
|
110
|
+
export declare function _resetDefaultWitnessKeyManagerForTests(): void;
|
|
100
111
|
//# sourceMappingURL=witness-key-manager.d.ts.map
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { generateKeyPairSync, createPrivateKey, createPublicKey, sign, verify, createHash, } from 'crypto';
|
|
10
10
|
import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync } from 'fs';
|
|
11
11
|
import { join } from 'path';
|
|
12
|
+
import { findProjectRoot } from '../kernel/project-root.js';
|
|
12
13
|
// ============================================================================
|
|
13
14
|
// WitnessKeyManager Implementation
|
|
14
15
|
// ============================================================================
|
|
@@ -215,4 +216,27 @@ export class WitnessKeyManager {
|
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
218
|
}
|
|
219
|
+
// ============================================================================
|
|
220
|
+
// Default (project-wide) instance — ADR-070 Phase 6.2 production wiring
|
|
221
|
+
// ============================================================================
|
|
222
|
+
let _defaultInstance = null;
|
|
223
|
+
/**
|
|
224
|
+
* Get the process-wide default WitnessKeyManager, backed by a persistent
|
|
225
|
+
* `.agentic-qe/witness-keys/` directory under the project root. Every
|
|
226
|
+
* production `WitnessChain` construction site should use this (instead of
|
|
227
|
+
* an ephemeral in-memory-only manager) so a signature created by one process
|
|
228
|
+
* can still be verified by a later one — an ephemeral key dies with the
|
|
229
|
+
* process that made it, permanently orphaning every signature it produced.
|
|
230
|
+
*/
|
|
231
|
+
export function getDefaultWitnessKeyManager() {
|
|
232
|
+
if (!_defaultInstance) {
|
|
233
|
+
const keyDir = join(findProjectRoot(), '.agentic-qe', 'witness-keys');
|
|
234
|
+
_defaultInstance = new WitnessKeyManager({ keyDir });
|
|
235
|
+
}
|
|
236
|
+
return _defaultInstance;
|
|
237
|
+
}
|
|
238
|
+
/** Test-only: reset the default key manager singleton between test files. */
|
|
239
|
+
export function _resetDefaultWitnessKeyManagerForTests() {
|
|
240
|
+
_defaultInstance = null;
|
|
241
|
+
}
|
|
218
242
|
//# sourceMappingURL=witness-key-manager.js.map
|
|
@@ -16,6 +16,7 @@ import { diffBrains, } from '../integrations/ruvector/brain-diff.js';
|
|
|
16
16
|
import { searchBrain, } from '../integrations/ruvector/brain-search.js';
|
|
17
17
|
import { createWitnessChain } from '../audit/witness-chain.js';
|
|
18
18
|
import { backfillWitnessChain } from '../audit/witness-backfill.js';
|
|
19
|
+
import { getDefaultWitnessKeyManager } from '../audit/witness-key-manager.js';
|
|
19
20
|
/**
|
|
20
21
|
* Export the QE brain state.
|
|
21
22
|
*
|
|
@@ -117,7 +118,7 @@ export async function brainSearch(inputPath, options = {}) {
|
|
|
117
118
|
export async function witnessBackfill(dbPath) {
|
|
118
119
|
const db = openDatabase(dbPath);
|
|
119
120
|
try {
|
|
120
|
-
const chain = createWitnessChain(db);
|
|
121
|
+
const chain = createWitnessChain(db, getDefaultWitnessKeyManager());
|
|
121
122
|
await chain.initialize();
|
|
122
123
|
return backfillWitnessChain(db, chain);
|
|
123
124
|
}
|
package/dist/cli/bundle.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
3
|
-
import{a as y}from"./chunks/chunk-
|
|
2
|
+
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)}
|
|
3
|
+
import{a as y}from"./chunks/chunk-7ZIVDGSN.js";import{a as f,c as P}from"./chunks/chunk-RHC7TFPU.js";import"./chunks/chunk-3AFNXU45.js";P();import{Command as S}from"commander";import m from"chalk";function h(e,i,a,s){let l=e.command(i).description(a);if(s)for(let u of s)l.alias(u);return l.helpOption(!1),l.allowUnknownOption(!0),l.allowExcessArguments(!0),l}function w(e,i){let a=e.commands,s=a.indexOf(i);s>=0&&a.splice(s,1)}function o(e,i){let a=h(e,i.name,i.description,i.aliases);a.action(async()=>{try{let s=await i.factory();w(e,a),e.addCommand(s),await e.parseAsync(process.argv)}catch(s){console.error(`Failed to load command '${i.name}':`,s instanceof Error?s.message:s),process.exit(1)}})}function d(e,i,a,s,l,u){let g=h(e,i,a,u);g.action(async()=>{try{let p=await s();w(e,g),p.register(e,l),await e.parseAsync(process.argv)}catch(p){console.error(`Failed to load command '${i}':`,p instanceof Error?p.message:p),process.exit(1)}})}var I=["[UnifiedMemory]","[HybridBackend]","[UnifiedPersistence]","[PersistentSONAEngine]","[QueenGovernance]","[QueenCoordinator]","[Queen]","[QUEEN]","[DomainBreakerRegistry]","[RealEmbeddings]","[HNSWIndex]","[PatternStore]","[TestGenerationCoordinator]","[CodeIntelligence]","[ProductFactorsBridge]","[LearningOptimizationCoordinator]","[DreamEngine]","[DreamScheduler]","[SecurityCompliance]","[Providers]","[GNN]","[test-generation]","[test-execution]","[coverage-analysis]","[quality-assessment]","[defect-intelligence]","[requirements-validation]","[code-intelligence]","[security-compliance]","[contract-testing]","[visual-accessibility]","[chaos-resilience]","[learning-optimization]","[enterprise-integration]","[coordination]","[PatternLearnerService]","[RequirementsValidation]","[ParserRegistry]","[AdversarialDefense]","[ContinueGateIntegration]","[ContinueGate]","[SQLitePatternStore]","[TokenTracking]","[InfraHealing]","[ExperienceCapture]"],b=/^\[\d{2}:\d{2}:\d{2}\.\d{3}\]\s+\[/,D=console.log.bind(console);console.log=(...e)=>{let a=(typeof e[0]=="string"?e[0]:"").trimStart();if(I.some(s=>a.startsWith(s))||b.test(a)){process.stderr.write(e.map(String).join(" ")+`
|
|
4
4
|
`);return}D(...e)};console.info=(...e)=>{process.stderr.write(e.map(String).join(" ")+`
|
|
5
|
-
`)};var t={kernel:null,queen:null,router:null,workflowOrchestrator:null,scheduledWorkflows:new Map,persistentScheduler:null,initialized:!1};function C(e,i){let a=e.getDomainAPI("visual-accessibility");if(a?.registerWorkflowActions)try{a.registerWorkflowActions(i)}catch(l){console.error(m.yellow(` Warning: Could not register visual-accessibility workflow actions: ${f(l)}`))}let s=e.getDomainAPI("requirements-validation");if(s?.registerWorkflowActions)try{s.registerWorkflowActions(i)}catch(l){console.error(m.yellow(` Warning: Could not register requirements-validation workflow actions: ${f(l)}`))}}async function
|
|
5
|
+
`)};var t={kernel:null,queen:null,router:null,workflowOrchestrator:null,scheduledWorkflows:new Map,persistentScheduler:null,initialized:!1};function C(e,i){let a=e.getDomainAPI("visual-accessibility");if(a?.registerWorkflowActions)try{a.registerWorkflowActions(i)}catch(l){console.error(m.yellow(` Warning: Could not register visual-accessibility workflow actions: ${f(l)}`))}let s=e.getDomainAPI("requirements-validation");if(s?.registerWorkflowActions)try{s.registerWorkflowActions(i)}catch(l){console.error(m.yellow(` Warning: Could not register requirements-validation workflow actions: ${f(l)}`))}}async function R(){let{QEKernelImpl:e}=await import("./chunks/kernel-CQ7R3AAV.js"),{CrossDomainEventRouter:i}=await import("./chunks/cross-domain-router-SXQ3HFRY.js"),{DefaultProtocolExecutor:a}=await import("./chunks/protocol-executor-5HJKW6MC.js"),{WorkflowOrchestrator:s}=await import("./chunks/workflow-orchestrator-S4LBFTYD.js"),{createQueenCoordinator:l}=await import("./chunks/queen-coordinator-6JFZD54W.js"),{createPersistentScheduler:u}=await import("./chunks/scheduler-MALHQKNR.js");t.kernel=new e({maxConcurrentAgents:15,memoryBackend:"sqlite",hnswEnabled:!0,lazyLoading:!0,enabledDomains:[...y],enableExperienceBridge:!1}),await t.kernel.initialize(),t.router=new i(t.kernel.eventBus),await t.router.initialize();let g=A=>t.kernel.getDomainAPI(A),p=new a(t.kernel.eventBus,t.kernel.memory,g);t.workflowOrchestrator=new s(t.kernel.eventBus,t.kernel.memory,t.kernel.coordinator),await t.workflowOrchestrator.initialize(),C(t.kernel,t.workflowOrchestrator),t.persistentScheduler=u(),t.queen=l(t.kernel,t.router,p,void 0),await t.queen.initialize();let{adoptExternalFleet:E}=await import("./chunks/core-handlers-46Z5VOO6.js");E({kernel:t.kernel,queen:t.queen,router:t.router,workflowOrchestrator:t.workflowOrchestrator}),t.initialized=!0}async function k(){if(t.initialized&&t.kernel&&t.queen)return!0;let e=await import("fs"),a=(await import("path")).resolve(".agentic-qe");return e.existsSync(a)?c():(console.error(m.red(`
|
|
6
6
|
Error: AQE system not initialized in this directory.`)),console.log(m.yellow("Run `aqe init` first to set up this project.\n")),!1)}async function c(){if(t.initialized&&t.kernel&&t.queen)return!0;process.stderr.write(m.gray("Auto-initializing v3 system...")+`
|
|
7
|
-
`);let e=3e4,i=new Promise((a,s)=>{setTimeout(()=>s(new Error("Initialization timeout after 30 seconds")),e)});try{return await Promise.race([
|
|
7
|
+
`);let e=3e4,i=new Promise((a,s)=>{setTimeout(()=>s(new Error("Initialization timeout after 30 seconds")),e)});try{return await Promise.race([R(),i]),process.stderr.write(m.green("System ready")+`
|
|
8
8
|
|
|
9
|
-
`),!0}catch(a){return a.message.includes("timeout")?(console.error(m.red("Initialization timed out after 30 seconds.")),console.log(m.yellow("Try running `aqe init` manually."))):(console.error(m.red("Failed to auto-initialize:"),a),console.log(m.yellow("Try running `aqe init` manually."))),!1}}async function r(e=0){try{t.workflowOrchestrator&&t.workflowOrchestrator.dispose().catch(()=>{}),t.queen&&t.queen.dispose().catch(()=>{}),t.router&&t.router.dispose().catch(()=>{}),t.kernel&&t.kernel.dispose().catch(()=>{})}catch{}process.exit(e)}var n=new S,v="3.
|
|
9
|
+
`),!0}catch(a){return a.message.includes("timeout")?(console.error(m.red("Initialization timed out after 30 seconds.")),console.log(m.yellow("Try running `aqe init` manually."))):(console.error(m.red("Failed to auto-initialize:"),a),console.log(m.yellow("Try running `aqe init` manually."))),!1}}async function r(e=0){try{t.workflowOrchestrator&&t.workflowOrchestrator.dispose().catch(()=>{}),t.queen&&t.queen.dispose().catch(()=>{}),t.router&&t.router.dispose().catch(()=>{}),t.kernel&&t.kernel.dispose().catch(()=>{})}catch{}process.exit(e)}var n=new S,v="3.12.0";n.name("aqe").description("Agentic QE - Domain-Driven Quality Engineering").version(v);d(n,"init","Initialize the AQE v3 system",()=>import("./chunks/init-handler-RXUSEMG7.js").then(e=>e.createInitHandler(r)),t);d(n,"status","Show system status",()=>import("./chunks/status-handler-HGCKYJX2.js").then(e=>e.createStatusHandler(r,k)),t);d(n,"health","Check system health",()=>import("./chunks/status-handler-HGCKYJX2.js").then(e=>e.createHealthHandler(r,k)),t);d(n,"task","Manage QE tasks",()=>import("./chunks/task-handler-O6REL34Y.js").then(e=>e.createTaskHandler(r,c)),t);d(n,"agent","Manage QE agents",()=>import("./chunks/agent-handler-A57SZUCW.js").then(e=>e.createAgentHandler(r,c)),t);d(n,"domain","Domain operations",()=>import("./chunks/domain-handler-4XU5BINU.js").then(e=>e.createDomainHandler(r,c)),t);d(n,"protocol","Execute coordination protocols",()=>import("./chunks/protocol-handler-ELGYV7D2.js").then(e=>e.createProtocolHandler(r,c)),t);d(n,"brain","Export, import, and inspect QE brain state",()=>import("./chunks/brain-handler-OHDPI5TQ.js").then(e=>e.createBrainHandler(r,c)),t);d(n,"hypergraph","Query the code knowledge hypergraph",()=>import("./chunks/hypergraph-handler-5ERXAVGH.js").then(e=>e.createHypergraphHandler(r,c)),t,["hg"]);d(n,"heartbeat","Manage the token-free heartbeat scheduler",()=>import("./chunks/heartbeat-handler-HLO5XCG7.js").then(e=>e.createHeartbeatHandler(r)),t);d(n,"routing","View routing performance, economics, and accuracy",()=>import("./chunks/routing-handler-ZJKGDDMT.js").then(e=>e.createRoutingHandler(r)),t);o(n,{name:"workflow",description:"Manage QE workflows and pipelines (ADR-041)",factory:()=>import("./chunks/workflow-ENBWRMBA.js").then(e=>e.createWorkflowCommand(t,r,c))});o(n,{name:"test",description:"Test generation, execution, scheduling, and load testing",factory:()=>import("./chunks/test-4LXUVHEU.js").then(e=>e.createTestCommand(t,r,c))});o(n,{name:"coverage",description:"Coverage analysis shortcut",factory:()=>import("./chunks/coverage-GTZJBSC4.js").then(e=>e.createCoverageCommand(t,r,c))});o(n,{name:"quality",description:"Quality assessment shortcut",factory:()=>import("./chunks/quality-HH7L5A7V.js").then(e=>e.createQualityCommand(t,r,c))});o(n,{name:"quality-gate",description:"Two-gate, three-valued quality verdict against a pinned checklist (ADR-119)",factory:()=>import("./chunks/quality-gate-NAQLXE4C.js").then(e=>e.createQualityGateCommand(t,r,c))});o(n,{name:"security",description:"Security scanning and URL validation",factory:()=>import("./chunks/security-XSK2QHB3.js").then(e=>e.createSecurityCommand(t,r,c))});o(n,{name:"arena",description:"Competitive test-strategy tournaments (ADR-104)",factory:()=>import("./chunks/arena-UTC4YY6Y.js").then(e=>e.createArenaCommand(t,r,c))});o(n,{name:"code",description:"Code intelligence analysis",factory:()=>import("./chunks/code-AWNVOZ7S.js").then(e=>e.createCodeCommand(t,r,c))});o(n,{name:"completions",description:"Generate shell completions for aqe",factory:()=>import("./chunks/completions-WOJAM45W.js").then(e=>e.createCompletionsCommand(r))});o(n,{name:"upgrade",description:"Detect optional native bindings and recommend install / flag changes",factory:()=>import("./chunks/upgrade-VEW4FL23.js").then(e=>e.createUpgradeCommand(r))});o(n,{name:"fleet",description:"Fleet operations with multi-agent progress tracking",factory:()=>import("./chunks/fleet-4MUPHSF5.js").then(e=>e.createFleetCommand(t,r,c,C))});o(n,{name:"validate",description:"Validation commands for skills and agents",factory:()=>import("./chunks/validate-swarm-M2HXHZVC.js").then(e=>e.createValidateSwarmCommand(t,r,c))});o(n,{name:"skill",description:"Skill validation and reporting (ADR-056)",factory:()=>import("./chunks/validate-O3P6PF7B.js").then(e=>e.createValidateCommand(t,r,c))});o(n,{name:"eval",description:"Run skill evaluation suites in parallel",factory:()=>import("./chunks/eval-XYOA3EH2.js").then(e=>e.createEvalCommand())});o(n,{name:"ci",description:"CI/CD pipeline orchestration",factory:()=>import("./chunks/ci-RJH5LAL3.js").then(e=>e.createCICommand(t,r,c))});o(n,{name:"token-usage",description:"View and analyze token consumption metrics (ADR-042)",factory:()=>import("./chunks/token-usage-TLT6OXXR.js").then(e=>e.createTokenUsageCommand())});o(n,{name:"llm",description:"LLM Router management (ADR-043)",factory:()=>import("./chunks/llm-router-TB5OJPEV.js").then(e=>e.createLLMRouterCommand())});o(n,{name:"sync",description:"Sync local learning data to cloud PostgreSQL",factory:()=>import("./chunks/sync-7WAVNZGL.js").then(e=>e.createSyncCommands())});o(n,{name:"hooks",description:"Self-learning QE hooks for pattern recognition and guidance",factory:()=>import("./chunks/hooks-R2757K57.js").then(e=>e.createHooksCommand())});o(n,{name:"learning",description:"AQE self-learning system management (standalone, no claude-flow required)",factory:()=>import("./chunks/learning-UYXWAU5D.js").then(e=>e.createLearningCommand())});o(n,{name:"memory",description:"Memory store, retrieve, search, and delete operations",factory:()=>import("./chunks/memory-W3LG6H6N.js").then(e=>e.createMemoryCommand(t,r,c))});o(n,{name:"mcp",description:"Start the MCP protocol server for Claude Code integration",factory:()=>import("./chunks/mcp-UX7TK3XV.js").then(e=>e.createMcpCommand())});o(n,{name:"platform",description:"Manage coding agent platform configurations",factory:()=>import("./chunks/platform-KCGXTZO3.js").then(e=>e.createPlatformCommand())});o(n,{name:"prove",description:"Generate a verifiable Proof-of-Quality attestation",factory:()=>import("./chunks/prove-AYJCQYNI.js").then(e=>e.createProveCommand(t,r,c))});o(n,{name:"ruvector",description:"RuVector integration management",factory:()=>import("./chunks/ruvector-commands-NXCSUBN2.js").then(e=>e.createRuVectorCommand())});o(n,{name:"audit",description:"Witness chain audit trail management",factory:()=>import("./chunks/audit-L4RL2AOY.js").then(e=>e.createAuditCommand(t,r,c))});o(n,{name:"pipeline",description:"Manage YAML deterministic pipelines (Imp-9)",factory:()=>import("./chunks/pipeline-3F5RIESX.js").then(e=>e.createPipelineCommand(t,r,c))});o(n,{name:"plugin",description:"Manage external QE domain plugins",factory:()=>import("./chunks/plugin-2H552KOV.js").then(e=>e.createPluginCommand())});o(n,{name:"daemon",description:"Manage the QE Quality Daemon",factory:()=>import("./chunks/daemon-MSFN2LXY.js").then(e=>e.createDaemonCommand())});process.on("SIGINT",async()=>{console.log(m.yellow(`
|
|
10
10
|
|
|
11
11
|
Shutting down...`)),console.log(m.green(`Shutdown complete
|
|
12
12
|
`)),await r(0)});process.on("SIGTERM",async()=>{console.log(m.yellow(`
|
|
13
|
-
Received SIGTERM, shutting down gracefully...`)),await r(0)});async function
|
|
13
|
+
Received SIGTERM, shutting down gracefully...`)),await r(0)});async function x(){let{isVersionFastPath:e}=await import("./chunks/fast-paths-DKIYN2YS.js");e(process.argv)&&(console.log(v),process.exit(0));let{bootstrapTokenTracking:i}=await import("./chunks/token-bootstrap-VA7T4P42.js");await i({enableOptimization:!0,enablePersistence:!0,verbose:process.env.AQE_VERBOSE==="true"}),await n.parseAsync(),await r(0)}x().catch(async e=>{console.error(m.red("Fatal error:"),e),await r(1)});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.0");process.exit(0)}
|
|
2
|
+
import{a,b,c}from"./chunk-WJYTLRA5.js";import"./chunk-IKVNYK7Y.js";import"./chunk-OHSVDMF7.js";import"./chunk-K5SN66B4.js";import"./chunk-RHC7TFPU.js";import"./chunk-3AFNXU45.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
|
|
@@ -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 x}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 x}from"./chunk-MDT3LIXS.js";import{c as f}from"./chunk-TJEJ4UVX.js";import"./chunk-3AFNXU45.js";x();import{createRequire as w}from"module";var S=f.create("agent-booster-wasm"),t={JavaScript:0,TypeScript:1,Python:2,Rust:3,Go:4,Java:5,C:6,Cpp:7},l={ExactReplace:0,FuzzyReplace:1,InsertAfter:2,InsertBefore:3,Append:4},v={0:"JavaScript",1:"TypeScript",2:"Python",3:"Rust",4:"Go",5:"Java",6:"C",7:"Cpp"},a=null,u=null,p=null;async function g(){if(a)return!0;if(p)return!1;try{if(a=w(import.meta.url)("./agent_booster_wasm.js"),!a)throw new Error("WASM module loaded but is null");return u=new a.AgentBoosterWasm,!0}catch(e){return p=e,console.warn("[AgentBoosterWASM] Failed to load WASM module:",e),!1}}function A(e){return{".js":t.JavaScript,".mjs":t.JavaScript,".cjs":t.JavaScript,".jsx":t.JavaScript,".ts":t.TypeScript,".tsx":t.TypeScript,".mts":t.TypeScript,".cts":t.TypeScript,".py":t.Python,".rs":t.Rust,".go":t.Go,".java":t.Java,".c":t.C,".h":t.C,".cpp":t.Cpp,".cc":t.Cpp,".cxx":t.Cpp,".hpp":t.Cpp}[e.toLowerCase()]??t.JavaScript}var M=[{name:"var-to-const",detect:(e,r)=>e.includes("var ")&&r.includes("const "),apply:(e,r)=>e.replace(/\bvar\s+/g,"const ")},{name:"var-to-let",detect:(e,r)=>e.includes("var ")&&r.includes("let "),apply:(e,r)=>e.replace(/\bvar\s+/g,"let ")},{name:"add-types-function",detect:(e,r)=>e.includes("function")&&!e.includes(":")&&r.includes(":"),apply:(e,r)=>r},{name:"async-wrapper",detect:(e,r)=>!e.includes("async")&&r.includes("async")&&r.includes("await"),apply:(e,r)=>r},{name:"try-catch-wrapper",detect:(e,r)=>!e.includes("try {")&&r.includes("try {"),apply:(e,r)=>r},{name:"null-check",detect:(e,r)=>!e.includes("if (!")&&!e.includes("if (!")&&(r.includes("if (!")||r.includes("?.")),apply:(e,r)=>r},{name:"test-assertion",detect:(e,r)=>e.includes("test(")&&!e.includes("expect(")&&r.includes("expect("),apply:(e,r)=>r}];function y(e,r){for(let n of M)if(n.detect(e,r))try{return{success:!0,code:n.apply(e,r),pattern:n.name}}catch(s){S.debug("Pattern transform failed, trying next",{pattern:n.name,error:s instanceof Error?s.message:String(s)});continue}return{success:!1,code:r}}async function b(e,r,n,s={}){let o=performance.now(),{confidenceThreshold:T=.5,allowFallback:d=!0}=s;if(!e.trim())return{success:!0,mergedCode:r,confidence:1,strategy:l.Append,syntaxValid:!0,source:"fallback",latencyMs:performance.now()-o};if(await g()&&u&&a)try{let c=a.WasmLanguage[v[n]],i=u.apply_edit(e,r,c);return{success:!0,mergedCode:i.merged_code,confidence:i.confidence,strategy:i.strategy,syntaxValid:i.syntax_valid,source:"wasm",latencyMs:performance.now()-o}}catch(c){let i=c;if(d){let m=y(e,r);if(m.success)return{success:!0,mergedCode:m.code,confidence:.7,strategy:l.FuzzyReplace,syntaxValid:!0,source:"pattern",latencyMs:performance.now()-o}}return{success:!1,mergedCode:r,confidence:0,strategy:l.Append,syntaxValid:!1,source:"fallback",latencyMs:performance.now()-o,error:i.message}}if(d){let c=y(e,r);return{success:c.success,mergedCode:c.code,confidence:c.success?.7:0,strategy:l.FuzzyReplace,syntaxValid:!0,source:"pattern",latencyMs:performance.now()-o}}return{success:!1,mergedCode:r,confidence:0,strategy:l.Append,syntaxValid:!1,source:"fallback",latencyMs:performance.now()-o,error:p?.message??"WASM not available"}}async function W(e,r={}){return Promise.all(e.map(({original:n,edit:s,language:o})=>b(n,s,o,r)))}async function C(){return g()}async function L(){return await g()&&a?a.AgentBoosterWasm.version():"unavailable"}async function R(){if(await g(),u&&a)try{u.apply_edit("function x() {}","function x() {}",a.WasmLanguage.JavaScript)}catch(e){console.debug("[AgentBoosterWASM] Warmup error:",e instanceof Error?e.message:e)}}var _={transform:b,batchTransform:W,isWasmAvailable:C,getVersion:L,warmup:R,Language:t,MergeStrategy:l,languageFromExtension:A};export{t as Language,l as MergeStrategy,W as batchTransform,_ as default,L as getVersion,C as isWasmAvailable,A as languageFromExtension,b as transform,R as warmup};
|
|
@@ -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{b 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 p}from"./chunk-P52YORQG.js";import{a as g}from"./chunk-MBF3Q7FQ.js";import"./chunk-K5SN66B4.js";import"./chunk-3AFNXU45.js";import s from"chalk";var l=class{name="agent";description="Manage QE agents";cleanupAndExit;ensureInitialized;constructor(n,t){this.cleanupAndExit=n,this.ensureInitialized=t}register(n,t){let a=n.command("agent").description(this.description);a.command("list").description("List all agents").option("-d, --domain <domain>","Filter by domain").option("-s, --status <status>","Filter by status").action(async e=>{await this.executeList(e,t)}),a.command("spawn <domain>").description("Spawn an agent in a domain").option("-t, --type <type>","Agent type","worker").option("-c, --capabilities <caps>","Comma-separated capabilities","general").option("--no-progress","Disable progress indicator").action(async(e,o)=>{await this.executeSpawn(e,o,t)})}async executeList(n,t){if(await this.ensureInitialized())try{let a=n.domain?t.queen.getAgentsByDomain(n.domain):t.queen.listAllAgents();if(n.status&&(a=a.filter(e=>e.status===n.status)),console.log(s.blue(`
|
|
3
3
|
Agents (${a.length})
|
|
4
4
|
`)),a.length===0)console.log(s.gray(" No agents found"));else{let e=new Map;for(let i of a)e.has(i.domain)||e.set(i.domain,[]),e.get(i.domain).push(i);let o=Array.from(e.entries());for(let[i,m]of o){console.log(s.cyan(` ${i}:`));for(let r of m)console.log(` ${r.id}`),console.log(` Type: ${r.type}`),console.log(` Status: ${g(r.status)}`),r.startedAt&&console.log(s.gray(` Started: ${r.startedAt.toISOString()}`));console.log("")}}}catch(a){console.error(s.red(`
|
|
5
5
|
Failed to list agents:`),a),await this.cleanupAndExit(1)}}async executeSpawn(n,t,a){if(await this.ensureInitialized())try{let e=t.capabilities.split(",");console.log(s.blue(`
|
|
@@ -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"./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"./chunk-3AFNXU45.js";import{existsSync as i,mkdirSync as d,unlinkSync as s,readdirSync as p,statSync as f}from"fs";import{join as o,basename as l}from"path";var v={branchDir:".agentic-qe/branches",defaultStrategy:"child-wins",orphanMaxAgeMs:36e5},g=class{config;parentAdapter;activeBranches=new Map;witnessChain=null;constructor(t,e){this.parentAdapter=t,this.config={...v,...e}}setWitnessChain(t){this.witnessChain=t}createBranch(t){if(this.activeBranches.has(t))throw new Error(`Branch already exists for agent ${t}`);i(this.config.branchDir)||d(this.config.branchDir,{recursive:!0});let e=o(this.config.branchDir,`${t}.rvf`),r=this.parentAdapter.path(),n=this.parentAdapter.derive(e),a={agentId:t,childPath:e,parentPath:r,childAdapter:n,createdAt:Date.now(),ingestLog:[]};return this.activeBranches.set(t,a),a}recordIngest(t,e){let r=this.activeBranches.get(t);if(r)for(let n of e)r.ingestLog.push({id:n.id,vector:n.vector})}async mergeBranch(t,e){let r=e??this.config.defaultStrategy,n=performance.now(),a=0;if(r==="child-wins"&&t.ingestLog.length>0)try{a=this.parentAdapter.ingest(t.ingestLog).accepted}catch(c){console.warn(`[AgentMemoryBranch] Merge replay failed for ${t.agentId}:`,c)}return this.witnessChain?.append("BRANCH_MERGE",{agentId:t.agentId,strategy:r,vectorsMerged:a,branchPath:t.childPath},`agent-${t.agentId}`),this.cleanupBranchFile(t),this.activeBranches.delete(t.agentId),{vectorsMerged:a,strategy:r,durationMs:performance.now()-n}}discardBranch(t){this.witnessChain?.append("BRANCH_DISCARD",{agentId:t.agentId,action:"discard",branchPath:t.childPath},`agent-${t.agentId}`),this.cleanupBranchFile(t),this.activeBranches.delete(t.agentId)}getBranch(t){return this.activeBranches.get(t)}getActiveBranches(){return Array.from(this.activeBranches.values())}listBranchFiles(){return i(this.config.branchDir)?p(this.config.branchDir).filter(e=>e.endsWith(".rvf")).map(e=>{let r=o(this.config.branchDir,e),n=f(r);return{agentId:l(e,".rvf"),path:r,sizeBytes:n.size,modifiedAt:n.mtime}}):[]}cleanupOrphans(t){let e=t??this.config.orphanMaxAgeMs,r=Date.now(),n=0;for(let a of this.listBranchFiles())if(r-a.modifiedAt.getTime()>e&&!this.activeBranches.has(a.agentId))try{s(a.path);let h=`${a.path}.idmap.json`;i(h)&&s(h),n++}catch{}return n}cleanupBranchFile(t){try{t.childAdapter.close()}catch{}try{i(t.childPath)&&s(t.childPath);let e=`${t.childPath}.idmap.json`;i(e)&&s(e)}catch{}}};export{g as AgentMemoryBranch};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.0");process.exit(0)}
|
|
2
|
+
import{a,b,c,d,e,f}from"./chunk-O3C5RRDQ.js";import"./chunk-G6RKUEGL.js";import"./chunk-GCF42L7M.js";import"./chunk-5YGESYBC.js";import"./chunk-5VBPIJUZ.js";import"./chunk-KDLYTJ5C.js";import"./chunk-36MPDANH.js";import"./chunk-VMP4M5PB.js";import"./chunk-WT4ZDDFM.js";import"./chunk-FI5SSLEF.js";import"./chunk-NW7G57NR.js";import"./chunk-XEYW3V5I.js";import"./chunk-CC5G3K4X.js";import"./chunk-Z3W3R4CW.js";import"./chunk-VZ67ZDB3.js";import"./chunk-C4SZSPXY.js";import"./chunk-SSXAW3ER.js";import"./chunk-MDT3LIXS.js";import"./chunk-TJEJ4UVX.js";import"./chunk-L5ZLOW3K.js";import"./chunk-K5SN66B4.js";import"./chunk-BB4OVXWF.js";import"./chunk-PT3FTGKZ.js";import"./chunk-GGMQOEZZ.js";import"./chunk-W2OMW6UU.js";import"./chunk-7ZIVDGSN.js";import"./chunk-RHC7TFPU.js";import"./chunk-6JNNZGI2.js";import"./chunk-UVVKFBF7.js";import"./chunk-YKOTOCO6.js";import"./chunk-FZIHOMGY.js";import"./chunk-KJWQ7ENF.js";import"./chunk-V2MD5EDD.js";import"./chunk-64M3FFM4.js";import"./chunk-AEX75YGI.js";import"./chunk-27JCWG5J.js";import"./chunk-2KHDGC7N.js";import"./chunk-3AFNXU45.js";export{b as AQELearningEngine,a as DEFAULT_ENGINE_CONFIG,c as DEFAULT_META_LEARNING_CONFIG,d as MetaLearningEngine,e as createAQELearningEngine,f as createDefaultLearningEngine};
|
|
@@ -1,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 c,c as f}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.0");process.exit(0)}
|
|
2
|
+
import{a as c,c as f}from"./chunk-RHC7TFPU.js";import"./chunk-3AFNXU45.js";f();import{Command as $}from"commander";import r from"chalk";function x(v,g,p){let m=new $("arena").description("Competitive test-strategy tournaments (ADR-104)").addHelpText("after",`
|
|
3
3
|
Examples:
|
|
4
4
|
# Run a 4-strategy tournament against the demo fixture (reproducible under --seed)
|
|
5
5
|
aqe arena run --strategies 4 --target fixtures/arena-demo --seed 42
|
|
@@ -9,10 +9,10 @@ Examples:
|
|
|
9
9
|
|
|
10
10
|
# List persisted runs
|
|
11
11
|
aqe arena list
|
|
12
|
-
`);return m.command("run").description("Run a seeded strategy tournament against an arena fixture").requiredOption("--target <dir>","Arena fixture directory (src/*.mjs + tests/*.test.mjs)").option("--strategies <n>","Number of strategies","4").option("--seed <n>","RNG seed (same seed = same tournament)","42").option("--max-mutants <n>","Mutant sample cap","24").option("--evolve <steps>","Hill-climb steps from the winner","0").option("--json","Output the full arena-result@1 envelope as JSON").action(async a=>{try{let{runArena:i}=await import("./arena-
|
|
12
|
+
`);return m.command("run").description("Run a seeded strategy tournament against an arena fixture").requiredOption("--target <dir>","Arena fixture directory (src/*.mjs + tests/*.test.mjs)").option("--strategies <n>","Number of strategies","4").option("--seed <n>","RNG seed (same seed = same tournament)","42").option("--max-mutants <n>","Mutant sample cap","24").option("--evolve <steps>","Hill-climb steps from the winner","0").option("--json","Output the full arena-result@1 envelope as JSON").action(async a=>{try{let{runArena:i}=await import("./arena-Y3XTX6O7.js"),t=i({target:a.target,strategies:parseInt(a.strategies,10),seed:parseInt(a.seed,10),maxMutants:parseInt(a.maxMutants,10),evolveSteps:parseInt(a.evolve,10),log:a.json?()=>{}:e=>console.error(r.dim(` ${e}`))});try{let{getUnifiedMemory:e}=await import("./unified-memory-A5BS3LGX.js"),s=e();s.isInitialized()||await s.initialize(),s.getDatabase().prepare("INSERT OR REPLACE INTO kv_store (namespace, key, value) VALUES ('arena', ?, ?)").run(`run:${t.seed}:${t.target}`,JSON.stringify(t))}catch(e){console.error(r.dim(` note: run not persisted (${c(e)})`))}if(a.json){console.log(JSON.stringify(t,null,2));return}let d=new Map(t.strategies.map(e=>[e.id,e]));console.log(r.blue(`
|
|
13
13
|
Arena: ${t.target} \xB7 seed ${t.seed} \xB7 ${t.mutantsTotal} mutants
|
|
14
14
|
`)),console.log(" rank id kill-rate coverage cost fitness groups"),t.ranking.forEach((e,s)=>{let n=d.get(e),u=n.coveragePct===null?" n/a":`${n.coveragePct.toFixed(2)}%`.padStart(7);console.log(` ${String(s+1).padEnd(5)}${n.id.padEnd(5)}${(n.killRate*100).toFixed(1).padStart(6)}% ${u} ${n.suiteCostRatio.toFixed(2).padEnd(6)}${n.fitness.toFixed(4).padEnd(9)}${n.name}`+(n.baselinePassed?"":r.red(" [baseline FAILED]")))}),console.log(`
|
|
15
15
|
competitive array (row beats column = 1):`);let o=t.strategies.map(e=>e.id);if(console.log(` ${o.map(e=>e.padEnd(4)).join("")}`),t.competitiveArray.forEach((e,s)=>{console.log(` ${o[s].padEnd(4)}${e.map(n=>String(n).padStart(2).padEnd(4)).join("")}`)}),t.evolution.length>0){console.log(`
|
|
16
16
|
evolution:`);for(let e of t.evolution)console.log(` step ${e.step}: [${e.groups.join("+")}] fitness ${e.fitness.toFixed(4)} ${e.accepted?r.green("accepted"):"rejected"}`)}let l=d.get(t.ranking[0]);console.log(r.green(`
|
|
17
17
|
winner: ${l.id} [${l.name}] \u2014 kill ${(l.killRate*100).toFixed(1)}%, fitness ${l.fitness.toFixed(4)}
|
|
18
|
-
`))}catch(i){console.error(r.red(` \u2717 ${c(i)}`)),await g(1)}}),m.command("list").description("List persisted arena runs").option("--json","Output as JSON").action(async a=>{if(await p())try{let{getUnifiedMemory:i}=await import("./unified-memory-
|
|
18
|
+
`))}catch(i){console.error(r.red(` \u2717 ${c(i)}`)),await g(1)}}),m.command("list").description("List persisted arena runs").option("--json","Output as JSON").action(async a=>{if(await p())try{let{getUnifiedMemory:i}=await import("./unified-memory-A5BS3LGX.js"),t=i();t.isInitialized()||await t.initialize();let d=t.getDatabase().prepare("SELECT key, value FROM kv_store WHERE namespace = 'arena' ORDER BY key").all();if(a.json){console.log(JSON.stringify(d.map(o=>({key:o.key,result:JSON.parse(o.value)})),null,2));return}if(d.length===0){console.log(r.yellow(" no persisted arena runs"));return}for(let o of d){let l=JSON.parse(o.value),e=l.strategies.find(s=>s.id===l.ranking[0]);console.log(` ${r.green(o.key)} \u2014 winner ${e?.id} [${e?.name}] fitness ${e?.fitness}`)}}catch(i){console.error(r.red(` \u2717 ${c(i)}`)),await g(1)}}),m}export{x as createArenaCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import"./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"./chunk-3AFNXU45.js";import*as K from"fs";import*as M from"path";function G(t){let r=t>>>0;return function(){r|=0,r=r+1831565813|0;let n=Math.imul(r^r>>>15,1|r);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function w(t,r){return Math.floor(t()*r)}var z=[["===","!=="],["!==","==="],["<=","<"],[">=",">"],["&&","||"],["||","&&"],["<","<="],[">",">="],["+","-"],["*","+"]];function H(t){let r=new Array(t.length).fill(!1),n=0,e="code";for(;n<t.length;){let s=t[n],i=t[n+1];e==="code"?(s==="'"?e="single":s==='"'?e="double":s==="`"?e="template":s==="/"&&i==="/"?e="line-comment":s==="/"&&i==="*"&&(e="block-comment"),e!=="code"&&(r[n]=!0)):(r[n]=!0,e==="single"&&s==="'"&&t[n-1]!=="\\"||e==="double"&&s==='"'&&t[n-1]!=="\\"||e==="template"&&s==="`"&&t[n-1]!=="\\"||e==="line-comment"&&s===`
|
|
3
3
|
`?e="code":e==="block-comment"&&s==="*"&&i==="/"&&(r[n+1]=!0,n++,e="code")),n++}return r}function E(t,r){let n=1;for(let e=0;e<r;e++)t[e]===`
|
|
4
4
|
`&&n++;return n}function A(t,r){let n=H(t),e=new Array(t.length).fill(!1),s=[];for(let[i,c]of z){let a=t.indexOf(i);for(;a!==-1;){let u=a+i.length,y=e.slice(a,u).some(Boolean),h=n.slice(a,u).some(Boolean),v=i===">"&&t[a-1]==="=",S=(i==="<"||i===">")&&(t[u]==="="||t[a-1]==="<"||t[a-1]===">");if(!y&&!h&&!v&&!S){for(let d=a;d<u;d++)e[d]=!0;s.push({id:`${r}:${E(t,a)}:${a}:${i}->${c}`,index:a,from:i,to:c,line:E(t,a)})}a=t.indexOf(i,a+1)}}return s.sort((i,c)=>i.index-c.index)}function W(t,r){return t.slice(0,r.index)+r.to+t.slice(r.index+r.from.length)}import*as m from"fs";import*as f from"path";import*as L from"os";import{spawnSync as J}from"child_process";function I(t){let r=f.resolve(t),n=f.join(r,"src"),e=f.join(r,"tests");if(!m.existsSync(n)||!m.existsSync(e))throw new Error(`not an arena fixture (expected src/ and tests/): ${r}`);let s=m.readdirSync(n).filter(c=>c.endsWith(".mjs")).sort().map(c=>f.join("src",c)),i={};for(let c of m.readdirSync(e).filter(a=>a.endsWith(".test.mjs")).sort())i[c.replace(".test.mjs","")]=f.join("tests",c);if(s.length===0||Object.keys(i).length===0)throw new Error(`fixture has no src/*.mjs or tests/*.test.mjs: ${r}`);return{root:r,sourceFiles:s,testGroups:i}}function T(t,r){let n=m.mkdtempSync(f.join(r,"arena-ws-"));m.mkdirSync(f.join(n,"src"),{recursive:!0}),m.mkdirSync(f.join(n,"tests"),{recursive:!0});for(let e of t.layout.sourceFiles){let s=t.mutatedFile&&t.mutatedFile.relPath===e?t.mutatedFile.content:m.readFileSync(f.join(t.layout.root,e),"utf8");m.writeFileSync(f.join(n,e),s)}for(let e of t.groups){let s=t.layout.testGroups[e];m.copyFileSync(f.join(t.layout.root,s),f.join(n,s))}return n}function $(t,r={}){let n=["--test"];r.coverage&&n.push("--experimental-test-coverage");let e=m.readdirSync(f.join(t,"tests")).filter(u=>u.endsWith(".test.mjs")).sort().map(u=>f.join("tests",u));n.push(...e);let s=process.hrtime.bigint(),i=J(process.execPath,n,{cwd:t,timeout:r.timeoutMs??12e4,encoding:"utf8"}),c=Number(process.hrtime.bigint()-s)/1e6,a=null;if(r.coverage){let u=/all files\s*\|\s*([\d.]+)/.exec(i.stdout??"");a=u?Number(u[1]):null}return{ok:i.status===0,durationMs:Math.round(c),coveragePct:a}}function N(){return m.mkdtempSync(f.join(L.tmpdir(),"qe-arena-"))}function B(t){m.rmSync(t,{recursive:!0,force:!0})}var k={kill:.6,coverage:.3,runtimePenalty:.1};function Q(t,r,n){let e=[...t].sort(),s=new Set([e.join("+")]),i=[{id:"s1",name:`all(${e.join("+")})`,groups:e}],c=0;for(;i.length<r&&c++<200;){let a=e.filter(()=>n()<.5);if(a.length===0)continue;let u=a.join("+");s.has(u)||(s.add(u),i.push({id:`s${i.length+1}`,name:u,groups:a}))}return i}function C(t,r,n){let e=r===null?0:r/100,s=k.kill*t+k.coverage*e-k.runtimePenalty*n;return Math.round(s*1e4)/1e4}function D(t,r,n,e){let s=T({layout:t,groups:r.groups},e),i=$(s,{coverage:!0});if(!i.ok)return{baselinePassed:!1,killed:0,total:0,coveragePct:i.coveragePct,runtimeMs:i.durationMs};let c=0,a=0;for(let u of n)for(let y of u.mutants){a++;let h=T({layout:t,groups:r.groups,mutatedFile:{relPath:u.relPath,content:W(u.source,y)}},e);$(h).ok||c++}return{baselinePassed:!0,killed:c,total:a,coveragePct:i.coveragePct,runtimeMs:i.durationMs}}function rt(t){let r=t.seed??42,n=t.log??(()=>{}),e=G(r),s=I(t.target),i=N();try{let c=t.maxMutants??24,a=s.sourceFiles.map(l=>{let o=K.readFileSync(M.join(s.root,l),"utf8");return{relPath:l,source:o,mutants:A(o,l)}}),u=a.flatMap(l=>l.mutants.map(o=>({file:l.relPath,m:o})));if(u.length>c){let l=new Set;for(;l.size<c;)l.add(u[w(e,u.length)].m.id);for(let o of a)o.mutants=o.mutants.filter(p=>l.has(p.id));u=a.flatMap(o=>o.mutants.map(p=>({file:o.relPath,m:p})))}n(`mutants: ${u.length} (of ${a.reduce((l,o)=>l+A(o.source,o.relPath).length,0)} enumerated)`);let y=Q(Object.keys(s.testGroups),t.strategies??4,e),h={},v=y.map(l=>{n(`evaluating ${l.id} [${l.name}] ...`);let o=D(s,l,a,i);return h[l.id]=o.runtimeMs,{s:l,e:o}}),S=Object.keys(s.testGroups).length,d=v.map(({s:l,e:o})=>{let p=o.total>0?Math.round(o.killed/o.total*1e4)/1e4:0,g=Math.round(l.groups.length/S*1e4)/1e4;return{...l,baselinePassed:o.baselinePassed,mutantsKilled:o.killed,mutantsTotal:o.total,killRate:p,coveragePct:o.coveragePct,suiteCostRatio:g,fitness:o.baselinePassed?C(p,o.coveragePct,g):0}}),P=[...d].sort((l,o)=>o.fitness-l.fitness||l.id.localeCompare(o.id)).map(l=>l.id),U=d.map(l=>d.map(o=>l.fitness>o.fitness?1:l.fitness<o.fitness?-1:0)),j=[];if(t.evolveSteps&&t.evolveSteps>0){let l=Object.keys(s.testGroups).sort(),o=d.find(g=>g.id===P[0]).groups,p=d.find(g=>g.id===P[0]).fitness;for(let g=1;g<=t.evolveSteps;g++){let R=l[w(e,l.length)],b=o.includes(R)?o.filter(q=>q!==R):[...o,R].sort();if(b.length===0){j.push({step:g,groups:b,fitness:0,accepted:!1});continue}let x=D(s,{id:`evo${g}`,name:b.join("+"),groups:b},a,i),_=x.total>0?x.killed/x.total:0,F=x.baselinePassed?C(_,x.coveragePct,b.length/l.length):0,O=F>p;j.push({step:g,groups:b,fitness:F,accepted:O}),O&&(o=b,p=F)}}return{contract:"arena-result@1",seed:r,target:M.relative(process.cwd(),s.root)||".",weights:{...k},mutantsTotal:u.length,strategies:d,ranking:P,competitiveArray:U,evolution:j,informational:{runtimesMs:h}}}finally{B(i)}}export{Q as buildStrategies,rt as runArena};
|
|
@@ -0,0 +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.12.0");process.exit(0)}
|
|
2
|
+
import{d as f,e as g,f as m,g as y}from"./chunk-KN5GOEYK.js";import{m as L}from"./chunk-C4SZSPXY.js";import"./chunk-SSXAW3ER.js";import"./chunk-MDT3LIXS.js";import"./chunk-TJEJ4UVX.js";import{b as l}from"./chunk-L5ZLOW3K.js";import"./chunk-K5SN66B4.js";import"./chunk-W2OMW6UU.js";import"./chunk-RHC7TFPU.js";import"./chunk-UVVKFBF7.js";import{p as E,q as w}from"./chunk-YKOTOCO6.js";import"./chunk-FZIHOMGY.js";import"./chunk-KJWQ7ENF.js";import"./chunk-V2MD5EDD.js";import"./chunk-64M3FFM4.js";import"./chunk-AEX75YGI.js";import"./chunk-27JCWG5J.js";import"./chunk-2KHDGC7N.js";import{g as v}from"./chunk-3AFNXU45.js";import{Command as x}from"commander";import c from"chalk";L();import{existsSync as p}from"node:fs";import b from"node:path";function C(n,i){let e=[];e.push(c.bold("Witness Chain Audit Verification")),e.push("");let t=i?c.green("ENABLED"):c.yellow("DISABLED");e.push(` Feature Flag: ${t}`),e.push(` Chain Length: ${n.length} receipts`);let r=n.valid?c.green("VALID"):c.red("BROKEN");return e.push(` Integrity: ${r}`),n.length>0&&e.push(` Last Hash: ${n.lastHash.slice(0,16)}...`),!n.valid&&n.brokenAt>=0&&(e.push(""),e.push(c.red(` Break detected at index ${n.brokenAt}`)),e.push(c.red(` ${n.message}`))),e.push(""),e.join(`
|
|
3
|
+
`)}function V(){try{let n=l(),i=b.join(n,".agentic-qe","memory.db");if(!p(i))return null;let e=(w(),v(E)),t=new e(i),r=f(t),s=m(r);return t.close(),s}catch{return null}}async function O(n){let i=y(),t=(V()??g()).verifyChain(),r={featureEnabled:i,chainLength:t.length,integrity:t.valid,brokenAt:t.brokenAt,lastHash:t.lastHash,message:t.message};return n.format==="json"?console.log(JSON.stringify(r,null,2)):console.log(C(t,i)),r}async function j(n){let{WitnessChain:i,hashWith:e,serializeEntry:t}=await import("./witness-chain-ZZAUAXDY.js"),r=l(),s=b.join(r,".agentic-qe","memory.db"),a;if(!p(s))a={featureEnabled:!0,chainLength:0,integrity:!0,brokenAt:-1,lastHash:"",message:`No database found at ${s} \u2014 nothing to verify`};else{let{default:A}=await import("./better-sqlite3-LRDXKYOJ.js"),h=new A(s,{readonly:!0});try{let d=new i(h);await d.initialize();let o=d.verify({includeArchive:!0,checkSignatures:!0}),u=h.prepare("SELECT * FROM witness_chain ORDER BY id DESC LIMIT 1").get(),k=u?e(u.hash_algo||"sha256",t(u)):"";a={featureEnabled:!0,chainLength:o.entriesChecked,integrity:o.valid,brokenAt:o.brokenAt??-1,lastHash:k,message:o.valid?`Audit chain verified: ${o.entriesChecked} entries checked, ${o.signatureFailures??0} signature failures`:`Audit chain BROKEN at id=${o.brokenAt} (${o.entriesChecked} entries checked before the break)`}}finally{h.close()}}return n.format==="json"?console.log(JSON.stringify(a,null,2)):console.log(C({valid:a.integrity,length:a.chainLength,brokenAt:a.brokenAt,lastHash:a.lastHash,message:a.message},a.featureEnabled)),a}function R(n,i,e){let t=new x("audit").description("Witness chain audit trail management");return t.command("verify").description("Verify witness chain integrity").option("-F, --format <format>","Output format (json|text)","text").option("-C, --chain <chain>","Which chain to verify: governance (29 decision receipts) or audit (full QE audit trail)","governance").action(async r=>{try{let s=r.format,a=r.chain==="audit"?await j({format:s}):await O({format:s});await i(a.integrity?0:1)}catch(s){console.error("Failed to verify witness chain:",s),await i(1)}}),t}export{R as createAuditCommand,C as formatVerificationText,j as handleAuditChainVerify,O as handleAuditVerify};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.0");process.exit(0)}
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-7WX3MKRS.js";import"./chunk-4SALW7OT.js";import"./chunk-C4SZSPXY.js";import"./chunk-SSXAW3ER.js";import"./chunk-MDT3LIXS.js";import"./chunk-TJEJ4UVX.js";import"./chunk-L5ZLOW3K.js";import"./chunk-K5SN66B4.js";import"./chunk-W2OMW6UU.js";import"./chunk-RHC7TFPU.js";import"./chunk-6JNNZGI2.js";import"./chunk-TJ6N4CCX.js";import"./chunk-UVVKFBF7.js";import"./chunk-YKOTOCO6.js";import"./chunk-FZIHOMGY.js";import"./chunk-KJWQ7ENF.js";import"./chunk-V2MD5EDD.js";import"./chunk-64M3FFM4.js";import"./chunk-AEX75YGI.js";import"./chunk-27JCWG5J.js";import"./chunk-2KHDGC7N.js";import"./chunk-3AFNXU45.js";export{l as MCPToolBase,k as defaultToolLogger,j as getKernel,i as getLLMRouter,e as getMemoryBackend,g as getSharedLLMRouter,c as getSharedMemoryBackend,a as isMemoryOnlyMode,b as registerRvfResetFn,h as resetSharedLLMRouter,d as resetSharedMemoryBackend,f as setSharedLLMRouter};
|
|
@@ -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,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q 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{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q as p}from"./chunk-YKOTOCO6.js";import"./chunk-3AFNXU45.js";p();export{i as DotProductAttention,h as FlashAttention,k as HyperbolicAttention,l as LinearAttention,m as MoEAttention,j as MultiHeadAttention,b as RuvectorLayer,n as SonaEngine,c as TensorCompress,a as default,d as differentiableSearch,f as getCompressionLevel,e as hierarchicalForward,g as init,o as pipeline};
|
|
@@ -0,0 +1,89 @@
|
|
|
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 A,b as L,c as F,d as R,e as Y,f as T,g as P,h as C,i as j,j as X,k as V,l as ye,m as $,n as Z,o as be,p as _,q as J,r as U,s as W}from"./chunk-6X3RJBA3.js";import{h as ge}from"./chunk-NW7G57NR.js";import{b as pe}from"./chunk-XEYW3V5I.js";import"./chunk-C4SZSPXY.js";import"./chunk-SSXAW3ER.js";import"./chunk-MDT3LIXS.js";import"./chunk-TJEJ4UVX.js";import"./chunk-L5ZLOW3K.js";import{b as x,d as Q}from"./chunk-K5SN66B4.js";import{a as fe,b as me,c as ue,d as k,f as ze}from"./chunk-PT3FTGKZ.js";import"./chunk-W2OMW6UU.js";import"./chunk-RHC7TFPU.js";import{a as O,b as We}from"./chunk-UVVKFBF7.js";import"./chunk-YKOTOCO6.js";import"./chunk-FZIHOMGY.js";import"./chunk-KJWQ7ENF.js";import"./chunk-V2MD5EDD.js";import"./chunk-64M3FFM4.js";import"./chunk-AEX75YGI.js";import"./chunk-27JCWG5J.js";import"./chunk-2KHDGC7N.js";import"./chunk-3AFNXU45.js";import B from"path";import o from"chalk";We();Q();import{existsSync as z,mkdirSync as He,writeFileSync as Ke,readFileSync as ee}from"fs";import{join as E,resolve as ne}from"path";var Ge={rl_q_values:"includeQValues",dream_insights:"includeDreamInsights",dream_cycles:"includeDreamInsights",witness_chain:"includeWitnessChain",vectors:"includeVectors"};function Qe(e,n){let r=Ge[e.tableName];return!(r&&n[r]===!1)}var Ye=1e4;function Xe(e,n,r,t){if(!Qe(n,r))return Z(E(t,n.fileName),[]),{count:0,rows:[]};let[a,s]=n.domainColumn?$(r.domains,n.domainColumn):[void 0,[]];if(X(e,n.tableName,a,s)>=Ye){let d=n.blobColumns,c=d&&d.length>0?p=>T(p,d):void 0;return{count:be(E(t,n.fileName),ye(e,n.tableName,a,s),c)}}let i=V(e,n.tableName,a,s);return n.blobColumns&&n.blobColumns.length>0&&(i=i.map(d=>T(d,n.blobColumns))),Z(E(t,n.fileName),i),{count:i.length,rows:i}}function he(e){let n=[];for(let r of R){let t=E(e,r.fileName);z(t)?n.push(C(ee(t,"utf-8"))):n.push(C(""))}return C(n.join(":"))}function we(e,n,r="memory.db"){let t=ne(n.outputPath);z(t)||He(t,{recursive:!0});let a=0,s={},l=new Set;for(let u of R){let p=Xe(e,u,n,t);if(s[u.tableName]=p.count,a+=p.count,u.tableName==="qe_patterns"){if(p.rows)for(let f of p.rows)f.qe_domain&&l.add(f.qe_domain);else if(p.count>0){let[f,w]=u.domainColumn?$(n.domains,u.domainColumn):[void 0,[]],y=`SELECT DISTINCT qe_domain FROM qe_patterns ${f?`WHERE ${f} AND qe_domain IS NOT NULL`:"WHERE qe_domain IS NOT NULL"}`;try{let g=e.prepare(y).all(...w||[]);for(let v of g)l.add(v.qe_domain)}catch{}}}}let i=n.includeVectors!==!1?X(e,"vectors"):0,d=he(t),c={version:"3.0",exportedAt:new Date().toISOString(),sourceDb:r,stats:{patternCount:s.qe_patterns||0,vectorCount:i,qValueCount:s.rl_q_values||0,dreamInsightCount:s.dream_insights||0,witnessChainLength:s.witness_chain||0,totalRecords:a},domains:[...l].sort(),checksum:d,tableRecordCounts:s};return Ke(E(t,"manifest.json"),JSON.stringify(c,null,2),"utf-8"),c}var Ze=new Set(["qe_patterns","rl_q_values","dream_insights","witness_chain"]);function en(e){return e==="1.0"?R.filter(n=>Ze.has(n.tableName)):e==="3.0"?R:(console.warn(`[brain-import] Unknown manifest version '${e}'. Attempting full import \u2014 some files may be missing.`),R)}function ve(e,n,r){let t=ne(n),a=E(t,"manifest.json");if(!z(a))throw new Error(`Manifest not found at ${a}`);let s=x(ee(a,"utf-8")),l=he(t);if(l!==s.checksum)throw new Error(`Checksum mismatch: expected ${s.checksum}, got ${l}. The export may have been tampered with or corrupted.`);let i=en(s.version);if(r.dryRun){let f=0;for(let w of i){let m=_(E(t,w.fileName),x);f+=m.length}return{imported:f,skipped:0,conflicts:0}}W(e);let d=0,c=0,u=0;return e.transaction(()=>{for(let f of i){let w=E(t,f.fileName),m=_(w,x);f.blobColumns&&f.blobColumns.length>0&&(m=m.map(y=>P(y,f.blobColumns)));for(let y of m){let g;if(f.dedupColumns&&f.dedupColumns.length>0)g=U(e,f.tableName,y,f.dedupColumns);else{let v=A[f.tableName]||"id",b=F[f.tableName],I=L[f.tableName];g=J(e,f.tableName,y,v,r.mergeStrategy,b,I)}d+=g.imported,c+=g.skipped,u+=g.conflicts}}})(),{imported:d,skipped:c,conflicts:u}}function Re(e){let n=ne(e),r=E(n,"manifest.json");if(!z(r))throw new Error(`Manifest not found at ${r}`);return x(ee(r,"utf-8"))}ze();import{existsSync as H,statSync as nn,unlinkSync as Se,writeFileSync as tn}from"fs";import{resolve as te}from"path";function xe(e,n,r="memory.db"){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use --format jsonl instead.");let t=te(n.outputPath),a=n.dimension??384;H(t)&&Se(t);let s=`${t}.idmap.json`;H(s)&&Se(s);let l=fe(t,a);try{let i={},d=new Set,c=0;for(let S of R){let[h,ce]=S.domainColumn?$(n.domains,S.domainColumn):[void 0,[]],D=V(e,S.tableName,h,ce);if(S.tableName==="qe_patterns")for(let q of D)q.qe_domain&&d.add(q.qe_domain);let G=Y[S.tableName];G&&G.length>0&&(D=D.map(q=>T(q,G))),i[S.tableName]=D,c+=D.length}let u=0,p=[];if(j(e,"qe_pattern_embeddings")){let S=e.prepare("SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings").all();for(let h of S)h.embedding&&h.dimension===a&&p.push({id:`pe:${h.pattern_id}`,vector:new Float32Array(h.embedding.buffer,h.embedding.byteOffset,a),metadata:{tableName:"qe_pattern_embeddings"}})}if(j(e,"captured_experiences")){let S=e.prepare("SELECT id, embedding, embedding_dimension, domain, quality FROM captured_experiences WHERE embedding IS NOT NULL").all();for(let h of S)h.embedding_dimension===a&&p.push({id:`exp:${h.id}`,vector:new Float32Array(h.embedding.buffer,h.embedding.byteOffset,a),metadata:{tableName:"captured_experiences",domain:h.domain,confidence:h.quality}})}if(j(e,"sona_patterns")){let S=e.prepare("SELECT id, state_embedding, domain, confidence FROM sona_patterns WHERE state_embedding IS NOT NULL").all();for(let h of S)h.state_embedding.byteLength/4===a&&p.push({id:`sona:${h.id}`,vector:new Float32Array(h.state_embedding.buffer,h.state_embedding.byteOffset,a),metadata:{tableName:"sona_patterns",domain:h.domain,confidence:h.confidence}})}p.length>0&&(u=l.ingest(p).accepted);let f={version:"3.0",format:"rvf",exportedAt:new Date().toISOString(),sourceDb:r,domains:[...d].sort(),tables:i},w=JSON.stringify(f),m=C(w),y=Buffer.from(w);l.embedKernel(y);let g=n.sign?l.sign(y)??void 0:void 0,v=g?n.signerKeyId??"default":void 0,b=l.fileId(),I=b?{fileId:b,parentId:l.parentId(),lineageDepth:l.lineageDepth()}:void 0,N=l.status(),M={version:"3.0",format:"rvf",exportedAt:f.exportedAt,sourceDb:r,stats:{patternCount:(i.qe_patterns||[]).length,embeddingCount:u,qValueCount:(i.rl_q_values||[]).length,dreamInsightCount:(i.dream_insights||[]).length,witnessChainLength:(i.witness_chain||[]).length,totalRecords:c},domains:f.domains,checksum:m,rvfStatus:{totalVectors:N.totalVectors,totalSegments:N.totalSegments,fileSizeBytes:N.fileSizeBytes},...g?{signature:g,signerKeyId:v}:{},...I?{lineage:I}:{}};if(g)try{l.freeze()}catch{}let Ue=`${t}.manifest.json`;return tn(Ue,JSON.stringify(M,null,2),"utf-8"),M}finally{l.close()}}var rn={patterns:"qe_patterns",qValues:"rl_q_values",dreamInsights:"dream_insights",witnessChain:"witness_chain"};function Ce(e,n,r){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use JSONL format.");let t=te(n);if(!H(t))throw new Error(`RVF file not found: ${t}`);let a=me(t);try{let s=a.verifyWitness();if(!s.valid&&(s.totalEntries>0||s.errors.length>0)){let m=s.errors.length>0?s.errors.join("; "):"unknown integrity error";throw new Error(`RVF witness verification failed: ${m}`)}let l=a.extractKernel();if(!l||!l.image)throw new Error("No brain data found in RVF file (missing kernel segment)");let i;try{i=JSON.parse(l.image.toString("utf-8"))}catch(m){throw new Error(`Failed to parse brain kernel data as JSON: ${m instanceof Error?m.message:m}`)}if(r.dryRun){let m=0;if(i.tables)for(let y of Object.values(i.tables))m+=y?.length??0;else m=(i.patterns?.length??0)+(i.qValues?.length??0)+(i.dreamInsights?.length??0)+(i.witnessChain?.length??0);return{imported:m,skipped:0,conflicts:0,embeddingsRestored:0}}W(e);let d=0,c=0,u=0,p=0,f={};if(i.tables)Object.assign(f,i.tables);else for(let[m,y]of Object.entries(rn)){let g=i[m];Array.isArray(g)&&(f[y]=g)}if(e.transaction(()=>{for(let m of R){let y=f[m.tableName];if(!y||!Array.isArray(y))continue;let g=Y[m.tableName];if(g&&g.length>0){y=y.map(v=>P(v,g));for(let v of y)for(let b of g)v[b]instanceof Buffer&&p++}for(let v of y){let b;if(m.dedupColumns&&m.dedupColumns.length>0)b=U(e,m.tableName,v,m.dedupColumns);else{let I=A[m.tableName]||"id",N=F[m.tableName],M=L[m.tableName];b=J(e,m.tableName,v,I,r.mergeStrategy,N,M)}d+=b.imported,c+=b.skipped,u+=b.conflicts}}})(),u>0)try{a.compact()}catch{}return{imported:d,skipped:c,conflicts:u,embeddingsRestored:p}}finally{a.close()}}function K(e){if(!k())throw new Error("@ruvector/rvf-node is not available.");let n=te(e);if(!H(n))throw new Error(`RVF file not found: ${n}`);let r=ue(n);try{let t=r.extractKernel();if(!t||!t.image)throw new Error("No brain data found in RVF file");let a=t.image.toString("utf-8"),s;try{s=JSON.parse(a)}catch(w){throw new Error(`Failed to parse brain kernel data as JSON: ${w instanceof Error?w.message:w}`)}let l=r.status(),i=nn(n).size,d=s.tables,c=d?d.qe_patterns?.length??0:s.patterns?.length??0,u=d?d.rl_q_values?.length??0:s.qValues?.length??0,p=d?d.dream_insights?.length??0:s.dreamInsights?.length??0,f=d?d.witness_chain?.length??0:s.witnessChain?.length??0;return{version:"3.0",format:"rvf",exportedAt:s.exportedAt??"unknown",sourceDb:s.sourceDb??"unknown",stats:{patternCount:c,embeddingCount:l.totalVectors,qValueCount:u,dreamInsightCount:p,witnessChainLength:f},domains:s.domains??[],checksum:C(a),rvfStatus:{totalVectors:l.totalVectors,totalSegments:l.totalSegments,fileSizeBytes:i}}}finally{r.close()}}function re(){return k()}Q();import{existsSync as ae,readFileSync as on,statSync as an}from"fs";import{join as oe,resolve as Ee}from"path";function Oe(e,n,r={}){let t=Ee(e),a=Ee(n),s=Be(t),l=Be(a),i=_e(t,s),d=_e(a,l),c=s==="jsonl"&&l==="jsonl",u=dn({pathA:t,pathB:a,manifestA:i,manifestB:d,recordLevel:c,tableFilter:r.tableFilter,maxIdsPerBucket:r.maxIdsPerBucket??500}),p=new Set(i.domains),f=new Set(d.domains),w=i.domains.filter(b=>!f.has(b)),m=d.domains.filter(b=>!p.has(b)),y=i.checksum===d.checksum,g=i.version===d.version,v=y&&g&&u.every(b=>b.delta===0&&(b.added?.length??0)===0&&(b.removed?.length??0)===0&&(b.changed?.length??0)===0);return{pathA:t,pathB:a,formatA:s,formatB:l,manifestA:i,manifestB:d,checksumMatch:y,versionMatch:g,identical:v,recordLevel:c,tableDiffs:u,domainsOnlyInA:w,domainsOnlyInB:m}}function Be(e){if(!ae(e))throw new Error(`Path not found: ${e}`);if(e.endsWith(".rvf"))return"rvf";if(an(e).isFile())throw new Error(`Unsupported brain export: ${e} (expected a .rvf file or a JSONL directory)`);return"jsonl"}function _e(e,n){return n==="rvf"?ln(e):sn(e)}function sn(e){let n=oe(e,"manifest.json");if(!ae(n))throw new Error(`Manifest not found at ${n}`);let r=x(on(n,"utf-8"));return Ae(r,"jsonl")}function ln(e){let n=K(e);return Ae(n,"rvf")}function Ae(e,n){return{format:n,version:e.version??"unknown",exportedAt:e.exportedAt??"unknown",sourceDb:e.sourceDb??"unknown",checksum:e.checksum??"",totalRecords:e.stats?.totalRecords??0,domains:e.domains??[],tableRecordCounts:e.tableRecordCounts??{}}}function dn(e){let n=e.tableFilter?R.filter(t=>t.tableName===e.tableFilter):R;if(e.tableFilter&&n.length===0)throw new Error(`Unknown table: ${e.tableFilter}`);let r=[];for(let t of n){let a=e.manifestA.tableRecordCounts[t.tableName]??0,s=e.manifestB.tableRecordCounts[t.tableName]??0,l=s-a,i,d,c;if(e.recordLevel&&cn(t)){let u=fn(oe(e.pathA,t.fileName),oe(e.pathB,t.fileName),t,e.maxIdsPerBucket);i=u.added,d=u.removed,c=u.changed}r.push({tableName:t.tableName,countA:a,countB:s,delta:l,...i!==void 0?{added:i}:{},...d!==void 0?{removed:d}:{},...c!==void 0?{changed:c}:{}})}return r}function cn(e){return!0}function fn(e,n,r,t){let a=Ie(e,r),s=Ie(n,r),l=[],i=[],d=[];for(let[c,u]of a){let p=s.get(c);if(p===void 0)i.length<t&&i.push(c);else if(p!==u){if(r.dedupColumns&&r.dedupColumns.length>0)continue;d.length<t&&d.push(c)}}for(let c of s.keys())a.has(c)||l.length<t&&l.push(c);return l.sort(),i.sort(),d.sort(),{added:l,removed:i,changed:d}}function Ie(e,n){let r=new Map;if(!ae(e))return r;let t=_(e,x);for(let a of t){let s=mn(a,n);if(s===void 0)continue;let l=un(a);r.set(s,pn(l))}return r}function mn(e,n){if(n.dedupColumns&&n.dedupColumns.length>0){let a=[];for(let s of n.dedupColumns){let l=e[s];if(l==null)return;a.push(String(l))}return a.join("")}let r=A[n.tableName]??"id",t=e[r];if(t!=null)return String(t)}function un(e){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];return JSON.stringify(r)}function pn(e){return C(e)}Q();import{existsSync as ie,statSync as gn}from"fs";import{join as Ne,resolve as yn}from"path";var bn=20,hn="qe_patterns";function De(e,n={}){let r=yn(e);Rn(r);let t=n.table??hn,a=R.find(g=>g.tableName===t);if(!a)throw new Error(`Unknown table: ${t}`);let s=Ne(r,a.fileName);if(!ie(s))throw new Error(`Table file not found: ${a.fileName} (expected in ${r}). Was this export generated with --format jsonl?`);let l=_(s,x),i=a.domainColumn,d=Math.max(1,n.limit??bn),c=n.query?n.query.toLowerCase():void 0,u=n.domains&&n.domains.length>0?new Set(n.domains):void 0,p=n.since,f=n.until,w=n.patternType,m=0,y=[];for(let g of l)wn(g,{domainColumn:i,domains:u,patternType:w,since:p,until:f,queryLower:c})&&(m++,y.length<d&&y.push(vn(g,a.tableName,i)));return{table:t,inputPath:r,totalScanned:l.length,totalMatched:m,limit:d,hits:y,truncated:m>d}}function wn(e,n){if(n.domains){if(!n.domainColumn)return!1;let r=e[n.domainColumn];if(typeof r!="string"||!n.domains.has(r))return!1}if(n.patternType!==void 0&&e.pattern_type!==n.patternType)return!1;if(n.since!==void 0||n.until!==void 0){let r=ke(e);if(r===void 0||n.since!==void 0&&r<n.since||n.until!==void 0&&r>n.until)return!1}if(n.queryLower!==void 0){let r=typeof e.name=="string"?e.name.toLowerCase():"",t=typeof e.description=="string"?e.description.toLowerCase():"";if(!r.includes(n.queryLower)&&!t.includes(n.queryLower))return!1}return!0}function ke(e){for(let n of["updated_at","created_at","timestamp"]){let r=e[n];if(typeof r=="string"&&r.length>0)return r}}function vn(e,n,r){let t=(typeof e.id=="string"||typeof e.id=="number"?String(e.id):void 0)??`${n}:?`,a={name:typeof e.name=="string"?e.name:void 0,description:typeof e.description=="string"?e.description:void 0,domain:r&&typeof e[r]=="string"?e[r]:void 0,patternType:typeof e.pattern_type=="string"?e.pattern_type:void 0,confidence:typeof e.confidence=="number"?e.confidence:void 0,updatedAt:ke(e)};return{id:t,display:a,row:e}}function Rn(e){if(!ie(e))throw new Error(`Path not found: ${e}`);if(gn(e).isFile())throw e.endsWith(".rvf")?new Error("Brain search does not support RVF exports. Re-export with --format jsonl, or use `aqe brain info` for RVF summaries."):new Error(`Unsupported brain export: ${e} (expected a JSONL directory)`);let r=Ne(e,"manifest.json");if(!ie(r))throw new Error(`Manifest not found at ${r}. Is this a brain export directory?`)}function Te(e,n){if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_patterns'").get())return{created:0,skipped:0};e.exec(`
|
|
3
|
+
CREATE TEMP TABLE IF NOT EXISTS _covered_patterns (
|
|
4
|
+
pattern_id TEXT PRIMARY KEY
|
|
5
|
+
)
|
|
6
|
+
`),e.exec("DELETE FROM _covered_patterns"),e.exec(`
|
|
7
|
+
INSERT INTO _covered_patterns (pattern_id)
|
|
8
|
+
SELECT DISTINCT json_extract(action_data, '$.patternId')
|
|
9
|
+
FROM witness_chain
|
|
10
|
+
WHERE action_type = 'PATTERN_CREATE'
|
|
11
|
+
AND json_extract(action_data, '$.patternId') IS NOT NULL
|
|
12
|
+
`),e.exec(`
|
|
13
|
+
INSERT OR IGNORE INTO _covered_patterns (pattern_id)
|
|
14
|
+
SELECT DISTINCT json_extract(action_data, '$.pattern_id')
|
|
15
|
+
FROM witness_chain
|
|
16
|
+
WHERE action_type = 'PATTERN_CREATE'
|
|
17
|
+
AND json_extract(action_data, '$.pattern_id') IS NOT NULL
|
|
18
|
+
`);let t=e.prepare(`SELECT p.id, p.pattern_type, p.qe_domain, p.name, p.created_at
|
|
19
|
+
FROM qe_patterns p
|
|
20
|
+
LEFT JOIN _covered_patterns c ON p.id = c.pattern_id
|
|
21
|
+
WHERE c.pattern_id IS NULL
|
|
22
|
+
ORDER BY p.created_at ASC`).all(),s=e.prepare("SELECT COUNT(*) as count FROM qe_patterns").get().count-t.length,l=0;for(let i of t)n.append("PATTERN_CREATE",{patternId:i.id,patternType:i.pattern_type,qeDomain:i.qe_domain,name:i.name,originalCreatedAt:i.created_at,backfilled:!0},"system:backfill"),l++;return e.exec("DROP TABLE IF EXISTS _covered_patterns"),{created:l,skipped:s}}async function $e(e,n){if(Sn(n.format)==="rvf"){let a=O(e,{readonly:!0});try{return xe(a,{outputPath:n.outputPath,domains:n.domains},e)}finally{a.close()}}let t=O(e,{readonly:!0});try{return we(t,n,e)}finally{t.close()}}async function Me(e,n,r){if(je(n,r.format)==="rvf"){let s=O(e);try{return Ce(s,n,{mergeStrategy:r.mergeStrategy,dryRun:r.dryRun})}finally{s.close()}}let a=O(e);try{return ve(a,n,r)}finally{a.close()}}async function qe(e,n){return je(e,n)==="rvf"?K(e):Re(e)}async function Le(e,n,r={}){return Oe(e,n,r)}async function Fe(e,n={}){return De(e,n)}async function Pe(e){let n=O(e);try{let r=ge(n,pe());return await r.initialize(),Te(n,r)}finally{n.close()}}function Sn(e){if(e==="jsonl")return"jsonl";if(e==="rvf"){if(!re())throw new Error("RVF format requested but @ruvector/rvf-node is not available on this platform. Use --format jsonl instead.");return"rvf"}return re()?"rvf":"jsonl"}function je(e,n){return n==="rvf"?"rvf":n==="jsonl"?"jsonl":e.endsWith(".rvf")?"rvf":"jsonl"}var de=class{name="brain";description="Export, import, and inspect QE brain state";cleanupAndExit;ensureInitialized;constructor(n,r){this.cleanupAndExit=n,this.ensureInitialized=r}register(n,r){let t=n.command("brain").description(this.description);t.command("export").description("Export brain state to a portable directory").requiredOption("-o, --output <path>","Output directory path").option("--format <format>","Export format: rvf (default) or jsonl","rvf").option("--db <path>","Source database path").action(async a=>{await this.executeExport(a)}),t.command("import").description("Import brain state from an export directory").requiredOption("-i, --input <path>","Path to brain export directory").option("--strategy <strategy>","Merge strategy","skip-conflicts").option("--dry-run","Preview import without writing",!1).option("--db <path>","Target database path").action(async a=>{await this.executeImport(a)}),t.command("info").description("Show manifest info for a brain export").requiredOption("-i, --input <path>","Path to brain export directory").action(async a=>{await this.executeInfo(a)}),t.command("witness-backfill").description("Create witness chain entries for patterns that predate the witness chain").option("--db <path>","Database path").action(async a=>{await this.executeWitnessBackfill(a)}),t.command("diff").description("Compare two brain exports (JSONL directory or .rvf file)").argument("<a>","Path to first brain export").argument("<b>","Path to second brain export").option("--table <name>","Restrict comparison to a single table").option("--verbose","Show the IDs of added/removed/changed records",!1).option("--json","Emit the diff as JSON to stdout",!1).action(async(a,s,l)=>{await this.executeDiff(a,s,l)}),t.command("search").description("Search a JSONL brain export with filters").requiredOption("-i, --input <path>","Path to brain export directory (JSONL)").option("--table <name>","Table to search (default: qe_patterns)").option("--domain <name...>","Restrict to one or more domains").option("--pattern-type <type>","Restrict to a specific pattern_type (qe_patterns only)").option("--since <iso>","Include rows with timestamp \u2265 <iso>").option("--until <iso>","Include rows with timestamp \u2264 <iso>").option("-q, --query <text>","Substring match across name + description (case-insensitive)").option("-l, --limit <n>","Maximum results to return","20").option("--json","Emit results as JSON to stdout",!1).action(async a=>{await this.executeSearch(a)})}async executeExport(n){try{console.log(o.blue(`
|
|
23
|
+
Exporting brain state (format: ${n.format})...
|
|
24
|
+
`));let r=await se(n.db),t=await $e(r,{outputPath:B.resolve(n.output),format:n.format});if(console.log(o.green(" Export complete.")),console.log(` Format: ${o.cyan("format"in t?t.format??"jsonl":"jsonl")}`),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"embeddingCount"in t.stats?console.log(` Vectors: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`),"rvfStatus"in t){let a=t.rvfStatus;console.log(` RVF Size: ${o.cyan(Ve(a.fileSizeBytes))}`),console.log(` Segments: ${o.cyan(a.totalSegments)}`)}console.log(` Checksum: ${o.gray(t.checksum)}`),console.log(` Output: ${o.cyan(B.resolve(n.output))}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
25
|
+
Brain export failed:`),r),await this.cleanupAndExit(1)}}async executeImport(n){try{n.dryRun?console.log(o.yellow(`
|
|
26
|
+
Dry-run mode \u2014 no data will be written.
|
|
27
|
+
`)):console.log(o.blue(`
|
|
28
|
+
Importing brain state...
|
|
29
|
+
`));let r=await se(n.db),t=await Me(r,B.resolve(n.input),{mergeStrategy:n.strategy,dryRun:n.dryRun});console.log(o.green(" Import complete.")),console.log(` Imported: ${o.cyan(t.imported)}`),console.log(` Skipped: ${o.yellow(t.skipped)}`),console.log(` Conflicts: ${o.red(t.conflicts)}`),"embeddingsRestored"in t&&console.log(` Embeddings: ${o.cyan(t.embeddingsRestored)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
30
|
+
Brain import failed:`),r),await this.cleanupAndExit(1)}}async executeInfo(n){try{console.log(o.blue(`
|
|
31
|
+
Brain Export Info
|
|
32
|
+
`));let r=B.resolve(n.input),t=await qe(r),a="format"in t?t.format??"jsonl":"jsonl";if(console.log(` Version: ${o.cyan(t.version)}`),console.log(` Format: ${o.cyan(a)}`),console.log(` Exported: ${o.cyan(t.exportedAt)}`),console.log(` Source DB: ${o.cyan(t.sourceDb)}`),console.log(o.blue(`
|
|
33
|
+
Learning Data:`)),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"qValueCount"in t.stats&&console.log(` Q-Values: ${o.cyan(t.stats.qValueCount)}`),"dreamInsightCount"in t.stats){let i=t.stats.dreamInsightCount,c=("tableRecordCounts"in t?t.tableRecordCounts:void 0)?.dream_cycles,u=c!==void 0?` (${c} cycles)`:"";console.log(` Dream Insights: ${o.cyan(i)}${o.gray(u)}`)}"witnessChainLength"in t.stats&&console.log(` Witness Chain: ${o.cyan(t.stats.witnessChainLength)} entries`),"embeddingCount"in t.stats?console.log(` Embeddings: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`);let s="tableRecordCounts"in t?t.tableRecordCounts:void 0;if(s){let i=Object.entries(s).filter(([d,c])=>c>0&&!["qe_patterns","rl_q_values","dream_insights","dream_cycles","witness_chain","vectors","qe_pattern_embeddings"].includes(d));if(i.length>0)for(let[d,c]of i){let p=`${d.replace(/_/g," ").replace(/\b\w/g,f=>f.toUpperCase())}:`.padEnd(15);console.log(` ${p}${o.cyan(c)}`)}}let l="totalRecords"in t.stats?t.stats.totalRecords:void 0;if(l!==void 0&&(console.log(o.blue(`
|
|
34
|
+
Summary:`)),console.log(` Total Records: ${o.cyan(l)}`)),"domains"in t&&Array.isArray(t.domains)&&t.domains.length>0&&(l||console.log(o.blue(`
|
|
35
|
+
Summary:`)),console.log(` Domains: ${o.cyan(t.domains.join(", "))}`)),"rvfStatus"in t){let i=t.rvfStatus;console.log(o.blue(`
|
|
36
|
+
RVF Details:`)),console.log(` File Size: ${o.cyan(Ve(i.fileSizeBytes))}`),console.log(` Vectors: ${o.cyan(i.totalVectors)}`),console.log(` Segments: ${o.cyan(i.totalSegments)}`)}if("lineage"in t){let i=t.lineage;i&&(console.log(o.blue(`
|
|
37
|
+
Lineage:`)),console.log(` File ID: ${o.cyan(i.fileId)}`),console.log(` Parent ID: ${o.cyan(i.parentId??"none (root)")}`),console.log(` Depth: ${o.cyan(i.lineageDepth)}`))}if("signature"in t){let i=t.signature,d=t.signerKeyId;console.log(o.blue(`
|
|
38
|
+
Signature:`)),i?(console.log(` Status: ${o.green("Signed")}`),console.log(` Key ID: ${o.cyan(d??"unknown")}`),console.log(` Signature: ${o.gray(i.slice(0,32)+"...")}`)):console.log(` Status: ${o.yellow("Unsigned")}`)}console.log(`
|
|
39
|
+
Checksum: ${o.gray(t.checksum)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
40
|
+
Failed to read brain info:`),r),await this.cleanupAndExit(1)}}async executeDiff(n,r,t){try{let a=await Le(B.resolve(n),B.resolve(r),{tableFilter:t.table});if(t.json){process.stdout.write(JSON.stringify(a,null,2)+`
|
|
41
|
+
`),await this.cleanupAndExit(a.identical?0:1);return}En(a,t.verbose),await this.cleanupAndExit(a.identical?0:1)}catch(a){console.error(o.red(`
|
|
42
|
+
Brain diff failed:`),a),await this.cleanupAndExit(2)}}async executeSearch(n){try{let r=xn(n.limit),t=Cn(n.domain),a=await Fe(B.resolve(n.input),{table:n.table,domains:t,patternType:n.patternType,since:n.since,until:n.until,query:n.query,limit:r});if(n.json){process.stdout.write(JSON.stringify(a,null,2)+`
|
|
43
|
+
`),await this.cleanupAndExit(a.totalMatched>0?0:3);return}In(a),await this.cleanupAndExit(a.totalMatched>0?0:3)}catch(r){console.error(o.red(`
|
|
44
|
+
Brain search failed:`),r),await this.cleanupAndExit(2)}}async executeWitnessBackfill(n){try{console.log(o.blue(`
|
|
45
|
+
Running witness chain backfill...
|
|
46
|
+
`));let r=await se(n.db),t=await Pe(r);console.log(o.green(" Backfill complete.")),console.log(` Created: ${o.cyan(t.created)} new witness entries`),console.log(` Skipped: ${o.cyan(t.skipped)} (already witnessed)`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
|
|
47
|
+
Witness backfill failed:`),r),await this.cleanupAndExit(1)}}getHelp(){return`
|
|
48
|
+
Export, import, and inspect QE brain state.
|
|
49
|
+
|
|
50
|
+
Formats:
|
|
51
|
+
rvf \u2014 Single portable .rvf file (default, requires @ruvector/rvf-node)
|
|
52
|
+
jsonl \u2014 JSONL directory format (fallback when native not available)
|
|
53
|
+
|
|
54
|
+
Usage:
|
|
55
|
+
aqe brain export -o brain.rvf [--format rvf] [--db <path>]
|
|
56
|
+
aqe brain export -o ./brain-dir --format jsonl [--db <path>]
|
|
57
|
+
aqe brain import -i brain.rvf [--strategy skip-conflicts] [--dry-run] [--db <path>]
|
|
58
|
+
aqe brain info -i brain.rvf
|
|
59
|
+
|
|
60
|
+
Subcommands:
|
|
61
|
+
export Export brain state to a portable .rvf file or JSONL directory
|
|
62
|
+
import Import a brain export into the local database
|
|
63
|
+
info Show manifest metadata for an existing brain export
|
|
64
|
+
diff Compare two brain exports (manifest always; record-level for JSONL)
|
|
65
|
+
search Filtered search over a JSONL brain export
|
|
66
|
+
|
|
67
|
+
Examples:
|
|
68
|
+
aqe brain export -o .agentic-qe/brain.rvf
|
|
69
|
+
aqe brain export -o .agentic-qe/brain.rvf --format rvf
|
|
70
|
+
aqe brain export -o ./brain-export --format jsonl
|
|
71
|
+
aqe brain import -i .agentic-qe/brain.rvf --strategy latest-wins
|
|
72
|
+
aqe brain import -i .agentic-qe/brain.rvf --dry-run
|
|
73
|
+
aqe brain info -i .agentic-qe/brain.rvf
|
|
74
|
+
aqe brain diff ./brain-a ./brain-b --verbose
|
|
75
|
+
aqe brain search -i ./brain-export --query oauth --domain test-generation
|
|
76
|
+
aqe brain search -i ./brain-export --since 2026-03-01 --limit 50 --json
|
|
77
|
+
`}};async function se(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-A5BS3LGX.js");return B.join(n(),".agentic-qe","memory.db")}function Ve(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function xn(e){let n=Number.parseInt(e,10);return!Number.isFinite(n)||n<1?20:n}function Cn(e){if(e===void 0)return;let n=Array.isArray(e)?e:[e],r=[];for(let t of n)for(let a of t.split(",")){let s=a.trim();s&&r.push(s)}return r.length>0?r:void 0}function En(e,n){console.log(o.blue(`
|
|
78
|
+
Brain Diff
|
|
79
|
+
`)),console.log(` A: ${o.cyan(e.pathA)} (${e.formatA})`),console.log(` B: ${o.cyan(e.pathB)} (${e.formatB})`),console.log(` Versions: ${o.cyan(e.manifestA.version)} \u2192 ${o.cyan(e.manifestB.version)}`+(e.versionMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Checksums: ${o.gray(e.manifestA.checksum.slice(0,12))}\u2026 \u2192 ${o.gray(e.manifestB.checksum.slice(0,12))}\u2026`+(e.checksumMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Exported: ${o.gray(e.manifestA.exportedAt)} \u2192 ${o.gray(e.manifestB.exportedAt)}`),console.log(` Records: ${o.cyan(e.manifestA.totalRecords)} \u2192 ${o.cyan(e.manifestB.totalRecords)} `+Je(e.manifestB.totalRecords-e.manifestA.totalRecords)),(e.domainsOnlyInA.length>0||e.domainsOnlyInB.length>0)&&(console.log(o.blue(`
|
|
80
|
+
Domains:`)),e.domainsOnlyInA.length>0&&console.log(` Only in A: ${o.yellow(e.domainsOnlyInA.join(", "))}`),e.domainsOnlyInB.length>0&&console.log(` Only in B: ${o.yellow(e.domainsOnlyInB.join(", "))}`)),e.recordLevel||console.log(o.gray(`
|
|
81
|
+
Note: record-level diff is only available when both sides are JSONL exports.
|
|
82
|
+
Per-table counts shown below; re-export with --format jsonl for added/removed/changed IDs.`)),console.log(o.blue(`
|
|
83
|
+
Tables:`));let r=e.tableDiffs.filter(Bn);if(r.length===0)console.log(o.gray(" (no differences)"));else for(let t of r)console.log(` ${t.tableName.padEnd(28)} ${o.cyan(String(t.countA).padStart(7))} \u2192 ${o.cyan(String(t.countB).padStart(7))} ${Je(t.delta)}`+_n(t,n)),n&&(t.added&&t.added.length>0&&le("added",t.added),t.removed&&t.removed.length>0&&le("removed",t.removed),t.changed&&t.changed.length>0&&le("changed",t.changed));console.log(""),e.identical?console.log(o.green(` Result: identical
|
|
84
|
+
`)):console.log(o.yellow(` Result: differences found
|
|
85
|
+
`))}function Bn(e){return!!(e.delta!==0||e.added&&e.added.length>0||e.removed&&e.removed.length>0||e.changed&&e.changed.length>0)}function Je(e){return e===0?o.gray("(\xB10)"):e>0?o.green(`(+${e})`):o.red(`(${e})`)}function _n(e,n){let r=[];return e.added&&e.added.length>0&&r.push(o.green(`+${e.added.length}`)),e.removed&&e.removed.length>0&&r.push(o.red(`-${e.removed.length}`)),e.changed&&e.changed.length>0&&r.push(o.yellow(`~${e.changed.length}`)),r.length===0?"":n?" "+r.join(" "):" "+o.gray("[")+r.join(" ")+o.gray("]")}function le(e,n){let r=n.slice(0,10).join(", "),t=n.length>10?o.gray(` \u2026(+${n.length-10} more)`):"";console.log(` ${o.gray(e+":")} ${r}${t}`)}function In(e){if(console.log(o.blue(`
|
|
86
|
+
Brain Search
|
|
87
|
+
`)),console.log(` Input: ${o.cyan(e.inputPath)}`),console.log(` Table: ${o.cyan(e.table)}`),console.log(` Scanned: ${o.cyan(e.totalScanned)} Matched: ${o.cyan(e.totalMatched)} Shown: ${o.cyan(e.hits.length)}`+(e.truncated?o.yellow(` (truncated to limit ${e.limit})`):"")),e.hits.length===0){console.log(o.yellow(`
|
|
88
|
+
No matching rows.
|
|
89
|
+
`));return}console.log("");for(let n of e.hits){let r=o.cyan(n.id)+(n.display.patternType?o.gray(` ${n.display.patternType}`):"")+(n.display.domain?o.gray(` [${n.display.domain}]`):"")+(n.display.confidence!==void 0?o.gray(` conf=${n.display.confidence.toFixed(2)}`):"");if(console.log(` ${r}`),n.display.name&&console.log(` ${o.bold(n.display.name)}`),n.display.description){let t=n.display.description.length>200?n.display.description.slice(0,200)+"\u2026":n.display.description;console.log(` ${o.gray(t)}`)}n.display.updatedAt&&console.log(` ${o.gray(n.display.updatedAt)}`),console.log("")}}function dt(e,n){return new de(e,n)}export{de as BrainHandler,dt as createBrainHandler};
|