@mastra/core 1.0.0-beta.1 → 1.0.0-beta.10
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/CHANGELOG.md +1128 -0
- package/dist/agent/agent-legacy.d.ts +19 -22
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent-types.test-d.d.ts +2 -0
- package/dist/agent/agent-types.test-d.d.ts.map +1 -0
- package/dist/agent/agent.d.ts +6 -6
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.types.d.ts +6 -4
- package/dist/agent/agent.types.d.ts.map +1 -1
- package/dist/agent/index.cjs +9 -9
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/index.cjs +3 -3
- package/dist/agent/message-list/index.d.ts +60 -3
- package/dist/agent/message-list/index.d.ts.map +1 -1
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/prompt/attachments-to-parts.d.ts.map +1 -1
- package/dist/agent/message-list/prompt/convert-file.d.ts +1 -1
- package/dist/agent/message-list/prompt/convert-file.d.ts.map +1 -1
- package/dist/agent/message-list/prompt/download-assets.d.ts.map +1 -1
- package/dist/agent/save-queue/index.d.ts +3 -1
- package/dist/agent/save-queue/index.d.ts.map +1 -1
- package/dist/agent/test-utils.d.ts +37 -0
- package/dist/agent/test-utils.d.ts.map +1 -1
- package/dist/agent/trip-wire.d.ts.map +1 -1
- package/dist/agent/types.d.ts +21 -6
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/utils.d.ts +3 -3
- package/dist/agent/utils.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts +9 -7
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +3 -3
- package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +6 -5
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +2 -1
- package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/schema.d.ts +8 -8
- package/dist/agent/workflows/prepare-stream/schema.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts +11 -1
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
- package/dist/base.cjs +2 -2
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/cache/index.cjs +3 -3
- package/dist/cache/index.js +1 -1
- package/dist/{chunk-4CDL2QJT.js → chunk-267YOF47.js} +121 -36
- package/dist/chunk-267YOF47.js.map +1 -0
- package/dist/{chunk-OJNJA5ZI.js → chunk-3CKZSDTQ.js} +3 -3
- package/dist/{chunk-OJNJA5ZI.js.map → chunk-3CKZSDTQ.js.map} +1 -1
- package/dist/{chunk-JV2KH24V.js → chunk-3GKKHF36.js} +693 -375
- package/dist/chunk-3GKKHF36.js.map +1 -0
- package/dist/{chunk-TQTAMPSC.js → chunk-3N3QE4ZK.js} +3 -3
- package/dist/chunk-3N3QE4ZK.js.map +1 -0
- package/dist/{chunk-QUKUN6NR.cjs → chunk-4JKEUSCC.cjs} +107 -7
- package/dist/chunk-4JKEUSCC.cjs.map +1 -0
- package/dist/{chunk-XEVG546F.js → chunk-4Q3Z6QRE.js} +178 -12
- package/dist/chunk-4Q3Z6QRE.js.map +1 -0
- package/dist/{chunk-CBAB7GOD.cjs → chunk-6BJ7XHRH.cjs} +2 -2
- package/dist/{chunk-CBAB7GOD.cjs.map → chunk-6BJ7XHRH.cjs.map} +1 -1
- package/dist/{chunk-JUBFO5J3.js → chunk-6CYYFT4O.js} +11378 -8189
- package/dist/chunk-6CYYFT4O.js.map +1 -0
- package/dist/{chunk-W7UH2PWL.js → chunk-6ONQWD6S.js} +1124 -325
- package/dist/chunk-6ONQWD6S.js.map +1 -0
- package/dist/{chunk-GRBGQ2GE.js → chunk-6TBWJV35.js} +5 -3
- package/dist/chunk-6TBWJV35.js.map +1 -0
- package/dist/chunk-6XCINXZ7.cjs +194 -0
- package/dist/chunk-6XCINXZ7.cjs.map +1 -0
- package/dist/{chunk-E7K4FTLN.cjs → chunk-72YCRTEX.cjs} +18 -2
- package/dist/chunk-72YCRTEX.cjs.map +1 -0
- package/dist/{chunk-MA7TEM62.cjs → chunk-7THRV5KZ.cjs} +762 -27
- package/dist/chunk-7THRV5KZ.cjs.map +1 -0
- package/dist/{chunk-76K3IYWM.js → chunk-ADADLFDR.js} +3 -3
- package/dist/{chunk-76K3IYWM.js.map → chunk-ADADLFDR.js.map} +1 -1
- package/dist/{chunk-DSNPWVIG.cjs → chunk-AF74UXR5.cjs} +4 -3
- package/dist/chunk-AF74UXR5.cjs.map +1 -0
- package/dist/{chunk-DNEURYF3.cjs → chunk-BCRRHJGV.cjs} +206 -65
- package/dist/chunk-BCRRHJGV.cjs.map +1 -0
- package/dist/chunk-BWYU7D33.js +192 -0
- package/dist/chunk-BWYU7D33.js.map +1 -0
- package/dist/{chunk-MV7KHWUT.js → chunk-BXONP7HX.js} +391 -15
- package/dist/chunk-BXONP7HX.js.map +1 -0
- package/dist/chunk-CDRYT2A5.js +513 -0
- package/dist/chunk-CDRYT2A5.js.map +1 -0
- package/dist/{chunk-CB575O6L.cjs → chunk-CZEJQSWB.cjs} +473 -124
- package/dist/chunk-CZEJQSWB.cjs.map +1 -0
- package/dist/chunk-DD2VNRQM.js +62 -0
- package/dist/chunk-DD2VNRQM.js.map +1 -0
- package/dist/{chunk-KEXGB7FK.cjs → chunk-DGV2FWB4.cjs} +7 -7
- package/dist/{chunk-KEXGB7FK.cjs.map → chunk-DGV2FWB4.cjs.map} +1 -1
- package/dist/{chunk-Y63IFHEZ.cjs → chunk-EOPEDKLG.cjs} +4 -4
- package/dist/chunk-EOPEDKLG.cjs.map +1 -0
- package/dist/{chunk-UIZSWUKP.js → chunk-F2GAJSBI.js} +105 -7
- package/dist/chunk-F2GAJSBI.js.map +1 -0
- package/dist/{chunk-VOY2RXOC.cjs → chunk-G4IFCTL5.cjs} +182 -15
- package/dist/chunk-G4IFCTL5.cjs.map +1 -0
- package/dist/chunk-KJBMTK5B.cjs +64 -0
- package/dist/chunk-KJBMTK5B.cjs.map +1 -0
- package/dist/{chunk-S6URFGCZ.js → chunk-LSHPJWM5.js} +3 -3
- package/dist/{chunk-S6URFGCZ.js.map → chunk-LSHPJWM5.js.map} +1 -1
- package/dist/chunk-MGCGWPQJ.cjs +275 -0
- package/dist/chunk-MGCGWPQJ.cjs.map +1 -0
- package/dist/chunk-MRFUISXC.cjs +4981 -0
- package/dist/chunk-MRFUISXC.cjs.map +1 -0
- package/dist/chunk-MSZP3FNH.cjs +518 -0
- package/dist/chunk-MSZP3FNH.cjs.map +1 -0
- package/dist/{chunk-KJ2SW6VA.js → chunk-NRUZYMHE.js} +4 -3
- package/dist/chunk-NRUZYMHE.js.map +1 -0
- package/dist/{chunk-VOQ3ULMT.js → chunk-NUA6TSRD.js} +752 -17
- package/dist/chunk-NUA6TSRD.js.map +1 -0
- package/dist/chunk-OEIVMCWX.js +4959 -0
- package/dist/chunk-OEIVMCWX.js.map +1 -0
- package/dist/{chunk-CINNK34N.js → chunk-OIDPIW42.js} +26 -11
- package/dist/chunk-OIDPIW42.js.map +1 -0
- package/dist/{chunk-CD56CXVE.cjs → chunk-OYIDRI3A.cjs} +32 -17
- package/dist/chunk-OYIDRI3A.cjs.map +1 -0
- package/dist/{chunk-2ZVKF4HP.cjs → chunk-P2D2VO2O.cjs} +1129 -328
- package/dist/chunk-P2D2VO2O.cjs.map +1 -0
- package/dist/{chunk-JPGVRWWL.js → chunk-PK2A5WBG.js} +472 -125
- package/dist/chunk-PK2A5WBG.js.map +1 -0
- package/dist/{chunk-X7JMA3IY.js → chunk-PSCMWPLC.js} +2 -2
- package/dist/{chunk-X7JMA3IY.js.map → chunk-PSCMWPLC.js.map} +1 -1
- package/dist/{chunk-WM6CK2F3.cjs → chunk-QD3UWFAV.cjs} +130 -48
- package/dist/chunk-QD3UWFAV.cjs.map +1 -0
- package/dist/{chunk-MSWTA73A.cjs → chunk-SL7Q6IZF.cjs} +11426 -8219
- package/dist/chunk-SL7Q6IZF.cjs.map +1 -0
- package/dist/{chunk-ECFXGXWO.cjs → chunk-SSPUH2N7.cjs} +693 -375
- package/dist/chunk-SSPUH2N7.cjs.map +1 -0
- package/dist/{chunk-BMAFVZ2D.cjs → chunk-T2VLUFGG.cjs} +4 -4
- package/dist/{chunk-BMAFVZ2D.cjs.map → chunk-T2VLUFGG.cjs.map} +1 -1
- package/dist/chunk-THZTRBFS.js +268 -0
- package/dist/chunk-THZTRBFS.js.map +1 -0
- package/dist/{chunk-Y6ROD72V.cjs → chunk-UIGRFDO6.cjs} +4 -4
- package/dist/{chunk-Y6ROD72V.cjs.map → chunk-UIGRFDO6.cjs.map} +1 -1
- package/dist/{chunk-J7O6WENZ.cjs → chunk-UVHSM2GU.cjs} +6 -2
- package/dist/chunk-UVHSM2GU.cjs.map +1 -0
- package/dist/{chunk-GGYKYORQ.cjs → chunk-WX2DLWXF.cjs} +407 -22
- package/dist/chunk-WX2DLWXF.cjs.map +1 -0
- package/dist/{chunk-H6CZGPZD.js → chunk-XRJQ5ZA7.js} +179 -38
- package/dist/chunk-XRJQ5ZA7.js.map +1 -0
- package/dist/{chunk-KIZIOFZC.js → chunk-Y36Y5MTD.js} +17 -3
- package/dist/chunk-Y36Y5MTD.js.map +1 -0
- package/dist/{chunk-IQO7ANVS.cjs → chunk-YWMMBIOM.cjs} +21 -20
- package/dist/chunk-YWMMBIOM.cjs.map +1 -0
- package/dist/{chunk-I4CXL4SR.js → chunk-Z57R5WS4.js} +16 -15
- package/dist/chunk-Z57R5WS4.js.map +1 -0
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.js +1 -1
- package/dist/di/index.cjs +10 -2
- package/dist/di/index.d.ts +1 -1
- package/dist/di/index.d.ts.map +1 -1
- package/dist/di/index.js +1 -1
- package/dist/evals/base.d.ts +10 -2
- package/dist/evals/base.d.ts.map +1 -1
- package/dist/evals/base.test-utils.d.ts +25 -25
- package/dist/evals/index.cjs +9 -9
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +7 -6
- package/dist/evals/scoreTraces/index.cjs.map +1 -1
- package/dist/evals/scoreTraces/index.js +4 -3
- package/dist/evals/scoreTraces/index.js.map +1 -1
- package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
- package/dist/evals/types.d.ts +25 -24
- package/dist/evals/types.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/integration/index.cjs +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +30 -10
- package/dist/llm/index.d.ts +2 -0
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +5 -1
- package/dist/llm/model/aisdk/v5/model.d.ts +47 -0
- package/dist/llm/model/aisdk/v5/model.d.ts.map +1 -0
- package/dist/llm/model/gateway-resolver.d.ts.map +1 -1
- package/dist/llm/model/gateways/azure.d.ts +36 -0
- package/dist/llm/model/gateways/azure.d.ts.map +1 -0
- package/dist/llm/model/gateways/base.d.ts +9 -4
- package/dist/llm/model/gateways/base.d.ts.map +1 -1
- package/dist/llm/model/gateways/constants.d.ts.map +1 -1
- package/dist/llm/model/gateways/index.d.ts +4 -1
- package/dist/llm/model/gateways/index.d.ts.map +1 -1
- package/dist/llm/model/gateways/models-dev.d.ts +3 -2
- package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
- package/dist/llm/model/gateways/netlify.d.ts +4 -3
- package/dist/llm/model/gateways/netlify.d.ts.map +1 -1
- package/dist/llm/model/is-v2-model.d.ts +3 -0
- package/dist/llm/model/is-v2-model.d.ts.map +1 -0
- package/dist/llm/model/model-method-from-agent.d.ts +4 -0
- package/dist/llm/model/model-method-from-agent.d.ts.map +1 -0
- package/dist/llm/model/model.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts +2 -2
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/model.loop.types.d.ts +2 -0
- package/dist/llm/model/model.loop.types.d.ts.map +1 -1
- package/dist/llm/model/provider-options.d.ts +4 -1
- package/dist/llm/model/provider-options.d.ts.map +1 -1
- package/dist/llm/model/provider-registry.d.ts +11 -1
- package/dist/llm/model/provider-registry.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +473 -24
- package/dist/llm/model/registry-generator.d.ts +12 -0
- package/dist/llm/model/registry-generator.d.ts.map +1 -1
- package/dist/llm/model/resolve-model.d.ts +1 -1
- package/dist/llm/model/resolve-model.d.ts.map +1 -1
- package/dist/llm/model/router.d.ts +12 -5
- package/dist/llm/model/router.d.ts.map +1 -1
- package/dist/llm/model/shared.types.d.ts +10 -4
- package/dist/llm/model/shared.types.d.ts.map +1 -1
- package/dist/logger/constants.d.ts +1 -0
- package/dist/logger/constants.d.ts.map +1 -1
- package/dist/logger/index.cjs +11 -11
- package/dist/logger/index.js +2 -2
- package/dist/logger/transport.d.ts +1 -1
- package/dist/logger/transport.d.ts.map +1 -1
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/loop.d.ts.map +1 -1
- package/dist/loop/network/index.d.ts.map +1 -1
- package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts +37 -0
- package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts.map +1 -0
- package/dist/loop/test-utils/fullStream.d.ts.map +1 -1
- package/dist/loop/test-utils/generateText.d.ts.map +1 -1
- package/dist/loop/test-utils/options.d.ts.map +1 -1
- package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
- package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
- package/dist/loop/test-utils/textStream.d.ts.map +1 -1
- package/dist/loop/test-utils/toUIMessageStream.d.ts.map +1 -1
- package/dist/loop/test-utils/tools.d.ts.map +1 -1
- package/dist/loop/test-utils/utils.d.ts +1 -1
- package/dist/loop/test-utils/utils.d.ts.map +1 -1
- package/dist/loop/types.d.ts +22 -5
- package/dist/loop/types.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +42 -42
- package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +29 -29
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +14 -14
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts +44 -43
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
- package/dist/loop/workflows/run-state.d.ts +2 -2
- package/dist/loop/workflows/run-state.d.ts.map +1 -1
- package/dist/loop/workflows/schema.d.ts +14 -14
- package/dist/loop/workflows/stream.d.ts +1 -1
- package/dist/loop/workflows/stream.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +377 -12
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +4 -4
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.ts +4 -4
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +2 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/types.d.ts +2 -2
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/memory/index.cjs +21 -327
- package/dist/memory/index.cjs.map +1 -1
- package/dist/memory/index.js +1 -327
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/memory.d.ts +28 -18
- package/dist/memory/memory.d.ts.map +1 -1
- package/dist/memory/mock.d.ts +15 -14
- package/dist/memory/mock.d.ts.map +1 -1
- package/dist/memory/types.d.ts +69 -11
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/models-dev-23RN2WHG.js +3 -0
- package/dist/{models-dev-DNBKXHT4.js.map → models-dev-23RN2WHG.js.map} +1 -1
- package/dist/models-dev-EO3SUIY2.cjs +12 -0
- package/dist/{models-dev-YBEEQIX6.cjs.map → models-dev-EO3SUIY2.cjs.map} +1 -1
- package/dist/netlify-GXJ5D5DD.js +3 -0
- package/dist/{netlify-7G2L5VSH.js.map → netlify-GXJ5D5DD.js.map} +1 -1
- package/dist/netlify-KJLY3GFS.cjs +12 -0
- package/dist/{netlify-GWNGSIRZ.cjs.map → netlify-KJLY3GFS.cjs.map} +1 -1
- package/dist/observability/index.cjs +16 -8
- package/dist/observability/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +236 -13
- package/dist/observability/types/tracing.d.ts.map +1 -1
- package/dist/observability/utils.d.ts +47 -1
- package/dist/observability/utils.d.ts.map +1 -1
- package/dist/processors/index.cjs +35 -11
- package/dist/processors/index.d.ts +101 -23
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/memory/index.d.ts +7 -0
- package/dist/processors/memory/index.d.ts.map +1 -0
- package/dist/processors/memory/message-history.d.ts +43 -0
- package/dist/processors/memory/message-history.d.ts.map +1 -0
- package/dist/processors/memory/semantic-recall.d.ts +152 -0
- package/dist/processors/memory/semantic-recall.d.ts.map +1 -0
- package/dist/processors/memory/working-memory.d.ts +65 -0
- package/dist/processors/memory/working-memory.d.ts.map +1 -0
- package/dist/processors/processors/batch-parts.d.ts +1 -1
- package/dist/processors/processors/batch-parts.d.ts.map +1 -1
- package/dist/processors/processors/index.d.ts +2 -1
- package/dist/processors/processors/index.d.ts.map +1 -1
- package/dist/processors/processors/language-detector.d.ts +15 -1
- package/dist/processors/processors/language-detector.d.ts.map +1 -1
- package/dist/processors/processors/moderation.d.ts +15 -1
- package/dist/processors/processors/moderation.d.ts.map +1 -1
- package/dist/processors/processors/pii-detector.d.ts +15 -1
- package/dist/processors/processors/pii-detector.d.ts.map +1 -1
- package/dist/processors/processors/prompt-injection-detector.d.ts +15 -1
- package/dist/processors/processors/prompt-injection-detector.d.ts.map +1 -1
- package/dist/processors/processors/structured-output.d.ts +3 -2
- package/dist/processors/processors/structured-output.d.ts.map +1 -1
- package/dist/processors/processors/system-prompt-scrubber.d.ts +1 -1
- package/dist/processors/processors/system-prompt-scrubber.d.ts.map +1 -1
- package/dist/processors/processors/token-limiter.d.ts +22 -12
- package/dist/processors/processors/token-limiter.d.ts.map +1 -1
- package/dist/processors/processors/tool-call-filter.d.ts +28 -0
- package/dist/processors/processors/tool-call-filter.d.ts.map +1 -0
- package/dist/processors/processors/unicode-normalizer.d.ts +1 -1
- package/dist/processors/processors/unicode-normalizer.d.ts.map +1 -1
- package/dist/processors/runner.d.ts +35 -4
- package/dist/processors/runner.d.ts.map +1 -1
- package/dist/provider-registry-A7FILT6Q.cjs +40 -0
- package/dist/provider-registry-A7FILT6Q.cjs.map +1 -0
- package/dist/provider-registry-XM2YDI5X.js +3 -0
- package/dist/provider-registry-XM2YDI5X.js.map +1 -0
- package/dist/provider-registry.json +1038 -55
- package/dist/{registry-generator-MK63POJO.cjs → registry-generator-34SC4TAU.cjs} +23 -6
- package/dist/registry-generator-34SC4TAU.cjs.map +1 -0
- package/dist/{registry-generator-H4YNODDH.js → registry-generator-UMTNPBJX.js} +23 -7
- package/dist/registry-generator-UMTNPBJX.js.map +1 -0
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +1 -1
- package/dist/request-context/index.cjs +10 -2
- package/dist/request-context/index.d.ts +26 -0
- package/dist/request-context/index.d.ts.map +1 -1
- package/dist/request-context/index.js +1 -1
- package/dist/server/auth.d.ts +11 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/base.d.ts +51 -0
- package/dist/server/base.d.ts.map +1 -0
- package/dist/server/composite-auth.d.ts +9 -0
- package/dist/server/composite-auth.d.ts.map +1 -0
- package/dist/server/index.cjs +124 -3
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +121 -3
- package/dist/server/index.js.map +1 -1
- package/dist/server/simple-auth.d.ts +27 -0
- package/dist/server/simple-auth.d.ts.map +1 -0
- package/dist/storage/base.d.ts +76 -3
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/constants.d.ts +3 -1
- package/dist/storage/constants.d.ts.map +1 -1
- package/dist/storage/domains/agents/base.d.ts +49 -0
- package/dist/storage/domains/agents/base.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts +3 -0
- package/dist/storage/domains/agents/index.d.ts.map +1 -0
- package/dist/storage/domains/agents/inmemory.d.ts +22 -0
- package/dist/storage/domains/agents/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/index.d.ts +1 -0
- package/dist/storage/domains/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/scores/base.d.ts +2 -2
- package/dist/storage/domains/scores/base.d.ts.map +1 -1
- package/dist/storage/domains/scores/inmemory.d.ts +2 -2
- package/dist/storage/domains/scores/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/workflows/base.d.ts +4 -0
- package/dist/storage/domains/workflows/base.d.ts.map +1 -1
- package/dist/storage/domains/workflows/inmemory.d.ts +5 -1
- package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
- package/dist/storage/index.cjs +65 -29
- package/dist/storage/index.js +1 -1
- package/dist/storage/mock.d.ts +7 -2
- package/dist/storage/mock.d.ts.map +1 -1
- package/dist/storage/storageWithInit.d.ts.map +1 -1
- package/dist/storage/types.d.ts +85 -2
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/utils.d.ts +82 -0
- package/dist/storage/utils.d.ts.map +1 -1
- package/dist/stream/MastraAgentNetworkStream.d.ts +1 -1
- package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
- package/dist/stream/MastraWorkflowStream.d.ts +1 -1
- package/dist/stream/MastraWorkflowStream.d.ts.map +1 -1
- package/dist/stream/RunOutput.d.ts +2 -2
- package/dist/stream/RunOutput.d.ts.map +1 -1
- package/dist/stream/aisdk/v4/usage.d.ts +19 -0
- package/dist/stream/aisdk/v4/usage.d.ts.map +1 -0
- package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/execute.d.ts +8 -4
- package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/input.d.ts +4 -1
- package/dist/stream/aisdk/v5/input.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/output.d.ts +9 -9
- package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
- package/dist/stream/base/base.d.ts +1 -1
- package/dist/stream/base/base.d.ts.map +1 -1
- package/dist/stream/base/input.d.ts +1 -1
- package/dist/stream/base/output-format-handlers.d.ts +14 -1
- package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts +3 -3
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +15 -11
- package/dist/stream/index.d.ts +2 -2
- package/dist/stream/index.d.ts.map +1 -1
- package/dist/stream/index.js +2 -2
- package/dist/stream/types.d.ts +48 -25
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.cjs +101 -30
- package/dist/test-utils/llm-mock.cjs.map +1 -1
- package/dist/test-utils/llm-mock.d.ts +7 -2
- package/dist/test-utils/llm-mock.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.js +97 -30
- package/dist/test-utils/llm-mock.js.map +1 -1
- package/dist/tools/index.cjs +6 -6
- package/dist/tools/index.js +2 -2
- package/dist/tools/is-vercel-tool.cjs +2 -2
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/stream.d.ts +10 -4
- package/dist/tools/stream.d.ts.map +1 -1
- package/dist/tools/tool-builder/builder.d.ts +2 -0
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/tool-stream-types.test-d.d.ts +2 -0
- package/dist/tools/tool-stream-types.test-d.d.ts.map +1 -0
- package/dist/tools/tool.d.ts +21 -8
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +33 -6
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/validation.d.ts +25 -1
- package/dist/tools/validation.d.ts.map +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/types/zod-compat.d.ts +14 -1
- package/dist/types/zod-compat.d.ts.map +1 -1
- package/dist/utils.cjs +25 -21
- package/dist/utils.d.ts +9 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/vector/filter/index.cjs +7 -189
- package/dist/vector/filter/index.cjs.map +1 -1
- package/dist/vector/filter/index.js +1 -190
- package/dist/vector/filter/index.js.map +1 -1
- package/dist/vector/index.cjs +7 -2
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.d.ts.map +1 -1
- package/dist/vector/index.js +2 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/types.d.ts +86 -3
- package/dist/vector/types.d.ts.map +1 -1
- package/dist/vector/vector.d.ts +39 -2
- package/dist/vector/vector.d.ts.map +1 -1
- package/dist/voice/aisdk/index.d.ts +3 -0
- package/dist/voice/aisdk/index.d.ts.map +1 -0
- package/dist/voice/aisdk/speech.d.ts +23 -0
- package/dist/voice/aisdk/speech.d.ts.map +1 -0
- package/dist/voice/aisdk/transcription.d.ts +22 -0
- package/dist/voice/aisdk/transcription.d.ts.map +1 -0
- package/dist/voice/composite-voice.d.ts +4 -3
- package/dist/voice/composite-voice.d.ts.map +1 -1
- package/dist/voice/index.cjs +12 -4
- package/dist/voice/index.d.ts +1 -0
- package/dist/voice/index.d.ts.map +1 -1
- package/dist/voice/index.js +1 -1
- package/dist/workflows/default.d.ts +179 -270
- package/dist/workflows/default.d.ts.map +1 -1
- package/dist/workflows/evented/execution-engine.d.ts +3 -1
- package/dist/workflows/evented/execution-engine.d.ts.map +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/step-executor.d.ts +1 -1
- package/dist/workflows/evented/step-executor.d.ts.map +1 -1
- package/dist/workflows/evented/workflow-event-processor/index.d.ts +5 -4
- package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
- package/dist/workflows/evented/workflow-event-processor/loop.d.ts +1 -1
- package/dist/workflows/evented/workflow-event-processor/loop.d.ts.map +1 -1
- package/dist/workflows/evented/workflow-event-processor/parallel.d.ts +2 -2
- package/dist/workflows/evented/workflow-event-processor/parallel.d.ts.map +1 -1
- package/dist/workflows/evented/workflow-event-processor/sleep.d.ts +2 -2
- package/dist/workflows/evented/workflow-event-processor/sleep.d.ts.map +1 -1
- package/dist/workflows/evented/workflow.d.ts +2 -1
- package/dist/workflows/evented/workflow.d.ts.map +1 -1
- package/dist/workflows/execution-engine.d.ts +8 -6
- package/dist/workflows/execution-engine.d.ts.map +1 -1
- package/dist/workflows/handlers/control-flow.d.ts +133 -0
- package/dist/workflows/handlers/control-flow.d.ts.map +1 -0
- package/dist/workflows/handlers/entry.d.ts +43 -0
- package/dist/workflows/handlers/entry.d.ts.map +1 -0
- package/dist/workflows/handlers/sleep.d.ts +60 -0
- package/dist/workflows/handlers/sleep.d.ts.map +1 -0
- package/dist/workflows/handlers/step.d.ts +58 -0
- package/dist/workflows/handlers/step.d.ts.map +1 -0
- package/dist/workflows/index.cjs +36 -16
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/step.d.ts +8 -6
- package/dist/workflows/step.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +223 -10
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/utils.d.ts +36 -0
- package/dist/workflows/utils.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +135 -54
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +26 -30
- package/src/llm/model/provider-types.generated.d.ts +473 -24
- package/dist/chunk-2ZVKF4HP.cjs.map +0 -1
- package/dist/chunk-436FFEF6.js +0 -34
- package/dist/chunk-436FFEF6.js.map +0 -1
- package/dist/chunk-4CDL2QJT.js.map +0 -1
- package/dist/chunk-7AHYOMHJ.js +0 -149
- package/dist/chunk-7AHYOMHJ.js.map +0 -1
- package/dist/chunk-CB575O6L.cjs.map +0 -1
- package/dist/chunk-CD56CXVE.cjs.map +0 -1
- package/dist/chunk-CINNK34N.js.map +0 -1
- package/dist/chunk-DNEURYF3.cjs.map +0 -1
- package/dist/chunk-DSNPWVIG.cjs.map +0 -1
- package/dist/chunk-E7K4FTLN.cjs.map +0 -1
- package/dist/chunk-ECFXGXWO.cjs.map +0 -1
- package/dist/chunk-ET6UOTTU.cjs +0 -154
- package/dist/chunk-ET6UOTTU.cjs.map +0 -1
- package/dist/chunk-GGYKYORQ.cjs.map +0 -1
- package/dist/chunk-GRBGQ2GE.js.map +0 -1
- package/dist/chunk-H6CZGPZD.js.map +0 -1
- package/dist/chunk-HDJFSJCK.js +0 -2237
- package/dist/chunk-HDJFSJCK.js.map +0 -1
- package/dist/chunk-HGNRQ3OG.js +0 -58
- package/dist/chunk-HGNRQ3OG.js.map +0 -1
- package/dist/chunk-I4CXL4SR.js.map +0 -1
- package/dist/chunk-IQO7ANVS.cjs.map +0 -1
- package/dist/chunk-J7O6WENZ.cjs.map +0 -1
- package/dist/chunk-JPGVRWWL.js.map +0 -1
- package/dist/chunk-JUBFO5J3.js.map +0 -1
- package/dist/chunk-JV2KH24V.js.map +0 -1
- package/dist/chunk-KIZIOFZC.js.map +0 -1
- package/dist/chunk-KJ2SW6VA.js.map +0 -1
- package/dist/chunk-LJFJTTZQ.cjs +0 -4
- package/dist/chunk-LJFJTTZQ.cjs.map +0 -1
- package/dist/chunk-LRSB62Z6.cjs +0 -60
- package/dist/chunk-LRSB62Z6.cjs.map +0 -1
- package/dist/chunk-LWBQ4P4N.cjs +0 -2240
- package/dist/chunk-LWBQ4P4N.cjs.map +0 -1
- package/dist/chunk-MA7TEM62.cjs.map +0 -1
- package/dist/chunk-MSWTA73A.cjs.map +0 -1
- package/dist/chunk-MV7KHWUT.js.map +0 -1
- package/dist/chunk-QUKUN6NR.cjs.map +0 -1
- package/dist/chunk-TQTAMPSC.js.map +0 -1
- package/dist/chunk-UIZSWUKP.js.map +0 -1
- package/dist/chunk-V3VLOOSW.cjs +0 -36
- package/dist/chunk-V3VLOOSW.cjs.map +0 -1
- package/dist/chunk-VOQ3ULMT.js.map +0 -1
- package/dist/chunk-VOY2RXOC.cjs.map +0 -1
- package/dist/chunk-W7UH2PWL.js.map +0 -1
- package/dist/chunk-WM6CK2F3.cjs.map +0 -1
- package/dist/chunk-XEVG546F.js.map +0 -1
- package/dist/chunk-Y63IFHEZ.cjs.map +0 -1
- package/dist/chunk-ZV5CC35D.js +0 -3
- package/dist/chunk-ZV5CC35D.js.map +0 -1
- package/dist/models-dev-DNBKXHT4.js +0 -3
- package/dist/models-dev-YBEEQIX6.cjs +0 -12
- package/dist/netlify-7G2L5VSH.js +0 -3
- package/dist/netlify-GWNGSIRZ.cjs +0 -12
- package/dist/registry-generator-H4YNODDH.js.map +0 -1
- package/dist/registry-generator-MK63POJO.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,1131 @@
|
|
|
1
1
|
# @mastra/core
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add support for typed structured output in agent workflow steps ([#11014](https://github.com/mastra-ai/mastra/pull/11014))
|
|
8
|
+
|
|
9
|
+
When wrapping an agent with `createStep()` and providing a `structuredOutput.schema`, the step's `outputSchema` is now correctly inferred from the provided schema instead of defaulting to `{ text: string }`.
|
|
10
|
+
|
|
11
|
+
This enables type-safe chaining of agent steps with structured output to subsequent steps:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
const articleSchema = z.object({
|
|
15
|
+
title: z.string(),
|
|
16
|
+
summary: z.string(),
|
|
17
|
+
tags: z.array(z.string()),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Agent step with structured output - outputSchema is now articleSchema
|
|
21
|
+
const agentStep = createStep(agent, {
|
|
22
|
+
structuredOutput: { schema: articleSchema },
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Next step can receive the structured output directly
|
|
26
|
+
const processStep = createStep({
|
|
27
|
+
id: 'process',
|
|
28
|
+
inputSchema: articleSchema, // Matches agent's outputSchema
|
|
29
|
+
outputSchema: z.object({ tagCount: z.number() }),
|
|
30
|
+
execute: async ({ inputData }) => ({
|
|
31
|
+
tagCount: inputData.tags.length, // Fully typed!
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
workflow.then(agentStep).then(processStep).commit();
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
When `structuredOutput` is not provided, the agent step continues to use the default `{ text: string }` output schema.
|
|
39
|
+
|
|
40
|
+
- Fixed a bug where multiple tools streaming output simultaneously could fail with "WritableStreamDefaultWriter is locked" errors. Tool streaming now works reliably during concurrent tool executions. ([#10830](https://github.com/mastra-ai/mastra/pull/10830))
|
|
41
|
+
|
|
42
|
+
- Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
await workflow.deleteWorkflowRunById(runId);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- Fixed CachedToken tracking in all Observability Exporters. Also fixed TimeToFirstToken in Langfuse, Braintrust, PostHog exporters. Fixed trace formatting in Posthog Exporter. ([#11029](https://github.com/mastra-ai/mastra/pull/11029))
|
|
49
|
+
|
|
50
|
+
- fix: persist data-\* chunks from writer.custom() to memory storage ([#10884](https://github.com/mastra-ai/mastra/pull/10884))
|
|
51
|
+
- Add persistence for custom data chunks (`data-*` parts) emitted via `writer.custom()` in tools
|
|
52
|
+
- Data chunks are now saved to message storage so they survive page refreshes
|
|
53
|
+
- Update `@assistant-ui/react` to v0.11.47 with native `DataMessagePart` support
|
|
54
|
+
- Convert `data-*` parts to `DataMessagePart` format (`{ type: 'data', name: string, data: T }`)
|
|
55
|
+
- Update related `@assistant-ui/*` packages for compatibility
|
|
56
|
+
|
|
57
|
+
- Fixed double validation bug that prevented Zod transforms from working correctly in tool schemas. ([#11025](https://github.com/mastra-ai/mastra/pull/11025))
|
|
58
|
+
|
|
59
|
+
When tools with Zod `.transform()` or `.pipe()` in their `outputSchema` were executed through the Agent pipeline, validation was happening twice - once in Tool.execute() (correct) and again in CoreToolBuilder (incorrect). The second validation received already-transformed data but expected pre-transform data, causing validation errors.
|
|
60
|
+
|
|
61
|
+
This fix enables proper use of Zod transforms in both `inputSchema` (for normalizing/cleaning input data) and `outputSchema` (for transforming output data to be LLM-friendly).
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [[`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932)]:
|
|
64
|
+
- @mastra/observability@1.0.0-beta.4
|
|
65
|
+
|
|
66
|
+
## 1.0.0-beta.9
|
|
67
|
+
|
|
68
|
+
### Minor Changes
|
|
69
|
+
|
|
70
|
+
- Add stored agents support ([#10953](https://github.com/mastra-ai/mastra/pull/10953))
|
|
71
|
+
|
|
72
|
+
Agents can now be stored in the database and loaded at runtime. This lets you persist agent configurations and dynamically create executable Agent instances from storage.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { Mastra } from '@mastra/core';
|
|
76
|
+
import { LibSQLStore } from '@mastra/libsql';
|
|
77
|
+
|
|
78
|
+
const mastra = new Mastra({
|
|
79
|
+
storage: new LibSQLStore({ url: ':memory:' }),
|
|
80
|
+
tools: { myTool },
|
|
81
|
+
scorers: { myScorer },
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Create agent in storage via API or directly
|
|
85
|
+
await mastra.getStorage().createAgent({
|
|
86
|
+
agent: {
|
|
87
|
+
id: 'my-agent',
|
|
88
|
+
name: 'My Agent',
|
|
89
|
+
instructions: 'You are helpful',
|
|
90
|
+
model: { provider: 'openai', name: 'gpt-4' },
|
|
91
|
+
tools: { myTool: {} },
|
|
92
|
+
scorers: { myScorer: { sampling: { type: 'ratio', rate: 0.5 } } },
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Load and use the agent
|
|
97
|
+
const agent = await mastra.getStoredAgentById('my-agent');
|
|
98
|
+
const response = await agent.generate({ messages: 'Hello!' });
|
|
99
|
+
|
|
100
|
+
// List all stored agents with pagination
|
|
101
|
+
const { agents, total, hasMore } = await mastra.listStoredAgents({
|
|
102
|
+
page: 0,
|
|
103
|
+
perPage: 10,
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Also adds a memory registry to Mastra so stored agents can reference memory instances by key.
|
|
108
|
+
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- Add agentId and agentName attributes to MODEL_GENERATION spans. This allows users to correlate gen_ai.usage metrics with specific agents when analyzing LLM operation spans. The attributes are exported as gen_ai.agent.id and gen_ai.agent.name in the OtelExporter. ([#10984](https://github.com/mastra-ai/mastra/pull/10984))
|
|
112
|
+
|
|
113
|
+
- Fix JSON parsing errors when LLMs output unescaped newlines in structured output strings ([#10965](https://github.com/mastra-ai/mastra/pull/10965))
|
|
114
|
+
|
|
115
|
+
Some LLMs (particularly when not using native JSON mode) output actual newline characters inside JSON string values instead of properly escaped `\n` sequences. This breaks JSON parsing and causes structured output to fail.
|
|
116
|
+
|
|
117
|
+
This change adds preprocessing to escape unescaped control characters (`\n`, `\r`, `\t`) within JSON string values before parsing, making structured output more robust across different LLM providers.
|
|
118
|
+
|
|
119
|
+
- Fix toolCallId propagation in agent network tool execution. The toolCallId property was undefined at runtime despite being required by TypeScript type definitions in AgentToolExecutionContext. Now properly passes the toolCallId through to the tool's context during network tool execution. ([#10951](https://github.com/mastra-ai/mastra/pull/10951))
|
|
120
|
+
|
|
121
|
+
- Exports `convertFullStreamChunkToMastra` from the stream module for AI SDK stream chunk transformations. ([#10911](https://github.com/mastra-ai/mastra/pull/10911))
|
|
122
|
+
|
|
123
|
+
## 1.0.0-beta.8
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- Fix saveScore not persisting ID correctly, breaking getScoreById retrieval ([#10915](https://github.com/mastra-ai/mastra/pull/10915))
|
|
128
|
+
|
|
129
|
+
**What Changed**
|
|
130
|
+
- saveScore now correctly returns scores that can be retrieved with getScoreById
|
|
131
|
+
- Validation errors now include contextual information (scorer, entity, trace details) for easier debugging
|
|
132
|
+
|
|
133
|
+
**Impact**
|
|
134
|
+
Previously, calling getScoreById after saveScore would return null because the generated ID wasn't persisted to the database. This is now fixed across all store implementations, ensuring consistent behavior and data integrity.
|
|
135
|
+
|
|
136
|
+
- `setState` is now async ([#10944](https://github.com/mastra-ai/mastra/pull/10944))
|
|
137
|
+
- `setState` must now be awaited: `await setState({ key: value })`
|
|
138
|
+
- State updates are merged automatically—no need to spread the previous state
|
|
139
|
+
- State data is validated against the step's `stateSchema` when `validateInputs` is enabled (default: `true`)
|
|
140
|
+
|
|
141
|
+
- Add human-in-the-loop support for workflows used in agent ([#10871](https://github.com/mastra-ai/mastra/pull/10871))
|
|
142
|
+
|
|
143
|
+
## 1.0.0-beta.7
|
|
144
|
+
|
|
145
|
+
### Minor Changes
|
|
146
|
+
|
|
147
|
+
- Add `disableInit` option to all storage adapters ([#10851](https://github.com/mastra-ai/mastra/pull/10851))
|
|
148
|
+
|
|
149
|
+
Adds a new `disableInit` config option to all storage providers that allows users to disable automatic table creation/migrations at runtime. This is useful for CI/CD pipelines where you want to run migrations during deployment with elevated credentials, then run the application with `disableInit: true` so it doesn't attempt schema changes at runtime.
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// CI/CD script - run migrations
|
|
153
|
+
const storage = new PostgresStore({
|
|
154
|
+
connectionString: DATABASE_URL,
|
|
155
|
+
id: 'pg-storage',
|
|
156
|
+
});
|
|
157
|
+
await storage.init();
|
|
158
|
+
|
|
159
|
+
// Runtime - skip auto-init
|
|
160
|
+
const storage = new PostgresStore({
|
|
161
|
+
connectionString: DATABASE_URL,
|
|
162
|
+
id: 'pg-storage',
|
|
163
|
+
disableInit: true,
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- Add time-to-first-token (TTFT) support for Langfuse integration ([#10781](https://github.com/mastra-ai/mastra/pull/10781))
|
|
170
|
+
|
|
171
|
+
Adds `completionStartTime` to model generation spans, which Langfuse uses to calculate TTFT metrics. The timestamp is automatically captured when the first content chunk arrives during streaming.
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
// completionStartTime is now automatically captured and sent to Langfuse
|
|
175
|
+
// enabling TTFT metrics in your Langfuse dashboard
|
|
176
|
+
const result = await agent.stream('Hello');
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
- Updated OtelExporters, Bridge, and Arize packages to better implement GenAI v1.38.0 Otel Semantic Conventions. See: ([#10591](https://github.com/mastra-ai/mastra/pull/10591))
|
|
180
|
+
https://github.com/open-telemetry/semantic-conventions/blob/v1.38.0/docs/gen-ai/README.md
|
|
181
|
+
|
|
182
|
+
- Standardize error IDs across all storage and vector stores using centralized helper functions (`createStorageErrorId` and `createVectorErrorId`). This ensures consistent error ID patterns (`MASTRA_STORAGE_{STORE}_{OPERATION}_{STATUS}` and `MASTRA_VECTOR_{STORE}_{OPERATION}_{STATUS}`) across the codebase for better error tracking and debugging. ([#10913](https://github.com/mastra-ai/mastra/pull/10913))
|
|
183
|
+
|
|
184
|
+
- fix: generate unique text IDs for Anthropic/Google providers ([#10740](https://github.com/mastra-ai/mastra/pull/10740))
|
|
185
|
+
|
|
186
|
+
Workaround for duplicate text-start/text-end IDs in multi-step agentic flows.
|
|
187
|
+
|
|
188
|
+
The `@ai-sdk/anthropic` and `@ai-sdk/google` providers use numeric indices ("0", "1", etc.) for text block IDs that reset for each LLM call. This caused duplicate IDs when an agent does TEXT → TOOL → TEXT, breaking message ordering and storage.
|
|
189
|
+
|
|
190
|
+
The fix replaces numeric IDs with UUIDs, maintaining a map per step so text-start, text-delta, and text-end chunks for the same block share the same UUID. OpenAI's UUIDs pass through unchanged.
|
|
191
|
+
|
|
192
|
+
Related: #9909
|
|
193
|
+
|
|
194
|
+
- Fix sub-agent requestContext propagation in listAgentTools ([#10844](https://github.com/mastra-ai/mastra/pull/10844))
|
|
195
|
+
|
|
196
|
+
Sub-agents with dynamic model configurations were broken because `requestContext` was not being passed to `getModel()` when creating agent tools. This caused sub-agents using function-based model configurations to receive an empty context instead of the parent's context.
|
|
197
|
+
|
|
198
|
+
No code changes required for consumers - this fix restores expected behavior for dynamic model configurations in sub-agents.
|
|
199
|
+
|
|
200
|
+
- Fix ToolStream type error when piping streams with different types ([#10845](https://github.com/mastra-ai/mastra/pull/10845))
|
|
201
|
+
|
|
202
|
+
Changes `ToolStream` to extend `WritableStream<unknown>` instead of `WritableStream<T>`. This fixes the TypeScript error when piping `objectStream` or `fullStream` to `writer` in workflow steps.
|
|
203
|
+
|
|
204
|
+
Before:
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
// TypeError: ToolStream<ChunkType> is not assignable to WritableStream<Partial<StoryPlan>>
|
|
208
|
+
await response.objectStream.pipeTo(writer);
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
After:
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
// Works without type errors
|
|
215
|
+
await response.objectStream.pipeTo(writer);
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
- feat: add native Perplexity provider support ([#10885](https://github.com/mastra-ai/mastra/pull/10885))
|
|
219
|
+
|
|
220
|
+
- When sending the first message to a new thread with PostgresStore, users would get a "Thread not found" error. This happened because the thread was created in memory but not persisted to the database before the MessageHistory output processor tried to save messages. ([#10881](https://github.com/mastra-ai/mastra/pull/10881))
|
|
221
|
+
|
|
222
|
+
**Before:**
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
threadObject = await memory.createThread({
|
|
226
|
+
// ...
|
|
227
|
+
saveThread: false, // thread not in DB yet
|
|
228
|
+
});
|
|
229
|
+
// Later: MessageHistory calls saveMessages() -> PostgresStore throws "Thread not found"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**After:**
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
threadObject = await memory.createThread({
|
|
236
|
+
// ...
|
|
237
|
+
saveThread: true, // thread persisted immediately
|
|
238
|
+
});
|
|
239
|
+
// MessageHistory can now save messages without error
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
- Emit error chunk and call onError when agent workflow step fails ([#10907](https://github.com/mastra-ai/mastra/pull/10907))
|
|
243
|
+
|
|
244
|
+
When a workflow step fails (e.g., tool not found), the error is now properly emitted as an error chunk to the stream and the onError callback is called. This fixes the issue where agent.generate() would throw "promise 'text' was not resolved or rejected" instead of the actual error message.
|
|
245
|
+
|
|
246
|
+
- fix(core): use agent description when converting agent to tool ([#10879](https://github.com/mastra-ai/mastra/pull/10879))
|
|
247
|
+
|
|
248
|
+
- Adds native @ai-sdk/deepseek provider support instead of using the OpenAI-compatible fallback. ([#10822](https://github.com/mastra-ai/mastra/pull/10822))
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
const agent = new Agent({
|
|
252
|
+
model: 'deepseek/deepseek-reasoner',
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// With provider options for reasoning
|
|
256
|
+
const response = await agent.generate('Solve this problem', {
|
|
257
|
+
providerOptions: {
|
|
258
|
+
deepseek: {
|
|
259
|
+
thinking: { type: 'enabled' },
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Also updates the doc generation scripts so DeepSeek provider options show up in the generated docs.
|
|
266
|
+
|
|
267
|
+
- Return state too if `includeState: true` is in `outputOptions` and workflow run is not successful ([#10806](https://github.com/mastra-ai/mastra/pull/10806))
|
|
268
|
+
|
|
269
|
+
- feat: Add partial response support for agent and workflow list endpoints ([#10886](https://github.com/mastra-ai/mastra/pull/10886))
|
|
270
|
+
|
|
271
|
+
Add optional `partial` query parameter to `/api/agents` and `/api/workflows` endpoints to return minimal data without schemas, reducing payload size for list views:
|
|
272
|
+
- When `partial=true`: tool schemas (inputSchema, outputSchema) are omitted
|
|
273
|
+
- When `partial=true`: workflow steps are replaced with stepCount integer
|
|
274
|
+
- When `partial=true`: workflow root schemas (inputSchema, outputSchema) are omitted
|
|
275
|
+
- Maintains backward compatibility when partial parameter is not provided
|
|
276
|
+
|
|
277
|
+
## Server Endpoint Usage
|
|
278
|
+
|
|
279
|
+
```http
|
|
280
|
+
# Get partial agent data (no tool schemas)
|
|
281
|
+
GET /api/agents?partial=true
|
|
282
|
+
|
|
283
|
+
# Get full agent data (default behavior)
|
|
284
|
+
GET /api/agents
|
|
285
|
+
|
|
286
|
+
# Get partial workflow data (stepCount instead of steps, no schemas)
|
|
287
|
+
GET /api/workflows?partial=true
|
|
288
|
+
|
|
289
|
+
# Get full workflow data (default behavior)
|
|
290
|
+
GET /api/workflows
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Client SDK Usage
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
import { MastraClient } from '@mastra/client-js';
|
|
297
|
+
|
|
298
|
+
const client = new MastraClient({ baseUrl: 'http://localhost:4111' });
|
|
299
|
+
|
|
300
|
+
// Get partial agent list (smaller payload)
|
|
301
|
+
const partialAgents = await client.listAgents({ partial: true });
|
|
302
|
+
|
|
303
|
+
// Get full agent list with tool schemas
|
|
304
|
+
const fullAgents = await client.listAgents();
|
|
305
|
+
|
|
306
|
+
// Get partial workflow list (smaller payload)
|
|
307
|
+
const partialWorkflows = await client.listWorkflows({ partial: true });
|
|
308
|
+
|
|
309
|
+
// Get full workflow list with steps and schemas
|
|
310
|
+
const fullWorkflows = await client.listWorkflows();
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
- Fix processInputStep so it runs correctly. ([#10909](https://github.com/mastra-ai/mastra/pull/10909))
|
|
314
|
+
|
|
315
|
+
- Updated dependencies [[`6c59a40`](https://github.com/mastra-ai/mastra/commit/6c59a40e0ad160467bd13d63a8a287028d75b02d), [`3076c67`](https://github.com/mastra-ai/mastra/commit/3076c6778b18988ae7d5c4c5c466366974b2d63f), [`0bada2f`](https://github.com/mastra-ai/mastra/commit/0bada2f2c1234932cf30c1c47a719ffb64b801c5), [`cc60ff6`](https://github.com/mastra-ai/mastra/commit/cc60ff616541a3b0fb531a7e469bf9ae7bb90528)]:
|
|
316
|
+
- @mastra/observability@1.0.0-beta.3
|
|
317
|
+
|
|
318
|
+
## 1.0.0-beta.6
|
|
319
|
+
|
|
320
|
+
### Major Changes
|
|
321
|
+
|
|
322
|
+
- Changed `.branch()` result schema to make all branch output fields optional. ([#10693](https://github.com/mastra-ai/mastra/pull/10693))
|
|
323
|
+
|
|
324
|
+
**Breaking change**: Branch outputs are now optional since only one branch executes at runtime. Update your workflow schemas to handle optional branch results.
|
|
325
|
+
|
|
326
|
+
**Before:**
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
const workflow = createWorkflow({...})
|
|
330
|
+
.branch([
|
|
331
|
+
[condition1, stepA], // outputSchema: { result: z.string() }
|
|
332
|
+
[condition2, stepB], // outputSchema: { data: z.number() }
|
|
333
|
+
])
|
|
334
|
+
.map({
|
|
335
|
+
finalResult: { step: stepA, path: 'result' } // Expected non-optional
|
|
336
|
+
});
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**After:**
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
const workflow = createWorkflow({...})
|
|
343
|
+
.branch([
|
|
344
|
+
[condition1, stepA],
|
|
345
|
+
[condition2, stepB],
|
|
346
|
+
])
|
|
347
|
+
.map({
|
|
348
|
+
finalResult: {
|
|
349
|
+
step: stepA,
|
|
350
|
+
path: 'result' // Now optional - provide fallback
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
**Why**: Branch conditionals execute only one path, so non-executed branches don't produce outputs. The type system now correctly reflects this runtime behavior.
|
|
356
|
+
|
|
357
|
+
Related issue: https://github.com/mastra-ai/mastra/issues/10642
|
|
358
|
+
|
|
359
|
+
### Minor Changes
|
|
360
|
+
|
|
361
|
+
- Memory system now uses processors. Memory processors (`MessageHistory`, `SemanticRecall`, `WorkingMemory`) are now exported from `@mastra/memory/processors` and automatically added to the agent pipeline based on your memory config. Core processors (`ToolCallFilter`, `TokenLimiter`) remain in `@mastra/core/processors`. ([#9254](https://github.com/mastra-ai/mastra/pull/9254))
|
|
362
|
+
|
|
363
|
+
- Add reserved keys in RequestContext for secure resourceId/threadId setting from middleware ([#10657](https://github.com/mastra-ai/mastra/pull/10657))
|
|
364
|
+
|
|
365
|
+
This allows middleware to securely set `resourceId` and `threadId` via reserved keys in RequestContext (`MASTRA_RESOURCE_ID_KEY` and `MASTRA_THREAD_ID_KEY`), which take precedence over client-provided values for security.
|
|
366
|
+
|
|
367
|
+
- feat(workflows): add suspendData parameter to step execute function ([#10734](https://github.com/mastra-ai/mastra/pull/10734))
|
|
368
|
+
|
|
369
|
+
Adds a new `suspendData` parameter to workflow step execute functions that provides access to the data originally passed to `suspend()` when the step was suspended. This enables steps to access context about why they were suspended when they are later resumed.
|
|
370
|
+
|
|
371
|
+
**New Features:**
|
|
372
|
+
- `suspendData` parameter automatically populated in step execute function when resuming
|
|
373
|
+
- Type-safe access to suspend data matching the step's `suspendSchema`
|
|
374
|
+
- Backward compatible - existing workflows continue to work unchanged
|
|
375
|
+
|
|
376
|
+
**Example:**
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
const step = createStep({
|
|
380
|
+
suspendSchema: z.object({ reason: z.string() }),
|
|
381
|
+
resumeSchema: z.object({ approved: z.boolean() }),
|
|
382
|
+
execute: async ({ suspend, suspendData, resumeData }) => {
|
|
383
|
+
if (!resumeData?.approved) {
|
|
384
|
+
return await suspend({ reason: 'Approval required' });
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// Access original suspend data when resuming
|
|
388
|
+
console.log(`Resuming after: ${suspendData?.reason}`);
|
|
389
|
+
return { result: 'Approved' };
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
- feat(storage): support querying messages from multiple threads ([#10663](https://github.com/mastra-ai/mastra/pull/10663))
|
|
395
|
+
- Fixed TypeScript errors where `threadId: string | string[]` was being passed to places expecting `Scalar` type
|
|
396
|
+
- Added proper multi-thread support for `listMessages` across all adapters when `threadId` is an array
|
|
397
|
+
- Updated `_getIncludedMessages` to look up message threadId by ID (since message IDs are globally unique)
|
|
398
|
+
- **upstash**: Added `msg-idx:{messageId}` index for O(1) message lookups (backwards compatible with fallback to scan for old messages, with automatic backfill)
|
|
399
|
+
|
|
400
|
+
- Adds trace tagging support to the BrainTrust and Langfuse tracing exporters. ([#10765](https://github.com/mastra-ai/mastra/pull/10765))
|
|
401
|
+
|
|
402
|
+
- Add `messageList` parameter to `processOutputStream` for accessing remembered messages during streaming ([#10608](https://github.com/mastra-ai/mastra/pull/10608))
|
|
403
|
+
|
|
404
|
+
- Unify transformScoreRow functions across storage adapters ([#10648](https://github.com/mastra-ai/mastra/pull/10648))
|
|
405
|
+
|
|
406
|
+
Added a unified `transformScoreRow` function in `@mastra/core/storage` that provides schema-driven row transformation for score data. This eliminates code duplication across 10 storage adapters while maintaining store-specific behavior through configurable options:
|
|
407
|
+
- `preferredTimestampFields`: Preferred source fields for timestamps (PostgreSQL, Cloudflare D1)
|
|
408
|
+
- `convertTimestamps`: Convert timestamp strings to Date objects (MSSQL, MongoDB, ClickHouse)
|
|
409
|
+
- `nullValuePattern`: Skip values matching pattern (ClickHouse's `'_null_'`)
|
|
410
|
+
- `fieldMappings`: Map source column names to schema fields (LibSQL's `additionalLLMContext`)
|
|
411
|
+
|
|
412
|
+
Each store adapter now uses the unified function with appropriate options, reducing ~200 lines of duplicate transformation logic while ensuring consistent behavior across all storage backends.
|
|
413
|
+
|
|
414
|
+
### Patch Changes
|
|
415
|
+
|
|
416
|
+
- dependencies updates: ([#10110](https://github.com/mastra-ai/mastra/pull/10110))
|
|
417
|
+
- Updated dependency [`hono-openapi@^1.1.1` ↗︎](https://www.npmjs.com/package/hono-openapi/v/1.1.1) (from `^0.4.8`, in `dependencies`)
|
|
418
|
+
|
|
419
|
+
- unexpected json parse issue, log error but dont fail ([#10241](https://github.com/mastra-ai/mastra/pull/10241))
|
|
420
|
+
|
|
421
|
+
- Fixed a bug in agent networks where sometimes the task name was empty ([#10629](https://github.com/mastra-ai/mastra/pull/10629))
|
|
422
|
+
|
|
423
|
+
- Adds `tool-result` and `tool-error` chunks to the processor.processOutputStream path. Processors now have access to these two chunks. ([#10645](https://github.com/mastra-ai/mastra/pull/10645))
|
|
424
|
+
|
|
425
|
+
- Include `.input` in workflow results for both engines and remove the option to omit them from Inngest workflows. ([#10688](https://github.com/mastra-ai/mastra/pull/10688))
|
|
426
|
+
|
|
427
|
+
- `getSpeakers` endpoint returns an empty array if voice is not configured on the agent and `getListeners` endpoint returns `{ enabled: false }` if voice is not figured on the agent. ([#10560](https://github.com/mastra-ai/mastra/pull/10560))
|
|
428
|
+
|
|
429
|
+
When no voice is set on agent don't throw error, by default set voice to undefined rather than DefaultVoice which throws errors when it is accessed.
|
|
430
|
+
|
|
431
|
+
- SimpleAuth and improved CloudAuth ([#10490](https://github.com/mastra-ai/mastra/pull/10490))
|
|
432
|
+
|
|
433
|
+
- When LLMs like Claude Sonnet 4.5 and Gemini 2.4 call tools with all-optional parameters, they send `args: undefined` instead of `args: {}`. This caused validation to fail with "root: Required". ([#10728](https://github.com/mastra-ai/mastra/pull/10728))
|
|
434
|
+
|
|
435
|
+
The fix normalizes `undefined`/`null` to `{}` for object schemas and `[]` for array schemas before validation.
|
|
436
|
+
|
|
437
|
+
- Fixed tool validation error messages so logs show Zod validation errors directly instead of hiding them inside structured JSON. ([#10579](https://github.com/mastra-ai/mastra/pull/10579))
|
|
438
|
+
|
|
439
|
+
- Fix error when spreading config objects in Mastra constructor ([#10718](https://github.com/mastra-ai/mastra/pull/10718))
|
|
440
|
+
|
|
441
|
+
Adds validation guards to handle undefined/null values that can occur when config objects are spread (`{ ...config }`). Previously, if getters or non-enumerable properties resulted in undefined values during spread, the constructor would throw cryptic errors when accessing `.id` or `.name` on undefined objects.
|
|
442
|
+
|
|
443
|
+
- Fix GPT-5/o3 reasoning models failing with "required reasoning item" errors when using memory with tools. Empty reasoning is now stored with providerMetadata to preserve OpenAI's item_reference. ([#10585](https://github.com/mastra-ai/mastra/pull/10585))
|
|
444
|
+
|
|
445
|
+
- Fix generateTitle model type to accept AI SDK LanguageModelV2 ([#10541](https://github.com/mastra-ai/mastra/pull/10541))
|
|
446
|
+
|
|
447
|
+
Updated the `generateTitle.model` config option to accept `MastraModelConfig` instead of `MastraLanguageModel`. This allows users to pass raw AI SDK `LanguageModelV2` models (e.g., `anthropic.languageModel('claude-3-5-haiku-20241022')`) directly without type errors.
|
|
448
|
+
|
|
449
|
+
Previously, passing a standard `LanguageModelV2` would fail because `MastraLanguageModelV2` has different `doGenerate`/`doStream` return types. Now `MastraModelConfig` is used consistently across:
|
|
450
|
+
- `memory/types.ts` - `generateTitle.model` config
|
|
451
|
+
- `agent.ts` - `genTitle`, `generateTitleFromUserMessage`, `resolveTitleGenerationConfig`
|
|
452
|
+
- `agent-legacy.ts` - `AgentLegacyCapabilities` interface
|
|
453
|
+
|
|
454
|
+
- Fix message ordering when using toAISdkV5Messages or prepareStep ([#10686](https://github.com/mastra-ai/mastra/pull/10686))
|
|
455
|
+
|
|
456
|
+
Messages without `createdAt` timestamps were getting shuffled because they all received identical timestamps during conversion. Now messages are assigned monotonically increasing timestamps via `generateCreatedAt()`, preserving input order.
|
|
457
|
+
|
|
458
|
+
Before:
|
|
459
|
+
|
|
460
|
+
```
|
|
461
|
+
Input: [user: "hello", assistant: "Hi!", user: "bye"]
|
|
462
|
+
Output: [user: "bye", assistant: "Hi!", user: "hello"] // shuffled!
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
After:
|
|
466
|
+
|
|
467
|
+
```
|
|
468
|
+
Input: [user: "hello", assistant: "Hi!", user: "bye"]
|
|
469
|
+
Output: [user: "hello", assistant: "Hi!", user: "bye"] // correct order
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
- Fix Scorer not using custom gateways registered with Mastra ([#10778](https://github.com/mastra-ai/mastra/pull/10778))
|
|
473
|
+
|
|
474
|
+
Scorers now have access to custom gateways when resolving models. Previously, calling `resolveModelConfig` in the scorer didn't pass the Mastra instance, so custom gateways were never available.
|
|
475
|
+
|
|
476
|
+
- Fix workflow run status not being updated from storage snapshot in createRun ([#10664](https://github.com/mastra-ai/mastra/pull/10664))
|
|
477
|
+
|
|
478
|
+
When createRun is called with an existing runId, it now correctly updates the run's status from the storage snapshot. This fixes the issue where different workflow instances (e.g., different API requests) would get a run with 'pending' status instead of the correct status from storage (e.g., 'suspended').
|
|
479
|
+
|
|
480
|
+
- Pass resourceId and threadId to network agent's subAgent when it has its own memory ([#10592](https://github.com/mastra-ai/mastra/pull/10592))
|
|
481
|
+
|
|
482
|
+
- use `agent.getMemory` to fetch the memory instance on the Agent class to make sure that storage gets set if memory doesn't set it itself. ([#10556](https://github.com/mastra-ai/mastra/pull/10556))
|
|
483
|
+
|
|
484
|
+
- Built-in processors that use internal agents (PromptInjectionDetector, ModerationProcessor, PIIDetector, LanguageDetector, StructuredOutputProcessor) now accept `providerOptions` to control model behavior. ([#10651](https://github.com/mastra-ai/mastra/pull/10651))
|
|
485
|
+
|
|
486
|
+
This lets you pass provider-specific settings like `reasoningEffort` for OpenAI thinking models:
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
const processor = new PromptInjectionDetector({
|
|
490
|
+
model: 'openai/o1-mini',
|
|
491
|
+
threshold: 0.7,
|
|
492
|
+
strategy: 'block',
|
|
493
|
+
providerOptions: {
|
|
494
|
+
openai: {
|
|
495
|
+
reasoningEffort: 'low',
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
});
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
- Improved typing for `workflow.then` to allow the provided steps `inputSchema` to be a subset of the previous steps `outputSchema`. Also errors if the provided steps `inputSchema` is a superset of the previous steps outputSchema. ([#10763](https://github.com/mastra-ai/mastra/pull/10763))
|
|
502
|
+
|
|
503
|
+
- Fix type issue with workflow `.parallel()` when passing multiple steps, one or more of which has a `resumeSchema` provided. ([#10708](https://github.com/mastra-ai/mastra/pull/10708))
|
|
504
|
+
|
|
505
|
+
- Adds bidirectional integration with otel tracing via a new @mastra/otel-bridge package. ([#10482](https://github.com/mastra-ai/mastra/pull/10482))
|
|
506
|
+
|
|
507
|
+
- Adds `processInputStep` method to the Processor interface. Unlike `processInput` which runs once at the start, this runs at each step of the agentic loop (including tool call continuations). ([#10650](https://github.com/mastra-ai/mastra/pull/10650))
|
|
508
|
+
|
|
509
|
+
```ts
|
|
510
|
+
const processor: Processor = {
|
|
511
|
+
id: 'my-processor',
|
|
512
|
+
processInputStep: async ({ messages, messageList, stepNumber, systemMessages }) => {
|
|
513
|
+
// Transform messages at each step before LLM call
|
|
514
|
+
return messageList;
|
|
515
|
+
},
|
|
516
|
+
};
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
- When using output processors with `agent.generate()`, `result.text` was returning the unprocessed LLM response instead of the processed text. ([#10735](https://github.com/mastra-ai/mastra/pull/10735))
|
|
520
|
+
|
|
521
|
+
**Before:**
|
|
522
|
+
|
|
523
|
+
```ts
|
|
524
|
+
const result = await agent.generate('hello');
|
|
525
|
+
result.text; // "hello world" (unprocessed)
|
|
526
|
+
result.response.messages[0].content[0].text; // "HELLO WORLD" (processed)
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
**After:**
|
|
530
|
+
|
|
531
|
+
```ts
|
|
532
|
+
const result = await agent.generate('hello');
|
|
533
|
+
result.text; // "HELLO WORLD" (processed)
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
The bug was caused by the `text` delayed promise being resolved twice - first correctly with the processed text, then overwritten with the unprocessed buffered text.
|
|
537
|
+
|
|
538
|
+
- Refactored default engine to fit durable execution better, and the inngest engine to match. ([#10627](https://github.com/mastra-ai/mastra/pull/10627))
|
|
539
|
+
Also fixes requestContext persistence by relying on inngest step memoization.
|
|
540
|
+
|
|
541
|
+
Unifies some of the stepResults and error formats in both engines.
|
|
542
|
+
|
|
543
|
+
- Allow direct access to server app handle directly from Mastra instance. ([#10598](https://github.com/mastra-ai/mastra/pull/10598))
|
|
544
|
+
|
|
545
|
+
```ts
|
|
546
|
+
// Before: HTTP request to localhost
|
|
547
|
+
const response = await fetch(`http://localhost:5000/api/tools`);
|
|
548
|
+
|
|
549
|
+
// After: Direct call via app.fetch()
|
|
550
|
+
const app = mastra.getServerApp<Hono>();
|
|
551
|
+
const response = await app.fetch(new Request('http://internal/api/tools'));
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
- Added `mastra.getServerApp<T>()` to access the underlying Hono/Express app
|
|
555
|
+
- Added `mastra.getMastraServer()` and `mastra.setMastraServer()` for adapter access
|
|
556
|
+
- Added `MastraServerBase` class in `@mastra/core/server` for adapter implementations
|
|
557
|
+
- Server adapters now auto-register with Mastra in their constructor
|
|
558
|
+
|
|
559
|
+
- Fix network agent not getting `text-delta` from subAgent when `.stream` is used ([#10533](https://github.com/mastra-ai/mastra/pull/10533))
|
|
560
|
+
|
|
561
|
+
- Fix discriminatedUnion schema information lost when json schema is converted to zod ([#10500](https://github.com/mastra-ai/mastra/pull/10500))
|
|
562
|
+
|
|
563
|
+
- Fix writer.custom not working during workflow resume operations ([#10720](https://github.com/mastra-ai/mastra/pull/10720))
|
|
564
|
+
|
|
565
|
+
When a workflow step is resumed, the writer parameter was not being properly passed through, causing writer.custom() calls to fail. This fix ensures the writableStream parameter is correctly passed to both run.resume() and run.start() calls in the workflow execution engine, allowing custom events to be emitted properly during resume operations.
|
|
566
|
+
|
|
567
|
+
- Fix corrupted provider-registry.json file in global cache and regenerate corrupted files ([#10606](https://github.com/mastra-ai/mastra/pull/10606))
|
|
568
|
+
|
|
569
|
+
- Fix TypeScript error when using Zod schemas in `defaultOptions.structuredOutput` ([#10710](https://github.com/mastra-ai/mastra/pull/10710))
|
|
570
|
+
|
|
571
|
+
Previously, defining `structuredOutput.schema` in `defaultOptions` would cause a TypeScript error because the type only accepted `undefined`. Now any valid `OutputSchema` is correctly accepted.
|
|
572
|
+
|
|
573
|
+
- Add support for `providerOptions` when defining tools. This allows developers to specify provider-specific configurations (like Anthropic's `cacheControl`) per tool. ([#10649](https://github.com/mastra-ai/mastra/pull/10649))
|
|
574
|
+
|
|
575
|
+
```typescript
|
|
576
|
+
createTool({
|
|
577
|
+
id: 'my-tool',
|
|
578
|
+
providerOptions: {
|
|
579
|
+
anthropic: { cacheControl: { type: 'ephemeral' } },
|
|
580
|
+
},
|
|
581
|
+
// ...
|
|
582
|
+
});
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
- Fixed OpenAI reasoning message merging so distinct reasoning items are no longer dropped when they share a message ID. Prevents downstream errors where a function call is missing its required "reasoning" item. See #9005. ([#10614](https://github.com/mastra-ai/mastra/pull/10614))
|
|
586
|
+
|
|
587
|
+
- Updated dependencies [[`103586c`](https://github.com/mastra-ai/mastra/commit/103586cb23ebcd2466c7f68a71674d37cc10e263), [`61a5705`](https://github.com/mastra-ai/mastra/commit/61a570551278b6743e64243b3ce7d73de915ca8a), [`db70a48`](https://github.com/mastra-ai/mastra/commit/db70a48aeeeeb8e5f92007e8ede52c364ce15287), [`f03ae60`](https://github.com/mastra-ai/mastra/commit/f03ae60500fe350c9d828621006cdafe1975fdd8)]:
|
|
588
|
+
- @mastra/observability@1.0.0-beta.2
|
|
589
|
+
- @mastra/schema-compat@1.0.0-beta.2
|
|
590
|
+
|
|
591
|
+
## 1.0.0-beta.5
|
|
592
|
+
|
|
593
|
+
### Patch Changes
|
|
594
|
+
|
|
595
|
+
- Add Azure OpenAI gateway ([#9990](https://github.com/mastra-ai/mastra/pull/9990))
|
|
596
|
+
|
|
597
|
+
The Azure OpenAI gateway supports three configuration modes:
|
|
598
|
+
1. **Static deployments**: Provide deployment names from Azure Portal
|
|
599
|
+
2. **Dynamic discovery**: Query Azure Management API for available deployments
|
|
600
|
+
3. **Manual**: Specify deployment names when creating agents
|
|
601
|
+
|
|
602
|
+
## Usage
|
|
603
|
+
|
|
604
|
+
```typescript
|
|
605
|
+
import { Mastra } from '@mastra/core';
|
|
606
|
+
import { AzureOpenAIGateway } from '@mastra/core/llm';
|
|
607
|
+
|
|
608
|
+
// Static mode (recommended)
|
|
609
|
+
export const mastra = new Mastra({
|
|
610
|
+
gateways: [
|
|
611
|
+
new AzureOpenAIGateway({
|
|
612
|
+
resourceName: process.env.AZURE_RESOURCE_NAME!,
|
|
613
|
+
apiKey: process.env.AZURE_API_KEY!,
|
|
614
|
+
deployments: ['gpt-4-prod', 'gpt-35-turbo-dev'],
|
|
615
|
+
}),
|
|
616
|
+
],
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
// Dynamic discovery mode
|
|
620
|
+
export const mastra = new Mastra({
|
|
621
|
+
gateways: [
|
|
622
|
+
new AzureOpenAIGateway({
|
|
623
|
+
resourceName: process.env.AZURE_RESOURCE_NAME!,
|
|
624
|
+
apiKey: process.env.AZURE_API_KEY!,
|
|
625
|
+
management: {
|
|
626
|
+
tenantId: process.env.AZURE_TENANT_ID!,
|
|
627
|
+
clientId: process.env.AZURE_CLIENT_ID!,
|
|
628
|
+
clientSecret: process.env.AZURE_CLIENT_SECRET!,
|
|
629
|
+
subscriptionId: process.env.AZURE_SUBSCRIPTION_ID!,
|
|
630
|
+
resourceGroup: 'my-resource-group',
|
|
631
|
+
},
|
|
632
|
+
}),
|
|
633
|
+
],
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
// Use Azure OpenAI models
|
|
637
|
+
const agent = new Agent({
|
|
638
|
+
model: 'azure-openai/gpt-4-deployment',
|
|
639
|
+
instructions: 'You are a helpful assistant',
|
|
640
|
+
});
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
- - Fix tool suspension throwing error when `outputSchema` is passed to tool during creation ([#10444](https://github.com/mastra-ai/mastra/pull/10444))
|
|
644
|
+
- Pass `suspendSchema` and `resumeSchema` from tool into step created when creating step from tool
|
|
645
|
+
|
|
646
|
+
- Add `onOutput` hook for tools ([#10466](https://github.com/mastra-ai/mastra/pull/10466))
|
|
647
|
+
|
|
648
|
+
Tools now support an `onOutput` lifecycle hook that is invoked after successful tool execution. This complements the existing `onInputStart`, `onInputDelta`, and `onInputAvailable` hooks to provide complete visibility into the tool execution lifecycle.
|
|
649
|
+
|
|
650
|
+
The `onOutput` hook receives:
|
|
651
|
+
- `output`: The tool's return value (typed according to `outputSchema`)
|
|
652
|
+
- `toolCallId`: Unique identifier for the tool call
|
|
653
|
+
- `toolName`: The name of the tool that was executed
|
|
654
|
+
- `abortSignal`: Signal for detecting if the operation should be cancelled
|
|
655
|
+
|
|
656
|
+
Example usage:
|
|
657
|
+
|
|
658
|
+
```typescript
|
|
659
|
+
import { createTool } from '@mastra/core/tools';
|
|
660
|
+
import { z } from 'zod';
|
|
661
|
+
|
|
662
|
+
export const weatherTool = createTool({
|
|
663
|
+
id: 'weather-tool',
|
|
664
|
+
description: 'Get weather information',
|
|
665
|
+
outputSchema: z.object({
|
|
666
|
+
temperature: z.number(),
|
|
667
|
+
conditions: z.string(),
|
|
668
|
+
}),
|
|
669
|
+
execute: async input => {
|
|
670
|
+
return { temperature: 72, conditions: 'sunny' };
|
|
671
|
+
},
|
|
672
|
+
onOutput: ({ output, toolCallId, toolName }) => {
|
|
673
|
+
console.log(`${toolName} completed:`, output);
|
|
674
|
+
// output is fully typed based on outputSchema
|
|
675
|
+
},
|
|
676
|
+
});
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
Hook execution order:
|
|
680
|
+
1. `onInputStart` - Input streaming begins
|
|
681
|
+
2. `onInputDelta` - Input chunks arrive (called multiple times)
|
|
682
|
+
3. `onInputAvailable` - Complete input parsed and validated
|
|
683
|
+
4. Tool's `execute` function runs
|
|
684
|
+
5. `onOutput` - Tool completed successfully (NEW)
|
|
685
|
+
|
|
686
|
+
- Add new deleteVectors, updateVector by filter ([#10408](https://github.com/mastra-ai/mastra/pull/10408))
|
|
687
|
+
|
|
688
|
+
- Fix base64 encoded images with threads - issue #10480 ([#10483](https://github.com/mastra-ai/mastra/pull/10483))
|
|
689
|
+
|
|
690
|
+
Fixed "Invalid URL" error when using base64 encoded images (without `data:` prefix) in agent calls with threads and resources. Raw base64 strings are now automatically converted to proper data URIs before being processed.
|
|
691
|
+
|
|
692
|
+
**Changes:**
|
|
693
|
+
- Updated `attachments-to-parts.ts` to detect and convert raw base64 strings to data URIs
|
|
694
|
+
- Fixed `MessageList` image processing to handle raw base64 in two locations:
|
|
695
|
+
- Image part conversion in `aiV4CoreMessageToV1PromptMessage`
|
|
696
|
+
- File part to experimental_attachments conversion in `mastraDBMessageToAIV4UIMessage`
|
|
697
|
+
- Added comprehensive tests for base64 images, data URIs, and HTTP URLs with threads
|
|
698
|
+
|
|
699
|
+
**Breaking Change:** None - this is a bug fix that maintains backward compatibility while adding support for raw base64 strings.
|
|
700
|
+
|
|
701
|
+
- Fix message metadata not persisting when using simple message format. Previously, custom metadata passed in messages (e.g., `{role: 'user', content: 'text', metadata: {userId: '123'}}`) was not being saved to the database. This occurred because the CoreMessage conversion path didn't preserve metadata fields. ([#10488](https://github.com/mastra-ai/mastra/pull/10488))
|
|
702
|
+
|
|
703
|
+
Now metadata is properly preserved for all message input formats:
|
|
704
|
+
- Simple CoreMessage format: `{role, content, metadata}`
|
|
705
|
+
- Full UIMessage format: `{role, content, parts, metadata}`
|
|
706
|
+
- AI SDK v5 ModelMessage format with metadata
|
|
707
|
+
|
|
708
|
+
Fixes #8556
|
|
709
|
+
|
|
710
|
+
- feat: Composite auth implementation ([#10359](https://github.com/mastra-ai/mastra/pull/10359))
|
|
711
|
+
|
|
712
|
+
- Fix requireApproval property being ignored for tools passed via toolsets, clientTools, and memoryTools parameters. The requireApproval flag now correctly propagates through all tool conversion paths, ensuring tools requiring approval will properly request user approval before execution. ([#10464](https://github.com/mastra-ai/mastra/pull/10464))
|
|
713
|
+
|
|
714
|
+
- Add timeTravel APIs and add timeTravel feature to studio ([#10361](https://github.com/mastra-ai/mastra/pull/10361))
|
|
715
|
+
|
|
716
|
+
- Fix Azure Foundry rate limit handling for -1 values ([#10409](https://github.com/mastra-ai/mastra/pull/10409))
|
|
717
|
+
|
|
718
|
+
- Fix model headers not being passed through gateway system ([#10465](https://github.com/mastra-ai/mastra/pull/10465))
|
|
719
|
+
|
|
720
|
+
Previously, custom headers specified in `MastraModelConfig` were not being passed through the gateway system to model providers. This affected:
|
|
721
|
+
- OpenRouter (preventing activity tracking with `HTTP-Referer` and `X-Title`)
|
|
722
|
+
- Custom providers using custom URLs (headers not passed to `createOpenAICompatible`)
|
|
723
|
+
- Custom gateway implementations (headers not available in `resolveLanguageModel`)
|
|
724
|
+
|
|
725
|
+
Now headers are correctly passed through the entire gateway system:
|
|
726
|
+
- Base `MastraModelGateway` interface updated to accept headers
|
|
727
|
+
- `ModelRouterLanguageModel` passes headers from config to all gateways
|
|
728
|
+
- OpenRouter receives headers for activity tracking
|
|
729
|
+
- Custom URL providers receive headers via `createOpenAICompatible`
|
|
730
|
+
- Custom gateways can access headers in their `resolveLanguageModel` implementation
|
|
731
|
+
|
|
732
|
+
Example usage:
|
|
733
|
+
|
|
734
|
+
```typescript
|
|
735
|
+
// Works with OpenRouter
|
|
736
|
+
const agent = new Agent({
|
|
737
|
+
name: 'my-agent',
|
|
738
|
+
instructions: 'You are a helpful assistant.',
|
|
739
|
+
model: {
|
|
740
|
+
id: 'openrouter/anthropic/claude-3-5-sonnet',
|
|
741
|
+
headers: {
|
|
742
|
+
'HTTP-Referer': 'https://myapp.com',
|
|
743
|
+
'X-Title': 'My Application',
|
|
744
|
+
},
|
|
745
|
+
},
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
// Also works with custom providers
|
|
749
|
+
const customAgent = new Agent({
|
|
750
|
+
name: 'custom-agent',
|
|
751
|
+
instructions: 'You are a helpful assistant.',
|
|
752
|
+
model: {
|
|
753
|
+
id: 'custom-provider/model',
|
|
754
|
+
url: 'https://api.custom.com/v1',
|
|
755
|
+
apiKey: 'key',
|
|
756
|
+
headers: {
|
|
757
|
+
'X-Custom-Header': 'custom-value',
|
|
758
|
+
},
|
|
759
|
+
},
|
|
760
|
+
});
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
Fixes https://github.com/mastra-ai/mastra/issues/9760
|
|
764
|
+
|
|
765
|
+
- fix(agent): persist messages before tool suspension ([#10369](https://github.com/mastra-ai/mastra/pull/10369))
|
|
766
|
+
|
|
767
|
+
Fixes issues where thread and messages were not saved before suspension when tools require approval or call suspend() during execution. This caused conversation history to be lost if users refreshed during tool approval or suspension.
|
|
768
|
+
|
|
769
|
+
**Backend changes (@mastra/core):**
|
|
770
|
+
- Add assistant messages to messageList immediately after LLM execution
|
|
771
|
+
- Flush messages synchronously before suspension to persist state
|
|
772
|
+
- Create thread if it doesn't exist before flushing
|
|
773
|
+
- Add metadata helpers to persist and remove tool approval state
|
|
774
|
+
- Pass saveQueueManager and memory context through workflow for immediate persistence
|
|
775
|
+
|
|
776
|
+
**Frontend changes (@mastra/react):**
|
|
777
|
+
- Extract runId from pending approvals to enable resumption after refresh
|
|
778
|
+
- Convert `pendingToolApprovals` (DB format) to `requireApprovalMetadata` (runtime format)
|
|
779
|
+
- Handle both `dynamic-tool` and `tool-{NAME}` part types for approval state
|
|
780
|
+
- Change runId from hardcoded `agentId` to unique `uuid()`
|
|
781
|
+
|
|
782
|
+
**UI changes (@mastra/playground-ui):**
|
|
783
|
+
- Handle tool calls awaiting approval in message initialization
|
|
784
|
+
- Convert approval metadata format when loading initial messages
|
|
785
|
+
|
|
786
|
+
Fixes #9745, #9906
|
|
787
|
+
|
|
788
|
+
- Update MockMemory to work with new storage API changes. MockMemory now properly implements all abstract MastraMemory methods. This includes proper thread management, message saving with MessageList conversion, working memory operations with scope support, and resource listing. ([#10368](https://github.com/mastra-ai/mastra/pull/10368))
|
|
789
|
+
|
|
790
|
+
Add Zod v4 support for working memory schemas. Memory implementations now check for Zod v4's built-in `.toJsonSchema()` method before falling back to the `zodToJsonSchema` compatibility function, improving performance and forward compatibility while maintaining backward compatibility with Zod v3.
|
|
791
|
+
|
|
792
|
+
Add Gemini 3 Pro test coverage in agent-gemini.test.ts to validate the latest Gemini model integration.
|
|
793
|
+
|
|
794
|
+
- Fix race condition in parallel tool stream writes ([#10463](https://github.com/mastra-ai/mastra/pull/10463))
|
|
795
|
+
|
|
796
|
+
Introduces a write queue to ToolStream to serialize access to the underlying stream, preventing writer locked errors
|
|
797
|
+
|
|
798
|
+
- Remove unneeded console warning when flushing messages and no threadId or saveQueueManager is found. ([#10498](https://github.com/mastra-ai/mastra/pull/10498))
|
|
799
|
+
|
|
800
|
+
- Add optional includeRawChunks parameter to agent execution options, ([#10456](https://github.com/mastra-ai/mastra/pull/10456))
|
|
801
|
+
allowing users to include raw chunks in stream output where supported
|
|
802
|
+
by the model provider.
|
|
803
|
+
|
|
804
|
+
- When `mastra dev` runs, multiple processes can write to `provider-registry.json` concurrently (auto-refresh, syncGateways, syncGlobalCacheToLocal). This causes file corruption where the end of the JSON appears twice, making it unparseable. ([#10455](https://github.com/mastra-ai/mastra/pull/10455))
|
|
805
|
+
|
|
806
|
+
The fix uses atomic writes via the write-to-temp-then-rename pattern. Instead of:
|
|
807
|
+
|
|
808
|
+
```ts
|
|
809
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
We now do:
|
|
813
|
+
|
|
814
|
+
```ts
|
|
815
|
+
const tempPath = `${filePath}.${process.pid}.${Date.now()}.${randomSuffix}.tmp`;
|
|
816
|
+
fs.writeFileSync(tempPath, content, 'utf-8');
|
|
817
|
+
fs.renameSync(tempPath, filePath); // atomic on POSIX
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
`fs.rename()` is atomic on POSIX systems when both paths are on the same filesystem, so concurrent writes will each complete fully rather than interleaving.
|
|
821
|
+
|
|
822
|
+
- Fix .map when placed at the beginning of a workflow or nested workflow ([#10457](https://github.com/mastra-ai/mastra/pull/10457))
|
|
823
|
+
|
|
824
|
+
- Ensures that data chunks written via `writer.custom()` always bubble up directly to the top-level stream, even when nested in sub-agents. This allows tools to emit custom progress updates, metrics, and other data that can be consumed at any level of the agent hierarchy. ([#10309](https://github.com/mastra-ai/mastra/pull/10309))
|
|
825
|
+
- **Added bubbling logic in sub-agent execution**: When sub-agents execute, data chunks (chunks with type starting with `data-`) are detected and written via `writer.custom()` instead of `writer.write()`, ensuring they bubble up directly without being wrapped in `tool-output` chunks.
|
|
826
|
+
- **Added comprehensive tests**:
|
|
827
|
+
- Test for `writer.custom()` with direct tool execution
|
|
828
|
+
- Test for `writer.custom()` with sub-agent tools (nested execution)
|
|
829
|
+
- Test for mixed usage of `writer.write()` and `writer.custom()` in the same tool
|
|
830
|
+
|
|
831
|
+
When a sub-agent's tool uses `writer.custom()` to write data chunks, those chunks appear in the sub-agent's stream. The parent agent's execution logic now detects these chunks and uses `writer.custom()` to bubble them up directly, preserving their structure and making them accessible at the top level.
|
|
832
|
+
|
|
833
|
+
This ensures that:
|
|
834
|
+
- Data chunks from tools always appear directly in the stream (not wrapped)
|
|
835
|
+
- Data chunks bubble up correctly through nested agent hierarchies
|
|
836
|
+
- Regular chunks continue to be wrapped in `tool-output` as expected
|
|
837
|
+
|
|
838
|
+
- Update agent workflow and sub-agent tool transformations to accept more input arguments. ([#10278](https://github.com/mastra-ai/mastra/pull/10278))
|
|
839
|
+
|
|
840
|
+
These tools now accept the following
|
|
841
|
+
|
|
842
|
+
```
|
|
843
|
+
workflowTool.execute({ inputData, initialState }, context)
|
|
844
|
+
|
|
845
|
+
agentTool.execute({ prompt, threadId, resourceId, instructions, maxSteps }, context)
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
Workflow tools now also properly return errors when the workflow run fails
|
|
849
|
+
|
|
850
|
+
```
|
|
851
|
+
const workflowResult = await workflowTool.execute({ inputData, initialState }, context)
|
|
852
|
+
|
|
853
|
+
console.log(workflowResult.error) // error msg if error
|
|
854
|
+
console.log(workflowResult.result) // result of the workflow if success
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
Workflows passed to agents do not properly handle suspend/resume`, they only handle success or error.
|
|
858
|
+
|
|
859
|
+
- Fixed OpenAI schema compatibility when using `agent.generate()` or `agent.stream()` with `structuredOutput`. ([#10366](https://github.com/mastra-ai/mastra/pull/10366))
|
|
860
|
+
|
|
861
|
+
## Changes
|
|
862
|
+
- **Automatic transformation**: Zod schemas are now automatically transformed for OpenAI strict mode compatibility when using OpenAI models (including reasoning models like o1, o3, o4)
|
|
863
|
+
- **Optional field handling**: `.optional()` fields are converted to `.nullable()` with a transform that converts `null` → `undefined`, preserving optional semantics while satisfying OpenAI's strict mode requirements
|
|
864
|
+
- **Preserves nullable fields**: Intentionally `.nullable()` fields remain unchanged
|
|
865
|
+
- **Deep transformation**: Handles `.optional()` fields at any nesting level (objects, arrays, unions, etc.)
|
|
866
|
+
- **JSON Schema objects**: Not transformed, only Zod schemas
|
|
867
|
+
|
|
868
|
+
## Example
|
|
869
|
+
|
|
870
|
+
```typescript
|
|
871
|
+
const agent = new Agent({
|
|
872
|
+
name: 'data-extractor',
|
|
873
|
+
model: { provider: 'openai', modelId: 'gpt-4o' },
|
|
874
|
+
instructions: 'Extract user information',
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
const schema = z.object({
|
|
878
|
+
name: z.string(),
|
|
879
|
+
age: z.number().optional(),
|
|
880
|
+
deletedAt: z.date().nullable(),
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
// Schema is automatically transformed for OpenAI compatibility
|
|
884
|
+
const result = await agent.generate('Extract: John, deleted yesterday', {
|
|
885
|
+
structuredOutput: { schema },
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
// Result: { name: 'John', age: undefined, deletedAt: null }
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
- Fix network data step formatting in AI SDK stream transformation ([#10432](https://github.com/mastra-ai/mastra/pull/10432))
|
|
892
|
+
|
|
893
|
+
Previously, network execution steps were not being tracked correctly in the AI SDK stream transformation. Steps were being duplicated rather than updated, and critical metadata like step IDs, iterations, and task information was missing or incorrectly structured.
|
|
894
|
+
|
|
895
|
+
**Changes:**
|
|
896
|
+
- Enhanced step tracking in `AgentNetworkToAISDKTransformer` to properly maintain step state throughout execution lifecycle
|
|
897
|
+
- Steps are now identified by unique IDs and updated in place rather than creating duplicates
|
|
898
|
+
- Added proper iteration and task metadata to each step in the network execution flow
|
|
899
|
+
- Fixed agent, workflow, and tool execution events to correctly populate step data
|
|
900
|
+
- Updated network stream event types to include `networkId`, `workflowId`, and consistent `runId` tracking
|
|
901
|
+
- Added test coverage for network custom data chunks with comprehensive validation
|
|
902
|
+
|
|
903
|
+
This ensures the AI SDK correctly represents the full execution flow of agent networks with accurate step sequencing and metadata.
|
|
904
|
+
|
|
905
|
+
- Fix generating provider-registry.json ([#10392](https://github.com/mastra-ai/mastra/pull/10392))
|
|
906
|
+
|
|
907
|
+
- Adds type inference for `mastra.get*ById` functions. Only those registered at the top level mastra instance will get inferred. MCP and tool id's do not get inferred yet, those need additional changes. ([#10199](https://github.com/mastra-ai/mastra/pull/10199))
|
|
908
|
+
|
|
909
|
+
- Fix working memory zod to json schema conversion to use schema-compat zodtoJsonSchema fn. ([#10391](https://github.com/mastra-ai/mastra/pull/10391))
|
|
910
|
+
|
|
911
|
+
- Fixes parallel tool call issue with Gemini 3 Pro by preventing step-start parts from being inserted between consecutive tool parts in the `addStartStepPartsForAIV5` function. This ensures that the AI SDK's `convertToModelMessages` correctly preserves the order of parallel tool calls and maintains the `thought_signature` on the first tool call as required by Gemini's API. ([#10372](https://github.com/mastra-ai/mastra/pull/10372))
|
|
912
|
+
|
|
913
|
+
- Updated dependencies [[`bae33d9`](https://github.com/mastra-ai/mastra/commit/bae33d91a63fbb64d1e80519e1fc1acaed1e9013)]:
|
|
914
|
+
- @mastra/schema-compat@1.0.0-beta.1
|
|
915
|
+
|
|
916
|
+
## 1.0.0-beta.4
|
|
917
|
+
|
|
918
|
+
### Patch Changes
|
|
919
|
+
|
|
920
|
+
- Fix message list provider metadata handling and reasoning text optimization ([#10281](https://github.com/mastra-ai/mastra/pull/10281))
|
|
921
|
+
- Improved provider metadata preservation across message transformations
|
|
922
|
+
- Optimized reasoning text storage to avoid duplication (using `details` instead of `reasoning` field)
|
|
923
|
+
- Fixed test snapshots for timestamp precision and metadata handling
|
|
924
|
+
|
|
925
|
+
- Allow provider to pass through options to the auth config ([#10284](https://github.com/mastra-ai/mastra/pull/10284))
|
|
926
|
+
|
|
927
|
+
- Fix deprecation warning when agent network executes workflows by using `.fullStream` instead of iterating `WorkflowRunOutput` directly ([#10285](https://github.com/mastra-ai/mastra/pull/10285))
|
|
928
|
+
|
|
929
|
+
- Fix generate toolResults and mismatch in provider tool names ([#10282](https://github.com/mastra-ai/mastra/pull/10282))
|
|
930
|
+
|
|
931
|
+
- Support AI SDK voice models ([#10304](https://github.com/mastra-ai/mastra/pull/10304))
|
|
932
|
+
|
|
933
|
+
Mastra now supports AI SDK's transcription and speech models directly in `CompositeVoice`, enabling seamless integration with a wide range of voice providers through the AI SDK ecosystem. This allows you to use models from OpenAI, ElevenLabs, Groq, Deepgram, LMNT, Hume, and many more for both speech-to-text (transcription) and text-to-speech capabilities.
|
|
934
|
+
|
|
935
|
+
AI SDK models are automatically wrapped when passed to `CompositeVoice`, so you can mix and match AI SDK models with existing Mastra voice providers for maximum flexibility.
|
|
936
|
+
|
|
937
|
+
## Usage Example
|
|
938
|
+
|
|
939
|
+
```typescript
|
|
940
|
+
import { CompositeVoice } from '@mastra/core/voice';
|
|
941
|
+
import { openai } from '@ai-sdk/openai';
|
|
942
|
+
import { elevenlabs } from '@ai-sdk/elevenlabs';
|
|
943
|
+
|
|
944
|
+
// Use AI SDK models directly with CompositeVoice
|
|
945
|
+
const voice = new CompositeVoice({
|
|
946
|
+
input: openai.transcription('whisper-1'), // AI SDK transcription model
|
|
947
|
+
output: elevenlabs.speech('eleven_turbo_v2'), // AI SDK speech model
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
// Convert text to speech
|
|
951
|
+
const audioStream = await voice.speak('Hello from AI SDK!');
|
|
952
|
+
|
|
953
|
+
// Convert speech to text
|
|
954
|
+
const transcript = await voice.listen(audioStream);
|
|
955
|
+
console.log(transcript);
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
Fixes #9947
|
|
959
|
+
|
|
960
|
+
## 1.0.0-beta.3
|
|
961
|
+
|
|
962
|
+
### Major Changes
|
|
963
|
+
|
|
964
|
+
- Use tool's outputSchema to validate results and return an error object if schema does not match output results. ([#9664](https://github.com/mastra-ai/mastra/pull/9664))
|
|
965
|
+
|
|
966
|
+
```typescript
|
|
967
|
+
const getUserTool = createTool({
|
|
968
|
+
id: 'get-user',
|
|
969
|
+
outputSchema: z.object({
|
|
970
|
+
id: z.string(),
|
|
971
|
+
name: z.string(),
|
|
972
|
+
email: z.string().email(),
|
|
973
|
+
}),
|
|
974
|
+
execute: async inputData => {
|
|
975
|
+
return { id: '123', name: 'John' };
|
|
976
|
+
},
|
|
977
|
+
});
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
When validation fails, the tool returns a `ValidationError`:
|
|
981
|
+
|
|
982
|
+
```typescript
|
|
983
|
+
// Before v1 - invalid output would silently pass through
|
|
984
|
+
await getUserTool.execute({});
|
|
985
|
+
// { id: "123", name: "John" } - missing email
|
|
986
|
+
|
|
987
|
+
// After v1 - validation error is returned
|
|
988
|
+
await getUserTool.execute({});
|
|
989
|
+
// {
|
|
990
|
+
// error: true,
|
|
991
|
+
// message: "Tool output validation failed for get-user. The tool returned invalid output:\n- email: Required\n\nReturned output: {...}",
|
|
992
|
+
// validationErrors: { ... }
|
|
993
|
+
// }
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
### Patch Changes
|
|
997
|
+
|
|
998
|
+
- dependencies updates: ([#10131](https://github.com/mastra-ai/mastra/pull/10131))
|
|
999
|
+
- Updated dependency [`hono@^4.10.5` ↗︎](https://www.npmjs.com/package/hono/v/4.10.5) (from `^4.9.7`, in `dependencies`)
|
|
1000
|
+
|
|
1001
|
+
- Only handle download image asset transformation if needed ([#10122](https://github.com/mastra-ai/mastra/pull/10122))
|
|
1002
|
+
|
|
1003
|
+
- Add serializedStepGraph to runExecutionResult response ([#10004](https://github.com/mastra-ai/mastra/pull/10004))
|
|
1004
|
+
|
|
1005
|
+
- Fix tool outputSchema validation to allow unsupported Zod types like ZodTuple. The outputSchema is only used for internal validation and never sent to the LLM, so model compatibility checks are not needed. ([#9409](https://github.com/mastra-ai/mastra/pull/9409))
|
|
1006
|
+
|
|
1007
|
+
- Fix vector definition to fix pinecone ([#10150](https://github.com/mastra-ai/mastra/pull/10150))
|
|
1008
|
+
|
|
1009
|
+
- fix resumeStream type to use resumeSchema ([#10202](https://github.com/mastra-ai/mastra/pull/10202))
|
|
1010
|
+
|
|
1011
|
+
- Add type bailed to workflowRunStatus ([#10091](https://github.com/mastra-ai/mastra/pull/10091))
|
|
1012
|
+
|
|
1013
|
+
- default validate inputs to true in Workflow execute ([#10222](https://github.com/mastra-ai/mastra/pull/10222))
|
|
1014
|
+
|
|
1015
|
+
- Add support for doGenerate in LanguageModelV2. This change fixes issues with OpenAI stream permissions. ([#10239](https://github.com/mastra-ai/mastra/pull/10239))
|
|
1016
|
+
- Added new abstraction over LanguageModelV2
|
|
1017
|
+
|
|
1018
|
+
- Fix input tool validation when no inputSchema is provided ([#9941](https://github.com/mastra-ai/mastra/pull/9941))
|
|
1019
|
+
|
|
1020
|
+
- Adds ability to create custom `MastraModelGateway`'s that can be added to the `Mastra` class instance under the `gateways` property. Giving you typescript autocompletion in any model picker string. ([#10180](https://github.com/mastra-ai/mastra/pull/10180))
|
|
1021
|
+
|
|
1022
|
+
```typescript
|
|
1023
|
+
import { MastraModelGateway, type ProviderConfig } from '@mastra/core/llm';
|
|
1024
|
+
import { createOpenAICompatible } from '@ai-sdk/openai-compatible-v5';
|
|
1025
|
+
import type { LanguageModelV2 } from '@ai-sdk/provider-v5';
|
|
1026
|
+
|
|
1027
|
+
class MyCustomGateway extends MastraModelGateway {
|
|
1028
|
+
readonly id = 'my-custom-gateway';
|
|
1029
|
+
readonly name = 'My Custom Gateway';
|
|
1030
|
+
readonly prefix = 'custom';
|
|
1031
|
+
|
|
1032
|
+
async fetchProviders(): Promise<Record<string, ProviderConfig>> {
|
|
1033
|
+
return {
|
|
1034
|
+
'my-provider': {
|
|
1035
|
+
name: 'My Provider',
|
|
1036
|
+
models: ['model-1', 'model-2'],
|
|
1037
|
+
apiKeyEnvVar: 'MY_API_KEY',
|
|
1038
|
+
gateway: this.id,
|
|
1039
|
+
},
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
buildUrl(modelId: string, envVars?: Record<string, string>): string {
|
|
1044
|
+
return 'https://api.my-provider.com/v1';
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
async getApiKey(modelId: string): Promise<string> {
|
|
1048
|
+
const apiKey = process.env.MY_API_KEY;
|
|
1049
|
+
if (!apiKey) throw new Error('MY_API_KEY not set');
|
|
1050
|
+
return apiKey;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
async resolveLanguageModel({
|
|
1054
|
+
modelId,
|
|
1055
|
+
providerId,
|
|
1056
|
+
apiKey,
|
|
1057
|
+
}: {
|
|
1058
|
+
modelId: string;
|
|
1059
|
+
providerId: string;
|
|
1060
|
+
apiKey: string;
|
|
1061
|
+
}): Promise<LanguageModelV2> {
|
|
1062
|
+
const baseURL = this.buildUrl(`${providerId}/${modelId}`);
|
|
1063
|
+
return createOpenAICompatible({
|
|
1064
|
+
name: providerId,
|
|
1065
|
+
apiKey,
|
|
1066
|
+
baseURL,
|
|
1067
|
+
}).chatModel(modelId);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
new Mastra({
|
|
1072
|
+
gateways: {
|
|
1073
|
+
myGateway: new MyCustomGateway(),
|
|
1074
|
+
},
|
|
1075
|
+
});
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
- Add an additional check to determine whether the model natively supports specific file types. Only download the file if the model does not support it natively. ([#9790](https://github.com/mastra-ai/mastra/pull/9790))
|
|
1079
|
+
|
|
1080
|
+
- Add restart method to workflow run that allows restarting an active workflow run ([#9750](https://github.com/mastra-ai/mastra/pull/9750))
|
|
1081
|
+
Add status filter to `listWorkflowRuns`
|
|
1082
|
+
Add automatic restart to restart active workflow runs when server starts
|
|
1083
|
+
|
|
1084
|
+
- Validate schemas by default in workflow. Previously, if you want schemas in the workflow to be validated, you'd have to add `validateInputs` option, now, this will be done by default but can be disabled. ([#10186](https://github.com/mastra-ai/mastra/pull/10186))
|
|
1085
|
+
|
|
1086
|
+
For workflows whose schemas and step schemas you don't want validated, do this
|
|
1087
|
+
|
|
1088
|
+
```diff
|
|
1089
|
+
createWorkflow({
|
|
1090
|
+
+ options: {
|
|
1091
|
+
+ validateInputs: false
|
|
1092
|
+
+ }
|
|
1093
|
+
})
|
|
1094
|
+
```
|
|
1095
|
+
|
|
1096
|
+
- Fix inngest parallel workflow ([#10169](https://github.com/mastra-ai/mastra/pull/10169))
|
|
1097
|
+
Fix tool as step in inngest
|
|
1098
|
+
Fix inngest nested workflow
|
|
1099
|
+
|
|
1100
|
+
- Add timeTravel to workflows. This makes it possible to start a workflow run from a particular step in the workflow ([#9994](https://github.com/mastra-ai/mastra/pull/9994))
|
|
1101
|
+
|
|
1102
|
+
Example code:
|
|
1103
|
+
|
|
1104
|
+
```ts
|
|
1105
|
+
const result = await run.timeTravel({
|
|
1106
|
+
step: 'step2',
|
|
1107
|
+
inputData: {
|
|
1108
|
+
value: 'input',
|
|
1109
|
+
},
|
|
1110
|
+
});
|
|
1111
|
+
```
|
|
1112
|
+
|
|
1113
|
+
- Fixes assets not being downloaded when available ([#10079](https://github.com/mastra-ai/mastra/pull/10079))
|
|
1114
|
+
|
|
1115
|
+
- Remove unused dependencies ([#10019](https://github.com/mastra-ai/mastra/pull/10019))
|
|
1116
|
+
|
|
1117
|
+
- Updated dependencies [[`a64d16a`](https://github.com/mastra-ai/mastra/commit/a64d16aedafe57ee5707bdcc25f96e07fa1a0233)]:
|
|
1118
|
+
- @mastra/observability@1.0.0-beta.1
|
|
1119
|
+
|
|
1120
|
+
## 1.0.0-beta.2
|
|
1121
|
+
|
|
1122
|
+
### Patch Changes
|
|
1123
|
+
|
|
1124
|
+
- Make suspendPayload optional when calling `suspend()` ([#9926](https://github.com/mastra-ai/mastra/pull/9926))
|
|
1125
|
+
Save value returned as `suspendOutput` if user returns data still after calling `suspend()`
|
|
1126
|
+
Automatically call `commit()` on uncommitted workflows when registering in Mastra instance
|
|
1127
|
+
Show actual suspendPayload on Studio in suspend/resume flow
|
|
1128
|
+
|
|
3
1129
|
## 1.0.0-beta.1
|
|
4
1130
|
|
|
5
1131
|
### Patch Changes
|
|
@@ -8,6 +1134,8 @@
|
|
|
8
1134
|
|
|
9
1135
|
- Add visual styles and labels for more workflow node types ([#9777](https://github.com/mastra-ai/mastra/pull/9777))
|
|
10
1136
|
|
|
1137
|
+
- `registerApiRoute` now accepts a `requiresAuth` option, so custom endpoints can opt in/out of Mastra auth without mutating the returned route object.
|
|
1138
|
+
|
|
11
1139
|
## 1.0.0-beta.0
|
|
12
1140
|
|
|
13
1141
|
### Major Changes
|