@mastra/core 1.87.0-alpha.2 → 1.87.0-alpha.4
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/@ai-sdk_openai@4.0.106/dist/index.d.ts +2034 -0
- package/dist/_types/@ai-sdk_openai@4.0.106/package.json +1 -0
- package/dist/a2a/index.cjs +1 -1
- package/dist/a2a/index.js +1 -1
- package/dist/agent/durable/index.cjs +1 -1
- package/dist/agent/durable/index.js +1 -1
- package/dist/agent/durable/run-message-refs.d.ts +3 -2
- package/dist/agent/index.cjs +4 -4
- package/dist/agent/index.js +4 -4
- package/dist/agent/message-list/adapters/AIV5Adapter.d.ts +15 -1
- package/dist/agent/message-list/index.cjs +2 -2
- package/dist/agent/message-list/index.js +2 -2
- package/dist/agent/message-list/state/types.d.ts +5 -1
- package/dist/agent/message-list/types.d.ts +1 -1
- package/dist/agent/message-list/utils/provider-compat.d.ts +9 -1
- package/dist/agent-builder/ee/index.cjs +1 -1
- package/dist/agent-builder/ee/index.js +1 -1
- package/dist/agent-controller/index.cjs +2 -2
- package/dist/agent-controller/index.js +2 -2
- package/dist/{agent-controller-v64JbuDa.cjs → agent-controller-CqcyudV6.cjs} +8 -8
- package/dist/{agent-controller-Dc58ARqw.js → agent-controller-VBMIPr6h.js} +8 -8
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-E-Jjxks4.js → background-tasks-1tyymY2H.js} +1 -1
- package/dist/{background-tasks-DgiQNKh7.cjs → background-tasks-FOaQ1LsS.cjs} +1 -1
- package/dist/browser/index.cjs +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/{builder-Dh175HnQ.js → builder-CUbE9d87.js} +2 -2
- package/dist/{builder-Dfp6Ckjr.cjs → builder-MLhVrFJw.cjs} +2 -2
- package/dist/capabilities/302ai.json +203 -203
- package/dist/capabilities/abliteratedllm.json +33 -33
- package/dist/capabilities/abliteration-ai.json +9 -9
- package/dist/capabilities/above.json +18 -18
- package/dist/capabilities/adaption.json +16 -16
- package/dist/capabilities/adzuki.json +20 -20
- package/dist/capabilities/agentrouter.json +11 -11
- package/dist/capabilities/agnes.json +3 -3
- package/dist/capabilities/ai-router.json +5 -5
- package/dist/capabilities/aiand.json +17 -17
- package/dist/capabilities/aigrow.json +11 -11
- package/dist/capabilities/aimlapi.json +153 -156
- package/dist/capabilities/aipg.json +2 -2
- package/dist/capabilities/aixy.json +14 -14
- package/dist/capabilities/aki-io.json +15 -15
- package/dist/capabilities/alibaba-cn.json +98 -98
- 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 +55 -55
- package/dist/capabilities/alibaba-token-plan.json +54 -54
- package/dist/capabilities/alibaba.json +67 -67
- package/dist/capabilities/ambient.json +19 -12
- package/dist/capabilities/amd.json +6 -6
- package/dist/capabilities/anthropic.json +47 -47
- package/dist/capabilities/anyapi.json +15 -15
- package/dist/capabilities/apiko.json +5 -5
- package/dist/capabilities/arcee.json +7 -7
- package/dist/capabilities/augure.json +6 -6
- package/dist/capabilities/auriko.json +19 -19
- package/dist/capabilities/bailing.json +5 -5
- package/dist/capabilities/baseten.json +25 -25
- package/dist/capabilities/bee.json +4 -4
- package/dist/capabilities/bothub.json +11 -11
- package/dist/capabilities/boundless.json +39 -39
- package/dist/capabilities/bumo.json +40 -40
- package/dist/capabilities/byteplus.json +29 -29
- package/dist/capabilities/cheapaimodel.json +10 -10
- package/dist/capabilities/cheapest-token.json +28 -28
- package/dist/capabilities/chutes.json +7 -7
- package/dist/capabilities/clarifai.json +2 -2
- package/dist/capabilities/cline-pass.json +39 -39
- package/dist/capabilities/cloudcode.json +10 -10
- package/dist/capabilities/cloudflare-workers-ai.json +13 -13
- package/dist/capabilities/commandcode.json +143 -143
- package/dist/capabilities/concentrate.json +279 -276
- package/dist/capabilities/cortecs.json +105 -105
- package/dist/capabilities/crossmodel.json +191 -191
- package/dist/capabilities/crusoe.json +10 -10
- package/dist/capabilities/daoxe.json +9 -9
- package/dist/capabilities/databricks.json +124 -124
- package/dist/capabilities/deepinfra.json +93 -84
- package/dist/capabilities/deepseek.json +3 -3
- package/dist/capabilities/digitalocean.json +114 -114
- package/dist/capabilities/dothoosh.json +30 -30
- package/dist/capabilities/doubleword.json +22 -22
- package/dist/capabilities/edenai.json +279 -288
- package/dist/capabilities/empiriolabs.json +166 -166
- package/dist/capabilities/engy.json +22 -22
- package/dist/capabilities/evroc.json +11 -11
- package/dist/capabilities/ezkielyna.json +10 -10
- package/dist/capabilities/fastrouter.json +85 -85
- package/dist/capabilities/fireworks-ai.json +130 -69
- package/dist/capabilities/freemodel.json +18 -18
- package/dist/capabilities/frogbot.json +93 -93
- package/dist/capabilities/gisoo.json +20 -20
- package/dist/capabilities/gmicloud.json +17 -17
- package/dist/capabilities/google.json +54 -54
- package/dist/capabilities/graphn.json +15 -15
- package/dist/capabilities/greenpt.json +36 -36
- package/dist/capabilities/groq.json +6 -6
- package/dist/capabilities/helicone.json +83 -83
- package/dist/capabilities/hostinger-router.json +8 -8
- package/dist/capabilities/hpc-ai.json +8 -8
- package/dist/capabilities/huawei-maas.json +12 -12
- package/dist/capabilities/hubris.json +33 -33
- package/dist/capabilities/huggingface.json +118 -78
- package/dist/capabilities/hyper.json +25 -33
- package/dist/capabilities/impossibl.json +162 -162
- package/dist/capabilities/inception.json +2 -2
- package/dist/capabilities/inceptron.json +4 -4
- package/dist/capabilities/inco.json +4 -4
- package/dist/capabilities/infer.json +15 -15
- package/dist/capabilities/inferall.json +7 -7
- package/dist/capabilities/inference-coop.json +15 -15
- package/dist/capabilities/inferenceapis.json +14 -14
- package/dist/capabilities/inferris.json +4 -4
- package/dist/capabilities/infersia.json +13 -13
- package/dist/capabilities/inferx.json +2 -2
- package/dist/capabilities/infomaniak.json +4 -4
- package/dist/capabilities/io-net.json +2 -2
- package/dist/capabilities/iteracompute.json +53 -53
- package/dist/capabilities/jad-ai.json +3 -3
- package/dist/capabilities/jalapeno.json +12 -12
- package/dist/capabilities/jiekou.json +61 -61
- package/dist/capabilities/jzstoken.json +45 -45
- package/dist/capabilities/keln.json +16 -16
- package/dist/capabilities/kenari.json +123 -131
- package/dist/capabilities/kilo.json +615 -612
- 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 +2 -2
- package/dist/capabilities/klavo.json +19 -19
- package/dist/capabilities/korouter.json +36 -36
- package/dist/capabilities/kunavo.json +6 -6
- package/dist/capabilities/liquid.json +11 -11
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +957 -909
- package/dist/capabilities/llmgateway.json +335 -335
- package/dist/capabilities/llmtr.json +25 -25
- package/dist/capabilities/lowrouter.json +58 -58
- package/dist/capabilities/lyceum.json +4 -4
- package/dist/capabilities/melious.json +10 -10
- package/dist/capabilities/merge-gateway.json +289 -289
- package/dist/capabilities/meta.json +7 -7
- 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 +19 -19
- package/dist/capabilities/mixlayer.json +5 -5
- package/dist/capabilities/modal.json +11 -11
- package/dist/capabilities/model-oracle-ai.json +23 -23
- package/dist/capabilities/modelis.json +18 -18
- package/dist/capabilities/modular.json +7 -7
- package/dist/capabilities/moneo.json +12 -12
- package/dist/capabilities/morph.json +15 -15
- package/dist/capabilities/munito-eu.json +4 -4
- package/dist/capabilities/munito.json +4 -4
- package/dist/capabilities/nan.json +23 -23
- package/dist/capabilities/nano-gpt.json +592 -576
- package/dist/capabilities/nearai.json +97 -97
- package/dist/capabilities/nebius.json +24 -24
- package/dist/capabilities/neon.json +132 -132
- package/dist/capabilities/neuralwatt.json +41 -41
- package/dist/capabilities/nokeep.json +4 -4
- package/dist/capabilities/novita-ai.json +115 -115
- package/dist/capabilities/nvidia.json +31 -31
- package/dist/capabilities/obscurify.json +31 -31
- package/dist/capabilities/oci.json +6 -6
- package/dist/capabilities/ofox.json +356 -356
- package/dist/capabilities/ollama-cloud.json +57 -57
- package/dist/capabilities/openai.json +57 -57
- package/dist/capabilities/opencode-go.json +86 -86
- package/dist/capabilities/openreason.json +4 -4
- package/dist/capabilities/openrouter.json +537 -526
- package/dist/capabilities/opper.json +26 -26
- package/dist/capabilities/orcarouter.json +223 -223
- package/dist/capabilities/outerlabs.json +25 -25
- package/dist/capabilities/ovhcloud.json +21 -21
- package/dist/capabilities/pareto.json +5 -5
- package/dist/capabilities/perplexity-agent.json +65 -65
- package/dist/capabilities/phala.json +30 -30
- package/dist/capabilities/pioneer.json +32 -32
- package/dist/capabilities/poe.json +129 -129
- package/dist/capabilities/powerspring.json +14 -14
- package/dist/capabilities/primalabs.json +9 -9
- package/dist/capabilities/prime.json +125 -124
- package/dist/capabilities/privatemode-ai.json +11 -11
- package/dist/capabilities/proxystacks.json +6 -6
- package/dist/capabilities/qiniu-ai.json +14 -14
- package/dist/capabilities/refuseless.json +5 -5
- package/dist/capabilities/regolo-ai.json +10 -10
- package/dist/capabilities/requesty.json +169 -192
- package/dist/capabilities/ruapi.json +19 -19
- package/dist/capabilities/runcrate.json +5 -5
- package/dist/capabilities/runinfra.json +9 -9
- package/dist/capabilities/sakana.json +7 -7
- package/dist/capabilities/sambanova.json +9 -9
- package/dist/capabilities/sandbase.json +25 -25
- package/dist/capabilities/sarvam.json +9 -9
- package/dist/capabilities/scaleway.json +19 -19
- package/dist/capabilities/scnet-token-plan.json +10 -10
- package/dist/capabilities/scx-ai.json +29 -29
- package/dist/capabilities/sensenova.json +15 -15
- package/dist/capabilities/siliconflow-cn.json +45 -45
- package/dist/capabilities/siliconflow.json +45 -45
- package/dist/capabilities/snowflake-cortex.json +18 -18
- package/dist/capabilities/sokkan.json +7 -7
- package/dist/capabilities/sparrowcodes.json +23 -23
- package/dist/capabilities/standardcompute.json +94 -94
- package/dist/capabilities/steadyrouter.json +42 -42
- package/dist/capabilities/stepfun-ai-step-plan.json +4 -4
- package/dist/capabilities/stepfun-ai.json +4 -4
- package/dist/capabilities/stepfun-step-plan.json +4 -4
- package/dist/capabilities/stepfun.json +4 -4
- package/dist/capabilities/stepping-stone.json +18 -18
- package/dist/capabilities/synthetic.json +11 -11
- package/dist/capabilities/synthorai.json +27 -27
- package/dist/capabilities/teamorouter.json +19 -19
- package/dist/capabilities/teapot-router.json +10 -10
- package/dist/capabilities/tencent-token-plan.json +37 -37
- package/dist/capabilities/tencent-tokenhub.json +52 -37
- package/dist/capabilities/tensorx.json +38 -38
- package/dist/capabilities/tenstorrent.json +4 -4
- package/dist/capabilities/the-grid-ai.json +29 -29
- package/dist/capabilities/thinkingmachines.json +77 -77
- package/dist/capabilities/tinfoil.json +10 -10
- package/dist/capabilities/toapis.json +3 -3
- package/dist/capabilities/togetherai.json +47 -47
- package/dist/capabilities/tokengo.json +20 -20
- package/dist/capabilities/tokenify.json +3 -3
- package/dist/capabilities/trustedrouter.json +7 -7
- package/dist/capabilities/trustedtokens.json +15 -15
- package/dist/capabilities/umans-ai-coding-plan.json +11 -11
- package/dist/capabilities/umans-ai.json +10 -10
- package/dist/capabilities/uncensuredai.json +5 -5
- package/dist/capabilities/unrestricted.json +6 -6
- package/dist/capabilities/uplinkswitch.json +20 -20
- package/dist/capabilities/upstage.json +8 -8
- package/dist/capabilities/vancine.json +23 -23
- package/dist/capabilities/vercel.json +581 -581
- package/dist/capabilities/vivgrid.json +80 -80
- package/dist/capabilities/volcengine-coding-plan.json +26 -26
- package/dist/capabilities/volcengine.json +24 -24
- package/dist/capabilities/vultr.json +34 -34
- package/dist/capabilities/wafer.ai.json +16 -16
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +20 -20
- package/dist/capabilities/watt.json +19 -19
- package/dist/capabilities/xai.json +6 -6
- package/dist/capabilities/xiaomi.json +3 -3
- package/dist/capabilities/xpersona.json +11 -11
- package/dist/capabilities/xxapi.json +26 -26
- package/dist/capabilities/zai-coding-plan.json +18 -18
- package/dist/capabilities/zai.json +33 -33
- package/dist/capabilities/zenifra.json +33 -33
- package/dist/capabilities/zenmux.json +186 -186
- package/dist/capabilities/zerogpu.json +11 -11
- package/dist/capabilities/zhipuai-coding-plan.json +8 -8
- package/dist/capabilities/zhipuai.json +32 -32
- package/dist/capabilities/zro.json +6 -6
- package/dist/channels/agent-channels.d.ts +22 -0
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/channels/output-processor.d.ts +12 -0
- package/dist/channels/state-adapter.d.ts +3 -1
- package/dist/channels/stream-helpers.d.ts +17 -0
- package/dist/{channels-BZL9RT2i.cjs → channels-CZ0iY2yh.cjs} +1 -1
- package/dist/{channels-0AO7PMJF.js → channels-hBppCRhl.js} +1 -1
- package/dist/coding-agent/index.cjs +2 -2
- package/dist/coding-agent/index.js +2 -2
- package/dist/datasets/index.cjs +2 -2
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +797 -797
- package/dist/docs/references/docs-agents-networks.md +1 -1
- package/dist/docs/references/docs-agents-tools.md +6 -0
- package/dist/docs/references/docs-auth-simple-auth.md +8 -8
- package/dist/docs/references/docs-evals-custom-scorers.md +1 -1
- package/dist/docs/references/docs-mastra-platform-observability-overview.md +3 -189
- package/dist/docs/references/docs-memory-message-history.md +25 -0
- package/dist/docs/references/docs-sandbox-lsp.md +5 -6
- package/dist/docs/references/docs-sandbox-overview.md +20 -0
- package/dist/docs/references/docs-sandbox-skills.md +2 -0
- package/dist/docs/references/docs-signals-sending-signals.md +1 -1
- package/dist/docs/references/reference-agent-controller-session.md +1 -1
- package/dist/docs/references/reference-agents-generate.md +1 -1
- package/dist/docs/references/reference-agents-network.md +1 -1
- package/dist/docs/references/reference-configuration.md +8 -8
- package/dist/docs/references/reference-core-getWorkspaceById.md +37 -0
- package/dist/docs/references/reference-evals-create-scorer.md +5 -5
- package/dist/docs/references/reference-evals-run-evals.md +1 -1
- package/dist/docs/references/reference-manual-install.md +1 -1
- package/dist/docs/references/reference-memory-observational-memory.md +8 -0
- package/dist/docs/references/reference-observability-tracing-interfaces.md +10 -6
- package/dist/docs/references/reference-processors-processor-interface.md +3 -2
- package/dist/docs/references/reference-processors-system-prompt-scrubber.md +1 -1
- package/dist/docs/references/reference-pubsub-base.md +5 -3
- package/dist/docs/references/reference-pubsub-caching-pubsub.md +3 -1
- package/dist/docs/references/reference-storage-overview.md +1 -1
- package/dist/docs/references/reference-storage-retention.md +20 -20
- package/dist/docs/references/reference-tools-vector-query-tool.md +8 -0
- package/dist/docs/references/reference-voice-overview.md +11 -26
- package/dist/docs/references/reference-voice-speech-to-speech.md +1 -1
- package/dist/docs/references/reference-voice-voice.listen.md +1 -0
- package/dist/docs/references/reference-voice-voice.speak.md +1 -3
- package/dist/docs/references/reference-workspace-factory-sandbox.md +6 -6
- package/dist/docs/references/reference-workspace-sandbox.md +14 -0
- package/dist/docs/references/reference.md +1 -0
- 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/harness/index.cjs +2 -2
- package/dist/harness/index.js +2 -2
- 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/base.types.d.ts +3 -1
- package/dist/llm/model/mastra-gateway-provider-tools.d.ts +9 -6
- package/dist/llm/model/model.d.ts +1 -1
- package/dist/llm/model/model.loop.d.ts +1 -1
- package/dist/llm/model/model.loop.types.d.ts +3 -1
- package/dist/llm/model/provider-options.d.ts +4 -3
- package/dist/llm/model/provider-types.generated.d.ts +7581 -7556
- package/dist/{llm-B46V7Mi7.js → llm-CsQOELh9.js} +38 -78
- package/dist/{llm-B4AeSFvV.cjs → llm-D6N-WJwo.cjs} +38 -78
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/{manager-BwDxA1Nn.cjs → manager-CtsjlKP7.cjs} +2 -2
- package/dist/{manager-BRAvwB9b.js → manager-DBVDNjO2.js} +2 -2
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-DBhdD172.cjs → mastra-B60fJsMe.cjs} +16 -16
- package/dist/{mastra-CIx6qEq2.js → mastra-Bkpe1lBu.js} +16 -16
- package/dist/memory/index.cjs +3 -3
- package/dist/memory/index.js +3 -3
- package/dist/{message-list-wI71UGxk.js → message-list-BGm1DCiG.js} +230 -129
- package/dist/{message-list-DfN9mWeN.cjs → message-list-vR3uLAHL.cjs} +230 -129
- package/dist/{model-CYhAa5qO.cjs → model-CAbL0zRc.cjs} +4 -3
- package/dist/{model-CJMsDU8w.js → model-Da_pawSI.js} +4 -3
- package/dist/{netlify-C9aJA6Cv.js → netlify-CW26UJrG.js} +41361 -30464
- package/dist/{netlify-Bw7Vd58y.cjs → netlify-hasf5dLA.cjs} +41364 -30461
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +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-Bn_7VvZ8.cjs → provider-registry-CeV5wjlF.cjs} +21019 -20909
- package/dist/{provider-registry-DOfYSEju.js → provider-registry-DnVkqIBw.js} +21020 -20910
- package/dist/provider-registry.json +21425 -21369
- package/dist/{registry-generator-Cw594Ttt.js → registry-generator-DSR56u5H.js} +1 -1
- package/dist/{registry-generator-BnK5Npgr.cjs → registry-generator-G4PZCqrS.cjs} +1 -1
- package/dist/{rehydrate-BWnd_TEx.cjs → rehydrate-BLJ-q_V6.cjs} +2 -2
- package/dist/{rehydrate-Dgqkw7Py.js → rehydrate-zXo3Wo60.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-DhOKJtlb.js → run-registry-Cl2QbXgN.js} +189 -62
- package/dist/{run-registry-lLRc7EE6.cjs → run-registry-oixTpWpa.cjs} +190 -63
- 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-C8HKG3qC.js → stream-DUUfwH38.js} +3 -3
- package/dist/{stream-BIDts1fZ.cjs → stream-DaZh0apo.cjs} +3 -3
- package/dist/test-utils/llm-mock.cjs +1 -1
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/{to-prompt-B9eZo2U5.cjs → to-prompt-CG-LyaBY.cjs} +9 -0
- package/dist/{to-prompt-BsDtVXrf.js → to-prompt-CMlVGYxC.js} +9 -0
- package/dist/tool-loop-agent/index.cjs +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/{tool-loop-agent-DM5V_0XS.js → tool-loop-agent-C4NvGYnM.js} +4 -4
- package/dist/{tool-loop-agent-PEY5a1R6.cjs → tool-loop-agent-DDowWQyO.cjs} +4 -4
- package/dist/tools/index.cjs +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/{tools-CDfyMpzN.js → tools-DDfA_ES4.js} +113 -31
- package/dist/{tools-CGF5Ik6j.cjs → tools-n9lqzDNe.cjs} +113 -31
- package/dist/{utils-DcnKVK34.js → utils-CVN-336o.js} +1 -1
- package/dist/{utils-CxMSu_wc.cjs → utils-CmNJO2xP.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-Dn750ciE.js → validate-CgNNzqgp.js} +1 -1
- package/dist/{validate-RVKgazCf.cjs → validate-LpK3-p_O.cjs} +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +2 -2
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/{worker-Dx0ZHMGX.cjs → worker-6qR81hZZ.cjs} +2 -2
- package/dist/{worker-CFPu9qwV.cjs → worker-BN2odJzu.cjs} +2 -2
- package/dist/{worker-DJPAdazC.js → worker-BdPUoHXa.js} +2 -2
- package/dist/{worker-SDi9jbP5.js → worker-ChoZX7rg.js} +2 -2
- package/dist/{workflow-DkBqNn7X.js → workflow-D2MsV-JA.js} +3 -3
- package/dist/{workflow-ZFOz_365.cjs → workflow-ww-N09bR.cjs} +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/workflows/step.d.ts +2 -0
- package/dist/workflows/workflow.d.ts +2 -0
- package/dist/workspace/index.cjs +3 -1
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +2 -2
- package/dist/workspace/lsp/manager.d.ts +19 -4
- package/dist/workspace/sandbox/mastra-sandbox.d.ts +17 -0
- package/dist/workspace/tools/index.d.ts +1 -0
- package/dist/workspace/tools/media.d.ts +20 -1
- package/dist/workspace/tools/recreate-sandbox.d.ts +24 -0
- package/dist/{workspace-DY2Nxiyi.js → workspace-BK9ltbSa.js} +270 -105
- package/dist/{workspace-X2RHJZU9.cjs → workspace-Pv3J8K0c.cjs} +281 -104
- package/package.json +6 -6
- package/src/llm/model/provider-types.generated.d.ts +7581 -7556
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as getCapabilityFileName, g as shouldEnableGateway, m as getGatewayId } from "./netlify-CW26UJrG.js";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs from "fs/promises";
|
|
4
4
|
// src/llm/model/registry-generator.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BrhgMLW6.cjs");
|
|
2
|
-
const require_netlify = require("./netlify-
|
|
2
|
+
const require_netlify = require("./netlify-hasf5dLA.cjs");
|
|
3
3
|
let path = require("path");
|
|
4
4
|
path = require_rolldown_runtime.__toESM(path, 1);
|
|
5
5
|
let fs_promises = require("fs/promises");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_run_registry = require("./run-registry-
|
|
1
|
+
const require_run_registry = require("./run-registry-oixTpWpa.cjs");
|
|
2
2
|
const require_predicate_index = require("./predicate/index.cjs");
|
|
3
|
-
const require_validate = require("./validate-
|
|
3
|
+
const require_validate = require("./validate-LpK3-p_O.cjs");
|
|
4
4
|
let _mastra_schema_compat_schema = require("@mastra/schema-compat/schema");
|
|
5
5
|
// src/workflows/dynamic/serialize.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Cc as predicateToCondition, Fs as cloneWorkflow, Gc as createStepFromTool, Is as createEventedWorkflow, Ls as createWorkflow, Sc as mapVariable, Uc as createStepFromAgent, al as getSingleStepEntryId } from "./run-registry-
|
|
1
|
+
import { Cc as predicateToCondition, Fs as cloneWorkflow, Gc as createStepFromTool, Is as createEventedWorkflow, Ls as createWorkflow, Sc as mapVariable, Uc as createStepFromAgent, al as getSingleStepEntryId } from "./run-registry-Cl2QbXgN.js";
|
|
2
2
|
import { derivePredicateLabel } from "./predicate/index.js";
|
|
3
|
-
import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-
|
|
3
|
+
import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-CgNNzqgp.js";
|
|
4
4
|
import { standardSchemaToJSONSchema, toStandardSchema } from "./schema/index.js";
|
|
5
5
|
// src/workflows/dynamic/serialize.ts
|
|
6
6
|
/**
|
package/dist/relevance/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_run_registry = require("../run-registry-
|
|
3
|
-
const require_stream = require("../stream-
|
|
2
|
+
const require_run_registry = require("../run-registry-oixTpWpa.cjs");
|
|
3
|
+
const require_stream = require("../stream-DaZh0apo.cjs");
|
|
4
4
|
// src/relevance/relevance-score-provider.ts
|
|
5
5
|
function createSimilarityPrompt(query, text) {
|
|
6
6
|
return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
|
package/dist/relevance/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as Agent } from "../run-registry-
|
|
2
|
-
import { ln as isSupportedLanguageModel } from "../stream-
|
|
1
|
+
import { P as Agent } from "../run-registry-Cl2QbXgN.js";
|
|
2
|
+
import { ln as isSupportedLanguageModel } from "../stream-DUUfwH38.js";
|
|
3
3
|
// src/relevance/relevance-score-provider.ts
|
|
4
4
|
function createSimilarityPrompt(query, text) {
|
|
5
5
|
return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
|
|
@@ -4,18 +4,18 @@ import { t as MastraBase } from "./base-CKLWBhDo.js";
|
|
|
4
4
|
import { A as compactStopReasonContext, D as agentLoopTermination, O as executionFailureTermination, S as resolveObservabilityContext, b as wrapMastra, i as subtractReportedUsage, k as tripwireTermination, n as extractUsageMetrics, r as isUsageIncomplete, t as calculateObservedUsage, x as createObservabilityContext, y as unwrapMastraTracingProxy } from "./observability-D7RNOAPx.js";
|
|
5
5
|
import { a as MastraNonRetryableError, i as MastraError, n as ErrorDomain, o as getErrorFromUnknown, t as ErrorCategory } from "./error-oh2DLsP2.js";
|
|
6
6
|
import { a as classifyProviderError, l as describeProviderError, t as recordTerminalErrorMessage, u as readProviderErrorDetails } from "./error-BC9Au-22.js";
|
|
7
|
-
import { $ as resolveProcessorSpanAttributes, $t as computeModelOutputProviderMetadata, A as OUTPUT_STREAM_HOOK_DURATION_KEY_PREFIX, An as safeError, B as ProviderHistoryCompat, Bt as summarizeStepResult, C as markChunkOutputProcessed, Cn as isMastraTimeoutError, Ct as resolveTemplate, D as asJsonSchema, Dn as MastraModelInput, Dt as getStepResult, E as isStructuredOutputError, Et as validateTemplate, F as findOwnModelStepSpan, Ft as materializeState, G as REPROCESS_PART_KEY, Gt as patchState, Ht as applyStatePatch, It as materializeWorkflowRun, J as summarizeActiveToolsForSpan, Jt as isObservationalMemoryEnabled$1, K as takeHeldParts, L as isTrailingAssistantGuardContinuation, Lt as pickStateKeys, M as ProcessorState, Mn as createRunScopeKey, Mt as applyStateColumnsWrite, N as endOutputStreamSpanAtStepEnd, Nt as isStateCheckpointDue, O as getResponseFormat, On as safeClose, Ot as getStepResultAsync, P as endOutputStreamSpanOutsideStep, Pt as latestStepResults, Q as summarizeToolChoiceForSpan, Qt as commitToolResult, R as needsTrailingAssistantGuard, Rt as stateBaseOf, S as stampChunkProducedAt, Sn as guardStreamWithAbort, T as escapeUnescapedControlCharsInJsonStrings, Tn as settledOrElapsed, Tt as traverseMappingPath, Vt as unusedStateEntries, W as FLUSH_HELD_PARTS_KEY, Wt as diffStateAsJson, X as summarizeProcessorResultForSpan, Xt as parseMemoryRequestContext, Y as summarizeProcessorModelForSpan, Z as summarizeProcessorToolsForSpan, _ as reconcileBufferedStepTexts, _n as DEADLINE_SAVE_WAIT_MS, _t as collectMappingStepRefs, a as convertFullStreamChunkToMastra, an as withAgentWorkflowToolMarker, at as RunJournal, b as resolveProcessorWriterMessageId, bn as getAbortReason, bt as resolveStepOutputs, c as WorkflowRunOutput, cn as isProcessorWorkflow, ct as hydrateStepResults, d as MastraModelOutput, dn as resolveThreadIdFromArgs, dt as loadStepResults, en as hasToolResultProcessor, et as resolveProcessorSpanName, f as clearStepPartIndexes, fn as supportedLanguageModelSpecifications, ft as loadedStepResults, g as persistProcessorDataChunk, gn as DEADLINE_SAVE_CLAIM_HOLD_MS, gt as stubStepResult, h as findStepPartBoundaries, hn as applyStateSignal, ht as storageV2StepResultAccessors, in as snapshotToolResult, it as PROCESSOR_ABORT_SIGNAL, j as ProcessorRunner, jn as createRunScope, k as isSignalChunkExcluded, kn as safeEnqueue, kt as getSnapshotMemoryInfo, l as TripWire, ln as isSupportedLanguageModel, lt as isStepResultStub, m as findIterationOffsetInParts, mn as tryStreamWithJsonFallback, mt as residentStepResultsLoader, nn as readModelOutput, nt as PROCESSOR_LATE_SIGNAL_SINK, on as normalizeModelOutput, ot as buildStepResultAccessors, p as createDestructurableOutput, pn as tryGenerateWithJsonFallback, pt as residentStepResults, q as withoutHeldContent, rn as resolveModelOutputAfterToolResultProcessors, rt as createProcessorSendSignal, s as MastraAgentNetworkStream, sn as validationErrorModelOutput, st as getHydratedStepResult, tn as latestProcessedModelOutput, tt as toProcessorSpanPhase, u as getModelOutputForTripwire, un as resolveSuspendedToolRunId, ut as lazyStepResults, v as resolveMessageText, vn as MastraTimeoutError, vt as collectPredicateStepRefs, w as createOutputHandler, wn as raceAgainstAbort, wt as templateReadsState, x as getChunkProducedAt, xn as guardStreamUntilMatch, xt as stepRefId, y as resolveOutputMessageSkippingCompletionChecks, yn as createTimeoutAbortSignal, yt as predicateReadsState, z as removeTrailingAssistantGuardContinuations, zt as stateColumnsWrite } from "./stream-
|
|
7
|
+
import { $ as resolveProcessorSpanAttributes, $t as computeModelOutputProviderMetadata, A as OUTPUT_STREAM_HOOK_DURATION_KEY_PREFIX, An as safeError, B as ProviderHistoryCompat, Bt as summarizeStepResult, C as markChunkOutputProcessed, Cn as isMastraTimeoutError, Ct as resolveTemplate, D as asJsonSchema, Dn as MastraModelInput, Dt as getStepResult, E as isStructuredOutputError, Et as validateTemplate, F as findOwnModelStepSpan, Ft as materializeState, G as REPROCESS_PART_KEY, Gt as patchState, Ht as applyStatePatch, It as materializeWorkflowRun, J as summarizeActiveToolsForSpan, Jt as isObservationalMemoryEnabled$1, K as takeHeldParts, L as isTrailingAssistantGuardContinuation, Lt as pickStateKeys, M as ProcessorState, Mn as createRunScopeKey, Mt as applyStateColumnsWrite, N as endOutputStreamSpanAtStepEnd, Nt as isStateCheckpointDue, O as getResponseFormat, On as safeClose, Ot as getStepResultAsync, P as endOutputStreamSpanOutsideStep, Pt as latestStepResults, Q as summarizeToolChoiceForSpan, Qt as commitToolResult, R as needsTrailingAssistantGuard, Rt as stateBaseOf, S as stampChunkProducedAt, Sn as guardStreamWithAbort, T as escapeUnescapedControlCharsInJsonStrings, Tn as settledOrElapsed, Tt as traverseMappingPath, Vt as unusedStateEntries, W as FLUSH_HELD_PARTS_KEY, Wt as diffStateAsJson, X as summarizeProcessorResultForSpan, Xt as parseMemoryRequestContext, Y as summarizeProcessorModelForSpan, Z as summarizeProcessorToolsForSpan, _ as reconcileBufferedStepTexts, _n as DEADLINE_SAVE_WAIT_MS, _t as collectMappingStepRefs, a as convertFullStreamChunkToMastra, an as withAgentWorkflowToolMarker, at as RunJournal, b as resolveProcessorWriterMessageId, bn as getAbortReason, bt as resolveStepOutputs, c as WorkflowRunOutput, cn as isProcessorWorkflow, ct as hydrateStepResults, d as MastraModelOutput, dn as resolveThreadIdFromArgs, dt as loadStepResults, en as hasToolResultProcessor, et as resolveProcessorSpanName, f as clearStepPartIndexes, fn as supportedLanguageModelSpecifications, ft as loadedStepResults, g as persistProcessorDataChunk, gn as DEADLINE_SAVE_CLAIM_HOLD_MS, gt as stubStepResult, h as findStepPartBoundaries, hn as applyStateSignal, ht as storageV2StepResultAccessors, in as snapshotToolResult, it as PROCESSOR_ABORT_SIGNAL, j as ProcessorRunner, jn as createRunScope, k as isSignalChunkExcluded, kn as safeEnqueue, kt as getSnapshotMemoryInfo, l as TripWire, ln as isSupportedLanguageModel, lt as isStepResultStub, m as findIterationOffsetInParts, mn as tryStreamWithJsonFallback, mt as residentStepResultsLoader, nn as readModelOutput, nt as PROCESSOR_LATE_SIGNAL_SINK, on as normalizeModelOutput, ot as buildStepResultAccessors, p as createDestructurableOutput, pn as tryGenerateWithJsonFallback, pt as residentStepResults, q as withoutHeldContent, rn as resolveModelOutputAfterToolResultProcessors, rt as createProcessorSendSignal, s as MastraAgentNetworkStream, sn as validationErrorModelOutput, st as getHydratedStepResult, tn as latestProcessedModelOutput, tt as toProcessorSpanPhase, u as getModelOutputForTripwire, un as resolveSuspendedToolRunId, ut as lazyStepResults, v as resolveMessageText, vn as MastraTimeoutError, vt as collectPredicateStepRefs, w as createOutputHandler, wn as raceAgainstAbort, wt as templateReadsState, x as getChunkProducedAt, xn as guardStreamUntilMatch, xt as stepRefId, y as resolveOutputMessageSkippingCompletionChecks, yn as createTimeoutAbortSignal, yt as predicateReadsState, z as removeTrailingAssistantGuardContinuations, zt as stateColumnsWrite } from "./stream-DUUfwH38.js";
|
|
8
8
|
import { c as MASTRA_THREAD_ID_KEY, d as isReservedRequestContextKey, f as mergeVersionOverrides$1, l as MASTRA_VERSIONS_KEY, n as MASTRA_AUTH_TOKEN_KEY, o as MASTRA_RESOURCE_ID_KEY, p as withoutLiveRequestKeys, r as MASTRA_INHERITED_MEMORY_KEY, s as MASTRA_SCOPES_KEY, t as MASTRA_CONTINUATION_TOOL_CALL_IDS_KEY, u as RequestContext } from "./request-context-COnZHt2-.js";
|
|
9
9
|
import { S as withAck, _ as serializeError$1, h as stripModelSnapshots, n as PublisherQueueLimitError, p as slimNestedAgentChunks, r as CachingPubSub, t as DefaultStepResult, u as isRunLocalTopic, v as EventEmitterPubSub, x as isLeaseProvider, y as NoopLeaseProvider } from "./output-helpers-CVzhy1Y0.js";
|
|
10
|
-
import { A as stableStringify$1, E as removeWorkingMemoryTags, P as embed$3, Z as preserveResponseItemIdsOnMerge, a as isTerminalToolInvocationState, c as withUnavailableAttachmentUrls, d as aiV5UIMessagesToAIV5ModelMessages, f as coreContentToString, i as isClientToolInvocationUpdate, l as isDownloadAssetsError, m as filterMessagesForPersistence, n as MessageList, ot as normalizeToolOutput, p as messagesAreEqual, r as advancesToolInvocationState, s as unavailableAttachmentPlaceholder, t as convertMessages, u as MessageMerger } from "./message-list-
|
|
10
|
+
import { A as stableStringify$1, E as removeWorkingMemoryTags, P as embed$3, Z as preserveResponseItemIdsOnMerge, a as isTerminalToolInvocationState, c as withUnavailableAttachmentUrls, d as aiV5UIMessagesToAIV5ModelMessages, f as coreContentToString, i as isClientToolInvocationUpdate, l as isDownloadAssetsError, m as filterMessagesForPersistence, n as MessageList, ot as normalizeToolOutput, p as messagesAreEqual, r as advancesToolInvocationState, s as unavailableAttachmentPlaceholder, t as convertMessages, u as MessageMerger } from "./message-list-BGm1DCiG.js";
|
|
11
11
|
import { Bt as listScoresArgsSchema, Ft as listLogsArgsSchema, Lt as listMetricsArgsSchema, Nt as listFeedbackArgsSchema, t as EntityType } from "./storage-Cc50aQAp.js";
|
|
12
12
|
import { a as getOrCreateSpan, f as resolveCurrentSpan, l as getTimeToFirstChunkMs, n as executeWithContextSync, o as getResumeTracingContext, p as resolveExportedSpanId, s as getRootExportSpan, t as executeWithContext, u as getWorkflowResumeTracingContext } from "./utils-DU_pU5SK.js";
|
|
13
13
|
import { i as setSpanErrorOrigin, n as getSpanErrorOrigin } from "./error-count-BH-rJW7q.js";
|
|
14
|
-
import { a as ModelRouterLanguageModel, d as attachModelStreamTransport, f as isDataChunk, i as resolveModelConfig, n as ModelRouterEmbeddingModel, o as resolveApiProviderId, p as readModelStreamTransport } from "./llm-
|
|
14
|
+
import { a as ModelRouterLanguageModel, d as attachModelStreamTransport, f as isDataChunk, i as resolveModelConfig, n as ModelRouterEmbeddingModel, o as resolveApiProviderId, p as readModelStreamTransport } from "./llm-CsQOELh9.js";
|
|
15
15
|
import { a as withToolPayloadTransformMetadata, i as transformToolPayloadForTargets, n as hasTransformedToolPayload, o as withToolPayloadTransformProviderMetadata, r as normalizeToolPayloadTransformPolicy, t as getTransformedToolPayload } from "./payload-transform-Dj3HUeD4.js";
|
|
16
16
|
import { boundedStringify, ensureSerializable, safeStringify } from "./utils/safe-stringify.js";
|
|
17
17
|
import { d as signalSpanAttributes, h as signalToXmlMarkup, l as mastraDBMessageToSignal, n as createSignal, o as isMastraSignalMessage, s as isTransientSignalMessage, u as resolveDeliveryAttributes } from "./signals-CqR_iWkg.js";
|
|
18
|
-
import { h as resolveFilePartMediaTypeAndData, m as parseDataUri, o as categorizeFileData } from "./to-prompt-
|
|
18
|
+
import { h as resolveFilePartMediaTypeAndData, m as parseDataUri, o as categorizeFileData } from "./to-prompt-CMlVGYxC.js";
|
|
19
19
|
import { c as parsePartialJson, h as tool$1, m as generateId$1, p as asSchema$1, r as embed$4, u as APICallError$1 } from "./dist-TPVqg8oV.js";
|
|
20
20
|
import { n as embed$5 } from "./dist-D3cKCUe-.js";
|
|
21
21
|
import { t as deepEqual$3 } from "./deep-equal-d1xU02ag.js";
|
|
@@ -24,13 +24,13 @@ import { _ as getRequestContextInputValues, a as getModelFacingValidationError,
|
|
|
24
24
|
import { a as isApprovalExempt, c as isProviderDefinedTool, d as markAgentWorkflowTool, f as markApprovalExempt, l as isProviderTool, n as getNeedsApprovalFn, o as isBuiltBeforeApproval, r as getProviderToolName, s as isMastraTool, t as getBeforeApprovalFn } from "./toolchecks-DrsZdc3S.js";
|
|
25
25
|
import { a as waitDelay, i as getRetryAfterMs, n as DEFAULT_MAX_RETRY_AFTER_MS, r as clampDelayMs } from "./fetchWithRetry-DFSvpYDT.js";
|
|
26
26
|
import { i as hasFreeFormObject } from "./model-DS-b2R-R.js";
|
|
27
|
-
import { c as modelSupportsStructuredOutput, l as modelSupportsTemperature } from "./provider-registry-
|
|
27
|
+
import { c as modelSupportsStructuredOutput, l as modelSupportsTemperature } from "./provider-registry-DnVkqIBw.js";
|
|
28
28
|
import { t as InMemoryServerCache } from "./inmemory-BK3zLwvM.js";
|
|
29
29
|
import { n as resolveDynamicArgument, t as getRequestUser } from "./dynamic-argument-BzPK3qPN.js";
|
|
30
|
-
import { t as MastraLLMV1 } from "./model-
|
|
31
|
-
import { A as eagerToolCallDidNotExecute, D as EagerToolExecutionCoordinator, E as EAGER_TOOL_EXECUTION_MARKER, F as hasRunningRunStep, I as isRunStepActive, L as setRunLeaseFence, M as isEagerlyExecutableToolCall, N as TOOL_ABORT_NOTICE, O as EagerToolExecutionNotRun, P as clearRunLeaseFence, R as startRunStep, S as selectFields, T as EAGER_TOOL_BAILOUT, a as ensureToolProperties, b as removeUndefinedValues, d as makeCoreTool, i as delay$1, j as eagerToolCallSuspensionIntent, k as eagerToolCallAlreadyAnnouncedInput, n as createMastraProxy, o as generateEmptyFromSchema, p as makeProcessorCoreTool, r as deepMerge$1, v as readPositiveIntEnv, w as EAGER_TOOL_ABORT_SIGNAL, y as rebindProcessorTools, z as whenRunStepsSettle } from "./utils-
|
|
30
|
+
import { t as MastraLLMV1 } from "./model-Da_pawSI.js";
|
|
31
|
+
import { A as eagerToolCallDidNotExecute, D as EagerToolExecutionCoordinator, E as EAGER_TOOL_EXECUTION_MARKER, F as hasRunningRunStep, I as isRunStepActive, L as setRunLeaseFence, M as isEagerlyExecutableToolCall, N as TOOL_ABORT_NOTICE, O as EagerToolExecutionNotRun, P as clearRunLeaseFence, R as startRunStep, S as selectFields, T as EAGER_TOOL_BAILOUT, a as ensureToolProperties, b as removeUndefinedValues, d as makeCoreTool, i as delay$1, j as eagerToolCallSuspensionIntent, k as eagerToolCallAlreadyAnnouncedInput, n as createMastraProxy, o as generateEmptyFromSchema, p as makeProcessorCoreTool, r as deepMerge$1, v as readPositiveIntEnv, w as EAGER_TOOL_ABORT_SIGNAL, y as rebindProcessorTools, z as whenRunStepsSettle } from "./utils-CVN-336o.js";
|
|
32
32
|
import { h as getWorkflowFGAResourceId, i as MastraFGAPermissions, y as requireFGA } from "./ee-iTj2bRDt-By_B9ngH.js";
|
|
33
|
-
import { a as resolveBackgroundConfig, o as createBackgroundTask, t as generateBackgroundTaskSystemPrompt } from "./background-tasks-
|
|
33
|
+
import { a as resolveBackgroundConfig, o as createBackgroundTask, t as generateBackgroundTaskSystemPrompt } from "./background-tasks-1tyymY2H.js";
|
|
34
34
|
import { t as ToolStream } from "./stream-D9JOykz7.js";
|
|
35
35
|
import { MISSING, collectInvalidPredicatePaths, createPredicateEvaluator, derivePredicateLabel, normalizePredicatePath, walk } from "./predicate/index.js";
|
|
36
36
|
import { Classifier } from "./classifier/index.js";
|
|
@@ -42,8 +42,8 @@ import { A as writeObjective, D as readObjective, O as resolveEffectiveGoalSetti
|
|
|
42
42
|
import { An as computeTraceStatus, Cr as extractTrajectory, Dr as saveScorePayloadSchema, It as TABLE_SCHEMAS, Lt as TABLE_SCORERS, Nn as extractBranchSpans, Pn as getBranchArgsSchema, Qn as listTracesArgsSchema, Sr as withBufferedReflectionVerified, Tr as extractWorkflowTrajectory, Yn as listBranchesArgsSchema, _r as isAppendOnlySince, ar as spanRecordSchema, br as maxObservationCursor, cr as toTraceSpans, gn as BRANCH_SPAN_TYPE_SET, gr as compareObservationalMemoryHeadOrder, hr as assertActiveObservationsApplied, or as toLightSpanRecord, pn as matchesExpectedWorkflowStatus, qn as isPreviewTruncated, sr as toTraceSpan, vn as TraceStatus, vr as isBufferedChunkCoveredByCursor, wr as extractTrajectoryFromTrace, xr as planReflectionGenerationText, yr as isBufferedReflectionUnchangedSince } from "./constants-BmdTvEYN.js";
|
|
43
43
|
import { t as GoalSignalProvider } from "./signal-provider-BslnAjWG.js";
|
|
44
44
|
import { t as slugify } from "./slugify-BUNmb-Ga.js";
|
|
45
|
-
import {
|
|
46
|
-
import { i as normalizeWebSearchProvider, n as createWebSearchProviderTool, r as isWebSearchTool } from "./tools-
|
|
45
|
+
import { F as LocalSandbox, at as evaluateReadRecord, c as Workspace, dt as WORKSPACE_TOOLS, g as resolveToolConfig, gt as shellQuote, h as createWorkspaceTools, ht as sliceByTokens, l as createSkillTools, lt as CompositeFilesystem, mt as estimateTokenCount, ot as normalizeReadTrackerPath, pt as sliceByTokensSafe, st as LocalFilesystem } from "./workspace-BK9ltbSa.js";
|
|
46
|
+
import { i as normalizeWebSearchProvider, n as createWebSearchProviderTool, r as isWebSearchTool } from "./tools-DDfA_ES4.js";
|
|
47
47
|
import { D as BM25Index, O as tokenize } from "./workspace-skills-38OY32_b.js";
|
|
48
48
|
import { f as calculatePagination, g as InMemoryThreadStateStorage, h as resolveListOrderBy, m as normalizePerPage, p as compareByField, s as StorageDomain, u as MastraCompositeStore } from "./filesystem-versioned-BL1ojJLo.js";
|
|
49
49
|
import { coreFeatures } from "./features/index.js";
|
|
@@ -65,11 +65,11 @@ import { ReadableStream as ReadableStream$1, TransformStream as TransformStream$
|
|
|
65
65
|
import { injectJsonInstructionIntoMessages, isAbortError } from "@ai-sdk/provider-utils-v6";
|
|
66
66
|
import { z as z$1 } from "zod";
|
|
67
67
|
import { createHash, randomUUID } from "crypto";
|
|
68
|
+
import { config, toJSONSchema } from "zod/v4/core";
|
|
69
|
+
import en from "zod/v4/locales/en.js";
|
|
68
70
|
import { prepareJsonSchemaForOpenAIStrictMode, wrapSchemaWithNullTransform } from "@mastra/schema-compat";
|
|
69
71
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
70
72
|
import { dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep, win32 } from "path";
|
|
71
|
-
import { config, toJSONSchema } from "zod/v4/core";
|
|
72
|
-
import en from "zod/v4/locales/en.js";
|
|
73
73
|
import { jsonSchemaToZod } from "@mastra/schema-compat/json-to-zod";
|
|
74
74
|
import { AsyncLocalStorage } from "async_hooks";
|
|
75
75
|
import fastq from "fastq";
|
|
@@ -7613,6 +7613,7 @@ function createStepFromProcessor$1(processor) {
|
|
|
7613
7613
|
};
|
|
7614
7614
|
const step = {
|
|
7615
7615
|
id: `processor:${processor.id}`,
|
|
7616
|
+
processorId: processor.id,
|
|
7616
7617
|
description: processor.name ?? `Processor ${processor.id}`,
|
|
7617
7618
|
inputSchema: toStandardSchema(ProcessorStepInputSchema),
|
|
7618
7619
|
outputSchema: toStandardSchema(ProcessorStepOutputSchema),
|
|
@@ -8258,7 +8259,8 @@ function cloneStep$1(step, opts) {
|
|
|
8258
8259
|
retries: step.retries,
|
|
8259
8260
|
scorers: step.scorers,
|
|
8260
8261
|
component: step.component,
|
|
8261
|
-
metadata: step.metadata
|
|
8262
|
+
metadata: step.metadata,
|
|
8263
|
+
processorId: step.processorId
|
|
8262
8264
|
};
|
|
8263
8265
|
}
|
|
8264
8266
|
/**
|
|
@@ -11996,6 +11998,7 @@ function snapshotRequestContextEntries(requestContext, onEntryOmitted) {
|
|
|
11996
11998
|
if (key === "mastra__versions") continue;
|
|
11997
11999
|
if (key === "mastra__durableExecutions") continue;
|
|
11998
12000
|
if (key === "mastra__durableSegments") continue;
|
|
12001
|
+
if (key === "__mastra_chat_channel_render") continue;
|
|
11999
12002
|
const json = boundedStringify(value);
|
|
12000
12003
|
if (json === void 0) {
|
|
12001
12004
|
onEntryOmitted?.();
|
|
@@ -21337,7 +21340,8 @@ function cloneStep(step, opts) {
|
|
|
21337
21340
|
retries: step.retries,
|
|
21338
21341
|
scorers: step.scorers,
|
|
21339
21342
|
metadata: step.metadata,
|
|
21340
|
-
component: step.component
|
|
21343
|
+
component: step.component,
|
|
21344
|
+
processorId: step.processorId
|
|
21341
21345
|
};
|
|
21342
21346
|
}
|
|
21343
21347
|
function isToolStep(input) {
|
|
@@ -21597,6 +21601,7 @@ function createStepFromProcessor(processor) {
|
|
|
21597
21601
|
};
|
|
21598
21602
|
return {
|
|
21599
21603
|
id: `processor:${processor.id}`,
|
|
21604
|
+
processorId: processor.id,
|
|
21600
21605
|
description: processor.name ?? `Processor ${processor.id}`,
|
|
21601
21606
|
inputSchema: toStandardSchema(ProcessorStepSchema),
|
|
21602
21607
|
outputSchema: toStandardSchema(ProcessorStepOutputSchema),
|
|
@@ -27746,12 +27751,14 @@ async function partitionMessages(messagesDescending, limits, tokenCounter, initi
|
|
|
27746
27751
|
if (maxTokens !== void 0 && !tokenCounter) throw new Error("A token counter is required to load token-limited message history");
|
|
27747
27752
|
let messageCount = 0;
|
|
27748
27753
|
let tokenCount = initialTokens;
|
|
27754
|
+
let loadedTokens = initialTokens;
|
|
27749
27755
|
let reachedLimit = false;
|
|
27750
27756
|
let overflowReason;
|
|
27751
27757
|
const retainedIds = /* @__PURE__ */ new Set();
|
|
27752
27758
|
for (const group of groupLinkedToolMessages(messagesDescending)) {
|
|
27753
27759
|
let groupTokens = 0;
|
|
27754
27760
|
if (tokenCounter) for (const message of group) groupTokens += await tokenCounter.countMessage(message);
|
|
27761
|
+
loadedTokens += groupTokens;
|
|
27755
27762
|
const exceedsMessageLimit = limits.maxMessages !== void 0 && messageCount + group.length > limits.maxMessages;
|
|
27756
27763
|
const exceedsTokenLimit = maxTokens !== void 0 && tokenCount + groupTokens > maxTokens;
|
|
27757
27764
|
if (reachedLimit || exceedsMessageLimit || exceedsTokenLimit) {
|
|
@@ -27766,7 +27773,8 @@ async function partitionMessages(messagesDescending, limits, tokenCounter, initi
|
|
|
27766
27773
|
return {
|
|
27767
27774
|
messages: messagesDescending.filter((message) => retainedIds.has(message.id)).reverse(),
|
|
27768
27775
|
overflow: messagesDescending.filter((message) => !retainedIds.has(message.id)).reverse(),
|
|
27769
|
-
overflowReason
|
|
27776
|
+
overflowReason,
|
|
27777
|
+
loadedTokens
|
|
27770
27778
|
};
|
|
27771
27779
|
}
|
|
27772
27780
|
function laterDate(left, right) {
|
|
@@ -27828,15 +27836,15 @@ async function loadMessageHistory(args) {
|
|
|
27828
27836
|
const newestOverflow = partitioned.overflow.at(-1);
|
|
27829
27837
|
if (newestOverflow) cutoffTimestamp = newestOverflow.createdAt.getTime();
|
|
27830
27838
|
const oldestTimestamp = result.messages.at(-1)?.createdAt.getTime();
|
|
27831
|
-
const crossedCutoff = cutoffTimestamp !== void 0 && oldestTimestamp !== void 0 && oldestTimestamp < cutoffTimestamp;
|
|
27839
|
+
const crossedCutoff = cutoffTimestamp !== void 0 && oldestTimestamp !== void 0 && oldestTimestamp < cutoffTimestamp && (!args.includeOverflow || partitioned.overflowReason !== "tokens" || partitioned.loadedTokens > (args.maxTokens ?? 0));
|
|
27832
27840
|
const reachedBoundary = args.boundary !== void 0 && oldestTimestamp !== void 0 && oldestTimestamp < new Date(args.boundary.createdAt).getTime();
|
|
27833
|
-
if (!result.hasMore || crossedCutoff || reachedBoundary || result.messages.length === 0) return
|
|
27841
|
+
if (!result.hasMore || crossedCutoff || reachedBoundary || result.messages.length === 0) return {
|
|
27834
27842
|
messages: partitioned.messages,
|
|
27835
|
-
overflow: []
|
|
27843
|
+
overflow: args.includeOverflow && partitioned.overflowReason === "tokens" ? partitioned.overflow : []
|
|
27836
27844
|
};
|
|
27837
|
-
if (oldestTimestamp === void 0) return
|
|
27845
|
+
if (oldestTimestamp === void 0) return {
|
|
27838
27846
|
messages: partitioned.messages,
|
|
27839
|
-
overflow: []
|
|
27847
|
+
overflow: args.includeOverflow && partitioned.overflowReason === "tokens" ? partitioned.overflow : []
|
|
27840
27848
|
};
|
|
27841
27849
|
if (end?.getTime() === oldestTimestamp && added === 0) page++;
|
|
27842
27850
|
else {
|
|
@@ -47884,6 +47892,32 @@ function chunkToFallbackMessage(chunk) {
|
|
|
47884
47892
|
if (chunk.type === "plan_update") return chunk.title && chunk.title.length > 0 ? chunk.title : null;
|
|
47885
47893
|
return null;
|
|
47886
47894
|
}
|
|
47895
|
+
/** Whitespace plus the meaningful joiners ZWNJ (U+200C) and ZWJ (U+200D). */
|
|
47896
|
+
const EDGE_PADDING = /[\s\u200C\u200D]/;
|
|
47897
|
+
/**
|
|
47898
|
+
* Sanitize a buffered channel reply before posting.
|
|
47899
|
+
*
|
|
47900
|
+
* Zero-width space (U+200B) and the byte-order mark (U+FEFF) are invisible
|
|
47901
|
+
* padding and are removed everywhere. Whitespace and the joiners ZWNJ
|
|
47902
|
+
* (U+200C) / ZWJ (U+200D) are trimmed only at the edges, so internal joiners
|
|
47903
|
+
* in compound emoji (🏄🏼♂️, 👨👩👧) and scripts such as Persian (میخواهم)
|
|
47904
|
+
* survive — the bug behind #31205. Invisible-only input collapses to '' so
|
|
47905
|
+
* callers skip posting it entirely.
|
|
47906
|
+
*
|
|
47907
|
+
* The edge trim is a single-pass scan rather than
|
|
47908
|
+
* `.replace(/^[\s\u200C\u200D]+|[\s\u200C\u200D]+$/g, '')`: that anchored
|
|
47909
|
+
* alternation backtracks quadratically over a long interior run of the class
|
|
47910
|
+
* (a 300k-character run of model-controlled output took ~80s), while this
|
|
47911
|
+
* scan is O(n).
|
|
47912
|
+
*/
|
|
47913
|
+
function cleanBufferedText(input) {
|
|
47914
|
+
const stripped = input.replace(/[\u200B\uFEFF]/g, "");
|
|
47915
|
+
let start = 0;
|
|
47916
|
+
let end = stripped.length;
|
|
47917
|
+
while (start < end && EDGE_PADDING.test(stripped.charAt(start))) start++;
|
|
47918
|
+
while (end > start && EDGE_PADDING.test(stripped.charAt(end - 1))) end--;
|
|
47919
|
+
return start === 0 && end === stripped.length ? stripped : stripped.slice(start, end);
|
|
47920
|
+
}
|
|
47887
47921
|
// src/channels/chat-driver-static.ts
|
|
47888
47922
|
/**
|
|
47889
47923
|
* Static (non-streaming) driver: consumes `AgentChunkType<any>` chunks and
|
|
@@ -47928,7 +47962,7 @@ async function runStaticDriver({ stream, chatThread, adapter, toolDisplay, toolD
|
|
|
47928
47962
|
let textBuffer = "";
|
|
47929
47963
|
const toolMessageIds = /* @__PURE__ */ new Map();
|
|
47930
47964
|
const flushText = async () => {
|
|
47931
|
-
const cleaned = textBuffer
|
|
47965
|
+
const cleaned = cleanBufferedText(textBuffer);
|
|
47932
47966
|
if (cleaned) try {
|
|
47933
47967
|
await chatThread.post(textFormat === "plain" ? cleaned : { markdown: cleaned });
|
|
47934
47968
|
} catch (e) {
|
|
@@ -48263,7 +48297,7 @@ async function runStreamingDriver({ stream, chatThread, adapter, toolDisplay, to
|
|
|
48263
48297
|
if (closed) break;
|
|
48264
48298
|
await waitForNext();
|
|
48265
48299
|
}
|
|
48266
|
-
const cleaned = fallback
|
|
48300
|
+
const cleaned = cleanBufferedText(fallback);
|
|
48267
48301
|
if (cleaned) try {
|
|
48268
48302
|
await chatThread.post(textFormat === "plain" ? cleaned : { markdown: cleaned });
|
|
48269
48303
|
} catch (postErr) {
|
|
@@ -48746,6 +48780,20 @@ const TEXT_CHUNK_TYPES = /* @__PURE__ */ new Set([
|
|
|
48746
48780
|
/** Key the processor reads off `requestContext` to locate its render deps. */
|
|
48747
48781
|
const CHAT_CHANNEL_RENDER_CONTEXT_KEY = "__mastra_chat_channel_render";
|
|
48748
48782
|
/**
|
|
48783
|
+
* Whether a `requestContext` entry is a live render context rather than the
|
|
48784
|
+
* method-less husk a JSON snapshot round-trip leaves behind (issue #31310).
|
|
48785
|
+
* `wrapStream` is the first method the session calls, so its presence is the
|
|
48786
|
+
* signal that the object is usable.
|
|
48787
|
+
*
|
|
48788
|
+
* Every reader that treats a stashed render context as a live object (the
|
|
48789
|
+
* output processor, `resolveChannelRenderContext`, `AgentChannels.resolveRunRender`
|
|
48790
|
+
* and the generative-UI processor) guards with this, so a husk on a replica's
|
|
48791
|
+
* restored `requestContext` always falls through to a rebuild from the thread.
|
|
48792
|
+
*/
|
|
48793
|
+
function isUsableRenderContext(value) {
|
|
48794
|
+
return typeof value === "object" && value !== null && typeof value.wrapStream === "function";
|
|
48795
|
+
}
|
|
48796
|
+
/**
|
|
48749
48797
|
* Single-producer / single-consumer async queue. The processor pushes chunks
|
|
48750
48798
|
* synchronously from `processOutputStream`; the driver consumes them via the
|
|
48751
48799
|
* async iterable. `close()` ends the iteration after pending items are drained.
|
|
@@ -48879,7 +48927,7 @@ var ChatChannelOutputProcessor = class {
|
|
|
48879
48927
|
async #resolveRenderContext(state, requestContext) {
|
|
48880
48928
|
if (state.render !== void 0) return state.render;
|
|
48881
48929
|
const fromRequest = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
48882
|
-
if (fromRequest) {
|
|
48930
|
+
if (isUsableRenderContext(fromRequest)) {
|
|
48883
48931
|
state.render = fromRequest;
|
|
48884
48932
|
return fromRequest;
|
|
48885
48933
|
}
|
|
@@ -49052,7 +49100,7 @@ var ChatChannelGenerativeUIProcessor = class {
|
|
|
49052
49100
|
}
|
|
49053
49101
|
async #resolve(requestContext, state) {
|
|
49054
49102
|
const inbound = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
49055
|
-
if (inbound) return inbound;
|
|
49103
|
+
if (isUsableRenderContext(inbound)) return inbound;
|
|
49056
49104
|
if (state && "render" in state) return state.render ?? void 0;
|
|
49057
49105
|
const threadId = parseMemoryRequestContext(requestContext)?.thread?.id;
|
|
49058
49106
|
const render = threadId && this.#channels ? await this.#channels.buildRenderContextForThread(threadId) : null;
|
|
@@ -49206,6 +49254,8 @@ async function headContentType(url, logger) {
|
|
|
49206
49254
|
}
|
|
49207
49255
|
}
|
|
49208
49256
|
// src/channels/processor.ts
|
|
49257
|
+
/** Per-run `state` key caching a thread's display mode recovered without a render context. */
|
|
49258
|
+
const RECOVERED_DISPLAY_KEY = "threadTextHidden";
|
|
49209
49259
|
/**
|
|
49210
49260
|
* Input processor that injects channel context (platform, bot identity, DM vs.
|
|
49211
49261
|
* public-channel guidance) into the agent's system prompt on every step.
|
|
@@ -49239,19 +49289,37 @@ var ChatChannelProcessor = class {
|
|
|
49239
49289
|
}
|
|
49240
49290
|
async #resolve(requestContext, state) {
|
|
49241
49291
|
const channel = requestContext?.get("channel");
|
|
49242
|
-
if (channel)
|
|
49243
|
-
|
|
49244
|
-
|
|
49245
|
-
|
|
49292
|
+
if (channel) {
|
|
49293
|
+
const render = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
49294
|
+
return {
|
|
49295
|
+
channel,
|
|
49296
|
+
textHidden: isUsableRenderContext(render) ? render.textDisplay === "hidden" : await this.#recoverTextHidden(requestContext, state)
|
|
49297
|
+
};
|
|
49298
|
+
}
|
|
49246
49299
|
if (state && "thread" in state) return state.thread ?? void 0;
|
|
49300
|
+
const resolved = await this.#resolveThread(requestContext);
|
|
49301
|
+
if (state) state.thread = resolved;
|
|
49302
|
+
return resolved ?? void 0;
|
|
49303
|
+
}
|
|
49304
|
+
/** The channel-backed context of the run's memory thread, or `null` when it has none. */
|
|
49305
|
+
async #resolveThread(requestContext) {
|
|
49247
49306
|
const threadId = parseMemoryRequestContext(requestContext)?.thread?.id;
|
|
49248
49307
|
const found = threadId && this.#channels ? await this.#channels.buildChannelContextForThread(threadId) : null;
|
|
49249
|
-
|
|
49308
|
+
return found ? {
|
|
49250
49309
|
channel: found.channel,
|
|
49251
49310
|
textHidden: found.render.textDisplay === "hidden"
|
|
49252
49311
|
} : null;
|
|
49253
|
-
|
|
49254
|
-
|
|
49312
|
+
}
|
|
49313
|
+
/**
|
|
49314
|
+
* Display mode of a channel-backed thread whose render context is no longer on the
|
|
49315
|
+
* restored request context. Cached per run like the thread lookup above, so later
|
|
49316
|
+
* steps of the same run read the thread once.
|
|
49317
|
+
*/
|
|
49318
|
+
async #recoverTextHidden(requestContext, state) {
|
|
49319
|
+
if (state && RECOVERED_DISPLAY_KEY in state) return state[RECOVERED_DISPLAY_KEY] === true;
|
|
49320
|
+
const textHidden = (await this.#resolveThread(requestContext))?.textHidden ?? false;
|
|
49321
|
+
if (state) state[RECOVERED_DISPLAY_KEY] = textHidden;
|
|
49322
|
+
return textHidden;
|
|
49255
49323
|
}
|
|
49256
49324
|
};
|
|
49257
49325
|
function channelLines(ctx, textHidden, tools) {
|
|
@@ -49774,15 +49842,17 @@ var ChannelReplyModeProcessor = class {
|
|
|
49774
49842
|
var MastraStateAdapter = class {
|
|
49775
49843
|
memoryStore;
|
|
49776
49844
|
getOwnerId;
|
|
49845
|
+
logger;
|
|
49777
49846
|
connected = false;
|
|
49778
49847
|
connectPromise = null;
|
|
49779
49848
|
cache = /* @__PURE__ */ new Map();
|
|
49780
49849
|
locks = /* @__PURE__ */ new Map();
|
|
49781
49850
|
lists = /* @__PURE__ */ new Map();
|
|
49782
49851
|
queues = /* @__PURE__ */ new Map();
|
|
49783
|
-
constructor(memoryStore, getOwnerId) {
|
|
49852
|
+
constructor(memoryStore, getOwnerId, logger) {
|
|
49784
49853
|
this.memoryStore = memoryStore;
|
|
49785
49854
|
this.getOwnerId = getOwnerId;
|
|
49855
|
+
this.logger = logger;
|
|
49786
49856
|
}
|
|
49787
49857
|
async connect() {
|
|
49788
49858
|
if (this.connected) return;
|
|
@@ -49801,7 +49871,10 @@ var MastraStateAdapter = class {
|
|
|
49801
49871
|
}
|
|
49802
49872
|
async subscribe(threadId) {
|
|
49803
49873
|
const thread = await this.findThreadByExternalId(threadId);
|
|
49804
|
-
if (!thread)
|
|
49874
|
+
if (!thread) {
|
|
49875
|
+
this.logger?.warn(`subscribe(${threadId}) ignored: no Mastra thread is mapped to this chat thread. Use AgentChannels.subscribeThread() for threads the bot started itself.`);
|
|
49876
|
+
return;
|
|
49877
|
+
}
|
|
49805
49878
|
await this.memoryStore.patchThread({
|
|
49806
49879
|
id: thread.id,
|
|
49807
49880
|
metadata: {
|
|
@@ -50193,7 +50266,7 @@ function formatLegacyHistoryBlock(history, chatThread, platform) {
|
|
|
50193
50266
|
async function resolveChannelRenderContext(requestContext, channels) {
|
|
50194
50267
|
if (!requestContext) return void 0;
|
|
50195
50268
|
const stashed = requestContext.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
50196
|
-
if (stashed) return stashed;
|
|
50269
|
+
if (isUsableRenderContext(stashed)) return stashed;
|
|
50197
50270
|
const threadId = requestContext.get("controller")?.threadId ?? parseMemoryRequestContext(requestContext)?.thread?.id;
|
|
50198
50271
|
if (!threadId) return void 0;
|
|
50199
50272
|
return await channels?.()?.buildRenderContextForThread(threadId) ?? void 0;
|
|
@@ -50637,7 +50710,7 @@ var AgentChannels = class {
|
|
|
50637
50710
|
const storage = mastra.getStorage();
|
|
50638
50711
|
const memoryStore = storage ? await storage.getStore("memory") : void 0;
|
|
50639
50712
|
if (!memoryStore) throw new Error("Channels require storage to be configured on the Mastra instance. Configure a storage provider like LibSQLStore.");
|
|
50640
|
-
this.stateAdapter = new MastraStateAdapter(memoryStore, () => this.getOwnerId());
|
|
50713
|
+
this.stateAdapter = new MastraStateAdapter(memoryStore, () => this.getOwnerId(), this.logger);
|
|
50641
50714
|
this.log("info", "Using MastraStateAdapter (subscriptions persist across restarts)");
|
|
50642
50715
|
}
|
|
50643
50716
|
const { Chat, Message: ChatMessage, ThreadImpl } = await getChatModule();
|
|
@@ -50865,25 +50938,30 @@ var AgentChannels = class {
|
|
|
50865
50938
|
runId = stashed.runId;
|
|
50866
50939
|
toolName = stashed.toolName;
|
|
50867
50940
|
toolArgs = stashed.args;
|
|
50868
|
-
}
|
|
50941
|
+
}
|
|
50942
|
+
if (!requesterId) {
|
|
50869
50943
|
const { result: lookup } = await this.lookupPersistedApproval({
|
|
50870
50944
|
mastra,
|
|
50871
50945
|
card,
|
|
50872
50946
|
platform
|
|
50873
50947
|
});
|
|
50874
|
-
if (
|
|
50875
|
-
|
|
50876
|
-
|
|
50948
|
+
if (!stashed?.runId) {
|
|
50949
|
+
if (lookup.status === "answered") {
|
|
50950
|
+
this.log("info", "Tool approval already answered", actionEventContext);
|
|
50951
|
+
return;
|
|
50952
|
+
}
|
|
50953
|
+
if (lookup.status === "pending") {
|
|
50954
|
+
runId = lookup.runId;
|
|
50955
|
+
toolName = lookup.toolName;
|
|
50956
|
+
toolArgs = lookup.args;
|
|
50957
|
+
}
|
|
50877
50958
|
}
|
|
50878
50959
|
if (lookup.status === "pending") {
|
|
50879
|
-
|
|
50880
|
-
toolName = lookup.toolName;
|
|
50881
|
-
toolArgs = lookup.args;
|
|
50882
|
-
if (adapterConfig?.toolApprovers !== "anyone" && !requesterId && lookup.authors.length > 1) {
|
|
50960
|
+
if (adapterConfig?.toolApprovers !== "anyone" && lookup.authors.length > 1) {
|
|
50883
50961
|
this.log("info", "Ignoring tool approval action: requester is ambiguous", actionEventContext);
|
|
50884
50962
|
return;
|
|
50885
50963
|
}
|
|
50886
|
-
requesterId
|
|
50964
|
+
requesterId = lookup.authors[0];
|
|
50887
50965
|
}
|
|
50888
50966
|
}
|
|
50889
50967
|
if (!runId) {
|
|
@@ -51188,7 +51266,7 @@ var AgentChannels = class {
|
|
|
51188
51266
|
*/
|
|
51189
51267
|
async resolveRunRender(requestContext, state) {
|
|
51190
51268
|
const inbound = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
|
|
51191
|
-
if (inbound) return inbound;
|
|
51269
|
+
if (isUsableRenderContext(inbound)) return inbound;
|
|
51192
51270
|
if (state && "render" in state) return state.render ?? void 0;
|
|
51193
51271
|
const render = await resolveChannelRenderContext(requestContext, () => this);
|
|
51194
51272
|
if (state) state.render = render ?? null;
|
|
@@ -51217,8 +51295,8 @@ var AgentChannels = class {
|
|
|
51217
51295
|
const has = (id) => configuredProcessors.some((p) => !isProcessorWorkflow(p) && p.id === id);
|
|
51218
51296
|
const processors = [];
|
|
51219
51297
|
if (Object.values(this.adapterConfigs).some((cfg) => cfg.threadLink) && !has(THREAD_LINK_PROCESSOR_ID)) processors.push(new ChannelThreadLinkProcessor((requestContext) => {
|
|
51220
|
-
const
|
|
51221
|
-
return
|
|
51298
|
+
const platform = requestContext.get("channel")?.platform ?? requestContext.get("__mastra_chat_channel_render")?.platform;
|
|
51299
|
+
return platform ? threadLinkOptions(this.adapterConfigs[platform]?.threadLink) : void 0;
|
|
51222
51300
|
}));
|
|
51223
51301
|
if (!has("chat-channel-render")) processors.push(new ChatChannelOutputProcessor(this));
|
|
51224
51302
|
if (this.replyModeEnabled && !has(REPLY_STREAM_PROCESSOR_ID)) processors.push(new ChannelReplyStreamProcessor((requestContext) => this.resolveRunRender(requestContext)));
|
|
@@ -52400,6 +52478,36 @@ var AgentChannels = class {
|
|
|
52400
52478
|
};
|
|
52401
52479
|
}
|
|
52402
52480
|
/**
|
|
52481
|
+
* Map a chat thread to a Mastra thread (creating the mapping if needed) and
|
|
52482
|
+
* subscribe to it, so follow-up replies reach the agent without a mention.
|
|
52483
|
+
*
|
|
52484
|
+
* Use this for threads the bot started itself, e.g. a scheduled digest posted
|
|
52485
|
+
* to Slack. Inbound messages create the mapping automatically, but a thread
|
|
52486
|
+
* the bot opened has none until someone mentions it. An existing mapping is
|
|
52487
|
+
* reused and keeps its original owner.
|
|
52488
|
+
*
|
|
52489
|
+
* @example
|
|
52490
|
+
* ```ts
|
|
52491
|
+
* const sent = await channel.post('Daily digest');
|
|
52492
|
+
* await agent.getChannels()!.subscribeThread({ thread: sent.thread, resourceId: 'digest-bot' });
|
|
52493
|
+
* ```
|
|
52494
|
+
*/
|
|
52495
|
+
async subscribeThread({ thread, resourceId, threadId }) {
|
|
52496
|
+
const mastra = this.getMastra();
|
|
52497
|
+
if (!mastra) throw new Error("subscribeThread requires the agent to be registered with a Mastra instance.");
|
|
52498
|
+
await this.initialize(mastra);
|
|
52499
|
+
const mastraThread = await this.getOrCreateThread({
|
|
52500
|
+
externalThreadId: thread.id,
|
|
52501
|
+
channelId: thread.channelId,
|
|
52502
|
+
platform: thread.adapter.name,
|
|
52503
|
+
resourceId,
|
|
52504
|
+
threadId: threadId ? () => threadId : void 0,
|
|
52505
|
+
mastra
|
|
52506
|
+
});
|
|
52507
|
+
await this.stateAdapter.subscribe(thread.id);
|
|
52508
|
+
return mastraThread;
|
|
52509
|
+
}
|
|
52510
|
+
/**
|
|
52403
52511
|
* Resolves an existing Mastra thread for the given external IDs, or creates one.
|
|
52404
52512
|
*/
|
|
52405
52513
|
async getOrCreateThread({ externalThreadId, channelId, platform, resourceId, threadId, onCreate, mastra }) {
|
|
@@ -67187,7 +67295,7 @@ var MastraLLMVNext = class extends MastraBase {
|
|
|
67187
67295
|
content: messages
|
|
67188
67296
|
}];
|
|
67189
67297
|
}
|
|
67190
|
-
stream({ resumeContext, runId, stopWhen, maxSteps, tools = {}, modelSettings, toolChoice = "auto", threadId, resourceId, structuredOutput, options, inputProcessors, llmRequestInputProcessors, outputProcessors, errorProcessors, hasConfiguredErrorProcessors, returnScorerData, providerOptions, messageList, requireToolApproval, toolCallConcurrency, eagerToolExecution, streamPublisher, _internal, onTracingTripwire, onTracingTerminalError, tracingScope = createRunScope(), agentId, agentVersionId, resolvedScopes, agentName, toolCallId, requestContext, actor, mcp, methodType, includeRawChunks, experimentalTransform, hideSignals, autoResumeSuspendedTools, maxProcessorRetries, processorStates, activeTools, isTaskComplete, goal, onIterationComplete, workspace, agentRunSpan, agent, ...rest }) {
|
|
67298
|
+
stream({ resumeContext, runId, stopWhen, maxSteps, tools = {}, modelSettings, toolChoice = "auto", threadId, resourceId, structuredOutput, options, inputProcessors, llmRequestInputProcessors, outputProcessors, errorProcessors, hasConfiguredErrorProcessors, returnScorerData, providerOptions, messageList, requireToolApproval, toolCallConcurrency, eagerToolExecution, streamPublisher, _internal, onTracingTripwire, onTracingTerminalError, tracingScope = createRunScope(), agentId, agentVersionId, resolvedScopes, agentName, toolCallId, requestContext, actor, mcp, methodType, includeRawChunks, experimentalTransform, hideSignals, autoResumeSuspendedTools, maxProcessorRetries, processorStates, activeTools, isTaskComplete, goal, onIterationComplete, workspace, agentRunSpan, agent, resultType, ...rest }) {
|
|
67191
67299
|
const observabilityContext = resolveObservabilityContext(rest);
|
|
67192
67300
|
let stopWhenToUse;
|
|
67193
67301
|
if (maxSteps && typeof maxSteps === "number") {
|
|
@@ -67213,7 +67321,8 @@ var MastraLLMVNext = class extends MastraBase {
|
|
|
67213
67321
|
provider: firstModel.provider,
|
|
67214
67322
|
streaming: true,
|
|
67215
67323
|
parameters: modelSettings,
|
|
67216
|
-
...toolDefinitions ? { tools: toolDefinitions } : {}
|
|
67324
|
+
...toolDefinitions ? { tools: toolDefinitions } : {},
|
|
67325
|
+
...resultType ? { resultType } : {}
|
|
67217
67326
|
},
|
|
67218
67327
|
metadata: {
|
|
67219
67328
|
runId,
|
|
@@ -73565,8 +73674,9 @@ function releaseRunMessageRefs(runId) {
|
|
|
73565
73674
|
/**
|
|
73566
73675
|
* A `SaveQueueManager` `onSaved` callback that records the rows a run saved,
|
|
73567
73676
|
* so its persisted transcript references them instead of repeating them. Only
|
|
73568
|
-
* runs that store refs hold an entry (the
|
|
73569
|
-
* for other runs, or landing after the
|
|
73677
|
+
* runs that store refs hold an entry (created before the run saves its input,
|
|
73678
|
+
* else by the transcript store), so saves for other runs, or landing after the
|
|
73679
|
+
* run released its entry, are not kept.
|
|
73570
73680
|
*/
|
|
73571
73681
|
function recordRunSavedMessages(runId) {
|
|
73572
73682
|
return (rows) => {
|
|
@@ -76385,6 +76495,15 @@ function buildMessagesFromChunks({ chunks, messageId, responseModelMetadata, too
|
|
|
76385
76495
|
});
|
|
76386
76496
|
break;
|
|
76387
76497
|
}
|
|
76498
|
+
case "custom": {
|
|
76499
|
+
const p = chunk.payload;
|
|
76500
|
+
parts.push({
|
|
76501
|
+
type: "custom",
|
|
76502
|
+
kind: p.kind,
|
|
76503
|
+
...p.providerMetadata ? { providerMetadata: p.providerMetadata } : {}
|
|
76504
|
+
});
|
|
76505
|
+
break;
|
|
76506
|
+
}
|
|
76388
76507
|
case "tool-call": {
|
|
76389
76508
|
const p = chunk.payload;
|
|
76390
76509
|
const toolDef = tools?.[p.toolName] || findProviderToolByName(tools, p.toolName);
|
|
@@ -83719,15 +83838,21 @@ async function persistDurableRunInput(runId, workflowInput, mastra, beforeSave)
|
|
|
83719
83838
|
await beforeSave();
|
|
83720
83839
|
}
|
|
83721
83840
|
const inputCopy = entry.messageList.clone();
|
|
83722
|
-
|
|
83723
|
-
|
|
83724
|
-
|
|
83725
|
-
|
|
83726
|
-
|
|
83727
|
-
|
|
83728
|
-
|
|
83729
|
-
|
|
83730
|
-
|
|
83841
|
+
if (state.fixedMemory) getRunMessageRefs(runId);
|
|
83842
|
+
try {
|
|
83843
|
+
await entry.saveQueueManager.flushMessages(inputCopy, state.threadId, state.memoryConfig, {
|
|
83844
|
+
throwOnError: true,
|
|
83845
|
+
beforePersist: () => assertExecutionOwned({
|
|
83846
|
+
runId,
|
|
83847
|
+
agentId: workflowInput.agentId,
|
|
83848
|
+
mastra,
|
|
83849
|
+
requestContext
|
|
83850
|
+
})
|
|
83851
|
+
});
|
|
83852
|
+
} catch (error) {
|
|
83853
|
+
if (state.fixedMemory) releaseRunMessageRefs(runId);
|
|
83854
|
+
throw error;
|
|
83855
|
+
}
|
|
83731
83856
|
const embedded = entry.messageList.getEmbeddedMessages();
|
|
83732
83857
|
for (const [messageId, textHash] of inputCopy.getEmbeddedMessages()) embedded.set(messageId, textHash);
|
|
83733
83858
|
}
|
|
@@ -84054,7 +84179,7 @@ async function prepareForDurableExecution(options) {
|
|
|
84054
84179
|
});
|
|
84055
84180
|
let tripwireData;
|
|
84056
84181
|
if (inputProcessors.length > 0) try {
|
|
84057
|
-
const { ProcessorRunner } = await import("./stream-
|
|
84182
|
+
const { ProcessorRunner } = await import("./stream-DUUfwH38.js").then((n) => n.I);
|
|
84058
84183
|
await new ProcessorRunner({
|
|
84059
84184
|
inputProcessors,
|
|
84060
84185
|
outputProcessors,
|
|
@@ -88519,11 +88644,13 @@ var Agent = class Agent extends MastraBase {
|
|
|
88519
88644
|
...observabilityContext,
|
|
88520
88645
|
messageList,
|
|
88521
88646
|
agentId: this.id,
|
|
88522
|
-
agentName: this.name
|
|
88647
|
+
agentName: this.name,
|
|
88648
|
+
resultType: "title_generation"
|
|
88523
88649
|
}).text;
|
|
88524
88650
|
} else text = (await llm.__text({
|
|
88525
88651
|
requestContext,
|
|
88526
88652
|
...observabilityContext,
|
|
88653
|
+
resultType: "title_generation",
|
|
88527
88654
|
messages: [{
|
|
88528
88655
|
role: "system",
|
|
88529
88656
|
content: systemInstructions
|