sliccy 2.48.0 → 2.49.2

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 (144) hide show
  1. package/README.md +1 -1
  2. package/dist/ui/assets/{adobe-f1RkQ2LG.js → adobe-DgFQQrOg.js} +1 -1
  3. package/dist/ui/assets/{adobe-B5JX3vSF.js → adobe-Dreg1wVK.js} +2 -2
  4. package/dist/ui/assets/{agent-bridge-KerdP1oi.js → agent-bridge-DQExUBtZ.js} +1 -1
  5. package/dist/ui/assets/{agent-message-to-chat-rNxH0eRL.js → agent-message-to-chat-CHszPkfe.js} +1 -1
  6. package/dist/ui/assets/anthropic-8dSWvEaO.js +39 -0
  7. package/dist/ui/assets/{anthropic-DXIx8WQZ.js → anthropic-CQXRZrKe.js} +2 -2
  8. package/dist/ui/assets/{azure-openai-Bbb6cKeV.js → azure-openai-DljwQRpg.js} +1 -1
  9. package/dist/ui/assets/{azure-openai-jVgW-OuR.js → azure-openai-Z75yrg_y.js} +1 -1
  10. package/dist/ui/assets/azure-openai-responses-B6VpI3fU.js +1 -0
  11. package/dist/ui/assets/azure-openai-responses-BruPNuxz.js +1 -0
  12. package/dist/ui/assets/backend-local-P05Hg6Af.js +9 -0
  13. package/dist/ui/assets/backend-local-mju0Ps5U.js +9 -0
  14. package/dist/ui/assets/bedrock-camp-9aDiXDk5.js +5 -0
  15. package/dist/ui/assets/bedrock-camp-CqXHYC67.js +4 -0
  16. package/dist/ui/assets/{cdp-C1_c8-E0.js → cdp-D-xyOaeF.js} +2 -2
  17. package/dist/ui/assets/cost-command-BOnG0NY3.js +1 -0
  18. package/dist/ui/assets/{dist-CxsgJFgV.js → dist-6maigE1F.js} +1 -1
  19. package/dist/ui/assets/{dist-BqCqxkrA.js → dist-8qo5XTx8.js} +1 -1
  20. package/dist/ui/assets/{dist-Sngeewv4.js → dist-DGI-KRHb.js} +1 -1
  21. package/dist/ui/assets/{dist-DPNMKo07.js → dist-DTOmXa93.js} +1 -1
  22. package/dist/ui/assets/{dist-USoe4ZIh.js → dist-Nvn9jT7s.js} +1 -1
  23. package/dist/ui/assets/env-api-keys-CH1OdZie.js +1 -0
  24. package/dist/ui/assets/env-api-keys-DxKb6C4Q.js +1 -0
  25. package/dist/ui/assets/{es-CbuIWQjf.js → es-DYpNCglL.js} +1 -1
  26. package/dist/ui/assets/{fs-Ch4z-7e8.js → fs-J4meBUCH.js} +3 -3
  27. package/dist/ui/assets/{fs-C8QxzFK_.js → fs-_TOckX3i.js} +2 -2
  28. package/dist/ui/assets/{github-DnfkA3fV.js → github-Cyp5HOCt.js} +1 -1
  29. package/dist/ui/assets/github-DIojNo8-.js +2 -0
  30. package/dist/ui/assets/google-BszFYcuS.js +1 -0
  31. package/dist/ui/assets/google-CYM-5k2z.js +1 -0
  32. package/dist/ui/assets/{google-shared-b8limp-0.js → google-shared-D_QrelB6.js} +1 -1
  33. package/dist/ui/assets/{google-shared-CEbAcMay.js → google-shared-XoadLsBb.js} +1 -1
  34. package/dist/ui/assets/{google-vertex-nFbLM1jr.js → google-vertex-ByJZJUMR.js} +1 -1
  35. package/dist/ui/assets/{google-vertex-DhlxvV6o.js → google-vertex-qkuMo_cz.js} +1 -1
  36. package/dist/ui/assets/{index-BxaasNW5.js → index-BqTqpjeH.js} +153 -163
  37. package/dist/ui/assets/json-parse-C5jSA6JB.js +3 -0
  38. package/dist/ui/assets/json-parse-Or9qhSeP.js +3 -0
  39. package/dist/ui/assets/{kernel-worker-BTAvhT7r.js → kernel-worker-CQw5MMmq.js} +883 -899
  40. package/dist/ui/assets/{local-llm-DQQUPDay.js → local-llm-CPVFxdug.js} +1 -1
  41. package/dist/ui/assets/{local-llm-BQQV1eUs.js → local-llm-g0wnxbDi.js} +1 -1
  42. package/dist/ui/assets/{magick-wasm-DwA3cs4T.js → magick-wasm-CTqVspRN.js} +1 -1
  43. package/dist/ui/assets/{magick-wasm-Dek2V-_y.js → magick-wasm-VuSQ-PNC.js} +1 -1
  44. package/dist/ui/assets/{mistral-BvJc11au.js → mistral-7vMFlwyv.js} +2 -2
  45. package/dist/ui/assets/{mistral-D_QxZUo3.js → mistral-BZdZwhYA.js} +2 -2
  46. package/dist/ui/assets/mount-B1Yosetn.js +2 -0
  47. package/dist/ui/assets/mount-rVcltyQp.js +1 -0
  48. package/dist/ui/assets/mount-table-store-BDnU4NqG.js +1 -0
  49. package/dist/ui/assets/{nuke-command-CKv7dPLq.js → nuke-command-6I6vn_OB.js} +1 -1
  50. package/dist/ui/assets/{oauth-bootstrap-iOQY9ywE.js → oauth-bootstrap-BhTDTASJ.js} +1 -1
  51. package/dist/ui/assets/{oauth-service-DTHr_ILl.js → oauth-service-BgJZh8oA.js} +1 -1
  52. package/dist/ui/assets/{oauth-service-BynE1niO.js → oauth-service-s6wxPNhT.js} +1 -1
  53. package/dist/ui/assets/offscreen-client-D_yQhOLu.js +1 -0
  54. package/dist/ui/assets/{onboarding-orchestrator-BTbcOsYi.js → onboarding-orchestrator-0jBXpPO0.js} +1 -1
  55. package/dist/ui/assets/{openai-codex-responses-ZTcDLOww.js → openai-codex-responses-BOuesx1c.js} +4 -4
  56. package/dist/ui/assets/{openai-codex-responses-jw3eMyAW.js → openai-codex-responses-DW3ZYFcb.js} +3 -3
  57. package/dist/ui/assets/openai-completions-D5rB4vsV.js +5 -0
  58. package/dist/ui/assets/openai-completions-ytvpg3gQ.js +5 -0
  59. package/dist/ui/assets/openai-responses-8f3sjZ0n.js +1 -0
  60. package/dist/ui/assets/openai-responses-CF3yEStf.js +1 -0
  61. package/dist/ui/assets/openai-responses-shared-DJ_O7os_.js +12 -0
  62. package/dist/ui/assets/{openai-responses-shared-Cb6xPI3z.js → openai-responses-shared-vokXRwgV.js} +1 -1
  63. package/dist/ui/assets/provider-settings-Ug5jEGjw.js +28 -0
  64. package/dist/ui/assets/provider-settings-rnwJD-hi.js +63 -0
  65. package/dist/ui/assets/{providers-DyuaLPXN.js → providers-CM4udL4d.js} +1 -1
  66. package/dist/ui/assets/{py-realm-worker-CiPbLFx2.js → py-realm-worker-Cg-6whKO.js} +1 -1
  67. package/dist/ui/assets/{pyodide-C2X7foBW.js → pyodide-DhfjhWo1.js} +1 -1
  68. package/dist/ui/assets/{pyodide-DM3gAwss.js → pyodide-DwCMl2Ja.js} +1 -1
  69. package/dist/ui/assets/{remote-terminal-view-B3w1XsI8.js → remote-terminal-view-BjoQOWNM.js} +3 -3
  70. package/dist/ui/assets/{slicc-editor-DAgxp34c.js → slicc-editor-DlLebxYv.js} +2 -2
  71. package/dist/ui/assets/{spawn-X9L04o6Q.js → spawn-C0I0kFhe.js} +1 -1
  72. package/dist/ui/assets/{sql-wasm-CqUynK8y.js → sql-wasm-eXBRXMXY.js} +1 -1
  73. package/dist/ui/assets/telemetry-B7l3TtVP.js +1 -0
  74. package/dist/ui/assets/tool-ui-B3Bihlxa.js +1 -0
  75. package/dist/ui/assets/tool-ui-D9h6SJkp.js +1 -0
  76. package/dist/ui/assets/{upgrade-detection-Bllbwwis.js → upgrade-detection-D1m3U6nl.js} +1 -1
  77. package/dist/ui/electron-overlay-entry.js +7 -7
  78. package/dist/ui/index.html +14 -10
  79. package/dist/ui/packages/webapp/index.html +14 -10
  80. package/package.json +3 -3
  81. package/dist/ui/assets/anthropic-DqN-XhOb.js +0 -39
  82. package/dist/ui/assets/azure-openai-responses-BLClomsm.js +0 -1
  83. package/dist/ui/assets/azure-openai-responses-DucvnACK.js +0 -1
  84. package/dist/ui/assets/bedrock-camp-BNzU3faS.js +0 -5
  85. package/dist/ui/assets/bedrock-camp-DAEKkMwP.js +0 -4
  86. package/dist/ui/assets/cost-command-DszplwaG.js +0 -1
  87. package/dist/ui/assets/github-Bm46hrl1.js +0 -2
  88. package/dist/ui/assets/google-D6ha3Lvd.js +0 -1
  89. package/dist/ui/assets/google-DmmMEYi-.js +0 -1
  90. package/dist/ui/assets/mount-CBj4Y0uY.js +0 -1
  91. package/dist/ui/assets/mount-XM0MMGbg.js +0 -2
  92. package/dist/ui/assets/offscreen-client-Bm3MzxIR.js +0 -1
  93. package/dist/ui/assets/openai-completions-DeKhvKno.js +0 -5
  94. package/dist/ui/assets/openai-completions-rPhCMQf6.js +0 -5
  95. package/dist/ui/assets/openai-responses-09Y9u2o-.js +0 -1
  96. package/dist/ui/assets/openai-responses-BYVIjcrN.js +0 -1
  97. package/dist/ui/assets/openai-responses-shared-BSdTPGXk.js +0 -12
  98. package/dist/ui/assets/provider-settings-B88plz7u.js +0 -63
  99. package/dist/ui/assets/provider-settings-YeoYrehC.js +0 -28
  100. /package/dist/ui/assets/{__vite-browser-external-BvI1wG2f.js → __vite-browser-external-ChUuVKj-.js} +0 -0
  101. /package/dist/ui/assets/{addon-fit-DYt1qsAX.js → addon-fit-BCjyTVK7.js} +0 -0
  102. /package/dist/ui/assets/{addon-fit-B0aHsvmX.js → addon-fit-CVV7fTw9.js} +0 -0
  103. /package/dist/ui/assets/{azure-ai-foundry-CaxHzIfg.js → azure-ai-foundry-BS3xCper.js} +0 -0
  104. /package/dist/ui/assets/{azure-ai-foundry-Bcv3AvZm.js → azure-ai-foundry-rmhg6ipI.js} +0 -0
  105. /package/dist/ui/assets/{bsh-watchdog-DEvn8Q9x.js → bsh-watchdog-D59Tbl5E.js} +0 -0
  106. /package/dist/ui/assets/{chat-fixture-5h_JuUYl.js → chat-fixture-CZVZdKyJ.js} +0 -0
  107. /package/dist/ui/assets/{diagnostics-5umns3WY.js → diagnostics-COTIkqqc.js} +0 -0
  108. /package/dist/ui/assets/{diagnostics-BowEoTPl.js → diagnostics-DEZCW87A.js} +0 -0
  109. /package/dist/ui/assets/{dist-Ct5XR8EU.js → dist-BzFg7Vf5.js} +0 -0
  110. /package/dist/ui/assets/{dist-zlAHCcD1.js → dist-DNQ3u_NS.js} +0 -0
  111. /package/dist/ui/assets/{git-config-BMEHAjvp.js → git-config-Bl-XsMb6.js} +0 -0
  112. /package/dist/ui/assets/{git-config-DZUguBxI.js → git-config-CxvDN7N3.js} +0 -0
  113. /package/dist/ui/assets/{github-copilot-headers-C8KSO_i5.js → github-copilot-headers-B6Fvsk-Y.js} +0 -0
  114. /package/dist/ui/assets/{github-copilot-headers-DLK82thn.js → github-copilot-headers-DFUtSIuj.js} +0 -0
  115. /package/dist/ui/assets/{hash-B7CztTb_.js → hash-CQjDwcjR.js} +0 -0
  116. /package/dist/ui/assets/{hash-BwzabXYv.js → hash-CsofV07h.js} +0 -0
  117. /package/dist/ui/assets/{headers-CRXCny-K.js → headers-BCPSYYop.js} +0 -0
  118. /package/dist/ui/assets/{headers-CeeP1wvy.js → headers-DkHU-pcw.js} +0 -0
  119. /package/dist/ui/assets/{lick-manager-proxy-DwmV23nZ.js → lick-manager-proxy-B0RDZsAR.js} +0 -0
  120. /package/dist/ui/assets/{mime-types-CtECiBq5.js → mime-types-DVkB7Eq7.js} +0 -0
  121. /package/dist/ui/assets/{mount-id-BBl3dJu8.js → mount-id-Ccy4_G8i.js} +0 -0
  122. /package/dist/ui/assets/{mount-picker-popup-BLHoVG3y.js → mount-picker-popup-DJJfRF_c.js} +0 -0
  123. /package/dist/ui/assets/{openai-NzrumIkM.js → openai-CRGaNv9i.js} +0 -0
  124. /package/dist/ui/assets/{openai-Cya-48mD.js → openai-D6Fs9zDM.js} +0 -0
  125. /package/dist/ui/assets/{page-storage-sync-DEhI1xEB.js → page-storage-sync-BawH6Tr4.js} +0 -0
  126. /package/dist/ui/assets/{panel-rpc-g85bMVnq.js → panel-rpc-CgCAJfWO.js} +0 -0
  127. /package/dist/ui/assets/{panel-rpc-handlers-Cd0NeWGr.js → panel-rpc-handlers-DQC5qat8.js} +0 -0
  128. /package/dist/ui/assets/{path-utils-B73K5PBp.js → path-utils-CgbXfwyO.js} +0 -0
  129. /package/dist/ui/assets/{path-utils-CNNVZ3-O.js → path-utils-d3qOVZOu.js} +0 -0
  130. /package/dist/ui/assets/{pdfjs-BdNq0_-j.js → pdfjs-jzfXBGiL.js} +0 -0
  131. /package/dist/ui/assets/{remote-cache-BdYCICnT.js → remote-cache-DdfqyJ2A.js} +0 -0
  132. /package/dist/ui/assets/{rum-_zaGz-D7.js → rum-CMSkYNP8.js} +0 -0
  133. /package/dist/ui/assets/{sanitize-unicode-DANurEy1.js → sanitize-unicode-BD2XKRoV.js} +0 -0
  134. /package/dist/ui/assets/{sanitize-unicode-MlE1hQqG.js → sanitize-unicode-ncMKN_SD.js} +0 -0
  135. /package/dist/ui/assets/{secret-env-DES2XPkD.js → secret-env-VITP8dzh.js} +0 -0
  136. /package/dist/ui/assets/{simple-options-B0cR4giT.js → simple-options-imi_RHvn.js} +0 -0
  137. /package/dist/ui/assets/{sprinkle-bridge-channel-DJuNr3kv.js → sprinkle-bridge-channel-C5ki0FNk.js} +0 -0
  138. /package/dist/ui/assets/{sprinkle-bridge-channel-DhKQ_srk.js → sprinkle-bridge-channel-CHgv5aYx.js} +0 -0
  139. /package/dist/ui/assets/{sprinkle-proxy-Ci8JPwa_.js → sprinkle-proxy-8PgiiiqE.js} +0 -0
  140. /package/dist/ui/assets/{src-oRxlT3fT.js → src-BcpYRmFj.js} +0 -0
  141. /package/dist/ui/assets/{transform-messages-DlZklr1h.js → transform-messages-uhk4b6os.js} +0 -0
  142. /package/dist/ui/assets/{tray-follower-status-DmK3Afse.js → tray-follower-status-Bjjx7UWt.js} +0 -0
  143. /package/dist/ui/assets/{xterm-CeGiW_7a.js → xterm-B7kAlFoJ.js} +0 -0
  144. /package/dist/ui/assets/{xterm-D5M9QCcR.js → xterm-ucbPh68r.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"./chunk-jRWAZmH_.js";import{t as n}from"./transform-messages-DlZklr1h.js";import{t as r}from"./sanitize-unicode-MlE1hQqG.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);function c(){return{geminiUrl:void 0,vertexUrl:void 0}}function l(e,t,n,r){if(!e?.baseUrl){let e=c();return t?e.vertexUrl??n:e.geminiUrl??r}return e.baseUrl}
1
+ import{o as e,t}from"./chunk-jRWAZmH_.js";import{t as n}from"./transform-messages-uhk4b6os.js";import{t as r}from"./sanitize-unicode-ncMKN_SD.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);function c(){return{geminiUrl:void 0,vertexUrl:void 0}}function l(e,t,n,r){if(!e?.baseUrl){let e=c();return t?e.vertexUrl??n:e.geminiUrl??r}return e.baseUrl}
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2025 Google LLC
@@ -1 +1 @@
1
- import{a as e,c as t,r as n,s as r}from"./transform-messages-DlZklr1h.js";import{t as i}from"./sanitize-unicode-MlE1hQqG.js";import{a,c as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p}from"./google-shared-CEbAcMay.js";const m={THINKING_LEVEL_UNSPECIFIED:c.THINKING_LEVEL_UNSPECIFIED,MINIMAL:c.MINIMAL,LOW:c.LOW,MEDIUM:c.MEDIUM,HIGH:c.HIGH};let h=0;const g=(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 o=C(i),c=o?y(t,o,i?.headers):v(t,T(i),E(i),i?.headers),l=D(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,g=e.content,_=()=>g.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=d(t);(!m||n&&m.type!==`thinking`||!n&&m.type!==`text`)&&(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:g.length-1,content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:_(),content:m.thinking,partial:e})),n?(m={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(m),a.push({type:`thinking_start`,contentIndex:_(),partial:e})):(m={type:`text`,text:``},e.content.push(m),a.push({type:`text_start`,contentIndex:_(),partial:e}))),m.type===`thinking`?(m.thinking+=t.text,m.thinkingSignature=u(m.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:_(),delta:t.text,partial:e})):(m.text+=t.text,m.textSignature=u(m.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:_(),delta:t.text,partial:e}))}if(t.functionCall){m&&=(m.type===`text`?a.push({type:`text_end`,contentIndex:_(),content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:_(),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()}_${++h}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),a.push({type:`toolcall_start`,contentIndex:_(),partial:e}),a.push({type:`toolcall_delta`,contentIndex:_(),delta:JSON.stringify(r.arguments),partial:e}),a.push({type:`toolcall_end`,contentIndex:_(),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(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:_(),content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:_(),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},_=(e,r,i)=>{let a=n(e,i,void 0);if(!i?.reasoning)return g(e,r,{...a,thinking:{enabled:!1}});let o=t(e,i.reasoning),s=o===`off`?`high`:o,c=e;return O(c)||k(c)?g(e,r,{...a,thinking:{enabled:!0,level:j(s,c)}}):g(e,r,{...a,thinking:{enabled:!0,budgetTokens:M(c,s,i.thinkingBudgets)}})};function v(e,t,n,r){return new f({vertexai:!0,project:t,location:n,apiVersion:`v1`,httpOptions:b(e,r)})}function y(e,t,n){return new f({vertexai:!0,apiKey:t,apiVersion:`v1`,httpOptions:b(e,n)})}function b(e,t){let n={},r=x(e.baseUrl);return r&&(n.baseUrl=r,n.baseUrlResourceScope=o.COLLECTION,S(r)&&(n.apiVersion=``)),(e.headers||t)&&(n.headers={...e.headers,...t}),Object.keys(n).length>0?n:void 0}function x(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function S(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function C(e){let t=e?.apiKey?.trim()||{}.GOOGLE_CLOUD_API_KEY?.trim();if(!(!t||t===`gcp-vertex-credentials`||w(t)))return t}function w(e){return/^<[^>]+>$/.test(e)}function T(e){let t=e?.project||{}.GOOGLE_CLOUD_PROJECT||{}.GCLOUD_PROJECT;if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function E(e){let t=e?.location||{}.GOOGLE_CLOUD_LOCATION;if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function D(e,t,n={}){let r=p(e,t),o={};n.temperature!==void 0&&(o.temperature=n.temperature),n.maxTokens!==void 0&&(o.maxOutputTokens=n.maxTokens);let s={...Object.keys(o).length>0&&o,...t.systemPrompt&&{systemInstruction:i(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:l(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:a(n.toolChoice)}}:s.toolConfig=void 0,n.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};n.thinking.level===void 0?n.thinking.budgetTokens!==void 0&&(e.thinkingBudget=n.thinking.budgetTokens):e.thinkingLevel=m[n.thinking.level],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=A(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);s.abortSignal=n.signal}return{model:e.id,contents:r,config:s}}function O(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function k(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function A(e){let t=e;return O(t)?{thinkingLevel:c.LOW}:k(t)?{thinkingLevel:c.MINIMAL}:{thinkingBudget:0}}function j(e,t){if(O(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function M(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{g as streamGoogleVertex,_ as streamSimpleGoogleVertex};
1
+ import{a as e,c as t,r as n,s as r}from"./transform-messages-uhk4b6os.js";import{t as i}from"./sanitize-unicode-ncMKN_SD.js";import{a,c as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p}from"./google-shared-XoadLsBb.js";const m={THINKING_LEVEL_UNSPECIFIED:c.THINKING_LEVEL_UNSPECIFIED,MINIMAL:c.MINIMAL,LOW:c.LOW,MEDIUM:c.MEDIUM,HIGH:c.HIGH};let h=0;const g=(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 o=C(i),c=o?y(t,o,i?.headers):v(t,T(i),E(i),i?.headers),l=D(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,g=e.content,_=()=>g.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=d(t);(!m||n&&m.type!==`thinking`||!n&&m.type!==`text`)&&(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:g.length-1,content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:_(),content:m.thinking,partial:e})),n?(m={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(m),a.push({type:`thinking_start`,contentIndex:_(),partial:e})):(m={type:`text`,text:``},e.content.push(m),a.push({type:`text_start`,contentIndex:_(),partial:e}))),m.type===`thinking`?(m.thinking+=t.text,m.thinkingSignature=u(m.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:_(),delta:t.text,partial:e})):(m.text+=t.text,m.textSignature=u(m.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:_(),delta:t.text,partial:e}))}if(t.functionCall){m&&=(m.type===`text`?a.push({type:`text_end`,contentIndex:_(),content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:_(),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()}_${++h}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),a.push({type:`toolcall_start`,contentIndex:_(),partial:e}),a.push({type:`toolcall_delta`,contentIndex:_(),delta:JSON.stringify(r.arguments),partial:e}),a.push({type:`toolcall_end`,contentIndex:_(),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(m&&(m.type===`text`?a.push({type:`text_end`,contentIndex:_(),content:m.text,partial:e}):a.push({type:`thinking_end`,contentIndex:_(),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},_=(e,r,i)=>{let a=n(e,i,void 0);if(!i?.reasoning)return g(e,r,{...a,thinking:{enabled:!1}});let o=t(e,i.reasoning),s=o===`off`?`high`:o,c=e;return O(c)||k(c)?g(e,r,{...a,thinking:{enabled:!0,level:j(s,c)}}):g(e,r,{...a,thinking:{enabled:!0,budgetTokens:M(c,s,i.thinkingBudgets)}})};function v(e,t,n,r){return new f({vertexai:!0,project:t,location:n,apiVersion:`v1`,httpOptions:b(e,r)})}function y(e,t,n){return new f({vertexai:!0,apiKey:t,apiVersion:`v1`,httpOptions:b(e,n)})}function b(e,t){let n={},r=x(e.baseUrl);return r&&(n.baseUrl=r,n.baseUrlResourceScope=o.COLLECTION,S(r)&&(n.apiVersion=``)),(e.headers||t)&&(n.headers={...e.headers,...t}),Object.keys(n).length>0?n:void 0}function x(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function S(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function C(e){let t=e?.apiKey?.trim()||{}.GOOGLE_CLOUD_API_KEY?.trim();if(!(!t||t===`gcp-vertex-credentials`||w(t)))return t}function w(e){return/^<[^>]+>$/.test(e)}function T(e){let t=e?.project||{}.GOOGLE_CLOUD_PROJECT||{}.GCLOUD_PROJECT;if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function E(e){let t=e?.location||{}.GOOGLE_CLOUD_LOCATION;if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function D(e,t,n={}){let r=p(e,t),o={};n.temperature!==void 0&&(o.temperature=n.temperature),n.maxTokens!==void 0&&(o.maxOutputTokens=n.maxTokens);let s={...Object.keys(o).length>0&&o,...t.systemPrompt&&{systemInstruction:i(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:l(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:a(n.toolChoice)}}:s.toolConfig=void 0,n.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};n.thinking.level===void 0?n.thinking.budgetTokens!==void 0&&(e.thinkingBudget=n.thinking.budgetTokens):e.thinkingLevel=m[n.thinking.level],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=A(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);s.abortSignal=n.signal}return{model:e.id,contents:r,config:s}}function O(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function k(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function A(e){let t=e;return O(t)?{thinkingLevel:c.LOW}:k(t)?{thinkingLevel:c.MINIMAL}:{thinkingBudget:0}}function j(e,t){if(O(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function M(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{g as streamGoogleVertex,_ as streamSimpleGoogleVertex};
@@ -1 +1 @@
1
- import{a as e,c as t,n,s as r}from"./simple-options-B0cR4giT.js";import{t as i}from"./sanitize-unicode-DANurEy1.js";import{a,c as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p}from"./google-shared-b8limp-0.js";var m=`v1`,h=`gcp-vertex-credentials`,g={THINKING_LEVEL_UNSPECIFIED:c.THINKING_LEVEL_UNSPECIFIED,MINIMAL:c.MINIMAL,LOW:c.LOW,MEDIUM:c.MEDIUM,HIGH:c.HIGH},_=0,v=(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 o=T(i),c=o?x(t,o,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=d(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=u(m.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:g(),delta:t.text,partial:e})):(m.text+=t.text,m.textSignature=u(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=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(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=n(e,i,void 0);if(!i?.reasoning)return v(e,r,{...a,thinking:{enabled:!1}});let o=t(e,i.reasoning),s=o===`off`?`high`:o,c=e;return A(c)||j(c)?v(e,r,{...a,thinking:{enabled:!0,level:N(s,c)}}):v(e,r,{...a,thinking:{enabled:!0,budgetTokens:P(c,s,i.thinkingBudgets)}})};function b(e,t,n,r){return new f({vertexai:!0,project:t,location:n,apiVersion:m,httpOptions:S(e,r)})}function x(e,t,n){return new f({vertexai:!0,apiKey:t,apiVersion:m,httpOptions:S(e,n)})}function S(e,t){let n={},r=C(e.baseUrl);return r&&(n.baseUrl=r,n.baseUrlResourceScope=o.COLLECTION,w(r)&&(n.apiVersion=``)),(e.headers||t)&&(n.headers={...e.headers,...t}),Object.keys(n).length>0?n:void 0}function C(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function w(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function T(e){let t=e?.apiKey?.trim()||{}.GOOGLE_CLOUD_API_KEY?.trim();if(!(!t||t===h||E(t)))return t}function E(e){return/^<[^>]+>$/.test(e)}function D(e){let t=e?.project||{}.GOOGLE_CLOUD_PROJECT||{}.GCLOUD_PROJECT;if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function O(e){let t=e?.location||{}.GOOGLE_CLOUD_LOCATION;if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function k(e,t,n={}){let r=p(e,t),o={};n.temperature!==void 0&&(o.temperature=n.temperature),n.maxTokens!==void 0&&(o.maxOutputTokens=n.maxTokens);let s={...Object.keys(o).length>0&&o,...t.systemPrompt&&{systemInstruction:i(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:l(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:a(n.toolChoice)}}:s.toolConfig=void 0,n.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};n.thinking.level===void 0?n.thinking.budgetTokens!==void 0&&(e.thinkingBudget=n.thinking.budgetTokens):e.thinkingLevel=g[n.thinking.level],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=M(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);s.abortSignal=n.signal}return{model:e.id,contents:r,config:s}}function A(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function j(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function M(e){let t=e;return A(t)?{thinkingLevel:c.LOW}:j(t)?{thinkingLevel:c.MINIMAL}:{thinkingBudget:0}}function N(e,t){if(A(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function P(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{v as streamGoogleVertex,y as streamSimpleGoogleVertex};
1
+ import{a as e,c as t,n,s as r}from"./simple-options-imi_RHvn.js";import{t as i}from"./sanitize-unicode-BD2XKRoV.js";import{a,c as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p}from"./google-shared-D_QrelB6.js";var m=`v1`,h=`gcp-vertex-credentials`,g={THINKING_LEVEL_UNSPECIFIED:c.THINKING_LEVEL_UNSPECIFIED,MINIMAL:c.MINIMAL,LOW:c.LOW,MEDIUM:c.MEDIUM,HIGH:c.HIGH},_=0,v=(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 o=T(i),c=o?x(t,o,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=d(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=u(m.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:g(),delta:t.text,partial:e})):(m.text+=t.text,m.textSignature=u(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=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(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=n(e,i,void 0);if(!i?.reasoning)return v(e,r,{...a,thinking:{enabled:!1}});let o=t(e,i.reasoning),s=o===`off`?`high`:o,c=e;return A(c)||j(c)?v(e,r,{...a,thinking:{enabled:!0,level:N(s,c)}}):v(e,r,{...a,thinking:{enabled:!0,budgetTokens:P(c,s,i.thinkingBudgets)}})};function b(e,t,n,r){return new f({vertexai:!0,project:t,location:n,apiVersion:m,httpOptions:S(e,r)})}function x(e,t,n){return new f({vertexai:!0,apiKey:t,apiVersion:m,httpOptions:S(e,n)})}function S(e,t){let n={},r=C(e.baseUrl);return r&&(n.baseUrl=r,n.baseUrlResourceScope=o.COLLECTION,w(r)&&(n.apiVersion=``)),(e.headers||t)&&(n.headers={...e.headers,...t}),Object.keys(n).length>0?n:void 0}function C(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function w(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function T(e){let t=e?.apiKey?.trim()||{}.GOOGLE_CLOUD_API_KEY?.trim();if(!(!t||t===h||E(t)))return t}function E(e){return/^<[^>]+>$/.test(e)}function D(e){let t=e?.project||{}.GOOGLE_CLOUD_PROJECT||{}.GCLOUD_PROJECT;if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function O(e){let t=e?.location||{}.GOOGLE_CLOUD_LOCATION;if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function k(e,t,n={}){let r=p(e,t),o={};n.temperature!==void 0&&(o.temperature=n.temperature),n.maxTokens!==void 0&&(o.maxOutputTokens=n.maxTokens);let s={...Object.keys(o).length>0&&o,...t.systemPrompt&&{systemInstruction:i(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:l(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:a(n.toolChoice)}}:s.toolConfig=void 0,n.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};n.thinking.level===void 0?n.thinking.budgetTokens!==void 0&&(e.thinkingBudget=n.thinking.budgetTokens):e.thinkingLevel=g[n.thinking.level],s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=M(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);s.abortSignal=n.signal}return{model:e.id,contents:r,config:s}}function A(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function j(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function M(e){let t=e;return A(t)?{thinkingLevel:c.LOW}:j(t)?{thinkingLevel:c.MINIMAL}:{thinkingBudget:0}}function N(e,t){if(A(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function P(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{v as streamGoogleVertex,y as streamSimpleGoogleVertex};