@shumai-one/shumai 0.4.2 → 0.4.4
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-071x515q.js +4 -0
- package/bin/{chunk-adekdctx.css → chunk-0ccg9ddn.css} +1 -1
- package/bin/chunk-0cmx7k4c.js +1 -0
- package/bin/chunk-0qaq0sp8.js +5 -0
- package/bin/chunk-0qjfahk9.js +2 -0
- package/bin/chunk-0zv3bks2.js +2 -0
- package/bin/chunk-16xax8kk.js +1 -0
- package/bin/chunk-1gvscz88.js +5 -0
- package/bin/chunk-1j27fzy1.js +2 -0
- package/bin/chunk-1t167cvj.js +11 -0
- package/bin/chunk-1xh34aew.js +2 -0
- package/bin/chunk-1zwajpwf.js +8 -0
- package/bin/chunk-2w5xqhjm.js +1 -0
- package/bin/chunk-3tedzb2j.js +54 -0
- package/bin/chunk-3ttrhqy3.js +2 -0
- package/bin/chunk-3zkasqb8.js +1 -0
- package/bin/chunk-453ykvaw.js +2 -0
- package/bin/chunk-4991gz3y.js +13 -0
- package/bin/chunk-4hkkdm2q.js +2 -0
- package/bin/chunk-4mjywsj8.js +3 -0
- package/bin/chunk-4v41a1r9.js +6 -0
- package/bin/chunk-4wy87hwd.js +3 -0
- package/bin/chunk-579e4wv4.js +3 -0
- package/bin/chunk-5adsx8x4.js +2 -0
- package/bin/chunk-5hg6kcfz.js +45 -0
- package/bin/chunk-5nm2jvg5.js +32 -0
- package/bin/chunk-5tcdwep5.js +11 -0
- package/bin/chunk-5vzrpz50.js +2 -0
- package/bin/chunk-6ghcj4a9.js +3 -0
- package/bin/chunk-77fmkpdz.js +10 -0
- package/bin/chunk-7bcxj1jd.js +2 -0
- package/bin/chunk-7gmdnsdg.js +2 -0
- package/bin/chunk-7jtmwt5a.js +3 -0
- package/bin/chunk-7kjgvxqa.js +2 -0
- package/bin/chunk-7pw1550a.js +2 -0
- package/bin/chunk-7rhz2gze.js +211 -0
- package/bin/chunk-837fky18.js +3 -0
- package/bin/chunk-84as6x83.js +1 -0
- package/bin/chunk-8e28hcny.js +2 -0
- package/bin/chunk-914bp49r.js +4 -0
- package/bin/chunk-97f2af6d.js +12 -0
- package/bin/chunk-98715kc3.js +2 -0
- package/bin/chunk-9ccw540k.js +2 -0
- package/bin/chunk-9t8n2des.js +2 -0
- package/bin/chunk-9ybt6vbm.js +1 -0
- package/bin/chunk-a6gx7f5q.js +1 -0
- package/bin/chunk-avwgktxb.js +2 -0
- package/bin/chunk-bkr5zm4h.js +2 -0
- package/bin/chunk-cbgq517y.js +2 -0
- package/bin/chunk-d27mm390.js +1 -0
- package/bin/chunk-dj92fss9.js +2 -0
- package/bin/chunk-dqxeztfa.js +2 -0
- package/bin/chunk-drepsbb4.js +2 -0
- package/bin/chunk-f6svp4dp.js +2 -0
- package/bin/chunk-fahk9h62.js +8 -0
- package/bin/chunk-fb40xxz3.js +3 -0
- package/bin/chunk-fnmwksnb.js +3 -0
- package/bin/chunk-fpc4p0j8.js +3 -0
- package/bin/chunk-fsyzs0tf.js +1 -0
- package/bin/chunk-fxecgp5k.js +1 -0
- package/bin/chunk-g3fpmyyn.js +3 -0
- package/bin/chunk-gc5sbfa5.js +2 -0
- package/bin/chunk-gdm6yfqq.js +2 -0
- package/bin/chunk-gk2q9a3f.js +2 -0
- package/bin/chunk-gt4csat6.js +3 -0
- package/bin/chunk-gye8gabk.js +2 -0
- package/bin/chunk-hk5rc6cd.js +24 -0
- package/bin/chunk-hm0dkzed.js +3 -0
- package/bin/chunk-hmpwg5za.js +16 -0
- package/bin/chunk-j1tkmcae.js +3 -0
- package/bin/chunk-j2bvj2yn.js +2 -0
- package/bin/chunk-jffktpqg.js +1 -0
- package/bin/chunk-jgs8an3h.js +18 -0
- package/bin/chunk-jmpb5633.js +2 -0
- package/bin/chunk-jrjnqx78.js +2 -0
- package/bin/chunk-k2k9vjq6.js +1 -0
- package/bin/chunk-kpgfqkp0.js +3 -0
- package/bin/chunk-ks8xzc95.js +3 -0
- package/bin/chunk-kswvyqq1.js +2 -0
- package/bin/chunk-m9pr03kn.js +2 -0
- package/bin/chunk-mfn9qjm4.js +2 -0
- package/bin/chunk-msfw3jmc.js +3 -0
- package/bin/chunk-mz0yjra0.js +5 -0
- package/bin/chunk-nbdw8fen.js +1 -0
- package/bin/chunk-nkdk229f.js +2 -0
- package/bin/chunk-nr20tvnw.js +3 -0
- package/bin/chunk-pazjhrnf.js +12 -0
- package/bin/chunk-q806pqeh.js +1 -0
- package/bin/chunk-qka4mkmj.js +2 -0
- package/bin/chunk-qsr1a0rp.js +2 -0
- package/bin/chunk-rchsme43.js +3 -0
- package/bin/chunk-reyxk4bw.js +2 -0
- package/bin/chunk-rhvv1vvk.js +3 -0
- package/bin/chunk-rq0n0vcc.js +2 -0
- package/bin/chunk-rqf7999q.js +42 -0
- package/bin/chunk-rssgmj7x.js +2 -0
- package/bin/chunk-ryzz5fht.js +2 -0
- package/bin/chunk-s2fnfyn9.js +2 -0
- package/bin/chunk-s2k4qntr.js +3 -0
- package/bin/chunk-snhsjs4x.js +299 -0
- package/bin/chunk-t2hy6tj9.js +2 -0
- package/bin/chunk-t7nsgg5k.js +4 -0
- package/bin/chunk-tm7f32c7.js +14 -0
- package/bin/chunk-trveq4wg.js +3 -0
- package/bin/chunk-vap4k11j.js +20 -0
- package/bin/chunk-vm5fx7td.js +3 -0
- package/bin/chunk-vy8gntez.js +1 -0
- package/bin/chunk-vyzptrea.js +2 -0
- package/bin/chunk-w4ghe71n.js +2 -0
- package/bin/chunk-wdsf44hs.js +2 -0
- package/bin/chunk-wjyaezs7.js +2 -0
- package/bin/chunk-wndm3px3.js +1 -0
- package/bin/chunk-x5jwwvs0.js +1 -0
- package/bin/chunk-x92cq59c.js +1 -0
- package/bin/chunk-xa18z1py.js +3 -0
- package/bin/chunk-xarsrs08.js +2 -0
- package/bin/chunk-xtf3c29c.css +1 -0
- package/bin/chunk-xx337zcw.js +2 -0
- package/bin/chunk-xz6713tj.js +2 -0
- package/bin/chunk-yfnem6se.js +2 -0
- package/bin/chunk-ytdwk2fq.js +2 -0
- package/bin/chunk-ze20rm02.js +7 -0
- package/bin/chunk-zw86wnwe.js +7 -0
- package/bin/chunk-zxk7q0zk.js +2 -0
- package/bin/{pdf.worker.min-szxdj13d.mjs → pdf.worker.min-vf48er29.mjs} +14423 -13889
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +841 -678
- package/package.json +18 -18
- package/prisma/migrations/20260904022457_add_agent_id_to_assets_and_audit_logs/migration.sql +17 -0
- package/prisma/migrations/20260906081230_default_denied_tools_delete_asset/migration.sql +15 -0
- package/prisma/migrations/20260907021754_add_asset_upload_id/migration.sql +2 -0
- package/prisma/schema.prisma +10 -0
- package/bin/chunk-07h4b77v.js +0 -2
- package/bin/chunk-0t4n4d5w.js +0 -4
- package/bin/chunk-1611z9jg.js +0 -2
- package/bin/chunk-1phqxp6z.js +0 -3
- package/bin/chunk-23hckrrz.js +0 -2
- package/bin/chunk-30z44j1g.js +0 -2
- package/bin/chunk-3j463k1g.js +0 -1
- package/bin/chunk-4181tdds.js +0 -14
- package/bin/chunk-480jtqng.js +0 -4
- package/bin/chunk-4c3g146q.js +0 -2
- package/bin/chunk-4ca0zt5e.js +0 -1
- package/bin/chunk-4d9bgmf2.js +0 -2
- package/bin/chunk-4ev56fss.js +0 -9
- package/bin/chunk-4gk52tjq.js +0 -45
- package/bin/chunk-4mdqkj4d.js +0 -1
- package/bin/chunk-4r91fggc.js +0 -2
- package/bin/chunk-50fb1x3w.js +0 -1
- package/bin/chunk-59gj1njz.js +0 -1
- package/bin/chunk-5pr0t7fb.js +0 -2
- package/bin/chunk-5vewxmz7.js +0 -3
- package/bin/chunk-62zx96pe.js +0 -2
- package/bin/chunk-63y0eb07.js +0 -2
- package/bin/chunk-6d5xrgfx.js +0 -2
- package/bin/chunk-6gbtz5bf.js +0 -67
- package/bin/chunk-6gjg5egq.js +0 -3
- package/bin/chunk-6m4jz9s1.js +0 -44
- package/bin/chunk-6s4x525w.js +0 -2
- package/bin/chunk-6w2wmvqs.js +0 -3
- package/bin/chunk-77d23vcn.js +0 -2
- package/bin/chunk-77m5p188.js +0 -2
- package/bin/chunk-7bvx087f.js +0 -1
- package/bin/chunk-7pfjfrjg.js +0 -5
- package/bin/chunk-7q10s127.js +0 -4
- package/bin/chunk-7thx8ctx.js +0 -3
- package/bin/chunk-8t4s91gh.js +0 -2
- package/bin/chunk-98ey5p2e.js +0 -3
- package/bin/chunk-9amndcyh.js +0 -6
- package/bin/chunk-9bk23g9x.js +0 -1
- package/bin/chunk-9mkcfy43.js +0 -1
- package/bin/chunk-9t3nsq5n.js +0 -2
- package/bin/chunk-9tjq99ds.js +0 -2
- package/bin/chunk-9wm9rwh1.js +0 -2
- package/bin/chunk-ab16fyg4.js +0 -4
- package/bin/chunk-arv0g2av.js +0 -1
- package/bin/chunk-aytj4zxg.js +0 -3
- package/bin/chunk-b1ypjqgp.js +0 -2
- package/bin/chunk-bdjv0ykq.js +0 -2
- package/bin/chunk-c1k86mfa.js +0 -10
- package/bin/chunk-caa96dgd.js +0 -2
- package/bin/chunk-ce4v2yjy.js +0 -1
- package/bin/chunk-cqh60y54.js +0 -3
- package/bin/chunk-cvq7zgw7.js +0 -1
- package/bin/chunk-d9mjbtp2.js +0 -2
- package/bin/chunk-dn7sbjws.js +0 -3
- package/bin/chunk-dxyq9h8n.js +0 -3
- package/bin/chunk-e3cabksx.js +0 -3
- package/bin/chunk-egcrbj94.js +0 -2
- package/bin/chunk-ev17v1mv.js +0 -2
- package/bin/chunk-evtpwg71.js +0 -2
- package/bin/chunk-f3e0nsv2.js +0 -2
- package/bin/chunk-f40gjqpq.js +0 -2
- package/bin/chunk-fe7822ak.js +0 -299
- package/bin/chunk-g8tkhw9j.js +0 -2
- package/bin/chunk-g9r0p4t8.js +0 -2
- package/bin/chunk-gbjyh9ms.js +0 -1
- package/bin/chunk-gtbsb39v.js +0 -3
- package/bin/chunk-gytz1q13.js +0 -13
- package/bin/chunk-h0fxysxs.js +0 -7
- package/bin/chunk-h8bdvsqt.js +0 -2
- package/bin/chunk-hag024w8.js +0 -2
- package/bin/chunk-hc6w5nw4.js +0 -7
- package/bin/chunk-j69dqc48.js +0 -2
- package/bin/chunk-jbtw1zym.js +0 -8
- package/bin/chunk-jc1vb7rj.js +0 -5
- package/bin/chunk-jdv78w9r.js +0 -2
- package/bin/chunk-jjs70y9v.js +0 -3
- package/bin/chunk-jmdar2gz.js +0 -2
- package/bin/chunk-jvwz10n4.js +0 -2
- package/bin/chunk-k47md1g4.js +0 -2
- package/bin/chunk-k4v0brcb.js +0 -2
- package/bin/chunk-k6n7c07e.js +0 -1
- package/bin/chunk-kk2cstsg.js +0 -2
- package/bin/chunk-knz4h56q.js +0 -12
- package/bin/chunk-kqqtt6bd.js +0 -3
- package/bin/chunk-kvyp1t4j.js +0 -7
- package/bin/chunk-kxskpgsq.js +0 -5
- package/bin/chunk-m6srbjcs.js +0 -2
- package/bin/chunk-mcc1scxs.js +0 -12
- package/bin/chunk-mq83a0kk.js +0 -2
- package/bin/chunk-mxm8g4q0.js +0 -1
- package/bin/chunk-nhpgdqq5.js +0 -2
- package/bin/chunk-nne496aa.js +0 -2
- package/bin/chunk-nqpb0r9h.js +0 -11
- package/bin/chunk-ns0zww9g.js +0 -2
- package/bin/chunk-ps4xfp23.js +0 -2
- package/bin/chunk-pz2ec6xt.js +0 -2
- package/bin/chunk-q163k309.js +0 -2
- package/bin/chunk-q1da61ps.js +0 -1
- package/bin/chunk-qrf0ady6.js +0 -68
- package/bin/chunk-qy28f25e.js +0 -2
- package/bin/chunk-r7s4ypw1.js +0 -2
- package/bin/chunk-ran23vm9.js +0 -1
- package/bin/chunk-rfvdc4n0.js +0 -2
- package/bin/chunk-rgthkvgx.js +0 -3
- package/bin/chunk-s39n3yw3.js +0 -2
- package/bin/chunk-s7wdd0g7.js +0 -8
- package/bin/chunk-s88ha5kx.js +0 -3
- package/bin/chunk-sf91bt9m.js +0 -2
- package/bin/chunk-sjwbjf9j.js +0 -2
- package/bin/chunk-t62076pv.js +0 -1
- package/bin/chunk-tbbwss3v.js +0 -3
- package/bin/chunk-tjcc7a6y.js +0 -24
- package/bin/chunk-tp6ab26e.js +0 -2
- package/bin/chunk-v2wxk9p5.js +0 -4
- package/bin/chunk-vbk6y4hk.js +0 -2
- package/bin/chunk-vfgfg5fk.js +0 -2
- package/bin/chunk-vm6c3xx9.js +0 -2
- package/bin/chunk-vsx96mt6.js +0 -3
- package/bin/chunk-wbyw1shz.js +0 -6
- package/bin/chunk-whh2vh50.css +0 -1
- package/bin/chunk-wjkcq65s.js +0 -2
- package/bin/chunk-wkefwkfp.js +0 -41
- package/bin/chunk-x7bsnk1e.js +0 -2
- package/bin/chunk-xbhw6bpz.js +0 -3
- package/bin/chunk-xg5yrcj5.js +0 -2
- package/bin/chunk-xg9xscqz.js +0 -1
- package/bin/chunk-xw2gpcsh.js +0 -3
- package/bin/chunk-ycq8ank7.js +0 -2
- package/bin/chunk-yp9hvkc5.js +0 -73
- package/bin/chunk-ytypyfkc.js +0 -65
- package/bin/chunk-z1kjmf60.js +0 -2
- package/bin/chunk-z36bx86r.js +0 -2
- package/bin/chunk-z7hdnecp.js +0 -3
- package/bin/chunk-zeby1cq7.js +0 -2
- package/bin/chunk-zs5e8z1w.js +0 -1
- package/bin/chunk-zxnyefg5.js +0 -2
- /package/bin/{chunk-24ke0th1.css → chunk-kegybs91.css} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{di,Gl,fi,Ql,Vl,Kl,Wl,Yl}from"./chunk-hmpwg5za.js";import{mn,hn}from"./chunk-4wy87hwd.js";import{je,Cr}from"./chunk-hm0dkzed.js";import{Na}from"./chunk-rchsme43.js";import{sn,qr}from"./chunk-trveq4wg.js";import{Yt}from"./chunk-nr20tvnw.js";var w=0,m=(e,a,n)=>{let i=new Yt;return(async()=>{let t={role:"assistant",content:[],api:"google-generative-ai",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let l=n?.apiKey;if(!l)throw Error(`No API key for provider: ${e.provider}`);let s=M(e,l,n?.headers),g=T(e,a,n),h=await n?.onPayload?.(g,e);if(h!==void 0)g=h;let b=await s.models.generateContentStream(g);i.push({type:"start",partial:t});let o=null,C=t.content,u=()=>C.length-1;for await(let c of b){t.responseId||=c.responseId;let p=c.candidates?.[0];if(p?.content?.parts)for(let r of p.content.parts){if(r.text!==void 0){let d=Gl(r);if(!o||d&&o.type!=="thinking"||!d&&o.type!=="text"){if(o)if(o.type==="text")i.push({type:"text_end",contentIndex:C.length-1,content:o.text,partial:t});else i.push({type:"thinking_end",contentIndex:u(),content:o.thinking,partial:t});if(d)o={type:"thinking",thinking:"",thinkingSignature:void 0},t.content.push(o),i.push({type:"thinking_start",contentIndex:u(),partial:t});else o={type:"text",text:""},t.content.push(o),i.push({type:"text_start",contentIndex:u(),partial:t})}if(o.type==="thinking")o.thinking+=r.text,o.thinkingSignature=fi(o.thinkingSignature,r.thoughtSignature),i.push({type:"thinking_delta",contentIndex:u(),delta:r.text,partial:t});else o.text+=r.text,o.textSignature=fi(o.textSignature,r.thoughtSignature),i.push({type:"text_delta",contentIndex:u(),delta:r.text,partial:t})}if(r.functionCall){if(o){if(o.type==="text")i.push({type:"text_end",contentIndex:u(),content:o.text,partial:t});else i.push({type:"thinking_end",contentIndex:u(),content:o.thinking,partial:t});o=null}let d=r.functionCall.id,f={type:"toolCall",id:!d||t.content.some((I)=>I.type==="toolCall"&&I.id===d)?`${r.functionCall.name}_${Date.now()}_${++w}`:d,name:r.functionCall.name||"",arguments:r.functionCall.args??{},...r.thoughtSignature&&{thoughtSignature:r.thoughtSignature}};t.content.push(f),i.push({type:"toolcall_start",contentIndex:u(),partial:t}),i.push({type:"toolcall_delta",contentIndex:u(),delta:JSON.stringify(f.arguments),partial:t}),i.push({type:"toolcall_end",contentIndex:u(),toolCall:f,partial:t})}}if(p?.finishReason){if(t.stopReason=Yl(p.finishReason),t.content.some((r)=>r.type==="toolCall"))t.stopReason="toolUse"}if(c.usageMetadata)t.usage={input:(c.usageMetadata.promptTokenCount||0)-(c.usageMetadata.cachedContentTokenCount||0),output:(c.usageMetadata.candidatesTokenCount||0)+(c.usageMetadata.thoughtsTokenCount||0),cacheRead:c.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:c.usageMetadata.thoughtsTokenCount||0,totalTokens:c.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},sn(e,t.usage)}if(o)if(o.type==="text")i.push({type:"text_end",contentIndex:u(),content:o.text,partial:t});else i.push({type:"thinking_end",contentIndex:u(),content:o.thinking,partial:t});if(n?.signal?.aborted)throw Error("Request was aborted");if(t.stopReason==="aborted"||t.stopReason==="error")throw Error("An unknown error occurred");i.push({type:"done",reason:t.stopReason,message:t}),i.end()}catch(l){for(let s of t.content)if("index"in s)delete s.index;t.stopReason=n?.signal?.aborted?"aborted":"error",t.errorMessage=hn(mn(l)),i.push({type:"error",reason:t.stopReason,error:t}),i.end()}})(),i},B=(e,a,n)=>{let i=n?.apiKey;if(!i)throw Error(`No API key for provider: ${e.provider}`);let t=Cr(e,a,n,i);if(!n?.reasoning)return m(e,a,{...t,thinking:{enabled:!1}});let l=qr(e,n.reasoning),s=l==="off"?"high":l,g=e;if(y(g)||x(g)||k(g))return m(e,a,{...t,thinking:{enabled:!0,level:S(s,g)}});return m(e,a,{...t,thinking:{enabled:!0,budgetTokens:R(g,s,n.thinkingBudgets)}})};function M(e,a,n){let i={};if(e.baseUrl)i.baseUrl=e.baseUrl,i.apiVersion="";let t=Na({...e.headers,...n});if(t)i.headers=t;return new di({apiKey:a,httpOptions:Object.keys(i).length>0?i:void 0})}function T(e,a,n={}){let i=Ql(e,a),t={};if(n.temperature!==void 0)t.temperature=n.temperature;if(n.maxTokens!==void 0)t.maxOutputTokens=n.maxTokens;let l=a.tools?.length?Wl(a.tools,n.toolChoice,Kl(e.id)):void 0,s={...Object.keys(t).length>0&&t,...a.systemPrompt&&{systemInstruction:je(a.systemPrompt)},...a.tools&&a.tools.length>0&&{tools:Vl(a.tools)},...l!==void 0&&{toolConfig:{functionCallingConfig:{mode:l}}}};if(n.thinking?.enabled&&e.reasoning){let h={includeThoughts:!0};if(n.thinking.level!==void 0)h.thinkingLevel=n.thinking.level;else if(n.thinking.budgetTokens!==void 0)h.thinkingBudget=n.thinking.budgetTokens;s.thinkingConfig=h}else if(e.reasoning&&n.thinking&&!n.thinking.enabled)s.thinkingConfig=v(e);if(n.signal){if(n.signal.aborted)throw Error("Request aborted");s.abortSignal=n.signal}return{model:e.id,contents:i,config:s}}function k(e){return/gemma-?4/.test(e.id.toLowerCase())}function y(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function x(e){let a=e.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(a)||a==="gemini-flash-latest"||a==="gemini-flash-lite-latest"}function v(e){if(y(e))return{thinkingLevel:"LOW"};if(x(e))return{thinkingLevel:"MINIMAL"};if(k(e))return{thinkingLevel:"MINIMAL"};return{thinkingBudget:0}}function S(e,a){if(y(a))switch(e){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}if(k(a))switch(e){case"minimal":case"low":return"MINIMAL";case"medium":case"high":return"HIGH"}switch(e){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function R(e,a,n){if(n?.[a]!==void 0)return n[a];if(e.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[a];if(e.id.includes("2.5-flash-lite"))return{minimal:512,low:2048,medium:8192,high:24576}[a];if(e.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[a];return-1}export{m as stream,B as streamSimple};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Dr,Vs,ef,e,m,d,x,F,a,r,I,y,l,s}from"./chunk-3tedzb2j.js";function c(t,n){let o={};if(!Object.keys(n).length)return o=t,o;for(let[u,i]of Object.entries(t)){let p=n[u];if(p===null)continue;o[p??u]=i}return o}function _(t){let n={};for(let[o,u]of Object.entries(t))if(typeof u<"u")n[o]=u;return n}class w extends Error{rawValue;rawMessage;static[Symbol.hasInstance](t){if(!(t instanceof Error))return!1;if(!("rawValue"in t))return!1;if(!("rawMessage"in t))return!1;if(!("pretty"in t))return!1;if(typeof t.pretty!=="function")return!1;return!0}constructor(t,n,o){super(`${t}: ${n}`);this.name="SDKValidationError",this.cause=n,this.rawValue=o,this.rawMessage=t}pretty(){if(this.cause instanceof Vs)return`${this.rawMessage}
|
|
3
|
+
${Qd(this.cause)}`;else return this.toString()}}function Qd(t){return ef(t)}function pi(t){return{ok:!0,value:t}}function Yo(t){return{ok:!1,error:t}}async function k(t){let n=await t;if(!n.ok)throw n.error;return n.value}function b(t,n,o){try{return pi(n(t))}catch(u){return Yo(new w(o,u,t))}}var Fo=r({prompt_tokens:m().default(0),completion_tokens:m().default(0),total_tokens:m().default(0),prompt_audio_seconds:s(m()).optional()}).catchall(x()).transform((t)=>c(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",prompt_audio_seconds:"promptAudioSeconds"})),ec=r({promptTokens:m().default(0),completionTokens:m().default(0),totalTokens:m().default(0),promptAudioSeconds:s(m()).optional()}).catchall(x()).transform((t)=>({...c(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",promptAudioSeconds:"prompt_audio_seconds"})}));function D(t){return O++,t}var O=0,v=0;function N(){v++;let t=O;return{end:(n)=>{let o=O-t;if(O=t+(n??o),--v===0)O=0;return o}}}function J(t){let n=Object.values(t);return I([...n.map((o)=>l(o)),e().transform((o)=>D(o))])}function ji(t){let n=Object.values(t).filter((o)=>typeof o==="number");return I([...n.map((o)=>l(o)),m().transform((o)=>D(o))])}function ct(t){return e()}function Wp(t){return m()}var P=Symbol("UNKNOWN");function K(t){return typeof t==="object"&&t!==null&&P in t}function Ve(t,n,o={}){let{unknownValue:u="UNKNOWN",outputPropertyName:i}=o;return F().transform((p)=>{let h=Object.defineProperties({raw:p,[i??t]:u,isUnknown:!0},{[P]:{value:!0,enumerable:!1,configurable:!1}});if(!(typeof p==="object"&&p!==null))return h;let S=p[t];if(typeof S!=="string")return h;if(!(S in n))return h;let T=n[S];if(!T)return h;let g=N(),C=T.safeParse(p);if(!C.success)return g.end(0),h;if(g.end(),i)C.data[i]=S;return C.data})}var Y=/^\d{4}-\d{2}-\d{2}$/;class j{serialized;static today(){return new j(new Date)}constructor(t){if(typeof t==="string"&&!Y.test(t))throw RangeError("RFCDate: date strings must be in the format YYYY-MM-DD: "+t);let n=new Date(t);if(isNaN(+n))throw RangeError("RFCDate: invalid date provided: "+t);if(this.serialized=n.toISOString().slice(0,10),!Y.test(this.serialized))throw TypeError(`RFCDate: failed to build valid date with given value: ${t} serialized to ${this.serialized}`)}toJSON(){return this.toString()}toString(){return this.serialized}}function M(t){return F().transform((n,o)=>{let u=[],i=t.map(()=>[]),p=N();for(let[z,S]of t.entries()){let T=N(),g=S.safeParse(n),C=T.end(),ie=0;if(g.success){u.push({data:g.data,inexactCount:C,zeroDefaultCount:0,fieldCount:-1});continue}i[z].push(...g.error.issues)}if(u.length===0)return p.end(0),o.addIssue({input:n,code:"invalid_union",errors:i}),Dr;let h=u[0];for(let z of u){if(u.length>1)z.fieldCount=ne(z.data);h=te(z,h)}return p.end(h.inexactCount),h.data})}function te(t,n){let o=t.inexactCount===0,u=n.inexactCount===0;if(o!==u)return o?t:n;let i=t.fieldCount-t.zeroDefaultCount,p=n.fieldCount-n.zeroDefaultCount;if(i!==p)return i>p?t:n;return t.inexactCount<n.inexactCount?t:n}function ne(t){let n=0,o=[t],u=0;while(u<o.length){let i=o[u++];if(i===void 0||K(i))continue;let p=typeof i;if(i===null||p==="number"||p==="string"||p==="boolean"||p==="bigint"||i instanceof Date||i instanceof j){n++;continue}if(Array.isArray(i)){o.push(...i);continue}if(p==="object")o.push(...Object.values(i))}return n}var B=r({type:l("input_audio"),input_audio:e()}).transform((t)=>c(t,{input_audio:"inputAudio"})),V=r({type:l("input_audio"),inputAudio:e()}).transform((t)=>c(t,{inputAudio:"input_audio"}));var Ea=r({type:l("document_url").default("document_url"),document_url:e(),document_name:s(e()).optional()}).transform((t)=>c(t,{document_url:"documentUrl",document_name:"documentName"})),zs=r({type:l("document_url").default("document_url"),documentUrl:e(),documentName:s(e()).optional()}).transform((t)=>c(t,{documentUrl:"document_url",documentName:"document_name"}));var W=r({type:l("file").default("file"),file_id:e()}).transform((t)=>c(t,{file_id:"fileId"})),Jl=r({type:l("file").default("file"),fileId:e()}).transform((t)=>c(t,{fileId:"file_id"}));var Z={Low:"low",Auto:"auto",High:"high"},q=J(Z),G=ct(Z);var L=r({url:e(),detail:s(q).optional()}),A=r({url:e(),detail:s(G).optional()});var De=M([L,e()]),Ee=M([A,e()]);var Ia=r({type:l("image_url").default("image_url"),image_url:M([L,e()])}).transform((t)=>c(t,{image_url:"imageUrl"})),js=r({type:l("image_url").default("image_url"),imageUrl:M([A,e()])}).transform((t)=>c(t,{imageUrl:"image_url"}));var Pe=M([m(),e()]),Me=M([m(),e()]);var R=r({type:l("reference").default("reference"),reference_ids:a(M([m(),e()]))}).transform((t)=>c(t,{reference_ids:"referenceIds"})),U=r({type:l("reference").default("reference"),referenceIds:a(M([m(),e()]))}).transform((t)=>c(t,{referenceIds:"reference_ids"}));var Jo=r({type:l("text").default("text"),text:e()}),Xo=r({type:l("text").default("text"),text:e()});var H={WebSearch:"web_search",WebSearchPremium:"web_search_premium",CodeInterpreter:"code_interpreter",ImageGeneration:"image_generation",DocumentLibrary:"document_library"},nn=J(H),qs=ct(H);var qe=M([nn,e()]),Ge=M([qs,e()]);var mi=r({type:l("tool_reference").default("tool_reference"),tool:M([nn,e()]),title:e(),url:s(e()).optional(),favicon:s(e()).optional(),description:s(e()).optional()}),Xl=r({type:l("tool_reference").default("tool_reference"),tool:M([qs,e()]),title:e(),url:s(e()).optional(),favicon:s(e()).optional(),description:s(e()).optional()});var nt=M([mi,Jo,R]),ot=M([Xl,Xo,U]);var Ta=r({type:l("thinking").default("thinking"),thinking:a(M([mi,Jo,R])),signature:s(e()).optional(),closed:d().optional()}),Ma=r({type:l("thinking").default("thinking"),thinking:a(M([Xl,Xo,U])),signature:s(e()).optional(),closed:d().optional()});var qi=Ve("type",{image_url:Ia.and(r({type:l("image_url")})),document_url:Ea.and(r({type:l("document_url")})),text:Jo.and(r({type:l("text")})),reference:R.and(r({type:l("reference")})),file:W.and(r({type:l("file")})),thinking:Ta.and(r({type:l("thinking")})),input_audio:B}),Hs=I([js.and(r({type:l("image_url")})),zs.and(r({type:l("document_url")})),Xo.and(r({type:l("text")})),U.and(r({type:l("reference")})),Jl.and(r({type:l("file")})),Ma.and(r({type:l("thinking")})),V]);var zt=M([y(e(),x()),e()]),St=M([y(e(),x()),e()]);var Q=r({name:e(),arguments:M([y(e(),x()),e()])}),X=r({name:e(),arguments:M([y(e(),x()),e()])});var du=r({id:e().default("null"),type:e().optional(),function:Q,index:m().default(0)}),Yp=r({id:e().default("null"),type:e().optional(),function:X,index:m().default(0)});var Jt=M([e(),a(qi)]);var fu=r({role:s(e()).optional(),content:s(M([e(),a(qi)])).optional(),tool_calls:s(a(du)).optional(),tool_call_id:s(e()).optional(),index:s(m()).optional(),metadata:s(y(e(),x())).optional()}).transform((t)=>c(t,{tool_calls:"toolCalls",tool_call_id:"toolCallId"}));var oe={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"},re=J(oe),ee=r({index:m(),delta:fu,finish_reason:s(re)}).transform((t)=>c(t,{finish_reason:"finishReason"}));var Vd=r({id:e(),object:e().optional(),created:m().optional(),model:e(),usage:Fo.optional(),choices:a(ee)});function Jp(t){return b(t,(n)=>Vd.parse(JSON.parse(n)),"Failed to parse 'CompletionChunk' from JSON")}
|
|
4
|
+
export{Qd,pi,Yo,k,b,c,_,J,ji,ct,Wp,Ve,M,Ea,zs,Jl,Ia,js,Jo,Xo,nn,qs,mi,Xl,Ta,Ma,qi,Hs,du,Yp,fu,Fo,ec,Vd,Jp};
|