sliccy 5.40.0 → 5.41.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/dist/ui/assets/account-store-B6ZJJHvy.js +103 -0
- package/dist/ui/assets/{account-store-hXYe6llx.js → account-store-Cc0LlOh0.js} +1 -1
- package/dist/ui/assets/adobe-B1BRYIRE.js +1 -0
- package/dist/ui/assets/adobe-BN-bE_SL.js +2 -0
- package/dist/ui/assets/{adobe-oauth-state-DW-IwDjB.js → adobe-oauth-state-Cn7LWTPZ.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-BDP4kUxn.js → agent-message-to-chat-DpqjbP5x.js} +1 -1
- package/dist/ui/assets/anthropic-messages-BP_xL8Mh.js +39 -0
- package/dist/ui/assets/anthropic-messages-BwBPoNP0.js +39 -0
- package/dist/ui/assets/{apps-rQgl-cpB.js → apps-CaQ1gkO4.js} +1 -1
- package/dist/ui/assets/{azure-openai-BGD2kY_f.js → azure-openai-CsaPL24q.js} +1 -1
- package/dist/ui/assets/{azure-openai-Dw-PBopQ.js → azure-openai-DZpoByWz.js} +1 -1
- package/dist/ui/assets/azure-openai-responses-BXDkTtSH.js +1 -0
- package/dist/ui/assets/azure-openai-responses-De9pJjBR.js +1 -0
- package/dist/ui/assets/bedrock-camp-CZFsedRI.js +1 -0
- package/dist/ui/assets/bedrock-camp-Czep_VHL.js +1 -0
- package/dist/ui/assets/{cerebras-DlQY_TSV.js → cerebras-CSyaZ_JD.js} +1 -1
- package/dist/ui/assets/{cerebras-kLjh5Y4m.js → cerebras-D9qOK7yO.js} +1 -1
- package/dist/ui/assets/compat-FrhC6T45.js +2 -0
- package/dist/ui/assets/{connect-surface-B9fZF0bW.js → connect-surface-BX9u-44v.js} +1 -1
- package/dist/ui/assets/{context-compaction-DaxQExZG.js → context-compaction-LYFtS2_f.js} +1 -1
- package/dist/ui/assets/dip-CjRcTAWq.js +1 -0
- package/dist/ui/assets/{dist-C4rnF_u9.js → dist-PxfR5esr.js} +1 -1
- package/dist/ui/assets/{dist-SCTbiXRc.js → dist-UblS7Ad_.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-C8wT1Kva.js → ensure-speech-assets-c4Yyh5Hl.js} +1 -1
- package/dist/ui/assets/error-body-C0EnfbdK.js +1 -0
- package/dist/ui/assets/esp8266-DUadcjG-.js +1 -0
- package/dist/ui/assets/{esptool-operations-D0PMNTBy.js → esptool-operations-C6yQIM3h.js} +2 -2
- package/dist/ui/assets/{fs-DJdIY3mI.js → fs-Be9_eBTx.js} +2 -2
- package/dist/ui/assets/{fs-C9drMRXK.js → fs-r9jcBgqR.js} +1 -1
- package/dist/ui/assets/{github-Dr0PBLdJ.js → github-789iE9_f.js} +2 -2
- package/dist/ui/assets/{github-DRGaGMIq.js → github-CBrBpJFF.js} +1 -1
- package/dist/ui/assets/{github-copilot-DTMNK2iN.js → github-copilot-BpWUXuYW.js} +1 -1
- package/dist/ui/assets/{github-copilot-B5MsC-Mh.js → github-copilot-CHXKNa6E.js} +1 -1
- package/dist/ui/assets/google-generative-ai-C58ldv83.js +1 -0
- package/dist/ui/assets/google-generative-ai-Eq6eGS5h.js +1 -0
- package/dist/ui/assets/{google-shared-mehyRjje.js → google-shared-DQbld86Z.js} +1 -1
- package/dist/ui/assets/{google-shared-0Fg2dFO2.js → google-shared-DwCjfFnw.js} +1 -1
- package/dist/ui/assets/google-vertex-C18Xl3dV.js +1 -0
- package/dist/ui/assets/google-vertex-CkkAgSFr.js +1 -0
- package/dist/ui/assets/{hear-CtbSNbmL.js → hear-Bag-j0V7.js} +1 -1
- package/dist/ui/assets/{kernel-worker-M4OSUjLe.js → kernel-worker-DzzwltLv.js} +1081 -1081
- package/dist/ui/assets/{kokoro-engine-CHDadqXT.js → kokoro-engine-BY5-MJ4F.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-HfRG1D9a.js → lick-ws-bridge-BA7kFq6f.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-BNbPpvx4.js → lick-ws-bridge-BBONAMUp.js} +1 -1
- package/dist/ui/assets/{local-llm-DMeLZ6lb.js → local-llm-CZI41QZ8.js} +1 -1
- package/dist/ui/assets/main-BBWzFPQm.js +24 -0
- package/dist/ui/assets/{mistral-conversations-CoropYyn.js → mistral-conversations-DKqvekSA.js} +2 -2
- package/dist/ui/assets/{mistral-conversations-BD1LHG49.js → mistral-conversations-szVW8BsU.js} +2 -2
- package/dist/ui/assets/{mount-DTRYDdBi.js → mount-CB_TFmaj.js} +1 -1
- package/dist/ui/assets/{mount-DKLuOjhC.js → mount-x5DyWWmZ.js} +2 -2
- package/dist/ui/assets/{new-session-D9geKvL4.js → new-session-bNLCxDOi.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-pcB_o7_p.js → oauth-bootstrap-CbMHDv7j.js} +2 -2
- package/dist/ui/assets/{openai-codex-Bm1P7I1P.js → openai-codex-Bno6nph_.js} +1 -1
- package/dist/ui/assets/{openai-codex-B-tq0InW.js → openai-codex-DO53z_Lp.js} +1 -1
- package/dist/ui/assets/openai-codex-responses-BDYh8ojD.js +7 -0
- package/dist/ui/assets/openai-codex-responses-C7QnNmC0.js +7 -0
- package/dist/ui/assets/openai-completions-BnAjXzgN.js +5 -0
- package/dist/ui/assets/openai-completions-t-glszMQ.js +5 -0
- package/dist/ui/assets/openai-responses-BofM6cmY.js +1 -0
- package/dist/ui/assets/openai-responses-o9_kr7GP.js +1 -0
- package/dist/ui/assets/openai-responses-shared-79gch22X.js +10 -0
- package/dist/ui/assets/openai-responses-shared-DKPwc9Eh.js +10 -0
- package/dist/ui/assets/openrouter-images-D0dgD5eX.js +1 -0
- package/dist/ui/assets/openrouter-images-PT0FZmkM.js +1 -0
- package/dist/ui/assets/{page-follower-tray-CB-5guCo.js → page-follower-tray-BnjUXDPD.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-Bw3OaUZN.js → panel-rpc-handlers-B8qUvr10.js} +2 -2
- package/dist/ui/assets/{provider-CpPdfI7j.js → provider-DC8kAP4A.js} +2 -2
- package/dist/ui/assets/{provider-BLHkVFKJ.js → provider-mu81QxQG.js} +1 -1
- package/dist/ui/assets/provider-store-access-BuFw0JKG.js +1 -0
- package/dist/ui/assets/provider-store-access-C_kNLQdJ.js +1 -0
- package/dist/ui/assets/{providers-ekTC5xpd.js → providers-D8GpXQnB.js} +2 -2
- package/dist/ui/assets/{providers-BeDyVcSi.js → providers-Ddxs0W8T.js} +1 -1
- package/dist/ui/assets/{quick-llm-crEbkH6q.js → quick-llm-Quagspyf.js} +1 -1
- package/dist/ui/assets/session-freezer-ChBPlDLR.js +1 -0
- package/dist/ui/assets/{speak-BKhMmu0q.js → speak-OWEJeikh.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-DJEGpbEL.js → sprinkle-manager-BKxGmOIl.js} +1 -1
- package/dist/ui/assets/{store-SugE11kf.js → store-CHYvCaH1.js} +1 -1
- package/dist/ui/assets/{sudo-8FlHSwPf.js → sudo-D4b0hE0I.js} +1 -1
- package/dist/ui/assets/transform-messages-DwI5R8if.js +1 -0
- package/dist/ui/assets/{transform-messages-CQuDksPz.js → transform-messages-ZX8cvJiJ.js} +1 -1
- package/dist/ui/assets/{transformers-env-Dm6KYkFB.js → transformers-env-1gFISbS1.js} +1 -1
- package/dist/ui/assets/{tray-leader-BEuWSPjO.js → tray-leader-CwiLM5-x.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-xQpmmvcJ.js → tray-leave-runtime-DQafc8zo.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-BmINZ5Oh.js → upgrade-detection-487abG_R.js} +1 -1
- package/dist/ui/assets/{voice-reply-BVSzlCQd.js → voice-reply-BWuWySTa.js} +1 -1
- package/dist/ui/assets/{wc-attach-zuw07y30.js → wc-attach-D0-Z2ZnU.js} +2 -2
- package/dist/ui/assets/{wc-extension-DkFWiXyA.js → wc-extension-DPoDkrXB.js} +2 -2
- package/dist/ui/assets/{wc-follower-BpVE8bZM.js → wc-follower-CMZy0UC8.js} +3 -3
- package/dist/ui/assets/wc-live-B6XBQ3Ph.js +258 -0
- package/dist/ui/assets/{wc-nav-D76G_K-8.js → wc-nav-Bip6J07i.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-C6hoCgyi.js → wc-onboarding-D0f-t12r.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-CCAMhCT0.js → wc-placeholder-C48kBOSX.js} +3 -3
- package/dist/ui/assets/{wc-settings-Ds_UySgO.js → wc-settings-kViiUzrv.js} +3 -3
- package/dist/ui/assets/{wc-shell-ChVfRkDg.js → wc-shell-C6CXABEp.js} +3 -3
- package/dist/ui/assets/{wc-sprinkles-ZlT4-gI3.js → wc-sprinkles-CybsDQpb.js} +2 -2
- package/dist/ui/assets/wc-tray-CkppgzxX.js +2 -0
- package/dist/ui/assets/{whisper-engine-Dq-ISOvb.js → whisper-engine-D7GZgIFR.js} +1 -1
- package/dist/ui/assets/{xai-grok-BeVMpO7i.js → xai-grok-B73mxnXH.js} +1 -1
- package/dist/ui/assets/{xai-grok-DpCU3Vf9.js → xai-grok-Bv-1jkIm.js} +1 -1
- package/dist/ui/index.html +7 -7
- package/dist/ui/packages/webapp/index.html +7 -7
- package/package.json +1 -1
- package/dist/ui/assets/account-store-CEtbM5ni.js +0 -103
- package/dist/ui/assets/adobe-DGmDeCd3.js +0 -2
- package/dist/ui/assets/adobe-cPrvHbnb.js +0 -1
- package/dist/ui/assets/anthropic-messages-DP3-Xd3J.js +0 -39
- package/dist/ui/assets/anthropic-messages-DSmP2_-Q.js +0 -39
- package/dist/ui/assets/azure-openai-responses-CEEm6_Xn.js +0 -1
- package/dist/ui/assets/azure-openai-responses-YO8iO-Ch.js +0 -1
- package/dist/ui/assets/bedrock-camp-DVKDCEuf.js +0 -1
- package/dist/ui/assets/bedrock-camp-DbZ6Mjym.js +0 -1
- package/dist/ui/assets/compat-DADQxxLV.js +0 -2
- package/dist/ui/assets/dip-DLGbA_M8.js +0 -1
- package/dist/ui/assets/esp8266-BhWeHRu0.js +0 -1
- package/dist/ui/assets/google-generative-ai-Cz3VHJVe.js +0 -1
- package/dist/ui/assets/google-generative-ai-DRLjqQHr.js +0 -1
- package/dist/ui/assets/google-vertex-C8F4Q-3-.js +0 -1
- package/dist/ui/assets/google-vertex-DI_ybVGc.js +0 -1
- package/dist/ui/assets/main-C_E1hhV6.js +0 -24
- package/dist/ui/assets/openai-codex-responses-DUWTsNB0.js +0 -7
- package/dist/ui/assets/openai-codex-responses-DcE8b3Us.js +0 -7
- package/dist/ui/assets/openai-completions-2m5htnw8.js +0 -5
- package/dist/ui/assets/openai-completions-CPxuOo6h.js +0 -5
- package/dist/ui/assets/openai-responses-BIaF8Olv.js +0 -1
- package/dist/ui/assets/openai-responses-D3YJWUR5.js +0 -1
- package/dist/ui/assets/openai-responses-shared-1KvKQf-4.js +0 -12
- package/dist/ui/assets/openai-responses-shared-CEQMR7Nx.js +0 -12
- package/dist/ui/assets/openrouter-images-CHaqAs_0.js +0 -1
- package/dist/ui/assets/openrouter-images-CIagBWVL.js +0 -1
- package/dist/ui/assets/provider-store-access-BGivQpbO.js +0 -1
- package/dist/ui/assets/provider-store-access-C4gvtXXH.js +0 -1
- package/dist/ui/assets/session-freezer-2cCjCk93.js +0 -1
- package/dist/ui/assets/transform-messages-D7OsqBmU.js +0 -1
- package/dist/ui/assets/wc-live-DsVoxwUC.js +0 -258
- package/dist/ui/assets/wc-tray-3cfbfVP2.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{t as n}from"./transform-messages-
|
|
1
|
+
import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{t as n}from"./transform-messages-ZX8cvJiJ.js";import{t as r}from"./sanitize-unicode-DmIE6hZJ.js";var i=t(((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=t((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=t(((e,t)=>{t.exports=a()})),s=e(t(((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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e,o as t,r as n,s as r}from"./transform-messages-ZX8cvJiJ.js";import{t as i}from"./provider-env-DwY8YuMk.js";import{n as a}from"./headers-CbDaTl3c.js";import{t as o}from"./sanitize-unicode-DmIE6hZJ.js";import{n as s,t as c}from"./error-body-C0EnfbdK.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _}from"./google-shared-DwCjfFnw.js";const v={THINKING_LEVEL_UNSPECIFIED:f.THINKING_LEVEL_UNSPECIFIED,MINIMAL:f.MINIMAL,LOW:f.LOW,MEDIUM:f.MEDIUM,HIGH:f.HIGH};let y=0;const b=(n,r,i)=>{let a=new e;return(async()=>{let e={role:`assistant`,content:[],api:`google-vertex`,provider:n.provider,model:n.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let o=O(i),s=o?C(n,o,i?.headers):S(n,A(i),j(i),i?.headers,i?.env),c=M(n,r,i),l=await i?.onPayload?.(c,n);l!==void 0&&(c=l);let u=await s.models.generateContentStream(c);a.push({type:`start`,partial:e});let f=null,p=e.content,g=()=>p.length-1;for await(let r of u){e.responseId||=r.responseId;let i=r.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=h(t);(!f||n&&f.type!==`thinking`||!n&&f.type!==`text`)&&(f&&(f.type===`text`?a.push({type:`text_end`,contentIndex:p.length-1,content:f.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:e})),n?(f={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(f),a.push({type:`thinking_start`,contentIndex:g(),partial:e})):(f={type:`text`,text:``},e.content.push(f),a.push({type:`text_start`,contentIndex:g(),partial:e}))),f.type===`thinking`?(f.thinking+=t.text,f.thinkingSignature=m(f.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:g(),delta:t.text,partial:e})):(f.text+=t.text,f.textSignature=m(f.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:g(),delta:t.text,partial:e}))}if(t.functionCall){f&&=(f.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:f.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:e}),null);let n=t.functionCall.id,r={type:`toolCall`,id:!n||e.content.some(e=>e.type===`toolCall`&&e.id===n)?`${t.functionCall.name}_${Date.now()}_${++y}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),a.push({type:`toolcall_start`,contentIndex:g(),partial:e}),a.push({type:`toolcall_delta`,contentIndex:g(),delta:JSON.stringify(r.arguments),partial:e}),a.push({type:`toolcall_end`,contentIndex:g(),toolCall:r,partial:e})}}i?.finishReason&&(e.stopReason=d(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&(e.stopReason=`toolUse`)),r.usageMetadata&&(e.usage={input:(r.usageMetadata.promptTokenCount||0)-(r.usageMetadata.cachedContentTokenCount||0),output:(r.usageMetadata.candidatesTokenCount||0)+(r.usageMetadata.thoughtsTokenCount||0),cacheRead:r.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:r.usageMetadata.thoughtsTokenCount||0,totalTokens:r.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},t(n,e.usage))}if(f&&(f.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:f.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:e})),i?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`aborted`||e.stopReason===`error`)throw Error(`An unknown error occurred`);a.push({type:`done`,reason:e.stopReason,message:e}),a.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=i?.signal?.aborted?`aborted`:`error`,e.errorMessage=c(s(t)),a.push({type:`error`,reason:e.stopReason,error:e}),a.end()}})(),a},x=(e,t,i)=>{let a=n(e,t,i,void 0);if(!i?.reasoning)return b(e,t,{...a,thinking:{enabled:!1}});let o=r(e,i.reasoning),s=o===`off`?`high`:o,c=e;return N(c)||P(c)?b(e,t,{...a,thinking:{enabled:!0,level:I(s,c)}}):b(e,t,{...a,thinking:{enabled:!0,budgetTokens:L(c,s,i.thinkingBudgets)}})};function S(e,t,n,r,i){let a=D(i);return new g({vertexai:!0,project:t,location:n,apiVersion:`v1`,...a?{googleAuthOptions:a}:{},httpOptions:w(e,r)})}function C(e,t,n){return new g({vertexai:!0,apiKey:t,apiVersion:`v1`,httpOptions:w(e,n)})}function w(e,t){let n={},r=T(e.baseUrl);r&&(n.baseUrl=r,n.baseUrlResourceScope=u.COLLECTION,E(r)&&(n.apiVersion=``));let i=a({...e.headers,...t});return i&&(n.headers=i),Object.keys(n).length>0?n:void 0}function T(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function E(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 D(e){let t=i(`GOOGLE_APPLICATION_CREDENTIALS`,e);return t?{keyFilename:t}:void 0}function O(e){let t=e?.apiKey?.trim();if(!(!t||t===`gcp-vertex-credentials`||k(t)))return t}function k(e){return/^<[^>]+>$/.test(e)}function A(e){let t=e?.project||i(`GOOGLE_CLOUD_PROJECT`,e?.env)||i(`GCLOUD_PROJECT`,e?.env);if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function j(e){let t=e?.location||i(`GOOGLE_CLOUD_LOCATION`,e?.env);if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function M(e,t,n={}){let r=_(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let a={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:o(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:p(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?a.toolConfig={functionCallingConfig:{mode:l(n.toolChoice)}}:a.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=v[n.thinking.level],a.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(a.thinkingConfig=F(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);a.abortSignal=n.signal}return{model:e.id,contents:r,config:a}}function N(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function P(e){let t=e.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(t)||t===`gemini-flash-latest`||t===`gemini-flash-lite-latest`}function F(e){let t=e;return N(t)?{thinkingLevel:f.LOW}:P(t)?{thinkingLevel:f.MINIMAL}:{thinkingBudget:0}}function I(e,t){if(N(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 L(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{b as stream,x as streamSimple};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./models-ByRUWfA-.js";import{t as r}from"./provider-env-D37PhSJu.js";import{r as i}from"./transform-messages-DwI5R8if.js";import{n as a}from"./headers-CbDaTl3c.js";import{t as o}from"./sanitize-unicode-DmIE6hZJ.js";import{n as s,t as c}from"./error-body-C0EnfbdK.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _}from"./google-shared-DQbld86Z.js";var v=`v1`,y=`gcp-vertex-credentials`,b={THINKING_LEVEL_UNSPECIFIED:f.THINKING_LEVEL_UNSPECIFIED,MINIMAL:f.MINIMAL,LOW:f.LOW,MEDIUM:f.MEDIUM,HIGH:f.HIGH},x=0,S=(e,r,i)=>{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=A(i),s=o?T(e,o,i?.headers):w(e,M(i),N(i),i?.headers,i?.env),c=P(e,r,i),l=await i?.onPayload?.(c,e);l!==void 0&&(c=l);let u=await s.models.generateContentStream(c);a.push({type:`start`,partial:t});let f=null,p=t.content,g=()=>p.length-1;for await(let r of u){t.responseId||=r.responseId;let i=r.candidates?.[0];if(i?.content?.parts)for(let e of i.content.parts){if(e.text!==void 0){let n=h(e);(!f||n&&f.type!==`thinking`||!n&&f.type!==`text`)&&(f&&(f.type===`text`?a.push({type:`text_end`,contentIndex:p.length-1,content:f.text,partial:t}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:t})),n?(f={type:`thinking`,thinking:``,thinkingSignature:void 0},t.content.push(f),a.push({type:`thinking_start`,contentIndex:g(),partial:t})):(f={type:`text`,text:``},t.content.push(f),a.push({type:`text_start`,contentIndex:g(),partial:t}))),f.type===`thinking`?(f.thinking+=e.text,f.thinkingSignature=m(f.thinkingSignature,e.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:g(),delta:e.text,partial:t})):(f.text+=e.text,f.textSignature=m(f.textSignature,e.thoughtSignature),a.push({type:`text_delta`,contentIndex:g(),delta:e.text,partial:t}))}if(e.functionCall){f&&=(f.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:f.text,partial:t}):a.push({type:`thinking_end`,contentIndex:g(),content:f.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()}_${++x}`:n,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};t.content.push(r),a.push({type:`toolcall_start`,contentIndex:g(),partial:t}),a.push({type:`toolcall_delta`,contentIndex:g(),delta:JSON.stringify(r.arguments),partial:t}),a.push({type:`toolcall_end`,contentIndex:g(),toolCall:r,partial:t})}}i?.finishReason&&(t.stopReason=d(i.finishReason),t.content.some(e=>e.type===`toolCall`)&&(t.stopReason=`toolUse`)),r.usageMetadata&&(t.usage={input:(r.usageMetadata.promptTokenCount||0)-(r.usageMetadata.cachedContentTokenCount||0),output:(r.usageMetadata.candidatesTokenCount||0)+(r.usageMetadata.thoughtsTokenCount||0),cacheRead:r.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:r.usageMetadata.thoughtsTokenCount||0,totalTokens:r.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},n(e,t.usage))}if(f&&(f.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:f.text,partial:t}):a.push({type:`thinking_end`,contentIndex:g(),content:f.thinking,partial:t})),i?.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=i?.signal?.aborted?`aborted`:`error`,t.errorMessage=c(s(e)),a.push({type:`error`,reason:t.stopReason,error:t}),a.end()}})(),a},C=(t,n,r)=>{let a=i(t,n,r,void 0);if(!r?.reasoning)return S(t,n,{...a,thinking:{enabled:!1}});let o=e(t,r.reasoning),s=o===`off`?`high`:o,c=t;return F(c)||I(c)?S(t,n,{...a,thinking:{enabled:!0,level:R(s,c)}}):S(t,n,{...a,thinking:{enabled:!0,budgetTokens:z(c,s,r.thinkingBudgets)}})};function w(e,t,n,r,i){let a=k(i);return new g({vertexai:!0,project:t,location:n,apiVersion:v,...a?{googleAuthOptions:a}:{},httpOptions:E(e,r)})}function T(e,t,n){return new g({vertexai:!0,apiKey:t,apiVersion:v,httpOptions:E(e,n)})}function E(e,t){let n={},r=D(e.baseUrl);r&&(n.baseUrl=r,n.baseUrlResourceScope=u.COLLECTION,O(r)&&(n.apiVersion=``));let i=a({...e.headers,...t});return i&&(n.headers=i),Object.keys(n).length>0?n:void 0}function D(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function O(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 k(e){let t=r(`GOOGLE_APPLICATION_CREDENTIALS`,e);return t?{keyFilename:t}:void 0}function A(e){let t=e?.apiKey?.trim();if(!(!t||t===y||j(t)))return t}function j(e){return/^<[^>]+>$/.test(e)}function M(e){let t=e?.project||r(`GOOGLE_CLOUD_PROJECT`,e?.env)||r(`GCLOUD_PROJECT`,e?.env);if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function N(e){let t=e?.location||r(`GOOGLE_CLOUD_LOCATION`,e?.env);if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function P(e,t,n={}){let r=_(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let a={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:o(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:p(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?a.toolConfig={functionCallingConfig:{mode:l(n.toolChoice)}}:a.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=b[n.thinking.level],a.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(a.thinkingConfig=L(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);a.abortSignal=n.signal}return{model:e.id,contents:r,config:a}}function F(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function I(e){let t=e.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(t)||t===`gemini-flash-latest`||t===`gemini-flash-lite-latest`}function L(e){let t=e;return F(t)?{thinkingLevel:f.LOW}:I(t)?{thinkingLevel:f.MINIMAL}:{thinkingBudget:0}}function R(e,t){if(F(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 z(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{S as stream,C as streamSimple};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import{t}from"./wc-permissions-registry-C7PhTX3c.js";import{i as n,n as r,r as i}from"./whisper-engine-
|
|
1
|
+
import{t as e}from"./logger-LESFN7Hj.js";import{t}from"./wc-permissions-registry-C7PhTX3c.js";import{i as n,n as r,r as i}from"./whisper-engine-D7GZgIFR.js";const a=16e3;async function o(e){if(typeof AudioContext>`u`||typeof OfflineAudioContext>`u`)throw Error(`audio decoding requires a window/page realm (AudioContext unavailable)`);let t=new AudioContext,n;try{n=await t.decodeAudioData(e.slice(0))}finally{await t.close().catch(()=>{})}let r=Math.max(1,Math.ceil(n.duration*a)),i=new OfflineAudioContext(1,r,a),o=i.createBufferSource();return o.buffer=n,o.connect(i.destination),o.start(),(await i.startRendering()).getChannelData(0).slice(0)}e(`speech:whisper-session`);function s(e){return e?.split(`-`)[0]?.toLowerCase()||void 0}const c=e(`speech:hear`);let l={};function u(){return l.getPermissionSurface?l.getPermissionSurface():t()||null}function d(){if(typeof window>`u`)return null;let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}var f=class extends Error{code;constructor(e){super(p(e)),this.name=`SpeechRecognitionError`,this.code=e}};function p(e){switch(e){case`network`:case`service-not-allowed`:return"builtin speech recognition is unsupported in this browser (no Web Speech cloud backend) — use `hear --engine enhanced`";case`not-allowed`:return`microphone permission denied for builtin speech recognition`;case`audio-capture`:return`no microphone available for builtin speech recognition`;case`no-speech`:return`no speech detected`;case`aborted`:return`speech recognition aborted`;default:return`speech recognition error: ${e}`}}function m(e){return e instanceof f&&(e.code===`network`||e.code===`service-not-allowed`)}function h(e,t){let n=d();return n?new Promise((r,i)=>{let a=Date.now(),o=()=>Date.now()-a,s=new n;s.continuous=!1,s.interimResults=!1,e&&(s.lang=e),c.debug(`builtinOnce: recognizer constructed`,{lang:e??`(browser default)`,timeoutMs:t});let l=``,u=!1,d=setTimeout(()=>{c.debug(`builtinOnce: timeout reached — stopping recognizer`,{elapsedMs:o()});try{s.stop()}catch{}},t);s.onstart=()=>c.debug(`builtinOnce: onstart (recognition service active)`,{elapsedMs:o()}),s.onaudiostart=()=>c.debug(`builtinOnce: onaudiostart (capturing audio)`,{elapsedMs:o()}),s.onspeechstart=()=>c.debug(`builtinOnce: onspeechstart (speech detected)`,{elapsedMs:o()}),s.onspeechend=()=>c.debug(`builtinOnce: onspeechend (speech ended)`,{elapsedMs:o()}),s.onnomatch=()=>c.debug(`builtinOnce: onnomatch (no recognizable speech)`,{elapsedMs:o()}),s.onresult=e=>{let t=[];for(let n=0;n<e.results.length;n++)t.push(e.results[n][0]?.transcript??``);l=t.join(` `).trim(),c.debug(`builtinOnce: onresult`,{elapsedMs:o(),resultCount:e.results.length,transcriptLength:l.length})},s.onerror=e=>{if(e.error===`no-speech`||e.error===`aborted`){c.debug(`builtinOnce: onerror (non-fatal — ends with empty transcript)`,{elapsedMs:o(),code:e.error});return}u=!0,clearTimeout(d),c.error(`builtinOnce: onerror (fatal)`,{elapsedMs:o(),code:e.error}),i(new f(e.error))},s.onend=()=>{clearTimeout(d),u?c.debug(`builtinOnce: onend after fatal error (already rejected)`,{elapsedMs:o()}):(c.debug(`builtinOnce: onend — resolving`,{elapsedMs:o(),transcriptLength:l.length,empty:l.length===0}),r(l))},c.debug(`builtinOnce: calling recognizer.start()`,{elapsedMs:o()}),s.start()}):Promise.reject(Error(`speech recognition unavailable in this environment`))}async function g(e){let t={audio:e?{deviceId:{exact:e}}:!0},n=u();if(n){c.debug(`acquireMicrophoneStream: requesting microphone via permission surface`,{hasDeviceId:!!e});let r=await n.prompt({kinds:[`microphone`],description:`The hear command needs your microphone to transcribe speech.`,requestOptions:{microphone:{constraints:t}},skipIfGranted:!0});if(r.status!==`granted`){c.error(`acquireMicrophoneStream: microphone permission not granted`,{status:r.status,reason:r.reason});let e=r.message?`: ${r.message}`:``;throw Error(`microphone permission ${r.reason??r.status}${e}`)}let i=r.grants.find(e=>e.kind===`microphone`);if(!i)throw c.error(`acquireMicrophoneStream: permission granted without a microphone stream`),Error(`microphone permission granted without a stream`);return c.debug(`acquireMicrophoneStream: microphone stream acquired via surface`),i.stream}if(!navigator.mediaDevices?.getUserMedia)throw c.error(`acquireMicrophoneStream: getUserMedia unavailable in this realm`),Error(`microphone capture unavailable in this realm`);c.debug(`acquireMicrophoneStream: no permission surface; calling getUserMedia directly`);try{let e=await navigator.mediaDevices.getUserMedia(t);return c.debug(`acquireMicrophoneStream: getUserMedia succeeded (direct)`),e}catch(e){throw c.error(`acquireMicrophoneStream: getUserMedia failed (direct)`,e),e}}async function _(e){let t=await g(e),n=new MediaRecorder(t),r=[];n.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},n.start(500);let i=()=>{for(let e of t.getTracks())e.stop()};return{stop:()=>new Promise(e=>{n.onstop=()=>{i(),e(r.length?new Blob(r,{type:n.mimeType||`audio/webm`}):null)};try{n.stop()}catch{i(),e(null)}}),cancel:()=>{try{n.stop()}catch{}i()}}}async function v(e){if(!u())return c.debug(`primeBuiltinPermission: no permission surface; recognizer drives its own prompt`),null;c.debug(`primeBuiltinPermission: priming microphone grant via permission surface`,{hasDeviceId:!!e});let t=await g(e);return c.debug(`primeBuiltinPermission: microphone primed; holding stream open for recognizer`),t}function y(e){if(e){for(let t of e.getTracks())t.stop();c.debug(`primeBuiltinPermission: released primed microphone stream`)}}async function b(e,t){let n=await _(e.deviceId),i=``;try{i=await h(e.lang,t)}catch(e){c.warn(`builtin endpointing failed; transcribing captured audio anyway`,e)}let a=await n.stop();if(!a)return{transcript:i,engine:`builtin`};try{let t=await r(),n=await o(await a.arrayBuffer()),i=await t.transcribe(n,{language:s(e.lang)});if(i)return{transcript:i,engine:`enhanced`}}catch(e){c.warn(`whisper transcription failed; falling back to builtin text`,e)}return{transcript:i,engine:`builtin`}}async function x(e={}){let t=e.timeoutMs??3e4,r=e.engine??`auto`,i=n()===`ready`;if(r===`enhanced`&&!i)throw c.error(`hearCapture: enhanced engine requested but whisper is not ready`),Error("enhanced engine not ready — run `hear --warmup` (check progress with `hear --status`)");let a=r!==`builtin`&&i;if(c.debug(`hearCapture: engine dispatch`,{requested:r,enhancedReady:i,resolved:a?`enhanced`:`builtin`}),a)return b(e,t);let o=await v(e.deviceId);try{let n=await h(e.lang,t);return c.debug(`hearCapture: builtin recognition produced a transcript`),{transcript:n,engine:`builtin`}}catch(n){if(!m(n))throw c.error(`hearCapture: builtin recognition failed`,n),n;if(i)return c.debug(`hearCapture: builtin unsupported in this browser; falling back to enhanced whisper`),y(o),o=null,b(e,t);throw c.error(`hearCapture: builtin unsupported and whisper not ready`,{code:n.code}),n}finally{y(o)}}async function S(e,t){let n=await r(),i=await o(e);return{transcript:await n.transcribe(i,{language:s(t)}),engine:`enhanced`}}function C(){let e=i();return{state:n(),...e?{loaded:e.loaded,total:e.total,etaSeconds:e.etaSeconds}:{}}}function w(){return r().catch(()=>{}),C()}export{x as hearCapture,C as hearStatus,S as hearTranscribe,w as hearWarmup};
|