@mastra/core 1.87.0-alpha.0 → 1.87.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@ai-sdk_anthropic@3.0.137/dist/index.d.ts +2 -2
- package/dist/_types/@ai-sdk_google@3.0.140/dist/index.d.ts +2 -2
- package/dist/_types/@ai-sdk_openai@3.0.135/dist/index.d.ts +2 -2
- package/dist/a2a/index.cjs +1 -1
- package/dist/a2a/index.js +1 -1
- package/dist/agent/durable/index.cjs +2 -1
- package/dist/agent/durable/index.d.ts +1 -0
- package/dist/agent/durable/index.js +2 -2
- package/dist/agent/durable/run-registry.d.ts +12 -1
- package/dist/agent/durable/types.d.ts +2 -0
- package/dist/agent/durable/workflows/finalize-run.d.ts +2 -1
- package/dist/agent/index.cjs +3 -3
- package/dist/agent/index.js +3 -3
- package/dist/agent/message-list/index.cjs +1 -1
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/thread-stream-runtime.d.ts +3 -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 +1 -1
- package/dist/agent-controller/index.js +1 -1
- package/dist/{agent-controller-B8LoFdtu.js → agent-controller-Dc58ARqw.js} +6 -6
- package/dist/{agent-controller-DSnFynpa.cjs → agent-controller-v64JbuDa.cjs} +6 -6
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-Ci5h0dhj.cjs → background-tasks-DgiQNKh7.cjs} +1 -1
- package/dist/{background-tasks-IW7M4iD2.js → background-tasks-E-Jjxks4.js} +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{builder-14Uptu8y.cjs → builder-Dfp6Ckjr.cjs} +2 -2
- package/dist/{builder-DI2c2xjy.js → builder-Dh175HnQ.js} +2 -2
- package/dist/capabilities/302ai.json +197 -197
- package/dist/capabilities/abliteratedllm.json +27 -27
- package/dist/capabilities/abliteration-ai.json +10 -10
- package/dist/capabilities/above.json +22 -22
- package/dist/capabilities/adaption.json +12 -12
- package/dist/capabilities/adzuki.json +29 -29
- package/dist/capabilities/agentrouter.json +8 -8
- package/dist/capabilities/agnes.json +3 -3
- package/dist/capabilities/ai-router.json +5 -5
- package/dist/capabilities/aiand.json +23 -23
- package/dist/capabilities/aigrow.json +12 -12
- package/dist/capabilities/aimlapi.json +151 -152
- package/dist/capabilities/aixy.json +23 -23
- package/dist/capabilities/aki-io.json +14 -14
- package/dist/capabilities/alibaba-cn.json +92 -92
- 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 +53 -53
- package/dist/capabilities/alibaba-token-plan.json +51 -51
- package/dist/capabilities/alibaba.json +62 -62
- package/dist/capabilities/ambient.json +10 -10
- package/dist/capabilities/amd.json +8 -8
- package/dist/capabilities/anthropic.json +34 -34
- package/dist/capabilities/anyapi.json +18 -18
- package/dist/capabilities/apiko.json +4 -4
- package/dist/capabilities/arcee.json +6 -6
- package/dist/capabilities/augure.json +7 -7
- package/dist/capabilities/auriko.json +21 -21
- package/dist/capabilities/bailing.json +5 -5
- package/dist/capabilities/baseten.json +28 -28
- package/dist/capabilities/bee.json +2 -2
- package/dist/capabilities/berget.json +4 -4
- package/dist/capabilities/bothub.json +16 -16
- package/dist/capabilities/boundless.json +39 -39
- package/dist/capabilities/bumo.json +42 -42
- package/dist/capabilities/byteplus.json +29 -29
- package/dist/capabilities/cerebras.json +4 -4
- package/dist/capabilities/cheapaimodel.json +10 -10
- package/dist/capabilities/cheapest-token.json +29 -29
- package/dist/capabilities/chutes.json +5 -5
- package/dist/capabilities/cline-pass.json +39 -39
- package/dist/capabilities/cloudcode.json +8 -8
- package/dist/capabilities/cloudflare-workers-ai.json +18 -18
- package/dist/capabilities/commandcode.json +154 -154
- package/dist/capabilities/concentrate.json +269 -269
- package/dist/capabilities/cortecs.json +113 -113
- package/dist/capabilities/crossmodel.json +168 -168
- package/dist/capabilities/crusoe.json +9 -9
- package/dist/capabilities/daoxe.json +9 -9
- package/dist/capabilities/databricks.json +128 -128
- package/dist/capabilities/deepinfra.json +99 -99
- package/dist/capabilities/deepseek.json +4 -4
- package/dist/capabilities/digitalocean.json +117 -117
- package/dist/capabilities/dothoosh.json +30 -30
- package/dist/capabilities/doubleword.json +27 -27
- package/dist/capabilities/edenai.json +901 -1734
- package/dist/capabilities/empiriolabs.json +175 -175
- package/dist/capabilities/engy.json +21 -21
- package/dist/capabilities/evroc.json +13 -13
- package/dist/capabilities/ezkielyna.json +8 -8
- package/dist/capabilities/fastrouter.json +78 -78
- package/dist/capabilities/fireworks-ai.json +68 -68
- package/dist/capabilities/freemodel.json +21 -21
- package/dist/capabilities/frogbot.json +96 -96
- package/dist/capabilities/gisoo.json +17 -17
- package/dist/capabilities/gmicloud.json +12 -12
- package/dist/capabilities/google.json +51 -51
- package/dist/capabilities/graphn.json +16 -16
- package/dist/capabilities/greenpt.json +35 -35
- package/dist/capabilities/groq.json +2 -2
- package/dist/capabilities/helicone.json +85 -85
- package/dist/capabilities/hopper.json +2 -2
- package/dist/capabilities/hostinger-router.json +13 -13
- package/dist/capabilities/hpc-ai.json +4 -4
- package/dist/capabilities/huawei-maas.json +12 -12
- package/dist/capabilities/hubris.json +29 -29
- package/dist/capabilities/huggingface.json +89 -89
- package/dist/capabilities/humain.json +2 -2
- package/dist/capabilities/hyper.json +27 -27
- package/dist/capabilities/impossibl.json +149 -149
- package/dist/capabilities/inception.json +3 -3
- package/dist/capabilities/inco.json +4 -4
- package/dist/capabilities/infer.json +12 -12
- package/dist/capabilities/inferall.json +10 -10
- package/dist/capabilities/inference-coop.json +11 -11
- package/dist/capabilities/inferenceapis.json +17 -17
- package/dist/capabilities/inferris.json +4 -4
- package/dist/capabilities/infersia.json +12 -12
- package/dist/capabilities/infomaniak.json +3 -3
- package/dist/capabilities/io-net.json +2 -2
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +44 -44
- package/dist/capabilities/jad-ai.json +2 -2
- package/dist/capabilities/jalapeno.json +11 -11
- package/dist/capabilities/jiekou.json +68 -68
- package/dist/capabilities/jzstoken.json +48 -48
- package/dist/capabilities/keln.json +20 -20
- package/dist/capabilities/kenari.json +125 -125
- package/dist/capabilities/kilo.json +623 -623
- package/dist/capabilities/kimi-code-plan-cn.json +4 -4
- package/dist/capabilities/kimi-code-plan-global.json +4 -4
- package/dist/capabilities/kitani.json +2 -2
- package/dist/capabilities/klavo.json +18 -18
- package/dist/capabilities/korouter.json +30 -30
- package/dist/capabilities/kunavo.json +6 -6
- package/dist/capabilities/liquid.json +12 -12
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +916 -916
- package/dist/capabilities/llmgateway.json +339 -339
- package/dist/capabilities/llmtr.json +31 -31
- package/dist/capabilities/longcat.json +2 -2
- package/dist/capabilities/lowrouter.json +51 -51
- package/dist/capabilities/lyceum.json +4 -4
- package/dist/capabilities/melious.json +12 -12
- package/dist/capabilities/merge-gateway.json +255 -254
- package/dist/capabilities/meta.json +7 -7
- package/dist/capabilities/minimax-cn-coding-plan.json +2 -2
- package/dist/capabilities/minimax-cn.json +5 -5
- package/dist/capabilities/minimax-coding-plan.json +2 -2
- package/dist/capabilities/minimax.json +5 -5
- package/dist/capabilities/mistral.json +18 -18
- package/dist/capabilities/mixlayer.json +5 -5
- package/dist/capabilities/modal.json +10 -10
- package/dist/capabilities/model-oracle-ai.json +21 -21
- package/dist/capabilities/modelis.json +19 -19
- package/dist/capabilities/modular.json +10 -10
- package/dist/capabilities/moneo.json +14 -14
- package/dist/capabilities/moonshotai-cn.json +5 -5
- package/dist/capabilities/moonshotai.json +5 -5
- package/dist/capabilities/morph.json +14 -14
- package/dist/capabilities/munito-eu.json +8 -8
- package/dist/capabilities/munito.json +9 -9
- package/dist/capabilities/nan.json +28 -28
- package/dist/capabilities/nano-gpt.json +586 -584
- package/dist/capabilities/nearai.json +87 -87
- package/dist/capabilities/nebius.json +26 -26
- package/dist/capabilities/neon.json +122 -122
- package/dist/capabilities/neuralwatt.json +45 -45
- package/dist/capabilities/nokeep.json +2 -2
- package/dist/capabilities/novita-ai.json +163 -163
- package/dist/capabilities/nvidia.json +22 -22
- package/dist/capabilities/oathbreaker.json +2 -2
- package/dist/capabilities/obscurify.json +25 -25
- package/dist/capabilities/oci.json +5 -5
- package/dist/capabilities/ofox.json +293 -293
- package/dist/capabilities/ollama-cloud.json +58 -58
- package/dist/capabilities/openai.json +55 -55
- package/dist/capabilities/opencode-go.json +86 -86
- package/dist/capabilities/openreason.json +4 -4
- package/dist/capabilities/openrouter.json +529 -535
- package/dist/capabilities/opper.json +27 -27
- package/dist/capabilities/orcarouter.json +192 -192
- package/dist/capabilities/outerlabs.json +31 -31
- package/dist/capabilities/ovhcloud.json +20 -20
- package/dist/capabilities/pareto.json +5 -5
- package/dist/capabilities/pendra.json +4 -4
- package/dist/capabilities/perplexity-agent.json +64 -64
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +22 -22
- package/dist/capabilities/pioneer.json +20 -20
- package/dist/capabilities/poe.json +113 -113
- package/dist/capabilities/poolside.json +3 -3
- package/dist/capabilities/powerspring.json +9 -9
- package/dist/capabilities/primalabs.json +10 -10
- package/dist/capabilities/prime.json +110 -110
- package/dist/capabilities/privatemode-ai.json +12 -12
- package/dist/capabilities/proxystacks.json +7 -7
- package/dist/capabilities/qiniu-ai.json +14 -14
- package/dist/capabilities/refuseless.json +7 -7
- package/dist/capabilities/regolo-ai.json +8 -8
- package/dist/capabilities/requesty.json +172 -172
- package/dist/capabilities/ruapi.json +15 -15
- package/dist/capabilities/runcrate.json +6 -6
- package/dist/capabilities/runinfra.json +13 -13
- package/dist/capabilities/sakana.json +7 -7
- package/dist/capabilities/sambanova.json +9 -9
- package/dist/capabilities/sandbase.json +24 -24
- package/dist/capabilities/sarvam.json +12 -12
- package/dist/capabilities/scaleway.json +18 -18
- package/dist/capabilities/scnet-token-plan.json +9 -9
- package/dist/capabilities/scx-ai.json +30 -30
- package/dist/capabilities/sensenova.json +12 -12
- package/dist/capabilities/siliconflow-cn.json +45 -45
- package/dist/capabilities/siliconflow.json +53 -53
- package/dist/capabilities/snowflake-cortex.json +22 -22
- package/dist/capabilities/sokkan.json +7 -7
- package/dist/capabilities/sparrowcodes.json +19 -19
- package/dist/capabilities/standardcompute.json +89 -89
- package/dist/capabilities/steadyrouter.json +41 -41
- package/dist/capabilities/stepfun-ai-step-plan.json +5 -5
- package/dist/capabilities/stepfun-ai.json +5 -5
- package/dist/capabilities/stepfun-step-plan.json +5 -5
- package/dist/capabilities/stepfun.json +5 -5
- package/dist/capabilities/stepping-stone.json +11 -11
- package/dist/capabilities/subconscious.json +2 -2
- package/dist/capabilities/synthetic.json +10 -10
- package/dist/capabilities/synthorai.json +23 -23
- package/dist/capabilities/teamorouter.json +25 -25
- package/dist/capabilities/teapot-router.json +13 -13
- package/dist/capabilities/tencent-token-plan.json +40 -40
- package/dist/capabilities/tencent-tokenhub.json +45 -45
- package/dist/capabilities/tensorx.json +27 -27
- package/dist/capabilities/the-grid-ai.json +37 -37
- package/dist/capabilities/thinkingmachines.json +74 -74
- package/dist/capabilities/tinfoil.json +12 -12
- package/dist/capabilities/toapis.json +2 -2
- package/dist/capabilities/togetherai.json +53 -53
- package/dist/capabilities/tokengo.json +23 -23
- package/dist/capabilities/tokenify.json +9 -9
- package/dist/capabilities/trustedrouter.json +4 -4
- package/dist/capabilities/trustedtokens.json +12 -12
- package/dist/capabilities/umans-ai-coding-plan.json +14 -14
- package/dist/capabilities/umans-ai.json +10 -10
- package/dist/capabilities/unrestricted.json +8 -8
- package/dist/capabilities/uplinkswitch.json +23 -23
- package/dist/capabilities/upstage.json +7 -7
- package/dist/capabilities/vancine.json +26 -26
- package/dist/capabilities/vercel.json +576 -576
- package/dist/capabilities/vivgrid.json +85 -85
- package/dist/capabilities/volcengine-coding-plan.json +36 -27
- package/dist/capabilities/volcengine.json +27 -27
- package/dist/capabilities/vultr.json +31 -31
- package/dist/capabilities/wafer.ai.json +14 -14
- package/dist/capabilities/wallaby.json +5 -5
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +11 -11
- package/dist/capabilities/watt.json +24 -24
- package/dist/capabilities/xai.json +6 -6
- package/dist/capabilities/xpersona.json +12 -12
- package/dist/capabilities/xxapi.json +29 -29
- package/dist/capabilities/zai-coding-plan.json +6 -6
- package/dist/capabilities/zai.json +32 -32
- package/dist/capabilities/zenifra.json +27 -27
- package/dist/capabilities/zenmux.json +186 -186
- package/dist/capabilities/zerogpu.json +14 -14
- package/dist/capabilities/zhipuai-coding-plan.json +8 -8
- package/dist/capabilities/zhipuai.json +31 -31
- package/dist/capabilities/zro.json +6 -6
- package/dist/channels/agent-channels.d.ts +7 -0
- package/dist/channels/attach-file-tool.d.ts +22 -0
- package/dist/channels/index.cjs +11 -2
- package/dist/channels/index.d.ts +10 -0
- package/dist/channels/index.js +3 -3
- package/dist/channels/reply-guidance-processor.d.ts +26 -0
- package/dist/channels/reply-mode.d.ts +66 -0
- package/dist/channels/reply-reminder-processor.d.ts +23 -0
- package/dist/channels/reply-tool.d.ts +43 -0
- package/dist/channels/thread-link-processor.d.ts +48 -0
- package/dist/channels/thread-lookup.d.ts +16 -0
- package/dist/channels/tool-announcement-processor.d.ts +29 -0
- package/dist/channels/types.d.ts +25 -0
- package/dist/{channels-Wh32drgu.js → channels-0AO7PMJF.js} +99 -2
- package/dist/{channels-tVV_de9Q.cjs → channels-BZL9RT2i.cjs} +122 -1
- package/dist/coding-agent/index.cjs +1 -1
- package/dist/coding-agent/index.js +1 -1
- package/dist/datasets/experiment/index.d.ts +1 -1
- package/dist/datasets/experiment/item.d.ts +4 -3
- package/dist/datasets/experiment/scorer.d.ts +34 -11
- package/dist/datasets/index.cjs +3 -2
- package/dist/datasets/index.js +3 -3
- package/dist/{dist-ByO0vuJJ-BjMue5_p.cjs → dist-CufwpBZM-CwERFaas.cjs} +4 -4
- package/dist/{dist-ByO0vuJJ-CCXLBnvJ.js → dist-CufwpBZM-DK14Qe0Z.js} +4 -4
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +743 -743
- package/dist/docs/references/docs-channels.md +43 -0
- package/dist/docs/references/docs-evals-experiments.md +13 -3
- package/dist/docs/references/reference-agents-durable-agent.md +2 -0
- package/dist/docs/references/reference-channels-thread-link.md +67 -0
- package/dist/docs/references/reference-workspace-factory-sandbox.md +2 -1
- 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 +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/importers/host.d.ts +7 -1
- package/dist/knowledge/importers/runner.d.ts +12 -0
- package/dist/knowledge/importers/types.d.ts +2 -0
- package/dist/knowledge/index.cjs +82 -6
- package/dist/knowledge/index.js +82 -6
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/provider-types.generated.d.ts +7397 -7534
- package/dist/{llm-B1zaFLYZ.js → llm-B46V7Mi7.js} +2 -2
- package/dist/{llm-BAiOsNAP.cjs → llm-B4AeSFvV.cjs} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/{manager-ChK9GdGz.js → manager-BRAvwB9b.js} +120 -70
- package/dist/{manager-BVX9nVrM.cjs → manager-BwDxA1Nn.cjs} +125 -69
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-CUGfgEpZ.js → mastra-CIx6qEq2.js} +16 -16
- package/dist/{mastra-HSmofHEJ.cjs → mastra-DBhdD172.cjs} +16 -16
- package/dist/memory/index.cjs +3 -3
- package/dist/memory/index.js +3 -3
- package/dist/{message-list-Cj0Sq_JP.cjs → message-list-DfN9mWeN.cjs} +121 -121
- package/dist/{message-list-KRbg-TnI.js → message-list-wI71UGxk.js} +1 -1
- package/dist/{model-C47BJRtR.js → model-CJMsDU8w.js} +1 -1
- package/dist/{model-WahorgzJ.cjs → model-CYhAa5qO.cjs} +1 -1
- package/dist/{netlify-D99AnEhW.cjs → netlify-Bw7Vd58y.cjs} +11 -11
- package/dist/{netlify-CfDXkuLf.js → netlify-C9aJA6Cv.js} +10 -10
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/processor-provider/index.cjs +1 -1
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +2 -2
- package/dist/processors/index.js +2 -2
- package/dist/{provider-registry-CO1NVbO5.cjs → provider-registry-Bn_7VvZ8.cjs} +22046 -22320
- package/dist/{provider-registry-CR385GJ4.js → provider-registry-DOfYSEju.js} +22046 -22320
- package/dist/provider-registry.json +22352 -22626
- package/dist/{registry-generator-Cvp34qcB.cjs → registry-generator-BnK5Npgr.cjs} +1 -1
- package/dist/{registry-generator-B3erRqYS.js → registry-generator-Cw594Ttt.js} +1 -1
- package/dist/{rehydrate-Da4hNuaK.cjs → rehydrate-BWnd_TEx.cjs} +2 -2
- package/dist/{rehydrate-CJBLrZxs.js → rehydrate-Dgqkw7Py.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-DdeEBsVW.js → run-registry-DhOKJtlb.js} +848 -186
- package/dist/{run-registry-TOOfO3hT.cjs → run-registry-lLRc7EE6.cjs} +883 -185
- 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-DH7Qgz8l.cjs → stream-BIDts1fZ.cjs} +2 -2
- package/dist/{stream-C5PagEDs.js → stream-C8HKG3qC.js} +2 -2
- package/dist/test-utils/llm-mock.cjs +1 -1
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/{tool-loop-agent-DVYJXlQJ.js → tool-loop-agent-DM5V_0XS.js} +4 -4
- package/dist/{tool-loop-agent-CJTs4T8b.cjs → tool-loop-agent-PEY5a1R6.cjs} +4 -4
- package/dist/{utils-xJi_N6Tx.cjs → utils-CxMSu_wc.cjs} +1 -1
- package/dist/{utils-D8upuTwy.js → utils-DcnKVK34.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-DTkW3Vlp.js → validate-Dn750ciE.js} +1 -1
- package/dist/{validate-6eZ8Wssn.cjs → validate-RVKgazCf.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-24ORi-wV.cjs → worker-CFPu9qwV.cjs} +2 -2
- package/dist/{worker-Dqubrnf8.js → worker-DJPAdazC.js} +2 -2
- package/dist/{worker-BO3u_WjZ.cjs → worker-Dx0ZHMGX.cjs} +2 -2
- package/dist/{worker-DbcFkKJO.js → worker-SDi9jbP5.js} +2 -2
- package/dist/{workflow-wXOf72fO.js → workflow-DkBqNn7X.js} +3 -3
- package/dist/{workflow-D5Fc5ieC.cjs → workflow-ZFOz_365.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/package.json +7 -7
- package/src/llm/model/provider-types.generated.d.ts +7397 -7534
- /package/dist/_types/{@ai-sdk_provider-utils@4.0.66 → @ai-sdk_provider-utils@4.0.67}/dist/index.d.ts +0 -0
- /package/dist/_types/{@ai-sdk_provider-utils@4.0.66 → @ai-sdk_provider-utils@4.0.67}/package.json +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as MASTRA_GATEWAY_STREAM_TRANSPORT, a as interpolateUrlTemplate, b as createOpenAICompatible, f as findGatewayForModel, h as shouldEnableGateway, l as MASTRA_USER_AGENT, m as hasAuthCredentials, o as parseModelRouterId, p as getGatewayId, r as ModelsDevGateway, s as createGoogleGenerativeAI, t as NetlifyGateway, v as MastraModelGateway, x as EventSourceParserStream, y as createOpenAI } from "./netlify-
|
|
1
|
+
import { _ as MASTRA_GATEWAY_STREAM_TRANSPORT, a as interpolateUrlTemplate, b as createOpenAICompatible, f as findGatewayForModel, h as shouldEnableGateway, l as MASTRA_USER_AGENT, m as hasAuthCredentials, o as parseModelRouterId, p as getGatewayId, r as ModelsDevGateway, s as createGoogleGenerativeAI, t as NetlifyGateway, v as MastraModelGateway, x as EventSourceParserStream, y as createOpenAI } from "./netlify-C9aJA6Cv.js";
|
|
2
2
|
import { n as prepareAzureStrictToolSchemas, r as createStreamFromGenerateResult, t as AISDKV5LanguageModel } from "./model-DS-b2R-R.js";
|
|
3
3
|
import { i as aiV5PromptToAIV7Prompt, r as aiV5PromptToAIV6Prompt } from "./to-prompt-BsDtVXrf.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-
|
|
5
|
+
import { f as MastraGateway, l as modelSupportsTemperature, n as PROVIDER_REGISTRY, p as gatewayServesObservationalMemory, t as GatewayRegistry } from "./provider-registry-DOfYSEju.js";
|
|
6
6
|
import { i as MastraError, n as ErrorDomain, t as ErrorCategory } 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";
|
|
@@ -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-Bw7Vd58y.cjs");
|
|
3
3
|
const require_model = require("./model-jBymoqGa.cjs");
|
|
4
4
|
const require_to_prompt = require("./to-prompt-B9eZo2U5.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-Bn_7VvZ8.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");
|
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-lLRc7EE6.cjs");
|
|
3
|
+
const require_stream = require("../stream-BIDts1fZ.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 { Gt as
|
|
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-DhOKJtlb.js";
|
|
2
|
+
import { Cn as isMastraTimeoutError, vn as MastraTimeoutError, yn as createTimeoutAbortSignal } from "../stream-C8HKG3qC.js";
|
|
3
3
|
export { MastraTimeoutError, createScorer, createTimeoutAbortSignal, formatCheckFeedback, formatCompletionFeedback, formatStreamCompletionFeedback, formatValidationFeedback, generateFinalResult, generateStructuredFinalResult, isMastraTimeoutError, loop, runChecks, runCompletionScorers, runDefaultCompletionCheck, runStreamCompletionScorers, runValidation };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-tIEjjQTE.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Hs as createStep, Us as createWorkflow, ta as assertSupportedPatterns, w as ScorerRunError, x as validateAndSaveScore, y as flushBeforeTraceRead } from "./run-registry-DhOKJtlb.js";
|
|
3
3
|
import { S as resolveObservabilityContext } from "./observability-D7RNOAPx.js";
|
|
4
4
|
import { i as MastraError } from "./error-oh2DLsP2.js";
|
|
5
|
-
import { dt as loadStepResults, ln as isSupportedLanguageModel } from "./stream-
|
|
5
|
+
import { dt as loadStepResults, ln as isSupportedLanguageModel } from "./stream-C8HKG3qC.js";
|
|
6
6
|
import { o as MASTRA_RESOURCE_ID_KEY, p as withoutLiveRequestKeys, u as RequestContext } from "./request-context-COnZHt2-.js";
|
|
7
7
|
import { t as EntityType } from "./storage-Cc50aQAp.js";
|
|
8
8
|
import { a as getOrCreateSpan } from "./utils-DU_pU5SK.js";
|
|
@@ -1022,11 +1022,18 @@ function resolveScorers(mastra, scorers) {
|
|
|
1022
1022
|
}).filter((s) => s !== null);
|
|
1023
1023
|
}
|
|
1024
1024
|
const EXPERIMENT_ITEM_SCORER_NOT_FOUND = "EXPERIMENT_ITEM_SCORER_NOT_FOUND";
|
|
1025
|
+
const EXPERIMENT_SCORER_NOT_FOUND = "EXPERIMENT_SCORER_NOT_FOUND";
|
|
1025
1026
|
/**
|
|
1026
|
-
* Create a run-scoped resolver
|
|
1027
|
-
*
|
|
1027
|
+
* Create a run-scoped scorer resolver. Instances pass through; string ids are
|
|
1028
|
+
* looked up in Mastra's registry, then loaded as stored scorers through the
|
|
1029
|
+
* editor (which registers them). Resolutions, including misses, are cached so
|
|
1030
|
+
* concurrent items hydrate a stored scorer at most once per run.
|
|
1031
|
+
*
|
|
1032
|
+
* Only a scorer that doesn't exist is reported in `missingIds`. A failed lookup
|
|
1033
|
+
* (for example, storage being unavailable) rejects with its own error and isn't
|
|
1034
|
+
* cached, so it isn't mistaken for a bad scorer ID.
|
|
1028
1035
|
*/
|
|
1029
|
-
function
|
|
1036
|
+
function createScorerResolver(mastra) {
|
|
1030
1037
|
const resolutionCache = /* @__PURE__ */ new Map();
|
|
1031
1038
|
const resolveById = (scorerId) => {
|
|
1032
1039
|
const cached = resolutionCache.get(scorerId);
|
|
@@ -1036,22 +1043,30 @@ function createItemScorerResolver(mastra) {
|
|
|
1036
1043
|
if (scorer) return scorer;
|
|
1037
1044
|
const editor = mastra.getEditor?.();
|
|
1038
1045
|
if (editor) {
|
|
1039
|
-
|
|
1040
|
-
await editor.scorer.getById(scorerId);
|
|
1041
|
-
} catch {}
|
|
1046
|
+
await editor.scorer.getById(scorerId);
|
|
1042
1047
|
scorer = getItemScorerById(mastra, scorerId);
|
|
1043
1048
|
}
|
|
1044
1049
|
return scorer;
|
|
1045
1050
|
})();
|
|
1046
1051
|
resolutionCache.set(scorerId, resolution);
|
|
1052
|
+
resolution.catch(() => resolutionCache.delete(scorerId));
|
|
1047
1053
|
return resolution;
|
|
1048
1054
|
};
|
|
1049
|
-
return async (
|
|
1050
|
-
const
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
+
return async (entries) => {
|
|
1056
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1057
|
+
const unique = entries.filter((entry) => {
|
|
1058
|
+
if (typeof entry !== "string") return true;
|
|
1059
|
+
if (seen.has(entry)) return false;
|
|
1060
|
+
seen.add(entry);
|
|
1061
|
+
return true;
|
|
1062
|
+
});
|
|
1063
|
+
const resolved = await Promise.all(unique.map(async (entry) => typeof entry === "string" ? {
|
|
1064
|
+
id: entry,
|
|
1065
|
+
scorer: await resolveById(entry)
|
|
1066
|
+
} : {
|
|
1067
|
+
id: entry.id,
|
|
1068
|
+
scorer: entry
|
|
1069
|
+
}));
|
|
1055
1070
|
return {
|
|
1056
1071
|
scorers: resolved.flatMap(({ scorer }) => scorer ? [scorer] : []),
|
|
1057
1072
|
missingIds: resolved.flatMap(({ id, scorer }) => scorer ? [] : [id])
|
|
@@ -1059,6 +1074,49 @@ function createItemScorerResolver(mastra) {
|
|
|
1059
1074
|
};
|
|
1060
1075
|
}
|
|
1061
1076
|
/**
|
|
1077
|
+
* The item error for scorer ids that can't be resolved during a run (e.g. a
|
|
1078
|
+
* stored scorer deleted after the experiment started). `null` when none are missing.
|
|
1079
|
+
*/
|
|
1080
|
+
function itemScorerNotFoundError(source, missingIds) {
|
|
1081
|
+
if (missingIds.length === 0) return null;
|
|
1082
|
+
return {
|
|
1083
|
+
code: EXPERIMENT_ITEM_SCORER_NOT_FOUND,
|
|
1084
|
+
message: `${source} scorer configuration references unregistered scorer IDs: ${missingIds.join(", ")}`
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
function experimentScorerNotFoundError(missingIds) {
|
|
1088
|
+
return new MastraError({
|
|
1089
|
+
id: EXPERIMENT_SCORER_NOT_FOUND,
|
|
1090
|
+
text: `Experiment scorers not found: ${missingIds.join(", ")}`,
|
|
1091
|
+
domain: "STORAGE",
|
|
1092
|
+
category: "USER"
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
/** Split a run-level scorer config (flat array or categorized) into flat scorers and step scorers. */
|
|
1096
|
+
function flattenScorerConfig(scorers) {
|
|
1097
|
+
if (scorers === void 0) return { flat: [] };
|
|
1098
|
+
if (Array.isArray(scorers)) return { flat: scorers };
|
|
1099
|
+
return {
|
|
1100
|
+
flat: [
|
|
1101
|
+
..."agent" in scorers && scorers.agent || [],
|
|
1102
|
+
..."workflow" in scorers && scorers.workflow || [],
|
|
1103
|
+
..."trajectory" in scorers && scorers.trajectory || []
|
|
1104
|
+
],
|
|
1105
|
+
steps: "steps" in scorers && scorers.steps || void 0
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Throw {@link EXPERIMENT_SCORER_NOT_FOUND} when any run-level scorer id can't
|
|
1110
|
+
* be resolved, so a typo or deleted stored scorer fails before an experiment is created.
|
|
1111
|
+
*/
|
|
1112
|
+
async function assertExperimentScorersExist(mastra, scorers) {
|
|
1113
|
+
const { flat, steps } = flattenScorerConfig(scorers);
|
|
1114
|
+
const ids = [...flat, ...Object.values(steps ?? {}).flat()].filter((scorer) => typeof scorer === "string");
|
|
1115
|
+
if (ids.length === 0) return;
|
|
1116
|
+
const { missingIds } = await createScorerResolver(mastra)(ids);
|
|
1117
|
+
if (missingIds.length > 0) throw experimentScorerNotFoundError(missingIds);
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1062
1120
|
* Attempt to extract a Trajectory from the observability trace store.
|
|
1063
1121
|
* Falls back to undefined if storage is unavailable or the trace has no spans.
|
|
1064
1122
|
* Callers flush observability first (see `flushForTrajectoryScorers`).
|
|
@@ -1272,20 +1330,6 @@ async function runScorerSafe(scorer, item, output, scorerInput, scorerOutput, ta
|
|
|
1272
1330
|
}
|
|
1273
1331
|
}
|
|
1274
1332
|
/**
|
|
1275
|
-
* Resolve step-scoped scorers from a `Record<stepId, (MastraScorer | string)[]>`.
|
|
1276
|
-
* String IDs are looked up from Mastra's scorer registry; missing IDs are skipped
|
|
1277
|
-
* with a warning (matching `resolveScorers`).
|
|
1278
|
-
*/
|
|
1279
|
-
function resolveStepScorers(mastra, stepsConfig) {
|
|
1280
|
-
if (!stepsConfig) return {};
|
|
1281
|
-
const resolved = {};
|
|
1282
|
-
for (const [stepId, scorers] of Object.entries(stepsConfig)) {
|
|
1283
|
-
const stepScorers = resolveScorers(mastra, scorers);
|
|
1284
|
-
if (stepScorers.length > 0) resolved[stepId] = stepScorers;
|
|
1285
|
-
}
|
|
1286
|
-
return resolved;
|
|
1287
|
-
}
|
|
1288
|
-
/**
|
|
1289
1333
|
* Run step-scoped scorers for a single workflow item. Mirrors the per-step
|
|
1290
1334
|
* dispatch in `runEvals`: each scorer runs against `stepResult.payload` and
|
|
1291
1335
|
* `stepResult.output`, with `targetScope: 'span'` and
|
|
@@ -1704,10 +1748,11 @@ function buildEmptyResult(experimentA, experimentB, versionMismatch, warnings) {
|
|
|
1704
1748
|
* Temporal activity) converges on a single row.
|
|
1705
1749
|
*
|
|
1706
1750
|
* Scorer precedence mirrors the in-process runner: experiment `scorerIds` →
|
|
1707
|
-
* item `scorerIds` → dataset `scorerIds` → none.
|
|
1708
|
-
*
|
|
1751
|
+
* item `scorerIds` → dataset `scorerIds` → none. Stored scorers are loaded on
|
|
1752
|
+
* demand at every level. A scorer that can't be resolved (e.g. a stored scorer
|
|
1753
|
+
* deleted after the experiment started) is a deterministic preflight failure
|
|
1709
1754
|
* ({@link EXPERIMENT_ITEM_SCORER_NOT_FOUND}): the target is not executed and
|
|
1710
|
-
* the error is recorded on the row.
|
|
1755
|
+
* the error is recorded on the row; other items are unaffected.
|
|
1711
1756
|
*
|
|
1712
1757
|
* Applies the same per-item run options as the in-process runner (model
|
|
1713
1758
|
* override, tool mocks, timeout, retries) but excludes its loop-level concerns:
|
|
@@ -1729,17 +1774,19 @@ async function executeExperimentItem(args) {
|
|
|
1729
1774
|
domain: "STORAGE",
|
|
1730
1775
|
category: "USER"
|
|
1731
1776
|
});
|
|
1732
|
-
|
|
1777
|
+
const resolveScorerEntries = createScorerResolver(mastra);
|
|
1778
|
+
let scorers;
|
|
1733
1779
|
let scorerConfigError = null;
|
|
1734
|
-
if (
|
|
1735
|
-
|
|
1736
|
-
const resolution = await createItemScorerResolver(mastra)(item.scorerIds);
|
|
1780
|
+
if (item.scorerIds !== void 0 && experiment.scorerIds == null) {
|
|
1781
|
+
const resolution = await resolveScorerEntries(item.scorerIds);
|
|
1737
1782
|
scorers = resolution.scorers;
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1783
|
+
scorerConfigError = itemScorerNotFoundError("Item", resolution.missingIds);
|
|
1784
|
+
} else {
|
|
1785
|
+
const source = experiment.scorerIds != null ? "Experiment" : "Dataset";
|
|
1786
|
+
const resolution = await resolveScorerEntries(experiment.scorerIds ?? args.datasetScorerIds ?? []);
|
|
1787
|
+
scorers = resolution.scorers;
|
|
1788
|
+
scorerConfigError = itemScorerNotFoundError(source, resolution.missingIds);
|
|
1789
|
+
}
|
|
1743
1790
|
const storage = mastra.getStorage();
|
|
1744
1791
|
const experimentsStore = await storage?.getStore("experiments");
|
|
1745
1792
|
if (!experimentsStore) throw new MastraError({
|
|
@@ -2014,31 +2061,31 @@ async function runExperiment(mastra, config) {
|
|
|
2014
2061
|
const itemsWithToolMocks = items.filter((item) => item.toolMocks?.length).length;
|
|
2015
2062
|
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.`);
|
|
2016
2063
|
const hasRunLevelScorers = scorerInput !== void 0;
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2064
|
+
const { flat: flatScorerInput, steps: stepsConfigInput } = flattenScorerConfig(scorerInput);
|
|
2065
|
+
const resolveScorerEntries = createScorerResolver(mastra);
|
|
2066
|
+
let runLevelScorers = [];
|
|
2067
|
+
let runLevelStepScorers = {};
|
|
2068
|
+
let datasetScorers = [];
|
|
2069
|
+
let runLevelMissingIds = [];
|
|
2070
|
+
let datasetMissingIds = [];
|
|
2071
|
+
try {
|
|
2072
|
+
if (hasRunLevelScorers) {
|
|
2073
|
+
const resolution = await resolveScorerEntries(flatScorerInput);
|
|
2074
|
+
const stepResolutions = await Promise.all(Object.entries(stepsConfigInput ?? {}).map(async ([stepId, entries]) => [stepId, await resolveScorerEntries(entries)]));
|
|
2075
|
+
const missingIds = [.../* @__PURE__ */ new Set([...resolution.missingIds, ...stepResolutions.flatMap(([, step]) => step.missingIds)])];
|
|
2076
|
+
if (missingIds.length > 0 && !providedExperimentId) throw experimentScorerNotFoundError(missingIds);
|
|
2077
|
+
runLevelScorers = resolution.scorers;
|
|
2078
|
+
runLevelMissingIds = missingIds;
|
|
2079
|
+
for (const [stepId, step] of stepResolutions) if (step.scorers.length > 0) runLevelStepScorers[stepId] = step.scorers;
|
|
2080
|
+
} else if (items.some((item) => item.scorerIds === void 0)) {
|
|
2081
|
+
const resolution = await resolveScorerEntries(datasetRecord?.scorerIds ?? []);
|
|
2082
|
+
datasetScorers = resolution.scorers;
|
|
2083
|
+
datasetMissingIds = resolution.missingIds;
|
|
2027
2084
|
}
|
|
2085
|
+
} catch (err) {
|
|
2086
|
+
await markFailedOnSetupError(err);
|
|
2087
|
+
throw err;
|
|
2028
2088
|
}
|
|
2029
|
-
if (flatScorerInput?.length) {
|
|
2030
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2031
|
-
flatScorerInput = flatScorerInput.filter((entry) => {
|
|
2032
|
-
if (typeof entry !== "string") return true;
|
|
2033
|
-
if (seen.has(entry)) return false;
|
|
2034
|
-
seen.add(entry);
|
|
2035
|
-
return true;
|
|
2036
|
-
});
|
|
2037
|
-
}
|
|
2038
|
-
const runLevelScorers = hasRunLevelScorers ? resolveScorers(mastra, flatScorerInput) : [];
|
|
2039
|
-
const runLevelStepScorers = hasRunLevelScorers ? resolveStepScorers(mastra, stepsConfigInput) : {};
|
|
2040
|
-
const resolveItemScorers = createItemScorerResolver(mastra);
|
|
2041
|
-
const datasetScorers = !hasRunLevelScorers && items.some((item) => item.scorerIds === void 0) ? resolveScorers(mastra, [...new Set(datasetRecord?.scorerIds ?? [])]) : [];
|
|
2042
2089
|
if (experimentsStore) {
|
|
2043
2090
|
if (!providedExperimentId) await experimentsStore.createExperiment({
|
|
2044
2091
|
id: experimentId,
|
|
@@ -2114,14 +2161,15 @@ async function runExperiment(mastra, config) {
|
|
|
2114
2161
|
if (hasRunLevelScorers) {
|
|
2115
2162
|
itemScorers = runLevelScorers;
|
|
2116
2163
|
itemStepScorers = runLevelStepScorers;
|
|
2164
|
+
scorerConfigError = itemScorerNotFoundError("Experiment", runLevelMissingIds);
|
|
2117
2165
|
} else if (item.scorerIds !== void 0) {
|
|
2118
|
-
const resolution = await
|
|
2166
|
+
const resolution = await resolveScorerEntries(item.scorerIds);
|
|
2119
2167
|
itemScorers = resolution.scorers;
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
}
|
|
2168
|
+
scorerConfigError = itemScorerNotFoundError("Item", resolution.missingIds);
|
|
2169
|
+
} else {
|
|
2170
|
+
itemScorers = datasetScorers;
|
|
2171
|
+
scorerConfigError = itemScorerNotFoundError("Dataset", datasetMissingIds);
|
|
2172
|
+
}
|
|
2125
2173
|
const timeoutSignal = itemTimeout ? AbortSignal.timeout(itemTimeout) : void 0;
|
|
2126
2174
|
const itemSignal = executionSignal && timeoutSignal ? AbortSignal.any([executionSignal, timeoutSignal]) : timeoutSignal ?? executionSignal;
|
|
2127
2175
|
let beforeEachError = null;
|
|
@@ -2749,6 +2797,7 @@ var Dataset = class {
|
|
|
2749
2797
|
const { durable, ...config } = asyncConfig;
|
|
2750
2798
|
assertAgentModelTarget(config);
|
|
2751
2799
|
const durableRun = durable ? durableRunOptions(config) : void 0;
|
|
2800
|
+
await assertExperimentScorersExist(this.#mastra, config.scorers);
|
|
2752
2801
|
const experimentsStore = config.persistence?.experiments !== "none" ? await this.#getExperimentsStore() : void 0;
|
|
2753
2802
|
const dataset = await (await this.#getDatasetsStore()).getDatasetById({
|
|
2754
2803
|
id: this.id,
|
|
@@ -3056,6 +3105,7 @@ var Dataset = class {
|
|
|
3056
3105
|
};
|
|
3057
3106
|
}
|
|
3058
3107
|
}
|
|
3108
|
+
await assertExperimentScorersExist(this.#mastra, args?.scorers);
|
|
3059
3109
|
const targetVersion = args?.version ?? dataset.version;
|
|
3060
3110
|
const totalItems = await this.#countItems(targetVersion);
|
|
3061
3111
|
if (totalItems === 0) throw new MastraError({
|
|
@@ -3640,4 +3690,4 @@ var DatasetsManager = class {
|
|
|
3640
3690
|
};
|
|
3641
3691
|
}
|
|
3642
3692
|
};
|
|
3643
|
-
export {
|
|
3693
|
+
export { EXPERIMENT_WORKFLOW_ID as S, TOOL_MOCK_NOT_DECLARED as _, executeExperimentItem as a, workflow_exports as b, computeScorerStats as c, EXPERIMENT_SCORER_NOT_FOUND as d, resolveScorers as f, TOOL_MOCK_MISMATCH as g, TOOL_MOCK_EXHAUSTED as h, runExperiment as i, isRegression as l, executeTarget as m, Dataset as n, compareExperiments as o, runScorersForItem as p, EXPERIMENT_ITEM_BEFORE_EACH_FAILED as r, computeMean as s, DatasetsManager as t, EXPERIMENT_ITEM_SCORER_NOT_FOUND as u, ToolMockMatcher as v, resolveTarget as x, EXPERIMENT_NOT_DURABLE as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
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-lLRc7EE6.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-BIDts1fZ.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");
|
|
@@ -1022,11 +1022,18 @@ function resolveScorers(mastra, scorers) {
|
|
|
1022
1022
|
}).filter((s) => s !== null);
|
|
1023
1023
|
}
|
|
1024
1024
|
const EXPERIMENT_ITEM_SCORER_NOT_FOUND = "EXPERIMENT_ITEM_SCORER_NOT_FOUND";
|
|
1025
|
+
const EXPERIMENT_SCORER_NOT_FOUND = "EXPERIMENT_SCORER_NOT_FOUND";
|
|
1025
1026
|
/**
|
|
1026
|
-
* Create a run-scoped resolver
|
|
1027
|
-
*
|
|
1027
|
+
* Create a run-scoped scorer resolver. Instances pass through; string ids are
|
|
1028
|
+
* looked up in Mastra's registry, then loaded as stored scorers through the
|
|
1029
|
+
* editor (which registers them). Resolutions, including misses, are cached so
|
|
1030
|
+
* concurrent items hydrate a stored scorer at most once per run.
|
|
1031
|
+
*
|
|
1032
|
+
* Only a scorer that doesn't exist is reported in `missingIds`. A failed lookup
|
|
1033
|
+
* (for example, storage being unavailable) rejects with its own error and isn't
|
|
1034
|
+
* cached, so it isn't mistaken for a bad scorer ID.
|
|
1028
1035
|
*/
|
|
1029
|
-
function
|
|
1036
|
+
function createScorerResolver(mastra) {
|
|
1030
1037
|
const resolutionCache = /* @__PURE__ */ new Map();
|
|
1031
1038
|
const resolveById = (scorerId) => {
|
|
1032
1039
|
const cached = resolutionCache.get(scorerId);
|
|
@@ -1036,22 +1043,30 @@ function createItemScorerResolver(mastra) {
|
|
|
1036
1043
|
if (scorer) return scorer;
|
|
1037
1044
|
const editor = mastra.getEditor?.();
|
|
1038
1045
|
if (editor) {
|
|
1039
|
-
|
|
1040
|
-
await editor.scorer.getById(scorerId);
|
|
1041
|
-
} catch {}
|
|
1046
|
+
await editor.scorer.getById(scorerId);
|
|
1042
1047
|
scorer = getItemScorerById(mastra, scorerId);
|
|
1043
1048
|
}
|
|
1044
1049
|
return scorer;
|
|
1045
1050
|
})();
|
|
1046
1051
|
resolutionCache.set(scorerId, resolution);
|
|
1052
|
+
resolution.catch(() => resolutionCache.delete(scorerId));
|
|
1047
1053
|
return resolution;
|
|
1048
1054
|
};
|
|
1049
|
-
return async (
|
|
1050
|
-
const
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
+
return async (entries) => {
|
|
1056
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1057
|
+
const unique = entries.filter((entry) => {
|
|
1058
|
+
if (typeof entry !== "string") return true;
|
|
1059
|
+
if (seen.has(entry)) return false;
|
|
1060
|
+
seen.add(entry);
|
|
1061
|
+
return true;
|
|
1062
|
+
});
|
|
1063
|
+
const resolved = await Promise.all(unique.map(async (entry) => typeof entry === "string" ? {
|
|
1064
|
+
id: entry,
|
|
1065
|
+
scorer: await resolveById(entry)
|
|
1066
|
+
} : {
|
|
1067
|
+
id: entry.id,
|
|
1068
|
+
scorer: entry
|
|
1069
|
+
}));
|
|
1055
1070
|
return {
|
|
1056
1071
|
scorers: resolved.flatMap(({ scorer }) => scorer ? [scorer] : []),
|
|
1057
1072
|
missingIds: resolved.flatMap(({ id, scorer }) => scorer ? [] : [id])
|
|
@@ -1059,6 +1074,49 @@ function createItemScorerResolver(mastra) {
|
|
|
1059
1074
|
};
|
|
1060
1075
|
}
|
|
1061
1076
|
/**
|
|
1077
|
+
* The item error for scorer ids that can't be resolved during a run (e.g. a
|
|
1078
|
+
* stored scorer deleted after the experiment started). `null` when none are missing.
|
|
1079
|
+
*/
|
|
1080
|
+
function itemScorerNotFoundError(source, missingIds) {
|
|
1081
|
+
if (missingIds.length === 0) return null;
|
|
1082
|
+
return {
|
|
1083
|
+
code: EXPERIMENT_ITEM_SCORER_NOT_FOUND,
|
|
1084
|
+
message: `${source} scorer configuration references unregistered scorer IDs: ${missingIds.join(", ")}`
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
function experimentScorerNotFoundError(missingIds) {
|
|
1088
|
+
return new require_error.MastraError({
|
|
1089
|
+
id: EXPERIMENT_SCORER_NOT_FOUND,
|
|
1090
|
+
text: `Experiment scorers not found: ${missingIds.join(", ")}`,
|
|
1091
|
+
domain: "STORAGE",
|
|
1092
|
+
category: "USER"
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
/** Split a run-level scorer config (flat array or categorized) into flat scorers and step scorers. */
|
|
1096
|
+
function flattenScorerConfig(scorers) {
|
|
1097
|
+
if (scorers === void 0) return { flat: [] };
|
|
1098
|
+
if (Array.isArray(scorers)) return { flat: scorers };
|
|
1099
|
+
return {
|
|
1100
|
+
flat: [
|
|
1101
|
+
..."agent" in scorers && scorers.agent || [],
|
|
1102
|
+
..."workflow" in scorers && scorers.workflow || [],
|
|
1103
|
+
..."trajectory" in scorers && scorers.trajectory || []
|
|
1104
|
+
],
|
|
1105
|
+
steps: "steps" in scorers && scorers.steps || void 0
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Throw {@link EXPERIMENT_SCORER_NOT_FOUND} when any run-level scorer id can't
|
|
1110
|
+
* be resolved, so a typo or deleted stored scorer fails before an experiment is created.
|
|
1111
|
+
*/
|
|
1112
|
+
async function assertExperimentScorersExist(mastra, scorers) {
|
|
1113
|
+
const { flat, steps } = flattenScorerConfig(scorers);
|
|
1114
|
+
const ids = [...flat, ...Object.values(steps ?? {}).flat()].filter((scorer) => typeof scorer === "string");
|
|
1115
|
+
if (ids.length === 0) return;
|
|
1116
|
+
const { missingIds } = await createScorerResolver(mastra)(ids);
|
|
1117
|
+
if (missingIds.length > 0) throw experimentScorerNotFoundError(missingIds);
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1062
1120
|
* Attempt to extract a Trajectory from the observability trace store.
|
|
1063
1121
|
* Falls back to undefined if storage is unavailable or the trace has no spans.
|
|
1064
1122
|
* Callers flush observability first (see `flushForTrajectoryScorers`).
|
|
@@ -1272,20 +1330,6 @@ async function runScorerSafe(scorer, item, output, scorerInput, scorerOutput, ta
|
|
|
1272
1330
|
}
|
|
1273
1331
|
}
|
|
1274
1332
|
/**
|
|
1275
|
-
* Resolve step-scoped scorers from a `Record<stepId, (MastraScorer | string)[]>`.
|
|
1276
|
-
* String IDs are looked up from Mastra's scorer registry; missing IDs are skipped
|
|
1277
|
-
* with a warning (matching `resolveScorers`).
|
|
1278
|
-
*/
|
|
1279
|
-
function resolveStepScorers(mastra, stepsConfig) {
|
|
1280
|
-
if (!stepsConfig) return {};
|
|
1281
|
-
const resolved = {};
|
|
1282
|
-
for (const [stepId, scorers] of Object.entries(stepsConfig)) {
|
|
1283
|
-
const stepScorers = resolveScorers(mastra, scorers);
|
|
1284
|
-
if (stepScorers.length > 0) resolved[stepId] = stepScorers;
|
|
1285
|
-
}
|
|
1286
|
-
return resolved;
|
|
1287
|
-
}
|
|
1288
|
-
/**
|
|
1289
1333
|
* Run step-scoped scorers for a single workflow item. Mirrors the per-step
|
|
1290
1334
|
* dispatch in `runEvals`: each scorer runs against `stepResult.payload` and
|
|
1291
1335
|
* `stepResult.output`, with `targetScope: 'span'` and
|
|
@@ -1704,10 +1748,11 @@ function buildEmptyResult(experimentA, experimentB, versionMismatch, warnings) {
|
|
|
1704
1748
|
* Temporal activity) converges on a single row.
|
|
1705
1749
|
*
|
|
1706
1750
|
* Scorer precedence mirrors the in-process runner: experiment `scorerIds` →
|
|
1707
|
-
* item `scorerIds` → dataset `scorerIds` → none.
|
|
1708
|
-
*
|
|
1751
|
+
* item `scorerIds` → dataset `scorerIds` → none. Stored scorers are loaded on
|
|
1752
|
+
* demand at every level. A scorer that can't be resolved (e.g. a stored scorer
|
|
1753
|
+
* deleted after the experiment started) is a deterministic preflight failure
|
|
1709
1754
|
* ({@link EXPERIMENT_ITEM_SCORER_NOT_FOUND}): the target is not executed and
|
|
1710
|
-
* the error is recorded on the row.
|
|
1755
|
+
* the error is recorded on the row; other items are unaffected.
|
|
1711
1756
|
*
|
|
1712
1757
|
* Applies the same per-item run options as the in-process runner (model
|
|
1713
1758
|
* override, tool mocks, timeout, retries) but excludes its loop-level concerns:
|
|
@@ -1729,17 +1774,19 @@ async function executeExperimentItem(args) {
|
|
|
1729
1774
|
domain: "STORAGE",
|
|
1730
1775
|
category: "USER"
|
|
1731
1776
|
});
|
|
1732
|
-
|
|
1777
|
+
const resolveScorerEntries = createScorerResolver(mastra);
|
|
1778
|
+
let scorers;
|
|
1733
1779
|
let scorerConfigError = null;
|
|
1734
|
-
if (
|
|
1735
|
-
|
|
1736
|
-
const resolution = await createItemScorerResolver(mastra)(item.scorerIds);
|
|
1780
|
+
if (item.scorerIds !== void 0 && experiment.scorerIds == null) {
|
|
1781
|
+
const resolution = await resolveScorerEntries(item.scorerIds);
|
|
1737
1782
|
scorers = resolution.scorers;
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1783
|
+
scorerConfigError = itemScorerNotFoundError("Item", resolution.missingIds);
|
|
1784
|
+
} else {
|
|
1785
|
+
const source = experiment.scorerIds != null ? "Experiment" : "Dataset";
|
|
1786
|
+
const resolution = await resolveScorerEntries(experiment.scorerIds ?? args.datasetScorerIds ?? []);
|
|
1787
|
+
scorers = resolution.scorers;
|
|
1788
|
+
scorerConfigError = itemScorerNotFoundError(source, resolution.missingIds);
|
|
1789
|
+
}
|
|
1743
1790
|
const storage = mastra.getStorage();
|
|
1744
1791
|
const experimentsStore = await storage?.getStore("experiments");
|
|
1745
1792
|
if (!experimentsStore) throw new require_error.MastraError({
|
|
@@ -2014,31 +2061,31 @@ async function runExperiment(mastra, config) {
|
|
|
2014
2061
|
const itemsWithToolMocks = items.filter((item) => item.toolMocks?.length).length;
|
|
2015
2062
|
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.`);
|
|
2016
2063
|
const hasRunLevelScorers = scorerInput !== void 0;
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2064
|
+
const { flat: flatScorerInput, steps: stepsConfigInput } = flattenScorerConfig(scorerInput);
|
|
2065
|
+
const resolveScorerEntries = createScorerResolver(mastra);
|
|
2066
|
+
let runLevelScorers = [];
|
|
2067
|
+
let runLevelStepScorers = {};
|
|
2068
|
+
let datasetScorers = [];
|
|
2069
|
+
let runLevelMissingIds = [];
|
|
2070
|
+
let datasetMissingIds = [];
|
|
2071
|
+
try {
|
|
2072
|
+
if (hasRunLevelScorers) {
|
|
2073
|
+
const resolution = await resolveScorerEntries(flatScorerInput);
|
|
2074
|
+
const stepResolutions = await Promise.all(Object.entries(stepsConfigInput ?? {}).map(async ([stepId, entries]) => [stepId, await resolveScorerEntries(entries)]));
|
|
2075
|
+
const missingIds = [.../* @__PURE__ */ new Set([...resolution.missingIds, ...stepResolutions.flatMap(([, step]) => step.missingIds)])];
|
|
2076
|
+
if (missingIds.length > 0 && !providedExperimentId) throw experimentScorerNotFoundError(missingIds);
|
|
2077
|
+
runLevelScorers = resolution.scorers;
|
|
2078
|
+
runLevelMissingIds = missingIds;
|
|
2079
|
+
for (const [stepId, step] of stepResolutions) if (step.scorers.length > 0) runLevelStepScorers[stepId] = step.scorers;
|
|
2080
|
+
} else if (items.some((item) => item.scorerIds === void 0)) {
|
|
2081
|
+
const resolution = await resolveScorerEntries(datasetRecord?.scorerIds ?? []);
|
|
2082
|
+
datasetScorers = resolution.scorers;
|
|
2083
|
+
datasetMissingIds = resolution.missingIds;
|
|
2027
2084
|
}
|
|
2085
|
+
} catch (err) {
|
|
2086
|
+
await markFailedOnSetupError(err);
|
|
2087
|
+
throw err;
|
|
2028
2088
|
}
|
|
2029
|
-
if (flatScorerInput?.length) {
|
|
2030
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2031
|
-
flatScorerInput = flatScorerInput.filter((entry) => {
|
|
2032
|
-
if (typeof entry !== "string") return true;
|
|
2033
|
-
if (seen.has(entry)) return false;
|
|
2034
|
-
seen.add(entry);
|
|
2035
|
-
return true;
|
|
2036
|
-
});
|
|
2037
|
-
}
|
|
2038
|
-
const runLevelScorers = hasRunLevelScorers ? resolveScorers(mastra, flatScorerInput) : [];
|
|
2039
|
-
const runLevelStepScorers = hasRunLevelScorers ? resolveStepScorers(mastra, stepsConfigInput) : {};
|
|
2040
|
-
const resolveItemScorers = createItemScorerResolver(mastra);
|
|
2041
|
-
const datasetScorers = !hasRunLevelScorers && items.some((item) => item.scorerIds === void 0) ? resolveScorers(mastra, [...new Set(datasetRecord?.scorerIds ?? [])]) : [];
|
|
2042
2089
|
if (experimentsStore) {
|
|
2043
2090
|
if (!providedExperimentId) await experimentsStore.createExperiment({
|
|
2044
2091
|
id: experimentId,
|
|
@@ -2114,14 +2161,15 @@ async function runExperiment(mastra, config) {
|
|
|
2114
2161
|
if (hasRunLevelScorers) {
|
|
2115
2162
|
itemScorers = runLevelScorers;
|
|
2116
2163
|
itemStepScorers = runLevelStepScorers;
|
|
2164
|
+
scorerConfigError = itemScorerNotFoundError("Experiment", runLevelMissingIds);
|
|
2117
2165
|
} else if (item.scorerIds !== void 0) {
|
|
2118
|
-
const resolution = await
|
|
2166
|
+
const resolution = await resolveScorerEntries(item.scorerIds);
|
|
2119
2167
|
itemScorers = resolution.scorers;
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
}
|
|
2168
|
+
scorerConfigError = itemScorerNotFoundError("Item", resolution.missingIds);
|
|
2169
|
+
} else {
|
|
2170
|
+
itemScorers = datasetScorers;
|
|
2171
|
+
scorerConfigError = itemScorerNotFoundError("Dataset", datasetMissingIds);
|
|
2172
|
+
}
|
|
2125
2173
|
const timeoutSignal = itemTimeout ? AbortSignal.timeout(itemTimeout) : void 0;
|
|
2126
2174
|
const itemSignal = executionSignal && timeoutSignal ? AbortSignal.any([executionSignal, timeoutSignal]) : timeoutSignal ?? executionSignal;
|
|
2127
2175
|
let beforeEachError = null;
|
|
@@ -2749,6 +2797,7 @@ var Dataset = class {
|
|
|
2749
2797
|
const { durable, ...config } = asyncConfig;
|
|
2750
2798
|
assertAgentModelTarget(config);
|
|
2751
2799
|
const durableRun = durable ? durableRunOptions(config) : void 0;
|
|
2800
|
+
await assertExperimentScorersExist(this.#mastra, config.scorers);
|
|
2752
2801
|
const experimentsStore = config.persistence?.experiments !== "none" ? await this.#getExperimentsStore() : void 0;
|
|
2753
2802
|
const dataset = await (await this.#getDatasetsStore()).getDatasetById({
|
|
2754
2803
|
id: this.id,
|
|
@@ -3056,6 +3105,7 @@ var Dataset = class {
|
|
|
3056
3105
|
};
|
|
3057
3106
|
}
|
|
3058
3107
|
}
|
|
3108
|
+
await assertExperimentScorersExist(this.#mastra, args?.scorers);
|
|
3059
3109
|
const targetVersion = args?.version ?? dataset.version;
|
|
3060
3110
|
const totalItems = await this.#countItems(targetVersion);
|
|
3061
3111
|
if (totalItems === 0) throw new require_error.MastraError({
|
|
@@ -3670,6 +3720,12 @@ Object.defineProperty(exports, "EXPERIMENT_NOT_DURABLE", {
|
|
|
3670
3720
|
return EXPERIMENT_NOT_DURABLE;
|
|
3671
3721
|
}
|
|
3672
3722
|
});
|
|
3723
|
+
Object.defineProperty(exports, "EXPERIMENT_SCORER_NOT_FOUND", {
|
|
3724
|
+
enumerable: true,
|
|
3725
|
+
get: function() {
|
|
3726
|
+
return EXPERIMENT_SCORER_NOT_FOUND;
|
|
3727
|
+
}
|
|
3728
|
+
});
|
|
3673
3729
|
Object.defineProperty(exports, "EXPERIMENT_WORKFLOW_ID", {
|
|
3674
3730
|
enumerable: true,
|
|
3675
3731
|
get: function() {
|
package/dist/mastra/index.cjs
CHANGED
package/dist/mastra/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Mastra } from "../mastra-
|
|
1
|
+
export { t as Mastra } from "../mastra-CIx6qEq2.js";
|