@mastra/core 1.0.0-beta.0 → 1.0.0-beta.10

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 (562) hide show
  1. package/CHANGELOG.md +1136 -0
  2. package/dist/agent/agent-legacy.d.ts +19 -22
  3. package/dist/agent/agent-legacy.d.ts.map +1 -1
  4. package/dist/agent/agent-types.test-d.d.ts +2 -0
  5. package/dist/agent/agent-types.test-d.d.ts.map +1 -0
  6. package/dist/agent/agent.d.ts +6 -6
  7. package/dist/agent/agent.d.ts.map +1 -1
  8. package/dist/agent/agent.types.d.ts +6 -4
  9. package/dist/agent/agent.types.d.ts.map +1 -1
  10. package/dist/agent/index.cjs +9 -9
  11. package/dist/agent/index.js +2 -2
  12. package/dist/agent/message-list/index.cjs +3 -3
  13. package/dist/agent/message-list/index.d.ts +60 -3
  14. package/dist/agent/message-list/index.d.ts.map +1 -1
  15. package/dist/agent/message-list/index.js +1 -1
  16. package/dist/agent/message-list/prompt/attachments-to-parts.d.ts.map +1 -1
  17. package/dist/agent/message-list/prompt/convert-file.d.ts +1 -1
  18. package/dist/agent/message-list/prompt/convert-file.d.ts.map +1 -1
  19. package/dist/agent/message-list/prompt/download-assets.d.ts.map +1 -1
  20. package/dist/agent/save-queue/index.d.ts +3 -1
  21. package/dist/agent/save-queue/index.d.ts.map +1 -1
  22. package/dist/agent/test-utils.d.ts +37 -0
  23. package/dist/agent/test-utils.d.ts.map +1 -1
  24. package/dist/agent/trip-wire.d.ts.map +1 -1
  25. package/dist/agent/types.d.ts +21 -6
  26. package/dist/agent/types.d.ts.map +1 -1
  27. package/dist/agent/utils.d.ts +3 -3
  28. package/dist/agent/utils.d.ts.map +1 -1
  29. package/dist/agent/workflows/prepare-stream/index.d.ts +9 -7
  30. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  31. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +3 -3
  32. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  33. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +6 -5
  34. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
  35. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +2 -1
  36. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  37. package/dist/agent/workflows/prepare-stream/schema.d.ts +8 -8
  38. package/dist/agent/workflows/prepare-stream/schema.d.ts.map +1 -1
  39. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +11 -1
  40. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  41. package/dist/base.cjs +2 -2
  42. package/dist/base.js +1 -1
  43. package/dist/bundler/index.cjs +2 -2
  44. package/dist/bundler/index.js +1 -1
  45. package/dist/cache/index.cjs +3 -3
  46. package/dist/cache/index.js +1 -1
  47. package/dist/{chunk-4CDL2QJT.js → chunk-267YOF47.js} +121 -36
  48. package/dist/chunk-267YOF47.js.map +1 -0
  49. package/dist/{chunk-OJNJA5ZI.js → chunk-3CKZSDTQ.js} +3 -3
  50. package/dist/{chunk-OJNJA5ZI.js.map → chunk-3CKZSDTQ.js.map} +1 -1
  51. package/dist/{chunk-JV2KH24V.js → chunk-3GKKHF36.js} +693 -375
  52. package/dist/chunk-3GKKHF36.js.map +1 -0
  53. package/dist/{chunk-TQTAMPSC.js → chunk-3N3QE4ZK.js} +3 -3
  54. package/dist/chunk-3N3QE4ZK.js.map +1 -0
  55. package/dist/{chunk-QUKUN6NR.cjs → chunk-4JKEUSCC.cjs} +107 -7
  56. package/dist/chunk-4JKEUSCC.cjs.map +1 -0
  57. package/dist/{chunk-XEVG546F.js → chunk-4Q3Z6QRE.js} +178 -12
  58. package/dist/chunk-4Q3Z6QRE.js.map +1 -0
  59. package/dist/{chunk-CBAB7GOD.cjs → chunk-6BJ7XHRH.cjs} +2 -2
  60. package/dist/{chunk-CBAB7GOD.cjs.map → chunk-6BJ7XHRH.cjs.map} +1 -1
  61. package/dist/{chunk-26SQQNMU.js → chunk-6CYYFT4O.js} +11389 -8193
  62. package/dist/chunk-6CYYFT4O.js.map +1 -0
  63. package/dist/{chunk-32CTMD2C.js → chunk-6ONQWD6S.js} +1221 -347
  64. package/dist/chunk-6ONQWD6S.js.map +1 -0
  65. package/dist/{chunk-J7O6WENZ.cjs → chunk-6TBWJV35.js} +5 -5
  66. package/dist/chunk-6TBWJV35.js.map +1 -0
  67. package/dist/chunk-6XCINXZ7.cjs +194 -0
  68. package/dist/chunk-6XCINXZ7.cjs.map +1 -0
  69. package/dist/{chunk-E7K4FTLN.cjs → chunk-72YCRTEX.cjs} +18 -2
  70. package/dist/chunk-72YCRTEX.cjs.map +1 -0
  71. package/dist/{chunk-BXOL277H.cjs → chunk-7THRV5KZ.cjs} +762 -27
  72. package/dist/chunk-7THRV5KZ.cjs.map +1 -0
  73. package/dist/{chunk-76K3IYWM.js → chunk-ADADLFDR.js} +3 -3
  74. package/dist/{chunk-76K3IYWM.js.map → chunk-ADADLFDR.js.map} +1 -1
  75. package/dist/{chunk-DSNPWVIG.cjs → chunk-AF74UXR5.cjs} +4 -3
  76. package/dist/chunk-AF74UXR5.cjs.map +1 -0
  77. package/dist/{chunk-QCQLOMJM.cjs → chunk-BCRRHJGV.cjs} +206 -65
  78. package/dist/chunk-BCRRHJGV.cjs.map +1 -0
  79. package/dist/chunk-BWYU7D33.js +192 -0
  80. package/dist/chunk-BWYU7D33.js.map +1 -0
  81. package/dist/{chunk-MV7KHWUT.js → chunk-BXONP7HX.js} +391 -15
  82. package/dist/chunk-BXONP7HX.js.map +1 -0
  83. package/dist/chunk-CDRYT2A5.js +513 -0
  84. package/dist/chunk-CDRYT2A5.js.map +1 -0
  85. package/dist/{chunk-S5MJLXMG.cjs → chunk-CZEJQSWB.cjs} +481 -124
  86. package/dist/chunk-CZEJQSWB.cjs.map +1 -0
  87. package/dist/chunk-DD2VNRQM.js +62 -0
  88. package/dist/chunk-DD2VNRQM.js.map +1 -0
  89. package/dist/{chunk-KEXGB7FK.cjs → chunk-DGV2FWB4.cjs} +7 -7
  90. package/dist/{chunk-KEXGB7FK.cjs.map → chunk-DGV2FWB4.cjs.map} +1 -1
  91. package/dist/{chunk-Y63IFHEZ.cjs → chunk-EOPEDKLG.cjs} +4 -4
  92. package/dist/chunk-EOPEDKLG.cjs.map +1 -0
  93. package/dist/{chunk-UIZSWUKP.js → chunk-F2GAJSBI.js} +105 -7
  94. package/dist/chunk-F2GAJSBI.js.map +1 -0
  95. package/dist/{chunk-VOY2RXOC.cjs → chunk-G4IFCTL5.cjs} +182 -15
  96. package/dist/chunk-G4IFCTL5.cjs.map +1 -0
  97. package/dist/chunk-KJBMTK5B.cjs +64 -0
  98. package/dist/chunk-KJBMTK5B.cjs.map +1 -0
  99. package/dist/{chunk-S6URFGCZ.js → chunk-LSHPJWM5.js} +3 -3
  100. package/dist/{chunk-S6URFGCZ.js.map → chunk-LSHPJWM5.js.map} +1 -1
  101. package/dist/chunk-MGCGWPQJ.cjs +275 -0
  102. package/dist/chunk-MGCGWPQJ.cjs.map +1 -0
  103. package/dist/chunk-MRFUISXC.cjs +4981 -0
  104. package/dist/chunk-MRFUISXC.cjs.map +1 -0
  105. package/dist/chunk-MSZP3FNH.cjs +518 -0
  106. package/dist/chunk-MSZP3FNH.cjs.map +1 -0
  107. package/dist/{chunk-KJ2SW6VA.js → chunk-NRUZYMHE.js} +4 -3
  108. package/dist/chunk-NRUZYMHE.js.map +1 -0
  109. package/dist/{chunk-7SKXKUYT.js → chunk-NUA6TSRD.js} +752 -17
  110. package/dist/chunk-NUA6TSRD.js.map +1 -0
  111. package/dist/chunk-OEIVMCWX.js +4959 -0
  112. package/dist/chunk-OEIVMCWX.js.map +1 -0
  113. package/dist/{chunk-VJUZZB2I.js → chunk-OIDPIW42.js} +26 -11
  114. package/dist/chunk-OIDPIW42.js.map +1 -0
  115. package/dist/{chunk-QUZGDSWE.cjs → chunk-OYIDRI3A.cjs} +32 -17
  116. package/dist/chunk-OYIDRI3A.cjs.map +1 -0
  117. package/dist/{chunk-YIK3ASEG.cjs → chunk-P2D2VO2O.cjs} +1226 -350
  118. package/dist/chunk-P2D2VO2O.cjs.map +1 -0
  119. package/dist/{chunk-L7XKOKOW.js → chunk-PK2A5WBG.js} +472 -125
  120. package/dist/chunk-PK2A5WBG.js.map +1 -0
  121. package/dist/{chunk-X7JMA3IY.js → chunk-PSCMWPLC.js} +2 -2
  122. package/dist/{chunk-X7JMA3IY.js.map → chunk-PSCMWPLC.js.map} +1 -1
  123. package/dist/{chunk-WM6CK2F3.cjs → chunk-QD3UWFAV.cjs} +130 -48
  124. package/dist/chunk-QD3UWFAV.cjs.map +1 -0
  125. package/dist/{chunk-FD734TPS.cjs → chunk-SL7Q6IZF.cjs} +11425 -8211
  126. package/dist/chunk-SL7Q6IZF.cjs.map +1 -0
  127. package/dist/{chunk-ECFXGXWO.cjs → chunk-SSPUH2N7.cjs} +693 -375
  128. package/dist/chunk-SSPUH2N7.cjs.map +1 -0
  129. package/dist/{chunk-BMAFVZ2D.cjs → chunk-T2VLUFGG.cjs} +4 -4
  130. package/dist/{chunk-BMAFVZ2D.cjs.map → chunk-T2VLUFGG.cjs.map} +1 -1
  131. package/dist/chunk-THZTRBFS.js +268 -0
  132. package/dist/chunk-THZTRBFS.js.map +1 -0
  133. package/dist/{chunk-Y6ROD72V.cjs → chunk-UIGRFDO6.cjs} +4 -4
  134. package/dist/{chunk-Y6ROD72V.cjs.map → chunk-UIGRFDO6.cjs.map} +1 -1
  135. package/dist/{chunk-GRBGQ2GE.js → chunk-UVHSM2GU.cjs} +9 -3
  136. package/dist/chunk-UVHSM2GU.cjs.map +1 -0
  137. package/dist/{chunk-GGYKYORQ.cjs → chunk-WX2DLWXF.cjs} +407 -22
  138. package/dist/chunk-WX2DLWXF.cjs.map +1 -0
  139. package/dist/{chunk-P6APHXPZ.js → chunk-XRJQ5ZA7.js} +179 -38
  140. package/dist/chunk-XRJQ5ZA7.js.map +1 -0
  141. package/dist/{chunk-KIZIOFZC.js → chunk-Y36Y5MTD.js} +17 -3
  142. package/dist/chunk-Y36Y5MTD.js.map +1 -0
  143. package/dist/{chunk-VV753WCB.cjs → chunk-YWMMBIOM.cjs} +21 -20
  144. package/dist/chunk-YWMMBIOM.cjs.map +1 -0
  145. package/dist/{chunk-BU4IAJWF.js → chunk-Z57R5WS4.js} +16 -15
  146. package/dist/chunk-Z57R5WS4.js.map +1 -0
  147. package/dist/deployer/index.cjs +2 -2
  148. package/dist/deployer/index.js +1 -1
  149. package/dist/di/index.cjs +10 -2
  150. package/dist/di/index.d.ts +1 -1
  151. package/dist/di/index.d.ts.map +1 -1
  152. package/dist/di/index.js +1 -1
  153. package/dist/evals/base.d.ts +10 -2
  154. package/dist/evals/base.d.ts.map +1 -1
  155. package/dist/evals/base.test-utils.d.ts +25 -25
  156. package/dist/evals/index.cjs +9 -9
  157. package/dist/evals/index.js +2 -2
  158. package/dist/evals/scoreTraces/index.cjs +7 -6
  159. package/dist/evals/scoreTraces/index.cjs.map +1 -1
  160. package/dist/evals/scoreTraces/index.js +4 -3
  161. package/dist/evals/scoreTraces/index.js.map +1 -1
  162. package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
  163. package/dist/evals/types.d.ts +25 -24
  164. package/dist/evals/types.d.ts.map +1 -1
  165. package/dist/index.cjs +2 -2
  166. package/dist/index.js +1 -1
  167. package/dist/integration/index.cjs +2 -2
  168. package/dist/integration/index.js +1 -1
  169. package/dist/llm/index.cjs +30 -10
  170. package/dist/llm/index.d.ts +2 -0
  171. package/dist/llm/index.d.ts.map +1 -1
  172. package/dist/llm/index.js +5 -1
  173. package/dist/llm/model/aisdk/v5/model.d.ts +47 -0
  174. package/dist/llm/model/aisdk/v5/model.d.ts.map +1 -0
  175. package/dist/llm/model/gateway-resolver.d.ts.map +1 -1
  176. package/dist/llm/model/gateways/azure.d.ts +36 -0
  177. package/dist/llm/model/gateways/azure.d.ts.map +1 -0
  178. package/dist/llm/model/gateways/base.d.ts +9 -4
  179. package/dist/llm/model/gateways/base.d.ts.map +1 -1
  180. package/dist/llm/model/gateways/constants.d.ts.map +1 -1
  181. package/dist/llm/model/gateways/index.d.ts +4 -1
  182. package/dist/llm/model/gateways/index.d.ts.map +1 -1
  183. package/dist/llm/model/gateways/models-dev.d.ts +3 -2
  184. package/dist/llm/model/gateways/models-dev.d.ts.map +1 -1
  185. package/dist/llm/model/gateways/netlify.d.ts +4 -3
  186. package/dist/llm/model/gateways/netlify.d.ts.map +1 -1
  187. package/dist/llm/model/is-v2-model.d.ts +3 -0
  188. package/dist/llm/model/is-v2-model.d.ts.map +1 -0
  189. package/dist/llm/model/model-method-from-agent.d.ts +4 -0
  190. package/dist/llm/model/model-method-from-agent.d.ts.map +1 -0
  191. package/dist/llm/model/model.d.ts.map +1 -1
  192. package/dist/llm/model/model.loop.d.ts +2 -2
  193. package/dist/llm/model/model.loop.d.ts.map +1 -1
  194. package/dist/llm/model/model.loop.types.d.ts +2 -0
  195. package/dist/llm/model/model.loop.types.d.ts.map +1 -1
  196. package/dist/llm/model/provider-options.d.ts +4 -1
  197. package/dist/llm/model/provider-options.d.ts.map +1 -1
  198. package/dist/llm/model/provider-registry.d.ts +11 -1
  199. package/dist/llm/model/provider-registry.d.ts.map +1 -1
  200. package/dist/llm/model/provider-types.generated.d.ts +520 -33
  201. package/dist/llm/model/registry-generator.d.ts +12 -0
  202. package/dist/llm/model/registry-generator.d.ts.map +1 -1
  203. package/dist/llm/model/resolve-model.d.ts +1 -1
  204. package/dist/llm/model/resolve-model.d.ts.map +1 -1
  205. package/dist/llm/model/router.d.ts +12 -5
  206. package/dist/llm/model/router.d.ts.map +1 -1
  207. package/dist/llm/model/shared.types.d.ts +10 -4
  208. package/dist/llm/model/shared.types.d.ts.map +1 -1
  209. package/dist/logger/constants.d.ts +1 -0
  210. package/dist/logger/constants.d.ts.map +1 -1
  211. package/dist/logger/index.cjs +11 -11
  212. package/dist/logger/index.js +2 -2
  213. package/dist/logger/transport.d.ts +1 -1
  214. package/dist/logger/transport.d.ts.map +1 -1
  215. package/dist/loop/index.cjs +2 -2
  216. package/dist/loop/index.js +1 -1
  217. package/dist/loop/loop.d.ts.map +1 -1
  218. package/dist/loop/network/index.d.ts.map +1 -1
  219. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts +37 -0
  220. package/dist/loop/test-utils/MastraLanguageModelV2Mock.d.ts.map +1 -0
  221. package/dist/loop/test-utils/fullStream.d.ts.map +1 -1
  222. package/dist/loop/test-utils/generateText.d.ts.map +1 -1
  223. package/dist/loop/test-utils/options.d.ts.map +1 -1
  224. package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
  225. package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
  226. package/dist/loop/test-utils/textStream.d.ts.map +1 -1
  227. package/dist/loop/test-utils/toUIMessageStream.d.ts.map +1 -1
  228. package/dist/loop/test-utils/tools.d.ts.map +1 -1
  229. package/dist/loop/test-utils/utils.d.ts +1 -1
  230. package/dist/loop/test-utils/utils.d.ts.map +1 -1
  231. package/dist/loop/types.d.ts +22 -5
  232. package/dist/loop/types.d.ts.map +1 -1
  233. package/dist/loop/workflows/agentic-execution/index.d.ts +42 -42
  234. package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
  235. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +29 -29
  236. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  237. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +14 -14
  238. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  239. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
  240. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  241. package/dist/loop/workflows/agentic-loop/index.d.ts +44 -43
  242. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  243. package/dist/loop/workflows/run-state.d.ts +2 -2
  244. package/dist/loop/workflows/run-state.d.ts.map +1 -1
  245. package/dist/loop/workflows/schema.d.ts +14 -14
  246. package/dist/loop/workflows/stream.d.ts +1 -1
  247. package/dist/loop/workflows/stream.d.ts.map +1 -1
  248. package/dist/mastra/index.cjs +2 -2
  249. package/dist/mastra/index.d.ts +377 -12
  250. package/dist/mastra/index.d.ts.map +1 -1
  251. package/dist/mastra/index.js +1 -1
  252. package/dist/mcp/index.cjs +4 -4
  253. package/dist/mcp/index.cjs.map +1 -1
  254. package/dist/mcp/index.d.ts +4 -4
  255. package/dist/mcp/index.d.ts.map +1 -1
  256. package/dist/mcp/index.js +2 -2
  257. package/dist/mcp/index.js.map +1 -1
  258. package/dist/mcp/types.d.ts +2 -2
  259. package/dist/mcp/types.d.ts.map +1 -1
  260. package/dist/memory/index.cjs +21 -327
  261. package/dist/memory/index.cjs.map +1 -1
  262. package/dist/memory/index.js +1 -327
  263. package/dist/memory/index.js.map +1 -1
  264. package/dist/memory/memory.d.ts +28 -18
  265. package/dist/memory/memory.d.ts.map +1 -1
  266. package/dist/memory/mock.d.ts +15 -14
  267. package/dist/memory/mock.d.ts.map +1 -1
  268. package/dist/memory/types.d.ts +69 -11
  269. package/dist/memory/types.d.ts.map +1 -1
  270. package/dist/models-dev-23RN2WHG.js +3 -0
  271. package/dist/{models-dev-7U4NRMM3.js.map → models-dev-23RN2WHG.js.map} +1 -1
  272. package/dist/models-dev-EO3SUIY2.cjs +12 -0
  273. package/dist/{models-dev-VKSAQPRK.cjs.map → models-dev-EO3SUIY2.cjs.map} +1 -1
  274. package/dist/netlify-GXJ5D5DD.js +3 -0
  275. package/dist/{netlify-42ZNWIDQ.js.map → netlify-GXJ5D5DD.js.map} +1 -1
  276. package/dist/netlify-KJLY3GFS.cjs +12 -0
  277. package/dist/{netlify-2IDXTNFW.cjs.map → netlify-KJLY3GFS.cjs.map} +1 -1
  278. package/dist/observability/index.cjs +16 -8
  279. package/dist/observability/index.js +1 -1
  280. package/dist/observability/types/tracing.d.ts +236 -13
  281. package/dist/observability/types/tracing.d.ts.map +1 -1
  282. package/dist/observability/utils.d.ts +47 -1
  283. package/dist/observability/utils.d.ts.map +1 -1
  284. package/dist/processors/index.cjs +35 -11
  285. package/dist/processors/index.d.ts +101 -23
  286. package/dist/processors/index.d.ts.map +1 -1
  287. package/dist/processors/index.js +1 -1
  288. package/dist/processors/memory/index.d.ts +7 -0
  289. package/dist/processors/memory/index.d.ts.map +1 -0
  290. package/dist/processors/memory/message-history.d.ts +43 -0
  291. package/dist/processors/memory/message-history.d.ts.map +1 -0
  292. package/dist/processors/memory/semantic-recall.d.ts +152 -0
  293. package/dist/processors/memory/semantic-recall.d.ts.map +1 -0
  294. package/dist/processors/memory/working-memory.d.ts +65 -0
  295. package/dist/processors/memory/working-memory.d.ts.map +1 -0
  296. package/dist/processors/processors/batch-parts.d.ts +1 -1
  297. package/dist/processors/processors/batch-parts.d.ts.map +1 -1
  298. package/dist/processors/processors/index.d.ts +2 -1
  299. package/dist/processors/processors/index.d.ts.map +1 -1
  300. package/dist/processors/processors/language-detector.d.ts +15 -1
  301. package/dist/processors/processors/language-detector.d.ts.map +1 -1
  302. package/dist/processors/processors/moderation.d.ts +15 -1
  303. package/dist/processors/processors/moderation.d.ts.map +1 -1
  304. package/dist/processors/processors/pii-detector.d.ts +15 -1
  305. package/dist/processors/processors/pii-detector.d.ts.map +1 -1
  306. package/dist/processors/processors/prompt-injection-detector.d.ts +15 -1
  307. package/dist/processors/processors/prompt-injection-detector.d.ts.map +1 -1
  308. package/dist/processors/processors/structured-output.d.ts +3 -2
  309. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  310. package/dist/processors/processors/system-prompt-scrubber.d.ts +1 -1
  311. package/dist/processors/processors/system-prompt-scrubber.d.ts.map +1 -1
  312. package/dist/processors/processors/token-limiter.d.ts +22 -12
  313. package/dist/processors/processors/token-limiter.d.ts.map +1 -1
  314. package/dist/processors/processors/tool-call-filter.d.ts +28 -0
  315. package/dist/processors/processors/tool-call-filter.d.ts.map +1 -0
  316. package/dist/processors/processors/unicode-normalizer.d.ts +1 -1
  317. package/dist/processors/processors/unicode-normalizer.d.ts.map +1 -1
  318. package/dist/processors/runner.d.ts +35 -4
  319. package/dist/processors/runner.d.ts.map +1 -1
  320. package/dist/provider-registry-A7FILT6Q.cjs +40 -0
  321. package/dist/provider-registry-A7FILT6Q.cjs.map +1 -0
  322. package/dist/provider-registry-XM2YDI5X.js +3 -0
  323. package/dist/provider-registry-XM2YDI5X.js.map +1 -0
  324. package/dist/provider-registry.json +1135 -77
  325. package/dist/{registry-generator-MK63POJO.cjs → registry-generator-34SC4TAU.cjs} +23 -6
  326. package/dist/registry-generator-34SC4TAU.cjs.map +1 -0
  327. package/dist/{registry-generator-H4YNODDH.js → registry-generator-UMTNPBJX.js} +23 -7
  328. package/dist/registry-generator-UMTNPBJX.js.map +1 -0
  329. package/dist/relevance/index.cjs +2 -2
  330. package/dist/relevance/index.js +1 -1
  331. package/dist/request-context/index.cjs +10 -2
  332. package/dist/request-context/index.d.ts +26 -0
  333. package/dist/request-context/index.d.ts.map +1 -1
  334. package/dist/request-context/index.js +1 -1
  335. package/dist/server/auth.d.ts +11 -0
  336. package/dist/server/auth.d.ts.map +1 -1
  337. package/dist/server/base.d.ts +51 -0
  338. package/dist/server/base.d.ts.map +1 -0
  339. package/dist/server/composite-auth.d.ts +9 -0
  340. package/dist/server/composite-auth.d.ts.map +1 -0
  341. package/dist/server/index.cjs +124 -3
  342. package/dist/server/index.cjs.map +1 -1
  343. package/dist/server/index.d.ts +8 -0
  344. package/dist/server/index.d.ts.map +1 -1
  345. package/dist/server/index.js +121 -3
  346. package/dist/server/index.js.map +1 -1
  347. package/dist/server/simple-auth.d.ts +27 -0
  348. package/dist/server/simple-auth.d.ts.map +1 -0
  349. package/dist/storage/base.d.ts +76 -3
  350. package/dist/storage/base.d.ts.map +1 -1
  351. package/dist/storage/constants.d.ts +3 -1
  352. package/dist/storage/constants.d.ts.map +1 -1
  353. package/dist/storage/domains/agents/base.d.ts +49 -0
  354. package/dist/storage/domains/agents/base.d.ts.map +1 -0
  355. package/dist/storage/domains/agents/index.d.ts +3 -0
  356. package/dist/storage/domains/agents/index.d.ts.map +1 -0
  357. package/dist/storage/domains/agents/inmemory.d.ts +22 -0
  358. package/dist/storage/domains/agents/inmemory.d.ts.map +1 -0
  359. package/dist/storage/domains/index.d.ts +1 -0
  360. package/dist/storage/domains/index.d.ts.map +1 -1
  361. package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
  362. package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
  363. package/dist/storage/domains/scores/base.d.ts +2 -2
  364. package/dist/storage/domains/scores/base.d.ts.map +1 -1
  365. package/dist/storage/domains/scores/inmemory.d.ts +2 -2
  366. package/dist/storage/domains/scores/inmemory.d.ts.map +1 -1
  367. package/dist/storage/domains/workflows/base.d.ts +4 -0
  368. package/dist/storage/domains/workflows/base.d.ts.map +1 -1
  369. package/dist/storage/domains/workflows/inmemory.d.ts +5 -1
  370. package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
  371. package/dist/storage/index.cjs +65 -29
  372. package/dist/storage/index.js +1 -1
  373. package/dist/storage/mock.d.ts +7 -2
  374. package/dist/storage/mock.d.ts.map +1 -1
  375. package/dist/storage/storageWithInit.d.ts.map +1 -1
  376. package/dist/storage/types.d.ts +85 -2
  377. package/dist/storage/types.d.ts.map +1 -1
  378. package/dist/storage/utils.d.ts +82 -0
  379. package/dist/storage/utils.d.ts.map +1 -1
  380. package/dist/stream/MastraAgentNetworkStream.d.ts +1 -1
  381. package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
  382. package/dist/stream/MastraWorkflowStream.d.ts +1 -1
  383. package/dist/stream/MastraWorkflowStream.d.ts.map +1 -1
  384. package/dist/stream/RunOutput.d.ts +2 -2
  385. package/dist/stream/RunOutput.d.ts.map +1 -1
  386. package/dist/stream/aisdk/v4/usage.d.ts +19 -0
  387. package/dist/stream/aisdk/v4/usage.d.ts.map +1 -0
  388. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
  389. package/dist/stream/aisdk/v5/execute.d.ts +8 -4
  390. package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
  391. package/dist/stream/aisdk/v5/input.d.ts +4 -1
  392. package/dist/stream/aisdk/v5/input.d.ts.map +1 -1
  393. package/dist/stream/aisdk/v5/output.d.ts +9 -9
  394. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  395. package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
  396. package/dist/stream/base/base.d.ts +1 -1
  397. package/dist/stream/base/base.d.ts.map +1 -1
  398. package/dist/stream/base/input.d.ts +1 -1
  399. package/dist/stream/base/output-format-handlers.d.ts +14 -1
  400. package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
  401. package/dist/stream/base/output.d.ts +3 -3
  402. package/dist/stream/base/output.d.ts.map +1 -1
  403. package/dist/stream/index.cjs +15 -11
  404. package/dist/stream/index.d.ts +2 -2
  405. package/dist/stream/index.d.ts.map +1 -1
  406. package/dist/stream/index.js +2 -2
  407. package/dist/stream/types.d.ts +48 -25
  408. package/dist/stream/types.d.ts.map +1 -1
  409. package/dist/test-utils/llm-mock.cjs +101 -30
  410. package/dist/test-utils/llm-mock.cjs.map +1 -1
  411. package/dist/test-utils/llm-mock.d.ts +7 -2
  412. package/dist/test-utils/llm-mock.d.ts.map +1 -1
  413. package/dist/test-utils/llm-mock.js +97 -30
  414. package/dist/test-utils/llm-mock.js.map +1 -1
  415. package/dist/tools/index.cjs +6 -6
  416. package/dist/tools/index.js +2 -2
  417. package/dist/tools/is-vercel-tool.cjs +2 -2
  418. package/dist/tools/is-vercel-tool.js +1 -1
  419. package/dist/tools/stream.d.ts +10 -4
  420. package/dist/tools/stream.d.ts.map +1 -1
  421. package/dist/tools/tool-builder/builder.d.ts +2 -0
  422. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  423. package/dist/tools/tool-stream-types.test-d.d.ts +2 -0
  424. package/dist/tools/tool-stream-types.test-d.d.ts.map +1 -0
  425. package/dist/tools/tool.d.ts +21 -8
  426. package/dist/tools/tool.d.ts.map +1 -1
  427. package/dist/tools/types.d.ts +33 -6
  428. package/dist/tools/types.d.ts.map +1 -1
  429. package/dist/tools/validation.d.ts +25 -1
  430. package/dist/tools/validation.d.ts.map +1 -1
  431. package/dist/tts/index.cjs +2 -2
  432. package/dist/tts/index.js +1 -1
  433. package/dist/types/zod-compat.d.ts +14 -1
  434. package/dist/types/zod-compat.d.ts.map +1 -1
  435. package/dist/utils.cjs +25 -21
  436. package/dist/utils.d.ts +9 -4
  437. package/dist/utils.d.ts.map +1 -1
  438. package/dist/utils.js +1 -1
  439. package/dist/vector/filter/index.cjs +7 -189
  440. package/dist/vector/filter/index.cjs.map +1 -1
  441. package/dist/vector/filter/index.js +1 -190
  442. package/dist/vector/filter/index.js.map +1 -1
  443. package/dist/vector/index.cjs +7 -2
  444. package/dist/vector/index.cjs.map +1 -1
  445. package/dist/vector/index.d.ts +1 -0
  446. package/dist/vector/index.d.ts.map +1 -1
  447. package/dist/vector/index.js +2 -1
  448. package/dist/vector/index.js.map +1 -1
  449. package/dist/vector/types.d.ts +86 -3
  450. package/dist/vector/types.d.ts.map +1 -1
  451. package/dist/vector/vector.d.ts +39 -2
  452. package/dist/vector/vector.d.ts.map +1 -1
  453. package/dist/voice/aisdk/index.d.ts +3 -0
  454. package/dist/voice/aisdk/index.d.ts.map +1 -0
  455. package/dist/voice/aisdk/speech.d.ts +23 -0
  456. package/dist/voice/aisdk/speech.d.ts.map +1 -0
  457. package/dist/voice/aisdk/transcription.d.ts +22 -0
  458. package/dist/voice/aisdk/transcription.d.ts.map +1 -0
  459. package/dist/voice/composite-voice.d.ts +4 -3
  460. package/dist/voice/composite-voice.d.ts.map +1 -1
  461. package/dist/voice/index.cjs +12 -4
  462. package/dist/voice/index.d.ts +1 -0
  463. package/dist/voice/index.d.ts.map +1 -1
  464. package/dist/voice/index.js +1 -1
  465. package/dist/workflows/default.d.ts +179 -270
  466. package/dist/workflows/default.d.ts.map +1 -1
  467. package/dist/workflows/evented/execution-engine.d.ts +3 -1
  468. package/dist/workflows/evented/execution-engine.d.ts.map +1 -1
  469. package/dist/workflows/evented/index.cjs +10 -10
  470. package/dist/workflows/evented/index.js +1 -1
  471. package/dist/workflows/evented/step-executor.d.ts +1 -1
  472. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  473. package/dist/workflows/evented/workflow-event-processor/index.d.ts +5 -4
  474. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  475. package/dist/workflows/evented/workflow-event-processor/loop.d.ts +1 -1
  476. package/dist/workflows/evented/workflow-event-processor/loop.d.ts.map +1 -1
  477. package/dist/workflows/evented/workflow-event-processor/parallel.d.ts +2 -2
  478. package/dist/workflows/evented/workflow-event-processor/parallel.d.ts.map +1 -1
  479. package/dist/workflows/evented/workflow-event-processor/sleep.d.ts +2 -2
  480. package/dist/workflows/evented/workflow-event-processor/sleep.d.ts.map +1 -1
  481. package/dist/workflows/evented/workflow.d.ts +2 -1
  482. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  483. package/dist/workflows/execution-engine.d.ts +8 -6
  484. package/dist/workflows/execution-engine.d.ts.map +1 -1
  485. package/dist/workflows/handlers/control-flow.d.ts +133 -0
  486. package/dist/workflows/handlers/control-flow.d.ts.map +1 -0
  487. package/dist/workflows/handlers/entry.d.ts +43 -0
  488. package/dist/workflows/handlers/entry.d.ts.map +1 -0
  489. package/dist/workflows/handlers/sleep.d.ts +60 -0
  490. package/dist/workflows/handlers/sleep.d.ts.map +1 -0
  491. package/dist/workflows/handlers/step.d.ts +58 -0
  492. package/dist/workflows/handlers/step.d.ts.map +1 -0
  493. package/dist/workflows/index.cjs +36 -16
  494. package/dist/workflows/index.js +1 -1
  495. package/dist/workflows/step.d.ts +8 -6
  496. package/dist/workflows/step.d.ts.map +1 -1
  497. package/dist/workflows/types.d.ts +224 -10
  498. package/dist/workflows/types.d.ts.map +1 -1
  499. package/dist/workflows/utils.d.ts +36 -0
  500. package/dist/workflows/utils.d.ts.map +1 -1
  501. package/dist/workflows/workflow.d.ts +135 -54
  502. package/dist/workflows/workflow.d.ts.map +1 -1
  503. package/package.json +26 -29
  504. package/src/llm/model/provider-types.generated.d.ts +520 -33
  505. package/dist/chunk-26SQQNMU.js.map +0 -1
  506. package/dist/chunk-32CTMD2C.js.map +0 -1
  507. package/dist/chunk-436FFEF6.js +0 -34
  508. package/dist/chunk-436FFEF6.js.map +0 -1
  509. package/dist/chunk-4CDL2QJT.js.map +0 -1
  510. package/dist/chunk-7AHYOMHJ.js +0 -149
  511. package/dist/chunk-7AHYOMHJ.js.map +0 -1
  512. package/dist/chunk-7SKXKUYT.js.map +0 -1
  513. package/dist/chunk-BNBRQS7N.js +0 -910
  514. package/dist/chunk-BNBRQS7N.js.map +0 -1
  515. package/dist/chunk-BU4IAJWF.js.map +0 -1
  516. package/dist/chunk-BXOL277H.cjs.map +0 -1
  517. package/dist/chunk-DSNPWVIG.cjs.map +0 -1
  518. package/dist/chunk-E7K4FTLN.cjs.map +0 -1
  519. package/dist/chunk-ECFXGXWO.cjs.map +0 -1
  520. package/dist/chunk-ET6UOTTU.cjs +0 -154
  521. package/dist/chunk-ET6UOTTU.cjs.map +0 -1
  522. package/dist/chunk-FD734TPS.cjs.map +0 -1
  523. package/dist/chunk-GGYKYORQ.cjs.map +0 -1
  524. package/dist/chunk-GRBGQ2GE.js.map +0 -1
  525. package/dist/chunk-HGNRQ3OG.js +0 -58
  526. package/dist/chunk-HGNRQ3OG.js.map +0 -1
  527. package/dist/chunk-IU2SZXJQ.cjs +0 -913
  528. package/dist/chunk-IU2SZXJQ.cjs.map +0 -1
  529. package/dist/chunk-J7O6WENZ.cjs.map +0 -1
  530. package/dist/chunk-JV2KH24V.js.map +0 -1
  531. package/dist/chunk-KIZIOFZC.js.map +0 -1
  532. package/dist/chunk-KJ2SW6VA.js.map +0 -1
  533. package/dist/chunk-L7XKOKOW.js.map +0 -1
  534. package/dist/chunk-LJFJTTZQ.cjs +0 -4
  535. package/dist/chunk-LJFJTTZQ.cjs.map +0 -1
  536. package/dist/chunk-LRSB62Z6.cjs +0 -60
  537. package/dist/chunk-LRSB62Z6.cjs.map +0 -1
  538. package/dist/chunk-MV7KHWUT.js.map +0 -1
  539. package/dist/chunk-P6APHXPZ.js.map +0 -1
  540. package/dist/chunk-QCQLOMJM.cjs.map +0 -1
  541. package/dist/chunk-QUKUN6NR.cjs.map +0 -1
  542. package/dist/chunk-QUZGDSWE.cjs.map +0 -1
  543. package/dist/chunk-S5MJLXMG.cjs.map +0 -1
  544. package/dist/chunk-TQTAMPSC.js.map +0 -1
  545. package/dist/chunk-UIZSWUKP.js.map +0 -1
  546. package/dist/chunk-V3VLOOSW.cjs +0 -36
  547. package/dist/chunk-V3VLOOSW.cjs.map +0 -1
  548. package/dist/chunk-VJUZZB2I.js.map +0 -1
  549. package/dist/chunk-VOY2RXOC.cjs.map +0 -1
  550. package/dist/chunk-VV753WCB.cjs.map +0 -1
  551. package/dist/chunk-WM6CK2F3.cjs.map +0 -1
  552. package/dist/chunk-XEVG546F.js.map +0 -1
  553. package/dist/chunk-Y63IFHEZ.cjs.map +0 -1
  554. package/dist/chunk-YIK3ASEG.cjs.map +0 -1
  555. package/dist/chunk-ZV5CC35D.js +0 -3
  556. package/dist/chunk-ZV5CC35D.js.map +0 -1
  557. package/dist/models-dev-7U4NRMM3.js +0 -3
  558. package/dist/models-dev-VKSAQPRK.cjs +0 -12
  559. package/dist/netlify-2IDXTNFW.cjs +0 -12
  560. package/dist/netlify-42ZNWIDQ.js +0 -3
  561. package/dist/registry-generator-H4YNODDH.js.map +0 -1
  562. package/dist/registry-generator-MK63POJO.cjs.map +0 -1
@@ -520,24 +520,74 @@ function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
520
520
  }
521
521
  return "runtime/unknown";
522
522
  }
523
- function removeUndefinedEntries(record) {
524
- return Object.fromEntries(
525
- Object.entries(record).filter(([_key, value]) => value != null)
526
- );
523
+ function normalizeHeaders(headers) {
524
+ if (headers == null) {
525
+ return {};
526
+ }
527
+ const normalized = {};
528
+ if (headers instanceof Headers) {
529
+ headers.forEach((value, key) => {
530
+ normalized[key.toLowerCase()] = value;
531
+ });
532
+ } else {
533
+ if (!Array.isArray(headers)) {
534
+ headers = Object.entries(headers);
535
+ }
536
+ for (const [key, value] of headers) {
537
+ if (value != null) {
538
+ normalized[key.toLowerCase()] = value;
539
+ }
540
+ }
541
+ }
542
+ return normalized;
527
543
  }
528
544
  function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
529
- const cleanedHeaders = removeUndefinedEntries(
530
- headers != null ? headers : {}
531
- );
532
- const normalizedHeaders = new Headers(cleanedHeaders);
545
+ const normalizedHeaders = new Headers(normalizeHeaders(headers));
533
546
  const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
534
547
  normalizedHeaders.set(
535
548
  "user-agent",
536
549
  [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" ")
537
550
  );
538
- return Object.fromEntries(normalizedHeaders);
551
+ return Object.fromEntries(normalizedHeaders.entries());
552
+ }
553
+ var VERSION = "3.0.17" ;
554
+ var DEFAULT_SCHEMA_PREFIX = "JSON schema:";
555
+ var DEFAULT_SCHEMA_SUFFIX = "You MUST answer with a JSON object that matches the JSON schema above.";
556
+ var DEFAULT_GENERIC_SUFFIX = "You MUST answer with JSON.";
557
+ function injectJsonInstruction({
558
+ prompt,
559
+ schema,
560
+ schemaPrefix = schema != null ? DEFAULT_SCHEMA_PREFIX : void 0,
561
+ schemaSuffix = schema != null ? DEFAULT_SCHEMA_SUFFIX : DEFAULT_GENERIC_SUFFIX
562
+ }) {
563
+ return [
564
+ prompt != null && prompt.length > 0 ? prompt : void 0,
565
+ prompt != null && prompt.length > 0 ? "" : void 0,
566
+ // add a newline if prompt is not null
567
+ schemaPrefix,
568
+ schema != null ? JSON.stringify(schema) : void 0,
569
+ schemaSuffix
570
+ ].filter((line) => line != null).join("\n");
571
+ }
572
+ function injectJsonInstructionIntoMessages({
573
+ messages,
574
+ schema,
575
+ schemaPrefix,
576
+ schemaSuffix
577
+ }) {
578
+ var _a15, _b;
579
+ const systemMessage = ((_a15 = messages[0]) == null ? void 0 : _a15.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
580
+ systemMessage.content = injectJsonInstruction({
581
+ prompt: systemMessage.content,
582
+ schema,
583
+ schemaPrefix,
584
+ schemaSuffix
585
+ });
586
+ return [
587
+ systemMessage,
588
+ ...((_b = messages[0]) == null ? void 0 : _b.role) === "system" ? messages.slice(1) : messages
589
+ ];
539
590
  }
540
- var VERSION = "3.0.12" ;
541
591
  function loadApiKey({
542
592
  apiKey,
543
593
  environmentVariableName,
@@ -633,7 +683,11 @@ function filter(obj) {
633
683
  }
634
684
  function secureJsonParse(text) {
635
685
  const { stackTraceLimit } = Error;
636
- Error.stackTraceLimit = 0;
686
+ try {
687
+ Error.stackTraceLimit = 0;
688
+ } catch (e) {
689
+ return _parse(text);
690
+ }
637
691
  try {
638
692
  return _parse(text);
639
693
  } finally {
@@ -3558,7 +3612,7 @@ var OpenAICompatibleImageModel = class {
3558
3612
  var openaiCompatibleImageResponseSchema = z4.z.object({
3559
3613
  data: z4.z.array(z4.z.object({ b64_json: z4.z.string() }))
3560
3614
  });
3561
- var VERSION2 = "1.0.22" ;
3615
+ var VERSION2 = "1.0.27" ;
3562
3616
  function createOpenAICompatible(options) {
3563
3617
  const baseURL = withoutTrailingSlash(options.baseURL);
3564
3618
  const providerName = options.name;
@@ -3604,8 +3658,14 @@ function createOpenAICompatible(options) {
3604
3658
 
3605
3659
  // src/llm/model/gateways/base.ts
3606
3660
  var MastraModelGateway = class {
3661
+ /**
3662
+ * Get the gateway ID
3663
+ */
3664
+ getId() {
3665
+ return this.id;
3666
+ }
3607
3667
  };
3608
- var VERSION3 = "2.0.33" ;
3668
+ var VERSION3 = "2.0.45" ;
3609
3669
  var anthropicErrorDataSchema = lazySchema(
3610
3670
  () => zodSchema(
3611
3671
  z4.z.object({
@@ -3807,7 +3867,18 @@ var anthropicMessagesResponseSchema = lazySchema(
3807
3867
  output_tokens: z4.z.number(),
3808
3868
  cache_creation_input_tokens: z4.z.number().nullish(),
3809
3869
  cache_read_input_tokens: z4.z.number().nullish()
3810
- })
3870
+ }),
3871
+ container: z4.z.object({
3872
+ expires_at: z4.z.string(),
3873
+ id: z4.z.string(),
3874
+ skills: z4.z.array(
3875
+ z4.z.object({
3876
+ type: z4.z.union([z4.z.literal("anthropic"), z4.z.literal("custom")]),
3877
+ skill_id: z4.z.string(),
3878
+ version: z4.z.string()
3879
+ })
3880
+ ).nullish()
3881
+ }).nullish()
3811
3882
  })
3812
3883
  )
3813
3884
  );
@@ -4037,7 +4108,21 @@ var anthropicMessagesChunkSchema = lazySchema(
4037
4108
  type: z4.z.literal("message_delta"),
4038
4109
  delta: z4.z.object({
4039
4110
  stop_reason: z4.z.string().nullish(),
4040
- stop_sequence: z4.z.string().nullish()
4111
+ stop_sequence: z4.z.string().nullish(),
4112
+ container: z4.z.object({
4113
+ expires_at: z4.z.string(),
4114
+ id: z4.z.string(),
4115
+ skills: z4.z.array(
4116
+ z4.z.object({
4117
+ type: z4.z.union([
4118
+ z4.z.literal("anthropic"),
4119
+ z4.z.literal("custom")
4120
+ ]),
4121
+ skill_id: z4.z.string(),
4122
+ version: z4.z.string()
4123
+ })
4124
+ ).nullish()
4125
+ }).nullish()
4041
4126
  }),
4042
4127
  usage: z4.z.looseObject({
4043
4128
  output_tokens: z4.z.number(),
@@ -5280,6 +5365,21 @@ var AnthropicMessagesLanguageModel = class {
5280
5365
  setting: "seed"
5281
5366
  });
5282
5367
  }
5368
+ if (temperature != null && temperature > 1) {
5369
+ warnings.push({
5370
+ type: "unsupported-setting",
5371
+ setting: "temperature",
5372
+ details: `${temperature} exceeds anthropic maximum of 1.0. clamped to 1.0`
5373
+ });
5374
+ temperature = 1;
5375
+ } else if (temperature != null && temperature < 0) {
5376
+ warnings.push({
5377
+ type: "unsupported-setting",
5378
+ setting: "temperature",
5379
+ details: `${temperature} is below anthropic minimum of 0. clamped to 0`
5380
+ });
5381
+ temperature = 0;
5382
+ }
5283
5383
  if ((responseFormat == null ? void 0 : responseFormat.type) === "json") {
5284
5384
  if (responseFormat.schema == null) {
5285
5385
  warnings.push({
@@ -5315,7 +5415,7 @@ var AnthropicMessagesLanguageModel = class {
5315
5415
  });
5316
5416
  const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === "enabled";
5317
5417
  const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;
5318
- const maxOutputTokensForModel = getMaxOutputTokensForModel(this.modelId);
5418
+ const { maxOutputTokens: maxOutputTokensForModel, knownModel } = getMaxOutputTokensForModel(this.modelId);
5319
5419
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
5320
5420
  const baseArgs = {
5321
5421
  // model id:
@@ -5377,7 +5477,7 @@ var AnthropicMessagesLanguageModel = class {
5377
5477
  }
5378
5478
  baseArgs.max_tokens = maxTokens + thinkingBudget;
5379
5479
  }
5380
- if (baseArgs.max_tokens > maxOutputTokensForModel) {
5480
+ if (knownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
5381
5481
  if (maxOutputTokens != null) {
5382
5482
  warnings.push({
5383
5483
  type: "unsupported-setting",
@@ -5472,7 +5572,7 @@ var AnthropicMessagesLanguageModel = class {
5472
5572
  });
5473
5573
  }
5474
5574
  async doGenerate(options) {
5475
- var _a15, _b, _c, _d, _e, _f;
5575
+ var _a15, _b, _c, _d, _e, _f, _g, _h;
5476
5576
  const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
5477
5577
  const citationDocuments = this.extractCitationDocuments(options.prompt);
5478
5578
  const {
@@ -5723,7 +5823,16 @@ var AnthropicMessagesLanguageModel = class {
5723
5823
  anthropic: {
5724
5824
  usage: response.usage,
5725
5825
  cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null,
5726
- stopSequence: (_f = response.stop_sequence) != null ? _f : null
5826
+ stopSequence: (_f = response.stop_sequence) != null ? _f : null,
5827
+ container: response.container ? {
5828
+ expiresAt: response.container.expires_at,
5829
+ id: response.container.id,
5830
+ skills: (_h = (_g = response.container.skills) == null ? void 0 : _g.map((skill) => ({
5831
+ type: skill.type,
5832
+ skillId: skill.skill_id,
5833
+ version: skill.version
5834
+ }))) != null ? _h : null
5835
+ } : null
5727
5836
  }
5728
5837
  }
5729
5838
  };
@@ -5753,6 +5862,7 @@ var AnthropicMessagesLanguageModel = class {
5753
5862
  let rawUsage = void 0;
5754
5863
  let cacheCreationInputTokens = null;
5755
5864
  let stopSequence = null;
5865
+ let container = null;
5756
5866
  let blockType = void 0;
5757
5867
  const generateId3 = this.generateId;
5758
5868
  return {
@@ -5762,7 +5872,7 @@ var AnthropicMessagesLanguageModel = class {
5762
5872
  controller.enqueue({ type: "stream-start", warnings });
5763
5873
  },
5764
5874
  transform(chunk, controller) {
5765
- var _a15, _b, _c, _d, _e, _f, _g, _h;
5875
+ var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5766
5876
  if (options.includeRawChunks) {
5767
5877
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
5768
5878
  }
@@ -5875,7 +5985,8 @@ var AnthropicMessagesLanguageModel = class {
5875
5985
  data: part.content.content.source.data
5876
5986
  }
5877
5987
  }
5878
- }
5988
+ },
5989
+ providerExecuted: true
5879
5990
  });
5880
5991
  } else if (part.content.type === "web_fetch_tool_result_error") {
5881
5992
  controller.enqueue({
@@ -6143,6 +6254,15 @@ var AnthropicMessagesLanguageModel = class {
6143
6254
  isJsonResponseFromTool: usesJsonResponseTool
6144
6255
  });
6145
6256
  stopSequence = (_h = value.delta.stop_sequence) != null ? _h : null;
6257
+ container = value.delta.container != null ? {
6258
+ expiresAt: value.delta.container.expires_at,
6259
+ id: value.delta.container.id,
6260
+ skills: (_j = (_i = value.delta.container.skills) == null ? void 0 : _i.map((skill) => ({
6261
+ type: skill.type,
6262
+ skillId: skill.skill_id,
6263
+ version: skill.version
6264
+ }))) != null ? _j : null
6265
+ } : null;
6146
6266
  rawUsage = {
6147
6267
  ...rawUsage,
6148
6268
  ...value.usage
@@ -6158,7 +6278,8 @@ var AnthropicMessagesLanguageModel = class {
6158
6278
  anthropic: {
6159
6279
  usage: rawUsage != null ? rawUsage : null,
6160
6280
  cacheCreationInputTokens,
6161
- stopSequence
6281
+ stopSequence,
6282
+ container
6162
6283
  }
6163
6284
  }
6164
6285
  });
@@ -6183,13 +6304,15 @@ var AnthropicMessagesLanguageModel = class {
6183
6304
  };
6184
6305
  function getMaxOutputTokensForModel(modelId) {
6185
6306
  if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
6186
- return 64e3;
6307
+ return { maxOutputTokens: 64e3, knownModel: true };
6187
6308
  } else if (modelId.includes("claude-opus-4-")) {
6188
- return 32e3;
6309
+ return { maxOutputTokens: 32e3, knownModel: true };
6189
6310
  } else if (modelId.includes("claude-3-5-haiku")) {
6190
- return 8192;
6311
+ return { maxOutputTokens: 8192, knownModel: true };
6312
+ } else if (modelId.includes("claude-3-haiku")) {
6313
+ return { maxOutputTokens: 4096, knownModel: true };
6191
6314
  } else {
6192
- return 4096;
6315
+ return { maxOutputTokens: 4096, knownModel: false };
6193
6316
  }
6194
6317
  }
6195
6318
  var bash_20241022InputSchema = lazySchema(
@@ -6525,8 +6648,14 @@ var anthropicTools = {
6525
6648
  webSearch_20250305
6526
6649
  };
6527
6650
  function createAnthropic(options = {}) {
6528
- var _a15;
6529
- const baseURL = (_a15 = withoutTrailingSlash(options.baseURL)) != null ? _a15 : "https://api.anthropic.com/v1";
6651
+ var _a15, _b;
6652
+ const baseURL = (_a15 = withoutTrailingSlash(
6653
+ loadOptionalSetting({
6654
+ settingValue: options.baseURL,
6655
+ environmentVariableName: "ANTHROPIC_BASE_URL"
6656
+ })
6657
+ )) != null ? _a15 : "https://api.anthropic.com/v1";
6658
+ const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
6530
6659
  const getHeaders = () => withUserAgentSuffix(
6531
6660
  {
6532
6661
  "anthropic-version": "2023-06-01",
@@ -6542,7 +6671,7 @@ function createAnthropic(options = {}) {
6542
6671
  const createChatModel = (modelId) => {
6543
6672
  var _a22;
6544
6673
  return new AnthropicMessagesLanguageModel(modelId, {
6545
- provider: "anthropic.messages",
6674
+ provider: providerName,
6546
6675
  baseURL,
6547
6676
  headers: getHeaders,
6548
6677
  fetch: options.fetch,
@@ -6573,7 +6702,7 @@ function createAnthropic(options = {}) {
6573
6702
  return provider;
6574
6703
  }
6575
6704
  createAnthropic();
6576
- var VERSION4 = "2.0.23" ;
6705
+ var VERSION4 = "2.0.40" ;
6577
6706
  var googleErrorDataSchema = lazySchema(
6578
6707
  () => zodSchema(
6579
6708
  z4.z.object({
@@ -6873,19 +7002,20 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
6873
7002
  contents.push({
6874
7003
  role: "model",
6875
7004
  parts: content.map((part) => {
6876
- var _a22, _b, _c, _d, _e, _f;
7005
+ var _a22, _b, _c;
7006
+ 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;
6877
7007
  switch (part.type) {
6878
7008
  case "text": {
6879
7009
  return part.text.length === 0 ? void 0 : {
6880
7010
  text: part.text,
6881
- thoughtSignature: (_b = (_a22 = part.providerOptions) == null ? void 0 : _a22.google) == null ? void 0 : _b.thoughtSignature
7011
+ thoughtSignature
6882
7012
  };
6883
7013
  }
6884
7014
  case "reasoning": {
6885
7015
  return part.text.length === 0 ? void 0 : {
6886
7016
  text: part.text,
6887
7017
  thought: true,
6888
- thoughtSignature: (_d = (_c = part.providerOptions) == null ? void 0 : _c.google) == null ? void 0 : _d.thoughtSignature
7018
+ thoughtSignature
6889
7019
  };
6890
7020
  }
6891
7021
  case "file": {
@@ -6912,7 +7042,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
6912
7042
  name: part.toolName,
6913
7043
  args: part.input
6914
7044
  },
6915
- thoughtSignature: (_f = (_e = part.providerOptions) == null ? void 0 : _e.google) == null ? void 0 : _f.thoughtSignature
7045
+ thoughtSignature
6916
7046
  };
6917
7047
  }
6918
7048
  }
@@ -6995,7 +7125,9 @@ var googleGenerativeAIProviderOptions = lazySchema(
6995
7125
  responseModalities: z4.z.array(z4.z.enum(["TEXT", "IMAGE"])).optional(),
6996
7126
  thinkingConfig: z4.z.object({
6997
7127
  thinkingBudget: z4.z.number().optional(),
6998
- includeThoughts: z4.z.boolean().optional()
7128
+ includeThoughts: z4.z.boolean().optional(),
7129
+ // https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
7130
+ thinkingLevel: z4.z.enum(["low", "medium", "high"]).optional()
6999
7131
  }).optional(),
7000
7132
  /**
7001
7133
  * Optional.
@@ -7083,7 +7215,8 @@ var googleGenerativeAIProviderOptions = lazySchema(
7083
7215
  "9:16",
7084
7216
  "16:9",
7085
7217
  "21:9"
7086
- ]).optional()
7218
+ ]).optional(),
7219
+ imageSize: z4.z.enum(["1K", "2K", "4K"]).optional()
7087
7220
  }).optional()
7088
7221
  })
7089
7222
  )
@@ -7096,8 +7229,14 @@ function prepareTools3({
7096
7229
  var _a15;
7097
7230
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
7098
7231
  const toolWarnings = [];
7099
- const isGemini2 = modelId.includes("gemini-2");
7232
+ const isLatest = [
7233
+ "gemini-flash-latest",
7234
+ "gemini-flash-lite-latest",
7235
+ "gemini-pro-latest"
7236
+ ].some((id) => id === modelId);
7237
+ const isGemini2orNewer = modelId.includes("gemini-2") || modelId.includes("gemini-3") || isLatest;
7100
7238
  const supportsDynamicRetrieval = modelId.includes("gemini-1.5-flash") && !modelId.includes("-8b");
7239
+ const supportsFileSearch = modelId.includes("gemini-2.5");
7101
7240
  if (tools == null) {
7102
7241
  return { tools: void 0, toolConfig: void 0, toolWarnings };
7103
7242
  }
@@ -7106,10 +7245,11 @@ function prepareTools3({
7106
7245
  (tool2) => tool2.type === "provider-defined"
7107
7246
  );
7108
7247
  if (hasFunctionTools && hasProviderDefinedTools) {
7248
+ const functionTools = tools.filter((tool2) => tool2.type === "function");
7109
7249
  toolWarnings.push({
7110
7250
  type: "unsupported-tool",
7111
7251
  tool: tools.find((tool2) => tool2.type === "function"),
7112
- details: "Cannot mix function tools with provider-defined tools in the same request. Please use either function tools or provider-defined tools, but not both."
7252
+ details: `Cannot mix function tools with provider-defined tools in the same request. Falling back to provider-defined tools only. The following function tools will be ignored: ${functionTools.map((t) => t.name).join(", ")}. Please use either function tools or provider-defined tools, but not both.`
7113
7253
  });
7114
7254
  }
7115
7255
  if (hasProviderDefinedTools) {
@@ -7120,7 +7260,7 @@ function prepareTools3({
7120
7260
  providerDefinedTools.forEach((tool2) => {
7121
7261
  switch (tool2.id) {
7122
7262
  case "google.google_search":
7123
- if (isGemini2) {
7263
+ if (isGemini2orNewer) {
7124
7264
  googleTools2.push({ googleSearch: {} });
7125
7265
  } else if (supportsDynamicRetrieval) {
7126
7266
  googleTools2.push({
@@ -7136,7 +7276,7 @@ function prepareTools3({
7136
7276
  }
7137
7277
  break;
7138
7278
  case "google.url_context":
7139
- if (isGemini2) {
7279
+ if (isGemini2orNewer) {
7140
7280
  googleTools2.push({ urlContext: {} });
7141
7281
  } else {
7142
7282
  toolWarnings.push({
@@ -7147,7 +7287,7 @@ function prepareTools3({
7147
7287
  }
7148
7288
  break;
7149
7289
  case "google.code_execution":
7150
- if (isGemini2) {
7290
+ if (isGemini2orNewer) {
7151
7291
  googleTools2.push({ codeExecution: {} });
7152
7292
  } else {
7153
7293
  toolWarnings.push({
@@ -7157,6 +7297,37 @@ function prepareTools3({
7157
7297
  });
7158
7298
  }
7159
7299
  break;
7300
+ case "google.file_search":
7301
+ if (supportsFileSearch) {
7302
+ googleTools2.push({ fileSearch: { ...tool2.args } });
7303
+ } else {
7304
+ toolWarnings.push({
7305
+ type: "unsupported-tool",
7306
+ tool: tool2,
7307
+ details: "The file search tool is only supported with Gemini 2.5 models."
7308
+ });
7309
+ }
7310
+ break;
7311
+ case "google.vertex_rag_store":
7312
+ if (isGemini2orNewer) {
7313
+ googleTools2.push({
7314
+ retrieval: {
7315
+ vertex_rag_store: {
7316
+ rag_resources: {
7317
+ rag_corpus: tool2.args.ragCorpus
7318
+ },
7319
+ similarity_top_k: tool2.args.topK
7320
+ }
7321
+ }
7322
+ });
7323
+ } else {
7324
+ toolWarnings.push({
7325
+ type: "unsupported-tool",
7326
+ tool: tool2,
7327
+ details: "The RAG store tool is not supported with other Gemini models than Gemini 2."
7328
+ });
7329
+ }
7330
+ break;
7160
7331
  default:
7161
7332
  toolWarnings.push({ type: "unsupported-tool", tool: tool2 });
7162
7333
  break;
@@ -7284,17 +7455,19 @@ var GoogleGenerativeAILanguageModel = class {
7284
7455
  toolChoice,
7285
7456
  providerOptions
7286
7457
  }) {
7287
- var _a15, _b;
7458
+ var _a15;
7288
7459
  const warnings = [];
7289
7460
  const googleOptions = await parseProviderOptions({
7290
7461
  provider: "google",
7291
7462
  providerOptions,
7292
7463
  schema: googleGenerativeAIProviderOptions
7293
7464
  });
7294
- if (((_a15 = googleOptions == null ? void 0 : googleOptions.thinkingConfig) == null ? void 0 : _a15.includeThoughts) === true && !this.config.provider.startsWith("google.vertex.")) {
7465
+ if ((tools == null ? void 0 : tools.some(
7466
+ (tool2) => tool2.type === "provider-defined" && tool2.id === "google.vertex_rag_store"
7467
+ )) && !this.config.provider.startsWith("google.vertex.")) {
7295
7468
  warnings.push({
7296
7469
  type: "other",
7297
- message: `The 'includeThoughts' option is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).`
7470
+ message: `The 'vertex_rag_store' tool is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).`
7298
7471
  });
7299
7472
  }
7300
7473
  const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
@@ -7328,7 +7501,7 @@ var GoogleGenerativeAILanguageModel = class {
7328
7501
  responseSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google GenAI does not support all OpenAPI Schema features,
7329
7502
  // so this is needed as an escape hatch:
7330
7503
  // TODO convert into provider option
7331
- ((_b = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _b : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
7504
+ ((_a15 = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _a15 : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
7332
7505
  ...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && {
7333
7506
  audioTimestamp: googleOptions.audioTimestamp
7334
7507
  },
@@ -7740,16 +7913,64 @@ function extractSources({
7740
7913
  groundingMetadata,
7741
7914
  generateId: generateId3
7742
7915
  }) {
7743
- var _a15;
7744
- return (_a15 = groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks) == null ? void 0 : _a15.filter(
7745
- (chunk) => chunk.web != null
7746
- ).map((chunk) => ({
7747
- type: "source",
7748
- sourceType: "url",
7749
- id: generateId3(),
7750
- url: chunk.web.uri,
7751
- title: chunk.web.title
7752
- }));
7916
+ var _a15, _b, _c;
7917
+ if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
7918
+ return void 0;
7919
+ }
7920
+ const sources = [];
7921
+ for (const chunk of groundingMetadata.groundingChunks) {
7922
+ if (chunk.web != null) {
7923
+ sources.push({
7924
+ type: "source",
7925
+ sourceType: "url",
7926
+ id: generateId3(),
7927
+ url: chunk.web.uri,
7928
+ title: (_a15 = chunk.web.title) != null ? _a15 : void 0
7929
+ });
7930
+ } else if (chunk.retrievedContext != null) {
7931
+ const uri = chunk.retrievedContext.uri;
7932
+ if (uri.startsWith("http://") || uri.startsWith("https://")) {
7933
+ sources.push({
7934
+ type: "source",
7935
+ sourceType: "url",
7936
+ id: generateId3(),
7937
+ url: uri,
7938
+ title: (_b = chunk.retrievedContext.title) != null ? _b : void 0
7939
+ });
7940
+ } else {
7941
+ const title = (_c = chunk.retrievedContext.title) != null ? _c : "Unknown Document";
7942
+ let mediaType = "application/octet-stream";
7943
+ let filename = void 0;
7944
+ if (uri.endsWith(".pdf")) {
7945
+ mediaType = "application/pdf";
7946
+ filename = uri.split("/").pop();
7947
+ } else if (uri.endsWith(".txt")) {
7948
+ mediaType = "text/plain";
7949
+ filename = uri.split("/").pop();
7950
+ } else if (uri.endsWith(".docx")) {
7951
+ mediaType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
7952
+ filename = uri.split("/").pop();
7953
+ } else if (uri.endsWith(".doc")) {
7954
+ mediaType = "application/msword";
7955
+ filename = uri.split("/").pop();
7956
+ } else if (uri.match(/\.(md|markdown)$/)) {
7957
+ mediaType = "text/markdown";
7958
+ filename = uri.split("/").pop();
7959
+ } else {
7960
+ filename = uri.split("/").pop();
7961
+ }
7962
+ sources.push({
7963
+ type: "source",
7964
+ sourceType: "document",
7965
+ id: generateId3(),
7966
+ mediaType,
7967
+ title,
7968
+ filename
7969
+ });
7970
+ }
7971
+ }
7972
+ }
7973
+ return sources.length > 0 ? sources : void 0;
7753
7974
  }
7754
7975
  var getGroundingMetadataSchema = () => z4.z.object({
7755
7976
  webSearchQueries: z4.z.array(z4.z.string()).nullish(),
@@ -7757,8 +7978,12 @@ var getGroundingMetadataSchema = () => z4.z.object({
7757
7978
  searchEntryPoint: z4.z.object({ renderedContent: z4.z.string() }).nullish(),
7758
7979
  groundingChunks: z4.z.array(
7759
7980
  z4.z.object({
7760
- web: z4.z.object({ uri: z4.z.string(), title: z4.z.string() }).nullish(),
7761
- retrievedContext: z4.z.object({ uri: z4.z.string(), title: z4.z.string() }).nullish()
7981
+ web: z4.z.object({ uri: z4.z.string(), title: z4.z.string().nullish() }).nullish(),
7982
+ retrievedContext: z4.z.object({
7983
+ uri: z4.z.string(),
7984
+ title: z4.z.string().nullish(),
7985
+ text: z4.z.string().nullish()
7986
+ }).nullish()
7762
7987
  })
7763
7988
  ).nullish(),
7764
7989
  groundingSupports: z4.z.array(
@@ -7828,7 +8053,9 @@ var usageSchema2 = z4.z.object({
7828
8053
  thoughtsTokenCount: z4.z.number().nullish(),
7829
8054
  promptTokenCount: z4.z.number().nullish(),
7830
8055
  candidatesTokenCount: z4.z.number().nullish(),
7831
- totalTokenCount: z4.z.number().nullish()
8056
+ totalTokenCount: z4.z.number().nullish(),
8057
+ // https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
8058
+ trafficType: z4.z.string().nullish()
7832
8059
  });
7833
8060
  var getUrlContextMetadataSchema = () => z4.z.object({
7834
8061
  urlMetadata: z4.z.array(
@@ -7890,6 +8117,30 @@ var codeExecution = createProviderDefinedToolFactoryWithOutputSchema({
7890
8117
  output: z4.z.string().describe("The output from the code execution.")
7891
8118
  })
7892
8119
  });
8120
+ var fileSearchArgsBaseSchema = z4.z.object({
8121
+ /** The names of the file_search_stores to retrieve from.
8122
+ * Example: `fileSearchStores/my-file-search-store-123`
8123
+ */
8124
+ fileSearchStoreNames: z4.z.array(z4.z.string()).describe(
8125
+ "The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
8126
+ ),
8127
+ /** The number of file search retrieval chunks to retrieve. */
8128
+ topK: z4.z.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
8129
+ /** Metadata filter to apply to the file search retrieval documents.
8130
+ * See https://google.aip.dev/160 for the syntax of the filter expression.
8131
+ */
8132
+ metadataFilter: z4.z.string().describe(
8133
+ "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
8134
+ ).optional()
8135
+ }).passthrough();
8136
+ var fileSearchArgsSchema = lazySchema(
8137
+ () => zodSchema(fileSearchArgsBaseSchema)
8138
+ );
8139
+ var fileSearch = createProviderDefinedToolFactory({
8140
+ id: "google.file_search",
8141
+ name: "file_search",
8142
+ inputSchema: fileSearchArgsSchema
8143
+ });
7893
8144
  var googleSearch = createProviderDefinedToolFactory({
7894
8145
  id: "google.google_search",
7895
8146
  name: "google_search",
@@ -7907,6 +8158,14 @@ var urlContext = createProviderDefinedToolFactory({
7907
8158
  name: "url_context",
7908
8159
  inputSchema: lazySchema(() => zodSchema(z4.z.object({})))
7909
8160
  });
8161
+ var vertexRagStore = createProviderDefinedToolFactory({
8162
+ id: "google.vertex_rag_store",
8163
+ name: "vertex_rag_store",
8164
+ inputSchema: z4.z.object({
8165
+ ragCorpus: z4.z.string(),
8166
+ topK: z4.z.number().optional()
8167
+ })
8168
+ });
7910
8169
  var googleTools = {
7911
8170
  /**
7912
8171
  * Creates a Google search tool that gives Google direct access to real-time web content.
@@ -7918,6 +8177,17 @@ var googleTools = {
7918
8177
  * Must have name "url_context".
7919
8178
  */
7920
8179
  urlContext,
8180
+ /**
8181
+ * Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.
8182
+ * Must have name "file_search".
8183
+ *
8184
+ * @param fileSearchStoreNames - Fully-qualified File Search store resource names.
8185
+ * @param metadataFilter - Optional filter expression to restrict the files that can be retrieved.
8186
+ * @param topK - Optional result limit for the number of chunks returned from File Search.
8187
+ *
8188
+ * @see https://ai.google.dev/gemini-api/docs/file-search
8189
+ */
8190
+ fileSearch,
7921
8191
  /**
7922
8192
  * A tool that enables the model to generate and run Python code.
7923
8193
  * Must have name "code_execution".
@@ -7928,7 +8198,12 @@ var googleTools = {
7928
8198
  * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
7929
8199
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
7930
8200
  */
7931
- codeExecution
8201
+ codeExecution,
8202
+ /**
8203
+ * Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.
8204
+ * Must have name "vertex_rag_store".
8205
+ */
8206
+ vertexRagStore
7932
8207
  };
7933
8208
  var GoogleGenerativeAIImageModel = class {
7934
8209
  constructor(modelId, settings, config) {
@@ -8037,8 +8312,9 @@ var googleImageProviderOptionsSchema = lazySchema(
8037
8312
  )
8038
8313
  );
8039
8314
  function createGoogleGenerativeAI(options = {}) {
8040
- var _a15;
8315
+ var _a15, _b;
8041
8316
  const baseURL = (_a15 = withoutTrailingSlash(options.baseURL)) != null ? _a15 : "https://generativelanguage.googleapis.com/v1beta";
8317
+ const providerName = (_b = options.name) != null ? _b : "google.generative-ai";
8042
8318
  const getHeaders = () => withUserAgentSuffix(
8043
8319
  {
8044
8320
  "x-goog-api-key": loadApiKey({
@@ -8053,7 +8329,7 @@ function createGoogleGenerativeAI(options = {}) {
8053
8329
  const createChatModel = (modelId) => {
8054
8330
  var _a22;
8055
8331
  return new GoogleGenerativeAILanguageModel(modelId, {
8056
- provider: "google.generative-ai",
8332
+ provider: providerName,
8057
8333
  baseURL,
8058
8334
  headers: getHeaders,
8059
8335
  generateId: (_a22 = options.generateId) != null ? _a22 : generateId,
@@ -8073,13 +8349,13 @@ function createGoogleGenerativeAI(options = {}) {
8073
8349
  });
8074
8350
  };
8075
8351
  const createEmbeddingModel = (modelId) => new GoogleGenerativeAIEmbeddingModel(modelId, {
8076
- provider: "google.generative-ai",
8352
+ provider: providerName,
8077
8353
  baseURL,
8078
8354
  headers: getHeaders,
8079
8355
  fetch: options.fetch
8080
8356
  });
8081
8357
  const createImageModel = (modelId, settings = {}) => new GoogleGenerativeAIImageModel(modelId, settings, {
8082
- provider: "google.generative-ai",
8358
+ provider: providerName,
8083
8359
  baseURL,
8084
8360
  headers: getHeaders,
8085
8361
  fetch: options.fetch
@@ -8301,7 +8577,7 @@ function getResponseMetadata3({
8301
8577
  return {
8302
8578
  id: id != null ? id : void 0,
8303
8579
  modelId: model != null ? model : void 0,
8304
- timestamp: created != null ? new Date(created * 1e3) : void 0
8580
+ timestamp: created ? new Date(created * 1e3) : void 0
8305
8581
  };
8306
8582
  }
8307
8583
  function mapOpenAIFinishReason(finishReason) {
@@ -8485,7 +8761,7 @@ var openaiChatLanguageModelOptions = lazyValidator(
8485
8761
  /**
8486
8762
  * Reasoning effort for reasoning models. Defaults to `medium`.
8487
8763
  */
8488
- reasoningEffort: z4.z.enum(["minimal", "low", "medium", "high"]).optional(),
8764
+ reasoningEffort: z4.z.enum(["none", "minimal", "low", "medium", "high"]).optional(),
8489
8765
  /**
8490
8766
  * Maximum number of completion tokens to generate. Useful for reasoning models.
8491
8767
  */
@@ -8535,6 +8811,15 @@ var openaiChatLanguageModelOptions = lazyValidator(
8535
8811
  * Useful for improving cache hit rates and working around automatic caching issues.
8536
8812
  */
8537
8813
  promptCacheKey: z4.z.string().optional(),
8814
+ /**
8815
+ * The retention policy for the prompt cache.
8816
+ * - 'in_memory': Default. Standard prompt caching behavior.
8817
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
8818
+ * Currently only available for 5.1 series models.
8819
+ *
8820
+ * @default 'in_memory'
8821
+ */
8822
+ promptCacheRetention: z4.z.enum(["in_memory", "24h"]).optional(),
8538
8823
  /**
8539
8824
  * A stable identifier used to help detect users of your application
8540
8825
  * that may be violating OpenAI's usage policies. The IDs should be a
@@ -8696,6 +8981,7 @@ var OpenAIChatLanguageModel = class {
8696
8981
  reasoning_effort: openaiOptions.reasoningEffort,
8697
8982
  service_tier: openaiOptions.serviceTier,
8698
8983
  prompt_cache_key: openaiOptions.promptCacheKey,
8984
+ prompt_cache_retention: openaiOptions.promptCacheRetention,
8699
8985
  safety_identifier: openaiOptions.safetyIdentifier,
8700
8986
  // messages:
8701
8987
  messages
@@ -8911,7 +9197,7 @@ var OpenAIChatLanguageModel = class {
8911
9197
  outputTokens: void 0,
8912
9198
  totalTokens: void 0
8913
9199
  };
8914
- let isFirstChunk = true;
9200
+ let metadataExtracted = false;
8915
9201
  let isActiveText = false;
8916
9202
  const providerMetadata = { openai: {} };
8917
9203
  return {
@@ -8936,12 +9222,15 @@ var OpenAIChatLanguageModel = class {
8936
9222
  controller.enqueue({ type: "error", error: value.error });
8937
9223
  return;
8938
9224
  }
8939
- if (isFirstChunk) {
8940
- isFirstChunk = false;
8941
- controller.enqueue({
8942
- type: "response-metadata",
8943
- ...getResponseMetadata3(value)
8944
- });
9225
+ if (!metadataExtracted) {
9226
+ const metadata = getResponseMetadata3(value);
9227
+ if (Object.values(metadata).some(Boolean)) {
9228
+ metadataExtracted = true;
9229
+ controller.enqueue({
9230
+ type: "response-metadata",
9231
+ ...getResponseMetadata3(value)
9232
+ });
9233
+ }
8945
9234
  }
8946
9235
  if (value.usage != null) {
8947
9236
  usage.inputTokens = (_a15 = value.usage.prompt_tokens) != null ? _a15 : void 0;
@@ -9113,18 +9402,6 @@ function getSystemMessageMode(modelId) {
9113
9402
  return (_b = (_a15 = reasoningModels[modelId]) == null ? void 0 : _a15.systemMessageMode) != null ? _b : "developer";
9114
9403
  }
9115
9404
  var reasoningModels = {
9116
- "o1-mini": {
9117
- systemMessageMode: "remove"
9118
- },
9119
- "o1-mini-2024-09-12": {
9120
- systemMessageMode: "remove"
9121
- },
9122
- "o1-preview": {
9123
- systemMessageMode: "remove"
9124
- },
9125
- "o1-preview-2024-09-12": {
9126
- systemMessageMode: "remove"
9127
- },
9128
9405
  o3: {
9129
9406
  systemMessageMode: "developer"
9130
9407
  },
@@ -9660,7 +9937,7 @@ var openaiImageResponseSchema = lazyValidator(
9660
9937
  data: z4.z.array(
9661
9938
  z4.z.object({
9662
9939
  b64_json: z4.z.string(),
9663
- revised_prompt: z4.z.string().optional()
9940
+ revised_prompt: z4.z.string().nullish()
9664
9941
  })
9665
9942
  )
9666
9943
  })
@@ -9805,7 +10082,7 @@ var compoundFilterSchema = z4.z.object({
9805
10082
  z4.z.union([comparisonFilterSchema, z4.z.lazy(() => compoundFilterSchema)])
9806
10083
  )
9807
10084
  });
9808
- var fileSearchArgsSchema = lazySchema(
10085
+ var fileSearchArgsSchema2 = lazySchema(
9809
10086
  () => zodSchema(
9810
10087
  z4.z.object({
9811
10088
  vectorStoreIds: z4.z.array(z4.z.string()),
@@ -9834,7 +10111,7 @@ var fileSearchOutputSchema = lazySchema(
9834
10111
  })
9835
10112
  )
9836
10113
  );
9837
- var fileSearch = createProviderDefinedToolFactoryWithOutputSchema({
10114
+ var fileSearch2 = createProviderDefinedToolFactoryWithOutputSchema({
9838
10115
  id: "openai.file_search",
9839
10116
  name: "file_search",
9840
10117
  inputSchema: z4.z.object({}),
@@ -9928,7 +10205,13 @@ var webSearchOutputSchema = lazySchema(
9928
10205
  url: z4.z.string(),
9929
10206
  pattern: z4.z.string()
9930
10207
  })
9931
- ])
10208
+ ]),
10209
+ sources: z4.z.array(
10210
+ z4.z.discriminatedUnion("type", [
10211
+ z4.z.object({ type: z4.z.literal("url"), url: z4.z.string() }),
10212
+ z4.z.object({ type: z4.z.literal("api"), name: z4.z.string() })
10213
+ ])
10214
+ ).optional()
9932
10215
  })
9933
10216
  )
9934
10217
  );
@@ -10006,7 +10289,7 @@ var openaiTools = {
10006
10289
  * @param ranking - The ranking options to use for the file search.
10007
10290
  * @param filters - The filters to use for the file search.
10008
10291
  */
10009
- fileSearch,
10292
+ fileSearch: fileSearch2,
10010
10293
  /**
10011
10294
  * The image generation tool allows you to generate images using a text prompt,
10012
10295
  * and optionally image inputs. It leverages the GPT Image model,
@@ -10486,7 +10769,13 @@ var openaiResponsesChunkSchema = lazyValidator(
10486
10769
  action: z4.z.discriminatedUnion("type", [
10487
10770
  z4.z.object({
10488
10771
  type: z4.z.literal("search"),
10489
- query: z4.z.string().nullish()
10772
+ query: z4.z.string().nullish(),
10773
+ sources: z4.z.array(
10774
+ z4.z.discriminatedUnion("type", [
10775
+ z4.z.object({ type: z4.z.literal("url"), url: z4.z.string() }),
10776
+ z4.z.object({ type: z4.z.literal("api"), name: z4.z.string() })
10777
+ ])
10778
+ ).nullish()
10490
10779
  }),
10491
10780
  z4.z.object({
10492
10781
  type: z4.z.literal("open_page"),
@@ -10594,10 +10883,13 @@ var openaiResponsesChunkSchema = lazyValidator(
10594
10883
  }),
10595
10884
  z4.z.object({
10596
10885
  type: z4.z.literal("error"),
10597
- code: z4.z.string(),
10598
- message: z4.z.string(),
10599
- param: z4.z.string().nullish(),
10600
- sequence_number: z4.z.number()
10886
+ sequence_number: z4.z.number(),
10887
+ error: z4.z.object({
10888
+ type: z4.z.string(),
10889
+ code: z4.z.string(),
10890
+ message: z4.z.string(),
10891
+ param: z4.z.string().nullish()
10892
+ })
10601
10893
  }),
10602
10894
  z4.z.object({ type: z4.z.string() }).loose().transform((value) => ({
10603
10895
  type: "unknown_chunk",
@@ -10610,13 +10902,15 @@ var openaiResponsesChunkSchema = lazyValidator(
10610
10902
  var openaiResponsesResponseSchema = lazyValidator(
10611
10903
  () => zodSchema(
10612
10904
  z4.z.object({
10613
- id: z4.z.string(),
10614
- created_at: z4.z.number(),
10905
+ id: z4.z.string().optional(),
10906
+ created_at: z4.z.number().optional(),
10615
10907
  error: z4.z.object({
10616
- code: z4.z.string(),
10617
- message: z4.z.string()
10908
+ message: z4.z.string(),
10909
+ type: z4.z.string(),
10910
+ param: z4.z.string().nullish(),
10911
+ code: z4.z.string()
10618
10912
  }).nullish(),
10619
- model: z4.z.string(),
10913
+ model: z4.z.string().optional(),
10620
10914
  output: z4.z.array(
10621
10915
  z4.z.discriminatedUnion("type", [
10622
10916
  z4.z.object({
@@ -10658,7 +10952,18 @@ var openaiResponsesResponseSchema = lazyValidator(
10658
10952
  quote: z4.z.string().nullish()
10659
10953
  }),
10660
10954
  z4.z.object({
10661
- type: z4.z.literal("container_file_citation")
10955
+ type: z4.z.literal("container_file_citation"),
10956
+ container_id: z4.z.string(),
10957
+ file_id: z4.z.string(),
10958
+ filename: z4.z.string().nullish(),
10959
+ start_index: z4.z.number().nullish(),
10960
+ end_index: z4.z.number().nullish(),
10961
+ index: z4.z.number().nullish()
10962
+ }),
10963
+ z4.z.object({
10964
+ type: z4.z.literal("file_path"),
10965
+ file_id: z4.z.string(),
10966
+ index: z4.z.number().nullish()
10662
10967
  })
10663
10968
  ])
10664
10969
  )
@@ -10672,7 +10977,13 @@ var openaiResponsesResponseSchema = lazyValidator(
10672
10977
  action: z4.z.discriminatedUnion("type", [
10673
10978
  z4.z.object({
10674
10979
  type: z4.z.literal("search"),
10675
- query: z4.z.string().nullish()
10980
+ query: z4.z.string().nullish(),
10981
+ sources: z4.z.array(
10982
+ z4.z.discriminatedUnion("type", [
10983
+ z4.z.object({ type: z4.z.literal("url"), url: z4.z.string() }),
10984
+ z4.z.object({ type: z4.z.literal("api"), name: z4.z.string() })
10985
+ ])
10986
+ ).nullish()
10676
10987
  }),
10677
10988
  z4.z.object({
10678
10989
  type: z4.z.literal("open_page"),
@@ -10691,7 +11002,10 @@ var openaiResponsesResponseSchema = lazyValidator(
10691
11002
  queries: z4.z.array(z4.z.string()),
10692
11003
  results: z4.z.array(
10693
11004
  z4.z.object({
10694
- attributes: z4.z.record(z4.z.string(), z4.z.unknown()),
11005
+ attributes: z4.z.record(
11006
+ z4.z.string(),
11007
+ z4.z.union([z4.z.string(), z4.z.number(), z4.z.boolean()])
11008
+ ),
10695
11009
  file_id: z4.z.string(),
10696
11010
  filename: z4.z.string(),
10697
11011
  score: z4.z.number(),
@@ -10753,7 +11067,7 @@ var openaiResponsesResponseSchema = lazyValidator(
10753
11067
  )
10754
11068
  })
10755
11069
  ])
10756
- ),
11070
+ ).optional(),
10757
11071
  service_tier: z4.z.string().nullish(),
10758
11072
  incomplete_details: z4.z.object({ reason: z4.z.string() }).nullish(),
10759
11073
  usage: z4.z.object({
@@ -10761,7 +11075,7 @@ var openaiResponsesResponseSchema = lazyValidator(
10761
11075
  input_tokens_details: z4.z.object({ cached_tokens: z4.z.number().nullish() }).nullish(),
10762
11076
  output_tokens: z4.z.number(),
10763
11077
  output_tokens_details: z4.z.object({ reasoning_tokens: z4.z.number().nullish() }).nullish()
10764
- })
11078
+ }).optional()
10765
11079
  })
10766
11080
  )
10767
11081
  );
@@ -10769,6 +11083,7 @@ var TOP_LOGPROBS_MAX = 20;
10769
11083
  var openaiResponsesProviderOptionsSchema = lazyValidator(
10770
11084
  () => zodSchema(
10771
11085
  z4.z.object({
11086
+ conversation: z4.z.string().nullish(),
10772
11087
  include: z4.z.array(
10773
11088
  z4.z.enum([
10774
11089
  "reasoning.encrypted_content",
@@ -10801,6 +11116,15 @@ var openaiResponsesProviderOptionsSchema = lazyValidator(
10801
11116
  parallelToolCalls: z4.z.boolean().nullish(),
10802
11117
  previousResponseId: z4.z.string().nullish(),
10803
11118
  promptCacheKey: z4.z.string().nullish(),
11119
+ /**
11120
+ * The retention policy for the prompt cache.
11121
+ * - 'in_memory': Default. Standard prompt caching behavior.
11122
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
11123
+ * Currently only available for 5.1 series models.
11124
+ *
11125
+ * @default 'in_memory'
11126
+ */
11127
+ promptCacheRetention: z4.z.enum(["in_memory", "24h"]).nullish(),
10804
11128
  reasoningEffort: z4.z.string().nullish(),
10805
11129
  reasoningSummary: z4.z.string().nullish(),
10806
11130
  safetyIdentifier: z4.z.string().nullish(),
@@ -10840,7 +11164,7 @@ async function prepareResponsesTools({
10840
11164
  case "openai.file_search": {
10841
11165
  const args = await validateTypes({
10842
11166
  value: tool2.args,
10843
- schema: fileSearchArgsSchema
11167
+ schema: fileSearchArgsSchema2
10844
11168
  });
10845
11169
  openaiTools2.push({
10846
11170
  type: "file_search",
@@ -11006,6 +11330,13 @@ var OpenAIResponsesLanguageModel = class {
11006
11330
  providerOptions,
11007
11331
  schema: openaiResponsesProviderOptionsSchema
11008
11332
  });
11333
+ if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
11334
+ warnings.push({
11335
+ type: "unsupported-setting",
11336
+ setting: "conversation",
11337
+ details: "conversation and previousResponseId cannot be used together"
11338
+ });
11339
+ }
11009
11340
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
11010
11341
  prompt,
11011
11342
  systemMessageMode: modelConfig.systemMessageMode,
@@ -11068,6 +11399,7 @@ var OpenAIResponsesLanguageModel = class {
11068
11399
  }
11069
11400
  },
11070
11401
  // provider options:
11402
+ conversation: openaiOptions == null ? void 0 : openaiOptions.conversation,
11071
11403
  max_tool_calls: openaiOptions == null ? void 0 : openaiOptions.maxToolCalls,
11072
11404
  metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
11073
11405
  parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
@@ -11078,6 +11410,7 @@ var OpenAIResponsesLanguageModel = class {
11078
11410
  service_tier: openaiOptions == null ? void 0 : openaiOptions.serviceTier,
11079
11411
  include,
11080
11412
  prompt_cache_key: openaiOptions == null ? void 0 : openaiOptions.promptCacheKey,
11413
+ prompt_cache_retention: openaiOptions == null ? void 0 : openaiOptions.promptCacheRetention,
11081
11414
  safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
11082
11415
  top_logprobs: topLogprobs,
11083
11416
  truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
@@ -11287,7 +11620,14 @@ var OpenAIResponsesLanguageModel = class {
11287
11620
  id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId(),
11288
11621
  mediaType: "text/plain",
11289
11622
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
11290
- filename: (_l = annotation.filename) != null ? _l : annotation.file_id
11623
+ filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
11624
+ ...annotation.file_id ? {
11625
+ providerMetadata: {
11626
+ openai: {
11627
+ fileId: annotation.file_id
11628
+ }
11629
+ }
11630
+ } : {}
11291
11631
  });
11292
11632
  }
11293
11633
  }
@@ -11397,7 +11737,9 @@ var OpenAIResponsesLanguageModel = class {
11397
11737
  }
11398
11738
  }
11399
11739
  const providerMetadata = {
11400
- openai: { responseId: response.id }
11740
+ openai: {
11741
+ ...response.id != null ? { responseId: response.id } : {}
11742
+ }
11401
11743
  };
11402
11744
  if (logprobs.length > 0) {
11403
11745
  providerMetadata.openai.logprobs = logprobs;
@@ -11405,6 +11747,7 @@ var OpenAIResponsesLanguageModel = class {
11405
11747
  if (typeof response.service_tier === "string") {
11406
11748
  providerMetadata.openai.serviceTier = response.service_tier;
11407
11749
  }
11750
+ const usage = response.usage;
11408
11751
  return {
11409
11752
  content,
11410
11753
  finishReason: mapOpenAIResponseFinishReason({
@@ -11412,11 +11755,11 @@ var OpenAIResponsesLanguageModel = class {
11412
11755
  hasFunctionCall
11413
11756
  }),
11414
11757
  usage: {
11415
- inputTokens: response.usage.input_tokens,
11416
- outputTokens: response.usage.output_tokens,
11417
- totalTokens: response.usage.input_tokens + response.usage.output_tokens,
11418
- reasoningTokens: (_q = (_p = response.usage.output_tokens_details) == null ? void 0 : _p.reasoning_tokens) != null ? _q : void 0,
11419
- cachedInputTokens: (_s = (_r = response.usage.input_tokens_details) == null ? void 0 : _r.cached_tokens) != null ? _s : void 0
11758
+ inputTokens: usage.input_tokens,
11759
+ outputTokens: usage.output_tokens,
11760
+ totalTokens: usage.input_tokens + usage.output_tokens,
11761
+ reasoningTokens: (_q = (_p = usage.output_tokens_details) == null ? void 0 : _p.reasoning_tokens) != null ? _q : void 0,
11762
+ cachedInputTokens: (_s = (_r = usage.input_tokens_details) == null ? void 0 : _r.cached_tokens) != null ? _s : void 0
11420
11763
  },
11421
11764
  request: { body },
11422
11765
  response: {
@@ -11865,7 +12208,14 @@ var OpenAIResponsesLanguageModel = class {
11865
12208
  id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : generateId(),
11866
12209
  mediaType: "text/plain",
11867
12210
  title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
11868
- filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id
12211
+ filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
12212
+ ...value.annotation.file_id ? {
12213
+ providerMetadata: {
12214
+ openai: {
12215
+ fileId: value.annotation.file_id
12216
+ }
12217
+ }
12218
+ } : {}
11869
12219
  });
11870
12220
  }
11871
12221
  } else if (isErrorChunk(value)) {
@@ -11943,13 +12293,6 @@ function getResponsesModelConfig(modelId) {
11943
12293
  };
11944
12294
  }
11945
12295
  if (modelId.startsWith("o") || modelId.startsWith("gpt-5") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
11946
- if (modelId.startsWith("o1-mini") || modelId.startsWith("o1-preview")) {
11947
- return {
11948
- ...defaults,
11949
- isReasoningModel: true,
11950
- systemMessageMode: "remove"
11951
- };
11952
- }
11953
12296
  return {
11954
12297
  ...defaults,
11955
12298
  isReasoningModel: true,
@@ -11965,7 +12308,11 @@ function mapWebSearchOutput(action) {
11965
12308
  var _a15;
11966
12309
  switch (action.type) {
11967
12310
  case "search":
11968
- return { action: { type: "search", query: (_a15 = action.query) != null ? _a15 : void 0 } };
12311
+ return {
12312
+ action: { type: "search", query: (_a15 = action.query) != null ? _a15 : void 0 },
12313
+ // include sources when provided by the Responses API (behind include flag)
12314
+ ...action.sources != null && { sources: action.sources }
12315
+ };
11969
12316
  case "open_page":
11970
12317
  return { action: { type: "openPage", url: action.url } };
11971
12318
  case "find":
@@ -12304,7 +12651,7 @@ var OpenAITranscriptionModel = class {
12304
12651
  };
12305
12652
  }
12306
12653
  };
12307
- var VERSION5 = "2.0.53" ;
12654
+ var VERSION5 = "2.0.69" ;
12308
12655
  function createOpenAI(options = {}) {
12309
12656
  var _a15, _b;
12310
12657
  const baseURL = (_a15 = withoutTrailingSlash(
@@ -12401,9 +12748,18 @@ function createOpenAI(options = {}) {
12401
12748
  }
12402
12749
  createOpenAI();
12403
12750
 
12751
+ exports.APICallError = APICallError;
12752
+ exports.EmptyResponseBodyError = EmptyResponseBodyError;
12753
+ exports.EventSourceParserStream = EventSourceParserStream;
12754
+ exports.InvalidArgumentError = InvalidArgumentError;
12755
+ exports.InvalidResponseDataError = InvalidResponseDataError;
12756
+ exports.JSONParseError = JSONParseError;
12757
+ exports.LoadAPIKeyError = LoadAPIKeyError;
12404
12758
  exports.MastraModelGateway = MastraModelGateway;
12405
12759
  exports.NoSuchModelError = NoSuchModelError;
12406
12760
  exports.OpenAICompatibleImageModel = OpenAICompatibleImageModel;
12761
+ exports.TooManyEmbeddingValuesForCallError = TooManyEmbeddingValuesForCallError;
12762
+ exports.TypeValidationError = TypeValidationError;
12407
12763
  exports.UnsupportedFunctionalityError = UnsupportedFunctionalityError;
12408
12764
  exports.combineHeaders = combineHeaders;
12409
12765
  exports.convertToBase64 = convertToBase64;
@@ -12415,10 +12771,11 @@ exports.createJsonResponseHandler = createJsonResponseHandler;
12415
12771
  exports.createOpenAI = createOpenAI;
12416
12772
  exports.createOpenAICompatible = createOpenAICompatible;
12417
12773
  exports.generateId = generateId;
12774
+ exports.injectJsonInstructionIntoMessages = injectJsonInstructionIntoMessages;
12418
12775
  exports.loadApiKey = loadApiKey;
12419
12776
  exports.parseProviderOptions = parseProviderOptions;
12420
12777
  exports.postJsonToApi = postJsonToApi;
12421
12778
  exports.withUserAgentSuffix = withUserAgentSuffix;
12422
12779
  exports.withoutTrailingSlash = withoutTrailingSlash;
12423
- //# sourceMappingURL=chunk-S5MJLXMG.cjs.map
12424
- //# sourceMappingURL=chunk-S5MJLXMG.cjs.map
12780
+ //# sourceMappingURL=chunk-CZEJQSWB.cjs.map
12781
+ //# sourceMappingURL=chunk-CZEJQSWB.cjs.map