sliccy 6.42.2 → 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 (146) 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-y8PSSbM1.js → account-store-D2IK2qHq.js} +30 -30
  6. package/dist/ui/assets/{adobe-DGzv5o9Q.js → adobe-B2LOb2Ih.js} +1 -1
  7. package/dist/ui/assets/{adobe-ClU-HOxw.js → adobe-D1tGasrx.js} +1 -1
  8. package/dist/ui/assets/agent-message-to-chat-VVddq_Ha.js +7 -0
  9. package/dist/ui/assets/{anthropic-messages-CwKCE8PD.js → anthropic-messages-CTRXVqwn.js} +2 -2
  10. package/dist/ui/assets/{anthropic-messages-DPd961JX.js → anthropic-messages-EYoOyCX6.js} +2 -2
  11. package/dist/ui/assets/{apply-layout-DN4RycQp.js → apply-layout-DGjlIg3B.js} +1 -1
  12. package/dist/ui/assets/{apps-CSF_V-bE.js → apps-WBxVtivp.js} +1 -1
  13. package/dist/ui/assets/{azure-openai-QWHytLUo.js → azure-openai-Bcr3RUKI.js} +1 -1
  14. package/dist/ui/assets/{azure-openai-BbfA67oz.js → azure-openai-BrJf_2kZ.js} +1 -1
  15. package/dist/ui/assets/azure-openai-responses-DhklLm0Z.js +1 -0
  16. package/dist/ui/assets/azure-openai-responses-eJTO6o5G.js +1 -0
  17. package/dist/ui/assets/bedrock-camp-BfNg24Ce.js +1 -0
  18. package/dist/ui/assets/bedrock-camp-DMGplF70.js +1 -0
  19. package/dist/ui/assets/{cerebras-CzhRPokK.js → cerebras-BU60Ozs0.js} +1 -1
  20. package/dist/ui/assets/{cerebras-9fccqwcN.js → cerebras-DFf0mQaP.js} +1 -1
  21. package/dist/ui/assets/compat-C0CyHyoL.js +2 -0
  22. package/dist/ui/assets/{connect-surface-DPt-zcyr.js → connect-surface-BbqEQN5f.js} +1 -1
  23. package/dist/ui/assets/{context-compaction-DDaM9TWa.js → context-compaction-MXRS4Kb2.js} +1 -1
  24. package/dist/ui/assets/{error-body-CqsCxuQ4.js → error-body-pkrba6pf.js} +1 -1
  25. package/dist/ui/assets/fs-UFiIQf1n.js +1 -0
  26. package/dist/ui/assets/fs-yLPrTusT.js +2 -0
  27. package/dist/ui/assets/{github-Cg60jjcf.js → github-BUB4blnB.js} +1 -1
  28. package/dist/ui/assets/github-CDTQ_VR3.js +2 -0
  29. package/dist/ui/assets/{github-copilot-CO2lq3Hz.js → github-copilot-B9kvpQTt.js} +1 -1
  30. package/dist/ui/assets/{github-copilot-NgNaiPbG.js → github-copilot-Bjycm0uY.js} +1 -1
  31. package/dist/ui/assets/{github-install-Bhrcqtrr.js → github-install-AllTWJoC.js} +1 -1
  32. package/dist/ui/assets/{github-zip-U-e0YcJc.js → github-zip-DF9OueMM.js} +1 -1
  33. package/dist/ui/assets/google-generative-ai-DEcgNsJh.js +1 -0
  34. package/dist/ui/assets/google-generative-ai-u7R_TH9o.js +1 -0
  35. package/dist/ui/assets/google-shared-BPNUreTT.js +371 -0
  36. package/dist/ui/assets/google-shared-CjO3-4_Q.js +11 -0
  37. package/dist/ui/assets/google-vertex-CTrzlewG.js +1 -0
  38. package/dist/ui/assets/google-vertex-bmq-ZPFH.js +1 -0
  39. package/dist/ui/assets/{kernel-worker-5FjRSqTZ.js → kernel-worker-BkcPKOHD.js} +649 -641
  40. package/dist/ui/assets/{legacy-api-aliases-DAkrHYf9.js → legacy-api-aliases-C0CAIWhd.js} +1 -1
  41. package/dist/ui/assets/{legacy-api-aliases-BVP0Ho8x.js → legacy-api-aliases-qI5FdR49.js} +1 -1
  42. package/dist/ui/assets/{local-llm-4P8VyegN.js → local-llm-B8l1KARS.js} +1 -1
  43. package/dist/ui/assets/{local-llm-BRZfRqQe.js → local-llm-BdNJXgbX.js} +1 -1
  44. package/dist/ui/assets/{main-CB6zF5Nu.js → main-CLBsTy2u.js} +3 -3
  45. package/dist/ui/assets/{mistral-conversations-Cyp2kssI.js → mistral-conversations-CunWHeDt.js} +2 -2
  46. package/dist/ui/assets/{mistral-conversations-gFwkX5N9.js → mistral-conversations-DWRsBsfa.js} +1 -1
  47. package/dist/ui/assets/models-BSkXF4T6.js +1 -0
  48. package/dist/ui/assets/{mount-D8FwGaHk.js → mount-BySj3d6Z.js} +2 -2
  49. package/dist/ui/assets/{mount-DiIbXHXM.js → mount-C8rIbmmr.js} +1 -1
  50. package/dist/ui/assets/{mount-recovery-Ze3PAzOp.js → mount-recovery-BK_G25OD.js} +1 -1
  51. package/dist/ui/assets/{new-session-PcDB5byI.js → new-session-C9GJ_PKI.js} +2 -2
  52. package/dist/ui/assets/{oauth-bootstrap-T8vjOAVa.js → oauth-bootstrap-BMKtjQXh.js} +2 -2
  53. package/dist/ui/assets/{openai-codex-B18aQw4z.js → openai-codex-CK_tnINi.js} +1 -1
  54. package/dist/ui/assets/{openai-codex-CKowAUIv.js → openai-codex-D_Awg71A.js} +1 -1
  55. package/dist/ui/assets/openai-codex-responses-8wXA5Dto.js +7 -0
  56. package/dist/ui/assets/openai-codex-responses-BYAXyTDg.js +7 -0
  57. package/dist/ui/assets/openai-completions-CfjF1o-N.js +5 -0
  58. package/dist/ui/assets/openai-completions-DAIm60Lb.js +5 -0
  59. package/dist/ui/assets/openai-responses-01Q5Zv3q.js +1 -0
  60. package/dist/ui/assets/openai-responses-B7rl8DAX.js +1 -0
  61. package/dist/ui/assets/{openai-responses-shared-uSSusU2w.js → openai-responses-shared-B_T0yMQn.js} +3 -3
  62. package/dist/ui/assets/{openai-responses-shared-DajOm-sC.js → openai-responses-shared-BrIGUa2e.js} +3 -3
  63. package/dist/ui/assets/{openrouter-KB6Gx6o9.js → openrouter-Ao1d_DFx.js} +1 -1
  64. package/dist/ui/assets/{openrouter-images-7cFnqg4_.js → openrouter-images-CeBDTy7a.js} +1 -1
  65. package/dist/ui/assets/{openrouter-images-eEy7Fej8.js → openrouter-images-JzygwjVz.js} +1 -1
  66. package/dist/ui/assets/{openrouter-models-gCCUSdgw.js → openrouter-models-BVfLgK5R.js} +1 -1
  67. package/dist/ui/assets/{openrouter-models-DmontTTG.js → openrouter-models-Ds9BfRxR.js} +1 -1
  68. package/dist/ui/assets/{openrouter-oauth-CdKWLphl.js → openrouter-oauth-CIbrg7_B.js} +1 -1
  69. package/dist/ui/assets/{openrouter-oauth-CJkaDLFj.js → openrouter-oauth-CMXSdSTW.js} +1 -1
  70. package/dist/ui/assets/{openrouter-CVBFGeBJ.js → openrouter-qXZ6rHij.js} +1 -1
  71. package/dist/ui/assets/openrouter.models-CrhNqqEN.js +1 -0
  72. package/dist/ui/assets/openrouter.models-DkPWoMvu.js +1 -0
  73. package/dist/ui/assets/{panel-rpc-handlers-NH6ZxXBF.js → panel-rpc-handlers-BEZkTElh.js} +2 -2
  74. package/dist/ui/assets/{provider-BVvLDAIL.js → provider-CUeWEkx7.js} +1 -1
  75. package/dist/ui/assets/{provider-sXDP0t7n.js → provider-DateAcUE.js} +2 -2
  76. package/dist/ui/assets/{provider-settings-DE5Ke3Lf.js → provider-settings-CgibVhar.js} +1 -1
  77. package/dist/ui/assets/{provider-settings-DZ1fT3xk.js → provider-settings-D1X4bwtI.js} +1 -1
  78. package/dist/ui/assets/provider-store-access-CtOIj6nl.js +1 -0
  79. package/dist/ui/assets/provider-store-access-MV-XHhP4.js +2 -0
  80. package/dist/ui/assets/{providers-B_UqM-GR.js → providers-CyERqESm.js} +1 -1
  81. package/dist/ui/assets/{providers-EEH69G4K.js → providers-DPwCuiPq.js} +2 -2
  82. package/dist/ui/assets/{quick-llm-DOkWNjz3.js → quick-llm-ga7kfL7T.js} +1 -1
  83. package/dist/ui/assets/{recovery-screen-JmywSaId.js → recovery-screen-mj0G_I-U.js} +1 -1
  84. package/dist/ui/assets/{redirect-uri-C0SF0Hdn.js → redirect-uri-DhE_B95B.js} +1 -1
  85. package/dist/ui/assets/{session-freezer-DGKuD3CO.js → session-freezer-C4S_1c8T.js} +4 -4
  86. package/dist/ui/assets/{setup-feature-flags-remote-CC5jMUxz.js → setup-feature-flags-remote-DzhAznfO.js} +1 -1
  87. package/dist/ui/assets/{setup-standalone-prelude-BN_ALX3m.js → setup-standalone-prelude-U-vJ2anA.js} +1 -1
  88. package/dist/ui/assets/{setup-sudo-BWCD0xI1.js → setup-sudo-DjFaSjGu.js} +2 -2
  89. package/dist/ui/assets/sidecar-merge-ChbmI6Wr.js +1 -0
  90. package/dist/ui/assets/sidecar-merge-DP5Rveo5.js +1 -0
  91. package/dist/ui/assets/sidecar-repair-CfVdKYNb.js +1 -0
  92. package/dist/ui/assets/sidecar-repair-cn5xY6Gb.js +1 -0
  93. package/dist/ui/assets/{skills-CICL6Qs5.js → skills-78jjtkP_.js} +1 -1
  94. package/dist/ui/assets/{store-DVdTVbQP.js → store-BrXMXbEO.js} +1 -1
  95. package/dist/ui/assets/{store-DqIZXn11.js → store-DmVOsDRg.js} +1 -1
  96. package/dist/ui/assets/{sudo-BKOF8V2Q.js → sudo-BR34TO-_.js} +1 -1
  97. package/dist/ui/assets/transform-messages-DEFauvrq.js +1 -0
  98. package/dist/ui/assets/transform-messages-XkZ1QnTb.js +1 -0
  99. package/dist/ui/assets/{upgrade-detection-BVkXdET9.js → upgrade-detection-TqZQh5uz.js} +1 -1
  100. package/dist/ui/assets/{wc-extension-BadT9JWY.js → wc-extension-D8aXdvAm.js} +2 -2
  101. package/dist/ui/assets/{wc-follower-CXKBW_nh.js → wc-follower-ghSAz5ud.js} +3 -3
  102. package/dist/ui/assets/{wc-live-DqKkGNvf.js → wc-live-CwvjwIBw.js} +3 -3
  103. package/dist/ui/assets/{wc-nav-eGebanhs.js → wc-nav-Cyy-b43_.js} +2 -2
  104. package/dist/ui/assets/{wc-onboarding-DMcJQvQc.js → wc-onboarding-K5WLiLcU.js} +2 -2
  105. package/dist/ui/assets/{wc-placeholder-Br9BhcY9.js → wc-placeholder-rXdt80Kf.js} +2 -2
  106. package/dist/ui/assets/{wc-settings-DNhg5fN6.js → wc-settings-BykuRVgp.js} +2 -2
  107. package/dist/ui/assets/{wc-shell-sWgyQAqa.js → wc-shell-BvUSkMkd.js} +7 -7
  108. package/dist/ui/assets/{wc-sprinkles-BOQXDY6E.js → wc-sprinkles-Bu5spc8F.js} +2 -2
  109. package/dist/ui/assets/{wc-tray-DkSMch94.js → wc-tray-Cc154F7D.js} +2 -2
  110. package/dist/ui/assets/{xai-grok-U9jyH4f4.js → xai-grok-BPEdJlpt.js} +1 -1
  111. package/dist/ui/assets/{xai-grok-gMIhc8ri.js → xai-grok-Bf-Tv5QQ.js} +1 -1
  112. package/dist/ui/index.html +12 -12
  113. package/dist/ui/packages/webapp/index.html +12 -12
  114. package/package.json +2 -2
  115. package/dist/ui/assets/account-store-DKltGDns.js +0 -42
  116. package/dist/ui/assets/agent-message-to-chat-BKTzrtDE.js +0 -7
  117. package/dist/ui/assets/azure-openai-responses-CtOKUN00.js +0 -1
  118. package/dist/ui/assets/azure-openai-responses-oRGXQA3K.js +0 -1
  119. package/dist/ui/assets/bedrock-camp-BDCjQMZx.js +0 -1
  120. package/dist/ui/assets/bedrock-camp-CFmElpzZ.js +0 -1
  121. package/dist/ui/assets/compat-Bn8HnC3L.js +0 -2
  122. package/dist/ui/assets/fs-D33dJneG.js +0 -2
  123. package/dist/ui/assets/fs-assVIc63.js +0 -1
  124. package/dist/ui/assets/github-rcdpKKRj.js +0 -2
  125. package/dist/ui/assets/google-generative-ai-BL_SqY5W.js +0 -1
  126. package/dist/ui/assets/google-generative-ai-DDF2tpZq.js +0 -1
  127. package/dist/ui/assets/google-shared-DPuPo5mO.js +0 -11
  128. package/dist/ui/assets/google-shared-biiFuSpC.js +0 -371
  129. package/dist/ui/assets/google-vertex-CobhNXpX.js +0 -1
  130. package/dist/ui/assets/google-vertex-VXUUgM7o.js +0 -1
  131. package/dist/ui/assets/models-DgdVqaw5.js +0 -1
  132. package/dist/ui/assets/openai-codex-responses-BJOy6BEd.js +0 -7
  133. package/dist/ui/assets/openai-codex-responses-BfT5s3yO.js +0 -7
  134. package/dist/ui/assets/openai-completions-CmslRX3-.js +0 -5
  135. package/dist/ui/assets/openai-completions-DDas47cy.js +0 -5
  136. package/dist/ui/assets/openai-responses-CHXkcom_.js +0 -1
  137. package/dist/ui/assets/openai-responses-DWlnQ-B0.js +0 -1
  138. package/dist/ui/assets/openrouter.models-Byp0hyfF.js +0 -1
  139. package/dist/ui/assets/openrouter.models-C8HitxAG.js +0 -1
  140. package/dist/ui/assets/provider-store-access-BDJ5HxGf.js +0 -2
  141. package/dist/ui/assets/provider-store-access-KHacrhuH.js +0 -1
  142. package/dist/ui/assets/sidecar-repair-B31h6Aw0.js +0 -1
  143. package/dist/ui/assets/sidecar-repair-DVW7uarV.js +0 -1
  144. package/dist/ui/assets/transcript-limits-BZmlTnX6.js +0 -1
  145. package/dist/ui/assets/transform-messages-D27pVLZ-.js +0 -1
  146. 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};