sliccy 3.4.2 → 3.5.0
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/README.md +1 -1
- package/dist/ui/assets/{adobe-DtL7GdwG.js → adobe-BTrolwsn.js} +2 -2
- package/dist/ui/assets/{adobe-CjwUvUUz.js → adobe-DNbs6u4w.js} +1 -1
- package/dist/ui/assets/{agent-bridge-Dreex1la.js → agent-bridge-k61smclx.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-D-uGBdBr.js → agent-message-to-chat-DWXOkb2Z.js} +1 -1
- package/dist/ui/assets/{anthropic-BcNzOm3q.js → anthropic-BqjQeXfl.js} +1 -1
- package/dist/ui/assets/{anthropic-CpMf0Lbf.js → anthropic-CcrOlimI.js} +1 -1
- package/dist/ui/assets/{apps-DHjHDFp8.js → apps-D91nMJB7.js} +1 -1
- package/dist/ui/assets/{azure-openai-DPZemc4U.js → azure-openai-CHFYUTbx.js} +1 -1
- package/dist/ui/assets/{azure-openai-CA1mxD3H.js → azure-openai-CRuR8Vsi.js} +1 -1
- package/dist/ui/assets/{azure-openai-responses-CkJGWdYm.js → azure-openai-responses-Bwq-OrgD.js} +1 -1
- package/dist/ui/assets/{azure-openai-responses-B-Sp7Lbb.js → azure-openai-responses-DM5xUo39.js} +1 -1
- package/dist/ui/assets/{bsh-watchdog-Cp3gNbYH.js → bsh-watchdog-3RZfBtR_.js} +1 -1
- package/dist/ui/assets/{cdp-wB9CHBaO.js → cdp-CK58t5ho.js} +3 -3
- package/dist/ui/assets/cost-command-Cv86QxPI.js +1 -0
- package/dist/ui/assets/{es-3DUxOu76.js → es-CbcIVlcd.js} +1 -1
- package/dist/ui/assets/{follower-sprinkle-bridge-CDFAxrIT.js → follower-sprinkle-bridge-CGEijdA5.js} +1 -1
- package/dist/ui/assets/{github-TbpFfs-O.js → github-B_G68RSs.js} +1 -1
- package/dist/ui/assets/{github-D6b5Hhsb.js → github-GxgSs3Zl.js} +2 -2
- package/dist/ui/assets/{google-BMVsxTG7.js → google-DFLFp2OL.js} +1 -1
- package/dist/ui/assets/{google-n4rJNqnF.js → google-b83wbkcd.js} +1 -1
- package/dist/ui/assets/{google-shared-B0BrRTgf.js → google-shared-DjI17nOK.js} +1 -1
- package/dist/ui/assets/{google-shared-DGHk65kV.js → google-shared-NbOWyxKl.js} +1 -1
- package/dist/ui/assets/{google-vertex-C0o8gAGe.js → google-vertex-B050schu.js} +1 -1
- package/dist/ui/assets/{google-vertex-Cbjs5cnT.js → google-vertex-CeqJxvmT.js} +1 -1
- package/dist/ui/assets/{index-Di6Yhobc.js → index-BgU8I0sH.js} +104 -103
- package/dist/ui/assets/{intercepted-oauth-5XrS3zi4.js → intercepted-oauth-Xm7HsZ6y.js} +1 -1
- package/dist/ui/assets/{kernel-worker-CbXtvutp.js → kernel-worker-PP3bQwjr.js} +17 -17
- package/dist/ui/assets/{lick-ws-bridge-DCpPUoqH.js → lick-ws-bridge-h5zJKPEB.js} +1 -1
- package/dist/ui/assets/{local-llm-CYufjkaA.js → local-llm-Lhh9VBzO.js} +1 -1
- package/dist/ui/assets/{magick-wasm-CJgANw_I.js → magick-wasm-C0SILdvq.js} +1 -1
- package/dist/ui/assets/{mistral-BevEK6OI.js → mistral-9OqiIYs3.js} +1 -1
- package/dist/ui/assets/{mistral-CmJ4hz5s.js → mistral-DtUZteMr.js} +1 -1
- package/dist/ui/assets/{nuke-command-CSlJniNh.js → nuke-command-DUHrgGlv.js} +1 -1
- package/dist/ui/assets/{oauth-pEdtO0n-.js → oauth-Db02XLMt.js} +1 -1
- package/dist/ui/assets/{oauth-bootstrap-CHQvm1zm.js → oauth-bootstrap-4d55C10S.js} +2 -2
- package/dist/ui/assets/{oauth-service-E487CG2S.js → oauth-service-BLo3Fcpz.js} +1 -1
- package/dist/ui/assets/{oauth-service-BLhH22XI.js → oauth-service-BXoSkORq.js} +1 -1
- package/dist/ui/assets/{offscreen-client-tyIPYuPQ.js → offscreen-client-XIDGfxx9.js} +1 -1
- package/dist/ui/assets/{onboarding-orchestrator-B0AYrgqN.js → onboarding-orchestrator-DJGV8LGW.js} +1 -1
- package/dist/ui/assets/{openai-codex-responses-C0xjwfYe.js → openai-codex-responses-BOAxScvB.js} +1 -1
- package/dist/ui/assets/{openai-codex-responses-D2f5kBKJ.js → openai-codex-responses-DRapAGGp.js} +1 -1
- package/dist/ui/assets/{openai-completions-BT4Diwqm.js → openai-completions-DzWuD9C3.js} +1 -1
- package/dist/ui/assets/{openai-responses-CZEufjZG.js → openai-responses-Ceg_E7Wj.js} +1 -1
- package/dist/ui/assets/{openai-responses-s57fcmKx.js → openai-responses-DQ7W3-CH.js} +1 -1
- package/dist/ui/assets/{openai-responses-shared-BIPZ3mo-.js → openai-responses-shared-7oYcMlCb.js} +1 -1
- package/dist/ui/assets/{openai-responses-shared-CXLudxob.js → openai-responses-shared-Bc7nNnu4.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-CaWuTTyj.js → panel-rpc-handlers-CbCaPLuQ.js} +1 -1
- package/dist/ui/assets/{provider-yeAVK7Ac.js → provider-CBoCo-ek.js} +1 -1
- package/dist/ui/assets/{provider-B_YPzOko.js → provider-UOMwZsVy.js} +2 -2
- package/dist/ui/assets/provider-store-access-ClfuXK_N.js +1 -0
- package/dist/ui/assets/provider-store-access-N4UUq2pi.js +1 -0
- package/dist/ui/assets/{proxied-fetch-BOut0pqh.js → proxied-fetch-CupZFiEY.js} +1 -1
- package/dist/ui/assets/{pyodide-qABm7xCc.js → pyodide-CFPf4_tb.js} +2 -2
- package/dist/ui/assets/remote-terminal-view-4GBE-7OQ.js +6 -0
- package/dist/ui/assets/{secret-env-BtrnLdyG.js → secret-env-B7k89Ks6.js} +1 -1
- package/dist/ui/assets/{slicc-editor-B7LN_EoL.js → slicc-editor-up7xd_bW.js} +1 -1
- package/dist/ui/assets/{spawn-DaHdHFzT.js → spawn-dSmmta8G.js} +1 -1
- package/dist/ui/assets/{sql-wasm-rZv93hdK.js → sql-wasm-BWr6CcWF.js} +1 -1
- package/dist/ui/assets/{store-DuyeqtSu.js → store-xHVlQiC6.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-d7bYIpZ5.js → tray-leave-runtime-BmCDM7CJ.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-CHpPmVNQ.js → upgrade-detection-BW4tcSMp.js} +1 -1
- package/dist/ui/assets/{xai-grok-BuTRvpeb.js → xai-grok-BcTZY9w5.js} +1 -1
- package/dist/ui/assets/{xai-grok-BuLwklR4.js → xai-grok-Bkn8_NbU.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/packages/webapp/index.html +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/cost-command-DjPtqKVx.js +0 -1
- package/dist/ui/assets/provider-store-access-3MjJSflq.js +0 -1
- package/dist/ui/assets/provider-store-access-6nY86_H7.js +0 -1
- package/dist/ui/assets/remote-terminal-view-CaavScXb.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,ot as t,rt as n,x as r}from"./kernel-worker-
|
|
1
|
+
import{o as e,ot as t,rt as n,x as r}from"./kernel-worker-PP3bQwjr.js";var i=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),a=n((e=>{var t=i();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),o=n(((e,t)=>{t.exports=a()})),s=t(n(((e,t)=>{let n=o(),r=[`Failed to fetch`,`NetworkError when attempting to fetch resource.`,`The Internet connection appears to be offline.`,`Network request failed`];var i=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=Error(e),this.originalError.stack=this.stack),this.name=`AbortError`,this.message=e}};let a=(e,t,n)=>{let r=n.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=r,e},s=e=>r.includes(e),c=(e,t)=>new Promise((r,o)=>{t={onFailedAttempt:()=>{},retries:10,...t};let c=n.operation(t);c.attempt(async n=>{try{r(await e(n))}catch(e){if(!(e instanceof Error)){o(TypeError(`Non-error was thrown: "${e}". You should only throw errors.`));return}if(e instanceof i)c.stop(),o(e.originalError);else if(e instanceof TypeError&&!s(e.message))c.stop(),o(e);else{a(e,n,t);try{await t.onFailedAttempt(e)}catch(e){o(e);return}c.retry(e)||o(c.mainError())}}})});t.exports=c,t.exports.default=c,t.exports.AbortError=i}))(),1)
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2025 Google LLC
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as e,V as t,y as n,z as r}from"./index-
|
|
1
|
+
import{H as e,V as t,y as n,z as r}from"./index-BgU8I0sH.js";import{t as i}from"./sanitize-unicode-h0KEBmEw.js";import{a,c as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p}from"./google-shared-DjI17nOK.js";var m=`v1`,h=`gcp-vertex-credentials`,g={THINKING_LEVEL_UNSPECIFIED:c.THINKING_LEVEL_UNSPECIFIED,MINIMAL:c.MINIMAL,LOW:c.LOW,MEDIUM:c.MEDIUM,HIGH:c.HIGH},_=0,v=(e,n,i)=>{let a=new r;return(async()=>{let r={role:`assistant`,content:[],api:`google-vertex`,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let o=T(i),c=o?x(e,o,i?.headers):b(e,D(i),O(i),i?.headers),l=k(e,n,i),f=await i?.onPayload?.(l,e);f!==void 0&&(l=f);let p=await c.models.generateContentStream(l);a.push({type:`start`,partial:r});let m=null,h=r.content,g=()=>h.length-1;for await(let n of p){r.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let e of i.content.parts){if(e.text!==void 0){let t=d(e);(!m||t&&m.type!==`thinking`||!t&&m.type!==`text`)&&(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:h.length-1,content:m.text,partial:r}):a.push({type:`thinking_end`,contentIndex:g(),content:m.thinking,partial:r})),t?(m={type:`thinking`,thinking:``,thinkingSignature:void 0},r.content.push(m),a.push({type:`thinking_start`,contentIndex:g(),partial:r})):(m={type:`text`,text:``},r.content.push(m),a.push({type:`text_start`,contentIndex:g(),partial:r}))),m.type===`thinking`?(m.thinking+=e.text,m.thinkingSignature=u(m.thinkingSignature,e.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:g(),delta:e.text,partial:r})):(m.text+=e.text,m.textSignature=u(m.textSignature,e.thoughtSignature),a.push({type:`text_delta`,contentIndex:g(),delta:e.text,partial:r}))}if(e.functionCall){m&&=(m.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:m.text,partial:r}):a.push({type:`thinking_end`,contentIndex:g(),content:m.thinking,partial:r}),null);let t=e.functionCall.id,n={type:`toolCall`,id:!t||r.content.some(e=>e.type===`toolCall`&&e.id===t)?`${e.functionCall.name}_${Date.now()}_${++_}`:t,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};r.content.push(n),a.push({type:`toolcall_start`,contentIndex:g(),partial:r}),a.push({type:`toolcall_delta`,contentIndex:g(),delta:JSON.stringify(n.arguments),partial:r}),a.push({type:`toolcall_end`,contentIndex:g(),toolCall:n,partial:r})}}i?.finishReason&&(r.stopReason=s(i.finishReason),r.content.some(e=>e.type===`toolCall`)&&(r.stopReason=`toolUse`)),n.usageMetadata&&(r.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}},t(e,r.usage))}if(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:m.text,partial:r}):a.push({type:`thinking_end`,contentIndex:g(),content:m.thinking,partial:r})),i?.signal?.aborted)throw Error(`Request was aborted`);if(r.stopReason===`aborted`||r.stopReason===`error`)throw Error(`An unknown error occurred`);a.push({type:`done`,reason:r.stopReason,message:r}),a.end()}catch(e){for(let e of r.content)`index`in e&&delete e.index;r.stopReason=i?.signal?.aborted?`aborted`:`error`,r.errorMessage=e instanceof Error?e.message:JSON.stringify(e),a.push({type:`error`,reason:r.stopReason,error:r}),a.end()}})(),a},y=(t,r,i)=>{let a=n(t,i,void 0);if(!i?.reasoning)return v(t,r,{...a,thinking:{enabled:!1}});let o=e(t,i.reasoning),s=o===`off`?`high`:o,c=t;return A(c)||j(c)?v(t,r,{...a,thinking:{enabled:!0,level:N(s,c)}}):v(t,r,{...a,thinking:{enabled:!0,budgetTokens:P(c,s,i.thinkingBudgets)}})};function b(e,t,n,r){return new f({vertexai:!0,project:t,location:n,apiVersion:m,httpOptions:S(e,r)})}function x(e,t,n){return new f({vertexai:!0,apiKey:t,apiVersion:m,httpOptions:S(e,n)})}function S(e,t){let n={},r=C(e.baseUrl);return r&&(n.baseUrl=r,n.baseUrlResourceScope=o.COLLECTION,w(r)&&(n.apiVersion=``)),(e.headers||t)&&(n.headers={...e.headers,...t}),Object.keys(n).length>0?n:void 0}function C(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function w(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function T(e){let t=e?.apiKey?.trim()||{}.GOOGLE_CLOUD_API_KEY?.trim();if(!(!t||t===h||E(t)))return t}function E(e){return/^<[^>]+>$/.test(e)}function D(e){let t=e?.project||{}.GOOGLE_CLOUD_PROJECT||{}.GCLOUD_PROJECT;if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function O(e){let t=e?.location||{}.GOOGLE_CLOUD_LOCATION;if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function k(e,t,n={}){let r=p(e,t),o={};n.temperature!==void 0&&(o.temperature=n.temperature),n.maxTokens!==void 0&&(o.maxOutputTokens=n.maxTokens);let s={...Object.keys(o).length>0&&o,...t.systemPrompt&&{systemInstruction:i(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:l(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:a(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=g[n.thinking.level],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=M(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 A(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function j(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function M(e){let t=e;return A(t)?{thinkingLevel:c.LOW}:j(t)?{thinkingLevel:c.MINIMAL}:{thinkingBudget:0}}function N(e,t){if(A(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function P(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`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{v as streamGoogleVertex,y as streamSimpleGoogleVertex};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,L as t,b as n,o as r,z as i}from"./kernel-worker-
|
|
1
|
+
import{B as e,L as t,b as n,o as r,z as i}from"./kernel-worker-PP3bQwjr.js";import{a,c as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p}from"./google-shared-NbOWyxKl.js";const m={THINKING_LEVEL_UNSPECIFIED:c.THINKING_LEVEL_UNSPECIFIED,MINIMAL:c.MINIMAL,LOW:c.LOW,MEDIUM:c.MEDIUM,HIGH:c.HIGH};let h=0;const g=(e,n,r)=>{let a=new t;return(async()=>{let t={role:`assistant`,content:[],api:`google-vertex`,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let o=C(r),c=o?y(e,o,r?.headers):v(e,T(r),E(r),r?.headers),l=D(e,n,r),f=await r?.onPayload?.(l,e);f!==void 0&&(l=f);let p=await c.models.generateContentStream(l);a.push({type:`start`,partial:t});let m=null,g=t.content,_=()=>g.length-1;for await(let n of p){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=d(e);(!m||n&&m.type!==`thinking`||!n&&m.type!==`text`)&&(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:g.length-1,content:m.text,partial:t}):a.push({type:`thinking_end`,contentIndex:_(),content:m.thinking,partial:t})),n?(m={type:`thinking`,thinking:``,thinkingSignature:void 0},t.content.push(m),a.push({type:`thinking_start`,contentIndex:_(),partial:t})):(m={type:`text`,text:``},t.content.push(m),a.push({type:`text_start`,contentIndex:_(),partial:t}))),m.type===`thinking`?(m.thinking+=e.text,m.thinkingSignature=u(m.thinkingSignature,e.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:_(),delta:e.text,partial:t})):(m.text+=e.text,m.textSignature=u(m.textSignature,e.thoughtSignature),a.push({type:`text_delta`,contentIndex:_(),delta:e.text,partial:t}))}if(e.functionCall){m&&=(m.type===`text`?a.push({type:`text_end`,contentIndex:_(),content:m.text,partial:t}):a.push({type:`thinking_end`,contentIndex:_(),content:m.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()}_${++h}`:n,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};t.content.push(r),a.push({type:`toolcall_start`,contentIndex:_(),partial:t}),a.push({type:`toolcall_delta`,contentIndex:_(),delta:JSON.stringify(r.arguments),partial:t}),a.push({type:`toolcall_end`,contentIndex:_(),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}},i(e,t.usage))}if(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:_(),content:m.text,partial:t}):a.push({type:`thinking_end`,contentIndex:_(),content:m.thinking,partial:t})),r?.signal?.aborted)throw Error(`Request was aborted`);if(t.stopReason===`aborted`||t.stopReason===`error`)throw Error(`An unknown error occurred`);a.push({type:`done`,reason:t.stopReason,message:t}),a.end()}catch(e){for(let e of t.content)`index`in e&&delete e.index;t.stopReason=r?.signal?.aborted?`aborted`:`error`,t.errorMessage=e instanceof Error?e.message:JSON.stringify(e),a.push({type:`error`,reason:t.stopReason,error:t}),a.end()}})(),a},_=(t,r,i)=>{let a=n(t,i,void 0);if(!i?.reasoning)return g(t,r,{...a,thinking:{enabled:!1}});let o=e(t,i.reasoning),s=o===`off`?`high`:o,c=t;return O(c)||k(c)?g(t,r,{...a,thinking:{enabled:!0,level:j(s,c)}}):g(t,r,{...a,thinking:{enabled:!0,budgetTokens:M(c,s,i.thinkingBudgets)}})};function v(e,t,n,r){return new f({vertexai:!0,project:t,location:n,apiVersion:`v1`,httpOptions:b(e,r)})}function y(e,t,n){return new f({vertexai:!0,apiKey:t,apiVersion:`v1`,httpOptions:b(e,n)})}function b(e,t){let n={},r=x(e.baseUrl);return r&&(n.baseUrl=r,n.baseUrlResourceScope=o.COLLECTION,S(r)&&(n.apiVersion=``)),(e.headers||t)&&(n.headers={...e.headers,...t}),Object.keys(n).length>0?n:void 0}function x(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function S(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function C(e){let t=e?.apiKey?.trim()||{}.GOOGLE_CLOUD_API_KEY?.trim();if(!(!t||t===`gcp-vertex-credentials`||w(t)))return t}function w(e){return/^<[^>]+>$/.test(e)}function T(e){let t=e?.project||{}.GOOGLE_CLOUD_PROJECT||{}.GCLOUD_PROJECT;if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function E(e){let t=e?.location||{}.GOOGLE_CLOUD_LOCATION;if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function D(e,t,n={}){let i=p(e,t),o={};n.temperature!==void 0&&(o.temperature=n.temperature),n.maxTokens!==void 0&&(o.maxOutputTokens=n.maxTokens);let s={...Object.keys(o).length>0&&o,...t.systemPrompt&&{systemInstruction:r(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:l(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:a(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=m[n.thinking.level],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=A(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 O(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function k(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function A(e){let t=e;return O(t)?{thinkingLevel:c.LOW}:k(t)?{thinkingLevel:c.MINIMAL}:{thinkingBudget:0}}function j(e,t){if(O(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function M(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`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{g as streamGoogleVertex,_ as streamSimpleGoogleVertex};
|