gemi 0.214.0 → 0.216.0

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 (264) hide show
  1. package/dist/ai/Agent.d.ts +9 -7
  2. package/dist/ai/Agent.d.ts.map +1 -1
  3. package/dist/ai/AgentController.d.ts +6 -5
  4. package/dist/ai/AgentController.d.ts.map +1 -1
  5. package/dist/ai/AgentProvider.d.ts +12 -15
  6. package/dist/ai/AgentProvider.d.ts.map +1 -1
  7. package/dist/ai/FallbackProvider.d.ts +6 -6
  8. package/dist/ai/FallbackProvider.d.ts.map +1 -1
  9. package/dist/ai/generate.d.ts.map +1 -1
  10. package/dist/ai/index.d.ts +1 -1
  11. package/dist/ai/index.d.ts.map +1 -1
  12. package/dist/ai/index.js +21 -21
  13. package/dist/ai/index.js.map +4 -4
  14. package/dist/ai/providers/anthropicStream.d.ts.map +1 -1
  15. package/dist/ai/providers/errors.d.ts +15 -7
  16. package/dist/ai/providers/errors.d.ts.map +1 -1
  17. package/dist/ai/providers/stream.d.ts.map +1 -1
  18. package/dist/ai/redact.d.ts +4 -6
  19. package/dist/ai/redact.d.ts.map +1 -1
  20. package/dist/ai/testing/index.js +2 -2
  21. package/dist/ai/testing/index.js.map +1 -1
  22. package/dist/ai/types.d.ts +23 -0
  23. package/dist/ai/types.d.ts.map +1 -1
  24. package/dist/app/index.js +1 -1
  25. package/dist/auth/config.d.ts +4 -1
  26. package/dist/auth/config.d.ts.map +1 -1
  27. package/dist/auth/connections/ConnectionManager.d.ts +9 -0
  28. package/dist/auth/connections/ConnectionManager.d.ts.map +1 -1
  29. package/dist/auth/connections/FacebookConnectionProvider.d.ts +126 -0
  30. package/dist/auth/connections/FacebookConnectionProvider.d.ts.map +1 -0
  31. package/dist/auth/connections/LinkedInConnectionProvider.d.ts +84 -0
  32. package/dist/auth/connections/LinkedInConnectionProvider.d.ts.map +1 -0
  33. package/dist/auth/connections/OAuthConnectionProvider.d.ts +14 -0
  34. package/dist/auth/connections/OAuthConnectionProvider.d.ts.map +1 -1
  35. package/dist/auth/connections/TikTokConnectionProvider.d.ts +52 -0
  36. package/dist/auth/connections/TikTokConnectionProvider.d.ts.map +1 -0
  37. package/dist/auth/connections/XConnectionProvider.d.ts +39 -0
  38. package/dist/auth/connections/XConnectionProvider.d.ts.map +1 -0
  39. package/dist/auth/connections/YouTubeConnectionProvider.d.ts +48 -0
  40. package/dist/auth/connections/YouTubeConnectionProvider.d.ts.map +1 -0
  41. package/dist/auth/connections/errors.d.ts +1 -1
  42. package/dist/auth/connections/errors.d.ts.map +1 -1
  43. package/dist/auth/connections/social.d.ts +63 -0
  44. package/dist/auth/connections/social.d.ts.map +1 -0
  45. package/dist/bin/ai-client/extract.d.ts +39 -1
  46. package/dist/bin/ai-client/extract.d.ts.map +1 -1
  47. package/dist/bin/ai-client/model.d.ts +7 -3
  48. package/dist/bin/ai-client/model.d.ts.map +1 -1
  49. package/dist/bin/gemi.js +12 -8
  50. package/dist/bin/gemi.js.map +4 -4
  51. package/dist/bin/http-client/extract.d.ts +11 -0
  52. package/dist/bin/http-client/extract.d.ts.map +1 -0
  53. package/dist/bin/http-client/model.d.ts +39 -0
  54. package/dist/bin/http-client/model.d.ts.map +1 -0
  55. package/dist/bun/plugin.js +1 -1
  56. package/dist/bun/preload.js +1 -1
  57. package/dist/{chunk-rdzdbd52.js → chunk-01r2cx3k.js} +4 -4
  58. package/dist/{chunk-rdzdbd52.js.map → chunk-01r2cx3k.js.map} +1 -1
  59. package/dist/{chunk-nc5p41g9.js → chunk-0a796avj.js} +2 -2
  60. package/dist/{chunk-nc5p41g9.js.map → chunk-0a796avj.js.map} +1 -1
  61. package/dist/{chunk-y0b22kf8.js → chunk-0ah98rf4.js} +2 -2
  62. package/dist/{chunk-y0b22kf8.js.map → chunk-0ah98rf4.js.map} +1 -1
  63. package/dist/{chunk-c80xrwep.js → chunk-0z8h6t7k.js} +2 -2
  64. package/dist/{chunk-c80xrwep.js.map → chunk-0z8h6t7k.js.map} +1 -1
  65. package/dist/{chunk-c8sqvhxp.js → chunk-1hs2fxxx.js} +2 -2
  66. package/dist/{chunk-c8sqvhxp.js.map → chunk-1hs2fxxx.js.map} +1 -1
  67. package/dist/{chunk-ge201pk4.js → chunk-1k6dn4ba.js} +1 -1
  68. package/dist/{chunk-gk2k76tn.js → chunk-2crfg0m7.js} +3 -3
  69. package/dist/{chunk-gk2k76tn.js.map → chunk-2crfg0m7.js.map} +1 -1
  70. package/dist/{chunk-153m8mfe.js → chunk-362a52jj.js} +2 -2
  71. package/dist/{chunk-153m8mfe.js.map → chunk-362a52jj.js.map} +1 -1
  72. package/dist/{chunk-gg97wgy0.js → chunk-3pfrqzw8.js} +2 -2
  73. package/dist/{chunk-gg97wgy0.js.map → chunk-3pfrqzw8.js.map} +1 -1
  74. package/dist/{chunk-5w0kzk4m.js → chunk-4zw9gaey.js} +2 -2
  75. package/dist/{chunk-5w0kzk4m.js.map → chunk-4zw9gaey.js.map} +1 -1
  76. package/dist/{chunk-m4nn6ne9.js → chunk-5294qsfq.js} +2 -2
  77. package/dist/{chunk-m4nn6ne9.js.map → chunk-5294qsfq.js.map} +1 -1
  78. package/dist/{chunk-5399t8zm.js → chunk-5cf59esb.js} +2 -2
  79. package/dist/{chunk-5399t8zm.js.map → chunk-5cf59esb.js.map} +1 -1
  80. package/dist/{chunk-768yza4f.js → chunk-5m0vh0rg.js} +2 -2
  81. package/dist/{chunk-768yza4f.js.map → chunk-5m0vh0rg.js.map} +1 -1
  82. package/dist/{chunk-d8nxkc90.js → chunk-5ya7fbfg.js} +2 -2
  83. package/dist/{chunk-d8nxkc90.js.map → chunk-5ya7fbfg.js.map} +1 -1
  84. package/dist/{chunk-tvd39jya.js → chunk-62b7paq5.js} +2 -2
  85. package/dist/{chunk-tvd39jya.js.map → chunk-62b7paq5.js.map} +1 -1
  86. package/dist/{chunk-bvm2w6ha.js → chunk-6669vjve.js} +2 -2
  87. package/dist/{chunk-bvm2w6ha.js.map → chunk-6669vjve.js.map} +1 -1
  88. package/dist/{chunk-fw7sxgse.js → chunk-6cge785m.js} +1 -1
  89. package/dist/{chunk-3egn4pfk.js → chunk-6s48nq83.js} +2 -2
  90. package/dist/{chunk-3egn4pfk.js.map → chunk-6s48nq83.js.map} +1 -1
  91. package/dist/{chunk-9xa5kzaq.js → chunk-7bywa721.js} +2 -2
  92. package/dist/{chunk-9xa5kzaq.js.map → chunk-7bywa721.js.map} +1 -1
  93. package/dist/{chunk-18aw52vs.js → chunk-7mg2ash8.js} +2 -2
  94. package/dist/{chunk-18aw52vs.js.map → chunk-7mg2ash8.js.map} +1 -1
  95. package/dist/{chunk-zsk4wvrs.js → chunk-8q3pnwtj.js} +2 -2
  96. package/dist/{chunk-zsk4wvrs.js.map → chunk-8q3pnwtj.js.map} +1 -1
  97. package/dist/{chunk-xdrnzs3t.js → chunk-95yr9y9v.js} +2 -2
  98. package/dist/{chunk-xdrnzs3t.js.map → chunk-95yr9y9v.js.map} +1 -1
  99. package/dist/{chunk-t8ghxzva.js → chunk-9k6swvf1.js} +3 -3
  100. package/dist/{chunk-t8ghxzva.js.map → chunk-9k6swvf1.js.map} +1 -1
  101. package/dist/{chunk-6n54q6wj.js → chunk-9pjvetym.js} +4 -4
  102. package/dist/{chunk-6n54q6wj.js.map → chunk-9pjvetym.js.map} +4 -4
  103. package/dist/{chunk-mcqzgyvf.js → chunk-a6yge4kh.js} +2 -2
  104. package/dist/{chunk-mcqzgyvf.js.map → chunk-a6yge4kh.js.map} +1 -1
  105. package/dist/{chunk-at5ce580.js → chunk-aqjjknyk.js} +3 -3
  106. package/dist/chunk-aqjjknyk.js.map +27 -0
  107. package/dist/{chunk-2v7stsgt.js → chunk-b02yzfpk.js} +2 -2
  108. package/dist/{chunk-2v7stsgt.js.map → chunk-b02yzfpk.js.map} +1 -1
  109. package/dist/{chunk-hcysexst.js → chunk-bk1e8sah.js} +2 -2
  110. package/dist/{chunk-hcysexst.js.map → chunk-bk1e8sah.js.map} +1 -1
  111. package/dist/{chunk-c8sq880v.js → chunk-btf3t4qa.js} +2 -2
  112. package/dist/{chunk-c8sq880v.js.map → chunk-btf3t4qa.js.map} +1 -1
  113. package/dist/{chunk-jgb3je66.js → chunk-bw1mvk6n.js} +2 -2
  114. package/dist/{chunk-jgb3je66.js.map → chunk-bw1mvk6n.js.map} +1 -1
  115. package/dist/{chunk-7czjphwg.js → chunk-c231j2e7.js} +2 -2
  116. package/dist/{chunk-7czjphwg.js.map → chunk-c231j2e7.js.map} +1 -1
  117. package/dist/{chunk-k6532519.js → chunk-c2c21b6g.js} +2 -2
  118. package/dist/{chunk-k6532519.js.map → chunk-c2c21b6g.js.map} +1 -1
  119. package/dist/{chunk-bjh3ms04.js → chunk-cgkp0ypn.js} +2 -2
  120. package/dist/{chunk-bjh3ms04.js.map → chunk-cgkp0ypn.js.map} +1 -1
  121. package/dist/{chunk-61sevt6g.js → chunk-cws2tsxg.js} +2 -2
  122. package/dist/{chunk-61sevt6g.js.map → chunk-cws2tsxg.js.map} +1 -1
  123. package/dist/{chunk-1a0ehbkm.js → chunk-djpqt7kh.js} +1 -1
  124. package/dist/{chunk-ha3d6zhv.js → chunk-djwmrvsq.js} +2 -2
  125. package/dist/{chunk-ha3d6zhv.js.map → chunk-djwmrvsq.js.map} +1 -1
  126. package/dist/chunk-dpm875be.js +71 -0
  127. package/dist/{chunk-2mwkjfnd.js.map → chunk-dpm875be.js.map} +5 -5
  128. package/dist/{chunk-2ek8wpe8.js → chunk-dqw432zh.js} +3 -3
  129. package/dist/{chunk-2ek8wpe8.js.map → chunk-dqw432zh.js.map} +1 -1
  130. package/dist/chunk-g1b6zetz.js +5 -0
  131. package/dist/{chunk-y10tys3s.js.map → chunk-g1b6zetz.js.map} +4 -4
  132. package/dist/{chunk-2hcwvkfx.js → chunk-g1th1dfa.js} +3 -3
  133. package/dist/{chunk-2hcwvkfx.js.map → chunk-g1th1dfa.js.map} +1 -1
  134. package/dist/{chunk-xbxdhmh4.js → chunk-g7vyn179.js} +3 -3
  135. package/dist/{chunk-xbxdhmh4.js.map → chunk-g7vyn179.js.map} +1 -1
  136. package/dist/{chunk-3vnb6xhz.js → chunk-gkjsanjh.js} +1 -1
  137. package/dist/{chunk-2x4x2qnk.js → chunk-gwe9hbds.js} +2 -2
  138. package/dist/{chunk-2x4x2qnk.js.map → chunk-gwe9hbds.js.map} +1 -1
  139. package/dist/{chunk-zzrmsvqc.js → chunk-hea3rwj3.js} +2 -2
  140. package/dist/{chunk-zzrmsvqc.js.map → chunk-hea3rwj3.js.map} +1 -1
  141. package/dist/{chunk-y54kz6h6.js → chunk-hknnxxg6.js} +3 -3
  142. package/dist/{chunk-y54kz6h6.js.map → chunk-hknnxxg6.js.map} +1 -1
  143. package/dist/{chunk-sqzm1k9q.js → chunk-htkw9qbv.js} +2 -2
  144. package/dist/{chunk-sqzm1k9q.js.map → chunk-htkw9qbv.js.map} +1 -1
  145. package/dist/{chunk-9ph676kt.js → chunk-j6j0qxam.js} +2 -2
  146. package/dist/{chunk-9ph676kt.js.map → chunk-j6j0qxam.js.map} +1 -1
  147. package/dist/{chunk-hka2sgqz.js → chunk-jr9f5r65.js} +3 -3
  148. package/dist/{chunk-hka2sgqz.js.map → chunk-jr9f5r65.js.map} +1 -1
  149. package/dist/{chunk-11wy7gm1.js → chunk-k9pch3e6.js} +2 -2
  150. package/dist/{chunk-11wy7gm1.js.map → chunk-k9pch3e6.js.map} +1 -1
  151. package/dist/{chunk-er6rhs42.js → chunk-kc1y747c.js} +3 -3
  152. package/dist/{chunk-er6rhs42.js.map → chunk-kc1y747c.js.map} +1 -1
  153. package/dist/{chunk-mj857ksa.js → chunk-kd6z1t9z.js} +3 -3
  154. package/dist/{chunk-mj857ksa.js.map → chunk-kd6z1t9z.js.map} +1 -1
  155. package/dist/{chunk-4q0pxgv6.js → chunk-knmh8ynk.js} +2 -2
  156. package/dist/{chunk-4q0pxgv6.js.map → chunk-knmh8ynk.js.map} +1 -1
  157. package/dist/{chunk-0njs5zqz.js → chunk-mjyr8at2.js} +3 -3
  158. package/dist/{chunk-0njs5zqz.js.map → chunk-mjyr8at2.js.map} +1 -1
  159. package/dist/{chunk-9a3wbbr6.js → chunk-mnfk2r8z.js} +2 -2
  160. package/dist/{chunk-9a3wbbr6.js.map → chunk-mnfk2r8z.js.map} +1 -1
  161. package/dist/{chunk-chy85f3v.js → chunk-mv2d2njy.js} +2 -2
  162. package/dist/{chunk-chy85f3v.js.map → chunk-mv2d2njy.js.map} +1 -1
  163. package/dist/{chunk-78gy3agg.js → chunk-mw4c05vw.js} +2 -2
  164. package/dist/{chunk-78gy3agg.js.map → chunk-mw4c05vw.js.map} +1 -1
  165. package/dist/{chunk-m4wagwhr.js → chunk-naj8bmj5.js} +2 -2
  166. package/dist/{chunk-m4wagwhr.js.map → chunk-naj8bmj5.js.map} +1 -1
  167. package/dist/{chunk-6cdykmvn.js → chunk-p5n1tqqg.js} +2 -2
  168. package/dist/{chunk-6cdykmvn.js.map → chunk-p5n1tqqg.js.map} +1 -1
  169. package/dist/{chunk-dghymwgp.js → chunk-py69zwwv.js} +2 -2
  170. package/dist/{chunk-dghymwgp.js.map → chunk-py69zwwv.js.map} +1 -1
  171. package/dist/{chunk-9yh4sfac.js → chunk-q677pnq5.js} +3 -3
  172. package/dist/{chunk-9yh4sfac.js.map → chunk-q677pnq5.js.map} +1 -1
  173. package/dist/chunk-rqa04dtq.js +11 -0
  174. package/dist/{chunk-3ejv7fs4.js.map → chunk-rqa04dtq.js.map} +6 -6
  175. package/dist/{chunk-vz2dt9f3.js → chunk-rzhgcajs.js} +1 -1
  176. package/dist/{chunk-5yfdrbwv.js → chunk-shn9t4vg.js} +2 -2
  177. package/dist/{chunk-5yfdrbwv.js.map → chunk-shn9t4vg.js.map} +1 -1
  178. package/dist/{chunk-2e278yhf.js → chunk-t0519abr.js} +2 -2
  179. package/dist/{chunk-2e278yhf.js.map → chunk-t0519abr.js.map} +1 -1
  180. package/dist/{chunk-c46y8hs0.js → chunk-t5af0fjq.js} +2 -2
  181. package/dist/{chunk-c46y8hs0.js.map → chunk-t5af0fjq.js.map} +1 -1
  182. package/dist/chunk-texzdarz.js +5 -0
  183. package/dist/{chunk-g4esp7z5.js.map → chunk-texzdarz.js.map} +1 -1
  184. package/dist/{chunk-wsp30cr6.js → chunk-ttz05z12.js} +2 -2
  185. package/dist/{chunk-wsp30cr6.js.map → chunk-ttz05z12.js.map} +1 -1
  186. package/dist/{chunk-sw8012bt.js → chunk-twb7x8j8.js} +2 -2
  187. package/dist/{chunk-sw8012bt.js.map → chunk-twb7x8j8.js.map} +1 -1
  188. package/dist/{chunk-2w8j265x.js → chunk-v7bbn1m0.js} +3 -3
  189. package/dist/{chunk-2w8j265x.js.map → chunk-v7bbn1m0.js.map} +1 -1
  190. package/dist/{chunk-qt80d3fw.js → chunk-w1my1q4q.js} +2 -2
  191. package/dist/{chunk-qt80d3fw.js.map → chunk-w1my1q4q.js.map} +1 -1
  192. package/dist/{chunk-ktxf56dm.js → chunk-wcj083k2.js} +3 -3
  193. package/dist/{chunk-ktxf56dm.js.map → chunk-wcj083k2.js.map} +1 -1
  194. package/dist/{chunk-fdbh87nv.js → chunk-xg5r0383.js} +3 -3
  195. package/dist/{chunk-fdbh87nv.js.map → chunk-xg5r0383.js.map} +1 -1
  196. package/dist/{chunk-wee3yrdn.js → chunk-xw241q0q.js} +1 -1
  197. package/dist/{chunk-nx86gzt1.js → chunk-y9fye7az.js} +2 -2
  198. package/dist/{chunk-nx86gzt1.js.map → chunk-y9fye7az.js.map} +1 -1
  199. package/dist/{chunk-ntwmz16f.js → chunk-yak9kt1x.js} +2 -2
  200. package/dist/{chunk-ntwmz16f.js.map → chunk-yak9kt1x.js.map} +1 -1
  201. package/dist/{chunk-frtx87yh.js → chunk-ybmy1rts.js} +2 -2
  202. package/dist/{chunk-frtx87yh.js.map → chunk-ybmy1rts.js.map} +1 -1
  203. package/dist/{chunk-s7p6w1p2.js → chunk-yjshg4e5.js} +2 -2
  204. package/dist/{chunk-s7p6w1p2.js.map → chunk-yjshg4e5.js.map} +1 -1
  205. package/dist/{chunk-tejgrqh7.js → chunk-z03ds1qe.js} +2 -2
  206. package/dist/{chunk-tejgrqh7.js.map → chunk-z03ds1qe.js.map} +1 -1
  207. package/dist/{chunk-3xrmx5c7.js → chunk-z54zefss.js} +2 -2
  208. package/dist/{chunk-3xrmx5c7.js.map → chunk-z54zefss.js.map} +1 -1
  209. package/dist/{chunk-cgjdxxwy.js → chunk-zbxvyanj.js} +2 -2
  210. package/dist/{chunk-cgjdxxwy.js.map → chunk-zbxvyanj.js.map} +1 -1
  211. package/dist/client/index.js +3 -2
  212. package/dist/client/index.js.map +1 -1
  213. package/dist/client/queryEffects.d.ts.map +1 -1
  214. package/dist/config/index.js +1 -1
  215. package/dist/console/run.js +2 -2
  216. package/dist/console/run.js.map +1 -1
  217. package/dist/container/index.js +2 -2
  218. package/dist/container/index.js.map +1 -1
  219. package/dist/database/index.js +2 -2
  220. package/dist/database/index.js.map +1 -1
  221. package/dist/email/index.js +2 -2
  222. package/dist/email/index.js.map +1 -1
  223. package/dist/facades/index.js +2 -2
  224. package/dist/facades/index.js.map +1 -1
  225. package/dist/foundation/index.js +2 -2
  226. package/dist/foundation/index.js.map +1 -1
  227. package/dist/http/ApiRouter.d.ts +6 -1
  228. package/dist/http/ApiRouter.d.ts.map +1 -1
  229. package/dist/http/index.js +2 -2
  230. package/dist/http/index.js.map +1 -1
  231. package/dist/i18n/dictionaryRuntime.js +2 -2
  232. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  233. package/dist/i18n/index.js +2 -2
  234. package/dist/i18n/index.js.map +1 -1
  235. package/dist/kernel/index.js +2 -2
  236. package/dist/kernel/index.js.map +1 -1
  237. package/dist/orm/index.js +2 -2
  238. package/dist/orm/index.js.map +1 -1
  239. package/dist/probe/index.js +2 -2
  240. package/dist/probe/index.js.map +1 -1
  241. package/dist/server/index.js +2 -2
  242. package/dist/server/index.js.map +1 -1
  243. package/dist/services/index.d.ts +11 -0
  244. package/dist/services/index.d.ts.map +1 -1
  245. package/dist/services/index.js +16 -16
  246. package/dist/services/index.js.map +9 -3
  247. package/dist/services/queue/work.js +2 -2
  248. package/dist/services/queue/work.js.map +1 -1
  249. package/dist/stats/route-table.js +1 -1
  250. package/dist/support/index.js +2 -2
  251. package/dist/support/index.js.map +1 -1
  252. package/dist/vitest/index.js +1 -1
  253. package/package.json +1 -1
  254. package/dist/chunk-2mwkjfnd.js +0 -71
  255. package/dist/chunk-3ejv7fs4.js +0 -11
  256. package/dist/chunk-at5ce580.js.map +0 -27
  257. package/dist/chunk-g4esp7z5.js +0 -5
  258. package/dist/chunk-y10tys3s.js +0 -5
  259. /package/dist/{chunk-ge201pk4.js.map → chunk-1k6dn4ba.js.map} +0 -0
  260. /package/dist/{chunk-fw7sxgse.js.map → chunk-6cge785m.js.map} +0 -0
  261. /package/dist/{chunk-1a0ehbkm.js.map → chunk-djpqt7kh.js.map} +0 -0
  262. /package/dist/{chunk-3vnb6xhz.js.map → chunk-gkjsanjh.js.map} +0 -0
  263. /package/dist/{chunk-vz2dt9f3.js.map → chunk-rzhgcajs.js.map} +0 -0
  264. /package/dist/{chunk-wee3yrdn.js.map → chunk-xw241q0q.js.map} +0 -0
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Ee as J,He as A}from"../../chunk-9yh4sfac.js";import{Uk as V}from"../../chunk-9a3wbbr6.js";import"../../chunk-mcqzgyvf.js";import"../../chunk-cgjdxxwy.js";import"../../chunk-er6rhs42.js";import"../../chunk-bvm2w6ha.js";import"../../chunk-mj857ksa.js";import"../../chunk-gg97wgy0.js";import{qm as Y,tm as N,um as Z,vm as _,zm as I}from"../../chunk-zzrmsvqc.js";import{Dm as x}from"../../chunk-5yfdrbwv.js";import"../../chunk-c80xrwep.js";import $ from"path";function X(z){if(!z.config.get("route.channels"))return null;let C=z.config.get("broadcast",{}).driver;if(!(C===void 0||C==="memory"||C instanceof V))return null;return'[gemi] Broadcasts from this worker reach no one: the broadcast driver is "memory", which delivers to the sockets of the process that emits, and a worker has none. Set `driver: "redis"` in app/config/broadcast.ts.'}class L extends Error{name="QueueWorkerRefused"}class O{kernel;stopping;keepAlive;settings;constructor(z,C={}){this.kernel=z;this.settings={..._(),...C}}async start(){if(await this.kernel.waitForBoot(),this.stopping)return;let z=this.kernel.app;if(!z.bound(J))throw new L("[gemi] `gemi queue:work` has no queue to claim from: this application does not register QueueServiceProvider.");let C=z.make(J);if(!C.durable)throw new L('[gemi] `gemi queue:work` refuses to start: the queue uses the memory driver, which keeps each job in the process that dispatched it, so a worker never sees one. Set `driver: "database"` (or another driver every process can reach) in app/config/queue.ts, or run jobs in the server and drop the worker.');C.start(),this.keepAlive=setInterval(()=>{},1073741824),console.log(`[gemi] Queue worker started: claiming up to ${C.config.concurrency} job(s) at a time.`);let E=X(z);if(E)console.warn(E)}stop(z={}){return this.stopping??=this.drain({...this.settings,...z}),this.stopping}async drain(z){let C=Date.now()+z.timeoutMs;Y();let E=this.kernel.app,F=E.resolved(J)?E.make(J):void 0;if(F)console.log(`[gemi] Shutting down: waiting for ${F.running} running job(s) (up to ${z.timeoutMs/1000}s).`),await F.drain(z.timeoutMs);let G=N()===0;if(!G){let U=C-Date.now();if(G=U>0&&await Promise.race([Z().then(()=>!0),new Promise((K)=>setTimeout(()=>K(!1),U))]),!G)console.error(`[gemi] Shutdown grace period elapsed with ${N()} held background task(s) still running; abandoning them.`)}let H=await this.kernel.shutdown({timeoutMs:z.providerTimeoutMs});clearInterval(this.keepAlive);let T=G&&(F?.running??0)===0&&H.failed.length===0&&H.timedOut.length===0;return console.log(`[gemi] Shutdown ${T?"complete":"finished with errors"}.`),T?0:1}}async function j(){let z=x();process.env.ROOT_DIR=z,process.env.APP_DIR=$.join(z,"app"),A();let C=$.join(z,"app/kernel/Kernel.ts"),{default:E}=await import(C);if(typeof E!=="function")return console.error(`[gemi] ${C} has no default export to boot the worker from.`),1;let F=new E;F.boot();let G=new O(F);I(()=>G.stop());try{await G.start()}catch(H){if(!(H instanceof L))throw H;return console.error(H.message),1}return}j().then((z)=>{if(z!==void 0)process.exit(z)},(z)=>{console.error("[gemi] The queue worker failed to start:",z),process.exit(1)});
2
+ import{Fe as J,Ie as A}from"../../chunk-q677pnq5.js";import{Vk as V}from"../../chunk-mnfk2r8z.js";import"../../chunk-a6yge4kh.js";import"../../chunk-zbxvyanj.js";import"../../chunk-kc1y747c.js";import"../../chunk-6669vjve.js";import"../../chunk-kd6z1t9z.js";import"../../chunk-3pfrqzw8.js";import{Am as I,rm as Y,um as N,vm as Z,wm as _}from"../../chunk-hea3rwj3.js";import{Em as x}from"../../chunk-shn9t4vg.js";import"../../chunk-0z8h6t7k.js";import $ from"path";function X(z){if(!z.config.get("route.channels"))return null;let C=z.config.get("broadcast",{}).driver;if(!(C===void 0||C==="memory"||C instanceof V))return null;return'[gemi] Broadcasts from this worker reach no one: the broadcast driver is "memory", which delivers to the sockets of the process that emits, and a worker has none. Set `driver: "redis"` in app/config/broadcast.ts.'}class L extends Error{name="QueueWorkerRefused"}class O{kernel;stopping;keepAlive;settings;constructor(z,C={}){this.kernel=z;this.settings={..._(),...C}}async start(){if(await this.kernel.waitForBoot(),this.stopping)return;let z=this.kernel.app;if(!z.bound(J))throw new L("[gemi] `gemi queue:work` has no queue to claim from: this application does not register QueueServiceProvider.");let C=z.make(J);if(!C.durable)throw new L('[gemi] `gemi queue:work` refuses to start: the queue uses the memory driver, which keeps each job in the process that dispatched it, so a worker never sees one. Set `driver: "database"` (or another driver every process can reach) in app/config/queue.ts, or run jobs in the server and drop the worker.');C.start(),this.keepAlive=setInterval(()=>{},1073741824),console.log(`[gemi] Queue worker started: claiming up to ${C.config.concurrency} job(s) at a time.`);let E=X(z);if(E)console.warn(E)}stop(z={}){return this.stopping??=this.drain({...this.settings,...z}),this.stopping}async drain(z){let C=Date.now()+z.timeoutMs;Y();let E=this.kernel.app,F=E.resolved(J)?E.make(J):void 0;if(F)console.log(`[gemi] Shutting down: waiting for ${F.running} running job(s) (up to ${z.timeoutMs/1000}s).`),await F.drain(z.timeoutMs);let G=N()===0;if(!G){let U=C-Date.now();if(G=U>0&&await Promise.race([Z().then(()=>!0),new Promise((K)=>setTimeout(()=>K(!1),U))]),!G)console.error(`[gemi] Shutdown grace period elapsed with ${N()} held background task(s) still running; abandoning them.`)}let H=await this.kernel.shutdown({timeoutMs:z.providerTimeoutMs});clearInterval(this.keepAlive);let T=G&&(F?.running??0)===0&&H.failed.length===0&&H.timedOut.length===0;return console.log(`[gemi] Shutdown ${T?"complete":"finished with errors"}.`),T?0:1}}async function j(){let z=x();process.env.ROOT_DIR=z,process.env.APP_DIR=$.join(z,"app"),A();let C=$.join(z,"app/kernel/Kernel.ts"),{default:E}=await import(C);if(typeof E!=="function")return console.error(`[gemi] ${C} has no default export to boot the worker from.`),1;let F=new E;F.boot();let G=new O(F);I(()=>G.stop());try{await G.start()}catch(H){if(!(H instanceof L))throw H;return console.error(H.message),1}return}j().then((z)=>{if(z!==void 0)process.exit(z)},(z)=>{console.error("[gemi] The queue worker failed to start:",z),process.exit(1)});
3
3
 
4
- //# debugId=97CBEFE9309FE4A164756E2164756E21
4
+ //# debugId=9190EEBF7358B17564756E2164756E21
@@ -7,6 +7,6 @@
7
7
  "import type { Application, ShutdownReport } from \"../../foundation/Application\";\nimport {\n heldWork,\n heldWorkSettled,\n markShuttingDown,\n shutdownSettings,\n type ShutdownSettings,\n} from \"../../server/shutdown\";\nimport { memoryBroadcastInWorker } from \"../broadcast/workerWarning\";\nimport { QueueManager } from \"./QueueManager\";\n\n/** The part of a `Kernel` a worker drives. */\nexport type WorkerKernel = {\n readonly app: Application;\n waitForBoot(): Promise<void>;\n shutdown(options?: { timeoutMs?: number }): Promise<ShutdownReport>;\n};\n\n/**\n * A worker that was told to start in an application it cannot claim for. The\n * message is written for the operator reading the deploy's logs.\n */\nexport class QueueWorkerRefused extends Error {\n name = \"QueueWorkerRefused\";\n}\n\n/**\n * The process `gemi queue:work` runs: the application booted as a server boots\n * it, claiming from the queue, and no `Bun.serve`. It exists so job capacity\n * can be scaled apart from request traffic, which needs a driver both kinds of\n * process can reach; see `start` for why the memory driver is refused.\n *\n * The caller marks the process as a worker (`markQueueWorker`) before the\n * kernel registers, so every claim rule that asks `claimsInThisProcess` sees a\n * process that claims, whatever `GEMI_QUEUE_CLAIM` says.\n */\nexport class QueueWorker {\n private stopping: Promise<number> | undefined;\n private keepAlive: ReturnType<typeof setInterval> | undefined;\n private readonly settings: ShutdownSettings;\n\n /**\n * `settings` default to the `GEMI_SHUTDOWN_*` variables, read here rather\n * than at the signal so a bad value is warned about while the deploy is\n * being watched, as `Server.start` does.\n */\n constructor(\n private readonly kernel: WorkerKernel,\n settings: Partial<ShutdownSettings> = {},\n ) {\n this.settings = { ...shutdownSettings(), ...settings };\n }\n\n /**\n * Boots the application and starts claiming. Rejects with\n * `QueueWorkerRefused` when the application has no queue, or its queue uses\n * the memory driver.\n *\n * Refused rather than warned about, because a memory worker can never do\n * anything: its jobs live in a `Map` in the process that dispatched them,\n * so a worker's is always empty. Left running, it looks like a healthy\n * deploy — a process up, no errors — that runs nothing, and scaling it out\n * adds no capacity. An exit the platform reports as a crash loop is a form\n * of the mistake someone will see.\n */\n async start(): Promise<void> {\n await this.kernel.waitForBoot();\n // A signal during the boot has already drained and cleared the handle\n // below. Going on would start the loop again and arm a handle nothing\n // clears, holding open a worker that has finished shutting down.\n if (this.stopping) return;\n\n const application = this.kernel.app;\n // `bound`, not `make` in a try: an application built without the queue\n // provider is a configuration to name, not an unbound-token stack trace.\n if (!application.bound(QueueManager)) {\n throw new QueueWorkerRefused(\n \"[gemi] `gemi queue:work` has no queue to claim from: this application \" +\n \"does not register QueueServiceProvider.\",\n );\n }\n const queue = application.make(QueueManager);\n if (!queue.durable) {\n throw new QueueWorkerRefused(\n \"[gemi] `gemi queue:work` refuses to start: the queue uses the memory \" +\n \"driver, which keeps each job in the process that dispatched it, so \" +\n 'a worker never sees one. Set `driver: \"database\"` (or another driver ' +\n \"every process can reach) in app/config/queue.ts, or run jobs in the \" +\n \"server and drop the worker.\",\n );\n }\n\n // Idempotent: a production boot with a durable driver has already started\n // it (`startClaimingIfServing`). Development has not, and a worker claims\n // in either.\n queue.start();\n // The queue's poll timer is unref'd, so that a script's queue does not\n // hold it open; here the queue is the process, and without a handle of its\n // own an idle worker would exit 0 as soon as it booted.\n this.keepAlive = setInterval(() => {}, 1 << 30);\n console.log(\n `[gemi] Queue worker started: claiming up to ${queue.config.concurrency} job(s) at a time.`,\n );\n const broadcastWarning = memoryBroadcastInWorker(application);\n if (broadcastWarning) console.warn(broadcastWarning);\n }\n\n /**\n * Stops claiming, waits for the running jobs, runs every provider's\n * `shutdown()`, and resolves with the exit code: 0 when no job was left\n * running and every provider finished in time, 1 otherwise. Idempotent.\n *\n * `gemi start`'s drain, with the jobs where the requests were:\n * `isShuttingDown()` turns true, which stops a durable queue claiming;\n * running jobs get `timeoutMs` (`GEMI_SHUTDOWN_TIMEOUT`), which a server\n * spends on requests; then `Application.shutdown` gets `providerTimeoutMs`,\n * and in it the queue provider waits for whatever is still running and\n * names it. The two budgets add up as they do for a server, so a worker\n * fits the same grace period. `delayMs` is not waited: it is for a load\n * balancer, and nothing routes to a worker.\n */\n stop(settings: Partial<ShutdownSettings> = {}): Promise<number> {\n this.stopping ??= this.drain({ ...this.settings, ...settings });\n return this.stopping;\n }\n\n private async drain(settings: ShutdownSettings): Promise<number> {\n const deadline = Date.now() + settings.timeoutMs;\n markShuttingDown();\n const application = this.kernel.app;\n // Resolving the manager now would build a driver only to stop it, which\n // is what a signal during the boot, before the provider resolved it, finds.\n const queue = application.resolved(QueueManager) ? application.make(QueueManager) : undefined;\n if (queue) {\n console.log(\n `[gemi] Shutting down: waiting for ${queue.running} running job(s) ` +\n `(up to ${settings.timeoutMs / 1000}s).`,\n );\n await queue.drain(settings.timeoutMs);\n }\n // Work held with `holdShutdown` (#1210) gets what is left of the same budget.\n let held = heldWork() === 0;\n if (!held) {\n const remaining = deadline - Date.now();\n held =\n remaining > 0 &&\n (await Promise.race([\n heldWorkSettled().then(() => true),\n new Promise<false>((resolve) => setTimeout(() => resolve(false), remaining)),\n ]));\n if (!held) {\n console.error(\n `[gemi] Shutdown grace period elapsed with ${heldWork()} held background task(s) still running; abandoning them.`,\n );\n }\n }\n\n const report = await this.kernel.shutdown({ timeoutMs: settings.providerTimeoutMs });\n clearInterval(this.keepAlive);\n const clean =\n held && (queue?.running ?? 0) === 0 && report.failed.length === 0 && report.timedOut.length === 0;\n console.log(`[gemi] Shutdown ${clean ? \"complete\" : \"finished with errors\"}.`);\n return clean ? 0 : 1;\n }\n}\n"
8
8
  ],
9
9
  "mappings": ";gdAYA,kBCDO,OAAS,DAAuB,DAAC,AAAyC,DAC/E,CAAI,DAAC,AAAY,KAAO,IAAI,gBAAgB,EAAG,OAAO,KACtD,IAAM,EAAS,EAAY,OAAO,IAAqB,YAAa,CAAC,CAAC,EAAE,OAGxE,GAAI,EADF,IAAW,QAAa,IAAW,UAAY,aAAkB,GACtD,OAAO,KACpB,MACE,uNCIG,MAAM,UAA2B,KAAM,CAC5C,KAAO,oBACT,CAYO,MAAM,CAAY,CAWJ,OAVX,SACA,UACS,SAOjB,WAAW,CACQ,EACjB,EAAsC,CAAC,EACvC,CAFiB,cAGjB,KAAK,SAAW,IAAK,EAAiB,KAAM,CAAS,OAejD,MAAK,EAAkB,CAK3B,GAJA,MAAM,KAAK,OAAO,YAAY,EAI1B,KAAK,SAAU,OAEnB,IAAM,EAAc,KAAK,OAAO,IAGhC,GAAI,CAAC,EAAY,MAAM,CAAY,EACjC,MAAM,IAAI,EACR,+GAEF,EAEF,IAAM,EAAQ,EAAY,KAAK,CAAY,EAC3C,GAAI,CAAC,EAAM,QACT,MAAM,IAAI,EACR,8SAKF,EAMF,EAAM,MAAM,EAIZ,KAAK,UAAY,YAAY,IAAM,GAAI,UAAO,EAC9C,QAAQ,IACN,+CAA+C,EAAM,OAAO,+BAC9D,EACA,IAAM,EAAmB,EAAwB,CAAW,EAC5D,GAAI,EAAkB,QAAQ,KAAK,CAAgB,EAiBrD,IAAI,CAAC,EAAsC,CAAC,EAAoB,CAE9D,OADA,KAAK,WAAa,KAAK,MAAM,IAAK,KAAK,YAAa,CAAS,CAAC,EACvD,KAAK,cAGA,MAAK,CAAC,EAA6C,CAC/D,IAAM,EAAW,KAAK,IAAI,EAAI,EAAS,UACvC,EAAiB,EACjB,IAAM,EAAc,KAAK,OAAO,IAG1B,EAAQ,EAAY,SAAS,CAAY,EAAI,EAAY,KAAK,CAAY,EAAI,OACpF,GAAI,EACF,QAAQ,IACN,qCAAqC,EAAM,iCAC/B,EAAS,UAAY,SACnC,EACA,MAAM,EAAM,MAAM,EAAS,SAAS,EAGtC,IAAI,EAAO,EAAS,IAAM,EAC1B,GAAI,CAAC,EAAM,CACT,IAAM,EAAY,EAAW,KAAK,IAAI,EAOtC,GANA,EACE,EAAY,GACX,MAAM,QAAQ,KAAK,CAClB,EAAgB,EAAE,KAAK,IAAM,EAAI,EACjC,IAAI,QAAe,CAAC,IAAY,WAAW,IAAM,EAAQ,EAAK,EAAG,CAAS,CAAC,CAC7E,CAAC,EACC,CAAC,EACH,QAAQ,MACN,6CAA6C,EAAS,2DACxD,EAIJ,IAAM,EAAS,MAAM,KAAK,OAAO,SAAS,CAAE,UAAW,EAAS,iBAAkB,CAAC,EACnF,cAAc,KAAK,SAAS,EAC5B,IAAM,EACJ,IAAS,GAAO,SAAW,KAAO,GAAK,EAAO,OAAO,SAAW,GAAK,EAAO,SAAS,SAAW,EAElG,OADA,QAAQ,IAAI,mBAAmB,EAAQ,WAAa,yBAAyB,EACtE,EAAQ,EAAI,EAEvB,CFjJA,eAAe,CAAI,EAAgC,CACjD,IAAM,EAAU,EAAY,EAI5B,QAAQ,IAAI,SAAW,EACvB,QAAQ,IAAI,QAAU,EAAK,KAAK,EAAS,KAAK,EAE9C,EAAgB,EAEhB,IAAM,EAAa,EAAK,KAAK,EAAS,sBAAsB,GACpD,QAAS,GAAY,MAAa,UAG1C,GAAI,OAAO,IAAW,WAEpB,OADA,QAAQ,MAAM,UAAU,kDAA2D,EAC5E,EAET,IAAM,EAAS,IAAI,EACnB,EAAO,KAAK,EAEZ,IAAM,EAAS,IAAI,EAAY,CAAM,EAKrC,EAAuB,IAAM,EAAO,KAAK,CAAC,EAE1C,GAAI,CACF,MAAM,EAAO,MAAM,EACnB,MAAO,EAAO,CACd,GAAI,EAAE,aAAiB,GAAqB,MAAM,EAElD,OADA,QAAQ,MAAM,EAAM,OAAO,EACpB,EAGT,OAGF,EAAK,EAAE,KACL,CAAC,IAAS,CACR,GAAI,IAAS,OAAW,QAAQ,KAAK,CAAI,GAE3C,CAAC,IAAU,CACT,QAAQ,MAAM,2CAA4C,CAAK,EAC/D,QAAQ,KAAK,CAAC,EAElB",
10
- "debugId": "97CBEFE9309FE4A164756E2164756E21",
10
+ "debugId": "9190EEBF7358B17564756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import"../chunk-c80xrwep.js";import M from"path";import{writeFileSync as Q}from"fs";var L=new Set(["FILE","REDIRECT"]);function H(j){return j.run(()=>{let x=[];for(let{group:z,view:D}of j.domains().viewGroups())for(let[G,B]of Object.entries(D.flatViewRoutes)){let C=D.routeManifest[G]??B.segments.map((K)=>K.viewPath);if(C.length===0||L.has(C.at(-1)))continue;x.push({path:G,group:z,views:C,...B.static?{static:{...B.static.layout?{layout:B.static.layout}:{},...B.static.navigation?{navigation:!0}:{}}}:{}})}return x})}var J=process.argv[2];async function U(){if(!J)throw Error("usage: route-table <out.json>");let j=M.resolve(process.cwd(),"app/kernel/Kernel.ts"),x=await import(j);if(typeof x.default!=="function")throw Error(`${j} has no default export (the Kernel subclass).`);let z=new x.default;z.boot();try{Q(J,JSON.stringify(H(z)))}finally{z.destroy()}}U().then(()=>process.exit(0),(j)=>{console.error(j?.stack??String(j)),process.exit(1)});
2
+ import"../chunk-0z8h6t7k.js";import M from"path";import{writeFileSync as Q}from"fs";var L=new Set(["FILE","REDIRECT"]);function H(j){return j.run(()=>{let x=[];for(let{group:z,view:D}of j.domains().viewGroups())for(let[G,B]of Object.entries(D.flatViewRoutes)){let C=D.routeManifest[G]??B.segments.map((K)=>K.viewPath);if(C.length===0||L.has(C.at(-1)))continue;x.push({path:G,group:z,views:C,...B.static?{static:{...B.static.layout?{layout:B.static.layout}:{},...B.static.navigation?{navigation:!0}:{}}}:{}})}return x})}var J=process.argv[2];async function U(){if(!J)throw Error("usage: route-table <out.json>");let j=M.resolve(process.cwd(),"app/kernel/Kernel.ts"),x=await import(j);if(typeof x.default!=="function")throw Error(`${j} has no default export (the Kernel subclass).`);let z=new x.default;z.boot();try{Q(J,JSON.stringify(H(z)))}finally{z.destroy()}}U().then(()=>process.exit(0),(j)=>{console.error(j?.stack??String(j)),process.exit(1)});
3
3
 
4
4
  //# debugId=05EB0087C5A2060D64756E2164756E21
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Me as Y}from"../chunk-5399t8zm.js";import{Zk as M}from"../chunk-cgjdxxwy.js";import{em as P,gm as R}from"../chunk-mj857ksa.js";import"../chunk-gg97wgy0.js";import{Am as Q,Bm as U,Cm as V,Dm as W}from"../chunk-5yfdrbwv.js";import"../chunk-c80xrwep.js";class S{static token;async boot(){}onShutdown(x){}static inject(){if(!this.token)throw Error(`Service [${this.name}] does not declare a \`static token\`, so the container has no key to resolve it by.`);try{return R(this)}catch(x){throw Error(`Could not inject [${this.name}]. Services are constructed when the kernel boots, so `+"inject() only works from code that runs after that \u2014 a constructor default or a method "+`body, never module top level. Check that [${this.name}] is listed in \`services\` on your Kernel.`,{cause:x})}}static with(x){let f=new this;for(let[C,g]of Object.entries(x))if(g!==void 0)f[C]=g;return f}}import{readdir as z}from"fs/promises";import{join as B,parse as j}from"path";var H=[".ts",".tsx",".js",".mjs",".jsx"];function J(x={}){let f={};for(let[C,g]of Object.entries(x))f[C]=q(g);return new P(f)}async function L(x,f=new P){let C=[];try{C=await z(x)}catch(D){return f}let g=C.filter((D)=>{let{ext:v,name:F}=j(D);return H.includes(v)&&!F.startsWith(".")}).sort();for(let D of g){let{name:v}=j(D),F=await import(B(x,D));f.set(v,q(F))}return f}function q(x){if(x&&typeof x==="object"&&"default"in x)return x.default;return x}export{M as withDefaults,Q as sourceFiles,W as projectRoot,L as loadConfigFrom,V as discoverClasses,J as createConfigRepository,Y as ServiceProvider,S as Service,P as Repository,U as DiscoveryError};
2
+ import{Ne as Y}from"../chunk-5cf59esb.js";import{_k as M}from"../chunk-zbxvyanj.js";import{fm as P,hm as R}from"../chunk-kd6z1t9z.js";import"../chunk-3pfrqzw8.js";import{Bm as Q,Cm as U,Dm as V,Em as W}from"../chunk-shn9t4vg.js";import"../chunk-0z8h6t7k.js";class S{static token;async boot(){}onShutdown(x){}static inject(){if(!this.token)throw Error(`Service [${this.name}] does not declare a \`static token\`, so the container has no key to resolve it by.`);try{return R(this)}catch(x){throw Error(`Could not inject [${this.name}]. Services are constructed when the kernel boots, so `+"inject() only works from code that runs after that \u2014 a constructor default or a method "+`body, never module top level. Check that [${this.name}] is listed in \`services\` on your Kernel.`,{cause:x})}}static with(x){let f=new this;for(let[C,g]of Object.entries(x))if(g!==void 0)f[C]=g;return f}}import{readdir as z}from"fs/promises";import{join as B,parse as j}from"path";var H=[".ts",".tsx",".js",".mjs",".jsx"];function J(x={}){let f={};for(let[C,g]of Object.entries(x))f[C]=q(g);return new P(f)}async function L(x,f=new P){let C=[];try{C=await z(x)}catch(D){return f}let g=C.filter((D)=>{let{ext:v,name:F}=j(D);return H.includes(v)&&!F.startsWith(".")}).sort();for(let D of g){let{name:v}=j(D),F=await import(B(x,D));f.set(v,q(F))}return f}function q(x){if(x&&typeof x==="object"&&"default"in x)return x.default;return x}export{M as withDefaults,Q as sourceFiles,W as projectRoot,L as loadConfigFrom,V as discoverClasses,J as createConfigRepository,Y as ServiceProvider,S as Service,P as Repository,U as DiscoveryError};
3
3
 
4
- //# debugId=509562A3FE17203B64756E2164756E21
4
+ //# debugId=E32487B046A7BE7064756E2164756E21
@@ -6,6 +6,6 @@
6
6
  "import { readdir } from \"node:fs/promises\";\nimport { join, parse } from \"node:path\";\n\nimport { Repository } from \"./Repository\";\n\nconst CONFIG_EXTENSIONS = [\".ts\", \".tsx\", \".js\", \".mjs\", \".jsx\"];\n\n// Builds a Repository from an already-imported map of config modules. The map\n// key becomes the top-level config key, so `{ mail: mailModule }` is readable\n// as `config.get(\"mail.driver\")`. Each entry may be either the module namespace\n// (its `default` export is unwrapped) or the config object itself.\nexport function createConfigRepository(\n modules: Record<string, any> = {},\n): Repository {\n const items: Record<string, any> = {};\n\n for (const [key, mod] of Object.entries(modules)) {\n items[key] = unwrap(mod);\n }\n\n return new Repository(items);\n}\n\n// Reads every config module in an app's `app/config` directory into a\n// Repository. The file's basename is the top-level key: `app/config/mail.ts`\n// populates `mail.*`. A missing directory yields an empty Repository so apps\n// that declare no config still boot.\nexport async function loadConfigFrom(\n directory: string,\n repository = new Repository(),\n): Promise<Repository> {\n let entries: string[] = [];\n\n try {\n entries = await readdir(directory);\n } catch (err) {\n return repository;\n }\n\n const files = entries\n .filter((entry) => {\n const { ext, name } = parse(entry);\n return CONFIG_EXTENSIONS.includes(ext) && !name.startsWith(\".\");\n })\n .sort();\n\n for (const file of files) {\n const { name } = parse(file);\n const mod = await import(join(directory, file));\n repository.set(name, unwrap(mod));\n }\n\n return repository;\n}\n\nfunction unwrap(mod: any) {\n if (mod && typeof mod === \"object\" && \"default\" in mod) {\n return mod.default;\n }\n return mod;\n}\n"
7
7
  ],
8
8
  "mappings": ";2RAiCO,CAAe,JAAQ,EAOrB,OAMD,AAAI,EAAkB,EAmB5B,UAAU,CAAC,EAEkD,QAmBtD,OAAS,EAKX,CACH,GAAI,CAAC,KAAK,MACR,MAAU,MACR,YAAY,KAAK,0FACnB,EAGF,GAAI,CACF,OAAO,EAAI,IAAuB,EAClC,MAAO,EAAO,CACd,MAAU,MACR,qBAAqB,KAAK,6DACxB,+FACA,6CAA6C,KAAK,kDAEpD,CAAE,OAAM,CACV,SAoBG,KAAuB,CAAoB,EAA0B,CAC1E,IAAM,EAAW,IAAI,KACrB,QAAY,EAAK,KAAU,OAAO,QAAQ,CAAS,EACjD,GAAI,IAAU,OAAW,EAAS,GAAO,EAE3C,OAAO,EAEX,CCtIA,kBAAS,oBACT,eAAS,WAAM,aAIf,IAAM,EAAoB,CAAC,MAAO,OAAQ,MAAO,OAAQ,MAAM,EAMxD,SAAS,CAAsB,CACpC,EAA+B,CAAC,EACpB,CACZ,IAAM,EAA6B,CAAC,EAEpC,QAAY,EAAK,KAAQ,OAAO,QAAQ,CAAO,EAC7C,EAAM,GAAO,EAAO,CAAG,EAGzB,OAAO,IAAI,EAAW,CAAK,EAO7B,eAAsB,CAAc,CAClC,EACA,EAAa,IAAI,EACI,CACrB,IAAI,EAAoB,CAAC,EAEzB,GAAI,CACF,EAAU,MAAM,EAAQ,CAAS,EACjC,MAAO,EAAK,CACZ,OAAO,EAGT,IAAM,EAAQ,EACX,OAAO,CAAC,IAAU,CACjB,IAAQ,MAAK,QAAS,EAAM,CAAK,EACjC,OAAO,EAAkB,SAAS,CAAG,GAAK,CAAC,EAAK,WAAW,GAAG,EAC/D,EACA,KAAK,EAER,QAAW,KAAQ,EAAO,CACxB,IAAQ,QAAS,EAAM,CAAI,EACrB,EAAM,MAAa,SAAK,EAAW,CAAI,GAC7C,EAAW,IAAI,EAAM,EAAO,CAAG,CAAC,EAGlC,OAAO,EAGT,SAAS,CAAM,CAAC,EAAU,CACxB,GAAI,GAAO,OAAO,IAAQ,UAAY,YAAa,EACjD,OAAO,EAAI,QAEb,OAAO",
9
- "debugId": "509562A3FE17203B64756E2164756E21",
9
+ "debugId": "E32487B046A7BE7064756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{ua as B,va as D}from"../chunk-xbxdhmh4.js";import"../chunk-s7p6w1p2.js";import"../chunk-18aw52vs.js";import{Pa as J}from"../chunk-qt80d3fw.js";import"../chunk-nx86gzt1.js";import"../chunk-c80xrwep.js";function N(){return{name:"gemi-custom-request",enforce:"pre",async transform(G,H){let j=H.split("?",1)[0];if(j.includes("/node_modules/")||!B.test(j))return null;return{code:await D(G),map:null}}}}export{N as gemiRequestPlugin,J as gemiIslandPlugin};
2
+ import{ua as B,va as D}from"../chunk-g7vyn179.js";import"../chunk-yjshg4e5.js";import"../chunk-7mg2ash8.js";import{Pa as J}from"../chunk-w1my1q4q.js";import"../chunk-y9fye7az.js";import"../chunk-0z8h6t7k.js";function N(){return{name:"gemi-custom-request",enforce:"pre",async transform(G,H){let j=H.split("?",1)[0];if(j.includes("/node_modules/")||!B.test(j))return null;return{code:await D(G),map:null}}}}export{N as gemiRequestPlugin,J as gemiIslandPlugin};
3
3
 
4
4
  //# debugId=54630B516034F10064756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemi",
3
- "version": "0.214.0",
3
+ "version": "0.216.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Enes Tufekci <enes@gemijs.dev>",
@@ -1,71 +0,0 @@
1
- // @bun
2
- import{ok as O}from"./chunk-y54kz6h6.js";import{Yk as S}from"./chunk-mcqzgyvf.js";import{Il as E}from"./chunk-bvm2w6ha.js";import{gm as U}from"./chunk-mj857ksa.js";class F{rows=new Map;async find(j,G){for(let Q of this.rows.values())if(Q.userId===j&&Q.provider===G)return{...Q};return null}async list(j){return[...this.rows.values()].filter((G)=>G.userId===j).map((G)=>({...G}))}async save(j,G,Q){let V=await this.find(j,G),W=new Date,Y={id:V?.id??Bun.randomUUIDv7(),userId:j,provider:G,...P(Q),needsReconnect:!1,revision:(V?.revision??0)+1,createdAt:V?.createdAt??W,updatedAt:W};return this.rows.set(Y.id,Y),{...Y}}async updateTokens(j,G,Q){let V=this.rows.get(j);if(!V||V.revision!==G)return null;let W=P(Q);W.providerAccountId??=V.providerAccountId;let Y={...V,...W,needsReconnect:!1,revision:G+1,updatedAt:new Date};return this.rows.set(j,Y),{...Y}}async markNeedsReconnect(j){let G=this.rows.get(j);if(G)this.rows.set(j,{...G,needsReconnect:!0,updatedAt:new Date})}async delete(j){this.rows.delete(j)}}class L{encrypter;table;sql;dialect;constructor(j,G,Q={}){this.encrypter=G;let V=Q.table??"gemi_oauth_connections";if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(V))throw Error(`The connections table name "${V}" is not a plain identifier.`);this.table=V,this.sql=j.sql,this.dialect=j.dialect}async createTable(){for(let j of q(this.dialect,this.table))await this.sql.unsafe(j)}async find(j,G){let Q=this.sql,V=await Q`
3
- SELECT * FROM ${this.name(Q)} WHERE user_id = ${j} AND provider = ${G}
4
- `;return V[0]?this.decode(V[0]):null}async list(j){let G=this.sql;return(await G`
5
- SELECT * FROM ${this.name(G)} WHERE user_id = ${j} ORDER BY provider
6
- `).map((V)=>this.decode(V))}async save(j,G,Q){let V=this.sql,W=this.encode(Q),Y=Date.now(),Z=async()=>R(await V`
7
- UPDATE ${this.name(V)}
8
- SET provider_account_id = ${W.providerAccountId}, scopes = ${W.scopes},
9
- access_token = ${W.accessToken}, refresh_token = ${W.refreshToken},
10
- token_type = ${W.tokenType}, expires_at = ${W.expiresAt},
11
- needs_reconnect = 0, revision = revision + 1, updated_at = ${Y}
12
- WHERE user_id = ${j} AND provider = ${G}
13
- `);if(await Z()===0)try{await V`
14
- INSERT INTO ${this.name(V)} (id, user_id, provider, provider_account_id, scopes,
15
- access_token, refresh_token, token_type, expires_at, needs_reconnect, revision,
16
- created_at, updated_at)
17
- VALUES (${Bun.randomUUIDv7()}, ${j}, ${G}, ${W.providerAccountId},
18
- ${W.scopes}, ${W.accessToken}, ${W.refreshToken}, ${W.tokenType},
19
- ${W.expiresAt}, 0, 1, ${Y}, ${Y})
20
- `}catch(J){if(await Z()===0)throw J}let B=await this.find(j,G);if(!B)throw Error("The OAuth connection vanished while it was being saved.");return B}async updateTokens(j,G,Q){let V=this.sql,W=this.encode(Q),Y=await V`
21
- UPDATE ${this.name(V)}
22
- SET provider_account_id = COALESCE(${W.providerAccountId}, provider_account_id),
23
- scopes = ${W.scopes}, access_token = ${W.accessToken},
24
- refresh_token = ${W.refreshToken}, token_type = ${W.tokenType},
25
- expires_at = ${W.expiresAt}, needs_reconnect = 0, revision = revision + 1,
26
- updated_at = ${Date.now()}
27
- WHERE id = ${j} AND revision = ${G}
28
- `;if(R(Y)===0)return null;let Z=await V`SELECT * FROM ${this.name(V)} WHERE id = ${j}`;return Z[0]?this.decode(Z[0]):null}async markNeedsReconnect(j){let G=this.sql;await G`UPDATE ${this.name(G)} SET needs_reconnect = 1, updated_at = ${Date.now()} WHERE id = ${j}`}async delete(j){let G=this.sql;await G`DELETE FROM ${this.name(G)} WHERE id = ${j}`}async rotateEncryption(j={}){let G=this.sql,Q=this.encrypter(),V=await G`
29
- SELECT id, access_token, refresh_token, revision FROM ${this.name(G)} ORDER BY id
30
- `,W=0;for(let Y of V){let Z=(J)=>typeof J==="string"&&Q.needsReencryption(J);if(!Z(Y.access_token)&&!Z(Y.refresh_token))continue;if(W+=1,j.dryRun)continue;let B=(J)=>J===null?null:Q.encrypt(Q.decrypt(J));await G`
31
- UPDATE ${this.name(G)}
32
- SET access_token = ${B(Y.access_token)}, refresh_token = ${B(Y.refresh_token)},
33
- revision = revision + 1
34
- WHERE id = ${Y.id} AND revision = ${Number(Y.revision)}
35
- `}return{scanned:V.length,rotated:W}}encode(j){let G=this.encrypter();return{providerAccountId:j.providerAccountId,scopes:j.scopes.join(" "),accessToken:G.encrypt(j.accessToken),refreshToken:j.refreshToken===null?null:G.encrypt(j.refreshToken),tokenType:j.tokenType,expiresAt:j.expiresAt===null?null:j.expiresAt.getTime()}}decode(j){let G=this.encrypter();return{id:String(j.id),userId:String(j.user_id),provider:String(j.provider),providerAccountId:j.provider_account_id===null?null:String(j.provider_account_id),scopes:String(j.scopes??"").split(" ").filter(Boolean),accessToken:G.decrypt(String(j.access_token)),refreshToken:j.refresh_token===null?null:G.decrypt(String(j.refresh_token)),tokenType:j.token_type===null?null:String(j.token_type),expiresAt:j.expires_at===null?null:new Date(Number(j.expires_at)),needsReconnect:Number(j.needs_reconnect)===1,revision:Number(j.revision),createdAt:new Date(Number(j.created_at)),updatedAt:new Date(Number(j.updated_at))}}get mysql(){return this.dialect==="mysql"||this.dialect==="mariadb"}name(j){return j.unsafe(this.mysql?`\`${this.table}\``:`"${this.table}"`)}}function P(j){return{providerAccountId:j.providerAccountId,scopes:[...j.scopes],accessToken:j.accessToken,refreshToken:j.refreshToken,tokenType:j.tokenType,expiresAt:j.expiresAt}}function R(j){let G=j;return Math.max(Number(G.count??0),Number(G.affectedRows??0))}function q(j,G){if(j==="mysql"||j==="mariadb")return[`CREATE TABLE IF NOT EXISTS \`${G}\` (
36
- \`id\` VARCHAR(191) NOT NULL,
37
- \`user_id\` VARCHAR(191) NOT NULL,
38
- \`provider\` VARCHAR(191) NOT NULL,
39
- \`provider_account_id\` VARCHAR(191) NULL,
40
- \`scopes\` TEXT NOT NULL,
41
- \`access_token\` TEXT NOT NULL,
42
- \`refresh_token\` TEXT NULL,
43
- \`token_type\` VARCHAR(191) NULL,
44
- \`expires_at\` BIGINT NULL,
45
- \`needs_reconnect\` INTEGER NOT NULL DEFAULT 0,
46
- \`revision\` BIGINT NOT NULL DEFAULT 0,
47
- \`created_at\` BIGINT NOT NULL,
48
- \`updated_at\` BIGINT NOT NULL,
49
-
50
- UNIQUE INDEX \`${G}_user_id_provider_key\`(\`user_id\`, \`provider\`),
51
- PRIMARY KEY (\`id\`)
52
- ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci`];let Q=j==="sqlite"?'"id" TEXT NOT NULL PRIMARY KEY,':'"id" TEXT NOT NULL,',V=j==="sqlite"?"":`,
53
-
54
- CONSTRAINT "${G}_pkey" PRIMARY KEY ("id")`;return[`CREATE TABLE IF NOT EXISTS "${G}" (
55
- ${Q}
56
- "user_id" TEXT NOT NULL,
57
- "provider" TEXT NOT NULL,
58
- "provider_account_id" TEXT,
59
- "scopes" TEXT NOT NULL,
60
- "access_token" TEXT NOT NULL,
61
- "refresh_token" TEXT,
62
- "token_type" TEXT,
63
- "expires_at" BIGINT,
64
- "needs_reconnect" INTEGER NOT NULL DEFAULT 0,
65
- "revision" BIGINT NOT NULL DEFAULT 0,
66
- "created_at" BIGINT NOT NULL,
67
- "updated_at" BIGINT NOT NULL${V}
68
- )`,`CREATE UNIQUE INDEX IF NOT EXISTS "${G}_user_id_provider_key" ON "${G}"("user_id", "provider")`]}class X extends Error{code;status;providerError;constructor(j,G,Q={}){super(G,Q.cause!==void 0?{cause:Q.cause}:void 0);this.code=j;this.name="OAuthConnectionError",this.status=Q.status,this.providerError=Q.providerError}}class K extends X{provider;constructor(j,G={}){super("reconnect_required",`The ${j} connection needs to be reconnected: its tokens were refused and could not be refreshed.`,G);this.provider=j;this.name="OAuthReconnectRequiredError"}}class C{config;constructor(j){for(let G of["authorizeUrl","tokenUrl"])_(G,j[G]);for(let G of["refreshUrl","revokeUrl"])if(j[G]!==void 0)_(G,j[G]);if(j.apiBaseUrl===void 0||j.apiBaseUrl===null||j.apiBaseUrl==="")throw Error(`OAuthConnectionProvider: apiBaseUrl is required. Set it to the provider's API origin (e.g. apiBaseUrl: "https://api.figma.com"); connection.fetch only sends the token there.`);_("apiBaseUrl",j.apiBaseUrl),this.config={scopeSeparator:" ",clientAuth:"body",pkce:!0,authorizationParams:{},refreshLeewaySeconds:60,multiple:!1,tokenPlacement:"header",...j,refreshGrantType:j.refreshGrantType??"refresh_token"}}async isTokenRejected(j){let G=this.config.isTokenRejected;if(!G)return j.status===401;return await G(j)}authorizationUrl(j){let G=new URL(this.config.authorizeUrl),Q={...this.config.authorizationParams,response_type:"code",client_id:this.config.clientId,redirect_uri:j.redirectUri,scope:this.config.scopes.join(this.config.scopeSeparator),state:j.state};if(this.config.pkce)Q.code_challenge=j.codeChallenge,Q.code_challenge_method="S256";for(let[V,W]of Object.entries(Q))G.searchParams.set(V,W);return G.toString()}exchangeCode(j){let G=new URLSearchParams({grant_type:"authorization_code",code:j.code,redirect_uri:j.redirectUri});if(this.config.pkce)G.set("code_verifier",j.codeVerifier);return this.tokenRequest(this.config.tokenUrl,G,{scopes:this.config.scopes,refreshToken:null,phase:"exchange"})}refresh(j,G){let Q=new URLSearchParams,V=this.config.refreshGrantType;if(V!==!1&&V!=="")Q.set("grant_type",V);return Q.set("refresh_token",j),this.tokenRequest(this.config.refreshUrl??this.config.tokenUrl,Q,{scopes:G,refreshToken:j,phase:"refresh"})}async revoke(j,G){if(!this.config.revokeUrl)throw new X("revoke_unsupported","This provider has no revokeUrl configured. Use disconnect() to forget the tokens locally.");let Q=new URLSearchParams({token:j,token_type_hint:G}),V;try{V=await fetch(this.config.revokeUrl,this.post(Q))}catch(W){throw new X("revoke_failed","The revocation request failed.",{cause:W})}if(!V.ok)throw new X("revoke_failed",`The provider refused the revocation (HTTP ${V.status}).`,{status:V.status})}post(j){let G={"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"};if(this.config.clientAuth==="basic"){let Q=`${encodeURIComponent(this.config.clientId)}:${encodeURIComponent(this.config.clientSecret)}`;G.Authorization=`Basic ${Buffer.from(Q).toString("base64")}`}else j.set("client_id",this.config.clientId),j.set("client_secret",this.config.clientSecret);return{method:"POST",headers:G,body:j.toString(),redirect:"error"}}async tokenRequest(j,G,Q){let V=Q.phase==="exchange"?"exchange_failed":"refresh_failed",W;try{W=await fetch(j,this.post(G))}catch($){throw new X(V,"The token request failed.",{cause:$})}let Y=await W.json().catch(()=>({}));if(!W.ok||typeof Y.access_token!=="string"||Y.access_token===""){let $=typeof Y.error==="string"&&/^[a-z0-9_]{1,64}$/.test(Y.error)?Y.error:void 0;throw new X(V,`The token endpoint refused the ${Q.phase==="exchange"?"code":"refresh token"} (HTTP ${W.status}${$?`, ${$}`:""}).`,{status:W.status,providerError:$})}let Z=Number(Y.expires_in),B=typeof Y.scope==="string"?Y.scope:void 0,J=Y.user_id_string??Y.user_id??Y.account_id;return{accessToken:Y.access_token,refreshToken:typeof Y.refresh_token==="string"&&Y.refresh_token!==""?Y.refresh_token:Q.refreshToken,tokenType:typeof Y.token_type==="string"?Y.token_type:null,expiresAt:Number.isFinite(Z)&&Z>0?new Date(Date.now()+Z*1000):null,scopes:B!==void 0?B.split(/[\s,]+/).filter(Boolean):Q.scopes,providerAccountId:typeof J==="string"||typeof J==="number"?String(J):null}}}function _(j,G){let Q;try{Q=new URL(String(G))}catch{Q=void 0}if(!Q||Q.protocol!=="https:"&&!(Q.protocol==="http:"&&M(Q.hostname)))throw Error(`OAuthConnectionProvider: ${j} must be an https URL (http only for localhost), got ${JSON.stringify(G)}.`)}function M(j){return j==="localhost"||j==="127.0.0.1"||j==="[::1]"||j==="::1"}class A{options;static token="auth.connections";resolvedStore;refreshing=new Map;fakes;fakeStore;fakeRequests=[];constructor(j){this.options=j;for(let[G,Q]of Object.entries(j.providers)){if(!Q.config.multiple)continue;let V=Object.keys(j.providers).find((W)=>W.startsWith(`${G}${D}`));if(G.includes(D)||V)throw Error(`auth.connections: "${V??G}" cannot be used alongside the multiple-account provider "${G}" ("${D}" separates a provider from an account id in the store).`)}}get providers(){return this.options.providers}get store(){if(this.fakeStore)return this.fakeStore;if(!this.resolvedStore){let j=this.options.store;this.resolvedStore=typeof j==="function"?j():j??new L(U(E).connection(),()=>O())}return this.resolvedStore}provider(j){let G=this.options.providers[j];if(!G){let Q=Object.keys(this.options.providers);throw new X("unknown_provider",`No OAuth connection provider "${j}" in auth.connections`+(Q.length>0?` (configured: ${Q.join(", ")}).`:" (none are configured)."))}return G}async for(j,G,Q){let V=this.provider(G),W=N(j);if(!V.config.multiple){let Z=await this.store.find(W,G);if(!Z||Q!==void 0&&Z.providerAccountId!==Q)return null;return new z(this,Z)}if(Q!==void 0){let Z=await this.store.find(W,T(G,Q))??await this.store.find(W,G);return Z&&Z.providerAccountId===Q?new z(this,Z):null}let[Y]=(await this.list(j,G)).sort((Z,B)=>B.connectedAt.getTime()-Z.connectedAt.getTime());return Y??null}async list(j,G){if(G!==void 0)this.provider(G);return(await this.store.list(N(j))).filter((V)=>{let W=this.providerName(V.provider);return W!==null&&(G===void 0||W===G)}).map((V)=>new z(this,V))}async save(j,G,Q){let V=this.provider(G),W=N(j),{profile:Y,...Z}=Q,B={refreshToken:null,tokenType:null,expiresAt:null,providerAccountId:null,scopes:V.config.scopes,...Z};if(!V.config.multiple)return new z(this,await this.store.save(W,G,B));let J=B.providerAccountId;if(typeof J!=="string"||J==="")throw new X("missing_account_id",`"${G}" allows several accounts per user, so a connection needs the provider's account id (providerAccountId), and the token exchange did not supply one.`);let $=await this.store.save(W,T(G,J),B),H=await this.store.find(W,G);if(H&&H.providerAccountId===J)await this.store.delete(H.id);return new z(this,$)}providerName(j){let G=this.options.providers;if(Object.hasOwn(G,j))return j;let Q=j.indexOf(D);if(Q<=0)return null;let V=j.slice(0,Q);return Object.hasOwn(G,V)&&G[V].config.multiple?V:null}fake(j={}){return this.fakes=new Map(Object.entries(j)),this.fakeStore=new F,this.fakeRequests.length=0,this}restore(){this.fakes=void 0,this.fakeStore=void 0,this.fakeRequests.length=0}get faked(){return this.fakes!==void 0}async send(j,G){if(!this.fakes)return fetch(G);this.fakeRequests.push(G.clone());let Q=this.fakes.get(j);if(!Q)throw Error(`Connections.fake() has no handler for "${j}". Pass one: Connections.fake({ ${j}: (req) => ... }).`);return Q(G)}refresh(j,G="requested"){let Q=this.refreshing.get(j.id);if(Q)return Q;let V=this.withLock(j.id,()=>this.refreshOnce(j,G)).finally(()=>this.refreshing.delete(j.id));return this.refreshing.set(j.id,V),V}async refreshOnce(j,G){let Q=this.providerName(j.provider)??j.provider,V=await this.store.find(j.userId,j.provider);if(!V||V.id!==j.id)throw new K(Q);if(V.revision!==j.revision&&!V.needsReconnect)return V;if(V.needsReconnect)throw new K(Q);let W=this.provider(Q);if(this.faked)return V;let Y=W.config.refreshStrategy;if(!Y&&V.refreshToken===null)throw await this.store.markNeedsReconnect(V.id),new K(Q);let Z;try{Z=Y?await Y({accessToken:V.accessToken,refreshToken:V.refreshToken,scopes:[...V.scopes],expiresAt:V.expiresAt,issuedAt:V.updatedAt,reason:G,providerAccountId:V.providerAccountId}):await W.refresh(V.refreshToken,V.scopes)}catch($){if($ instanceof X&&$.status!==void 0&&$.status>=400&&$.status<500&&$.providerError!=="invalid_client")throw await this.store.markNeedsReconnect(V.id),new K(Q,{cause:$,status:$.status,providerError:$.providerError});throw $}if(Z===null)return V;let B=await this.store.updateTokens(V.id,V.revision,Z);if(B)return B;let J=await this.store.find(V.userId,V.provider);if(!J)throw new K(Q);return J}async withLock(j,G){let Q=U();if(this.faked||!Q.bound(S))return G();let V=await Q.make(S).run(`gemi:oauth-connection:${j}`,{ttl:30000,wait:20000},()=>G());if(!V.acquired)throw new X("refresh_failed","Timed out waiting for another refresh of this connection to finish.");return V.value}}class z{manager;record;constructor(j,G){this.manager=j;this.record=G}get provider(){return this.manager.providerName(this.record.provider)??this.record.provider}get userId(){return this.record.userId}get providerAccountId(){return this.record.providerAccountId}get scopes(){return this.record.scopes}get expiresAt(){return this.record.expiresAt}get needsReconnect(){return this.record.needsReconnect}get connectedAt(){return this.record.createdAt}get status(){if(this.record.needsReconnect)return"needs_reconnect";let j=this.record.expiresAt?.getTime();if(this.record.refreshToken===null&&j!==void 0&&j<=Date.now())return"needs_reconnect";return"connected"}connectionProvider(){return this.manager.provider(this.provider)}hasScopes(...j){return j.every((G)=>this.record.scopes.includes(G))}async fetch(j,G={}){let Q=this.resolveUrl(j),V=await this.current(),W=await this.send(Q,G,V.accessToken);if(!W.authorized||G.body instanceof ReadableStream)return W.response;if(!await this.manager.provider(this.provider).isTokenRejected(W.response))return W.response;await W.response.body?.cancel().catch(()=>{});let Z=await this.refreshFrom(V,"rejected");return(await this.send(Q,G,Z.accessToken)).response}async accessToken(){return(await this.current()).accessToken}async refresh(){await this.refreshFrom(this.record)}async revoke(){if(!this.manager.faked){let j=this.manager.provider(this.provider);if(this.record.refreshToken!==null)await j.revoke(this.record.refreshToken,"refresh_token");else await j.revoke(this.record.accessToken,"access_token")}await this.manager.store.delete(this.record.id)}async disconnect(){await this.manager.store.delete(this.record.id)}toJSON(){return{provider:this.provider,providerAccountId:this.providerAccountId,scopes:[...this.scopes],expiresAt:this.expiresAt,needsReconnect:this.needsReconnect,status:this.status,connectedAt:this.connectedAt}}[Symbol.for("nodejs.util.inspect.custom")](){return{ProviderConnection:this.toJSON()}}async current(){if(this.record.needsReconnect)throw new K(this.provider);let j=this.manager.provider(this.provider).config.refreshLeewaySeconds*1000,G=this.record.expiresAt?.getTime();if(G!==void 0&&G-Date.now()<=j)return this.refreshFrom(this.record,"expiring");return this.record}async refreshFrom(j,G="requested"){try{this.record=await this.manager.refresh(j,G)}catch(Q){if(Q instanceof K)this.record={...this.record,needsReconnect:!0};throw Q}return this.record}resolveUrl(j){let G=this.manager.provider(this.provider).config.apiBaseUrl,Q;try{Q=new URL(String(j),G)}catch{throw new X("forbidden_url",`connection.fetch was given ${JSON.stringify(String(j))}, which is not a URL.`)}if(Q.origin!==new URL(G).origin)throw new X("forbidden_url",`connection.fetch only sends the ${this.provider} token to ${new URL(G).origin} (apiBaseUrl), not to ${Q.origin}.`);if(Q.protocol!=="https:"&&!(Q.protocol==="http:"&&M(Q.hostname)))throw new X("forbidden_url",`connection.fetch only sends a token over https, not to ${Q.origin}.`);return Q}async send(j,G,Q){let V=j,W=(G.method??"GET").toUpperCase(),Y=G.body,Z=!0;if(G.redirect==="manual"||G.redirect==="error")return{response:await this.manager.send(this.provider,this.request(V,G,W,Y,Q)),authorized:Z};for(let B=0;;B++){let J=this.request(V,{...G,redirect:"manual"},W,Y,Z?Q:null),$=await this.manager.send(this.provider,J),H=$.headers.get("location");if(!b.has($.status)||H===null||B>=5)return{response:$,authorized:Z};await $.body?.cancel().catch(()=>{});let x=new URL(H,V);if(x.origin!==V.origin)Z=!1;if($.status===303||($.status===301||$.status===302)&&W==="POST")W="GET",Y=void 0;V=x}}request(j,G,Q,V,W){let Y=new Headers(G.headers),Z=new URL(j),B=this.manager.provider(this.provider).config.tokenPlacement;if(W===null)Y.delete("authorization");else if(B==="query")Z.searchParams.set("access_token",W);else Y.set("Authorization",`Bearer ${W}`);return new Request(Z,{...G,method:Q,body:V,headers:Y})}}var b=new Set([301,302,303,307,308]),D=":";function T(j,G){return`${j}${D}${G}`}function N(j){let G=typeof j==="object"&&j!==null?j.id:j;if(G===void 0||G===null||G==="")throw TypeError("An OAuth connection belongs to a user: pass the user (or its id).");return String(G)}
69
- export{F as Zj,L as _j,X as $j,K as ak,C as bk,A as ck,z as dk};
70
-
71
- //# debugId=F5FEA1DF2CFBFB6564756E2164756E21
@@ -1,11 +0,0 @@
1
- // @bun
2
- import{Nd as NQ,Td as A,Ud as s,Vd as J5,Wd as Z5,Xd as LQ,Yd as k,Zd as x,xd as e,zd as t}from"./chunk-y10tys3s.js";import{Vj as pQ}from"./chunk-xdrnzs3t.js";function WQ(Q,$,J){let Z=Q.on;if(Z===void 0)return!0;if(typeof Z!=="function")return Z.includes($.code);try{return Z($,J)===!0}catch{return!1}}var M5=4000,_5=60000;function fQ(Q){if(Q===void 0)return;let $=(J,Z)=>typeof J==="number"&&Number.isFinite(J)&&J>=Z;if(!Q||!$(Q.patienceMs,0)||Q.initialWaitMs!==void 0&&!$(Q.initialWaitMs,1)||Q.maxWaitMs!==void 0&&!$(Q.maxWaitMs,1)||Q.on!==void 0&&typeof Q.on!=="function"&&!(Array.isArray(Q.on)&&Q.on.every((J)=>typeof J==="string")))throw Error(`The provider's retry policy ${JSON.stringify(Q)} is not usable: patienceMs has to be a number of milliseconds (0 or more), initialWaitMs and maxWaitMs above 0, and on a list of error codes or a function.`)}function VQ(Q,$,J,Z,Y){let G=Q.patienceMs-Z;if(G<=0)return;let V=Q.maxWaitMs??_5,z=Q.initialWaitMs??M5,j=J!==void 0?Math.min(J,V):Math.round(Math.min(V,z*2**$)*(0.5+Y()*0.5));return Math.min(j,G)}var R5=500,yQ=20000;function I5(Q,$){if(!Q)return;let J=Q.trim();if(/^\d+(\.\d+)?$/.test(J))return Math.max(0,Number(J)*1000);let Z=Date.parse(J);if(Number.isNaN(Z))return;return Math.max(0,Z-$)}function r(Q,$){let J=Math.min(yQ,R5*2**Q);return Math.round(J*(0.5+$()*0.5))}function A5(Q){return Q===429||Q===408||Q===409||Q>=500}function E5(Q,$){return A5(Q)&&x($).retryable}function gQ(Q){return Q.reason??new DOMException("The operation was aborted.","AbortError")}function uQ(Q,$){return new Promise((J,Z)=>{let Y=setTimeout(J,Q);$?.addEventListener("abort",()=>{clearTimeout(Y),Z(gQ($))},{once:!0})})}async function KQ(Q,$,J=uQ){if(!$)return await J(Q);$.throwIfAborted();let Z;try{await Promise.race([J(Q,$),new Promise((Y,G)=>{Z=()=>G(gQ($)),$.addEventListener("abort",Z,{once:!0})})])}finally{if(Z)$.removeEventListener("abort",Z)}}async function c(Q,$,J){let Z=J.fetchImpl??((W,X)=>fetch(W,X)),Y=J.sleep??uQ,G=J.random??Math.random,V=J.now??Date.now,z=Math.max(0,J.maxRetries),j=J.startedAt??V(),K=J.retry,B=(W,X,q,F)=>{let N=V()-j;try{J.onRetry?.({attempt:X+1,maxRetries:z,error:x(q),...k(q),timedOut:F,delayMs:W,elapsedMs:N,...K?{remainingMs:Math.max(0,K.patienceMs-N-W)}:{}})}catch{}return KQ(W,J.signal,Y)},H=(W,X,q,F)=>{if(!K)return;let{status:N}=k(q);if(!WQ(K,x(q),{...N?{status:N}:{},timedOut:F}))return;return VQ(K,W-z,X,V()-j,G)};for(let W=0;;W++){J.signal?.throwIfAborted();let X=new AbortController,q=()=>X.abort(J.signal?.reason);J.signal?.addEventListener("abort",q,{once:!0});let F=!1,N=J.timeoutMs>0?setTimeout(()=>{F=!0,X.abort()},J.timeoutMs):void 0,P;try{P=await Z(Q,{...$,signal:X.signal})}catch(_){if(N!==void 0)clearTimeout(N);if(J.signal?.removeEventListener("abort",q),J.signal?.aborted)throw _;let R=F?new s(J.timeoutMs):_;if(F&&J.retryTimeouts===!1)throw R;let I=W<z?r(W,G):H(W,void 0,R,F);if(I===void 0)throw R;await B(I,W,R,F);continue}if(N!==void 0)clearTimeout(N);if(P.ok)return P;J.signal?.removeEventListener("abort",q);let O=await T5(P),L=new A(P.status,O,P.headers.get("x-request-id")??P.headers.get("request-id")??void 0,I5(P.headers.get("retry-after"),V()));if(!E5(P.status,L))throw L;let y=L.retryAfter??(P.status===429?x(L).retryAfter:void 0),v=W>=z?H(W,y,L,!1):y===void 0?r(W,G):Math.min(y,yQ);if(v===void 0)throw L;await B(v,W,L,!1)}}async function T5(Q){let $;try{$=await Q.text()}catch{return null}try{return JSON.parse($)}catch{return $}}function cQ(Q,$,J){let Z=$.idleMs>0?$.idleMs:0,Y=$.maxMs>0?$.maxMs:0;if(!Q||!Z&&!Y)return Q;let G=Y?performance.now()+Y:1/0,V=Q.getReader();return new ReadableStream({async pull(z){let j,K,B=Math.max(0,G-performance.now()),H=!Z||B<=Z,W=H?B:Z,X=new Promise((q,F)=>{j=setTimeout(()=>{K=H?J.max():J.idle(),F(K)},W)});try{let q=await Promise.race([V.read(),X]);if(q.done)z.close();else z.enqueue(q.value)}catch(q){let F=K??q;z.error(F),V.cancel(F).catch(()=>{})}finally{clearTimeout(j)}},cancel(z){return V.cancel(z)}},{highWaterMark:0})}var BQ=30000,mQ=10,dQ=7200,w5=600,k5="gpt-live-transcribe";function v5(Q){return Q.type==="transcription"}function h5(Q){if(Q.language!==void 0&&Q.languages!==void 0)throw TypeError("A transcription session takes `languages` or `language`, not both (gpt-live-transcribe reads `languages`).");for(let Y of Q.keywords??[])if(/[<>\r\n]/.test(Y))throw TypeError(`Transcription keywords must be one line without "<" or ">", got ${JSON.stringify(Y)}.`);let $={model:Q.model??k5};if(Q.prompt!==void 0)$.prompt=Q.prompt;if(Q.keywords?.length)$.keywords=Q.keywords;if(Q.languages?.length)$.languages=Q.languages;if(Q.language!==void 0)$.language=Q.language;if(Q.delay!==void 0)$.delay=Q.delay;let J={transcription:$,turn_detection:Q.turnDetection?lQ(Q.turnDetection):null};if(Q.noiseReduction!==void 0)J.noise_reduction=Q.noiseReduction&&{type:Q.noiseReduction};let Z={type:"transcription",audio:{input:J}};if(Q.logprobs)Z.include=["item.input_audio_transcription.logprobs"];return{...Z,...Q.vendor}}function b5(Q){if(!Q)return{type:"object",properties:{}};return pQ(Q)?Q.toJSONSchema():Q}function a(Q,$){if(v5(Q))return h5(Q);let J={type:"realtime"},Z=Q.model??$;if(Z)J.model=Z;if(Q.instructions!==void 0)J.instructions=Q.instructions;if(Q.outputModalities)J.output_modalities=Q.outputModalities;if(Q.maxOutputTokens!==void 0)J.max_output_tokens=Q.maxOutputTokens;if(Q.truncation!==void 0)J.truncation=Q.truncation;if(Q.tools)J.tools=Q.tools.map((V)=>({type:"function",name:V.name,...V.description?{description:V.description}:{},parameters:b5(V.parameters)}));if(Q.toolChoice!==void 0)J.tool_choice=typeof Q.toolChoice==="string"?Q.toolChoice:{type:"function",name:Q.toolChoice.name};let Y={};if(Q.turnDetection!==void 0)Y.turn_detection=Q.turnDetection&&lQ(Q.turnDetection);if(Q.transcription!==void 0)Y.transcription=Q.transcription;if(Q.noiseReduction!==void 0)Y.noise_reduction=Q.noiseReduction&&{type:Q.noiseReduction};let G={};if(Q.voice!==void 0)G.voice=Q.voice;if(Q.speed!==void 0)G.speed=Q.speed;if(Object.keys(Y).length||Object.keys(G).length)J.audio={...Object.keys(Y).length?{input:Y}:{},...Object.keys(G).length?{output:G}:{}};return{...J,...Q.vendor}}function lQ(Q){let $={type:Q.type};if(Q.createResponse!==void 0)$.create_response=Q.createResponse;if(Q.interruptResponse!==void 0)$.interrupt_response=Q.interruptResponse;if(Q.type==="semantic_vad"){if(Q.eagerness!==void 0)$.eagerness=Q.eagerness}else{if(Q.threshold!==void 0)$.threshold=Q.threshold;if(Q.prefixPaddingMs!==void 0)$.prefix_padding_ms=Q.prefixPaddingMs;if(Q.silenceDurationMs!==void 0)$.silence_duration_ms=Q.silenceDurationMs;if(Q.idleTimeoutMs!==void 0)$.idle_timeout_ms=Q.idleTimeoutMs}return $}function HQ(Q){let $=Number(Q?.input_tokens??0),J=Number(Q?.output_tokens??0),Z={inputTokens:$,outputTokens:J,totalTokens:Number(Q?.total_tokens??$+J)},Y=Q?.input_token_details??Q?.input_tokens_details,G=Q?.output_token_details??Q?.output_tokens_details;if(typeof Y?.cached_tokens==="number")Z.cachedInputTokens=Y.cached_tokens;if(typeof Y?.audio_tokens==="number")Z.audioInputTokens=Y.audio_tokens;let V=Y?.cached_tokens_details?.audio_tokens;if(typeof V==="number")Z.cachedAudioInputTokens=V;if(typeof Y?.image_tokens==="number"&&Y.image_tokens>0)Z.imageInputTokens=Y.image_tokens;if(typeof G?.audio_tokens==="number")Z.audioOutputTokens=G.audio_tokens;return Z}class m extends Error{code;retryable;status;constructor(Q,$={}){super(Q.message,{cause:$.cause});if(this.name="RealtimeRequestError",this.code=Q.code,this.retryable=Q.retryable,$.status!==void 0)this.status=$.status}}var f5=60;class o{model;target;options;constructor(Q,$){this.target=Q,this.options=$,this.model=$.model}url(Q){return`${this.target.base}/realtime${Q}${this.target.query}`}sidebandUrl(Q){let $=this.target.base.replace(/^http(s?):/i,(Z,Y)=>`ws${Y}:`),J=this.target.query?`${this.target.query}&`:"?";return`${$}/realtime${J}call_id=${encodeURIComponent(Q)}`}async createCall(Q){let $=Q.flow??this.options.callFlow??"unified",J,Z;if($==="ephemeral")J={authorization:`Bearer ${(await this.clientSecret({session:Q.session,ttlSeconds:f5,signal:Q.signal})).value}`,"content-type":"application/sdp"},Z=Q.sdp;else{let j=new FormData;j.set("sdp",Q.sdp),j.set("session",JSON.stringify(a(Q.session??{},this.model))),J=await this.target.headers(),Z=j}if(Q.safetyIdentifier)J["OpenAI-Safety-Identifier"]=Q.safetyIdentifier;let Y=this.url("/calls"),G=await this.request(Q.webrtcFilter?`${Y}${Y.includes("?")?"&":"?"}webrtcfilter=on`:Y,{method:"POST",headers:J,body:Z},Q.signal),V=await G.text(),z=g5(G);if(!z)throw new m({code:"provider_error",message:"The provider started a realtime call but did not say which one (no Location).",retryable:!1});return{sdpAnswer:V,callId:z}}async clientSecret(Q={}){let $=Q.ttlSeconds??w5;if(!Number.isInteger($)||$<mQ||$>dQ)throw RangeError(`ttlSeconds must be a whole number from ${mQ} to ${dQ}, got ${$}.`);let J={...await this.target.headers(),"content-type":"application/json"};if(Q.safetyIdentifier)J["OpenAI-Safety-Identifier"]=Q.safetyIdentifier;let Y=await(await this.request(this.url("/client_secrets"),{method:"POST",headers:J,body:JSON.stringify({expires_after:{anchor:"created_at",seconds:$},session:a(Q.session??{},this.model)})},Q.signal)).json();if(typeof Y?.value!=="string")throw new m({code:"provider_error",message:"The provider answered a client secret request with no secret.",retryable:!1});return{value:Y.value,expiresAt:Number(Y.expires_at??0),session:Y.session,callsUrl:this.url("/calls")}}async hangup(Q,$={}){try{await this.request(this.url(`/calls/${encodeURIComponent(Q)}/hangup`),{method:"POST",headers:await this.target.headers()},$.signal)}catch(J){if(y5(J,Q))return;throw J}}sideband(Q,$={}){return new XQ({...$,callId:Q,url:this.sidebandUrl(Q),headers:this.target.headers,webSocket:$.webSocket??this.options.webSocket,hangup:()=>this.hangup(Q)})}async request(Q,$,J){try{return await c(Q,$,{maxRetries:this.target.maxRetries,timeoutMs:this.target.timeoutMs,retryTimeouts:!1,signal:J,fetchImpl:this.options.fetchImpl})}catch(Z){if(J?.aborted)throw Z;throw new m(x(Z),{cause:Z,...Z instanceof A?{status:Z.status}:{}})}}}function y5(Q,$){if(!(Q instanceof m)||Q.status!==404)return!1;let J=Q.cause instanceof A?Q.cause.body:void 0,Z=J?.error??J,Y=String(Z?.code??"").toLowerCase(),G=String(Z?.message??"").toLowerCase();if(Y.includes("call"))return!0;if(G.includes($.toLowerCase()))return!0;return/\bcall\b/.test(G)&&/not (be )?found|does not exist|no longer|ended/.test(G)}function g5(Q){let $=Q.headers.get("location");if(!$)return;let J=$.split("?")[0].replace(/\/+$/,""),Z=J.slice(J.lastIndexOf("/")+1);return Z?decodeURIComponent(Z):void 0}var u5={"response.audio_transcript.delta":"response.output_audio_transcript.delta","response.audio_transcript.done":"response.output_audio_transcript.done","response.text.delta":"response.output_text.delta","response.text.done":"response.output_text.done","response.audio.delta":"response.output_audio.delta","response.audio.done":"response.output_audio.done"};function c5(Q){if(typeof Q!=="string")return;let $;try{$=JSON.parse(Q)}catch{return}if(!$||typeof $!=="object"||typeof $.type!=="string")return;let J=u5[$.type];if(J)$.type=J;if($.type==="response.done"&&$.response?.usage)$.usage=HQ($.response.usage);if($.type==="conversation.item.input_audio_transcription.completed"&&$.usage)if($.usage.type==="duration"){let Z=Number($.usage.seconds);if(Number.isFinite(Z))$.transcriptionSeconds=Z}else $.transcriptionUsage=HQ($.usage);return $}var iQ=1,m5=500;function d5(Q,$){let J=globalThis.WebSocket;if(!J)throw Error("No global WebSocket: the realtime sideband needs Bun or Node 22+.");return new J(Q,{headers:$.headers})}class XQ{callId;ready;closed;init;socket;finalEvent;outbox=[];subscribers=new Set;listeners=new Set;backlog=[];closing=!1;finished=!1;everOpened=!1;failures=0;resolveReady;rejectReady;resolveClosed;constructor(Q){this.init=Q,this.callId=Q.callId,this.ready=new Promise(($,J)=>{this.resolveReady=$,this.rejectReady=J}),this.ready.catch(()=>{}),this.closed=new Promise(($)=>this.resolveClosed=$),this.open()}send(Q){if(this.finished||this.closing)return;let $=JSON.stringify(Q);if(this.socket?.readyState===iQ)this.socket.send($);else this.outbox.push($)}updateSession(Q){this.send({type:"session.update",session:a(Q)})}addItem(Q){this.send({type:"conversation.item.create",item:Q})}addNote(Q){this.addItem({type:"message",role:"system",content:[{type:"input_text",text:Q}]})}functionOutput(Q,$){this.addItem({type:"function_call_output",call_id:Q,output:typeof $==="string"?$:JSON.stringify($)})}createResponse(Q={}){let $={};if(Q.instructions!==void 0)$.instructions=Q.instructions;if(Q.toolChoice!==void 0)$.tool_choice=typeof Q.toolChoice==="string"?Q.toolChoice:{type:"function",name:Q.toolChoice.name};if(Q.outputModalities)$.output_modalities=Q.outputModalities;if(Q.conversation)$.conversation=Q.conversation;if(Q.metadata)$.metadata=Q.metadata;Object.assign($,Q.vendor),this.send(Object.keys($).length?{type:"response.create",response:$}:{type:"response.create"})}cancelResponse(Q){this.send(Q?{type:"response.cancel",response_id:Q}:{type:"response.cancel"})}on(Q){return this.listeners.add(Q),()=>this.listeners.delete(Q)}[Symbol.asyncIterator](){let Q={queue:this.backlog??[],done:this.finished};return this.backlog=void 0,this.subscribers.add(Q),{next:async()=>{for(;;){let J=Q.queue.shift();if(J)return{value:J,done:!1};if(Q.done)return this.subscribers.delete(Q),{value:void 0,done:!0};await new Promise((Z)=>Q.wake=Z),Q.wake=void 0}},return:async()=>{return Q.done=!0,Q.queue.length=0,this.subscribers.delete(Q),{value:void 0,done:!0}}}}close(Q=1000,$="closed"){if(this.finished||this.closing)return;if(this.closing=!0,this.socket&&this.socket.readyState<=iQ)this.socket.close(Q,$);else this.finish(Q,$,!0)}async hangup(){try{await this.init.hangup()}catch(Q){if(this.finalEvent&&!this.finalEvent.byClient&&this.finalEvent.code===1000)return;throw Q}this.close(1000,"hangup")}async open(){let Q;try{let J=await this.init.headers();if(this.closing)return this.finish(1000,"closed",!0);Q=(this.init.webSocket??d5)(this.init.url,{headers:J})}catch(J){return this.dropped(1006,J instanceof Error?J.message:String(J),!1)}this.socket=Q;let $=!1;Q.addEventListener("open",()=>{$=!0;let J=this.everOpened;this.everOpened=!0;let Z=this.failures;this.failures=0;for(let Y of this.outbox.splice(0))Q.send(Y);if(this.resolveReady(),J)this.emit({type:"sideband.reconnected",attempt:Z})}),Q.addEventListener("message",(J)=>{let Z=c5(J.data);if(Z)this.emit(Z)}),Q.addEventListener("close",(J)=>{if(this.socket!==Q)return;this.dropped(J.code??1006,J.reason??"",$)}),Q.addEventListener("error",()=>{})}dropped(Q,$,J){if(this.socket=void 0,this.closing)return this.finish(Q,$,!0);let Z=this.init.reconnect?.attempts??3;if(!((Q!==1000||!J)&&this.failures<Z))return this.finish(Q,$,!1);this.failures+=1;let G=(this.init.reconnect?.delayMs??500)*2**(this.failures-1);setTimeout(()=>void this.open(),G)}finish(Q,$,J){if(this.finished)return;this.finished=!0,this.outbox.length=0;let Z={type:"sideband.closed",code:Q,reason:$,byClient:J};this.finalEvent=Z,this.emit(Z);for(let Y of this.subscribers)Y.done=!0,Y.wake?.();if(!this.everOpened)this.rejectReady(Error(`Realtime sideband did not open (${Q} ${$}).`));this.resolveClosed(Z)}emit(Q){if(this.backlog){if(this.backlog.push(Q),this.backlog.length>m5)this.backlog.shift()}for(let $ of this.subscribers){if($.done)continue;$.queue.push(Q),$.wake?.()}for(let $ of this.listeners)try{$(Q)}catch{}}}var sQ=3;function jQ(Q){let $=new Map;for(let J of Q)for(let Z of J.content??[]){if(Z.type!=="file"||!Z.fileId||$.has(Z.fileId))continue;$.set(Z.fileId,{name:Z.name,mimeType:Z.mimeType})}return $}function aQ(Q,$,J=new Map){if(!($ instanceof A))return[];if($.status!==400&&$.status!==404)return[];let Z=qQ($.body);if(!Z)return[];let Y=p5(Q.input);if(Y.length===0)return[];let G=/^input\[(\d+)\]\.content\[(\d+)\]\.file_id$/.exec(Z.param??"");if(G){let K=Q.input[Number(G[1])],B=zQ(K)[Number(G[2])],H=B&&typeof B.file_id==="string"?B.file_id:void 0;if(H)return[H]}let V=Z.message??"",z=rQ(Y.map((K)=>K.fileId).filter((K)=>l5(V,K)));if(z.length>0)return z;let j=/Expected (image type|context stuffing file type) to be a supported format:.*but got \.([a-z0-9]+)\.?\s*$/is.exec(V);if(j){let K=j[1].toLowerCase()==="image type"?"input_image":"input_file",B=j[2].toLowerCase(),H=rQ(Y.filter((X)=>X.type===K).map((X)=>X.fileId)),W=H.filter((X)=>(J.get(X)?.name??"").trim().toLowerCase().endsWith(`.${B}`));if(W.length===1)return W;if(W.length===0&&H.length===1)return H}return[]}function oQ(Q,$,J=new Map){return{...Q,input:Q.input.map((Z)=>{let Y=zQ(Z);if(!Y.some((G)=>nQ(G,$)))return Z;return{...Z,content:Y.map((G)=>nQ(G,$)?{type:"input_text",text:d(J.get(String(G.file_id))?.name)}:G)}})}}function d(Q){return`[${Q?`attachment ${JSON.stringify(Q)}`:"an attachment"} could not be read by the provider and is not shown to you. Tell the user if it matters to the answer; uploading it again may help.]`}function nQ(Q,$){return typeof Q.file_id==="string"&&$.has(Q.file_id)}function zQ(Q){let $=Q?.content;return Array.isArray($)?$:[]}function p5(Q){let $=[];for(let J of Q)for(let Z of zQ(J))if(typeof Z.file_id==="string"&&Z.file_id)$.push({type:String(Z.type),fileId:Z.file_id});return $}function qQ(Q){if(!Q||typeof Q!=="object")return null;let $=Q,J=$.error&&typeof $.error==="object"?$.error:Q;return{message:typeof J.message==="string"?J.message:void 0,param:typeof J.param==="string"?J.param:void 0}}function l5(Q,$){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[^A-Za-z0-9_-])${J}($|[^A-Za-z0-9_-])`).test(Q)}function rQ(Q){return[...new Set(Q)]}function tQ(Q,$){if(!($ instanceof A))return null;if($.status!==400&&$.status!==404)return null;let J=Q?.input;if(!Array.isArray(J))return null;let Z=qQ($.body)?.message??"",Y=/Item with id '([^']+)' not found/i.exec(Z)?.[1];if(!Y)return null;let G=(V)=>V?.type==="reasoning";if(!J.some((V)=>G(V)&&V.id===Y))return null;return{...Q,input:J.filter((V)=>!G(V))}}async function*CQ(Q){let $="",J="",Z=[],Y,G=()=>{if(Z.length===0&&!J)return null;let j={event:J,data:Z.join(`
3
- `),id:Y};return J="",Z=[],Y=void 0,j.data?j:null},V=(j)=>{let K=j.endsWith("\r")?j.slice(0,-1):j;if(K==="")return G();if(K.startsWith(":"))return null;let B=K.indexOf(":"),H=B===-1?K:K.slice(0,B),W=B===-1?"":K.slice(B+1);if(W.startsWith(" "))W=W.slice(1);if(H==="event")J=W;else if(H==="data")Z.push(W);else if(H==="id")Y=W;return null};for await(let j of Q){$+=j;let K=$.indexOf(`
4
- `);while(K!==-1){let B=$.slice(0,K);$=$.slice(K+1);let H=V(B);if(H)yield H;K=$.indexOf(`
5
- `)}}if($.length>0){let j=V($);if(j)yield j}let z=G();if(z)yield z}async function*eQ(Q,$={}){let J=new Map,Z=new Set,Y,G=!1,V,z=(j,K)=>({type:"finish",reason:j,usage:K,...V?{model:V}:{}});for await(let j of CQ(Q)){if(j.data==="[DONE]")break;let K;try{K=JSON.parse(j.data)}catch{continue}let B=typeof K.type==="string"?K.type:j.event,H=K.response?.model;if(typeof H==="string"&&H)V=H;switch(B){case"response.output_text.delta":{let W=String(K.delta??"");if(!W)break;yield $.structuredOutput?{type:"output-delta",delta:W}:{type:"text-delta",delta:W};break}case"response.reasoning_summary_text.delta":case"response.reasoning_text.delta":{let W=String(K.delta??"");if(!W)break;yield{type:"reasoning-delta",delta:W,id:K.item_id};break}case"response.output_item.added":{let W=K.item;if(!W)break;if(W.type==="function_call"){let X=String(W.id??K.item_id??W.call_id??"");J.set(X,{callId:String(W.call_id??X),name:String(W.name??""),namespace:typeof W.namespace==="string"&&W.namespace?W.namespace:void 0,done:!1})}break}case"response.function_call_arguments.delta":{let W=J.get(String(K.item_id??""));if(!W)break;let X=String(K.delta??"");if(!X)break;yield{type:"tool-call-delta",toolCallId:W.callId,name:W.name,argsDelta:X,...W.namespace?{namespace:W.namespace}:{}};break}case"response.function_call_arguments.done":{let W=String(K.item_id??""),X=J.get(W);if(!X)break;X.done=!0,yield{type:"tool-call",toolCallId:X.callId,name:X.name,args:String(K.arguments??""),...X.namespace?{namespace:X.namespace}:{}};break}case"response.output_item.done":{let W=K.item;if(!W)break;if(W.type==="function_call"){let X=String(W.id??K.item_id??W.call_id??""),q=J.get(X);if(q?.done)break;let F=(typeof W.namespace==="string"?W.namespace:"")||q?.namespace;if(yield{type:"tool-call",toolCallId:String(W.call_id??X),name:String(W.name??q?.name??""),args:String(W.arguments??""),...F?{namespace:F}:{}},q)q.done=!0;break}if(W.type==="tool_search_call"||W.type==="tool_search_output"){if(W.type==="tool_search_call"&&W.arguments!==void 0)Y=W.arguments;let X=i5(W);if(X.loaded.length===0&&X.namespaces.length===0)break;let q=String(W.tool_search_call_id??W.id??"");if(Z.has(q))break;Z.add(q);let F=Y;Y=void 0,yield{type:"tool-search",...X,...F!==void 0&&F!==null?{arguments:F}:{}}}break}case"response.refusal.done":{yield{type:"error",error:{code:"content_filtered",message:String(K.refusal??"The model refused to answer."),retryable:!1}};break}case"response.completed":{G=!0,yield z("stop",FQ(K.response?.usage));break}case"response.incomplete":{G=!0;let W=FQ(K.response?.usage),X=K.response?.incomplete_details?.reason;if(X==="content_filter"){yield{type:"error",error:{code:"content_filtered",message:n5(K.response?.content_filters),retryable:!1}},yield z("error",W);break}yield z(X==="max_output_tokens"?"length":"stop",W);break}case"response.failed":case"error":{G=!0;let W=K.response?.error??K.error??K;yield{type:"error",error:r5(W)},yield z("error",FQ(K.response?.usage));break}}if(G)return}if(!G)yield{type:"error",error:{code:"provider_error",message:"The provider stream ended without a terminal event.",retryable:!0}},yield z("error",S())}function i5(Q){let $=[],J=[];return Q5(Q.results??Q.tools??Q.loaded??Q.output,$,J,0),{loaded:UQ($),namespaces:UQ(J)}}function Q5(Q,$,J,Z){if(!Array.isArray(Q)||Z>4)return;for(let Y of Q){if(typeof Y==="string"){$.push(Y);continue}if(!Y||typeof Y!=="object")continue;let G=Y,V=typeof G.name==="string"?G.name:typeof G.tool_name==="string"?G.tool_name:"",z=G.tools??G.functions;if(Array.isArray(z)){if(V)J.push(V);Q5(z,$,J,Z+1);continue}if(V)$.push(V)}}function UQ(Q){return Q.filter(($,J)=>Q.indexOf($)===J)}function n5(Q){if(!Array.isArray(Q))return"The provider's content filter blocked this request.";let J=[];for(let Z of Q){if(!Z||typeof Z!=="object")continue;let Y=Z,G=Y.content_filter_results;if(!G||typeof G!=="object")continue;for(let[V,z]of Object.entries(G))if(z&&typeof z==="object"&&z.filtered===!0)J.push(`${V} (${String(Y.source_type??"unknown")})`)}return J.length===0?"The provider's content filter blocked this request.":`The provider's content filter blocked this request. Categories: ${UQ(J).join(", ")}.`}function r5(Q){let $=typeof Q?.message==="string"?Q.message:"The provider stream failed.",J=String(Q?.code??"").toLowerCase();if(J==="rate_limit_exceeded")return{code:"rate_limited",message:$,retryable:!0};if(J==="context_length_exceeded")return{code:"context_length_exceeded",message:$,retryable:!1};if(J.includes("content_filter"))return{code:"content_filtered",message:$,retryable:!1};return{code:"provider_error",message:$,retryable:!0}}function S(){return{inputTokens:0,outputTokens:0,totalTokens:0}}function FQ(Q){if(!Q)return S();let $=Number(Q.input_tokens??0),J=Number(Q.output_tokens??0),Z={inputTokens:$,outputTokens:J,totalTokens:Number(Q.total_tokens??$+J)},Y=Q.output_tokens_details?.reasoning_tokens;if(typeof Y==="number")Z.reasoningTokens=Y;let G=Q.input_tokens_details?.cached_tokens;if(typeof G==="number")Z.cachedInputTokens=G;return Z}async function*$5(Q){if(!Q)return;let $=Q.getReader(),J=new TextDecoder;try{while(!0){let{done:Y,value:G}=await $.read();if(Y)break;if(G)yield J.decode(G,{stream:!0})}let Z=J.decode();if(Z)yield Z}finally{$.releaseLock()}}function QQ(Q){return{responsesUrl:`${Q.base}/responses${Q.query}`,filesUrl:`${Q.base}/files${Q.query}`,headers:Q.headers,timeoutMs:Q.timeoutMs,streamIdleTimeoutMs:Q.streamIdleTimeoutMs,streamMaxDurationMs:Q.streamMaxDurationMs,maxToolArgumentChars:Q.maxToolArgumentChars,maxRetries:Q.maxRetries,...Q.retry?{retry:Q.retry}:{}}}async function*$Q(Q,$,J){let Z=J.parse??eQ,Y=$,G=new Set,V=0,z=!1,j=Math.max(0,Q.maxRetries),K=Q.random??Math.random,B,H=(O)=>{if(!B)return O;let L=t(t(S(),B),O.usage);return B=void 0,{...O,usage:L}},W=()=>H({type:"finish",reason:"aborted",usage:S()}),X=Q.streamIdleTimeoutMs??0,q=Q.streamMaxDurationMs??0,F=Q.maxToolArgumentChars??0,N=Q.now??Date.now,P=N();for(let O=0;;O++){let L=new AbortController,y=J.signal?AbortSignal.any([J.signal,L.signal]):L.signal,v;while(v===void 0)try{let C=[],U=()=>{},M=c(Q.responsesUrl,{method:"POST",headers:{...await Q.headers(),"content-type":"application/json"},body:JSON.stringify(Y)},{maxRetries:Q.maxRetries,timeoutMs:Q.timeoutMs,signal:y,fetchImpl:Q.fetchImpl,sleep:Q.sleep,random:Q.random,now:Q.now,startedAt:P,...Q.retry?{retry:Q.retry}:{},onRetry:(h)=>{C.push({type:"retry",...h,phase:"request"}),U()}}),w=M.then(()=>!0,()=>!0);for(;;){let h=new Promise((n)=>U=()=>n(!1)),u=await Promise.race([w,h]);if(yield*C.splice(0),u)break}v=await M}catch(C){let U=Y,M=J.files&&V<sQ?aQ(U,C,J.files).filter((u)=>!G.has(u)):[];if(M.length>0){V++;let u=x(C).message;for(let n of M)G.add(n),yield{type:"file-rejected",fileId:n,message:u,...k(C)};Y=oQ(U,new Set(M),J.files);continue}let w=z?null:tQ(Y,C);if(w){z=!0,Y=w;continue}let h=x(C);if(h.code==="aborted"){yield W();return}yield{type:"error",error:h,...k(C)},yield H({type:"finish",reason:"error",usage:S()});return}let _=[],R=!1,I,GQ=!1,E,g=new Map;try{let C=cQ(v.body,{idleMs:X,maxMs:q},{idle:()=>{let U=new J5(X);return L.abort(U),U},max:()=>{let U=new Z5(q);return L.abort(U),U}});for await(let U of Z($5(C),{structuredOutput:J.structuredOutput})){if(U.type==="tool-call-delta"){let M=(g.get(U.toolCallId)??0)+U.argsDelta.length;if(g.set(U.toolCallId,M),F>0&&M>F){let w=new LQ(F,U.name,U.toolCallId,M);throw L.abort(w),w}yield U;continue}if(U.type==="tool-call")g.delete(U.toolCallId);if(R){yield U.type==="finish"?H(U):U;continue}if(e(U)){R=!0,yield*_.splice(0),yield U;continue}if(U.type==="error")I=U.error;_.push(U)}}catch(C){GQ=C instanceof s;let U=x(C);if(U.code==="aborted"||J.signal?.aborted){yield W();return}if(R){yield{type:"error",error:U},yield H({type:"finish",reason:"error",usage:S()});return}if(I=U,C instanceof LQ)E=C.detail;_.push({type:"error",error:U,...E?{toolArgumentsTooLong:E}:{}},{type:"finish",reason:"error",usage:S()})}if(R)return;let l={};for(let C of _)if(C.type==="error")l=k(C);let i=!I?.retryable||J.signal?.aborted||E&&J.retryToolArgumentsTooLong===!1?void 0:O<j?r(O,K):Q.retry&&WQ(Q.retry,I,{...l.status!==void 0?{status:l.status}:{},timedOut:GQ,...E?{toolArgumentsTooLong:E}:{}})?VQ(Q.retry,O-j,I.retryAfter,N()-P,K):void 0;if(i!==void 0){for(let U of _)if(U.type==="finish")B=t(B??S(),U.usage);if(g.size>0)yield{type:"tool-call-discard",toolCallIds:[...g.keys()]};let C=N()-P;yield{type:"retry",attempt:O+1,maxRetries:j,error:I,...l,phase:"stream",timedOut:GQ,...E?{toolArgumentsTooLong:E}:{},delayMs:i,elapsedMs:C,...Q.retry?{remainingMs:Math.max(0,Q.retry.patienceMs-C-i)}:{}};try{await KQ(i,J.signal,Q.sleep)}catch{yield W();return}continue}for(let C of _)yield C.type==="finish"?H(C):C;return}}async function JQ(Q,$,J="user_data"){let Z=new FormData;if(J)Z.set("purpose",J);Z.set("file",$);let G=await(await c(Q.filesUrl,{method:"POST",headers:await Q.headers(),body:Z},{maxRetries:Q.maxRetries,timeoutMs:Q.timeoutMs,fetchImpl:Q.fetchImpl})).json();if(!G?.id)throw Error("The provider accepted the upload but returned no file id.");return G.id}function PQ(Q,$){let{capabilities:J}=$,Z={model:$.model,input:s5(Q.messages,J,Q.tools),stream:!0};if(Q.systemPrompt)Z.instructions=Q.systemPrompt;let Y=Y6(Q.tools,J);if(Y.length>0){if(Z.tools=Y,!J.parallelToolCalls)Z.parallel_tool_calls=!1;if(Q.toolChoice!==void 0)Z.tool_choice=typeof Q.toolChoice==="string"?Q.toolChoice:{type:"function",name:Q.toolChoice.name}}if(Q.output)Z.text={format:{type:"json_schema",name:Q.output.name,schema:Q.output.schema,strict:Q.output.strict}};if(Q.reasoning&&J.reasoning)Z.reasoning=Q.reasoning==="none"?{effort:"none"}:{effort:Q.reasoning,summary:"auto"};if(typeof Q.temperature==="number")Z.temperature=Q.temperature;if(typeof Q.maxOutputTokens==="number")Z.max_output_tokens=Q.maxOutputTokens;if(Q.promptCacheKey)Z.prompt_cache_key=Q.promptCacheKey;return Z}function s5(Q,$,J){let Z=[],Y=new Map;if($.toolSearch){for(let G of J??[])if(ZQ(G))Y.set(G.name,G)}for(let G of Q){let V=G.role,z=!$6.has(G.finishReason),j=[],K=()=>{if(j.length===0)return;Z.push({type:"message",role:V,content:j}),j=[]};for(let B of G.content??[])switch(B.type){case"text":{if(!B.text)break;j.push(b(V,B.text));break}case"output":{if(B.partial)break;j.push(b(V,JSON.stringify(B.value)));break}case"file":{if(V==="assistant")break;let H=DQ(B);if(!$.fileInput){if(H)j.push(b(V,p(B,!1)));break}if(OQ(B,H),B.providerRejected){if(H)j.push(b(V,p(B,!1)));j.push(b(V,d(B.name)));break}if(H)j.push(b(V,p(B,!!B.fileId)));if(B.fileId)j.push(t5(B));break}case"reasoning":{if(K(),!z)break;let H=J6(B);if(H)Z.push(H);break}case"tool-call":{if(B.partial)break;if(K(),$.toolSearch&&Array.isArray(B.toolSearches))for(let W of B.toolSearches)Z.push(...Z6(W,J??[]));let H={type:"function_call",call_id:B.toolCallId,name:String(B.name),arguments:JSON.stringify(B.input??{})};if(B.namespace&&Y.has(B.namespace))H.namespace=B.namespace;Z.push(H);break}case"tool-result":{K(),Z.push({type:"function_call_output",call_id:B.toolCallId,output:SQ(B)});break}}K()}return o5(Z)}var a5="No result was recorded for this tool call. Assume it did not complete.";function o5(Q){let $=new Set,J=new Set,Z=[];for(let G of Q){if(G.type==="function_call"){let V=String(G.call_id);if($.has(V))continue;$.add(V)}else if(G.type==="function_call_output"){let V=String(G.call_id);if(!$.has(V)||J.has(V))continue;J.add(V)}Z.push(G)}if(J.size===$.size)return Z;let Y=[];for(let G of Z){if(Y.push(G),G.type!=="function_call")continue;let V=String(G.call_id);if(J.has(V))continue;J.add(V),Y.push({type:"function_call_output",call_id:V,output:a5})}return Y}function b(Q,$){return{type:Q==="assistant"?"output_text":"input_text",text:$}}function DQ(Q){let $=Q.attachmentId;return typeof $==="string"&&$.startsWith(NQ)?$:void 0}function p(Q,$){let J=[`id=${JSON.stringify(Q.attachmentId)}`];if(Q.name)J.push(`name=${JSON.stringify(Q.name)}`);if(Q.mimeType)J.push(`mimeType=${JSON.stringify(Q.mimeType)}`);let Z=`attachment ${J.join(" ")}`;return $?`[${Z}]`:`[${Z} \u2014 its contents are not shown to you; a tool can read the file by this id]`}function t5(Q){return{type:xQ(Q)?"input_image":"input_file",file_id:Q.fileId}}function xQ(Q){let $=Q.mimeType?.trim().toLowerCase()??"";return $?$.startsWith("image/")&&$!=="image/svg+xml":e5(Q.name)}function OQ(Q,$){if(Q.fileId?.startsWith(NQ))throw Error(`FilePart.fileId holds a gemi attachment id (${Q.fileId}). That field is the *provider's* file id, from \`fileId\` on the upload response; the \`attachmentId\` goes in \`FilePart.attachmentId\`, is shown to the model as text, and is resolved by a tool through \`ctx.attachments\`.`);if(!Q.fileId&&!$)throw Error("FilePart.fileId is empty and there is no `attachmentId` either. `fileId` is the *provider's* file id and `attachmentId` is gemi's (`gemi_att_\u2026`), both from the upload response; an upload always answers at least one, so a part with neither was built from something other than that answer.")}function e5(Q){let $=/\.([a-z0-9]+)$/.exec(Q?.trim().toLowerCase()??"");return $?.[1]!==void 0&&Q6.has($[1])}var Q6=new Set(["jpeg","jpg","png","gif","webp"]),$6=new Set(["error","aborted","interrupted"]);function J6(Q){if(!Q.id)return null;let $={type:"reasoning",id:Q.id};return $.summary=Q.text?[{type:"summary_text",text:Q.text}]:[],$}function SQ(Q){if(Q.status==="ok"){let $=Q.modelOutput!==void 0?Q.modelOutput:Q.output;return typeof $==="string"?$:JSON.stringify($??null)}if(Q.status==="running"){let $=Q.job?.summary===void 0?"":` Started with: ${JSON.stringify(Q.job.summary)}.`;return`Started background job ${Q.job?.id??"(unknown)"}. It is still running, so there is no result yet: this message will be replaced by the result when it finishes. Do not start it again.${$}`}if(Q.status==="denied"){let $=Q.reason?` Reason given: ${Q.reason}`:"";if(Q.cause==="stopped")return`The run was stopped before this tool call could complete, so it did not run.${$}`;if(Q.cause==="interrupted")return`The run was interrupted (the server stopped) while this tool call was in progress, so its result was lost. It may have run in part or in full: check its effects before repeating it.${$}`;if(Q.cause==="denied-earlier")return`The user already declined this tool call earlier in this conversation, so it did not run and they were not asked again. Do not ask for it again; carry on without it.${$}`;return`The user declined this tool call, so it did not run.${$}`}return`The tool call failed and produced no result. Error (${Q.error?.code??"unknown"}): ${Q.error?.message??"no message"}`}function Z6(Q,$){let J=new Set(Y5(Q?.loaded)),Z=Y5(Q?.namespaces),Y=new Set(Z),G=[];for(let z of $)if(ZQ(z)){if(!Y.has(z.name))continue;let j=z.tools.filter((K)=>J.size===0||J.has(K.name));if(j.length===0)continue;G.push({type:"namespace",name:z.name,description:z.description,tools:j.map((K)=>f(K,!0))})}else if(z.deferred&&J.has(z.name))G.push(f(z,!0));if(G.length===0)return[];return[{type:"tool_search_call",call_id:null,execution:"server",status:"completed",arguments:Q.arguments&&typeof Q.arguments==="object"?Q.arguments:{paths:Z.length>0?Z:[...J]}},{type:"tool_search_output",call_id:null,execution:"server",status:"completed",tools:G}]}function Y5(Q){return Array.isArray(Q)?Q.filter(($)=>typeof $==="string"):[]}function ZQ(Q){return Array.isArray(Q.tools)}function Y6(Q,$){if(!Q||Q.length===0)return[];if(!$.toolSearch){let Y=[];for(let G of Q)if(ZQ(G))for(let V of G.tools)Y.push(f(V,!1));else Y.push(f(G,!1));return Y}let J=[],Z=!1;for(let Y of Q)if(ZQ(Y)){let G=Y.tools.map((V)=>{if(V.deferred)Z=!0;return f(V,!0)});J.push({type:"namespace",name:Y.name,description:Y.description,tools:G})}else{if(Y.deferred)Z=!0;J.push(f(Y,!0))}if(Z)J.push({type:"tool_search"});return J}function f(Q,$){let J={type:"function",name:Q.name,description:Q.description,parameters:Q.parameters,strict:Q.strict};if($&&Q.deferred)J.defer_loading=!0;return J}var G6=64000;function G5(Q,$){let J={model:$.model,max_tokens:Q.maxOutputTokens??G6,messages:U6(Q.messages,$.capabilities),stream:!0},Z=Q.output,Y=!!Z?.strict&&!z6(Z.schema),G=Z&&!Y?q6(Z.schema):void 0,V=[Q.systemPrompt,G].filter(Boolean);if(V.length>0)J.system=[{type:"text",text:V.join(`
6
-
7
- `)}];let z=$.capabilities.reasoning?Q.reasoning:void 0;if(z==="none"){if(/^claude-sonnet-5-5(?:-\d{8})?$/.test($.modelId))J.thinking={type:"between_tools"};J.output_config={effort:"low"}}else if(z)J.thinking={type:"adaptive",display:"summarized"},J.output_config={effort:V6(z,$.modelId)};else if($.capabilities.reasoning&&W6(J.messages))J.thinking={type:"adaptive"};if(J.thinking?.type==="adaptive"&&$.blockBinding)J.thinking.block_binding={prefix_mismatch_behavior:"drop_block"};if(Z&&Y)J.output_config={...J.output_config,format:{type:"json_schema",schema:j6(Z.schema)}};let j=_6(Q.tools);if(j.length>0){J.tools=j;let K=F6(Q.toolChoice,$.forcedToolChoice);if(!$.capabilities.parallelToolCalls)K.disable_parallel_tool_use=!0;if(Q.toolChoice!==void 0||K.disable_parallel_tool_use)J.tool_choice=K}return K6(J)}function W6(Q){return Q.some(($)=>$.content.some((J)=>J.type==="thinking"||J.type==="redacted_thinking"))}var MQ="thinking-binding-controls-2026-08-01";function W5(Q){if(/bound to a different conversation|Invalid `signature` in `thinking` block/i.test(Q))return"thinking";if(/schema is too complex/i.test(Q))return"schema";return}function V5(Q){let $=[];for(let J of Q.messages){let Z=J.content.filter((G)=>G.type!=="thinking"&&G.type!=="redacted_thinking");if(Z.length===0)continue;let Y=$.at(-1);if(Y?.role===J.role)Y.content.push(...Z);else $.push({role:J.role,content:Z})}return{...Q,messages:$}}function V6(Q,$){if(Q==="none"||Q==="minimal")return"low";if(Q==="xhigh"&&/^claude-(?:opus|sonnet)-4-6(?:-|$)/.test($))return"high";return Q}function K6(Q){let $=(Z)=>{if(Z)Z.cache_control={type:"ephemeral"}};$(Q.tools?.at(-1)),$(Q.system?.at(-1));let J=Q.messages.at(-1)?.content??[];return $([...J].reverse().find((Z)=>Z.type!=="thinking"&&Z.type!=="redacted_thinking")),Q}var X6=new Set(["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","minLength","maxLength","maxItems","uniqueItems"]),B6=new Set(["date-time","time","date","duration","email","hostname","uri","ipv4","ipv6","uuid"]),H6=/\\[1-9]|\(\?<?[=!]|\\[bB]/,K5=new Set(["properties","patternProperties","$defs","definitions"]);function j6(Q){let $=(J)=>{if(Array.isArray(J))return J.map($);if(!T(J))return J;let Z={},Y=[];for(let[G,V]of Object.entries(J)){if(X6.has(G)||G==="minItems"&&typeof V==="number"&&V>1||G==="format"&&typeof V==="string"&&!B6.has(V)||G==="pattern"&&typeof V==="string"&&H6.test(V)){Y.push(`${G}: ${JSON.stringify(V)}`);continue}Z[G]=K5.has(G)&&T(V)?Object.fromEntries(Object.entries(V).map(([j,K])=>[j,$(K)])):$(V)}if(Y.length>0){let G=`{${Y.join(", ")}}`;Z.description=typeof Z.description==="string"?`${Z.description} ${G}`:G}if(Z.type==="object"||T(Z.properties))Z.additionalProperties=!1;return Z};return $(Q)}function z6(Q){let $=0,J=0,Z=(Y)=>{if(Array.isArray(Y))return Y.forEach(Z);if(!T(Y))return;if(Array.isArray(Y.anyOf)||Array.isArray(Y.type))J++;if(T(Y.properties)){let G=new Set(Array.isArray(Y.required)?Y.required:[]);$+=Object.keys(Y.properties).filter((V)=>!G.has(V)).length}for(let[G,V]of Object.entries(Y))if(K5.has(G)&&T(V))Object.values(V).forEach(Z);else Z(V)};return Z(Q),$>24||J>16}function q6(Q){return`Answer with only a JSON value (no prose, no code fence) that matches this JSON schema:
8
- ${JSON.stringify(Q)}`}function F6(Q,$){if(Q==="none")return{type:"none"};if(Q==="required")return $?{type:"any"}:{type:"auto"};if(Q&&typeof Q==="object")return $?{type:"tool",name:Q.name}:{type:"auto"};return{type:"auto"}}function U6(Q,$){let J=[],Z=new Map;for(let B of Q){let H=B.role==="assistant"?"assistant":"user";J.push("step-end");for(let W of B.content??[])switch(W.type){case"text":{if(H==="assistant"?!!W.text:!!W.text?.trim())J.push({role:H,block:{type:"text",text:W.text}});break}case"output":{if(W.partial)break;let X=W.text??JSON.stringify(W.value);J.push({role:H,block:{type:"text",text:X}});break}case"file":{if(H==="assistant")break;for(let X of x6(W,$))J.push({role:H,block:X});break}case"reasoning":{let X=H==="assistant"?D6(W):void 0;if(X)J.push({role:H,block:X});break}case"tool-call":{if(W.partial)break;J.push({role:"assistant",block:{type:"tool_use",id:W.toolCallId,name:String(W.name),input:T(W.input)?W.input:{}}});break}case"tool-result":{if(J.push("step-end"),Z.has(W.toolCallId))break;Z.set(W.toolCallId,{type:"tool_result",tool_use_id:W.toolCallId,content:SQ(W),...W.status==="error"?{is_error:!0}:{}});break}}}let Y=[],G=(B,H)=>{let W=Y[Y.length-1];if(W&&W.role===B)W.content.push(H);else Y.push({role:B,content:[H]})},V=new Set,z=[],j=!1,K=()=>{for(let B of z)G("user",Z.get(B)??P6(B));z=[],j=!1};for(let B of J){if(B==="step-end"){j=!0;continue}let{role:H,block:W}=B;if(j||H==="user")K();if(W.type==="tool_use"){let X=String(W.id);if(V.has(X))continue;V.add(X),z.push(X)}G(H,W)}if(K(),Y[0]?.role==="assistant")Y.unshift({role:"user",content:[{type:"text",text:C6}]});if(Y.at(-1)?.role==="assistant")Y.push({role:"user",content:[{type:"text",text:L6}]});return Y}var C6="(The conversation continues from an earlier point.)",L6="Continue.",N6="No result was recorded for this tool call. Assume it did not complete.";function P6(Q){return{type:"tool_result",tool_use_id:Q,content:N6}}function D6(Q){let $=Q.providerMetadata?.anthropic;if(!T($))return;if($.type==="thinking"&&typeof $.signature==="string")return{type:"thinking",thinking:Q.text??"",signature:$.signature};if($.type==="redacted_thinking"&&typeof $.data==="string")return{type:"redacted_thinking",data:$.data};return}function x6(Q,$){let J=DQ(Q),Z=(G)=>J?[{type:"text",text:p(Q,G)}]:[];if(!$.fileInput)return Z(!1);if(OQ(Q,J),!Q.fileId)return Z(!1);let Y=Q.providerRejected?void 0:S6(Q);if(!Y)return[...Z(!1),{type:"text",text:d(Q.name)}];return[...Z(!0),{type:Y,source:{type:"file",file_id:Q.fileId}}]}var O6=new Set(["image/jpeg","image/png","image/gif","image/webp"]);function S6(Q){let $=Q.mimeType?.trim().toLowerCase()??"";if(xQ(Q))return!$||O6.has($)?"image":void 0;if($)return $==="application/pdf"||$==="text/plain"?"document":void 0;return/\.(pdf|txt)$/i.test(Q.name??"")?"document":void 0}function T(Q){return!!Q&&typeof Q==="object"&&!Array.isArray(Q)}function M6(Q){return Array.isArray(Q.tools)}function _6(Q){let $=[];for(let J of Q??[])for(let Z of M6(J)?J.tools:[J])$.push({name:Z.name,description:Z.description,input_schema:Z.parameters,eager_input_streaming:!0});return $}async function*j5(Q,$={}){let J=new Map,Z=[],Y,G={},V,z,j=!1,K=(B)=>({type:"finish",reason:B,usage:T6(G),...Y?{model:Y}:{}});for await(let B of CQ(Q)){let H;try{H=JSON.parse(B.data)}catch{continue}switch(typeof H.type==="string"?H.type:B.event){case"message_start":{let X=H.message??{};if(typeof X.model==="string"&&X.model)Y=X.model;G=H5(G,X.usage);break}case"content_block_start":{let X=Number(H.index),q=H.content_block??{},F={type:String(q.type??""),id:typeof q.id==="string"?q.id:void 0,name:typeof q.name==="string"?q.name:void 0,args:"",signature:typeof q.signature==="string"?q.signature:""};if(J.set(X,F),F.type==="redacted_thinking")yield{type:"reasoning-delta",delta:"",providerMetadata:{anthropic:{type:"redacted_thinking",data:String(q.data??"")}}};if(F.type==="text"&&typeof q.text==="string"&&q.text)yield B5(q.text,$);break}case"content_block_delta":{let X=J.get(Number(H.index)),q=H.delta??{};if(!X)break;if(q.type==="text_delta"){let F=String(q.text??"");if(F)yield B5(F,$)}else if(q.type==="thinking_delta"){let F=String(q.thinking??"");if(F)yield{type:"reasoning-delta",delta:F}}else if(q.type==="signature_delta")X.signature+=String(q.signature??"");else if(q.type==="input_json_delta"&&X.type==="tool_use"){let F=String(q.partial_json??"");if(!F)break;X.args+=F,yield{type:"tool-call-delta",toolCallId:X.id??"",name:X.name??"",argsDelta:F}}break}case"content_block_stop":{let X=Number(H.index),q=J.get(X);if(J.delete(X),q?.type==="thinking")yield{type:"reasoning-delta",delta:"",providerMetadata:{anthropic:{type:"thinking",signature:q.signature}}};if(q?.type==="tool_use")if(q.args||="{}",R6(q.args))yield X5(q);else Z.push(q);break}case"message_delta":{if(typeof H.delta?.stop_reason==="string")V=H.delta.stop_reason;if(H.delta?.stop_details)z=H.delta.stop_details;G=H5(G,H.usage);break}case"message_stop":{if(j=!0,V==="refusal"){yield{type:"error",error:A6(z)},yield K("error");break}let X=I6(V);if(Z.length>0&&X==="length")yield{type:"tool-call-discard",toolCallIds:Z.map((q)=>q.id??"")};else for(let q of Z)yield X5(q);yield K(X);break}case"error":{j=!0,yield{type:"error",error:E6(H.error??H)},yield K("error");break}}if(j)return}yield{type:"error",error:{code:"provider_error",message:"The provider stream ended without a terminal event.",retryable:!0}},yield K("error")}function X5(Q){return{type:"tool-call",toolCallId:Q.id??"",name:Q.name??"",args:Q.args}}function R6(Q){try{return JSON.parse(Q),!0}catch{return!1}}function B5(Q,$){return $.structuredOutput?{type:"output-delta",delta:Q}:{type:"text-delta",delta:Q}}function I6(Q){if(Q==="max_tokens"||Q==="model_context_window_exceeded")return"length";return"stop"}function A6(Q){let $=typeof Q?.explanation==="string"?Q.explanation:"",J=typeof Q?.category==="string"?` (${Q.category})`:"";return{code:"content_filtered",message:$||`The model declined to answer${J}.`,retryable:!1}}function E6(Q){let $=String(Q?.type??"").toLowerCase(),J=typeof Q?.message==="string"?Q.message:"The provider stream failed.";if($==="rate_limit_error")return{code:"rate_limited",message:J,retryable:!0};if($==="invalid_request_error"||$==="request_too_large")return{code:/prompt is too long|request_too_large/i.test(`${$} ${J}`)?"context_length_exceeded":"provider_error",message:J,retryable:!1};if($==="authentication_error"||$==="permission_error"||$==="billing_error"||$==="not_found_error")return{code:"provider_error",message:J,retryable:!1};return{code:"provider_error",message:J,retryable:!0}}function H5(Q,$){if(!$||typeof $!=="object")return Q;let J={...Q};for(let Y of["input_tokens","output_tokens","cache_creation_input_tokens","cache_read_input_tokens"])if(typeof $[Y]==="number")J[Y]=$[Y];let Z=$.output_tokens_details?.thinking_tokens;if(typeof Z==="number")J.thinking_tokens=Z;return J}function T6(Q){if(!Q)return S();let{cache_read_input_tokens:$,cache_creation_input_tokens:J}=Q,Z=(Q.input_tokens??0)+($??0)+(J??0),Y=Q.output_tokens??0,G={inputTokens:Z,outputTokens:Y,totalTokens:Z+Y};if(typeof $==="number")G.cachedInputTokens=$;if(typeof J==="number")G.cacheWriteInputTokens=J;if(typeof Q.thinking_tokens==="number")G.reasoningTokens=Q.thinking_tokens;return G}function _Q(Q){let $=IQ(Q);if($.startsWith("gpt-3.5")||$.startsWith("text-")||$.startsWith("davinci"))return{reasoning:!1,structuredOutput:!1,fileInput:!1,parallelToolCalls:!0,toolSearch:!1,supportsForcedToolChoice:!0};let J=k6($);if(J?.kind==="o")return{reasoning:!0,structuredOutput:!0,fileInput:!0,parallelToolCalls:J.major>1,toolSearch:z5(J),supportsForcedToolChoice:!0};if(J?.kind==="gpt")return{reasoning:J.major>=5,structuredOutput:J.major>4||$.startsWith("gpt-4o")||$.startsWith("gpt-4.1"),fileInput:J.major>4||$.startsWith("gpt-4o")||$.startsWith("gpt-4.1"),parallelToolCalls:!0,toolSearch:z5(J),supportsForcedToolChoice:!0};return{reasoning:!0,structuredOutput:!0,fileInput:!0,parallelToolCalls:!0,toolSearch:!0,supportsForcedToolChoice:!0}}function z5(Q){if(Q.kind==="o")return Q.major>=5;return Q.major>5||Q.major===5&&Q.minor>=2}function RQ(Q){let $=IQ(Q),J=/^claude-(?:opus|sonnet|haiku)-4(?:-(\d{1,2}))?(?:-\d{8})?$/.exec($);return{reasoning:!(/^claude-(?:3|2|instant)/.test($)||!!J&&Number(J[1]??0)<=5),structuredOutput:!0,fileInput:!0,parallelToolCalls:!0,toolSearch:!1,supportsForcedToolChoice:w6(Q)}}function w6(Q){let $=IQ(Q);return/^claude-(?:3|2|instant)/.test($)||/^claude-(?:opus|sonnet|haiku)-4(?:-|$)/.test($)||/^claude-(?:opus|sonnet|fable|mythos)-5(?:-\d{8})?$/.test($)||/^claude-haiku-5-5(?:-\d{8})?$/.test($)}function IQ(Q){return Q.trim().toLowerCase()}function k6(Q){let $=/^gpt-(\d+)(?:\.(\d+))?/.exec(Q);if($?.[1])return{kind:"gpt",major:Number($[1]),minor:Number($[2]??0)};let J=/^o(\d+)(?:[-.]|$)/.exec(Q);if(J?.[1])return{kind:"o",major:Number(J[1]),minor:0};return null}var AQ=120000,EQ=2,TQ=120000,wQ=300000;function D(Q){return typeof process>"u"?void 0:process.env?.[Q]}var v6="preview";function q5(Q){let $=Q.trim().replace(/\/+$/,"");if(!$)return"";return`${$.replace(/\/openai(?:\/v1)?$/i,"")}/openai`}function h6(Q){return/^\d{4}-\d{2}-\d{2}/.test(Q)?"":"/v1"}function kQ(Q,$={}){return{base:(Q.baseURL??D("OPENAI_BASE_URL")??"https://api.openai.com/v1").replace(/\/+$/,""),query:"",headers:async()=>{let Z=Q.apiKey??D("OPENAI_API_KEY");return{...Z?{authorization:`Bearer ${Z}`}:{},...Q.headers}},timeoutMs:Q.timeoutMs??$.timeoutMs??AQ,streamIdleTimeoutMs:Q.streamIdleTimeoutMs??TQ,streamMaxDurationMs:Q.streamMaxDurationMs??wQ,maxToolArgumentChars:Q.maxToolArgumentChars??0,maxRetries:Q.maxRetries??EQ,...hQ(Q)}}function F5(Q){let $=Q.baseURL??Q.endpoint??D("AZURE_OPENAI_ENDPOINT");if($)return q5($);let J=Q.resourceName??D("AZURE_OPENAI_RESOURCE_NAME")??D("AZURE_RESOURCE_NAME");return J?q5(`https://${J.trim()}.cognitiveservices.azure.com`):""}function vQ(Q,$={}){let J=Q.apiVersion??D("AZURE_OPENAI_API_VERSION")??v6;return{base:`${F5(Q)}${h6(J)}`,query:`?api-version=${encodeURIComponent(J)}`,headers:async()=>{if(Q.getToken)return{authorization:`Bearer ${await Q.getToken()}`,...Q.headers};let Z=Q.apiKey??D("AZURE_OPENAI_API_KEY");return{...Z?{"api-key":Z}:{},...Q.headers}},timeoutMs:Q.timeoutMs??$.timeoutMs??AQ,streamIdleTimeoutMs:Q.streamIdleTimeoutMs??TQ,streamMaxDurationMs:Q.streamMaxDurationMs??wQ,maxToolArgumentChars:Q.maxToolArgumentChars??0,maxRetries:Q.maxRetries??EQ,...hQ(Q)}}var b6="2026-10-21";function U5(Q,$={}){let J=Q.baseURL??D("ANTHROPIC_BASE_URL")??"https://api.anthropic.com";return L5(J,Q,$,async()=>{let Z=Q.workspaceId??D("ANTHROPIC_WORKSPACE_ID"),Y=Z?{"anthropic-workspace-id":Z}:{},G=Q.apiKey??D("ANTHROPIC_API_KEY");if(G)return{"x-api-key":G,...Y};let V=D("ANTHROPIC_AUTH_TOKEN");return V?{authorization:`Bearer ${V}`,...Y}:Y})}function C5(Q,$={}){let J=Q.resourceName??D("ANTHROPIC_FOUNDRY_RESOURCE"),Z=Q.baseURL??Q.endpoint??D("ANTHROPIC_FOUNDRY_BASE_URL")??(J?`https://${J.trim()}.services.ai.azure.com/anthropic`:"");if(!Z.trim())throw Error("AzureAnthropicProvider has no Foundry endpoint. Set `endpoint` (the deployment's Target URI without `/v1/messages`, e.g. `https://<resource>.services.ai.azure.com/anthropic`) or `resourceName`, or the ANTHROPIC_FOUNDRY_BASE_URL or ANTHROPIC_FOUNDRY_RESOURCE environment variable.");return L5(Z,Q,$,async()=>{if(Q.getToken)return{authorization:`Bearer ${await Q.getToken()}`};let Y=Q.apiKey??D("ANTHROPIC_FOUNDRY_API_KEY");return Y?{"api-key":Y}:{}})}function L5(Q,$,J,Z){return{base:`${Q.trim().replace(/\/+$/,"").replace(/\/v1$/,"")}/v1`,query:"",headers:async()=>({...await Z(),"anthropic-version":b6,...$.headers}),timeoutMs:$.timeoutMs??J.timeoutMs??AQ,streamIdleTimeoutMs:$.streamIdleTimeoutMs??TQ,streamMaxDurationMs:$.streamMaxDurationMs??wQ,maxToolArgumentChars:$.maxToolArgumentChars??0,maxRetries:$.maxRetries??EQ,...hQ($)}}function N5(Q,$={}){return{...vQ(Q,$),base:`${F5(Q)}/v1`,query:""}}function hQ(Q){return fQ(Q.retry),Q.retry?{retry:Q.retry}:{}}class YQ{static models(){return[]}normalizeError(Q){return x(Q)}}var P5=["gpt-5.5","gpt-5.4","gpt-5.4-mini","gpt-5.4-nano","gpt-5.2","gpt-5.1","gpt-5","gpt-5-mini","gpt-5-nano","gpt-4.1","gpt-4.1-mini","gpt-4.1-nano","gpt-4o","gpt-4o-mini","o4-mini","o3","o3-mini"];class D5 extends YQ{model;capabilities;config;constructor(Q,$={}){super();this.model=Q,this.capabilities=_Q(Q),this.config=$}static model(Q,$){return new D5(Q,$)}static models(){return P5}stream(Q){let $=PQ(Q,{model:this.model,capabilities:this.capabilities});return $Q(this.endpoint(),$,{signal:Q.signal,retryToolArgumentsTooLong:Q.retryToolArgumentsTooLong,structuredOutput:Boolean(Q.output),files:jQ(Q.messages)})}upload(Q){return JQ(this.endpoint(),Q)}endpoint(){return QQ(kQ(this.config))}get realtime(){return new o(kQ(this.config,{timeoutMs:BQ}),{model:this.model})}}var f6=["claude-opus-5-5","claude-sonnet-5-5","claude-haiku-5-5","claude-fable-5-2","claude-fable-5-1","claude-opus-5","claude-sonnet-5","claude-fable-5","claude-opus-4-8","claude-sonnet-4-6","claude-haiku-4-5"];class bQ extends YQ{model;capabilities;config;constructor(Q,$={}){super();this.model=Q,this.capabilities=RQ(Q),this.config=$}static model(Q,$){return new bQ(Q,$)}static models(){return f6}stream(Q){return this.send(Q)}async*send(Q){let $=Q,J=!1,Z=new Set;for(;;){let Y=this.request($);if(J)Y=V5(Y);let G,V=!1;for await(let z of $Q(this.endpointFor(Y),Y,{signal:Q.signal,retryToolArgumentsTooLong:Q.retryToolArgumentsTooLong,structuredOutput:Boolean(Q.output),parse:j5})){if(G)continue;if(!V&&z.type==="error"&&z.status===400){let j=W5(z.error.message);if(j&&!Z.has(j)){Z.add(j),G=j;continue}}if(e(z))V=!0;yield z}if(!G)return;if(G==="thinking")J=!0;else if($.output)$={...$,output:{...$.output,strict:!1}}}}request(Q){return G5(Q,{model:this.deployment(),modelId:this.model,capabilities:this.capabilities,forcedToolChoice:this.capabilities.supportsForcedToolChoice!==!1,blockBinding:this.bindsThinking()})}endpointFor(Q){let $=this.endpoint();if(!(Q.thinking?.type==="adaptive"&&Q.thinking.block_binding))return $;return{...$,headers:async()=>{let Z=await $.headers(),Y=Z["anthropic-beta"];return{...Z,"anthropic-beta":Y?`${Y},${MQ}`:MQ}}}}bindsThinking(){return!0}deployment(){return this.model}upload(Q){return JQ(this.endpoint(),Q,null)}endpoint(){return x5(U5(this.config))}}function x5(Q){return{...QQ(Q),responsesUrl:`${Q.base}/messages`}}class O5 extends bQ{constructor(Q,$={}){super(Q,$);this.capabilities={...RQ(Q),fileInput:!1}}static model(Q,$){return new O5(Q,$)}upload(Q){return Promise.reject(Error("AzureAnthropicProvider does not upload files: the Files API is not available on Azure-hosted Foundry deployments. The file is still stored by gemi and named to the model by its attachment id."))}deployment(){return this.config.deployment??this.model}bindsThinking(){return!1}endpoint(){return x5(C5(this.config))}}class S5 extends YQ{model;capabilities;config;constructor(Q,$={}){super();this.model=Q,this.capabilities=_Q(Q),this.config=$}static model(Q,$){return new S5(Q,$)}static models(){return P5}stream(Q){let $=PQ(Q,{model:this.deployment(),capabilities:this.capabilities});return $Q(this.endpoint(),$,{signal:Q.signal,retryToolArgumentsTooLong:Q.retryToolArgumentsTooLong,structuredOutput:Boolean(Q.output),files:jQ(Q.messages)})}upload(Q){return JQ(this.endpoint(),Q,"assistants")}deployment(){return this.config.deployment??this.model}endpoint(){return QQ(vQ(this.config))}get realtime(){return new o(N5(this.config,{timeoutMs:BQ}),{model:this.deployment(),callFlow:"ephemeral"})}}
9
- export{c as ca,kQ as da,vQ as ea,XQ as fa,k5 as ga,HQ as ha,m as ia,o as ja,y5 as ka,YQ as la,D5 as ma,bQ as na,O5 as oa,S5 as pa};
10
-
11
- //# debugId=8F0C1B5568F3A5AE64756E2164756E21