@mastra/core 1.0.0-beta.2 → 1.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/CHANGELOG.md +206 -0
  2. package/dist/agent/agent-legacy.d.ts +2 -2
  3. package/dist/agent/agent-legacy.d.ts.map +1 -1
  4. package/dist/agent/agent.d.ts +1 -1
  5. package/dist/agent/agent.d.ts.map +1 -1
  6. package/dist/agent/agent.types.d.ts +3 -2
  7. package/dist/agent/agent.types.d.ts.map +1 -1
  8. package/dist/agent/index.cjs +9 -9
  9. package/dist/agent/index.js +2 -2
  10. package/dist/agent/message-list/index.cjs +3 -3
  11. package/dist/agent/message-list/index.d.ts +5 -0
  12. package/dist/agent/message-list/index.d.ts.map +1 -1
  13. package/dist/agent/message-list/index.js +1 -1
  14. package/dist/agent/message-list/prompt/convert-file.d.ts +1 -1
  15. package/dist/agent/message-list/prompt/convert-file.d.ts.map +1 -1
  16. package/dist/agent/message-list/prompt/download-assets.d.ts.map +1 -1
  17. package/dist/agent/types.d.ts +1 -0
  18. package/dist/agent/types.d.ts.map +1 -1
  19. package/dist/agent/utils.d.ts.map +1 -1
  20. package/dist/agent/workflows/prepare-stream/index.d.ts +2 -1
  21. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  22. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +3 -1
  23. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  24. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +2 -1
  25. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
  26. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +2 -1
  27. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  28. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +3 -1
  29. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  30. package/dist/{chunk-YCVEJ3UN.cjs → chunk-2NVBZKZI.cjs} +988 -233
  31. package/dist/chunk-2NVBZKZI.cjs.map +1 -0
  32. package/dist/{chunk-SNPVZPLB.js → chunk-2OTDXX73.js} +6 -5
  33. package/dist/chunk-2OTDXX73.js.map +1 -0
  34. package/dist/chunk-3PSWNGBF.js +3 -0
  35. package/dist/{chunk-ZV5CC35D.js.map → chunk-3PSWNGBF.js.map} +1 -1
  36. package/dist/{chunk-ZGHTOYHW.js → chunk-3RW5EMSB.js} +155 -24
  37. package/dist/chunk-3RW5EMSB.js.map +1 -0
  38. package/dist/chunk-3W5RQCCY.cjs +440 -0
  39. package/dist/chunk-3W5RQCCY.cjs.map +1 -0
  40. package/dist/{chunk-ET6UOTTU.cjs → chunk-4IKJAKCD.cjs} +40 -4
  41. package/dist/chunk-4IKJAKCD.cjs.map +1 -0
  42. package/dist/{chunk-2ZVKF4HP.cjs → chunk-4RXG622P.cjs} +184 -285
  43. package/dist/chunk-4RXG622P.cjs.map +1 -0
  44. package/dist/{chunk-22443P6A.cjs → chunk-5WXEYDFI.cjs} +173 -42
  45. package/dist/chunk-5WXEYDFI.cjs.map +1 -0
  46. package/dist/{chunk-ZWNI5IWX.cjs → chunk-CYVNOIXS.cjs} +13 -12
  47. package/dist/chunk-CYVNOIXS.cjs.map +1 -0
  48. package/dist/{chunk-4CDL2QJT.js → chunk-D6EDHNGV.js} +53 -16
  49. package/dist/chunk-D6EDHNGV.js.map +1 -0
  50. package/dist/chunk-FVNT7VTO.js +436 -0
  51. package/dist/chunk-FVNT7VTO.js.map +1 -0
  52. package/dist/{chunk-WM6CK2F3.cjs → chunk-HBJPYQRN.cjs} +57 -19
  53. package/dist/chunk-HBJPYQRN.cjs.map +1 -0
  54. package/dist/{chunk-HDJFSJCK.js → chunk-IHJDOC3A.js} +35 -587
  55. package/dist/chunk-IHJDOC3A.js.map +1 -0
  56. package/dist/{chunk-QUKUN6NR.cjs → chunk-ISMGVGUM.cjs} +105 -5
  57. package/dist/chunk-ISMGVGUM.cjs.map +1 -0
  58. package/dist/{chunk-JYYQQEBH.cjs → chunk-IWB65P37.cjs} +241 -4
  59. package/dist/chunk-IWB65P37.cjs.map +1 -0
  60. package/dist/{chunk-MV7KHWUT.js → chunk-IWQDBVJK.js} +25 -4
  61. package/dist/chunk-IWQDBVJK.js.map +1 -0
  62. package/dist/{chunk-XEVG546F.js → chunk-JXESKY4A.js} +3 -3
  63. package/dist/{chunk-XEVG546F.js.map → chunk-JXESKY4A.js.map} +1 -1
  64. package/dist/{chunk-7AHYOMHJ.js → chunk-KEURQGCQ.js} +40 -5
  65. package/dist/chunk-KEURQGCQ.js.map +1 -0
  66. package/dist/{chunk-JPGVRWWL.js → chunk-MDKPL2R2.js} +470 -124
  67. package/dist/chunk-MDKPL2R2.js.map +1 -0
  68. package/dist/{chunk-UIZSWUKP.js → chunk-NZAXAFI3.js} +104 -6
  69. package/dist/chunk-NZAXAFI3.js.map +1 -0
  70. package/dist/{chunk-VOY2RXOC.cjs → chunk-O6NA3Z43.cjs} +6 -6
  71. package/dist/{chunk-VOY2RXOC.cjs.map → chunk-O6NA3Z43.cjs.map} +1 -1
  72. package/dist/chunk-PE3V7GUL.cjs +4 -0
  73. package/dist/{chunk-LJFJTTZQ.cjs.map → chunk-PE3V7GUL.cjs.map} +1 -1
  74. package/dist/{chunk-I4CXL4SR.js → chunk-RXDJL5QT.js} +5 -4
  75. package/dist/chunk-RXDJL5QT.js.map +1 -0
  76. package/dist/{chunk-LWBQ4P4N.cjs → chunk-S6OEQHEI.cjs} +62 -614
  77. package/dist/chunk-S6OEQHEI.cjs.map +1 -0
  78. package/dist/{chunk-7PO6SEJF.js → chunk-U7VECK2G.js} +240 -3
  79. package/dist/chunk-U7VECK2G.js.map +1 -0
  80. package/dist/{chunk-ECFXGXWO.cjs → chunk-VSM3NLUX.cjs} +312 -210
  81. package/dist/chunk-VSM3NLUX.cjs.map +1 -0
  82. package/dist/{chunk-IQO7ANVS.cjs → chunk-VZC4BWWH.cjs} +10 -9
  83. package/dist/chunk-VZC4BWWH.cjs.map +1 -0
  84. package/dist/{chunk-JV2KH24V.js → chunk-W3DD3XP5.js} +312 -210
  85. package/dist/chunk-W3DD3XP5.js.map +1 -0
  86. package/dist/{chunk-GGYKYORQ.cjs → chunk-WQSGX6XA.cjs} +27 -6
  87. package/dist/chunk-WQSGX6XA.cjs.map +1 -0
  88. package/dist/{chunk-W7UH2PWL.js → chunk-WTYNK7Q4.js} +179 -282
  89. package/dist/chunk-WTYNK7Q4.js.map +1 -0
  90. package/dist/{chunk-7CBEP2ZQ.js → chunk-XXBWX7DT.js} +949 -197
  91. package/dist/chunk-XXBWX7DT.js.map +1 -0
  92. package/dist/{chunk-CB575O6L.cjs → chunk-ZCVTH3CH.cjs} +470 -130
  93. package/dist/chunk-ZCVTH3CH.cjs.map +1 -0
  94. package/dist/evals/base.d.ts.map +1 -1
  95. package/dist/evals/index.cjs +4 -4
  96. package/dist/evals/index.js +1 -1
  97. package/dist/evals/scoreTraces/index.cjs +5 -4
  98. package/dist/evals/scoreTraces/index.cjs.map +1 -1
  99. package/dist/evals/scoreTraces/index.js +3 -2
  100. package/dist/evals/scoreTraces/index.js.map +1 -1
  101. package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
  102. package/dist/index.cjs +2 -2
  103. package/dist/index.js +1 -1
  104. package/dist/integration/index.cjs +2 -2
  105. package/dist/integration/index.js +1 -1
  106. package/dist/llm/index.cjs +26 -10
  107. package/dist/llm/index.d.ts +1 -0
  108. package/dist/llm/index.d.ts.map +1 -1
  109. package/dist/llm/index.js +5 -1
  110. package/dist/llm/model/aisdk/v5/model.d.ts +47 -0
  111. package/dist/llm/model/aisdk/v5/model.d.ts.map +1 -0
  112. package/dist/llm/model/gateways/base.d.ts +8 -0
  113. package/dist/llm/model/gateways/base.d.ts.map +1 -1
  114. package/dist/llm/model/gateways/models-dev.d.ts +1 -0
  115. package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
  116. package/dist/llm/model/gateways/netlify.d.ts +2 -1
  117. package/dist/llm/model/gateways/netlify.d.ts.map +1 -1
  118. package/dist/llm/model/is-v2-model.d.ts +3 -0
  119. package/dist/llm/model/is-v2-model.d.ts.map +1 -0
  120. package/dist/llm/model/model-method-from-agent.d.ts +4 -0
  121. package/dist/llm/model/model-method-from-agent.d.ts.map +1 -0
  122. package/dist/llm/model/model.loop.d.ts +2 -2
  123. package/dist/llm/model/model.loop.d.ts.map +1 -1
  124. package/dist/llm/model/model.loop.types.d.ts +2 -0
  125. package/dist/llm/model/model.loop.types.d.ts.map +1 -1
  126. package/dist/llm/model/provider-registry.d.ts +11 -1
  127. package/dist/llm/model/provider-registry.d.ts.map +1 -1
  128. package/dist/llm/model/provider-types.generated.d.ts +56 -7
  129. package/dist/llm/model/registry-generator.d.ts.map +1 -1
  130. package/dist/llm/model/resolve-model.d.ts +1 -1
  131. package/dist/llm/model/resolve-model.d.ts.map +1 -1
  132. package/dist/llm/model/router.d.ts +12 -5
  133. package/dist/llm/model/router.d.ts.map +1 -1
  134. package/dist/llm/model/shared.types.d.ts +10 -4
  135. package/dist/llm/model/shared.types.d.ts.map +1 -1
  136. package/dist/loop/index.cjs +2 -2
  137. package/dist/loop/index.js +1 -1
  138. package/dist/loop/network/index.d.ts.map +1 -1
  139. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts +37 -0
  140. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts.map +1 -0
  141. package/dist/loop/test-utils/fullStream.d.ts.map +1 -1
  142. package/dist/loop/test-utils/generateText.d.ts.map +1 -1
  143. package/dist/loop/test-utils/options.d.ts.map +1 -1
  144. package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
  145. package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
  146. package/dist/loop/test-utils/textStream.d.ts.map +1 -1
  147. package/dist/loop/test-utils/toUIMessageStream.d.ts.map +1 -1
  148. package/dist/loop/test-utils/tools.d.ts.map +1 -1
  149. package/dist/loop/test-utils/utils.d.ts +1 -1
  150. package/dist/loop/test-utils/utils.d.ts.map +1 -1
  151. package/dist/loop/types.d.ts +8 -3
  152. package/dist/loop/types.d.ts.map +1 -1
  153. package/dist/loop/workflows/agentic-execution/index.d.ts +12 -12
  154. package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
  155. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +9 -9
  156. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  157. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +4 -4
  158. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  159. package/dist/loop/workflows/agentic-loop/index.d.ts +13 -12
  160. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  161. package/dist/loop/workflows/run-state.d.ts +2 -2
  162. package/dist/loop/workflows/run-state.d.ts.map +1 -1
  163. package/dist/loop/workflows/schema.d.ts +4 -4
  164. package/dist/loop/workflows/stream.d.ts.map +1 -1
  165. package/dist/mastra/index.cjs +2 -2
  166. package/dist/mastra/index.d.ts +127 -3
  167. package/dist/mastra/index.d.ts.map +1 -1
  168. package/dist/mastra/index.js +1 -1
  169. package/dist/memory/index.cjs +8 -8
  170. package/dist/memory/index.js +4 -4
  171. package/dist/models-dev-6PRLJKVZ.js +3 -0
  172. package/dist/{models-dev-DNBKXHT4.js.map → models-dev-6PRLJKVZ.js.map} +1 -1
  173. package/dist/models-dev-WHMI5G6Y.cjs +12 -0
  174. package/dist/{models-dev-YBEEQIX6.cjs.map → models-dev-WHMI5G6Y.cjs.map} +1 -1
  175. package/dist/netlify-46I3SNNV.cjs +12 -0
  176. package/dist/{netlify-GWNGSIRZ.cjs.map → netlify-46I3SNNV.cjs.map} +1 -1
  177. package/dist/netlify-EBQ6YUC6.js +3 -0
  178. package/dist/{netlify-7G2L5VSH.js.map → netlify-EBQ6YUC6.js.map} +1 -1
  179. package/dist/processors/index.cjs +11 -11
  180. package/dist/processors/index.js +1 -1
  181. package/dist/provider-registry-HDG6UMUC.js +3 -0
  182. package/dist/provider-registry-HDG6UMUC.js.map +1 -0
  183. package/dist/provider-registry-RP2W4B24.cjs +40 -0
  184. package/dist/provider-registry-RP2W4B24.cjs.map +1 -0
  185. package/dist/provider-registry.json +140 -18
  186. package/dist/{registry-generator-MK63POJO.cjs → registry-generator-JPCV47SC.cjs} +6 -4
  187. package/dist/registry-generator-JPCV47SC.cjs.map +1 -0
  188. package/dist/{registry-generator-H4YNODDH.js → registry-generator-XD4FPZTU.js} +6 -4
  189. package/dist/registry-generator-XD4FPZTU.js.map +1 -0
  190. package/dist/relevance/index.cjs +2 -2
  191. package/dist/relevance/index.js +1 -1
  192. package/dist/server/auth.d.ts +11 -0
  193. package/dist/server/auth.d.ts.map +1 -1
  194. package/dist/server/index.cjs +12 -1
  195. package/dist/server/index.cjs.map +1 -1
  196. package/dist/server/index.d.ts +4 -0
  197. package/dist/server/index.d.ts.map +1 -1
  198. package/dist/server/index.js +12 -1
  199. package/dist/server/index.js.map +1 -1
  200. package/dist/storage/domains/workflows/inmemory.d.ts +1 -1
  201. package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
  202. package/dist/storage/index.cjs +29 -29
  203. package/dist/storage/index.js +1 -1
  204. package/dist/storage/types.d.ts +2 -1
  205. package/dist/storage/types.d.ts.map +1 -1
  206. package/dist/stream/RunOutput.d.ts +1 -1
  207. package/dist/stream/RunOutput.d.ts.map +1 -1
  208. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
  209. package/dist/stream/aisdk/v5/execute.d.ts +6 -3
  210. package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
  211. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  212. package/dist/stream/base/input.d.ts +1 -1
  213. package/dist/stream/base/output.d.ts.map +1 -1
  214. package/dist/stream/index.cjs +11 -11
  215. package/dist/stream/index.js +2 -2
  216. package/dist/stream/types.d.ts +4 -3
  217. package/dist/stream/types.d.ts.map +1 -1
  218. package/dist/test-utils/llm-mock.cjs +68 -31
  219. package/dist/test-utils/llm-mock.cjs.map +1 -1
  220. package/dist/test-utils/llm-mock.d.ts +4 -2
  221. package/dist/test-utils/llm-mock.d.ts.map +1 -1
  222. package/dist/test-utils/llm-mock.js +67 -30
  223. package/dist/test-utils/llm-mock.js.map +1 -1
  224. package/dist/tools/index.cjs +4 -4
  225. package/dist/tools/index.js +1 -1
  226. package/dist/tools/is-vercel-tool.cjs +2 -2
  227. package/dist/tools/is-vercel-tool.js +1 -1
  228. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  229. package/dist/tools/tool.d.ts.map +1 -1
  230. package/dist/tools/types.d.ts +1 -0
  231. package/dist/tools/types.d.ts.map +1 -1
  232. package/dist/tools/validation.d.ts +12 -0
  233. package/dist/tools/validation.d.ts.map +1 -1
  234. package/dist/utils.cjs +25 -21
  235. package/dist/utils.d.ts +4 -1
  236. package/dist/utils.d.ts.map +1 -1
  237. package/dist/utils.js +1 -1
  238. package/dist/voice/aisdk/index.d.ts +3 -0
  239. package/dist/voice/aisdk/index.d.ts.map +1 -0
  240. package/dist/voice/aisdk/speech.d.ts +23 -0
  241. package/dist/voice/aisdk/speech.d.ts.map +1 -0
  242. package/dist/voice/aisdk/transcription.d.ts +22 -0
  243. package/dist/voice/aisdk/transcription.d.ts.map +1 -0
  244. package/dist/voice/composite-voice.d.ts +4 -3
  245. package/dist/voice/composite-voice.d.ts.map +1 -1
  246. package/dist/voice/index.cjs +12 -4
  247. package/dist/voice/index.d.ts +1 -0
  248. package/dist/voice/index.d.ts.map +1 -1
  249. package/dist/voice/index.js +1 -1
  250. package/dist/workflows/default.d.ts +24 -8
  251. package/dist/workflows/default.d.ts.map +1 -1
  252. package/dist/workflows/evented/execution-engine.d.ts +3 -1
  253. package/dist/workflows/evented/execution-engine.d.ts.map +1 -1
  254. package/dist/workflows/evented/index.cjs +10 -10
  255. package/dist/workflows/evented/index.js +1 -1
  256. package/dist/workflows/evented/workflow-event-processor/index.d.ts +5 -4
  257. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  258. package/dist/workflows/evented/workflow-event-processor/loop.d.ts +1 -1
  259. package/dist/workflows/evented/workflow-event-processor/loop.d.ts.map +1 -1
  260. package/dist/workflows/evented/workflow-event-processor/parallel.d.ts +2 -2
  261. package/dist/workflows/evented/workflow-event-processor/parallel.d.ts.map +1 -1
  262. package/dist/workflows/evented/workflow-event-processor/sleep.d.ts +2 -2
  263. package/dist/workflows/evented/workflow-event-processor/sleep.d.ts.map +1 -1
  264. package/dist/workflows/evented/workflow.d.ts +2 -1
  265. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  266. package/dist/workflows/execution-engine.d.ts +4 -2
  267. package/dist/workflows/execution-engine.d.ts.map +1 -1
  268. package/dist/workflows/index.cjs +28 -16
  269. package/dist/workflows/index.js +1 -1
  270. package/dist/workflows/step.d.ts +1 -0
  271. package/dist/workflows/step.d.ts.map +1 -1
  272. package/dist/workflows/types.d.ts +54 -2
  273. package/dist/workflows/types.d.ts.map +1 -1
  274. package/dist/workflows/utils.d.ts +20 -0
  275. package/dist/workflows/utils.d.ts.map +1 -1
  276. package/dist/workflows/workflow.d.ts +108 -40
  277. package/dist/workflows/workflow.d.ts.map +1 -1
  278. package/package.json +19 -27
  279. package/src/llm/model/provider-types.generated.d.ts +56 -7
  280. package/dist/chunk-22443P6A.cjs.map +0 -1
  281. package/dist/chunk-2ZVKF4HP.cjs.map +0 -1
  282. package/dist/chunk-4CDL2QJT.js.map +0 -1
  283. package/dist/chunk-7AHYOMHJ.js.map +0 -1
  284. package/dist/chunk-7CBEP2ZQ.js.map +0 -1
  285. package/dist/chunk-7PO6SEJF.js.map +0 -1
  286. package/dist/chunk-CB575O6L.cjs.map +0 -1
  287. package/dist/chunk-ECFXGXWO.cjs.map +0 -1
  288. package/dist/chunk-ET6UOTTU.cjs.map +0 -1
  289. package/dist/chunk-GGYKYORQ.cjs.map +0 -1
  290. package/dist/chunk-HDJFSJCK.js.map +0 -1
  291. package/dist/chunk-I4CXL4SR.js.map +0 -1
  292. package/dist/chunk-IQO7ANVS.cjs.map +0 -1
  293. package/dist/chunk-JPGVRWWL.js.map +0 -1
  294. package/dist/chunk-JV2KH24V.js.map +0 -1
  295. package/dist/chunk-JYYQQEBH.cjs.map +0 -1
  296. package/dist/chunk-LJFJTTZQ.cjs +0 -4
  297. package/dist/chunk-LWBQ4P4N.cjs.map +0 -1
  298. package/dist/chunk-MV7KHWUT.js.map +0 -1
  299. package/dist/chunk-QUKUN6NR.cjs.map +0 -1
  300. package/dist/chunk-SNPVZPLB.js.map +0 -1
  301. package/dist/chunk-UIZSWUKP.js.map +0 -1
  302. package/dist/chunk-W7UH2PWL.js.map +0 -1
  303. package/dist/chunk-WM6CK2F3.cjs.map +0 -1
  304. package/dist/chunk-YCVEJ3UN.cjs.map +0 -1
  305. package/dist/chunk-ZGHTOYHW.js.map +0 -1
  306. package/dist/chunk-ZV5CC35D.js +0 -3
  307. package/dist/chunk-ZWNI5IWX.cjs.map +0 -1
  308. package/dist/models-dev-DNBKXHT4.js +0 -3
  309. package/dist/models-dev-YBEEQIX6.cjs +0 -12
  310. package/dist/netlify-7G2L5VSH.js +0 -3
  311. package/dist/netlify-GWNGSIRZ.cjs +0 -12
  312. package/dist/registry-generator-H4YNODDH.js.map +0 -1
  313. package/dist/registry-generator-MK63POJO.cjs.map +0 -1
@@ -1,562 +1,7 @@
1
- import { createJsonErrorResponseHandler, InvalidArgumentError, withoutTrailingSlash, generateId, withUserAgentSuffix, parseProviderOptions, postJsonToApi, createJsonResponseHandler, combineHeaders, createEventSourceResponseHandler, loadApiKey, UnsupportedFunctionalityError, APICallError, convertToBase64, LoadAPIKeyError, TypeValidationError, EmptyResponseBodyError, JSONParseError, EventSourceParserStream, NoSuchModelError, MastraModelGateway, createOpenAICompatible, createAnthropic, createGoogleGenerativeAI, createOpenAI, TooManyEmbeddingValuesForCallError, OpenAICompatibleImageModel } from './chunk-JPGVRWWL.js';
1
+ import { createJsonErrorResponseHandler, withoutTrailingSlash, generateId, withUserAgentSuffix, parseProviderOptions, injectJsonInstructionIntoMessages, postJsonToApi, createJsonResponseHandler, combineHeaders, createEventSourceResponseHandler, loadApiKey, convertToBase64, UnsupportedFunctionalityError, NoSuchModelError, MastraModelGateway, createOpenAICompatible, createAnthropic, createGoogleGenerativeAI, createOpenAI, TooManyEmbeddingValuesForCallError, OpenAICompatibleImageModel } from './chunk-MDKPL2R2.js';
2
2
  import { z } from 'zod/v4';
3
3
  import { createOpenRouter } from '@openrouter/ai-sdk-provider-v5';
4
4
 
5
- function combineHeaders2(...headers) {
6
- return headers.reduce(
7
- (combinedHeaders, currentHeaders) => ({
8
- ...combinedHeaders,
9
- ...currentHeaders != null ? currentHeaders : {}
10
- }),
11
- {}
12
- );
13
- }
14
- function extractResponseHeaders(response) {
15
- return Object.fromEntries([...response.headers]);
16
- }
17
- var createIdGenerator = ({
18
- prefix,
19
- size = 16,
20
- alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
21
- separator = "-"
22
- } = {}) => {
23
- const generator = () => {
24
- const alphabetLength = alphabet.length;
25
- const chars = new Array(size);
26
- for (let i = 0; i < size; i++) {
27
- chars[i] = alphabet[Math.random() * alphabetLength | 0];
28
- }
29
- return chars.join("");
30
- };
31
- if (prefix == null) {
32
- return generator;
33
- }
34
- if (alphabet.includes(separator)) {
35
- throw new InvalidArgumentError({
36
- argument: "separator",
37
- message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
38
- });
39
- }
40
- return () => `${prefix}${separator}${generator()}`;
41
- };
42
- var generateId2 = createIdGenerator();
43
- function isAbortError(error) {
44
- return (error instanceof Error || error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
45
- error.name === "TimeoutError");
46
- }
47
- var FETCH_FAILED_ERROR_MESSAGES = ["fetch failed", "failed to fetch"];
48
- function handleFetchError({
49
- error,
50
- url,
51
- requestBodyValues
52
- }) {
53
- if (isAbortError(error)) {
54
- return error;
55
- }
56
- if (error instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error.message.toLowerCase())) {
57
- const cause = error.cause;
58
- if (cause != null) {
59
- return new APICallError({
60
- message: `Cannot connect to API: ${cause.message}`,
61
- cause,
62
- url,
63
- requestBodyValues,
64
- isRetryable: true
65
- // retry when network error
66
- });
67
- }
68
- }
69
- return error;
70
- }
71
- function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
72
- var _a, _b, _c;
73
- if (globalThisAny.window) {
74
- return `runtime/browser`;
75
- }
76
- if ((_a = globalThisAny.navigator) == null ? void 0 : _a.userAgent) {
77
- return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
78
- }
79
- if ((_c = (_b = globalThisAny.process) == null ? void 0 : _b.versions) == null ? void 0 : _c.node) {
80
- return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
81
- }
82
- if (globalThisAny.EdgeRuntime) {
83
- return `runtime/vercel-edge`;
84
- }
85
- return "runtime/unknown";
86
- }
87
- function normalizeHeaders(headers) {
88
- if (headers == null) {
89
- return {};
90
- }
91
- const normalized = {};
92
- if (headers instanceof Headers) {
93
- headers.forEach((value, key) => {
94
- normalized[key.toLowerCase()] = value;
95
- });
96
- } else {
97
- if (!Array.isArray(headers)) {
98
- headers = Object.entries(headers);
99
- }
100
- for (const [key, value] of headers) {
101
- if (value != null) {
102
- normalized[key.toLowerCase()] = value;
103
- }
104
- }
105
- }
106
- return normalized;
107
- }
108
- function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
109
- const normalizedHeaders = new Headers(normalizeHeaders(headers));
110
- const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
111
- normalizedHeaders.set(
112
- "user-agent",
113
- [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" ")
114
- );
115
- return Object.fromEntries(normalizedHeaders.entries());
116
- }
117
- var VERSION = "3.0.16" ;
118
- var DEFAULT_SCHEMA_PREFIX = "JSON schema:";
119
- var DEFAULT_SCHEMA_SUFFIX = "You MUST answer with a JSON object that matches the JSON schema above.";
120
- var DEFAULT_GENERIC_SUFFIX = "You MUST answer with JSON.";
121
- function injectJsonInstruction({
122
- prompt,
123
- schema,
124
- schemaPrefix = schema != null ? DEFAULT_SCHEMA_PREFIX : void 0,
125
- schemaSuffix = schema != null ? DEFAULT_SCHEMA_SUFFIX : DEFAULT_GENERIC_SUFFIX
126
- }) {
127
- return [
128
- prompt != null && prompt.length > 0 ? prompt : void 0,
129
- prompt != null && prompt.length > 0 ? "" : void 0,
130
- // add a newline if prompt is not null
131
- schemaPrefix,
132
- schema != null ? JSON.stringify(schema) : void 0,
133
- schemaSuffix
134
- ].filter((line) => line != null).join("\n");
135
- }
136
- function injectJsonInstructionIntoMessages({
137
- messages,
138
- schema,
139
- schemaPrefix,
140
- schemaSuffix
141
- }) {
142
- var _a, _b;
143
- const systemMessage = ((_a = messages[0]) == null ? void 0 : _a.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
144
- systemMessage.content = injectJsonInstruction({
145
- prompt: systemMessage.content,
146
- schema,
147
- schemaPrefix,
148
- schemaSuffix
149
- });
150
- return [
151
- systemMessage,
152
- ...((_b = messages[0]) == null ? void 0 : _b.role) === "system" ? messages.slice(1) : messages
153
- ];
154
- }
155
- function loadApiKey2({
156
- apiKey,
157
- environmentVariableName,
158
- apiKeyParameterName = "apiKey",
159
- description
160
- }) {
161
- if (typeof apiKey === "string") {
162
- return apiKey;
163
- }
164
- if (apiKey != null) {
165
- throw new LoadAPIKeyError({
166
- message: `${description} API key must be a string.`
167
- });
168
- }
169
- if (typeof process === "undefined") {
170
- throw new LoadAPIKeyError({
171
- message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables is not supported in this environment.`
172
- });
173
- }
174
- apiKey = process.env[environmentVariableName];
175
- if (apiKey == null) {
176
- throw new LoadAPIKeyError({
177
- message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter or the ${environmentVariableName} environment variable.`
178
- });
179
- }
180
- if (typeof apiKey !== "string") {
181
- throw new LoadAPIKeyError({
182
- message: `${description} API key must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
183
- });
184
- }
185
- return apiKey;
186
- }
187
- var suspectProtoRx = /"__proto__"\s*:/;
188
- var suspectConstructorRx = /"constructor"\s*:/;
189
- function _parse(text) {
190
- const obj = JSON.parse(text);
191
- if (obj === null || typeof obj !== "object") {
192
- return obj;
193
- }
194
- if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {
195
- return obj;
196
- }
197
- return filter(obj);
198
- }
199
- function filter(obj) {
200
- let next = [obj];
201
- while (next.length) {
202
- const nodes = next;
203
- next = [];
204
- for (const node of nodes) {
205
- if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
206
- throw new SyntaxError("Object contains forbidden prototype property");
207
- }
208
- if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
209
- throw new SyntaxError("Object contains forbidden prototype property");
210
- }
211
- for (const key in node) {
212
- const value = node[key];
213
- if (value && typeof value === "object") {
214
- next.push(value);
215
- }
216
- }
217
- }
218
- }
219
- return obj;
220
- }
221
- function secureJsonParse(text) {
222
- const { stackTraceLimit } = Error;
223
- Error.stackTraceLimit = 0;
224
- try {
225
- return _parse(text);
226
- } finally {
227
- Error.stackTraceLimit = stackTraceLimit;
228
- }
229
- }
230
- var validatorSymbol = Symbol.for("vercel.ai.validator");
231
- function validator(validate) {
232
- return { [validatorSymbol]: true, validate };
233
- }
234
- function isValidator(value) {
235
- return typeof value === "object" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && "validate" in value;
236
- }
237
- function asValidator(value) {
238
- return isValidator(value) ? value : typeof value === "function" ? value() : standardSchemaValidator(value);
239
- }
240
- function standardSchemaValidator(standardSchema) {
241
- return validator(async (value) => {
242
- const result = await standardSchema["~standard"].validate(value);
243
- return result.issues == null ? { success: true, value: result.value } : {
244
- success: false,
245
- error: new TypeValidationError({
246
- value,
247
- cause: result.issues
248
- })
249
- };
250
- });
251
- }
252
- async function validateTypes({
253
- value,
254
- schema
255
- }) {
256
- const result = await safeValidateTypes({ value, schema });
257
- if (!result.success) {
258
- throw TypeValidationError.wrap({ value, cause: result.error });
259
- }
260
- return result.value;
261
- }
262
- async function safeValidateTypes({
263
- value,
264
- schema
265
- }) {
266
- const validator2 = asValidator(schema);
267
- try {
268
- if (validator2.validate == null) {
269
- return { success: true, value, rawValue: value };
270
- }
271
- const result = await validator2.validate(value);
272
- if (result.success) {
273
- return { success: true, value: result.value, rawValue: value };
274
- }
275
- return {
276
- success: false,
277
- error: TypeValidationError.wrap({ value, cause: result.error }),
278
- rawValue: value
279
- };
280
- } catch (error) {
281
- return {
282
- success: false,
283
- error: TypeValidationError.wrap({ value, cause: error }),
284
- rawValue: value
285
- };
286
- }
287
- }
288
- async function parseJSON({
289
- text,
290
- schema
291
- }) {
292
- try {
293
- const value = secureJsonParse(text);
294
- if (schema == null) {
295
- return value;
296
- }
297
- return validateTypes({ value, schema });
298
- } catch (error) {
299
- if (JSONParseError.isInstance(error) || TypeValidationError.isInstance(error)) {
300
- throw error;
301
- }
302
- throw new JSONParseError({ text, cause: error });
303
- }
304
- }
305
- async function safeParseJSON({
306
- text,
307
- schema
308
- }) {
309
- try {
310
- const value = secureJsonParse(text);
311
- if (schema == null) {
312
- return { success: true, value, rawValue: value };
313
- }
314
- return await safeValidateTypes({ value, schema });
315
- } catch (error) {
316
- return {
317
- success: false,
318
- error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text, cause: error }),
319
- rawValue: void 0
320
- };
321
- }
322
- }
323
- function parseJsonEventStream({
324
- stream,
325
- schema
326
- }) {
327
- return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).pipeThrough(
328
- new TransformStream({
329
- async transform({ data }, controller) {
330
- if (data === "[DONE]") {
331
- return;
332
- }
333
- controller.enqueue(await safeParseJSON({ text: data, schema }));
334
- }
335
- })
336
- );
337
- }
338
- async function parseProviderOptions2({
339
- provider,
340
- providerOptions,
341
- schema
342
- }) {
343
- if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
344
- return void 0;
345
- }
346
- const parsedProviderOptions = await safeValidateTypes({
347
- value: providerOptions[provider],
348
- schema
349
- });
350
- if (!parsedProviderOptions.success) {
351
- throw new InvalidArgumentError({
352
- argument: "providerOptions",
353
- message: `invalid ${provider} provider options`,
354
- cause: parsedProviderOptions.error
355
- });
356
- }
357
- return parsedProviderOptions.value;
358
- }
359
- var getOriginalFetch2 = () => globalThis.fetch;
360
- var postJsonToApi2 = async ({
361
- url,
362
- headers,
363
- body,
364
- failedResponseHandler,
365
- successfulResponseHandler,
366
- abortSignal,
367
- fetch: fetch2
368
- }) => postToApi({
369
- url,
370
- headers: {
371
- "Content-Type": "application/json",
372
- ...headers
373
- },
374
- body: {
375
- content: JSON.stringify(body),
376
- values: body
377
- },
378
- failedResponseHandler,
379
- successfulResponseHandler,
380
- abortSignal,
381
- fetch: fetch2
382
- });
383
- var postToApi = async ({
384
- url,
385
- headers = {},
386
- body,
387
- successfulResponseHandler,
388
- failedResponseHandler,
389
- abortSignal,
390
- fetch: fetch2 = getOriginalFetch2()
391
- }) => {
392
- try {
393
- const response = await fetch2(url, {
394
- method: "POST",
395
- headers: withUserAgentSuffix2(
396
- headers,
397
- `ai-sdk/provider-utils/${VERSION}`,
398
- getRuntimeEnvironmentUserAgent()
399
- ),
400
- body: body.content,
401
- signal: abortSignal
402
- });
403
- const responseHeaders = extractResponseHeaders(response);
404
- if (!response.ok) {
405
- let errorInformation;
406
- try {
407
- errorInformation = await failedResponseHandler({
408
- response,
409
- url,
410
- requestBodyValues: body.values
411
- });
412
- } catch (error) {
413
- if (isAbortError(error) || APICallError.isInstance(error)) {
414
- throw error;
415
- }
416
- throw new APICallError({
417
- message: "Failed to process error response",
418
- cause: error,
419
- statusCode: response.status,
420
- url,
421
- responseHeaders,
422
- requestBodyValues: body.values
423
- });
424
- }
425
- throw errorInformation.value;
426
- }
427
- try {
428
- return await successfulResponseHandler({
429
- response,
430
- url,
431
- requestBodyValues: body.values
432
- });
433
- } catch (error) {
434
- if (error instanceof Error) {
435
- if (isAbortError(error) || APICallError.isInstance(error)) {
436
- throw error;
437
- }
438
- }
439
- throw new APICallError({
440
- message: "Failed to process successful response",
441
- cause: error,
442
- statusCode: response.status,
443
- url,
444
- responseHeaders,
445
- requestBodyValues: body.values
446
- });
447
- }
448
- } catch (error) {
449
- throw handleFetchError({ error, url, requestBodyValues: body.values });
450
- }
451
- };
452
- var createJsonErrorResponseHandler2 = ({
453
- errorSchema,
454
- errorToMessage,
455
- isRetryable
456
- }) => async ({ response, url, requestBodyValues }) => {
457
- const responseBody = await response.text();
458
- const responseHeaders = extractResponseHeaders(response);
459
- if (responseBody.trim() === "") {
460
- return {
461
- responseHeaders,
462
- value: new APICallError({
463
- message: response.statusText,
464
- url,
465
- requestBodyValues,
466
- statusCode: response.status,
467
- responseHeaders,
468
- responseBody,
469
- isRetryable: isRetryable == null ? void 0 : isRetryable(response)
470
- })
471
- };
472
- }
473
- try {
474
- const parsedError = await parseJSON({
475
- text: responseBody,
476
- schema: errorSchema
477
- });
478
- return {
479
- responseHeaders,
480
- value: new APICallError({
481
- message: errorToMessage(parsedError),
482
- url,
483
- requestBodyValues,
484
- statusCode: response.status,
485
- responseHeaders,
486
- responseBody,
487
- data: parsedError,
488
- isRetryable: isRetryable == null ? void 0 : isRetryable(response, parsedError)
489
- })
490
- };
491
- } catch (parseError) {
492
- return {
493
- responseHeaders,
494
- value: new APICallError({
495
- message: response.statusText,
496
- url,
497
- requestBodyValues,
498
- statusCode: response.status,
499
- responseHeaders,
500
- responseBody,
501
- isRetryable: isRetryable == null ? void 0 : isRetryable(response)
502
- })
503
- };
504
- }
505
- };
506
- var createEventSourceResponseHandler2 = (chunkSchema) => async ({ response }) => {
507
- const responseHeaders = extractResponseHeaders(response);
508
- if (response.body == null) {
509
- throw new EmptyResponseBodyError({});
510
- }
511
- return {
512
- responseHeaders,
513
- value: parseJsonEventStream({
514
- stream: response.body,
515
- schema: chunkSchema
516
- })
517
- };
518
- };
519
- var createJsonResponseHandler2 = (responseSchema) => async ({ response, url, requestBodyValues }) => {
520
- const responseBody = await response.text();
521
- const parsedResult = await safeParseJSON({
522
- text: responseBody,
523
- schema: responseSchema
524
- });
525
- const responseHeaders = extractResponseHeaders(response);
526
- if (!parsedResult.success) {
527
- throw new APICallError({
528
- message: "Invalid JSON response",
529
- cause: parsedResult.error,
530
- statusCode: response.status,
531
- responseHeaders,
532
- responseBody,
533
- url,
534
- requestBodyValues
535
- });
536
- }
537
- return {
538
- responseHeaders,
539
- value: parsedResult.value,
540
- rawValue: parsedResult.rawValue
541
- };
542
- };
543
- new Set(
544
- "ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
545
- );
546
- var { btoa} = globalThis;
547
- function convertUint8ArrayToBase64(array) {
548
- let latin1string = "";
549
- for (let i = 0; i < array.length; i++) {
550
- latin1string += String.fromCodePoint(array[i]);
551
- }
552
- return btoa(latin1string);
553
- }
554
- function convertToBase642(value) {
555
- return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
556
- }
557
- function withoutTrailingSlash2(url) {
558
- return url == null ? void 0 : url.replace(/\/$/, "");
559
- }
560
5
  function convertToMistralChatMessages(prompt) {
561
6
  const messages = [];
562
7
  for (let i = 0; i < prompt.length; i++) {
@@ -580,7 +25,7 @@ function convertToMistralChatMessages(prompt) {
580
25
  const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
581
26
  return {
582
27
  type: "image_url",
583
- image_url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase642(part.data)}`
28
+ image_url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`
584
29
  };
585
30
  } else if (part.mediaType === "application/pdf") {
586
31
  return {
@@ -729,7 +174,7 @@ var mistralErrorDataSchema = z.object({
729
174
  param: z.string().nullable(),
730
175
  code: z.string().nullable()
731
176
  });
732
- var mistralFailedResponseHandler = createJsonErrorResponseHandler2({
177
+ var mistralFailedResponseHandler = createJsonErrorResponseHandler({
733
178
  errorSchema: mistralErrorDataSchema,
734
179
  errorToMessage: (data) => data.message
735
180
  });
@@ -794,7 +239,7 @@ var MistralChatLanguageModel = class {
794
239
  var _a;
795
240
  this.modelId = modelId;
796
241
  this.config = config;
797
- this.generateId = (_a = config.generateId) != null ? _a : generateId2;
242
+ this.generateId = (_a = config.generateId) != null ? _a : generateId;
798
243
  }
799
244
  get provider() {
800
245
  return this.config.provider;
@@ -816,7 +261,7 @@ var MistralChatLanguageModel = class {
816
261
  }) {
817
262
  var _a, _b, _c, _d;
818
263
  const warnings = [];
819
- const options = (_a = await parseProviderOptions2({
264
+ const options = (_a = await parseProviderOptions({
820
265
  provider: "mistral",
821
266
  providerOptions,
822
267
  schema: mistralLanguageModelOptions
@@ -903,12 +348,12 @@ var MistralChatLanguageModel = class {
903
348
  responseHeaders,
904
349
  value: response,
905
350
  rawValue: rawResponse
906
- } = await postJsonToApi2({
351
+ } = await postJsonToApi({
907
352
  url: `${this.config.baseURL}/chat/completions`,
908
- headers: combineHeaders2(this.config.headers(), options.headers),
353
+ headers: combineHeaders(this.config.headers(), options.headers),
909
354
  body,
910
355
  failedResponseHandler: mistralFailedResponseHandler,
911
- successfulResponseHandler: createJsonResponseHandler2(
356
+ successfulResponseHandler: createJsonResponseHandler(
912
357
  mistralChatResponseSchema
913
358
  ),
914
359
  abortSignal: options.abortSignal,
@@ -965,12 +410,12 @@ var MistralChatLanguageModel = class {
965
410
  async doStream(options) {
966
411
  const { args, warnings } = await this.getArgs(options);
967
412
  const body = { ...args, stream: true };
968
- const { responseHeaders, value: response } = await postJsonToApi2({
413
+ const { responseHeaders, value: response } = await postJsonToApi({
969
414
  url: `${this.config.baseURL}/chat/completions`,
970
- headers: combineHeaders2(this.config.headers(), options.headers),
415
+ headers: combineHeaders(this.config.headers(), options.headers),
971
416
  body,
972
417
  failedResponseHandler: mistralFailedResponseHandler,
973
- successfulResponseHandler: createEventSourceResponseHandler2(
418
+ successfulResponseHandler: createEventSourceResponseHandler(
974
419
  mistralChatChunkSchema
975
420
  ),
976
421
  abortSignal: options.abortSignal,
@@ -985,7 +430,7 @@ var MistralChatLanguageModel = class {
985
430
  let isFirstChunk = true;
986
431
  let activeText = false;
987
432
  let activeReasoningId = null;
988
- const generateId22 = this.generateId;
433
+ const generateId2 = this.generateId;
989
434
  return {
990
435
  stream: response.pipeThrough(
991
436
  new TransformStream({
@@ -1026,7 +471,7 @@ var MistralChatLanguageModel = class {
1026
471
  controller.enqueue({ type: "text-end", id: "0" });
1027
472
  activeText = false;
1028
473
  }
1029
- activeReasoningId = generateId22();
474
+ activeReasoningId = generateId2();
1030
475
  controller.enqueue({
1031
476
  type: "reasoning-start",
1032
477
  id: activeReasoningId
@@ -1254,16 +699,16 @@ var MistralEmbeddingModel = class {
1254
699
  responseHeaders,
1255
700
  value: response,
1256
701
  rawValue
1257
- } = await postJsonToApi2({
702
+ } = await postJsonToApi({
1258
703
  url: `${this.config.baseURL}/embeddings`,
1259
- headers: combineHeaders2(this.config.headers(), headers),
704
+ headers: combineHeaders(this.config.headers(), headers),
1260
705
  body: {
1261
706
  model: this.modelId,
1262
707
  input: values,
1263
708
  encoding_format: "float"
1264
709
  },
1265
710
  failedResponseHandler: mistralFailedResponseHandler,
1266
- successfulResponseHandler: createJsonResponseHandler2(
711
+ successfulResponseHandler: createJsonResponseHandler(
1267
712
  MistralTextEmbeddingResponseSchema
1268
713
  ),
1269
714
  abortSignal,
@@ -1280,20 +725,20 @@ var MistralTextEmbeddingResponseSchema = z.object({
1280
725
  data: z.array(z.object({ embedding: z.array(z.number()) })),
1281
726
  usage: z.object({ prompt_tokens: z.number() }).nullish()
1282
727
  });
1283
- var VERSION2 = "2.0.23" ;
728
+ var VERSION = "2.0.24" ;
1284
729
  function createMistral(options = {}) {
1285
730
  var _a;
1286
- const baseURL = (_a = withoutTrailingSlash2(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1";
1287
- const getHeaders = () => withUserAgentSuffix2(
731
+ const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1";
732
+ const getHeaders = () => withUserAgentSuffix(
1288
733
  {
1289
- Authorization: `Bearer ${loadApiKey2({
734
+ Authorization: `Bearer ${loadApiKey({
1290
735
  apiKey: options.apiKey,
1291
736
  environmentVariableName: "MISTRAL_API_KEY",
1292
737
  description: "Mistral"
1293
738
  })}`,
1294
739
  ...options.headers
1295
740
  },
1296
- `ai-sdk/mistral/${VERSION2}`
741
+ `ai-sdk/mistral/${VERSION}`
1297
742
  );
1298
743
  const createChatModel = (modelId) => new MistralChatLanguageModel(modelId, {
1299
744
  provider: "mistral.chat",
@@ -1491,6 +936,13 @@ var searchSourceSchema = z.discriminatedUnion("type", [
1491
936
  ]);
1492
937
  var xaiProviderOptions = z.object({
1493
938
  reasoningEffort: z.enum(["low", "high"]).optional(),
939
+ /**
940
+ * Whether to enable parallel function calling during tool use.
941
+ * When true, the model can call multiple functions in parallel.
942
+ * When false, the model will call functions sequentially.
943
+ * Defaults to true.
944
+ */
945
+ parallel_function_calling: z.boolean().optional(),
1494
946
  searchParameters: z.object({
1495
947
  /**
1496
948
  * search mode preference
@@ -1645,13 +1097,6 @@ var XaiChatLanguageModel = class {
1645
1097
  setting: "stopSequences"
1646
1098
  });
1647
1099
  }
1648
- if (responseFormat != null && responseFormat.type === "json" && responseFormat.schema != null) {
1649
- warnings.push({
1650
- type: "unsupported-setting",
1651
- setting: "responseFormat",
1652
- details: "JSON response format schema is not supported"
1653
- });
1654
- }
1655
1100
  const { messages, warnings: messageWarnings } = convertToXaiChatMessages(prompt);
1656
1101
  warnings.push(...messageWarnings);
1657
1102
  const {
@@ -1672,6 +1117,8 @@ var XaiChatLanguageModel = class {
1672
1117
  top_p: topP,
1673
1118
  seed,
1674
1119
  reasoning_effort: options.reasoningEffort,
1120
+ // parallel function calling
1121
+ parallel_function_calling: options.parallel_function_calling,
1675
1122
  // response format
1676
1123
  response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? responseFormat.schema != null ? {
1677
1124
  type: "json_schema",
@@ -2023,7 +1470,7 @@ var xaiChatChunkSchema = z.object({
2023
1470
  usage: xaiUsageSchema.nullish(),
2024
1471
  citations: z.array(z.string().url()).nullish()
2025
1472
  });
2026
- var VERSION3 = "2.0.26" ;
1473
+ var VERSION2 = "2.0.33" ;
2027
1474
  var xaiErrorStructure = {
2028
1475
  errorSchema: xaiErrorDataSchema,
2029
1476
  errorToMessage: (data) => data.error.message
@@ -2042,7 +1489,7 @@ function createXai(options = {}) {
2042
1489
  })}`,
2043
1490
  ...options.headers
2044
1491
  },
2045
- `ai-sdk/xai/${VERSION3}`
1492
+ `ai-sdk/xai/${VERSION2}`
2046
1493
  );
2047
1494
  const createLanguageModel = (modelId) => {
2048
1495
  return new XaiChatLanguageModel(modelId, {
@@ -2128,6 +1575,7 @@ var OPENAI_COMPATIBLE_OVERRIDES = {
2128
1575
  }
2129
1576
  };
2130
1577
  var ModelsDevGateway = class extends MastraModelGateway {
1578
+ id = "models.dev";
2131
1579
  name = "models.dev";
2132
1580
  prefix = void 0;
2133
1581
  // No prefix for registry gateway
@@ -2233,5 +1681,5 @@ var ModelsDevGateway = class extends MastraModelGateway {
2233
1681
  };
2234
1682
 
2235
1683
  export { ModelsDevGateway, parseModelRouterId };
2236
- //# sourceMappingURL=chunk-HDJFSJCK.js.map
2237
- //# sourceMappingURL=chunk-HDJFSJCK.js.map
1684
+ //# sourceMappingURL=chunk-IHJDOC3A.js.map
1685
+ //# sourceMappingURL=chunk-IHJDOC3A.js.map