@mastra/core 1.0.0-beta.21 → 1.0.0-beta.22
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 +356 -0
- package/dist/action/index.d.ts +7 -7
- package/dist/action/index.d.ts.map +1 -1
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts +100 -18
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.types.d.ts +22 -18
- package/dist/agent/agent.types.d.ts.map +1 -1
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/adapters/AIV4Adapter.d.ts.map +1 -1
- package/dist/agent/message-list/index.cjs +18 -18
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/message-list.d.ts +2 -1
- package/dist/agent/message-list/message-list.d.ts.map +1 -1
- package/dist/agent/trip-wire.d.ts +1 -2
- package/dist/agent/trip-wire.d.ts.map +1 -1
- package/dist/agent/types.d.ts +9 -10
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/utils.d.ts +7 -42
- package/dist/agent/utils.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts +6 -118
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +7 -11
- 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 +4 -68
- 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 +3 -45
- package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/schema.d.ts +10 -10
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts +2 -8
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
- package/dist/{chunk-HJXEZSNI.js → chunk-3XY64RAM.js} +5 -5
- package/dist/{chunk-HJXEZSNI.js.map → chunk-3XY64RAM.js.map} +1 -1
- package/dist/{chunk-XSJNTLM7.js → chunk-453NPBJ7.js} +479 -47
- package/dist/chunk-453NPBJ7.js.map +1 -0
- package/dist/{chunk-3CZ42NBZ.js → chunk-5UVSKF5L.js} +17 -14
- package/dist/chunk-5UVSKF5L.js.map +1 -0
- package/dist/{chunk-XKDVT3ZH.cjs → chunk-67ZKOPA4.cjs} +480 -48
- package/dist/chunk-67ZKOPA4.cjs.map +1 -0
- package/dist/{chunk-YLP5IWH2.js → chunk-7IYWOBLG.js} +4 -4
- package/dist/{chunk-YLP5IWH2.js.map → chunk-7IYWOBLG.js.map} +1 -1
- package/dist/{chunk-3RCMDLCG.cjs → chunk-ALQFYWAR.cjs} +12 -12
- package/dist/{chunk-3RCMDLCG.cjs.map → chunk-ALQFYWAR.cjs.map} +1 -1
- package/dist/{chunk-PC3FBUWH.js → chunk-C4CIC3LZ.js} +2 -2
- package/dist/chunk-C4CIC3LZ.js.map +1 -0
- package/dist/{chunk-7JGQWNV5.js → chunk-CPLRD2VP.js} +3 -3
- package/dist/{chunk-7JGQWNV5.js.map → chunk-CPLRD2VP.js.map} +1 -1
- package/dist/{chunk-AHN7K3VE.js → chunk-CQ2E577C.js} +5 -5
- package/dist/chunk-CQ2E577C.js.map +1 -0
- package/dist/{chunk-A4MCHA5L.cjs → chunk-CVLIEFWM.cjs} +100 -819
- package/dist/chunk-CVLIEFWM.cjs.map +1 -0
- package/dist/{chunk-XBZWAUZ3.js → chunk-IFPQ2MLB.js} +25 -12
- package/dist/chunk-IFPQ2MLB.js.map +1 -0
- package/dist/{chunk-DVJZZAZA.cjs → chunk-IHD36QFA.cjs} +7 -7
- package/dist/{chunk-DVJZZAZA.cjs.map → chunk-IHD36QFA.cjs.map} +1 -1
- package/dist/{chunk-WMJEP45F.cjs → chunk-J4KVR4DZ.cjs} +25 -18
- package/dist/chunk-J4KVR4DZ.cjs.map +1 -0
- package/dist/{chunk-3RFSIHFR.js → chunk-K2LPTKSY.js} +4 -720
- package/dist/chunk-K2LPTKSY.js.map +1 -0
- package/dist/{chunk-FY3PYSMK.cjs → chunk-KHO4KFXW.cjs} +5 -5
- package/dist/{chunk-FY3PYSMK.cjs.map → chunk-KHO4KFXW.cjs.map} +1 -1
- package/dist/{chunk-W7R7GPNN.cjs → chunk-MGPIVG2O.cjs} +9 -9
- package/dist/chunk-MGPIVG2O.cjs.map +1 -0
- package/dist/{chunk-KGE3KAM7.js → chunk-N3PAHTKU.js} +23 -3
- package/dist/chunk-N3PAHTKU.js.map +1 -0
- package/dist/{chunk-O4H44CMA.js → chunk-N7TDP7ZE.js} +586 -117
- package/dist/chunk-N7TDP7ZE.js.map +1 -0
- package/dist/{chunk-I5GMA5UM.cjs → chunk-NPIYNC5A.cjs} +9 -9
- package/dist/{chunk-I5GMA5UM.cjs.map → chunk-NPIYNC5A.cjs.map} +1 -1
- package/dist/{chunk-AW7FISLD.cjs → chunk-OZ75PBBK.cjs} +27 -7
- package/dist/chunk-OZ75PBBK.cjs.map +1 -0
- package/dist/{chunk-JMAPJWVG.cjs → chunk-OZCUIZRA.cjs} +2021 -1426
- package/dist/chunk-OZCUIZRA.cjs.map +1 -0
- package/dist/{chunk-6OPEMI2Q.cjs → chunk-PM3UIIBK.cjs} +2 -3
- package/dist/{chunk-6OPEMI2Q.cjs.map → chunk-PM3UIIBK.cjs.map} +1 -1
- package/dist/{chunk-CISH55FP.js → chunk-PSIJ6OSV.js} +16 -9
- package/dist/chunk-PSIJ6OSV.js.map +1 -0
- package/dist/{chunk-UOZ3GJY2.cjs → chunk-PTK74KG4.cjs} +2 -2
- package/dist/chunk-PTK74KG4.cjs.map +1 -0
- package/dist/{chunk-O5IPTMEH.cjs → chunk-Q5QQDMSD.cjs} +32 -29
- package/dist/chunk-Q5QQDMSD.cjs.map +1 -0
- package/dist/{chunk-UVHSM2GU.cjs → chunk-SMM2C4KH.cjs} +6 -4
- package/dist/chunk-SMM2C4KH.cjs.map +1 -0
- package/dist/{chunk-UXLQEGIN.cjs → chunk-SVPXZEU7.cjs} +35 -22
- package/dist/chunk-SVPXZEU7.cjs.map +1 -0
- package/dist/{chunk-SOSXN7X4.cjs → chunk-TU6MNGBB.cjs} +619 -151
- package/dist/chunk-TU6MNGBB.cjs.map +1 -0
- package/dist/{chunk-EK7E4ETB.js → chunk-TX5GUG5Q.js} +3 -3
- package/dist/{chunk-EK7E4ETB.js.map → chunk-TX5GUG5Q.js.map} +1 -1
- package/dist/{chunk-SQ7T6FWC.cjs → chunk-UAH236P2.cjs} +13 -13
- package/dist/{chunk-SQ7T6FWC.cjs.map → chunk-UAH236P2.cjs.map} +1 -1
- package/dist/{chunk-AIJ6HPJG.js → chunk-UL7TJCKA.js} +4 -4
- package/dist/{chunk-AIJ6HPJG.js.map → chunk-UL7TJCKA.js.map} +1 -1
- package/dist/{chunk-IC2MIQBW.js → chunk-UVOQLIWL.js} +1922 -1326
- package/dist/chunk-UVOQLIWL.js.map +1 -0
- package/dist/{chunk-IMLORTHO.js → chunk-WANKWENG.js} +5 -5
- package/dist/{chunk-IMLORTHO.js.map → chunk-WANKWENG.js.map} +1 -1
- package/dist/{chunk-ICU4Z5MO.cjs → chunk-X7DR353F.cjs} +8 -8
- package/dist/{chunk-ICU4Z5MO.cjs.map → chunk-X7DR353F.cjs.map} +1 -1
- package/dist/{chunk-6TBWJV35.js → chunk-Y22QMA7S.js} +6 -4
- package/dist/chunk-Y22QMA7S.js.map +1 -0
- package/dist/{chunk-FT7DFPAL.js → chunk-YYNZEEOO.js} +5 -5
- package/dist/{chunk-FT7DFPAL.js.map → chunk-YYNZEEOO.js.map} +1 -1
- package/dist/di/index.cjs +4 -4
- package/dist/di/index.js +1 -1
- package/dist/docs/README.md +6 -5
- package/dist/docs/SKILL.md +6 -5
- package/dist/docs/SOURCE_MAP.json +288 -293
- package/dist/docs/agents/01-overview.md +2 -2
- package/dist/docs/agents/02-using-tools.md +5 -0
- package/dist/docs/agents/04-structured-output.md +24 -4
- package/dist/docs/agents/06-processors.md +65 -1
- package/dist/docs/agents/08-agent-approval.md +5 -6
- package/dist/docs/agents/09-network-approval.md +274 -0
- package/dist/docs/agents/{10-reference.md → 11-reference.md} +1 -1
- package/dist/docs/ai-sdk/01-reference.md +1 -1
- package/dist/docs/cli/01-reference.md +1 -1
- package/dist/docs/client-js/01-reference.md +10 -5
- package/dist/docs/configuration.mdx/01-reference.md +750 -0
- package/dist/docs/core/01-reference.md +9 -35
- package/dist/docs/deployer/01-reference.md +19 -6
- package/dist/docs/evals/01-overview.md +5 -5
- package/dist/docs/evals/02-custom-scorers.md +49 -6
- package/dist/docs/evals/04-reference.md +10 -4
- package/dist/docs/mcp/01-overview.md +26 -16
- package/dist/docs/mcp/02-publishing-mcp-server.md +2 -2
- package/dist/docs/memory/01-overview.md +2 -2
- package/dist/docs/memory/02-storage.md +59 -25
- package/dist/docs/memory/03-working-memory.md +10 -6
- package/dist/docs/memory/04-semantic-recall.md +2 -4
- package/dist/docs/memory/05-memory-processors.md +2 -3
- package/dist/docs/memory/06-reference.md +2 -4
- package/dist/docs/observability/01-overview.md +1 -1
- package/dist/docs/observability/02-logging.md +4 -5
- package/dist/docs/observability/03-overview.md +69 -13
- package/dist/docs/observability/09-datadog.md +169 -0
- package/dist/docs/observability/10-laminar.md +95 -0
- package/dist/docs/observability/{11-otel.md → 13-otel.md} +12 -7
- package/dist/docs/observability/{13-reference.md → 15-reference.md} +125 -1
- package/dist/docs/processors/01-reference.md +23 -0
- package/dist/docs/rag/01-overview.md +1 -1
- package/dist/docs/rag/02-chunking-and-embedding.md +0 -1
- package/dist/docs/rag/03-vector-databases.md +10 -5
- package/dist/docs/rag/04-retrieval.md +5 -6
- package/dist/docs/rag/06-reference.md +4 -5
- package/dist/docs/server/01-mastra-server.md +32 -49
- package/dist/docs/server/02-custom-adapters.md +5 -2
- package/dist/docs/server/04-request-context.md +50 -11
- package/dist/docs/server/05-custom-api-routes.md +1 -1
- package/dist/docs/server/06-mastra-client.md +2 -2
- package/dist/docs/storage/01-reference.md +99 -23
- package/dist/docs/streaming/04-reference.md +6 -1
- package/dist/docs/tools/01-reference.md +380 -25
- package/dist/docs/tools-mcp/01-mcp-overview.md +10 -2
- package/dist/docs/tools-mcp/02-overview.md +4 -4
- package/dist/docs/vectors/01-reference.md +24 -11
- package/dist/docs/voice/01-overview.md +2 -2
- package/dist/docs/voice/05-reference.md +2 -2
- package/dist/docs/workflows/01-overview.md +5 -5
- package/dist/docs/workflows/04-agents-and-tools.md +4 -6
- package/dist/docs/workflows/06-suspend-and-resume.md +5 -7
- package/dist/docs/workflows/11-reference.md +1 -91
- package/dist/evals/base.d.ts.map +1 -1
- package/dist/evals/index.cjs +20 -20
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +5 -5
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts +4 -67
- package/dist/evals/scoreTraces/scoreTracesWorkflow.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 +9 -9
- package/dist/llm/index.js +2 -2
- package/dist/llm/model/model.loop.d.ts +1 -2
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/model.loop.types.d.ts +1 -2
- package/dist/llm/model/model.loop.types.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +224 -18
- package/dist/loop/index.cjs +12 -12
- package/dist/loop/index.js +1 -1
- package/dist/loop/loop.d.ts +1 -2
- package/dist/loop/loop.d.ts.map +1 -1
- package/dist/loop/network/index.d.ts +21 -80
- package/dist/loop/network/index.d.ts.map +1 -1
- package/dist/loop/network/run-command-tool.d.ts +14 -11
- package/dist/loop/network/run-command-tool.d.ts.map +1 -1
- package/dist/loop/network/validation.d.ts +3 -4
- package/dist/loop/network/validation.d.ts.map +1 -1
- package/dist/loop/test-utils/options.d.ts.map +1 -1
- package/dist/loop/types.d.ts +4 -5
- package/dist/loop/types.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +31 -804
- package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +22 -539
- 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 +13 -294
- 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 +2 -41
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts +32 -805
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
- package/dist/loop/workflows/schema.d.ts +90 -91
- package/dist/loop/workflows/schema.d.ts.map +1 -1
- package/dist/loop/workflows/stream.d.ts +1 -2
- package/dist/loop/workflows/stream.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +28 -9
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +11 -11
- package/dist/memory/index.js +1 -1
- package/dist/memory/memory.d.ts +4 -2
- package/dist/memory/memory.d.ts.map +1 -1
- package/dist/observability/index.cjs +11 -11
- package/dist/observability/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +45 -7
- package/dist/observability/types/tracing.d.ts.map +1 -1
- package/dist/processors/index.cjs +38 -38
- package/dist/processors/index.d.ts +3 -3
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/memory/semantic-recall.d.ts +2 -0
- package/dist/processors/memory/semantic-recall.d.ts.map +1 -1
- package/dist/processors/processors/structured-output.d.ts +2 -2
- package/dist/processors/processors/structured-output.d.ts.map +1 -1
- package/dist/processors/processors/token-limiter.d.ts +16 -10
- package/dist/processors/processors/token-limiter.d.ts.map +1 -1
- package/dist/processors/runner.d.ts +4 -4
- package/dist/processors/runner.d.ts.map +1 -1
- package/dist/processors/step-schema.d.ts +66 -67
- package/dist/processors/step-schema.d.ts.map +1 -1
- package/dist/provider-registry-C3IAGLLU.js +3 -0
- package/dist/{provider-registry-6DWM3X3I.js.map → provider-registry-C3IAGLLU.js.map} +1 -1
- package/dist/provider-registry-YH4FCTT2.cjs +40 -0
- package/dist/{provider-registry-DCECMUCQ.cjs.map → provider-registry-YH4FCTT2.cjs.map} +1 -1
- package/dist/provider-registry.json +477 -45
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/request-context/index.cjs +4 -4
- package/dist/request-context/index.d.ts +10 -9
- package/dist/request-context/index.d.ts.map +1 -1
- package/dist/request-context/index.js +1 -1
- package/dist/server/types.d.ts +1 -1
- package/dist/storage/constants.cjs +14 -14
- package/dist/storage/constants.d.ts +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/observability/types.d.ts +90 -90
- package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
- package/dist/storage/index.cjs +93 -93
- package/dist/storage/index.js +2 -2
- package/dist/stream/MastraAgentNetworkStream.d.ts +8 -12
- package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/execute.d.ts +2 -3
- package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/transform.d.ts +2 -3
- package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
- package/dist/stream/base/output-format-handlers.d.ts +2 -2
- package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts +76 -50
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/base/schema.d.ts +7 -2
- package/dist/stream/base/schema.d.ts.map +1 -1
- package/dist/stream/index.cjs +11 -15
- 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 +72 -26
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.d.ts +1 -1
- package/dist/tool-loop-agent/index.d.ts.map +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/tool-loop-agent/tool-loop-processor.d.ts +1 -2
- package/dist/tool-loop-agent/tool-loop-processor.d.ts.map +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.js +1 -1
- package/dist/tools/is-vercel-tool.cjs +2 -2
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/tool.d.ts +27 -14
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +76 -20
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/ui-types.d.ts +3 -4
- package/dist/tools/ui-types.d.ts.map +1 -1
- package/dist/tools/validation.d.ts +4 -4
- package/dist/tools/validation.d.ts.map +1 -1
- package/dist/types/dynamic-argument.d.ts +61 -1
- package/dist/types/dynamic-argument.d.ts.map +1 -1
- package/dist/types/zod-compat.d.ts +3 -11
- package/dist/types/zod-compat.d.ts.map +1 -1
- package/dist/utils.cjs +22 -22
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +6 -6
- package/dist/voice/index.js +1 -1
- package/dist/workflows/default.d.ts +114 -2
- package/dist/workflows/default.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.map +1 -1
- package/dist/workflows/evented/workflow-event-processor/utils.d.ts +1 -1
- package/dist/workflows/evented/workflow.d.ts +74 -21
- package/dist/workflows/evented/workflow.d.ts.map +1 -1
- package/dist/workflows/handlers/control-flow.d.ts +2 -2
- package/dist/workflows/handlers/control-flow.d.ts.map +1 -1
- package/dist/workflows/handlers/sleep.d.ts.map +1 -1
- package/dist/workflows/handlers/step.d.ts +1 -1
- package/dist/workflows/handlers/step.d.ts.map +1 -1
- package/dist/workflows/index.cjs +23 -23
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/step.d.ts +28 -24
- package/dist/workflows/step.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +91 -54
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +165 -118
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/llm/model/provider-types.generated.d.ts +224 -18
- package/dist/chunk-3CZ42NBZ.js.map +0 -1
- package/dist/chunk-3RFSIHFR.js.map +0 -1
- package/dist/chunk-6TBWJV35.js.map +0 -1
- package/dist/chunk-A4MCHA5L.cjs.map +0 -1
- package/dist/chunk-AHN7K3VE.js.map +0 -1
- package/dist/chunk-AW7FISLD.cjs.map +0 -1
- package/dist/chunk-CISH55FP.js.map +0 -1
- package/dist/chunk-IC2MIQBW.js.map +0 -1
- package/dist/chunk-JMAPJWVG.cjs.map +0 -1
- package/dist/chunk-KGE3KAM7.js.map +0 -1
- package/dist/chunk-O4H44CMA.js.map +0 -1
- package/dist/chunk-O5IPTMEH.cjs.map +0 -1
- package/dist/chunk-PC3FBUWH.js.map +0 -1
- package/dist/chunk-SOSXN7X4.cjs.map +0 -1
- package/dist/chunk-UOZ3GJY2.cjs.map +0 -1
- package/dist/chunk-UVHSM2GU.cjs.map +0 -1
- package/dist/chunk-UXLQEGIN.cjs.map +0 -1
- package/dist/chunk-W7R7GPNN.cjs.map +0 -1
- package/dist/chunk-WMJEP45F.cjs.map +0 -1
- package/dist/chunk-XBZWAUZ3.js.map +0 -1
- package/dist/chunk-XKDVT3ZH.cjs.map +0 -1
- package/dist/chunk-XSJNTLM7.js.map +0 -1
- package/dist/provider-registry-6DWM3X3I.js +0 -3
- package/dist/provider-registry-DCECMUCQ.cjs +0 -40
- package/dist/stream/aisdk/v5/output.d.ts +0 -121
- package/dist/stream/aisdk/v5/output.d.ts.map +0 -1
- /package/dist/docs/agents/{09-adding-voice.md → 10-adding-voice.md} +0 -0
- /package/dist/docs/observability/{09-langfuse.md → 11-langfuse.md} +0 -0
- /package/dist/docs/observability/{10-langsmith.md → 12-langsmith.md} +0 -0
- /package/dist/docs/observability/{12-posthog.md → 14-posthog.md} +0 -0
|
@@ -431,27 +431,27 @@ Captures OpenTelemetry traces for monitoring and debugging.
|
|
|
431
431
|
|
|
432
432
|
---
|
|
433
433
|
|
|
434
|
-
## Reference: Storage
|
|
434
|
+
## Reference: Composite Storage
|
|
435
435
|
|
|
436
436
|
> Documentation for combining multiple storage backends in Mastra.
|
|
437
437
|
|
|
438
|
-
MastraStorage can compose storage domains from different
|
|
438
|
+
`MastraStorage` can compose storage domains from different providers. Use it when you need different databases for different purposes. For example, use LibSQL for memory and PostgreSQL for workflows.
|
|
439
439
|
|
|
440
440
|
## Installation
|
|
441
441
|
|
|
442
|
-
MastraStorage is included in `@mastra/core`:
|
|
442
|
+
`MastraStorage` is included in `@mastra/core`:
|
|
443
443
|
|
|
444
444
|
```bash
|
|
445
445
|
npm install @mastra/core@beta
|
|
446
446
|
```
|
|
447
447
|
|
|
448
|
-
You'll also need to install the storage
|
|
448
|
+
You'll also need to install the storage providers you want to compose:
|
|
449
449
|
|
|
450
450
|
```bash
|
|
451
451
|
npm install @mastra/pg@beta @mastra/libsql@beta
|
|
452
452
|
```
|
|
453
453
|
|
|
454
|
-
## Storage
|
|
454
|
+
## Storage domains
|
|
455
455
|
|
|
456
456
|
Mastra organizes storage into five specialized domains, each handling a specific type of data. Each domain can be backed by a different storage adapter, and domain classes are exported from each storage package.
|
|
457
457
|
|
|
@@ -469,13 +469,13 @@ Mastra organizes storage into five specialized domains, each handling a specific
|
|
|
469
469
|
|
|
470
470
|
Import domain classes directly from each store package and compose them:
|
|
471
471
|
|
|
472
|
-
```typescript
|
|
472
|
+
```typescript title="src/mastra/index.ts"
|
|
473
473
|
import { MastraStorage } from "@mastra/core/storage";
|
|
474
474
|
import { WorkflowsPG, ScoresPG } from "@mastra/pg";
|
|
475
475
|
import { MemoryLibSQL } from "@mastra/libsql";
|
|
476
476
|
import { Mastra } from "@mastra/core";
|
|
477
477
|
|
|
478
|
-
const mastra = new Mastra({
|
|
478
|
+
export const mastra = new Mastra({
|
|
479
479
|
storage: new MastraStorage({
|
|
480
480
|
id: "composite",
|
|
481
481
|
domains: {
|
|
@@ -491,7 +491,7 @@ const mastra = new Mastra({
|
|
|
491
491
|
|
|
492
492
|
Use `default` to specify a fallback storage, then override specific domains:
|
|
493
493
|
|
|
494
|
-
```typescript
|
|
494
|
+
```typescript title="src/mastra/index.ts"
|
|
495
495
|
import { MastraStorage } from "@mastra/core/storage";
|
|
496
496
|
import { PostgresStore } from "@mastra/pg";
|
|
497
497
|
import { MemoryLibSQL } from "@mastra/libsql";
|
|
@@ -502,7 +502,7 @@ const pgStore = new PostgresStore({
|
|
|
502
502
|
connectionString: process.env.DATABASE_URL,
|
|
503
503
|
});
|
|
504
504
|
|
|
505
|
-
const mastra = new Mastra({
|
|
505
|
+
export const mastra = new Mastra({
|
|
506
506
|
storage: new MastraStorage({
|
|
507
507
|
id: "composite",
|
|
508
508
|
default: pgStore,
|
|
@@ -517,9 +517,9 @@ const mastra = new Mastra({
|
|
|
517
517
|
|
|
518
518
|
## Initialization
|
|
519
519
|
|
|
520
|
-
MastraStorage initializes each configured domain independently. When passed to the Mastra class, `init()` is called automatically:
|
|
520
|
+
`MastraStorage` initializes each configured domain independently. When passed to the Mastra class, `init()` is called automatically:
|
|
521
521
|
|
|
522
|
-
```typescript
|
|
522
|
+
```typescript title="src/mastra/index.ts"
|
|
523
523
|
import { MastraStorage } from "@mastra/core/storage";
|
|
524
524
|
import { MemoryPG, WorkflowsPG, ScoresPG } from "@mastra/pg";
|
|
525
525
|
import { Mastra } from "@mastra/core";
|
|
@@ -533,7 +533,7 @@ const storage = new MastraStorage({
|
|
|
533
533
|
},
|
|
534
534
|
});
|
|
535
535
|
|
|
536
|
-
const mastra = new Mastra({
|
|
536
|
+
export const mastra = new Mastra({
|
|
537
537
|
storage, // init() called automatically
|
|
538
538
|
});
|
|
539
539
|
```
|
|
@@ -558,7 +558,7 @@ const memoryStore = await storage.getStore("memory");
|
|
|
558
558
|
const thread = await memoryStore?.getThreadById({ threadId: "..." });
|
|
559
559
|
```
|
|
560
560
|
|
|
561
|
-
## Use
|
|
561
|
+
## Use cases
|
|
562
562
|
|
|
563
563
|
### Separate databases for different workloads
|
|
564
564
|
|
|
@@ -955,13 +955,17 @@ Ensure you have a MongoDB Atlas Local (via Docker) or MongoDB Atlas Cloud instan
|
|
|
955
955
|
import { MongoDBStore } from "@mastra/mongodb";
|
|
956
956
|
|
|
957
957
|
const storage = new MongoDBStore({
|
|
958
|
-
|
|
958
|
+
id: 'mongodb-storage',
|
|
959
|
+
uri: process.env.MONGODB_URI,
|
|
959
960
|
dbName: process.env.MONGODB_DATABASE,
|
|
960
961
|
});
|
|
961
962
|
```
|
|
962
963
|
|
|
963
964
|
## Parameters
|
|
964
965
|
|
|
966
|
+
> **Deprecation Notice**
|
|
967
|
+
The `url` parameter is deprecated but still supported for backward compatibility. Please use `uri` instead in all new code.
|
|
968
|
+
|
|
965
969
|
## Constructor Examples
|
|
966
970
|
|
|
967
971
|
You can instantiate `MongoDBStore` in the following ways:
|
|
@@ -971,13 +975,15 @@ import { MongoDBStore } from "@mastra/mongodb";
|
|
|
971
975
|
|
|
972
976
|
// Basic connection without custom options
|
|
973
977
|
const store1 = new MongoDBStore({
|
|
974
|
-
|
|
978
|
+
id: 'mongodb-storage-01',
|
|
979
|
+
uri: "mongodb+srv://user:password@cluster.mongodb.net",
|
|
975
980
|
dbName: "mastra_storage",
|
|
976
981
|
});
|
|
977
982
|
|
|
978
983
|
// Using connection string with options
|
|
979
984
|
const store2 = new MongoDBStore({
|
|
980
|
-
|
|
985
|
+
id: 'mongodb-storage-02',
|
|
986
|
+
uri: "mongodb+srv://user:password@cluster.mongodb.net",
|
|
981
987
|
dbName: "mastra_storage",
|
|
982
988
|
options: {
|
|
983
989
|
retryWrites: true,
|
|
@@ -1011,7 +1017,8 @@ import { Mastra } from "@mastra/core";
|
|
|
1011
1017
|
import { MongoDBStore } from "@mastra/mongodb";
|
|
1012
1018
|
|
|
1013
1019
|
const storage = new MongoDBStore({
|
|
1014
|
-
|
|
1020
|
+
id: 'mongodb-storage',
|
|
1021
|
+
uri: process.env.MONGODB_URI,
|
|
1015
1022
|
dbName: process.env.MONGODB_DATABASE,
|
|
1016
1023
|
});
|
|
1017
1024
|
|
|
@@ -1027,7 +1034,7 @@ import { MongoDBStore } from "@mastra/mongodb";
|
|
|
1027
1034
|
|
|
1028
1035
|
const storage = new MongoDBStore({
|
|
1029
1036
|
id: 'mongodb-storage',
|
|
1030
|
-
|
|
1037
|
+
uri: process.env.MONGODB_URI,
|
|
1031
1038
|
dbName: process.env.MONGODB_DATABASE,
|
|
1032
1039
|
});
|
|
1033
1040
|
|
|
@@ -1052,7 +1059,8 @@ MongoDB storage includes built-in vector search capabilities for AI applications
|
|
|
1052
1059
|
import { MongoDBVector } from "@mastra/mongodb";
|
|
1053
1060
|
|
|
1054
1061
|
const vectorStore = new MongoDBVector({
|
|
1055
|
-
|
|
1062
|
+
id: 'mongodb-vector',
|
|
1063
|
+
uri: process.env.MONGODB_URI,
|
|
1056
1064
|
dbName: process.env.MONGODB_DATABASE,
|
|
1057
1065
|
});
|
|
1058
1066
|
|
|
@@ -1112,13 +1120,11 @@ export const mongodbAgent = new Agent({
|
|
|
1112
1120
|
model: "openai/gpt-5.1",
|
|
1113
1121
|
memory: new Memory({
|
|
1114
1122
|
storage: new MongoDBStore({
|
|
1115
|
-
|
|
1123
|
+
uri: process.env.MONGODB_URI!,
|
|
1116
1124
|
dbName: process.env.MONGODB_DB_NAME!,
|
|
1117
1125
|
}),
|
|
1118
1126
|
options: {
|
|
1119
|
-
|
|
1120
|
-
generateTitle: true,
|
|
1121
|
-
},
|
|
1127
|
+
generateTitle: true,
|
|
1122
1128
|
},
|
|
1123
1129
|
}),
|
|
1124
1130
|
});
|
|
@@ -1395,6 +1401,7 @@ import { Mastra } from "@mastra/core";
|
|
|
1395
1401
|
import { PostgresStore } from "@mastra/pg";
|
|
1396
1402
|
|
|
1397
1403
|
const storage = new PostgresStore({
|
|
1404
|
+
id: 'pg-storage',
|
|
1398
1405
|
connectionString: process.env.DATABASE_URL,
|
|
1399
1406
|
});
|
|
1400
1407
|
|
|
@@ -1441,6 +1448,75 @@ This enables direct queries and custom transaction management. When using these
|
|
|
1441
1448
|
|
|
1442
1449
|
This approach is intended for advanced scenarios where low-level access is required.
|
|
1443
1450
|
|
|
1451
|
+
### Using with Next.js
|
|
1452
|
+
|
|
1453
|
+
When using `PostgresStore` in Next.js applications, [Hot Module Replacement (HMR)](https://nextjs.org/docs/architecture/fast-refresh) during development can cause multiple storage instances to be created, resulting in this warning:
|
|
1454
|
+
|
|
1455
|
+
```
|
|
1456
|
+
WARNING: Creating a duplicate database object for the same connection.
|
|
1457
|
+
```
|
|
1458
|
+
|
|
1459
|
+
To prevent this, store the `PostgresStore` instance on the global object so it persists across HMR reloads:
|
|
1460
|
+
|
|
1461
|
+
```typescript title="src/mastra/storage.ts"
|
|
1462
|
+
import { PostgresStore } from "@mastra/pg";
|
|
1463
|
+
import { Memory } from "@mastra/memory";
|
|
1464
|
+
|
|
1465
|
+
// Extend the global type to include our instances
|
|
1466
|
+
declare global {
|
|
1467
|
+
var pgStore: PostgresStore | undefined;
|
|
1468
|
+
var memory: Memory | undefined;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
// Get or create the PostgresStore instance
|
|
1472
|
+
function getPgStore(): PostgresStore {
|
|
1473
|
+
if (!global.pgStore) {
|
|
1474
|
+
if (!process.env.DATABASE_URL) {
|
|
1475
|
+
throw new Error("DATABASE_URL is not defined in environment variables");
|
|
1476
|
+
}
|
|
1477
|
+
global.pgStore = new PostgresStore({
|
|
1478
|
+
id: "pg-storage",
|
|
1479
|
+
connectionString: process.env.DATABASE_URL,
|
|
1480
|
+
ssl:
|
|
1481
|
+
process.env.DATABASE_SSL === "true"
|
|
1482
|
+
? { rejectUnauthorized: false }
|
|
1483
|
+
: false,
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
return global.pgStore;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
// Get or create the Memory instance
|
|
1490
|
+
function getMemory(): Memory {
|
|
1491
|
+
if (!global.memory) {
|
|
1492
|
+
global.memory = new Memory({
|
|
1493
|
+
storage: getPgStore(),
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
return global.memory;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
export const storage = getPgStore();
|
|
1500
|
+
export const memory = getMemory();
|
|
1501
|
+
```
|
|
1502
|
+
|
|
1503
|
+
Then use the exported instances in your Mastra configuration:
|
|
1504
|
+
|
|
1505
|
+
```typescript title="src/mastra/index.ts"
|
|
1506
|
+
import { Mastra } from "@mastra/core/mastra";
|
|
1507
|
+
import { storage } from "./storage";
|
|
1508
|
+
|
|
1509
|
+
export const mastra = new Mastra({
|
|
1510
|
+
storage,
|
|
1511
|
+
// ...other config
|
|
1512
|
+
});
|
|
1513
|
+
```
|
|
1514
|
+
|
|
1515
|
+
This pattern ensures only one `PostgresStore` instance is created regardless of how many times the module is reloaded during development. The same pattern can be applied to other storage providers like `LibSQLStore`.
|
|
1516
|
+
|
|
1517
|
+
> **Note:**
|
|
1518
|
+
This singleton pattern is only necessary during local development with HMR. In production builds, modules are only loaded once.
|
|
1519
|
+
|
|
1444
1520
|
## Usage Example
|
|
1445
1521
|
|
|
1446
1522
|
### Adding memory to an agent
|
|
@@ -298,6 +298,11 @@ for await (const chunk of stream.fullStream) {
|
|
|
298
298
|
break;
|
|
299
299
|
case "finish":
|
|
300
300
|
console.log(`Done! Reason: $`);
|
|
301
|
+
// Access response messages with any metadata added by output processors
|
|
302
|
+
const uiMessages = chunk.payload.response?.uiMessages;
|
|
303
|
+
if (uiMessages) {
|
|
304
|
+
console.log("Response messages:", uiMessages);
|
|
305
|
+
}
|
|
301
306
|
break;
|
|
302
307
|
}
|
|
303
308
|
}
|
|
@@ -546,7 +551,7 @@ await agent.streamLegacy("message for agent", {
|
|
|
546
551
|
|
|
547
552
|
> **Note:**
|
|
548
553
|
|
|
549
|
-
The new `.stream()` method offers enhanced capabilities including AI SDK v5 compatibility, better structured output handling, and improved callback system. See the [migration guide](https://mastra.ai/guides/v1/migrations/vnext-to-standard-apis) for detailed migration instructions.
|
|
554
|
+
The new `.stream()` method offers enhanced capabilities including AI SDK v5+ compatibility, better structured output handling, and improved callback system. See the [migration guide](https://mastra.ai/guides/v1/migrations/vnext-to-standard-apis) for detailed migration instructions.
|
|
550
555
|
|
|
551
556
|
### Quick Migration Example
|
|
552
557
|
|