@mastra/core 1.87.0-alpha.2 → 1.87.0-alpha.5
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/agent-controller.d.ts +6 -0
- package/dist/agent-controller/index.cjs +2 -2
- package/dist/agent-controller/index.js +2 -2
- package/dist/agent-controller/worker-run-binding.d.ts +15 -0
- package/dist/{agent-controller-Dc58ARqw.js → agent-controller-CDwoELRq.js} +50 -8
- package/dist/{agent-controller-v64JbuDa.cjs → agent-controller-DEB1G03O.cjs} +50 -8
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-DgiQNKh7.cjs → background-tasks-B40g_Guf.cjs} +1 -1
- package/dist/{background-tasks-E-Jjxks4.js → background-tasks-CBp2178j.js} +1 -1
- package/dist/browser/index.cjs +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/{builder-Dh175HnQ.js → builder-DTEXPju5.js} +2 -2
- package/dist/{builder-Dfp6Ckjr.cjs → builder-tuHJooMG.cjs} +2 -2
- package/dist/capabilities/302ai.json +191 -191
- package/dist/capabilities/abliteratedllm.json +39 -39
- package/dist/capabilities/abliteration-ai.json +10 -10
- package/dist/capabilities/above.json +20 -20
- package/dist/capabilities/adaption.json +15 -15
- package/dist/capabilities/adzuki.json +20 -20
- package/dist/capabilities/agentrouter.json +9 -9
- package/dist/capabilities/agnes.json +3 -3
- package/dist/capabilities/ai-router.json +6 -6
- package/dist/capabilities/aiand.json +25 -25
- package/dist/capabilities/aigrow.json +15 -15
- package/dist/capabilities/aimlapi.json +140 -143
- package/dist/capabilities/aixy.json +22 -22
- package/dist/capabilities/aki-io.json +12 -12
- package/dist/capabilities/alibaba-cn.json +98 -98
- 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 +51 -51
- package/dist/capabilities/alibaba.json +99 -65
- package/dist/capabilities/ambient.json +23 -16
- package/dist/capabilities/amd.json +7 -7
- package/dist/capabilities/anthropic.json +43 -43
- package/dist/capabilities/anyapi.json +13 -13
- package/dist/capabilities/apiko.json +2 -2
- package/dist/capabilities/arcee.json +9 -9
- package/dist/capabilities/augure.json +7 -7
- package/dist/capabilities/auriko.json +20 -20
- package/dist/capabilities/bailing.json +5 -5
- package/dist/capabilities/baseten.json +32 -32
- package/dist/capabilities/bee.json +3 -3
- package/dist/capabilities/berget.json +8 -8
- package/dist/capabilities/bothub.json +17 -17
- package/dist/capabilities/boundless.json +39 -39
- package/dist/capabilities/bumo.json +38 -38
- package/dist/capabilities/byteplus.json +32 -32
- package/dist/capabilities/cerebras.json +4 -4
- package/dist/capabilities/cheapaimodel.json +10 -10
- package/dist/capabilities/cheapest-token.json +30 -30
- package/dist/capabilities/chutes.json +10 -10
- package/dist/capabilities/clarifai.json +2 -2
- package/dist/capabilities/cline-pass.json +36 -36
- package/dist/capabilities/cloudcode.json +9 -9
- package/dist/capabilities/cloudflare-workers-ai.json +19 -19
- package/dist/capabilities/commandcode.json +145 -145
- package/dist/capabilities/concentrate.json +278 -295
- package/dist/capabilities/cortecs.json +109 -109
- package/dist/capabilities/crossmodel.json +200 -200
- package/dist/capabilities/crusoe.json +10 -10
- package/dist/capabilities/daoxe.json +6 -6
- package/dist/capabilities/databricks.json +124 -124
- package/dist/capabilities/deepinfra.json +98 -89
- package/dist/capabilities/deepseek.json +4 -4
- package/dist/capabilities/digitalocean.json +113 -113
- package/dist/capabilities/dothoosh.json +27 -27
- package/dist/capabilities/doubleword.json +23 -23
- package/dist/capabilities/edenai.json +283 -292
- package/dist/capabilities/empiriolabs.json +159 -159
- package/dist/capabilities/engy.json +23 -23
- package/dist/capabilities/entrim.json +2 -2
- package/dist/capabilities/evroc.json +16 -16
- package/dist/capabilities/ezkielyna.json +10 -10
- package/dist/capabilities/fastrouter.json +82 -82
- package/dist/capabilities/fireworks-ai.json +126 -65
- package/dist/capabilities/freemodel.json +15 -15
- package/dist/capabilities/friendli.json +8 -8
- package/dist/capabilities/frogbot.json +95 -95
- package/dist/capabilities/gisoo.json +15 -15
- package/dist/capabilities/gmicloud.json +13 -13
- package/dist/capabilities/google.json +54 -54
- package/dist/capabilities/graphn.json +16 -16
- package/dist/capabilities/greenpt.json +35 -35
- package/dist/capabilities/groq.json +9 -9
- package/dist/capabilities/helicone.json +84 -84
- package/dist/capabilities/hopper.json +2 -2
- package/dist/capabilities/hostinger-router.json +11 -11
- package/dist/capabilities/hpc-ai.json +7 -7
- package/dist/capabilities/huawei-maas.json +15 -15
- package/dist/capabilities/hubris.json +32 -32
- package/dist/capabilities/huggingface.json +118 -78
- package/dist/capabilities/hyper.json +20 -28
- package/dist/capabilities/impossibl.json +123 -123
- package/dist/capabilities/inception.json +3 -3
- package/dist/capabilities/inceptron.json +2 -2
- package/dist/capabilities/inco.json +5 -5
- package/dist/capabilities/infer.json +16 -16
- package/dist/capabilities/inferall.json +14 -14
- package/dist/capabilities/inference-coop.json +8 -8
- package/dist/capabilities/inferenceapis.json +15 -15
- package/dist/capabilities/inferris.json +2 -2
- package/dist/capabilities/infersia.json +9 -9
- 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/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +54 -54
- package/dist/capabilities/jalapeno.json +11 -11
- package/dist/capabilities/jiekou.json +63 -63
- package/dist/capabilities/jzstoken.json +50 -50
- package/dist/capabilities/keln.json +18 -18
- package/dist/capabilities/kenari.json +118 -126
- package/dist/capabilities/kilo.json +632 -638
- package/dist/capabilities/kimi-code-plan-cn.json +5 -5
- package/dist/capabilities/kimi-code-plan-global.json +5 -5
- package/dist/capabilities/klavo.json +20 -20
- package/dist/capabilities/korouter.json +34 -34
- package/dist/capabilities/kunavo.json +10 -10
- package/dist/capabilities/liquid.json +13 -13
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +973 -917
- package/dist/capabilities/llmgateway.json +333 -333
- package/dist/capabilities/llmtr.json +29 -29
- package/dist/capabilities/logits.json +2 -2
- package/dist/capabilities/lowrouter.json +54 -54
- package/dist/capabilities/lyceum.json +14 -14
- package/dist/capabilities/melious.json +15 -15
- package/dist/capabilities/merge-gateway.json +244 -244
- package/dist/capabilities/meta.json +8 -8
- 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 +17 -17
- package/dist/capabilities/mixlayer.json +2 -2
- package/dist/capabilities/modal.json +10 -10
- package/dist/capabilities/model-oracle-ai.json +25 -25
- package/dist/capabilities/modelis.json +24 -24
- package/dist/capabilities/modelscope.json +2 -2
- package/dist/capabilities/modular.json +9 -9
- package/dist/capabilities/moneo.json +14 -14
- package/dist/capabilities/moonshotai-cn.json +7 -7
- package/dist/capabilities/moonshotai.json +7 -7
- package/dist/capabilities/morph.json +13 -13
- package/dist/capabilities/munito-eu.json +8 -8
- package/dist/capabilities/munito.json +8 -8
- package/dist/capabilities/nan.json +25 -25
- package/dist/capabilities/nano-gpt.json +573 -554
- package/dist/capabilities/nearai.json +89 -89
- package/dist/capabilities/nebius.json +30 -30
- package/dist/capabilities/neon.json +128 -128
- package/dist/capabilities/neuralwatt.json +41 -41
- package/dist/capabilities/novita-ai.json +171 -171
- package/dist/capabilities/nvidia.json +40 -40
- package/dist/capabilities/oathbreaker.json +2 -2
- package/dist/capabilities/obscurify.json +21 -21
- package/dist/capabilities/oci.json +10 -10
- package/dist/capabilities/ofox.json +375 -375
- package/dist/capabilities/ollama-cloud.json +51 -51
- package/dist/capabilities/openai.json +53 -53
- package/dist/capabilities/opencode-go.json +86 -86
- package/dist/capabilities/openreason.json +5 -5
- package/dist/capabilities/openrouter.json +557 -546
- package/dist/capabilities/opper.json +29 -29
- package/dist/capabilities/orcarouter.json +254 -254
- package/dist/capabilities/outerlabs.json +29 -29
- package/dist/capabilities/ovhcloud.json +23 -23
- package/dist/capabilities/pendra.json +4 -4
- package/dist/capabilities/perplexity-agent.json +55 -55
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +34 -34
- package/dist/capabilities/pioneer.json +30 -30
- package/dist/capabilities/poe.json +126 -126
- package/dist/capabilities/powerspring.json +11 -11
- package/dist/capabilities/primalabs.json +10 -10
- package/dist/capabilities/prime.json +120 -119
- package/dist/capabilities/privatemode-ai.json +10 -10
- package/dist/capabilities/proxystacks.json +7 -7
- package/dist/capabilities/qiniu-ai.json +14 -14
- package/dist/capabilities/refuseless.json +9 -9
- package/dist/capabilities/regolo-ai.json +5 -5
- package/dist/capabilities/requesty.json +167 -190
- package/dist/capabilities/ruapi.json +17 -17
- package/dist/capabilities/runcrate.json +9 -9
- package/dist/capabilities/runinfra.json +10 -10
- package/dist/capabilities/sakana.json +6 -6
- package/dist/capabilities/sambanova.json +8 -8
- package/dist/capabilities/sandbase.json +21 -21
- package/dist/capabilities/sarvam.json +5 -5
- package/dist/capabilities/scaleway.json +18 -18
- package/dist/capabilities/scnet-token-plan.json +10 -10
- package/dist/capabilities/scx-ai.json +32 -32
- package/dist/capabilities/sensenova.json +14 -14
- package/dist/capabilities/siliconflow-cn.json +44 -44
- package/dist/capabilities/siliconflow.json +53 -53
- package/dist/capabilities/snowflake-cortex.json +22 -22
- package/dist/capabilities/sokkan.json +9 -9
- package/dist/capabilities/sparrowcodes.json +19 -19
- package/dist/capabilities/standardcompute.json +90 -90
- package/dist/capabilities/steadyrouter.json +42 -42
- package/dist/capabilities/stepfun-ai-step-plan.json +2 -2
- package/dist/capabilities/stepfun-ai.json +2 -2
- package/dist/capabilities/stepfun-step-plan.json +2 -2
- package/dist/capabilities/stepfun.json +2 -2
- package/dist/capabilities/stepping-stone.json +19 -19
- package/dist/capabilities/synthetic.json +10 -10
- package/dist/capabilities/synthorai.json +24 -24
- package/dist/capabilities/teamorouter.json +23 -23
- package/dist/capabilities/teapot-router.json +12 -12
- package/dist/capabilities/tencent-token-plan-intl.json +126 -0
- package/dist/capabilities/tencent-token-plan.json +39 -39
- package/dist/capabilities/tencent-tokenhub.json +56 -41
- package/dist/capabilities/tensorx.json +50 -50
- package/dist/capabilities/tenstorrent.json +6 -6
- package/dist/capabilities/the-grid-ai.json +33 -33
- package/dist/capabilities/thinkingmachines.json +77 -77
- package/dist/capabilities/tinfoil.json +12 -12
- package/dist/capabilities/toapis.json +2 -2
- package/dist/capabilities/togetherai.json +41 -41
- package/dist/capabilities/tokengo.json +22 -22
- package/dist/capabilities/tokenify.json +3 -3
- package/dist/capabilities/trustedrouter.json +7 -7
- package/dist/capabilities/trustedtokens.json +17 -17
- package/dist/capabilities/umans-ai-coding-plan.json +11 -11
- package/dist/capabilities/umans-ai.json +8 -8
- package/dist/capabilities/uncensuredai.json +5 -5
- package/dist/capabilities/unrestricted.json +4 -4
- package/dist/capabilities/uplinkswitch.json +21 -21
- package/dist/capabilities/upstage.json +6 -6
- package/dist/capabilities/vancine.json +24 -24
- package/dist/capabilities/vercel.json +582 -582
- package/dist/capabilities/vivgrid.json +86 -86
- package/dist/capabilities/volcengine-coding-plan.json +29 -29
- package/dist/capabilities/volcengine.json +23 -23
- package/dist/capabilities/vultr.json +27 -27
- package/dist/capabilities/wafer.ai.json +18 -18
- package/dist/capabilities/wallaby.json +2 -2
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +21 -21
- package/dist/capabilities/watt.json +20 -20
- 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 +2 -2
- package/dist/capabilities/xpersona.json +10 -10
- package/dist/capabilities/xxapi.json +28 -28
- package/dist/capabilities/zai-coding-plan.json +18 -18
- package/dist/capabilities/zai.json +27 -27
- package/dist/capabilities/zenifra.json +26 -26
- package/dist/capabilities/zenmux.json +200 -200
- package/dist/capabilities/zerogpu.json +13 -13
- package/dist/capabilities/zhipuai-coding-plan.json +8 -8
- package/dist/capabilities/zhipuai.json +26 -26
- package/dist/capabilities/zro.json +7 -7
- 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-0AO7PMJF.js → channels-CC2Z4adP.js} +1 -1
- package/dist/{channels-BZL9RT2i.cjs → channels-Drxs9g13.cjs} +1 -1
- package/dist/coding-agent/index.cjs +2 -2
- package/dist/coding-agent/index.js +2 -2
- package/dist/{constants-B9ZDvXZ4.cjs → constants-Bou0hEgY.cjs} +4 -0
- package/dist/{constants-BmdTvEYN.js → constants-CFWgIaqA.js} +4 -0
- package/dist/datasets/experiment/scorer.d.ts +16 -5
- 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 +1032 -1032
- 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-knowledge-knowledge-tools.md +3 -3
- 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 +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/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 +51 -16
- package/dist/knowledge/index.js +51 -16
- package/dist/knowledge/page-tools.d.ts +9 -0
- package/dist/knowledge/scope-runtime.d.ts +6 -0
- 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 +7932 -7894
- package/dist/{llm-B4AeSFvV.cjs → llm-CbpBEabY.cjs} +38 -78
- package/dist/{llm-B46V7Mi7.js → llm-D3y8qOKL.js} +38 -78
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/{manager-BwDxA1Nn.cjs → manager-BOn6RJwA.cjs} +106 -35
- package/dist/{manager-BRAvwB9b.js → manager-elIuArZa.js} +106 -35
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-DBhdD172.cjs → mastra-CDQJWY6v.cjs} +16 -16
- package/dist/{mastra-CIx6qEq2.js → mastra-DQjco6Bt.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-CJMsDU8w.js → model-BjyU1L4I.js} +4 -3
- package/dist/{model-CYhAa5qO.cjs → model-C4aI7k-i.cjs} +4 -3
- package/dist/{netlify-Bw7Vd58y.cjs → netlify-BjuUEMrL.cjs} +41364 -30461
- package/dist/{netlify-C9aJA6Cv.js → netlify-BpB7PtZV.js} +41361 -30464
- 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-DOfYSEju.js → provider-registry-BjdxtGZZ.js} +22658 -22514
- package/dist/{provider-registry-Bn_7VvZ8.cjs → provider-registry-bkFdaY45.cjs} +22657 -22513
- package/dist/provider-registry.json +22617 -22527
- package/dist/{registry-generator-BnK5Npgr.cjs → registry-generator-BORKO0_T.cjs} +1 -1
- package/dist/{registry-generator-Cw594Ttt.js → registry-generator-CPF318Kc.js} +1 -1
- package/dist/{rehydrate-BWnd_TEx.cjs → rehydrate-Cps4MTph.cjs} +2 -2
- package/dist/{rehydrate-Dgqkw7Py.js → rehydrate-Cw2Id-Uz.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-lLRc7EE6.cjs → run-registry-BTFPEkXT.cjs} +368 -92
- package/dist/{run-registry-DhOKJtlb.js → run-registry-D5z2YVqJ.js} +356 -92
- package/dist/storage/constants.cjs +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/knowledge/base.d.ts +16 -1
- package/dist/storage/domains/knowledge/importers-inmemory.d.ts +1 -0
- package/dist/storage/domains/knowledge/importers.d.ts +8 -0
- package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
- package/dist/storage/domains/knowledge/pages-inmemory.d.ts +5 -1
- package/dist/storage/index.cjs +3 -3
- package/dist/storage/index.js +3 -3
- package/dist/storage/types.d.ts +8 -0
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-BIDts1fZ.cjs → stream-D1OnBHDi.cjs} +3 -3
- package/dist/{stream-C8HKG3qC.js → stream-DB5efioT.js} +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-DkhFVx0h.js} +4 -4
- package/dist/{tool-loop-agent-PEY5a1R6.cjs → tool-loop-agent-Ote8gJMn.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-BTKpGHA6.js} +1 -1
- package/dist/{utils-CxMSu_wc.cjs → utils-Dl_UFejV.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-Dn750ciE.js → validate-D6fUqYGz.js} +1 -1
- package/dist/{validate-RVKgazCf.cjs → validate-DdDuQRoZ.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-B27B9RlK.cjs} +2 -2
- package/dist/{worker-SDi9jbP5.js → worker-Bo_hTQJC.js} +2 -2
- package/dist/{worker-DJPAdazC.js → worker-DC269pGx.js} +2 -2
- package/dist/{worker-CFPu9qwV.cjs → worker-mq-oiLa5.cjs} +2 -2
- package/dist/{workflow-ZFOz_365.cjs → workflow-D61dV4AC.cjs} +3 -3
- package/dist/{workflow-DkBqNn7X.js → workflow-D97r3h2-.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/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 +9 -9
- package/src/llm/model/provider-types.generated.d.ts +7932 -7894
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BrhgMLW6.cjs");
|
|
2
|
-
const require_netlify = require("./netlify-
|
|
2
|
+
const require_netlify = require("./netlify-BjuUEMrL.cjs");
|
|
3
3
|
const require_model = require("./model-jBymoqGa.cjs");
|
|
4
|
-
const require_to_prompt = require("./to-prompt-
|
|
4
|
+
const require_to_prompt = require("./to-prompt-CG-LyaBY.cjs");
|
|
5
5
|
const require_content = require("./content-CC0W1d5p.cjs");
|
|
6
|
-
const require_provider_registry = require("./provider-registry-
|
|
6
|
+
const require_provider_registry = require("./provider-registry-bkFdaY45.cjs");
|
|
7
7
|
const require_error = require("./error-D90lJ6M7.cjs");
|
|
8
8
|
const require_request_context = require("./request-context-D9RXYCy8.cjs");
|
|
9
9
|
const require_dynamic_argument = require("./dynamic-argument-CUc1BBOS.cjs");
|
|
@@ -8640,54 +8640,6 @@ var GatewayManager = class GatewayManager {
|
|
|
8640
8640
|
return providerId === gatewayId ? gatewayId : `${gatewayId}/${providerId}`;
|
|
8641
8641
|
}
|
|
8642
8642
|
};
|
|
8643
|
-
// src/llm/model/mastra-gateway-provider-tools.ts
|
|
8644
|
-
const OPENROUTER_WEB_SEARCH_TOOL_ID = "openrouter.web_search";
|
|
8645
|
-
const NATIVE_WEB_SEARCH_TOOL_IDS = {
|
|
8646
|
-
"openai.web_search": true,
|
|
8647
|
-
"anthropic.web_search_20250305": true,
|
|
8648
|
-
"google.google_search": true,
|
|
8649
|
-
"xai.web_search": true
|
|
8650
|
-
};
|
|
8651
|
-
/** True for the gateway's OpenRouter chat models, false for its native Anthropic OAuth models. */
|
|
8652
|
-
function isOpenRouterModel(model) {
|
|
8653
|
-
return typeof model.provider === "string" && (model.provider === "openrouter" || model.provider.startsWith("openrouter."));
|
|
8654
|
-
}
|
|
8655
|
-
/**
|
|
8656
|
-
* The Mastra gateway's chat endpoint only runs `openrouter:*` server tools. Another provider's
|
|
8657
|
-
* native tool is rejected with a 400 (OpenAI, xAI models) or dropped without an error (Anthropic,
|
|
8658
|
-
* Google models), so the model silently loses the tool.
|
|
8659
|
-
*
|
|
8660
|
-
* A native web search tool with no arguments is swapped for the gateway's web search, which works
|
|
8661
|
-
* for every tool-calling model. Any other native tool fails here with an actionable message.
|
|
8662
|
-
*/
|
|
8663
|
-
function prepareToolsForMastraGateway(options, routerId) {
|
|
8664
|
-
const isProviderTool = (tool) => tool.type === "provider-defined" || tool.type === "provider";
|
|
8665
|
-
if (!options.tools?.some(isProviderTool)) return options;
|
|
8666
|
-
const tools = options.tools.map((tool) => {
|
|
8667
|
-
if (!isProviderTool(tool)) return tool;
|
|
8668
|
-
const { id, args } = tool;
|
|
8669
|
-
if (id.startsWith("openrouter.")) return tool;
|
|
8670
|
-
const isWebSearch = id in NATIVE_WEB_SEARCH_TOOL_IDS;
|
|
8671
|
-
if (isWebSearch && Object.keys(args ?? {}).length === 0) return {
|
|
8672
|
-
...tool,
|
|
8673
|
-
id: OPENROUTER_WEB_SEARCH_TOOL_ID
|
|
8674
|
-
};
|
|
8675
|
-
throw new require_error.MastraError({
|
|
8676
|
-
id: "MASTRA_GATEWAY_UNSUPPORTED_PROVIDER_TOOL",
|
|
8677
|
-
domain: require_error.ErrorDomain.LLM,
|
|
8678
|
-
category: require_error.ErrorCategory.USER,
|
|
8679
|
-
details: {
|
|
8680
|
-
toolId: id,
|
|
8681
|
-
model: routerId
|
|
8682
|
-
},
|
|
8683
|
-
text: `The provider tool "${id}" cannot be used with "${routerId}". The Mastra gateway only runs its own server tools. ` + (isWebSearch ? `Its web search does not accept "${id}" options: use webSearchTool from @mastra/core/tools, or call the provider directly to keep them.` : `Call the provider directly to use this tool.`)
|
|
8684
|
-
});
|
|
8685
|
-
});
|
|
8686
|
-
return {
|
|
8687
|
-
...options,
|
|
8688
|
-
tools
|
|
8689
|
-
};
|
|
8690
|
-
}
|
|
8691
8643
|
// src/llm/model/router.ts
|
|
8692
8644
|
/**
|
|
8693
8645
|
* Type guard to check if a model is a LanguageModelV4 (AI SDK v7)
|
|
@@ -8974,14 +8926,13 @@ var ModelRouterLanguageModel = class ModelRouterLanguageModel {
|
|
|
8974
8926
|
controller.close();
|
|
8975
8927
|
} }) };
|
|
8976
8928
|
}
|
|
8977
|
-
|
|
8929
|
+
const sanitizedOptions = this.stripUnsupportedSamplingParams(options);
|
|
8978
8930
|
const model = await this.resolveLanguageModel({
|
|
8979
8931
|
apiKey: auth.apiKey ?? "",
|
|
8980
8932
|
auth,
|
|
8981
8933
|
headers: mergeHeaders(this.config.headers, auth.headers),
|
|
8982
8934
|
...resolved
|
|
8983
8935
|
});
|
|
8984
|
-
if (this.gatewayId === "mastra" && isOpenRouterModel(model)) sanitizedOptions = prepareToolsForMastraGateway(sanitizedOptions, this.config.routerId);
|
|
8985
8936
|
if (isLanguageModelV4(model)) return new AISDKV7LanguageModel(model).doGenerate(sanitizedOptions);
|
|
8986
8937
|
if (isLanguageModelV3(model)) return new AISDKV6LanguageModel(model).doGenerate(sanitizedOptions);
|
|
8987
8938
|
return new require_model.AISDKV5LanguageModel(model).doGenerate(sanitizedOptions);
|
|
@@ -9000,7 +8951,7 @@ var ModelRouterLanguageModel = class ModelRouterLanguageModel {
|
|
|
9000
8951
|
controller.close();
|
|
9001
8952
|
} }) };
|
|
9002
8953
|
}
|
|
9003
|
-
|
|
8954
|
+
const sanitizedOptions = this.stripUnsupportedSamplingParams(options);
|
|
9004
8955
|
const { transport, websocket } = getOpenAITransport(sanitizedOptions.providerOptions, resolved.providerId);
|
|
9005
8956
|
const resolvedTransport = (transport === "auto" ? "websocket" : transport) === "websocket" && !this.config.url && (this.gatewayId === "models.dev" && OPENAI_WS_ALLOWLIST.has(this.provider) || this.gatewayId === "azure-openai") ? "websocket" : "fetch";
|
|
9006
8957
|
const model = await this.resolveLanguageModel({
|
|
@@ -9011,7 +8962,6 @@ var ModelRouterLanguageModel = class ModelRouterLanguageModel {
|
|
|
9011
8962
|
responsesWebSocket: websocket,
|
|
9012
8963
|
...resolved
|
|
9013
8964
|
});
|
|
9014
|
-
if (this.gatewayId === "mastra" && isOpenRouterModel(model)) sanitizedOptions = prepareToolsForMastraGateway(sanitizedOptions, this.config.routerId);
|
|
9015
8965
|
const streamTransport = this.#lastStreamTransport;
|
|
9016
8966
|
if (isLanguageModelV4(model)) {
|
|
9017
8967
|
const streamResult = await new AISDKV7LanguageModel(model).doStream(sanitizedOptions);
|
|
@@ -9070,7 +9020,7 @@ var ModelRouterLanguageModel = class ModelRouterLanguageModel {
|
|
|
9070
9020
|
return cache.modelInstances.get(key);
|
|
9071
9021
|
}
|
|
9072
9022
|
if (this.config.url) {
|
|
9073
|
-
const modelInstance = this.config.api === "responses" ? require_netlify.createOpenAI({
|
|
9023
|
+
const modelInstance = this.config.api === "responses" ? require_netlify.createOpenAI$1({
|
|
9074
9024
|
apiKey,
|
|
9075
9025
|
baseURL: this.config.url,
|
|
9076
9026
|
headers
|
|
@@ -9133,7 +9083,7 @@ var ModelRouterLanguageModel = class ModelRouterLanguageModel {
|
|
|
9133
9083
|
headers: responsesWebSocket?.headers
|
|
9134
9084
|
});
|
|
9135
9085
|
return {
|
|
9136
|
-
modelInstance: require_netlify.createOpenAI({
|
|
9086
|
+
modelInstance: require_netlify.createOpenAI$1({
|
|
9137
9087
|
apiKey,
|
|
9138
9088
|
baseURL,
|
|
9139
9089
|
headers,
|
|
@@ -9316,6 +9266,27 @@ async function resolveModelAuth({ gateway, request, explicit }) {
|
|
|
9316
9266
|
}
|
|
9317
9267
|
// src/llm/model/embedding-router.ts
|
|
9318
9268
|
const MASTRA_GATEWAY_ID = "mastra";
|
|
9269
|
+
/**
|
|
9270
|
+
* Embedding-specific default base URLs for providers whose generated registry
|
|
9271
|
+
* entry carries an API key variable but no URL. Registry and environment URLs
|
|
9272
|
+
* stay authoritative; these only fill the gap.
|
|
9273
|
+
*/
|
|
9274
|
+
const DEFAULT_EMBEDDING_PROVIDER_URLS = { deepinfra: "https://api.deepinfra.com/v1/openai" };
|
|
9275
|
+
/**
|
|
9276
|
+
* Parse a non-gateway `provider/model` identifier. The provider is the first
|
|
9277
|
+
* segment and the model is everything after the first `/`, so namespaced model
|
|
9278
|
+
* ids like `deepinfra/Qwen/Qwen3-Embedding-8B` resolve to provider
|
|
9279
|
+
* `deepinfra` and model `Qwen/Qwen3-Embedding-8B`. Empty provider and model
|
|
9280
|
+
* segments are rejected.
|
|
9281
|
+
*/
|
|
9282
|
+
function parseEmbeddingModelId(modelId) {
|
|
9283
|
+
const separatorIndex = modelId.indexOf("/");
|
|
9284
|
+
if (separatorIndex <= 0 || separatorIndex === modelId.length - 1) throw new Error(`Invalid model string format: "${modelId}". Expected format: "provider/model"`);
|
|
9285
|
+
return {
|
|
9286
|
+
providerId: modelId.slice(0, separatorIndex),
|
|
9287
|
+
modelId: modelId.slice(separatorIndex + 1)
|
|
9288
|
+
};
|
|
9289
|
+
}
|
|
9319
9290
|
function trimTrailingSlashes(value) {
|
|
9320
9291
|
let end = value.length;
|
|
9321
9292
|
while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
|
|
@@ -9386,14 +9357,7 @@ var ModelRouterEmbeddingModel = class {
|
|
|
9386
9357
|
providerId: MASTRA_GATEWAY_ID,
|
|
9387
9358
|
modelId: parts.slice(1).join("/")
|
|
9388
9359
|
};
|
|
9389
|
-
} else
|
|
9390
|
-
if (parts.length !== 2) throw new Error(`Invalid model string format: "${config}". Expected format: "provider/model"`);
|
|
9391
|
-
const [providerId, modelId] = parts;
|
|
9392
|
-
normalizedConfig = {
|
|
9393
|
-
providerId,
|
|
9394
|
-
modelId
|
|
9395
|
-
};
|
|
9396
|
-
}
|
|
9360
|
+
} else normalizedConfig = parseEmbeddingModelId(config);
|
|
9397
9361
|
} else if ("providerId" in config && "modelId" in config) normalizedConfig = {
|
|
9398
9362
|
providerId: config.providerId,
|
|
9399
9363
|
modelId: config.modelId,
|
|
@@ -9412,17 +9376,12 @@ var ModelRouterEmbeddingModel = class {
|
|
|
9412
9376
|
apiKey: config.apiKey,
|
|
9413
9377
|
headers: config.headers
|
|
9414
9378
|
};
|
|
9415
|
-
} else {
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
url: config.url,
|
|
9422
|
-
apiKey: config.apiKey,
|
|
9423
|
-
headers: config.headers
|
|
9424
|
-
};
|
|
9425
|
-
}
|
|
9379
|
+
} else normalizedConfig = {
|
|
9380
|
+
...parseEmbeddingModelId(config.id),
|
|
9381
|
+
url: config.url,
|
|
9382
|
+
apiKey: config.apiKey,
|
|
9383
|
+
headers: config.headers
|
|
9384
|
+
};
|
|
9426
9385
|
}
|
|
9427
9386
|
this.provider = normalizedConfig.providerId;
|
|
9428
9387
|
this.modelId = normalizedConfig.modelId;
|
|
@@ -9465,11 +9424,12 @@ var ModelRouterEmbeddingModel = class {
|
|
|
9465
9424
|
if (normalizedConfig.providerId === "openai") this.providerModel = require_netlify.createOpenAI({ apiKey }).embeddingModel(normalizedConfig.modelId);
|
|
9466
9425
|
else if (normalizedConfig.providerId === "google") this.providerModel = require_netlify.createGoogleGenerativeAI({ apiKey }).embeddingModel(normalizedConfig.modelId);
|
|
9467
9426
|
else {
|
|
9468
|
-
|
|
9427
|
+
const providerUrl = providerConfig.url ?? DEFAULT_EMBEDDING_PROVIDER_URLS[normalizedConfig.providerId];
|
|
9428
|
+
if (!providerUrl) throw new Error(`Provider ${normalizedConfig.providerId} does not have a URL configured`);
|
|
9469
9429
|
this.providerModel = require_netlify.createOpenAICompatible({
|
|
9470
9430
|
name: normalizedConfig.providerId,
|
|
9471
9431
|
apiKey,
|
|
9472
|
-
baseURL: require_netlify.interpolateUrlTemplate(
|
|
9432
|
+
baseURL: require_netlify.interpolateUrlTemplate(providerUrl)
|
|
9473
9433
|
}).embeddingModel(normalizedConfig.modelId);
|
|
9474
9434
|
}
|
|
9475
9435
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as EventSourceParserStream, a as interpolateUrlTemplate, b as createOpenAI, c as createGoogleGenerativeAI, g as shouldEnableGateway, h as hasAuthCredentials, m as getGatewayId, o as parseModelRouterId, p as findGatewayForModel, r as ModelsDevGateway, s as createOpenAI$1, t as NetlifyGateway, u as MASTRA_USER_AGENT, v as MASTRA_GATEWAY_STREAM_TRANSPORT, x as createOpenAICompatible, y as MastraModelGateway } from "./netlify-BpB7PtZV.js";
|
|
2
2
|
import { n as prepareAzureStrictToolSchemas, r as createStreamFromGenerateResult, t as AISDKV5LanguageModel } from "./model-DS-b2R-R.js";
|
|
3
|
-
import { i as aiV5PromptToAIV7Prompt, r as aiV5PromptToAIV6Prompt } from "./to-prompt-
|
|
3
|
+
import { i as aiV5PromptToAIV7Prompt, r as aiV5PromptToAIV6Prompt } from "./to-prompt-CMlVGYxC.js";
|
|
4
4
|
import { t as convertToDataContent } from "./content-CFBIylxS.js";
|
|
5
|
-
import { f as MastraGateway, l as modelSupportsTemperature, n as PROVIDER_REGISTRY, p as gatewayServesObservationalMemory, t as GatewayRegistry } from "./provider-registry-
|
|
6
|
-
import { i as MastraError
|
|
5
|
+
import { f as MastraGateway, l as modelSupportsTemperature, n as PROVIDER_REGISTRY, p as gatewayServesObservationalMemory, t as GatewayRegistry } from "./provider-registry-BjdxtGZZ.js";
|
|
6
|
+
import { i as MastraError } from "./error-oh2DLsP2.js";
|
|
7
7
|
import { u as RequestContext } from "./request-context-COnZHt2-.js";
|
|
8
8
|
import { n as resolveDynamicArgument } from "./dynamic-argument-BzPK3qPN.js";
|
|
9
9
|
import { t as InMemoryServerCache } from "./inmemory-BK3zLwvM.js";
|
|
@@ -8638,54 +8638,6 @@ var GatewayManager = class GatewayManager {
|
|
|
8638
8638
|
return providerId === gatewayId ? gatewayId : `${gatewayId}/${providerId}`;
|
|
8639
8639
|
}
|
|
8640
8640
|
};
|
|
8641
|
-
// src/llm/model/mastra-gateway-provider-tools.ts
|
|
8642
|
-
const OPENROUTER_WEB_SEARCH_TOOL_ID = "openrouter.web_search";
|
|
8643
|
-
const NATIVE_WEB_SEARCH_TOOL_IDS = {
|
|
8644
|
-
"openai.web_search": true,
|
|
8645
|
-
"anthropic.web_search_20250305": true,
|
|
8646
|
-
"google.google_search": true,
|
|
8647
|
-
"xai.web_search": true
|
|
8648
|
-
};
|
|
8649
|
-
/** True for the gateway's OpenRouter chat models, false for its native Anthropic OAuth models. */
|
|
8650
|
-
function isOpenRouterModel(model) {
|
|
8651
|
-
return typeof model.provider === "string" && (model.provider === "openrouter" || model.provider.startsWith("openrouter."));
|
|
8652
|
-
}
|
|
8653
|
-
/**
|
|
8654
|
-
* The Mastra gateway's chat endpoint only runs `openrouter:*` server tools. Another provider's
|
|
8655
|
-
* native tool is rejected with a 400 (OpenAI, xAI models) or dropped without an error (Anthropic,
|
|
8656
|
-
* Google models), so the model silently loses the tool.
|
|
8657
|
-
*
|
|
8658
|
-
* A native web search tool with no arguments is swapped for the gateway's web search, which works
|
|
8659
|
-
* for every tool-calling model. Any other native tool fails here with an actionable message.
|
|
8660
|
-
*/
|
|
8661
|
-
function prepareToolsForMastraGateway(options, routerId) {
|
|
8662
|
-
const isProviderTool = (tool) => tool.type === "provider-defined" || tool.type === "provider";
|
|
8663
|
-
if (!options.tools?.some(isProviderTool)) return options;
|
|
8664
|
-
const tools = options.tools.map((tool) => {
|
|
8665
|
-
if (!isProviderTool(tool)) return tool;
|
|
8666
|
-
const { id, args } = tool;
|
|
8667
|
-
if (id.startsWith("openrouter.")) return tool;
|
|
8668
|
-
const isWebSearch = id in NATIVE_WEB_SEARCH_TOOL_IDS;
|
|
8669
|
-
if (isWebSearch && Object.keys(args ?? {}).length === 0) return {
|
|
8670
|
-
...tool,
|
|
8671
|
-
id: OPENROUTER_WEB_SEARCH_TOOL_ID
|
|
8672
|
-
};
|
|
8673
|
-
throw new MastraError({
|
|
8674
|
-
id: "MASTRA_GATEWAY_UNSUPPORTED_PROVIDER_TOOL",
|
|
8675
|
-
domain: ErrorDomain.LLM,
|
|
8676
|
-
category: ErrorCategory.USER,
|
|
8677
|
-
details: {
|
|
8678
|
-
toolId: id,
|
|
8679
|
-
model: routerId
|
|
8680
|
-
},
|
|
8681
|
-
text: `The provider tool "${id}" cannot be used with "${routerId}". The Mastra gateway only runs its own server tools. ` + (isWebSearch ? `Its web search does not accept "${id}" options: use webSearchTool from @mastra/core/tools, or call the provider directly to keep them.` : `Call the provider directly to use this tool.`)
|
|
8682
|
-
});
|
|
8683
|
-
});
|
|
8684
|
-
return {
|
|
8685
|
-
...options,
|
|
8686
|
-
tools
|
|
8687
|
-
};
|
|
8688
|
-
}
|
|
8689
8641
|
// src/llm/model/router.ts
|
|
8690
8642
|
/**
|
|
8691
8643
|
* Type guard to check if a model is a LanguageModelV4 (AI SDK v7)
|
|
@@ -8972,14 +8924,13 @@ var ModelRouterLanguageModel = class ModelRouterLanguageModel {
|
|
|
8972
8924
|
controller.close();
|
|
8973
8925
|
} }) };
|
|
8974
8926
|
}
|
|
8975
|
-
|
|
8927
|
+
const sanitizedOptions = this.stripUnsupportedSamplingParams(options);
|
|
8976
8928
|
const model = await this.resolveLanguageModel({
|
|
8977
8929
|
apiKey: auth.apiKey ?? "",
|
|
8978
8930
|
auth,
|
|
8979
8931
|
headers: mergeHeaders(this.config.headers, auth.headers),
|
|
8980
8932
|
...resolved
|
|
8981
8933
|
});
|
|
8982
|
-
if (this.gatewayId === "mastra" && isOpenRouterModel(model)) sanitizedOptions = prepareToolsForMastraGateway(sanitizedOptions, this.config.routerId);
|
|
8983
8934
|
if (isLanguageModelV4(model)) return new AISDKV7LanguageModel(model).doGenerate(sanitizedOptions);
|
|
8984
8935
|
if (isLanguageModelV3(model)) return new AISDKV6LanguageModel(model).doGenerate(sanitizedOptions);
|
|
8985
8936
|
return new AISDKV5LanguageModel(model).doGenerate(sanitizedOptions);
|
|
@@ -8998,7 +8949,7 @@ var ModelRouterLanguageModel = class ModelRouterLanguageModel {
|
|
|
8998
8949
|
controller.close();
|
|
8999
8950
|
} }) };
|
|
9000
8951
|
}
|
|
9001
|
-
|
|
8952
|
+
const sanitizedOptions = this.stripUnsupportedSamplingParams(options);
|
|
9002
8953
|
const { transport, websocket } = getOpenAITransport(sanitizedOptions.providerOptions, resolved.providerId);
|
|
9003
8954
|
const resolvedTransport = (transport === "auto" ? "websocket" : transport) === "websocket" && !this.config.url && (this.gatewayId === "models.dev" && OPENAI_WS_ALLOWLIST.has(this.provider) || this.gatewayId === "azure-openai") ? "websocket" : "fetch";
|
|
9004
8955
|
const model = await this.resolveLanguageModel({
|
|
@@ -9009,7 +8960,6 @@ var ModelRouterLanguageModel = class ModelRouterLanguageModel {
|
|
|
9009
8960
|
responsesWebSocket: websocket,
|
|
9010
8961
|
...resolved
|
|
9011
8962
|
});
|
|
9012
|
-
if (this.gatewayId === "mastra" && isOpenRouterModel(model)) sanitizedOptions = prepareToolsForMastraGateway(sanitizedOptions, this.config.routerId);
|
|
9013
8963
|
const streamTransport = this.#lastStreamTransport;
|
|
9014
8964
|
if (isLanguageModelV4(model)) {
|
|
9015
8965
|
const streamResult = await new AISDKV7LanguageModel(model).doStream(sanitizedOptions);
|
|
@@ -9314,6 +9264,27 @@ async function resolveModelAuth({ gateway, request, explicit }) {
|
|
|
9314
9264
|
}
|
|
9315
9265
|
// src/llm/model/embedding-router.ts
|
|
9316
9266
|
const MASTRA_GATEWAY_ID = "mastra";
|
|
9267
|
+
/**
|
|
9268
|
+
* Embedding-specific default base URLs for providers whose generated registry
|
|
9269
|
+
* entry carries an API key variable but no URL. Registry and environment URLs
|
|
9270
|
+
* stay authoritative; these only fill the gap.
|
|
9271
|
+
*/
|
|
9272
|
+
const DEFAULT_EMBEDDING_PROVIDER_URLS = { deepinfra: "https://api.deepinfra.com/v1/openai" };
|
|
9273
|
+
/**
|
|
9274
|
+
* Parse a non-gateway `provider/model` identifier. The provider is the first
|
|
9275
|
+
* segment and the model is everything after the first `/`, so namespaced model
|
|
9276
|
+
* ids like `deepinfra/Qwen/Qwen3-Embedding-8B` resolve to provider
|
|
9277
|
+
* `deepinfra` and model `Qwen/Qwen3-Embedding-8B`. Empty provider and model
|
|
9278
|
+
* segments are rejected.
|
|
9279
|
+
*/
|
|
9280
|
+
function parseEmbeddingModelId(modelId) {
|
|
9281
|
+
const separatorIndex = modelId.indexOf("/");
|
|
9282
|
+
if (separatorIndex <= 0 || separatorIndex === modelId.length - 1) throw new Error(`Invalid model string format: "${modelId}". Expected format: "provider/model"`);
|
|
9283
|
+
return {
|
|
9284
|
+
providerId: modelId.slice(0, separatorIndex),
|
|
9285
|
+
modelId: modelId.slice(separatorIndex + 1)
|
|
9286
|
+
};
|
|
9287
|
+
}
|
|
9317
9288
|
function trimTrailingSlashes(value) {
|
|
9318
9289
|
let end = value.length;
|
|
9319
9290
|
while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
|
|
@@ -9384,14 +9355,7 @@ var ModelRouterEmbeddingModel = class {
|
|
|
9384
9355
|
providerId: MASTRA_GATEWAY_ID,
|
|
9385
9356
|
modelId: parts.slice(1).join("/")
|
|
9386
9357
|
};
|
|
9387
|
-
} else
|
|
9388
|
-
if (parts.length !== 2) throw new Error(`Invalid model string format: "${config}". Expected format: "provider/model"`);
|
|
9389
|
-
const [providerId, modelId] = parts;
|
|
9390
|
-
normalizedConfig = {
|
|
9391
|
-
providerId,
|
|
9392
|
-
modelId
|
|
9393
|
-
};
|
|
9394
|
-
}
|
|
9358
|
+
} else normalizedConfig = parseEmbeddingModelId(config);
|
|
9395
9359
|
} else if ("providerId" in config && "modelId" in config) normalizedConfig = {
|
|
9396
9360
|
providerId: config.providerId,
|
|
9397
9361
|
modelId: config.modelId,
|
|
@@ -9410,17 +9374,12 @@ var ModelRouterEmbeddingModel = class {
|
|
|
9410
9374
|
apiKey: config.apiKey,
|
|
9411
9375
|
headers: config.headers
|
|
9412
9376
|
};
|
|
9413
|
-
} else {
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
url: config.url,
|
|
9420
|
-
apiKey: config.apiKey,
|
|
9421
|
-
headers: config.headers
|
|
9422
|
-
};
|
|
9423
|
-
}
|
|
9377
|
+
} else normalizedConfig = {
|
|
9378
|
+
...parseEmbeddingModelId(config.id),
|
|
9379
|
+
url: config.url,
|
|
9380
|
+
apiKey: config.apiKey,
|
|
9381
|
+
headers: config.headers
|
|
9382
|
+
};
|
|
9424
9383
|
}
|
|
9425
9384
|
this.provider = normalizedConfig.providerId;
|
|
9426
9385
|
this.modelId = normalizedConfig.modelId;
|
|
@@ -9460,14 +9419,15 @@ var ModelRouterEmbeddingModel = class {
|
|
|
9460
9419
|
const envVarDisplay = Array.isArray(providerConfig.apiKeyEnvVar) ? providerConfig.apiKeyEnvVar.join(" or ") : providerConfig.apiKeyEnvVar;
|
|
9461
9420
|
throw new Error(`API key not found for provider ${normalizedConfig.providerId}. Set ${envVarDisplay}`);
|
|
9462
9421
|
}
|
|
9463
|
-
if (normalizedConfig.providerId === "openai") this.providerModel = createOpenAI({ apiKey }).embeddingModel(normalizedConfig.modelId);
|
|
9422
|
+
if (normalizedConfig.providerId === "openai") this.providerModel = createOpenAI$1({ apiKey }).embeddingModel(normalizedConfig.modelId);
|
|
9464
9423
|
else if (normalizedConfig.providerId === "google") this.providerModel = createGoogleGenerativeAI({ apiKey }).embeddingModel(normalizedConfig.modelId);
|
|
9465
9424
|
else {
|
|
9466
|
-
|
|
9425
|
+
const providerUrl = providerConfig.url ?? DEFAULT_EMBEDDING_PROVIDER_URLS[normalizedConfig.providerId];
|
|
9426
|
+
if (!providerUrl) throw new Error(`Provider ${normalizedConfig.providerId} does not have a URL configured`);
|
|
9467
9427
|
this.providerModel = createOpenAICompatible({
|
|
9468
9428
|
name: normalizedConfig.providerId,
|
|
9469
9429
|
apiKey,
|
|
9470
|
-
baseURL: interpolateUrlTemplate(
|
|
9430
|
+
baseURL: interpolateUrlTemplate(providerUrl)
|
|
9471
9431
|
}).embeddingModel(normalizedConfig.modelId);
|
|
9472
9432
|
}
|
|
9473
9433
|
}
|
package/dist/loop/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-BTFPEkXT.cjs");
|
|
3
|
+
const require_stream = require("../stream-D1OnBHDi.cjs");
|
|
4
4
|
exports.MastraTimeoutError = require_stream.MastraTimeoutError;
|
|
5
5
|
exports.createScorer = require_run_registry.createScorer;
|
|
6
6
|
exports.createTimeoutAbortSignal = require_stream.createTimeoutAbortSignal;
|
package/dist/loop/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Bt as formatCompletionFeedback, Gt as runChecks, Ht as formatValidationFeedback, Jt as runStreamCompletionScorers, Kt as runCompletionScorers, T as createScorer, Ut as generateFinalResult, Vt as formatStreamCompletionFeedback, Wt as generateStructuredFinalResult, Xt as loop, Yt as runValidation, qt as runDefaultCompletionCheck, zt as formatCheckFeedback } from "../run-registry-
|
|
2
|
-
import { Cn as isMastraTimeoutError, vn as MastraTimeoutError, yn as createTimeoutAbortSignal } from "../stream-
|
|
1
|
+
import { Bt as formatCompletionFeedback, Gt as runChecks, Ht as formatValidationFeedback, Jt as runStreamCompletionScorers, Kt as runCompletionScorers, T as createScorer, Ut as generateFinalResult, Vt as formatStreamCompletionFeedback, Wt as generateStructuredFinalResult, Xt as loop, Yt as runValidation, qt as runDefaultCompletionCheck, zt as formatCheckFeedback } from "../run-registry-D5z2YVqJ.js";
|
|
2
|
+
import { Cn as isMastraTimeoutError, vn as MastraTimeoutError, yn as createTimeoutAbortSignal } from "../stream-DB5efioT.js";
|
|
3
3
|
export { MastraTimeoutError, createScorer, createTimeoutAbortSignal, formatCheckFeedback, formatCompletionFeedback, formatStreamCompletionFeedback, formatValidationFeedback, generateFinalResult, generateStructuredFinalResult, isMastraTimeoutError, loop, runChecks, runCompletionScorers, runDefaultCompletionCheck, runStreamCompletionScorers, runValidation };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BrhgMLW6.cjs");
|
|
2
|
-
const require_run_registry = require("./run-registry-
|
|
2
|
+
const require_run_registry = require("./run-registry-BTFPEkXT.cjs");
|
|
3
3
|
const require_observability = require("./observability-B0R_D1PZ.cjs");
|
|
4
4
|
const require_error = require("./error-D90lJ6M7.cjs");
|
|
5
|
-
const require_stream = require("./stream-
|
|
5
|
+
const require_stream = require("./stream-D1OnBHDi.cjs");
|
|
6
6
|
const require_request_context = require("./request-context-D9RXYCy8.cjs");
|
|
7
7
|
const require_storage = require("./storage-CfG0I2aF.cjs");
|
|
8
8
|
const require_utils = require("./utils-D-eNsgDM.cjs");
|
|
9
9
|
const require_deep_equal = require("./deep-equal-TMDmByBC.cjs");
|
|
10
|
-
const require_constants = require("./constants-
|
|
10
|
+
const require_constants = require("./constants-Bou0hEgY.cjs");
|
|
11
11
|
let zod = require("zod");
|
|
12
12
|
let _mastra_schema_compat = require("@mastra/schema-compat");
|
|
13
13
|
let _mastra_schema_compat_zod_to_json = require("@mastra/schema-compat/zod-to-json");
|
|
@@ -1023,22 +1023,40 @@ function resolveScorers(mastra, scorers) {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
const EXPERIMENT_ITEM_SCORER_NOT_FOUND = "EXPERIMENT_ITEM_SCORER_NOT_FOUND";
|
|
1025
1025
|
const EXPERIMENT_SCORER_NOT_FOUND = "EXPERIMENT_SCORER_NOT_FOUND";
|
|
1026
|
+
/** Version ids of scorers built from a pinned stored version, recorded on their score rows. */
|
|
1027
|
+
const pinnedScorerVersionIds = /* @__PURE__ */ new WeakMap();
|
|
1026
1028
|
/**
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1029
|
-
|
|
1030
|
-
|
|
1029
|
+
* Build a stored scorer at a specific version without registering it, so a
|
|
1030
|
+
* pinned (possibly older) version never replaces the current one in Mastra's registry.
|
|
1031
|
+
*/
|
|
1032
|
+
async function loadPinnedScorer(mastra, scorerId, versionId) {
|
|
1033
|
+
const editor = mastra.getEditor?.();
|
|
1034
|
+
const store = await mastra.getStorage()?.getStore("scorerDefinitions");
|
|
1035
|
+
if (!editor || !store) return null;
|
|
1036
|
+
const definition = await store.getByIdResolved(scorerId, { versionId });
|
|
1037
|
+
if (definition?.resolvedVersionId !== versionId) return null;
|
|
1038
|
+
const scorer = editor.scorer.resolve(definition);
|
|
1039
|
+
if (scorer) pinnedScorerVersionIds.set(scorer, versionId);
|
|
1040
|
+
return scorer;
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Create a run-scoped scorer resolver. Instances pass through. String ids
|
|
1044
|
+
* pinned in `scorerVersions` load that stored version; other ids are looked up
|
|
1045
|
+
* in Mastra's registry, then loaded as stored scorers through the editor (which
|
|
1046
|
+
* registers them). Resolutions, including misses, are cached so concurrent items
|
|
1047
|
+
* load a stored scorer at most once per run.
|
|
1031
1048
|
*
|
|
1032
1049
|
* Only a scorer that doesn't exist is reported in `missingIds`. A failed lookup
|
|
1033
1050
|
* (for example, storage being unavailable) rejects with its own error and isn't
|
|
1034
1051
|
* cached, so it isn't mistaken for a bad scorer ID.
|
|
1035
1052
|
*/
|
|
1036
|
-
function createScorerResolver(mastra) {
|
|
1053
|
+
function createScorerResolver(mastra, scorerVersions) {
|
|
1037
1054
|
const resolutionCache = /* @__PURE__ */ new Map();
|
|
1038
1055
|
const resolveById = (scorerId) => {
|
|
1039
1056
|
const cached = resolutionCache.get(scorerId);
|
|
1040
1057
|
if (cached) return cached;
|
|
1041
|
-
const
|
|
1058
|
+
const pinnedVersionId = scorerVersions && Object.hasOwn(scorerVersions, scorerId) ? scorerVersions[scorerId] : void 0;
|
|
1059
|
+
const resolution = pinnedVersionId ? loadPinnedScorer(mastra, scorerId, pinnedVersionId) : (async () => {
|
|
1042
1060
|
let scorer = getItemScorerById(mastra, scorerId);
|
|
1043
1061
|
if (scorer) return scorer;
|
|
1044
1062
|
const editor = mastra.getEditor?.();
|
|
@@ -1074,6 +1092,23 @@ function createScorerResolver(mastra) {
|
|
|
1074
1092
|
};
|
|
1075
1093
|
}
|
|
1076
1094
|
/**
|
|
1095
|
+
* Pin the current version of every stored scorer among `scorerIds`, so all
|
|
1096
|
+
* items of an experiment are scored by the same definition even if the stored
|
|
1097
|
+
* scorer is edited mid-run. Ids served by a code scorer are not pinned.
|
|
1098
|
+
*/
|
|
1099
|
+
async function pinStoredScorerVersions(mastra, scorerIds) {
|
|
1100
|
+
const store = mastra.getEditor?.() ? await mastra.getStorage()?.getStore("scorerDefinitions") : void 0;
|
|
1101
|
+
if (!store) return null;
|
|
1102
|
+
const pins = {};
|
|
1103
|
+
for (const scorerId of new Set(scorerIds)) {
|
|
1104
|
+
const registered = getItemScorerById(mastra, scorerId);
|
|
1105
|
+
if (registered && registered.source !== "stored") continue;
|
|
1106
|
+
const definition = await store.getByIdResolved(scorerId);
|
|
1107
|
+
if (definition?.resolvedVersionId) pins[scorerId] = definition.resolvedVersionId;
|
|
1108
|
+
}
|
|
1109
|
+
return Object.keys(pins).length > 0 ? pins : null;
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1077
1112
|
* The item error for scorer ids that can't be resolved during a run (e.g. a
|
|
1078
1113
|
* stored scorer deleted after the experiment started). `null` when none are missing.
|
|
1079
1114
|
*/
|
|
@@ -1105,13 +1140,17 @@ function flattenScorerConfig(scorers) {
|
|
|
1105
1140
|
steps: "steps" in scorers && scorers.steps || void 0
|
|
1106
1141
|
};
|
|
1107
1142
|
}
|
|
1143
|
+
/** Every scorer id in a run-level `scorers` config, including workflow step scorers. */
|
|
1144
|
+
function runLevelScorerIds(scorers) {
|
|
1145
|
+
const { flat, steps } = flattenScorerConfig(scorers);
|
|
1146
|
+
return [...flat, ...Object.values(steps ?? {}).flat()].filter((scorer) => typeof scorer === "string");
|
|
1147
|
+
}
|
|
1108
1148
|
/**
|
|
1109
1149
|
* Throw {@link EXPERIMENT_SCORER_NOT_FOUND} when any run-level scorer id can't
|
|
1110
1150
|
* be resolved, so a typo or deleted stored scorer fails before an experiment is created.
|
|
1111
1151
|
*/
|
|
1112
1152
|
async function assertExperimentScorersExist(mastra, scorers) {
|
|
1113
|
-
const
|
|
1114
|
-
const ids = [...flat, ...Object.values(steps ?? {}).flat()].filter((scorer) => typeof scorer === "string");
|
|
1153
|
+
const ids = runLevelScorerIds(scorers);
|
|
1115
1154
|
if (ids.length === 0) return;
|
|
1116
1155
|
const { missingIds } = await createScorerResolver(mastra)(ids);
|
|
1117
1156
|
if (missingIds.length > 0) throw experimentScorerNotFoundError(missingIds);
|
|
@@ -1193,7 +1232,8 @@ async function runScorersForItem(scorers, item, output, storage, runId, targetTy
|
|
|
1193
1232
|
id: scorer.id,
|
|
1194
1233
|
name: scorer.name,
|
|
1195
1234
|
description: scorer.description ?? "",
|
|
1196
|
-
hasJudge: !!scorer.judge
|
|
1235
|
+
hasJudge: !!scorer.judge,
|
|
1236
|
+
...pinnedScorerVersionIds.has(scorer) ? { versionId: pinnedScorerVersionIds.get(scorer) } : {}
|
|
1197
1237
|
},
|
|
1198
1238
|
entity: {
|
|
1199
1239
|
id: targetId,
|
|
@@ -1414,7 +1454,8 @@ async function runStepScorersForItem(stepScorers, item, workflowData, storage, r
|
|
|
1414
1454
|
id: scorer.id,
|
|
1415
1455
|
name: scorer.name,
|
|
1416
1456
|
description: scorer.description ?? "",
|
|
1417
|
-
hasJudge: !!scorer.judge
|
|
1457
|
+
hasJudge: !!scorer.judge,
|
|
1458
|
+
...pinnedScorerVersionIds.has(scorer) ? { versionId: pinnedScorerVersionIds.get(scorer) } : {}
|
|
1418
1459
|
},
|
|
1419
1460
|
entity: {
|
|
1420
1461
|
id: targetId,
|
|
@@ -1774,7 +1815,7 @@ async function executeExperimentItem(args) {
|
|
|
1774
1815
|
domain: "STORAGE",
|
|
1775
1816
|
category: "USER"
|
|
1776
1817
|
});
|
|
1777
|
-
const resolveScorerEntries = createScorerResolver(mastra);
|
|
1818
|
+
const resolveScorerEntries = createScorerResolver(mastra, experiment.scorerVersions);
|
|
1778
1819
|
let scorers;
|
|
1779
1820
|
let scorerConfigError = null;
|
|
1780
1821
|
if (item.scorerIds !== void 0 && experiment.scorerIds == null) {
|
|
@@ -2062,13 +2103,20 @@ async function runExperiment(mastra, config) {
|
|
|
2062
2103
|
if (targetType !== "agent" && itemsWithToolMocks > 0) mastra.getLogger()?.warn(`Experiment target is "${config.task ? "task" : targetType}" but ${itemsWithToolMocks} of ${items.length} dataset items declare toolMocks. Tool mocks only apply to agent targets and will be ignored.`);
|
|
2063
2104
|
const hasRunLevelScorers = scorerInput !== void 0;
|
|
2064
2105
|
const { flat: flatScorerInput, steps: stepsConfigInput } = flattenScorerConfig(scorerInput);
|
|
2065
|
-
|
|
2106
|
+
let scorerVersions = null;
|
|
2107
|
+
let resolveScorerEntries;
|
|
2066
2108
|
let runLevelScorers = [];
|
|
2067
2109
|
let runLevelStepScorers = {};
|
|
2068
2110
|
let datasetScorers = [];
|
|
2069
2111
|
let runLevelMissingIds = [];
|
|
2070
2112
|
let datasetMissingIds = [];
|
|
2071
2113
|
try {
|
|
2114
|
+
scorerVersions = providedExperimentId ? (await experimentsStore?.getExperimentById({ id: experimentId }))?.scorerVersions ?? null : await pinStoredScorerVersions(mastra, [
|
|
2115
|
+
...runLevelScorerIds(scorerInput),
|
|
2116
|
+
...datasetRecord?.scorerIds ?? [],
|
|
2117
|
+
...items.flatMap((item) => item.scorerIds ?? [])
|
|
2118
|
+
]);
|
|
2119
|
+
resolveScorerEntries = createScorerResolver(mastra, scorerVersions);
|
|
2072
2120
|
if (hasRunLevelScorers) {
|
|
2073
2121
|
const resolution = await resolveScorerEntries(flatScorerInput);
|
|
2074
2122
|
const stepResolutions = await Promise.all(Object.entries(stepsConfigInput ?? {}).map(async ([stepId, entries]) => [stepId, await resolveScorerEntries(entries)]));
|
|
@@ -2103,6 +2151,7 @@ async function runExperiment(mastra, config) {
|
|
|
2103
2151
|
targetId: targetId ?? "inline",
|
|
2104
2152
|
totalItems: items.length,
|
|
2105
2153
|
agentVersion,
|
|
2154
|
+
scorerVersions,
|
|
2106
2155
|
organizationId: datasetRecord?.organizationId ?? null,
|
|
2107
2156
|
projectId: datasetRecord?.projectId ?? null
|
|
2108
2157
|
});
|
|
@@ -2602,6 +2651,22 @@ var Dataset = class {
|
|
|
2602
2651
|
return pagination.total;
|
|
2603
2652
|
}
|
|
2604
2653
|
/**
|
|
2654
|
+
* Pin the current version of every stored scorer the experiment can use:
|
|
2655
|
+
* run-level, dataset-level and item-level ids at the experiment's dataset version.
|
|
2656
|
+
*/
|
|
2657
|
+
async #pinScorerVersions(scorers, dataset, version) {
|
|
2658
|
+
if (!this.#mastra.getEditor?.()) return null;
|
|
2659
|
+
const items = await (await this.#getDatasetsStore()).getItemsByVersion({
|
|
2660
|
+
datasetId: this.id,
|
|
2661
|
+
version
|
|
2662
|
+
});
|
|
2663
|
+
return pinStoredScorerVersions(this.#mastra, [
|
|
2664
|
+
...runLevelScorerIds(scorers),
|
|
2665
|
+
...dataset.scorerIds ?? [],
|
|
2666
|
+
...items.flatMap((item) => item.scorerIds ?? [])
|
|
2667
|
+
]);
|
|
2668
|
+
}
|
|
2669
|
+
/**
|
|
2605
2670
|
* Get the full dataset record from storage.
|
|
2606
2671
|
*/
|
|
2607
2672
|
async getDetails() {
|
|
@@ -2818,26 +2883,30 @@ var Dataset = class {
|
|
|
2818
2883
|
category: "USER"
|
|
2819
2884
|
});
|
|
2820
2885
|
const experimentId = crypto.randomUUID();
|
|
2821
|
-
if (experimentsStore)
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2886
|
+
if (experimentsStore) {
|
|
2887
|
+
const scorerVersions = await this.#pinScorerVersions(config.scorers, dataset, targetVersion);
|
|
2888
|
+
await experimentsStore.createExperiment({
|
|
2889
|
+
id: experimentId,
|
|
2890
|
+
datasetId: this.id,
|
|
2891
|
+
datasetVersion: targetVersion,
|
|
2892
|
+
targetType: config.targetType ?? "agent",
|
|
2893
|
+
targetId: config.targetId ?? "inline",
|
|
2894
|
+
totalItems,
|
|
2895
|
+
name: config.name,
|
|
2896
|
+
description: config.description,
|
|
2897
|
+
metadata: withAgentModelMetadata(config.metadata, config.agentModel),
|
|
2898
|
+
provenance: config.provenance,
|
|
2899
|
+
experimentSetId: config.grouping?.experimentSetId,
|
|
2900
|
+
comparisonId: config.grouping?.comparisonId,
|
|
2901
|
+
variantId: config.grouping?.variantId,
|
|
2902
|
+
trialIndex: config.grouping?.trialIndex,
|
|
2903
|
+
agentVersion: config.agentVersion,
|
|
2904
|
+
organizationId: dataset.organizationId ?? null,
|
|
2905
|
+
projectId: dataset.projectId ?? null,
|
|
2906
|
+
...durableRun ? { scorerIds: durableRun.scorerIds ?? null } : {},
|
|
2907
|
+
scorerVersions
|
|
2908
|
+
});
|
|
2909
|
+
}
|
|
2841
2910
|
if (durableRun) {
|
|
2842
2911
|
try {
|
|
2843
2912
|
await this.#mastra.__ensureExperimentWorkflow();
|
|
@@ -3115,6 +3184,7 @@ var Dataset = class {
|
|
|
3115
3184
|
category: "USER"
|
|
3116
3185
|
});
|
|
3117
3186
|
const experimentId = args?.id ?? crypto.randomUUID();
|
|
3187
|
+
const scorerVersions = await this.#pinScorerVersions(args?.scorers, dataset, targetVersion);
|
|
3118
3188
|
try {
|
|
3119
3189
|
await experimentsStore.createExperiment({
|
|
3120
3190
|
id: experimentId,
|
|
@@ -3123,6 +3193,7 @@ var Dataset = class {
|
|
|
3123
3193
|
targetType: args?.targetType ?? null,
|
|
3124
3194
|
targetId: args?.targetId ?? null,
|
|
3125
3195
|
scorerIds: args?.scorers?.length ? args.scorers : null,
|
|
3196
|
+
scorerVersions,
|
|
3126
3197
|
totalItems,
|
|
3127
3198
|
name: args?.name,
|
|
3128
3199
|
description: args?.description,
|