@mastra/server 1.80.0-alpha.3 → 1.80.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (498) hide show
  1. package/dist/_types/@internal_core/dist/storage/index.d.ts +0 -12
  2. package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +0 -2
  3. package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/routes/index.d.ts +0 -2
  4. package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/types/index.d.ts +0 -2
  5. package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +65 -13
  6. package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-v6/dist/index.d.ts +110 -35
  7. package/dist/{a2a-BKtK_s5o.cjs → a2a-BaRqCOUl.cjs} +14 -22
  8. package/dist/{a2a-BKtK_s5o.cjs.map → a2a-BaRqCOUl.cjs.map} +1 -1
  9. package/dist/{a2a-CBl-c-lm.cjs → a2a-BsBYrosr.cjs} +2 -3
  10. package/dist/{a2a-CBl-c-lm.cjs.map → a2a-BsBYrosr.cjs.map} +1 -1
  11. package/dist/{a2a-BS0gTQk3.js → a2a-C3ClP3C2.js} +2 -3
  12. package/dist/{a2a-BS0gTQk3.js.map → a2a-C3ClP3C2.js.map} +1 -1
  13. package/dist/{a2a-DKGBctKT.js → a2a-CApzjeDH.js} +13 -21
  14. package/dist/{a2a-DKGBctKT.js.map → a2a-CApzjeDH.js.map} +1 -1
  15. package/dist/{agent-builder-DDYdQvlQ.cjs → agent-builder-9-GSvpgR.cjs} +3 -4
  16. package/dist/{agent-builder-DDYdQvlQ.cjs.map → agent-builder-9-GSvpgR.cjs.map} +1 -1
  17. package/dist/{agent-builder-B8kc4OBs.js → agent-builder-Cr-52Ulb.js} +3 -4
  18. package/dist/{agent-builder-B8kc4OBs.js.map → agent-builder-Cr-52Ulb.js.map} +1 -1
  19. package/dist/{agent-builder-C-U5USc5.js → agent-builder-Cv6X2dKZ.js} +12 -13
  20. package/dist/{agent-builder-C-U5USc5.js.map → agent-builder-Cv6X2dKZ.js.map} +1 -1
  21. package/dist/{agent-builder-us2nwcWc.cjs → agent-builder-DExL1jAO.cjs} +12 -13
  22. package/dist/{agent-builder-us2nwcWc.cjs.map → agent-builder-DExL1jAO.cjs.map} +1 -1
  23. package/dist/{agent-versions-CzXJWn1T.cjs → agent-versions-De5bRBaa.cjs} +5 -6
  24. package/dist/{agent-versions-CzXJWn1T.cjs.map → agent-versions-De5bRBaa.cjs.map} +1 -1
  25. package/dist/{agent-versions-W600H1ME.js → agent-versions-Pa-ABszp.js} +5 -6
  26. package/dist/{agent-versions-W600H1ME.js.map → agent-versions-Pa-ABszp.js.map} +1 -1
  27. package/dist/{agents-D1-fgNeb.js → agents-A-ahR0eQ.js} +5 -6
  28. package/dist/{agents-D1-fgNeb.js.map → agents-A-ahR0eQ.js.map} +1 -1
  29. package/dist/{agents-AyHEkc2F.cjs → agents-BBaFtyAt.cjs} +20 -21
  30. package/dist/agents-BBaFtyAt.cjs.map +1 -0
  31. package/dist/{agents-BYE5Dmfk.js → agents-CGS0tE4p.js} +19 -20
  32. package/dist/agents-CGS0tE4p.js.map +1 -0
  33. package/dist/{agents-B1EiIdRs.cjs → agents-vFpMvK3w.cjs} +5 -6
  34. package/dist/{agents-B1EiIdRs.cjs.map → agents-vFpMvK3w.cjs.map} +1 -1
  35. package/dist/{api-schema-manifest-A066IsPX.js → api-schema-manifest-BCIpcado.js} +4 -5
  36. package/dist/{api-schema-manifest-A066IsPX.js.map → api-schema-manifest-BCIpcado.js.map} +1 -1
  37. package/dist/{api-schema-manifest-BaF6TE9d.cjs → api-schema-manifest-BRItYYlN.cjs} +5 -6
  38. package/dist/{api-schema-manifest-BaF6TE9d.cjs.map → api-schema-manifest-BRItYYlN.cjs.map} +1 -1
  39. package/dist/{auth-B8fQdEg-.cjs → auth-CM5AgF9l.cjs} +2 -3
  40. package/dist/{auth-B8fQdEg-.cjs.map → auth-CM5AgF9l.cjs.map} +1 -1
  41. package/dist/{auth-CZFXpwba.js → auth-CjT_a76k.js} +2 -3
  42. package/dist/{auth-CZFXpwba.js.map → auth-CjT_a76k.js.map} +1 -1
  43. package/dist/{background-tasks-B3VAKTJh.cjs → background-tasks-BMp9Q6SB.cjs} +7 -9
  44. package/dist/{background-tasks-B3VAKTJh.cjs.map → background-tasks-BMp9Q6SB.cjs.map} +1 -1
  45. package/dist/{background-tasks-Du2zYOPl.js → background-tasks-DIpPsqVy.js} +7 -9
  46. package/dist/{background-tasks-Du2zYOPl.js.map → background-tasks-DIpPsqVy.js.map} +1 -1
  47. package/dist/{builder-registry-DLdu9bWH.js → builder-registry-CtGv0Gj6.js} +7 -9
  48. package/dist/{builder-registry-DLdu9bWH.js.map → builder-registry-CtGv0Gj6.js.map} +1 -1
  49. package/dist/{builder-registry-DaFAaMTf.cjs → builder-registry-DWusXgse.cjs} +7 -9
  50. package/dist/{builder-registry-DaFAaMTf.cjs.map → builder-registry-DWusXgse.cjs.map} +1 -1
  51. package/dist/{channels-BnVRmnzK.cjs → channels-EqvuQQbv.cjs} +6 -8
  52. package/dist/{channels-BnVRmnzK.cjs.map → channels-EqvuQQbv.cjs.map} +1 -1
  53. package/dist/{channels-Db-4pXVZ.js → channels-LNR2QIkc.js} +6 -8
  54. package/dist/{channels-Db-4pXVZ.js.map → channels-LNR2QIkc.js.map} +1 -1
  55. package/dist/{common-DhKNoXGp.cjs → common-DVZqSEhZ.cjs} +2 -3
  56. package/dist/{common-DhKNoXGp.cjs.map → common-DVZqSEhZ.cjs.map} +1 -1
  57. package/dist/{common-Y30XtCyr.js → common-xUmaFUop.js} +2 -3
  58. package/dist/{common-Y30XtCyr.js.map → common-xUmaFUop.js.map} +1 -1
  59. package/dist/{constants-e7aaPCLj.cjs → constants-Co1XjPjd.cjs} +2 -3
  60. package/dist/{constants-e7aaPCLj.cjs.map → constants-Co1XjPjd.cjs.map} +1 -1
  61. package/dist/{constants-DazK_RZj.js → constants-ohUUT3Vg.js} +2 -3
  62. package/dist/{constants-DazK_RZj.js.map → constants-ohUUT3Vg.js.map} +1 -1
  63. package/dist/{conversations-D-ew5IXn.js → conversations-B-s9MWRb.js} +8 -9
  64. package/dist/{conversations-D-ew5IXn.js.map → conversations-B-s9MWRb.js.map} +1 -1
  65. package/dist/{conversations-DasqEDCF.cjs → conversations-BPQNrv5g.cjs} +5 -6
  66. package/dist/{conversations-DasqEDCF.cjs.map → conversations-BPQNrv5g.cjs.map} +1 -1
  67. package/dist/{conversations-DzuWI3w-.cjs → conversations-DLuMXWot.cjs} +8 -9
  68. package/dist/{conversations-DzuWI3w-.cjs.map → conversations-DLuMXWot.cjs.map} +1 -1
  69. package/dist/{conversations-BzBHVFYe.js → conversations-nNko6-H4.js} +4 -5
  70. package/dist/{conversations-BzBHVFYe.js.map → conversations-nNko6-H4.js.map} +1 -1
  71. package/dist/{datasets-Cgtczd13.cjs → datasets-BP2O5CSR.cjs} +3 -4
  72. package/dist/{datasets-Cgtczd13.cjs.map → datasets-BP2O5CSR.cjs.map} +1 -1
  73. package/dist/{datasets-FRp69Mwv.js → datasets-hLmYapTk.js} +3 -4
  74. package/dist/{datasets-FRp69Mwv.js.map → datasets-hLmYapTk.js.map} +1 -1
  75. package/dist/{default-options-C7tykjLq.cjs → default-options-DRN81WEQ.cjs} +2 -3
  76. package/dist/{default-options-C7tykjLq.cjs.map → default-options-DRN81WEQ.cjs.map} +1 -1
  77. package/dist/{default-options-oSlrqpuP.js → default-options-Dir6CKnE.js} +2 -3
  78. package/dist/{default-options-oSlrqpuP.js.map → default-options-Dir6CKnE.js.map} +1 -1
  79. package/dist/{dist-lT2rqyY9.cjs → dist-36GZrEvk.cjs} +4 -5
  80. package/dist/{dist-lT2rqyY9.cjs.map → dist-36GZrEvk.cjs.map} +1 -1
  81. package/dist/{dist-CeTLA-e5.cjs → dist-BZGewCGq.cjs} +6 -10
  82. package/dist/{dist-CeTLA-e5.cjs.map → dist-BZGewCGq.cjs.map} +1 -1
  83. package/dist/{dist-Bo3GdQwf.cjs → dist-Bal15xNO.cjs} +5 -7
  84. package/dist/{dist-Bo3GdQwf.cjs.map → dist-Bal15xNO.cjs.map} +1 -1
  85. package/dist/dist-C-L2kyKZ.js +1 -0
  86. package/dist/{dist-DjkPkAzV.js → dist-CNjm6d2Q.js} +5 -8
  87. package/dist/{dist-DjkPkAzV.js.map → dist-CNjm6d2Q.js.map} +1 -1
  88. package/dist/{dist-DLld1qjf.js → dist-CVoi_Dov.js} +3 -4
  89. package/dist/{dist-DLld1qjf.js.map → dist-CVoi_Dov.js.map} +1 -1
  90. package/dist/{dist-CukR8zi9.cjs → dist-Clj7hRKz.cjs} +1554 -725
  91. package/dist/dist-Clj7hRKz.cjs.map +1 -0
  92. package/dist/{dist-DsrJXwic.cjs → dist-D02J6PZG.cjs} +4 -5
  93. package/dist/{dist-DsrJXwic.cjs.map → dist-D02J6PZG.cjs.map} +1 -1
  94. package/dist/dist-D6oS7RF1.cjs +3 -0
  95. package/dist/{dist-CREG82cy.js → dist-DC9qnRcv.js} +3 -4
  96. package/dist/{dist-CREG82cy.js.map → dist-DC9qnRcv.js.map} +1 -1
  97. package/dist/{dist-BIrQLUV9.js → dist-Dc0g0QSi.js} +4 -6
  98. package/dist/{dist-BIrQLUV9.js.map → dist-Dc0g0QSi.js.map} +1 -1
  99. package/dist/{dist-BBOnrL_A.js → dist-Dwfkbwzg.js} +3 -4
  100. package/dist/{dist-BBOnrL_A.js.map → dist-Dwfkbwzg.js.map} +1 -1
  101. package/dist/{dist-5TAg2f91.js → dist-PlsLrwz8.js} +1549 -719
  102. package/dist/dist-PlsLrwz8.js.map +1 -0
  103. package/dist/{dist-B9ery9Zw.cjs → dist-lG-fYW7-.cjs} +4 -5
  104. package/dist/{dist-B9ery9Zw.cjs.map → dist-lG-fYW7-.cjs.map} +1 -1
  105. package/dist/docs/SKILL.md +1 -1
  106. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  107. package/dist/docs/references/docs-server-custom-adapters.md +53 -1
  108. package/dist/docs/references/docs-server-custom-api-routes.md +2 -0
  109. package/dist/{dynamic-workflows-HwPX3mcf.cjs → dynamic-workflows-CpCkqM1g.cjs} +6 -8
  110. package/dist/{dynamic-workflows-HwPX3mcf.cjs.map → dynamic-workflows-CpCkqM1g.cjs.map} +1 -1
  111. package/dist/{dynamic-workflows-CTUO0SFu.js → dynamic-workflows-DDauBnDt.js} +6 -8
  112. package/dist/{dynamic-workflows-CTUO0SFu.js.map → dynamic-workflows-DDauBnDt.js.map} +1 -1
  113. package/dist/{editor-builder-BSBHrTzY.cjs → editor-builder-8li-nXor.cjs} +3 -4
  114. package/dist/{editor-builder-BSBHrTzY.cjs.map → editor-builder-8li-nXor.cjs.map} +1 -1
  115. package/dist/{editor-builder-DCrTMwA4.js → editor-builder-BCZy1ZH1.js} +3 -4
  116. package/dist/{editor-builder-DCrTMwA4.js.map → editor-builder-BCZy1ZH1.js.map} +1 -1
  117. package/dist/{editor-builder-Bibw1X4q.cjs → editor-builder-DFqbiatl.cjs} +7 -9
  118. package/dist/{editor-builder-Bibw1X4q.cjs.map → editor-builder-DFqbiatl.cjs.map} +1 -1
  119. package/dist/{editor-builder-Dq03QZzH.js → editor-builder-qPFmAnZz.js} +7 -9
  120. package/dist/{editor-builder-Dq03QZzH.js.map → editor-builder-qPFmAnZz.js.map} +1 -1
  121. package/dist/{favorites-DWDyKxts.js → favorites-8aieznq3.js} +2 -3
  122. package/dist/{favorites-DWDyKxts.js.map → favorites-8aieznq3.js.map} +1 -1
  123. package/dist/{favorites-D1-AzGsK.cjs → favorites-D0CoxxQn.cjs} +2 -3
  124. package/dist/{favorites-D1-AzGsK.cjs.map → favorites-D0CoxxQn.cjs.map} +1 -1
  125. package/dist/{helpers-CewFtCva.cjs → helpers-CE1fJdLM.cjs} +6 -9
  126. package/dist/{helpers-CewFtCva.cjs.map → helpers-CE1fJdLM.cjs.map} +1 -1
  127. package/dist/{helpers-CxSa9O3X.js → helpers-CMCXsowL.js} +6 -9
  128. package/dist/{helpers-CxSa9O3X.js.map → helpers-CMCXsowL.js.map} +1 -1
  129. package/dist/{http-exception-CKDHupKw.cjs → http-exception-Co3MbFUf.cjs} +2 -3
  130. package/dist/{http-exception-CKDHupKw.cjs.map → http-exception-Co3MbFUf.cjs.map} +1 -1
  131. package/dist/{http-exception-CyfxZB6W.js → http-exception-CzaWkxMl.js} +2 -3
  132. package/dist/{http-exception-CyfxZB6W.js.map → http-exception-CzaWkxMl.js.map} +1 -1
  133. package/dist/index.cjs +2 -3
  134. package/dist/index.js +1 -2
  135. package/dist/{logs-CY8AGOCO.cjs → logs-CC6IycDY.cjs} +3 -4
  136. package/dist/{logs-CY8AGOCO.cjs.map → logs-CC6IycDY.cjs.map} +1 -1
  137. package/dist/{logs-CxfPk-iL.js → logs-DIBh_xCk.js} +7 -8
  138. package/dist/{logs-CxfPk-iL.js.map → logs-DIBh_xCk.js.map} +1 -1
  139. package/dist/{logs-Bd_xpsYw.js → logs-DpyTCDyt.js} +3 -4
  140. package/dist/{logs-Bd_xpsYw.js.map → logs-DpyTCDyt.js.map} +1 -1
  141. package/dist/{logs-CiSw7r0s.cjs → logs-NNur5jkf.cjs} +7 -8
  142. package/dist/{logs-CiSw7r0s.cjs.map → logs-NNur5jkf.cjs.map} +1 -1
  143. package/dist/{mcp-ziWVk7Ol.cjs → mcp-4iUBgZ7s.cjs} +3 -4
  144. package/dist/{mcp-ziWVk7Ol.cjs.map → mcp-4iUBgZ7s.cjs.map} +1 -1
  145. package/dist/{mcp-CWDfSu7w.js → mcp-CnV25lv0.js} +6 -7
  146. package/dist/{mcp-CWDfSu7w.js.map → mcp-CnV25lv0.js.map} +1 -1
  147. package/dist/{mcp-CWGJRqkC.cjs → mcp-DegWUDeB.cjs} +6 -7
  148. package/dist/{mcp-CWGJRqkC.cjs.map → mcp-DegWUDeB.cjs.map} +1 -1
  149. package/dist/{mcp-Drqt0GqD.js → mcp-DgdKiptb.js} +3 -4
  150. package/dist/{mcp-Drqt0GqD.js.map → mcp-DgdKiptb.js.map} +1 -1
  151. package/dist/{mcp-client-versions-DxBkzcYH.js → mcp-client-versions-B471u-DI.js} +3 -4
  152. package/dist/{mcp-client-versions-DxBkzcYH.js.map → mcp-client-versions-B471u-DI.js.map} +1 -1
  153. package/dist/{mcp-client-versions-Cq97zXiK.cjs → mcp-client-versions-HRTe5cRT.cjs} +3 -4
  154. package/dist/{mcp-client-versions-Cq97zXiK.cjs.map → mcp-client-versions-HRTe5cRT.cjs.map} +1 -1
  155. package/dist/{memory-CizEIbl1.cjs → memory-BnPGDrdg.cjs} +4 -5
  156. package/dist/{memory-CizEIbl1.cjs.map → memory-BnPGDrdg.cjs.map} +1 -1
  157. package/dist/{memory-B58Q2LgU.js → memory-CZ2ELVP0.js} +4 -5
  158. package/dist/{memory-B58Q2LgU.js.map → memory-CZ2ELVP0.js.map} +1 -1
  159. package/dist/{memory-BHtTSzvJ.js → memory-DeZ1je-b.js} +10 -12
  160. package/dist/memory-DeZ1je-b.js.map +1 -0
  161. package/dist/{memory-CwwkVDh1.cjs → memory-Pj9P9vsl.cjs} +10 -12
  162. package/dist/memory-Pj9P9vsl.cjs.map +1 -0
  163. package/dist/{message-history-_kbQlA4r.js → message-history-BBVH-ORZ.js} +2 -3
  164. package/dist/{message-history-_kbQlA4r.js.map → message-history-BBVH-ORZ.js.map} +1 -1
  165. package/dist/{message-history-CkUYxSaS.cjs → message-history-CtELj716.cjs} +2 -3
  166. package/dist/{message-history-CkUYxSaS.cjs.map → message-history-CtELj716.cjs.map} +1 -1
  167. package/dist/{observability-Dz9jvMJ3.js → observability-65rZOqJk.js} +6 -7
  168. package/dist/{observability-Dz9jvMJ3.js.map → observability-65rZOqJk.js.map} +1 -1
  169. package/dist/{observability-C2BZQ2jU.cjs → observability-CFKSxaff.cjs} +6 -7
  170. package/dist/{observability-C2BZQ2jU.cjs.map → observability-CFKSxaff.cjs.map} +1 -1
  171. package/dist/{observability-new-endpoints-3DlTYf34.js → observability-new-endpoints-B6MRJ5Rb.js} +8 -11
  172. package/dist/observability-new-endpoints-B6MRJ5Rb.js.map +1 -0
  173. package/dist/{observability-new-endpoints-Drr7q2Dj.cjs → observability-new-endpoints-CDeHfFNP.cjs} +9 -12
  174. package/dist/observability-new-endpoints-CDeHfFNP.cjs.map +1 -0
  175. package/dist/{plans-DZAJG1Et.cjs → plans-Dtt4D4-Y.cjs} +8 -9
  176. package/dist/{plans-DZAJG1Et.cjs.map → plans-Dtt4D4-Y.cjs.map} +1 -1
  177. package/dist/{plans-CKbStbWl.js → plans-YK-iaKqj.js} +8 -9
  178. package/dist/{plans-CKbStbWl.js.map → plans-YK-iaKqj.js.map} +1 -1
  179. package/dist/{probe-image-size-l1uuhbob.cjs → probe-image-size-C0psF6WM.cjs} +69 -120
  180. package/dist/probe-image-size-C0psF6WM.cjs.map +1 -0
  181. package/dist/{probe-image-size-DBmo2MAe.js → probe-image-size-CpV7slsd.js} +69 -120
  182. package/dist/probe-image-size-CpV7slsd.js.map +1 -0
  183. package/dist/{processor-providers-DHvTA9AL.cjs → processor-providers-CRrcV9ra.cjs} +2 -3
  184. package/dist/{processor-providers-DHvTA9AL.cjs.map → processor-providers-CRrcV9ra.cjs.map} +1 -1
  185. package/dist/{processor-providers-DBhZC6-4.js → processor-providers-WHdDe4aA.js} +2 -3
  186. package/dist/{processor-providers-DBhZC6-4.js.map → processor-providers-WHdDe4aA.js.map} +1 -1
  187. package/dist/{processors-80HWq8nr.cjs → processors-BEut-2a-.cjs} +2 -3
  188. package/dist/{processors-80HWq8nr.cjs.map → processors-BEut-2a-.cjs.map} +1 -1
  189. package/dist/{processors-33IULT8X.js → processors-IhyRC0xH.js} +2 -3
  190. package/dist/{processors-33IULT8X.js.map → processors-IhyRC0xH.js.map} +1 -1
  191. package/dist/{prompt-block-versions-Cl3Lh4H-.cjs → prompt-block-versions-BUPyaY8g.cjs} +4 -5
  192. package/dist/{prompt-block-versions-Cl3Lh4H-.cjs.map → prompt-block-versions-BUPyaY8g.cjs.map} +1 -1
  193. package/dist/{prompt-block-versions-cfq_e1Zi.js → prompt-block-versions-D1gjBkQx.js} +4 -5
  194. package/dist/{prompt-block-versions-cfq_e1Zi.js.map → prompt-block-versions-D1gjBkQx.js.map} +1 -1
  195. package/dist/{responses-CfcIc53b.cjs → responses-CTiwnWeF.cjs} +3 -4
  196. package/dist/{responses-CfcIc53b.cjs.map → responses-CTiwnWeF.cjs.map} +1 -1
  197. package/dist/{responses-jiVC-1lx.js → responses-CaixIxi0.js} +8 -9
  198. package/dist/{responses-jiVC-1lx.js.map → responses-CaixIxi0.js.map} +1 -1
  199. package/dist/{responses-DJNJgCTg.js → responses-D-fsDRLd.js} +2 -3
  200. package/dist/{responses-DJNJgCTg.js.map → responses-D-fsDRLd.js.map} +1 -1
  201. package/dist/{responses-BubMB79l.cjs → responses-Did1x3VK.cjs} +8 -9
  202. package/dist/{responses-BubMB79l.cjs.map → responses-Did1x3VK.cjs.map} +1 -1
  203. package/dist/{rolldown-runtime-BwC_XMyb.cjs → rolldown-runtime-10nMEhjP.cjs} +1 -2
  204. package/dist/{rolldown-runtime-D3Hj5m0v.js → rolldown-runtime-CQI-hT2b.js} +1 -2
  205. package/dist/{route-builder-CjkWxv4E.js → route-builder-BxPrwNog.js} +6 -10
  206. package/dist/route-builder-BxPrwNog.js.map +1 -0
  207. package/dist/{route-builder-B2Qhhd7C.cjs → route-builder-CvARmqnA.cjs} +8 -12
  208. package/dist/route-builder-CvARmqnA.cjs.map +1 -0
  209. package/dist/{routes-DKV9oxFW.js → routes-C434Lhz9.js} +59 -92
  210. package/dist/{routes-DKV9oxFW.js.map → routes-C434Lhz9.js.map} +1 -1
  211. package/dist/{routes-jXksmX9G.cjs → routes-CtGp_lBn.cjs} +4 -7
  212. package/dist/routes-CtGp_lBn.cjs.map +1 -0
  213. package/dist/{routes-CKfXiwRc.js → routes-MRZFTKei.js} +4 -7
  214. package/dist/routes-MRZFTKei.js.map +1 -0
  215. package/dist/{routes-D6bDACPd.cjs → routes-rU9Sku0f.cjs} +59 -92
  216. package/dist/{routes-D6bDACPd.cjs.map → routes-rU9Sku0f.cjs.map} +1 -1
  217. package/dist/{rule-group-C5eydl98.js → rule-group-4pWeG61q.js} +2 -3
  218. package/dist/{rule-group-C5eydl98.js.map → rule-group-4pWeG61q.js.map} +1 -1
  219. package/dist/{rule-group-Hyn4rN52.cjs → rule-group-CIacr-Zz.cjs} +2 -3
  220. package/dist/{rule-group-Hyn4rN52.cjs.map → rule-group-CIacr-Zz.cjs.map} +1 -1
  221. package/dist/{schedules-GokZKBYg.cjs → schedules-CL4IU7kS.cjs} +6 -8
  222. package/dist/{schedules-GokZKBYg.cjs.map → schedules-CL4IU7kS.cjs.map} +1 -1
  223. package/dist/{schedules-_3zPKyqm.js → schedules-CQPodXrR.js} +6 -8
  224. package/dist/{schedules-_3zPKyqm.js.map → schedules-CQPodXrR.js.map} +1 -1
  225. package/dist/{schema-CzbEIyhE-BsMcj9Ws.js → schema-Bf12g7KC-DBc4NSds.js} +104 -35
  226. package/dist/schema-Bf12g7KC-DBc4NSds.js.map +1 -0
  227. package/dist/{schema-CzbEIyhE-20gGIWkz.cjs → schema-Bf12g7KC-plP4Ir6h.cjs} +105 -36
  228. package/dist/schema-Bf12g7KC-plP4Ir6h.cjs.map +1 -0
  229. package/dist/{scorer-versions-CX8RM9a6.js → scorer-versions-DIqKt2kn.js} +4 -5
  230. package/dist/{scorer-versions-CX8RM9a6.js.map → scorer-versions-DIqKt2kn.js.map} +1 -1
  231. package/dist/{scorer-versions-DeCS12ym.cjs → scorer-versions-r7C61gWf.cjs} +4 -5
  232. package/dist/{scorer-versions-DeCS12ym.cjs.map → scorer-versions-r7C61gWf.cjs.map} +1 -1
  233. package/dist/{scores-CetVKM4g.cjs → scores-Bu70OP1U.cjs} +3 -4
  234. package/dist/{scores-CetVKM4g.cjs.map → scores-Bu70OP1U.cjs.map} +1 -1
  235. package/dist/{scores-BWTo-_L5.js → scores-DHnw31S7.js} +8 -9
  236. package/dist/{scores-BWTo-_L5.js.map → scores-DHnw31S7.js.map} +1 -1
  237. package/dist/{scores-BbqFfKcy.js → scores-DZ1hftoG.js} +3 -4
  238. package/dist/{scores-BbqFfKcy.js.map → scores-DZ1hftoG.js.map} +1 -1
  239. package/dist/{scores-C8XPZcwt.cjs → scores-K78lAAwd.cjs} +8 -9
  240. package/dist/{scores-C8XPZcwt.cjs.map → scores-K78lAAwd.cjs.map} +1 -1
  241. package/dist/server/a2a/store.cjs +2 -3
  242. package/dist/server/a2a/store.js +1 -2
  243. package/dist/server/auth/index.cjs +3 -3
  244. package/dist/server/auth/index.js +2 -2
  245. package/dist/server/browser-stream/index.cjs +3 -5
  246. package/dist/server/browser-stream/index.cjs.map +1 -1
  247. package/dist/server/browser-stream/index.js +2 -4
  248. package/dist/server/browser-stream/index.js.map +1 -1
  249. package/dist/server/handlers/a2a.cjs +2 -2
  250. package/dist/server/handlers/a2a.js +1 -1
  251. package/dist/server/handlers/agent-builder.cjs +2 -2
  252. package/dist/server/handlers/agent-builder.js +1 -1
  253. package/dist/server/handlers/agent-controller.cjs +20 -18
  254. package/dist/server/handlers/agent-controller.cjs.map +1 -1
  255. package/dist/server/handlers/agent-controller.d.ts +2 -0
  256. package/dist/server/handlers/agent-controller.d.ts.map +1 -1
  257. package/dist/server/handlers/agent-controller.js +19 -17
  258. package/dist/server/handlers/agent-controller.js.map +1 -1
  259. package/dist/server/handlers/agent-versions.cjs +7 -8
  260. package/dist/server/handlers/agent-versions.js +6 -7
  261. package/dist/server/handlers/agents.cjs +2 -2
  262. package/dist/server/handlers/agents.d.ts.map +1 -1
  263. package/dist/server/handlers/agents.js +1 -1
  264. package/dist/server/handlers/auth.cjs +7 -8
  265. package/dist/server/handlers/auth.js +6 -7
  266. package/dist/server/handlers/author-enrichment.cjs +2 -3
  267. package/dist/server/handlers/author-enrichment.js +1 -2
  268. package/dist/server/handlers/authorship.cjs +4 -5
  269. package/dist/server/handlers/authorship.js +3 -4
  270. package/dist/server/handlers/background-tasks.cjs +2 -2
  271. package/dist/server/handlers/background-tasks.js +1 -1
  272. package/dist/server/handlers/builder-registry.cjs +2 -2
  273. package/dist/server/handlers/builder-registry.js +1 -1
  274. package/dist/server/handlers/channels.cjs +2 -2
  275. package/dist/server/handlers/channels.js +1 -1
  276. package/dist/server/handlers/conversations.cjs +2 -2
  277. package/dist/server/handlers/conversations.js +1 -1
  278. package/dist/server/handlers/datasets.cjs +7 -8
  279. package/dist/server/handlers/datasets.js +6 -7
  280. package/dist/server/handlers/dynamic-workflows.cjs +2 -2
  281. package/dist/server/handlers/dynamic-workflows.js +1 -1
  282. package/dist/server/handlers/editor-builder.cjs +2 -2
  283. package/dist/server/handlers/editor-builder.js +1 -1
  284. package/dist/server/handlers/error.cjs +3 -4
  285. package/dist/server/handlers/error.js +2 -3
  286. package/dist/server/handlers/favorites-enrichment.cjs +3 -4
  287. package/dist/server/handlers/favorites-enrichment.js +2 -3
  288. package/dist/server/handlers/gateway-memory-client.cjs +2 -3
  289. package/dist/server/handlers/gateway-memory-client.js +1 -2
  290. package/dist/server/handlers/logs.cjs +2 -2
  291. package/dist/server/handlers/logs.js +1 -1
  292. package/dist/server/handlers/mcp-client-versions.cjs +6 -7
  293. package/dist/server/handlers/mcp-client-versions.js +5 -6
  294. package/dist/server/handlers/mcp.cjs +2 -2
  295. package/dist/server/handlers/mcp.js +1 -1
  296. package/dist/server/handlers/memory.cjs +2 -2
  297. package/dist/server/handlers/memory.d.ts.map +1 -1
  298. package/dist/server/handlers/memory.js +1 -1
  299. package/dist/server/handlers/observability-list-query-schemas.cjs +2 -3
  300. package/dist/server/handlers/observability-list-query-schemas.js +1 -2
  301. package/dist/server/handlers/observability-new-endpoints.cjs +2 -2
  302. package/dist/server/handlers/observability-new-endpoints.d.ts +2 -10
  303. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  304. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  305. package/dist/server/handlers/observability-shared.cjs +4 -5
  306. package/dist/server/handlers/observability-shared.js +3 -4
  307. package/dist/server/handlers/observability-storage-schemas.cjs +2 -3
  308. package/dist/server/handlers/observability-storage-schemas.js +1 -2
  309. package/dist/server/handlers/observability.cjs +3 -3
  310. package/dist/server/handlers/observability.js +2 -2
  311. package/dist/server/handlers/plans.cjs +2 -2
  312. package/dist/server/handlers/plans.js +1 -1
  313. package/dist/server/handlers/processor-providers.cjs +5 -6
  314. package/dist/server/handlers/processor-providers.js +4 -5
  315. package/dist/server/handlers/processors.cjs +5 -6
  316. package/dist/server/handlers/processors.js +4 -5
  317. package/dist/server/handlers/prompt-block-versions.cjs +6 -7
  318. package/dist/server/handlers/prompt-block-versions.js +5 -6
  319. package/dist/server/handlers/responses.adapter.cjs +2 -3
  320. package/dist/server/handlers/responses.adapter.js +1 -2
  321. package/dist/server/handlers/responses.cjs +2 -2
  322. package/dist/server/handlers/responses.js +1 -1
  323. package/dist/server/handlers/responses.storage.cjs +4 -5
  324. package/dist/server/handlers/responses.storage.js +3 -4
  325. package/dist/server/handlers/schedules-workflows-shim.cjs +2 -3
  326. package/dist/server/handlers/schedules-workflows-shim.js +1 -2
  327. package/dist/server/handlers/schedules.cjs +2 -2
  328. package/dist/server/handlers/schedules.js +1 -1
  329. package/dist/server/handlers/scorer-versions.cjs +6 -7
  330. package/dist/server/handlers/scorer-versions.js +5 -6
  331. package/dist/server/handlers/scores.cjs +2 -2
  332. package/dist/server/handlers/scores.js +1 -1
  333. package/dist/server/handlers/skills-sh-shared.cjs +3 -4
  334. package/dist/server/handlers/skills-sh-shared.js +2 -3
  335. package/dist/server/handlers/stored-agent-favorites.cjs +8 -9
  336. package/dist/server/handlers/stored-agent-favorites.js +7 -8
  337. package/dist/server/handlers/stored-agents.cjs +8 -9
  338. package/dist/server/handlers/stored-agents.js +7 -8
  339. package/dist/server/handlers/stored-mcp-clients.cjs +7 -8
  340. package/dist/server/handlers/stored-mcp-clients.js +6 -7
  341. package/dist/server/handlers/stored-prompt-blocks.cjs +7 -8
  342. package/dist/server/handlers/stored-prompt-blocks.js +6 -7
  343. package/dist/server/handlers/stored-scorers.cjs +7 -8
  344. package/dist/server/handlers/stored-scorers.js +6 -7
  345. package/dist/server/handlers/stored-skill-favorites.cjs +8 -9
  346. package/dist/server/handlers/stored-skill-favorites.js +7 -8
  347. package/dist/server/handlers/stored-skills.cjs +7 -8
  348. package/dist/server/handlers/stored-skills.js +6 -7
  349. package/dist/server/handlers/stored-workspaces.cjs +6 -7
  350. package/dist/server/handlers/stored-workspaces.js +5 -6
  351. package/dist/server/handlers/system.cjs +5 -6
  352. package/dist/server/handlers/system.js +4 -5
  353. package/dist/server/handlers/test-utils.cjs +2 -3
  354. package/dist/server/handlers/test-utils.js +1 -2
  355. package/dist/server/handlers/tool-providers.cjs +6 -7
  356. package/dist/server/handlers/tool-providers.js +5 -6
  357. package/dist/server/handlers/tool-schema-overrides.cjs +2 -3
  358. package/dist/server/handlers/tool-schema-overrides.js +1 -2
  359. package/dist/server/handlers/tools.cjs +2 -2
  360. package/dist/server/handlers/tools.js +1 -1
  361. package/dist/server/handlers/utils.cjs +3 -2
  362. package/dist/server/handlers/utils.d.ts +17 -2
  363. package/dist/server/handlers/utils.d.ts.map +1 -1
  364. package/dist/server/handlers/utils.js +1 -1
  365. package/dist/server/handlers/validate-agent-instructions.cjs +4 -5
  366. package/dist/server/handlers/validate-agent-instructions.js +3 -4
  367. package/dist/server/handlers/validate-avatar.cjs +3 -4
  368. package/dist/server/handlers/validate-avatar.js +2 -3
  369. package/dist/server/handlers/vector.cjs +2 -2
  370. package/dist/server/handlers/vector.js +1 -1
  371. package/dist/server/handlers/version-helpers.cjs +2 -3
  372. package/dist/server/handlers/version-helpers.js +1 -2
  373. package/dist/server/handlers/voice.cjs +2 -2
  374. package/dist/server/handlers/voice.js +1 -1
  375. package/dist/server/handlers/workflow-builder.cjs +2 -2
  376. package/dist/server/handlers/workflow-builder.js +1 -1
  377. package/dist/server/handlers/workflows.cjs +2 -2
  378. package/dist/server/handlers/workflows.d.ts.map +1 -1
  379. package/dist/server/handlers/workflows.js +1 -1
  380. package/dist/server/handlers/workspace.cjs +2 -2
  381. package/dist/server/handlers/workspace.js +1 -1
  382. package/dist/server/handlers.cjs +18 -18
  383. package/dist/server/handlers.js +17 -17
  384. package/dist/server/schemas/index.cjs +35 -35
  385. package/dist/server/schemas/index.js +34 -34
  386. package/dist/server/server-adapter/index.cjs +14 -21
  387. package/dist/server/server-adapter/index.cjs.map +1 -1
  388. package/dist/server/server-adapter/index.js +13 -20
  389. package/dist/server/server-adapter/index.js.map +1 -1
  390. package/dist/server/server-adapter/routes/observability.d.ts +1 -5
  391. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  392. package/dist/{stored-agents-BtaEzKfr.js → stored-agents-BpxMmhtz.js} +9 -11
  393. package/dist/{stored-agents-BtaEzKfr.js.map → stored-agents-BpxMmhtz.js.map} +1 -1
  394. package/dist/{stored-agents-BTL-o6aM.cjs → stored-agents-CDlh3CQQ.cjs} +9 -11
  395. package/dist/{stored-agents-BTL-o6aM.cjs.map → stored-agents-CDlh3CQQ.cjs.map} +1 -1
  396. package/dist/{stored-mcp-clients-D7bNkmTM.cjs → stored-mcp-clients-BA7OSGZ_.cjs} +3 -4
  397. package/dist/{stored-mcp-clients-D7bNkmTM.cjs.map → stored-mcp-clients-BA7OSGZ_.cjs.map} +1 -1
  398. package/dist/{stored-mcp-clients-DMR6NvCp.js → stored-mcp-clients-DtLv0Tly.js} +3 -4
  399. package/dist/{stored-mcp-clients-DMR6NvCp.js.map → stored-mcp-clients-DtLv0Tly.js.map} +1 -1
  400. package/dist/{stored-prompt-blocks-BjHxMCuC.cjs → stored-prompt-blocks-Cqi0vnTE.cjs} +4 -5
  401. package/dist/{stored-prompt-blocks-BjHxMCuC.cjs.map → stored-prompt-blocks-Cqi0vnTE.cjs.map} +1 -1
  402. package/dist/{stored-prompt-blocks-C7qmiWSB.js → stored-prompt-blocks-Z_BuhsUq.js} +4 -5
  403. package/dist/{stored-prompt-blocks-C7qmiWSB.js.map → stored-prompt-blocks-Z_BuhsUq.js.map} +1 -1
  404. package/dist/{stored-scorers-BSxh7JZX.js → stored-scorers-BdJadnUS.js} +4 -5
  405. package/dist/{stored-scorers-BSxh7JZX.js.map → stored-scorers-BdJadnUS.js.map} +1 -1
  406. package/dist/{stored-scorers-I8L1-bAI.cjs → stored-scorers-D1zYUEXg.cjs} +4 -5
  407. package/dist/{stored-scorers-I8L1-bAI.cjs.map → stored-scorers-D1zYUEXg.cjs.map} +1 -1
  408. package/dist/{stored-skills-DzW8hLnI.js → stored-skills-D8Q1NmsH.js} +3 -4
  409. package/dist/{stored-skills-DzW8hLnI.js.map → stored-skills-D8Q1NmsH.js.map} +1 -1
  410. package/dist/{stored-skills-C1e8kf2k.cjs → stored-skills-DppdzQY0.cjs} +3 -4
  411. package/dist/{stored-skills-C1e8kf2k.cjs.map → stored-skills-DppdzQY0.cjs.map} +1 -1
  412. package/dist/{stored-workspaces-DSfChCJ0.cjs → stored-workspaces-BOwJwkec.cjs} +3 -4
  413. package/dist/{stored-workspaces-DSfChCJ0.cjs.map → stored-workspaces-BOwJwkec.cjs.map} +1 -1
  414. package/dist/{stored-workspaces-AkC68rSw.js → stored-workspaces-CYXLBJy5.js} +3 -4
  415. package/dist/{stored-workspaces-AkC68rSw.js.map → stored-workspaces-CYXLBJy5.js.map} +1 -1
  416. package/dist/{system-sSSmmt7I.js → system-B8L_G4oo.js} +2 -3
  417. package/dist/{system-sSSmmt7I.js.map → system-B8L_G4oo.js.map} +1 -1
  418. package/dist/{system-B_Sod-Le.cjs → system-DGfJlOxK.cjs} +2 -3
  419. package/dist/{system-B_Sod-Le.cjs.map → system-DGfJlOxK.cjs.map} +1 -1
  420. package/dist/{tool-providers-DFQkhO4R.cjs → tool-providers-BVwRJTtB.cjs} +2 -3
  421. package/dist/{tool-providers-DFQkhO4R.cjs.map → tool-providers-BVwRJTtB.cjs.map} +1 -1
  422. package/dist/{tool-providers-CIESXi7M.js → tool-providers-Cq3vFqgE.js} +2 -3
  423. package/dist/{tool-providers-CIESXi7M.js.map → tool-providers-Cq3vFqgE.js.map} +1 -1
  424. package/dist/{tools-Ci71xxGP.cjs → tools-CeVJwkPP.cjs} +13 -14
  425. package/dist/tools-CeVJwkPP.cjs.map +1 -0
  426. package/dist/{tools--oMljfqq.js → tools-hd_ZCJkE.js} +12 -13
  427. package/dist/tools-hd_ZCJkE.js.map +1 -0
  428. package/dist/{utils-dDLIDg8O.cjs → utils-BbYUI6Yn.cjs} +37 -14
  429. package/dist/utils-BbYUI6Yn.cjs.map +1 -0
  430. package/dist/{utils-CF76qzZR.cjs → utils-BnH77wPf.cjs} +107 -81
  431. package/dist/utils-BnH77wPf.cjs.map +1 -0
  432. package/dist/{utils-BBJlS81s.js → utils-DHxjw4Tn.js} +31 -14
  433. package/dist/utils-DHxjw4Tn.js.map +1 -0
  434. package/dist/{utils-aoLN3Wfi.js → utils-YEuwVEc2.js} +104 -78
  435. package/dist/utils-YEuwVEc2.js.map +1 -0
  436. package/dist/{vector-TWv4t-4g.js → vector-Deod39jt.js} +6 -7
  437. package/dist/{vector-TWv4t-4g.js.map → vector-Deod39jt.js.map} +1 -1
  438. package/dist/{vector-BKDD1kwc.cjs → vector-IxK1t4Cb.cjs} +6 -7
  439. package/dist/{vector-BKDD1kwc.cjs.map → vector-IxK1t4Cb.cjs.map} +1 -1
  440. package/dist/{vectors-LFI1jch0.cjs → vectors-CqV387sY.cjs} +3 -4
  441. package/dist/{vectors-LFI1jch0.cjs.map → vectors-CqV387sY.cjs.map} +1 -1
  442. package/dist/{vectors-CJtupgIF.js → vectors-CvHLWqjC.js} +3 -4
  443. package/dist/{vectors-CJtupgIF.js.map → vectors-CvHLWqjC.js.map} +1 -1
  444. package/dist/{version-common-DrzXq7Ct.cjs → version-common-B2n_ML_w.cjs} +3 -4
  445. package/dist/{version-common-DrzXq7Ct.cjs.map → version-common-B2n_ML_w.cjs.map} +1 -1
  446. package/dist/{version-common-4xFzvCS5.js → version-common-Di2U8VWH.js} +3 -4
  447. package/dist/{version-common-4xFzvCS5.js.map → version-common-Di2U8VWH.js.map} +1 -1
  448. package/dist/{voice-BnGwlZ75.cjs → voice-CBbxcsCM.cjs} +4 -5
  449. package/dist/{voice-BnGwlZ75.cjs.map → voice-CBbxcsCM.cjs.map} +1 -1
  450. package/dist/{voice-DjG8tBAD.js → voice-CzFWhWPJ.js} +4 -5
  451. package/dist/{voice-DjG8tBAD.js.map → voice-CzFWhWPJ.js.map} +1 -1
  452. package/dist/{workflow-builder-Dguv4rc0.cjs → workflow-builder-B33pXjdu.cjs} +8 -10
  453. package/dist/{workflow-builder-Dguv4rc0.cjs.map → workflow-builder-B33pXjdu.cjs.map} +1 -1
  454. package/dist/{workflow-builder-BoI-XXsT.js → workflow-builder-D4Po74yJ.js} +8 -10
  455. package/dist/{workflow-builder-BoI-XXsT.js.map → workflow-builder-D4Po74yJ.js.map} +1 -1
  456. package/dist/{workflows-Dcx4Ib0t.js → workflows-C9BMJV_C.js} +3 -4
  457. package/dist/{workflows-Dcx4Ib0t.js.map → workflows-C9BMJV_C.js.map} +1 -1
  458. package/dist/{workflows-5AytZqK_.cjs → workflows-CiP6r_nw.cjs} +35 -36
  459. package/dist/workflows-CiP6r_nw.cjs.map +1 -0
  460. package/dist/{workflows-C8rDpHyY.cjs → workflows-SYBpQupF.cjs} +3 -4
  461. package/dist/{workflows-C8rDpHyY.cjs.map → workflows-SYBpQupF.cjs.map} +1 -1
  462. package/dist/{workflows-D7Oq5On9.js → workflows-tk1Ixg8M.js} +35 -36
  463. package/dist/workflows-tk1Ixg8M.js.map +1 -0
  464. package/dist/{workspace-BVHXoKmP.js → workspace-C9dE6D1U.js} +6 -7
  465. package/dist/{workspace-BVHXoKmP.js.map → workspace-C9dE6D1U.js.map} +1 -1
  466. package/dist/{workspace-d25MZ9dj.cjs → workspace-CyH_iu8w.cjs} +6 -7
  467. package/dist/{workspace-d25MZ9dj.cjs.map → workspace-CyH_iu8w.cjs.map} +1 -1
  468. package/dist/{workspace-BJYV2lkt.cjs → workspace-KeHGZvNV.cjs} +2 -3
  469. package/dist/{workspace-BJYV2lkt.cjs.map → workspace-KeHGZvNV.cjs.map} +1 -1
  470. package/dist/{workspace-4dBGFdV2.js → workspace-muaSMxVS.js} +2 -3
  471. package/dist/{workspace-4dBGFdV2.js.map → workspace-muaSMxVS.js.map} +1 -1
  472. package/package.json +10 -10
  473. package/dist/agents-AyHEkc2F.cjs.map +0 -1
  474. package/dist/agents-BYE5Dmfk.js.map +0 -1
  475. package/dist/dist-5TAg2f91.js.map +0 -1
  476. package/dist/dist-C9Jwt1f0.cjs +0 -3
  477. package/dist/dist-CukR8zi9.cjs.map +0 -1
  478. package/dist/dist-Dgae8Imb.js +0 -1
  479. package/dist/memory-BHtTSzvJ.js.map +0 -1
  480. package/dist/memory-CwwkVDh1.cjs.map +0 -1
  481. package/dist/observability-new-endpoints-3DlTYf34.js.map +0 -1
  482. package/dist/observability-new-endpoints-Drr7q2Dj.cjs.map +0 -1
  483. package/dist/probe-image-size-DBmo2MAe.js.map +0 -1
  484. package/dist/probe-image-size-l1uuhbob.cjs.map +0 -1
  485. package/dist/route-builder-B2Qhhd7C.cjs.map +0 -1
  486. package/dist/route-builder-CjkWxv4E.js.map +0 -1
  487. package/dist/routes-CKfXiwRc.js.map +0 -1
  488. package/dist/routes-jXksmX9G.cjs.map +0 -1
  489. package/dist/schema-CzbEIyhE-20gGIWkz.cjs.map +0 -1
  490. package/dist/schema-CzbEIyhE-BsMcj9Ws.js.map +0 -1
  491. package/dist/tools--oMljfqq.js.map +0 -1
  492. package/dist/tools-Ci71xxGP.cjs.map +0 -1
  493. package/dist/utils-BBJlS81s.js.map +0 -1
  494. package/dist/utils-CF76qzZR.cjs.map +0 -1
  495. package/dist/utils-aoLN3Wfi.js.map +0 -1
  496. package/dist/utils-dDLIDg8O.cjs.map +0 -1
  497. package/dist/workflows-5AytZqK_.cjs.map +0 -1
  498. package/dist/workflows-D7Oq5On9.js.map +0 -1
@@ -1,7 +1,7 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-BwC_XMyb.cjs");
2
- const require_schema_CzbEIyhE = require("./schema-CzbEIyhE-20gGIWkz.cjs");
3
- require("./utils-CF76qzZR.cjs");
4
- const require_dist = require("./dist-CeTLA-e5.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-10nMEhjP.cjs");
2
+ const require_schema_Bf12g7KC = require("./schema-Bf12g7KC-plP4Ir6h.cjs");
3
+ require("./utils-BnH77wPf.cjs");
4
+ const require_dist = require("./dist-BZGewCGq.cjs");
5
5
  let zod_v4 = require("zod/v4");
6
6
  zod_v4 = require_rolldown_runtime.__toESM(zod_v4, 1);
7
7
  let _mastra_core_schema = require("@mastra/core/schema");
@@ -30,7 +30,7 @@ let diagnostics_channel = require("diagnostics_channel");
30
30
  let async_hooks = require("async_hooks");
31
31
  let child_process = require("child_process");
32
32
  let fs_promises = require("fs/promises");
33
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ms/2.0.0/a65cc302695e9dde36bdbab59e67a07f313b77a4e7b89957a7bf17f930a58070/node_modules/ms/index.js
33
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ms/2.0.0/a65cc302695e9dde36bdbab59e67a07f313b77a4e7b89957a7bf17f930a58070/node_modules/ms/index.js
34
34
  var require_ms = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
35
35
  /**
36
36
  * Helpers.
@@ -138,8 +138,7 @@ var require_ms = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((export
138
138
  return Math.ceil(ms / n) + " " + name + "s";
139
139
  }
140
140
  }));
141
- //#endregion
142
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/debug.js
141
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/debug.js
143
142
  var require_debug = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
144
143
  /**
145
144
  * This is the common logic for both the Node.js and web browser
@@ -278,8 +277,7 @@ var require_debug = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exp
278
277
  return val;
279
278
  }
280
279
  }));
281
- //#endregion
282
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/browser.js
280
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/browser.js
283
281
  var require_browser = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
284
282
  /**
285
283
  * This is the web browser implementation of `debug()`.
@@ -400,8 +398,7 @@ var require_browser = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((e
400
398
  } catch (e) {}
401
399
  }
402
400
  }));
403
- //#endregion
404
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/node.js
401
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/node.js
405
402
  var require_node = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
406
403
  /**
407
404
  * Module dependencies.
@@ -572,8 +569,7 @@ var require_node = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expo
572
569
  */
573
570
  exports.enable(load());
574
571
  }));
575
- //#endregion
576
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/index.js
572
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/index.js
577
573
  var require_src = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
578
574
  /**
579
575
  * Detect Electron renderer process, which is node, but we should
@@ -582,8 +578,7 @@ var require_src = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expor
582
578
  if (typeof process !== "undefined" && process.type === "renderer") module.exports = require_browser();
583
579
  else module.exports = require_node();
584
580
  }));
585
- //#endregion
586
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/stream-parser/0.3.1/05001837beb9bed7e5025720d2f11fc3082c627fc85fbc1354f5c8b6191938d4/node_modules/stream-parser/index.js
581
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/stream-parser/0.3.1/05001837beb9bed7e5025720d2f11fc3082c627fc85fbc1354f5c8b6191938d4/node_modules/stream-parser/index.js
587
582
  var require_stream_parser = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
588
583
  /**
589
584
  * Module dependencies.
@@ -784,8 +779,7 @@ var require_stream_parser = /* @__PURE__ */ require_rolldown_runtime.__commonJSM
784
779
  };
785
780
  }
786
781
  }));
787
- //#endregion
788
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/common/read_le_be.js
782
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/common/read_le_be.js
789
783
  var require_read_le_be = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
790
784
  exports.readUInt16LE = function(data, offset) {
791
785
  return data[offset] | data[offset + 1] << 8;
@@ -812,8 +806,7 @@ var require_read_le_be = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(
812
806
  return exports.readUInt32BE(data, offset) | 0;
813
807
  };
814
808
  }));
815
- //#endregion
816
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/common/index.js
809
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/common/index.js
817
810
  var require_common = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
818
811
  var Transform = require("stream").Transform;
819
812
  var streamParser = require_stream_parser();
@@ -860,8 +853,7 @@ var require_common = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
860
853
  exports.readInt32LE = readLeBe.readInt32LE;
861
854
  exports.readInt32BE = readLeBe.readInt32BE;
862
855
  }));
863
- //#endregion
864
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/miaf_utils.js
856
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/miaf_utils.js
865
857
  var require_miaf_utils = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
866
858
  var readUInt16BE = require_common().readUInt16BE;
867
859
  var readUInt32BE = require_common().readUInt32BE;
@@ -1070,8 +1062,7 @@ var require_miaf_utils = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(
1070
1062
  };
1071
1063
  };
1072
1064
  }));
1073
- //#endregion
1074
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/exif_utils.js
1065
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/exif_utils.js
1075
1066
  var require_exif_utils = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1076
1067
  function error(message, code) {
1077
1068
  var err = new Error(message);
@@ -1238,8 +1229,7 @@ var require_exif_utils = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(
1238
1229
  }
1239
1230
  };
1240
1231
  }));
1241
- //#endregion
1242
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/common/svg_header.js
1232
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/common/svg_header.js
1243
1233
  var require_svg_header = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
1244
1234
  exports.MAX_DATA_LENGTH = 10240;
1245
1235
  var attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*";
@@ -1323,8 +1313,7 @@ var require_svg_header = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(
1323
1313
  };
1324
1314
  };
1325
1315
  }));
1326
- //#endregion
1327
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/avif.js
1316
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/avif.js
1328
1317
  var require_avif = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1329
1318
  var str2arr = require_common().str2arr;
1330
1319
  var sliceEq = require_common().sliceEq;
@@ -1372,8 +1361,7 @@ var require_avif = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expo
1372
1361
  return result;
1373
1362
  };
1374
1363
  }));
1375
- //#endregion
1376
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/bmp.js
1364
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/bmp.js
1377
1365
  var require_bmp = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1378
1366
  var str2arr = require_common().str2arr;
1379
1367
  var sliceEq = require_common().sliceEq;
@@ -1404,8 +1392,7 @@ var require_bmp = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expor
1404
1392
  };
1405
1393
  };
1406
1394
  }));
1407
- //#endregion
1408
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/gif.js
1395
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/gif.js
1409
1396
  var require_gif = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1410
1397
  var str2arr = require_common().str2arr;
1411
1398
  var sliceEq = require_common().sliceEq;
@@ -1425,8 +1412,7 @@ var require_gif = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expor
1425
1412
  };
1426
1413
  };
1427
1414
  }));
1428
- //#endregion
1429
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/ico.js
1415
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/ico.js
1430
1416
  var require_ico = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1431
1417
  var readUInt16LE = require_common().readUInt16LE;
1432
1418
  var HEADER = 0;
@@ -1464,8 +1450,7 @@ var require_ico = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expor
1464
1450
  };
1465
1451
  };
1466
1452
  }));
1467
- //#endregion
1468
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/jpeg.js
1453
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/jpeg.js
1469
1454
  var require_jpeg = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1470
1455
  var readUInt16BE = require_common().readUInt16BE;
1471
1456
  var str2arr = require_common().str2arr;
@@ -1510,8 +1495,7 @@ var require_jpeg = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expo
1510
1495
  }
1511
1496
  };
1512
1497
  }));
1513
- //#endregion
1514
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/png.js
1498
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/png.js
1515
1499
  var require_png = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1516
1500
  var str2arr = require_common().str2arr;
1517
1501
  var sliceEq = require_common().sliceEq;
@@ -1532,8 +1516,7 @@ var require_png = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expor
1532
1516
  };
1533
1517
  };
1534
1518
  }));
1535
- //#endregion
1536
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/psd.js
1519
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/psd.js
1537
1520
  var require_psd = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1538
1521
  var str2arr = require_common().str2arr;
1539
1522
  var sliceEq = require_common().sliceEq;
@@ -1552,8 +1535,7 @@ var require_psd = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expor
1552
1535
  };
1553
1536
  };
1554
1537
  }));
1555
- //#endregion
1556
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/svg.js
1538
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/svg.js
1557
1539
  var require_svg = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1558
1540
  var parseSvgHeader = require_svg_header().parse;
1559
1541
  var MAX_DATA_LENGTH = require_svg_header().MAX_DATA_LENGTH;
@@ -1566,8 +1548,7 @@ var require_svg = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expor
1566
1548
  return parseSvgHeader(str);
1567
1549
  };
1568
1550
  }));
1569
- //#endregion
1570
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/tiff.js
1551
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/tiff.js
1571
1552
  var require_tiff = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1572
1553
  var str2arr = require_common().str2arr;
1573
1554
  var sliceEq = require_common().sliceEq;
@@ -1617,8 +1598,7 @@ var require_tiff = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expo
1617
1598
  };
1618
1599
  };
1619
1600
  }));
1620
- //#endregion
1621
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parse_sync/webp.js
1601
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/webp.js
1622
1602
  var require_webp = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1623
1603
  var str2arr = require_common().str2arr;
1624
1604
  var sliceEq = require_common().sliceEq;
@@ -1689,8 +1669,7 @@ var require_webp = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expo
1689
1669
  return result;
1690
1670
  };
1691
1671
  }));
1692
- //#endregion
1693
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/lib/parsers_sync.js
1672
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parsers_sync.js
1694
1673
  var require_parsers_sync = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1695
1674
  module.exports = {
1696
1675
  avif: require_avif(),
@@ -1705,8 +1684,7 @@ var require_parsers_sync = /* @__PURE__ */ require_rolldown_runtime.__commonJSMi
1705
1684
  webp: require_webp()
1706
1685
  };
1707
1686
  }));
1708
- //#endregion
1709
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/43b9b37f7c8cc84dfb4291a9197892579e4bb95490e2ba02998c927153256ea7/node_modules/probe-image-size/sync.js
1687
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/sync.js
1710
1688
  var require_sync = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
1711
1689
  var parsers = require_parsers_sync();
1712
1690
  function probeBuffer(buffer) {
@@ -1725,8 +1703,7 @@ var require_sync = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((expo
1725
1703
  };
1726
1704
  module.exports.parsers = parsers;
1727
1705
  }));
1728
- //#endregion
1729
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@ai-sdk/openai/1.3.24/9ea9437756f1191484449f4e611ce2befb4ff9a7be92f5dfa8b1970d80a87966/node_modules/@ai-sdk/openai/dist/index.mjs
1706
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@ai-sdk/openai/1.3.24/9ea9437756f1191484449f4e611ce2befb4ff9a7be92f5dfa8b1970d80a87966/node_modules/@ai-sdk/openai/dist/index.mjs
1730
1707
  var import_sync = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_sync(), 1);
1731
1708
  function convertToOpenAIChatMessages({ prompt, useLegacyFunctionCalling = false, systemMessageMode = "system" }) {
1732
1709
  const messages = [];
@@ -4008,8 +3985,7 @@ function createOpenAI(options = {}) {
4008
3985
  return provider;
4009
3986
  }
4010
3987
  var openai = createOpenAI({ compatibility: "strict" });
4011
- //#endregion
4012
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/async-mutex/0.5.0/4b32f2ae13cd0d7acb694455f7c2810d59202098580506b1730c21c7ab02798f/node_modules/async-mutex/index.mjs
3988
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/async-mutex/0.5.0/4b32f2ae13cd0d7acb694455f7c2810d59202098580506b1730c21c7ab02798f/node_modules/async-mutex/index.mjs
4013
3989
  const E_CANCELED = /* @__PURE__ */ new Error("request for lock canceled");
4014
3990
  var __awaiter$2 = function(thisArg, _arguments, P, generator) {
4015
3991
  function adopt(value) {
@@ -4201,8 +4177,7 @@ var Mutex = class {
4201
4177
  return this._semaphore.cancel();
4202
4178
  }
4203
4179
  };
4204
- //#endregion
4205
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lru-cache/11.5.3/5f933852b2037e33252208b4fa114552d3422c97eca48d9d18f9ecabf26b3c0c/node_modules/lru-cache/dist/esm/node/index.min.js
4180
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lru-cache/11.5.3/5f933852b2037e33252208b4fa114552d3422c97eca48d9d18f9ecabf26b3c0c/node_modules/lru-cache/dist/esm/node/index.min.js
4206
4181
  var S = (0, diagnostics_channel.channel)("lru-cache:metrics");
4207
4182
  var W = (0, diagnostics_channel.tracingChannel)("lru-cache");
4208
4183
  var L = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
@@ -4850,8 +4825,7 @@ var I = class d {
4850
4825
  }
4851
4826
  }
4852
4827
  };
4853
- //#endregion
4854
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/xxhash-wasm/1.1.0/7a4d29379f632c8775c0f7a81c6f7be0607f720c94b35e32b01c8ed7b2685ac1/node_modules/xxhash-wasm/esm/xxhash-wasm.js
4828
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/xxhash-wasm/1.1.0/7a4d29379f632c8775c0f7a81c6f7be0607f720c94b35e32b01c8ed7b2685ac1/node_modules/xxhash-wasm/esm/xxhash-wasm.js
4855
4829
  const t = new Uint8Array([
4856
4830
  0,
4857
4831
  97,
@@ -8006,8 +7980,7 @@ async function e() {
8006
7980
  };
8007
7981
  }((await WebAssembly.instantiate(t)).instance);
8008
7982
  }
8009
- //#endregion
8010
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/base.js
7983
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/base.js
8011
7984
  var Diff = class {
8012
7985
  diff(oldStr, newStr, options = {}) {
8013
7986
  let callback;
@@ -8184,12 +8157,10 @@ var Diff = class {
8184
8157
  return components;
8185
8158
  }
8186
8159
  };
8187
- //#endregion
8188
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/character.js
8160
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/character.js
8189
8161
  var CharacterDiff = class extends Diff {};
8190
8162
  new CharacterDiff();
8191
- //#endregion
8192
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/util/string.js
8163
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/util/string.js
8193
8164
  function longestCommonPrefix(str1, str2) {
8194
8165
  let i = 0;
8195
8166
  for (; i < str1.length && i < str2.length; i++) if (str1[i] != str2[i]) return str1.slice(0, i);
@@ -8278,8 +8249,7 @@ function leadingAndTrailingWs(string, segmenter) {
8278
8249
  const lastSeg = segments[segments.length - 1];
8279
8250
  return [/\s/.test(firstSeg) ? firstSeg : "", /\s/.test(lastSeg) ? lastSeg : ""];
8280
8251
  }
8281
- //#endregion
8282
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/word.js
8252
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/word.js
8283
8253
  const extendedWordChars = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
8284
8254
  const tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
8285
8255
  var WordDiff = class extends Diff {
@@ -8386,8 +8356,7 @@ var WordsWithSpaceDiff = class extends Diff {
8386
8356
  }
8387
8357
  };
8388
8358
  new WordsWithSpaceDiff();
8389
- //#endregion
8390
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/line.js
8359
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/line.js
8391
8360
  var LineDiff = class extends Diff {
8392
8361
  constructor() {
8393
8362
  super(...arguments);
@@ -8419,8 +8388,7 @@ function tokenize(value, options) {
8419
8388
  }
8420
8389
  return retLines;
8421
8390
  }
8422
- //#endregion
8423
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/sentence.js
8391
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/sentence.js
8424
8392
  function isSentenceEndPunct(char) {
8425
8393
  return char == "." || char == "!" || char == "?";
8426
8394
  }
@@ -8446,16 +8414,14 @@ var SentenceDiff = class extends Diff {
8446
8414
  }
8447
8415
  };
8448
8416
  new SentenceDiff();
8449
- //#endregion
8450
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/css.js
8417
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/css.js
8451
8418
  var CssDiff = class extends Diff {
8452
8419
  tokenize(value) {
8453
8420
  return value.split(/([{}:;,]|\s+)/);
8454
8421
  }
8455
8422
  };
8456
8423
  new CssDiff();
8457
- //#endregion
8458
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/json.js
8424
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/json.js
8459
8425
  var JsonDiff = class extends Diff {
8460
8426
  constructor() {
8461
8427
  super(...arguments);
@@ -8509,8 +8475,7 @@ function canonicalize(obj, stack, replacementStack, replacer, key) {
8509
8475
  } else canonicalizedObj = obj;
8510
8476
  return canonicalizedObj;
8511
8477
  }
8512
- //#endregion
8513
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/array.js
8478
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/array.js
8514
8479
  var ArrayDiff = class extends Diff {
8515
8480
  tokenize(value) {
8516
8481
  return value.slice();
@@ -8523,8 +8488,7 @@ var ArrayDiff = class extends Diff {
8523
8488
  }
8524
8489
  };
8525
8490
  new ArrayDiff();
8526
- //#endregion
8527
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/patch/create.js
8491
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/patch/create.js
8528
8492
  function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
8529
8493
  let optionsObj;
8530
8494
  if (!options) optionsObj = {};
@@ -8618,8 +8582,7 @@ function splitLines(text) {
8618
8582
  else result.push(result.pop().slice(0, -1));
8619
8583
  return result;
8620
8584
  }
8621
- //#endregion
8622
- //#region ../memory/dist/src-BUWL69LT.js
8585
+ // ../memory/dist/src-kIpEG6XZ.js
8623
8586
  var __defProp$3 = Object.defineProperty;
8624
8587
  var __exportAll = (all, no_symbols) => {
8625
8588
  let target = {};
@@ -12443,26 +12406,30 @@ const LF$2 = 10;
12443
12406
  const CR$2 = 13;
12444
12407
  const SPACE$2 = 32;
12445
12408
  function noop$2(_arg) {}
12446
- function createParser$2(callbacks) {
12447
- if (typeof callbacks == "function") throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
12448
- const { onEvent = noop$2, onError = noop$2, onRetry = noop$2, onComment } = callbacks, pendingFragments = [];
12449
- let isFirstChunk = !0, id, data = "", dataLines = 0, eventType;
12409
+ function createParser$2(config) {
12410
+ if (typeof config == "function") throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
12411
+ const { onEvent = noop$2, onError = noop$2, onRetry = noop$2, onComment, maxBufferSize } = config, pendingFragments = [];
12412
+ let pendingFragmentsLength = 0, isFirstChunk = !0, id, data = "", dataLines = 0, eventType, terminated = !1;
12450
12413
  function feed(chunk) {
12414
+ if (terminated) throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
12451
12415
  if (isFirstChunk && (isFirstChunk = !1, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
12452
12416
  const trailing2 = processLines(chunk);
12453
- trailing2 !== "" && pendingFragments.push(trailing2);
12417
+ trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
12454
12418
  return;
12455
12419
  }
12456
12420
  if (chunk.indexOf(`
12457
12421
  `) === -1 && chunk.indexOf("\r") === -1) {
12458
- pendingFragments.push(chunk);
12422
+ pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
12459
12423
  return;
12460
12424
  }
12461
12425
  pendingFragments.push(chunk);
12462
12426
  const input = pendingFragments.join("");
12463
- pendingFragments.length = 0;
12427
+ pendingFragments.length = 0, pendingFragmentsLength = 0;
12464
12428
  const trailing = processLines(input);
12465
- trailing !== "" && pendingFragments.push(trailing);
12429
+ trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
12430
+ }
12431
+ function checkBufferSize() {
12432
+ maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = !0, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(new ParseError$2(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, { type: "max-buffer-size-exceeded" }))));
12466
12433
  }
12467
12434
  function processLines(chunk) {
12468
12435
  let searchIndex = 0;
@@ -12526,7 +12493,7 @@ ${value2}`, dataLines++;
12526
12493
  }
12527
12494
  if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
12528
12495
  const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE$2 ? start + 4 : start + 3, end);
12529
- id = value2.includes("\0") ? void 0 : value2;
12496
+ value2.includes("\0") || (id = value2);
12530
12497
  return;
12531
12498
  }
12532
12499
  if (firstCharCode === 58) {
@@ -12554,7 +12521,7 @@ ${value2}`, dataLines++;
12554
12521
  ${value}`, dataLines++;
12555
12522
  break;
12556
12523
  case "id":
12557
- id = value.includes("\0") ? void 0 : value;
12524
+ value.includes("\0") || (id = value);
12558
12525
  break;
12559
12526
  case "retry":
12560
12527
  /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(new ParseError$2(`Invalid \`retry\` value: "${value}"`, {
@@ -12583,7 +12550,7 @@ ${value}`, dataLines++;
12583
12550
  const incompleteLine = pendingFragments.join("");
12584
12551
  parseLine(incompleteLine, 0, incompleteLine.length);
12585
12552
  }
12586
- isFirstChunk = !0, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
12553
+ isFirstChunk = !0, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = !1;
12587
12554
  }
12588
12555
  return {
12589
12556
  feed,
@@ -12597,7 +12564,7 @@ function isEventPrefix$2(chunk, i, firstCharCode) {
12597
12564
  return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
12598
12565
  }
12599
12566
  var EventSourceParserStream$2 = class extends TransformStream {
12600
- constructor({ onError, onRetry, onComment } = {}) {
12567
+ constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
12601
12568
  let parser;
12602
12569
  super({
12603
12570
  start(controller) {
@@ -12606,10 +12573,11 @@ var EventSourceParserStream$2 = class extends TransformStream {
12606
12573
  controller.enqueue(event);
12607
12574
  },
12608
12575
  onError(error) {
12609
- onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
12576
+ typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
12610
12577
  },
12611
12578
  onRetry,
12612
- onComment
12579
+ onComment,
12580
+ maxBufferSize
12613
12581
  });
12614
12582
  },
12615
12583
  transform(chunk) {
@@ -12834,7 +12802,7 @@ function withUserAgentSuffix$2(headers, ...userAgentSuffixParts) {
12834
12802
  normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
12835
12803
  return Object.fromEntries(normalizedHeaders.entries());
12836
12804
  }
12837
- var VERSION$8 = "3.0.41";
12805
+ var VERSION$8 = "3.0.42";
12838
12806
  var getOriginalFetch$3 = () => globalThis.fetch;
12839
12807
  var getFromApi$2 = async ({ url, headers = {}, successfulResponseHandler, failedResponseHandler, abortSignal, fetch = getOriginalFetch$3() }) => {
12840
12808
  try {
@@ -15088,58 +15056,84 @@ var GatewayImageModel$2 = class {
15088
15056
  };
15089
15057
  }
15090
15058
  };
15091
- var providerMetadataEntrySchema$5 = zod_v4.z.object({ images: zod_v4.z.array(zod_v4.z.unknown()).optional() }).catchall(zod_v4.z.unknown());
15092
- var gatewayImageUsageSchema$2 = zod_v4.z.object({
15059
+ var providerMetadataEntrySchema$5 = () => zod_v4.z.object({ images: zod_v4.z.array(zod_v4.z.unknown()).optional() }).catchall(zod_v4.z.unknown());
15060
+ var gatewayImageUsageSchema$2 = () => zod_v4.z.object({
15093
15061
  inputTokens: zod_v4.z.number().nullish(),
15094
15062
  outputTokens: zod_v4.z.number().nullish(),
15095
15063
  totalTokens: zod_v4.z.number().nullish()
15096
15064
  });
15097
- var gatewayImageResponseSchema$2 = zod_v4.z.object({
15065
+ var gatewayImageResponseSchema$2 = lazySchema$2(() => zodSchema$2(zod_v4.z.object({
15098
15066
  images: zod_v4.z.array(zod_v4.z.string()),
15099
15067
  isRetryable: zod_v4.z.boolean().optional(),
15100
15068
  warnings: zod_v4.z.array(zod_v4.z.object({
15101
15069
  type: zod_v4.z.literal("other"),
15102
15070
  message: zod_v4.z.string()
15103
15071
  })).optional(),
15104
- providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema$5).optional(),
15105
- usage: gatewayImageUsageSchema$2.optional()
15106
- });
15072
+ providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema$5()).optional(),
15073
+ usage: gatewayImageUsageSchema$2().optional()
15074
+ })));
15075
+ var parallelSearchModes$2 = [
15076
+ "turbo",
15077
+ "fast",
15078
+ "basic",
15079
+ "advanced",
15080
+ "one-shot",
15081
+ "agentic"
15082
+ ];
15107
15083
  var parallelSearchToolFactory$2 = createProviderDefinedToolFactoryWithOutputSchema({
15108
15084
  id: "gateway.parallel_search",
15109
15085
  name: "parallel_search",
15110
15086
  inputSchema: lazySchema$2(() => zodSchema$2(zod.z.object({
15111
15087
  objective: zod.z.string().describe("Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),
15112
- search_queries: zod.z.array(zod.z.string()).optional().describe("Optional search queries to supplement the objective. Maximum 200 characters per query."),
15113
- mode: zod.z.enum(["one-shot", "agentic"]).optional().describe("Mode preset: \"one-shot\" for comprehensive results with longer excerpts (default), \"agentic\" for concise, token-efficient results for multi-step workflows."),
15088
+ search_queries: zod.z.array(zod.z.string()).optional().describe("Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."),
15089
+ mode: zod.z.enum(parallelSearchModes$2).optional().describe("Search mode: \"turbo\" and \"fast\" return quickly with shorter excerpts, \"basic\" is balanced (default), \"advanced\" is the most thorough. \"turbo\" supports English and Japanese only. \"one-shot\" and \"agentic\" are deprecated aliases of \"basic\" and \"advanced\"."),
15114
15090
  max_results: zod.z.number().optional().describe("Maximum number of results to return (1-20). Defaults to 10 if not specified."),
15115
15091
  source_policy: zod.z.object({
15116
- include_domains: zod.z.array(zod.z.string()).optional().describe("List of domains to include in search results."),
15117
- exclude_domains: zod.z.array(zod.z.string()).optional().describe("List of domains to exclude from search results."),
15118
- after_date: zod.z.string().optional().describe("Only include results published after this date (ISO 8601 format).")
15092
+ include_domains: zod.z.array(zod.z.string()).optional().describe("Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."),
15093
+ exclude_domains: zod.z.array(zod.z.string()).optional().describe("Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."),
15094
+ after_date: zod.z.string().optional().describe("Only include results published on or after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time.")
15119
15095
  }).optional().describe("Source policy for controlling which domains to include/exclude and freshness."),
15120
15096
  excerpts: zod.z.object({
15121
15097
  max_chars_per_result: zod.z.number().optional().describe("Maximum characters per result."),
15122
- max_chars_total: zod.z.number().optional().describe("Maximum total characters across all results.")
15098
+ max_chars_total: zod.z.number().optional().describe("Deprecated: use the top-level max_chars_total.")
15123
15099
  }).optional().describe("Excerpt configuration for controlling result length."),
15124
- fetch_policy: zod.z.object({ max_age_seconds: zod.z.number().optional().describe("Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.") }).optional().describe("Fetch policy for controlling content freshness.")
15100
+ max_chars_total: zod.z.number().optional().describe("Maximum total characters across all result excerpts."),
15101
+ fetch_policy: zod.z.object({
15102
+ max_age_seconds: zod.z.number().optional().describe("Maximum age of cached content in seconds before a live fetch, minimum 600."),
15103
+ timeout_seconds: zod.z.number().optional().describe("Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."),
15104
+ disable_cache_fallback: zod.z.boolean().optional().describe("Return an error instead of older cached content when a live fetch fails.")
15105
+ }).optional().describe("Fetch policy for controlling content freshness."),
15106
+ location: zod.z.string().optional().describe("ISO 3166-1 alpha-2 country code to localize results, e.g. \"us\".")
15125
15107
  }))),
15126
15108
  outputSchema: lazySchema$2(() => zodSchema$2(zod.z.union([zod.z.object({
15127
- searchId: zod.z.string(),
15109
+ search_id: zod.z.string(),
15128
15110
  results: zod.z.array(zod.z.object({
15129
15111
  url: zod.z.string(),
15130
- title: zod.z.string(),
15131
- excerpt: zod.z.string(),
15132
- publishDate: zod.z.string().nullable().optional(),
15133
- relevanceScore: zod.z.number().optional()
15134
- }))
15112
+ title: zod.z.string().nullable().optional(),
15113
+ publish_date: zod.z.string().nullable().optional(),
15114
+ excerpts: zod.z.array(zod.z.string())
15115
+ })),
15116
+ warnings: zod.z.array(zod.z.object({
15117
+ type: zod.z.string(),
15118
+ message: zod.z.string(),
15119
+ detail: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional()
15120
+ })).nullable().optional(),
15121
+ usage: zod.z.array(zod.z.object({
15122
+ name: zod.z.string(),
15123
+ count: zod.z.number().optional()
15124
+ })).nullable().optional(),
15125
+ session_id: zod.z.string().optional()
15135
15126
  }), zod.z.object({
15136
15127
  error: zod.z.enum([
15137
15128
  "api_error",
15129
+ "configuration_error",
15130
+ "execution_error",
15131
+ "gateway_rate_limit",
15132
+ "invalid_input",
15138
15133
  "rate_limit",
15139
15134
  "timeout",
15140
- "invalid_input",
15141
- "configuration_error",
15142
- "unknown"
15135
+ "unknown",
15136
+ "unknown_tool"
15143
15137
  ]),
15144
15138
  statusCode: zod.z.number().optional(),
15145
15139
  message: zod.z.string()
@@ -15213,7 +15207,7 @@ async function getVercelRequestId$2() {
15213
15207
  var _a10;
15214
15208
  return (_a10 = getContext$2().headers) == null ? void 0 : _a10["x-vercel-id"];
15215
15209
  }
15216
- var VERSION$7 = "2.0.168";
15210
+ var VERSION$7 = "2.0.172";
15217
15211
  var AI_GATEWAY_PROTOCOL_VERSION$2 = "0.0.1";
15218
15212
  function createGatewayProvider$1(options = {}) {
15219
15213
  var _a10, _b10;
@@ -16155,52 +16149,52 @@ var trace$1 = function() {
16155
16149
  }().getInstance();
16156
16150
  var __defProp$1 = Object.defineProperty;
16157
16151
  var __export$1 = (target, all) => {
16158
- for (var name16 in all) __defProp$1(target, name16, {
16159
- get: all[name16],
16152
+ for (var name17 in all) __defProp$1(target, name17, {
16153
+ get: all[name17],
16160
16154
  enumerable: true
16161
16155
  });
16162
16156
  };
16163
- var name2$3 = "AI_InvalidArgumentError";
16164
- var marker2$3 = `vercel.ai.error.${name2$3}`;
16165
- var symbol2$3 = Symbol.for(marker2$3);
16166
- var _a2$3;
16157
+ var name3$3 = "AI_InvalidArgumentError";
16158
+ var marker3$3 = `vercel.ai.error.${name3$3}`;
16159
+ var symbol3$3 = Symbol.for(marker3$3);
16160
+ var _a3$3;
16167
16161
  var InvalidArgumentError$4 = class extends AISDKError$2 {
16168
16162
  constructor({ parameter, value, message }) {
16169
16163
  super({
16170
- name: name2$3,
16164
+ name: name3$3,
16171
16165
  message: `Invalid argument for parameter ${parameter}: ${message}`
16172
16166
  });
16173
- this[_a2$3] = true;
16167
+ this[_a3$3] = true;
16174
16168
  this.parameter = parameter;
16175
16169
  this.value = value;
16176
16170
  }
16177
16171
  static isInstance(error) {
16178
- return AISDKError$2.hasMarker(error, marker2$3);
16172
+ return AISDKError$2.hasMarker(error, marker3$3);
16179
16173
  }
16180
16174
  };
16181
- _a2$3 = symbol2$3;
16182
- var name6$3 = "AI_NoObjectGeneratedError";
16183
- var marker6$3 = `vercel.ai.error.${name6$3}`;
16184
- var symbol6$3 = Symbol.for(marker6$3);
16185
- var _a6$3;
16175
+ _a3$3 = symbol3$3;
16176
+ var name7$3 = "AI_NoObjectGeneratedError";
16177
+ var marker7$3 = `vercel.ai.error.${name7$3}`;
16178
+ var symbol7$3 = Symbol.for(marker7$3);
16179
+ var _a7$3;
16186
16180
  var NoObjectGeneratedError$1 = class extends AISDKError$2 {
16187
16181
  constructor({ message = "No object generated.", cause, text: text2, response, usage, finishReason }) {
16188
16182
  super({
16189
- name: name6$3,
16183
+ name: name7$3,
16190
16184
  message,
16191
16185
  cause
16192
16186
  });
16193
- this[_a6$3] = true;
16187
+ this[_a7$3] = true;
16194
16188
  this.text = text2;
16195
16189
  this.response = response;
16196
16190
  this.usage = usage;
16197
16191
  this.finishReason = finishReason;
16198
16192
  }
16199
16193
  static isInstance(error) {
16200
- return AISDKError$2.hasMarker(error, marker6$3);
16194
+ return AISDKError$2.hasMarker(error, marker7$3);
16201
16195
  }
16202
16196
  };
16203
- _a6$3 = symbol6$3;
16197
+ _a7$3 = symbol7$3;
16204
16198
  var UnsupportedModelVersionError$2 = class extends AISDKError$2 {
16205
16199
  constructor(options) {
16206
16200
  super({
@@ -16212,26 +16206,26 @@ var UnsupportedModelVersionError$2 = class extends AISDKError$2 {
16212
16206
  this.modelId = options.modelId;
16213
16207
  }
16214
16208
  };
16215
- var name14$1 = "AI_RetryError";
16216
- var marker14$2 = `vercel.ai.error.${name14$1}`;
16217
- var symbol14$2 = Symbol.for(marker14$2);
16218
- var _a14$2;
16209
+ var name15$1 = "AI_RetryError";
16210
+ var marker15$1 = `vercel.ai.error.${name15$1}`;
16211
+ var symbol15$1 = Symbol.for(marker15$1);
16212
+ var _a15$1;
16219
16213
  var RetryError$2 = class extends AISDKError$2 {
16220
16214
  constructor({ message, reason, errors }) {
16221
16215
  super({
16222
- name: name14$1,
16216
+ name: name15$1,
16223
16217
  message
16224
16218
  });
16225
- this[_a14$2] = true;
16219
+ this[_a15$1] = true;
16226
16220
  this.reason = reason;
16227
16221
  this.errors = errors;
16228
16222
  this.lastError = errors[errors.length - 1];
16229
16223
  }
16230
16224
  static isInstance(error) {
16231
- return AISDKError$2.hasMarker(error, marker14$2);
16225
+ return AISDKError$2.hasMarker(error, marker15$1);
16232
16226
  }
16233
16227
  };
16234
- _a14$2 = symbol14$2;
16228
+ _a15$1 = symbol15$1;
16235
16229
  function resolveEmbeddingModel$2(model) {
16236
16230
  if (typeof model !== "string") {
16237
16231
  if (model.specificationVersion !== "v2") throw new UnsupportedModelVersionError$2({
@@ -16244,17 +16238,17 @@ function resolveEmbeddingModel$2(model) {
16244
16238
  return getGlobalProvider$2().textEmbeddingModel(model);
16245
16239
  }
16246
16240
  function getGlobalProvider$2() {
16247
- var _a16;
16248
- return (_a16 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a16 : gateway$2;
16241
+ var _a17;
16242
+ return (_a17 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a17 : gateway$2;
16249
16243
  }
16250
- var VERSION$6 = "5.0.277";
16244
+ var VERSION$6 = "5.0.281";
16251
16245
  var dataContentSchema$1 = zod_v4.z.union([
16252
16246
  zod_v4.z.string(),
16253
16247
  zod_v4.z.instanceof(Uint8Array),
16254
16248
  zod_v4.z.instanceof(ArrayBuffer),
16255
16249
  zod_v4.z.custom((value) => {
16256
- var _a16, _b;
16257
- return (_b = (_a16 = globalThis.Buffer) == null ? void 0 : _a16.isBuffer(value)) != null ? _b : false;
16250
+ var _a17, _b;
16251
+ return (_b = (_a17 = globalThis.Buffer) == null ? void 0 : _a17.isBuffer(value)) != null ? _b : false;
16258
16252
  }, { message: "Must be a Buffer" })
16259
16253
  ]);
16260
16254
  var jsonValueSchema$2 = zod_v4.z.lazy(() => zod_v4.z.union([
@@ -16378,8 +16372,8 @@ function assembleOperationName$1({ operationId, telemetry }) {
16378
16372
  };
16379
16373
  }
16380
16374
  function getTelemetryMetadataAttributes(telemetry) {
16381
- var _a16;
16382
- return Object.entries((_a16 = telemetry == null ? void 0 : telemetry.metadata) != null ? _a16 : {}).reduce((attributes, [key, value]) => {
16375
+ var _a17;
16376
+ return Object.entries((_a17 = telemetry == null ? void 0 : telemetry.metadata) != null ? _a17 : {}).reduce((attributes, [key, value]) => {
16383
16377
  attributes[`ai.telemetry.metadata.${key}`] = value;
16384
16378
  return attributes;
16385
16379
  }, {});
@@ -16403,7 +16397,7 @@ var noopTracer$1 = {
16403
16397
  startSpan() {
16404
16398
  return noopSpan$1;
16405
16399
  },
16406
- startActiveSpan(name16, arg1, arg2, arg3) {
16400
+ startActiveSpan(name17, arg1, arg2, arg3) {
16407
16401
  if (typeof arg1 === "function") return arg1(noopSpan$1);
16408
16402
  if (typeof arg2 === "function") return arg2(noopSpan$1);
16409
16403
  if (typeof arg3 === "function") return arg3(noopSpan$1);
@@ -16454,8 +16448,8 @@ function getTracer$1({ isEnabled = false, tracer } = {}) {
16454
16448
  if (tracer) return tracer;
16455
16449
  return trace$1.getTracer("ai");
16456
16450
  }
16457
- function recordSpan$1({ name: name16, tracer, attributes, fn, endWhenDone = true, endOnError = endWhenDone }) {
16458
- return tracer.startActiveSpan(name16, { attributes }, async (span) => {
16451
+ function recordSpan$1({ name: name17, tracer, attributes, fn, endWhenDone = true, endOnError = endWhenDone }) {
16452
+ return tracer.startActiveSpan(name17, { attributes }, async (span) => {
16459
16453
  try {
16460
16454
  const result = await fn(span);
16461
16455
  if (endWhenDone) span.end();
@@ -16929,7 +16923,7 @@ async function embedMany$2({ model: modelArg, values, maxParallelCalls = Infinit
16929
16923
  }),
16930
16924
  tracer,
16931
16925
  fn: async (doEmbedSpan) => {
16932
- var _a16;
16926
+ var _a17;
16933
16927
  const modelResponse = await model.doEmbed({
16934
16928
  values,
16935
16929
  abortSignal,
@@ -16937,7 +16931,7 @@ async function embedMany$2({ model: modelArg, values, maxParallelCalls = Infinit
16937
16931
  providerOptions
16938
16932
  });
16939
16933
  const embeddings3 = modelResponse.embeddings;
16940
- const usage2 = (_a16 = modelResponse.usage) != null ? _a16 : { tokens: NaN };
16934
+ const usage2 = (_a17 = modelResponse.usage) != null ? _a17 : { tokens: NaN };
16941
16935
  doEmbedSpan.setAttributes(selectTelemetryAttributes$1({
16942
16936
  telemetry,
16943
16937
  attributes: {
@@ -16997,7 +16991,7 @@ async function embedMany$2({ model: modelArg, values, maxParallelCalls = Infinit
16997
16991
  }),
16998
16992
  tracer,
16999
16993
  fn: async (doEmbedSpan) => {
17000
- var _a16;
16994
+ var _a17;
17001
16995
  const modelResponse = await model.doEmbed({
17002
16996
  values: chunk,
17003
16997
  abortSignal,
@@ -17005,7 +16999,7 @@ async function embedMany$2({ model: modelArg, values, maxParallelCalls = Infinit
17005
16999
  providerOptions
17006
17000
  });
17007
17001
  const embeddings2 = modelResponse.embeddings;
17008
- const usage = (_a16 = modelResponse.usage) != null ? _a16 : { tokens: NaN };
17002
+ const usage = (_a17 = modelResponse.usage) != null ? _a17 : { tokens: NaN };
17009
17003
  doEmbedSpan.setAttributes(selectTelemetryAttributes$1({
17010
17004
  telemetry,
17011
17005
  attributes: {
@@ -17332,26 +17326,30 @@ const LF$1 = 10;
17332
17326
  const CR$1 = 13;
17333
17327
  const SPACE$1 = 32;
17334
17328
  function noop$1(_arg) {}
17335
- function createParser$1(callbacks) {
17336
- if (typeof callbacks == "function") throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
17337
- const { onEvent = noop$1, onError = noop$1, onRetry = noop$1, onComment } = callbacks, pendingFragments = [];
17338
- let isFirstChunk = !0, id, data = "", dataLines = 0, eventType;
17329
+ function createParser$1(config) {
17330
+ if (typeof config == "function") throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
17331
+ const { onEvent = noop$1, onError = noop$1, onRetry = noop$1, onComment, maxBufferSize } = config, pendingFragments = [];
17332
+ let pendingFragmentsLength = 0, isFirstChunk = !0, id, data = "", dataLines = 0, eventType, terminated = !1;
17339
17333
  function feed(chunk) {
17334
+ if (terminated) throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
17340
17335
  if (isFirstChunk && (isFirstChunk = !1, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
17341
17336
  const trailing2 = processLines(chunk);
17342
- trailing2 !== "" && pendingFragments.push(trailing2);
17337
+ trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
17343
17338
  return;
17344
17339
  }
17345
17340
  if (chunk.indexOf(`
17346
17341
  `) === -1 && chunk.indexOf("\r") === -1) {
17347
- pendingFragments.push(chunk);
17342
+ pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
17348
17343
  return;
17349
17344
  }
17350
17345
  pendingFragments.push(chunk);
17351
17346
  const input = pendingFragments.join("");
17352
- pendingFragments.length = 0;
17347
+ pendingFragments.length = 0, pendingFragmentsLength = 0;
17353
17348
  const trailing = processLines(input);
17354
- trailing !== "" && pendingFragments.push(trailing);
17349
+ trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
17350
+ }
17351
+ function checkBufferSize() {
17352
+ maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = !0, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(new ParseError$1(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, { type: "max-buffer-size-exceeded" }))));
17355
17353
  }
17356
17354
  function processLines(chunk) {
17357
17355
  let searchIndex = 0;
@@ -17415,7 +17413,7 @@ ${value2}`, dataLines++;
17415
17413
  }
17416
17414
  if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
17417
17415
  const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE$1 ? start + 4 : start + 3, end);
17418
- id = value2.includes("\0") ? void 0 : value2;
17416
+ value2.includes("\0") || (id = value2);
17419
17417
  return;
17420
17418
  }
17421
17419
  if (firstCharCode === 58) {
@@ -17443,7 +17441,7 @@ ${value2}`, dataLines++;
17443
17441
  ${value}`, dataLines++;
17444
17442
  break;
17445
17443
  case "id":
17446
- id = value.includes("\0") ? void 0 : value;
17444
+ value.includes("\0") || (id = value);
17447
17445
  break;
17448
17446
  case "retry":
17449
17447
  /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(new ParseError$1(`Invalid \`retry\` value: "${value}"`, {
@@ -17472,7 +17470,7 @@ ${value}`, dataLines++;
17472
17470
  const incompleteLine = pendingFragments.join("");
17473
17471
  parseLine(incompleteLine, 0, incompleteLine.length);
17474
17472
  }
17475
- isFirstChunk = !0, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
17473
+ isFirstChunk = !0, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = !1;
17476
17474
  }
17477
17475
  return {
17478
17476
  feed,
@@ -17486,7 +17484,7 @@ function isEventPrefix$1(chunk, i, firstCharCode) {
17486
17484
  return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
17487
17485
  }
17488
17486
  var EventSourceParserStream$1 = class extends TransformStream {
17489
- constructor({ onError, onRetry, onComment } = {}) {
17487
+ constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
17490
17488
  let parser;
17491
17489
  super({
17492
17490
  start(controller) {
@@ -17495,10 +17493,11 @@ var EventSourceParserStream$1 = class extends TransformStream {
17495
17493
  controller.enqueue(event);
17496
17494
  },
17497
17495
  onError(error) {
17498
- onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
17496
+ typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
17499
17497
  },
17500
17498
  onRetry,
17501
- onComment
17499
+ onComment,
17500
+ maxBufferSize
17502
17501
  });
17503
17502
  },
17504
17503
  transform(chunk) {
@@ -17606,7 +17605,7 @@ function validateDownloadUrl$1(url) {
17606
17605
  url,
17607
17606
  message: `URL must have a hostname`
17608
17607
  });
17609
- if (hostname === "localhost" || hostname.endsWith(".local") || hostname.endsWith(".localhost")) throw new DownloadError$1({
17608
+ if (hostname === "localhost" || hostname.endsWith(".local") || hostname.endsWith(".localhost") || hostname.endsWith(".internal")) throw new DownloadError$1({
17610
17609
  url,
17611
17610
  message: `URL with hostname ${hostname} is not allowed`
17612
17611
  });
@@ -18003,7 +18002,7 @@ function withUserAgentSuffix$1(headers, ...userAgentSuffixParts) {
18003
18002
  normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
18004
18003
  return Object.fromEntries(normalizedHeaders.entries());
18005
18004
  }
18006
- var VERSION$5 = "4.0.61";
18005
+ var VERSION$5 = "4.0.62";
18007
18006
  var getOriginalFetch$1 = () => globalThis.fetch;
18008
18007
  var getFromApi$1 = async ({ url, headers = {}, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, validateUrl, credentialedOrigin, trustedOrigin }) => {
18009
18008
  try {
@@ -20294,7 +20293,7 @@ var GatewayEmbeddingModel$1 = class {
20294
20293
  };
20295
20294
  }
20296
20295
  };
20297
- var gatewayEmbeddingWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20296
+ var gatewayEmbeddingWarningSchema$1 = () => zod_v4.z.discriminatedUnion("type", [
20298
20297
  zod_v4.z.object({
20299
20298
  type: zod_v4.z.literal("unsupported"),
20300
20299
  feature: zod_v4.z.string(),
@@ -20313,7 +20312,7 @@ var gatewayEmbeddingWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20313
20312
  var gatewayEmbeddingResponseSchema$1 = lazySchema$1(() => zodSchema$1(zod_v4.z.object({
20314
20313
  embeddings: zod_v4.z.array(zod_v4.z.array(zod_v4.z.number())),
20315
20314
  usage: zod_v4.z.object({ tokens: zod_v4.z.number() }).nullish(),
20316
- warnings: zod_v4.z.array(gatewayEmbeddingWarningSchema$1).optional(),
20315
+ warnings: zod_v4.z.array(gatewayEmbeddingWarningSchema$1()).optional(),
20317
20316
  providerMetadata: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.record(zod_v4.z.string(), zod_v4.z.unknown())).optional()
20318
20317
  })));
20319
20318
  function mapGatewayWarnings(warnings) {
@@ -20397,8 +20396,8 @@ function maybeEncodeImageFile$1(file) {
20397
20396
  };
20398
20397
  return file;
20399
20398
  }
20400
- var providerMetadataEntrySchema$4 = zod_v4.z.object({ images: zod_v4.z.array(zod_v4.z.unknown()).optional() }).catchall(zod_v4.z.unknown());
20401
- var gatewayImageWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20399
+ var providerMetadataEntrySchema$4 = () => zod_v4.z.object({ images: zod_v4.z.array(zod_v4.z.unknown()).optional() }).catchall(zod_v4.z.unknown());
20400
+ var gatewayImageWarningSchema$1 = () => zod_v4.z.discriminatedUnion("type", [
20402
20401
  zod_v4.z.object({
20403
20402
  type: zod_v4.z.literal("unsupported"),
20404
20403
  feature: zod_v4.z.string(),
@@ -20419,18 +20418,18 @@ var gatewayImageWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20419
20418
  message: zod_v4.z.string()
20420
20419
  })
20421
20420
  ]);
20422
- var gatewayImageUsageSchema$1 = zod_v4.z.object({
20421
+ var gatewayImageUsageSchema$1 = () => zod_v4.z.object({
20423
20422
  inputTokens: zod_v4.z.number().nullish(),
20424
20423
  outputTokens: zod_v4.z.number().nullish(),
20425
20424
  totalTokens: zod_v4.z.number().nullish()
20426
20425
  });
20427
- var gatewayImageResponseSchema$1 = zod_v4.z.object({
20426
+ var gatewayImageResponseSchema$1 = lazySchema$1(() => zodSchema$1(zod_v4.z.object({
20428
20427
  images: zod_v4.z.array(zod_v4.z.string()),
20429
20428
  isRetryable: zod_v4.z.boolean().optional(),
20430
- warnings: zod_v4.z.array(gatewayImageWarningSchema$1).optional(),
20431
- providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema$4).optional(),
20432
- usage: gatewayImageUsageSchema$1.optional()
20433
- });
20429
+ warnings: zod_v4.z.array(gatewayImageWarningSchema$1()).optional(),
20430
+ providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema$4()).optional(),
20431
+ usage: gatewayImageUsageSchema$1().optional()
20432
+ })));
20434
20433
  var GatewayVideoModel$1 = class {
20435
20434
  constructor(modelId, config) {
20436
20435
  this.modelId = modelId;
@@ -20554,8 +20553,8 @@ function maybeEncodeVideoFile$1(file) {
20554
20553
  };
20555
20554
  return file;
20556
20555
  }
20557
- var providerMetadataEntrySchema2 = zod_v4.z.object({ videos: zod_v4.z.array(zod_v4.z.unknown()).optional() }).catchall(zod_v4.z.unknown());
20558
- var gatewayVideoDataSchema$1 = zod_v4.z.union([zod_v4.z.object({
20556
+ var providerMetadataEntrySchema2 = () => zod_v4.z.object({ videos: zod_v4.z.array(zod_v4.z.unknown()).optional() }).catchall(zod_v4.z.unknown());
20557
+ var gatewayVideoDataSchema$1 = () => zod_v4.z.union([zod_v4.z.object({
20559
20558
  type: zod_v4.z.literal("url"),
20560
20559
  url: zod_v4.z.string(),
20561
20560
  mediaType: zod_v4.z.string()
@@ -20564,7 +20563,7 @@ var gatewayVideoDataSchema$1 = zod_v4.z.union([zod_v4.z.object({
20564
20563
  data: zod_v4.z.string(),
20565
20564
  mediaType: zod_v4.z.string()
20566
20565
  })]);
20567
- var gatewayVideoWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20566
+ var gatewayVideoWarningSchema$1 = () => zod_v4.z.discriminatedUnion("type", [
20568
20567
  zod_v4.z.object({
20569
20568
  type: zod_v4.z.literal("unsupported"),
20570
20569
  feature: zod_v4.z.string(),
@@ -20585,18 +20584,18 @@ var gatewayVideoWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20585
20584
  message: zod_v4.z.string()
20586
20585
  })
20587
20586
  ]);
20588
- var gatewayVideoEventSchema$1 = zod_v4.z.discriminatedUnion("type", [zod_v4.z.object({
20587
+ var gatewayVideoEventSchema$1 = lazySchema$1(() => zodSchema$1(zod_v4.z.discriminatedUnion("type", [zod_v4.z.object({
20589
20588
  type: zod_v4.z.literal("result"),
20590
- videos: zod_v4.z.array(gatewayVideoDataSchema$1),
20591
- warnings: zod_v4.z.array(gatewayVideoWarningSchema$1).optional(),
20592
- providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema2).optional()
20589
+ videos: zod_v4.z.array(gatewayVideoDataSchema$1()),
20590
+ warnings: zod_v4.z.array(gatewayVideoWarningSchema$1()).optional(),
20591
+ providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema2()).optional()
20593
20592
  }), zod_v4.z.object({
20594
20593
  type: zod_v4.z.literal("error"),
20595
20594
  message: zod_v4.z.string(),
20596
20595
  errorType: zod_v4.z.string(),
20597
20596
  statusCode: zod_v4.z.number(),
20598
20597
  param: zod_v4.z.unknown().nullable()
20599
- })]);
20598
+ })])));
20600
20599
  var GatewayRerankingModel$1 = class {
20601
20600
  constructor(modelId, config) {
20602
20601
  this.modelId = modelId;
@@ -20653,7 +20652,7 @@ var GatewayRerankingModel$1 = class {
20653
20652
  };
20654
20653
  }
20655
20654
  };
20656
- var gatewayRerankingWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20655
+ var gatewayRerankingWarningSchema$1 = () => zod_v4.z.discriminatedUnion("type", [
20657
20656
  zod_v4.z.object({
20658
20657
  type: zod_v4.z.literal("unsupported"),
20659
20658
  feature: zod_v4.z.string(),
@@ -20674,7 +20673,7 @@ var gatewayRerankingResponseSchema$1 = lazySchema$1(() => zodSchema$1(zod_v4.z.o
20674
20673
  index: zod_v4.z.number(),
20675
20674
  relevanceScore: zod_v4.z.number()
20676
20675
  })),
20677
- warnings: zod_v4.z.array(gatewayRerankingWarningSchema$1).optional(),
20676
+ warnings: zod_v4.z.array(gatewayRerankingWarningSchema$1()).optional(),
20678
20677
  providerMetadata: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.record(zod_v4.z.string(), zod_v4.z.unknown())).optional()
20679
20678
  })));
20680
20679
  var GatewaySpeechModel$1 = class {
@@ -20737,8 +20736,8 @@ var GatewaySpeechModel$1 = class {
20737
20736
  };
20738
20737
  }
20739
20738
  };
20740
- var providerMetadataEntrySchema3 = zod_v4.z.object({}).catchall(zod_v4.z.unknown());
20741
- var gatewaySpeechWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20739
+ var providerMetadataEntrySchema3 = () => zod_v4.z.object({}).catchall(zod_v4.z.unknown());
20740
+ var gatewaySpeechWarningSchema$1 = () => zod_v4.z.discriminatedUnion("type", [
20742
20741
  zod_v4.z.object({
20743
20742
  type: zod_v4.z.literal("unsupported"),
20744
20743
  feature: zod_v4.z.string(),
@@ -20759,11 +20758,11 @@ var gatewaySpeechWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20759
20758
  message: zod_v4.z.string()
20760
20759
  })
20761
20760
  ]);
20762
- var gatewaySpeechResponseSchema$1 = zod_v4.z.object({
20761
+ var gatewaySpeechResponseSchema$1 = lazySchema$1(() => zodSchema$1(zod_v4.z.object({
20763
20762
  audio: zod_v4.z.string(),
20764
- warnings: zod_v4.z.array(gatewaySpeechWarningSchema$1).optional(),
20765
- providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema3).optional()
20766
- });
20763
+ warnings: zod_v4.z.array(gatewaySpeechWarningSchema$1()).optional(),
20764
+ providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema3()).optional()
20765
+ })));
20767
20766
  var GatewayTranscriptionModel$1 = class {
20768
20767
  constructor(modelId, config) {
20769
20768
  this.modelId = modelId;
@@ -20824,8 +20823,8 @@ var GatewayTranscriptionModel$1 = class {
20824
20823
  };
20825
20824
  }
20826
20825
  };
20827
- var providerMetadataEntrySchema4 = zod_v4.z.object({}).catchall(zod_v4.z.unknown());
20828
- var gatewayTranscriptionWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20826
+ var providerMetadataEntrySchema4 = () => zod_v4.z.object({}).catchall(zod_v4.z.unknown());
20827
+ var gatewayTranscriptionWarningSchema$1 = () => zod_v4.z.discriminatedUnion("type", [
20829
20828
  zod_v4.z.object({
20830
20829
  type: zod_v4.z.literal("unsupported"),
20831
20830
  feature: zod_v4.z.string(),
@@ -20846,7 +20845,7 @@ var gatewayTranscriptionWarningSchema$1 = zod_v4.z.discriminatedUnion("type", [
20846
20845
  message: zod_v4.z.string()
20847
20846
  })
20848
20847
  ]);
20849
- var gatewayTranscriptionResponseSchema$1 = zod_v4.z.object({
20848
+ var gatewayTranscriptionResponseSchema$1 = lazySchema$1(() => zodSchema$1(zod_v4.z.object({
20850
20849
  text: zod_v4.z.string(),
20851
20850
  segments: zod_v4.z.array(zod_v4.z.object({
20852
20851
  text: zod_v4.z.string(),
@@ -20855,10 +20854,10 @@ var gatewayTranscriptionResponseSchema$1 = zod_v4.z.object({
20855
20854
  })).optional(),
20856
20855
  language: zod_v4.z.string().nullish(),
20857
20856
  durationInSeconds: zod_v4.z.number().nullish(),
20858
- warnings: zod_v4.z.array(gatewayTranscriptionWarningSchema$1).optional(),
20859
- providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema4).optional()
20860
- });
20861
- var jsonObjectSchema$1 = zod.z.record(zod.z.string(), zod.z.unknown());
20857
+ warnings: zod_v4.z.array(gatewayTranscriptionWarningSchema$1()).optional(),
20858
+ providerMetadata: zod_v4.z.record(zod_v4.z.string(), providerMetadataEntrySchema4()).optional()
20859
+ })));
20860
+ var jsonObjectSchema$1 = () => zod.z.record(zod.z.string(), zod.z.unknown());
20862
20861
  var browserbaseFetchToolFactory$1 = createProviderToolFactoryWithOutputSchema({
20863
20862
  id: "gateway.browserbase_fetch",
20864
20863
  inputSchema: lazySchema$1(() => zodSchema$1(zod.z.object({
@@ -20871,11 +20870,11 @@ var browserbaseFetchToolFactory$1 = createProviderToolFactoryWithOutputSchema({
20871
20870
  "json",
20872
20871
  "markdown"
20873
20872
  ]).optional().describe("Output format. raw returns the response body unchanged, markdown returns page content as Markdown, and json returns structured content using schema."),
20874
- schema: jsonObjectSchema$1.optional().describe("JSON Schema for structured extraction. Only use with format set to json.")
20873
+ schema: jsonObjectSchema$1().optional().describe("JSON Schema for structured extraction. Only use with format set to json.")
20875
20874
  }))),
20876
20875
  outputSchema: lazySchema$1(() => zodSchema$1(zod.z.union([zod.z.object({
20877
20876
  id: zod.z.string(),
20878
- content: zod.z.union([zod.z.string(), jsonObjectSchema$1]),
20877
+ content: zod.z.union([zod.z.string(), jsonObjectSchema$1()]),
20879
20878
  contentType: zod.z.string(),
20880
20879
  encoding: zod.z.string(),
20881
20880
  headers: zod.z.record(zod.z.string(), zod.z.string()),
@@ -21034,41 +21033,67 @@ var exaSearchToolFactory$1 = createProviderToolFactoryWithOutputSchema({
21034
21033
  })])))
21035
21034
  });
21036
21035
  var exaSearch$1 = (config = {}) => exaSearchToolFactory$1(config);
21036
+ var parallelSearchModes$1 = [
21037
+ "turbo",
21038
+ "fast",
21039
+ "basic",
21040
+ "advanced",
21041
+ "one-shot",
21042
+ "agentic"
21043
+ ];
21037
21044
  var parallelSearchToolFactory$1 = createProviderToolFactoryWithOutputSchema({
21038
21045
  id: "gateway.parallel_search",
21039
21046
  inputSchema: lazySchema$1(() => zodSchema$1(zod.z.object({
21040
21047
  objective: zod.z.string().describe("Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),
21041
- search_queries: zod.z.array(zod.z.string()).optional().describe("Optional search queries to supplement the objective. Maximum 200 characters per query."),
21042
- mode: zod.z.enum(["one-shot", "agentic"]).optional().describe("Mode preset: \"one-shot\" for comprehensive results with longer excerpts (default), \"agentic\" for concise, token-efficient results for multi-step workflows."),
21048
+ search_queries: zod.z.array(zod.z.string()).optional().describe("Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."),
21049
+ mode: zod.z.enum(parallelSearchModes$1).optional().describe("Search mode: \"turbo\" and \"fast\" return quickly with shorter excerpts, \"basic\" is balanced (default), \"advanced\" is the most thorough. \"turbo\" supports English and Japanese only. \"one-shot\" and \"agentic\" are deprecated aliases of \"basic\" and \"advanced\"."),
21043
21050
  max_results: zod.z.number().optional().describe("Maximum number of results to return (1-20). Defaults to 10 if not specified."),
21044
21051
  source_policy: zod.z.object({
21045
- include_domains: zod.z.array(zod.z.string()).optional().describe("Limit results to these domains. Use plain domain names only — e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."),
21046
- exclude_domains: zod.z.array(zod.z.string()).optional().describe("Exclude results from these domains. Use plain domain names only — e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."),
21047
- after_date: zod.z.string().optional().describe("Only include results published after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time.")
21052
+ include_domains: zod.z.array(zod.z.string()).optional().describe("Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."),
21053
+ exclude_domains: zod.z.array(zod.z.string()).optional().describe("Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."),
21054
+ after_date: zod.z.string().optional().describe("Only include results published on or after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time.")
21048
21055
  }).optional().describe("Source policy for controlling which domains to include/exclude and freshness."),
21049
21056
  excerpts: zod.z.object({
21050
21057
  max_chars_per_result: zod.z.number().optional().describe("Maximum characters per result."),
21051
- max_chars_total: zod.z.number().optional().describe("Maximum total characters across all results.")
21058
+ max_chars_total: zod.z.number().optional().describe("Deprecated: use the top-level max_chars_total.")
21052
21059
  }).optional().describe("Excerpt configuration for controlling result length."),
21053
- fetch_policy: zod.z.object({ max_age_seconds: zod.z.number().optional().describe("Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.") }).optional().describe("Fetch policy for controlling content freshness.")
21060
+ max_chars_total: zod.z.number().optional().describe("Maximum total characters across all result excerpts."),
21061
+ fetch_policy: zod.z.object({
21062
+ max_age_seconds: zod.z.number().optional().describe("Maximum age of cached content in seconds before a live fetch, minimum 600."),
21063
+ timeout_seconds: zod.z.number().optional().describe("Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."),
21064
+ disable_cache_fallback: zod.z.boolean().optional().describe("Return an error instead of older cached content when a live fetch fails.")
21065
+ }).optional().describe("Fetch policy for controlling content freshness."),
21066
+ location: zod.z.string().optional().describe("ISO 3166-1 alpha-2 country code to localize results, e.g. \"us\".")
21054
21067
  }))),
21055
21068
  outputSchema: lazySchema$1(() => zodSchema$1(zod.z.union([zod.z.object({
21056
- searchId: zod.z.string(),
21069
+ search_id: zod.z.string(),
21057
21070
  results: zod.z.array(zod.z.object({
21058
21071
  url: zod.z.string(),
21059
- title: zod.z.string(),
21060
- excerpt: zod.z.string(),
21061
- publishDate: zod.z.string().nullable().optional(),
21062
- relevanceScore: zod.z.number().optional()
21063
- }))
21072
+ title: zod.z.string().nullable().optional(),
21073
+ publish_date: zod.z.string().nullable().optional(),
21074
+ excerpts: zod.z.array(zod.z.string())
21075
+ })),
21076
+ warnings: zod.z.array(zod.z.object({
21077
+ type: zod.z.string(),
21078
+ message: zod.z.string(),
21079
+ detail: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional()
21080
+ })).nullable().optional(),
21081
+ usage: zod.z.array(zod.z.object({
21082
+ name: zod.z.string(),
21083
+ count: zod.z.number().optional()
21084
+ })).nullable().optional(),
21085
+ session_id: zod.z.string().optional()
21064
21086
  }), zod.z.object({
21065
21087
  error: zod.z.enum([
21066
21088
  "api_error",
21089
+ "configuration_error",
21090
+ "execution_error",
21091
+ "gateway_rate_limit",
21092
+ "invalid_input",
21067
21093
  "rate_limit",
21068
21094
  "timeout",
21069
- "invalid_input",
21070
- "configuration_error",
21071
- "unknown"
21095
+ "unknown",
21096
+ "unknown_tool"
21072
21097
  ]),
21073
21098
  statusCode: zod.z.number().optional(),
21074
21099
  message: zod.z.string()
@@ -21118,7 +21143,7 @@ var perplexitySearchToolFactory$1 = createProviderToolFactoryWithOutputSchema({
21118
21143
  })])))
21119
21144
  });
21120
21145
  var perplexitySearch$1 = (config = {}) => perplexitySearchToolFactory$1(config);
21121
- var takoDataSourceInputSchema$1 = zod.z.object({
21146
+ var takoDataSourceInputSchema$1 = () => zod.z.object({
21122
21147
  count: zod.z.number().optional().describe("Maximum number of data results to return (1-20). When include_contents is true, each additional result adds its own data surcharge."),
21123
21148
  include_contents: zod.z.boolean().optional().describe("Inline rows for each data result. This adds a data surcharge based on row count and dataset source. To estimate cost, search with include_contents disabled and inspect cards.content.export_pricing. This applies to every returned card; limit sources.data.count and sources.data.max_rows to control cost."),
21124
21149
  mode: zod.z.enum(["inline", "url"]).optional().describe("Requested data delivery mode. Search card data is always inline."),
@@ -21132,7 +21157,7 @@ var takoDataSourceInputSchema$1 = zod.z.object({
21132
21157
  node_ids: zod.z.array(zod.z.string()).optional().describe("Data Graph node IDs to prioritize. Maximum 20."),
21133
21158
  strict: zod.z.boolean().optional().describe("Only return cards matching node_ids. Requires a non-empty node_ids.")
21134
21159
  });
21135
- var takoWebSourceInputSchema$1 = zod.z.object({
21160
+ var takoWebSourceInputSchema$1 = () => zod.z.object({
21136
21161
  count: zod.z.number().optional().describe("Maximum number of web results to return (1-20)."),
21137
21162
  include_contents: zod.z.boolean().optional().describe("Inline extracted web page text. This can add a data charge."),
21138
21163
  category: zod.z.enum([
@@ -21156,8 +21181,8 @@ var takoSearchInputSchema$1 = lazySchema$1(() => zodSchema$1(zod.z.object({
21156
21181
  "instant"
21157
21182
  ]).optional().describe("Search effort. fast is the balanced default, instant favors cached results and low latency, and deep broadens retrieval with reranking at higher cost and latency."),
21158
21183
  sources: zod.z.object({
21159
- data: takoDataSourceInputSchema$1.optional(),
21160
- web: takoWebSourceInputSchema$1.optional()
21184
+ data: takoDataSourceInputSchema$1().optional(),
21185
+ web: takoWebSourceInputSchema$1().optional()
21161
21186
  }).optional().describe("Sources to search. Omit to search both curated data and the web. When provided, only keys present are searched."),
21162
21187
  location: zod.z.object({
21163
21188
  latitude: zod.z.number().describe("Latitude between -90 and 90."),
@@ -21172,12 +21197,12 @@ var takoSearchInputSchema$1 = lazySchema$1(() => zodSchema$1(zod.z.object({
21172
21197
  }).optional().describe("Controls card rendering in the search response."),
21173
21198
  include_related: zod.z.number().optional().describe("Maximum related search suggestions to include (1-20).")
21174
21199
  })));
21175
- var takoDatasetCellSchema$1 = zod.z.union([
21200
+ var takoDatasetCellSchema$1 = () => zod.z.union([
21176
21201
  zod.z.boolean(),
21177
21202
  zod.z.number(),
21178
21203
  zod.z.string()
21179
21204
  ]).nullable();
21180
- var takoResultContentSchema$1 = zod.z.object({
21205
+ var takoResultContentSchema$1 = () => zod.z.object({
21181
21206
  content_format: zod.z.enum([
21182
21207
  "card_json",
21183
21208
  "csv",
@@ -21186,7 +21211,7 @@ var takoResultContentSchema$1 = zod.z.object({
21186
21211
  ]).nullish(),
21187
21212
  cost: zod.z.number().optional(),
21188
21213
  data: zod.z.string().nullish(),
21189
- records: zod.z.array(zod.z.record(zod.z.string(), takoDatasetCellSchema$1)).nullish(),
21214
+ records: zod.z.array(zod.z.record(zod.z.string(), takoDatasetCellSchema$1())).nullish(),
21190
21215
  dataset: zod.z.object({
21191
21216
  columns: zod.z.array(zod.z.object({
21192
21217
  name: zod.z.string(),
@@ -21199,7 +21224,7 @@ var takoResultContentSchema$1 = zod.z.object({
21199
21224
  ]),
21200
21225
  unit: zod.z.string().nullish()
21201
21226
  })),
21202
- rows: zod.z.array(zod.z.array(takoDatasetCellSchema$1)),
21227
+ rows: zod.z.array(zod.z.array(takoDatasetCellSchema$1())),
21203
21228
  total_rows: zod.z.number(),
21204
21229
  truncated: zod.z.boolean(),
21205
21230
  ref: zod.z.string(),
@@ -21235,7 +21260,7 @@ var takoResultContentSchema$1 = zod.z.object({
21235
21260
  unit: zod.z.string().nullish()
21236
21261
  })).nullish()
21237
21262
  }).passthrough();
21238
- var takoCardSchema$1 = zod.z.object({
21263
+ var takoCardSchema$1 = () => zod.z.object({
21239
21264
  card_id: zod.z.string().nullish(),
21240
21265
  title: zod.z.string().nullish(),
21241
21266
  description: zod.z.string().nullish(),
@@ -21261,7 +21286,7 @@ var takoCardSchema$1 = zod.z.object({
21261
21286
  "Low",
21262
21287
  "Medium"
21263
21288
  ]).nullish(),
21264
- content: takoResultContentSchema$1.nullish(),
21289
+ content: takoResultContentSchema$1().nullish(),
21265
21290
  exportable: zod.z.boolean().optional(),
21266
21291
  nodes: zod.z.array(zod.z.object({
21267
21292
  id: zod.z.string(),
@@ -21279,21 +21304,21 @@ var takoCardSchema$1 = zod.z.object({
21279
21304
  last_updated: zod.z.string().nullish()
21280
21305
  }).nullish()
21281
21306
  }).passthrough();
21282
- var takoWebResultSchema$1 = zod.z.object({
21307
+ var takoWebResultSchema$1 = () => zod.z.object({
21283
21308
  title: zod.z.string(),
21284
21309
  url: zod.z.string(),
21285
21310
  snippet: zod.z.string().nullish(),
21286
21311
  source_name: zod.z.string().nullish(),
21287
21312
  publish_date: zod.z.string().nullish(),
21288
- content: takoResultContentSchema$1.nullish()
21313
+ content: takoResultContentSchema$1().nullish()
21289
21314
  }).passthrough();
21290
21315
  var takoSearchToolFactory$1 = createProviderToolFactoryWithOutputSchema({
21291
21316
  id: "gateway.tako_search",
21292
21317
  inputSchema: takoSearchInputSchema$1,
21293
21318
  outputSchema: lazySchema$1(() => zodSchema$1(zod.z.union([zod.z.object({
21294
21319
  request_id: zod.z.string(),
21295
- cards: zod.z.array(takoCardSchema$1).optional(),
21296
- web_results: zod.z.array(takoWebResultSchema$1).optional(),
21320
+ cards: zod.z.array(takoCardSchema$1()).optional(),
21321
+ web_results: zod.z.array(takoWebResultSchema$1()).optional(),
21297
21322
  usage: zod.z.object({
21298
21323
  total_cost_usd: zod.z.number(),
21299
21324
  compute: zod.z.object({ cost_usd: zod.z.number() }).nullish(),
@@ -21372,7 +21397,7 @@ async function getVercelRequestId$1() {
21372
21397
  var _a11;
21373
21398
  return (_a11 = getContext$1().headers) == null ? void 0 : _a11["x-vercel-id"];
21374
21399
  }
21375
- var VERSION$4 = "3.0.217";
21400
+ var VERSION$4 = "3.0.221";
21376
21401
  var AI_GATEWAY_PROTOCOL_VERSION$1 = "0.0.1";
21377
21402
  function createGatewayProvider(options = {}) {
21378
21403
  var _a11, _b11;
@@ -22529,7 +22554,7 @@ function getTotalTimeoutMs(timeout) {
22529
22554
  if (typeof timeout === "number") return timeout;
22530
22555
  return timeout.totalMs;
22531
22556
  }
22532
- var VERSION$3 = "6.0.309";
22557
+ var VERSION$3 = "6.0.315";
22533
22558
  var dataContentSchema$3 = zod_v4.z.union([
22534
22559
  zod_v4.z.string(),
22535
22560
  zod_v4.z.instanceof(Uint8Array),
@@ -23936,26 +23961,30 @@ const LF = 10;
23936
23961
  const CR = 13;
23937
23962
  const SPACE = 32;
23938
23963
  function noop(_arg) {}
23939
- function createParser(callbacks) {
23940
- if (typeof callbacks == "function") throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
23941
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
23942
- let isFirstChunk = !0, id, data = "", dataLines = 0, eventType;
23964
+ function createParser(config) {
23965
+ if (typeof config == "function") throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
23966
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config, pendingFragments = [];
23967
+ let pendingFragmentsLength = 0, isFirstChunk = !0, id, data = "", dataLines = 0, eventType, terminated = !1;
23943
23968
  function feed(chunk) {
23969
+ if (terminated) throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
23944
23970
  if (isFirstChunk && (isFirstChunk = !1, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
23945
23971
  const trailing2 = processLines(chunk);
23946
- trailing2 !== "" && pendingFragments.push(trailing2);
23972
+ trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
23947
23973
  return;
23948
23974
  }
23949
23975
  if (chunk.indexOf(`
23950
23976
  `) === -1 && chunk.indexOf("\r") === -1) {
23951
- pendingFragments.push(chunk);
23977
+ pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
23952
23978
  return;
23953
23979
  }
23954
23980
  pendingFragments.push(chunk);
23955
23981
  const input = pendingFragments.join("");
23956
- pendingFragments.length = 0;
23982
+ pendingFragments.length = 0, pendingFragmentsLength = 0;
23957
23983
  const trailing = processLines(input);
23958
- trailing !== "" && pendingFragments.push(trailing);
23984
+ trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
23985
+ }
23986
+ function checkBufferSize() {
23987
+ maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = !0, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, { type: "max-buffer-size-exceeded" }))));
23959
23988
  }
23960
23989
  function processLines(chunk) {
23961
23990
  let searchIndex = 0;
@@ -24019,7 +24048,7 @@ ${value2}`, dataLines++;
24019
24048
  }
24020
24049
  if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
24021
24050
  const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
24022
- id = value2.includes("\0") ? void 0 : value2;
24051
+ value2.includes("\0") || (id = value2);
24023
24052
  return;
24024
24053
  }
24025
24054
  if (firstCharCode === 58) {
@@ -24047,7 +24076,7 @@ ${value2}`, dataLines++;
24047
24076
  ${value}`, dataLines++;
24048
24077
  break;
24049
24078
  case "id":
24050
- id = value.includes("\0") ? void 0 : value;
24079
+ value.includes("\0") || (id = value);
24051
24080
  break;
24052
24081
  case "retry":
24053
24082
  /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(new ParseError(`Invalid \`retry\` value: "${value}"`, {
@@ -24076,7 +24105,7 @@ ${value}`, dataLines++;
24076
24105
  const incompleteLine = pendingFragments.join("");
24077
24106
  parseLine(incompleteLine, 0, incompleteLine.length);
24078
24107
  }
24079
- isFirstChunk = !0, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
24108
+ isFirstChunk = !0, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = !1;
24080
24109
  }
24081
24110
  return {
24082
24111
  feed,
@@ -24090,7 +24119,7 @@ function isEventPrefix(chunk, i, firstCharCode) {
24090
24119
  return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
24091
24120
  }
24092
24121
  var EventSourceParserStream = class extends TransformStream {
24093
- constructor({ onError, onRetry, onComment } = {}) {
24122
+ constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
24094
24123
  let parser;
24095
24124
  super({
24096
24125
  start(controller) {
@@ -24099,10 +24128,11 @@ var EventSourceParserStream = class extends TransformStream {
24099
24128
  controller.enqueue(event);
24100
24129
  },
24101
24130
  onError(error) {
24102
- onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
24131
+ typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
24103
24132
  },
24104
24133
  onRetry,
24105
- onComment
24134
+ onComment,
24135
+ maxBufferSize
24106
24136
  });
24107
24137
  },
24108
24138
  transform(chunk) {
@@ -24388,7 +24418,7 @@ function handleFetchError({ error, url, requestBodyValues }) {
24388
24418
  }
24389
24419
  return error;
24390
24420
  }
24391
- const VERSION$2 = "5.0.62";
24421
+ const VERSION$2 = "5.0.68";
24392
24422
  /**
24393
24423
  * Normalizes different header inputs into a plain record with lower-case keys.
24394
24424
  * Entries with `undefined` or `null` values are removed.
@@ -24520,7 +24550,7 @@ function validateDownloadUrl(url) {
24520
24550
  url,
24521
24551
  message: `URL must have a hostname`
24522
24552
  });
24523
- if (hostname === "localhost" || hostname.endsWith(".local") || hostname.endsWith(".localhost")) throw new DownloadError({
24553
+ if (hostname === "localhost" || hostname.endsWith(".local") || hostname.endsWith(".localhost") || hostname.endsWith(".internal")) throw new DownloadError({
24524
24554
  url,
24525
24555
  message: `URL with hostname ${hostname} is not allowed`
24526
24556
  });
@@ -24894,7 +24924,7 @@ async function readResponseWithSizeLimit({ response, url, maxBytes = DEFAULT_MAX
24894
24924
  url,
24895
24925
  message: `Download of ${url} exceeded maximum size of ${maxBytes} bytes.`
24896
24926
  });
24897
- chunks.push(value);
24927
+ chunks.push(value.byteLength < value.buffer.byteLength ? new Uint8Array(value) : value);
24898
24928
  }
24899
24929
  } finally {
24900
24930
  try {
@@ -26652,6 +26682,132 @@ function resolveSync(value) {
26652
26682
  return next;
26653
26683
  }
26654
26684
  /**
26685
+ * Experimental speech-stream WebSocket envelope (v1): the standard
26686
+ * serialization of `Experimental_StreamingSpeechModelV4.doStream` over a WebSocket. Clients (e.g.
26687
+ * the `@ai-sdk/gateway` provider) encode with this module and servers (e.g.
26688
+ * AI Gateway) decode with it, so the two sides cannot drift.
26689
+ *
26690
+ * Envelope rules:
26691
+ *
26692
+ * 1. The client sends exactly one `speech-stream.start` TEXT frame first.
26693
+ * 2. Input text rides `speech-stream.text-delta` TEXT frames, in order. A
26694
+ * frame may carry its text part's `voice` and `providerOptions`. A long
26695
+ * part may span several frames: `voice` is repeated on each, and
26696
+ * `providerOptions` appear on the first only, so they must describe an
26697
+ * event at the start of the part (e.g. a turn break), not a setting. An
26698
+ * empty `delta` is valid and carries only part metadata; it does not end
26699
+ * the input.
26700
+ * 3. The client signals the end of the input text with the
26701
+ * `speech-stream.text-done` TEXT frame; a plain close without it is an
26702
+ * abort.
26703
+ * 4. Every server→client TEXT frame is one JSON-serialized
26704
+ * `SpeechModelV4StreamPart` (flattened, no wrapper). `audio` payloads are
26705
+ * base64 strings. `Date` values (`response-metadata.timestamp`) serialize
26706
+ * to ISO 8601 strings and are revived by `parseSpeechStreamPart`. `Error`
26707
+ * payloads in `error` parts serialize as `{ name, message }`; servers may
26708
+ * instead send `{ type, message }`, where `type` names an error class the
26709
+ * client can map to a typed error (e.g. `invalid_request_error`).
26710
+ * 5. The server closes with code 1000 after the `finish` part. Over this
26711
+ * envelope an `error` part is terminal: the server sends it on failure and
26712
+ * then closes non-1000. A close without a prior `finish` is an error.
26713
+ * 6. Unknown frame/part types are ignored in both directions (forward
26714
+ * compatibility).
26715
+ * 7. Servers may enforce a maximum frame size (the AI Gateway rejects frames
26716
+ * over 256 KiB); clients should keep text-delta frames under 64 KiB.
26717
+ * 8. Connection establishment (URL, auth) is transport-specific and out of
26718
+ * scope.
26719
+ *
26720
+ * The envelope validates frame shape only; server policy layers on top. Both
26721
+ * parsers use `secureJsonParse`, so frames carrying `__proto__` /
26722
+ * `constructor.prototype` keys are rejected rather than parsed.
26723
+ */
26724
+ /** Type of the first client TEXT frame. */
26725
+ const SPEECH_STREAM_START_FRAME_TYPE = "speech-stream.start";
26726
+ /** Type of the client TEXT frame that carries one input text delta. */
26727
+ const SPEECH_STREAM_TEXT_DELTA_FRAME_TYPE = "speech-stream.text-delta";
26728
+ /** Type of the client TEXT frame that signals the end of the input text. */
26729
+ const SPEECH_STREAM_TEXT_DONE_FRAME_TYPE = "speech-stream.text-done";
26730
+ /**
26731
+ * Client-side: parse a server TEXT frame into a speech stream part. Returns
26732
+ * `undefined` for malformed or unsafe JSON, unknown part types, and known
26733
+ * part types whose fields are missing or mistyped. Revives
26734
+ * `response-metadata.timestamp` to a `Date`.
26735
+ */
26736
+ function parseSpeechStreamPart(text) {
26737
+ let value;
26738
+ try {
26739
+ value = secureJsonParse$3(text);
26740
+ } catch {
26741
+ return;
26742
+ }
26743
+ if (!isRecord$6(value)) return;
26744
+ const part = value;
26745
+ switch (part.type) {
26746
+ case "stream-start": {
26747
+ if (!Array.isArray(part.warnings)) return;
26748
+ const warnings = part.warnings.filter((warning) => !isUnknownWarningType(warning));
26749
+ return warnings.every(isWarning$1) ? {
26750
+ ...part,
26751
+ warnings
26752
+ } : void 0;
26753
+ }
26754
+ case "audio": return isString$1(part.audio) && isAudioFormat(part.audioFormat) && isOptional$1(part.id, isString$1) && isOptional$1(part.providerMetadata, isRecord$6) ? part : void 0;
26755
+ case "finish": return isOptional$1(part.usage, isUsage) && isOptional$1(part.providerMetadata, isRecord$6) ? part : void 0;
26756
+ case "response-metadata": {
26757
+ if (!(isOptional$1(part.modelId, isString$1) && isOptional$1(part.headers, isRecord$6))) return;
26758
+ const timestamp = part.timestamp;
26759
+ if (timestamp == null) return {
26760
+ ...part,
26761
+ timestamp: void 0
26762
+ };
26763
+ if (typeof timestamp !== "string") return;
26764
+ const revived = new Date(timestamp);
26765
+ return Number.isNaN(revived.getTime()) ? void 0 : {
26766
+ ...part,
26767
+ timestamp: revived
26768
+ };
26769
+ }
26770
+ case "raw": return "rawValue" in part ? part : void 0;
26771
+ case "error": return "error" in part ? part : void 0;
26772
+ default: return;
26773
+ }
26774
+ }
26775
+ function isString$1(value) {
26776
+ return typeof value === "string";
26777
+ }
26778
+ function isOptional$1(value, check) {
26779
+ return value === void 0 || check(value);
26780
+ }
26781
+ const knownWarningTypes = /* @__PURE__ */ new Set([
26782
+ "compatibility",
26783
+ "deprecated",
26784
+ "other",
26785
+ "unsupported"
26786
+ ]);
26787
+ function isUnknownWarningType(value) {
26788
+ return isRecord$6(value) && isString$1(value.type) && !knownWarningTypes.has(value.type);
26789
+ }
26790
+ function isWarning$1(value) {
26791
+ if (!isRecord$6(value)) return false;
26792
+ switch (value.type) {
26793
+ case "compatibility":
26794
+ case "unsupported": return isString$1(value.feature) && isOptional$1(value.details, isString$1);
26795
+ case "deprecated": return isString$1(value.setting) && isString$1(value.message);
26796
+ case "other": return isString$1(value.message);
26797
+ default: return false;
26798
+ }
26799
+ }
26800
+ function isAudioFormat(value) {
26801
+ return isRecord$6(value) && isString$1(value.type) && value.type.length > 0 && isOptional$1(value.rate, (rate) => typeof rate === "number" && Number.isFinite(rate) && rate > 0);
26802
+ }
26803
+ function isUsage(value) {
26804
+ return isRecord$6(value) && [
26805
+ "inputCharacters",
26806
+ "inputTokens",
26807
+ "outputTokens"
26808
+ ].every((key) => isOptional$1(value[key], (count) => typeof count === "number"));
26809
+ }
26810
+ /**
26655
26811
  * Experimental transcription-stream WebSocket envelope (v1): the standard
26656
26812
  * serialization of `TranscriptionModelV4.doStream` over a WebSocket. Clients
26657
26813
  * (e.g. the `@ai-sdk/gateway` provider) encode with this module and servers
@@ -26712,12 +26868,12 @@ function parseTranscriptionStreamPart(text) {
26712
26868
  const part = value;
26713
26869
  switch (part.type) {
26714
26870
  case "stream-start": return Array.isArray(part.warnings) && part.warnings.every(isWarning) ? part : void 0;
26715
- case "transcript-delta": return isString$1(part.delta) && isOptional(part.id, isString$1) && isOptional(part.providerMetadata, isRecord$6) ? part : void 0;
26716
- case "transcript-partial": return isString$1(part.text) && isOptional(part.id, isString$1) && isOptional(part.startSecond, isNumber) && isOptional(part.durationInSeconds, isNumber) && isOptional(part.channelIndex, isNumber) && isOptional(part.providerMetadata, isRecord$6) ? part : void 0;
26717
- case "transcript-final": return isString$1(part.text) && isOptional(part.id, isString$1) && isOptional(part.startSecond, isNumber) && isOptional(part.endSecond, isNumber) && isOptional(part.channelIndex, isNumber) && isOptional(part.providerMetadata, isRecord$6) ? part : void 0;
26718
- case "finish": return isString$1(part.text) && Array.isArray(part.segments) && part.segments.every(isSegment) && isOptional(part.language, isString$1) && isOptional(part.durationInSeconds, isNumber) && isOptional(part.usage, isRecord$6) && isOptional(part.providerMetadata, isRecord$6) ? part : void 0;
26871
+ case "transcript-delta": return isString$2(part.delta) && isOptional(part.id, isString$2) && isOptional(part.providerMetadata, isRecord$6) ? part : void 0;
26872
+ case "transcript-partial": return isString$2(part.text) && isOptional(part.id, isString$2) && isOptional(part.startSecond, isNumber) && isOptional(part.durationInSeconds, isNumber) && isOptional(part.channelIndex, isNumber) && isOptional(part.providerMetadata, isRecord$6) ? part : void 0;
26873
+ case "transcript-final": return isString$2(part.text) && isOptional(part.id, isString$2) && isOptional(part.startSecond, isNumber) && isOptional(part.endSecond, isNumber) && isOptional(part.channelIndex, isNumber) && isOptional(part.providerMetadata, isRecord$6) ? part : void 0;
26874
+ case "finish": return isString$2(part.text) && Array.isArray(part.segments) && part.segments.every(isSegment) && isOptional(part.language, isString$2) && isOptional(part.durationInSeconds, isNumber) && isOptional(part.usage, isRecord$6) && isOptional(part.providerMetadata, isRecord$6) ? part : void 0;
26719
26875
  case "response-metadata": {
26720
- if (!(isOptional(part.modelId, isString$1) && isOptional(part.headers, isRecord$6))) return;
26876
+ if (!(isOptional(part.modelId, isString$2) && isOptional(part.headers, isRecord$6))) return;
26721
26877
  const timestamp = part.timestamp;
26722
26878
  if (timestamp == null) return {
26723
26879
  ...part,
@@ -26735,7 +26891,7 @@ function parseTranscriptionStreamPart(text) {
26735
26891
  default: return;
26736
26892
  }
26737
26893
  }
26738
- function isString$1(value) {
26894
+ function isString$2(value) {
26739
26895
  return typeof value === "string";
26740
26896
  }
26741
26897
  function isNumber(value) {
@@ -26745,10 +26901,10 @@ function isOptional(value, check) {
26745
26901
  return value === void 0 || check(value);
26746
26902
  }
26747
26903
  function isWarning(value) {
26748
- return isRecord$6(value) && isString$1(value.type);
26904
+ return isRecord$6(value) && isString$2(value.type);
26749
26905
  }
26750
26906
  function isSegment(value) {
26751
- return isRecord$6(value) && isString$1(value.text) && isNumber(value.startSecond) && isNumber(value.endSecond);
26907
+ return isRecord$6(value) && isString$2(value.text) && isNumber(value.startSecond) && isNumber(value.endSecond);
26752
26908
  }
26753
26909
  function withoutTrailingSlash(url) {
26754
26910
  return url?.replace(/\/$/, "");
@@ -26790,8 +26946,8 @@ async function getVercelOidcToken() {
26790
26946
  throw new Error("@vercel/oidc is not available in the vendored @internal AI packages. Provide an API key instead.");
26791
26947
  }
26792
26948
  /**
26793
- * Shared WebSocket subprotocol contract for AI Gateway realtime and streaming
26794
- * transcription auth.
26949
+ * Shared WebSocket subprotocol contract for AI Gateway realtime, streaming
26950
+ * transcription, and streaming speech auth.
26795
26951
  *
26796
26952
  * The browser `WebSocket` API cannot set request headers, so the Gateway auth
26797
26953
  * (bearer) token is carried through the `Sec-WebSocket-Protocol` handshake
@@ -26800,7 +26956,8 @@ async function getVercelOidcToken() {
26800
26956
  *
26801
26957
  * This module is the single source of truth for that contract so the client and
26802
26958
  * the Gateway server can't drift: the client encodes values with
26803
- * `getGatewayRealtimeProtocols` / `getGatewayTranscriptionProtocols`, and the
26959
+ * `getGatewayRealtimeProtocols` / `getGatewayTranscriptionProtocols` /
26960
+ * `getGatewaySpeechProtocols`, and the
26804
26961
  * Gateway server decodes them with `getGatewayRealtimeAuthToken` /
26805
26962
  * `getGatewayRealtimeTeamIdOrSlug`.
26806
26963
  *
@@ -26821,6 +26978,11 @@ const GATEWAY_REALTIME_SUBPROTOCOL = "ai-gateway-realtime.v1";
26821
26978
  * purpose as `GATEWAY_REALTIME_SUBPROTOCOL`).
26822
26979
  */
26823
26980
  const GATEWAY_TRANSCRIPTION_SUBPROTOCOL = "ai-gateway-transcription.v1";
26981
+ /**
26982
+ * Marker subprotocol for streaming speech handshakes (same negotiation
26983
+ * purpose as `GATEWAY_REALTIME_SUBPROTOCOL`).
26984
+ */
26985
+ const GATEWAY_SPEECH_SUBPROTOCOL = "ai-gateway-speech.v1";
26824
26986
  /** Subprotocol prefix that carries the Gateway auth (bearer) token. */
26825
26987
  const GATEWAY_AUTH_SUBPROTOCOL_PREFIX = "ai-gateway-auth.";
26826
26988
  /** Subprotocol prefix that carries optional Vercel team scoping. */
@@ -26839,6 +27001,13 @@ function getGatewayRealtimeProtocols(token, options) {
26839
27001
  function getGatewayTranscriptionProtocols(token, options) {
26840
27002
  return buildGatewayProtocols(GATEWAY_TRANSCRIPTION_SUBPROTOCOL, token, options);
26841
27003
  }
27004
+ /**
27005
+ * Client-side: `getGatewayRealtimeProtocols`, but with the streaming speech
27006
+ * marker subprotocol.
27007
+ */
27008
+ function getGatewaySpeechProtocols(token, options) {
27009
+ return buildGatewayProtocols(GATEWAY_SPEECH_SUBPROTOCOL, token, options);
27010
+ }
26842
27011
  function buildGatewayProtocols(marker, token, options) {
26843
27012
  const protocols = [marker, `${GATEWAY_AUTH_SUBPROTOCOL_PREFIX}${token}`];
26844
27013
  if (options?.teamIdOrSlug) protocols.push(`${GATEWAY_TEAM_SUBPROTOCOL_PREFIX}${encodeSubprotocolValue(options.teamIdOrSlug)}`);
@@ -27792,7 +27961,7 @@ async function* convertGatewayBatchResultLines(lines) {
27792
27961
  yield item;
27793
27962
  }
27794
27963
  }
27795
- const gatewayBatchItemResultLineSchema = z$3.object({
27964
+ const gatewayBatchItemResultLineSchema = lazySchema(() => zodSchema$4(z$3.object({
27796
27965
  type: z$3.literal("text"),
27797
27966
  id: z$3.string(),
27798
27967
  status: z$3.enum([
@@ -27801,41 +27970,41 @@ const gatewayBatchItemResultLineSchema = z$3.object({
27801
27970
  "failed",
27802
27971
  "succeeded"
27803
27972
  ])
27804
- }).catchall(z$3.unknown());
27805
- const gatewayBatchErrorSchema = z$3.object({
27973
+ }).catchall(z$3.unknown())));
27974
+ const gatewayBatchErrorSchema = () => z$3.object({
27806
27975
  message: z$3.string(),
27807
27976
  type: z$3.string().nullish(),
27808
27977
  code: z$3.string().nullish(),
27809
27978
  statusCode: z$3.number().nullish()
27810
27979
  });
27811
- const gatewayBatchRequestCountsSchema = z$3.object({
27980
+ const gatewayBatchRequestCountsSchema = () => z$3.object({
27812
27981
  total: z$3.number().nullish(),
27813
27982
  pending: z$3.number().nullish(),
27814
27983
  completed: z$3.number().nullish(),
27815
27984
  failed: z$3.number().nullish()
27816
27985
  });
27817
- const gatewayBatchProviderMetadataSchema = z$3.record(z$3.string(), z$3.record(z$3.string(), z$3.unknown()));
27818
- const gatewayBatchStatusFieldsSchema = z$3.object({
27986
+ const gatewayBatchProviderMetadataSchema = () => z$3.record(z$3.string(), z$3.record(z$3.string(), z$3.unknown()));
27987
+ const gatewayBatchStatusFieldsSchema = () => z$3.object({
27819
27988
  status: z$3.enum([
27820
27989
  "completed",
27821
27990
  "failed",
27822
27991
  "pending"
27823
27992
  ]),
27824
27993
  rawStatus: z$3.string().nullish(),
27825
- requestCounts: gatewayBatchRequestCountsSchema.nullish(),
27826
- error: gatewayBatchErrorSchema.nullish(),
27994
+ requestCounts: gatewayBatchRequestCountsSchema().nullish(),
27995
+ error: gatewayBatchErrorSchema().nullish(),
27827
27996
  createdAt: z$3.string().nullish(),
27828
27997
  expiresAt: z$3.string().nullish(),
27829
- providerMetadata: gatewayBatchProviderMetadataSchema.nullish()
27998
+ providerMetadata: gatewayBatchProviderMetadataSchema().nullish()
27830
27999
  });
27831
- const gatewayBatchStartResponseSchema = gatewayBatchStatusFieldsSchema.extend({
28000
+ const gatewayBatchStartResponseSchema = lazySchema(() => zodSchema$4(gatewayBatchStatusFieldsSchema().extend({
27832
28001
  batchId: z$3.string(),
27833
28002
  warnings: z$3.array(z$3.object({
27834
28003
  requestId: z$3.string().nullish(),
27835
28004
  warning: z$3.unknown()
27836
28005
  }).catchall(z$3.unknown())).nullish()
27837
- });
27838
- const gatewayBatchStatusResponseSchema = gatewayBatchStatusFieldsSchema;
28006
+ })));
28007
+ const gatewayBatchStatusResponseSchema = lazySchema(() => zodSchema$4(gatewayBatchStatusFieldsSchema()));
27839
28008
  var GatewayLanguageModel = class GatewayLanguageModel {
27840
28009
  static [WORKFLOW_SERIALIZE](model) {
27841
28010
  return serializeModelOptions({
@@ -28032,7 +28201,7 @@ var GatewayEmbeddingModel = class GatewayEmbeddingModel {
28032
28201
  };
28033
28202
  }
28034
28203
  };
28035
- const gatewayEmbeddingWarningSchema = z$3.discriminatedUnion("type", [
28204
+ const gatewayEmbeddingWarningSchema = () => z$3.discriminatedUnion("type", [
28036
28205
  z$3.object({
28037
28206
  type: z$3.literal("unsupported"),
28038
28207
  feature: z$3.string(),
@@ -28056,7 +28225,7 @@ const gatewayEmbeddingWarningSchema = z$3.discriminatedUnion("type", [
28056
28225
  const gatewayEmbeddingResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
28057
28226
  embeddings: z$3.array(z$3.array(z$3.number())),
28058
28227
  usage: z$3.object({ tokens: z$3.number() }).nullish(),
28059
- warnings: z$3.array(gatewayEmbeddingWarningSchema).optional(),
28228
+ warnings: z$3.array(gatewayEmbeddingWarningSchema()).optional(),
28060
28229
  providerMetadata: z$3.record(z$3.string(), z$3.record(z$3.string(), z$3.unknown())).optional()
28061
28230
  })));
28062
28231
  var GatewayImageModel = class GatewayImageModel {
@@ -28139,8 +28308,8 @@ function maybeEncodeImageFile(file) {
28139
28308
  };
28140
28309
  return file;
28141
28310
  }
28142
- const providerMetadataEntrySchema$3 = z$3.object({ images: z$3.array(z$3.unknown()).optional() }).catchall(z$3.unknown());
28143
- const gatewayImageWarningSchema = z$3.discriminatedUnion("type", [
28311
+ const providerMetadataEntrySchema$3 = () => z$3.object({ images: z$3.array(z$3.unknown()).optional() }).catchall(z$3.unknown());
28312
+ const gatewayImageWarningSchema = () => z$3.discriminatedUnion("type", [
28144
28313
  z$3.object({
28145
28314
  type: z$3.literal("unsupported"),
28146
28315
  feature: z$3.string(),
@@ -28161,18 +28330,18 @@ const gatewayImageWarningSchema = z$3.discriminatedUnion("type", [
28161
28330
  message: z$3.string()
28162
28331
  })
28163
28332
  ]);
28164
- const gatewayImageUsageSchema = z$3.object({
28333
+ const gatewayImageUsageSchema = () => z$3.object({
28165
28334
  inputTokens: z$3.number().nullish(),
28166
28335
  outputTokens: z$3.number().nullish(),
28167
28336
  totalTokens: z$3.number().nullish()
28168
28337
  });
28169
- const gatewayImageResponseSchema = z$3.object({
28338
+ const gatewayImageResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
28170
28339
  images: z$3.array(z$3.string()),
28171
28340
  isRetryable: z$3.boolean().optional(),
28172
- warnings: z$3.array(gatewayImageWarningSchema).optional(),
28173
- providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$3).optional(),
28174
- usage: gatewayImageUsageSchema.optional()
28175
- });
28341
+ warnings: z$3.array(gatewayImageWarningSchema()).optional(),
28342
+ providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$3()).optional(),
28343
+ usage: gatewayImageUsageSchema().optional()
28344
+ })));
28176
28345
  var GatewayVideoModel = class {
28177
28346
  constructor(modelId, config) {
28178
28347
  this.modelId = modelId;
@@ -28392,8 +28561,8 @@ function maybeEncodeVideoFile(file) {
28392
28561
  };
28393
28562
  return file;
28394
28563
  }
28395
- const providerMetadataEntrySchema$2 = z$3.object({ videos: z$3.array(z$3.unknown()).optional() }).catchall(z$3.unknown());
28396
- const gatewayVideoDataSchema = z$3.union([z$3.object({
28564
+ const providerMetadataEntrySchema$2 = () => z$3.object({ videos: z$3.array(z$3.unknown()).optional() }).catchall(z$3.unknown());
28565
+ const gatewayVideoDataSchema = () => z$3.union([z$3.object({
28397
28566
  type: z$3.literal("url"),
28398
28567
  url: z$3.string(),
28399
28568
  mediaType: z$3.string()
@@ -28402,7 +28571,7 @@ const gatewayVideoDataSchema = z$3.union([z$3.object({
28402
28571
  data: z$3.string(),
28403
28572
  mediaType: z$3.string()
28404
28573
  })]);
28405
- const gatewayVideoWarningSchema = z$3.discriminatedUnion("type", [
28574
+ const gatewayVideoWarningSchema = () => z$3.discriminatedUnion("type", [
28406
28575
  z$3.object({
28407
28576
  type: z$3.literal("unsupported"),
28408
28577
  feature: z$3.string(),
@@ -28423,56 +28592,56 @@ const gatewayVideoWarningSchema = z$3.discriminatedUnion("type", [
28423
28592
  message: z$3.string()
28424
28593
  })
28425
28594
  ]);
28426
- const gatewayVideoEventSchema = z$3.discriminatedUnion("type", [z$3.object({
28595
+ const gatewayVideoEventSchema = lazySchema(() => zodSchema$4(z$3.discriminatedUnion("type", [z$3.object({
28427
28596
  type: z$3.literal("result"),
28428
- videos: z$3.array(gatewayVideoDataSchema),
28429
- warnings: z$3.array(gatewayVideoWarningSchema).optional(),
28430
- providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2).optional()
28597
+ videos: z$3.array(gatewayVideoDataSchema()),
28598
+ warnings: z$3.array(gatewayVideoWarningSchema()).optional(),
28599
+ providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2()).optional()
28431
28600
  }), z$3.object({
28432
28601
  type: z$3.literal("error"),
28433
28602
  message: z$3.string(),
28434
28603
  errorType: z$3.string(),
28435
28604
  statusCode: z$3.number(),
28436
28605
  param: z$3.unknown().nullable()
28437
- })]);
28438
- const gatewayVideoStartResponseSchema = z$3.object({
28606
+ })])));
28607
+ const gatewayVideoStartResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
28439
28608
  operation: z$3.unknown(),
28440
- warnings: z$3.array(gatewayVideoWarningSchema).nullish(),
28441
- providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2).nullish()
28442
- });
28443
- const gatewayVideoStatusResponseSchema = z$3.discriminatedUnion("status", [
28609
+ warnings: z$3.array(gatewayVideoWarningSchema()).nullish(),
28610
+ providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2()).nullish()
28611
+ })));
28612
+ const gatewayVideoStatusResponseSchema = lazySchema(() => zodSchema$4(z$3.discriminatedUnion("status", [
28444
28613
  z$3.object({
28445
28614
  status: z$3.literal("pending"),
28446
- warnings: z$3.array(gatewayVideoWarningSchema).nullish(),
28447
- providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2).nullish()
28615
+ warnings: z$3.array(gatewayVideoWarningSchema()).nullish(),
28616
+ providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2()).nullish()
28448
28617
  }),
28449
28618
  z$3.object({
28450
28619
  status: z$3.literal("completed"),
28451
- videos: z$3.array(gatewayVideoDataSchema),
28452
- warnings: z$3.array(gatewayVideoWarningSchema).nullish(),
28453
- providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2).nullish()
28620
+ videos: z$3.array(gatewayVideoDataSchema()),
28621
+ warnings: z$3.array(gatewayVideoWarningSchema()).nullish(),
28622
+ providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2()).nullish()
28454
28623
  }),
28455
28624
  z$3.object({
28456
28625
  status: z$3.literal("error"),
28457
28626
  error: z$3.string(),
28458
- providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2).nullish()
28627
+ providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2()).nullish()
28459
28628
  }),
28460
28629
  z$3.object({
28461
28630
  status: z$3.literal("cancelled"),
28462
- providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2).nullish()
28631
+ providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$2()).nullish()
28463
28632
  })
28464
- ]);
28465
- const gatewayDecisionProviderOptionsSchema = lazySchema(() => zodSchema$4(z$3.object({ models: gatewayModelFallbacksSchema.optional() }).catchall(z$3.unknown())));
28466
- const probabilitySchema = z$3.number().finite().min(0).max(1);
28467
- const questionSchema = z$3.string().min(1).max(256);
28468
- const directConditionSchema = z$3.union([z$3.object({
28469
- question: questionSchema.optional(),
28470
- confidenceBelow: probabilitySchema
28633
+ ])));
28634
+ const gatewayDecisionProviderOptionsSchema = lazySchema(() => zodSchema$4(z$3.object({ models: gatewayModelFallbacksSchema().optional() }).catchall(z$3.unknown())));
28635
+ const probabilitySchema = () => z$3.number().finite().min(0).max(1);
28636
+ const questionSchema = () => z$3.string().min(1).max(256);
28637
+ const directConditionSchema = () => z$3.union([z$3.object({
28638
+ question: questionSchema().optional(),
28639
+ confidenceBelow: probabilitySchema()
28471
28640
  }).strict(), z$3.object({
28472
- question: questionSchema.optional(),
28473
- probabilityBetween: z$3.array(probabilitySchema).length(2).refine(([minimum, maximum]) => minimum <= maximum, { message: "probabilityBetween minimum must be less than or equal to maximum" })
28641
+ question: questionSchema().optional(),
28642
+ probabilityBetween: z$3.array(probabilitySchema()).length(2).refine(([minimum, maximum]) => minimum <= maximum, { message: "probabilityBetween minimum must be less than or equal to maximum" })
28474
28643
  }).strict()]);
28475
- const groupBeyondMaxDepthSchema = z$3.union([
28644
+ const groupBeyondMaxDepthSchema = () => z$3.union([
28476
28645
  z$3.object({ any: z$3.unknown() }),
28477
28646
  z$3.object({ all: z$3.unknown() }),
28478
28647
  z$3.object({ atLeast: z$3.unknown() })
@@ -28482,11 +28651,11 @@ const groupBeyondMaxDepthSchema = z$3.union([
28482
28651
  message: `conditions can be nested at most 5 levels deep`
28483
28652
  });
28484
28653
  });
28485
- const conditionalModelFallbackSchema = z$3.object({
28654
+ const conditionalModelFallbackSchema = () => z$3.object({
28486
28655
  model: z$3.string().min(1),
28487
28656
  when: conditionSchema(1)
28488
28657
  }).strict();
28489
- const gatewayModelFallbacksSchema = z$3.array(z$3.union([z$3.string(), conditionalModelFallbackSchema])).superRefine((entries, context) => {
28658
+ const gatewayModelFallbacksSchema = () => z$3.array(z$3.union([z$3.string(), conditionalModelFallbackSchema()])).superRefine((entries, context) => {
28490
28659
  const conditionalIndexes = entries.flatMap((entry, index) => typeof entry === "string" ? [] : [index]);
28491
28660
  if (conditionalIndexes.length > 1) context.addIssue({
28492
28661
  code: "custom",
@@ -28499,11 +28668,11 @@ const gatewayModelFallbacksSchema = z$3.array(z$3.union([z$3.string(), condition
28499
28668
  });
28500
28669
  });
28501
28670
  function conditionSchema(depth) {
28502
- if (depth === 5) return z$3.union([directConditionSchema, groupBeyondMaxDepthSchema]);
28671
+ if (depth === 5) return z$3.union([directConditionSchema(), groupBeyondMaxDepthSchema()]);
28503
28672
  const childConditionSchema = conditionSchema(depth + 1);
28504
28673
  const conditionListSchema = z$3.array(childConditionSchema).min(1).max(20);
28505
28674
  return z$3.union([
28506
- directConditionSchema,
28675
+ directConditionSchema(),
28507
28676
  z$3.object({ any: conditionListSchema }).strict(),
28508
28677
  z$3.object({ all: conditionListSchema }).strict(),
28509
28678
  z$3.object({ atLeast: z$3.object({
@@ -28533,7 +28702,7 @@ var GatewayDecisionModel = class {
28533
28702
  doEvaluate(options) {
28534
28703
  return this.doDecide(options);
28535
28704
  }
28536
- async doDecide({ state, questions, headers, abortSignal, providerOptions }) {
28705
+ async doDecide({ state, questions, maxOutputTokens, reasoning, headers, abortSignal, providerOptions }) {
28537
28706
  const stateParts = toGatewayDecisionState(state);
28538
28707
  const gatewayOptions = await parseProviderOptions({
28539
28708
  provider: "gateway",
@@ -28552,6 +28721,8 @@ var GatewayDecisionModel = class {
28552
28721
  body: {
28553
28722
  stateParts,
28554
28723
  questions,
28724
+ maxOutputTokens,
28725
+ reasoning,
28555
28726
  ...validatedProviderOptions ? { providerOptions: validatedProviderOptions } : {}
28556
28727
  },
28557
28728
  successfulResponseHandler: createJsonResponseHandler(gatewayDecisionResponseSchema),
@@ -28588,7 +28759,7 @@ var GatewayDecisionModel = class {
28588
28759
  };
28589
28760
  }
28590
28761
  };
28591
- const gatewayDecisionAnswerSchema = z$3.discriminatedUnion("type", [
28762
+ const gatewayDecisionAnswerSchema = () => z$3.discriminatedUnion("type", [
28592
28763
  z$3.object({
28593
28764
  type: z$3.literal("choice"),
28594
28765
  choice: z$3.string(),
@@ -28605,7 +28776,7 @@ const gatewayDecisionAnswerSchema = z$3.discriminatedUnion("type", [
28605
28776
  }),
28606
28777
  z$3.object({ type: z$3.literal("refusal") })
28607
28778
  ]);
28608
- const gatewayDecisionWarningSchema = z$3.discriminatedUnion("type", [
28779
+ const gatewayDecisionWarningSchema = () => z$3.discriminatedUnion("type", [
28609
28780
  z$3.object({
28610
28781
  type: z$3.literal("unsupported"),
28611
28782
  feature: z$3.string(),
@@ -28627,7 +28798,7 @@ const gatewayDecisionWarningSchema = z$3.discriminatedUnion("type", [
28627
28798
  })
28628
28799
  ]);
28629
28800
  const gatewayDecisionResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
28630
- answers: z$3.record(z$3.string(), gatewayDecisionAnswerSchema),
28801
+ answers: z$3.record(z$3.string(), gatewayDecisionAnswerSchema()),
28631
28802
  model: z$3.string().optional(),
28632
28803
  rounding: z$3.object({
28633
28804
  probabilityDecimals: z$3.number().optional(),
@@ -28637,7 +28808,7 @@ const gatewayDecisionResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
28637
28808
  inputTokens: z$3.number().optional(),
28638
28809
  outputTokens: z$3.number().optional()
28639
28810
  }).optional(),
28640
- warnings: z$3.array(gatewayDecisionWarningSchema).optional(),
28811
+ warnings: z$3.array(gatewayDecisionWarningSchema()).optional(),
28641
28812
  providerMetadata: z$3.record(z$3.string(), z$3.record(z$3.string(), z$3.unknown())).optional()
28642
28813
  })));
28643
28814
  function toGatewayDecisionState(state) {
@@ -28706,7 +28877,7 @@ var GatewayRerankingModel = class {
28706
28877
  };
28707
28878
  }
28708
28879
  };
28709
- const gatewayRerankingWarningSchema = z$3.discriminatedUnion("type", [
28880
+ const gatewayRerankingWarningSchema = () => z$3.discriminatedUnion("type", [
28710
28881
  z$3.object({
28711
28882
  type: z$3.literal("unsupported"),
28712
28883
  feature: z$3.string(),
@@ -28732,95 +28903,49 @@ const gatewayRerankingResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
28732
28903
  index: z$3.number(),
28733
28904
  relevanceScore: z$3.number()
28734
28905
  })),
28735
- warnings: z$3.array(gatewayRerankingWarningSchema).optional(),
28906
+ warnings: z$3.array(gatewayRerankingWarningSchema()).optional(),
28736
28907
  providerMetadata: z$3.record(z$3.string(), z$3.record(z$3.string(), z$3.unknown())).optional()
28737
28908
  })));
28738
- var GatewaySpeechModel = class {
28739
- constructor(modelId, config) {
28740
- this.modelId = modelId;
28741
- this.config = config;
28742
- this.specificationVersion = "v4";
28743
- }
28744
- get provider() {
28745
- return this.config.provider;
28746
- }
28747
- async doGenerate({ text, voice, outputFormat, instructions, speed, language, providerOptions, headers, abortSignal }) {
28748
- const resolvedHeaders = this.config.headers ? await resolve$3(this.config.headers) : void 0;
28749
- try {
28750
- const { responseHeaders, value: responseBody, rawValue } = await postJsonToApi({
28751
- url: this.getUrl(),
28752
- headers: combineHeaders(resolvedHeaders, headers ?? {}, this.getModelConfigHeaders(), await resolve$3(this.config.o11yHeaders)),
28753
- body: {
28754
- text,
28755
- ...voice && { voice },
28756
- ...outputFormat && { outputFormat },
28757
- ...instructions && { instructions },
28758
- ...speed != null && { speed },
28759
- ...language && { language },
28760
- ...providerOptions && { providerOptions }
28761
- },
28762
- successfulResponseHandler: createJsonResponseHandler(gatewaySpeechResponseSchema),
28763
- failedResponseHandler: createJsonErrorResponseHandler({
28764
- errorSchema: z$3.any(),
28765
- errorToMessage: (data) => getErrorMessage(data) ?? "unknown error"
28766
- }),
28767
- ...abortSignal && { abortSignal },
28768
- fetch: this.config.fetch
28769
- });
28770
- return {
28771
- audio: responseBody.audio,
28772
- warnings: responseBody.warnings ?? [],
28773
- ...responseBody.usage != null && { usage: responseBody.usage },
28774
- providerMetadata: responseBody.providerMetadata,
28775
- response: {
28776
- timestamp: /* @__PURE__ */ new Date(),
28777
- modelId: this.modelId,
28778
- headers: responseHeaders,
28779
- body: rawValue
28780
- }
28781
- };
28782
- } catch (error) {
28783
- throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders ?? {}));
28784
- }
28785
- }
28786
- getUrl() {
28787
- return `${this.config.baseURL}/speech-model`;
28788
- }
28789
- getModelConfigHeaders() {
28790
- return {
28791
- "ai-speech-model-specification-version": "4",
28792
- "ai-model-id": this.modelId
28793
- };
28794
- }
28909
+ /**
28910
+ * `asGatewayError` is async while the WebSocket event handlers are
28911
+ * synchronous, hence this helper.
28912
+ */
28913
+ async function errorControllerWithGatewayError(controller, error, authMethod) {
28914
+ controller.error(await asGatewayError(error, authMethod));
28915
+ }
28916
+ /**
28917
+ * Extract a human-readable message from an `error` stream part's payload for
28918
+ * the terminal close error.
28919
+ */
28920
+ function getServerErrorMessage(error) {
28921
+ if (error != null && typeof error === "object" && "message" in error && typeof error.message === "string") return error.message;
28922
+ return getErrorMessage(error);
28923
+ }
28924
+ /** Canonical status codes for server error-part types (no HTTP status exists on the WebSocket). */
28925
+ const SERVER_ERROR_STATUS_CODES = {
28926
+ authentication_error: 401,
28927
+ failed_dependency: 424,
28928
+ forbidden: 403,
28929
+ internal_server_error: 500,
28930
+ invalid_request_error: 400,
28931
+ model_not_found: 404,
28932
+ rate_limit_exceeded: 429
28795
28933
  };
28796
- const providerMetadataEntrySchema$1 = z$3.object({}).catchall(z$3.unknown());
28797
- const gatewaySpeechWarningSchema = z$3.discriminatedUnion("type", [
28798
- z$3.object({
28799
- type: z$3.literal("unsupported"),
28800
- feature: z$3.string(),
28801
- details: z$3.string().optional()
28802
- }),
28803
- z$3.object({
28804
- type: z$3.literal("compatibility"),
28805
- feature: z$3.string(),
28806
- details: z$3.string().optional()
28807
- }),
28808
- z$3.object({
28809
- type: z$3.literal("deprecated"),
28810
- setting: z$3.string(),
28811
- message: z$3.string()
28812
- }),
28813
- z$3.object({
28814
- type: z$3.literal("other"),
28815
- message: z$3.string()
28816
- })
28817
- ]);
28818
- const gatewaySpeechResponseSchema = z$3.object({
28819
- audio: z$3.string(),
28820
- warnings: z$3.array(gatewaySpeechWarningSchema).optional(),
28821
- usage: z$3.record(z$3.string(), z$3.json()).optional(),
28822
- providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$1).optional()
28823
- });
28934
+ /**
28935
+ * Maps a server error-part payload (`{ message, type }`) to the public
28936
+ * Gateway error class for its type; unknown shapes keep the generic message.
28937
+ */
28938
+ async function createErrorFromServerErrorPart(error, authMethod, streamLabel = "transcription") {
28939
+ if (typeof error === "object" && error != null && "message" in error && typeof error.message === "string" && "type" in error && typeof error.type === "string" && error.type in SERVER_ERROR_STATUS_CODES) return createGatewayErrorFromResponse({
28940
+ response: { error: {
28941
+ message: error.message,
28942
+ type: error.type
28943
+ } },
28944
+ statusCode: SERVER_ERROR_STATUS_CODES[error.type],
28945
+ authMethod
28946
+ });
28947
+ return /* @__PURE__ */ new Error(`AI Gateway ${streamLabel} stream failed: ${getServerErrorMessage(error)}`);
28948
+ }
28824
28949
  var GatewayTranscriptionModel = class {
28825
28950
  constructor(modelId, config) {
28826
28951
  this.modelId = modelId;
@@ -28940,11 +29065,11 @@ function toGatewayTranscriptionUrl(baseURL, modelId) {
28940
29065
  * case-insensitive because `combineHeaders` does not normalize casing and
28941
29066
  * callers can pass arbitrary casing via the `headers` option.
28942
29067
  */
28943
- function getProtocolsFromHeaders(headers) {
29068
+ function getProtocolsFromHeaders(headers, { marker = GATEWAY_TRANSCRIPTION_SUBPROTOCOL, getProtocols = getGatewayTranscriptionProtocols } = {}) {
28944
29069
  const normalizedHeaders = normalizeHeaders(headers);
28945
29070
  const authorization = normalizedHeaders.authorization;
28946
29071
  const token = authorization?.startsWith("Bearer ") ? authorization.slice(7) : void 0;
28947
- return token == null ? [GATEWAY_TRANSCRIPTION_SUBPROTOCOL] : getGatewayTranscriptionProtocols(token, { teamIdOrSlug: normalizedHeaders[VERCEL_AI_GATEWAY_TEAM_HEADER] });
29072
+ return token == null ? [marker] : getProtocols(token, { teamIdOrSlug: normalizedHeaders[VERCEL_AI_GATEWAY_TEAM_HEADER] });
28948
29073
  }
28949
29074
  /** Audio frames stay under server frame-size limits (envelope rule 7). */
28950
29075
  const MAX_AUDIO_FRAME_BYTES = 65536;
@@ -29051,8 +29176,8 @@ function createGatewayTranscriptionStream({ webSocket, url, protocols, headers,
29051
29176
  }
29052
29177
  });
29053
29178
  }
29054
- const providerMetadataEntrySchema = z$3.object({}).catchall(z$3.unknown());
29055
- const gatewayTranscriptionWarningSchema = z$3.discriminatedUnion("type", [
29179
+ const providerMetadataEntrySchema$1 = () => z$3.object({}).catchall(z$3.unknown());
29180
+ const gatewayTranscriptionWarningSchema = () => z$3.discriminatedUnion("type", [
29056
29181
  z$3.object({
29057
29182
  type: z$3.literal("unsupported"),
29058
29183
  feature: z$3.string(),
@@ -29073,7 +29198,7 @@ const gatewayTranscriptionWarningSchema = z$3.discriminatedUnion("type", [
29073
29198
  message: z$3.string()
29074
29199
  })
29075
29200
  ]);
29076
- const gatewayTranscriptionResponseSchema = z$3.object({
29201
+ const gatewayTranscriptionResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
29077
29202
  text: z$3.string(),
29078
29203
  segments: z$3.array(z$3.object({
29079
29204
  text: z$3.string(),
@@ -29082,50 +29207,274 @@ const gatewayTranscriptionResponseSchema = z$3.object({
29082
29207
  })).optional(),
29083
29208
  language: z$3.string().nullish(),
29084
29209
  durationInSeconds: z$3.number().nullish(),
29085
- warnings: z$3.array(gatewayTranscriptionWarningSchema).optional(),
29210
+ warnings: z$3.array(gatewayTranscriptionWarningSchema()).optional(),
29086
29211
  usage: z$3.record(z$3.string(), z$3.json()).optional(),
29087
- providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema).optional()
29088
- });
29212
+ providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema$1()).optional()
29213
+ })));
29214
+ var GatewaySpeechModel = class {
29215
+ constructor(modelId, config) {
29216
+ this.modelId = modelId;
29217
+ this.config = config;
29218
+ this.specificationVersion = "v4";
29219
+ }
29220
+ get provider() {
29221
+ return this.config.provider;
29222
+ }
29223
+ async doGenerate({ text, voice, outputFormat, instructions, speed, language, providerOptions, headers, abortSignal }) {
29224
+ const resolvedHeaders = this.config.headers ? await resolve$3(this.config.headers) : void 0;
29225
+ try {
29226
+ const { responseHeaders, value: responseBody, rawValue } = await postJsonToApi({
29227
+ url: this.getUrl(),
29228
+ headers: combineHeaders(resolvedHeaders, headers ?? {}, this.getModelConfigHeaders(), await resolve$3(this.config.o11yHeaders)),
29229
+ body: {
29230
+ text,
29231
+ ...voice && { voice },
29232
+ ...outputFormat && { outputFormat },
29233
+ ...instructions && { instructions },
29234
+ ...speed != null && { speed },
29235
+ ...language && { language },
29236
+ ...providerOptions && { providerOptions }
29237
+ },
29238
+ successfulResponseHandler: createJsonResponseHandler(gatewaySpeechResponseSchema),
29239
+ failedResponseHandler: createJsonErrorResponseHandler({
29240
+ errorSchema: z$3.any(),
29241
+ errorToMessage: (data) => getErrorMessage(data) ?? "unknown error"
29242
+ }),
29243
+ ...abortSignal && { abortSignal },
29244
+ fetch: this.config.fetch
29245
+ });
29246
+ return {
29247
+ audio: responseBody.audio,
29248
+ warnings: responseBody.warnings ?? [],
29249
+ ...responseBody.usage != null && { usage: responseBody.usage },
29250
+ providerMetadata: responseBody.providerMetadata,
29251
+ response: {
29252
+ timestamp: /* @__PURE__ */ new Date(),
29253
+ modelId: this.modelId,
29254
+ headers: responseHeaders,
29255
+ body: rawValue
29256
+ }
29257
+ };
29258
+ } catch (error) {
29259
+ throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders ?? {}));
29260
+ }
29261
+ }
29262
+ async doStream(options) {
29263
+ const currentDate = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date();
29264
+ const headers = combineHeaders(await resolve$3(this.config.headers ?? {}), options.headers ?? {}, this.getModelConfigHeaders(), await resolve$3(this.config.o11yHeaders));
29265
+ const authMethod = await parseAuthMethod(headers);
29266
+ const startFrame = {
29267
+ type: SPEECH_STREAM_START_FRAME_TYPE,
29268
+ ...options.voice != null && { voice: options.voice },
29269
+ ...options.outputFormat != null && { outputFormat: options.outputFormat },
29270
+ ...options.instructions != null && { instructions: options.instructions },
29271
+ ...options.speed != null && { speed: options.speed },
29272
+ ...options.language != null && { language: options.language },
29273
+ ...options.providerOptions != null && { providerOptions: options.providerOptions },
29274
+ ...options.includeRawChunks != null && { includeRawChunks: options.includeRawChunks }
29275
+ };
29276
+ return {
29277
+ stream: createGatewaySpeechStream({
29278
+ webSocket: this.config.webSocket,
29279
+ url: toGatewaySpeechUrl(this.config.baseURL, this.modelId),
29280
+ protocols: getProtocolsFromHeaders(headers, {
29281
+ marker: GATEWAY_SPEECH_SUBPROTOCOL,
29282
+ getProtocols: getGatewaySpeechProtocols
29283
+ }),
29284
+ headers,
29285
+ startFrame,
29286
+ text: options.text,
29287
+ abortSignal: options.abortSignal,
29288
+ authMethod
29289
+ }),
29290
+ request: { body: startFrame },
29291
+ response: {
29292
+ timestamp: currentDate,
29293
+ modelId: this.modelId
29294
+ }
29295
+ };
29296
+ }
29297
+ getUrl() {
29298
+ return `${this.config.baseURL}/speech-model`;
29299
+ }
29300
+ getModelConfigHeaders() {
29301
+ return {
29302
+ "ai-speech-model-specification-version": "4",
29303
+ "ai-model-id": this.modelId
29304
+ };
29305
+ }
29306
+ };
29089
29307
  /**
29090
- * `asGatewayError` is async while the WebSocket event handlers are
29091
- * synchronous, hence this helper.
29308
+ * Gateway streaming speech WebSocket URL: HTTP(S) base upgraded to WS(S),
29309
+ * model id in `?ai-model-id=` (browser `WebSocket` cannot set headers).
29092
29310
  */
29093
- async function errorControllerWithGatewayError(controller, error, authMethod) {
29094
- controller.error(await asGatewayError(error, authMethod));
29311
+ function toGatewaySpeechUrl(baseURL, modelId) {
29312
+ const url = new URL(`${baseURL.replace(/^http/, "ws")}/speech-model`);
29313
+ url.searchParams.set("ai-model-id", modelId);
29314
+ return url.toString();
29095
29315
  }
29096
29316
  /**
29097
- * Extract a human-readable message from an `error` stream part's payload for
29098
- * the terminal close error.
29317
+ * Keeps text-delta frames under 64 KiB (envelope rule 7) even when JSON
29318
+ * escapes every code unit as `\uXXXX`.
29099
29319
  */
29100
- function getServerErrorMessage(error) {
29101
- if (error != null && typeof error === "object" && "message" in error && typeof error.message === "string") return error.message;
29102
- return getErrorMessage(error);
29103
- }
29104
- /** Canonical status codes for server error-part types (no HTTP status exists on the WebSocket). */
29105
- const SERVER_ERROR_STATUS_CODES = {
29106
- authentication_error: 401,
29107
- failed_dependency: 424,
29108
- forbidden: 403,
29109
- internal_server_error: 500,
29110
- invalid_request_error: 400,
29111
- model_not_found: 404,
29112
- rate_limit_exceeded: 429
29113
- };
29320
+ const MAX_TEXT_DELTA_CODE_UNITS = 8192;
29114
29321
  /**
29115
- * Maps a server error-part payload (`{ message, type }`) to the public
29116
- * Gateway error class for its type; unknown shapes keep the generic message.
29322
+ * Splits a long text delta into pieces of at most `MAX_TEXT_DELTA_CODE_UNITS`
29323
+ * UTF-16 code units without separating a surrogate pair.
29117
29324
  */
29118
- async function createErrorFromServerErrorPart(error, authMethod) {
29119
- if (typeof error === "object" && error != null && "message" in error && typeof error.message === "string" && "type" in error && typeof error.type === "string" && error.type in SERVER_ERROR_STATUS_CODES) return createGatewayErrorFromResponse({
29120
- response: { error: {
29121
- message: error.message,
29122
- type: error.type
29123
- } },
29124
- statusCode: SERVER_ERROR_STATUS_CODES[error.type],
29125
- authMethod
29325
+ function splitTextDelta(delta) {
29326
+ const pieces = [];
29327
+ let offset = 0;
29328
+ while (offset < delta.length) {
29329
+ let end = Math.min(offset + MAX_TEXT_DELTA_CODE_UNITS, delta.length);
29330
+ const lastCodeUnit = delta.charCodeAt(end - 1);
29331
+ if (end < delta.length && lastCodeUnit >= 55296 && lastCodeUnit <= 56319) end--;
29332
+ pieces.push(delta.slice(offset, end));
29333
+ offset = end;
29334
+ }
29335
+ return pieces;
29336
+ }
29337
+ function createGatewaySpeechStream({ webSocket, url, protocols, headers, startFrame, text, abortSignal, authMethod }) {
29338
+ let finished = false;
29339
+ let cleanup = () => {};
29340
+ return new ReadableStream({
29341
+ start: (controller) => {
29342
+ let textReader;
29343
+ let hasServerErrorPart = false;
29344
+ let lastServerError;
29345
+ let textStopped = false;
29346
+ let connection;
29347
+ const cancelText = () => {
29348
+ if (textReader != null) {
29349
+ textReader.cancel().catch(() => {});
29350
+ textReader = void 0;
29351
+ } else text.cancel().catch(() => {});
29352
+ };
29353
+ cleanup = (closeCode) => {
29354
+ cancelText();
29355
+ connection?.close(closeCode);
29356
+ };
29357
+ const finishWithError = (error) => {
29358
+ if (finished) return;
29359
+ finished = true;
29360
+ cleanup();
29361
+ errorControllerWithGatewayError(controller, error, authMethod);
29362
+ };
29363
+ const sendText = async (socket) => {
29364
+ const reader = text.getReader();
29365
+ textReader = reader;
29366
+ try {
29367
+ while (true) {
29368
+ const { done, value } = await reader.read();
29369
+ if (done || finished || textStopped) break;
29370
+ let first = true;
29371
+ const pieces = splitTextDelta(value.text);
29372
+ if (pieces.length === 0 && (value.voice != null || value.providerOptions != null)) pieces.push("");
29373
+ for (const delta of pieces) {
29374
+ if (finished || textStopped) break;
29375
+ const frame = {
29376
+ type: SPEECH_STREAM_TEXT_DELTA_FRAME_TYPE,
29377
+ delta,
29378
+ ...value.voice != null && { voice: value.voice },
29379
+ ...first && value.providerOptions != null && { providerOptions: value.providerOptions }
29380
+ };
29381
+ first = false;
29382
+ socket.send(JSON.stringify(frame));
29383
+ await waitForWebSocketBufferDrain(socket);
29384
+ }
29385
+ }
29386
+ } finally {
29387
+ reader.releaseLock();
29388
+ if (textReader === reader) textReader = void 0;
29389
+ }
29390
+ if (!finished && !textStopped) socket.send(JSON.stringify({ type: SPEECH_STREAM_TEXT_DONE_FRAME_TYPE }));
29391
+ };
29392
+ connection = connectToWebSocket({
29393
+ url,
29394
+ protocols,
29395
+ headers,
29396
+ webSocket,
29397
+ abortSignal,
29398
+ onAbort: (reason) => {
29399
+ if (finished) return;
29400
+ finished = true;
29401
+ cleanup();
29402
+ controller.error(reason);
29403
+ },
29404
+ onProcessingError: finishWithError,
29405
+ onOpen: (socket) => {
29406
+ socket.send(JSON.stringify(startFrame));
29407
+ sendText(socket).catch(finishWithError);
29408
+ },
29409
+ onMessageText: async (messageText) => {
29410
+ if (finished) return;
29411
+ const part = parseSpeechStreamPart(messageText);
29412
+ if (part == null) return;
29413
+ if (part.type === "finish") {
29414
+ finished = true;
29415
+ controller.enqueue(part);
29416
+ controller.close();
29417
+ cleanup(1e3);
29418
+ return;
29419
+ }
29420
+ if (part.type === "error") {
29421
+ hasServerErrorPart = true;
29422
+ lastServerError = part.error;
29423
+ textStopped = true;
29424
+ cancelText();
29425
+ part.error = await createErrorFromServerErrorPart(part.error, authMethod, "speech");
29426
+ if (finished) return;
29427
+ }
29428
+ controller.enqueue(part);
29429
+ },
29430
+ onSocketError: () => {
29431
+ finishWithError(/* @__PURE__ */ new Error("Connection error on AI Gateway speech stream"));
29432
+ },
29433
+ onClose: ({ code, reason }) => {
29434
+ if (hasServerErrorPart) {
29435
+ if (finished) return;
29436
+ createErrorFromServerErrorPart(lastServerError, authMethod, "speech").then(finishWithError);
29437
+ return;
29438
+ }
29439
+ finishWithError(/* @__PURE__ */ new Error("AI Gateway speech stream closed before a finish part was received" + (code != null ? ` (code ${code}${reason ? `: ${reason}` : ""})` : "") + "."));
29440
+ }
29441
+ });
29442
+ },
29443
+ cancel: () => {
29444
+ if (finished) return;
29445
+ finished = true;
29446
+ cleanup();
29447
+ }
29126
29448
  });
29127
- return /* @__PURE__ */ new Error(`AI Gateway transcription stream failed: ${getServerErrorMessage(error)}`);
29128
29449
  }
29450
+ const providerMetadataEntrySchema = () => z$3.object({}).catchall(z$3.unknown());
29451
+ const gatewaySpeechWarningSchema = () => z$3.discriminatedUnion("type", [
29452
+ z$3.object({
29453
+ type: z$3.literal("unsupported"),
29454
+ feature: z$3.string(),
29455
+ details: z$3.string().optional()
29456
+ }),
29457
+ z$3.object({
29458
+ type: z$3.literal("compatibility"),
29459
+ feature: z$3.string(),
29460
+ details: z$3.string().optional()
29461
+ }),
29462
+ z$3.object({
29463
+ type: z$3.literal("deprecated"),
29464
+ setting: z$3.string(),
29465
+ message: z$3.string()
29466
+ }),
29467
+ z$3.object({
29468
+ type: z$3.literal("other"),
29469
+ message: z$3.string()
29470
+ })
29471
+ ]);
29472
+ const gatewaySpeechResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
29473
+ audio: z$3.string(),
29474
+ warnings: z$3.array(gatewaySpeechWarningSchema()).optional(),
29475
+ usage: z$3.record(z$3.string(), z$3.json()).optional(),
29476
+ providerMetadata: z$3.record(z$3.string(), providerMetadataEntrySchema()).optional()
29477
+ })));
29129
29478
  /**
29130
29479
  * Realtime model backed by the AI Gateway.
29131
29480
  *
@@ -29193,7 +29542,7 @@ function toGatewayRealtimeUrl(baseURL, modelId) {
29193
29542
  url.searchParams.set("ai-model-id", modelId);
29194
29543
  return url.toString();
29195
29544
  }
29196
- const jsonObjectSchema = z$3.record(z$3.string(), z$3.unknown());
29545
+ const jsonObjectSchema = () => z$3.record(z$3.string(), z$3.unknown());
29197
29546
  const browserbaseFetchToolFactory = createProviderExecutedToolFactory({
29198
29547
  id: "gateway.browserbase_fetch",
29199
29548
  inputSchema: lazySchema(() => zodSchema$4(z$3.object({
@@ -29206,11 +29555,11 @@ const browserbaseFetchToolFactory = createProviderExecutedToolFactory({
29206
29555
  "json",
29207
29556
  "markdown"
29208
29557
  ]).optional().describe("Output format. raw returns the response body unchanged, markdown returns page content as Markdown, and json returns structured content using schema."),
29209
- schema: jsonObjectSchema.optional().describe("JSON Schema for structured extraction. Only use with format set to json.")
29558
+ schema: jsonObjectSchema().optional().describe("JSON Schema for structured extraction. Only use with format set to json.")
29210
29559
  }))),
29211
29560
  outputSchema: lazySchema(() => zodSchema$4(z$3.union([z$3.object({
29212
29561
  id: z$3.string(),
29213
- content: z$3.union([z$3.string(), jsonObjectSchema]),
29562
+ content: z$3.union([z$3.string(), jsonObjectSchema()]),
29214
29563
  contentType: z$3.string(),
29215
29564
  encoding: z$3.string(),
29216
29565
  headers: z$3.record(z$3.string(), z$3.string()),
@@ -29369,41 +29718,67 @@ const exaSearchToolFactory = createProviderExecutedToolFactory({
29369
29718
  })])))
29370
29719
  });
29371
29720
  const exaSearch = (config = {}) => exaSearchToolFactory(config);
29721
+ const parallelSearchModes = [
29722
+ "turbo",
29723
+ "fast",
29724
+ "basic",
29725
+ "advanced",
29726
+ "one-shot",
29727
+ "agentic"
29728
+ ];
29372
29729
  const parallelSearchToolFactory = createProviderExecutedToolFactory({
29373
29730
  id: "gateway.parallel_search",
29374
29731
  inputSchema: lazySchema(() => zodSchema$4(z$3.object({
29375
29732
  objective: z$3.string().describe("Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),
29376
- search_queries: z$3.array(z$3.string()).optional().describe("Optional search queries to supplement the objective. Maximum 200 characters per query."),
29377
- mode: z$3.enum(["one-shot", "agentic"]).optional().describe("Mode preset: \"one-shot\" for comprehensive results with longer excerpts (default), \"agentic\" for concise, token-efficient results for multi-step workflows."),
29733
+ search_queries: z$3.array(z$3.string()).optional().describe("Provide 2-3 concise keyword queries, 3-6 words each (max 5, 200 chars each). Strongly recommended; the search runs on these queries."),
29734
+ mode: z$3.enum(parallelSearchModes).optional().describe("Search mode: \"turbo\" and \"fast\" return quickly with shorter excerpts, \"basic\" is balanced (default), \"advanced\" is the most thorough. \"turbo\" supports English and Japanese only. \"one-shot\" and \"agentic\" are deprecated aliases of \"basic\" and \"advanced\"."),
29378
29735
  max_results: z$3.number().optional().describe("Maximum number of results to return (1-20). Defaults to 10 if not specified."),
29379
29736
  source_policy: z$3.object({
29380
- include_domains: z$3.array(z$3.string()).optional().describe("Limit results to these domains. Use plain domain names only — e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."),
29381
- exclude_domains: z$3.array(z$3.string()).optional().describe("Exclude results from these domains. Use plain domain names only — e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."),
29382
- after_date: z$3.string().optional().describe("Only include results published after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time.")
29737
+ include_domains: z$3.array(z$3.string()).optional().describe("Domains or domain/path prefixes to restrict results to, without scheme or port. Example: ['wikipedia.org', 'docs.python.org/3']."),
29738
+ exclude_domains: z$3.array(z$3.string()).optional().describe("Domains or domain/path prefixes to exclude, without scheme or port. Example: ['reddit.com']."),
29739
+ after_date: z$3.string().optional().describe("Only include results published on or after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time.")
29383
29740
  }).optional().describe("Source policy for controlling which domains to include/exclude and freshness."),
29384
29741
  excerpts: z$3.object({
29385
29742
  max_chars_per_result: z$3.number().optional().describe("Maximum characters per result."),
29386
- max_chars_total: z$3.number().optional().describe("Maximum total characters across all results.")
29743
+ max_chars_total: z$3.number().optional().describe("Deprecated: use the top-level max_chars_total.")
29387
29744
  }).optional().describe("Excerpt configuration for controlling result length."),
29388
- fetch_policy: z$3.object({ max_age_seconds: z$3.number().optional().describe("Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.") }).optional().describe("Fetch policy for controlling content freshness.")
29745
+ max_chars_total: z$3.number().optional().describe("Maximum total characters across all result excerpts."),
29746
+ fetch_policy: z$3.object({
29747
+ max_age_seconds: z$3.number().optional().describe("Maximum age of cached content in seconds before a live fetch, minimum 600."),
29748
+ timeout_seconds: z$3.number().optional().describe("Timeout in seconds for a live fetch when content is not cached. Capped by the gateway tool timeout."),
29749
+ disable_cache_fallback: z$3.boolean().optional().describe("Return an error instead of older cached content when a live fetch fails.")
29750
+ }).optional().describe("Fetch policy for controlling content freshness."),
29751
+ location: z$3.string().optional().describe("ISO 3166-1 alpha-2 country code to localize results, e.g. \"us\".")
29389
29752
  }))),
29390
29753
  outputSchema: lazySchema(() => zodSchema$4(z$3.union([z$3.object({
29391
- searchId: z$3.string(),
29754
+ search_id: z$3.string(),
29392
29755
  results: z$3.array(z$3.object({
29393
29756
  url: z$3.string(),
29394
- title: z$3.string(),
29395
- excerpt: z$3.string(),
29396
- publishDate: z$3.string().nullable().optional(),
29397
- relevanceScore: z$3.number().optional()
29398
- }))
29757
+ title: z$3.string().nullable().optional(),
29758
+ publish_date: z$3.string().nullable().optional(),
29759
+ excerpts: z$3.array(z$3.string())
29760
+ })),
29761
+ warnings: z$3.array(z$3.object({
29762
+ type: z$3.string(),
29763
+ message: z$3.string(),
29764
+ detail: z$3.record(z$3.string(), z$3.unknown()).nullable().optional()
29765
+ })).nullable().optional(),
29766
+ usage: z$3.array(z$3.object({
29767
+ name: z$3.string(),
29768
+ count: z$3.number().optional()
29769
+ })).nullable().optional(),
29770
+ session_id: z$3.string().optional()
29399
29771
  }), z$3.object({
29400
29772
  error: z$3.enum([
29401
29773
  "api_error",
29774
+ "configuration_error",
29775
+ "execution_error",
29776
+ "gateway_rate_limit",
29777
+ "invalid_input",
29402
29778
  "rate_limit",
29403
29779
  "timeout",
29404
- "invalid_input",
29405
- "configuration_error",
29406
- "unknown"
29780
+ "unknown",
29781
+ "unknown_tool"
29407
29782
  ]),
29408
29783
  statusCode: z$3.number().optional(),
29409
29784
  message: z$3.string()
@@ -29453,7 +29828,7 @@ const perplexitySearchToolFactory = createProviderExecutedToolFactory({
29453
29828
  })])))
29454
29829
  });
29455
29830
  const perplexitySearch = (config = {}) => perplexitySearchToolFactory(config);
29456
- const takoDataSourceInputSchema = z$3.object({
29831
+ const takoDataSourceInputSchema = () => z$3.object({
29457
29832
  count: z$3.number().optional().describe("Maximum number of data results to return (1-20). When include_contents is true, each additional result adds its own data surcharge."),
29458
29833
  include_contents: z$3.boolean().optional().describe("Inline rows for each data result. This adds a data surcharge based on row count and dataset source. To estimate cost, search with include_contents disabled and inspect cards.content.export_pricing. This applies to every returned card; limit sources.data.count and sources.data.max_rows to control cost."),
29459
29834
  mode: z$3.enum(["inline", "url"]).optional().describe("Requested data delivery mode. Search card data is always inline."),
@@ -29467,7 +29842,7 @@ const takoDataSourceInputSchema = z$3.object({
29467
29842
  node_ids: z$3.array(z$3.string()).optional().describe("Data Graph node IDs to prioritize. Maximum 20."),
29468
29843
  strict: z$3.boolean().optional().describe("Only return cards matching node_ids. Requires a non-empty node_ids.")
29469
29844
  });
29470
- const takoWebSourceInputSchema = z$3.object({
29845
+ const takoWebSourceInputSchema = () => z$3.object({
29471
29846
  count: z$3.number().optional().describe("Maximum number of web results to return (1-20)."),
29472
29847
  include_contents: z$3.boolean().optional().describe("Inline extracted web page text. This can add a data charge."),
29473
29848
  category: z$3.enum([
@@ -29491,8 +29866,8 @@ const takoSearchInputSchema = lazySchema(() => zodSchema$4(z$3.object({
29491
29866
  "instant"
29492
29867
  ]).optional().describe("Search effort. fast is the balanced default, instant favors cached results and low latency, and deep broadens retrieval with reranking at higher cost and latency."),
29493
29868
  sources: z$3.object({
29494
- data: takoDataSourceInputSchema.optional(),
29495
- web: takoWebSourceInputSchema.optional()
29869
+ data: takoDataSourceInputSchema().optional(),
29870
+ web: takoWebSourceInputSchema().optional()
29496
29871
  }).optional().describe("Sources to search. Omit to search both curated data and the web. When provided, only keys present are searched."),
29497
29872
  location: z$3.object({
29498
29873
  latitude: z$3.number().describe("Latitude between -90 and 90."),
@@ -29507,12 +29882,12 @@ const takoSearchInputSchema = lazySchema(() => zodSchema$4(z$3.object({
29507
29882
  }).optional().describe("Controls card rendering in the search response."),
29508
29883
  include_related: z$3.number().optional().describe("Maximum related search suggestions to include (1-20).")
29509
29884
  })));
29510
- const takoDatasetCellSchema = z$3.union([
29885
+ const takoDatasetCellSchema = () => z$3.union([
29511
29886
  z$3.boolean(),
29512
29887
  z$3.number(),
29513
29888
  z$3.string()
29514
29889
  ]).nullable();
29515
- const takoResultContentSchema = z$3.object({
29890
+ const takoResultContentSchema = () => z$3.object({
29516
29891
  content_format: z$3.enum([
29517
29892
  "card_json",
29518
29893
  "csv",
@@ -29521,7 +29896,7 @@ const takoResultContentSchema = z$3.object({
29521
29896
  ]).nullish(),
29522
29897
  cost: z$3.number().optional(),
29523
29898
  data: z$3.string().nullish(),
29524
- records: z$3.array(z$3.record(z$3.string(), takoDatasetCellSchema)).nullish(),
29899
+ records: z$3.array(z$3.record(z$3.string(), takoDatasetCellSchema())).nullish(),
29525
29900
  dataset: z$3.object({
29526
29901
  columns: z$3.array(z$3.object({
29527
29902
  name: z$3.string(),
@@ -29534,7 +29909,7 @@ const takoResultContentSchema = z$3.object({
29534
29909
  ]),
29535
29910
  unit: z$3.string().nullish()
29536
29911
  })),
29537
- rows: z$3.array(z$3.array(takoDatasetCellSchema)),
29912
+ rows: z$3.array(z$3.array(takoDatasetCellSchema())),
29538
29913
  total_rows: z$3.number(),
29539
29914
  truncated: z$3.boolean(),
29540
29915
  ref: z$3.string(),
@@ -29570,7 +29945,7 @@ const takoResultContentSchema = z$3.object({
29570
29945
  unit: z$3.string().nullish()
29571
29946
  })).nullish()
29572
29947
  }).passthrough();
29573
- const takoCardSchema = z$3.object({
29948
+ const takoCardSchema = () => z$3.object({
29574
29949
  card_id: z$3.string().nullish(),
29575
29950
  title: z$3.string().nullish(),
29576
29951
  description: z$3.string().nullish(),
@@ -29596,7 +29971,7 @@ const takoCardSchema = z$3.object({
29596
29971
  "Low",
29597
29972
  "Medium"
29598
29973
  ]).nullish(),
29599
- content: takoResultContentSchema.nullish(),
29974
+ content: takoResultContentSchema().nullish(),
29600
29975
  exportable: z$3.boolean().optional(),
29601
29976
  nodes: z$3.array(z$3.object({
29602
29977
  id: z$3.string(),
@@ -29614,21 +29989,21 @@ const takoCardSchema = z$3.object({
29614
29989
  last_updated: z$3.string().nullish()
29615
29990
  }).nullish()
29616
29991
  }).passthrough();
29617
- const takoWebResultSchema = z$3.object({
29992
+ const takoWebResultSchema = () => z$3.object({
29618
29993
  title: z$3.string(),
29619
29994
  url: z$3.string(),
29620
29995
  snippet: z$3.string().nullish(),
29621
29996
  source_name: z$3.string().nullish(),
29622
29997
  publish_date: z$3.string().nullish(),
29623
- content: takoResultContentSchema.nullish()
29998
+ content: takoResultContentSchema().nullish()
29624
29999
  }).passthrough();
29625
30000
  const takoSearchToolFactory = createProviderExecutedToolFactory({
29626
30001
  id: "gateway.tako_search",
29627
30002
  inputSchema: takoSearchInputSchema,
29628
30003
  outputSchema: lazySchema(() => zodSchema$4(z$3.union([z$3.object({
29629
30004
  request_id: z$3.string(),
29630
- cards: z$3.array(takoCardSchema).optional(),
29631
- web_results: z$3.array(takoWebResultSchema).optional(),
30005
+ cards: z$3.array(takoCardSchema()).optional(),
30006
+ web_results: z$3.array(takoWebResultSchema()).optional(),
29632
30007
  usage: z$3.object({
29633
30008
  total_cost_usd: z$3.number(),
29634
30009
  compute: z$3.object({ cost_usd: z$3.number() }).nullish(),
@@ -29709,13 +30084,13 @@ const gatewayTools = {
29709
30084
  async function getVercelRequestId() {
29710
30085
  return getContext().headers?.["x-vercel-id"];
29711
30086
  }
29712
- const VERSION$1$3 = "4.0.116";
30087
+ const VERSION$1$3 = "4.0.126";
29713
30088
  const AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
29714
30089
  /** Response shape of `POST /v1/realtime/client-secrets`. `expiresAt` is epoch seconds. */
29715
- const gatewayClientSecretResponseSchema = z$3.object({
30090
+ const gatewayClientSecretResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
29716
30091
  token: z$3.string(),
29717
30092
  expiresAt: z$3.number().nullish()
29718
- });
30093
+ })));
29719
30094
  /**
29720
30095
  * Create a remote provider instance.
29721
30096
  */
@@ -29944,11 +30319,24 @@ function createGateway(options = {}) {
29944
30319
  baseURL,
29945
30320
  headers: getHeaders,
29946
30321
  fetch: options.fetch,
29947
- o11yHeaders: createO11yHeaders()
30322
+ o11yHeaders: createO11yHeaders(),
30323
+ webSocket: options.webSocket
29948
30324
  });
29949
30325
  };
29950
30326
  provider.speechModel = createSpeechModel;
29951
30327
  provider.speech = createSpeechModel;
30328
+ provider.experimental_speech = Object.assign((modelId) => createSpeechModel(modelId), { getToken: async (tokenOptions) => {
30329
+ const secret = await mintClientSecret({
30330
+ modelId: tokenOptions.model,
30331
+ routeKind: "speech",
30332
+ ...tokenOptions.expiresAfterSeconds != null && { expiresAfterSeconds: tokenOptions.expiresAfterSeconds }
30333
+ });
30334
+ return {
30335
+ token: secret.token,
30336
+ url: toGatewaySpeechUrl(baseURL, tokenOptions.model),
30337
+ ...secret.expiresAt != null && { expiresAt: secret.expiresAt }
30338
+ };
30339
+ } });
29952
30340
  const createTranscriptionModel = (modelId) => {
29953
30341
  return new GatewayTranscriptionModel(modelId, {
29954
30342
  provider: "gateway",
@@ -30011,7 +30399,7 @@ async function getGatewayAuthToken(options) {
30011
30399
  };
30012
30400
  }
30013
30401
  function assertGatewayClientSecretServerEnvironment() {
30014
- if (typeof globalThis.window !== "undefined") throw new Error("AI Gateway client secrets must be minted server-side: minting needs your Gateway credential, which must never reach the browser. Call gateway.experimental_realtime.getToken() or gateway.experimental_transcription.getToken() from your server and pass the returned token to the client.");
30402
+ if (typeof globalThis.window !== "undefined") throw new Error("AI Gateway client secrets must be minted server-side: minting needs your Gateway credential, which must never reach the browser. Call gateway.experimental_realtime.getToken(), gateway.experimental_transcription.getToken(), or gateway.experimental_speech.getToken() from your server and pass the returned token to the client.");
30015
30403
  }
30016
30404
  const name$23 = "AI_InvalidArgumentError";
30017
30405
  const marker$23 = `vercel.ai.error.${name$23}`;
@@ -30487,7 +30875,7 @@ function resolveEmbeddingModel(model) {
30487
30875
  function getGlobalProvider() {
30488
30876
  return asProviderV4(globalThis.AI_SDK_DEFAULT_PROVIDER ?? gateway);
30489
30877
  }
30490
- const VERSION = "7.0.143";
30878
+ const VERSION = "7.0.153";
30491
30879
  const z$2 = {
30492
30880
  array: zod_v4.array,
30493
30881
  boolean: zod_v4.boolean,
@@ -35240,6 +35628,20 @@ var OmIncompleteResponseError = class extends Error {
35240
35628
  }
35241
35629
  };
35242
35630
  /**
35631
+ * A model reply that finished but carries nothing usable: no text, only whitespace,
35632
+ * or text with no recognised Observer sections (e.g. a refusal).
35633
+ * Retryable, so an empty reply is retried like a transport error.
35634
+ *
35635
+ * @internal
35636
+ */
35637
+ var OmEmptyResponseError = class extends Error {
35638
+ isRetryable = true;
35639
+ constructor(label, what = "empty output") {
35640
+ super(`${label} returned ${what}`);
35641
+ this.name = "OmEmptyResponseError";
35642
+ }
35643
+ };
35644
+ /**
35243
35645
  * OM calls are single-step (`maxSteps: 1`). A step that ends with `other` or
35244
35646
  * `unknown` means the stream closed before the model finished, so its text is
35245
35647
  * partial. Throw a retryable error so `withRetry` re-runs the whole call
@@ -36559,6 +36961,14 @@ function sanitizeToolResultValue(value, seen = /* @__PURE__ */ new WeakMap()) {
36559
36961
  function serializeToolResultForTokenCounting(value) {
36560
36962
  return stringifyToolResult(value);
36561
36963
  }
36964
+ /**
36965
+ * Returns a tool invocation's `errorText` as a string. The field is typed as a string, but
36966
+ * persisted or imported history can hold a structured error object, so anything that is not
36967
+ * a string is serialized. Nullish values become an empty string.
36968
+ */
36969
+ function toolErrorTextToString(errorText) {
36970
+ return errorText == null ? "" : stringifyToolResult(errorText);
36971
+ }
36562
36972
  function stringifyToolResult(value) {
36563
36973
  if (typeof value === "string") return value;
36564
36974
  const sanitized = sanitizeToolResultValue(value);
@@ -37415,15 +37825,18 @@ function formatObserverMessage(msg, counter, toolFormatting, options) {
37415
37825
  if (exchange?.terminal?.occurrence === occurrence && !toolFormatting.emittedOutcomes.has(inv.toolCallId)) {
37416
37826
  toolFormatting.emittedOutcomes.add(inv.toolCallId);
37417
37827
  const hasResult = resultWithoutAttachments !== void 0 && (typeof resultWithoutAttachments !== "string" || resultWithoutAttachments.trim().length > 0);
37418
- const body = inv.isError ? hasResult ? formatToolResultForObserver(resultWithoutAttachments, { maxTokens: maxToolResultTokens }) : inv.errorText?.trim() ? inv.errorText : "Tool execution failed" : hasResult ? formatToolResultForObserver(resultWithoutAttachments, { maxTokens: maxToolResultTokens }) : "[empty result]";
37828
+ const errorText = toolErrorTextToString(inv.errorText);
37829
+ const body = inv.isError ? hasResult ? formatToolResultForObserver(resultWithoutAttachments, { maxTokens: maxToolResultTokens }) : errorText.trim() ? errorText : "Tool execution failed" : hasResult ? formatToolResultForObserver(resultWithoutAttachments, { maxTokens: maxToolResultTokens }) : "[empty result]";
37419
37830
  pushLine(`${inv.isError ? "Tool Error" : "Tool Result"} ${inv.toolName}`, maybeTruncate(body, maxLen), partCreatedAt, { tool: true });
37420
37831
  }
37421
37832
  return;
37422
37833
  }
37423
37834
  if (exchange?.terminal?.occurrence === occurrence && !toolFormatting.emittedOutcomes.has(inv.toolCallId)) {
37424
37835
  toolFormatting.emittedOutcomes.add(inv.toolCallId);
37425
- if (inv.state === "output-error") pushLine(`Tool Error ${inv.toolName}`, maybeTruncate(inv.errorText?.trim() ? inv.errorText : "Tool execution failed", maxLen), partCreatedAt, { tool: true });
37426
- else if (inv.state === "output-denied") pushLine(`Tool Denied ${inv.toolName}`, maybeTruncate(inv.approval?.reason?.trim() ? inv.approval.reason : "Tool call was not approved by the user", maxLen), partCreatedAt, { tool: true });
37836
+ if (inv.state === "output-error") {
37837
+ const errorText = toolErrorTextToString(inv.errorText);
37838
+ pushLine(`Tool Error ${inv.toolName}`, maybeTruncate(errorText.trim() ? errorText : "Tool execution failed", maxLen), partCreatedAt, { tool: true });
37839
+ } else if (inv.state === "output-denied") pushLine(`Tool Denied ${inv.toolName}`, maybeTruncate(inv.approval?.reason?.trim() ? inv.approval.reason : "Tool call was not approved by the user", maxLen), partCreatedAt, { tool: true });
37427
37840
  return;
37428
37841
  }
37429
37842
  if (!exchange) pushLine(`Tool Call ${inv.toolName}`, formatObserverToolArguments(inv.args, maxLen), partCreatedAt, { tool: true });
@@ -37745,13 +38158,15 @@ function parseMemorySectionXml(content) {
37745
38158
  suggestedResponse: "",
37746
38159
  threadTitle: ""
37747
38160
  };
37748
- const observationsMatches = [...content.matchAll(/^[ \t]*<observations>([\s\S]*?)^[ \t]*<\/observations>/gim)];
37749
- if (observationsMatches.length > 0) result.observations = observationsMatches.map((m) => m[1]?.trim() ?? "").filter(Boolean).join("\n");
38161
+ const observationsMatches = [...content.matchAll(/^[ \t]*<observations>(?:([^\r\n]*?)<\/observations>[ \t]*$|([\s\S]*?)^[ \t]*<\/observations>)/gim)];
38162
+ if (observationsMatches.length > 0) result.observations = observationsMatches.map((m) => (m[1] ?? m[2])?.trim() ?? "").filter(Boolean).join("\n");
37750
38163
  else result.observations = extractListItemsOnly(content);
37751
- const currentTaskMatch = content.match(/^[ \t]*<current-task>([\s\S]*?)^[ \t]*<\/current-task>/im);
37752
- if (currentTaskMatch?.[1]) result.currentTask = currentTaskMatch[1].trim();
37753
- const suggestedResponseMatch = content.match(/^[ \t]*<suggested-response>([\s\S]*?)^[ \t]*<\/suggested-response>/im);
37754
- if (suggestedResponseMatch?.[1]) result.suggestedResponse = suggestedResponseMatch[1].trim();
38164
+ const currentTaskMatch = content.match(/^[ \t]*<current-task>(?:([^\r\n]*?)<\/current-task>[ \t]*$|([\s\S]*?)^[ \t]*<\/current-task>)/im);
38165
+ const currentTask = currentTaskMatch?.[1] ?? currentTaskMatch?.[2];
38166
+ if (currentTask) result.currentTask = currentTask.trim();
38167
+ const suggestedResponseMatch = content.match(/^[ \t]*<suggested-response>(?:([^\r\n]*?)<\/suggested-response>[ \t]*$|([\s\S]*?)^[ \t]*<\/suggested-response>)/im);
38168
+ const suggestedResponse = suggestedResponseMatch?.[1] ?? suggestedResponseMatch?.[2];
38169
+ if (suggestedResponse) result.suggestedResponse = suggestedResponse.trim();
37755
38170
  const threadTitleMatch = content.match(/^[ \t]*<thread-title>([\s\S]*?)<\/thread-title>/im);
37756
38171
  if (threadTitleMatch?.[1]) result.threadTitle = threadTitleMatch[1].trim();
37757
38172
  return result;
@@ -38320,7 +38735,7 @@ var ObserverRunner = class {
38320
38735
  callback: (childObservabilityContext) => this.withAbortCheck(async () => {
38321
38736
  try {
38322
38737
  attemptMemory = temporaryMemory?.newThread();
38323
- return assertCompleteModelResponse(await (await agent.stream(observerMessages, {
38738
+ return assertRecognizedObserverOutput(assertNonEmptyObserverOutput(assertCompleteModelResponse(await (await agent.stream(observerMessages, {
38324
38739
  maxSteps: 1,
38325
38740
  modelSettings: { ...this.observationConfig.modelSettings },
38326
38741
  providerOptions: this.observationConfig.providerOptions,
@@ -38329,7 +38744,7 @@ var ObserverRunner = class {
38329
38744
  onChunk: onActivity,
38330
38745
  ...internalRequestContext ? { requestContext: internalRequestContext } : {},
38331
38746
  ...childObservabilityContext
38332
- })).getFullOutput(), "OM observer");
38747
+ })).getFullOutput(), "OM observer"), "OM observer"), "OM observer", (text) => hasSingleThreadObserverContent(text, activeExtractors));
38333
38748
  } catch (error) {
38334
38749
  this.mastra?.getLogger?.().error("OM observer provider call failed", {
38335
38750
  diagnostic: formatOmError(error),
@@ -38432,7 +38847,7 @@ var ObserverRunner = class {
38432
38847
  for (const threadId of allThreadOrder) {
38433
38848
  const threadResult = output.results.get(threadId);
38434
38849
  if (!threadResult) {
38435
- output.results.set(threadId, { observations: "" });
38850
+ if (!messagesByThread.has(threadId)) output.results.set(threadId, { observations: "" });
38436
38851
  continue;
38437
38852
  }
38438
38853
  threadResult.observations = await applyTextTransform(this.hooks, "afterObservation", threadResult.observations, contextFor(threadId));
@@ -38534,7 +38949,7 @@ var ObserverRunner = class {
38534
38949
  },
38535
38950
  callback: (childObservabilityContext) => this.withAbortCheck(async () => {
38536
38951
  try {
38537
- return assertCompleteModelResponse(await (await agent.stream(observerMessages, {
38952
+ return assertRecognizedObserverOutput(assertNonEmptyObserverOutput(assertCompleteModelResponse(await (await agent.stream(observerMessages, {
38538
38953
  maxSteps: 1,
38539
38954
  modelSettings: { ...this.observationConfig.modelSettings },
38540
38955
  providerOptions: this.observationConfig.providerOptions,
@@ -38542,7 +38957,7 @@ var ObserverRunner = class {
38542
38957
  onChunk: onActivity,
38543
38958
  ...internalRequestContext ? { requestContext: internalRequestContext } : {},
38544
38959
  ...childObservabilityContext
38545
- })).getFullOutput(), "OM multi-thread observer");
38960
+ })).getFullOutput(), "OM multi-thread observer"), "OM multi-thread observer"), "OM multi-thread observer", (text) => hasMultiThreadObserverContent(text, activeExtractors, threadOrder));
38546
38961
  } catch (error) {
38547
38962
  this.mastra?.getLogger?.().error("OM multi-thread observer provider call failed", {
38548
38963
  diagnostic: formatOmError(error),
@@ -38619,8 +39034,7 @@ var ObserverRunner = class {
38619
39034
  extractors: activeExtractors
38620
39035
  });
38621
39036
  }
38622
- for (const threadId of threadOrder) if (!results.has(threadId)) results.set(threadId, { observations: "" });
38623
- for (const msgs of messagesByThread.values()) for (const msg of msgs) this.observedMessageIds.add(msg.id);
39037
+ for (const threadId of results.keys()) for (const msg of messagesByThread.get(threadId) ?? []) this.observedMessageIds.add(msg.id);
38624
39038
  const usage = result.totalUsage ?? result.usage;
38625
39039
  return {
38626
39040
  results,
@@ -38634,6 +39048,39 @@ var ObserverRunner = class {
38634
39048
  }
38635
39049
  };
38636
39050
  /**
39051
+ * An empty Observer response must not be committed: that would advance
39052
+ * `lastObservedAt` past messages that were never observed. Throwing a retryable
39053
+ * error lets `withRetry` retry it like a transport error; once retries run out
39054
+ * it surfaces as `OmModelExecutionError`, so `failurePolicy` decides the turn.
39055
+ */
39056
+ function assertNonEmptyObserverOutput(output, label) {
39057
+ if (!output.text?.trim()) throw new OmEmptyResponseError(label);
39058
+ return output;
39059
+ }
39060
+ /**
39061
+ * A reply with text but nothing the parser recognises (e.g. a refusal like
39062
+ * "I can't help with that") parses to zero observations. Committing it would drop
39063
+ * the observed messages the same way an empty reply does, so it gets the same retry.
39064
+ * Degenerate replies pass through; the degenerate retry handles them.
39065
+ */
39066
+ function assertRecognizedObserverOutput(output, label, isRecognized) {
39067
+ if (!isRecognized(output.text)) throw new OmEmptyResponseError(label, "no observations");
39068
+ return output;
39069
+ }
39070
+ function hasSingleThreadObserverContent(text, extractors) {
39071
+ if (/^[ \t]*<observations>/im.test(text)) return true;
39072
+ const parsed = parseObserverOutput(text, extractors);
39073
+ return Boolean(parsed.degenerate || parsed.observations || parsed.currentTask || parsed.suggestedContinuation || parsed.threadTitle || Object.keys(parsed.extractedValues ?? {}).length || parsed.extractionFailures?.length);
39074
+ }
39075
+ /**
39076
+ * Multi-thread replies carry every recognised section inside `<thread>` blocks, so a reply
39077
+ * with no block for any requested thread has nothing to record.
39078
+ */
39079
+ function hasMultiThreadObserverContent(text, extractors, threadOrder) {
39080
+ const parsed = parseMultiThreadObserverOutput(text, extractors);
39081
+ return Boolean(parsed.degenerate || threadOrder.some((threadId) => parsed.threads.has(threadId)));
39082
+ }
39083
+ /**
38637
39084
  * Synchronous image dimension lookup for in-memory image buffers.
38638
39085
  *
38639
39086
  * Uses `probe-image-size`'s sync parsers rather than `image-size`, which has unfixed
@@ -38944,7 +39391,7 @@ async function resolveImageDimensionsAsync(part) {
38944
39391
  const url = resolveHttpAssetUrl(getObjectValue(part, "image") ?? getObjectValue(part, "data"));
38945
39392
  if (!url) return existing;
38946
39393
  try {
38947
- const probeImageSize = (await Promise.resolve().then(() => /* @__PURE__ */ require_rolldown_runtime.__toESM(require("./probe-image-size-l1uuhbob.cjs").default, 1))).default;
39394
+ const probeImageSize = (await Promise.resolve().then(() => /* @__PURE__ */ require_rolldown_runtime.__toESM(require("./probe-image-size-C0psF6WM.cjs").default, 1))).default;
38948
39395
  const probed = await probeImageSize(url, {
38949
39396
  open_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
38950
39397
  response_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
@@ -39935,7 +40382,8 @@ var TokenCounter = class TokenCounter {
39935
40382
  }
39936
40383
  if (typeof resultForCounting !== "string") overheadDelta -= 12;
39937
40384
  } else {
39938
- const fallback = invocation.isError ? invocation.errorText?.trim() ? invocation.errorText : "Tool execution failed" : "[empty result]";
40385
+ const errorText = toolErrorTextToString(invocation.errorText);
40386
+ const fallback = invocation.isError ? errorText.trim() ? errorText : "Tool execution failed" : "[empty result]";
39939
40387
  tokens += this.readOrPersistPartEstimate(part, invocation.isError ? "tool-result-error" : "tool-result-json", fallback);
39940
40388
  }
39941
40389
  return {
@@ -39962,7 +40410,8 @@ var TokenCounter = class TokenCounter {
39962
40410
  const signature = this.countToolCallSignature(part, invocation);
39963
40411
  tokens += signature.tokens;
39964
40412
  overheadDelta += signature.overheadDelta;
39965
- const errorMessage = invocation.errorText?.trim() ? invocation.errorText : "Tool execution failed";
40413
+ const errorText = toolErrorTextToString(invocation.errorText);
40414
+ const errorMessage = errorText.trim() ? errorText : "Tool execution failed";
39966
40415
  tokens += this.readOrPersistPartEstimate(part, "tool-result-error", errorMessage);
39967
40416
  return {
39968
40417
  tokens,
@@ -40237,7 +40686,7 @@ const updateWorkingMemoryTool = (memoryConfig) => {
40237
40686
  };
40238
40687
  if (schema) {
40239
40688
  const standardSchema = (0, _mastra_core_schema.isStandardSchemaWithJSON)(schema) ? schema : (0, _mastra_core_schema.toStandardSchema)(schema);
40240
- const jsonSchema = require_schema_CzbEIyhE.standardSchemaToJSONSchema(standardSchema, { io: "input" });
40689
+ const jsonSchema = require_schema_Bf12g7KC.standardSchemaToJSONSchema(standardSchema, { io: "input" });
40241
40690
  delete jsonSchema.$schema;
40242
40691
  const wrappedJsonSchema = {
40243
40692
  $schema: "http://json-schema.org/draft-07/schema#",
@@ -40446,7 +40895,7 @@ function createWorkingMemoryTool(config, options = {}) {
40446
40895
  */
40447
40896
  async function validateAgainstConfiguredSchema(schema, value) {
40448
40897
  const standardSchema = (0, _mastra_core_schema.toStandardSchema)(schema);
40449
- const jsonSchema = require_schema_CzbEIyhE.standardSchemaToJSONSchema(standardSchema, { io: "input" });
40898
+ const jsonSchema = require_schema_Bf12g7KC.standardSchemaToJSONSchema(standardSchema, { io: "input" });
40450
40899
  const result = await standardSchema["~standard"].validate(stripNullsFromOptional(value, jsonSchema));
40451
40900
  if (!result.issues) return result.value;
40452
40901
  const details = result.issues.map((issue) => {
@@ -42808,12 +43257,17 @@ function runNext(key, queue) {
42808
43257
  * Runs `op` once every earlier op on `key` has settled (reflection-priority ops first among those
42809
43258
  * still waiting) and resolves or rejects with its result. A rejection reaches only this caller.
42810
43259
  *
43260
+ * Aborting `abortSignal` while the op is still queued rejects the caller and skips the op. Once the
43261
+ * op has started, the caller waits for its result, so work after a landed commit still runs.
43262
+ *
42811
43263
  * Enqueueing on a key from inside an op that holds the same key, directly or through nested ops
42812
43264
  * on other keys, would deadlock, so it rejects.
42813
43265
  */
42814
- function runOMCommit(key, op, { priority = "normal" } = {}) {
43266
+ function runOMCommit(key, op, { priority = "normal", abortSignal } = {}) {
42815
43267
  if (holdsKey(key)) return Promise.reject(/* @__PURE__ */ new Error(`Re-entrant observational memory commit on "${key}": an op cannot enqueue on the key it holds.`));
42816
- return new Promise((resolve, reject) => {
43268
+ if (abortSignal?.aborted) return Promise.reject(abortSignal.reason);
43269
+ let started = false;
43270
+ const work = new Promise((resolve, reject) => {
42817
43271
  let queue = queues.get(key);
42818
43272
  if (!queue) {
42819
43273
  queue = {
@@ -42841,7 +43295,11 @@ function runOMCommit(key, op, { priority = "normal" } = {}) {
42841
43295
  release();
42842
43296
  }, OM_COMMIT_STALL_MS);
42843
43297
  stallTimer.unref?.();
42844
- heldKeys.run(held, () => Promise.resolve().then(op)).then((value) => {
43298
+ heldKeys.run(held, () => Promise.resolve().then(() => {
43299
+ abortSignal?.throwIfAborted();
43300
+ started = true;
43301
+ return op();
43302
+ })).then((value) => {
42845
43303
  release();
42846
43304
  resolve(value);
42847
43305
  }, (error) => {
@@ -42852,6 +43310,14 @@ function runOMCommit(key, op, { priority = "normal" } = {}) {
42852
43310
  (priority === "reflection" ? owner.reflection : owner.normal).push(start);
42853
43311
  if (owner.running === null) runNext(key, owner);
42854
43312
  });
43313
+ if (!abortSignal) return work;
43314
+ return new Promise((resolve, reject) => {
43315
+ const onAbort = () => {
43316
+ if (!started) reject(abortSignal.reason);
43317
+ };
43318
+ abortSignal.addEventListener("abort", onAbort, { once: true });
43319
+ work.then(resolve, reject).finally(() => abortSignal.removeEventListener("abort", onAbort));
43320
+ });
42855
43321
  }
42856
43322
  const activeOps = /* @__PURE__ */ new Map();
42857
43323
  function opKey(recordId, op) {
@@ -42871,6 +43337,24 @@ function unregisterOp(recordId, op) {
42871
43337
  function isOpActiveInProcess(recordId, op) {
42872
43338
  return (activeOps.get(opKey(recordId, op)) ?? 0) > 0;
42873
43339
  }
43340
+ /** Stops waiting when `signal` aborts; the awaited work keeps running. */
43341
+ async function waitWithAbort(work, signal) {
43342
+ if (!signal) return work;
43343
+ if (signal.aborted) {
43344
+ work.catch(() => {});
43345
+ throw signal.reason;
43346
+ }
43347
+ let onAbort = () => {};
43348
+ const cancelled = new Promise((_, reject) => {
43349
+ onAbort = () => reject(signal.reason);
43350
+ signal.addEventListener("abort", onAbort, { once: true });
43351
+ });
43352
+ try {
43353
+ return await Promise.race([work, cancelled]);
43354
+ } finally {
43355
+ signal.removeEventListener("abort", onAbort);
43356
+ }
43357
+ }
42874
43358
  /**
42875
43359
  * Manages the static buffering state machine for async observation and reflection.
42876
43360
  *
@@ -43013,7 +43497,7 @@ var BufferingCoordinator = class BufferingCoordinator {
43013
43497
  /**
43014
43498
  * Await any in-flight async buffering operations for a given thread/resource.
43015
43499
  */
43016
- static async awaitBuffering(threadId, resourceId, scope, timeoutMs = 3e4) {
43500
+ static async awaitBuffering(threadId, resourceId, scope, timeoutMs = 3e4, abortSignal) {
43017
43501
  const lockKey = getOMLockKey(scope, threadId, resourceId);
43018
43502
  const obsKey = `obs:${lockKey}`;
43019
43503
  const reflKey = `refl:${lockKey}`;
@@ -43025,9 +43509,9 @@ var BufferingCoordinator = class BufferingCoordinator {
43025
43509
  if (promises.length === 0) return;
43026
43510
  let timeoutId;
43027
43511
  try {
43028
- await Promise.race([Promise.allSettled(promises).then(() => void 0), new Promise((resolve) => {
43512
+ await waitWithAbort(Promise.race([Promise.allSettled(promises).then(() => void 0), new Promise((resolve) => {
43029
43513
  timeoutId = setTimeout(resolve, timeoutMs);
43030
- })]);
43514
+ })]), abortSignal);
43031
43515
  } finally {
43032
43516
  if (timeoutId !== void 0) clearTimeout(timeoutId);
43033
43517
  }
@@ -43554,17 +44038,21 @@ var ObservationStrategy = class ObservationStrategy {
43554
44038
  const { record, threadId, abortSignal, writer, reflectionHooks, requestContext } = this.opts;
43555
44039
  const cycleId = this.generateCycleId();
43556
44040
  try {
44041
+ abortSignal?.throwIfAborted();
43557
44042
  if (this.needsLock) {
43558
44043
  const fresh = await this.storage.getObservationalMemory(record.threadId, record.resourceId);
43559
44044
  if (fresh?.lastObservedAt && record.lastObservedAt && fresh.lastObservedAt > record.lastObservedAt) return { observed: false };
43560
44045
  }
44046
+ abortSignal?.throwIfAborted();
43561
44047
  const { messages, existingObservations, contextRecord } = await this.prepare();
43562
44048
  if (messages.length === 0) return { observed: false };
43563
44049
  const observationMessages = stripSubconsciousSignals(messages);
43564
44050
  await this.emitStartMarkers(cycleId);
43565
44051
  const observerContext = this.deps.prepareObserverContext(existingObservations, contextRecord ?? record);
43566
44052
  const output = await this.observe(observerContext.context ?? "", observationMessages, observerContext.wasTruncated);
44053
+ abortSignal?.throwIfAborted();
43567
44054
  let processed = await this.process(output, existingObservations);
44055
+ abortSignal?.throwIfAborted();
43568
44056
  let committedRecord = record;
43569
44057
  const outcome = await this.persist(processed);
43570
44058
  this.settleObservationCommit(outcome?.status === "committed" && !outcome.alreadyCovered);
@@ -43581,6 +44069,7 @@ var ObservationStrategy = class ObservationStrategy {
43581
44069
  processed = outcome.processed;
43582
44070
  committedRecord = outcome.record;
43583
44071
  }
44072
+ abortSignal?.throwIfAborted();
43584
44073
  await this.emitEndMarkers(cycleId, processed);
43585
44074
  if (this.needsReflection) await this.deps.reflector.maybeReflect({
43586
44075
  record: {
@@ -43608,6 +44097,7 @@ var ObservationStrategy = class ObservationStrategy {
43608
44097
  providerMetadata: output.providerMetadata
43609
44098
  };
43610
44099
  } catch (error) {
44100
+ if (abortSignal?.aborted) throw error;
43611
44101
  await this.emitFailedMarkers(cycleId, error);
43612
44102
  if (!this.rethrowOnFailure) {
43613
44103
  const failedMarkerForStorage = {
@@ -43770,6 +44260,7 @@ var ObservationStrategy = class ObservationStrategy {
43770
44260
  composedFrom = head.activeObservations ?? "";
43771
44261
  processed = await opts.recompose(head);
43772
44262
  }
44263
+ this.opts.abortSignal?.throwIfAborted();
43773
44264
  const input = {
43774
44265
  id: target.id,
43775
44266
  observations: processed.observations,
@@ -43806,7 +44297,10 @@ var ObservationStrategy = class ObservationStrategy {
43806
44297
  /** Runs one storage commit in this thread's (or resource's) slot of the process-wide commit queue. */
43807
44298
  runCommit(op) {
43808
44299
  const { threadId, resourceId, record } = this.opts;
43809
- return runOMCommit(getOMLockKey(this.scope, record.threadId ?? threadId, record.resourceId ?? resourceId), op);
44300
+ return runOMCommit(getOMLockKey(this.scope, record.threadId ?? threadId, record.resourceId ?? resourceId), () => {
44301
+ this.opts.abortSignal?.throwIfAborted();
44302
+ return op();
44303
+ }, { abortSignal: this.opts.abortSignal });
43810
44304
  }
43811
44305
  async indexObservationGroups(observations, threadId, resourceId, observedAt, recordId) {
43812
44306
  if (!resourceId || !this.deps.onIndexObservations) return;
@@ -43910,6 +44404,7 @@ var ObservationStrategy = class ObservationStrategy {
43910
44404
  return index;
43911
44405
  }
43912
44406
  async attachMarker(marker, msg, index, threadId, resourceId) {
44407
+ if (this.opts.abortSignal?.aborted) return;
43913
44408
  const parts = msg.content?.parts;
43914
44409
  if (!parts || !Array.isArray(parts)) return;
43915
44410
  const markerData = marker.data;
@@ -43931,7 +44426,7 @@ var ObservationStrategy = class ObservationStrategy {
43931
44426
  */
43932
44427
  async persistMarkerToStorage(marker, threadId, resourceId, opts) {
43933
44428
  try {
43934
- const assistants = ((await this.storage.listMessages({
44429
+ const result = await this.storage.listMessages({
43935
44430
  threadId,
43936
44431
  perPage: 20,
43937
44432
  orderBy: {
@@ -43939,7 +44434,9 @@ var ObservationStrategy = class ObservationStrategy {
43939
44434
  direction: "DESC"
43940
44435
  },
43941
44436
  ...opts?.notAfter ? { filter: { dateRange: { end: opts.notAfter } } } : {}
43942
- }))?.messages ?? []).filter((msg) => msg?.role === "assistant" && Array.isArray(msg.content?.parts));
44437
+ });
44438
+ if (this.opts.abortSignal?.aborted) return;
44439
+ const assistants = (result?.messages ?? []).filter((msg) => msg?.role === "assistant" && Array.isArray(msg.content?.parts));
43943
44440
  const startMessage = opts?.onlyIfObserved || opts?.onCycleStartMessage ? assistants.find((m) => afterOwnStartMarker(m, marker) !== -1) : void 0;
43944
44441
  const msg = opts?.onCycleStartMessage ? startMessage : startMessage ?? assistants[0];
43945
44442
  if (!msg) return;
@@ -43966,7 +44463,7 @@ var ObservationStrategy = class ObservationStrategy {
43966
44463
  * should fall back to `persistMarkerToStorage`).
43967
44464
  */
43968
44465
  async persistMarkerToMessage(marker, messageList, threadId, resourceId) {
43969
- if (!messageList) return false;
44466
+ if (this.opts.abortSignal?.aborted || !messageList) return false;
43970
44467
  const allMsgs = getObservableMessages(messageList);
43971
44468
  for (let i = allMsgs.length - 1; i >= 0; i--) {
43972
44469
  const msg = allMsgs[i];
@@ -44207,6 +44704,7 @@ var SyncObservationStrategy = class extends ObservationStrategy {
44207
44704
  },
44208
44705
  lastObservedMessageCursor: getLastObservedMessageCursor(messages)
44209
44706
  });
44707
+ this.opts.abortSignal?.throwIfAborted();
44210
44708
  await this.storage.patchThread({
44211
44709
  id: threadId,
44212
44710
  ...shouldUpdateThreadTitle ? { title: newTitle } : {},
@@ -44880,6 +45378,7 @@ var ResourceScopedObservationStrategy = class extends ObservationStrategy {
44880
45378
  },
44881
45379
  lastObservedMessageCursor: update.lastObservedMessageCursor
44882
45380
  });
45381
+ this.opts.abortSignal?.throwIfAborted();
44883
45382
  await this.storage.patchThread({
44884
45383
  id: update.threadId,
44885
45384
  ...shouldUpdateThreadTitle ? { title: newTitle } : {},
@@ -45075,6 +45574,7 @@ var ObservationStep = class {
45075
45574
  * builds system message, filters observed.
45076
45575
  */
45077
45576
  async prepare() {
45577
+ this.turn.abortSignal?.throwIfAborted();
45078
45578
  if (this._prepared) throw new Error(`Step ${this.stepNumber} already prepared`);
45079
45579
  const { threadId, resourceId, messageList } = this.turn;
45080
45580
  const om = this.turn.om;
@@ -45087,6 +45587,7 @@ var ObservationStep = class {
45087
45587
  const step0Messages = this.stepNumber === 0 ? getObservableMessages(messageList) : [];
45088
45588
  if (this.stepNumber === 0) {
45089
45589
  const activation = await om.activate({
45590
+ abortSignal: this.turn.abortSignal,
45090
45591
  threadId,
45091
45592
  resourceId,
45092
45593
  checkThreshold: true,
@@ -45103,7 +45604,8 @@ var ObservationStep = class {
45103
45604
  await om.resetBufferingState({
45104
45605
  threadId,
45105
45606
  resourceId,
45106
- recordId: activation.record.id
45607
+ recordId: activation.record.id,
45608
+ abortSignal: this.turn.abortSignal
45107
45609
  });
45108
45610
  await this.turn.refreshRecord();
45109
45611
  }
@@ -45111,6 +45613,7 @@ var ObservationStep = class {
45111
45613
  const preReflectGeneration = record.generationCount;
45112
45614
  const obsTokens = record.observationTokenCount ?? 0;
45113
45615
  await om.reflector.maybeReflect({
45616
+ abortSignal: this.turn.abortSignal,
45114
45617
  record,
45115
45618
  observationTokens: obsTokens,
45116
45619
  threadId,
@@ -45159,12 +45662,14 @@ var ObservationStep = class {
45159
45662
  const safeCandidates = selectSafeBufferPrefix(candidates);
45160
45663
  const deferred = candidates.length > 0 && safeCandidates.length === 0;
45161
45664
  if (safeCandidates.length > 0) {
45665
+ this.turn.abortSignal?.throwIfAborted();
45162
45666
  om.sealMessagesForBuffering(safeCandidates);
45163
45667
  try {
45164
45668
  await this.turn.hooks?.onBufferChunkSealed?.();
45165
45669
  } catch (error) {
45166
45670
  omDebug(`[OM:buffer] onBufferChunkSealed hook failed: ${error instanceof Error ? error.message : String(error)}`);
45167
45671
  }
45672
+ this.turn.abortSignal?.throwIfAborted();
45168
45673
  if (this.turn.memory) await this.turn.memory.persistMessages(safeCandidates);
45169
45674
  const inputIds = new Set(messageList.get.input.db().map((msg) => msg.id));
45170
45675
  const sealedOutput = safeCandidates.filter((msg) => !inputIds.has(msg.id));
@@ -45271,7 +45776,8 @@ var ObservationStep = class {
45271
45776
  threadId,
45272
45777
  resourceId,
45273
45778
  recordId: obsResult.record.id,
45274
- activatedMessageIds: obsResult.activatedMessageIds
45779
+ activatedMessageIds: obsResult.activatedMessageIds,
45780
+ abortSignal: this.turn.abortSignal
45275
45781
  });
45276
45782
  await this.turn.refreshRecord();
45277
45783
  if (this.turn.record.generationCount > preObsGeneration) reflected = true;
@@ -45337,7 +45843,7 @@ var ObservationStep = class {
45337
45843
  async runThresholdObservation(inAsyncObservationBand) {
45338
45844
  const { threadId, resourceId, messageList } = this.turn;
45339
45845
  const om = this.turn.om;
45340
- if (!inAsyncObservationBand) await om.waitForBuffering(threadId, resourceId);
45846
+ if (!inAsyncObservationBand) await om.waitForBuffering(threadId, resourceId, void 0, this.turn.abortSignal);
45341
45847
  await this.turn.refreshRecord();
45342
45848
  const observableMessages = this.seededResponseMessage ? getObservableMessages(messageList).filter((msg) => msg.id !== this.turn.responseMessageId) : getObservableMessages(messageList);
45343
45849
  let status = await om.getStatus({
@@ -45356,6 +45862,7 @@ var ObservationStep = class {
45356
45862
  let activated = false;
45357
45863
  while (status.shouldObserve && status.canActivate) {
45358
45864
  const activation = await om.activate({
45865
+ abortSignal: this.turn.abortSignal,
45359
45866
  threadId,
45360
45867
  resourceId,
45361
45868
  record: this.turn.record,
@@ -45396,6 +45903,7 @@ var ObservationStep = class {
45396
45903
  if (activated) {
45397
45904
  const preReflectionRecord = this.turn.record;
45398
45905
  await om.reflector.maybeReflect({
45906
+ abortSignal: this.turn.abortSignal,
45399
45907
  record: preReflectionRecord,
45400
45908
  observationTokens: preReflectionRecord.observationTokenCount ?? 0,
45401
45909
  threadId,
@@ -45436,6 +45944,7 @@ var ObservationStep = class {
45436
45944
  let obsResult;
45437
45945
  try {
45438
45946
  obsResult = await om.observe({
45947
+ abortSignal: this.turn.abortSignal,
45439
45948
  threadId,
45440
45949
  resourceId,
45441
45950
  messages: pendingMessages,
@@ -45472,6 +45981,7 @@ var ObservationStep = class {
45472
45981
  let messageToSeal = latestObservedIndex >= 0 ? liveMessages[latestObservedIndex] : void 0;
45473
45982
  if (this.stepNumber === 0 && messageToSeal?.role !== "assistant") messageToSeal = void 0;
45474
45983
  const messagesToSeal = messageToSeal ? [messageToSeal] : [];
45984
+ this.turn.abortSignal?.throwIfAborted();
45475
45985
  om.sealMessagesForBuffering(messagesToSeal);
45476
45986
  if (this.seededResponseMessage) omDebug("[OM:observe] skipping response-id rotation — step-0 seeded response message holds the active id");
45477
45987
  else try {
@@ -45603,7 +46113,9 @@ var ObservationTurn = class {
45603
46113
  responseMessageId;
45604
46114
  /** Processor-provided hooks for turn/step lifecycle integration. */
45605
46115
  hooks;
46116
+ abortSignal;
45606
46117
  constructor(opts) {
46118
+ this.abortSignal = opts.abortSignal;
45607
46119
  this.om = opts.om;
45608
46120
  this.threadId = opts.threadId;
45609
46121
  this.resourceId = opts.resourceId;
@@ -45717,7 +46229,7 @@ var ObservationTurn = class {
45717
46229
  if (unsavedMessages.length > 0) await this.om.persistMessages(unsavedMessages, this.threadId, this.resourceId);
45718
46230
  const asyncObservationEnabled = this.om.buffering.isAsyncObservationEnabled();
45719
46231
  const bufferOnIdle = this.om.getObservationConfig().bufferOnIdle;
45720
- if (asyncObservationEnabled && bufferOnIdle) {
46232
+ if (!this.abortSignal?.aborted && asyncObservationEnabled && bufferOnIdle) {
45721
46233
  const allMessages = getObservableMessages(messageList);
45722
46234
  const record = this._record;
45723
46235
  const idleMessages = selectSafeBufferPrefix(this.om.getUnobservedMessages(allMessages, record));
@@ -46069,7 +46581,7 @@ async function getThreadExtractedValues(storage, extractors, threadId) {
46069
46581
  const thread = await storage.getThreadById({ threadId });
46070
46582
  return getPriorExtractedValues((0, _mastra_core_memory.getThreadOMMetadata)(thread?.metadata), extractors);
46071
46583
  }
46072
- async function persistThreadExtractedValues(storage, extractors, threadId, values) {
46584
+ async function persistThreadExtractedValues(storage, extractors, threadId, values, abortSignal) {
46073
46585
  if (!threadId || !values) return;
46074
46586
  const metadataUpdate = buildThreadMetadataFromExtractedValues(extractors, values);
46075
46587
  const thread = await storage.getThreadById({ threadId });
@@ -46084,6 +46596,7 @@ async function persistThreadExtractedValues(storage, extractors, threadId, value
46084
46596
  ...metadataUpdate.extracted ?? {}
46085
46597
  }
46086
46598
  });
46599
+ abortSignal?.throwIfAborted();
46087
46600
  await storage.patchThread({
46088
46601
  id: threadId,
46089
46602
  metadata: newMetadata
@@ -46391,7 +46904,7 @@ var ReflectorRunner = class {
46391
46904
  ...failedMarker,
46392
46905
  transient: true
46393
46906
  }).catch(() => {});
46394
- await this.persistMarkerToStorage(failedMarker, streamContext.threadId, streamContext.resourceId);
46907
+ await this.persistMarkerToStorage(failedMarker, streamContext.threadId, streamContext.resourceId, abortSignal);
46395
46908
  const retryCycleId = crypto.randomUUID();
46396
46909
  streamContext.cycleId = retryCycleId;
46397
46910
  const startMarker = createObservationStartMarker({
@@ -46408,7 +46921,7 @@ var ReflectorRunner = class {
46408
46921
  ...startMarker,
46409
46922
  transient: true
46410
46923
  }).catch(() => {});
46411
- await this.persistMarkerToStorage(startMarker, streamContext.threadId, streamContext.resourceId);
46924
+ await this.persistMarkerToStorage(startMarker, streamContext.threadId, streamContext.resourceId, abortSignal);
46412
46925
  }
46413
46926
  currentLevel = Math.min(currentLevel + 1, maxLevel);
46414
46927
  }
@@ -46558,7 +47071,6 @@ var ReflectorRunner = class {
46558
47071
  const compressionStartLevel = await this.getCompressionStartLevel(requestContext);
46559
47072
  const reflectResult = await this.call(activeObservations, void 0, void 0, compressionTarget, void 0, true, compressionStartLevel, requestContext, priorExtractedValues, observabilityContext, void 0, mainAgent, sendSignal, currentModel);
46560
47073
  reflectResult.observations = await applyTextTransform(this.hooks, "afterReflection", reflectResult.observations, hookContext);
46561
- await persistThreadExtractedValues(this.storage, this.reflectionConfig.extractors, currentRecord.threadId ?? void 0, reflectResult.extractedValues);
46562
47074
  const reflectionTokenCount = this.tokenCounter.countObservations(reflectResult.observations);
46563
47075
  omDebug(`[OM:reflect] doAsyncBufferedReflection: reflector returned ${reflectionTokenCount} tokens (${reflectResult.observations?.length} chars), saving to recordId=${currentRecord.id}`);
46564
47076
  if (!await runOMCommit(this.buffering.getLockKey(currentRecord.threadId, currentRecord.resourceId), async () => {
@@ -46580,6 +47092,7 @@ var ReflectorRunner = class {
46580
47092
  };
46581
47093
  }
46582
47094
  omDebug(`[OM:reflect] doAsyncBufferedReflection: bufferedReflection saved with lineCount=${reflectedObservationLineCount}`);
47095
+ await persistThreadExtractedValues(this.storage, this.reflectionConfig.extractors, currentRecord.threadId ?? void 0, reflectResult.extractedValues);
46583
47096
  if (writer) {
46584
47097
  const endMarker = createBufferingEndMarker({
46585
47098
  cycleId,
@@ -46618,8 +47131,10 @@ var ReflectorRunner = class {
46618
47131
  else {
46619
47132
  omDebug(`[OM:reflect] tryActivateBufferedReflection: waiting for in-progress op...`);
46620
47133
  try {
46621
- await Promise.race([asyncOp, new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("Timeout")), 5e3))]);
46622
- } catch {}
47134
+ await waitWithAbort(Promise.race([asyncOp, new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("Timeout")), 5e3))]), committedContext?.abortSignal);
47135
+ } catch {
47136
+ committedContext?.abortSignal?.throwIfAborted();
47137
+ }
46623
47138
  }
46624
47139
  }
46625
47140
  const freshRecord = await this.storage.getObservationalMemory(record.threadId, record.resourceId);
@@ -46660,11 +47175,17 @@ var ReflectorRunner = class {
46660
47175
  }
46661
47176
  omDebug(`[OM:reflect] tryActivateBufferedReflection: activating, beforeTokens=${beforeTokens}, combinedTokenCount=${combinedTokenCount}, reflectedLineCount=${reflectedLineCount}, unreflectedLines=${unreflectedLines.length}`);
46662
47177
  const newRecordId = crypto.randomUUID();
46663
- const swapped = await runOMCommit(lockKey, () => this.storage.swapBufferedReflectionToActive({
46664
- currentRecord: freshRecord,
46665
- tokenCount: combinedTokenCount,
46666
- newRecordId
46667
- }), { priority: "reflection" });
47178
+ const swapped = await runOMCommit(lockKey, () => {
47179
+ committedContext?.abortSignal?.throwIfAborted();
47180
+ return this.storage.swapBufferedReflectionToActive({
47181
+ currentRecord: freshRecord,
47182
+ tokenCount: combinedTokenCount,
47183
+ newRecordId
47184
+ });
47185
+ }, {
47186
+ priority: "reflection",
47187
+ abortSignal: committedContext?.abortSignal
47188
+ });
46668
47189
  if (!isReflectionApplied(swapped, newRecordId, freshRecord.id)) {
46669
47190
  omDebug(`[OM:reflect] tryActivateBufferedReflection: buffered reflection on ${freshRecord.id} not applied (head is ${swapped.id})`);
46670
47191
  return { status: "not-applied" };
@@ -46704,7 +47225,7 @@ var ReflectorRunner = class {
46704
47225
  ...activationMarker,
46705
47226
  transient: true
46706
47227
  }).catch(() => {});
46707
- await this.persistMarkerToMessage(activationMarker, messageList, freshRecord.threadId ?? "", freshRecord.resourceId ?? void 0);
47228
+ await this.persistMarkerToMessage(activationMarker, messageList, freshRecord.threadId ?? "", freshRecord.resourceId ?? void 0, committedContext?.abortSignal);
46708
47229
  }
46709
47230
  BufferingCoordinator.reflectionBufferCycleIds.delete(bufferKey);
46710
47231
  return { status: "activated" };
@@ -46723,11 +47244,13 @@ var ReflectorRunner = class {
46723
47244
  * @internal Used by observation strategies. Do not call directly.
46724
47245
  */
46725
47246
  async maybeReflect(opts) {
47247
+ opts.abortSignal?.throwIfAborted();
46726
47248
  const { record: callerRecord, observationTokens, writer, abortSignal, mainAgent, sendSignal, sendStateSignal, messageList, currentModel, reflectionHooks, trigger, requestContext, observabilityContext, lastActivityAt, threadId: requestedThreadId } = opts;
46727
47249
  const record = { ...callerRecord };
46728
47250
  const lockKey = this.buffering.getLockKey(record.threadId, record.resourceId);
46729
47251
  const reflectThreshold = getMaxThreshold(this.getEffectiveReflectionTokens(record));
46730
47252
  const priorExtractedValues = await getThreadExtractedValues(this.storage, this.reflectionConfig.extractors, requestedThreadId ?? record.threadId);
47253
+ abortSignal?.throwIfAborted();
46731
47254
  if (this.buffering.isAsyncReflectionEnabled() && observationTokens < reflectThreshold) {
46732
47255
  if ((() => {
46733
47256
  if (!this.buffering.isAsyncReflectionEnabled()) return false;
@@ -46821,7 +47344,7 @@ var ReflectorRunner = class {
46821
47344
  ...startMarker,
46822
47345
  transient: true
46823
47346
  }).catch(() => {});
46824
- await this.persistMarkerToStorage(startMarker, threadId, record.resourceId ?? void 0);
47347
+ await this.persistMarkerToStorage(startMarker, threadId, record.resourceId ?? void 0, abortSignal);
46825
47348
  }
46826
47349
  this.emitDebugEvent({
46827
47350
  type: "reflection_triggered",
@@ -46859,21 +47382,29 @@ var ReflectorRunner = class {
46859
47382
  };
46860
47383
  const reflectResult = await this.call(await applyTextTransform(this.hooks, "beforeReflection", record.activeObservations, hookContext), void 0, streamContext, reflectThreshold, abortSignal, void 0, compressionStartLevel, requestContext, priorExtractedValues, observabilityContext, void 0, mainAgent, sendSignal, currentModel);
46861
47384
  reflectResult.observations = await applyTextTransform(this.hooks, "afterReflection", reflectResult.observations, hookContext);
47385
+ abortSignal?.throwIfAborted();
46862
47386
  reflectionUsage = reflectResult.usage;
46863
47387
  reflectionProviderMetadata = reflectResult.providerMetadata;
46864
47388
  const reflectionTokenCount = this.tokenCounter.countObservations(reflectResult.observations);
46865
47389
  const newRecordId = crypto.randomUUID();
46866
- const committedRecord = await runOMCommit(this.buffering.getLockKey(record.threadId, record.resourceId), () => this.storage.createReflectionGeneration({
46867
- currentRecord: record,
46868
- reflection: reflectResult.observations,
46869
- tokenCount: reflectionTokenCount,
46870
- newRecordId
46871
- }), { priority: "reflection" });
47390
+ const committedRecord = await runOMCommit(this.buffering.getLockKey(record.threadId, record.resourceId), () => {
47391
+ abortSignal?.throwIfAborted();
47392
+ return this.storage.createReflectionGeneration({
47393
+ currentRecord: record,
47394
+ reflection: reflectResult.observations,
47395
+ tokenCount: reflectionTokenCount,
47396
+ newRecordId
47397
+ });
47398
+ }, {
47399
+ priority: "reflection",
47400
+ abortSignal
47401
+ });
46872
47402
  if (!isReflectionApplied(committedRecord, newRecordId, record.id)) {
46873
47403
  omDebug(`[OM:reflect] reflection of ${record.id} not applied (head is ${committedRecord.id})`);
46874
47404
  throw new ReflectionNotAppliedError(record.id, committedRecord.id);
46875
47405
  }
46876
- await persistThreadExtractedValues(this.storage, this.reflectionConfig.extractors, record.threadId ?? void 0, reflectResult.extractedValues);
47406
+ abortSignal?.throwIfAborted();
47407
+ await persistThreadExtractedValues(this.storage, this.reflectionConfig.extractors, record.threadId ?? void 0, reflectResult.extractedValues, abortSignal);
46877
47408
  if (reflectionTokenCount >= reflectThreshold) this.syncReflectionSuppression.set(lockKey, reflectionTokenCount);
46878
47409
  else this.syncReflectionSuppression.delete(lockKey);
46879
47410
  await this.notifyReflectionCommitted({
@@ -46904,7 +47435,7 @@ var ReflectorRunner = class {
46904
47435
  ...endMarker,
46905
47436
  transient: true
46906
47437
  }).catch(() => {});
46907
- await this.persistMarkerToStorage(endMarker, threadId, record.resourceId ?? void 0);
47438
+ await this.persistMarkerToStorage(endMarker, threadId, record.resourceId ?? void 0, abortSignal);
46908
47439
  }
46909
47440
  this.emitDebugEvent({
46910
47441
  type: "reflection_complete",
@@ -46918,6 +47449,7 @@ var ReflectorRunner = class {
46918
47449
  });
46919
47450
  } catch (error) {
46920
47451
  reflectionError = error instanceof Error ? error : new Error(String(error));
47452
+ if (abortSignal?.aborted) throw error;
46921
47453
  const failedMarker = createObservationFailedMarker({
46922
47454
  cycleId: streamContext?.cycleId ?? cycleId,
46923
47455
  operationType: "reflection",
@@ -46934,12 +47466,12 @@ var ReflectorRunner = class {
46934
47466
  }).catch(() => {});
46935
47467
  let persistedToList = false;
46936
47468
  try {
46937
- persistedToList = await this.persistMarkerToMessage(failedMarker, messageList, threadId, record.resourceId ?? void 0);
47469
+ persistedToList = await this.persistMarkerToMessage(failedMarker, messageList, threadId, record.resourceId ?? void 0, abortSignal);
46938
47470
  } catch {
46939
47471
  persistedToList = false;
46940
47472
  }
46941
47473
  if (!persistedToList) try {
46942
- await this.persistMarkerToStorage(failedMarker, threadId, record.resourceId ?? void 0);
47474
+ await this.persistMarkerToStorage(failedMarker, threadId, record.resourceId ?? void 0, abortSignal);
46943
47475
  } catch (markerError) {
46944
47476
  omError("[OM] Failed to persist reflection-failed marker", markerError);
46945
47477
  }
@@ -47579,9 +48111,10 @@ var ObservationalMemory = class ObservationalMemory {
47579
48111
  * Acquire a lock for the given key, execute the callback, then release.
47580
48112
  * If a lock is already held, waits for it to be released before acquiring.
47581
48113
  */
47582
- async withLock(key, fn) {
48114
+ async withLock(key, fn, abortSignal) {
47583
48115
  const existingLock = this.locks.get(key);
47584
- if (existingLock) await existingLock;
48116
+ if (existingLock) await waitWithAbort(existingLock, abortSignal);
48117
+ abortSignal?.throwIfAborted();
47585
48118
  let releaseLock;
47586
48119
  const lockPromise = new Promise((resolve) => {
47587
48120
  releaseLock = resolve;
@@ -47723,8 +48256,8 @@ var ObservationalMemory = class ObservationalMemory {
47723
48256
  scope: this.scope,
47724
48257
  buffering: this.buffering,
47725
48258
  emitDebugEvent: (e) => this.emitDebugEvent(e),
47726
- persistMarkerToStorage: (m, t, r) => this.persistMarkerToStorage(m, t, r),
47727
- persistMarkerToMessage: (m, ml, t, r) => this.persistMarkerToMessage(m, ml, t, r),
48259
+ persistMarkerToStorage: (m, t, r, signal) => this.persistMarkerToStorage(m, t, r, { abortSignal: signal }),
48260
+ persistMarkerToMessage: (m, ml, t, r, signal) => this.persistMarkerToMessage(m, ml, t, r, signal),
47728
48261
  getCompressionStartLevel: (rc) => this.getCompressionStartLevel(rc),
47729
48262
  resolveModel: (inputTokens, options) => this.resolveReflectionModel(inputTokens, options),
47730
48263
  mastra: config.mastra,
@@ -47770,8 +48303,8 @@ var ObservationalMemory = class ObservationalMemory {
47770
48303
  * Wait for any in-flight async buffering operations for the given thread/resource.
47771
48304
  * Used by server endpoints to block until buffering completes so the UI can get final state.
47772
48305
  */
47773
- async waitForBuffering(threadId, resourceId, timeoutMs = 3e4) {
47774
- return BufferingCoordinator.awaitBuffering(threadId, resourceId, this.scope, timeoutMs);
48306
+ async waitForBuffering(threadId, resourceId, timeoutMs = 3e4, abortSignal) {
48307
+ return BufferingCoordinator.awaitBuffering(threadId, resourceId, this.scope, timeoutMs, abortSignal);
47775
48308
  }
47776
48309
  getConcreteModel(model, inputTokens) {
47777
48310
  if (model instanceof ModelByInputTokens) {
@@ -48074,7 +48607,8 @@ var ObservationalMemory = class ObservationalMemory {
48074
48607
  * assistant message; reflection markers belong to the current user input.
48075
48608
  * @internal Used by ReflectorRunner. Do not call directly.
48076
48609
  */
48077
- async persistMarkerToMessage(marker, messageList, threadId, resourceId) {
48610
+ async persistMarkerToMessage(marker, messageList, threadId, resourceId, abortSignal) {
48611
+ if (abortSignal?.aborted) return false;
48078
48612
  if (!messageList) return false;
48079
48613
  const allMsgs = messageList.get.all.db();
48080
48614
  const markerData = marker.data;
@@ -48111,7 +48645,7 @@ var ObservationalMemory = class ObservationalMemory {
48111
48645
  const targetRole = markerData?.operationType === "reflection" ? "user" : "assistant";
48112
48646
  const preferred = [...opts?.preferMessages ?? []].reverse().find((m) => m.role === targetRole && (!m.threadId || m.threadId === threadId));
48113
48647
  const preferredStored = preferred ? (await this.storage.listMessagesById({ messageIds: [preferred.id] })).messages : [];
48114
- const messages = (preferredStored.length ? { messages: preferredStored } : await this.storage.listMessages({
48648
+ const result = preferredStored.length ? { messages: preferredStored } : await this.storage.listMessages({
48115
48649
  threadId,
48116
48650
  perPage: 20,
48117
48651
  orderBy: {
@@ -48119,7 +48653,9 @@ var ObservationalMemory = class ObservationalMemory {
48119
48653
  direction: "DESC"
48120
48654
  },
48121
48655
  ...opts?.notAfter ? { filter: { dateRange: { end: opts.notAfter } } } : {}
48122
- }))?.messages ?? [];
48656
+ });
48657
+ if (opts?.abortSignal?.aborted) return;
48658
+ const messages = result?.messages ?? [];
48123
48659
  for (const msg of messages) if (msg?.role === targetRole && msg.content?.parts && Array.isArray(msg.content.parts)) {
48124
48660
  if (!(markerData?.cycleId && msg.content.parts.some((p) => p?.type === marker.type && p?.data?.cycleId === markerData.cycleId))) msg.content.parts.push(marker);
48125
48661
  await this.messageHistory.persistMessages({
@@ -48886,12 +49422,15 @@ ${formattedMessages}
48886
49422
  */
48887
49423
  /** @internal Used by ObservationStep. */
48888
49424
  async resetBufferingState(opts) {
48889
- const { threadId, resourceId, recordId, activatedMessageIds } = opts;
49425
+ const { threadId, resourceId, recordId, activatedMessageIds, abortSignal } = opts;
48890
49426
  const lockKey = this.buffering.getLockKey(threadId, resourceId);
48891
49427
  const bufKey = this.buffering.getObservationBufferKey(lockKey);
48892
49428
  BufferingCoordinator.setObservationBoundary(bufKey, 0);
48893
- await runOMCommit(lockKey, () => this.storage.setBufferingObservationFlag(recordId, false, 0)).catch(() => {});
48894
- if (activatedMessageIds && activatedMessageIds.length > 0) this.buffering.cleanupStaticMaps(threadId, resourceId, activatedMessageIds);
49429
+ try {
49430
+ await waitWithAbort(this.trackBackgroundWork(runOMCommit(lockKey, () => this.storage.setBufferingObservationFlag(recordId, false, 0)).catch(() => {}), lockKey), abortSignal);
49431
+ } finally {
49432
+ if (activatedMessageIds && activatedMessageIds.length > 0) this.buffering.cleanupStaticMaps(threadId, resourceId, activatedMessageIds);
49433
+ }
48895
49434
  }
48896
49435
  /**
48897
49436
  * Build the observation system message string for injection into an LLM prompt.
@@ -49419,6 +49958,7 @@ ${formattedMessages}
49419
49958
  */
49420
49959
  /** @internal Used by ObservationStep. */
49421
49960
  async activate(opts) {
49961
+ opts.abortSignal?.throwIfAborted();
49422
49962
  const { threadId, resourceId } = opts;
49423
49963
  const record = opts.record ?? await this.getOrCreateRecord(threadId, resourceId);
49424
49964
  if (this.buffering.isAsyncObservationEnabled()) {
@@ -49431,7 +49971,8 @@ ${formattedMessages}
49431
49971
  if (currentContextTokens < dbBoundary * .5) {
49432
49972
  omDebug(`[OM:activate] resetting stale lastBufferedBoundary: dbBoundary=${dbBoundary}, currentContextTokens=${currentContextTokens}`);
49433
49973
  BufferingCoordinator.setObservationBoundary(bufKey, 0);
49434
- await runOMCommit(lockKey, () => this.storage.setBufferingObservationFlag(record.id, false, 0)).catch(() => {});
49974
+ await runOMCommit(lockKey, () => this.storage.setBufferingObservationFlag(record.id, false, 0), { abortSignal: opts.abortSignal }).catch(() => {});
49975
+ opts.abortSignal?.throwIfAborted();
49435
49976
  }
49436
49977
  }
49437
49978
  }
@@ -49484,8 +50025,11 @@ ${formattedMessages}
49484
50025
  const threshold = calculateDynamicThreshold(this.getEffectiveMessageTokens(record), record.observationTokenCount ?? 0);
49485
50026
  if (activationTriggeredBy === "threshold" && !(livePendingTokens !== void 0 && blockAfter !== void 0 && livePendingTokens >= threshold && livePendingTokens < blockAfter)) {
49486
50027
  let timeoutId;
49487
- await Promise.race([pendingChunkWrite, new Promise((resolve) => timeoutId = setTimeout(resolve, 6e4))]);
49488
- clearTimeout(timeoutId);
50028
+ try {
50029
+ await waitWithAbort(Promise.race([pendingChunkWrite, new Promise((resolve) => timeoutId = setTimeout(resolve, 6e4))]), opts.abortSignal);
50030
+ } finally {
50031
+ clearTimeout(timeoutId);
50032
+ }
49489
50033
  }
49490
50034
  }
49491
50035
  const commitKey = this.buffering.getLockKey(threadId, resourceId);
@@ -49504,7 +50048,9 @@ ${formattedMessages}
49504
50048
  const currentPendingTokens = livePendingTokens ?? (head.pendingMessageTokens || totalChunkMessageTokens);
49505
50049
  const blockAfter = this.getEffectiveObservationBlockAfter(head);
49506
50050
  const forceMaxActivation = !!(blockAfter && currentPendingTokens >= blockAfter);
50051
+ opts.abortSignal?.throwIfAborted();
49507
50052
  if (head.pendingMessageTokens !== currentPendingTokens) await this.storage.setPendingMessageTokens(head.id, currentPendingTokens);
50053
+ opts.abortSignal?.throwIfAborted();
49508
50054
  return {
49509
50055
  head,
49510
50056
  chunks,
@@ -49517,7 +50063,7 @@ ${formattedMessages}
49517
50063
  bufferedChunks: chunks
49518
50064
  })
49519
50065
  };
49520
- });
50066
+ }, { abortSignal: opts.abortSignal });
49521
50067
  if (!swapped) return {
49522
50068
  activated: false,
49523
50069
  record
@@ -49533,9 +50079,10 @@ ${formattedMessages}
49533
50079
  record: await this.getRecord(threadId, resourceId) ?? record
49534
50080
  };
49535
50081
  const swappedRecordId = freshRecord.id;
49536
- await runOMCommit(commitKey, () => this.storage.setBufferingObservationFlag(swappedRecordId, false)).catch(() => {});
50082
+ await waitWithAbort(this.trackBackgroundWork(runOMCommit(commitKey, () => this.storage.setBufferingObservationFlag(swappedRecordId, false)).catch(() => {}), commitKey), opts.abortSignal).catch(() => {});
49537
50083
  unregisterOp(freshRecord.id, "bufferingObservation");
49538
50084
  const postSwapRecord = await this.storage.getObservationalMemory(record.threadId, record.resourceId);
50085
+ opts.abortSignal?.throwIfAborted();
49539
50086
  if (opts.writer && postSwapRecord && activationResult.activatedCycleIds.length > 0) {
49540
50087
  const perChunkMap = new Map(activationResult.perChunk?.map((c) => [c.cycleId, c]));
49541
50088
  for (const cycleId of activationResult.activatedCycleIds) {
@@ -49565,10 +50112,11 @@ ${formattedMessages}
49565
50112
  ...activationMarker,
49566
50113
  transient: true
49567
50114
  }).catch(() => {});
49568
- await this.persistMarkerToMessage(activationMarker, opts.messageList, record.threadId ?? "", record.resourceId ?? void 0);
50115
+ await this.persistMarkerToMessage(activationMarker, opts.messageList, record.threadId ?? "", record.resourceId ?? void 0, opts.abortSignal);
49569
50116
  }
49570
50117
  }
49571
50118
  const thread = await this.storage.getThreadById({ threadId });
50119
+ opts.abortSignal?.throwIfAborted();
49572
50120
  if (thread) {
49573
50121
  const activatedChunks = freshChunks.filter((c) => activationResult.activatedCycleIds.includes(c.cycleId));
49574
50122
  const lastActivated = activatedChunks[activatedChunks.length - 1];
@@ -49713,6 +50261,7 @@ ${formattedMessages}
49713
50261
  let recordInsideLock;
49714
50262
  try {
49715
50263
  await this.withLock(lockKey, async () => {
50264
+ opts.abortSignal?.throwIfAborted();
49716
50265
  const freshRecord = await this.getOrCreateRecord(threadId, resourceId);
49717
50266
  recordInsideLock = freshRecord;
49718
50267
  generationBefore = freshRecord.generationCount;
@@ -49731,6 +50280,7 @@ ${formattedMessages}
49731
50280
  resourceId,
49732
50281
  messages: unobservedMessages,
49733
50282
  messageList: opts.messageList,
50283
+ abortSignal: opts.abortSignal,
49734
50284
  reflectionHooks,
49735
50285
  trigger,
49736
50286
  agent: opts.agent,
@@ -49745,7 +50295,7 @@ ${formattedMessages}
49745
50295
  observationUsage = result.usage;
49746
50296
  observationProviderMetadata = result.providerMetadata;
49747
50297
  observationError = result.error;
49748
- });
50298
+ }, opts.abortSignal);
49749
50299
  } catch (error) {
49750
50300
  lifecycleError = error;
49751
50301
  observationError = error instanceof Error ? error : new Error(String(error));
@@ -50016,6 +50566,7 @@ ${formattedMessages}
50016
50566
  beginTurn(opts) {
50017
50567
  return new ObservationTurn({
50018
50568
  om: this,
50569
+ abortSignal: opts.abortSignal,
50019
50570
  threadId: opts.threadId,
50020
50571
  resourceId: opts.resourceId,
50021
50572
  messageList: opts.messageList,
@@ -50027,53 +50578,6 @@ ${formattedMessages}
50027
50578
  });
50028
50579
  }
50029
50580
  };
50030
- /**
50031
- * Detects provider errors that reject a request for exceeding the model's context window.
50032
- *
50033
- * Providers report this with different codes and wording, so this matches the known shapes
50034
- * (OpenAI and OpenAI-compatible APIs, Anthropic, Google, Bedrock, xAI, Mistral, local servers)
50035
- * against the error's message, code, response body and causes.
50036
- */
50037
- const CONTEXT_OVERFLOW_PATTERNS = [
50038
- /context[_ ]length[_ ]exceeded/i,
50039
- /maximum context length/i,
50040
- /maximum prompt length/i,
50041
- /prompt is too long/i,
50042
- /input is too long/i,
50043
- /exceed\w*\b[^.]{0,40}\bcontext (?:window|length|limit|size)/i,
50044
- /input token count[^.]{0,40}exceeds the maximum/i,
50045
- /reduce the length of the (?:messages|prompt|input)/i
50046
- ];
50047
- const MAX_CAUSE_DEPTH = 4;
50048
- function collectErrorText(error, depth = 0) {
50049
- if (depth > MAX_CAUSE_DEPTH || error == null) return [];
50050
- if (typeof error === "string") return [error];
50051
- if (typeof error !== "object") return [];
50052
- const record = error;
50053
- const texts = [];
50054
- for (const key of [
50055
- "message",
50056
- "code",
50057
- "type",
50058
- "responseBody"
50059
- ]) {
50060
- const value = record[key];
50061
- if (typeof value === "string") texts.push(value);
50062
- }
50063
- if (record.data && typeof record.data === "object") texts.push(...collectErrorText(record.data.error ?? record.data, depth + 1));
50064
- if (record.error && typeof record.error === "object") texts.push(...collectErrorText(record.error, depth + 1));
50065
- texts.push(...collectErrorText(record.cause, depth + 1));
50066
- return texts;
50067
- }
50068
- function isRateLimited(error, depth = 0) {
50069
- if (depth > MAX_CAUSE_DEPTH || error == null || typeof error !== "object") return false;
50070
- const record = error;
50071
- return record.statusCode === 429 || isRateLimited(record.cause, depth + 1);
50072
- }
50073
- function isContextOverflowError(error) {
50074
- if (isRateLimited(error)) return false;
50075
- return collectErrorText(error).some((text) => CONTEXT_OVERFLOW_PATTERNS.some((pattern) => pattern.test(text)));
50076
- }
50077
50581
  const TEMPORAL_GAP_REMINDER_TYPE = "temporal-gap";
50078
50582
  function getTemporalGapReminderText(gapText, timestamp) {
50079
50583
  return `${gapText} — ${formatTemporalTimestamp(new Date(timestamp))}`;
@@ -50187,10 +50691,11 @@ const CONTEXT_OVERFLOW_STEP_KEY = "__omContextOverflowStep";
50187
50691
  function isMastraGatewayModel(model) {
50188
50692
  return typeof model === "object" && model !== null && "gatewayId" in model && model.gatewayId === "mastra";
50189
50693
  }
50190
- function injectObservationContextMessages({ messageList, systemMessages, continuationMessage, threadId, resourceId }) {
50694
+ function injectObservationContextMessages({ messageList, systemMessages, continuationMessage, hasObservations, threadId, resourceId }) {
50191
50695
  if (!systemMessages?.length) return;
50192
50696
  messageList.clearSystemMessages("observational-memory");
50193
50697
  for (const msg of systemMessages) messageList.addSystem(msg, "observational-memory");
50698
+ if (!continuationMessage && !hasObservations) return;
50194
50699
  const contMsg = continuationMessage ?? {
50195
50700
  id: "om-continuation",
50196
50701
  role: "user",
@@ -50297,6 +50802,7 @@ var ObservationalMemoryProcessor = class {
50297
50802
  messageList,
50298
50803
  systemMessages,
50299
50804
  continuationMessage: ctx.continuationMessage,
50805
+ hasObservations: Boolean(ctx.omRecord?.activeObservations),
50300
50806
  threadId,
50301
50807
  resourceId
50302
50808
  });
@@ -50316,6 +50822,7 @@ var ObservationalMemoryProcessor = class {
50316
50822
  if (!this.turn || !state.__omTurn) {
50317
50823
  if (this.turn && !state.__omTurn) await this.turn.end().catch(() => {});
50318
50824
  this.turn = this.engine.beginTurn({
50825
+ abortSignal,
50319
50826
  threadId,
50320
50827
  resourceId,
50321
50828
  messageList,
@@ -50400,6 +50907,7 @@ var ObservationalMemoryProcessor = class {
50400
50907
  messageList,
50401
50908
  systemMessages: ctx.systemMessage,
50402
50909
  continuationMessage: this.turn.context.continuation,
50910
+ hasObservations: Boolean(this.turn.record.activeObservations),
50403
50911
  threadId,
50404
50912
  resourceId
50405
50913
  });
@@ -50417,7 +50925,7 @@ var ObservationalMemoryProcessor = class {
50417
50925
  });
50418
50926
  const finalTotalPending = ctx.status.pendingTokens;
50419
50927
  try {
50420
- await runOMCommit(this.engine.buffering.getLockKey(threadId, resourceId), () => this.engine.getStorage().setPendingMessageTokens(turnRecord.id, finalTotalPending));
50928
+ await runOMCommit(this.engine.buffering.getLockKey(threadId, resourceId), () => this.engine.getStorage().setPendingMessageTokens(turnRecord.id, finalTotalPending), { abortSignal });
50421
50929
  this.turn.patchRecord({ pendingMessageTokens: finalTotalPending });
50422
50930
  } catch {}
50423
50931
  if (reproCaptureEnabled) writeProcessInputStepReproCapture({
@@ -50469,16 +50977,17 @@ var ObservationalMemoryProcessor = class {
50469
50977
  if (!this.engine.getObservationConfig().observeOnContextOverflow) return;
50470
50978
  if (state[GATEWAY_STATE_KEY]) return;
50471
50979
  if (state[CONTEXT_OVERFLOW_STEP_KEY] === stepNumber) return;
50472
- if (!isContextOverflowError(error)) return;
50980
+ if ((0, _mastra_core_error.classifyProviderError)(error) !== "context_overflow") return;
50473
50981
  const context = this.engine.getThreadContext(requestContext, messageList);
50474
50982
  if (!context) return;
50475
50983
  if ((0, _mastra_core_memory.parseMemoryRequestContext)(requestContext)?.memoryConfig?.readOnly) return;
50476
50984
  state[CONTEXT_OVERFLOW_STEP_KEY] = stepNumber;
50477
50985
  omDebug(`[OM:processAPIError] context overflow at step ${stepNumber} — observing pending messages`);
50478
50986
  const { threadId, resourceId } = context;
50479
- await this.engine.waitForBuffering(threadId, resourceId);
50987
+ await this.engine.waitForBuffering(threadId, resourceId, void 0, args.abortSignal);
50480
50988
  const messages = getObservableMessages(messageList);
50481
50989
  const { activated } = await this.engine.activate({
50990
+ abortSignal: args.abortSignal,
50482
50991
  threadId,
50483
50992
  resourceId,
50484
50993
  messages,
@@ -50486,6 +50995,7 @@ var ObservationalMemoryProcessor = class {
50486
50995
  writer: args.writer
50487
50996
  });
50488
50997
  const { observed } = await this.engine.getTokenCounter().runWithModelContext(state.__omActorModelContext, () => this.engine.observe({
50998
+ abortSignal: args.abortSignal,
50489
50999
  threadId,
50490
51000
  resourceId,
50491
51001
  messages: getObservableMessages(messageList),
@@ -51749,8 +52259,8 @@ ${workingMemory}`;
51749
52259
  if (config.workingMemory?.schema) try {
51750
52260
  const schema = config.workingMemory.schema;
51751
52261
  let convertedSchema;
51752
- if (require_schema_CzbEIyhE.isStandardSchemaWithJSON(schema)) convertedSchema = schema["~standard"].jsonSchema.output({ target: "draft-07" });
51753
- else convertedSchema = require_schema_CzbEIyhE.toStandardSchema(schema)["~standard"].jsonSchema.output({ target: "draft-07" });
52262
+ if (require_schema_Bf12g7KC.isStandardSchemaWithJSON(schema)) convertedSchema = schema["~standard"].jsonSchema.output({ target: "draft-07" });
52263
+ else convertedSchema = require_schema_Bf12g7KC.toStandardSchema(schema)["~standard"].jsonSchema.output({ target: "draft-07" });
51754
52264
  return {
51755
52265
  format: "json",
51756
52266
  content: JSON.stringify(convertedSchema)
@@ -51781,7 +52291,8 @@ ${workingMemory}`;
51781
52291
  const workingMemoryConfig = config.workingMemory;
51782
52292
  if (config?.readOnly || workingMemoryConfig.agentManaged === false) return this.getReadOnlyWorkingMemoryInstruction({
51783
52293
  template: workingMemoryTemplate,
51784
- data: workingMemoryData
52294
+ data: workingMemoryData,
52295
+ autoUpdated: !config?.readOnly
51785
52296
  });
51786
52297
  return this.isVNextWorkingMemoryConfig(memoryConfig) ? this.__experimental_getWorkingMemoryToolInstructionVNext({
51787
52298
  template: workingMemoryTemplate,
@@ -52118,10 +52629,10 @@ ${template.content !== this.defaultWorkingMemoryTemplate ? `- Only store informa
52118
52629
  /**
52119
52630
  * Generate read-only working memory instructions.
52120
52631
  * This provides the working memory context without any tool update instructions.
52121
- * Used when memory is in readOnly mode.
52632
+ * Used when memory is in readOnly mode, or with `autoUpdated` when the app updates it (agentManaged: false).
52122
52633
  */
52123
- getReadOnlyWorkingMemoryInstruction({ data }) {
52124
- return `WORKING_MEMORY_SYSTEM_INSTRUCTION (READ-ONLY):
52634
+ getReadOnlyWorkingMemoryInstruction({ data, autoUpdated = false }) {
52635
+ return `WORKING_MEMORY_SYSTEM_INSTRUCTION (${autoUpdated ? "AUTO-UPDATED" : "READ-ONLY"}):
52125
52636
  The following is your working memory - persistent information about the user and conversation collected over previous interactions. This data is provided for context to help you maintain continuity.
52126
52637
 
52127
52638
  <working_memory_data>
@@ -52131,7 +52642,7 @@ ${data || "No working memory data available."}
52131
52642
  Guidelines:
52132
52643
  1. Use this information to provide personalized and contextually relevant responses
52133
52644
  2. Act naturally - don't mention this system to users. This information should inform your responses without being explicitly referenced
52134
- 3. This memory is read-only in the current session - you cannot update it
52645
+ 3. ${autoUpdated ? "This memory is updated automatically after each response. When the user shares or corrects information, acknowledge it naturally. Never say you can't save or update it" : "This memory is read-only in the current session - you cannot update it"}
52135
52646
 
52136
52647
  Notes:
52137
52648
  - This system is here so that you can maintain the conversation when your context window is very short
@@ -53259,8 +53770,7 @@ Notes:
53259
53770
  return new PinnedStateProcessor({ getKnowledgeStore: () => this.getKnowledgeStore() });
53260
53771
  }
53261
53772
  };
53262
- //#endregion
53263
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ignore/7.0.5/d6411cd18dd20fbb425503c2ba0ac12fc6b5c7b2b2481cbdc797c212eb8be050/node_modules/ignore/index.js
53773
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ignore/7.0.14/808b17988fa8533fe98882725cca12b21fbaf7385e5b53154e07188a2518551a/node_modules/ignore/index.js
53264
53774
  var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
53265
53775
  function makeArray(subject) {
53266
53776
  return Array.isArray(subject) ? subject : [subject];
@@ -53269,13 +53779,16 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53269
53779
  const EMPTY = "";
53270
53780
  const SPACE = " ";
53271
53781
  const ESCAPE = "\\";
53272
- const REGEX_TEST_BLANK_LINE = /^\s+$/;
53782
+ const REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
53783
+ const BOM = "";
53273
53784
  const REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
53785
+ const REGEX_ANCHORED_GLOBSTAR = /^\/\*{2,}$/;
53274
53786
  const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
53275
53787
  const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
53276
53788
  const REGEX_SPLITALL_CRLF = /\r?\n/g;
53277
- const REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
53278
- const REGEX_TEST_TRAILING_SLASH = /\/$/;
53789
+ const DOUBLE_SLASH = "//";
53790
+ const SLASH_CODE = 47;
53791
+ const DOT_CODE = 46;
53279
53792
  const SLASH = "/";
53280
53793
  let TMP_KEY_IGNORE = "node-ignore";
53281
53794
  /* istanbul ignore else */
@@ -53285,51 +53798,319 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53285
53798
  Object.defineProperty(object, key, { value });
53286
53799
  return value;
53287
53800
  };
53288
- const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
53289
53801
  const RETURN_FALSE = () => false;
53290
- const sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY);
53291
- const cleanRangeBackSlash = (slashes) => {
53292
- const { length } = slashes;
53293
- return slashes.slice(0, length - length % 2);
53802
+ const POSIX_CLASSES = {
53803
+ alnum: "0-9A-Za-z",
53804
+ alpha: "A-Za-z",
53805
+ blank: " \\t",
53806
+ cntrl: "\\x00-\\x1f\\x7f",
53807
+ digit: "0-9",
53808
+ graph: "!-.0-~",
53809
+ lower: "a-z",
53810
+ print: " -.0-~",
53811
+ punct: "!-.:-@\\[-`{-~",
53812
+ space: " \\t\\n\\r",
53813
+ upper: "A-Z",
53814
+ xdigit: "0-9A-Fa-f"
53815
+ };
53816
+ const CLASS_MEMBERS_TO_ESCAPE = "\\]^-[";
53817
+ const escapeMember = (char) => CLASS_MEMBERS_TO_ESCAPE.indexOf(char) < 0 ? char : ESCAPE + char;
53818
+ const NON_SLASH = "(?!\\/)";
53819
+ const classSource = (negated, body) => {
53820
+ if (negated) return `[^\\/${body}]`;
53821
+ const source = `[${body}]`;
53822
+ return new RegExp(source).test("/") ? NON_SLASH + source : source;
53823
+ };
53824
+ const scanBracket = (pattern, start) => {
53825
+ const { length } = pattern;
53826
+ let index = start + 1;
53827
+ let negated = EMPTY;
53828
+ const lead = pattern[index];
53829
+ if (lead === "!" || lead === "^") {
53830
+ negated = "^";
53831
+ index++;
53832
+ }
53833
+ let body = EMPTY;
53834
+ let prev = EMPTY;
53835
+ for (;;) {
53836
+ const char = pattern[index];
53837
+ if (char === UNDEFINED) return null;
53838
+ if (char === ESCAPE) {
53839
+ const escaped = pattern[index + 1];
53840
+ if (escaped === UNDEFINED) return null;
53841
+ body += escapeMember(escaped);
53842
+ prev = escaped;
53843
+ index++;
53844
+ } else if (char === "-" && prev && index + 1 < length && pattern[index + 1] !== "]") {
53845
+ index++;
53846
+ let to = pattern[index];
53847
+ if (to === ESCAPE) to = pattern[index += 1];
53848
+ if (prev <= to) body += `-${escapeMember(to)}`;
53849
+ prev = EMPTY;
53850
+ } else if (char === "[" && pattern[index + 1] === ":") {
53851
+ const nameStart = index + 2;
53852
+ let end = nameStart;
53853
+ while (end < length && pattern[end] !== "]") end++;
53854
+ if (end === length) return null;
53855
+ if (end > nameStart && pattern[end - 1] === ":") {
53856
+ const name = pattern.slice(nameStart, end - 1);
53857
+ if (!Object.prototype.hasOwnProperty.call(POSIX_CLASSES, name)) return null;
53858
+ body += POSIX_CLASSES[name];
53859
+ prev = EMPTY;
53860
+ index = end;
53861
+ } else {
53862
+ body += escapeMember("[");
53863
+ prev = "[";
53864
+ index = nameStart - 2;
53865
+ }
53866
+ } else {
53867
+ body += escapeMember(char);
53868
+ prev = char;
53869
+ }
53870
+ index++;
53871
+ if (pattern[index] === "]") return {
53872
+ end: index,
53873
+ source: classSource(negated, body)
53874
+ };
53875
+ }
53294
53876
  };
53877
+ const NEVER_MATCH = "[]";
53878
+ const PLACEHOLDER = "\0";
53879
+ const REGEX_RESTORE_PLACEHOLDER = new RegExp(`${PLACEHOLDER}(\\d+)${PLACEHOLDER}`, "g");
53880
+ const TRAILING_WILDCARD = "";
53881
+ const TRAILING_DOUBLESTAR = "";
53882
+ const isReserved = (char) => char === PLACEHOLDER || char === TRAILING_WILDCARD || char === TRAILING_DOUBLESTAR;
53883
+ const extractBrackets = (pattern) => {
53884
+ const sources = [];
53885
+ const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
53886
+ const { length } = pattern;
53887
+ let out = EMPTY;
53888
+ let index = 0;
53889
+ while (index < length) {
53890
+ const char = pattern[index];
53891
+ if (char === ESCAPE) {
53892
+ const escaped = pattern[index + 1];
53893
+ if (escaped === UNDEFINED || escaped === SLASH && index + 2 === length) out += hold(NEVER_MATCH);
53894
+ else if (escaped === "*" || escaped === "[" || escaped === SPACE) out += pattern.slice(index, index + 2);
53895
+ else out += hold(REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : isReserved(escaped) ? `[${escaped}]` : escaped);
53896
+ index += 2;
53897
+ } else if (isReserved(char)) {
53898
+ out += hold(`[${char}]`);
53899
+ index++;
53900
+ } else if (char === "[") {
53901
+ const scanned = scanBracket(pattern, index);
53902
+ if (scanned === null) {
53903
+ out += hold(NEVER_MATCH);
53904
+ index = length;
53905
+ } else {
53906
+ out += hold(scanned.source);
53907
+ index = scanned.end + 1;
53908
+ }
53909
+ } else {
53910
+ out += char;
53911
+ index++;
53912
+ }
53913
+ }
53914
+ return {
53915
+ source: out,
53916
+ sources
53917
+ };
53918
+ };
53919
+ const DIRECT = null;
53920
+ const REGEX_INNER_SLASH = /\/(?!$)/;
53295
53921
  const REPLACERS = [
53296
- [/^\uFEFF/, () => EMPTY],
53297
- [/((?:\\\\)*?)(\\?\s+)$/, (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)],
53298
- [/(\\+?)\s/g, (_, m1) => {
53299
- const { length } = m1;
53300
- return m1.slice(0, length - length % 2) + SPACE;
53301
- }],
53922
+ [
53923
+ /(\\+)( ?)/g,
53924
+ (_, run, space) => space ? run.slice(0, run.length - run.length % 2) + SPACE : run,
53925
+ "\\ "
53926
+ ],
53927
+ [
53928
+ /(^|\/)\*{3,}(?=\/|$)/g,
53929
+ (_, start) => `${start}**`,
53930
+ "*"
53931
+ ],
53302
53932
  [/[\\$.|*+(){^]/g, (match) => `\\${match}`],
53303
- [/(?!\\)\?/g, () => "[^/]"],
53304
- [/^\//, () => "^"],
53305
- [/\//g, () => "\\/"],
53306
- [/^\^*\\\*\\\*\\\//, () => "^(?:.*\\/)?"],
53307
- [/^(?=[^^])/, function startingReplacer() {
53308
- return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
53933
+ [
53934
+ /(?!\\)\?/g,
53935
+ () => "[^/]",
53936
+ "?"
53937
+ ],
53938
+ [
53939
+ /^\//,
53940
+ () => "^",
53941
+ SLASH
53942
+ ],
53943
+ [
53944
+ /\//g,
53945
+ () => "\\/",
53946
+ SLASH
53947
+ ],
53948
+ [
53949
+ /^\^*(?:\\\*\\\*\\\/)+/,
53950
+ () => "^(?:.*\\/)?",
53951
+ "*"
53952
+ ],
53953
+ [DIRECT, (source, pattern) => {
53954
+ if (!source || source[0] === "^") return source;
53955
+ return (!REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^") + source;
53309
53956
  }],
53310
- [/\\\/\\\*\\\*(?=\\\/|$)/g, (_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"],
53311
- [/(^|[^\\]+)(\\\*)+(?=.+)/g, (_, p1, p2) => {
53312
- return p1 + p2.replace(/\\\*/g, "[^\\/]*");
53313
- }],
53314
- [/\\\\\\(?=[$.|*+(){^])/g, () => ESCAPE],
53315
- [/\\\\/g, () => ESCAPE],
53316
- [/(\\)?\[([^\]/]*?)(\\*)($|\])/g, (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"],
53317
- [/(?:[^*])$/, (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`]
53957
+ [
53958
+ /\\\/\\\*\\\*(?=\\\/|$)/g,
53959
+ (_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : `\\/${TRAILING_DOUBLESTAR}`,
53960
+ "*"
53961
+ ],
53962
+ [
53963
+ /(^|[^\\]+)(\\\*)+(?=.+)/g,
53964
+ (_, p1, p2) => {
53965
+ return p1 + p2.replace(/\\\*/g, "[^\\/]*");
53966
+ },
53967
+ "*"
53968
+ ],
53969
+ [
53970
+ /(^|[^\\])((?:\\\\)*)\\\*$/,
53971
+ (match, p1, p2) => p2 === EMPTY ? p1 + TRAILING_WILDCARD : match,
53972
+ "*"
53973
+ ],
53974
+ [
53975
+ /\\\\\\(?=[$.|*+(){^])/g,
53976
+ () => ESCAPE,
53977
+ "\\\\"
53978
+ ],
53979
+ [
53980
+ /\\\\/g,
53981
+ () => ESCAPE,
53982
+ "\\\\"
53983
+ ],
53984
+ [
53985
+ /\\\[([^\]/]*?)($|\])/g,
53986
+ (match, range, close) => `\\[${range}${close}`,
53987
+ "["
53988
+ ],
53989
+ [DIRECT, (source) => {
53990
+ const last = source[source.length - 1];
53991
+ if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) return source;
53992
+ return last === SLASH ? `${source}$` : `${source}(?=$|\\/$)`;
53993
+ }]
53318
53994
  ];
53319
- const REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
53995
+ const REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\uE000$/;
53320
53996
  const MODE_IGNORE = "regex";
53321
53997
  const MODE_CHECK_IGNORE = "checkRegex";
53322
- const TRAILING_WILD_CARD_REPLACERS = {
53323
- [MODE_IGNORE](_, p1) {
53324
- return `${p1 ? `${p1}[^/]+` : "[^/]*"}(?=$|\\/$)`;
53325
- },
53326
- [MODE_CHECK_IGNORE](_, p1) {
53327
- return `${p1 ? `${p1}[^/]*` : "[^/]*"}(?=$|\\/$)`;
53998
+ const replaceTrailingWildcard = (_, p1) => {
53999
+ return `${p1 ? `${p1}[^/]+` : "[^/]*"}(?=$|\\/$)`;
54000
+ };
54001
+ const REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
54002
+ const replaceTrailingDoublestar = () => ".+(?=$|\\/$)";
54003
+ const WILDCARD = "[^\\/]*";
54004
+ const separatorAfter = (run, at) => {
54005
+ let separator = EMPTY;
54006
+ for (let index = at + 1; index < run.length && !run[index].wildcard; index++) separator += run[index].single;
54007
+ return separator;
54008
+ };
54009
+ const pinWildcards = (source) => {
54010
+ if (source.indexOf(WILDCARD) < 0) return source;
54011
+ const tokens = [];
54012
+ const { length } = source;
54013
+ let index = 0;
54014
+ while (index < length) {
54015
+ const char = source[index];
54016
+ if (source.startsWith(WILDCARD, index)) {
54017
+ tokens.push({ wildcard: true });
54018
+ index += 6;
54019
+ } else if (char === "[") {
54020
+ let end = index + 1;
54021
+ if (source[end] === "^") end++;
54022
+ if (source[end] === "]") end++;
54023
+ while (end < length && source[end] !== "]") end += source[end] === ESCAPE ? 2 : 1;
54024
+ end++;
54025
+ tokens.push({ single: source.slice(index, end) });
54026
+ index = end;
54027
+ } else if (char === ESCAPE) {
54028
+ tokens.push({ single: source.slice(index, index + 2) });
54029
+ index += 2;
54030
+ } else if (char === "(") {
54031
+ let depth = 0;
54032
+ let end = index;
54033
+ do {
54034
+ if (source[end] === ESCAPE) end++;
54035
+ else if (source[end] === "(") depth++;
54036
+ else if (source[end] === ")") depth--;
54037
+ end++;
54038
+ } while (end < length && depth > 0);
54039
+ if ("*+?".indexOf(source[end]) >= 0) end++;
54040
+ tokens.push({ boundary: source.slice(index, end) });
54041
+ index = end;
54042
+ } else if (char === "^" || char === "$") {
54043
+ tokens.push({ boundary: char });
54044
+ index++;
54045
+ } else {
54046
+ tokens.push({ single: char });
54047
+ index++;
54048
+ }
53328
54049
  }
54050
+ let out = EMPTY;
54051
+ let run = [];
54052
+ const flush = () => {
54053
+ let lastWildcard;
54054
+ run.forEach((token, at) => {
54055
+ if (token.wildcard) lastWildcard = at;
54056
+ });
54057
+ run.forEach((token, at) => {
54058
+ if (!token.wildcard) {
54059
+ out += token.single;
54060
+ return;
54061
+ }
54062
+ out += at === lastWildcard ? WILDCARD : `(?:(?!${separatorAfter(run, at)})[^\\/])*`;
54063
+ });
54064
+ run = [];
54065
+ };
54066
+ tokens.forEach((token) => {
54067
+ if (token.boundary === void 0) {
54068
+ run.push(token);
54069
+ return;
54070
+ }
54071
+ flush();
54072
+ out += token.boundary;
54073
+ });
54074
+ flush();
54075
+ return out;
54076
+ };
54077
+ const makeRegexPrefix = (pattern) => {
54078
+ if (REGEX_ANCHORED_GLOBSTAR.test(pattern)) pattern = "**";
54079
+ const { source, sources } = extractBrackets(pattern);
54080
+ const replaced = REPLACERS.reduce((prev, [matcher, replacer, required]) => {
54081
+ if (matcher === DIRECT) return replacer(prev, pattern);
54082
+ if (required !== UNDEFINED && prev.indexOf(required) < 0) return prev;
54083
+ return matcher.test(prev) ? prev.replace(matcher, replacer.bind(pattern)) : prev;
54084
+ }, source);
54085
+ return sources.length ? replaced.replace(REGEX_RESTORE_PLACEHOLDER, (match, index) => sources[index]) : replaced;
54086
+ };
54087
+ const checkSourceOf = (body, prefix) => {
54088
+ if (body[body.length - 1] === SLASH) prefix = makeRegexPrefix(body.slice(0, -1));
54089
+ const head = prefix.slice(0, -1);
54090
+ const last = prefix[prefix.length - 1];
54091
+ return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? `${head}.*$` : NEVER_MATCH;
54092
+ };
54093
+ const matchesBasename = (body) => {
54094
+ const index = body.indexOf(SLASH);
54095
+ return index < 0 || index === body.length - 1;
54096
+ };
54097
+ const basenameOf = (path) => {
54098
+ const end = path.length - 1;
54099
+ const index = path.lastIndexOf(SLASH, path[end] === SLASH ? end - 1 : end);
54100
+ return index < 0 ? path : path.slice(index + 1);
54101
+ };
54102
+ const parentOf = (path) => {
54103
+ if (path.charCodeAt(0) === SLASH_CODE || path.indexOf(DOUBLE_SLASH) >= 0) {
54104
+ const slices = path.split(SLASH).filter(Boolean);
54105
+ slices.pop();
54106
+ return slices.length ? slices.join(SLASH) + SLASH : EMPTY;
54107
+ }
54108
+ const end = path.length - 1;
54109
+ const cut = path.lastIndexOf(SLASH, path.charCodeAt(end) === SLASH_CODE ? end - 1 : end);
54110
+ return cut < 0 ? EMPTY : path.slice(0, cut + 1);
53329
54111
  };
53330
- const makeRegexPrefix = (pattern) => REPLACERS.reduce((prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)), pattern);
53331
54112
  const isString = (subject) => typeof subject === "string";
53332
- const checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
54113
+ const checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern);
53333
54114
  const splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
53334
54115
  var IgnoreRule = class {
53335
54116
  constructor(pattern, mark, body, ignoreCase, negative, prefix) {
@@ -53340,6 +54121,9 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53340
54121
  define(this, "ignoreCase", ignoreCase);
53341
54122
  define(this, "regexPrefix", prefix);
53342
54123
  }
54124
+ get _basenameOnly() {
54125
+ return define(this, "_basenameOnly", matchesBasename(this.body));
54126
+ }
53343
54127
  get regex() {
53344
54128
  const key = "_regex";
53345
54129
  if (this[key]) return this[key];
@@ -53351,18 +54135,33 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53351
54135
  return this._make(MODE_CHECK_IGNORE, key);
53352
54136
  }
53353
54137
  _make(mode, key) {
53354
- const str = this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, TRAILING_WILD_CARD_REPLACERS[mode]);
54138
+ const str = pinWildcards(mode === MODE_IGNORE ? this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, replaceTrailingWildcard).replace(REGEX_REPLACE_TRAILING_DOUBLESTAR, replaceTrailingDoublestar) : checkSourceOf(this.body, this.regexPrefix));
53355
54139
  const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
53356
54140
  return define(this, key, regex);
53357
54141
  }
53358
54142
  };
54143
+ const isLineEnd = (char) => char === "\r" || char === "\n";
54144
+ const trimEnd = (body) => {
54145
+ let end = body.length;
54146
+ while (end && isLineEnd(body[end - 1])) end--;
54147
+ const lineEnd = end;
54148
+ while (end && body[end - 1] === SPACE) end--;
54149
+ if (end === lineEnd) return body.slice(0, end);
54150
+ let backslashes = 0;
54151
+ while (backslashes < end && body[end - backslashes - 1] === ESCAPE) backslashes++;
54152
+ return backslashes % 2 ? body.slice(0, end - 1) + SPACE : body.slice(0, end);
54153
+ };
53359
54154
  const createRule = ({ pattern, mark }, ignoreCase) => {
54155
+ let body = pattern[0] === BOM ? pattern.slice(1) : pattern;
54156
+ if (body[0] === "#") return;
53360
54157
  let negative = false;
53361
- let body = pattern;
53362
- if (body.indexOf("!") === 0) {
54158
+ if (body[0] === "!") {
53363
54159
  negative = true;
53364
- body = body.substr(1);
54160
+ body = body.slice(1);
53365
54161
  }
54162
+ const last = body[body.length - 1];
54163
+ if (last === SPACE || last === "\r" || last === "\n") body = trimEnd(body);
54164
+ if (!body) return;
53366
54165
  body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
53367
54166
  const regexPrefix = makeRegexPrefix(body);
53368
54167
  return new IgnoreRule(pattern, mark, body, ignoreCase, negative, regexPrefix);
@@ -53371,37 +54170,43 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53371
54170
  constructor(ignoreCase) {
53372
54171
  this._ignoreCase = ignoreCase;
53373
54172
  this._rules = [];
54173
+ this._basenameCount = 0;
53374
54174
  }
53375
54175
  _add(pattern) {
53376
54176
  if (pattern && pattern[KEY_IGNORE]) {
53377
54177
  this._rules = this._rules.concat(pattern._rules._rules);
54178
+ this._basenameCount += pattern._rules._basenameCount;
53378
54179
  this._added = true;
53379
54180
  return;
53380
54181
  }
53381
54182
  if (isString(pattern)) pattern = { pattern };
53382
- if (checkPattern(pattern.pattern)) {
53383
- const rule = createRule(pattern, this._ignoreCase);
54183
+ const rule = checkPattern(pattern.pattern) && createRule(pattern, this._ignoreCase);
54184
+ if (rule) {
53384
54185
  this._added = true;
53385
54186
  this._rules.push(rule);
54187
+ if (matchesBasename(rule.body)) this._basenameCount++;
53386
54188
  }
53387
54189
  }
53388
54190
  add(pattern) {
53389
54191
  this._added = false;
53390
54192
  makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._add, this);
54193
+ if (this._added) this._literalRules = UNDEFINED;
53391
54194
  return this._added;
53392
54195
  }
53393
- test(path, checkUnignored, mode) {
54196
+ testLiteral(path) {
54197
+ const rules = this._literalRules || (this._literalRules = this._rules.filter(({ body }) => body[body.length - (body[body.length - 1] === SLASH ? 2 : 1)] === "*"));
53394
54198
  let ignored = false;
53395
54199
  let unignored = false;
53396
54200
  let matchedRule;
53397
- this._rules.forEach((rule) => {
53398
- const { negative } = rule;
53399
- if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) return;
53400
- if (!rule[mode].test(path)) return;
53401
- ignored = !negative;
53402
- unignored = negative;
53403
- matchedRule = negative ? UNDEFINED : rule;
53404
- });
54201
+ for (let index = rules.length - 1; index >= 0; index--) {
54202
+ const rule = rules[index];
54203
+ if (rule.checkRegex.test(path)) {
54204
+ ignored = !rule.negative;
54205
+ unignored = rule.negative;
54206
+ matchedRule = rule.negative ? UNDEFINED : rule;
54207
+ break;
54208
+ }
54209
+ }
53405
54210
  const ret = {
53406
54211
  ignored,
53407
54212
  unignored
@@ -53409,6 +54214,28 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53409
54214
  if (matchedRule) ret.rule = matchedRule;
53410
54215
  return ret;
53411
54216
  }
54217
+ test(path, mode) {
54218
+ const rules = this._rules;
54219
+ const { length } = rules;
54220
+ const shortcut = this._basenameCount * 2 >= length;
54221
+ const basename = shortcut ? basenameOf(path) : path;
54222
+ for (let index = length - 1; index >= 0; index--) {
54223
+ const rule = rules[index];
54224
+ if (rule[mode].test(shortcut && rule._basenameOnly ? basename : path)) {
54225
+ const { negative } = rule;
54226
+ const ret = {
54227
+ ignored: !negative,
54228
+ unignored: negative
54229
+ };
54230
+ if (!negative) ret.rule = rule;
54231
+ return ret;
54232
+ }
54233
+ }
54234
+ return {
54235
+ ignored: false,
54236
+ unignored: false
54237
+ };
54238
+ }
53412
54239
  };
53413
54240
  const throwError = (message, Ctor) => {
53414
54241
  throw new Ctor(message);
@@ -53419,7 +54246,16 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53419
54246
  if (checkPath.isNotRelative(path)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
53420
54247
  return true;
53421
54248
  };
53422
- const isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
54249
+ const isNotRelative = (path) => {
54250
+ const first = path.charCodeAt(0);
54251
+ if (first === SLASH_CODE) return true;
54252
+ if (first !== DOT_CODE) return false;
54253
+ if (path.length === 1) return true;
54254
+ const second = path.charCodeAt(1);
54255
+ if (second === SLASH_CODE) return true;
54256
+ if (second !== DOT_CODE) return false;
54257
+ return path.length === 2 || path.charCodeAt(2) === SLASH_CODE;
54258
+ };
53423
54259
  checkPath.isNotRelative = isNotRelative;
53424
54260
  /* istanbul ignore next */
53425
54261
  checkPath.convert = (p) => p;
@@ -53441,31 +54277,26 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53441
54277
  addPattern(pattern) {
53442
54278
  return this.add(pattern);
53443
54279
  }
53444
- _test(originalPath, cache, checkUnignored, slices) {
54280
+ _test(originalPath, cache) {
53445
54281
  const path = originalPath && checkPath.convert(originalPath);
53446
54282
  checkPath(path, originalPath, this._strictPathCheck ? throwError : RETURN_FALSE);
53447
- return this._t(path, cache, checkUnignored, slices);
54283
+ return this._t(path, cache);
53448
54284
  }
53449
54285
  checkIgnore(path) {
53450
- if (!REGEX_TEST_TRAILING_SLASH.test(path)) return this.test(path);
53451
- const slices = path.split(SLASH).filter(Boolean);
53452
- slices.pop();
53453
- if (slices.length) {
53454
- const parent = this._t(slices.join(SLASH) + SLASH, this._testCache, true, slices);
53455
- if (parent.ignored) return parent;
53456
- }
53457
- return this._rules.test(path, false, MODE_CHECK_IGNORE);
54286
+ if (path.charCodeAt(path.length - 1) !== SLASH_CODE) return this.test(path);
54287
+ const dir = this._t(path, this._testCache);
54288
+ if (dir.ignored) return dir;
54289
+ const literal = this._rules.testLiteral(path);
54290
+ return literal.ignored || literal.unignored ? literal : dir;
53458
54291
  }
53459
- _t(path, cache, checkUnignored, slices) {
54292
+ _t(path, cache) {
53460
54293
  if (path in cache) return cache[path];
53461
- if (!slices) slices = path.split(SLASH).filter(Boolean);
53462
- slices.pop();
53463
- if (!slices.length) return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
53464
- const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
53465
- return cache[path] = parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
54294
+ const parentPath = parentOf(path);
54295
+ const parent = parentPath ? this._t(parentPath, cache) : UNDEFINED;
54296
+ return cache[path] = parent && parent.ignored ? parent : this._rules.test(path, MODE_IGNORE);
53466
54297
  }
53467
54298
  ignores(path) {
53468
- return this._test(path, this._ignoreCache, false).ignored;
54299
+ return this._test(path, this._ignoreCache).ignored;
53469
54300
  }
53470
54301
  createFilter() {
53471
54302
  return (path) => !this.ignores(path);
@@ -53474,7 +54305,7 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53474
54305
  return makeArray(paths).filter(this.createFilter());
53475
54306
  }
53476
54307
  test(path) {
53477
- return this._test(path, this._testCache, true);
54308
+ return this._test(path, this._testCache);
53478
54309
  }
53479
54310
  };
53480
54311
  const factory = (options) => new Ignore(options);
@@ -53493,8 +54324,7 @@ var require_ignore = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((ex
53493
54324
  module.exports.isPathValid = isPathValid;
53494
54325
  define(module.exports, Symbol.for("setupWindows"), setupWindows);
53495
54326
  }));
53496
- //#endregion
53497
- //#region ../agent-builder/dist/index.js
54327
+ // ../agent-builder/dist/index.js
53498
54328
  var import_ignore = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_ignore(), 1);
53499
54329
  const UNIT_KINDS = [
53500
54330
  "mcp-server",
@@ -54052,23 +54882,23 @@ const createModelInstance = async (provider, modelId, version = "v2") => {
54052
54882
  try {
54053
54883
  const providerFn = version === `v1` ? { v1: {
54054
54884
  openai: async () => {
54055
- const { openai } = await Promise.resolve().then(() => require("./dist-C9Jwt1f0.cjs"));
54885
+ const { openai } = await Promise.resolve().then(() => require("./dist-D6oS7RF1.cjs"));
54056
54886
  return openai(modelId);
54057
54887
  },
54058
54888
  anthropic: async () => {
54059
- const { anthropic } = await Promise.resolve().then(() => require("./dist-lT2rqyY9.cjs"));
54889
+ const { anthropic } = await Promise.resolve().then(() => require("./dist-36GZrEvk.cjs"));
54060
54890
  return anthropic(modelId);
54061
54891
  },
54062
54892
  groq: async () => {
54063
- const { groq } = await Promise.resolve().then(() => require("./dist-DsrJXwic.cjs"));
54893
+ const { groq } = await Promise.resolve().then(() => require("./dist-D02J6PZG.cjs"));
54064
54894
  return groq(modelId);
54065
54895
  },
54066
54896
  xai: async () => {
54067
- const { xai } = await Promise.resolve().then(() => require("./dist-Bo3GdQwf.cjs"));
54897
+ const { xai } = await Promise.resolve().then(() => require("./dist-Bal15xNO.cjs"));
54068
54898
  return xai(modelId);
54069
54899
  },
54070
54900
  google: async () => {
54071
- const { google } = await Promise.resolve().then(() => require("./dist-B9ery9Zw.cjs"));
54901
+ const { google } = await Promise.resolve().then(() => require("./dist-lG-fYW7-.cjs"));
54072
54902
  return google(modelId);
54073
54903
  }
54074
54904
  } }[version][provider] : () => new _mastra_core_llm.ModelRouterLanguageModel(`${provider}/${modelId}`);
@@ -56233,7 +57063,7 @@ export const mastra = new Mastra({
56233
57063
  if (includeMetadata) {
56234
57064
  item.size = stats.size;
56235
57065
  item.lastModified = stats.mtime.toISOString();
56236
- item.permissions = `0${(stats.mode & parseInt("777", 8)).toString(8)}`;
57066
+ item.permissions = `0${(stats.mode & 511).toString(8)}`;
56237
57067
  }
56238
57068
  items.push(item);
56239
57069
  if (recursive && type === "directory") await processDirectory(fullPath, currentDepth + 1);
@@ -56747,7 +57577,7 @@ Return the actual exported names of the units, as well as the file names.`,
56747
57577
  });
56748
57578
  else {
56749
57579
  const standardSchema = (0, _mastra_core_schema.toStandardSchema)(output);
56750
- const jsonSchema = require_schema_CzbEIyhE.standardSchemaToJSONSchema(standardSchema);
57580
+ const jsonSchema = require_schema_Bf12g7KC.standardSchemaToJSONSchema(standardSchema);
56751
57581
  result = await agent.generateLegacy(prompt, {
56752
57582
  experimental_output: jsonSchema,
56753
57583
  maxSteps: 100
@@ -59993,40 +60823,40 @@ var API_NAME = "trace";
59993
60823
  })().getInstance();
59994
60824
  var __defProp = Object.defineProperty;
59995
60825
  var __export = (target, all) => {
59996
- for (var name16 in all) __defProp(target, name16, {
59997
- get: all[name16],
60826
+ for (var name17 in all) __defProp(target, name17, {
60827
+ get: all[name17],
59998
60828
  enumerable: true
59999
60829
  });
60000
60830
  };
60001
- var name6 = "AI_NoObjectGeneratedError";
60002
- var marker6 = `vercel.ai.error.${name6}`;
60003
- var symbol6 = Symbol.for(marker6);
60004
- var _a6;
60831
+ var name7 = "AI_NoObjectGeneratedError";
60832
+ var marker7 = `vercel.ai.error.${name7}`;
60833
+ var symbol7 = Symbol.for(marker7);
60834
+ var _a7;
60005
60835
  var NoObjectGeneratedError = class extends AISDKError {
60006
60836
  constructor({ message = "No object generated.", cause, text: text2, response, usage, finishReason }) {
60007
60837
  super({
60008
- name: name6,
60838
+ name: name7,
60009
60839
  message,
60010
60840
  cause
60011
60841
  });
60012
- this[_a6] = true;
60842
+ this[_a7] = true;
60013
60843
  this.text = text2;
60014
60844
  this.response = response;
60015
60845
  this.usage = usage;
60016
60846
  this.finishReason = finishReason;
60017
60847
  }
60018
60848
  static isInstance(error) {
60019
- return AISDKError.hasMarker(error, marker6);
60849
+ return AISDKError.hasMarker(error, marker7);
60020
60850
  }
60021
60851
  };
60022
- _a6 = symbol6;
60852
+ _a7 = symbol7;
60023
60853
  var dataContentSchema = zod_v4.z.union([
60024
60854
  zod_v4.z.string(),
60025
60855
  zod_v4.z.instanceof(Uint8Array),
60026
60856
  zod_v4.z.instanceof(ArrayBuffer),
60027
60857
  zod_v4.z.custom((value) => {
60028
- var _a16, _b;
60029
- return (_b = (_a16 = globalThis.Buffer) == null ? void 0 : _a16.isBuffer(value)) != null ? _b : false;
60858
+ var _a17, _b;
60859
+ return (_b = (_a17 = globalThis.Buffer) == null ? void 0 : _a17.isBuffer(value)) != null ? _b : false;
60030
60860
  }, { message: "Must be a Buffer" })
60031
60861
  ]);
60032
60862
  var jsonValueSchema = zod_v4.z.lazy(() => zod_v4.z.union([
@@ -61754,7 +62584,6 @@ const agentBuilderWorkflows = {
61754
62584
  };
61755
62585
  }).then(taskExecutionStep).commit()
61756
62586
  };
61757
- //#endregion
61758
62587
  exports.agentBuilderWorkflows = agentBuilderWorkflows;
61759
62588
  exports.createOpenAI = createOpenAI;
61760
62589
  exports.openai = openai;
@@ -61789,4 +62618,4 @@ Object.defineProperty(exports, "require_sync", {
61789
62618
  }
61790
62619
  });
61791
62620
 
61792
- //# sourceMappingURL=dist-CukR8zi9.cjs.map
62621
+ //# sourceMappingURL=dist-Clj7hRKz.cjs.map