sliccy 3.5.3 → 3.5.5
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/dist/ui/assets/adobe-DCsfRQn2.js +2 -0
- package/dist/ui/assets/adobe-DSSPywlx.js +1 -0
- package/dist/ui/assets/{agent-bridge-QUPNBZ2M.js → agent-bridge-DaJ_nmW3.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-EegC3h4z.js → agent-message-to-chat-CsyFcZ2w.js} +1 -1
- package/dist/ui/assets/anthropic-04L_IqQ4.js +39 -0
- package/dist/ui/assets/{anthropic-BCPUmLlH.js → anthropic-DdObQ2i-.js} +3 -3
- package/dist/ui/assets/{apps-ARppSggc.js → apps-BBc8G_er.js} +1 -1
- package/dist/ui/assets/{azure-openai-CSqpmdoJ.js → azure-openai-DzGirHIb.js} +1 -1
- package/dist/ui/assets/{azure-openai-Dj6AtlWc.js → azure-openai-maMzaMwe.js} +1 -1
- package/dist/ui/assets/azure-openai-responses-Cd0P_ssa.js +1 -0
- package/dist/ui/assets/azure-openai-responses-CjukGNgz.js +1 -0
- package/dist/ui/assets/{bsh-watchdog-n6YE4WDU.js → bsh-watchdog-C8BJAFc3.js} +1 -1
- package/dist/ui/assets/{cdp-gQLbMV33.js → cdp-DMk0S7sC.js} +3 -3
- package/dist/ui/assets/cost-command-BtJx6Gwp.js +1 -0
- package/dist/ui/assets/{dist-EkY3RL7q.js → dist-tLLu0PBg.js} +1 -1
- package/dist/ui/assets/{es-Dl_wFGUb.js → es-Bjf1BIVF.js} +1 -1
- package/dist/ui/assets/{follower-sprinkle-bridge-BoiqP4YZ.js → follower-sprinkle-bridge-BFLnAii4.js} +1 -1
- package/dist/ui/assets/{github-CHvwqjE3.js → github-CcyS4zY-.js} +2 -2
- package/dist/ui/assets/{github-DM2J7Mgt.js → github-q1jHC2aO.js} +1 -1
- package/dist/ui/assets/{google-C9QmZApU.js → google-Cgd9E3cB.js} +1 -1
- package/dist/ui/assets/{google-DKCA1R_7.js → google-okAFtSPB.js} +1 -1
- package/dist/ui/assets/{google-shared-ChqdmdiQ.js → google-shared-Dz7dBXHI.js} +1 -1
- package/dist/ui/assets/{google-shared-CtOJ2bS7.js → google-shared-O-0R1H53.js} +1 -1
- package/dist/ui/assets/{google-vertex-CtmQEm1u.js → google-vertex-BSk7Kd0k.js} +1 -1
- package/dist/ui/assets/{google-vertex-BER3Pt6h.js → google-vertex-BkZigHmB.js} +1 -1
- package/dist/ui/assets/index-BdDYVKjf.js +1611 -0
- package/dist/ui/assets/{intercepted-oauth-Jw3xVg9G.js → intercepted-oauth-BbYCzrsi.js} +1 -1
- package/dist/ui/assets/{kernel-worker-BqsDBXbE.js → kernel-worker-7oVJDvYj.js} +982 -946
- package/dist/ui/assets/{lick-ws-bridge-C005aXkl.js → lick-ws-bridge-Cre3RRwL.js} +1 -1
- package/dist/ui/assets/{local-llm-BsaTlk41.js → local-llm-DAe8mBkI.js} +1 -1
- package/dist/ui/assets/{magick-wasm-Br5gEq8f.js → magick-wasm-C1izt9i7.js} +1 -1
- package/dist/ui/assets/{mistral-8klJTPp6.js → mistral-BgP2Mhzf.js} +1 -1
- package/dist/ui/assets/{mistral-Bi5-T2qa.js → mistral-DVuMIs98.js} +1 -1
- package/dist/ui/assets/{nuke-command-DgWx9r2f.js → nuke-command-BbxGOoiP.js} +1 -1
- package/dist/ui/assets/{oauth-CKU6cnIv.js → oauth-D12YL9GU.js} +1 -1
- package/dist/ui/assets/{oauth-bootstrap-mJ5YsUe3.js → oauth-bootstrap-BtJmY6M6.js} +2 -2
- package/dist/ui/assets/{oauth-service-Cgf9MVrf.js → oauth-service-Copu_4SG.js} +1 -1
- package/dist/ui/assets/{oauth-service-DHgur_ou.js → oauth-service-DJF7cZo7.js} +1 -1
- package/dist/ui/assets/{offscreen-client-BO7GCQC9.js → offscreen-client-Cz7pdJA-.js} +1 -1
- package/dist/ui/assets/{onboarding-orchestrator-DjGfBe9C.js → onboarding-orchestrator-BKXIEudN.js} +1 -1
- package/dist/ui/assets/openai-codex-responses-B7pudFjp.js +7 -0
- package/dist/ui/assets/openai-codex-responses-BAPqEmsF.js +7 -0
- package/dist/ui/assets/openai-completions-iJ14N4Sw.js +5 -0
- package/dist/ui/assets/openai-responses-C4kJ_gQ1.js +1 -0
- package/dist/ui/assets/openai-responses-CtIsFZKY.js +1 -0
- package/dist/ui/assets/{openai-responses-shared-iGCQtEmr.js → openai-responses-shared-CqmlDcXz.js} +1 -1
- package/dist/ui/assets/{openai-responses-shared-CasuVjR3.js → openai-responses-shared-DxBvmwvL.js} +1 -1
- package/dist/ui/assets/openrouter-CPoeAmgd.js +1 -0
- package/dist/ui/assets/openrouter-CdadiGtx.js +1 -0
- package/dist/ui/assets/{panel-rpc-handlers-CCAiOb3P.js → panel-rpc-handlers-DbHRM59x.js} +1 -1
- package/dist/ui/assets/{provider-DBDGeKq2.js → provider-DXK8JUs0.js} +1 -1
- package/dist/ui/assets/{provider-CWORKakZ.js → provider-DcrxGcMH.js} +2 -2
- package/dist/ui/assets/provider-store-access-BjvfvyfX.js +1 -0
- package/dist/ui/assets/provider-store-access-auxlQIvP.js +1 -0
- package/dist/ui/assets/{proxied-fetch-4a8GX3lQ.js → proxied-fetch-Zr3psZ6-.js} +1 -1
- package/dist/ui/assets/{pyodide-SEQBksci.js → pyodide-DlSYVqmj.js} +2 -2
- package/dist/ui/assets/{remote-terminal-view-rdKqXY1R.js → remote-terminal-view-PnTEWD7p.js} +1 -1
- package/dist/ui/assets/{secret-env-D3-HZIfV.js → secret-env-YSczATtn.js} +1 -1
- package/dist/ui/assets/{slicc-editor-BSeQjTkI.js → slicc-editor-BwZ-JdjT.js} +1 -1
- package/dist/ui/assets/{spawn-C2QWgMfJ.js → spawn-CfeAB8A4.js} +1 -1
- package/dist/ui/assets/{sql-wasm-CBRpqz0E.js → sql-wasm-BVmSEJv3.js} +1 -1
- package/dist/ui/assets/{store-C5DiLXoP.js → store-D-IKH6-w.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-DJE7-4nL.js → tray-leave-runtime-D9Wr8bCF.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-BXpvQUQ5.js → upgrade-detection-CpKdzfSv.js} +1 -1
- package/dist/ui/assets/{xai-grok-BvXSoiv5.js → xai-grok-CGPoHWCQ.js} +1 -1
- package/dist/ui/assets/{xai-grok-CMQ_FwH3.js → xai-grok-DwtbUE6F.js} +1 -1
- package/dist/ui/assets/{xai-grok-sanitize-BeI8rdV5.js → xai-grok-sanitize-DtMFuPGU.js} +1 -1
- package/dist/ui/assets/{xai-grok-sanitize-h_8XMTD9.js → xai-grok-sanitize-L5nUbDcW.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/packages/webapp/index.html +1 -1
- package/package.json +4 -4
- package/dist/ui/assets/adobe-B6PUhyDO.js +0 -2
- package/dist/ui/assets/adobe-C19PEbL3.js +0 -1
- package/dist/ui/assets/anthropic-CSFiGx12.js +0 -39
- package/dist/ui/assets/azure-openai-responses-3cm1V-j6.js +0 -1
- package/dist/ui/assets/azure-openai-responses-Bcauywoy.js +0 -1
- package/dist/ui/assets/cost-command-CAAiRKiz.js +0 -1
- package/dist/ui/assets/index-VQChmsyd.js +0 -1575
- package/dist/ui/assets/openai-codex-responses-CJKHtG7H.js +0 -7
- package/dist/ui/assets/openai-codex-responses-DRlfx466.js +0 -7
- package/dist/ui/assets/openai-completions-YN-IHpay.js +0 -5
- package/dist/ui/assets/openai-responses-C66HRRVd.js +0 -1
- package/dist/ui/assets/openai-responses-VosVPzrO.js +0 -1
- package/dist/ui/assets/provider-store-access-BtkHC8u5.js +0 -1
- package/dist/ui/assets/provider-store-access-CwJibPlx.js +0 -1
- /package/dist/ui/assets/{active-transport-CfU1UxY6.js → active-transport-Clj9slj7.js} +0 -0
- /package/dist/ui/assets/{active-transport-Dm6CWYVE.js → active-transport-Cu6hvJXz.js} +0 -0
- /package/dist/ui/assets/{addon-fit-BDUxDgg1.js → addon-fit-CBG3Hsec.js} +0 -0
- /package/dist/ui/assets/{addon-fit-Dkm5m5XK.js → addon-fit-D2MIn2bh.js} +0 -0
- /package/dist/ui/assets/{azure-ai-foundry-1pnZpxAJ.js → azure-ai-foundry-CGkSI_4f.js} +0 -0
- /package/dist/ui/assets/{azure-ai-foundry-BHLfY_0t.js → azure-ai-foundry-DVqxYCDH.js} +0 -0
- /package/dist/ui/assets/{chat-fixture-DOzffHLr.js → chat-fixture-C0wxG6yH.js} +0 -0
- /package/dist/ui/assets/{dist-BYoCEWmq.js → dist-4mA3RMrN.js} +0 -0
- /package/dist/ui/assets/{dist-BrjVVq8c.js → dist-9RlRmGag.js} +0 -0
- /package/dist/ui/assets/{git-config-CGMfR0WK.js → git-config-47_ySgKl.js} +0 -0
- /package/dist/ui/assets/{global-db-B97_fwjD.js → global-db-CMspJ2t8.js} +0 -0
- /package/dist/ui/assets/{lick-manager-proxy-BnnMFbgv.js → lick-manager-proxy-1L0EGIWD.js} +0 -0
- /package/dist/ui/assets/{page-storage-sync-CqMAh8jG.js → page-storage-sync-3GLxly8J.js} +0 -0
- /package/dist/ui/assets/{pdfjs-DDDkZHZ4.js → pdfjs-CW51NNE6.js} +0 -0
- /package/dist/ui/assets/{rum-DCU8sePD.js → rum-CY2gBT8x.js} +0 -0
- /package/dist/ui/assets/{sprinkle-bridge-channel-DojIojh7.js → sprinkle-bridge-channel-Bw5UaanD.js} +0 -0
- /package/dist/ui/assets/{sprinkle-bridge-channel-DJC5SGWr.js → sprinkle-bridge-channel-DAHSl7rf.js} +0 -0
- /package/dist/ui/assets/{sprinkle-proxy-rF3NSOGq.js → sprinkle-proxy-D6wqmewK.js} +0 -0
- /package/dist/ui/assets/{xai-grok-errors-WbFsMZum.js → xai-grok-errors-C6VnD_MH.js} +0 -0
- /package/dist/ui/assets/{xai-grok-errors-Bzn3oNvW.js → xai-grok-errors-DQQRqci0.js} +0 -0
- /package/dist/ui/assets/{xai-grok-models-cvcIXmNM.js → xai-grok-models-BndZgIFZ.js} +0 -0
- /package/dist/ui/assets/{xai-grok-models-DMYWtapT.js → xai-grok-models-D7n8nh39.js} +0 -0
- /package/dist/ui/assets/{xterm-DhusGoAm.js → xterm-4j9yS4Tj.js} +0 -0
- /package/dist/ui/assets/{xterm-D8ldLLKi.js → xterm-DLCsxsB1.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,F as t,G as n,M as r,Q as i,R as a,_ as o,p as s,q as c,v as l}from"./kernel-worker-
|
|
1
|
+
import{$ as e,F as t,G as n,M as r,Q as i,R as a,_ as o,p as s,q as c,v as l}from"./kernel-worker-7oVJDvYj.js";import{getOAuthPageOrigin as u}from"./oauth-service-Copu_4SG.js";var d={clientId:``,scopes:`repo,read:user,user:email`};function f(){try{let t=localStorage.getItem(e);if(t)return t.replace(/\/$/,``)}catch{}return i}async function p(e){let t=`${f()}/oauth/token`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,code:e.code,redirect_uri:e.redirectUri})}),r;try{r=await n.json()}catch{throw Error(`Token exchange failed (HTTP ${n.status}): non-JSON response`)}if(!n.ok&&n.status!==200){let e=r.error_description??r.error??`Token exchange failed (HTTP ${n.status})`;throw Error(e)}if(r.error){let e=r.error_description??r.error;throw Error(e)}return r}async function m(e){let t=`${f()}/oauth/revoke`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,access_token:e.accessToken})});if(!(n.status===204||n.ok)){if(n.status===400)try{if((await n.json()).error===`unsupported`)return}catch{}throw Error(`Token revocation failed (HTTP ${n.status})`)}}const h=Object.assign({"/packages/webapp/providers/github-config.json":d})[`/packages/webapp/providers/github-config.json`]??{clientId:``,scopes:`repo,read:user,user:email`};let g=null,_=null;async function v(){if(g)return g;if(y){try{let e=await fetch(`${f()}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return g=t.oauth.github,g}}catch{}return h.clientId}try{let e=await fetch(`/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return g=t.oauth.github,g;if(t.trayWorkerBaseUrl){_=t.trayWorkerBaseUrl;let e=await fetch(`${t.trayWorkerBaseUrl}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return g=t.oauth.github,g}}}}catch{}return h.clientId}const y=typeof chrome<`u`&&!!chrome?.runtime?.id;function b(){return s().find(e=>e.providerId===`github`)}function x(e){try{return new URL(e).searchParams.get(`code`)}catch{return null}}async function S(e){try{let t=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${e}`,Accept:`application/vnd.github+json`}});if(t.ok){let e=await t.json();return{name:e.name||e.login,avatar:e.avatar_url,login:e.login,id:e.id}}}catch(e){console.warn(`[github] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function C(e,t){return`${e}+${t}@users.noreply.github.com`}async function w(e){try{let{VirtualFS:t}=await import(`./kernel-worker-7oVJDvYj.js`);await(await t.create({dbName:c})).writeFile(`/workspace/.git/github-token`,e),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch(e){console.warn(`[github] Failed to write git token:`,e instanceof Error?e.message:String(e))}}async function T(){try{let{VirtualFS:e}=await import(`./kernel-worker-7oVJDvYj.js`);await(await e.create({dbName:c})).rm(`/workspace/.git/github-token`),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch{}}async function E(e){if(!(!e.login||e.id===void 0))try{let{VirtualFS:t}=await import(`./kernel-worker-7oVJDvYj.js`),{readGlobalGitConfigValue:n,writeGlobalGitConfigValue:r}=await import(`./kernel-worker-7oVJDvYj.js`),i=await t.create({dbName:c}),a=e.name||e.login,o=C(e.id,e.login);!await n(i,`user.name`)&&a&&await r(i,`user.name`,a),await n(i,`user.email`)||await r(i,`user.email`,o)}catch(e){console.warn(`[github] Failed to seed git identity:`,e instanceof Error?e.message:String(e))}}async function D(){let e=b();if(!e?.accessToken)throw Error(`Not logged in to GitHub — please log in first`);return e.accessToken}const O=`https://models.github.ai/inference`,k=[{id:`openai/gpt-4.1`,name:`GPT-4.1`,api:`openai`,context_window:1047576,max_tokens:32768,reasoning:!1,input:[`text`,`image`]},{id:`openai/gpt-4.1-mini`,name:`GPT-4.1 mini`,api:`openai`,context_window:1047576,max_tokens:32768,reasoning:!1,input:[`text`,`image`]}];function A(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`github-openai`,provider:`github`,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:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}const j=(e,t,n={})=>{let i=a();return(async()=>{try{let a=await D(),o=r({...e,baseUrl:O,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},t,{...n,apiKey:a});for await(let e of o)i.push(e);i.end()}catch(t){console.error(`[github] Stream error:`,t instanceof Error?t.message:String(t)),i.push(A(e,t)),i.end()}})(),i},M=(e,n,r)=>{let i=a();return(async()=>{try{let a=await D(),o=t({...e,baseUrl:O,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},n,{...r,apiKey:a});for await(let e of o)i.push(e);i.end()}catch(t){console.error(`[github] Stream error:`,t instanceof Error?t.message:String(t)),i.push(A(e,t)),i.end()}})(),i},N={id:`github`,name:`GitHub`,description:`GitHub Models + git authentication — login with your GitHub account`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`gpt-4.1`,oauthTokenDomains:[`github.com`,`*.github.com`,`api.github.com`,`raw.githubusercontent.com`,`models.github.ai`],getModelIds:()=>k,onOAuthLogin:async(e,t,n)=>{let r=await v();if(!r)throw Error(`GitHub OAuth not configured — no client ID available`);let i=n?.scopes??h.scopes,a=y?null:await u(),s=y?`${f()}/auth/callback`:`${_??a.origin}/auth/callback`,c=crypto.randomUUID(),d=y?chrome.runtime.id:``,m=y?{source:`extension`,extensionId:d,path:`/github`,nonce:c}:{port:parseInt(new URL(a.href).port||`5710`,10),path:`/auth/callback`,nonce:c},g=btoa(JSON.stringify(m)),b=c,C=new URLSearchParams({client_id:r,scope:i,redirect_uri:s});g&&C.set(`state`,g);let D=await e(`https://github.com/login/oauth/authorize?${C}`);if(!D)return;if(b)try{if(new URL(D).searchParams.get(`nonce`)!==b){console.error(`[github] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[github] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let O=x(D);if(!O){console.error(`[github] Could not extract authorization code from redirect URL`);return}let k=await p({provider:`github`,code:O,redirectUri:s}),A=await S(k.access_token);await l({providerId:`github`,accessToken:k.access_token,userName:A.name,userAvatar:A.avatar});let j=o(`github`)?.maskedValue;j?await w(j):await T(),await E(A),t()},onOAuthLogout:async()=>{let e=b();e?.accessToken&&await m({provider:`github`,accessToken:e.accessToken}).catch(e=>console.warn(`[github] Token revocation failed:`,e instanceof Error?e.message:String(e))),await T(),await l({providerId:`github`,accessToken:``})}};function P(){n({api:`github-openai`,stream:j,streamSimple:M})}export{C as buildNoreplyEmail,N as config,x as extractCodeFromUrl,D as getValidAccessToken,P as register,E as syncGitIdentityFromGitHub};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as e,H as t,V as n,y as r,z as i}from"./index-
|
|
1
|
+
import{G as e,H as t,V as n,y as r,z as i}from"./index-BdDYVKjf.js";import{t as a}from"./sanitize-unicode-h0KEBmEw.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./google-shared-Dz7dBXHI.js";var p=0,m=(t,r,a)=>{let o=new i;return(async()=>{let i={role:`assistant`,content:[],api:`google-generative-ai`,provider:t.provider,model:t.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 c=g(t,a?.apiKey||e(t.provider)||``,a?.headers),d=_(t,r,a),f=await a?.onPayload?.(d,t);f!==void 0&&(d=f);let m=await c.models.generateContentStream(d);o.push({type:`start`,partial:i});let h=null,v=i.content,y=()=>v.length-1;for await(let e of m){i.responseId||=e.responseId;let r=e.candidates?.[0];if(r?.content?.parts)for(let e of r.content.parts){if(e.text!==void 0){let t=u(e);(!h||t&&h.type!==`thinking`||!t&&h.type!==`text`)&&(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:v.length-1,content:h.text,partial:i}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:i})),t?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},i.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:i})):(h={type:`text`,text:``},i.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:i}))),h.type===`thinking`?(h.thinking+=e.text,h.thinkingSignature=l(h.thinkingSignature,e.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:e.text,partial:i})):(h.text+=e.text,h.textSignature=l(h.textSignature,e.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:e.text,partial:i}))}if(e.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:i}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:i}),null);let t=e.functionCall.id,n={type:`toolCall`,id:!t||i.content.some(e=>e.type===`toolCall`&&e.id===t)?`${e.functionCall.name}_${Date.now()}_${++p}`:t,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};i.content.push(n),o.push({type:`toolcall_start`,contentIndex:y(),partial:i}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(n.arguments),partial:i}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:n,partial:i})}}r?.finishReason&&(i.stopReason=s(r.finishReason),i.content.some(e=>e.type===`toolCall`)&&(i.stopReason=`toolUse`)),e.usageMetadata&&(i.usage={input:(e.usageMetadata.promptTokenCount||0)-(e.usageMetadata.cachedContentTokenCount||0),output:(e.usageMetadata.candidatesTokenCount||0)+(e.usageMetadata.thoughtsTokenCount||0),cacheRead:e.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:e.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},n(t,i.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:i}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:i})),a?.signal?.aborted)throw Error(`Request was aborted`);if(i.stopReason===`aborted`||i.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:i.stopReason,message:i}),o.end()}catch(e){for(let e of i.content)`index`in e&&delete e.index;i.stopReason=a?.signal?.aborted?`aborted`:`error`,i.errorMessage=e instanceof Error?e.message:JSON.stringify(e),o.push({type:`error`,reason:i.stopReason,error:i}),o.end()}})(),o},h=(n,i,a)=>{let o=a?.apiKey||e(n.provider);if(!o)throw Error(`No API key for provider: ${n.provider}`);let s=r(n,a,o);if(!a?.reasoning)return m(n,i,{...s,thinking:{enabled:!1}});let c=t(n,a.reasoning),l=c===`off`?`high`:c,u=n;return y(u)||b(u)||v(u)?m(n,i,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(n,i,{...s,thinking:{enabled:!0,budgetTokens:C(u,l,a.thinkingBudgets)}})};function g(e,t,n){let r={};return e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``),(e.headers||n)&&(r.headers={...e.headers,...n}),new d({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function _(e,t,n={}){let r=f(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:a(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:c(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:o(n.toolChoice)}}:s.toolConfig=void 0,n.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};n.thinking.level===void 0?n.thinking.budgetTokens!==void 0&&(e.thinkingBudget=n.thinking.budgetTokens):e.thinkingLevel=n.thinking.level,s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=x(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);s.abortSignal=n.signal}return{model:e.id,contents:r,config:s}}function v(e){return/gemma-?4/.test(e.id.toLowerCase())}function y(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function b(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function x(e){return y(e)?{thinkingLevel:`LOW`}:b(e)||v(e)?{thinkingLevel:`MINIMAL`}:{thinkingBudget:0}}function S(e,t){if(y(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}if(v(t))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 C(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{m as streamGoogle,h as streamSimpleGoogle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,L as t,U as n,b as r,o as i,z as a}from"./kernel-worker-
|
|
1
|
+
import{B as e,L as t,U as n,b as r,o as i,z as a}from"./kernel-worker-7oVJDvYj.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./google-shared-O-0R1H53.js";let p=0;const m=(e,r,i)=>{let o=new t;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 c=g(e,i?.apiKey||n(e.provider)||``,i?.headers),d=_(e,r,i),f=await i?.onPayload?.(d,e);f!==void 0&&(d=f);let m=await c.models.generateContentStream(d);o.push({type:`start`,partial:t});let h=null,v=t.content,y=()=>v.length-1;for await(let n of m){t.responseId||=n.responseId;let r=n.candidates?.[0];if(r?.content?.parts)for(let e of r.content.parts){if(e.text!==void 0){let n=u(e);(!h||n&&h.type!==`thinking`||!n&&h.type!==`text`)&&(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:v.length-1,content:h.text,partial:t}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:t})),n?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},t.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:t})):(h={type:`text`,text:``},t.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:t}))),h.type===`thinking`?(h.thinking+=e.text,h.thinkingSignature=l(h.thinkingSignature,e.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:e.text,partial:t})):(h.text+=e.text,h.textSignature=l(h.textSignature,e.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:e.text,partial:t}))}if(e.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:t}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:t}),null);let n=e.functionCall.id,r={type:`toolCall`,id:!n||t.content.some(e=>e.type===`toolCall`&&e.id===n)?`${e.functionCall.name}_${Date.now()}_${++p}`:n,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};t.content.push(r),o.push({type:`toolcall_start`,contentIndex:y(),partial:t}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(r.arguments),partial:t}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:r,partial:t})}}r?.finishReason&&(t.stopReason=s(r.finishReason),t.content.some(e=>e.type===`toolCall`)&&(t.stopReason=`toolUse`)),n.usageMetadata&&(t.usage={input:(n.usageMetadata.promptTokenCount||0)-(n.usageMetadata.cachedContentTokenCount||0),output:(n.usageMetadata.candidatesTokenCount||0)+(n.usageMetadata.thoughtsTokenCount||0),cacheRead:n.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:n.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},a(e,t.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:t}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:t})),i?.signal?.aborted)throw Error(`Request was aborted`);if(t.stopReason===`aborted`||t.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:t.stopReason,message:t}),o.end()}catch(e){for(let e of t.content)`index`in e&&delete e.index;t.stopReason=i?.signal?.aborted?`aborted`:`error`,t.errorMessage=e instanceof Error?e.message:JSON.stringify(e),o.push({type:`error`,reason:t.stopReason,error:t}),o.end()}})(),o},h=(t,i,a)=>{let o=a?.apiKey||n(t.provider);if(!o)throw Error(`No API key for provider: ${t.provider}`);let s=r(t,a,o);if(!a?.reasoning)return m(t,i,{...s,thinking:{enabled:!1}});let c=e(t,a.reasoning),l=c===`off`?`high`:c,u=t;return y(u)||b(u)||v(u)?m(t,i,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(t,i,{...s,thinking:{enabled:!0,budgetTokens:C(u,l,a.thinkingBudgets)}})};function g(e,t,n){let r={};return e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``),(e.headers||n)&&(r.headers={...e.headers,...n}),new d({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function _(e,t,n={}){let r=f(e,t),a={};n.temperature!==void 0&&(a.temperature=n.temperature),n.maxTokens!==void 0&&(a.maxOutputTokens=n.maxTokens);let s={...Object.keys(a).length>0&&a,...t.systemPrompt&&{systemInstruction:i(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:c(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:o(n.toolChoice)}}:s.toolConfig=void 0,n.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};n.thinking.level===void 0?n.thinking.budgetTokens!==void 0&&(e.thinkingBudget=n.thinking.budgetTokens):e.thinkingLevel=n.thinking.level,s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=x(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);s.abortSignal=n.signal}return{model:e.id,contents:r,config:s}}function v(e){return/gemma-?4/.test(e.id.toLowerCase())}function y(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function b(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function x(e){return y(e)?{thinkingLevel:`LOW`}:b(e)||v(e)?{thinkingLevel:`MINIMAL`}:{thinkingBudget:0}}function S(e,t){if(y(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}if(v(t))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 C(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{m as streamGoogle,h as streamSimpleGoogle};
|