sliccy 2.19.1 → 2.20.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.
Files changed (58) hide show
  1. package/dist/ui/assets/{anthropic-jfXbKP8w.js → anthropic-BGyl3htz.js} +2 -2
  2. package/dist/ui/assets/{azure-openai-responses-Be3FIezJ.js → azure-openai-responses-CbKqafK7.js} +1 -1
  3. package/dist/ui/assets/{dist-BZOmMqub.js → dist-BtQe82Xj.js} +1 -1
  4. package/dist/ui/assets/{dist-Ehp5JdjU2.js → dist-C1jAH56R2.js} +2 -2
  5. package/dist/ui/assets/{dist-B7V-aBlB.js → dist-D-rzXAqE.js} +1 -1
  6. package/dist/ui/assets/{dist-C1MjLlkt.js → dist-DTyc80cS.js} +1 -1
  7. package/dist/ui/assets/{dist-BZxeNw0j.js → dist-F76yn3C-.js} +1 -1
  8. package/dist/ui/assets/{es-C4eImHYv.js → es-Bkhta-LQ.js} +1 -1
  9. package/dist/ui/assets/fetch-body-ia_fTXBk.js +1 -0
  10. package/dist/ui/assets/fs-fz4iXNYW.js +3 -0
  11. package/dist/ui/assets/global-db-CDzv9YxJ.js +1 -0
  12. package/dist/ui/assets/{google-gemini-cli-CvfYAGzv.js → google-gemini-cli-BQI-9Qiz.js} +1 -1
  13. package/dist/ui/assets/{google-shared-FQyNXg85.js → google-shared-C4Mx5Yuj.js} +1 -1
  14. package/dist/ui/assets/{google-vertex-DmvsouTy.js → google-vertex-BAW4gsJc.js} +1 -1
  15. package/dist/ui/assets/{google-DbwefFoE.js → google-xZ4YOF3C.js} +1 -1
  16. package/dist/ui/assets/{index-bCn91XYu.js → index-BDkoDqER.js} +1819 -10249
  17. package/dist/ui/assets/index-DHeFq1cw.css +1 -0
  18. package/dist/ui/assets/{magick-wasm-frXbjDiE.js → magick-wasm-BxnW4fXL.js} +1 -1
  19. package/dist/ui/assets/{mistral-CqpwDSp6.js → mistral-DklsQMOz.js} +2 -2
  20. package/dist/ui/assets/onboarding-orchestrator-mN8Jb28x.js +1 -0
  21. package/dist/ui/assets/{openai-codex-responses-CJpk7FOM.js → openai-codex-responses-CZLVC7Uh.js} +1 -1
  22. package/dist/ui/assets/{openai-completions-DJtuyjaD.js → openai-completions-CzdXZQUw.js} +1 -1
  23. package/dist/ui/assets/{openai-responses-DsHPl0ae.js → openai-responses-DS9I74xC.js} +1 -1
  24. package/dist/ui/assets/{openai-responses-shared-Di2uqygE.js → openai-responses-shared-ITjOx1DN.js} +1 -1
  25. package/dist/ui/assets/provider-settings-DX0seAAp.js +95 -0
  26. package/dist/ui/assets/{pyodide-B0c5k_as.js → pyodide-MFQZaztQ.js} +2 -2
  27. package/dist/ui/assets/{skills-DOSaN1J0.js → skills-Dtogt9Eh.js} +1 -1
  28. package/dist/ui/assets/{slicc-editor-YtGc7gid.js → slicc-editor-CQDcP7mc.js} +2 -2
  29. package/dist/ui/assets/{sql-wasm-CNZ88Vcf.js → sql-wasm-D9K_zXBO.js} +1 -1
  30. package/dist/ui/index.html +14 -12
  31. package/dist/ui/packages/webapp/index.html +14 -12
  32. package/package.json +1 -1
  33. package/dist/ui/assets/fs-Bs8Vlxfm.js +0 -3
  34. package/dist/ui/assets/index-C6L2cW9t.css +0 -1
  35. package/dist/ui/assets/provider-settings-DQ98Ko9l.js +0 -95
  36. /package/dist/ui/assets/{__vite-browser-external-MxCBxUMe.js → __vite-browser-external-CdaqDer8.js} +0 -0
  37. /package/dist/ui/assets/{addon-fit-CniRnSyE.js → addon-fit-_YHcqy0h.js} +0 -0
  38. /package/dist/ui/assets/{bsh-watchdog-BofJVeV-.js → bsh-watchdog-DaMIn7RH.js} +0 -0
  39. /package/dist/ui/assets/{chat-fixture-Blio0Wdt.js → chat-fixture-Dp2mIM1B.js} +0 -0
  40. /package/dist/ui/assets/{constants-BnzYaC4L.js → constants-BRXVgFtB.js} +0 -0
  41. /package/dist/ui/assets/{db-CJnk7hWr.js → db-De872N8_.js} +0 -0
  42. /package/dist/ui/assets/{dist-BreQU7P7.js → dist-4mA3RMrN.js} +0 -0
  43. /package/dist/ui/assets/{dist-CEBWSFtw.js → dist-phq8AUaz.js} +0 -0
  44. /package/dist/ui/assets/{github-copilot-headers-BFowJEWi.js → github-copilot-headers-4kWA0Xn_.js} +0 -0
  45. /package/dist/ui/assets/{hash-B7CztTb_.js → hash-BxH-1uxX.js} +0 -0
  46. /package/dist/ui/assets/{headers-CrRy8cka.js → headers-DstdYk4t.js} +0 -0
  47. /package/dist/ui/assets/{lick-manager-proxy-Dw3D3AzG.js → lick-manager-proxy-DYlDsj9K.js} +0 -0
  48. /package/dist/ui/assets/{oauth-service-DUXASG7L.js → oauth-service-CKR4S63v.js} +0 -0
  49. /package/dist/ui/assets/{offscreen-client-CsH6V__l.js → offscreen-client-CW9l4qPQ.js} +0 -0
  50. /package/dist/ui/assets/{openai-CuiHR4mv.js → openai-5CK-qymG.js} +0 -0
  51. /package/dist/ui/assets/{path-utils-DFPXxD-4.js → path-utils-DOZrxGax.js} +0 -0
  52. /package/dist/ui/assets/{pdfjs-Bc7iJ0mN.js → pdfjs-7FN3p2zx.js} +0 -0
  53. /package/dist/ui/assets/{rum-DO8u_wTG.js → rum-C22a_afY.js} +0 -0
  54. /package/dist/ui/assets/{sanitize-unicode-6mS7gbvU.js → sanitize-unicode-DndIFJRs.js} +0 -0
  55. /package/dist/ui/assets/{secret-masking-ZNVanUmG.js → secret-masking-D8cHWx2y.js} +0 -0
  56. /package/dist/ui/assets/{simple-options-CP_5aL7H.js → simple-options-DmhWMfpt.js} +0 -0
  57. /package/dist/ui/assets/{src-BqF-C6jp.js → src-C0qlzztM.js} +0 -0
  58. /package/dist/ui/assets/{xterm-BaLOnk9X.js → xterm-GX0WTpdZ.js} +0 -0
@@ -1 +1 @@
1
- import{a as e,n as t,r as n,s as r}from"./simple-options-CP_5aL7H.js";import{t as i}from"./sanitize-unicode-6mS7gbvU.js";import{c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f,u as p}from"./google-shared-FQyNXg85.js";var m=`v1`,h=`gcp-vertex-credentials`,g={THINKING_LEVEL_UNSPECIFIED:p.THINKING_LEVEL_UNSPECIFIED,MINIMAL:p.MINIMAL,LOW:p.LOW,MEDIUM:p.MEDIUM,HIGH:p.HIGH},_=0,v=(t,n,i)=>{let a=new e;return(async()=>{let e={role:`assistant`,content:[],api:`google-vertex`,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 s=T(i),c=s?x(t,s,i?.headers):b(t,D(i),O(i),i?.headers),l=k(t,n,i),f=await i?.onPayload?.(l,t);f!==void 0&&(l=f);let p=await c.models.generateContentStream(l);a.push({type:`start`,partial:e});let m=null,h=e.content,g=()=>h.length-1;for await(let n of p){e.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=u(t);(!m||n&&m.type!==`thinking`||!n&&m.type!==`text`)&&(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:h.length-1,content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:m.thinking,partial:e})),n?(m={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(m),a.push({type:`thinking_start`,contentIndex:g(),partial:e})):(m={type:`text`,text:``},e.content.push(m),a.push({type:`text_start`,contentIndex:g(),partial:e}))),m.type===`thinking`?(m.thinking+=t.text,m.thinkingSignature=d(m.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:g(),delta:t.text,partial:e})):(m.text+=t.text,m.textSignature=d(m.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:g(),delta:t.text,partial:e}))}if(t.functionCall){m&&=(m.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:m.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()}_${++_}`: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=o(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&(e.stopReason=`toolUse`)),n.usageMetadata&&(e.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}},r(t,e.usage))}if(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:m.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=t instanceof Error?t.message:JSON.stringify(t),a.push({type:`error`,reason:e.stopReason,error:e}),a.end()}})(),a},y=(e,r,i)=>{let a=t(e,i,void 0);if(!i?.reasoning)return v(e,r,{...a,thinking:{enabled:!1}});let o=n(i.reasoning),s=e;return A(s)||j(s)?v(e,r,{...a,thinking:{enabled:!0,level:N(o,s)}}):v(e,r,{...a,thinking:{enabled:!0,budgetTokens:P(s,o,i.thinkingBudgets)}})};function b(e,t,n,r){return new a({vertexai:!0,project:t,location:n,apiVersion:m,httpOptions:S(e,r)})}function x(e,t,n){return new a({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=s.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=f(e,t),a={};n.temperature!==void 0&&(a.temperature=n.temperature),n.maxTokens!==void 0&&(a.maxOutputTokens=n.maxTokens);let o={...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?o.toolConfig={functionCallingConfig:{mode:l(n.toolChoice)}}:o.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],o.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(o.thinkingConfig=M(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);o.abortSignal=n.signal}return{model:e.id,contents:r,config:o}}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:p.LOW}:j(t)?{thinkingLevel:p.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
+ import{a as e,n as t,r as n,s as r}from"./simple-options-DmhWMfpt.js";import{t as i}from"./sanitize-unicode-DndIFJRs.js";import{c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f,u as p}from"./google-shared-C4Mx5Yuj.js";var m=`v1`,h=`gcp-vertex-credentials`,g={THINKING_LEVEL_UNSPECIFIED:p.THINKING_LEVEL_UNSPECIFIED,MINIMAL:p.MINIMAL,LOW:p.LOW,MEDIUM:p.MEDIUM,HIGH:p.HIGH},_=0,v=(t,n,i)=>{let a=new e;return(async()=>{let e={role:`assistant`,content:[],api:`google-vertex`,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 s=T(i),c=s?x(t,s,i?.headers):b(t,D(i),O(i),i?.headers),l=k(t,n,i),f=await i?.onPayload?.(l,t);f!==void 0&&(l=f);let p=await c.models.generateContentStream(l);a.push({type:`start`,partial:e});let m=null,h=e.content,g=()=>h.length-1;for await(let n of p){e.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=u(t);(!m||n&&m.type!==`thinking`||!n&&m.type!==`text`)&&(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:h.length-1,content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:m.thinking,partial:e})),n?(m={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(m),a.push({type:`thinking_start`,contentIndex:g(),partial:e})):(m={type:`text`,text:``},e.content.push(m),a.push({type:`text_start`,contentIndex:g(),partial:e}))),m.type===`thinking`?(m.thinking+=t.text,m.thinkingSignature=d(m.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:g(),delta:t.text,partial:e})):(m.text+=t.text,m.textSignature=d(m.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:g(),delta:t.text,partial:e}))}if(t.functionCall){m&&=(m.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:m.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()}_${++_}`: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=o(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&(e.stopReason=`toolUse`)),n.usageMetadata&&(e.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}},r(t,e.usage))}if(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:g(),content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:g(),content:m.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=t instanceof Error?t.message:JSON.stringify(t),a.push({type:`error`,reason:e.stopReason,error:e}),a.end()}})(),a},y=(e,r,i)=>{let a=t(e,i,void 0);if(!i?.reasoning)return v(e,r,{...a,thinking:{enabled:!1}});let o=n(i.reasoning),s=e;return A(s)||j(s)?v(e,r,{...a,thinking:{enabled:!0,level:N(o,s)}}):v(e,r,{...a,thinking:{enabled:!0,budgetTokens:P(s,o,i.thinkingBudgets)}})};function b(e,t,n,r){return new a({vertexai:!0,project:t,location:n,apiVersion:m,httpOptions:S(e,r)})}function x(e,t,n){return new a({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=s.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=f(e,t),a={};n.temperature!==void 0&&(a.temperature=n.temperature),n.maxTokens!==void 0&&(a.maxOutputTokens=n.maxTokens);let o={...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?o.toolConfig={functionCallingConfig:{mode:l(n.toolChoice)}}:o.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],o.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(o.thinkingConfig=M(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);o.abortSignal=n.signal}return{model:e.id,contents:r,config:o}}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:p.LOW}:j(t)?{thinkingLevel:p.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{a as e,n as t,r as n,s as r}from"./simple-options-CP_5aL7H.js";import{u as i}from"./index-bCn91XYu.js";import{t as a}from"./sanitize-unicode-6mS7gbvU.js";import{c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./google-shared-FQyNXg85.js";var p=0,m=(t,n,a)=>{let o=new e;return(async()=>{let e={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||i(t.provider)||``,a?.headers),l=_(t,n,a),f=await a?.onPayload?.(l,t);f!==void 0&&(l=f);let m=await c.models.generateContentStream(l);o.push({type:`start`,partial:e});let h=null,v=e.content,y=()=>v.length-1;for await(let n of m){e.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=u(t);(!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:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e})),n?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:e})):(h={type:`text`,text:``},e.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:e}))),h.type===`thinking`?(h.thinking+=t.text,h.thinkingSignature=d(h.thinkingSignature,t.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:t.text,partial:e})):(h.text+=t.text,h.textSignature=d(h.textSignature,t.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:t.text,partial:e}))}if(t.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.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()}_${++p}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),o.push({type:`toolcall_start`,contentIndex:y(),partial:e}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(r.arguments),partial:e}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:r,partial:e})}}i?.finishReason&&(e.stopReason=s(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&(e.stopReason=`toolUse`)),n.usageMetadata&&(e.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}},r(t,e.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e})),a?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`aborted`||e.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:e.stopReason,message:e}),o.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=a?.signal?.aborted?`aborted`:`error`,e.errorMessage=t instanceof Error?t.message:JSON.stringify(t),o.push({type:`error`,reason:e.stopReason,error:e}),o.end()}})(),o},h=(e,r,a)=>{let o=a?.apiKey||i(e.provider);if(!o)throw Error(`No API key for provider: ${e.provider}`);let s=t(e,a,o);if(!a?.reasoning)return m(e,r,{...s,thinking:{enabled:!1}});let c=n(a.reasoning),l=e;return y(l)||b(l)||v(l)?m(e,r,{...s,thinking:{enabled:!0,level:S(c,l)}}):m(e,r,{...s,thinking:{enabled:!0,budgetTokens:C(l,c,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 o({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 o={...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?o.toolConfig={functionCallingConfig:{mode:l(n.toolChoice)}}:o.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,o.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(o.thinkingConfig=x(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);o.abortSignal=n.signal}return{model:e.id,contents:r,config:o}}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
+ import{a as e,n as t,r as n,s as r}from"./simple-options-DmhWMfpt.js";import{d as i}from"./index-BDkoDqER.js";import{t as a}from"./sanitize-unicode-DndIFJRs.js";import{c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./google-shared-C4Mx5Yuj.js";var p=0,m=(t,n,a)=>{let o=new e;return(async()=>{let e={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||i(t.provider)||``,a?.headers),l=_(t,n,a),f=await a?.onPayload?.(l,t);f!==void 0&&(l=f);let m=await c.models.generateContentStream(l);o.push({type:`start`,partial:e});let h=null,v=e.content,y=()=>v.length-1;for await(let n of m){e.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=u(t);(!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:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e})),n?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:e})):(h={type:`text`,text:``},e.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:e}))),h.type===`thinking`?(h.thinking+=t.text,h.thinkingSignature=d(h.thinkingSignature,t.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:t.text,partial:e})):(h.text+=t.text,h.textSignature=d(h.textSignature,t.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:t.text,partial:e}))}if(t.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.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()}_${++p}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),o.push({type:`toolcall_start`,contentIndex:y(),partial:e}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(r.arguments),partial:e}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:r,partial:e})}}i?.finishReason&&(e.stopReason=s(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&(e.stopReason=`toolUse`)),n.usageMetadata&&(e.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}},r(t,e.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e})),a?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`aborted`||e.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:e.stopReason,message:e}),o.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=a?.signal?.aborted?`aborted`:`error`,e.errorMessage=t instanceof Error?t.message:JSON.stringify(t),o.push({type:`error`,reason:e.stopReason,error:e}),o.end()}})(),o},h=(e,r,a)=>{let o=a?.apiKey||i(e.provider);if(!o)throw Error(`No API key for provider: ${e.provider}`);let s=t(e,a,o);if(!a?.reasoning)return m(e,r,{...s,thinking:{enabled:!1}});let c=n(a.reasoning),l=e;return y(l)||b(l)||v(l)?m(e,r,{...s,thinking:{enabled:!0,level:S(c,l)}}):m(e,r,{...s,thinking:{enabled:!0,budgetTokens:C(l,c,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 o({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 o={...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?o.toolConfig={functionCallingConfig:{mode:l(n.toolChoice)}}:o.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,o.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(o.thinkingConfig=x(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);o.abortSignal=n.signal}return{model:e.id,contents:r,config:o}}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};