@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,564 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkCB575O6L_cjs = require('./chunk-CB575O6L.cjs');
3
+ var chunkZCVTH3CH_cjs = require('./chunk-ZCVTH3CH.cjs');
4
4
  var v4 = require('zod/v4');
5
5
  var aiSdkProviderV5 = require('@openrouter/ai-sdk-provider-v5');
6
6
 
7
- function combineHeaders2(...headers) {
8
- return headers.reduce(
9
- (combinedHeaders, currentHeaders) => ({
10
- ...combinedHeaders,
11
- ...currentHeaders != null ? currentHeaders : {}
12
- }),
13
- {}
14
- );
15
- }
16
- function extractResponseHeaders(response) {
17
- return Object.fromEntries([...response.headers]);
18
- }
19
- var createIdGenerator = ({
20
- prefix,
21
- size = 16,
22
- alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
23
- separator = "-"
24
- } = {}) => {
25
- const generator = () => {
26
- const alphabetLength = alphabet.length;
27
- const chars = new Array(size);
28
- for (let i = 0; i < size; i++) {
29
- chars[i] = alphabet[Math.random() * alphabetLength | 0];
30
- }
31
- return chars.join("");
32
- };
33
- if (prefix == null) {
34
- return generator;
35
- }
36
- if (alphabet.includes(separator)) {
37
- throw new chunkCB575O6L_cjs.InvalidArgumentError({
38
- argument: "separator",
39
- message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
40
- });
41
- }
42
- return () => `${prefix}${separator}${generator()}`;
43
- };
44
- var generateId2 = createIdGenerator();
45
- function isAbortError(error) {
46
- return (error instanceof Error || error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
47
- error.name === "TimeoutError");
48
- }
49
- var FETCH_FAILED_ERROR_MESSAGES = ["fetch failed", "failed to fetch"];
50
- function handleFetchError({
51
- error,
52
- url,
53
- requestBodyValues
54
- }) {
55
- if (isAbortError(error)) {
56
- return error;
57
- }
58
- if (error instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error.message.toLowerCase())) {
59
- const cause = error.cause;
60
- if (cause != null) {
61
- return new chunkCB575O6L_cjs.APICallError({
62
- message: `Cannot connect to API: ${cause.message}`,
63
- cause,
64
- url,
65
- requestBodyValues,
66
- isRetryable: true
67
- // retry when network error
68
- });
69
- }
70
- }
71
- return error;
72
- }
73
- function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
74
- var _a, _b, _c;
75
- if (globalThisAny.window) {
76
- return `runtime/browser`;
77
- }
78
- if ((_a = globalThisAny.navigator) == null ? void 0 : _a.userAgent) {
79
- return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
80
- }
81
- if ((_c = (_b = globalThisAny.process) == null ? void 0 : _b.versions) == null ? void 0 : _c.node) {
82
- return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
83
- }
84
- if (globalThisAny.EdgeRuntime) {
85
- return `runtime/vercel-edge`;
86
- }
87
- return "runtime/unknown";
88
- }
89
- function normalizeHeaders(headers) {
90
- if (headers == null) {
91
- return {};
92
- }
93
- const normalized = {};
94
- if (headers instanceof Headers) {
95
- headers.forEach((value, key) => {
96
- normalized[key.toLowerCase()] = value;
97
- });
98
- } else {
99
- if (!Array.isArray(headers)) {
100
- headers = Object.entries(headers);
101
- }
102
- for (const [key, value] of headers) {
103
- if (value != null) {
104
- normalized[key.toLowerCase()] = value;
105
- }
106
- }
107
- }
108
- return normalized;
109
- }
110
- function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
111
- const normalizedHeaders = new Headers(normalizeHeaders(headers));
112
- const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
113
- normalizedHeaders.set(
114
- "user-agent",
115
- [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" ")
116
- );
117
- return Object.fromEntries(normalizedHeaders.entries());
118
- }
119
- var VERSION = "3.0.16" ;
120
- var DEFAULT_SCHEMA_PREFIX = "JSON schema:";
121
- var DEFAULT_SCHEMA_SUFFIX = "You MUST answer with a JSON object that matches the JSON schema above.";
122
- var DEFAULT_GENERIC_SUFFIX = "You MUST answer with JSON.";
123
- function injectJsonInstruction({
124
- prompt,
125
- schema,
126
- schemaPrefix = schema != null ? DEFAULT_SCHEMA_PREFIX : void 0,
127
- schemaSuffix = schema != null ? DEFAULT_SCHEMA_SUFFIX : DEFAULT_GENERIC_SUFFIX
128
- }) {
129
- return [
130
- prompt != null && prompt.length > 0 ? prompt : void 0,
131
- prompt != null && prompt.length > 0 ? "" : void 0,
132
- // add a newline if prompt is not null
133
- schemaPrefix,
134
- schema != null ? JSON.stringify(schema) : void 0,
135
- schemaSuffix
136
- ].filter((line) => line != null).join("\n");
137
- }
138
- function injectJsonInstructionIntoMessages({
139
- messages,
140
- schema,
141
- schemaPrefix,
142
- schemaSuffix
143
- }) {
144
- var _a, _b;
145
- const systemMessage = ((_a = messages[0]) == null ? void 0 : _a.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
146
- systemMessage.content = injectJsonInstruction({
147
- prompt: systemMessage.content,
148
- schema,
149
- schemaPrefix,
150
- schemaSuffix
151
- });
152
- return [
153
- systemMessage,
154
- ...((_b = messages[0]) == null ? void 0 : _b.role) === "system" ? messages.slice(1) : messages
155
- ];
156
- }
157
- function loadApiKey2({
158
- apiKey,
159
- environmentVariableName,
160
- apiKeyParameterName = "apiKey",
161
- description
162
- }) {
163
- if (typeof apiKey === "string") {
164
- return apiKey;
165
- }
166
- if (apiKey != null) {
167
- throw new chunkCB575O6L_cjs.LoadAPIKeyError({
168
- message: `${description} API key must be a string.`
169
- });
170
- }
171
- if (typeof process === "undefined") {
172
- throw new chunkCB575O6L_cjs.LoadAPIKeyError({
173
- message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables is not supported in this environment.`
174
- });
175
- }
176
- apiKey = process.env[environmentVariableName];
177
- if (apiKey == null) {
178
- throw new chunkCB575O6L_cjs.LoadAPIKeyError({
179
- message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter or the ${environmentVariableName} environment variable.`
180
- });
181
- }
182
- if (typeof apiKey !== "string") {
183
- throw new chunkCB575O6L_cjs.LoadAPIKeyError({
184
- message: `${description} API key must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
185
- });
186
- }
187
- return apiKey;
188
- }
189
- var suspectProtoRx = /"__proto__"\s*:/;
190
- var suspectConstructorRx = /"constructor"\s*:/;
191
- function _parse(text) {
192
- const obj = JSON.parse(text);
193
- if (obj === null || typeof obj !== "object") {
194
- return obj;
195
- }
196
- if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {
197
- return obj;
198
- }
199
- return filter(obj);
200
- }
201
- function filter(obj) {
202
- let next = [obj];
203
- while (next.length) {
204
- const nodes = next;
205
- next = [];
206
- for (const node of nodes) {
207
- if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
208
- throw new SyntaxError("Object contains forbidden prototype property");
209
- }
210
- if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
211
- throw new SyntaxError("Object contains forbidden prototype property");
212
- }
213
- for (const key in node) {
214
- const value = node[key];
215
- if (value && typeof value === "object") {
216
- next.push(value);
217
- }
218
- }
219
- }
220
- }
221
- return obj;
222
- }
223
- function secureJsonParse(text) {
224
- const { stackTraceLimit } = Error;
225
- Error.stackTraceLimit = 0;
226
- try {
227
- return _parse(text);
228
- } finally {
229
- Error.stackTraceLimit = stackTraceLimit;
230
- }
231
- }
232
- var validatorSymbol = Symbol.for("vercel.ai.validator");
233
- function validator(validate) {
234
- return { [validatorSymbol]: true, validate };
235
- }
236
- function isValidator(value) {
237
- return typeof value === "object" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && "validate" in value;
238
- }
239
- function asValidator(value) {
240
- return isValidator(value) ? value : typeof value === "function" ? value() : standardSchemaValidator(value);
241
- }
242
- function standardSchemaValidator(standardSchema) {
243
- return validator(async (value) => {
244
- const result = await standardSchema["~standard"].validate(value);
245
- return result.issues == null ? { success: true, value: result.value } : {
246
- success: false,
247
- error: new chunkCB575O6L_cjs.TypeValidationError({
248
- value,
249
- cause: result.issues
250
- })
251
- };
252
- });
253
- }
254
- async function validateTypes({
255
- value,
256
- schema
257
- }) {
258
- const result = await safeValidateTypes({ value, schema });
259
- if (!result.success) {
260
- throw chunkCB575O6L_cjs.TypeValidationError.wrap({ value, cause: result.error });
261
- }
262
- return result.value;
263
- }
264
- async function safeValidateTypes({
265
- value,
266
- schema
267
- }) {
268
- const validator2 = asValidator(schema);
269
- try {
270
- if (validator2.validate == null) {
271
- return { success: true, value, rawValue: value };
272
- }
273
- const result = await validator2.validate(value);
274
- if (result.success) {
275
- return { success: true, value: result.value, rawValue: value };
276
- }
277
- return {
278
- success: false,
279
- error: chunkCB575O6L_cjs.TypeValidationError.wrap({ value, cause: result.error }),
280
- rawValue: value
281
- };
282
- } catch (error) {
283
- return {
284
- success: false,
285
- error: chunkCB575O6L_cjs.TypeValidationError.wrap({ value, cause: error }),
286
- rawValue: value
287
- };
288
- }
289
- }
290
- async function parseJSON({
291
- text,
292
- schema
293
- }) {
294
- try {
295
- const value = secureJsonParse(text);
296
- if (schema == null) {
297
- return value;
298
- }
299
- return validateTypes({ value, schema });
300
- } catch (error) {
301
- if (chunkCB575O6L_cjs.JSONParseError.isInstance(error) || chunkCB575O6L_cjs.TypeValidationError.isInstance(error)) {
302
- throw error;
303
- }
304
- throw new chunkCB575O6L_cjs.JSONParseError({ text, cause: error });
305
- }
306
- }
307
- async function safeParseJSON({
308
- text,
309
- schema
310
- }) {
311
- try {
312
- const value = secureJsonParse(text);
313
- if (schema == null) {
314
- return { success: true, value, rawValue: value };
315
- }
316
- return await safeValidateTypes({ value, schema });
317
- } catch (error) {
318
- return {
319
- success: false,
320
- error: chunkCB575O6L_cjs.JSONParseError.isInstance(error) ? error : new chunkCB575O6L_cjs.JSONParseError({ text, cause: error }),
321
- rawValue: void 0
322
- };
323
- }
324
- }
325
- function parseJsonEventStream({
326
- stream,
327
- schema
328
- }) {
329
- return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new chunkCB575O6L_cjs.EventSourceParserStream()).pipeThrough(
330
- new TransformStream({
331
- async transform({ data }, controller) {
332
- if (data === "[DONE]") {
333
- return;
334
- }
335
- controller.enqueue(await safeParseJSON({ text: data, schema }));
336
- }
337
- })
338
- );
339
- }
340
- async function parseProviderOptions2({
341
- provider,
342
- providerOptions,
343
- schema
344
- }) {
345
- if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
346
- return void 0;
347
- }
348
- const parsedProviderOptions = await safeValidateTypes({
349
- value: providerOptions[provider],
350
- schema
351
- });
352
- if (!parsedProviderOptions.success) {
353
- throw new chunkCB575O6L_cjs.InvalidArgumentError({
354
- argument: "providerOptions",
355
- message: `invalid ${provider} provider options`,
356
- cause: parsedProviderOptions.error
357
- });
358
- }
359
- return parsedProviderOptions.value;
360
- }
361
- var getOriginalFetch2 = () => globalThis.fetch;
362
- var postJsonToApi2 = async ({
363
- url,
364
- headers,
365
- body,
366
- failedResponseHandler,
367
- successfulResponseHandler,
368
- abortSignal,
369
- fetch: fetch2
370
- }) => postToApi({
371
- url,
372
- headers: {
373
- "Content-Type": "application/json",
374
- ...headers
375
- },
376
- body: {
377
- content: JSON.stringify(body),
378
- values: body
379
- },
380
- failedResponseHandler,
381
- successfulResponseHandler,
382
- abortSignal,
383
- fetch: fetch2
384
- });
385
- var postToApi = async ({
386
- url,
387
- headers = {},
388
- body,
389
- successfulResponseHandler,
390
- failedResponseHandler,
391
- abortSignal,
392
- fetch: fetch2 = getOriginalFetch2()
393
- }) => {
394
- try {
395
- const response = await fetch2(url, {
396
- method: "POST",
397
- headers: withUserAgentSuffix2(
398
- headers,
399
- `ai-sdk/provider-utils/${VERSION}`,
400
- getRuntimeEnvironmentUserAgent()
401
- ),
402
- body: body.content,
403
- signal: abortSignal
404
- });
405
- const responseHeaders = extractResponseHeaders(response);
406
- if (!response.ok) {
407
- let errorInformation;
408
- try {
409
- errorInformation = await failedResponseHandler({
410
- response,
411
- url,
412
- requestBodyValues: body.values
413
- });
414
- } catch (error) {
415
- if (isAbortError(error) || chunkCB575O6L_cjs.APICallError.isInstance(error)) {
416
- throw error;
417
- }
418
- throw new chunkCB575O6L_cjs.APICallError({
419
- message: "Failed to process error response",
420
- cause: error,
421
- statusCode: response.status,
422
- url,
423
- responseHeaders,
424
- requestBodyValues: body.values
425
- });
426
- }
427
- throw errorInformation.value;
428
- }
429
- try {
430
- return await successfulResponseHandler({
431
- response,
432
- url,
433
- requestBodyValues: body.values
434
- });
435
- } catch (error) {
436
- if (error instanceof Error) {
437
- if (isAbortError(error) || chunkCB575O6L_cjs.APICallError.isInstance(error)) {
438
- throw error;
439
- }
440
- }
441
- throw new chunkCB575O6L_cjs.APICallError({
442
- message: "Failed to process successful response",
443
- cause: error,
444
- statusCode: response.status,
445
- url,
446
- responseHeaders,
447
- requestBodyValues: body.values
448
- });
449
- }
450
- } catch (error) {
451
- throw handleFetchError({ error, url, requestBodyValues: body.values });
452
- }
453
- };
454
- var createJsonErrorResponseHandler2 = ({
455
- errorSchema,
456
- errorToMessage,
457
- isRetryable
458
- }) => async ({ response, url, requestBodyValues }) => {
459
- const responseBody = await response.text();
460
- const responseHeaders = extractResponseHeaders(response);
461
- if (responseBody.trim() === "") {
462
- return {
463
- responseHeaders,
464
- value: new chunkCB575O6L_cjs.APICallError({
465
- message: response.statusText,
466
- url,
467
- requestBodyValues,
468
- statusCode: response.status,
469
- responseHeaders,
470
- responseBody,
471
- isRetryable: isRetryable == null ? void 0 : isRetryable(response)
472
- })
473
- };
474
- }
475
- try {
476
- const parsedError = await parseJSON({
477
- text: responseBody,
478
- schema: errorSchema
479
- });
480
- return {
481
- responseHeaders,
482
- value: new chunkCB575O6L_cjs.APICallError({
483
- message: errorToMessage(parsedError),
484
- url,
485
- requestBodyValues,
486
- statusCode: response.status,
487
- responseHeaders,
488
- responseBody,
489
- data: parsedError,
490
- isRetryable: isRetryable == null ? void 0 : isRetryable(response, parsedError)
491
- })
492
- };
493
- } catch (parseError) {
494
- return {
495
- responseHeaders,
496
- value: new chunkCB575O6L_cjs.APICallError({
497
- message: response.statusText,
498
- url,
499
- requestBodyValues,
500
- statusCode: response.status,
501
- responseHeaders,
502
- responseBody,
503
- isRetryable: isRetryable == null ? void 0 : isRetryable(response)
504
- })
505
- };
506
- }
507
- };
508
- var createEventSourceResponseHandler2 = (chunkSchema) => async ({ response }) => {
509
- const responseHeaders = extractResponseHeaders(response);
510
- if (response.body == null) {
511
- throw new chunkCB575O6L_cjs.EmptyResponseBodyError({});
512
- }
513
- return {
514
- responseHeaders,
515
- value: parseJsonEventStream({
516
- stream: response.body,
517
- schema: chunkSchema
518
- })
519
- };
520
- };
521
- var createJsonResponseHandler2 = (responseSchema) => async ({ response, url, requestBodyValues }) => {
522
- const responseBody = await response.text();
523
- const parsedResult = await safeParseJSON({
524
- text: responseBody,
525
- schema: responseSchema
526
- });
527
- const responseHeaders = extractResponseHeaders(response);
528
- if (!parsedResult.success) {
529
- throw new chunkCB575O6L_cjs.APICallError({
530
- message: "Invalid JSON response",
531
- cause: parsedResult.error,
532
- statusCode: response.status,
533
- responseHeaders,
534
- responseBody,
535
- url,
536
- requestBodyValues
537
- });
538
- }
539
- return {
540
- responseHeaders,
541
- value: parsedResult.value,
542
- rawValue: parsedResult.rawValue
543
- };
544
- };
545
- new Set(
546
- "ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
547
- );
548
- var { btoa} = globalThis;
549
- function convertUint8ArrayToBase64(array) {
550
- let latin1string = "";
551
- for (let i = 0; i < array.length; i++) {
552
- latin1string += String.fromCodePoint(array[i]);
553
- }
554
- return btoa(latin1string);
555
- }
556
- function convertToBase642(value) {
557
- return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
558
- }
559
- function withoutTrailingSlash2(url) {
560
- return url == null ? void 0 : url.replace(/\/$/, "");
561
- }
562
7
  function convertToMistralChatMessages(prompt) {
563
8
  const messages = [];
564
9
  for (let i = 0; i < prompt.length; i++) {
@@ -582,7 +27,7 @@ function convertToMistralChatMessages(prompt) {
582
27
  const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
583
28
  return {
584
29
  type: "image_url",
585
- image_url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase642(part.data)}`
30
+ image_url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${chunkZCVTH3CH_cjs.convertToBase64(part.data)}`
586
31
  };
587
32
  } else if (part.mediaType === "application/pdf") {
588
33
  return {
@@ -590,7 +35,7 @@ function convertToMistralChatMessages(prompt) {
590
35
  document_url: part.data.toString()
591
36
  };
592
37
  } else {
593
- throw new chunkCB575O6L_cjs.UnsupportedFunctionalityError({
38
+ throw new chunkZCVTH3CH_cjs.UnsupportedFunctionalityError({
594
39
  functionality: "Only images and PDF file parts are supported"
595
40
  });
596
41
  }
@@ -731,7 +176,7 @@ var mistralErrorDataSchema = v4.z.object({
731
176
  param: v4.z.string().nullable(),
732
177
  code: v4.z.string().nullable()
733
178
  });
734
- var mistralFailedResponseHandler = createJsonErrorResponseHandler2({
179
+ var mistralFailedResponseHandler = chunkZCVTH3CH_cjs.createJsonErrorResponseHandler({
735
180
  errorSchema: mistralErrorDataSchema,
736
181
  errorToMessage: (data) => data.message
737
182
  });
@@ -781,7 +226,7 @@ function prepareTools({
781
226
  };
782
227
  default: {
783
228
  const _exhaustiveCheck = type;
784
- throw new chunkCB575O6L_cjs.UnsupportedFunctionalityError({
229
+ throw new chunkZCVTH3CH_cjs.UnsupportedFunctionalityError({
785
230
  functionality: `tool choice type: ${_exhaustiveCheck}`
786
231
  });
787
232
  }
@@ -796,7 +241,7 @@ var MistralChatLanguageModel = class {
796
241
  var _a;
797
242
  this.modelId = modelId;
798
243
  this.config = config;
799
- this.generateId = (_a = config.generateId) != null ? _a : generateId2;
244
+ this.generateId = (_a = config.generateId) != null ? _a : chunkZCVTH3CH_cjs.generateId;
800
245
  }
801
246
  get provider() {
802
247
  return this.config.provider;
@@ -818,7 +263,7 @@ var MistralChatLanguageModel = class {
818
263
  }) {
819
264
  var _a, _b, _c, _d;
820
265
  const warnings = [];
821
- const options = (_a = await parseProviderOptions2({
266
+ const options = (_a = await chunkZCVTH3CH_cjs.parseProviderOptions({
822
267
  provider: "mistral",
823
268
  providerOptions,
824
269
  schema: mistralLanguageModelOptions
@@ -850,7 +295,7 @@ var MistralChatLanguageModel = class {
850
295
  const structuredOutputs = (_b = options.structuredOutputs) != null ? _b : true;
851
296
  const strictJsonSchema = (_c = options.strictJsonSchema) != null ? _c : false;
852
297
  if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && !(responseFormat == null ? void 0 : responseFormat.schema)) {
853
- prompt = injectJsonInstructionIntoMessages({
298
+ prompt = chunkZCVTH3CH_cjs.injectJsonInstructionIntoMessages({
854
299
  messages: prompt,
855
300
  schema: responseFormat.schema
856
301
  });
@@ -905,12 +350,12 @@ var MistralChatLanguageModel = class {
905
350
  responseHeaders,
906
351
  value: response,
907
352
  rawValue: rawResponse
908
- } = await postJsonToApi2({
353
+ } = await chunkZCVTH3CH_cjs.postJsonToApi({
909
354
  url: `${this.config.baseURL}/chat/completions`,
910
- headers: combineHeaders2(this.config.headers(), options.headers),
355
+ headers: chunkZCVTH3CH_cjs.combineHeaders(this.config.headers(), options.headers),
911
356
  body,
912
357
  failedResponseHandler: mistralFailedResponseHandler,
913
- successfulResponseHandler: createJsonResponseHandler2(
358
+ successfulResponseHandler: chunkZCVTH3CH_cjs.createJsonResponseHandler(
914
359
  mistralChatResponseSchema
915
360
  ),
916
361
  abortSignal: options.abortSignal,
@@ -967,12 +412,12 @@ var MistralChatLanguageModel = class {
967
412
  async doStream(options) {
968
413
  const { args, warnings } = await this.getArgs(options);
969
414
  const body = { ...args, stream: true };
970
- const { responseHeaders, value: response } = await postJsonToApi2({
415
+ const { responseHeaders, value: response } = await chunkZCVTH3CH_cjs.postJsonToApi({
971
416
  url: `${this.config.baseURL}/chat/completions`,
972
- headers: combineHeaders2(this.config.headers(), options.headers),
417
+ headers: chunkZCVTH3CH_cjs.combineHeaders(this.config.headers(), options.headers),
973
418
  body,
974
419
  failedResponseHandler: mistralFailedResponseHandler,
975
- successfulResponseHandler: createEventSourceResponseHandler2(
420
+ successfulResponseHandler: chunkZCVTH3CH_cjs.createEventSourceResponseHandler(
976
421
  mistralChatChunkSchema
977
422
  ),
978
423
  abortSignal: options.abortSignal,
@@ -987,7 +432,7 @@ var MistralChatLanguageModel = class {
987
432
  let isFirstChunk = true;
988
433
  let activeText = false;
989
434
  let activeReasoningId = null;
990
- const generateId22 = this.generateId;
435
+ const generateId2 = this.generateId;
991
436
  return {
992
437
  stream: response.pipeThrough(
993
438
  new TransformStream({
@@ -1028,7 +473,7 @@ var MistralChatLanguageModel = class {
1028
473
  controller.enqueue({ type: "text-end", id: "0" });
1029
474
  activeText = false;
1030
475
  }
1031
- activeReasoningId = generateId22();
476
+ activeReasoningId = generateId2();
1032
477
  controller.enqueue({
1033
478
  type: "reasoning-start",
1034
479
  id: activeReasoningId
@@ -1245,7 +690,7 @@ var MistralEmbeddingModel = class {
1245
690
  headers
1246
691
  }) {
1247
692
  if (values.length > this.maxEmbeddingsPerCall) {
1248
- throw new chunkCB575O6L_cjs.TooManyEmbeddingValuesForCallError({
693
+ throw new chunkZCVTH3CH_cjs.TooManyEmbeddingValuesForCallError({
1249
694
  provider: this.provider,
1250
695
  modelId: this.modelId,
1251
696
  maxEmbeddingsPerCall: this.maxEmbeddingsPerCall,
@@ -1256,16 +701,16 @@ var MistralEmbeddingModel = class {
1256
701
  responseHeaders,
1257
702
  value: response,
1258
703
  rawValue
1259
- } = await postJsonToApi2({
704
+ } = await chunkZCVTH3CH_cjs.postJsonToApi({
1260
705
  url: `${this.config.baseURL}/embeddings`,
1261
- headers: combineHeaders2(this.config.headers(), headers),
706
+ headers: chunkZCVTH3CH_cjs.combineHeaders(this.config.headers(), headers),
1262
707
  body: {
1263
708
  model: this.modelId,
1264
709
  input: values,
1265
710
  encoding_format: "float"
1266
711
  },
1267
712
  failedResponseHandler: mistralFailedResponseHandler,
1268
- successfulResponseHandler: createJsonResponseHandler2(
713
+ successfulResponseHandler: chunkZCVTH3CH_cjs.createJsonResponseHandler(
1269
714
  MistralTextEmbeddingResponseSchema
1270
715
  ),
1271
716
  abortSignal,
@@ -1282,20 +727,20 @@ var MistralTextEmbeddingResponseSchema = v4.z.object({
1282
727
  data: v4.z.array(v4.z.object({ embedding: v4.z.array(v4.z.number()) })),
1283
728
  usage: v4.z.object({ prompt_tokens: v4.z.number() }).nullish()
1284
729
  });
1285
- var VERSION2 = "2.0.23" ;
730
+ var VERSION = "2.0.24" ;
1286
731
  function createMistral(options = {}) {
1287
732
  var _a;
1288
- const baseURL = (_a = withoutTrailingSlash2(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1";
1289
- const getHeaders = () => withUserAgentSuffix2(
733
+ const baseURL = (_a = chunkZCVTH3CH_cjs.withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.mistral.ai/v1";
734
+ const getHeaders = () => chunkZCVTH3CH_cjs.withUserAgentSuffix(
1290
735
  {
1291
- Authorization: `Bearer ${loadApiKey2({
736
+ Authorization: `Bearer ${chunkZCVTH3CH_cjs.loadApiKey({
1292
737
  apiKey: options.apiKey,
1293
738
  environmentVariableName: "MISTRAL_API_KEY",
1294
739
  description: "Mistral"
1295
740
  })}`,
1296
741
  ...options.headers
1297
742
  },
1298
- `ai-sdk/mistral/${VERSION2}`
743
+ `ai-sdk/mistral/${VERSION}`
1299
744
  );
1300
745
  const createChatModel = (modelId) => new MistralChatLanguageModel(modelId, {
1301
746
  provider: "mistral.chat",
@@ -1324,7 +769,7 @@ function createMistral(options = {}) {
1324
769
  provider.textEmbedding = createEmbeddingModel;
1325
770
  provider.textEmbeddingModel = createEmbeddingModel;
1326
771
  provider.imageModel = (modelId) => {
1327
- throw new chunkCB575O6L_cjs.NoSuchModelError({ modelId, modelType: "imageModel" });
772
+ throw new chunkZCVTH3CH_cjs.NoSuchModelError({ modelId, modelType: "imageModel" });
1328
773
  };
1329
774
  return provider;
1330
775
  }
@@ -1356,11 +801,11 @@ function convertToXaiChatMessages(prompt) {
1356
801
  return {
1357
802
  type: "image_url",
1358
803
  image_url: {
1359
- url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${chunkCB575O6L_cjs.convertToBase64(part.data)}`
804
+ url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${chunkZCVTH3CH_cjs.convertToBase64(part.data)}`
1360
805
  }
1361
806
  };
1362
807
  } else {
1363
- throw new chunkCB575O6L_cjs.UnsupportedFunctionalityError({
808
+ throw new chunkZCVTH3CH_cjs.UnsupportedFunctionalityError({
1364
809
  functionality: `file part media type ${part.mediaType}`
1365
810
  });
1366
811
  }
@@ -1493,6 +938,13 @@ var searchSourceSchema = v4.z.discriminatedUnion("type", [
1493
938
  ]);
1494
939
  var xaiProviderOptions = v4.z.object({
1495
940
  reasoningEffort: v4.z.enum(["low", "high"]).optional(),
941
+ /**
942
+ * Whether to enable parallel function calling during tool use.
943
+ * When true, the model can call multiple functions in parallel.
944
+ * When false, the model will call functions sequentially.
945
+ * Defaults to true.
946
+ */
947
+ parallel_function_calling: v4.z.boolean().optional(),
1496
948
  searchParameters: v4.z.object({
1497
949
  /**
1498
950
  * search mode preference
@@ -1534,7 +986,7 @@ var xaiErrorDataSchema = v4.z.object({
1534
986
  code: v4.z.union([v4.z.string(), v4.z.number()]).nullish()
1535
987
  })
1536
988
  });
1537
- var xaiFailedResponseHandler = chunkCB575O6L_cjs.createJsonErrorResponseHandler({
989
+ var xaiFailedResponseHandler = chunkZCVTH3CH_cjs.createJsonErrorResponseHandler({
1538
990
  errorSchema: xaiErrorDataSchema,
1539
991
  errorToMessage: (data) => data.error.message
1540
992
  });
@@ -1583,7 +1035,7 @@ function prepareTools2({
1583
1035
  };
1584
1036
  default: {
1585
1037
  const _exhaustiveCheck = type;
1586
- throw new chunkCB575O6L_cjs.UnsupportedFunctionalityError({
1038
+ throw new chunkZCVTH3CH_cjs.UnsupportedFunctionalityError({
1587
1039
  functionality: `tool choice type: ${_exhaustiveCheck}`
1588
1040
  });
1589
1041
  }
@@ -1618,7 +1070,7 @@ var XaiChatLanguageModel = class {
1618
1070
  }) {
1619
1071
  var _a, _b, _c;
1620
1072
  const warnings = [];
1621
- const options = (_a = await chunkCB575O6L_cjs.parseProviderOptions({
1073
+ const options = (_a = await chunkZCVTH3CH_cjs.parseProviderOptions({
1622
1074
  provider: "xai",
1623
1075
  providerOptions,
1624
1076
  schema: xaiProviderOptions
@@ -1647,13 +1099,6 @@ var XaiChatLanguageModel = class {
1647
1099
  setting: "stopSequences"
1648
1100
  });
1649
1101
  }
1650
- if (responseFormat != null && responseFormat.type === "json" && responseFormat.schema != null) {
1651
- warnings.push({
1652
- type: "unsupported-setting",
1653
- setting: "responseFormat",
1654
- details: "JSON response format schema is not supported"
1655
- });
1656
- }
1657
1102
  const { messages, warnings: messageWarnings } = convertToXaiChatMessages(prompt);
1658
1103
  warnings.push(...messageWarnings);
1659
1104
  const {
@@ -1674,6 +1119,8 @@ var XaiChatLanguageModel = class {
1674
1119
  top_p: topP,
1675
1120
  seed,
1676
1121
  reasoning_effort: options.reasoningEffort,
1122
+ // parallel function calling
1123
+ parallel_function_calling: options.parallel_function_calling,
1677
1124
  // response format
1678
1125
  response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? responseFormat.schema != null ? {
1679
1126
  type: "json_schema",
@@ -1735,12 +1182,12 @@ var XaiChatLanguageModel = class {
1735
1182
  responseHeaders,
1736
1183
  value: response,
1737
1184
  rawValue: rawResponse
1738
- } = await chunkCB575O6L_cjs.postJsonToApi({
1185
+ } = await chunkZCVTH3CH_cjs.postJsonToApi({
1739
1186
  url: `${(_a = this.config.baseURL) != null ? _a : "https://api.x.ai/v1"}/chat/completions`,
1740
- headers: chunkCB575O6L_cjs.combineHeaders(this.config.headers(), options.headers),
1187
+ headers: chunkZCVTH3CH_cjs.combineHeaders(this.config.headers(), options.headers),
1741
1188
  body,
1742
1189
  failedResponseHandler: xaiFailedResponseHandler,
1743
- successfulResponseHandler: chunkCB575O6L_cjs.createJsonResponseHandler(
1190
+ successfulResponseHandler: chunkZCVTH3CH_cjs.createJsonResponseHandler(
1744
1191
  xaiChatResponseSchema
1745
1192
  ),
1746
1193
  abortSignal: options.abortSignal,
@@ -1812,12 +1259,12 @@ var XaiChatLanguageModel = class {
1812
1259
  include_usage: true
1813
1260
  }
1814
1261
  };
1815
- const { responseHeaders, value: response } = await chunkCB575O6L_cjs.postJsonToApi({
1262
+ const { responseHeaders, value: response } = await chunkZCVTH3CH_cjs.postJsonToApi({
1816
1263
  url: `${(_a = this.config.baseURL) != null ? _a : "https://api.x.ai/v1"}/chat/completions`,
1817
- headers: chunkCB575O6L_cjs.combineHeaders(this.config.headers(), options.headers),
1264
+ headers: chunkZCVTH3CH_cjs.combineHeaders(this.config.headers(), options.headers),
1818
1265
  body,
1819
1266
  failedResponseHandler: xaiFailedResponseHandler,
1820
- successfulResponseHandler: chunkCB575O6L_cjs.createEventSourceResponseHandler(xaiChatChunkSchema),
1267
+ successfulResponseHandler: chunkZCVTH3CH_cjs.createEventSourceResponseHandler(xaiChatChunkSchema),
1821
1268
  abortSignal: options.abortSignal,
1822
1269
  fetch: this.config.fetch
1823
1270
  });
@@ -2025,38 +1472,38 @@ var xaiChatChunkSchema = v4.z.object({
2025
1472
  usage: xaiUsageSchema.nullish(),
2026
1473
  citations: v4.z.array(v4.z.string().url()).nullish()
2027
1474
  });
2028
- var VERSION3 = "2.0.26" ;
1475
+ var VERSION2 = "2.0.33" ;
2029
1476
  var xaiErrorStructure = {
2030
1477
  errorSchema: xaiErrorDataSchema,
2031
1478
  errorToMessage: (data) => data.error.message
2032
1479
  };
2033
1480
  function createXai(options = {}) {
2034
1481
  var _a;
2035
- const baseURL = chunkCB575O6L_cjs.withoutTrailingSlash(
1482
+ const baseURL = chunkZCVTH3CH_cjs.withoutTrailingSlash(
2036
1483
  (_a = options.baseURL) != null ? _a : "https://api.x.ai/v1"
2037
1484
  );
2038
- const getHeaders = () => chunkCB575O6L_cjs.withUserAgentSuffix(
1485
+ const getHeaders = () => chunkZCVTH3CH_cjs.withUserAgentSuffix(
2039
1486
  {
2040
- Authorization: `Bearer ${chunkCB575O6L_cjs.loadApiKey({
1487
+ Authorization: `Bearer ${chunkZCVTH3CH_cjs.loadApiKey({
2041
1488
  apiKey: options.apiKey,
2042
1489
  environmentVariableName: "XAI_API_KEY",
2043
1490
  description: "xAI API key"
2044
1491
  })}`,
2045
1492
  ...options.headers
2046
1493
  },
2047
- `ai-sdk/xai/${VERSION3}`
1494
+ `ai-sdk/xai/${VERSION2}`
2048
1495
  );
2049
1496
  const createLanguageModel = (modelId) => {
2050
1497
  return new XaiChatLanguageModel(modelId, {
2051
1498
  provider: "xai.chat",
2052
1499
  baseURL,
2053
1500
  headers: getHeaders,
2054
- generateId: chunkCB575O6L_cjs.generateId,
1501
+ generateId: chunkZCVTH3CH_cjs.generateId,
2055
1502
  fetch: options.fetch
2056
1503
  });
2057
1504
  };
2058
1505
  const createImageModel = (modelId) => {
2059
- return new chunkCB575O6L_cjs.OpenAICompatibleImageModel(modelId, {
1506
+ return new chunkZCVTH3CH_cjs.OpenAICompatibleImageModel(modelId, {
2060
1507
  provider: "xai.image",
2061
1508
  url: ({ path }) => `${baseURL}${path}`,
2062
1509
  headers: getHeaders,
@@ -2068,7 +1515,7 @@ function createXai(options = {}) {
2068
1515
  provider.languageModel = createLanguageModel;
2069
1516
  provider.chat = createLanguageModel;
2070
1517
  provider.textEmbeddingModel = (modelId) => {
2071
- throw new chunkCB575O6L_cjs.NoSuchModelError({ modelId, modelType: "textEmbeddingModel" });
1518
+ throw new chunkZCVTH3CH_cjs.NoSuchModelError({ modelId, modelType: "textEmbeddingModel" });
2072
1519
  };
2073
1520
  provider.imageModel = createImageModel;
2074
1521
  provider.image = createImageModel;
@@ -2129,7 +1576,8 @@ var OPENAI_COMPATIBLE_OVERRIDES = {
2129
1576
  apiKeyEnvVar: "AI_GATEWAY_API_KEY"
2130
1577
  }
2131
1578
  };
2132
- var ModelsDevGateway = class extends chunkCB575O6L_cjs.MastraModelGateway {
1579
+ var ModelsDevGateway = class extends chunkZCVTH3CH_cjs.MastraModelGateway {
1580
+ id = "models.dev";
2133
1581
  name = "models.dev";
2134
1582
  prefix = void 0;
2135
1583
  // No prefix for registry gateway
@@ -2209,14 +1657,14 @@ var ModelsDevGateway = class extends chunkCB575O6L_cjs.MastraModelGateway {
2209
1657
  const baseURL = this.buildUrl(`${providerId}/${modelId}`);
2210
1658
  switch (providerId) {
2211
1659
  case "openai":
2212
- return chunkCB575O6L_cjs.createOpenAI({ apiKey }).responses(modelId);
1660
+ return chunkZCVTH3CH_cjs.createOpenAI({ apiKey }).responses(modelId);
2213
1661
  case "gemini":
2214
1662
  case "google":
2215
- return chunkCB575O6L_cjs.createGoogleGenerativeAI({
1663
+ return chunkZCVTH3CH_cjs.createGoogleGenerativeAI({
2216
1664
  apiKey
2217
1665
  }).chat(modelId);
2218
1666
  case "anthropic":
2219
- return chunkCB575O6L_cjs.createAnthropic({ apiKey })(modelId);
1667
+ return chunkZCVTH3CH_cjs.createAnthropic({ apiKey })(modelId);
2220
1668
  case "mistral":
2221
1669
  return createMistral({ apiKey })(modelId);
2222
1670
  case "openrouter":
@@ -2227,7 +1675,7 @@ var ModelsDevGateway = class extends chunkCB575O6L_cjs.MastraModelGateway {
2227
1675
  })(modelId);
2228
1676
  default:
2229
1677
  if (!baseURL) throw new Error(`No API URL found for ${providerId}/${modelId}`);
2230
- return chunkCB575O6L_cjs.createOpenAICompatible({ name: providerId, apiKey, baseURL, supportsStructuredOutputs: true }).chatModel(
1678
+ return chunkZCVTH3CH_cjs.createOpenAICompatible({ name: providerId, apiKey, baseURL, supportsStructuredOutputs: true }).chatModel(
2231
1679
  modelId
2232
1680
  );
2233
1681
  }
@@ -2236,5 +1684,5 @@ var ModelsDevGateway = class extends chunkCB575O6L_cjs.MastraModelGateway {
2236
1684
 
2237
1685
  exports.ModelsDevGateway = ModelsDevGateway;
2238
1686
  exports.parseModelRouterId = parseModelRouterId;
2239
- //# sourceMappingURL=chunk-LWBQ4P4N.cjs.map
2240
- //# sourceMappingURL=chunk-LWBQ4P4N.cjs.map
1687
+ //# sourceMappingURL=chunk-S6OEQHEI.cjs.map
1688
+ //# sourceMappingURL=chunk-S6OEQHEI.cjs.map