agentic-qe 3.11.4 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/helpers/.helpers-version +1 -0
- package/.claude/helpers/auto-memory-hook.mjs +35 -3
- package/.claude/helpers/brain-checkpoint.cjs +16 -1
- package/.claude/helpers/helpers.manifest.json +12 -0
- package/.claude/helpers/hook-handler.cjs +26 -5
- package/.claude/helpers/intelligence.cjs +14 -1
- package/.claude/hooks/aqe-hook.cjs +57 -10
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +110 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/adapters/a2a/auth/routes.js +59 -28
- package/dist/audit/witness-chain.d.ts +25 -0
- package/dist/audit/witness-chain.js +69 -22
- package/dist/audit/witness-key-manager.d.ts +11 -0
- package/dist/audit/witness-key-manager.js +24 -0
- package/dist/cli/brain-commands.js +2 -1
- package/dist/cli/bundle.js +6 -6
- package/dist/cli/chunks/adapter-6IWRIHF3.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-62I6ZNRW.js → agent-booster-wasm-IO54X6IQ.js} +2 -2
- package/dist/cli/chunks/{agent-handler-E2TZKKBS.js → agent-handler-A57SZUCW.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-JHAHC2NH.js → agent-memory-branch-BX7LRFGN.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-FSF5U67K.js +2 -0
- package/dist/cli/chunks/{arena-72ZV65BR.js → arena-UTC4YY6Y.js} +4 -4
- package/dist/cli/chunks/{arena-KLG3YSSR.js → arena-Y3XTX6O7.js} +2 -2
- package/dist/cli/chunks/audit-L4RL2AOY.js +3 -0
- package/dist/cli/chunks/base-2CKCJU3O.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-LAFK5QZ4.js → better-sqlite3-LRDXKYOJ.js} +2 -2
- package/dist/cli/chunks/brain-handler-OHDPI5TQ.js +89 -0
- package/dist/cli/chunks/{branch-enumerator-C7MPNYT7.js → branch-enumerator-ZRXE2CQ7.js} +2 -2
- package/dist/cli/chunks/{browser-UUDUDYLR.js → browser-NT33FG76.js} +2 -2
- package/dist/cli/chunks/browser-workflow-UGYJE64S.js +2 -0
- package/dist/cli/chunks/{chunk-7QTB5XIQ.js → chunk-27JCWG5J.js} +2 -2
- package/dist/cli/chunks/{chunk-3FJZMQJ7.js → chunk-2ALNNXFF.js} +2 -2
- package/dist/cli/chunks/{chunk-LMJUMUQJ.js → chunk-2AOOIAW3.js} +4 -4
- package/dist/cli/chunks/{chunk-CNF3ZWLM.js → chunk-2AR4B3DI.js} +2 -2
- package/dist/cli/chunks/{chunk-7ADD2ZQL.js → chunk-2KHDGC7N.js} +2 -2
- package/dist/cli/chunks/{chunk-P6S6ZVB5.js → chunk-2UMCB7AH.js} +1 -1
- package/dist/cli/chunks/{chunk-HH6NCBSP.js → chunk-335GHVJV.js} +22 -22
- package/dist/cli/chunks/{chunk-2WPSMQIL.js → chunk-36MPDANH.js} +1 -1
- package/dist/cli/chunks/{chunk-Y4AXOHW4.js → chunk-3AFNXU45.js} +1 -1
- package/dist/cli/chunks/{chunk-SL3SNOO2.js → chunk-3B4XXFKD.js} +2 -2
- package/dist/cli/chunks/{chunk-7IKWF2AD.js → chunk-4GU656WM.js} +1 -1
- package/dist/cli/chunks/{chunk-IQBZBUP5.js → chunk-4SALW7OT.js} +2 -2
- package/dist/cli/chunks/{chunk-TCVEKRPI.js → chunk-5FR5GBUT.js} +2 -2
- package/dist/cli/chunks/chunk-5VBPIJUZ.js +65 -0
- package/dist/cli/chunks/chunk-5XFX25AJ.js +4 -0
- package/dist/cli/chunks/{chunk-QSDIY3E2.js → chunk-5YGESYBC.js} +1 -1
- package/dist/cli/chunks/{chunk-5U2WHPXL.js → chunk-62RELCU6.js} +1 -1
- package/dist/cli/chunks/{chunk-QJ5NCYJ3.js → chunk-64M3FFM4.js} +2 -2
- package/dist/cli/chunks/{chunk-BMQDELPA.js → chunk-6JNNZGI2.js} +1 -1
- package/dist/cli/chunks/{chunk-U34OZXD6.js → chunk-6X3RJBA3.js} +2 -2
- package/dist/cli/chunks/{chunk-AE6HXMOG.js → chunk-72VZGAMJ.js} +1 -1
- package/dist/cli/chunks/{chunk-4JFH3MVA.js → chunk-7F7U2HUH.js} +1 -1
- package/dist/cli/chunks/{chunk-A4OMK3FO.js → chunk-7HJHXSYT.js} +2 -2
- package/dist/cli/chunks/chunk-7WX3MKRS.js +2 -0
- package/dist/cli/chunks/{chunk-O7PVZ32A.js → chunk-7ZIVDGSN.js} +1 -1
- package/dist/cli/chunks/{chunk-EZRHSHOQ.js → chunk-AAATFEIL.js} +2 -2
- package/dist/cli/chunks/{chunk-TQ373GGI.js → chunk-AEX75YGI.js} +2 -2
- package/dist/cli/chunks/chunk-BA6U7NSR.js +2 -0
- package/dist/cli/chunks/chunk-BB4OVXWF.js +14 -0
- package/dist/cli/chunks/{chunk-GRQ36XUH.js → chunk-BBC526PL.js} +2 -2
- package/dist/cli/chunks/{chunk-EONKMHKO.js → chunk-BGRJZH5Q.js} +2 -2
- package/dist/cli/chunks/{chunk-XQ6DW5FV.js → chunk-BUYPRUNY.js} +2 -2
- package/dist/cli/chunks/{chunk-TU6YN43Q.js → chunk-BZPF6GTL.js} +1 -1
- package/dist/cli/chunks/{chunk-TPMBFARK.js → chunk-C4SZSPXY.js} +67 -22
- package/dist/cli/chunks/{chunk-D6CKKNYC.js → chunk-C6GYLCTX.js} +2 -2
- package/dist/cli/chunks/{chunk-YNK6SUPU.js → chunk-CC5G3K4X.js} +2 -2
- package/dist/cli/chunks/{chunk-ADFKY3X2.js → chunk-CHO54B34.js} +2 -2
- package/dist/cli/chunks/{chunk-WQZ2WRO4.js → chunk-CMGYUCM7.js} +1 -1
- package/dist/cli/chunks/{chunk-QMC5MTBV.js → chunk-CSEEGX5T.js} +2 -2
- package/dist/cli/chunks/{chunk-FSGMRQFC.js → chunk-CVGXB7IX.js} +2 -2
- package/dist/cli/chunks/{chunk-5VSQAGA2.js → chunk-DQDFACYW.js} +1 -1
- package/dist/cli/chunks/chunk-DR7PCO3S.js +153 -0
- package/dist/cli/chunks/{chunk-D5S47YUS.js → chunk-DTOE3NYW.js} +3 -3
- package/dist/cli/chunks/{chunk-WZYNY3VF.js → chunk-DXOMRWDC.js} +1 -1
- package/dist/cli/chunks/{chunk-HJ24KMC2.js → chunk-EGH3H7QO.js} +1 -1
- package/dist/cli/chunks/{chunk-JFLSQH2X.js → chunk-EM2JIIAQ.js} +2 -2
- package/dist/cli/chunks/{chunk-MWFJC5HR.js → chunk-ESDGCTC4.js} +1 -1
- package/dist/cli/chunks/{chunk-SRVTNG6L.js → chunk-EZE2HRQB.js} +2 -2
- package/dist/cli/chunks/{chunk-ZFCVT43J.js → chunk-FEEMJDUF.js} +2 -2
- package/dist/cli/chunks/{chunk-HJO4RNOW.js → chunk-FI5SSLEF.js} +2 -2
- package/dist/cli/chunks/{chunk-XHRLBJTM.js → chunk-FKPUPQQT.js} +2 -2
- package/dist/cli/chunks/{chunk-ODZSQVEW.js → chunk-FOPS6DRZ.js} +1 -1
- package/dist/cli/chunks/{chunk-AQIEK4SY.js → chunk-FU5RNEXV.js} +2 -2
- package/dist/cli/chunks/{chunk-PQUXFSN6.js → chunk-FZIHOMGY.js} +2 -2
- package/dist/cli/chunks/{chunk-Z2REKBD6.js → chunk-FZRU73M4.js} +2 -2
- package/dist/cli/chunks/{chunk-NBBLPDJX.js → chunk-G5JQLUUO.js} +2 -2
- package/dist/cli/chunks/{chunk-4BFCLSDN.js → chunk-G6LR7FK7.js} +2 -2
- package/dist/cli/chunks/{chunk-QEVX4GWF.js → chunk-G6RKUEGL.js} +2 -2
- package/dist/cli/chunks/{chunk-HWBMYR5W.js → chunk-GCF42L7M.js} +5 -5
- package/dist/cli/chunks/{chunk-TSWF3AGQ.js → chunk-GGMQOEZZ.js} +2 -2
- package/dist/cli/chunks/{chunk-PFWJQPUC.js → chunk-HAEUPIKW.js} +2 -2
- package/dist/cli/chunks/{chunk-63QUN3JK.js → chunk-HDJMD6UH.js} +1 -1
- package/dist/cli/chunks/{chunk-JPENUVCI.js → chunk-HW62TB4T.js} +1 -1
- package/dist/cli/chunks/{chunk-WMIRAD3J.js → chunk-I6WHYRWB.js} +2 -2
- package/dist/cli/chunks/{chunk-YZ5EQR37.js → chunk-ICK3B24H.js} +2 -2
- package/dist/cli/chunks/{chunk-FRFVN6AA.js → chunk-IDLNLSQI.js} +2 -2
- package/dist/cli/chunks/{chunk-VQU7DMEY.js → chunk-IJUYHIKN.js} +2 -2
- package/dist/cli/chunks/{chunk-6JUOH6L4.js → chunk-IKVNYK7Y.js} +2 -2
- package/dist/cli/chunks/{chunk-ZKCKOQJI.js → chunk-JOBCMNTP.js} +2 -2
- package/dist/cli/chunks/{chunk-ARPBG6FQ.js → chunk-JYX7AZHE.js} +2 -2
- package/dist/cli/chunks/{chunk-SFDUT5WM.js → chunk-JYXSVSH2.js} +2 -2
- package/dist/cli/chunks/{chunk-VJGHRWMH.js → chunk-K5SN66B4.js} +2 -2
- package/dist/cli/chunks/{chunk-DNOU2HVQ.js → chunk-KDLYTJ5C.js} +2 -2
- package/dist/cli/chunks/{chunk-T76RFXQX.js → chunk-KI5BP4X5.js} +2 -2
- package/dist/cli/chunks/{chunk-7AWK43JN.js → chunk-KJWQ7ENF.js} +2 -2
- package/dist/cli/chunks/{chunk-BRLUNIR4.js → chunk-KN5GOEYK.js} +2 -2
- package/dist/cli/chunks/{chunk-VKJQAKYG.js → chunk-KZ37VHMJ.js} +2 -2
- package/dist/cli/chunks/{chunk-NV3TXXOW.js → chunk-KZMRU7DL.js} +2 -2
- package/dist/cli/chunks/{chunk-LLUPRGOR.js → chunk-L5ZLOW3K.js} +2 -2
- package/dist/cli/chunks/{chunk-THKZVOZV.js → chunk-LMJUQWR7.js} +1 -1
- package/dist/cli/chunks/{chunk-2KNFS3L5.js → chunk-MBF3Q7FQ.js} +1 -1
- package/dist/cli/chunks/chunk-MDT3LIXS.js +2 -0
- package/dist/cli/chunks/{chunk-B5XUWHKQ.js → chunk-MJPYNGZ7.js} +1 -1
- package/dist/cli/chunks/{chunk-UCYTY4LG.js → chunk-MK3J7JVZ.js} +2 -2
- package/dist/cli/chunks/{chunk-MCT4CD5M.js → chunk-MUAHFGIX.js} +2 -2
- package/dist/cli/chunks/{chunk-3SBUL72V.js → chunk-MUV56BPK.js} +2 -2
- package/dist/cli/chunks/{chunk-WNMDWP5A.js → chunk-NLHISTL2.js} +2 -2
- package/dist/cli/chunks/{chunk-UJMTKXPI.js → chunk-NNGCUJWQ.js} +2 -2
- package/dist/cli/chunks/chunk-NW7G57NR.js +27 -0
- package/dist/cli/chunks/{chunk-3SRPFBU7.js → chunk-O3C5RRDQ.js} +3 -3
- package/dist/cli/chunks/{chunk-AYGEWPN4.js → chunk-OHSVDMF7.js} +1 -1
- package/dist/cli/chunks/{chunk-AJXGGTX7.js → chunk-OPIWFXME.js} +1 -1
- package/dist/cli/chunks/{chunk-ZSBJNE35.js → chunk-P52YORQG.js} +2 -2
- package/dist/cli/chunks/chunk-PM566XEO.js +2 -0
- package/dist/cli/chunks/chunk-POKMJTD2.js +2 -0
- package/dist/cli/chunks/{chunk-GOQ4P2PB.js → chunk-PQMLIVGV.js} +2 -2
- package/dist/cli/chunks/{chunk-IB3ZPLFA.js → chunk-PT3FTGKZ.js} +2 -2
- package/dist/cli/chunks/{chunk-U3AVZGQA.js → chunk-Q5YRPS4P.js} +1 -1
- package/dist/cli/chunks/{chunk-5Z4FBCBK.js → chunk-QJ6H2HQQ.js} +1 -1
- package/dist/cli/chunks/{chunk-DRMHVY4T.js → chunk-RG552ROA.js} +4 -4
- package/dist/cli/chunks/{chunk-PEIQDQXN.js → chunk-RHC7TFPU.js} +2 -2
- package/dist/cli/chunks/{chunk-JNQN5DNS.js → chunk-RMFRFING.js} +1 -1
- package/dist/cli/chunks/{chunk-4YT5YN5G.js → chunk-RQN4HWGV.js} +2 -2
- package/dist/cli/chunks/{chunk-5P7Q5YNC.js → chunk-RYUSZ43T.js} +1 -1
- package/dist/cli/chunks/{chunk-O5NEJIHB.js → chunk-RZDNCTOA.js} +2 -2
- package/dist/cli/chunks/chunk-SCMXIBI7.js +2 -0
- package/dist/cli/chunks/{chunk-6545AS2J.js → chunk-SPEUF7ZL.js} +2 -2
- package/dist/cli/chunks/{chunk-LW5DHT3Z.js → chunk-SSXAW3ER.js} +2 -2
- package/dist/cli/chunks/{chunk-Q7ORVHJB.js → chunk-TC2JE5OK.js} +3 -3
- package/dist/cli/chunks/{chunk-MALOUGSF.js → chunk-TED4KOSK.js} +2 -2
- package/dist/cli/chunks/{chunk-ICCTQ5LO.js → chunk-TJ6N4CCX.js} +2 -2
- package/dist/cli/chunks/{chunk-6GYGAW53.js → chunk-TJEJ4UVX.js} +2 -2
- package/dist/cli/chunks/{chunk-VO6YJGB4.js → chunk-TO5PQSDD.js} +2 -2
- package/dist/cli/chunks/{chunk-LKURMUBU.js → chunk-TR5GOGH3.js} +37 -12
- package/dist/cli/chunks/{chunk-JCTCM6IR.js → chunk-UGJQJSPB.js} +1 -1
- package/dist/cli/chunks/{chunk-4RHNPRAP.js → chunk-USB44IHJ.js} +2 -2
- package/dist/cli/chunks/{chunk-JDFPAJGB.js → chunk-UUOXV3NS.js} +92 -92
- package/dist/cli/chunks/chunk-UVVKFBF7.js +2 -0
- package/dist/cli/chunks/{chunk-VCUCD3B5.js → chunk-V2MD5EDD.js} +2 -2
- package/dist/cli/chunks/{chunk-RFQBDMAP.js → chunk-VA7TEOPM.js} +1 -1
- package/dist/cli/chunks/{chunk-IF3HPQNV.js → chunk-VMP4M5PB.js} +1 -1
- package/dist/cli/chunks/{chunk-KUZMVH6N.js → chunk-VS4GMNJK.js} +3 -3
- package/dist/cli/chunks/{chunk-ZYZT2CDX.js → chunk-VWJSWXHG.js} +1 -1
- package/dist/cli/chunks/{chunk-54B6P2WS.js → chunk-VZ67ZDB3.js} +3 -3
- package/dist/cli/chunks/{chunk-NSPCZPTB.js → chunk-W2OMW6UU.js} +2 -2
- package/dist/cli/chunks/{chunk-3SKIZDKL.js → chunk-W766S4SK.js} +1 -1
- package/dist/cli/chunks/{chunk-N2BJN6AO.js → chunk-WJYTLRA5.js} +3 -3
- package/dist/cli/chunks/{chunk-X64BEXUY.js → chunk-WNASEUBW.js} +117 -113
- package/dist/cli/chunks/{chunk-HT6WAYIR.js → chunk-WT4ZDDFM.js} +1 -1
- package/dist/cli/chunks/chunk-XEYW3V5I.js +2 -0
- package/dist/cli/chunks/{chunk-6W3QHS45.js → chunk-XIFPIVZI.js} +2 -2
- package/dist/cli/chunks/{chunk-3E7D3A35.js → chunk-Y2MCIIJD.js} +1 -1
- package/dist/cli/chunks/{chunk-YUHM72VQ.js → chunk-YKOTOCO6.js} +2 -2
- package/dist/cli/chunks/{chunk-YKSWC7I4.js → chunk-Z3W3R4CW.js} +8 -20
- package/dist/cli/chunks/chunk-ZT2WHCVM.js +2 -0
- package/dist/cli/chunks/{chunk-G3TFNY4T.js → chunk-ZVPAFX4I.js} +2 -2
- package/dist/cli/chunks/{chunk-NFJT7XXR.js → chunk-ZWC6CM4R.js} +1 -1
- package/dist/cli/chunks/{ci-HQCRSCC7.js → ci-RJH5LAL3.js} +2 -2
- package/dist/cli/chunks/{ci-output-YBVXLA6O.js → ci-output-62SGMGB2.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-ULGMF2QN.js → circuit-breaker-QXTS5ZAW.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-MKZ2LJXK.js → claude-flow-setup-BBCCT5WV.js} +2 -2
- package/dist/cli/chunks/client-E2XUBCLK.js +2 -0
- package/dist/cli/chunks/{cline-installer-WZQ6XBWN.js → cline-installer-IZCUJJ3I.js} +2 -2
- package/dist/cli/chunks/{code-H3KGH45S.js → code-AWNVOZ7S.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-NUVEAJ7C.js → code-index-extractor-MX65BKMI.js} +2 -2
- package/dist/cli/chunks/{codex-installer-JQI6E6CV.js → codex-installer-EQT6JVLM.js} +2 -2
- package/dist/cli/chunks/{completions-NDF4PFE7.js → completions-WOJAM45W.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-XCZH66HG.js → complexity-analyzer-3DJB7V3K.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-Z4AJGZ7S.js → continuedev-installer-P4KWUTCJ.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-K4IPAL7C.js → copilot-installer-FFZWTMWQ.js} +2 -2
- package/dist/cli/chunks/core-handlers-46Z5VOO6.js +2 -0
- package/dist/cli/chunks/{cost-tracker-35KXAB23.js → cost-tracker-CYBOV3NI.js} +2 -2
- package/dist/cli/chunks/{coverage-QW5I4TYZ.js → coverage-GTZJBSC4.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-SXQ3HFRY.js +2 -0
- package/dist/cli/chunks/{cursor-installer-P4Z7RMIZ.js → cursor-installer-WZIVXGGB.js} +2 -2
- package/dist/cli/chunks/daemon-JWMHEJEN.js +10 -0
- package/dist/cli/chunks/{daemon-WQWTCYBM.js → daemon-MSFN2LXY.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-7XD2VGON.js → dag-attention-scheduler-4TWOTTQE.js} +2 -2
- package/dist/cli/chunks/{detect-GZ3P4DI7.js → detect-YZ6AGQPB.js} +2 -2
- package/dist/cli/chunks/{dist-node-6WWAW7OP.js → dist-node-3EM2XH54.js} +2 -2
- package/dist/cli/chunks/{domain-handler-3GTLWARQ.js → domain-handler-4XU5BINU.js} +2 -2
- package/dist/cli/chunks/domain-transfer-HUFC7I52.js +2 -0
- package/dist/cli/chunks/dream-R6MQQQ3N.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-BGIMA77V.js → embed-and-insert-pattern-J5ZFM6YX.js} +2 -2
- package/dist/cli/chunks/{eval-SXV6DRDD.js → eval-XYOA3EH2.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-TT6WCT2S.js → experience-capture-middleware-E3RYQB6Z.js} +3 -3
- package/dist/cli/chunks/{fast-paths-HTAZHEQP.js → fast-paths-DKIYN2YS.js} +2 -2
- package/dist/cli/chunks/{feature-flags-DIE3Z2B4.js → feature-flags-S2RNZATS.js} +2 -2
- package/dist/cli/chunks/{feature-flags-WBUKU54W.js → feature-flags-ZB63Z7N5.js} +2 -2
- package/dist/cli/chunks/{file-discovery-SKDETFS3.js → file-discovery-USJJLYQU.js} +2 -2
- package/dist/cli/chunks/{fleet-WCWEPAVU.js → fleet-4MUPHSF5.js} +4 -4
- package/dist/cli/chunks/{gnn-wrapper-KWZOWBYS.js → gnn-wrapper-PYOQZKX6.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-3AGYHVG2.js → heartbeat-handler-HLO5XCG7.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-OSDPJT6A.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-KMGSHBIN.js +2 -0
- package/dist/cli/chunks/hnsw-index-IMFRAOPE.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-6OJJDZHL.js → hnsw-legacy-bridge-FZEH2KLM.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-URULPKRF.js → hnswlib-node-VS6L5VUG.js} +2 -2
- package/dist/cli/chunks/{hooks-OXEBTLXV.js → hooks-R2757K57.js} +48 -52
- package/dist/cli/chunks/hybrid-router-57QSWSWC.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-NL74PRHD.js → hypergraph-engine-EAV3GJ5D.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-KZ54AEEL.js → hypergraph-handler-5ERXAVGH.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-OC4MPBGA.js +2 -0
- package/dist/cli/chunks/{init-handler-XKZXRXPG.js → init-handler-RXUSEMG7.js} +6 -6
- package/dist/cli/chunks/init-wizard-CDBRL4PO.js +2 -0
- package/dist/cli/chunks/kernel-CQ7R3AAV.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-WISQMJK7.js → kilocode-installer-ZUBVBHGT.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-O7TBB3GM.js → kiro-installer-TRTRQDGL.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-UXNH7RY4.js +2 -0
- package/dist/cli/chunks/{learning-6IZBGVRU.js → learning-UYXWAU5D.js} +3 -3
- package/dist/cli/chunks/{llm-router-QDMQPPQ7.js → llm-router-TB5OJPEV.js} +4 -4
- package/dist/cli/chunks/llm-router-service-UV34YXBE.js +2 -0
- package/dist/cli/chunks/{load-KLAJJGL5.js → load-ELPSUIPV.js} +2 -2
- package/dist/cli/chunks/load-test-2VEN3PQZ.js +2 -0
- package/dist/cli/chunks/{mcp-SZOPQZIZ.js → mcp-UX7TK3XV.js} +2 -2
- package/dist/cli/chunks/{memory-G3WY74C6.js → memory-W3LG6H6N.js} +5 -5
- package/dist/cli/chunks/memory-backend-TZL5U6F3.js +2 -0
- package/dist/cli/chunks/memory-handlers-BNXAYS2P.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-TDNQGTOT.js → multi-model-executor-227LWZRY.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-NGYGEDMV.js → opencode-installer-F4WKVWDL.js} +2 -2
- package/dist/cli/chunks/{orchestrator-KPI5DY2C.js → orchestrator-V4DBMGK6.js} +5 -5
- package/dist/cli/chunks/pattern-null-store-KLX2RNHM.js +2 -0
- package/dist/cli/chunks/pattern-usage-recorder-BY3HEWSU.js +2 -0
- package/dist/cli/chunks/{pipeline-CSDCC675.js → pipeline-3F5RIESX.js} +2 -2
- package/dist/cli/chunks/{platform-Q5XKEVKH.js → platform-KCGXTZO3.js} +2 -2
- package/dist/cli/chunks/{plugin-XKKR3GVL.js → plugin-2H552KOV.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-22QVNKEN.js → prime-radiant-advanced-wasm-EFKVL7VN.js} +2 -2
- package/dist/cli/chunks/protocol-executor-5HJKW6MC.js +2 -0
- package/dist/cli/chunks/{protocol-handler-REQKTJGG.js → protocol-handler-ELGYV7D2.js} +2 -2
- package/dist/cli/chunks/{prove-NOFUFSQN.js → prove-AYJCQYNI.js} +2 -2
- package/dist/cli/chunks/provider-manager-TRZSBXD3.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-RCEYSLVV.js +2 -0
- package/dist/cli/chunks/{quality-3DQ2H5TK.js → quality-HH7L5A7V.js} +2 -2
- package/dist/cli/chunks/quality-gate-NAQLXE4C.js +7 -0
- package/dist/cli/chunks/queen-coordinator-6JFZD54W.js +2 -0
- package/dist/cli/chunks/{real-embeddings-FCGNYWLL.js → real-embeddings-IO3F4ZFR.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-HX3CNRIR.js → roocode-installer-X4TU5HO4.js} +2 -2
- package/dist/cli/chunks/router-KRLC46NS.js +2 -0
- package/dist/cli/chunks/routing-feedback-WW26H6SA.js +2 -0
- package/dist/cli/chunks/{routing-handler-YRZ2LDCR.js → routing-handler-ZJKGDDMT.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-GCQVBJ4E.js → ruvector-commands-NXCSUBN2.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-B562P3ZC.js → rvf-dual-writer-JMA74SKP.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-NAGFKCMD.js → rvf-migration-adapter-BNTGH2KU.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-WWFBEJ5Q.js → rvf-migration-coordinator-7T2HHUOH.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-OVQKPQUH.js +2 -0
- package/dist/cli/chunks/safe-db-UQOCQIH2.js +2 -0
- package/dist/cli/chunks/schedule-EUX7ZQUK.js +2 -0
- package/dist/cli/chunks/scheduler-MALHQKNR.js +2 -0
- package/dist/cli/chunks/{security-IFOYTD75.js → security-XSK2QHB3.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-TYD5TQ35.js → shared-rvf-adapter-WLRKI7RY.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-YGOOVDQZ.js → shared-rvf-dual-writer-SZW3J7ZK.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-OBCLRP4L.js +2 -0
- package/dist/cli/chunks/status-handler-HGCKYJX2.js +46 -0
- package/dist/cli/chunks/{structural-health-KZI6YMKV.js → structural-health-4SJCFX63.js} +2 -2
- package/dist/cli/chunks/{sync-Z5BDDBMK.js → sync-7WAVNZGL.js} +2 -2
- package/dist/cli/chunks/{sync-ABZNNYRC.js → sync-ATR4DUSA.js} +2 -2
- package/dist/cli/chunks/{task-handler-5ACZEPJ7.js → task-handler-O6REL34Y.js} +2 -2
- package/dist/cli/chunks/{task-handlers-UZWDPL6A.js → task-handlers-WFV2ZYWW.js} +3 -3
- package/dist/cli/chunks/{test-APO3MCVV.js → test-4LXUVHEU.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-EFZA5G5C.js → test-scheduling-OTN3DMKY.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-J2OPLNUK.js → token-bootstrap-VA7T4P42.js} +2 -2
- package/dist/cli/chunks/{token-usage-VHWVNN4R.js → token-usage-TLT6OXXR.js} +2 -2
- package/dist/cli/chunks/{transformers-PX4HPO75.js → transformers-JI7LZRQ3.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-44HA2Z3F.js → tree-sitter-wasm-parser-QNIMHB4K.js} +2 -2
- package/dist/cli/chunks/{types-IMOP7F4R.js → types-DJNWOAC6.js} +2 -2
- package/dist/cli/chunks/unified-memory-A5BS3LGX.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-WJLJO5MY.js +2 -0
- package/dist/cli/chunks/unified-persistence-CFC2BKI5.js +2 -0
- package/dist/cli/chunks/{upgrade-OZ3O6ZZI.js → upgrade-VEW4FL23.js} +2 -2
- package/dist/cli/chunks/{validate-DRY5BMWX.js → validate-O3P6PF7B.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-QD3LYPUF.js → validate-swarm-M2HXHZVC.js} +2 -2
- package/dist/cli/chunks/{vibium-2J3H2ITD.js → vibium-GOU55LUO.js} +2 -2
- package/dist/cli/chunks/visual-security-VPB6KVYJ.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-KRNUOGKI.js → web-tree-sitter-MXOI4GH3.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-PQIPH3WP.js → windsurf-installer-6GKT53IH.js} +2 -2
- package/dist/cli/chunks/{witness-chain-HPLOYPS7.js → witness-chain-OXGQGL26.js} +2 -2
- package/dist/cli/chunks/witness-chain-ZZAUAXDY.js +2 -0
- package/dist/cli/chunks/witness-key-manager-PGFSQXUJ.js +2 -0
- package/dist/cli/chunks/{workflow-OAQ3FWCY.js → workflow-ENBWRMBA.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-S4LBFTYD.js +2 -0
- package/dist/cli/chunks/{wrappers-UPIU6S5S.js → wrappers-MHLNYANQ.js} +2 -2
- package/dist/cli/commands/audit.d.ts +12 -0
- package/dist/cli/commands/audit.js +64 -4
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +45 -19
- package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +13 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +38 -0
- package/dist/cli/commands/hooks-handlers/task-hooks.js +19 -1
- package/dist/cli/commands/quality-gate.d.ts +24 -0
- package/dist/cli/commands/quality-gate.js +135 -0
- package/dist/cli/handlers/status-handler.d.ts +18 -0
- package/dist/cli/handlers/status-handler.js +47 -0
- package/dist/cli/index.js +5 -0
- package/dist/coordination/mincut/dream-integration.d.ts +11 -0
- package/dist/coordination/mincut/dream-integration.js +39 -12
- package/dist/coordination/mincut/queen-integration.js +24 -7
- package/dist/coordination/protocol-executor.js +2 -1
- package/dist/coordination/queen-lifecycle.js +4 -1
- package/dist/domains/code-intelligence/coordinator.js +10 -6
- package/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -1
- package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +6 -0
- package/dist/domains/defect-intelligence/services/defect-predictor.js +21 -0
- package/dist/domains/learning-optimization/interfaces.d.ts +7 -0
- package/dist/domains/learning-optimization/plugin.js +5 -0
- package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +10 -0
- package/dist/domains/learning-optimization/services/learning-coordinator.js +57 -0
- package/dist/domains/test-execution/plugin.js +2 -2
- package/dist/domains/test-execution/services/flaky-detector.js +1 -1
- package/dist/domains/test-generation/coordinator.js +22 -8
- package/dist/domains/test-generation/interfaces.d.ts +3 -0
- package/dist/domains/test-generation/services/test-generator.js +9 -1
- package/dist/integrations/ruvector/delta-tracker.js +10 -1
- package/dist/integrations/ruvector/feature-flags.js +7 -0
- package/dist/integrations/ruvector/sona-persistence.d.ts +24 -0
- package/dist/integrations/ruvector/sona-persistence.js +76 -0
- package/dist/integrations/ruvector/sona-three-loop.d.ts +15 -0
- package/dist/integrations/ruvector/sona-three-loop.js +17 -0
- package/dist/kernel/unified-memory-schemas.d.ts +2 -2
- package/dist/kernel/unified-memory-schemas.js +48 -2
- package/dist/kernel/unified-memory.d.ts +22 -0
- package/dist/kernel/unified-memory.js +43 -0
- package/dist/learning/aqe-learning-engine.js +3 -1
- package/dist/learning/dream/concept-graph.d.ts +31 -1
- package/dist/learning/dream/concept-graph.js +109 -3
- package/dist/learning/dream/dream-engine.d.ts +13 -1
- package/dist/learning/dream/dream-engine.js +146 -10
- package/dist/learning/dream/index.d.ts +1 -1
- package/dist/learning/dream/types.d.ts +23 -0
- package/dist/learning/pattern-lifecycle.d.ts +16 -0
- package/dist/learning/pattern-lifecycle.js +77 -1
- package/dist/learning/pattern-store.d.ts +2 -2
- package/dist/learning/pattern-store.js +14 -3
- package/dist/learning/provenance-tier.d.ts +52 -0
- package/dist/learning/provenance-tier.js +64 -0
- package/dist/learning/qe-flywheel/corpus-scorer.d.ts +55 -0
- package/dist/learning/qe-flywheel/corpus-scorer.js +293 -0
- package/dist/learning/qe-flywheel/coupled-anchor.d.ts +91 -0
- package/dist/learning/qe-flywheel/coupled-anchor.js +181 -0
- package/dist/learning/qe-flywheel/generation.d.ts +121 -0
- package/dist/learning/qe-flywheel/generation.js +167 -0
- package/dist/learning/qe-flywheel/policy.d.ts +37 -0
- package/dist/learning/qe-flywheel/policy.js +66 -0
- package/dist/learning/qe-flywheel/receipt-store.d.ts +31 -0
- package/dist/learning/qe-flywheel/receipt-store.js +89 -0
- package/dist/learning/qe-flywheel/receipt.d.ts +62 -0
- package/dist/learning/qe-flywheel/receipt.js +97 -0
- package/dist/learning/qe-reasoning-bank.js +34 -31
- package/dist/learning/routing-topology-gate.d.ts +12 -2
- package/dist/learning/routing-topology-gate.js +15 -3
- package/dist/learning/rvf-pattern-store.d.ts +1 -1
- package/dist/learning/rvf-pattern-store.js +21 -8
- package/dist/learning/sqlite-persistence.js +12 -9
- package/dist/mcp/bundle.js +540 -460
- package/dist/mcp/qe-tool-bridge.js +7 -2
- package/dist/mcp/tools/base.d.ts +29 -0
- package/dist/mcp/tools/base.js +25 -0
- package/dist/mcp/tools/coverage-analysis/index.js +6 -4
- package/dist/mcp/tools/learning-optimization/dream.d.ts +4 -13
- package/dist/mcp/tools/learning-optimization/dream.js +10 -96
- package/dist/mcp/tools/planning/goap-execute.d.ts +13 -1
- package/dist/mcp/tools/planning/goap-execute.js +33 -18
- package/dist/mcp/tools/quality-assessment/gate.d.ts +38 -0
- package/dist/mcp/tools/quality-assessment/gate.js +86 -0
- package/dist/mcp/tools/registry.d.ts +1 -0
- package/dist/mcp/tools/registry.js +10 -2
- package/dist/persistence/rvf-migration-coordinator.js +2 -1
- package/dist/planning/actions/qe-action-library.js +124 -1
- package/dist/planning/goap-planner.d.ts +14 -2
- package/dist/planning/goap-planner.js +51 -9
- package/dist/planning/index.d.ts +1 -1
- package/dist/planning/plan-executor.d.ts +84 -4
- package/dist/planning/plan-executor.js +221 -56
- package/dist/planning/types.d.ts +27 -0
- package/dist/shared/events/domain-events.d.ts +2 -0
- package/dist/shared/safe-db.js +23 -4
- package/dist/validation/anchor-set.d.ts +74 -0
- package/dist/validation/anchor-set.js +78 -0
- package/dist/validation/frontier-judge.d.ts +99 -0
- package/dist/validation/frontier-judge.js +234 -0
- package/dist/validation/gate-reexecute.d.ts +165 -0
- package/dist/validation/gate-reexecute.js +255 -0
- package/dist/validation/quality-gate-runner.d.ts +49 -0
- package/dist/validation/quality-gate-runner.js +62 -0
- package/dist/validation/quality-verdict.d.ts +94 -0
- package/dist/validation/quality-verdict.js +120 -0
- package/dist/workers/workers/learning-consolidation.js +21 -1
- package/package.json +1 -1
- package/dist/cli/chunks/adapter-2HMUXHWY.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-M2NKRVRE.js +0 -2
- package/dist/cli/chunks/audit-EPB7ETMT.js +0 -3
- package/dist/cli/chunks/base-CCHC2DAC.js +0 -2
- package/dist/cli/chunks/brain-handler-FBMYEERK.js +0 -89
- package/dist/cli/chunks/browser-workflow-4DGHFYY3.js +0 -2
- package/dist/cli/chunks/chunk-37ZDGJ3H.js +0 -2
- package/dist/cli/chunks/chunk-5AQ7FXYG.js +0 -27
- package/dist/cli/chunks/chunk-KYTFIP6R.js +0 -2
- package/dist/cli/chunks/chunk-MYMIEQSZ.js +0 -65
- package/dist/cli/chunks/chunk-RCPD6F4R.js +0 -2
- package/dist/cli/chunks/chunk-TCWR6TDN.js +0 -2
- package/dist/cli/chunks/chunk-UQ72K44T.js +0 -149
- package/dist/cli/chunks/chunk-XXRTWG7O.js +0 -2
- package/dist/cli/chunks/chunk-ZSA6V5FH.js +0 -2
- package/dist/cli/chunks/client-2OVEDWGU.js +0 -2
- package/dist/cli/chunks/core-handlers-UXRRYP52.js +0 -2
- package/dist/cli/chunks/cross-domain-router-PV3VQVLO.js +0 -2
- package/dist/cli/chunks/daemon-ESUEM6VB.js +0 -10
- package/dist/cli/chunks/domain-transfer-TQYO3SVG.js +0 -2
- package/dist/cli/chunks/dream-UFUXVJQC.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-MBG3SARO.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-5HXA3QB3.js +0 -2
- package/dist/cli/chunks/hnsw-index-PZRQWBRG.js +0 -2
- package/dist/cli/chunks/hybrid-router-NQRIE2GG.js +0 -2
- package/dist/cli/chunks/impact-analyzer-46347ZDV.js +0 -2
- package/dist/cli/chunks/init-wizard-CJYP4WKO.js +0 -2
- package/dist/cli/chunks/kernel-22KQZ56U.js +0 -2
- package/dist/cli/chunks/knowledge-graph-KM3JDBGR.js +0 -2
- package/dist/cli/chunks/llm-router-service-IFO6GRRO.js +0 -2
- package/dist/cli/chunks/load-test-TTKCYAPB.js +0 -2
- package/dist/cli/chunks/memory-backend-ELHCX2ZT.js +0 -2
- package/dist/cli/chunks/memory-handlers-3SKYQZTL.js +0 -2
- package/dist/cli/chunks/pattern-null-store-TMXAYD43.js +0 -2
- package/dist/cli/chunks/protocol-executor-BPLR5EJC.js +0 -2
- package/dist/cli/chunks/provider-manager-4MMD5QKL.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-P7KNT3WZ.js +0 -2
- package/dist/cli/chunks/queen-coordinator-NBZZ4MGC.js +0 -2
- package/dist/cli/chunks/router-2RXR6J2Q.js +0 -2
- package/dist/cli/chunks/routing-feedback-AVAA76TK.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-X2YDJA55.js +0 -2
- package/dist/cli/chunks/safe-db-4PRU65BK.js +0 -2
- package/dist/cli/chunks/schedule-2AST5CHW.js +0 -2
- package/dist/cli/chunks/scheduler-SW6II7OU.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-OB5NEGAK.js +0 -2
- package/dist/cli/chunks/status-handler-HFPWSCBY.js +0 -45
- package/dist/cli/chunks/unified-memory-X7OJYGSD.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-O6HOD5YL.js +0 -2
- package/dist/cli/chunks/unified-persistence-C332CER2.js +0 -2
- package/dist/cli/chunks/visual-security-MPUG5HPI.js +0 -2
- package/dist/cli/chunks/witness-chain-Q4BZHPDF.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-4NDWECYK.js +0 -2
|
@@ -1,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 d}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.12.0");process.exit(0)}
|
|
2
|
+
import{b as d}from"./chunk-MBF3Q7FQ.js";import{a as c,c as f}from"./chunk-RHC7TFPU.js";import"./chunk-3AFNXU45.js";import*as s from"fs";import*as l from"path";import e from"chalk";f();var h=class{name="heartbeat";description="Manage the token-free heartbeat scheduler";cleanupAndExit;worker;constructor(t){this.cleanupAndExit=t}async getWorker(){if(!this.worker){let{HeartbeatSchedulerWorker:t}=await import("./heartbeat-scheduler-OSDPJT6A.js");this.worker=new t}return this.worker}register(t,o){let a=t.command("heartbeat").description(this.description);a.command("status").description("Show heartbeat worker status, health, and schedule").action(async()=>{await this.executeStatus()}),a.command("run-now").description("Trigger an immediate heartbeat cycle").option("-t, --timeout <ms>","Timeout in milliseconds (default: worker built-in 60s)").action(async n=>{let i=n.timeout?parseInt(n.timeout,10):void 0;await this.executeRunNow(i)}),a.command("history").description("Show recent heartbeat results").option("-n, --count <count>","Number of entries to show","10").action(async n=>{await this.executeHistory(parseInt(n.count,10)||10)}),a.command("log").description("Show today's daily log entries").option("-d, --date <date>","Show log for specific date (YYYY-MM-DD)").action(async n=>{await this.executeLog(n.date)}),a.command("pause").description("Pause the heartbeat worker").action(async()=>{await this.executePause()}),a.command("resume").description("Resume the heartbeat worker").action(async()=>{await this.executeResume()})}async executeStatus(){try{this.worker=await this.getWorker(),await this.worker.initialize();let t=this.worker.getHealth(),o=this.worker.lastResult;if(console.log(e.blue(`
|
|
3
3
|
Heartbeat Scheduler Status`)),console.log(e.gray(" "+"\u2500".repeat(35))),console.log(` Status: ${x(t.status)}`),console.log(` Health Score: ${y(t.healthScore)}${e.gray("/100")}`),this.worker.lastRunAt){let n=p(this.worker.lastRunAt);console.log(` Last Run: ${e.cyan(this.worker.lastRunAt.toISOString().replace("T"," ").slice(0,19))} ${e.gray(`(${n})`)}`)}else console.log(` Last Run: ${e.gray("never")}`);if(this.worker.nextRunAt){let n=p(this.worker.nextRunAt,!0);console.log(` Next Run: ${e.cyan(this.worker.nextRunAt.toISOString().replace("T"," ").slice(0,19))} ${e.gray(`(${n})`)}`)}console.log(` Total Runs: ${e.cyan(String(t.totalExecutions))}`);let a=t.totalExecutions>0?(t.successfulExecutions/t.totalExecutions*100).toFixed(1):"100.0";if(console.log(` Success Rate: ${e.cyan(a+"%")}`),o?.metrics?.domainMetrics){let n=o.metrics.domainMetrics;console.log(""),console.log(e.blue(" Last Result:")),console.log(` Promoted: ${e.cyan(String(n.promoted??0))} patterns`),console.log(` Deprecated: ${e.cyan(String(n.deprecated??0))} patterns`),console.log(` Decayed: ${e.cyan(String(n.decayed??0))} patterns`),console.log(` Pending Exp: ${e.cyan(String(n.pendingExperiences??0))}`),console.log(` Avg Conf: ${e.cyan(String(n.avgConfidence??0))}`)}console.log(""),await this.cleanupAndExit(0)}catch(t){console.error(e.red(`
|
|
4
4
|
Failed to get heartbeat status:`),c(t)),await this.cleanupAndExit(1)}}async executeRunNow(t){try{this.worker=await this.getWorker(),console.log(e.blue(`
|
|
5
5
|
Triggering heartbeat cycle...
|
|
@@ -8,7 +8,7 @@ import{b as d}from"./chunk-2KNFS3L5.js";import{a as c,c as f}from"./chunk-PEIQDQ
|
|
|
8
8
|
Heartbeat History (last ${o.length})`)),console.log(e.gray(" "+"\u2500".repeat(60)));for(let a of o){let n=a.success?e.green("OK"):e.red("FAIL"),i=a.timestamp.slice(0,19).replace("T"," "),u=a.domainMetrics||{};console.log(` ${e.gray(i)} ${n} score:${e.cyan(String(a.healthScore))} +${u.promoted??0}/-${u.deprecated??0} ${e.gray(d(a.durationMs))}`)}console.log(""),await this.cleanupAndExit(0)}catch(o){console.error(e.red(`
|
|
9
9
|
Failed to load history:`),c(o)),await this.cleanupAndExit(1)}}async executeLog(t){try{let o=t||new Date().toISOString().split("T")[0];if(!/^\d{4}-\d{2}-\d{2}$/.test(o)){console.error(e.red(`
|
|
10
10
|
Invalid date format: "${o}". Use YYYY-MM-DD.
|
|
11
|
-
`)),await this.cleanupAndExit(1);return}let{findProjectRoot:a}=await import("./unified-memory-
|
|
11
|
+
`)),await this.cleanupAndExit(1);return}let{findProjectRoot:a}=await import("./unified-memory-A5BS3LGX.js"),n=l.join(a(),".agentic-qe","logs"),i=l.join(n,`${o}.md`);if(!s.existsSync(i)){console.log(e.yellow(`
|
|
12
12
|
No daily log found for ${o}.
|
|
13
13
|
`)),await this.cleanupAndExit(0);return}let u=s.readFileSync(i,"utf-8");console.log(e.blue(`
|
|
14
14
|
Daily Log \u2014 ${o}`)),console.log(e.gray(" "+"\u2500".repeat(40)));for(let g of u.split(`
|
|
@@ -45,4 +45,4 @@ Examples:
|
|
|
45
45
|
aqe heartbeat log --date 2026-03-25
|
|
46
46
|
aqe heartbeat pause
|
|
47
47
|
aqe heartbeat resume
|
|
48
|
-
`}},m=100;async function w(){let{findProjectRoot:r}=await import("./unified-memory-
|
|
48
|
+
`}},m=100;async function w(){let{findProjectRoot:r}=await import("./unified-memory-A5BS3LGX.js");return l.join(r(),".agentic-qe","heartbeat-history.json")}async function b(r){try{let t=await w(),o=l.dirname(t);s.existsSync(o)||s.mkdirSync(o,{recursive:!0});let a=[];if(s.existsSync(t))try{a=JSON.parse(s.readFileSync(t,"utf-8"))}catch{a=[]}a.unshift({timestamp:r.timestamp.toISOString(),success:r.success,durationMs:r.durationMs,healthScore:r.metrics.healthScore,domainMetrics:r.metrics.domainMetrics}),a.length>m&&(a=a.slice(0,m)),s.writeFileSync(t,JSON.stringify(a,null,2))}catch{}}async function S(r){try{let t=await w();return s.existsSync(t)?JSON.parse(s.readFileSync(t,"utf-8")).slice(0,r):[]}catch{return[]}}function x(r){switch(r){case"idle":return e.cyan(r);case"running":return e.yellow(r);case"paused":return e.yellow(r);case"stopped":return e.gray(r);case"error":return e.red(r);default:return e.white(r)}}function y(r){return r>=80?e.green(String(r)):r>=50?e.yellow(String(r)):e.red(String(r))}function k(r){switch(r){case"improving":return e.green(r);case"stable":return e.cyan(r);case"degrading":return e.red(r);default:return e.gray(r)}}function p(r,t=!1){let o=t?r.getTime()-Date.now():Date.now()-r.getTime();return o<0?t?"now":"just now":o<6e4?`${Math.floor(o/1e3)}s ${t?"from now":"ago"}`:o<36e5?`${Math.floor(o/6e4)}m ${t?"from now":"ago"}`:`${Math.floor(o/36e5)}h ${t?"from now":"ago"}`}function A(r){return new h(r)}export{h as HeartbeatHandler,A as createHeartbeatHandler};
|
|
@@ -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{b as a}from"./chunk-FU5RNEXV.js";import"./chunk-DR7PCO3S.js";import"./chunk-7F7U2HUH.js";import"./chunk-PM566XEO.js";import"./chunk-VMP4M5PB.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-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{a as HeartbeatSchedulerWorker};
|
|
@@ -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,c as b}from"./chunk-AEX75YGI.js";import"./chunk-27JCWG5J.js";import"./chunk-2KHDGC7N.js";import"./chunk-3AFNXU45.js";b();export{a as HnswAdapter};
|
|
@@ -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}from"./chunk-KI5BP4X5.js";import"./chunk-MDT3LIXS.js";import"./chunk-TJEJ4UVX.js";import"./chunk-KJWQ7ENF.js";import"./chunk-AEX75YGI.js";import"./chunk-27JCWG5J.js";import"./chunk-2KHDGC7N.js";import"./chunk-3AFNXU45.js";export{a as DEFAULT_HNSW_CONFIG,b as HNSWIndex,d as benchmarkHNSW,c as createHNSWIndex};
|
|
@@ -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";var s=class{adapter;metadataMap=new Map;insertCount=0;constructor(e){this.adapter=e}async initialize(){}async insert(e,t,r){this.adapter.addByStringId(e,t),this.insertCount++,r&&this.metadataMap.set(e,r)}async search(e,t){return this.adapter.searchByArray(e,t).map(a=>({key:a.id,score:a.score,distance:1-a.score,metadata:this.metadataMap.get(a.id)}))}async batchInsert(e){for(let t of e)await this.insert(t.key,t.vector,t.metadata)}async delete(e){let t=this.adapter.removeByStringId(e);return t&&this.metadataMap.delete(e),t}async getStats(){return{nativeHNSW:!0,backendType:"ruvector-gnn",vectorCount:this.adapter.size(),indexSizeBytes:this.adapter.size()*this.adapter.dimensions()*4,avgSearchLatencyMs:this.adapter.lastSearchLatencyMs,p95SearchLatencyMs:0,p99SearchLatencyMs:0,searchOperations:0,insertOperations:this.insertCount}}async clear(){this.adapter.clear(),this.metadataMap.clear(),this.insertCount=0}isNativeAvailable(){return!0}};export{s as HnswLegacyBridge};
|
|
@@ -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-IJUYHIKN.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};
|
|
@@ -1,11 +1,11 @@
|
|
|
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 v,b as fe,c as he}from"./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 v,b as fe,c as he}from"./chunk-VS4GMNJK.js";import{a as pe,b as ge}from"./chunk-G6RKUEGL.js";import{a as ue}from"./chunk-4SALW7OT.js";import{a as Y}from"./chunk-DQDFACYW.js";import{d as G,h as ne}from"./chunk-GCF42L7M.js";import"./chunk-5YGESYBC.js";import"./chunk-5VBPIJUZ.js";import"./chunk-KDLYTJ5C.js";import"./chunk-36MPDANH.js";import{b as K}from"./chunk-VMP4M5PB.js";import"./chunk-WT4ZDDFM.js";import"./chunk-FI5SSLEF.js";import"./chunk-NW7G57NR.js";import"./chunk-XEYW3V5I.js";import"./chunk-Z3W3R4CW.js";import"./chunk-VZ67ZDB3.js";import{i as M,m as U}from"./chunk-C4SZSPXY.js";import"./chunk-SSXAW3ER.js";import{a as $e}from"./chunk-MDT3LIXS.js";import{c as de}from"./chunk-TJEJ4UVX.js";import{b as R}from"./chunk-L5ZLOW3K.js";import{b as le,d as Ie}from"./chunk-K5SN66B4.js";import{a as me}from"./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";import{Command as at}from"commander";import $ from"chalk";import ke from"node:path";U();import{randomUUID as F}from"crypto";import C from"chalk";var H="dream-scheduler:hook-state";async function x(o){try{let e=await o.get(H);return e||(e={lastDreamTime:null,experienceCount:0,sessionStartTime:new Date().toISOString(),totalDreamsThisSession:0}),e.experienceCount++,await o.set(H,e),e.experienceCount}catch{return 0}}async function W(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-A5BS3LGX.js"),t=e();t.isInitialized()||await t.initialize();let{initializeExperienceCapture:n}=await import("./experience-capture-middleware-E3RYQB6Z.js");await n();let r=t.getDatabase();try{r.pragma("busy_timeout = 60000")}catch{}let s=`cli-${Date.now()}-${F().slice(0,8)}`,a=o.durationMs||0,c;if(o.success){let i=a>0&&a<5e3?.1:0,h=o.source.includes("post-task")?.1:o.source.includes("post-edit")?.05:0;c=Math.min(.95,.7+i+h)}else{let i=o.source.includes("post-task")?.15:o.source.includes("post-edit")?.1:0;c=Math.min(.6,.3+i)}r.prepare(`
|
|
4
4
|
INSERT OR REPLACE INTO captured_experiences
|
|
5
5
|
(id, task, agent, domain, success, quality, duration_ms,
|
|
6
6
|
started_at, completed_at, source)
|
|
7
7
|
VALUES (?, ?, ?, ?, ?, ?, ?, datetime('now'), datetime('now'), ?)
|
|
8
|
-
`).run(s,o.task.slice(0,500),o.agent,o.domain,o.success?1:0,c,a,o.source),(async()=>{try{let{computeRealEmbedding:i}=await import("./real-embeddings-
|
|
8
|
+
`).run(s,o.task.slice(0,500),o.agent,o.domain,o.success?1:0,c,a,o.source),(async()=>{try{let{computeRealEmbedding:i}=await import("./real-embeddings-IO3F4ZFR.js"),h=`${o.domain}: ${o.task}`.slice(0,512),l=await i(h);r.prepare("UPDATE captured_experiences SET embedding = ?, embedding_dimension = ? WHERE id = ?").run(Buffer.from(new Float32Array(l).buffer),l.length,s)}catch{}})()}catch(e){console.error(C.dim(`[hooks] persistCommandExperience: ${e instanceof Error?e.message:"unknown"}`))}}async function oe(o){let{getUnifiedMemory:e}=await import("./unified-memory-A5BS3LGX.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}try{n.exec(`
|
|
9
9
|
CREATE TABLE IF NOT EXISTS captured_experiences (
|
|
10
10
|
id TEXT PRIMARY KEY,
|
|
11
11
|
task TEXT NOT NULL,
|
|
@@ -40,7 +40,7 @@ import{a as v,b as fe,c as he}from"./chunk-KUZMVH6N.js";import{a as pe,b as ge}f
|
|
|
40
40
|
FOREIGN KEY (experience_id) REFERENCES captured_experiences(id) ON DELETE CASCADE
|
|
41
41
|
);
|
|
42
42
|
CREATE INDEX IF NOT EXISTS idx_exp_apps_experience ON experience_applications(experience_id);
|
|
43
|
-
`)}catch{}try{let u=n.prepare("PRAGMA table_info(qe_trajectories)").all();u.length>0&&!u.some(
|
|
43
|
+
`)}catch{}try{let u=n.prepare("PRAGMA table_info(qe_trajectories)").all();u.length>0&&!u.some(y=>y.name==="metadata_json")&&n.exec("ALTER TABLE qe_trajectories ADD COLUMN metadata_json TEXT")}catch{}let r=`exp-${Date.now()}-${F().slice(0,8)}`,s=`${o.agent}:${o.taskId}`,a=o.durationMs??0,c=o.success?1:0,i=a<100?1:a<500?.8:a<2e3?.6:a<5e3?.4:a<1e4?.2:.1,h=.25*c+.325+.1*i,l=null,p=0,d=0,k=n.transaction(()=>{n.prepare(`
|
|
44
44
|
INSERT INTO captured_experiences
|
|
45
45
|
(id, task, agent, domain, success, quality, duration_ms,
|
|
46
46
|
model_tier, started_at, completed_at, source)
|
|
@@ -49,13 +49,13 @@ import{a as v,b as fe,c as he}from"./chunk-KUZMVH6N.js";import{a as pe,b as ge}f
|
|
|
49
49
|
INSERT INTO experience_applications
|
|
50
50
|
(id, experience_id, task, success, tokens_saved, feedback, applied_at)
|
|
51
51
|
VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
|
|
52
|
-
`).run(`app-${Date.now()}-${
|
|
52
|
+
`).run(`app-${Date.now()}-${F().slice(0,8)}`,r,s,o.success?1:0,Math.round(h*100),`[Patch 060] post-task outcome: ${o.success?"success":"failure"}`);try{let m=n.prepare(`
|
|
53
53
|
SELECT key, value FROM kv_store
|
|
54
54
|
WHERE namespace = 'task-bridge'
|
|
55
55
|
AND (expires_at IS NULL OR expires_at > strftime('%s','now') * 1000)
|
|
56
56
|
ORDER BY created_at DESC
|
|
57
57
|
LIMIT 1
|
|
58
|
-
`).get();if(m?.value)try{l=JSON.parse(m.value)}catch{l=null}if(l&&Array.isArray(l.selectedPatternIds)&&l.selectedPatternIds.length>0){let T=l.estimatedTokenSavings&&l.selectedPatternIds.length?Math.round(l.estimatedTokenSavings/l.selectedPatternIds.length):0,
|
|
58
|
+
`).get();if(m?.value)try{l=JSON.parse(m.value)}catch{l=null}if(l&&Array.isArray(l.selectedPatternIds)&&l.selectedPatternIds.length>0){let T=l.estimatedTokenSavings&&l.selectedPatternIds.length?Math.round(l.estimatedTokenSavings/l.selectedPatternIds.length):0,D=n.prepare(`
|
|
59
59
|
INSERT INTO experience_applications
|
|
60
60
|
(id, experience_id, task, success, tokens_saved, feedback, applied_at)
|
|
61
61
|
VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
|
|
@@ -71,29 +71,25 @@ import{a as v,b as fe,c as he}from"./chunk-KUZMVH6N.js";import{a as pe,b as ge}f
|
|
|
71
71
|
AND successful_uses >= 3
|
|
72
72
|
AND success_rate >= 0.7
|
|
73
73
|
AND confidence >= 0.6
|
|
74
|
-
`);for(let S of l.selectedPatternIds){
|
|
74
|
+
`);for(let S of l.selectedPatternIds){D.run(`app-${Date.now()}-${F().slice(0,8)}`,r,`${s}:pattern:${S}`,o.success?1:0,T,`[Patch 160+300] task-bridge pattern_id=${S} ts=${T}`);try{me(n,{patternId:S,success:o.success,metrics:{tokens_saved:T,source:"cli-hook-post-task",experience_id:r},feedback:`[Patch 160+300] task-bridge pattern_id=${S} ts=${T}`})}catch{}try{let j=L.get(S);j?.tier==="short-term"&&j.successful_uses>=3&&j.success_rate>=.7&&j.confidence>=.6&&P.run(S)}catch{}}m&&n.prepare("DELETE FROM kv_store WHERE namespace='task-bridge' AND key = ?").run(m.key)}}catch(m){console.error(C.dim(`[hooks] post-task bridge: ${m instanceof Error?m.message:"unknown"}`))}let u=`traj-${Date.now()}-${F().slice(0,8)}`,y=o.parentAgentId!==void 0||o.depth!==void 0?JSON.stringify({...o.parentAgentId!==void 0?{parentAgentId:o.parentAgentId}:{},...o.depth!==void 0?{depth:o.depth}:{}}):null;n.prepare(`
|
|
75
75
|
INSERT INTO qe_trajectories (id, task, agent, domain, started_at, ended_at, success, steps_json, metadata_json)
|
|
76
76
|
VALUES (?, ?, ?, ?, datetime('now'), datetime('now'), ?, ?, ?)
|
|
77
|
-
`).run(u,s,o.agent,o.domain??"general",o.success?1:0,JSON.stringify([{step:1,task:o.taskId,success:o.success}]),
|
|
77
|
+
`).run(u,s,o.agent,o.domain??"general",o.success?1:0,JSON.stringify([{step:1,task:o.taskId,success:o.success}]),y);try{let m=n.prepare(`
|
|
78
78
|
SELECT id, task, agent, success, started_at, completed_at
|
|
79
79
|
FROM captured_experiences
|
|
80
80
|
WHERE consolidated_into IS NULL
|
|
81
81
|
AND task LIKE ?
|
|
82
82
|
AND started_at > datetime('now', '-1 hour')
|
|
83
83
|
ORDER BY started_at ASC
|
|
84
|
-
`).all(`%:${o.taskId}`);if(m.length>=2){let T=`traj-multi-${Date.now()}-${
|
|
84
|
+
`).all(`%:${o.taskId}`);if(m.length>=2){let T=`traj-multi-${Date.now()}-${F().slice(0,8)}`,D=JSON.stringify(m.map((S,j)=>({step:j+1,task:S.task,agent:S.agent,success:!!S.success,started_at:S.started_at,completed_at:S.completed_at}))),L=m.every(S=>!!S.success);n.prepare(`
|
|
85
85
|
INSERT INTO qe_trajectories (id, task, agent, domain, started_at, ended_at, success, steps_json)
|
|
86
86
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
87
|
-
`).run(T,`multi:${o.taskId}`,o.agent,o.domain??"general",m[0].started_at,m[m.length-1].completed_at,L?1:0,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
ORDER BY created_at DESC
|
|
94
|
-
LIMIT 3
|
|
95
|
-
)
|
|
96
|
-
`).run().changes??0}catch{}});try{k()}catch(u){console.error(H.dim(`[hooks] persistTaskOutcome txn: ${u instanceof Error?u.message:"unknown"}`))}return(async()=>{try{let{computeRealEmbedding:u}=await import("./real-embeddings-FCGNYWLL.js"),E=`${o.domain??"general"}: ${s}`.slice(0,512),m=await u(E);n.prepare("UPDATE captured_experiences SET embedding = ?, embedding_dimension = ? WHERE id = ?").run(Buffer.from(new Float32Array(m).buffer),m.length,r)}catch{}})(),{experienceId:r,qualityScore:h,bridge:l,stitchedSiblings:p,insightsApplied:d}}async function W(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-X7OJYGSD.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}let r=`${o.taskType}|${o.priority}|${o.domain||"any"}`,s=o.agent,a=`q-learning:aqe-hook-router:${r}:${s}`,c=o.success?.1:-1,i=.1,h=.9,l=n.prepare(`
|
|
87
|
+
`).run(T,`multi:${o.taskId}`,o.agent,o.domain??"general",m[0].started_at,m[m.length-1].completed_at,L?1:0,D);let P=m.map(()=>"?").join(",");n.prepare(`UPDATE captured_experiences SET consolidated_into = ? WHERE id IN (${P})`).run(T,...m.map(S=>S.id)),p=m.length}}catch(m){console.error(C.dim(`[hooks] post-task stitch: ${m instanceof Error?m.message:"unknown"}`))}});try{k()}catch(u){console.error(C.dim(`[hooks] persistTaskOutcome txn: ${u instanceof Error?u.message:"unknown"}`))}if(o.success)try{let u=n.prepare(`
|
|
88
|
+
SELECT id FROM dream_insights
|
|
89
|
+
WHERE actionable = 1 AND (applied = 0 OR applied IS NULL)
|
|
90
|
+
ORDER BY created_at DESC
|
|
91
|
+
LIMIT 3
|
|
92
|
+
`).all();if(u.length>0){let{createDreamEngine:y}=await import("./dream-R6MQQQ3N.js"),m=y();await m.initialize();try{for(let T of u){let D=await m.applyInsight(T.id);D.success&&D.patternId&&d++}}finally{await m.close()}}}catch(u){console.error(C.dim(`[hooks] post-task insight apply: ${u instanceof Error?u.message:"unknown"}`))}return(async()=>{try{let{computeRealEmbedding:u}=await import("./real-embeddings-IO3F4ZFR.js"),y=`${o.domain??"general"}: ${s}`.slice(0,512),m=await u(y);n.prepare("UPDATE captured_experiences SET embedding = ?, embedding_dimension = ? WHERE id = ?").run(Buffer.from(new Float32Array(m).buffer),m.length,r)}catch{}})(),{experienceId:r,qualityScore:h,bridge:l,stitchedSiblings:p,insightsApplied:d}}async function J(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-A5BS3LGX.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}let r=`${o.taskType}|${o.priority}|${o.domain||"any"}`,s=o.agent,a=`q-learning:aqe-hook-router:${r}:${s}`,c=o.success?.1:-1,i=.1,h=.9,l=n.prepare(`
|
|
97
93
|
SELECT q_value FROM rl_q_values WHERE id = ?
|
|
98
94
|
`).get(a),p=l&&typeof l.q_value=="number"?l.q_value:0,d=n.prepare(`
|
|
99
95
|
SELECT MAX(q_value) AS m FROM rl_q_values WHERE state_key = ?
|
|
@@ -106,7 +102,7 @@ import{a as v,b as fe,c as he}from"./chunk-KUZMVH6N.js";import{a as pe,b as ge}f
|
|
|
106
102
|
visits = visits + 1,
|
|
107
103
|
last_reward = excluded.last_reward,
|
|
108
104
|
updated_at = datetime('now')
|
|
109
|
-
`).run(a,r,s,u,c,o.domain||"any")}catch(e){console.error(
|
|
105
|
+
`).run(a,r,s,u,c,o.domain||"any")}catch(e){console.error(C.dim(`[hooks] q-learning update: ${e instanceof Error?e.message:"unknown"}`))}}async function re(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-A5BS3LGX.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}n.prepare(`
|
|
110
106
|
UPDATE routing_outcomes
|
|
111
107
|
SET success = ?, quality_score = ?, duration_ms = ?
|
|
112
108
|
WHERE id IN (
|
|
@@ -117,7 +113,7 @@ import{a as v,b as fe,c as he}from"./chunk-KUZMVH6N.js";import{a as pe,b as ge}f
|
|
|
117
113
|
ORDER BY (CASE WHEN used_agent = ? THEN 0 ELSE 1 END), created_at DESC
|
|
118
114
|
LIMIT 1
|
|
119
115
|
)
|
|
120
|
-
`).run(o.success?1:0,o.qualityScore,o.durationMs,o.agent)}catch(e){console.error(
|
|
116
|
+
`).run(o.success?1:0,o.qualityScore,o.durationMs,o.agent)}catch(e){console.error(C.dim(`[hooks] routing UPDATE: ${e instanceof Error?e.message:"unknown"}`))}}async function se(){let{getUnifiedMemory:o}=await import("./unified-memory-A5BS3LGX.js"),e=o();e.isInitialized()||await e.initialize();let t=e.getDatabase();try{t.pragma("busy_timeout = 60000")}catch{}let n=new Set(t.prepare("PRAGMA table_info(captured_experiences)").all().map(i=>i.name)),r=[["consolidated_into","TEXT DEFAULT NULL"],["consolidation_count","INTEGER DEFAULT 1"],["quality_updated_at","TEXT DEFAULT NULL"],["reuse_success_count","INTEGER DEFAULT 0"],["reuse_failure_count","INTEGER DEFAULT 0"]];for(let[i,h]of r)n.has(i)||t.exec(`ALTER TABLE captured_experiences ADD COLUMN ${i} ${h}`);let s=t.prepare(`
|
|
121
117
|
SELECT
|
|
122
118
|
domain,
|
|
123
119
|
agent,
|
|
@@ -133,7 +129,7 @@ import{a as v,b as fe,c as he}from"./chunk-KUZMVH6N.js";import{a as pe,b as ge}f
|
|
|
133
129
|
HAVING cnt >= 3 AND avg_quality >= 0.5 AND success_rate >= 0.6
|
|
134
130
|
ORDER BY avg_quality DESC
|
|
135
131
|
LIMIT 50
|
|
136
|
-
`).all();if(s.length===0)return 0;let{v4:a}=await import("./dist-node-
|
|
132
|
+
`).all();if(s.length===0)return 0;let{v4:a}=await import("./dist-node-3EM2XH54.js"),c=0;for(let i of s)try{let h=new Date().toISOString().slice(0,7),l=`${i.agent}-${i.domain}-${h}`,p=t.prepare(`
|
|
137
133
|
SELECT id FROM qe_patterns
|
|
138
134
|
WHERE qe_domain = ? AND name = ?
|
|
139
135
|
LIMIT 1
|
|
@@ -145,33 +141,33 @@ import{a as v,b as fe,c as he}from"./chunk-KUZMVH6N.js";import{a as pe,b as ge}f
|
|
|
145
141
|
quality_score = MIN(0.99, quality_score + 0.005),
|
|
146
142
|
updated_at = datetime('now')
|
|
147
143
|
WHERE id = ?
|
|
148
|
-
`).run(i.cnt,i.successes,p.id);else{let d=a(),k=Math.min(.95,i.avg_quality*.8+i.success_rate*.2),u=k*.3+Math.min(i.cnt,100)/100*.2+i.success_rate*.5,
|
|
144
|
+
`).run(i.cnt,i.successes,p.id);else{let d=a(),k=Math.min(.95,i.avg_quality*.8+i.success_rate*.2),u=k*.3+Math.min(i.cnt,100)/100*.2+i.success_rate*.5,y=`Auto-consolidated from ${i.cnt} experiences. Agent: ${i.agent}, success rate: ${(i.success_rate*100).toFixed(0)}%`,m=(i.sources||"").split(",").filter(Boolean);t.prepare(`
|
|
149
145
|
INSERT INTO qe_patterns (
|
|
150
146
|
id, pattern_type, qe_domain, domain, name, description,
|
|
151
147
|
confidence, usage_count, success_rate, quality_score, tier,
|
|
152
148
|
template_json, context_json, created_at, successful_uses
|
|
153
149
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now'), ?)
|
|
154
|
-
`).run(d,"workflow",i.domain,i.domain,l,
|
|
150
|
+
`).run(d,"workflow",i.domain,i.domain,l,y,k,i.cnt,i.success_rate,u,"short-term",JSON.stringify({type:"workflow",content:`${i.agent} pattern for ${i.domain}`,variables:[]}),JSON.stringify({tags:m,sourceType:"session-consolidation",extractedAt:new Date().toISOString()}),i.successes);let{ensurePatternEmbedding:T}=await import("./embed-and-insert-pattern-J5ZFM6YX.js");await T(t,d,l,y,m),c++}t.prepare(`
|
|
155
151
|
UPDATE captured_experiences
|
|
156
152
|
SET application_count = application_count + 1
|
|
157
153
|
WHERE domain = ? AND agent = ? AND application_count = 0
|
|
158
|
-
`).run(i.domain,i.agent)}catch{}return c}var g={reasoningBank:null,hookRegistry:null,coherenceService:null,sessionId:null,initialized:!1,initializationPromise:null};async function _(){if(g.initializationPromise&&await g.initializationPromise,g.initialized&&g.reasoningBank&&g.hookRegistry)return{reasoningBank:g.reasoningBank,hookRegistry:g.hookRegistry};if(g.initializationPromise=
|
|
159
|
-
\u{1F4DD} Pre-Edit Analysis`)),console.log(
|
|
160
|
-
\u{1F3AF} Recommended Agent:`)
|
|
161
|
-
\u{1F4A1} Guidance:`)),
|
|
154
|
+
`).run(i.domain,i.agent)}catch{}return c}var g={reasoningBank:null,hookRegistry:null,coherenceService:null,sessionId:null,initialized:!1,initializationPromise:null};async function _(){if(g.initializationPromise&&await g.initializationPromise,g.initialized&&g.reasoningBank&&g.hookRegistry)return{reasoningBank:g.reasoningBank,hookRegistry:g.hookRegistry};if(g.initializationPromise=Le(),await g.initializationPromise,g.initializationPromise=null,!g.reasoningBank||!g.hookRegistry)throw new Error("Failed to initialize hooks system");return{reasoningBank:g.reasoningBank,hookRegistry:g.hookRegistry}}async function Le(){if(!g.initialized)try{let o=R(),e=ke.join(o,".agentic-qe"),t=await O(e);try{g.coherenceService=await pe(ge),console.log($.dim("[hooks] CoherenceService initialized with WASM engines"))}catch(a){console.log($.dim(`[hooks] CoherenceService WASM unavailable, using fallback: ${a instanceof Error?a.message:"unknown"}`))}g.reasoningBank=ne(t,void 0,{enableLearning:!0,enableGuidance:!0,enableRouting:!0,embeddingDimension:384,useONNXEmbeddings:!0},g.coherenceService??void 0);let n=1e4,r=new AbortController,s=setTimeout(()=>r.abort(new Error("ReasoningBank init timeout")),n);try{await g.reasoningBank.initialize({signal:r.signal})}finally{clearTimeout(s)}try{let{getSharedRvfDualWriter:a}=await import("./shared-rvf-dual-writer-SZW3J7ZK.js"),c=await a();c&&g.reasoningBank.setRvfDualWriter(c)}catch(a){process.env.DEBUG&&console.debug("[hooks] RVF wiring skipped:",a instanceof Error?a.message:a)}g.hookRegistry=he(g.reasoningBank),g.initialized=!0,console.log($.dim("[hooks] System initialized"))}catch(o){console.warn($.yellow(`[hooks] Using fallback mode: ${o instanceof Error?o.message:"unknown error"}`));let e=Pe();g.reasoningBank=ne(e,void 0,{enableLearning:!0,enableGuidance:!0,enableRouting:!0}),g.hookRegistry=new fe,g.hookRegistry.initialize(g.reasoningBank),g.initialized=!0}}function q(o){try{o.pragma("busy_timeout = 60000")}catch{}}async function O(o){let t=new ue({sqlite:{path:ke.join(o,"memory.db"),walMode:!0,poolSize:3,busyTimeout:6e4},enableFallback:!0,defaultNamespace:"qe-patterns"}),n=new AbortController,r=setTimeout(()=>n.abort(new Error("Backend init timeout")),5e3);try{await t.initialize({signal:n.signal})}finally{clearTimeout(r)}return t}function Pe(){let o=new Map;return{initialize:async()=>{},dispose:async()=>{o.clear()},get:async e=>{let t=o.get(e);return t?t.value:void 0},set:async(e,t,n)=>{o.set(e,{value:t})},delete:async e=>o.delete(e),has:async e=>o.has(e),search:async(e,t)=>{let n=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(n.replace(/\*/g,".*"));return Array.from(o.keys()).filter(s=>r.test(s))},vectorSearch:async(e,t)=>[],storeVector:async(e,t,n)=>{},count:async e=>{let t=0,n=`${e}:`;for(let r of o.keys())r.startsWith(n)&&t++;return t},hasCodeIntelligenceIndex:async()=>{let e="code-intelligence:kg:";for(let t of o.keys())if(t.startsWith(e))return!0;return!1}}}function f(o){console.log(JSON.stringify(o,null,2))}function N(o){console.log($.green("\u2713"),o)}function b(o){console.error($.red("\u2717"),o)}function Z(o){if(o.length===0){console.log($.dim(" No specific guidance"));return}o.forEach((e,t)=>{console.log($.cyan(` ${t+1}.`),e)})}async function B(o=500){return process.stdin.isTTY?"":new Promise(e=>{let t="",n=setTimeout(()=>{process.stdin.removeAllListeners(),process.stdin.pause(),e(t)},o);process.stdin.setEncoding("utf8"),process.stdin.on("data",r=>{t+=r}),process.stdin.on("end",()=>{clearTimeout(n),e(t)}),process.stdin.on("error",()=>{clearTimeout(n),e(t)}),process.stdin.resume()})}function ye(o){if(!o.trim())return"";let e;try{e=JSON.parse(o)}catch{return""}let t=e.tool_input,n=e.toolInput,r=[t?.file_path,t?.filePath,n?.file_path,n?.filePath,e.file_path,e.filePath];for(let s of r)if(typeof s=="string"&&s.trim())return s;return""}function Ee(o){if(!o.trim())return"";let e;try{e=JSON.parse(o)}catch{return""}let t=e.tool_input,n=e.toolInput,r=[t?.subagent_type,t?.subagentType,n?.subagent_type,n?.subagentType,e.subagent_type,e.subagentType];for(let s of r)if(typeof s=="string"&&s.trim())return s;return""}import I from"chalk";import Ce from"node:path";U();function Te(o){o.command("pre-edit").description("Get context and guidance before editing a file").requiredOption("-f, --file <path>","File path to edit").option("-o, --operation <type>","Operation type: create, update, delete, refactor","update").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),r=(await t.emit(v.PreTestGeneration,{targetFile:e.file,testType:"unit",operation:e.operation}))[0]||{success:!0,guidance:[],routing:null};if(e.json){let s=r.guidance||[],c=[r.routing?.recommendedAgent?`Recommended agent: ${r.routing.recommendedAgent} (${(r.routing.confidence*100).toFixed(0)}% confidence).`:"",...s.map(i=>i)].filter(Boolean).join(" ");f({hookSpecificOutput:{hookEventName:"PreToolUse",additionalContext:c||void 0},file:e.file,operation:e.operation,patterns:r.routing?.patterns?.length||0})}else console.log(I.bold(`
|
|
155
|
+
\u{1F4DD} Pre-Edit Analysis`)),console.log(I.dim(` File: ${e.file}`)),console.log(I.dim(` Operation: ${e.operation}`)),r.routing&&(console.log(I.bold(`
|
|
156
|
+
\u{1F3AF} Recommended Agent:`),I.cyan(r.routing.recommendedAgent)),console.log(I.dim(` Confidence: ${(r.routing.confidence*100).toFixed(1)}%`))),console.log(I.bold(`
|
|
157
|
+
\u{1F4A1} Guidance:`)),Z(r.guidance||[]);return}catch(t){throw b(`pre-edit failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("post-edit").description("Record editing outcome for pattern learning").requiredOption("-f, --file <path>","File path that was edited").option("--success","Edit was successful").option("--failure","Edit failed").option("--pattern-id <id>","Pattern ID that was applied").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n=e.success||!e.failure,r=e.file||"";if(!r.trim())try{let p=await B();r=ye(p)}catch{}let s=r.split("/").pop()||"unknown",c=/\.(test|spec)\.(ts|js|tsx|jsx)$/.test(s)?"test-generation":"code-intelligence",i=e.patternId||`edit:${c}:${s}`,l=(await t.emit(v.PostTestGeneration,{targetFile:r,success:n,patternId:i,generatedTests:null,testCount:0}))[0]||{success:!0,patternsLearned:0};try{let{reasoningBank:p}=await _();await p.recordOutcome({patternId:i,success:n,metrics:{executionTimeMs:0},feedback:`Edit ${n?"succeeded":"failed"}: ${r}`})}catch{}try{await W({task:`edit: ${r}`,agent:"cli-hook",domain:c,success:n,source:"cli-hook-post-edit"})}catch{}try{let p=R(),d=Ce.join(p,".agentic-qe"),k=await O(d);await x(k)}catch{}e.json?f({success:!0,file:r,editSuccess:n,patternsLearned:l.patternsLearned||0,dreamTriggered:!1,dreamReason:"deferred-to-kernel"}):(N(`Recorded edit outcome for ${r||"(unknown file)"}`),l.patternsLearned&&console.log(I.green(` Patterns learned: ${l.patternsLearned}`)));return}catch(t){throw b(`post-edit failed: ${t instanceof Error?t.message:"unknown"}`),t}})}import{randomUUID as qe}from"crypto";U();import A from"chalk";import je from"node:path";function Me(o){if(!o.trim())return"";let e;try{e=JSON.parse(o)}catch{return o.trim()}let t=[e.prompt,e.user_prompt,e.command,e.tool_input?.prompt,e.tool_input?.description,e.toolInput?.prompt,e.toolInput?.description];for(let n of t)if(typeof n=="string"&&n.trim())return n;return""}function _e(o){o.command("route").description("Route a task to the optimal QE agent").option("-t, --task <description>","Task description (falls back to stdin event JSON)").option("-d, --domain <domain>","Target QE domain hint").option("-c, --capabilities <caps...>","Required capabilities").option("--json","Output as JSON").action(async e=>{try{let t=e.task??"";if(!t.trim()){let c=await B();t=Me(c)}if(!t.trim())throw new Error("No task provided. Pass --task <description> or pipe a Claude Code hook event JSON to stdin.");let{reasoningBank:n}=await _(),r={task:t,domain:e.domain,capabilities:e.capabilities},s=await n.routeTask(r);if(!s.success)throw new Error(s.error.message);let a=s.value;e.json?f({recommendedAgent:a.recommendedAgent,confidence:a.confidence,alternatives:a.alternatives,domains:a.domains,patternCount:a.patterns.length,guidance:a.guidance,reasoning:a.reasoning,exploration:a.exploration??!1,criticality:a.criticality??null,qWeight:a.qWeight??null}):(console.log(A.bold(`
|
|
162
158
|
\u{1F3AF} Task Routing Result`)),console.log(A.dim(` Task: "${t}"`)),console.log(A.bold(`
|
|
163
159
|
\u{1F464} Recommended Agent:`),A.cyan(a.recommendedAgent)),console.log(A.dim(` Confidence: ${(a.confidence*100).toFixed(1)}%`)),a.alternatives.length>0&&(console.log(A.bold(`
|
|
164
160
|
\u{1F504} Alternatives:`)),a.alternatives.forEach(c=>{console.log(A.dim(` - ${c.agent}: ${(c.score*100).toFixed(1)}%`))})),console.log(A.bold(`
|
|
165
161
|
\u{1F4C2} Detected Domains:`),a.domains.join(", ")),console.log(A.bold(`
|
|
166
|
-
\u{1F4A1} Guidance:`)),
|
|
167
|
-
\u{1F4D6} Reasoning:`),A.dim(a.reasoning)));try{let{getUnifiedMemory:c}=await import("./unified-memory-
|
|
162
|
+
\u{1F4A1} Guidance:`)),Z(a.guidance),console.log(A.bold(`
|
|
163
|
+
\u{1F4D6} Reasoning:`),A.dim(a.reasoning)));try{let{getUnifiedMemory:c}=await import("./unified-memory-A5BS3LGX.js"),i=c();i.isInitialized()||await i.initialize();let h=i.getDatabase();q(h),Y(h);let l=`route-${Date.now()}-${qe().slice(0,8)}`,p=a.confidence<.5,d=a;h.prepare(`
|
|
168
164
|
INSERT OR REPLACE INTO routing_outcomes (
|
|
169
165
|
id, task_json, decision_json, used_agent,
|
|
170
166
|
followed_recommendation, success, quality_score,
|
|
171
167
|
duration_ms, error,
|
|
172
168
|
exploration, criticality, q_weight
|
|
173
169
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
174
|
-
`).run(l,JSON.stringify({description:t,domain:e.domain}),JSON.stringify({recommended:a.recommendedAgent,confidence:a.confidence,alternatives:a.alternatives,lowConfidence:p,exploration:d.exploration??!1,criticality:d.criticality??null,qWeight:d.qWeight??null}),a.recommendedAgent,1,0,-1,0,p?"low-confidence":null,d.exploration?1:0,d.criticality??null,d.qWeight??null);let k=R(),u=
|
|
170
|
+
`).run(l,JSON.stringify({description:t,domain:e.domain}),JSON.stringify({recommended:a.recommendedAgent,confidence:a.confidence,alternatives:a.alternatives,lowConfidence:p,exploration:d.exploration??!1,criticality:d.criticality??null,qWeight:d.qWeight??null}),a.recommendedAgent,1,0,-1,0,p?"low-confidence":null,d.exploration?1:0,d.criticality??null,d.qWeight??null);let k=R(),u=je.join(k,".agentic-qe"),y=await O(u);await x(y)}catch(c){console.error(A.dim(`[hooks] route persist: ${c instanceof Error?c.message:"unknown"}`))}return}catch(t){throw b(`route failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("post-route").description("Close the most-recent route sentinel from a Stop hook (#451)").option("--success [bool]","Whether the turn completed successfully","true").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0,n=.325+(t?.25:0)+.1,r=M();r.isInitialized()||await r.initialize();let s=r.getDatabase();q(s);let a=s.prepare(`
|
|
175
171
|
SELECT id, task_json, used_agent FROM routing_outcomes
|
|
176
172
|
WHERE quality_score = -1
|
|
177
173
|
AND task_json NOT LIKE '%"taskId"%'
|
|
@@ -181,7 +177,7 @@ import{a as v,b as fe,c as he}from"./chunk-KUZMVH6N.js";import{a as pe,b as ge}f
|
|
|
181
177
|
UPDATE routing_outcomes
|
|
182
178
|
SET success = ?, quality_score = ?, duration_ms = 0, error = NULL
|
|
183
179
|
WHERE id = ?
|
|
184
|
-
`).run(t?1:0,n,a.id):{changes:0};if(a)try{let h=JSON.parse(a.task_json),l=String(h.description??"");l&&await
|
|
180
|
+
`).run(t?1:0,n,a.id):{changes:0};if(a)try{let h=JSON.parse(a.task_json),l=String(h.description??"");l&&await J({taskType:G(l),priority:"normal",domain:K(l)[0]??"any",agent:a.used_agent,success:t})}catch{}let i=s.prepare(`
|
|
185
181
|
UPDATE routing_outcomes
|
|
186
182
|
SET success = 0,
|
|
187
183
|
quality_score = 0.325,
|
|
@@ -190,20 +186,20 @@ import{a as v,b as fe,c as he}from"./chunk-KUZMVH6N.js";import{a as pe,b as ge}f
|
|
|
190
186
|
WHERE quality_score = -1
|
|
191
187
|
AND task_json NOT LIKE '%"taskId"%'
|
|
192
188
|
AND created_at < datetime('now', '-300 seconds')
|
|
193
|
-
`).run();e.json?f({success:!0,resolved:c.changes>0,staleSwept:i.changes,qualityScore:n,turnSuccess:t}):i.changes>0&&console.log(A.dim(`[hooks] post-route: swept ${i.changes} stale sentinel(s)`));return}catch(t){e.json?f({success:!1,error:t instanceof Error?t.message:"unknown"}):console.error(A.dim(`[hooks] post-route: ${t instanceof Error?t.message:"unknown"}`));return}})}import
|
|
189
|
+
`).run();e.json?f({success:!0,resolved:c.changes>0,staleSwept:i.changes,qualityScore:n,turnSuccess:t}):i.changes>0&&console.log(A.dim(`[hooks] post-route: swept ${i.changes} stale sentinel(s)`));return}catch(t){e.json?f({success:!1,error:t instanceof Error?t.message:"unknown"}):console.error(A.dim(`[hooks] post-route: ${t instanceof Error?t.message:"unknown"}`));return}})}import E from"chalk";Ie();function Se(o){o.command("stats").description("Display hooks system statistics").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=await t.getStats();if(e.json)f(n);else{console.log(E.bold(`
|
|
194
190
|
\u{1F4CA} Hooks System Statistics
|
|
195
|
-
`)),console.log(
|
|
196
|
-
By Domain:`));for(let[r,s]of Object.entries(n.byDomain))s>0&&console.log(` ${r}: ${s}`);console.log(
|
|
197
|
-
Routing:`)),console.log(` Requests: ${n.routingRequests}`),console.log(` Avg Confidence: ${(n.avgRoutingConfidence*100).toFixed(1)}%`),console.log(
|
|
198
|
-
Learning:`)),console.log(` Outcomes: ${n.learningOutcomes}`),console.log(` Success Rate: ${(n.patternSuccessRate*100).toFixed(1)}%`),console.log(
|
|
199
|
-
Search Performance:`)),console.log(` Operations: ${n.patternStoreStats.searchOperations}`),console.log(` Avg Latency: ${n.patternStoreStats.avgSearchLatencyMs.toFixed(2)}ms`),console.log(` HNSW Native: ${n.patternStoreStats.hnswStats.nativeAvailable?"\u2713":"\u2717"}`)}}catch(t){throw b(`stats failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("list").description("List all registered QE hook events").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n=t.getRegisteredEvents();if(e.json)f({events:n,totalEvents:Object.keys(v).length,registeredEvents:n.length});else{console.log(
|
|
191
|
+
`)),console.log(E.bold("Patterns:")),console.log(` Total: ${E.cyan(n.totalPatterns)}`),console.log(` Short-term: ${n.patternStoreStats.byTier.shortTerm}`),console.log(` Long-term: ${n.patternStoreStats.byTier.longTerm}`),console.log(E.bold(`
|
|
192
|
+
By Domain:`));for(let[r,s]of Object.entries(n.byDomain))s>0&&console.log(` ${r}: ${s}`);console.log(E.bold(`
|
|
193
|
+
Routing:`)),console.log(` Requests: ${n.routingRequests}`),console.log(` Avg Confidence: ${(n.avgRoutingConfidence*100).toFixed(1)}%`),console.log(E.bold(`
|
|
194
|
+
Learning:`)),console.log(` Outcomes: ${n.learningOutcomes}`),console.log(` Success Rate: ${(n.patternSuccessRate*100).toFixed(1)}%`),console.log(E.bold(`
|
|
195
|
+
Search Performance:`)),console.log(` Operations: ${n.patternStoreStats.searchOperations}`),console.log(` Avg Latency: ${n.patternStoreStats.avgSearchLatencyMs.toFixed(2)}ms`),console.log(` HNSW Native: ${n.patternStoreStats.hnswStats.nativeAvailable?"\u2713":"\u2717"}`)}}catch(t){throw b(`stats failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("list").description("List all registered QE hook events").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n=t.getRegisteredEvents();if(e.json)f({events:n,totalEvents:Object.keys(v).length,registeredEvents:n.length});else{console.log(E.bold(`
|
|
200
196
|
\u{1F4CB} Registered QE Hook Events
|
|
201
|
-
`)),console.log(
|
|
202
|
-
Registered: ${n.length}/${Object.keys(v).length}`))}}catch(t){throw b(`list failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("emit").description("Emit a QE hook event").requiredOption("-e, --event <name>","Event name (e.g., qe:pattern-applied)").option("-d, --data <json>","Event data as JSON","{}").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n;try{n=le(e.data)}catch{throw new Error(`Invalid JSON data: ${e.data}`)}let r=await t.emit(e.event,n);e.json?f({event:e.event,results:r}):(console.log(
|
|
203
|
-
\u{1F4E1} Hook Event Emitted`)),console.log(
|
|
197
|
+
`)),console.log(E.bold("All Available Events:"));for(let[r,s]of Object.entries(v)){let c=n.includes(s)?E.green("\u2713"):E.dim("\u25CB");console.log(` ${c} ${r}: ${E.dim(s)}`)}console.log(E.dim(`
|
|
198
|
+
Registered: ${n.length}/${Object.keys(v).length}`))}}catch(t){throw b(`list failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("emit").description("Emit a QE hook event").requiredOption("-e, --event <name>","Event name (e.g., qe:pattern-applied)").option("-d, --data <json>","Event data as JSON","{}").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n;try{n=le(e.data)}catch{throw new Error(`Invalid JSON data: ${e.data}`)}let r=await t.emit(e.event,n);e.json?f({event:e.event,results:r}):(console.log(E.bold(`
|
|
199
|
+
\u{1F4E1} Hook Event Emitted`)),console.log(E.dim(` Event: ${e.event}`)),console.log(E.dim(` Handlers: ${r.length}`)),r.forEach((s,a)=>{let c=s.success?E.green("\u2713"):E.red("\u2717");console.log(` ${c} Handler ${a+1}: ${s.success?"success":s.error}`),s.patternsLearned&&console.log(E.green(` Patterns learned: ${s.patternsLearned}`))}))}catch(t){throw b(`emit failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("learn").description("Store a new pattern in the reasoning bank").requiredOption("-n, --name <name>","Pattern name").requiredOption("-d, --description <desc>","Pattern description").option("-t, --type <type>","Pattern type","test-template").option("--domain <domain>","QE domain").option("--tags <tags...>","Pattern tags").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=await t.storePattern({patternType:e.type,name:e.name,description:e.description,template:{type:"prompt",content:e.description,variables:[]},context:{tags:e.tags||[]}});if(!n.success)throw new Error(n.error.message);let r=n.value;e.json?f({success:!0,pattern:{id:r.id,name:r.name,type:r.patternType,domain:r.qeDomain}}):(N(`Pattern stored: ${r.name}`),console.log(E.dim(` ID: ${r.id}`)),console.log(E.dim(` Domain: ${r.qeDomain}`)),console.log(E.dim(` Tier: ${r.tier}`)))}catch(t){throw b(`learn failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("search").description("Search for patterns in the reasoning bank").requiredOption("-q, --query <query>","Search query").option("-l, --limit <n>","Maximum results","10").option("-d, --domain <domain>","Filter by domain").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=await t.searchPatterns(e.query,{limit:parseInt(e.limit,10),domain:e.domain});if(!n.success)throw new Error(n.error.message);let r=n.value;e.json?f({query:e.query,total:r.length,patterns:r.map(s=>({id:s.pattern.id,name:s.pattern.name,score:s.score,domain:s.pattern.qeDomain,matchType:s.matchType}))}):(console.log(E.bold(`
|
|
204
200
|
\u{1F50D} Search Results for "${e.query}"
|
|
205
|
-
`)),r.length===0?console.log(
|
|
206
|
-
`)){let t=e.match(/^(?:export\s+)?NAGUAL_CLOUD_KEY=(.+)/);if(t)return t[1].trim().replace(/^['"]|['"]$/g,"")}}catch{}}var
|
|
201
|
+
`)),r.length===0?console.log(E.dim(" No patterns found")):r.forEach((s,a)=>{console.log(`${E.cyan(`${a+1}.`)} ${s.pattern.name} ${E.dim(`(${(s.score*100).toFixed(1)}%)`)}`),console.log(E.dim(` Domain: ${s.pattern.qeDomain}`)),console.log(E.dim(` Match: ${s.matchType}`)),console.log(E.dim(` ID: ${s.pattern.id}`)),console.log()}),console.log(E.dim(`Found ${r.length} pattern(s)`)))}catch(t){throw b(`search failed: ${t instanceof Error?t.message:"unknown"}`),t}})}U();import Q from"chalk";import Ue from"node:path";function be(o){o.command("session-start").description("Initialize session state when Claude Code session starts").option("-s, --session-id <id>","Session ID").option("--json","Output as JSON").action(async e=>{try{let t=e.sessionId||`session-${Date.now()}`;g.sessionId=t;let{reasoningBank:n}=await _(),r=await n.getStats(),s=R(),a=Ue.join(s,".agentic-qe"),c=await O(a),i=await c.get(H),h=!i||!i.sessionStartTime;i?(i.sessionStartTime=new Date().toISOString(),i.totalDreamsThisSession=0):i={lastDreamTime:null,experienceCount:0,sessionStartTime:new Date().toISOString(),totalDreamsThisSession:0},await c.set(H,i);let l=[];l.push(`AQE Learning: ${r.totalPatterns} patterns loaded`);let p=Object.entries(r.byDomain).filter(([,k])=>k>0).sort(([,k],[,u])=>u-k).slice(0,5);p.length>0&&l.push(`Top domains: ${p.map(([k,u])=>`${k}(${u})`).join(", ")}`),r.patternSuccessRate>0&&l.push(`Pattern success rate: ${(r.patternSuccessRate*100).toFixed(0)}%`),r.routingRequests>0&&l.push(`Routing confidence: ${(r.avgRoutingConfidence*100).toFixed(0)}% across ${r.routingRequests} requests`);let d=l.join(". ")+".";e.json?f({hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:d},sessionId:t,initialized:!0,patternsLoaded:r.totalPatterns,dreamScheduler:{enabled:!0,lastDreamTime:i.lastDreamTime,pendingExperiences:i.experienceCount}}):(N(`Session started: ${t}`),console.log(Q.dim(` Patterns loaded: ${r.totalPatterns}`)),console.log(Q.dim(` Dream scheduler: enabled (${i.experienceCount} pending experiences)`)));return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}}),o.command("session-end").description("Save session state when Claude Code session ends").option("--save-state","Save learning state to disk").option("--export-metrics","Export session metrics").option("--json","Output as JSON").action(async e=>{try{let t=g.sessionId||"unknown",n=null;if(g.initialized&&g.reasoningBank)try{n=await g.reasoningBank.getStats()}catch{}let r=0;try{r=await se()}catch{}if(e.json){let s=n?`Session complete: ${n.totalPatterns} patterns, ${n.routingRequests} routings, ${(n.patternSuccessRate*100).toFixed(0)}% success rate`:"Session complete";f({continue:!0,sessionId:t,stateSaved:e.saveState||!1,metricsExported:e.exportMetrics||!1,patternsConsolidated:r,finalStats:n?{patternsLearned:n.totalPatterns,routingRequests:n.routingRequests,successRate:n.patternSuccessRate}:null})}else N(`Session ended: ${t}`),n&&(console.log(Q.dim(` Patterns: ${n.totalPatterns}`)),console.log(Q.dim(` Routing requests: ${n.routingRequests}`))),r>0&&console.log(Q.dim(` Patterns consolidated: ${r}`));return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}})}import{createHash as Je,randomUUID as Qe}from"node:crypto";import w from"chalk";import Ve from"node:path";U();$e();import{readFileSync as Fe}from"node:fs";import{homedir as He}from"node:os";var ee=de.create("nagual-client");function Be(){try{let o=Fe(`${He()}/.nagual/cloud-hooks.env`,"utf8");for(let e of o.split(`
|
|
202
|
+
`)){let t=e.match(/^(?:export\s+)?NAGUAL_CLOUD_KEY=(.+)/);if(t)return t[1].trim().replace(/^['"]|['"]$/g,"")}}catch{}}var ze="http://localhost:3333",we=3e3,Ge=5e3;var ie=class{baseUrl;token;enabled;constructor(){this.baseUrl=process.env.NAGUAL_URL??ze,this.token=process.env.NAGUAL_CLOUD_KEY??process.env.NAGUAL_API_TOKEN??Be(),this.enabled=!0}async search(e,t,n=5){try{let r=await fetch(`${this.baseUrl}/api/patterns/search`,{method:"POST",headers:this.headers(),body:JSON.stringify({query:e,domain:t,limit:n}),signal:AbortSignal.timeout(we)});return r.ok?(await r.json()).patterns??[]:[]}catch{return[]}}async recordOutcome(e,t){try{let n=await fetch(`${this.baseUrl}/api/patterns/${encodeURIComponent(e)}/outcome`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),signal:AbortSignal.timeout(we)});n.ok||ee.debug("nagual recordOutcome non-OK",{patternId:e,status:n.status})}catch(n){ee.debug("nagual recordOutcome failed (non-fatal)",{patternId:e,err:n})}}async promotePattern(e){let t={problem:e.problem,solution:e.solution,domain:e.domain,reward:e.reward*.8,tags:[...e.tags??[],"source:aqe",e.source_project?`project:${e.source_project}`:null].filter(n=>n!==null)};try{let n=await fetch(`${this.baseUrl}/api/patterns`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),signal:AbortSignal.timeout(Ge)});n.ok||ee.debug("nagual promotePattern non-OK",{status:n.status})}catch(n){ee.debug("nagual promotePattern failed (non-fatal)",{err:n})}}headers(){let e={"Content-Type":"application/json"};return this.token&&(e.Authorization=`Bearer ${this.token}`),e}},ae;function Re(){return ae||(ae=new ie),ae}var We=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/;function Ae(o,e){let t={};if(o!==void 0){if(!We.test(o))return{error:`Invalid --parent-agent-id "${o}": must start with a letter or digit and contain only letters, digits, "_", ".", ":", "-" (max 128 chars)`};t.parentAgentId=o}if(e!==void 0){let n=typeof e=="number"?e:Number(e);if(!Number.isInteger(n))return{error:`Invalid --depth "${e}": must be an integer`};if(n<0)return{error:`Invalid --depth ${n}: must be >= 0`};if(n>32)return{error:`Invalid --depth ${n}: must be <= 32`};t.depth=n}return t}var Xe="task-bridge",Ke=6e5,ve=.5;function Ye(o){return Je("sha256").update(o).digest("hex").slice(0,16)}var Ze=new Set(["test-generation","coverage-analysis","defect-intelligence","security-compliance","quality-assessment","requirements-validation"]),et=80;async function tt(o,e){return!process.env.NAGUAL_URL&&!process.env.NAGUAL_CLOUD_URL&&!process.env.NAGUAL_CLOUD_KEY?[]:o.length<et?[]:e&&!Ze.has(e)?[]:Re().search(o.slice(0,300),e,3)}function Oe(o){o.command("pre-task").description("Get context and guidance before spawning a Task agent").option("--task-id <id>","Task identifier").option("-d, --description <desc>","Task description").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=null;if(e.description){let d=await t.routeTask({task:e.description});d.success&&(n=d.value)}let r=(n?.patterns??[]).slice(0,5).map(d=>d?.id).filter(d=>typeof d=="string"),s=n?.domains?.[0],a=e.description?await tt(String(e.description),s):[],c=null,i=[],h=0,l=null;try{let d=M();d.isInitialized()||await d.initialize();let k=d.getDatabase();q(k);try{let u=k.prepare(`
|
|
207
203
|
SELECT used_agent AS agent,
|
|
208
204
|
ROUND(AVG(quality_score), 3) AS avgQuality,
|
|
209
205
|
COUNT(*) AS n
|
|
@@ -219,30 +215,30 @@ Registered: ${n.length}/${Object.keys(v).length}`))}}catch(t){throw b(`list fail
|
|
|
219
215
|
AND created_at > datetime('now', '-7 days')
|
|
220
216
|
ORDER BY created_at DESC
|
|
221
217
|
LIMIT 3
|
|
222
|
-
`).all().map(
|
|
218
|
+
`).all().map(y=>({key:y.key,summary:String(y.value).slice(0,200)}))}catch{}if(r.length>0)try{let u=r.map(()=>"?").join(","),y=k.prepare(`
|
|
223
219
|
SELECT COALESCE(SUM(average_token_savings), 0) AS sum
|
|
224
220
|
FROM qe_patterns
|
|
225
221
|
WHERE id IN (${u})
|
|
226
|
-
`).get(...r);h=Math.max(0,Math.round(
|
|
222
|
+
`).get(...r);h=Math.max(0,Math.round(y?.sum??0))}catch{}if(e.description)try{let u=String(e.description),y=G(u),m="normal",T=n?.domains?.[0]??"any",D=Math.max(0,Math.min(10,Math.round(Math.min(u.length/200,1)*10)));l=`task:${Ye(u)}`;let L=JSON.stringify({selectedPatternIds:r,agent:n?.recommendedAgent??null,description:u.slice(0,200),taskType:y,priority:m,domain:T,complexityBucket:D,estimatedTokenSavings:h,ts:Date.now()}),P=Date.now()+Ke;k.prepare(`
|
|
227
223
|
INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at, created_at)
|
|
228
224
|
VALUES (?, ?, ?, ?, strftime('%s','now')*1000)
|
|
229
|
-
`).run(l,
|
|
225
|
+
`).run(l,Xe,L,P)}catch(u){console.error(w.dim(`[hooks] pre-task bridge: ${u instanceof Error?u.message:"unknown"}`))}if(n?.recommendedAgent)try{Y(k);let u=e.taskId||`hook-${Date.now()}`,y=`route-${Date.now()}-${Qe().slice(0,8)}`,m=n.confidence<ve,T=n;k.prepare(`
|
|
230
226
|
INSERT INTO routing_outcomes (
|
|
231
227
|
id, task_json, decision_json, used_agent,
|
|
232
228
|
followed_recommendation, success, quality_score,
|
|
233
229
|
duration_ms, error,
|
|
234
230
|
exploration, criticality, q_weight
|
|
235
231
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
236
|
-
`).run(
|
|
232
|
+
`).run(y,JSON.stringify({description:e.description,taskId:u}),JSON.stringify({recommended:n.recommendedAgent,confidence:n.confidence,alternatives:n.alternatives,lowConfidence:m,exploration:T.exploration??!1,criticality:T.criticality??null,qWeight:T.qWeight??null}),n.recommendedAgent,1,0,-1,0,m?"low-confidence":null,T.exploration?1:0,T.criticality??null,T.qWeight??null)}catch(u){console.error(w.dim(`[hooks] pre-task sentinel: ${u instanceof Error?u.message:"unknown"}`))}}catch(d){console.error(w.dim(`[hooks] pre-task memory: ${d instanceof Error?d.message:"unknown"}`))}let p=n?n.confidence<ve:!1;if(e.json)f({success:!0,taskId:e.taskId,description:e.description,recommendedAgent:n?.recommendedAgent,confidence:n?.confidence,guidance:n?.guidance||[],selectedPatternIds:r,historicalBest:c,priorVerdicts:i,estimatedTokenSavings:h,lowConfidence:p,bridgeKey:l,nagualPatterns:a.map(d=>({id:d.id,problem:d.problem,solution:d.solution.slice(0,400),domain:d.domain,reward:d.reward}))});else if(console.log(w.bold(`
|
|
237
233
|
\u{1F680} Pre-Task Analysis`)),console.log(w.dim(` Task ID: ${e.taskId||"N/A"}`)),n&&(console.log(w.bold(`
|
|
238
234
|
\u{1F3AF} Recommended:`),w.cyan(n.recommendedAgent)),console.log(w.dim(` Confidence: ${(n.confidence*100).toFixed(1)}%`)),p&&console.log(w.yellow(" \u26A0 Low confidence \u2014 consider providing more context"))),a.length>0){console.log(w.bold(`
|
|
239
|
-
\u{1F4DA} Nagual context (cross-project):`));for(let d of a)console.log(w.dim(` [${d.domain}] ${d.problem.slice(0,80)} (reward: ${d.reward.toFixed(2)})`))}return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}}),o.command("post-task").description("Record task outcome for pattern learning").option("--task-id <id>","Task identifier").option("--success [bool]","Whether task succeeded","true").option("--agent <name>","Agent that executed the task").option("--duration <ms>","Task duration in milliseconds").option("-d, --description <desc>","Task description \u2014 fallback Q-state source when pre-task bridge is absent (issue #499)").option("--parent-agent-id <id>","Agent that spawned this task (ADR-101 nesting provenance)").option("--depth <n>","Nesting depth of this task, 0 = top-level (ADR-101)").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0,n=
|
|
235
|
+
\u{1F4DA} Nagual context (cross-project):`));for(let d of a)console.log(w.dim(` [${d.domain}] ${d.problem.slice(0,80)} (reward: ${d.reward.toFixed(2)})`))}return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}}),o.command("post-task").description("Record task outcome for pattern learning").option("--task-id <id>","Task identifier").option("--success [bool]","Whether task succeeded","true").option("--agent <name>","Agent that executed the task").option("--duration <ms>","Task duration in milliseconds").option("-d, --description <desc>","Task description \u2014 fallback Q-state source when pre-task bridge is absent (issue #499)").option("--parent-agent-id <id>","Agent that spawned this task (ADR-101 nesting provenance)").option("--depth <n>","Nesting depth of this task, 0 = top-level (ADR-101)").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0;if(!e.agent||!String(e.agent).trim())try{let s=await B(),a=Ee(s);a&&(e.agent=a)}catch{}let n=Ae(e.parentAgentId,e.depth);if(n.error){e.json?console.log(JSON.stringify({success:!1,error:n.error})):console.error(w.red(` \u2717 ${n.error}`)),process.exitCode=1;return}let r=0;try{let{hookRegistry:s,reasoningBank:a}=await _();r=(await s.emit(v.QEAgentCompletion,{taskId:e.taskId,success:t,agent:e.agent,duration:e.duration?parseInt(e.duration,10):void 0,timestamp:Date.now()})).reduce((p,d)=>p+(d.patternsLearned||0),0);{let p=e.taskId||`hook-${Date.now()}`,d=e.agent||"unknown",k=e.duration?parseInt(e.duration,10):0,u=(n.parentAgentId?`, Parent: ${n.parentAgentId}`:"")+(n.depth!==void 0?`, Depth: ${n.depth}`:"");await a.recordOutcome({patternId:`task:${d}:${p}`,success:t,metrics:{executionTimeMs:k},feedback:`Agent: ${d}, Task: ${p}${u}`});let y=await oe({taskId:p,agent:d,durationMs:k,success:t,parentAgentId:n.parentAgentId,depth:n.depth}),m=d==="unknown"&&y.bridge?.agent?y.bridge.agent:d;await re({agent:m,success:t,durationMs:k,qualityScore:y.qualityScore});let T=String(e.description??"");if(y.bridge||T){let D=y.bridge?.taskType??G(T),L=y.bridge?.priority??"normal",P=y.bridge?.domain??K(T)[0]??"any";await J({taskType:D,priority:L,domain:P,agent:m,success:t})}}let i=R(),h=Ve.join(i,".agentic-qe"),l=await O(h);await x(l)}catch(s){console.error(w.dim(`[hooks] Learning init: ${s instanceof Error?s.message:"unknown"}`))}e.json?f({success:!0,taskId:e.taskId,taskSuccess:t,patternsLearned:r,dreamTriggered:!1,dreamReason:"deferred-to-kernel"}):(N(`Task completed: ${e.taskId||"unknown"}`),console.log(w.dim(` Success: ${t}`)),r>0&&console.log(w.green(` Patterns learned: ${r}`)));return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}})}import{existsSync as nt,readFileSync as ot}from"node:fs";import{randomUUID as Ne}from"node:crypto";import X from"chalk";import De from"node:path";U();import*as z from"fs";import*as te from"path";var V=class o{statePath;warnThreshold;blockThreshold;halfOpenAfterMs;staleAfterMs;constructor(e){this.statePath=e.statePath,this.warnThreshold=e.warnThreshold??3,this.blockThreshold=e.blockThreshold??5,this.halfOpenAfterMs=e.halfOpenAfterMs??12e4,this.staleAfterMs=e.staleAfterMs??30*6e4}static signature(e){return e.trim().replace(/\s+/g," ").slice(0,200)}check(e,t=Date.now()){let n=o.signature(e);if(!n)return{verdict:"allow",consecutiveFailures:0,halfOpen:!1};let r=this.readState()[n];if(!r||r.consecutiveFailures<this.warnThreshold)return{verdict:"allow",consecutiveFailures:r?.consecutiveFailures??0,halfOpen:!1};let s=r.consecutiveFailures;return s>=this.blockThreshold?t-r.lastFailureAt>=this.halfOpenAfterMs?{verdict:"warn",consecutiveFailures:s,halfOpen:!0,hint:`This command has failed ${s}x consecutively; allowing one probe attempt. If it fails again it will be flagged immediately.`}:{verdict:"block",consecutiveFailures:s,halfOpen:!1,hint:`The same command failed ${s}x consecutively. Re-running it unchanged is unlikely to succeed \u2014 inspect the error output, change the approach, or fix the underlying problem first. (A successful run resets this breaker.)`}:{verdict:"warn",consecutiveFailures:s,halfOpen:!1,hint:`This command has failed ${s}x consecutively \u2014 consider changing approach before retrying.`}}record(e,t,n=Date.now()){let r=o.signature(e);if(r)try{let s=this.readState();if(t){s[r]&&(delete s[r],this.writeState(s,n));return}let a=s[r]??{consecutiveFailures:0,lastFailureAt:n};a.consecutiveFailures+=1,a.lastFailureAt=n,s[r]=a,this.writeState(s,n)}catch{}}static isStrict(e=process.env){return e.AQE_STRICT_TOOL_LOOP==="1"||e.AQE_STRICT_TOOL_LOOP==="true"}readState(){try{let e=z.readFileSync(this.statePath,"utf8"),t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}writeState(e,t){for(let[n,r]of Object.entries(e))t-r.lastFailureAt>this.staleAfterMs&&delete e[n];z.mkdirSync(te.dirname(this.statePath),{recursive:!0}),z.writeFileSync(this.statePath,JSON.stringify(e))}};function ce(o){return new V({statePath:te.join(o,".agentic-qe","tool-loop-state.json")})}function rt(o){return/\bjest\b/i.test(o)?"jest":/\bvitest\b/i.test(o)?"vitest":/\bpytest\b/i.test(o)?"pytest":/\bmocha\b/i.test(o)?"mocha":null}async function st(o){try{let e=M();e.isInitialized()||await e.initialize();let t=e.getDatabase();q(t);let n=o.framework==="pytest"?"python":"javascript",r=o.command.split(/\s+/).slice(0,3).join("-").slice(0,80);t.prepare(`
|
|
240
236
|
INSERT INTO test_outcomes (
|
|
241
237
|
id, test_id, test_name, generated_by, framework, language, domain,
|
|
242
238
|
passed, execution_time_ms, maintainability_score, created_at
|
|
243
239
|
) VALUES (?, ?, ?, 'cli-hook-post-command', ?, ?, 'test-execution',
|
|
244
240
|
?, ?, 0.5, datetime('now'))
|
|
245
|
-
`).run(`to-${Date.now()}-${
|
|
241
|
+
`).run(`to-${Date.now()}-${Ne().slice(0,8)}`,`cmd:${r}`,o.command.slice(0,200),o.framework,n,o.success?1:0,o.durationMs);try{let s=De.join(process.cwd(),"coverage","coverage-summary.json");if(nt(s)){let c=JSON.parse(ot(s,"utf-8")).total??{},i=Number(c.lines?.pct??0),h=Number(c.branches?.pct??0),l=Number(c.functions?.pct??0),p=t.prepare(`
|
|
246
242
|
SELECT after_lines, after_branches, after_functions
|
|
247
243
|
FROM coverage_sessions
|
|
248
244
|
WHERE target_path = ?
|
|
@@ -256,8 +252,8 @@ Registered: ${n.length}/${Object.keys(v).length}`))}}catch(t){throw b(`list fail
|
|
|
256
252
|
tests_generated, tests_passed, duration_ms,
|
|
257
253
|
started_at, completed_at
|
|
258
254
|
) VALUES (?, ?, 'cli-hook-post-command', ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?)
|
|
259
|
-
`).run(`cs-${Date.now()}-${
|
|
260
|
-
\u26A0\uFE0F Command Warnings:`)),a.forEach(i=>console.log(
|
|
255
|
+
`).run(`cs-${Date.now()}-${Ne().slice(0,8)}`,process.cwd(),o.framework,p?.after_lines??0,p?.after_branches??0,p?.after_functions??0,i,h,l,o.success?1:0,o.durationMs,d,d)}}catch(s){console.error(X.dim(`[hooks] coverage_sessions: ${s instanceof Error?s.message:"unknown"}`))}}catch(e){console.error(X.dim(`[hooks] test_outcomes: ${e instanceof Error?e.message:"unknown"}`))}}function xe(o){o.command("guard").description("File guardian - block edits to protected files").requiredOption("-f, --file <path>","File path to check").option("--json","Output as JSON (required for hook API)").action(async e=>{try{let t=e.file||"",n=t.replace(/\\/g,"/"),s=[{pattern:/^\.env($|\.)/,reason:"Environment file contains secrets"},{pattern:/\.env\.[a-zA-Z]+$/,reason:"Environment file contains secrets"},{pattern:/\.lock$/,reason:"Lock files are auto-generated"},{pattern:/(^|\/)node_modules\//,reason:"node_modules is managed by package manager"},{pattern:/(^|\/)\.agentic-qe\/memory\.db/,reason:"AQE memory database must not be directly edited"},{pattern:/(^|\/)\.agentic-qe\/memory\.db-wal$/,reason:"AQE WAL file must not be directly edited"},{pattern:/(^|\/)\.agentic-qe\/memory\.db-shm$/,reason:"AQE shared memory file must not be directly edited"}].find(a=>a.pattern.test(n));s?e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Protected file: ${s.reason} (${t})`}}):b(`Blocked: ${s.reason} (${t})`):e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}}):N(`Allowed: ${t}`);return}catch{e.json&&f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}});return}}),o.command("pre-command").description("Get context before executing a Bash command").option("-c, --command <cmd>","Command to be executed").option("--json","Output as JSON").action(async e=>{try{let t=e.command||"",n=[{pattern:/rm\s+(-[a-zA-Z]*f[a-zA-Z]*\s+)?-[a-zA-Z]*r[a-zA-Z]*\s+\/(?!\w)/,reason:"Recursive delete of root filesystem"},{pattern:/rm\s+(-[a-zA-Z]*r[a-zA-Z]*\s+)?-[a-zA-Z]*f[a-zA-Z]*\s+\/(?!\w)/,reason:"Recursive delete of root filesystem"},{pattern:/rm\s+-rf\s+~/,reason:"Recursive delete of home directory"},{pattern:/DROP\s+(TABLE|DATABASE|SCHEMA)/i,reason:"Destructive SQL operation"},{pattern:/git\s+push\s+.*--force(?!-)/,reason:"Force push can overwrite remote history"},{pattern:/git\s+reset\s+--hard/,reason:"Hard reset discards uncommitted changes"},{pattern:/>\s*\/dev\/sd[a-z]/,reason:"Direct write to block device"},{pattern:/dd\s+if=.*of=\/dev\/sd/,reason:"Direct disk write via dd"},{pattern:/chmod\s+777\s/,reason:"World-writable permissions are a security risk"},{pattern:/:\(\)\s*\{\s*:\|\s*:&\s*\}\s*;?\s*:/,reason:"Fork bomb detected"},{pattern:/mkfs\./,reason:"Filesystem format operation"},{pattern:/>\s*\/dev\/null\s*2>&1\s*&\s*disown/,reason:"Stealth background process"}],r=[{pattern:/\.agentic-qe.*rm/,reason:"Deleting AQE data files"},{pattern:/rm\s+-rf\s/,reason:"Recursive force delete"},{pattern:/git\s+clean\s+-[a-zA-Z]*f/,reason:"Force cleaning untracked files"}],s=n.find(i=>i.pattern.test(t)),a=r.filter(i=>i.pattern.test(t)).map(i=>i.reason),c=null;try{c=ce(R()).check(t)}catch{}if(c&&c.verdict==="block"&&V.isStrict()){e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Tool-loop breaker (AQE_STRICT_TOOL_LOOP): ${c.hint}`}}):b(`Blocked by tool-loop breaker: ${c.hint}`);return}if(c&&c.verdict==="block"?a.push(`\u{1F6D1} TOOL-LOOP BREAKER: ${c.hint}`):c&&c.verdict==="warn"&&a.push(`Tool-loop breaker: ${c.hint}`),s)e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Dangerous command blocked: ${s.reason}`}}):b(`Blocked: ${s.reason}`);else if(e.json){let i={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};a.length>0&&(i.hookSpecificOutput.additionalContext=`Warnings: ${a.join("; ")}`),f(i)}else a.length>0&&(console.log(X.yellow(`
|
|
256
|
+
\u26A0\uFE0F Command Warnings:`)),a.forEach(i=>console.log(X.yellow(` - ${i}`))));return}catch{e.json&&f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}});return}}),o.command("post-command").description("Record Bash command outcome").option("-c, --command <cmd>","Command that was executed").option("--success [bool]","Whether command succeeded","true").option("--exit-code <code>","Command exit code").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0,n=e.exitCode?parseInt(e.exitCode,10):t?0:1,r=(e.command||"").substring(0,200);try{ce(R()).record(r,t)}catch{}let s=/\b(test|vitest|jest|pytest|mocha)\b/i.test(r),a=/\b(build|compile|tsc)\b/i.test(r),c=/\b(lint|eslint|prettier)\b/i.test(r),i=0,h=!1;try{let{reasoningBank:l}=await _();if(s){let{hookRegistry:T}=await _();await T.emit(v.TestExecutionResult,{runId:`cmd-${Date.now()}`,patternId:`cmd:test:${r.split(/\s+/).slice(0,3).join("-")}`,passed:t?1:0,failed:t?0:1,duration:0,flaky:!1})}let p=r.replace(/[^a-zA-Z0-9]/g,"-").slice(0,80),d=s?"test-execution":a?"code-intelligence":c?"quality-assessment":"code-intelligence";await l.recordOutcome({patternId:`cmd:${p}`,success:t,metrics:{executionTimeMs:0},feedback:`Command: ${r}, exit: ${n}`}),i=1,(s||a||c)&&(await W({task:`bash: ${r}`,agent:"cli-hook",domain:d,success:t,source:"cli-hook-post-command"}),h=!0);let k=rt(r);k&&await st({command:r,framework:k,success:t,durationMs:0});let u=R(),y=De.join(u,".agentic-qe"),m=await O(y);await x(m)}catch(l){console.error(X.dim(`[hooks] post-command learning: ${l instanceof Error?l.message:"unknown"}`))}e.json&&f({success:!0,command:r.substring(0,100),commandSuccess:t,exitCode:n,patternsLearned:i,experienceRecorded:h});return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}})}function $n(){let o=new at("hooks").description("Self-learning QE hooks for pattern recognition and guidance").addHelpText("after",`
|
|
261
257
|
Examples:
|
|
262
258
|
# File editing hooks (learning from edits)
|
|
263
259
|
aqe hooks pre-edit --file src/utils.ts --operation create
|
|
@@ -282,4 +278,4 @@ Examples:
|
|
|
282
278
|
aqe hooks search --query "authentication"
|
|
283
279
|
aqe hooks stats
|
|
284
280
|
aqe hooks list
|
|
285
|
-
`);return
|
|
281
|
+
`);return Te(o),_e(o),Se(o),be(o),Oe(o),xe(o),o}export{v as QE_HOOK_EVENTS,$n as createHooksCommand,_ as getHooksSystem,g as hooksState};
|
|
@@ -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-SCMXIBI7.js";import"./chunk-QJ6H2HQQ.js";import"./chunk-ESDGCTC4.js";import"./chunk-POKMJTD2.js";import"./chunk-BA6U7NSR.js";import"./chunk-RMFRFING.js";import"./chunk-RHC7TFPU.js";import"./chunk-6JNNZGI2.js";import"./chunk-3AFNXU45.js";export{a as HybridRouter,b as createHybridRouter,c as createQERouter};
|
|
@@ -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}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}from"./chunk-TED4KOSK.js";import"./chunk-SSXAW3ER.js";import"./chunk-K5SN66B4.js";import"./chunk-RHC7TFPU.js";import"./chunk-6JNNZGI2.js";import"./chunk-3AFNXU45.js";export{a as DEFAULT_HYPERGRAPH_ENGINE_CONFIG,b as HypergraphEngine,c as createHypergraphEngine,d as createHypergraphEngineSync,e as default};
|
|
@@ -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"./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 e from"chalk";import{join as m,resolve as h}from"path";import{existsSync as y}from"fs";var c=class{name="hypergraph";description="Query the code knowledge hypergraph";cleanupAndExit;ensureInitialized;constructor(n,r){this.cleanupAndExit=n,this.ensureInitialized=r}register(n,r){let s=n.command("hypergraph").alias("hg").description(this.description);s.command("stats").description("Show hypergraph statistics (node/edge counts by type)").option("--db <path>","Database path").action(async t=>{await this.executeStats(t)}),s.command("untested").description("Find functions with no test coverage").option("--db <path>","Database path").option("--limit <number>","Max results","20").action(async t=>{await this.executeUntested(t)}),s.command("impacted <files...>").description("Find tests impacted by changed files").option("--db <path>","Database path").action(async(t,i)=>{await this.executeImpacted(t,i)}),s.command("gaps").description("Find functions with low coverage").option("--db <path>","Database path").option("--max-coverage <number>","Coverage threshold (%)","50").option("--limit <number>","Max results","20").action(async t=>{await this.executeGaps(t)})}async executeStats(n){if(!await this.ensureInitialized())return;let{engine:r,close:s}=await this.openEngine(n.db);try{let t=await r.getStats();if(console.log(e.blue(`
|
|
3
3
|
Hypergraph Statistics
|
|
4
4
|
`)),console.log(e.white(` Total nodes: ${t.totalNodes}`)),console.log(e.white(` Total edges: ${t.totalEdges}`)),t.totalNodes>0){console.log(e.gray(`
|
|
5
5
|
Nodes by type:`));for(let[i,o]of Object.entries(t.nodesByType))o>0&&console.log(e.gray(` ${i}: ${o}`));console.log(e.gray(`
|
|
@@ -15,7 +15,7 @@ import"./chunk-Y4AXOHW4.js";import e from"chalk";import{join as m,resolve as h}f
|
|
|
15
15
|
`))}finally{i()}await this.cleanupAndExit(0)}async executeGaps(n){if(!await this.ensureInitialized())return;let{engine:r,close:s}=await this.openEngine(n.db);try{let t=parseInt(n.maxCoverage,10)||50,i=parseInt(n.limit,10)||20,o=await r.findCoverageGaps(t),a=o.slice(0,i);if(console.log(e.blue(`
|
|
16
16
|
Coverage Gaps (<= ${t}%) \u2014 ${o.length} total
|
|
17
17
|
`)),a.length===0)console.log(e.green(" No coverage gaps found!"));else{for(let l of a){let d=l.coverage!==void 0?e.red(` ${l.coverage}%`):"",p=l.complexity?e.yellow(` complexity=${l.complexity}`):"";console.log(e.white(` ${l.name}`)+d+e.gray(` ${l.filePath||""}`)+p)}o.length>i&&console.log(e.gray(`
|
|
18
|
-
... and ${o.length-i} more (use --limit to show more)`))}console.log("")}finally{s()}await this.cleanupAndExit(0)}async openEngine(n){let{findProjectRoot:r}=await import("./unified-memory-
|
|
18
|
+
... and ${o.length-i} more (use --limit to show more)`))}console.log("")}finally{s()}await this.cleanupAndExit(0)}async openEngine(n){let{findProjectRoot:r}=await import("./unified-memory-A5BS3LGX.js"),{openDatabase:s}=await import("./safe-db-UQOCQIH2.js"),{createHypergraphEngine:t}=await import("./hypergraph-engine-EAV3GJ5D.js"),i=r(),o=n||m(i,".agentic-qe","memory.db");if(!y(o))throw new Error(`Database not found: ${o}
|
|
19
19
|
Run "aqe init --auto" first.`);let a=s(o);try{return{engine:await t({db:a,maxTraversalDepth:10,maxQueryResults:1e3,enableVectorSearch:!1}),close:()=>{try{a.close()}catch{}}}}catch(l){try{a.close()}catch{}throw l}}getHelp(){return`
|
|
20
20
|
Query the code knowledge hypergraph for untested functions,
|
|
21
21
|
impacted tests, and coverage gaps.
|
|
@@ -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}from"./chunk-FZRU73M4.js";import"./chunk-RG552ROA.js";import"./chunk-NNGCUJWQ.js";import"./chunk-MUV56BPK.js";import"./chunk-MDT3LIXS.js";import"./chunk-TJEJ4UVX.js";import"./chunk-K5SN66B4.js";import"./chunk-7ZIVDGSN.js";import"./chunk-RHC7TFPU.js";import"./chunk-6JNNZGI2.js";import"./chunk-3AFNXU45.js";export{a as ImpactAnalyzerService};
|