@bkm016/basalt 0.0.0-stage → 0.1.1
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-09vr609h.js +2 -0
- package/chunk-0hbjv3y6.js +11 -0
- package/chunk-0qqb6v41.js +3753 -0
- package/chunk-0szjy61m.js +2 -0
- package/chunk-0yytz0r1.js +59 -0
- package/chunk-1aspj1hn.js +3 -0
- package/chunk-1b7gbe8g.js +10 -0
- package/chunk-1v7st27a.js +25 -0
- package/chunk-1yzt0qm0.js +2 -0
- package/chunk-2bb01ddq.js +16 -0
- package/chunk-2wkaw73s.js +9 -0
- package/chunk-2zqny2sy.js +2 -0
- package/chunk-32at88hc.js +3 -0
- package/chunk-3m7qwfm3.js +7 -0
- package/chunk-44ek81ad.js +3 -0
- package/chunk-45cz26ap.js +39 -0
- package/chunk-501zkf9b.js +3 -0
- package/chunk-58vz2qsq.js +2 -0
- package/chunk-6e49xsf5.js +3 -0
- package/chunk-6qertm2t.js +3 -0
- package/chunk-8dxzqwq3.js +2 -0
- package/chunk-9mmz6wt3.js +2 -0
- package/chunk-a3tqx584.js +10 -0
- package/chunk-a6r4z44b.js +2 -0
- package/chunk-a8nyk4k9.js +2 -0
- package/chunk-agntrqs9.js +2 -0
- package/chunk-bhqyxyap.js +3 -0
- package/chunk-bpw6q7g0.js +3 -0
- package/chunk-c25s4w6a.js +5 -0
- package/chunk-cv5wsd9m.js +8 -0
- package/chunk-d48bfd2e.js +3 -0
- package/chunk-dakrpbe6.js +3 -0
- package/chunk-dhm42y04.js +7 -0
- package/chunk-exnn1867.js +2 -0
- package/chunk-f7egr55n.js +31 -0
- package/chunk-g2t6t8fk.js +3 -0
- package/chunk-h6sw8fbt.js +5 -0
- package/chunk-hat3s3pr.js +3 -0
- package/chunk-hcn9cf6v.js +2 -0
- package/chunk-jhd54p1b.js +3 -0
- package/chunk-k7w7ac9q.js +18 -0
- package/chunk-kf8hq21a.js +25 -0
- package/chunk-kfq8wyd3.js +3 -0
- package/chunk-n6e43rvk.js +3 -0
- package/chunk-nt2gntad.js +2 -0
- package/chunk-pmc3y1z8.js +2 -0
- package/chunk-pvncysbb.js +3 -0
- package/chunk-q8zx3kt6.js +2 -0
- package/chunk-qczbfccb.js +12 -0
- package/chunk-qnr1f5pj.js +3 -0
- package/chunk-qx0m82rw.js +2 -0
- package/chunk-r9aatvwm.js +3 -0
- package/chunk-rm3kcxq9.js +20 -0
- package/chunk-rv06x0kn.js +7 -0
- package/chunk-ry0z4ev6.js +2 -0
- package/chunk-s37s3k24.js +12 -0
- package/chunk-sh74qzvt.js +5 -0
- package/chunk-szat3vp4.js +3 -0
- package/chunk-t057xfrt.js +5 -0
- package/chunk-tvm4zmgj.js +3 -0
- package/chunk-v9fea96h.js +3 -0
- package/chunk-vgvq3q12.js +3 -0
- package/chunk-vkkj4awb.js +2 -0
- package/chunk-vv7fp27r.js +3 -0
- package/chunk-wjd9fr23.js +2 -0
- package/chunk-wx7kdf0b.js +2 -0
- package/chunk-x3dnb9sz.js +3 -0
- package/chunk-xsbxykr4.js +2 -0
- package/chunk-xysny0ve.js +3 -0
- package/chunk-y69ewdn2.js +3 -0
- package/chunk-yskm0hsy.js +2 -0
- package/chunk-zef13k3h.js +471 -0
- package/cli.js +89 -0
- package/compiled.js +23 -0
- package/icon-dp9pmcvp.png +0 -0
- package/package.json +21 -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-05w4fyzc.js +1 -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-0vt9fg48.js +2 -0
- package/web/chunk-20q90epj.js +2 -0
- package/web/chunk-22a4ety5.js +1 -0
- package/web/chunk-24mfx6w1.js +2 -0
- package/web/chunk-2j4m0bh1.js +2 -0
- package/web/chunk-2m12wyrb.js +16 -0
- package/web/chunk-2msj52w6.js +1 -0
- package/web/chunk-2ps6mepk.js +120 -0
- package/web/chunk-2pver6r4.js +1 -0
- package/web/chunk-2scce33n.js +1 -0
- package/web/chunk-37ajk6zg.js +2 -0
- package/web/chunk-3ee04tmm.js +200 -0
- package/web/chunk-3jhyzmnf.js +292 -0
- package/web/chunk-45fzdcgz.js +30 -0
- package/web/chunk-4gavbw65.js +1 -0
- package/web/chunk-4ks96e4r.js +1 -0
- package/web/chunk-4rm1vy7w.js +1 -0
- package/web/chunk-4v8en1yw.js +40 -0
- package/web/chunk-4wd9r73y.js +1 -0
- package/web/chunk-4wkm9fda.js +1 -0
- package/web/chunk-54thej0t.js +2 -0
- package/web/chunk-59kqahb3.js +1 -0
- package/web/chunk-5vw9rs4r.js +4 -0
- package/web/chunk-6beqrmtq.js +1 -0
- package/web/chunk-6m69hczt.js +2 -0
- package/web/chunk-70qwwwak.js +2 -0
- package/web/chunk-74j07k8k.js +2 -0
- package/web/chunk-8g239029.js +1 -0
- package/web/chunk-8p4tc9f4.js +70 -0
- package/web/chunk-90kp4pnz.js +2 -0
- package/web/chunk-9an7cjd9.js +291 -0
- package/web/chunk-9dxjafp2.js +78 -0
- package/web/chunk-9p12mgs6.js +2 -0
- package/web/chunk-9v1f6yc8.js +1 -0
- package/web/chunk-9yakxvjb.js +2 -0
- package/web/chunk-a1z5qx1r.js +36 -0
- package/web/chunk-a3verqw9.js +214 -0
- package/web/chunk-a5x2zveg.js +7 -0
- package/web/chunk-ad6x47yy.js +1 -0
- package/web/chunk-amzgyy1k.js +1 -0
- package/web/chunk-b1pe46zz.js +2 -0
- package/web/chunk-b4wbk7vc.js +217 -0
- package/web/chunk-bc78qf1m.js +7 -0
- package/web/chunk-bgnnrpna.js +89 -0
- package/web/chunk-bj90t5gh.js +99 -0
- package/web/chunk-bjkc94mv.js +1 -0
- package/web/chunk-ca682sm6.js +370 -0
- package/web/chunk-cff5hcm8.js +8 -0
- package/web/chunk-cg3jterp.js +2 -0
- package/web/chunk-d18r4m14.js +141 -0
- package/web/chunk-dmqtdeb4.js +1 -0
- package/web/chunk-dt462hk9.js +332 -0
- package/web/chunk-dy2gm1fs.js +1 -0
- package/web/chunk-dzwxgqgm.js +39 -0
- package/web/chunk-e32y85kx.js +1 -0
- package/web/chunk-e53wfgb8.js +1 -0
- package/web/chunk-e6jxqbv7.js +3 -0
- package/web/chunk-esp1mmgr.js +1 -0
- package/web/chunk-ew3cgdtd.js +1 -0
- package/web/chunk-f26smjjf.js +2 -0
- package/web/chunk-f91wzwtk.js +1 -0
- package/web/chunk-fk0dh93x.js +89 -0
- package/web/chunk-fm2ybfj5.js +98 -0
- package/web/chunk-fscafg24.js +34 -0
- package/web/chunk-fz06t6km.js +55 -0
- package/web/chunk-g1ev11wx.js +1 -0
- package/web/chunk-g4azyef7.js +106 -0
- package/web/chunk-gjq1pxw3.js +1 -0
- package/web/chunk-gqw3f02j.js +140 -0
- package/web/chunk-h5ejbf6e.js +1 -0
- package/web/chunk-hev4hq89.js +2 -0
- package/web/chunk-hfaffkrh.js +1 -0
- package/web/chunk-hp167dbv.js +1 -0
- package/web/chunk-j2vt8c8v.js +1 -0
- package/web/chunk-jjh5jvva.js +1 -0
- package/web/chunk-jrcyc9s9.js +38 -0
- package/web/chunk-jwzd9tzk.js +24 -0
- package/web/chunk-k5btcvbg.js +1 -0
- package/web/chunk-ka3q31t1.js +1 -0
- package/web/chunk-kdyjnwdx.js +2 -0
- package/web/chunk-kpvgecwy.js +1 -0
- package/web/chunk-kq40ss39.js +1 -0
- package/web/chunk-m2d1sp30.js +1 -0
- package/web/chunk-n1dmrz44.js +2 -0
- package/web/chunk-n90cqdvg.js +2 -0
- package/web/chunk-nj0cv1cq.js +257 -0
- package/web/chunk-nzey7cpv.js +1 -0
- package/web/chunk-p3b9crsa.js +2 -0
- package/web/chunk-pf2ab8p8.js +1 -0
- package/web/chunk-pxe3vna4.js +1 -0
- package/web/chunk-q0p5xqe1.js +84 -0
- package/web/chunk-q5ke7a33.js +24 -0
- package/web/chunk-q7dsnvpf.js +1 -0
- package/web/chunk-qd8bxxdj.js +1 -0
- package/web/chunk-qefasa1j.js +2 -0
- package/web/chunk-qh7265qw.js +4 -0
- package/web/chunk-qnaqf0cr.js +1 -0
- package/web/chunk-r1dnh0s8.js +1 -0
- package/web/chunk-r5eakmw6.js +1 -0
- package/web/chunk-rg426vkf.js +1 -0
- package/web/chunk-rpmpttbk.js +12 -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-scpwc9ev.js +1 -0
- package/web/chunk-srrfphes.js +1 -0
- package/web/chunk-ss1bcb0n.js +2 -0
- package/web/chunk-ssy07dd2.js +1 -0
- package/web/chunk-t6agpn2z.js +1 -0
- package/web/chunk-taynqrgq.js +142 -0
- package/web/chunk-tgpbhzn9.js +1 -0
- package/web/chunk-tmvakq7n.js +19 -0
- package/web/chunk-tqmwd9qp.js +139 -0
- package/web/chunk-ts7zrf5b.js +2 -0
- package/web/chunk-ttg6tbwx.js +2 -0
- package/web/chunk-v28fx2nd.js +1 -0
- package/web/chunk-v5cnt7c8.js +1 -0
- package/web/chunk-vt40e1kp.js +1136 -0
- package/web/chunk-w53rba6g.js +1 -0
- package/web/chunk-w86n42dy.js +1 -0
- package/web/chunk-w880psmw.js +1 -0
- package/web/chunk-wptv8atc.js +2 -0
- package/web/chunk-wtawdeej.css +1 -0
- package/web/chunk-xbty0rv7.js +41 -0
- package/web/chunk-xet1jjy9.js +1 -0
- package/web/chunk-xjxv8dg8.js +169 -0
- package/web/chunk-xrxne80b.js +62 -0
- package/web/chunk-xzp7jf7e.js +2 -0
- package/web/chunk-y0m8hrwz.js +303 -0
- package/web/chunk-y49fhfda.js +7 -0
- package/web/chunk-yd46jhqv.js +1 -0
- package/web/chunk-ydtrc1ay.js +2 -0
- package/web/chunk-z09emmrb.js +1 -0
- package/web/chunk-z7dcbxws.js +1 -0
- package/web/chunk-zbj1trar.js +2 -0
- package/web/chunk-zde7mj43.js +1 -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,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{L}from"./chunk-0hbjv3y6.js";import{b}from"./chunk-k7w7ac9q.js";import{i}from"./chunk-qnr1f5pj.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 R=i(L());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-1yzt0qm0.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-1yzt0qm0.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 I=(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,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 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:y}=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 I(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,y,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 I(l),l}};var h=i(b()),O=!1,v=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:r,ssoRegion:t,ssoRoleName:n,ssoClient:a,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-xsbxykr4.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})),P;try{P=await Z.send(new E({accountId:r,roleName:n,accessToken:C}))}catch(_){throw new h.CredentialsProviderError(_,{tryNextLink:O,logger:l})}let{roleCredentials:{accessKeyId:F,secretAccessKey:D,sessionToken:M,expiration:G,credentialScope:K,accountId:H}={}}=P;if(!F||!D||!M||!G)throw new h.CredentialsProviderError("SSO returns an invalid temporary credential.",{tryNextLink:O,logger:l});let A={accessKeyId:F,secretAccessKey:D,sessionToken:M,expiration:new Date(G),...K&&{credentialScope:K},...H&&{accountId:H}};if(o)R.setCredentialFeature(A,"CREDENTIALS_SSO","s");else R.setCredentialFeature(A,"CREDENTIALS_SSO_LEGACY","u");return A};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],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 v({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 v({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};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
class n{incoming=[];outgoing=[];get length(){return this.incoming.length+this.outgoing.length}enqueue(e){this.incoming.push(e)}dequeue(){if(this.outgoing.length===0)while(this.incoming.length>0)this.outgoing.push(this.incoming.pop());return this.outgoing.pop()}}class Vn{queue=new n;waiting=new n;done=!1;finalResultPromise;resolveFinalResult;isComplete;extractResult;constructor(e,t){this.isComplete=e,this.extractResult=t,this.finalResultPromise=new Promise((i)=>{this.resolveFinalResult=i})}push(e){if(this.done)return;if(this.isComplete(e))this.done=!0,this.resolveFinalResult(this.extractResult(e));let t=this.waiting.dequeue();if(t)t({value:e,done:!1});else this.queue.enqueue(e)}end(e){if(this.done=!0,e!==void 0)this.resolveFinalResult(e);while(this.waiting.length>0)this.waiting.dequeue()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){while(!0)if(this.queue.length>0)yield this.queue.dequeue();else if(this.done)return;else{let e=await new Promise((t)=>this.waiting.enqueue(t));if(e.done)return;yield e.value}}result(){return this.finalResultPromise}}class M extends Vn{#t=Date.now();#i=performance.now();constructor(){super((e)=>e.type==="done"||e.type==="error",(e)=>{if(e.type==="done")return e.message;else if(e.type==="error")return e.error;throw Error("Unexpected event type for final result")})}push(e){if(e.type==="done")this.#e(e.message);else if(e.type==="error")this.#e(e.error);super.push(e)}end(e){if(e!==void 0)this.#e(e);super.end(e)}#e(e){if(this.done||e.durationMs!==void 0||e.timestamp<this.#t)return;e.durationMs=Math.max(0,Math.round(performance.now()-this.#i))}}function Kn(){return new M}function Ve(e){if(e instanceof Error)return e.message||e.name;if(typeof e==="string")return e;return String(e)}function xi(e){if(!(e instanceof Error))return{name:"ThrownValue",message:Ve(e)};let t=e.code;return{name:e.name||void 0,message:e.message||e.name,stack:e.stack,code:typeof t==="string"||typeof t==="number"?t:void 0}}function qt(e,t,i){return{type:e,timestamp:Date.now(),error:xi(t),details:i}}function Te(e,t){e.diagnostics=[...e.diagnostics??[],t]}
|
|
3
|
+
export{Vn,M,Kn,Ve,xi,qt,Te};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{_}from"./chunk-hat3s3pr.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 Cr(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{Cr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Tn}from"./chunk-f7egr55n.js";import"./chunk-hat3s3pr.js";import"./chunk-c25s4w6a.js";import{Ir,ii}from"./chunk-x3dnb9sz.js";import{at,Je,lt}from"./chunk-s37s3k24.js";import{Ge}from"./chunk-bpw6q7g0.js";import{ee}from"./chunk-tvm4zmgj.js";import{ie}from"./chunk-d48bfd2e.js";import{q,j}from"./chunk-y69ewdn2.js";import{Ee,ct,V}from"./chunk-1aspj1hn.js";import{z}from"./chunk-dakrpbe6.js";import{re,ge,ye,H}from"./chunk-qczbfccb.js";import{M}from"./chunk-6e49xsf5.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=re(a,r.compat?.supportsMidConvoSystemMessages);return(async()=>{let n=Ir(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 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},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 Tn({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=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,N as streamSimple};
|