agentic-qe 3.9.29 → 3.9.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +176 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/bridge/captured-experience-bridge.js +31 -2
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-CI2GZYME.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-EPRGXS5D.js → agent-booster-wasm-AQXZYWZY.js} +2 -2
- package/dist/cli/chunks/{agent-handler-LF6D64UE.js → agent-handler-7N4ZPXCY.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-XD3UQD6Y.js → agent-memory-branch-FLKF2JVX.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-KNQKALLI.js +2 -0
- package/dist/cli/chunks/{audit-MNJONFOL.js → audit-B4V4IKTA.js} +2 -2
- package/dist/cli/chunks/base-P7PRMQWY.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-PSQJ3C65.js → better-sqlite3-NYOVLWBG.js} +2 -2
- package/dist/cli/chunks/{brain-handler-SA2G3FDO.js → brain-handler-OOXJ2KYY.js} +4 -4
- package/dist/cli/chunks/{branch-enumerator-T7SZZTMH.js → branch-enumerator-LFKFW3A4.js} +2 -2
- package/dist/cli/chunks/{browser-OH5HUVOG.js → browser-F72IES2I.js} +3 -3
- package/dist/cli/chunks/browser-workflow-QUP4A763.js +2 -0
- package/dist/cli/chunks/{chunk-K7CFDRVW.js → chunk-2NLZXG6V.js} +1 -1
- package/dist/cli/chunks/{chunk-5Q26UGSU.js → chunk-35SFAIXE.js} +2 -2
- package/dist/cli/chunks/{chunk-UI6KM5PK.js → chunk-3VKB4HVT.js} +2 -2
- package/dist/cli/chunks/{chunk-UKYPDNQR.js → chunk-462MZLJB.js} +1 -1
- package/dist/cli/chunks/{chunk-WUKSEOUO.js → chunk-47QIAHUJ.js} +2 -2
- package/dist/cli/chunks/{chunk-R55RXPHB.js → chunk-4N736EES.js} +2 -2
- package/dist/cli/chunks/{chunk-5XRNUFEG.js → chunk-52D3CYE5.js} +2 -2
- package/dist/cli/chunks/{chunk-5MUYYPPW.js → chunk-5AMAJCZS.js} +3 -3
- package/dist/cli/chunks/{chunk-2JK43GR4.js → chunk-5G2L4XRU.js} +2 -2
- package/dist/cli/chunks/{chunk-C7MWQ4BI.js → chunk-5M4F3PAL.js} +1 -1
- package/dist/cli/chunks/{chunk-PYAITX6B.js → chunk-5WWQLPB4.js} +2 -2
- package/dist/cli/chunks/chunk-5Z6PYYWK.js +2 -0
- package/dist/cli/chunks/{chunk-VHJRWMZ5.js → chunk-62KYX5NH.js} +2 -2
- package/dist/cli/chunks/{chunk-667A24A4.js → chunk-7MXQV7RB.js} +12 -6
- package/dist/cli/chunks/{chunk-N5SS5YIS.js → chunk-7OVVBBOZ.js} +2 -2
- package/dist/cli/chunks/{chunk-TESFXE2W.js → chunk-7RPEBKQZ.js} +2 -2
- package/dist/cli/chunks/{chunk-3T4Q5V4B.js → chunk-7UHRT5AX.js} +2 -2
- package/dist/cli/chunks/{chunk-7PYHCYLJ.js → chunk-7V7TP242.js} +1 -1
- package/dist/cli/chunks/{chunk-IBSTVSKT.js → chunk-A424Z7LA.js} +1 -1
- package/dist/cli/chunks/{chunk-IX5LUHCN.js → chunk-AKFRM4IO.js} +2 -2
- package/dist/cli/chunks/{chunk-UGXYKPM4.js → chunk-AKJWBJDK.js} +2 -2
- package/dist/cli/chunks/{chunk-MBNFD2C3.js → chunk-AQN6PDHI.js} +1 -1
- package/dist/cli/chunks/{chunk-YCK464TF.js → chunk-BMS7WFDB.js} +1 -1
- package/dist/cli/chunks/{chunk-C7G7TA2H.js → chunk-BYHUGO73.js} +3 -3
- package/dist/cli/chunks/{chunk-ZZAZQKOA.js → chunk-CFLA2GBS.js} +2 -2
- package/dist/cli/chunks/{chunk-7AIVTUMM.js → chunk-CNKOIHF6.js} +2 -2
- package/dist/cli/chunks/{chunk-23B7TDPN.js → chunk-CQWZNVIM.js} +2 -2
- package/dist/cli/chunks/{chunk-REFFJUYT.js → chunk-CUSLB7MB.js} +2 -2
- package/dist/cli/chunks/chunk-CYUGE5ZQ.js +2 -0
- package/dist/cli/chunks/{chunk-BZ4OMPVJ.js → chunk-DMF4Z2M6.js} +2 -2
- package/dist/cli/chunks/{chunk-HEUAPPKE.js → chunk-DUF733Z7.js} +1 -1
- package/dist/cli/chunks/{chunk-VKJLHKLY.js → chunk-EAIPJSKH.js} +2 -2
- package/dist/cli/chunks/{chunk-GHBQVPJT.js → chunk-EJXRBAQF.js} +2 -2
- package/dist/cli/chunks/{chunk-N6A4XFUM.js → chunk-EKYPQ5DX.js} +1 -1
- package/dist/cli/chunks/{chunk-ZPFBEZV5.js → chunk-ENCFLC44.js} +2 -2
- package/dist/cli/chunks/{chunk-WQX2Q42U.js → chunk-FOAWHNOP.js} +2 -2
- package/dist/cli/chunks/{chunk-GBLW4QDV.js → chunk-FUHPLXJX.js} +1 -1
- package/dist/cli/chunks/{chunk-3E4VPGNW.js → chunk-G2U7Q6V6.js} +2 -2
- package/dist/cli/chunks/{chunk-7WRIYQG7.js → chunk-G3YKCZWQ.js} +3 -3
- package/dist/cli/chunks/{chunk-OLJLSLCY.js → chunk-GJSH4UZ3.js} +3 -3
- package/dist/cli/chunks/{chunk-XP5OUB2X.js → chunk-GN7FUCJH.js} +1 -1
- package/dist/cli/chunks/{chunk-UO3QSXYD.js → chunk-GQFAVT2I.js} +1 -1
- package/dist/cli/chunks/{chunk-AUE4QOT7.js → chunk-HHEIQHLQ.js} +2 -2
- package/dist/cli/chunks/{chunk-LRWREDZU.js → chunk-I3TFGMOQ.js} +1 -1
- package/dist/cli/chunks/{chunk-BUMNLVMC.js → chunk-IRRGUXAU.js} +1 -1
- package/dist/cli/chunks/{chunk-ZMZS6NKQ.js → chunk-IY4P35N3.js} +2 -2
- package/dist/cli/chunks/{chunk-SKIG6EOQ.js → chunk-JF3U456G.js} +2 -2
- package/dist/cli/chunks/{chunk-YEXQMYOM.js → chunk-JJRZOLDY.js} +2 -2
- package/dist/cli/chunks/{chunk-G426VZ5K.js → chunk-JKKV5KKS.js} +2 -2
- package/dist/cli/chunks/{chunk-I6PVI7R5.js → chunk-JMLOEW7Y.js} +2 -2
- package/dist/cli/chunks/chunk-JRIDPOEZ.js +95 -0
- package/dist/cli/chunks/{chunk-MCJRIW7M.js → chunk-K37CNLQZ.js} +1 -1
- package/dist/cli/chunks/{chunk-LIEKDXTS.js → chunk-K6MFAVXK.js} +2 -2
- package/dist/cli/chunks/{chunk-OPPASGEB.js → chunk-KJAIE7SL.js} +4 -4
- package/dist/cli/chunks/{chunk-ZWI5Z2SI.js → chunk-KXRDQQGN.js} +2 -2
- package/dist/cli/chunks/{chunk-Y7VPSAWH.js → chunk-L4JTTPU7.js} +2 -2
- package/dist/cli/chunks/{chunk-RXAJBMM7.js → chunk-L63KB63A.js} +2 -2
- package/dist/cli/chunks/{chunk-KX3XTWNR.js → chunk-L7DNPOAQ.js} +2 -2
- package/dist/cli/chunks/{chunk-LJDPZC6Q.js → chunk-LF5RO6WO.js} +1 -1
- package/dist/cli/chunks/{chunk-GWBI5IMK.js → chunk-LRWRFKQH.js} +1 -1
- package/dist/cli/chunks/{chunk-JXWZZTPN.js → chunk-M6RVKGIP.js} +2 -2
- package/dist/cli/chunks/{chunk-IQXDL7BX.js → chunk-MAJ5QFVY.js} +1 -1
- package/dist/cli/chunks/chunk-MYCVU3D3.js +14 -0
- package/dist/cli/chunks/{chunk-C7SJS5E4.js → chunk-N6P7ENG7.js} +2 -2
- package/dist/cli/chunks/{chunk-KQYKPEY6.js → chunk-N6SIKSCO.js} +2 -2
- package/dist/cli/chunks/{chunk-BP3KVVEM.js → chunk-NBKM7NKX.js} +2 -2
- package/dist/cli/chunks/{chunk-TZG7TJD5.js → chunk-NLUBN642.js} +2 -2
- package/dist/cli/chunks/{chunk-HCVIUAF2.js → chunk-NNF3GCGF.js} +2 -2
- package/dist/cli/chunks/{chunk-AYESXBSX.js → chunk-NTVJKQ5S.js} +2 -2
- package/dist/cli/chunks/{chunk-LPSIKIE2.js → chunk-NZQYNUGM.js} +2 -2
- package/dist/cli/chunks/{chunk-JX2AS6QZ.js → chunk-ONMJJ2C3.js} +1 -1
- package/dist/cli/chunks/{chunk-AOZ3JGJQ.js → chunk-OXOXNAEZ.js} +2 -2
- package/dist/cli/chunks/chunk-PSF6YQQM.js +180 -0
- package/dist/cli/chunks/{chunk-OW47RQEW.js → chunk-PTOTOBOU.js} +1 -1
- package/dist/cli/chunks/{chunk-FIMBLHR5.js → chunk-PUSZ4NBY.js} +2 -2
- package/dist/cli/chunks/chunk-PYYNY7RJ.js +2 -0
- package/dist/cli/chunks/{chunk-JXWJ6BLR.js → chunk-QEJBJST4.js} +1 -1
- package/dist/cli/chunks/{chunk-AQ4ZSM4D.js → chunk-QGLWFZVQ.js} +2 -2
- package/dist/cli/chunks/{chunk-ONFODTGV.js → chunk-QITO7E7Y.js} +1 -1
- package/dist/cli/chunks/{chunk-YWW6YPT5.js → chunk-QMSDKKYG.js} +1 -1
- package/dist/cli/chunks/{chunk-DCZV4QTP.js → chunk-RBDAHW2M.js} +2 -2
- package/dist/cli/chunks/{chunk-TLPIUYN3.js → chunk-RDJWUKIR.js} +2 -2
- package/dist/cli/chunks/{chunk-FDETLFX4.js → chunk-REJEFTWX.js} +1 -1
- package/dist/cli/chunks/{chunk-BVHLZ3TP.js → chunk-ROEIR3OD.js} +1 -1
- package/dist/cli/chunks/{chunk-GTJNB5B4.js → chunk-RTGNWRQI.js} +2 -2
- package/dist/cli/chunks/{chunk-XJJQZULZ.js → chunk-SL4TAJOE.js} +2 -2
- package/dist/cli/chunks/{chunk-ENJBAK7Y.js → chunk-T4DDCMKG.js} +113 -113
- package/dist/cli/chunks/{chunk-ZIX5MU4Q.js → chunk-TJGIIGKL.js} +2 -2
- package/dist/cli/chunks/{chunk-ZOORGOLY.js → chunk-TLCCM2AF.js} +1 -1
- package/dist/cli/chunks/{chunk-RBHWBTKA.js → chunk-TVHWI77X.js} +1 -1
- package/dist/cli/chunks/{chunk-P7HWW3VH.js → chunk-TYUIQSSF.js} +2 -2
- package/dist/cli/chunks/{chunk-YXMKMUQX.js → chunk-UIIEZMSM.js} +1 -1
- package/dist/cli/chunks/{chunk-VWDVQFEV.js → chunk-UIRTXM7C.js} +71 -71
- package/dist/cli/chunks/{chunk-2HUYG6Q6.js → chunk-UNXUSYRL.js} +3 -3
- package/dist/cli/chunks/chunk-VA45HLBF.js +2 -0
- package/dist/cli/chunks/{chunk-BMMXCDTH.js → chunk-VAIOZDG5.js} +1 -1
- package/dist/cli/chunks/{chunk-3YS4ZLL2.js → chunk-VLAGWLHF.js} +2 -2
- package/dist/cli/chunks/{chunk-SCXRYZ3U.js → chunk-VOOJDHLI.js} +14 -8
- package/dist/cli/chunks/{chunk-RRQH5BMQ.js → chunk-VSKABN3B.js} +29 -17
- package/dist/cli/chunks/{chunk-HHDPHHTX.js → chunk-VUL5HIKR.js} +2 -2
- package/dist/cli/chunks/{chunk-ZXWHKLZN.js → chunk-W7XVEWKQ.js} +1 -1
- package/dist/cli/chunks/{chunk-CZEQFAKE.js → chunk-WB6TI6Q3.js} +2 -2
- package/dist/cli/chunks/{chunk-YDBBXRH7.js → chunk-X2FLWV5C.js} +2 -2
- package/dist/cli/chunks/{chunk-G7LVJXZR.js → chunk-XE4YKDIM.js} +2 -2
- package/dist/cli/chunks/{chunk-A7ZCJ2XN.js → chunk-XGBIXRKD.js} +2 -2
- package/dist/cli/chunks/{chunk-B23E53WF.js → chunk-XMMWYQJK.js} +2 -2
- package/dist/cli/chunks/{chunk-3MFAU2JA.js → chunk-XNJ6DIEW.js} +2 -2
- package/dist/cli/chunks/{chunk-VJR2JIYP.js → chunk-XTWYCMAM.js} +2 -2
- package/dist/cli/chunks/{chunk-POV6V35B.js → chunk-XY3WUGD3.js} +2 -2
- package/dist/cli/chunks/{chunk-OU2FFOML.js → chunk-YEZJE2ZW.js} +4 -4
- package/dist/cli/chunks/{chunk-HDKXJMRS.js → chunk-YLEMSN46.js} +1 -1
- package/dist/cli/chunks/{chunk-SH7N3Y63.js → chunk-YMN4C32S.js} +3 -3
- package/dist/cli/chunks/{chunk-KIUJ4EI5.js → chunk-YN7HCVUP.js} +2 -2
- package/dist/cli/chunks/{chunk-WYSM5565.js → chunk-YQJBE6NX.js} +2 -2
- package/dist/cli/chunks/{chunk-QNIOQ4AR.js → chunk-ZBJRNCWX.js} +2 -2
- package/dist/cli/chunks/{chunk-NZIU2SEI.js → chunk-ZG4EKPGV.js} +1 -1
- package/dist/cli/chunks/{chunk-4ZAX5A6E.js → chunk-ZWSRIJ2T.js} +2 -2
- package/dist/cli/chunks/{ci-5BS5ALBZ.js → ci-LRTJSZHT.js} +2 -2
- package/dist/cli/chunks/{ci-output-I7CGW62R.js → ci-output-LISCHUKD.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-7P2V65XX.js → circuit-breaker-7PMP25KZ.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-EKRLBRCE.js → claude-flow-setup-DOW4QVMC.js} +2 -2
- package/dist/cli/chunks/client-XF6SJO2C.js +2 -0
- package/dist/cli/chunks/{cline-installer-U6KRJJHQ.js → cline-installer-2NXQGW73.js} +2 -2
- package/dist/cli/chunks/{code-I6PB6YM7.js → code-3X6RWAS7.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-NP7JW32L.js → code-index-extractor-4ABP5WCP.js} +2 -2
- package/dist/cli/chunks/{codex-installer-52W4TK27.js → codex-installer-V7PII6GL.js} +2 -2
- package/dist/cli/chunks/{completions-LTOAC3Y5.js → completions-Y7LNQ63I.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-RXAF5SX3.js → complexity-analyzer-XLYMAM6I.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-BNUOLW2M.js → continuedev-installer-GOT4TKNT.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-YXANWEVX.js → copilot-installer-D6BAQVIO.js} +2 -2
- package/dist/cli/chunks/{cost-tracker-EBAHKAGL.js → cost-tracker-VT7C5Q52.js} +2 -2
- package/dist/cli/chunks/{coverage-SWVKYJ6V.js → coverage-C62MRP4M.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-J2OFPM6R.js +2 -0
- package/dist/cli/chunks/{cursor-installer-QIZPJ5YQ.js → cursor-installer-WAWSS2K2.js} +2 -2
- package/dist/cli/chunks/{daemon-YPL4BMZX.js → daemon-CP2ETHRF.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-6XXECMF2.js → dag-attention-scheduler-SZIZWPV7.js} +2 -2
- package/dist/cli/chunks/{detect-GGTJLBM6.js → detect-AJX6NJEP.js} +2 -2
- package/dist/cli/chunks/{dist-node-B6P2AD27.js → dist-node-E5X47QTY.js} +2 -2
- package/dist/cli/chunks/{domain-handler-TSZJEND7.js → domain-handler-FN3PIP45.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-EBKK2ZKV.js → domain-transfer-N3TOJEMT.js} +2 -2
- package/dist/cli/chunks/dream-D5LD5SOZ.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-OMRWRS6V.js → embed-and-insert-pattern-PJI5TZKR.js} +2 -2
- package/dist/cli/chunks/{eval-Q5PAQA5O.js → eval-OS54TDQU.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-5MOUWAON.js → experience-capture-middleware-FBM4ANZW.js} +3 -3
- package/dist/cli/chunks/{fast-paths-32E3N4KU.js → fast-paths-2CVAAPQO.js} +2 -2
- package/dist/cli/chunks/{feature-flags-WRIWP5VL.js → feature-flags-A5KFWVFC.js} +2 -2
- package/dist/cli/chunks/{feature-flags-VERJA5SQ.js → feature-flags-GEXTW6OT.js} +2 -2
- package/dist/cli/chunks/{file-discovery-2X6CZSTB.js → file-discovery-KWLVC7KN.js} +2 -2
- package/dist/cli/chunks/{fleet-VB2JTP7P.js → fleet-MNKH356S.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-HNKBFKUD.js → gnn-wrapper-ALTWYFVZ.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-Y5GIRQNS.js → heartbeat-handler-MBMEPEGW.js} +4 -4
- package/dist/cli/chunks/{heartbeat-scheduler-UGB57DTJ.js → heartbeat-scheduler-OH3SS7MH.js} +2 -2
- package/dist/cli/chunks/hnsw-adapter-M2MMM3N6.js +2 -0
- package/dist/cli/chunks/hnsw-index-JO7KNF7M.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-A6G6GPMS.js → hnsw-legacy-bridge-WTD5PR5V.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-XT27JRMH.js → hnswlib-node-WENGW3YX.js} +2 -2
- package/dist/cli/chunks/hooks-ELHGEBFK.js +248 -0
- package/dist/cli/chunks/{hybrid-router-LTAQGTNR.js → hybrid-router-D6ZMIZCE.js} +2 -2
- package/dist/cli/chunks/{hypergraph-engine-IRTPRX6K.js → hypergraph-engine-JOQ6TERZ.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-6IVDHP2K.js → hypergraph-handler-HX45YWWN.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-ROQL4J7P.js +2 -0
- package/dist/cli/chunks/{init-handler-NNLOQN2F.js → init-handler-TNVU6NQ6.js} +6 -6
- package/dist/cli/chunks/init-wizard-4BDFZX4M.js +2 -0
- package/dist/cli/chunks/kernel-37Y63WKR.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-Q5A6WBX2.js → kilocode-installer-YC5RJIY4.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-ZVOLX6AX.js → kiro-installer-EAB26M55.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-V3DX6ZCX.js +2 -0
- package/dist/cli/chunks/learning-A2OB7D2B.js +117 -0
- package/dist/cli/chunks/{llm-router-EFIOXD3E.js → llm-router-KEG6PA7C.js} +4 -4
- package/dist/cli/chunks/{load-7HYD5K5T.js → load-D6ZDLVA3.js} +2 -2
- package/dist/cli/chunks/load-test-HPBA2CMT.js +2 -0
- package/dist/cli/chunks/{mcp-TQEPJY5L.js → mcp-ERJHZ6FN.js} +2 -2
- package/dist/cli/chunks/{memory-2P5KRDUP.js → memory-GSRIJIVR.js} +5 -5
- package/dist/cli/chunks/memory-backend-DODDBB46.js +2 -0
- package/dist/cli/chunks/memory-handlers-MFLCRS7V.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-Z74ALKIH.js → multi-model-executor-GK3V7ERC.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-2NICPXQZ.js → opencode-installer-6TTN26RG.js} +2 -2
- package/dist/cli/chunks/{orchestrator-ZPVU3M4M.js → orchestrator-YVTSM6QW.js} +37 -18
- package/dist/cli/chunks/{pipeline-B55E7S5P.js → pipeline-EWLJCY5G.js} +2 -2
- package/dist/cli/chunks/{platform-6FY6335Y.js → platform-2ULHQQME.js} +2 -2
- package/dist/cli/chunks/{plugin-F23VOSIL.js → plugin-PYN2KOXA.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-LL7WPCNW.js → prime-radiant-advanced-wasm-IULCTOGZ.js} +2 -2
- package/dist/cli/chunks/protocol-executor-D56OYMCJ.js +2 -0
- package/dist/cli/chunks/{protocol-handler-JWPPGEUR.js → protocol-handler-FZYI2SBP.js} +2 -2
- package/dist/cli/chunks/{prove-S4PD63BK.js → prove-DN7S74SP.js} +2 -2
- package/dist/cli/chunks/{provider-manager-R7YYUTO3.js → provider-manager-FT3MCROB.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-KXROIEK7.js +2 -0
- package/dist/cli/chunks/{quality-UIG6G2BR.js → quality-ITBU6LGC.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-XOGATERL.js +2 -0
- package/dist/cli/chunks/{real-embeddings-7GJEWY4C.js → real-embeddings-PZUZ5RXJ.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-Y5YVCVVS.js → roocode-installer-2LMVZOUZ.js} +2 -2
- package/dist/cli/chunks/router-3EHNUCOM.js +2 -0
- package/dist/cli/chunks/routing-feedback-ZHKGET22.js +2 -0
- package/dist/cli/chunks/{routing-handler-YFBT7LZH.js → routing-handler-5RB73UCF.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-7WCRMBWZ.js → ruvector-commands-VBN4APMG.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-PPZ5AVFW.js → rvf-dual-writer-BNY4AUWT.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-SVW4AKVC.js → rvf-migration-adapter-73MKPBGV.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-TNCPU743.js → rvf-migration-coordinator-SGVB7ZAZ.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-4YC5IQUW.js +2 -0
- package/dist/cli/chunks/safe-db-PLJRHQIC.js +2 -0
- package/dist/cli/chunks/schedule-7DGELVJE.js +2 -0
- package/dist/cli/chunks/scheduler-VWASEC2J.js +2 -0
- package/dist/cli/chunks/{security-22YXZGU3.js → security-XUH4H7R3.js} +3 -3
- package/dist/cli/chunks/shared-rvf-adapter-DCVDY2XW.js +2 -0
- package/dist/cli/chunks/{shared-rvf-dual-writer-Q5OSQNW5.js → shared-rvf-dual-writer-GML4EDYF.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-CTEBGVOW.js +2 -0
- package/dist/cli/chunks/{status-handler-CTEEZTVQ.js → status-handler-XI7GJF6Z.js} +2 -2
- package/dist/cli/chunks/{structural-health-S72DLFPZ.js → structural-health-WPCYKOXV.js} +2 -2
- package/dist/cli/chunks/{sync-2AJ5S27F.js → sync-SFKTCRZC.js} +10 -10
- package/dist/cli/chunks/{task-handler-XQCQAUM3.js → task-handler-FZB55IEG.js} +2 -2
- package/dist/cli/chunks/{task-handlers-U6DXLSYJ.js → task-handlers-EXZGFH7F.js} +3 -3
- package/dist/cli/chunks/{test-K7C4CWFH.js → test-XYRN4OVU.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-WQBR6C3V.js → test-scheduling-FLVOPGOT.js} +5 -5
- package/dist/cli/chunks/{token-bootstrap-IRZHAD7N.js → token-bootstrap-FDCFVRHM.js} +2 -2
- package/dist/cli/chunks/{token-usage-DIK6QRD5.js → token-usage-MHNZF3DM.js} +2 -2
- package/dist/cli/chunks/{transformers-RPUPJLSR.js → transformers-4CRVTMWY.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-A45KH4YZ.js → tree-sitter-wasm-parser-CI3V4AND.js} +2 -2
- package/dist/cli/chunks/{types-LO5DGIJC.js → types-RKCD4BNL.js} +2 -2
- package/dist/cli/chunks/unified-memory-YDKXKW3D.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-6N7YZCLR.js +2 -0
- package/dist/cli/chunks/unified-persistence-UTWLPUQI.js +2 -0
- package/dist/cli/chunks/{upgrade-QZNMQOBY.js → upgrade-463W7VKH.js} +2 -2
- package/dist/cli/chunks/{validate-675K5FDZ.js → validate-LENSMEAY.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-TJXJFTT4.js → validate-swarm-4FEBNAWA.js} +2 -2
- package/dist/cli/chunks/{vibium-2FFU5KPE.js → vibium-TXNVIVWJ.js} +2 -2
- package/dist/cli/chunks/visual-security-DGXSOFKD.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-VX55VO25.js → web-tree-sitter-BZEGWID4.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-A7FNN7RB.js → windsurf-installer-7AFXJTPU.js} +2 -2
- package/dist/cli/chunks/{witness-chain-QLIBCLCH.js → witness-chain-G6SUZOZG.js} +2 -2
- package/dist/cli/chunks/witness-chain-VP4MF6EU.js +2 -0
- package/dist/cli/chunks/{workflow-LQDA5VYM.js → workflow-EVQPO6FH.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-VXSYAKQY.js +2 -0
- package/dist/cli/chunks/{wrappers-KE6AZMO6.js → wrappers-HR6RUDI2.js} +2 -2
- package/dist/cli/commands/hooks-handlers/editing-hooks.js +9 -3
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +16 -24
- package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +1 -1
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +8 -1
- package/dist/cli/commands/hooks-handlers/routing-hooks.js +15 -3
- package/dist/cli/commands/hooks-handlers/task-hooks.js +37 -46
- package/dist/cli/commands/learning.js +194 -0
- package/dist/cli/commands/sync.js +3 -0
- package/dist/domains/requirements-validation/services/quality-criteria/quality-criteria-service.js +4 -1
- package/dist/init/phases/07-hooks.js +4 -1
- package/dist/init/phases/10-workers.js +24 -2
- package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.js +15 -12
- package/dist/integrations/n8n/agent-factory.js +4 -1
- package/dist/integrations/n8n/n8n-adapter.js +4 -1
- package/dist/kernel/interfaces.d.ts +12 -0
- package/dist/kernel/kernel.d.ts +1 -0
- package/dist/kernel/kernel.js +57 -0
- package/dist/kernel/unified-memory-schemas.d.ts +1 -1
- package/dist/kernel/unified-memory-schemas.js +7 -1
- package/dist/learning/agent-routing.d.ts +134 -1
- package/dist/learning/agent-routing.js +185 -2
- package/dist/learning/dream/dream-insights-pruner.d.ts +49 -0
- package/dist/learning/dream/dream-insights-pruner.js +53 -0
- package/dist/learning/dream/dream-scheduler.js +17 -0
- package/dist/learning/loop-health.d.ts +84 -0
- package/dist/learning/loop-health.js +91 -0
- package/dist/learning/pattern-usage-recorder.d.ts +58 -0
- package/dist/learning/pattern-usage-recorder.js +72 -0
- package/dist/learning/qe-reasoning-bank-types.d.ts +11 -0
- package/dist/learning/qe-reasoning-bank.d.ts +11 -0
- package/dist/learning/qe-reasoning-bank.js +86 -3
- package/dist/learning/routing-topology-gate.d.ts +40 -0
- package/dist/learning/routing-topology-gate.js +55 -0
- package/dist/learning/sqlite-persistence.d.ts +6 -1
- package/dist/learning/sqlite-persistence.js +14 -20
- package/dist/mcp/bundle.js +3833 -3807
- package/dist/mcp/handlers/domain-handler-configs.js +72 -13
- package/dist/mcp/protocol-server.d.ts +6 -0
- package/dist/mcp/protocol-server.js +91 -2
- package/dist/mcp/tools/coherence/collapse.d.ts +4 -0
- package/dist/mcp/tools/coherence/collapse.js +48 -21
- package/dist/mcp/tools/embeddings/embedding.js +5 -2
- package/dist/routing/routing-feedback.js +7 -3
- package/dist/routing/routing-outcomes-migration.d.ts +31 -0
- package/dist/routing/routing-outcomes-migration.js +60 -0
- package/dist/test-scheduling/pipeline.d.ts +1 -1
- package/dist/test-scheduling/pipeline.js +8 -2
- package/dist/workers/workers/learning-consolidation.d.ts +28 -0
- package/dist/workers/workers/learning-consolidation.js +204 -0
- package/dist/workflows/browser/workflow-loader.js +4 -1
- package/package.json +1 -1
- package/dist/cli/chunks/adapter-4NVP2SYD.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-ZTR5KIGB.js +0 -2
- package/dist/cli/chunks/base-2M65XYDE.js +0 -2
- package/dist/cli/chunks/browser-workflow-7EXB6DUF.js +0 -2
- package/dist/cli/chunks/chunk-6ZJROHI3.js +0 -2
- package/dist/cli/chunks/chunk-J3CLEYJP.js +0 -14
- package/dist/cli/chunks/chunk-SRSL5OFF.js +0 -180
- package/dist/cli/chunks/chunk-WLPP7V3W.js +0 -95
- package/dist/cli/chunks/chunk-YXS6SHB2.js +0 -2
- package/dist/cli/chunks/client-KTEVHNVO.js +0 -2
- package/dist/cli/chunks/cross-domain-router-23RTLMQL.js +0 -2
- package/dist/cli/chunks/dream-KNO2ZF24.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-JQHOAYXA.js +0 -2
- package/dist/cli/chunks/hnsw-index-AIUQDZLY.js +0 -2
- package/dist/cli/chunks/hooks-Z4U7DCTP.js +0 -259
- package/dist/cli/chunks/impact-analyzer-ULJRGNBM.js +0 -2
- package/dist/cli/chunks/init-wizard-R2WC5V2W.js +0 -2
- package/dist/cli/chunks/kernel-ZDQG4UWQ.js +0 -2
- package/dist/cli/chunks/knowledge-graph-RLCAQW6I.js +0 -2
- package/dist/cli/chunks/learning-NZLHSX4F.js +0 -107
- package/dist/cli/chunks/load-test-KH35UZSW.js +0 -2
- package/dist/cli/chunks/memory-backend-NOYRJTBH.js +0 -2
- package/dist/cli/chunks/memory-handlers-YEQ4LSIX.js +0 -2
- package/dist/cli/chunks/protocol-executor-OL36TRHK.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-C4QW56VE.js +0 -2
- package/dist/cli/chunks/queen-coordinator-FDDIA6BW.js +0 -2
- package/dist/cli/chunks/router-RRKX62UE.js +0 -2
- package/dist/cli/chunks/routing-feedback-NRJJVC35.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-TQLQYN7Y.js +0 -2
- package/dist/cli/chunks/safe-db-COFZGOYL.js +0 -2
- package/dist/cli/chunks/schedule-QAMKOCVJ.js +0 -2
- package/dist/cli/chunks/scheduler-RFETEEGY.js +0 -2
- package/dist/cli/chunks/shared-rvf-adapter-QNA66NKB.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-43TV2RI3.js +0 -2
- package/dist/cli/chunks/unified-memory-VSSMXGHP.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-ZV324XYA.js +0 -2
- package/dist/cli/chunks/unified-persistence-EE2UVIXW.js +0 -2
- package/dist/cli/chunks/visual-security-LWH7LME7.js +0 -2
- package/dist/cli/chunks/witness-chain-3YAV5SLZ.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-4UG2CNYN.js +0 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dream Insights Pruner (#488 C.2)
|
|
3
|
+
*
|
|
4
|
+
* Periodic retention sweep for the `dream_insights` table.
|
|
5
|
+
*
|
|
6
|
+
* dream_insights accumulate forever in default deployments — the schema has
|
|
7
|
+
* `created_at` but no `expires_at`, no foreign-key cascade that fires on
|
|
8
|
+
* regular cycle delete (cycles aren't routinely purged either), and no
|
|
9
|
+
* equivalent of `pattern-lifecycle.ts`'s decay/deprecation pass.
|
|
10
|
+
*
|
|
11
|
+
* Observed in state-rich shops (per #488 reporter): 120+ rows accumulated
|
|
12
|
+
* over ~30h of activity, with most at `applied = 0`. Without pruning, this
|
|
13
|
+
* grows linearly with hook activity. Over months the table becomes a slow
|
|
14
|
+
* `getPendingInsights` target and vector embeddings (if attached) grow
|
|
15
|
+
* unbounded.
|
|
16
|
+
*
|
|
17
|
+
* Strategy: delete only insights that:
|
|
18
|
+
* - have never been applied (`applied = 0`), AND
|
|
19
|
+
* - are older than the retention window (default 30 days)
|
|
20
|
+
*
|
|
21
|
+
* Applied insights stay forever — they're part of the audit trail for
|
|
22
|
+
* pattern changes. Recently-created insights stay regardless of applied
|
|
23
|
+
* state — they might still be picked up by a future `applyInsight` pass.
|
|
24
|
+
*
|
|
25
|
+
* Called from `LearningConsolidationWorker.runContinuousLearningLoop` on
|
|
26
|
+
* the 30-min worker tick. Failures are non-fatal — the worker continues
|
|
27
|
+
* with the rest of its lifecycle work.
|
|
28
|
+
*/
|
|
29
|
+
import type { Database as DatabaseType } from 'better-sqlite3';
|
|
30
|
+
export interface PruneStaleDreamInsightsOptions {
|
|
31
|
+
/**
|
|
32
|
+
* How many days old an `applied = 0` insight must be before it's
|
|
33
|
+
* eligible for deletion. Defaults to 30 days — matches the
|
|
34
|
+
* `staleDaysThreshold` used by `pattern-lifecycle.ts` for consistency.
|
|
35
|
+
*/
|
|
36
|
+
retentionDays?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface PruneResult {
|
|
39
|
+
/** Number of rows deleted. Zero if the table is empty or no rows qualify. */
|
|
40
|
+
pruned: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Delete stale unapplied insights. Idempotent — safe to call on every tick.
|
|
44
|
+
*
|
|
45
|
+
* Returns `{ pruned: 0 }` if the table doesn't exist (init hasn't created
|
|
46
|
+
* the dream schema yet) or if no rows qualify.
|
|
47
|
+
*/
|
|
48
|
+
export declare function pruneStaleDreamInsights(db: DatabaseType, options?: PruneStaleDreamInsightsOptions): PruneResult;
|
|
49
|
+
//# sourceMappingURL=dream-insights-pruner.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dream Insights Pruner (#488 C.2)
|
|
3
|
+
*
|
|
4
|
+
* Periodic retention sweep for the `dream_insights` table.
|
|
5
|
+
*
|
|
6
|
+
* dream_insights accumulate forever in default deployments — the schema has
|
|
7
|
+
* `created_at` but no `expires_at`, no foreign-key cascade that fires on
|
|
8
|
+
* regular cycle delete (cycles aren't routinely purged either), and no
|
|
9
|
+
* equivalent of `pattern-lifecycle.ts`'s decay/deprecation pass.
|
|
10
|
+
*
|
|
11
|
+
* Observed in state-rich shops (per #488 reporter): 120+ rows accumulated
|
|
12
|
+
* over ~30h of activity, with most at `applied = 0`. Without pruning, this
|
|
13
|
+
* grows linearly with hook activity. Over months the table becomes a slow
|
|
14
|
+
* `getPendingInsights` target and vector embeddings (if attached) grow
|
|
15
|
+
* unbounded.
|
|
16
|
+
*
|
|
17
|
+
* Strategy: delete only insights that:
|
|
18
|
+
* - have never been applied (`applied = 0`), AND
|
|
19
|
+
* - are older than the retention window (default 30 days)
|
|
20
|
+
*
|
|
21
|
+
* Applied insights stay forever — they're part of the audit trail for
|
|
22
|
+
* pattern changes. Recently-created insights stay regardless of applied
|
|
23
|
+
* state — they might still be picked up by a future `applyInsight` pass.
|
|
24
|
+
*
|
|
25
|
+
* Called from `LearningConsolidationWorker.runContinuousLearningLoop` on
|
|
26
|
+
* the 30-min worker tick. Failures are non-fatal — the worker continues
|
|
27
|
+
* with the rest of its lifecycle work.
|
|
28
|
+
*/
|
|
29
|
+
const DEFAULT_RETENTION_DAYS = 30;
|
|
30
|
+
/**
|
|
31
|
+
* Delete stale unapplied insights. Idempotent — safe to call on every tick.
|
|
32
|
+
*
|
|
33
|
+
* Returns `{ pruned: 0 }` if the table doesn't exist (init hasn't created
|
|
34
|
+
* the dream schema yet) or if no rows qualify.
|
|
35
|
+
*/
|
|
36
|
+
export function pruneStaleDreamInsights(db, options = {}) {
|
|
37
|
+
const retentionDays = options.retentionDays ?? DEFAULT_RETENTION_DAYS;
|
|
38
|
+
// Guard against the table not existing yet — a freshly-init'd shop may
|
|
39
|
+
// have started the worker before the dream schema was applied.
|
|
40
|
+
const tableExists = db
|
|
41
|
+
.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='dream_insights'")
|
|
42
|
+
.get();
|
|
43
|
+
if (!tableExists) {
|
|
44
|
+
return { pruned: 0 };
|
|
45
|
+
}
|
|
46
|
+
const result = db
|
|
47
|
+
.prepare(`DELETE FROM dream_insights
|
|
48
|
+
WHERE applied = 0
|
|
49
|
+
AND created_at < datetime('now', ?)`)
|
|
50
|
+
.run(`-${retentionDays} days`);
|
|
51
|
+
return { pruned: result.changes };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=dream-insights-pruner.js.map
|
|
@@ -17,6 +17,9 @@ import { LoggerFactory } from '../../logging/index.js';
|
|
|
17
17
|
// ADR-062: Meta-learning integration
|
|
18
18
|
import { MetaLearningEngine, DEFAULT_META_LEARNING_CONFIG, } from '../aqe-learning-engine.js';
|
|
19
19
|
import { LearningMetricsTracker, } from '../metrics-tracker.js';
|
|
20
|
+
// ADR-094 / #488 B.2: record per-tick liveness so `aqe learning loop-health`
|
|
21
|
+
// surfaces the kernel-side dream loop as live.
|
|
22
|
+
import { recordLoopHealth } from '../loop-health.js';
|
|
20
23
|
const logger = LoggerFactory.create('DreamScheduler');
|
|
21
24
|
/**
|
|
22
25
|
* Default DreamScheduler configuration
|
|
@@ -333,6 +336,7 @@ export class DreamScheduler {
|
|
|
333
336
|
}
|
|
334
337
|
this.dreaming = true;
|
|
335
338
|
logger.info('Starting dream cycle', { durationMs });
|
|
339
|
+
let dreamError;
|
|
336
340
|
try {
|
|
337
341
|
// Ensure concepts are loaded before dreaming
|
|
338
342
|
const loaded = await this.dreamEngine.ensureConceptsLoaded();
|
|
@@ -372,8 +376,21 @@ export class DreamScheduler {
|
|
|
372
376
|
logger.info('Dream completed', { insightsGenerated: result.insights.length });
|
|
373
377
|
return result;
|
|
374
378
|
}
|
|
379
|
+
catch (err) {
|
|
380
|
+
dreamError = err instanceof Error ? err : new Error(String(err));
|
|
381
|
+
throw err;
|
|
382
|
+
}
|
|
375
383
|
finally {
|
|
376
384
|
this.dreaming = false;
|
|
385
|
+
// ADR-094 / #488 B.2: record liveness so `aqe learning loop-health`
|
|
386
|
+
// can show the kernel-side dream scheduler as live. Best-effort —
|
|
387
|
+
// recordLoopHealth itself never throws.
|
|
388
|
+
if (this.memoryBackend) {
|
|
389
|
+
await recordLoopHealth(this.memoryBackend, 'dreamScheduler', {
|
|
390
|
+
success: !dreamError,
|
|
391
|
+
error: dreamError,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
377
394
|
}
|
|
378
395
|
}
|
|
379
396
|
/**
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-Learning Loop Health (#488 B.2)
|
|
3
|
+
*
|
|
4
|
+
* Records per-component liveness signals for the AQE self-learning loop:
|
|
5
|
+
*
|
|
6
|
+
* captured_experiences (SQLite)
|
|
7
|
+
* → CapturedExperienceBridge.drain (component: 'bridge')
|
|
8
|
+
* → learning:experience:* kv
|
|
9
|
+
* → LearningConsolidationWorker.tick (component: 'learningWorker')
|
|
10
|
+
* → learning:pattern:* kv
|
|
11
|
+
* → DreamScheduler.tick (component: 'dreamScheduler')
|
|
12
|
+
* → dream_insights / qe_patterns
|
|
13
|
+
*
|
|
14
|
+
* Each tick records `{ success: true }` so operators can answer "is the
|
|
15
|
+
* loop closing end-to-end?" without DB-mining `dream_cycles`, `kv_store`,
|
|
16
|
+
* and `routing_outcomes` separately. Cumulative counters in `aqe learning
|
|
17
|
+
* stats` are not enough: they grow forever and can't distinguish "healthy
|
|
18
|
+
* loop" from "loop wedged 3 hours ago with stale totals".
|
|
19
|
+
*
|
|
20
|
+
* Persists as a single JSON value under `learning:loop-health` in the
|
|
21
|
+
* unified memory. Cheap to write (~200 bytes), cheap to read.
|
|
22
|
+
*/
|
|
23
|
+
import type { MemoryBackend } from '../kernel/interfaces.js';
|
|
24
|
+
export declare const LOOP_HEALTH_KEY = "learning:loop-health";
|
|
25
|
+
export type LoopComponent = 'bridge' | 'dreamScheduler' | 'learningWorker';
|
|
26
|
+
export interface ComponentHealth {
|
|
27
|
+
/** ISO timestamp of the most recent successful tick. Empty string when never succeeded. */
|
|
28
|
+
lastSuccessAt: string;
|
|
29
|
+
/** Total ticks attempted since this loop-health record was created. */
|
|
30
|
+
ticksSinceBoot: number;
|
|
31
|
+
/** Total successful ticks since this loop-health record was created. */
|
|
32
|
+
successesSinceBoot: number;
|
|
33
|
+
/** Most recent error captured during a failed tick. Cleared on next success. */
|
|
34
|
+
lastError?: {
|
|
35
|
+
message: string;
|
|
36
|
+
at: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface LoopHealth {
|
|
40
|
+
/** Max(lastSuccessAt across components). Empty string when nothing has succeeded yet. */
|
|
41
|
+
overallLastSuccess: string;
|
|
42
|
+
/** ISO timestamp when this record was first written. */
|
|
43
|
+
bootedAt: string;
|
|
44
|
+
/** Per-component status. Components are added on first tick — absence means never invoked. */
|
|
45
|
+
components: {
|
|
46
|
+
bridge?: ComponentHealth;
|
|
47
|
+
dreamScheduler?: ComponentHealth;
|
|
48
|
+
learningWorker?: ComponentHealth;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Minimal memory interface this module needs. Both `MemoryBackend` (kernel)
|
|
53
|
+
* and `WorkerMemory` (worker context) satisfy this — the helper stays
|
|
54
|
+
* transport-agnostic so writers can call it without knowing which they hold.
|
|
55
|
+
*/
|
|
56
|
+
export interface LoopHealthMemory {
|
|
57
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
58
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Record one tick of a component. Always best-effort: a write failure here
|
|
62
|
+
* MUST NOT propagate to the calling component (the bridge / worker should
|
|
63
|
+
* keep running even if the health key can't be persisted).
|
|
64
|
+
*/
|
|
65
|
+
export declare function recordLoopHealth(memory: LoopHealthMemory | MemoryBackend, component: LoopComponent, result: {
|
|
66
|
+
success: boolean;
|
|
67
|
+
error?: Error | string;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Read the current loop-health record. Returns undefined if no tick has
|
|
71
|
+
* ever fired — operators reading via `aqe learning loop-health` should
|
|
72
|
+
* interpret undefined as "the loop hasn't started yet (or workers aren't
|
|
73
|
+
* running)" rather than "the loop is healthy".
|
|
74
|
+
*/
|
|
75
|
+
export declare function getLoopHealth(memory: LoopHealthMemory | MemoryBackend): Promise<LoopHealth | undefined>;
|
|
76
|
+
/**
|
|
77
|
+
* Compute a staleness verdict per component given a "stale after" threshold.
|
|
78
|
+
* Caller chooses the threshold based on the component's expected cadence:
|
|
79
|
+
* - bridge: 5s poll → stale after ~30s
|
|
80
|
+
* - learningWorker: 30 min tick → stale after ~2h
|
|
81
|
+
* - dreamScheduler: variable → caller's call
|
|
82
|
+
*/
|
|
83
|
+
export declare function isComponentStale(health: ComponentHealth | undefined, staleAfterMs: number, now?: Date): boolean;
|
|
84
|
+
//# sourceMappingURL=loop-health.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-Learning Loop Health (#488 B.2)
|
|
3
|
+
*
|
|
4
|
+
* Records per-component liveness signals for the AQE self-learning loop:
|
|
5
|
+
*
|
|
6
|
+
* captured_experiences (SQLite)
|
|
7
|
+
* → CapturedExperienceBridge.drain (component: 'bridge')
|
|
8
|
+
* → learning:experience:* kv
|
|
9
|
+
* → LearningConsolidationWorker.tick (component: 'learningWorker')
|
|
10
|
+
* → learning:pattern:* kv
|
|
11
|
+
* → DreamScheduler.tick (component: 'dreamScheduler')
|
|
12
|
+
* → dream_insights / qe_patterns
|
|
13
|
+
*
|
|
14
|
+
* Each tick records `{ success: true }` so operators can answer "is the
|
|
15
|
+
* loop closing end-to-end?" without DB-mining `dream_cycles`, `kv_store`,
|
|
16
|
+
* and `routing_outcomes` separately. Cumulative counters in `aqe learning
|
|
17
|
+
* stats` are not enough: they grow forever and can't distinguish "healthy
|
|
18
|
+
* loop" from "loop wedged 3 hours ago with stale totals".
|
|
19
|
+
*
|
|
20
|
+
* Persists as a single JSON value under `learning:loop-health` in the
|
|
21
|
+
* unified memory. Cheap to write (~200 bytes), cheap to read.
|
|
22
|
+
*/
|
|
23
|
+
export const LOOP_HEALTH_KEY = 'learning:loop-health';
|
|
24
|
+
/**
|
|
25
|
+
* Record one tick of a component. Always best-effort: a write failure here
|
|
26
|
+
* MUST NOT propagate to the calling component (the bridge / worker should
|
|
27
|
+
* keep running even if the health key can't be persisted).
|
|
28
|
+
*/
|
|
29
|
+
export async function recordLoopHealth(memory, component, result) {
|
|
30
|
+
try {
|
|
31
|
+
const now = new Date().toISOString();
|
|
32
|
+
const state = (await memory.get(LOOP_HEALTH_KEY)) ?? {
|
|
33
|
+
overallLastSuccess: '',
|
|
34
|
+
bootedAt: now,
|
|
35
|
+
components: {},
|
|
36
|
+
};
|
|
37
|
+
const existing = state.components[component] ?? {
|
|
38
|
+
lastSuccessAt: '',
|
|
39
|
+
ticksSinceBoot: 0,
|
|
40
|
+
successesSinceBoot: 0,
|
|
41
|
+
};
|
|
42
|
+
existing.ticksSinceBoot += 1;
|
|
43
|
+
if (result.success) {
|
|
44
|
+
existing.lastSuccessAt = now;
|
|
45
|
+
existing.successesSinceBoot += 1;
|
|
46
|
+
delete existing.lastError;
|
|
47
|
+
}
|
|
48
|
+
else if (result.error) {
|
|
49
|
+
const message = result.error instanceof Error ? result.error.message : String(result.error);
|
|
50
|
+
existing.lastError = { message, at: now };
|
|
51
|
+
}
|
|
52
|
+
state.components[component] = existing;
|
|
53
|
+
// Recompute overallLastSuccess as max(component.lastSuccessAt). ISO 8601
|
|
54
|
+
// strings sort lexicographically the same as chronologically.
|
|
55
|
+
const successTimes = Object.values(state.components)
|
|
56
|
+
.map((c) => c?.lastSuccessAt ?? '')
|
|
57
|
+
.filter((t) => t !== '');
|
|
58
|
+
state.overallLastSuccess = successTimes.length > 0 ? successTimes.sort().pop() : '';
|
|
59
|
+
await memory.set(LOOP_HEALTH_KEY, state);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Loop-health is itself best-effort observability. Never throw.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Read the current loop-health record. Returns undefined if no tick has
|
|
67
|
+
* ever fired — operators reading via `aqe learning loop-health` should
|
|
68
|
+
* interpret undefined as "the loop hasn't started yet (or workers aren't
|
|
69
|
+
* running)" rather than "the loop is healthy".
|
|
70
|
+
*/
|
|
71
|
+
export async function getLoopHealth(memory) {
|
|
72
|
+
try {
|
|
73
|
+
return await memory.get(LOOP_HEALTH_KEY);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Compute a staleness verdict per component given a "stale after" threshold.
|
|
81
|
+
* Caller chooses the threshold based on the component's expected cadence:
|
|
82
|
+
* - bridge: 5s poll → stale after ~30s
|
|
83
|
+
* - learningWorker: 30 min tick → stale after ~2h
|
|
84
|
+
* - dreamScheduler: variable → caller's call
|
|
85
|
+
*/
|
|
86
|
+
export function isComponentStale(health, staleAfterMs, now = new Date()) {
|
|
87
|
+
if (!health || !health.lastSuccessAt)
|
|
88
|
+
return true;
|
|
89
|
+
return now.getTime() - new Date(health.lastSuccessAt).getTime() > staleAfterMs;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=loop-health.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Usage Recorder
|
|
3
|
+
* ADR-021: QE ReasoningBank for Pattern Learning (single-writer extension)
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth for "pattern was used in a task" accounting:
|
|
6
|
+
*
|
|
7
|
+
* - INSERTs a row into qe_pattern_usage (per-use audit trail)
|
|
8
|
+
* - UPDATEs qe_patterns.{usage_count, successful_uses, success_rate,
|
|
9
|
+
* quality_score, last_used_at, updated_at}
|
|
10
|
+
*
|
|
11
|
+
* Both writes happen inside ONE transaction so the audit trail and the
|
|
12
|
+
* aggregate columns never disagree on count.
|
|
13
|
+
*
|
|
14
|
+
* Before this helper, two parallel writers existed (#486 Gap B):
|
|
15
|
+
* - SQLitePatternStore.recordUsage — did BOTH INSERT and UPDATE atomically
|
|
16
|
+
* - hooks-dream-learning.ts inline UPDATE — did UPDATE only, skipping the
|
|
17
|
+
* audit INSERT. Hook-driven usage stayed invisible in qe_pattern_usage
|
|
18
|
+
* even as qe_patterns.usage_count incremented.
|
|
19
|
+
*
|
|
20
|
+
* Quality formula (mirrors pattern-lifecycle.ts and the legacy inline hook):
|
|
21
|
+
* quality_score = confidence * 0.3 + min(usage_count/100, 1) * 0.2 + success_rate * 0.5
|
|
22
|
+
*/
|
|
23
|
+
import type { Database as DatabaseType } from 'better-sqlite3';
|
|
24
|
+
export interface PatternUsageRecord {
|
|
25
|
+
patternId: string;
|
|
26
|
+
success: boolean;
|
|
27
|
+
metrics?: Record<string, unknown>;
|
|
28
|
+
feedback?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface PatternUsageResult {
|
|
31
|
+
/**
|
|
32
|
+
* Whether the helper found and updated the pattern row.
|
|
33
|
+
* False (no throw) if patternId doesn't exist, since hook subprocesses
|
|
34
|
+
* iterate over selectedPatternIds that may include stale UUIDs from
|
|
35
|
+
* the routing kv. Callers who want strict semantics should check this
|
|
36
|
+
* flag and throw themselves.
|
|
37
|
+
*/
|
|
38
|
+
updated: boolean;
|
|
39
|
+
/** Post-update usage_count. Undefined if !updated. */
|
|
40
|
+
usageCount?: number;
|
|
41
|
+
/** Post-update successful_uses. Undefined if !updated. */
|
|
42
|
+
successfulUses?: number;
|
|
43
|
+
/** Post-update success_rate. Undefined if !updated. */
|
|
44
|
+
successRate?: number;
|
|
45
|
+
/** Post-update quality_score. Undefined if !updated. */
|
|
46
|
+
qualityScore?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Record one use of a pattern atomically across qe_pattern_usage and qe_patterns.
|
|
50
|
+
*
|
|
51
|
+
* Idempotency: each call inserts ONE audit row and increments usage_count by ONE.
|
|
52
|
+
* The transaction makes the two writes atomic — if either fails, neither lands.
|
|
53
|
+
*
|
|
54
|
+
* Concurrency: better-sqlite3 transactions are serialized at the connection
|
|
55
|
+
* level. Multiple concurrent callers on the same connection will queue.
|
|
56
|
+
*/
|
|
57
|
+
export declare function recordPatternUsage(db: DatabaseType, record: PatternUsageRecord): PatternUsageResult;
|
|
58
|
+
//# sourceMappingURL=pattern-usage-recorder.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Usage Recorder
|
|
3
|
+
* ADR-021: QE ReasoningBank for Pattern Learning (single-writer extension)
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth for "pattern was used in a task" accounting:
|
|
6
|
+
*
|
|
7
|
+
* - INSERTs a row into qe_pattern_usage (per-use audit trail)
|
|
8
|
+
* - UPDATEs qe_patterns.{usage_count, successful_uses, success_rate,
|
|
9
|
+
* quality_score, last_used_at, updated_at}
|
|
10
|
+
*
|
|
11
|
+
* Both writes happen inside ONE transaction so the audit trail and the
|
|
12
|
+
* aggregate columns never disagree on count.
|
|
13
|
+
*
|
|
14
|
+
* Before this helper, two parallel writers existed (#486 Gap B):
|
|
15
|
+
* - SQLitePatternStore.recordUsage — did BOTH INSERT and UPDATE atomically
|
|
16
|
+
* - hooks-dream-learning.ts inline UPDATE — did UPDATE only, skipping the
|
|
17
|
+
* audit INSERT. Hook-driven usage stayed invisible in qe_pattern_usage
|
|
18
|
+
* even as qe_patterns.usage_count incremented.
|
|
19
|
+
*
|
|
20
|
+
* Quality formula (mirrors pattern-lifecycle.ts and the legacy inline hook):
|
|
21
|
+
* quality_score = confidence * 0.3 + min(usage_count/100, 1) * 0.2 + success_rate * 0.5
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Record one use of a pattern atomically across qe_pattern_usage and qe_patterns.
|
|
25
|
+
*
|
|
26
|
+
* Idempotency: each call inserts ONE audit row and increments usage_count by ONE.
|
|
27
|
+
* The transaction makes the two writes atomic — if either fails, neither lands.
|
|
28
|
+
*
|
|
29
|
+
* Concurrency: better-sqlite3 transactions are serialized at the connection
|
|
30
|
+
* level. Multiple concurrent callers on the same connection will queue.
|
|
31
|
+
*/
|
|
32
|
+
export function recordPatternUsage(db, record) {
|
|
33
|
+
const pattern = db
|
|
34
|
+
.prepare(`SELECT confidence, usage_count, successful_uses FROM qe_patterns WHERE id = ?`)
|
|
35
|
+
.get(record.patternId);
|
|
36
|
+
if (!pattern) {
|
|
37
|
+
return { updated: false };
|
|
38
|
+
}
|
|
39
|
+
const successInc = record.success ? 1 : 0;
|
|
40
|
+
const newUsageCount = pattern.usage_count + 1;
|
|
41
|
+
const newSuccessfulUses = pattern.successful_uses + successInc;
|
|
42
|
+
const newSuccessRate = newSuccessfulUses / newUsageCount;
|
|
43
|
+
const usageScore = Math.min(1, newUsageCount / 100);
|
|
44
|
+
const newQualityScore = pattern.confidence * 0.3 + usageScore * 0.2 + newSuccessRate * 0.5;
|
|
45
|
+
const insertUsage = db.prepare(`
|
|
46
|
+
INSERT INTO qe_pattern_usage (pattern_id, success, metrics_json, feedback)
|
|
47
|
+
VALUES (?, ?, ?, ?)
|
|
48
|
+
`);
|
|
49
|
+
const updatePattern = db.prepare(`
|
|
50
|
+
UPDATE qe_patterns SET
|
|
51
|
+
usage_count = ?,
|
|
52
|
+
successful_uses = ?,
|
|
53
|
+
success_rate = ?,
|
|
54
|
+
quality_score = ?,
|
|
55
|
+
last_used_at = datetime('now'),
|
|
56
|
+
updated_at = datetime('now')
|
|
57
|
+
WHERE id = ?
|
|
58
|
+
`);
|
|
59
|
+
const txn = db.transaction(() => {
|
|
60
|
+
insertUsage.run(record.patternId, successInc, record.metrics ? JSON.stringify(record.metrics) : null, record.feedback ?? null);
|
|
61
|
+
updatePattern.run(newUsageCount, newSuccessfulUses, newSuccessRate, newQualityScore, record.patternId);
|
|
62
|
+
});
|
|
63
|
+
txn();
|
|
64
|
+
return {
|
|
65
|
+
updated: true,
|
|
66
|
+
usageCount: newUsageCount,
|
|
67
|
+
successfulUses: newSuccessfulUses,
|
|
68
|
+
successRate: newSuccessRate,
|
|
69
|
+
qualityScore: newQualityScore,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=pattern-usage-recorder.js.map
|
|
@@ -79,6 +79,17 @@ export interface QERoutingResult {
|
|
|
79
79
|
guidance: string[];
|
|
80
80
|
/** Reasoning for the recommendation */
|
|
81
81
|
reasoning: string;
|
|
82
|
+
/**
|
|
83
|
+
* ADR-095 telemetry — all optional, populated by routeTask when the
|
|
84
|
+
* exploration / Q-value path runs. Callers persist these into
|
|
85
|
+
* routing_outcomes for retrospective analysis.
|
|
86
|
+
*/
|
|
87
|
+
/** True if ε-greedy promoted an alternative over the greedy winner. */
|
|
88
|
+
exploration?: boolean;
|
|
89
|
+
/** Mincut safety multiplier in effect (1.0 = full rate, 0.2 = dampened). */
|
|
90
|
+
criticality?: number;
|
|
91
|
+
/** Average qWeight across the scored agents — proxy for Q-table maturity. */
|
|
92
|
+
qWeight?: number;
|
|
82
93
|
}
|
|
83
94
|
/**
|
|
84
95
|
* Pattern learning outcome
|
|
@@ -118,6 +118,17 @@ export declare class QEReasoningBank implements IQEReasoningBank {
|
|
|
118
118
|
* Route a task to optimal agent
|
|
119
119
|
*/
|
|
120
120
|
routeTask(request: QERoutingRequest): Promise<Result<QERoutingResult>>;
|
|
121
|
+
/**
|
|
122
|
+
* ADR-095: Build a per-agent Q-value lookup closure for the current
|
|
123
|
+
* routing decision. The closure executes a prepared-statement query
|
|
124
|
+
* against `rl_q_values` for each agent considered.
|
|
125
|
+
*
|
|
126
|
+
* Returns a no-op lookup when the unified memory backend is unavailable
|
|
127
|
+
* (e.g. during early boot or in tests that don't initialize SQLite).
|
|
128
|
+
* The no-op causes `calculateAgentScores` to fall back to pure-static
|
|
129
|
+
* scoring — identical to pre-ADR-095 behavior.
|
|
130
|
+
*/
|
|
131
|
+
private buildQValueLookup;
|
|
121
132
|
/**
|
|
122
133
|
* Get guidance for a domain
|
|
123
134
|
*/
|
|
@@ -25,7 +25,9 @@ import { getWitnessChain } from '../audit/witness-chain.js';
|
|
|
25
25
|
// Import extracted modules
|
|
26
26
|
import { DEFAULT_QE_REASONING_BANK_CONFIG } from './qe-reasoning-bank-types.js';
|
|
27
27
|
import { PRETRAINED_PATTERNS } from './pretrained-patterns.js';
|
|
28
|
-
import { AGENT_CAPABILITIES, calculateAgentScores, } from './agent-routing.js';
|
|
28
|
+
import { AGENT_CAPABILITIES, calculateAgentScores, applyExplorationPolicy, resolveExplorationRate, deriveTaskType, buildRoutingStateKey, deriveComplexityBucket, } from './agent-routing.js';
|
|
29
|
+
import { resolveTopologyCriticalFromSharedMincut } from './routing-topology-gate.js';
|
|
30
|
+
import { getUnifiedMemory } from '../kernel/unified-memory.js';
|
|
29
31
|
import { resizeEmbedding, hashEmbedding } from './embedding-utils.js';
|
|
30
32
|
import { checkPatternPromotionWithCoherence, promotePattern as promotePatternFn, seedCrossDomainPatterns as seedCrossDomainPatternsFn, } from './pattern-promotion.js';
|
|
31
33
|
// ============================================================================
|
|
@@ -395,8 +397,35 @@ export class QEReasoningBank {
|
|
|
395
397
|
agentDomainPatternCounts.set(agentType, count);
|
|
396
398
|
}
|
|
397
399
|
}
|
|
398
|
-
//
|
|
399
|
-
|
|
400
|
+
// ADR-095: build the Q-value lookup closure from the task's state_key.
|
|
401
|
+
// The state_key MUST match what `updateHookRouterQValue` writes from
|
|
402
|
+
// post-task — buildRoutingStateKey enforces that.
|
|
403
|
+
const stateKey = buildRoutingStateKey({
|
|
404
|
+
taskType: deriveTaskType(request.task),
|
|
405
|
+
priority: 'normal',
|
|
406
|
+
domain: detectedDomains[0],
|
|
407
|
+
complexityBucket: deriveComplexityBucket(request.task),
|
|
408
|
+
});
|
|
409
|
+
const qValueLookup = this.buildQValueLookup(stateKey);
|
|
410
|
+
// 4. Calculate agent scores (now Q-blended when lookup available)
|
|
411
|
+
const agentScores = calculateAgentScores(detectedDomains, request.capabilities, agentDomainPatternCounts, this.config.routingWeights, AGENT_CAPABILITIES, request.context?.language, qValueLookup);
|
|
412
|
+
// ADR-095: ε-greedy exploration with mincut safety gate.
|
|
413
|
+
// The exploration is best-effort — failures fall through to greedy.
|
|
414
|
+
// Topology check uses `resolveTopologyCriticalFromSharedMincut` —
|
|
415
|
+
// see that module for the empty-graph regression context.
|
|
416
|
+
let safetyMultiplier = 1.0;
|
|
417
|
+
try {
|
|
418
|
+
const topologyCritical = resolveTopologyCriticalFromSharedMincut();
|
|
419
|
+
const rateInfo = resolveExplorationRate({
|
|
420
|
+
envOverride: process.env.AQE_ROUTER_EXPLORATION_RATE,
|
|
421
|
+
topologyCritical,
|
|
422
|
+
});
|
|
423
|
+
safetyMultiplier = rateInfo.safetyMultiplier;
|
|
424
|
+
applyExplorationPolicy(agentScores, rateInfo.epsilon);
|
|
425
|
+
}
|
|
426
|
+
catch {
|
|
427
|
+
// Exploration failures are non-fatal; greedy order stands.
|
|
428
|
+
}
|
|
400
429
|
const recommended = agentScores[0];
|
|
401
430
|
const alternatives = agentScores.slice(1, 4);
|
|
402
431
|
// Generate guidance
|
|
@@ -411,6 +440,11 @@ export class QEReasoningBank {
|
|
|
411
440
|
}
|
|
412
441
|
// Update stats
|
|
413
442
|
this.stats.totalRoutingConfidence += recommended.score;
|
|
443
|
+
// ADR-095 telemetry: average qWeight across the scored agents — a
|
|
444
|
+
// proxy for Q-table maturity. Operators can correlate this with
|
|
445
|
+
// routing_outcomes.quality_score over time to see if learning helps.
|
|
446
|
+
const totalQWeight = agentScores.reduce((acc, a) => acc + (a.qWeight ?? 0), 0);
|
|
447
|
+
const avgQWeight = agentScores.length > 0 ? totalQWeight / agentScores.length : 0;
|
|
414
448
|
const result = {
|
|
415
449
|
recommendedAgent: recommended.agent,
|
|
416
450
|
confidence: recommended.score,
|
|
@@ -419,6 +453,9 @@ export class QEReasoningBank {
|
|
|
419
453
|
patterns,
|
|
420
454
|
guidance,
|
|
421
455
|
reasoning: recommended.reasoning.join('; '),
|
|
456
|
+
exploration: recommended.exploration === true,
|
|
457
|
+
criticality: safetyMultiplier,
|
|
458
|
+
qWeight: avgQWeight,
|
|
422
459
|
};
|
|
423
460
|
return ok(result);
|
|
424
461
|
}
|
|
@@ -426,6 +463,52 @@ export class QEReasoningBank {
|
|
|
426
463
|
return err(toError(error));
|
|
427
464
|
}
|
|
428
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* ADR-095: Build a per-agent Q-value lookup closure for the current
|
|
468
|
+
* routing decision. The closure executes a prepared-statement query
|
|
469
|
+
* against `rl_q_values` for each agent considered.
|
|
470
|
+
*
|
|
471
|
+
* Returns a no-op lookup when the unified memory backend is unavailable
|
|
472
|
+
* (e.g. during early boot or in tests that don't initialize SQLite).
|
|
473
|
+
* The no-op causes `calculateAgentScores` to fall back to pure-static
|
|
474
|
+
* scoring — identical to pre-ADR-095 behavior.
|
|
475
|
+
*/
|
|
476
|
+
buildQValueLookup(stateKey) {
|
|
477
|
+
try {
|
|
478
|
+
const um = getUnifiedMemory();
|
|
479
|
+
if (!um.isInitialized())
|
|
480
|
+
return () => undefined;
|
|
481
|
+
const db = um.getDatabase();
|
|
482
|
+
// Verify the Q-table exists; many CLI commands run without ever
|
|
483
|
+
// initializing the schema and the SELECT below would throw.
|
|
484
|
+
const tableExists = db
|
|
485
|
+
.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='rl_q_values'")
|
|
486
|
+
.get();
|
|
487
|
+
if (!tableExists)
|
|
488
|
+
return () => undefined;
|
|
489
|
+
const stmt = db.prepare(`
|
|
490
|
+
SELECT q_value, visits FROM rl_q_values
|
|
491
|
+
WHERE algorithm = 'q-learning'
|
|
492
|
+
AND agent_id = 'aqe-hook-router'
|
|
493
|
+
AND state_key = ?
|
|
494
|
+
AND action_key = ?
|
|
495
|
+
`);
|
|
496
|
+
return (agentType) => {
|
|
497
|
+
try {
|
|
498
|
+
const row = stmt.get(stateKey, agentType);
|
|
499
|
+
if (!row)
|
|
500
|
+
return undefined;
|
|
501
|
+
return { qValue: row.q_value, visits: row.visits };
|
|
502
|
+
}
|
|
503
|
+
catch {
|
|
504
|
+
return undefined;
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
catch {
|
|
509
|
+
return () => undefined;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
429
512
|
/**
|
|
430
513
|
* Get guidance for a domain
|
|
431
514
|
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routing Topology Safety Gate (ADR-095 — CRITICAL #1 follow-up)
|
|
3
|
+
*
|
|
4
|
+
* Resolves whether the agent dependency graph is in a "critical" topology
|
|
5
|
+
* state for the purpose of dampening exploration in QEReasoningBank.routeTask.
|
|
6
|
+
*
|
|
7
|
+
* Why this lives in its own module:
|
|
8
|
+
*
|
|
9
|
+
* 1. Testability. The reasoning-bank's full init path (real embeddings,
|
|
10
|
+
* HNSW, pretrained patterns) is OOM-heavy in test environments. Putting
|
|
11
|
+
* the topology gate here lets us unit-test it against a fresh
|
|
12
|
+
* SwarmGraph singleton without spinning up the kernel + bank stack.
|
|
13
|
+
*
|
|
14
|
+
* 2. The empty-graph regression. `MinCutCalculator.getMinCutValue` returns
|
|
15
|
+
* 0 on an empty graph; `MinCutHealthMonitor.isCritical()` is defined as
|
|
16
|
+
* `minCutValue < warningThreshold`, so an empty graph reports as
|
|
17
|
+
* critical. CLI hook routing — the only place this gate fires in
|
|
18
|
+
* practice — sees an empty graph because Queen coordinator activity
|
|
19
|
+
* is what populates it. Without the emptiness check, exploration is
|
|
20
|
+
* permanently dampened in the exact deployment case ADR-095 was meant
|
|
21
|
+
* to help.
|
|
22
|
+
*
|
|
23
|
+
* Treat empty/uninitialized graph as "no signal" (full ε rate). Only
|
|
24
|
+
* consult `isCritical()` when the graph has actual vertices.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Returns true ONLY when:
|
|
28
|
+
* 1. The shared monitor + graph are both initialized
|
|
29
|
+
* 2. The graph has at least one vertex (so the mincut value is real,
|
|
30
|
+
* not the degenerate 0 of an empty graph)
|
|
31
|
+
* 3. The monitor's `isCritical()` returns true
|
|
32
|
+
*
|
|
33
|
+
* Any other state returns false (full ε rate / no dampening).
|
|
34
|
+
*
|
|
35
|
+
* All errors are swallowed — the gate is a best-effort signal that must
|
|
36
|
+
* never block routing. Caller defaults safetyMultiplier to 1.0 when this
|
|
37
|
+
* returns false.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveTopologyCriticalFromSharedMincut(): boolean;
|
|
40
|
+
//# sourceMappingURL=routing-topology-gate.d.ts.map
|