@mastra/core 1.87.0 → 1.88.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@internal_ai-v6@0.0.100/dist/index.d.ts +97 -2049
- package/dist/agent/agent.d.ts +10 -2
- package/dist/agent/durable/create-evented-agent.d.ts +2 -1
- package/dist/agent/durable/execution-engine.d.ts +4 -2
- package/dist/agent/durable/index.cjs +3 -2
- package/dist/agent/durable/index.js +3 -2
- package/dist/agent/durable/segment-spans.d.ts +7 -0
- package/dist/agent/durable/stored-signal-drain.d.ts +1 -1
- package/dist/agent/durable/types.d.ts +6 -0
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.js +2 -2
- package/dist/agent/request-context-snapshot.d.ts +5 -0
- package/dist/agent/thread-stream-runtime.d.ts +26 -4
- package/dist/agent-builder/ee/index.cjs +1 -1
- package/dist/agent-builder/ee/index.js +1 -1
- package/dist/agent-controller/index.cjs +1 -1
- package/dist/agent-controller/index.js +1 -1
- package/dist/{agent-controller-vUU_atR-.js → agent-controller-CQDCmsFD.js} +15 -9
- package/dist/{agent-controller-DckvJ7bq.cjs → agent-controller-NQKYmY0W.cjs} +15 -9
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-HAzB0JtC.js → background-tasks-B7UygDdO.js} +1 -1
- package/dist/{background-tasks-By_1e9Gf.cjs → background-tasks-CeARf1DK.cjs} +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{builder-CmtDqFLe.js → builder-CpAEmMdR.js} +2 -2
- package/dist/{builder-Dx8GMhFn.cjs → builder-Dmf04g9P.cjs} +2 -2
- package/dist/capabilities/302ai.json +196 -196
- package/dist/capabilities/abliteratedllm.json +33 -33
- package/dist/capabilities/abliteration-ai.json +9 -9
- package/dist/capabilities/above.json +13 -13
- package/dist/capabilities/adaption.json +7 -7
- package/dist/capabilities/adzuki.json +20 -20
- package/dist/capabilities/agentrouter.json +10 -10
- package/dist/capabilities/agnes.json +2 -2
- package/dist/capabilities/ai-router.json +6 -6
- package/dist/capabilities/aiand.json +27 -18
- package/dist/capabilities/aigrow.json +14 -14
- package/dist/capabilities/aimlapi.json +146 -146
- package/dist/capabilities/aipg.json +2 -2
- package/dist/capabilities/aixy.json +17 -17
- package/dist/capabilities/aki-io.json +14 -14
- package/dist/capabilities/alibaba-cn.json +94 -94
- package/dist/capabilities/alibaba-coding-plan-cn.json +5 -5
- package/dist/capabilities/alibaba-coding-plan.json +5 -5
- package/dist/capabilities/alibaba-token-plan-cn.json +50 -50
- package/dist/capabilities/alibaba-token-plan.json +53 -53
- package/dist/capabilities/alibaba.json +71 -71
- package/dist/capabilities/ambient.json +8 -8
- package/dist/capabilities/amd-tokenlab.json +4 -4
- package/dist/capabilities/amd.json +11 -11
- package/dist/capabilities/anthropic.json +36 -36
- package/dist/capabilities/anyapi.json +18 -18
- package/dist/capabilities/apiko.json +2 -2
- package/dist/capabilities/arcee.json +9 -9
- package/dist/capabilities/augure.json +5 -5
- package/dist/capabilities/auriko.json +23 -23
- package/dist/capabilities/bailing.json +5 -5
- package/dist/capabilities/baseten.json +47 -38
- package/dist/capabilities/bee.json +5 -5
- package/dist/capabilities/bothub.json +14 -14
- package/dist/capabilities/boundless.json +37 -37
- package/dist/capabilities/bumo.json +40 -40
- package/dist/capabilities/byteplus.json +22 -22
- package/dist/capabilities/cerebras.json +4 -4
- package/dist/capabilities/cheapaimodel.json +10 -10
- package/dist/capabilities/cheapest-token.json +25 -25
- package/dist/capabilities/chutes.json +34 -32
- package/dist/capabilities/cline-pass.json +29 -29
- package/dist/capabilities/cloudcode.json +7 -7
- package/dist/capabilities/cloudflare-workers-ai.json +15 -15
- package/dist/capabilities/commandcode.json +146 -146
- package/dist/capabilities/concentrate.json +286 -277
- package/dist/capabilities/cortecs.json +109 -109
- package/dist/capabilities/crossmodel.json +194 -194
- package/dist/capabilities/crusoe.json +13 -13
- package/dist/capabilities/daoxe.json +7 -7
- package/dist/capabilities/databricks.json +128 -120
- package/dist/capabilities/deepinfra.json +102 -102
- package/dist/capabilities/deepseek.json +4 -4
- package/dist/capabilities/digitalocean.json +113 -114
- package/dist/capabilities/dothoosh.json +29 -29
- package/dist/capabilities/doubleword.json +26 -26
- package/dist/capabilities/edenai.json +287 -278
- package/dist/capabilities/empiriolabs.json +169 -169
- package/dist/capabilities/engy.json +24 -18
- package/dist/capabilities/entrim.json +6 -6
- package/dist/capabilities/evroc.json +13 -13
- package/dist/capabilities/ezkielyna.json +9 -9
- package/dist/capabilities/fastrouter.json +79 -79
- package/dist/capabilities/fireworks-ai.json +92 -92
- package/dist/capabilities/freemodel.json +10 -10
- package/dist/capabilities/friendli.json +26 -5
- package/dist/capabilities/frogbot.json +97 -97
- package/dist/capabilities/gisoo.json +19 -19
- package/dist/capabilities/gmicloud.json +7 -7
- package/dist/capabilities/google.json +53 -53
- package/dist/capabilities/graphn.json +14 -14
- package/dist/capabilities/greenpt.json +34 -34
- package/dist/capabilities/groq.json +4 -4
- package/dist/capabilities/helicone.json +88 -88
- package/dist/capabilities/hetzner.json +4 -4
- package/dist/capabilities/hostinger-router.json +10 -10
- package/dist/capabilities/hpc-ai.json +2 -2
- package/dist/capabilities/huawei-maas.json +15 -15
- package/dist/capabilities/hubris.json +28 -28
- package/dist/capabilities/huggingface.json +87 -85
- package/dist/capabilities/hyper.json +24 -24
- package/dist/capabilities/impossibl.json +114 -114
- package/dist/capabilities/inception.json +3 -3
- package/dist/capabilities/inceptron.json +8 -8
- package/dist/capabilities/inco.json +2 -2
- package/dist/capabilities/infer.json +17 -17
- package/dist/capabilities/inferall.json +5 -5
- package/dist/capabilities/inference-coop.json +2 -2
- package/dist/capabilities/inferenceapis.json +27 -27
- package/dist/capabilities/inferris.json +3 -3
- package/dist/capabilities/infersia.json +11 -11
- package/dist/capabilities/infomaniak.json +2 -2
- package/dist/capabilities/io-net.json +2 -2
- package/dist/capabilities/iteracompute.json +38 -38
- package/dist/capabilities/jalapeno.json +10 -10
- package/dist/capabilities/jiekou.json +34 -34
- package/dist/capabilities/joingonka.json +4 -4
- package/dist/capabilities/jzstoken.json +49 -49
- package/dist/capabilities/keln.json +24 -24
- package/dist/capabilities/kenari.json +122 -137
- package/dist/capabilities/kilo.json +615 -614
- package/dist/capabilities/kimchi.json +14 -14
- package/dist/capabilities/kimi-code-plan-cn.json +9 -9
- package/dist/capabilities/kimi-code-plan-global.json +9 -9
- package/dist/capabilities/kitani.json +6 -6
- package/dist/capabilities/klavo.json +20 -20
- package/dist/capabilities/korouter.json +35 -35
- package/dist/capabilities/kunavo.json +10 -10
- package/dist/capabilities/liquid.json +9 -9
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +959 -923
- package/dist/capabilities/llmgateway.json +349 -340
- package/dist/capabilities/llmtr.json +29 -29
- package/dist/capabilities/logits.json +2 -2
- package/dist/capabilities/lowrouter.json +53 -53
- package/dist/capabilities/lyceum.json +12 -12
- package/dist/capabilities/melious.json +9 -9
- package/dist/capabilities/merge-gateway.json +271 -263
- package/dist/capabilities/meta.json +11 -11
- package/dist/capabilities/minimax-cn-coding-plan.json +5 -5
- package/dist/capabilities/minimax-cn.json +5 -5
- package/dist/capabilities/minimax-coding-plan.json +5 -5
- package/dist/capabilities/minimax.json +5 -5
- package/dist/capabilities/mistral.json +16 -16
- package/dist/capabilities/mixlayer.json +4 -4
- package/dist/capabilities/modal.json +11 -11
- package/dist/capabilities/model-oracle-ai.json +19 -19
- package/dist/capabilities/modelis.json +16 -16
- package/dist/capabilities/modular.json +5 -5
- package/dist/capabilities/moneo.json +10 -10
- package/dist/capabilities/moonshotai-cn.json +6 -6
- package/dist/capabilities/moonshotai.json +6 -6
- package/dist/capabilities/morph.json +18 -18
- package/dist/capabilities/munito-eu.json +8 -8
- package/dist/capabilities/munito.json +10 -10
- package/dist/capabilities/nan.json +33 -33
- package/dist/capabilities/nano-gpt.json +557 -567
- package/dist/capabilities/nearai.json +77 -77
- package/dist/capabilities/nebius.json +42 -34
- package/dist/capabilities/neon.json +127 -127
- package/dist/capabilities/neuralwatt.json +37 -37
- package/dist/capabilities/nokeep.json +4 -4
- package/dist/capabilities/novita-ai.json +115 -115
- package/dist/capabilities/nvidia.json +17 -17
- package/dist/capabilities/oathbreaker.json +5 -5
- package/dist/capabilities/obscurify.json +29 -29
- package/dist/capabilities/oci.json +6 -6
- package/dist/capabilities/ofox.json +265 -265
- package/dist/capabilities/ollama-cloud.json +52 -52
- package/dist/capabilities/openai.json +58 -61
- package/dist/capabilities/opencode-go.json +90 -90
- package/dist/capabilities/openreason.json +6 -6
- package/dist/capabilities/openrouter.json +550 -548
- package/dist/capabilities/opper.json +26 -26
- package/dist/capabilities/orcarouter.json +310 -294
- package/dist/capabilities/outerlabs.json +29 -29
- package/dist/capabilities/ovhcloud.json +22 -22
- package/dist/capabilities/pareto.json +4 -4
- package/dist/capabilities/perplexity-agent.json +69 -69
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +30 -30
- package/dist/capabilities/poe.json +111 -111
- package/dist/capabilities/poolside.json +2 -2
- package/dist/capabilities/powerspring.json +9 -9
- package/dist/capabilities/primalabs.json +11 -11
- package/dist/capabilities/prime.json +127 -119
- package/dist/capabilities/privatemode-ai.json +6 -6
- package/dist/capabilities/proxystacks.json +3 -3
- package/dist/capabilities/qiniu-ai.json +13 -13
- package/dist/capabilities/refuseless.json +5 -5
- package/dist/capabilities/regolo-ai.json +10 -10
- package/dist/capabilities/requesty.json +200 -200
- package/dist/capabilities/ruapi.json +20 -20
- package/dist/capabilities/runcrate.json +13 -13
- package/dist/capabilities/runinfra.json +19 -19
- package/dist/capabilities/sakana.json +5 -5
- package/dist/capabilities/sambanova.json +9 -9
- package/dist/capabilities/sandbase.json +22 -22
- package/dist/capabilities/sarvam.json +14 -14
- package/dist/capabilities/scaleway.json +17 -17
- package/dist/capabilities/scnet-token-plan.json +8 -8
- package/dist/capabilities/scx-ai.json +22 -22
- package/dist/capabilities/sensenova.json +11 -11
- package/dist/capabilities/siliconflow-cn.json +59 -59
- package/dist/capabilities/siliconflow.json +57 -57
- package/dist/capabilities/snowflake-cortex.json +19 -19
- package/dist/capabilities/sokkan.json +10 -10
- package/dist/capabilities/sparrowcodes.json +20 -20
- package/dist/capabilities/standardcompute.json +85 -85
- package/dist/capabilities/steadyrouter.json +40 -40
- package/dist/capabilities/stepfun-ai-step-plan.json +5 -5
- package/dist/capabilities/stepfun-ai.json +5 -5
- package/dist/capabilities/stepfun-step-plan.json +5 -5
- package/dist/capabilities/stepfun.json +5 -5
- package/dist/capabilities/stepping-stone.json +18 -18
- package/dist/capabilities/superbot-gg.json +4 -4
- package/dist/capabilities/synthetic.json +12 -12
- package/dist/capabilities/synthorai.json +21 -21
- package/dist/capabilities/teamorouter.json +17 -17
- package/dist/capabilities/teapot-router.json +13 -13
- package/dist/capabilities/tencent-token-plan-intl.json +22 -22
- package/dist/capabilities/tencent-token-plan.json +42 -42
- package/dist/capabilities/tencent-tokenhub.json +44 -44
- package/dist/capabilities/tensorx.json +43 -43
- package/dist/capabilities/tenstorrent.json +2 -2
- package/dist/capabilities/the-grid-ai.json +30 -30
- package/dist/capabilities/thinkingmachines.json +78 -78
- package/dist/capabilities/tinfoil.json +13 -13
- package/dist/capabilities/toapis.json +2 -2
- package/dist/capabilities/togetherai.json +54 -54
- package/dist/capabilities/tokengo.json +23 -23
- package/dist/capabilities/tokenharbor.json +217 -217
- package/dist/capabilities/tokenify.json +9 -9
- package/dist/capabilities/trustedrouter.json +6 -6
- package/dist/capabilities/trustedtokens.json +12 -12
- package/dist/capabilities/umans-ai-coding-plan.json +17 -17
- package/dist/capabilities/umans-ai.json +11 -11
- package/dist/capabilities/uncensuredai.json +5 -5
- package/dist/capabilities/unrestricted.json +4 -4
- package/dist/capabilities/uplinkswitch.json +20 -20
- package/dist/capabilities/upstage.json +2 -2
- package/dist/capabilities/vancine.json +20 -20
- package/dist/capabilities/vercel.json +580 -571
- package/dist/capabilities/vivgrid.json +61 -61
- package/dist/capabilities/volcengine-coding-plan.json +26 -26
- package/dist/capabilities/volcengine.json +24 -24
- package/dist/capabilities/vultr.json +15 -15
- package/dist/capabilities/wafer.ai.json +19 -19
- package/dist/capabilities/wallaby.json +5 -5
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +21 -21
- package/dist/capabilities/watt.json +19 -19
- package/dist/capabilities/xai.json +2 -2
- package/dist/capabilities/xpersona.json +13 -13
- package/dist/capabilities/xxapi.json +27 -27
- package/dist/capabilities/zai-coding-plan.json +11 -11
- package/dist/capabilities/zai.json +32 -32
- package/dist/capabilities/zenifra.json +27 -27
- package/dist/capabilities/zenmux.json +178 -178
- package/dist/capabilities/zerogpu.json +12 -12
- package/dist/capabilities/zhipuai-coding-plan.json +3 -3
- package/dist/capabilities/zhipuai.json +28 -28
- package/dist/capabilities/zro.json +7 -7
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-DChC1kXm.js → channels-BQ--aLCA.js} +1 -1
- package/dist/{channels-BamLzaJG.cjs → channels-CTCBsS5M.cjs} +1 -1
- package/dist/coding-agent/index.cjs +1 -1
- package/dist/coding-agent/index.js +1 -1
- package/dist/datasets/index.cjs +2 -2
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +804 -804
- package/dist/docs/references/docs-agents-human-in-the-loop.md +1 -1
- package/dist/docs/references/docs-agents-resumable-streams.md +3 -3
- package/dist/docs/references/docs-channels.md +8 -2
- package/dist/docs/references/docs-deployment-workers.md +10 -4
- package/dist/docs/references/docs-harness-durable-agents.md +17 -15
- package/dist/docs/references/docs-server-mcp.md +68 -0
- package/dist/docs/references/docs-server-pubsub.md +25 -16
- package/dist/docs/references/docs-signals-running-across-processes.md +9 -3
- package/dist/docs/references/docs-signals-sending-signals.md +1 -1
- package/dist/docs/references/docs-workflows-overview.md +3 -3
- package/dist/docs/references/reference-agents-agent.md +3 -1
- package/dist/docs/references/reference-agents-durable-agent.md +3 -3
- package/dist/docs/references/reference-configuration.md +60 -0
- package/dist/docs/references/reference-pubsub-base.md +1 -1
- package/dist/docs/references/reference-pubsub-caching-pubsub.md +1 -1
- package/dist/docs/references/reference-pubsub-google-cloud-pubsub.md +13 -7
- package/dist/docs/references/reference-pubsub-lease-provider.md +4 -0
- package/dist/docs/references/reference-pubsub-redis-streams.md +18 -9
- package/dist/docs/references/reference-pubsub-valkey-streams.md +25 -7
- package/dist/evals/index.cjs +1 -1
- package/dist/evals/index.js +1 -1
- package/dist/evals/scoreTraces/index.cjs +1 -1
- package/dist/evals/scoreTraces/index.js +1 -1
- package/dist/events/caching-pubsub.d.ts +3 -11
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.js +1 -1
- package/dist/events/pubsub.d.ts +2 -1
- package/dist/{execution-fence-BBKnrhWR.cjs → execution-fence-C8Q0wWkG.cjs} +841 -219
- package/dist/{execution-fence--VdnD7p4.js → execution-fence-DGFyUV5h.js} +841 -219
- package/dist/harness/index.cjs +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/index.cjs +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/provider-types.generated.d.ts +7689 -7673
- package/dist/llm/reasoning/account-switch.d.ts +50 -0
- package/dist/llm/reasoning/index.cjs +65 -0
- package/dist/llm/reasoning/index.d.ts +1 -0
- package/dist/llm/reasoning/index.js +61 -1
- package/dist/{llm-DknPJDW6.cjs → llm-RIAYOAtD.cjs} +2 -2
- package/dist/{llm-ccA_1Q-H.js → llm-YNjDFSui.js} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/loop/suspended-run-auto-resume.d.ts +15 -0
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
- package/dist/{manager-DWX6-Cx4.js → manager-DZhtdV6Q.js} +2 -2
- package/dist/{manager-D9F0i7O2.cjs → manager-Y-jYcS7T.cjs} +2 -2
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.d.ts +35 -11
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-BzWL4xI8.cjs → mastra-B2-HBq1-.cjs} +108 -20
- package/dist/{mastra-oUDN81l8.js → mastra-BJ54VxOO.js} +108 -20
- package/dist/memory/index.cjs +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{model-BwxfS6T_.js → model-cS3d5rmF.js} +1 -1
- package/dist/{model-BnD7SPlA.cjs → model-lzZPXaEV.cjs} +1 -1
- package/dist/{netlify-CS0VDbb9.cjs → netlify-1lti1j4Z.cjs} +1 -1
- package/dist/{netlify-DcY9gHCJ.js → netlify-ClBjc0Xg.js} +1 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/{output-helpers-k2-48ssH.js → output-helpers-D-qplq22.js} +13 -15
- package/dist/{output-helpers-By5FbLpp.cjs → output-helpers-D4O_oFne.cjs} +12 -14
- package/dist/processor-provider/index.cjs +1 -1
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +2 -2
- package/dist/processors/index.js +2 -2
- package/dist/{provider-registry-OggbU6OE.cjs → provider-registry-C6jd3Uxi.cjs} +21565 -21544
- package/dist/{provider-registry-BvbEoScB.js → provider-registry-C_XQJvu2.js} +21565 -21544
- package/dist/provider-registry.json +22006 -21980
- package/dist/{registry-generator-CDaf48a6.cjs → registry-generator-BYdAlox6.cjs} +1 -1
- package/dist/{registry-generator-BFOQQHyt.js → registry-generator-DBrTbThj.js} +1 -1
- package/dist/{rehydrate-CFoKaNlm.js → rehydrate-4xHubfOY.js} +2 -2
- package/dist/{rehydrate-QeS0NjGw.cjs → rehydrate-BtwY0ima.cjs} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{scheduler-0ShtMM1I.js → scheduler-D1qdie5k.js} +4 -2
- package/dist/{scheduler-CMjK0LoQ.cjs → scheduler-DE5lcHJA.cjs} +4 -2
- package/dist/server/index.d.ts +1 -1
- package/dist/server/types.d.ts +57 -0
- package/dist/storage/domains/memory/base.d.ts +6 -1
- package/dist/storage/index.cjs +2 -2
- package/dist/storage/index.js +2 -2
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-CNqAlDJF.cjs → stream-DqKDB3nL.cjs} +1 -1
- package/dist/{stream-D2rv1Ut1.js → stream-H_wVxqdK.js} +1 -1
- package/dist/test-utils/llm-mock.cjs +1 -1
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/{tool-loop-agent-Dusqj7-j.cjs → tool-loop-agent-D4gSdYuN.cjs} +3 -3
- package/dist/{tool-loop-agent-CFsOjueT.js → tool-loop-agent-DvZcOxWe.js} +3 -3
- package/dist/{utils-CIuOHPoS.cjs → utils-Dd4m7z13.cjs} +1 -1
- package/dist/{utils-DLnCt6E9.js → utils-h5k_ChdS.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-ShLcQTA5.js → validate-DQB9spZ1.js} +1 -1
- package/dist/{validate-1zReLtWc.cjs → validate-u6_TUYSo.cjs} +1 -1
- package/dist/vector/index.cjs +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.d.ts +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/worker/workers/orchestration-worker.d.ts +13 -0
- package/dist/{worker-CQ8rTJwQ.cjs → worker-0F7Nukyf.cjs} +2 -2
- package/dist/{worker-BPNrwCFs.cjs → worker-D-cq8McN.cjs} +117 -32
- package/dist/{worker-ngt-F1Iv.js → worker-DWOK2M_5.js} +117 -32
- package/dist/{worker-CKcQcPl8.js → worker-DmUkyJY_.js} +2 -2
- package/dist/{workflow-B_e5wMmz.cjs → workflow-DXE15e-w.cjs} +4 -4
- package/dist/{workflow-XDIVRsu4.js → workflow-DamOke3z.js} +4 -4
- package/dist/workflows/builder/index.cjs +1 -1
- package/dist/workflows/builder/index.js +1 -1
- package/dist/workflows/evented/index.cjs +1 -1
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/setup-warning.d.ts +20 -0
- package/dist/workflows/index.cjs +5 -5
- package/dist/workflows/index.js +5 -5
- package/dist/workflows/scheduler/types.d.ts +3 -0
- package/dist/workspace/tools/media.d.ts +2 -2
- package/package.json +7 -7
- package/src/llm/model/provider-types.generated.d.ts +7689 -7673
|
@@ -537,7 +537,7 @@ For automatic tool resumption to work:
|
|
|
537
537
|
| Manual (`resumeStream()`) | Programmatic control, webhooks, button clicks, external triggers |
|
|
538
538
|
| Automatic (`autoResumeSuspendedTools`) | Conversational flows where users provide resume data in natural language |
|
|
539
539
|
|
|
540
|
-
Both approaches work with the same tool definitions. Automatic resumption triggers only when suspended tools exist in the message history and the user sends a new message on the same thread.
|
|
540
|
+
Both approaches work with the same tool definitions. Automatic resumption triggers only when suspended tools exist in the message history and the user sends a new message on the same thread. A message sent with `sendMessage()` or queued with `queueMessage()` while the tool is suspended starts that turn. A tool waiting for approval keeps both waiting until it's approved or declined.
|
|
541
541
|
|
|
542
542
|
## Resuming after a restart
|
|
543
543
|
|
|
@@ -23,7 +23,7 @@ Mastra resolves the stream transport and replay cache separately:
|
|
|
23
23
|
- **Transport:** For the plain loop and the default durable engine, Mastra uses the first configured option: the agent's `durable.pubsub`, the agent's top-level `pubsub`, or `mastra.pubsub`. Evented steps publish on `mastra.pubsub` so workers can publish to the same stream.
|
|
24
24
|
- **Replay cache:** Mastra uses the agent's `durable.cache`, then `mastra.serverCache`, then an in-memory cache. Evented runs use the shared Mastra cache when replay caching is enabled. If the transport is already a `CachingPubSub`, Mastra reuses its cache. Set `durable.cache: false` to skip adding a replay cache without changing the transport or its retained history.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
The replay cache numbers each run's events and holds the run's ownership record. With more than one process, set up a PubSub backend and a server cache that every process shares in the same step, as in [distributed deployments](https://mastra.ai/docs/server/pubsub). With the default in-memory cache, only the process that started a run can serve it to the observe and abort routes, and evented steps that run on another process publish events that an offset can't skip.
|
|
27
27
|
|
|
28
28
|
## Configure streams
|
|
29
29
|
|
|
@@ -46,7 +46,7 @@ export const supportAgent = new Agent({
|
|
|
46
46
|
|
|
47
47
|
| Option | Default | Description |
|
|
48
48
|
| ------------------ | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
49
|
-
| `pubsub` | `mastra.pubsub` | Bus the run is published on. Use a shared bus to follow runs across processes.
|
|
49
|
+
| `pubsub` | `mastra.pubsub` | Bus the run is published on. Use a shared bus and a shared cache to follow runs across processes. |
|
|
50
50
|
| `cache` | `mastra.serverCache`, else an in-memory cache | Replay cache. Pass `false` to disable this cache. Transports such as Redis Streams can still replay retained history. |
|
|
51
51
|
| `shouldCache` | Every topic | Return `false` for a topic to skip caching it. |
|
|
52
52
|
| `cleanupTimeoutMs` | `30000` | How long after it finishes a run is cleared. `0` turns off this timer only. The cache's own expiry and eviction still apply. |
|
|
@@ -141,7 +141,7 @@ When several servers share a PubSub and cache, such as Redis, a run started on o
|
|
|
141
141
|
- Each run writes an ownership record (agent, run, resource and thread) to the cache before its first event. The server's observe and abort routes check the caller against that record, so tenant and thread checks hold on every server.
|
|
142
142
|
- An unknown, expired or evicted record returns 404. If the cache can't be read, the routes return 503 rather than skipping the check.
|
|
143
143
|
- With `durable: { cache: false }` the record is kept in `mastra.serverCache`, so ownership still works across servers. Replay then depends on the PubSub: one that keeps history, like Redis Streams, replays it, and an in-process bus delivers only live events.
|
|
144
|
-
- With the default in-memory cache
|
|
144
|
+
- With the default in-memory cache, each server keeps its own records, so only the server that started a run can observe or stop it through these routes, even when the PubSub is shared.
|
|
145
145
|
|
|
146
146
|
## Related
|
|
147
147
|
|
|
@@ -474,11 +474,13 @@ The default in-memory pub/sub can't cross instance boundaries, so on serverless
|
|
|
474
474
|
|
|
475
475
|
Without a shared pub/sub, that instance can't reach the active run and starts its own, leaving the original run untouched and the thread processed twice.
|
|
476
476
|
|
|
477
|
-
Configure a shared pub/sub backed by Redis Streams on the `Mastra` instance so leases and signals coordinate across instances:
|
|
477
|
+
Configure a shared pub/sub backed by Redis Streams on the `Mastra` instance so leases and signals coordinate across instances, and a server cache on the same Redis so every instance reads the same agent run streams:
|
|
478
478
|
|
|
479
479
|
```typescript
|
|
480
480
|
import { Mastra } from '@mastra/core'
|
|
481
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
481
482
|
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
483
|
+
import { Redis } from 'ioredis'
|
|
482
484
|
import { yourAgent } from './agents/your-agent'
|
|
483
485
|
|
|
484
486
|
export const mastra = new Mastra({
|
|
@@ -487,10 +489,14 @@ export const mastra = new Mastra({
|
|
|
487
489
|
url: process.env.REDIS_URL,
|
|
488
490
|
keyPrefix: 'mastra:my-app',
|
|
489
491
|
}),
|
|
492
|
+
cache: new RedisServerCache(
|
|
493
|
+
{ client: new Redis(process.env.REDIS_URL!) },
|
|
494
|
+
{ keyPrefix: 'mastra:my-app:cache:' },
|
|
495
|
+
),
|
|
490
496
|
})
|
|
491
497
|
```
|
|
492
498
|
|
|
493
|
-
Vercel's managed Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
|
|
499
|
+
Replicas of one deployment use the same `keyPrefix` values, and another deployment on the same Redis needs its own on both the pubsub and the cache. Vercel's managed Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
|
|
494
500
|
|
|
495
501
|
## Other adapters
|
|
496
502
|
|
|
@@ -85,18 +85,20 @@ The server generated by `mastra build` starts these workers automatically. If yo
|
|
|
85
85
|
|
|
86
86
|
This setup needs no external infrastructure beyond your storage adapter. It doesn't survive process crashes, and you can't scale individual components.
|
|
87
87
|
|
|
88
|
-
> **Warning:** The in-memory PubSub delivers events only inside the process that published them. Running several Mastra instances on one storage with it isn't supported for evented workflows or agents. Each instance restarts the others' active evented workflow runs when it boots. A multi-instance deployment needs a PubSub backend that redelivers unacknowledged events
|
|
88
|
+
> **Warning:** The in-memory PubSub delivers events only inside the process that published them. Running several Mastra instances on one storage with it isn't supported for evented workflows or agents. Each instance restarts the others' active evented workflow runs when it boots. A multi-instance deployment needs a PubSub backend that redelivers unacknowledged events, a storage adapter with workflow step guards, and, for evented agents, a server cache that every instance shares. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
89
89
|
|
|
90
90
|
### Split processes
|
|
91
91
|
|
|
92
|
-
To run workers in their own processes, configure a distributed [PubSub](https://mastra.ai/docs/server/pubsub) backend and use the `MASTRA_WORKERS` environment variable to control which workers start in each process.
|
|
92
|
+
To run workers in their own processes, configure a distributed [PubSub](https://mastra.ai/docs/server/pubsub) backend with a server cache that every process shares, and use the `MASTRA_WORKERS` environment variable to control which workers start in each process.
|
|
93
93
|
|
|
94
94
|
**Redis Streams + PostgreSQL**:
|
|
95
95
|
|
|
96
96
|
```typescript
|
|
97
97
|
import { Mastra } from '@mastra/core/mastra'
|
|
98
98
|
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
99
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
99
100
|
import { PostgresStore } from '@mastra/pg'
|
|
101
|
+
import { Redis } from 'ioredis'
|
|
100
102
|
|
|
101
103
|
export const mastra = new Mastra({
|
|
102
104
|
storage: new PostgresStore({
|
|
@@ -105,6 +107,7 @@ export const mastra = new Mastra({
|
|
|
105
107
|
pubsub: new RedisStreamsPubSub({
|
|
106
108
|
url: process.env.REDIS_URL!,
|
|
107
109
|
}),
|
|
110
|
+
cache: new RedisServerCache({ client: new Redis(process.env.REDIS_URL!) }),
|
|
108
111
|
})
|
|
109
112
|
```
|
|
110
113
|
|
|
@@ -114,6 +117,8 @@ export const mastra = new Mastra({
|
|
|
114
117
|
import { Mastra } from '@mastra/core/mastra'
|
|
115
118
|
import { GoogleCloudPubSub } from '@mastra/google-cloud-pubsub'
|
|
116
119
|
import { LibSQLStore } from '@mastra/libsql'
|
|
120
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
121
|
+
import { Redis } from 'ioredis'
|
|
117
122
|
|
|
118
123
|
export const mastra = new Mastra({
|
|
119
124
|
storage: new LibSQLStore({
|
|
@@ -122,14 +127,15 @@ export const mastra = new Mastra({
|
|
|
122
127
|
pubsub: new GoogleCloudPubSub({
|
|
123
128
|
projectId: process.env.GCP_PROJECT_ID!,
|
|
124
129
|
}),
|
|
130
|
+
cache: new RedisServerCache({ client: new Redis(process.env.REDIS_URL!) }),
|
|
125
131
|
})
|
|
126
132
|
```
|
|
127
133
|
|
|
128
|
-
Any [supported storage backend](https://mastra.ai/reference/workers/overview) works. Swap the storage adapter for your preferred database.
|
|
134
|
+
Any [supported storage backend](https://mastra.ai/reference/workers/overview) works. Swap the storage adapter for your preferred database. Google Cloud Pub/Sub has no matching server cache, so the second example can use any cache that every process shares: `RedisServerCache` from `@mastra/redis` as shown, `ValkeyServerCache` from `@mastra/valkey`, or `ConvexServerCache` from `@mastra/convex`.
|
|
129
135
|
|
|
130
136
|
Run the same build artifact in multiple containers, each with a different [`MASTRA_WORKERS`](https://mastra.ai/reference/workers/overview) value to control which worker starts in each process.
|
|
131
137
|
|
|
132
|
-
Split deployments require a distributed PubSub backend ([`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), [`ValkeyStreamsPubSub`](https://mastra.ai/reference/pubsub/valkey-streams), or [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub)), a shared [storage backend](https://mastra.ai/reference/workers/overview), and network connectivity between the orchestration worker and the API. Messages sent to a running evented agent reach a run on a worker only when the agent's memory uses [storage that shares pending signals across processes](https://mastra.ai/docs/server/pubsub).
|
|
138
|
+
Split deployments require a distributed PubSub backend ([`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), [`ValkeyStreamsPubSub`](https://mastra.ai/reference/pubsub/valkey-streams), or [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub)), a shared [storage backend](https://mastra.ai/reference/workers/overview), a shared server cache, and network connectivity between the orchestration worker and the API. The cache holds each agent run's numbered stream events and ownership record, so a client can observe and reconnect to a run through any process. Messages sent to a running evented agent reach a run on a worker only when the agent's memory uses [storage that shares pending signals across processes](https://mastra.ai/docs/server/pubsub).
|
|
133
139
|
|
|
134
140
|
### Select workers
|
|
135
141
|
|
|
@@ -68,17 +68,17 @@ A durable agent adds three layers on top of a regular agent:
|
|
|
68
68
|
|
|
69
69
|
2. **PubSub streaming**: The loop publishes chunks to a PubSub topic keyed by the run ID. The caller subscribes to that topic and pipes the chunks into a `ReadableStream`, while the cache replays any chunks missed during a disconnect.
|
|
70
70
|
|
|
71
|
-
3. **Cache layer**:
|
|
71
|
+
3. **Cache layer**: The server cache stores and numbers published events so that a late subscriber can catch up. It's in-memory by default. A deployment with several processes uses one they all share, such as Redis.
|
|
72
72
|
|
|
73
73
|
## Execution variants
|
|
74
74
|
|
|
75
75
|
Choose the engine based on where the agent should run:
|
|
76
76
|
|
|
77
|
-
| Native agent setting | Wrapper equivalent | Best for
|
|
78
|
-
| ------------------------------------ | -------------------------------------------------------- |
|
|
79
|
-
| `durable.executionEngine: 'default'` | `createDurableAgent()` from `@mastra/core/agent/durable` | Local development and single-process servers. You get a stream you can await directly.
|
|
80
|
-
| `durable.executionEngine: 'evented'` | `createEventedAgent()` from `@mastra/core/agent/durable` | Runs in the background, and you can follow the run through PubSub. It can run in one process or across multiple processes with a [supported PubSub backend and
|
|
81
|
-
| No native setting | `createInngestAgent()` from `@mastra/inngest` | On Inngest, with step memoization, retries, and a monitoring dashboard.
|
|
77
|
+
| Native agent setting | Wrapper equivalent | Best for |
|
|
78
|
+
| ------------------------------------ | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
79
|
+
| `durable.executionEngine: 'default'` | `createDurableAgent()` from `@mastra/core/agent/durable` | Local development and single-process servers. You get a stream you can await directly. |
|
|
80
|
+
| `durable.executionEngine: 'evented'` | `createEventedAgent()` from `@mastra/core/agent/durable` | Runs in the background, and you can follow the run through PubSub. It can run in one process or across multiple processes with a [supported PubSub backend, storage adapter, and server cache](https://mastra.ai/docs/server/pubsub). |
|
|
81
|
+
| No native setting | `createInngestAgent()` from `@mastra/inngest` | On Inngest, with step memoization, retries, and a monitoring dashboard. |
|
|
82
82
|
|
|
83
83
|
To set a default for registered native agents, use `durable.executionEngine` on [Mastra](https://mastra.ai/reference/core/mastra-class). An explicit agent setting overrides it. The choice is fixed at registration or first execution. Wrapper factories select their own engine without changing the wrapped agent's selection.
|
|
84
84
|
|
|
@@ -107,7 +107,7 @@ const agent = new Agent({
|
|
|
107
107
|
export const eventedWriter = createEventedAgent({ agent })
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
In one process, an evented agent runs on the default PubSub backend with no extra setup, which is how you try it locally. To run its steps on several processes, such as dedicated [workers](https://mastra.ai/docs/deployment/workers), configure a PubSub backend that redelivers unacknowledged events
|
|
110
|
+
In one process, an evented agent runs on the default PubSub backend with no extra setup, which is how you try it locally. To run its steps on several processes, such as dedicated [workers](https://mastra.ai/docs/deployment/workers), configure a PubSub backend that redelivers unacknowledged events, a storage adapter with workflow step guards, and a server cache that every process shares. `EventEmitterPubSub` and `UnixSocketPubSub` don't qualify. Messages sent to a running evented agent reach a run on another process only when the agent's memory uses [storage that shares pending signals across processes](https://mastra.ai/docs/server/pubsub). See [evented workflows and agents](https://mastra.ai/docs/server/pubsub) for the supported backends and adapters.
|
|
111
111
|
|
|
112
112
|
### Resumable streams for stored agents
|
|
113
113
|
|
|
@@ -183,21 +183,24 @@ for await (const chunk of output.fullStream) {
|
|
|
183
183
|
|
|
184
184
|
If you pass `idleTimeoutMs` and no chunks arrive for that long, Mastra checks `isAlive` when you provide it. If `isAlive` returns `true` or throws, the timer restarts and the stream stays open. Otherwise the stream ends with an error chunk and detaches the observer. The run itself is only cleaned up when `isAlive` returns `false`.
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
A registered durable agent uses the server cache of its `Mastra` instance, `InMemoryServerCache` by default, so resumable streams work within a single process. For reconnects across processes or replicas, set the PubSub backend and a server cache on `Mastra` in the same step, and share run storage between every process. The cache holds the events a reconnect replays and each run's ownership record. A shared transport delivers live events but can't recover events held only in another process's cache. A Redis cache also keeps retained events across process restarts:
|
|
187
187
|
|
|
188
188
|
```typescript
|
|
189
|
-
import {
|
|
189
|
+
import { Mastra } from '@mastra/core'
|
|
190
190
|
import { RedisServerCache } from '@mastra/redis'
|
|
191
|
+
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
191
192
|
import Redis from 'ioredis'
|
|
193
|
+
import { durableAgent } from './agents/durable-agent'
|
|
192
194
|
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
cache,
|
|
195
|
+
export const mastra = new Mastra({
|
|
196
|
+
agents: { durableAgent },
|
|
197
|
+
pubsub: new RedisStreamsPubSub({ url: process.env.REDIS_URL! }),
|
|
198
|
+
cache: new RedisServerCache({ client: new Redis(process.env.REDIS_URL!) }),
|
|
198
199
|
})
|
|
199
200
|
```
|
|
200
201
|
|
|
202
|
+
`createDurableAgent()` also accepts its own `cache`. Evented agents use the `Mastra` cache for run events even when given one, because their steps publish from whichever process runs them.
|
|
203
|
+
|
|
201
204
|
`createInngestAgent()` doesn't enable caching by default. Pass a `cache` option or register the agent with a `Mastra` instance that has a `serverCache` configured to enable resumable streams.
|
|
202
205
|
|
|
203
206
|
For cached topics, each published event is recorded in the cache before it's delivered live, so publish latency is bounded by the round-trip to the cache. If the cache write fails, the event is still delivered live but can't be replayed. `@mastra/redis` and `@mastra/valkey` record each event in a single round-trip using a Lua script. `@mastra/redis` falls back to separate commands when the client has no `evalScript` or when Redis Cluster rejects the multi-key script. Per-run workflow watch events (`workflow.events.v2.*`) are never cached. If the cache is remote (for example, in another region) and you don't need to resume a topic, use `shouldCache` to publish that topic straight through:
|
|
@@ -205,7 +208,6 @@ For cached topics, each published event is recorded in the cache before it's del
|
|
|
205
208
|
```typescript
|
|
206
209
|
export const durableAgent = createDurableAgent({
|
|
207
210
|
agent,
|
|
208
|
-
cache,
|
|
209
211
|
// Skip the replay cache for the per-chunk stream topic; other topics stay resumable.
|
|
210
212
|
shouldCache: topic => !topic.startsWith('agent.stream.'),
|
|
211
213
|
})
|
|
@@ -408,6 +408,74 @@ claude mcp add --transport http mastra https://my-app.example.com/api/mcp \
|
|
|
408
408
|
|
|
409
409
|
The endpoint doesn't return `403` with `error="insufficient_scope"` yet. A caller without `mcp:read` gets a plain `403`, because Mastra permissions aren't OAuth scopes a client could request.
|
|
410
410
|
|
|
411
|
+
## Server card
|
|
412
|
+
|
|
413
|
+
The endpoint publishes an experimental [MCP Server Card](https://github.com/modelcontextprotocol/experimental-ext-server-card) at `/api/mcp/server-card`. MCP clients and registries read it before connecting to learn the server's name, version, endpoint URL, and supported protocol versions. It never lists tools, resources, or anything about a user.
|
|
414
|
+
|
|
415
|
+
The card is public, even when `server.auth` is configured, and any origin can read it. It's served whenever the endpoint is, and it follows `server.mcp.path`:
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
curl https://my-app.example.com/api/mcp/server-card
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
```json
|
|
422
|
+
{
|
|
423
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",
|
|
424
|
+
"name": "com.example.my-app/mastra",
|
|
425
|
+
"version": "1.0.0",
|
|
426
|
+
"description": "Mastra server exposing agents, workflows, and tools over MCP",
|
|
427
|
+
"title": "Mastra",
|
|
428
|
+
"remotes": [
|
|
429
|
+
{
|
|
430
|
+
"type": "streamable-http",
|
|
431
|
+
"url": "https://my-app.example.com/api/mcp",
|
|
432
|
+
"supportedProtocolVersions": [
|
|
433
|
+
"2026-07-28",
|
|
434
|
+
"2025-11-25",
|
|
435
|
+
"2025-06-18",
|
|
436
|
+
"2025-03-26",
|
|
437
|
+
"2024-11-05",
|
|
438
|
+
"2024-10-07"
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
The name, title, and version come from `server.mcp.serverInfo`, and the URL from the request. Behind a proxy, set `server.mcp.card.url`, or `server.mcp.oauth.resource`, to the public URL. A card with a set URL can also be stored by shared caches. Set `server.mcp.card` to change other fields, or to `false` to stop serving it:
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
import { Mastra } from '@mastra/core'
|
|
449
|
+
|
|
450
|
+
export const mastra = new Mastra({
|
|
451
|
+
server: {
|
|
452
|
+
mcp: {
|
|
453
|
+
card: {
|
|
454
|
+
name: 'com.example/assistant',
|
|
455
|
+
url: 'https://my-app.example.com/api/mcp',
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
})
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
To publish a card for your own [`MCPServer`](https://mastra.ai/reference/tools/mcp-server), set its `serverCard` option.
|
|
463
|
+
|
|
464
|
+
An invalid `name`, `title`, `description`, `url`, or `websiteUrl` in `server.mcp.card`, such as a `name` without a slash, stops the server at startup with an error naming the field.
|
|
465
|
+
|
|
466
|
+
### CORS with a server adapter
|
|
467
|
+
|
|
468
|
+
`mastra dev` and `mastra build` send the card's CORS headers whatever `server.cors` is set to. When you mount Mastra in your own app with a [server adapter](https://mastra.ai/docs/server/server-adapters), your app's CORS middleware runs first. A plain cross-origin `GET` still gets `Access-Control-Allow-Origin: *`, but a browser that sends `If-None-Match` from a script first sends a preflight request, and your middleware answers it with its own origin rules. Skip your CORS middleware for the card path so the card answers the preflight itself:
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
import cors from 'cors'
|
|
472
|
+
|
|
473
|
+
const appCors = cors({ origin: 'https://app.example.com' })
|
|
474
|
+
app.use((req, res, next) =>
|
|
475
|
+
req.path === '/api/mcp/server-card' ? next() : appCors(req, res, next),
|
|
476
|
+
)
|
|
477
|
+
```
|
|
478
|
+
|
|
411
479
|
## Limitations
|
|
412
480
|
|
|
413
481
|
- Workflows run synchronously within the MCP request. Long-running workflows are bounded by your server's request timeout.
|
|
@@ -16,7 +16,7 @@ Several built-in systems publish and subscribe to events through the same pub/su
|
|
|
16
16
|
- **Scheduled workflows**: The scheduler dispatches due runs by publishing to the workflow topic. See [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows).
|
|
17
17
|
- **Background tasks**: A task manager dispatches work to a worker group and fans task lifecycle updates out to subscribers, which is how background task streams stay live. See [Background task streaming](https://mastra.ai/docs/harness/background-tasks).
|
|
18
18
|
- **Agent signals**: Sending a signal to an active agent run publishes an event on a thread topic. The event reaches the process that holds the run. A step of an evented run that executes in a different process gets the signal only through [storage that shares pending signals across processes](#signals-sent-to-a-running-evented-agent).
|
|
19
|
-
- **Resumable streams**: Stream chunks are published per run, so a client that reconnects can replay what it missed.
|
|
19
|
+
- **Resumable streams**: Stream chunks are published per run and recorded in the server cache, so a client that reconnects can replay what it missed.
|
|
20
20
|
|
|
21
21
|
Because these systems run on one bus, the backend you choose applies to all of them at once.
|
|
22
22
|
|
|
@@ -75,44 +75,49 @@ Use a distributed backend when you run more than one instance or host, and every
|
|
|
75
75
|
|
|
76
76
|
For example, sending a signal to an agent run requires the signal event to cross the process boundary to the instance that owns the run. With the in-process default, that instance never receives the event.
|
|
77
77
|
|
|
78
|
+
Configure a server cache (`cache`) that every instance shares in the same step. Each agent run keeps its ownership record and its numbered event log in that cache. With the default `InMemoryServerCache`, each instance has its own: the observe and abort routes only find a run on the instance that started it, and an [evented agent](#evented-workflows-and-agents) step that runs on another instance publishes events that a reconnecting client can't skip by offset.
|
|
79
|
+
|
|
78
80
|
[Durable agent](https://mastra.ai/docs/harness/durable-agents) crash recovery also depends on the backend when the storage adapter doesn't support run fencing. Recovery then uses the backend's leases to tell whether another instance still drives a run. `RedisStreamsPubSub` provides leases across hosts. `GoogleCloudPubSub` doesn't.
|
|
79
81
|
|
|
80
82
|
Both backends below deliver across processes and hosts and persist events for redelivery.
|
|
81
83
|
|
|
82
|
-
The following example uses [Redis Streams](https://redis.io/docs/latest/develop/data-types/streams/):
|
|
84
|
+
The following example uses [Redis Streams](https://redis.io/docs/latest/develop/data-types/streams/), with `RedisServerCache` from `@mastra/redis` on the same Redis:
|
|
83
85
|
|
|
84
86
|
```typescript
|
|
85
87
|
import { Mastra } from '@mastra/core'
|
|
88
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
86
89
|
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
90
|
+
import { Redis } from 'ioredis'
|
|
87
91
|
|
|
88
92
|
export const mastra = new Mastra({
|
|
89
|
-
pubsub: new RedisStreamsPubSub({
|
|
90
|
-
|
|
91
|
-
}),
|
|
93
|
+
pubsub: new RedisStreamsPubSub({ url: process.env.REDIS_URL! }),
|
|
94
|
+
cache: new RedisServerCache({ client: new Redis(process.env.REDIS_URL!) }),
|
|
92
95
|
})
|
|
93
96
|
```
|
|
94
97
|
|
|
95
|
-
The following example uses [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/docs):
|
|
98
|
+
The following example uses [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/docs). Google Cloud Pub/Sub has no matching server cache, so use any cache that every process shares: `RedisServerCache` from `@mastra/redis` as below, `ValkeyServerCache` from `@mastra/valkey`, or `ConvexServerCache` from `@mastra/convex`.
|
|
96
99
|
|
|
97
100
|
```typescript
|
|
98
101
|
import { Mastra } from '@mastra/core'
|
|
99
102
|
import { GoogleCloudPubSub } from '@mastra/google-cloud-pubsub'
|
|
103
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
104
|
+
import { Redis } from 'ioredis'
|
|
100
105
|
|
|
101
106
|
export const mastra = new Mastra({
|
|
102
|
-
pubsub: new GoogleCloudPubSub({
|
|
103
|
-
|
|
104
|
-
}),
|
|
107
|
+
pubsub: new GoogleCloudPubSub({ projectId: 'my-project' }),
|
|
108
|
+
cache: new RedisServerCache({ client: new Redis(process.env.REDIS_URL!) }),
|
|
105
109
|
})
|
|
106
110
|
```
|
|
107
111
|
|
|
108
112
|
## Evented workflows and agents
|
|
109
113
|
|
|
110
|
-
Workflows on the [evented execution engine](https://mastra.ai/docs/workflows/scheduled-workflows) and agents using [evented durable execution](https://mastra.ai/docs/harness/durable-agents) advance a run one event at a time. Any worker can take the next event, which lets several processes share one run. That only holds when the deployment has
|
|
114
|
+
Workflows on the [evented execution engine](https://mastra.ai/docs/workflows/scheduled-workflows) and agents using [evented durable execution](https://mastra.ai/docs/harness/durable-agents) advance a run one event at a time. Any worker can take the next event, which lets several processes share one run. That only holds when the deployment has the following:
|
|
111
115
|
|
|
112
116
|
- **A PubSub backend that redelivers unacknowledged events**: When a worker stops in the middle of a step, the backend gives the step's event to another worker.
|
|
113
117
|
- **A storage adapter with workflow step guards**: The backend can deliver the same event more than once, and the step guard keeps a later delivery from saving the step's result a second time. A step can still run more than once, so [make steps with side effects idempotent](https://mastra.ai/docs/workflows/overview).
|
|
118
|
+
- **For evented agents, a server cache that every process shares**: Each step appends its stream events to the run's log in the cache, which numbers them. With the default `InMemoryServerCache`, a step on another process publishes its events without a number, so a client that reconnects with an offset receives most of the run again.
|
|
114
119
|
|
|
115
|
-
The backends that redeliver are marked **Yes** in the [Choosing a backend](#choosing-a-backend) table. A backend's reference page says whether redelivery can be turned off. The storage adapters with workflow step guards are `@mastra/pg` and `@mastra/libsql`. With `@mastra/libsql`, see [evented agent worker takeover](https://mastra.ai/reference/pubsub/redis-streams) for the database setups that work across machines.
|
|
120
|
+
The backends that redeliver are marked **Yes** in the [Choosing a backend](#choosing-a-backend) table. A backend's reference page says whether redelivery can be turned off. The storage adapters with workflow step guards are `@mastra/pg` and `@mastra/libsql`. With `@mastra/libsql`, see [evented agent worker takeover](https://mastra.ai/reference/pubsub/redis-streams) for the database setups that work across machines. Set the cache as in the [distributed deployment examples](#distributed-deployments).
|
|
116
121
|
|
|
117
122
|
[`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter) and [`UnixSocketPubSub`](https://mastra.ai/reference/pubsub/unix-socket-pubsub) don't redeliver an event that a stopped process received and never acknowledged. On the default `EventEmitterPubSub`, evented workflows and agents run in one process, which is how you try the evented engine locally and run it in tests. Don't use either backend to run evented workflows or agents on several processes:
|
|
118
123
|
|
|
@@ -132,19 +137,23 @@ Messages and other signals sent to an evented agent's active run wait until a mo
|
|
|
132
137
|
| `@mastra/libsql` | Yes | [Depends on the connection](https://mastra.ai/integrations/databases/libsql) |
|
|
133
138
|
| `InMemoryStore` | Yes | No |
|
|
134
139
|
|
|
135
|
-
A run keeps its signals in storage when the agent's memory uses storage that keeps pending signals and the run is the thread's active run, with a thread and a `resourceId`. A run started with `prepare()` and a run with `readOnly` memory aren't the thread's active run. Any other evented run keeps its signals in the memory of the process that started it, and they reach the run only when that process executes the run's next step. Otherwise the agent answers them in a new turn after the run ends. Input from `queueMessage()` and `queueSignal()`
|
|
140
|
+
A run keeps its signals in storage when the agent's memory uses storage that keeps pending signals and the run is the thread's active run, with a thread and a `resourceId`. A run started with `prepare()` and a run with `readOnly` memory aren't the thread's active run. Any other evented run keeps its signals in the memory of the process that started it, and they reach the run only when that process executes the run's next step. Otherwise the agent answers them in a new turn after the run ends. Input from `queueMessage()` and `queueSignal()` waits in the memory of the process that queued it, and is lost if that process stops. When that process finds the thread held by another process's run instead of starting the turn itself, it passes the input to that process. If that run keeps its signals in storage, the passed input is stored as a row that waits for the run to end, and all rows the run releases start the thread's next turn together.
|
|
136
141
|
|
|
137
142
|
A stored signal that the run never takes waits for the thread's next run. The process that started the run starts that next run with the signal when the run ends, if that process is still up. When another run already holds the thread and reads the same storage, that run takes the signal at its next model request, or, if it already made its last one, the signal starts the thread's next turn when that run ends. Otherwise the signal waits for the thread's next run that reads the same storage. A run that fails deletes the signals its failed turn took, whether it fails in the process that started it or on a worker, and the thread's next run receives only the ones it never took. A failure that carries no saved progress is the exception, such as a step that runs out of deliveries with `storageVersion: 2`: the run then puts back the signals it took and never saved, and the thread's next run receives them again. When a run's `modelSettings.timeout.totalMs` deadline fires in the process that started it while another process executes its steps, the starting process saves only the turn's input, and the signals the interrupted step took and never saved go back to pending, so the thread's next run receives them again, also when the run saved earlier progress. A suspended run stops receiving signals once another run uses its thread, and signals sent to it afterwards wait for the thread's next run or are answered `blocked`, as [`sendSignal()`](https://mastra.ai/reference/agents/agent) describes. A signal taken by a step that crashes before the run saves its progress is taken again by the thread's next run if the crashed run never recovers or ends.
|
|
138
143
|
|
|
139
144
|
### Warning for unsupported setups
|
|
140
145
|
|
|
141
|
-
Mastra logs a warning
|
|
146
|
+
Mastra logs a warning when a setup can't support several processes:
|
|
142
147
|
|
|
143
148
|
- The PubSub backend delivers to other processes and doesn't redeliver unacknowledged events.
|
|
144
149
|
- The PubSub backend redelivers unacknowledged events and the storage adapter has no workflow step guards.
|
|
150
|
+
- The PubSub backend delivers to other processes, an evented agent is registered, and the server cache is `InMemoryServerCache`.
|
|
145
151
|
- The PubSub backend delivers to other processes and an evented agent's active run keeps its signals in one process.
|
|
146
152
|
|
|
147
|
-
|
|
153
|
+
The first two cases share one warning, logged the first time an evented run is created. The others are separate warnings:
|
|
154
|
+
|
|
155
|
+
- The server cache warning begins with `Evented agents aren't supported on several processes with this setup` and names the in-memory cache: `cache` on `Mastra`, or the cache of a `CachingPubSub` you configured as `pubsub`. Each process that can run an evented agent's steps logs it at startup, including dedicated workers. Mastra treats any other cache class as shared.
|
|
156
|
+
- The signals warning begins with `Signals sent to running evented agents aren't supported on several processes with this setup`, logged the first time such a run starts. It names the cause: the run has no memory, thread, or `resourceId`, the agent's memory storage doesn't keep pending signals, or that storage keeps them in one process.
|
|
148
157
|
|
|
149
158
|
The default `EventEmitterPubSub` doesn't trigger the warning, because its events never leave the process. `UnixSocketPubSub` triggers it even when one process uses the socket, because Mastra can't tell how many processes share it.
|
|
150
159
|
|
|
@@ -169,9 +178,9 @@ To disable the warning for a setup that one process uses, set the `MASTRA_DISABL
|
|
|
169
178
|
|
|
170
179
|
## Resumable streams
|
|
171
180
|
|
|
172
|
-
Resumable streams let a client reconnect and replay events it missed,
|
|
181
|
+
[Resumable streams](https://mastra.ai/docs/agents/resumable-streams) let a client reconnect and replay events it missed. Mastra records each agent run's events in the server cache before publishing them and numbers them, so a client can replay a run from the start or from an offset. Replay reaches across processes only when they share the cache, as in the [distributed deployment examples](#distributed-deployments). [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) also retains events and replays a topic to a new subscriber, but only from the start.
|
|
173
182
|
|
|
174
|
-
|
|
183
|
+
To record other topics too, wrap the backend in [`CachingPubSub`](https://mastra.ai/reference/pubsub/caching-pubsub). It records events per topic, except those Mastra publishes for the local process only, such as per-run workflow watch events, so a late or reconnecting subscriber can catch up before continuing with live events.
|
|
175
184
|
|
|
176
185
|
```typescript
|
|
177
186
|
import { Mastra } from '@mastra/core'
|
|
@@ -105,12 +105,14 @@ Signal providers have their own lifecycle. Call [`provider.stop()`](https://mast
|
|
|
105
105
|
|
|
106
106
|
## Configuration
|
|
107
107
|
|
|
108
|
-
A shared Redis Streams backend handles both signal delivery and thread leases:
|
|
108
|
+
A shared Redis Streams backend handles both signal delivery and thread leases, and a Redis server cache goes with it:
|
|
109
109
|
|
|
110
110
|
```typescript
|
|
111
111
|
import { Mastra } from '@mastra/core'
|
|
112
112
|
import { PostgresStore } from '@mastra/pg'
|
|
113
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
113
114
|
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
115
|
+
import { Redis } from 'ioredis'
|
|
114
116
|
|
|
115
117
|
export const mastra = new Mastra({
|
|
116
118
|
agents: { agent },
|
|
@@ -122,12 +124,16 @@ export const mastra = new Mastra({
|
|
|
122
124
|
url: process.env.REDIS_URL,
|
|
123
125
|
keyPrefix: 'mastra:my-app',
|
|
124
126
|
}),
|
|
127
|
+
cache: new RedisServerCache(
|
|
128
|
+
{ client: new Redis(process.env.REDIS_URL!) },
|
|
129
|
+
{ keyPrefix: 'mastra:my-app:cache:' },
|
|
130
|
+
),
|
|
125
131
|
})
|
|
126
132
|
```
|
|
127
133
|
|
|
128
|
-
Every instance points `storage` at the same database, so persisted signals, state signals, and notification records survive a restart and are visible to whichever process owns the thread.
|
|
134
|
+
Every instance points `storage` at the same database, so persisted signals, state signals, and notification records survive a restart and are visible to whichever process owns the thread. The shared `cache` holds each run's stream events and ownership record, so a client can observe a run and reconnect to it through any instance.
|
|
129
135
|
|
|
130
|
-
Use the same `keyPrefix` on every coordinating instance, and
|
|
136
|
+
Use the same `keyPrefix` values on every coordinating instance, and give environments sharing one Redis server their own prefix on both the pubsub and the cache. Vercel's managed Redis and Upstash Redis both work with `RedisStreamsPubSub`.
|
|
131
137
|
|
|
132
138
|
The lease settings are environment variables:
|
|
133
139
|
|
|
@@ -67,7 +67,7 @@ const result = agent.queueMessage('Also check whether the tests need updates.',
|
|
|
67
67
|
await result.accepted
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Queued input waits for the active run to finish, then starts a new run. On an idle thread it starts immediately. [`cancelQueuedMessages()`](https://mastra.ai/reference/agents/agent) removes input that no run has taken yet, without stopping the active run. Its awaited result lists the IDs this process cancelled, including ones it deleted from memory storage when it knows the thread's store: this process started the thread's current run and that run hasn't ended, or the agent's memory is a fixed instance and this process knows the thread's run keeps its signals in storage. Other processes cancel matching input when they get the request, and those IDs aren't in the result. Input a run already took stays delivered.
|
|
70
|
+
Queued input waits for the active run to finish, then starts a new run. On an idle thread it starts immediately. A run paused on a tool's `suspend()` with `autoResumeSuspendedTools` enabled counts as finished. Queued input starts the next run, which [resumes the tool](https://mastra.ai/docs/agents/human-in-the-loop). Input passed to another process because that process holds the thread's run is the exception when that run [keeps its signals in storage](https://mastra.ai/docs/server/pubsub): it's stored, and all input passed to that run starts one new run together. [`cancelQueuedMessages()`](https://mastra.ai/reference/agents/agent) removes input that no run has taken yet, without stopping the active run. Its awaited result lists the IDs this process cancelled, including ones it deleted from memory storage when it knows the thread's store: this process started the thread's current run and that run hasn't ended, or the agent's memory is a fixed instance and this process knows the thread's run keeps its signals in storage. Other processes cancel matching input when they get the request, and those IDs aren't in the result. Input a run already took stays delivered.
|
|
71
71
|
|
|
72
72
|
[`queueSignal()`](https://mastra.ai/reference/agents/agent) queues typed context with the same behavior but keeps the signal's `type`, `tagName`, and attributes.
|
|
73
73
|
|
|
@@ -127,7 +127,7 @@ export const testWorkflow = createWorkflow({
|
|
|
127
127
|
message: z.string()
|
|
128
128
|
}),
|
|
129
129
|
outputSchema: z.object({
|
|
130
|
-
|
|
130
|
+
formatted: z.string()
|
|
131
131
|
})
|
|
132
132
|
})
|
|
133
133
|
.then(step1)
|
|
@@ -149,7 +149,7 @@ export const testWorkflow = createWorkflow({
|
|
|
149
149
|
message: v.string()
|
|
150
150
|
})),
|
|
151
151
|
outputSchema: toStandardJsonSchema(v.object({
|
|
152
|
-
|
|
152
|
+
formatted: v.string()
|
|
153
153
|
}))
|
|
154
154
|
})
|
|
155
155
|
.then(step1)
|
|
@@ -170,7 +170,7 @@ export const testWorkflow = createWorkflow({
|
|
|
170
170
|
message: "string"
|
|
171
171
|
}),
|
|
172
172
|
outputSchema: type({
|
|
173
|
-
|
|
173
|
+
formatted: "string"
|
|
174
174
|
})
|
|
175
175
|
})
|
|
176
176
|
.then(step1)
|
|
@@ -237,7 +237,9 @@ For an evented agent on [storage that keeps pending signals](https://mastra.ai/d
|
|
|
237
237
|
|
|
238
238
|
### `queueMessage(message, options)`
|
|
239
239
|
|
|
240
|
-
Queues a user message for the next turn on a thread. If the thread is active, Mastra waits for the active run to finish, then starts a new run with the queued message. If the thread is idle, Mastra starts a run immediately.
|
|
240
|
+
Queues a user message for the next turn on a thread. If the thread is active, Mastra waits for the active run to finish, then starts a new run with the queued message. If the thread is idle, Mastra starts a run immediately. Messages passed to another process because it holds the thread's run are stored when that run [keeps its signals in storage](https://mastra.ai/docs/server/pubsub), and start one new run together when that run ends.
|
|
241
|
+
|
|
242
|
+
A run paused on a tool's `suspend()` with `autoResumeSuspendedTools` enabled counts as finished, because it's waiting for the user's next message. The queued message starts the next run, which [resumes the tool](https://mastra.ai/docs/agents/human-in-the-loop). A run paused for a tool approval or without `autoResumeSuspendedTools` keeps the message queued until it finishes.
|
|
241
243
|
|
|
242
244
|
```typescript
|
|
243
245
|
agent.queueMessage('Also check whether the tests need updates.', {
|
|
@@ -111,7 +111,7 @@ Returns: `DurableAgent`
|
|
|
111
111
|
|
|
112
112
|
Wraps an `Agent` with fire-and-forget durable execution on the built-in evented workflow engine. Like `createDurableAgent`, it returns a result you stream from, but the run is started without being awaited: events on the Mastra instance's PubSub drive execution independently of the caller. Register the agent on a `Mastra` instance with storage to get evented execution; without one, the agent falls back to the default in-process engine and logs a warning. It doesn't accept `id` or `name` overrides.
|
|
113
113
|
|
|
114
|
-
An evented agent runs in one process on any PubSub backend. Running its steps on several processes needs a backend that redelivers unacknowledged events
|
|
114
|
+
An evented agent runs in one process on any PubSub backend. Running its steps on several processes needs a backend that redelivers unacknowledged events, a storage adapter with workflow step guards, and a server cache on `Mastra` that every process shares. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
115
115
|
|
|
116
116
|
```typescript
|
|
117
117
|
import { createEventedAgent } from '@mastra/core/agent/durable'
|
|
@@ -125,7 +125,7 @@ Returns: `EventedAgent` (a subclass of `DurableAgent`)
|
|
|
125
125
|
|
|
126
126
|
**agent** (`Agent`): The Agent to wrap with evented durable execution capabilities.
|
|
127
127
|
|
|
128
|
-
**cache** (`MastraServerCache | false`): Cache for stored stream events, which enables resumable streams. If omitted, the agent inherits the cache from the Mastra instance, or uses an InMemoryServerCache. Set to false to disable caching.
|
|
128
|
+
**cache** (`MastraServerCache | false`): Cache for stored stream events, which enables resumable streams. If omitted, the agent inherits the cache from the Mastra instance, or uses an InMemoryServerCache. Once the agent is registered, evented run frames use the Mastra cache instead, because evented steps append there. Set to false to disable caching.
|
|
129
129
|
|
|
130
130
|
**pubsub** (`PubSub`): PubSub instance for streaming events. Once the agent is registered, evented run frames use mastra.pubsub instead, because evented steps publish there. (Default: `mastra.pubsub, or EventEmitterPubSub when unregistered`)
|
|
131
131
|
|
|
@@ -250,7 +250,7 @@ Indexed replay is limited to events still available in the configured cache. The
|
|
|
250
250
|
|
|
251
251
|
A failed cache write loses only that event from the cache. It has no `index`, and the events written before and after it still replay when the cache numbers and appends an event in one step. The in-memory and Valkey caches always do. `RedisServerCache` does while Redis scripting works, and switches to two steps when the client has no `eval` or Redis Cluster rejects the script with `CROSSSLOT`. A custom cache that keeps the default `listPushIndexed()` also takes two steps. A two-step cache can leave a gap that makes offset replay skip later events, so replay such a log without an `offset` and skip indexes already processed. Cache replay can't recover an event the cache never stored. A transport that retains it, such as `RedisStreamsPubSub`, can still deliver it without an `index`.
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
With a PubSub that reaches other processes, such as Redis Streams, set a server cache that every process shares, such as `RedisServerCache`, on the `Mastra` instance. With the default in-memory cache, a step of an evented agent (`createEventedAgent()`) that runs outside the process that started the run, such as on a dedicated worker, publishes its events without an index, so an offset can't skip them. An observer that reconnects through another process, such as a different server replica, can't replay from the starting process's cache either. Mastra logs a warning at startup when an evented agent runs on this setup. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
254
254
|
|
|
255
255
|
By default `observe()` waits indefinitely for events. If the process running the run dies, the run stops producing events but never emits a completion event, so the observed stream would wait forever. Pass `idleTimeoutMs` to end the stream after a bounded period of silence. Before timing out, `observe()` can consult an optional `isAlive` check. Return `true` while work continues, such as during a long-running tool call or a pause for human input. A `false` result ends the stream with an error, as does omitting `isAlive`. A transient throw from `isAlive` is treated as "still alive", so a momentary check failure never ends a live stream.
|
|
256
256
|
|