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
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { randomUUID } from 'crypto';
|
|
8
8
|
import chalk from 'chalk';
|
|
9
|
+
import { recordPatternUsage } from '../../../learning/pattern-usage-recorder.js';
|
|
9
10
|
// ============================================================================
|
|
10
11
|
// Dream Scheduler State (persisted in kv_store between hook invocations)
|
|
11
12
|
// ============================================================================
|
|
@@ -328,25 +329,6 @@ export async function persistTaskOutcome(opts) {
|
|
|
328
329
|
(id, experience_id, task, success, tokens_saved, feedback, applied_at)
|
|
329
330
|
VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
|
|
330
331
|
`);
|
|
331
|
-
// Mirror SQLitePatternStore.recordUsage() so the hook flow updates
|
|
332
|
-
// qe_patterns.{usage_count, successful_uses, success_rate, quality_score}.
|
|
333
|
-
// recordUsage() is otherwise only reachable via HandleTaskOutcomeRecord
|
|
334
|
-
// — never from this hook path — so 88/89 patterns stayed pinned at the
|
|
335
|
-
// bootstrap quality_score floor (~0.30) and never promoted to long-term.
|
|
336
|
-
// Quality formula: confidence*0.3 + min(usage_count/100,1)*0.2 + success_rate*0.5
|
|
337
|
-
const updatePatternUsage = db.prepare(`
|
|
338
|
-
UPDATE qe_patterns SET
|
|
339
|
-
usage_count = usage_count + 1,
|
|
340
|
-
successful_uses = successful_uses + ?,
|
|
341
|
-
success_rate = CAST(successful_uses + ? AS REAL) / CAST(usage_count + 1 AS REAL),
|
|
342
|
-
quality_score = ? * 0.3
|
|
343
|
-
+ MIN(CAST(usage_count + 1 AS REAL) / 100.0, 1.0) * 0.2
|
|
344
|
-
+ (CAST(successful_uses + ? AS REAL) / CAST(usage_count + 1 AS REAL)) * 0.5,
|
|
345
|
-
last_used_at = datetime('now'),
|
|
346
|
-
updated_at = datetime('now')
|
|
347
|
-
WHERE id = ?
|
|
348
|
-
`);
|
|
349
|
-
const getPatternConfidence = db.prepare(`SELECT confidence FROM qe_patterns WHERE id = ?`);
|
|
350
332
|
// Issue #455: recordOutcome() is called with a synthetic
|
|
351
333
|
// `task:agent:taskId` patternId that never matches qe_patterns.id, so
|
|
352
334
|
// checkPatternPromotionWithCoherence() is skipped for the real UUIDs
|
|
@@ -370,12 +352,22 @@ export async function persistTaskOutcome(opts) {
|
|
|
370
352
|
`);
|
|
371
353
|
for (const patternId of bridge.selectedPatternIds) {
|
|
372
354
|
insertApp.run(`app-${Date.now()}-${randomUUID().slice(0, 8)}`, experienceId, `${taskField}:pattern:${patternId}`, opts.success ? 1 : 0, perPatternTokens, `[Patch 160+300] task-bridge pattern_id=${patternId} ts=${perPatternTokens}`);
|
|
355
|
+
// #486 Gap B: single-writer for pattern usage. Replaces the legacy
|
|
356
|
+
// inline UPDATE that bumped qe_patterns columns but skipped the
|
|
357
|
+
// qe_pattern_usage INSERT, leaving the audit table empty even as
|
|
358
|
+
// usage_count climbed. recordPatternUsage() does both writes in
|
|
359
|
+
// one transaction, matching SQLitePatternStore.recordUsage().
|
|
373
360
|
try {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
361
|
+
recordPatternUsage(db, {
|
|
362
|
+
patternId,
|
|
363
|
+
success: opts.success,
|
|
364
|
+
metrics: {
|
|
365
|
+
tokens_saved: perPatternTokens,
|
|
366
|
+
source: 'cli-hook-post-task',
|
|
367
|
+
experience_id: experienceId,
|
|
368
|
+
},
|
|
369
|
+
feedback: `[Patch 160+300] task-bridge pattern_id=${patternId} ts=${perPatternTokens}`,
|
|
370
|
+
});
|
|
379
371
|
}
|
|
380
372
|
catch { /* fail-soft per pattern */ }
|
|
381
373
|
// Issue #455: re-read post-UPDATE state and promote if thresholds met.
|
|
@@ -87,5 +87,5 @@ export declare function readStdinJsonEvent(timeoutMs?: number): Promise<string>;
|
|
|
87
87
|
* Exported for unit testing.
|
|
88
88
|
*/
|
|
89
89
|
export declare function extractFilePathFromEvent(raw: string): string;
|
|
90
|
-
export { DREAM_STATE_KEY, DREAM_INTERVAL_MS, DREAM_EXPERIENCE_THRESHOLD, DREAM_MIN_GAP_MS, type DreamHookState, type TaskBridgePayload, type TaskOutcomeResult,
|
|
90
|
+
export { DREAM_STATE_KEY, DREAM_INTERVAL_MS, DREAM_EXPERIENCE_THRESHOLD, DREAM_MIN_GAP_MS, type DreamHookState, type TaskBridgePayload, type TaskOutcomeResult, incrementDreamExperience, persistCommandExperience, persistTaskOutcome, updateHookRouterQValue, updateRoutingOutcomeQuality, consolidateExperiencesToPatterns, } from './hooks-dream-learning.js';
|
|
91
91
|
//# sourceMappingURL=hooks-shared.d.ts.map
|
|
@@ -357,5 +357,12 @@ export function extractFilePathFromEvent(raw) {
|
|
|
357
357
|
// ============================================================================
|
|
358
358
|
// Dream Scheduler & Learning — re-exported from hooks-dream-learning.ts
|
|
359
359
|
// ============================================================================
|
|
360
|
-
export { DREAM_STATE_KEY, DREAM_INTERVAL_MS, DREAM_EXPERIENCE_THRESHOLD, DREAM_MIN_GAP_MS,
|
|
360
|
+
export { DREAM_STATE_KEY, DREAM_INTERVAL_MS, DREAM_EXPERIENCE_THRESHOLD, DREAM_MIN_GAP_MS,
|
|
361
|
+
// ADR-094: checkAndTriggerDream is intentionally NOT re-exported here.
|
|
362
|
+
// Hook handlers must not trigger dreams from inside the subprocess; the
|
|
363
|
+
// kernel-side DreamScheduler is the authoritative trigger. The function
|
|
364
|
+
// remains exported from hooks-dream-learning.ts for direct test access
|
|
365
|
+
// and for any future kernel-side caller that wants the encapsulated
|
|
366
|
+
// single-cycle logic.
|
|
367
|
+
incrementDreamExperience, persistCommandExperience, persistTaskOutcome, updateHookRouterQValue, updateRoutingOutcomeQuality, consolidateExperiencesToPatterns, } from './hooks-dream-learning.js';
|
|
361
368
|
//# sourceMappingURL=hooks-shared.js.map
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Handles task routing to optimal QE agent.
|
|
6
6
|
*/
|
|
7
7
|
import { randomUUID } from 'crypto';
|
|
8
|
+
import { ensureRoutingOutcomesAdr095Columns } from '../../../routing/routing-outcomes-migration.js';
|
|
8
9
|
import chalk from 'chalk';
|
|
9
10
|
import path from 'node:path';
|
|
10
11
|
import { findProjectRoot, getUnifiedMemory } from '../../../kernel/unified-memory.js';
|
|
@@ -87,6 +88,10 @@ export function registerRoutingHooks(hooks) {
|
|
|
87
88
|
patternCount: routing.patterns.length,
|
|
88
89
|
guidance: routing.guidance,
|
|
89
90
|
reasoning: routing.reasoning,
|
|
91
|
+
// ADR-095 telemetry passed through to operators / scripts
|
|
92
|
+
exploration: routing.exploration ?? false,
|
|
93
|
+
criticality: routing.criticality ?? null,
|
|
94
|
+
qWeight: routing.qWeight ?? null,
|
|
90
95
|
});
|
|
91
96
|
}
|
|
92
97
|
else {
|
|
@@ -114,6 +119,8 @@ export function registerRoutingHooks(hooks) {
|
|
|
114
119
|
}
|
|
115
120
|
const db = um.getDatabase();
|
|
116
121
|
applyHookBusyTimeout(db);
|
|
122
|
+
// ADR-095: ensure new columns exist before INSERTing them. Idempotent.
|
|
123
|
+
ensureRoutingOutcomesAdr095Columns(db);
|
|
117
124
|
const outcomeId = `route-${Date.now()}-${randomUUID().slice(0, 8)}`;
|
|
118
125
|
// Split-write semantics: quality_score means "outcome quality after
|
|
119
126
|
// task ran" (6-dim formula), NOT routing confidence. Routing-
|
|
@@ -122,22 +129,27 @@ export function registerRoutingHooks(hooks) {
|
|
|
122
129
|
// quality. lowConfidence is surfaced via decision_json + the error
|
|
123
130
|
// column so it's visible in queries that don't parse JSON.
|
|
124
131
|
const lowConfidence = routing.confidence < 0.5;
|
|
132
|
+
const routingTelemetry = routing;
|
|
125
133
|
db.prepare(`
|
|
126
134
|
INSERT OR REPLACE INTO routing_outcomes (
|
|
127
135
|
id, task_json, decision_json, used_agent,
|
|
128
136
|
followed_recommendation, success, quality_score,
|
|
129
|
-
duration_ms, error
|
|
130
|
-
|
|
137
|
+
duration_ms, error,
|
|
138
|
+
exploration, criticality, q_weight
|
|
139
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
131
140
|
`).run(outcomeId, JSON.stringify({ description: task, domain: options.domain }), JSON.stringify({
|
|
132
141
|
recommended: routing.recommendedAgent,
|
|
133
142
|
confidence: routing.confidence,
|
|
134
143
|
alternatives: routing.alternatives,
|
|
135
144
|
lowConfidence,
|
|
145
|
+
exploration: routingTelemetry.exploration ?? false,
|
|
146
|
+
criticality: routingTelemetry.criticality ?? null,
|
|
147
|
+
qWeight: routingTelemetry.qWeight ?? null,
|
|
136
148
|
}), routing.recommendedAgent, 1, // followed_recommendation = true
|
|
137
149
|
0, // success = 0 (sentinel — post-task UPDATEs)
|
|
138
150
|
-1, // quality_score = -1 sentinel
|
|
139
151
|
0, // duration not yet tracked
|
|
140
|
-
lowConfidence ? 'low-confidence' : null);
|
|
152
|
+
lowConfidence ? 'low-confidence' : null, routingTelemetry.exploration ? 1 : 0, routingTelemetry.criticality ?? null, routingTelemetry.qWeight ?? null);
|
|
141
153
|
// Increment dream experience counter
|
|
142
154
|
const projectRoot = findProjectRoot();
|
|
143
155
|
const dataDir = path.join(projectRoot, '.agentic-qe');
|
|
@@ -9,7 +9,9 @@ import chalk from 'chalk';
|
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
import { QE_HOOK_EVENTS } from '../../../learning/qe-hooks.js';
|
|
11
11
|
import { findProjectRoot, getUnifiedMemory } from '../../../kernel/unified-memory.js';
|
|
12
|
-
import { applyHookBusyTimeout, getHooksSystem, createHybridBackendWithTimeout, incrementDreamExperience,
|
|
12
|
+
import { applyHookBusyTimeout, getHooksSystem, createHybridBackendWithTimeout, incrementDreamExperience, persistTaskOutcome, updateHookRouterQValue, updateRoutingOutcomeQuality, printJson, printSuccess, } from './hooks-shared.js';
|
|
13
|
+
import { ensureRoutingOutcomesAdr095Columns } from '../../../routing/routing-outcomes-migration.js';
|
|
14
|
+
import { deriveTaskType } from '../../../learning/agent-routing.js';
|
|
13
15
|
// ============================================================================
|
|
14
16
|
// Constants — task-bridge / routing-quality / q-learning
|
|
15
17
|
// ============================================================================
|
|
@@ -22,30 +24,9 @@ const LOW_CONFIDENCE_THRESHOLD = 0.5;
|
|
|
22
24
|
// ============================================================================
|
|
23
25
|
// Helpers
|
|
24
26
|
// ============================================================================
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*/
|
|
29
|
-
function deriveTaskType(description) {
|
|
30
|
-
const d = description.toLowerCase();
|
|
31
|
-
if (/\bgenerate[- ]?test|\btest[- ]?gen|\bgenerate.+spec/.test(d))
|
|
32
|
-
return 'test-generation';
|
|
33
|
-
if (/\bcoverage|\banalyze.+cover/.test(d))
|
|
34
|
-
return 'coverage-analysis';
|
|
35
|
-
if (/\bquality|\bassess|\baudit/.test(d))
|
|
36
|
-
return 'quality-assessment';
|
|
37
|
-
if (/\bsecurity|\bvulnerab|\bcompliance/.test(d))
|
|
38
|
-
return 'security-compliance';
|
|
39
|
-
if (/\bdefect|\bbug|\bdiagnos/.test(d))
|
|
40
|
-
return 'defect-intelligence';
|
|
41
|
-
if (/\brequirement|\bspec\b/.test(d))
|
|
42
|
-
return 'requirements-validation';
|
|
43
|
-
if (/\brefactor|\brewrite|\boptim/.test(d))
|
|
44
|
-
return 'refactoring';
|
|
45
|
-
if (/\btest|\brun.+test/.test(d))
|
|
46
|
-
return 'test-execution';
|
|
47
|
-
return 'unknown';
|
|
48
|
-
}
|
|
27
|
+
// ADR-095: deriveTaskType moved to learning/agent-routing.ts so the routing
|
|
28
|
+
// path (QEReasoningBank.routeTask) and the post-task Q-update path share
|
|
29
|
+
// the same state_key derivation. Imported above.
|
|
49
30
|
/** Hash a description to a stable short bridge key. */
|
|
50
31
|
function hashDescription(description) {
|
|
51
32
|
return createHash('sha256').update(description).digest('hex').slice(0, 16);
|
|
@@ -142,7 +123,14 @@ export function registerTaskHooks(hooks) {
|
|
|
142
123
|
// Patch 160 + 280-bridge: write the task-bridge entry that post-task
|
|
143
124
|
// will consume to fan out experience_applications per pattern_id and
|
|
144
125
|
// derive a structural q-learning state_key.
|
|
145
|
-
|
|
126
|
+
//
|
|
127
|
+
// The bridge MUST write even when selectedPatternIds is empty: the
|
|
128
|
+
// Q-learning Bellman update at task-hooks.ts post-task site uses a
|
|
129
|
+
// state_key derived from (taskType|priority|domain|complexityBucket)
|
|
130
|
+
// and an action_key from routing.recommendedAgent — neither requires
|
|
131
|
+
// non-empty patterns. Gating on patterns starves rl_q_values for
|
|
132
|
+
// low-confidence prompts. (#487)
|
|
133
|
+
if (options.description) {
|
|
146
134
|
try {
|
|
147
135
|
const description = String(options.description);
|
|
148
136
|
const taskType = deriveTaskType(description);
|
|
@@ -182,23 +170,33 @@ export function registerTaskHooks(hooks) {
|
|
|
182
170
|
// same `hook-${ts}` fallback as post-task.
|
|
183
171
|
if (routing?.recommendedAgent) {
|
|
184
172
|
try {
|
|
173
|
+
// ADR-095: ensure routing_outcomes has the new columns before
|
|
174
|
+
// INSERTing them. Idempotent (process-local flag).
|
|
175
|
+
ensureRoutingOutcomesAdr095Columns(db);
|
|
185
176
|
const effectivePreTaskId = options.taskId || `hook-${Date.now()}`;
|
|
186
177
|
const outcomeId = `route-${Date.now()}-${randomUUID().slice(0, 8)}`;
|
|
187
178
|
const lowConfidence = routing.confidence < LOW_CONFIDENCE_THRESHOLD;
|
|
179
|
+
const routingWithTelemetry = routing;
|
|
188
180
|
db.prepare(`
|
|
189
181
|
INSERT INTO routing_outcomes (
|
|
190
182
|
id, task_json, decision_json, used_agent,
|
|
191
183
|
followed_recommendation, success, quality_score,
|
|
192
|
-
duration_ms, error
|
|
193
|
-
|
|
184
|
+
duration_ms, error,
|
|
185
|
+
exploration, criticality, q_weight
|
|
186
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
194
187
|
`).run(outcomeId, JSON.stringify({ description: options.description, taskId: effectivePreTaskId }), JSON.stringify({
|
|
195
188
|
recommended: routing.recommendedAgent,
|
|
196
189
|
confidence: routing.confidence,
|
|
197
190
|
alternatives: routing.alternatives,
|
|
198
191
|
lowConfidence,
|
|
192
|
+
// Preserve telemetry in decision_json too for callers that
|
|
193
|
+
// read just the JSON blob.
|
|
194
|
+
exploration: routingWithTelemetry.exploration ?? false,
|
|
195
|
+
criticality: routingWithTelemetry.criticality ?? null,
|
|
196
|
+
qWeight: routingWithTelemetry.qWeight ?? null,
|
|
199
197
|
}), routing.recommendedAgent, 1, 0, // success = 0 (sentinel — post-task UPDATEs to actual)
|
|
200
198
|
-1, // quality_score = -1 sentinel
|
|
201
|
-
0, lowConfidence ? 'low-confidence' : null);
|
|
199
|
+
0, lowConfidence ? 'low-confidence' : null, routingWithTelemetry.exploration ? 1 : 0, routingWithTelemetry.criticality ?? null, routingWithTelemetry.qWeight ?? null);
|
|
202
200
|
}
|
|
203
201
|
catch (sentinelErr) {
|
|
204
202
|
console.error(chalk.dim(`[hooks] pre-task sentinel: ${sentinelErr instanceof Error ? sentinelErr.message : 'unknown'}`));
|
|
@@ -268,7 +266,6 @@ export function registerTaskHooks(hooks) {
|
|
|
268
266
|
// Initialize hooks system and record learning outcome
|
|
269
267
|
// BUG FIX: Must call getHooksSystem() FIRST to initialize, not check state.initialized
|
|
270
268
|
let patternsLearned = 0;
|
|
271
|
-
let dreamResult = { triggered: false };
|
|
272
269
|
try {
|
|
273
270
|
// Initialize system (creates ReasoningBank and HookRegistry)
|
|
274
271
|
const { hookRegistry, reasoningBank } = await getHooksSystem();
|
|
@@ -341,30 +338,30 @@ export function registerTaskHooks(hooks) {
|
|
|
341
338
|
});
|
|
342
339
|
}
|
|
343
340
|
}
|
|
344
|
-
//
|
|
341
|
+
// ADR-094: post-task bumps the experience counter but DOES NOT
|
|
342
|
+
// trigger dream cycles inline. Dream cycles run in the long-lived
|
|
343
|
+
// kernel's DreamScheduler so the 10-second SQLite write transaction
|
|
344
|
+
// doesn't block other writers from this short-lived hook subprocess.
|
|
345
345
|
const projectRoot = findProjectRoot();
|
|
346
346
|
const dataDir = path.join(projectRoot, '.agentic-qe');
|
|
347
347
|
const memoryBackend = await createHybridBackendWithTimeout(dataDir);
|
|
348
|
-
|
|
349
|
-
// Check if dream cycle should be triggered
|
|
350
|
-
// Always check — time-based triggers need every invocation, and the
|
|
351
|
-
// check itself is lightweight (just reads state + compares timestamps)
|
|
352
|
-
dreamResult = await checkAndTriggerDream(memoryBackend);
|
|
348
|
+
await incrementDreamExperience(memoryBackend);
|
|
353
349
|
}
|
|
354
350
|
catch (initError) {
|
|
355
351
|
// Log but don't fail - learning is best-effort
|
|
356
352
|
console.error(chalk.dim(`[hooks] Learning init: ${initError instanceof Error ? initError.message : 'unknown'}`));
|
|
357
353
|
}
|
|
358
354
|
if (options.json) {
|
|
355
|
+
// dreamTriggered/dreamReason retained for backwards-compat with
|
|
356
|
+
// operator scripts; the kernel-side scheduler is the authoritative
|
|
357
|
+
// trigger now (ADR-094).
|
|
359
358
|
printJson({
|
|
360
359
|
success: true,
|
|
361
360
|
taskId: options.taskId,
|
|
362
361
|
taskSuccess: success,
|
|
363
362
|
patternsLearned,
|
|
364
|
-
dreamTriggered:
|
|
365
|
-
dreamReason:
|
|
366
|
-
dreamInsights: dreamResult.insightsGenerated,
|
|
367
|
-
dreamInsightsApplied: dreamResult.insightsApplied,
|
|
363
|
+
dreamTriggered: false,
|
|
364
|
+
dreamReason: 'deferred-to-kernel',
|
|
368
365
|
});
|
|
369
366
|
}
|
|
370
367
|
else {
|
|
@@ -373,12 +370,6 @@ export function registerTaskHooks(hooks) {
|
|
|
373
370
|
if (patternsLearned > 0) {
|
|
374
371
|
console.log(chalk.green(` Patterns learned: ${patternsLearned}`));
|
|
375
372
|
}
|
|
376
|
-
if (dreamResult.triggered) {
|
|
377
|
-
const appliedSuffix = typeof dreamResult.insightsApplied === 'number'
|
|
378
|
-
? `, ${dreamResult.insightsApplied} applied`
|
|
379
|
-
: '';
|
|
380
|
-
console.log(chalk.blue(` 🌙 Dream cycle triggered (${dreamResult.reason}): ${dreamResult.insightsGenerated} insights${appliedSuffix}`));
|
|
381
|
-
}
|
|
382
373
|
}
|
|
383
374
|
return;
|
|
384
375
|
}
|
|
@@ -65,6 +65,7 @@ Examples:
|
|
|
65
65
|
registerDreamCommand(learning);
|
|
66
66
|
registerRepairCommand(learning);
|
|
67
67
|
registerHealthCommand(learning);
|
|
68
|
+
registerLoopHealthCommand(learning);
|
|
68
69
|
return learning;
|
|
69
70
|
}
|
|
70
71
|
// ============================================================================
|
|
@@ -1414,6 +1415,199 @@ function registerHealthCommand(learning) {
|
|
|
1414
1415
|
});
|
|
1415
1416
|
}
|
|
1416
1417
|
// ============================================================================
|
|
1418
|
+
// Subcommand: loop-health (#488 B.2)
|
|
1419
|
+
// ============================================================================
|
|
1420
|
+
/**
|
|
1421
|
+
* Component staleness thresholds (ms). Each component has its own expected
|
|
1422
|
+
* cadence — the bridge polls every 5s, the learning worker ticks every 30
|
|
1423
|
+
* min, the dream scheduler is variable. Anything older than ~2x its cadence
|
|
1424
|
+
* counts as stale and operators should investigate.
|
|
1425
|
+
*/
|
|
1426
|
+
const COMPONENT_STALE_THRESHOLDS = {
|
|
1427
|
+
bridge: 30_000, // 5s poll → stale at 30s
|
|
1428
|
+
learningWorker: 2 * 3600_000, // 30 min tick → stale at 2h
|
|
1429
|
+
dreamScheduler: 2 * 3600_000, // similar cadence to worker
|
|
1430
|
+
};
|
|
1431
|
+
function registerLoopHealthCommand(learning) {
|
|
1432
|
+
learning
|
|
1433
|
+
.command('loop-health')
|
|
1434
|
+
.description('Show pipeline component liveness for the self-learning loop')
|
|
1435
|
+
.option('--json', 'Output as JSON')
|
|
1436
|
+
.action(async (options) => {
|
|
1437
|
+
try {
|
|
1438
|
+
const projectRoot = findProjectRoot();
|
|
1439
|
+
const dbPath = path.join(projectRoot, '.agentic-qe', 'memory.db');
|
|
1440
|
+
if (!existsSync(dbPath)) {
|
|
1441
|
+
throw new Error('Database not found. Run "aqe init --auto" first.');
|
|
1442
|
+
}
|
|
1443
|
+
const db = openDatabase(dbPath, { readonly: true });
|
|
1444
|
+
let raw;
|
|
1445
|
+
try {
|
|
1446
|
+
// Try the unified kv_store first (kernel-owned key).
|
|
1447
|
+
const row = db
|
|
1448
|
+
.prepare(`SELECT value FROM kv_store WHERE key = 'learning:loop-health' LIMIT 1`)
|
|
1449
|
+
.get();
|
|
1450
|
+
raw = row?.value;
|
|
1451
|
+
}
|
|
1452
|
+
catch {
|
|
1453
|
+
// kv_store may not exist yet on a freshly-init'd shop.
|
|
1454
|
+
}
|
|
1455
|
+
// ADR-095: routing diversification stats (7-day rolling window)
|
|
1456
|
+
let routingStats = null;
|
|
1457
|
+
try {
|
|
1458
|
+
const colCheck = db
|
|
1459
|
+
.prepare("PRAGMA table_info(routing_outcomes)")
|
|
1460
|
+
.all();
|
|
1461
|
+
const hasExploration = colCheck.some((c) => c.name === 'exploration');
|
|
1462
|
+
if (hasExploration) {
|
|
1463
|
+
const totals = db
|
|
1464
|
+
.prepare(`SELECT
|
|
1465
|
+
COUNT(*) AS total,
|
|
1466
|
+
SUM(CASE WHEN exploration = 1 THEN 1 ELSE 0 END) AS explore,
|
|
1467
|
+
AVG(criticality) AS avgCrit,
|
|
1468
|
+
AVG(q_weight) AS avgQ
|
|
1469
|
+
FROM routing_outcomes
|
|
1470
|
+
WHERE created_at >= datetime('now', '-7 days')`)
|
|
1471
|
+
.get();
|
|
1472
|
+
const total = totals.total ?? 0;
|
|
1473
|
+
const explore = totals.explore ?? 0;
|
|
1474
|
+
const exploit = total - explore;
|
|
1475
|
+
const exploitQ = db
|
|
1476
|
+
.prepare(`SELECT AVG(quality_score) AS avgQ FROM routing_outcomes
|
|
1477
|
+
WHERE exploration = 0 AND quality_score >= 0
|
|
1478
|
+
AND created_at >= datetime('now', '-7 days')`)
|
|
1479
|
+
.get();
|
|
1480
|
+
const exploreQ = db
|
|
1481
|
+
.prepare(`SELECT AVG(quality_score) AS avgQ FROM routing_outcomes
|
|
1482
|
+
WHERE exploration = 1 AND quality_score >= 0
|
|
1483
|
+
AND created_at >= datetime('now', '-7 days')`)
|
|
1484
|
+
.get();
|
|
1485
|
+
routingStats = {
|
|
1486
|
+
totalDecisions: total,
|
|
1487
|
+
explorationCount: explore,
|
|
1488
|
+
exploitCount: exploit,
|
|
1489
|
+
explorationRate: total > 0 ? explore / total : 0,
|
|
1490
|
+
avgQualityExploit: exploitQ.avgQ,
|
|
1491
|
+
avgQualityExplore: exploreQ.avgQ,
|
|
1492
|
+
avgCriticality: totals.avgCrit,
|
|
1493
|
+
avgQWeight: totals.avgQ,
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
catch {
|
|
1498
|
+
// routing_outcomes missing or pre-ADR-095 schema — skip silently.
|
|
1499
|
+
}
|
|
1500
|
+
db.close();
|
|
1501
|
+
let health = null;
|
|
1502
|
+
if (raw) {
|
|
1503
|
+
try {
|
|
1504
|
+
health = safeJsonParse(raw);
|
|
1505
|
+
}
|
|
1506
|
+
catch {
|
|
1507
|
+
health = null;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
const now = Date.now();
|
|
1511
|
+
const verdict = (componentKey, c) => {
|
|
1512
|
+
const threshold = COMPONENT_STALE_THRESHOLDS[componentKey] ?? 600_000;
|
|
1513
|
+
if (!c || !c.lastSuccessAt)
|
|
1514
|
+
return 'never-ran';
|
|
1515
|
+
const age = now - new Date(c.lastSuccessAt).getTime();
|
|
1516
|
+
return age > threshold ? 'stale' : 'live';
|
|
1517
|
+
};
|
|
1518
|
+
if (options.json) {
|
|
1519
|
+
if (!health) {
|
|
1520
|
+
printJson({
|
|
1521
|
+
overallLastSuccess: null,
|
|
1522
|
+
bootedAt: null,
|
|
1523
|
+
components: {},
|
|
1524
|
+
verdicts: {},
|
|
1525
|
+
routingDiversification: routingStats,
|
|
1526
|
+
note: 'No loop-health record yet. Workers must run at least once for this to populate.',
|
|
1527
|
+
});
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
const verdicts = {};
|
|
1531
|
+
for (const key of Object.keys(health.components)) {
|
|
1532
|
+
verdicts[key] = verdict(key, health.components[key]);
|
|
1533
|
+
}
|
|
1534
|
+
printJson({ ...health, verdicts, routingDiversification: routingStats });
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
console.log('');
|
|
1538
|
+
console.log(chalk.bold('Self-Learning Loop Health'));
|
|
1539
|
+
console.log('');
|
|
1540
|
+
if (!health) {
|
|
1541
|
+
console.log(chalk.dim(' No loop-health record yet.'));
|
|
1542
|
+
console.log(chalk.dim(' Workers must run at least once to populate.'));
|
|
1543
|
+
console.log(chalk.dim(' Start the daemon: aqe daemon start'));
|
|
1544
|
+
// FALL THROUGH (no early return): routing-diversification stats may
|
|
1545
|
+
// still be available even when loop-health components haven't ticked
|
|
1546
|
+
// yet (e.g., routing happened via hook handlers but daemon-side
|
|
1547
|
+
// workers never ran). Operators need both signals visible.
|
|
1548
|
+
}
|
|
1549
|
+
else {
|
|
1550
|
+
console.log(` Booted at: ${chalk.dim(health.bootedAt)}`);
|
|
1551
|
+
console.log(` Last success (any): ${health.overallLastSuccess || chalk.dim('(none yet)')}`);
|
|
1552
|
+
console.log('');
|
|
1553
|
+
console.log(chalk.bold(' Components:'));
|
|
1554
|
+
const known = [
|
|
1555
|
+
['bridge', 'CapturedExperienceBridge'],
|
|
1556
|
+
['learningWorker', 'LearningConsolidationWorker'],
|
|
1557
|
+
['dreamScheduler', 'DreamScheduler'],
|
|
1558
|
+
];
|
|
1559
|
+
for (const [key, label] of known) {
|
|
1560
|
+
const c = health.components[key];
|
|
1561
|
+
const v = verdict(key, c);
|
|
1562
|
+
const colored = v === 'live'
|
|
1563
|
+
? chalk.green('● live')
|
|
1564
|
+
: v === 'stale'
|
|
1565
|
+
? chalk.yellow('● stale')
|
|
1566
|
+
: chalk.dim('○ never-ran');
|
|
1567
|
+
const lastSuccess = c?.lastSuccessAt || chalk.dim('(never)');
|
|
1568
|
+
const ticks = c
|
|
1569
|
+
? `${c.successesSinceBoot}/${c.ticksSinceBoot} ticks ok`
|
|
1570
|
+
: chalk.dim('no ticks');
|
|
1571
|
+
console.log(` ${label.padEnd(32)} ${colored.padEnd(20)} ${ticks}`);
|
|
1572
|
+
console.log(` ${chalk.dim('last success:')} ${lastSuccess}`);
|
|
1573
|
+
if (c?.lastError) {
|
|
1574
|
+
console.log(` ${chalk.red('last error:')} ${c.lastError.message} ${chalk.dim('(at ' + c.lastError.at + ')')}`);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
const stale = known.filter(([k, _]) => verdict(k, health.components[k]) === 'stale');
|
|
1578
|
+
if (stale.length > 0) {
|
|
1579
|
+
console.log('');
|
|
1580
|
+
console.log(chalk.yellow(` Warning: ${stale.length} component(s) stale — daemon may not be running or the loop is wedged.`));
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
// ADR-095: routing diversification dashboard
|
|
1584
|
+
if (routingStats && routingStats.totalDecisions > 0) {
|
|
1585
|
+
console.log('');
|
|
1586
|
+
console.log(chalk.bold(' Routing diversification (last 7 days):'));
|
|
1587
|
+
const ratePct = (routingStats.explorationRate * 100).toFixed(1);
|
|
1588
|
+
console.log(` Decisions: ${routingStats.totalDecisions} (${routingStats.exploitCount} exploit, ${routingStats.explorationCount} explore = ${ratePct}%)`);
|
|
1589
|
+
if (routingStats.avgQualityExploit !== null && routingStats.avgQualityExplore !== null) {
|
|
1590
|
+
const delta = routingStats.avgQualityExplore - routingStats.avgQualityExploit;
|
|
1591
|
+
const deltaStr = delta >= 0 ? chalk.green(`+${delta.toFixed(3)}`) : chalk.red(delta.toFixed(3));
|
|
1592
|
+
console.log(` Avg quality: exploit=${routingStats.avgQualityExploit.toFixed(3)}, explore=${routingStats.avgQualityExplore.toFixed(3)} (Δ ${deltaStr})`);
|
|
1593
|
+
}
|
|
1594
|
+
if (routingStats.avgCriticality !== null) {
|
|
1595
|
+
console.log(` Avg mincut multiplier: ${routingStats.avgCriticality.toFixed(2)} (1.0=full rate, 0.2=critical-topology dampening)`);
|
|
1596
|
+
}
|
|
1597
|
+
if (routingStats.avgQWeight !== null && routingStats.avgQWeight > 0) {
|
|
1598
|
+
console.log(` Avg Q-weight: ${routingStats.avgQWeight.toFixed(3)} (0=cold start, ${0.4} max)`);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
console.log('');
|
|
1602
|
+
return;
|
|
1603
|
+
}
|
|
1604
|
+
catch (error) {
|
|
1605
|
+
printError(`loop-health failed: ${error instanceof Error ? error.message : 'unknown'}`);
|
|
1606
|
+
throw error;
|
|
1607
|
+
}
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
// ============================================================================
|
|
1417
1611
|
// Exports
|
|
1418
1612
|
// ============================================================================
|
|
1419
1613
|
export { initializeLearningSystem } from './learning-helpers.js';
|
|
@@ -16,8 +16,11 @@ import ora from 'ora';
|
|
|
16
16
|
import { createSyncAgent, syncToCloud, syncIncrementalToCloud, DEFAULT_SYNC_CONFIG, pullFromCloud, pullIncrementalFromCloud, } from '../../sync/index.js';
|
|
17
17
|
import * as fs from 'fs';
|
|
18
18
|
import * as path from 'path';
|
|
19
|
+
import { fileURLToPath } from 'url';
|
|
19
20
|
import { toErrorMessage } from '../../shared/error-utils.js';
|
|
20
21
|
import { findPackageRoot } from '../../init/find-package-root.js';
|
|
22
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
const __dirname = path.dirname(__filename);
|
|
21
24
|
/**
|
|
22
25
|
* Create sync commands
|
|
23
26
|
*/
|
package/dist/domains/requirements-validation/services/quality-criteria/quality-criteria-service.js
CHANGED
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* Part of the QCSD (Quality Conscious Software Delivery) framework.
|
|
6
6
|
*/
|
|
7
7
|
import { existsSync, readFileSync } from 'fs';
|
|
8
|
-
import { join } from 'path';
|
|
8
|
+
import { join, dirname } from 'path';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
9
10
|
import { HTSM_CATEGORIES, NEVER_OMIT_CATEGORIES } from './types.js';
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = dirname(__filename);
|
|
10
13
|
// ============================================================================
|
|
11
14
|
// Quality Criteria Service
|
|
12
15
|
// ============================================================================
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
* - Adds full env vars and v3 settings sections
|
|
9
9
|
*/
|
|
10
10
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
11
|
-
import { join } from 'path';
|
|
11
|
+
import { join, dirname } from 'path';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
12
13
|
import { safeJsonParse } from '../../shared/safe-json.js';
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = dirname(__filename);
|
|
13
16
|
import { isAqeHookEntry, mergeHooksSmart, generateAqeEnvVars, generateV3SettingsSections, } from '../settings-merge.js';
|
|
14
17
|
import { BasePhase, } from './phase-interface.js';
|
|
15
18
|
/**
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
* Configures background workers for continuous monitoring
|
|
4
4
|
*/
|
|
5
5
|
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
6
|
-
import { join } from 'path';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
7
8
|
import { BasePhase, } from './phase-interface.js';
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
8
11
|
/**
|
|
9
12
|
* Workers phase - configures background workers
|
|
10
13
|
*/
|
|
@@ -118,12 +121,30 @@ if (existsSync(pidFile)) {
|
|
|
118
121
|
const ts = new Date().toISOString();
|
|
119
122
|
appendFileSync(logFile, '[' + ts + '] Starting AQE v3 Worker Daemon...\\n');
|
|
120
123
|
|
|
121
|
-
// Find the best way to run aqe-mcp
|
|
124
|
+
// Find the best way to run aqe-mcp.
|
|
125
|
+
//
|
|
126
|
+
// #488 B.1: candidate ordering matters for the pidfile contract. When we
|
|
127
|
+
// spawn the real MCP binary directly, child.pid is the long-lived process
|
|
128
|
+
// — \`process.kill(pid, 0)\` against the pidfile correctly reports liveness.
|
|
129
|
+
// When we fall back to \`npx --yes agentic-qe mcp\`, child.pid is the npx
|
|
130
|
+
// wrapper PID, which exits as soon as it has forked the real bundle. The
|
|
131
|
+
// pidfile then points at a dead process and idempotency checks misbehave.
|
|
132
|
+
//
|
|
133
|
+
// We try in order: local .bin → local node_modules bundle → global install
|
|
134
|
+
// via require.resolve → npx wrapper (last resort, with the caveat above).
|
|
122
135
|
const candidates = [
|
|
123
136
|
join(projectRoot, 'node_modules', '.bin', 'aqe-mcp'),
|
|
124
137
|
join(projectRoot, 'node_modules', 'agentic-qe', 'dist', 'mcp', 'bundle.js'),
|
|
125
138
|
];
|
|
126
139
|
|
|
140
|
+
// Probe globally-installed agentic-qe (npm install -g) via require.resolve.
|
|
141
|
+
// This is the case the npx fallback used to silently cover with a bad PID.
|
|
142
|
+
try {
|
|
143
|
+
candidates.push(require.resolve('agentic-qe/dist/mcp/bundle.js'));
|
|
144
|
+
} catch {
|
|
145
|
+
// Not globally installed — fall through to npx fallback below.
|
|
146
|
+
}
|
|
147
|
+
|
|
127
148
|
let mcpCmd, mcpArgs;
|
|
128
149
|
const binCandidate = candidates.find(c => existsSync(c));
|
|
129
150
|
|
|
@@ -136,6 +157,7 @@ if (binCandidate && binCandidate.endsWith('bundle.js')) {
|
|
|
136
157
|
} else {
|
|
137
158
|
mcpCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
138
159
|
mcpArgs = ['--yes', 'agentic-qe', 'mcp'];
|
|
160
|
+
appendFileSync(logFile, '[' + ts + '] WARNING: using npx fallback — daemon.pid will point at the npx wrapper, not the MCP server. \`aqe daemon status\` may misreport liveness after the wrapper exits.\\n');
|
|
139
161
|
}
|
|
140
162
|
|
|
141
163
|
appendFileSync(logFile, '[' + ts + '] Using: ' + mcpCmd + ' ' + mcpArgs.join(' ') + '\\n');
|