sliccy 6.43.0 → 6.43.1

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 (143) hide show
  1. package/dist/node-server/electron-controller.d.ts +34 -2
  2. package/dist/node-server/electron-controller.js +21 -4
  3. package/dist/node-server/index.js +8 -0
  4. package/dist/ui/assets/account-store-BzWzQYN1.js +42 -0
  5. package/dist/ui/assets/{account-store-BzC0x752.js → account-store-D2IK2qHq.js} +30 -30
  6. package/dist/ui/assets/{adobe-CoeG8AXw.js → adobe-B2LOb2Ih.js} +1 -1
  7. package/dist/ui/assets/{adobe-KfCyFC0w.js → adobe-D1tGasrx.js} +1 -1
  8. package/dist/ui/assets/{anthropic-messages-CwKCE8PD.js → anthropic-messages-CTRXVqwn.js} +2 -2
  9. package/dist/ui/assets/{anthropic-messages-DPd961JX.js → anthropic-messages-EYoOyCX6.js} +2 -2
  10. package/dist/ui/assets/{apply-layout-Bt4lk2Me.js → apply-layout-DGjlIg3B.js} +1 -1
  11. package/dist/ui/assets/{apps-4osfSnfB.js → apps-WBxVtivp.js} +1 -1
  12. package/dist/ui/assets/{azure-openai-B8P4TPnO.js → azure-openai-Bcr3RUKI.js} +1 -1
  13. package/dist/ui/assets/{azure-openai-Bmb5Ncn6.js → azure-openai-BrJf_2kZ.js} +1 -1
  14. package/dist/ui/assets/azure-openai-responses-DhklLm0Z.js +1 -0
  15. package/dist/ui/assets/azure-openai-responses-eJTO6o5G.js +1 -0
  16. package/dist/ui/assets/bedrock-camp-BfNg24Ce.js +1 -0
  17. package/dist/ui/assets/bedrock-camp-DMGplF70.js +1 -0
  18. package/dist/ui/assets/{cerebras-DXkRDNk9.js → cerebras-BU60Ozs0.js} +1 -1
  19. package/dist/ui/assets/{cerebras-DTX8p8iF.js → cerebras-DFf0mQaP.js} +1 -1
  20. package/dist/ui/assets/compat-C0CyHyoL.js +2 -0
  21. package/dist/ui/assets/{connect-surface-EVVLAHmG.js → connect-surface-BbqEQN5f.js} +1 -1
  22. package/dist/ui/assets/{context-compaction-DDaM9TWa.js → context-compaction-MXRS4Kb2.js} +1 -1
  23. package/dist/ui/assets/{error-body-CqsCxuQ4.js → error-body-pkrba6pf.js} +1 -1
  24. package/dist/ui/assets/fs-UFiIQf1n.js +1 -0
  25. package/dist/ui/assets/fs-yLPrTusT.js +2 -0
  26. package/dist/ui/assets/{github-TCKAE5Uh.js → github-BUB4blnB.js} +1 -1
  27. package/dist/ui/assets/github-CDTQ_VR3.js +2 -0
  28. package/dist/ui/assets/{github-copilot-BYeR_g6J.js → github-copilot-B9kvpQTt.js} +1 -1
  29. package/dist/ui/assets/{github-copilot-CVI88qdz.js → github-copilot-Bjycm0uY.js} +1 -1
  30. package/dist/ui/assets/{github-install-BuPC3YZw.js → github-install-AllTWJoC.js} +1 -1
  31. package/dist/ui/assets/{github-zip-Dlg-Q2ue.js → github-zip-DF9OueMM.js} +1 -1
  32. package/dist/ui/assets/google-generative-ai-DEcgNsJh.js +1 -0
  33. package/dist/ui/assets/google-generative-ai-u7R_TH9o.js +1 -0
  34. package/dist/ui/assets/google-shared-BPNUreTT.js +371 -0
  35. package/dist/ui/assets/google-shared-CjO3-4_Q.js +11 -0
  36. package/dist/ui/assets/google-vertex-CTrzlewG.js +1 -0
  37. package/dist/ui/assets/google-vertex-bmq-ZPFH.js +1 -0
  38. package/dist/ui/assets/{kernel-worker-DEHxwjq6.js → kernel-worker-BkcPKOHD.js} +113 -113
  39. package/dist/ui/assets/{legacy-api-aliases-DAkrHYf9.js → legacy-api-aliases-C0CAIWhd.js} +1 -1
  40. package/dist/ui/assets/{legacy-api-aliases-BVP0Ho8x.js → legacy-api-aliases-qI5FdR49.js} +1 -1
  41. package/dist/ui/assets/{local-llm-CB_9Ui8j.js → local-llm-B8l1KARS.js} +1 -1
  42. package/dist/ui/assets/{local-llm-D8ts0-Qm.js → local-llm-BdNJXgbX.js} +1 -1
  43. package/dist/ui/assets/{main-CYhcxAYn.js → main-CLBsTy2u.js} +3 -3
  44. package/dist/ui/assets/{mistral-conversations-Cyp2kssI.js → mistral-conversations-CunWHeDt.js} +2 -2
  45. package/dist/ui/assets/{mistral-conversations-gFwkX5N9.js → mistral-conversations-DWRsBsfa.js} +1 -1
  46. package/dist/ui/assets/models-BSkXF4T6.js +1 -0
  47. package/dist/ui/assets/{mount-Dh40D48l.js → mount-BySj3d6Z.js} +2 -2
  48. package/dist/ui/assets/{mount-Wax857ht.js → mount-C8rIbmmr.js} +1 -1
  49. package/dist/ui/assets/{mount-recovery-D3-N1o_E.js → mount-recovery-BK_G25OD.js} +1 -1
  50. package/dist/ui/assets/{new-session-PVPeVFQc.js → new-session-C9GJ_PKI.js} +2 -2
  51. package/dist/ui/assets/{oauth-bootstrap-onRgf3Is.js → oauth-bootstrap-BMKtjQXh.js} +2 -2
  52. package/dist/ui/assets/{openai-codex-DF2vOI8z.js → openai-codex-CK_tnINi.js} +1 -1
  53. package/dist/ui/assets/{openai-codex-DgZ9eDkQ.js → openai-codex-D_Awg71A.js} +1 -1
  54. package/dist/ui/assets/openai-codex-responses-8wXA5Dto.js +7 -0
  55. package/dist/ui/assets/openai-codex-responses-BYAXyTDg.js +7 -0
  56. package/dist/ui/assets/openai-completions-CfjF1o-N.js +5 -0
  57. package/dist/ui/assets/openai-completions-DAIm60Lb.js +5 -0
  58. package/dist/ui/assets/openai-responses-01Q5Zv3q.js +1 -0
  59. package/dist/ui/assets/openai-responses-B7rl8DAX.js +1 -0
  60. package/dist/ui/assets/{openai-responses-shared-uSSusU2w.js → openai-responses-shared-B_T0yMQn.js} +3 -3
  61. package/dist/ui/assets/{openai-responses-shared-DajOm-sC.js → openai-responses-shared-BrIGUa2e.js} +3 -3
  62. package/dist/ui/assets/{openrouter-BbF3Yuh_.js → openrouter-Ao1d_DFx.js} +1 -1
  63. package/dist/ui/assets/{openrouter-images-7cFnqg4_.js → openrouter-images-CeBDTy7a.js} +1 -1
  64. package/dist/ui/assets/{openrouter-images-eEy7Fej8.js → openrouter-images-JzygwjVz.js} +1 -1
  65. package/dist/ui/assets/{openrouter-models-gCCUSdgw.js → openrouter-models-BVfLgK5R.js} +1 -1
  66. package/dist/ui/assets/{openrouter-models-DmontTTG.js → openrouter-models-Ds9BfRxR.js} +1 -1
  67. package/dist/ui/assets/{openrouter-oauth-CyGkjg56.js → openrouter-oauth-CIbrg7_B.js} +1 -1
  68. package/dist/ui/assets/{openrouter-oauth-Dx8hVsUq.js → openrouter-oauth-CMXSdSTW.js} +1 -1
  69. package/dist/ui/assets/{openrouter-KaXerwGG.js → openrouter-qXZ6rHij.js} +1 -1
  70. package/dist/ui/assets/openrouter.models-CrhNqqEN.js +1 -0
  71. package/dist/ui/assets/openrouter.models-DkPWoMvu.js +1 -0
  72. package/dist/ui/assets/{panel-rpc-handlers-B7p25iL1.js → panel-rpc-handlers-BEZkTElh.js} +2 -2
  73. package/dist/ui/assets/{provider-C3zSzTlr.js → provider-CUeWEkx7.js} +1 -1
  74. package/dist/ui/assets/{provider-CdACKvd3.js → provider-DateAcUE.js} +2 -2
  75. package/dist/ui/assets/{provider-settings-B8PQoEsb.js → provider-settings-CgibVhar.js} +1 -1
  76. package/dist/ui/assets/{provider-settings-DBbKsRoG.js → provider-settings-D1X4bwtI.js} +1 -1
  77. package/dist/ui/assets/provider-store-access-CtOIj6nl.js +1 -0
  78. package/dist/ui/assets/provider-store-access-MV-XHhP4.js +2 -0
  79. package/dist/ui/assets/{providers-DW9h25Xk.js → providers-CyERqESm.js} +1 -1
  80. package/dist/ui/assets/{providers-CQOF0OxI.js → providers-DPwCuiPq.js} +2 -2
  81. package/dist/ui/assets/{quick-llm-YdXmDgWO.js → quick-llm-ga7kfL7T.js} +1 -1
  82. package/dist/ui/assets/{recovery-screen-BBq0CbOW.js → recovery-screen-mj0G_I-U.js} +1 -1
  83. package/dist/ui/assets/{redirect-uri-BtFxK4OI.js → redirect-uri-DhE_B95B.js} +1 -1
  84. package/dist/ui/assets/{session-freezer-D2xY_37i.js → session-freezer-C4S_1c8T.js} +3 -3
  85. package/dist/ui/assets/{setup-feature-flags-remote-Dq70lhlj.js → setup-feature-flags-remote-DzhAznfO.js} +1 -1
  86. package/dist/ui/assets/{setup-standalone-prelude-TJXZI1xV.js → setup-standalone-prelude-U-vJ2anA.js} +1 -1
  87. package/dist/ui/assets/{setup-sudo-DqKSTbxO.js → setup-sudo-DjFaSjGu.js} +2 -2
  88. package/dist/ui/assets/sidecar-merge-ChbmI6Wr.js +1 -0
  89. package/dist/ui/assets/sidecar-merge-DP5Rveo5.js +1 -0
  90. package/dist/ui/assets/sidecar-repair-CfVdKYNb.js +1 -0
  91. package/dist/ui/assets/sidecar-repair-cn5xY6Gb.js +1 -0
  92. package/dist/ui/assets/{skills-BXWN2lD6.js → skills-78jjtkP_.js} +1 -1
  93. package/dist/ui/assets/{store-C-oC5Dsv.js → store-BrXMXbEO.js} +1 -1
  94. package/dist/ui/assets/{store-DsiNO53b.js → store-DmVOsDRg.js} +1 -1
  95. package/dist/ui/assets/{sudo-BIuk1k1q.js → sudo-BR34TO-_.js} +1 -1
  96. package/dist/ui/assets/transform-messages-DEFauvrq.js +1 -0
  97. package/dist/ui/assets/transform-messages-XkZ1QnTb.js +1 -0
  98. package/dist/ui/assets/{upgrade-detection-DrziRNRB.js → upgrade-detection-TqZQh5uz.js} +1 -1
  99. package/dist/ui/assets/{wc-extension-VX3ZakVl.js → wc-extension-D8aXdvAm.js} +2 -2
  100. package/dist/ui/assets/{wc-follower-DzPdgiZN.js → wc-follower-ghSAz5ud.js} +3 -3
  101. package/dist/ui/assets/{wc-live-B5H5aWbX.js → wc-live-CwvjwIBw.js} +3 -3
  102. package/dist/ui/assets/{wc-nav-DYKStk4A.js → wc-nav-Cyy-b43_.js} +2 -2
  103. package/dist/ui/assets/{wc-onboarding-fMXbJHE6.js → wc-onboarding-K5WLiLcU.js} +2 -2
  104. package/dist/ui/assets/{wc-placeholder-zyLzZm58.js → wc-placeholder-rXdt80Kf.js} +2 -2
  105. package/dist/ui/assets/{wc-settings-BXhukZUh.js → wc-settings-BykuRVgp.js} +2 -2
  106. package/dist/ui/assets/{wc-shell-C5zb79_R.js → wc-shell-BvUSkMkd.js} +7 -7
  107. package/dist/ui/assets/{wc-sprinkles-DBXkVV3r.js → wc-sprinkles-Bu5spc8F.js} +2 -2
  108. package/dist/ui/assets/{wc-tray-DyqmeJQK.js → wc-tray-Cc154F7D.js} +2 -2
  109. package/dist/ui/assets/{xai-grok-DxaYAHiB.js → xai-grok-BPEdJlpt.js} +1 -1
  110. package/dist/ui/assets/{xai-grok-CGVh0Pwi.js → xai-grok-Bf-Tv5QQ.js} +1 -1
  111. package/dist/ui/index.html +12 -12
  112. package/dist/ui/packages/webapp/index.html +12 -12
  113. package/package.json +2 -2
  114. package/dist/ui/assets/account-store-C1tZH-mA.js +0 -42
  115. package/dist/ui/assets/azure-openai-responses-CtOKUN00.js +0 -1
  116. package/dist/ui/assets/azure-openai-responses-oRGXQA3K.js +0 -1
  117. package/dist/ui/assets/bedrock-camp-BDCjQMZx.js +0 -1
  118. package/dist/ui/assets/bedrock-camp-CFmElpzZ.js +0 -1
  119. package/dist/ui/assets/compat-Bn8HnC3L.js +0 -2
  120. package/dist/ui/assets/fs-DJwfGyA1.js +0 -2
  121. package/dist/ui/assets/fs-DOqDOgs2.js +0 -1
  122. package/dist/ui/assets/github-t4MIUh5J.js +0 -2
  123. package/dist/ui/assets/google-generative-ai-BL_SqY5W.js +0 -1
  124. package/dist/ui/assets/google-generative-ai-DDF2tpZq.js +0 -1
  125. package/dist/ui/assets/google-shared-DPuPo5mO.js +0 -11
  126. package/dist/ui/assets/google-shared-biiFuSpC.js +0 -371
  127. package/dist/ui/assets/google-vertex-CobhNXpX.js +0 -1
  128. package/dist/ui/assets/google-vertex-VXUUgM7o.js +0 -1
  129. package/dist/ui/assets/models-DgdVqaw5.js +0 -1
  130. package/dist/ui/assets/openai-codex-responses-BJOy6BEd.js +0 -7
  131. package/dist/ui/assets/openai-codex-responses-BfT5s3yO.js +0 -7
  132. package/dist/ui/assets/openai-completions-CmslRX3-.js +0 -5
  133. package/dist/ui/assets/openai-completions-DDas47cy.js +0 -5
  134. package/dist/ui/assets/openai-responses-CHXkcom_.js +0 -1
  135. package/dist/ui/assets/openai-responses-DWlnQ-B0.js +0 -1
  136. package/dist/ui/assets/openrouter.models-Byp0hyfF.js +0 -1
  137. package/dist/ui/assets/openrouter.models-C8HitxAG.js +0 -1
  138. package/dist/ui/assets/provider-store-access-ChzjVdqD.js +0 -1
  139. package/dist/ui/assets/provider-store-access-Dcy68Vs8.js +0 -2
  140. package/dist/ui/assets/sidecar-repair-B31h6Aw0.js +0 -1
  141. package/dist/ui/assets/sidecar-repair-DVW7uarV.js +0 -1
  142. package/dist/ui/assets/transform-messages-D27pVLZ-.js +0 -1
  143. package/dist/ui/assets/transform-messages-DgR3h-Ck.js +0 -1
@@ -0,0 +1 @@
1
+ import{i as e}from"./diagnostics-DN_idNHx.js";import{n as t,t as n}from"./models-BSkXF4T6.js";import{t as r}from"./provider-env-CTOcDKrQ.js";import{i}from"./transform-messages-XkZ1QnTb.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-pkrba6pf.js";import{a as l,c as u,d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y}from"./google-shared-CjO3-4_Q.js";var b=`v1`,x=`gcp-vertex-credentials`,S={THINKING_LEVEL_UNSPECIFIED:d.THINKING_LEVEL_UNSPECIFIED,MINIMAL:d.MINIMAL,LOW:d.LOW,MEDIUM:d.MEDIUM,HIGH:d.HIGH},C=0,w=(t,r,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:`pending`,timestamp:Date.now()};try{if(i?.fetch&&i.fetch!==globalThis.fetch)throw Error(`Custom fetch is not supported by the Google Vertex adapter`);let o=M(i),s=o?D(t,o,i?.headers):E(t,P(i),F(i),i?.headers,i?.env),c=I(t,r,i),l=await i?.onPayload?.(c,t);l!==void 0&&(c=l);let u=await _(()=>s.models.generateContentStream(c),i);a.push({type:`start`,partial:e});let d=null,p=e.content,m=()=>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=g(t);(!d||n&&d.type!==`thinking`||!n&&d.type!==`text`)&&(d&&(d.type===`text`?a.push({type:`text_end`,contentIndex:p.length-1,content:d.text,partial:e}):a.push({type:`thinking_end`,contentIndex:m(),content:d.thinking,partial:e})),n?(d={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(d),a.push({type:`thinking_start`,contentIndex:m(),partial:e})):(d={type:`text`,text:``},e.content.push(d),a.push({type:`text_start`,contentIndex:m(),partial:e}))),d.type===`thinking`?(d.thinking+=t.text,d.thinkingSignature=h(d.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:m(),delta:t.text,partial:e})):(d.text+=t.text,d.textSignature=h(d.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:m(),delta:t.text,partial:e}))}if(t.functionCall){d&&=(d.type===`text`?a.push({type:`text_end`,contentIndex:m(),content:d.text,partial:e}):a.push({type:`thinking_end`,contentIndex:m(),content:d.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()}_${++C}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),a.push({type:`toolcall_start`,contentIndex:m(),partial:e}),a.push({type:`toolcall_delta`,contentIndex:m(),delta:JSON.stringify(r.arguments),partial:e}),a.push({type:`toolcall_end`,contentIndex:m(),toolCall:r,partial:e})}}i?.finishReason&&(e.rawStopReason=i.finishReason,e.stopReason=f(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}},n(t,e.usage))}if(d&&(d.type===`text`?a.push({type:`text_end`,contentIndex:m(),content:d.text,partial:e}):a.push({type:`thinking_end`,contentIndex:m(),content:d.thinking,partial:e})),i?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`pending`)throw Error(`Google Vertex stream ended without a finish reason`);if(e.stopReason===`aborted`||e.stopReason===`error`){let t=e.rawStopReason?`Provider stopped with: ${e.rawStopReason}`:`An unknown error occurred`;throw Error(t)}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},T=(e,n,r)=>{let a=i(e,n,r,void 0);if(!r?.reasoning)return w(e,n,{...a,thinking:{enabled:!1}});let o=t(e,r.reasoning),s=o===`off`?`high`:o,c=e;return L(c)||R(c)?w(e,n,{...a,thinking:{enabled:!0,level:B(s,c)}}):w(e,n,{...a,thinking:{enabled:!0,budgetTokens:V(c,s,r.thinkingBudgets)}})};function E(e,t,n,r,i){let a=j(i);return new p({vertexai:!0,project:t,location:n,apiVersion:b,...a?{googleAuthOptions:a}:{},httpOptions:O(e,r)})}function D(e,t,n){return new p({vertexai:!0,apiKey:t,apiVersion:b,httpOptions:O(e,n)})}function O(e,t){let n={},r=k(e.baseUrl);r&&(n.baseUrl=r,n.baseUrlResourceScope=y.COLLECTION,A(r)&&(n.apiVersion=``));let i=a({...e.headers,...t});return i&&(n.headers=i),Object.keys(n).length>0?n:void 0}function k(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function A(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 j(e){let t=r(`GOOGLE_APPLICATION_CREDENTIALS`,e);return t?{keyFilename:t}:void 0}function M(e){let t=e?.apiKey?.trim();if(!(!t||t===x||N(t)))return t}function N(e){return/^<[^>]+>$/.test(e)}function P(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 F(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 I(e,t,n={}){let r=v(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let a=t.tools?.length?l(t.tools,n.toolChoice,u(e.id)):void 0,s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:o(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:m(t.tools)},...a!==void 0&&{toolConfig:{functionCallingConfig:{mode:a}}}};if(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=S[n.thinking.level],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=z(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 L(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function R(e){let t=e.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(t)||t===`gemini-flash-latest`||t===`gemini-flash-lite-latest`}function z(e){let t=e;return L(t)?{thinkingLevel:d.LOW}:R(t)?{thinkingLevel:d.MINIMAL}:{thinkingBudget:0}}function B(e,t){if(L(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 V(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{w as stream,T as streamSimple};
@@ -0,0 +1 @@
1
+ import{i as e}from"./diagnostics-DN_idNHx.js";import{c as t,i as n,s as r}from"./transform-messages-DEFauvrq.js";import{t as i}from"./provider-env-CILujRmO.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-pkrba6pf.js";import{a as l,c as u,d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y}from"./google-shared-BPNUreTT.js";const b={THINKING_LEVEL_UNSPECIFIED:d.THINKING_LEVEL_UNSPECIFIED,MINIMAL:d.MINIMAL,LOW:d.LOW,MEDIUM:d.MEDIUM,HIGH:d.HIGH};let x=0;const S=(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:`pending`,timestamp:Date.now()};try{if(i?.fetch&&i.fetch!==globalThis.fetch)throw Error(`Custom fetch is not supported by the Google Vertex adapter`);let o=A(i),s=o?T(t,o,i?.headers):w(t,M(i),N(i),i?.headers,i?.env),c=P(t,n,i),l=await i?.onPayload?.(c,t);l!==void 0&&(c=l);let u=await _(()=>s.models.generateContentStream(c),i);a.push({type:`start`,partial:e});let d=null,p=e.content,m=()=>p.length-1;for await(let n of u){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=g(t);(!d||n&&d.type!==`thinking`||!n&&d.type!==`text`)&&(d&&(d.type===`text`?a.push({type:`text_end`,contentIndex:p.length-1,content:d.text,partial:e}):a.push({type:`thinking_end`,contentIndex:m(),content:d.thinking,partial:e})),n?(d={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(d),a.push({type:`thinking_start`,contentIndex:m(),partial:e})):(d={type:`text`,text:``},e.content.push(d),a.push({type:`text_start`,contentIndex:m(),partial:e}))),d.type===`thinking`?(d.thinking+=t.text,d.thinkingSignature=h(d.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:m(),delta:t.text,partial:e})):(d.text+=t.text,d.textSignature=h(d.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:m(),delta:t.text,partial:e}))}if(t.functionCall){d&&=(d.type===`text`?a.push({type:`text_end`,contentIndex:m(),content:d.text,partial:e}):a.push({type:`thinking_end`,contentIndex:m(),content:d.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()}_${++x}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),a.push({type:`toolcall_start`,contentIndex:m(),partial:e}),a.push({type:`toolcall_delta`,contentIndex:m(),delta:JSON.stringify(r.arguments),partial:e}),a.push({type:`toolcall_end`,contentIndex:m(),toolCall:r,partial:e})}}i?.finishReason&&(e.rawStopReason=i.finishReason,e.stopReason=f(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,reasoning:n.usageMetadata.thoughtsTokenCount||0,totalTokens:n.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},r(t,e.usage))}if(d&&(d.type===`text`?a.push({type:`text_end`,contentIndex:m(),content:d.text,partial:e}):a.push({type:`thinking_end`,contentIndex:m(),content:d.thinking,partial:e})),i?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`pending`)throw Error(`Google Vertex stream ended without a finish reason`);if(e.stopReason===`aborted`||e.stopReason===`error`){let t=e.rawStopReason?`Provider stopped with: ${e.rawStopReason}`:`An unknown error occurred`;throw Error(t)}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},C=(e,r,i)=>{let a=n(e,r,i,void 0);if(!i?.reasoning)return S(e,r,{...a,thinking:{enabled:!1}});let o=t(e,i.reasoning),s=o===`off`?`high`:o,c=e;return F(c)||I(c)?S(e,r,{...a,thinking:{enabled:!0,level:R(s,c)}}):S(e,r,{...a,thinking:{enabled:!0,budgetTokens:z(c,s,i.thinkingBudgets)}})};function w(e,t,n,r,i){let a=k(i);return new p({vertexai:!0,project:t,location:n,apiVersion:`v1`,...a?{googleAuthOptions:a}:{},httpOptions:E(e,r)})}function T(e,t,n){return new p({vertexai:!0,apiKey:t,apiVersion:`v1`,httpOptions:E(e,n)})}function E(e,t){let n={},r=D(e.baseUrl);r&&(n.baseUrl=r,n.baseUrlResourceScope=y.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=i(`GOOGLE_APPLICATION_CREDENTIALS`,e);return t?{keyFilename:t}:void 0}function A(e){let t=e?.apiKey?.trim();if(!(!t||t===`gcp-vertex-credentials`||j(t)))return t}function j(e){return/^<[^>]+>$/.test(e)}function M(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 N(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 P(e,t,n={}){let r=v(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let a=t.tools?.length?l(t.tools,n.toolChoice,u(e.id)):void 0,s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:o(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:m(t.tools)},...a!==void 0&&{toolConfig:{functionCallingConfig:{mode:a}}}};if(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],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=L(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 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:d.LOW}:I(t)?{thinkingLevel:d.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};