@mastra/server 0.0.0-remove-cloud-span-transform-20250425214156 → 0.0.0-remove-unused-import-20250909212718

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 (334) hide show
  1. package/CHANGELOG.md +3541 -0
  2. package/LICENSE.md +11 -42
  3. package/README.md +48 -135
  4. package/dist/chunk-3THIIWWW.cjs +484 -0
  5. package/dist/chunk-3THIIWWW.cjs.map +1 -0
  6. package/dist/{chunk-L7XE5QTW.js → chunk-4QCXUEAT.js} +11 -2
  7. package/dist/chunk-4QCXUEAT.js.map +1 -0
  8. package/dist/chunk-4RRMWXQ2.js +3522 -0
  9. package/dist/chunk-4RRMWXQ2.js.map +1 -0
  10. package/dist/chunk-5DP5XZH6.cjs +928 -0
  11. package/dist/chunk-5DP5XZH6.cjs.map +1 -0
  12. package/dist/chunk-5QUKZCEF.js +476 -0
  13. package/dist/chunk-5QUKZCEF.js.map +1 -0
  14. package/dist/chunk-66YYHFGF.js +761 -0
  15. package/dist/chunk-66YYHFGF.js.map +1 -0
  16. package/dist/chunk-6GMFZ5LK.js +2774 -0
  17. package/dist/chunk-6GMFZ5LK.js.map +1 -0
  18. package/dist/chunk-6LUKYSWE.cjs +610 -0
  19. package/dist/chunk-6LUKYSWE.cjs.map +1 -0
  20. package/dist/chunk-743UIDHI.cjs +2013 -0
  21. package/dist/chunk-743UIDHI.cjs.map +1 -0
  22. package/dist/{chunk-FV45V6WC.cjs → chunk-7NADHFD2.cjs} +3 -7
  23. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  24. package/dist/chunk-7QEJ5QG5.js +151 -0
  25. package/dist/chunk-7QEJ5QG5.js.map +1 -0
  26. package/dist/chunk-A3AL7EWJ.js +83 -0
  27. package/dist/chunk-A3AL7EWJ.js.map +1 -0
  28. package/dist/{chunk-Q6SHQECN.js → chunk-A75S4TDD.js} +36 -10
  29. package/dist/chunk-A75S4TDD.js.map +1 -0
  30. package/dist/chunk-AK2FXLLB.cjs +849 -0
  31. package/dist/chunk-AK2FXLLB.cjs.map +1 -0
  32. package/dist/chunk-B2V3PUB7.js +591 -0
  33. package/dist/chunk-B2V3PUB7.js.map +1 -0
  34. package/dist/chunk-CY4TP3FK.js +16 -0
  35. package/dist/chunk-CY4TP3FK.js.map +1 -0
  36. package/dist/chunk-EMMSS5I5.cjs +37 -0
  37. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  38. package/dist/chunk-EMNGA4R4.js +845 -0
  39. package/dist/chunk-EMNGA4R4.js.map +1 -0
  40. package/dist/chunk-FALVL2VV.cjs +3525 -0
  41. package/dist/chunk-FALVL2VV.cjs.map +1 -0
  42. package/dist/chunk-FQNT7PI4.js +937 -0
  43. package/dist/chunk-FQNT7PI4.js.map +1 -0
  44. package/dist/chunk-G3PMV62Z.js +33 -0
  45. package/dist/chunk-G3PMV62Z.js.map +1 -0
  46. package/dist/chunk-G4PUALCE.cjs +28 -0
  47. package/dist/chunk-G4PUALCE.cjs.map +1 -0
  48. package/dist/chunk-GU4EWMZB.cjs +769 -0
  49. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  50. package/dist/chunk-GUI3CROV.cjs +159 -0
  51. package/dist/chunk-GUI3CROV.cjs.map +1 -0
  52. package/dist/chunk-HJQKWRKQ.cjs +764 -0
  53. package/dist/chunk-HJQKWRKQ.cjs.map +1 -0
  54. package/dist/chunk-HVBBFCDH.cjs +2321 -0
  55. package/dist/chunk-HVBBFCDH.cjs.map +1 -0
  56. package/dist/chunk-HZJRQ5L3.cjs +1411 -0
  57. package/dist/chunk-HZJRQ5L3.cjs.map +1 -0
  58. package/dist/chunk-IGFMAZZ5.cjs +1150 -0
  59. package/dist/chunk-IGFMAZZ5.cjs.map +1 -0
  60. package/dist/chunk-IOQGI4ML.js +931 -0
  61. package/dist/chunk-IOQGI4ML.js.map +1 -0
  62. package/dist/chunk-IY34NOLA.cjs +150 -0
  63. package/dist/chunk-IY34NOLA.cjs.map +1 -0
  64. package/dist/chunk-J7BPKKOG.cjs +163 -0
  65. package/dist/chunk-J7BPKKOG.cjs.map +1 -0
  66. package/dist/chunk-KNGXRN26.cjs +335 -0
  67. package/dist/chunk-KNGXRN26.cjs.map +1 -0
  68. package/dist/{chunk-WTHDCRMY.js → chunk-KV6VHX4V.js} +33 -8
  69. package/dist/chunk-KV6VHX4V.js.map +1 -0
  70. package/dist/chunk-L265APUD.cjs +69 -0
  71. package/dist/chunk-L265APUD.cjs.map +1 -0
  72. package/dist/chunk-LF2ZLOFP.js +767 -0
  73. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  74. package/dist/chunk-LYPU75T6.js +1147 -0
  75. package/dist/chunk-LYPU75T6.js.map +1 -0
  76. package/dist/chunk-M2YFWHSB.js +455 -0
  77. package/dist/chunk-M2YFWHSB.js.map +1 -0
  78. package/dist/chunk-MLGHQDZZ.js +15671 -0
  79. package/dist/chunk-MLGHQDZZ.js.map +1 -0
  80. package/dist/{chunk-TRDNDNGQ.js → chunk-MMROOK5J.js} +4 -7
  81. package/dist/chunk-MMROOK5J.js.map +1 -0
  82. package/dist/chunk-N7F33WAD.js +2290 -0
  83. package/dist/chunk-N7F33WAD.js.map +1 -0
  84. package/dist/chunk-NG5IVLEZ.js +1012 -0
  85. package/dist/chunk-NG5IVLEZ.js.map +1 -0
  86. package/dist/chunk-OGW6HHVI.js +1408 -0
  87. package/dist/chunk-OGW6HHVI.js.map +1 -0
  88. package/dist/chunk-OZLRIVC4.cjs +588 -0
  89. package/dist/chunk-OZLRIVC4.cjs.map +1 -0
  90. package/dist/chunk-P7CIEIJ3.js +925 -0
  91. package/dist/chunk-P7CIEIJ3.js.map +1 -0
  92. package/dist/chunk-P7RBMCBE.cjs +934 -0
  93. package/dist/chunk-P7RBMCBE.cjs.map +1 -0
  94. package/dist/chunk-PPYGWINI.cjs +2777 -0
  95. package/dist/chunk-PPYGWINI.cjs.map +1 -0
  96. package/dist/{chunk-7IWQE76Z.cjs → chunk-PWTXZZTR.cjs} +37 -11
  97. package/dist/chunk-PWTXZZTR.cjs.map +1 -0
  98. package/dist/chunk-R7NOGUZG.js +65 -0
  99. package/dist/chunk-R7NOGUZG.js.map +1 -0
  100. package/dist/chunk-RCHEPTZZ.js +2006 -0
  101. package/dist/chunk-RCHEPTZZ.js.map +1 -0
  102. package/dist/chunk-RE4RPXT2.cjs +18 -0
  103. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  104. package/dist/chunk-RW2D3G4K.cjs +470 -0
  105. package/dist/chunk-RW2D3G4K.cjs.map +1 -0
  106. package/dist/chunk-SIGXR3JT.cjs +1043 -0
  107. package/dist/chunk-SIGXR3JT.cjs.map +1 -0
  108. package/dist/chunk-SPLSYTYW.cjs +88 -0
  109. package/dist/chunk-SPLSYTYW.cjs.map +1 -0
  110. package/dist/chunk-SQY4T6EJ.js +571 -0
  111. package/dist/chunk-SQY4T6EJ.js.map +1 -0
  112. package/dist/{chunk-5JNVY6DU.js → chunk-SYRRSBGL.js} +48 -12
  113. package/dist/chunk-SYRRSBGL.js.map +1 -0
  114. package/dist/{chunk-M56ECCHK.cjs → chunk-T3TIA3O6.cjs} +22 -19
  115. package/dist/chunk-T3TIA3O6.cjs.map +1 -0
  116. package/dist/{chunk-LFOBHRFO.js → chunk-TTHEEIZ3.js} +83 -65
  117. package/dist/chunk-TTHEEIZ3.js.map +1 -0
  118. package/dist/chunk-TVSIG4JE.cjs +940 -0
  119. package/dist/chunk-TVSIG4JE.cjs.map +1 -0
  120. package/dist/{chunk-RE6YL32K.js → chunk-U46VIX2V.js} +54 -30
  121. package/dist/chunk-U46VIX2V.js.map +1 -0
  122. package/dist/{chunk-4JINXASC.js → chunk-WHN4VX55.js} +7 -4
  123. package/dist/chunk-WHN4VX55.js.map +1 -0
  124. package/dist/chunk-WZC6CIVD.cjs +120 -0
  125. package/dist/chunk-WZC6CIVD.cjs.map +1 -0
  126. package/dist/chunk-YITREQVN.cjs +15707 -0
  127. package/dist/chunk-YITREQVN.cjs.map +1 -0
  128. package/dist/dist-26HWEQY6.js +3 -0
  129. package/dist/dist-26HWEQY6.js.map +1 -0
  130. package/dist/dist-3A5DXB37.cjs +20 -0
  131. package/dist/dist-3A5DXB37.cjs.map +1 -0
  132. package/dist/dist-3SJKQJGY.cjs +16 -0
  133. package/dist/dist-3SJKQJGY.cjs.map +1 -0
  134. package/dist/dist-4ZQSPE5K.js +3 -0
  135. package/dist/dist-4ZQSPE5K.js.map +1 -0
  136. package/dist/dist-5W5QNRTD.js +3 -0
  137. package/dist/dist-5W5QNRTD.js.map +1 -0
  138. package/dist/dist-653SRMPL.js +3 -0
  139. package/dist/dist-653SRMPL.js.map +1 -0
  140. package/dist/dist-6U6EFC5C.cjs +16 -0
  141. package/dist/dist-6U6EFC5C.cjs.map +1 -0
  142. package/dist/dist-7IHNNYMF.cjs +16 -0
  143. package/dist/dist-7IHNNYMF.cjs.map +1 -0
  144. package/dist/dist-B5IPRF6W.js +3 -0
  145. package/dist/dist-B5IPRF6W.js.map +1 -0
  146. package/dist/dist-EOMYFT4Y.cjs +16 -0
  147. package/dist/dist-EOMYFT4Y.cjs.map +1 -0
  148. package/dist/dist-EZZMMMNT.cjs +16 -0
  149. package/dist/dist-EZZMMMNT.cjs.map +1 -0
  150. package/dist/dist-F2ET4MNO.cjs +16 -0
  151. package/dist/dist-F2ET4MNO.cjs.map +1 -0
  152. package/dist/dist-H64VX6DE.js +3 -0
  153. package/dist/dist-H64VX6DE.js.map +1 -0
  154. package/dist/dist-HY7RMLJQ.cjs +16 -0
  155. package/dist/dist-HY7RMLJQ.cjs.map +1 -0
  156. package/dist/dist-M6S4P3FJ.js +3 -0
  157. package/dist/dist-M6S4P3FJ.js.map +1 -0
  158. package/dist/dist-NR7QSCQT.js +3 -0
  159. package/dist/dist-NR7QSCQT.js.map +1 -0
  160. package/dist/dist-QLFMCMCX.js +3 -0
  161. package/dist/dist-QLFMCMCX.js.map +1 -0
  162. package/dist/dist-UY46BFRP.js +3 -0
  163. package/dist/dist-UY46BFRP.js.map +1 -0
  164. package/dist/dist-WCQDRTIV.cjs +16 -0
  165. package/dist/dist-WCQDRTIV.cjs.map +1 -0
  166. package/dist/dist-WKYB3LTJ.cjs +16 -0
  167. package/dist/dist-WKYB3LTJ.cjs.map +1 -0
  168. package/dist/index.cjs +2 -0
  169. package/dist/index.cjs.map +1 -0
  170. package/dist/index.d.ts +1 -0
  171. package/dist/index.d.ts.map +1 -0
  172. package/dist/index.js +2 -0
  173. package/dist/index.js.map +1 -0
  174. package/dist/server/a2a/protocol.d.ts +8 -0
  175. package/dist/server/a2a/protocol.d.ts.map +1 -0
  176. package/dist/server/a2a/store.cjs +25 -0
  177. package/dist/server/a2a/store.cjs.map +1 -0
  178. package/dist/server/a2a/store.d.ts +14 -0
  179. package/dist/server/a2a/store.d.ts.map +1 -0
  180. package/dist/server/a2a/store.js +23 -0
  181. package/dist/server/a2a/store.js.map +1 -0
  182. package/dist/server/a2a/tasks.d.ts +20 -0
  183. package/dist/server/a2a/tasks.d.ts.map +1 -0
  184. package/dist/server/handlers/a2a.cjs +32 -0
  185. package/dist/server/handlers/a2a.cjs.map +1 -0
  186. package/dist/server/handlers/a2a.d.ts +68 -0
  187. package/dist/server/handlers/a2a.d.ts.map +1 -0
  188. package/dist/server/handlers/a2a.js +3 -0
  189. package/dist/server/handlers/a2a.js.map +1 -0
  190. package/dist/server/handlers/agent-builder.cjs +68 -0
  191. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  192. package/dist/server/handlers/agent-builder.d.ts +87 -0
  193. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  194. package/dist/server/handlers/agent-builder.js +3 -0
  195. package/dist/server/handlers/agent-builder.js.map +1 -0
  196. package/dist/server/handlers/agents.cjs +37 -7
  197. package/dist/server/handlers/agents.cjs.map +1 -0
  198. package/dist/server/handlers/agents.d.ts +129 -6
  199. package/dist/server/handlers/agents.d.ts.map +1 -0
  200. package/dist/server/handlers/agents.js +3 -1
  201. package/dist/server/handlers/agents.js.map +1 -0
  202. package/dist/server/handlers/error.cjs +4 -2
  203. package/dist/server/handlers/error.cjs.map +1 -0
  204. package/dist/server/handlers/error.d.ts +2 -1
  205. package/dist/server/handlers/error.d.ts.map +1 -0
  206. package/dist/server/handlers/error.js +3 -1
  207. package/dist/server/handlers/error.js.map +1 -0
  208. package/dist/server/handlers/legacyWorkflows.cjs +48 -0
  209. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  210. package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
  211. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  212. package/dist/server/handlers/legacyWorkflows.js +3 -0
  213. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  214. package/dist/server/handlers/logs.cjs +6 -4
  215. package/dist/server/handlers/logs.cjs.map +1 -0
  216. package/dist/server/handlers/logs.d.ts +34 -3
  217. package/dist/server/handlers/logs.d.ts.map +1 -0
  218. package/dist/server/handlers/logs.js +3 -1
  219. package/dist/server/handlers/logs.js.map +1 -0
  220. package/dist/server/handlers/memory.cjs +39 -9
  221. package/dist/server/handlers/memory.cjs.map +1 -0
  222. package/dist/server/handlers/memory.d.ts +118 -8
  223. package/dist/server/handlers/memory.d.ts.map +1 -0
  224. package/dist/server/handlers/memory.js +3 -1
  225. package/dist/server/handlers/memory.js.map +1 -0
  226. package/dist/server/handlers/network.cjs +7 -5
  227. package/dist/server/handlers/network.cjs.map +1 -0
  228. package/dist/server/handlers/network.d.ts +50 -4
  229. package/dist/server/handlers/network.d.ts.map +1 -0
  230. package/dist/server/handlers/network.js +3 -1
  231. package/dist/server/handlers/network.js.map +1 -0
  232. package/dist/server/handlers/observability.cjs +16 -0
  233. package/dist/server/handlers/observability.cjs.map +1 -0
  234. package/dist/server/handlers/observability.d.ts +23 -0
  235. package/dist/server/handlers/observability.d.ts.map +1 -0
  236. package/dist/server/handlers/observability.js +3 -0
  237. package/dist/server/handlers/observability.js.map +1 -0
  238. package/dist/server/handlers/scores.cjs +32 -0
  239. package/dist/server/handlers/scores.cjs.map +1 -0
  240. package/dist/server/handlers/scores.d.ts +49 -0
  241. package/dist/server/handlers/scores.d.ts.map +1 -0
  242. package/dist/server/handlers/scores.js +3 -0
  243. package/dist/server/handlers/scores.js.map +1 -0
  244. package/dist/server/handlers/telemetry.cjs +9 -3
  245. package/dist/server/handlers/telemetry.cjs.map +1 -0
  246. package/dist/server/handlers/telemetry.d.ts +33 -2
  247. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  248. package/dist/server/handlers/telemetry.js +3 -1
  249. package/dist/server/handlers/telemetry.js.map +1 -0
  250. package/dist/server/handlers/tools.cjs +11 -5
  251. package/dist/server/handlers/tools.cjs.map +1 -0
  252. package/dist/server/handlers/tools.d.ts +25 -4
  253. package/dist/server/handlers/tools.d.ts.map +1 -0
  254. package/dist/server/handlers/tools.js +3 -1
  255. package/dist/server/handlers/tools.js.map +1 -0
  256. package/dist/server/handlers/utils.cjs +8 -2
  257. package/dist/server/handlers/utils.cjs.map +1 -0
  258. package/dist/server/handlers/utils.d.ts +8 -1
  259. package/dist/server/handlers/utils.d.ts.map +1 -0
  260. package/dist/server/handlers/utils.js +3 -1
  261. package/dist/server/handlers/utils.js.map +1 -0
  262. package/dist/server/handlers/vNextNetwork.cjs +220 -0
  263. package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
  264. package/dist/server/handlers/vNextNetwork.d.ts +179 -0
  265. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
  266. package/dist/server/handlers/vNextNetwork.js +213 -0
  267. package/dist/server/handlers/vNextNetwork.js.map +1 -0
  268. package/dist/server/handlers/vector.cjs +9 -7
  269. package/dist/server/handlers/vector.cjs.map +1 -0
  270. package/dist/server/handlers/vector.d.ts +51 -6
  271. package/dist/server/handlers/vector.d.ts.map +1 -0
  272. package/dist/server/handlers/vector.js +3 -1
  273. package/dist/server/handlers/vector.js.map +1 -0
  274. package/dist/server/handlers/voice.cjs +10 -4
  275. package/dist/server/handlers/voice.cjs.map +1 -0
  276. package/dist/server/handlers/voice.d.ts +39 -3
  277. package/dist/server/handlers/voice.d.ts.map +1 -0
  278. package/dist/server/handlers/voice.js +3 -1
  279. package/dist/server/handlers/voice.js.map +1 -0
  280. package/dist/server/handlers/workflows.cjs +35 -13
  281. package/dist/server/handlers/workflows.cjs.map +1 -0
  282. package/dist/server/handlers/workflows.d.ts +73 -10
  283. package/dist/server/handlers/workflows.d.ts.map +1 -0
  284. package/dist/server/handlers/workflows.js +3 -1
  285. package/dist/server/handlers/workflows.js.map +1 -0
  286. package/dist/server/handlers.cjs +52 -30
  287. package/dist/server/handlers.cjs.map +1 -0
  288. package/dist/server/handlers.d.ts +15 -10
  289. package/dist/server/handlers.d.ts.map +1 -0
  290. package/dist/server/handlers.js +16 -10
  291. package/dist/server/handlers.js.map +1 -0
  292. package/dist/server/http-exception.d.ts +87 -0
  293. package/dist/server/http-exception.d.ts.map +1 -0
  294. package/dist/server/types.d.ts +10 -0
  295. package/dist/server/types.d.ts.map +1 -0
  296. package/dist/server/utils.d.ts +42 -0
  297. package/dist/server/utils.d.ts.map +1 -0
  298. package/package.json +51 -19
  299. package/dist/_tsup-dts-rollup.d.cts +0 -648
  300. package/dist/_tsup-dts-rollup.d.ts +0 -648
  301. package/dist/chunk-2FJURXCL.cjs +0 -213
  302. package/dist/chunk-3AHQ5RGN.js +0 -11
  303. package/dist/chunk-3EJZQ6TQ.js +0 -49
  304. package/dist/chunk-55HTWX4C.cjs +0 -93
  305. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  306. package/dist/chunk-B66WVPGJ.js +0 -297
  307. package/dist/chunk-D3G23FP3.cjs +0 -126
  308. package/dist/chunk-FPIWDH5Y.cjs +0 -126
  309. package/dist/chunk-HCOPJZ4A.cjs +0 -164
  310. package/dist/chunk-OMN3UI6X.js +0 -5576
  311. package/dist/chunk-QN4KF3BH.cjs +0 -18
  312. package/dist/chunk-R4J7XQYU.js +0 -156
  313. package/dist/chunk-RBQASTUP.js +0 -203
  314. package/dist/chunk-SKBVVI24.cjs +0 -54
  315. package/dist/chunk-TZK63M5N.cjs +0 -317
  316. package/dist/chunk-ZHNKYTNS.cjs +0 -309
  317. package/dist/chunk-ZLBRQFDD.cjs +0 -13
  318. package/dist/index.d.cts +0 -1
  319. package/dist/server/handlers/agents.d.cts +0 -6
  320. package/dist/server/handlers/error.d.cts +0 -1
  321. package/dist/server/handlers/logs.d.cts +0 -3
  322. package/dist/server/handlers/memory.d.cts +0 -8
  323. package/dist/server/handlers/network.d.cts +0 -4
  324. package/dist/server/handlers/telemetry.d.cts +0 -2
  325. package/dist/server/handlers/tools.d.cts +0 -4
  326. package/dist/server/handlers/utils.d.cts +0 -1
  327. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  328. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  329. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  330. package/dist/server/handlers/vNextWorkflows.js +0 -1
  331. package/dist/server/handlers/vector.d.cts +0 -6
  332. package/dist/server/handlers/voice.d.cts +0 -3
  333. package/dist/server/handlers/workflows.d.cts +0 -10
  334. package/dist/server/handlers.d.cts +0 -10
@@ -0,0 +1,2321 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ // ../../node_modules/.pnpm/@ai-sdk+provider@2.0.0/node_modules/@ai-sdk/provider/dist/index.mjs
6
+ var marker = "vercel.ai.error";
7
+ var symbol = Symbol.for(marker);
8
+ var _a;
9
+ var _AISDKError = class _AISDKError2 extends Error {
10
+ /**
11
+ * Creates an AI SDK Error.
12
+ *
13
+ * @param {Object} params - The parameters for creating the error.
14
+ * @param {string} params.name - The name of the error.
15
+ * @param {string} params.message - The error message.
16
+ * @param {unknown} [params.cause] - The underlying cause of the error.
17
+ */
18
+ constructor({
19
+ name: name14,
20
+ message,
21
+ cause
22
+ }) {
23
+ super(message);
24
+ this[_a] = true;
25
+ this.name = name14;
26
+ this.cause = cause;
27
+ }
28
+ /**
29
+ * Checks if the given error is an AI SDK Error.
30
+ * @param {unknown} error - The error to check.
31
+ * @returns {boolean} True if the error is an AI SDK Error, false otherwise.
32
+ */
33
+ static isInstance(error) {
34
+ return _AISDKError2.hasMarker(error, marker);
35
+ }
36
+ static hasMarker(error, marker15) {
37
+ const markerSymbol = Symbol.for(marker15);
38
+ return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;
39
+ }
40
+ };
41
+ _a = symbol;
42
+ var AISDKError = _AISDKError;
43
+ var name = "AI_APICallError";
44
+ var marker2 = `vercel.ai.error.${name}`;
45
+ var symbol2 = Symbol.for(marker2);
46
+ var _a2;
47
+ var APICallError = class extends AISDKError {
48
+ constructor({
49
+ message,
50
+ url,
51
+ requestBodyValues,
52
+ statusCode,
53
+ responseHeaders,
54
+ responseBody,
55
+ cause,
56
+ isRetryable = statusCode != null && (statusCode === 408 || // request timeout
57
+ statusCode === 409 || // conflict
58
+ statusCode === 429 || // too many requests
59
+ statusCode >= 500),
60
+ // server error
61
+ data
62
+ }) {
63
+ super({ name, message, cause });
64
+ this[_a2] = true;
65
+ this.url = url;
66
+ this.requestBodyValues = requestBodyValues;
67
+ this.statusCode = statusCode;
68
+ this.responseHeaders = responseHeaders;
69
+ this.responseBody = responseBody;
70
+ this.isRetryable = isRetryable;
71
+ this.data = data;
72
+ }
73
+ static isInstance(error) {
74
+ return AISDKError.hasMarker(error, marker2);
75
+ }
76
+ };
77
+ _a2 = symbol2;
78
+ var name2 = "AI_EmptyResponseBodyError";
79
+ var marker3 = `vercel.ai.error.${name2}`;
80
+ var symbol3 = Symbol.for(marker3);
81
+ var _a3;
82
+ var EmptyResponseBodyError = class extends AISDKError {
83
+ // used in isInstance
84
+ constructor({ message = "Empty response body" } = {}) {
85
+ super({ name: name2, message });
86
+ this[_a3] = true;
87
+ }
88
+ static isInstance(error) {
89
+ return AISDKError.hasMarker(error, marker3);
90
+ }
91
+ };
92
+ _a3 = symbol3;
93
+ function getErrorMessage(error) {
94
+ if (error == null) {
95
+ return "unknown error";
96
+ }
97
+ if (typeof error === "string") {
98
+ return error;
99
+ }
100
+ if (error instanceof Error) {
101
+ return error.message;
102
+ }
103
+ return JSON.stringify(error);
104
+ }
105
+ var name3 = "AI_InvalidArgumentError";
106
+ var marker4 = `vercel.ai.error.${name3}`;
107
+ var symbol4 = Symbol.for(marker4);
108
+ var _a4;
109
+ var InvalidArgumentError = class extends AISDKError {
110
+ constructor({
111
+ message,
112
+ cause,
113
+ argument
114
+ }) {
115
+ super({ name: name3, message, cause });
116
+ this[_a4] = true;
117
+ this.argument = argument;
118
+ }
119
+ static isInstance(error) {
120
+ return AISDKError.hasMarker(error, marker4);
121
+ }
122
+ };
123
+ _a4 = symbol4;
124
+ var name4 = "AI_InvalidPromptError";
125
+ var marker5 = `vercel.ai.error.${name4}`;
126
+ var symbol5 = Symbol.for(marker5);
127
+ var _a5;
128
+ var InvalidPromptError = class extends AISDKError {
129
+ constructor({
130
+ prompt,
131
+ message,
132
+ cause
133
+ }) {
134
+ super({ name: name4, message: `Invalid prompt: ${message}`, cause });
135
+ this[_a5] = true;
136
+ this.prompt = prompt;
137
+ }
138
+ static isInstance(error) {
139
+ return AISDKError.hasMarker(error, marker5);
140
+ }
141
+ };
142
+ _a5 = symbol5;
143
+ var name5 = "AI_InvalidResponseDataError";
144
+ var marker6 = `vercel.ai.error.${name5}`;
145
+ var symbol6 = Symbol.for(marker6);
146
+ var _a6;
147
+ var InvalidResponseDataError = class extends AISDKError {
148
+ constructor({
149
+ data,
150
+ message = `Invalid response data: ${JSON.stringify(data)}.`
151
+ }) {
152
+ super({ name: name5, message });
153
+ this[_a6] = true;
154
+ this.data = data;
155
+ }
156
+ static isInstance(error) {
157
+ return AISDKError.hasMarker(error, marker6);
158
+ }
159
+ };
160
+ _a6 = symbol6;
161
+ var name6 = "AI_JSONParseError";
162
+ var marker7 = `vercel.ai.error.${name6}`;
163
+ var symbol7 = Symbol.for(marker7);
164
+ var _a7;
165
+ var JSONParseError = class extends AISDKError {
166
+ constructor({ text, cause }) {
167
+ super({
168
+ name: name6,
169
+ message: `JSON parsing failed: Text: ${text}.
170
+ Error message: ${getErrorMessage(cause)}`,
171
+ cause
172
+ });
173
+ this[_a7] = true;
174
+ this.text = text;
175
+ }
176
+ static isInstance(error) {
177
+ return AISDKError.hasMarker(error, marker7);
178
+ }
179
+ };
180
+ _a7 = symbol7;
181
+ var name7 = "AI_LoadAPIKeyError";
182
+ var marker8 = `vercel.ai.error.${name7}`;
183
+ var symbol8 = Symbol.for(marker8);
184
+ var _a8;
185
+ var LoadAPIKeyError = class extends AISDKError {
186
+ // used in isInstance
187
+ constructor({ message }) {
188
+ super({ name: name7, message });
189
+ this[_a8] = true;
190
+ }
191
+ static isInstance(error) {
192
+ return AISDKError.hasMarker(error, marker8);
193
+ }
194
+ };
195
+ _a8 = symbol8;
196
+ var name10 = "AI_NoSuchModelError";
197
+ var marker11 = `vercel.ai.error.${name10}`;
198
+ var symbol11 = Symbol.for(marker11);
199
+ var _a11;
200
+ var NoSuchModelError = class extends AISDKError {
201
+ constructor({
202
+ errorName = name10,
203
+ modelId,
204
+ modelType,
205
+ message = `No such ${modelType}: ${modelId}`
206
+ }) {
207
+ super({ name: errorName, message });
208
+ this[_a11] = true;
209
+ this.modelId = modelId;
210
+ this.modelType = modelType;
211
+ }
212
+ static isInstance(error) {
213
+ return AISDKError.hasMarker(error, marker11);
214
+ }
215
+ };
216
+ _a11 = symbol11;
217
+ var name11 = "AI_TooManyEmbeddingValuesForCallError";
218
+ var marker12 = `vercel.ai.error.${name11}`;
219
+ var symbol12 = Symbol.for(marker12);
220
+ var _a12;
221
+ var TooManyEmbeddingValuesForCallError = class extends AISDKError {
222
+ constructor(options) {
223
+ super({
224
+ name: name11,
225
+ message: `Too many values for a single embedding call. The ${options.provider} model "${options.modelId}" can only embed up to ${options.maxEmbeddingsPerCall} values per call, but ${options.values.length} values were provided.`
226
+ });
227
+ this[_a12] = true;
228
+ this.provider = options.provider;
229
+ this.modelId = options.modelId;
230
+ this.maxEmbeddingsPerCall = options.maxEmbeddingsPerCall;
231
+ this.values = options.values;
232
+ }
233
+ static isInstance(error) {
234
+ return AISDKError.hasMarker(error, marker12);
235
+ }
236
+ };
237
+ _a12 = symbol12;
238
+ var name12 = "AI_TypeValidationError";
239
+ var marker13 = `vercel.ai.error.${name12}`;
240
+ var symbol13 = Symbol.for(marker13);
241
+ var _a13;
242
+ var _TypeValidationError = class _TypeValidationError2 extends AISDKError {
243
+ constructor({ value, cause }) {
244
+ super({
245
+ name: name12,
246
+ message: `Type validation failed: Value: ${JSON.stringify(value)}.
247
+ Error message: ${getErrorMessage(cause)}`,
248
+ cause
249
+ });
250
+ this[_a13] = true;
251
+ this.value = value;
252
+ }
253
+ static isInstance(error) {
254
+ return AISDKError.hasMarker(error, marker13);
255
+ }
256
+ /**
257
+ * Wraps an error into a TypeValidationError.
258
+ * If the cause is already a TypeValidationError with the same value, it returns the cause.
259
+ * Otherwise, it creates a new TypeValidationError.
260
+ *
261
+ * @param {Object} params - The parameters for wrapping the error.
262
+ * @param {unknown} params.value - The value that failed validation.
263
+ * @param {unknown} params.cause - The original error or cause of the validation failure.
264
+ * @returns {TypeValidationError} A TypeValidationError instance.
265
+ */
266
+ static wrap({
267
+ value,
268
+ cause
269
+ }) {
270
+ return _TypeValidationError2.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError2({ value, cause });
271
+ }
272
+ };
273
+ _a13 = symbol13;
274
+ var TypeValidationError = _TypeValidationError;
275
+ var name13 = "AI_UnsupportedFunctionalityError";
276
+ var marker14 = `vercel.ai.error.${name13}`;
277
+ var symbol14 = Symbol.for(marker14);
278
+ var _a14;
279
+ var UnsupportedFunctionalityError = class extends AISDKError {
280
+ constructor({
281
+ functionality,
282
+ message = `'${functionality}' functionality not supported.`
283
+ }) {
284
+ super({ name: name13, message });
285
+ this[_a14] = true;
286
+ this.functionality = functionality;
287
+ }
288
+ static isInstance(error) {
289
+ return AISDKError.hasMarker(error, marker14);
290
+ }
291
+ };
292
+ _a14 = symbol14;
293
+
294
+ // ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/index.js
295
+ var ParseError = class extends Error {
296
+ constructor(message, options) {
297
+ super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
298
+ }
299
+ };
300
+ function noop(_arg) {
301
+ }
302
+ function createParser(callbacks) {
303
+ if (typeof callbacks == "function")
304
+ throw new TypeError(
305
+ "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
306
+ );
307
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
308
+ let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
309
+ function feed(newChunk) {
310
+ const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
311
+ for (const line of complete)
312
+ parseLine(line);
313
+ incompleteLine = incomplete, isFirstChunk = false;
314
+ }
315
+ function parseLine(line) {
316
+ if (line === "") {
317
+ dispatchEvent();
318
+ return;
319
+ }
320
+ if (line.startsWith(":")) {
321
+ onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
322
+ return;
323
+ }
324
+ const fieldSeparatorIndex = line.indexOf(":");
325
+ if (fieldSeparatorIndex !== -1) {
326
+ const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
327
+ processField(field, value, line);
328
+ return;
329
+ }
330
+ processField(line, "", line);
331
+ }
332
+ function processField(field, value, line) {
333
+ switch (field) {
334
+ case "event":
335
+ eventType = value;
336
+ break;
337
+ case "data":
338
+ data = `${data}${value}
339
+ `;
340
+ break;
341
+ case "id":
342
+ id = value.includes("\0") ? void 0 : value;
343
+ break;
344
+ case "retry":
345
+ /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
346
+ new ParseError(`Invalid \`retry\` value: "${value}"`, {
347
+ type: "invalid-retry",
348
+ value,
349
+ line
350
+ })
351
+ );
352
+ break;
353
+ default:
354
+ onError(
355
+ new ParseError(
356
+ `Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
357
+ { type: "unknown-field", field, value, line }
358
+ )
359
+ );
360
+ break;
361
+ }
362
+ }
363
+ function dispatchEvent() {
364
+ data.length > 0 && onEvent({
365
+ id,
366
+ event: eventType || void 0,
367
+ // If the data buffer's last character is a U+000A LINE FEED (LF) character,
368
+ // then remove the last character from the data buffer.
369
+ data: data.endsWith(`
370
+ `) ? data.slice(0, -1) : data
371
+ }), id = void 0, data = "", eventType = "";
372
+ }
373
+ function reset(options = {}) {
374
+ incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
375
+ }
376
+ return { feed, reset };
377
+ }
378
+ function splitLines(chunk) {
379
+ const lines = [];
380
+ let incompleteLine = "", searchIndex = 0;
381
+ for (; searchIndex < chunk.length; ) {
382
+ const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
383
+ `, searchIndex);
384
+ let lineEnd = -1;
385
+ if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
386
+ incompleteLine = chunk.slice(searchIndex);
387
+ break;
388
+ } else {
389
+ const line = chunk.slice(searchIndex, lineEnd);
390
+ lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
391
+ ` && searchIndex++;
392
+ }
393
+ }
394
+ return [lines, incompleteLine];
395
+ }
396
+
397
+ // ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/stream.js
398
+ var EventSourceParserStream = class extends TransformStream {
399
+ constructor({ onError, onRetry, onComment } = {}) {
400
+ let parser;
401
+ super({
402
+ start(controller) {
403
+ parser = createParser({
404
+ onEvent: (event) => {
405
+ controller.enqueue(event);
406
+ },
407
+ onError(error) {
408
+ onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
409
+ },
410
+ onRetry,
411
+ onComment
412
+ });
413
+ },
414
+ transform(chunk) {
415
+ parser.feed(chunk);
416
+ }
417
+ });
418
+ }
419
+ };
420
+
421
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
422
+ var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
423
+ var defaultOptions = {
424
+ name: void 0,
425
+ $refStrategy: "root",
426
+ basePath: ["#"],
427
+ effectStrategy: "input",
428
+ pipeStrategy: "all",
429
+ dateStrategy: "format:date-time",
430
+ mapStrategy: "entries",
431
+ removeAdditionalStrategy: "passthrough",
432
+ allowedAdditionalProperties: true,
433
+ rejectedAdditionalProperties: false,
434
+ definitionPath: "definitions",
435
+ target: "jsonSchema7",
436
+ strictUnions: false,
437
+ definitions: {},
438
+ errorMessages: false,
439
+ markdownDescription: false,
440
+ patternStrategy: "escape",
441
+ applyRegexFlags: false,
442
+ emailStrategy: "format:email",
443
+ base64Strategy: "contentEncoding:base64",
444
+ nameStrategy: "ref",
445
+ openAiAnyTypeName: "OpenAiAnyType"
446
+ };
447
+ var getDefaultOptions = (options) => typeof options === "string" ? {
448
+ ...defaultOptions,
449
+ name: options
450
+ } : {
451
+ ...defaultOptions,
452
+ ...options
453
+ };
454
+
455
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js
456
+ var getRefs = (options) => {
457
+ const _options = getDefaultOptions(options);
458
+ const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
459
+ return {
460
+ ..._options,
461
+ flags: { hasReferencedOpenAiAnyType: false },
462
+ currentPath,
463
+ propertyPath: void 0,
464
+ seen: new Map(Object.entries(_options.definitions).map(([name14, def]) => [
465
+ def._def,
466
+ {
467
+ def: def._def,
468
+ path: [..._options.basePath, _options.definitionPath, name14],
469
+ // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
470
+ jsonSchema: void 0
471
+ }
472
+ ]))
473
+ };
474
+ };
475
+
476
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
477
+ function addErrorMessage(res, key, errorMessage, refs) {
478
+ if (!refs?.errorMessages)
479
+ return;
480
+ if (errorMessage) {
481
+ res.errorMessage = {
482
+ ...res.errorMessage,
483
+ [key]: errorMessage
484
+ };
485
+ }
486
+ }
487
+ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
488
+ res[key] = value;
489
+ addErrorMessage(res, key, errorMessage, refs);
490
+ }
491
+
492
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
493
+ var getRelativePath = (pathA, pathB) => {
494
+ let i = 0;
495
+ for (; i < pathA.length && i < pathB.length; i++) {
496
+ if (pathA[i] !== pathB[i])
497
+ break;
498
+ }
499
+ return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
500
+ };
501
+
502
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
503
+ function parseAnyDef(refs) {
504
+ if (refs.target !== "openAi") {
505
+ return {};
506
+ }
507
+ const anyDefinitionPath = [
508
+ ...refs.basePath,
509
+ refs.definitionPath,
510
+ refs.openAiAnyTypeName
511
+ ];
512
+ refs.flags.hasReferencedOpenAiAnyType = true;
513
+ return {
514
+ $ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
515
+ };
516
+ }
517
+ function parseArrayDef(def, refs) {
518
+ const res = {
519
+ type: "array"
520
+ };
521
+ if (def.type?._def && def.type?._def?.typeName !== zod.ZodFirstPartyTypeKind.ZodAny) {
522
+ res.items = parseDef(def.type._def, {
523
+ ...refs,
524
+ currentPath: [...refs.currentPath, "items"]
525
+ });
526
+ }
527
+ if (def.minLength) {
528
+ setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
529
+ }
530
+ if (def.maxLength) {
531
+ setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
532
+ }
533
+ if (def.exactLength) {
534
+ setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
535
+ setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
536
+ }
537
+ return res;
538
+ }
539
+
540
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
541
+ function parseBigintDef(def, refs) {
542
+ const res = {
543
+ type: "integer",
544
+ format: "int64"
545
+ };
546
+ if (!def.checks)
547
+ return res;
548
+ for (const check of def.checks) {
549
+ switch (check.kind) {
550
+ case "min":
551
+ if (refs.target === "jsonSchema7") {
552
+ if (check.inclusive) {
553
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
554
+ } else {
555
+ setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
556
+ }
557
+ } else {
558
+ if (!check.inclusive) {
559
+ res.exclusiveMinimum = true;
560
+ }
561
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
562
+ }
563
+ break;
564
+ case "max":
565
+ if (refs.target === "jsonSchema7") {
566
+ if (check.inclusive) {
567
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
568
+ } else {
569
+ setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
570
+ }
571
+ } else {
572
+ if (!check.inclusive) {
573
+ res.exclusiveMaximum = true;
574
+ }
575
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
576
+ }
577
+ break;
578
+ case "multipleOf":
579
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
580
+ break;
581
+ }
582
+ }
583
+ return res;
584
+ }
585
+
586
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
587
+ function parseBooleanDef() {
588
+ return {
589
+ type: "boolean"
590
+ };
591
+ }
592
+
593
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
594
+ function parseBrandedDef(_def, refs) {
595
+ return parseDef(_def.type._def, refs);
596
+ }
597
+
598
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
599
+ var parseCatchDef = (def, refs) => {
600
+ return parseDef(def.innerType._def, refs);
601
+ };
602
+
603
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
604
+ function parseDateDef(def, refs, overrideDateStrategy) {
605
+ const strategy = overrideDateStrategy ?? refs.dateStrategy;
606
+ if (Array.isArray(strategy)) {
607
+ return {
608
+ anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
609
+ };
610
+ }
611
+ switch (strategy) {
612
+ case "string":
613
+ case "format:date-time":
614
+ return {
615
+ type: "string",
616
+ format: "date-time"
617
+ };
618
+ case "format:date":
619
+ return {
620
+ type: "string",
621
+ format: "date"
622
+ };
623
+ case "integer":
624
+ return integerDateParser(def, refs);
625
+ }
626
+ }
627
+ var integerDateParser = (def, refs) => {
628
+ const res = {
629
+ type: "integer",
630
+ format: "unix-time"
631
+ };
632
+ if (refs.target === "openApi3") {
633
+ return res;
634
+ }
635
+ for (const check of def.checks) {
636
+ switch (check.kind) {
637
+ case "min":
638
+ setResponseValueAndErrors(
639
+ res,
640
+ "minimum",
641
+ check.value,
642
+ // This is in milliseconds
643
+ check.message,
644
+ refs
645
+ );
646
+ break;
647
+ case "max":
648
+ setResponseValueAndErrors(
649
+ res,
650
+ "maximum",
651
+ check.value,
652
+ // This is in milliseconds
653
+ check.message,
654
+ refs
655
+ );
656
+ break;
657
+ }
658
+ }
659
+ return res;
660
+ };
661
+
662
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
663
+ function parseDefaultDef(_def, refs) {
664
+ return {
665
+ ...parseDef(_def.innerType._def, refs),
666
+ default: _def.defaultValue()
667
+ };
668
+ }
669
+
670
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
671
+ function parseEffectsDef(_def, refs) {
672
+ return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
673
+ }
674
+
675
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
676
+ function parseEnumDef(def) {
677
+ return {
678
+ type: "string",
679
+ enum: Array.from(def.values)
680
+ };
681
+ }
682
+
683
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
684
+ var isJsonSchema7AllOfType = (type) => {
685
+ if ("type" in type && type.type === "string")
686
+ return false;
687
+ return "allOf" in type;
688
+ };
689
+ function parseIntersectionDef(def, refs) {
690
+ const allOf = [
691
+ parseDef(def.left._def, {
692
+ ...refs,
693
+ currentPath: [...refs.currentPath, "allOf", "0"]
694
+ }),
695
+ parseDef(def.right._def, {
696
+ ...refs,
697
+ currentPath: [...refs.currentPath, "allOf", "1"]
698
+ })
699
+ ].filter((x) => !!x);
700
+ let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
701
+ const mergedAllOf = [];
702
+ allOf.forEach((schema) => {
703
+ if (isJsonSchema7AllOfType(schema)) {
704
+ mergedAllOf.push(...schema.allOf);
705
+ if (schema.unevaluatedProperties === void 0) {
706
+ unevaluatedProperties = void 0;
707
+ }
708
+ } else {
709
+ let nestedSchema = schema;
710
+ if ("additionalProperties" in schema && schema.additionalProperties === false) {
711
+ const { additionalProperties, ...rest } = schema;
712
+ nestedSchema = rest;
713
+ } else {
714
+ unevaluatedProperties = void 0;
715
+ }
716
+ mergedAllOf.push(nestedSchema);
717
+ }
718
+ });
719
+ return mergedAllOf.length ? {
720
+ allOf: mergedAllOf,
721
+ ...unevaluatedProperties
722
+ } : void 0;
723
+ }
724
+
725
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
726
+ function parseLiteralDef(def, refs) {
727
+ const parsedType = typeof def.value;
728
+ if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
729
+ return {
730
+ type: Array.isArray(def.value) ? "array" : "object"
731
+ };
732
+ }
733
+ if (refs.target === "openApi3") {
734
+ return {
735
+ type: parsedType === "bigint" ? "integer" : parsedType,
736
+ enum: [def.value]
737
+ };
738
+ }
739
+ return {
740
+ type: parsedType === "bigint" ? "integer" : parsedType,
741
+ const: def.value
742
+ };
743
+ }
744
+
745
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
746
+ var emojiRegex = void 0;
747
+ var zodPatterns = {
748
+ /**
749
+ * `c` was changed to `[cC]` to replicate /i flag
750
+ */
751
+ cuid: /^[cC][^\s-]{8,}$/,
752
+ cuid2: /^[0-9a-z]+$/,
753
+ ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
754
+ /**
755
+ * `a-z` was added to replicate /i flag
756
+ */
757
+ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
758
+ /**
759
+ * Constructed a valid Unicode RegExp
760
+ *
761
+ * Lazily instantiate since this type of regex isn't supported
762
+ * in all envs (e.g. React Native).
763
+ *
764
+ * See:
765
+ * https://github.com/colinhacks/zod/issues/2433
766
+ * Fix in Zod:
767
+ * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
768
+ */
769
+ emoji: () => {
770
+ if (emojiRegex === void 0) {
771
+ emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
772
+ }
773
+ return emojiRegex;
774
+ },
775
+ /**
776
+ * Unused
777
+ */
778
+ uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
779
+ /**
780
+ * Unused
781
+ */
782
+ ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
783
+ ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
784
+ /**
785
+ * Unused
786
+ */
787
+ ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
788
+ ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
789
+ base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
790
+ base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
791
+ nanoid: /^[a-zA-Z0-9_-]{21}$/,
792
+ jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
793
+ };
794
+ function parseStringDef(def, refs) {
795
+ const res = {
796
+ type: "string"
797
+ };
798
+ if (def.checks) {
799
+ for (const check of def.checks) {
800
+ switch (check.kind) {
801
+ case "min":
802
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
803
+ break;
804
+ case "max":
805
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
806
+ break;
807
+ case "email":
808
+ switch (refs.emailStrategy) {
809
+ case "format:email":
810
+ addFormat(res, "email", check.message, refs);
811
+ break;
812
+ case "format:idn-email":
813
+ addFormat(res, "idn-email", check.message, refs);
814
+ break;
815
+ case "pattern:zod":
816
+ addPattern(res, zodPatterns.email, check.message, refs);
817
+ break;
818
+ }
819
+ break;
820
+ case "url":
821
+ addFormat(res, "uri", check.message, refs);
822
+ break;
823
+ case "uuid":
824
+ addFormat(res, "uuid", check.message, refs);
825
+ break;
826
+ case "regex":
827
+ addPattern(res, check.regex, check.message, refs);
828
+ break;
829
+ case "cuid":
830
+ addPattern(res, zodPatterns.cuid, check.message, refs);
831
+ break;
832
+ case "cuid2":
833
+ addPattern(res, zodPatterns.cuid2, check.message, refs);
834
+ break;
835
+ case "startsWith":
836
+ addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
837
+ break;
838
+ case "endsWith":
839
+ addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
840
+ break;
841
+ case "datetime":
842
+ addFormat(res, "date-time", check.message, refs);
843
+ break;
844
+ case "date":
845
+ addFormat(res, "date", check.message, refs);
846
+ break;
847
+ case "time":
848
+ addFormat(res, "time", check.message, refs);
849
+ break;
850
+ case "duration":
851
+ addFormat(res, "duration", check.message, refs);
852
+ break;
853
+ case "length":
854
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
855
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
856
+ break;
857
+ case "includes": {
858
+ addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
859
+ break;
860
+ }
861
+ case "ip": {
862
+ if (check.version !== "v6") {
863
+ addFormat(res, "ipv4", check.message, refs);
864
+ }
865
+ if (check.version !== "v4") {
866
+ addFormat(res, "ipv6", check.message, refs);
867
+ }
868
+ break;
869
+ }
870
+ case "base64url":
871
+ addPattern(res, zodPatterns.base64url, check.message, refs);
872
+ break;
873
+ case "jwt":
874
+ addPattern(res, zodPatterns.jwt, check.message, refs);
875
+ break;
876
+ case "cidr": {
877
+ if (check.version !== "v6") {
878
+ addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
879
+ }
880
+ if (check.version !== "v4") {
881
+ addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
882
+ }
883
+ break;
884
+ }
885
+ case "emoji":
886
+ addPattern(res, zodPatterns.emoji(), check.message, refs);
887
+ break;
888
+ case "ulid": {
889
+ addPattern(res, zodPatterns.ulid, check.message, refs);
890
+ break;
891
+ }
892
+ case "base64": {
893
+ switch (refs.base64Strategy) {
894
+ case "format:binary": {
895
+ addFormat(res, "binary", check.message, refs);
896
+ break;
897
+ }
898
+ case "contentEncoding:base64": {
899
+ setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
900
+ break;
901
+ }
902
+ case "pattern:zod": {
903
+ addPattern(res, zodPatterns.base64, check.message, refs);
904
+ break;
905
+ }
906
+ }
907
+ break;
908
+ }
909
+ case "nanoid": {
910
+ addPattern(res, zodPatterns.nanoid, check.message, refs);
911
+ }
912
+ }
913
+ }
914
+ }
915
+ return res;
916
+ }
917
+ function escapeLiteralCheckValue(literal, refs) {
918
+ return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
919
+ }
920
+ var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
921
+ function escapeNonAlphaNumeric(source) {
922
+ let result = "";
923
+ for (let i = 0; i < source.length; i++) {
924
+ if (!ALPHA_NUMERIC.has(source[i])) {
925
+ result += "\\";
926
+ }
927
+ result += source[i];
928
+ }
929
+ return result;
930
+ }
931
+ function addFormat(schema, value, message, refs) {
932
+ if (schema.format || schema.anyOf?.some((x) => x.format)) {
933
+ if (!schema.anyOf) {
934
+ schema.anyOf = [];
935
+ }
936
+ if (schema.format) {
937
+ schema.anyOf.push({
938
+ format: schema.format,
939
+ ...schema.errorMessage && refs.errorMessages && {
940
+ errorMessage: { format: schema.errorMessage.format }
941
+ }
942
+ });
943
+ delete schema.format;
944
+ if (schema.errorMessage) {
945
+ delete schema.errorMessage.format;
946
+ if (Object.keys(schema.errorMessage).length === 0) {
947
+ delete schema.errorMessage;
948
+ }
949
+ }
950
+ }
951
+ schema.anyOf.push({
952
+ format: value,
953
+ ...message && refs.errorMessages && { errorMessage: { format: message } }
954
+ });
955
+ } else {
956
+ setResponseValueAndErrors(schema, "format", value, message, refs);
957
+ }
958
+ }
959
+ function addPattern(schema, regex, message, refs) {
960
+ if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
961
+ if (!schema.allOf) {
962
+ schema.allOf = [];
963
+ }
964
+ if (schema.pattern) {
965
+ schema.allOf.push({
966
+ pattern: schema.pattern,
967
+ ...schema.errorMessage && refs.errorMessages && {
968
+ errorMessage: { pattern: schema.errorMessage.pattern }
969
+ }
970
+ });
971
+ delete schema.pattern;
972
+ if (schema.errorMessage) {
973
+ delete schema.errorMessage.pattern;
974
+ if (Object.keys(schema.errorMessage).length === 0) {
975
+ delete schema.errorMessage;
976
+ }
977
+ }
978
+ }
979
+ schema.allOf.push({
980
+ pattern: stringifyRegExpWithFlags(regex, refs),
981
+ ...message && refs.errorMessages && { errorMessage: { pattern: message } }
982
+ });
983
+ } else {
984
+ setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
985
+ }
986
+ }
987
+ function stringifyRegExpWithFlags(regex, refs) {
988
+ if (!refs.applyRegexFlags || !regex.flags) {
989
+ return regex.source;
990
+ }
991
+ const flags = {
992
+ i: regex.flags.includes("i"),
993
+ m: regex.flags.includes("m"),
994
+ s: regex.flags.includes("s")
995
+ // `.` matches newlines
996
+ };
997
+ const source = flags.i ? regex.source.toLowerCase() : regex.source;
998
+ let pattern = "";
999
+ let isEscaped = false;
1000
+ let inCharGroup = false;
1001
+ let inCharRange = false;
1002
+ for (let i = 0; i < source.length; i++) {
1003
+ if (isEscaped) {
1004
+ pattern += source[i];
1005
+ isEscaped = false;
1006
+ continue;
1007
+ }
1008
+ if (flags.i) {
1009
+ if (inCharGroup) {
1010
+ if (source[i].match(/[a-z]/)) {
1011
+ if (inCharRange) {
1012
+ pattern += source[i];
1013
+ pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
1014
+ inCharRange = false;
1015
+ } else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
1016
+ pattern += source[i];
1017
+ inCharRange = true;
1018
+ } else {
1019
+ pattern += `${source[i]}${source[i].toUpperCase()}`;
1020
+ }
1021
+ continue;
1022
+ }
1023
+ } else if (source[i].match(/[a-z]/)) {
1024
+ pattern += `[${source[i]}${source[i].toUpperCase()}]`;
1025
+ continue;
1026
+ }
1027
+ }
1028
+ if (flags.m) {
1029
+ if (source[i] === "^") {
1030
+ pattern += `(^|(?<=[\r
1031
+ ]))`;
1032
+ continue;
1033
+ } else if (source[i] === "$") {
1034
+ pattern += `($|(?=[\r
1035
+ ]))`;
1036
+ continue;
1037
+ }
1038
+ }
1039
+ if (flags.s && source[i] === ".") {
1040
+ pattern += inCharGroup ? `${source[i]}\r
1041
+ ` : `[${source[i]}\r
1042
+ ]`;
1043
+ continue;
1044
+ }
1045
+ pattern += source[i];
1046
+ if (source[i] === "\\") {
1047
+ isEscaped = true;
1048
+ } else if (inCharGroup && source[i] === "]") {
1049
+ inCharGroup = false;
1050
+ } else if (!inCharGroup && source[i] === "[") {
1051
+ inCharGroup = true;
1052
+ }
1053
+ }
1054
+ return pattern;
1055
+ }
1056
+
1057
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
1058
+ function parseRecordDef(def, refs) {
1059
+ if (refs.target === "openAi") {
1060
+ console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
1061
+ }
1062
+ if (refs.target === "openApi3" && def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodEnum) {
1063
+ return {
1064
+ type: "object",
1065
+ required: def.keyType._def.values,
1066
+ properties: def.keyType._def.values.reduce((acc, key) => ({
1067
+ ...acc,
1068
+ [key]: parseDef(def.valueType._def, {
1069
+ ...refs,
1070
+ currentPath: [...refs.currentPath, "properties", key]
1071
+ }) ?? parseAnyDef(refs)
1072
+ }), {}),
1073
+ additionalProperties: refs.rejectedAdditionalProperties
1074
+ };
1075
+ }
1076
+ const schema = {
1077
+ type: "object",
1078
+ additionalProperties: parseDef(def.valueType._def, {
1079
+ ...refs,
1080
+ currentPath: [...refs.currentPath, "additionalProperties"]
1081
+ }) ?? refs.allowedAdditionalProperties
1082
+ };
1083
+ if (refs.target === "openApi3") {
1084
+ return schema;
1085
+ }
1086
+ if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
1087
+ const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
1088
+ return {
1089
+ ...schema,
1090
+ propertyNames: keyType
1091
+ };
1092
+ } else if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodEnum) {
1093
+ return {
1094
+ ...schema,
1095
+ propertyNames: {
1096
+ enum: def.keyType._def.values
1097
+ }
1098
+ };
1099
+ } else if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === zod.ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
1100
+ const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);
1101
+ return {
1102
+ ...schema,
1103
+ propertyNames: keyType
1104
+ };
1105
+ }
1106
+ return schema;
1107
+ }
1108
+
1109
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
1110
+ function parseMapDef(def, refs) {
1111
+ if (refs.mapStrategy === "record") {
1112
+ return parseRecordDef(def, refs);
1113
+ }
1114
+ const keys = parseDef(def.keyType._def, {
1115
+ ...refs,
1116
+ currentPath: [...refs.currentPath, "items", "items", "0"]
1117
+ }) || parseAnyDef(refs);
1118
+ const values = parseDef(def.valueType._def, {
1119
+ ...refs,
1120
+ currentPath: [...refs.currentPath, "items", "items", "1"]
1121
+ }) || parseAnyDef(refs);
1122
+ return {
1123
+ type: "array",
1124
+ maxItems: 125,
1125
+ items: {
1126
+ type: "array",
1127
+ items: [keys, values],
1128
+ minItems: 2,
1129
+ maxItems: 2
1130
+ }
1131
+ };
1132
+ }
1133
+
1134
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
1135
+ function parseNativeEnumDef(def) {
1136
+ const object = def.values;
1137
+ const actualKeys = Object.keys(def.values).filter((key) => {
1138
+ return typeof object[object[key]] !== "number";
1139
+ });
1140
+ const actualValues = actualKeys.map((key) => object[key]);
1141
+ const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
1142
+ return {
1143
+ type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
1144
+ enum: actualValues
1145
+ };
1146
+ }
1147
+
1148
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
1149
+ function parseNeverDef(refs) {
1150
+ return refs.target === "openAi" ? void 0 : {
1151
+ not: parseAnyDef({
1152
+ ...refs,
1153
+ currentPath: [...refs.currentPath, "not"]
1154
+ })
1155
+ };
1156
+ }
1157
+
1158
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
1159
+ function parseNullDef(refs) {
1160
+ return refs.target === "openApi3" ? {
1161
+ enum: ["null"],
1162
+ nullable: true
1163
+ } : {
1164
+ type: "null"
1165
+ };
1166
+ }
1167
+
1168
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
1169
+ var primitiveMappings = {
1170
+ ZodString: "string",
1171
+ ZodNumber: "number",
1172
+ ZodBigInt: "integer",
1173
+ ZodBoolean: "boolean",
1174
+ ZodNull: "null"
1175
+ };
1176
+ function parseUnionDef(def, refs) {
1177
+ if (refs.target === "openApi3")
1178
+ return asAnyOf(def, refs);
1179
+ const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
1180
+ if (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
1181
+ const types = options.reduce((types2, x) => {
1182
+ const type = primitiveMappings[x._def.typeName];
1183
+ return type && !types2.includes(type) ? [...types2, type] : types2;
1184
+ }, []);
1185
+ return {
1186
+ type: types.length > 1 ? types : types[0]
1187
+ };
1188
+ } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
1189
+ const types = options.reduce((acc, x) => {
1190
+ const type = typeof x._def.value;
1191
+ switch (type) {
1192
+ case "string":
1193
+ case "number":
1194
+ case "boolean":
1195
+ return [...acc, type];
1196
+ case "bigint":
1197
+ return [...acc, "integer"];
1198
+ case "object":
1199
+ if (x._def.value === null)
1200
+ return [...acc, "null"];
1201
+ case "symbol":
1202
+ case "undefined":
1203
+ case "function":
1204
+ default:
1205
+ return acc;
1206
+ }
1207
+ }, []);
1208
+ if (types.length === options.length) {
1209
+ const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
1210
+ return {
1211
+ type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
1212
+ enum: options.reduce((acc, x) => {
1213
+ return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
1214
+ }, [])
1215
+ };
1216
+ }
1217
+ } else if (options.every((x) => x._def.typeName === "ZodEnum")) {
1218
+ return {
1219
+ type: "string",
1220
+ enum: options.reduce((acc, x) => [
1221
+ ...acc,
1222
+ ...x._def.values.filter((x2) => !acc.includes(x2))
1223
+ ], [])
1224
+ };
1225
+ }
1226
+ return asAnyOf(def, refs);
1227
+ }
1228
+ var asAnyOf = (def, refs) => {
1229
+ const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
1230
+ ...refs,
1231
+ currentPath: [...refs.currentPath, "anyOf", `${i}`]
1232
+ })).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
1233
+ return anyOf.length ? { anyOf } : void 0;
1234
+ };
1235
+
1236
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
1237
+ function parseNullableDef(def, refs) {
1238
+ if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
1239
+ if (refs.target === "openApi3") {
1240
+ return {
1241
+ type: primitiveMappings[def.innerType._def.typeName],
1242
+ nullable: true
1243
+ };
1244
+ }
1245
+ return {
1246
+ type: [
1247
+ primitiveMappings[def.innerType._def.typeName],
1248
+ "null"
1249
+ ]
1250
+ };
1251
+ }
1252
+ if (refs.target === "openApi3") {
1253
+ const base2 = parseDef(def.innerType._def, {
1254
+ ...refs,
1255
+ currentPath: [...refs.currentPath]
1256
+ });
1257
+ if (base2 && "$ref" in base2)
1258
+ return { allOf: [base2], nullable: true };
1259
+ return base2 && { ...base2, nullable: true };
1260
+ }
1261
+ const base = parseDef(def.innerType._def, {
1262
+ ...refs,
1263
+ currentPath: [...refs.currentPath, "anyOf", "0"]
1264
+ });
1265
+ return base && { anyOf: [base, { type: "null" }] };
1266
+ }
1267
+
1268
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
1269
+ function parseNumberDef(def, refs) {
1270
+ const res = {
1271
+ type: "number"
1272
+ };
1273
+ if (!def.checks)
1274
+ return res;
1275
+ for (const check of def.checks) {
1276
+ switch (check.kind) {
1277
+ case "int":
1278
+ res.type = "integer";
1279
+ addErrorMessage(res, "type", check.message, refs);
1280
+ break;
1281
+ case "min":
1282
+ if (refs.target === "jsonSchema7") {
1283
+ if (check.inclusive) {
1284
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
1285
+ } else {
1286
+ setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
1287
+ }
1288
+ } else {
1289
+ if (!check.inclusive) {
1290
+ res.exclusiveMinimum = true;
1291
+ }
1292
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
1293
+ }
1294
+ break;
1295
+ case "max":
1296
+ if (refs.target === "jsonSchema7") {
1297
+ if (check.inclusive) {
1298
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
1299
+ } else {
1300
+ setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
1301
+ }
1302
+ } else {
1303
+ if (!check.inclusive) {
1304
+ res.exclusiveMaximum = true;
1305
+ }
1306
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
1307
+ }
1308
+ break;
1309
+ case "multipleOf":
1310
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
1311
+ break;
1312
+ }
1313
+ }
1314
+ return res;
1315
+ }
1316
+
1317
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
1318
+ function parseObjectDef(def, refs) {
1319
+ const forceOptionalIntoNullable = refs.target === "openAi";
1320
+ const result = {
1321
+ type: "object",
1322
+ properties: {}
1323
+ };
1324
+ const required = [];
1325
+ const shape = def.shape();
1326
+ for (const propName in shape) {
1327
+ let propDef = shape[propName];
1328
+ if (propDef === void 0 || propDef._def === void 0) {
1329
+ continue;
1330
+ }
1331
+ let propOptional = safeIsOptional(propDef);
1332
+ if (propOptional && forceOptionalIntoNullable) {
1333
+ if (propDef._def.typeName === "ZodOptional") {
1334
+ propDef = propDef._def.innerType;
1335
+ }
1336
+ if (!propDef.isNullable()) {
1337
+ propDef = propDef.nullable();
1338
+ }
1339
+ propOptional = false;
1340
+ }
1341
+ const parsedDef = parseDef(propDef._def, {
1342
+ ...refs,
1343
+ currentPath: [...refs.currentPath, "properties", propName],
1344
+ propertyPath: [...refs.currentPath, "properties", propName]
1345
+ });
1346
+ if (parsedDef === void 0) {
1347
+ continue;
1348
+ }
1349
+ result.properties[propName] = parsedDef;
1350
+ if (!propOptional) {
1351
+ required.push(propName);
1352
+ }
1353
+ }
1354
+ if (required.length) {
1355
+ result.required = required;
1356
+ }
1357
+ const additionalProperties = decideAdditionalProperties(def, refs);
1358
+ if (additionalProperties !== void 0) {
1359
+ result.additionalProperties = additionalProperties;
1360
+ }
1361
+ return result;
1362
+ }
1363
+ function decideAdditionalProperties(def, refs) {
1364
+ if (def.catchall._def.typeName !== "ZodNever") {
1365
+ return parseDef(def.catchall._def, {
1366
+ ...refs,
1367
+ currentPath: [...refs.currentPath, "additionalProperties"]
1368
+ });
1369
+ }
1370
+ switch (def.unknownKeys) {
1371
+ case "passthrough":
1372
+ return refs.allowedAdditionalProperties;
1373
+ case "strict":
1374
+ return refs.rejectedAdditionalProperties;
1375
+ case "strip":
1376
+ return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
1377
+ }
1378
+ }
1379
+ function safeIsOptional(schema) {
1380
+ try {
1381
+ return schema.isOptional();
1382
+ } catch {
1383
+ return true;
1384
+ }
1385
+ }
1386
+
1387
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
1388
+ var parseOptionalDef = (def, refs) => {
1389
+ if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
1390
+ return parseDef(def.innerType._def, refs);
1391
+ }
1392
+ const innerSchema = parseDef(def.innerType._def, {
1393
+ ...refs,
1394
+ currentPath: [...refs.currentPath, "anyOf", "1"]
1395
+ });
1396
+ return innerSchema ? {
1397
+ anyOf: [
1398
+ {
1399
+ not: parseAnyDef(refs)
1400
+ },
1401
+ innerSchema
1402
+ ]
1403
+ } : parseAnyDef(refs);
1404
+ };
1405
+
1406
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
1407
+ var parsePipelineDef = (def, refs) => {
1408
+ if (refs.pipeStrategy === "input") {
1409
+ return parseDef(def.in._def, refs);
1410
+ } else if (refs.pipeStrategy === "output") {
1411
+ return parseDef(def.out._def, refs);
1412
+ }
1413
+ const a = parseDef(def.in._def, {
1414
+ ...refs,
1415
+ currentPath: [...refs.currentPath, "allOf", "0"]
1416
+ });
1417
+ const b = parseDef(def.out._def, {
1418
+ ...refs,
1419
+ currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
1420
+ });
1421
+ return {
1422
+ allOf: [a, b].filter((x) => x !== void 0)
1423
+ };
1424
+ };
1425
+
1426
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
1427
+ function parsePromiseDef(def, refs) {
1428
+ return parseDef(def.type._def, refs);
1429
+ }
1430
+
1431
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
1432
+ function parseSetDef(def, refs) {
1433
+ const items = parseDef(def.valueType._def, {
1434
+ ...refs,
1435
+ currentPath: [...refs.currentPath, "items"]
1436
+ });
1437
+ const schema = {
1438
+ type: "array",
1439
+ uniqueItems: true,
1440
+ items
1441
+ };
1442
+ if (def.minSize) {
1443
+ setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
1444
+ }
1445
+ if (def.maxSize) {
1446
+ setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
1447
+ }
1448
+ return schema;
1449
+ }
1450
+
1451
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
1452
+ function parseTupleDef(def, refs) {
1453
+ if (def.rest) {
1454
+ return {
1455
+ type: "array",
1456
+ minItems: def.items.length,
1457
+ items: def.items.map((x, i) => parseDef(x._def, {
1458
+ ...refs,
1459
+ currentPath: [...refs.currentPath, "items", `${i}`]
1460
+ })).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
1461
+ additionalItems: parseDef(def.rest._def, {
1462
+ ...refs,
1463
+ currentPath: [...refs.currentPath, "additionalItems"]
1464
+ })
1465
+ };
1466
+ } else {
1467
+ return {
1468
+ type: "array",
1469
+ minItems: def.items.length,
1470
+ maxItems: def.items.length,
1471
+ items: def.items.map((x, i) => parseDef(x._def, {
1472
+ ...refs,
1473
+ currentPath: [...refs.currentPath, "items", `${i}`]
1474
+ })).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
1475
+ };
1476
+ }
1477
+ }
1478
+
1479
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
1480
+ function parseUndefinedDef(refs) {
1481
+ return {
1482
+ not: parseAnyDef(refs)
1483
+ };
1484
+ }
1485
+
1486
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
1487
+ function parseUnknownDef(refs) {
1488
+ return parseAnyDef(refs);
1489
+ }
1490
+
1491
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
1492
+ var parseReadonlyDef = (def, refs) => {
1493
+ return parseDef(def.innerType._def, refs);
1494
+ };
1495
+
1496
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js
1497
+ var selectParser = (def, typeName, refs) => {
1498
+ switch (typeName) {
1499
+ case zod.ZodFirstPartyTypeKind.ZodString:
1500
+ return parseStringDef(def, refs);
1501
+ case zod.ZodFirstPartyTypeKind.ZodNumber:
1502
+ return parseNumberDef(def, refs);
1503
+ case zod.ZodFirstPartyTypeKind.ZodObject:
1504
+ return parseObjectDef(def, refs);
1505
+ case zod.ZodFirstPartyTypeKind.ZodBigInt:
1506
+ return parseBigintDef(def, refs);
1507
+ case zod.ZodFirstPartyTypeKind.ZodBoolean:
1508
+ return parseBooleanDef();
1509
+ case zod.ZodFirstPartyTypeKind.ZodDate:
1510
+ return parseDateDef(def, refs);
1511
+ case zod.ZodFirstPartyTypeKind.ZodUndefined:
1512
+ return parseUndefinedDef(refs);
1513
+ case zod.ZodFirstPartyTypeKind.ZodNull:
1514
+ return parseNullDef(refs);
1515
+ case zod.ZodFirstPartyTypeKind.ZodArray:
1516
+ return parseArrayDef(def, refs);
1517
+ case zod.ZodFirstPartyTypeKind.ZodUnion:
1518
+ case zod.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
1519
+ return parseUnionDef(def, refs);
1520
+ case zod.ZodFirstPartyTypeKind.ZodIntersection:
1521
+ return parseIntersectionDef(def, refs);
1522
+ case zod.ZodFirstPartyTypeKind.ZodTuple:
1523
+ return parseTupleDef(def, refs);
1524
+ case zod.ZodFirstPartyTypeKind.ZodRecord:
1525
+ return parseRecordDef(def, refs);
1526
+ case zod.ZodFirstPartyTypeKind.ZodLiteral:
1527
+ return parseLiteralDef(def, refs);
1528
+ case zod.ZodFirstPartyTypeKind.ZodEnum:
1529
+ return parseEnumDef(def);
1530
+ case zod.ZodFirstPartyTypeKind.ZodNativeEnum:
1531
+ return parseNativeEnumDef(def);
1532
+ case zod.ZodFirstPartyTypeKind.ZodNullable:
1533
+ return parseNullableDef(def, refs);
1534
+ case zod.ZodFirstPartyTypeKind.ZodOptional:
1535
+ return parseOptionalDef(def, refs);
1536
+ case zod.ZodFirstPartyTypeKind.ZodMap:
1537
+ return parseMapDef(def, refs);
1538
+ case zod.ZodFirstPartyTypeKind.ZodSet:
1539
+ return parseSetDef(def, refs);
1540
+ case zod.ZodFirstPartyTypeKind.ZodLazy:
1541
+ return () => def.getter()._def;
1542
+ case zod.ZodFirstPartyTypeKind.ZodPromise:
1543
+ return parsePromiseDef(def, refs);
1544
+ case zod.ZodFirstPartyTypeKind.ZodNaN:
1545
+ case zod.ZodFirstPartyTypeKind.ZodNever:
1546
+ return parseNeverDef(refs);
1547
+ case zod.ZodFirstPartyTypeKind.ZodEffects:
1548
+ return parseEffectsDef(def, refs);
1549
+ case zod.ZodFirstPartyTypeKind.ZodAny:
1550
+ return parseAnyDef(refs);
1551
+ case zod.ZodFirstPartyTypeKind.ZodUnknown:
1552
+ return parseUnknownDef(refs);
1553
+ case zod.ZodFirstPartyTypeKind.ZodDefault:
1554
+ return parseDefaultDef(def, refs);
1555
+ case zod.ZodFirstPartyTypeKind.ZodBranded:
1556
+ return parseBrandedDef(def, refs);
1557
+ case zod.ZodFirstPartyTypeKind.ZodReadonly:
1558
+ return parseReadonlyDef(def, refs);
1559
+ case zod.ZodFirstPartyTypeKind.ZodCatch:
1560
+ return parseCatchDef(def, refs);
1561
+ case zod.ZodFirstPartyTypeKind.ZodPipeline:
1562
+ return parsePipelineDef(def, refs);
1563
+ case zod.ZodFirstPartyTypeKind.ZodFunction:
1564
+ case zod.ZodFirstPartyTypeKind.ZodVoid:
1565
+ case zod.ZodFirstPartyTypeKind.ZodSymbol:
1566
+ return void 0;
1567
+ default:
1568
+ return /* @__PURE__ */ ((_) => void 0)();
1569
+ }
1570
+ };
1571
+
1572
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js
1573
+ function parseDef(def, refs, forceResolution = false) {
1574
+ const seenItem = refs.seen.get(def);
1575
+ if (refs.override) {
1576
+ const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
1577
+ if (overrideResult !== ignoreOverride) {
1578
+ return overrideResult;
1579
+ }
1580
+ }
1581
+ if (seenItem && !forceResolution) {
1582
+ const seenSchema = get$ref(seenItem, refs);
1583
+ if (seenSchema !== void 0) {
1584
+ return seenSchema;
1585
+ }
1586
+ }
1587
+ const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
1588
+ refs.seen.set(def, newItem);
1589
+ const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
1590
+ const jsonSchema = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
1591
+ if (jsonSchema) {
1592
+ addMeta(def, refs, jsonSchema);
1593
+ }
1594
+ if (refs.postProcess) {
1595
+ const postProcessResult = refs.postProcess(jsonSchema, def, refs);
1596
+ newItem.jsonSchema = jsonSchema;
1597
+ return postProcessResult;
1598
+ }
1599
+ newItem.jsonSchema = jsonSchema;
1600
+ return jsonSchema;
1601
+ }
1602
+ var get$ref = (item, refs) => {
1603
+ switch (refs.$refStrategy) {
1604
+ case "root":
1605
+ return { $ref: item.path.join("/") };
1606
+ case "relative":
1607
+ return { $ref: getRelativePath(refs.currentPath, item.path) };
1608
+ case "none":
1609
+ case "seen": {
1610
+ if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
1611
+ console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
1612
+ return parseAnyDef(refs);
1613
+ }
1614
+ return refs.$refStrategy === "seen" ? parseAnyDef(refs) : void 0;
1615
+ }
1616
+ }
1617
+ };
1618
+ var addMeta = (def, refs, jsonSchema) => {
1619
+ if (def.description) {
1620
+ jsonSchema.description = def.description;
1621
+ if (refs.markdownDescription) {
1622
+ jsonSchema.markdownDescription = def.description;
1623
+ }
1624
+ }
1625
+ return jsonSchema;
1626
+ };
1627
+
1628
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
1629
+ var zodToJsonSchema = (schema, options) => {
1630
+ const refs = getRefs(options);
1631
+ let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name15, schema2]) => ({
1632
+ ...acc,
1633
+ [name15]: parseDef(schema2._def, {
1634
+ ...refs,
1635
+ currentPath: [...refs.basePath, refs.definitionPath, name15]
1636
+ }, true) ?? parseAnyDef(refs)
1637
+ }), {}) : void 0;
1638
+ const name14 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
1639
+ const main = parseDef(schema._def, name14 === void 0 ? refs : {
1640
+ ...refs,
1641
+ currentPath: [...refs.basePath, refs.definitionPath, name14]
1642
+ }, false) ?? parseAnyDef(refs);
1643
+ const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
1644
+ if (title !== void 0) {
1645
+ main.title = title;
1646
+ }
1647
+ if (refs.flags.hasReferencedOpenAiAnyType) {
1648
+ if (!definitions) {
1649
+ definitions = {};
1650
+ }
1651
+ if (!definitions[refs.openAiAnyTypeName]) {
1652
+ definitions[refs.openAiAnyTypeName] = {
1653
+ // Skipping "object" as no properties can be defined and additionalProperties must be "false"
1654
+ type: ["string", "number", "integer", "boolean", "array", "null"],
1655
+ items: {
1656
+ $ref: refs.$refStrategy === "relative" ? "1" : [
1657
+ ...refs.basePath,
1658
+ refs.definitionPath,
1659
+ refs.openAiAnyTypeName
1660
+ ].join("/")
1661
+ }
1662
+ };
1663
+ }
1664
+ }
1665
+ const combined = name14 === void 0 ? definitions ? {
1666
+ ...main,
1667
+ [refs.definitionPath]: definitions
1668
+ } : main : {
1669
+ $ref: [
1670
+ ...refs.$refStrategy === "relative" ? [] : refs.basePath,
1671
+ refs.definitionPath,
1672
+ name14
1673
+ ].join("/"),
1674
+ [refs.definitionPath]: {
1675
+ ...definitions,
1676
+ [name14]: main
1677
+ }
1678
+ };
1679
+ if (refs.target === "jsonSchema7") {
1680
+ combined.$schema = "http://json-schema.org/draft-07/schema#";
1681
+ } else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
1682
+ combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
1683
+ }
1684
+ if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) {
1685
+ console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
1686
+ }
1687
+ return combined;
1688
+ };
1689
+
1690
+ // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
1691
+ var esm_default = zodToJsonSchema;
1692
+
1693
+ // ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.3_zod@3.25.76/node_modules/@ai-sdk/provider-utils/dist/index.mjs
1694
+ function combineHeaders(...headers) {
1695
+ return headers.reduce(
1696
+ (combinedHeaders, currentHeaders) => ({
1697
+ ...combinedHeaders,
1698
+ ...currentHeaders != null ? currentHeaders : {}
1699
+ }),
1700
+ {}
1701
+ );
1702
+ }
1703
+ function extractResponseHeaders(response) {
1704
+ return Object.fromEntries([...response.headers]);
1705
+ }
1706
+ var createIdGenerator = ({
1707
+ prefix,
1708
+ size = 16,
1709
+ alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
1710
+ separator = "-"
1711
+ } = {}) => {
1712
+ const generator = () => {
1713
+ const alphabetLength = alphabet.length;
1714
+ const chars = new Array(size);
1715
+ for (let i = 0; i < size; i++) {
1716
+ chars[i] = alphabet[Math.random() * alphabetLength | 0];
1717
+ }
1718
+ return chars.join("");
1719
+ };
1720
+ if (prefix == null) {
1721
+ return generator;
1722
+ }
1723
+ if (alphabet.includes(separator)) {
1724
+ throw new InvalidArgumentError({
1725
+ argument: "separator",
1726
+ message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
1727
+ });
1728
+ }
1729
+ return () => `${prefix}${separator}${generator()}`;
1730
+ };
1731
+ var generateId = createIdGenerator();
1732
+ function isAbortError(error) {
1733
+ return (error instanceof Error || error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
1734
+ error.name === "TimeoutError");
1735
+ }
1736
+ var FETCH_FAILED_ERROR_MESSAGES = ["fetch failed", "failed to fetch"];
1737
+ function handleFetchError({
1738
+ error,
1739
+ url,
1740
+ requestBodyValues
1741
+ }) {
1742
+ if (isAbortError(error)) {
1743
+ return error;
1744
+ }
1745
+ if (error instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error.message.toLowerCase())) {
1746
+ const cause = error.cause;
1747
+ if (cause != null) {
1748
+ return new APICallError({
1749
+ message: `Cannot connect to API: ${cause.message}`,
1750
+ cause,
1751
+ url,
1752
+ requestBodyValues,
1753
+ isRetryable: true
1754
+ // retry when network error
1755
+ });
1756
+ }
1757
+ }
1758
+ return error;
1759
+ }
1760
+ function removeUndefinedEntries(record) {
1761
+ return Object.fromEntries(
1762
+ Object.entries(record).filter(([_key, value]) => value != null)
1763
+ );
1764
+ }
1765
+ function loadApiKey({
1766
+ apiKey,
1767
+ environmentVariableName,
1768
+ apiKeyParameterName = "apiKey",
1769
+ description
1770
+ }) {
1771
+ if (typeof apiKey === "string") {
1772
+ return apiKey;
1773
+ }
1774
+ if (apiKey != null) {
1775
+ throw new LoadAPIKeyError({
1776
+ message: `${description} API key must be a string.`
1777
+ });
1778
+ }
1779
+ if (typeof process === "undefined") {
1780
+ throw new LoadAPIKeyError({
1781
+ message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables is not supported in this environment.`
1782
+ });
1783
+ }
1784
+ apiKey = process.env[environmentVariableName];
1785
+ if (apiKey == null) {
1786
+ throw new LoadAPIKeyError({
1787
+ message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter or the ${environmentVariableName} environment variable.`
1788
+ });
1789
+ }
1790
+ if (typeof apiKey !== "string") {
1791
+ throw new LoadAPIKeyError({
1792
+ message: `${description} API key must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
1793
+ });
1794
+ }
1795
+ return apiKey;
1796
+ }
1797
+ var suspectProtoRx = /"__proto__"\s*:/;
1798
+ var suspectConstructorRx = /"constructor"\s*:/;
1799
+ function _parse(text) {
1800
+ const obj = JSON.parse(text);
1801
+ if (obj === null || typeof obj !== "object") {
1802
+ return obj;
1803
+ }
1804
+ if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {
1805
+ return obj;
1806
+ }
1807
+ return filter(obj);
1808
+ }
1809
+ function filter(obj) {
1810
+ let next = [obj];
1811
+ while (next.length) {
1812
+ const nodes = next;
1813
+ next = [];
1814
+ for (const node of nodes) {
1815
+ if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
1816
+ throw new SyntaxError("Object contains forbidden prototype property");
1817
+ }
1818
+ if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
1819
+ throw new SyntaxError("Object contains forbidden prototype property");
1820
+ }
1821
+ for (const key in node) {
1822
+ const value = node[key];
1823
+ if (value && typeof value === "object") {
1824
+ next.push(value);
1825
+ }
1826
+ }
1827
+ }
1828
+ }
1829
+ return obj;
1830
+ }
1831
+ function secureJsonParse(text) {
1832
+ const { stackTraceLimit } = Error;
1833
+ Error.stackTraceLimit = 0;
1834
+ try {
1835
+ return _parse(text);
1836
+ } finally {
1837
+ Error.stackTraceLimit = stackTraceLimit;
1838
+ }
1839
+ }
1840
+ var validatorSymbol = Symbol.for("vercel.ai.validator");
1841
+ function validator(validate) {
1842
+ return { [validatorSymbol]: true, validate };
1843
+ }
1844
+ function isValidator(value) {
1845
+ return typeof value === "object" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && "validate" in value;
1846
+ }
1847
+ function asValidator(value) {
1848
+ return isValidator(value) ? value : standardSchemaValidator(value);
1849
+ }
1850
+ function standardSchemaValidator(standardSchema) {
1851
+ return validator(async (value) => {
1852
+ const result = await standardSchema["~standard"].validate(value);
1853
+ return result.issues == null ? { success: true, value: result.value } : {
1854
+ success: false,
1855
+ error: new TypeValidationError({
1856
+ value,
1857
+ cause: result.issues
1858
+ })
1859
+ };
1860
+ });
1861
+ }
1862
+ async function validateTypes({
1863
+ value,
1864
+ schema
1865
+ }) {
1866
+ const result = await safeValidateTypes({ value, schema });
1867
+ if (!result.success) {
1868
+ throw TypeValidationError.wrap({ value, cause: result.error });
1869
+ }
1870
+ return result.value;
1871
+ }
1872
+ async function safeValidateTypes({
1873
+ value,
1874
+ schema
1875
+ }) {
1876
+ const validator2 = asValidator(schema);
1877
+ try {
1878
+ if (validator2.validate == null) {
1879
+ return { success: true, value, rawValue: value };
1880
+ }
1881
+ const result = await validator2.validate(value);
1882
+ if (result.success) {
1883
+ return { success: true, value: result.value, rawValue: value };
1884
+ }
1885
+ return {
1886
+ success: false,
1887
+ error: TypeValidationError.wrap({ value, cause: result.error }),
1888
+ rawValue: value
1889
+ };
1890
+ } catch (error) {
1891
+ return {
1892
+ success: false,
1893
+ error: TypeValidationError.wrap({ value, cause: error }),
1894
+ rawValue: value
1895
+ };
1896
+ }
1897
+ }
1898
+ async function parseJSON({
1899
+ text,
1900
+ schema
1901
+ }) {
1902
+ try {
1903
+ const value = secureJsonParse(text);
1904
+ if (schema == null) {
1905
+ return value;
1906
+ }
1907
+ return validateTypes({ value, schema });
1908
+ } catch (error) {
1909
+ if (JSONParseError.isInstance(error) || TypeValidationError.isInstance(error)) {
1910
+ throw error;
1911
+ }
1912
+ throw new JSONParseError({ text, cause: error });
1913
+ }
1914
+ }
1915
+ async function safeParseJSON({
1916
+ text,
1917
+ schema
1918
+ }) {
1919
+ try {
1920
+ const value = secureJsonParse(text);
1921
+ if (schema == null) {
1922
+ return { success: true, value, rawValue: value };
1923
+ }
1924
+ return await safeValidateTypes({ value, schema });
1925
+ } catch (error) {
1926
+ return {
1927
+ success: false,
1928
+ error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text, cause: error }),
1929
+ rawValue: void 0
1930
+ };
1931
+ }
1932
+ }
1933
+ function isParsableJson(input) {
1934
+ try {
1935
+ secureJsonParse(input);
1936
+ return true;
1937
+ } catch (e) {
1938
+ return false;
1939
+ }
1940
+ }
1941
+ function parseJsonEventStream({
1942
+ stream,
1943
+ schema
1944
+ }) {
1945
+ return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).pipeThrough(
1946
+ new TransformStream({
1947
+ async transform({ data }, controller) {
1948
+ if (data === "[DONE]") {
1949
+ return;
1950
+ }
1951
+ controller.enqueue(await safeParseJSON({ text: data, schema }));
1952
+ }
1953
+ })
1954
+ );
1955
+ }
1956
+ async function parseProviderOptions({
1957
+ provider,
1958
+ providerOptions,
1959
+ schema
1960
+ }) {
1961
+ if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
1962
+ return void 0;
1963
+ }
1964
+ const parsedProviderOptions = await safeValidateTypes({
1965
+ value: providerOptions[provider],
1966
+ schema
1967
+ });
1968
+ if (!parsedProviderOptions.success) {
1969
+ throw new InvalidArgumentError({
1970
+ argument: "providerOptions",
1971
+ message: `invalid ${provider} provider options`,
1972
+ cause: parsedProviderOptions.error
1973
+ });
1974
+ }
1975
+ return parsedProviderOptions.value;
1976
+ }
1977
+ var getOriginalFetch2 = () => globalThis.fetch;
1978
+ var postJsonToApi = async ({
1979
+ url,
1980
+ headers,
1981
+ body,
1982
+ failedResponseHandler,
1983
+ successfulResponseHandler,
1984
+ abortSignal,
1985
+ fetch
1986
+ }) => postToApi({
1987
+ url,
1988
+ headers: {
1989
+ "Content-Type": "application/json",
1990
+ ...headers
1991
+ },
1992
+ body: {
1993
+ content: JSON.stringify(body),
1994
+ values: body
1995
+ },
1996
+ failedResponseHandler,
1997
+ successfulResponseHandler,
1998
+ abortSignal,
1999
+ fetch
2000
+ });
2001
+ var postFormDataToApi = async ({
2002
+ url,
2003
+ headers,
2004
+ formData,
2005
+ failedResponseHandler,
2006
+ successfulResponseHandler,
2007
+ abortSignal,
2008
+ fetch
2009
+ }) => postToApi({
2010
+ url,
2011
+ headers,
2012
+ body: {
2013
+ content: formData,
2014
+ values: Object.fromEntries(formData.entries())
2015
+ },
2016
+ failedResponseHandler,
2017
+ successfulResponseHandler,
2018
+ abortSignal,
2019
+ fetch
2020
+ });
2021
+ var postToApi = async ({
2022
+ url,
2023
+ headers = {},
2024
+ body,
2025
+ successfulResponseHandler,
2026
+ failedResponseHandler,
2027
+ abortSignal,
2028
+ fetch = getOriginalFetch2()
2029
+ }) => {
2030
+ try {
2031
+ const response = await fetch(url, {
2032
+ method: "POST",
2033
+ headers: removeUndefinedEntries(headers),
2034
+ body: body.content,
2035
+ signal: abortSignal
2036
+ });
2037
+ const responseHeaders = extractResponseHeaders(response);
2038
+ if (!response.ok) {
2039
+ let errorInformation;
2040
+ try {
2041
+ errorInformation = await failedResponseHandler({
2042
+ response,
2043
+ url,
2044
+ requestBodyValues: body.values
2045
+ });
2046
+ } catch (error) {
2047
+ if (isAbortError(error) || APICallError.isInstance(error)) {
2048
+ throw error;
2049
+ }
2050
+ throw new APICallError({
2051
+ message: "Failed to process error response",
2052
+ cause: error,
2053
+ statusCode: response.status,
2054
+ url,
2055
+ responseHeaders,
2056
+ requestBodyValues: body.values
2057
+ });
2058
+ }
2059
+ throw errorInformation.value;
2060
+ }
2061
+ try {
2062
+ return await successfulResponseHandler({
2063
+ response,
2064
+ url,
2065
+ requestBodyValues: body.values
2066
+ });
2067
+ } catch (error) {
2068
+ if (error instanceof Error) {
2069
+ if (isAbortError(error) || APICallError.isInstance(error)) {
2070
+ throw error;
2071
+ }
2072
+ }
2073
+ throw new APICallError({
2074
+ message: "Failed to process successful response",
2075
+ cause: error,
2076
+ statusCode: response.status,
2077
+ url,
2078
+ responseHeaders,
2079
+ requestBodyValues: body.values
2080
+ });
2081
+ }
2082
+ } catch (error) {
2083
+ throw handleFetchError({ error, url, requestBodyValues: body.values });
2084
+ }
2085
+ };
2086
+ function tool(tool2) {
2087
+ return tool2;
2088
+ }
2089
+ function createProviderDefinedToolFactory({
2090
+ id,
2091
+ name: name14,
2092
+ inputSchema
2093
+ }) {
2094
+ return ({
2095
+ execute,
2096
+ outputSchema,
2097
+ toModelOutput,
2098
+ onInputStart,
2099
+ onInputDelta,
2100
+ onInputAvailable,
2101
+ ...args
2102
+ }) => tool({
2103
+ type: "provider-defined",
2104
+ id,
2105
+ name: name14,
2106
+ args,
2107
+ inputSchema,
2108
+ outputSchema,
2109
+ execute,
2110
+ toModelOutput,
2111
+ onInputStart,
2112
+ onInputDelta,
2113
+ onInputAvailable
2114
+ });
2115
+ }
2116
+ function createProviderDefinedToolFactoryWithOutputSchema({
2117
+ id,
2118
+ name: name14,
2119
+ inputSchema,
2120
+ outputSchema
2121
+ }) {
2122
+ return ({
2123
+ execute,
2124
+ toModelOutput,
2125
+ onInputStart,
2126
+ onInputDelta,
2127
+ onInputAvailable,
2128
+ ...args
2129
+ }) => tool({
2130
+ type: "provider-defined",
2131
+ id,
2132
+ name: name14,
2133
+ args,
2134
+ inputSchema,
2135
+ outputSchema,
2136
+ execute,
2137
+ toModelOutput,
2138
+ onInputStart,
2139
+ onInputDelta,
2140
+ onInputAvailable
2141
+ });
2142
+ }
2143
+ async function resolve(value) {
2144
+ if (typeof value === "function") {
2145
+ value = value();
2146
+ }
2147
+ return Promise.resolve(value);
2148
+ }
2149
+ var createJsonErrorResponseHandler = ({
2150
+ errorSchema,
2151
+ errorToMessage,
2152
+ isRetryable
2153
+ }) => async ({ response, url, requestBodyValues }) => {
2154
+ const responseBody = await response.text();
2155
+ const responseHeaders = extractResponseHeaders(response);
2156
+ if (responseBody.trim() === "") {
2157
+ return {
2158
+ responseHeaders,
2159
+ value: new APICallError({
2160
+ message: response.statusText,
2161
+ url,
2162
+ requestBodyValues,
2163
+ statusCode: response.status,
2164
+ responseHeaders,
2165
+ responseBody,
2166
+ isRetryable: isRetryable == null ? void 0 : isRetryable(response)
2167
+ })
2168
+ };
2169
+ }
2170
+ try {
2171
+ const parsedError = await parseJSON({
2172
+ text: responseBody,
2173
+ schema: errorSchema
2174
+ });
2175
+ return {
2176
+ responseHeaders,
2177
+ value: new APICallError({
2178
+ message: errorToMessage(parsedError),
2179
+ url,
2180
+ requestBodyValues,
2181
+ statusCode: response.status,
2182
+ responseHeaders,
2183
+ responseBody,
2184
+ data: parsedError,
2185
+ isRetryable: isRetryable == null ? void 0 : isRetryable(response, parsedError)
2186
+ })
2187
+ };
2188
+ } catch (parseError) {
2189
+ return {
2190
+ responseHeaders,
2191
+ value: new APICallError({
2192
+ message: response.statusText,
2193
+ url,
2194
+ requestBodyValues,
2195
+ statusCode: response.status,
2196
+ responseHeaders,
2197
+ responseBody,
2198
+ isRetryable: isRetryable == null ? void 0 : isRetryable(response)
2199
+ })
2200
+ };
2201
+ }
2202
+ };
2203
+ var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
2204
+ const responseHeaders = extractResponseHeaders(response);
2205
+ if (response.body == null) {
2206
+ throw new EmptyResponseBodyError({});
2207
+ }
2208
+ return {
2209
+ responseHeaders,
2210
+ value: parseJsonEventStream({
2211
+ stream: response.body,
2212
+ schema: chunkSchema
2213
+ })
2214
+ };
2215
+ };
2216
+ var createJsonResponseHandler = (responseSchema) => async ({ response, url, requestBodyValues }) => {
2217
+ const responseBody = await response.text();
2218
+ const parsedResult = await safeParseJSON({
2219
+ text: responseBody,
2220
+ schema: responseSchema
2221
+ });
2222
+ const responseHeaders = extractResponseHeaders(response);
2223
+ if (!parsedResult.success) {
2224
+ throw new APICallError({
2225
+ message: "Invalid JSON response",
2226
+ cause: parsedResult.error,
2227
+ statusCode: response.status,
2228
+ responseHeaders,
2229
+ responseBody,
2230
+ url,
2231
+ requestBodyValues
2232
+ });
2233
+ }
2234
+ return {
2235
+ responseHeaders,
2236
+ value: parsedResult.value,
2237
+ rawValue: parsedResult.rawValue
2238
+ };
2239
+ };
2240
+ var createBinaryResponseHandler = () => async ({ response, url, requestBodyValues }) => {
2241
+ const responseHeaders = extractResponseHeaders(response);
2242
+ if (!response.body) {
2243
+ throw new APICallError({
2244
+ message: "Response body is empty",
2245
+ url,
2246
+ requestBodyValues,
2247
+ statusCode: response.status,
2248
+ responseHeaders,
2249
+ responseBody: void 0
2250
+ });
2251
+ }
2252
+ try {
2253
+ const buffer = await response.arrayBuffer();
2254
+ return {
2255
+ responseHeaders,
2256
+ value: new Uint8Array(buffer)
2257
+ };
2258
+ } catch (error) {
2259
+ throw new APICallError({
2260
+ message: "Failed to read response as array buffer",
2261
+ url,
2262
+ requestBodyValues,
2263
+ statusCode: response.status,
2264
+ responseHeaders,
2265
+ responseBody: void 0,
2266
+ cause: error
2267
+ });
2268
+ }
2269
+ };
2270
+ var { btoa, atob } = globalThis;
2271
+ function convertBase64ToUint8Array(base64String) {
2272
+ const base64Url = base64String.replace(/-/g, "+").replace(/_/g, "/");
2273
+ const latin1string = atob(base64Url);
2274
+ return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0));
2275
+ }
2276
+ function convertUint8ArrayToBase64(array) {
2277
+ let latin1string = "";
2278
+ for (let i = 0; i < array.length; i++) {
2279
+ latin1string += String.fromCodePoint(array[i]);
2280
+ }
2281
+ return btoa(latin1string);
2282
+ }
2283
+ function convertToBase64(value) {
2284
+ return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
2285
+ }
2286
+ function withoutTrailingSlash(url) {
2287
+ return url == null ? void 0 : url.replace(/\/$/, "");
2288
+ }
2289
+
2290
+ exports.AISDKError = AISDKError;
2291
+ exports.APICallError = APICallError;
2292
+ exports.EmptyResponseBodyError = EmptyResponseBodyError;
2293
+ exports.EventSourceParserStream = EventSourceParserStream;
2294
+ exports.InvalidArgumentError = InvalidArgumentError;
2295
+ exports.InvalidPromptError = InvalidPromptError;
2296
+ exports.InvalidResponseDataError = InvalidResponseDataError;
2297
+ exports.JSONParseError = JSONParseError;
2298
+ exports.NoSuchModelError = NoSuchModelError;
2299
+ exports.TooManyEmbeddingValuesForCallError = TooManyEmbeddingValuesForCallError;
2300
+ exports.TypeValidationError = TypeValidationError;
2301
+ exports.UnsupportedFunctionalityError = UnsupportedFunctionalityError;
2302
+ exports.combineHeaders = combineHeaders;
2303
+ exports.convertBase64ToUint8Array = convertBase64ToUint8Array;
2304
+ exports.convertToBase64 = convertToBase64;
2305
+ exports.createBinaryResponseHandler = createBinaryResponseHandler;
2306
+ exports.createEventSourceResponseHandler = createEventSourceResponseHandler;
2307
+ exports.createJsonErrorResponseHandler = createJsonErrorResponseHandler;
2308
+ exports.createJsonResponseHandler = createJsonResponseHandler;
2309
+ exports.createProviderDefinedToolFactory = createProviderDefinedToolFactory;
2310
+ exports.createProviderDefinedToolFactoryWithOutputSchema = createProviderDefinedToolFactoryWithOutputSchema;
2311
+ exports.esm_default = esm_default;
2312
+ exports.generateId = generateId;
2313
+ exports.isParsableJson = isParsableJson;
2314
+ exports.loadApiKey = loadApiKey;
2315
+ exports.parseProviderOptions = parseProviderOptions;
2316
+ exports.postFormDataToApi = postFormDataToApi;
2317
+ exports.postJsonToApi = postJsonToApi;
2318
+ exports.resolve = resolve;
2319
+ exports.withoutTrailingSlash = withoutTrailingSlash;
2320
+ //# sourceMappingURL=chunk-HVBBFCDH.cjs.map
2321
+ //# sourceMappingURL=chunk-HVBBFCDH.cjs.map