@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.
Files changed (446) hide show
  1. package/dist/_types/@ai-sdk_openai@4.0.106/dist/index.d.ts +2034 -0
  2. package/dist/_types/@ai-sdk_openai@4.0.106/package.json +1 -0
  3. package/dist/a2a/index.cjs +1 -1
  4. package/dist/a2a/index.js +1 -1
  5. package/dist/agent/durable/index.cjs +1 -1
  6. package/dist/agent/durable/index.js +1 -1
  7. package/dist/agent/durable/run-message-refs.d.ts +3 -2
  8. package/dist/agent/index.cjs +4 -4
  9. package/dist/agent/index.js +4 -4
  10. package/dist/agent/message-list/adapters/AIV5Adapter.d.ts +15 -1
  11. package/dist/agent/message-list/index.cjs +2 -2
  12. package/dist/agent/message-list/index.js +2 -2
  13. package/dist/agent/message-list/state/types.d.ts +5 -1
  14. package/dist/agent/message-list/types.d.ts +1 -1
  15. package/dist/agent/message-list/utils/provider-compat.d.ts +9 -1
  16. package/dist/agent-builder/ee/index.cjs +1 -1
  17. package/dist/agent-builder/ee/index.js +1 -1
  18. package/dist/agent-controller/agent-controller.d.ts +6 -0
  19. package/dist/agent-controller/index.cjs +2 -2
  20. package/dist/agent-controller/index.js +2 -2
  21. package/dist/agent-controller/worker-run-binding.d.ts +15 -0
  22. package/dist/{agent-controller-Dc58ARqw.js → agent-controller-CDwoELRq.js} +50 -8
  23. package/dist/{agent-controller-v64JbuDa.cjs → agent-controller-DEB1G03O.cjs} +50 -8
  24. package/dist/background-tasks/index.cjs +1 -1
  25. package/dist/background-tasks/index.js +1 -1
  26. package/dist/{background-tasks-DgiQNKh7.cjs → background-tasks-B40g_Guf.cjs} +1 -1
  27. package/dist/{background-tasks-E-Jjxks4.js → background-tasks-CBp2178j.js} +1 -1
  28. package/dist/browser/index.cjs +2 -2
  29. package/dist/browser/index.js +2 -2
  30. package/dist/{builder-Dh175HnQ.js → builder-DTEXPju5.js} +2 -2
  31. package/dist/{builder-Dfp6Ckjr.cjs → builder-tuHJooMG.cjs} +2 -2
  32. package/dist/capabilities/302ai.json +191 -191
  33. package/dist/capabilities/abliteratedllm.json +39 -39
  34. package/dist/capabilities/abliteration-ai.json +10 -10
  35. package/dist/capabilities/above.json +20 -20
  36. package/dist/capabilities/adaption.json +15 -15
  37. package/dist/capabilities/adzuki.json +20 -20
  38. package/dist/capabilities/agentrouter.json +9 -9
  39. package/dist/capabilities/agnes.json +3 -3
  40. package/dist/capabilities/ai-router.json +6 -6
  41. package/dist/capabilities/aiand.json +25 -25
  42. package/dist/capabilities/aigrow.json +15 -15
  43. package/dist/capabilities/aimlapi.json +140 -143
  44. package/dist/capabilities/aixy.json +22 -22
  45. package/dist/capabilities/aki-io.json +12 -12
  46. package/dist/capabilities/alibaba-cn.json +98 -98
  47. package/dist/capabilities/alibaba-coding-plan-cn.json +3 -3
  48. package/dist/capabilities/alibaba-coding-plan.json +3 -3
  49. package/dist/capabilities/alibaba-token-plan-cn.json +48 -48
  50. package/dist/capabilities/alibaba-token-plan.json +51 -51
  51. package/dist/capabilities/alibaba.json +99 -65
  52. package/dist/capabilities/ambient.json +23 -16
  53. package/dist/capabilities/amd.json +7 -7
  54. package/dist/capabilities/anthropic.json +43 -43
  55. package/dist/capabilities/anyapi.json +13 -13
  56. package/dist/capabilities/apiko.json +2 -2
  57. package/dist/capabilities/arcee.json +9 -9
  58. package/dist/capabilities/augure.json +7 -7
  59. package/dist/capabilities/auriko.json +20 -20
  60. package/dist/capabilities/bailing.json +5 -5
  61. package/dist/capabilities/baseten.json +32 -32
  62. package/dist/capabilities/bee.json +3 -3
  63. package/dist/capabilities/berget.json +8 -8
  64. package/dist/capabilities/bothub.json +17 -17
  65. package/dist/capabilities/boundless.json +39 -39
  66. package/dist/capabilities/bumo.json +38 -38
  67. package/dist/capabilities/byteplus.json +32 -32
  68. package/dist/capabilities/cerebras.json +4 -4
  69. package/dist/capabilities/cheapaimodel.json +10 -10
  70. package/dist/capabilities/cheapest-token.json +30 -30
  71. package/dist/capabilities/chutes.json +10 -10
  72. package/dist/capabilities/clarifai.json +2 -2
  73. package/dist/capabilities/cline-pass.json +36 -36
  74. package/dist/capabilities/cloudcode.json +9 -9
  75. package/dist/capabilities/cloudflare-workers-ai.json +19 -19
  76. package/dist/capabilities/commandcode.json +145 -145
  77. package/dist/capabilities/concentrate.json +278 -295
  78. package/dist/capabilities/cortecs.json +109 -109
  79. package/dist/capabilities/crossmodel.json +200 -200
  80. package/dist/capabilities/crusoe.json +10 -10
  81. package/dist/capabilities/daoxe.json +6 -6
  82. package/dist/capabilities/databricks.json +124 -124
  83. package/dist/capabilities/deepinfra.json +98 -89
  84. package/dist/capabilities/deepseek.json +4 -4
  85. package/dist/capabilities/digitalocean.json +113 -113
  86. package/dist/capabilities/dothoosh.json +27 -27
  87. package/dist/capabilities/doubleword.json +23 -23
  88. package/dist/capabilities/edenai.json +283 -292
  89. package/dist/capabilities/empiriolabs.json +159 -159
  90. package/dist/capabilities/engy.json +23 -23
  91. package/dist/capabilities/entrim.json +2 -2
  92. package/dist/capabilities/evroc.json +16 -16
  93. package/dist/capabilities/ezkielyna.json +10 -10
  94. package/dist/capabilities/fastrouter.json +82 -82
  95. package/dist/capabilities/fireworks-ai.json +126 -65
  96. package/dist/capabilities/freemodel.json +15 -15
  97. package/dist/capabilities/friendli.json +8 -8
  98. package/dist/capabilities/frogbot.json +95 -95
  99. package/dist/capabilities/gisoo.json +15 -15
  100. package/dist/capabilities/gmicloud.json +13 -13
  101. package/dist/capabilities/google.json +54 -54
  102. package/dist/capabilities/graphn.json +16 -16
  103. package/dist/capabilities/greenpt.json +35 -35
  104. package/dist/capabilities/groq.json +9 -9
  105. package/dist/capabilities/helicone.json +84 -84
  106. package/dist/capabilities/hopper.json +2 -2
  107. package/dist/capabilities/hostinger-router.json +11 -11
  108. package/dist/capabilities/hpc-ai.json +7 -7
  109. package/dist/capabilities/huawei-maas.json +15 -15
  110. package/dist/capabilities/hubris.json +32 -32
  111. package/dist/capabilities/huggingface.json +118 -78
  112. package/dist/capabilities/hyper.json +20 -28
  113. package/dist/capabilities/impossibl.json +123 -123
  114. package/dist/capabilities/inception.json +3 -3
  115. package/dist/capabilities/inceptron.json +2 -2
  116. package/dist/capabilities/inco.json +5 -5
  117. package/dist/capabilities/infer.json +16 -16
  118. package/dist/capabilities/inferall.json +14 -14
  119. package/dist/capabilities/inference-coop.json +8 -8
  120. package/dist/capabilities/inferenceapis.json +15 -15
  121. package/dist/capabilities/inferris.json +2 -2
  122. package/dist/capabilities/infersia.json +9 -9
  123. package/dist/capabilities/inferx.json +2 -2
  124. package/dist/capabilities/infomaniak.json +4 -4
  125. package/dist/capabilities/io-net.json +2 -2
  126. package/dist/capabilities/isoquant.json +4 -4
  127. package/dist/capabilities/iteracompute.json +54 -54
  128. package/dist/capabilities/jalapeno.json +11 -11
  129. package/dist/capabilities/jiekou.json +63 -63
  130. package/dist/capabilities/jzstoken.json +50 -50
  131. package/dist/capabilities/keln.json +18 -18
  132. package/dist/capabilities/kenari.json +118 -126
  133. package/dist/capabilities/kilo.json +632 -638
  134. package/dist/capabilities/kimi-code-plan-cn.json +5 -5
  135. package/dist/capabilities/kimi-code-plan-global.json +5 -5
  136. package/dist/capabilities/klavo.json +20 -20
  137. package/dist/capabilities/korouter.json +34 -34
  138. package/dist/capabilities/kunavo.json +10 -10
  139. package/dist/capabilities/liquid.json +13 -13
  140. package/dist/capabilities/lithosai.json +2 -2
  141. package/dist/capabilities/llmgateway-providers.json +973 -917
  142. package/dist/capabilities/llmgateway.json +333 -333
  143. package/dist/capabilities/llmtr.json +29 -29
  144. package/dist/capabilities/logits.json +2 -2
  145. package/dist/capabilities/lowrouter.json +54 -54
  146. package/dist/capabilities/lyceum.json +14 -14
  147. package/dist/capabilities/melious.json +15 -15
  148. package/dist/capabilities/merge-gateway.json +244 -244
  149. package/dist/capabilities/meta.json +8 -8
  150. package/dist/capabilities/minimax-cn-coding-plan.json +5 -5
  151. package/dist/capabilities/minimax-cn.json +5 -5
  152. package/dist/capabilities/minimax-coding-plan.json +5 -5
  153. package/dist/capabilities/minimax.json +5 -5
  154. package/dist/capabilities/mistral.json +17 -17
  155. package/dist/capabilities/mixlayer.json +2 -2
  156. package/dist/capabilities/modal.json +10 -10
  157. package/dist/capabilities/model-oracle-ai.json +25 -25
  158. package/dist/capabilities/modelis.json +24 -24
  159. package/dist/capabilities/modelscope.json +2 -2
  160. package/dist/capabilities/modular.json +9 -9
  161. package/dist/capabilities/moneo.json +14 -14
  162. package/dist/capabilities/moonshotai-cn.json +7 -7
  163. package/dist/capabilities/moonshotai.json +7 -7
  164. package/dist/capabilities/morph.json +13 -13
  165. package/dist/capabilities/munito-eu.json +8 -8
  166. package/dist/capabilities/munito.json +8 -8
  167. package/dist/capabilities/nan.json +25 -25
  168. package/dist/capabilities/nano-gpt.json +573 -554
  169. package/dist/capabilities/nearai.json +89 -89
  170. package/dist/capabilities/nebius.json +30 -30
  171. package/dist/capabilities/neon.json +128 -128
  172. package/dist/capabilities/neuralwatt.json +41 -41
  173. package/dist/capabilities/novita-ai.json +171 -171
  174. package/dist/capabilities/nvidia.json +40 -40
  175. package/dist/capabilities/oathbreaker.json +2 -2
  176. package/dist/capabilities/obscurify.json +21 -21
  177. package/dist/capabilities/oci.json +10 -10
  178. package/dist/capabilities/ofox.json +375 -375
  179. package/dist/capabilities/ollama-cloud.json +51 -51
  180. package/dist/capabilities/openai.json +53 -53
  181. package/dist/capabilities/opencode-go.json +86 -86
  182. package/dist/capabilities/openreason.json +5 -5
  183. package/dist/capabilities/openrouter.json +557 -546
  184. package/dist/capabilities/opper.json +29 -29
  185. package/dist/capabilities/orcarouter.json +254 -254
  186. package/dist/capabilities/outerlabs.json +29 -29
  187. package/dist/capabilities/ovhcloud.json +23 -23
  188. package/dist/capabilities/pendra.json +4 -4
  189. package/dist/capabilities/perplexity-agent.json +55 -55
  190. package/dist/capabilities/perplexity.json +2 -2
  191. package/dist/capabilities/phala.json +34 -34
  192. package/dist/capabilities/pioneer.json +30 -30
  193. package/dist/capabilities/poe.json +126 -126
  194. package/dist/capabilities/powerspring.json +11 -11
  195. package/dist/capabilities/primalabs.json +10 -10
  196. package/dist/capabilities/prime.json +120 -119
  197. package/dist/capabilities/privatemode-ai.json +10 -10
  198. package/dist/capabilities/proxystacks.json +7 -7
  199. package/dist/capabilities/qiniu-ai.json +14 -14
  200. package/dist/capabilities/refuseless.json +9 -9
  201. package/dist/capabilities/regolo-ai.json +5 -5
  202. package/dist/capabilities/requesty.json +167 -190
  203. package/dist/capabilities/ruapi.json +17 -17
  204. package/dist/capabilities/runcrate.json +9 -9
  205. package/dist/capabilities/runinfra.json +10 -10
  206. package/dist/capabilities/sakana.json +6 -6
  207. package/dist/capabilities/sambanova.json +8 -8
  208. package/dist/capabilities/sandbase.json +21 -21
  209. package/dist/capabilities/sarvam.json +5 -5
  210. package/dist/capabilities/scaleway.json +18 -18
  211. package/dist/capabilities/scnet-token-plan.json +10 -10
  212. package/dist/capabilities/scx-ai.json +32 -32
  213. package/dist/capabilities/sensenova.json +14 -14
  214. package/dist/capabilities/siliconflow-cn.json +44 -44
  215. package/dist/capabilities/siliconflow.json +53 -53
  216. package/dist/capabilities/snowflake-cortex.json +22 -22
  217. package/dist/capabilities/sokkan.json +9 -9
  218. package/dist/capabilities/sparrowcodes.json +19 -19
  219. package/dist/capabilities/standardcompute.json +90 -90
  220. package/dist/capabilities/steadyrouter.json +42 -42
  221. package/dist/capabilities/stepfun-ai-step-plan.json +2 -2
  222. package/dist/capabilities/stepfun-ai.json +2 -2
  223. package/dist/capabilities/stepfun-step-plan.json +2 -2
  224. package/dist/capabilities/stepfun.json +2 -2
  225. package/dist/capabilities/stepping-stone.json +19 -19
  226. package/dist/capabilities/synthetic.json +10 -10
  227. package/dist/capabilities/synthorai.json +24 -24
  228. package/dist/capabilities/teamorouter.json +23 -23
  229. package/dist/capabilities/teapot-router.json +12 -12
  230. package/dist/capabilities/tencent-token-plan-intl.json +126 -0
  231. package/dist/capabilities/tencent-token-plan.json +39 -39
  232. package/dist/capabilities/tencent-tokenhub.json +56 -41
  233. package/dist/capabilities/tensorx.json +50 -50
  234. package/dist/capabilities/tenstorrent.json +6 -6
  235. package/dist/capabilities/the-grid-ai.json +33 -33
  236. package/dist/capabilities/thinkingmachines.json +77 -77
  237. package/dist/capabilities/tinfoil.json +12 -12
  238. package/dist/capabilities/toapis.json +2 -2
  239. package/dist/capabilities/togetherai.json +41 -41
  240. package/dist/capabilities/tokengo.json +22 -22
  241. package/dist/capabilities/tokenify.json +3 -3
  242. package/dist/capabilities/trustedrouter.json +7 -7
  243. package/dist/capabilities/trustedtokens.json +17 -17
  244. package/dist/capabilities/umans-ai-coding-plan.json +11 -11
  245. package/dist/capabilities/umans-ai.json +8 -8
  246. package/dist/capabilities/uncensuredai.json +5 -5
  247. package/dist/capabilities/unrestricted.json +4 -4
  248. package/dist/capabilities/uplinkswitch.json +21 -21
  249. package/dist/capabilities/upstage.json +6 -6
  250. package/dist/capabilities/vancine.json +24 -24
  251. package/dist/capabilities/vercel.json +582 -582
  252. package/dist/capabilities/vivgrid.json +86 -86
  253. package/dist/capabilities/volcengine-coding-plan.json +29 -29
  254. package/dist/capabilities/volcengine.json +23 -23
  255. package/dist/capabilities/vultr.json +27 -27
  256. package/dist/capabilities/wafer.ai.json +18 -18
  257. package/dist/capabilities/wallaby.json +2 -2
  258. package/dist/capabilities/wally.json +11 -11
  259. package/dist/capabilities/wandb.json +21 -21
  260. package/dist/capabilities/watt.json +20 -20
  261. package/dist/capabilities/xai.json +5 -5
  262. package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
  263. package/dist/capabilities/xiaomi-token-plan-cn.json +2 -2
  264. package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
  265. package/dist/capabilities/xiaomi.json +2 -2
  266. package/dist/capabilities/xpersona.json +10 -10
  267. package/dist/capabilities/xxapi.json +28 -28
  268. package/dist/capabilities/zai-coding-plan.json +18 -18
  269. package/dist/capabilities/zai.json +27 -27
  270. package/dist/capabilities/zenifra.json +26 -26
  271. package/dist/capabilities/zenmux.json +200 -200
  272. package/dist/capabilities/zerogpu.json +13 -13
  273. package/dist/capabilities/zhipuai-coding-plan.json +8 -8
  274. package/dist/capabilities/zhipuai.json +26 -26
  275. package/dist/capabilities/zro.json +7 -7
  276. package/dist/channels/agent-channels.d.ts +22 -0
  277. package/dist/channels/index.cjs +2 -2
  278. package/dist/channels/index.js +2 -2
  279. package/dist/channels/output-processor.d.ts +12 -0
  280. package/dist/channels/state-adapter.d.ts +3 -1
  281. package/dist/channels/stream-helpers.d.ts +17 -0
  282. package/dist/{channels-0AO7PMJF.js → channels-CC2Z4adP.js} +1 -1
  283. package/dist/{channels-BZL9RT2i.cjs → channels-Drxs9g13.cjs} +1 -1
  284. package/dist/coding-agent/index.cjs +2 -2
  285. package/dist/coding-agent/index.js +2 -2
  286. package/dist/{constants-B9ZDvXZ4.cjs → constants-Bou0hEgY.cjs} +4 -0
  287. package/dist/{constants-BmdTvEYN.js → constants-CFWgIaqA.js} +4 -0
  288. package/dist/datasets/experiment/scorer.d.ts +16 -5
  289. package/dist/datasets/index.cjs +2 -2
  290. package/dist/datasets/index.js +2 -2
  291. package/dist/docs/SKILL.md +2 -1
  292. package/dist/docs/assets/SOURCE_MAP.json +1032 -1032
  293. package/dist/docs/references/docs-agents-networks.md +1 -1
  294. package/dist/docs/references/docs-agents-tools.md +6 -0
  295. package/dist/docs/references/docs-auth-simple-auth.md +8 -8
  296. package/dist/docs/references/docs-evals-custom-scorers.md +1 -1
  297. package/dist/docs/references/docs-mastra-platform-observability-overview.md +3 -189
  298. package/dist/docs/references/docs-memory-message-history.md +25 -0
  299. package/dist/docs/references/docs-sandbox-lsp.md +5 -6
  300. package/dist/docs/references/docs-sandbox-overview.md +20 -0
  301. package/dist/docs/references/docs-sandbox-skills.md +2 -0
  302. package/dist/docs/references/docs-signals-sending-signals.md +1 -1
  303. package/dist/docs/references/reference-agent-controller-session.md +1 -1
  304. package/dist/docs/references/reference-agents-generate.md +1 -1
  305. package/dist/docs/references/reference-agents-network.md +1 -1
  306. package/dist/docs/references/reference-configuration.md +8 -8
  307. package/dist/docs/references/reference-core-getWorkspaceById.md +37 -0
  308. package/dist/docs/references/reference-evals-create-scorer.md +5 -5
  309. package/dist/docs/references/reference-evals-run-evals.md +1 -1
  310. package/dist/docs/references/reference-knowledge-knowledge-tools.md +3 -3
  311. package/dist/docs/references/reference-manual-install.md +1 -1
  312. package/dist/docs/references/reference-memory-observational-memory.md +8 -0
  313. package/dist/docs/references/reference-observability-tracing-interfaces.md +10 -6
  314. package/dist/docs/references/reference-processors-processor-interface.md +3 -2
  315. package/dist/docs/references/reference-processors-system-prompt-scrubber.md +1 -1
  316. package/dist/docs/references/reference-pubsub-base.md +5 -3
  317. package/dist/docs/references/reference-pubsub-caching-pubsub.md +3 -1
  318. package/dist/docs/references/reference-storage-overview.md +1 -1
  319. package/dist/docs/references/reference-storage-retention.md +20 -20
  320. package/dist/docs/references/reference-tools-vector-query-tool.md +8 -0
  321. package/dist/docs/references/reference-voice-overview.md +11 -26
  322. package/dist/docs/references/reference-voice-speech-to-speech.md +1 -1
  323. package/dist/docs/references/reference-voice-voice.listen.md +1 -0
  324. package/dist/docs/references/reference-voice-voice.speak.md +1 -3
  325. package/dist/docs/references/reference-workspace-factory-sandbox.md +6 -6
  326. package/dist/docs/references/reference-workspace-sandbox.md +14 -0
  327. package/dist/docs/references/reference.md +1 -0
  328. package/dist/evals/index.cjs +2 -2
  329. package/dist/evals/index.js +2 -2
  330. package/dist/evals/scoreTraces/index.cjs +2 -2
  331. package/dist/evals/scoreTraces/index.js +2 -2
  332. package/dist/harness/index.cjs +2 -2
  333. package/dist/harness/index.js +2 -2
  334. package/dist/index.cjs +1 -1
  335. package/dist/index.js +1 -1
  336. package/dist/knowledge/index.cjs +51 -16
  337. package/dist/knowledge/index.js +51 -16
  338. package/dist/knowledge/page-tools.d.ts +9 -0
  339. package/dist/knowledge/scope-runtime.d.ts +6 -0
  340. package/dist/llm/index.cjs +3 -3
  341. package/dist/llm/index.js +3 -3
  342. package/dist/llm/model/base.types.d.ts +3 -1
  343. package/dist/llm/model/mastra-gateway-provider-tools.d.ts +9 -6
  344. package/dist/llm/model/model.d.ts +1 -1
  345. package/dist/llm/model/model.loop.d.ts +1 -1
  346. package/dist/llm/model/model.loop.types.d.ts +3 -1
  347. package/dist/llm/model/provider-options.d.ts +4 -3
  348. package/dist/llm/model/provider-types.generated.d.ts +7932 -7894
  349. package/dist/{llm-B4AeSFvV.cjs → llm-CbpBEabY.cjs} +38 -78
  350. package/dist/{llm-B46V7Mi7.js → llm-D3y8qOKL.js} +38 -78
  351. package/dist/loop/index.cjs +2 -2
  352. package/dist/loop/index.js +2 -2
  353. package/dist/{manager-BwDxA1Nn.cjs → manager-BOn6RJwA.cjs} +106 -35
  354. package/dist/{manager-BRAvwB9b.js → manager-elIuArZa.js} +106 -35
  355. package/dist/mastra/index.cjs +1 -1
  356. package/dist/mastra/index.js +1 -1
  357. package/dist/{mastra-DBhdD172.cjs → mastra-CDQJWY6v.cjs} +16 -16
  358. package/dist/{mastra-CIx6qEq2.js → mastra-DQjco6Bt.js} +16 -16
  359. package/dist/memory/index.cjs +3 -3
  360. package/dist/memory/index.js +3 -3
  361. package/dist/{message-list-wI71UGxk.js → message-list-BGm1DCiG.js} +230 -129
  362. package/dist/{message-list-DfN9mWeN.cjs → message-list-vR3uLAHL.cjs} +230 -129
  363. package/dist/{model-CJMsDU8w.js → model-BjyU1L4I.js} +4 -3
  364. package/dist/{model-CYhAa5qO.cjs → model-C4aI7k-i.cjs} +4 -3
  365. package/dist/{netlify-Bw7Vd58y.cjs → netlify-BjuUEMrL.cjs} +41364 -30461
  366. package/dist/{netlify-C9aJA6Cv.js → netlify-BpB7PtZV.js} +41361 -30464
  367. package/dist/notifications/index.cjs +1 -1
  368. package/dist/notifications/index.js +1 -1
  369. package/dist/observability/types/tracing.d.ts +1 -1
  370. package/dist/processor-provider/index.cjs +1 -1
  371. package/dist/processor-provider/index.js +1 -1
  372. package/dist/processors/index.cjs +2 -2
  373. package/dist/processors/index.js +2 -2
  374. package/dist/{provider-registry-DOfYSEju.js → provider-registry-BjdxtGZZ.js} +22658 -22514
  375. package/dist/{provider-registry-Bn_7VvZ8.cjs → provider-registry-bkFdaY45.cjs} +22657 -22513
  376. package/dist/provider-registry.json +22617 -22527
  377. package/dist/{registry-generator-BnK5Npgr.cjs → registry-generator-BORKO0_T.cjs} +1 -1
  378. package/dist/{registry-generator-Cw594Ttt.js → registry-generator-CPF318Kc.js} +1 -1
  379. package/dist/{rehydrate-BWnd_TEx.cjs → rehydrate-Cps4MTph.cjs} +2 -2
  380. package/dist/{rehydrate-Dgqkw7Py.js → rehydrate-Cw2Id-Uz.js} +2 -2
  381. package/dist/relevance/index.cjs +2 -2
  382. package/dist/relevance/index.js +2 -2
  383. package/dist/{run-registry-lLRc7EE6.cjs → run-registry-BTFPEkXT.cjs} +368 -92
  384. package/dist/{run-registry-DhOKJtlb.js → run-registry-D5z2YVqJ.js} +356 -92
  385. package/dist/storage/constants.cjs +1 -1
  386. package/dist/storage/constants.js +1 -1
  387. package/dist/storage/domains/knowledge/base.d.ts +16 -1
  388. package/dist/storage/domains/knowledge/importers-inmemory.d.ts +1 -0
  389. package/dist/storage/domains/knowledge/importers.d.ts +8 -0
  390. package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
  391. package/dist/storage/domains/knowledge/pages-inmemory.d.ts +5 -1
  392. package/dist/storage/index.cjs +3 -3
  393. package/dist/storage/index.js +3 -3
  394. package/dist/storage/types.d.ts +8 -0
  395. package/dist/stream/index.cjs +2 -2
  396. package/dist/stream/index.js +2 -2
  397. package/dist/{stream-BIDts1fZ.cjs → stream-D1OnBHDi.cjs} +3 -3
  398. package/dist/{stream-C8HKG3qC.js → stream-DB5efioT.js} +3 -3
  399. package/dist/test-utils/llm-mock.cjs +1 -1
  400. package/dist/test-utils/llm-mock.js +1 -1
  401. package/dist/{to-prompt-B9eZo2U5.cjs → to-prompt-CG-LyaBY.cjs} +9 -0
  402. package/dist/{to-prompt-BsDtVXrf.js → to-prompt-CMlVGYxC.js} +9 -0
  403. package/dist/tool-loop-agent/index.cjs +1 -1
  404. package/dist/tool-loop-agent/index.js +1 -1
  405. package/dist/{tool-loop-agent-DM5V_0XS.js → tool-loop-agent-DkhFVx0h.js} +4 -4
  406. package/dist/{tool-loop-agent-PEY5a1R6.cjs → tool-loop-agent-Ote8gJMn.cjs} +4 -4
  407. package/dist/tools/index.cjs +1 -1
  408. package/dist/tools/index.js +1 -1
  409. package/dist/{tools-CDfyMpzN.js → tools-DDfA_ES4.js} +113 -31
  410. package/dist/{tools-CGF5Ik6j.cjs → tools-n9lqzDNe.cjs} +113 -31
  411. package/dist/{utils-DcnKVK34.js → utils-BTKpGHA6.js} +1 -1
  412. package/dist/{utils-CxMSu_wc.cjs → utils-Dl_UFejV.cjs} +1 -1
  413. package/dist/utils.cjs +1 -1
  414. package/dist/utils.js +1 -1
  415. package/dist/{validate-Dn750ciE.js → validate-D6fUqYGz.js} +1 -1
  416. package/dist/{validate-RVKgazCf.cjs → validate-DdDuQRoZ.cjs} +1 -1
  417. package/dist/vector/index.cjs +2 -2
  418. package/dist/vector/index.js +2 -2
  419. package/dist/worker/index.cjs +1 -1
  420. package/dist/worker/index.js +1 -1
  421. package/dist/{worker-Dx0ZHMGX.cjs → worker-B27B9RlK.cjs} +2 -2
  422. package/dist/{worker-SDi9jbP5.js → worker-Bo_hTQJC.js} +2 -2
  423. package/dist/{worker-DJPAdazC.js → worker-DC269pGx.js} +2 -2
  424. package/dist/{worker-CFPu9qwV.cjs → worker-mq-oiLa5.cjs} +2 -2
  425. package/dist/{workflow-ZFOz_365.cjs → workflow-D61dV4AC.cjs} +3 -3
  426. package/dist/{workflow-DkBqNn7X.js → workflow-D97r3h2-.js} +3 -3
  427. package/dist/workflows/builder/index.cjs +1 -1
  428. package/dist/workflows/builder/index.js +1 -1
  429. package/dist/workflows/evented/index.cjs +1 -1
  430. package/dist/workflows/evented/index.js +1 -1
  431. package/dist/workflows/index.cjs +4 -4
  432. package/dist/workflows/index.js +4 -4
  433. package/dist/workflows/step.d.ts +2 -0
  434. package/dist/workflows/workflow.d.ts +2 -0
  435. package/dist/workspace/index.cjs +3 -1
  436. package/dist/workspace/index.d.ts +1 -1
  437. package/dist/workspace/index.js +2 -2
  438. package/dist/workspace/lsp/manager.d.ts +19 -4
  439. package/dist/workspace/sandbox/mastra-sandbox.d.ts +17 -0
  440. package/dist/workspace/tools/index.d.ts +1 -0
  441. package/dist/workspace/tools/media.d.ts +20 -1
  442. package/dist/workspace/tools/recreate-sandbox.d.ts +24 -0
  443. package/dist/{workspace-DY2Nxiyi.js → workspace-BK9ltbSa.js} +270 -105
  444. package/dist/{workspace-X2RHJZU9.cjs → workspace-Pv3J8K0c.cjs} +281 -104
  445. package/package.json +9 -9
  446. 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-Bw7Vd58y.cjs");
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-B9eZo2U5.cjs");
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-Bn_7VvZ8.cjs");
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
- let sanitizedOptions = this.stripUnsupportedSamplingParams(options);
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
- let sanitizedOptions = this.stripUnsupportedSamplingParams(options);
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
- if (parts.length !== 2) throw new Error(`Invalid model string format: "${config.id}". Expected format: "provider/model"`);
9417
- const [providerId, modelId] = parts;
9418
- normalizedConfig = {
9419
- providerId,
9420
- modelId,
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
- if (!providerConfig.url) throw new Error(`Provider ${normalizedConfig.providerId} does not have a URL configured`);
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(providerConfig.url)
9432
+ baseURL: require_netlify.interpolateUrlTemplate(providerUrl)
9473
9433
  }).embeddingModel(normalizedConfig.modelId);
9474
9434
  }
9475
9435
  }
@@ -1,9 +1,9 @@
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";
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-BsDtVXrf.js";
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-DOfYSEju.js";
6
- import { i as MastraError, n as ErrorDomain, t as ErrorCategory } from "./error-oh2DLsP2.js";
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
- let sanitizedOptions = this.stripUnsupportedSamplingParams(options);
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
- let sanitizedOptions = this.stripUnsupportedSamplingParams(options);
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
- if (parts.length !== 2) throw new Error(`Invalid model string format: "${config.id}". Expected format: "provider/model"`);
9415
- const [providerId, modelId] = parts;
9416
- normalizedConfig = {
9417
- providerId,
9418
- modelId,
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
- if (!providerConfig.url) throw new Error(`Provider ${normalizedConfig.providerId} does not have a URL configured`);
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(providerConfig.url)
9430
+ baseURL: interpolateUrlTemplate(providerUrl)
9471
9431
  }).embeddingModel(normalizedConfig.modelId);
9472
9432
  }
9473
9433
  }
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_run_registry = require("../run-registry-lLRc7EE6.cjs");
3
- const require_stream = require("../stream-BIDts1fZ.cjs");
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;
@@ -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-DhOKJtlb.js";
2
- import { Cn as isMastraTimeoutError, vn as MastraTimeoutError, yn as createTimeoutAbortSignal } from "../stream-C8HKG3qC.js";
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-lLRc7EE6.cjs");
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-BIDts1fZ.cjs");
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-B9ZDvXZ4.cjs");
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
- * 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.
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 resolution = (async () => {
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 { flat, steps } = flattenScorerConfig(scorers);
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
- const resolveScorerEntries = createScorerResolver(mastra);
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) await experimentsStore.createExperiment({
2822
- id: experimentId,
2823
- datasetId: this.id,
2824
- datasetVersion: targetVersion,
2825
- targetType: config.targetType ?? "agent",
2826
- targetId: config.targetId ?? "inline",
2827
- totalItems,
2828
- name: config.name,
2829
- description: config.description,
2830
- metadata: withAgentModelMetadata(config.metadata, config.agentModel),
2831
- provenance: config.provenance,
2832
- experimentSetId: config.grouping?.experimentSetId,
2833
- comparisonId: config.grouping?.comparisonId,
2834
- variantId: config.grouping?.variantId,
2835
- trialIndex: config.grouping?.trialIndex,
2836
- agentVersion: config.agentVersion,
2837
- organizationId: dataset.organizationId ?? null,
2838
- projectId: dataset.projectId ?? null,
2839
- ...durableRun ? { scorerIds: durableRun.scorerIds ?? null } : {}
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,