@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
|
@@ -10,17 +10,18 @@ import type { PubSub } from '../events/pubsub.js';
|
|
|
10
10
|
import type { Mastra } from '../mastra/index.js';
|
|
11
11
|
import type { TracingContext, TracingOptions, TracingPolicy } from '../observability/index.js';
|
|
12
12
|
import type { Processor } from '../processors/index.js';
|
|
13
|
-
import {
|
|
13
|
+
import { ProcessorStepOutputSchema, ProcessorStepInputSchema } from '../processors/step-schema.js';
|
|
14
14
|
import type { StorageListWorkflowRunsInput } from '../storage/index.js';
|
|
15
|
-
import type { OutputSchema } from '../stream/base/schema.js';
|
|
15
|
+
import type { InferZodLikeSchema, OutputSchema, SchemaWithValidation } from '../stream/base/schema.js';
|
|
16
16
|
import { WorkflowRunOutput } from '../stream/RunOutput.js';
|
|
17
|
-
import
|
|
17
|
+
import { Tool } from '../tools/index.js';
|
|
18
|
+
import type { ToolExecutionContext } from '../tools/index.js';
|
|
18
19
|
import type { DynamicArgument } from '../types/index.js';
|
|
19
20
|
import { PUBSUB_SYMBOL } from './constants.js';
|
|
20
21
|
import type { ExecutionEngine, ExecutionGraph } from './execution-engine.js';
|
|
21
|
-
import type { ConditionFunction, ExecuteFunction, LoopConditionFunction, Step, SuspendOptions } from './step.js';
|
|
22
|
-
import type { DefaultEngineType, DynamicMapping, ExtractSchemaFromStep, ExtractSchemaType, PathsToStringProps, SerializedStepFlowEntry, StepFlowEntry, StepResult, StepsRecord, StepWithComponent, StreamEvent, SubsetOf, TimeTravelContext, WorkflowConfig, WorkflowEngineType, WorkflowOptions, WorkflowResult, WorkflowType, WorkflowRunStatus, WorkflowState, WorkflowStateField, WorkflowStreamEvent,
|
|
23
|
-
export type AgentStepOptions<
|
|
22
|
+
import type { ConditionFunction, ExecuteFunction, InnerOutput, LoopConditionFunction, Step, SuspendOptions } from './step.js';
|
|
23
|
+
import type { DefaultEngineType, DynamicMapping, ExtractSchemaFromStep, ExtractSchemaType, PathsToStringProps, SerializedStepFlowEntry, StepFlowEntry, StepResult, StepsRecord, StepWithComponent, StreamEvent, SubsetOf, TimeTravelContext, WorkflowConfig, WorkflowEngineType, WorkflowOptions, WorkflowResult, WorkflowType, WorkflowRunStatus, WorkflowState, WorkflowStateField, WorkflowStreamEvent, StepParams, OutputWriter } from './types.js';
|
|
24
|
+
export type AgentStepOptions<TOUTPUT> = Omit<AgentExecutionOptions<TOUTPUT> & AgentStreamOptions, 'format' | 'tracingContext' | 'requestContext' | 'abortSignal' | 'context' | 'onStepFinish' | 'output' | 'experimental_output' | 'resourceId' | 'threadId' | 'scorers'>;
|
|
24
25
|
export declare function mapVariable<TStep extends Step<string, any, any, any, any, any>>({ step, path, }: {
|
|
25
26
|
step: TStep;
|
|
26
27
|
path: PathsToStringProps<ExtractSchemaType<ExtractSchemaFromStep<TStep, 'outputSchema'>>> | '.';
|
|
@@ -28,7 +29,7 @@ export declare function mapVariable<TStep extends Step<string, any, any, any, an
|
|
|
28
29
|
step: TStep;
|
|
29
30
|
path: PathsToStringProps<ExtractSchemaType<ExtractSchemaFromStep<TStep, 'outputSchema'>>> | '.';
|
|
30
31
|
};
|
|
31
|
-
export declare function mapVariable<TWorkflow extends Workflow<any, any, any, any, any, any>>({ initData: TWorkflow, path, }: {
|
|
32
|
+
export declare function mapVariable<TWorkflow extends Workflow<any, any, any, any, any, any, any>>({ initData: TWorkflow, path, }: {
|
|
32
33
|
initData: TWorkflow;
|
|
33
34
|
path: PathsToStringProps<ExtractSchemaType<ExtractSchemaFromStep<TWorkflow, 'inputSchema'>>> | '.';
|
|
34
35
|
}): {
|
|
@@ -36,7 +37,7 @@ export declare function mapVariable<TWorkflow extends Workflow<any, any, any, an
|
|
|
36
37
|
path: PathsToStringProps<ExtractSchemaType<ExtractSchemaFromStep<TWorkflow, 'inputSchema'>>> | '.';
|
|
37
38
|
};
|
|
38
39
|
/**
|
|
39
|
-
* Creates a
|
|
40
|
+
* Creates a step from explicit params (IMPORTANT: FIRST overload for best error messages when using .then in workflows)
|
|
40
41
|
* @param params Configuration parameters for the step
|
|
41
42
|
* @param params.id Unique identifier for the step
|
|
42
43
|
* @param params.description Optional description of what the step does
|
|
@@ -45,29 +46,60 @@ export declare function mapVariable<TWorkflow extends Workflow<any, any, any, an
|
|
|
45
46
|
* @param params.execute Function that performs the step's operations
|
|
46
47
|
* @returns A Step object that can be added to the workflow
|
|
47
48
|
*/
|
|
48
|
-
export declare function createStep<TStepId extends string,
|
|
49
|
-
|
|
49
|
+
export declare function createStep<TStepId extends string, TStateSchema extends z.ZodTypeAny | undefined, TInputSchema extends z.ZodTypeAny, TOutputSchema extends z.ZodTypeAny, TResumeSchema extends z.ZodTypeAny | undefined = undefined, TSuspendSchema extends z.ZodTypeAny | undefined = undefined>(params: StepParams<TStepId, TStateSchema, TInputSchema, TOutputSchema, TResumeSchema, TSuspendSchema>): Step<TStepId, TStateSchema extends z.ZodTypeAny ? z.infer<TStateSchema> : unknown, z.infer<TInputSchema>, z.infer<TOutputSchema>, TResumeSchema extends z.ZodTypeAny ? z.infer<TResumeSchema> : unknown, TSuspendSchema extends z.ZodTypeAny ? z.infer<TSuspendSchema> : unknown, DefaultEngineType>;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a step from an agent with structured output
|
|
52
|
+
*/
|
|
53
|
+
export declare function createStep<TStepId extends string, TStepOutput>(agent: Agent<TStepId, any>, agentOptions: AgentStepOptions<TStepOutput> & {
|
|
50
54
|
structuredOutput: {
|
|
51
|
-
schema: TStepOutput
|
|
55
|
+
schema: OutputSchema<TStepOutput>;
|
|
52
56
|
};
|
|
53
57
|
retries?: number;
|
|
54
58
|
scorers?: DynamicArgument<MastraScorers>;
|
|
55
|
-
}): Step<TStepId,
|
|
56
|
-
prompt:
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
}): Step<TStepId, unknown, {
|
|
60
|
+
prompt: string;
|
|
61
|
+
}, TStepOutput, unknown, unknown, DefaultEngineType>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a step from an agent (defaults to { text: string } output)
|
|
64
|
+
*/
|
|
65
|
+
export declare function createStep<TStepId extends string, TStepInput extends {
|
|
66
|
+
prompt: string;
|
|
67
|
+
}, TStepOutput extends {
|
|
68
|
+
text: string;
|
|
69
|
+
}, TResume, TSuspend>(agent: Agent<TStepId, any>, agentOptions?: AgentStepOptions<TStepOutput> & {
|
|
63
70
|
retries?: number;
|
|
64
71
|
scorers?: DynamicArgument<MastraScorers>;
|
|
65
|
-
}): Step<TStepId,
|
|
66
|
-
|
|
72
|
+
}): Step<TStepId, unknown, TStepInput, TStepOutput, TResume, TSuspend, DefaultEngineType>;
|
|
73
|
+
/**
|
|
74
|
+
* Creates a step from a tool
|
|
75
|
+
*/
|
|
76
|
+
export declare function createStep<TSchemaIn, TSuspend, TResume, TSchemaOut, TContext extends ToolExecutionContext<TSuspend, TResume>, TId extends string>(tool: Tool<TSchemaIn, TSchemaOut, TSuspend, TResume, TContext, TId>, toolOptions?: {
|
|
67
77
|
retries?: number;
|
|
68
78
|
scorers?: DynamicArgument<MastraScorers>;
|
|
69
|
-
}): Step<
|
|
70
|
-
|
|
79
|
+
}): Step<TId, unknown, TSchemaIn, TSchemaOut, TSuspend, TResume, DefaultEngineType>;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a step from a Processor - wraps a Processor as a workflow step
|
|
82
|
+
* Note: We require at least one processor method to distinguish from StepParams
|
|
83
|
+
*/
|
|
84
|
+
export declare function createStep<TProcessorId extends string>(processor: (Processor<TProcessorId> & {
|
|
85
|
+
processInput: Function;
|
|
86
|
+
}) | (Processor<TProcessorId> & {
|
|
87
|
+
processInputStream: Function;
|
|
88
|
+
}) | (Processor<TProcessorId> & {
|
|
89
|
+
processInputStep: Function;
|
|
90
|
+
}) | (Processor<TProcessorId> & {
|
|
91
|
+
processOutputStream: Function;
|
|
92
|
+
}) | (Processor<TProcessorId> & {
|
|
93
|
+
processOutputResult: Function;
|
|
94
|
+
}) | (Processor<TProcessorId> & {
|
|
95
|
+
processOutputStep: Function;
|
|
96
|
+
})): Step<`processor:${TProcessorId}`, unknown, z.infer<typeof ProcessorStepInputSchema>, z.infer<typeof ProcessorStepOutputSchema>, unknown, unknown, DefaultEngineType>;
|
|
97
|
+
/**
|
|
98
|
+
* IMPORTANT: Fallback overload - provides better error messages when StepParams doesn't match
|
|
99
|
+
* This should be LAST and will show clearer errors about what's wrong
|
|
100
|
+
* This is a copy of first one, KEEP THIS IN SYNC!
|
|
101
|
+
*/
|
|
102
|
+
export declare function createStep<TStepId extends string, TStateSchema extends z.ZodTypeAny | undefined, TInputSchema extends z.ZodTypeAny, TOutputSchema extends z.ZodTypeAny, TResumeSchema extends z.ZodTypeAny | undefined = undefined, TSuspendSchema extends z.ZodTypeAny | undefined = undefined>(params: StepParams<TStepId, TStateSchema, TInputSchema, TOutputSchema, TResumeSchema, TSuspendSchema>): Step<TStepId, TStateSchema extends z.ZodTypeAny ? z.infer<TStateSchema> : unknown, z.infer<TInputSchema>, z.infer<TOutputSchema>, TResumeSchema extends z.ZodTypeAny ? z.infer<TResumeSchema> : unknown, TSuspendSchema extends z.ZodTypeAny ? z.infer<TSuspendSchema> : unknown, DefaultEngineType>;
|
|
71
103
|
export declare function cloneStep<TStepId extends string>(step: Step<string, any, any, any, any, any, DefaultEngineType>, opts: {
|
|
72
104
|
id: TStepId;
|
|
73
105
|
}): Step<TStepId, any, any, any, any, any, DefaultEngineType>;
|
|
@@ -76,17 +108,17 @@ export declare function cloneStep<TStepId extends string>(step: Step<string, any
|
|
|
76
108
|
* A Processor must have an 'id' property and at least one processor method.
|
|
77
109
|
*/
|
|
78
110
|
export declare function isProcessor(obj: unknown): obj is Processor;
|
|
79
|
-
export declare function createWorkflow<TWorkflowId extends string = string, TState
|
|
80
|
-
export declare function cloneWorkflow<TWorkflowId extends string = string, TState
|
|
111
|
+
export declare function createWorkflow<TWorkflowId extends string = string, TState = unknown, TInput = unknown, TOutput = unknown, TSteps extends Step<string, any, any, any, any, any, DefaultEngineType>[] = Step[]>(params: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps>): Workflow<DefaultEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TInput>;
|
|
112
|
+
export declare function cloneWorkflow<TWorkflowId extends string = string, TState = unknown, TInput = unknown, TOutput = unknown, TSteps extends Step<string, any, any, any, any, any, DefaultEngineType>[] = Step<string, any, any, any, any, any, DefaultEngineType>[], TPrevSchema = TInput>(workflow: Workflow<DefaultEngineType, TSteps, string, TState, TInput, TOutput, TPrevSchema>, opts: {
|
|
81
113
|
id: TWorkflowId;
|
|
82
114
|
}): Workflow<DefaultEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TPrevSchema>;
|
|
83
|
-
export declare class Workflow<TEngineType =
|
|
115
|
+
export declare class Workflow<TEngineType = DefaultEngineType, TSteps extends Step<string, any, any, any, any, any, TEngineType>[] = Step<string, unknown, unknown, unknown, unknown, unknown, TEngineType>[], TWorkflowId extends string = string, TState = unknown, TInput = unknown, TOutput = unknown, TPrevSchema = TInput> extends MastraBase implements Step<TWorkflowId, TState, TInput, TOutput | undefined, any, any, DefaultEngineType> {
|
|
84
116
|
#private;
|
|
85
117
|
id: TWorkflowId;
|
|
86
118
|
description?: string | undefined;
|
|
87
|
-
inputSchema: TInput
|
|
88
|
-
outputSchema: TOutput
|
|
89
|
-
stateSchema?: TState
|
|
119
|
+
inputSchema: SchemaWithValidation<TInput>;
|
|
120
|
+
outputSchema: SchemaWithValidation<TOutput>;
|
|
121
|
+
stateSchema?: SchemaWithValidation<TState>;
|
|
90
122
|
steps: Record<string, StepWithComponent>;
|
|
91
123
|
stepDefs?: TSteps;
|
|
92
124
|
engineType: WorkflowEngineType;
|
|
@@ -103,7 +135,7 @@ export declare class Workflow<TEngineType = any, TSteps extends Step<string, any
|
|
|
103
135
|
};
|
|
104
136
|
constructor({ mastra, id, inputSchema, outputSchema, stateSchema, description, executionEngine, retryConfig, steps, options, type, }: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps>);
|
|
105
137
|
get runs(): Map<string, Run<TEngineType, TSteps, TState, TInput, TOutput>>;
|
|
106
|
-
get mastra(): Mastra<Record<string, Agent<any, import("../agent").ToolsInput>>, Record<string, Workflow<any, any, any, any, any, any, any>>, Record<string, import("../vector").MastraVector<any>>, Record<string, import("../tts").MastraTTS>, import("../logger").IMastraLogger, Record<string, import("../mcp").MCPServerBase<any>>, Record<string, import("../evals").MastraScorer<any, any, any, any>>, Record<string, import("../tools").ToolAction<any, any, any, any, any, any>>, Record<string, Processor<any, unknown>>, Record<string, import("../memory").MastraMemory>> | undefined;
|
|
138
|
+
get mastra(): Mastra<Record<string, Agent<any, import("../agent").ToolsInput, undefined>>, Record<string, Workflow<any, any, any, any, any, any, any>>, Record<string, import("../vector").MastraVector<any>>, Record<string, import("../tts").MastraTTS>, import("../logger").IMastraLogger, Record<string, import("../mcp").MCPServerBase<any>>, Record<string, import("../evals").MastraScorer<any, any, any, any>>, Record<string, import("../tools").ToolAction<any, any, any, any, any, any>>, Record<string, Processor<any, unknown>>, Record<string, import("../memory").MastraMemory>> | undefined;
|
|
107
139
|
get options(): Omit<WorkflowOptions, "validateInputs" | "shouldPersistSnapshot"> & Required<Pick<WorkflowOptions, "validateInputs" | "shouldPersistSnapshot">>;
|
|
108
140
|
__registerMastra(mastra: Mastra): void;
|
|
109
141
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
@@ -112,24 +144,27 @@ export declare class Workflow<TEngineType = any, TSteps extends Step<string, any
|
|
|
112
144
|
* Adds a step to the workflow
|
|
113
145
|
* @param step The step to add to the workflow
|
|
114
146
|
* @returns The workflow instance for chaining
|
|
147
|
+
*
|
|
148
|
+
* The step's inputSchema must be satisfied by the previous step's output (or workflow input for first step).
|
|
149
|
+
* This means: TPrevSchema must be assignable to TStepInput
|
|
115
150
|
*/
|
|
116
|
-
then<TStepId extends string, TStepState
|
|
151
|
+
then<TStepId extends string, TStepState, TStepInput, TSchemaOut>(step: Step<TStepId, unknown extends TStepState ? TStepState : SubsetOf<TStepState, TState>, TPrevSchema extends TStepInput ? TStepInput : TPrevSchema, TSchemaOut, any, any, TEngineType>): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TSchemaOut>;
|
|
117
152
|
/**
|
|
118
153
|
* Adds a sleep step to the workflow
|
|
119
154
|
* @param duration The duration to sleep for
|
|
120
155
|
* @returns The workflow instance for chaining
|
|
121
156
|
*/
|
|
122
|
-
sleep(duration: number | ExecuteFunction<
|
|
157
|
+
sleep(duration: number | ExecuteFunction<TState, TPrevSchema, number, any, any, TEngineType>): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TPrevSchema>;
|
|
123
158
|
/**
|
|
124
159
|
* Adds a sleep until step to the workflow
|
|
125
160
|
* @param date The date to sleep until
|
|
126
161
|
* @returns The workflow instance for chaining
|
|
127
162
|
*/
|
|
128
|
-
sleepUntil(date: Date | ExecuteFunction<
|
|
163
|
+
sleepUntil(date: Date | ExecuteFunction<TState, TPrevSchema, Date, any, any, TEngineType>): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TPrevSchema>;
|
|
129
164
|
/**
|
|
130
165
|
* @deprecated waitForEvent has been removed. Please use suspend/resume instead.
|
|
131
166
|
*/
|
|
132
|
-
waitForEvent<TStepState
|
|
167
|
+
waitForEvent<TStepState, TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut>(_event: string, _step: Step<TStepId, SubsetOf<TStepState, TState>, TStepInputSchema, TSchemaOut, any, any, TEngineType>, _opts?: {
|
|
133
168
|
timeout?: number;
|
|
134
169
|
}): void;
|
|
135
170
|
map(mappingConfig: {
|
|
@@ -138,31 +173,31 @@ export declare class Workflow<TEngineType = any, TSteps extends Step<string, any
|
|
|
138
173
|
path: string;
|
|
139
174
|
} | {
|
|
140
175
|
value: any;
|
|
141
|
-
schema:
|
|
176
|
+
schema: SchemaWithValidation<any>;
|
|
142
177
|
} | {
|
|
143
178
|
initData: Workflow<TEngineType, any, any, any, any, any, any>;
|
|
144
179
|
path: string;
|
|
145
180
|
} | {
|
|
146
181
|
requestContextPath: string;
|
|
147
|
-
schema:
|
|
148
|
-
} | DynamicMapping<TPrevSchema,
|
|
149
|
-
} | ExecuteFunction<
|
|
182
|
+
schema: SchemaWithValidation<any>;
|
|
183
|
+
} | DynamicMapping<TPrevSchema, any>;
|
|
184
|
+
} | ExecuteFunction<TState, TPrevSchema, any, any, any, TEngineType>, stepOptions?: {
|
|
150
185
|
id?: string | null;
|
|
151
186
|
}): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, any>;
|
|
152
187
|
parallel<TParallelSteps extends readonly Step<string, any, TPrevSchema, any, any, any, TEngineType>[]>(steps: TParallelSteps & {
|
|
153
|
-
[K in keyof TParallelSteps]: TParallelSteps[K] extends Step<string, infer S
|
|
154
|
-
any, // Don't infer
|
|
188
|
+
[K in keyof TParallelSteps]: TParallelSteps[K] extends Step<string, infer S, TPrevSchema, infer O, any, // Don't infer TResume - causes issues with heterogeneous tuples
|
|
189
|
+
any, // Don't infer TSuspend - causes issues with heterogeneous tuples
|
|
155
190
|
TEngineType> ? Step<string, SubsetOf<S, TState>, TPrevSchema, O, any, any, TEngineType> : `Error: Expected Step with state schema that is a subset of workflow state`;
|
|
156
|
-
}): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput,
|
|
191
|
+
}): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, { [K in keyof StepsRecord<TParallelSteps>]: InferZodLikeSchema<StepsRecord<TParallelSteps>[K]["outputSchema"]>; }>;
|
|
157
192
|
branch<TBranchSteps extends Array<[
|
|
158
|
-
ConditionFunction<
|
|
193
|
+
ConditionFunction<TState, TPrevSchema, any, any, any, TEngineType>,
|
|
159
194
|
Step<string, any, TPrevSchema, any, any, any, TEngineType>
|
|
160
|
-
]>>(steps: TBranchSteps): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput,
|
|
161
|
-
dowhile<TStepState
|
|
162
|
-
dountil<TStepState
|
|
163
|
-
foreach<TPrevIsArray extends TPrevSchema extends
|
|
195
|
+
]>>(steps: TBranchSteps): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, { [K in keyof StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>]?: InferZodLikeSchema<StepsRecord<{ [K_1 in keyof TBranchSteps]: TBranchSteps[K_1][1]; }[number][]>[K]["outputSchema"]>; }>;
|
|
196
|
+
dowhile<TStepState, TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut>(step: Step<TStepId, SubsetOf<TStepState, TState>, TStepInputSchema, TSchemaOut, any, any, TEngineType>, condition: LoopConditionFunction<TState, any, any, any, any, TEngineType>): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TSchemaOut>;
|
|
197
|
+
dountil<TStepState, TStepInputSchema extends TPrevSchema, TStepId extends string, TSchemaOut>(step: Step<TStepId, SubsetOf<TStepState, TState>, TStepInputSchema, TSchemaOut, any, any, TEngineType>, condition: LoopConditionFunction<TState, any, any, any, any, TEngineType>): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TSchemaOut>;
|
|
198
|
+
foreach<TPrevIsArray extends TPrevSchema extends any[] ? true : false, TStepState, TStepInputSchema extends TPrevSchema extends (infer TElement)[] ? TElement : never, TStepId extends string, TSchemaOut>(step: TPrevIsArray extends true ? Step<TStepId, SubsetOf<TStepState, TState>, TStepInputSchema, TSchemaOut, any, any, TEngineType> : 'Previous step must return an array type', opts?: {
|
|
164
199
|
concurrency: number;
|
|
165
|
-
}): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput,
|
|
200
|
+
}): Workflow<TEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TSchemaOut[]>;
|
|
166
201
|
/**
|
|
167
202
|
* Builds the execution graph for this workflow
|
|
168
203
|
* @returns The execution graph that can be used to execute the workflow
|
|
@@ -194,15 +229,14 @@ export declare class Workflow<TEngineType = any, TSteps extends Step<string, any
|
|
|
194
229
|
}): Promise<MastraScorers>;
|
|
195
230
|
execute({ runId, inputData, resumeData, state, setState, suspend, restart, resume, timeTravel, [PUBSUB_SYMBOL]: pubsub, mastra, requestContext, abort, abortSignal, retryCount, tracingContext, outputWriter, validateInputs, perStep, }: {
|
|
196
231
|
runId?: string;
|
|
197
|
-
inputData:
|
|
198
|
-
resumeData?:
|
|
199
|
-
state:
|
|
200
|
-
setState: (state:
|
|
201
|
-
|
|
202
|
-
suspend: (suspendPayload: any, suspendOptions?: SuspendOptions) => Promise<any>;
|
|
232
|
+
inputData: TInput;
|
|
233
|
+
resumeData?: unknown;
|
|
234
|
+
state: TState;
|
|
235
|
+
setState: (state: TState) => Promise<void>;
|
|
236
|
+
suspend: (suspendPayload: any, suspendOptions?: SuspendOptions) => InnerOutput | Promise<InnerOutput>;
|
|
203
237
|
restart?: boolean;
|
|
204
238
|
timeTravel?: {
|
|
205
|
-
inputData?:
|
|
239
|
+
inputData?: TInput;
|
|
206
240
|
steps: string[];
|
|
207
241
|
nestedStepResults?: Record<string, Record<string, StepResult<any, any, any, any>>>;
|
|
208
242
|
resumeData?: any;
|
|
@@ -226,7 +260,7 @@ export declare class Workflow<TEngineType = any, TSteps extends Step<string, any
|
|
|
226
260
|
outputWriter?: OutputWriter;
|
|
227
261
|
validateInputs?: boolean;
|
|
228
262
|
perStep?: boolean;
|
|
229
|
-
}): Promise<
|
|
263
|
+
}): Promise<TOutput | undefined>;
|
|
230
264
|
listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<import("../storage").WorkflowRuns>;
|
|
231
265
|
listActiveWorkflowRuns(): Promise<{
|
|
232
266
|
runs: import("../storage").WorkflowRun[];
|
|
@@ -255,7 +289,7 @@ export declare class Workflow<TEngineType = any, TSteps extends Step<string, any
|
|
|
255
289
|
/**
|
|
256
290
|
* Represents a workflow run that can be executed
|
|
257
291
|
*/
|
|
258
|
-
export declare class Run<TEngineType =
|
|
292
|
+
export declare class Run<TEngineType = DefaultEngineType, TSteps extends Step<string, any, any, any, any, any, TEngineType>[] = Step<string, unknown, unknown, unknown, unknown, unknown, TEngineType>[], TState = unknown, TInput = unknown, TOutput = unknown> {
|
|
259
293
|
#private;
|
|
260
294
|
protected pubsub: PubSub;
|
|
261
295
|
/**
|
|
@@ -304,12 +338,12 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
304
338
|
readonly workflowSteps: Record<string, StepWithComponent>;
|
|
305
339
|
workflowRunStatus: WorkflowRunStatus;
|
|
306
340
|
readonly workflowEngineType: WorkflowEngineType;
|
|
307
|
-
get mastra(): Mastra<Record<string, Agent<any, import("../agent").ToolsInput>>, Record<string, Workflow<any, any, any, any, any, any, any>>, Record<string, import("../vector").MastraVector<any>>, Record<string, import("../tts").MastraTTS>, import("../logger").IMastraLogger, Record<string, import("../mcp").MCPServerBase<any>>, Record<string, import("../evals").MastraScorer<any, any, any, any>>, Record<string, import("../tools").ToolAction<any, any, any, any, any, any>>, Record<string, Processor<any, unknown>>, Record<string, import("../memory").MastraMemory>> | undefined;
|
|
308
|
-
|
|
341
|
+
get mastra(): Mastra<Record<string, Agent<any, import("../agent").ToolsInput, undefined>>, Record<string, Workflow<any, any, any, any, any, any, any>>, Record<string, import("../vector").MastraVector<any>>, Record<string, import("../tts").MastraTTS>, import("../logger").IMastraLogger, Record<string, import("../mcp").MCPServerBase<any>>, Record<string, import("../evals").MastraScorer<any, any, any, any>>, Record<string, import("../tools").ToolAction<any, any, any, any, any, any>>, Record<string, Processor<any, unknown>>, Record<string, import("../memory").MastraMemory>> | undefined;
|
|
342
|
+
streamOutput?: WorkflowRunOutput<WorkflowResult<TState, TInput, TOutput, TSteps>>;
|
|
309
343
|
protected closeStreamAction?: () => Promise<void>;
|
|
310
344
|
protected executionResults?: Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>;
|
|
311
|
-
protected stateSchema?:
|
|
312
|
-
protected inputSchema?:
|
|
345
|
+
protected stateSchema?: SchemaWithValidation<TState>;
|
|
346
|
+
protected inputSchema?: SchemaWithValidation<TInput>;
|
|
313
347
|
protected cleanup?: () => void;
|
|
314
348
|
protected retryConfig?: {
|
|
315
349
|
attempts?: number;
|
|
@@ -319,8 +353,8 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
319
353
|
workflowId: string;
|
|
320
354
|
runId: string;
|
|
321
355
|
resourceId?: string;
|
|
322
|
-
stateSchema?:
|
|
323
|
-
inputSchema?:
|
|
356
|
+
stateSchema?: SchemaWithValidation<TState>;
|
|
357
|
+
inputSchema?: SchemaWithValidation<TInput>;
|
|
324
358
|
executionEngine: ExecutionEngine;
|
|
325
359
|
executionGraph: ExecutionGraph;
|
|
326
360
|
mastra?: Mastra;
|
|
@@ -342,13 +376,19 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
342
376
|
* This aborts any running execution and updates the workflow status to 'canceled' in storage.
|
|
343
377
|
*/
|
|
344
378
|
cancel(): Promise<void>;
|
|
345
|
-
protected _validateInput(inputData
|
|
346
|
-
protected _validateInitialState(initialState
|
|
347
|
-
protected _validateResumeData<
|
|
348
|
-
protected _validateTimetravelInputData<
|
|
349
|
-
protected _start({ inputData, initialState, requestContext, outputWriter, tracingContext, tracingOptions, format, outputOptions, perStep, }: {
|
|
350
|
-
inputData?:
|
|
351
|
-
|
|
379
|
+
protected _validateInput(inputData?: TInput): Promise<TInput | undefined>;
|
|
380
|
+
protected _validateInitialState(initialState?: TState): Promise<TState | undefined>;
|
|
381
|
+
protected _validateResumeData<TResume>(resumeData: TResume, suspendedStep?: StepWithComponent): Promise<TResume>;
|
|
382
|
+
protected _validateTimetravelInputData<TInput>(inputData: TInput, step: Step<string, any, TInput, any, any, any, TEngineType>): Promise<TInput>;
|
|
383
|
+
protected _start({ inputData, initialState, requestContext, outputWriter, tracingContext, tracingOptions, format, outputOptions, perStep, }: (TInput extends unknown ? {
|
|
384
|
+
inputData?: TInput;
|
|
385
|
+
} : {
|
|
386
|
+
inputData: TInput;
|
|
387
|
+
}) & (TState extends unknown ? {
|
|
388
|
+
initialState?: TState;
|
|
389
|
+
} : {
|
|
390
|
+
initialState: TState;
|
|
391
|
+
}) & {
|
|
352
392
|
requestContext?: RequestContext;
|
|
353
393
|
outputWriter?: OutputWriter;
|
|
354
394
|
tracingContext?: TracingContext;
|
|
@@ -365,9 +405,15 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
365
405
|
* @param input The input data for the workflow
|
|
366
406
|
* @returns A promise that resolves to the workflow output
|
|
367
407
|
*/
|
|
368
|
-
start(args: {
|
|
369
|
-
inputData?:
|
|
370
|
-
|
|
408
|
+
start(args: (TInput extends unknown ? {
|
|
409
|
+
inputData?: TInput;
|
|
410
|
+
} : {
|
|
411
|
+
inputData: TInput;
|
|
412
|
+
}) & (TState extends unknown ? {
|
|
413
|
+
initialState?: TState;
|
|
414
|
+
} : {
|
|
415
|
+
initialState: TState;
|
|
416
|
+
}) & {
|
|
371
417
|
requestContext?: RequestContext;
|
|
372
418
|
outputWriter?: OutputWriter;
|
|
373
419
|
tracingContext?: TracingContext;
|
|
@@ -385,9 +431,15 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
385
431
|
* @param args The input data and configuration for the workflow
|
|
386
432
|
* @returns A promise that resolves immediately with the runId
|
|
387
433
|
*/
|
|
388
|
-
startAsync(args: {
|
|
389
|
-
inputData?:
|
|
390
|
-
|
|
434
|
+
startAsync(args: (TInput extends unknown ? {
|
|
435
|
+
inputData?: TInput;
|
|
436
|
+
} : {
|
|
437
|
+
inputData: TInput;
|
|
438
|
+
}) & (TState extends unknown ? {
|
|
439
|
+
initialState?: TState;
|
|
440
|
+
} : {
|
|
441
|
+
initialState: TState;
|
|
442
|
+
}) & {
|
|
391
443
|
requestContext?: RequestContext;
|
|
392
444
|
tracingOptions?: TracingOptions;
|
|
393
445
|
outputOptions?: {
|
|
@@ -403,8 +455,11 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
403
455
|
* @param input The input data for the workflow
|
|
404
456
|
* @returns A promise that resolves to the workflow output
|
|
405
457
|
*/
|
|
406
|
-
streamLegacy({ inputData, requestContext, onChunk, tracingContext, tracingOptions, }?: {
|
|
407
|
-
inputData?:
|
|
458
|
+
streamLegacy({ inputData, requestContext, onChunk, tracingContext, tracingOptions, }?: (TInput extends unknown ? {
|
|
459
|
+
inputData?: TInput;
|
|
460
|
+
} : {
|
|
461
|
+
inputData: TInput;
|
|
462
|
+
}) & {
|
|
408
463
|
requestContext?: RequestContext;
|
|
409
464
|
tracingContext?: TracingContext;
|
|
410
465
|
onChunk?: (chunk: StreamEvent) => Promise<unknown>;
|
|
@@ -425,23 +480,24 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
425
480
|
* @returns A readable stream of the workflow events
|
|
426
481
|
*/
|
|
427
482
|
observeStream(): ReadableStream<WorkflowStreamEvent>;
|
|
428
|
-
streamAsync({ inputData, requestContext, perStep, }?: {
|
|
429
|
-
inputData?: z.input<TInput>;
|
|
430
|
-
requestContext?: RequestContext;
|
|
431
|
-
perStep?: boolean;
|
|
432
|
-
}): Promise<ReturnType<typeof this.stream>>;
|
|
433
483
|
/**
|
|
434
484
|
* Starts the workflow execution with the provided input as a stream
|
|
435
485
|
* @param input The input data for the workflow
|
|
436
486
|
* @returns A promise that resolves to the workflow output
|
|
437
487
|
*/
|
|
438
|
-
stream({ inputData, requestContext, tracingContext, tracingOptions, closeOnSuspend, initialState, outputOptions, perStep, }
|
|
439
|
-
inputData?:
|
|
488
|
+
stream({ inputData, requestContext, tracingContext, tracingOptions, closeOnSuspend, initialState, outputOptions, perStep, }: (TInput extends unknown ? {
|
|
489
|
+
inputData?: TInput;
|
|
490
|
+
} : {
|
|
491
|
+
inputData: TInput;
|
|
492
|
+
}) & (TState extends unknown ? {
|
|
493
|
+
initialState?: TState;
|
|
494
|
+
} : {
|
|
495
|
+
initialState: TState;
|
|
496
|
+
}) & {
|
|
440
497
|
requestContext?: RequestContext;
|
|
441
498
|
tracingContext?: TracingContext;
|
|
442
499
|
tracingOptions?: TracingOptions;
|
|
443
500
|
closeOnSuspend?: boolean;
|
|
444
|
-
initialState?: z.input<TState>;
|
|
445
501
|
outputOptions?: {
|
|
446
502
|
includeState?: boolean;
|
|
447
503
|
includeResumeLabels?: boolean;
|
|
@@ -453,11 +509,11 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
453
509
|
* @param input The input data for the workflow
|
|
454
510
|
* @returns A promise that resolves to the workflow output
|
|
455
511
|
*/
|
|
456
|
-
resumeStream<
|
|
457
|
-
resumeData?:
|
|
458
|
-
step?: Step<string, any, any, any,
|
|
512
|
+
resumeStream<TResume>({ step, resumeData, requestContext, tracingContext, tracingOptions, forEachIndex, outputOptions, perStep, }?: {
|
|
513
|
+
resumeData?: TResume;
|
|
514
|
+
step?: Step<string, any, any, any, TResume, any, TEngineType> | [
|
|
459
515
|
...Step<string, any, any, any, any, any, TEngineType>[],
|
|
460
|
-
Step<string, any, any, any,
|
|
516
|
+
Step<string, any, any, any, TResume, any, TEngineType>
|
|
461
517
|
] | string | string[];
|
|
462
518
|
requestContext?: RequestContext;
|
|
463
519
|
tracingContext?: TracingContext;
|
|
@@ -477,11 +533,11 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
477
533
|
* @internal
|
|
478
534
|
*/
|
|
479
535
|
watchAsync(cb: (event: WorkflowStreamEvent) => void): Promise<() => void>;
|
|
480
|
-
resume<
|
|
481
|
-
resumeData?:
|
|
482
|
-
step?: Step<string, any, any, any,
|
|
536
|
+
resume<TResume>(params: {
|
|
537
|
+
resumeData?: TResume;
|
|
538
|
+
step?: Step<string, any, any, any, TResume, any, TEngineType> | [
|
|
483
539
|
...Step<string, any, any, any, any, any, TEngineType>[],
|
|
484
|
-
Step<string, any, any, any,
|
|
540
|
+
Step<string, any, any, any, TResume, any, TEngineType>
|
|
485
541
|
] | string | string[];
|
|
486
542
|
label?: string;
|
|
487
543
|
requestContext?: RequestContext;
|
|
@@ -506,11 +562,11 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
506
562
|
tracingContext?: TracingContext;
|
|
507
563
|
tracingOptions?: TracingOptions;
|
|
508
564
|
}): Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>;
|
|
509
|
-
protected _resume<
|
|
510
|
-
resumeData?:
|
|
511
|
-
step?: Step<string, any, any,
|
|
565
|
+
protected _resume<TResume>(params: {
|
|
566
|
+
resumeData?: TResume;
|
|
567
|
+
step?: Step<string, any, any, TResume, any, any, TEngineType> | [
|
|
512
568
|
...Step<string, any, any, any, any, any, TEngineType>[],
|
|
513
|
-
Step<string, any, any,
|
|
569
|
+
Step<string, any, any, TResume, any, any, TEngineType>
|
|
514
570
|
] | string | string[];
|
|
515
571
|
label?: string;
|
|
516
572
|
requestContext?: RequestContext;
|
|
@@ -533,14 +589,11 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
533
589
|
tracingContext?: TracingContext;
|
|
534
590
|
tracingOptions?: TracingOptions;
|
|
535
591
|
}): Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>;
|
|
536
|
-
protected _timeTravel<
|
|
537
|
-
inputData?:
|
|
592
|
+
protected _timeTravel<TInput>({ inputData, resumeData, initialState, step: stepParam, context, nestedStepsContext, requestContext, outputWriter, tracingContext, tracingOptions, outputOptions, perStep, }: {
|
|
593
|
+
inputData?: TInput;
|
|
538
594
|
resumeData?: any;
|
|
539
|
-
initialState?:
|
|
540
|
-
step: Step<string, any,
|
|
541
|
-
...Step<string, any, any, any, any, any, TEngineType>[],
|
|
542
|
-
Step<string, any, TInputSchema, any, any, any, TEngineType>
|
|
543
|
-
] | string | string[];
|
|
595
|
+
initialState?: TState;
|
|
596
|
+
step: Step<string, any, TInput, any, any, any, TEngineType> | [...Step<string, any, any, any, any, any, TEngineType>[], Step<string, any, TInput, any, any, any, TEngineType>] | string | string[];
|
|
544
597
|
context?: TimeTravelContext<any, any, any, any>;
|
|
545
598
|
nestedStepsContext?: Record<string, TimeTravelContext<any, any, any, any>>;
|
|
546
599
|
requestContext?: RequestContext;
|
|
@@ -553,14 +606,11 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
553
606
|
};
|
|
554
607
|
perStep?: boolean;
|
|
555
608
|
}): Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>;
|
|
556
|
-
timeTravel<
|
|
557
|
-
inputData?:
|
|
609
|
+
timeTravel<TInput>(args: {
|
|
610
|
+
inputData?: TInput;
|
|
558
611
|
resumeData?: any;
|
|
559
|
-
initialState?:
|
|
560
|
-
step: Step<string, any,
|
|
561
|
-
...Step<string, any, any, any, any, any, TEngineType>[],
|
|
562
|
-
Step<string, any, TInputSchema, any, any, any, TEngineType>
|
|
563
|
-
] | string | string[];
|
|
612
|
+
initialState?: TState;
|
|
613
|
+
step: Step<string, any, TInput, any, any, any, TEngineType> | [...Step<string, any, any, any, any, any, TEngineType>[], Step<string, any, TInput, any, any, any, TEngineType>] | string | string[];
|
|
564
614
|
context?: TimeTravelContext<any, any, any, any>;
|
|
565
615
|
nestedStepsContext?: Record<string, TimeTravelContext<any, any, any, any>>;
|
|
566
616
|
requestContext?: RequestContext;
|
|
@@ -573,14 +623,11 @@ export declare class Run<TEngineType = any, TSteps extends Step<string, any, any
|
|
|
573
623
|
};
|
|
574
624
|
perStep?: boolean;
|
|
575
625
|
}): Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>;
|
|
576
|
-
timeTravelStream<
|
|
577
|
-
inputData?:
|
|
578
|
-
initialState?:
|
|
626
|
+
timeTravelStream<TTravelInput>({ inputData, resumeData, initialState, step, context, nestedStepsContext, requestContext, tracingContext, tracingOptions, outputOptions, perStep, }: {
|
|
627
|
+
inputData?: TTravelInput;
|
|
628
|
+
initialState?: TState;
|
|
579
629
|
resumeData?: any;
|
|
580
|
-
step: Step<string, any,
|
|
581
|
-
...Step<string, any, any, any, any, any, TEngineType>[],
|
|
582
|
-
Step<string, any, TInputSchema, any, any, any, TEngineType>
|
|
583
|
-
] | string | string[];
|
|
630
|
+
step: Step<string, any, any, any, any, any, TEngineType> | [...Step<string, any, any, any, any, any, TEngineType>[], Step<string, any, any, any, any, any, TEngineType>] | string | string[];
|
|
584
631
|
context?: TimeTravelContext<any, any, any, any>;
|
|
585
632
|
nestedStepsContext?: Record<string, TimeTravelContext<any, any, any, any>>;
|
|
586
633
|
requestContext?: RequestContext;
|