@bkm016/basalt 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +275 -2
- package/chunk-0hbjv3y6.js +11 -0
- package/chunk-0rya8cxe.js +3 -0
- package/chunk-0szjy61m.js +2 -0
- package/chunk-0tdv0t5q.js +3 -0
- package/chunk-1egbcp85.js +59 -0
- package/chunk-1fv27j4b.js +3 -0
- package/chunk-1yzt0qm0.js +2 -0
- package/chunk-2zqny2sy.js +2 -0
- package/chunk-32at88hc.js +3 -0
- package/chunk-356q8e0y.js +10 -0
- package/chunk-3jz9g8ab.js +10 -0
- package/chunk-3p7q2pyp.js +3 -0
- package/chunk-501zkf9b.js +3 -0
- package/chunk-58vz2qsq.js +2 -0
- package/chunk-5fdgy0q2.js +16 -0
- package/chunk-5wp4egky.js +7 -0
- package/chunk-665jzf2w.js +25 -0
- package/chunk-6gyhajhx.js +3 -0
- package/chunk-7yw8aa5j.js +31 -0
- package/chunk-8wjgbd9k.js +3 -0
- package/chunk-913tfr9c.js +2 -0
- package/chunk-97kjn55j.js +2 -0
- package/chunk-9y69ywyg.js +3 -0
- package/chunk-a6r4z44b.js +2 -0
- package/chunk-agntrqs9.js +2 -0
- package/chunk-b9bg5fhd.js +2 -0
- package/chunk-bj14jshr.js +3 -0
- package/chunk-c25s4w6a.js +5 -0
- package/chunk-d48bfd2e.js +3 -0
- package/chunk-d913kpyw.js +3 -0
- package/chunk-dakrpbe6.js +3 -0
- package/chunk-g2k3yhgh.js +12 -0
- package/chunk-hat3s3pr.js +3 -0
- package/chunk-hcn9cf6v.js +2 -0
- package/chunk-j2x0g1vg.js +2 -0
- package/chunk-k0t23cmx.js +2 -0
- package/chunk-k7w7ac9q.js +18 -0
- package/chunk-kgdrjqsy.js +3 -0
- package/chunk-kjr81mrd.js +9 -0
- package/chunk-m38ber71.js +2 -0
- package/chunk-n6e43rvk.js +3 -0
- package/chunk-qbf8x2ft.js +5 -0
- package/chunk-qcwnkr5y.js +2 -0
- package/chunk-qffb7een.js +3 -0
- package/chunk-qnr1f5pj.js +3 -0
- package/chunk-r9aatvwm.js +3 -0
- package/chunk-rad3dm0q.js +2 -0
- package/chunk-rjdhaasf.js +3 -0
- package/chunk-rm3kcxq9.js +20 -0
- package/chunk-rv06x0kn.js +7 -0
- package/chunk-sf13azm4.js +12 -0
- package/chunk-sytpmbfp.js +471 -0
- package/chunk-t057xfrt.js +5 -0
- package/chunk-tjpvayr1.js +2 -0
- package/chunk-tnrqkc7b.js +8 -0
- package/chunk-v9fea96h.js +3 -0
- package/chunk-ve7qx8wm.js +3 -0
- package/chunk-vkkj4awb.js +2 -0
- package/chunk-wc5j0hfw.js +39 -0
- package/chunk-wd9zxhza.js +2 -0
- package/chunk-wx7kdf0b.js +2 -0
- package/chunk-x9982ek7.js +25 -0
- package/chunk-xhk54h2q.js +7 -0
- package/chunk-xsbxykr4.js +2 -0
- package/chunk-y69ewdn2.js +3 -0
- package/chunk-y8ced1jm.js +5 -0
- package/chunk-y9xe9ct2.js +2 -0
- package/chunk-yb1jxgnk.js +2 -0
- package/chunk-zt1wvkyf.js +3 -0
- package/compiled.js +3773 -0
- package/icon-dp9pmcvp.png +0 -0
- package/package.json +20 -4
- package/ui-test-worker.js +226 -0
- package/web/KaTeX_AMS-Regular-n7eqehx2.woff2 +0 -0
- package/web/KaTeX_Caligraphic-Bold-20r3b6fv.woff2 +0 -0
- package/web/KaTeX_Caligraphic-Regular-kkjm8f18.woff2 +0 -0
- package/web/KaTeX_Fraktur-Bold-pz5vg4t0.woff2 +0 -0
- package/web/KaTeX_Fraktur-Regular-a1e9wkwk.woff2 +0 -0
- package/web/KaTeX_Main-Bold-mcp098h8.woff2 +0 -0
- package/web/KaTeX_Main-BoldItalic-fy74z249.woff2 +0 -0
- package/web/KaTeX_Main-Italic-hw2gxy7f.woff2 +0 -0
- package/web/KaTeX_Main-Regular-xvp1b75c.woff2 +0 -0
- package/web/KaTeX_Math-BoldItalic-mf5nf33d.woff2 +0 -0
- package/web/KaTeX_Math-Italic-ap60jrna.woff2 +0 -0
- package/web/KaTeX_SansSerif-Bold-we3bymb6.woff2 +0 -0
- package/web/KaTeX_SansSerif-Italic-ent92bjx.woff2 +0 -0
- package/web/KaTeX_SansSerif-Regular-0573pbz9.woff2 +0 -0
- package/web/KaTeX_Script-Regular-z2rtj6vq.woff2 +0 -0
- package/web/KaTeX_Size1-Regular-dfr3w1hv.woff2 +0 -0
- package/web/KaTeX_Size2-Regular-kted78zb.woff2 +0 -0
- package/web/KaTeX_Size3-Regular-e6k1k5jk.woff2 +0 -0
- package/web/KaTeX_Size4-Regular-abedc1pd.woff2 +0 -0
- package/web/KaTeX_Typewriter-Regular-scw9zx1z.woff2 +0 -0
- package/web/apple-touch-icon-7dkm33qp.png +0 -0
- package/web/apple-touch-icon.png +0 -0
- package/web/chunk-00mq7bhx.js +1 -0
- package/web/chunk-0atfn8jf.js +1 -0
- package/web/chunk-0k0hvh59.js +40 -0
- package/web/chunk-0mrkjnte.js +1 -0
- package/web/chunk-0pbjgdgp.js +2 -0
- package/web/chunk-0s80zw00.js +1 -0
- package/web/chunk-0xck277j.js +140 -0
- package/web/chunk-1t760bg0.js +1 -0
- package/web/chunk-1v3d60pp.js +217 -0
- package/web/chunk-1x8fn8w9.js +1 -0
- package/web/chunk-20q90epj.js +2 -0
- package/web/chunk-24mfx6w1.js +2 -0
- package/web/chunk-29e1trsq.js +78 -0
- package/web/chunk-2j4m0bh1.js +2 -0
- package/web/chunk-310yey4q.js +1 -0
- package/web/chunk-32ezm0ry.js +1136 -0
- package/web/chunk-3ahpr030.js +2 -0
- package/web/chunk-3bqh2dkw.js +7 -0
- package/web/chunk-3cfabjey.js +370 -0
- package/web/chunk-3hvgs5aw.js +1 -0
- package/web/chunk-3kh6zefg.js +1 -0
- package/web/chunk-3pf33xsm.js +98 -0
- package/web/chunk-3pm4645m.js +2 -0
- package/web/chunk-401v5ht6.js +8 -0
- package/web/chunk-4b5mt5pd.js +70 -0
- package/web/chunk-4gavbw65.js +1 -0
- package/web/chunk-4rm1vy7w.js +1 -0
- package/web/chunk-4wd9r73y.js +1 -0
- package/web/chunk-4y2td14d.js +24 -0
- package/web/chunk-54thej0t.js +2 -0
- package/web/chunk-55kw67nv.js +1 -0
- package/web/chunk-59kqahb3.js +1 -0
- package/web/chunk-5hex8g0y.js +24 -0
- package/web/chunk-5r5kv4gh.js +1 -0
- package/web/chunk-6atq9qtt.js +7 -0
- package/web/chunk-6beqrmtq.js +1 -0
- package/web/chunk-6m69hczt.js +2 -0
- package/web/chunk-6r912gfj.js +34 -0
- package/web/chunk-74j07k8k.js +2 -0
- package/web/chunk-7f0m2yrd.js +169 -0
- package/web/chunk-8g239029.js +1 -0
- package/web/chunk-942prjb6.js +332 -0
- package/web/chunk-95q1bwxn.js +1 -0
- package/web/chunk-9s7c178f.js +1 -0
- package/web/chunk-9v1f6yc8.js +1 -0
- package/web/chunk-a3xt6840.js +38 -0
- package/web/chunk-ad6x47yy.js +1 -0
- package/web/chunk-b5brnfv9.js +2 -0
- package/web/chunk-benmmqt2.js +1 -0
- package/web/chunk-bgqdcnke.js +1 -0
- package/web/chunk-bhe4jzha.js +1 -0
- package/web/chunk-bwyw10wx.js +39 -0
- package/web/chunk-c85wxnpw.js +292 -0
- package/web/chunk-canbct9d.js +55 -0
- package/web/chunk-cg3jterp.js +2 -0
- package/web/chunk-d18r4m14.js +141 -0
- package/web/chunk-d4d3mnak.js +84 -0
- package/web/chunk-dmqtdeb4.js +1 -0
- package/web/chunk-dy2gm1fs.js +1 -0
- package/web/chunk-e5rmr47n.js +2 -0
- package/web/chunk-ea9swkkt.js +1 -0
- package/web/chunk-ejd43q75.js +19 -0
- package/web/chunk-eqegxtdt.js +1 -0
- package/web/chunk-ev1g5cqw.js +2 -0
- package/web/chunk-ezyvv4ab.js +3 -0
- package/web/chunk-f91wzwtk.js +1 -0
- package/web/chunk-fdkp6tzq.js +36 -0
- package/web/chunk-g1ev11wx.js +1 -0
- package/web/chunk-g9qv15hq.js +41 -0
- package/web/chunk-ghxe4gam.js +2 -0
- package/web/chunk-gmfp7fg4.js +1 -0
- package/web/chunk-gxay64d5.js +1 -0
- package/web/chunk-gxn0bey7.js +142 -0
- package/web/chunk-haphmhz8.js +200 -0
- package/web/chunk-hejz98gw.js +1 -0
- package/web/chunk-hfaffkrh.js +1 -0
- package/web/chunk-hp167dbv.js +1 -0
- package/web/chunk-hryhthxr.js +16 -0
- package/web/chunk-j2vt8c8v.js +1 -0
- package/web/chunk-jg6nzn6q.js +1 -0
- package/web/chunk-jtwhjp20.js +303 -0
- package/web/chunk-jvhmna7z.js +89 -0
- package/web/chunk-ka3q31t1.js +1 -0
- package/web/chunk-kbtbbarw.js +2 -0
- package/web/chunk-ktqt87qw.js +1 -0
- package/web/chunk-kx2xk3bb.js +1 -0
- package/web/chunk-m2d1sp30.js +1 -0
- package/web/chunk-mdsgekpk.js +1 -0
- package/web/chunk-mq92vqb1.js +2 -0
- package/web/chunk-n1dmrz44.js +2 -0
- package/web/chunk-n5fn9khr.js +1 -0
- package/web/chunk-n90cqdvg.js +2 -0
- package/web/chunk-nerx2q12.js +139 -0
- package/web/chunk-ngpq43vn.js +1 -0
- package/web/chunk-nj0cv1cq.js +257 -0
- package/web/chunk-nzey7cpv.js +1 -0
- package/web/chunk-p8y0hjx9.js +2 -0
- package/web/chunk-pxe3vna4.js +1 -0
- package/web/chunk-pz934t6t.js +30 -0
- package/web/chunk-r1dnh0s8.js +1 -0
- package/web/chunk-r5eakmw6.js +1 -0
- package/web/chunk-rkesqprv.js +1 -0
- package/web/chunk-rsn8j7xv.js +120 -0
- package/web/chunk-rtf2zzzv.js +1 -0
- package/web/chunk-ry9256r7.js +1 -0
- package/web/chunk-rykfak98.js +2 -0
- package/web/chunk-rz6wwdd5.js +106 -0
- package/web/chunk-s8vapqgr.js +12 -0
- package/web/chunk-sc63gh9d.js +2 -0
- package/web/chunk-srrfphes.js +1 -0
- package/web/chunk-svdzmaxb.js +2 -0
- package/web/chunk-svmhj9hd.js +1 -0
- package/web/chunk-t6agpn2z.js +1 -0
- package/web/chunk-tfyxp2qs.js +89 -0
- package/web/chunk-ts7zrf5b.js +2 -0
- package/web/chunk-ttg6tbwx.js +2 -0
- package/web/chunk-v47rhg7b.js +1 -0
- package/web/chunk-v5cnt7c8.js +1 -0
- package/web/chunk-v6v831tc.js +214 -0
- package/web/chunk-vadqkz3x.js +99 -0
- package/web/chunk-vfqdy860.js +1 -0
- package/web/chunk-vfqe8298.js +1 -0
- package/web/chunk-vqjs551t.js +7 -0
- package/web/chunk-wtawdeej.css +1 -0
- package/web/chunk-x3zwjkwg.js +62 -0
- package/web/chunk-x59p8sg2.js +1 -0
- package/web/chunk-x9q4kh67.js +4 -0
- package/web/chunk-xet1jjy9.js +1 -0
- package/web/chunk-xzp7jf7e.js +2 -0
- package/web/chunk-y7z144e3.js +1 -0
- package/web/chunk-ydgqrfvw.js +2 -0
- package/web/chunk-ydtrc1ay.js +2 -0
- package/web/chunk-yj1a2d37.js +1 -0
- package/web/chunk-ykxpb3wv.js +2 -0
- package/web/chunk-ytpwz01r.js +291 -0
- package/web/chunk-z09emmrb.js +1 -0
- package/web/chunk-z1jtv4c0.js +2 -0
- package/web/chunk-zakv2xdf.js +1 -0
- package/web/chunk-zbj1trar.js +2 -0
- package/web/chunk-zk2f7x5e.js +4 -0
- package/web/icon-192.png +0 -0
- package/web/icon-512.png +0 -0
- package/web/icon-maskable-512.png +0 -0
- package/web/icon-yx2p2pye.svg +13 -0
- package/web/icon.svg +13 -0
- package/web/index.html +23 -0
- package/web/install.ps1 +91 -0
- package/web/install.sh +177 -0
- package/web/inter-latin-wght-normal-an0py913.woff2 +0 -0
- package/web/jetbrains-mono-latin-wght-normal-hj2e42wt.woff2 +0 -0
- package/web/manifest-txf6vfbq.webmanifest +35 -0
- package/web/manifest.webmanifest +35 -0
- package/web/source-serif-4-latin-wght-italic-ta5tqqvz.woff2 +0 -0
- package/web/source-serif-4-latin-wght-normal-1yyvbhsz.woff2 +0 -0
- package/web/sw.js +90 -0
- package/worker.js +2 -0
|
@@ -0,0 +1,5 @@
|
|
|
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};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{F}from"./chunk-c25s4w6a.js";import{_}from"./chunk-hat3s3pr.js";import{z,he}from"./chunk-dakrpbe6.js";import{M,qt,Te}from"./chunk-0rya8cxe.js";class u extends Error{code;diagnosticDetails;constructor(r,t,n){super(r);this.name="PiMessagesResponseError",this.code=t,this.diagnosticDetails=n}}function x(r){try{let t=JSON.parse(r),n=t?.error;return t&&typeof n==="object"&&n!==null&&!Array.isArray(n)?t:void 0}catch{return}}function m(r){return r.length>8192?`${r.slice(0,8192)}\u2026`:r}function y(r,t,n){let e=typeof n?.error?.message==="string"?n.error.message:void 0,s=typeof n?.error?.code==="string"?n.error.code:void 0,a=e??t,o=s?` (${s})`:"";return`${r.status} ${r.statusText}: ${a}${o}`}function k(r,t,n,e){let s=x(e),a=typeof s?.error?.code==="string"?s.error.code:void 0;return new u(y(n,e,s),a,{version:1,provider:r.provider,model:r.id,url:t.toString(),status:n.status,statusText:n.statusText,...s?.error===void 0?{}:{error:s.error},...s?{}:{body:m(e)},timestampMs:Date.now()})}function h(){return{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}function l(r,t){if(!t)return;Te(r,{type:"pi_messages_rewrite",timestamp:Date.now(),details:{...t}})}function w(r){let t={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:"pending",timestamp:Date.now()},n=new Map;return(e)=>{switch(e.type){case"done":if(Object.assign(t,{stopReason:e.reason,usage:e.usage,responseId:e.responseId}),e.providerThinkingLevel!==void 0)t.providerThinkingLevel=e.providerThinkingLevel;return l(t,e.rewrite),{type:"done",reason:e.reason,message:t};case"error":if(Object.assign(t,{stopReason:e.reason,usage:e.usage,errorMessage:e.errorMessage,responseId:e.responseId}),e.providerThinkingLevel!==void 0)t.providerThinkingLevel=e.providerThinkingLevel;return l(t,e.rewrite),{type:"error",reason:e.reason,error:t};case"start":break;case"text_start":t.content[e.contentIndex]={type:"text",text:""};break;case"text_delta":t.content[e.contentIndex].text+=e.delta;break;case"text_end":Object.assign(t.content[e.contentIndex],{text:e.content,textSignature:e.contentSignature});break;case"thinking_start":t.content[e.contentIndex]={type:"thinking",thinking:""};break;case"thinking_delta":t.content[e.contentIndex].thinking+=e.delta;break;case"thinking_end":Object.assign(t.content[e.contentIndex],{thinking:e.content,thinkingSignature:e.contentSignature,redacted:e.redacted});break;case"toolcall_start":t.content[e.contentIndex]={type:"toolCall",id:e.id,name:e.toolName,arguments:{}},n.set(e.contentIndex,"");break;case"toolcall_delta":{let s=`${n.get(e.contentIndex)??""}${e.delta}`;n.set(e.contentIndex,s),t.content[e.contentIndex].arguments=F(s);break}case"toolcall_end":return Object.assign(t.content[e.contentIndex],e.toolCall),n.delete(e.contentIndex),{type:"toolcall_end",contentIndex:e.contentIndex,toolCall:t.content[e.contentIndex],partial:t}}return{...e,partial:t}}}async function*b(r){let t=new TextDecoder,n=r.getReader(),e="";try{while(!0){let{done:s,value:a}=await n.read();e+=s?t.decode():t.decode(a,{stream:!0}),e=e.replace(/\r\n/g,`
|
|
3
|
+
`);let o=e.indexOf(`
|
|
4
|
+
|
|
5
|
+
`);while(o!==-1){let c=f(e.slice(0,o));if(c)yield c;e=e.slice(o+2),o=e.indexOf(`
|
|
6
|
+
|
|
7
|
+
`)}if(s)break}if(e.trim()){let s=f(e);if(s)yield s}}finally{n.releaseLock()}}function f(r){let t=r.split(`
|
|
8
|
+
`).find((n)=>n.startsWith("data:"))?.slice(5).trim();return t&&t!=="[DONE]"?JSON.parse(t):void 0}function I(r,t,n){let e=n?"aborted":"error",s={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:e,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()};if(!n&&t instanceof u)Te(s,qt("pi_messages_response_failure",t,t.diagnosticDetails));return{type:"error",reason:e,error:s}}function E(r,t){if(r)return r;return _("PI_CACHE_RETENTION",t)==="long"?"long":void 0}var T=(r,t,n)=>{let e=new M,s=w(r);return(async()=>{try{let a=n?.apiKey;if(!a)throw Error(`No API key provided for provider "${r.provider}"`);let o=new URL(`${r.baseUrl.replace(/\/+$/u,"")}/messages`);if(n?.debug)o.searchParams.set("debug","1");let c={model:r.id,context:t,options:{temperature:n?.temperature,maxTokens:n?.maxTokens,reasoning:n?.reasoning,cacheRetention:E(n?.cacheRetention,n?.env),sessionId:n?.sessionId,toolChoice:n?.toolChoice}},p=await n?.onPayload?.(c,r);if(p!==void 0)c=p;let i=await(n?.fetch??globalThis.fetch)(o,{method:"POST",headers:{authorization:`Bearer ${a}`,accept:"text/event-stream","content-type":"application/json",...he(n?.headers)},body:JSON.stringify(c),signal:n?.signal});if(await n?.onResponse?.({status:i.status,headers:z(i.headers)},r),!i.ok){let d=await i.text();throw k(r,o,i,d)}if(!i.body)throw Error(`${r.provider} response has no body`);for await(let d of b(i.body)){await n?.onProviderStreamEvent?.(d,r);let g=s(d);if(e.push(g),g.type==="done"||g.type==="error")return}throw Error(`${r.provider} stream ended without a terminal event`)}catch(a){e.push(I(r,a,n?.signal?.aborted??!1))}})(),e},C=(r,t,n)=>{let e=n;return T(r,t,{...n,reasoning:n?.reasoning,toolChoice:n?.toolChoice,debug:e?.debug})};export{u as PiMessagesResponseError,T as stream,C as streamSimple};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function xr(i){let e=i.filter((n)=>n!==void 0);if(e.length===0)return{cleanup:()=>{}};if(e.length===1)return{signal:e[0],cleanup:()=>{}};let r=new AbortController,o=[],s=(n)=>{if(!r.signal.aborted)r.abort(n.reason)};for(let n of e){if(n.aborted){s(n);break}let t=()=>s(n);n.addEventListener("abort",t,{once:!0}),o.push({signal:n,listener:t})}return{signal:r.signal,cleanup:()=>{for(let{signal:n,listener:t}of o)n.removeEventListener("abort",t)}}}
|
|
3
|
+
export{xr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{L}from"./chunk-0hbjv3y6.js";import{b}from"./chunk-k7w7ac9q.js";import{i}from"./chunk-qnr1f5pj.js";var u=i(b());var B=i(b());var p=i(L()),d=i(b());var P=i(L()),f=i(b()),S=(e,t,r)=>{let o={EcsContainer:async(s)=>{let{fromHttp:a}=await import("./chunk-rv06x0kn.js"),{fromContainerMetadata:n}=await import("./chunk-32at88hc.js");return r?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),async()=>f.chain(a(s??{}),n(s))().then(m)},Ec2InstanceMetadata:async(s)=>{r?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");let{fromInstanceMetadata:a}=await import("./chunk-32at88hc.js");return async()=>a(s)().then(m)},Environment:async(s)=>{r?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");let{fromEnv:a}=await import("./chunk-58vz2qsq.js");return async()=>a(s)().then(m)}};if(e in o)return o[e];else throw new f.CredentialsProviderError(`Unsupported credential source in profile ${t}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:r})},m=(e)=>P.setCredentialFeature(e,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p");var I=(e,{profile:t="default",logger:r}={})=>Boolean(e)&&typeof e==="object"&&typeof e.role_arn==="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1&&["undefined","string"].indexOf(typeof e.external_id)>-1&&["undefined","string"].indexOf(typeof e.mfa_serial)>-1&&(q(e,{profile:t,logger:r})||H(e,{profile:t,logger:r})),q=(e,{profile:t,logger:r})=>{let o=typeof e.source_profile==="string"&&typeof e.credential_source>"u";if(o)r?.debug?.(` ${t} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`);return o},H=(e,{profile:t,logger:r})=>{let o=typeof e.credential_source==="string"&&typeof e.source_profile>"u";if(o)r?.debug?.(` ${t} isCredentialSourceProfile credential_source=${e.credential_source}`);return o},R=async(e,t,r,o,s={},a)=>{r.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");let n=t[e],{source_profile:c,region:K}=n;if(!r.roleAssumer){let{getDefaultRoleAssumer:l}=await import("./chunk-wx7kdf0b.js");r.roleAssumer=l({...r.clientConfig,credentialProviderLogger:r.logger,parentClientConfig:{...o,...r?.parentClientConfig,region:K??r?.parentClientConfig?.region??o?.region}},r.clientPlugins)}if(c&&c in s)throw new d.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${d.getProfileName(r)}. Profiles visited: `+Object.keys(s).join(", "),{logger:r.logger});r.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${c?`source_profile=[${c}]`:`profile=[${e}]`}`);let E=c?a(c,t,r,o,{...s,[c]:!0},v(t[c]??{})):(await S(n.credential_source,e,r.logger)(r))();if(v(n))return E.then((l)=>p.setCredentialFeature(l,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"));else{let l={RoleArn:n.role_arn,RoleSessionName:n.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:n.external_id,DurationSeconds:parseInt(n.duration_seconds||"3600",10)},{mfa_serial:_}=n;if(_){if(!r.mfaCodeProvider)throw new d.CredentialsProviderError(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:r.logger,tryNextLink:!1});l.SerialNumber=_,l.TokenCode=await r.mfaCodeProvider(_)}let G=await E;return r.roleAssumer(G,l).then((U)=>p.setCredentialFeature(U,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}},v=(e)=>!e.role_arn&&!!e.credential_source;var A=i(L()),O=(e)=>Boolean(e&&e.login_session),x=async(e,t,r)=>{let{fromLoginCredentials:o}=await import("./chunk-agntrqs9.js"),s=await o({...t,profile:e})({callerClientConfig:r});return A.setCredentialFeature(s,"CREDENTIALS_PROFILE_LOGIN","AC")};var k=i(L()),F=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.credential_process==="string",h=async(e,t)=>{let{fromProcess:r}=await import("./chunk-a6r4z44b.js"),o=await r({...e,profile:t})();return k.setCredentialFeature(o,"CREDENTIALS_PROFILE_PROCESS","v")};var C=i(L()),D=async(e,t,r={},o)=>{let{fromSSO:s}=await import("./chunk-501zkf9b.js");return s({profile:e,logger:r.logger,parentClientConfig:r.parentClientConfig,clientConfig:r.clientConfig})({callerClientConfig:o}).then((a)=>{if(t.sso_session)return C.setCredentialFeature(a,"CREDENTIALS_PROFILE_SSO","r");else return C.setCredentialFeature(a,"CREDENTIALS_PROFILE_SSO_LEGACY","t")})},T=(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 W=i(L()),y=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.aws_access_key_id==="string"&&typeof e.aws_secret_access_key==="string"&&["undefined","string"].indexOf(typeof e.aws_session_token)>-1&&["undefined","string"].indexOf(typeof e.aws_account_id)>-1,g=async(e,t)=>{t?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");let r={accessKeyId:e.aws_access_key_id,secretAccessKey:e.aws_secret_access_key,sessionToken:e.aws_session_token,...e.aws_credential_scope&&{credentialScope:e.aws_credential_scope},...e.aws_account_id&&{accountId:e.aws_account_id}};return W.setCredentialFeature(r,"CREDENTIALS_PROFILE","n")};var N=i(L()),j=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.web_identity_token_file==="string"&&typeof e.role_arn==="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1,M=async(e,t,r)=>{let{fromTokenFile:o}=await import("./chunk-0szjy61m.js"),s=await o({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:t.roleAssumerWithWebIdentity,logger:t.logger,parentClientConfig:t.parentClientConfig})({callerClientConfig:r});return N.setCredentialFeature(s,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")};var w=async(e,t,r,o,s={},a=!1)=>{let n=t[e];if(Object.keys(s).length>0&&y(n))return g(n,r);if(a||I(n,{profile:e,logger:r.logger}))return R(e,t,r,o,s,w);if(y(n))return g(n,r);if(j(n))return M(n,r,o);if(F(n))return h(r,e);if(T(n))return await D(e,n,r,o);if(O(n))return x(e,r,o);throw new B.CredentialsProviderError(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:r.logger})};var V=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");let r=await u.parseKnownFiles(e);return w(u.getProfileName({profile:e.profile??t?.profile}),r,e,t)};export{V as fromIni};
|