@mastra/core 1.0.0-beta.11 → 1.0.0-beta.13

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 (394) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +7549 -0
  3. package/dist/_types/@internal_ai-sdk-v4/dist/test.d.ts +65 -0
  4. package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +8396 -0
  5. package/dist/_types/@internal_ai-sdk-v5/dist/test.d.ts +1708 -0
  6. package/dist/_types/@internal_external-types/dist/index.d.ts +858 -0
  7. package/dist/agent/agent-legacy.d.ts +1 -1
  8. package/dist/agent/agent.d.ts +1 -1
  9. package/dist/agent/agent.d.ts.map +1 -1
  10. package/dist/agent/agent.types.d.ts +5 -1
  11. package/dist/agent/agent.types.d.ts.map +1 -1
  12. package/dist/agent/index.cjs +9 -9
  13. package/dist/agent/index.js +2 -2
  14. package/dist/agent/message-list/index.cjs +3 -3
  15. package/dist/agent/message-list/index.d.ts +4 -3
  16. package/dist/agent/message-list/index.d.ts.map +1 -1
  17. package/dist/agent/message-list/index.js +1 -1
  18. package/dist/agent/message-list/prompt/attachments-to-parts.d.ts +1 -1
  19. package/dist/agent/message-list/prompt/invalid-content-error.d.ts +1 -1
  20. package/dist/agent/message-list/types.d.ts +3 -3
  21. package/dist/agent/message-list/types.d.ts.map +1 -1
  22. package/dist/agent/message-list/utils/ai-v4-v5/core-model-message.d.ts +1 -1
  23. package/dist/agent/message-list/utils/ai-v4-v5/ui-message.d.ts +1 -1
  24. package/dist/agent/message-list/utils/ai-v5/gemini-compatibility.d.ts +2 -2
  25. package/dist/agent/message-list/utils/ai-v5/gemini-compatibility.d.ts.map +1 -1
  26. package/dist/agent/message-list/utils/convert-messages.d.ts +2 -2
  27. package/dist/agent/message-list/utils/convert-messages.d.ts.map +1 -1
  28. package/dist/agent/types.d.ts +3 -3
  29. package/dist/agent/utils.d.ts +3 -3
  30. package/dist/agent/utils.d.ts.map +1 -1
  31. package/dist/agent/workflows/prepare-stream/index.d.ts +2 -1
  32. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  33. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  34. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +3 -1
  35. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  36. package/dist/bundler/types.d.ts +14 -1
  37. package/dist/bundler/types.d.ts.map +1 -1
  38. package/dist/{chunk-U3XOLEPX.js → chunk-2IU4RGU5.js} +6 -32
  39. package/dist/chunk-2IU4RGU5.js.map +1 -0
  40. package/dist/chunk-2SQB3WBT.js +4574 -0
  41. package/dist/chunk-2SQB3WBT.js.map +1 -0
  42. package/dist/{chunk-THZTRBFS.js → chunk-373OC54J.js} +8 -8
  43. package/dist/chunk-373OC54J.js.map +1 -0
  44. package/dist/{chunk-F2GAJSBI.js → chunk-4BC5FUAO.js} +8 -6
  45. package/dist/{chunk-F2GAJSBI.js.map → chunk-4BC5FUAO.js.map} +1 -1
  46. package/dist/chunk-55VPMN3N.js +250 -0
  47. package/dist/chunk-55VPMN3N.js.map +1 -0
  48. package/dist/{chunk-QM5SRDJX.js → chunk-5PTZG26U.js} +66 -84
  49. package/dist/chunk-5PTZG26U.js.map +1 -0
  50. package/dist/chunk-5VZGJTPR.js +4837 -0
  51. package/dist/chunk-5VZGJTPR.js.map +1 -0
  52. package/dist/{chunk-C36YRTZ6.js → chunk-62Q7K656.js} +6 -7
  53. package/dist/chunk-62Q7K656.js.map +1 -0
  54. package/dist/chunk-6PMMP3FR.js +7 -0
  55. package/dist/chunk-6PMMP3FR.js.map +1 -0
  56. package/dist/{chunk-DZUJEN5N.cjs → chunk-6SZKM6EC.cjs} +10 -3
  57. package/dist/{chunk-DZUJEN5N.cjs.map → chunk-6SZKM6EC.cjs.map} +1 -1
  58. package/dist/{chunk-5WRI5ZAA.js → chunk-7D4SUZUM.js} +10 -4
  59. package/dist/{chunk-5WRI5ZAA.js.map → chunk-7D4SUZUM.js.map} +1 -1
  60. package/dist/{chunk-YWMMBIOM.cjs → chunk-7HEAVZRS.cjs} +15 -15
  61. package/dist/{chunk-YWMMBIOM.cjs.map → chunk-7HEAVZRS.cjs.map} +1 -1
  62. package/dist/{chunk-BUKY6CTR.cjs → chunk-AGHLXC4I.cjs} +106 -36
  63. package/dist/chunk-AGHLXC4I.cjs.map +1 -0
  64. package/dist/{chunk-PK2A5WBG.js → chunk-ARAQIW6E.js} +222 -604
  65. package/dist/chunk-ARAQIW6E.js.map +1 -0
  66. package/dist/{chunk-US2U7ECW.js → chunk-BQDZIQ3G.js} +156 -90
  67. package/dist/chunk-BQDZIQ3G.js.map +1 -0
  68. package/dist/chunk-D22XABFZ.js +79 -0
  69. package/dist/chunk-D22XABFZ.js.map +1 -0
  70. package/dist/{chunk-2ULLRN4Y.js → chunk-E5BQRAJK.js} +943 -626
  71. package/dist/chunk-E5BQRAJK.js.map +1 -0
  72. package/dist/chunk-FST2G2FQ.cjs +84 -0
  73. package/dist/chunk-FST2G2FQ.cjs.map +1 -0
  74. package/dist/chunk-FVQTJUBD.cjs +2120 -0
  75. package/dist/chunk-FVQTJUBD.cjs.map +1 -0
  76. package/dist/chunk-G6E6V2Z4.js +2070 -0
  77. package/dist/chunk-G6E6V2Z4.js.map +1 -0
  78. package/dist/{chunk-7P6BNIJH.js → chunk-GIWC35YQ.js} +105 -35
  79. package/dist/chunk-GIWC35YQ.js.map +1 -0
  80. package/dist/{chunk-4JKEUSCC.cjs → chunk-H4VUIOWU.cjs} +22 -20
  81. package/dist/chunk-H4VUIOWU.cjs.map +1 -0
  82. package/dist/{chunk-TWH4PTDG.cjs → chunk-HWMMIRIF.cjs} +32 -27
  83. package/dist/chunk-HWMMIRIF.cjs.map +1 -0
  84. package/dist/chunk-IXZ2T2QX.cjs +448 -0
  85. package/dist/chunk-IXZ2T2QX.cjs.map +1 -0
  86. package/dist/chunk-L3NKIMF5.cjs +10 -0
  87. package/dist/chunk-L3NKIMF5.cjs.map +1 -0
  88. package/dist/chunk-L4JCRWDY.cjs +252 -0
  89. package/dist/chunk-L4JCRWDY.cjs.map +1 -0
  90. package/dist/{chunk-BJXKH4LG.cjs → chunk-LGB4VNZI.cjs} +43 -78
  91. package/dist/chunk-LGB4VNZI.cjs.map +1 -0
  92. package/dist/{chunk-PG5H6QIO.cjs → chunk-MLKE7HRS.cjs} +41 -21
  93. package/dist/chunk-MLKE7HRS.cjs.map +1 -0
  94. package/dist/{chunk-OEIVMCWX.js → chunk-MRRFTNF4.js} +2537 -84
  95. package/dist/chunk-MRRFTNF4.js.map +1 -0
  96. package/dist/chunk-MXBVP7HX.cjs +4842 -0
  97. package/dist/chunk-MXBVP7HX.cjs.map +1 -0
  98. package/dist/chunk-NESKUIRE.cjs +4586 -0
  99. package/dist/chunk-NESKUIRE.cjs.map +1 -0
  100. package/dist/{chunk-SVLMF4UZ.cjs → chunk-NIOEY3N3.cjs} +66 -85
  101. package/dist/chunk-NIOEY3N3.cjs.map +1 -0
  102. package/dist/{chunk-CZEJQSWB.cjs → chunk-OWIEOL55.cjs} +295 -677
  103. package/dist/chunk-OWIEOL55.cjs.map +1 -0
  104. package/dist/{chunk-WTSZBHIZ.cjs → chunk-PJAK4U6R.cjs} +24 -24
  105. package/dist/{chunk-WTSZBHIZ.cjs.map → chunk-PJAK4U6R.cjs.map} +1 -1
  106. package/dist/{chunk-52RSUALV.cjs → chunk-R5AJGM55.cjs} +1314 -995
  107. package/dist/chunk-R5AJGM55.cjs.map +1 -0
  108. package/dist/{chunk-IVV5TOMD.js → chunk-RCJLMMTO.js} +32 -12
  109. package/dist/chunk-RCJLMMTO.js.map +1 -0
  110. package/dist/{chunk-S73Z3PBJ.cjs → chunk-SZYSDJTN.cjs} +27 -28
  111. package/dist/chunk-SZYSDJTN.cjs.map +1 -0
  112. package/dist/{chunk-YC6PJEPH.cjs → chunk-U4CSOY6T.cjs} +188 -122
  113. package/dist/chunk-U4CSOY6T.cjs.map +1 -0
  114. package/dist/chunk-UBSPZTQX.js +434 -0
  115. package/dist/chunk-UBSPZTQX.js.map +1 -0
  116. package/dist/{chunk-SCUWP4II.cjs → chunk-VEPP75C4.cjs} +47 -74
  117. package/dist/chunk-VEPP75C4.cjs.map +1 -0
  118. package/dist/{chunk-JIGDJK2O.js → chunk-VETAQUW3.js} +4 -39
  119. package/dist/chunk-VETAQUW3.js.map +1 -0
  120. package/dist/{chunk-Z57R5WS4.js → chunk-WPTTKULS.js} +4 -4
  121. package/dist/{chunk-Z57R5WS4.js.map → chunk-WPTTKULS.js.map} +1 -1
  122. package/dist/{chunk-O2BJW7YA.js → chunk-WYGUWVTF.js} +5 -5
  123. package/dist/{chunk-O2BJW7YA.js.map → chunk-WYGUWVTF.js.map} +1 -1
  124. package/dist/{chunk-SXNQRJQD.js → chunk-WYWRMIQC.js} +127 -22
  125. package/dist/chunk-WYWRMIQC.js.map +1 -0
  126. package/dist/{chunk-5Q6WAYEY.cjs → chunk-X6IBA7FP.cjs} +137 -50
  127. package/dist/chunk-X6IBA7FP.cjs.map +1 -0
  128. package/dist/{chunk-MRFUISXC.cjs → chunk-Y7MZ5LJT.cjs} +2632 -179
  129. package/dist/chunk-Y7MZ5LJT.cjs.map +1 -0
  130. package/dist/{chunk-JJ5O45LH.js → chunk-YPLZDWG7.js} +32 -27
  131. package/dist/chunk-YPLZDWG7.js.map +1 -0
  132. package/dist/{chunk-MGCGWPQJ.cjs → chunk-Z55SJVEC.cjs} +8 -8
  133. package/dist/chunk-Z55SJVEC.cjs.map +1 -0
  134. package/dist/error/index.cjs +6 -6
  135. package/dist/error/index.d.ts +26 -20
  136. package/dist/error/index.d.ts.map +1 -1
  137. package/dist/error/index.js +1 -1
  138. package/dist/error/utils.d.ts +19 -5
  139. package/dist/error/utils.d.ts.map +1 -1
  140. package/dist/evals/index.cjs +4 -4
  141. package/dist/evals/index.js +1 -1
  142. package/dist/evals/run/index.d.ts +1 -1
  143. package/dist/evals/scoreTraces/index.cjs +8 -8
  144. package/dist/evals/scoreTraces/index.js +2 -2
  145. package/dist/evals/types.d.ts +1 -1
  146. package/dist/events/event-emitter.d.ts +6 -1
  147. package/dist/events/event-emitter.d.ts.map +1 -1
  148. package/dist/index.cjs +2 -2
  149. package/dist/index.js +1 -1
  150. package/dist/integration/index.cjs +2 -2
  151. package/dist/integration/index.js +1 -1
  152. package/dist/llm/index.cjs +15 -15
  153. package/dist/llm/index.d.ts +2 -2
  154. package/dist/llm/index.d.ts.map +1 -1
  155. package/dist/llm/index.js +5 -5
  156. package/dist/llm/model/aisdk/v5/model.d.ts +1 -1
  157. package/dist/llm/model/base.types.d.ts +2 -2
  158. package/dist/llm/model/model.d.ts +1 -1
  159. package/dist/llm/model/model.d.ts.map +1 -1
  160. package/dist/llm/model/model.loop.d.ts +2 -2
  161. package/dist/llm/model/model.loop.d.ts.map +1 -1
  162. package/dist/llm/model/model.loop.types.d.ts +1 -1
  163. package/dist/llm/model/model.loop.types.d.ts.map +1 -1
  164. package/dist/llm/model/provider-types.generated.d.ts +51 -11
  165. package/dist/llm/model/shared.types.d.ts +1 -1
  166. package/dist/loop/index.cjs +2 -2
  167. package/dist/loop/index.js +1 -1
  168. package/dist/loop/loop.d.ts +2 -2
  169. package/dist/loop/loop.d.ts.map +1 -1
  170. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts +1 -1
  171. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts.map +1 -1
  172. package/dist/loop/test-utils/options.d.ts.map +1 -1
  173. package/dist/loop/test-utils/streamObject.d.ts +1 -1
  174. package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
  175. package/dist/loop/test-utils/tools.d.ts.map +1 -1
  176. package/dist/loop/types.d.ts +3 -1
  177. package/dist/loop/types.d.ts.map +1 -1
  178. package/dist/loop/workflows/agentic-execution/index.d.ts +13 -13
  179. package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
  180. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +10 -10
  181. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  182. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +5 -5
  183. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  184. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +22 -21
  185. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  186. package/dist/loop/workflows/agentic-loop/index.d.ts +13 -13
  187. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  188. package/dist/loop/workflows/schema.d.ts +6 -6
  189. package/dist/loop/workflows/schema.d.ts.map +1 -1
  190. package/dist/loop/workflows/stream.d.ts +2 -2
  191. package/dist/loop/workflows/stream.d.ts.map +1 -1
  192. package/dist/mastra/index.cjs +2 -2
  193. package/dist/mastra/index.js +1 -1
  194. package/dist/mcp/index.cjs +4 -4
  195. package/dist/mcp/index.js +1 -1
  196. package/dist/memory/index.cjs +6 -6
  197. package/dist/memory/index.js +1 -1
  198. package/dist/memory/memory.d.ts +1 -1
  199. package/dist/memory/types.d.ts +3 -3
  200. package/dist/memory/types.d.ts.map +1 -1
  201. package/dist/models-dev-D3EKFGAO.cjs +12 -0
  202. package/dist/{models-dev-EO3SUIY2.cjs.map → models-dev-D3EKFGAO.cjs.map} +1 -1
  203. package/dist/models-dev-EO22XOXQ.js +3 -0
  204. package/dist/{models-dev-23RN2WHG.js.map → models-dev-EO22XOXQ.js.map} +1 -1
  205. package/dist/netlify-AE4LNCAI.js +3 -0
  206. package/dist/{netlify-GXJ5D5DD.js.map → netlify-AE4LNCAI.js.map} +1 -1
  207. package/dist/netlify-WE42TZIT.cjs +12 -0
  208. package/dist/{netlify-KJLY3GFS.cjs.map → netlify-WE42TZIT.cjs.map} +1 -1
  209. package/dist/processors/index.cjs +37 -37
  210. package/dist/processors/index.d.ts +2 -2
  211. package/dist/processors/index.d.ts.map +1 -1
  212. package/dist/processors/index.js +1 -1
  213. package/dist/processors/step-schema.d.ts +1267 -1267
  214. package/dist/processors/step-schema.d.ts.map +1 -1
  215. package/dist/provider-registry-6LF3NGC5.js +3 -0
  216. package/dist/{provider-registry-F67Y6OF2.js.map → provider-registry-6LF3NGC5.js.map} +1 -1
  217. package/dist/provider-registry-73FKMXJV.cjs +40 -0
  218. package/dist/{provider-registry-3TG2KUD2.cjs.map → provider-registry-73FKMXJV.cjs.map} +1 -1
  219. package/dist/provider-registry.json +100 -30
  220. package/dist/{registry-generator-UMTNPBJX.js → registry-generator-AVQXI3GX.js} +2 -2
  221. package/dist/{registry-generator-UMTNPBJX.js.map → registry-generator-AVQXI3GX.js.map} +1 -1
  222. package/dist/{registry-generator-34SC4TAU.cjs → registry-generator-KOFNIIWJ.cjs} +2 -2
  223. package/dist/{registry-generator-34SC4TAU.cjs.map → registry-generator-KOFNIIWJ.cjs.map} +1 -1
  224. package/dist/relevance/index.cjs +2 -2
  225. package/dist/relevance/index.js +1 -1
  226. package/dist/server/index.cjs +5 -5
  227. package/dist/server/index.js +1 -1
  228. package/dist/storage/base.d.ts +2 -10
  229. package/dist/storage/base.d.ts.map +1 -1
  230. package/dist/storage/domains/workflows/base.d.ts +2 -8
  231. package/dist/storage/domains/workflows/base.d.ts.map +1 -1
  232. package/dist/storage/domains/workflows/inmemory.d.ts +2 -8
  233. package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
  234. package/dist/storage/index.cjs +38 -38
  235. package/dist/storage/index.js +1 -1
  236. package/dist/storage/mock.d.ts +2 -8
  237. package/dist/storage/mock.d.ts.map +1 -1
  238. package/dist/storage/types.d.ts +9 -1
  239. package/dist/storage/types.d.ts.map +1 -1
  240. package/dist/stream/RunOutput.d.ts +1 -1
  241. package/dist/stream/aisdk/v4/input.d.ts +1 -1
  242. package/dist/stream/aisdk/v5/compat/content.d.ts +1 -1
  243. package/dist/stream/aisdk/v5/compat/content.d.ts.map +1 -1
  244. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts +1 -1
  245. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
  246. package/dist/stream/aisdk/v5/compat/ui-message.d.ts +1 -1
  247. package/dist/stream/aisdk/v5/compat/ui-message.d.ts.map +1 -1
  248. package/dist/stream/aisdk/v5/compat/validation.d.ts +1 -1
  249. package/dist/stream/aisdk/v5/compat/validation.d.ts.map +1 -1
  250. package/dist/stream/aisdk/v5/execute.d.ts +2 -2
  251. package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
  252. package/dist/stream/aisdk/v5/input.d.ts +1 -1
  253. package/dist/stream/aisdk/v5/input.d.ts.map +1 -1
  254. package/dist/stream/aisdk/v5/output-helpers.d.ts +12 -27
  255. package/dist/stream/aisdk/v5/output-helpers.d.ts.map +1 -1
  256. package/dist/stream/aisdk/v5/output.d.ts +41 -91
  257. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  258. package/dist/stream/aisdk/v5/transform.d.ts +1 -1
  259. package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
  260. package/dist/stream/base/input.d.ts +1 -1
  261. package/dist/stream/base/output.d.ts +9 -31
  262. package/dist/stream/base/output.d.ts.map +1 -1
  263. package/dist/stream/base/schema.d.ts +2 -2
  264. package/dist/stream/base/schema.d.ts.map +1 -1
  265. package/dist/stream/index.cjs +12 -12
  266. package/dist/stream/index.js +2 -2
  267. package/dist/stream/types.d.ts +3 -2
  268. package/dist/stream/types.d.ts.map +1 -1
  269. package/dist/test-utils/llm-mock.cjs +14587 -14
  270. package/dist/test-utils/llm-mock.cjs.map +1 -1
  271. package/dist/test-utils/llm-mock.d.ts +3 -3
  272. package/dist/test-utils/llm-mock.d.ts.map +1 -1
  273. package/dist/test-utils/llm-mock.js +14577 -4
  274. package/dist/test-utils/llm-mock.js.map +1 -1
  275. package/dist/token-6GSAFR2W-SGVIXFCP.cjs +63 -0
  276. package/dist/token-6GSAFR2W-SGVIXFCP.cjs.map +1 -0
  277. package/dist/token-6GSAFR2W-SPYPLMBM.js +61 -0
  278. package/dist/token-6GSAFR2W-SPYPLMBM.js.map +1 -0
  279. package/dist/token-util-NEHG7TUY-7GMW5FXI.cjs +10 -0
  280. package/dist/token-util-NEHG7TUY-7GMW5FXI.cjs.map +1 -0
  281. package/dist/token-util-NEHG7TUY-JRJTGTAB.js +8 -0
  282. package/dist/token-util-NEHG7TUY-JRJTGTAB.js.map +1 -0
  283. package/dist/tools/index.cjs +4 -4
  284. package/dist/tools/index.js +1 -1
  285. package/dist/tools/is-vercel-tool.cjs +2 -2
  286. package/dist/tools/is-vercel-tool.js +1 -1
  287. package/dist/tools/tool-builder/builder.d.ts +2 -1
  288. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  289. package/dist/tools/tool.d.ts.map +1 -1
  290. package/dist/tools/types.d.ts +5 -5
  291. package/dist/tools/types.d.ts.map +1 -1
  292. package/dist/utils.cjs +22 -22
  293. package/dist/utils.d.ts +3 -3
  294. package/dist/utils.d.ts.map +1 -1
  295. package/dist/utils.js +1 -1
  296. package/dist/vector/embed.d.ts +2 -2
  297. package/dist/vector/embed.d.ts.map +1 -1
  298. package/dist/vector/index.cjs +11 -11
  299. package/dist/vector/index.js +3 -3
  300. package/dist/vector/vector.d.ts +1 -1
  301. package/dist/voice/aisdk/speech.d.ts +1 -1
  302. package/dist/voice/aisdk/speech.d.ts.map +1 -1
  303. package/dist/voice/aisdk/transcription.d.ts +1 -1
  304. package/dist/voice/aisdk/transcription.d.ts.map +1 -1
  305. package/dist/voice/composite-voice.d.ts +1 -1
  306. package/dist/voice/composite-voice.d.ts.map +1 -1
  307. package/dist/voice/index.cjs +6 -6
  308. package/dist/voice/index.js +1 -1
  309. package/dist/workflows/constants.cjs +4 -4
  310. package/dist/workflows/constants.d.ts +1 -1
  311. package/dist/workflows/constants.d.ts.map +1 -1
  312. package/dist/workflows/constants.js +1 -1
  313. package/dist/workflows/default.d.ts +9 -16
  314. package/dist/workflows/default.d.ts.map +1 -1
  315. package/dist/workflows/evented/execution-engine.d.ts +3 -2
  316. package/dist/workflows/evented/execution-engine.d.ts.map +1 -1
  317. package/dist/workflows/evented/index.cjs +10 -10
  318. package/dist/workflows/evented/index.js +1 -1
  319. package/dist/workflows/evented/step-executor.d.ts +1 -1
  320. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  321. package/dist/workflows/evented/workflow-event-processor/index.d.ts +1 -1
  322. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  323. package/dist/workflows/evented/workflow.d.ts +15 -0
  324. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  325. package/dist/workflows/execution-engine.d.ts +25 -2
  326. package/dist/workflows/execution-engine.d.ts.map +1 -1
  327. package/dist/workflows/handlers/control-flow.d.ts +6 -5
  328. package/dist/workflows/handlers/control-flow.d.ts.map +1 -1
  329. package/dist/workflows/handlers/entry.d.ts +5 -3
  330. package/dist/workflows/handlers/entry.d.ts.map +1 -1
  331. package/dist/workflows/handlers/sleep.d.ts +4 -3
  332. package/dist/workflows/handlers/sleep.d.ts.map +1 -1
  333. package/dist/workflows/handlers/step.d.ts +5 -3
  334. package/dist/workflows/handlers/step.d.ts.map +1 -1
  335. package/dist/workflows/index.cjs +26 -22
  336. package/dist/workflows/index.js +1 -1
  337. package/dist/workflows/step.d.ts +5 -4
  338. package/dist/workflows/step.d.ts.map +1 -1
  339. package/dist/workflows/types.d.ts +66 -14
  340. package/dist/workflows/types.d.ts.map +1 -1
  341. package/dist/workflows/utils.d.ts +11 -0
  342. package/dist/workflows/utils.d.ts.map +1 -1
  343. package/dist/workflows/workflow.d.ts +26 -8
  344. package/dist/workflows/workflow.d.ts.map +1 -1
  345. package/package.json +12 -11
  346. package/src/llm/model/provider-types.generated.d.ts +51 -11
  347. package/dist/agent/__tests__/mock-model.d.ts +0 -8
  348. package/dist/agent/__tests__/mock-model.d.ts.map +0 -1
  349. package/dist/agent/agent-types.test-d.d.ts +0 -2
  350. package/dist/agent/agent-types.test-d.d.ts.map +0 -1
  351. package/dist/ai-sdk.types.d.ts +0 -4705
  352. package/dist/chunk-2ULLRN4Y.js.map +0 -1
  353. package/dist/chunk-3E3ILV6T.cjs +0 -518
  354. package/dist/chunk-3E3ILV6T.cjs.map +0 -1
  355. package/dist/chunk-4JKEUSCC.cjs.map +0 -1
  356. package/dist/chunk-52RSUALV.cjs.map +0 -1
  357. package/dist/chunk-5PAEYE3Q.js +0 -513
  358. package/dist/chunk-5PAEYE3Q.js.map +0 -1
  359. package/dist/chunk-5Q6WAYEY.cjs.map +0 -1
  360. package/dist/chunk-7P6BNIJH.js.map +0 -1
  361. package/dist/chunk-ABJOUEVA.cjs +0 -10
  362. package/dist/chunk-ABJOUEVA.cjs.map +0 -1
  363. package/dist/chunk-BJXKH4LG.cjs.map +0 -1
  364. package/dist/chunk-BUKY6CTR.cjs.map +0 -1
  365. package/dist/chunk-C36YRTZ6.js.map +0 -1
  366. package/dist/chunk-CZEJQSWB.cjs.map +0 -1
  367. package/dist/chunk-IVV5TOMD.js.map +0 -1
  368. package/dist/chunk-JIGDJK2O.js.map +0 -1
  369. package/dist/chunk-JJ5O45LH.js.map +0 -1
  370. package/dist/chunk-MGCGWPQJ.cjs.map +0 -1
  371. package/dist/chunk-MRFUISXC.cjs.map +0 -1
  372. package/dist/chunk-NLNKQD2T.js +0 -7
  373. package/dist/chunk-NLNKQD2T.js.map +0 -1
  374. package/dist/chunk-OEIVMCWX.js.map +0 -1
  375. package/dist/chunk-PG5H6QIO.cjs.map +0 -1
  376. package/dist/chunk-PK2A5WBG.js.map +0 -1
  377. package/dist/chunk-QM5SRDJX.js.map +0 -1
  378. package/dist/chunk-S73Z3PBJ.cjs.map +0 -1
  379. package/dist/chunk-SCUWP4II.cjs.map +0 -1
  380. package/dist/chunk-SVLMF4UZ.cjs.map +0 -1
  381. package/dist/chunk-SXNQRJQD.js.map +0 -1
  382. package/dist/chunk-THZTRBFS.js.map +0 -1
  383. package/dist/chunk-TWH4PTDG.cjs.map +0 -1
  384. package/dist/chunk-U3XOLEPX.js.map +0 -1
  385. package/dist/chunk-US2U7ECW.js.map +0 -1
  386. package/dist/chunk-YC6PJEPH.cjs.map +0 -1
  387. package/dist/models-dev-23RN2WHG.js +0 -3
  388. package/dist/models-dev-EO3SUIY2.cjs +0 -12
  389. package/dist/netlify-GXJ5D5DD.js +0 -3
  390. package/dist/netlify-KJLY3GFS.cjs +0 -12
  391. package/dist/provider-registry-3TG2KUD2.cjs +0 -40
  392. package/dist/provider-registry-F67Y6OF2.js +0 -3
  393. package/dist/tools/tool-stream-types.test-d.d.ts +0 -2
  394. package/dist/tools/tool-stream-types.test-d.d.ts.map +0 -1
@@ -1,422 +1,8 @@
1
+ import { InvalidArgumentError, UnsupportedFunctionalityError, APICallError, LoadAPIKeyError, TypeValidationError, EmptyResponseBodyError, JSONParseError, EventSourceParserStream, LoadSettingError, NoSuchModelError, InvalidResponseDataError, TooManyEmbeddingValuesForCallError, InvalidPromptError } from './chunk-UBSPZTQX.js';
1
2
  import * as z4 from 'zod/v4';
2
3
  import { z } from 'zod/v4';
3
4
  import { ZodFirstPartyTypeKind } from 'zod/v3';
4
5
 
5
- // ../../node_modules/.pnpm/@ai-sdk+provider@2.0.0/node_modules/@ai-sdk/provider/dist/index.mjs
6
- var marker = "vercel.ai.error";
7
- var symbol = Symbol.for(marker);
8
- var _a;
9
- var _AISDKError = class _AISDKError2 extends Error {
10
- /**
11
- * Creates an AI SDK Error.
12
- *
13
- * @param {Object} params - The parameters for creating the error.
14
- * @param {string} params.name - The name of the error.
15
- * @param {string} params.message - The error message.
16
- * @param {unknown} [params.cause] - The underlying cause of the error.
17
- */
18
- constructor({
19
- name: name14,
20
- message,
21
- cause
22
- }) {
23
- super(message);
24
- this[_a] = true;
25
- this.name = name14;
26
- this.cause = cause;
27
- }
28
- /**
29
- * Checks if the given error is an AI SDK Error.
30
- * @param {unknown} error - The error to check.
31
- * @returns {boolean} True if the error is an AI SDK Error, false otherwise.
32
- */
33
- static isInstance(error) {
34
- return _AISDKError2.hasMarker(error, marker);
35
- }
36
- static hasMarker(error, marker15) {
37
- const markerSymbol = Symbol.for(marker15);
38
- return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;
39
- }
40
- };
41
- _a = symbol;
42
- var AISDKError = _AISDKError;
43
- var name = "AI_APICallError";
44
- var marker2 = `vercel.ai.error.${name}`;
45
- var symbol2 = Symbol.for(marker2);
46
- var _a2;
47
- var APICallError = class extends AISDKError {
48
- constructor({
49
- message,
50
- url,
51
- requestBodyValues,
52
- statusCode,
53
- responseHeaders,
54
- responseBody,
55
- cause,
56
- isRetryable = statusCode != null && (statusCode === 408 || // request timeout
57
- statusCode === 409 || // conflict
58
- statusCode === 429 || // too many requests
59
- statusCode >= 500),
60
- // server error
61
- data
62
- }) {
63
- super({ name, message, cause });
64
- this[_a2] = true;
65
- this.url = url;
66
- this.requestBodyValues = requestBodyValues;
67
- this.statusCode = statusCode;
68
- this.responseHeaders = responseHeaders;
69
- this.responseBody = responseBody;
70
- this.isRetryable = isRetryable;
71
- this.data = data;
72
- }
73
- static isInstance(error) {
74
- return AISDKError.hasMarker(error, marker2);
75
- }
76
- };
77
- _a2 = symbol2;
78
- var name2 = "AI_EmptyResponseBodyError";
79
- var marker3 = `vercel.ai.error.${name2}`;
80
- var symbol3 = Symbol.for(marker3);
81
- var _a3;
82
- var EmptyResponseBodyError = class extends AISDKError {
83
- // used in isInstance
84
- constructor({ message = "Empty response body" } = {}) {
85
- super({ name: name2, message });
86
- this[_a3] = true;
87
- }
88
- static isInstance(error) {
89
- return AISDKError.hasMarker(error, marker3);
90
- }
91
- };
92
- _a3 = symbol3;
93
- function getErrorMessage(error) {
94
- if (error == null) {
95
- return "unknown error";
96
- }
97
- if (typeof error === "string") {
98
- return error;
99
- }
100
- if (error instanceof Error) {
101
- return error.message;
102
- }
103
- return JSON.stringify(error);
104
- }
105
- var name3 = "AI_InvalidArgumentError";
106
- var marker4 = `vercel.ai.error.${name3}`;
107
- var symbol4 = Symbol.for(marker4);
108
- var _a4;
109
- var InvalidArgumentError = class extends AISDKError {
110
- constructor({
111
- message,
112
- cause,
113
- argument
114
- }) {
115
- super({ name: name3, message, cause });
116
- this[_a4] = true;
117
- this.argument = argument;
118
- }
119
- static isInstance(error) {
120
- return AISDKError.hasMarker(error, marker4);
121
- }
122
- };
123
- _a4 = symbol4;
124
- var name4 = "AI_InvalidPromptError";
125
- var marker5 = `vercel.ai.error.${name4}`;
126
- var symbol5 = Symbol.for(marker5);
127
- var _a5;
128
- var InvalidPromptError = class extends AISDKError {
129
- constructor({
130
- prompt,
131
- message,
132
- cause
133
- }) {
134
- super({ name: name4, message: `Invalid prompt: ${message}`, cause });
135
- this[_a5] = true;
136
- this.prompt = prompt;
137
- }
138
- static isInstance(error) {
139
- return AISDKError.hasMarker(error, marker5);
140
- }
141
- };
142
- _a5 = symbol5;
143
- var name5 = "AI_InvalidResponseDataError";
144
- var marker6 = `vercel.ai.error.${name5}`;
145
- var symbol6 = Symbol.for(marker6);
146
- var _a6;
147
- var InvalidResponseDataError = class extends AISDKError {
148
- constructor({
149
- data,
150
- message = `Invalid response data: ${JSON.stringify(data)}.`
151
- }) {
152
- super({ name: name5, message });
153
- this[_a6] = true;
154
- this.data = data;
155
- }
156
- static isInstance(error) {
157
- return AISDKError.hasMarker(error, marker6);
158
- }
159
- };
160
- _a6 = symbol6;
161
- var name6 = "AI_JSONParseError";
162
- var marker7 = `vercel.ai.error.${name6}`;
163
- var symbol7 = Symbol.for(marker7);
164
- var _a7;
165
- var JSONParseError = class extends AISDKError {
166
- constructor({ text, cause }) {
167
- super({
168
- name: name6,
169
- message: `JSON parsing failed: Text: ${text}.
170
- Error message: ${getErrorMessage(cause)}`,
171
- cause
172
- });
173
- this[_a7] = true;
174
- this.text = text;
175
- }
176
- static isInstance(error) {
177
- return AISDKError.hasMarker(error, marker7);
178
- }
179
- };
180
- _a7 = symbol7;
181
- var name7 = "AI_LoadAPIKeyError";
182
- var marker8 = `vercel.ai.error.${name7}`;
183
- var symbol8 = Symbol.for(marker8);
184
- var _a8;
185
- var LoadAPIKeyError = class extends AISDKError {
186
- // used in isInstance
187
- constructor({ message }) {
188
- super({ name: name7, message });
189
- this[_a8] = true;
190
- }
191
- static isInstance(error) {
192
- return AISDKError.hasMarker(error, marker8);
193
- }
194
- };
195
- _a8 = symbol8;
196
- var name10 = "AI_NoSuchModelError";
197
- var marker11 = `vercel.ai.error.${name10}`;
198
- var symbol11 = Symbol.for(marker11);
199
- var _a11;
200
- var NoSuchModelError = class extends AISDKError {
201
- constructor({
202
- errorName = name10,
203
- modelId,
204
- modelType,
205
- message = `No such ${modelType}: ${modelId}`
206
- }) {
207
- super({ name: errorName, message });
208
- this[_a11] = true;
209
- this.modelId = modelId;
210
- this.modelType = modelType;
211
- }
212
- static isInstance(error) {
213
- return AISDKError.hasMarker(error, marker11);
214
- }
215
- };
216
- _a11 = symbol11;
217
- var name11 = "AI_TooManyEmbeddingValuesForCallError";
218
- var marker12 = `vercel.ai.error.${name11}`;
219
- var symbol12 = Symbol.for(marker12);
220
- var _a12;
221
- var TooManyEmbeddingValuesForCallError = class extends AISDKError {
222
- constructor(options) {
223
- super({
224
- name: name11,
225
- message: `Too many values for a single embedding call. The ${options.provider} model "${options.modelId}" can only embed up to ${options.maxEmbeddingsPerCall} values per call, but ${options.values.length} values were provided.`
226
- });
227
- this[_a12] = true;
228
- this.provider = options.provider;
229
- this.modelId = options.modelId;
230
- this.maxEmbeddingsPerCall = options.maxEmbeddingsPerCall;
231
- this.values = options.values;
232
- }
233
- static isInstance(error) {
234
- return AISDKError.hasMarker(error, marker12);
235
- }
236
- };
237
- _a12 = symbol12;
238
- var name12 = "AI_TypeValidationError";
239
- var marker13 = `vercel.ai.error.${name12}`;
240
- var symbol13 = Symbol.for(marker13);
241
- var _a13;
242
- var _TypeValidationError = class _TypeValidationError2 extends AISDKError {
243
- constructor({ value, cause }) {
244
- super({
245
- name: name12,
246
- message: `Type validation failed: Value: ${JSON.stringify(value)}.
247
- Error message: ${getErrorMessage(cause)}`,
248
- cause
249
- });
250
- this[_a13] = true;
251
- this.value = value;
252
- }
253
- static isInstance(error) {
254
- return AISDKError.hasMarker(error, marker13);
255
- }
256
- /**
257
- * Wraps an error into a TypeValidationError.
258
- * If the cause is already a TypeValidationError with the same value, it returns the cause.
259
- * Otherwise, it creates a new TypeValidationError.
260
- *
261
- * @param {Object} params - The parameters for wrapping the error.
262
- * @param {unknown} params.value - The value that failed validation.
263
- * @param {unknown} params.cause - The original error or cause of the validation failure.
264
- * @returns {TypeValidationError} A TypeValidationError instance.
265
- */
266
- static wrap({
267
- value,
268
- cause
269
- }) {
270
- return _TypeValidationError2.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError2({ value, cause });
271
- }
272
- };
273
- _a13 = symbol13;
274
- var TypeValidationError = _TypeValidationError;
275
- var name13 = "AI_UnsupportedFunctionalityError";
276
- var marker14 = `vercel.ai.error.${name13}`;
277
- var symbol14 = Symbol.for(marker14);
278
- var _a14;
279
- var UnsupportedFunctionalityError = class extends AISDKError {
280
- constructor({
281
- functionality,
282
- message = `'${functionality}' functionality not supported.`
283
- }) {
284
- super({ name: name13, message });
285
- this[_a14] = true;
286
- this.functionality = functionality;
287
- }
288
- static isInstance(error) {
289
- return AISDKError.hasMarker(error, marker14);
290
- }
291
- };
292
- _a14 = symbol14;
293
-
294
- // ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/index.js
295
- var ParseError = class extends Error {
296
- constructor(message, options) {
297
- super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
298
- }
299
- };
300
- function noop(_arg) {
301
- }
302
- function createParser(callbacks) {
303
- if (typeof callbacks == "function")
304
- throw new TypeError(
305
- "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
306
- );
307
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
308
- let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
309
- function feed(newChunk) {
310
- const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
311
- for (const line of complete)
312
- parseLine(line);
313
- incompleteLine = incomplete, isFirstChunk = false;
314
- }
315
- function parseLine(line) {
316
- if (line === "") {
317
- dispatchEvent();
318
- return;
319
- }
320
- if (line.startsWith(":")) {
321
- onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
322
- return;
323
- }
324
- const fieldSeparatorIndex = line.indexOf(":");
325
- if (fieldSeparatorIndex !== -1) {
326
- const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
327
- processField(field, value, line);
328
- return;
329
- }
330
- processField(line, "", line);
331
- }
332
- function processField(field, value, line) {
333
- switch (field) {
334
- case "event":
335
- eventType = value;
336
- break;
337
- case "data":
338
- data = `${data}${value}
339
- `;
340
- break;
341
- case "id":
342
- id = value.includes("\0") ? void 0 : value;
343
- break;
344
- case "retry":
345
- /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
346
- new ParseError(`Invalid \`retry\` value: "${value}"`, {
347
- type: "invalid-retry",
348
- value,
349
- line
350
- })
351
- );
352
- break;
353
- default:
354
- onError(
355
- new ParseError(
356
- `Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
357
- { type: "unknown-field", field, value, line }
358
- )
359
- );
360
- break;
361
- }
362
- }
363
- function dispatchEvent() {
364
- data.length > 0 && onEvent({
365
- id,
366
- event: eventType || void 0,
367
- // If the data buffer's last character is a U+000A LINE FEED (LF) character,
368
- // then remove the last character from the data buffer.
369
- data: data.endsWith(`
370
- `) ? data.slice(0, -1) : data
371
- }), id = void 0, data = "", eventType = "";
372
- }
373
- function reset(options = {}) {
374
- incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
375
- }
376
- return { feed, reset };
377
- }
378
- function splitLines(chunk) {
379
- const lines = [];
380
- let incompleteLine = "", searchIndex = 0;
381
- for (; searchIndex < chunk.length; ) {
382
- const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
383
- `, searchIndex);
384
- let lineEnd = -1;
385
- if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
386
- incompleteLine = chunk.slice(searchIndex);
387
- break;
388
- } else {
389
- const line = chunk.slice(searchIndex, lineEnd);
390
- lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
391
- ` && searchIndex++;
392
- }
393
- }
394
- return [lines, incompleteLine];
395
- }
396
-
397
- // ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/stream.js
398
- var EventSourceParserStream = class extends TransformStream {
399
- constructor({ onError, onRetry, onComment } = {}) {
400
- let parser;
401
- super({
402
- start(controller) {
403
- parser = createParser({
404
- onEvent: (event) => {
405
- controller.enqueue(event);
406
- },
407
- onError(error) {
408
- onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
409
- },
410
- onRetry,
411
- onComment
412
- });
413
- },
414
- transform(chunk) {
415
- parser.feed(chunk);
416
- }
417
- });
418
- }
419
- };
420
6
  function combineHeaders(...headers) {
421
7
  return headers.reduce(
422
8
  (combinedHeaders, currentHeaders) => ({
@@ -484,11 +70,11 @@ function handleFetchError({
484
70
  return error;
485
71
  }
486
72
  function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
487
- var _a15, _b, _c;
73
+ var _a, _b, _c;
488
74
  if (globalThisAny.window) {
489
75
  return `runtime/browser`;
490
76
  }
491
- if ((_a15 = globalThisAny.navigator) == null ? void 0 : _a15.userAgent) {
77
+ if ((_a = globalThisAny.navigator) == null ? void 0 : _a.userAgent) {
492
78
  return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
493
79
  }
494
80
  if ((_c = (_b = globalThisAny.process) == null ? void 0 : _b.versions) == null ? void 0 : _c.node) {
@@ -554,8 +140,8 @@ function injectJsonInstructionIntoMessages({
554
140
  schemaPrefix,
555
141
  schemaSuffix
556
142
  }) {
557
- var _a15, _b;
558
- const systemMessage = ((_a15 = messages[0]) == null ? void 0 : _a15.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
143
+ var _a, _b;
144
+ const systemMessage = ((_a = messages[0]) == null ? void 0 : _a.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
559
145
  systemMessage.content = injectJsonInstruction({
560
146
  prompt: systemMessage.content,
561
147
  schema,
@@ -615,16 +201,48 @@ function loadOptionalSetting({
615
201
  }
616
202
  return settingValue;
617
203
  }
204
+ function loadSetting({
205
+ settingValue,
206
+ environmentVariableName,
207
+ settingName,
208
+ description
209
+ }) {
210
+ if (typeof settingValue === "string") {
211
+ return settingValue;
212
+ }
213
+ if (settingValue != null) {
214
+ throw new LoadSettingError({
215
+ message: `${description} setting must be a string.`
216
+ });
217
+ }
218
+ if (typeof process === "undefined") {
219
+ throw new LoadSettingError({
220
+ message: `${description} setting is missing. Pass it using the '${settingName}' parameter. Environment variables is not supported in this environment.`
221
+ });
222
+ }
223
+ settingValue = process.env[environmentVariableName];
224
+ if (settingValue == null) {
225
+ throw new LoadSettingError({
226
+ message: `${description} setting is missing. Pass it using the '${settingName}' parameter or the ${environmentVariableName} environment variable.`
227
+ });
228
+ }
229
+ if (typeof settingValue !== "string") {
230
+ throw new LoadSettingError({
231
+ message: `${description} setting must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
232
+ });
233
+ }
234
+ return settingValue;
235
+ }
618
236
  function mediaTypeToExtension(mediaType) {
619
- var _a15;
237
+ var _a;
620
238
  const [_type, subtype = ""] = mediaType.toLowerCase().split("/");
621
- return (_a15 = {
239
+ return (_a = {
622
240
  mpeg: "mp3",
623
241
  "x-wav": "wav",
624
242
  opus: "ogg",
625
243
  mp4: "m4a",
626
244
  "x-m4a": "m4a"
627
- }[subtype]) != null ? _a15 : subtype;
245
+ }[subtype]) != null ? _a : subtype;
628
246
  }
629
247
  var suspectProtoRx = /"__proto__"\s*:/;
630
248
  var suspectConstructorRx = /"constructor"\s*:/;
@@ -937,7 +555,7 @@ function tool(tool2) {
937
555
  }
938
556
  function createProviderDefinedToolFactory({
939
557
  id,
940
- name: name14,
558
+ name,
941
559
  inputSchema
942
560
  }) {
943
561
  return ({
@@ -951,7 +569,7 @@ function createProviderDefinedToolFactory({
951
569
  }) => tool({
952
570
  type: "provider-defined",
953
571
  id,
954
- name: name14,
572
+ name,
955
573
  args,
956
574
  inputSchema,
957
575
  outputSchema,
@@ -964,7 +582,7 @@ function createProviderDefinedToolFactory({
964
582
  }
965
583
  function createProviderDefinedToolFactoryWithOutputSchema({
966
584
  id,
967
- name: name14,
585
+ name,
968
586
  inputSchema,
969
587
  outputSchema
970
588
  }) {
@@ -978,7 +596,7 @@ function createProviderDefinedToolFactoryWithOutputSchema({
978
596
  }) => tool({
979
597
  type: "provider-defined",
980
598
  id,
981
- name: name14,
599
+ name,
982
600
  args,
983
601
  inputSchema,
984
602
  outputSchema,
@@ -1158,11 +776,11 @@ function parseAnyDef() {
1158
776
  return {};
1159
777
  }
1160
778
  function parseArrayDef(def, refs) {
1161
- var _a15, _b, _c;
779
+ var _a, _b, _c;
1162
780
  const res = {
1163
781
  type: "array"
1164
782
  };
1165
- if (((_a15 = def.type) == null ? void 0 : _a15._def) && ((_c = (_b = def.type) == null ? void 0 : _b._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
783
+ if (((_a = def.type) == null ? void 0 : _a._def) && ((_c = (_b = def.type) == null ? void 0 : _b._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
1166
784
  res.items = parseDef(def.type._def, {
1167
785
  ...refs,
1168
786
  currentPath: [...refs.currentPath, "items"]
@@ -1521,8 +1139,8 @@ function escapeNonAlphaNumeric(source) {
1521
1139
  return result;
1522
1140
  }
1523
1141
  function addFormat(schema, value, message, refs) {
1524
- var _a15;
1525
- if (schema.format || ((_a15 = schema.anyOf) == null ? void 0 : _a15.some((x) => x.format))) {
1142
+ var _a;
1143
+ if (schema.format || ((_a = schema.anyOf) == null ? void 0 : _a.some((x) => x.format))) {
1526
1144
  if (!schema.anyOf) {
1527
1145
  schema.anyOf = [];
1528
1146
  }
@@ -1541,8 +1159,8 @@ function addFormat(schema, value, message, refs) {
1541
1159
  }
1542
1160
  }
1543
1161
  function addPattern(schema, regex, message, refs) {
1544
- var _a15;
1545
- if (schema.pattern || ((_a15 = schema.allOf) == null ? void 0 : _a15.some((x) => x.pattern))) {
1162
+ var _a;
1163
+ if (schema.pattern || ((_a = schema.allOf) == null ? void 0 : _a.some((x) => x.pattern))) {
1546
1164
  if (!schema.allOf) {
1547
1165
  schema.allOf = [];
1548
1166
  }
@@ -1561,7 +1179,7 @@ function addPattern(schema, regex, message, refs) {
1561
1179
  }
1562
1180
  }
1563
1181
  function stringifyRegExpWithFlags(regex, refs) {
1564
- var _a15;
1182
+ var _a;
1565
1183
  if (!refs.applyRegexFlags || !regex.flags) {
1566
1184
  return regex.source;
1567
1185
  }
@@ -1591,7 +1209,7 @@ function stringifyRegExpWithFlags(regex, refs) {
1591
1209
  pattern += source[i];
1592
1210
  pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
1593
1211
  inCharRange = false;
1594
- } else if (source[i + 1] === "-" && ((_a15 = source[i + 2]) == null ? void 0 : _a15.match(/[a-z]/))) {
1212
+ } else if (source[i + 1] === "-" && ((_a = source[i + 2]) == null ? void 0 : _a.match(/[a-z]/))) {
1595
1213
  pattern += source[i];
1596
1214
  inCharRange = true;
1597
1215
  } else {
@@ -1633,13 +1251,13 @@ function stringifyRegExpWithFlags(regex, refs) {
1633
1251
  return pattern;
1634
1252
  }
1635
1253
  function parseRecordDef(def, refs) {
1636
- var _a15, _b, _c, _d, _e, _f;
1254
+ var _a, _b, _c, _d, _e, _f;
1637
1255
  const schema = {
1638
1256
  type: "object",
1639
- additionalProperties: (_a15 = parseDef(def.valueType._def, {
1257
+ additionalProperties: (_a = parseDef(def.valueType._def, {
1640
1258
  ...refs,
1641
1259
  currentPath: [...refs.currentPath, "additionalProperties"]
1642
- })) != null ? _a15 : refs.allowedAdditionalProperties
1260
+ })) != null ? _a : refs.allowedAdditionalProperties
1643
1261
  };
1644
1262
  if (((_b = def.keyType) == null ? void 0 : _b._def.typeName) === ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
1645
1263
  const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
@@ -1896,8 +1514,8 @@ function safeIsOptional(schema) {
1896
1514
  }
1897
1515
  }
1898
1516
  var parseOptionalDef = (def, refs) => {
1899
- var _a15;
1900
- if (refs.currentPath.toString() === ((_a15 = refs.propertyPath) == null ? void 0 : _a15.toString())) {
1517
+ var _a;
1518
+ if (refs.currentPath.toString() === ((_a = refs.propertyPath) == null ? void 0 : _a.toString())) {
1901
1519
  return parseDef(def.innerType._def, refs);
1902
1520
  }
1903
1521
  const innerSchema = parseDef(def.innerType._def, {
@@ -2067,10 +1685,10 @@ var selectParser = (def, typeName, refs) => {
2067
1685
  }
2068
1686
  };
2069
1687
  function parseDef(def, refs, forceResolution = false) {
2070
- var _a15;
1688
+ var _a;
2071
1689
  const seenItem = refs.seen.get(def);
2072
1690
  if (refs.override) {
2073
- const overrideResult = (_a15 = refs.override) == null ? void 0 : _a15.call(
1691
+ const overrideResult = (_a = refs.override) == null ? void 0 : _a.call(
2074
1692
  refs,
2075
1693
  def,
2076
1694
  refs,
@@ -2136,11 +1754,11 @@ var getRefs = (options) => {
2136
1754
  currentPath,
2137
1755
  propertyPath: void 0,
2138
1756
  seen: new Map(
2139
- Object.entries(_options.definitions).map(([name14, def]) => [
1757
+ Object.entries(_options.definitions).map(([name, def]) => [
2140
1758
  def._def,
2141
1759
  {
2142
1760
  def: def._def,
2143
- path: [..._options.basePath, _options.definitionPath, name14],
1761
+ path: [..._options.basePath, _options.definitionPath, name],
2144
1762
  // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
2145
1763
  jsonSchema: void 0
2146
1764
  }
@@ -2149,50 +1767,50 @@ var getRefs = (options) => {
2149
1767
  };
2150
1768
  };
2151
1769
  var zodToJsonSchema = (schema, options) => {
2152
- var _a15;
1770
+ var _a;
2153
1771
  const refs = getRefs(options);
2154
1772
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
2155
- (acc, [name22, schema2]) => {
2156
- var _a22;
1773
+ (acc, [name2, schema2]) => {
1774
+ var _a2;
2157
1775
  return {
2158
1776
  ...acc,
2159
- [name22]: (_a22 = parseDef(
1777
+ [name2]: (_a2 = parseDef(
2160
1778
  schema2._def,
2161
1779
  {
2162
1780
  ...refs,
2163
- currentPath: [...refs.basePath, refs.definitionPath, name22]
1781
+ currentPath: [...refs.basePath, refs.definitionPath, name2]
2164
1782
  },
2165
1783
  true
2166
- )) != null ? _a22 : parseAnyDef()
1784
+ )) != null ? _a2 : parseAnyDef()
2167
1785
  };
2168
1786
  },
2169
1787
  {}
2170
1788
  ) : void 0;
2171
- const name14 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
2172
- const main = (_a15 = parseDef(
1789
+ const name = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
1790
+ const main = (_a = parseDef(
2173
1791
  schema._def,
2174
- name14 === void 0 ? refs : {
1792
+ name === void 0 ? refs : {
2175
1793
  ...refs,
2176
- currentPath: [...refs.basePath, refs.definitionPath, name14]
1794
+ currentPath: [...refs.basePath, refs.definitionPath, name]
2177
1795
  },
2178
1796
  false
2179
- )) != null ? _a15 : parseAnyDef();
1797
+ )) != null ? _a : parseAnyDef();
2180
1798
  const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
2181
1799
  if (title !== void 0) {
2182
1800
  main.title = title;
2183
1801
  }
2184
- const combined = name14 === void 0 ? definitions ? {
1802
+ const combined = name === void 0 ? definitions ? {
2185
1803
  ...main,
2186
1804
  [refs.definitionPath]: definitions
2187
1805
  } : main : {
2188
1806
  $ref: [
2189
1807
  ...refs.$refStrategy === "relative" ? [] : refs.basePath,
2190
1808
  refs.definitionPath,
2191
- name14
1809
+ name
2192
1810
  ].join("/"),
2193
1811
  [refs.definitionPath]: {
2194
1812
  ...definitions,
2195
- [name14]: main
1813
+ [name]: main
2196
1814
  }
2197
1815
  };
2198
1816
  combined.$schema = "http://json-schema.org/draft-07/schema#";
@@ -2200,8 +1818,8 @@ var zodToJsonSchema = (schema, options) => {
2200
1818
  };
2201
1819
  var zod_to_json_schema_default = zodToJsonSchema;
2202
1820
  function zod3Schema(zodSchema2, options) {
2203
- var _a15;
2204
- const useReferences = (_a15 = void 0 ) != null ? _a15 : false;
1821
+ var _a;
1822
+ const useReferences = (_a = options == null ? void 0 : options.useReferences) != null ? _a : false;
2205
1823
  return jsonSchema(
2206
1824
  // defer json schema creation to avoid unnecessary computation when only validation is needed
2207
1825
  () => zod_to_json_schema_default(zodSchema2, {
@@ -2216,8 +1834,8 @@ function zod3Schema(zodSchema2, options) {
2216
1834
  );
2217
1835
  }
2218
1836
  function zod4Schema(zodSchema2, options) {
2219
- var _a15;
2220
- const useReferences = (_a15 = void 0 ) != null ? _a15 : false;
1837
+ var _a;
1838
+ const useReferences = (_a = options == null ? void 0 : options.useReferences) != null ? _a : false;
2221
1839
  return jsonSchema(
2222
1840
  // defer json schema creation to avoid unnecessary computation when only validation is needed
2223
1841
  () => z4.toJSONSchema(zodSchema2, {
@@ -2238,9 +1856,9 @@ function isZod4Schema(zodSchema2) {
2238
1856
  }
2239
1857
  function zodSchema(zodSchema2, options) {
2240
1858
  if (isZod4Schema(zodSchema2)) {
2241
- return zod4Schema(zodSchema2);
1859
+ return zod4Schema(zodSchema2, options);
2242
1860
  } else {
2243
- return zod3Schema(zodSchema2);
1861
+ return zod3Schema(zodSchema2, options);
2244
1862
  }
2245
1863
  }
2246
1864
  var schemaSymbol = Symbol.for("vercel.ai.schema");
@@ -2290,8 +1908,8 @@ function withoutTrailingSlash(url) {
2290
1908
  return url == null ? void 0 : url.replace(/\/$/, "");
2291
1909
  }
2292
1910
  function getOpenAIMetadata(message) {
2293
- var _a15, _b;
2294
- return (_b = (_a15 = message == null ? void 0 : message.providerOptions) == null ? void 0 : _a15.openaiCompatible) != null ? _b : {};
1911
+ var _a, _b;
1912
+ return (_b = (_a = message == null ? void 0 : message.providerOptions) == null ? void 0 : _a.openaiCompatible) != null ? _b : {};
2295
1913
  }
2296
1914
  function convertToOpenAICompatibleChatMessages(prompt) {
2297
1915
  const messages = [];
@@ -2516,10 +2134,10 @@ var OpenAICompatibleChatLanguageModel = class {
2516
2134
  // type inferred via constructor
2517
2135
  constructor(modelId, config) {
2518
2136
  this.specificationVersion = "v2";
2519
- var _a15, _b;
2137
+ var _a, _b;
2520
2138
  this.modelId = modelId;
2521
2139
  this.config = config;
2522
- const errorStructure = (_a15 = config.errorStructure) != null ? _a15 : defaultOpenAICompatibleErrorStructure;
2140
+ const errorStructure = (_a = config.errorStructure) != null ? _a : defaultOpenAICompatibleErrorStructure;
2523
2141
  this.chunkSchema = createOpenAICompatibleChatChunkSchema(
2524
2142
  errorStructure.errorSchema
2525
2143
  );
@@ -2533,8 +2151,8 @@ var OpenAICompatibleChatLanguageModel = class {
2533
2151
  return this.config.provider.split(".")[0].trim();
2534
2152
  }
2535
2153
  get supportedUrls() {
2536
- var _a15, _b, _c;
2537
- return (_c = (_b = (_a15 = this.config).supportedUrls) == null ? void 0 : _b.call(_a15)) != null ? _c : {};
2154
+ var _a, _b, _c;
2155
+ return (_c = (_b = (_a = this.config).supportedUrls) == null ? void 0 : _b.call(_a)) != null ? _c : {};
2538
2156
  }
2539
2157
  async getArgs({
2540
2158
  prompt,
@@ -2551,14 +2169,14 @@ var OpenAICompatibleChatLanguageModel = class {
2551
2169
  toolChoice,
2552
2170
  tools
2553
2171
  }) {
2554
- var _a15, _b, _c, _d;
2172
+ var _a, _b, _c, _d;
2555
2173
  const warnings = [];
2556
2174
  const compatibleOptions = Object.assign(
2557
- (_a15 = await parseProviderOptions({
2175
+ (_a = await parseProviderOptions({
2558
2176
  provider: "openai-compatible",
2559
2177
  providerOptions,
2560
2178
  schema: openaiCompatibleProviderOptions
2561
- })) != null ? _a15 : {},
2179
+ })) != null ? _a : {},
2562
2180
  (_b = await parseProviderOptions({
2563
2181
  provider: this.providerOptionsName,
2564
2182
  providerOptions,
@@ -2624,7 +2242,7 @@ var OpenAICompatibleChatLanguageModel = class {
2624
2242
  };
2625
2243
  }
2626
2244
  async doGenerate(options) {
2627
- var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2245
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2628
2246
  const { args, warnings } = await this.getArgs({ ...options });
2629
2247
  const body = JSON.stringify(args);
2630
2248
  const {
@@ -2651,7 +2269,7 @@ var OpenAICompatibleChatLanguageModel = class {
2651
2269
  if (text != null && text.length > 0) {
2652
2270
  content.push({ type: "text", text });
2653
2271
  }
2654
- const reasoning = (_a15 = choice.message.reasoning_content) != null ? _a15 : choice.message.reasoning;
2272
+ const reasoning = (_a = choice.message.reasoning_content) != null ? _a : choice.message.reasoning;
2655
2273
  if (reasoning != null && reasoning.length > 0) {
2656
2274
  content.push({
2657
2275
  type: "reasoning",
@@ -2702,7 +2320,7 @@ var OpenAICompatibleChatLanguageModel = class {
2702
2320
  };
2703
2321
  }
2704
2322
  async doStream(options) {
2705
- var _a15;
2323
+ var _a;
2706
2324
  const { args, warnings } = await this.getArgs({ ...options });
2707
2325
  const body = {
2708
2326
  ...args,
@@ -2710,7 +2328,7 @@ var OpenAICompatibleChatLanguageModel = class {
2710
2328
  // only include stream_options when in strict compatibility mode:
2711
2329
  stream_options: this.config.includeUsage ? { include_usage: true } : void 0
2712
2330
  };
2713
- const metadataExtractor = (_a15 = this.config.metadataExtractor) == null ? void 0 : _a15.createStreamExtractor();
2331
+ const metadataExtractor = (_a = this.config.metadataExtractor) == null ? void 0 : _a.createStreamExtractor();
2714
2332
  const { responseHeaders, value: response } = await postJsonToApi({
2715
2333
  url: this.config.url({
2716
2334
  path: "/chat/completions",
@@ -2752,7 +2370,7 @@ var OpenAICompatibleChatLanguageModel = class {
2752
2370
  },
2753
2371
  // TODO we lost type safety on Chunk, most likely due to the error schema. MUST FIX
2754
2372
  transform(chunk, controller) {
2755
- var _a22, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2373
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2756
2374
  if (options.includeRawChunks) {
2757
2375
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2758
2376
  }
@@ -2809,7 +2427,7 @@ var OpenAICompatibleChatLanguageModel = class {
2809
2427
  return;
2810
2428
  }
2811
2429
  const delta = choice.delta;
2812
- const reasoningContent = (_a22 = delta.reasoning_content) != null ? _a22 : delta.reasoning;
2430
+ const reasoningContent = (_a2 = delta.reasoning_content) != null ? _a2 : delta.reasoning;
2813
2431
  if (reasoningContent) {
2814
2432
  if (!isActiveReasoning) {
2815
2433
  controller.enqueue({
@@ -2919,7 +2537,7 @@ var OpenAICompatibleChatLanguageModel = class {
2919
2537
  }
2920
2538
  },
2921
2539
  flush(controller) {
2922
- var _a22, _b, _c, _d, _e, _f;
2540
+ var _a2, _b, _c, _d, _e, _f;
2923
2541
  if (isActiveReasoning) {
2924
2542
  controller.enqueue({ type: "reasoning-end", id: "reasoning-0" });
2925
2543
  }
@@ -2935,7 +2553,7 @@ var OpenAICompatibleChatLanguageModel = class {
2935
2553
  });
2936
2554
  controller.enqueue({
2937
2555
  type: "tool-call",
2938
- toolCallId: (_a22 = toolCall.id) != null ? _a22 : generateId(),
2556
+ toolCallId: (_a2 = toolCall.id) != null ? _a2 : generateId(),
2939
2557
  toolName: toolCall.function.name,
2940
2558
  input: toolCall.function.arguments
2941
2559
  });
@@ -3165,10 +2783,10 @@ var OpenAICompatibleCompletionLanguageModel = class {
3165
2783
  // type inferred via constructor
3166
2784
  constructor(modelId, config) {
3167
2785
  this.specificationVersion = "v2";
3168
- var _a15;
2786
+ var _a;
3169
2787
  this.modelId = modelId;
3170
2788
  this.config = config;
3171
- const errorStructure = (_a15 = config.errorStructure) != null ? _a15 : defaultOpenAICompatibleErrorStructure;
2789
+ const errorStructure = (_a = config.errorStructure) != null ? _a : defaultOpenAICompatibleErrorStructure;
3172
2790
  this.chunkSchema = createOpenAICompatibleCompletionChunkSchema(
3173
2791
  errorStructure.errorSchema
3174
2792
  );
@@ -3181,8 +2799,8 @@ var OpenAICompatibleCompletionLanguageModel = class {
3181
2799
  return this.config.provider.split(".")[0].trim();
3182
2800
  }
3183
2801
  get supportedUrls() {
3184
- var _a15, _b, _c;
3185
- return (_c = (_b = (_a15 = this.config).supportedUrls) == null ? void 0 : _b.call(_a15)) != null ? _c : {};
2802
+ var _a, _b, _c;
2803
+ return (_c = (_b = (_a = this.config).supportedUrls) == null ? void 0 : _b.call(_a)) != null ? _c : {};
3186
2804
  }
3187
2805
  async getArgs({
3188
2806
  prompt,
@@ -3199,13 +2817,13 @@ var OpenAICompatibleCompletionLanguageModel = class {
3199
2817
  tools,
3200
2818
  toolChoice
3201
2819
  }) {
3202
- var _a15;
2820
+ var _a;
3203
2821
  const warnings = [];
3204
- const completionOptions = (_a15 = await parseProviderOptions({
2822
+ const completionOptions = (_a = await parseProviderOptions({
3205
2823
  provider: this.providerOptionsName,
3206
2824
  providerOptions,
3207
2825
  schema: openaiCompatibleCompletionProviderOptions
3208
- })) != null ? _a15 : {};
2826
+ })) != null ? _a : {};
3209
2827
  if (topK != null) {
3210
2828
  warnings.push({ type: "unsupported-setting", setting: "topK" });
3211
2829
  }
@@ -3250,7 +2868,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
3250
2868
  };
3251
2869
  }
3252
2870
  async doGenerate(options) {
3253
- var _a15, _b, _c, _d, _e, _f;
2871
+ var _a, _b, _c, _d, _e, _f;
3254
2872
  const { args, warnings } = await this.getArgs(options);
3255
2873
  const {
3256
2874
  responseHeaders,
@@ -3278,7 +2896,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
3278
2896
  return {
3279
2897
  content,
3280
2898
  usage: {
3281
- inputTokens: (_b = (_a15 = response.usage) == null ? void 0 : _a15.prompt_tokens) != null ? _b : void 0,
2899
+ inputTokens: (_b = (_a = response.usage) == null ? void 0 : _a.prompt_tokens) != null ? _b : void 0,
3282
2900
  outputTokens: (_d = (_c = response.usage) == null ? void 0 : _c.completion_tokens) != null ? _d : void 0,
3283
2901
  totalTokens: (_f = (_e = response.usage) == null ? void 0 : _e.total_tokens) != null ? _f : void 0
3284
2902
  },
@@ -3328,7 +2946,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
3328
2946
  controller.enqueue({ type: "stream-start", warnings });
3329
2947
  },
3330
2948
  transform(chunk, controller) {
3331
- var _a15, _b, _c;
2949
+ var _a, _b, _c;
3332
2950
  if (options.includeRawChunks) {
3333
2951
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
3334
2952
  }
@@ -3355,7 +2973,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
3355
2973
  });
3356
2974
  }
3357
2975
  if (value.usage != null) {
3358
- usage.inputTokens = (_a15 = value.usage.prompt_tokens) != null ? _a15 : void 0;
2976
+ usage.inputTokens = (_a = value.usage.prompt_tokens) != null ? _a : void 0;
3359
2977
  usage.outputTokens = (_b = value.usage.completion_tokens) != null ? _b : void 0;
3360
2978
  usage.totalTokens = (_c = value.usage.total_tokens) != null ? _c : void 0;
3361
2979
  }
@@ -3445,12 +3063,12 @@ var OpenAICompatibleEmbeddingModel = class {
3445
3063
  return this.config.provider;
3446
3064
  }
3447
3065
  get maxEmbeddingsPerCall() {
3448
- var _a15;
3449
- return (_a15 = this.config.maxEmbeddingsPerCall) != null ? _a15 : 2048;
3066
+ var _a;
3067
+ return (_a = this.config.maxEmbeddingsPerCall) != null ? _a : 2048;
3450
3068
  }
3451
3069
  get supportsParallelCalls() {
3452
- var _a15;
3453
- return (_a15 = this.config.supportsParallelCalls) != null ? _a15 : true;
3070
+ var _a;
3071
+ return (_a = this.config.supportsParallelCalls) != null ? _a : true;
3454
3072
  }
3455
3073
  get providerOptionsName() {
3456
3074
  return this.config.provider.split(".")[0].trim();
@@ -3461,13 +3079,13 @@ var OpenAICompatibleEmbeddingModel = class {
3461
3079
  abortSignal,
3462
3080
  providerOptions
3463
3081
  }) {
3464
- var _a15, _b, _c;
3082
+ var _a, _b, _c;
3465
3083
  const compatibleOptions = Object.assign(
3466
- (_a15 = await parseProviderOptions({
3084
+ (_a = await parseProviderOptions({
3467
3085
  provider: "openai-compatible",
3468
3086
  providerOptions,
3469
3087
  schema: openaiCompatibleEmbeddingProviderOptions
3470
- })) != null ? _a15 : {},
3088
+ })) != null ? _a : {},
3471
3089
  (_b = await parseProviderOptions({
3472
3090
  provider: this.providerOptionsName,
3473
3091
  providerOptions,
@@ -3541,7 +3159,7 @@ var OpenAICompatibleImageModel = class {
3541
3159
  headers,
3542
3160
  abortSignal
3543
3161
  }) {
3544
- var _a15, _b, _c, _d, _e;
3162
+ var _a, _b, _c, _d, _e;
3545
3163
  const warnings = [];
3546
3164
  if (aspectRatio != null) {
3547
3165
  warnings.push({
@@ -3553,7 +3171,7 @@ var OpenAICompatibleImageModel = class {
3553
3171
  if (seed != null) {
3554
3172
  warnings.push({ type: "unsupported-setting", setting: "seed" });
3555
3173
  }
3556
- const currentDate = (_c = (_b = (_a15 = this.config._internal) == null ? void 0 : _a15.currentDate) == null ? void 0 : _b.call(_a15)) != null ? _c : /* @__PURE__ */ new Date();
3174
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
3557
3175
  const { value: response, responseHeaders } = await postJsonToApi({
3558
3176
  url: this.config.url({
3559
3177
  path: "/images/generations",
@@ -4185,9 +3803,9 @@ var anthropicProviderOptions = z.object({
4185
3803
  });
4186
3804
  var MAX_CACHE_BREAKPOINTS = 4;
4187
3805
  function getCacheControl(providerMetadata) {
4188
- var _a15;
3806
+ var _a;
4189
3807
  const anthropic2 = providerMetadata == null ? void 0 : providerMetadata.anthropic;
4190
- const cacheControlValue = (_a15 = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _a15 : anthropic2 == null ? void 0 : anthropic2.cache_control;
3808
+ const cacheControlValue = (_a = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _a : anthropic2 == null ? void 0 : anthropic2.cache_control;
4191
3809
  return cacheControlValue;
4192
3810
  }
4193
3811
  var CacheControlValidator = class {
@@ -4718,20 +4336,20 @@ async function convertToAnthropicMessagesPrompt({
4718
4336
  warnings,
4719
4337
  cacheControlValidator
4720
4338
  }) {
4721
- var _a15, _b, _c, _d, _e;
4339
+ var _a, _b, _c, _d, _e;
4722
4340
  const betas = /* @__PURE__ */ new Set();
4723
4341
  const blocks = groupIntoBlocks(prompt);
4724
4342
  const validator2 = cacheControlValidator || new CacheControlValidator();
4725
4343
  let system = void 0;
4726
4344
  const messages = [];
4727
4345
  async function shouldEnableCitations(providerMetadata) {
4728
- var _a22, _b2;
4346
+ var _a2, _b2;
4729
4347
  const anthropicOptions = await parseProviderOptions({
4730
4348
  provider: "anthropic",
4731
4349
  providerOptions: providerMetadata,
4732
4350
  schema: anthropicFilePartProviderOptions
4733
4351
  });
4734
- return (_b2 = (_a22 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a22.enabled) != null ? _b2 : false;
4352
+ return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
4735
4353
  }
4736
4354
  async function getDocumentMetadata(providerMetadata) {
4737
4355
  const anthropicOptions = await parseProviderOptions({
@@ -4774,10 +4392,10 @@ async function convertToAnthropicMessagesPrompt({
4774
4392
  for (let j = 0; j < content.length; j++) {
4775
4393
  const part = content[j];
4776
4394
  const isLastPart = j === content.length - 1;
4777
- const cacheControl = (_a15 = validator2.getCacheControl(part.providerOptions, {
4395
+ const cacheControl = (_a = validator2.getCacheControl(part.providerOptions, {
4778
4396
  type: "user message part",
4779
4397
  canCache: true
4780
- })) != null ? _a15 : isLastPart ? validator2.getCacheControl(message.providerOptions, {
4398
+ })) != null ? _a : isLastPart ? validator2.getCacheControl(message.providerOptions, {
4781
4399
  type: "user message",
4782
4400
  canCache: true
4783
4401
  }) : void 0;
@@ -5263,7 +4881,7 @@ function mapAnthropicStopReason({
5263
4881
  }
5264
4882
  }
5265
4883
  function createCitationSource(citation, citationDocuments, generateId3) {
5266
- var _a15;
4884
+ var _a;
5267
4885
  if (citation.type !== "page_location" && citation.type !== "char_location") {
5268
4886
  return;
5269
4887
  }
@@ -5276,7 +4894,7 @@ function createCitationSource(citation, citationDocuments, generateId3) {
5276
4894
  sourceType: "document",
5277
4895
  id: generateId3(),
5278
4896
  mediaType: documentInfo.mediaType,
5279
- title: (_a15 = citation.document_title) != null ? _a15 : documentInfo.title,
4897
+ title: (_a = citation.document_title) != null ? _a : documentInfo.title,
5280
4898
  filename: documentInfo.filename,
5281
4899
  providerMetadata: {
5282
4900
  anthropic: citation.type === "page_location" ? {
@@ -5294,10 +4912,10 @@ function createCitationSource(citation, citationDocuments, generateId3) {
5294
4912
  var AnthropicMessagesLanguageModel = class {
5295
4913
  constructor(modelId, config) {
5296
4914
  this.specificationVersion = "v2";
5297
- var _a15;
4915
+ var _a;
5298
4916
  this.modelId = modelId;
5299
4917
  this.config = config;
5300
- this.generateId = (_a15 = config.generateId) != null ? _a15 : generateId;
4918
+ this.generateId = (_a = config.generateId) != null ? _a : generateId;
5301
4919
  }
5302
4920
  supportsUrl(url) {
5303
4921
  return url.protocol === "https:";
@@ -5306,8 +4924,8 @@ var AnthropicMessagesLanguageModel = class {
5306
4924
  return this.config.provider;
5307
4925
  }
5308
4926
  get supportedUrls() {
5309
- var _a15, _b, _c;
5310
- return (_c = (_b = (_a15 = this.config).supportedUrls) == null ? void 0 : _b.call(_a15)) != null ? _c : {};
4927
+ var _a, _b, _c;
4928
+ return (_c = (_b = (_a = this.config).supportedUrls) == null ? void 0 : _b.call(_a)) != null ? _c : {};
5311
4929
  }
5312
4930
  async getArgs({
5313
4931
  prompt,
@@ -5324,7 +4942,7 @@ var AnthropicMessagesLanguageModel = class {
5324
4942
  toolChoice,
5325
4943
  providerOptions
5326
4944
  }) {
5327
- var _a15, _b, _c, _d;
4945
+ var _a, _b, _c, _d;
5328
4946
  const warnings = [];
5329
4947
  if (frequencyPenalty != null) {
5330
4948
  warnings.push({
@@ -5388,7 +5006,7 @@ var AnthropicMessagesLanguageModel = class {
5388
5006
  const cacheControlValidator = new CacheControlValidator();
5389
5007
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
5390
5008
  prompt,
5391
- sendReasoning: (_a15 = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _a15 : true,
5009
+ sendReasoning: (_a = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _a : true,
5392
5010
  warnings,
5393
5011
  cacheControlValidator
5394
5012
  });
@@ -5520,38 +5138,38 @@ var AnthropicMessagesLanguageModel = class {
5520
5138
  );
5521
5139
  }
5522
5140
  buildRequestUrl(isStreaming) {
5523
- var _a15, _b, _c;
5524
- return (_c = (_b = (_a15 = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a15, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
5141
+ var _a, _b, _c;
5142
+ return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
5525
5143
  }
5526
5144
  transformRequestBody(args) {
5527
- var _a15, _b, _c;
5528
- return (_c = (_b = (_a15 = this.config).transformRequestBody) == null ? void 0 : _b.call(_a15, args)) != null ? _c : args;
5145
+ var _a, _b, _c;
5146
+ return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;
5529
5147
  }
5530
5148
  extractCitationDocuments(prompt) {
5531
5149
  const isCitationPart = (part) => {
5532
- var _a15, _b;
5150
+ var _a, _b;
5533
5151
  if (part.type !== "file") {
5534
5152
  return false;
5535
5153
  }
5536
5154
  if (part.mediaType !== "application/pdf" && part.mediaType !== "text/plain") {
5537
5155
  return false;
5538
5156
  }
5539
- const anthropic2 = (_a15 = part.providerOptions) == null ? void 0 : _a15.anthropic;
5157
+ const anthropic2 = (_a = part.providerOptions) == null ? void 0 : _a.anthropic;
5540
5158
  const citationsConfig = anthropic2 == null ? void 0 : anthropic2.citations;
5541
5159
  return (_b = citationsConfig == null ? void 0 : citationsConfig.enabled) != null ? _b : false;
5542
5160
  };
5543
5161
  return prompt.filter((message) => message.role === "user").flatMap((message) => message.content).filter(isCitationPart).map((part) => {
5544
- var _a15;
5162
+ var _a;
5545
5163
  const filePart = part;
5546
5164
  return {
5547
- title: (_a15 = filePart.filename) != null ? _a15 : "Untitled Document",
5165
+ title: (_a = filePart.filename) != null ? _a : "Untitled Document",
5548
5166
  filename: filePart.filename,
5549
5167
  mediaType: filePart.mediaType
5550
5168
  };
5551
5169
  });
5552
5170
  }
5553
5171
  async doGenerate(options) {
5554
- var _a15, _b, _c, _d, _e, _f, _g, _h;
5172
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5555
5173
  const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
5556
5174
  const citationDocuments = this.extractCitationDocuments(options.prompt);
5557
5175
  const {
@@ -5694,11 +5312,11 @@ var AnthropicMessagesLanguageModel = class {
5694
5312
  toolCallId: part.tool_use_id,
5695
5313
  toolName: "web_search",
5696
5314
  result: part.content.map((result) => {
5697
- var _a22;
5315
+ var _a2;
5698
5316
  return {
5699
5317
  url: result.url,
5700
5318
  title: result.title,
5701
- pageAge: (_a22 = result.page_age) != null ? _a22 : null,
5319
+ pageAge: (_a2 = result.page_age) != null ? _a2 : null,
5702
5320
  encryptedContent: result.encrypted_content,
5703
5321
  type: result.type
5704
5322
  };
@@ -5714,7 +5332,7 @@ var AnthropicMessagesLanguageModel = class {
5714
5332
  title: result.title,
5715
5333
  providerMetadata: {
5716
5334
  anthropic: {
5717
- pageAge: (_a15 = result.page_age) != null ? _a15 : null
5335
+ pageAge: (_a = result.page_age) != null ? _a : null
5718
5336
  }
5719
5337
  }
5720
5338
  });
@@ -5851,7 +5469,7 @@ var AnthropicMessagesLanguageModel = class {
5851
5469
  controller.enqueue({ type: "stream-start", warnings });
5852
5470
  },
5853
5471
  transform(chunk, controller) {
5854
- var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5472
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5855
5473
  if (options.includeRawChunks) {
5856
5474
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
5857
5475
  }
@@ -5990,11 +5608,11 @@ var AnthropicMessagesLanguageModel = class {
5990
5608
  toolCallId: part.tool_use_id,
5991
5609
  toolName: "web_search",
5992
5610
  result: part.content.map((result) => {
5993
- var _a22;
5611
+ var _a2;
5994
5612
  return {
5995
5613
  url: result.url,
5996
5614
  title: result.title,
5997
- pageAge: (_a22 = result.page_age) != null ? _a22 : null,
5615
+ pageAge: (_a2 = result.page_age) != null ? _a2 : null,
5998
5616
  encryptedContent: result.encrypted_content,
5999
5617
  type: result.type
6000
5618
  };
@@ -6010,7 +5628,7 @@ var AnthropicMessagesLanguageModel = class {
6010
5628
  title: result.title,
6011
5629
  providerMetadata: {
6012
5630
  anthropic: {
6013
- pageAge: (_a15 = result.page_age) != null ? _a15 : null
5631
+ pageAge: (_a = result.page_age) != null ? _a : null
6014
5632
  }
6015
5633
  }
6016
5634
  });
@@ -6627,13 +6245,13 @@ var anthropicTools = {
6627
6245
  webSearch_20250305
6628
6246
  };
6629
6247
  function createAnthropic(options = {}) {
6630
- var _a15, _b;
6631
- const baseURL = (_a15 = withoutTrailingSlash(
6248
+ var _a, _b;
6249
+ const baseURL = (_a = withoutTrailingSlash(
6632
6250
  loadOptionalSetting({
6633
6251
  settingValue: options.baseURL,
6634
6252
  environmentVariableName: "ANTHROPIC_BASE_URL"
6635
6253
  })
6636
- )) != null ? _a15 : "https://api.anthropic.com/v1";
6254
+ )) != null ? _a : "https://api.anthropic.com/v1";
6637
6255
  const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
6638
6256
  const getHeaders = () => withUserAgentSuffix(
6639
6257
  {
@@ -6648,13 +6266,13 @@ function createAnthropic(options = {}) {
6648
6266
  `ai-sdk/anthropic/${VERSION3}`
6649
6267
  );
6650
6268
  const createChatModel = (modelId) => {
6651
- var _a22;
6269
+ var _a2;
6652
6270
  return new AnthropicMessagesLanguageModel(modelId, {
6653
6271
  provider: providerName,
6654
6272
  baseURL,
6655
6273
  headers: getHeaders,
6656
6274
  fetch: options.fetch,
6657
- generateId: (_a22 = options.generateId) != null ? _a22 : generateId,
6275
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId,
6658
6276
  supportedUrls: () => ({
6659
6277
  "image/*": [/^https?:\/\/.*$/]
6660
6278
  })
@@ -6929,11 +6547,11 @@ function isEmptyObjectSchema(jsonSchema2) {
6929
6547
  return jsonSchema2 != null && typeof jsonSchema2 === "object" && jsonSchema2.type === "object" && (jsonSchema2.properties == null || Object.keys(jsonSchema2.properties).length === 0) && !jsonSchema2.additionalProperties;
6930
6548
  }
6931
6549
  function convertToGoogleGenerativeAIMessages(prompt, options) {
6932
- var _a15;
6550
+ var _a;
6933
6551
  const systemInstructionParts = [];
6934
6552
  const contents = [];
6935
6553
  let systemMessagesAllowed = true;
6936
- const isGemmaModel = (_a15 = options == null ? void 0 : options.isGemmaModel) != null ? _a15 : false;
6554
+ const isGemmaModel = (_a = options == null ? void 0 : options.isGemmaModel) != null ? _a : false;
6937
6555
  for (const { role, content } of prompt) {
6938
6556
  switch (role) {
6939
6557
  case "system": {
@@ -6981,8 +6599,8 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
6981
6599
  contents.push({
6982
6600
  role: "model",
6983
6601
  parts: content.map((part) => {
6984
- var _a22, _b, _c;
6985
- const thoughtSignature = ((_b = (_a22 = part.providerOptions) == null ? void 0 : _a22.google) == null ? void 0 : _b.thoughtSignature) != null ? String((_c = part.providerOptions.google) == null ? void 0 : _c.thoughtSignature) : void 0;
6602
+ var _a2, _b, _c;
6603
+ const thoughtSignature = ((_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.google) == null ? void 0 : _b.thoughtSignature) != null ? String((_c = part.providerOptions.google) == null ? void 0 : _c.thoughtSignature) : void 0;
6986
6604
  switch (part.type) {
6987
6605
  case "text": {
6988
6606
  return part.text.length === 0 ? void 0 : {
@@ -7205,7 +6823,7 @@ function prepareTools3({
7205
6823
  toolChoice,
7206
6824
  modelId
7207
6825
  }) {
7208
- var _a15;
6826
+ var _a;
7209
6827
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
7210
6828
  const toolWarnings = [];
7211
6829
  const isLatest = [
@@ -7324,7 +6942,7 @@ function prepareTools3({
7324
6942
  case "function":
7325
6943
  functionDeclarations.push({
7326
6944
  name: tool2.name,
7327
- description: (_a15 = tool2.description) != null ? _a15 : "",
6945
+ description: (_a = tool2.description) != null ? _a : "",
7328
6946
  parameters: convertJSONSchemaToOpenAPISchema(tool2.inputSchema)
7329
6947
  });
7330
6948
  break;
@@ -7407,17 +7025,17 @@ function mapGoogleGenerativeAIFinishReason({
7407
7025
  var GoogleGenerativeAILanguageModel = class {
7408
7026
  constructor(modelId, config) {
7409
7027
  this.specificationVersion = "v2";
7410
- var _a15;
7028
+ var _a;
7411
7029
  this.modelId = modelId;
7412
7030
  this.config = config;
7413
- this.generateId = (_a15 = config.generateId) != null ? _a15 : generateId;
7031
+ this.generateId = (_a = config.generateId) != null ? _a : generateId;
7414
7032
  }
7415
7033
  get provider() {
7416
7034
  return this.config.provider;
7417
7035
  }
7418
7036
  get supportedUrls() {
7419
- var _a15, _b, _c;
7420
- return (_c = (_b = (_a15 = this.config).supportedUrls) == null ? void 0 : _b.call(_a15)) != null ? _c : {};
7037
+ var _a, _b, _c;
7038
+ return (_c = (_b = (_a = this.config).supportedUrls) == null ? void 0 : _b.call(_a)) != null ? _c : {};
7421
7039
  }
7422
7040
  async getArgs({
7423
7041
  prompt,
@@ -7434,7 +7052,7 @@ var GoogleGenerativeAILanguageModel = class {
7434
7052
  toolChoice,
7435
7053
  providerOptions
7436
7054
  }) {
7437
- var _a15;
7055
+ var _a;
7438
7056
  const warnings = [];
7439
7057
  const googleOptions = await parseProviderOptions({
7440
7058
  provider: "google",
@@ -7480,7 +7098,7 @@ var GoogleGenerativeAILanguageModel = class {
7480
7098
  responseSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google GenAI does not support all OpenAPI Schema features,
7481
7099
  // so this is needed as an escape hatch:
7482
7100
  // TODO convert into provider option
7483
- ((_a15 = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _a15 : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
7101
+ ((_a = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _a : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
7484
7102
  ...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && {
7485
7103
  audioTimestamp: googleOptions.audioTimestamp
7486
7104
  },
@@ -7506,7 +7124,7 @@ var GoogleGenerativeAILanguageModel = class {
7506
7124
  };
7507
7125
  }
7508
7126
  async doGenerate(options) {
7509
- var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
7127
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
7510
7128
  const { args, warnings } = await this.getArgs(options);
7511
7129
  const body = JSON.stringify(args);
7512
7130
  const mergedHeaders = combineHeaders(
@@ -7530,7 +7148,7 @@ var GoogleGenerativeAILanguageModel = class {
7530
7148
  });
7531
7149
  const candidate = response.candidates[0];
7532
7150
  const content = [];
7533
- const parts = (_b = (_a15 = candidate.content) == null ? void 0 : _a15.parts) != null ? _b : [];
7151
+ const parts = (_b = (_a = candidate.content) == null ? void 0 : _a.parts) != null ? _b : [];
7534
7152
  const usageMetadata = response.usageMetadata;
7535
7153
  let lastCodeExecutionToolCallId;
7536
7154
  for (const part of parts) {
@@ -7656,7 +7274,7 @@ var GoogleGenerativeAILanguageModel = class {
7656
7274
  controller.enqueue({ type: "stream-start", warnings });
7657
7275
  },
7658
7276
  transform(chunk, controller) {
7659
- var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
7277
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
7660
7278
  if (options.includeRawChunks) {
7661
7279
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
7662
7280
  }
@@ -7667,7 +7285,7 @@ var GoogleGenerativeAILanguageModel = class {
7667
7285
  const value = chunk.value;
7668
7286
  const usageMetadata = value.usageMetadata;
7669
7287
  if (usageMetadata != null) {
7670
- usage.inputTokens = (_a15 = usageMetadata.promptTokenCount) != null ? _a15 : void 0;
7288
+ usage.inputTokens = (_a = usageMetadata.promptTokenCount) != null ? _a : void 0;
7671
7289
  usage.outputTokens = (_b = usageMetadata.candidatesTokenCount) != null ? _b : void 0;
7672
7290
  usage.totalTokens = (_c = usageMetadata.totalTokenCount) != null ? _c : void 0;
7673
7291
  usage.reasoningTokens = (_d = usageMetadata.thoughtsTokenCount) != null ? _d : void 0;
@@ -7892,7 +7510,7 @@ function extractSources({
7892
7510
  groundingMetadata,
7893
7511
  generateId: generateId3
7894
7512
  }) {
7895
- var _a15, _b, _c;
7513
+ var _a, _b, _c;
7896
7514
  if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
7897
7515
  return void 0;
7898
7516
  }
@@ -7904,7 +7522,7 @@ function extractSources({
7904
7522
  sourceType: "url",
7905
7523
  id: generateId3(),
7906
7524
  url: chunk.web.uri,
7907
- title: (_a15 = chunk.web.title) != null ? _a15 : void 0
7525
+ title: (_a = chunk.web.title) != null ? _a : void 0
7908
7526
  });
7909
7527
  } else if (chunk.retrievedContext != null) {
7910
7528
  const uri = chunk.retrievedContext.uri;
@@ -8192,14 +7810,14 @@ var GoogleGenerativeAIImageModel = class {
8192
7810
  this.specificationVersion = "v2";
8193
7811
  }
8194
7812
  get maxImagesPerCall() {
8195
- var _a15;
8196
- return (_a15 = this.settings.maxImagesPerCall) != null ? _a15 : 4;
7813
+ var _a;
7814
+ return (_a = this.settings.maxImagesPerCall) != null ? _a : 4;
8197
7815
  }
8198
7816
  get provider() {
8199
7817
  return this.config.provider;
8200
7818
  }
8201
7819
  async doGenerate(options) {
8202
- var _a15, _b, _c;
7820
+ var _a, _b, _c;
8203
7821
  const {
8204
7822
  prompt,
8205
7823
  n = 1,
@@ -8230,7 +7848,7 @@ var GoogleGenerativeAIImageModel = class {
8230
7848
  providerOptions,
8231
7849
  schema: googleImageProviderOptionsSchema
8232
7850
  });
8233
- const currentDate = (_c = (_b = (_a15 = this.config._internal) == null ? void 0 : _a15.currentDate) == null ? void 0 : _b.call(_a15)) != null ? _c : /* @__PURE__ */ new Date();
7851
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
8234
7852
  const parameters = {
8235
7853
  sampleCount: n
8236
7854
  };
@@ -8291,8 +7909,8 @@ var googleImageProviderOptionsSchema = lazySchema(
8291
7909
  )
8292
7910
  );
8293
7911
  function createGoogleGenerativeAI(options = {}) {
8294
- var _a15, _b;
8295
- const baseURL = (_a15 = withoutTrailingSlash(options.baseURL)) != null ? _a15 : "https://generativelanguage.googleapis.com/v1beta";
7912
+ var _a, _b;
7913
+ const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://generativelanguage.googleapis.com/v1beta";
8296
7914
  const providerName = (_b = options.name) != null ? _b : "google.generative-ai";
8297
7915
  const getHeaders = () => withUserAgentSuffix(
8298
7916
  {
@@ -8306,12 +7924,12 @@ function createGoogleGenerativeAI(options = {}) {
8306
7924
  `ai-sdk/google/${VERSION4}`
8307
7925
  );
8308
7926
  const createChatModel = (modelId) => {
8309
- var _a22;
7927
+ var _a2;
8310
7928
  return new GoogleGenerativeAILanguageModel(modelId, {
8311
7929
  provider: providerName,
8312
7930
  baseURL,
8313
7931
  headers: getHeaders,
8314
- generateId: (_a22 = options.generateId) != null ? _a22 : generateId,
7932
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId,
8315
7933
  supportedUrls: () => ({
8316
7934
  "*": [
8317
7935
  // Google Generative Language "files" endpoint
@@ -8416,7 +8034,7 @@ function convertToOpenAIChatMessages({
8416
8034
  messages.push({
8417
8035
  role: "user",
8418
8036
  content: content.map((part, index) => {
8419
- var _a15, _b, _c;
8037
+ var _a, _b, _c;
8420
8038
  switch (part.type) {
8421
8039
  case "text": {
8422
8040
  return { type: "text", text: part.text };
@@ -8429,7 +8047,7 @@ function convertToOpenAIChatMessages({
8429
8047
  image_url: {
8430
8048
  url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`,
8431
8049
  // OpenAI specific extension: image detail
8432
- detail: (_b = (_a15 = part.providerOptions) == null ? void 0 : _a15.openai) == null ? void 0 : _b.imageDetail
8050
+ detail: (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.imageDetail
8433
8051
  }
8434
8052
  };
8435
8053
  } else if (part.mediaType.startsWith("audio/")) {
@@ -8895,13 +8513,13 @@ var OpenAIChatLanguageModel = class {
8895
8513
  toolChoice,
8896
8514
  providerOptions
8897
8515
  }) {
8898
- var _a15, _b, _c, _d;
8516
+ var _a, _b, _c, _d;
8899
8517
  const warnings = [];
8900
- const openaiOptions = (_a15 = await parseProviderOptions({
8518
+ const openaiOptions = (_a = await parseProviderOptions({
8901
8519
  provider: "openai",
8902
8520
  providerOptions,
8903
8521
  schema: openaiChatLanguageModelOptions
8904
- })) != null ? _a15 : {};
8522
+ })) != null ? _a : {};
8905
8523
  const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
8906
8524
  if (topK != null) {
8907
8525
  warnings.push({
@@ -9071,7 +8689,7 @@ var OpenAIChatLanguageModel = class {
9071
8689
  };
9072
8690
  }
9073
8691
  async doGenerate(options) {
9074
- var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
8692
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
9075
8693
  const { args: body, warnings } = await this.getArgs(options);
9076
8694
  const {
9077
8695
  responseHeaders,
@@ -9097,7 +8715,7 @@ var OpenAIChatLanguageModel = class {
9097
8715
  if (text != null && text.length > 0) {
9098
8716
  content.push({ type: "text", text });
9099
8717
  }
9100
- for (const toolCall of (_a15 = choice.message.tool_calls) != null ? _a15 : []) {
8718
+ for (const toolCall of (_a = choice.message.tool_calls) != null ? _a : []) {
9101
8719
  content.push({
9102
8720
  type: "tool-call",
9103
8721
  toolCallId: (_b = toolCall.id) != null ? _b : generateId(),
@@ -9186,7 +8804,7 @@ var OpenAIChatLanguageModel = class {
9186
8804
  controller.enqueue({ type: "stream-start", warnings });
9187
8805
  },
9188
8806
  transform(chunk, controller) {
9189
- var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
8807
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
9190
8808
  if (options.includeRawChunks) {
9191
8809
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
9192
8810
  }
@@ -9212,7 +8830,7 @@ var OpenAIChatLanguageModel = class {
9212
8830
  }
9213
8831
  }
9214
8832
  if (value.usage != null) {
9215
- usage.inputTokens = (_a15 = value.usage.prompt_tokens) != null ? _a15 : void 0;
8833
+ usage.inputTokens = (_a = value.usage.prompt_tokens) != null ? _a : void 0;
9216
8834
  usage.outputTokens = (_b = value.usage.completion_tokens) != null ? _b : void 0;
9217
8835
  usage.totalTokens = (_c = value.usage.total_tokens) != null ? _c : void 0;
9218
8836
  usage.reasoningTokens = (_e = (_d = value.usage.completion_tokens_details) == null ? void 0 : _d.reasoning_tokens) != null ? _e : void 0;
@@ -9374,11 +8992,11 @@ function supportsPriorityProcessing(modelId) {
9374
8992
  return modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
9375
8993
  }
9376
8994
  function getSystemMessageMode(modelId) {
9377
- var _a15, _b;
8995
+ var _a, _b;
9378
8996
  if (!isReasoningModel(modelId)) {
9379
8997
  return "system";
9380
8998
  }
9381
- return (_b = (_a15 = reasoningModels[modelId]) == null ? void 0 : _a15.systemMessageMode) != null ? _b : "developer";
8999
+ return (_b = (_a = reasoningModels[modelId]) == null ? void 0 : _a.systemMessageMode) != null ? _b : "developer";
9382
9000
  }
9383
9001
  var reasoningModels = {
9384
9002
  o3: {
@@ -9683,7 +9301,7 @@ var OpenAICompletionLanguageModel = class {
9683
9301
  };
9684
9302
  }
9685
9303
  async doGenerate(options) {
9686
- var _a15, _b, _c;
9304
+ var _a, _b, _c;
9687
9305
  const { args, warnings } = await this.getArgs(options);
9688
9306
  const {
9689
9307
  responseHeaders,
@@ -9711,7 +9329,7 @@ var OpenAICompletionLanguageModel = class {
9711
9329
  return {
9712
9330
  content: [{ type: "text", text: choice.text }],
9713
9331
  usage: {
9714
- inputTokens: (_a15 = response.usage) == null ? void 0 : _a15.prompt_tokens,
9332
+ inputTokens: (_a = response.usage) == null ? void 0 : _a.prompt_tokens,
9715
9333
  outputTokens: (_b = response.usage) == null ? void 0 : _b.completion_tokens,
9716
9334
  totalTokens: (_c = response.usage) == null ? void 0 : _c.total_tokens
9717
9335
  },
@@ -9865,7 +9483,7 @@ var OpenAIEmbeddingModel = class {
9865
9483
  abortSignal,
9866
9484
  providerOptions
9867
9485
  }) {
9868
- var _a15;
9486
+ var _a;
9869
9487
  if (values.length > this.maxEmbeddingsPerCall) {
9870
9488
  throw new TooManyEmbeddingValuesForCallError({
9871
9489
  provider: this.provider,
@@ -9874,11 +9492,11 @@ var OpenAIEmbeddingModel = class {
9874
9492
  values
9875
9493
  });
9876
9494
  }
9877
- const openaiOptions = (_a15 = await parseProviderOptions({
9495
+ const openaiOptions = (_a = await parseProviderOptions({
9878
9496
  provider: "openai",
9879
9497
  providerOptions,
9880
9498
  schema: openaiEmbeddingProviderOptions
9881
- })) != null ? _a15 : {};
9499
+ })) != null ? _a : {};
9882
9500
  const {
9883
9501
  responseHeaders,
9884
9502
  value: response,
@@ -9939,8 +9557,8 @@ var OpenAIImageModel = class {
9939
9557
  this.specificationVersion = "v2";
9940
9558
  }
9941
9559
  get maxImagesPerCall() {
9942
- var _a15;
9943
- return (_a15 = modelMaxImagesPerCall[this.modelId]) != null ? _a15 : 1;
9560
+ var _a;
9561
+ return (_a = modelMaxImagesPerCall[this.modelId]) != null ? _a : 1;
9944
9562
  }
9945
9563
  get provider() {
9946
9564
  return this.config.provider;
@@ -9955,7 +9573,7 @@ var OpenAIImageModel = class {
9955
9573
  headers,
9956
9574
  abortSignal
9957
9575
  }) {
9958
- var _a15, _b, _c, _d;
9576
+ var _a, _b, _c, _d;
9959
9577
  const warnings = [];
9960
9578
  if (aspectRatio != null) {
9961
9579
  warnings.push({
@@ -9967,7 +9585,7 @@ var OpenAIImageModel = class {
9967
9585
  if (seed != null) {
9968
9586
  warnings.push({ type: "unsupported-setting", setting: "seed" });
9969
9587
  }
9970
- const currentDate = (_c = (_b = (_a15 = this.config._internal) == null ? void 0 : _a15.currentDate) == null ? void 0 : _b.call(_a15)) != null ? _c : /* @__PURE__ */ new Date();
9588
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
9971
9589
  const { value: response, responseHeaders } = await postJsonToApi({
9972
9590
  url: this.config.url({
9973
9591
  path: "/images/generations",
@@ -10327,7 +9945,7 @@ async function convertToOpenAIResponsesInput({
10327
9945
  store,
10328
9946
  hasLocalShellTool = false
10329
9947
  }) {
10330
- var _a15, _b, _c, _d;
9948
+ var _a, _b, _c, _d;
10331
9949
  const input = [];
10332
9950
  const warnings = [];
10333
9951
  for (const { role, content } of prompt) {
@@ -10362,7 +9980,7 @@ async function convertToOpenAIResponsesInput({
10362
9980
  input.push({
10363
9981
  role: "user",
10364
9982
  content: content.map((part, index) => {
10365
- var _a22, _b2, _c2;
9983
+ var _a2, _b2, _c2;
10366
9984
  switch (part.type) {
10367
9985
  case "text": {
10368
9986
  return { type: "input_text", text: part.text };
@@ -10375,7 +9993,7 @@ async function convertToOpenAIResponsesInput({
10375
9993
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
10376
9994
  image_url: `data:${mediaType};base64,${convertToBase64(part.data)}`
10377
9995
  },
10378
- detail: (_b2 = (_a22 = part.providerOptions) == null ? void 0 : _a22.openai) == null ? void 0 : _b2.imageDetail
9996
+ detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
10379
9997
  };
10380
9998
  } else if (part.mediaType === "application/pdf") {
10381
9999
  if (part.data instanceof URL) {
@@ -10407,7 +10025,7 @@ async function convertToOpenAIResponsesInput({
10407
10025
  for (const part of content) {
10408
10026
  switch (part.type) {
10409
10027
  case "text": {
10410
- const id = (_b = (_a15 = part.providerOptions) == null ? void 0 : _a15.openai) == null ? void 0 : _b.itemId;
10028
+ const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId;
10411
10029
  if (store && id != null) {
10412
10030
  input.push({ type: "item_reference", id });
10413
10031
  break;
@@ -11280,7 +10898,7 @@ var OpenAIResponsesLanguageModel = class {
11280
10898
  toolChoice,
11281
10899
  responseFormat
11282
10900
  }) {
11283
- var _a15, _b, _c, _d;
10901
+ var _a, _b, _c, _d;
11284
10902
  const warnings = [];
11285
10903
  const modelConfig = getResponsesModelConfig(this.modelId);
11286
10904
  if (topK != null) {
@@ -11320,7 +10938,7 @@ var OpenAIResponsesLanguageModel = class {
11320
10938
  prompt,
11321
10939
  systemMessageMode: modelConfig.systemMessageMode,
11322
10940
  fileIdPrefixes: this.config.fileIdPrefixes,
11323
- store: (_a15 = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a15 : true,
10941
+ store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
11324
10942
  hasLocalShellTool: hasOpenAITool("openai.local_shell")
11325
10943
  });
11326
10944
  warnings.push(...inputWarnings);
@@ -11475,7 +11093,7 @@ var OpenAIResponsesLanguageModel = class {
11475
11093
  };
11476
11094
  }
11477
11095
  async doGenerate(options) {
11478
- var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
11096
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
11479
11097
  const {
11480
11098
  args: body,
11481
11099
  warnings,
@@ -11527,7 +11145,7 @@ var OpenAIResponsesLanguageModel = class {
11527
11145
  providerMetadata: {
11528
11146
  openai: {
11529
11147
  itemId: part.id,
11530
- reasoningEncryptedContent: (_a15 = part.encrypted_content) != null ? _a15 : null
11148
+ reasoningEncryptedContent: (_a = part.encrypted_content) != null ? _a : null
11531
11149
  }
11532
11150
  }
11533
11151
  });
@@ -11796,7 +11414,7 @@ var OpenAIResponsesLanguageModel = class {
11796
11414
  controller.enqueue({ type: "stream-start", warnings });
11797
11415
  },
11798
11416
  transform(chunk, controller) {
11799
- var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
11417
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
11800
11418
  if (options.includeRawChunks) {
11801
11419
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
11802
11420
  }
@@ -11906,7 +11524,7 @@ var OpenAIResponsesLanguageModel = class {
11906
11524
  providerMetadata: {
11907
11525
  openai: {
11908
11526
  itemId: value.item.id,
11909
- reasoningEncryptedContent: (_a15 = value.item.encrypted_content) != null ? _a15 : null
11527
+ reasoningEncryptedContent: (_a = value.item.encrypted_content) != null ? _a : null
11910
11528
  }
11911
11529
  }
11912
11530
  });
@@ -12284,11 +11902,11 @@ function getResponsesModelConfig(modelId) {
12284
11902
  };
12285
11903
  }
12286
11904
  function mapWebSearchOutput(action) {
12287
- var _a15;
11905
+ var _a;
12288
11906
  switch (action.type) {
12289
11907
  case "search":
12290
11908
  return {
12291
- action: { type: "search", query: (_a15 = action.query) != null ? _a15 : void 0 },
11909
+ action: { type: "search", query: (_a = action.query) != null ? _a : void 0 },
12292
11910
  // include sources when provided by the Responses API (behind include flag)
12293
11911
  ...action.sources != null && { sources: action.sources }
12294
11912
  };
@@ -12373,8 +11991,8 @@ var OpenAISpeechModel = class {
12373
11991
  };
12374
11992
  }
12375
11993
  async doGenerate(options) {
12376
- var _a15, _b, _c;
12377
- const currentDate = (_c = (_b = (_a15 = this.config._internal) == null ? void 0 : _a15.currentDate) == null ? void 0 : _b.call(_a15)) != null ? _c : /* @__PURE__ */ new Date();
11994
+ var _a, _b, _c;
11995
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
12378
11996
  const { requestBody, warnings } = await this.getArgs(options);
12379
11997
  const {
12380
11998
  value: audio,
@@ -12585,8 +12203,8 @@ var OpenAITranscriptionModel = class {
12585
12203
  };
12586
12204
  }
12587
12205
  async doGenerate(options) {
12588
- var _a15, _b, _c, _d, _e, _f, _g, _h;
12589
- const currentDate = (_c = (_b = (_a15 = this.config._internal) == null ? void 0 : _a15.currentDate) == null ? void 0 : _b.call(_a15)) != null ? _c : /* @__PURE__ */ new Date();
12206
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12207
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
12590
12208
  const { formData, warnings } = await this.getArgs(options);
12591
12209
  const {
12592
12210
  value: response,
@@ -12632,13 +12250,13 @@ var OpenAITranscriptionModel = class {
12632
12250
  };
12633
12251
  var VERSION5 = "2.0.69" ;
12634
12252
  function createOpenAI(options = {}) {
12635
- var _a15, _b;
12636
- const baseURL = (_a15 = withoutTrailingSlash(
12253
+ var _a, _b;
12254
+ const baseURL = (_a = withoutTrailingSlash(
12637
12255
  loadOptionalSetting({
12638
12256
  settingValue: options.baseURL,
12639
12257
  environmentVariableName: "OPENAI_BASE_URL"
12640
12258
  })
12641
- )) != null ? _a15 : "https://api.openai.com/v1";
12259
+ )) != null ? _a : "https://api.openai.com/v1";
12642
12260
  const providerName = (_b = options.name) != null ? _b : "openai";
12643
12261
  const getHeaders = () => withUserAgentSuffix(
12644
12262
  {
@@ -12727,6 +12345,6 @@ function createOpenAI(options = {}) {
12727
12345
  }
12728
12346
  createOpenAI();
12729
12347
 
12730
- export { APICallError, EmptyResponseBodyError, EventSourceParserStream, InvalidArgumentError, InvalidResponseDataError, JSONParseError, LoadAPIKeyError, MastraModelGateway, NoSuchModelError, OpenAICompatibleImageModel, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, combineHeaders, convertToBase64, createAnthropic, createEventSourceResponseHandler, createGoogleGenerativeAI, createJsonErrorResponseHandler, createJsonResponseHandler, createOpenAI, createOpenAICompatible, generateId, injectJsonInstructionIntoMessages, loadApiKey, parseProviderOptions, postJsonToApi, withUserAgentSuffix, withoutTrailingSlash };
12731
- //# sourceMappingURL=chunk-PK2A5WBG.js.map
12732
- //# sourceMappingURL=chunk-PK2A5WBG.js.map
12348
+ export { MastraModelGateway, OpenAICompatibleImageModel, combineHeaders, convertBase64ToUint8Array, convertToBase64, createAnthropic, createBinaryResponseHandler, createEventSourceResponseHandler, createGoogleGenerativeAI, createJsonErrorResponseHandler, createJsonResponseHandler, createOpenAI, createOpenAICompatible, createProviderDefinedToolFactoryWithOutputSchema, generateId, injectJsonInstructionIntoMessages, isParsableJson, lazySchema, lazyValidator, loadApiKey, loadSetting, mediaTypeToExtension, parseProviderOptions, postFormDataToApi, postJsonToApi, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
12349
+ //# sourceMappingURL=chunk-ARAQIW6E.js.map
12350
+ //# sourceMappingURL=chunk-ARAQIW6E.js.map