@mastra/core 1.88.0-alpha.0 → 1.88.0-alpha.1
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_core@0.1.4/dist/knowledge-compat/index.d.ts +17 -1
- package/dist/agent/durable/index.cjs +1 -1
- package/dist/agent/durable/index.js +1 -1
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.js +2 -2
- 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/model-catalog-cache.d.ts +9 -5
- package/dist/agent-controller/session.d.ts +17 -0
- package/dist/{agent-controller-NQKYmY0W.cjs → agent-controller-C-WK9bMA.cjs} +57 -53
- package/dist/{agent-controller-CQDCmsFD.js → agent-controller-Wxbc6702.js} +57 -53
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-B7UygDdO.js → background-tasks-DSMkHpbu.js} +1 -1
- package/dist/{background-tasks-CeARf1DK.cjs → background-tasks-DcKNctMR.cjs} +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{builder-Dmf04g9P.cjs → builder-CybmqbZt.cjs} +2 -2
- package/dist/{builder-CpAEmMdR.js → builder-PXwZnGYe.js} +2 -2
- package/dist/capabilities/302ai.json +194 -194
- package/dist/capabilities/abliteratedllm.json +30 -30
- package/dist/capabilities/abliteration-ai.json +6 -6
- package/dist/capabilities/above.json +18 -18
- package/dist/capabilities/adaption.json +11 -11
- package/dist/capabilities/adzuki.json +22 -22
- package/dist/capabilities/agentrouter.json +5 -5
- package/dist/capabilities/agnes.json +3 -3
- package/dist/capabilities/ai-router.json +7 -7
- package/dist/capabilities/aiand.json +23 -24
- package/dist/capabilities/aigrow.json +13 -13
- package/dist/capabilities/aimlapi.json +151 -151
- package/dist/capabilities/aipg.json +2 -2
- package/dist/capabilities/aixy.json +23 -23
- package/dist/capabilities/aki-io.json +13 -13
- package/dist/capabilities/alibaba-cn.json +99 -99
- package/dist/capabilities/alibaba-coding-plan-cn.json +3 -3
- package/dist/capabilities/alibaba-coding-plan.json +3 -3
- package/dist/capabilities/alibaba-token-plan-cn.json +48 -48
- package/dist/capabilities/alibaba-token-plan.json +48 -48
- package/dist/capabilities/alibaba.json +79 -79
- package/dist/capabilities/ambient.json +13 -13
- package/dist/capabilities/amd-tokenlab.json +2 -2
- package/dist/capabilities/amd.json +8 -8
- package/dist/capabilities/anthropic.json +32 -32
- package/dist/capabilities/anyapi.json +47 -47
- package/dist/capabilities/apiko.json +4 -4
- package/dist/capabilities/arcee.json +6 -6
- package/dist/capabilities/augure.json +5 -5
- package/dist/capabilities/auriko.json +19 -19
- package/dist/capabilities/bailing.json +4 -4
- package/dist/capabilities/baseten.json +31 -31
- package/dist/capabilities/bee.json +3 -3
- package/dist/capabilities/bothub.json +15 -15
- package/dist/capabilities/boundless.json +35 -35
- package/dist/capabilities/bumo.json +41 -41
- package/dist/capabilities/byteplus.json +28 -28
- package/dist/capabilities/cheapaimodel.json +9 -9
- package/dist/capabilities/cheapest-token.json +29 -29
- package/dist/capabilities/chutes.json +36 -36
- package/dist/capabilities/cline-pass.json +28 -28
- package/dist/capabilities/cloudcode.json +5 -5
- package/dist/capabilities/cloudferro-sherlock.json +4 -4
- package/dist/capabilities/cloudflare-workers-ai.json +12 -12
- package/dist/capabilities/commandcode.json +150 -150
- package/dist/capabilities/concentrate.json +282 -282
- package/dist/capabilities/cortecs.json +105 -105
- package/dist/capabilities/crossmodel.json +187 -187
- package/dist/capabilities/crusoe.json +19 -19
- package/dist/capabilities/daoxe.json +8 -8
- package/dist/capabilities/databricks.json +133 -133
- package/dist/capabilities/deepinfra.json +92 -92
- package/dist/capabilities/deepseek.json +3 -3
- package/dist/capabilities/digitalocean.json +115 -115
- package/dist/capabilities/dothoosh.json +27 -27
- package/dist/capabilities/doubleword.json +24 -24
- package/dist/capabilities/edenai.json +293 -284
- package/dist/capabilities/empiriolabs.json +161 -161
- package/dist/capabilities/engy.json +23 -23
- package/dist/capabilities/entrim.json +4 -4
- package/dist/capabilities/evroc.json +19 -19
- package/dist/capabilities/ezkielyna.json +6 -6
- package/dist/capabilities/fastrouter.json +94 -94
- package/dist/capabilities/fireworks-ai.json +102 -91
- package/dist/capabilities/freemodel.json +12 -12
- package/dist/capabilities/friendli.json +11 -11
- package/dist/capabilities/frogbot.json +89 -89
- package/dist/capabilities/gisoo.json +19 -19
- package/dist/capabilities/gmicloud.json +18 -18
- package/dist/capabilities/google.json +52 -52
- package/dist/capabilities/graphn.json +9 -9
- package/dist/capabilities/greenpt.json +34 -34
- package/dist/capabilities/groq.json +2 -2
- package/dist/capabilities/helicone.json +74 -74
- package/dist/capabilities/hetzner.json +4 -4
- package/dist/capabilities/hostinger-router.json +10 -10
- package/dist/capabilities/hpc-ai.json +9 -9
- package/dist/capabilities/huawei-maas.json +12 -12
- package/dist/capabilities/hubris.json +29 -29
- package/dist/capabilities/huggingface.json +93 -85
- package/dist/capabilities/humain.json +2 -2
- package/dist/capabilities/hyper.json +26 -26
- package/dist/capabilities/impossibl.json +160 -160
- package/dist/capabilities/inception.json +2 -2
- package/dist/capabilities/inceptron.json +8 -8
- package/dist/capabilities/inco.json +3 -3
- package/dist/capabilities/infer.json +15 -15
- package/dist/capabilities/inferall.json +6 -6
- package/dist/capabilities/inference-coop.json +4 -4
- package/dist/capabilities/inferenceapis.json +22 -22
- package/dist/capabilities/inferris.json +3 -3
- package/dist/capabilities/infersia.json +12 -12
- package/dist/capabilities/inferx.json +2 -2
- package/dist/capabilities/infomaniak.json +2 -2
- package/dist/capabilities/io-net.json +4 -4
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +36 -36
- package/dist/capabilities/jalapeno.json +10 -10
- package/dist/capabilities/jiekou.json +31 -31
- package/dist/capabilities/joingonka.json +4 -4
- package/dist/capabilities/jzstoken.json +44 -44
- package/dist/capabilities/keln.json +21 -21
- package/dist/capabilities/kenari.json +124 -124
- package/dist/capabilities/kilo.json +673 -633
- package/dist/capabilities/kimchi.json +19 -19
- package/dist/capabilities/kimi-code-plan-cn.json +5 -5
- package/dist/capabilities/kimi-code-plan-global.json +5 -5
- package/dist/capabilities/kitani.json +6 -6
- package/dist/capabilities/klavo.json +25 -25
- package/dist/capabilities/korouter.json +32 -32
- package/dist/capabilities/kunavo.json +6 -6
- package/dist/capabilities/liquid.json +8 -8
- package/dist/capabilities/llmgateway-providers.json +934 -932
- package/dist/capabilities/llmgateway.json +331 -329
- package/dist/capabilities/llmtr.json +18 -18
- package/dist/capabilities/longcat.json +2 -2
- package/dist/capabilities/lowrouter.json +65 -65
- package/dist/capabilities/lyceum.json +14 -14
- package/dist/capabilities/melious.json +8 -8
- package/dist/capabilities/merge-gateway.json +301 -301
- package/dist/capabilities/meta.json +12 -12
- package/dist/capabilities/mistral.json +26 -18
- package/dist/capabilities/mixlayer.json +3 -3
- package/dist/capabilities/modal.json +5 -5
- package/dist/capabilities/model-oracle-ai.json +24 -24
- package/dist/capabilities/modelis.json +17 -17
- package/dist/capabilities/modelscope.json +2 -2
- package/dist/capabilities/modular.json +16 -16
- package/dist/capabilities/moneo.json +5 -5
- package/dist/capabilities/morph.json +17 -17
- package/dist/capabilities/munito-eu.json +8 -8
- package/dist/capabilities/munito.json +8 -8
- package/dist/capabilities/nan.json +32 -32
- package/dist/capabilities/nano-gpt.json +578 -572
- package/dist/capabilities/nearai.json +123 -123
- package/dist/capabilities/nebius.json +32 -32
- package/dist/capabilities/neon.json +123 -123
- package/dist/capabilities/neuralwatt.json +36 -36
- package/dist/capabilities/nokeep.json +5 -5
- package/dist/capabilities/novita-ai.json +122 -122
- package/dist/capabilities/nvidia.json +24 -24
- package/dist/capabilities/oathbreaker.json +3 -3
- package/dist/capabilities/obscurify.json +33 -33
- package/dist/capabilities/oci.json +4 -4
- package/dist/capabilities/ofox.json +275 -275
- package/dist/capabilities/ollama-cloud.json +55 -55
- package/dist/capabilities/openai.json +57 -57
- package/dist/capabilities/opencode-go.json +91 -82
- package/dist/capabilities/openreason.json +6 -6
- package/dist/capabilities/openrouter.json +543 -543
- package/dist/capabilities/opper.json +30 -30
- package/dist/capabilities/orcarouter.json +273 -273
- package/dist/capabilities/outerlabs.json +33 -33
- package/dist/capabilities/ovhcloud.json +18 -18
- package/dist/capabilities/pareto.json +4 -4
- package/dist/capabilities/perplexity-agent.json +78 -78
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +38 -38
- package/dist/capabilities/poe.json +138 -138
- package/dist/capabilities/poolside.json +3 -3
- package/dist/capabilities/powerspring.json +11 -11
- package/dist/capabilities/primalabs.json +15 -15
- package/dist/capabilities/prime.json +117 -117
- 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 +4 -4
- package/dist/capabilities/regolo-ai.json +8 -8
- package/dist/capabilities/requesty.json +200 -200
- package/dist/capabilities/ruapi.json +19 -19
- package/dist/capabilities/runcrate.json +12 -12
- package/dist/capabilities/runinfra.json +17 -17
- package/dist/capabilities/sakana.json +7 -7
- package/dist/capabilities/sambanova.json +9 -9
- package/dist/capabilities/sandbase.json +30 -30
- package/dist/capabilities/sarvam.json +8 -8
- package/dist/capabilities/scaleway.json +16 -16
- package/dist/capabilities/scnet-token-plan.json +14 -14
- package/dist/capabilities/scx-ai.json +20 -20
- package/dist/capabilities/sensenova.json +10 -10
- package/dist/capabilities/siliconflow-cn.json +50 -50
- package/dist/capabilities/siliconflow.json +66 -66
- package/dist/capabilities/snowflake-cortex.json +19 -19
- package/dist/capabilities/sokkan.json +5 -5
- package/dist/capabilities/sparrowcodes.json +20 -20
- package/dist/capabilities/standardcompute.json +80 -80
- package/dist/capabilities/steadyrouter.json +34 -34
- package/dist/capabilities/stepfun-ai-step-plan.json +7 -7
- package/dist/capabilities/stepfun-ai.json +7 -7
- package/dist/capabilities/stepfun-step-plan.json +7 -7
- package/dist/capabilities/stepfun.json +7 -7
- package/dist/capabilities/stepping-stone.json +19 -19
- package/dist/capabilities/synthetic.json +8 -8
- package/dist/capabilities/synthorai.json +25 -25
- package/dist/capabilities/teamorouter.json +16 -16
- package/dist/capabilities/teapot-router.json +13 -13
- package/dist/capabilities/tencent-token-plan-intl.json +24 -24
- package/dist/capabilities/tencent-token-plan.json +39 -39
- package/dist/capabilities/tencent-tokenhub.json +47 -47
- package/dist/capabilities/tensorx.json +50 -50
- package/dist/capabilities/tenstorrent.json +2 -2
- package/dist/capabilities/the-grid-ai.json +26 -26
- package/dist/capabilities/thinkingmachines.json +64 -64
- package/dist/capabilities/tinfoil.json +10 -10
- package/dist/capabilities/toapis.json +2 -2
- package/dist/capabilities/togetherai.json +35 -35
- package/dist/capabilities/tokengo.json +26 -26
- package/dist/capabilities/tokenharbor.json +205 -205
- package/dist/capabilities/tokenify.json +9 -9
- package/dist/capabilities/trustedrouter.json +6 -6
- package/dist/capabilities/trustedtokens.json +19 -19
- package/dist/capabilities/umans-ai-coding-plan.json +17 -17
- package/dist/capabilities/umans-ai.json +13 -13
- package/dist/capabilities/unrestricted.json +4 -4
- package/dist/capabilities/uplinkswitch.json +21 -21
- package/dist/capabilities/vancine.json +17 -17
- package/dist/capabilities/vercel.json +584 -580
- package/dist/capabilities/verda.json +4 -4
- package/dist/capabilities/vivgrid.json +67 -67
- package/dist/capabilities/volcengine-coding-plan.json +21 -21
- package/dist/capabilities/volcengine.json +27 -27
- package/dist/capabilities/vultr.json +12 -12
- package/dist/capabilities/wafer.ai.json +20 -20
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +16 -16
- package/dist/capabilities/watt.json +25 -25
- package/dist/capabilities/xai.json +5 -5
- package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-cn.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
- package/dist/capabilities/xiaomi.json +3 -3
- package/dist/capabilities/xpersona.json +11 -11
- package/dist/capabilities/xxapi.json +23 -23
- package/dist/capabilities/zai-coding-plan.json +18 -18
- package/dist/capabilities/zai.json +31 -31
- package/dist/capabilities/zenifra.json +30 -30
- package/dist/capabilities/zenmux.json +191 -191
- package/dist/capabilities/zerogpu.json +10 -10
- package/dist/capabilities/zhipuai.json +30 -30
- package/dist/capabilities/zro.json +7 -7
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-BQ--aLCA.js → channels-Cxy4jW11.js} +1 -1
- package/dist/{channels-CTCBsS5M.cjs → channels-DNOI029U.cjs} +1 -1
- package/dist/coding-agent/index.cjs +1 -1
- package/dist/coding-agent/index.js +1 -1
- package/dist/{constants-Dro9fuhk.js → constants-C2Q-ZI5d.js} +6 -0
- package/dist/{constants-B2FVV_2e.cjs → constants-DPHwzvan.cjs} +6 -0
- 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 +1073 -1068
- package/dist/docs/references/docs-channels.md +42 -1
- package/dist/docs/references/docs-develop.md +2 -0
- package/dist/docs/references/docs-evals-experiments.md +2 -0
- package/dist/docs/references/docs-guides-build-an-eval-loop.md +5 -1
- package/dist/docs/references/docs-guides-overview.md +2 -1
- package/dist/docs/references/docs-knowledge-importers.md +11 -1
- package/dist/docs/references/docs-knowledge-scopes-and-access.md +26 -0
- package/dist/docs/references/docs-memory-message-history.md +24 -16
- package/dist/docs/references/docs-memory-overview.md +21 -17
- package/dist/docs/references/docs-sandbox-overview.md +12 -10
- package/dist/docs/references/docs-workflows-control-flow.md +20 -0
- package/dist/docs/references/integrations-observability-arthur.md +1 -1
- package/dist/docs/references/reference-agent-controller-agent-controller-class.md +1 -1
- package/dist/docs/references/reference-agent-controller-session.md +9 -0
- package/dist/docs/references/reference-knowledge-knowledge-class.md +1 -1
- package/dist/docs/references/reference-knowledge-knowledge-tools.md +1 -1
- package/dist/docs/references/reference-observability-tracing-bridges-datadog.md +12 -11
- package/dist/docs/references/reference-processors-processor-interface.md +1 -1
- package/dist/docs/references/reference-storage-overview.md +1 -1
- package/dist/docs/references/reference-voice-overview.md +0 -27
- package/dist/docs/references/reference-workflows-step.md +1 -1
- package/dist/docs/references/reference-workspace-workspace-class.md +3 -1
- package/dist/evals/index.cjs +2 -2
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +2 -2
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/{execution-fence-C8Q0wWkG.cjs → execution-fence-C1nozqra.cjs} +284 -97
- package/dist/{execution-fence-DGFyUV5h.js → execution-fence-pJB0qqFJ.js} +273 -98
- 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/importers/local-host.d.ts +2 -1
- package/dist/knowledge/importers/sink.d.ts +6 -0
- package/dist/knowledge/importers/types.d.ts +5 -0
- package/dist/knowledge/index.cjs +105 -20
- package/dist/knowledge/index.js +105 -21
- package/dist/knowledge/links.d.ts +19 -6
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/gateways/mastra.d.ts +19 -0
- package/dist/llm/model/gateways/refreshing-cache.d.ts +52 -0
- package/dist/llm/model/provider-types.generated.d.ts +8054 -8040
- package/dist/{llm-RIAYOAtD.cjs → llm-VhPqyULU.cjs} +2 -2
- package/dist/{llm-YNjDFSui.js → llm-_z1lIfCN.js} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/loop/workflows/agentic-execution/background-task-check-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/goal-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/is-task-complete-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +2 -0
- package/dist/loop/workflows/schema.d.ts +13 -0
- package/dist/{manager-Y-jYcS7T.cjs → manager-BT70SgFz.cjs} +3 -3
- package/dist/{manager-DZhtdV6Q.js → manager-C3Kx39p_.js} +3 -3
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-B2-HBq1-.cjs → mastra-CQGD2RoN.cjs} +16 -16
- package/dist/{mastra-BJ54VxOO.js → mastra-fJ0iKYGP.js} +16 -16
- package/dist/memory/index.cjs +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{model-lzZPXaEV.cjs → model-D9NDbf-e.cjs} +1 -1
- package/dist/{model-cS3d5rmF.js → model-DmBDBf-q.js} +1 -1
- package/dist/{netlify-1lti1j4Z.cjs → netlify-DNaNhels.cjs} +1 -1
- package/dist/{netlify-ClBjc0Xg.js → netlify-_yV5Nwud.js} +1 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- 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-C_XQJvu2.js → provider-registry-C4tv__fr.js} +19498 -19296
- package/dist/{provider-registry-C6jd3Uxi.cjs → provider-registry-_BUQuSKb.cjs} +19253 -19033
- package/dist/provider-registry.json +19144 -19115
- package/dist/{registry-generator-DBrTbThj.js → registry-generator-CenhQnEi.js} +1 -1
- package/dist/{registry-generator-BYdAlox6.cjs → registry-generator-D7lsLJC-.cjs} +1 -1
- package/dist/{rehydrate-4xHubfOY.js → rehydrate-CuWN_5No.js} +2 -2
- package/dist/{rehydrate-BtwY0ima.cjs → rehydrate-SpC_gJCY.cjs} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/storage/constants.cjs +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/knowledge/base.d.ts +11 -0
- package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
- package/dist/storage/domains/knowledge/pages-inmemory.d.ts +4 -0
- package/dist/storage/domains/knowledge/pages.d.ts +1 -1
- package/dist/storage/domains/observability/tracing.d.ts +12 -0
- package/dist/storage/index.cjs +4 -3
- package/dist/storage/index.js +4 -4
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-H_wVxqdK.js → stream-BfSwqzPi.js} +1 -1
- package/dist/{stream-DqKDB3nL.cjs → stream-CW3d1Xg6.cjs} +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-DvZcOxWe.js → tool-loop-agent-B4_o4-Me.js} +3 -3
- package/dist/{tool-loop-agent-D4gSdYuN.cjs → tool-loop-agent-JN_oKyfY.cjs} +3 -3
- package/dist/{utils-Dd4m7z13.cjs → utils-Bq606mC8.cjs} +1 -1
- package/dist/{utils-h5k_ChdS.js → utils-CnpMuTyD.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-u6_TUYSo.cjs → validate-CFv6HWXx.cjs} +1 -1
- package/dist/{validate-DQB9spZ1.js → validate-Db2C7Sj_.js} +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.js +1 -1
- package/dist/{worker-D-cq8McN.cjs → worker-CNIBQPQy.cjs} +2 -2
- package/dist/{worker-0F7Nukyf.cjs → worker-IZeSOZjg.cjs} +2 -2
- package/dist/{worker-DmUkyJY_.js → worker-UXFAgWOK.js} +2 -2
- package/dist/{worker-DWOK2M_5.js → worker-X0fAJfcx.js} +2 -2
- package/dist/{workflow-DXE15e-w.cjs → workflow-CMLLlVDc.cjs} +3 -3
- package/dist/{workflow-DamOke3z.js → workflow-DfXq2p2f.js} +3 -3
- 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/index.cjs +4 -4
- package/dist/workflows/index.js +4 -4
- package/dist/workspace/tools/media.d.ts +2 -2
- package/package.json +3 -3
- package/src/llm/model/provider-types.generated.d.ts +8054 -8040
|
@@ -184,7 +184,7 @@ Set `toolDisplay: 'text'` on an adapter to render tool calls as plain text inste
|
|
|
184
184
|
|
|
185
185
|
### Custom action handling
|
|
186
186
|
|
|
187
|
-
Use `handlers.onAction` to handle button clicks and select changes from cards you post yourself. The handler is called with the Chat SDK action event and the default handler, plus the same `ctx` the other channel handlers receive. Values you set on `ctx.requestContext` before delegating carry through to the resumed tool call. The default handler processes the built-in Approve and Deny buttons and ignores every other action ID, so call it for events you don't handle to keep tool approval working:
|
|
187
|
+
Use `handlers.onAction` to handle button clicks and select changes from cards you post yourself. The handler is called with the Chat SDK action event and the default handler, plus the same `ctx` the other channel handlers receive. Values you set on `ctx.requestContext` before delegating carry through to the resumed tool call. The default handler processes the built-in Approve and Deny buttons and the Continue button (`CONTINUE_RUN_ACTION_ID`), and ignores every other action ID, so call it for events you don't handle to keep tool approval and run continuation working:
|
|
188
188
|
|
|
189
189
|
```typescript
|
|
190
190
|
channels: {
|
|
@@ -294,6 +294,22 @@ Messages that come in over a channel carry a `platform` attribute (for example `
|
|
|
294
294
|
|
|
295
295
|
Replies on those runs go through the same adapter path as replies to a message. Mastra remembers the last person who wrote in the thread, so adapters that need a recipient, like Slack's native streaming, work the same way.
|
|
296
296
|
|
|
297
|
+
### Subscribe to threads the bot started
|
|
298
|
+
|
|
299
|
+
A thread the bot opened itself, such as a scheduled digest, has no Mastra thread until someone mentions the bot in it. Call `subscribeThread()` after posting to create that mapping and subscribe to the thread, so replies reach the agent without a mention. An existing mapping is reused and keeps its original owner.
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
const channels = agent.getChannels()!
|
|
303
|
+
const sent = await channels.sdk!.channel('slack:C123ABC').post('Daily digest is ready.')
|
|
304
|
+
|
|
305
|
+
await channels.subscribeThread({
|
|
306
|
+
thread: channels.sdk!.thread(sent.threadId),
|
|
307
|
+
resourceId: 'digest-bot',
|
|
308
|
+
})
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
`resourceId` owns the Mastra thread if a new one is created. Pass `threadId` to choose its ID, otherwise Mastra generates one.
|
|
312
|
+
|
|
297
313
|
## Multi-user awareness
|
|
298
314
|
|
|
299
315
|
In group conversations, Mastra prefixes each message with the sender's name and platform ID so the agent can distinguish between speakers:
|
|
@@ -360,6 +376,31 @@ channels: {
|
|
|
360
376
|
},
|
|
361
377
|
```
|
|
362
378
|
|
|
379
|
+
To let people continue a stopped run from the chat, return a card with a `CONTINUE_RUN_ACTION_ID` button from `formatError`. Pressing the button sends `Continue.` to the agent from the person who pressed it, through `onSubscribedMessage`, the same way a reply in the thread would:
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
import { CONTINUE_RUN_ACTION_ID } from '@mastra/core/channels'
|
|
383
|
+
import { Actions, Button, Card, CardText } from 'chat'
|
|
384
|
+
|
|
385
|
+
channels: {
|
|
386
|
+
adapters: {
|
|
387
|
+
slack: {
|
|
388
|
+
adapter: createSlackAdapter(),
|
|
389
|
+
formatError: error =>
|
|
390
|
+
Card({
|
|
391
|
+
title: 'Run stopped',
|
|
392
|
+
children: [
|
|
393
|
+
CardText(error.message),
|
|
394
|
+
Actions([Button({ id: CONTINUE_RUN_ACTION_ID, label: 'Continue' })]),
|
|
395
|
+
],
|
|
396
|
+
}),
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
The button does nothing when `onSubscribedMessage` or `onAction` is set to `false`.
|
|
403
|
+
|
|
363
404
|
Platform retries sometimes deliver an event more than once. Adapters use channel state for deduplication, which [storage](https://mastra.ai/docs/storage) can preserve across restarts. Because this protection is best effort, custom-handler side effects should be idempotent so duplicate delivery can't repeat work such as ticket creation.
|
|
364
405
|
|
|
365
406
|
### Batched messages
|
|
@@ -100,6 +100,8 @@ yarn dlx skills update mastra
|
|
|
100
100
|
bun x skills update mastra
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
From version 1.87, the `@mastra/core` package includes the `mastra` skill, so tools that sync skills from installed packages, such as [`skills`](https://github.com/vercel-labs/skills#sync-skills-from-npm-packages) and [pnpm](https://pnpm.io/agent-skills), can use it.
|
|
104
|
+
|
|
103
105
|
> **Note:** When you create a project with [create mastra](https://mastra.ai/docs), the command automatically installs the Mastra skills so your coding agent can discover and use them.
|
|
104
106
|
|
|
105
107
|
### Mastra CLI
|
|
@@ -246,6 +246,8 @@ Omitting `scorerIds` from an update preserves its current value. Each item versi
|
|
|
246
246
|
|
|
247
247
|
Mastra resolves scorer IDs the same way at every level by checking registered scorers first and then asking the Editor to load a stored scorer, so stored scorers work even in a durable run's worker that never loaded them. Mastra doesn't resolve IDs from lower-priority sources that the precedence rules ignore.
|
|
248
248
|
|
|
249
|
+
When an Editor is configured, creating an experiment pins the current version of every stored scorer it can use, at the experiment, dataset, and item level. Each item is scored with the pinned version, even if someone edits the scorer while the experiment runs. Scorers registered in code aren't versioned, so they aren't pinned.
|
|
250
|
+
|
|
249
251
|
An unknown ID in the experiment's `scorers` option rejects `startExperiment()`, `startExperimentAsync()`, or `createExperiment()` with the `EXPERIMENT_SCORER_NOT_FOUND` code before Mastra creates the experiment. The server returns a `400` response for this error.
|
|
250
252
|
|
|
251
253
|
If an item's scorer can't be found once the experiment is running, that item fails with the `EXPERIMENT_ITEM_SCORER_NOT_FOUND` code. This happens for a stale item-level or dataset-level ID, or for a scorer deleted after the experiment started. Mastra skips target execution without retrying that item, while the rest of the experiment continues.
|
|
@@ -392,4 +392,8 @@ const toneOfVoice = createRubricScorer({
|
|
|
392
392
|
|
|
393
393
|
### Limit response length
|
|
394
394
|
|
|
395
|
-
Use `checks.matches(/^[\s\S]{1,1000}$/)` to require an answer between 1 and 1,000 characters. Choose a limit appropriate to the task. See [Text checks](https://mastra.ai/docs/evals/quick-checks).
|
|
395
|
+
Use `checks.matches(/^[\s\S]{1,1000}$/)` to require an answer between 1 and 1,000 characters. Choose a limit appropriate to the task. See [Text checks](https://mastra.ai/docs/evals/quick-checks).
|
|
396
|
+
|
|
397
|
+
### Test stateful agents
|
|
398
|
+
|
|
399
|
+
When an agent has memory, context stored during one test case can leak into the next. See [Testing stateful agents](https://mastra.ai/docs/guides/testing-stateful-agents) to isolate threads and resources, seed known memory, and check what the agent stores.
|
|
@@ -12,4 +12,5 @@ These guides explain how Mastra's features work together when building AI applic
|
|
|
12
12
|
- [Authentication and identity](https://mastra.ai/docs/guides/authentication-identity)
|
|
13
13
|
- [MCP authentication](https://mastra.ai/docs/guides/mcp-authentication-authorization)
|
|
14
14
|
- [Streaming](https://mastra.ai/docs/guides/streaming)
|
|
15
|
-
- [Build an eval loop](https://mastra.ai/docs/guides/build-an-eval-loop)
|
|
15
|
+
- [Build an eval loop](https://mastra.ai/docs/guides/build-an-eval-loop)
|
|
16
|
+
- [Testing stateful agents](https://mastra.ai/docs/guides/testing-stateful-agents)
|
|
@@ -195,6 +195,14 @@ The first run prints `succeeded` with every article counted as `created`. Run it
|
|
|
195
195
|
|
|
196
196
|
Knowledge doesn't schedule runs. Call `run()` from your own scheduler, such as a cron job or a scheduled workflow. Only one run of a binding goes at a time. A second call while one is going returns `skipped`.
|
|
197
197
|
|
|
198
|
+
By default a flush holds up to `bufferSize` items, whatever their size. When your host limits request size, set `maxFlushBytes` so a batch of large items is sent in parts instead of failing at the same items on every run:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
await knowledge.importers!.run('acme-help-desk', { maxFlushBytes: 8 * 1024 * 1024 })
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The limit counts the request encoded as JSON. A host can also send its own limit when a run starts, and the runner keeps under the lower of the two. An item or saved cursor too big for a request on its own ends the run with the error code `flush_too_large`, before anything more is sent.
|
|
205
|
+
|
|
198
206
|
### Read the run result
|
|
199
207
|
|
|
200
208
|
A finished run has an `outcome` of `succeeded`, `failed` or `canceled`, and `counts` of what changed. `succeeded` means the run processed everything your importer sent. It doesn't mean the source and Knowledge are in sync: items can still be refused. Check `counts.refused`, and `refused` for each refused item's `sourceId` and reason. When a run fails, `error.code` says why and `error.retryable` says whether running it again may help. When a run returns `status: 'unfinished'`, it ended but the runner couldn't confirm that Knowledge recorded its result, for example because a reply was lost. Errors from Knowledge that retrying can't fix are thrown from `run()`.
|
|
@@ -207,7 +215,9 @@ Use `ctx.reportBacklog()` in your importer when it stops early on purpose, for e
|
|
|
207
215
|
|
|
208
216
|
When a page already sits at the binding's target, it becomes the importer's folder: its body and the pages under it are kept, and items are added under it. Folders are shared: if that page is another binding's folder or item, it stays that too, and both bindings keep writing and removing their own items under it. When the source removes an item whose page is another binding's folder, the page is kept as a stub, so that binding's folder keeps its ID. When an item's place is already taken by a page, your importer takes that page over, whoever wrote it. The page keeps its ID and anything nested under it, and the item's title and description replace its own. Its body replaces the page's body when the item sends one. A declare sends none. The page keeps its body until an upsert sends one. Unless the page was another importer's item, the body it had before the import is kept in a note on the page. From then on the importer updates it like a page it created. When the source removes the item, the page is never deleted: it gets that saved body back, or becomes a stub when no body was saved. Each takeover saves the body the page has at that moment and replaces the note an earlier takeover left, so edits made after a removal are what the next removal gives back. A page whose body is empty at that moment keeps no note, and its next removal leaves a stub. That includes the item coming back from the source after a removal. If someone deletes the note, the page becomes a stub instead, until a later takeover saves a new one.
|
|
209
217
|
|
|
210
|
-
Importers write where they're configured. When an item of your importer takes over a page another binding imported as an item, that binding stops tracking it, and its next run writes its item again. When two bindings write the same page, the one that ran last owns it. When a binding moves its pages, pages other bindings imported under them move too, and those bindings' links to them are fixed on their next run, even one that sends nothing. Each run takes the page back and rewrites it, so give bindings separate targets unless you want that. When someone moves an imported page elsewhere in the same scope, it stays where they put it and keeps getting the item's updates. If the source then removes the item, the page is deleted where they put it. When someone moves it into another scope, it stays there as an ordinary page and the
|
|
218
|
+
Importers write where they're configured. When an item of your importer takes over a page another binding imported as an item, that binding stops tracking it, and its next run writes its item again. When two bindings write the same page, the one that ran last owns it. When a binding moves its pages, pages other bindings imported under them move too, and those bindings' links to them are fixed on their next run, even one that sends nothing. Each run takes the page back and rewrites it, so give bindings separate targets unless you want that. When someone moves an imported page elsewhere in the same scope, it stays where they put it and keeps getting the item's updates. If the source then removes the item, the page is deleted where they put it. When someone moves it into another scope, it stays there as an ordinary page, and the item is written again at the target the next time your importer sends it. People can add their own pages under imported pages. Those move along with their parent.
|
|
219
|
+
|
|
220
|
+
When someone merges an imported page into another page, the importer leaves it alone. It keeps tracking the item, but later upserts of that item are skipped and counted in `counts.merged`, removing the item does nothing, and the page it was merged into is never touched. A new child of that item goes under its `fallbackParent` page when one exists, otherwise in the importer's folder, and it stays there. Existing children move under the page it was merged into. When that page is in the same scope, they keep getting their items' updates. When it's in another scope, they stay there as ordinary pages. Their items return to the importer's folder only when the source sends them again, which an incremental importer may not do.
|
|
211
221
|
|
|
212
222
|
An item is refused when it can't be written, for example when someone changes the page at the same moment. A binding whose folder was deleted still removes the items it tracks. Its next write makes the folder again. Refused items are counted in `counts.refused`, and the run result lists them in `refused`, each with its `sourceId` and a `reason`. The list holds the first 100. Send the item again. An importer that reads from a cursor may already have saved a cursor past the refused item, so a normal next run doesn't always send it. Reset that cursor, or have your importer send the item again some other way.
|
|
213
223
|
|
|
@@ -148,6 +148,32 @@ export const faq = new Agent({
|
|
|
148
148
|
|
|
149
149
|
The function must return every `resource:` and `thread:` scope it receives. Memory uses them to identify the user and thread. The run fails if one is missing.
|
|
150
150
|
|
|
151
|
+
### Agent identities
|
|
152
|
+
|
|
153
|
+
Spread `knowledgeAgentScopes()` into your `scopes` to give each agent run an identity of its own. A run of an agent then also holds `agent:<agentId>`. With an `org:` scope it holds `agent:<agentId>:org:<orgId>`, and with a Memory resource it holds `agent:<agentId>:user:<resourceId>`. When the agent's `metadata.persona` has a `role` or `teamId`, the run also holds `agent:persona:role:<role>` or `agent:persona:team:<teamId>` scopes:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { Knowledge, knowledgeAgentScopes, knowledgeMemoryScopes } from '@mastra/core/knowledge'
|
|
157
|
+
|
|
158
|
+
const knowledge = new Knowledge({
|
|
159
|
+
storage,
|
|
160
|
+
scopes: { ...knowledgeMemoryScopes(), ...knowledgeAgentScopes() },
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
export const support = new Agent({
|
|
164
|
+
id: 'support',
|
|
165
|
+
name: 'Support',
|
|
166
|
+
instructions: 'You help customers with billing questions.',
|
|
167
|
+
model: 'openai/gpt-6.2-sol',
|
|
168
|
+
metadata: { persona: { role: 'support', teamId: 'billing' } },
|
|
169
|
+
knowledge,
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
These identities grant nothing on their own. Name them in an access rule, for example `{ principal: 'agent:support:org:$orgId', role: 'viewer' }`, to give that agent access to a scope within the run's organization. `agent:support` binds no organization, so a rule naming it on a per-organization scope such as `team:$orgId:$teamId` grants access in every organization. Use it only for access you mean to share across organizations.
|
|
174
|
+
|
|
175
|
+
`knowledgePersonaScopes()` adds a read-only convention on top: each agent reads its own `#persona` page, and every agent of a role or team reads that scope's `#rules` page, pinned into its context. To let one agent edit those rules, pass `agent:persona:role:<role>:edit` or `agent:persona:team:<teamId>:edit` in that run's scopes.
|
|
176
|
+
|
|
151
177
|
## How access is decided
|
|
152
178
|
|
|
153
179
|
Each time a tool runs, Knowledge works out which scopes the run can reach and with which role:
|
|
@@ -47,21 +47,7 @@ yarn add @mastra/memory@latest @mastra/libsql@latest
|
|
|
47
47
|
bun add @mastra/memory@latest @mastra/libsql@latest
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
import { Mastra } from '@mastra/core'
|
|
54
|
-
import { LibSQLStore } from '@mastra/libsql'
|
|
55
|
-
|
|
56
|
-
export const mastra = new Mastra({
|
|
57
|
-
storage: new LibSQLStore({
|
|
58
|
-
id: 'mastra-storage',
|
|
59
|
-
url: 'file:./mastra.db',
|
|
60
|
-
}),
|
|
61
|
-
})
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Instantiate a [`Memory`](https://mastra.ai/reference/memory/memory-class) instance in your agent:
|
|
50
|
+
Create an agent with a [`Memory`](https://mastra.ai/reference/memory/memory-class) instance. Set `OPENAI_API_KEY` to run this example or choose a model from another [configured provider](https://mastra.ai/models/environment-variables).
|
|
65
51
|
|
|
66
52
|
```typescript
|
|
67
53
|
import { Memory } from '@mastra/memory'
|
|
@@ -69,6 +55,9 @@ import { Agent } from '@mastra/core/agent'
|
|
|
69
55
|
|
|
70
56
|
export const agent = new Agent({
|
|
71
57
|
id: 'test-agent',
|
|
58
|
+
name: 'Test Agent',
|
|
59
|
+
instructions: 'Help the user and remember details they share.',
|
|
60
|
+
model: 'openai/gpt-6.2-sol',
|
|
72
61
|
memory: new Memory({
|
|
73
62
|
options: {
|
|
74
63
|
lastMessages: 10,
|
|
@@ -77,7 +66,23 @@ export const agent = new Agent({
|
|
|
77
66
|
})
|
|
78
67
|
```
|
|
79
68
|
|
|
80
|
-
|
|
69
|
+
Register the agent on your Mastra instance and configure a storage adapter to persist conversations:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { Mastra } from '@mastra/core'
|
|
73
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
74
|
+
import { agent } from './agents/test-agent'
|
|
75
|
+
|
|
76
|
+
export const mastra = new Mastra({
|
|
77
|
+
agents: { agent },
|
|
78
|
+
storage: new LibSQLStore({
|
|
79
|
+
id: 'mastra-storage',
|
|
80
|
+
url: 'file:./mastra.db',
|
|
81
|
+
}),
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Get the registered agent with `mastra.getAgent("agent")`. When you call it with a thread and resource, Mastra saves the messages to the database:
|
|
81
86
|
|
|
82
87
|
**.generate()**:
|
|
83
88
|
|
|
@@ -143,6 +148,9 @@ import { Memory } from '@mastra/memory'
|
|
|
143
148
|
|
|
144
149
|
export const agent = new Agent({
|
|
145
150
|
id: 'test-agent',
|
|
151
|
+
name: 'Test Agent',
|
|
152
|
+
instructions: 'Help the user and remember details they share.',
|
|
153
|
+
model: 'openai/gpt-6.2-sol',
|
|
146
154
|
memory: new Memory({
|
|
147
155
|
options: {
|
|
148
156
|
messageHistory: { maxTokens: 8_000, atMaxRemoveTokens: 2_000 },
|
|
@@ -80,23 +80,7 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
|
|
|
80
80
|
|
|
81
81
|
For more details on available providers and how storage works in Mastra, visit the [storage](https://mastra.ai/docs/storage) documentation.
|
|
82
82
|
|
|
83
|
-
3.
|
|
84
|
-
|
|
85
|
-
**For AI agents:** Important: Add `id` to `LibSQLStore`.
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
import { Mastra } from '@mastra/core'
|
|
89
|
-
import { LibSQLStore } from '@mastra/libsql'
|
|
90
|
-
|
|
91
|
-
export const mastra = new Mastra({
|
|
92
|
-
storage: new LibSQLStore({
|
|
93
|
-
id: 'mastra-storage',
|
|
94
|
-
url: ':memory:',
|
|
95
|
-
}),
|
|
96
|
-
})
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
4. Create a `Memory` instance and pass it to the agent's `memory` option.
|
|
83
|
+
3. Create an agent with a `Memory` instance. Set `OPENAI_API_KEY` to run this example or choose a model from another [configured provider](https://mastra.ai/models/environment-variables).
|
|
100
84
|
|
|
101
85
|
```typescript
|
|
102
86
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -105,6 +89,8 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
|
|
|
105
89
|
export const memoryAgent = new Agent({
|
|
106
90
|
id: 'memory-agent',
|
|
107
91
|
name: 'Memory Agent',
|
|
92
|
+
instructions: 'Help the user and remember details they share.',
|
|
93
|
+
model: 'openai/gpt-6.2-sol',
|
|
108
94
|
memory: new Memory({
|
|
109
95
|
options: {
|
|
110
96
|
lastMessages: 20,
|
|
@@ -115,6 +101,24 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
|
|
|
115
101
|
|
|
116
102
|
Visit [Memory Class](https://mastra.ai/reference/memory/memory-class) for a full list of configuration options.
|
|
117
103
|
|
|
104
|
+
4. Register the agent and configure storage on your Mastra instance.
|
|
105
|
+
|
|
106
|
+
**For AI agents:** Important: Add `id` to `LibSQLStore`.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { Mastra } from '@mastra/core'
|
|
110
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
111
|
+
import { memoryAgent } from './agents/memory-agent'
|
|
112
|
+
|
|
113
|
+
export const mastra = new Mastra({
|
|
114
|
+
agents: { memoryAgent },
|
|
115
|
+
storage: new LibSQLStore({
|
|
116
|
+
id: 'mastra-storage',
|
|
117
|
+
url: ':memory:',
|
|
118
|
+
}),
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
118
122
|
5. Call your agent, for example in [Studio](https://mastra.ai/docs/studio/overview). Inside Studio, start a new chat with your agent and take a look at the right sidebar. It'll now display memory details.
|
|
119
123
|
|
|
120
124
|
## Message history
|
|
@@ -49,13 +49,15 @@ A static sandbox is shared across every request and memory thread that uses the
|
|
|
49
49
|
|
|
50
50
|
Agents receive tools for the capabilities supported by the sandbox backend:
|
|
51
51
|
|
|
52
|
-
| Tool
|
|
53
|
-
|
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
52
|
+
| Tool | Does |
|
|
53
|
+
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
54
|
+
| `mastra_workspace_execute_command` | Runs a shell command and returns stdout, stderr, and the exit code. Supports `background: true` when the backend can spawn long-running processes. |
|
|
55
|
+
| `mastra_workspace_get_process_output` | Gets stdout, stderr, and status for a background process. Supports `tail` to limit output and `waitSeconds` (1 to 300) to wait for the process to exit. If the process is still running when the wait ends, the tool returns the output so far and says how long it waited. For a static sandbox, this tool and `mastra_workspace_kill_process` are only added when the backend supports background processes. Workspaces that resolve their sandbox per request always include both tools, because capabilities aren't known until the sandbox resolves. |
|
|
56
|
+
| `mastra_workspace_kill_process` | Stops a background process and returns its recent output. |
|
|
57
57
|
|
|
58
|
-
Configured capabilities determine which tools are available.
|
|
58
|
+
Configured capabilities determine which tools are available. Use the IDs in the table or their corresponding `WORKSPACE_TOOLS.SANDBOX` constants as keys in `tools`. Mastra ignores unrecognized keys such as `execute_command`.
|
|
59
|
+
|
|
60
|
+
The following example disables the shell tool.
|
|
59
61
|
|
|
60
62
|
```typescript
|
|
61
63
|
import { LocalSandbox, Workspace, WORKSPACE_TOOLS } from '@mastra/core/workspace'
|
|
@@ -261,7 +263,7 @@ Because a [resolver-backed sandbox](#sandboxes-per-user-or-thread) isn't known u
|
|
|
261
263
|
|
|
262
264
|
## Background processes
|
|
263
265
|
|
|
264
|
-
When agents start background processes through `
|
|
266
|
+
When agents start background processes through `mastra_workspace_execute_command`, you can receive lifecycle callbacks for stdout, stderr, and process exit. Configure these through the `backgroundProcesses` option on its `WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND` entry:
|
|
265
267
|
|
|
266
268
|
```typescript
|
|
267
269
|
import { Workspace, LocalSandbox, WORKSPACE_TOOLS } from '@mastra/core/workspace'
|
|
@@ -280,13 +282,13 @@ const workspace = new Workspace({
|
|
|
280
282
|
})
|
|
281
283
|
```
|
|
282
284
|
|
|
283
|
-
These callbacks fire for all background processes started by the agent through `
|
|
285
|
+
These callbacks fire for all background processes started by the agent through `mastra_workspace_execute_command`.
|
|
284
286
|
|
|
285
|
-
Each callback receives the process `pid` and, when available, the `toolCallId`, `agentId`, `threadId`, `resourceId`, and `runId` of the call that started it, so you can route an exit notice back to the right conversation. `onExit` also gets `killedByAbort`, which is `true` when the abort signal fired (the run's signal by default) and stopped the process, and `false` when it exited on its own or was stopped with `
|
|
287
|
+
Each callback receives the process `pid` and, when available, the `toolCallId`, `agentId`, `threadId`, `resourceId`, and `runId` of the call that started it, so you can route an exit notice back to the right conversation. `onExit` also gets `killedByAbort`, which is `true` when the abort signal fired (the run's signal by default) and stopped the process, and `false` when it exited on its own or was stopped with `mastra_workspace_kill_process`.
|
|
286
288
|
|
|
287
289
|
By default, background processes inherit the agent's abort signal and stop when the agent disconnects. Set `abortSignal` to a custom signal, or use `null` or `false` when the process should continue after the request ends.
|
|
288
290
|
|
|
289
|
-
The `timeout` input of `
|
|
291
|
+
The `timeout` input of `mastra_workspace_execute_command` also applies to background commands: the process is stopped after that many seconds. A `timeout` of `0` sets no timer in `LocalSandbox`. When `timeout` is omitted, the sandbox provider decides. `LocalSandbox` sets no timer for background commands, while `E2BSandbox` uses the `timeout` option it was created with, which defaults to 300 seconds. That option is in milliseconds, unlike the `mastra_workspace_execute_command` `timeout`, so a 60-second default needs `new E2BSandbox({ timeout: 60000 })`. The tool description tells agents to omit `timeout` for dev servers and other commands meant to keep running.
|
|
290
292
|
|
|
291
293
|
For the full `SandboxProcessManager` API, including programmatic process spawning, output, and standard input, see the [`SandboxProcessManager` reference](https://mastra.ai/reference/workspace/process-manager).
|
|
292
294
|
|
|
@@ -24,24 +24,33 @@ import { createWorkflow, createStep } from '@mastra/core/workflows'
|
|
|
24
24
|
import { z } from 'zod'
|
|
25
25
|
|
|
26
26
|
const step1 = createStep({
|
|
27
|
+
id: 'step-1',
|
|
27
28
|
inputSchema: z.object({
|
|
28
29
|
message: z.string(),
|
|
29
30
|
}),
|
|
30
31
|
outputSchema: z.object({
|
|
31
32
|
formatted: z.string(),
|
|
32
33
|
}),
|
|
34
|
+
execute: async ({ inputData }) => ({
|
|
35
|
+
formatted: inputData.message.toUpperCase(),
|
|
36
|
+
}),
|
|
33
37
|
})
|
|
34
38
|
|
|
35
39
|
const step2 = createStep({
|
|
40
|
+
id: 'step-2',
|
|
36
41
|
inputSchema: z.object({
|
|
37
42
|
formatted: z.string(),
|
|
38
43
|
}),
|
|
39
44
|
outputSchema: z.object({
|
|
40
45
|
emphasized: z.string(),
|
|
41
46
|
}),
|
|
47
|
+
execute: async ({ inputData }) => ({
|
|
48
|
+
emphasized: `${inputData.formatted}!`,
|
|
49
|
+
}),
|
|
42
50
|
})
|
|
43
51
|
|
|
44
52
|
export const testWorkflow = createWorkflow({
|
|
53
|
+
id: 'test-workflow',
|
|
45
54
|
inputSchema: z.object({
|
|
46
55
|
message: z.string(),
|
|
47
56
|
}),
|
|
@@ -64,10 +73,20 @@ import { z } from 'zod'
|
|
|
64
73
|
|
|
65
74
|
const step1 = createStep({
|
|
66
75
|
id: 'step-1',
|
|
76
|
+
inputSchema: z.object({ message: z.string() }),
|
|
77
|
+
outputSchema: z.object({ formatted: z.string() }),
|
|
78
|
+
execute: async ({ inputData }) => ({
|
|
79
|
+
formatted: inputData.message.toUpperCase(),
|
|
80
|
+
}),
|
|
67
81
|
})
|
|
68
82
|
|
|
69
83
|
const step2 = createStep({
|
|
70
84
|
id: 'step-2',
|
|
85
|
+
inputSchema: z.object({ message: z.string() }),
|
|
86
|
+
outputSchema: z.object({ emphasized: z.string() }),
|
|
87
|
+
execute: async ({ inputData }) => ({
|
|
88
|
+
emphasized: `${inputData.message}!`,
|
|
89
|
+
}),
|
|
71
90
|
})
|
|
72
91
|
|
|
73
92
|
const step3 = createStep({
|
|
@@ -93,6 +112,7 @@ const step3 = createStep({
|
|
|
93
112
|
})
|
|
94
113
|
|
|
95
114
|
export const testWorkflow = createWorkflow({
|
|
115
|
+
id: 'test-workflow',
|
|
96
116
|
inputSchema: z.object({
|
|
97
117
|
message: z.string(),
|
|
98
118
|
}),
|
|
@@ -47,7 +47,7 @@ Arthur Engine associates traces with tasks in two ways:
|
|
|
47
47
|
- **By service name**: Set `serviceName` in the observability config. Arthur Engine automatically routes traces to the task matching that name, creating it if needed.
|
|
48
48
|
- **By task ID**: Pass a pre-existing `taskId` to the exporter to send traces to a specific task directly.
|
|
49
49
|
|
|
50
|
-
If both are provided, `
|
|
50
|
+
If both are provided, Arthur Engine routes traces by `serviceName` and ignores `taskId`.
|
|
51
51
|
|
|
52
52
|
### Environment variables
|
|
53
53
|
|
|
@@ -200,7 +200,7 @@ The same `id` returns the same `Session` instance. Sessions with different ids a
|
|
|
200
200
|
|
|
201
201
|
**id** (`string`): Session identifier and live-session registry key. Defaults to resourceId.
|
|
202
202
|
|
|
203
|
-
**ownerId** (`string`): Stable identity of the process-local Session host. Defaults to id. New threads use it as their initial owner, but later transfers do not change this value.
|
|
203
|
+
**ownerId** (`string`): Stable identity of the process-local Session host. Defaults to the controller id. New threads use it as their initial owner, but later transfers do not change this value.
|
|
204
204
|
|
|
205
205
|
**tags** (`Record<string, string>`): Tags copied to threads created by the session.
|
|
206
206
|
|
|
@@ -90,6 +90,15 @@ unsubscribe()
|
|
|
90
90
|
|
|
91
91
|
Returns: `() => void`
|
|
92
92
|
|
|
93
|
+
When a processor such as Mastra Code's model rotation emits a `data-mastracode-model-fallback` part after moving a request to a fallback model, the reply gets that part under the same message ID the reply is saved with. The part is held until the reply's `step-start` arrives, so it isn't sent if the stream ends before then. If the reply hasn't started yet, the part arrives in its `message_start` event. Otherwise it arrives in a `message_update` event of type `part`, with its index. Its data holds `from` and `to` (each with `entryId` and `label`), `reason` (`'pool-exhausted'` or `'persistent-outage'`), `at`, and an optional `failure.kind`. To check a stored failure kind at runtime, compare it against `PROVIDER_FAILURE_KINDS` from `@mastra/core/error`:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { PROVIDER_FAILURE_KINDS, type ProviderFailureKind } from '@mastra/core/error'
|
|
97
|
+
|
|
98
|
+
const isFailureKind = (value: string): value is ProviderFailureKind =>
|
|
99
|
+
(PROVIDER_FAILURE_KINDS as readonly string[]).includes(value)
|
|
100
|
+
```
|
|
101
|
+
|
|
93
102
|
#### `initialStateEvents()`
|
|
94
103
|
|
|
95
104
|
Return what a subscriber joining mid-run is missing, as ordinary events the session never emits itself. The list holds a `message_start` for the reply in flight, the latest `om_status` for the active thread, and a `usage_update` whose `total` is the thread's token total. Deliver them to the joining subscriber right before calling `subscribe()`, in the same synchronous block, so no live event lands between the two.
|
|
@@ -330,7 +330,7 @@ do {
|
|
|
330
330
|
reindexLinks(): Promise<number>
|
|
331
331
|
```
|
|
332
332
|
|
|
333
|
-
Rebuilds the page link index from every page body, and resolves to how many pages it indexed. Writes keep the index current, so this is for pages that predate it or were written straight to the store, and for links a write left as they were. A write re-resolves at most 100 linking pages, and checks at most 99 pages sharing a name. Past either limit it logs a warning that names `reindexLinks()`. It needs no vector store.
|
|
333
|
+
Rebuilds the page link index from every page body, and resolves to how many pages it indexed. Writes keep the index current, so this is for pages that predate it or were written straight to the store, and for links a write left as they were. A write re-resolves at most 100 linking pages, and checks at most 99 pages sharing a name. Past either limit it logs a warning that names `reindexLinks()`. An importer flush re-resolves up to 1,000 linking pages in batches of 100. Later flushes re-resolve the rest, and a run that ends with some left chains another run for them when it re-resolved any linking pages. A host whose settle budget is 0 or less doesn't chain for them. It needs no vector store.
|
|
334
334
|
|
|
335
335
|
#### `renameScopeDeclaration()`
|
|
336
336
|
|
|
@@ -51,7 +51,7 @@ A read of a page that doesn't exist lists up to three close matches by `ref`.
|
|
|
51
51
|
|
|
52
52
|
Searches the pages and notes the run can read.
|
|
53
53
|
|
|
54
|
-
The query is split into words, and quote marks are ignored. Each word matches case-insensitively as part of any word, so `refund` matches `refunds`. A page matches when its name, description or body contains at least one of the words. A note matches when its own text does.
|
|
54
|
+
The query is split into words, and quote marks are ignored. Each word matches case-insensitively as part of any word, so `refund` matches `refunds`. A page matches when its name, description or body contains at least one of the words. A note matches when its own text does. A search uses the first 16 distinct words. A word longer than 128 characters fails the search with a `KnowledgeInvalidSearchError` instead of being dropped or cut.
|
|
55
55
|
|
|
56
56
|
Keyword results are ranked in this order:
|
|
57
57
|
|
|
@@ -45,7 +45,7 @@ createSpan(options: CreateSpanOptions<SpanType>): SpanIds | undefined
|
|
|
45
45
|
|
|
46
46
|
Called by the Mastra observability instance during span construction. Creates a dd-trace APM span eagerly via `tracer.startSpan()` and returns Mastra-compatible identifiers. The returned IDs are used by Mastra throughout the span's lifetime. The dd-trace span object is stored internally and used for scope activation.
|
|
47
47
|
|
|
48
|
-
**Returns:** `SpanIds | undefined` - `{ spanId, traceId, parentSpanId }
|
|
48
|
+
**Returns:** `SpanIds | undefined` - `{ spanId, traceId, parentSpanId }` when the parent is a Mastra span, `{ spanId, traceId, externalParentSpanId }` when the parent is an external Datadog span, or `undefined` if the bridge is disabled.
|
|
49
49
|
|
|
50
50
|
### `executeInContext`
|
|
51
51
|
|
|
@@ -176,16 +176,17 @@ See the [DatadogBridge Guide](https://mastra.ai/integrations/observability/datad
|
|
|
176
176
|
|
|
177
177
|
Mastra span types are mapped to Datadog LLM Observability span kinds. When your `@mastra/core` and `@mastra/observability` versions emit `MODEL_INFERENCE` spans (the `model-inference-span` feature), `MODEL_INFERENCE` is the `llm` span and `MODEL_STEP` becomes a `workflow` span that wraps it:
|
|
178
178
|
|
|
179
|
-
| Mastra SpanType
|
|
180
|
-
|
|
|
181
|
-
| `AGENT_RUN`
|
|
182
|
-
| `MODEL_GENERATION`
|
|
183
|
-
| `MODEL_STEP`
|
|
184
|
-
| `MODEL_INFERENCE`
|
|
185
|
-
| `TOOL_CALL`
|
|
186
|
-
| `MCP_TOOL_CALL`
|
|
187
|
-
| `
|
|
188
|
-
|
|
|
179
|
+
| Mastra SpanType | Datadog Kind |
|
|
180
|
+
| -------------------- | ------------------------------------------------------------- |
|
|
181
|
+
| `AGENT_RUN` | `agent` |
|
|
182
|
+
| `MODEL_GENERATION` | `workflow` |
|
|
183
|
+
| `MODEL_STEP` | `llm`, or `workflow` when `MODEL_INFERENCE` spans are emitted |
|
|
184
|
+
| `MODEL_INFERENCE` | `llm` |
|
|
185
|
+
| `TOOL_CALL` | `tool` |
|
|
186
|
+
| `MCP_TOOL_CALL` | `tool` |
|
|
187
|
+
| `PROVIDER_TOOL_CALL` | `tool` |
|
|
188
|
+
| `WORKFLOW_RUN` | `workflow` |
|
|
189
|
+
| All other types | `task` |
|
|
189
190
|
|
|
190
191
|
## Tags support
|
|
191
192
|
|
|
@@ -351,7 +351,7 @@ The object form can return any combination of these properties:
|
|
|
351
351
|
|
|
352
352
|
**systemMessages** (`CoreMessage[]`): Replace all system messages for this step only.
|
|
353
353
|
|
|
354
|
-
**providerOptions** (`
|
|
354
|
+
**providerOptions** (`SharedProviderOptions`): Change provider-specific options for this step.
|
|
355
355
|
|
|
356
356
|
**modelSettings** (`CallSettings`): Change model settings for this step.
|
|
357
357
|
|
|
@@ -47,7 +47,7 @@ The schema definitions below cover the built-in database-backed tables documente
|
|
|
47
47
|
|
|
48
48
|
Stores conversation messages and their metadata. Each message belongs to a thread and contains the actual content along with metadata about the sender role and message type.
|
|
49
49
|
|
|
50
|
-
idtextPRIMARYKEYNOT NULLUnique identifier for the messagethread_idtextNOT NULLParent thread reference (`threads.id`). Postgres and libSQL store `mastra-queue:pending:<threadId>` or `mastra-queue:taken:<threadId>` instead while the row is a queued \[pending signal]\(/docs/server/pubsub#signals-sent-to-a-running-evented-agent), which no read by thread or resource returns, so that value matches no thread.resourceIdtextCAN BE NULLID of the resource that owns this message. Postgres and libSQL store `NULL` while the row is a pending signal.contenttextNOT NULLJSON of the message content in V2 format. Example: `{ format: 2, parts: [...] }`roletextNOT NULLEnum of `user | assistant`createdAttimestampNOT NULLUsed for thread message ordering
|
|
50
|
+
idtextPRIMARYKEYNOT NULLUnique identifier for the messagethread_idtextNOT NULLParent thread reference (`threads.id`). Postgres and libSQL store `mastra-queue:pending:<threadId>` or `mastra-queue:taken:<threadId>` instead while the row is a queued \[pending signal]\(/docs/server/pubsub#signals-sent-to-a-running-evented-agent), which no read by thread or resource returns, so that value matches no thread.resourceIdtextCAN BE NULLID of the resource that owns this message. Postgres and libSQL store `NULL` while the row is a pending signal.contenttextNOT NULLJSON of the message content in V2 format. Example: `{ format: 2, parts: [...] }`roletextNOT NULLEnum of `user | assistant | system | signal`createdAttimestampNOT NULLUsed for thread message ordering
|
|
51
51
|
|
|
52
52
|
The message `content` column contains a JSON object conforming to the `MastraMessageContentV2` type, which is designed to align with the AI SDK `UIMessage` message shape.
|
|
53
53
|
|
|
@@ -142,33 +142,6 @@ playAudio(audioStream)
|
|
|
142
142
|
|
|
143
143
|
Visit the [Google Voice Reference](https://mastra.ai/integrations/voice/google) for more information on the Google voice provider.
|
|
144
144
|
|
|
145
|
-
**Cloudflare**:
|
|
146
|
-
|
|
147
|
-
```typescript
|
|
148
|
-
import { Agent } from '@mastra/core/agent'
|
|
149
|
-
import { CloudflareVoice } from '@mastra/voice-cloudflare'
|
|
150
|
-
import { playAudio } from '@mastra/node-audio'
|
|
151
|
-
|
|
152
|
-
const voiceAgent = new Agent({
|
|
153
|
-
id: 'voice-agent',
|
|
154
|
-
name: 'Voice Agent',
|
|
155
|
-
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
156
|
-
model: 'openai/gpt-6.2-sol',
|
|
157
|
-
voice: new CloudflareVoice(),
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
const { text } = await voiceAgent.generate('What color is the sky?')
|
|
161
|
-
|
|
162
|
-
// Convert text to speech to an Audio Stream
|
|
163
|
-
const audioStream = await voiceAgent.voice.speak(text, {
|
|
164
|
-
speaker: 'default', // Optional: specify a speaker
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
playAudio(audioStream)
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
Visit the [Cloudflare Voice Reference](https://mastra.ai/integrations/voice/cloudflare) for more information on the Cloudflare voice provider.
|
|
171
|
-
|
|
172
145
|
**Deepgram**:
|
|
173
146
|
|
|
174
147
|
```typescript
|
|
@@ -234,7 +234,7 @@ A classifier without constructor-configured questions can't be used as a workflo
|
|
|
234
234
|
|
|
235
235
|
**execute.state** (`z.infer<TState>`): The current workflow state. Contains shared values that persist across all steps and suspend/resume cycles. The structure is defined by the step's stateSchema. Reading it in a run stored with storageVersion: 2 throws; use await getState() instead.
|
|
236
236
|
|
|
237
|
-
**execute.getState** (`(keys
|
|
237
|
+
**execute.getState** (`{ (): Promise<z.infer<TState>>; <K extends keyof z.infer<TState>>(keys: readonly K[]): Promise<Pick<z.infer<TState>, K>> }`): Resolves to the current workflow state, including this step's own setState changes. Pass top-level keys to get a Pick of the state containing only those keys. When the step has no state schema, both forms resolve to Record\<string, any>. Works on every engine and storage version.
|
|
238
238
|
|
|
239
239
|
**execute.setState** (`(state: z.infer<TState>) => Promise<void>`): Replaces the step's pending state with the value you pass, which is validated on its own against the step's stateSchema, so it must contain every field that schema requires. Top-level keys you leave out keep their current value. A second call in the same step replaces the first. On the evented engine, setState instead merges the keys you pass into the state without validating them, and a second call adds to the first. Await it, so the update is applied before the step returns and a validation error fails the step.
|
|
240
240
|
|
|
@@ -25,6 +25,8 @@ const workspace = new Workspace({
|
|
|
25
25
|
bm25: true,
|
|
26
26
|
autoIndexPaths: ['docs'],
|
|
27
27
|
})
|
|
28
|
+
|
|
29
|
+
await workspace.init()
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
## Constructor parameters
|
|
@@ -47,7 +49,7 @@ const workspace = new Workspace({
|
|
|
47
49
|
|
|
48
50
|
**embedder** (`Embedder`): Function that turns text into vectors. Required when vectorStore is set, unless the store generates embeddings itself (see Server-side embeddings). Accepts either a single-text function (text: string) => Promise\<number\[]> or a batch-capable function (texts: string\[]) => Promise\<number\[]\[]> that has a batch: true property and an optional maxBatchSize. See Batch embedding.
|
|
49
51
|
|
|
50
|
-
**autoIndexPaths** (`string[]`): Paths or glob patterns to
|
|
52
|
+
**autoIndexPaths** (`string[]`): Paths or glob patterns such as '\*\*/\*.md' to index when you await workspace.init(). See auto-indexing.
|
|
51
53
|
|
|
52
54
|
**skills** (`string[] | ((context: SkillsContext) => string[] | Promise<string[]>)`): Paths where SKILL.md files are located. This can be a static array or an async function that resolves paths dynamically. Supports glob patterns like './\*\*/skills' for discovery. Skills are read from skillSource when set, otherwise from the workspace filesystem — including a resolver-backed filesystem, which is resolved per request. With a resolver, use workspace.skills.getScoped({ requestContext }) so the filesystem is chosen from the request; direct calls such as workspace.skills.list() resolve with an empty RequestContext. Only when no filesystem is configured are skills read from the local disk.
|
|
53
55
|
|
package/dist/evals/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_execution_fence = require("../execution-fence-
|
|
3
|
-
const require_constants = require("../constants-
|
|
2
|
+
const require_execution_fence = require("../execution-fence-C1nozqra.cjs");
|
|
3
|
+
const require_constants = require("../constants-DPHwzvan.cjs");
|
|
4
4
|
const require_collect_tool_mocks = require("../collect-tool-mocks-k9fM6oDl.cjs");
|
|
5
5
|
exports.MastraScorer = require_execution_fence.MastraScorer;
|
|
6
6
|
exports.SCORING_PREDICATE_ROOTS = require_execution_fence.SCORING_PREDICATE_ROOTS;
|