@shumai-one/shumai 0.1.8 → 0.1.9
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-8e4d80kp.js → chunk-08m8mzfa.js} +1 -1
- package/bin/{chunk-qggykya7.js → chunk-0at8vxt5.js} +1 -1
- package/bin/{chunk-4g68cqhk.js → chunk-0zv7f9ca.js} +1 -1
- package/bin/{chunk-30jjvb4k.js → chunk-1fpqq6ed.js} +2 -2
- package/bin/chunk-1rvy3h5v.js +1 -0
- package/bin/{chunk-8swcdgg3.js → chunk-1wq9hjjr.js} +1 -1
- package/bin/{chunk-6ftb22yh.js → chunk-22dje1f5.js} +1 -1
- package/bin/{chunk-yz7fdcqe.js → chunk-22v60r4w.js} +2 -2
- package/bin/chunk-23ggq8gr.js +1 -0
- package/bin/{chunk-8g69rftv.js → chunk-29ectt6g.js} +2 -2
- package/bin/chunk-2cqxd8de.js +2 -0
- package/bin/{chunk-7qm716wz.js → chunk-2k4vp654.js} +1 -1
- package/bin/{chunk-rp5kkkb2.js → chunk-2kp858g5.js} +2 -2
- package/bin/{chunk-v159ppmt.js → chunk-2tbya52d.js} +1 -1
- package/bin/{chunk-kc7vcfch.js → chunk-2vs3evc7.js} +2 -2
- package/bin/{chunk-0b7pt74x.js → chunk-2xx8j495.js} +2 -2
- package/bin/chunk-314ncj75.js +2 -0
- package/bin/{chunk-wp51h5mn.js → chunk-33169en9.js} +1 -1
- package/bin/{chunk-eqjxqzxw.js → chunk-3n1k9qt5.js} +1 -1
- package/bin/{chunk-redk7r63.js → chunk-3qdn3pty.js} +1 -1
- package/bin/{chunk-7yh2nbmq.js → chunk-3rajscaz.js} +1 -1
- package/bin/{chunk-vfn5aygx.js → chunk-3rt9mnj3.js} +1 -1
- package/bin/{chunk-fseg9mh8.js → chunk-3x62t1m0.js} +1 -1
- package/bin/{chunk-xj8ss02x.js → chunk-45yzs9sh.js} +2 -2
- package/bin/chunk-4ddrkmxq.js +2 -0
- package/bin/{chunk-ww62rpxv.js → chunk-5a2maxwp.js} +2 -2
- package/bin/{chunk-map94w8n.js → chunk-62rqa4dq.js} +2 -2
- package/bin/chunk-749eqers.js +1 -0
- package/bin/{chunk-0hp6t0q3.js → chunk-7ddaxdpf.js} +1 -1
- package/bin/{chunk-5mvvjqcp.js → chunk-7rhjej0x.js} +1 -1
- package/bin/{chunk-h6qkpxtj.js → chunk-7wvgtw25.js} +1 -1
- package/bin/{chunk-5wppe329.js → chunk-94h8644q.js} +1 -1
- package/bin/{chunk-wndb0rc7.js → chunk-9awf1xp6.js} +2 -2
- package/bin/{chunk-b6ay38ns.js → chunk-9n0etqsy.js} +1 -1
- package/bin/{chunk-k9m47xba.js → chunk-9rw65s3e.js} +2 -2
- package/bin/{chunk-1dvam047.js → chunk-a5kfa0k9.js} +1 -1
- package/bin/{chunk-7a2gg16x.js → chunk-aakzq0w1.js} +1 -1
- package/bin/{chunk-c8t4yzjs.js → chunk-abm6b5hq.js} +2 -2
- package/bin/{chunk-a70x1w8e.js → chunk-ac2ky3q0.js} +2 -2
- package/bin/{chunk-24bbrqy7.js → chunk-acxm86fh.js} +1 -1
- package/bin/chunk-at2kt8kk.js +1 -0
- package/bin/{chunk-x9q1k4kw.js → chunk-by6reed2.js} +2 -2
- package/bin/{chunk-3cre4tc5.js → chunk-cthpdt54.js} +2 -2
- package/bin/{chunk-qb5qfw71.js → chunk-d0earxhc.js} +1 -1
- package/bin/{chunk-xy33vxtv.js → chunk-d1ka11hc.js} +1 -1
- package/bin/{chunk-sqpaynb6.js → chunk-d2y3rbjm.js} +1 -1
- package/bin/chunk-dfsfh3pw.js +2 -0
- package/bin/{chunk-9z155z22.js → chunk-dh4tbp68.js} +2 -2
- package/bin/{chunk-q1zr85gb.js → chunk-dmgjse02.js} +1 -1
- package/bin/chunk-dsnnmmd9.js +62 -0
- package/bin/{chunk-d9haskf5.js → chunk-dypsm6m2.js} +1 -1
- package/bin/{chunk-vqfm1spm.js → chunk-dyybbn07.js} +1 -1
- package/bin/{chunk-1w2ewnxj.js → chunk-e1gzv3p0.js} +2 -2
- package/bin/{chunk-2nvc9af3.js → chunk-e2ekkk1h.js} +2 -2
- package/bin/{chunk-gda70q5n.js → chunk-eadb78m8.js} +1 -1
- package/bin/{chunk-32ptm61p.js → chunk-ec88pb09.js} +2 -2
- package/bin/{chunk-eagsj1vb.js → chunk-ehfk24cf.js} +1 -1
- package/bin/{chunk-tqtms9ft.js → chunk-ej456cn5.js} +2 -2
- package/bin/{chunk-tjzrhp6f.js → chunk-f9v92x1z.js} +2 -2
- package/bin/{chunk-yadp1e44.js → chunk-fcb14agg.js} +1 -1
- package/bin/chunk-fjhbwem5.js +3 -0
- package/bin/{chunk-dvgxj01x.js → chunk-fwe9g818.js} +1 -1
- package/bin/{chunk-2r9dzbmv.js → chunk-fybr479k.js} +2 -2
- package/bin/{chunk-ehgc7x4w.js → chunk-gdm6y33a.js} +1 -1
- package/bin/chunk-j8e6ytkh.css +1 -0
- package/bin/chunk-jdgf23w4.js +1 -0
- package/bin/chunk-jm7c1sd3.js +1 -0
- package/bin/{chunk-5n525czh.js → chunk-jwdf5dkn.js} +1 -1
- package/bin/{chunk-t6ettw1q.js → chunk-k5w64spz.js} +2 -2
- package/bin/chunk-k712q1zj.js +2 -0
- package/bin/{chunk-nz95b2c5.js → chunk-kbzm1pwx.js} +1 -1
- package/bin/{chunk-g460bbnk.js → chunk-kqgfhhk4.js} +2 -2
- package/bin/{chunk-d3bx7aew.js → chunk-m3eys85a.js} +1 -1
- package/bin/{chunk-f3vj8mrh.js → chunk-mjan6b09.js} +3 -3
- package/bin/{chunk-3xqy7myz.js → chunk-mv79zk8q.js} +3 -3
- package/bin/{chunk-x1178p5d.js → chunk-mxwnzxmd.js} +2 -2
- package/bin/{chunk-k4pa97ny.js → chunk-n296vcfw.js} +1 -1
- package/bin/{chunk-4jnv6j35.js → chunk-n2n6etpd.js} +1 -1
- package/bin/{chunk-8fe6c473.js → chunk-n5hfy93f.js} +2 -2
- package/bin/{chunk-08hwazz9.js → chunk-n6jgyv4y.js} +2 -2
- package/bin/{chunk-8jmnfqt9.js → chunk-nar4s9v9.js} +1 -1
- package/bin/chunk-parn6mr0.js +1 -0
- package/bin/{chunk-1saz0r74.js → chunk-q9zn84ms.js} +2 -2
- package/bin/{chunk-ypada0jh.js → chunk-qedhje78.js} +2 -2
- package/bin/{chunk-5wcyvbqg.js → chunk-qqesrgjk.js} +1 -1
- package/bin/{chunk-mfmry62q.js → chunk-qz9xht6d.js} +1 -1
- package/bin/{chunk-qvkqjgtt.js → chunk-qzgkshc5.js} +1 -1
- package/bin/chunk-raxnhtb0.js +2 -0
- package/bin/{chunk-wdg3m7ck.js → chunk-s3eadfmq.js} +26 -26
- package/bin/{chunk-f35s32xy.js → chunk-s8d2045p.js} +1 -1
- package/bin/chunk-saq2g4j3.js +1 -0
- package/bin/{chunk-xs7cpj25.js → chunk-sj6fzxmd.js} +2 -2
- package/bin/{chunk-rz9pz59y.js → chunk-t1sv4zdb.js} +2 -2
- package/bin/chunk-ts1w9p9a.js +1 -0
- package/bin/chunk-v1ax9cja.js +2 -0
- package/bin/{chunk-5qtqgx87.js → chunk-vqketj32.js} +2 -2
- package/bin/{chunk-f8xx6rcr.js → chunk-vreyhvb6.js} +2 -2
- package/bin/{chunk-qk2ff4nz.js → chunk-w4t9n9te.js} +1 -1
- package/bin/{chunk-23ps0bkk.js → chunk-w4y97tzy.js} +1 -1
- package/bin/{chunk-cmv4axyg.js → chunk-wsnrv2aa.js} +2 -2
- package/bin/{chunk-5ev6gvcw.js → chunk-wv4fe1fj.js} +2 -2
- package/bin/{chunk-9x12d447.js → chunk-xh2ntgmk.js} +2 -2
- package/bin/{chunk-4fsbzhr2.js → chunk-y1xs4c5j.js} +1 -1
- package/bin/chunk-ycx0497z.js +1 -0
- package/bin/{chunk-0zpc9pkt.js → chunk-yhj8c5re.js} +2 -2
- package/bin/{chunk-qbtsq2mp.js → chunk-ysq64j13.js} +1 -1
- package/bin/chunk-ywzht1v9.js +3 -0
- package/bin/{chunk-w3t6tpgg.js → chunk-z14hh99h.js} +1 -1
- package/bin/{chunk-kv62xcad.js → chunk-zd8tf4j1.js} +2 -2
- package/bin/{chunk-8k17tr3j.js → chunk-zxd1hrpf.js} +2 -2
- package/bin/{chunk-wyp6md07.js → chunk-zyhr9ajx.js} +2 -2
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +170 -158
- package/package.json +7 -7
- package/prisma/migrations/20260711121142_add_agent_session_type/migration.sql +8 -0
- package/prisma/migrations/20260711123731_add_agent_session_name/migration.sql +2 -0
- package/prisma/migrations/20260711124459_add_naming_session_type/migration.sql +2 -0
- package/prisma/migrations/20260714024940_add_session_id_to_workflow_tasks/migration.sql +5 -0
- package/prisma/migrations/20260714025034_backfill_session_id_in_workflow_tasks/migration.sql +4 -0
- package/prisma/schema.prisma +11 -0
- package/bin/chunk-0kkyb1qj.js +0 -2
- package/bin/chunk-2hbxxtna.js +0 -3
- package/bin/chunk-3f8h4ny6.js +0 -1
- package/bin/chunk-5fcq8frp.js +0 -2
- package/bin/chunk-5mfrg15w.js +0 -2
- package/bin/chunk-7ypz776w.js +0 -2
- package/bin/chunk-8re7vwwx.js +0 -1
- package/bin/chunk-cr4jkqng.js +0 -1
- package/bin/chunk-h2v02d67.js +0 -1
- package/bin/chunk-h90tm6j4.js +0 -2
- package/bin/chunk-jk0x7225.css +0 -1
- package/bin/chunk-jkhyp3kp.js +0 -1
- package/bin/chunk-kb7egkm8.js +0 -2
- package/bin/chunk-p2xqn9ks.js +0 -1
- package/bin/chunk-p8hzvaqv.js +0 -1
- package/bin/chunk-qsbmjs1a.js +0 -2
- package/bin/chunk-r673a3wt.js +0 -62
- package/bin/chunk-rfx3y5re.js +0 -1
- package/bin/chunk-vw02zbwa.js +0 -1
- package/bin/chunk-vwgb2q3b.js +0 -1
- package/bin/chunk-zqbsbxz7.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function L(G,q,D){return{temperature:q?.temperature,maxTokens:q?.maxTokens,signal:q?.signal,apiKey:D||q?.apiKey,transport:q?.transport,cacheRetention:q?.cacheRetention,sessionId:q?.sessionId,headers:q?.headers,onPayload:q?.onPayload,onResponse:q?.onResponse,timeoutMs:q?.timeoutMs,websocketConnectTimeoutMs:q?.websocketConnectTimeoutMs,maxRetries:q?.maxRetries,maxRetryDelayMs:q?.maxRetryDelayMs,metadata:q?.metadata}}function K(G){return G==="xhigh"?"high":G}function y(G,q,D,N){let _={...{minimal:1024,low:2048,medium:8192,high:16384},...N},O=1024,V=K(D),J=_[V],Q=G===void 0?q:Math.min(G+J,q);if(Q<=J)J=Math.max(0,Q-1024);return{maxTokens:Q,thinkingBudget:J}}function j(G,q){let D=[],N=!1;for(let Y of G){if(Y.type==="image"){if(!N)D.push({type:"text",text:q});N=!0;continue}D.push(Y),N=Y.text===q}return D}function U(G,q){if(q.input.includes("image"))return G;return G.map((D)=>{if(D.role==="user"&&Array.isArray(D.content))return{...D,content:j(D.content,"(image omitted: model does not support images)")};if(D.role==="toolResult")return{...D,content:j(D.content,"(tool image omitted: model does not support images)")};return D})}function W(G,q,D){let N=new Map,_=U(G,q).map((E)=>{if(E.role==="user")return E;if(E.role==="toolResult"){let A=N.get(E.toolCallId);if(A&&A!==E.toolCallId)return{...E,toolCallId:A};return E}if(E.role==="assistant"){let A=E,H=A.provider===q.provider&&A.api===q.api&&A.model===q.id,$=A.content.flatMap((F)=>{if(F.type==="thinking"){if(F.redacted)return H?F:[];if(H&&F.thinkingSignature)return F;if(!F.thinking||F.thinking.trim()==="")return[];if(H)return F;return{type:"text",text:F.thinking}}if(F.type==="text"){if(H)return F;return{type:"text",text:F.text}}if(F.type==="toolCall"){let X=F,Z=X;if(!H&&X.thoughtSignature)Z={...X},delete Z.thoughtSignature;if(!H&&D){let w=D(X.id,q,A);if(w!==X.id)N.set(X.id,w),Z={...Z,id:w}}return Z}return F});return{...A,content:$}}return E}),O=[],V=[],J=new Set,Q=()=>{if(V.length>0){for(let E of V)if(!J.has(E.id))O.push({role:"toolResult",toolCallId:E.id,toolName:E.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});V=[],J=new Set}};for(let E=0;E<_.length;E++){let A=_[E];if(A.role==="assistant"){Q();let H=A;if(H.stopReason==="error"||H.stopReason==="aborted")continue;let $=H.content.filter((F)=>F.type==="toolCall");if($.length>0)V=$,J=new Set;O.push(A)}else if(A.role==="toolResult")J.add(A.toolCallId),O.push(A);else if(A.role==="user")Q(),O.push(A);else O.push(A)}return Q(),O}
|
|
3
|
-
export{L as
|
|
3
|
+
export{L as Sj,y as Tj,W as Uj};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function L(G,q,D){return{temperature:q?.temperature,maxTokens:q?.maxTokens,signal:q?.signal,apiKey:D||q?.apiKey,transport:q?.transport,cacheRetention:q?.cacheRetention,sessionId:q?.sessionId,headers:q?.headers,onPayload:q?.onPayload,onResponse:q?.onResponse,timeoutMs:q?.timeoutMs,maxRetries:q?.maxRetries,maxRetryDelayMs:q?.maxRetryDelayMs,metadata:q?.metadata}}function K(G){return G==="xhigh"?"high":G}function y(G,q,D,N){let _={...{minimal:1024,low:2048,medium:8192,high:16384},...N},O=1024,V=K(D),J=_[V],Q=G===void 0?q:Math.min(G+J,q);if(Q<=J)J=Math.max(0,Q-1024);return{maxTokens:Q,thinkingBudget:J}}function j(G,q){let D=[],N=!1;for(let Y of G){if(Y.type==="image"){if(!N)D.push({type:"text",text:q});N=!0;continue}D.push(Y),N=Y.text===q}return D}function U(G,q){if(q.input.includes("image"))return G;return G.map((D)=>{if(D.role==="user"&&Array.isArray(D.content))return{...D,content:j(D.content,"(image omitted: model does not support images)")};if(D.role==="toolResult")return{...D,content:j(D.content,"(tool image omitted: model does not support images)")};return D})}function W(G,q,D){let N=new Map,_=U(G,q).map((E)=>{if(E.role==="user")return E;if(E.role==="toolResult"){let A=N.get(E.toolCallId);if(A&&A!==E.toolCallId)return{...E,toolCallId:A};return E}if(E.role==="assistant"){let A=E,H=A.provider===q.provider&&A.api===q.api&&A.model===q.id,$=A.content.flatMap((F)=>{if(F.type==="thinking"){if(F.redacted)return H?F:[];if(H&&F.thinkingSignature)return F;if(!F.thinking||F.thinking.trim()==="")return[];if(H)return F;return{type:"text",text:F.thinking}}if(F.type==="text"){if(H)return F;return{type:"text",text:F.text}}if(F.type==="toolCall"){let X=F,Z=X;if(!H&&X.thoughtSignature)Z={...X},delete Z.thoughtSignature;if(!H&&D){let w=D(X.id,q,A);if(w!==X.id)N.set(X.id,w),Z={...Z,id:w}}return Z}return F});return{...A,content:$}}return E}),O=[],V=[],J=new Set,Q=()=>{if(V.length>0){for(let E of V)if(!J.has(E.id))O.push({role:"toolResult",toolCallId:E.id,toolName:E.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});V=[],J=new Set}};for(let E=0;E<_.length;E++){let A=_[E];if(A.role==="assistant"){Q();let H=A;if(H.stopReason==="error"||H.stopReason==="aborted")continue;let $=H.content.filter((F)=>F.type==="toolCall");if($.length>0)V=$,J=new Set;O.push(A)}else if(A.role==="toolResult")J.add(A.toolCallId),O.push(A);else if(A.role==="user")Q(),O.push(A);else O.push(A)}return Q(),O}
|
|
3
|
-
export{L as
|
|
3
|
+
export{L as xb,y as yb,W as zb};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{rb as C,sb as j,tb as v,ub as T,vb as I,wb as B}from"./chunk-k5w64spz.js";import{xb as M}from"./chunk-0at8vxt5.js";import{Ab as P}from"./chunk-22dje1f5.js";import{ie as L,je as K,ke as G}from"./chunk-7rhjej0x.js";import{Oj as F,Qj as y,Rj as H}from"./chunk-mjan6b09.js";import"./chunk-kbzm1pwx.js";var b="v1",k="gcp-vertex-credentials",g={THINKING_LEVEL_UNSPECIFIED:F.THINKING_LEVEL_UNSPECIFIED,MINIMAL:F.MINIMAL,LOW:F.LOW,MEDIUM:F.MEDIUM,HIGH:F.HIGH},m=0,S=(q,w,J)=>{let Y=new G;return(async()=>{let Q={role:"assistant",content:[],api:"google-vertex",provider:q.provider,model:q.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 W=p(J),z=W?u(q,W,J?.headers):d(q,r(J),s(J),J?.headers),N=i(q,w,J),R=await J?.onPayload?.(N,q);if(R!==void 0)N=R;let x=await z.models.generateContentStream(N);Y.push({type:"start",partial:Q});let Z=null,A=Q.content,X=()=>A.length-1;for await(let D of x){Q.responseId||=D.responseId;let V=D.candidates?.[0];if(V?.content?.parts)for(let $ of V.content.parts){if($.text!==void 0){let _=C($);if(!Z||_&&Z.type!=="thinking"||!_&&Z.type!=="text"){if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:A.length-1,content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(_)Z={type:"thinking",thinking:"",thinkingSignature:void 0},Q.content.push(Z),Y.push({type:"thinking_start",contentIndex:X(),partial:Q});else Z={type:"text",text:""},Q.content.push(Z),Y.push({type:"text_start",contentIndex:X(),partial:Q})}if(Z.type==="thinking")Z.thinking+=$.text,Z.thinkingSignature=j(Z.thinkingSignature,$.thoughtSignature),Y.push({type:"thinking_delta",contentIndex:X(),delta:$.text,partial:Q});else Z.text+=$.text,Z.textSignature=j(Z.textSignature,$.thoughtSignature),Y.push({type:"text_delta",contentIndex:X(),delta:$.text,partial:Q})}if($.functionCall){if(Z){if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});Z=null}let _=$.functionCall.id,E={type:"toolCall",id:!_||Q.content.some((U)=>U.type==="toolCall"&&U.id===_)?`${$.functionCall.name}_${Date.now()}_${++m}`:_,name:$.functionCall.name||"",arguments:$.functionCall.args??{},...$.thoughtSignature&&{thoughtSignature:$.thoughtSignature}};Q.content.push(E),Y.push({type:"toolcall_start",contentIndex:X(),partial:Q}),Y.push({type:"toolcall_delta",contentIndex:X(),delta:JSON.stringify(E.arguments),partial:Q}),Y.push({type:"toolcall_end",contentIndex:X(),toolCall:E,partial:Q})}}if(V?.finishReason){if(Q.stopReason=B(V.finishReason),Q.content.some(($)=>$.type==="toolCall"))Q.stopReason="toolUse"}if(D.usageMetadata)Q.usage={input:(D.usageMetadata.promptTokenCount||0)-(D.usageMetadata.cachedContentTokenCount||0),output:(D.usageMetadata.candidatesTokenCount||0)+(D.usageMetadata.thoughtsTokenCount||0),cacheRead:D.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:D.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},L(q,Q.usage)}if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(J?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");Y.push({type:"done",reason:Q.stopReason,message:Q}),Y.end()}catch(W){for(let z of Q.content)if("index"in z)delete z.index;Q.stopReason=J?.signal?.aborted?"aborted":"error",Q.errorMessage=W instanceof Error?W.message:JSON.stringify(W),Y.push({type:"error",reason:Q.stopReason,error:Q}),Y.end()}})(),Y},Wq=(q,w,J)=>{let Y=M(q,J,void 0);if(!J?.reasoning)return S(q,w,{...Y,thinking:{enabled:!1}});let Q=K(q,J.reasoning),W=Q==="off"?"high":Q,z=q;if(O(z)||h(z))return S(q,w,{...Y,thinking:{enabled:!0,level:e(W,z)}});return S(q,w,{...Y,thinking:{enabled:!0,budgetTokens:t(z,W,J.thinkingBudgets)}})};function d(q,w,J,Y){return new H({vertexai:!0,project:w,location:J,apiVersion:b,httpOptions:f(q,Y)})}function u(q,w,J){return new H({vertexai:!0,apiKey:w,apiVersion:b,httpOptions:f(q,J)})}function f(q,w){let J={},Y=a(q.baseUrl);if(Y){if(J.baseUrl=Y,J.baseUrlResourceScope=y.COLLECTION,c(Y))J.apiVersion=""}if(q.headers||w)J.headers={...q.headers,...w};return Object.keys(J).length>0?J:void 0}function a(q){let w=q.trim();if(!w||w.includes("{location}"))return;return w}function c(q){try{return new URL(q).pathname.split("/").some((J)=>/^v\d+(?:beta\d*)?$/.test(J))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(q)}}function p(q){let w=q?.apiKey?.trim()||process.env.GOOGLE_CLOUD_API_KEY?.trim();if(!w||w===k||l(w))return;return w}function l(q){return/^<[^>]+>$/.test(q)}function r(q){let w=q?.project||process.env.GOOGLE_CLOUD_PROJECT||process.env.GCLOUD_PROJECT;if(!w)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return w}function s(q){let w=q?.location||process.env.GOOGLE_CLOUD_LOCATION;if(!w)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return w}function i(q,w,J={}){let Y=v(q,w),Q={};if(J.temperature!==void 0)Q.temperature=J.temperature;if(J.maxTokens!==void 0)Q.maxOutputTokens=J.maxTokens;let W={...Object.keys(Q).length>0&&Q,...w.systemPrompt&&{systemInstruction:P(w.systemPrompt)},...w.tools&&w.tools.length>0&&{tools:T(w.tools)}};if(w.tools&&w.tools.length>0&&J.toolChoice)W.toolConfig={functionCallingConfig:{mode:I(J.toolChoice)}};else W.toolConfig=void 0;if(J.thinking?.enabled&&q.reasoning){let N={includeThoughts:!0};if(J.thinking.level!==void 0)N.thinkingLevel=g[J.thinking.level];else if(J.thinking.budgetTokens!==void 0)N.thinkingBudget=J.thinking.budgetTokens;W.thinkingConfig=N}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)W.thinkingConfig=n(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");W.abortSignal=J.signal}return{model:q.id,contents:Y,config:W}}function O(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function h(q){return/gemini-3(?:\.\d+)?-flash/.test(q.id.toLowerCase())}function n(q){let w=q;if(O(w))return{thinkingLevel:F.LOW};if(h(w))return{thinkingLevel:F.MINIMAL};return{thinkingBudget:0}}function e(q,w){if(O(w))switch(q){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(q){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function t(q,w,J){if(J?.[w]!==void 0)return J[w];if(q.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[w];if(q.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[w];return-1}export{Wq as streamSimpleGoogleVertex,S as streamGoogleVertex};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Fj as G}from"./chunk-yhj8c5re.js";import{Zj as F}from"./chunk-kbzm1pwx.js";var y=F(G(),1),H=new Set(['"',"\\","/","b","f","n","r","t","u"]);function K(b){let f=b.codePointAt(0);return f!==void 0&&f>=0&&f<=31}function Q(b){switch(b){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
3
3
|
`:return"\\n";case"\r":return"\\r";case"\t":return"\\t";default:return`\\u${b.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}function B(b){let f="",v=!1;for(let k=0;k<b.length;k++){let q=b[k];if(!v){if(f+=q,q==='"')v=!0;continue}if(q==='"'){f+=q,v=!1;continue}if(q==="\\"){let w=b[k+1];if(w===void 0){f+="\\\\";continue}if(w==="u"){let z=b.slice(k+2,k+6);if(/^[0-9a-fA-F]{4}$/.test(z)){f+=`\\u${z}`,k+=5;continue}}if(H.has(w)){f+=`\\${w}`,k+=1;continue}f+="\\\\";continue}f+=K(q)?Q(q):q}return f}function T(b){try{return JSON.parse(b)}catch(f){let v=B(b);if(v!==b)return JSON.parse(v);throw f}}function X(b){if(!b||b.trim()==="")return{};try{return T(b)}catch{try{return y.parse(b)??{}}catch{try{return y.parse(B(b))??{}}catch{return{}}}}}
|
|
4
|
-
export{T as
|
|
4
|
+
export{T as Dj,X as Ej};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as B}from"./chunk-qzgkshc5.js";import"./chunk-n2n6etpd.js";import"./chunk-abm6b5hq.js";import"./chunk-s3eadfmq.js";import"./chunk-fybr479k.js";import"./chunk-62rqa4dq.js";import"./chunk-314ncj75.js";import"./chunk-f9v92x1z.js";import"./chunk-kqgfhhk4.js";import"./chunk-wsnrv2aa.js";import"./chunk-t1sv4zdb.js";import"./chunk-q9zn84ms.js";import"./chunk-dfsfh3pw.js";import"./chunk-by6reed2.js";import"./chunk-zyhr9ajx.js";import"./chunk-4ddrkmxq.js";import"./chunk-fjhbwem5.js";import"./chunk-qedhje78.js";import"./chunk-45yzs9sh.js";import"./chunk-5a2maxwp.js";import"./chunk-e2ekkk1h.js";import"./chunk-mxwnzxmd.js";import"./chunk-e1gzv3p0.js";import{dg as q,ug as w}from"./chunk-dsnnmmd9.js";import"./chunk-kbzm1pwx.js";function O(){let{shareId:C,fileId:D}=k.useParams(),{start:E,version:G,compare:H,cmpLeft:J,cmpRight:K,cmpActive:N}=k.useSearch();return q(B,{shareId:C,initialFileId:D,startTime:E,versionId:G,compare:H,compareLeftId:J,compareRightId:K,compareActiveSide:N})}var k=w("/share/$shareId/files/$fileId")({component:O});export{k as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{wj as S,xj as T,yj as C}from"./chunk-29ectt6g.js";import"./chunk-a5kfa0k9.js";import{Aj as D}from"./chunk-fwe9g818.js";import{Cj as Z}from"./chunk-w4y97tzy.js";import"./chunk-1fpqq6ed.js";import"./chunk-yhj8c5re.js";import{Gj as k}from"./chunk-n296vcfw.js";import{Sj as f}from"./chunk-08m8mzfa.js";import{Wj as M,Xj as V}from"./chunk-3rajscaz.js";import"./chunk-eadb78m8.js";import"./chunk-kbzm1pwx.js";var j="v1",E=new Set(["openai","openai-codex","opencode","azure-openai-responses"]);function K(G){let Q=new Map;if(!G)return Q;for(let w of G.split(",")){let W=w.trim();if(!W)continue;let[X,J]=W.split("=",2);if(!X||!J)continue;Q.set(X.trim(),J.trim())}return Q}function g(G,Q){if(Q?.azureDeploymentName)return Q.azureDeploymentName;return K(process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(G.id)||G.id}function B(G){if(G instanceof Error){let Q=G.status,w=typeof Q==="number"?Q:void 0;if(w!==void 0)return`Azure OpenAI API error (${w}): ${G.message}`;return G.message}try{return JSON.stringify(G)}catch{return String(G)}}var I=(G,Q,w)=>{let W=new V;return(async()=>{let X=g(G,w),J={role:"assistant",content:[],api:"azure-openai-responses",provider:G.provider,model:G.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 Y=w?.apiKey;if(!Y)throw Error(`No API key for provider: ${G.provider}`);let $=z(G,Y,w),q=b(G,Q,w,X),F=await w?.onPayload?.(q,G);if(F!==void 0)q=F;let L={...w?.signal?{signal:w.signal}:{},...w?.timeoutMs!==void 0?{timeout:w.timeoutMs}:{},maxRetries:w?.maxRetries??0},{data:_,response:H}=await $.responses.create(q,L).withResponse();if(await w?.onResponse?.({status:H.status,headers:k(H.headers)},G),W.push({type:"start",partial:J}),await C(_,J,W,G),w?.signal?.aborted)throw Error("Request was aborted");if(J.stopReason==="aborted"||J.stopReason==="error")throw Error("An unknown error occurred");W.push({type:"done",reason:J.stopReason,message:J}),W.end()}catch(Y){for(let $ of J.content)delete $.index,delete $.partialJson;J.stopReason=w?.signal?.aborted?"aborted":"error",J.errorMessage=B(Y),W.push({type:"error",reason:J.stopReason,error:J}),W.end()}})(),W},c=(G,Q,w)=>{let W=w?.apiKey;if(!W)throw Error(`No API key for provider: ${G.provider}`);let X=f(G,w,W),J=w?.reasoning?M(G,w.reasoning):void 0;return I(G,Q,{...X,reasoningEffort:J==="off"?void 0:J})};function P(G){let Q=G.trim().replace(/\/+$/,""),w;try{w=new URL(Q)}catch{throw Error(`Invalid Azure OpenAI base URL: ${G}`)}let W=w.hostname.endsWith(".openai.azure.com")||w.hostname.endsWith(".cognitiveservices.azure.com"),X=w.pathname.replace(/\/+$/,"");if(W&&(X===""||X==="/"||X==="/openai"))w.pathname="/openai/v1",w.search="";return w.toString().replace(/\/+$/,"")}function O(G){return`https://${G}.openai.azure.com/openai/v1`}function h(G,Q){let w=Q?.azureApiVersion||process.env.AZURE_OPENAI_API_VERSION||j,W=Q?.azureBaseUrl?.trim()||process.env.AZURE_OPENAI_BASE_URL?.trim()||void 0,X=Q?.azureResourceName||process.env.AZURE_OPENAI_RESOURCE_NAME,J=W;if(!J&&X)J=O(X);if(!J&&G.baseUrl)J=G.baseUrl;if(!J)throw Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return{baseUrl:P(J),apiVersion:w}}function z(G,Q,w){let W={...G.headers};if(w?.headers)Object.assign(W,w.headers);let{baseUrl:X,apiVersion:J}=h(G,w);return new Z({apiKey:Q,apiVersion:J,dangerouslyAllowBrowser:!0,defaultHeaders:W,baseURL:X})}function b(G,Q,w,W){let X=S(G,Q,E),J={model:W,input:X,stream:!0,prompt_cache_key:D(w?.sessionId)};if(w?.maxTokens)J.max_output_tokens=w?.maxTokens;if(w?.temperature!==void 0)J.temperature=w?.temperature;if(Q.tools&&Q.tools.length>0)J.tools=T(Q.tools);if(G.reasoning){if(w?.reasoningEffort||w?.reasoningSummary){let Y=w?.reasoningEffort?G.thinkingLevelMap?.[w.reasoningEffort]??w.reasoningEffort:"medium";J.reasoning={effort:Y,summary:w?.reasoningSummary||"auto"},J.include=["reasoning.encrypted_content"]}else if(G.thinkingLevelMap?.off!==null)J.reasoning={effort:G.thinkingLevelMap?.off??"none"}}return J}export{c as streamSimpleAzureOpenAIResponses,I as streamAzureOpenAIResponses};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{J as
|
|
1
|
+
import{Gg as B,zg as F}from"./chunk-dsnnmmd9.js";var J=F((w,D)=>({metadata:{},isLoading:!1,error:null,fetchMetadata:async(A)=>{w({isLoading:!0,error:null});try{let h=await B.api.teams[":teamId"]["user-metadata"].$get({param:{teamId:A}});if(!h.ok)throw Error("failed to fetch user metadata");let C=(await h.json()).reduce((j,E)=>{return j[E.key]=E.value,j},{});w({metadata:C,isLoading:!1})}catch(h){w({error:h instanceof Error?h.message:String(h),isLoading:!1})}},setMetadata:async(A,h,q)=>{let C=D().metadata;w((j)=>({metadata:{...j.metadata,[h]:q}}));try{if(!(await B.api.teams[":teamId"]["user-metadata"][":key"].$put({param:{teamId:A,key:h},json:{value:q}})).ok)throw Error("failed to update user metadata")}catch(j){w({metadata:C}),console.error(j)}},getMetadata:(A,h)=>{let q=D().metadata[A];return q!==void 0?q:h}}));
|
|
2
|
+
export{J as Lf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v}from"./chunk-qzgkshc5.js";import"./chunk-n2n6etpd.js";import"./chunk-abm6b5hq.js";import"./chunk-s3eadfmq.js";import"./chunk-fybr479k.js";import"./chunk-62rqa4dq.js";import"./chunk-314ncj75.js";import"./chunk-f9v92x1z.js";import"./chunk-kqgfhhk4.js";import"./chunk-wsnrv2aa.js";import"./chunk-t1sv4zdb.js";import"./chunk-q9zn84ms.js";import"./chunk-dfsfh3pw.js";import"./chunk-by6reed2.js";import"./chunk-zyhr9ajx.js";import"./chunk-4ddrkmxq.js";import"./chunk-fjhbwem5.js";import"./chunk-qedhje78.js";import"./chunk-45yzs9sh.js";import"./chunk-5a2maxwp.js";import"./chunk-e2ekkk1h.js";import"./chunk-mxwnzxmd.js";import"./chunk-e1gzv3p0.js";import{dg as k,ug as q}from"./chunk-dsnnmmd9.js";import"./chunk-kbzm1pwx.js";function B(){let{shareId:w,folderId:A}=C.useParams();return k(v,{shareId:w,initialFolderId:A})}var C=q("/share/$shareId/folders/$folderId")({component:B});export{C as Route};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{zj as J}from"./chunk-a5kfa0k9.js";import{Ej as w}from"./chunk-1fpqq6ed.js";import{Uj as R}from"./chunk-08m8mzfa.js";import{Vj as j}from"./chunk-3rajscaz.js";import{Yj as V}from"./chunk-eadb78m8.js";function M(Q,E){let W={v:1,id:Q};if(E)W.phase=E;return JSON.stringify(W)}function C(Q){if(!Q)return;if(Q.startsWith("{"))try{let E=JSON.parse(Q);if(E.v===1&&typeof E.id==="string"){if(E.phase==="commentary"||E.phase==="final_answer")return{id:E.id,phase:E.phase};return{id:E.id}}}catch{}return{id:Q}}function x(Q,E,W,U){let _=[],N=(G)=>{let O=G.replace(/[^a-zA-Z0-9_-]/g,"_");return(O.length>64?O.slice(0,64):O).replace(/_+$/,"")},A=(G)=>{let O=`fc_${J(G)}`;return O.length>64?O.slice(0,64):O},y=(G,O,Y)=>{if(!W.has(Q.provider))return N(G);if(!G.includes("|"))return N(G);let[H,L]=G.split("|"),$=N(H),D=Y.provider!==Q.provider||Y.api!==Q.api?A(L):N(L);if(!D.startsWith("fc_"))D=N(`fc_${D}`);return`${$}|${D}`},Z=R(E.messages,Q,y);if((U?.includeSystemPrompt??!0)&&E.systemPrompt){let G=Q.reasoning?"developer":"system";_.push({role:G,content:V(E.systemPrompt)})}let q=0;for(let G of Z){if(G.role==="user")if(typeof G.content==="string")_.push({role:"user",content:[{type:"input_text",text:V(G.content)}]});else{let O=G.content.map((Y)=>{if(Y.type==="text")return{type:"input_text",text:V(Y.text)};return{type:"input_image",detail:"auto",image_url:`data:${Y.mimeType};base64,${Y.data}`}});if(O.length===0)continue;_.push({role:"user",content:O})}else if(G.role==="assistant"){let O=[],Y=G,H=Y.model!==Q.id&&Y.provider===Q.provider&&Y.api===Q.api,L=0;for(let $ of G.content)if($.type==="thinking"){if($.thinkingSignature){let X=JSON.parse($.thinkingSignature);O.push(X)}}else if($.type==="text"){let X=$,D=C(X.textSignature),f=L===0?`msg_pi_${q}`:`msg_pi_${q}_${L}`;L++;let F=D?.id;if(!F)F=f;else if(F.length>64)F=`msg_${J(F)}`;O.push({type:"message",role:"assistant",content:[{type:"output_text",text:V(X.text),annotations:[]}],status:"completed",id:F,phase:D?.phase})}else if($.type==="toolCall"){let X=$,[D,f]=X.id.split("|"),F=f;if(H&&F?.startsWith("fc_"))F=void 0;O.push({type:"function_call",id:F,call_id:D,name:X.name,arguments:JSON.stringify(X.arguments)})}if(O.length===0)continue;_.push(...O)}else if(G.role==="toolResult"){let O=G.content.filter((X)=>X.type==="text").map((X)=>X.text).join(`
|
|
3
3
|
`),Y=G.content.some((X)=>X.type==="image"),H=O.length>0,[L]=G.toolCallId.split("|"),$;if(Y&&Q.input.includes("image")){let X=[];if(H)X.push({type:"input_text",text:V(O)});for(let D of G.content)if(D.type==="image")X.push({type:"input_image",detail:"auto",image_url:`data:${D.mimeType};base64,${D.data}`});$=X}else $=V(H?O:"(see attached image)");_.push({type:"function_call_output",call_id:L,output:$})}q++}return _}function v(Q,E){let W=E?.strict===void 0?!1:E.strict;return Q.map((U)=>({type:"function",name:U.name,description:U.description,parameters:U.parameters,strict:W}))}async function B(Q,E,W,U,_){let N=null,A=null,y=E.content,Z=()=>y.length-1;for await(let K of Q)if(K.type==="response.created")E.responseId=K.response.id;else if(K.type==="response.output_item.added"){let q=K.item;if(q.type==="reasoning")N=q,A={type:"thinking",thinking:""},E.content.push(A),W.push({type:"thinking_start",contentIndex:Z(),partial:E});else if(q.type==="message")N=q,A={type:"text",text:""},E.content.push(A),W.push({type:"text_start",contentIndex:Z(),partial:E});else if(q.type==="function_call")N=q,A={type:"toolCall",id:`${q.call_id}|${q.id}`,name:q.name,arguments:{},partialJson:q.arguments||""},E.content.push(A),W.push({type:"toolcall_start",contentIndex:Z(),partial:E})}else if(K.type==="response.reasoning_summary_part.added"){if(N&&N.type==="reasoning")N.summary=N.summary||[],N.summary.push(K.part)}else if(K.type==="response.reasoning_summary_text.delta"){if(N?.type==="reasoning"&&A?.type==="thinking"){N.summary=N.summary||[];let q=N.summary[N.summary.length-1];if(q)A.thinking+=K.delta,q.text+=K.delta,W.push({type:"thinking_delta",contentIndex:Z(),delta:K.delta,partial:E})}}else if(K.type==="response.reasoning_summary_part.done"){if(N?.type==="reasoning"&&A?.type==="thinking"){N.summary=N.summary||[];let q=N.summary[N.summary.length-1];if(q)A.thinking+=`
|
|
4
4
|
|
|
5
5
|
`,q.text+=`
|
|
@@ -11,4 +11,4 @@ import{tj as J}from"./chunk-d9haskf5.js";import{yj as w}from"./chunk-30jjvb4k.js
|
|
|
11
11
|
`)||"",O=q.content?.map((Y)=>Y.text).join(`
|
|
12
12
|
|
|
13
13
|
`)||"";A.thinking=G||O||A.thinking,A.thinkingSignature=JSON.stringify(q),W.push({type:"thinking_end",contentIndex:Z(),content:A.thinking,partial:E}),A=null}else if(q.type==="message"&&A?.type==="text")A.text=q.content.map((G)=>G.type==="output_text"?G.text:G.refusal).join(""),A.textSignature=M(q.id,q.phase??void 0),W.push({type:"text_end",contentIndex:Z(),content:A.text,partial:E}),A=null;else if(q.type==="function_call"){let G=A?.type==="toolCall"&&A.partialJson?w(A.partialJson):w(q.arguments||"{}"),O;if(A?.type==="toolCall")A.arguments=G,delete A.partialJson,O=A;else O={type:"toolCall",id:`${q.call_id}|${q.id}`,name:q.name,arguments:G};A=null,W.push({type:"toolcall_end",contentIndex:Z(),toolCall:O,partial:E})}}else if(K.type==="response.completed"){let q=K.response;if(q?.id)E.responseId=q.id;if(q?.usage){let G=q.usage.input_tokens_details?.cached_tokens||0;E.usage={input:(q.usage.input_tokens||0)-G,output:q.usage.output_tokens||0,cacheRead:G,cacheWrite:0,totalTokens:q.usage.total_tokens||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}if(j(U,E.usage),_?.applyServiceTierPricing){let G=_.resolveServiceTier?_.resolveServiceTier(q?.service_tier,_.serviceTier):q?.service_tier??_.serviceTier;_.applyServiceTierPricing(E.usage,G)}if(E.stopReason=T(q?.status),E.content.some((G)=>G.type==="toolCall")&&E.stopReason==="stop")E.stopReason="toolUse"}else if(K.type==="error")throw Error(`Error Code ${K.code}: ${K.message}`||"Unknown error");else if(K.type==="response.failed"){let q=K.response?.error,G=K.response?.incomplete_details,O=q?`${q.code||"unknown"}: ${q.message||"no message"}`:G?.reason?`incomplete: ${G.reason}`:"Unknown error (no error details in response)";throw Error(O)}}function T(Q){if(!Q)return"stop";switch(Q){case"completed":return"stop";case"incomplete":return"length";case"failed":case"cancelled":return"error";case"in_progress":case"queued":return"stop";default:throw Error(`Unhandled stop reason: ${Q}`)}}
|
|
14
|
-
export{x as
|
|
14
|
+
export{x as wj,v as xj,B as yj};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as S}from"./chunk-s3eadfmq.js";import{Q as Jz,R as Xz,S as Yz,T as Zz,U as _z}from"./chunk-314ncj75.js";import{Va as $z}from"./chunk-kqgfhhk4.js";import{Xa as A}from"./chunk-wsnrv2aa.js";import{nf as H}from"./chunk-fjhbwem5.js";import{Jf as zz}from"./chunk-qedhje78.js";import{Zf as Gz}from"./chunk-e1gzv3p0.js";import{Fh as b,Gg as a,Pg as n,Ri as B,Yg as r,_g as o,ai as e,bg as Hz,cg as M,dg as z,dh as R,eg as J,eh as t,hg as c,jh as f,jj as Y,oi as h,xi as s}from"./chunk-dsnnmmd9.js";import{Zj as Fz}from"./chunk-kbzm1pwx.js";var _=Fz(Hz(),1);function Sz({projectId:P,contextAssetId:v}){let{isHistoryMode:U,setIsHistoryMode:u,currentSessionId:qz,chatAssets:p,removeAsset:Kz,messages:D,historySessions:I,isStreaming:O,fetchHistorySessions:g,loadSession:Qz,deleteSession:Uz,startNewSession:Vz,sendMessage:Wz,abortActiveSession:Lz,selectedAgentId:E,setSelectedAgentId:T}=H(),{teamId:Z,ensureTeamIdForProject:l}=Gz();_.useEffect(()=>{if(P)l(P)},[P,l]);let{data:Nz=[]}=c({queryKey:["agents",Z],queryFn:async()=>{if(!Z)return[];let G=await a.api.teams[":teamId"].agents.$get({param:{teamId:Z}});if(!G.ok)throw Error("failed to fetch agents");return G.json()},enabled:!!Z}),C=Nz.filter((G)=>G.type==="chat"&&G.enabled);_.useEffect(()=>{if(C.length>0){if(!C.some((X)=>X.id===E))T(C[0].id)}},[C,E,T]);let[F,m]=_.useState(""),j=_.useRef(null),y=_.useRef(null),w=_.useRef(!0),k=_.useRef(!0);_.useEffect(()=>{k.current=!0,w.current=!0},[P,v,U]),_.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let{scrollTop:X,isAtBottom:$}=H.getState(),Q=setTimeout(()=>{if($)G.scrollTop=G.scrollHeight;else G.scrollTop=X;let L=setTimeout(()=>{k.current=!1},50);return()=>clearTimeout(L)},0);return()=>clearTimeout(Q)},[P,v,U]),_.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let X=()=>{if(k.current)return;let $=G.scrollTop,Q=G.scrollHeight-$-G.clientHeight<10;H.getState().setScrollState($,Q)};return G.addEventListener("scroll",X),()=>{G.removeEventListener("scroll",X)}},[P,v,U]);let{ref:Pz,isDropTarget:Oz}=$z({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});_.useEffect(()=>{if(!U){let{isAtBottom:G}=H.getState();if(G||O){let X=w.current?"auto":"smooth";j.current?.scrollIntoView({behavior:X})}w.current=!1}},[D,O,U]),_.useEffect(()=>{if(U&&Z)g(Z)},[U,g,Z]);let d=()=>{if(!F.trim()||O||!Z)return;Wz(Z,F,P,v),m("")},Dz=(G)=>{if(G.nativeEvent.isComposing)return;if(G.key==="Enter"&&!G.shiftKey)G.preventDefault(),d()},i=(G)=>{if(typeof G==="string")return G;if(Array.isArray(G))return G.map((X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"&&"type"in X&&X.type==="text"&&"text"in X)return String(X.text);return""}).join("");return""},x=(G)=>{return G.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:")},Cz=(G)=>{switch(G.role){case"user":return z("div",{className:"flex justify-end w-full",children:z("div",{className:"bg-primary text-primary-foreground rounded-lg px-3 py-2 max-w-[85%] text-sm whitespace-pre-wrap shadow-xs break-words",children:i(G.content)})},G.id);case"assistant":{let $=G.content;if(!$)return null;let Q=[];if($.forEach((q,V)=>{if(!q||typeof q!=="object")return;let W=q;switch(W.type){case"text":{let K=W.text;if(typeof K!=="string"||!K.trim())return;Q.push(z("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:z(S,{components:{pre:({node:N,...Ez})=>z("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...Ez})},children:x(K)})},`txt-${V}`));break}case"thinking":{let K=W.thinking;if(typeof K!=="string"||!K.trim())return;Q.push(J("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(t,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),z("span",{children:Y.role_thinking()||"Thinking"}),z(f,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),z("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:z(S,{children:x(K)})})]},`think-${V}`));break}case"toolCall":{let K=String(W.name||W.toolName||Y.unknown()),N=W.arguments||W.args;Q.push(J("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(s,{className:"h-3.5 w-3.5"}),z("span",{children:Y.calling_tool()}),z("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:K}),z(f,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!N&&J("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[z("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:Y.tool_arguments()||"Arguments"}),z("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(N,null,2)})]})]},`tool-${V}`));break}case"image":{let K=String(W.mimeType||"image/png"),N=String(W.data||"");Q.push(z("div",{className:"my-2 max-w-full",children:N?z("img",{src:N.startsWith("data:")?N:`data:${K};base64,${N}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):z("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:Y.image_object()})},`img-${V}`));break}default:{let K=JSON.stringify(q,null,2);if(K==="{}")return;Q.push(z("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:K},`other-${V}`))}}}),Q.length===0)return null;let L=!1;if($.length>0){let q=$[$.length-1];if(typeof q==="string"&&q.trim().length>0)L=!0;else if(q&&typeof q==="object"){let V=q;if(V.type==="text"&&typeof V.text==="string"&&V.text.trim().length>0)L=!0}}return J("div",{className:"flex flex-col w-full space-y-1",children:[z("div",{className:"space-y-2 w-full",children:Q}),L&&z("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:Y.created_by_agent()})]},G.id)}case"toolResult":return z("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:z("span",{className:"font-semibold",children:Y.tool_result_with_name({name:G.toolName||"tool"})})},G.id);case"thinking_level_change":case"custom":{let X=G;if(X.customType==="context_display_info"){let L=X.details?.assets||[];if(L.length===0)return null;return J("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[z("div",{className:"font-semibold",children:Y.assets_added_to_context()}),z("ul",{className:"list-disc list-inside space-y-0.5",children:L.map((q)=>J("li",{className:"truncate",children:[q.name," ",J("span",{className:"text-muted-foreground/70",children:["(",q.type,")"]})]},q.id))})]},G.id)}let $=X.content||"";return z("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:i($)},G.id)}default:return null}};return J("div",{ref:Pz,className:B("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Oz&&z("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:J("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[z(R,{className:"h-6 w-6 text-primary animate-bounce"}),z("span",{className:"text-sm font-semibold text-foreground",children:Y.chatbot_drag_drop_hint()||"Drop assets here"})]})}),z("div",{className:"flex items-center justify-between p-4 pt-[0.7rem] flex-shrink-0",children:U?J(M,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.history()})}),z("button",{onClick:()=>u(!1),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:"Close History",children:z(r,{className:"h-4 w-4"})})]}):J(M,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.shumai_agent()})}),J("div",{className:"flex items-center gap-1",children:[z("button",{onClick:Vz,className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.new_chat(),children:z(e,{className:"h-4 w-4"})}),z("button",{onClick:()=>u(!0),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.history(),children:z(b,{className:"h-4 w-4"})})]})]})}),U?z(A,{className:"flex-1 p-4 min-h-0",children:I.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground p-4 text-center",children:[z(b,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.no_history_sessions()})]}):z("div",{className:"space-y-2 pb-4",children:I.map((G)=>{let X=G.id===qz;return J("div",{className:B("group relative flex items-center justify-between p-3 border rounded-lg transition-all cursor-pointer bg-card",X?"border-primary":"border-border hover:bg-accent/30"),children:[J("div",{onClick:()=>Z&&Qz(Z,G.id),className:"flex-1 min-w-0 pr-6",children:[z("div",{className:"text-sm font-semibold text-foreground truncate",children:G.name||Y.new_chat()}),z("div",{className:"text-xs text-muted-foreground mt-0.5",children:zz(G.createdAt)})]}),z("button",{onClick:($)=>{if($.stopPropagation(),Z&&confirm(Y.delete_session_confirm()))Uz(Z,G.id)},className:"absolute right-3 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted",title:"Delete Session",children:z(h,{className:"h-4 w-4"})})]},G.id)})})}):J(M,{children:[z(A,{ref:y,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:D.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[z(R,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.chatbot_drag_drop_hint()})]}):J("div",{className:"space-y-4 pb-4",children:[D.map(Cz),O&&D.length>0&&D[D.length-1].role==="user"&&J("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[z(n,{className:"h-3 w-3 animate-spin text-primary"}),z("span",{children:"Thinking..."})]}),z("div",{ref:j})]})}),z("div",{className:"p-2 flex-shrink-0 bg-background",children:J("div",{className:"relative flex flex-col w-full border border-foreground/20 rounded-2xl shadow-xs transition-all duration-200 focus-within:ring-2 focus-within:ring-primary focus-within:border-transparent bg-background overflow-hidden",children:[p.length>0&&z("div",{className:"flex flex-col gap-1.5 min-h-0 max-h-[160px] overflow-y-auto border-b border-border bg-muted/5 p-3 divide-y divide-border/50",children:p.map((G)=>J("div",{className:"flex items-center justify-between py-1.5 text-xs group",children:[J("div",{className:"flex items-baseline gap-1.5 min-w-0 pr-2",children:[z("span",{className:"truncate font-medium text-foreground",children:G.name}),z("span",{className:"text-[9px] text-muted-foreground uppercase flex-shrink-0",children:G.type})]}),z("button",{onClick:()=>Kz(G.id),className:"text-muted-foreground hover:text-destructive transition-colors p-0.5",title:Y.remove_from_context(),children:z(h,{className:"h-3.5 w-3.5"})})]},G.id))}),z("textarea",{value:F,onChange:(G)=>m(G.target.value),onKeyDown:Dz,placeholder:"Type a message...",rows:2,className:"w-full bg-transparent border-none focus:ring-0 focus:outline-hidden resize-none min-h-[44px] max-h-[120px] px-3 py-2 text-sm focus-visible:outline-hidden focus:ring-transparent focus:border-transparent focus-visible:ring-0",disabled:O}),J("div",{className:"flex justify-between items-center px-3 pb-2 pt-1",children:[z("div",{className:"flex items-center gap-1.5 min-w-0 max-w-[70%]",children:C.length>0?J(Jz,{value:E||"",onValueChange:(G)=>T(G),disabled:O,children:[z(Yz,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full",children:z(Xz,{placeholder:Y.select_agent()})}),z(Zz,{children:C.map((G)=>z(_z,{value:G.id,children:J("div",{className:"flex items-center gap-2",children:[G.avatar?z("img",{src:G.avatar,alt:G.name,className:"w-4 h-4 rounded-full object-cover"}):z(R,{className:"w-4 h-4 text-muted-foreground"}),z("span",{className:"text-xs",children:G.name})]})},G.id))})]}):z("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:z("span",{children:Y.no_chat_agents_warning()})})}),O?z("button",{onClick:()=>{if(Z)Lz(Z)},className:"p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm bg-destructive text-destructive-foreground hover:bg-destructive/90 transform hover:-translate-y-0.5",title:"Stop generation",children:z("div",{className:"h-4 w-4 flex items-center justify-center",children:z("div",{className:"h-3 w-3 bg-current rounded-[2px] bg-white"})})}):z("button",{onClick:d,disabled:!F.trim()||!E,className:B("p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm",F.trim()&&E?"bg-primary text-primary-foreground hover:bg-primary/95 transform hover:-translate-y-0.5":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:z(o,{className:"h-4 w-4"})})]})]})})]})]})}
|
|
2
|
+
export{Sz as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{lb as T,mb as C,nb as L}from"./chunk-2vs3evc7.js";import"./chunk-dypsm6m2.js";import{pb as S}from"./chunk-9n0etqsy.js";import{qb as M}from"./chunk-7ddaxdpf.js";import{xb as D}from"./chunk-0at8vxt5.js";import"./chunk-22dje1f5.js";import"./chunk-wv4fe1fj.js";import{je as V,ke as f}from"./chunk-7rhjej0x.js";import{le as F}from"./chunk-n6jgyv4y.js";import{Cj as k}from"./chunk-w4y97tzy.js";import"./chunk-yhj8c5re.js";import"./chunk-kbzm1pwx.js";var B="v1",E=new Set(["openai","openai-codex","opencode","azure-openai-responses"]);function I(G){let Q=new Map;if(!G)return Q;for(let w of G.split(",")){let W=w.trim();if(!W)continue;let[X,J]=W.split("=",2);if(!X||!J)continue;Q.set(X.trim(),J.trim())}return Q}function P(G,Q){if(Q?.azureDeploymentName)return Q.azureDeploymentName;return I(process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(G.id)||G.id}function g(G){if(G instanceof Error){let Q=G.status,w=typeof Q==="number"?Q:void 0;if(w!==void 0)return`Azure OpenAI API error (${w}): ${G.message}`;return G.message}try{return JSON.stringify(G)}catch{return String(G)}}var O=(G,Q,w)=>{let W=new f;return(async()=>{let X=P(G,w),J={role:"assistant",content:[],api:"azure-openai-responses",provider:G.provider,model:G.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 Y=w?.apiKey||F(G.provider)||"",$=K(G,Y,w),q=N(G,Q,w,X),H=await w?.onPayload?.(q,G);if(H!==void 0)q=H;let _={...w?.signal?{signal:w.signal}:{},...w?.timeoutMs!==void 0?{timeout:w.timeoutMs}:{},...w?.maxRetries!==void 0?{maxRetries:w.maxRetries}:{}},{data:j,response:Z}=await $.responses.create(q,_).withResponse();if(await w?.onResponse?.({status:Z.status,headers:M(Z.headers)},G),W.push({type:"start",partial:J}),await L(j,J,W,G),w?.signal?.aborted)throw Error("Request was aborted");if(J.stopReason==="aborted"||J.stopReason==="error")throw Error("An unknown error occurred");W.push({type:"done",reason:J.stopReason,message:J}),W.end()}catch(Y){for(let $ of J.content)delete $.index,delete $.partialJson;J.stopReason=w?.signal?.aborted?"aborted":"error",J.errorMessage=g(Y),W.push({type:"error",reason:J.stopReason,error:J}),W.end()}})(),W},d=(G,Q,w)=>{let W=w?.apiKey||F(G.provider);if(!W)throw Error(`No API key for provider: ${G.provider}`);let X=D(G,w,W),J=w?.reasoning?V(G,w.reasoning):void 0;return O(G,Q,{...X,reasoningEffort:J==="off"?void 0:J})};function h(G){let Q=G.trim().replace(/\/+$/,""),w;try{w=new URL(Q)}catch{throw Error(`Invalid Azure OpenAI base URL: ${G}`)}let W=w.hostname.endsWith(".openai.azure.com")||w.hostname.endsWith(".cognitiveservices.azure.com"),X=w.pathname.replace(/\/+$/,"");if(W&&(X===""||X==="/"||X==="/openai"))w.pathname="/openai/v1",w.search="";return w.toString().replace(/\/+$/,"")}function z(G){return`https://${G}.openai.azure.com/openai/v1`}function b(G,Q){let w=Q?.azureApiVersion||process.env.AZURE_OPENAI_API_VERSION||B,W=Q?.azureBaseUrl?.trim()||process.env.AZURE_OPENAI_BASE_URL?.trim()||void 0,X=Q?.azureResourceName||process.env.AZURE_OPENAI_RESOURCE_NAME,J=W;if(!J&&X)J=z(X);if(!J&&G.baseUrl)J=G.baseUrl;if(!J)throw Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return{baseUrl:h(J),apiVersion:w}}function K(G,Q,w){if(!Q){if(!process.env.AZURE_OPENAI_API_KEY)throw Error("Azure OpenAI API key is required. Set AZURE_OPENAI_API_KEY environment variable or pass it as an argument.");Q=process.env.AZURE_OPENAI_API_KEY}let W={...G.headers};if(w?.headers)Object.assign(W,w.headers);let{baseUrl:X,apiVersion:J}=b(G,w);return new k({apiKey:Q,apiVersion:J,dangerouslyAllowBrowser:!0,defaultHeaders:W,baseURL:X})}function N(G,Q,w,W){let X=T(G,Q,E),J={model:W,input:X,stream:!0,prompt_cache_key:S(w?.sessionId)};if(w?.maxTokens)J.max_output_tokens=w?.maxTokens;if(w?.temperature!==void 0)J.temperature=w?.temperature;if(Q.tools&&Q.tools.length>0)J.tools=C(Q.tools);if(G.reasoning){if(w?.reasoningEffort||w?.reasoningSummary){let Y=w?.reasoningEffort?G.thinkingLevelMap?.[w.reasoningEffort]??w.reasoningEffort:"medium";J.reasoning={effort:Y,summary:w?.reasoningSummary||"auto"},J.include=["reasoning.encrypted_content"]}else if(G.thinkingLevelMap?.off!==null)J.reasoning={effort:G.thinkingLevelMap?.off??"none"}}return J}export{d as streamSimpleAzureOpenAIResponses,O as streamAzureOpenAIResponses};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{B as
|
|
1
|
+
import{Uf as A}from"./chunk-dh4tbp68.js";import{Gg as z,dg as v,tg as w}from"./chunk-dsnnmmd9.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
|
|
2
|
+
export{B as we,H as xe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-xg9xscqz.js";import{
|
|
2
|
+
import"./chunk-xg9xscqz.js";import{Vb as I,lc as w}from"./chunk-ac2ky3q0.js";import"./chunk-kbzm1pwx.js";function R(q,$){if(typeof q==="string"&&typeof $==="string")return q.toLowerCase()===$.toLowerCase();return q===$}function y(q,$){if(typeof q!=="string")return $.includes(q);return $.some((E)=>typeof E==="string"&&q.toLowerCase()===E.toLowerCase())}function j(q,$){return!y(q,$)}function g(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().includes($.toLowerCase())}function f(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().startsWith($.toLowerCase())}function V(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().endsWith($.toLowerCase())}var v=(q,$)=>{let E=null,M=w({config:{adapterId:"memory",adapterName:"Memory Adapter",usePlural:!1,debugLogs:$?.debugLogs||!1,supportsArrays:!0,customTransformInput(P){if(P.options.advanced?.database?.generateId==="serial"&&P.field==="id"&&P.action==="create")return q[P.model].length+1;return P.data},transaction:async(P)=>{let A=structuredClone(q);try{return await P(M(E))}catch(_){throw Object.keys(q).forEach((S)=>{q[S]=A[S]}),_}}},adapter:({getFieldName:P,getDefaultFieldName:A,options:_,getModelName:S})=>{let N=(x,K,Y)=>{if(!K)return x;return x.sort((L,Z)=>{let z=P({model:Y,field:K.field}),D=L[z],X=Z[z],Q=0;if(D==null&&X==null)Q=0;else if(D==null)Q=-1;else if(X==null)Q=1;else if(typeof D==="string"&&typeof X==="string")Q=D.localeCompare(X);else if(D instanceof Date&&X instanceof Date)Q=D.getTime()-X.getTime();else if(typeof D==="number"&&typeof X==="number")Q=D-X;else if(typeof D==="boolean"&&typeof X==="boolean")Q=D===X?0:D?1:-1;else Q=String(D).localeCompare(String(X));return K.direction==="asc"?Q:-Q})};function F(x,K,Y,L){let Z=(()=>{let X=q[K];if(!X)throw I.error(`[MemoryAdapter] Model ${K} not found in the DB`,Object.keys(q)),Error(`Model ${K} not found`);let Q=(G,O)=>{let{field:J,value:H,operator:B,mode:k="sensitive"}=O,U=k==="insensitive"&&(typeof H==="string"||Array.isArray(H)&&H.every((W)=>typeof W==="string"));switch(B){case"in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return y(G[J],H);return H.includes(G[J]);case"not_in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return j(G[J],H);return!H.includes(G[J]);case"contains":if(U)return g(G[J],H);return G[J]?.includes(H);case"starts_with":if(U)return f(G[J],H);return G[J].startsWith(H);case"ends_with":if(U)return V(G[J],H);return G[J].endsWith(H);case"ne":return U?!R(G[J],H):G[J]!==H;case"gt":return H!=null&&Boolean(G[J]>H);case"gte":return H!=null&&Boolean(G[J]>=H);case"lt":return H!=null&&Boolean(G[J]<H);case"lte":return H!=null&&Boolean(G[J]<=H);default:if(U)return R(G[J],H);if(H===null)return G[J]==null;return G[J]===H}},T=X.filter((G)=>{if(!x.length||x.length===0)return!0;let O=Q(G,x[0]);for(let J of x){let H=Q(G,J);if(J.connector==="OR")O=O||H;else O=O&&H}return O});if(L?.length&&L.length>0)T=T.map((G)=>Object.fromEntries(Object.entries(G).filter(([O])=>L.includes(A({model:K,field:O})))));return T})();if(!Y)return Z;let z=new Map,D=new Map;for(let X of Z){let Q=String(X.id);if(!z.has(Q)){let G={...X};for(let[O,J]of Object.entries(Y)){let H=S(O);if(J.relation==="one-to-one")G[H]=null;else G[H]=[],D.set(`${Q}-${O}`,new Set)}z.set(Q,G)}let T=z.get(Q);for(let[G,O]of Object.entries(Y)){let J=S(G),H=q[J];if(!H)throw I.error(`[MemoryAdapter] JoinOption model ${J} not found in the DB`,Object.keys(q)),Error(`JoinOption model ${J} not found`);let B=H.filter((k)=>k[O.on.to]===X[O.on.from]);if(O.relation==="one-to-one")T[J]=B[0]||null;else{let k=D.get(`${Q}-${G}`),U=O.limit??100,W=0;for(let C of B){if(W>=U)break;if(!k.has(C.id))T[J].push(C),k.add(C.id),W++}}}}return Array.from(z.values())}return{create:async({model:x,data:K})=>{if(_.advanced?.database?.generateId==="serial")K.id=q[S(x)].length+1;if(!q[x])q[x]=[];return q[x].push(K),K},findOne:async({model:x,where:K,select:Y,join:L})=>{let Z=F(K,x,L,Y);if(L){let z=Z;if(!z.length)return null;return z[0]}return Z[0]||null},findMany:async({model:x,where:K,sortBy:Y,limit:L,select:Z,offset:z,join:D})=>{let X=F(K||[],x,D,Z);if(D){let T=X;if(!T.length)return[];N(T,Y,x);let G=T;if(z!==void 0)G=G.slice(z);if(L!==void 0)G=G.slice(0,L);return G}let Q=N(X,Y,x);if(z!==void 0)Q=Q.slice(z);if(L!==void 0)Q=Q.slice(0,L);return Q||[]},count:async({model:x,where:K})=>{if(K)return F(K,x).length;return q[x].length},update:async({model:x,where:K,update:Y})=>{let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null},delete:async({model:x,where:K})=>{let Y=q[x],L=F(K,x);q[x]=Y.filter((Z)=>!L.includes(Z))},deleteMany:async({model:x,where:K})=>{let Y=q[x],L=F(K,x),Z=0;return q[x]=Y.filter((z)=>{if(L.includes(z))return Z++,!1;return!L.includes(z)}),Z},consumeOne:async({model:x,where:K})=>{let Y=q[x],L=F(K,x)[0];if(!L)return null;return q[x]=Y.filter((Z)=>Z!==L),L},updateMany({model:x,where:K,update:Y}){let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null}}}});return(P)=>{return E=P,M(P)}};export{v as memoryAdapter};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ob as f}from"./chunk-dypsm6m2.js";import{zb as j}from"./chunk-0at8vxt5.js";import{Ab as U}from"./chunk-22dje1f5.js";import{ge as H}from"./chunk-wv4fe1fj.js";import{ie as J}from"./chunk-7rhjej0x.js";function M(Q,E){let W={v:1,id:Q};if(E)W.phase=E;return JSON.stringify(W)}function R(Q){if(!Q)return;if(Q.startsWith("{"))try{let E=JSON.parse(Q);if(E.v===1&&typeof E.id==="string"){if(E.phase==="commentary"||E.phase==="final_answer")return{id:E.id,phase:E.phase};return{id:E.id}}}catch{}return{id:Q}}function b(Q,E,W,L){let D=[],N=(G)=>{let O=G.replace(/[^a-zA-Z0-9_-]/g,"_");return(O.length>64?O.slice(0,64):O).replace(/_+$/,"")},A=(G)=>{let O=`fc_${f(G)}`;return O.length>64?O.slice(0,64):O},w=(G,O,X)=>{if(!W.has(Q.provider))return N(G);if(!G.includes("|"))return N(G);let[V,F]=G.split("|"),$=N(V),Y=X.provider!==Q.provider||X.api!==Q.api?A(F):N(F);if(!Y.startsWith("fc_"))Y=N(`fc_${Y}`);return`${$}|${Y}`},Z=j(E.messages,Q,w);if((L?.includeSystemPrompt??!0)&&E.systemPrompt){let G=Q.reasoning?"developer":"system";D.push({role:G,content:U(E.systemPrompt)})}let q=0;for(let G of Z){if(G.role==="user")if(typeof G.content==="string")D.push({role:"user",content:[{type:"input_text",text:U(G.content)}]});else{let O=G.content.map((X)=>{if(X.type==="text")return{type:"input_text",text:U(X.text)};return{type:"input_image",detail:"auto",image_url:`data:${X.mimeType};base64,${X.data}`}});if(O.length===0)continue;D.push({role:"user",content:O})}else if(G.role==="assistant"){let O=[],X=G,V=X.model!==Q.id&&X.provider===Q.provider&&X.api===Q.api;for(let F of G.content)if(F.type==="thinking"){if(F.thinkingSignature){let $=JSON.parse(F.thinkingSignature);O.push($)}}else if(F.type==="text"){let $=F,_=R($.textSignature),Y=_?.id;if(!Y)Y=`msg_${q}`;else if(Y.length>64)Y=`msg_${f(Y)}`;O.push({type:"message",role:"assistant",content:[{type:"output_text",text:U($.text),annotations:[]}],status:"completed",id:Y,phase:_?.phase})}else if(F.type==="toolCall"){let $=F,[_,Y]=$.id.split("|"),y=Y;if(V&&y?.startsWith("fc_"))y=void 0;O.push({type:"function_call",id:y,call_id:_,name:$.name,arguments:JSON.stringify($.arguments)})}if(O.length===0)continue;D.push(...O)}else if(G.role==="toolResult"){let O=G.content.filter((_)=>_.type==="text").map((_)=>_.text).join(`
|
|
3
3
|
`),X=G.content.some((_)=>_.type==="image"),V=O.length>0,[F]=G.toolCallId.split("|"),$;if(X&&Q.input.includes("image")){let _=[];if(V)_.push({type:"input_text",text:U(O)});for(let Y of G.content)if(Y.type==="image")_.push({type:"input_image",detail:"auto",image_url:`data:${Y.mimeType};base64,${Y.data}`});$=_}else $=U(V?O:"(see attached image)");D.push({type:"function_call_output",call_id:F,output:$})}q++}return D}function x(Q,E){let W=E?.strict===void 0?!1:E.strict;return Q.map((L)=>({type:"function",name:L.name,description:L.description,parameters:L.parameters,strict:W}))}async function B(Q,E,W,L,D){let N=null,A=null,w=E.content,Z=()=>w.length-1;for await(let K of Q)if(K.type==="response.created")E.responseId=K.response.id;else if(K.type==="response.output_item.added"){let q=K.item;if(q.type==="reasoning")N=q,A={type:"thinking",thinking:""},E.content.push(A),W.push({type:"thinking_start",contentIndex:Z(),partial:E});else if(q.type==="message")N=q,A={type:"text",text:""},E.content.push(A),W.push({type:"text_start",contentIndex:Z(),partial:E});else if(q.type==="function_call")N=q,A={type:"toolCall",id:`${q.call_id}|${q.id}`,name:q.name,arguments:{},partialJson:q.arguments||""},E.content.push(A),W.push({type:"toolcall_start",contentIndex:Z(),partial:E})}else if(K.type==="response.reasoning_summary_part.added"){if(N&&N.type==="reasoning")N.summary=N.summary||[],N.summary.push(K.part)}else if(K.type==="response.reasoning_summary_text.delta"){if(N?.type==="reasoning"&&A?.type==="thinking"){N.summary=N.summary||[];let q=N.summary[N.summary.length-1];if(q)A.thinking+=K.delta,q.text+=K.delta,W.push({type:"thinking_delta",contentIndex:Z(),delta:K.delta,partial:E})}}else if(K.type==="response.reasoning_summary_part.done"){if(N?.type==="reasoning"&&A?.type==="thinking"){N.summary=N.summary||[];let q=N.summary[N.summary.length-1];if(q)A.thinking+=`
|
|
4
4
|
|
|
5
5
|
`,q.text+=`
|
|
@@ -11,4 +11,4 @@ import{mb as f}from"./chunk-1dvam047.js";import{xb as j}from"./chunk-qggykya7.js
|
|
|
11
11
|
`)||"",O=q.content?.map((X)=>X.text).join(`
|
|
12
12
|
|
|
13
13
|
`)||"";A.thinking=G||O||A.thinking,A.thinkingSignature=JSON.stringify(q),W.push({type:"thinking_end",contentIndex:Z(),content:A.thinking,partial:E}),A=null}else if(q.type==="message"&&A?.type==="text")A.text=q.content.map((G)=>G.type==="output_text"?G.text:G.refusal).join(""),A.textSignature=M(q.id,q.phase??void 0),W.push({type:"text_end",contentIndex:Z(),content:A.text,partial:E}),A=null;else if(q.type==="function_call"){let G=A?.type==="toolCall"&&A.partialJson?H(A.partialJson):H(q.arguments||"{}"),O;if(A?.type==="toolCall")A.arguments=G,delete A.partialJson,O=A;else O={type:"toolCall",id:`${q.call_id}|${q.id}`,name:q.name,arguments:G};A=null,W.push({type:"toolcall_end",contentIndex:Z(),toolCall:O,partial:E})}}else if(K.type==="response.completed"){let q=K.response;if(q?.id)E.responseId=q.id;if(q?.usage){let G=q.usage.input_tokens_details?.cached_tokens||0;E.usage={input:(q.usage.input_tokens||0)-G,output:q.usage.output_tokens||0,cacheRead:G,cacheWrite:0,totalTokens:q.usage.total_tokens||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}if(J(L,E.usage),D?.applyServiceTierPricing){let G=D.resolveServiceTier?D.resolveServiceTier(q?.service_tier,D.serviceTier):q?.service_tier??D.serviceTier;D.applyServiceTierPricing(E.usage,G)}if(E.stopReason=C(q?.status),E.content.some((G)=>G.type==="toolCall")&&E.stopReason==="stop")E.stopReason="toolUse"}else if(K.type==="error")throw Error(`Error Code ${K.code}: ${K.message}`||"Unknown error");else if(K.type==="response.failed"){let q=K.response?.error,G=K.response?.incomplete_details,O=q?`${q.code||"unknown"}: ${q.message||"no message"}`:G?.reason?`incomplete: ${G.reason}`:"Unknown error (no error details in response)";throw Error(O)}}function C(Q){if(!Q)return"stop";switch(Q){case"completed":return"stop";case"incomplete":return"length";case"failed":case"cancelled":return"error";case"in_progress":case"queued":return"stop";default:throw Error(`Unhandled stop reason: ${Q}`)}}
|
|
14
|
-
export{b as
|
|
14
|
+
export{b as lb,x as mb,B as nb};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{B as
|
|
1
|
+
import{Uf as A}from"./chunk-dh4tbp68.js";import{Gg as z,dg as v,tg as w}from"./chunk-dsnnmmd9.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/folders/$folderId")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
|
|
2
|
+
export{B as qe,H as re};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Qf as e}from"./chunk-5a2maxwp.js";import{Li as n,Mi as U,Ri as s,dg as r,eg as l,ih as x,jh as f,mh as b}from"./chunk-dsnnmmd9.js";function ae({...t}){return r(n.Root,{"data-slot":"select",...t})}function se({...t}){return r(n.Value,{"data-slot":"select-value",...t})}function pe({className:t,size:o="default",children:i,...p}){return l(n.Trigger,{"data-slot":"select-trigger","data-size":o,className:s("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...p,children:[i,r(n.Icon,{asChild:!0,children:r(f,{className:"size-4 opacity-50"})})]})}function ce({className:t,children:o,position:i="item-aligned",align:p="center",...d}){return r(n.Portal,{children:l(n.Content,{"data-slot":"select-content",className:s("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",i==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:i,align:p,...d,children:[r(w,{}),r(n.Viewport,{className:s("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),r(T,{})]})})}function le({className:t,children:o,...i}){return l(n.Item,{"data-slot":"select-item",className:s("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...i,children:[r("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:r(n.ItemIndicator,{children:r(x,{className:"size-4"})})}),r(n.ItemText,{children:o})]})}function w({className:t,...o}){return r(n.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:s("flex cursor-default items-center justify-center py-1",t),...o,children:r(b,{className:"size-4"})})}function T({className:t,...o}){return r(n.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:s("flex cursor-default items-center justify-center py-1",t),...o,children:r(f,{className:"size-4"})})}var c=e.object({cursor:e.string().optional(),total:e.number().optional(),totalSize:e.number().optional()}),a=e.object({first:e.coerce.number().optional(),after:e.string().optional()});var Se=e.object({name:e.string()}),N=e.object({id:e.string(),name:e.string(),rootFolder:e.string().optional(),updatedAt:e.union([e.string(),e.date()])});var he=e.object({data:e.array(N),pageInfo:c}),xe=e.object({teamId:e.string(),userId:e.string()}),be=e.object({id:e.string(),name:e.string(),email:e.string().optional(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional(),unreadNotificationCount:e.number().optional()}),Re=e.object({name:e.string().optional(),imageKey:e.string().nullable().optional()}),Ie=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),email:e.string().optional(),type:e.enum(["human","agent"]).optional(),image:e.string().optional(),scope:e.enum(["team","project"]).optional()}),ve=e.object({includeAgents:e.string().optional().transform((t)=>t==="true")}),A={best_match:"best_match",all:"all"},qe=e.union([e.object({key:e.literal("transcode.videoStrategy"),value:e.nativeEnum(A)})]),je=e.object({allowedDomains:e.array(e.string()),pendingDomains:e.array(e.string()).default([])});var Pe=e.object({role:e.enum(["editor","reviewer"])});var R=e.enum(["chat","autofill","embedding"]),I=e.enum(["off","minimal","low","medium","high","xhigh"]),F=e.object({id:e.string().optional(),skillId:e.string(),skill:e.object({id:e.string(),name:e.string()}).optional()}),Ue=e.object({id:e.string(),name:e.string(),type:R,enabled:e.boolean(),avatar:e.string().optional(),providerId:e.string().optional(),modelId:e.string().optional(),thinkingLevel:I.optional().default("off"),systemPrompt:e.string().optional(),soul:e.string().optional(),skills:e.array(F).optional()}),v=e.object({name:e.string().min(1),type:R,enabled:e.boolean().optional().default(!0),avatar:e.string().optional(),providerId:e.string().optional(),modelId:e.string().optional(),thinkingLevel:I.optional().default("off"),systemPrompt:e.string().optional(),soul:e.string().optional(),skills:e.array(e.string()).optional()}),we=v.superRefine((t,o)=>{if(t.type==="chat"||t.type==="autofill"){if(!t.providerId)o.addIssue({code:e.ZodIssueCode.custom,message:"providerId is required for chat/autofill agents",path:["providerId"]});if(!t.modelId)o.addIssue({code:e.ZodIssueCode.custom,message:"modelId is required for chat/autofill agents",path:["modelId"]})}}),Te=v.superRefine((t,o)=>{if(t.type==="chat"||t.type==="autofill"){if(!t.providerId)o.addIssue({code:e.ZodIssueCode.custom,message:"providerId is required for chat/autofill agents",path:["providerId"]});if(!t.modelId)o.addIssue({code:e.ZodIssueCode.custom,message:"modelId is required for chat/autofill agents",path:["modelId"]})}}),Ne=e.object({id:e.string(),sessionId:e.string(),entry:e.unknown()});var Le=e.object({apiKey:e.string().optional(),baseUrl:e.string().optional(),chatModels:e.array(e.string()).optional()});var Oe=e.object({data:e.array(e.lazy(()=>O)),pageInfo:c}),q=e.object({mediaType:e.string().nullable(),thumbnailUrl:e.string().optional(),originalHeight:e.number().optional(),originalWidth:e.number().optional(),spriteUrl:e.string().optional(),duration:e.number().optional()}),L=e.object({type:e.string().nullable(),preview:q.nullable()}),m=e.object({id:e.string(),name:e.string(),image:e.string().optional()}),M=e.object({fieldId:e.string(),value:e.any()}),V=e.object({id:e.string(),name:e.string()}),B=e.object({duration:e.number().optional(),originalWidth:e.number().optional(),originalHeight:e.number().optional(),frameRate:e.number().optional(),totalFrames:e.number().optional(),startTimecode:e.string().optional()}),O=e.object({id:e.string(),name:e.string(),sizeByte:e.number(),fileCount:e.number(),type:e.string(),targetType:e.string().optional().nullable(),status:e.string(),mediaType:e.string().nullable(),latestChildren:e.array(L).optional(),preview:q.nullable().optional(),createdAt:e.string(),updatedAt:e.string(),deletedAt:e.string().nullable().optional(),projectId:e.string().optional().nullable(),creator:m.nullable().optional(),fieldValues:e.array(M).optional(),sortIndex:e.string().optional().nullable(),startTime:e.number().optional().nullable(),endTime:e.number().optional().nullable(),media:e.object({original:e.object({downloadUrl:e.string(),key:e.string().optional()}).optional(),videoTranscodes:e.array(e.object({id:e.string(),url:e.string(),key:e.string(),width:e.number(),height:e.number(),size:e.number(),isRaw:e.boolean()})).optional(),imageTranscodes:e.array(e.object({id:e.string(),url:e.string(),key:e.string(),width:e.number(),height:e.number(),size:e.number(),isRaw:e.boolean()})).optional(),videoPreview:e.object({url:e.string(),key:e.string().optional()}).optional(),mimeType:e.string().optional(),metadata:B.optional()}).optional(),ancestorFolders:e.array(V).optional(),versionStack:e.object({id:e.string(),versions:e.array(e.object({version:e.number(),current:e.boolean(),id:e.string(),name:e.string().optional().nullable(),previewUrl:e.string().optional().nullable(),creator:e.object({id:e.string(),name:e.string().nullable()}).nullable().optional()}))}).optional().nullable()}),De=e.object({name:e.string(),type:e.string(),projectId:e.string().optional(),parentId:e.string().optional(),key:e.string().optional(),sizeByte:e.number().optional(),contentType:e.string().optional(),creatorId:e.string().optional()}),Ee=e.object({assetId:e.string()}),_e=e.object({id:e.string(),name:e.string()}),Ge=e.object({assetId:e.string().optional(),assetType:e.string(),projectId:e.string().optional(),showDeleted:e.boolean().optional(),prefix:e.string().optional(),sort:e.string().optional(),order:e.string().optional(),...a.shape}),Ze=e.object({assetId:e.string(),userId:e.string(),replyToId:e.string().optional(),message:e.string(),annotations:e.any().optional(),second:e.number().optional(),attachmentIds:e.array(e.string())}),D=e.object({id:e.string(),assetId:e.string(),url:e.string(),mediaType:e.string().nullable()}),E=e.object({id:e.string(),assetId:e.string(),message:e.string().nullable(),annotations:e.any(),second:e.number().nullable(),creator:m,replies:e.array(e.lazy(()=>E)),attachments:e.array(D),mentions:e.array(m),createdAt:e.string(),updatedAt:e.string(),sessionId:e.string().nullable(),isCompleted:e.boolean(),completionLastChangedBy:m.nullable()}),Ke=e.object({isCompleted:e.boolean()}),Qe=e.object({newParentId:e.string(),assetIds:e.array(e.string()),creatorId:e.string().optional()}),He=e.object({newParentId:e.string(),assetIds:e.array(e.string()),withComments:e.boolean().default(!1),creatorId:e.string().optional()}),Je=e.object({name:e.string()}),We=e.object({beforeIndex:e.string().optional(),afterIndex:e.string().optional()}),Xe=e.object({ids:e.array(e.string())}),Ye=e.object({ids:e.array(e.string())}),$e=e.object({file:e.instanceof(File)}),ze=e.object({key:e.string()}),et=e.object({fileName:e.string(),contentType:e.string(),size:e.number()}),tt=e.object({id:e.string(),uploadUrl:e.string()}),ot=e.object({ids:e.array(e.string())}),_=e.object({id:e.string(),name:e.string(),url:e.string()}),rt=e.object({files:e.array(_)});var at=e.object({userCount:e.number()}),st=e.object({name:e.string().min(1,"Name is required").max(100,"Name is too long")}),pt=e.object({id:e.string(),token:e.string(),name:e.string(),createdAt:e.string()});var G=e.enum(["is","eq","neq","gt","gte","lt","lte","contains","notContains","isEmpty","isNotEmpty","in","notIn","hasAny","hasAll","hasNone","isWithin"]),Z=e.object({field:e.string(),operator:G,value:e.any()}),K=e.enum(["asc","desc"]),Q=e.object({field:e.string(),order:K}),H=e.enum(["AND","OR"]),J=e.enum(["file","folder"]),u=e.object({operator:H.optional().default("AND"),conditions:e.array(Z).optional().default([]),sort:Q.optional(),assetType:J.optional(),showSymlink:e.boolean().optional(),recursively:e.boolean().optional().default(!0),query:e.string().optional(),isSemantic:e.boolean().optional().default(!1)}),dt=u.extend(a.shape);var g=e.object({sourceFolderId:e.string(),searchFilter:u}),W=e.object({id:e.string(),name:e.string(),filter:g,projectId:e.string(),createdAt:e.string(),updatedAt:e.string(),creator:e.object({id:e.string(),name:e.string(),image:e.string().optional().nullable()}).optional().nullable()}),St=e.object({name:e.string(),filter:g}),ht=e.object({name:e.string().optional(),filter:g.optional()});var xt=e.object({data:e.array(W),pageInfo:e.object({cursor:e.string().optional(),total:e.number().optional()})});var It=e.object({name:e.string(),parentId:e.string()}),vt=e.object({name:e.string()}),qt=e.object({ids:e.array(e.string())}),jt=e.object({ids:e.array(e.string())});var Ct=e.object({code:e.string(),role:e.enum(["editor","reviewer","owner"]),teamId:e.string(),teamName:e.string(),projectId:e.string().optional(),projectName:e.string().optional(),inviterName:e.string(),isUsed:e.boolean()}),Ut=e.object({role:e.enum(["editor","reviewer"])}),wt=e.object({role:e.enum(["editor","reviewer"])}),Tt=e.object({code:e.string()});var Ft={text:"text",longText:"longText",select:"select",selectMulti:"selectMulti",rating:"rating",number:"number",toggle:"toggle",date:"date",user:"user",userMulti:"userMulti"},Lt=e.object({id:e.string(),displayName:e.string(),color:e.string().optional()}),y=e.object({name:e.string(),type:e.enum(["text","longText","select","selectMulti","rating","number","toggle","date","user","userMulti"]),text:e.any().optional(),longText:e.any().optional(),select:e.any().optional(),selectMulti:e.any().optional(),rating:e.any().optional(),number:e.any().optional(),toggle:e.any().optional(),date:e.any().optional(),user:e.any().optional(),userMulti:e.any().optional()}),Mt=e.object({key:e.string().optional(),label:e.string().optional(),scope:e.string().optional(),config:y,aiAutofill:e.boolean().default(!1),description:e.string().default("")}),Vt=e.object({label:e.string().optional(),config:y,aiAutofill:e.boolean().optional(),description:e.string().optional()}),X=e.object({fieldId:e.string(),visible:e.boolean()}),Bt=e.array(X),Y=e.object({key:e.string(),value:e.any()}),Ot=e.array(Y),Dt=e.object({id:e.string(),config:y,scope:e.string(),readOnly:e.boolean(),visible:e.boolean(),description:e.string(),aiAutofill:e.boolean()});var j=e.object({id:e.string().optional(),name:e.string().optional(),role:e.string().optional()}),P=e.object({id:e.string().optional(),name:e.string().optional()}),$=e.object({id:e.string().optional(),mediaType:e.string().optional(),name:e.string().optional(),preview:e.string().optional(),thumbnailUrl:e.string().optional(),originalWidth:e.number().optional(),originalHeight:e.number().optional()}),Gt=e.object({id:e.string().optional(),creator:j.optional(),type:e.string().optional(),team:P.optional(),project:P.optional(),asset:$.optional(),user:j.optional(),createdAt:e.string().optional(),isRead:e.boolean().optional()}),Zt=e.object({unreadOnly:e.union([e.boolean(),e.string()]).transform((t)=>t===!0||t==="true").optional(),after:e.string().optional(),pageSize:e.coerce.number().optional()}),Kt=e.object({notificationId:e.string().min(1)}),Qt=e.object({comments:e.boolean().default(!0),replies:e.boolean().default(!0),mentions:e.boolean().default(!0),yourUploads:e.boolean().default(!1),otherUploads:e.boolean().default(!0),statusUpdates:e.boolean().default(!0)});var Xt=e.object({name:e.string(),coverImageKey:e.string().optional(),enableNotification:e.boolean().default(!0)}),Yt=e.object({name:e.string().optional(),coverImageKey:e.string().optional(),enableNotification:e.boolean().optional()}),z=e.object({id:e.string(),name:e.string(),teamId:e.string(),rootFolder:e.string().optional(),coverImage:e.string().optional(),coverImageKey:e.string().optional(),enableNotification:e.boolean(),updatedAt:e.union([e.string(),e.date()])}),$t=e.object({sortBy:e.string().optional(),sortDirection:e.enum(["asc","desc"]).optional()}).merge(a),zt=e.object({data:e.array(z),pageInfo:c}),eo=e.object({teamId:e.string()}),to=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional(),scope:e.enum(["team","project"]).optional()}),oo=e.object({id:e.string(),name:e.string()}),ro=e.object({assetType:e.string(),sort:e.enum(["createdAt","name","size"]).optional(),order:e.enum(["asc","desc"]).optional()}).merge(a),no=e.object({role:e.enum(["editor","reviewer"])}),io=e.object({userId:e.string(),role:e.enum(["owner","editor","reviewer"])}),ao=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional()});var k=["openai-completions","mistral-conversations","openai-responses","azure-openai-responses","openai-codex-responses","anthropic-messages","bedrock-converse-stream","google-generative-ai","google-vertex"],ee=e.object({api:e.enum(k).optional(),reasoning:e.boolean().default(!1),input:e.array(e.enum(["text","image"])).default(["text"]),contextWindow:e.number().int().positive().default(128000),maxTokens:e.number().int().positive().default(4096),cost:e.object({input:e.number().nonnegative().default(0),output:e.number().nonnegative().default(0),cacheRead:e.number().nonnegative().default(0),cacheWrite:e.number().nonnegative().default(0)})}),S=e.object({id:e.string().optional(),modelId:e.string().min(1,"Model ID is required"),name:e.string().min(0).default(""),config:ee}),h=e.object({baseUrl:e.string().url("Must be a valid URL").optional().or(e.literal("")),apiKey:e.string().optional().or(e.literal("")),api:e.enum(k),headers:e.record(e.string(),e.string()).optional(),authHeader:e.boolean().optional()}),co=e.object({name:e.string().min(1,"Provider name is required"),config:h,models:e.array(S).min(1,"At least one model is required")}),lo=e.object({config:h,models:e.array(S).min(1,"At least one model is required")}),mo=e.object({id:e.string(),name:e.string(),isBuiltin:e.boolean(),config:h,models:e.array(S).optional(),modelsCount:e.number().optional(),createdAt:e.date(),updatedAt:e.date()});var yo=e.object({name:e.string().min(1),expireAt:e.string().datetime().optional(),password:e.string().optional(),isDisabled:e.boolean().optional(),defaultSortOrder:e.string().optional(),viewMode:e.string().optional()}),So=e.object({name:e.string().min(1).optional(),expireAt:e.string().datetime().optional().nullable(),password:e.string().optional().nullable(),isDisabled:e.boolean().optional(),defaultSortOrder:e.string().optional().nullable(),viewMode:e.string().optional().nullable(),fieldVisibility:e.record(e.string(),e.boolean()).optional().nullable()}),ho=a.extend({projectId:e.string().optional()}),xo=e.object({assetIds:e.array(e.string().min(1)).min(1)});var Io=e.object({assetId:e.string().optional(),githubUrl:e.string().optional(),override:e.boolean().optional()}),vo=e.object({config:e.object({environmentVariables:e.array(e.object({name:e.string(),default:e.string().optional()}))})});var C=e.lazy(()=>e.object({name:e.string(),id:e.string(),size:e.number(),children:e.array(C),type:e.string(),mediaType:e.string().optional()})),Po=e.object({parentId:e.string(),files:e.array(C)}),te=e.object({id:e.string(),fileId:e.string(),url:e.string()}),ko=e.object({taskId:e.string(),presignedUrls:e.array(te),createdAssets:e.array(e.object({tempId:e.string(),assetId:e.string()})).optional()}),Co=e.object({fileId:e.string(),errorMessage:e.string().optional()}),Uo=e.object({id:e.string(),name:e.string(),total:e.number(),uploaded:e.number(),createdAt:e.string()}),wo=e.object({bucket:e.string(),key:e.string(),Signature:e.string()}),To=e.object({file:e.instanceof(File)});var oe=e.object({key:e.string(),value:e.unknown()}),Fo=e.object({value:e.unknown()}),Lo=e.array(oe);var Bo=e.object({fileIds:e.array(e.string())}),Oo=e.object({fileId:e.string(),beforeId:e.string()});var _o=e.object({agentId:e.string(),textPrompt:e.string().optional(),attachedFiles:e.array(e.string()).optional(),assetIds:e.array(e.string()).optional(),sessionId:e.string().optional(),contextAssetId:e.string().optional(),projectId:e.string().optional()}).superRefine((t,o)=>{let i=t.textPrompt&&t.textPrompt.trim().length>0,p=t.attachedFiles&&t.attachedFiles.length>0,d=t.assetIds&&t.assetIds.length>0;if(!i&&!p&&!d)o.addIssue({code:e.ZodIssueCode.custom,message:"At least one of textPrompt, attachedFiles, or assetIds must be provided.",path:["textPrompt"]})}),Go=e.object({id:e.string(),agentId:e.string(),userId:e.string().nullable(),assetId:e.string().nullable(),userCommentId:e.string().nullable(),name:e.string().nullable().optional(),createdAt:e.string(),updatedAt:e.string()}),Zo=e.intersection(e.object({id:e.string()}),e.unknown());function yr({className:t,orientation:o="horizontal",decorative:i=!0,...p}){return r(U.Root,{"data-slot":"separator",decorative:i,orientation:o,className:s("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...p})}
|
|
2
|
+
export{ae as Q,se as R,pe as S,ce as T,le as U,I as V,Ft as W,k as X,S as Y,h as Z,A as _,yr as $};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{lb as I,mb as s,nb as k}from"./chunk-2vs3evc7.js";import"./chunk-dypsm6m2.js";import{pb as o}from"./chunk-9n0etqsy.js";import{qb as b}from"./chunk-7ddaxdpf.js";import{xb as t}from"./chunk-0at8vxt5.js";import"./chunk-22dje1f5.js";import{Hb as e,Ib as f,Jb as NN,Kb as QN}from"./chunk-3rt9mnj3.js";import"./chunk-wv4fe1fj.js";import{je as r,ke as n}from"./chunk-7rhjej0x.js";import{le as g}from"./chunk-n6jgyv4y.js";import"./chunk-yhj8c5re.js";import"./chunk-kbzm1pwx.js";var zN=function(N,Q){if(typeof N==="string"&&/^\.\.?\//.test(N))return N.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(V,X,Y,Z,G){return X?Q?".jsx":".js":Y&&(!Z||!G)?V:Y+Z+"."+G.toLowerCase()+"js"});return N},B=null,VN=(N)=>import(zN(N)),RN="node:os";if(typeof process<"u"&&(process.versions?.node||process.versions?.bun))VN(RN).then((N)=>{B=N});var KN="https://chatgpt.com/backend-api",ON="https://api.openai.com/auth",x=3,l=1000,XN=new Set(["openai","openai-codex","opencode"]),_N=1009,UN=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function jN(N,Q){if(N===429||N===500||N===502||N===503||N===504)return!0;return/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(Q)}function p(N,Q){return new Promise((V,X)=>{if(Q?.aborted){X(Error("Request was aborted"));return}let Y=setTimeout(V,N);Q?.addEventListener("abort",()=>{clearTimeout(Y),X(Error("Request was aborted"))})})}var WN=(N,Q,V)=>{let X=new n;return(async()=>{let Y={role:"assistant",content:[],api:"openai-codex-responses",provider:N.provider,model:N.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 Z=V?.apiKey||g(N.provider)||"";if(!Z)throw Error(`No API key for provider: ${N.provider}`);let G=pN(Z),$=AN(N,Q,V),F=await V?.onPayload?.($,N);if(F!==void 0)$=F;let L=V?.sessionId||iN(),_=dN(N.headers,V?.headers,G,Z,V?.sessionId),j=aN(N.headers,V?.headers,G,Z,L),J=JSON.stringify($),O=V?.transport||"auto",P=O!=="sse"&&DN(V?.sessionId);if(P)i(V?.sessionId);if(O!=="sse"&&!P){let K=!1;try{if(await cN(HN(N.baseUrl),$,j,Y,X,N,()=>{K=!0},V),V?.signal?.aborted)throw Error("Request was aborted");X.push({type:"done",reason:Y.stopReason,message:Y}),X.end();return}catch(z){if(V?.signal?.aborted||qN(z))throw z;if(QN(Y,NN("provider_transport_failure",z,{configuredTransport:O,fallbackTransport:K?void 0:"sse",eventsEmitted:K,phase:K?"after_message_stream_start":"before_message_stream_start",requestBytes:new TextEncoder().encode(J).byteLength})),SN(V?.sessionId,z),K)throw z;i(V?.sessionId)}}let D,R;for(let K=0;K<=x;K++){if(V?.signal?.aborted)throw Error("Request was aborted");try{if(D=await fetch($N(N.baseUrl),{method:"POST",headers:_,body:J,signal:V?.signal}),await V?.onResponse?.({status:D.status,headers:b(D.headers)},N),D.ok)break;let z=await D.text();if(K<x&&jN(D.status,z)){let q=l*2**K,m=D.headers.get("retry-after-ms");if(m!==null){let A=Number(m);if(Number.isFinite(A))q=Math.max(0,A)}else{let A=D.headers.get("retry-after");if(A){let u=Number(A);if(Number.isFinite(u))q=Math.max(0,u*1000);else{let c=Date.parse(A);if(!Number.isNaN(c))q=Math.max(0,c-Date.now())}}}await p(q,V?.signal);continue}let M=new Response(z,{status:D.status,statusText:D.statusText}),y=await lN(M);throw Error(y.friendlyMessage||y.message)}catch(z){if(z instanceof Error){if(z.name==="AbortError"||z.message==="Request was aborted")throw Error("Request was aborted")}if(R=z instanceof Error?z:Error(String(z)),K<x&&!R.message.includes("usage limit")){let M=l*2**K;await p(M,V?.signal);continue}throw R}}if(!D?.ok)throw R??Error("Failed after retries");if(!D.body)throw Error("No response body");if(X.push({type:"start",partial:Y}),await MN(D,Y,X,N,V),V?.signal?.aborted)throw Error("Request was aborted");X.push({type:"done",reason:Y.stopReason,message:Y}),X.end()}catch(Z){for(let G of Y.content)delete G.partialJson;Y.stopReason=V?.signal?.aborted?"aborted":"error",Y.errorMessage=Z instanceof Error?Z.message:String(Z),X.push({type:"error",reason:Y.stopReason,error:Y}),X.end()}})(),X},XQ=(N,Q,V)=>{let X=V?.apiKey||g(N.provider);if(!X)throw Error(`No API key for provider: ${N.provider}`);let Y=t(N,V,X),Z=V?.reasoning?r(N,V.reasoning):void 0;return WN(N,Q,{...Y,reasoningEffort:Z==="off"?void 0:Z})};function AN(N,Q,V){let X=I(N,Q,XN,{includeSystemPrompt:!1}),Y={model:N.id,store:!1,stream:!0,instructions:Q.systemPrompt||"You are a helpful assistant.",input:X,text:{verbosity:V?.textVerbosity||"low"},include:["reasoning.encrypted_content"],prompt_cache_key:o(V?.sessionId),tool_choice:"auto",parallel_tool_calls:!0};if(V?.temperature!==void 0)Y.temperature=V.temperature;if(V?.serviceTier!==void 0)Y.service_tier=V.serviceTier;if(Q.tools&&Q.tools.length>0)Y.tools=s(Q.tools,{strict:null});if(V?.reasoningEffort!==void 0){let Z=V.reasoningEffort==="none"?N.thinkingLevelMap?.off??"none":N.thinkingLevelMap?.[V.reasoningEffort]??V.reasoningEffort;if(Z!==null)Y.reasoning={effort:Z,summary:V.reasoningSummary??"auto"}}return Y}function BN(N,Q){switch(Q){case"flex":return 0.5;case"priority":return N.id==="gpt-5.5"?2.5:2;default:return 1}}function YN(N,Q,V){let X=BN(V,Q);if(X===1)return;N.cost.input*=X,N.cost.output*=X,N.cost.cacheRead*=X,N.cost.cacheWrite*=X,N.cost.total=N.cost.input+N.cost.output+N.cost.cacheRead+N.cost.cacheWrite}function ZN(N,Q){if(N==="default"&&(Q==="flex"||Q==="priority"))return Q;return N??Q}function $N(N){let V=(N&&N.trim().length>0?N:KN).replace(/\/+$/,"");if(V.endsWith("/codex/responses"))return V;if(V.endsWith("/codex"))return`${V}/responses`;return`${V}/codex/responses`}function HN(N){let Q=new URL($N(N));if(Q.protocol==="https:")Q.protocol="wss:";if(Q.protocol==="http:")Q.protocol="ws:";return Q.toString()}async function MN(N,Q,V,X,Y){await k(GN(TN(N)),Q,V,X,{serviceTier:Y?.serviceTier,resolveServiceTier:ZN,applyServiceTierPricing:(Z,G)=>YN(Z,G,X)})}class C extends Error{code;payload;constructor(N,Q){super(N);this.name="CodexApiError",this.code=Q?.code,this.payload=Q?.payload,this.cause=Q?.cause}}class S extends Error{payload;constructor(N,Q){super(N);this.name="CodexProtocolError",this.payload=Q?.payload,this.cause=Q?.cause}}function qN(N){return N instanceof C||N instanceof S}async function*GN(N){for await(let Q of N){let V=typeof Q.type==="string"?Q.type:void 0;if(!V)continue;if(V==="error"){let X=Q.code||"",Y=Q.message||"";throw new C(`Codex error: ${Y||X||JSON.stringify(Q)}`,{code:X||void 0,payload:Q})}if(V==="response.failed"){let X=Q.response,Y=X?.error?.code,Z=X?.error?.message;throw new C(Z||"Codex response failed",{code:Y,payload:Q})}if(V==="response.done"||V==="response.completed"||V==="response.incomplete"){let X=Q.response,Y=X?{...X,status:wN(X.status)}:X;yield{...Q,type:"response.completed",response:Y};return}yield Q}}function wN(N){if(typeof N!=="string")return;return UN.has(N)?N:void 0}async function*TN(N){if(!N.body)return;let Q=N.body.getReader(),V=new TextDecoder,X="";try{while(!0){let{done:Y,value:Z}=await Q.read();if(Y)break;X+=V.decode(Z,{stream:!0});let G=X.indexOf(`
|
|
3
3
|
|
|
4
4
|
`);while(G!==-1){let $=X.slice(0,G);X=X.slice(G+2);let F=$.split(`
|
|
5
5
|
`).filter((L)=>L.startsWith("data:")).map((L)=>L.slice(5).trim());if(F.length>0){let L=F.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Lc as J,Mc as H}from"./chunk-xh2ntgmk.js";import{wd as P,xd as V,yd as W}from"./chunk-ysq64j13.js";import"./chunk-kbzm1pwx.js";var X=class{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(){}async releaseMigrationLock(){}get supportsOutput(){return!0}},Y=class{#h;#j=new $;#w;#z;constructor(h){this.#h={...h}}async init(){if(this.#w=this.#h.database,this.#z=new Z(this.#w),this.#h.onCreateConnection)await this.#h.onCreateConnection(this.#z)}async acquireConnection(){return await this.#j.lock(),this.#z}async beginTransaction(h){await h.executeQuery(H.raw("begin"))}async commitTransaction(h){await h.executeQuery(H.raw("commit"))}async rollbackTransaction(h){await h.executeQuery(H.raw("rollback"))}async releaseConnection(){this.#j.unlock()}async destroy(){this.#w?.close()}},Z=class{#h;constructor(h){this.#h=h}executeQuery(h){let{sql:w,parameters:z}=h,j=this.#h.prepare(w);return Promise.resolve({rows:j.all(z)})}async*streamQuery(){throw Error("Streaming query is not supported by SQLite driver.")}},$=class{#h;#j;async lock(){while(this.#h!==void 0)await this.#h;this.#h=new Promise((h)=>{this.#j=h})}unlock(){let h=this.#j;this.#h=void 0,this.#j=void 0,h?.()}},k=class{#h;constructor(h){this.#h=h}async getSchemas(){return[]}async getTables(h={withInternalKyselyTables:!1}){let w=this.#h.selectFrom("sqlite_schema").where("type","=","table").where("name","not like","sqlite_%").select("name").$castTo();if(!h.withInternalKyselyTables)w=w.where("name","!=",V).where("name","!=",W);let z=await w.execute();return Promise.all(z.map(({name:j})=>this.#j(j)))}async getMetadata(h){return{tables:await this.getTables(h)}}async#j(h){let w=this.#h,z=(await w.selectFrom("sqlite_master").where("name","=",h).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((j)=>j.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g,"");return{name:h,columns:(await w.selectFrom(J`pragma_table_info(${h})`.as("table_info")).select(["name","type","notnull","dflt_value"]).execute()).map((j)=>({name:j.name,dataType:j.type,isNullable:!j.notnull,isAutoIncrementing:j.name===z,hasDefaultValue:j.dflt_value!=null})),isView:!0}}},K=class extends P{getCurrentParameterPlaceholder(){return"?"}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}},G=class{#h;constructor(h){this.#h={...h}}createDriver(){return new Y(this.#h)}createQueryCompiler(){return new K}createAdapter(){return new X}createIntrospector(h){return new k(h)}};export{G as BunSqliteDialect};
|
|
@@ -38,4 +38,4 @@ If you understand the risks and have appropriate mitigations in place,
|
|
|
38
38
|
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
39
39
|
|
|
40
40
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
41
|
-
`);this.baseURL=W.baseURL,this.timeout=W.timeout??C0.DEFAULT_TIMEOUT,this.logger=W.logger??console;let J="warn";this.logLevel=J,this.logLevel=iZ(W.logLevel,"ClientOptions.logLevel",this)??iZ(GZ("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=W.fetchOptions,this.maxRetries=W.maxRetries??2,this.fetch=W.fetch??D0(),G(this,vZ,P0,"f"),this._options=W,this.apiKey=typeof Z==="string"?Z:null,this.authToken=$}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){if(X.get("x-api-key")||X.get("authorization"))return;if(this.apiKey&&X.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&X.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(X){return w([await this.apiKeyAuth(X),await this.bearerAuth(X)])}async apiKeyAuth(X){if(this.apiKey==null)return;return w([{"X-Api-Key":this.apiKey}])}async bearerAuth(X){if(this.authToken==null)return;return w([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(X){return k0(X)}getUserAgent(){return`${this.constructor.name}/JS ${m}`}defaultIdempotencyKey(){return`stainless-node-retry-${cZ()}`}makeStatusError(X,Z,$,z){return A.generate(X,Z,$,z)}buildURL(X,Z,$){let z=!Y(this,U0,"m",Q1).call(this)&&$||this.baseURL,W=E0(X)?new URL(X):new URL(z+(z.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),J=this.defaultQuery(),Q=Object.fromEntries(W.searchParams);if(!uZ(J)||!uZ(Q))Z={...Q,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))W.search=this.stringifyQuery(Z);return W.toString()}_calculateNonstreamingTimeout(X){if(3600*X/128000>600)throw new N("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(X){}async prepareRequest(X,{url:Z,options:$}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,$){return this.request(Promise.resolve($).then((z)=>{return{method:X,path:Z,...z}}))}request(X,Z=null){return new r(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,$){let z=await X,W=z.maxRetries??this.maxRetries;if(Z==null)Z=W;await this.prepareOptions(z);let{req:J,url:Q,timeout:K}=await this.buildRequest(z,{retryCount:W-Z});await this.prepareRequest(J,{url:Q,options:z});let x="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),E=$===void 0?"":`, retryOf: ${$}`,O=Date.now();if(T(this).debug(`[${x}] sending request`,g({retryOfRequestLogID:$,method:z.method,url:Q,options:z,headers:J.headers})),z.signal?.aborted)throw new L;let k=new AbortController,C=await this.fetchWithTimeout(Q,J,K,k).catch(MX),F=Date.now();if(C instanceof globalThis.Error){let h=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new L;let _=b(C)||/timed? ?out/i.test(String(C)+("cause"in C?String(C.cause):""));if(Z)return T(this).info(`[${x}] connection ${_?"timed out":"failed"} - ${h}`),T(this).debug(`[${x}] connection ${_?"timed out":"failed"} (${h})`,g({retryOfRequestLogID:$,url:Q,durationMs:F-O,message:C.message})),this.retryRequest(z,Z,$??x);if(T(this).info(`[${x}] connection ${_?"timed out":"failed"} - error; no more retries left`),T(this).debug(`[${x}] connection ${_?"timed out":"failed"} (error; no more retries left)`,g({retryOfRequestLogID:$,url:Q,durationMs:F-O,message:C.message})),_)throw new EX;throw new o({cause:C})}let a=[...C.headers.entries()].filter(([h])=>h==="request-id").map(([h,_])=>", "+h+": "+JSON.stringify(_)).join(""),OX=`[${x}${E}${a}] ${J.method} ${Q} ${C.ok?"succeeded":"failed"} with status ${C.status} in ${F-O}ms`;if(!C.ok){let h=await this.shouldRetry(C);if(Z&&h){let NZ=`retrying, ${Z} attempts remaining`;return await f0(C.body),T(this).info(`${OX} - ${NZ}`),T(this).debug(`[${x}] response error (${NZ})`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,durationMs:F-O})),this.retryRequest(z,Z,$??x,C.headers)}let _=h?"error; no more retries left":"error; not retryable";T(this).info(`${OX} - ${_}`);let q0=await C.text().catch((NZ)=>MX(NZ).message),O0=UZ(q0),M0=O0?void 0:q0;throw T(this).debug(`[${x}] response error (${_})`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,message:M0,durationMs:Date.now()-O})),this.makeStatusError(C.status,O0,M0,C.headers)}return T(this).info(OX),T(this).debug(`[${x}] response start`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,durationMs:F-O})),{response:C,options:z,controller:k,requestLogID:x,retryOfRequestLogID:$,startTime:O}}getAPIList(X,Z,$){return this.requestAPIList(Z,$&&"then"in $?$.then((z)=>({method:"get",path:X,...z})):{method:"get",path:X,...$})}requestAPIList(X,Z){let $=this.makeRequest(Z,null,void 0);return new AZ(this,$,X)}async fetchWithTimeout(X,Z,$,z){let{signal:W,method:J,...Q}=Z||{},K=this._makeAbort(z);if(W)W.addEventListener("abort",K,{once:!0});let x=setTimeout(K,$),E=globalThis.ReadableStream&&Q.body instanceof globalThis.ReadableStream||typeof Q.body==="object"&&Q.body!==null&&Symbol.asyncIterator in Q.body,O={signal:z.signal,...E?{duplex:"half"}:{},method:"GET",...Q};if(J)O.method=J.toUpperCase();try{return await this.fetch.call(void 0,X,O)}finally{clearTimeout(x)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,$,z){let W,J=z?.get("retry-after-ms");if(J){let K=parseFloat(J);if(!Number.isNaN(K))W=K}let Q=z?.get("retry-after");if(Q&&!W){let K=parseFloat(Q);if(!Number.isNaN(K))W=K*1000;else W=Date.parse(Q)-Date.now()}if(W===void 0){let K=X.maxRetries??this.maxRetries;W=this.calculateDefaultRetryTimeoutMillis(Z,K)}return await F0(W),this.makeRequest(X,Z-1,$)}calculateDefaultRetryTimeoutMillis(X,Z){let W=Z-X,J=Math.min(0.5*Math.pow(2,W),8),Q=1-Math.random()*0.25;return J*Q*1000}calculateNonstreamingTimeout(X,Z){if(3600000*X/128000>600000||Z!=null&&X>Z)throw new N("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(X,{retryCount:Z=0}={}){let $={...X},{method:z,path:W,query:J,defaultBaseURL:Q}=$,K=this.buildURL(W,J,Q);if("timeout"in $)H0("timeout",$.timeout);$.timeout=$.timeout??this.timeout;let{bodyHeaders:x,body:E}=this.buildBody({options:$}),O=await this.buildHeaders({options:X,method:z,bodyHeaders:x,retryCount:Z});return{req:{method:z,headers:O,...$.signal&&{signal:$.signal},...globalThis.ReadableStream&&E instanceof globalThis.ReadableStream&&{duplex:"half"},...E&&{body:E},...this.fetchOptions??{},...$.fetchOptions??{}},url:K,timeout:$.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:$,retryCount:z}){let W={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();W[this.idempotencyHeader]=X.idempotencyKey}let J=w([W,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...B0(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(X),this._options.defaultHeaders,$,X.headers]);return this.validateHeaders(J),J.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let $=w([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&$.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:CZ(X)};else if(typeof X==="object"&&$.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return Y(this,vZ,"f").call(this,{body:X,headers:$})}}C0=M,vZ=new WeakMap,U0=new WeakSet,Q1=function(){return this.baseURL!=="https://api.anthropic.com"};M.Anthropic=C0;M.HUMAN_PROMPT=V1;M.AI_PROMPT=G1;M.DEFAULT_TIMEOUT=600000;M.AnthropicError=N;M.APIError=A;M.APIConnectionError=o;M.APIConnectionTimeoutError=EX;M.APIUserAbortError=L;M.NotFoundError=TX;M.ConflictError=LX;M.RateLimitError=jX;M.BadRequestError=AX;M.AuthenticationError=HX;M.InternalServerError=BX;M.PermissionDeniedError=FX;M.UnprocessableEntityError=SX;M.toFile=HZ;class WX extends M{constructor(){super(...arguments);this.completions=new UX(this),this.messages=new zX(this),this.models=new qX(this),this.beta=new S(this)}}WX.Completions=UX;WX.Messages=zX;WX.Models=qX;WX.Beta=S;export{WX as
|
|
41
|
+
`);this.baseURL=W.baseURL,this.timeout=W.timeout??C0.DEFAULT_TIMEOUT,this.logger=W.logger??console;let J="warn";this.logLevel=J,this.logLevel=iZ(W.logLevel,"ClientOptions.logLevel",this)??iZ(GZ("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=W.fetchOptions,this.maxRetries=W.maxRetries??2,this.fetch=W.fetch??D0(),G(this,vZ,P0,"f"),this._options=W,this.apiKey=typeof Z==="string"?Z:null,this.authToken=$}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){if(X.get("x-api-key")||X.get("authorization"))return;if(this.apiKey&&X.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&X.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(X){return w([await this.apiKeyAuth(X),await this.bearerAuth(X)])}async apiKeyAuth(X){if(this.apiKey==null)return;return w([{"X-Api-Key":this.apiKey}])}async bearerAuth(X){if(this.authToken==null)return;return w([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(X){return k0(X)}getUserAgent(){return`${this.constructor.name}/JS ${m}`}defaultIdempotencyKey(){return`stainless-node-retry-${cZ()}`}makeStatusError(X,Z,$,z){return A.generate(X,Z,$,z)}buildURL(X,Z,$){let z=!Y(this,U0,"m",Q1).call(this)&&$||this.baseURL,W=E0(X)?new URL(X):new URL(z+(z.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),J=this.defaultQuery(),Q=Object.fromEntries(W.searchParams);if(!uZ(J)||!uZ(Q))Z={...Q,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))W.search=this.stringifyQuery(Z);return W.toString()}_calculateNonstreamingTimeout(X){if(3600*X/128000>600)throw new N("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(X){}async prepareRequest(X,{url:Z,options:$}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,$){return this.request(Promise.resolve($).then((z)=>{return{method:X,path:Z,...z}}))}request(X,Z=null){return new r(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,$){let z=await X,W=z.maxRetries??this.maxRetries;if(Z==null)Z=W;await this.prepareOptions(z);let{req:J,url:Q,timeout:K}=await this.buildRequest(z,{retryCount:W-Z});await this.prepareRequest(J,{url:Q,options:z});let x="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),E=$===void 0?"":`, retryOf: ${$}`,O=Date.now();if(T(this).debug(`[${x}] sending request`,g({retryOfRequestLogID:$,method:z.method,url:Q,options:z,headers:J.headers})),z.signal?.aborted)throw new L;let k=new AbortController,C=await this.fetchWithTimeout(Q,J,K,k).catch(MX),F=Date.now();if(C instanceof globalThis.Error){let h=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new L;let _=b(C)||/timed? ?out/i.test(String(C)+("cause"in C?String(C.cause):""));if(Z)return T(this).info(`[${x}] connection ${_?"timed out":"failed"} - ${h}`),T(this).debug(`[${x}] connection ${_?"timed out":"failed"} (${h})`,g({retryOfRequestLogID:$,url:Q,durationMs:F-O,message:C.message})),this.retryRequest(z,Z,$??x);if(T(this).info(`[${x}] connection ${_?"timed out":"failed"} - error; no more retries left`),T(this).debug(`[${x}] connection ${_?"timed out":"failed"} (error; no more retries left)`,g({retryOfRequestLogID:$,url:Q,durationMs:F-O,message:C.message})),_)throw new EX;throw new o({cause:C})}let a=[...C.headers.entries()].filter(([h])=>h==="request-id").map(([h,_])=>", "+h+": "+JSON.stringify(_)).join(""),OX=`[${x}${E}${a}] ${J.method} ${Q} ${C.ok?"succeeded":"failed"} with status ${C.status} in ${F-O}ms`;if(!C.ok){let h=await this.shouldRetry(C);if(Z&&h){let NZ=`retrying, ${Z} attempts remaining`;return await f0(C.body),T(this).info(`${OX} - ${NZ}`),T(this).debug(`[${x}] response error (${NZ})`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,durationMs:F-O})),this.retryRequest(z,Z,$??x,C.headers)}let _=h?"error; no more retries left":"error; not retryable";T(this).info(`${OX} - ${_}`);let q0=await C.text().catch((NZ)=>MX(NZ).message),O0=UZ(q0),M0=O0?void 0:q0;throw T(this).debug(`[${x}] response error (${_})`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,message:M0,durationMs:Date.now()-O})),this.makeStatusError(C.status,O0,M0,C.headers)}return T(this).info(OX),T(this).debug(`[${x}] response start`,g({retryOfRequestLogID:$,url:C.url,status:C.status,headers:C.headers,durationMs:F-O})),{response:C,options:z,controller:k,requestLogID:x,retryOfRequestLogID:$,startTime:O}}getAPIList(X,Z,$){return this.requestAPIList(Z,$&&"then"in $?$.then((z)=>({method:"get",path:X,...z})):{method:"get",path:X,...$})}requestAPIList(X,Z){let $=this.makeRequest(Z,null,void 0);return new AZ(this,$,X)}async fetchWithTimeout(X,Z,$,z){let{signal:W,method:J,...Q}=Z||{},K=this._makeAbort(z);if(W)W.addEventListener("abort",K,{once:!0});let x=setTimeout(K,$),E=globalThis.ReadableStream&&Q.body instanceof globalThis.ReadableStream||typeof Q.body==="object"&&Q.body!==null&&Symbol.asyncIterator in Q.body,O={signal:z.signal,...E?{duplex:"half"}:{},method:"GET",...Q};if(J)O.method=J.toUpperCase();try{return await this.fetch.call(void 0,X,O)}finally{clearTimeout(x)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,$,z){let W,J=z?.get("retry-after-ms");if(J){let K=parseFloat(J);if(!Number.isNaN(K))W=K}let Q=z?.get("retry-after");if(Q&&!W){let K=parseFloat(Q);if(!Number.isNaN(K))W=K*1000;else W=Date.parse(Q)-Date.now()}if(W===void 0){let K=X.maxRetries??this.maxRetries;W=this.calculateDefaultRetryTimeoutMillis(Z,K)}return await F0(W),this.makeRequest(X,Z-1,$)}calculateDefaultRetryTimeoutMillis(X,Z){let W=Z-X,J=Math.min(0.5*Math.pow(2,W),8),Q=1-Math.random()*0.25;return J*Q*1000}calculateNonstreamingTimeout(X,Z){if(3600000*X/128000>600000||Z!=null&&X>Z)throw new N("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(X,{retryCount:Z=0}={}){let $={...X},{method:z,path:W,query:J,defaultBaseURL:Q}=$,K=this.buildURL(W,J,Q);if("timeout"in $)H0("timeout",$.timeout);$.timeout=$.timeout??this.timeout;let{bodyHeaders:x,body:E}=this.buildBody({options:$}),O=await this.buildHeaders({options:X,method:z,bodyHeaders:x,retryCount:Z});return{req:{method:z,headers:O,...$.signal&&{signal:$.signal},...globalThis.ReadableStream&&E instanceof globalThis.ReadableStream&&{duplex:"half"},...E&&{body:E},...this.fetchOptions??{},...$.fetchOptions??{}},url:K,timeout:$.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:$,retryCount:z}){let W={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();W[this.idempotencyHeader]=X.idempotencyKey}let J=w([W,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...B0(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(X),this._options.defaultHeaders,$,X.headers]);return this.validateHeaders(J),J.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let $=w([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&$.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:CZ(X)};else if(typeof X==="object"&&$.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return Y(this,vZ,"f").call(this,{body:X,headers:$})}}C0=M,vZ=new WeakMap,U0=new WeakSet,Q1=function(){return this.baseURL!=="https://api.anthropic.com"};M.Anthropic=C0;M.HUMAN_PROMPT=V1;M.AI_PROMPT=G1;M.DEFAULT_TIMEOUT=600000;M.AnthropicError=N;M.APIError=A;M.APIConnectionError=o;M.APIConnectionTimeoutError=EX;M.APIUserAbortError=L;M.NotFoundError=TX;M.ConflictError=LX;M.RateLimitError=jX;M.BadRequestError=AX;M.AuthenticationError=HX;M.InternalServerError=BX;M.PermissionDeniedError=FX;M.UnprocessableEntityError=SX;M.toFile=HZ;class WX extends M{constructor(){super(...arguments);this.completions=new UX(this),this.messages=new zX(this),this.models=new qX(this),this.beta=new S(this)}}WX.Completions=UX;WX.Messages=zX;WX.Models=qX;WX.Beta=S;export{WX as vj};
|