@mastra/server 1.79.0-alpha.10 → 1.79.0-alpha.11
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-DUseI2VG.cjs → api-schema-manifest-A2qfi54Y.cjs} +4 -4
- package/dist/{api-schema-manifest-DUseI2VG.cjs.map → api-schema-manifest-A2qfi54Y.cjs.map} +1 -1
- package/dist/{api-schema-manifest-CWRIJP-B.js → api-schema-manifest-Dun5VMRT.js} +3 -3
- package/dist/{api-schema-manifest-CWRIJP-B.js.map → api-schema-manifest-Dun5VMRT.js.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/{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-BTdLh6E_.js +274 -0
- package/dist/mcp-BTdLh6E_.js.map +1 -0
- package/dist/mcp-BYqFR5q-.cjs +339 -0
- package/dist/mcp-BYqFR5q-.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-Dl6_kWm7.js → routes-CKfXiwRc.js} +5 -3
- package/dist/routes-CKfXiwRc.js.map +1 -0
- package/dist/{routes-rwufkyUe.js → routes-D1cP2OeF.js} +26 -26
- package/dist/{routes-rwufkyUe.js.map → routes-D1cP2OeF.js.map} +1 -1
- package/dist/{routes-DPojsNf1.cjs → routes-bxG4x1MV.cjs} +199 -199
- package/dist/{routes-DPojsNf1.cjs.map → routes-bxG4x1MV.cjs.map} +1 -1
- 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-CTTTCgbk.cjs} +3 -3
- package/dist/{schedules-Bj-giFbc.cjs.map → schedules-CTTTCgbk.cjs.map} +1 -1
- package/dist/{schedules-BQYgaz66.js → schedules-DXh37n6-.js} +2 -2
- package/dist/{schedules-BQYgaz66.js.map → schedules-DXh37n6-.js.map} +1 -1
- 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 +12 -289
- 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.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 +6 -6
- package/dist/server/schemas/index.js +3 -3
- 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/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 +4 -4
- 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/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-Dl6_kWm7.js.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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses-CCRijwDF.cjs","names":["HTTPException","getEffectiveThreadId","getEffectiveResourceId","enforceThreadAccess","getAgentFromSystem","getAgentMemoryStore","toResponseStatus","toResponseUsage","persistResponseTurnRecord","resolveResponseTurnMessagesForStorage","buildCompletedResponse","mapResponseInputToExecutionMessages","findResponseTurnRecord","findResponseTurnRecordAcrossAgents","mapMastraToolsToResponseTools","createMessageId","buildInProgressResponse","formatSseEvent","createResponseStreamEventTranslator","createOutputTextPart","createRoute","createResponseBodySchema","responseObjectSchema","MastraFGAPermissions","handleError","responseIdPathParams","mapResponseTurnRecordToResponse","deleteResponseSchema","deleteResponseTurnRecord"],"sources":["../src/server/handlers/responses.ts"],"sourcesContent":["import type { Agent, MastraDBMessage } from '@mastra/core/agent';\nimport type { Mastra } from '@mastra/core/mastra';\nimport type { RequestContext } from '@mastra/core/request-context';\nimport type { MemoryStorage } from '@mastra/core/storage';\nimport { MastraFGAPermissions } from '../fga-permissions';\nimport { HTTPException } from '../http-exception';\nimport {\n createResponseBodySchema,\n deleteResponseSchema,\n responseIdPathParams,\n responseObjectSchema,\n} from '../schemas/responses';\nimport type { CreateResponseBody, DeleteResponse, ResponseObject } from '../schemas/responses';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { getAgentFromSystem } from './agents';\nimport { handleError } from './error';\nimport {\n buildCompletedResponse,\n buildInProgressResponse,\n createResponseStreamEventTranslator,\n createMessageId,\n createOutputTextPart,\n formatSseEvent,\n mapMastraToolsToResponseTools,\n mapResponseInputToExecutionMessages,\n mapResponseTurnRecordToResponse,\n toResponseStatus,\n toResponseUsage,\n} from './responses.adapter';\nimport {\n deleteResponseTurnRecord,\n findResponseTurnRecord,\n findResponseTurnRecordAcrossAgents,\n getAgentMemoryStore,\n persistResponseTurnRecord,\n resolveResponseTurnMessagesForStorage,\n} from './responses.storage';\nimport type {\n ProviderMetadataLike,\n ResponseTurnRecord,\n ResponseTurnRecordMetadata,\n ThreadExecutionContext,\n UsageLike,\n} from './responses.storage';\nimport { enforceThreadAccess, getEffectiveResourceId, getEffectiveThreadId } from './utils';\n\ntype AgentExecutionInput = Parameters<Agent['generate']>[0];\ntype ResolvedAgentModel = Awaited<ReturnType<Agent['getModel']>>;\n\ntype ResponseExecutionResult = {\n text?: string;\n finishReason?: string;\n totalUsage?: UsageLike | Promise<UsageLike>;\n usage?: UsageLike | Promise<UsageLike>;\n providerMetadata?: ProviderMetadataLike | Promise<ProviderMetadataLike>;\n response?: {\n id?: string;\n dbMessages?: MastraDBMessage[];\n };\n};\n\ntype ResponseStreamResult = {\n fullStream: ReadableStream<unknown> | Promise<ReadableStream<unknown>>;\n text: Promise<string> | string;\n finishReason: Promise<string | undefined> | string | undefined;\n totalUsage?: Promise<UsageLike> | UsageLike;\n usage?: Promise<UsageLike> | UsageLike;\n providerMetadata?: Promise<ProviderMetadataLike> | ProviderMetadataLike;\n response?:\n | Promise<{\n id?: string;\n dbMessages?: MastraDBMessage[];\n }>\n | {\n id?: string;\n dbMessages?: MastraDBMessage[];\n };\n};\n\ntype CompletedResponseState = {\n completedAt: number;\n status: ResponseObject['status'];\n text: string;\n usage: UsageLike;\n usageDetails: ResponseObject['usage'];\n providerOptions: ProviderMetadataLike;\n};\n\ntype FinalizedResponse = {\n completedState: CompletedResponseState;\n response: ResponseObject;\n responseMessages: MastraDBMessage[];\n};\n\ntype PreparedCreateResponseRequest = {\n agent: Agent<any, any, any, any>;\n agentMemoryStore: MemoryStorage | null;\n configuredTools: ReturnType<typeof mapMastraToolsToResponseTools>;\n createdAt: number;\n didStore: boolean;\n executionInput: AgentExecutionInput;\n previousResponseTurnRecord: ResponseTurnRecord | null;\n resolvedModel: ResolvedAgentModel;\n responseId: string;\n responseModel: string;\n responseMetadata: Omit<\n ResponseTurnRecordMetadata,\n 'completedAt' | 'status' | 'usage' | 'providerOptions' | 'messageIds'\n >;\n threadContext: ThreadExecutionContext | null;\n};\n\nconst JSON_OBJECT_RESPONSE_SCHEMA = {\n type: 'object',\n additionalProperties: true,\n} as const;\n\nfunction jsonResponse(data: ResponseObject, status: number = 200): Response {\n return new Response(JSON.stringify(data), {\n status,\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n}\n\nfunction createStructuredOutput(text: CreateResponseBody['text']) {\n if (!text) {\n return undefined;\n }\n\n switch (text.format.type) {\n case 'json_object':\n return {\n schema: JSON_OBJECT_RESPONSE_SCHEMA,\n jsonPromptInjection: true,\n };\n case 'json_schema':\n return {\n schema: text.format.schema,\n };\n default:\n return undefined;\n }\n}\n\nfunction getStreamedMessageOutputItem(response: ResponseObject, responseId: string) {\n return (\n response.output.find(\n (item): item is Extract<ResponseObject['output'][number], { type: 'message' }> =>\n item.type === 'message' && item.id === responseId,\n ) ?? null\n );\n}\n\n/**\n * Resolves the memory thread that should back the current response request.\n *\n * If `previous_response_id` is present, the request continues on that stored thread.\n * Otherwise, the route only creates or reuses a thread when the caller asked to store\n * the response and the resolved agent actually has memory configured.\n */\nasync function resolveThreadExecutionContext({\n agent,\n store,\n conversationId,\n previousResponseTurnRecord,\n requestContext,\n}: {\n agent: Agent<any, any, any, any>;\n store: boolean;\n conversationId?: string;\n previousResponseTurnRecord: ResponseTurnRecord | null;\n requestContext: RequestContext;\n}): Promise<ThreadExecutionContext | null> {\n if (conversationId && previousResponseTurnRecord && previousResponseTurnRecord.thread.id !== conversationId) {\n throw new HTTPException(400, {\n message:\n 'conversation_id and previous_response_id must reference the same conversation thread when both are provided',\n });\n }\n\n if (previousResponseTurnRecord) {\n return {\n threadId: previousResponseTurnRecord.thread.id,\n resourceId: previousResponseTurnRecord.thread.resourceId,\n };\n }\n\n const effectiveThreadId = getEffectiveThreadId(requestContext, undefined);\n const effectiveResourceId = getEffectiveResourceId(requestContext, undefined);\n\n if (!store && !conversationId && !effectiveThreadId) {\n return null;\n }\n\n const memory = await agent.getMemory({ requestContext });\n if (!memory) {\n if (conversationId) {\n throw new HTTPException(400, {\n message: 'conversation_id requires the target agent to have memory configured',\n });\n }\n\n return null;\n }\n\n if (conversationId) {\n const existingThread = await memory.getThreadById({ threadId: conversationId });\n if (!existingThread) {\n throw new HTTPException(404, { message: `Conversation ${conversationId} was not found` });\n }\n\n await enforceThreadAccess({\n mastra: agent.getMastraInstance(),\n requestContext,\n threadId: conversationId,\n thread: existingThread,\n effectiveResourceId,\n });\n return {\n threadId: existingThread.id,\n resourceId: effectiveResourceId ?? existingThread.resourceId,\n };\n }\n\n if (!effectiveThreadId) {\n if (!store) {\n return null;\n }\n\n const threadId = globalThis.crypto.randomUUID();\n const createdThread = await memory.createThread({\n threadId,\n resourceId: effectiveResourceId ?? threadId,\n });\n\n return {\n threadId: createdThread.id,\n resourceId: createdThread.resourceId,\n };\n }\n\n const threadId = effectiveThreadId;\n const existingThread = await memory.getThreadById({ threadId });\n if (existingThread) {\n await enforceThreadAccess({\n mastra: agent.getMastraInstance(),\n requestContext,\n threadId,\n thread: existingThread,\n effectiveResourceId,\n });\n return {\n threadId: existingThread.id,\n resourceId: effectiveResourceId ?? existingThread.resourceId,\n };\n }\n\n if (!store) {\n return null;\n }\n\n const resourceId = effectiveResourceId ?? threadId;\n const createdThread = await memory.createThread({\n threadId,\n resourceId,\n });\n\n return {\n threadId: createdThread.id,\n resourceId: createdThread.resourceId,\n };\n}\n\nfunction createExecutionMemory(threadContext: ThreadExecutionContext | null) {\n if (!threadContext) {\n return undefined;\n }\n\n return {\n memory: {\n thread: threadContext.threadId,\n resource: threadContext.resourceId,\n },\n } as const;\n}\n\n/**\n * Resolves the registered Mastra agent that owns the response request.\n */\nasync function resolveResponseAgent({\n mastra,\n agentId,\n}: {\n mastra: Mastra | undefined;\n agentId?: string;\n}): Promise<Agent<any, any, any, any>> {\n if (!agentId) {\n throw new HTTPException(400, {\n message: 'Responses requests require an agent_id',\n });\n }\n\n if (!mastra) {\n throw new HTTPException(500, { message: 'Mastra instance is required for agent-backed responses' });\n }\n\n return getAgentFromSystem({ mastra, agentId });\n}\n\nasync function resolveAgentMemoryStore({\n agent,\n requestContext,\n errorMessage,\n}: {\n agent: Agent<any, any, any, any>;\n requestContext: RequestContext;\n errorMessage: string;\n}): Promise<MemoryStorage> {\n const agentMemoryStore = await getAgentMemoryStore({ agent, requestContext });\n if (!agentMemoryStore) {\n throw new HTTPException(400, { message: errorMessage });\n }\n\n return agentMemoryStore;\n}\n\n/**\n * Executes a non-streaming Responses API request through the resolved Mastra agent.\n */\nasync function executeGenerate({\n agent,\n resolvedModel,\n modelOverride,\n instructions,\n text,\n providerOptions,\n input,\n requestContext,\n abortSignal,\n threadContext,\n}: {\n agent: Agent;\n resolvedModel: ResolvedAgentModel;\n modelOverride?: string;\n instructions: string | undefined;\n text: CreateResponseBody['text'];\n providerOptions: CreateResponseBody['providerOptions'];\n input: AgentExecutionInput;\n requestContext: RequestContext;\n abortSignal: AbortSignal;\n threadContext: ThreadExecutionContext | null;\n}) {\n const executionMemory = createExecutionMemory(threadContext);\n const structuredOutput = createStructuredOutput(text);\n const modelOption = modelOverride ? { model: modelOverride } : {};\n const commonOptions = {\n instructions,\n requestContext,\n abortSignal,\n ...modelOption,\n structuredOutput,\n providerOptions,\n ...(executionMemory ?? {}),\n };\n\n if (resolvedModel.specificationVersion === 'v1') {\n if (threadContext) {\n return (await agent.generateLegacy(input, {\n instructions,\n requestContext,\n abortSignal,\n ...modelOption,\n output: structuredOutput?.schema,\n providerOptions,\n resourceId: threadContext.resourceId,\n threadId: threadContext.threadId,\n } as never)) as ResponseExecutionResult;\n }\n\n return (await agent.generateLegacy(input, {\n instructions,\n requestContext,\n abortSignal,\n ...modelOption,\n output: structuredOutput?.schema,\n providerOptions,\n } as never)) as ResponseExecutionResult;\n }\n\n return (await agent.generate(input, commonOptions as never)) as ResponseExecutionResult;\n}\n\n/**\n * Executes a streaming Responses API request through the resolved Mastra agent.\n */\nasync function executeStream({\n agent,\n resolvedModel,\n modelOverride,\n instructions,\n text,\n providerOptions,\n input,\n requestContext,\n abortSignal,\n threadContext,\n}: {\n agent: Agent;\n resolvedModel: ResolvedAgentModel;\n modelOverride?: string;\n instructions: string | undefined;\n text: CreateResponseBody['text'];\n providerOptions: CreateResponseBody['providerOptions'];\n input: AgentExecutionInput;\n requestContext: RequestContext;\n abortSignal: AbortSignal;\n threadContext: ThreadExecutionContext | null;\n}) {\n const executionMemory = createExecutionMemory(threadContext);\n const structuredOutput = createStructuredOutput(text);\n const modelOption = modelOverride ? { model: modelOverride } : {};\n const commonOptions = {\n instructions,\n requestContext,\n abortSignal,\n ...modelOption,\n structuredOutput,\n providerOptions,\n ...(executionMemory ?? {}),\n };\n\n if (resolvedModel.specificationVersion === 'v1') {\n if (threadContext) {\n return (await agent.streamLegacy(input, {\n instructions,\n requestContext,\n abortSignal,\n ...modelOption,\n output: structuredOutput?.schema,\n providerOptions,\n resourceId: threadContext.resourceId,\n threadId: threadContext.threadId,\n } as never)) as ResponseStreamResult;\n }\n\n return (await agent.streamLegacy(input, {\n instructions,\n requestContext,\n abortSignal,\n ...modelOption,\n output: structuredOutput?.schema,\n providerOptions,\n } as never)) as ResponseStreamResult;\n }\n\n return (await agent.stream(input, commonOptions as never)) as ResponseStreamResult;\n}\n\nasync function resolveUsage(result: ResponseExecutionResult | ResponseStreamResult): Promise<UsageLike> {\n return (await (result.totalUsage ?? result.usage ?? null)) as UsageLike;\n}\n\nasync function resolveProviderMetadata(\n result: ResponseExecutionResult | ResponseStreamResult,\n): Promise<ProviderMetadataLike> {\n return (await (result.providerMetadata ?? undefined)) as ProviderMetadataLike;\n}\n\nasync function resolveFinishReason(\n result: ResponseExecutionResult | ResponseStreamResult,\n): Promise<string | undefined> {\n return (await result.finishReason) ?? undefined;\n}\n\nasync function resolveText(result: ResponseExecutionResult | ResponseStreamResult): Promise<string> {\n return (await result.text) ?? '';\n}\n\n/**\n * Resolves the final response state shared by streaming and non-streaming flows.\n */\nasync function resolveCompletedResponseState(\n result: ResponseExecutionResult | ResponseStreamResult,\n fallbackText: string,\n): Promise<CompletedResponseState> {\n const usage = await resolveUsage(result);\n\n return {\n completedAt: Math.floor(Date.now() / 1000),\n status: toResponseStatus(await resolveFinishReason(result)),\n text: (await resolveText(result)) || fallbackText,\n usage,\n usageDetails: toResponseUsage(usage),\n providerOptions: await resolveProviderMetadata(result),\n };\n}\n\n/**\n * Stores the completed response when the request opted into memory-backed persistence.\n */\nasync function storeCompletedResponse({\n agentMemoryStore,\n didStore,\n threadContext,\n responseId,\n metadata,\n completedState,\n messages,\n outputItems,\n}: {\n agentMemoryStore: MemoryStorage | null;\n didStore: boolean;\n threadContext: ThreadExecutionContext | null;\n responseId: string;\n metadata: Omit<ResponseTurnRecordMetadata, 'completedAt' | 'status' | 'usage' | 'providerOptions' | 'messageIds'>;\n completedState: CompletedResponseState;\n messages: MastraDBMessage[];\n outputItems: ResponseObject['output'];\n}): Promise<void> {\n if (!didStore || !threadContext) {\n return;\n }\n\n await persistResponseTurnRecord({\n memoryStore: agentMemoryStore,\n responseId,\n metadata: {\n ...metadata,\n completedAt: completedState.completedAt,\n status: completedState.status,\n usage: completedState.usageDetails,\n providerOptions: completedState.providerOptions,\n messageIds: [],\n outputItems,\n },\n threadContext,\n messages,\n });\n}\n\n/**\n * Resolves the final response object and persists the stored response turn when needed.\n */\nasync function finalizeResponse({\n agentMemoryStore,\n didStore,\n threadContext,\n result,\n responseId,\n createdAt,\n model,\n instructions,\n previousResponseId,\n conversationId,\n configuredTools,\n responseMetadata,\n fallbackText,\n fallbackOutputItems,\n}: {\n agentMemoryStore: MemoryStorage | null;\n didStore: boolean;\n threadContext: ThreadExecutionContext | null;\n result: ResponseExecutionResult | ResponseStreamResult;\n responseId: string;\n createdAt: number;\n model: string;\n instructions: string | undefined;\n previousResponseId?: string;\n conversationId?: string;\n configuredTools: ReturnType<typeof mapMastraToolsToResponseTools>;\n responseMetadata: Omit<\n ResponseTurnRecordMetadata,\n 'completedAt' | 'status' | 'usage' | 'providerOptions' | 'messageIds'\n >;\n fallbackText: string;\n fallbackOutputItems?: (completedState: CompletedResponseState) => ResponseObject['output'];\n}): Promise<FinalizedResponse> {\n const completedState = await resolveCompletedResponseState(result, fallbackText);\n const fallbackItems = fallbackOutputItems?.(completedState);\n const responseMessages = await resolveResponseTurnMessagesForStorage({\n result,\n responseId,\n text: completedState.text,\n threadContext,\n fallbackOutputItems: threadContext ? fallbackItems : undefined,\n });\n const response = buildCompletedResponse({\n responseId,\n outputMessageId: responseId,\n model,\n createdAt,\n completedAt: completedState.completedAt,\n status: completedState.status,\n text: completedState.text,\n usage: completedState.usage,\n instructions,\n textConfig: responseMetadata.text,\n previousResponseId,\n conversationId,\n providerOptions: completedState.providerOptions,\n tools: configuredTools,\n messages: responseMessages,\n fallbackOutputItems: fallbackItems,\n store: didStore,\n });\n\n await storeCompletedResponse({\n agentMemoryStore,\n didStore,\n threadContext,\n responseId,\n metadata: responseMetadata,\n completedState,\n messages: responseMessages,\n outputItems: response.output,\n });\n\n return { completedState, response, responseMessages };\n}\n\n/**\n * Resolves all request-scoped Mastra primitives needed to execute a Responses create\n * call: the owning agent, the memory thread context, the normalized execution input,\n * and the response-turn metadata that may be persisted later.\n */\nasync function prepareCreateResponseRequest({\n body,\n mastra,\n requestContext,\n}: {\n body: CreateResponseBody;\n mastra: Mastra | undefined;\n requestContext: RequestContext;\n}): Promise<PreparedCreateResponseRequest> {\n const executionInput = mapResponseInputToExecutionMessages(body.input) as AgentExecutionInput;\n let previousResponseTurnRecord: ResponseTurnRecord | null = null;\n let resolvedAgent: Agent<any, any, any, any> | null = null;\n\n if (body.previous_response_id) {\n if (body.agent_id) {\n resolvedAgent = await resolveResponseAgent({ mastra, agentId: body.agent_id });\n previousResponseTurnRecord = await findResponseTurnRecord({\n agent: resolvedAgent,\n responseId: body.previous_response_id,\n requestContext,\n });\n\n if (!previousResponseTurnRecord) {\n const owningResponseTurnRecord = await findResponseTurnRecordAcrossAgents({\n mastra,\n responseId: body.previous_response_id,\n requestContext,\n });\n\n if (owningResponseTurnRecord) {\n if (owningResponseTurnRecord.metadata.agentId === body.agent_id) {\n previousResponseTurnRecord = owningResponseTurnRecord;\n } else {\n throw new HTTPException(400, {\n message: `Stored response ${body.previous_response_id} belongs to agent ${owningResponseTurnRecord.metadata.agentId}, not ${body.agent_id}`,\n });\n }\n }\n\n if (!previousResponseTurnRecord) {\n throw new HTTPException(404, { message: `Stored response ${body.previous_response_id} was not found` });\n }\n }\n } else {\n if (!mastra) {\n throw new HTTPException(500, { message: 'Mastra instance is required for agent-backed responses' });\n }\n\n previousResponseTurnRecord = await findResponseTurnRecordAcrossAgents({\n mastra,\n responseId: body.previous_response_id,\n requestContext,\n });\n\n if (!previousResponseTurnRecord) {\n throw new HTTPException(404, { message: `Stored response ${body.previous_response_id} was not found` });\n }\n }\n }\n\n const agent =\n resolvedAgent ??\n (await resolveResponseAgent({\n mastra,\n agentId: body.agent_id ?? previousResponseTurnRecord?.metadata.agentId,\n }));\n const resolvedModel = await agent.getModel({\n requestContext,\n modelConfig: body.model,\n });\n const responseModel =\n body.model ??\n (() => {\n if (resolvedModel.provider && resolvedModel.modelId) {\n const publicProviderId = resolvedModel.provider.includes('.')\n ? resolvedModel.provider.split('.')[0]!\n : resolvedModel.provider;\n return `${publicProviderId}/${resolvedModel.modelId}`;\n }\n\n if (resolvedModel.modelId) {\n return resolvedModel.modelId;\n }\n\n throw new HTTPException(500, {\n message: 'Responses route could not determine the effective model for this request',\n });\n })();\n const shouldStore = body.store ?? false;\n const needsMemoryStore = shouldStore || Boolean(body.conversation_id) || Boolean(body.previous_response_id);\n const agentMemoryStore = needsMemoryStore\n ? await resolveAgentMemoryStore({\n agent,\n requestContext,\n errorMessage: body.previous_response_id\n ? 'previous_response_id requires the target agent to have memory storage configured'\n : shouldStore\n ? 'Stored responses require the target agent to have memory storage configured'\n : 'conversation_id requires the target agent to have memory storage configured',\n })\n : null;\n const configuredTools = mapMastraToolsToResponseTools(\n (await Promise.resolve(agent.listTools({ requestContext }))) as Record<string, unknown>,\n );\n\n const responseId = createMessageId();\n const createdAt = Math.floor(Date.now() / 1000);\n const threadContext = await resolveThreadExecutionContext({\n agent,\n store: shouldStore,\n conversationId: body.conversation_id,\n previousResponseTurnRecord,\n requestContext,\n });\n\n if (shouldStore && !threadContext) {\n throw new HTTPException(400, {\n message: 'Stored responses require the target agent to have memory configured',\n });\n }\n\n const didStore = shouldStore && Boolean(threadContext);\n\n return {\n agent,\n agentMemoryStore,\n configuredTools,\n createdAt,\n didStore,\n executionInput,\n previousResponseTurnRecord,\n resolvedModel,\n responseId,\n responseModel,\n responseMetadata: {\n agentId: agent.id,\n model: responseModel,\n createdAt,\n instructions: body.instructions,\n text: body.text,\n previousResponseId: previousResponseTurnRecord?.message.id ?? body.previous_response_id,\n tools: configuredTools,\n store: didStore,\n },\n threadContext,\n };\n}\n\n/**\n * Bridges a Mastra agent stream into OpenAI-style Responses SSE events and completes\n * the stored response-turn record when the stream finishes.\n */\nfunction createResponseEventStream({\n agentMemoryStore,\n body,\n configuredTools,\n createdAt,\n didStore,\n previousResponseTurnRecord,\n responseId,\n responseModel,\n responseMetadata,\n streamResult,\n threadContext,\n}: {\n agentMemoryStore: MemoryStorage | null;\n body: CreateResponseBody;\n configuredTools: ReturnType<typeof mapMastraToolsToResponseTools>;\n createdAt: number;\n didStore: boolean;\n previousResponseTurnRecord: ResponseTurnRecord | null;\n responseId: string;\n responseModel: string;\n responseMetadata: Omit<\n ResponseTurnRecordMetadata,\n 'completedAt' | 'status' | 'usage' | 'providerOptions' | 'messageIds'\n >;\n streamResult: ResponseStreamResult;\n threadContext: ThreadExecutionContext | null;\n}) {\n const createdResponse = buildInProgressResponse({\n responseId,\n model: responseModel,\n createdAt,\n instructions: body.instructions,\n textConfig: body.text,\n previousResponseId: body.previous_response_id,\n conversationId: threadContext?.threadId ?? body.conversation_id,\n tools: configuredTools,\n store: didStore,\n });\n\n return new ReadableStream<Uint8Array>({\n async start(controller) {\n let sequenceNumber = 1;\n const enqueueEvent = (eventName: string, payload: Record<string, unknown>) => {\n controller.enqueue(\n formatSseEvent(eventName, {\n ...payload,\n sequence_number: sequenceNumber++,\n }),\n );\n };\n\n enqueueEvent('response.created', {\n type: 'response.created',\n response: createdResponse,\n });\n enqueueEvent('response.in_progress', {\n type: 'response.in_progress',\n response: createdResponse,\n });\n\n const streamEvents = createResponseStreamEventTranslator(responseId);\n const fullStream = await streamResult.fullStream;\n const reader = fullStream.getReader();\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n for (const event of streamEvents.consume(value)) {\n enqueueEvent(event.event, event.payload);\n }\n }\n\n for (const event of streamEvents.flushPendingToolResults()) {\n enqueueEvent(event.event, event.payload);\n }\n\n const { completedState, response } = await finalizeResponse({\n agentMemoryStore,\n didStore,\n threadContext,\n result: streamResult,\n responseId,\n createdAt,\n model: responseModel,\n instructions: body.instructions,\n previousResponseId: previousResponseTurnRecord?.message.id ?? body.previous_response_id,\n conversationId: threadContext?.threadId ?? body.conversation_id,\n configuredTools,\n responseMetadata,\n fallbackText: streamEvents.text,\n fallbackOutputItems: completedState =>\n streamEvents.getOutputItems({\n text: completedState.text,\n status: completedState.status,\n }),\n });\n\n const completedItem = getStreamedMessageOutputItem(response, responseId);\n if (completedItem || completedState.text) {\n for (const event of streamEvents.completeText(\n completedState.text,\n completedItem ?? {\n id: responseId,\n type: 'message' as const,\n role: 'assistant' as const,\n status: 'completed' as const,\n content: [createOutputTextPart(completedState.text)],\n },\n )) {\n enqueueEvent(event.event, event.payload);\n }\n }\n enqueueEvent('response.completed', {\n type: 'response.completed',\n response,\n });\n controller.close();\n } catch (error) {\n controller.error(error);\n } finally {\n reader.releaseLock();\n }\n },\n });\n}\n\nexport const CREATE_RESPONSE_ROUTE = createRoute({\n method: 'POST',\n path: '/v1/responses',\n responseType: 'datastream-response',\n bodySchema: createResponseBodySchema,\n responseSchema: responseObjectSchema,\n summary: 'Create a response',\n description: 'Creates a response through a Mastra-hosted Responses API-compatible route',\n tags: ['Responses'],\n requiresAuth: true,\n requiresPermission: MastraFGAPermissions.AGENTS_EXECUTE,\n handler: async ({ mastra, requestContext, abortSignal, ...body }) => {\n try {\n const {\n agent,\n agentMemoryStore,\n configuredTools,\n createdAt,\n didStore,\n executionInput,\n previousResponseTurnRecord,\n resolvedModel,\n responseId,\n responseModel,\n responseMetadata,\n threadContext,\n } = await prepareCreateResponseRequest({ body, mastra, requestContext });\n\n if (!body.stream) {\n const result = await executeGenerate({\n agent,\n resolvedModel,\n modelOverride: body.model,\n instructions: body.instructions,\n text: body.text,\n providerOptions: body.providerOptions,\n input: executionInput,\n requestContext,\n abortSignal,\n threadContext,\n });\n\n const { response } = await finalizeResponse({\n agentMemoryStore,\n didStore,\n threadContext,\n result,\n responseId,\n createdAt,\n model: responseModel,\n instructions: body.instructions,\n previousResponseId: previousResponseTurnRecord?.message.id ?? body.previous_response_id,\n conversationId: threadContext?.threadId ?? body.conversation_id,\n configuredTools,\n responseMetadata,\n fallbackText: '',\n });\n\n return jsonResponse(response);\n }\n\n const streamResult = await executeStream({\n agent,\n resolvedModel,\n modelOverride: body.model,\n instructions: body.instructions,\n text: body.text,\n providerOptions: body.providerOptions,\n input: executionInput,\n requestContext,\n abortSignal,\n threadContext,\n });\n\n const stream = createResponseEventStream({\n agentMemoryStore,\n body,\n configuredTools,\n createdAt,\n didStore,\n previousResponseTurnRecord,\n responseId,\n responseModel,\n responseMetadata,\n streamResult,\n threadContext,\n });\n\n return new Response(stream, {\n headers: {\n 'Content-Type': 'text/event-stream; charset=utf-8',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n 'X-Accel-Buffering': 'no',\n },\n });\n } catch (error) {\n return handleError(error, 'Error creating response');\n }\n },\n});\n\nexport const GET_RESPONSE_ROUTE = createRoute({\n method: 'GET',\n path: '/v1/responses/:responseId',\n responseType: 'json',\n pathParamSchema: responseIdPathParams,\n responseSchema: responseObjectSchema,\n summary: 'Retrieve a stored response',\n description: 'Returns a previously stored response object',\n tags: ['Responses'],\n requiresAuth: true,\n requiresPermission: MastraFGAPermissions.AGENTS_READ,\n handler: async ({ mastra, requestContext, responseId }) => {\n try {\n const responseTurnRecord = await findResponseTurnRecordAcrossAgents({ mastra, responseId, requestContext });\n if (!responseTurnRecord) {\n throw new HTTPException(404, { message: `Stored response ${responseId} was not found` });\n }\n\n return mapResponseTurnRecordToResponse(responseTurnRecord);\n } catch (error) {\n return handleError(error, 'Error retrieving response');\n }\n },\n});\n\nexport const DELETE_RESPONSE_ROUTE = createRoute({\n method: 'DELETE',\n path: '/v1/responses/:responseId',\n responseType: 'json',\n pathParamSchema: responseIdPathParams,\n responseSchema: deleteResponseSchema,\n summary: 'Delete a stored response',\n description: 'Deletes a stored response so it can no longer be retrieved or chained',\n tags: ['Responses'],\n requiresAuth: true,\n requiresPermission: MastraFGAPermissions.AGENTS_DELETE,\n handler: async ({ mastra, requestContext, responseId }) => {\n try {\n const responseTurnRecord = await findResponseTurnRecordAcrossAgents({ mastra, responseId, requestContext });\n if (!responseTurnRecord) {\n throw new HTTPException(404, { message: `Stored response ${responseId} was not found` });\n }\n\n await deleteResponseTurnRecord({ responseTurnRecord });\n\n const response: DeleteResponse = {\n id: responseId,\n object: 'response',\n deleted: true,\n };\n\n return response;\n } catch (error) {\n return handleError(error, 'Error deleting response');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;AAgHA,MAAM,8BAA8B;CAClC,MAAM;CACN,sBAAsB;AACxB;AAEA,SAAS,aAAa,MAAsB,SAAiB,KAAe;CAC1E,OAAO,IAAI,SAAS,KAAK,UAAU,IAAI,GAAG;EACxC;EACA,SAAS,EACP,gBAAgB,mBAClB;CACF,CAAC;AACH;AAEA,SAAS,uBAAuB,MAAkC;CAChE,IAAI,CAAC,MACH;CAGF,QAAQ,KAAK,OAAO,MAApB;EACE,KAAK,eACH,OAAO;GACL,QAAQ;GACR,qBAAqB;EACvB;EACF,KAAK,eACH,OAAO,EACL,QAAQ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,YAAY,OAAO,2BAA2B;EACvD;CACF;AACF,CAAC;AAED,MAAa,wBAAwBJ,sBAAAA,YAAY;CAC/C,QAAQ;CACR,MAAM;CACN,cAAc;CACd,iBAAiBK,kBAAAA;CACjB,gBAAgBE,kBAAAA;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,WAAW;CAClB,cAAc;CACd,oBAAoBJ,cAAAA,qBAAqB;CACzC,SAAS,OAAO,EAAE,QAAQ,gBAAgB,iBAAiB;EACzD,IAAI;GACF,MAAM,qBAAqB,MAAMV,0CAAAA,mCAAmC;IAAE;IAAQ;IAAY;GAAe,CAAC;GAC1G,IAAI,CAAC,oBACH,MAAM,IAAIb,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,WAAW,gBAAgB,CAAC;GAGzF,MAAM4B,0CAAAA,yBAAyB,EAAE,mBAAmB,CAAC;GAQrD,OAAO;IALL,IAAI;IACJ,QAAQ;IACR,SAAS;GAGG;EAChB,SAAS,OAAO;GACd,OAAOJ,8BAAAA,YAAY,OAAO,yBAAyB;EACrD;CACF;AACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-BwC_XMyb.cjs");
|
|
2
2
|
let zod = require("zod");
|
|
3
3
|
zod = require_rolldown_runtime.__toESM(zod, 1);
|
|
4
4
|
//#region src/server/schemas/responses.ts
|
|
@@ -262,4 +262,4 @@ Object.defineProperty(exports, "responseUsageSchema", {
|
|
|
262
262
|
}
|
|
263
263
|
});
|
|
264
264
|
|
|
265
|
-
//# sourceMappingURL=responses-
|
|
265
|
+
//# sourceMappingURL=responses-CfcIc53b.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses-CKNdSRkS.cjs","names":["z"],"sources":["../src/server/schemas/responses.ts"],"sourcesContent":["import z from 'zod';\n\nexport const responseIdPathParams = z.object({\n responseId: z.string().describe('Unique identifier for the stored response'),\n});\n\nexport const responseInputTextPartSchema = z.object({\n type: z.enum(['input_text', 'text', 'output_text']),\n text: z.string(),\n});\n\nexport const responseInputMessageSchema = z.object({\n role: z.enum(['system', 'developer', 'user', 'assistant']),\n content: z.union([z.string(), z.array(responseInputTextPartSchema)]),\n});\n\nexport type ResponseInputMessage = z.infer<typeof responseInputMessageSchema>;\n\nconst providerOptionValuesSchema = z.record(z.string(), z.unknown());\n\nconst providerOptionsSchema = z\n .object({\n openai: providerOptionValuesSchema\n .optional()\n .describe('OpenAI provider options such as previousResponseId, conversation, or responseId'),\n azure: providerOptionValuesSchema\n .optional()\n .describe('Azure OpenAI provider options such as previousResponseId, store, or itemId'),\n })\n .passthrough();\n\nconst responseTextFormatJsonObjectSchema = z.object({\n type: z.literal('json_object').describe('Requests JSON object output compatibility for the response'),\n});\n\nconst responseTextFormatJsonSchemaSchema = z.object({\n type: z.literal('json_schema'),\n name: z.string(),\n description: z.string().optional(),\n schema: z.record(z.string(), z.unknown()),\n strict: z.boolean().optional(),\n});\n\nexport const responseTextFormatSchema = z.union([\n responseTextFormatJsonObjectSchema,\n responseTextFormatJsonSchemaSchema,\n]);\n\nexport type ResponseTextFormat = z.infer<typeof responseTextFormatSchema>;\n\nconst responseTextSchema = z.object({\n format: responseTextFormatSchema,\n});\n\nexport type ResponseTextConfig = z.infer<typeof responseTextSchema>;\n\nexport const createResponseBodySchema = z\n .object({\n model: z\n .string()\n .optional()\n .describe(\n 'Optional model identifier override, such as openai/gpt-5. When omitted, the agent default model is used.',\n ),\n agent_id: z\n .string()\n .min(1)\n .optional()\n .describe('Mastra agent ID for the request. Required unless previous_response_id is provided.'),\n input: z.union([z.string(), z.array(responseInputMessageSchema)]),\n instructions: z.string().optional(),\n text: responseTextSchema\n .optional()\n .describe(\n 'Optional text output format. Supports `json_object` for JSON mode and `json_schema` for schema-constrained structured output.',\n ),\n conversation_id: z.string().optional().describe('Optional conversation ID. In Mastra this is the raw threadId.'),\n providerOptions: providerOptionsSchema\n .optional()\n .describe('Optional provider-specific options passed through to the underlying model call'),\n stream: z.boolean().optional().default(false),\n store: z.boolean().optional().default(false),\n previous_response_id: z.string().min(1).optional(),\n })\n .passthrough()\n .refine(data => data.agent_id || data.previous_response_id, {\n message: 'agent_id is required unless previous_response_id is provided',\n path: [],\n });\n\nexport type CreateResponseBody = z.infer<typeof createResponseBodySchema>;\n\nexport const responseOutputTextSchema = z.object({\n type: z.literal('output_text'),\n text: z.string(),\n annotations: z.array(z.unknown()).optional(),\n logprobs: z.array(z.unknown()).optional(),\n});\n\nexport const responseInputTextContentSchema = z.object({\n type: z.literal('input_text'),\n text: z.string(),\n});\n\nexport const conversationMessageContentSchema = z.union([responseInputTextContentSchema, responseOutputTextSchema]);\n\nexport const responseOutputMessageSchema = z.object({\n id: z.string(),\n type: z.literal('message'),\n role: z.literal('assistant'),\n status: z.enum(['in_progress', 'completed', 'incomplete']),\n content: z.array(responseOutputTextSchema),\n});\n\nexport const responseOutputFunctionCallSchema = z.object({\n id: z.string(),\n type: z.literal('function_call'),\n call_id: z.string(),\n name: z.string(),\n arguments: z.string(),\n status: z.enum(['in_progress', 'completed', 'incomplete']).optional(),\n});\n\nexport const responseOutputFunctionCallOutputSchema = z.object({\n id: z.string(),\n type: z.literal('function_call_output'),\n call_id: z.string(),\n output: z.string(),\n});\n\nexport const responseUsageSchema = z.object({\n input_tokens: z.number(),\n output_tokens: z.number(),\n total_tokens: z.number(),\n input_tokens_details: z\n .object({\n cached_tokens: z.number(),\n })\n .optional(),\n output_tokens_details: z\n .object({\n reasoning_tokens: z.number(),\n })\n .optional(),\n});\n\nexport type ResponseUsage = z.infer<typeof responseUsageSchema>;\n\nexport const responseToolSchema = z.object({\n type: z.literal('function'),\n name: z.string(),\n description: z.string().optional(),\n parameters: z.unknown().optional(),\n});\n\nexport type ResponseTool = z.infer<typeof responseToolSchema>;\n\nexport const responseOutputItemSchema = z.union([\n responseOutputMessageSchema,\n responseOutputFunctionCallSchema,\n responseOutputFunctionCallOutputSchema,\n]);\n\nexport type ResponseOutputItem = z.infer<typeof responseOutputItemSchema>;\n\nexport const conversationItemMessageSchema = z.object({\n id: z.string(),\n type: z.literal('message'),\n role: z.enum(['system', 'user', 'assistant']),\n status: z.literal('completed'),\n content: z.array(conversationMessageContentSchema),\n});\n\nexport const conversationItemSchema = z.union([\n conversationItemMessageSchema,\n responseOutputFunctionCallSchema,\n responseOutputFunctionCallOutputSchema,\n]);\n\nexport type ConversationItem = z.infer<typeof conversationItemSchema>;\n\nexport const responseObjectSchema = z.object({\n id: z.string(),\n object: z.literal('response'),\n created_at: z.number(),\n completed_at: z.number().nullable(),\n model: z.string(),\n status: z.enum(['in_progress', 'completed', 'incomplete']),\n output: z.array(responseOutputItemSchema),\n usage: responseUsageSchema.nullable(),\n error: z.null().optional(),\n incomplete_details: z.null().optional(),\n instructions: z.string().nullable().optional(),\n text: responseTextSchema.nullable().optional(),\n previous_response_id: z.string().nullable().optional(),\n conversation_id: z.string().nullable().optional(),\n providerOptions: providerOptionsSchema.optional(),\n tools: z.array(responseToolSchema).optional(),\n store: z.boolean().optional(),\n});\n\nexport type ResponseObject = z.infer<typeof responseObjectSchema>;\n\nexport const deleteResponseSchema = z.object({\n id: z.string(),\n object: z.literal('response'),\n deleted: z.literal(true),\n});\n\nexport type DeleteResponse = z.infer<typeof deleteResponseSchema>;\n"],"mappings":";;;;AAEA,MAAa,uBAAuBA,IAAAA,QAAE,OAAO,EAC3C,YAAYA,IAAAA,QAAE,OAAO,CAAC,CAAC,SAAS,2CAA2C,EAC7E,CAAC;AAED,MAAa,8BAA8BA,IAAAA,QAAE,OAAO;CAClD,MAAMA,IAAAA,QAAE,KAAK;EAAC;EAAc;EAAQ;CAAa,CAAC;CAClD,MAAMA,IAAAA,QAAE,OAAO;AACjB,CAAC;AAED,MAAa,6BAA6BA,IAAAA,QAAE,OAAO;CACjD,MAAMA,IAAAA,QAAE,KAAK;EAAC;EAAU;EAAa;EAAQ;CAAW,CA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ID,MAAa,uBAAuBA,IAAAA,QAAE,OAAO;CAC3C,IAAIA,IAAAA,QAAE,OAAO;CACb,QAAQA,IAAAA,QAAE,QAAQ,UAAU;CAC5B,SAASA,IAAAA,QAAE,QAAQ,IAAI;AACzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"responses-CfcIc53b.cjs","names":["z"],"sources":["../src/server/schemas/responses.ts"],"sourcesContent":["import z from 'zod';\n\nexport const responseIdPathParams = z.object({\n responseId: z.string().describe('Unique identifier for the stored response'),\n});\n\nexport const responseInputTextPartSchema = z.object({\n type: z.enum(['input_text', 'text', 'output_text']),\n text: z.string(),\n});\n\nexport const responseInputMessageSchema = z.object({\n role: z.enum(['system', 'developer', 'user', 'assistant']),\n content: z.union([z.string(), z.array(responseInputTextPartSchema)]),\n});\n\nexport type ResponseInputMessage = z.infer<typeof responseInputMessageSchema>;\n\nconst providerOptionValuesSchema = z.record(z.string(), z.unknown());\n\nconst providerOptionsSchema = z\n .object({\n openai: providerOptionValuesSchema\n .optional()\n .describe('OpenAI provider options such as previousResponseId, conversation, or responseId'),\n azure: providerOptionValuesSchema\n .optional()\n .describe('Azure OpenAI provider options such as previousResponseId, store, or itemId'),\n })\n .passthrough();\n\nconst responseTextFormatJsonObjectSchema = z.object({\n type: z.literal('json_object').describe('Requests JSON object output compatibility for the response'),\n});\n\nconst responseTextFormatJsonSchemaSchema = z.object({\n type: z.literal('json_schema'),\n name: z.string(),\n description: z.string().optional(),\n schema: z.record(z.string(), z.unknown()),\n strict: z.boolean().optional(),\n});\n\nexport const responseTextFormatSchema = z.union([\n responseTextFormatJsonObjectSchema,\n responseTextFormatJsonSchemaSchema,\n]);\n\nexport type ResponseTextFormat = z.infer<typeof responseTextFormatSchema>;\n\nconst responseTextSchema = z.object({\n format: responseTextFormatSchema,\n});\n\nexport type ResponseTextConfig = z.infer<typeof responseTextSchema>;\n\nexport const createResponseBodySchema = z\n .object({\n model: z\n .string()\n .optional()\n .describe(\n 'Optional model identifier override, such as openai/gpt-5. When omitted, the agent default model is used.',\n ),\n agent_id: z\n .string()\n .min(1)\n .optional()\n .describe('Mastra agent ID for the request. Required unless previous_response_id is provided.'),\n input: z.union([z.string(), z.array(responseInputMessageSchema)]),\n instructions: z.string().optional(),\n text: responseTextSchema\n .optional()\n .describe(\n 'Optional text output format. Supports `json_object` for JSON mode and `json_schema` for schema-constrained structured output.',\n ),\n conversation_id: z.string().optional().describe('Optional conversation ID. In Mastra this is the raw threadId.'),\n providerOptions: providerOptionsSchema\n .optional()\n .describe('Optional provider-specific options passed through to the underlying model call'),\n stream: z.boolean().optional().default(false),\n store: z.boolean().optional().default(false),\n previous_response_id: z.string().min(1).optional(),\n })\n .passthrough()\n .refine(data => data.agent_id || data.previous_response_id, {\n message: 'agent_id is required unless previous_response_id is provided',\n path: [],\n });\n\nexport type CreateResponseBody = z.infer<typeof createResponseBodySchema>;\n\nexport const responseOutputTextSchema = z.object({\n type: z.literal('output_text'),\n text: z.string(),\n annotations: z.array(z.unknown()).optional(),\n logprobs: z.array(z.unknown()).optional(),\n});\n\nexport const responseInputTextContentSchema = z.object({\n type: z.literal('input_text'),\n text: z.string(),\n});\n\nexport const conversationMessageContentSchema = z.union([responseInputTextContentSchema, responseOutputTextSchema]);\n\nexport const responseOutputMessageSchema = z.object({\n id: z.string(),\n type: z.literal('message'),\n role: z.literal('assistant'),\n status: z.enum(['in_progress', 'completed', 'incomplete']),\n content: z.array(responseOutputTextSchema),\n});\n\nexport const responseOutputFunctionCallSchema = z.object({\n id: z.string(),\n type: z.literal('function_call'),\n call_id: z.string(),\n name: z.string(),\n arguments: z.string(),\n status: z.enum(['in_progress', 'completed', 'incomplete']).optional(),\n});\n\nexport const responseOutputFunctionCallOutputSchema = z.object({\n id: z.string(),\n type: z.literal('function_call_output'),\n call_id: z.string(),\n output: z.string(),\n});\n\nexport const responseUsageSchema = z.object({\n input_tokens: z.number(),\n output_tokens: z.number(),\n total_tokens: z.number(),\n input_tokens_details: z\n .object({\n cached_tokens: z.number(),\n })\n .optional(),\n output_tokens_details: z\n .object({\n reasoning_tokens: z.number(),\n })\n .optional(),\n});\n\nexport type ResponseUsage = z.infer<typeof responseUsageSchema>;\n\nexport const responseToolSchema = z.object({\n type: z.literal('function'),\n name: z.string(),\n description: z.string().optional(),\n parameters: z.unknown().optional(),\n});\n\nexport type ResponseTool = z.infer<typeof responseToolSchema>;\n\nexport const responseOutputItemSchema = z.union([\n responseOutputMessageSchema,\n responseOutputFunctionCallSchema,\n responseOutputFunctionCallOutputSchema,\n]);\n\nexport type ResponseOutputItem = z.infer<typeof responseOutputItemSchema>;\n\nexport const conversationItemMessageSchema = z.object({\n id: z.string(),\n type: z.literal('message'),\n role: z.enum(['system', 'user', 'assistant']),\n status: z.literal('completed'),\n content: z.array(conversationMessageContentSchema),\n});\n\nexport const conversationItemSchema = z.union([\n conversationItemMessageSchema,\n responseOutputFunctionCallSchema,\n responseOutputFunctionCallOutputSchema,\n]);\n\nexport type ConversationItem = z.infer<typeof conversationItemSchema>;\n\nexport const responseObjectSchema = z.object({\n id: z.string(),\n object: z.literal('response'),\n created_at: z.number(),\n completed_at: z.number().nullable(),\n model: z.string(),\n status: z.enum(['in_progress', 'completed', 'incomplete']),\n output: z.array(responseOutputItemSchema),\n usage: responseUsageSchema.nullable(),\n error: z.null().optional(),\n incomplete_details: z.null().optional(),\n instructions: z.string().nullable().optional(),\n text: responseTextSchema.nullable().optional(),\n previous_response_id: z.string().nullable().optional(),\n conversation_id: z.string().nullable().optional(),\n providerOptions: providerOptionsSchema.optional(),\n tools: z.array(responseToolSchema).optional(),\n store: z.boolean().optional(),\n});\n\nexport type ResponseObject = z.infer<typeof responseObjectSchema>;\n\nexport const deleteResponseSchema = z.object({\n id: z.string(),\n object: z.literal('response'),\n deleted: z.literal(true),\n});\n\nexport type DeleteResponse = z.infer<typeof deleteResponseSchema>;\n"],"mappings":";;;;AAEA,MAAa,uBAAuBA,IAAAA,QAAE,OAAO,EAC3C,YAAYA,IAAAA,QAAE,OA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C7C,sBAAsBA,IAAAA,QAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACrD,iBAAiBA,IAAAA,QAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAChD,iBAAiB,sBAAsB,SAAS;CAChD,OAAOA,IAAAA,QAAE,MAAM,kBAAkB,CAAC,CAAC,SAAS;CAC5C,OAAOA,IAAAA,QAAE,QAAQ,CAAC,CAAC,SAAS;AAC9B,CAAC;AAID,MAAa,uBAAuBA,IAAAA,QAAE,OAAO;CAC3C,IAAIA,IAAAA,QAAE,OAAO;CACb,QAAQA,IAAAA,QAAE,QAAQ,UAAU;CAC5B,SAASA,IAAAA,QAAE,QAAQ,IAAI;AACzB,CAAC"}
|
|
@@ -13,7 +13,7 @@ var __esmMin = (fn, res, err) => () => {
|
|
|
13
13
|
throw err = [e], e;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
16
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
17
17
|
var __exportAll = (all, no_symbols) => {
|
|
18
18
|
let target = {};
|
|
19
19
|
for (var name in all) __defProp(target, name, {
|
|
@@ -33,7 +33,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
33
|
}
|
|
34
34
|
return to;
|
|
35
35
|
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
37
37
|
value: mod,
|
|
38
38
|
enumerable: true
|
|
39
39
|
}) : target, mod));
|
|
@@ -14,7 +14,7 @@ var __esmMin = (fn, res, err) => () => {
|
|
|
14
14
|
throw err = [e], e;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
17
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
18
18
|
var __exportAll = (all, no_symbols) => {
|
|
19
19
|
let target = {};
|
|
20
20
|
for (var name in all) __defProp(target, name, {
|
|
@@ -34,7 +34,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
34
34
|
}
|
|
35
35
|
return to;
|
|
36
36
|
};
|
|
37
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
38
38
|
value: mod,
|
|
39
39
|
enumerable: true
|
|
40
40
|
}) : target, mod));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_schema_CzbEIyhE = require("./schema-CzbEIyhE-20gGIWkz.cjs");
|
|
2
2
|
let zod_v4 = require("zod/v4");
|
|
3
3
|
let _mastra_core_schema = require("@mastra/core/schema");
|
|
4
4
|
let _mastra_core_utils_zod_to_json = require("@mastra/core/utils/zod-to-json");
|
|
@@ -169,8 +169,10 @@ var ExclusiveMinimumHandler = class {
|
|
|
169
169
|
if (numberSchema.exclusiveMinimum === void 0) return;
|
|
170
170
|
if (types.number !== false) {
|
|
171
171
|
const currentNumber = types.number || zod_v4.z.number();
|
|
172
|
-
if (currentNumber instanceof zod_v4.z.ZodNumber)
|
|
173
|
-
|
|
172
|
+
if (currentNumber instanceof zod_v4.z.ZodNumber) {
|
|
173
|
+
if (typeof numberSchema.exclusiveMinimum === "number") types.number = currentNumber.gt(numberSchema.exclusiveMinimum);
|
|
174
|
+
else types.number = false;
|
|
175
|
+
}
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
178
|
};
|
|
@@ -180,8 +182,10 @@ var ExclusiveMaximumHandler = class {
|
|
|
180
182
|
if (numberSchema.exclusiveMaximum === void 0) return;
|
|
181
183
|
if (types.number !== false) {
|
|
182
184
|
const currentNumber = types.number || zod_v4.z.number();
|
|
183
|
-
if (currentNumber instanceof zod_v4.z.ZodNumber)
|
|
184
|
-
|
|
185
|
+
if (currentNumber instanceof zod_v4.z.ZodNumber) {
|
|
186
|
+
if (typeof numberSchema.exclusiveMaximum === "number") types.number = currentNumber.lt(numberSchema.exclusiveMaximum);
|
|
187
|
+
else types.number = false;
|
|
188
|
+
}
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
191
|
};
|
|
@@ -242,9 +246,10 @@ var ItemsHandler = class {
|
|
|
242
246
|
});
|
|
243
247
|
}
|
|
244
248
|
types.array = newArray;
|
|
245
|
-
} else if (typeof arraySchema.items === "boolean" && arraySchema.items === false)
|
|
246
|
-
|
|
247
|
-
|
|
249
|
+
} else if (typeof arraySchema.items === "boolean" && arraySchema.items === false) {
|
|
250
|
+
if (!arraySchema.prefixItems) types.array = zod_v4.z.array(zod_v4.z.any()).max(0);
|
|
251
|
+
else types.array = types.array || zod_v4.z.array(zod_v4.z.any());
|
|
252
|
+
} else if (typeof arraySchema.items === "boolean" && arraySchema.items === true) types.array = types.array || zod_v4.z.array(zod_v4.z.any());
|
|
248
253
|
else if (arraySchema.prefixItems) types.array = types.array || zod_v4.z.array(zod_v4.z.any());
|
|
249
254
|
}
|
|
250
255
|
};
|
|
@@ -537,12 +542,14 @@ function convertJsonSchemaToZod(schema) {
|
|
|
537
542
|
if (types.null !== false) allowedSchemas.push(types.null || zod_v4.z.null());
|
|
538
543
|
if (types.array !== false) allowedSchemas.push(types.array || zod_v4.z.array(zod_v4.z.any()));
|
|
539
544
|
if (types.tuple !== false && types.tuple !== void 0) allowedSchemas.push(types.tuple);
|
|
540
|
-
if (types.object !== false)
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
545
|
+
if (types.object !== false) {
|
|
546
|
+
if (types.object) allowedSchemas.push(types.object);
|
|
547
|
+
else {
|
|
548
|
+
const objectSchema = zod_v4.z.custom((val) => {
|
|
549
|
+
return typeof val === "object" && val !== null && !Array.isArray(val);
|
|
550
|
+
}, "Must be an object, not an array");
|
|
551
|
+
allowedSchemas.push(objectSchema);
|
|
552
|
+
}
|
|
546
553
|
}
|
|
547
554
|
if (types.file !== false && types.file !== void 0) allowedSchemas.push(types.file);
|
|
548
555
|
let zodSchema;
|
|
@@ -676,7 +683,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
676
683
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
677
684
|
var __getProtoOf = Object.getPrototypeOf;
|
|
678
685
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
679
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
686
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
680
687
|
var __copyProps = (to, from, except, desc) => {
|
|
681
688
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
682
689
|
key = keys[i];
|
|
@@ -687,7 +694,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
687
694
|
}
|
|
688
695
|
return to;
|
|
689
696
|
};
|
|
690
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
|
|
697
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp$1(target, "default", {
|
|
691
698
|
value: mod,
|
|
692
699
|
enumerable: true
|
|
693
700
|
}) : target, mod));
|
|
@@ -992,24 +999,24 @@ function parseBigintDef(def, refs) {
|
|
|
992
999
|
if (!def.checks) return res;
|
|
993
1000
|
for (const check of def.checks) switch (check.kind) {
|
|
994
1001
|
case "min":
|
|
995
|
-
if (refs.target === "jsonSchema7")
|
|
996
|
-
|
|
997
|
-
|
|
1002
|
+
if (refs.target === "jsonSchema7") {
|
|
1003
|
+
if (check.inclusive) setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1004
|
+
else setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
1005
|
+
} else {
|
|
998
1006
|
if (!check.inclusive) res.exclusiveMinimum = true;
|
|
999
1007
|
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1000
1008
|
}
|
|
1001
1009
|
break;
|
|
1002
1010
|
case "max":
|
|
1003
|
-
if (refs.target === "jsonSchema7")
|
|
1004
|
-
|
|
1005
|
-
|
|
1011
|
+
if (refs.target === "jsonSchema7") {
|
|
1012
|
+
if (check.inclusive) setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1013
|
+
else setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
1014
|
+
} else {
|
|
1006
1015
|
if (!check.inclusive) res.exclusiveMaximum = true;
|
|
1007
1016
|
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1008
1017
|
}
|
|
1009
1018
|
break;
|
|
1010
|
-
case "multipleOf":
|
|
1011
|
-
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
1012
|
-
break;
|
|
1019
|
+
case "multipleOf": setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
1013
1020
|
}
|
|
1014
1021
|
return res;
|
|
1015
1022
|
}
|
|
@@ -1048,9 +1055,7 @@ const integerDateParser = (def, refs) => {
|
|
|
1048
1055
|
case "min":
|
|
1049
1056
|
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1050
1057
|
break;
|
|
1051
|
-
case "max":
|
|
1052
|
-
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1053
|
-
break;
|
|
1058
|
+
case "max": setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1054
1059
|
}
|
|
1055
1060
|
return res;
|
|
1056
1061
|
};
|
|
@@ -1190,9 +1195,7 @@ function parseStringDef(def, refs) {
|
|
|
1190
1195
|
case "format:idn-email":
|
|
1191
1196
|
addFormat(res, "idn-email", check.message, refs);
|
|
1192
1197
|
break;
|
|
1193
|
-
case "pattern:zod":
|
|
1194
|
-
addPattern(res, zodPatterns.email, check.message, refs);
|
|
1195
|
-
break;
|
|
1198
|
+
case "pattern:zod": addPattern(res, zodPatterns.email, check.message, refs);
|
|
1196
1199
|
}
|
|
1197
1200
|
break;
|
|
1198
1201
|
case "url":
|
|
@@ -1263,16 +1266,10 @@ function parseStringDef(def, refs) {
|
|
|
1263
1266
|
case "contentEncoding:base64":
|
|
1264
1267
|
setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
|
|
1265
1268
|
break;
|
|
1266
|
-
case "pattern:zod":
|
|
1267
|
-
addPattern(res, zodPatterns.base64, check.message, refs);
|
|
1268
|
-
break;
|
|
1269
|
+
case "pattern:zod": addPattern(res, zodPatterns.base64, check.message, refs);
|
|
1269
1270
|
}
|
|
1270
1271
|
break;
|
|
1271
1272
|
case "nanoid": addPattern(res, zodPatterns.nanoid, check.message, refs);
|
|
1272
|
-
case "toLowerCase":
|
|
1273
|
-
case "toUpperCase":
|
|
1274
|
-
case "trim": break;
|
|
1275
|
-
default:
|
|
1276
1273
|
}
|
|
1277
1274
|
return res;
|
|
1278
1275
|
}
|
|
@@ -1588,24 +1585,24 @@ function parseNumberDef(def, refs) {
|
|
|
1588
1585
|
addErrorMessage(res, "type", check.message, refs);
|
|
1589
1586
|
break;
|
|
1590
1587
|
case "min":
|
|
1591
|
-
if (refs.target === "jsonSchema7")
|
|
1592
|
-
|
|
1593
|
-
|
|
1588
|
+
if (refs.target === "jsonSchema7") {
|
|
1589
|
+
if (check.inclusive) setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1590
|
+
else setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
1591
|
+
} else {
|
|
1594
1592
|
if (!check.inclusive) res.exclusiveMinimum = true;
|
|
1595
1593
|
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1596
1594
|
}
|
|
1597
1595
|
break;
|
|
1598
1596
|
case "max":
|
|
1599
|
-
if (refs.target === "jsonSchema7")
|
|
1600
|
-
|
|
1601
|
-
|
|
1597
|
+
if (refs.target === "jsonSchema7") {
|
|
1598
|
+
if (check.inclusive) setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1599
|
+
else setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
1600
|
+
} else {
|
|
1602
1601
|
if (!check.inclusive) res.exclusiveMaximum = true;
|
|
1603
1602
|
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1604
1603
|
}
|
|
1605
1604
|
break;
|
|
1606
|
-
case "multipleOf":
|
|
1607
|
-
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
1608
|
-
break;
|
|
1605
|
+
case "multipleOf": setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
1609
1606
|
}
|
|
1610
1607
|
return res;
|
|
1611
1608
|
}
|
|
@@ -1842,7 +1839,7 @@ const addMeta = (def, refs, jsonSchema) => {
|
|
|
1842
1839
|
}
|
|
1843
1840
|
return jsonSchema;
|
|
1844
1841
|
};
|
|
1845
|
-
const zodToJsonSchema$
|
|
1842
|
+
const zodToJsonSchema$2 = (schema, options) => {
|
|
1846
1843
|
const refs = getRefs(options);
|
|
1847
1844
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({
|
|
1848
1845
|
...acc,
|
|
@@ -1903,7 +1900,7 @@ const zodToJsonSchema$1 = (schema, options) => {
|
|
|
1903
1900
|
if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
1904
1901
|
return combined;
|
|
1905
1902
|
};
|
|
1906
|
-
var esm_default = zodToJsonSchema$
|
|
1903
|
+
var esm_default = zodToJsonSchema$2;
|
|
1907
1904
|
var textStreamPart = {
|
|
1908
1905
|
code: "0",
|
|
1909
1906
|
name: "text",
|
|
@@ -2024,7 +2021,6 @@ function fixJson(input) {
|
|
|
2024
2021
|
stack.pop();
|
|
2025
2022
|
stack.push(swapState);
|
|
2026
2023
|
stack.push("INSIDE_ARRAY_START");
|
|
2027
|
-
break;
|
|
2028
2024
|
}
|
|
2029
2025
|
}
|
|
2030
2026
|
function processAfterObjectValue(char, i) {
|
|
@@ -2036,7 +2032,6 @@ function fixJson(input) {
|
|
|
2036
2032
|
case "}":
|
|
2037
2033
|
lastValidIndex = i;
|
|
2038
2034
|
stack.pop();
|
|
2039
|
-
break;
|
|
2040
2035
|
}
|
|
2041
2036
|
}
|
|
2042
2037
|
function processAfterArrayValue(char, i) {
|
|
@@ -2048,7 +2043,6 @@ function fixJson(input) {
|
|
|
2048
2043
|
case "]":
|
|
2049
2044
|
lastValidIndex = i;
|
|
2050
2045
|
stack.pop();
|
|
2051
|
-
break;
|
|
2052
2046
|
}
|
|
2053
2047
|
}
|
|
2054
2048
|
for (let i = 0; i < input.length; i++) {
|
|
@@ -2066,7 +2060,6 @@ function fixJson(input) {
|
|
|
2066
2060
|
case "}":
|
|
2067
2061
|
lastValidIndex = i;
|
|
2068
2062
|
stack.pop();
|
|
2069
|
-
break;
|
|
2070
2063
|
}
|
|
2071
2064
|
break;
|
|
2072
2065
|
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
@@ -2074,7 +2067,6 @@ function fixJson(input) {
|
|
|
2074
2067
|
case "\"":
|
|
2075
2068
|
stack.pop();
|
|
2076
2069
|
stack.push("INSIDE_OBJECT_KEY");
|
|
2077
|
-
break;
|
|
2078
2070
|
}
|
|
2079
2071
|
break;
|
|
2080
2072
|
case "INSIDE_OBJECT_KEY":
|
|
@@ -2082,7 +2074,6 @@ function fixJson(input) {
|
|
|
2082
2074
|
case "\"":
|
|
2083
2075
|
stack.pop();
|
|
2084
2076
|
stack.push("INSIDE_OBJECT_AFTER_KEY");
|
|
2085
|
-
break;
|
|
2086
2077
|
}
|
|
2087
2078
|
break;
|
|
2088
2079
|
case "INSIDE_OBJECT_AFTER_KEY":
|
|
@@ -2090,7 +2081,6 @@ function fixJson(input) {
|
|
|
2090
2081
|
case ":":
|
|
2091
2082
|
stack.pop();
|
|
2092
2083
|
stack.push("INSIDE_OBJECT_BEFORE_VALUE");
|
|
2093
|
-
break;
|
|
2094
2084
|
}
|
|
2095
2085
|
break;
|
|
2096
2086
|
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
@@ -2120,7 +2110,6 @@ function fixJson(input) {
|
|
|
2120
2110
|
default:
|
|
2121
2111
|
lastValidIndex = i;
|
|
2122
2112
|
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
2123
|
-
break;
|
|
2124
2113
|
}
|
|
2125
2114
|
break;
|
|
2126
2115
|
case "INSIDE_ARRAY_AFTER_VALUE":
|
|
@@ -2133,9 +2122,7 @@ function fixJson(input) {
|
|
|
2133
2122
|
lastValidIndex = i;
|
|
2134
2123
|
stack.pop();
|
|
2135
2124
|
break;
|
|
2136
|
-
default:
|
|
2137
|
-
lastValidIndex = i;
|
|
2138
|
-
break;
|
|
2125
|
+
default: lastValidIndex = i;
|
|
2139
2126
|
}
|
|
2140
2127
|
break;
|
|
2141
2128
|
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
@@ -2176,9 +2163,7 @@ function fixJson(input) {
|
|
|
2176
2163
|
stack.pop();
|
|
2177
2164
|
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
|
|
2178
2165
|
break;
|
|
2179
|
-
default:
|
|
2180
|
-
stack.pop();
|
|
2181
|
-
break;
|
|
2166
|
+
default: stack.pop();
|
|
2182
2167
|
}
|
|
2183
2168
|
break;
|
|
2184
2169
|
case "INSIDE_LITERAL": {
|
|
@@ -3799,7 +3784,7 @@ function trimStartOfStream() {
|
|
|
3799
3784
|
return text2;
|
|
3800
3785
|
};
|
|
3801
3786
|
}
|
|
3802
|
-
|
|
3787
|
+
require_schema_CzbEIyhE.require_json_schema_traverse();
|
|
3803
3788
|
//#endregion
|
|
3804
3789
|
//#region src/server/server-adapter/openapi-utils.ts
|
|
3805
3790
|
function isSchemaApiRoute(route) {
|
|
@@ -3833,7 +3818,8 @@ function generateRouteOpenAPI({ method, path, summary, description, tags = [], p
|
|
|
3833
3818
|
* Helper to convert any PublicSchema to JSON Schema for OpenAPI
|
|
3834
3819
|
*/
|
|
3835
3820
|
function schemaToJsonSchema(schema) {
|
|
3836
|
-
|
|
3821
|
+
const standardSchema = (0, _mastra_core_schema.toStandardSchema)(schema);
|
|
3822
|
+
return require_schema_CzbEIyhE.standardSchemaToJSONSchema(standardSchema);
|
|
3837
3823
|
}
|
|
3838
3824
|
const DEFINITION_KEYWORDS = ["$defs", "definitions"];
|
|
3839
3825
|
const GENERATED_DEFINITION_NAME = /^__schema\d+$/;
|
|
@@ -4367,4 +4353,4 @@ Object.defineProperty(exports, "wrapSchemaForQueryParams", {
|
|
|
4367
4353
|
}
|
|
4368
4354
|
});
|
|
4369
4355
|
|
|
4370
|
-
//# sourceMappingURL=route-builder-
|
|
4356
|
+
//# sourceMappingURL=route-builder-B2Qhhd7C.cjs.map
|