@mastra/core 1.0.0-beta.11 → 1.0.0-beta.13
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 +173 -0
- package/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +7549 -0
- package/dist/_types/@internal_ai-sdk-v4/dist/test.d.ts +65 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +8396 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/test.d.ts +1708 -0
- package/dist/_types/@internal_external-types/dist/index.d.ts +858 -0
- package/dist/agent/agent-legacy.d.ts +1 -1
- package/dist/agent/agent.d.ts +1 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.types.d.ts +5 -1
- package/dist/agent/agent.types.d.ts.map +1 -1
- package/dist/agent/index.cjs +9 -9
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/index.cjs +3 -3
- package/dist/agent/message-list/index.d.ts +4 -3
- package/dist/agent/message-list/index.d.ts.map +1 -1
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/prompt/attachments-to-parts.d.ts +1 -1
- package/dist/agent/message-list/prompt/invalid-content-error.d.ts +1 -1
- package/dist/agent/message-list/types.d.ts +3 -3
- package/dist/agent/message-list/types.d.ts.map +1 -1
- package/dist/agent/message-list/utils/ai-v4-v5/core-model-message.d.ts +1 -1
- package/dist/agent/message-list/utils/ai-v4-v5/ui-message.d.ts +1 -1
- package/dist/agent/message-list/utils/ai-v5/gemini-compatibility.d.ts +2 -2
- package/dist/agent/message-list/utils/ai-v5/gemini-compatibility.d.ts.map +1 -1
- package/dist/agent/message-list/utils/convert-messages.d.ts +2 -2
- package/dist/agent/message-list/utils/convert-messages.d.ts.map +1 -1
- package/dist/agent/types.d.ts +3 -3
- package/dist/agent/utils.d.ts +3 -3
- package/dist/agent/utils.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts +2 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts +3 -1
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
- package/dist/bundler/types.d.ts +14 -1
- package/dist/bundler/types.d.ts.map +1 -1
- package/dist/{chunk-U3XOLEPX.js → chunk-2IU4RGU5.js} +6 -32
- package/dist/chunk-2IU4RGU5.js.map +1 -0
- package/dist/chunk-2SQB3WBT.js +4574 -0
- package/dist/chunk-2SQB3WBT.js.map +1 -0
- package/dist/{chunk-THZTRBFS.js → chunk-373OC54J.js} +8 -8
- package/dist/chunk-373OC54J.js.map +1 -0
- package/dist/{chunk-F2GAJSBI.js → chunk-4BC5FUAO.js} +8 -6
- package/dist/{chunk-F2GAJSBI.js.map → chunk-4BC5FUAO.js.map} +1 -1
- package/dist/chunk-55VPMN3N.js +250 -0
- package/dist/chunk-55VPMN3N.js.map +1 -0
- package/dist/{chunk-QM5SRDJX.js → chunk-5PTZG26U.js} +66 -84
- package/dist/chunk-5PTZG26U.js.map +1 -0
- package/dist/chunk-5VZGJTPR.js +4837 -0
- package/dist/chunk-5VZGJTPR.js.map +1 -0
- package/dist/{chunk-C36YRTZ6.js → chunk-62Q7K656.js} +6 -7
- package/dist/chunk-62Q7K656.js.map +1 -0
- package/dist/chunk-6PMMP3FR.js +7 -0
- package/dist/chunk-6PMMP3FR.js.map +1 -0
- package/dist/{chunk-DZUJEN5N.cjs → chunk-6SZKM6EC.cjs} +10 -3
- package/dist/{chunk-DZUJEN5N.cjs.map → chunk-6SZKM6EC.cjs.map} +1 -1
- package/dist/{chunk-5WRI5ZAA.js → chunk-7D4SUZUM.js} +10 -4
- package/dist/{chunk-5WRI5ZAA.js.map → chunk-7D4SUZUM.js.map} +1 -1
- package/dist/{chunk-YWMMBIOM.cjs → chunk-7HEAVZRS.cjs} +15 -15
- package/dist/{chunk-YWMMBIOM.cjs.map → chunk-7HEAVZRS.cjs.map} +1 -1
- package/dist/{chunk-BUKY6CTR.cjs → chunk-AGHLXC4I.cjs} +106 -36
- package/dist/chunk-AGHLXC4I.cjs.map +1 -0
- package/dist/{chunk-PK2A5WBG.js → chunk-ARAQIW6E.js} +222 -604
- package/dist/chunk-ARAQIW6E.js.map +1 -0
- package/dist/{chunk-US2U7ECW.js → chunk-BQDZIQ3G.js} +156 -90
- package/dist/chunk-BQDZIQ3G.js.map +1 -0
- package/dist/chunk-D22XABFZ.js +79 -0
- package/dist/chunk-D22XABFZ.js.map +1 -0
- package/dist/{chunk-2ULLRN4Y.js → chunk-E5BQRAJK.js} +943 -626
- package/dist/chunk-E5BQRAJK.js.map +1 -0
- package/dist/chunk-FST2G2FQ.cjs +84 -0
- package/dist/chunk-FST2G2FQ.cjs.map +1 -0
- package/dist/chunk-FVQTJUBD.cjs +2120 -0
- package/dist/chunk-FVQTJUBD.cjs.map +1 -0
- package/dist/chunk-G6E6V2Z4.js +2070 -0
- package/dist/chunk-G6E6V2Z4.js.map +1 -0
- package/dist/{chunk-7P6BNIJH.js → chunk-GIWC35YQ.js} +105 -35
- package/dist/chunk-GIWC35YQ.js.map +1 -0
- package/dist/{chunk-4JKEUSCC.cjs → chunk-H4VUIOWU.cjs} +22 -20
- package/dist/chunk-H4VUIOWU.cjs.map +1 -0
- package/dist/{chunk-TWH4PTDG.cjs → chunk-HWMMIRIF.cjs} +32 -27
- package/dist/chunk-HWMMIRIF.cjs.map +1 -0
- package/dist/chunk-IXZ2T2QX.cjs +448 -0
- package/dist/chunk-IXZ2T2QX.cjs.map +1 -0
- package/dist/chunk-L3NKIMF5.cjs +10 -0
- package/dist/chunk-L3NKIMF5.cjs.map +1 -0
- package/dist/chunk-L4JCRWDY.cjs +252 -0
- package/dist/chunk-L4JCRWDY.cjs.map +1 -0
- package/dist/{chunk-BJXKH4LG.cjs → chunk-LGB4VNZI.cjs} +43 -78
- package/dist/chunk-LGB4VNZI.cjs.map +1 -0
- package/dist/{chunk-PG5H6QIO.cjs → chunk-MLKE7HRS.cjs} +41 -21
- package/dist/chunk-MLKE7HRS.cjs.map +1 -0
- package/dist/{chunk-OEIVMCWX.js → chunk-MRRFTNF4.js} +2537 -84
- package/dist/chunk-MRRFTNF4.js.map +1 -0
- package/dist/chunk-MXBVP7HX.cjs +4842 -0
- package/dist/chunk-MXBVP7HX.cjs.map +1 -0
- package/dist/chunk-NESKUIRE.cjs +4586 -0
- package/dist/chunk-NESKUIRE.cjs.map +1 -0
- package/dist/{chunk-SVLMF4UZ.cjs → chunk-NIOEY3N3.cjs} +66 -85
- package/dist/chunk-NIOEY3N3.cjs.map +1 -0
- package/dist/{chunk-CZEJQSWB.cjs → chunk-OWIEOL55.cjs} +295 -677
- package/dist/chunk-OWIEOL55.cjs.map +1 -0
- package/dist/{chunk-WTSZBHIZ.cjs → chunk-PJAK4U6R.cjs} +24 -24
- package/dist/{chunk-WTSZBHIZ.cjs.map → chunk-PJAK4U6R.cjs.map} +1 -1
- package/dist/{chunk-52RSUALV.cjs → chunk-R5AJGM55.cjs} +1314 -995
- package/dist/chunk-R5AJGM55.cjs.map +1 -0
- package/dist/{chunk-IVV5TOMD.js → chunk-RCJLMMTO.js} +32 -12
- package/dist/chunk-RCJLMMTO.js.map +1 -0
- package/dist/{chunk-S73Z3PBJ.cjs → chunk-SZYSDJTN.cjs} +27 -28
- package/dist/chunk-SZYSDJTN.cjs.map +1 -0
- package/dist/{chunk-YC6PJEPH.cjs → chunk-U4CSOY6T.cjs} +188 -122
- package/dist/chunk-U4CSOY6T.cjs.map +1 -0
- package/dist/chunk-UBSPZTQX.js +434 -0
- package/dist/chunk-UBSPZTQX.js.map +1 -0
- package/dist/{chunk-SCUWP4II.cjs → chunk-VEPP75C4.cjs} +47 -74
- package/dist/chunk-VEPP75C4.cjs.map +1 -0
- package/dist/{chunk-JIGDJK2O.js → chunk-VETAQUW3.js} +4 -39
- package/dist/chunk-VETAQUW3.js.map +1 -0
- package/dist/{chunk-Z57R5WS4.js → chunk-WPTTKULS.js} +4 -4
- package/dist/{chunk-Z57R5WS4.js.map → chunk-WPTTKULS.js.map} +1 -1
- package/dist/{chunk-O2BJW7YA.js → chunk-WYGUWVTF.js} +5 -5
- package/dist/{chunk-O2BJW7YA.js.map → chunk-WYGUWVTF.js.map} +1 -1
- package/dist/{chunk-SXNQRJQD.js → chunk-WYWRMIQC.js} +127 -22
- package/dist/chunk-WYWRMIQC.js.map +1 -0
- package/dist/{chunk-5Q6WAYEY.cjs → chunk-X6IBA7FP.cjs} +137 -50
- package/dist/chunk-X6IBA7FP.cjs.map +1 -0
- package/dist/{chunk-MRFUISXC.cjs → chunk-Y7MZ5LJT.cjs} +2632 -179
- package/dist/chunk-Y7MZ5LJT.cjs.map +1 -0
- package/dist/{chunk-JJ5O45LH.js → chunk-YPLZDWG7.js} +32 -27
- package/dist/chunk-YPLZDWG7.js.map +1 -0
- package/dist/{chunk-MGCGWPQJ.cjs → chunk-Z55SJVEC.cjs} +8 -8
- package/dist/chunk-Z55SJVEC.cjs.map +1 -0
- package/dist/error/index.cjs +6 -6
- package/dist/error/index.d.ts +26 -20
- package/dist/error/index.d.ts.map +1 -1
- package/dist/error/index.js +1 -1
- package/dist/error/utils.d.ts +19 -5
- package/dist/error/utils.d.ts.map +1 -1
- package/dist/evals/index.cjs +4 -4
- package/dist/evals/index.js +1 -1
- package/dist/evals/run/index.d.ts +1 -1
- package/dist/evals/scoreTraces/index.cjs +8 -8
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/evals/types.d.ts +1 -1
- package/dist/events/event-emitter.d.ts +6 -1
- package/dist/events/event-emitter.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 +15 -15
- package/dist/llm/index.d.ts +2 -2
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +5 -5
- package/dist/llm/model/aisdk/v5/model.d.ts +1 -1
- package/dist/llm/model/base.types.d.ts +2 -2
- package/dist/llm/model/model.d.ts +1 -1
- package/dist/llm/model/model.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts +2 -2
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/model.loop.types.d.ts +1 -1
- package/dist/llm/model/model.loop.types.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +51 -11
- package/dist/llm/model/shared.types.d.ts +1 -1
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/loop.d.ts +2 -2
- package/dist/loop/loop.d.ts.map +1 -1
- package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts +1 -1
- package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts.map +1 -1
- package/dist/loop/test-utils/options.d.ts.map +1 -1
- package/dist/loop/test-utils/streamObject.d.ts +1 -1
- package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
- package/dist/loop/test-utils/tools.d.ts.map +1 -1
- package/dist/loop/types.d.ts +3 -1
- package/dist/loop/types.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +13 -13
- package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +10 -10
- 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 +5 -5
- 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 +22 -21
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts +13 -13
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
- package/dist/loop/workflows/schema.d.ts +6 -6
- package/dist/loop/workflows/schema.d.ts.map +1 -1
- package/dist/loop/workflows/stream.d.ts +2 -2
- package/dist/loop/workflows/stream.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +4 -4
- package/dist/mcp/index.js +1 -1
- package/dist/memory/index.cjs +6 -6
- package/dist/memory/index.js +1 -1
- package/dist/memory/memory.d.ts +1 -1
- package/dist/memory/types.d.ts +3 -3
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/models-dev-D3EKFGAO.cjs +12 -0
- package/dist/{models-dev-EO3SUIY2.cjs.map → models-dev-D3EKFGAO.cjs.map} +1 -1
- package/dist/models-dev-EO22XOXQ.js +3 -0
- package/dist/{models-dev-23RN2WHG.js.map → models-dev-EO22XOXQ.js.map} +1 -1
- package/dist/netlify-AE4LNCAI.js +3 -0
- package/dist/{netlify-GXJ5D5DD.js.map → netlify-AE4LNCAI.js.map} +1 -1
- package/dist/netlify-WE42TZIT.cjs +12 -0
- package/dist/{netlify-KJLY3GFS.cjs.map → netlify-WE42TZIT.cjs.map} +1 -1
- package/dist/processors/index.cjs +37 -37
- package/dist/processors/index.d.ts +2 -2
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/step-schema.d.ts +1267 -1267
- package/dist/processors/step-schema.d.ts.map +1 -1
- package/dist/provider-registry-6LF3NGC5.js +3 -0
- package/dist/{provider-registry-F67Y6OF2.js.map → provider-registry-6LF3NGC5.js.map} +1 -1
- package/dist/provider-registry-73FKMXJV.cjs +40 -0
- package/dist/{provider-registry-3TG2KUD2.cjs.map → provider-registry-73FKMXJV.cjs.map} +1 -1
- package/dist/provider-registry.json +100 -30
- package/dist/{registry-generator-UMTNPBJX.js → registry-generator-AVQXI3GX.js} +2 -2
- package/dist/{registry-generator-UMTNPBJX.js.map → registry-generator-AVQXI3GX.js.map} +1 -1
- package/dist/{registry-generator-34SC4TAU.cjs → registry-generator-KOFNIIWJ.cjs} +2 -2
- package/dist/{registry-generator-34SC4TAU.cjs.map → registry-generator-KOFNIIWJ.cjs.map} +1 -1
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +5 -5
- package/dist/server/index.js +1 -1
- package/dist/storage/base.d.ts +2 -10
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/domains/workflows/base.d.ts +2 -8
- package/dist/storage/domains/workflows/base.d.ts.map +1 -1
- package/dist/storage/domains/workflows/inmemory.d.ts +2 -8
- package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
- package/dist/storage/index.cjs +38 -38
- package/dist/storage/index.js +1 -1
- package/dist/storage/mock.d.ts +2 -8
- package/dist/storage/mock.d.ts.map +1 -1
- package/dist/storage/types.d.ts +9 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/RunOutput.d.ts +1 -1
- package/dist/stream/aisdk/v4/input.d.ts +1 -1
- package/dist/stream/aisdk/v5/compat/content.d.ts +1 -1
- package/dist/stream/aisdk/v5/compat/content.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts +1 -1
- package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/compat/ui-message.d.ts +1 -1
- package/dist/stream/aisdk/v5/compat/ui-message.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/compat/validation.d.ts +1 -1
- package/dist/stream/aisdk/v5/compat/validation.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/execute.d.ts +2 -2
- package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/input.d.ts +1 -1
- package/dist/stream/aisdk/v5/input.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/output-helpers.d.ts +12 -27
- package/dist/stream/aisdk/v5/output-helpers.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/output.d.ts +41 -91
- package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/transform.d.ts +1 -1
- package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
- package/dist/stream/base/input.d.ts +1 -1
- package/dist/stream/base/output.d.ts +9 -31
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/base/schema.d.ts +2 -2
- package/dist/stream/base/schema.d.ts.map +1 -1
- package/dist/stream/index.cjs +12 -12
- package/dist/stream/index.js +2 -2
- package/dist/stream/types.d.ts +3 -2
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.cjs +14587 -14
- package/dist/test-utils/llm-mock.cjs.map +1 -1
- package/dist/test-utils/llm-mock.d.ts +3 -3
- package/dist/test-utils/llm-mock.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.js +14577 -4
- package/dist/test-utils/llm-mock.js.map +1 -1
- package/dist/token-6GSAFR2W-SGVIXFCP.cjs +63 -0
- package/dist/token-6GSAFR2W-SGVIXFCP.cjs.map +1 -0
- package/dist/token-6GSAFR2W-SPYPLMBM.js +61 -0
- package/dist/token-6GSAFR2W-SPYPLMBM.js.map +1 -0
- package/dist/token-util-NEHG7TUY-7GMW5FXI.cjs +10 -0
- package/dist/token-util-NEHG7TUY-7GMW5FXI.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-JRJTGTAB.js +8 -0
- package/dist/token-util-NEHG7TUY-JRJTGTAB.js.map +1 -0
- 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 +2 -1
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +5 -5
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils.cjs +22 -22
- package/dist/utils.d.ts +3 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/vector/embed.d.ts +2 -2
- package/dist/vector/embed.d.ts.map +1 -1
- package/dist/vector/index.cjs +11 -11
- package/dist/vector/index.js +3 -3
- package/dist/vector/vector.d.ts +1 -1
- package/dist/voice/aisdk/speech.d.ts +1 -1
- package/dist/voice/aisdk/speech.d.ts.map +1 -1
- package/dist/voice/aisdk/transcription.d.ts +1 -1
- package/dist/voice/aisdk/transcription.d.ts.map +1 -1
- package/dist/voice/composite-voice.d.ts +1 -1
- package/dist/voice/composite-voice.d.ts.map +1 -1
- package/dist/voice/index.cjs +6 -6
- package/dist/voice/index.js +1 -1
- package/dist/workflows/constants.cjs +4 -4
- package/dist/workflows/constants.d.ts +1 -1
- package/dist/workflows/constants.d.ts.map +1 -1
- package/dist/workflows/constants.js +1 -1
- package/dist/workflows/default.d.ts +9 -16
- package/dist/workflows/default.d.ts.map +1 -1
- package/dist/workflows/evented/execution-engine.d.ts +3 -2
- package/dist/workflows/evented/execution-engine.d.ts.map +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/step-executor.d.ts +1 -1
- package/dist/workflows/evented/step-executor.d.ts.map +1 -1
- package/dist/workflows/evented/workflow-event-processor/index.d.ts +1 -1
- package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
- package/dist/workflows/evented/workflow.d.ts +15 -0
- package/dist/workflows/evented/workflow.d.ts.map +1 -1
- package/dist/workflows/execution-engine.d.ts +25 -2
- package/dist/workflows/execution-engine.d.ts.map +1 -1
- package/dist/workflows/handlers/control-flow.d.ts +6 -5
- package/dist/workflows/handlers/control-flow.d.ts.map +1 -1
- package/dist/workflows/handlers/entry.d.ts +5 -3
- package/dist/workflows/handlers/entry.d.ts.map +1 -1
- package/dist/workflows/handlers/sleep.d.ts +4 -3
- package/dist/workflows/handlers/sleep.d.ts.map +1 -1
- package/dist/workflows/handlers/step.d.ts +5 -3
- package/dist/workflows/handlers/step.d.ts.map +1 -1
- package/dist/workflows/index.cjs +26 -22
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/step.d.ts +5 -4
- package/dist/workflows/step.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +66 -14
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/utils.d.ts +11 -0
- package/dist/workflows/utils.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +26 -8
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +12 -11
- package/src/llm/model/provider-types.generated.d.ts +51 -11
- package/dist/agent/__tests__/mock-model.d.ts +0 -8
- package/dist/agent/__tests__/mock-model.d.ts.map +0 -1
- package/dist/agent/agent-types.test-d.d.ts +0 -2
- package/dist/agent/agent-types.test-d.d.ts.map +0 -1
- package/dist/ai-sdk.types.d.ts +0 -4705
- package/dist/chunk-2ULLRN4Y.js.map +0 -1
- package/dist/chunk-3E3ILV6T.cjs +0 -518
- package/dist/chunk-3E3ILV6T.cjs.map +0 -1
- package/dist/chunk-4JKEUSCC.cjs.map +0 -1
- package/dist/chunk-52RSUALV.cjs.map +0 -1
- package/dist/chunk-5PAEYE3Q.js +0 -513
- package/dist/chunk-5PAEYE3Q.js.map +0 -1
- package/dist/chunk-5Q6WAYEY.cjs.map +0 -1
- package/dist/chunk-7P6BNIJH.js.map +0 -1
- package/dist/chunk-ABJOUEVA.cjs +0 -10
- package/dist/chunk-ABJOUEVA.cjs.map +0 -1
- package/dist/chunk-BJXKH4LG.cjs.map +0 -1
- package/dist/chunk-BUKY6CTR.cjs.map +0 -1
- package/dist/chunk-C36YRTZ6.js.map +0 -1
- package/dist/chunk-CZEJQSWB.cjs.map +0 -1
- package/dist/chunk-IVV5TOMD.js.map +0 -1
- package/dist/chunk-JIGDJK2O.js.map +0 -1
- package/dist/chunk-JJ5O45LH.js.map +0 -1
- package/dist/chunk-MGCGWPQJ.cjs.map +0 -1
- package/dist/chunk-MRFUISXC.cjs.map +0 -1
- package/dist/chunk-NLNKQD2T.js +0 -7
- package/dist/chunk-NLNKQD2T.js.map +0 -1
- package/dist/chunk-OEIVMCWX.js.map +0 -1
- package/dist/chunk-PG5H6QIO.cjs.map +0 -1
- package/dist/chunk-PK2A5WBG.js.map +0 -1
- package/dist/chunk-QM5SRDJX.js.map +0 -1
- package/dist/chunk-S73Z3PBJ.cjs.map +0 -1
- package/dist/chunk-SCUWP4II.cjs.map +0 -1
- package/dist/chunk-SVLMF4UZ.cjs.map +0 -1
- package/dist/chunk-SXNQRJQD.js.map +0 -1
- package/dist/chunk-THZTRBFS.js.map +0 -1
- package/dist/chunk-TWH4PTDG.cjs.map +0 -1
- package/dist/chunk-U3XOLEPX.js.map +0 -1
- package/dist/chunk-US2U7ECW.js.map +0 -1
- package/dist/chunk-YC6PJEPH.cjs.map +0 -1
- package/dist/models-dev-23RN2WHG.js +0 -3
- package/dist/models-dev-EO3SUIY2.cjs +0 -12
- package/dist/netlify-GXJ5D5DD.js +0 -3
- package/dist/netlify-KJLY3GFS.cjs +0 -12
- package/dist/provider-registry-3TG2KUD2.cjs +0 -40
- package/dist/provider-registry-F67Y6OF2.js +0 -3
- package/dist/tools/tool-stream-types.test-d.d.ts +0 -2
- package/dist/tools/tool-stream-types.test-d.d.ts.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var chunkMGCGWPQJ_cjs = require('./chunk-MGCGWPQJ.cjs');
|
|
3
|
+
var chunkR5AJGM55_cjs = require('./chunk-R5AJGM55.cjs');
|
|
4
|
+
var chunkL3NKIMF5_cjs = require('./chunk-L3NKIMF5.cjs');
|
|
5
|
+
var chunkZ55SJVEC_cjs = require('./chunk-Z55SJVEC.cjs');
|
|
7
6
|
var chunkUVHSM2GU_cjs = require('./chunk-UVHSM2GU.cjs');
|
|
7
|
+
var chunkHWMMIRIF_cjs = require('./chunk-HWMMIRIF.cjs');
|
|
8
8
|
var chunkDGV2FWB4_cjs = require('./chunk-DGV2FWB4.cjs');
|
|
9
9
|
var chunkAF74UXR5_cjs = require('./chunk-AF74UXR5.cjs');
|
|
10
10
|
var EventEmitter = require('events');
|
|
@@ -31,7 +31,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
31
31
|
let suspended;
|
|
32
32
|
let bailed;
|
|
33
33
|
const startedAt = Date.now();
|
|
34
|
-
const { inputData, validationError } = await
|
|
34
|
+
const { inputData, validationError } = await chunkR5AJGM55_cjs.validateStepInput({
|
|
35
35
|
prevOutput: typeof params.foreachIdx === "number" ? params.input?.[params.foreachIdx] : params.input,
|
|
36
36
|
step,
|
|
37
37
|
validateInputs: params.validateInputs ?? true
|
|
@@ -56,7 +56,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
56
56
|
throw validationError;
|
|
57
57
|
}
|
|
58
58
|
const stepResult = await step.execute(
|
|
59
|
-
|
|
59
|
+
chunkR5AJGM55_cjs.createDeprecationProxy(
|
|
60
60
|
{
|
|
61
61
|
workflowId: params.workflowId,
|
|
62
62
|
runId,
|
|
@@ -71,9 +71,9 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
71
71
|
resumeData: params.resumeData,
|
|
72
72
|
suspendData: suspendDataToUse,
|
|
73
73
|
getInitData: () => stepResults?.input,
|
|
74
|
-
getStepResult:
|
|
74
|
+
getStepResult: chunkR5AJGM55_cjs.getStepResult.bind(this, stepResults),
|
|
75
75
|
suspend: async (suspendPayload) => {
|
|
76
|
-
const { suspendData, validationError: validationError2 } = await
|
|
76
|
+
const { suspendData, validationError: validationError2 } = await chunkR5AJGM55_cjs.validateStepSuspendData({
|
|
77
77
|
suspendData: suspendPayload,
|
|
78
78
|
step,
|
|
79
79
|
validateInputs: params.validateInputs ?? true
|
|
@@ -91,9 +91,8 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
91
91
|
abort: () => {
|
|
92
92
|
abortController?.abort();
|
|
93
93
|
},
|
|
94
|
-
[
|
|
95
|
-
|
|
96
|
-
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: void 0,
|
|
94
|
+
[chunkL3NKIMF5_cjs.PUBSUB_SYMBOL]: this.mastra?.pubsub ?? new chunkR5AJGM55_cjs.EventEmitterPubSub(params.emitter),
|
|
95
|
+
[chunkL3NKIMF5_cjs.STREAM_FORMAT_SYMBOL]: void 0,
|
|
97
96
|
// TODO
|
|
98
97
|
engine: {},
|
|
99
98
|
abortSignal: abortController?.signal,
|
|
@@ -102,7 +101,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
102
101
|
},
|
|
103
102
|
{
|
|
104
103
|
paramName: "runCount",
|
|
105
|
-
deprecationMessage:
|
|
104
|
+
deprecationMessage: chunkR5AJGM55_cjs.runCountDeprecationMessage,
|
|
106
105
|
logger: this.logger
|
|
107
106
|
}
|
|
108
107
|
)
|
|
@@ -138,15 +137,15 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
138
137
|
return finalResult;
|
|
139
138
|
} catch (error) {
|
|
140
139
|
const endedAt = Date.now();
|
|
141
|
-
const errorInstance =
|
|
142
|
-
|
|
140
|
+
const errorInstance = chunkHWMMIRIF_cjs.getErrorFromUnknown(error, {
|
|
141
|
+
serializeStack: false,
|
|
143
142
|
fallbackMessage: "Unknown step execution error"
|
|
144
143
|
});
|
|
145
144
|
return {
|
|
146
145
|
...stepInfo,
|
|
147
146
|
status: "failed",
|
|
148
147
|
endedAt,
|
|
149
|
-
error:
|
|
148
|
+
error: errorInstance
|
|
150
149
|
};
|
|
151
150
|
}
|
|
152
151
|
}
|
|
@@ -200,7 +199,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
200
199
|
iterationCount
|
|
201
200
|
}) {
|
|
202
201
|
return condition(
|
|
203
|
-
|
|
202
|
+
chunkR5AJGM55_cjs.createDeprecationProxy(
|
|
204
203
|
{
|
|
205
204
|
workflowId,
|
|
206
205
|
runId,
|
|
@@ -211,7 +210,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
211
210
|
retryCount,
|
|
212
211
|
resumeData,
|
|
213
212
|
getInitData: () => stepResults?.input,
|
|
214
|
-
getStepResult:
|
|
213
|
+
getStepResult: chunkR5AJGM55_cjs.getStepResult.bind(this, stepResults),
|
|
215
214
|
bail: (_result) => {
|
|
216
215
|
throw new Error("Not implemented");
|
|
217
216
|
},
|
|
@@ -220,9 +219,8 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
220
219
|
abort: () => {
|
|
221
220
|
abortController?.abort();
|
|
222
221
|
},
|
|
223
|
-
[
|
|
224
|
-
|
|
225
|
-
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: void 0,
|
|
222
|
+
[chunkL3NKIMF5_cjs.PUBSUB_SYMBOL]: this.mastra?.pubsub ?? new chunkR5AJGM55_cjs.EventEmitterPubSub(emitter),
|
|
223
|
+
[chunkL3NKIMF5_cjs.STREAM_FORMAT_SYMBOL]: void 0,
|
|
226
224
|
// TODO
|
|
227
225
|
engine: {},
|
|
228
226
|
abortSignal: abortController?.signal,
|
|
@@ -232,7 +230,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
232
230
|
},
|
|
233
231
|
{
|
|
234
232
|
paramName: "runCount",
|
|
235
|
-
deprecationMessage:
|
|
233
|
+
deprecationMessage: chunkR5AJGM55_cjs.runCountDeprecationMessage,
|
|
236
234
|
logger: this.logger
|
|
237
235
|
}
|
|
238
236
|
)
|
|
@@ -250,7 +248,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
250
248
|
}
|
|
251
249
|
try {
|
|
252
250
|
return await step.fn(
|
|
253
|
-
|
|
251
|
+
chunkR5AJGM55_cjs.createDeprecationProxy(
|
|
254
252
|
{
|
|
255
253
|
workflowId: params.workflowId,
|
|
256
254
|
runId,
|
|
@@ -264,7 +262,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
264
262
|
retryCount,
|
|
265
263
|
resumeData: params.resumeData,
|
|
266
264
|
getInitData: () => stepResults?.input,
|
|
267
|
-
getStepResult:
|
|
265
|
+
getStepResult: chunkR5AJGM55_cjs.getStepResult.bind(this, stepResults),
|
|
268
266
|
suspend: async (_suspendPayload) => {
|
|
269
267
|
throw new Error("Not implemented");
|
|
270
268
|
},
|
|
@@ -276,9 +274,8 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
276
274
|
},
|
|
277
275
|
// TODO
|
|
278
276
|
writer: void 0,
|
|
279
|
-
[
|
|
280
|
-
|
|
281
|
-
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: void 0,
|
|
277
|
+
[chunkL3NKIMF5_cjs.PUBSUB_SYMBOL]: this.mastra?.pubsub ?? new chunkR5AJGM55_cjs.EventEmitterPubSub(ee),
|
|
278
|
+
[chunkL3NKIMF5_cjs.STREAM_FORMAT_SYMBOL]: void 0,
|
|
282
279
|
// TODO
|
|
283
280
|
engine: {},
|
|
284
281
|
abortSignal: abortController?.signal,
|
|
@@ -287,7 +284,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
287
284
|
},
|
|
288
285
|
{
|
|
289
286
|
paramName: "runCount",
|
|
290
|
-
deprecationMessage:
|
|
287
|
+
deprecationMessage: chunkR5AJGM55_cjs.runCountDeprecationMessage,
|
|
291
288
|
logger: this.logger
|
|
292
289
|
}
|
|
293
290
|
)
|
|
@@ -309,7 +306,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
309
306
|
}
|
|
310
307
|
try {
|
|
311
308
|
const result = await step.fn(
|
|
312
|
-
|
|
309
|
+
chunkR5AJGM55_cjs.createDeprecationProxy(
|
|
313
310
|
{
|
|
314
311
|
workflowId: params.workflowId,
|
|
315
312
|
runId,
|
|
@@ -323,7 +320,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
323
320
|
retryCount,
|
|
324
321
|
resumeData: params.resumeData,
|
|
325
322
|
getInitData: () => stepResults?.input,
|
|
326
|
-
getStepResult:
|
|
323
|
+
getStepResult: chunkR5AJGM55_cjs.getStepResult.bind(this, stepResults),
|
|
327
324
|
suspend: async (_suspendPayload) => {
|
|
328
325
|
throw new Error("Not implemented");
|
|
329
326
|
},
|
|
@@ -335,9 +332,8 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
335
332
|
},
|
|
336
333
|
// TODO
|
|
337
334
|
writer: void 0,
|
|
338
|
-
[
|
|
339
|
-
|
|
340
|
-
[chunkABJOUEVA_cjs.STREAM_FORMAT_SYMBOL]: void 0,
|
|
335
|
+
[chunkL3NKIMF5_cjs.PUBSUB_SYMBOL]: this.mastra?.pubsub ?? new chunkR5AJGM55_cjs.EventEmitterPubSub(ee),
|
|
336
|
+
[chunkL3NKIMF5_cjs.STREAM_FORMAT_SYMBOL]: void 0,
|
|
341
337
|
// TODO
|
|
342
338
|
engine: {},
|
|
343
339
|
abortSignal: abortController?.signal,
|
|
@@ -346,7 +342,7 @@ var StepExecutor = class extends chunkDGV2FWB4_cjs.MastraBase {
|
|
|
346
342
|
},
|
|
347
343
|
{
|
|
348
344
|
paramName: "runCount",
|
|
349
|
-
deprecationMessage:
|
|
345
|
+
deprecationMessage: chunkR5AJGM55_cjs.runCountDeprecationMessage,
|
|
350
346
|
logger: this.logger
|
|
351
347
|
}
|
|
352
348
|
)
|
|
@@ -958,7 +954,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
958
954
|
executionPath: [],
|
|
959
955
|
resumeSteps,
|
|
960
956
|
stepResults,
|
|
961
|
-
prevResult: { status: "failed", error:
|
|
957
|
+
prevResult: { status: "failed", error: chunkHWMMIRIF_cjs.getErrorFromUnknown(e).toJSON() },
|
|
962
958
|
requestContext,
|
|
963
959
|
resumeData,
|
|
964
960
|
activeSteps: {},
|
|
@@ -967,26 +963,27 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
967
963
|
});
|
|
968
964
|
}
|
|
969
965
|
async processWorkflowCancel({ workflowId, runId }) {
|
|
970
|
-
const
|
|
966
|
+
const storage = this.mastra.getStorage();
|
|
967
|
+
const currentState = await storage?.loadWorkflowSnapshot({
|
|
971
968
|
workflowName: workflowId,
|
|
972
|
-
runId
|
|
973
|
-
opts: {
|
|
974
|
-
status: "canceled"
|
|
975
|
-
}
|
|
976
|
-
});
|
|
977
|
-
await this.endWorkflow({
|
|
978
|
-
workflow: void 0,
|
|
979
|
-
workflowId,
|
|
980
|
-
runId,
|
|
981
|
-
stepResults: currentState?.context,
|
|
982
|
-
prevResult: { status: "canceled" },
|
|
983
|
-
requestContext: currentState?.requestContext,
|
|
984
|
-
executionPath: [],
|
|
985
|
-
activeSteps: {},
|
|
986
|
-
resumeSteps: [],
|
|
987
|
-
resumeData: void 0,
|
|
988
|
-
parentWorkflow: void 0
|
|
969
|
+
runId
|
|
989
970
|
});
|
|
971
|
+
await this.endWorkflow(
|
|
972
|
+
{
|
|
973
|
+
workflow: void 0,
|
|
974
|
+
workflowId,
|
|
975
|
+
runId,
|
|
976
|
+
stepResults: currentState?.context ?? {},
|
|
977
|
+
prevResult: { status: "canceled" },
|
|
978
|
+
requestContext: currentState?.requestContext ?? {},
|
|
979
|
+
executionPath: [],
|
|
980
|
+
activeSteps: {},
|
|
981
|
+
resumeSteps: [],
|
|
982
|
+
resumeData: void 0,
|
|
983
|
+
parentWorkflow: void 0
|
|
984
|
+
},
|
|
985
|
+
"canceled"
|
|
986
|
+
);
|
|
990
987
|
}
|
|
991
988
|
async processWorkflowStart({
|
|
992
989
|
workflow,
|
|
@@ -1001,9 +998,12 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1001
998
|
stepResults,
|
|
1002
999
|
requestContext
|
|
1003
1000
|
}) {
|
|
1001
|
+
const existingRun = await this.mastra.getStorage()?.getWorkflowRunById({ runId, workflowName: workflow.id });
|
|
1002
|
+
const resourceId = existingRun?.resourceId;
|
|
1004
1003
|
await this.mastra.getStorage()?.persistWorkflowSnapshot({
|
|
1005
1004
|
workflowName: workflow.id,
|
|
1006
1005
|
runId,
|
|
1006
|
+
resourceId,
|
|
1007
1007
|
snapshot: {
|
|
1008
1008
|
activePaths: [],
|
|
1009
1009
|
suspendedPaths: {},
|
|
@@ -1040,13 +1040,13 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1040
1040
|
}
|
|
1041
1041
|
});
|
|
1042
1042
|
}
|
|
1043
|
-
async endWorkflow(args) {
|
|
1043
|
+
async endWorkflow(args, status = "success") {
|
|
1044
1044
|
const { workflowId, runId, prevResult } = args;
|
|
1045
1045
|
await this.mastra.getStorage()?.updateWorkflowState({
|
|
1046
1046
|
workflowName: workflowId,
|
|
1047
1047
|
runId,
|
|
1048
1048
|
opts: {
|
|
1049
|
-
status
|
|
1049
|
+
status,
|
|
1050
1050
|
result: prevResult
|
|
1051
1051
|
}
|
|
1052
1052
|
});
|
|
@@ -1207,7 +1207,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1207
1207
|
parentWorkflow,
|
|
1208
1208
|
requestContext
|
|
1209
1209
|
},
|
|
1210
|
-
new
|
|
1210
|
+
new chunkHWMMIRIF_cjs.MastraError({
|
|
1211
1211
|
id: "MASTRA_WORKFLOW",
|
|
1212
1212
|
text: `Execution path is empty: ${JSON.stringify(executionPath)}`,
|
|
1213
1213
|
domain: "MASTRA_WORKFLOW" /* MASTRA_WORKFLOW */,
|
|
@@ -1230,7 +1230,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1230
1230
|
parentWorkflow,
|
|
1231
1231
|
requestContext
|
|
1232
1232
|
},
|
|
1233
|
-
new
|
|
1233
|
+
new chunkHWMMIRIF_cjs.MastraError({
|
|
1234
1234
|
id: "MASTRA_WORKFLOW",
|
|
1235
1235
|
text: `Step not found in step graph: ${JSON.stringify(executionPath)}`,
|
|
1236
1236
|
domain: "MASTRA_WORKFLOW" /* MASTRA_WORKFLOW */,
|
|
@@ -1359,7 +1359,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1359
1359
|
parentWorkflow,
|
|
1360
1360
|
requestContext
|
|
1361
1361
|
},
|
|
1362
|
-
new
|
|
1362
|
+
new chunkHWMMIRIF_cjs.MastraError({
|
|
1363
1363
|
id: "MASTRA_WORKFLOW",
|
|
1364
1364
|
text: `Step is not executable: ${step?.type} -- ${JSON.stringify(executionPath)}`,
|
|
1365
1365
|
domain: "MASTRA_WORKFLOW" /* MASTRA_WORKFLOW */,
|
|
@@ -1386,7 +1386,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1386
1386
|
parentWorkflow,
|
|
1387
1387
|
requestContext
|
|
1388
1388
|
},
|
|
1389
|
-
new
|
|
1389
|
+
new chunkHWMMIRIF_cjs.MastraError({
|
|
1390
1390
|
id: "MASTRA_WORKFLOW",
|
|
1391
1391
|
text: `Nested workflow run id not found: ${JSON.stringify(stepResults)}`,
|
|
1392
1392
|
domain: "MASTRA_WORKFLOW" /* MASTRA_WORKFLOW */,
|
|
@@ -1430,7 +1430,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1430
1430
|
workflowName: step.step.id,
|
|
1431
1431
|
runId
|
|
1432
1432
|
}) ?? { context: {} };
|
|
1433
|
-
const timeTravelParams =
|
|
1433
|
+
const timeTravelParams = chunkR5AJGM55_cjs.createTimeTravelExecutionParams({
|
|
1434
1434
|
steps: timeTravel.steps.slice(1),
|
|
1435
1435
|
inputData: timeTravel.inputData,
|
|
1436
1436
|
resumeData: timeTravel.resumeData,
|
|
@@ -1521,7 +1521,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1521
1521
|
for (const [key, value] of Object.entries(requestContext)) {
|
|
1522
1522
|
rc.set(key, value);
|
|
1523
1523
|
}
|
|
1524
|
-
const { resumeData: timeTravelResumeData, validationError: timeTravelResumeValidationError } = await
|
|
1524
|
+
const { resumeData: timeTravelResumeData, validationError: timeTravelResumeValidationError } = await chunkR5AJGM55_cjs.validateStepResumeData({
|
|
1525
1525
|
resumeData: timeTravel?.stepResults[step.step.id]?.status === "suspended" ? timeTravel?.resumeData : void 0,
|
|
1526
1526
|
step: step.step
|
|
1527
1527
|
});
|
|
@@ -1681,7 +1681,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1681
1681
|
activeSteps,
|
|
1682
1682
|
requestContext
|
|
1683
1683
|
},
|
|
1684
|
-
new
|
|
1684
|
+
new chunkHWMMIRIF_cjs.MastraError({
|
|
1685
1685
|
id: "MASTRA_WORKFLOW",
|
|
1686
1686
|
text: `Step not found: ${JSON.stringify(executionPath)}`,
|
|
1687
1687
|
domain: "MASTRA_WORKFLOW" /* MASTRA_WORKFLOW */,
|
|
@@ -1929,7 +1929,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1929
1929
|
workflowId: workflowData.workflowId,
|
|
1930
1930
|
runId: workflowData.runId
|
|
1931
1931
|
});
|
|
1932
|
-
if (currentState?.status === "canceled" && type !== "workflow.end") {
|
|
1932
|
+
if (currentState?.status === "canceled" && type !== "workflow.end" && type !== "workflow.cancel") {
|
|
1933
1933
|
return;
|
|
1934
1934
|
}
|
|
1935
1935
|
if (type.startsWith("workflow.user-event.")) {
|
|
@@ -1957,7 +1957,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
1957
1957
|
if (!workflow) {
|
|
1958
1958
|
return this.errorWorkflow(
|
|
1959
1959
|
workflowData,
|
|
1960
|
-
new
|
|
1960
|
+
new chunkHWMMIRIF_cjs.MastraError({
|
|
1961
1961
|
id: "MASTRA_WORKFLOW",
|
|
1962
1962
|
text: `Workflow not found: ${workflowData.workflowId}`,
|
|
1963
1963
|
domain: "MASTRA_WORKFLOW" /* MASTRA_WORKFLOW */,
|
|
@@ -2038,7 +2038,7 @@ var WorkflowEventProcessor = class extends EventProcessor {
|
|
|
2038
2038
|
|
|
2039
2039
|
// src/workflows/evented/workflow.ts
|
|
2040
2040
|
function cloneWorkflow(workflow, opts) {
|
|
2041
|
-
const wf = new
|
|
2041
|
+
const wf = new chunkR5AJGM55_cjs.Workflow({
|
|
2042
2042
|
id: opts.id,
|
|
2043
2043
|
inputSchema: workflow.inputSchema,
|
|
2044
2044
|
outputSchema: workflow.outputSchema,
|
|
@@ -2069,7 +2069,7 @@ function isAgent(params) {
|
|
|
2069
2069
|
return params?.component === "AGENT";
|
|
2070
2070
|
}
|
|
2071
2071
|
function isTool(params) {
|
|
2072
|
-
return params instanceof
|
|
2072
|
+
return params instanceof chunkZ55SJVEC_cjs.Tool;
|
|
2073
2073
|
}
|
|
2074
2074
|
function createStep(params) {
|
|
2075
2075
|
if (isAgent(params)) {
|
|
@@ -2086,7 +2086,7 @@ function createStep(params) {
|
|
|
2086
2086
|
outputSchema: z__default.default.object({
|
|
2087
2087
|
text: z__default.default.string()
|
|
2088
2088
|
}),
|
|
2089
|
-
execute: async ({ inputData, [
|
|
2089
|
+
execute: async ({ inputData, runId, [chunkL3NKIMF5_cjs.PUBSUB_SYMBOL]: pubsub, requestContext, abortSignal, abort }) => {
|
|
2090
2090
|
let streamPromise = {};
|
|
2091
2091
|
streamPromise.promise = new Promise((resolve, reject) => {
|
|
2092
2092
|
streamPromise.resolve = resolve;
|
|
@@ -2108,22 +2108,24 @@ function createStep(params) {
|
|
|
2108
2108
|
name: params.name,
|
|
2109
2109
|
args: inputData
|
|
2110
2110
|
};
|
|
2111
|
-
await
|
|
2112
|
-
type: "
|
|
2113
|
-
|
|
2111
|
+
await pubsub.publish(`workflow.events.v2.${runId}`, {
|
|
2112
|
+
type: "watch",
|
|
2113
|
+
runId,
|
|
2114
|
+
data: { type: "tool-call-streaming-start", ...toolData ?? {} }
|
|
2114
2115
|
});
|
|
2115
2116
|
for await (const chunk of fullStream) {
|
|
2116
2117
|
if (chunk.type === "text-delta") {
|
|
2117
|
-
await
|
|
2118
|
-
type: "
|
|
2119
|
-
|
|
2120
|
-
argsTextDelta: chunk.textDelta
|
|
2118
|
+
await pubsub.publish(`workflow.events.v2.${runId}`, {
|
|
2119
|
+
type: "watch",
|
|
2120
|
+
runId,
|
|
2121
|
+
data: { type: "tool-call-delta", ...toolData ?? {}, argsTextDelta: chunk.textDelta }
|
|
2121
2122
|
});
|
|
2122
2123
|
}
|
|
2123
2124
|
}
|
|
2124
|
-
await
|
|
2125
|
-
type: "
|
|
2126
|
-
|
|
2125
|
+
await pubsub.publish(`workflow.events.v2.${runId}`, {
|
|
2126
|
+
type: "watch",
|
|
2127
|
+
runId,
|
|
2128
|
+
data: { type: "tool-call-streaming-finish", ...toolData ?? {} }
|
|
2127
2129
|
});
|
|
2128
2130
|
return {
|
|
2129
2131
|
text: await streamPromise.promise
|
|
@@ -2194,7 +2196,9 @@ function createWorkflow(params) {
|
|
|
2194
2196
|
options: {
|
|
2195
2197
|
validateInputs: params.options?.validateInputs ?? true,
|
|
2196
2198
|
shouldPersistSnapshot: params.options?.shouldPersistSnapshot ?? (() => true),
|
|
2197
|
-
tracingPolicy: params.options?.tracingPolicy
|
|
2199
|
+
tracingPolicy: params.options?.tracingPolicy,
|
|
2200
|
+
onFinish: params.options?.onFinish,
|
|
2201
|
+
onError: params.options?.onError
|
|
2198
2202
|
}
|
|
2199
2203
|
});
|
|
2200
2204
|
return new EventedWorkflow({
|
|
@@ -2202,7 +2206,7 @@ function createWorkflow(params) {
|
|
|
2202
2206
|
executionEngine
|
|
2203
2207
|
});
|
|
2204
2208
|
}
|
|
2205
|
-
var EventedWorkflow = class extends
|
|
2209
|
+
var EventedWorkflow = class extends chunkR5AJGM55_cjs.Workflow {
|
|
2206
2210
|
constructor(params) {
|
|
2207
2211
|
super(params);
|
|
2208
2212
|
this.engineType = "evented";
|
|
@@ -2216,6 +2220,7 @@ var EventedWorkflow = class extends chunk52RSUALV_cjs.Workflow {
|
|
|
2216
2220
|
const run = this.runs.get(runIdToUse) ?? new EventedRun({
|
|
2217
2221
|
workflowId: this.id,
|
|
2218
2222
|
runId: runIdToUse,
|
|
2223
|
+
resourceId: options?.resourceId,
|
|
2219
2224
|
executionEngine: this.executionEngine,
|
|
2220
2225
|
executionGraph: this.executionGraph,
|
|
2221
2226
|
serializedStepGraph: this.serializedStepGraph,
|
|
@@ -2236,6 +2241,7 @@ var EventedWorkflow = class extends chunk52RSUALV_cjs.Workflow {
|
|
|
2236
2241
|
await this.mastra?.getStorage()?.persistWorkflowSnapshot({
|
|
2237
2242
|
workflowName: this.id,
|
|
2238
2243
|
runId: runIdToUse,
|
|
2244
|
+
resourceId: options?.resourceId,
|
|
2239
2245
|
snapshot: {
|
|
2240
2246
|
runId: runIdToUse,
|
|
2241
2247
|
status: "pending",
|
|
@@ -2257,7 +2263,7 @@ var EventedWorkflow = class extends chunk52RSUALV_cjs.Workflow {
|
|
|
2257
2263
|
return run;
|
|
2258
2264
|
}
|
|
2259
2265
|
};
|
|
2260
|
-
var EventedRun = class extends
|
|
2266
|
+
var EventedRun = class extends chunkR5AJGM55_cjs.Run {
|
|
2261
2267
|
constructor(params) {
|
|
2262
2268
|
super(params);
|
|
2263
2269
|
this.serializedStepGraph = params.serializedStepGraph;
|
|
@@ -2279,6 +2285,7 @@ var EventedRun = class extends chunk52RSUALV_cjs.Run {
|
|
|
2279
2285
|
await this.mastra?.getStorage()?.persistWorkflowSnapshot({
|
|
2280
2286
|
workflowName: this.workflowId,
|
|
2281
2287
|
runId: this.runId,
|
|
2288
|
+
resourceId: this.resourceId,
|
|
2282
2289
|
snapshot: {
|
|
2283
2290
|
runId: this.runId,
|
|
2284
2291
|
serializedStepGraph: this.serializedStepGraph,
|
|
@@ -2296,6 +2303,9 @@ var EventedRun = class extends chunk52RSUALV_cjs.Run {
|
|
|
2296
2303
|
});
|
|
2297
2304
|
const inputDataToUse = await this._validateInput(inputData);
|
|
2298
2305
|
const initialStateToUse = await this._validateInitialState(initialState ?? {});
|
|
2306
|
+
if (!this.mastra?.pubsub) {
|
|
2307
|
+
throw new Error("Mastra instance with pubsub is required for workflow execution");
|
|
2308
|
+
}
|
|
2299
2309
|
const result = await this.executionEngine.execute({
|
|
2300
2310
|
workflowId: this.workflowId,
|
|
2301
2311
|
runId: this.runId,
|
|
@@ -2303,20 +2313,7 @@ var EventedRun = class extends chunk52RSUALV_cjs.Run {
|
|
|
2303
2313
|
serializedStepGraph: this.serializedStepGraph,
|
|
2304
2314
|
input: inputDataToUse,
|
|
2305
2315
|
initialState: initialStateToUse,
|
|
2306
|
-
|
|
2307
|
-
emit: async (event, data) => {
|
|
2308
|
-
this.emitter.emit(event, data);
|
|
2309
|
-
},
|
|
2310
|
-
on: (event, callback) => {
|
|
2311
|
-
this.emitter.on(event, callback);
|
|
2312
|
-
},
|
|
2313
|
-
off: (event, callback) => {
|
|
2314
|
-
this.emitter.off(event, callback);
|
|
2315
|
-
},
|
|
2316
|
-
once: (event, callback) => {
|
|
2317
|
-
this.emitter.once(event, callback);
|
|
2318
|
-
}
|
|
2319
|
-
},
|
|
2316
|
+
pubsub: this.mastra.pubsub,
|
|
2320
2317
|
retryConfig: this.retryConfig,
|
|
2321
2318
|
requestContext,
|
|
2322
2319
|
abortController: this.abortController
|
|
@@ -2326,6 +2323,62 @@ var EventedRun = class extends chunk52RSUALV_cjs.Run {
|
|
|
2326
2323
|
}
|
|
2327
2324
|
return result;
|
|
2328
2325
|
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Starts the workflow execution without waiting for completion (fire-and-forget).
|
|
2328
|
+
* Returns immediately with the runId. The workflow executes in the background via pubsub.
|
|
2329
|
+
* Use this when you don't need to wait for the result or want to avoid polling failures.
|
|
2330
|
+
*/
|
|
2331
|
+
async startAsync({
|
|
2332
|
+
inputData,
|
|
2333
|
+
initialState,
|
|
2334
|
+
requestContext
|
|
2335
|
+
}) {
|
|
2336
|
+
if (this.serializedStepGraph.length === 0) {
|
|
2337
|
+
throw new Error(
|
|
2338
|
+
"Execution flow of workflow is not defined. Add steps to the workflow via .then(), .branch(), etc."
|
|
2339
|
+
);
|
|
2340
|
+
}
|
|
2341
|
+
if (!this.executionGraph.steps) {
|
|
2342
|
+
throw new Error("Uncommitted step flow changes detected. Call .commit() to register the steps.");
|
|
2343
|
+
}
|
|
2344
|
+
requestContext = requestContext ?? new chunkUVHSM2GU_cjs.RequestContext();
|
|
2345
|
+
await this.mastra?.getStorage()?.persistWorkflowSnapshot({
|
|
2346
|
+
workflowName: this.workflowId,
|
|
2347
|
+
runId: this.runId,
|
|
2348
|
+
resourceId: this.resourceId,
|
|
2349
|
+
snapshot: {
|
|
2350
|
+
runId: this.runId,
|
|
2351
|
+
serializedStepGraph: this.serializedStepGraph,
|
|
2352
|
+
status: "running",
|
|
2353
|
+
value: {},
|
|
2354
|
+
context: {},
|
|
2355
|
+
requestContext: Object.fromEntries(requestContext.entries()),
|
|
2356
|
+
activePaths: [],
|
|
2357
|
+
activeStepsPath: {},
|
|
2358
|
+
suspendedPaths: {},
|
|
2359
|
+
resumeLabels: {},
|
|
2360
|
+
waitingPaths: {},
|
|
2361
|
+
timestamp: Date.now()
|
|
2362
|
+
}
|
|
2363
|
+
});
|
|
2364
|
+
const inputDataToUse = await this._validateInput(inputData);
|
|
2365
|
+
const initialStateToUse = await this._validateInitialState(initialState ?? {});
|
|
2366
|
+
if (!this.mastra?.pubsub) {
|
|
2367
|
+
throw new Error("Mastra instance with pubsub is required for workflow execution");
|
|
2368
|
+
}
|
|
2369
|
+
await this.mastra.pubsub.publish("workflows", {
|
|
2370
|
+
type: "workflow.start",
|
|
2371
|
+
runId: this.runId,
|
|
2372
|
+
data: {
|
|
2373
|
+
workflowId: this.workflowId,
|
|
2374
|
+
runId: this.runId,
|
|
2375
|
+
prevResult: { status: "success", output: inputDataToUse },
|
|
2376
|
+
requestContext: Object.fromEntries(requestContext.entries()),
|
|
2377
|
+
initialState: initialStateToUse
|
|
2378
|
+
}
|
|
2379
|
+
});
|
|
2380
|
+
return { runId: this.runId };
|
|
2381
|
+
}
|
|
2329
2382
|
// TODO: stream
|
|
2330
2383
|
async resume(params) {
|
|
2331
2384
|
let steps = [];
|
|
@@ -2365,6 +2418,9 @@ var EventedRun = class extends chunk52RSUALV_cjs.Run {
|
|
|
2365
2418
|
}
|
|
2366
2419
|
const suspendedStep = this.workflowSteps[steps?.[0] ?? ""];
|
|
2367
2420
|
const resumeDataToUse = await this._validateResumeData(params.resumeData, suspendedStep);
|
|
2421
|
+
if (!this.mastra?.pubsub) {
|
|
2422
|
+
throw new Error("Mastra instance with pubsub is required for workflow execution");
|
|
2423
|
+
}
|
|
2368
2424
|
const executionResultPromise = this.executionEngine.execute({
|
|
2369
2425
|
workflowId: this.workflowId,
|
|
2370
2426
|
runId: this.runId,
|
|
@@ -2377,21 +2433,7 @@ var EventedRun = class extends chunk52RSUALV_cjs.Run {
|
|
|
2377
2433
|
resumePayload: resumeDataToUse,
|
|
2378
2434
|
resumePath
|
|
2379
2435
|
},
|
|
2380
|
-
|
|
2381
|
-
emit: (event, data) => {
|
|
2382
|
-
this.emitter.emit(event, data);
|
|
2383
|
-
return Promise.resolve();
|
|
2384
|
-
},
|
|
2385
|
-
on: (event, callback) => {
|
|
2386
|
-
this.emitter.on(event, callback);
|
|
2387
|
-
},
|
|
2388
|
-
off: (event, callback) => {
|
|
2389
|
-
this.emitter.off(event, callback);
|
|
2390
|
-
},
|
|
2391
|
-
once: (event, callback) => {
|
|
2392
|
-
this.emitter.once(event, callback);
|
|
2393
|
-
}
|
|
2394
|
-
},
|
|
2436
|
+
pubsub: this.mastra.pubsub,
|
|
2395
2437
|
requestContext,
|
|
2396
2438
|
abortController: this.abortController
|
|
2397
2439
|
}).then((result) => {
|
|
@@ -2435,6 +2477,13 @@ var EventedRun = class extends chunk52RSUALV_cjs.Run {
|
|
|
2435
2477
|
};
|
|
2436
2478
|
}
|
|
2437
2479
|
async cancel() {
|
|
2480
|
+
await this.mastra?.getStorage()?.updateWorkflowState({
|
|
2481
|
+
workflowName: this.workflowId,
|
|
2482
|
+
runId: this.runId,
|
|
2483
|
+
opts: {
|
|
2484
|
+
status: "canceled"
|
|
2485
|
+
}
|
|
2486
|
+
});
|
|
2438
2487
|
await this.mastra?.pubsub.publish("workflows", {
|
|
2439
2488
|
type: "workflow.cancel",
|
|
2440
2489
|
runId: this.runId,
|
|
@@ -2490,7 +2539,7 @@ function isExecutableStep(step) {
|
|
|
2490
2539
|
}
|
|
2491
2540
|
|
|
2492
2541
|
// src/workflows/evented/execution-engine.ts
|
|
2493
|
-
var EventedExecutionEngine = class extends
|
|
2542
|
+
var EventedExecutionEngine = class extends chunkR5AJGM55_cjs.ExecutionEngine {
|
|
2494
2543
|
eventProcessor;
|
|
2495
2544
|
constructor({
|
|
2496
2545
|
mastra,
|
|
@@ -2563,7 +2612,7 @@ var EventedExecutionEngine = class extends chunk52RSUALV_cjs.ExecutionEngine {
|
|
|
2563
2612
|
}
|
|
2564
2613
|
});
|
|
2565
2614
|
}
|
|
2566
|
-
const resultData = await new Promise((resolve) => {
|
|
2615
|
+
const resultData = await new Promise((resolve, reject) => {
|
|
2567
2616
|
const finishCb = async (event, ack) => {
|
|
2568
2617
|
if (event.runId !== params.runId) {
|
|
2569
2618
|
await ack?.();
|
|
@@ -2572,38 +2621,55 @@ var EventedExecutionEngine = class extends chunk52RSUALV_cjs.ExecutionEngine {
|
|
|
2572
2621
|
if (["workflow.end", "workflow.fail", "workflow.suspend"].includes(event.type)) {
|
|
2573
2622
|
await ack?.();
|
|
2574
2623
|
await pubsub.unsubscribe("workflows-finish", finishCb);
|
|
2624
|
+
if (event.type === "workflow.fail" && event.data.stepResults) {
|
|
2625
|
+
event.data.stepResults = chunkR5AJGM55_cjs.hydrateSerializedStepErrors(event.data.stepResults);
|
|
2626
|
+
}
|
|
2575
2627
|
resolve(event.data);
|
|
2576
2628
|
return;
|
|
2577
2629
|
}
|
|
2578
2630
|
await ack?.();
|
|
2579
2631
|
};
|
|
2580
|
-
pubsub.subscribe("workflows-finish", finishCb).catch(() => {
|
|
2632
|
+
pubsub.subscribe("workflows-finish", finishCb).catch((err) => {
|
|
2633
|
+
console.error("Failed to subscribe to workflows-finish:", err);
|
|
2634
|
+
reject(err);
|
|
2581
2635
|
});
|
|
2582
2636
|
});
|
|
2637
|
+
let callbackArg;
|
|
2583
2638
|
if (resultData.prevResult.status === "failed") {
|
|
2584
|
-
|
|
2639
|
+
callbackArg = {
|
|
2585
2640
|
status: "failed",
|
|
2586
2641
|
error: resultData.prevResult.error,
|
|
2587
2642
|
steps: resultData.stepResults
|
|
2588
2643
|
};
|
|
2589
2644
|
} else if (resultData.prevResult.status === "suspended") {
|
|
2645
|
+
callbackArg = {
|
|
2646
|
+
status: "suspended",
|
|
2647
|
+
steps: resultData.stepResults
|
|
2648
|
+
};
|
|
2649
|
+
} else {
|
|
2650
|
+
callbackArg = {
|
|
2651
|
+
status: resultData.prevResult.status,
|
|
2652
|
+
result: resultData.prevResult?.output,
|
|
2653
|
+
steps: resultData.stepResults
|
|
2654
|
+
};
|
|
2655
|
+
}
|
|
2656
|
+
await this.invokeLifecycleCallbacks(callbackArg);
|
|
2657
|
+
let result;
|
|
2658
|
+
if (resultData.prevResult.status === "suspended") {
|
|
2590
2659
|
const suspendedSteps = Object.entries(resultData.stepResults).map(([_stepId, stepResult]) => {
|
|
2591
2660
|
if (stepResult.status === "suspended") {
|
|
2592
2661
|
return stepResult.suspendPayload?.__workflow_meta?.path ?? [];
|
|
2593
2662
|
}
|
|
2594
2663
|
return null;
|
|
2595
2664
|
}).filter(Boolean);
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
steps: resultData.stepResults,
|
|
2665
|
+
result = {
|
|
2666
|
+
...callbackArg,
|
|
2599
2667
|
suspended: suspendedSteps
|
|
2600
2668
|
};
|
|
2669
|
+
} else {
|
|
2670
|
+
result = callbackArg;
|
|
2601
2671
|
}
|
|
2602
|
-
return
|
|
2603
|
-
status: resultData.prevResult.status,
|
|
2604
|
-
result: resultData.prevResult?.output,
|
|
2605
|
-
steps: resultData.stepResults
|
|
2606
|
-
};
|
|
2672
|
+
return result;
|
|
2607
2673
|
}
|
|
2608
2674
|
};
|
|
2609
2675
|
|
|
@@ -2616,5 +2682,5 @@ exports.cloneStep = cloneStep;
|
|
|
2616
2682
|
exports.cloneWorkflow = cloneWorkflow;
|
|
2617
2683
|
exports.createStep = createStep;
|
|
2618
2684
|
exports.createWorkflow = createWorkflow;
|
|
2619
|
-
//# sourceMappingURL=chunk-
|
|
2620
|
-
//# sourceMappingURL=chunk-
|
|
2685
|
+
//# sourceMappingURL=chunk-U4CSOY6T.cjs.map
|
|
2686
|
+
//# sourceMappingURL=chunk-U4CSOY6T.cjs.map
|