@mastra/server 1.79.0-alpha.9 → 1.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{a2a-CHBSYHxu.js → a2a-BqLB3McP.js} +17 -16
- package/dist/a2a-BqLB3McP.js.map +1 -0
- package/dist/{a2a-B465DD1u.cjs → a2a-Uood_0DN.cjs} +19 -18
- package/dist/a2a-Uood_0DN.cjs.map +1 -0
- package/dist/agent-builder-CuBD1tpv.cjs +728 -0
- package/dist/agent-builder-CuBD1tpv.cjs.map +1 -0
- package/dist/agent-builder-VhM8ADW-.js +627 -0
- package/dist/agent-builder-VhM8ADW-.js.map +1 -0
- package/dist/{agents-X1E7fW3p.js → agents-BHLTMBff.js} +2 -2
- package/dist/{agents-X1E7fW3p.js.map → agents-BHLTMBff.js.map} +1 -1
- package/dist/agents-BOWEUKyV.cjs +3127 -0
- package/dist/agents-BOWEUKyV.cjs.map +1 -0
- package/dist/agents-DRQ3ScbX.js +2828 -0
- package/dist/agents-DRQ3ScbX.js.map +1 -0
- package/dist/{agents-DoNMSCMt.cjs → agents-T-OIM9IK.cjs} +2 -2
- package/dist/{agents-DoNMSCMt.cjs.map → agents-T-OIM9IK.cjs.map} +1 -1
- package/dist/{api-schema-manifest-CWRIJP-B.js → api-schema-manifest-CI90M4sX.js} +3 -3
- package/dist/{api-schema-manifest-CWRIJP-B.js.map → api-schema-manifest-CI90M4sX.js.map} +1 -1
- package/dist/{api-schema-manifest-DUseI2VG.cjs → api-schema-manifest-DIlNfbyw.cjs} +4 -4
- package/dist/{api-schema-manifest-DUseI2VG.cjs.map → api-schema-manifest-DIlNfbyw.cjs.map} +1 -1
- package/dist/{background-tasks-CabImVak.cjs → background-tasks-B3VAKTJh.cjs} +3 -3
- package/dist/{background-tasks-CabImVak.cjs.map → background-tasks-B3VAKTJh.cjs.map} +1 -1
- package/dist/{background-tasks-oBaLtnCn.js → background-tasks-Du2zYOPl.js} +2 -2
- package/dist/{background-tasks-oBaLtnCn.js.map → background-tasks-Du2zYOPl.js.map} +1 -1
- package/dist/{builder-registry-DOkLe8ES.js → builder-registry-DLdu9bWH.js} +3 -3
- package/dist/{builder-registry-DOkLe8ES.js.map → builder-registry-DLdu9bWH.js.map} +1 -1
- package/dist/{builder-registry-D0frV8lQ.cjs → builder-registry-DaFAaMTf.cjs} +3 -3
- package/dist/{builder-registry-D0frV8lQ.cjs.map → builder-registry-DaFAaMTf.cjs.map} +1 -1
- package/dist/{channels-CBIopVWd.cjs → channels-BnVRmnzK.cjs} +6 -3
- package/dist/{channels-CBIopVWd.cjs.map → channels-BnVRmnzK.cjs.map} +1 -1
- package/dist/{channels-BOxgHvzI.js → channels-Db-4pXVZ.js} +6 -3
- package/dist/{channels-BOxgHvzI.js.map → channels-Db-4pXVZ.js.map} +1 -1
- package/dist/conversations-8BWryNlF.js +165 -0
- package/dist/conversations-8BWryNlF.js.map +1 -0
- package/dist/conversations-C5MkQBB8.cjs +194 -0
- package/dist/conversations-C5MkQBB8.cjs.map +1 -0
- package/dist/{conversations-Bj5TLNqF.cjs → conversations-DasqEDCF.cjs} +3 -3
- package/dist/{conversations-Bj5TLNqF.cjs.map → conversations-DasqEDCF.cjs.map} +1 -1
- package/dist/{dist-9c3PXXpk.cjs → dist-B-bEVWlJ.cjs} +4733 -1251
- package/dist/dist-B-bEVWlJ.cjs.map +1 -0
- package/dist/dist-B3kC8Yd0.cjs +3 -0
- package/dist/{dist-CQ3FSKT-.cjs → dist-B9ery9Zw.cjs} +38 -35
- package/dist/{dist-CQ3FSKT-.cjs.map → dist-B9ery9Zw.cjs.map} +1 -1
- package/dist/{dist-BxMmGD3n.js → dist-BBOnrL_A.js} +10 -12
- package/dist/{dist-BxMmGD3n.js.map → dist-BBOnrL_A.js.map} +1 -1
- package/dist/{dist-DOWsEmo6.js → dist-BIrQLUV9.js} +20 -20
- package/dist/{dist-DOWsEmo6.js.map → dist-BIrQLUV9.js.map} +1 -1
- package/dist/dist-BM9J-PTK.js +1 -0
- package/dist/{dist-DC1Pewf5.cjs → dist-Bo3GdQwf.cjs} +21 -21
- package/dist/{dist-DC1Pewf5.cjs.map → dist-Bo3GdQwf.cjs.map} +1 -1
- package/dist/{dist-BwYL7Ykb.js → dist-CREG82cy.js} +37 -34
- package/dist/{dist-BwYL7Ykb.js.map → dist-CREG82cy.js.map} +1 -1
- package/dist/{dist-rDRetJVY.cjs → dist-CeTLA-e5.cjs} +2 -3
- package/dist/{dist-rDRetJVY.cjs.map → dist-CeTLA-e5.cjs.map} +1 -1
- package/dist/{dist-CBRJax5e.js → dist-DLld1qjf.js} +25 -31
- package/dist/{dist-CBRJax5e.js.map → dist-DLld1qjf.js.map} +1 -1
- package/dist/{dist-B_bet8uz.js → dist-DjkPkAzV.js} +2 -3
- package/dist/{dist-B_bet8uz.js.map → dist-DjkPkAzV.js.map} +1 -1
- package/dist/{dist-UKEksCGq.cjs → dist-DsrJXwic.cjs} +11 -13
- package/dist/{dist-UKEksCGq.cjs.map → dist-DsrJXwic.cjs.map} +1 -1
- package/dist/{dist-DGCnbhNe.js → dist-k77XQGUn.js} +4493 -1043
- package/dist/dist-k77XQGUn.js.map +1 -0
- package/dist/{dist-3FPW9nVj.cjs → dist-lT2rqyY9.cjs} +26 -32
- package/dist/{dist-3FPW9nVj.cjs.map → dist-lT2rqyY9.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-server-routes.md +159 -0
- package/dist/{dynamic-workflows-Rr_6ac1y.js → dynamic-workflows-CTUO0SFu.js} +3 -3
- package/dist/{dynamic-workflows-Rr_6ac1y.js.map → dynamic-workflows-CTUO0SFu.js.map} +1 -1
- package/dist/{dynamic-workflows-DXlkr-jK.cjs → dynamic-workflows-HwPX3mcf.cjs} +3 -3
- package/dist/{dynamic-workflows-DXlkr-jK.cjs.map → dynamic-workflows-HwPX3mcf.cjs.map} +1 -1
- package/dist/{editor-builder-BclcHxN6.cjs → editor-builder-BDtiWw0f.cjs} +2 -2
- package/dist/{editor-builder-BclcHxN6.cjs.map → editor-builder-BDtiWw0f.cjs.map} +1 -1
- package/dist/{editor-builder-D16kc1P6.js → editor-builder-ClFlGXoX.js} +4 -4
- package/dist/{editor-builder-D16kc1P6.js.map → editor-builder-ClFlGXoX.js.map} +1 -1
- package/dist/{editor-builder-s9WqPJgA.js → editor-builder-DnLCfqnY.js} +2 -2
- package/dist/{editor-builder-s9WqPJgA.js.map → editor-builder-DnLCfqnY.js.map} +1 -1
- package/dist/{editor-builder-DXHiPX1A.cjs → editor-builder-DtpP1FtW.cjs} +5 -5
- package/dist/{editor-builder-DXHiPX1A.cjs.map → editor-builder-DtpP1FtW.cjs.map} +1 -1
- package/dist/{helpers-ElhPeCSK.cjs → helpers-CAcEhq38.cjs} +21 -17
- package/dist/{helpers-ElhPeCSK.cjs.map → helpers-CAcEhq38.cjs.map} +1 -1
- package/dist/{helpers-DLhX1fqc.js → helpers-vrqddDd5.js} +21 -17
- package/dist/{helpers-DLhX1fqc.js.map → helpers-vrqddDd5.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/logs-CiSw7r0s.cjs +119 -0
- package/dist/logs-CiSw7r0s.cjs.map +1 -0
- package/dist/logs-CxfPk-iL.js +96 -0
- package/dist/logs-CxfPk-iL.js.map +1 -0
- package/dist/mcp-CWDfSu7w.js +474 -0
- package/dist/mcp-CWDfSu7w.js.map +1 -0
- package/dist/mcp-CWGJRqkC.cjs +563 -0
- package/dist/mcp-CWGJRqkC.cjs.map +1 -0
- package/dist/{mcp-DzpwLXEY.js → mcp-Drqt0GqD.js} +79 -4
- package/dist/mcp-Drqt0GqD.js.map +1 -0
- package/dist/{mcp-ShaKO7gA.cjs → mcp-ziWVk7Ol.cjs} +126 -3
- package/dist/mcp-ziWVk7Ol.cjs.map +1 -0
- package/dist/memory-BHtTSzvJ.js +1739 -0
- package/dist/memory-BHtTSzvJ.js.map +1 -0
- package/dist/memory-CwwkVDh1.cjs +1906 -0
- package/dist/memory-CwwkVDh1.cjs.map +1 -0
- package/dist/observability-BBMCMeT-.cjs +502 -0
- package/dist/observability-BBMCMeT-.cjs.map +1 -0
- package/dist/observability-ZRgRcvoX.js +431 -0
- package/dist/observability-ZRgRcvoX.js.map +1 -0
- package/dist/{observability-new-endpoints-BU8JYPfh.js → observability-new-endpoints-fjoZzEtk.js} +10 -9
- package/dist/{observability-new-endpoints-BU8JYPfh.js.map → observability-new-endpoints-fjoZzEtk.js.map} +1 -1
- package/dist/{observability-new-endpoints-AMp9bnMV.cjs → observability-new-endpoints-tG3-odLa.cjs} +11 -10
- package/dist/observability-new-endpoints-tG3-odLa.cjs.map +1 -0
- package/dist/plans-CiPgWBhO.cjs +68 -0
- package/dist/plans-CiPgWBhO.cjs.map +1 -0
- package/dist/plans-DCepEY7n.js +57 -0
- package/dist/plans-DCepEY7n.js.map +1 -0
- package/dist/{probe-image-size-DBGjhUtJ.cjs → probe-image-size-Alv3gwKl.cjs} +194 -184
- package/dist/probe-image-size-Alv3gwKl.cjs.map +1 -0
- package/dist/{probe-image-size-Dmoxv93t.js → probe-image-size-BdfbUHxx.js} +158 -148
- package/dist/probe-image-size-BdfbUHxx.js.map +1 -0
- package/dist/responses-4FwMNxoJ.js +628 -0
- package/dist/responses-4FwMNxoJ.js.map +1 -0
- package/dist/responses-CCRijwDF.cjs +651 -0
- package/dist/responses-CCRijwDF.cjs.map +1 -0
- package/dist/{responses-CKNdSRkS.cjs → responses-CfcIc53b.cjs} +2 -2
- package/dist/{responses-CKNdSRkS.cjs.map → responses-CfcIc53b.cjs.map} +1 -1
- package/dist/{rolldown-runtime-Bd6kNlEP.cjs → rolldown-runtime-BwC_XMyb.cjs} +2 -2
- package/dist/{rolldown-runtime-maW3aOIk.js → rolldown-runtime-D3Hj5m0v.js} +2 -2
- package/dist/{route-builder-BNZs643f.cjs → route-builder-B2Qhhd7C.cjs} +52 -66
- package/dist/route-builder-B2Qhhd7C.cjs.map +1 -0
- package/dist/{route-builder-BfQYtclb.js → route-builder-CjkWxv4E.js} +51 -65
- package/dist/route-builder-CjkWxv4E.js.map +1 -0
- package/dist/{routes-rwufkyUe.js → routes-BC20mdNN.js} +30 -26
- package/dist/routes-BC20mdNN.js.map +1 -0
- package/dist/{routes-Dl6_kWm7.js → routes-CKfXiwRc.js} +5 -3
- package/dist/routes-CKfXiwRc.js.map +1 -0
- package/dist/{routes-DPojsNf1.cjs → routes-DGLJyqjD.cjs} +203 -199
- package/dist/routes-DGLJyqjD.cjs.map +1 -0
- package/dist/{routes-BULZI-PU.cjs → routes-jXksmX9G.cjs} +5 -3
- package/dist/routes-jXksmX9G.cjs.map +1 -0
- package/dist/{schedules-Bj-giFbc.cjs → schedules-GokZKBYg.cjs} +6 -4
- package/dist/schedules-GokZKBYg.cjs.map +1 -0
- package/dist/{schedules-BQYgaz66.js → schedules-_3zPKyqm.js} +5 -3
- package/dist/schedules-_3zPKyqm.js.map +1 -0
- package/dist/{schema-e0VHpMt0-C0452jOk.cjs → schema-CzbEIyhE-20gGIWkz.cjs} +83 -88
- package/dist/schema-CzbEIyhE-20gGIWkz.cjs.map +1 -0
- package/dist/{schema-e0VHpMt0-CVP5Hnxy.js → schema-CzbEIyhE-BsMcj9Ws.js} +82 -87
- package/dist/schema-CzbEIyhE-BsMcj9Ws.js.map +1 -0
- package/dist/scores-D9UgETt_.js +288 -0
- package/dist/scores-D9UgETt_.js.map +1 -0
- package/dist/scores-DRdtS7NT.cjs +329 -0
- package/dist/scores-DRdtS7NT.cjs.map +1 -0
- package/dist/server/a2a/store.cjs +1 -1
- package/dist/server/auth/index.cjs +2 -2
- package/dist/server/auth/index.js +1 -1
- package/dist/server/browser-stream/index.cjs +9 -11
- package/dist/server/browser-stream/index.cjs.map +1 -1
- package/dist/server/browser-stream/index.js +8 -10
- package/dist/server/browser-stream/index.js.map +1 -1
- package/dist/server/handlers/a2a.cjs +2 -2
- package/dist/server/handlers/a2a.js +1 -2
- package/dist/server/handlers/agent-builder.cjs +18 -648
- package/dist/server/handlers/agent-builder.js +1 -627
- package/dist/server/handlers/agent-controller.cjs +5 -5
- package/dist/server/handlers/agent-controller.cjs.map +1 -1
- package/dist/server/handlers/agent-controller.js +11 -9
- package/dist/server/handlers/agent-controller.js.map +1 -1
- package/dist/server/handlers/agent-versions.cjs +15 -8
- package/dist/server/handlers/agent-versions.cjs.map +1 -1
- package/dist/server/handlers/agent-versions.js +14 -7
- package/dist/server/handlers/agent-versions.js.map +1 -1
- package/dist/server/handlers/agents.cjs +51 -2860
- package/dist/server/handlers/agents.js +1 -2806
- package/dist/server/handlers/auth.cjs +14 -12
- package/dist/server/handlers/auth.cjs.map +1 -1
- package/dist/server/handlers/auth.js +20 -16
- package/dist/server/handlers/auth.js.map +1 -1
- package/dist/server/handlers/author-enrichment.cjs +1 -1
- package/dist/server/handlers/authorship.cjs +1 -1
- package/dist/server/handlers/authorship.cjs.map +1 -1
- package/dist/server/handlers/background-tasks.cjs +2 -2
- package/dist/server/handlers/background-tasks.js +1 -2
- package/dist/server/handlers/builder-registry.cjs +2 -2
- package/dist/server/handlers/builder-registry.js +1 -2
- package/dist/server/handlers/channels.cjs +2 -2
- package/dist/server/handlers/channels.js +1 -2
- package/dist/server/handlers/conversations.cjs +6 -171
- package/dist/server/handlers/conversations.js +1 -162
- package/dist/server/handlers/datasets.cjs +2 -2
- package/dist/server/handlers/datasets.cjs.map +1 -1
- package/dist/server/handlers/datasets.js +1 -1
- package/dist/server/handlers/dynamic-workflows.cjs +2 -2
- package/dist/server/handlers/dynamic-workflows.js +1 -2
- package/dist/server/handlers/editor-builder.cjs +2 -2
- package/dist/server/handlers/editor-builder.js +1 -2
- package/dist/server/handlers/error.cjs +18 -13
- package/dist/server/handlers/error.cjs.map +1 -1
- package/dist/server/handlers/error.js +17 -12
- package/dist/server/handlers/error.js.map +1 -1
- package/dist/server/handlers/favorites-enrichment.cjs +2 -2
- package/dist/server/handlers/favorites-enrichment.js +1 -1
- package/dist/server/handlers/gateway-memory-client.cjs +1 -1
- package/dist/server/handlers/logs.cjs +5 -104
- package/dist/server/handlers/logs.js +1 -96
- package/dist/server/handlers/mcp-client-versions.cjs +15 -8
- package/dist/server/handlers/mcp-client-versions.cjs.map +1 -1
- package/dist/server/handlers/mcp-client-versions.js +14 -7
- package/dist/server/handlers/mcp-client-versions.js.map +1 -1
- package/dist/server/handlers/mcp.cjs +16 -289
- package/dist/server/handlers/mcp.d.ts +219 -0
- package/dist/server/handlers/mcp.d.ts.map +1 -1
- package/dist/server/handlers/mcp.js +1 -274
- package/dist/server/handlers/memory.cjs +29 -1763
- package/dist/server/handlers/memory.js +1 -1731
- package/dist/server/handlers/observability-list-query-schemas.cjs +1 -1
- package/dist/server/handlers/observability-new-endpoints.cjs +2 -2
- package/dist/server/handlers/observability-new-endpoints.js +1 -2
- package/dist/server/handlers/observability-shared.cjs +2 -2
- package/dist/server/handlers/observability-shared.js +1 -1
- package/dist/server/handlers/observability-storage-schemas.cjs +1 -1
- package/dist/server/handlers/observability.cjs +14 -445
- package/dist/server/handlers/observability.js +3 -429
- package/dist/server/handlers/plans.cjs +3 -63
- package/dist/server/handlers/plans.js +1 -57
- package/dist/server/handlers/processor-providers.cjs +2 -2
- package/dist/server/handlers/processor-providers.cjs.map +1 -1
- package/dist/server/handlers/processor-providers.js +1 -1
- package/dist/server/handlers/processors.cjs +13 -15
- package/dist/server/handlers/processors.cjs.map +1 -1
- package/dist/server/handlers/processors.js +12 -14
- package/dist/server/handlers/processors.js.map +1 -1
- package/dist/server/handlers/prompt-block-versions.cjs +15 -8
- package/dist/server/handlers/prompt-block-versions.cjs.map +1 -1
- package/dist/server/handlers/prompt-block-versions.js +14 -7
- package/dist/server/handlers/prompt-block-versions.js.map +1 -1
- package/dist/server/handlers/responses.adapter.cjs +1 -1
- package/dist/server/handlers/responses.adapter.cjs.map +1 -1
- package/dist/server/handlers/responses.cjs +5 -632
- package/dist/server/handlers/responses.js +1 -624
- package/dist/server/handlers/responses.storage.cjs +2 -2
- package/dist/server/handlers/schedules-workflows-shim.cjs +1 -1
- package/dist/server/handlers/schedules.cjs +2 -2
- package/dist/server/handlers/schedules.d.ts +16 -0
- package/dist/server/handlers/schedules.d.ts.map +1 -1
- package/dist/server/handlers/schedules.js +1 -2
- package/dist/server/handlers/scorer-versions.cjs +15 -8
- package/dist/server/handlers/scorer-versions.cjs.map +1 -1
- package/dist/server/handlers/scorer-versions.js +14 -7
- package/dist/server/handlers/scorer-versions.js.map +1 -1
- package/dist/server/handlers/scores.cjs +8 -299
- package/dist/server/handlers/scores.js +1 -288
- package/dist/server/handlers/skills-sh-shared.cjs +1 -1
- package/dist/server/handlers/stored-agent-favorites.cjs +4 -4
- package/dist/server/handlers/stored-agent-favorites.js +3 -3
- package/dist/server/handlers/stored-agents.cjs +19 -13
- package/dist/server/handlers/stored-agents.cjs.map +1 -1
- package/dist/server/handlers/stored-agents.js +18 -12
- package/dist/server/handlers/stored-agents.js.map +1 -1
- package/dist/server/handlers/stored-mcp-clients.cjs +8 -6
- package/dist/server/handlers/stored-mcp-clients.cjs.map +1 -1
- package/dist/server/handlers/stored-mcp-clients.js +7 -5
- package/dist/server/handlers/stored-mcp-clients.js.map +1 -1
- package/dist/server/handlers/stored-prompt-blocks.cjs +3 -3
- package/dist/server/handlers/stored-prompt-blocks.js +2 -2
- package/dist/server/handlers/stored-scorers.cjs +3 -3
- package/dist/server/handlers/stored-scorers.js +2 -2
- package/dist/server/handlers/stored-skill-favorites.cjs +4 -4
- package/dist/server/handlers/stored-skill-favorites.js +3 -3
- package/dist/server/handlers/stored-skills.cjs +6 -5
- package/dist/server/handlers/stored-skills.cjs.map +1 -1
- package/dist/server/handlers/stored-skills.js +5 -4
- package/dist/server/handlers/stored-skills.js.map +1 -1
- package/dist/server/handlers/stored-workspaces.cjs +3 -3
- package/dist/server/handlers/stored-workspaces.js +2 -2
- package/dist/server/handlers/system.cjs +3 -3
- package/dist/server/handlers/system.cjs.map +1 -1
- package/dist/server/handlers/system.js +2 -2
- package/dist/server/handlers/test-utils.cjs +1 -1
- package/dist/server/handlers/tool-providers.cjs +2 -2
- package/dist/server/handlers/tool-providers.js +1 -1
- package/dist/server/handlers/tool-schema-overrides.cjs +1 -1
- package/dist/server/handlers/tools.cjs +7 -267
- package/dist/server/handlers/tools.js +1 -257
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -2
- package/dist/server/handlers/validate-agent-instructions.cjs +2 -2
- package/dist/server/handlers/validate-agent-instructions.js +1 -1
- package/dist/server/handlers/validate-avatar.cjs +2 -2
- package/dist/server/handlers/validate-avatar.cjs.map +1 -1
- package/dist/server/handlers/validate-avatar.js +1 -1
- package/dist/server/handlers/validate-avatar.js.map +1 -1
- package/dist/server/handlers/vector.cjs +17 -334
- package/dist/server/handlers/vector.js +1 -314
- package/dist/server/handlers/version-helpers.cjs +1 -1
- package/dist/server/handlers/voice.cjs +9 -35
- package/dist/server/handlers/voice.js +1 -23
- package/dist/server/handlers/workflow-builder.cjs +2 -2
- package/dist/server/handlers/workflow-builder.js +1 -2
- package/dist/server/handlers/workflows.cjs +30 -1293
- package/dist/server/handlers/workflows.js +1 -1257
- package/dist/server/handlers/workspace.cjs +27 -1176
- package/dist/server/handlers/workspace.js +1 -1146
- package/dist/server/handlers.cjs +33 -33
- package/dist/server/handlers.js +17 -17
- package/dist/server/schemas/index.cjs +7 -7
- package/dist/server/schemas/index.js +4 -4
- package/dist/server/schemas/mcp.d.ts +102 -0
- package/dist/server/schemas/mcp.d.ts.map +1 -1
- package/dist/server/schemas/schedules.d.ts +5 -0
- package/dist/server/schemas/schedules.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +5 -5
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.js +4 -4
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/mcp.d.ts +214 -0
- package/dist/server/server-adapter/routes/mcp.d.ts.map +1 -1
- package/dist/tools-CmFSfDMn.js +256 -0
- package/dist/tools-CmFSfDMn.js.map +1 -0
- package/dist/tools-SPJtxG9N.cjs +291 -0
- package/dist/tools-SPJtxG9N.cjs.map +1 -0
- package/dist/{utils-DCgeTrq2.cjs → utils-CF76qzZR.cjs} +12 -17
- package/dist/{utils-DCgeTrq2.cjs.map → utils-CF76qzZR.cjs.map} +1 -1
- package/dist/{utils-DCAUeb6M.js → utils-aoLN3Wfi.js} +11 -16
- package/dist/{utils-DCAUeb6M.js.map → utils-aoLN3Wfi.js.map} +1 -1
- package/dist/{utils-Du-EpvDs.cjs → utils-dDLIDg8O.cjs} +2 -2
- package/dist/{utils-Du-EpvDs.cjs.map → utils-dDLIDg8O.cjs.map} +1 -1
- package/dist/vector-BKDD1kwc.cjs +409 -0
- package/dist/vector-BKDD1kwc.cjs.map +1 -0
- package/dist/vector-TWv4t-4g.js +314 -0
- package/dist/vector-TWv4t-4g.js.map +1 -0
- package/dist/voice-BnGwlZ75.cjs +70 -0
- package/dist/voice-BnGwlZ75.cjs.map +1 -0
- package/dist/voice-DjG8tBAD.js +23 -0
- package/dist/voice-DjG8tBAD.js.map +1 -0
- package/dist/{workflow-builder-Brj3IArM.cjs → workflow-builder-C9-8ZOWF.cjs} +5 -5
- package/dist/{workflow-builder-Brj3IArM.cjs.map → workflow-builder-C9-8ZOWF.cjs.map} +1 -1
- package/dist/{workflow-builder-DOa1Vx6w.js → workflow-builder-CjlLoQvo.js} +10 -8
- package/dist/{workflow-builder-DOa1Vx6w.js.map → workflow-builder-CjlLoQvo.js.map} +1 -1
- package/dist/workflows-DjqeJcdJ.cjs +1446 -0
- package/dist/workflows-DjqeJcdJ.cjs.map +1 -0
- package/dist/workflows-bb-otd2o.js +1273 -0
- package/dist/workflows-bb-otd2o.js.map +1 -0
- package/dist/workspace-B6kzp-bo.js +1154 -0
- package/dist/workspace-B6kzp-bo.js.map +1 -0
- package/dist/workspace-COKR1SxH.cjs +1309 -0
- package/dist/workspace-COKR1SxH.cjs.map +1 -0
- package/package.json +9 -9
- package/dist/a2a-B465DD1u.cjs.map +0 -1
- package/dist/a2a-CHBSYHxu.js.map +0 -1
- package/dist/dist-9c3PXXpk.cjs.map +0 -1
- package/dist/dist-B5OwHWTo.cjs +0 -2294
- package/dist/dist-B5OwHWTo.cjs.map +0 -1
- package/dist/dist-DGCnbhNe.js.map +0 -1
- package/dist/dist-DcoIg_tp.js +0 -2293
- package/dist/dist-DcoIg_tp.js.map +0 -1
- package/dist/mcp-DzpwLXEY.js.map +0 -1
- package/dist/mcp-ShaKO7gA.cjs.map +0 -1
- package/dist/observability-new-endpoints-AMp9bnMV.cjs.map +0 -1
- package/dist/probe-image-size-DBGjhUtJ.cjs.map +0 -1
- package/dist/probe-image-size-Dmoxv93t.js.map +0 -1
- package/dist/route-builder-BNZs643f.cjs.map +0 -1
- package/dist/route-builder-BfQYtclb.js.map +0 -1
- package/dist/routes-BULZI-PU.cjs.map +0 -1
- package/dist/routes-DPojsNf1.cjs.map +0 -1
- package/dist/routes-Dl6_kWm7.js.map +0 -1
- package/dist/routes-rwufkyUe.js.map +0 -1
- package/dist/schedules-BQYgaz66.js.map +0 -1
- package/dist/schedules-Bj-giFbc.cjs.map +0 -1
- package/dist/schema-Drf2W04o.js +0 -2
- package/dist/schema-EQanefYq.cjs +0 -1
- package/dist/schema-e0VHpMt0-C0452jOk.cjs.map +0 -1
- package/dist/schema-e0VHpMt0-CVP5Hnxy.js.map +0 -1
- package/dist/server/handlers/agent-builder.cjs.map +0 -1
- package/dist/server/handlers/agent-builder.js.map +0 -1
- package/dist/server/handlers/agents.cjs.map +0 -1
- package/dist/server/handlers/agents.js.map +0 -1
- package/dist/server/handlers/conversations.cjs.map +0 -1
- package/dist/server/handlers/conversations.js.map +0 -1
- package/dist/server/handlers/logs.cjs.map +0 -1
- package/dist/server/handlers/logs.js.map +0 -1
- package/dist/server/handlers/mcp.cjs.map +0 -1
- package/dist/server/handlers/mcp.js.map +0 -1
- package/dist/server/handlers/memory.cjs.map +0 -1
- package/dist/server/handlers/memory.js.map +0 -1
- package/dist/server/handlers/observability.cjs.map +0 -1
- package/dist/server/handlers/observability.js.map +0 -1
- package/dist/server/handlers/plans.cjs.map +0 -1
- package/dist/server/handlers/plans.js.map +0 -1
- package/dist/server/handlers/responses.cjs.map +0 -1
- package/dist/server/handlers/responses.js.map +0 -1
- package/dist/server/handlers/scores.cjs.map +0 -1
- package/dist/server/handlers/scores.js.map +0 -1
- package/dist/server/handlers/tools.cjs.map +0 -1
- package/dist/server/handlers/tools.js.map +0 -1
- package/dist/server/handlers/vector.cjs.map +0 -1
- package/dist/server/handlers/vector.js.map +0 -1
- package/dist/server/handlers/voice.cjs.map +0 -1
- package/dist/server/handlers/voice.js.map +0 -1
- package/dist/server/handlers/workflows.cjs.map +0 -1
- package/dist/server/handlers/workflows.js.map +0 -1
- package/dist/server/handlers/workspace.cjs.map +0 -1
- package/dist/server/handlers/workspace.js.map +0 -1
- package/dist/sync-Ai_ZDz7U.js +0 -1700
- package/dist/sync-Ai_ZDz7U.js.map +0 -1
- package/dist/sync-BrO5MtSe.cjs +0 -1729
- package/dist/sync-BrO5MtSe.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.cjs","names":["HTTPException"],"sources":["../../../src/server/handlers/error.ts"],"sourcesContent":["import type { ZodError } from 'zod';\n\nimport { HTTPException } from '../http-exception';\nimport type { StatusCode } from '../http-exception';\nimport type { ApiError } from '../types';\n\n/**\n * Duck-typed interface for ZodError-like objects.\n * Note: Zod v4 uses PropertyKey[] (string | number | symbol) for path.\n */\nexport interface ZodErrorLike {\n issues: Array<{\n path: PropertyKey[];\n message: string;\n }>;\n}\n\n/**\n * Recognition for `ModelNotAllowedError` from `@mastra/core/agent-builder/ee`.\n *\n * Inlined as a duck check rather than imported so that `handleError` (wired\n * into every route) does not force a load-time dependency on the\n * `@mastra/core/agent-builder/ee` subpath. That subpath only ships in\n * `@mastra/core >= 1.34.0`; deploys whose bundled `@mastra/server` resolves\n * against an older core would otherwise crash at startup with\n * `ERR_MODULE_NOT_FOUND` on `@mastra/core/dist/agent-builder/ee/index.js`.\n */\nconst MODEL_NOT_ALLOWED_CODE = 'MODEL_NOT_ALLOWED';\n\ninterface ModelNotAllowedErrorLike extends Error {\n code: typeof MODEL_NOT_ALLOWED_CODE;\n allowed?: unknown;\n attempted?: unknown;\n offendingLabel?: string;\n}\n\nfunction isModelNotAllowedError(error: unknown): error is ModelNotAllowedErrorLike {\n return error instanceof Error && (error as { code?: unknown }).code === MODEL_NOT_ALLOWED_CODE;\n}\n\nconst WORKFLOW_SCHEMA_VALIDATION_FAILED_CODE = 'WORKFLOW_SCHEMA_VALIDATION_FAILED';\n\nfunction isWorkflowSchemaValidationError(error: unknown): error is Error {\n return error instanceof Error && (error as { id?: unknown }).id === WORKFLOW_SCHEMA_VALIDATION_FAILED_CODE;\n}\n\n// A resume or time travel the run can't accept: another caller claimed it, it is still running,\n// or it isn't waiting to be resumed.\nconst RUN_CLAIM_CONFLICT_CODES = new Set([\n 'WORKFLOW_RESUME_ALREADY_CLAIMED',\n 'AGENT_RESUME_ALREADY_CLAIMED',\n 'WORKFLOW_RUN_NOT_SUSPENDED',\n 'AGENT_RESUME_RUN_NOT_SUSPENDED',\n 'WORKFLOW_TIME_TRAVEL_ALREADY_CLAIMED',\n 'WORKFLOW_TIME_TRAVEL_RUN_RUNNING',\n]);\n\nfunction isRunClaimConflictError(error: unknown): error is Error & { id: string } {\n return error instanceof Error && RUN_CLAIM_CONFLICT_CODES.has((error as { id?: unknown }).id as string);\n}\n\n/**\n * Durable agent errors for a request that conflicts with the run's state:\n * another execution owns the run, it is already being recovered, it lost a\n * concurrent claim, or it is suspended (recover). Matched by id, like the\n * other checks here, so the server doesn't depend on core exporting them.\n */\nconst DURABLE_RUN_CONFLICT_CODES = new Set([\n 'DURABLE_AGENT_RUN_ACTIVE',\n 'DURABLE_AGENT_RECOVER_RUN_ACTIVE_LOCALLY',\n 'DURABLE_AGENT_RECOVER_ALREADY_IN_PROGRESS',\n 'DURABLE_AGENT_RECOVER_RUN_SUSPENDED',\n 'DURABLE_AGENT_EXECUTION_CONFLICT',\n]);\n\nfunction isDurableRunConflictError(error: unknown): error is Error {\n const id = (error as { id?: unknown } | undefined)?.id;\n return error instanceof Error && typeof id === 'string' && DURABLE_RUN_CONFLICT_CODES.has(id);\n}\n\nconst FEEDBACK_REVIEW_STATUS_CONFLICT_CODE = 'OBSERVABILITY_UPDATE_FEEDBACK_REVIEW_STATUS_CONFLICT';\n\nfunction isFeedbackReviewStatusConflictError(error: unknown): error is Error {\n return error instanceof Error && (error as { id?: unknown }).id === FEEDBACK_REVIEW_STATUS_CONFLICT_CODE;\n}\n\n/**\n * Matches the `OBSERVABILITY_STORAGE_*_NOT_IMPLEMENTED` MastraError the base\n * observability store throws for every optional method a store doesn't\n * implement. Checked by id (not `instanceof`) so it holds across duplicated\n * `@mastra/core` installs.\n */\nfunction isObservabilityStorageNotImplementedError(error: unknown): error is Error {\n const id = error && typeof error === 'object' && 'id' in error ? error.id : undefined;\n return typeof id === 'string' && id.startsWith('OBSERVABILITY_STORAGE_') && id.endsWith('_NOT_IMPLEMENTED');\n}\n\n/**\n * Structural check for ZodError instances.\n *\n * Avoids `instanceof ZodError` because consumers can resolve `'zod'` to a\n * different package instance (e.g. `zod@^3`) than the one a server adapter is\n * bundled with (`zod@^4`). In that case `instanceof` is false and validation\n * errors fall through to a generic response that drops field-path information.\n *\n * See https://github.com/mastra-ai/mastra/issues/17167.\n */\nexport function isZodError(error: unknown): error is ZodError<any> {\n return (\n !!error &&\n typeof error === 'object' &&\n (error as { name?: unknown }).name === 'ZodError' &&\n Array.isArray((error as { issues?: unknown }).issues)\n );\n}\n\n/**\n * Formats a ZodError into a structured validation error response.\n * Returns an object with an error message and an array of field-specific issues.\n */\nexport function formatZodError(\n error: ZodErrorLike,\n context: string,\n): { error: string; issues: Array<{ field: string; message: string }> } {\n const issues = error.issues.map(e => ({\n field: e.path.length > 0 ? e.path.map(p => String(p)).join('.') : 'root',\n message: e.message,\n }));\n\n return {\n error: `Invalid ${context}`,\n issues,\n };\n}\n\n// Helper to handle errors consistently\nexport function handleError(error: unknown, defaultMessage: string): never {\n if (isModelNotAllowedError(error)) {\n const body = {\n error: {\n code: error.code,\n message: error.message,\n allowed: error.allowed,\n attempted: error.attempted,\n offendingLabel: error.offendingLabel,\n },\n };\n const res = new Response(JSON.stringify(body), {\n status: 422,\n headers: { 'content-type': 'application/json' },\n });\n throw new HTTPException(422, {\n res,\n message: error.message,\n cause: error,\n });\n }\n\n // A losing concurrent resume or time travel, or a recover of a run that is live or suspended, is\n // a conflict on run state, not a malformed request, so it maps to 409 and clients can\n // distinguish it from a 400/500 and re-read the run.\n if (isRunClaimConflictError(error) || isDurableRunConflictError(error)) {\n const res = isRunClaimConflictError(error)\n ? new Response(JSON.stringify({ error: error.message, code: error.id }), {\n status: 409,\n headers: { 'content-type': 'application/json' },\n })\n : undefined;\n throw new HTTPException(409, {\n res,\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n // The feedback row changed under a review-status update, so the caller re-reads and retries;\n // that is a conflict, not a broken store.\n if (isFeedbackReviewStatusConflictError(error)) {\n throw new HTTPException(409, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n if (isWorkflowSchemaValidationError(error)) {\n throw new HTTPException(400, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n // Optional observability APIs (feedback, metrics, logs, scores, ...) throw\n // `*_NOT_IMPLEMENTED` on stores that don't support them. That's a missing\n // capability, not a server fault, so it maps to 501 — which server adapters\n // log as a warning instead of an error. The message is preserved because\n // clients match on it to detect unsupported operations. Clients should check\n // `GET /observability/capabilities` before calling optional routes.\n if (isObservabilityStorageNotImplementedError(error)) {\n throw new HTTPException(501, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n const apiError = error as ApiError;\n\n const apiErrorStatus = apiError.status || apiError.details?.status || 500;\n\n throw new HTTPException(apiErrorStatus as StatusCode, {\n message: apiError.message || defaultMessage,\n stack: apiError.stack,\n cause: apiError.cause,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAM,yBAAyB;AAS/B,SAAS,uBAAuB,OAAmD;CACjF,OAAO,iBAAiB,SAAU,MAA6B,SAAS;AAC1E;AAEA,MAAM,yCAAyC;AAE/C,SAAS,gCAAgC,OAAgC;CACvE,OAAO,iBAAiB,SAAU,MAA2B,OAAO;AACtE;AAIA,MAAM,2CAA2B,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,wBAAwB,OAAiD;CAChF,OAAO,iBAAiB,SAAS,yBAAyB,IAAK,MAA2B,EAAY;AACxG;;;;;;;AAQA,MAAM,6CAA6B,IAAI,IAAI;CACzC;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,0BAA0B,OAAgC;CACjE,MAAM,KAAM,OAAwC;CACpD,OAAO,iBAAiB,SAAS,OAAO,OAAO,YAAY,2BAA2B,IAAI,EAAE;AAC9F;AAEA,MAAM,uCAAuC;AAE7C,SAAS,oCAAoC,OAAgC;CAC3E,OAAO,iBAAiB,SAAU,MAA2B,OAAO;AACtE;;;;;;;AAQA,SAAS,0CAA0C,OAAgC;CACjF,MAAM,KAAK,SAAS,OAAO,UAAU,YAAY,QAAQ,QAAQ,MAAM,KAAK,KAAA;CAC5E,OAAO,OAAO,OAAO,YAAY,GAAG,WAAW,wBAAwB,KAAK,GAAG,SAAS,kBAAkB;AAC5G;;;;;;;;;;;AAYA,SAAgB,WAAW,OAAwC;CACjE,OACE,CAAC,CAAC,SACF,OAAO,UAAU,YAChB,MAA6B,SAAS,cACvC,MAAM,QAAS,MAA+B,MAAM;AAExD;;;;;AAMA,SAAgB,eACd,OACA,SACsE;CACtE,MAAM,SAAS,MAAM,OAAO,KAAI,OAAM;EACpC,OAAO,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,KAAI,MAAK,OAAO,CAAC,CAAC,C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A,cAFa,SAAS,UAAU,SAAS,SAAS,UAAU,KAEhB;EACpD,SAAS,SAAS,WAAW;EAC7B,OAAO,SAAS;EAChB,OAAO,SAAS;CAClB,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"error.cjs","names":["HTTPException"],"sources":["../../../src/server/handlers/error.ts"],"sourcesContent":["import type { ZodError } from 'zod';\n\nimport { HTTPException } from '../http-exception';\nimport type { StatusCode } from '../http-exception';\nimport type { ApiError } from '../types';\n\n/**\n * Duck-typed interface for ZodError-like objects.\n * Note: Zod v4 uses PropertyKey[] (string | number | symbol) for path.\n */\nexport interface ZodErrorLike {\n issues: Array<{\n path: PropertyKey[];\n message: string;\n }>;\n}\n\n/**\n * Recognition for `ModelNotAllowedError` from `@mastra/core/agent-builder/ee`.\n *\n * Inlined as a duck check rather than imported so that `handleError` (wired\n * into every route) does not force a load-time dependency on the\n * `@mastra/core/agent-builder/ee` subpath. That subpath only ships in\n * `@mastra/core >= 1.34.0`; deploys whose bundled `@mastra/server` resolves\n * against an older core would otherwise crash at startup with\n * `ERR_MODULE_NOT_FOUND` on `@mastra/core/dist/agent-builder/ee/index.js`.\n */\nconst MODEL_NOT_ALLOWED_CODE = 'MODEL_NOT_ALLOWED';\n\ninterface ModelNotAllowedErrorLike extends Error {\n code: typeof MODEL_NOT_ALLOWED_CODE;\n allowed?: unknown;\n attempted?: unknown;\n offendingLabel?: string;\n}\n\nfunction isModelNotAllowedError(error: unknown): error is ModelNotAllowedErrorLike {\n return error instanceof Error && (error as { code?: unknown }).code === MODEL_NOT_ALLOWED_CODE;\n}\n\nconst WORKFLOW_SCHEMA_VALIDATION_FAILED_CODE = 'WORKFLOW_SCHEMA_VALIDATION_FAILED';\n\nfunction isWorkflowSchemaValidationError(error: unknown): error is Error {\n return error instanceof Error && (error as { id?: unknown }).id === WORKFLOW_SCHEMA_VALIDATION_FAILED_CODE;\n}\n\n// A resume or time travel the run can't accept: another caller claimed it, it is still running,\n// or it isn't waiting to be resumed.\nconst RUN_CLAIM_CONFLICT_CODES = new Set([\n 'WORKFLOW_RESUME_ALREADY_CLAIMED',\n 'AGENT_RESUME_ALREADY_CLAIMED',\n 'WORKFLOW_RUN_NOT_SUSPENDED',\n 'AGENT_RESUME_RUN_NOT_SUSPENDED',\n 'WORKFLOW_TIME_TRAVEL_ALREADY_CLAIMED',\n 'WORKFLOW_TIME_TRAVEL_RUN_RUNNING',\n]);\n\nfunction isRunClaimConflictError(error: unknown): error is Error & { id: string } {\n return error instanceof Error && RUN_CLAIM_CONFLICT_CODES.has((error as { id?: unknown }).id as string);\n}\n\n/**\n * Durable agent errors for a request that conflicts with the run's state:\n * another execution owns the run, it is already being recovered, it lost a\n * concurrent claim, or it is suspended (recover). Matched by id, like the\n * other checks here, so the server doesn't depend on core exporting them.\n */\nconst DURABLE_RUN_CONFLICT_CODES = new Set([\n 'DURABLE_AGENT_RUN_ACTIVE',\n 'DURABLE_AGENT_RECOVER_RUN_ACTIVE_LOCALLY',\n 'DURABLE_AGENT_RECOVER_ALREADY_IN_PROGRESS',\n 'DURABLE_AGENT_RECOVER_RUN_SUSPENDED',\n 'DURABLE_AGENT_EXECUTION_CONFLICT',\n]);\n\nfunction isDurableRunConflictError(error: unknown): error is Error {\n const id = (error as { id?: unknown } | undefined)?.id;\n return error instanceof Error && typeof id === 'string' && DURABLE_RUN_CONFLICT_CODES.has(id);\n}\n\nconst FEEDBACK_REVIEW_STATUS_CONFLICT_CODE = 'OBSERVABILITY_UPDATE_FEEDBACK_REVIEW_STATUS_CONFLICT';\n\nfunction isFeedbackReviewStatusConflictError(error: unknown): error is Error {\n return error instanceof Error && (error as { id?: unknown }).id === FEEDBACK_REVIEW_STATUS_CONFLICT_CODE;\n}\n\n/**\n * Matches the `OBSERVABILITY_STORAGE_*_NOT_IMPLEMENTED` MastraError the base\n * observability store throws for every optional method a store doesn't\n * implement. Checked by id (not `instanceof`) so it holds across duplicated\n * `@mastra/core` installs.\n */\nfunction isObservabilityStorageNotImplementedError(error: unknown): error is Error {\n const id = error && typeof error === 'object' && 'id' in error ? error.id : undefined;\n return typeof id === 'string' && id.startsWith('OBSERVABILITY_STORAGE_') && id.endsWith('_NOT_IMPLEMENTED');\n}\n\n/**\n * Structural check for ZodError instances.\n *\n * Avoids `instanceof ZodError` because consumers can resolve `'zod'` to a\n * different package instance (e.g. `zod@^3`) than the one a server adapter is\n * bundled with (`zod@^4`). In that case `instanceof` is false and validation\n * errors fall through to a generic response that drops field-path information.\n *\n * See https://github.com/mastra-ai/mastra/issues/17167.\n */\nexport function isZodError(error: unknown): error is ZodError<any> {\n return (\n !!error &&\n typeof error === 'object' &&\n (error as { name?: unknown }).name === 'ZodError' &&\n Array.isArray((error as { issues?: unknown }).issues)\n );\n}\n\n/**\n * Formats a ZodError into a structured validation error response.\n * Returns an object with an error message and an array of field-specific issues.\n */\nexport function formatZodError(\n error: ZodErrorLike,\n context: string,\n): { error: string; issues: Array<{ field: string; message: string }> } {\n const issues = error.issues.map(e => ({\n field: e.path.length > 0 ? e.path.map(p => String(p)).join('.') : 'root',\n message: e.message,\n }));\n\n return {\n error: `Invalid ${context}`,\n issues,\n };\n}\n\n// Helper to handle errors consistently\nexport function handleError(error: unknown, defaultMessage: string): never {\n if (isModelNotAllowedError(error)) {\n const body = {\n error: {\n code: error.code,\n message: error.message,\n allowed: error.allowed,\n attempted: error.attempted,\n offendingLabel: error.offendingLabel,\n },\n };\n const res = new Response(JSON.stringify(body), {\n status: 422,\n headers: { 'content-type': 'application/json' },\n });\n throw new HTTPException(422, {\n res,\n message: error.message,\n cause: error,\n });\n }\n\n // A losing concurrent resume or time travel, or a recover of a run that is live or suspended, is\n // a conflict on run state, not a malformed request, so it maps to 409 and clients can\n // distinguish it from a 400/500 and re-read the run.\n if (isRunClaimConflictError(error) || isDurableRunConflictError(error)) {\n const res = isRunClaimConflictError(error)\n ? new Response(JSON.stringify({ error: error.message, code: error.id }), {\n status: 409,\n headers: { 'content-type': 'application/json' },\n })\n : undefined;\n throw new HTTPException(409, {\n res,\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n // The feedback row changed under a review-status update, so the caller re-reads and retries;\n // that is a conflict, not a broken store.\n if (isFeedbackReviewStatusConflictError(error)) {\n throw new HTTPException(409, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n if (isWorkflowSchemaValidationError(error)) {\n throw new HTTPException(400, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n // Optional observability APIs (feedback, metrics, logs, scores, ...) throw\n // `*_NOT_IMPLEMENTED` on stores that don't support them. That's a missing\n // capability, not a server fault, so it maps to 501 — which server adapters\n // log as a warning instead of an error. The message is preserved because\n // clients match on it to detect unsupported operations. Clients should check\n // `GET /observability/capabilities` before calling optional routes.\n if (isObservabilityStorageNotImplementedError(error)) {\n throw new HTTPException(501, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n const apiError = error as ApiError;\n\n const apiErrorStatus = apiError.status || apiError.details?.status || 500;\n\n throw new HTTPException(apiErrorStatus as StatusCode, {\n message: apiError.message || defaultMessage,\n stack: apiError.stack,\n cause: apiError.cause,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAM,yBAAyB;AAS/B,SAAS,uBAAuB,OAAmD;CACjF,OAAO,iBAAiB,SAAU,MAA6B,SAAS;AAC1E;AAEA,MAAM,yCAAyC;AAE/C,SAAS,gCAAgC,OAAgC;CACvE,OAAO,iBAAiB,SAAU,MAA2B,OAAO;AACtE;AAIA,MAAM,2CAA2B,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,wBAAwB,OAAiD;CAChF,OAAO,iBAAiB,SAAS,yBAAyB,IAAK,MAA2B,EAAY;AACxG;;;;;;;AAQA,MAAM,6CAA6B,IAAI,IAAI;CACzC;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,0BAA0B,OAAgC;CACjE,MAAM,KAAM,OAAwC;CACpD,OAAO,iBAAiB,SAAS,O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AK,UAAU;GAAE,OAAO,MAAM;GAAS,MAAM,MAAM;EAAG,CAAC,GAAG;GACrE,QAAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;EAChD,CAAC,IACD,KAAA;EACJ,MAAM,IAAIA,uBAAAA,cAAc,KAAK;GAC3B;GACA,SAAS,MAAM;GACf,OAAO,MAAM;GACb,OAAO;EACT,CAAC;CACH;CAIA,IAAI,oCAAoC,KAAK,GAC3C,MAAM,IAAIA,uBAAAA,cAAc,KAAK;EAC3B,SAAS,MAAM;EACf,OAAO,MAAM;EACb,OAAO;CACT,CAAC;CAGH,IAAI,gCAAgC,KAAK,GACvC,MAAM,IAAIA,uBAAAA,cAAc,KAAK;EAC3B,SAAS,MAAM;EACf,OAAO,MAAM;EACb,OAAO;CACT,CAAC;CASH,IAAI,0CAA0C,KAAK,GACjD,MAAM,IAAIA,uBAAAA,cAAc,KAAK;EAC3B,SAAS,MAAM;EACf,OAAO,MAAM;EACb,OAAO;CACT,CAAC;CAGH,MAAM,WAAW;CAEjB,MAAM,iBAAiB,SAAS,UAAU,SAAS,SAAS,UAAU;CAEtE,MAAM,IAAIA,uBAAAA,cAAc,gBAA8B;EACpD,SAAS,SAAS,WAAW;EAC7B,OAAO,SAAS;EAChB,OAAO,SAAS;CAClB,CAAC;AACH"}
|
|
@@ -96,27 +96,31 @@ function handleError(error, defaultMessage) {
|
|
|
96
96
|
attempted: error.attempted,
|
|
97
97
|
offendingLabel: error.offendingLabel
|
|
98
98
|
} };
|
|
99
|
+
const res = new Response(JSON.stringify(body), {
|
|
100
|
+
status: 422,
|
|
101
|
+
headers: { "content-type": "application/json" }
|
|
102
|
+
});
|
|
99
103
|
throw new HTTPException(422, {
|
|
100
|
-
res
|
|
101
|
-
status: 422,
|
|
102
|
-
headers: { "content-type": "application/json" }
|
|
103
|
-
}),
|
|
104
|
+
res,
|
|
104
105
|
message: error.message,
|
|
105
106
|
cause: error
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
|
-
if (isRunClaimConflictError(error) || isDurableRunConflictError(error))
|
|
109
|
-
res
|
|
109
|
+
if (isRunClaimConflictError(error) || isDurableRunConflictError(error)) {
|
|
110
|
+
const res = isRunClaimConflictError(error) ? new Response(JSON.stringify({
|
|
110
111
|
error: error.message,
|
|
111
112
|
code: error.id
|
|
112
113
|
}), {
|
|
113
114
|
status: 409,
|
|
114
115
|
headers: { "content-type": "application/json" }
|
|
115
|
-
}) : void 0
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
}) : void 0;
|
|
117
|
+
throw new HTTPException(409, {
|
|
118
|
+
res,
|
|
119
|
+
message: error.message,
|
|
120
|
+
stack: error.stack,
|
|
121
|
+
cause: error
|
|
122
|
+
});
|
|
123
|
+
}
|
|
120
124
|
if (isFeedbackReviewStatusConflictError(error)) throw new HTTPException(409, {
|
|
121
125
|
message: error.message,
|
|
122
126
|
stack: error.stack,
|
|
@@ -133,7 +137,8 @@ function handleError(error, defaultMessage) {
|
|
|
133
137
|
cause: error
|
|
134
138
|
});
|
|
135
139
|
const apiError = error;
|
|
136
|
-
|
|
140
|
+
const apiErrorStatus = apiError.status || apiError.details?.status || 500;
|
|
141
|
+
throw new HTTPException(apiErrorStatus, {
|
|
137
142
|
message: apiError.message || defaultMessage,
|
|
138
143
|
stack: apiError.stack,
|
|
139
144
|
cause: apiError.cause
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","names":[],"sources":["../../../src/server/handlers/error.ts"],"sourcesContent":["import type { ZodError } from 'zod';\n\nimport { HTTPException } from '../http-exception';\nimport type { StatusCode } from '../http-exception';\nimport type { ApiError } from '../types';\n\n/**\n * Duck-typed interface for ZodError-like objects.\n * Note: Zod v4 uses PropertyKey[] (string | number | symbol) for path.\n */\nexport interface ZodErrorLike {\n issues: Array<{\n path: PropertyKey[];\n message: string;\n }>;\n}\n\n/**\n * Recognition for `ModelNotAllowedError` from `@mastra/core/agent-builder/ee`.\n *\n * Inlined as a duck check rather than imported so that `handleError` (wired\n * into every route) does not force a load-time dependency on the\n * `@mastra/core/agent-builder/ee` subpath. That subpath only ships in\n * `@mastra/core >= 1.34.0`; deploys whose bundled `@mastra/server` resolves\n * against an older core would otherwise crash at startup with\n * `ERR_MODULE_NOT_FOUND` on `@mastra/core/dist/agent-builder/ee/index.js`.\n */\nconst MODEL_NOT_ALLOWED_CODE = 'MODEL_NOT_ALLOWED';\n\ninterface ModelNotAllowedErrorLike extends Error {\n code: typeof MODEL_NOT_ALLOWED_CODE;\n allowed?: unknown;\n attempted?: unknown;\n offendingLabel?: string;\n}\n\nfunction isModelNotAllowedError(error: unknown): error is ModelNotAllowedErrorLike {\n return error instanceof Error && (error as { code?: unknown }).code === MODEL_NOT_ALLOWED_CODE;\n}\n\nconst WORKFLOW_SCHEMA_VALIDATION_FAILED_CODE = 'WORKFLOW_SCHEMA_VALIDATION_FAILED';\n\nfunction isWorkflowSchemaValidationError(error: unknown): error is Error {\n return error instanceof Error && (error as { id?: unknown }).id === WORKFLOW_SCHEMA_VALIDATION_FAILED_CODE;\n}\n\n// A resume or time travel the run can't accept: another caller claimed it, it is still running,\n// or it isn't waiting to be resumed.\nconst RUN_CLAIM_CONFLICT_CODES = new Set([\n 'WORKFLOW_RESUME_ALREADY_CLAIMED',\n 'AGENT_RESUME_ALREADY_CLAIMED',\n 'WORKFLOW_RUN_NOT_SUSPENDED',\n 'AGENT_RESUME_RUN_NOT_SUSPENDED',\n 'WORKFLOW_TIME_TRAVEL_ALREADY_CLAIMED',\n 'WORKFLOW_TIME_TRAVEL_RUN_RUNNING',\n]);\n\nfunction isRunClaimConflictError(error: unknown): error is Error & { id: string } {\n return error instanceof Error && RUN_CLAIM_CONFLICT_CODES.has((error as { id?: unknown }).id as string);\n}\n\n/**\n * Durable agent errors for a request that conflicts with the run's state:\n * another execution owns the run, it is already being recovered, it lost a\n * concurrent claim, or it is suspended (recover). Matched by id, like the\n * other checks here, so the server doesn't depend on core exporting them.\n */\nconst DURABLE_RUN_CONFLICT_CODES = new Set([\n 'DURABLE_AGENT_RUN_ACTIVE',\n 'DURABLE_AGENT_RECOVER_RUN_ACTIVE_LOCALLY',\n 'DURABLE_AGENT_RECOVER_ALREADY_IN_PROGRESS',\n 'DURABLE_AGENT_RECOVER_RUN_SUSPENDED',\n 'DURABLE_AGENT_EXECUTION_CONFLICT',\n]);\n\nfunction isDurableRunConflictError(error: unknown): error is Error {\n const id = (error as { id?: unknown } | undefined)?.id;\n return error instanceof Error && typeof id === 'string' && DURABLE_RUN_CONFLICT_CODES.has(id);\n}\n\nconst FEEDBACK_REVIEW_STATUS_CONFLICT_CODE = 'OBSERVABILITY_UPDATE_FEEDBACK_REVIEW_STATUS_CONFLICT';\n\nfunction isFeedbackReviewStatusConflictError(error: unknown): error is Error {\n return error instanceof Error && (error as { id?: unknown }).id === FEEDBACK_REVIEW_STATUS_CONFLICT_CODE;\n}\n\n/**\n * Matches the `OBSERVABILITY_STORAGE_*_NOT_IMPLEMENTED` MastraError the base\n * observability store throws for every optional method a store doesn't\n * implement. Checked by id (not `instanceof`) so it holds across duplicated\n * `@mastra/core` installs.\n */\nfunction isObservabilityStorageNotImplementedError(error: unknown): error is Error {\n const id = error && typeof error === 'object' && 'id' in error ? error.id : undefined;\n return typeof id === 'string' && id.startsWith('OBSERVABILITY_STORAGE_') && id.endsWith('_NOT_IMPLEMENTED');\n}\n\n/**\n * Structural check for ZodError instances.\n *\n * Avoids `instanceof ZodError` because consumers can resolve `'zod'` to a\n * different package instance (e.g. `zod@^3`) than the one a server adapter is\n * bundled with (`zod@^4`). In that case `instanceof` is false and validation\n * errors fall through to a generic response that drops field-path information.\n *\n * See https://github.com/mastra-ai/mastra/issues/17167.\n */\nexport function isZodError(error: unknown): error is ZodError<any> {\n return (\n !!error &&\n typeof error === 'object' &&\n (error as { name?: unknown }).name === 'ZodError' &&\n Array.isArray((error as { issues?: unknown }).issues)\n );\n}\n\n/**\n * Formats a ZodError into a structured validation error response.\n * Returns an object with an error message and an array of field-specific issues.\n */\nexport function formatZodError(\n error: ZodErrorLike,\n context: string,\n): { error: string; issues: Array<{ field: string; message: string }> } {\n const issues = error.issues.map(e => ({\n field: e.path.length > 0 ? e.path.map(p => String(p)).join('.') : 'root',\n message: e.message,\n }));\n\n return {\n error: `Invalid ${context}`,\n issues,\n };\n}\n\n// Helper to handle errors consistently\nexport function handleError(error: unknown, defaultMessage: string): never {\n if (isModelNotAllowedError(error)) {\n const body = {\n error: {\n code: error.code,\n message: error.message,\n allowed: error.allowed,\n attempted: error.attempted,\n offendingLabel: error.offendingLabel,\n },\n };\n const res = new Response(JSON.stringify(body), {\n status: 422,\n headers: { 'content-type': 'application/json' },\n });\n throw new HTTPException(422, {\n res,\n message: error.message,\n cause: error,\n });\n }\n\n // A losing concurrent resume or time travel, or a recover of a run that is live or suspended, is\n // a conflict on run state, not a malformed request, so it maps to 409 and clients can\n // distinguish it from a 400/500 and re-read the run.\n if (isRunClaimConflictError(error) || isDurableRunConflictError(error)) {\n const res = isRunClaimConflictError(error)\n ? new Response(JSON.stringify({ error: error.message, code: error.id }), {\n status: 409,\n headers: { 'content-type': 'application/json' },\n })\n : undefined;\n throw new HTTPException(409, {\n res,\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n // The feedback row changed under a review-status update, so the caller re-reads and retries;\n // that is a conflict, not a broken store.\n if (isFeedbackReviewStatusConflictError(error)) {\n throw new HTTPException(409, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n if (isWorkflowSchemaValidationError(error)) {\n throw new HTTPException(400, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n // Optional observability APIs (feedback, metrics, logs, scores, ...) throw\n // `*_NOT_IMPLEMENTED` on stores that don't support them. That's a missing\n // capability, not a server fault, so it maps to 501 — which server adapters\n // log as a warning instead of an error. The message is preserved because\n // clients match on it to detect unsupported operations. Clients should check\n // `GET /observability/capabilities` before calling optional routes.\n if (isObservabilityStorageNotImplementedError(error)) {\n throw new HTTPException(501, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n const apiError = error as ApiError;\n\n const apiErrorStatus = apiError.status || apiError.details?.status || 500;\n\n throw new HTTPException(apiErrorStatus as StatusCode, {\n message: apiError.message || defaultMessage,\n stack: apiError.stack,\n cause: apiError.cause,\n });\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,MAAM,yBAAyB;AAS/B,SAAS,uBAAuB,OAAmD;CACjF,OAAO,iBAAiB,SAAU,MAA6B,SAAS;AAC1E;AAEA,MAAM,yCAAyC;AAE/C,SAAS,gCAAgC,OAAgC;CACvE,OAAO,iBAAiB,SAAU,MAA2B,OAAO;AACtE;AAIA,MAAM,2CAA2B,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,wBAAwB,OAAiD;CAChF,OAAO,iBAAiB,SAAS,yBAAyB,IAAK,MAA2B,EAAY;AACxG;;;;;;;AAQA,MAAM,6CAA6B,IAAI,IAAI;CACzC;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,0BAA0B,OAAgC;CACjE,MAAM,KAAM,OAAwC;CACpD,OAAO,iBAAiB,SAAS,OAAO,OAAO,YAAY,2BAA2B,IAAI,EAAE;AAC9F;AAEA,MAAM,uCAAuC;AAE7C,SAAS,oCAAoC,OAAgC;CAC3E,OAAO,iBAAiB,SAAU,MAA2B,OAAO;AACtE;;;;;;;AAQA,SAAS,0CAA0C,OAAgC;CACjF,MAAM,KAAK,SAAS,OAAO,UAAU,YAAY,QAAQ,QAAQ,MAAM,KAAK,KAAA;CAC5E,OAAO,OAAO,OAAO,YAAY,GAAG,WAAW,wBAAwB,KAAK,GAAG,SAAS,kBAAkB;AAC5G;;;;;;;;;;;AAYA,SAAgB,WAAW,OAAwC;CACjE,OACE,CAAC,CAAC,SACF,OAAO,UAAU,YAChB,MAA6B,SAAS,cACvC,MAAM,QAAS,MAA+B,MAAM;AAExD;;;;;AAMA,SAAgB,eACd,OACA,S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OAAO,MAAM;EACb,OAAO;CACT,CAAC;CAGH,MAAM,WAAW;CAIjB,MAAM,IAAI,cAFa,SAAS,UAAU,SAAS,SAAS,UAAU,KAEhB;EACpD,SAAS,SAAS,WAAW;EAC7B,OAAO,SAAS;EAChB,OAAO,SAAS;CAClB,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"error.js","names":[],"sources":["../../../src/server/handlers/error.ts"],"sourcesContent":["import type { ZodError } from 'zod';\n\nimport { HTTPException } from '../http-exception';\nimport type { StatusCode } from '../http-exception';\nimport type { ApiError } from '../types';\n\n/**\n * Duck-typed interface for ZodError-like objects.\n * Note: Zod v4 uses PropertyKey[] (string | number | symbol) for path.\n */\nexport interface ZodErrorLike {\n issues: Array<{\n path: PropertyKey[];\n message: string;\n }>;\n}\n\n/**\n * Recognition for `ModelNotAllowedError` from `@mastra/core/agent-builder/ee`.\n *\n * Inlined as a duck check rather than imported so that `handleError` (wired\n * into every route) does not force a load-time dependency on the\n * `@mastra/core/agent-builder/ee` subpath. That subpath only ships in\n * `@mastra/core >= 1.34.0`; deploys whose bundled `@mastra/server` resolves\n * against an older core would otherwise crash at startup with\n * `ERR_MODULE_NOT_FOUND` on `@mastra/core/dist/agent-builder/ee/index.js`.\n */\nconst MODEL_NOT_ALLOWED_CODE = 'MODEL_NOT_ALLOWED';\n\ninterface ModelNotAllowedErrorLike extends Error {\n code: typeof MODEL_NOT_ALLOWED_CODE;\n allowed?: unknown;\n attempted?: unknown;\n offendingLabel?: string;\n}\n\nfunction isModelNotAllowedError(error: unknown): error is ModelNotAllowedErrorLike {\n return error instanceof Error && (error as { code?: unknown }).code === MODEL_NOT_ALLOWED_CODE;\n}\n\nconst WORKFLOW_SCHEMA_VALIDATION_FAILED_CODE = 'WORKFLOW_SCHEMA_VALIDATION_FAILED';\n\nfunction isWorkflowSchemaValidationError(error: unknown): error is Error {\n return error instanceof Error && (error as { id?: unknown }).id === WORKFLOW_SCHEMA_VALIDATION_FAILED_CODE;\n}\n\n// A resume or time travel the run can't accept: another caller claimed it, it is still running,\n// or it isn't waiting to be resumed.\nconst RUN_CLAIM_CONFLICT_CODES = new Set([\n 'WORKFLOW_RESUME_ALREADY_CLAIMED',\n 'AGENT_RESUME_ALREADY_CLAIMED',\n 'WORKFLOW_RUN_NOT_SUSPENDED',\n 'AGENT_RESUME_RUN_NOT_SUSPENDED',\n 'WORKFLOW_TIME_TRAVEL_ALREADY_CLAIMED',\n 'WORKFLOW_TIME_TRAVEL_RUN_RUNNING',\n]);\n\nfunction isRunClaimConflictError(error: unknown): error is Error & { id: string } {\n return error instanceof Error && RUN_CLAIM_CONFLICT_CODES.has((error as { id?: unknown }).id as string);\n}\n\n/**\n * Durable agent errors for a request that conflicts with the run's state:\n * another execution owns the run, it is already being recovered, it lost a\n * concurrent claim, or it is suspended (recover). Matched by id, like the\n * other checks here, so the server doesn't depend on core exporting them.\n */\nconst DURABLE_RUN_CONFLICT_CODES = new Set([\n 'DURABLE_AGENT_RUN_ACTIVE',\n 'DURABLE_AGENT_RECOVER_RUN_ACTIVE_LOCALLY',\n 'DURABLE_AGENT_RECOVER_ALREADY_IN_PROGRESS',\n 'DURABLE_AGENT_RECOVER_RUN_SUSPENDED',\n 'DURABLE_AGENT_EXECUTION_CONFLICT',\n]);\n\nfunction isDurableRunConflictError(error: unknown): error is Error {\n const id = (error as { id?: unknown } | undefined)?.id;\n return error instanceof Error && typeof id === 'string' && DURABLE_RUN_CONFLICT_CODES.has(id);\n}\n\nconst FEEDBACK_REVIEW_STATUS_CONFLICT_CODE = 'OBSERVABILITY_UPDATE_FEEDBACK_REVIEW_STATUS_CONFLICT';\n\nfunction isFeedbackReviewStatusConflictError(error: unknown): error is Error {\n return error instanceof Error && (error as { id?: unknown }).id === FEEDBACK_REVIEW_STATUS_CONFLICT_CODE;\n}\n\n/**\n * Matches the `OBSERVABILITY_STORAGE_*_NOT_IMPLEMENTED` MastraError the base\n * observability store throws for every optional method a store doesn't\n * implement. Checked by id (not `instanceof`) so it holds across duplicated\n * `@mastra/core` installs.\n */\nfunction isObservabilityStorageNotImplementedError(error: unknown): error is Error {\n const id = error && typeof error === 'object' && 'id' in error ? error.id : undefined;\n return typeof id === 'string' && id.startsWith('OBSERVABILITY_STORAGE_') && id.endsWith('_NOT_IMPLEMENTED');\n}\n\n/**\n * Structural check for ZodError instances.\n *\n * Avoids `instanceof ZodError` because consumers can resolve `'zod'` to a\n * different package instance (e.g. `zod@^3`) than the one a server adapter is\n * bundled with (`zod@^4`). In that case `instanceof` is false and validation\n * errors fall through to a generic response that drops field-path information.\n *\n * See https://github.com/mastra-ai/mastra/issues/17167.\n */\nexport function isZodError(error: unknown): error is ZodError<any> {\n return (\n !!error &&\n typeof error === 'object' &&\n (error as { name?: unknown }).name === 'ZodError' &&\n Array.isArray((error as { issues?: unknown }).issues)\n );\n}\n\n/**\n * Formats a ZodError into a structured validation error response.\n * Returns an object with an error message and an array of field-specific issues.\n */\nexport function formatZodError(\n error: ZodErrorLike,\n context: string,\n): { error: string; issues: Array<{ field: string; message: string }> } {\n const issues = error.issues.map(e => ({\n field: e.path.length > 0 ? e.path.map(p => String(p)).join('.') : 'root',\n message: e.message,\n }));\n\n return {\n error: `Invalid ${context}`,\n issues,\n };\n}\n\n// Helper to handle errors consistently\nexport function handleError(error: unknown, defaultMessage: string): never {\n if (isModelNotAllowedError(error)) {\n const body = {\n error: {\n code: error.code,\n message: error.message,\n allowed: error.allowed,\n attempted: error.attempted,\n offendingLabel: error.offendingLabel,\n },\n };\n const res = new Response(JSON.stringify(body), {\n status: 422,\n headers: { 'content-type': 'application/json' },\n });\n throw new HTTPException(422, {\n res,\n message: error.message,\n cause: error,\n });\n }\n\n // A losing concurrent resume or time travel, or a recover of a run that is live or suspended, is\n // a conflict on run state, not a malformed request, so it maps to 409 and clients can\n // distinguish it from a 400/500 and re-read the run.\n if (isRunClaimConflictError(error) || isDurableRunConflictError(error)) {\n const res = isRunClaimConflictError(error)\n ? new Response(JSON.stringify({ error: error.message, code: error.id }), {\n status: 409,\n headers: { 'content-type': 'application/json' },\n })\n : undefined;\n throw new HTTPException(409, {\n res,\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n // The feedback row changed under a review-status update, so the caller re-reads and retries;\n // that is a conflict, not a broken store.\n if (isFeedbackReviewStatusConflictError(error)) {\n throw new HTTPException(409, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n if (isWorkflowSchemaValidationError(error)) {\n throw new HTTPException(400, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n // Optional observability APIs (feedback, metrics, logs, scores, ...) throw\n // `*_NOT_IMPLEMENTED` on stores that don't support them. That's a missing\n // capability, not a server fault, so it maps to 501 — which server adapters\n // log as a warning instead of an error. The message is preserved because\n // clients match on it to detect unsupported operations. Clients should check\n // `GET /observability/capabilities` before calling optional routes.\n if (isObservabilityStorageNotImplementedError(error)) {\n throw new HTTPException(501, {\n message: error.message,\n stack: error.stack,\n cause: error,\n });\n }\n\n const apiError = error as ApiError;\n\n const apiErrorStatus = apiError.status || apiError.details?.status || 500;\n\n throw new HTTPException(apiErrorStatus as StatusCode, {\n message: apiError.message || defaultMessage,\n stack: apiError.stack,\n cause: apiError.cause,\n });\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,MAAM,yBAAyB;AAS/B,SAAS,uBAAuB,OAAmD;CACjF,OAAO,iBAAiB,SAAU,MAA6B,SAAS;AAC1E;AAEA,MAAM,yCAAyC;AAE/C,SAAS,gCAAgC,OAAgC;CACvE,OAAO,iBAAiB,SAAU,MAA2B,OAAO;AACtE;AAIA,MAAM,2CAA2B,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,wBAAwB,OAAiD;CAChF,OAAO,iBAAiB,SAAS,yBAAyB,IAAK,MAA2B,EAAY;AACxG;;;;;;;AAQA,MAAM,6CAA6B,IAAI,IAAI;CACzC;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,0BAA0B,OAA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MAAM,MAAM,wBAAwB,KAAK,IACrC,IAAI,SAAS,KAAK,UAAU;GAAE,OAAO,MAAM;GAAS,MAAM,MAAM;EAAG,CAAC,GAAG;GACrE,QAAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;EAChD,CAAC,IACD,KAAA;EACJ,MAAM,IAAI,cAAc,KAAK;GAC3B;GACA,SAAS,MAAM;GACf,OAAO,MAAM;GACb,OAAO;EACT,CAAC;CACH;CAIA,IAAI,oCAAoC,KAAK,GAC3C,MAAM,IAAI,cAAc,KAAK;EAC3B,SAAS,MAAM;EACf,OAAO,MAAM;EACb,OAAO;CACT,CAAC;CAGH,IAAI,gCAAgC,KAAK,GACvC,MAAM,IAAI,cAAc,KAAK;EAC3B,SAAS,MAAM;EACf,OAAO,MAAM;EACb,OAAO;CACT,CAAC;CASH,IAAI,0CAA0C,KAAK,GACjD,MAAM,IAAI,cAAc,KAAK;EAC3B,SAAS,MAAM;EACf,OAAO,MAAM;EACb,OAAO;CACT,CAAC;CAGH,MAAM,WAAW;CAEjB,MAAM,iBAAiB,SAAS,UAAU,SAAS,SAAS,UAAU;CAEtE,MAAM,IAAI,cAAc,gBAA8B;EACpD,SAAS,SAAS,WAAW;EAC7B,OAAO,SAAS;EAChB,OAAO,SAAS;CAClB,CAAC;AACH"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../../rolldown-runtime-
|
|
2
|
+
require("../../rolldown-runtime-BwC_XMyb.cjs");
|
|
3
3
|
const require_server_handlers_authorship = require("./authorship.cjs");
|
|
4
|
-
const require_editor_builder = require("../../editor-builder-
|
|
4
|
+
const require_editor_builder = require("../../editor-builder-DtpP1FtW.cjs");
|
|
5
5
|
//#region src/server/handlers/favorites-enrichment.ts
|
|
6
6
|
/**
|
|
7
7
|
* Resolve the EE feature flag plus the caller's favorited set for a list of
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getCallerAuthorId } from "./authorship.js";
|
|
2
|
-
import { i as isBuilderFeatureEnabled } from "../../editor-builder-
|
|
2
|
+
import { i as isBuilderFeatureEnabled } from "../../editor-builder-ClFlGXoX.js";
|
|
3
3
|
//#region src/server/handlers/favorites-enrichment.ts
|
|
4
4
|
/**
|
|
5
5
|
* Resolve the EE feature flag plus the caller's favorited set for a list of
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../../rolldown-runtime-
|
|
2
|
+
require("../../rolldown-runtime-BwC_XMyb.cjs");
|
|
3
3
|
//#region src/server/handlers/gateway-memory-client.ts
|
|
4
4
|
var GatewayMemoryClient = class {
|
|
5
5
|
baseUrl;
|
|
@@ -1,105 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const require_logs = require("../../logs-CY8AGOCO.cjs");
|
|
8
|
-
//#region src/server/handlers/logs.ts
|
|
9
|
-
var logs_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
10
|
-
LIST_LOGS_BY_RUN_ID_ROUTE: () => LIST_LOGS_BY_RUN_ID_ROUTE,
|
|
11
|
-
LIST_LOGS_ROUTE: () => LIST_LOGS_ROUTE,
|
|
12
|
-
LIST_LOG_TRANSPORTS_ROUTE: () => LIST_LOG_TRANSPORTS_ROUTE
|
|
13
|
-
});
|
|
14
|
-
const LIST_LOG_TRANSPORTS_ROUTE = require_route_builder.createRoute({
|
|
15
|
-
method: "GET",
|
|
16
|
-
path: "/logs/transports",
|
|
17
|
-
responseType: "json",
|
|
18
|
-
responseSchema: require_logs.listLogTransportsResponseSchema,
|
|
19
|
-
summary: "List log transports",
|
|
20
|
-
description: "Returns a list of all available log transports",
|
|
21
|
-
tags: ["Logs"],
|
|
22
|
-
requiresAuth: true,
|
|
23
|
-
handler: async ({ mastra }) => {
|
|
24
|
-
try {
|
|
25
|
-
const transports = mastra.getLogger().getTransports();
|
|
26
|
-
return { transports: transports ? [...transports.keys()] : [] };
|
|
27
|
-
} catch (error) {
|
|
28
|
-
return require_server_handlers_error.handleError(error, "Error getting log Transports");
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
const LIST_LOGS_ROUTE = require_route_builder.createRoute({
|
|
33
|
-
method: "GET",
|
|
34
|
-
path: "/logs",
|
|
35
|
-
responseType: "json",
|
|
36
|
-
queryParamSchema: require_logs.listLogsQuerySchema,
|
|
37
|
-
responseSchema: require_logs.listLogsResponseSchema,
|
|
38
|
-
summary: "List logs",
|
|
39
|
-
description: "Returns logs from a specific transport with optional filtering by date range, log level, and custom filters",
|
|
40
|
-
tags: ["Logs"],
|
|
41
|
-
requiresAuth: true,
|
|
42
|
-
handler: async ({ mastra, ...params }) => {
|
|
43
|
-
try {
|
|
44
|
-
const { transportId, fromDate, toDate, logLevel, filters: _filters, page, perPage } = params;
|
|
45
|
-
require_utils.validateBody({ transportId });
|
|
46
|
-
const filters = require_utils.parseFilters(_filters);
|
|
47
|
-
return await mastra.listLogs(transportId, {
|
|
48
|
-
fromDate,
|
|
49
|
-
toDate,
|
|
50
|
-
logLevel,
|
|
51
|
-
filters,
|
|
52
|
-
page: page ? Number(page) : void 0,
|
|
53
|
-
perPage: perPage ? Number(perPage) : void 0
|
|
54
|
-
});
|
|
55
|
-
} catch (error) {
|
|
56
|
-
return require_server_handlers_error.handleError(error, "Error getting logs");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
const LIST_LOGS_BY_RUN_ID_ROUTE = require_route_builder.createRoute({
|
|
61
|
-
method: "GET",
|
|
62
|
-
path: "/logs/:runId",
|
|
63
|
-
responseType: "json",
|
|
64
|
-
pathParamSchema: require_common.runIdSchema,
|
|
65
|
-
queryParamSchema: require_logs.listLogsQuerySchema,
|
|
66
|
-
responseSchema: require_logs.listLogsResponseSchema,
|
|
67
|
-
summary: "List logs by run ID",
|
|
68
|
-
description: "Returns all logs for a specific execution run from a transport",
|
|
69
|
-
tags: ["Logs"],
|
|
70
|
-
requiresAuth: true,
|
|
71
|
-
handler: async ({ mastra, runId, ...params }) => {
|
|
72
|
-
try {
|
|
73
|
-
const { transportId, fromDate, toDate, logLevel, filters: _filters, page, perPage } = params;
|
|
74
|
-
require_utils.validateBody({
|
|
75
|
-
runId,
|
|
76
|
-
transportId
|
|
77
|
-
});
|
|
78
|
-
const filters = require_utils.parseFilters(_filters);
|
|
79
|
-
return await mastra.listLogsByRunId({
|
|
80
|
-
runId,
|
|
81
|
-
transportId,
|
|
82
|
-
fromDate,
|
|
83
|
-
toDate,
|
|
84
|
-
logLevel,
|
|
85
|
-
filters,
|
|
86
|
-
page: page ? Number(page) : void 0,
|
|
87
|
-
perPage: perPage ? Number(perPage) : void 0
|
|
88
|
-
});
|
|
89
|
-
} catch (error) {
|
|
90
|
-
return require_server_handlers_error.handleError(error, "Error getting logs by run ID");
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
//#endregion
|
|
95
|
-
exports.LIST_LOGS_BY_RUN_ID_ROUTE = LIST_LOGS_BY_RUN_ID_ROUTE;
|
|
96
|
-
exports.LIST_LOGS_ROUTE = LIST_LOGS_ROUTE;
|
|
97
|
-
exports.LIST_LOG_TRANSPORTS_ROUTE = LIST_LOG_TRANSPORTS_ROUTE;
|
|
98
|
-
Object.defineProperty(exports, "logs_exports", {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function() {
|
|
101
|
-
return logs_exports;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=logs.cjs.map
|
|
2
|
+
require("../../rolldown-runtime-BwC_XMyb.cjs");
|
|
3
|
+
const require_logs = require("../../logs-CiSw7r0s.cjs");
|
|
4
|
+
exports.LIST_LOGS_BY_RUN_ID_ROUTE = require_logs.LIST_LOGS_BY_RUN_ID_ROUTE;
|
|
5
|
+
exports.LIST_LOGS_ROUTE = require_logs.LIST_LOGS_ROUTE;
|
|
6
|
+
exports.LIST_LOG_TRANSPORTS_ROUTE = require_logs.LIST_LOG_TRANSPORTS_ROUTE;
|
|
@@ -1,96 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { u as runIdSchema } from "../../common-Y30XtCyr.js";
|
|
3
|
-
import { n as createRoute } from "../../route-builder-BfQYtclb.js";
|
|
4
|
-
import { handleError } from "./error.js";
|
|
5
|
-
import { c as parseFilters, p as validateBody } from "../../utils-BBJlS81s.js";
|
|
6
|
-
import { n as listLogsQuerySchema, r as listLogsResponseSchema, t as listLogTransportsResponseSchema } from "../../logs-Bd_xpsYw.js";
|
|
7
|
-
//#region src/server/handlers/logs.ts
|
|
8
|
-
var logs_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
-
LIST_LOGS_BY_RUN_ID_ROUTE: () => LIST_LOGS_BY_RUN_ID_ROUTE,
|
|
10
|
-
LIST_LOGS_ROUTE: () => LIST_LOGS_ROUTE,
|
|
11
|
-
LIST_LOG_TRANSPORTS_ROUTE: () => LIST_LOG_TRANSPORTS_ROUTE
|
|
12
|
-
});
|
|
13
|
-
const LIST_LOG_TRANSPORTS_ROUTE = createRoute({
|
|
14
|
-
method: "GET",
|
|
15
|
-
path: "/logs/transports",
|
|
16
|
-
responseType: "json",
|
|
17
|
-
responseSchema: listLogTransportsResponseSchema,
|
|
18
|
-
summary: "List log transports",
|
|
19
|
-
description: "Returns a list of all available log transports",
|
|
20
|
-
tags: ["Logs"],
|
|
21
|
-
requiresAuth: true,
|
|
22
|
-
handler: async ({ mastra }) => {
|
|
23
|
-
try {
|
|
24
|
-
const transports = mastra.getLogger().getTransports();
|
|
25
|
-
return { transports: transports ? [...transports.keys()] : [] };
|
|
26
|
-
} catch (error) {
|
|
27
|
-
return handleError(error, "Error getting log Transports");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const LIST_LOGS_ROUTE = createRoute({
|
|
32
|
-
method: "GET",
|
|
33
|
-
path: "/logs",
|
|
34
|
-
responseType: "json",
|
|
35
|
-
queryParamSchema: listLogsQuerySchema,
|
|
36
|
-
responseSchema: listLogsResponseSchema,
|
|
37
|
-
summary: "List logs",
|
|
38
|
-
description: "Returns logs from a specific transport with optional filtering by date range, log level, and custom filters",
|
|
39
|
-
tags: ["Logs"],
|
|
40
|
-
requiresAuth: true,
|
|
41
|
-
handler: async ({ mastra, ...params }) => {
|
|
42
|
-
try {
|
|
43
|
-
const { transportId, fromDate, toDate, logLevel, filters: _filters, page, perPage } = params;
|
|
44
|
-
validateBody({ transportId });
|
|
45
|
-
const filters = parseFilters(_filters);
|
|
46
|
-
return await mastra.listLogs(transportId, {
|
|
47
|
-
fromDate,
|
|
48
|
-
toDate,
|
|
49
|
-
logLevel,
|
|
50
|
-
filters,
|
|
51
|
-
page: page ? Number(page) : void 0,
|
|
52
|
-
perPage: perPage ? Number(perPage) : void 0
|
|
53
|
-
});
|
|
54
|
-
} catch (error) {
|
|
55
|
-
return handleError(error, "Error getting logs");
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
const LIST_LOGS_BY_RUN_ID_ROUTE = createRoute({
|
|
60
|
-
method: "GET",
|
|
61
|
-
path: "/logs/:runId",
|
|
62
|
-
responseType: "json",
|
|
63
|
-
pathParamSchema: runIdSchema,
|
|
64
|
-
queryParamSchema: listLogsQuerySchema,
|
|
65
|
-
responseSchema: listLogsResponseSchema,
|
|
66
|
-
summary: "List logs by run ID",
|
|
67
|
-
description: "Returns all logs for a specific execution run from a transport",
|
|
68
|
-
tags: ["Logs"],
|
|
69
|
-
requiresAuth: true,
|
|
70
|
-
handler: async ({ mastra, runId, ...params }) => {
|
|
71
|
-
try {
|
|
72
|
-
const { transportId, fromDate, toDate, logLevel, filters: _filters, page, perPage } = params;
|
|
73
|
-
validateBody({
|
|
74
|
-
runId,
|
|
75
|
-
transportId
|
|
76
|
-
});
|
|
77
|
-
const filters = parseFilters(_filters);
|
|
78
|
-
return await mastra.listLogsByRunId({
|
|
79
|
-
runId,
|
|
80
|
-
transportId,
|
|
81
|
-
fromDate,
|
|
82
|
-
toDate,
|
|
83
|
-
logLevel,
|
|
84
|
-
filters,
|
|
85
|
-
page: page ? Number(page) : void 0,
|
|
86
|
-
perPage: perPage ? Number(perPage) : void 0
|
|
87
|
-
});
|
|
88
|
-
} catch (error) {
|
|
89
|
-
return handleError(error, "Error getting logs by run ID");
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
//#endregion
|
|
94
|
-
export { LIST_LOGS_BY_RUN_ID_ROUTE, LIST_LOGS_ROUTE, LIST_LOG_TRANSPORTS_ROUTE, logs_exports as t };
|
|
95
|
-
|
|
96
|
-
//# sourceMappingURL=logs.js.map
|
|
1
|
+
export { t as LIST_LOGS_BY_RUN_ID_ROUTE, n as LIST_LOGS_ROUTE, r as LIST_LOG_TRANSPORTS_ROUTE } from "../../logs-CxfPk-iL.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../../rolldown-runtime-
|
|
2
|
+
require("../../rolldown-runtime-BwC_XMyb.cjs");
|
|
3
3
|
const require_http_exception = require("../../http-exception-CKDHupKw.cjs");
|
|
4
|
-
const require_route_builder = require("../../route-builder-
|
|
5
|
-
const require_utils = require("../../utils-
|
|
4
|
+
const require_route_builder = require("../../route-builder-B2Qhhd7C.cjs");
|
|
5
|
+
const require_utils = require("../../utils-CF76qzZR.cjs");
|
|
6
6
|
const require_server_handlers_error = require("./error.cjs");
|
|
7
7
|
const require_server_handlers_version_helpers = require("./version-helpers.cjs");
|
|
8
8
|
const require_mcp_client_versions = require("../../mcp-client-versions-Cq97zXiK.cjs");
|
|
@@ -71,7 +71,8 @@ const CREATE_MCP_CLIENT_VERSION_ROUTE = require_route_builder.createRoute({
|
|
|
71
71
|
}
|
|
72
72
|
const latestVersion = await mcpClientStore.getLatestVersion(mcpClientId);
|
|
73
73
|
if (!mcpClient.activeVersionId && latestVersion) currentConfig = require_server_handlers_version_helpers.extractConfigFromVersion(latestVersion, require_server_handlers_version_helpers.MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS);
|
|
74
|
-
const
|
|
74
|
+
const previousConfig = latestVersion ? require_server_handlers_version_helpers.extractConfigFromVersion(latestVersion, require_server_handlers_version_helpers.MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS) : null;
|
|
75
|
+
const changedFields = require_server_handlers_version_helpers.calculateChangedFields(previousConfig, currentConfig);
|
|
75
76
|
const { versionId } = await require_server_handlers_version_helpers.createVersionWithRetry(mcpClientStore, mcpClientId, "mcpClientId", currentConfig, changedFields, { changeMessage });
|
|
76
77
|
const version = await mcpClientStore.getVersion(versionId);
|
|
77
78
|
if (!version) throw new require_http_exception.HTTPException(500, { message: "Failed to retrieve created version" });
|
|
@@ -104,7 +105,8 @@ const GET_MCP_CLIENT_VERSION_ROUTE = require_route_builder.createRoute({
|
|
|
104
105
|
const version = await mcpClientStore.getVersion(versionId);
|
|
105
106
|
if (!version) throw new require_http_exception.HTTPException(404, { message: `Version with id ${versionId} not found` });
|
|
106
107
|
if (version.mcpClientId !== mcpClientId) throw new require_http_exception.HTTPException(404, { message: `Version with id ${versionId} not found for MCP client ${mcpClientId}` });
|
|
107
|
-
|
|
108
|
+
const mcpClient = await mcpClientStore.getById(mcpClientId);
|
|
109
|
+
require_utils.assertStoredResourceScope(mcpClient, await require_utils.getStoredResourceScope(mastra, requestContext));
|
|
108
110
|
return version;
|
|
109
111
|
} catch (error) {
|
|
110
112
|
return require_server_handlers_error.handleError(error, "Error getting MCP client version");
|
|
@@ -183,7 +185,9 @@ const RESTORE_MCP_CLIENT_VERSION_ROUTE = require_route_builder.createRoute({
|
|
|
183
185
|
...restoredConfig
|
|
184
186
|
});
|
|
185
187
|
const latestVersion = await mcpClientStore.getLatestVersion(mcpClientId);
|
|
186
|
-
const
|
|
188
|
+
const previousConfig = latestVersion ? require_server_handlers_version_helpers.extractConfigFromVersion(latestVersion, require_server_handlers_version_helpers.MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS) : null;
|
|
189
|
+
const changedFields = require_server_handlers_version_helpers.calculateChangedFields(previousConfig, restoredConfig);
|
|
190
|
+
const { versionId: newVersionId } = await require_server_handlers_version_helpers.createVersionWithRetry(mcpClientStore, mcpClientId, "mcpClientId", restoredConfig, changedFields, { changeMessage: `Restored from version ${versionToRestore.versionNumber}` });
|
|
187
191
|
const newVersion = await mcpClientStore.getVersion(newVersionId);
|
|
188
192
|
if (!newVersion) throw new require_http_exception.HTTPException(500, { message: "Failed to retrieve created version" });
|
|
189
193
|
await require_server_handlers_version_helpers.enforceRetentionLimit(mcpClientStore, mcpClientId, "mcpClientId", mcpClient.activeVersionId);
|
|
@@ -251,15 +255,18 @@ const COMPARE_MCP_CLIENT_VERSIONS_ROUTE = require_route_builder.createRoute({
|
|
|
251
255
|
if (!storage) throw new require_http_exception.HTTPException(500, { message: "Storage is not configured" });
|
|
252
256
|
const mcpClientStore = await storage.getStore("mcpClients");
|
|
253
257
|
if (!mcpClientStore) throw new require_http_exception.HTTPException(500, { message: "MCP clients storage domain is not available" });
|
|
254
|
-
|
|
258
|
+
const mcpClient = await mcpClientStore.getById(mcpClientId);
|
|
259
|
+
require_utils.assertStoredResourceScope(mcpClient, await require_utils.getStoredResourceScope(mastra, requestContext));
|
|
255
260
|
const fromVersion = await mcpClientStore.getVersion(from);
|
|
256
261
|
if (!fromVersion) throw new require_http_exception.HTTPException(404, { message: `Version with id ${from} not found` });
|
|
257
262
|
if (fromVersion.mcpClientId !== mcpClientId) throw new require_http_exception.HTTPException(404, { message: `Version with id ${from} not found for MCP client ${mcpClientId}` });
|
|
258
263
|
const toVersion = await mcpClientStore.getVersion(to);
|
|
259
264
|
if (!toVersion) throw new require_http_exception.HTTPException(404, { message: `Version with id ${to} not found` });
|
|
260
265
|
if (toVersion.mcpClientId !== mcpClientId) throw new require_http_exception.HTTPException(404, { message: `Version with id ${to} not found for MCP client ${mcpClientId}` });
|
|
266
|
+
const fromConfig = require_server_handlers_version_helpers.extractConfigFromVersion(fromVersion, require_server_handlers_version_helpers.MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS);
|
|
267
|
+
const toConfig = require_server_handlers_version_helpers.extractConfigFromVersion(toVersion, require_server_handlers_version_helpers.MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS);
|
|
261
268
|
return {
|
|
262
|
-
diffs: require_server_handlers_version_helpers.computeVersionDiffs(
|
|
269
|
+
diffs: require_server_handlers_version_helpers.computeVersionDiffs(fromConfig, toConfig),
|
|
263
270
|
fromVersion,
|
|
264
271
|
toVersion
|
|
265
272
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-client-versions.cjs","names":["createRoute","mcpClientVersionPathParams","listMCPClientVersionsQuerySchema","listMCPClientVersionsResponseSchema","HTTPException","getStoredResourceScope","handleError","createMCPClientVersionBodySchema","createMCPClientVersionResponseSchema","extractConfigFromVersion","MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS","calculateChangedFields","createVersionWithRetry","enforceRetentionLimit","mcpClientVersionIdPathParams","getMCPClientVersionResponseSchema","activateMCPClientVersionResponseSchema","restoreMCPClientVersionResponseSchema","deleteMCPClientVersionResponseSchema","compareMCPClientVersionsQuerySchema","compareMCPClientVersionsResponseSchema","computeVersionDiffs"],"sources":["../../../src/server/handlers/mcp-client-versions.ts"],"sourcesContent":["import { HTTPException } from '../http-exception';\nimport {\n mcpClientVersionPathParams,\n mcpClientVersionIdPathParams,\n listMCPClientVersionsQuerySchema,\n createMCPClientVersionBodySchema,\n compareMCPClientVersionsQuerySchema,\n listMCPClientVersionsResponseSchema,\n getMCPClientVersionResponseSchema,\n createMCPClientVersionResponseSchema,\n activateMCPClientVersionResponseSchema,\n restoreMCPClientVersionResponseSchema,\n deleteMCPClientVersionResponseSchema,\n compareMCPClientVersionsResponseSchema,\n} from '../schemas/mcp-client-versions';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * GET /stored/mcp-clients/:mcpClientId/versions - List all versions for an MCP client\n */\nexport const LIST_MCP_CLIENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/mcp-clients/:mcpClientId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionPathParams,\n queryParamSchema: listMCPClientVersionsQuerySchema,\n responseSchema: listMCPClientVersionsResponseSchema,\n summary: 'List MCP client versions',\n description: 'Returns a paginated list of all versions for a stored MCP client',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const result = await mcpClientStore.listVersions({\n mcpClientId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing MCP client versions');\n }\n },\n});\n\n/**\n * POST /stored/mcp-clients/:mcpClientId/versions - Create a new version snapshot\n */\nexport const CREATE_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/mcp-clients/:mcpClientId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionPathParams,\n bodySchema: createMCPClientVersionBodySchema,\n responseSchema: createMCPClientVersionResponseSchema,\n summary: 'Create MCP client version',\n description: 'Creates a new version snapshot of the current MCP client configuration',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n let currentConfig: Record<string, unknown> = {};\n if (mcpClient.activeVersionId) {\n const activeVersion = await mcpClientStore.getVersion(mcpClient.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n const latestVersion = await mcpClientStore.getLatestVersion(mcpClientId);\n\n // If no activeVersionId, fall back to latest version config\n if (!mcpClient.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n )\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n const { versionId } = await createVersionWithRetry(\n mcpClientStore as unknown as VersionedStoreInterface,\n mcpClientId,\n 'mcpClientId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n const version = await mcpClientStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n await enforceRetentionLimit(\n mcpClientStore as unknown as VersionedStoreInterface,\n mcpClientId,\n 'mcpClientId',\n mcpClient.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating MCP client version');\n }\n },\n});\n\n/**\n * GET /stored/mcp-clients/:mcpClientId/versions/:versionId - Get a specific version\n */\nexport const GET_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/mcp-clients/:mcpClientId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionIdPathParams,\n responseSchema: getMCPClientVersionResponseSchema,\n summary: 'Get MCP client version',\n description: 'Returns a specific version of an MCP client by its version ID',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const version = await mcpClientStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n if (version.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${versionId} not found for MCP client ${mcpClientId}`,\n });\n }\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting MCP client version');\n }\n },\n});\n\n/**\n * POST /stored/mcp-clients/:mcpClientId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/mcp-clients/:mcpClientId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionIdPathParams,\n responseSchema: activateMCPClientVersionResponseSchema,\n summary: 'Activate MCP client version',\n description: 'Sets a specific version as the active version for the MCP client',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const version = await mcpClientStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${versionId} not found for MCP client ${mcpClientId}`,\n });\n }\n\n await mcpClientStore.update({\n id: mcpClientId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.mcp.clearCache(mcpClientId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating MCP client version');\n }\n },\n});\n\n/**\n * POST /stored/mcp-clients/:mcpClientId/versions/:versionId/restore - Restore MCP client to a version\n */\nexport const RESTORE_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/mcp-clients/:mcpClientId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionIdPathParams,\n responseSchema: restoreMCPClientVersionResponseSchema,\n summary: 'Restore MCP client version',\n description: 'Restores the MCP client configuration from a version, creating a new version',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const versionToRestore = await mcpClientStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${versionId} not found for MCP client ${mcpClientId}`,\n });\n }\n\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n\n await mcpClientStore.update({\n id: mcpClientId,\n ...restoredConfig,\n });\n\n const latestVersion = await mcpClientStore.getLatestVersion(mcpClientId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n )\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n const { versionId: newVersionId } = await createVersionWithRetry(\n mcpClientStore as unknown as VersionedStoreInterface,\n mcpClientId,\n 'mcpClientId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n const newVersion = await mcpClientStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n await enforceRetentionLimit(\n mcpClientStore as unknown as VersionedStoreInterface,\n mcpClientId,\n 'mcpClientId',\n mcpClient.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the updated config\n mastra.getEditor()?.mcp.clearCache(mcpClientId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring MCP client version');\n }\n },\n});\n\n/**\n * DELETE /stored/mcp-clients/:mcpClientId/versions/:versionId - Delete a version\n */\nexport const DELETE_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/mcp-clients/:mcpClientId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionIdPathParams,\n responseSchema: deleteMCPClientVersionResponseSchema,\n summary: 'Delete MCP client version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const version = await mcpClientStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${versionId} not found for MCP client ${mcpClientId}`,\n });\n }\n\n if (mcpClient.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await mcpClientStore.deleteVersion(versionId);\n\n // Clear the editor cache so subsequent requests see the updated config\n mastra.getEditor()?.mcp.clearCache(mcpClientId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting MCP client version');\n }\n },\n});\n\n/**\n * GET /stored/mcp-clients/:mcpClientId/versions/compare - Compare two versions\n */\nexport const COMPARE_MCP_CLIENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/mcp-clients/:mcpClientId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionPathParams,\n queryParamSchema: compareMCPClientVersionsQuerySchema,\n responseSchema: compareMCPClientVersionsResponseSchema,\n summary: 'Compare MCP client versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const fromVersion = await mcpClientStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${from} not found for MCP client ${mcpClientId}`,\n });\n }\n\n const toVersion = await mcpClientStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${to} not found for MCP client ${mcpClientId}`,\n });\n }\n\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error, 'Error comparing MCP client versions');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;A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,oBATKZ,wCAAAA,yBACjB,aACAC,wCAAAA,iCAOyC,GAL1BD,wCAAAA,yBACf,WACAC,wCAAAA,iCAGmD,CAG/C;IACJ;IACA;GACF;EACF,SAAS,OAAO;GACd,OAAOJ,8BAAAA,YAAY,OAAO,qCAAqC;EACjE;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"mcp-client-versions.cjs","names":["createRoute","mcpClientVersionPathParams","listMCPClientVersionsQuerySchema","listMCPClientVersionsResponseSchema","HTTPException","getStoredResourceScope","handleError","createMCPClientVersionBodySchema","createMCPClientVersionResponseSchema","extractConfigFromVersion","MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS","calculateChangedFields","createVersionWithRetry","enforceRetentionLimit","mcpClientVersionIdPathParams","getMCPClientVersionResponseSchema","activateMCPClientVersionResponseSchema","restoreMCPClientVersionResponseSchema","deleteMCPClientVersionResponseSchema","compareMCPClientVersionsQuerySchema","compareMCPClientVersionsResponseSchema","computeVersionDiffs"],"sources":["../../../src/server/handlers/mcp-client-versions.ts"],"sourcesContent":["import { HTTPException } from '../http-exception';\nimport {\n mcpClientVersionPathParams,\n mcpClientVersionIdPathParams,\n listMCPClientVersionsQuerySchema,\n createMCPClientVersionBodySchema,\n compareMCPClientVersionsQuerySchema,\n listMCPClientVersionsResponseSchema,\n getMCPClientVersionResponseSchema,\n createMCPClientVersionResponseSchema,\n activateMCPClientVersionResponseSchema,\n restoreMCPClientVersionResponseSchema,\n deleteMCPClientVersionResponseSchema,\n compareMCPClientVersionsResponseSchema,\n} from '../schemas/mcp-client-versions';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * GET /stored/mcp-clients/:mcpClientId/versions - List all versions for an MCP client\n */\nexport const LIST_MCP_CLIENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/mcp-clients/:mcpClientId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionPathParams,\n queryParamSchema: listMCPClientVersionsQuerySchema,\n responseSchema: listMCPClientVersionsResponseSchema,\n summary: 'List MCP client versions',\n description: 'Returns a paginated list of all versions for a stored MCP client',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const result = await mcpClientStore.listVersions({\n mcpClientId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing MCP client versions');\n }\n },\n});\n\n/**\n * POST /stored/mcp-clients/:mcpClientId/versions - Create a new version snapshot\n */\nexport const CREATE_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/mcp-clients/:mcpClientId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionPathParams,\n bodySchema: createMCPClientVersionBodySchema,\n responseSchema: createMCPClientVersionResponseSchema,\n summary: 'Create MCP client version',\n description: 'Creates a new version snapshot of the current MCP client configuration',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n let currentConfig: Record<string, unknown> = {};\n if (mcpClient.activeVersionId) {\n const activeVersion = await mcpClientStore.getVersion(mcpClient.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n const latestVersion = await mcpClientStore.getLatestVersion(mcpClientId);\n\n // If no activeVersionId, fall back to latest version config\n if (!mcpClient.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n )\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n const { versionId } = await createVersionWithRetry(\n mcpClientStore as unknown as VersionedStoreInterface,\n mcpClientId,\n 'mcpClientId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n const version = await mcpClientStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n await enforceRetentionLimit(\n mcpClientStore as unknown as VersionedStoreInterface,\n mcpClientId,\n 'mcpClientId',\n mcpClient.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating MCP client version');\n }\n },\n});\n\n/**\n * GET /stored/mcp-clients/:mcpClientId/versions/:versionId - Get a specific version\n */\nexport const GET_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/mcp-clients/:mcpClientId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionIdPathParams,\n responseSchema: getMCPClientVersionResponseSchema,\n summary: 'Get MCP client version',\n description: 'Returns a specific version of an MCP client by its version ID',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const version = await mcpClientStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n if (version.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${versionId} not found for MCP client ${mcpClientId}`,\n });\n }\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting MCP client version');\n }\n },\n});\n\n/**\n * POST /stored/mcp-clients/:mcpClientId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/mcp-clients/:mcpClientId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionIdPathParams,\n responseSchema: activateMCPClientVersionResponseSchema,\n summary: 'Activate MCP client version',\n description: 'Sets a specific version as the active version for the MCP client',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const version = await mcpClientStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${versionId} not found for MCP client ${mcpClientId}`,\n });\n }\n\n await mcpClientStore.update({\n id: mcpClientId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.mcp.clearCache(mcpClientId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating MCP client version');\n }\n },\n});\n\n/**\n * POST /stored/mcp-clients/:mcpClientId/versions/:versionId/restore - Restore MCP client to a version\n */\nexport const RESTORE_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/mcp-clients/:mcpClientId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionIdPathParams,\n responseSchema: restoreMCPClientVersionResponseSchema,\n summary: 'Restore MCP client version',\n description: 'Restores the MCP client configuration from a version, creating a new version',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const versionToRestore = await mcpClientStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${versionId} not found for MCP client ${mcpClientId}`,\n });\n }\n\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n\n await mcpClientStore.update({\n id: mcpClientId,\n ...restoredConfig,\n });\n\n const latestVersion = await mcpClientStore.getLatestVersion(mcpClientId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n )\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n const { versionId: newVersionId } = await createVersionWithRetry(\n mcpClientStore as unknown as VersionedStoreInterface,\n mcpClientId,\n 'mcpClientId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n const newVersion = await mcpClientStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n await enforceRetentionLimit(\n mcpClientStore as unknown as VersionedStoreInterface,\n mcpClientId,\n 'mcpClientId',\n mcpClient.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the updated config\n mastra.getEditor()?.mcp.clearCache(mcpClientId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring MCP client version');\n }\n },\n});\n\n/**\n * DELETE /stored/mcp-clients/:mcpClientId/versions/:versionId - Delete a version\n */\nexport const DELETE_MCP_CLIENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/mcp-clients/:mcpClientId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionIdPathParams,\n responseSchema: deleteMCPClientVersionResponseSchema,\n summary: 'Delete MCP client version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n if (!mcpClient) {\n throw new HTTPException(404, { message: `MCP client with id ${mcpClientId} not found` });\n }\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const version = await mcpClientStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${versionId} not found for MCP client ${mcpClientId}`,\n });\n }\n\n if (mcpClient.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await mcpClientStore.deleteVersion(versionId);\n\n // Clear the editor cache so subsequent requests see the updated config\n mastra.getEditor()?.mcp.clearCache(mcpClientId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting MCP client version');\n }\n },\n});\n\n/**\n * GET /stored/mcp-clients/:mcpClientId/versions/compare - Compare two versions\n */\nexport const COMPARE_MCP_CLIENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/mcp-clients/:mcpClientId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: mcpClientVersionPathParams,\n queryParamSchema: compareMCPClientVersionsQuerySchema,\n responseSchema: compareMCPClientVersionsResponseSchema,\n summary: 'Compare MCP client versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['MCP Client Versions'],\n handler: async ({ mastra, mcpClientId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const mcpClientStore = await storage.getStore('mcpClients');\n if (!mcpClientStore) {\n throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n }\n const mcpClient = await mcpClientStore.getById(mcpClientId);\n assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n const fromVersion = await mcpClientStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${from} not found for MCP client ${mcpClientId}`,\n });\n }\n\n const toVersion = await mcpClientStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.mcpClientId !== mcpClientId) {\n throw new HTTPException(404, {\n message: `Version with id ${to} not found for MCP client ${mcpClientId}`,\n });\n }\n\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n );\n\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error, 'Error comparing MCP client versions');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;AAgCA,MAAa,iCAAiCA,sBAAAA,YAAY;CACxD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,cAAc;CACd,iBAAiBC,4BAAAA;CACjB,kBAAkBC,4BAAAA;CAClB,gBAAgBC,4BAAAA;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,qBAAqB;CAC5B,SAAS,OAAO,EAAE,QAAQ,aAAa,MAAM,SAAS,SAAS,qBAAqB;EAClF,IAAI;GACF,MAAM,UAAU,OAAO,WAAW;GAElC,IAAI,CAAC,SACH,M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