@shumai-one/shumai 0.6.1 → 0.6.3
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/bin/chunk-02b5bcmc.js +1 -0
- package/bin/chunk-09mj32d7.js +2 -0
- package/bin/{chunk-bg6waaf9.js → chunk-09mpcg9x.js} +2 -2
- package/bin/{chunk-ahgq10a7.js → chunk-0a298n62.js} +2 -2
- package/bin/chunk-0rgbxp24.js +3 -0
- package/bin/{chunk-9s0k533c.js → chunk-19zbh4fr.js} +1 -1
- package/bin/{chunk-c6f8x05m.js → chunk-1e1q1hyg.js} +2 -2
- package/bin/chunk-1ja2zw4w.js +2 -0
- package/bin/chunk-1tar0x8s.js +7 -0
- package/bin/{chunk-p1ed0pa6.js → chunk-1y6h4vge.js} +1 -1
- package/bin/{chunk-d18v5vmp.js → chunk-20bamhwa.js} +2 -2
- package/bin/chunk-20w1w9x7.js +2 -0
- package/bin/{chunk-b7qs7hxg.js → chunk-25npafhz.js} +2 -2
- package/bin/chunk-2qgagdb7.js +1 -0
- package/bin/chunk-2t6g3pny.js +3 -0
- package/bin/chunk-34f64q0q.js +2 -0
- package/bin/{chunk-kywdke0y.js → chunk-3hgrw1m0.js} +5 -5
- package/bin/{chunk-16n160h1.js → chunk-3s2ga6mt.js} +1 -1
- package/bin/{chunk-r9gp9yqw.js → chunk-3vpz5nat.js} +1 -1
- package/bin/chunk-4p31kxjh.js +3 -0
- package/bin/{chunk-3j82q2gj.js → chunk-4vjgdj0h.js} +1 -1
- package/bin/chunk-50pfmxt1.js +2 -0
- package/bin/chunk-5ddg5ezb.js +55 -0
- package/bin/chunk-5ngftxjb.js +218 -0
- package/bin/chunk-6f3zhq64.js +5 -0
- package/bin/chunk-6nqqe7w9.js +1 -0
- package/bin/chunk-6t525bmg.js +1 -0
- package/bin/chunk-7546ptwg.js +32 -0
- package/bin/chunk-7jz3cmq6.js +2 -0
- package/bin/{chunk-ht5rht98.js → chunk-7kah3zb5.js} +2 -2
- package/bin/chunk-7mawxsk3.js +2 -0
- package/bin/{chunk-fxtzy5f5.js → chunk-88jg9dq5.js} +2 -2
- package/bin/chunk-8ww98y1m.js +2 -0
- package/bin/chunk-9405hzv2.js +2 -0
- package/bin/chunk-95b4mwyq.js +2 -0
- package/bin/chunk-9vxmgvc8.js +2 -0
- package/bin/chunk-9x42vgeq.js +16 -0
- package/bin/{chunk-s01p4w8d.js → chunk-a74g6h8a.js} +2 -2
- package/bin/{chunk-am6dg0a5.js → chunk-a859y4e1.js} +2 -2
- package/bin/chunk-addssm8d.js +1 -0
- package/bin/chunk-ajq9sxg0.js +129 -0
- package/bin/chunk-amp9h878.js +2 -0
- package/bin/chunk-atdfqdkj.js +7 -0
- package/bin/{chunk-dfecgpce.js → chunk-atpt99h4.js} +13 -13
- package/bin/chunk-awshe30f.js +1 -0
- package/bin/chunk-b3t7gbhm.js +2 -0
- package/bin/chunk-bbxwyhz3.js +4 -0
- package/bin/chunk-bd3v8mp1.js +7 -0
- package/bin/chunk-brgns7hv.js +2 -0
- package/bin/chunk-c02727j9.js +2 -0
- package/bin/chunk-c1wvs81k.js +2 -0
- package/bin/chunk-c8frmqsk.js +2 -0
- package/bin/chunk-cagzye3j.js +2 -0
- package/bin/{chunk-b9d8xdhb.js → chunk-cp96e9pq.js} +1 -1
- package/bin/chunk-d55138xx.js +5 -0
- package/bin/{chunk-3me1v3z5.js → chunk-ddmf9gqv.js} +2 -2
- package/bin/chunk-djb65frk.js +1 -0
- package/bin/{chunk-hzv1mhr5.js → chunk-dkhdn92k.js} +2 -2
- package/bin/chunk-dx9f5wab.js +1 -0
- package/bin/chunk-dygj751y.js +393 -0
- package/bin/chunk-e55sgg8t.js +2 -0
- package/bin/{chunk-fre31bhw.js → chunk-enax4303.js} +2 -2
- package/bin/{chunk-jb8vbeb0.js → chunk-erfkd3z9.js} +2 -2
- package/bin/chunk-esj0kwe5.js +12 -0
- package/bin/chunk-etrm28sy.js +2 -0
- package/bin/chunk-ex3174e3.js +2 -0
- package/bin/{chunk-bs6saf4d.js → chunk-eyjfhdp9.js} +2 -2
- package/bin/{chunk-r5g84kj4.js → chunk-ezjxx44x.js} +3 -3
- package/bin/chunk-f4xnx4n6.js +1 -0
- package/bin/{chunk-jq3pq545.js → chunk-f8hgy69t.js} +2 -2
- package/bin/chunk-fakph5jp.js +1 -0
- package/bin/{chunk-1eqw2dpx.js → chunk-femnbfkj.js} +2 -2
- package/bin/chunk-ffjdkdcv.js +2 -0
- package/bin/chunk-gd016e9p.js +2 -0
- package/bin/chunk-gyv3yrhj.js +2 -0
- package/bin/{chunk-sd6w0z6a.js → chunk-h2bphev9.js} +2 -2
- package/bin/chunk-h3atwgx2.js +1 -0
- package/bin/chunk-h7xny3de.js +2 -0
- package/bin/chunk-hg3rkp41.js +11 -0
- package/bin/chunk-hpzk9k55.js +1 -0
- package/bin/chunk-hsyfrzdd.js +1 -0
- package/bin/chunk-hvyy8vct.js +3 -0
- package/bin/chunk-j2s311yc.js +3 -0
- package/bin/{chunk-swz6v48q.js → chunk-j2txsbxz.js} +2 -2
- package/bin/chunk-j6x53e33.js +1 -0
- package/bin/chunk-jacanzp7.js +1 -0
- package/bin/chunk-jc7dycy6.js +2 -0
- package/bin/{chunk-6hzktewz.js → chunk-jt02kpfc.js} +2 -2
- package/bin/chunk-k7vbk8v4.js +3 -0
- package/bin/chunk-mn0kt3p6.js +3 -0
- package/bin/chunk-mn71dffh.js +4 -0
- package/bin/chunk-npeapp7e.js +7 -0
- package/bin/{chunk-qqj2m1b1.js → chunk-p2vsdnd1.js} +2 -2
- package/bin/chunk-pdw77q09.js +2 -0
- package/bin/chunk-pq6kdp83.js +4 -0
- package/bin/chunk-ptcz4ed3.js +2 -0
- package/bin/chunk-q1fzgqsv.js +2 -0
- package/bin/chunk-q4ny4hpt.js +2 -0
- package/bin/{chunk-wsprap60.js → chunk-q5x0yywj.js} +2 -2
- package/bin/{chunk-h6f2gyt5.js → chunk-q8xr1a8j.js} +2 -2
- package/bin/chunk-q8ysc5ex.js +1 -0
- package/bin/chunk-qm50g4n5.js +10 -0
- package/bin/chunk-qvp24w0q.js +2 -0
- package/bin/chunk-r6t0j0jx.js +11 -0
- package/bin/chunk-s1j4v33x.js +2 -0
- package/bin/{chunk-n412a1hp.js → chunk-s6pk2zyg.js} +6 -6
- package/bin/chunk-s74g9vsk.js +3 -0
- package/bin/chunk-sz19nn1x.js +2 -0
- package/bin/{chunk-agcnbjxk.js → chunk-sz5zawfw.js} +2 -2
- package/bin/chunk-t68y25gf.js +1 -0
- package/bin/chunk-te484xtb.js +13 -0
- package/bin/{chunk-c60j1b4w.js → chunk-tfrevef9.js} +1 -1
- package/bin/chunk-thpw6tcj.js +2 -0
- package/bin/{chunk-w4ydfy9d.js → chunk-v0yevesp.js} +7 -7
- package/bin/chunk-vj4gamdn.js +2 -0
- package/bin/chunk-vmwys2ch.js +2 -0
- package/bin/chunk-vnmggrd6.js +18 -0
- package/bin/{chunk-d4hk62q2.js → chunk-vv0m0m2f.js} +4 -4
- package/bin/chunk-w6g84d59.js +8 -0
- package/bin/chunk-wgvgtttc.js +13 -0
- package/bin/chunk-xy9qpn6b.js +1 -0
- package/bin/{chunk-0tvnfy4k.js → chunk-y3haqtr8.js} +2 -2
- package/bin/chunk-y5dv67mg.js +2 -0
- package/bin/chunk-yb4mzqrd.js +5 -0
- package/bin/chunk-z0de127n.js +5 -0
- package/bin/chunk-z8t6e0ee.js +1 -0
- package/bin/chunk-zfg4yy3c.js +2 -0
- package/bin/{chunk-acmr8v0d.js → chunk-zkvezz89.js} +1 -1
- package/bin/chunk-zrrnvdxq.js +3 -0
- package/bin/chunk-zx1c4vm5.js +42 -0
- package/bin/chunk-zzqse5qc.js +2 -0
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +942 -1015
- package/package.json +7 -7
- package/prisma/migrations/20261026024507_hash_api_tokens/migration.sql +28 -0
- package/prisma/migrations/20261026031904_add_audit_log_via/migration.sql +2 -0
- package/prisma/migrations/20261029024626_add_oauth_and_jwks/migration.sql +205 -0
- package/prisma/migrations/20261029030321_default_empty_arrays_oauth/migration.sql +25 -0
- package/prisma/schema.prisma +186 -1
- package/bin/chunk-0502p2k7.js +0 -3
- package/bin/chunk-0b0t6y8h.js +0 -11
- package/bin/chunk-1vt9ss7d.js +0 -2
- package/bin/chunk-23780yj6.js +0 -3
- package/bin/chunk-2cpsfc87.js +0 -1
- package/bin/chunk-2w0d9veg.js +0 -2
- package/bin/chunk-2xp9prpq.js +0 -1
- package/bin/chunk-3gqs15zq.js +0 -2
- package/bin/chunk-3pw7z25v.js +0 -3
- package/bin/chunk-3tx9v8kj.js +0 -2
- package/bin/chunk-3wdtp4ht.js +0 -1
- package/bin/chunk-57axjy7y.js +0 -1
- package/bin/chunk-5aqthcm6.js +0 -5
- package/bin/chunk-5gq4q1bb.js +0 -2
- package/bin/chunk-5r1br11d.js +0 -2
- package/bin/chunk-61hrdg0g.js +0 -1
- package/bin/chunk-6aa4xmnw.js +0 -2
- package/bin/chunk-6mrgtn78.js +0 -18
- package/bin/chunk-6s55r0z9.js +0 -1
- package/bin/chunk-6vkfzzvt.js +0 -5
- package/bin/chunk-7dprpnm6.js +0 -2
- package/bin/chunk-7rycq6wb.js +0 -129
- package/bin/chunk-895gzdtp.js +0 -7
- package/bin/chunk-8d1p8qpv.js +0 -1
- package/bin/chunk-8r3k84dh.js +0 -2
- package/bin/chunk-99sarrvt.js +0 -3
- package/bin/chunk-b21z62fj.js +0 -1
- package/bin/chunk-bv589v2m.js +0 -3
- package/bin/chunk-c8kjpmfe.js +0 -2
- package/bin/chunk-c9xyejnk.js +0 -2
- package/bin/chunk-cb9peqy5.js +0 -2
- package/bin/chunk-ckczqmrz.js +0 -5
- package/bin/chunk-cr33cs6j.js +0 -2
- package/bin/chunk-cxet91kt.js +0 -2
- package/bin/chunk-d7e351jd.js +0 -6
- package/bin/chunk-ebcfbn00.js +0 -2
- package/bin/chunk-f0b4a9y3.js +0 -2
- package/bin/chunk-fkn6f4qt.js +0 -4
- package/bin/chunk-g78vapcm.js +0 -2
- package/bin/chunk-gdpfwxea.js +0 -4
- package/bin/chunk-gwqqq0b1.js +0 -32
- package/bin/chunk-h3cwf9aw.js +0 -2
- package/bin/chunk-h4ty530v.js +0 -16
- package/bin/chunk-h58yfx7w.js +0 -2
- package/bin/chunk-h9ngpxyd.js +0 -1
- package/bin/chunk-hbr17jvr.js +0 -13
- package/bin/chunk-hc0xbmtt.js +0 -5
- package/bin/chunk-j9t7tvt5.js +0 -2
- package/bin/chunk-jvt8q0eg.js +0 -2
- package/bin/chunk-jzgtthsj.js +0 -3
- package/bin/chunk-jzjhg7ng.js +0 -1
- package/bin/chunk-k547syp2.js +0 -2
- package/bin/chunk-k7sjpke6.js +0 -2
- package/bin/chunk-k8ct1qgv.js +0 -3
- package/bin/chunk-k9q4nn8b.js +0 -11
- package/bin/chunk-keetdtxb.js +0 -2
- package/bin/chunk-kjjw8mbg.js +0 -1
- package/bin/chunk-mey80kv9.js +0 -54
- package/bin/chunk-nfncawpm.js +0 -12
- package/bin/chunk-nvwt8atc.js +0 -1
- package/bin/chunk-p1d500sf.js +0 -211
- package/bin/chunk-q0vs124k.js +0 -2
- package/bin/chunk-q5795f3s.js +0 -2
- package/bin/chunk-q5j3b0h5.js +0 -3
- package/bin/chunk-qd7pvaxb.js +0 -2
- package/bin/chunk-qhpt7170.js +0 -2
- package/bin/chunk-qt78vs3g.js +0 -2
- package/bin/chunk-ra6mdjr0.js +0 -1
- package/bin/chunk-ryfvaz6v.js +0 -3
- package/bin/chunk-s22eapcc.js +0 -2
- package/bin/chunk-sbg86tch.js +0 -2
- package/bin/chunk-sbqy6m8t.js +0 -1
- package/bin/chunk-sdp9w627.js +0 -14
- package/bin/chunk-sn0nypvd.js +0 -42
- package/bin/chunk-sv92vkyh.js +0 -2
- package/bin/chunk-t6cn018t.js +0 -3
- package/bin/chunk-ts4d1mxf.js +0 -2
- package/bin/chunk-wkdkc12e.js +0 -4
- package/bin/chunk-xgnvktq6.js +0 -10
- package/bin/chunk-xjw3mpvx.js +0 -1
- package/bin/chunk-xsfy8hz3.js +0 -2
- package/bin/chunk-xznq2axj.js +0 -1
- package/bin/chunk-y4v08wq7.js +0 -1
- package/bin/chunk-yncvy335.js +0 -3
- package/bin/chunk-ytzddcj2.js +0 -1
- package/bin/chunk-zxqasmvz.js +0 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{gr,ir}from"./chunk-vnmggrd6.js";import{Z,ae}from"./chunk-4p31kxjh.js";var Is=Z(function(he){var{hasOwn:z}=gr(),{streamCollector:ee}=gr();he.streamCollector=ee;var{buildQueryString:V,HttpResponse:K}=ir(),E=ae("https"),{Readable:te}=ae("stream"),_=ae("http2");function I(e){let t=e&&typeof e==="object"&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){let s=Error("Request aborted");return s.name="AbortError",s.cause=t,s}let n=Error(String(t));return n.name="AbortError",n}let o=Error("Request aborted");return o.name="AbortError",o}var oe=["ECONNRESET","EPIPE","ETIMEDOUT"],Q=(e)=>{let t={};for(let o in e){if(!z(e,o))continue;let n=e[o];t[o]=Array.isArray(n)?n.join(","):n}return t},h={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:(e)=>clearTimeout(e)},q=1000,ne=(e,t,o=0)=>{if(!o)return-1;let n=(s)=>{let i=h.setTimeout(()=>{e.destroy(),t(Object.assign(Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${o} ms.`),{name:"TimeoutError"}))},o-s),c=(a)=>{if(a?.connecting)a.on("connect",()=>{h.clearTimeout(i)});else h.clearTimeout(i)};if(e.socket)c(e.socket);else e.on("socket",c)};if(o<2000)return n(0),0;return h.setTimeout(n.bind(null,q),q)},se=(e,t,o=0,n,s)=>{if(o)return h.setTimeout(()=>{let i=`@smithy/node-http-handler - [${n?"ERROR":"WARN"}] a request has exceeded the configured ${o} ms requestTimeout.`;if(n){let c=Object.assign(Error(i),{name:"TimeoutError",code:"ETIMEDOUT"});e.destroy(c),t(c)}else i+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",s?.warn?.(i)},o);return-1},re=3000,ie=(e,{keepAlive:t,keepAliveMsecs:o},n=re)=>{if(t!==!0)return-1;let s=()=>{if(e.socket)e.socket.setKeepAlive(t,o||0);else e.on("socket",(i)=>{i.setKeepAlive(t,o||0)})};if(n===0)return s(),0;return h.setTimeout(s,n)},F=3000,ce=(e,t,o=0)=>{let n=(s)=>{let i=o-s,c=()=>{e.destroy(),t(Object.assign(Error(`@smithy/node-http-handler - the request socket timed out after ${o} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};if(e.socket)e.socket.setTimeout(i,c),e.on("close",()=>e.socket?.removeListener("timeout",c));else e.setTimeout(i,c)};if(0<o&&o<6000)return n(0),0;return h.setTimeout(n.bind(null,o===0?0:F),F)},j=6000;async function J(e,t,o=j,n=!1){let s=t.headers,i=s?s.Expect||s.expect:void 0,c=-1,a=!0;if(!n&&i==="100-continue")a=await Promise.race([new Promise((u)=>{c=Number(h.setTimeout(()=>u(!0),Math.max(j,o)))}),new Promise((u)=>{e.on("continue",()=>{h.clearTimeout(c),u(!0)}),e.on("response",()=>{h.clearTimeout(c),u(!1)}),e.on("error",()=>{h.clearTimeout(c),u(!1)})})]);if(a)ue(e,t.body)}function ue(e,t){if(t instanceof te){t.pipe(e);return}if(t){let o=Buffer.isBuffer(t);if(o||typeof t==="string"){if(o&&t.byteLength===0)e.end();else e.end(t);return}let s=t;if(typeof s==="object"&&s.buffer&&typeof s.byteOffset==="number"&&typeof s.byteLength==="number"){e.end(Buffer.from(s.buffer,s.byteOffset,s.byteLength));return}e.end(Buffer.from(t));return}e.end()}var fe=0,H=void 0,B=void 0;class L{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){if(typeof e?.handle==="function")return e;return new L(e)}static checkSocketUsage(e,t,o=console){let{sockets:n,requests:s,maxSockets:i}=e;if(typeof i!=="number"||i===1/0)return t;let c=15000;if(Date.now()-c<t)return t;if(n&&s)for(let a in n){if(!z(n,a))continue;let u=n[a]?.length??0,l=s[a]?.length??0;if(u>=i&&l>=2*i)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${u} and ${l} 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 t}constructor(e){this.configProvider=new Promise((t,o)=>{if(typeof e==="function")e().then((n)=>{t(this.resolveDefaultConfig(n))}).catch(o);else t(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t,requestTimeout:o}={}){if(!this.config)this.config=await this.configProvider;let n=this.config,s=n.logger,i=e.protocol==="https:";if(!i&&!this.config.httpAgent)this.config.httpAgent=await this.config.httpAgentProvider();return new Promise((c,a)=>{let u=void 0,l=-1,m=-1,T=-1,C=-1,w=-1,k=()=>{h.clearTimeout(l),h.clearTimeout(m),h.clearTimeout(T),h.clearTimeout(C),h.clearTimeout(w)},U=async(r)=>{await u,k(),c(r)},p=async(r)=>{await u,k(),a(r)};if(t?.aborted){let r=I(t);p(r);return}let S=e.headers,D=S?(S.Expect??S.expect)==="100-continue":!1,x=i?n.httpsAgent:n.httpAgent;if(D&&!this.externalAgent)x=new(i?E.Agent:H)({keepAlive:!1,maxSockets:1/0});l=h.setTimeout(()=>{this.socketWarningTimestamp=L.checkSocketUsage(x,this.socketWarningTimestamp,s)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2000)+(n.connectionTimeout??1000));let O=e.query?V(e.query):"",v=void 0;if(e.username!=null||e.password!=null){let r=e.username??"",f=e.password??"";v=`${r}:${f}`}let P=e.path;if(O)P+=`?${O}`;if(e.fragment)P+=`#${e.fragment}`;let y=e.hostname??"";if(y[0]==="["&&y.endsWith("]"))y=e.hostname.slice(1,-1);else y=e.hostname;let R={headers:e.headers,host:y,method:e.method,path:P,port:e.port,agent:x,auth:v},g=(i?E.request:B)(R,(r)=>{let f=new K({statusCode:r.statusCode||-1,reason:r.statusMessage,headers:Q(r.headers),body:r});U({response:f})});if(g.on("error",(r)=>{if(oe.includes(r.code))p(Object.assign(r,{name:"TimeoutError"}));else p(r)}),t){let r=()=>{g.destroy();let f=I(t);p(f)};if(typeof t.addEventListener==="function"){let f=t;f.addEventListener("abort",r,{once:!0}),g.once("close",()=>f.removeEventListener("abort",r))}else t.onabort=r}let b=o??n.requestTimeout;m=ne(g,p,n.connectionTimeout),T=se(g,p,b,n.throwOnRequestTimeout,s??console),C=ce(g,p,n.socketTimeout);let d=R.agent;if(typeof d==="object"&&"keepAlive"in d)w=ie(g,{keepAlive:d.keepAlive,keepAliveMsecs:d.keepAliveMsecs});u=J(g,e,b,this.externalAgent).catch((r)=>(k(),a(r)))})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((o)=>{if(e===Symbol.for("logger"))return{...o,logger:o.logger??t};return{...o,[e]:t}})}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:t,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:c,throwOnRequestTimeout:a,logger:u}=e||{},l=!0,m=50;return{connectionTimeout:o,requestTimeout:t,socketTimeout:n,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:a,httpAgentProvider:async()=>{let T=ae("http"),{Agent:C,request:w}=T.default??T;if(B=w,H=C,i instanceof H||typeof i?.destroy==="function")return this.externalAgent=!0,i;return new H({keepAlive:!0,maxSockets:50,...i})},httpsAgent:(()=>{if(c instanceof E.Agent||typeof c?.destroy==="function")return this.externalAgent=!0,c;return new E.Agent({keepAlive:!0,maxSockets:50,...c})})(),logger:u}}}var de=new Uint16Array(1);class M{id=de[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.destroy()}useCount(){return this.refs}}class G{sessions=[];maxConcurrency=0;constructor(e){this.sessions=(e??[]).map((t)=>new M(t))}poll(){let e=!1;for(let t of this.sessions){if(t.deref().destroyed){e=!0;continue}if(!this.maxConcurrency||t.useCount()<this.maxConcurrency)return t}if(e){for(let t of this.sessions)if(t.deref().destroyed)this.remove(t)}}offerLast(e){this.sessions.push(e)}remove(e){let t=this.sessions.indexOf(e);if(t>-1)this.sessions.splice(t,1)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(e){this.maxConcurrency=e}destroy(e){this.remove(e),e.destroy()}}class X{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,t){let o=this.getUrlString(e),n=this.getPool(o);if(!this.config.disableConcurrency&&!t.isEventStream){let u=n.poll();if(u)return u.retain(),u}let s=new M(this.connect(o)),i=s.deref();if(this.config.maxConcurrency)i.settings({maxConcurrentStreams:this.config.maxConcurrency},(u)=>{if(u)throw Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});let c=()=>{this.removeFromPoolAndClose(o,s)},a=()=>{this.removeFromPoolAndCheckedDestroy(o,s)};if(i.on("goaway",c),i.on("error",a),i.on("frameError",a),i.on("close",a),t.requestTimeout)i.setTimeout(t.requestTimeout,a);return n.offerLast(s),s.retain(),s}release(e,t){t.free()}createIsolatedSession(e,t){let o=this.getUrlString(e),n=new M(this.connect(o)),s=n.deref();s.settings({maxConcurrentStreams:1});let i=()=>{n.destroy()};if(s.on("error",i),s.on("frameError",i),s.on("close",i),t.requestTimeout)s.setTimeout(t.requestTimeout,i);return n.retain(),n}destroy(){for(let[e,t]of this.connectionPools){for(let o of[...t])o.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 t of this.connectionPools.values())t.setMaxConcurrency(e)}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}setNodeHttp2ConnectOptions(e){this.connectOptions=e}debug(){let e={};for(let[t,o]of this.connectionPools){let n=[];for(let s of o)n.push({id:s.id,active:s.useCount(),maxConcurrent:s.max,totalRequests:s.total});e[t]={sessions:n}}return e}removeFromPoolAndClose(e,t){this.connectionPools.get(e)?.remove(t),t.close()}removeFromPoolAndCheckedDestroy(e,t){this.connectionPools.get(e)?.remove(t),t.destroy()}getPool(e){if(!this.connectionPools.has(e)){let t=new G;if(this.config.maxConcurrency)t.setMaxConcurrency(this.config.maxConcurrency);this.connectionPools.set(e,t)}return this.connectionPools.get(e)}getUrlString(e){return e.destination.toString()}connect(e){return this.connectOptions===void 0?_.connect(e):_.connect(e,this.connectOptions)}}var{constants:W}=_;class N{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new X({});static create(e){if(typeof e?.handle==="function")return e;return new N(e)}constructor(e){this.configProvider=new Promise((t,o)=>{if(typeof e==="function")e().then((n)=>{t(n||{})}).catch(o);else t(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:t,requestTimeout:o,isEventStream:n}={}){if(!this.config){this.config=await this.configProvider;let{disableConcurrentStreams:u,maxConcurrentStreams:l,nodeHttp2ConnectOptions:m}=this.config;if(this.connectionManager.setDisableConcurrentStreams(u??!1),l)this.connectionManager.setMaxConcurrentStreams(l);if(m)this.connectionManager.setNodeHttp2ConnectOptions(m)}let{requestTimeout:s,disableConcurrentStreams:i}=this.config,c=i||n,a=o??s;return new Promise((u,l)=>{let m=!1,T=void 0,C=async(r)=>{await T,u(r)},w=async(r)=>{await T,l(r)};if(t?.aborted){m=!0;let r=I(t);w(r);return}let{hostname:k,method:U,port:p,protocol:S,query:D}=e,x="";if(e.username!=null||e.password!=null){let r=e.username??"",f=e.password??"";x=`${r}:${f}@`}let O=`${S}//${x}${k}${p?`:${p}`:""}`,v={destination:new URL(O)},P={requestTimeout:this.config?.sessionTimeout,isEventStream:n},y=c?this.connectionManager.createIsolatedSession(v,P):this.connectionManager.lease(v,P),R=y.deref(),A=(r)=>{if(c)y.destroy();m=!0,w(r)},g=D?V(D):"",b=e.path;if(g)b+=`?${g}`;if(e.fragment)b+=`#${e.fragment}`;let d=R.request({...e.headers,[W.HTTP2_HEADER_PATH]:b,[W.HTTP2_HEADER_METHOD]:U});if(a)d.setTimeout(a,()=>{d.close();let r=Error(`Stream timed out because of no activity for ${a} ms`);r.name="TimeoutError",A(r)});if(t){let r=()=>{d.close();let f=I(t);A(f)};if(typeof t.addEventListener==="function"){let f=t;f.addEventListener("abort",r,{once:!0}),d.once("close",()=>f.removeEventListener("abort",r))}else t.onabort=r}d.on("frameError",(r,f,Y)=>{A(Error(`Frame type id ${r} in stream id ${Y} has failed with code ${f}.`))}),d.on("error",A),d.on("aborted",()=>{A(Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${d.rstCode}.`))}),d.on("response",(r)=>{let f=new K({statusCode:r[":status"]??-1,headers:Q(r),body:d});if(m=!0,C({response:f}),c)R.close()}),d.on("close",()=>{if(c)y.destroy();else this.connectionManager.release(v,y);if(!m)A(Error("Unexpected error: http2 request did not get a response"))}),T=J(d,e,a)})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((o)=>({...o,[e]:t}))}httpHandlerConfigs(){return this.config??{}}}he.DEFAULT_REQUEST_TIMEOUT=fe;he.NodeHttp2Handler=N;he.NodeHttpHandler=L});
|
|
5
|
+
export{Is};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{se,Z}from"./chunk-4p31kxjh.js";var C=Z(function(P){Object.defineProperty(P,"__esModule",{value:!0});P.Allow=P.ALL=P.COLLECTION=P.ATOM=P.SPECIAL=P.INF=P._INFINITY=P.INFINITY=P.NAN=P.BOOL=P.NULL=P.OBJ=P.ARR=P.NUM=P.STR=void 0;P.STR=1;P.NUM=2;P.ARR=4;P.OBJ=8;P.NULL=16;P.BOOL=32;P.NAN=64;P.INFINITY=128;P._INFINITY=256;P.INF=P.INFINITY|P._INFINITY;P.SPECIAL=P.NULL|P.BOOL|P.INF|P.NAN;P.ATOM=P.STR|P.NUM|P.SPECIAL;P.COLLECTION=P.ARR|P.OBJ;P.ALL=P.ATOM|P.COLLECTION;P.Allow={STR:P.STR,NUM:P.NUM,ARR:P.ARR,OBJ:P.OBJ,NULL:P.NULL,BOOL:P.BOOL,NAN:P.NAN,INFINITY:P.INFINITY,_INFINITY:P._INFINITY,INF:P.INF,SPECIAL:P.SPECIAL,ATOM:P.ATOM,COLLECTION:P.COLLECTION,ALL:P.ALL};P.default=P.Allow});var m=Z(function(c){var V=c&&c.__createBinding||(Object.create?function(t,r,s,e){if(e===void 0)e=s;var u=Object.getOwnPropertyDescriptor(r,s);if(!u||("get"in u?!r.__esModule:u.writable||u.configurable))u={enumerable:!0,get:function(){return r[s]}};Object.defineProperty(t,e,u)}:function(t,r,s,e){if(e===void 0)e=s;t[e]=r[s]}),z=c&&c.__exportStar||function(t,r){for(var s in t)if(s!=="default"&&!Object.prototype.hasOwnProperty.call(r,s))V(r,t,s)};Object.defineProperty(c,"__esModule",{value:!0});c.Allow=c.MalformedJSON=c.PartialJSON=c.parseJSON=c.parse=void 0;var i=C();Object.defineProperty(c,"Allow",{enumerable:!0,get:function(){return i.Allow}});z(C(),c);class E extends Error{}c.PartialJSON=E;class R extends Error{}c.MalformedJSON=R;function U(t,r=i.Allow.ALL){if(typeof t!=="string")throw TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw Error(`${t} is empty`);return G(t.trim(),r)}c.parseJSON=U;var G=(t,r)=>{let s=t.length,e=0,u=(n)=>{throw new E(`${n} at position ${e}`)},o=(n)=>{throw new R(`${n} at position ${e}`)},p=()=>{if(N(),e>=s)u("Unexpected end of input");if(t[e]==='"')return F();if(t[e]==="{")return v();if(t[e]==="[")return W();if(t.substring(e,e+4)==="null"||i.Allow.NULL&r&&s-e<4&&"null".startsWith(t.substring(e)))return e+=4,null;if(t.substring(e,e+4)==="true"||i.Allow.BOOL&r&&s-e<4&&"true".startsWith(t.substring(e)))return e+=4,!0;if(t.substring(e,e+5)==="false"||i.Allow.BOOL&r&&s-e<5&&"false".startsWith(t.substring(e)))return e+=5,!1;if(t.substring(e,e+8)==="Infinity"||i.Allow.INFINITY&r&&s-e<8&&"Infinity".startsWith(t.substring(e)))return e+=8,1/0;if(t.substring(e,e+9)==="-Infinity"||i.Allow._INFINITY&r&&1<s-e&&s-e<9&&"-Infinity".startsWith(t.substring(e)))return e+=9,-1/0;if(t.substring(e,e+3)==="NaN"||i.Allow.NAN&r&&s-e<3&&"NaN".startsWith(t.substring(e)))return e+=3,NaN;return D()},F=()=>{let n=e,a=!1;e++;while(e<s&&(t[e]!=='"'||a&&t[e-1]==="\\"))a=t[e]==="\\"?!a:!1,e++;if(t.charAt(e)=='"')try{return JSON.parse(t.substring(n,++e-Number(a)))}catch(f){o(String(f))}else if(i.Allow.STR&r)try{return JSON.parse(t.substring(n,e-Number(a))+'"')}catch(f){return JSON.parse(t.substring(n,t.lastIndexOf("\\"))+'"')}u("Unterminated string literal")},v=()=>{e++,N();let n={};try{while(t[e]!=="}"){if(N(),e>=s&&i.Allow.OBJ&r)return n;let a=F();N(),e++;try{let f=p();n[a]=f}catch(f){if(i.Allow.OBJ&r)return n;else throw f}if(N(),t[e]===",")e++}}catch(a){if(i.Allow.OBJ&r)return n;else u("Expected '}' at end of object")}return e++,n},W=()=>{e++;let n=[];try{while(t[e]!=="]")if(n.push(p()),N(),t[e]===",")e++}catch(a){if(i.Allow.ARR&r)return n;u("Expected ']' at end of array")}return e++,n},D=()=>{if(e===0){if(t==="-")o("Not sure what '-' is");try{return JSON.parse(t)}catch(a){if(i.Allow.NUM&r)try{return JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch(f){}o(String(a))}}let n=e;if(t[e]==="-")e++;while(t[e]&&",]}".indexOf(t[e])===-1)e++;if(e==s&&!(i.Allow.NUM&r))u("Unterminated number literal");try{return JSON.parse(t.substring(n,e))}catch(a){if(t.substring(n,e)==="-")u("Not sure what '-' is");try{return JSON.parse(t.substring(n,t.lastIndexOf("e")))}catch(f){o(String(f))}}},N=()=>{while(e<s&&`
|
|
3
|
+
\r `.includes(t[e]))e++};return p()},H=U;c.parse=H});var B=se(m(),1),K=new Set(['"',"\\","/","b","f","n","r","t","u"]);function Q(t){let r=t.codePointAt(0);return r!==void 0&&r>=0&&r<=31}function X(t){switch(t){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
4
|
+
`:return"\\n";case"\r":return"\\r";case"\t":return"\\t";default:return`\\u${t.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}function Y(t){let r="",s=!1;for(let e=0;e<t.length;e++){let u=t[e];if(!s){if(r+=u,u==='"')s=!0;continue}if(u==='"'){r+=u,s=!1;continue}if(u==="\\"){let o=t[e+1];if(o===void 0){r+="\\\\";continue}if(o==="u"){let p=t.slice(e+2,e+6);if(/^[0-9a-fA-F]{4}$/.test(p)){r+=`\\u${p}`,e+=5;continue}}if(K.has(o)){r+=`\\${o}`,e+=1;continue}r+="\\\\";continue}r+=Q(u)?X(u):u}return r}function lm(t){try{return JSON.parse(t)}catch(r){let s=Y(t);if(s!==t)return JSON.parse(s);throw r}}function Cn(t){if(!t||t.trim()==="")return{};try{return lm(t)}catch{try{return B.parse(t)??{}}catch{try{return B.parse(Y(t))??{}}catch{return{}}}}}
|
|
5
|
+
export{lm,Cn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S,L,a,X,Je,R,Pt,qt,Sg}from"./chunk-5ngftxjb.js";import"./chunk-ajq9sxg0.js";import"./chunk-1tar0x8s.js";import"./chunk-34f64q0q.js";import"./chunk-qvp24w0q.js";import"./chunk-9405hzv2.js";import"./chunk-qm50g4n5.js";import"./chunk-ffjdkdcv.js";import"./chunk-50pfmxt1.js";import"./chunk-20w1w9x7.js";import"./chunk-thpw6tcj.js";import"./chunk-pq6kdp83.js";import"./chunk-6f3zhq64.js";import"./chunk-d55138xx.js";import{xo}from"./chunk-cagzye3j.js";import"./chunk-sz5zawfw.js";import{Ar}from"./chunk-b3t7gbhm.js";import"./chunk-c1wvs81k.js";import"./chunk-etrm28sy.js";import"./chunk-0a298n62.js";import"./chunk-s1j4v33x.js";import"./chunk-pdw77q09.js";import"./chunk-femnbfkj.js";import"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";L();function s(){let{projectId:e}=c.useParams(),{teamId:r,ensureTeamIdForProject:t}=Pt();S(()=>{t(e)},[e,t]);let{data:n}=Ar(Sg(e)),o=n?.rootFolder,{data:m}=X({queryKey:["folders",o],queryFn:async()=>{let d=await R.api.folders[":folderId"].$get({param:{folderId:o}});if(!d.ok)throw Error("failed to fetch folder");return await d.json()},enabled:!!o});if(!r||!o||!m)return a(qt,{});return a(xo,{teamId:r,projectId:e,projectName:n.name??"",assetId:o,rootFolderId:o})}var c=Je("/projects/$projectId/")({component:s});export{c as Route};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Yt}from"./chunk-r6t0j0jx.js";import{at}from"./chunk-vnmggrd6.js";import{se}from"./chunk-4p31kxjh.js";var _=se(Yt()),N=se(at()),ld="AWS_ACCESS_KEY_ID",cd="AWS_SECRET_ACCESS_KEY",S="AWS_SESSION_TOKEN",C="AWS_CREDENTIAL_EXPIRATION",A="AWS_CREDENTIAL_SCOPE",p="AWS_ACCOUNT_ID",Ff=(e)=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[ld],E=process.env[cd],r=process.env[S],n=process.env[C],s=process.env[A],t=process.env[p];if(o&&E){let c={accessKeyId:o,secretAccessKey:E,...r&&{sessionToken:r},...n&&{expiration:new Date(n)},...s&&{credentialScope:s},...t&&{accountId:t}};return _.setCredentialFeature(c,"CREDENTIALS_ENV_VARS","g"),c}throw new N.CredentialsProviderError("Unable to find environment variable credentials.",{logger:e?.logger})};export{ld,cd,Ff};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{pi,Eu,pl,xu,ml,Cu,Su,Iu,Tu,ku}from"./chunk-9x42vgeq.js";import{kr}from"./chunk-k7vbk8v4.js";import{no,oo}from"./chunk-eyjfhdp9.js";import{Fa}from"./chunk-hvyy8vct.js";import{it,Xr}from"./chunk-erfkd3z9.js";import{Vn,bn}from"./chunk-h2bphev9.js";import{hr}from"./chunk-1e1q1hyg.js";var y="v1",E="gcp-vertex-credentials",T={THINKING_LEVEL_UNSPECIFIED:pi.THINKING_LEVEL_UNSPECIFIED,MINIMAL:pi.MINIMAL,LOW:pi.LOW,MEDIUM:pi.MEDIUM,HIGH:pi.HIGH},_=0,m=(e,t,n)=>{let o=new hr;return(async()=>{let i={role:"assistant",content:[],api:"google-vertex",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let u=S(n),s=u?v(e,u,n?.headers):b(e,A(n),P(n),n?.headers,n?.env),h=N(e,t,n),g=await n?.onPayload?.(h,e);if(g!==void 0)h=g;let x=await s.models.generateContentStream(h);o.push({type:"start",partial:i});let r=null,I=i.content,l=()=>I.length-1;for await(let c of x){i.responseId||=c.responseId;let p=c.candidates?.[0];if(p?.content?.parts)for(let a of p.content.parts){if(a.text!==void 0){let d=xu(a);if(!r||d&&r.type!=="thinking"||!d&&r.type!=="text"){if(r)if(r.type==="text")o.push({type:"text_end",contentIndex:I.length-1,content:r.text,partial:i});else o.push({type:"thinking_end",contentIndex:l(),content:r.thinking,partial:i});if(d)r={type:"thinking",thinking:"",thinkingSignature:void 0},i.content.push(r),o.push({type:"thinking_start",contentIndex:l(),partial:i});else r={type:"text",text:""},i.content.push(r),o.push({type:"text_start",contentIndex:l(),partial:i})}if(r.type==="thinking")r.thinking+=a.text,r.thinkingSignature=ml(r.thinkingSignature,a.thoughtSignature),o.push({type:"thinking_delta",contentIndex:l(),delta:a.text,partial:i});else r.text+=a.text,r.textSignature=ml(r.textSignature,a.thoughtSignature),o.push({type:"text_delta",contentIndex:l(),delta:a.text,partial:i})}if(a.functionCall){if(r){if(r.type==="text")o.push({type:"text_end",contentIndex:l(),content:r.text,partial:i});else o.push({type:"thinking_end",contentIndex:l(),content:r.thinking,partial:i});r=null}let d=a.functionCall.id,f={type:"toolCall",id:!d||i.content.some((C)=>C.type==="toolCall"&&C.id===d)?`${a.functionCall.name}_${Date.now()}_${++_}`:d,name:a.functionCall.name||"",arguments:a.functionCall.args??{},...a.thoughtSignature&&{thoughtSignature:a.thoughtSignature}};i.content.push(f),o.push({type:"toolcall_start",contentIndex:l(),partial:i}),o.push({type:"toolcall_delta",contentIndex:l(),delta:JSON.stringify(f.arguments),partial:i}),o.push({type:"toolcall_end",contentIndex:l(),toolCall:f,partial:i})}}if(p?.finishReason){if(i.stopReason=ku(p.finishReason),i.content.some((a)=>a.type==="toolCall"))i.stopReason="toolUse"}if(c.usageMetadata)i.usage={input:(c.usageMetadata.promptTokenCount||0)-(c.usageMetadata.cachedContentTokenCount||0),output:(c.usageMetadata.candidatesTokenCount||0)+(c.usageMetadata.thoughtsTokenCount||0),cacheRead:c.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:c.usageMetadata.thoughtsTokenCount||0,totalTokens:c.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},Vn(e,i.usage)}if(r)if(r.type==="text")o.push({type:"text_end",contentIndex:l(),content:r.text,partial:i});else o.push({type:"thinking_end",contentIndex:l(),content:r.thinking,partial:i});if(n?.signal?.aborted)throw Error("Request was aborted");if(i.stopReason==="aborted"||i.stopReason==="error")throw Error("An unknown error occurred");o.push({type:"done",reason:i.stopReason,message:i}),o.end()}catch(u){for(let s of i.content)if("index"in s)delete s.index;i.stopReason=n?.signal?.aborted?"aborted":"error",i.errorMessage=oo(no(u)),o.push({type:"error",reason:i.stopReason,error:i}),o.end()}})(),o},Y=(e,t,n)=>{let o=Xr(e,t,n,void 0);if(!n?.reasoning)return m(e,t,{...o,thinking:{enabled:!1}});let i=bn(e,n.reasoning),u=i==="off"?"high":i,s=e;if(k(s)||L(s))return m(e,t,{...o,thinking:{enabled:!0,level:D(u,s)}});return m(e,t,{...o,thinking:{enabled:!0,budgetTokens:H(s,u,n.thinkingBudgets)}})};function b(e,t,n,o,i){let u=w(i);return new pl({vertexai:!0,project:t,location:n,apiVersion:y,...u?{googleAuthOptions:u}:{},httpOptions:O(e,o)})}function v(e,t,n){return new pl({vertexai:!0,apiKey:t,apiVersion:y,httpOptions:O(e,n)})}function O(e,t){let n={},o=M(e.baseUrl);if(o){if(n.baseUrl=o,n.baseUrlResourceScope=Eu.COLLECTION,R(o))n.apiVersion=""}let i=Fa({...e.headers,...t});if(i)n.headers=i;return Object.keys(n).length>0?n:void 0}function M(e){let t=e.trim();if(!t||t.includes("{location}"))return;return t}function R(e){try{return new URL(e).pathname.split("/").some((n)=>/^v\d+(?:beta\d*)?$/.test(n))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function w(e){let t=kr("GOOGLE_APPLICATION_CREDENTIALS",e);return t?{keyFilename:t}:void 0}function S(e){let t=e?.apiKey?.trim();if(!t||t===E||G(t))return;return t}function G(e){return/^<[^>]+>$/.test(e)}function A(e){let t=e?.project||kr("GOOGLE_CLOUD_PROJECT",e?.env)||kr("GCLOUD_PROJECT",e?.env);if(!t)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return t}function P(e){let t=e?.location||kr("GOOGLE_CLOUD_LOCATION",e?.env);if(!t)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return t}function N(e,t,n={}){let o=Cu(e,t),i={};if(n.temperature!==void 0)i.temperature=n.temperature;if(n.maxTokens!==void 0)i.maxOutputTokens=n.maxTokens;let u=t.tools?.length?Tu(t.tools,n.toolChoice,Iu(e.id)):void 0,s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:it(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:Su(t.tools)},...u!==void 0&&{toolConfig:{functionCallingConfig:{mode:u}}}};if(n.thinking?.enabled&&e.reasoning){let g={includeThoughts:!0};if(n.thinking.level!==void 0)g.thinkingLevel=T[n.thinking.level];else if(n.thinking.budgetTokens!==void 0)g.thinkingBudget=n.thinking.budgetTokens;s.thinkingConfig=g}else if(e.reasoning&&n.thinking&&!n.thinking.enabled)s.thinkingConfig=U(e);if(n.signal){if(n.signal.aborted)throw Error("Request aborted");s.abortSignal=n.signal}return{model:e.id,contents:o,config:s}}function k(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function L(e){let t=e.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(t)||t==="gemini-flash-latest"||t==="gemini-flash-lite-latest"}function U(e){let t=e;if(k(t))return{thinkingLevel:pi.LOW};if(L(t))return{thinkingLevel:pi.MINIMAL};return{thinkingBudget:0}}function D(e,t){if(k(t))switch(e){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(e){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function H(e,t,n){if(n?.[t]!==void 0)return n[t];if(e.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[t];if(e.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[t];return-1}export{m as stream,Y as streamSimple};
|