@bkm016/basalt 0.1.12 → 0.1.14

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 (288) hide show
  1. package/README.md +3 -2
  2. package/chunk-03wzwnn6.js +2 -0
  3. package/{chunk-7jezts2n.js → chunk-06s9pr82.js} +2 -2
  4. package/{chunk-eyrtbbdd.js → chunk-0crbhhna.js} +1 -1
  5. package/{chunk-kpe7pnhy.js → chunk-0rasqm8y.js} +4 -4
  6. package/chunk-1w4nh5t6.js +5 -0
  7. package/{chunk-02d3x4mj.js → chunk-2eaehpp6.js} +3 -3
  8. package/{chunk-jj4hqbrx.js → chunk-30dxcr91.js} +3 -3
  9. package/{chunk-nw1xpt3s.js → chunk-343jsm46.js} +2 -2
  10. package/{chunk-bk4rpnm8.js → chunk-37ndxehw.js} +2 -2
  11. package/chunk-38g4jd6v.js +5 -0
  12. package/{chunk-0fc9apfn.js → chunk-39mh7h58.js} +23 -23
  13. package/{chunk-6mges89p.js → chunk-44a7f5ta.js} +5 -5
  14. package/chunk-44b9yx79.js +2 -0
  15. package/{chunk-jn5pqy5v.js → chunk-46vy2m29.js} +1 -1
  16. package/{chunk-2kxnw7vs.js → chunk-4f6p4n7k.js} +2 -2
  17. package/chunk-4w8j6n7z.js +2 -0
  18. package/{chunk-qs8zzg50.js → chunk-4yxd2kg1.js} +2 -2
  19. package/{chunk-ksk49hv0.js → chunk-59hg9a84.js} +1 -1
  20. package/chunk-62ebm0bn.js +2 -0
  21. package/chunk-6ef085c1.js +20 -0
  22. package/chunk-6hx9y86d.js +3 -0
  23. package/chunk-73t051r6.js +2 -0
  24. package/{chunk-1h34mzh7.js → chunk-7mgkpn94.js} +7 -7
  25. package/{chunk-w0rr66z7.js → chunk-81x8r8w4.js} +1 -1
  26. package/chunk-86yr2c0r.js +3 -0
  27. package/{chunk-ypqjfv3a.js → chunk-8np9b2y8.js} +2 -2
  28. package/{chunk-hbnmymaq.js → chunk-9ew8cap5.js} +2 -2
  29. package/chunk-9v3b7jjv.js +2 -0
  30. package/{chunk-01nve4qy.js → chunk-9vam83py.js} +1 -1
  31. package/chunk-9xjecw6c.js +2 -0
  32. package/{chunk-6sz5q3df.js → chunk-b2wpj81x.js} +2 -2
  33. package/chunk-b516bp7n.js +3 -0
  34. package/chunk-bjvv3403.js +2 -0
  35. package/{chunk-hc300148.js → chunk-c8g9jjqs.js} +2 -2
  36. package/chunk-cs91rmbf.js +18 -0
  37. package/chunk-drett6hb.js +2 -0
  38. package/{chunk-fy82qxa1.js → chunk-edcf97ka.js} +1 -1
  39. package/chunk-en7z6ne5.js +3 -0
  40. package/{chunk-p2pmdbt2.js → chunk-evnqkyt7.js} +12 -12
  41. package/{chunk-8mezk0cb.js → chunk-g2etemv5.js} +2 -2
  42. package/{chunk-n0ybj4h9.js → chunk-g5p9mj1r.js} +2 -2
  43. package/{chunk-eq4wqxzt.js → chunk-ge38dhv9.js} +2 -2
  44. package/chunk-hggam3je.js +2 -0
  45. package/chunk-k38jaz6c.js +7 -0
  46. package/{chunk-qfcr5g35.js → chunk-kcn05erf.js} +3 -3
  47. package/{chunk-rwks9zaw.js → chunk-m5km74eq.js} +2 -2
  48. package/{chunk-jpnf71q7.js → chunk-mfb3dgs8.js} +2 -2
  49. package/{chunk-vjne04dp.js → chunk-mh4bjtfs.js} +4 -4
  50. package/chunk-nysatg77.js +4161 -0
  51. package/chunk-p886jr17.js +25 -0
  52. package/{chunk-82v8jh1h.js → chunk-pdt65s31.js} +2 -2
  53. package/chunk-pjgt1bdx.js +3 -0
  54. package/{chunk-tvm4zmgj.js → chunk-pyj6avd5.js} +2 -2
  55. package/chunk-qd2enpr2.js +3 -0
  56. package/{chunk-cbgpymt4.js → chunk-qe76naq9.js} +1 -1
  57. package/{chunk-ntks40jd.js → chunk-qjnx4fsn.js} +5 -5
  58. package/{chunk-fhxy6y34.js → chunk-qs161f2q.js} +2 -2
  59. package/{chunk-v7wcchy2.js → chunk-rghqprav.js} +1 -1
  60. package/chunk-t33bm5aa.js +2 -0
  61. package/{chunk-nrsd810j.js → chunk-tfhp09nj.js} +2 -2
  62. package/chunk-vd5332ps.js +2 -0
  63. package/{chunk-3pf1d62g.js → chunk-vqm94hz2.js} +2 -2
  64. package/{chunk-85v69h91.js → chunk-w55cnj0f.js} +2 -2
  65. package/{chunk-1zj3zvw5.js → chunk-wnd3y4c0.js} +4 -4
  66. package/{chunk-stj493dn.js → chunk-xafx1p7z.js} +2 -2
  67. package/{chunk-9as0p561.js → chunk-xf7zw32f.js} +14 -14
  68. package/chunk-xk3t5ves.js +482 -0
  69. package/{chunk-5wnmbc1b.js → chunk-xq74x4gc.js} +2 -2
  70. package/chunk-y0274xr2.js +7 -0
  71. package/{chunk-ejjem0tc.js → chunk-z9p6s986.js} +6 -6
  72. package/chunk-zcwz44db.js +2 -0
  73. package/{chunk-w6f2r052.js → chunk-zhyzhekt.js} +1 -1
  74. package/compiled.js +85 -12
  75. package/package.json +1 -1
  76. package/ui-test-worker.js +65 -65
  77. package/web/chunk-15g9pnzy.js +1 -0
  78. package/web/{chunk-4f6a8dsk.js → chunk-17wwzrp4.js} +1 -1
  79. package/web/chunk-19tkjg9w.js +1 -0
  80. package/web/chunk-1y387f45.js +1 -0
  81. package/web/{chunk-30aeb767.js → chunk-25sn840r.js} +2 -2
  82. package/web/chunk-26sp6jre.js +1 -0
  83. package/web/{chunk-81s15c2e.js → chunk-2c7kxr4v.js} +2 -2
  84. package/web/{chunk-wvrs986a.js → chunk-2gsf89vs.js} +3 -3
  85. package/web/{chunk-3qxxrwsp.js → chunk-2gvz70wr.js} +10 -10
  86. package/web/chunk-2s3my1jn.js +1 -0
  87. package/web/{chunk-ar6jnhm5.js → chunk-32dh0hft.js} +1 -1
  88. package/web/{chunk-3rkkp6ed.js → chunk-3haw3wcw.js} +5 -5
  89. package/web/{chunk-hn8m1vsg.js → chunk-3rxhs9qm.js} +7 -7
  90. package/web/chunk-410qdvmv.js +1 -0
  91. package/web/chunk-4qehf2xx.js +2 -0
  92. package/web/{chunk-qdd3bx8q.js → chunk-51b8n5e1.js} +1 -1
  93. package/web/chunk-54mgncq3.js +1 -0
  94. package/web/{chunk-r6kk4vp1.js → chunk-59g6rrew.js} +4 -4
  95. package/web/{chunk-7tkgbbf9.js → chunk-5d9veaef.js} +2 -2
  96. package/web/chunk-6481wt3t.js +1 -0
  97. package/web/chunk-6ehecat3.js +1 -0
  98. package/web/chunk-6m8hq6ph.js +1 -0
  99. package/web/chunk-73941p08.js +1 -0
  100. package/web/{chunk-aeymdtm1.js → chunk-783s8jds.js} +3 -3
  101. package/web/{chunk-g4zm0crw.js → chunk-78m018ya.js} +1 -1
  102. package/web/chunk-797bh7z6.js +39 -0
  103. package/web/{chunk-hva7xyne.js → chunk-7hpqrfgg.js} +2 -2
  104. package/web/{chunk-enwfd8d5.js → chunk-7kywe73f.js} +2 -2
  105. package/web/chunk-7qq1ypvj.js +1 -0
  106. package/web/{chunk-xbyrgyy0.js → chunk-7wzszsf5.js} +2 -2
  107. package/web/{chunk-aa46mrgh.js → chunk-7zfqppsx.js} +2 -2
  108. package/web/{chunk-d73zkc4q.js → chunk-8sr9w61v.js} +3 -3
  109. package/web/{chunk-v34mr9ky.js → chunk-8ttp8fh3.js} +6 -6
  110. package/web/chunk-8zg89764.js +1 -0
  111. package/web/{chunk-2cyzaqjy.js → chunk-988e9wx6.js} +3 -3
  112. package/web/{chunk-k4dnjf8n.js → chunk-9h0f3gar.js} +3 -3
  113. package/web/chunk-9vr6hpmk.js +34 -0
  114. package/web/chunk-9vrp249f.js +2 -0
  115. package/web/{chunk-td83xf12.js → chunk-a205cj09.js} +2 -2
  116. package/web/{chunk-gkmaryr4.js → chunk-ahn2frbt.js} +1 -1
  117. package/web/{chunk-5g8md2wg.js → chunk-aknsydan.js} +5 -5
  118. package/web/chunk-at0xtfhy.js +1 -0
  119. package/web/chunk-bahccwb9.js +1 -0
  120. package/web/{chunk-rdr6wt22.js → chunk-c7fqrs8j.js} +4 -4
  121. package/web/chunk-d3hyf9yd.js +1 -0
  122. package/web/chunk-dcegr80c.js +1 -0
  123. package/web/{chunk-act3rr85.js → chunk-dwtatme7.js} +1 -1
  124. package/web/{chunk-5np514v5.js → chunk-ex8rmqn1.js} +12 -12
  125. package/web/{chunk-g488hxx0.js → chunk-faskbfjf.js} +3 -3
  126. package/web/chunk-feanedhx.js +1 -0
  127. package/web/{chunk-e94pd9rr.js → chunk-ffywf5w5.js} +10 -10
  128. package/web/chunk-fx3d48e6.js +1 -0
  129. package/web/{chunk-ncfzmf2g.js → chunk-g3szt4c4.js} +1 -1
  130. package/web/chunk-g7bcntpm.js +1 -0
  131. package/web/chunk-gr1tjqbd.js +1 -0
  132. package/web/{chunk-bygwbpvq.js → chunk-hbwxtbq3.js} +2 -2
  133. package/web/{chunk-gten0rpx.js → chunk-hdtvrh0f.js} +2 -2
  134. package/web/chunk-j031r08w.js +1 -0
  135. package/web/{chunk-d57fm7k0.js → chunk-j6wcszxq.js} +2 -2
  136. package/web/{chunk-885kpj14.js → chunk-jdx7qp2w.js} +2 -2
  137. package/web/chunk-jge7nn3s.js +1 -0
  138. package/web/chunk-jy8zat04.js +1 -0
  139. package/web/{chunk-7vgh17es.js → chunk-jzge034r.js} +1 -1
  140. package/web/{chunk-fj753yzt.js → chunk-k4qrqmdk.js} +2 -2
  141. package/web/chunk-k8s7kye3.js +1 -0
  142. package/web/{chunk-2jfesv7m.js → chunk-k9fyqrhp.js} +2 -2
  143. package/web/chunk-k9zn1n6d.js +1 -0
  144. package/web/chunk-kg3tksv7.js +1 -0
  145. package/web/chunk-kk5rw81s.js +2 -0
  146. package/web/{chunk-xpecre7w.js → chunk-kpmd893m.js} +4 -4
  147. package/web/chunk-md9j949p.js +1 -0
  148. package/web/{chunk-jeafmjsm.js → chunk-mn2wv9ye.js} +6 -6
  149. package/web/{chunk-dndd757x.js → chunk-mv7jgmnb.js} +3 -3
  150. package/web/{chunk-c3fty2c2.js → chunk-mvm68qtt.js} +7 -7
  151. package/web/chunk-nbcpbqq4.js +1 -0
  152. package/web/{chunk-b99k8q22.js → chunk-nfpff7yf.js} +8 -8
  153. package/web/chunk-nk7jkpam.js +1 -0
  154. package/web/chunk-nmvt1rn3.js +1 -0
  155. package/web/chunk-npw1s1h2.js +1 -0
  156. package/web/chunk-npyrdsf8.css +1 -0
  157. package/web/chunk-nzzxv84v.js +8 -0
  158. package/web/{chunk-n9v14vyd.js → chunk-p4pqtybm.js} +22 -22
  159. package/web/{chunk-jyf7a7yp.js → chunk-p79c7aak.js} +1 -1
  160. package/web/{chunk-6jb2zyp6.js → chunk-pafw34vg.js} +2 -2
  161. package/web/{chunk-y2rzeb4v.js → chunk-pf65cank.js} +2 -2
  162. package/web/{chunk-d1btrqmw.js → chunk-ppa21760.js} +1 -1
  163. package/web/{chunk-60mym60n.js → chunk-ptpkv0te.js} +1 -1
  164. package/web/{chunk-yjs6jmdb.js → chunk-qcdej581.js} +3 -3
  165. package/web/{chunk-q1zxvjhs.js → chunk-qftcdcps.js} +2 -2
  166. package/web/{chunk-4wwd3pfz.js → chunk-qv1w36ja.js} +2 -2
  167. package/web/chunk-r8p741qj.js +2 -0
  168. package/web/chunk-rcexbkjj.js +1 -0
  169. package/web/{chunk-kerfb21g.js → chunk-rjakb64x.js} +1 -1
  170. package/web/{chunk-k0cg4n2k.js → chunk-s0xy00v5.js} +2 -2
  171. package/web/{chunk-ym7kv2hs.js → chunk-s2ps0ct5.js} +1 -1
  172. package/web/{chunk-h24ybwp6.js → chunk-s45g7fp6.js} +1 -1
  173. package/web/{chunk-pjpre6de.js → chunk-s70aj1v5.js} +6 -6
  174. package/web/chunk-say8bvkc.js +1 -0
  175. package/web/{chunk-qh62nkem.js → chunk-sd3cdqcm.js} +2 -2
  176. package/web/{chunk-6f2sz84q.js → chunk-sgkevxdf.js} +2 -2
  177. package/web/chunk-sjffrcq9.js +1 -0
  178. package/web/{chunk-19zd0tye.js → chunk-snaepr87.js} +8 -8
  179. package/web/{chunk-3n9ypydh.js → chunk-tdzh6nsz.js} +2 -2
  180. package/web/{chunk-wqzbxzk3.js → chunk-tjd8qp87.js} +1 -1
  181. package/web/chunk-tncc9e57.js +1 -0
  182. package/web/chunk-ty2rmwda.js +1142 -0
  183. package/web/chunk-v22hp18w.js +1 -0
  184. package/web/chunk-ve9dz857.js +2 -0
  185. package/web/{chunk-80z8s8zb.js → chunk-vg346gxc.js} +2 -2
  186. package/web/{chunk-hqxc9m07.js → chunk-vpegzgzb.js} +10 -10
  187. package/web/{chunk-pzg25qqe.js → chunk-vvvd3grf.js} +2 -2
  188. package/web/{chunk-qp3tjhaq.js → chunk-vwv6pqy7.js} +1 -1
  189. package/web/{chunk-3psgr0q8.js → chunk-vxm7n7w6.js} +20 -20
  190. package/web/{chunk-h754ntg7.js → chunk-w5q7978e.js} +1 -1
  191. package/web/{chunk-xvfeq8v2.js → chunk-we4mhfmq.js} +12 -12
  192. package/web/{chunk-8539865x.js → chunk-wfgrdabk.js} +1 -1
  193. package/web/{chunk-sdr5wa4z.js → chunk-wkhj4hsw.js} +4 -4
  194. package/web/{chunk-7ksg3ccg.js → chunk-wspk8qbg.js} +2 -2
  195. package/web/{chunk-hxbfkdjd.js → chunk-xf1hnpme.js} +1 -1
  196. package/web/{chunk-v1hfbjz9.js → chunk-xhqvzmfj.js} +5 -5
  197. package/web/chunk-xq70hgre.js +1 -0
  198. package/web/chunk-xtss82z2.js +1 -0
  199. package/web/{chunk-yf8ykk4v.js → chunk-y3tb6410.js} +3 -3
  200. package/web/{chunk-7v85yvb2.js → chunk-y6mcxfm0.js} +1 -1
  201. package/web/{chunk-7adsmqv6.js → chunk-ya696bfe.js} +2 -2
  202. package/web/{chunk-w9gnqkez.js → chunk-ysw5fs45.js} +3 -3
  203. package/web/chunk-zkq1xknc.js +1 -0
  204. package/web/chunk-zkv025s5.js +1 -0
  205. package/web/{chunk-8cnjd0f2.js → chunk-zpzvz973.js} +28 -28
  206. package/web/{chunk-b5zf1hs3.js → chunk-zsat72qd.js} +120 -120
  207. package/web/chunk-zx3h7v72.js +1 -0
  208. package/web/index.html +1 -1
  209. package/worker.js +1 -1
  210. package/chunk-1xfv4bd7.js +0 -2
  211. package/chunk-2fyjph3f.js +0 -2
  212. package/chunk-37zystxb.js +0 -25
  213. package/chunk-3k627vf2.js +0 -3
  214. package/chunk-4gtgqcct.js +0 -5
  215. package/chunk-7er5pz7s.js +0 -479
  216. package/chunk-7g5smgjj.js +0 -2
  217. package/chunk-7m3jagqn.js +0 -2
  218. package/chunk-9c4gdg1q.js +0 -3
  219. package/chunk-b2bxqeb4.js +0 -2
  220. package/chunk-bpw6q7g0.js +0 -3
  221. package/chunk-bwawt15q.js +0 -3
  222. package/chunk-cdw03j4t.js +0 -20
  223. package/chunk-ch1r3ted.js +0 -2
  224. package/chunk-cmwdjes8.js +0 -18
  225. package/chunk-db7ws33a.js +0 -7
  226. package/chunk-e1x629v0.js +0 -5
  227. package/chunk-j64dc767.js +0 -3
  228. package/chunk-m4bg1apa.js +0 -7
  229. package/chunk-nhm9z3d8.js +0 -2
  230. package/chunk-pnspvnyd.js +0 -2
  231. package/chunk-qnkrrwmg.js +0 -2
  232. package/chunk-r4gm8ngh.js +0 -2
  233. package/chunk-rks90mh1.js +0 -2
  234. package/chunk-t7te60m7.js +0 -2
  235. package/chunk-tv52xajf.js +0 -2
  236. package/chunk-wqqjzsjt.js +0 -3983
  237. package/chunk-xef4642x.js +0 -3
  238. package/web/chunk-04drx71p.js +0 -1
  239. package/web/chunk-0mdf1qja.js +0 -1
  240. package/web/chunk-0rdgt4jb.css +0 -1
  241. package/web/chunk-1m0kp0g3.js +0 -8
  242. package/web/chunk-3j2tcphs.js +0 -1
  243. package/web/chunk-3k9h7a73.js +0 -1142
  244. package/web/chunk-3m1bb2fw.js +0 -1
  245. package/web/chunk-55nvm2mj.js +0 -1
  246. package/web/chunk-5dkqfnh7.js +0 -2
  247. package/web/chunk-7ky5nrrr.js +0 -1
  248. package/web/chunk-8sdjgv3k.js +0 -1
  249. package/web/chunk-9bxtzwtc.js +0 -1
  250. package/web/chunk-9jy8nc4r.js +0 -1
  251. package/web/chunk-aebrw6cv.js +0 -39
  252. package/web/chunk-bcjgzwef.js +0 -1
  253. package/web/chunk-bra33pt0.js +0 -2
  254. package/web/chunk-cxpnj495.js +0 -2
  255. package/web/chunk-d94t9z70.js +0 -1
  256. package/web/chunk-de29pe57.js +0 -1
  257. package/web/chunk-e68jw0bg.js +0 -1
  258. package/web/chunk-fr4fft89.js +0 -1
  259. package/web/chunk-gckmcef6.js +0 -1
  260. package/web/chunk-gnb09wmx.js +0 -1
  261. package/web/chunk-gx340asc.js +0 -1
  262. package/web/chunk-hrgqc1vr.js +0 -1
  263. package/web/chunk-j9c8fa82.js +0 -1
  264. package/web/chunk-jz5mmp64.js +0 -1
  265. package/web/chunk-kxeaj44h.js +0 -1
  266. package/web/chunk-m0136xav.js +0 -1
  267. package/web/chunk-m1rdyvb5.js +0 -1
  268. package/web/chunk-m6vyvgm5.js +0 -1
  269. package/web/chunk-mxkbmgcv.js +0 -2
  270. package/web/chunk-my0ec787.js +0 -1
  271. package/web/chunk-mzzaet63.js +0 -1
  272. package/web/chunk-nkpdd9hw.js +0 -1
  273. package/web/chunk-ny436sqg.js +0 -1
  274. package/web/chunk-pbp1p5ex.js +0 -1
  275. package/web/chunk-ph75hddv.js +0 -1
  276. package/web/chunk-phdfyqaa.js +0 -1
  277. package/web/chunk-phxa5krt.js +0 -1
  278. package/web/chunk-r4zbw4zj.js +0 -2
  279. package/web/chunk-ry4ycah9.js +0 -1
  280. package/web/chunk-sqm16fat.js +0 -1
  281. package/web/chunk-tj1fn8v2.js +0 -1
  282. package/web/chunk-v0wtk059.js +0 -34
  283. package/web/chunk-v1qt3gq4.js +0 -1
  284. package/web/chunk-v854w9yn.js +0 -1
  285. package/web/chunk-ve56gxq0.js +0 -1
  286. package/web/chunk-w573ym17.js +0 -1
  287. package/web/chunk-x0mjydtp.js +0 -1
  288. package/web/chunk-zhybh04p.js +0 -1
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{pn}from"./chunk-9as0p561.js";import"./chunk-eq4wqxzt.js";import"./chunk-4gtgqcct.js";import{mr,jo}from"./chunk-2kxnw7vs.js";import{at,Je,lt}from"./chunk-ntks40jd.js";import{Ge}from"./chunk-bpw6q7g0.js";import{ae}from"./chunk-3pf1d62g.js";import{ee}from"./chunk-tvm4zmgj.js";import{q,V}from"./chunk-ypqjfv3a.js";import{Te,ct,K}from"./chunk-fhxy6y34.js";import{j}from"./chunk-nrsd810j.js";import{re,be,Se,G}from"./chunk-ejjem0tc.js";import{L}from"./chunk-qs8zzg50.js";var g=new Set(["openai","openai-codex","opencode","azure"]),h=16;function y(r){return V(q(r),"Azure OpenAI API error")}var A=(r,a,e)=>{let t=new L,i=re(a,r.compat?.supportsMidConvoSystemMessages);return(async()=>{let n=mr(r,e),s={role:"assistant",content:[],api:"azure-openai-responses",provider:r.provider,model:r.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{let p=e?.apiKey;if(!p)throw Error(`No API key for provider: ${r.provider}`);let c=R(r,p,e),o=Te(be(i.messages),r.compat?.supportsOpenAIGrammarTools??!1),m=T(r,i,e,n,o),u=await e?.onPayload?.(m,r);if(u!==void 0)m=u;let f={...e?.signal?{signal:e.signal}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{},maxRetries:0},{data:d,response:l}=await ae(()=>c.responses.create(m,f).withResponse(),{maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,signal:e?.signal});if(await e?.onResponse?.({status:l.status,headers:j(l.headers)},r),t.push({type:"start",partial:s}),await lt(d,s,t,r,{onProviderStreamEvent:e?.onProviderStreamEvent,grammarToolInputProperties:o}),e?.signal?.aborted)throw Error("Request was aborted");if(s.stopReason==="pending")throw Error("Azure OpenAI Responses stream ended without a stop reason");if(s.stopReason==="aborted"||s.stopReason==="error")throw Error(s.errorMessage||"An unknown error occurred");t.push({type:"done",reason:s.stopReason,message:s}),t.end()}catch(p){for(let c of s.content)delete c.index,delete c.partialJson,delete c.customInput;s.stopReason=e?.signal?.aborted?"aborted":"error",s.errorMessage=y(p),t.push({type:"error",reason:s.stopReason,error:s}),t.end()}})(),t},z=(r,a,e)=>{let t=e?.apiKey;if(!t)throw Error(`No API key for provider: ${r.provider}`);let i={...K(r,a,e,t),toolChoice:e?.toolChoice},n=e?.reasoning?G(r,e.reasoning):void 0;return A(r,a,{...i,reasoningEffort:n==="off"?void 0:n})};function R(r,a,e){let t={"User-Agent":ee(),...r.headers};if(e?.headers)Object.assign(t,e.headers);let{baseUrl:i,apiVersion:n}=jo(r,e);return new pn({apiKey:a,apiVersion:n,dangerouslyAllowBrowser:!0,fetch:e?.fetch,defaultHeaders:t,baseURL:i})}function T(r,a,e,t,i=Te(be(a.messages),r.compat?.supportsOpenAIGrammarTools??!1)){let n=r.compat?.supportsAdditionalTools??!1,s=r.compat?.supportsToolSearch??!1,p=Se(a.messages,n||s),c=at(r,a,g,{grammarToolInputProperties:i,supportsMidConvoSystemMessages:r.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools:n,supportsToolSearch:s,toolOptions:{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1}}),o={model:t,input:c,stream:!0,prompt_cache_key:Ge(e?.sessionId),store:!1};if(e?.maxTokens)o.max_output_tokens=Math.max(e.maxTokens,h);if(e?.temperature!==void 0)o.temperature=e?.temperature;if(p.requestTools.length>0)o.tools=Je(p.requestTools,{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1});if(e?.toolChoice!==void 0)o.tool_choice=e.toolChoice;let m=e?.reasoningEffort??(e?.reasoningSummary?"medium":void 0);if(r.reasoning){if(m){let f=e?.reasoningEffort?r.thinkingLevelMap?.[e.reasoningEffort]??e.reasoningEffort:m;o.reasoning={effort:f,summary:e?.reasoningSummary||"auto"},o.include=["reasoning.encrypted_content"]}else if(r.thinkingLevelMap?.off!==null)o.reasoning={effort:r.thinkingLevelMap?.off??"none"}}let u=ct(r,m??"off",e?.samplingParams);if(u)Object.assign(o,u);return o}export{A as stream,z as streamSimple};
2
+ import{Bn}from"./chunk-xf7zw32f.js";import"./chunk-ge38dhv9.js";import"./chunk-38g4jd6v.js";import{wr,ai}from"./chunk-4f6p4n7k.js";import{ut,tt,pt}from"./chunk-qjnx4fsn.js";import{Ke}from"./chunk-86yr2c0r.js";import{oe}from"./chunk-pyj6avd5.js";import{ue}from"./chunk-vqm94hz2.js";import{Re,dt,X}from"./chunk-qs161f2q.js";import{V,J}from"./chunk-8np9b2y8.js";import{Q}from"./chunk-tfhp09nj.js";import{se,xe,ve,K}from"./chunk-z9p6s986.js";import{U}from"./chunk-4yxd2kg1.js";var g=new Set(["openai","openai-codex","opencode","azure"]),h=16;function y(r){return J(V(r),"Azure OpenAI API error")}var A=(r,a,e)=>{let t=new U,i=se(a,r.compat?.supportsMidConvoSystemMessages);return(async()=>{let n=wr(r,e),s={role:"assistant",content:[],api:"azure-openai-responses",provider:r.provider,model:r.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{let p=e?.apiKey;if(!p)throw Error(`No API key for provider: ${r.provider}`);let c=R(r,p,e),o=Re(xe(i.messages),r.compat?.supportsOpenAIGrammarTools??!1),m=T(r,i,e,n,o),u=await e?.onPayload?.(m,r);if(u!==void 0)m=u;let f={...e?.signal?{signal:e.signal}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{},maxRetries:0},{data:d,response:l}=await ue(()=>c.responses.create(m,f).withResponse(),{maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,signal:e?.signal});if(await e?.onResponse?.({status:l.status,headers:Q(l.headers)},r),t.push({type:"start",partial:s}),await pt(d,s,t,r,{onProviderStreamEvent:e?.onProviderStreamEvent,grammarToolInputProperties:o}),e?.signal?.aborted)throw Error("Request was aborted");if(s.stopReason==="pending")throw Error("Azure OpenAI Responses stream ended without a stop reason");if(s.stopReason==="aborted"||s.stopReason==="error")throw Error(s.errorMessage||"An unknown error occurred");t.push({type:"done",reason:s.stopReason,message:s}),t.end()}catch(p){for(let c of s.content)delete c.index,delete c.partialJson,delete c.customInput;s.stopReason=e?.signal?.aborted?"aborted":"error",s.errorMessage=y(p),t.push({type:"error",reason:s.stopReason,error:s}),t.end()}})(),t},z=(r,a,e)=>{let t=e?.apiKey;if(!t)throw Error(`No API key for provider: ${r.provider}`);let i={...X(r,a,e,t),toolChoice:e?.toolChoice},n=e?.reasoning?K(r,e.reasoning):void 0;return A(r,a,{...i,reasoningEffort:n==="off"?void 0:n})};function R(r,a,e){let t={"User-Agent":oe(),...r.headers};if(e?.headers)Object.assign(t,e.headers);let{baseUrl:i,apiVersion:n}=ai(r,e);return new Bn({apiKey:a,apiVersion:n,dangerouslyAllowBrowser:!0,fetch:e?.fetch,defaultHeaders:t,baseURL:i})}function T(r,a,e,t,i=Re(xe(a.messages),r.compat?.supportsOpenAIGrammarTools??!1)){let n=r.compat?.supportsAdditionalTools??!1,s=r.compat?.supportsToolSearch??!1,p=ve(a.messages,n||s),c=ut(r,a,g,{grammarToolInputProperties:i,supportsMidConvoSystemMessages:r.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools:n,supportsToolSearch:s,toolOptions:{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1}}),o={model:t,input:c,stream:!0,prompt_cache_key:Ke(e?.sessionId),store:!1};if(e?.maxTokens)o.max_output_tokens=Math.max(e.maxTokens,h);if(e?.temperature!==void 0)o.temperature=e?.temperature;if(p.requestTools.length>0)o.tools=tt(p.requestTools,{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1});if(e?.toolChoice!==void 0)o.tool_choice=e.toolChoice;let m=e?.reasoningEffort??(e?.reasoningSummary?"medium":void 0);if(r.reasoning){if(m){let f=e?.reasoningEffort?r.thinkingLevelMap?.[e.reasoningEffort]??e.reasoningEffort:m;o.reasoning={effort:f,summary:e?.reasoningSummary||"auto"},o.include=["reasoning.encrypted_content"]}else if(r.thinkingLevelMap?.off!==null)o.reasoning={effort:r.thinkingLevelMap?.off??"none"}}let u=dt(r,m??"off",e?.samplingParams);if(u)Object.assign(o,u);return o}export{A as stream,z as streamSimple};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ function Ke(_){if(_===void 0)return;let n=Array.from(_);if(n.length<=64)return _;return n.slice(0,64).join("")}
3
+ export{Ke};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function q(t){if(!(t instanceof Error))return{message:u(t),messageCarriesBody:!1};let e=t,n=d(e),s=o(e),r=s===void 0||t.message.includes(s);return{status:n,body:s,message:t.message,messageCarriesBody:r}}function d(t){if(typeof t.statusCode==="number")return t.statusCode;if(typeof t.status==="number")return t.status;if(typeof t.$metadata?.httpStatusCode==="number")return t.$metadata.httpStatusCode;if(typeof t.$response?.statusCode==="number")return t.$response.statusCode;return}function o(t){let e=f(t);if(e===void 0)return;let n=e.trim();if(n.length===0)return;return c(n,4000)}function f(t){if(typeof t.body==="string")return t.body;if(i(t.error))return u(t.error);let e=t.$response?.body;if(typeof e==="string")return e;if(a(e))return;if(i(e))return u(e);return}function a(t){return typeof t==="object"&&t!==null&&"pipe"in t&&typeof t.pipe==="function"}function i(t){if(typeof t!=="object"||t===null)return!1;let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return!1;return Object.keys(t).length>0}function V(t,e){if(t.messageCarriesBody||t.status===void 0||t.body===void 0)return e!==void 0&&t.status!==void 0?`${e} (${t.status}): ${t.message}`:t.message;return e!==void 0?`${e} (${t.status}): ${t.body}`:`${t.status}: ${t.body}`}function c(t,e){if(t.length<=e)return t;return`${t.slice(0,e)}... [truncated ${t.length-e} chars]`}function u(t){try{let e=JSON.stringify(t);return e===void 0?String(t):e}catch{return String(t)}}
3
- export{q,V};
2
+ function V(t){if(!(t instanceof Error))return{message:u(t),messageCarriesBody:!1};let e=t,n=d(e),s=o(e),r=s===void 0||t.message.includes(s);return{status:n,body:s,message:t.message,messageCarriesBody:r}}function d(t){if(typeof t.statusCode==="number")return t.statusCode;if(typeof t.status==="number")return t.status;if(typeof t.$metadata?.httpStatusCode==="number")return t.$metadata.httpStatusCode;if(typeof t.$response?.statusCode==="number")return t.$response.statusCode;return}function o(t){let e=f(t);if(e===void 0)return;let n=e.trim();if(n.length===0)return;return c(n,4000)}function f(t){if(typeof t.body==="string")return t.body;if(i(t.error))return u(t.error);let e=t.$response?.body;if(typeof e==="string")return e;if(a(e))return;if(i(e))return u(e);return}function a(t){return typeof t==="object"&&t!==null&&"pipe"in t&&typeof t.pipe==="function"}function i(t){if(typeof t!=="object"||t===null)return!1;let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return!1;return Object.keys(t).length>0}function J(t,e){if(t.messageCarriesBody||t.status===void 0||t.body===void 0)return e!==void 0&&t.status!==void 0?`${e} (${t.status}): ${t.message}`:t.message;return e!==void 0?`${e} (${t.status}): ${t.body}`:`${t.status}: ${t.body}`}function c(t,e){if(t.length<=e)return t;return`${t.slice(0,e)}... [truncated ${t.length-e} chars]`}function u(t){try{let e=JSON.stringify(t);return e===void 0?String(t):e}catch{return String(t)}}
3
+ export{V,J};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{b,H}from"./chunk-cmwdjes8.js";import{i}from"./chunk-bwawt15q.js";var I=i(b());var h=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.AccessKeyId==="string"&&typeof e.SecretAccessKey==="string"&&typeof e.Token==="string"&&typeof e.Expiration==="string",C=(e)=>({accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:new Date(e.Expiration),...e.AccountId&&{accountId:e.AccountId}});var v=({maxRetries:e=0,timeout:t=1000})=>({maxRetries:e,timeout:t});var g=i(b());import y from"http";function _(e){return new Promise((t,n)=>{let o=y.request({method:"GET",...e,hostname:e.hostname?.replace(/^\[(.+)\]$/,"$1")});o.on("error",(r)=>{n(Object.assign(new g.ProviderError("Unable to connect to instance metadata service"),r)),o.destroy()}),o.on("timeout",()=>{n(new g.ProviderError("TimeoutError from instance metadata service")),o.destroy()}),o.on("response",(r)=>{let{statusCode:a=400}=r;if(a<200||300<=a)n(Object.assign(new g.ProviderError("Error response received from instance metadata service"),{statusCode:a})),o.destroy();let m=[];r.on("data",(s)=>{m.push(s)}),r.on("end",()=>{t(Buffer.concat(m)),o.destroy()})}),o.end()})}var A=(e,t)=>{let n=e();for(let o=0;o<t;o++)n=n.catch(e);return n};var S="AWS_CONTAINER_CREDENTIALS_FULL_URI",O="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",w="AWS_CONTAINER_AUTHORIZATION_TOKEN",Y=(e={})=>{let{timeout:t,maxRetries:n}=v(e);return()=>A(async()=>{let o=await Z({logger:e.logger}),r=JSON.parse(await j(t,o));if(!h(r))throw new I.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:e.logger});return C(r)},n)},j=async(e,t)=>{if(process.env[w])t.headers={...t.headers,Authorization:process.env[w]};return(await _({...t,timeout:e})).toString()},J="169.254.170.2",X=new Set(["localhost","127.0.0.1"]),z=new Set(["http:","https:"]),Z=async({logger:e})=>{if(process.env[O])return{hostname:J,path:process.env[O]};if(process.env[S]){let t;try{t=new URL(process.env[S])}catch{throw new I.CredentialsProviderError(`${process.env[S]} is not a valid container metadata service URL`,{tryNextLink:!1,logger:e})}if(!t.hostname||!X.has(t.hostname))throw new I.CredentialsProviderError(`${t.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:e});if(!t.protocol||!z.has(t.protocol))throw new I.CredentialsProviderError(`${t.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:e});return{protocol:t.protocol,hostname:t.hostname,path:t.pathname+t.search,port:t.port?parseInt(t.port,10):void 0}}throw new I.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${O} or ${S} environment variable is set`,{tryNextLink:!1,logger:e})};var N=i(b());var P=i(b());class D extends P.CredentialsProviderError{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(e,t=!0){super(e,t);this.tryNextLink=t,Object.setPrototypeOf(this,D.prototype)}}var M=i(b()),V=i(H());var u;(function(e){e.IPv4="http://169.254.169.254",e.IPv6="http://[fd00:ec2::254]"})(u||(u={}));var L={environmentVariableSelector:(e)=>e.AWS_EC2_METADATA_SERVICE_ENDPOINT,configFileSelector:(e)=>e.ec2_metadata_service_endpoint,default:void 0};var p;(function(e){e.IPv4="IPv4",e.IPv6="IPv6"})(p||(p={}));var Q="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",ee="ec2_metadata_service_endpoint_mode",F={environmentVariableSelector:(e)=>e[Q],configFileSelector:(e)=>e[ee],default:p.IPv4};var k=async()=>V.parseUrl(await te()||await oe()),te=async()=>M.loadConfig(L)(),oe=async()=>{let e=await M.loadConfig(F)();switch(e){case p.IPv4:return u.IPv4;case p.IPv6:return u.IPv6;default:throw Error(`Unsupported endpoint mode: ${e}. Select from ${Object.values(p)}`)}};var x=(e,t)=>{let n=300+Math.floor(Math.random()*300),o=new Date(Date.now()+n*1000);t.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(o)}.
3
- For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);let r=e.originalExpiration??e.expiration;return{...e,...r?{originalExpiration:r}:{},expiration:o}};var U=(e,t={})=>{let n=t?.logger||console,o;return async()=>{let r;try{if(r=await e(),r.expiration&&r.expiration.getTime()<Date.now())r=x(r,n)}catch(a){if(o)n.warn("Credential renew failed: ",a),r=x(o,n);else throw a}return o=r,r}};var B="/latest/meta-data/iam/security-credentials/",re="/latest/api/token",R="AWS_EC2_METADATA_V1_DISABLED",W="ec2_metadata_v1_disabled",K="x-aws-ec2-metadata-token",ne=(e={})=>U(ae(e),{logger:e.logger}),ae=(e={})=>{let t=!1,{logger:n,profile:o}=e,{timeout:r,maxRetries:a}=v(e),m=async(s,f)=>{if(t||f.headers?.[K]==null){let c=!1,d=!1,q=await N.loadConfig({environmentVariableSelector:(l)=>{let E=l[R];if(d=!!E&&E!=="false",E===void 0)throw new N.CredentialsProviderError(`${R} not set in env, checking config file next.`,{logger:e.logger});return d},configFileSelector:(l)=>{let E=l[W];return c=!!E&&E!=="false",c},default:!1},{profile:o})();if(e.ec2MetadataV1Disabled||q){let l=[];if(e.ec2MetadataV1Disabled)l.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(c)l.push(`config file profile (${W})`);if(d)l.push(`process environment variable (${R})`);throw new D(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${l.join(", ")}].`)}}let G=(await A(async()=>{let c;try{c=await ie(f)}catch(d){if(d.statusCode===401)t=!1;throw d}return c},s)).trim();return A(async()=>{let c;try{c=await ce(G,f,e)}catch(d){if(d.statusCode===401)t=!1;throw d}return c},s)};return async()=>{let s=await k();if(t)return n?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),m(a,{...s,timeout:r});else{let f;try{f=(await se({...s,timeout:r})).toString()}catch(T){if(T?.statusCode===400)throw Object.assign(T,{message:"EC2 Metadata token request returned error"});else if(T.message==="TimeoutError"||[403,404,405].includes(T.statusCode))t=!0;return n?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),m(a,{...s,timeout:r})}return m(a,{...s,headers:{[K]:f},timeout:r})}}},se=async(e)=>_({...e,path:re,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),ie=async(e)=>(await _({...e,path:B})).toString(),ce=async(e,t,n)=>{let o=JSON.parse((await _({...t,path:B+e})).toString());if(!h(o))throw new N.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:n.logger});return C(o)};export{S as ENV_CMDS_FULL_URI,O as ENV_CMDS_RELATIVE_URI,Y as fromContainerMetadata,ne as fromInstanceMetadata};
2
+ import{v,z}from"./chunk-cs91rmbf.js";import{a}from"./chunk-qd2enpr2.js";var I=a(v());var h=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.AccessKeyId==="string"&&typeof e.SecretAccessKey==="string"&&typeof e.Token==="string"&&typeof e.Expiration==="string",C=(e)=>({accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:new Date(e.Expiration),...e.AccountId&&{accountId:e.AccountId}});var g=({maxRetries:e=0,timeout:t=1000})=>({maxRetries:e,timeout:t});var O=a(v());import P from"http";function _(e){return new Promise((t,n)=>{let o=P.request({method:"GET",...e,hostname:e.hostname?.replace(/^\[(.+)\]$/,"$1")});o.on("error",(r)=>{n(Object.assign(new O.ProviderError("Unable to connect to instance metadata service"),r)),o.destroy()}),o.on("timeout",()=>{n(new O.ProviderError("TimeoutError from instance metadata service")),o.destroy()}),o.on("response",(r)=>{let{statusCode:s=400}=r;if(s<200||300<=s)n(Object.assign(new O.ProviderError("Error response received from instance metadata service"),{statusCode:s})),o.destroy();let m=[];r.on("data",(i)=>{m.push(i)}),r.on("end",()=>{t(Buffer.concat(m)),o.destroy()})}),o.end()})}var A=(e,t)=>{let n=e();for(let o=0;o<t;o++)n=n.catch(e);return n};var S="AWS_CONTAINER_CREDENTIALS_FULL_URI",D="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",M="AWS_CONTAINER_AUTHORIZATION_TOKEN",q=(e={})=>{let{timeout:t,maxRetries:n}=g(e);return()=>A(async()=>{let o=await Z({logger:e.logger}),r=JSON.parse(await Y(t,o));if(!h(r))throw new I.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:e.logger});return C(r)},n)},Y=async(e,t)=>{if(process.env[M])t.headers={...t.headers,Authorization:process.env[M]};return(await _({...t,timeout:e})).toString()},j="169.254.170.2",J=new Set(["localhost","127.0.0.1"]),X=new Set(["http:","https:"]),Z=async({logger:e})=>{if(process.env[D])return{hostname:j,path:process.env[D]};if(process.env[S]){let t;try{t=new URL(process.env[S])}catch{throw new I.CredentialsProviderError(`${process.env[S]} is not a valid container metadata service URL`,{tryNextLink:!1,logger:e})}if(!t.hostname||!J.has(t.hostname))throw new I.CredentialsProviderError(`${t.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:e});if(!t.protocol||!X.has(t.protocol))throw new I.CredentialsProviderError(`${t.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:e});return{protocol:t.protocol,hostname:t.hostname,path:t.pathname+t.search,port:t.port?parseInt(t.port,10):void 0}}throw new I.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${D} or ${S} environment variable is set`,{tryNextLink:!1,logger:e})};var N=a(v());var L=a(v());class w extends L.CredentialsProviderError{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(e,t=!0){super(e,t);this.tryNextLink=t,Object.setPrototypeOf(this,w.prototype)}}var x=a(v()),V=a(z());var u;(function(e){e.IPv4="http://169.254.169.254",e.IPv6="http://[fd00:ec2::254]"})(u||(u={}));var F={environmentVariableSelector:(e)=>e.AWS_EC2_METADATA_SERVICE_ENDPOINT,configFileSelector:(e)=>e.ec2_metadata_service_endpoint,default:void 0};var p;(function(e){e.IPv4="IPv4",e.IPv6="IPv6"})(p||(p={}));var Q="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",ee="ec2_metadata_service_endpoint_mode",b={environmentVariableSelector:(e)=>e[Q],configFileSelector:(e)=>e[ee],default:p.IPv4};var k=async()=>V.parseUrl(await te()||await oe()),te=async()=>x.loadConfig(F)(),oe=async()=>{let e=await x.loadConfig(b)();switch(e){case p.IPv4:return u.IPv4;case p.IPv6:return u.IPv6;default:throw Error(`Unsupported endpoint mode: ${e}. Select from ${Object.values(p)}`)}};var R=(e,t)=>{let n=300+Math.floor(Math.random()*300),o=new Date(Date.now()+n*1000);t.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(o)}.
3
+ For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);let r=e.originalExpiration??e.expiration;return{...e,...r?{originalExpiration:r}:{},expiration:o}};var U=(e,t={})=>{let n=t?.logger||console,o;return async()=>{let r;try{if(r=await e(),r.expiration&&r.expiration.getTime()<Date.now())r=R(r,n)}catch(s){if(o)n.warn("Credential renew failed: ",s),r=R(o,n);else throw s}return o=r,r}};var B="/latest/meta-data/iam/security-credentials/",re="/latest/api/token",y="AWS_EC2_METADATA_V1_DISABLED",W="ec2_metadata_v1_disabled",K="x-aws-ec2-metadata-token",ne=(e={})=>U(ae(e),{logger:e.logger}),ae=(e={})=>{let t=!1,{logger:n,profile:o}=e,{timeout:r,maxRetries:s}=g(e),m=async(i,f)=>{if(t||f.headers?.[K]==null){let c=!1,d=!1,H=await N.loadConfig({environmentVariableSelector:(l)=>{let E=l[y];if(d=!!E&&E!=="false",E===void 0)throw new N.CredentialsProviderError(`${y} not set in env, checking config file next.`,{logger:e.logger});return d},configFileSelector:(l)=>{let E=l[W];return c=!!E&&E!=="false",c},default:!1},{profile:o})();if(e.ec2MetadataV1Disabled||H){let l=[];if(e.ec2MetadataV1Disabled)l.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(c)l.push(`config file profile (${W})`);if(d)l.push(`process environment variable (${y})`);throw new w(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${l.join(", ")}].`)}}let G=(await A(async()=>{let c;try{c=await ie(f)}catch(d){if(d.statusCode===401)t=!1;throw d}return c},i)).trim();return A(async()=>{let c;try{c=await ce(G,f,e)}catch(d){if(d.statusCode===401)t=!1;throw d}return c},i)};return async()=>{let i=await k();if(t)return n?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),m(s,{...i,timeout:r});else{let f;try{f=(await se({...i,timeout:r})).toString()}catch(T){if(T?.statusCode===400)throw Object.assign(T,{message:"EC2 Metadata token request returned error"});else if(T.message==="TimeoutError"||[403,404,405].includes(T.statusCode))t=!0;return n?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),m(s,{...i,timeout:r})}return m(s,{...i,headers:{[K]:f},timeout:r})}}},se=async(e)=>_({...e,path:re,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),ie=async(e)=>(await _({...e,path:B})).toString(),ce=async(e,t,n)=>{let o=JSON.parse((await _({...t,path:B+e})).toString());if(!h(o))throw new N.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:n.logger});return C(o)};export{S as ENV_CMDS_FULL_URI,D as ENV_CMDS_RELATIVE_URI,q as fromContainerMetadata,ne as fromInstanceMetadata};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qt,mo}from"./chunk-p886jr17.js";import"./chunk-ge38dhv9.js";import"./chunk-38g4jd6v.js";export{Qt as stream,mo as streamSimple};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{g}from"./chunk-9as0p561.js";import{ae}from"./chunk-3pf1d62g.js";import{q,V}from"./chunk-ypqjfv3a.js";import{y}from"./chunk-3k627vf2.js";import{j,ye}from"./chunk-nrsd810j.js";var P=async(e,s,t)=>{let a={api:e.api,provider:e.provider,model:e.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let r=t?.apiKey;if(!r)throw Error(`No API key for provider: ${e.provider}`);let c=x(e,r,t?.headers,t?.fetch),n=_(e,s),i=await t?.onPayload?.(n,e);if(i!==void 0)n=i;let o={...t?.signal?{signal:t.signal}:{},...t?.timeoutMs!==void 0?{timeout:t.timeoutMs}:{},maxRetries:0},{data:R,response:l}=await ae(()=>c.chat.completions.create(n,o).withResponse(),{maxRetries:t?.maxRetries,maxRetryDelayMs:t?.maxRetryDelayMs,signal:t?.signal});await t?.onResponse?.({status:l.status,headers:j(l.headers)},e);let u=R;if(a.responseId=u.id,u.usage)a.usage=k(u.usage,e);let p=u.choices[0];if(p){let m=p.message.content;if(typeof m==="string"&&m.length>0)a.output.push({type:"text",text:m});for(let d of p.message.images??[]){let f=typeof d.image_url==="string"?d.image_url:d.image_url?.url;if(!f?.startsWith("data:"))continue;let h=f.match(/^data:([^;]+);base64,(.+)$/);if(!h)continue;a.output.push({type:"image",mimeType:h[1],data:h[2]})}}return a}catch(r){return a.stopReason=t?.signal?.aborted?"aborted":"error",a.errorMessage=V(q(r)),a}};function x(e,s,t,a){return new g({apiKey:s,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:a,defaultHeaders:ye({...e.headers,...t})})}function _(e,s){let t=s.input.map((a)=>{if(a.type==="text")return{type:"text",text:y(a.text)};return{type:"image_url",image_url:{url:`data:${a.mimeType};base64,${a.data}`}}});return{model:e.id,messages:[{role:"user",content:t}],stream:!1,modalities:e.output.includes("text")?["image","text"]:["image"]}}function k(e,s){let t=e.prompt_tokens||0,a=e.prompt_tokens_details?.cached_tokens||0,r=e.prompt_tokens_details?.cache_write_tokens||0,c=r>0?Math.max(0,a-r):a,n=Math.max(0,t-c-r),i=e.completion_tokens||0,o={input:n,output:i,cacheRead:c,cacheWrite:r,totalTokens:n+i+c+r,cost:{input:s.cost.input/1e6*n,output:s.cost.output/1e6*i,cacheRead:s.cost.cacheRead/1e6*c,cacheWrite:s.cost.cacheWrite/1e6*r,total:0}};return o.cost.total=o.cost.input+o.cost.output+o.cost.cacheRead+o.cost.cacheWrite,o}export{P as generateImages};
2
+ import{S}from"./chunk-xf7zw32f.js";import{ue}from"./chunk-vqm94hz2.js";import{w}from"./chunk-b516bp7n.js";import{V,J}from"./chunk-8np9b2y8.js";import{Q,we}from"./chunk-tfhp09nj.js";var M=async(e,s,t)=>{let a={api:e.api,provider:e.provider,model:e.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let r=t?.apiKey;if(!r)throw Error(`No API key for provider: ${e.provider}`);let c=y(e,r,t?.headers,t?.fetch),n=R(e,s),i=await t?.onPayload?.(n,e);if(i!==void 0)n=i;let o={...t?.signal?{signal:t.signal}:{},...t?.timeoutMs!==void 0?{timeout:t.timeoutMs}:{},maxRetries:0},{data:f,response:g}=await ue(()=>c.chat.completions.create(n,o).withResponse(),{maxRetries:t?.maxRetries,maxRetryDelayMs:t?.maxRetryDelayMs,signal:t?.signal});await t?.onResponse?.({status:g.status,headers:Q(g.headers)},e);let u=f;if(a.responseId=u.id,u.usage)a.usage=x(u.usage,e);let p=u.choices[0];if(p){let m=p.message.content;if(typeof m==="string"&&m.length>0)a.output.push({type:"text",text:m});for(let d of p.message.images??[]){let l=typeof d.image_url==="string"?d.image_url:d.image_url?.url;if(!l?.startsWith("data:"))continue;let h=l.match(/^data:([^;]+);base64,(.+)$/);if(!h)continue;a.output.push({type:"image",mimeType:h[1],data:h[2]})}}return a}catch(r){return a.stopReason=t?.signal?.aborted?"aborted":"error",a.errorMessage=J(V(r)),a}};function y(e,s,t,a){return new S({apiKey:s,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:a,defaultHeaders:we({...e.headers,...t})})}function R(e,s){let t=s.input.map((a)=>{if(a.type==="text")return{type:"text",text:w(a.text)};return{type:"image_url",image_url:{url:`data:${a.mimeType};base64,${a.data}`}}});return{model:e.id,messages:[{role:"user",content:t}],stream:!1,modalities:e.output.includes("text")?["image","text"]:["image"]}}function x(e,s){let t=e.prompt_tokens||0,a=e.prompt_tokens_details?.cached_tokens||0,r=e.prompt_tokens_details?.cache_write_tokens||0,c=r>0?Math.max(0,a-r):a,n=Math.max(0,t-c-r),i=e.completion_tokens||0,o={input:n,output:i,cacheRead:c,cacheWrite:r,totalTokens:n+i+c+r,cost:{input:s.cost.input/1e6*n,output:s.cost.output/1e6*i,cacheRead:s.cost.cacheRead/1e6*c,cacheWrite:s.cost.cacheWrite/1e6*r,total:0}};return o.cost.total=o.cost.input+o.cost.output+o.cost.cacheRead+o.cost.cacheWrite,o}export{M as generateImages};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{He,at}from"./chunk-6ef085c1.js";import{qe}from"./chunk-1w4nh5t6.js";import{je,Pe,B}from"./chunk-mh4bjtfs.js";import{_e,Z,v,Ae,ee,Ye,z}from"./chunk-cs91rmbf.js";var{awsEndpointFunctions:Y,emitWarningIfUnsupportedVersion:J,createDefaultUserAgentProvider:X,NODE_APP_ID_CONFIG_OPTIONS:te,getAwsRegionExtensionConfiguration:se,resolveAwsRegionExtensionConfiguration:oe,resolveUserAgentConfig:ne,resolveHostHeaderConfig:re,getUserAgentPlugin:ie,getHostHeaderPlugin:ae,getLoggerPlugin:ce,getRecursionDetectionPlugin:ue}=B(),{NoAuthSigner:de,getHttpAuthSchemeEndpointRuleSetPlugin:pe,DefaultIdentityProviderConfig:le,getHttpSigningPlugin:he}=Pe(),{normalizeProvider:F,getSmithyContext:ge,ServiceException:me,NoOpLogger:Se,emitWarningIfUnsupportedVersion:Ee,loadConfigsForDefaultMode:fe,getDefaultExtensionConfiguration:ve,resolveDefaultRuntimeConfig:Re,Client:xe,makeBuilder:Ce,createAggregatedClient:Ie}=Z(),{Command:Es}=Z();var{resolveDefaultsModeConfig:ye,loadConfig:a,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:Oe,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:we,NODE_REGION_CONFIG_OPTIONS:Te,NODE_REGION_CONFIG_FILE_OPTIONS:Ne,resolveRegionConfig:De}=v(),{BinaryDecisionDiagram:ke,EndpointCache:be,decideEndpoint:Fe,customEndpointFunctions:$e,resolveEndpointConfig:Ue,getEndpointPlugin:Ge}=Ae(),{parseUrl:Me,getHttpHandlerExtensionConfiguration:ze,resolveHttpHandlerRuntimeConfig:Le,getContentLengthPlugin:Ke}=z(),{DEFAULT_RETRY_MODE:Ve,NODE_RETRY_MODE_CONFIG_OPTIONS:Be,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:We,resolveRetryConfig:Qe,getRetryPlugin:Je}=je(),{TypeRegistry:q,getSchemaSerdePlugin:Xe}=_e(),{resolveAwsSdkSigV4Config:Ze,AwsSdkSigV4Signer:et,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:tt}=He(),{toUtf8:st,fromUtf8:ot,toBase64:nt,fromBase64:rt,calculateBodyLength:it}=ee(),{streamCollector:ct,NodeHttpHandler:ut}=qe(),{AwsRestJsonProtocol:dt}=at(),{Sha256:pt}=Ye(),lt=async(e,t,s)=>({operation:ge(t).operation,region:await F(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function ht(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:e.region},propertiesExtractor:(t,s)=>({signingProperties:{config:t,context:s}})}}function gt(e){return{schemeId:"smithy.api#noAuth"}}var mt=(e)=>{let t=[];switch(e.operation){case"GetRoleCredentials":{t.push(gt());break}default:t.push(ht(e))}return t},St=(e)=>{let t=Ze(e);return Object.assign(t,{authSchemePreference:F(e.authSchemePreference??[])})},_t=(e)=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"}),Et={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},ft="3.997.47",Pt={version:ft},p="ref",c=-1,g=!0,T="isSet",H="PartitionResult",m="booleanEquals",R="getAttr",N={[p]:"Endpoint"},x={[p]:H},d={},D=[{[p]:"Region"}],k={conditions:[[T,[N]],[T,D],["aws.partition",D,H],[m,[{[p]:"UseFIPS"},g]],[m,[{[p]:"UseDualStack"},g]],[m,[{fn:R,argv:[x,"supportsDualStack"]},g]],[m,[{fn:R,argv:[x,"supportsFIPS"]},g]],["stringEquals",[{fn:R,argv:[x,"name"]},"aws-us-gov"]]],results:[[c],[c,"Invalid Configuration: FIPS and custom endpoint are not supported"],[c,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[N,d],["https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",d],[c,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://portal.sso.{Region}.amazonaws.com",d],["https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",d],[c,"FIPS is enabled but this partition does not support FIPS"],["https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",d],[c,"DualStack is enabled but this partition does not support DualStack"],["https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",d],[c,"Invalid Configuration: Missing Region"]]},vt=2,n=1e8,Rt=new Int32Array([-1,1,-1,0,13,3,1,4,n+12,2,5,n+12,3,8,6,4,7,n+11,5,n+9,n+10,4,11,9,6,10,n+8,7,n+6,n+7,5,12,n+5,6,n+4,n+5,3,n+1,14,4,n+2,n+3]),xt=ke.from(Rt,vt,k.conditions,k.results),Ct=new be({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),It=(e,t={})=>Ct.get(e,()=>Fe(xt,{endpointParams:e,logger:t.logger}));$e.aws=Y;class u extends me{static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.sso#SSOServiceException";constructor(e){super(e);Object.setPrototypeOf(this,u.prototype)}}class C extends u{static shapeId="com.amazonaws.sso#InvalidRequestException";name="InvalidRequestException";$fault="client";constructor(e){super({name:"InvalidRequestException",$fault:"client",...e});Object.setPrototypeOf(this,C.prototype)}}class I extends u{static shapeId="com.amazonaws.sso#ResourceNotFoundException";name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});Object.setPrototypeOf(this,I.prototype)}}class y extends u{static shapeId="com.amazonaws.sso#TooManyRequestsException";name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e});Object.setPrototypeOf(this,y.prototype)}}class A extends u{static shapeId="com.amazonaws.sso#UnauthorizedException";name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e});Object.setPrototypeOf(this,A.prototype)}}var yt="AccessTokenType",At="GetRoleCredentials",Ot="GetRoleCredentialsRequest",wt="GetRoleCredentialsResponse",Tt="InvalidRequestException",Nt="RoleCredentials",Dt="ResourceNotFoundException",kt="SecretAccessKeyType",bt="SessionTokenType",Ft="TooManyRequestsException",qt="UnauthorizedException",$t="accountId",Ht="accessKeyId",Ut="accessToken",Gt="account_id",S="client",_="error",Mt="expiration",zt="http",E="httpError",jt="httpHeader",b="httpQuery",f="message",Lt="roleCredentials",Kt="roleName",Vt="role_name",U="smithy.ts.sdk.synthetic.com.amazonaws.sso",Bt="secretAccessKey",Wt="sessionToken",Qt="x-amz-sso_bearer_token",r="com.amazonaws.sso",G=new q(U),Yt=[-3,U,"SSOServiceException",0,[],[]];G.registerError(Yt,u);var l=new q(r),Jt=[-3,r,Tt,{[_]:S,[E]:400},[f],[0]];l.registerError(Jt,C);var Xt=[-3,r,Dt,{[_]:S,[E]:404},[f],[0]];l.registerError(Xt,I);var Zt=[-3,r,Ft,{[_]:S,[E]:429},[f],[0]];l.registerError(Zt,y);var es=[-3,r,qt,{[_]:S,[E]:401},[f],[0]];l.registerError(es,A);var ts=[G,l],ss=[0,r,yt,8,0],os=[0,r,kt,8,0],ns=[0,r,bt,8,0],rs=[3,r,Ot,0,[Kt,$t,Ut],[[0,{[b]:Vt}],[0,{[b]:Gt}],[()=>ss,{[jt]:Qt}]],3],is=[3,r,wt,0,[Lt],[[()=>as,0]]],as=[3,r,Nt,0,[Ht,Bt,Wt,Mt],[0,[()=>os,0],[()=>ns,0],1]],cs=[9,r,At,{[zt]:["GET","/federation/credentials",200]},()=>rs,()=>is],us=(e)=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??rt,base64Encoder:e?.base64Encoder??nt,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??It,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??mt,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new et},{schemeId:"smithy.api#noAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new de}],logger:e?.logger??new Se,protocol:e?.protocol??dt,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:ts,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:e?.serviceId??"SSO",sha256:e?.sha256??pt,urlParser:e?.urlParser??Me,utf8Decoder:e?.utf8Decoder??ot,utf8Encoder:e?.utf8Encoder??st}),ds=(e)=>{Ee(process.version);let t=ye(e),s=()=>t().then(fe),i=us(e);J(process.version);let o={profile:e?.profile,logger:i.logger};return{...i,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??a(tt,o),bodyLengthChecker:e?.bodyLengthChecker??it,defaultUserAgentProvider:e?.defaultUserAgentProvider??X({serviceId:i.serviceId,clientVersion:Pt.version}),maxAttempts:e?.maxAttempts??a(We,e),region:e?.region??a(Te,{...Ne,...o}),requestHandler:ut.create(e?.requestHandler??s),retryMode:e?.retryMode??a({...Be,default:async()=>(await s()).retryMode||Ve},e),streamCollector:e?.streamCollector??ct,useDualstackEndpoint:e?.useDualstackEndpoint??a(we,o),useFipsEndpoint:e?.useFipsEndpoint??a(Oe,o),userAgentAppId:e?.userAgentAppId??a(te,o)}},ps=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:s,credentials:i}=e;return{setHttpAuthScheme(o){let h=t.findIndex((P)=>P.schemeId===o.schemeId);if(h===-1)t.push(o);else t.splice(h,1,o)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(o){s=o},httpAuthSchemeProvider(){return s},setCredentials(o){i=o},credentials(){return i}}},ls=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),hs=(e,t)=>{let s=Object.assign(se(e),ve(e),ze(e),ps(e));return t.forEach((i)=>i.configure(s)),Object.assign(e,oe(s),Re(s),Le(s),ls(s))};class O extends xe{config;constructor(...[e]){let t=ds(e||{});super(t);this.initConfig=t;let s=_t(t),i=ne(s),o=Qe(i),h=De(o),P=re(h),K=Ue(P),V=St(K),W=hs(V,e?.extensions||[]);this.config=W,this.middlewareStack.use(Xe(this.config)),this.middlewareStack.use(ie(this.config)),this.middlewareStack.use(Je(this.config)),this.middlewareStack.use(Ke(this.config)),this.middlewareStack.use(ae(this.config)),this.middlewareStack.use(ce(this.config)),this.middlewareStack.use(ue(this.config)),this.middlewareStack.use(pe(this.config,{httpAuthSchemeParametersProvider:lt,identityProviderConfigProvider:async(Q)=>new le({"aws.auth#sigv4":Q.credentials})})),this.middlewareStack.use(he(this.config))}destroy(){super.destroy()}}var gs=Ce(Et,"SWBPortalService","SSOClient",Ge),ms={},Ss=(e,t,s,i)=>[];class w extends gs(ms,Ss,"GetRoleCredentials",cs){}var _s={GetRoleCredentialsCommand:w};class M extends O{}Ie(_s,M);var j=w;var L=O;export{j as GetRoleCredentialsCommand,L as SSOClient};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{O}from"./chunk-vjne04dp.js";import{b}from"./chunk-cmwdjes8.js";import{i}from"./chunk-bwawt15q.js";var g=i(b());var U=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var v=i(O());var f=i(b());var j=300000,k="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var q=async(e,o={},r)=>{let{SSOOIDCClient:t}=await import("./chunk-r4gm8ngh.js"),n=(p)=>o.clientConfig?.[p]??o.parentClientConfig?.[p]??r?.[p];return new t(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:n("logger"),userAgentAppId:n("userAgentAppId")}))};var W=async(e,o,r={},t)=>{let{CreateTokenCommand:n}=await import("./chunk-r4gm8ngh.js");return(await q(o,r,t)).send(new n({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var X=i(b());var N=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new X.TokenProviderError(`Token is expired. ${k}`,!1)};var z=i(b());var w=(e,o,r=!1)=>{if(typeof o>"u")throw new z.TokenProviderError(`Value not present for '${e}' in SSO Token${r?". Cannot refresh":""}. ${k}`,!1)};var J=i(b());import{promises as ee}from"fs";var{writeFile:oe}=ee,V=(e,o)=>{let r=J.getSSOTokenFilepath(e),t=JSON.stringify(o,null,2);return oe(r,t)};var Y=new Map,R=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let r=await f.parseKnownFiles(e),t=f.getProfileName({profile:e.profile??o?.profile}),n=r[t];if(!n)throw new f.TokenProviderError(`Profile '${t}' could not be found in shared credentials file.`,!1);else if(!n.sso_session)throw new f.TokenProviderError(`Profile '${t}' is missing required property 'sso_session'.`);let a=n.sso_session,S=(await f.loadSsoSessionData(e))[a];if(!S)throw new f.TokenProviderError(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(let c of["sso_start_url","sso_region"])if(!S[c])throw new f.TokenProviderError(`Sso session '${a}' is missing required property '${c}'.`,!1);let{sso_start_url:d,sso_region:E}=S,s;try{s=await f.getSSOTokenFromFile(a)}catch(c){throw new f.TokenProviderError(`The SSO session token associated with profile=${t} was not found or is invalid. ${k}`,!1)}w("accessToken",s.accessToken),w("expiresAt",s.expiresAt);let{accessToken:T,expiresAt:x}=s,l={token:T,expiration:new Date(x)};if(l.expiration.getTime()-Date.now()>j)return l;let m=Y.get(a)??0;if(Date.now()-m<30000)return N(l),l;w("clientId",s.clientId,!0),w("clientSecret",s.clientSecret,!0),w("refreshToken",s.refreshToken,!0);try{Y.set(a,Date.now());let c=await W(s,E,e,o);w("accessToken",c.accessToken),w("expiresIn",c.expiresIn);let C=new Date(Date.now()+c.expiresIn*1000);try{await V(a,{...s,accessToken:c.accessToken,expiresAt:C.toISOString(),refreshToken:c.refreshToken})}catch(u){}return{token:c.accessToken,expiration:C}}catch(c){return N(l),l}};var h=i(b()),y=!1,P=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:r,ssoRegion:t,ssoRoleName:n,ssoClient:a,clientConfig:p,parentClientConfig:S,callerClientConfig:d,profile:E,filepath:s,configFilepath:T,ignoreCache:x,logger:l})=>{let m,c="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{let _=await R({profile:E,filepath:s,configFilepath:T,ignoreCache:x,clientConfig:p,parentClientConfig:S,logger:l})({callerClientConfig:d});m={accessToken:_.token,expiresAt:new Date(_.expiration).toISOString()}}catch(_){throw new h.CredentialsProviderError(_.message,{tryNextLink:y,logger:l})}else try{m=await h.getSSOTokenFromFile(e)}catch(_){throw new h.CredentialsProviderError("The SSO session associated with this profile is invalid. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:y,logger:l})}if(new Date(m.expiresAt).getTime()-Date.now()<=0)throw new h.CredentialsProviderError("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:y,logger:l});let{accessToken:C}=m,{SSOClient:u,GetRoleCredentialsCommand:A}=await import("./chunk-tv52xajf.js"),Z=a||new u(Object.assign({},p??{},{logger:p?.logger??d?.logger??S?.logger,region:p?.region??t,userAgentAppId:p?.userAgentAppId??d?.userAgentAppId??S?.userAgentAppId})),F;try{F=await Z.send(new A({accountId:r,roleName:n,accessToken:C}))}catch(_){throw new h.CredentialsProviderError(_,{tryNextLink:y,logger:l})}let{roleCredentials:{accessKeyId:D,secretAccessKey:L,sessionToken:M,expiration:G,credentialScope:K,accountId:H}={}}=F;if(!D||!L||!M||!G)throw new h.CredentialsProviderError("SSO returns an invalid temporary credential.",{tryNextLink:y,logger:l});let I={accessKeyId:D,secretAccessKey:L,sessionToken:M,expiration:new Date(G),...K&&{credentialScope:K},...H&&{accountId:H}};if(o)v.setCredentialFeature(I,"CREDENTIALS_SSO","s");else v.setCredentialFeature(I,"CREDENTIALS_SSO_LEGACY","u");return I};var B=i(b()),Q=(e,o)=>{let{sso_start_url:r,sso_account_id:t,sso_region:n,sso_role_name:a}=e;if(!r||!t||!n||!a)throw new B.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}
3
- Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e};var se=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");let{ssoStartUrl:r,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoSession:p}=e,{ssoClient:S}=e,d=g.getProfileName({profile:e.profile??o?.profile});if(!r&&!t&&!n&&!a&&!p){let s=(await g.parseKnownFiles(e))[d];if(!s)throw new g.CredentialsProviderError(`Profile ${d} was not found.`,{logger:e.logger});if(!U(s))throw new g.CredentialsProviderError(`Profile ${d} is not configured with SSO credentials.`,{logger:e.logger});if(s?.sso_session){let u=(await g.loadSsoSessionData(e))[s.sso_session],A=` configurations in profile ${d} and sso-session ${s.sso_session}`;if(n&&n!==u.sso_region)throw new g.CredentialsProviderError("Conflicting SSO region"+A,{tryNextLink:!1,logger:e.logger});if(r&&r!==u.sso_start_url)throw new g.CredentialsProviderError("Conflicting SSO start_url"+A,{tryNextLink:!1,logger:e.logger});s.sso_region=u.sso_region,s.sso_start_url=u.sso_start_url}let{sso_start_url:T,sso_account_id:x,sso_region:l,sso_role_name:m,sso_session:c}=Q(s,e.logger);return P({ssoStartUrl:T,ssoSession:c,ssoAccountId:x,ssoRegion:l,ssoRoleName:m,ssoClient:S,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:d,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}else if(!r||!t||!n||!a)throw new g.CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger});else return P({ssoStartUrl:r,ssoSession:p,ssoAccountId:t,ssoRegion:n,ssoRoleName:a,ssoClient:S,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:d,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})};export{se as fromSSO};
2
+ import{B}from"./chunk-mh4bjtfs.js";import{v}from"./chunk-cs91rmbf.js";import{a}from"./chunk-qd2enpr2.js";var g=a(v());var H=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var R=a(B());var f=a(v());var U=300000,k="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var j=async(e,o={},r)=>{let{SSOOIDCClient:t}=await import("./chunk-4w8j6n7z.js"),n=(p)=>o.clientConfig?.[p]??o.parentClientConfig?.[p]??r?.[p];return new t(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:n("logger"),userAgentAppId:n("userAgentAppId")}))};var q=async(e,o,r={},t)=>{let{CreateTokenCommand:n}=await import("./chunk-4w8j6n7z.js");return(await j(o,r,t)).send(new n({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var W=a(v());var I=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new W.TokenProviderError(`Token is expired. ${k}`,!1)};var X=a(v());var w=(e,o,r=!1)=>{if(typeof o>"u")throw new X.TokenProviderError(`Value not present for '${e}' in SSO Token${r?". Cannot refresh":""}. ${k}`,!1)};var z=a(v());import{promises as ee}from"fs";var{writeFile:oe}=ee,J=(e,o)=>{let r=z.getSSOTokenFilepath(e),t=JSON.stringify(o,null,2);return oe(r,t)};var V=new Map,N=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let r=await f.parseKnownFiles(e),t=f.getProfileName({profile:e.profile??o?.profile}),n=r[t];if(!n)throw new f.TokenProviderError(`Profile '${t}' could not be found in shared credentials file.`,!1);else if(!n.sso_session)throw new f.TokenProviderError(`Profile '${t}' is missing required property 'sso_session'.`);let i=n.sso_session,S=(await f.loadSsoSessionData(e))[i];if(!S)throw new f.TokenProviderError(`Sso session '${i}' could not be found in shared credentials file.`,!1);for(let c of["sso_start_url","sso_region"])if(!S[c])throw new f.TokenProviderError(`Sso session '${i}' is missing required property '${c}'.`,!1);let{sso_start_url:d,sso_region:y}=S,s;try{s=await f.getSSOTokenFromFile(i)}catch(c){throw new f.TokenProviderError(`The SSO session token associated with profile=${t} was not found or is invalid. ${k}`,!1)}w("accessToken",s.accessToken),w("expiresAt",s.expiresAt);let{accessToken:T,expiresAt:x}=s,l={token:T,expiration:new Date(x)};if(l.expiration.getTime()-Date.now()>U)return l;let m=V.get(i)??0;if(Date.now()-m<30000)return I(l),l;w("clientId",s.clientId,!0),w("clientSecret",s.clientSecret,!0),w("refreshToken",s.refreshToken,!0);try{V.set(i,Date.now());let c=await q(s,y,e,o);w("accessToken",c.accessToken),w("expiresIn",c.expiresIn);let C=new Date(Date.now()+c.expiresIn*1000);try{await J(i,{...s,accessToken:c.accessToken,expiresAt:C.toISOString(),refreshToken:c.refreshToken})}catch(u){}return{token:c.accessToken,expiration:C}}catch(c){return I(l),l}};var h=a(v()),O=!1,P=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:r,ssoRegion:t,ssoRoleName:n,ssoClient:i,clientConfig:p,parentClientConfig:S,callerClientConfig:d,profile:y,filepath:s,configFilepath:T,ignoreCache:x,logger:l})=>{let m,c="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{let _=await N({profile:y,filepath:s,configFilepath:T,ignoreCache:x,clientConfig:p,parentClientConfig:S,logger:l})({callerClientConfig:d});m={accessToken:_.token,expiresAt:new Date(_.expiration).toISOString()}}catch(_){throw new h.CredentialsProviderError(_.message,{tryNextLink:O,logger:l})}else try{m=await h.getSSOTokenFromFile(e)}catch(_){throw new h.CredentialsProviderError("The SSO session associated with this profile is invalid. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:O,logger:l})}if(new Date(m.expiresAt).getTime()-Date.now()<=0)throw new h.CredentialsProviderError("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:O,logger:l});let{accessToken:C}=m,{SSOClient:u,GetRoleCredentialsCommand:E}=await import("./chunk-9xjecw6c.js"),Z=i||new u(Object.assign({},p??{},{logger:p?.logger??d?.logger??S?.logger,region:p?.region??t,userAgentAppId:p?.userAgentAppId??d?.userAgentAppId??S?.userAgentAppId})),F;try{F=await Z.send(new E({accountId:r,roleName:n,accessToken:C}))}catch(_){throw new h.CredentialsProviderError(_,{tryNextLink:O,logger:l})}let{roleCredentials:{accessKeyId:D,secretAccessKey:L,sessionToken:M,expiration:b,credentialScope:G,accountId:K}={}}=F;if(!D||!L||!M||!b)throw new h.CredentialsProviderError("SSO returns an invalid temporary credential.",{tryNextLink:O,logger:l});let A={accessKeyId:D,secretAccessKey:L,sessionToken:M,expiration:new Date(b),...G&&{credentialScope:G},...K&&{accountId:K}};if(o)R.setCredentialFeature(A,"CREDENTIALS_SSO","s");else R.setCredentialFeature(A,"CREDENTIALS_SSO_LEGACY","u");return A};var Y=a(v()),Q=(e,o)=>{let{sso_start_url:r,sso_account_id:t,sso_region:n,sso_role_name:i}=e;if(!r||!t||!n||!i)throw new Y.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}
3
+ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e};var se=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");let{ssoStartUrl:r,ssoAccountId:t,ssoRegion:n,ssoRoleName:i,ssoSession:p}=e,{ssoClient:S}=e,d=g.getProfileName({profile:e.profile??o?.profile});if(!r&&!t&&!n&&!i&&!p){let s=(await g.parseKnownFiles(e))[d];if(!s)throw new g.CredentialsProviderError(`Profile ${d} was not found.`,{logger:e.logger});if(!H(s))throw new g.CredentialsProviderError(`Profile ${d} is not configured with SSO credentials.`,{logger:e.logger});if(s?.sso_session){let u=(await g.loadSsoSessionData(e))[s.sso_session],E=` configurations in profile ${d} and sso-session ${s.sso_session}`;if(n&&n!==u.sso_region)throw new g.CredentialsProviderError("Conflicting SSO region"+E,{tryNextLink:!1,logger:e.logger});if(r&&r!==u.sso_start_url)throw new g.CredentialsProviderError("Conflicting SSO start_url"+E,{tryNextLink:!1,logger:e.logger});s.sso_region=u.sso_region,s.sso_start_url=u.sso_start_url}let{sso_start_url:T,sso_account_id:x,sso_region:l,sso_role_name:m,sso_session:c}=Q(s,e.logger);return P({ssoStartUrl:T,ssoSession:c,ssoAccountId:x,ssoRegion:l,ssoRoleName:m,ssoClient:S,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:d,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}else if(!r||!t||!n||!i)throw new g.CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger});else return P({ssoStartUrl:r,ssoSession:p,ssoAccountId:t,ssoRegion:n,ssoRoleName:i,ssoClient:S,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:d,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})};export{se as fromSSO};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ function w(u){return u.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}
3
+ export{w};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{B}from"./chunk-mh4bjtfs.js";import{v}from"./chunk-cs91rmbf.js";import{a}from"./chunk-qd2enpr2.js";var _=a(B()),N=a(v()),zr="AWS_ACCESS_KEY_ID",jr="AWS_SECRET_ACCESS_KEY",S="AWS_SESSION_TOKEN",C="AWS_CREDENTIAL_EXPIRATION",A="AWS_CREDENTIAL_SCOPE",p="AWS_ACCOUNT_ID",$n=(e)=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[zr],E=process.env[jr],r=process.env[S],n=process.env[C],s=process.env[A],t=process.env[p];if(o&&E){let c={accessKeyId:o,secretAccessKey:E,...r&&{sessionToken:r},...n&&{expiration:new Date(n)},...s&&{credentialScope:s},...t&&{accountId:t}};return _.setCredentialFeature(c,"CREDENTIALS_ENV_VARS","g"),c}throw new N.CredentialsProviderError("Unable to find environment variable credentials.",{logger:e?.logger})};export{zr,jr,$n};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{T}from"./chunk-eq4wqxzt.js";var a={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function p(e,r){let o=e.toLowerCase(),t=e.toUpperCase();return r?.[o]||r?.[t]||T(o)||T(t)||""}function f(e){if(e instanceof URL)return e;try{return new URL(e)}catch{return}}function u(e){return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}function l(e){let r=e.trim().toLowerCase();if(!r)return;if(r.startsWith("[")){let t=r.indexOf("]");if(t!==-1){let n=r.slice(1,t),c=r.slice(t+1);if(c.startsWith(":")){let s=Number.parseInt(c.slice(1),10);return{host:n,port:Number.isNaN(s)?0:s}}return{host:n,port:0}}}if(r.includes(":")&&r.split(":").length>2)return{host:r,port:0};let o=r.lastIndexOf(":");if(o!==-1&&o===r.indexOf(":")){let t=r.slice(0,o),n=Number.parseInt(r.slice(o+1),10);if(!Number.isNaN(n))return{host:t,port:n}}return{host:r,port:0}}function d(e,r,o){let t=p("no_proxy",o).toLowerCase();if(!t)return!0;if(t==="*")return!1;let n=u(e.toLowerCase());return t.split(/[,\s]/).every((c)=>{let s=l(c);if(!s)return!0;if(s.port&&s.port!==r)return!0;let i=u(s.host);if(i.startsWith("*."))i=i.slice(2);else if(i.startsWith(".")||i.startsWith("*"))i=i.slice(1);if(!i)return!0;if(n===i)return!1;if(n.endsWith(`.${i}`))return!1;return!0})}function h(e,r){let o=f(e);if(!o?.protocol||!o.host)return"";let t=o.protocol.split(":",1)[0],n=u(o.hostname||o.host.replace(/:\d*$/,"")),c=Number.parseInt(o.port,10)||a[t]||0;if(!d(n,c,r))return"";let s=p(`${t}_proxy`,r)||p("all_proxy",r);if(s&&!s.includes("://"))s=`${t}://${s}`;return s}var x="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function Lr(e,r){let o=h(e,r);if(!o)return;let t;try{t=new URL(o)}catch(n){throw Error(`Invalid proxy URL ${JSON.stringify(o)}: ${n instanceof Error?n.message:String(n)}`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw Error(`${x} Got ${t.protocol}`);return t}
3
- export{Lr};
2
+ import{_}from"./chunk-ge38dhv9.js";var a={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function p(e,r){let o=e.toLowerCase(),t=e.toUpperCase();return r?.[o]||r?.[t]||_(o)||_(t)||""}function f(e){if(e instanceof URL)return e;try{return new URL(e)}catch{return}}function u(e){return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}function l(e){let r=e.trim().toLowerCase();if(!r)return;if(r.startsWith("[")){let t=r.indexOf("]");if(t!==-1){let n=r.slice(1,t),c=r.slice(t+1);if(c.startsWith(":")){let s=Number.parseInt(c.slice(1),10);return{host:n,port:Number.isNaN(s)?0:s}}return{host:n,port:0}}}if(r.includes(":")&&r.split(":").length>2)return{host:r,port:0};let o=r.lastIndexOf(":");if(o!==-1&&o===r.indexOf(":")){let t=r.slice(0,o),n=Number.parseInt(r.slice(o+1),10);if(!Number.isNaN(n))return{host:t,port:n}}return{host:r,port:0}}function d(e,r,o){let t=p("no_proxy",o).toLowerCase();if(!t)return!0;if(t==="*")return!1;let n=u(e.toLowerCase());return t.split(/[,\s]/).every((c)=>{let s=l(c);if(!s)return!0;if(s.port&&s.port!==r)return!0;let i=u(s.host);if(i.startsWith("*."))i=i.slice(2);else if(i.startsWith(".")||i.startsWith("*"))i=i.slice(1);if(!i)return!0;if(n===i)return!1;if(n.endsWith(`.${i}`))return!1;return!0})}function h(e,r){let o=f(e);if(!o?.protocol||!o.host)return"";let t=o.protocol.split(":",1)[0],n=u(o.hostname||o.host.replace(/:\d*$/,"")),c=Number.parseInt(o.port,10)||a[t]||0;if(!d(n,c,r))return"";let s=p(`${t}_proxy`,r)||p("all_proxy",r);if(s&&!s.includes("://"))s=`${t}://${s}`;return s}var x="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function Wr(e,r){let o=h(e,r);if(!o)return;let t;try{t=new URL(o)}catch(n){throw Error(`Invalid proxy URL ${JSON.stringify(o)}: ${n instanceof Error?n.message:String(n)}`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw Error(`${x} Got ${t.protocol}`);return t}
3
+ export{Wr};