@shumai-one/shumai 0.2.0 → 0.2.2
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-0aj303as.js +3 -0
- package/bin/{chunk-kbzm1pwx.js → chunk-0qkj838r.js} +1 -1
- package/bin/{chunk-5a2maxwp.js → chunk-0rxhc7ka.js} +2 -2
- package/bin/chunk-0xbf8bcg.js +2 -0
- package/bin/{chunk-xh2ntgmk.js → chunk-14fh4s1a.js} +2 -2
- package/bin/{chunk-6mn3jqm9.js → chunk-15sefy5t.js} +2 -2
- package/bin/{chunk-mjan6b09.js → chunk-1wm57c6y.js} +3 -3
- package/bin/{chunk-pf8edn5x.js → chunk-1xpec5r8.js} +2 -2
- package/bin/chunk-23d3968z.js +2 -0
- package/bin/{chunk-r3n9zpfw.js → chunk-262hkppb.js} +2 -2
- package/bin/{chunk-3n1k9qt5.js → chunk-29tx9qe2.js} +1 -1
- package/bin/chunk-2aamsc5v.js +2 -0
- package/bin/chunk-2aascrtb.js +2 -0
- package/bin/chunk-2dsmsa6a.js +3 -0
- package/bin/chunk-2g12s6mc.js +2 -0
- package/bin/chunk-31baz5n0.js +2 -0
- package/bin/{chunk-a5kfa0k9.js → chunk-3rmc8nz6.js} +1 -1
- package/bin/{chunk-dyybbn07.js → chunk-46ar48f9.js} +1 -1
- package/bin/chunk-4e3jbp84.js +1 -0
- package/bin/chunk-4jk0y1w1.js +1 -0
- package/bin/{chunk-7ddaxdpf.js → chunk-4qpa7b5t.js} +1 -1
- package/bin/{chunk-8wv3kdz9.js → chunk-54tr7y2x.js} +2 -2
- package/bin/{chunk-ehfk24cf.js → chunk-5d2q46mx.js} +1 -1
- package/bin/{chunk-2cmg5sfn.js → chunk-5m9be8an.js} +2 -2
- package/bin/{chunk-yk3k5g5w.js → chunk-5r8858hx.js} +2 -2
- package/bin/{chunk-fwe9g818.js → chunk-5t6c3038.js} +1 -1
- package/bin/chunk-6z65xd0w.js +3 -0
- package/bin/{chunk-cp18trqb.js → chunk-77r8w95d.js} +2 -2
- package/bin/chunk-7b17fb36.js +6 -0
- package/bin/chunk-7e06b2zb.js +2 -0
- package/bin/{chunk-29ectt6g.js → chunk-7hsgmjpa.js} +2 -2
- package/bin/chunk-7we7ex0m.js +3 -0
- package/bin/{chunk-6r9w7z15.js → chunk-88fg1sw7.js} +2 -2
- package/bin/chunk-891h8br6.js +3 -0
- package/bin/{chunk-m7jfszqt.js → chunk-8mkfgcvb.js} +2 -2
- package/bin/chunk-8qg47kj6.js +3 -0
- package/bin/chunk-8tf6kgdj.js +2 -0
- package/bin/{chunk-s8d2045p.js → chunk-8wqfkm4c.js} +1 -1
- package/bin/{chunk-3rajscaz.js → chunk-922nnh39.js} +1 -1
- package/bin/{chunk-aakzq0w1.js → chunk-925q4paa.js} +1 -1
- package/bin/{chunk-frm7vz6v.js → chunk-92xxys10.js} +6 -6
- package/bin/chunk-97jzve52.js +4 -0
- package/bin/{chunk-w4y97tzy.js → chunk-9ab6k4rq.js} +1 -1
- package/bin/chunk-9avkn3x1.js +3 -0
- package/bin/{chunk-22dje1f5.js → chunk-9h027f50.js} +1 -1
- package/bin/{chunk-ec88pb09.js → chunk-9h3ds7rn.js} +2 -2
- package/bin/chunk-av71yjaa.js +1 -0
- package/bin/{chunk-xpqcvxej.js → chunk-b8js74jk.js} +1 -1
- package/bin/chunk-bd71dp4j.js +8 -0
- package/bin/{chunk-yhj8c5re.js → chunk-bs0fjz3w.js} +2 -2
- package/bin/chunk-byqc8tzq.js +1 -0
- package/bin/chunk-c45rh4hk.js +3 -0
- package/bin/chunk-ccw7mjgq.js +5 -0
- package/bin/{chunk-3x62t1m0.js → chunk-cxhmr356.js} +1 -1
- package/bin/chunk-d2vxmn9v.js +3 -0
- package/bin/chunk-d3wmdjze.js +8 -0
- package/bin/{chunk-z42cyc20.js → chunk-de99643r.js} +2 -2
- package/bin/{chunk-4kk5g619.js → chunk-dghtwyq1.js} +2 -2
- package/bin/chunk-dqgv5yy1.js +6 -0
- package/bin/chunk-e3s3rz2e.js +12 -0
- package/bin/chunk-e52nga6c.js +3 -0
- package/bin/chunk-e7ndw3hg.js +12 -0
- package/bin/chunk-f14sqw1d.js +1 -0
- package/bin/chunk-f7sbkfmk.js +2 -0
- package/bin/{chunk-mnv6pj0k.js → chunk-fa2g2wge.js} +2 -2
- package/bin/{chunk-fcb14agg.js → chunk-fbte2rmd.js} +1 -1
- package/bin/chunk-fcvtgx1y.js +7 -0
- package/bin/chunk-fd5a3pdd.js +1 -0
- package/bin/{chunk-49ej1y67.js → chunk-fepymbka.js} +2 -2
- package/bin/{chunk-j8q688sx.js → chunk-fz88kkk1.js} +2 -2
- package/bin/chunk-g6zzg6v2.js +1 -0
- package/bin/chunk-g8th86na.js +2 -0
- package/bin/chunk-gswbc6y9.js +2 -0
- package/bin/{chunk-d1ka11hc.js → chunk-gtrc5ka2.js} +1 -1
- package/bin/chunk-h0ytx8zc.js +2 -0
- package/bin/{chunk-gdm6y33a.js → chunk-hkbybhww.js} +1 -1
- package/bin/chunk-hr97a5j5.js +4 -0
- package/bin/{chunk-dypsm6m2.js → chunk-j8qtab70.js} +1 -1
- package/bin/{chunk-hdk93ghf.js → chunk-jf3vn5c3.js} +2 -2
- package/bin/{chunk-ajqsprm0.js → chunk-kfhtk3eh.js} +2 -2
- package/bin/chunk-kr06nrbx.js +2 -0
- package/bin/{chunk-9rw65s3e.js → chunk-m4zpf9gg.js} +2 -2
- package/bin/{chunk-y1xs4c5j.js → chunk-mqjzmn0e.js} +1 -1
- package/bin/{chunk-d2y3rbjm.js → chunk-mzg1h07d.js} +1 -1
- package/bin/{chunk-ysq64j13.js → chunk-n4meg9wb.js} +1 -1
- package/bin/{chunk-acxm86fh.js → chunk-nrwna4ha.js} +1 -1
- package/bin/chunk-nyhqy6q2.js +62 -0
- package/bin/{chunk-4zq8vxcy.css → chunk-pmswtfe3.css} +1 -1
- package/bin/chunk-pq18zenh.js +2 -0
- package/bin/chunk-pxw97qbq.js +3 -0
- package/bin/chunk-q09dfja5.js +3 -0
- package/bin/{chunk-m54p1cvp.js → chunk-q24epdh8.js} +2 -2
- package/bin/{chunk-k5w64spz.js → chunk-qksb0v3c.js} +2 -2
- package/bin/chunk-qqk51620.js +2 -0
- package/bin/chunk-r0w920zb.js +1 -0
- package/bin/{chunk-08m8mzfa.js → chunk-re0b7sj7.js} +1 -1
- package/bin/chunk-rtngbgpk.js +7 -0
- package/bin/{chunk-5tmf3c0g.js → chunk-ry33f2qk.js} +2 -2
- package/bin/{chunk-9n0etqsy.js → chunk-s1n39qte.js} +1 -1
- package/bin/{chunk-3qdn3pty.js → chunk-s46zwr4p.js} +1 -1
- package/bin/chunk-s8t74q9m.js +1 -0
- package/bin/chunk-sd86v1e6.js +1 -0
- package/bin/{chunk-kpy0kpna.js → chunk-srn8t0v7.js} +2 -2
- package/bin/chunk-szzff7gd.js +1 -0
- package/bin/{chunk-fwf8yne2.js → chunk-t3t6021k.js} +2 -2
- package/bin/{chunk-eadb78m8.js → chunk-ta7bfdrn.js} +1 -1
- package/bin/chunk-thsbcbay.js +8 -0
- package/bin/chunk-tspps87j.js +1 -0
- package/bin/chunk-w7dn1m95.js +2 -0
- package/bin/chunk-w88219ex.js +3 -0
- package/bin/{chunk-pqm0g14r.js → chunk-wc8sc9r9.js} +2 -2
- package/bin/chunk-wg98cacx.js +2 -0
- package/bin/chunk-wsyg4rwg.js +2 -0
- package/bin/{chunk-n5hfy93f.js → chunk-xcwbg4w9.js} +3 -3
- package/bin/{chunk-dgx2zxze.js → chunk-xyjw8w3r.js} +2 -2
- package/bin/chunk-y2qp11v9.js +1 -0
- package/bin/{chunk-1fpqq6ed.js → chunk-ybhgmvxa.js} +2 -2
- package/bin/{chunk-1wq9hjjr.js → chunk-ygz6pawn.js} +1 -1
- package/bin/{chunk-mv79zk8q.js → chunk-ymeycphq.js} +3 -3
- package/bin/{chunk-wv4fe1fj.js → chunk-zemrvz79.js} +2 -2
- package/bin/{chunk-3rt9mnj3.js → chunk-ztmj61z9.js} +1 -1
- package/bin/chunk-zzx99j8t.js +2 -0
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +308 -283
- package/package.json +7 -7
- package/prisma/migrations/20260722022359_add_skill_permission/migration.sql +2 -0
- package/prisma/migrations/20260723025234_add_ai_usage_table/migration.sql +28 -0
- package/prisma/migrations/20260723032755_add_ai_usage_unique_constraint/migration.sql +8 -0
- package/prisma/schema.prisma +26 -0
- package/bin/chunk-09wp20mv.js +0 -1
- package/bin/chunk-0at8vxt5.js +0 -3
- package/bin/chunk-0zv7f9ca.js +0 -2
- package/bin/chunk-2k4vp654.js +0 -2
- package/bin/chunk-2s5a64nr.js +0 -2
- package/bin/chunk-2tbya52d.js +0 -2
- package/bin/chunk-2vs3evc7.js +0 -14
- package/bin/chunk-33169en9.js +0 -8
- package/bin/chunk-33ee1cvv.js +0 -2
- package/bin/chunk-3m39v371.js +0 -1
- package/bin/chunk-4hnrd4qh.js +0 -2
- package/bin/chunk-6c4c7t0n.js +0 -1
- package/bin/chunk-6frqqxkv.js +0 -1
- package/bin/chunk-7rhjej0x.js +0 -3
- package/bin/chunk-7wvgtw25.js +0 -3
- package/bin/chunk-8s0ae37g.js +0 -1
- package/bin/chunk-94h8644q.js +0 -2
- package/bin/chunk-ac2ky3q0.js +0 -12
- package/bin/chunk-axx5bh38.js +0 -2
- package/bin/chunk-cthpdt54.js +0 -11
- package/bin/chunk-d0earxhc.js +0 -4
- package/bin/chunk-d0n8nxp3.js +0 -3
- package/bin/chunk-d22pyc5n.js +0 -1
- package/bin/chunk-dmgjse02.js +0 -4
- package/bin/chunk-e5833tbd.js +0 -2
- package/bin/chunk-g7wrxnmd.js +0 -1
- package/bin/chunk-gk7158n4.js +0 -2
- package/bin/chunk-hb5v9ees.js +0 -2
- package/bin/chunk-jrvrg4fx.js +0 -1
- package/bin/chunk-k712q1zj.js +0 -2
- package/bin/chunk-kef0rnwn.js +0 -1
- package/bin/chunk-n296vcfw.js +0 -3
- package/bin/chunk-n6jgyv4y.js +0 -3
- package/bin/chunk-nar4s9v9.js +0 -3
- package/bin/chunk-nn8e9j7c.js +0 -1
- package/bin/chunk-nwtb6dt1.js +0 -62
- package/bin/chunk-ps4h3387.js +0 -5
- package/bin/chunk-q4f5vvtx.js +0 -2
- package/bin/chunk-qqesrgjk.js +0 -7
- package/bin/chunk-qz9xht6d.js +0 -2
- package/bin/chunk-symna5cj.js +0 -1
- package/bin/chunk-twzgpwst.js +0 -2
- package/bin/chunk-vgvmt2m1.js +0 -2
- package/bin/chunk-w4t9n9te.js +0 -6
- package/bin/chunk-z14hh99h.js +0 -2
- package/bin/chunk-zsdwska1.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Kh as B,Lh as J,Qh as $,Sh as w,mh as u,th as z}from"./chunk-nyhqy6q2.js";import{Vk as b}from"./chunk-0qkj838r.js";var E=null,g=J((p)=>({projectState:null,setProjectState:(j)=>{if(E)clearTimeout(E),E=null;p({projectState:j})},clearProjectState:()=>{if(E)clearTimeout(E);E=setTimeout(()=>{p({projectState:null}),E=null},10)}}));var H=J((p)=>({isChatbotOpen:!1,setIsChatbotOpen:(j)=>p({isChatbotOpen:j}),isHistoryMode:!1,setIsHistoryMode:(j)=>p({isHistoryMode:j}),currentSessionId:null,setCurrentSessionId:(j)=>p({currentSessionId:j}),chatAssets:[],addAssets:(j)=>p((c)=>{let f=new Set(c.chatAssets.map((P)=>P.id)),F=j.filter((P)=>!f.has(P.id));return{chatAssets:[...c.chatAssets,...F]}}),removeAsset:(j)=>p((c)=>({chatAssets:c.chatAssets.filter((f)=>f.id!==j)})),clearAssets:()=>p({chatAssets:[]}),messages:[],setMessages:(j)=>p({messages:j}),historySessions:[],setHistorySessions:(j)=>p({historySessions:j}),isStreaming:!1,setIsStreaming:(j)=>p({isStreaming:j}),selectedAgentId:null,setSelectedAgentId:(j)=>p({selectedAgentId:j}),scrollTop:0,isAtBottom:!0,setScrollState:(j,c)=>p({scrollTop:j,isAtBottom:c}),fetchHistorySessions:async(j)=>{try{let c=await w.api.teams[":teamId"].chat.sessions.$get({param:{teamId:j},query:{first:"50"}});if(c.ok){let f=await c.json();p({historySessions:f.data||[]})}}catch(c){console.error("Failed to fetch history sessions:",c)}},loadSession:async(j,c)=>{try{let f=await w.api.teams[":teamId"].chat.sessions[":sessionId"].messages.$get({param:{teamId:j,sessionId:c}});if(f.ok){let F=await f.json(),T=H.getState().historySessions.find((O)=>O.id===c)?.agentId||null;p({currentSessionId:c,messages:F,isHistoryMode:!1,scrollTop:0,isAtBottom:!0,...T?{selectedAgentId:T}:{}})}else throw Error("Failed to load session messages")}catch(f){let F=f instanceof Error?f.message:"Failed to load session";$.error(F)}},deleteSession:async(j,c)=>{try{if((await w.api.teams[":teamId"].chat.sessions[":sessionId"].$delete({param:{teamId:j,sessionId:c}})).ok)$.success("Session deleted successfully"),p((F)=>({historySessions:F.historySessions.filter((P)=>P.id!==c),currentSessionId:F.currentSessionId===c?null:F.currentSessionId,messages:F.currentSessionId===c?[]:F.messages}));else throw Error("Failed to delete session")}catch(f){let F=f instanceof Error?f.message:"Failed to delete session";$.error(F)}},startNewSession:()=>{p({currentSessionId:null,messages:[],chatAssets:[],scrollTop:0,isAtBottom:!0})},sendMessage:async(j,c,f,F)=>{let P=H.getState();if(P.isStreaming)return;let T=`temp-${Date.now()}`,O={id:T,role:"user",content:[{type:"text",text:c}],timestamp:Date.now()},R=[...P.messages];if(P.chatAssets.length>0){let G={id:`temp-context-${Date.now()}`,role:"custom",customType:"context_display_info",details:{assets:P.chatAssets.map((k)=>({id:k.id,name:k.name,type:k.type}))},timestamp:Date.now()-1};R.push(G)}R.push(O),p({messages:R,isStreaming:!0,chatAssets:[],isAtBottom:!0});let v=P.chatAssets.map((K)=>K.id),Y=P.selectedAgentId;if(!Y){$.error("No agent selected");return}try{let K=await w.api.teams[":teamId"].chat.$post({param:{teamId:j},json:{agentId:Y,textPrompt:c,assetIds:v,sessionId:P.currentSessionId||void 0,contextAssetId:F,projectId:f}});if(!K.ok)throw Error("Failed to start chat");let G=K.headers.get("x-session-id");if(G&&!P.currentSessionId)p({currentSessionId:G});let k=K.body?.getReader();if(!k)throw Error("No stream body");let U=new TextDecoder,V="";while(!0){let{done:A,value:y}=await k.read();if(A)break;V+=U.decode(y,{stream:!0});let Z=V.split(`
|
|
2
2
|
`);V=Z.pop()||"";for(let C of Z){let W=C.trim();if(!W)continue;if(W.startsWith("data: ")){let M=W.slice(6);try{let Q=JSON.parse(M);if(Q.type==="session"){if(!H.getState().currentSessionId)p({currentSessionId:Q.sessionId})}else if(Q.type==="entry"){let D=Q.entry;p((_)=>{let h=_.messages.some((q)=>q.id===D.id),X=_.messages.filter((q)=>{if(D.role==="user"&&!h)return!(q.id.startsWith("temp-")&&!q.id.startsWith("temp-context-"));if(D.role==="custom"&&D.customType==="context_display_info"&&!h)return!q.id.startsWith("temp-context-");return!0}),N=X.findIndex((q)=>q.id===D.id);if(N!==-1){let q=[...X];return q[N]=D,{messages:q}}else return{messages:[...X,D]}})}else if(Q.type==="done"){if(Q.status==="failed")$.error(Q.error||"Workflow failed")}}catch(Q){console.error("Error parsing SSE line:",Q)}}}}H.getState().fetchHistorySessions(j)}catch(K){let G=K instanceof Error?K.message:"Failed to send message";$.error(G),p((k)=>({messages:k.messages.filter((U)=>U.id!==T)}))}finally{p({isStreaming:!1})}},abortActiveSession:async(j)=>{let{currentSessionId:c,isStreaming:f}=H.getState();if(!c||!f)return;try{if((await w.api.teams[":teamId"].chat.sessions[":sessionId"].abort.$post({param:{teamId:j,sessionId:c}})).ok)$.success("Agent execution stopped");else throw Error("Failed to abort agent execution")}catch(F){let P=F instanceof Error?F.message:"Failed to abort execution";$.error(P)}}}));var L=b(u(),1);function S(p){let j=p.match(/teams\/([^/]+)/);if(j)return{teamId:j[1]};let c=p.match(/projects\/([^/]+)/);if(c)return{projectId:c[1]};return{}}function t(){let[p,j]=L.useState(),c=B({select:(T)=>T.location.pathname}),{teamId:f,projectId:F}=S(c),{data:P}=z({queryKey:["projects",F,"team"],queryFn:async()=>{let T=await w.api.projects[":projectId"].team.$get({param:{projectId:F}});if(!T.ok)throw Error("failed to fetch project team");return await T.json()},enabled:!!F});return L.useEffect(()=>{if(f)j(f);else if(P?.teamId)j(P.teamId)},[f,P]),p}
|
|
3
|
-
export{t as
|
|
3
|
+
export{t as gg,g as hg,H as ig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Dk as C,Ek as j,Fk as v,Gk as T,Hk as I,Ik as B}from"./chunk-qksb0v3c.js";import{Kk as F,Mk as M,Nk as H}from"./chunk-1wm57c6y.js";import{Ok as G}from"./chunk-re0b7sj7.js";import{Rk as P,Sk as L,Tk as K}from"./chunk-922nnh39.js";import{Uk as y}from"./chunk-9h027f50.js";import"./chunk-0qkj838r.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 K;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}},P(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=G(q,J,void 0);if(!J?.reasoning)return S(q,w,{...Y,thinking:{enabled:!1}});let Q=L(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=M.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();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:y(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,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{B as
|
|
1
|
+
import{zf as A}from"./chunk-ry33f2qk.js";import{Fh as w,Sh as z,oh as v}from"./chunk-nyhqy6q2.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/shares/$shareId")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
|
|
2
|
+
export{B as nf,H as of};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{B as
|
|
1
|
+
import{zf as A}from"./chunk-ry33f2qk.js";import{Fh as w,Sh as z,oh as v}from"./chunk-nyhqy6q2.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 wf,H as xf};
|