@bkm016/basalt 0.1.0 → 0.1.2

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 (214) hide show
  1. package/README.md +16 -22
  2. package/chunk-06hdzq5n.js +2 -0
  3. package/chunk-09rj27b2.js +2 -0
  4. package/{chunk-qnr1f5pj.js → chunk-0y7ne3d0.js} +2 -2
  5. package/{chunk-8wjgbd9k.js → chunk-10xzzn07.js} +2 -2
  6. package/{chunk-bj14jshr.js → chunk-1qpces5a.js} +2 -2
  7. package/chunk-1zdwrgd4.js +2 -0
  8. package/chunk-27gntzs5.js +5 -0
  9. package/chunk-2esbgxps.js +25 -0
  10. package/{chunk-913tfr9c.js → chunk-362g64pd.js} +1 -1
  11. package/{chunk-rjdhaasf.js → chunk-3cjsd292.js} +2 -2
  12. package/chunk-5c9j8qe4.js +478 -0
  13. package/chunk-5j1krv9v.js +2 -0
  14. package/{chunk-vkkj4awb.js → chunk-6hssbcgj.js} +1 -1
  15. package/chunk-75m78j7x.js +10 -0
  16. package/{chunk-zt1wvkyf.js → chunk-8296hw9m.js} +1 -1
  17. package/{chunk-9y69ywyg.js → chunk-8d46jtbj.js} +2 -2
  18. package/{chunk-sf13azm4.js → chunk-8tjad3r0.js} +4 -4
  19. package/{chunk-agntrqs9.js → chunk-97rzj7f6.js} +1 -1
  20. package/{chunk-k7w7ac9q.js → chunk-981f9dw8.js} +8 -8
  21. package/chunk-9mmz6wt3.js +2 -0
  22. package/chunk-aefadsy6.js +3 -0
  23. package/chunk-bannb9xm.js +3 -0
  24. package/chunk-bpw6q7g0.js +3 -0
  25. package/{chunk-3jz9g8ab.js → chunk-c7x1zq39.js} +3 -3
  26. package/{chunk-rv06x0kn.js → chunk-cjc90f84.js} +1 -1
  27. package/{chunk-6gyhajhx.js → chunk-d2j735sd.js} +2 -2
  28. package/{chunk-qcwnkr5y.js → chunk-d8gtbw9g.js} +1 -1
  29. package/{chunk-rm3kcxq9.js → chunk-fjtvjrkg.js} +13 -13
  30. package/{chunk-qbf8x2ft.js → chunk-fm0k0qtz.js} +1 -1
  31. package/{chunk-1yzt0qm0.js → chunk-fw2bpqmw.js} +1 -1
  32. package/{chunk-kgdrjqsy.js → chunk-g2t6t8fk.js} +2 -2
  33. package/{chunk-wc5j0hfw.js → chunk-gp7y0fja.js} +13 -13
  34. package/{chunk-5fdgy0q2.js → chunk-gzxnene8.js} +10 -10
  35. package/{chunk-y9xe9ct2.js → chunk-hwr56pfj.js} +1 -1
  36. package/{chunk-0hbjv3y6.js → chunk-jwdb0ccj.js} +3 -3
  37. package/{chunk-x9982ek7.js → chunk-k23t7vhs.js} +5 -5
  38. package/{chunk-qffb7een.js → chunk-k506w58v.js} +2 -2
  39. package/{chunk-0tdv0t5q.js → chunk-k6w6y71k.js} +2 -2
  40. package/chunk-m40gxwq4.js +5 -0
  41. package/chunk-m8vkwdgr.js +5 -0
  42. package/{chunk-7yw8aa5j.js → chunk-mvfsxdx6.js} +13 -13
  43. package/{chunk-3p7q2pyp.js → chunk-nbb9trwz.js} +1 -1
  44. package/{chunk-0szjy61m.js → chunk-pbcy6zdt.js} +1 -1
  45. package/chunk-pmqtkqsf.js +2 -0
  46. package/{chunk-hat3s3pr.js → chunk-pxsrqrd0.js} +1 -1
  47. package/{chunk-xsbxykr4.js → chunk-qe0teyn1.js} +1 -1
  48. package/{chunk-2zqny2sy.js → chunk-r7fpkb49.js} +1 -1
  49. package/{chunk-xhk54h2q.js → chunk-rtzqqngy.js} +4 -4
  50. package/chunk-ry0z4ev6.js +2 -0
  51. package/{chunk-0rya8cxe.js → chunk-shadcb9z.js} +2 -2
  52. package/chunk-shhrr741.js +3753 -0
  53. package/{chunk-tnrqkc7b.js → chunk-t6zs4kw0.js} +2 -2
  54. package/chunk-tvm4zmgj.js +3 -0
  55. package/{chunk-hcn9cf6v.js → chunk-v258nxcz.js} +1 -1
  56. package/{chunk-a6r4z44b.js → chunk-vk1gxk1t.js} +1 -1
  57. package/{chunk-d913kpyw.js → chunk-vv7fp27r.js} +2 -2
  58. package/{chunk-g2k3yhgh.js → chunk-x1xss1d7.js} +3 -3
  59. package/{chunk-dakrpbe6.js → chunk-x4874m8e.js} +2 -2
  60. package/{chunk-wx7kdf0b.js → chunk-xfvvh1s5.js} +1 -1
  61. package/{chunk-1egbcp85.js → chunk-y0m980k3.js} +7 -7
  62. package/{chunk-5wp4egky.js → chunk-y58ygzn9.js} +4 -4
  63. package/{chunk-kjr81mrd.js → chunk-y648fzx0.js} +5 -5
  64. package/{chunk-32at88hc.js → chunk-y7nma9rk.js} +1 -1
  65. package/{chunk-wd9zxhza.js → chunk-ykens1hy.js} +1 -1
  66. package/chunk-z55bmysw.js +2 -0
  67. package/chunk-zmsgwr3s.js +2 -0
  68. package/{chunk-501zkf9b.js → chunk-ztsjgssj.js} +1 -1
  69. package/cli.js +89 -0
  70. package/compiled.js +12 -3762
  71. package/package.json +4 -3
  72. package/ui-test-worker.js +67 -67
  73. package/web/chunk-0sewdyz1.js +1 -0
  74. package/web/{chunk-g9qv15hq.js → chunk-1z5p7a1h.js} +1 -1
  75. package/web/chunk-21ke27j6.js +1 -0
  76. package/web/{chunk-svmhj9hd.js → chunk-24k0r5aq.js} +1 -1
  77. package/web/{chunk-vqjs551t.js → chunk-284a17k8.js} +1 -1
  78. package/web/{chunk-3cfabjey.js → chunk-2pjdtesn.js} +14 -14
  79. package/web/{chunk-ngpq43vn.js → chunk-3mvr2gwh.js} +1 -1
  80. package/web/chunk-3t3zwx9j.js +1 -0
  81. package/web/{chunk-ezyvv4ab.js → chunk-3z93efr4.js} +1 -1
  82. package/web/{chunk-rkesqprv.js → chunk-43jqvsrg.js} +1 -1
  83. package/web/{chunk-4y2td14d.js → chunk-4bry4xds.js} +2 -2
  84. package/web/{chunk-ea9swkkt.js → chunk-5e7ygjdn.js} +1 -1
  85. package/web/{chunk-3ahpr030.js → chunk-5jbf7n5q.js} +1 -1
  86. package/web/{chunk-bhe4jzha.js → chunk-5rx8rtsa.js} +1 -1
  87. package/web/chunk-5xc9d5ft.js +1 -0
  88. package/web/{chunk-fdkp6tzq.js → chunk-693m9kt7.js} +3 -3
  89. package/web/{chunk-mq92vqb1.js → chunk-6qejm5s2.js} +1 -1
  90. package/web/{chunk-z1jtv4c0.js → chunk-8ah6ce1b.js} +2 -2
  91. package/web/{chunk-zk2f7x5e.js → chunk-8e43yaq3.js} +3 -3
  92. package/web/{chunk-hejz98gw.js → chunk-8wye0wbb.js} +1 -1
  93. package/web/{chunk-pz934t6t.js → chunk-986z0p48.js} +5 -5
  94. package/web/{chunk-jtwhjp20.js → chunk-9dd1c37b.js} +77 -77
  95. package/web/{chunk-sc63gh9d.js → chunk-9re6yttj.js} +2 -2
  96. package/web/{chunk-1t760bg0.js → chunk-abbvjt4e.js} +1 -1
  97. package/web/{chunk-1v3d60pp.js → chunk-agmkx996.js} +3 -3
  98. package/web/{chunk-kbtbbarw.js → chunk-anbn2ttv.js} +2 -2
  99. package/web/chunk-aqm3spxt.js +1139 -0
  100. package/web/{chunk-jvhmna7z.js → chunk-avwpjsxw.js} +5 -5
  101. package/web/chunk-b470hvpk.js +1 -0
  102. package/web/{chunk-29e1trsq.js → chunk-bt1m87ck.js} +2 -2
  103. package/web/chunk-cqp1d4p0.js +1 -0
  104. package/web/{chunk-b5brnfv9.js → chunk-ctcrk3qn.js} +2 -2
  105. package/web/{chunk-zakv2xdf.js → chunk-ctd8bfg2.js} +1 -1
  106. package/web/{chunk-5hex8g0y.js → chunk-cwvtraca.js} +1 -1
  107. package/web/{chunk-1x8fn8w9.js → chunk-dk90px7g.js} +1 -1
  108. package/web/{chunk-0mrkjnte.js → chunk-ds7srg4p.js} +1 -1
  109. package/web/{chunk-6r912gfj.js → chunk-dt8ss97f.js} +5 -5
  110. package/web/{chunk-ykxpb3wv.js → chunk-ezkqa7we.js} +1 -1
  111. package/web/{chunk-svdzmaxb.js → chunk-f078k1ej.js} +1 -1
  112. package/web/chunk-fekjj24p.css +1 -0
  113. package/web/{chunk-v6v831tc.js → chunk-fqj9kry9.js} +5 -5
  114. package/web/chunk-frjfamx7.js +8 -0
  115. package/web/{chunk-rz6wwdd5.js → chunk-fy8ey195.js} +1 -1
  116. package/web/{chunk-p8y0hjx9.js → chunk-g8ee1csm.js} +1 -1
  117. package/web/{chunk-ktqt87qw.js → chunk-h31p43qa.js} +1 -1
  118. package/web/chunk-h5p5jsrw.js +1 -0
  119. package/web/chunk-h9fmr6ch.js +1 -0
  120. package/web/{chunk-x9q4kh67.js → chunk-jf2ehmvp.js} +2 -2
  121. package/web/{chunk-canbct9d.js → chunk-jmnaq7c1.js} +1 -1
  122. package/web/chunk-jq0pw0k2.js +1 -0
  123. package/web/{chunk-ghxe4gam.js → chunk-jvj66qhs.js} +2 -2
  124. package/web/{chunk-7f0m2yrd.js → chunk-jzmzhj8z.js} +4 -4
  125. package/web/chunk-k4cfnvyq.js +1 -0
  126. package/web/{chunk-942prjb6.js → chunk-kgerjbn4.js} +1 -1
  127. package/web/{chunk-3bqh2dkw.js → chunk-kww4azv5.js} +5 -5
  128. package/web/chunk-m29dhjkh.js +1 -0
  129. package/web/chunk-mj6tee5h.js +1 -0
  130. package/web/{chunk-a3xt6840.js → chunk-mjpjkyd1.js} +1 -1
  131. package/web/{chunk-20q90epj.js → chunk-n8sky2q6.js} +1 -1
  132. package/web/{chunk-3pf33xsm.js → chunk-pk3ap3wh.js} +4 -4
  133. package/web/{chunk-tfyxp2qs.js → chunk-q1pkntc6.js} +4 -4
  134. package/web/{chunk-gxn0bey7.js → chunk-qryrg2pq.js} +2 -2
  135. package/web/{chunk-0xck277j.js → chunk-r92sbgwv.js} +5 -5
  136. package/web/{chunk-ev1g5cqw.js → chunk-raqqscwa.js} +2 -2
  137. package/web/{chunk-c85wxnpw.js → chunk-rc2vq9wz.js} +3 -3
  138. package/web/{chunk-rsn8j7xv.js → chunk-rkj743fg.js} +3 -3
  139. package/web/{chunk-v47rhg7b.js → chunk-rrws61wf.js} +1 -1
  140. package/web/{chunk-ytpwz01r.js → chunk-s3hwejnr.js} +2 -2
  141. package/web/{chunk-bwyw10wx.js → chunk-s3rdx28k.js} +2 -2
  142. package/web/{chunk-hryhthxr.js → chunk-shbw6wg8.js} +1 -1
  143. package/web/chunk-szcy5z56.js +1 -0
  144. package/web/{chunk-ejd43q75.js → chunk-t1xk6hca.js} +4 -4
  145. package/web/chunk-t2hhdg9r.js +1 -0
  146. package/web/chunk-tj4cmkwe.js +1 -0
  147. package/web/{chunk-mdsgekpk.js → chunk-tn1xzmgx.js} +1 -1
  148. package/web/{chunk-0k0hvh59.js → chunk-tnv7z83q.js} +1 -1
  149. package/web/chunk-v2b5q0n5.js +1 -0
  150. package/web/{chunk-haphmhz8.js → chunk-vj6kstpp.js} +5 -5
  151. package/web/{chunk-e5rmr47n.js → chunk-vjqmnkh2.js} +1 -1
  152. package/web/{chunk-vfqe8298.js → chunk-vkc149rb.js} +1 -1
  153. package/web/{chunk-n5fn9khr.js → chunk-vny496ba.js} +1 -1
  154. package/web/{chunk-s8vapqgr.js → chunk-vz5ck6x9.js} +1 -1
  155. package/web/{chunk-6atq9qtt.js → chunk-xa88zgkr.js} +1 -1
  156. package/web/{chunk-d4d3mnak.js → chunk-xdcs8qz3.js} +4 -4
  157. package/web/chunk-y5x74t89.js +1 -0
  158. package/web/{chunk-x3zwjkwg.js → chunk-yen2kkn2.js} +1 -1
  159. package/web/{chunk-vadqkz3x.js → chunk-yjv2c45j.js} +4 -4
  160. package/web/chunk-yx3dh5hg.js +1 -0
  161. package/web/chunk-yz4fmtk2.js +1 -0
  162. package/web/{chunk-4b5mt5pd.js → chunk-z24vs8q9.js} +3 -3
  163. package/web/chunk-z5j6x6j8.js +2 -0
  164. package/web/chunk-z5stjrhc.js +1 -0
  165. package/web/{chunk-3pm4645m.js → chunk-z760wagr.js} +1 -1
  166. package/web/{chunk-nerx2q12.js → chunk-znvnb9dh.js} +1 -1
  167. package/web/{chunk-55kw67nv.js → chunk-zrzq29e6.js} +1 -1
  168. package/web/{icon-yx2p2pye.svg → icon-1wgy7kzy.svg} +13 -13
  169. package/web/icon.svg +13 -13
  170. package/web/index.html +2 -2
  171. package/web/install.sh +0 -0
  172. package/web/sw.js +9 -0
  173. package/worker.js +1 -1
  174. package/chunk-1fv27j4b.js +0 -3
  175. package/chunk-356q8e0y.js +0 -10
  176. package/chunk-58vz2qsq.js +0 -2
  177. package/chunk-665jzf2w.js +0 -25
  178. package/chunk-97kjn55j.js +0 -2
  179. package/chunk-b9bg5fhd.js +0 -2
  180. package/chunk-c25s4w6a.js +0 -5
  181. package/chunk-j2x0g1vg.js +0 -2
  182. package/chunk-k0t23cmx.js +0 -2
  183. package/chunk-m38ber71.js +0 -2
  184. package/chunk-rad3dm0q.js +0 -2
  185. package/chunk-sytpmbfp.js +0 -471
  186. package/chunk-t057xfrt.js +0 -5
  187. package/chunk-tjpvayr1.js +0 -2
  188. package/chunk-ve7qx8wm.js +0 -3
  189. package/chunk-y8ced1jm.js +0 -5
  190. package/chunk-yb1jxgnk.js +0 -2
  191. package/web/chunk-00mq7bhx.js +0 -1
  192. package/web/chunk-0atfn8jf.js +0 -1
  193. package/web/chunk-310yey4q.js +0 -1
  194. package/web/chunk-32ezm0ry.js +0 -1136
  195. package/web/chunk-3hvgs5aw.js +0 -1
  196. package/web/chunk-3kh6zefg.js +0 -1
  197. package/web/chunk-401v5ht6.js +0 -8
  198. package/web/chunk-5r5kv4gh.js +0 -1
  199. package/web/chunk-95q1bwxn.js +0 -1
  200. package/web/chunk-9s7c178f.js +0 -1
  201. package/web/chunk-benmmqt2.js +0 -1
  202. package/web/chunk-bgqdcnke.js +0 -1
  203. package/web/chunk-eqegxtdt.js +0 -1
  204. package/web/chunk-gmfp7fg4.js +0 -1
  205. package/web/chunk-gxay64d5.js +0 -1
  206. package/web/chunk-jg6nzn6q.js +0 -1
  207. package/web/chunk-kx2xk3bb.js +0 -1
  208. package/web/chunk-ry9256r7.js +0 -1
  209. package/web/chunk-vfqdy860.js +0 -1
  210. package/web/chunk-wtawdeej.css +0 -1
  211. package/web/chunk-x59p8sg2.js +0 -1
  212. package/web/chunk-y7z144e3.js +0 -1
  213. package/web/chunk-ydgqrfvw.js +0 -2
  214. package/web/chunk-yj1a2d37.js +0 -1
package/chunk-t057xfrt.js DELETED
@@ -1,5 +0,0 @@
1
- // @bun
2
- import{X,B}from"./chunk-k7w7ac9q.js";import{t,p}from"./chunk-qnr1f5pj.js";var Fe=t(function(me){var{hasOwn:Q}=X(),{streamCollector:ne}=X();me.streamCollector=ne;var{buildQueryString:J,HttpResponse:G}=B(),A=p("https"),{Readable:se}=p("stream"),O=p("http2");function M(e){let o=e&&typeof e==="object"&&"reason"in e?e.reason:void 0;if(o){if(o instanceof Error){let r=Error("Request aborted");return r.name="AbortError",r.cause=o,r}let s=Error(String(o));return s.name="AbortError",s}let n=Error("Request aborted");return n.name="AbortError",n}var re=["ECONNRESET","EPIPE","ETIMEDOUT"],Y=(e)=>{let o={};for(let n in e){if(!Q(e,n))continue;let s=e[n];o[n]=Array.isArray(s)?s.join(","):s}return o},l={setTimeout:(e,o)=>setTimeout(e,o),clearTimeout:(e)=>clearTimeout(e)},j=1000,ie=(e,o,n=0)=>{if(!n)return-1;let s=(r)=>{let c=l.setTimeout(()=>{e.destroy(),o(Object.assign(Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${n} ms.`),{name:"TimeoutError"}))},n-r),a=(u)=>{if(u?.connecting)u.on("connect",()=>{l.clearTimeout(c)});else l.clearTimeout(c)};if(e.socket)a(e.socket);else e.on("socket",a)};if(n<2000)return s(0),0;return l.setTimeout(s.bind(null,j),j)},ce=(e,o,n=0,s,r)=>{if(n)return l.setTimeout(()=>{let c=`@smithy/node-http-handler - [${s?"ERROR":"WARN"}] a request has exceeded the configured ${n} ms requestTimeout.`;if(s){let a=Object.assign(Error(c),{name:"TimeoutError",code:"ETIMEDOUT"});e.destroy(a),o(a)}else c+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",r?.warn?.(c)},n);return-1},ae=3000,ue=(e,{keepAlive:o,keepAliveMsecs:n},s=ae)=>{if(o!==!0)return-1;let r=()=>{if(e.socket)e.socket.setKeepAlive(o,n||0);else e.on("socket",(c)=>{c.setKeepAlive(o,n||0)})};if(s===0)return r(),0;return l.setTimeout(r,s)},W=3000,fe=(e,o,n=0)=>{let s=(r)=>{let c=n-r,a=()=>{e.destroy(),o(Object.assign(Error(`@smithy/node-http-handler - the request socket timed out after ${n} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};if(e.socket)e.socket.setTimeout(c,a),e.on("close",()=>e.socket?.removeListener("timeout",a));else e.setTimeout(c,a)};if(0<n&&n<6000)return s(0),0;return l.setTimeout(s.bind(null,n===0?0:W),W)},z=6000;async function Z(e,o,n=z,s=!1){let r=o.headers,c=r?r.Expect||r.expect:void 0,a=-1,u=!0;if(!s&&c==="100-continue")u=await Promise.race([new Promise((f)=>{a=Number(l.setTimeout(()=>f(!0),Math.max(z,n)))}),new Promise((f)=>{e.on("continue",()=>{l.clearTimeout(a),f(!0)}),e.on("response",()=>{l.clearTimeout(a),f(!1)}),e.on("error",()=>{l.clearTimeout(a),f(!1)})})]);if(u)de(e,o.body)}function de(e,o){if(o instanceof se){o.pipe(e);return}if(o){let n=Buffer.isBuffer(o);if(n||typeof o==="string"){if(n&&o.byteLength===0)e.end();else e.end(o);return}let r=o;if(typeof r==="object"&&r.buffer&&typeof r.byteOffset==="number"&&typeof r.byteLength==="number"){e.end(Buffer.from(r.buffer,r.byteOffset,r.byteLength));return}e.end(Buffer.from(o));return}e.end()}var he=0,L=void 0,V=void 0;class U{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){if(typeof e?.handle==="function")return e;return new U(e)}static checkSocketUsage(e,o,n=console){let{sockets:s,requests:r,maxSockets:c}=e;if(typeof c!=="number"||c===1/0)return o;let a=15000;if(Date.now()-a<o)return o;if(s&&r)for(let u in s){if(!Q(s,u))continue;let f=s[u]?.length??0,m=r[u]?.length??0;if(f>=c&&m>=2*c)return n?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${f} and ${m} additional requests are enqueued.
3
- See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
4
- or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return o}constructor(e){this.configProvider=new Promise((o,n)=>{if(typeof e==="function")e().then((s)=>{o(this.resolveDefaultConfig(s))}).catch(n);else o(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:o,requestTimeout:n}={}){if(!this.config)this.config=await this.configProvider;let s=this.config,r=s.logger,c=e.protocol==="https:";if(!c&&!this.config.httpAgent)this.config.httpAgent=await this.config.httpAgentProvider();return new Promise((a,u)=>{let f=void 0,m=-1,g=-1,w=-1,v=-1,C=-1,_=()=>{l.clearTimeout(m),l.clearTimeout(g),l.clearTimeout(w),l.clearTimeout(v),l.clearTimeout(C)},F=async(i)=>{await f,_(),a(i)},E=async(i)=>{await f,_(),u(i)};if(o?.aborted){let i=M(o);E(i);return}let D=e.headers,H=D?(D.Expect??D.expect)==="100-continue":!1,P=c?s.httpsAgent:s.httpAgent;if(H&&!this.externalAgent)P=new(c?A.Agent:L)({keepAlive:!1,maxSockets:1/0});m=l.setTimeout(()=>{this.socketWarningTimestamp=U.checkSocketUsage(P,this.socketWarningTimestamp,r)},s.socketAcquisitionWarningTimeout??(s.requestTimeout??2000)+(s.connectionTimeout??1000));let I=e.query?J(e.query):"",b=void 0;if(e.username!=null||e.password!=null){let i=e.username??"",d=e.password??"";b=`${i}:${d}`}let k=e.path;if(I)k+=`?${I}`;if(e.fragment)k+=`#${e.fragment}`;let y=e.hostname??"";if(y[0]==="["&&y.endsWith("]"))y=e.hostname.slice(1,-1);else y=e.hostname;let S={headers:e.headers,host:y,method:e.method,path:k,port:e.port,agent:P,auth:b},T=(c?A.request:V)(S,(i)=>{let d=new G({statusCode:i.statusCode||-1,reason:i.statusMessage,headers:Y(i.headers),body:i});F({response:d})});if(T.on("error",(i)=>{if(re.includes(i.code))E(Object.assign(i,{name:"TimeoutError"}));else E(i)}),o){let i=()=>{T.destroy();let d=M(o);E(d)};if(typeof o.addEventListener==="function"){let d=o;d.addEventListener("abort",i,{once:!0}),T.once("close",()=>d.removeEventListener("abort",i))}else o.onabort=i}let R=n??s.requestTimeout;g=ie(T,E,s.connectionTimeout),w=ce(T,E,R,s.throwOnRequestTimeout,r??console),v=fe(T,E,s.socketTimeout);let h=S.agent;if(typeof h==="object"&&"keepAlive"in h)C=ue(T,{keepAlive:h.keepAlive,keepAliveMsecs:h.keepAliveMsecs});f=Z(T,e,R,this.externalAgent).catch((i)=>(_(),u(i)))})}updateHttpClientConfig(e,o){this.config=void 0,this.configProvider=this.configProvider.then((n)=>{if(e===Symbol.for("logger"))return{...n,logger:n.logger??o};return{...n,[e]:o}})}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:o,connectionTimeout:n,socketTimeout:s,socketAcquisitionWarningTimeout:r,httpAgent:c,httpsAgent:a,throwOnRequestTimeout:u,logger:f}=e||{},m=!0,g=50;return{connectionTimeout:n,requestTimeout:o,socketTimeout:s,socketAcquisitionWarningTimeout:r,throwOnRequestTimeout:u,httpAgentProvider:async()=>{let w=p("http"),{Agent:v,request:C}=w.default??w;if(V=C,L=v,c instanceof L||typeof c?.destroy==="function")return this.externalAgent=!0,c;return new L({keepAlive:!0,maxSockets:50,...c})},httpsAgent:(()=>{if(a instanceof A.Agent||typeof a?.destroy==="function")return this.externalAgent=!0,a;return new A.Agent({keepAlive:!0,maxSockets:50,...a})})(),logger:f}}}var le=new Uint16Array(1);class N{id=le[0]++;total=0;max=0;session;refs=0;constructor(e){e.unref(),this.session=e}retain(){if(this.session.destroyed)throw Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");this.refs+=1,this.total+=1,this.max=Math.max(this.refs,this.max),this.session.ref()}free(){if(this.session.destroyed)return;if(this.refs-=1,this.refs===0)this.session.unref();if(this.refs<0)throw Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}deref(){return this.session}close(){if(!this.session.closed)this.session.close()}destroy(){if(this.refs=0,!this.session.destroyed)this.session.setTimeout(0),this.session.destroy()}useCount(){return this.refs}}class ee{sessions=[];maxConcurrency=0;constructor(e){this.sessions=(e??[]).map((o)=>new N(o))}poll(){let e=!1;for(let o of this.sessions){if(o.deref().destroyed){e=!0;continue}if(!this.maxConcurrency||o.useCount()<this.maxConcurrency)return o}if(e){for(let o of this.sessions)if(o.deref().destroyed)this.remove(o)}}offerLast(e){this.sessions.push(e)}remove(e){let o=this.sessions.indexOf(e);if(o>-1)this.sessions.splice(o,1)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(e){this.maxConcurrency=e}destroy(e){this.remove(e),e.destroy()}}class te{config;connectOptions;connectionPools=new Map;constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw RangeError("maxConcurrency must be greater than zero.")}lease(e,o){let n=this.getUrlString(e),s=this.getPool(n);if(!this.config.disableConcurrency&&!o.isEventStream){let f=s.poll();if(f)return f.retain(),f}let r=new N(this.connect(n)),c=r.deref();if(this.config.maxConcurrency)c.settings({maxConcurrentStreams:this.config.maxConcurrency},(f)=>{if(f)throw Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});let a=()=>{this.removeFromPoolAndClose(n,r)},u=()=>{this.removeFromPoolAndCheckedDestroy(n,r)};if(c.on("goaway",a),c.on("error",u),c.on("frameError",u),c.on("close",u),o.requestTimeout)c.setTimeout(o.requestTimeout,u);return s.offerLast(r),r.retain(),r}release(e,o){o.free()}createIsolatedSession(e,o){let n=this.getUrlString(e),s=new N(this.connect(n)),r=s.deref();r.settings({maxConcurrentStreams:1});let c=()=>{s.destroy()};r.on("error",c),r.on("frameError",c),r.on("close",c);let a=o.requestTimeout??300000;return r.setTimeout(a,c),s.retain(),s}destroy(){for(let[e,o]of this.connectionPools){for(let n of[...o])n.destroy();this.connectionPools.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e;for(let o of this.connectionPools.values())o.setMaxConcurrency(e)}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}setNodeHttp2ConnectOptions(e){this.connectOptions=e}debug(){let e={};for(let[o,n]of this.connectionPools){let s=[];for(let r of n)s.push({id:r.id,active:r.useCount(),maxConcurrent:r.max,totalRequests:r.total});e[o]={sessions:s}}return e}removeFromPoolAndClose(e,o){this.connectionPools.get(e)?.remove(o),o.close()}removeFromPoolAndCheckedDestroy(e,o){this.connectionPools.get(e)?.remove(o),o.destroy()}getPool(e){if(!this.connectionPools.has(e)){let o=new ee;if(this.config.maxConcurrency)o.setMaxConcurrency(this.config.maxConcurrency);this.connectionPools.set(e,o)}return this.connectionPools.get(e)}getUrlString(e){return e.destination.toString()}connect(e){return this.connectOptions===void 0?O.connect(e):O.connect(e,this.connectOptions)}}var{constants:K}=O;class q{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new te({});static create(e){if(typeof e?.handle==="function")return e;return new q(e)}constructor(e){this.configProvider=new Promise((o,n)=>{if(typeof e==="function")e().then((s)=>{o(s||{})}).catch(n);else o(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:o,requestTimeout:n,isEventStream:s}={}){if(!this.config){this.config=await this.configProvider;let{disableConcurrentStreams:f,maxConcurrentStreams:m,nodeHttp2ConnectOptions:g}=this.config;if(this.connectionManager.setDisableConcurrentStreams(f??!1),m)this.connectionManager.setMaxConcurrentStreams(m);if(g)this.connectionManager.setNodeHttp2ConnectOptions(g)}let{requestTimeout:r,disableConcurrentStreams:c}=this.config,a=c||s,u=n??r;return new Promise((f,m)=>{let g=!1,w=void 0,v=async(i)=>{await w,f(i)},C=async(i)=>{await w,m(i)};if(o?.aborted){g=!0;let i=M(o);C(i);return}let{hostname:_,method:F,port:E,protocol:D,query:H}=e,P="";if(e.username!=null||e.password!=null){let i=e.username??"",d=e.password??"";P=`${i}:${d}@`}let I=`${D}//${P}${_}${E?`:${E}`:""}`,b={destination:new URL(I)},k={requestTimeout:this.config?.sessionTimeout,isEventStream:s},y=a?this.connectionManager.createIsolatedSession(b,k):this.connectionManager.lease(b,k),S=y.deref(),x=(i)=>{if(a)y.destroy();g=!0,C(i)},T=H?J(H):"",R=e.path;if(T)R+=`?${T}`;if(e.fragment)R+=`#${e.fragment}`;let h=S.request({...e.headers,[K.HTTP2_HEADER_PATH]:R,[K.HTTP2_HEADER_METHOD]:F});if(u)h.setTimeout(u,()=>{h.close();let i=Error(`Stream timed out because of no activity for ${u} ms`);i.name="TimeoutError",x(i)});if(o){let i=()=>{h.close();let d=M(o);x(d)};if(typeof o.addEventListener==="function"){let d=o;d.addEventListener("abort",i,{once:!0}),h.once("close",()=>d.removeEventListener("abort",i))}else o.onabort=i}h.on("frameError",(i,d,oe)=>{x(Error(`Frame type id ${i} in stream id ${oe} has failed with code ${d}.`))}),h.on("error",x),h.on("aborted",()=>{x(Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${h.rstCode}.`))}),h.on("response",(i)=>{let d=new G({statusCode:i[":status"]??-1,headers:Y(i),body:h});if(g=!0,v({response:d}),a)S.close(),h.on("end",()=>{y.destroy()})}),h.on("close",()=>{if(a)y.destroy();else this.connectionManager.release(b,y);if(!g){let i=Error("Unexpected error: http2 request did not get a response");if(S.destroyed)i.name="TimeoutError";x(i)}}),w=Z(h,e,u)})}updateHttpClientConfig(e,o){this.config=void 0,this.configProvider=this.configProvider.then((n)=>({...n,[e]:o}))}httpHandlerConfigs(){return this.config??{}}}me.DEFAULT_REQUEST_TIMEOUT=he;me.NodeHttp2Handler=q;me.NodeHttpHandler=U});
5
- export{Fe};
package/chunk-tjpvayr1.js DELETED
@@ -1,2 +0,0 @@
1
- // @bun
2
- import*as Yn from"child_process";import*as yt from"crypto";import*as it from"fs";import*as x from"path";import*as Xr from"stream";import*as Xn from"util";export{Yn,yt,it,x,Xr,Xn};
package/chunk-ve7qx8wm.js DELETED
@@ -1,3 +0,0 @@
1
- // @bun
2
- function He(_){if(_===void 0)return;let n=Array.from(_);if(n.length<=64)return _;return n.slice(0,64).join("")}
3
- export{He};
package/chunk-y8ced1jm.js DELETED
@@ -1,5 +0,0 @@
1
- // @bun
2
- import{F}from"./chunk-c25s4w6a.js";import{xr}from"./chunk-v9fea96h.js";import{Je}from"./chunk-kgdrjqsy.js";import{de,ce,V,me,ee}from"./chunk-rjdhaasf.js";import{g}from"./chunk-n6e43rvk.js";import{z}from"./chunk-dakrpbe6.js";import{N,Me,ne,te,Q,H}from"./chunk-sf13azm4.js";import{M}from"./chunk-0rya8cxe.js";var S=9,U=4000,D=(t,e,n)=>{let r=new M,o=te(e,t.compat?.supportsMidConvoSystemMessages);return(async()=>{let s=B(t);try{let l=n?.apiKey;if(!l)throw Error(`No API key for provider: ${t.provider}`);let f=J(),u=me(o.messages,t,(d)=>f(d)),a=se(t,o,u,n),i=await n?.onPayload?.(a,t);if(i!==void 0)a=i;let c=await Z(t,a,l,n);if(r.push({type:"start",partial:s}),await ie(t,s,r,c,n?.onProviderStreamEvent),n?.signal?.aborted)throw Error("Request was aborted");if(s.stopReason==="pending")throw Error("Mistral stream ended without a finish reason");if(s.stopReason==="aborted"||s.stopReason==="error")throw Error(s.errorMessage||"An unknown error occurred");r.push({type:"done",reason:s.stopReason,message:s}),r.end()}catch(l){for(let f of s.content)delete f.partialArgs;s.stopReason=n?.signal?.aborted?"aborted":"error",s.errorMessage=K(l),r.push({type:"error",reason:s.stopReason,error:s}),r.end()}})(),r},Ee=(t,e,n)=>{let r=n?.apiKey;if(!r)throw Error(`No API key for provider: ${t.provider}`);let o={...V(t,e,n,r),toolChoice:n?.toolChoice},s=n?.reasoning?H(t,n.reasoning):void 0,l=s==="off"?void 0:s,f=t.reasoning?t.thinkingLevelMap:void 0,u=f?l?f[l]??"high":f.off??void 0:void 0;return D(t,e,{...o,promptMode:t.reasoning&&!f&&l?"reasoning":void 0,reasoningEffort:u})};function B(t){return{role:"assistant",content:[],api:t.api,provider:t.provider,model:t.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()}}function J(){let t=new Map,e=new Map;return(n)=>{let r=t.get(n);if(r)return r;let o=0;while(!0){let s=P(n,o),l=e.get(s);if(!l||l===n)return t.set(n,s),e.set(s,n),s;o++}}}function P(t,e){let n=t.replace(/[^a-zA-Z0-9]/g,"");if(e===0&&n.length===S)return n;let r=n||t,o=e===0?r:`${r}:${e}`;return Je(o).replace(/[^a-zA-Z0-9]/g,"").slice(0,S)}function K(t){if(t instanceof Error){let e=t,n=typeof e.statusCode==="number"?e.statusCode:void 0,r=typeof e.body==="string"?e.body.trim():void 0;if(n!==void 0&&r)return`Mistral API error (${n}): ${W(r,U)}`;if(n!==void 0)return`Mistral API error (${n}): ${t.message}`;return t.message}return q(t)}function W(t,e){if(t.length<=e)return t;return`${t.slice(0,e)}... [truncated ${t.length-e} chars]`}function q(t){try{let e=JSON.stringify(t);return e===void 0?String(t):e}catch{return String(t)}}async function Z(t,e,n,r){let o=new URL(t.baseUrl);o.pathname=`${o.pathname.replace(/\/+$/u,"")}/`;let s=new URL("v1/chat/completions",o),l=G(t,n,r),f=r?.timeoutMs??60000,u=AbortSignal.timeout(f),a=xr([r?.signal,u]),i;try{i=await(r?.fetch??globalThis.fetch)(s,{method:"POST",headers:l,body:JSON.stringify(X(e)),signal:a.signal})}catch(c){if(u.aborted&&!r?.signal?.aborted)throw Error(`Mistral response headers timed out after ${f}ms`);throw c}finally{a.cleanup()}if(await r?.onResponse?.({status:i.status,headers:z(i.headers)},t),!i.ok){let c=await i.text();throw new O(i.status,c,i.statusText)}if(!i.body)throw Error("Mistral response has no body");return oe(i.body,r?.signal)}class O extends Error{statusCode;body;constructor(t,e,n){super(n||`Request failed with status ${t}`);this.name="MistralHttpError",this.statusCode=t,this.body=e}}function G(t,e,n){let r=new Headers({"User-Agent":ee(),accept:"text/event-stream",authorization:`Bearer ${e}`,"content-type":"application/json"});A(r,t.headers),A(r,n?.headers);let o=I(t.headers,"x-affinity")||I(n?.headers,"x-affinity");if(L(n)&&!o)r.set("x-affinity",n.sessionId);return r}function A(t,e){if(!e)return;for(let[n,r]of Object.entries(e))if(r===null)t.delete(n);else t.set(n,r)}function I(t,e){return!!t&&Object.keys(t).some((n)=>n.toLowerCase()===e)}function X(t){let e={...t};for(let[r,o]of[["topP","top_p"],["maxTokens","max_tokens"],["randomSeed","random_seed"],["responseFormat","response_format"],["toolChoice","tool_choice"],["presencePenalty","presence_penalty"],["frequencyPenalty","frequency_penalty"],["parallelToolCalls","parallel_tool_calls"],["reasoningEffort","reasoning_effort"],["promptMode","prompt_mode"],["promptCacheKey","prompt_cache_key"],["safePrompt","safe_prompt"]])k(e,r,o);e.messages=t.messages.map((r)=>Y(r));let n=e.response_format;if(w(n)){let r={...n};k(r,"jsonSchema","json_schema");let o=r.json_schema;if(w(o)){let s={...o};k(s,"schemaDefinition","schema"),r.json_schema=s}e.response_format=r}return e}function Y(t){let e={...t};if(k(e,"toolCalls","tool_calls"),k(e,"toolCallId","tool_call_id"),Array.isArray(t.content))e.content=t.content.map((n)=>re(n));return e}function re(t){let e={...t};for(let[n,r]of[["imageUrl","image_url"],["documentUrl","document_url"],["documentName","document_name"],["fileId","file_id"],["referenceIds","reference_ids"],["inputAudio","input_audio"]])k(e,n,r);return e}function k(t,e,n){if(!(e in t))return;t[n]=t[e],delete t[e]}function w(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var b=Symbol("mistral-stream-done");async function*oe(t,e){let n=t.getReader(),r=new TextDecoder,o="",s=()=>{n.cancel().catch(()=>{})};e?.addEventListener("abort",s,{once:!0});try{while(!0){if(e?.aborted)throw e.reason;let{done:l,value:f}=await n.read();if(e?.aborted)throw e.reason;o+=l?r.decode():r.decode(f,{stream:!0});let u=E(o);while(u){let a=v(o.slice(0,u.index));if(o=o.slice(u.index+u.length),a===b)return;if(a)yield a;u=E(o)}if(l)break}if(o.trim()){let l=v(o);if(l!==b&&l)yield l}}finally{e?.removeEventListener("abort",s);try{await n.cancel()}catch{}try{n.releaseLock()}catch{}}}function E(t){let e=/\r\n\r\n|\r\n\r|\r\n\n|\r\r\n|\n\r\n|\r\r|\n\r|\n\n/u.exec(t);return e?.index===void 0?void 0:{index:e.index,length:e[0].length}}function v(t){let e=t.split(/\r\n|\r|\n/u).filter((r)=>r.startsWith("data:")).map((r)=>r.slice(5).trimStart()).join(`
3
- `).trim();if(!e)return;if(e==="[DONE]")return b;let n=JSON.parse(e);if(!w(n)||!Array.isArray(n.choices))throw Error("Invalid Mistral streaming event");return{data:n}}function se(t,e,n,r){let o={model:t.id,stream:!0,messages:fe(n,t.input.includes("image"))},s=ne(e.messages);if(s.length>0)o.tools=le(s);if(r?.temperature!==void 0)o.temperature=r.temperature;if(r?.maxTokens!==void 0)o.maxTokens=r.maxTokens;if(r?.toolChoice)o.toolChoice=pe(r.toolChoice);if(r?.promptMode)o.promptMode=r.promptMode;if(r?.reasoningEffort)o.reasoningEffort=r.reasoningEffort;if(L(r))o.promptCacheKey=r.sessionId;return o}function L(t){return t?.cacheRetention!=="none"&&!!t?.sessionId}function ae(t,e){let n=t,r=n.promptTokensDetails?.cachedTokens??n.prompt_tokens_details?.cached_tokens??n.promptTokenDetails?.cachedTokens??n.prompt_token_details?.cached_tokens??n.numCachedTokens??n.num_cached_tokens??0,o=typeof r==="number"&&Number.isFinite(r)?r:0;return Math.min(e,Math.max(0,o))}async function ie(t,e,n,r,o){let s=null,l=e.content,f=()=>l.length-1,u=new Map,a=(i)=>{if(!i)return;if(i.type==="text"){n.push({type:"text_end",contentIndex:f(),content:i.text,partial:e});return}if(i.type==="thinking")n.push({type:"thinking_end",contentIndex:f(),content:i.thinking,partial:e})};for await(let i of r){let c=i.data;if(await o?.(c,t),e.responseId||=c.id,c.usage){let p=c.usage.prompt_tokens||0,h=ae(c.usage,p);e.usage.input=Math.max(0,p-h),e.usage.output=c.usage.completion_tokens||0,e.usage.cacheRead=h,e.usage.cacheWrite=0,e.usage.totalTokens=c.usage.total_tokens||e.usage.input+e.usage.output+e.usage.cacheRead+e.usage.cacheWrite,Q(t,e.usage)}let d=c.choices[0];if(!d)continue;if(d.finish_reason){e.rawStopReason=d.finish_reason;let p=he(d.finish_reason);if(e.stopReason=p.stopReason,p.errorMessage)e.errorMessage=p.errorMessage}let x=d.delta;if(x.content!==null&&x.content!==void 0){let p=typeof x.content==="string"?[x.content]:x.content;for(let h of p){if(typeof h==="string"){let m=g(h);if(!m)continue;if(!s||s.type!=="text")a(s),s={type:"text",text:""},e.content.push(s),n.push({type:"text_start",contentIndex:f(),partial:e});s.text+=m,n.push({type:"text_delta",contentIndex:f(),delta:m,partial:e});continue}if(h.type==="thinking"){let m=(h.thinking??[]).map((y)=>y.text??"").filter((y)=>y.length>0).join(""),_=g(m);if(!_)continue;if(!s||s.type!=="thinking")a(s),s={type:"thinking",thinking:""},e.content.push(s),n.push({type:"thinking_start",contentIndex:f(),partial:e});s.thinking+=_,n.push({type:"thinking_delta",contentIndex:f(),delta:_,partial:e});continue}if(h.type==="text"){let m=g(h.text??"");if(!m)continue;if(!s||s.type!=="text")a(s),s={type:"text",text:""},e.content.push(s),n.push({type:"text_start",contentIndex:f(),partial:e});s.text+=m,n.push({type:"text_delta",contentIndex:f(),delta:m,partial:e})}}}let j=x.tool_calls||[];for(let p of j){if(s)a(s),s=null;let h=p.id&&p.id!=="null"?p.id:P(`toolcall:${p.index??0}`,0),m=p.index??h,_=u.get(m),y;if(_!==void 0){let R=e.content[_];if(R?.type==="toolCall")y=R}if(!y)y={type:"toolCall",id:h,name:p.function.name,arguments:{},partialArgs:""},e.content.push(y),u.set(m,e.content.length-1),n.push({type:"toolcall_start",contentIndex:e.content.length-1,partial:e});let C=typeof p.function.arguments==="string"?p.function.arguments:JSON.stringify(p.function.arguments||{});y.partialArgs=(y.partialArgs||"")+C,y.arguments=F(y.partialArgs),n.push({type:"toolcall_delta",contentIndex:u.get(m),delta:C,partial:e})}}a(s);for(let i of u.values()){let c=e.content[i];if(c.type!=="toolCall")continue;let d=c;d.arguments=F(d.partialArgs),delete d.partialArgs,n.push({type:"toolcall_end",contentIndex:i,toolCall:d,partial:e})}}function le(t){return t.map((e)=>{let n=ce(e,!0);return{type:"function",function:{name:e.name,description:e.description,parameters:T(de(e,n)),strict:n??!1}}})}function T(t){if(Array.isArray(t))return t.map((e)=>T(e));if(t&&typeof t==="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=T(r);return e}return t}function fe(t,e){let n=[];for(let[r,o]of t.entries()){if(o.role==="system"){let a=r===0?N(o):Me(o);if(a.length>0)n.push({role:"system",content:g(a)});continue}if(o.role==="user"){if(typeof o.content==="string"){n.push({role:"user",content:g(o.content)});continue}let a=o.content.some((c)=>c.type==="image"),i=o.content.filter((c)=>c.type==="text"||e).map((c)=>{if(c.type==="text")return{type:"text",text:g(c.text)};return{type:"image_url",imageUrl:`data:${c.mimeType};base64,${c.data}`}});if(i.length>0){n.push({role:"user",content:i});continue}if(a&&!e)n.push({role:"user",content:"(image omitted: model does not support images)"});continue}if(o.role==="assistant"){let a=[],i=[];for(let d of o.content){if(d.type==="text"){if(d.text.trim().length>0)a.push({type:"text",text:g(d.text)});continue}if(d.type==="thinking"){if(d.thinking.trim().length>0)a.push({type:"thinking",thinking:[{type:"text",text:g(d.thinking)}]});continue}i.push({id:d.id,type:"function",function:{name:d.name,arguments:JSON.stringify(d.arguments||{})},index:0})}let c={role:"assistant",prefix:!1};if(a.length>0)c.content=a;if(i.length>0)c.toolCalls=i;if(a.length>0||i.length>0)n.push(c);continue}let s=[],l=o.content.filter((a)=>a.type==="text").map((a)=>a.type==="text"?g(a.text):"").join(`
4
- `),f=o.content.some((a)=>a.type==="image"),u=ue(l,f,e,o.isError);s.push({type:"text",text:u});for(let a of o.content){if(!e)continue;if(a.type!=="image")continue;s.push({type:"image_url",imageUrl:`data:${a.mimeType};base64,${a.data}`})}n.push({role:"tool",toolCallId:o.toolCallId,name:o.toolName,content:s})}return n}function ue(t,e,n,r){let o=t.trim(),s=r?"[tool error] ":"";if(o.length>0)return`${s}${o}${e&&!n?`
5
- [tool image omitted: model does not support images]`:""}`;if(e){if(n)return r?"[tool error] (see attached image)":"(see attached image)";return r?"[tool error] (image omitted: model does not support images)":"(image omitted: model does not support images)"}return r?"[tool error] (no tool output)":"(no tool output)"}function pe(t){if(!t)return;if(t==="auto"||t==="none"||t==="any"||t==="required")return t;return{type:"function",function:{name:t.function.name}}}function he(t){if(t===null)return{stopReason:"stop"};switch(t){case"stop":return{stopReason:"stop"};case"length":case"model_length":return{stopReason:"length"};case"tool_calls":return{stopReason:"toolUse"};case"error":return{stopReason:"error",errorMessage:"Provider stopped with: error (server error)"};default:return{stopReason:"error",errorMessage:`Provider stopped with: ${t}`}}}export{D as stream,Ee as streamSimple};
package/chunk-yb1jxgnk.js DELETED
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Jr}from"./chunk-7yw8aa5j.js";import"./chunk-hat3s3pr.js";import"./chunk-c25s4w6a.js";import{st,Xe,at}from"./chunk-g2k3yhgh.js";import{He}from"./chunk-ve7qx8wm.js";import{Cr,ii}from"./chunk-6gyhajhx.js";import{q,j}from"./chunk-y69ewdn2.js";import{Ee,ct,V,ee}from"./chunk-rjdhaasf.js";import{ie}from"./chunk-d48bfd2e.js";import{z}from"./chunk-dakrpbe6.js";import{te,ge,ye,H}from"./chunk-sf13azm4.js";import{M}from"./chunk-0rya8cxe.js";var g=new Set(["openai","openai-codex","opencode","azure"]),h=16;function y(r){return j(q(r),"Azure OpenAI API error")}var A=(r,a,e)=>{let t=new M,i=te(a,r.compat?.supportsMidConvoSystemMessages);return(async()=>{let n=Cr(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=Ee(ge(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 ie(()=>c.responses.create(m,f).withResponse(),{maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,signal:e?.signal});if(await e?.onResponse?.({status:l.status,headers:z(l.headers)},r),t.push({type:"start",partial:s}),await at(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},N=(r,a,e)=>{let t=e?.apiKey;if(!t)throw Error(`No API key for provider: ${r.provider}`);let i={...V(r,a,e,t),toolChoice:e?.toolChoice},n=e?.reasoning?H(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}=ii(r,e);return new Jr({apiKey:a,apiVersion:n,dangerouslyAllowBrowser:!0,fetch:e?.fetch,defaultHeaders:t,baseURL:i})}function T(r,a,e,t,i=Ee(ge(a.messages),r.compat?.supportsOpenAIGrammarTools??!1)){let n=r.compat?.supportsAdditionalTools??!1,s=r.compat?.supportsToolSearch??!1,p=ye(a.messages,n||s),c=st(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:He(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=Xe(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,N as streamSimple};
@@ -1 +0,0 @@
1
- import{xi}from"./chunk-gxn0bey7.js";export{xi as createGitGraphServices};
@@ -1 +0,0 @@
1
- import{gi}from"./chunk-gxn0bey7.js";export{gi as createTreemapServices};
@@ -1 +0,0 @@
1
- import{Ci}from"./chunk-gxn0bey7.js";export{Ci as createTreeViewServices};