sliccy 3.30.0 → 3.31.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 (88) hide show
  1. package/dist/ui/assets/adobe-CNsjY_V1.js +2 -0
  2. package/dist/ui/assets/adobe-q1ynSkgJ.js +1 -0
  3. package/dist/ui/assets/{agent-bridge-B47ORnu8.js → agent-bridge-DaY3lEr8.js} +1 -1
  4. package/dist/ui/assets/{agent-message-to-chat-CivM5iVI.js → agent-message-to-chat-QxmVsZHN.js} +1 -1
  5. package/dist/ui/assets/{anthropic-B8x_-x-6.js → anthropic-BcxNFOMf.js} +1 -1
  6. package/dist/ui/assets/{anthropic-BIPAKMlm.js → anthropic-C29fNa0p.js} +1 -1
  7. package/dist/ui/assets/{apps-BIbLhrlo.js → apps-DEr5_QVi.js} +1 -1
  8. package/dist/ui/assets/{azure-openai-CxXU2gBi.js → azure-openai-BOAQMret.js} +1 -1
  9. package/dist/ui/assets/{azure-openai-NCIJ99-Z.js → azure-openai-BgjK3tAI.js} +1 -1
  10. package/dist/ui/assets/{azure-openai-responses-Cl168K30.js → azure-openai-responses-B_ZHPZQ_.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-responses-Dsb2dVcl.js → azure-openai-responses-D9aG5ZZZ.js} +1 -1
  12. package/dist/ui/assets/{biome_wasm-CDybUpcY.js → biome_wasm-DFR1VZSE.js} +1 -1
  13. package/dist/ui/assets/{bsh-watchdog-Ct8X8nj0.js → bsh-watchdog-DOvowpMJ.js} +1 -1
  14. package/dist/ui/assets/{cdp-CQNRG1L7.js → cdp-DLzkpHPR.js} +3 -3
  15. package/dist/ui/assets/{cdp-ws-page-bridge-TbT2oOFP.js → cdp-ws-page-bridge-DbNf5VhA.js} +1 -1
  16. package/dist/ui/assets/{common-Dp2LMvPs.js → common-Ce3nKdPG.js} +1 -1
  17. package/dist/ui/assets/{connect-surface-6Xdk8gty.js → connect-surface-BfntsfUz.js} +1 -1
  18. package/dist/ui/assets/cost-command-CfSpaR6u.js +1 -0
  19. package/dist/ui/assets/{es-BZcvk2vu.js → es-Gkir_CGN.js} +1 -1
  20. package/dist/ui/assets/{follower-sprinkle-bridge-BZOJjwi5.js → follower-sprinkle-bridge-Bsb9Um7I.js} +1 -1
  21. package/dist/ui/assets/{github-T4vTwz6j.js → github-C2uMRSdr.js} +1 -1
  22. package/dist/ui/assets/{github-copilot-DJhJjjGT.js → github-copilot-BdAJesOB.js} +1 -1
  23. package/dist/ui/assets/{github-copilot-DCNfM6__.js → github-copilot-DsrWwQfK.js} +2 -2
  24. package/dist/ui/assets/{github-CB-1cuiS.js → github-tMItzRHe.js} +2 -2
  25. package/dist/ui/assets/{google-CjogI3dp.js → google-BCVpl33Q.js} +1 -1
  26. package/dist/ui/assets/{google-Zk-hhREr.js → google-BJtxAJct.js} +1 -1
  27. package/dist/ui/assets/{google-shared-CjuxcHRG.js → google-shared-BEVjYKj2.js} +1 -1
  28. package/dist/ui/assets/{google-shared-D4TYGikU.js → google-shared-CaucmB5i.js} +1 -1
  29. package/dist/ui/assets/{google-vertex-DbzvO7wH.js → google-vertex-BrfIL2f8.js} +1 -1
  30. package/dist/ui/assets/{google-vertex-D_IdMTe5.js → google-vertex-Di3B-unZ.js} +1 -1
  31. package/dist/ui/assets/{intercepted-oauth-B7FJFo6o.js → intercepted-oauth-Ap0NXgFY.js} +1 -1
  32. package/dist/ui/assets/{kernel-worker-CwwcfcWb.js → kernel-worker-aL7clsM2.js} +21 -21
  33. package/dist/ui/assets/{lick-ws-bridge-CCyIzWKp.js → lick-ws-bridge-2FLXq2tY.js} +1 -1
  34. package/dist/ui/assets/{local-llm-liuOe0zO.js → local-llm-CABjY-eT.js} +1 -1
  35. package/dist/ui/assets/{magick-wasm-DNjpr8Jr.js → magick-wasm-DojPv_bG.js} +1 -1
  36. package/dist/ui/assets/{main-DMvYmz_A.js → main-BtoNCPyQ.js} +9 -9
  37. package/dist/ui/assets/main-D683Koa8.css +1 -0
  38. package/dist/ui/assets/{main-cherry-D_banPZS.js → main-cherry-BtqehQbg.js} +1 -1
  39. package/dist/ui/assets/{mistral-RYfQO4J8.js → mistral-D13sQ4B4.js} +1 -1
  40. package/dist/ui/assets/{mistral-BD2ee9tA.js → mistral-DmQtCAV6.js} +1 -1
  41. package/dist/ui/assets/{nodejs-ChSC5wtq.js → nodejs-CqTAsRQj.js} +1 -1
  42. package/dist/ui/assets/{nuke-command-rYpivCHk.js → nuke-command-WSharcWR.js} +1 -1
  43. package/dist/ui/assets/{oauth-cX4Ramn1.js → oauth-C6A6yZED.js} +1 -1
  44. package/dist/ui/assets/{oauth-bootstrap-C7RP8P8x.js → oauth-bootstrap-ac4aWs2_.js} +2 -2
  45. package/dist/ui/assets/{oauth-service-sz6K_MqP.js → oauth-service-0c_TknIC.js} +1 -1
  46. package/dist/ui/assets/{oauth-service-C2C92amm.js → oauth-service-7-jMR6uA.js} +1 -1
  47. package/dist/ui/assets/{offscreen-client-kZ_-M9GL.js → offscreen-client-ltzgalb5.js} +1 -1
  48. package/dist/ui/assets/{onboarding-orchestrator-5vX8kVLy.js → onboarding-orchestrator-BOYZUUXo.js} +1 -1
  49. package/dist/ui/assets/{openai-codex-DpKepxN6.js → openai-codex-BvRU1nKe.js} +1 -1
  50. package/dist/ui/assets/{openai-codex-IvPx6ZBR.js → openai-codex-CfooJWr6.js} +1 -1
  51. package/dist/ui/assets/{openai-codex-responses-BLeLjsUM.js → openai-codex-responses-Cb4wO_aM.js} +1 -1
  52. package/dist/ui/assets/{openai-codex-responses-D_-qBZSC.js → openai-codex-responses-DxuvnQBg.js} +1 -1
  53. package/dist/ui/assets/{openai-completions-BcTP1T3o.js → openai-completions-DkS2zVD3.js} +1 -1
  54. package/dist/ui/assets/{openai-responses-Dapme5mJ.js → openai-responses-C4PfIrGV.js} +1 -1
  55. package/dist/ui/assets/{openai-responses-BccakAos.js → openai-responses-FJRVWCAN.js} +1 -1
  56. package/dist/ui/assets/{openai-responses-shared-DQ2Zhc3v.js → openai-responses-shared-BYmbH8Nn.js} +1 -1
  57. package/dist/ui/assets/{openai-responses-shared-CDgUSOrg.js → openai-responses-shared-C3n9ip32.js} +1 -1
  58. package/dist/ui/assets/{openrouter-CC-WqU96.js → openrouter-B7t4AFIg.js} +1 -1
  59. package/dist/ui/assets/{openrouter-B2q2ipL6.js → openrouter-D_bhNbxi.js} +1 -1
  60. package/dist/ui/assets/{panel-rpc-handlers-GJ90xyvC.js → panel-rpc-handlers-B5pMQ8y2.js} +1 -1
  61. package/dist/ui/assets/{provider-DVHbmHE-.js → provider-D86wGnIQ.js} +2 -2
  62. package/dist/ui/assets/{provider-DQLLbpL2.js → provider-Dy70twsR.js} +1 -1
  63. package/dist/ui/assets/provider-store-access-D_YGmkw4.js +1 -0
  64. package/dist/ui/assets/provider-store-access-iZ8Jszhq.js +1 -0
  65. package/dist/ui/assets/{proxied-fetch-CQfWbSFy.js → proxied-fetch-CAbygDUy.js} +1 -1
  66. package/dist/ui/assets/{pyodide-DbbP0Z2Z.js → pyodide-Cj1nQzdj.js} +2 -2
  67. package/dist/ui/assets/{remote-terminal-view-DCOs0LA6.js → remote-terminal-view-Di-2iBd0.js} +1 -1
  68. package/dist/ui/assets/{secret-env-BltiZf1i.js → secret-env-Kl69LC-B.js} +1 -1
  69. package/dist/ui/assets/{slicc-editor-BmgJU73Z.js → slicc-editor-BpfdHOM4.js} +1 -1
  70. package/dist/ui/assets/{spawn-SKmFRfBn.js → spawn-D7jaToJ9.js} +1 -1
  71. package/dist/ui/assets/{sql-wasm-7mGRTB92.js → sql-wasm-rW6OuYUy.js} +1 -1
  72. package/dist/ui/assets/{store-BL9yDBxi.js → store-BYZoB9Pz.js} +1 -1
  73. package/dist/ui/assets/{tray-leave-runtime-Bbl_QlKA.js → tray-leave-runtime-Bl06YhqQ.js} +1 -1
  74. package/dist/ui/assets/{typescript-lrBWKZhg.js → typescript-BGABsOjF.js} +1 -1
  75. package/dist/ui/assets/{upgrade-detection-vmj6wvLl.js → upgrade-detection-D6N4MRCp.js} +1 -1
  76. package/dist/ui/assets/{web-BGNRUVyk.js → web-DUSjmrph.js} +1 -1
  77. package/dist/ui/assets/{ws-subscribers-BVEk6KlP.js → ws-subscribers-Ctp0G6_t.js} +1 -1
  78. package/dist/ui/assets/{xai-grok-DCg21mqz.js → xai-grok-COpIZ456.js} +1 -1
  79. package/dist/ui/assets/{xai-grok-CfV2xtIC.js → xai-grok-DIrGQApI.js} +1 -1
  80. package/dist/ui/index.html +2 -2
  81. package/dist/ui/packages/webapp/index.html +2 -2
  82. package/package.json +1 -1
  83. package/dist/ui/assets/adobe-BY1zH2zg.js +0 -1
  84. package/dist/ui/assets/adobe-DWr7bwoG.js +0 -2
  85. package/dist/ui/assets/cost-command-BBWgCx9X.js +0 -1
  86. package/dist/ui/assets/main-BxXY3xQw.css +0 -1
  87. package/dist/ui/assets/provider-store-access-8En9BwpM.js +0 -1
  88. package/dist/ui/assets/provider-store-access-pZUdvcTQ.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-DMvYmz_A.js","assets/modulepreload-polyfill-Dezn_h7o.js","assets/main-BxXY3xQw.css"])))=>i.map(i=>d[i]);
2
- import{D as e,T as t,f as n,it as r,l as i,r as a}from"./main-DMvYmz_A.js";import{getOAuthPageOrigin as o}from"./oauth-service-sz6K_MqP.js";import{t as s}from"./global-db-CbuLl-zx.js";var c={clientId:``,scopes:`repo,read:user,user:email`};function l(){try{let t=localStorage.getItem(e);if(t)return t.replace(/\/$/,``)}catch{}return t}async function u(e){let t=`${l()}/oauth/token`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,code:e.code,redirect_uri:e.redirectUri})}),r;try{r=await n.json()}catch{throw Error(`Token exchange failed (HTTP ${n.status}): non-JSON response`)}if(!n.ok&&n.status!==200){let e=r.error_description??r.error??`Token exchange failed (HTTP ${n.status})`;throw Error(e)}if(r.error){let e=r.error_description??r.error;throw Error(e)}return r}async function d(e){let t=`${l()}/oauth/revoke`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,access_token:e.accessToken})});if(!(n.status===204||n.ok)){if(n.status===400)try{if((await n.json()).error===`unsupported`)return}catch{}throw Error(`Token revocation failed (HTTP ${n.status})`)}}var f=Object.assign({"/packages/webapp/providers/github-config.json":c})[`/packages/webapp/providers/github-config.json`]??{clientId:``,scopes:`repo,read:user,user:email`},p=null,m=null;function h(e){let{isExtension:t,isConnectMode:n,workerBaseUrl:r,pageOrigin:i,pageHref:a,extensionId:o,nonce:s}=e;if(t)return{redirectUri:`${r}/auth/callback`,state:{source:`extension`,extensionId:o,path:`/github`,nonce:s}};if(n){let e=i??``;if(/^https?:\/\/(localhost|127\.0\.0\.1):\d+$/.test(e)){let t=parseInt(new URL(a??e).port||`8790`,10);return{redirectUri:`${r}/auth/callback`,state:{source:`local`,port:t,path:`/auth/callback`,nonce:s}}}return{redirectUri:`${r}/auth/callback`,state:{source:`remote`,origin:e,path:`/auth/callback`,nonce:s}}}return{redirectUri:`${e.runtimeWorkerBaseUrl??i??``}/auth/callback`,state:{port:parseInt(new URL(a??i??`http://localhost:5710`).port||`5710`,10),path:`/auth/callback`,nonce:s}}}async function g(){if(p)return p;if(_){try{let e=await fetch(`${l()}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return p=t.oauth.github,p}}catch{}return f.clientId}try{let e=await fetch(`/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return p=t.oauth.github,p;if(t.trayWorkerBaseUrl){m=t.trayWorkerBaseUrl;let e=await fetch(`${t.trayWorkerBaseUrl}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return p=t.oauth.github,p}}}}catch{}return f.clientId}var _=typeof chrome<`u`&&!!chrome?.runtime?.id;function v(){return a().find(e=>e.providerId===`github`)}function y(e){try{return new URL(e).searchParams.get(`code`)}catch{return null}}async function b(e){try{let t=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${e}`,Accept:`application/vnd.github+json`}});if(t.ok){let e=await t.json();return{name:e.name||e.login,avatar:e.avatar_url,login:e.login,id:e.id}}}catch(e){console.warn(`[github] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function x(e,t){return`${e}+${t}@users.noreply.github.com`}async function S(e){try{let{VirtualFS:t}=await r(async()=>{let{VirtualFS:e}=await import(`./main-DMvYmz_A.js`).then(e=>e.x);return{VirtualFS:e}},__vite__mapDeps([0,1,2]));await(await t.create({dbName:s})).writeFile(`/workspace/.git/github-token`,e),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch(e){console.warn(`[github] Failed to write git token:`,e instanceof Error?e.message:String(e))}}async function C(){try{let{VirtualFS:e}=await r(async()=>{let{VirtualFS:e}=await import(`./main-DMvYmz_A.js`).then(e=>e.x);return{VirtualFS:e}},__vite__mapDeps([0,1,2]));await(await e.create({dbName:s})).rm(`/workspace/.git/github-token`),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch{}}async function w(e){if(!(!e.login||e.id===void 0))try{let{VirtualFS:t}=await r(async()=>{let{VirtualFS:e}=await import(`./main-DMvYmz_A.js`).then(e=>e.x);return{VirtualFS:e}},__vite__mapDeps([0,1,2])),{readGlobalGitConfigValue:n,writeGlobalGitConfigValue:i}=await r(async()=>{let{readGlobalGitConfigValue:e,writeGlobalGitConfigValue:t}=await import(`./git-config-DLJIrKjL.js`);return{readGlobalGitConfigValue:e,writeGlobalGitConfigValue:t}},[]),a=await t.create({dbName:s}),o=e.name||e.login,c=x(e.id,e.login);!await n(a,`user.name`)&&o&&await i(a,`user.name`,o),await n(a,`user.email`)||await i(a,`user.email`,c)}catch(e){console.warn(`[github] Failed to seed git identity:`,e instanceof Error?e.message:String(e))}}async function T(){let e=v();if(!e?.accessToken)throw Error(`Not logged in to GitHub — please log in first`);return e.accessToken}var E={id:`github`,name:`GitHub`,description:"Sign in with GitHub for git authentication (push/pull/clone) and the `oauth-token github` shell command. Does not expose LLM models — use the GitHub Copilot provider for those.",requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,oauthTokenDomains:[`github.com`,`*.github.com`,`api.github.com`,`raw.githubusercontent.com`],getModelIds:()=>[],onOAuthLogin:async(e,t,r)=>{let a=await g();if(!a)throw Error(`GitHub OAuth not configured — no client ID available`);let s=r?.scopes??f.scopes,c=_?null:await o(),d=crypto.randomUUID(),p=_?chrome.runtime.id:``,{redirectUri:v,state:x}=h({isExtension:_,isConnectMode:!!globalThis.__slicc_connect_mode,workerBaseUrl:l(),runtimeWorkerBaseUrl:m,pageOrigin:c?.origin??null,pageHref:c?.href??null,extensionId:p,nonce:d}),T=btoa(JSON.stringify(x)),E=d,D=new URLSearchParams({client_id:a,scope:s,redirect_uri:v});T&&D.set(`state`,T);let O=await e(`https://github.com/login/oauth/authorize?${D}`);if(!O)return;if(E)try{if(new URL(O).searchParams.get(`nonce`)!==E){console.error(`[github] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[github] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let k=y(O);if(!k){console.error(`[github] Could not extract authorization code from redirect URL`);return}let A=await u({provider:`github`,code:k,redirectUri:v}),j=await b(A.access_token);await n({providerId:`github`,accessToken:A.access_token,userName:j.name,userAvatar:j.avatar});let M=i(`github`)?.maskedValue;M?await S(M):await C(),await w(j),t()},onOAuthLogout:async()=>{let e=v();e?.accessToken&&await d({provider:`github`,accessToken:e.accessToken}).catch(e=>console.warn(`[github] Token revocation failed:`,e instanceof Error?e.message:String(e))),await C(),await n({providerId:`github`,accessToken:``})},getOAuthLogoutUrl:e=>`https://github.com/logout`};export{x as buildNoreplyEmail,E as config,y as extractCodeFromUrl,T as getValidAccessToken,h as resolveGithubOAuthRedirect,w as syncGitIdentityFromGitHub};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-BtoNCPyQ.js","assets/modulepreload-polyfill-Dezn_h7o.js","assets/main-D683Koa8.css"])))=>i.map(i=>d[i]);
2
+ import{D as e,T as t,f as n,it as r,l as i,r as a}from"./main-BtoNCPyQ.js";import{getOAuthPageOrigin as o}from"./oauth-service-0c_TknIC.js";import{t as s}from"./global-db-CbuLl-zx.js";var c={clientId:``,scopes:`repo,read:user,user:email`};function l(){try{let t=localStorage.getItem(e);if(t)return t.replace(/\/$/,``)}catch{}return t}async function u(e){let t=`${l()}/oauth/token`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,code:e.code,redirect_uri:e.redirectUri})}),r;try{r=await n.json()}catch{throw Error(`Token exchange failed (HTTP ${n.status}): non-JSON response`)}if(!n.ok&&n.status!==200){let e=r.error_description??r.error??`Token exchange failed (HTTP ${n.status})`;throw Error(e)}if(r.error){let e=r.error_description??r.error;throw Error(e)}return r}async function d(e){let t=`${l()}/oauth/revoke`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,access_token:e.accessToken})});if(!(n.status===204||n.ok)){if(n.status===400)try{if((await n.json()).error===`unsupported`)return}catch{}throw Error(`Token revocation failed (HTTP ${n.status})`)}}var f=Object.assign({"/packages/webapp/providers/github-config.json":c})[`/packages/webapp/providers/github-config.json`]??{clientId:``,scopes:`repo,read:user,user:email`},p=null,m=null;function h(e){let{isExtension:t,isConnectMode:n,workerBaseUrl:r,pageOrigin:i,pageHref:a,extensionId:o,nonce:s}=e;if(t)return{redirectUri:`${r}/auth/callback`,state:{source:`extension`,extensionId:o,path:`/github`,nonce:s}};if(n){let e=i??``;if(/^https?:\/\/(localhost|127\.0\.0\.1):\d+$/.test(e)){let t=parseInt(new URL(a??e).port||`8790`,10);return{redirectUri:`${r}/auth/callback`,state:{source:`local`,port:t,path:`/auth/callback`,nonce:s}}}return{redirectUri:`${r}/auth/callback`,state:{source:`remote`,origin:e,path:`/auth/callback`,nonce:s}}}return{redirectUri:`${e.runtimeWorkerBaseUrl??i??``}/auth/callback`,state:{port:parseInt(new URL(a??i??`http://localhost:5710`).port||`5710`,10),path:`/auth/callback`,nonce:s}}}async function g(){if(p)return p;if(_){try{let e=await fetch(`${l()}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return p=t.oauth.github,p}}catch{}return f.clientId}try{let e=await fetch(`/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return p=t.oauth.github,p;if(t.trayWorkerBaseUrl){m=t.trayWorkerBaseUrl;let e=await fetch(`${t.trayWorkerBaseUrl}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return p=t.oauth.github,p}}}}catch{}return f.clientId}var _=typeof chrome<`u`&&!!chrome?.runtime?.id;function v(){return a().find(e=>e.providerId===`github`)}function y(e){try{return new URL(e).searchParams.get(`code`)}catch{return null}}async function b(e){try{let t=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${e}`,Accept:`application/vnd.github+json`}});if(t.ok){let e=await t.json();return{name:e.name||e.login,avatar:e.avatar_url,login:e.login,id:e.id}}}catch(e){console.warn(`[github] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function x(e,t){return`${e}+${t}@users.noreply.github.com`}async function S(e){try{let{VirtualFS:t}=await r(async()=>{let{VirtualFS:e}=await import(`./main-BtoNCPyQ.js`).then(e=>e.x);return{VirtualFS:e}},__vite__mapDeps([0,1,2]));await(await t.create({dbName:s})).writeFile(`/workspace/.git/github-token`,e),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch(e){console.warn(`[github] Failed to write git token:`,e instanceof Error?e.message:String(e))}}async function C(){try{let{VirtualFS:e}=await r(async()=>{let{VirtualFS:e}=await import(`./main-BtoNCPyQ.js`).then(e=>e.x);return{VirtualFS:e}},__vite__mapDeps([0,1,2]));await(await e.create({dbName:s})).rm(`/workspace/.git/github-token`),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch{}}async function w(e){if(!(!e.login||e.id===void 0))try{let{VirtualFS:t}=await r(async()=>{let{VirtualFS:e}=await import(`./main-BtoNCPyQ.js`).then(e=>e.x);return{VirtualFS:e}},__vite__mapDeps([0,1,2])),{readGlobalGitConfigValue:n,writeGlobalGitConfigValue:i}=await r(async()=>{let{readGlobalGitConfigValue:e,writeGlobalGitConfigValue:t}=await import(`./git-config-DLJIrKjL.js`);return{readGlobalGitConfigValue:e,writeGlobalGitConfigValue:t}},[]),a=await t.create({dbName:s}),o=e.name||e.login,c=x(e.id,e.login);!await n(a,`user.name`)&&o&&await i(a,`user.name`,o),await n(a,`user.email`)||await i(a,`user.email`,c)}catch(e){console.warn(`[github] Failed to seed git identity:`,e instanceof Error?e.message:String(e))}}async function T(){let e=v();if(!e?.accessToken)throw Error(`Not logged in to GitHub — please log in first`);return e.accessToken}var E={id:`github`,name:`GitHub`,description:"Sign in with GitHub for git authentication (push/pull/clone) and the `oauth-token github` shell command. Does not expose LLM models — use the GitHub Copilot provider for those.",requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,oauthTokenDomains:[`github.com`,`*.github.com`,`api.github.com`,`raw.githubusercontent.com`],getModelIds:()=>[],onOAuthLogin:async(e,t,r)=>{let a=await g();if(!a)throw Error(`GitHub OAuth not configured — no client ID available`);let s=r?.scopes??f.scopes,c=_?null:await o(),d=crypto.randomUUID(),p=_?chrome.runtime.id:``,{redirectUri:v,state:x}=h({isExtension:_,isConnectMode:!!globalThis.__slicc_connect_mode,workerBaseUrl:l(),runtimeWorkerBaseUrl:m,pageOrigin:c?.origin??null,pageHref:c?.href??null,extensionId:p,nonce:d}),T=btoa(JSON.stringify(x)),E=d,D=new URLSearchParams({client_id:a,scope:s,redirect_uri:v});T&&D.set(`state`,T);let O=await e(`https://github.com/login/oauth/authorize?${D}`);if(!O)return;if(E)try{if(new URL(O).searchParams.get(`nonce`)!==E){console.error(`[github] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[github] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let k=y(O);if(!k){console.error(`[github] Could not extract authorization code from redirect URL`);return}let A=await u({provider:`github`,code:k,redirectUri:v}),j=await b(A.access_token);await n({providerId:`github`,accessToken:A.access_token,userName:j.name,userAvatar:j.avatar});let M=i(`github`)?.maskedValue;M?await S(M):await C(),await w(j),t()},onOAuthLogout:async()=>{let e=v();e?.accessToken&&await d({provider:`github`,accessToken:e.accessToken}).catch(e=>console.warn(`[github] Token revocation failed:`,e instanceof Error?e.message:String(e))),await C(),await n({providerId:`github`,accessToken:``})},getOAuthLogoutUrl:e=>`https://github.com/logout`};export{x as buildNoreplyEmail,E as config,y as extractCodeFromUrl,T as getValidAccessToken,h as resolveGithubOAuthRedirect,w as syncGitIdentityFromGitHub};
@@ -1 +1 @@
1
- import{G as e,K as t,O as n,U as r,X as i,l as a}from"./kernel-worker-CwwcfcWb.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./google-shared-D4TYGikU.js";let p=0;const m=(t,n,a)=>{let o=new r;return(async()=>{let r={role:`assistant`,content:[],api:`google-generative-ai`,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let c=g(t,a?.apiKey||i(t.provider)||``,a?.headers),d=_(t,n,a),f=await a?.onPayload?.(d,t);f!==void 0&&(d=f);let m=await c.models.generateContentStream(d);o.push({type:`start`,partial:r});let h=null,v=r.content,y=()=>v.length-1;for await(let n of m){r.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let e of i.content.parts){if(e.text!==void 0){let t=u(e);(!h||t&&h.type!==`thinking`||!t&&h.type!==`text`)&&(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:v.length-1,content:h.text,partial:r}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:r})),t?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},r.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:r})):(h={type:`text`,text:``},r.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:r}))),h.type===`thinking`?(h.thinking+=e.text,h.thinkingSignature=l(h.thinkingSignature,e.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:e.text,partial:r})):(h.text+=e.text,h.textSignature=l(h.textSignature,e.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:e.text,partial:r}))}if(e.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:r}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:r}),null);let t=e.functionCall.id,n={type:`toolCall`,id:!t||r.content.some(e=>e.type===`toolCall`&&e.id===t)?`${e.functionCall.name}_${Date.now()}_${++p}`:t,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};r.content.push(n),o.push({type:`toolcall_start`,contentIndex:y(),partial:r}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(n.arguments),partial:r}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:n,partial:r})}}i?.finishReason&&(r.stopReason=s(i.finishReason),r.content.some(e=>e.type===`toolCall`)&&(r.stopReason=`toolUse`)),n.usageMetadata&&(r.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}},e(t,r.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:r}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:r})),a?.signal?.aborted)throw Error(`Request was aborted`);if(r.stopReason===`aborted`||r.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:r.stopReason,message:r}),o.end()}catch(e){for(let e of r.content)`index`in e&&delete e.index;r.stopReason=a?.signal?.aborted?`aborted`:`error`,r.errorMessage=e instanceof Error?e.message:JSON.stringify(e),o.push({type:`error`,reason:r.stopReason,error:r}),o.end()}})(),o},h=(e,r,a)=>{let o=a?.apiKey||i(e.provider);if(!o)throw Error(`No API key for provider: ${e.provider}`);let s=n(e,a,o);if(!a?.reasoning)return m(e,r,{...s,thinking:{enabled:!1}});let c=t(e,a.reasoning),l=c===`off`?`high`:c,u=e;return y(u)||b(u)||v(u)?m(e,r,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(e,r,{...s,thinking:{enabled:!0,budgetTokens:C(u,l,a.thinkingBudgets)}})};function g(e,t,n){let r={};return e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``),(e.headers||n)&&(r.headers={...e.headers,...n}),new d({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function _(e,t,n={}){let r=f(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:a(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:c(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:o(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=n.thinking.level,s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=x(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 v(e){return/gemma-?4/.test(e.id.toLowerCase())}function y(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function b(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function x(e){return y(e)?{thinkingLevel:`LOW`}:b(e)||v(e)?{thinkingLevel:`MINIMAL`}:{thinkingBudget:0}}function S(e,t){if(y(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}if(v(t))switch(e){case`minimal`:case`low`:return`MINIMAL`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function C(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{m as streamGoogle,h as streamSimpleGoogle};
1
+ import{G as e,K as t,O as n,U as r,X as i,l as a}from"./kernel-worker-aL7clsM2.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./google-shared-CaucmB5i.js";let p=0;const m=(t,n,a)=>{let o=new r;return(async()=>{let r={role:`assistant`,content:[],api:`google-generative-ai`,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let c=g(t,a?.apiKey||i(t.provider)||``,a?.headers),d=_(t,n,a),f=await a?.onPayload?.(d,t);f!==void 0&&(d=f);let m=await c.models.generateContentStream(d);o.push({type:`start`,partial:r});let h=null,v=r.content,y=()=>v.length-1;for await(let n of m){r.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let e of i.content.parts){if(e.text!==void 0){let t=u(e);(!h||t&&h.type!==`thinking`||!t&&h.type!==`text`)&&(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:v.length-1,content:h.text,partial:r}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:r})),t?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},r.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:r})):(h={type:`text`,text:``},r.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:r}))),h.type===`thinking`?(h.thinking+=e.text,h.thinkingSignature=l(h.thinkingSignature,e.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:e.text,partial:r})):(h.text+=e.text,h.textSignature=l(h.textSignature,e.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:e.text,partial:r}))}if(e.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:r}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:r}),null);let t=e.functionCall.id,n={type:`toolCall`,id:!t||r.content.some(e=>e.type===`toolCall`&&e.id===t)?`${e.functionCall.name}_${Date.now()}_${++p}`:t,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};r.content.push(n),o.push({type:`toolcall_start`,contentIndex:y(),partial:r}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(n.arguments),partial:r}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:n,partial:r})}}i?.finishReason&&(r.stopReason=s(i.finishReason),r.content.some(e=>e.type===`toolCall`)&&(r.stopReason=`toolUse`)),n.usageMetadata&&(r.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}},e(t,r.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:r}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:r})),a?.signal?.aborted)throw Error(`Request was aborted`);if(r.stopReason===`aborted`||r.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:r.stopReason,message:r}),o.end()}catch(e){for(let e of r.content)`index`in e&&delete e.index;r.stopReason=a?.signal?.aborted?`aborted`:`error`,r.errorMessage=e instanceof Error?e.message:JSON.stringify(e),o.push({type:`error`,reason:r.stopReason,error:r}),o.end()}})(),o},h=(e,r,a)=>{let o=a?.apiKey||i(e.provider);if(!o)throw Error(`No API key for provider: ${e.provider}`);let s=n(e,a,o);if(!a?.reasoning)return m(e,r,{...s,thinking:{enabled:!1}});let c=t(e,a.reasoning),l=c===`off`?`high`:c,u=e;return y(u)||b(u)||v(u)?m(e,r,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(e,r,{...s,thinking:{enabled:!0,budgetTokens:C(u,l,a.thinkingBudgets)}})};function g(e,t,n){let r={};return e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``),(e.headers||n)&&(r.headers={...e.headers,...n}),new d({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function _(e,t,n={}){let r=f(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:a(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:c(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:o(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=n.thinking.level,s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=x(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 v(e){return/gemma-?4/.test(e.id.toLowerCase())}function y(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function b(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function x(e){return y(e)?{thinkingLevel:`LOW`}:b(e)||v(e)?{thinkingLevel:`MINIMAL`}:{thinkingBudget:0}}function S(e,t){if(y(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}if(v(t))switch(e){case`minimal`:case`low`:return`MINIMAL`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function C(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{m as streamGoogle,h as streamSimpleGoogle};
@@ -1 +1 @@
1
- import{$ as e,Q as t,X as n,rt as r,v as i}from"./main-DMvYmz_A.js";import{t as a}from"./sanitize-unicode-DmIE6hZJ.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./google-shared-CjuxcHRG.js";var p=0,m=(e,i,a)=>{let o=new n;return(async()=>{let n={role:`assistant`,content:[],api:`google-generative-ai`,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let c=g(e,a?.apiKey||r(e.provider)||``,a?.headers),d=_(e,i,a),f=await a?.onPayload?.(d,e);f!==void 0&&(d=f);let m=await c.models.generateContentStream(d);o.push({type:`start`,partial:n});let h=null,v=n.content,y=()=>v.length-1;for await(let r of m){n.responseId||=r.responseId;let i=r.candidates?.[0];if(i?.content?.parts)for(let e of i.content.parts){if(e.text!==void 0){let t=u(e);(!h||t&&h.type!==`thinking`||!t&&h.type!==`text`)&&(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:v.length-1,content:h.text,partial:n}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:n})),t?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},n.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:n})):(h={type:`text`,text:``},n.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:n}))),h.type===`thinking`?(h.thinking+=e.text,h.thinkingSignature=l(h.thinkingSignature,e.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:e.text,partial:n})):(h.text+=e.text,h.textSignature=l(h.textSignature,e.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:e.text,partial:n}))}if(e.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:n}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:n}),null);let t=e.functionCall.id,r={type:`toolCall`,id:!t||n.content.some(e=>e.type===`toolCall`&&e.id===t)?`${e.functionCall.name}_${Date.now()}_${++p}`:t,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};n.content.push(r),o.push({type:`toolcall_start`,contentIndex:y(),partial:n}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(r.arguments),partial:n}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:r,partial:n})}}i?.finishReason&&(n.stopReason=s(i.finishReason),n.content.some(e=>e.type===`toolCall`)&&(n.stopReason=`toolUse`)),r.usageMetadata&&(n.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,totalTokens:r.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},t(e,n.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:n}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:n})),a?.signal?.aborted)throw Error(`Request was aborted`);if(n.stopReason===`aborted`||n.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:n.stopReason,message:n}),o.end()}catch(e){for(let e of n.content)`index`in e&&delete e.index;n.stopReason=a?.signal?.aborted?`aborted`:`error`,n.errorMessage=e instanceof Error?e.message:JSON.stringify(e),o.push({type:`error`,reason:n.stopReason,error:n}),o.end()}})(),o},h=(t,n,a)=>{let o=a?.apiKey||r(t.provider);if(!o)throw Error(`No API key for provider: ${t.provider}`);let s=i(t,a,o);if(!a?.reasoning)return m(t,n,{...s,thinking:{enabled:!1}});let c=e(t,a.reasoning),l=c===`off`?`high`:c,u=t;return y(u)||b(u)||v(u)?m(t,n,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(t,n,{...s,thinking:{enabled:!0,budgetTokens:C(u,l,a.thinkingBudgets)}})};function g(e,t,n){let r={};return e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``),(e.headers||n)&&(r.headers={...e.headers,...n}),new d({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function _(e,t,n={}){let r=f(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:a(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:c(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:o(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=n.thinking.level,s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=x(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 v(e){return/gemma-?4/.test(e.id.toLowerCase())}function y(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function b(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function x(e){return y(e)?{thinkingLevel:`LOW`}:b(e)||v(e)?{thinkingLevel:`MINIMAL`}:{thinkingBudget:0}}function S(e,t){if(y(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}if(v(t))switch(e){case`minimal`:case`low`:return`MINIMAL`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function C(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{m as streamGoogle,h as streamSimpleGoogle};
1
+ import{$ as e,Q as t,X as n,rt as r,v as i}from"./main-BtoNCPyQ.js";import{t as a}from"./sanitize-unicode-DmIE6hZJ.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./google-shared-BEVjYKj2.js";var p=0,m=(e,i,a)=>{let o=new n;return(async()=>{let n={role:`assistant`,content:[],api:`google-generative-ai`,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let c=g(e,a?.apiKey||r(e.provider)||``,a?.headers),d=_(e,i,a),f=await a?.onPayload?.(d,e);f!==void 0&&(d=f);let m=await c.models.generateContentStream(d);o.push({type:`start`,partial:n});let h=null,v=n.content,y=()=>v.length-1;for await(let r of m){n.responseId||=r.responseId;let i=r.candidates?.[0];if(i?.content?.parts)for(let e of i.content.parts){if(e.text!==void 0){let t=u(e);(!h||t&&h.type!==`thinking`||!t&&h.type!==`text`)&&(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:v.length-1,content:h.text,partial:n}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:n})),t?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},n.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:n})):(h={type:`text`,text:``},n.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:n}))),h.type===`thinking`?(h.thinking+=e.text,h.thinkingSignature=l(h.thinkingSignature,e.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:e.text,partial:n})):(h.text+=e.text,h.textSignature=l(h.textSignature,e.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:e.text,partial:n}))}if(e.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:n}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:n}),null);let t=e.functionCall.id,r={type:`toolCall`,id:!t||n.content.some(e=>e.type===`toolCall`&&e.id===t)?`${e.functionCall.name}_${Date.now()}_${++p}`:t,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};n.content.push(r),o.push({type:`toolcall_start`,contentIndex:y(),partial:n}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(r.arguments),partial:n}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:r,partial:n})}}i?.finishReason&&(n.stopReason=s(i.finishReason),n.content.some(e=>e.type===`toolCall`)&&(n.stopReason=`toolUse`)),r.usageMetadata&&(n.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,totalTokens:r.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},t(e,n.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:n}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:n})),a?.signal?.aborted)throw Error(`Request was aborted`);if(n.stopReason===`aborted`||n.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:n.stopReason,message:n}),o.end()}catch(e){for(let e of n.content)`index`in e&&delete e.index;n.stopReason=a?.signal?.aborted?`aborted`:`error`,n.errorMessage=e instanceof Error?e.message:JSON.stringify(e),o.push({type:`error`,reason:n.stopReason,error:n}),o.end()}})(),o},h=(t,n,a)=>{let o=a?.apiKey||r(t.provider);if(!o)throw Error(`No API key for provider: ${t.provider}`);let s=i(t,a,o);if(!a?.reasoning)return m(t,n,{...s,thinking:{enabled:!1}});let c=e(t,a.reasoning),l=c===`off`?`high`:c,u=t;return y(u)||b(u)||v(u)?m(t,n,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(t,n,{...s,thinking:{enabled:!0,budgetTokens:C(u,l,a.thinkingBudgets)}})};function g(e,t,n){let r={};return e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``),(e.headers||n)&&(r.headers={...e.headers,...n}),new d({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function _(e,t,n={}){let r=f(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let s={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:a(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:c(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?s.toolConfig={functionCallingConfig:{mode:o(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=n.thinking.level,s.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(s.thinkingConfig=x(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 v(e){return/gemma-?4/.test(e.id.toLowerCase())}function y(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function b(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function x(e){return y(e)?{thinkingLevel:`LOW`}:b(e)||v(e)?{thinkingLevel:`MINIMAL`}:{thinkingBudget:0}}function S(e,t){if(y(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}if(v(t))switch(e){case`minimal`:case`low`:return`MINIMAL`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function C(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{m as streamGoogle,h as streamSimpleGoogle};