@mastra/core 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +202 -0
- package/dist/agent/agent.d.ts +22 -3
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.js +2 -2
- 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.map +1 -1
- package/dist/{chunk-IOY7Y5GV.js → chunk-3VVNJPTO.js} +602 -187
- package/dist/chunk-3VVNJPTO.js.map +1 -0
- package/dist/{chunk-VDKWYUGC.cjs → chunk-5WBEMKE2.cjs} +7 -3
- package/dist/chunk-5WBEMKE2.cjs.map +1 -0
- package/dist/{chunk-H5S4PS44.cjs → chunk-76Q75VI4.cjs} +602 -187
- package/dist/chunk-76Q75VI4.cjs.map +1 -0
- package/dist/{chunk-ZBESCKPX.cjs → chunk-7AHCLTZZ.cjs} +1572 -36
- package/dist/chunk-7AHCLTZZ.cjs.map +1 -0
- package/dist/{chunk-SEKQJ447.js → chunk-ACAILOJE.js} +166 -68
- package/dist/chunk-ACAILOJE.js.map +1 -0
- package/dist/{chunk-YIJZBU54.cjs → chunk-BCSVBOAN.cjs} +240 -463
- package/dist/chunk-BCSVBOAN.cjs.map +1 -0
- package/dist/{chunk-ZVWVQ6MG.js → chunk-CY4ZWL2X.js} +8 -3
- package/dist/chunk-CY4ZWL2X.js.map +1 -0
- package/dist/{chunk-ET7GXCHS.js → chunk-DIKRJVK6.js} +5 -5
- package/dist/{chunk-ET7GXCHS.js.map → chunk-DIKRJVK6.js.map} +1 -1
- package/dist/{chunk-P6ZX7OKT.cjs → chunk-E6I5LBDM.cjs} +7 -7
- package/dist/{chunk-P6ZX7OKT.cjs.map → chunk-E6I5LBDM.cjs.map} +1 -1
- package/dist/{chunk-BFV3GSGS.js → chunk-FT5Q6XTK.js} +1546 -22
- package/dist/chunk-FT5Q6XTK.js.map +1 -0
- package/dist/{chunk-K54LFB4P.js → chunk-FXOWXS4O.js} +3 -3
- package/dist/{chunk-K54LFB4P.js.map → chunk-FXOWXS4O.js.map} +1 -1
- package/dist/{chunk-QNXY3J6B.cjs → chunk-GCRPNAAR.cjs} +22 -19
- package/dist/chunk-GCRPNAAR.cjs.map +1 -0
- package/dist/{chunk-5M3RMO7U.js → chunk-GTA5BKXZ.js} +8 -8
- package/dist/{chunk-5M3RMO7U.js.map → chunk-GTA5BKXZ.js.map} +1 -1
- package/dist/{chunk-G5R2755Q.cjs → chunk-HAIQ57YB.cjs} +53 -20
- package/dist/chunk-HAIQ57YB.cjs.map +1 -0
- package/dist/{chunk-3ZBLD2Y4.cjs → chunk-HH76UOJL.cjs} +2 -2
- package/dist/{chunk-3ZBLD2Y4.cjs.map → chunk-HH76UOJL.cjs.map} +1 -1
- package/dist/{chunk-HAGCXIBX.cjs → chunk-HNYQITSV.cjs} +9 -9
- package/dist/{chunk-HAGCXIBX.cjs.map → chunk-HNYQITSV.cjs.map} +1 -1
- package/dist/{chunk-GJTLWOKJ.js → chunk-HQA3IBLZ.js} +51 -18
- package/dist/chunk-HQA3IBLZ.js.map +1 -0
- package/dist/{chunk-4BXXAZ75.js → chunk-HQTHWVAK.js} +15 -7
- package/dist/chunk-HQTHWVAK.js.map +1 -0
- package/dist/{chunk-CCLV5CAA.js → chunk-JGOH7RWL.js} +7 -3
- package/dist/chunk-JGOH7RWL.js.map +1 -0
- package/dist/{chunk-Y6TGIUGL.js → chunk-LSF5WJ6G.js} +2 -2
- package/dist/{chunk-Y6TGIUGL.js.map → chunk-LSF5WJ6G.js.map} +1 -1
- package/dist/{chunk-D6HO5QAM.cjs → chunk-M26GEN4C.cjs} +14 -9
- package/dist/chunk-M26GEN4C.cjs.map +1 -0
- package/dist/{chunk-4P35AVPE.cjs → chunk-MEMYFFOL.cjs} +256 -157
- package/dist/chunk-MEMYFFOL.cjs.map +1 -0
- package/dist/{chunk-BQ355Z3O.js → chunk-NUZWQA4J.js} +4 -4
- package/dist/{chunk-BQ355Z3O.js.map → chunk-NUZWQA4J.js.map} +1 -1
- package/dist/{chunk-JIRB5LX4.js → chunk-OHX36YXF.js} +5 -3
- package/dist/chunk-OHX36YXF.js.map +1 -0
- package/dist/{chunk-PKORY4ZZ.cjs → chunk-OOTLMVNN.cjs} +107 -7
- package/dist/chunk-OOTLMVNN.cjs.map +1 -0
- package/dist/{chunk-D4M6E4OQ.cjs → chunk-OWZ6QT24.cjs} +16 -8
- package/dist/chunk-OWZ6QT24.cjs.map +1 -0
- package/dist/{chunk-6OHS6ZQ3.js → chunk-PDJCIONR.js} +8 -8
- package/dist/{chunk-6OHS6ZQ3.js.map → chunk-PDJCIONR.js.map} +1 -1
- package/dist/{chunk-WU2P7XOU.cjs → chunk-PP4G2TZZ.cjs} +20 -20
- package/dist/{chunk-WU2P7XOU.cjs.map → chunk-PP4G2TZZ.cjs.map} +1 -1
- package/dist/{chunk-VWAK25TU.js → chunk-SBBWRNZA.js} +10 -7
- package/dist/chunk-SBBWRNZA.js.map +1 -0
- package/dist/{chunk-TU4YMXOQ.js → chunk-TJIFNVPX.js} +6 -6
- package/dist/{chunk-TU4YMXOQ.js.map → chunk-TJIFNVPX.js.map} +1 -1
- package/dist/{chunk-V5YNS2QO.cjs → chunk-XJNQHPBJ.cjs} +15 -15
- package/dist/{chunk-V5YNS2QO.cjs.map → chunk-XJNQHPBJ.cjs.map} +1 -1
- package/dist/{chunk-MVYP55NA.js → chunk-YC6Z75K2.js} +113 -336
- package/dist/chunk-YC6Z75K2.js.map +1 -0
- package/dist/{chunk-3ZF7IC6Q.cjs → chunk-YZMSJKAK.cjs} +5 -3
- package/dist/chunk-YZMSJKAK.cjs.map +1 -0
- package/dist/{chunk-L3WDI7HP.cjs → chunk-Z2X5VTYJ.cjs} +65 -65
- package/dist/{chunk-L3WDI7HP.cjs.map → chunk-Z2X5VTYJ.cjs.map} +1 -1
- package/dist/{chunk-BN5MV2QK.cjs → chunk-Z52OAJ73.cjs} +4 -4
- package/dist/{chunk-BN5MV2QK.cjs.map → chunk-Z52OAJ73.cjs.map} +1 -1
- package/dist/{chunk-WYPSC6CO.js → chunk-ZBU6P4JV.js} +104 -4
- package/dist/chunk-ZBU6P4JV.js.map +1 -0
- package/dist/datasets/experiment/index.d.ts.map +1 -1
- package/dist/datasets/experiment/scorer.d.ts.map +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/di/index.cjs +4 -4
- package/dist/di/index.js +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +443 -384
- package/dist/docs/references/docs-agents-agent-approval.md +61 -31
- package/dist/docs/references/docs-agents-supervisor-agents.md +1 -1
- package/dist/docs/references/docs-memory-observational-memory.md +9 -0
- package/dist/docs/references/docs-memory-semantic-recall.md +17 -1
- package/dist/docs/references/docs-workspace-skills.md +7 -5
- package/dist/docs/references/reference-agents-agent.md +20 -20
- package/dist/docs/references/reference-agents-generate.md +200 -66
- package/dist/docs/references/reference-agents-generateLegacy.md +77 -35
- package/dist/docs/references/reference-agents-getDefaultGenerateOptions.md +4 -6
- package/dist/docs/references/reference-agents-getDefaultOptions.md +4 -6
- package/dist/docs/references/reference-agents-getDefaultStreamOptions.md +4 -6
- package/dist/docs/references/reference-agents-getDescription.md +1 -1
- package/dist/docs/references/reference-agents-getInstructions.md +4 -6
- package/dist/docs/references/reference-agents-getLLM.md +6 -8
- package/dist/docs/references/reference-agents-getMemory.md +4 -6
- package/dist/docs/references/reference-agents-getModel.md +4 -6
- package/dist/docs/references/reference-agents-getTools.md +5 -7
- package/dist/docs/references/reference-agents-getVoice.md +4 -6
- package/dist/docs/references/reference-agents-listAgents.md +4 -6
- package/dist/docs/references/reference-agents-listScorers.md +4 -6
- package/dist/docs/references/reference-agents-listTools.md +4 -6
- package/dist/docs/references/reference-agents-listWorkflows.md +4 -6
- package/dist/docs/references/reference-agents-network.md +69 -23
- package/dist/docs/references/reference-ai-sdk-chat-route.md +7 -7
- package/dist/docs/references/reference-ai-sdk-network-route.md +3 -3
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-stream.md +9 -9
- package/dist/docs/references/reference-ai-sdk-with-mastra.md +12 -12
- package/dist/docs/references/reference-ai-sdk-workflow-route.md +3 -3
- package/dist/docs/references/reference-auth-auth0.md +6 -6
- package/dist/docs/references/reference-auth-clerk.md +5 -5
- package/dist/docs/references/reference-auth-firebase.md +7 -7
- package/dist/docs/references/reference-auth-jwt.md +1 -1
- package/dist/docs/references/reference-auth-supabase.md +4 -4
- package/dist/docs/references/reference-auth-workos.md +6 -6
- package/dist/docs/references/reference-core-addGateway.md +2 -2
- package/dist/docs/references/reference-core-getAgent.md +2 -2
- package/dist/docs/references/reference-core-getAgentById.md +2 -2
- package/dist/docs/references/reference-core-getDeployer.md +1 -1
- package/dist/docs/references/reference-core-getGateway.md +2 -2
- package/dist/docs/references/reference-core-getGatewayById.md +2 -2
- package/dist/docs/references/reference-core-getLogger.md +1 -1
- package/dist/docs/references/reference-core-getMCPServer.md +2 -2
- package/dist/docs/references/reference-core-getMCPServerById.md +3 -3
- package/dist/docs/references/reference-core-getMemory.md +2 -2
- package/dist/docs/references/reference-core-getScorer.md +2 -2
- package/dist/docs/references/reference-core-getScorerById.md +2 -2
- package/dist/docs/references/reference-core-getServer.md +1 -1
- package/dist/docs/references/reference-core-getStorage.md +1 -1
- package/dist/docs/references/reference-core-getStoredAgentById.md +18 -20
- package/dist/docs/references/reference-core-getTelemetry.md +1 -1
- package/dist/docs/references/reference-core-getVector.md +2 -2
- package/dist/docs/references/reference-core-getWorkflow.md +3 -3
- package/dist/docs/references/reference-core-listAgents.md +1 -1
- package/dist/docs/references/reference-core-listGateways.md +1 -1
- package/dist/docs/references/reference-core-listLogs.md +9 -11
- package/dist/docs/references/reference-core-listLogsByRunId.md +9 -9
- package/dist/docs/references/reference-core-listMCPServers.md +1 -1
- package/dist/docs/references/reference-core-listMemory.md +1 -1
- package/dist/docs/references/reference-core-listScorers.md +1 -1
- package/dist/docs/references/reference-core-listStoredAgents.md +9 -11
- package/dist/docs/references/reference-core-listVectors.md +1 -1
- package/dist/docs/references/reference-core-listWorkflows.md +2 -2
- package/dist/docs/references/reference-core-mastra-class.md +17 -17
- package/dist/docs/references/reference-core-mastra-model-gateway.md +15 -15
- package/dist/docs/references/reference-core-setLogger.md +2 -4
- package/dist/docs/references/reference-core-setStorage.md +1 -1
- package/dist/docs/references/reference-datasets-addItem.md +20 -4
- package/dist/docs/references/reference-datasets-addItems.md +8 -2
- package/dist/docs/references/reference-datasets-compareExperiments.md +15 -3
- package/dist/docs/references/reference-datasets-create.md +6 -6
- package/dist/docs/references/reference-datasets-dataset.md +1 -1
- package/dist/docs/references/reference-datasets-delete.md +2 -2
- package/dist/docs/references/reference-datasets-deleteExperiment.md +2 -2
- package/dist/docs/references/reference-datasets-deleteItem.md +2 -2
- package/dist/docs/references/reference-datasets-deleteItems.md +2 -2
- package/dist/docs/references/reference-datasets-get.md +2 -2
- package/dist/docs/references/reference-datasets-getDetails.md +9 -9
- package/dist/docs/references/reference-datasets-getExperiment.md +2 -2
- package/dist/docs/references/reference-datasets-getItem.md +3 -3
- package/dist/docs/references/reference-datasets-getItemHistory.md +22 -2
- package/dist/docs/references/reference-datasets-list.md +7 -3
- package/dist/docs/references/reference-datasets-listExperimentResults.md +34 -4
- package/dist/docs/references/reference-datasets-listExperiments.md +41 -3
- package/dist/docs/references/reference-datasets-listItems.md +18 -6
- package/dist/docs/references/reference-datasets-listVersions.md +23 -3
- package/dist/docs/references/reference-datasets-startExperiment.md +62 -12
- package/dist/docs/references/reference-datasets-startExperimentAsync.md +5 -1
- package/dist/docs/references/reference-datasets-update.md +6 -6
- package/dist/docs/references/reference-datasets-updateItem.md +5 -5
- package/dist/docs/references/reference-evals-answer-relevancy.md +11 -11
- package/dist/docs/references/reference-evals-answer-similarity.md +17 -19
- package/dist/docs/references/reference-evals-bias.md +10 -10
- package/dist/docs/references/reference-evals-completeness.md +3 -3
- package/dist/docs/references/reference-evals-content-similarity.md +6 -6
- package/dist/docs/references/reference-evals-context-precision.md +4 -4
- package/dist/docs/references/reference-evals-create-scorer.md +47 -49
- package/dist/docs/references/reference-evals-faithfulness.md +11 -11
- package/dist/docs/references/reference-evals-hallucination.md +17 -21
- package/dist/docs/references/reference-evals-keyword-coverage.md +4 -4
- package/dist/docs/references/reference-evals-mastra-scorer.md +14 -14
- package/dist/docs/references/reference-evals-run-evals.md +16 -16
- package/dist/docs/references/reference-evals-scorer-utils.md +3 -3
- package/dist/docs/references/reference-evals-textual-difference.md +3 -3
- package/dist/docs/references/reference-evals-tone-consistency.md +3 -3
- package/dist/docs/references/reference-evals-toxicity.md +8 -8
- package/dist/docs/references/reference-harness-harness-class.md +34 -42
- package/dist/docs/references/reference-logging-pino-logger.md +5 -5
- package/dist/docs/references/reference-memory-deleteMessages.md +2 -2
- package/dist/docs/references/reference-memory-memory-class.md +12 -14
- package/dist/docs/references/reference-memory-observational-memory.md +102 -94
- package/dist/docs/references/reference-observability-tracing-configuration.md +27 -10
- package/dist/docs/references/reference-observability-tracing-exporters-console-exporter.md +4 -7
- package/dist/docs/references/reference-processors-batch-parts-processor.md +8 -10
- package/dist/docs/references/reference-processors-language-detector.md +14 -16
- package/dist/docs/references/reference-processors-message-history-processor.md +7 -9
- package/dist/docs/references/reference-processors-moderation-processor.md +13 -15
- package/dist/docs/references/reference-processors-pii-detector.md +14 -16
- package/dist/docs/references/reference-processors-processor-interface.md +62 -62
- package/dist/docs/references/reference-processors-prompt-injection-detector.md +11 -13
- package/dist/docs/references/reference-processors-semantic-recall-processor.md +14 -16
- package/dist/docs/references/reference-processors-system-prompt-scrubber.md +12 -14
- package/dist/docs/references/reference-processors-token-limiter-processor.md +11 -13
- package/dist/docs/references/reference-processors-tool-call-filter.md +5 -7
- package/dist/docs/references/reference-processors-tool-search-processor.md +9 -11
- package/dist/docs/references/reference-processors-unicode-normalizer.md +8 -10
- package/dist/docs/references/reference-processors-working-memory-processor.md +14 -18
- package/dist/docs/references/reference-rag-database-config.md +11 -7
- package/dist/docs/references/reference-rag-embeddings.md +12 -12
- package/dist/docs/references/reference-server-mastra-server.md +10 -10
- package/dist/docs/references/reference-server-register-api-route.md +13 -13
- package/dist/docs/references/reference-storage-cloudflare-d1.md +5 -5
- package/dist/docs/references/reference-storage-composite.md +9 -9
- package/dist/docs/references/reference-storage-lance.md +3 -3
- package/dist/docs/references/reference-storage-libsql.md +2 -2
- package/dist/docs/references/reference-storage-mongodb.md +5 -5
- package/dist/docs/references/reference-storage-mssql.md +2 -2
- package/dist/docs/references/reference-storage-postgresql.md +25 -25
- package/dist/docs/references/reference-storage-upstash.md +3 -3
- package/dist/docs/references/reference-streaming-ChunkType.md +251 -59
- package/dist/docs/references/reference-streaming-agents-MastraModelOutput.md +86 -16
- package/dist/docs/references/reference-streaming-agents-streamLegacy.md +79 -39
- package/dist/docs/references/reference-streaming-workflows-resumeStream.md +18 -8
- package/dist/docs/references/reference-streaming-workflows-stream.md +21 -9
- package/dist/docs/references/reference-streaming-workflows-timeTravelStream.md +4 -4
- package/dist/docs/references/reference-tools-create-tool.md +25 -21
- package/dist/docs/references/reference-tools-graph-rag-tool.md +16 -18
- package/dist/docs/references/reference-tools-mcp-client.md +38 -27
- package/dist/docs/references/reference-tools-mcp-server.md +45 -45
- package/dist/docs/references/reference-tools-vector-query-tool.md +34 -22
- package/dist/docs/references/reference-vectors-libsql.md +31 -31
- package/dist/docs/references/reference-vectors-mongodb.md +32 -32
- package/dist/docs/references/reference-vectors-pg.md +60 -44
- package/dist/docs/references/reference-vectors-upstash.md +25 -25
- package/dist/docs/references/reference-voice-composite-voice.md +10 -10
- package/dist/docs/references/reference-voice-mastra-voice.md +20 -20
- package/dist/docs/references/reference-voice-voice.addInstructions.md +1 -1
- package/dist/docs/references/reference-voice-voice.addTools.md +1 -1
- package/dist/docs/references/reference-voice-voice.connect.md +3 -3
- package/dist/docs/references/reference-voice-voice.events.md +11 -11
- package/dist/docs/references/reference-voice-voice.listen.md +9 -9
- package/dist/docs/references/reference-voice-voice.on.md +2 -2
- package/dist/docs/references/reference-voice-voice.speak.md +11 -11
- package/dist/docs/references/reference-workflows-run-methods-cancel.md +2 -2
- package/dist/docs/references/reference-workflows-run-methods-restart.md +17 -5
- package/dist/docs/references/reference-workflows-run-methods-resume.md +23 -9
- package/dist/docs/references/reference-workflows-run-methods-start.md +22 -8
- package/dist/docs/references/reference-workflows-run-methods-startAsync.md +12 -6
- package/dist/docs/references/reference-workflows-run-methods-timeTravel.md +29 -13
- package/dist/docs/references/reference-workflows-run.md +12 -12
- package/dist/docs/references/reference-workflows-step.md +24 -26
- package/dist/docs/references/reference-workflows-workflow-methods-branch.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-commit.md +1 -1
- package/dist/docs/references/reference-workflows-workflow-methods-create-run.md +4 -4
- package/dist/docs/references/reference-workflows-workflow-methods-dountil.md +3 -3
- package/dist/docs/references/reference-workflows-workflow-methods-dowhile.md +3 -3
- package/dist/docs/references/reference-workflows-workflow-methods-foreach.md +9 -9
- package/dist/docs/references/reference-workflows-workflow-methods-map.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-parallel.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-sleep.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-sleepUntil.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-then.md +2 -2
- package/dist/docs/references/reference-workflows-workflow.md +40 -50
- package/dist/docs/references/reference-workspace-filesystem.md +22 -22
- package/dist/docs/references/reference-workspace-local-filesystem.md +35 -35
- package/dist/docs/references/reference-workspace-local-sandbox.md +26 -26
- package/dist/docs/references/reference-workspace-sandbox.md +8 -8
- package/dist/docs/references/reference-workspace-workspace-class.md +30 -34
- package/dist/editor/types.d.ts +1 -0
- package/dist/editor/types.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/harness/harness.d.ts.map +1 -1
- package/dist/harness/index.cjs +25 -21
- package/dist/harness/index.cjs.map +1 -1
- package/dist/harness/index.js +15 -11
- package/dist/harness/index.js.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 +12 -12
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/model.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +5 -1
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-2FJK72J2.cjs +12 -0
- package/dist/{models-dev-UVWCKPA2.cjs.map → models-dev-2FJK72J2.cjs.map} +1 -1
- package/dist/models-dev-CMQG6EMO.js +3 -0
- package/dist/{models-dev-W3LXZTEB.js.map → models-dev-CMQG6EMO.js.map} +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +42 -42
- package/dist/processors/index.js +1 -1
- package/dist/processors/processors/skills.d.ts +9 -42
- package/dist/processors/processors/skills.d.ts.map +1 -1
- package/dist/provider-registry-EHOAWHFE.cjs +40 -0
- package/dist/{provider-registry-4HLP2JRR.cjs.map → provider-registry-EHOAWHFE.cjs.map} +1 -1
- package/dist/provider-registry-LVP6T63V.js +3 -0
- package/dist/{provider-registry-K3DWQSMH.js.map → provider-registry-LVP6T63V.js.map} +1 -1
- package/dist/provider-registry.json +12 -4
- 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.map +1 -1
- package/dist/request-context/index.js +1 -1
- package/dist/storage/base.d.ts +34 -1
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/constants.cjs +56 -56
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/agents/filesystem.d.ts +28 -0
- package/dist/storage/domains/agents/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts +1 -0
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/experiments/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/mcp-clients/filesystem.d.ts +28 -0
- package/dist/storage/domains/mcp-clients/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/mcp-clients/index.d.ts +1 -0
- package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -1
- package/dist/storage/domains/mcp-servers/filesystem.d.ts +28 -0
- package/dist/storage/domains/mcp-servers/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/mcp-servers/index.d.ts +1 -0
- package/dist/storage/domains/mcp-servers/index.d.ts.map +1 -1
- package/dist/storage/domains/prompt-blocks/filesystem.d.ts +28 -0
- package/dist/storage/domains/prompt-blocks/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts +1 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -1
- package/dist/storage/domains/scorer-definitions/filesystem.d.ts +28 -0
- package/dist/storage/domains/scorer-definitions/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts +1 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -1
- package/dist/storage/domains/skills/filesystem.d.ts +28 -0
- package/dist/storage/domains/skills/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/skills/index.d.ts +1 -0
- package/dist/storage/domains/skills/index.d.ts.map +1 -1
- package/dist/storage/domains/workspaces/filesystem.d.ts +28 -0
- package/dist/storage/domains/workspaces/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/workspaces/index.d.ts +1 -0
- package/dist/storage/domains/workspaces/index.d.ts.map +1 -1
- package/dist/storage/filesystem-db.d.ts +82 -0
- package/dist/storage/filesystem-db.d.ts.map +1 -0
- package/dist/storage/filesystem-versioned.d.ts +148 -0
- package/dist/storage/filesystem-versioned.d.ts.map +1 -0
- package/dist/storage/filesystem.d.ts +39 -0
- package/dist/storage/filesystem.d.ts.map +1 -0
- package/dist/storage/git-history.d.ts +68 -0
- package/dist/storage/git-history.d.ts.map +1 -0
- package/dist/storage/index.cjs +208 -160
- package/dist/storage/index.d.ts +4 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -2
- package/dist/storage/types.d.ts +1 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/RunOutput.d.ts +1 -1
- package/dist/stream/aisdk/v5/output-helpers.d.ts +6 -6
- package/dist/stream/base/output.d.ts +3 -3
- package/dist/stream/base/schema.d.ts +1 -1
- package/dist/stream/index.cjs +11 -11
- package/dist/stream/index.js +2 -2
- 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.js +1 -1
- package/dist/tools/index.cjs +6 -6
- 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 +6 -0
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +27 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils.cjs +23 -23
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +9 -9
- package/dist/vector/index.js +2 -2
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +25 -25
- package/dist/workflows/index.js +1 -1
- package/dist/workspace/index.cjs +70 -66
- package/dist/workspace/index.d.ts +1 -0
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/sandbox/execa.d.ts +9 -0
- package/dist/workspace/sandbox/execa.d.ts.map +1 -0
- package/dist/workspace/sandbox/local-process-manager.d.ts.map +1 -1
- package/dist/workspace/skills/index.d.ts +1 -0
- package/dist/workspace/skills/index.d.ts.map +1 -1
- package/dist/workspace/skills/tools.d.ts +36 -0
- package/dist/workspace/skills/tools.d.ts.map +1 -0
- package/dist/workspace/tools/execute-command.d.ts.map +1 -1
- package/dist/workspace/tools/output-helpers.d.ts +4 -3
- package/dist/workspace/tools/output-helpers.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/llm/model/provider-types.generated.d.ts +5 -1
- package/dist/chunk-3ZF7IC6Q.cjs.map +0 -1
- package/dist/chunk-4BXXAZ75.js.map +0 -1
- package/dist/chunk-4P35AVPE.cjs.map +0 -1
- package/dist/chunk-BFV3GSGS.js.map +0 -1
- package/dist/chunk-CCLV5CAA.js.map +0 -1
- package/dist/chunk-D4M6E4OQ.cjs.map +0 -1
- package/dist/chunk-D6HO5QAM.cjs.map +0 -1
- package/dist/chunk-G5R2755Q.cjs.map +0 -1
- package/dist/chunk-GJTLWOKJ.js.map +0 -1
- package/dist/chunk-H5S4PS44.cjs.map +0 -1
- package/dist/chunk-IOY7Y5GV.js.map +0 -1
- package/dist/chunk-JIRB5LX4.js.map +0 -1
- package/dist/chunk-MVYP55NA.js.map +0 -1
- package/dist/chunk-PKORY4ZZ.cjs.map +0 -1
- package/dist/chunk-QNXY3J6B.cjs.map +0 -1
- package/dist/chunk-SEKQJ447.js.map +0 -1
- package/dist/chunk-VDKWYUGC.cjs.map +0 -1
- package/dist/chunk-VWAK25TU.js.map +0 -1
- package/dist/chunk-WYPSC6CO.js.map +0 -1
- package/dist/chunk-YIJZBU54.cjs.map +0 -1
- package/dist/chunk-ZBESCKPX.cjs.map +0 -1
- package/dist/chunk-ZVWVQ6MG.js.map +0 -1
- package/dist/models-dev-UVWCKPA2.cjs +0 -12
- package/dist/models-dev-W3LXZTEB.js +0 -3
- package/dist/provider-registry-4HLP2JRR.cjs +0 -40
- package/dist/provider-registry-K3DWQSMH.js +0 -3
|
@@ -14,17 +14,29 @@ const restartedResult = await run.restart()
|
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
16
16
|
|
|
17
|
-
**requestContext
|
|
17
|
+
**requestContext** (`RequestContext`): Request Context data to use when resuming
|
|
18
18
|
|
|
19
|
-
**tracingContext
|
|
19
|
+
**tracingContext** (`TracingContext`): Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.
|
|
20
20
|
|
|
21
|
-
**
|
|
21
|
+
**tracingContext.currentSpan** (`Span`): Current span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
22
|
+
|
|
23
|
+
**tracingOptions** (`TracingOptions`): Options for Tracing configuration.
|
|
24
|
+
|
|
25
|
+
**tracingOptions.metadata** (`Record<string, any>`): Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.
|
|
26
|
+
|
|
27
|
+
**tracingOptions.requestContextKeys** (`string[]`): Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').
|
|
28
|
+
|
|
29
|
+
**tracingOptions.traceId** (`string`): Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.
|
|
30
|
+
|
|
31
|
+
**tracingOptions.parentSpanId** (`string`): Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.
|
|
32
|
+
|
|
33
|
+
**tracingOptions.tags** (`string[]`): Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
22
34
|
|
|
23
35
|
## Returns
|
|
24
36
|
|
|
25
|
-
**result
|
|
37
|
+
**result** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
26
38
|
|
|
27
|
-
**traceId
|
|
39
|
+
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
28
40
|
|
|
29
41
|
## Related
|
|
30
42
|
|
|
@@ -18,25 +18,39 @@ if (result.status === 'suspended') {
|
|
|
18
18
|
|
|
19
19
|
## Parameters
|
|
20
20
|
|
|
21
|
-
**resumeData
|
|
21
|
+
**resumeData** (`z.infer<TResumeSchema>`): Data for resuming the suspended step
|
|
22
22
|
|
|
23
|
-
**step
|
|
23
|
+
**step** (`Step<string, any, any, TResumeSchema, any, TEngineType> | [...Step<string, any, any, any, any, TEngineType>[], Step<string, any, any, TResumeSchema, any, TEngineType>] | string | string[]`): The step(s) to resume execution from. Can be a Step instance, array of Steps, step ID string, or array of step ID strings
|
|
24
24
|
|
|
25
|
-
**requestContext
|
|
25
|
+
**requestContext** (`RequestContext`): Request Context data to use when resuming
|
|
26
26
|
|
|
27
|
-
**retryCount
|
|
27
|
+
**retryCount** (`number`): Optional retry count for nested workflow execution
|
|
28
28
|
|
|
29
|
-
**tracingContext
|
|
29
|
+
**tracingContext** (`TracingContext`): Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.
|
|
30
30
|
|
|
31
|
-
**
|
|
31
|
+
**tracingContext.currentSpan** (`Span`): Current span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
32
32
|
|
|
33
|
-
**
|
|
33
|
+
**tracingOptions** (`TracingOptions`): Options for Tracing configuration.
|
|
34
|
+
|
|
35
|
+
**tracingOptions.metadata** (`Record<string, any>`): Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.
|
|
36
|
+
|
|
37
|
+
**tracingOptions.requestContextKeys** (`string[]`): Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').
|
|
38
|
+
|
|
39
|
+
**tracingOptions.traceId** (`string`): Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.
|
|
40
|
+
|
|
41
|
+
**tracingOptions.parentSpanId** (`string`): Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.
|
|
42
|
+
|
|
43
|
+
**tracingOptions.tags** (`string[]`): Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
44
|
+
|
|
45
|
+
**outputOptions** (`OutputOptions`): Options for output configuration.
|
|
46
|
+
|
|
47
|
+
**outputOptions.includeState** (`boolean`): Whether to include the workflow run state in the result.
|
|
34
48
|
|
|
35
49
|
## Returns
|
|
36
50
|
|
|
37
|
-
**result
|
|
51
|
+
**result** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
38
52
|
|
|
39
|
-
**traceId
|
|
53
|
+
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
40
54
|
|
|
41
55
|
## Extended usage example
|
|
42
56
|
|
|
@@ -16,23 +16,37 @@ const result = await run.start({
|
|
|
16
16
|
|
|
17
17
|
## Parameters
|
|
18
18
|
|
|
19
|
-
**inputData
|
|
19
|
+
**inputData** (`z.infer<TInput>`): Input data that matches the workflow's input schema
|
|
20
20
|
|
|
21
|
-
**requestContext
|
|
21
|
+
**requestContext** (`RequestContext`): Request Context data to use during workflow execution
|
|
22
22
|
|
|
23
|
-
**outputWriter
|
|
23
|
+
**outputWriter** (`(chunk: TOutput) => Promise<void>`): Optional asynchronous function to handle output chunks as they are produced
|
|
24
24
|
|
|
25
|
-
**tracingContext
|
|
25
|
+
**tracingContext** (`TracingContext`): Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.
|
|
26
26
|
|
|
27
|
-
**
|
|
27
|
+
**tracingContext.currentSpan** (`Span`): Current span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
28
28
|
|
|
29
|
-
**
|
|
29
|
+
**tracingOptions** (`TracingOptions`): Options for Tracing configuration.
|
|
30
|
+
|
|
31
|
+
**tracingOptions.metadata** (`Record<string, any>`): Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.
|
|
32
|
+
|
|
33
|
+
**tracingOptions.requestContextKeys** (`string[]`): Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').
|
|
34
|
+
|
|
35
|
+
**tracingOptions.traceId** (`string`): Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.
|
|
36
|
+
|
|
37
|
+
**tracingOptions.parentSpanId** (`string`): Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.
|
|
38
|
+
|
|
39
|
+
**tracingOptions.tags** (`string[]`): Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
40
|
+
|
|
41
|
+
**outputOptions** (`OutputOptions`): Options for output configuration.
|
|
42
|
+
|
|
43
|
+
**outputOptions.includeState** (`boolean`): Whether to include the workflow run state in the result.
|
|
30
44
|
|
|
31
45
|
## Returns
|
|
32
46
|
|
|
33
|
-
**result
|
|
47
|
+
**result** (`Promise<WorkflowResult<TState, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
34
48
|
|
|
35
|
-
**traceId
|
|
49
|
+
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
36
50
|
|
|
37
51
|
## Extended usage example
|
|
38
52
|
|
|
@@ -20,19 +20,25 @@ const result = await workflow.getWorkflowRunExecutionResult(runId)
|
|
|
20
20
|
|
|
21
21
|
## Parameters
|
|
22
22
|
|
|
23
|
-
**inputData
|
|
23
|
+
**inputData** (`z.infer<TInput>`): Input data that matches the workflow's input schema
|
|
24
24
|
|
|
25
|
-
**requestContext
|
|
25
|
+
**requestContext** (`RequestContext`): Request Context data to use during workflow execution
|
|
26
26
|
|
|
27
|
-
**initialState
|
|
27
|
+
**initialState** (`z.infer<TState>`): Initial state to use for the workflow execution
|
|
28
28
|
|
|
29
|
-
**tracingOptions
|
|
29
|
+
**tracingOptions** (`TracingOptions`): Options for Tracing configuration.
|
|
30
30
|
|
|
31
|
-
**
|
|
31
|
+
**tracingOptions.metadata** (`Record<string, any>`): Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.
|
|
32
|
+
|
|
33
|
+
**tracingOptions.traceId** (`string`): Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.
|
|
34
|
+
|
|
35
|
+
**outputOptions** (`OutputOptions`): Options for output configuration.
|
|
36
|
+
|
|
37
|
+
**outputOptions.includeState** (`boolean`): Whether to include the workflow run state in the result.
|
|
32
38
|
|
|
33
39
|
## Returns
|
|
34
40
|
|
|
35
|
-
**runId
|
|
41
|
+
**runId** (`string`): The unique identifier for this workflow run. Use this to check status or retrieve results later.
|
|
36
42
|
|
|
37
43
|
## When to use startAsync()
|
|
38
44
|
|
|
@@ -15,33 +15,49 @@ const result = await run.timeTravel({
|
|
|
15
15
|
|
|
16
16
|
## Parameters
|
|
17
17
|
|
|
18
|
-
**step
|
|
18
|
+
**step** (`Step<string, any, TInputSchema, any, any, any, TEngineType> | [...Step<string, any, any, any, any, any, TEngineType>[], Step<string, any, TInputSchema, any, any, any, TEngineType>] | string | string[]`): The target step to start execution from. It can be a Step instance, array of Steps (for nested workflows), step ID string, or array of step ID strings. Use dot notation or arrays for nested workflow steps (e.g., 'nestedWorkflow\.step3' or \['nestedWorkflow', 'step3'])
|
|
19
19
|
|
|
20
|
-
**inputData
|
|
20
|
+
**inputData** (`z.infer<TInputSchema>`): Input data for the target step. Must match the step's input schema. If not provided, uses data from the workflow snapshot
|
|
21
21
|
|
|
22
|
-
**resumeData
|
|
22
|
+
**resumeData** (`any`): Resume data to provide if the workflow was previously suspended
|
|
23
23
|
|
|
24
|
-
**initialState
|
|
24
|
+
**initialState** (`z.infer<TState>`): Initial state to set for the workflow run. Used to set workflow-level state before execution
|
|
25
25
|
|
|
26
|
-
**context
|
|
26
|
+
**context** (`TimeTravelContext<any, any, any, any>`): Execution context containing step results for steps before the target step. Each key is a step ID with a StepResult object containing status, payload, output, startedAt, endedAt, suspendPayload, and resumePayload
|
|
27
27
|
|
|
28
|
-
**nestedStepsContext
|
|
28
|
+
**nestedStepsContext** (`Record<string, TimeTravelContext<any, any, any, any>>`): Context for nested workflow steps. Keyed by nested workflow ID, each containing step results for that nested workflow
|
|
29
29
|
|
|
30
|
-
**requestContext
|
|
30
|
+
**requestContext** (`RequestContext`): Request Context data to use during time travel execution
|
|
31
31
|
|
|
32
|
-
**outputWriter
|
|
32
|
+
**outputWriter** (`(chunk: TOutput) => Promise<void>`): Optional asynchronous function to handle output chunks as they are produced
|
|
33
33
|
|
|
34
|
-
**tracingContext
|
|
34
|
+
**tracingContext** (`TracingContext`): Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.
|
|
35
35
|
|
|
36
|
-
**
|
|
36
|
+
**tracingContext.currentSpan** (`Span`): Current span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
37
37
|
|
|
38
|
-
**
|
|
38
|
+
**tracingOptions** (`TracingOptions`): Options for Tracing configuration.
|
|
39
|
+
|
|
40
|
+
**tracingOptions.metadata** (`Record<string, any>`): Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.
|
|
41
|
+
|
|
42
|
+
**tracingOptions.requestContextKeys** (`string[]`): Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').
|
|
43
|
+
|
|
44
|
+
**tracingOptions.traceId** (`string`): Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.
|
|
45
|
+
|
|
46
|
+
**tracingOptions.parentSpanId** (`string`): Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.
|
|
47
|
+
|
|
48
|
+
**tracingOptions.tags** (`string[]`): Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
49
|
+
|
|
50
|
+
**outputOptions** (`OutputOptions`): Options for output configuration.
|
|
51
|
+
|
|
52
|
+
**outputOptions.includeState** (`boolean`): Whether to include the workflow run state in the result.
|
|
53
|
+
|
|
54
|
+
**outputOptions.includeResumeLabels** (`boolean`): Whether to include resume labels in the result.
|
|
39
55
|
|
|
40
56
|
## Returns
|
|
41
57
|
|
|
42
|
-
**result
|
|
58
|
+
**result** (`Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>`): A promise that resolves to the workflow execution result containing step outputs and status
|
|
43
59
|
|
|
44
|
-
**traceId
|
|
60
|
+
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
45
61
|
|
|
46
62
|
## Extended usage examples
|
|
47
63
|
|
|
@@ -20,33 +20,33 @@ if (result.status === 'suspended') {
|
|
|
20
20
|
|
|
21
21
|
## Run Methods
|
|
22
22
|
|
|
23
|
-
**start
|
|
23
|
+
**start** (`(options?: StartOptions) => Promise<WorkflowResult>`): Starts workflow execution with input data
|
|
24
24
|
|
|
25
|
-
**resume
|
|
25
|
+
**resume** (`(options?: ResumeOptions) => Promise<WorkflowResult>`): Resumes a suspended workflow from a specific step
|
|
26
26
|
|
|
27
|
-
**stream
|
|
27
|
+
**stream** (`(options?: StreamOptions) => MastraWorkflowStream`): Monitors workflow execution as a stream of events with enhanced streaming features
|
|
28
28
|
|
|
29
|
-
**resumeStream
|
|
29
|
+
**resumeStream** (`(options?: ResumeStreamOptions) => MastraWorkflowStream`): Resumes a suspended workflow with streaming support
|
|
30
30
|
|
|
31
|
-
**cancel
|
|
31
|
+
**cancel** (`() => Promise<{ message: string }>`): Cancels the workflow execution, stopping any running steps and preventing subsequent steps from executing
|
|
32
32
|
|
|
33
|
-
**restart
|
|
33
|
+
**restart** (`(options?: RestartOptions) => Promise<WorkflowResult>`): Restarts the workflow execution from last active step
|
|
34
34
|
|
|
35
|
-
**timeTravel
|
|
35
|
+
**timeTravel** (`(options?: TimeTravelOptions) => Promise<WorkflowResult>`): Re-executes a workflow starting from any specific step, using either stored snapshot data or custom context you provide.
|
|
36
36
|
|
|
37
|
-
**timeTravelStream
|
|
37
|
+
**timeTravelStream** (`(options?: TimeTravelOptions) => MastraWorkflowStream`): Time travels a workflow execution with streaming support
|
|
38
38
|
|
|
39
39
|
## Run Status
|
|
40
40
|
|
|
41
41
|
A workflow run's `status` indicates its current execution state. The possible values are:
|
|
42
42
|
|
|
43
|
-
**success
|
|
43
|
+
**success** (`string`): All steps finished executing successfully, with a valid result output
|
|
44
44
|
|
|
45
|
-
**failed
|
|
45
|
+
**failed** (`string`): Workflow execution encountered an error during execution, with error details available
|
|
46
46
|
|
|
47
|
-
**suspended
|
|
47
|
+
**suspended** (`string`): Workflow execution is paused waiting for resume, with suspended step information
|
|
48
48
|
|
|
49
|
-
**canceled
|
|
49
|
+
**canceled** (`string`): Workflow execution was canceled via the cancel() method, stopping any running steps and preventing subsequent steps from executing
|
|
50
50
|
|
|
51
51
|
## Related
|
|
52
52
|
|
|
@@ -60,57 +60,55 @@ const agentStep = createStep(testAgent, {
|
|
|
60
60
|
|
|
61
61
|
### Agent step options
|
|
62
62
|
|
|
63
|
-
**structuredOutput
|
|
63
|
+
**structuredOutput** (`{ schema: z.ZodType<any> }`): When provided, the agent returns structured data matching this schema instead of plain text. The step's outputSchema is set to the provided schema.
|
|
64
64
|
|
|
65
|
-
**onFinish
|
|
65
|
+
**onFinish** (`(result: AgentResult) => void`): Callback invoked when the agent completes generation.
|
|
66
66
|
|
|
67
67
|
## Constructor Parameters
|
|
68
68
|
|
|
69
|
-
**id
|
|
69
|
+
**id** (`string`): Unique identifier for the step
|
|
70
70
|
|
|
71
|
-
**description
|
|
71
|
+
**description** (`string`): Optional description of what the step does
|
|
72
72
|
|
|
73
|
-
**inputSchema
|
|
73
|
+
**inputSchema** (`z.ZodType<any>`): Zod schema defining the input structure
|
|
74
74
|
|
|
75
|
-
**outputSchema
|
|
75
|
+
**outputSchema** (`z.ZodType<any>`): Zod schema defining the output structure
|
|
76
76
|
|
|
77
|
-
**resumeSchema
|
|
77
|
+
**resumeSchema** (`z.ZodType<any>`): Optional Zod schema for resuming the step
|
|
78
78
|
|
|
79
|
-
**suspendSchema
|
|
79
|
+
**suspendSchema** (`z.ZodType<any>`): Optional Zod schema for suspending the step
|
|
80
80
|
|
|
81
|
-
**stateSchema
|
|
81
|
+
**stateSchema** (`z.ZodObject<any>`): Optional Zod schema for the step state. Automatically injected when using Mastra's state system. The stateSchema must be a subset of the workflow's stateSchema. If not specified, type is 'any'.
|
|
82
82
|
|
|
83
|
-
**requestContextSchema
|
|
83
|
+
**requestContextSchema** (`z.ZodType<any>`): Zod schema for validating request context values. When provided, the context is validated before the step's execute() runs, failing the step if validation fails.
|
|
84
84
|
|
|
85
|
-
**execute
|
|
85
|
+
**execute** (`(params: ExecuteParams) => Promise<any>`): Async function containing step logic
|
|
86
86
|
|
|
87
|
-
**
|
|
87
|
+
**execute.inputData** (`z.infer<TStepInput>`): The input data matching the inputSchema
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
**execute.resumeData** (`z.infer<TResumeSchema>`): The resume data matching the resumeSchema, when resuming the step from a suspended state. Only exists if the step is being resumed.
|
|
90
90
|
|
|
91
|
-
**
|
|
91
|
+
**execute.suspendData** (`z.infer<TSuspendSchema>`): The suspend data that was originally passed to suspend() when the step was suspended. Only exists if the step is being resumed and was previously suspended with data.
|
|
92
92
|
|
|
93
|
-
**
|
|
93
|
+
**execute.mastra** (`Mastra`): Access to Mastra services (agents, tools, etc.)
|
|
94
94
|
|
|
95
|
-
**
|
|
95
|
+
**execute.getStepResult** (`(step: Step | string) => any`): Function to access results from other steps
|
|
96
96
|
|
|
97
|
-
**
|
|
97
|
+
**execute.getInitData** (`() => any`): Function to access the initial input data of the workflow in any step
|
|
98
98
|
|
|
99
|
-
**
|
|
99
|
+
**execute.suspend** (`(suspendPayload: any, suspendOptions?: { resumeLabel?: string }) => Promise<void>`): Function to pause workflow execution
|
|
100
100
|
|
|
101
|
-
**
|
|
101
|
+
**execute.state** (`z.infer<TState>`): The current workflow state. Contains shared values that persist across all steps and suspend/resume cycles. The structure is defined by the step's stateSchema.
|
|
102
102
|
|
|
103
|
-
**
|
|
103
|
+
**execute.setState** (`(state: z.infer<TState>) => void`): Function to set the state of the workflow. Inject via reducer-like pattern, such as 'setState({ ...state, ...newState })'
|
|
104
104
|
|
|
105
|
-
**
|
|
105
|
+
**execute.runId** (`string`): Current run id
|
|
106
106
|
|
|
107
|
-
**
|
|
107
|
+
**execute.requestContext** (`RequestContext`): Request Context for dependency injection and contextual information.
|
|
108
108
|
|
|
109
|
-
**
|
|
109
|
+
**execute.retryCount** (`number`): The retry count for this specific step, it automatically increases each time the step is retried
|
|
110
110
|
|
|
111
|
-
**
|
|
112
|
-
|
|
113
|
-
**retryCount?:** (`number`): The retry count for this specific step, it automatically increases each time the step is retried
|
|
111
|
+
**metadata** (`Record<string, any>`): Optional key-value pairs for storing additional step information. Values must be serializable (no functions, circular references, etc.).
|
|
114
112
|
|
|
115
113
|
## Related
|
|
116
114
|
|
|
@@ -13,11 +13,11 @@ workflow.branch([
|
|
|
13
13
|
|
|
14
14
|
## Parameters
|
|
15
15
|
|
|
16
|
-
**steps
|
|
16
|
+
**steps** (`[() => boolean, Step]`): An array of tuples, each containing a condition function and a step to execute if the condition is true
|
|
17
17
|
|
|
18
18
|
## Returns
|
|
19
19
|
|
|
20
|
-
**workflow
|
|
20
|
+
**workflow** (`NewWorkflow`): The workflow instance for method chaining
|
|
21
21
|
|
|
22
22
|
## Related
|
|
23
23
|
|
|
@@ -10,15 +10,15 @@ await workflow.createRun()
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**runId
|
|
13
|
+
**runId** (`string`): Optional custom identifier for the workflow run
|
|
14
14
|
|
|
15
|
-
**resourceId
|
|
15
|
+
**resourceId** (`string`): Optional identifier to associate the workflow run with a specific resource (e.g., user ID, tenant ID). This value is persisted with the workflow run and can be used for filtering and querying runs.
|
|
16
16
|
|
|
17
|
-
**disableScorers
|
|
17
|
+
**disableScorers** (`boolean`): Optional flag to disable scorers for this workflow run
|
|
18
18
|
|
|
19
19
|
## Returns
|
|
20
20
|
|
|
21
|
-
**run
|
|
21
|
+
**run** (`Run`): A new workflow run instance that can be used to execute the workflow
|
|
22
22
|
|
|
23
23
|
## Extended usage example
|
|
24
24
|
|
|
@@ -10,13 +10,13 @@ workflow.dountil(step1, async ({ inputData }) => true)
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**step
|
|
13
|
+
**step** (`Step`): The step instance to execute in the loop
|
|
14
14
|
|
|
15
|
-
**condition
|
|
15
|
+
**condition** (`(params : ExecuteParams & { iterationCount: number }) => Promise<boolean>`): A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters and the iteration count.
|
|
16
16
|
|
|
17
17
|
## Returns
|
|
18
18
|
|
|
19
|
-
**workflow
|
|
19
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
20
20
|
|
|
21
21
|
## Related
|
|
22
22
|
|
|
@@ -10,13 +10,13 @@ workflow.dowhile(step1, async ({ inputData }) => true)
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**step
|
|
13
|
+
**step** (`Step`): The step instance to execute in the loop
|
|
14
14
|
|
|
15
|
-
**condition
|
|
15
|
+
**condition** (`(params : ExecuteParams & { iterationCount: number }) => Promise<boolean>`): A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters and the iteration count.
|
|
16
16
|
|
|
17
17
|
## Returns
|
|
18
18
|
|
|
19
|
-
**workflow
|
|
19
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
20
20
|
|
|
21
21
|
## Related
|
|
22
22
|
|
|
@@ -10,13 +10,13 @@ workflow.foreach(step1, { concurrency: 2 })
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**step
|
|
13
|
+
**step** (`Step`): The step instance to execute in the loop. The previous step must return an array type.
|
|
14
14
|
|
|
15
|
-
**opts
|
|
15
|
+
**opts** (`object`): Optional configuration for the loop. The concurrency option controls how many iterations can run in parallel (default: 1)
|
|
16
16
|
|
|
17
17
|
## Returns
|
|
18
18
|
|
|
19
|
-
**workflow
|
|
19
|
+
**workflow** (`Workflow`): The workflow instance for method chaining. The output type is an array of the step's output type.
|
|
20
20
|
|
|
21
21
|
## Behavior
|
|
22
22
|
|
|
@@ -101,17 +101,17 @@ for await (const chunk of stream) {
|
|
|
101
101
|
|
|
102
102
|
Each progress event payload contains:
|
|
103
103
|
|
|
104
|
-
**id
|
|
104
|
+
**id** (`string`): The step ID of the foreach step
|
|
105
105
|
|
|
106
|
-
**completedCount
|
|
106
|
+
**completedCount** (`number`): Number of iterations completed so far
|
|
107
107
|
|
|
108
|
-
**totalCount
|
|
108
|
+
**totalCount** (`number`): Total number of iterations
|
|
109
109
|
|
|
110
|
-
**currentIndex
|
|
110
|
+
**currentIndex** (`number`): Index of the iteration that just completed
|
|
111
111
|
|
|
112
|
-
**iterationStatus
|
|
112
|
+
**iterationStatus** (`'success' | 'failed' | 'suspended'`): Status of the iteration that just completed
|
|
113
113
|
|
|
114
|
-
**iterationOutput
|
|
114
|
+
**iterationOutput** (`Record<string, any>`): Output of the iteration (present when iterationStatus is 'success')
|
|
115
115
|
|
|
116
116
|
## Related
|
|
117
117
|
|
|
@@ -10,11 +10,11 @@ workflow.map(async ({ inputData }) => `${inputData.value} - map`)
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**mappingFunction
|
|
13
|
+
**mappingFunction** (`(params: { inputData: any }) => any`): Function that transforms input data and returns the mapped result
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Using `inputData`
|
|
20
20
|
|
|
@@ -10,11 +10,11 @@ workflow.parallel([step1, step2])
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**steps
|
|
13
|
+
**steps** (`Step[]`): The step instances to execute in parallel
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Related
|
|
20
20
|
|
|
@@ -10,11 +10,11 @@ workflow.sleep(5000)
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**milliseconds
|
|
13
|
+
**milliseconds** (`number | ((context: { inputData: any }) => number | Promise<number>)`): The number of milliseconds to pause execution, or a callback that returns the delay
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Extended usage example
|
|
20
20
|
|
|
@@ -10,11 +10,11 @@ workflow.sleepUntil(new Date(Date.now() + 5000))
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**dateOrCallback
|
|
13
|
+
**dateOrCallback** (`Date | ((params: ExecuteFunctionParams) => Promise<Date>)`): Either a Date object or a callback function that returns a Date. The callback receives execution context and can compute the target time dynamically based on input data.
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`Workflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Extended usage example
|
|
20
20
|
|
|
@@ -10,11 +10,11 @@ workflow.then(step1).then(step2)
|
|
|
10
10
|
|
|
11
11
|
## Parameters
|
|
12
12
|
|
|
13
|
-
**step
|
|
13
|
+
**step** (`Step`): The step instance that should execute after the previous step completes
|
|
14
14
|
|
|
15
15
|
## Returns
|
|
16
16
|
|
|
17
|
-
**workflow
|
|
17
|
+
**workflow** (`NewWorkflow`): The workflow instance for method chaining
|
|
18
18
|
|
|
19
19
|
## Related
|
|
20
20
|
|