@mastra/core 1.2.1-alpha.0 → 1.3.0-alpha.2
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 +341 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +2093 -262
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts +12 -3
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/index.cjs +18 -18
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/message-list.d.ts.map +1 -1
- package/dist/agent/types.d.ts +6 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts +3 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/map-results-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/base.cjs +2 -2
- package/dist/base.d.ts +13 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/cache/index.cjs +3 -3
- package/dist/cache/index.js +1 -1
- package/dist/{chunk-ENCTSDWC.js → chunk-2GWTJFVM.js} +2410 -1402
- package/dist/chunk-2GWTJFVM.js.map +1 -0
- package/dist/{chunk-OB4V67IX.cjs → chunk-2K5PNW2U.cjs} +4 -4
- package/dist/{chunk-OB4V67IX.cjs.map → chunk-2K5PNW2U.cjs.map} +1 -1
- package/dist/{chunk-VZXYBFCX.cjs → chunk-2P6DD7M5.cjs} +10 -10
- package/dist/{chunk-VZXYBFCX.cjs.map → chunk-2P6DD7M5.cjs.map} +1 -1
- package/dist/{chunk-Q2D7LERO.cjs → chunk-2VD5OGOT.cjs} +4 -4
- package/dist/{chunk-Q2D7LERO.cjs.map → chunk-2VD5OGOT.cjs.map} +1 -1
- package/dist/{chunk-2DMSFLJY.cjs → chunk-6TZKQI4R.cjs} +8 -8
- package/dist/chunk-6TZKQI4R.cjs.map +1 -0
- package/dist/{chunk-4NG7CKEG.js → chunk-6VGCVSP4.js} +3 -3
- package/dist/{chunk-4NG7CKEG.js.map → chunk-6VGCVSP4.js.map} +1 -1
- package/dist/{chunk-IIZF4W7B.cjs → chunk-7UWHFWST.cjs} +52 -5
- package/dist/chunk-7UWHFWST.cjs.map +1 -0
- package/dist/{chunk-VW7YQWDW.cjs → chunk-BFIOQFGF.cjs} +28 -2
- package/dist/chunk-BFIOQFGF.cjs.map +1 -0
- package/dist/{chunk-E3VFKTIA.js → chunk-BXLLXTT4.js} +2245 -179
- package/dist/chunk-BXLLXTT4.js.map +1 -0
- package/dist/{chunk-HMCXNOF6.cjs → chunk-CGPH7CMG.cjs} +2431 -1417
- package/dist/chunk-CGPH7CMG.cjs.map +1 -0
- package/dist/{chunk-GVLPTDJA.cjs → chunk-D5JZT6EK.cjs} +236 -63
- package/dist/chunk-D5JZT6EK.cjs.map +1 -0
- package/dist/{chunk-5SOS47PH.cjs → chunk-FLHFB23E.cjs} +454 -222
- package/dist/chunk-FLHFB23E.cjs.map +1 -0
- package/dist/{chunk-XCPEEIHI.cjs → chunk-GCTAD6B7.cjs} +3012 -927
- package/dist/chunk-GCTAD6B7.cjs.map +1 -0
- package/dist/{chunk-W3AQUG66.js → chunk-GIY5BINT.js} +4 -4
- package/dist/{chunk-W3AQUG66.js.map → chunk-GIY5BINT.js.map} +1 -1
- package/dist/{chunk-M6VFJX5A.js → chunk-GMSAGYTB.js} +3 -3
- package/dist/{chunk-M6VFJX5A.js.map → chunk-GMSAGYTB.js.map} +1 -1
- package/dist/{chunk-JRJJ5VQE.cjs → chunk-GZD6443M.cjs} +99 -55
- package/dist/chunk-GZD6443M.cjs.map +1 -0
- package/dist/{chunk-Z6NRYYOH.js → chunk-ILQXPZCD.js} +9 -4
- package/dist/chunk-ILQXPZCD.js.map +1 -0
- package/dist/{chunk-5YVR7B4R.js → chunk-JQNREL64.js} +29 -9
- package/dist/chunk-JQNREL64.js.map +1 -0
- package/dist/{chunk-QOFI2WBM.cjs → chunk-JU6K7UDX.cjs} +991 -229
- package/dist/chunk-JU6K7UDX.cjs.map +1 -0
- package/dist/{chunk-HN2MSTR6.cjs → chunk-KAJNBNWP.cjs} +283 -38
- package/dist/chunk-KAJNBNWP.cjs.map +1 -0
- package/dist/{chunk-MSWXEOZC.js → chunk-KL2JPSRX.js} +5 -5
- package/dist/chunk-KL2JPSRX.js.map +1 -0
- package/dist/{chunk-MQB7XFXP.js → chunk-LHRHOPUC.js} +3 -3
- package/dist/{chunk-MQB7XFXP.js.map → chunk-LHRHOPUC.js.map} +1 -1
- package/dist/{chunk-VX7UA3SO.js → chunk-MOOJ3H3C.js} +974 -217
- package/dist/chunk-MOOJ3H3C.js.map +1 -0
- package/dist/{chunk-HU2ONA2W.cjs → chunk-ON2KVIUJ.cjs} +17 -17
- package/dist/{chunk-HU2ONA2W.cjs.map → chunk-ON2KVIUJ.cjs.map} +1 -1
- package/dist/{chunk-I66TMZJ3.cjs → chunk-OOCEAC6U.cjs} +21 -18
- package/dist/chunk-OOCEAC6U.cjs.map +1 -0
- package/dist/{chunk-MNWW2R3U.js → chunk-OV7OOUUR.js} +90 -54
- package/dist/chunk-OV7OOUUR.js.map +1 -0
- package/dist/{chunk-C4WWWQHT.cjs → chunk-RO47SMI7.cjs} +23 -3
- package/dist/chunk-RO47SMI7.cjs.map +1 -0
- package/dist/{chunk-6FG6FU5Y.cjs → chunk-RQ56ZSIR.cjs} +4 -4
- package/dist/{chunk-6FG6FU5Y.cjs.map → chunk-RQ56ZSIR.cjs.map} +1 -1
- package/dist/{chunk-IW3BNL7A.js → chunk-RS6CZXGA.js} +50 -3
- package/dist/chunk-RS6CZXGA.js.map +1 -0
- package/dist/{chunk-AIJLACR2.js → chunk-S53FKKVL.js} +27 -3
- package/dist/chunk-S53FKKVL.js.map +1 -0
- package/dist/{chunk-G6E3QNJC.js → chunk-SBPPGJL6.js} +4078 -4333
- package/dist/chunk-SBPPGJL6.js.map +1 -0
- package/dist/{chunk-UZL4H5P2.cjs → chunk-SH4PCZ3X.cjs} +5375 -5648
- package/dist/chunk-SH4PCZ3X.cjs.map +1 -0
- package/dist/{chunk-ZWM2CAIM.js → chunk-STKNQDVA.js} +4 -4
- package/dist/{chunk-ZWM2CAIM.js.map → chunk-STKNQDVA.js.map} +1 -1
- package/dist/{chunk-A5QFWX67.cjs → chunk-U2CABSMC.cjs} +79 -59
- package/dist/chunk-U2CABSMC.cjs.map +1 -0
- package/dist/{chunk-7MDVYPWX.cjs → chunk-UE2G2LRP.cjs} +9 -4
- package/dist/chunk-UE2G2LRP.cjs.map +1 -0
- package/dist/{chunk-AUF6U2BL.js → chunk-VM25PDSW.js} +5 -5
- package/dist/{chunk-AUF6U2BL.js.map → chunk-VM25PDSW.js.map} +1 -1
- package/dist/{chunk-RXD5EGQF.js → chunk-VVD56FI4.js} +228 -55
- package/dist/chunk-VVD56FI4.js.map +1 -0
- package/dist/{chunk-JIT2OY3X.js → chunk-WCAFTXGK.js} +23 -3
- package/dist/chunk-WCAFTXGK.js.map +1 -0
- package/dist/{chunk-P62OJXQ4.js → chunk-WL3AW3YA.js} +282 -37
- package/dist/chunk-WL3AW3YA.js.map +1 -0
- package/dist/{chunk-YLODOPYM.cjs → chunk-XDD5V446.cjs} +4163 -5352
- package/dist/chunk-XDD5V446.cjs.map +1 -0
- package/dist/{chunk-B4M33FCS.cjs → chunk-XQVYEOI7.cjs} +7 -7
- package/dist/{chunk-B4M33FCS.cjs.map → chunk-XQVYEOI7.cjs.map} +1 -1
- package/dist/{chunk-BP2TSCBW.js → chunk-ZATLLPIH.js} +4391 -5561
- package/dist/chunk-ZATLLPIH.js.map +1 -0
- package/dist/{chunk-T6PRRKMW.js → chunk-ZHFM7HCQ.js} +9 -6
- package/dist/chunk-ZHFM7HCQ.js.map +1 -0
- package/dist/{chunk-WFUNLRQX.js → chunk-ZRUTE56J.js} +366 -134
- package/dist/chunk-ZRUTE56J.js.map +1 -0
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.js +1 -1
- package/dist/docs/SKILL.md +2 -9
- package/dist/docs/assets/SOURCE_MAP.json +399 -342
- package/dist/docs/references/docs-agents-agent-memory.md +45 -1
- package/dist/docs/references/docs-agents-network-approval.md +1 -1
- package/dist/docs/references/docs-agents-networks.md +3 -3
- package/dist/docs/references/docs-agents-overview.md +8 -0
- package/dist/docs/references/docs-agents-using-tools.md +82 -72
- package/dist/docs/references/docs-memory-observational-memory.md +11 -8
- package/dist/docs/references/docs-observability-overview.md +1 -1
- package/dist/docs/references/docs-observability-tracing-exporters-langsmith.md +70 -0
- package/dist/docs/references/docs-observability-tracing-overview.md +1 -1
- package/dist/docs/references/docs-server-middleware.md +0 -2
- package/dist/docs/references/docs-server-request-context.md +17 -0
- package/dist/docs/references/docs-workflows-agents-and-tools.md +2 -2
- package/dist/docs/references/docs-workflows-overview.md +1 -1
- package/dist/docs/references/docs-workspace-filesystem.md +2 -0
- package/dist/docs/references/docs-workspace-overview.md +3 -1
- package/dist/docs/references/docs-workspace-sandbox.md +2 -0
- package/dist/docs/references/docs-workspace-search.md +2 -0
- package/dist/docs/references/docs-workspace-skills.md +3 -1
- package/dist/docs/references/reference-agents-getTools.md +1 -6
- package/dist/docs/references/reference-agents-listAgents.md +1 -1
- package/dist/docs/references/reference-agents-network.md +0 -2
- package/dist/docs/references/reference-cli-mastra.md +29 -4
- package/dist/docs/references/reference-client-js-agents.md +1 -1
- package/dist/docs/references/reference-configuration.md +1 -1
- package/dist/docs/references/reference-core-getStoredAgentById.md +2 -2
- package/dist/docs/references/reference-core-listStoredAgents.md +1 -1
- package/dist/docs/references/reference-memory-observational-memory.md +2 -0
- package/dist/docs/references/reference-tools-mcp-client.md +0 -2
- package/dist/docs/references/reference-workflows-step.md +2 -0
- package/dist/docs/references/reference-workflows-workflow-methods-map.md +2 -2
- package/dist/docs/references/reference-workspace-filesystem.md +2 -0
- package/dist/docs/references/reference-workspace-local-filesystem.md +2 -0
- package/dist/docs/references/reference-workspace-local-sandbox.md +2 -0
- package/dist/docs/references/reference-workspace-sandbox.md +2 -0
- package/dist/docs/references/reference-workspace-workspace-class.md +2 -0
- package/dist/docs/references/reference.md +7 -2
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/types.d.ts +53 -48
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/evals/base.d.ts +15 -0
- 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/run/index.d.ts +3 -3
- package/dist/evals/run/index.d.ts.map +1 -1
- package/dist/evals/scoreTraces/index.cjs +5 -5
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/features/index.cjs +1 -1
- package/dist/features/index.cjs.map +1 -1
- package/dist/features/index.d.ts.map +1 -1
- package/dist/features/index.js +1 -1
- package/dist/features/index.js.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/integration/index.cjs +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +16 -16
- package/dist/llm/index.js +5 -5
- package/dist/llm/model/gateways/constants.d.ts.map +1 -1
- package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts +1 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +128 -10
- package/dist/llm/model/resolve-model.d.ts.map +1 -1
- package/dist/loop/index.cjs +12 -12
- package/dist/loop/index.js +1 -1
- package/dist/loop/network/index.d.ts +3 -3
- package/dist/loop/network/index.d.ts.map +1 -1
- package/dist/loop/network/run-command-tool.d.ts +1 -1
- package/dist/loop/types.d.ts +13 -0
- package/dist/loop/types.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +9 -9
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +7 -7
- 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 +3 -3
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts +9 -9
- package/dist/loop/workflows/schema.d.ts +12 -12
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +91 -5
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +2 -2
- package/dist/mcp/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/memory/mock.d.ts.map +1 -1
- package/dist/memory/types.d.ts +128 -0
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/models-dev-FQVUTQ7L.js +3 -0
- package/dist/{models-dev-Z45JSLWD.js.map → models-dev-FQVUTQ7L.js.map} +1 -1
- package/dist/models-dev-PPIXUUCU.cjs +12 -0
- package/dist/{models-dev-OQKVMEIT.cjs.map → models-dev-PPIXUUCU.cjs.map} +1 -1
- package/dist/netlify-4RIKF7Y3.js +3 -0
- package/dist/{netlify-SSWMYSAX.js.map → netlify-4RIKF7Y3.js.map} +1 -1
- package/dist/netlify-V5F7JEJH.cjs +12 -0
- package/dist/{netlify-TXZZCT6N.cjs.map → netlify-V5F7JEJH.cjs.map} +1 -1
- package/dist/processors/index.cjs +41 -41
- package/dist/processors/index.js +1 -1
- package/dist/processors/step-schema.d.ts +44 -44
- package/dist/provider-registry-C6XCYX44.cjs +40 -0
- package/dist/{provider-registry-NR7FXV2Q.cjs.map → provider-registry-C6XCYX44.cjs.map} +1 -1
- package/dist/provider-registry-NWU4YFQW.js +3 -0
- package/dist/{provider-registry-RPOTQNHI.js.map → provider-registry-NWU4YFQW.js.map} +1 -1
- package/dist/provider-registry.json +278 -33
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +3 -3
- package/dist/server/index.js +1 -1
- package/dist/storage/base.d.ts +3 -1
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/constants.cjs +51 -19
- package/dist/storage/constants.d.ts +10 -2
- package/dist/storage/constants.d.ts.map +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/agents/base.d.ts +13 -164
- package/dist/storage/domains/agents/base.d.ts.map +1 -1
- package/dist/storage/domains/agents/index.d.ts +0 -1
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/agents/inmemory.d.ts +6 -10
- package/dist/storage/domains/agents/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/index.d.ts +3 -0
- package/dist/storage/domains/index.d.ts.map +1 -1
- package/dist/storage/domains/inmemory-db.d.ts +7 -1
- package/dist/storage/domains/inmemory-db.d.ts.map +1 -1
- package/dist/storage/domains/memory/base.d.ts +45 -5
- package/dist/storage/domains/memory/base.d.ts.map +1 -1
- package/dist/storage/domains/memory/inmemory.d.ts +7 -7
- package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/observability/types.d.ts +62 -62
- package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/prompt-blocks/base.d.ts +47 -0
- package/dist/storage/domains/prompt-blocks/base.d.ts.map +1 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts +3 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -0
- package/dist/storage/domains/prompt-blocks/inmemory.d.ts +31 -0
- package/dist/storage/domains/prompt-blocks/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/base.d.ts +47 -0
- package/dist/storage/domains/scorer-definitions/base.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts +3 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/inmemory.d.ts +31 -0
- package/dist/storage/domains/scorer-definitions/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/versioned.d.ts +136 -0
- package/dist/storage/domains/versioned.d.ts.map +1 -0
- package/dist/storage/index.cjs +156 -104
- package/dist/storage/index.js +2 -2
- package/dist/storage/mock.d.ts.map +1 -1
- package/dist/storage/types.d.ts +481 -27
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/MastraAgentNetworkStream.d.ts +1 -1
- package/dist/stream/MastraWorkflowStream.d.ts +1 -1
- package/dist/stream/RunOutput.d.ts +1 -1
- package/dist/stream/RunOutput.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts +4 -0
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +11 -11
- package/dist/stream/index.js +2 -2
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/tools/index.cjs +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/types.d.ts +15 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/validation.d.ts.map +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/types/zod-compat.d.ts +2 -2
- package/dist/types/zod-compat.d.ts.map +1 -1
- package/dist/utils/zod-utils.d.ts +19 -0
- package/dist/utils/zod-utils.d.ts.map +1 -1
- package/dist/utils.cjs +28 -28
- package/dist/utils.d.ts +7 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/vector/index.cjs +9 -9
- package/dist/vector/index.js +2 -2
- package/dist/voice/index.cjs +6 -6
- package/dist/voice/index.js +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.map +1 -1
- package/dist/workflows/evented/workflow.d.ts +3 -1
- package/dist/workflows/evented/workflow.d.ts.map +1 -1
- package/dist/workflows/execution-engine.d.ts.map +1 -1
- package/dist/workflows/index.cjs +25 -25
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/step.d.ts +4 -3
- package/dist/workflows/step.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +2 -1
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +12 -4
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/dist/workspace/errors.d.ts +6 -0
- package/dist/workspace/errors.d.ts.map +1 -1
- package/dist/workspace/filesystem/composite-filesystem.d.ts +93 -0
- package/dist/workspace/filesystem/composite-filesystem.d.ts.map +1 -0
- package/dist/workspace/filesystem/filesystem.d.ts +35 -0
- package/dist/workspace/filesystem/filesystem.d.ts.map +1 -1
- package/dist/workspace/filesystem/index.d.ts +2 -0
- package/dist/workspace/filesystem/index.d.ts.map +1 -1
- package/dist/workspace/filesystem/local-filesystem.d.ts +9 -1
- package/dist/workspace/filesystem/local-filesystem.d.ts.map +1 -1
- package/dist/workspace/filesystem/mastra-filesystem.d.ts +92 -3
- package/dist/workspace/filesystem/mastra-filesystem.d.ts.map +1 -1
- package/dist/workspace/filesystem/mount.d.ts +34 -0
- package/dist/workspace/filesystem/mount.d.ts.map +1 -0
- package/dist/workspace/index.cjs +62 -34
- package/dist/workspace/index.d.ts +6 -2
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/lifecycle.d.ts +29 -0
- package/dist/workspace/lifecycle.d.ts.map +1 -1
- package/dist/workspace/sandbox/errors.d.ts +50 -0
- package/dist/workspace/sandbox/errors.d.ts.map +1 -0
- package/dist/workspace/sandbox/index.d.ts +3 -0
- package/dist/workspace/sandbox/index.d.ts.map +1 -1
- package/dist/workspace/sandbox/local-sandbox.d.ts +17 -2
- package/dist/workspace/sandbox/local-sandbox.d.ts.map +1 -1
- package/dist/workspace/sandbox/mastra-sandbox.d.ts +153 -6
- package/dist/workspace/sandbox/mastra-sandbox.d.ts.map +1 -1
- package/dist/workspace/sandbox/mount-manager.d.ts +195 -0
- package/dist/workspace/sandbox/mount-manager.d.ts.map +1 -0
- package/dist/workspace/sandbox/sandbox.d.ts +37 -84
- package/dist/workspace/sandbox/sandbox.d.ts.map +1 -1
- package/dist/workspace/sandbox/types.d.ts +92 -0
- package/dist/workspace/sandbox/types.d.ts.map +1 -0
- package/dist/workspace/tools/tools.d.ts.map +1 -1
- package/dist/workspace/tools/tree-formatter.d.ts.map +1 -1
- package/dist/workspace/workspace.d.ts +73 -3
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/llm/model/provider-types.generated.d.ts +128 -10
- package/dist/chunk-2DMSFLJY.cjs.map +0 -1
- package/dist/chunk-5SOS47PH.cjs.map +0 -1
- package/dist/chunk-5YVR7B4R.js.map +0 -1
- package/dist/chunk-7MDVYPWX.cjs.map +0 -1
- package/dist/chunk-A5QFWX67.cjs.map +0 -1
- package/dist/chunk-AIJLACR2.js.map +0 -1
- package/dist/chunk-BP2TSCBW.js.map +0 -1
- package/dist/chunk-C4WWWQHT.cjs.map +0 -1
- package/dist/chunk-E3VFKTIA.js.map +0 -1
- package/dist/chunk-ENCTSDWC.js.map +0 -1
- package/dist/chunk-G6E3QNJC.js.map +0 -1
- package/dist/chunk-GVLPTDJA.cjs.map +0 -1
- package/dist/chunk-HMCXNOF6.cjs.map +0 -1
- package/dist/chunk-HN2MSTR6.cjs.map +0 -1
- package/dist/chunk-I66TMZJ3.cjs.map +0 -1
- package/dist/chunk-IIZF4W7B.cjs.map +0 -1
- package/dist/chunk-IW3BNL7A.js.map +0 -1
- package/dist/chunk-JIT2OY3X.js.map +0 -1
- package/dist/chunk-JRJJ5VQE.cjs.map +0 -1
- package/dist/chunk-MNWW2R3U.js.map +0 -1
- package/dist/chunk-MSWXEOZC.js.map +0 -1
- package/dist/chunk-P62OJXQ4.js.map +0 -1
- package/dist/chunk-QOFI2WBM.cjs.map +0 -1
- package/dist/chunk-RXD5EGQF.js.map +0 -1
- package/dist/chunk-T6PRRKMW.js.map +0 -1
- package/dist/chunk-UZL4H5P2.cjs.map +0 -1
- package/dist/chunk-VW7YQWDW.cjs.map +0 -1
- package/dist/chunk-VX7UA3SO.js.map +0 -1
- package/dist/chunk-WFUNLRQX.js.map +0 -1
- package/dist/chunk-XCPEEIHI.cjs.map +0 -1
- package/dist/chunk-YLODOPYM.cjs.map +0 -1
- package/dist/chunk-Z6NRYYOH.js.map +0 -1
- package/dist/docs/references/docs-tools-mcp-advanced-usage.md +0 -143
- package/dist/docs/references/docs-tools-mcp-mcp-overview.md +0 -383
- package/dist/docs/references/docs-tools-mcp-overview.md +0 -78
- package/dist/docs/references/docs-workflows-input-data-mapping.md +0 -102
- package/dist/docs/references/reference-deployer-netlify.md +0 -14
- package/dist/docs/references/reference-deployer-vercel.md +0 -39
- package/dist/docs/references/reference-tools-client.md +0 -228
- package/dist/models-dev-OQKVMEIT.cjs +0 -12
- package/dist/models-dev-Z45JSLWD.js +0 -3
- package/dist/netlify-SSWMYSAX.js +0 -3
- package/dist/netlify-TXZZCT6N.cjs +0 -12
- package/dist/provider-registry-NR7FXV2Q.cjs +0 -40
- package/dist/provider-registry-RPOTQNHI.js +0 -3
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkCGPH7CMG_cjs = require('./chunk-CGPH7CMG.cjs');
|
|
4
|
+
var chunkRQ56ZSIR_cjs = require('./chunk-RQ56ZSIR.cjs');
|
|
5
5
|
var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunkJU6K7UDX_cjs = require('./chunk-JU6K7UDX.cjs');
|
|
7
|
+
var chunkUE2G2LRP_cjs = require('./chunk-UE2G2LRP.cjs');
|
|
8
8
|
var chunkZIEQA3YP_cjs = require('./chunk-ZIEQA3YP.cjs');
|
|
9
9
|
var chunkPM3UIIBK_cjs = require('./chunk-PM3UIIBK.cjs');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var chunkGCTAD6B7_cjs = require('./chunk-GCTAD6B7.cjs');
|
|
11
|
+
var chunkON2KVIUJ_cjs = require('./chunk-ON2KVIUJ.cjs');
|
|
12
12
|
var chunk6BJ7XHRH_cjs = require('./chunk-6BJ7XHRH.cjs');
|
|
13
13
|
var chunk4D4KB75Y_cjs = require('./chunk-4D4KB75Y.cjs');
|
|
14
14
|
var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
|
|
15
|
-
var
|
|
15
|
+
var chunkOOCEAC6U_cjs = require('./chunk-OOCEAC6U.cjs');
|
|
16
16
|
var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
|
|
17
|
-
var
|
|
17
|
+
var chunk7UWHFWST_cjs = require('./chunk-7UWHFWST.cjs');
|
|
18
18
|
var chunkCYUP7QWT_cjs = require('./chunk-CYUP7QWT.cjs');
|
|
19
19
|
var chunkVDKWYUGC_cjs = require('./chunk-VDKWYUGC.cjs');
|
|
20
20
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
21
21
|
var chunk4WQYXT2I_cjs = require('./chunk-4WQYXT2I.cjs');
|
|
22
|
-
var
|
|
22
|
+
var chunkRO47SMI7_cjs = require('./chunk-RO47SMI7.cjs');
|
|
23
23
|
var chunk7XAECHYL_cjs = require('./chunk-7XAECHYL.cjs');
|
|
24
24
|
var chunk6SZKM6EC_cjs = require('./chunk-6SZKM6EC.cjs');
|
|
25
25
|
var z10 = require('zod');
|
|
@@ -1222,7 +1222,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1222
1222
|
writer
|
|
1223
1223
|
});
|
|
1224
1224
|
const mutations = messageList.stopRecording();
|
|
1225
|
-
if (result instanceof
|
|
1225
|
+
if (result instanceof chunkUE2G2LRP_cjs.MessageList) {
|
|
1226
1226
|
if (result !== messageList) {
|
|
1227
1227
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1228
1228
|
category: "USER",
|
|
@@ -1474,7 +1474,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1474
1474
|
retryCount
|
|
1475
1475
|
});
|
|
1476
1476
|
let mutations;
|
|
1477
|
-
if (result instanceof
|
|
1477
|
+
if (result instanceof chunkUE2G2LRP_cjs.MessageList) {
|
|
1478
1478
|
if (result !== messageList) {
|
|
1479
1479
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1480
1480
|
category: "USER",
|
|
@@ -1801,7 +1801,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1801
1801
|
writer
|
|
1802
1802
|
});
|
|
1803
1803
|
const mutations = messageList.stopRecording();
|
|
1804
|
-
if (result instanceof
|
|
1804
|
+
if (result instanceof chunkUE2G2LRP_cjs.MessageList) {
|
|
1805
1805
|
if (result !== messageList) {
|
|
1806
1806
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1807
1807
|
category: "USER",
|
|
@@ -1871,7 +1871,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1871
1871
|
processor,
|
|
1872
1872
|
stepNumber
|
|
1873
1873
|
}) {
|
|
1874
|
-
if (result instanceof
|
|
1874
|
+
if (result instanceof chunkUE2G2LRP_cjs.MessageList) {
|
|
1875
1875
|
if (result !== messageList) {
|
|
1876
1876
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1877
1877
|
category: "USER",
|
|
@@ -1906,7 +1906,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1906
1906
|
}
|
|
1907
1907
|
const { model: _model, ...rest } = result;
|
|
1908
1908
|
if (result.model) {
|
|
1909
|
-
const resolvedModel = await
|
|
1909
|
+
const resolvedModel = await chunkGCTAD6B7_cjs.resolveModelConfig(result.model);
|
|
1910
1910
|
const isSupported = isSupportedLanguageModel(resolvedModel);
|
|
1911
1911
|
if (!isSupported) {
|
|
1912
1912
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -2487,7 +2487,7 @@ function createDestructurableOutput(output) {
|
|
|
2487
2487
|
}
|
|
2488
2488
|
});
|
|
2489
2489
|
}
|
|
2490
|
-
var MastraModelOutput = class extends
|
|
2490
|
+
var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
2491
2491
|
#status = "running";
|
|
2492
2492
|
#error;
|
|
2493
2493
|
#baseStream;
|
|
@@ -2543,6 +2543,7 @@ var MastraModelOutput = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
2543
2543
|
#tripwire = void 0;
|
|
2544
2544
|
#delayedPromises = {
|
|
2545
2545
|
suspendPayload: new DelayedPromise(),
|
|
2546
|
+
resumeSchema: new DelayedPromise(),
|
|
2546
2547
|
object: new DelayedPromise(),
|
|
2547
2548
|
finishReason: new DelayedPromise(),
|
|
2548
2549
|
usage: new DelayedPromise(),
|
|
@@ -2692,6 +2693,7 @@ var MastraModelOutput = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
2692
2693
|
case "tool-call-approval":
|
|
2693
2694
|
self.#status = "suspended";
|
|
2694
2695
|
self.#delayedPromises.suspendPayload.resolve(chunk.payload);
|
|
2696
|
+
self.#delayedPromises.resumeSchema.resolve(chunk.payload.resumeSchema);
|
|
2695
2697
|
break;
|
|
2696
2698
|
case "raw":
|
|
2697
2699
|
if (!self.#options.includeRawChunks) {
|
|
@@ -2906,8 +2908,9 @@ var MastraModelOutput = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
2906
2908
|
steps: self.#bufferedSteps,
|
|
2907
2909
|
totalUsage: self.#usageCount,
|
|
2908
2910
|
content: [],
|
|
2909
|
-
suspendPayload: void 0
|
|
2911
|
+
suspendPayload: void 0,
|
|
2910
2912
|
// Tripwire doesn't suspend, so resolve to undefined
|
|
2913
|
+
resumeSchema: void 0
|
|
2911
2914
|
});
|
|
2912
2915
|
self.#emitChunk(chunk);
|
|
2913
2916
|
controller.enqueue(chunk);
|
|
@@ -2972,7 +2975,7 @@ var MastraModelOutput = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
2972
2975
|
);
|
|
2973
2976
|
const responseMessages = self.messageList.get.response.aiV4.core();
|
|
2974
2977
|
const lastResponseMessage = responseMessages[responseMessages.length - 1];
|
|
2975
|
-
const outputText = lastResponseMessage ?
|
|
2978
|
+
const outputText = lastResponseMessage ? chunkUE2G2LRP_cjs.coreContentToString(lastResponseMessage.content) : "";
|
|
2976
2979
|
if (lastStep && outputText && outputText !== originalText) {
|
|
2977
2980
|
lastStep.text = outputText;
|
|
2978
2981
|
}
|
|
@@ -3036,7 +3039,8 @@ var MastraModelOutput = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
3036
3039
|
steps: self.#bufferedSteps,
|
|
3037
3040
|
totalUsage: self.#getTotalUsage(),
|
|
3038
3041
|
content: messageList.get.response.aiV5.stepContent(),
|
|
3039
|
-
suspendPayload: void 0
|
|
3042
|
+
suspendPayload: void 0,
|
|
3043
|
+
resumeSchema: void 0
|
|
3040
3044
|
});
|
|
3041
3045
|
const baseFinishStep = self.#bufferedSteps[self.#bufferedSteps.length - 1];
|
|
3042
3046
|
if (baseFinishStep) {
|
|
@@ -3194,6 +3198,9 @@ var MastraModelOutput = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
3194
3198
|
get suspendPayload() {
|
|
3195
3199
|
return this.#getDelayedPromise(this.#delayedPromises.suspendPayload);
|
|
3196
3200
|
}
|
|
3201
|
+
get resumeSchema() {
|
|
3202
|
+
return this.#getDelayedPromise(this.#delayedPromises.resumeSchema);
|
|
3203
|
+
}
|
|
3197
3204
|
/**
|
|
3198
3205
|
* Stream of all chunks. Provides complete control over stream processing.
|
|
3199
3206
|
*/
|
|
@@ -3356,6 +3363,7 @@ var MastraModelOutput = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
3356
3363
|
traceId: this.traceId,
|
|
3357
3364
|
runId: this.runId,
|
|
3358
3365
|
suspendPayload: await this.suspendPayload,
|
|
3366
|
+
resumeSchema: await this.resumeSchema,
|
|
3359
3367
|
// All messages from this execution (input + memory history + response)
|
|
3360
3368
|
messages: this.messageList.get.all.db(),
|
|
3361
3369
|
// Only messages loaded from memory (conversation history)
|
|
@@ -4279,7 +4287,7 @@ function convertMastraChunkToAISDKv5({
|
|
|
4279
4287
|
if (mode === "generate") {
|
|
4280
4288
|
return {
|
|
4281
4289
|
type: "file",
|
|
4282
|
-
file: new
|
|
4290
|
+
file: new chunkUE2G2LRP_cjs.DefaultGeneratedFile({
|
|
4283
4291
|
data: chunk.payload.data,
|
|
4284
4292
|
mediaType: chunk.payload.mimeType
|
|
4285
4293
|
})
|
|
@@ -4287,7 +4295,7 @@ function convertMastraChunkToAISDKv5({
|
|
|
4287
4295
|
}
|
|
4288
4296
|
return {
|
|
4289
4297
|
type: "file",
|
|
4290
|
-
file: new
|
|
4298
|
+
file: new chunkUE2G2LRP_cjs.DefaultGeneratedFileWithType({
|
|
4291
4299
|
data: chunk.payload.data,
|
|
4292
4300
|
mediaType: chunk.payload.mimeType
|
|
4293
4301
|
})
|
|
@@ -4808,7 +4816,7 @@ var ProcessorStepOutputSchema = z10.z.object({
|
|
|
4808
4816
|
var ProcessorStepSchema = ProcessorStepInputSchema;
|
|
4809
4817
|
|
|
4810
4818
|
// src/workflows/execution-engine.ts
|
|
4811
|
-
var ExecutionEngine = class extends
|
|
4819
|
+
var ExecutionEngine = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
4812
4820
|
mastra;
|
|
4813
4821
|
options;
|
|
4814
4822
|
constructor({ mastra, options }) {
|
|
@@ -4818,6 +4826,10 @@ var ExecutionEngine = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
4818
4826
|
}
|
|
4819
4827
|
__registerMastra(mastra) {
|
|
4820
4828
|
this.mastra = mastra;
|
|
4829
|
+
const logger = mastra?.getLogger();
|
|
4830
|
+
if (logger) {
|
|
4831
|
+
this.__setLogger(logger);
|
|
4832
|
+
}
|
|
4821
4833
|
}
|
|
4822
4834
|
getLogger() {
|
|
4823
4835
|
return this.logger;
|
|
@@ -4897,7 +4909,7 @@ async function validateStepInput({
|
|
|
4897
4909
|
}) {
|
|
4898
4910
|
let inputData = prevOutput;
|
|
4899
4911
|
let validationError;
|
|
4900
|
-
if (validateInputs &&
|
|
4912
|
+
if (validateInputs && chunkOOCEAC6U_cjs.isZodType(step.inputSchema)) {
|
|
4901
4913
|
const inputSchema = step.inputSchema;
|
|
4902
4914
|
const validatedInput = await inputSchema.safeParseAsync(prevOutput);
|
|
4903
4915
|
if (!validatedInput.success) {
|
|
@@ -4926,7 +4938,7 @@ async function validateStepResumeData({ resumeData, step }) {
|
|
|
4926
4938
|
}
|
|
4927
4939
|
let validationError;
|
|
4928
4940
|
const resumeSchema = step.resumeSchema;
|
|
4929
|
-
if (resumeSchema &&
|
|
4941
|
+
if (resumeSchema && chunkOOCEAC6U_cjs.isZodType(resumeSchema)) {
|
|
4930
4942
|
const validatedResumeData = await resumeSchema.safeParseAsync(resumeData);
|
|
4931
4943
|
if (!validatedResumeData.success) {
|
|
4932
4944
|
const errors = getZodErrors(validatedResumeData.error);
|
|
@@ -4957,7 +4969,7 @@ async function validateStepSuspendData({
|
|
|
4957
4969
|
}
|
|
4958
4970
|
let validationError;
|
|
4959
4971
|
const suspendSchema = step.suspendSchema;
|
|
4960
|
-
if (suspendSchema && validateInputs &&
|
|
4972
|
+
if (suspendSchema && validateInputs && chunkOOCEAC6U_cjs.isZodType(suspendSchema)) {
|
|
4961
4973
|
const validatedSuspendData = await suspendSchema.safeParseAsync(suspendData);
|
|
4962
4974
|
if (!validatedSuspendData.success) {
|
|
4963
4975
|
const errors = getZodErrors(validatedSuspendData.error);
|
|
@@ -4988,7 +5000,7 @@ async function validateStepStateData({
|
|
|
4988
5000
|
}
|
|
4989
5001
|
let validationError;
|
|
4990
5002
|
const stateSchema = step.stateSchema;
|
|
4991
|
-
if (stateSchema && validateInputs &&
|
|
5003
|
+
if (stateSchema && validateInputs && chunkOOCEAC6U_cjs.isZodType(stateSchema)) {
|
|
4992
5004
|
const validatedStateData = await stateSchema.safeParseAsync(stateData);
|
|
4993
5005
|
if (!validatedStateData.success) {
|
|
4994
5006
|
const errors = getZodErrors(validatedStateData.error);
|
|
@@ -5007,7 +5019,7 @@ async function validateStepRequestContext({
|
|
|
5007
5019
|
}) {
|
|
5008
5020
|
let validationError;
|
|
5009
5021
|
const requestContextSchema = step.requestContextSchema;
|
|
5010
|
-
if (requestContextSchema && validateInputs &&
|
|
5022
|
+
if (requestContextSchema && validateInputs && chunkOOCEAC6U_cjs.isZodType(requestContextSchema)) {
|
|
5011
5023
|
const contextValues = requestContext?.all ?? {};
|
|
5012
5024
|
const validatedRequestContext = await requestContextSchema.safeParseAsync(contextValues);
|
|
5013
5025
|
if (!validatedRequestContext.success) {
|
|
@@ -5143,7 +5155,7 @@ var createTimeTravelExecutionParams = (params) => {
|
|
|
5143
5155
|
result = void 0;
|
|
5144
5156
|
}
|
|
5145
5157
|
if (result) {
|
|
5146
|
-
const formattedResult =
|
|
5158
|
+
const formattedResult = chunkOOCEAC6U_cjs.removeUndefinedValues(result);
|
|
5147
5159
|
stepResults[stepId] = formattedResult;
|
|
5148
5160
|
}
|
|
5149
5161
|
});
|
|
@@ -5703,7 +5715,7 @@ async function executeLoop(engine, params) {
|
|
|
5703
5715
|
options: {
|
|
5704
5716
|
type: "workflow_conditional_eval" /* WORKFLOW_CONDITIONAL_EVAL */,
|
|
5705
5717
|
name: `condition: '${entry.loopType}'`,
|
|
5706
|
-
input:
|
|
5718
|
+
input: chunkOOCEAC6U_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
|
|
5707
5719
|
attributes: {
|
|
5708
5720
|
conditionIndex: iteration
|
|
5709
5721
|
},
|
|
@@ -7770,10 +7782,10 @@ function isAgent(input) {
|
|
|
7770
7782
|
return input instanceof Agent;
|
|
7771
7783
|
}
|
|
7772
7784
|
function isToolStep(input) {
|
|
7773
|
-
return input instanceof
|
|
7785
|
+
return input instanceof chunk7UWHFWST_cjs.Tool;
|
|
7774
7786
|
}
|
|
7775
7787
|
function isStepParams(input) {
|
|
7776
|
-
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof
|
|
7788
|
+
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof chunk7UWHFWST_cjs.Tool);
|
|
7777
7789
|
}
|
|
7778
7790
|
function createStep(params, agentOrToolOptions) {
|
|
7779
7791
|
if (isAgent(params)) {
|
|
@@ -7802,13 +7814,14 @@ function createStepFromParams(params) {
|
|
|
7802
7814
|
requestContextSchema: params.requestContextSchema,
|
|
7803
7815
|
scorers: params.scorers,
|
|
7804
7816
|
retries: params.retries,
|
|
7817
|
+
metadata: params.metadata,
|
|
7805
7818
|
execute: params.execute.bind(params)
|
|
7806
7819
|
};
|
|
7807
7820
|
}
|
|
7808
7821
|
function createStepFromAgent(params, agentOrToolOptions) {
|
|
7809
7822
|
const options = agentOrToolOptions ?? {};
|
|
7810
7823
|
const outputSchema = options?.structuredOutput?.schema ?? z10.z.object({ text: z10.z.string() });
|
|
7811
|
-
const { retries, scorers, ...agentOptions } = options ?? {};
|
|
7824
|
+
const { retries, scorers, metadata, ...agentOptions } = options ?? {};
|
|
7812
7825
|
return {
|
|
7813
7826
|
id: params.id,
|
|
7814
7827
|
description: params.getDescription(),
|
|
@@ -7818,6 +7831,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
|
|
|
7818
7831
|
outputSchema,
|
|
7819
7832
|
retries,
|
|
7820
7833
|
scorers,
|
|
7834
|
+
metadata,
|
|
7821
7835
|
execute: async ({
|
|
7822
7836
|
inputData,
|
|
7823
7837
|
runId,
|
|
@@ -7943,6 +7957,7 @@ function createStepFromTool(params, toolOpts) {
|
|
|
7943
7957
|
suspendSchema: params.suspendSchema,
|
|
7944
7958
|
retries: toolOpts?.retries,
|
|
7945
7959
|
scorers: toolOpts?.scorers,
|
|
7960
|
+
metadata: toolOpts?.metadata,
|
|
7946
7961
|
execute: async ({
|
|
7947
7962
|
inputData,
|
|
7948
7963
|
mastra,
|
|
@@ -8107,7 +8122,7 @@ function createStepFromProcessor(processor) {
|
|
|
8107
8122
|
phase,
|
|
8108
8123
|
// Auto-create MessageList from messages if not provided
|
|
8109
8124
|
// This enables running processor workflows from the UI where messageList can't be serialized
|
|
8110
|
-
messageList: messageList ?? (Array.isArray(messages) ? new
|
|
8125
|
+
messageList: messageList ?? (Array.isArray(messages) ? new chunkUE2G2LRP_cjs.MessageList().add(messages, "input").addSystem(systemMessages ?? []) : void 0),
|
|
8111
8126
|
stepNumber,
|
|
8112
8127
|
systemMessages,
|
|
8113
8128
|
streamParts,
|
|
@@ -8161,7 +8176,7 @@ function createStepFromProcessor(processor) {
|
|
|
8161
8176
|
messageList: checkedMessageList,
|
|
8162
8177
|
systemMessages: systemMessages ?? []
|
|
8163
8178
|
});
|
|
8164
|
-
if (result instanceof
|
|
8179
|
+
if (result instanceof chunkUE2G2LRP_cjs.MessageList) {
|
|
8165
8180
|
if (result !== checkedMessageList) {
|
|
8166
8181
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
8167
8182
|
category: "USER" /* USER */,
|
|
@@ -8325,7 +8340,7 @@ function createStepFromProcessor(processor) {
|
|
|
8325
8340
|
messages,
|
|
8326
8341
|
messageList: passThrough.messageList
|
|
8327
8342
|
});
|
|
8328
|
-
if (result instanceof
|
|
8343
|
+
if (result instanceof chunkUE2G2LRP_cjs.MessageList) {
|
|
8329
8344
|
if (result !== passThrough.messageList) {
|
|
8330
8345
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
8331
8346
|
category: "USER" /* USER */,
|
|
@@ -8392,7 +8407,7 @@ function createStepFromProcessor(processor) {
|
|
|
8392
8407
|
systemMessages: systemMessages ?? [],
|
|
8393
8408
|
steps: steps ?? []
|
|
8394
8409
|
});
|
|
8395
|
-
if (result instanceof
|
|
8410
|
+
if (result instanceof chunkUE2G2LRP_cjs.MessageList) {
|
|
8396
8411
|
if (result !== checkedMessageList) {
|
|
8397
8412
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
8398
8413
|
category: "USER" /* USER */,
|
|
@@ -8455,11 +8470,12 @@ function cloneStep(step, opts) {
|
|
|
8455
8470
|
execute: step.execute,
|
|
8456
8471
|
retries: step.retries,
|
|
8457
8472
|
scorers: step.scorers,
|
|
8458
|
-
component: step.component
|
|
8473
|
+
component: step.component,
|
|
8474
|
+
metadata: step.metadata
|
|
8459
8475
|
};
|
|
8460
8476
|
}
|
|
8461
8477
|
function isProcessor(obj) {
|
|
8462
|
-
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof
|
|
8478
|
+
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof chunk7UWHFWST_cjs.Tool) && (typeof obj.processInput === "function" || typeof obj.processInputStep === "function" || typeof obj.processOutputStream === "function" || typeof obj.processOutputResult === "function" || typeof obj.processOutputStep === "function");
|
|
8463
8479
|
}
|
|
8464
8480
|
function createWorkflow(params) {
|
|
8465
8481
|
return new Workflow(params);
|
|
@@ -8477,7 +8493,7 @@ function cloneWorkflow(workflow, opts) {
|
|
|
8477
8493
|
wf.commit();
|
|
8478
8494
|
return wf;
|
|
8479
8495
|
}
|
|
8480
|
-
var Workflow = class extends
|
|
8496
|
+
var Workflow = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
8481
8497
|
id;
|
|
8482
8498
|
description;
|
|
8483
8499
|
inputSchema;
|
|
@@ -8582,6 +8598,7 @@ var Workflow = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
8582
8598
|
step: {
|
|
8583
8599
|
id: step.id,
|
|
8584
8600
|
description: step.description,
|
|
8601
|
+
metadata: step.metadata,
|
|
8585
8602
|
component: step.component,
|
|
8586
8603
|
serializedStepFlow: step.serializedStepFlow,
|
|
8587
8604
|
canSuspend: Boolean(step.suspendSchema || step.resumeSchema)
|
|
@@ -8751,6 +8768,7 @@ var Workflow = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
8751
8768
|
step: {
|
|
8752
8769
|
id: step.id,
|
|
8753
8770
|
description: step.description,
|
|
8771
|
+
metadata: step.metadata,
|
|
8754
8772
|
component: step.component,
|
|
8755
8773
|
serializedStepFlow: step.serializedStepFlow,
|
|
8756
8774
|
canSuspend: Boolean(step.suspendSchema || step.resumeSchema)
|
|
@@ -8778,6 +8796,7 @@ var Workflow = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
8778
8796
|
step: {
|
|
8779
8797
|
id: step.id,
|
|
8780
8798
|
description: step.description,
|
|
8799
|
+
metadata: step.metadata,
|
|
8781
8800
|
component: step.component,
|
|
8782
8801
|
serializedStepFlow: step.serializedStepFlow,
|
|
8783
8802
|
canSuspend: Boolean(step.suspendSchema || step.resumeSchema)
|
|
@@ -8803,6 +8822,7 @@ var Workflow = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
8803
8822
|
step: {
|
|
8804
8823
|
id: step.id,
|
|
8805
8824
|
description: step.description,
|
|
8825
|
+
metadata: step.metadata,
|
|
8806
8826
|
component: step.component,
|
|
8807
8827
|
serializedStepFlow: step.serializedStepFlow,
|
|
8808
8828
|
canSuspend: Boolean(step.suspendSchema || step.resumeSchema)
|
|
@@ -8826,6 +8846,7 @@ var Workflow = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
8826
8846
|
step: {
|
|
8827
8847
|
id: step.id,
|
|
8828
8848
|
description: step.description,
|
|
8849
|
+
metadata: step.metadata,
|
|
8829
8850
|
component: step.component,
|
|
8830
8851
|
serializedStepFlow: step.serializedStepFlow,
|
|
8831
8852
|
canSuspend: Boolean(step.suspendSchema || step.resumeSchema)
|
|
@@ -8844,6 +8865,7 @@ var Workflow = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
8844
8865
|
step: {
|
|
8845
8866
|
id: step.id,
|
|
8846
8867
|
description: step.description,
|
|
8868
|
+
metadata: step.metadata,
|
|
8847
8869
|
component: step.component,
|
|
8848
8870
|
serializedStepFlow: step.serializedStepFlow,
|
|
8849
8871
|
canSuspend: Boolean(actualStep.suspendSchema || actualStep.resumeSchema)
|
|
@@ -9427,7 +9449,7 @@ var Run = class {
|
|
|
9427
9449
|
}
|
|
9428
9450
|
async _validateInput(inputData) {
|
|
9429
9451
|
let inputDataToUse = inputData;
|
|
9430
|
-
if (this.validateInputs && this.inputSchema &&
|
|
9452
|
+
if (this.validateInputs && this.inputSchema && chunkOOCEAC6U_cjs.isZodType(this.inputSchema)) {
|
|
9431
9453
|
const validatedInputData = await this.inputSchema.safeParseAsync(inputData);
|
|
9432
9454
|
if (!validatedInputData.success) {
|
|
9433
9455
|
const errors = getZodErrors(validatedInputData.error);
|
|
@@ -9441,7 +9463,7 @@ var Run = class {
|
|
|
9441
9463
|
let initialStateToUse = initialState;
|
|
9442
9464
|
if (this.validateInputs) {
|
|
9443
9465
|
let stateSchema = this.stateSchema;
|
|
9444
|
-
if (stateSchema &&
|
|
9466
|
+
if (stateSchema && chunkOOCEAC6U_cjs.isZodType(stateSchema)) {
|
|
9445
9467
|
const validatedInitialState = await stateSchema.safeParseAsync(initialState);
|
|
9446
9468
|
if (!validatedInitialState.success) {
|
|
9447
9469
|
const errors = getZodErrors(validatedInitialState.error);
|
|
@@ -9455,7 +9477,7 @@ var Run = class {
|
|
|
9455
9477
|
return initialStateToUse;
|
|
9456
9478
|
}
|
|
9457
9479
|
async _validateRequestContext(requestContext) {
|
|
9458
|
-
if (this.validateInputs && this.requestContextSchema &&
|
|
9480
|
+
if (this.validateInputs && this.requestContextSchema && chunkOOCEAC6U_cjs.isZodType(this.requestContextSchema)) {
|
|
9459
9481
|
const contextValues = requestContext?.all ?? {};
|
|
9460
9482
|
const validatedRequestContext = await this.requestContextSchema.safeParseAsync(contextValues);
|
|
9461
9483
|
if (!validatedRequestContext.success) {
|
|
@@ -9469,7 +9491,7 @@ var Run = class {
|
|
|
9469
9491
|
}
|
|
9470
9492
|
async _validateResumeData(resumeData, suspendedStep) {
|
|
9471
9493
|
let resumeDataToUse = resumeData;
|
|
9472
|
-
if (suspendedStep && suspendedStep.resumeSchema && this.validateInputs &&
|
|
9494
|
+
if (suspendedStep && suspendedStep.resumeSchema && this.validateInputs && chunkOOCEAC6U_cjs.isZodType(suspendedStep.resumeSchema)) {
|
|
9473
9495
|
const resumeSchema = suspendedStep.resumeSchema;
|
|
9474
9496
|
const validatedResumeData = await resumeSchema.safeParseAsync(resumeData);
|
|
9475
9497
|
if (!validatedResumeData.success) {
|
|
@@ -9482,7 +9504,7 @@ var Run = class {
|
|
|
9482
9504
|
}
|
|
9483
9505
|
async _validateTimetravelInputData(inputData, step) {
|
|
9484
9506
|
let inputDataToUse = inputData;
|
|
9485
|
-
if (step && step.inputSchema && this.validateInputs &&
|
|
9507
|
+
if (step && step.inputSchema && this.validateInputs && chunkOOCEAC6U_cjs.isZodType(step.inputSchema)) {
|
|
9486
9508
|
const inputSchema = step.inputSchema;
|
|
9487
9509
|
const validatedInputData = await inputSchema.safeParseAsync(inputData);
|
|
9488
9510
|
if (!validatedInputData.success) {
|
|
@@ -10433,7 +10455,7 @@ var PrepareStepProcessor = class {
|
|
|
10433
10455
|
};
|
|
10434
10456
|
|
|
10435
10457
|
// src/stream/base/input.ts
|
|
10436
|
-
var MastraModelInput = class extends
|
|
10458
|
+
var MastraModelInput = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
10437
10459
|
initialize({ runId, createStream, onResult }) {
|
|
10438
10460
|
const self = this;
|
|
10439
10461
|
const stream = new ReadableStream({
|
|
@@ -11121,6 +11143,7 @@ function createLLMExecutionStep({
|
|
|
11121
11143
|
modelSpanTracker,
|
|
11122
11144
|
autoResumeSuspendedTools,
|
|
11123
11145
|
maxProcessorRetries,
|
|
11146
|
+
workspace,
|
|
11124
11147
|
outputWriter
|
|
11125
11148
|
}) {
|
|
11126
11149
|
const initialSystemMessages = messageList.getAllSystemMessages();
|
|
@@ -11134,7 +11157,7 @@ function createLLMExecutionStep({
|
|
|
11134
11157
|
let warnings;
|
|
11135
11158
|
let request;
|
|
11136
11159
|
let rawResponse;
|
|
11137
|
-
const { outputStream, callBail, runState, stepTools } = await executeStreamWithFallbackModels(
|
|
11160
|
+
const { outputStream, callBail, runState, stepTools, stepWorkspace } = await executeStreamWithFallbackModels(
|
|
11138
11161
|
models,
|
|
11139
11162
|
logger
|
|
11140
11163
|
)(async (modelConfig, isLastModel) => {
|
|
@@ -11153,7 +11176,8 @@ function createLLMExecutionStep({
|
|
|
11153
11176
|
activeTools,
|
|
11154
11177
|
providerOptions,
|
|
11155
11178
|
modelSettings,
|
|
11156
|
-
structuredOutput
|
|
11179
|
+
structuredOutput,
|
|
11180
|
+
workspace
|
|
11157
11181
|
};
|
|
11158
11182
|
const inputStepProcessors = [
|
|
11159
11183
|
...inputProcessors || [],
|
|
@@ -11439,10 +11463,17 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
11439
11463
|
throw error;
|
|
11440
11464
|
}
|
|
11441
11465
|
}
|
|
11442
|
-
return {
|
|
11466
|
+
return {
|
|
11467
|
+
outputStream: outputStream2,
|
|
11468
|
+
callBail: false,
|
|
11469
|
+
runState: runState2,
|
|
11470
|
+
stepTools: currentStep.tools,
|
|
11471
|
+
stepWorkspace: currentStep.workspace
|
|
11472
|
+
};
|
|
11443
11473
|
});
|
|
11444
11474
|
if (_internal) {
|
|
11445
11475
|
_internal.stepTools = stepTools;
|
|
11476
|
+
_internal.stepWorkspace = stepWorkspace ?? _internal.stepWorkspace;
|
|
11446
11477
|
}
|
|
11447
11478
|
if (callBail) {
|
|
11448
11479
|
const usage2 = outputStream._getImmediateUsage();
|
|
@@ -11594,6 +11625,9 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
11594
11625
|
tripwire: stepTripwireData
|
|
11595
11626
|
})
|
|
11596
11627
|
);
|
|
11628
|
+
if (shouldRetry) {
|
|
11629
|
+
messageList.removeByIds([messageId]);
|
|
11630
|
+
}
|
|
11597
11631
|
const retryFeedbackText = shouldRetry && processOutputStepTripwire ? `[Processor Feedback] Your previous response was not accepted: ${processOutputStepTripwire.message}. Please try again with the feedback in mind.` : void 0;
|
|
11598
11632
|
const messages = {
|
|
11599
11633
|
all: messageList.get.all.aiV5.model(),
|
|
@@ -11829,7 +11863,8 @@ function createToolCallStep({
|
|
|
11829
11863
|
args,
|
|
11830
11864
|
suspendPayload,
|
|
11831
11865
|
resumeSchema,
|
|
11832
|
-
type
|
|
11866
|
+
type,
|
|
11867
|
+
suspendedToolRunId
|
|
11833
11868
|
}) => {
|
|
11834
11869
|
const metadataKey = type === "suspension" ? "suspendedTools" : "pendingToolApprovals";
|
|
11835
11870
|
const responseMessages = messageList.get.response.db();
|
|
@@ -11844,7 +11879,7 @@ function createToolCallStep({
|
|
|
11844
11879
|
toolName,
|
|
11845
11880
|
args,
|
|
11846
11881
|
type,
|
|
11847
|
-
runId,
|
|
11882
|
+
runId: suspendedToolRunId ?? runId,
|
|
11848
11883
|
// Store the runId so we can resume after page refresh
|
|
11849
11884
|
...type === "suspension" ? { suspendPayload } : {},
|
|
11850
11885
|
resumeSchema
|
|
@@ -12064,42 +12099,122 @@ function createToolCallStep({
|
|
|
12064
12099
|
outputWriter,
|
|
12065
12100
|
// Pass current step span as parent for tool call spans
|
|
12066
12101
|
tracingContext: modelSpanTracker?.getTracingContext(),
|
|
12102
|
+
// Pass workspace from _internal (set by llmExecutionStep via prepareStep/processInputStep)
|
|
12103
|
+
workspace: _internal?.stepWorkspace,
|
|
12067
12104
|
suspend: async (suspendPayload, options2) => {
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12105
|
+
if (options2?.requireToolApproval) {
|
|
12106
|
+
controller.enqueue({
|
|
12107
|
+
type: "tool-call-approval",
|
|
12108
|
+
runId,
|
|
12109
|
+
from: "AGENT" /* AGENT */,
|
|
12110
|
+
payload: {
|
|
12111
|
+
toolCallId: inputData.toolCallId,
|
|
12112
|
+
toolName: inputData.toolName,
|
|
12113
|
+
args: inputData.args,
|
|
12114
|
+
resumeSchema: JSON.stringify(
|
|
12115
|
+
zodToJson.zodToJsonSchema(
|
|
12116
|
+
z10__default.default.object({
|
|
12117
|
+
approved: z10__default.default.boolean().describe(
|
|
12118
|
+
"Controls if the tool call is approved or not, should be true when approved and false when declined"
|
|
12119
|
+
)
|
|
12120
|
+
})
|
|
12121
|
+
)
|
|
12122
|
+
)
|
|
12123
|
+
}
|
|
12124
|
+
});
|
|
12125
|
+
addToolMetadata({
|
|
12073
12126
|
toolCallId: inputData.toolCallId,
|
|
12074
12127
|
toolName: inputData.toolName,
|
|
12075
|
-
suspendPayload,
|
|
12076
12128
|
args: inputData.args,
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12091
|
-
|
|
12092
|
-
|
|
12129
|
+
type: "approval",
|
|
12130
|
+
suspendedToolRunId: options2.runId,
|
|
12131
|
+
resumeSchema: JSON.stringify(
|
|
12132
|
+
zodToJson.zodToJsonSchema(
|
|
12133
|
+
z10__default.default.object({
|
|
12134
|
+
approved: z10__default.default.boolean().describe(
|
|
12135
|
+
"Controls if the tool call is approved or not, should be true when approved and false when declined"
|
|
12136
|
+
)
|
|
12137
|
+
})
|
|
12138
|
+
)
|
|
12139
|
+
)
|
|
12140
|
+
});
|
|
12141
|
+
await flushMessagesBeforeSuspension();
|
|
12142
|
+
return suspend(
|
|
12143
|
+
{
|
|
12144
|
+
requireToolApproval: {
|
|
12145
|
+
toolCallId: inputData.toolCallId,
|
|
12146
|
+
toolName: inputData.toolName,
|
|
12147
|
+
args: inputData.args
|
|
12148
|
+
},
|
|
12149
|
+
__streamState: streamState.serialize()
|
|
12150
|
+
},
|
|
12151
|
+
{
|
|
12152
|
+
resumeLabel: inputData.toolCallId
|
|
12153
|
+
}
|
|
12154
|
+
);
|
|
12155
|
+
} else {
|
|
12156
|
+
controller.enqueue({
|
|
12157
|
+
type: "tool-call-suspended",
|
|
12158
|
+
runId,
|
|
12159
|
+
from: "AGENT" /* AGENT */,
|
|
12160
|
+
payload: {
|
|
12161
|
+
toolCallId: inputData.toolCallId,
|
|
12162
|
+
toolName: inputData.toolName,
|
|
12163
|
+
suspendPayload,
|
|
12164
|
+
args: inputData.args,
|
|
12165
|
+
resumeSchema: options2?.resumeSchema
|
|
12166
|
+
}
|
|
12167
|
+
});
|
|
12168
|
+
addToolMetadata({
|
|
12169
|
+
toolCallId: inputData.toolCallId,
|
|
12093
12170
|
toolName: inputData.toolName,
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12171
|
+
args,
|
|
12172
|
+
suspendPayload,
|
|
12173
|
+
suspendedToolRunId: options2?.isAgentSuspend ? options2.runId : void 0,
|
|
12174
|
+
type: "suspension",
|
|
12175
|
+
resumeSchema: options2?.resumeSchema
|
|
12176
|
+
});
|
|
12177
|
+
await flushMessagesBeforeSuspension();
|
|
12178
|
+
return await suspend(
|
|
12179
|
+
{
|
|
12180
|
+
toolCallSuspended: suspendPayload,
|
|
12181
|
+
__streamState: streamState.serialize(),
|
|
12182
|
+
toolName: inputData.toolName,
|
|
12183
|
+
resumeLabel: options2?.resumeLabel
|
|
12184
|
+
},
|
|
12185
|
+
{
|
|
12186
|
+
resumeLabel: inputData.toolCallId
|
|
12187
|
+
}
|
|
12188
|
+
);
|
|
12189
|
+
}
|
|
12100
12190
|
},
|
|
12101
12191
|
resumeData: resumeDataToPassToToolOptions
|
|
12102
12192
|
};
|
|
12193
|
+
if (resumeDataToPassToToolOptions && inputData.toolName?.startsWith("agent-") && !isResumeToolCall) {
|
|
12194
|
+
let suspendedToolRunId = "";
|
|
12195
|
+
const messages = messageList.get.all.db();
|
|
12196
|
+
const assistantMessages = [...messages].reverse().filter((message) => message.role === "assistant");
|
|
12197
|
+
for (const message of assistantMessages) {
|
|
12198
|
+
const pendingOrSuspendedTools = message.content.metadata?.suspendedTools || message.content.metadata?.pendingToolApprovals;
|
|
12199
|
+
if (pendingOrSuspendedTools && pendingOrSuspendedTools[inputData.toolName]) {
|
|
12200
|
+
suspendedToolRunId = pendingOrSuspendedTools[inputData.toolName].runId;
|
|
12201
|
+
break;
|
|
12202
|
+
}
|
|
12203
|
+
const dataToolSuspendedParts = message.content.parts?.filter(
|
|
12204
|
+
(part) => (part.type === "data-tool-call-suspended" || part.type === "data-tool-call-approval") && !part.data.resumed
|
|
12205
|
+
);
|
|
12206
|
+
if (dataToolSuspendedParts && dataToolSuspendedParts.length > 0) {
|
|
12207
|
+
const foundTool = dataToolSuspendedParts.find((part) => part.data.toolName === inputData.toolName);
|
|
12208
|
+
if (foundTool) {
|
|
12209
|
+
suspendedToolRunId = foundTool.data.runId;
|
|
12210
|
+
break;
|
|
12211
|
+
}
|
|
12212
|
+
}
|
|
12213
|
+
}
|
|
12214
|
+
if (suspendedToolRunId) {
|
|
12215
|
+
args.suspendedToolRunId = suspendedToolRunId;
|
|
12216
|
+
}
|
|
12217
|
+
}
|
|
12103
12218
|
const result = await tool2.execute(args, toolOptions);
|
|
12104
12219
|
if (tool2 && "onOutput" in tool2 && typeof tool2.onOutput === "function") {
|
|
12105
12220
|
try {
|
|
@@ -12602,6 +12717,12 @@ var MastraScorer = class _MastraScorer {
|
|
|
12602
12717
|
}
|
|
12603
12718
|
}
|
|
12604
12719
|
#mastra;
|
|
12720
|
+
#rawConfig;
|
|
12721
|
+
/**
|
|
12722
|
+
* Tracks whether this scorer was defined in code or loaded from storage.
|
|
12723
|
+
* Set by `Mastra.addScorer()` when the `source` option is provided.
|
|
12724
|
+
*/
|
|
12725
|
+
source;
|
|
12605
12726
|
/**
|
|
12606
12727
|
* Registers the Mastra instance with the scorer.
|
|
12607
12728
|
* This enables access to custom gateways for model resolution.
|
|
@@ -12610,6 +12731,20 @@ var MastraScorer = class _MastraScorer {
|
|
|
12610
12731
|
__registerMastra(mastra) {
|
|
12611
12732
|
this.#mastra = mastra;
|
|
12612
12733
|
}
|
|
12734
|
+
/**
|
|
12735
|
+
* Returns the raw storage configuration this scorer was created from,
|
|
12736
|
+
* or undefined if it was created from code.
|
|
12737
|
+
*/
|
|
12738
|
+
toRawConfig() {
|
|
12739
|
+
return this.#rawConfig;
|
|
12740
|
+
}
|
|
12741
|
+
/**
|
|
12742
|
+
* Sets the raw storage configuration for this scorer.
|
|
12743
|
+
* @internal
|
|
12744
|
+
*/
|
|
12745
|
+
__setRawConfig(rawConfig) {
|
|
12746
|
+
this.#rawConfig = rawConfig;
|
|
12747
|
+
}
|
|
12613
12748
|
get type() {
|
|
12614
12749
|
return this.config.type;
|
|
12615
12750
|
}
|
|
@@ -12860,7 +12995,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
12860
12995
|
}
|
|
12861
12996
|
});
|
|
12862
12997
|
}
|
|
12863
|
-
const resolvedModel = await
|
|
12998
|
+
const resolvedModel = await chunkGCTAD6B7_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
|
|
12864
12999
|
const judge = new Agent({
|
|
12865
13000
|
id: "judge",
|
|
12866
13001
|
name: "judge",
|
|
@@ -13281,7 +13416,7 @@ async function generateStructuredFinalResult(agent, context, structuredOutputOpt
|
|
|
13281
13416
|
}
|
|
13282
13417
|
|
|
13283
13418
|
// src/llm/model/model.loop.ts
|
|
13284
|
-
var MastraLLMVNext = class extends
|
|
13419
|
+
var MastraLLMVNext = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
13285
13420
|
#models;
|
|
13286
13421
|
#mastra;
|
|
13287
13422
|
#options;
|
|
@@ -13403,7 +13538,8 @@ var MastraLLMVNext = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
13403
13538
|
autoResumeSuspendedTools,
|
|
13404
13539
|
maxProcessorRetries,
|
|
13405
13540
|
processorStates,
|
|
13406
|
-
activeTools
|
|
13541
|
+
activeTools,
|
|
13542
|
+
workspace
|
|
13407
13543
|
}) {
|
|
13408
13544
|
let stopWhenToUse;
|
|
13409
13545
|
if (maxSteps && typeof maxSteps === "number") {
|
|
@@ -13470,6 +13606,7 @@ var MastraLLMVNext = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
13470
13606
|
maxProcessorRetries,
|
|
13471
13607
|
processorStates,
|
|
13472
13608
|
activeTools,
|
|
13609
|
+
workspace,
|
|
13473
13610
|
options: {
|
|
13474
13611
|
...options,
|
|
13475
13612
|
onStepFinish: async (props) => {
|
|
@@ -13510,7 +13647,7 @@ var MastraLLMVNext = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
13510
13647
|
const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
|
|
13511
13648
|
if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
|
|
13512
13649
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
13513
|
-
await
|
|
13650
|
+
await chunkOOCEAC6U_cjs.delay(10 * 1e3);
|
|
13514
13651
|
}
|
|
13515
13652
|
},
|
|
13516
13653
|
onFinish: async (props) => {
|
|
@@ -13642,6 +13779,7 @@ async function getRoutingAgent({
|
|
|
13642
13779
|
const toolsToUse = await agent.listTools({ requestContext });
|
|
13643
13780
|
const model = await agent.getModel({ requestContext });
|
|
13644
13781
|
const memoryToUse = await agent.getMemory({ requestContext });
|
|
13782
|
+
const clientToolsToUse = (await agent.getDefaultOptions({ requestContext }))?.clientTools;
|
|
13645
13783
|
const configuredInputProcessors = await agent.listConfiguredInputProcessors(requestContext);
|
|
13646
13784
|
const configuredOutputProcessors = await agent.listConfiguredOutputProcessors(requestContext);
|
|
13647
13785
|
const agentList = Object.entries(agentsToUse).map(([name, agent2]) => {
|
|
@@ -13653,7 +13791,7 @@ async function getRoutingAgent({
|
|
|
13653
13791
|
)}`;
|
|
13654
13792
|
}).join("\n");
|
|
13655
13793
|
const memoryTools = await memoryToUse?.listTools?.();
|
|
13656
|
-
const toolList = Object.entries({ ...toolsToUse, ...memoryTools }).map(([name, tool2]) => {
|
|
13794
|
+
const toolList = Object.entries({ ...toolsToUse, ...memoryTools, ...clientToolsToUse || {} }).map(([name, tool2]) => {
|
|
13657
13795
|
const inputSchema = "inputSchema" in tool2 ? tool2.inputSchema ?? z10__default.default.object({}) : z10__default.default.object({});
|
|
13658
13796
|
return ` - **${name}**: ${tool2.description}, input schema: ${JSON.stringify(chunk4WQYXT2I_cjs.zodToJsonSchema(inputSchema))}`;
|
|
13659
13797
|
}).join("\n");
|
|
@@ -13772,7 +13910,7 @@ async function prepareMemoryStep({
|
|
|
13772
13910
|
);
|
|
13773
13911
|
}
|
|
13774
13912
|
} else {
|
|
13775
|
-
const messageList = new
|
|
13913
|
+
const messageList = new chunkUE2G2LRP_cjs.MessageList({
|
|
13776
13914
|
threadId: thread?.id,
|
|
13777
13915
|
resourceId: thread?.resourceId
|
|
13778
13916
|
});
|
|
@@ -13835,7 +13973,7 @@ async function saveMessagesWithProcessors(memory, messages, processorRunner, con
|
|
|
13835
13973
|
await memory.saveMessages({ messages });
|
|
13836
13974
|
return;
|
|
13837
13975
|
}
|
|
13838
|
-
const messageList = new
|
|
13976
|
+
const messageList = new chunkUE2G2LRP_cjs.MessageList();
|
|
13839
13977
|
for (const msg of messages) {
|
|
13840
13978
|
messageList.add(msg, "response");
|
|
13841
13979
|
}
|
|
@@ -14040,20 +14178,6 @@ async function createNetworkLoop({
|
|
|
14040
14178
|
});
|
|
14041
14179
|
}
|
|
14042
14180
|
const isComplete = object.primitiveId === "none" && object.primitiveType === "none";
|
|
14043
|
-
if (isComplete && object.selectionReason) {
|
|
14044
|
-
await writer.write({
|
|
14045
|
-
type: "routing-agent-text-start",
|
|
14046
|
-
payload: { runId: stepId },
|
|
14047
|
-
from: "NETWORK" /* NETWORK */,
|
|
14048
|
-
runId
|
|
14049
|
-
});
|
|
14050
|
-
await writer.write({
|
|
14051
|
-
type: "routing-agent-text-delta",
|
|
14052
|
-
payload: { runId: stepId, text: object.selectionReason },
|
|
14053
|
-
from: "NETWORK" /* NETWORK */,
|
|
14054
|
-
runId
|
|
14055
|
-
});
|
|
14056
|
-
}
|
|
14057
14181
|
const conversationContext = filterMessagesForSubAgent(result.rememberedMessages ?? []);
|
|
14058
14182
|
const endPayload = {
|
|
14059
14183
|
task: inputData.task,
|
|
@@ -14706,7 +14830,8 @@ async function createNetworkLoop({
|
|
|
14706
14830
|
const agentTools = await agent.listTools({ requestContext });
|
|
14707
14831
|
const memory = await agent.getMemory({ requestContext });
|
|
14708
14832
|
const memoryTools = await memory?.listTools?.();
|
|
14709
|
-
const
|
|
14833
|
+
const clientTools = (await agent.getDefaultOptions({ requestContext }))?.clientTools;
|
|
14834
|
+
const toolsMap = { ...agentTools, ...memoryTools, ...clientTools || {} };
|
|
14710
14835
|
let tool2 = toolsMap[inputData.primitiveId];
|
|
14711
14836
|
if (!tool2) {
|
|
14712
14837
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -15306,7 +15431,7 @@ async function networkLoop({
|
|
|
15306
15431
|
"resumeData": "string"
|
|
15307
15432
|
}
|
|
15308
15433
|
`;
|
|
15309
|
-
const messageList = new
|
|
15434
|
+
const messageList = new chunkUE2G2LRP_cjs.MessageList();
|
|
15310
15435
|
messageList.addSystem(systemInstructions);
|
|
15311
15436
|
messageList.add(task, "user");
|
|
15312
15437
|
const result = llm.stream({
|
|
@@ -15871,7 +15996,7 @@ ${skillInstructions}`;
|
|
|
15871
15996
|
createSkillActivateTool() {
|
|
15872
15997
|
const skills = this.skills;
|
|
15873
15998
|
const activatedSkills = this._activatedSkills;
|
|
15874
|
-
return
|
|
15999
|
+
return chunk7UWHFWST_cjs.createTool({
|
|
15875
16000
|
id: "skill-activate",
|
|
15876
16001
|
description: "Activate a skill to load its full instructions. You should activate skills proactively when they are relevant to the user's request without asking for permission first.",
|
|
15877
16002
|
inputSchema: z10__default.default.object({
|
|
@@ -15912,7 +16037,7 @@ ${skillInstructions}`;
|
|
|
15912
16037
|
createSkillReadReferenceTool() {
|
|
15913
16038
|
const skills = this.skills;
|
|
15914
16039
|
const activatedSkills = this._activatedSkills;
|
|
15915
|
-
return
|
|
16040
|
+
return chunk7UWHFWST_cjs.createTool({
|
|
15916
16041
|
id: "skill-read-reference",
|
|
15917
16042
|
description: "Read a reference file from an activated skill. Optionally specify line range to read a portion of the file.",
|
|
15918
16043
|
inputSchema: z10__default.default.object({
|
|
@@ -15942,7 +16067,7 @@ ${skillInstructions}`;
|
|
|
15942
16067
|
message: `Reference file "${referencePath}" not found in skill "${skillName}". Available references: ${availableRefs.join(", ") || "none"}`
|
|
15943
16068
|
};
|
|
15944
16069
|
}
|
|
15945
|
-
const result =
|
|
16070
|
+
const result = chunkCGPH7CMG_cjs.extractLines(fullContent, startLine, endLine);
|
|
15946
16071
|
return {
|
|
15947
16072
|
success: true,
|
|
15948
16073
|
content: result.content,
|
|
@@ -15958,7 +16083,7 @@ ${skillInstructions}`;
|
|
|
15958
16083
|
createSkillReadScriptTool() {
|
|
15959
16084
|
const skills = this.skills;
|
|
15960
16085
|
const activatedSkills = this._activatedSkills;
|
|
15961
|
-
return
|
|
16086
|
+
return chunk7UWHFWST_cjs.createTool({
|
|
15962
16087
|
id: "skill-read-script",
|
|
15963
16088
|
description: "Read a script file from an activated skill. Scripts contain executable code. Optionally specify line range.",
|
|
15964
16089
|
inputSchema: z10__default.default.object({
|
|
@@ -15988,7 +16113,7 @@ ${skillInstructions}`;
|
|
|
15988
16113
|
message: `Script file "${scriptPath}" not found in skill "${skillName}". Available scripts: ${availableScripts.join(", ") || "none"}`
|
|
15989
16114
|
};
|
|
15990
16115
|
}
|
|
15991
|
-
const result =
|
|
16116
|
+
const result = chunkCGPH7CMG_cjs.extractLines(fullContent, startLine, endLine);
|
|
15992
16117
|
return {
|
|
15993
16118
|
success: true,
|
|
15994
16119
|
content: result.content,
|
|
@@ -16004,7 +16129,7 @@ ${skillInstructions}`;
|
|
|
16004
16129
|
createSkillReadAssetTool() {
|
|
16005
16130
|
const skills = this.skills;
|
|
16006
16131
|
const activatedSkills = this._activatedSkills;
|
|
16007
|
-
return
|
|
16132
|
+
return chunk7UWHFWST_cjs.createTool({
|
|
16008
16133
|
id: "skill-read-asset",
|
|
16009
16134
|
description: "Read an asset file from an activated skill. Assets include templates, data files, and other static resources. Binary files are returned as base64.",
|
|
16010
16135
|
inputSchema: z10__default.default.object({
|
|
@@ -16056,7 +16181,7 @@ ${skillInstructions}`;
|
|
|
16056
16181
|
*/
|
|
16057
16182
|
createSkillSearchTool() {
|
|
16058
16183
|
const skills = this.skills;
|
|
16059
|
-
return
|
|
16184
|
+
return chunk7UWHFWST_cjs.createTool({
|
|
16060
16185
|
id: "skill-search",
|
|
16061
16186
|
description: "Search across skill content to find relevant information. Useful when you need to find specific details within skills.",
|
|
16062
16187
|
inputSchema: z10__default.default.object({
|
|
@@ -16233,7 +16358,7 @@ var AgentLegacyHandler = class {
|
|
|
16233
16358
|
methodType: methodType === "generate" ? "generateLegacy" : "streamLegacy",
|
|
16234
16359
|
memoryConfig
|
|
16235
16360
|
});
|
|
16236
|
-
let messageList = new
|
|
16361
|
+
let messageList = new chunkUE2G2LRP_cjs.MessageList({
|
|
16237
16362
|
threadId,
|
|
16238
16363
|
resourceId,
|
|
16239
16364
|
generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
|
|
@@ -16302,7 +16427,7 @@ var AgentLegacyHandler = class {
|
|
|
16302
16427
|
title: thread.title,
|
|
16303
16428
|
memoryConfig,
|
|
16304
16429
|
resourceId,
|
|
16305
|
-
saveThread:
|
|
16430
|
+
saveThread: true
|
|
16306
16431
|
});
|
|
16307
16432
|
}
|
|
16308
16433
|
requestContext.set("MastraMemory", {
|
|
@@ -16364,7 +16489,7 @@ var AgentLegacyHandler = class {
|
|
|
16364
16489
|
result: resToLog,
|
|
16365
16490
|
threadId
|
|
16366
16491
|
});
|
|
16367
|
-
const messageListResponses = new
|
|
16492
|
+
const messageListResponses = new chunkUE2G2LRP_cjs.MessageList({
|
|
16368
16493
|
threadId,
|
|
16369
16494
|
resourceId,
|
|
16370
16495
|
generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
|
|
@@ -16413,9 +16538,7 @@ var AgentLegacyHandler = class {
|
|
|
16413
16538
|
model: titleModel,
|
|
16414
16539
|
instructions: titleInstructions
|
|
16415
16540
|
} = this.capabilities.resolveTitleGenerationConfig(config?.generateTitle);
|
|
16416
|
-
|
|
16417
|
-
const isFirstUserMessage = rememberedUserMessages.length === 0;
|
|
16418
|
-
if (shouldGenerate && isFirstUserMessage && userMessage) {
|
|
16541
|
+
if (shouldGenerate && !threadExists && userMessage) {
|
|
16419
16542
|
promises.push(
|
|
16420
16543
|
this.capabilities.genTitle(userMessage, requestContext, { currentSpan: agentSpan }, titleModel, titleInstructions).then((title) => {
|
|
16421
16544
|
if (title) {
|
|
@@ -16571,12 +16694,14 @@ var AgentLegacyHandler = class {
|
|
|
16571
16694
|
let messageList;
|
|
16572
16695
|
let thread;
|
|
16573
16696
|
let threadExists;
|
|
16697
|
+
let threadCreatedByStep = false;
|
|
16574
16698
|
return {
|
|
16575
16699
|
llm,
|
|
16576
16700
|
before: async () => {
|
|
16577
16701
|
const beforeResult = await before();
|
|
16578
16702
|
const { messageObjects, convertedTools, agentSpan } = beforeResult;
|
|
16579
16703
|
threadExists = beforeResult.threadExists || false;
|
|
16704
|
+
threadCreatedByStep = false;
|
|
16580
16705
|
messageList = beforeResult.messageList;
|
|
16581
16706
|
thread = beforeResult.thread;
|
|
16582
16707
|
const threadId = thread?.id;
|
|
@@ -16592,7 +16717,7 @@ var AgentLegacyHandler = class {
|
|
|
16592
16717
|
requestContext,
|
|
16593
16718
|
onStepFinish: async (props) => {
|
|
16594
16719
|
if (savePerStep) {
|
|
16595
|
-
if (!threadExists && memory && thread) {
|
|
16720
|
+
if (!threadExists && !threadCreatedByStep && memory && thread) {
|
|
16596
16721
|
await memory.createThread({
|
|
16597
16722
|
threadId,
|
|
16598
16723
|
title: thread.title,
|
|
@@ -16600,7 +16725,7 @@ var AgentLegacyHandler = class {
|
|
|
16600
16725
|
resourceId: thread.resourceId,
|
|
16601
16726
|
memoryConfig
|
|
16602
16727
|
});
|
|
16603
|
-
|
|
16728
|
+
threadCreatedByStep = true;
|
|
16604
16729
|
}
|
|
16605
16730
|
await this.capabilities.saveStepMessages({
|
|
16606
16731
|
result: props,
|
|
@@ -16665,17 +16790,23 @@ var AgentLegacyHandler = class {
|
|
|
16665
16790
|
};
|
|
16666
16791
|
const { llm, before, after } = await this.prepareLLMOptions(messages, mergedGenerateOptions, "generate");
|
|
16667
16792
|
if (llm.getModel().specificationVersion !== "v1") {
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
|
|
16793
|
+
const specVersion = llm.getModel().specificationVersion;
|
|
16794
|
+
this.capabilities.logger.error(
|
|
16795
|
+
`Models with specificationVersion "${specVersion}" are not supported for generateLegacy. Please use generate() instead.`,
|
|
16796
|
+
{
|
|
16797
|
+
modelId: llm.getModel().modelId,
|
|
16798
|
+
specificationVersion: specVersion
|
|
16799
|
+
}
|
|
16800
|
+
);
|
|
16671
16801
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
16672
16802
|
id: "AGENT_GENERATE_V2_MODEL_NOT_SUPPORTED",
|
|
16673
16803
|
domain: "AGENT" /* AGENT */,
|
|
16674
16804
|
category: "USER" /* USER */,
|
|
16675
16805
|
details: {
|
|
16676
|
-
modelId: llm.getModel().modelId
|
|
16806
|
+
modelId: llm.getModel().modelId,
|
|
16807
|
+
specificationVersion: specVersion
|
|
16677
16808
|
},
|
|
16678
|
-
text: "
|
|
16809
|
+
text: `Models with specificationVersion "${specVersion}" are not supported for generateLegacy(). Please use generate() instead.`
|
|
16679
16810
|
});
|
|
16680
16811
|
}
|
|
16681
16812
|
const llmToUse = llm;
|
|
@@ -16885,17 +17016,23 @@ var AgentLegacyHandler = class {
|
|
|
16885
17016
|
};
|
|
16886
17017
|
const { llm, before, after } = await this.prepareLLMOptions(messages, mergedStreamOptions, "stream");
|
|
16887
17018
|
if (llm.getModel().specificationVersion !== "v1") {
|
|
16888
|
-
|
|
16889
|
-
|
|
16890
|
-
|
|
17019
|
+
const specVersion = llm.getModel().specificationVersion;
|
|
17020
|
+
this.capabilities.logger.error(
|
|
17021
|
+
`Models with specificationVersion "${specVersion}" are not supported for streamLegacy. Please use stream() instead.`,
|
|
17022
|
+
{
|
|
17023
|
+
modelId: llm.getModel().modelId,
|
|
17024
|
+
specificationVersion: specVersion
|
|
17025
|
+
}
|
|
17026
|
+
);
|
|
16891
17027
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
16892
17028
|
id: "AGENT_STREAM_V2_MODEL_NOT_SUPPORTED",
|
|
16893
17029
|
domain: "AGENT" /* AGENT */,
|
|
16894
17030
|
category: "USER" /* USER */,
|
|
16895
17031
|
details: {
|
|
16896
|
-
modelId: llm.getModel().modelId
|
|
17032
|
+
modelId: llm.getModel().modelId,
|
|
17033
|
+
specificationVersion: specVersion
|
|
16897
17034
|
},
|
|
16898
|
-
text: "
|
|
17035
|
+
text: `Models with specificationVersion "${specVersion}" are not supported for streamLegacy(). Please use stream() instead.`
|
|
16899
17036
|
});
|
|
16900
17037
|
}
|
|
16901
17038
|
const beforeResult = await before();
|
|
@@ -17196,6 +17333,7 @@ function createMapResultsStep({
|
|
|
17196
17333
|
return async ({ inputData, bail, tracingContext }) => {
|
|
17197
17334
|
const toolsData = inputData["prepare-tools-step"];
|
|
17198
17335
|
const memoryData = inputData["prepare-memory-step"];
|
|
17336
|
+
let threadCreatedByStep = false;
|
|
17199
17337
|
const result = {
|
|
17200
17338
|
...options,
|
|
17201
17339
|
tools: toolsData.convertedTools,
|
|
@@ -17206,7 +17344,7 @@ function createMapResultsStep({
|
|
|
17206
17344
|
requestContext,
|
|
17207
17345
|
onStepFinish: async (props) => {
|
|
17208
17346
|
if (options.savePerStep && !memoryConfig?.readOnly) {
|
|
17209
|
-
if (!memoryData.threadExists && memory && memoryData.thread) {
|
|
17347
|
+
if (!memoryData.threadExists && !threadCreatedByStep && memory && memoryData.thread) {
|
|
17210
17348
|
await memory.createThread({
|
|
17211
17349
|
threadId: memoryData.thread?.id,
|
|
17212
17350
|
title: memoryData.thread?.title,
|
|
@@ -17214,7 +17352,7 @@ function createMapResultsStep({
|
|
|
17214
17352
|
resourceId: memoryData.thread?.resourceId,
|
|
17215
17353
|
memoryConfig
|
|
17216
17354
|
});
|
|
17217
|
-
|
|
17355
|
+
threadCreatedByStep = true;
|
|
17218
17356
|
}
|
|
17219
17357
|
await capabilities.saveStepMessages({
|
|
17220
17358
|
result: props,
|
|
@@ -17389,7 +17527,7 @@ var prepareToolsStepOutputSchema = z10.z.object({
|
|
|
17389
17527
|
var prepareMemoryStepOutputSchema = z10.z.object({
|
|
17390
17528
|
threadExists: z10.z.boolean(),
|
|
17391
17529
|
thread: storageThreadSchema.optional(),
|
|
17392
|
-
messageList: z10.z.instanceof(
|
|
17530
|
+
messageList: z10.z.instanceof(chunkUE2G2LRP_cjs.MessageList),
|
|
17393
17531
|
/** Shared processor states map that persists across loop iterations for both input and output processors */
|
|
17394
17532
|
processorStates: z10.z.instanceof(Map),
|
|
17395
17533
|
/** Tripwire data when input processor triggered abort */
|
|
@@ -17429,7 +17567,7 @@ function createPrepareMemoryStep({
|
|
|
17429
17567
|
outputSchema: prepareMemoryStepOutputSchema,
|
|
17430
17568
|
execute: async ({ tracingContext }) => {
|
|
17431
17569
|
const thread = threadFromArgs;
|
|
17432
|
-
const messageList = new
|
|
17570
|
+
const messageList = new chunkUE2G2LRP_cjs.MessageList({
|
|
17433
17571
|
threadId: thread?.id,
|
|
17434
17572
|
resourceId,
|
|
17435
17573
|
generateMessageId: capabilities.generateMessageId,
|
|
@@ -17589,7 +17727,8 @@ function createStreamStep({
|
|
|
17589
17727
|
memoryConfig,
|
|
17590
17728
|
memory,
|
|
17591
17729
|
resourceId,
|
|
17592
|
-
autoResumeSuspendedTools
|
|
17730
|
+
autoResumeSuspendedTools,
|
|
17731
|
+
workspace
|
|
17593
17732
|
}) {
|
|
17594
17733
|
return createStep({
|
|
17595
17734
|
id: "stream-text-step",
|
|
@@ -17625,7 +17764,8 @@ function createStreamStep({
|
|
|
17625
17764
|
agentName,
|
|
17626
17765
|
toolCallId,
|
|
17627
17766
|
methodType: modelMethodType,
|
|
17628
|
-
autoResumeSuspendedTools
|
|
17767
|
+
autoResumeSuspendedTools,
|
|
17768
|
+
workspace
|
|
17629
17769
|
});
|
|
17630
17770
|
return streamResult;
|
|
17631
17771
|
}
|
|
@@ -17652,7 +17792,8 @@ function createPrepareStreamWorkflow({
|
|
|
17652
17792
|
resumeContext,
|
|
17653
17793
|
agentId,
|
|
17654
17794
|
agentName,
|
|
17655
|
-
toolCallId
|
|
17795
|
+
toolCallId,
|
|
17796
|
+
workspace
|
|
17656
17797
|
}) {
|
|
17657
17798
|
const prepareToolsStep = createPrepareToolsStep({
|
|
17658
17799
|
capabilities,
|
|
@@ -17691,7 +17832,8 @@ function createPrepareStreamWorkflow({
|
|
|
17691
17832
|
memoryConfig,
|
|
17692
17833
|
memory,
|
|
17693
17834
|
resourceId,
|
|
17694
|
-
autoResumeSuspendedTools: options.autoResumeSuspendedTools
|
|
17835
|
+
autoResumeSuspendedTools: options.autoResumeSuspendedTools,
|
|
17836
|
+
workspace
|
|
17695
17837
|
});
|
|
17696
17838
|
const mapResultsStep = createMapResultsStep({
|
|
17697
17839
|
capabilities,
|
|
@@ -17726,7 +17868,7 @@ function resolveMaybePromise(value, cb) {
|
|
|
17726
17868
|
}
|
|
17727
17869
|
return cb(value);
|
|
17728
17870
|
}
|
|
17729
|
-
var Agent = class extends
|
|
17871
|
+
var Agent = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
17730
17872
|
id;
|
|
17731
17873
|
name;
|
|
17732
17874
|
source;
|
|
@@ -17776,7 +17918,7 @@ var Agent = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
17776
17918
|
* ```
|
|
17777
17919
|
*/
|
|
17778
17920
|
constructor(config) {
|
|
17779
|
-
super({ component: chunk7XAECHYL_cjs.RegisteredLogger.AGENT });
|
|
17921
|
+
super({ component: chunk7XAECHYL_cjs.RegisteredLogger.AGENT, rawConfig: config.rawConfig });
|
|
17780
17922
|
this.name = config.name;
|
|
17781
17923
|
this.id = config.id ?? config.name;
|
|
17782
17924
|
this.source = "code";
|
|
@@ -17855,7 +17997,7 @@ var Agent = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
17855
17997
|
this.#voice?.addInstructions(config.instructions);
|
|
17856
17998
|
}
|
|
17857
17999
|
} else {
|
|
17858
|
-
this.#voice = new
|
|
18000
|
+
this.#voice = new chunkRQ56ZSIR_cjs.DefaultVoice();
|
|
17859
18001
|
}
|
|
17860
18002
|
if (config.workspace) {
|
|
17861
18003
|
this.#workspace = config.workspace;
|
|
@@ -17899,7 +18041,7 @@ var Agent = class extends chunkC4WWWQHT_cjs.MastraBase {
|
|
|
17899
18041
|
* Throws an error if validation fails.
|
|
17900
18042
|
*/
|
|
17901
18043
|
async #validateRequestContext(requestContext) {
|
|
17902
|
-
if (this.#requestContextSchema &&
|
|
18044
|
+
if (this.#requestContextSchema && chunkOOCEAC6U_cjs.isZodType(this.#requestContextSchema)) {
|
|
17903
18045
|
const contextValues = requestContext?.all ?? {};
|
|
17904
18046
|
const validatedRequestContext = await this.#requestContextSchema.safeParseAsync(contextValues);
|
|
17905
18047
|
if (!validatedRequestContext.success) {
|
|
@@ -18121,6 +18263,25 @@ ${errorMessages}`,
|
|
|
18121
18263
|
const configuredProcessors = typeof this.#outputProcessors === "function" ? await this.#outputProcessors({ requestContext: requestContext || new chunkVDKWYUGC_cjs.RequestContext() }) : this.#outputProcessors;
|
|
18122
18264
|
return this.combineProcessorsIntoWorkflow(configuredProcessors, `${this.id}-configured-output-processor`);
|
|
18123
18265
|
}
|
|
18266
|
+
/**
|
|
18267
|
+
* Returns the IDs of the raw configured input and output processors,
|
|
18268
|
+
* without combining them into workflows. Used by the editor to clone
|
|
18269
|
+
* agent processor configuration to storage.
|
|
18270
|
+
*/
|
|
18271
|
+
async getConfiguredProcessorIds(requestContext) {
|
|
18272
|
+
const ctx = requestContext || new chunkVDKWYUGC_cjs.RequestContext();
|
|
18273
|
+
let inputProcessorIds = [];
|
|
18274
|
+
if (this.#inputProcessors) {
|
|
18275
|
+
const processors = typeof this.#inputProcessors === "function" ? await this.#inputProcessors({ requestContext: ctx }) : this.#inputProcessors;
|
|
18276
|
+
inputProcessorIds = processors.map((p) => p.id).filter(Boolean);
|
|
18277
|
+
}
|
|
18278
|
+
let outputProcessorIds = [];
|
|
18279
|
+
if (this.#outputProcessors) {
|
|
18280
|
+
const processors = typeof this.#outputProcessors === "function" ? await this.#outputProcessors({ requestContext: ctx }) : this.#outputProcessors;
|
|
18281
|
+
outputProcessorIds = processors.map((p) => p.id).filter(Boolean);
|
|
18282
|
+
}
|
|
18283
|
+
return { inputProcessorIds, outputProcessorIds };
|
|
18284
|
+
}
|
|
18124
18285
|
/**
|
|
18125
18286
|
* Returns configured processor workflows for registration with Mastra.
|
|
18126
18287
|
* This excludes memory-derived processors to avoid triggering memory factory functions.
|
|
@@ -18239,26 +18400,17 @@ ${errorMessages}`,
|
|
|
18239
18400
|
requestContext = new chunkVDKWYUGC_cjs.RequestContext()
|
|
18240
18401
|
} = {}) {
|
|
18241
18402
|
if (this.#workspace) {
|
|
18242
|
-
let resolvedWorkspace;
|
|
18243
18403
|
if (typeof this.#workspace !== "function") {
|
|
18244
|
-
|
|
18245
|
-
}
|
|
18246
|
-
|
|
18247
|
-
|
|
18248
|
-
|
|
18249
|
-
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
|
|
18254
|
-
agentName: this.name
|
|
18255
|
-
},
|
|
18256
|
-
text: `[Agent:${this.name}] - Function-based workspace returned empty value`
|
|
18257
|
-
});
|
|
18258
|
-
this.logger.trackException(mastraError);
|
|
18259
|
-
this.logger.error(mastraError.toString());
|
|
18260
|
-
throw mastraError;
|
|
18261
|
-
}
|
|
18404
|
+
return this.#workspace;
|
|
18405
|
+
}
|
|
18406
|
+
const result = this.#workspace({ requestContext, mastra: this.#mastra });
|
|
18407
|
+
const resolvedWorkspace = await Promise.resolve(result);
|
|
18408
|
+
if (!resolvedWorkspace) {
|
|
18409
|
+
return void 0;
|
|
18410
|
+
}
|
|
18411
|
+
resolvedWorkspace.__setLogger(this.logger);
|
|
18412
|
+
if (this.#mastra) {
|
|
18413
|
+
this.#mastra.addWorkspace(resolvedWorkspace);
|
|
18262
18414
|
}
|
|
18263
18415
|
return resolvedWorkspace;
|
|
18264
18416
|
}
|
|
@@ -18357,7 +18509,7 @@ ${errorMessages}`,
|
|
|
18357
18509
|
voice?.addInstructions(this.#convertInstructionsToString(instructions));
|
|
18358
18510
|
return voice;
|
|
18359
18511
|
} else {
|
|
18360
|
-
return new
|
|
18512
|
+
return new chunkRQ56ZSIR_cjs.DefaultVoice();
|
|
18361
18513
|
}
|
|
18362
18514
|
}
|
|
18363
18515
|
/**
|
|
@@ -18615,7 +18767,7 @@ ${errorMessages}`,
|
|
|
18615
18767
|
*/
|
|
18616
18768
|
listTools({ requestContext = new chunkVDKWYUGC_cjs.RequestContext() } = {}) {
|
|
18617
18769
|
if (typeof this.#tools !== "function") {
|
|
18618
|
-
return
|
|
18770
|
+
return chunkOOCEAC6U_cjs.ensureToolProperties(this.#tools);
|
|
18619
18771
|
}
|
|
18620
18772
|
const result = this.#tools({
|
|
18621
18773
|
requestContext,
|
|
@@ -18636,7 +18788,7 @@ ${errorMessages}`,
|
|
|
18636
18788
|
this.logger.error(mastraError.toString());
|
|
18637
18789
|
throw mastraError;
|
|
18638
18790
|
}
|
|
18639
|
-
return
|
|
18791
|
+
return chunkOOCEAC6U_cjs.ensureToolProperties(tools);
|
|
18640
18792
|
});
|
|
18641
18793
|
}
|
|
18642
18794
|
/**
|
|
@@ -18668,7 +18820,7 @@ ${errorMessages}`,
|
|
|
18668
18820
|
});
|
|
18669
18821
|
});
|
|
18670
18822
|
} else {
|
|
18671
|
-
llm = new
|
|
18823
|
+
llm = new chunkON2KVIUJ_cjs.MastraLLMV1({
|
|
18672
18824
|
model: resolvedModel,
|
|
18673
18825
|
mastra: this.#mastra,
|
|
18674
18826
|
options: { tracingPolicy: this.#options?.tracingPolicy }
|
|
@@ -18693,7 +18845,7 @@ ${errorMessages}`,
|
|
|
18693
18845
|
*/
|
|
18694
18846
|
async resolveModelConfig(modelConfig, requestContext) {
|
|
18695
18847
|
try {
|
|
18696
|
-
return await
|
|
18848
|
+
return await chunkGCTAD6B7_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
|
|
18697
18849
|
} catch (error) {
|
|
18698
18850
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
18699
18851
|
id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
|
|
@@ -18845,6 +18997,9 @@ ${errorMessages}`,
|
|
|
18845
18997
|
*/
|
|
18846
18998
|
__registerMastra(mastra) {
|
|
18847
18999
|
this.#mastra = mastra;
|
|
19000
|
+
if (this.#workspace && typeof this.#workspace !== "function") {
|
|
19001
|
+
this.#workspace.__setLogger(this.logger);
|
|
19002
|
+
}
|
|
18848
19003
|
if (this.#tools && typeof this.#tools === "object") {
|
|
18849
19004
|
Object.entries(this.#tools).forEach(([key, tool2]) => {
|
|
18850
19005
|
try {
|
|
@@ -18901,7 +19056,7 @@ ${errorMessages}`,
|
|
|
18901
19056
|
instructions
|
|
18902
19057
|
}) {
|
|
18903
19058
|
const llm = await this.getLLM({ requestContext, model });
|
|
18904
|
-
const normMessage = new
|
|
19059
|
+
const normMessage = new chunkUE2G2LRP_cjs.MessageList().add(message, "user").get.all.ui().at(-1);
|
|
18905
19060
|
if (!normMessage) {
|
|
18906
19061
|
throw new Error(`Could not generate title from input ${JSON.stringify(message)}`);
|
|
18907
19062
|
}
|
|
@@ -18924,7 +19079,7 @@ ${errorMessages}`,
|
|
|
18924
19079
|
const systemInstructions = await this.resolveTitleInstructions(requestContext, instructions);
|
|
18925
19080
|
let text = "";
|
|
18926
19081
|
if (isSupportedLanguageModel(llm.getModel())) {
|
|
18927
|
-
const messageList = new
|
|
19082
|
+
const messageList = new chunkUE2G2LRP_cjs.MessageList().add(
|
|
18928
19083
|
[
|
|
18929
19084
|
{
|
|
18930
19085
|
role: "system",
|
|
@@ -18977,7 +19132,7 @@ ${errorMessages}`,
|
|
|
18977
19132
|
async genTitle(userMessage, requestContext, tracingContext, model, instructions) {
|
|
18978
19133
|
try {
|
|
18979
19134
|
if (userMessage) {
|
|
18980
|
-
const normMessage = new
|
|
19135
|
+
const normMessage = new chunkUE2G2LRP_cjs.MessageList().add(userMessage, "user").get.all.ui().at(-1);
|
|
18981
19136
|
if (normMessage) {
|
|
18982
19137
|
return await this.generateTitleFromUserMessage({
|
|
18983
19138
|
message: normMessage,
|
|
@@ -19017,6 +19172,10 @@ ${errorMessages}`,
|
|
|
19017
19172
|
return convertedMemoryTools;
|
|
19018
19173
|
}
|
|
19019
19174
|
const memory = await this.getMemory({ requestContext });
|
|
19175
|
+
if (!threadId && !resourceId) {
|
|
19176
|
+
this.logger.debug(`[Agent:${this.name}] - Skipping memory tools (no thread or resource context)`, { runId });
|
|
19177
|
+
return convertedMemoryTools;
|
|
19178
|
+
}
|
|
19020
19179
|
const memoryTools = memory?.listTools?.(memoryConfig);
|
|
19021
19180
|
if (memoryTools) {
|
|
19022
19181
|
this.logger.debug(
|
|
@@ -19042,7 +19201,7 @@ ${errorMessages}`,
|
|
|
19042
19201
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
19043
19202
|
requireApproval: toolObj.requireApproval
|
|
19044
19203
|
};
|
|
19045
|
-
const convertedToCoreTool =
|
|
19204
|
+
const convertedToCoreTool = chunkOOCEAC6U_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
19046
19205
|
convertedMemoryTools[toolName] = convertedToCoreTool;
|
|
19047
19206
|
}
|
|
19048
19207
|
}
|
|
@@ -19070,7 +19229,7 @@ ${errorMessages}`,
|
|
|
19070
19229
|
if (!workspace) {
|
|
19071
19230
|
return convertedWorkspaceTools;
|
|
19072
19231
|
}
|
|
19073
|
-
const workspaceTools =
|
|
19232
|
+
const workspaceTools = chunkCGPH7CMG_cjs.createWorkspaceTools(workspace);
|
|
19074
19233
|
if (Object.keys(workspaceTools).length > 0) {
|
|
19075
19234
|
this.logger.debug(`[Agent:${this.name}] - Adding workspace tools: ${Object.keys(workspaceTools).join(", ")}`, {
|
|
19076
19235
|
runId
|
|
@@ -19091,7 +19250,7 @@ ${errorMessages}`,
|
|
|
19091
19250
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
19092
19251
|
requireApproval: toolObj.requireApproval
|
|
19093
19252
|
};
|
|
19094
|
-
const convertedToCoreTool =
|
|
19253
|
+
const convertedToCoreTool = chunkOOCEAC6U_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
19095
19254
|
convertedWorkspaceTools[toolName] = convertedToCoreTool;
|
|
19096
19255
|
}
|
|
19097
19256
|
}
|
|
@@ -19248,7 +19407,7 @@ ${errorMessages}`,
|
|
|
19248
19407
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
19249
19408
|
requireApproval: tool2.requireApproval
|
|
19250
19409
|
};
|
|
19251
|
-
return [k,
|
|
19410
|
+
return [k, chunkOOCEAC6U_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
|
|
19252
19411
|
})
|
|
19253
19412
|
);
|
|
19254
19413
|
const assignedToolEntriesConverted = Object.fromEntries(
|
|
@@ -19298,7 +19457,7 @@ ${errorMessages}`,
|
|
|
19298
19457
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
19299
19458
|
requireApproval: toolObj.requireApproval
|
|
19300
19459
|
};
|
|
19301
|
-
const convertedToCoreTool =
|
|
19460
|
+
const convertedToCoreTool = chunkOOCEAC6U_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
|
|
19302
19461
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
19303
19462
|
}
|
|
19304
19463
|
}
|
|
@@ -19343,7 +19502,7 @@ ${errorMessages}`,
|
|
|
19343
19502
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
19344
19503
|
requireApproval: tool2.requireApproval
|
|
19345
19504
|
};
|
|
19346
|
-
const convertedToCoreTool =
|
|
19505
|
+
const convertedToCoreTool = chunkOOCEAC6U_cjs.makeCoreTool(rest, options, "client-tool", autoResumeSuspendedTools);
|
|
19347
19506
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
19348
19507
|
}
|
|
19349
19508
|
}
|
|
@@ -19382,7 +19541,7 @@ ${errorMessages}`,
|
|
|
19382
19541
|
subAgentResourceId: z10.z.string().describe("The resource ID of the agent").optional()
|
|
19383
19542
|
});
|
|
19384
19543
|
const modelVersion = (await agent.getModel({ requestContext })).specificationVersion;
|
|
19385
|
-
const toolObj =
|
|
19544
|
+
const toolObj = chunk7UWHFWST_cjs.createTool({
|
|
19386
19545
|
id: `agent-${agentName}`,
|
|
19387
19546
|
description: agent.getDescription() || `Agent: ${agentName}`,
|
|
19388
19547
|
inputSchema: agentInputSchema,
|
|
@@ -19412,11 +19571,20 @@ ${errorMessages}`,
|
|
|
19412
19571
|
source: "agent",
|
|
19413
19572
|
entityId: agentName
|
|
19414
19573
|
}) || `${slugify.default(this.id)}-${agentName}`;
|
|
19574
|
+
const suspendedToolRunId = inputData.suspendedToolRunId;
|
|
19575
|
+
const { resumeData, suspend } = context?.agent ?? {};
|
|
19415
19576
|
if ((methodType === "generate" || methodType === "generateLegacy") && supportedLanguageModelSpecifications.includes(modelVersion)) {
|
|
19416
19577
|
if (!agent.hasOwnMemory() && this.#memory) {
|
|
19417
19578
|
agent.__setMemory(this.#memory);
|
|
19418
19579
|
}
|
|
19419
|
-
const generateResult = await agent.
|
|
19580
|
+
const generateResult = resumeData ? await agent.resumeGenerate(resumeData, {
|
|
19581
|
+
runId: suspendedToolRunId,
|
|
19582
|
+
requestContext,
|
|
19583
|
+
tracingContext: context?.tracingContext,
|
|
19584
|
+
...inputData.instructions && { instructions: inputData.instructions },
|
|
19585
|
+
...inputData.maxSteps && { maxSteps: inputData.maxSteps },
|
|
19586
|
+
...resourceId && threadId ? { memory: { resource: subAgentResourceId, thread: subAgentThreadId } } : {}
|
|
19587
|
+
}) : await agent.generate(inputData.prompt, {
|
|
19420
19588
|
requestContext,
|
|
19421
19589
|
tracingContext: context?.tracingContext,
|
|
19422
19590
|
...inputData.instructions && { instructions: inputData.instructions },
|
|
@@ -19428,6 +19596,13 @@ ${errorMessages}`,
|
|
|
19428
19596
|
}
|
|
19429
19597
|
} : {}
|
|
19430
19598
|
});
|
|
19599
|
+
if (generateResult.finishReason === "suspended") {
|
|
19600
|
+
return suspend?.(generateResult.suspendPayload, {
|
|
19601
|
+
resumeSchema: generateResult.resumeSchema,
|
|
19602
|
+
runId: generateResult.runId,
|
|
19603
|
+
isAgentSuspend: true
|
|
19604
|
+
});
|
|
19605
|
+
}
|
|
19431
19606
|
result = { text: generateResult.text, subAgentThreadId, subAgentResourceId };
|
|
19432
19607
|
} else if (methodType === "generate" && modelVersion === "v1") {
|
|
19433
19608
|
const generateResult = await agent.generateLegacy(inputData.prompt, {
|
|
@@ -19439,7 +19614,19 @@ ${errorMessages}`,
|
|
|
19439
19614
|
if (!agent.hasOwnMemory() && this.#memory) {
|
|
19440
19615
|
agent.__setMemory(this.#memory);
|
|
19441
19616
|
}
|
|
19442
|
-
const streamResult = await agent.
|
|
19617
|
+
const streamResult = resumeData ? await agent.resumeStream(resumeData, {
|
|
19618
|
+
runId: suspendedToolRunId,
|
|
19619
|
+
requestContext,
|
|
19620
|
+
tracingContext: context?.tracingContext,
|
|
19621
|
+
...inputData.instructions && { instructions: inputData.instructions },
|
|
19622
|
+
...inputData.maxSteps && { maxSteps: inputData.maxSteps },
|
|
19623
|
+
...resourceId && threadId ? {
|
|
19624
|
+
memory: {
|
|
19625
|
+
resource: subAgentResourceId,
|
|
19626
|
+
thread: subAgentThreadId
|
|
19627
|
+
}
|
|
19628
|
+
} : {}
|
|
19629
|
+
}) : await agent.stream(inputData.prompt, {
|
|
19443
19630
|
requestContext,
|
|
19444
19631
|
tracingContext: context?.tracingContext,
|
|
19445
19632
|
...inputData.instructions && { instructions: inputData.instructions },
|
|
@@ -19456,8 +19643,34 @@ ${errorMessages}`,
|
|
|
19456
19643
|
if (context?.writer) {
|
|
19457
19644
|
if (chunk.type.startsWith("data-")) {
|
|
19458
19645
|
await context.writer.custom(chunk);
|
|
19646
|
+
if (chunk.type === "data-tool-call-approval") {
|
|
19647
|
+
return suspend?.(
|
|
19648
|
+
{},
|
|
19649
|
+
{ requireToolApproval: true, runId: streamResult.runId, isAgentSuspend: true }
|
|
19650
|
+
);
|
|
19651
|
+
}
|
|
19652
|
+
if (chunk.type === "data-tool-call-suspended") {
|
|
19653
|
+
return suspend?.(chunk.data.suspendPayload, {
|
|
19654
|
+
resumeSchema: chunk.data.resumeSchema,
|
|
19655
|
+
runId: streamResult.runId,
|
|
19656
|
+
isAgentSuspend: true
|
|
19657
|
+
});
|
|
19658
|
+
}
|
|
19459
19659
|
} else {
|
|
19460
19660
|
await context.writer.write(chunk);
|
|
19661
|
+
if (chunk.type === "tool-call-approval") {
|
|
19662
|
+
return suspend?.(
|
|
19663
|
+
{},
|
|
19664
|
+
{ requireToolApproval: true, runId: streamResult.runId, isAgentSuspend: true }
|
|
19665
|
+
);
|
|
19666
|
+
}
|
|
19667
|
+
if (chunk.type === "tool-call-suspended") {
|
|
19668
|
+
return suspend?.(chunk.payload.suspendPayload, {
|
|
19669
|
+
resumeSchema: chunk.payload.resumeSchema,
|
|
19670
|
+
runId: streamResult.runId,
|
|
19671
|
+
isAgentSuspend: true
|
|
19672
|
+
});
|
|
19673
|
+
}
|
|
19461
19674
|
}
|
|
19462
19675
|
}
|
|
19463
19676
|
if (chunk.type === "text-delta") {
|
|
@@ -19523,7 +19736,7 @@ ${errorMessages}`,
|
|
|
19523
19736
|
tracingContext,
|
|
19524
19737
|
tracingPolicy: this.#options?.tracingPolicy
|
|
19525
19738
|
};
|
|
19526
|
-
convertedAgentTools[`agent-${agentName}`] =
|
|
19739
|
+
convertedAgentTools[`agent-${agentName}`] = chunkOOCEAC6U_cjs.makeCoreTool(
|
|
19527
19740
|
toolObj,
|
|
19528
19741
|
options,
|
|
19529
19742
|
void 0,
|
|
@@ -19552,10 +19765,10 @@ ${errorMessages}`,
|
|
|
19552
19765
|
for (const [workflowName, workflow] of Object.entries(workflows)) {
|
|
19553
19766
|
const extendedInputSchema = z10.z.object({
|
|
19554
19767
|
// @ts-expect-error - zod types mismatch between v3 and v4
|
|
19555
|
-
inputData: workflow.inputSchema,
|
|
19768
|
+
inputData: workflow.inputSchema ?? z10.z.object({}).passthrough(),
|
|
19556
19769
|
...workflow.stateSchema ? { initialState: workflow.stateSchema } : {}
|
|
19557
19770
|
});
|
|
19558
|
-
const toolObj =
|
|
19771
|
+
const toolObj = chunk7UWHFWST_cjs.createTool({
|
|
19559
19772
|
id: `workflow-${workflowName}`,
|
|
19560
19773
|
description: workflow.description || `Workflow: ${workflowName}`,
|
|
19561
19774
|
inputSchema: extendedInputSchema,
|
|
@@ -19708,7 +19921,7 @@ ${errorMessages}`,
|
|
|
19708
19921
|
tracingContext,
|
|
19709
19922
|
tracingPolicy: this.#options?.tracingPolicy
|
|
19710
19923
|
};
|
|
19711
|
-
convertedWorkflowTools[`workflow-${workflowName}`] =
|
|
19924
|
+
convertedWorkflowTools[`workflow-${workflowName}`] = chunkOOCEAC6U_cjs.makeCoreTool(
|
|
19712
19925
|
toolObj,
|
|
19713
19926
|
options,
|
|
19714
19927
|
void 0,
|
|
@@ -19738,7 +19951,7 @@ ${errorMessages}`,
|
|
|
19738
19951
|
let mastraProxy = void 0;
|
|
19739
19952
|
const logger = this.logger;
|
|
19740
19953
|
if (this.#mastra) {
|
|
19741
|
-
mastraProxy =
|
|
19954
|
+
mastraProxy = chunkOOCEAC6U_cjs.createMastraProxy({ mastra: this.#mastra, logger });
|
|
19742
19955
|
}
|
|
19743
19956
|
const assignedTools = await this.listAssignedTools({
|
|
19744
19957
|
runId,
|
|
@@ -19988,7 +20201,7 @@ ${errorMessages}`,
|
|
|
19988
20201
|
throw mastraError;
|
|
19989
20202
|
}
|
|
19990
20203
|
let headers;
|
|
19991
|
-
if (resolvedModel instanceof
|
|
20204
|
+
if (resolvedModel instanceof chunkGCTAD6B7_cjs.ModelRouterLanguageModel) {
|
|
19992
20205
|
headers = resolvedModel.config?.headers;
|
|
19993
20206
|
}
|
|
19994
20207
|
return [
|
|
@@ -20034,7 +20247,7 @@ ${errorMessages}`,
|
|
|
20034
20247
|
throw mastraError;
|
|
20035
20248
|
}
|
|
20036
20249
|
let headers;
|
|
20037
|
-
if (model2 instanceof
|
|
20250
|
+
if (model2 instanceof chunkGCTAD6B7_cjs.ModelRouterLanguageModel) {
|
|
20038
20251
|
headers = model2.config?.headers;
|
|
20039
20252
|
}
|
|
20040
20253
|
return {
|
|
@@ -20092,7 +20305,7 @@ ${errorMessages}`,
|
|
|
20092
20305
|
const targetProvider = structuredOutputModel.provider;
|
|
20093
20306
|
const targetModelId = structuredOutputModel.modelId;
|
|
20094
20307
|
if (targetProvider.includes("openai") || targetModelId.includes("openai")) {
|
|
20095
|
-
if (
|
|
20308
|
+
if (chunkOOCEAC6U_cjs.isZodType(options.structuredOutput.schema) && targetModelId) {
|
|
20096
20309
|
const modelInfo = {
|
|
20097
20310
|
provider: targetProvider,
|
|
20098
20311
|
modelId: targetModelId,
|
|
@@ -20138,6 +20351,7 @@ ${errorMessages}`,
|
|
|
20138
20351
|
mastra: this.#mastra
|
|
20139
20352
|
});
|
|
20140
20353
|
const memory = await this.getMemory({ requestContext });
|
|
20354
|
+
const workspace = await this.getWorkspace({ requestContext });
|
|
20141
20355
|
const saveQueueManager = new SaveQueueManager({
|
|
20142
20356
|
logger: this.logger,
|
|
20143
20357
|
memory
|
|
@@ -20186,7 +20400,8 @@ ${errorMessages}`,
|
|
|
20186
20400
|
resumeContext,
|
|
20187
20401
|
agentId: this.id,
|
|
20188
20402
|
agentName: this.name,
|
|
20189
|
-
toolCallId: options.toolCallId
|
|
20403
|
+
toolCallId: options.toolCallId,
|
|
20404
|
+
workspace
|
|
20190
20405
|
});
|
|
20191
20406
|
const run = await executionWorkflow.createRun();
|
|
20192
20407
|
const result = await run.start({ tracingContext: { currentSpan: agentSpan } });
|
|
@@ -20276,9 +20491,7 @@ ${errorMessages}`,
|
|
|
20276
20491
|
model: titleModel,
|
|
20277
20492
|
instructions: titleInstructions
|
|
20278
20493
|
} = this.resolveTitleGenerationConfig(config.generateTitle);
|
|
20279
|
-
|
|
20280
|
-
const isFirstUserMessage = rememberedUserMessages.length === 0;
|
|
20281
|
-
if (shouldGenerate && isFirstUserMessage) {
|
|
20494
|
+
if (shouldGenerate && !threadExists) {
|
|
20282
20495
|
const userMessage = this.getMostRecentUserMessage(messageList.get.all.ui());
|
|
20283
20496
|
if (userMessage) {
|
|
20284
20497
|
const title = await this.genTitle(
|
|
@@ -20499,7 +20712,7 @@ ${errorMessages}`,
|
|
|
20499
20712
|
const defaultOptions = await this.getDefaultOptions({
|
|
20500
20713
|
requestContext: options?.requestContext
|
|
20501
20714
|
});
|
|
20502
|
-
const mergedOptions =
|
|
20715
|
+
const mergedOptions = chunkOOCEAC6U_cjs.deepMerge(
|
|
20503
20716
|
defaultOptions,
|
|
20504
20717
|
options ?? {}
|
|
20505
20718
|
);
|
|
@@ -20510,16 +20723,17 @@ ${errorMessages}`,
|
|
|
20510
20723
|
if (!isSupportedLanguageModel(modelInfo)) {
|
|
20511
20724
|
const modelId = modelInfo.modelId || "unknown";
|
|
20512
20725
|
const provider = modelInfo.provider || "unknown";
|
|
20726
|
+
const specVersion = modelInfo.specificationVersion;
|
|
20513
20727
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
20514
20728
|
id: "AGENT_GENERATE_V1_MODEL_NOT_SUPPORTED",
|
|
20515
20729
|
domain: "AGENT" /* AGENT */,
|
|
20516
20730
|
category: "USER" /* USER */,
|
|
20517
|
-
text: `Agent "${this.name}" is using AI SDK v4 model (${provider}:${modelId}) which is not compatible with generate(). Please use AI SDK v5+ models or call the generateLegacy() method instead. See https://mastra.ai/en/docs/streaming/overview for more information.`,
|
|
20731
|
+
text: specVersion === "v1" ? `Agent "${this.name}" is using AI SDK v4 model (${provider}:${modelId}) which is not compatible with generate(). Please use AI SDK v5+ models or call the generateLegacy() method instead. See https://mastra.ai/en/docs/streaming/overview for more information.` : `Agent "${this.name}" has a model (${provider}:${modelId}) with unrecognized specificationVersion "${specVersion}". Supported versions: v1 (legacy), v2 (AI SDK v5), v3 (AI SDK v6). Please ensure your AI SDK provider is compatible with this version of Mastra.`,
|
|
20518
20732
|
details: {
|
|
20519
20733
|
agentName: this.name,
|
|
20520
20734
|
modelId,
|
|
20521
20735
|
provider,
|
|
20522
|
-
specificationVersion:
|
|
20736
|
+
specificationVersion: specVersion
|
|
20523
20737
|
}
|
|
20524
20738
|
});
|
|
20525
20739
|
}
|
|
@@ -20562,7 +20776,7 @@ ${errorMessages}`,
|
|
|
20562
20776
|
const defaultOptions = await this.getDefaultOptions({
|
|
20563
20777
|
requestContext: streamOptions?.requestContext
|
|
20564
20778
|
});
|
|
20565
|
-
const mergedOptions =
|
|
20779
|
+
const mergedOptions = chunkOOCEAC6U_cjs.deepMerge(
|
|
20566
20780
|
defaultOptions,
|
|
20567
20781
|
streamOptions ?? {}
|
|
20568
20782
|
);
|
|
@@ -20573,16 +20787,17 @@ ${errorMessages}`,
|
|
|
20573
20787
|
if (!isSupportedLanguageModel(modelInfo)) {
|
|
20574
20788
|
const modelId = modelInfo.modelId || "unknown";
|
|
20575
20789
|
const provider = modelInfo.provider || "unknown";
|
|
20790
|
+
const specVersion = modelInfo.specificationVersion;
|
|
20576
20791
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
20577
20792
|
id: "AGENT_STREAM_V1_MODEL_NOT_SUPPORTED",
|
|
20578
20793
|
domain: "AGENT" /* AGENT */,
|
|
20579
20794
|
category: "USER" /* USER */,
|
|
20580
|
-
text: `Agent "${this.name}" is using AI SDK v4 model (${provider}:${modelId}) which is not compatible with stream(). Please use AI SDK v5+ models or call the streamLegacy() method instead. See https://mastra.ai/en/docs/streaming/overview for more information.`,
|
|
20795
|
+
text: specVersion === "v1" ? `Agent "${this.name}" is using AI SDK v4 model (${provider}:${modelId}) which is not compatible with stream(). Please use AI SDK v5+ models or call the streamLegacy() method instead. See https://mastra.ai/en/docs/streaming/overview for more information.` : `Agent "${this.name}" has a model (${provider}:${modelId}) with unrecognized specificationVersion "${specVersion}". Supported versions: v1 (legacy), v2 (AI SDK v5), v3 (AI SDK v6). Please ensure your AI SDK provider is compatible with this version of Mastra.`,
|
|
20581
20796
|
details: {
|
|
20582
20797
|
agentName: this.name,
|
|
20583
20798
|
modelId,
|
|
20584
20799
|
provider,
|
|
20585
|
-
specificationVersion:
|
|
20800
|
+
specificationVersion: specVersion
|
|
20586
20801
|
}
|
|
20587
20802
|
});
|
|
20588
20803
|
}
|
|
@@ -20619,7 +20834,7 @@ ${errorMessages}`,
|
|
|
20619
20834
|
const defaultOptions = await this.getDefaultOptions({
|
|
20620
20835
|
requestContext: streamOptions?.requestContext
|
|
20621
20836
|
});
|
|
20622
|
-
let mergedStreamOptions =
|
|
20837
|
+
let mergedStreamOptions = chunkOOCEAC6U_cjs.deepMerge(
|
|
20623
20838
|
defaultOptions,
|
|
20624
20839
|
streamOptions ?? {}
|
|
20625
20840
|
);
|
|
@@ -20627,11 +20842,18 @@ ${errorMessages}`,
|
|
|
20627
20842
|
requestContext: mergedStreamOptions.requestContext
|
|
20628
20843
|
});
|
|
20629
20844
|
if (!isSupportedLanguageModel(llm.getModel())) {
|
|
20845
|
+
const modelInfo = llm.getModel();
|
|
20846
|
+
const specVersion = modelInfo.specificationVersion;
|
|
20630
20847
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
20631
20848
|
id: "AGENT_STREAM_V1_MODEL_NOT_SUPPORTED",
|
|
20632
20849
|
domain: "AGENT" /* AGENT */,
|
|
20633
20850
|
category: "USER" /* USER */,
|
|
20634
|
-
text: "V1 models are not supported for
|
|
20851
|
+
text: specVersion === "v1" ? "V1 models are not supported for resumeStream. Please use streamLegacy instead." : `Model has unrecognized specificationVersion "${specVersion}". Supported versions: v1 (legacy), v2 (AI SDK v5), v3 (AI SDK v6). Please ensure your AI SDK provider is compatible with this version of Mastra.`,
|
|
20852
|
+
details: {
|
|
20853
|
+
modelId: modelInfo.modelId,
|
|
20854
|
+
provider: modelInfo.provider,
|
|
20855
|
+
specificationVersion: specVersion
|
|
20856
|
+
}
|
|
20635
20857
|
});
|
|
20636
20858
|
}
|
|
20637
20859
|
const workflowsStore = await this.#mastra?.getStorage()?.getStore("workflows");
|
|
@@ -20686,7 +20908,7 @@ ${errorMessages}`,
|
|
|
20686
20908
|
const defaultOptions = await this.getDefaultOptions({
|
|
20687
20909
|
requestContext: options?.requestContext
|
|
20688
20910
|
});
|
|
20689
|
-
const mergedOptions =
|
|
20911
|
+
const mergedOptions = chunkOOCEAC6U_cjs.deepMerge(
|
|
20690
20912
|
defaultOptions,
|
|
20691
20913
|
options ?? {}
|
|
20692
20914
|
);
|
|
@@ -20697,16 +20919,17 @@ ${errorMessages}`,
|
|
|
20697
20919
|
if (!isSupportedLanguageModel(modelInfo)) {
|
|
20698
20920
|
const modelId = modelInfo.modelId || "unknown";
|
|
20699
20921
|
const provider = modelInfo.provider || "unknown";
|
|
20922
|
+
const specVersion = modelInfo.specificationVersion;
|
|
20700
20923
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
20701
20924
|
id: "AGENT_GENERATE_V1_MODEL_NOT_SUPPORTED",
|
|
20702
20925
|
domain: "AGENT" /* AGENT */,
|
|
20703
20926
|
category: "USER" /* USER */,
|
|
20704
|
-
text: `Agent "${this.name}" is using AI SDK v4 model (${provider}:${modelId}) which is not compatible with generate(). Please use AI SDK v5+ models or call the generateLegacy() method instead. See https://mastra.ai/en/docs/streaming/overview for more information.`,
|
|
20927
|
+
text: specVersion === "v1" ? `Agent "${this.name}" is using AI SDK v4 model (${provider}:${modelId}) which is not compatible with generate(). Please use AI SDK v5+ models or call the generateLegacy() method instead. See https://mastra.ai/en/docs/streaming/overview for more information.` : `Agent "${this.name}" has a model (${provider}:${modelId}) with unrecognized specificationVersion "${specVersion}". Supported versions: v1 (legacy), v2 (AI SDK v5), v3 (AI SDK v6). Please ensure your AI SDK provider is compatible with this version of Mastra.`,
|
|
20705
20928
|
details: {
|
|
20706
20929
|
agentName: this.name,
|
|
20707
20930
|
modelId,
|
|
20708
20931
|
provider,
|
|
20709
|
-
specificationVersion:
|
|
20932
|
+
specificationVersion: specVersion
|
|
20710
20933
|
}
|
|
20711
20934
|
});
|
|
20712
20935
|
}
|
|
@@ -22890,7 +23113,7 @@ var ToolSearchProcessor = class {
|
|
|
22890
23113
|
minScore: options.search?.minScore ?? 0
|
|
22891
23114
|
};
|
|
22892
23115
|
this.ttl = options.ttl ?? 36e5;
|
|
22893
|
-
this.bm25Index = new
|
|
23116
|
+
this.bm25Index = new chunkCGPH7CMG_cjs.BM25Index({}, TOOL_SEARCH_TOKENIZE_OPTIONS);
|
|
22894
23117
|
this.indexTools();
|
|
22895
23118
|
if (this.ttl > 0) {
|
|
22896
23119
|
this.scheduleCleanup();
|
|
@@ -23055,7 +23278,7 @@ var ToolSearchProcessor = class {
|
|
|
23055
23278
|
messageList.addSystem(
|
|
23056
23279
|
"To discover available tools, call search_tools with a keyword query. To add a tool to the conversation, call load_tool with the tool name. Tools must be loaded before they can be used."
|
|
23057
23280
|
);
|
|
23058
|
-
const searchTool =
|
|
23281
|
+
const searchTool = chunk7UWHFWST_cjs.createTool({
|
|
23059
23282
|
id: "search_tools",
|
|
23060
23283
|
description: "Search for available tools by keyword. Use this when you need a capability you don't currently have. Returns a list of matching tools with their names and descriptions. After finding a useful tool, use load_tool to make it available.",
|
|
23061
23284
|
inputSchema: z10.z.object({
|
|
@@ -23085,7 +23308,7 @@ var ToolSearchProcessor = class {
|
|
|
23085
23308
|
};
|
|
23086
23309
|
}
|
|
23087
23310
|
});
|
|
23088
|
-
const loadTool =
|
|
23311
|
+
const loadTool = chunk7UWHFWST_cjs.createTool({
|
|
23089
23312
|
id: "load_tool",
|
|
23090
23313
|
description: "Load a specific tool into your context. Call this after finding a tool with search_tools. Once loaded, the tool will be available for use. Args: toolName - The exact name of the tool to load (from search results).",
|
|
23091
23314
|
inputSchema: z10.z.object({
|
|
@@ -23637,7 +23860,7 @@ var SemanticRecall = class {
|
|
|
23637
23860
|
*/
|
|
23638
23861
|
formatCrossThreadMessages(messages, currentThreadId) {
|
|
23639
23862
|
let result = ``;
|
|
23640
|
-
const v1Messages = new
|
|
23863
|
+
const v1Messages = new chunkUE2G2LRP_cjs.MessageList().add(messages, "memory").get.all.v1();
|
|
23641
23864
|
let lastYmd = null;
|
|
23642
23865
|
for (const msg of v1Messages) {
|
|
23643
23866
|
const date = msg.createdAt;
|
|
@@ -23975,7 +24198,7 @@ function augmentWithInit(storage) {
|
|
|
23975
24198
|
}
|
|
23976
24199
|
|
|
23977
24200
|
// src/memory/memory.ts
|
|
23978
|
-
var MemoryProcessor = class extends
|
|
24201
|
+
var MemoryProcessor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
23979
24202
|
/**
|
|
23980
24203
|
* Process a list of messages and return a filtered or transformed list.
|
|
23981
24204
|
* @param messages The messages to process
|
|
@@ -24005,7 +24228,7 @@ var memoryDefaultOptions = {
|
|
|
24005
24228
|
`
|
|
24006
24229
|
}
|
|
24007
24230
|
};
|
|
24008
|
-
var MastraMemory = class extends
|
|
24231
|
+
var MastraMemory = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
24009
24232
|
/**
|
|
24010
24233
|
* Unique identifier for the memory instance.
|
|
24011
24234
|
* If not provided, defaults to a static name 'default-memory'.
|
|
@@ -24071,7 +24294,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
24071
24294
|
);
|
|
24072
24295
|
}
|
|
24073
24296
|
if (typeof config.embedder === "string") {
|
|
24074
|
-
this.embedder = new
|
|
24297
|
+
this.embedder = new chunkGCTAD6B7_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
24075
24298
|
} else {
|
|
24076
24299
|
this.embedder = config.embedder;
|
|
24077
24300
|
}
|
|
@@ -24110,7 +24333,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
24110
24333
|
}
|
|
24111
24334
|
setEmbedder(embedder, embedderOptions) {
|
|
24112
24335
|
if (typeof embedder === "string") {
|
|
24113
|
-
this.embedder = new
|
|
24336
|
+
this.embedder = new chunkGCTAD6B7_cjs.ModelRouterEmbeddingModel(embedder);
|
|
24114
24337
|
} else {
|
|
24115
24338
|
this.embedder = embedder;
|
|
24116
24339
|
}
|
|
@@ -24177,7 +24400,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
24177
24400
|
"The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
|
|
24178
24401
|
);
|
|
24179
24402
|
}
|
|
24180
|
-
const mergedConfig =
|
|
24403
|
+
const mergedConfig = chunkOOCEAC6U_cjs.deepMerge(this.threadConfig, config || {});
|
|
24181
24404
|
if (typeof config?.workingMemory === "object" && config.workingMemory?.schema && typeof mergedConfig.workingMemory === "object") {
|
|
24182
24405
|
mergedConfig.workingMemory.schema = config.workingMemory.schema;
|
|
24183
24406
|
}
|
|
@@ -24471,7 +24694,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
24471
24694
|
} = {}) {
|
|
24472
24695
|
super({
|
|
24473
24696
|
name: "mock",
|
|
24474
|
-
storage: storage || new
|
|
24697
|
+
storage: storage || new chunkJU6K7UDX_cjs.InMemoryStore(),
|
|
24475
24698
|
options: {
|
|
24476
24699
|
workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : void 0,
|
|
24477
24700
|
lastMessages: enableMessageHistory ? 10 : void 0
|
|
@@ -24549,7 +24772,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
24549
24772
|
return {};
|
|
24550
24773
|
}
|
|
24551
24774
|
return {
|
|
24552
|
-
updateWorkingMemory:
|
|
24775
|
+
updateWorkingMemory: chunk7UWHFWST_cjs.createTool({
|
|
24553
24776
|
id: "update-working-memory",
|
|
24554
24777
|
description: `Update the working memory with new information. Any data not included will be overwritten.`,
|
|
24555
24778
|
inputSchema: z10__default.default.object({ memory: z10__default.default.string() }),
|
|
@@ -24557,21 +24780,30 @@ var MockMemory = class extends MastraMemory {
|
|
|
24557
24780
|
const threadId = context?.agent?.threadId;
|
|
24558
24781
|
const resourceId = context?.agent?.resourceId;
|
|
24559
24782
|
const memory = context?.memory;
|
|
24560
|
-
if (!
|
|
24561
|
-
throw new Error("
|
|
24783
|
+
if (!memory) {
|
|
24784
|
+
throw new Error("Memory instance is required for working memory updates");
|
|
24562
24785
|
}
|
|
24563
|
-
|
|
24564
|
-
if (!
|
|
24565
|
-
thread
|
|
24566
|
-
threadId,
|
|
24567
|
-
resourceId,
|
|
24568
|
-
memoryConfig: _config
|
|
24569
|
-
});
|
|
24786
|
+
const scope = mergedConfig.workingMemory?.scope || "resource";
|
|
24787
|
+
if (scope === "thread" && !threadId) {
|
|
24788
|
+
throw new Error("Thread ID is required for thread-scoped working memory updates");
|
|
24570
24789
|
}
|
|
24571
|
-
if (
|
|
24572
|
-
throw new Error(
|
|
24573
|
-
|
|
24574
|
-
|
|
24790
|
+
if (scope === "resource" && !resourceId) {
|
|
24791
|
+
throw new Error("Resource ID is required for resource-scoped working memory updates");
|
|
24792
|
+
}
|
|
24793
|
+
if (threadId) {
|
|
24794
|
+
let thread = await memory.getThreadById({ threadId });
|
|
24795
|
+
if (!thread) {
|
|
24796
|
+
thread = await memory.createThread({
|
|
24797
|
+
threadId,
|
|
24798
|
+
resourceId,
|
|
24799
|
+
memoryConfig: _config
|
|
24800
|
+
});
|
|
24801
|
+
}
|
|
24802
|
+
if (thread.resourceId && resourceId && thread.resourceId !== resourceId) {
|
|
24803
|
+
throw new Error(
|
|
24804
|
+
`Thread with id ${threadId} resourceId does not match the current resourceId ${resourceId}`
|
|
24805
|
+
);
|
|
24806
|
+
}
|
|
24575
24807
|
}
|
|
24576
24808
|
const workingMemory = typeof inputData.memory === "string" ? inputData.memory : JSON.stringify(inputData.memory);
|
|
24577
24809
|
await memory.updateWorkingMemory({
|
|
@@ -24770,5 +25002,5 @@ exports.validateStepRequestContext = validateStepRequestContext;
|
|
|
24770
25002
|
exports.validateStepResumeData = validateStepResumeData;
|
|
24771
25003
|
exports.validateStepStateData = validateStepStateData;
|
|
24772
25004
|
exports.validateStepSuspendData = validateStepSuspendData;
|
|
24773
|
-
//# sourceMappingURL=chunk-
|
|
24774
|
-
//# sourceMappingURL=chunk-
|
|
25005
|
+
//# sourceMappingURL=chunk-FLHFB23E.cjs.map
|
|
25006
|
+
//# sourceMappingURL=chunk-FLHFB23E.cjs.map
|