agentic-qe 3.10.0 → 3.10.2
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/hooks/README.txt +17 -0
- package/.claude/hooks/aqe-hook.cjs +98 -0
- package/.claude/hooks/cross-phase-memory.yaml +296 -0
- package/.claude/hooks/post-task-sync.sh +113 -0
- package/.claude/hooks/v3-domain-workers.json +121 -0
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +148 -0
- package/README.md +35 -8
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-CR6J5C76.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-5UDM2PWG.js → agent-booster-wasm-DHSIPFTH.js} +2 -2
- package/dist/cli/chunks/{agent-handler-JSYER5YC.js → agent-handler-FPQVHGGT.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-T2SAHI4F.js → agent-memory-branch-OLOF5ZHV.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-2MNTHMB6.js +2 -0
- package/dist/cli/chunks/{audit-HIBRVGXG.js → audit-ALRYPHGP.js} +2 -2
- package/dist/cli/chunks/base-AOQNGMTL.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-TA4DZV62.js → better-sqlite3-5BT5FO64.js} +2 -2
- package/dist/cli/chunks/{brain-handler-N6AWIMXG.js → brain-handler-ROZUHCOT.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-VYQGBVEJ.js → branch-enumerator-VK7G4NKJ.js} +2 -2
- package/dist/cli/chunks/{browser-2X4WKZPT.js → browser-Q2S75M2F.js} +2 -2
- package/dist/cli/chunks/browser-workflow-UJ4A2ZXO.js +2 -0
- package/dist/cli/chunks/{chunk-BQX5QDU5.js → chunk-2244IFZA.js} +1 -1
- package/dist/cli/chunks/{chunk-S33246T4.js → chunk-22D6VBPD.js} +1 -1
- package/dist/cli/chunks/{chunk-UGX4EHT5.js → chunk-24LUQICS.js} +2 -2
- package/dist/cli/chunks/{chunk-6HCHW5TS.js → chunk-2EDWGHDA.js} +2 -2
- package/dist/cli/chunks/{chunk-4WYGUTSF.js → chunk-2JDLQWSV.js} +2 -2
- package/dist/cli/chunks/{chunk-3QULDB7K.js → chunk-2OH3ALYB.js} +1 -1
- package/dist/cli/chunks/chunk-3RHHKYUR.js +2 -0
- package/dist/cli/chunks/{chunk-Z6JLPPAY.js → chunk-3Z4FHA2E.js} +1 -1
- package/dist/cli/chunks/{chunk-ZYZWBNKT.js → chunk-4BXGVM2C.js} +1 -1
- package/dist/cli/chunks/{chunk-6F3WJOU2.js → chunk-4F3ZTXHP.js} +2 -2
- package/dist/cli/chunks/{chunk-CU4IUJ2K.js → chunk-4GTDW2XL.js} +2 -2
- package/dist/cli/chunks/{chunk-4UUDFWOP.js → chunk-5HB54RUS.js} +2 -2
- package/dist/cli/chunks/{chunk-YHNEBCYQ.js → chunk-5PL7WTCU.js} +2 -2
- package/dist/cli/chunks/{chunk-MF3XRML3.js → chunk-5PRFFHFV.js} +2 -2
- package/dist/cli/chunks/{chunk-TEJPHJMW.js → chunk-5QHSLWLP.js} +2 -2
- package/dist/cli/chunks/{chunk-ZFBMBCKN.js → chunk-5WJ3FWL4.js} +2 -2
- package/dist/cli/chunks/{chunk-V5TRAL57.js → chunk-6KSCXPPL.js} +2 -2
- package/dist/cli/chunks/{chunk-P6XYFDXN.js → chunk-6NZHEM4V.js} +1 -1
- package/dist/cli/chunks/{chunk-HD6CZBZV.js → chunk-6ZFHIKQG.js} +2 -2
- package/dist/cli/chunks/{chunk-VEOQH4W6.js → chunk-7DKYCVJI.js} +2 -2
- package/dist/cli/chunks/{chunk-Y4I5JBOL.js → chunk-7IVQ6OVR.js} +2 -2
- package/dist/cli/chunks/chunk-7IZ2OPC2.js +2 -0
- package/dist/cli/chunks/{chunk-AFFYJSW2.js → chunk-7QRMARM7.js} +2 -2
- package/dist/cli/chunks/{chunk-L2AIES7X.js → chunk-7SJX4CFK.js} +1 -1
- package/dist/cli/chunks/{chunk-UCIJCRPB.js → chunk-7SWD3D6Y.js} +2 -2
- package/dist/cli/chunks/{chunk-FCSJ7GIZ.js → chunk-7V5UHLNY.js} +4 -4
- package/dist/cli/chunks/{chunk-5QJDH4Z5.js → chunk-7Z46RDDV.js} +2 -2
- package/dist/cli/chunks/{chunk-5RQT7EJP.js → chunk-A5RMQG4N.js} +3 -3
- package/dist/cli/chunks/{chunk-3BO7EKGO.js → chunk-AH7FXNFE.js} +3 -3
- package/dist/cli/chunks/chunk-AIUSZC6K.js +3 -0
- package/dist/cli/chunks/{chunk-MJBXQXSX.js → chunk-AOI67HA3.js} +1 -1
- package/dist/cli/chunks/{chunk-6H5MRVJS.js → chunk-AV7KYE5P.js} +7 -7
- package/dist/cli/chunks/{chunk-OGT45MZN.js → chunk-AWFIEGR3.js} +2 -2
- package/dist/cli/chunks/{chunk-J5RJYFRM.js → chunk-BQCSCAUC.js} +2 -2
- package/dist/cli/chunks/{chunk-OUJJ34JH.js → chunk-C2M74HCN.js} +1 -1
- package/dist/cli/chunks/{chunk-G2HA2O3R.js → chunk-CIRPP7RQ.js} +2 -2
- package/dist/cli/chunks/{chunk-LXHA55EB.js → chunk-CMACGG4Z.js} +1 -1
- package/dist/cli/chunks/{chunk-LRISVDVO.js → chunk-CTDLI2ON.js} +1 -1
- package/dist/cli/chunks/{chunk-DXV6NRG3.js → chunk-CV2SBMBW.js} +2 -2
- package/dist/cli/chunks/{chunk-WLLE54TA.js → chunk-DMQPO43S.js} +1 -1
- package/dist/cli/chunks/{chunk-I4E6CLC4.js → chunk-DRWGK3YO.js} +2 -2
- package/dist/cli/chunks/{chunk-Z2SCTEZD.js → chunk-DZZEHPSJ.js} +2 -2
- package/dist/cli/chunks/{chunk-DY7IRNE2.js → chunk-EA7ZSN3V.js} +1 -1
- package/dist/cli/chunks/{chunk-M4HDBRVJ.js → chunk-EQBEGDTG.js} +1 -1
- package/dist/cli/chunks/{chunk-HZPXOAFW.js → chunk-ETN5563K.js} +2 -2
- package/dist/cli/chunks/{chunk-OWMGD7FO.js → chunk-EVCOCGVJ.js} +3 -3
- package/dist/cli/chunks/{chunk-27ACATRH.js → chunk-FO43SQXP.js} +2 -2
- package/dist/cli/chunks/{chunk-DQJJS4AX.js → chunk-FO73PZVU.js} +2 -2
- package/dist/cli/chunks/{chunk-FEBXP74Y.js → chunk-FPAW77XV.js} +1 -1
- package/dist/cli/chunks/{chunk-KYLJERZ3.js → chunk-FY3CUPNN.js} +20 -17
- package/dist/cli/chunks/{chunk-LQ3TA22E.js → chunk-G5U6Q42D.js} +2 -2
- package/dist/cli/chunks/{chunk-JCKX2LEJ.js → chunk-HA63NBFK.js} +49 -49
- package/dist/cli/chunks/{chunk-NT4PI5HI.js → chunk-HHCYSAH3.js} +2 -2
- package/dist/cli/chunks/{chunk-GPKZ4MMH.js → chunk-HJME6G5M.js} +1 -1
- package/dist/cli/chunks/{chunk-TR7BZLB6.js → chunk-HJORBNXW.js} +1 -1
- package/dist/cli/chunks/{chunk-BXCS55GB.js → chunk-HO37VP4O.js} +1 -1
- package/dist/cli/chunks/{chunk-FX4SYT6Y.js → chunk-I677W5BT.js} +3 -3
- package/dist/cli/chunks/chunk-IAZEDWRX.js +2 -0
- package/dist/cli/chunks/{chunk-5UOV7T36.js → chunk-IICTTDAA.js} +2 -2
- package/dist/cli/chunks/{chunk-BQT4J3BD.js → chunk-JF53LRBL.js} +2 -2
- package/dist/cli/chunks/{chunk-S4CNA6Z5.js → chunk-KB5L5TTF.js} +3 -3
- package/dist/cli/chunks/{chunk-UE3XXKLN.js → chunk-L7VIX22Y.js} +2 -2
- package/dist/cli/chunks/{chunk-C5QESAYA.js → chunk-LQTWPSYL.js} +1 -1
- package/dist/cli/chunks/{chunk-2GL4GH52.js → chunk-LZCBSFAU.js} +4 -4
- package/dist/cli/chunks/{chunk-LDMG4372.js → chunk-MCOFJHSJ.js} +2 -2
- package/dist/cli/chunks/{chunk-ZCNVFULO.js → chunk-MCZHKXB4.js} +2 -2
- package/dist/cli/chunks/{chunk-VTIXFHZR.js → chunk-MEY43PIQ.js} +2 -2
- package/dist/cli/chunks/{chunk-PNDO4W4L.js → chunk-MMIQ5DMA.js} +2 -2
- package/dist/cli/chunks/{chunk-NWHSEXHA.js → chunk-MNUTRAUV.js} +1 -1
- package/dist/cli/chunks/{chunk-XFUU2RCA.js → chunk-MNV3E5KY.js} +2 -2
- package/dist/cli/chunks/{chunk-WVCIZIKH.js → chunk-MYWQTCS4.js} +1 -1
- package/dist/cli/chunks/{chunk-T7DLX3LS.js → chunk-NZO4WUSO.js} +3 -3
- package/dist/cli/chunks/{chunk-RF6QKV7M.js → chunk-OIEQF7PG.js} +2 -2
- package/dist/cli/chunks/{chunk-NLCUQMUR.js → chunk-OIRZJCZY.js} +2 -2
- package/dist/cli/chunks/{chunk-KOSKGZK4.js → chunk-ON4D4TJ4.js} +2 -2
- package/dist/cli/chunks/chunk-OPFN5LFT.js +95 -0
- package/dist/cli/chunks/{chunk-55JPAF56.js → chunk-ORF2UKQH.js} +1 -1
- package/dist/cli/chunks/{chunk-M73IL7FA.js → chunk-OWQ6HEYI.js} +2 -2
- package/dist/cli/chunks/{chunk-O3NAUNFC.js → chunk-OXCEUR5F.js} +2 -2
- package/dist/cli/chunks/{chunk-BTIVIWIG.js → chunk-PEK6NGVJ.js} +1 -1
- package/dist/cli/chunks/{chunk-ALCQRJDY.js → chunk-PIZYRPMT.js} +2 -2
- package/dist/cli/chunks/{chunk-L3IFZ4IX.js → chunk-PXTDEO65.js} +2 -2
- package/dist/cli/chunks/{chunk-3U77XX6J.js → chunk-PYIHZXCI.js} +12 -12
- package/dist/cli/chunks/{chunk-FQ5FT7IE.js → chunk-QBRHKTFT.js} +1 -1
- package/dist/cli/chunks/{chunk-I4T4JPR2.js → chunk-QEPFXY6G.js} +1 -1
- package/dist/cli/chunks/{chunk-X4U5NYB6.js → chunk-QJ2EHLJ2.js} +1 -1
- package/dist/cli/chunks/{chunk-JKVNZASH.js → chunk-QQNCSEZG.js} +2 -2
- package/dist/cli/chunks/{chunk-URVDWF2Y.js → chunk-QSE67XJO.js} +2 -2
- package/dist/cli/chunks/{chunk-RARSTEUO.js → chunk-R2O6OKT2.js} +1 -1
- package/dist/cli/chunks/{chunk-RGONSQ44.js → chunk-RLXTBL3H.js} +210 -210
- package/dist/cli/chunks/{chunk-RH3PHCJT.js → chunk-RNREAOY4.js} +2 -2
- package/dist/cli/chunks/{chunk-2POXDKUB.js → chunk-S3OZ7XSY.js} +1 -1
- package/dist/cli/chunks/{provider-manager-HV55NIIO.js → chunk-S3ZO7JXS.js} +13 -13
- package/dist/cli/chunks/{chunk-QWBO76AU.js → chunk-SJH3HYNC.js} +2 -2
- package/dist/cli/chunks/{chunk-WC6KZDPM.js → chunk-STEGWLH5.js} +2 -2
- package/dist/cli/chunks/{chunk-KCHFF4IE.js → chunk-SVYTN2GT.js} +2 -2
- package/dist/cli/chunks/{chunk-OKGK7DBT.js → chunk-SW4OKUTC.js} +2 -2
- package/dist/cli/chunks/{chunk-3OSCWD7Z.js → chunk-THRTUW4Z.js} +1 -1
- package/dist/cli/chunks/{chunk-U56TIYGP.js → chunk-TJKDATEU.js} +2 -2
- package/dist/cli/chunks/{chunk-4NQ6KANC.js → chunk-U3EUH6LX.js} +2 -2
- package/dist/cli/chunks/{chunk-7Y54QZKF.js → chunk-UUFOHMUG.js} +2 -2
- package/dist/cli/chunks/{chunk-W6U7SIIK.js → chunk-UVU7XLJY.js} +3 -3
- package/dist/cli/chunks/chunk-UWXH2UQK.js +2 -0
- package/dist/cli/chunks/{chunk-YYDHTBHE.js → chunk-UYYBPWU3.js} +1 -1
- package/dist/cli/chunks/{chunk-LYVFC7C7.js → chunk-VSUTI4G6.js} +2 -2
- package/dist/cli/chunks/{chunk-SGONA5GS.js → chunk-WDMPJ2M2.js} +2 -2
- package/dist/cli/chunks/{chunk-66GIKUI2.js → chunk-WNR2KAUH.js} +2 -2
- package/dist/cli/chunks/{chunk-M3M7HXDH.js → chunk-WSVUSIAZ.js} +2 -2
- package/dist/cli/chunks/{chunk-SCYF5CQA.js → chunk-WZJUMJ2S.js} +1 -1
- package/dist/cli/chunks/{chunk-WG6I7YF3.js → chunk-X2VAOIUY.js} +1 -1
- package/dist/cli/chunks/{chunk-7ZIRDBXH.js → chunk-XDSA7YUQ.js} +1 -1
- package/dist/cli/chunks/{chunk-HIWBW4IQ.js → chunk-XDU624HU.js} +1 -1
- package/dist/cli/chunks/{chunk-JUICZG3T.js → chunk-XGBAHAGC.js} +2 -2
- package/dist/cli/chunks/{chunk-DQLEZBWV.js → chunk-XMJTTF5N.js} +2 -2
- package/dist/cli/chunks/{chunk-KNL3QWVA.js → chunk-XPCNUX2U.js} +2 -2
- package/dist/cli/chunks/{chunk-VTO5O7DA.js → chunk-XRJECWZE.js} +1 -1
- package/dist/cli/chunks/{chunk-HD5NQDOL.js → chunk-XTCUN36Z.js} +2 -2
- package/dist/cli/chunks/{chunk-KDFW7MVM.js → chunk-Y63MBMOV.js} +2 -2
- package/dist/cli/chunks/{chunk-L4N6PTIC.js → chunk-YACT5WFC.js} +2 -2
- package/dist/cli/chunks/{chunk-QU54GUEA.js → chunk-YI6GNRQM.js} +2 -2
- package/dist/cli/chunks/chunk-YNNOY3XN.js +62 -0
- package/dist/cli/chunks/{chunk-GXCD7GNH.js → chunk-YWZHMXTO.js} +2 -2
- package/dist/cli/chunks/{chunk-XFMSHTXG.js → chunk-ZDHMZPSL.js} +1 -1
- package/dist/cli/chunks/{chunk-F363JJUI.js → chunk-ZGNZJJFF.js} +1 -1
- package/dist/cli/chunks/{chunk-UCXQQCIP.js → chunk-ZK2BH23O.js} +2 -2
- package/dist/cli/chunks/{chunk-IQNR662U.js → chunk-ZQUXNG5X.js} +2 -2
- package/dist/cli/chunks/{chunk-IBXNBLGM.js → chunk-ZXTO4C7R.js} +2 -2
- package/dist/cli/chunks/{ci-7TR4NQ5I.js → ci-PYCRCL7G.js} +2 -2
- package/dist/cli/chunks/{ci-output-SLTICF3O.js → ci-output-EKQQFE2D.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-7GVVTMBY.js → circuit-breaker-RH3Q2MJO.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-TYCWYEMM.js → claude-flow-setup-DUDXB4VV.js} +2 -2
- package/dist/cli/chunks/client-RDPWGOSA.js +2 -0
- package/dist/cli/chunks/{cline-installer-ESIAJOLK.js → cline-installer-3Q4WIWUG.js} +2 -2
- package/dist/cli/chunks/{code-I42JGOVI.js → code-E4Q6DGOO.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-2CCXPCQW.js → code-index-extractor-2PCISUOW.js} +2 -2
- package/dist/cli/chunks/{codex-installer-HEZRDNUT.js → codex-installer-YNNNOLJ6.js} +2 -2
- package/dist/cli/chunks/{completions-44HLIZGI.js → completions-2F7TUFBD.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-SOCSFDVO.js → complexity-analyzer-2B6MHO7W.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-Q7O4HLIM.js → continuedev-installer-ENOKRU5M.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-GIWCVLCS.js → copilot-installer-6YD2KM5F.js} +2 -2
- package/dist/cli/chunks/{cost-tracker-G7BONKEV.js → cost-tracker-FCH4QOEA.js} +2 -2
- package/dist/cli/chunks/{coverage-5TWVP7KY.js → coverage-JTOXZE3T.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-4K5ZVZEZ.js +2 -0
- package/dist/cli/chunks/{cursor-installer-43EQZSB5.js → cursor-installer-QZFBUGLQ.js} +2 -2
- package/dist/cli/chunks/{daemon-ZXHFRDKG.js → daemon-K4QFB5FQ.js} +3 -3
- package/dist/cli/chunks/{daemon-QQZE4BU2.js → daemon-M422U3ZA.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-GOZAVAZQ.js → dag-attention-scheduler-BXAAW33V.js} +2 -2
- package/dist/cli/chunks/{detect-X777GVJ4.js → detect-UGSWIOAD.js} +2 -2
- package/dist/cli/chunks/{dist-node-EZZK46TB.js → dist-node-FN3HX3OK.js} +2 -2
- package/dist/cli/chunks/{domain-handler-ZT32DKYY.js → domain-handler-7PP7VYA7.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-LHQVSLJW.js → domain-transfer-XZM44W7I.js} +2 -2
- package/dist/cli/chunks/dream-RPNWM7VS.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-XFYPPWG7.js → embed-and-insert-pattern-JZVERJ5L.js} +2 -2
- package/dist/cli/chunks/{eval-V4NYJZUZ.js → eval-466NFF2D.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-HXX2W4GL.js → experience-capture-middleware-I7IQCC7V.js} +3 -3
- package/dist/cli/chunks/{fast-paths-RBPWQSFJ.js → fast-paths-34OICNZA.js} +2 -2
- package/dist/cli/chunks/{feature-flags-NX5EXRO3.js → feature-flags-6UBIVTAD.js} +2 -2
- package/dist/cli/chunks/{feature-flags-INJJZBMN.js → feature-flags-X5WBBWSO.js} +2 -2
- package/dist/cli/chunks/{file-discovery-SNFSG6NK.js → file-discovery-NLMDBWXX.js} +2 -2
- package/dist/cli/chunks/{fleet-6SDN4UWE.js → fleet-W7CYCHDI.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-2JDRTDDK.js → gnn-wrapper-K4VTAG5X.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-QLK6E7KA.js → heartbeat-handler-ZGKF2Z6T.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-JBCXMMZO.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-3SC2HZIG.js +2 -0
- package/dist/cli/chunks/hnsw-index-FQORAR6K.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-Q2ZEZQKB.js → hnsw-legacy-bridge-ELDRLKK5.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-Y6GX6CGB.js → hnswlib-node-ZGSUMHDC.js} +2 -2
- package/dist/cli/chunks/{hooks-D4YENHO2.js → hooks-T4CBINAV.js} +13 -13
- package/dist/cli/chunks/hybrid-router-6CBFDXPR.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-G72U446M.js → hypergraph-engine-UWFW3XP5.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-TRZ5FDRH.js → hypergraph-handler-PK2BI46K.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-SOEFVZWG.js +2 -0
- package/dist/cli/chunks/{init-handler-3ZD4GCT4.js → init-handler-HNG6KJOU.js} +6 -6
- package/dist/cli/chunks/init-wizard-3E4IU5M4.js +2 -0
- package/dist/cli/chunks/kernel-GFZP4G5J.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-AXSIW3XW.js → kilocode-installer-25V7FEJ4.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-JQGIFWBK.js → kiro-installer-7RMTTCQB.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-BKRKBU26.js +2 -0
- package/dist/cli/chunks/{learning-SPO7TGWX.js → learning-XQC2MG2R.js} +3 -3
- package/dist/cli/chunks/llm-router-6KTTONH4.js +36 -0
- package/dist/cli/chunks/llm-router-service-KE4IGZPP.js +2 -0
- package/dist/cli/chunks/{load-XIDDK64U.js → load-BV64P3AL.js} +2 -2
- package/dist/cli/chunks/load-test-VSYJV2AO.js +2 -0
- package/dist/cli/chunks/{mcp-3JXRGXO4.js → mcp-U5ZN77TA.js} +2 -2
- package/dist/cli/chunks/{memory-A66KRS2P.js → memory-WB5BNBK7.js} +5 -5
- package/dist/cli/chunks/memory-backend-B72RGHRF.js +2 -0
- package/dist/cli/chunks/memory-handlers-NWCH7AUO.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-XCDGUVCE.js → multi-model-executor-3X3W3UTY.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-GELXWLF2.js → opencode-installer-TTTMG7ZZ.js} +2 -2
- package/dist/cli/chunks/{orchestrator-CCS3K6NH.js → orchestrator-BLCGSHMZ.js} +18 -18
- package/dist/cli/chunks/{pipeline-Z5C72H5S.js → pipeline-DZPGMRG7.js} +2 -2
- package/dist/cli/chunks/{platform-4AK7XJ3Y.js → platform-EVMZAUNV.js} +2 -2
- package/dist/cli/chunks/{plugin-7RYBIZI7.js → plugin-OR55K4HT.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-E5PARKRX.js → prime-radiant-advanced-wasm-4ODV27HD.js} +2 -2
- package/dist/cli/chunks/protocol-executor-V3F37FPO.js +2 -0
- package/dist/cli/chunks/{protocol-handler-R6QJQFNL.js → protocol-handler-ZOTI5PID.js} +2 -2
- package/dist/cli/chunks/{prove-7ESQ2YAL.js → prove-DIMBYJ7V.js} +2 -2
- package/dist/cli/chunks/provider-manager-2PN72TT6.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-P665QNIR.js +2 -0
- package/dist/cli/chunks/{quality-4UE345QA.js → quality-7MX4VL6M.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-XD4F7BGB.js +2 -0
- package/dist/cli/chunks/{real-embeddings-TYIVN3N5.js → real-embeddings-YPUHWRN2.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-2KOANC47.js → roocode-installer-WG5AU4QM.js} +2 -2
- package/dist/cli/chunks/router-4SSNWDJC.js +2 -0
- package/dist/cli/chunks/routing-feedback-O2JSIBW6.js +2 -0
- package/dist/cli/chunks/{routing-handler-JFEYTN7T.js → routing-handler-LZB4MN2K.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-KSLSZRJX.js → ruvector-commands-YE4ADBMC.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-EPBL226J.js → rvf-dual-writer-QS5ATW4C.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-25KSI6SF.js → rvf-migration-adapter-YIGKSBD3.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-2XBYHPZP.js → rvf-migration-coordinator-2NDCWP7F.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-WIUHYXRB.js +2 -0
- package/dist/cli/chunks/safe-db-WL5Y7ZNS.js +2 -0
- package/dist/cli/chunks/schedule-U7QDGU5A.js +2 -0
- package/dist/cli/chunks/scheduler-LXKGQYXA.js +2 -0
- package/dist/cli/chunks/{security-4XWYKI4O.js → security-HT4SUT24.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-WRZ3HGDQ.js → shared-rvf-adapter-4IZOJL33.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-DX2N5STR.js → shared-rvf-dual-writer-ZKFO7CBY.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-4KFO3SEB.js +2 -0
- package/dist/cli/chunks/{status-handler-V75OSXMQ.js → status-handler-AMEMKBI4.js} +2 -2
- package/dist/cli/chunks/{structural-health-TLX3JHZ6.js → structural-health-RBADRLC3.js} +2 -2
- package/dist/cli/chunks/{sync-KGBEXUF7.js → sync-ARDDLQBS.js} +2 -2
- package/dist/cli/chunks/{sync-DXZFMVZQ.js → sync-PCB23M4K.js} +2 -2
- package/dist/cli/chunks/{task-handler-T3OJ6R7H.js → task-handler-J26FSCH5.js} +2 -2
- package/dist/cli/chunks/{task-handlers-NJYR54AS.js → task-handlers-AQRLR6BL.js} +3 -3
- package/dist/cli/chunks/{test-KMVDNNQA.js → test-YXWSIOSB.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-R5EQ2XGV.js → test-scheduling-XY532GI4.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-PFKVV3RO.js → token-bootstrap-KL2QIQ36.js} +2 -2
- package/dist/cli/chunks/{token-usage-ZLOGA6LR.js → token-usage-2MJVE4DT.js} +2 -2
- package/dist/cli/chunks/{transformers-TNPSPQI3.js → transformers-QSNTOD2Z.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-A2EEB5BF.js → tree-sitter-wasm-parser-QJOKHOIW.js} +2 -2
- package/dist/cli/chunks/{types-DIXPI4NR.js → types-RNKRSYMO.js} +2 -2
- package/dist/cli/chunks/unified-memory-7AS4LIEF.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-GREESNJX.js +2 -0
- package/dist/cli/chunks/unified-persistence-BPJOMZOA.js +2 -0
- package/dist/cli/chunks/{upgrade-LX5KP6VO.js → upgrade-EKJHIFWP.js} +2 -2
- package/dist/cli/chunks/{validate-3L6F7M36.js → validate-KS4T7LWC.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-FD42ZKAQ.js → validate-swarm-SKKWRP2H.js} +2 -2
- package/dist/cli/chunks/{vibium-GSBSJR53.js → vibium-FLUQO4IF.js} +2 -2
- package/dist/cli/chunks/visual-security-BW662FHQ.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-TXHMO4BW.js → web-tree-sitter-UMC63DWD.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-3EUZ6RD3.js → windsurf-installer-V3FQGJIQ.js} +2 -2
- package/dist/cli/chunks/{witness-chain-ONAUEJ4M.js → witness-chain-GE74TLSO.js} +2 -2
- package/dist/cli/chunks/witness-chain-OXVDLNVT.js +2 -0
- package/dist/cli/chunks/{workflow-E7A6BV4C.js → workflow-4YZ2RPWA.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-KKNR46XV.js +2 -0
- package/dist/cli/chunks/{wrappers-AHHAQJM3.js → wrappers-37NLMKPE.js} +2 -2
- package/dist/cli/commands/hooks-handlers/command-hooks.js +1 -1
- package/dist/cli/commands/hooks-handlers/routing-hooks.js +1 -1
- package/dist/cli/commands/hooks-handlers/task-hooks.js +1 -1
- package/dist/cli/commands/llm-router.js +83 -26
- package/dist/domains/chaos-resilience/coordinator.d.ts +2 -1
- package/dist/domains/chaos-resilience/coordinator.js +3 -2
- package/dist/domains/chaos-resilience/plugin.d.ts +4 -2
- package/dist/domains/chaos-resilience/plugin.js +8 -5
- package/dist/domains/code-intelligence/coordinator.d.ts +2 -1
- package/dist/domains/code-intelligence/coordinator.js +3 -2
- package/dist/domains/code-intelligence/plugin.d.ts +4 -2
- package/dist/domains/code-intelligence/plugin.js +8 -5
- package/dist/domains/contract-testing/coordinator.d.ts +2 -1
- package/dist/domains/contract-testing/coordinator.js +3 -2
- package/dist/domains/contract-testing/plugin.d.ts +4 -2
- package/dist/domains/contract-testing/plugin.js +8 -5
- package/dist/domains/coverage-analysis/coordinator.d.ts +2 -1
- package/dist/domains/coverage-analysis/coordinator.js +4 -3
- package/dist/domains/coverage-analysis/plugin.d.ts +3 -2
- package/dist/domains/coverage-analysis/plugin.js +4 -4
- package/dist/domains/defect-intelligence/coordinator.d.ts +2 -1
- package/dist/domains/defect-intelligence/coordinator.js +4 -3
- package/dist/domains/defect-intelligence/plugin.d.ts +4 -2
- package/dist/domains/defect-intelligence/plugin.js +9 -6
- package/dist/domains/learning-optimization/coordinator.d.ts +2 -1
- package/dist/domains/learning-optimization/coordinator.js +3 -2
- package/dist/domains/learning-optimization/plugin.d.ts +4 -2
- package/dist/domains/learning-optimization/plugin.js +8 -5
- package/dist/domains/quality-assessment/coordinator.d.ts +2 -1
- package/dist/domains/quality-assessment/coordinator.js +4 -3
- package/dist/domains/quality-assessment/plugin.d.ts +4 -2
- package/dist/domains/quality-assessment/plugin.js +10 -6
- package/dist/domains/requirements-validation/coordinator.d.ts +2 -1
- package/dist/domains/requirements-validation/coordinator.js +3 -2
- package/dist/domains/requirements-validation/plugin.d.ts +4 -2
- package/dist/domains/requirements-validation/plugin.js +8 -5
- package/dist/domains/security-compliance/coordinator.d.ts +2 -1
- package/dist/domains/security-compliance/coordinator.js +4 -2
- package/dist/domains/security-compliance/plugin.d.ts +4 -2
- package/dist/domains/security-compliance/plugin.js +11 -6
- package/dist/domains/test-execution/coordinator.d.ts +3 -2
- package/dist/domains/test-execution/coordinator.js +6 -5
- package/dist/domains/test-execution/plugin.d.ts +4 -2
- package/dist/domains/test-execution/plugin.js +6 -4
- package/dist/domains/test-generation/coordinator.d.ts +2 -1
- package/dist/domains/test-generation/coordinator.js +4 -3
- package/dist/domains/test-generation/plugin.d.ts +4 -2
- package/dist/domains/test-generation/plugin.js +12 -7
- package/dist/domains/visual-accessibility/coordinator.d.ts +2 -1
- package/dist/domains/visual-accessibility/coordinator.js +4 -3
- package/dist/domains/visual-accessibility/plugin.d.ts +4 -2
- package/dist/domains/visual-accessibility/plugin.js +9 -6
- package/dist/init/init-wizard-hooks.js +271 -271
- package/dist/init/phases/07-hooks.d.ts +7 -0
- package/dist/init/phases/07-hooks.js +132 -96
- package/dist/kernel/interfaces.d.ts +37 -0
- package/dist/kernel/kernel.d.ts +39 -0
- package/dist/kernel/kernel.js +157 -17
- package/dist/learning/agent-routing.d.ts +19 -0
- package/dist/learning/agent-routing.js +27 -1
- package/dist/learning/dream/dream-scheduler.d.ts +11 -36
- package/dist/learning/dream/dream-scheduler.js +44 -0
- package/dist/learning/experience-consolidation.d.ts +16 -0
- package/dist/learning/experience-consolidation.js +55 -11
- package/dist/learning/pattern-lifecycle.d.ts +21 -0
- package/dist/learning/pattern-lifecycle.js +70 -6
- package/dist/mcp/bundle.js +426 -401
- package/dist/mcp/protocol-server.js +13 -14
- package/dist/mcp/qe-tool-bridge.js +8 -1
- package/dist/mcp/tools/base.d.ts +56 -0
- package/dist/mcp/tools/base.js +104 -1
- package/dist/mcp/tools/chaos-resilience/inject.js +4 -2
- package/dist/mcp/tools/code-intelligence/analyze.js +5 -3
- package/dist/mcp/tools/contract-testing/validate.js +4 -2
- package/dist/mcp/tools/coverage-analysis/index.js +11 -5
- package/dist/mcp/tools/defect-intelligence/predict.js +5 -10
- package/dist/mcp/tools/learning-optimization/optimize.js +4 -2
- package/dist/mcp/tools/registry.js +8 -1
- package/dist/mcp/tools/test-generation/generate.js +10 -6
- package/dist/mcp/tools/visual-accessibility/index.js +7 -4
- package/dist/mcp/transport/stdio.d.ts +20 -0
- package/dist/mcp/transport/stdio.js +35 -2
- package/dist/shared/llm/llm-router-service.d.ts +77 -0
- package/dist/shared/llm/llm-router-service.js +166 -0
- package/dist/shared/llm/providers/gemini.js +5 -2
- package/dist/shared/llm/router/config-store.d.ts +89 -0
- package/dist/shared/llm/router/config-store.js +261 -0
- package/dist/shared/llm/router/hybrid-router.js +33 -11
- package/dist/shared/utils/rabitq.d.ts +133 -0
- package/dist/shared/utils/rabitq.js +201 -0
- package/package.json +8 -2
- package/dist/cli/chunks/adapter-WTE6UVGP.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-LCLEBU7D.js +0 -2
- package/dist/cli/chunks/base-73I73HBF.js +0 -2
- package/dist/cli/chunks/browser-workflow-2NSV5O6W.js +0 -2
- package/dist/cli/chunks/chunk-6MONUYQ5.js +0 -2
- package/dist/cli/chunks/chunk-QL3U5VSM.js +0 -62
- package/dist/cli/chunks/chunk-VMJXNTJT.js +0 -95
- package/dist/cli/chunks/chunk-X73CRYF4.js +0 -2
- package/dist/cli/chunks/client-7GB4WWUD.js +0 -2
- package/dist/cli/chunks/cross-domain-router-7HQ74TLE.js +0 -2
- package/dist/cli/chunks/dream-G5SEFHI4.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-NG7BY3FR.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-TDSLUI7K.js +0 -2
- package/dist/cli/chunks/hnsw-index-OWLQSOQH.js +0 -2
- package/dist/cli/chunks/hybrid-router-URU2XLBD.js +0 -2
- package/dist/cli/chunks/impact-analyzer-NMTN75KA.js +0 -2
- package/dist/cli/chunks/init-wizard-SHBFYGBV.js +0 -2
- package/dist/cli/chunks/kernel-7KVY2JGO.js +0 -2
- package/dist/cli/chunks/knowledge-graph-V4G5J5B7.js +0 -2
- package/dist/cli/chunks/llm-router-G6N2OKDA.js +0 -36
- package/dist/cli/chunks/load-test-N4RNPLG4.js +0 -2
- package/dist/cli/chunks/memory-backend-HPGJ5YDQ.js +0 -2
- package/dist/cli/chunks/memory-handlers-K33YVCVQ.js +0 -2
- package/dist/cli/chunks/protocol-executor-GNVWUJUP.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-DDSBHO6D.js +0 -2
- package/dist/cli/chunks/queen-coordinator-BQJ5O63C.js +0 -2
- package/dist/cli/chunks/router-C2RKWB7J.js +0 -2
- package/dist/cli/chunks/routing-feedback-RHATTSJ6.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-QG4CXHLL.js +0 -2
- package/dist/cli/chunks/safe-db-A4KQ2IDB.js +0 -2
- package/dist/cli/chunks/schedule-O7MLASQT.js +0 -2
- package/dist/cli/chunks/scheduler-HT7RNYQ2.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-4NNKJ6CQ.js +0 -2
- package/dist/cli/chunks/unified-memory-CMNJVHOJ.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-JQLU2KI6.js +0 -2
- package/dist/cli/chunks/unified-persistence-I25TEDIU.js +0 -2
- package/dist/cli/chunks/visual-security-AJJIEV5V.js +0 -2
- package/dist/cli/chunks/witness-chain-762QQBTN.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-ZGPYISKY.js +0 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* ADR-039: Integrated with connection pooling, load balancing, and performance monitoring
|
|
7
7
|
*/
|
|
8
|
-
import { createStdioTransport, JSON_RPC_ERRORS, } from './transport';
|
|
8
|
+
import { createStdioTransport, JSON_RPC_ERRORS, isJsonRpcCodedError, McpError, } from './transport';
|
|
9
9
|
import { createToolRegistry } from './tool-registry';
|
|
10
10
|
import { MiddlewareChain } from './middleware/middleware-chain';
|
|
11
11
|
import { createMicrocompactMiddleware } from './middleware/microcompact';
|
|
@@ -156,7 +156,15 @@ export class MCPProtocolServer {
|
|
|
156
156
|
return await this.handleRequest(request);
|
|
157
157
|
}
|
|
158
158
|
catch (err) {
|
|
159
|
-
//
|
|
159
|
+
// Errors that carry a JSON-RPC `code` (e.g. METHOD_NOT_FOUND for an
|
|
160
|
+
// unknown tool/method — thrown as McpError or a legacy plain
|
|
161
|
+
// `{ code, message }` object) are real protocol errors: re-throw so the
|
|
162
|
+
// transport serializes them as a proper JSON-RPC error response with the
|
|
163
|
+
// correct code/message, instead of flattening to "[object Object]".
|
|
164
|
+
if (isJsonRpcCodedError(err)) {
|
|
165
|
+
throw err;
|
|
166
|
+
}
|
|
167
|
+
// Last-resort safety net: catch anything else that escapes handleToolsCall
|
|
160
168
|
// to prevent MCP connection from being killed (-32000)
|
|
161
169
|
const message = err instanceof Error ? err.message : String(err);
|
|
162
170
|
console.error(`[MCP] Unhandled error in request handler: ${message}`);
|
|
@@ -307,10 +315,7 @@ export class MCPProtocolServer {
|
|
|
307
315
|
return { pong: true };
|
|
308
316
|
// Unknown method
|
|
309
317
|
default:
|
|
310
|
-
throw {
|
|
311
|
-
code: JSON_RPC_ERRORS.METHOD_NOT_FOUND,
|
|
312
|
-
message: `Unknown method: ${method}`,
|
|
313
|
-
};
|
|
318
|
+
throw new McpError(JSON_RPC_ERRORS.METHOD_NOT_FOUND, `Unknown method: ${method}`);
|
|
314
319
|
}
|
|
315
320
|
}
|
|
316
321
|
async handleNotification(notification) {
|
|
@@ -333,10 +338,7 @@ export class MCPProtocolServer {
|
|
|
333
338
|
// ============================================================================
|
|
334
339
|
async handleInitialize(params) {
|
|
335
340
|
if (this.initialized) {
|
|
336
|
-
throw
|
|
337
|
-
code: JSON_RPC_ERRORS.INVALID_REQUEST,
|
|
338
|
-
message: 'Server already initialized',
|
|
339
|
-
};
|
|
341
|
+
throw new McpError(JSON_RPC_ERRORS.INVALID_REQUEST, 'Server already initialized');
|
|
340
342
|
}
|
|
341
343
|
// Store client info
|
|
342
344
|
if (params.clientInfo) {
|
|
@@ -371,10 +373,7 @@ export class MCPProtocolServer {
|
|
|
371
373
|
const { name, arguments: args = {} } = params;
|
|
372
374
|
const tool = this.tools.get(name);
|
|
373
375
|
if (!tool) {
|
|
374
|
-
throw {
|
|
375
|
-
code: JSON_RPC_ERRORS.METHOD_NOT_FOUND,
|
|
376
|
-
message: `Unknown tool: ${name}`,
|
|
377
|
-
};
|
|
376
|
+
throw new McpError(JSON_RPC_ERRORS.METHOD_NOT_FOUND, `Unknown tool: ${name}`);
|
|
378
377
|
}
|
|
379
378
|
// ADR-039: Track tool invocation with performance monitoring
|
|
380
379
|
const startTime = performance.now();
|
|
@@ -75,7 +75,14 @@ export function registerMissingQETools(registerFn) {
|
|
|
75
75
|
parameters: schemaToParameters(tool),
|
|
76
76
|
},
|
|
77
77
|
handler: async (params) => {
|
|
78
|
-
|
|
78
|
+
// ADR-043: explicitly forward the shared HybridRouter (registered
|
|
79
|
+
// by QEKernelImpl during initialize() in production, or built
|
|
80
|
+
// lazily for MCP-only contexts) so the MCPToolContext.llmRouter
|
|
81
|
+
// field carries the actual instance rather than relying on each
|
|
82
|
+
// tool's getLLMRouter(context) singleton fallback.
|
|
83
|
+
const { getSharedLLMRouter } = await import('./tools/base.js');
|
|
84
|
+
const llmRouter = (await getSharedLLMRouter()) ?? undefined;
|
|
85
|
+
const result = await tool.invoke(params, { llmRouter });
|
|
79
86
|
return result;
|
|
80
87
|
},
|
|
81
88
|
};
|
package/dist/mcp/tools/base.d.ts
CHANGED
|
@@ -26,6 +26,41 @@ export declare function resetSharedMemoryBackend(): void;
|
|
|
26
26
|
* Get memory backend from context or create shared one
|
|
27
27
|
*/
|
|
28
28
|
export declare function getMemoryBackend(context?: MCPToolContext): Promise<MemoryBackend>;
|
|
29
|
+
/**
|
|
30
|
+
* Register an externally-built HybridRouter as the shared singleton.
|
|
31
|
+
* Called by QEKernelImpl during initialize() so kernel-mode and MCP-mode
|
|
32
|
+
* tools share the same router instance. Idempotent — calling with the
|
|
33
|
+
* same router twice is a no-op; calling with a different router
|
|
34
|
+
* replaces the previous one (and any in-flight lazy init is cancelled
|
|
35
|
+
* for next-read semantics).
|
|
36
|
+
*/
|
|
37
|
+
export declare function setSharedLLMRouter(router: import('../../shared/llm/router/hybrid-router.js').HybridRouter): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get or create the shared HybridRouter for standalone MCP tools that
|
|
40
|
+
* construct their service directly (without going through the kernel /
|
|
41
|
+
* plugin chain that Phase 2 wired up).
|
|
42
|
+
*
|
|
43
|
+
* Returns null when:
|
|
44
|
+
* - AQE_LLM_ROUTER_DISABLED env kill-switch is set, OR
|
|
45
|
+
* - no provider key is in env and the project has no llm-config.json
|
|
46
|
+
*
|
|
47
|
+
* Callers MUST tolerate a null return value and fall back to
|
|
48
|
+
* deterministic-only behavior in that case.
|
|
49
|
+
*
|
|
50
|
+
* Resets via `resetSharedLLMRouter()` for tests.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getSharedLLMRouter(): Promise<import('../../shared/llm/router/hybrid-router.js').HybridRouter | null>;
|
|
53
|
+
/**
|
|
54
|
+
* Reset the shared LLM router singleton. For tests.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resetSharedLLMRouter(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Get LLM router from context or shared singleton. Returns undefined
|
|
59
|
+
* (not null) when no router is available, so it can be spread directly
|
|
60
|
+
* into a `{ memory, llmRouter }` dependency bag without contaminating
|
|
61
|
+
* the value.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getLLMRouter(context?: MCPToolContext): Promise<import('../../shared/llm/router/hybrid-router.js').HybridRouter | undefined>;
|
|
29
64
|
/**
|
|
30
65
|
* JSON Schema property definition for tool parameters
|
|
31
66
|
*/
|
|
@@ -79,6 +114,13 @@ export interface MCPToolContext {
|
|
|
79
114
|
demoMode?: boolean;
|
|
80
115
|
/** Shared memory backend for persistent storage */
|
|
81
116
|
memory?: import('../../kernel/interfaces').MemoryBackend;
|
|
117
|
+
/**
|
|
118
|
+
* ADR-043: HybridRouter for LLM-enhanced analysis. Standalone MCP
|
|
119
|
+
* tools that construct services directly should fetch this via
|
|
120
|
+
* `getLLMRouter(context)` and pass it into the service dependency
|
|
121
|
+
* bag so isLLMAnalysisAvailable() returns true.
|
|
122
|
+
*/
|
|
123
|
+
llmRouter?: import('../../shared/llm/router/hybrid-router.js').HybridRouter;
|
|
82
124
|
}
|
|
83
125
|
/**
|
|
84
126
|
* Data source tracking for audit/transparency
|
|
@@ -167,6 +209,20 @@ export declare abstract class MCPToolBase<TParams extends Record<string, unknown
|
|
|
167
209
|
abortSignal?: AbortSignal;
|
|
168
210
|
/** Explicit demo mode - returns sample data without calling real services */
|
|
169
211
|
demoMode?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* ADR-043: Optional memory backend injection. When provided, the
|
|
214
|
+
* context.memory field is populated and tools skip the shared
|
|
215
|
+
* singleton fallback.
|
|
216
|
+
*/
|
|
217
|
+
memory?: import('../../kernel/interfaces').MemoryBackend;
|
|
218
|
+
/**
|
|
219
|
+
* ADR-043: Optional LLM router injection. When provided, the
|
|
220
|
+
* context.llmRouter field is populated so getLLMRouter(context)
|
|
221
|
+
* returns it directly — used by the MCP runtime to forward the
|
|
222
|
+
* kernel singleton without going through getSharedLLMRouter()'s
|
|
223
|
+
* lazy build path.
|
|
224
|
+
*/
|
|
225
|
+
llmRouter?: import('../../shared/llm/router/hybrid-router.js').HybridRouter;
|
|
170
226
|
}): Promise<ToolResult<TResult>>;
|
|
171
227
|
/**
|
|
172
228
|
* Create result metadata
|
package/dist/mcp/tools/base.js
CHANGED
|
@@ -97,6 +97,101 @@ export async function getMemoryBackend(context) {
|
|
|
97
97
|
}
|
|
98
98
|
return getSharedMemoryBackend();
|
|
99
99
|
}
|
|
100
|
+
// ============================================================================
|
|
101
|
+
// Shared LLM Router for MCP Tools (ADR-043)
|
|
102
|
+
// ============================================================================
|
|
103
|
+
//
|
|
104
|
+
// Two paths populate this singleton:
|
|
105
|
+
//
|
|
106
|
+
// 1. QEKernelImpl._initializeLLMRouter() calls setSharedLLMRouter() on
|
|
107
|
+
// boot, so kernel-mode AND MCP-mode share ONE HybridRouter — one
|
|
108
|
+
// cost tracker, one metrics collector, one provider circuit breaker.
|
|
109
|
+
// This is the production path.
|
|
110
|
+
//
|
|
111
|
+
// 2. Pure-MCP processes (no kernel — e.g. standalone CLI invocations
|
|
112
|
+
// that go directly through the MCP tool surface) lazily construct
|
|
113
|
+
// a router on first getSharedLLMRouter() call. Subordinate to (1).
|
|
114
|
+
//
|
|
115
|
+
// AQE_LLM_ROUTER_DISABLED env kill-switch is honored in both paths so a
|
|
116
|
+
// user can opt out without code changes.
|
|
117
|
+
let sharedLLMRouter = null;
|
|
118
|
+
let llmRouterInitPromise = null;
|
|
119
|
+
/**
|
|
120
|
+
* Returns true when the AQE_LLM_ROUTER_DISABLED env kill-switch is set.
|
|
121
|
+
* Honors '1', 'true', 'yes', 'on'; ignores '', '0', 'false', 'no', 'off'.
|
|
122
|
+
*/
|
|
123
|
+
function isRouterKillSwitchSet() {
|
|
124
|
+
const v = (process.env.AQE_LLM_ROUTER_DISABLED ?? '').trim().toLowerCase();
|
|
125
|
+
if (!v)
|
|
126
|
+
return false;
|
|
127
|
+
return v !== 'false' && v !== '0' && v !== 'no' && v !== 'off';
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Register an externally-built HybridRouter as the shared singleton.
|
|
131
|
+
* Called by QEKernelImpl during initialize() so kernel-mode and MCP-mode
|
|
132
|
+
* tools share the same router instance. Idempotent — calling with the
|
|
133
|
+
* same router twice is a no-op; calling with a different router
|
|
134
|
+
* replaces the previous one (and any in-flight lazy init is cancelled
|
|
135
|
+
* for next-read semantics).
|
|
136
|
+
*/
|
|
137
|
+
export function setSharedLLMRouter(router) {
|
|
138
|
+
sharedLLMRouter = router;
|
|
139
|
+
llmRouterInitPromise = null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get or create the shared HybridRouter for standalone MCP tools that
|
|
143
|
+
* construct their service directly (without going through the kernel /
|
|
144
|
+
* plugin chain that Phase 2 wired up).
|
|
145
|
+
*
|
|
146
|
+
* Returns null when:
|
|
147
|
+
* - AQE_LLM_ROUTER_DISABLED env kill-switch is set, OR
|
|
148
|
+
* - no provider key is in env and the project has no llm-config.json
|
|
149
|
+
*
|
|
150
|
+
* Callers MUST tolerate a null return value and fall back to
|
|
151
|
+
* deterministic-only behavior in that case.
|
|
152
|
+
*
|
|
153
|
+
* Resets via `resetSharedLLMRouter()` for tests.
|
|
154
|
+
*/
|
|
155
|
+
export async function getSharedLLMRouter() {
|
|
156
|
+
if (isRouterKillSwitchSet()) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
if (sharedLLMRouter) {
|
|
160
|
+
return sharedLLMRouter;
|
|
161
|
+
}
|
|
162
|
+
if (llmRouterInitPromise) {
|
|
163
|
+
return llmRouterInitPromise;
|
|
164
|
+
}
|
|
165
|
+
llmRouterInitPromise = (async () => {
|
|
166
|
+
const { createLLMRouterService } = await import('../../shared/llm/llm-router-service.js');
|
|
167
|
+
const built = await createLLMRouterService();
|
|
168
|
+
if (!built)
|
|
169
|
+
return null;
|
|
170
|
+
sharedLLMRouter = built.router;
|
|
171
|
+
return sharedLLMRouter;
|
|
172
|
+
})();
|
|
173
|
+
return llmRouterInitPromise;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Reset the shared LLM router singleton. For tests.
|
|
177
|
+
*/
|
|
178
|
+
export function resetSharedLLMRouter() {
|
|
179
|
+
sharedLLMRouter = null;
|
|
180
|
+
llmRouterInitPromise = null;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Get LLM router from context or shared singleton. Returns undefined
|
|
184
|
+
* (not null) when no router is available, so it can be spread directly
|
|
185
|
+
* into a `{ memory, llmRouter }` dependency bag without contaminating
|
|
186
|
+
* the value.
|
|
187
|
+
*/
|
|
188
|
+
export async function getLLMRouter(context) {
|
|
189
|
+
if (context?.llmRouter) {
|
|
190
|
+
return context.llmRouter;
|
|
191
|
+
}
|
|
192
|
+
const shared = await getSharedLLMRouter();
|
|
193
|
+
return shared ?? undefined;
|
|
194
|
+
}
|
|
100
195
|
/**
|
|
101
196
|
* Default console logger
|
|
102
197
|
*/
|
|
@@ -245,7 +340,13 @@ export class MCPToolBase {
|
|
|
245
340
|
metadata: this.createMetadata(startTime, requestId),
|
|
246
341
|
};
|
|
247
342
|
}
|
|
248
|
-
// Create execution context
|
|
343
|
+
// Create execution context.
|
|
344
|
+
// ADR-043: memory + llmRouter are populated from invoke() options so
|
|
345
|
+
// the MCP runtime (qe-tool-bridge, registry, daemon) can forward the
|
|
346
|
+
// kernel singleton explicitly rather than relying on the shared
|
|
347
|
+
// singleton fallback. When unset, getLLMRouter(context) falls back
|
|
348
|
+
// to getSharedLLMRouter() — which itself is kernel-aware via
|
|
349
|
+
// setSharedLLMRouter() registered during kernel.initialize().
|
|
249
350
|
const context = {
|
|
250
351
|
requestId,
|
|
251
352
|
startTime,
|
|
@@ -253,6 +354,8 @@ export class MCPToolBase {
|
|
|
253
354
|
onStream: options.onStream,
|
|
254
355
|
abortSignal: options.abortSignal,
|
|
255
356
|
demoMode: options.demoMode,
|
|
357
|
+
memory: options.memory,
|
|
358
|
+
llmRouter: options.llmRouter,
|
|
256
359
|
};
|
|
257
360
|
try {
|
|
258
361
|
// Execute the tool
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - ChaosEngineerService for fault injection and experiment execution
|
|
8
8
|
*/
|
|
9
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
-
import { MCPToolBase, getSharedMemoryBackend } from '../base.js';
|
|
10
|
+
import { MCPToolBase, getSharedMemoryBackend, getLLMRouter } from '../base.js';
|
|
11
11
|
import { ChaosEngineerService } from '../../../domains/chaos-resilience/services/chaos-engineer.js';
|
|
12
12
|
import { toErrorMessage } from '../../../shared/error-utils.js';
|
|
13
13
|
// ============================================================================
|
|
@@ -26,7 +26,9 @@ export class ChaosInjectTool extends MCPToolBase {
|
|
|
26
26
|
async getService(context) {
|
|
27
27
|
if (!this.chaosEngineer) {
|
|
28
28
|
const memory = context.memory || await getSharedMemoryBackend();
|
|
29
|
-
|
|
29
|
+
// ADR-043 wiring.
|
|
30
|
+
const llmRouter = await getLLMRouter(context);
|
|
31
|
+
this.chaosEngineer = new ChaosEngineerService({ memory, llmRouter }, {
|
|
30
32
|
enableDryRun: true,
|
|
31
33
|
autoRollbackOnFailure: true,
|
|
32
34
|
});
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - SemanticAnalyzerService for semantic code search
|
|
9
9
|
* - ImpactAnalyzerService for change impact analysis
|
|
10
10
|
*/
|
|
11
|
-
import { MCPToolBase, getSharedMemoryBackend } from '../base';
|
|
11
|
+
import { MCPToolBase, getSharedMemoryBackend, getLLMRouter } from '../base';
|
|
12
12
|
import { KnowledgeGraphService } from '../../../domains/code-intelligence/services/knowledge-graph';
|
|
13
13
|
import { SemanticAnalyzerService } from '../../../domains/code-intelligence/services/semantic-analyzer';
|
|
14
14
|
import { ImpactAnalyzerService } from '../../../domains/code-intelligence/services/impact-analyzer';
|
|
@@ -35,8 +35,10 @@ export class CodeAnalyzeTool extends MCPToolBase {
|
|
|
35
35
|
*/
|
|
36
36
|
async getKnowledgeGraph(context) {
|
|
37
37
|
if (!this.knowledgeGraph) {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// ADR-043 wiring.
|
|
39
|
+
const memory = context.memory ?? await getSharedMemoryBackend();
|
|
40
|
+
const llmRouter = await getLLMRouter(context);
|
|
41
|
+
this.knowledgeGraph = new KnowledgeGraphService({ memory, llmRouter });
|
|
40
42
|
}
|
|
41
43
|
return this.knowledgeGraph;
|
|
42
44
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - ContractValidatorService for contract/schema validation
|
|
8
8
|
* - ApiCompatibilityService for breaking change detection
|
|
9
9
|
*/
|
|
10
|
-
import { MCPToolBase, getSharedMemoryBackend } from '../base.js';
|
|
10
|
+
import { MCPToolBase, getSharedMemoryBackend, getLLMRouter } from '../base.js';
|
|
11
11
|
import { safeJsonParse } from '../../../shared/safe-json.js';
|
|
12
12
|
import { Version } from '../../../shared/value-objects/index.js';
|
|
13
13
|
import { ContractValidatorService } from '../../../domains/contract-testing/services/contract-validator.js';
|
|
@@ -67,7 +67,9 @@ export class ContractValidateTool extends MCPToolBase {
|
|
|
67
67
|
async getServices(context) {
|
|
68
68
|
if (!this.contractValidator || !this.apiCompatibility) {
|
|
69
69
|
const memory = context.memory || await getSharedMemoryBackend();
|
|
70
|
-
|
|
70
|
+
// ADR-043 wiring.
|
|
71
|
+
const llmRouter = await getLLMRouter(context);
|
|
72
|
+
this.contractValidator = new ContractValidatorService({ memory, llmRouter });
|
|
71
73
|
this.apiCompatibility = new ApiCompatibilityService(memory);
|
|
72
74
|
}
|
|
73
75
|
return {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This module wraps the REAL coverage-analysis domain services.
|
|
8
8
|
* Uses actual LCOV/JSON parsing and vector-based gap detection.
|
|
9
9
|
*/
|
|
10
|
-
import { MCPToolBase, getSharedMemoryBackend } from '../base';
|
|
10
|
+
import { MCPToolBase, getSharedMemoryBackend, getLLMRouter } from '../base';
|
|
11
11
|
import { CoverageAnalyzerService } from '../../../domains/coverage-analysis/services/coverage-analyzer';
|
|
12
12
|
import { GapDetectorService } from '../../../domains/coverage-analysis/services/gap-detector';
|
|
13
13
|
import { findAndParseCoverage, parseCoverage, } from '../../../domains/coverage-analysis/services/coverage-parser';
|
|
@@ -83,8 +83,12 @@ export class CoverageAnalyzeTool extends MCPToolBase {
|
|
|
83
83
|
analyzerService = null;
|
|
84
84
|
async getService(context) {
|
|
85
85
|
if (!this.analyzerService) {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
// ADR-043 wiring: pull the shared HybridRouter (returns undefined
|
|
87
|
+
// when no provider key is present) so isLLMAnalysisAvailable()
|
|
88
|
+
// returns true in MCP mode the same way it does in kernel mode.
|
|
89
|
+
const memory = context.memory ?? await getSharedMemoryBackend();
|
|
90
|
+
const llmRouter = await getLLMRouter(context);
|
|
91
|
+
this.analyzerService = new CoverageAnalyzerService({ memory, llmRouter });
|
|
88
92
|
}
|
|
89
93
|
return this.analyzerService;
|
|
90
94
|
}
|
|
@@ -296,8 +300,10 @@ export class CoverageGapsTool extends MCPToolBase {
|
|
|
296
300
|
gapService = null;
|
|
297
301
|
async getService(context) {
|
|
298
302
|
if (!this.gapService) {
|
|
299
|
-
|
|
300
|
-
|
|
303
|
+
// ADR-043 wiring.
|
|
304
|
+
const memory = context.memory ?? await getSharedMemoryBackend();
|
|
305
|
+
const llmRouter = await getLLMRouter(context);
|
|
306
|
+
this.gapService = new GapDetectorService({ memory, llmRouter });
|
|
301
307
|
}
|
|
302
308
|
return this.gapService;
|
|
303
309
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This tool wraps the REAL defect-intelligence domain service.
|
|
7
7
|
* Uses actual code analysis, git history, and weighted feature prediction.
|
|
8
8
|
*/
|
|
9
|
-
import { MCPToolBase, getSharedMemoryBackend } from '../base';
|
|
9
|
+
import { MCPToolBase, getSharedMemoryBackend, getLLMRouter } from '../base';
|
|
10
10
|
import { DefectPredictorService } from '../../../domains/defect-intelligence/services/defect-predictor';
|
|
11
11
|
import { toErrorMessage } from '../../../shared/error-utils.js';
|
|
12
12
|
// ============================================================================
|
|
@@ -44,15 +44,10 @@ export class DefectPredictTool extends MCPToolBase {
|
|
|
44
44
|
*/
|
|
45
45
|
async getService(context) {
|
|
46
46
|
if (!this.predictorService) {
|
|
47
|
-
//
|
|
48
|
-
const memory = context.memory;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
// Use shared persistent memory backend
|
|
54
|
-
this.predictorService = new DefectPredictorService(await getSharedMemoryBackend());
|
|
55
|
-
}
|
|
47
|
+
// ADR-043 wiring.
|
|
48
|
+
const memory = context.memory ?? await getSharedMemoryBackend();
|
|
49
|
+
const llmRouter = await getLLMRouter(context);
|
|
50
|
+
this.predictorService = new DefectPredictorService({ memory, llmRouter });
|
|
56
51
|
}
|
|
57
52
|
return this.predictorService;
|
|
58
53
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - MetricsOptimizerService for strategy optimization
|
|
9
9
|
* - TransferSpecialistService for knowledge transfer
|
|
10
10
|
*/
|
|
11
|
-
import { MCPToolBase, getSharedMemoryBackend } from '../base.js';
|
|
11
|
+
import { MCPToolBase, getSharedMemoryBackend, getLLMRouter } from '../base.js';
|
|
12
12
|
import { TimeRange } from '../../../shared/value-objects/index.js';
|
|
13
13
|
import { LearningCoordinatorService } from '../../../domains/learning-optimization/services/learning-coordinator.js';
|
|
14
14
|
import { MetricsOptimizerService } from '../../../domains/learning-optimization/services/metrics-optimizer.js';
|
|
@@ -33,7 +33,9 @@ export class LearningOptimizeTool extends MCPToolBase {
|
|
|
33
33
|
async getServices(context) {
|
|
34
34
|
if (!this.learningCoordinator || !this.metricsOptimizer || !this.transferSpecialist) {
|
|
35
35
|
const memory = context.memory || await getSharedMemoryBackend();
|
|
36
|
-
|
|
36
|
+
// ADR-043 wiring.
|
|
37
|
+
const llmRouter = await getLLMRouter(context);
|
|
38
|
+
this.learningCoordinator = new LearningCoordinatorService({ memory, llmRouter });
|
|
37
39
|
this.metricsOptimizer = new MetricsOptimizerService(memory);
|
|
38
40
|
this.transferSpecialist = new TransferSpecialistService(memory);
|
|
39
41
|
}
|
|
@@ -166,7 +166,14 @@ export function registerAllQETools(registry) {
|
|
|
166
166
|
category: 'domain',
|
|
167
167
|
domain: tool.domain,
|
|
168
168
|
lazyLoad: false, // QE tools are always available
|
|
169
|
-
},
|
|
169
|
+
},
|
|
170
|
+
// ADR-043: forward the shared HybridRouter so the tool's
|
|
171
|
+
// MCPToolContext.llmRouter is populated explicitly.
|
|
172
|
+
async (params) => {
|
|
173
|
+
const { getSharedLLMRouter } = await import('./base.js');
|
|
174
|
+
const llmRouter = (await getSharedLLMRouter()) ?? undefined;
|
|
175
|
+
return tool.invoke(params, { llmRouter });
|
|
176
|
+
});
|
|
170
177
|
}
|
|
171
178
|
}
|
|
172
179
|
/**
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* This tool wraps the test-generation domain service and exposes it via MCP.
|
|
7
7
|
* Supports unit, integration, and e2e test generation with AI enhancement.
|
|
8
8
|
*/
|
|
9
|
-
import { MCPToolBase, getSharedMemoryBackend } from '../base';
|
|
10
|
-
import {
|
|
9
|
+
import { MCPToolBase, getSharedMemoryBackend, getLLMRouter } from '../base';
|
|
10
|
+
import { createTestGeneratorServiceWithDependencies } from '../../../domains/test-generation/services/test-generator';
|
|
11
11
|
import { TokenOptimizerService } from '../../../optimization/token-optimizer-service.js';
|
|
12
12
|
import { toErrorMessage } from '../../../shared/error-utils.js';
|
|
13
13
|
// ============================================================================
|
|
@@ -27,10 +27,13 @@ export class TestGenerateTool extends MCPToolBase {
|
|
|
27
27
|
* Initialize or get the test generator service with persistent storage
|
|
28
28
|
* Uses factory function for proper dependency injection
|
|
29
29
|
*/
|
|
30
|
-
async getService() {
|
|
30
|
+
async getService(context) {
|
|
31
31
|
if (!this.testGeneratorService) {
|
|
32
|
+
// ADR-043 wiring: dependencies factory accepts llmRouter so the
|
|
33
|
+
// ADR-051 LLM-enhanced generation branch is reachable in MCP mode.
|
|
32
34
|
const memory = await getSharedMemoryBackend();
|
|
33
|
-
|
|
35
|
+
const llmRouter = await getLLMRouter(context);
|
|
36
|
+
this.testGeneratorService = createTestGeneratorServiceWithDependencies({ memory, llmRouter }, {
|
|
34
37
|
defaultFramework: 'vitest',
|
|
35
38
|
maxTestsPerFile: 50,
|
|
36
39
|
coverageTargetDefault: 80,
|
|
@@ -71,8 +74,9 @@ export class TestGenerateTool extends MCPToolBase {
|
|
|
71
74
|
`saving ~${earlyExitResult.estimatedTokensSaved} tokens`);
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
|
-
// Get the domain service and call it with the request
|
|
75
|
-
|
|
77
|
+
// Get the domain service and call it with the request.
|
|
78
|
+
// Pass context so ADR-043 llmRouter reaches the service.
|
|
79
|
+
const service = await this.getService(context);
|
|
76
80
|
// Build the domain request from MCP params
|
|
77
81
|
const domainRequest = {
|
|
78
82
|
sourceFiles,
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* - VisualTesterService for screenshot capture and comparison
|
|
9
9
|
* - AccessibilityTesterService for WCAG compliance auditing
|
|
10
10
|
*/
|
|
11
|
-
import { MCPToolBase, getSharedMemoryBackend } from '../base';
|
|
12
|
-
import {
|
|
11
|
+
import { MCPToolBase, getSharedMemoryBackend, getLLMRouter } from '../base';
|
|
12
|
+
import { createVisualTesterServiceWithDependencies } from '../../../domains/visual-accessibility/services/visual-tester';
|
|
13
13
|
import { AccessibilityTesterService } from '../../../domains/visual-accessibility/services/accessibility-tester';
|
|
14
14
|
import { toErrorMessage } from '../../../shared/error-utils.js';
|
|
15
15
|
// ============================================================================
|
|
@@ -30,8 +30,11 @@ export class VisualCompareTool extends MCPToolBase {
|
|
|
30
30
|
*/
|
|
31
31
|
async getService(context) {
|
|
32
32
|
if (!this.visualTester) {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
// ADR-043 wiring: dependencies factory accepts llmRouter so the
|
|
34
|
+
// ADR-051 LLM-enhanced visual analysis branch is reachable in MCP mode.
|
|
35
|
+
const memory = context.memory ?? await getSharedMemoryBackend();
|
|
36
|
+
const llmRouter = await getLLMRouter(context);
|
|
37
|
+
this.visualTester = createVisualTesterServiceWithDependencies({ memory, llmRouter });
|
|
35
38
|
}
|
|
36
39
|
return this.visualTester;
|
|
37
40
|
}
|
|
@@ -43,6 +43,26 @@ export declare const JSON_RPC_ERRORS: {
|
|
|
43
43
|
readonly INTERNAL_ERROR: -32603;
|
|
44
44
|
readonly SERVER_ERROR: -32000;
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Error subclass that carries a JSON-RPC error `code` so it can be surfaced as a
|
|
48
|
+
* proper JSON-RPC error response (instead of being flattened to "[object Object]").
|
|
49
|
+
* Mirrors the OAuthProviderError pattern used in the security layer.
|
|
50
|
+
*/
|
|
51
|
+
export declare class McpError extends Error {
|
|
52
|
+
readonly code: number;
|
|
53
|
+
readonly data?: unknown | undefined;
|
|
54
|
+
constructor(code: number, message: string, data?: unknown | undefined);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Type guard for any thrown value that carries a JSON-RPC `code` + `message`.
|
|
58
|
+
* Accepts both the McpError subclass and legacy plain `{ code, message }` objects
|
|
59
|
+
* so existing throw sites continue to map to the right JSON-RPC error code.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isJsonRpcCodedError(err: unknown): err is {
|
|
62
|
+
code: number;
|
|
63
|
+
message: string;
|
|
64
|
+
data?: unknown;
|
|
65
|
+
};
|
|
46
66
|
export declare class StdioTransport {
|
|
47
67
|
private readonly inputStream;
|
|
48
68
|
private readonly outputStream;
|
|
@@ -16,6 +16,32 @@ export const JSON_RPC_ERRORS = {
|
|
|
16
16
|
INTERNAL_ERROR: -32603,
|
|
17
17
|
SERVER_ERROR: -32000,
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Error subclass that carries a JSON-RPC error `code` so it can be surfaced as a
|
|
21
|
+
* proper JSON-RPC error response (instead of being flattened to "[object Object]").
|
|
22
|
+
* Mirrors the OAuthProviderError pattern used in the security layer.
|
|
23
|
+
*/
|
|
24
|
+
export class McpError extends Error {
|
|
25
|
+
code;
|
|
26
|
+
data;
|
|
27
|
+
constructor(code, message, data) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.code = code;
|
|
30
|
+
this.data = data;
|
|
31
|
+
this.name = 'McpError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Type guard for any thrown value that carries a JSON-RPC `code` + `message`.
|
|
36
|
+
* Accepts both the McpError subclass and legacy plain `{ code, message }` objects
|
|
37
|
+
* so existing throw sites continue to map to the right JSON-RPC error code.
|
|
38
|
+
*/
|
|
39
|
+
export function isJsonRpcCodedError(err) {
|
|
40
|
+
return (typeof err === 'object' &&
|
|
41
|
+
err !== null &&
|
|
42
|
+
typeof err.code === 'number' &&
|
|
43
|
+
typeof err.message === 'string');
|
|
44
|
+
}
|
|
19
45
|
// ============================================================================
|
|
20
46
|
// Stdio Transport Implementation
|
|
21
47
|
// ============================================================================
|
|
@@ -205,8 +231,15 @@ export class StdioTransport {
|
|
|
205
231
|
});
|
|
206
232
|
}
|
|
207
233
|
catch (err) {
|
|
208
|
-
|
|
209
|
-
|
|
234
|
+
// Honor a JSON-RPC `code` carried by the thrown value (McpError or a legacy
|
|
235
|
+
// plain `{ code, message }` object); otherwise fall back to INTERNAL_ERROR.
|
|
236
|
+
if (isJsonRpcCodedError(err)) {
|
|
237
|
+
await this.sendError(request.id, err.code, err.message, err.data);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
const error = err;
|
|
241
|
+
await this.sendError(request.id, JSON_RPC_ERRORS.INTERNAL_ERROR, error.message || 'Internal error');
|
|
242
|
+
}
|
|
210
243
|
}
|
|
211
244
|
}
|
|
212
245
|
async handleNotification(notification) {
|