sliccy 3.17.0 → 3.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/ui/assets/adobe-BI_Hbg7e.js +1 -0
  2. package/dist/ui/assets/adobe-D6oQBkjb.js +2 -0
  3. package/dist/ui/assets/{agent-bridge-_c6J6Roe.js → agent-bridge-avkwO-58.js} +1 -1
  4. package/dist/ui/assets/{agent-message-to-chat-CwzwhYwI.js → agent-message-to-chat-BwF3D9sV.js} +1 -1
  5. package/dist/ui/assets/{anthropic-DuyYNsVy.js → anthropic-Cbkrj7k9.js} +1 -1
  6. package/dist/ui/assets/{anthropic-DVg1WB3P.js → anthropic-D1V8pxg7.js} +1 -1
  7. package/dist/ui/assets/{apps-D4QHJqIo.js → apps-CuaCSoBe.js} +1 -1
  8. package/dist/ui/assets/{azure-openai-BBwxYCqK.js → azure-openai-CCOKUAwC.js} +1 -1
  9. package/dist/ui/assets/{azure-openai-responses-U_OhjIft.js → azure-openai-responses-DeRhIoo6.js} +1 -1
  10. package/dist/ui/assets/{azure-openai-responses-1KMjp9lB.js → azure-openai-responses-hLVWkPjN.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-CCocZQqr.js → azure-openai-x92wGBBW.js} +1 -1
  12. package/dist/ui/assets/{biome_wasm-CW46ywCD.js → biome_wasm-CAmr5bJX.js} +1 -1
  13. package/dist/ui/assets/{bsh-watchdog-DjxcEQC3.js → bsh-watchdog-CRvtcjnR.js} +1 -1
  14. package/dist/ui/assets/{cdp-BYJmkq3Z.js → cdp-DUSqoAuA.js} +3 -3
  15. package/dist/ui/assets/{cdp-ws-page-bridge-6V6vk0DI.js → cdp-ws-page-bridge-Bos1MJQ8.js} +1 -1
  16. package/dist/ui/assets/{common-BYdyBvXA.js → common-DSKIOrjd.js} +1 -1
  17. package/dist/ui/assets/cost-command-u9h70T2D.js +1 -0
  18. package/dist/ui/assets/{es-BHP3e8lV.js → es-CYeQ7jng.js} +1 -1
  19. package/dist/ui/assets/{follower-sprinkle-bridge-FDnGzaUj.js → follower-sprinkle-bridge-DMG_bDDo.js} +1 -1
  20. package/dist/ui/assets/{github-DDaiVse9.js → github-Bap5HVe5.js} +1 -1
  21. package/dist/ui/assets/{github-copilot-BXb0hqex.js → github-copilot-B3v-d9JH.js} +1 -1
  22. package/dist/ui/assets/{github-copilot-6mF9XfuS.js → github-copilot-BjYfuiWF.js} +2 -2
  23. package/dist/ui/assets/{github-D9sn99MA.js → github-lA2JkZnR.js} +2 -2
  24. package/dist/ui/assets/{google-CBf6hEVr.js → google-BjAhlOIW.js} +1 -1
  25. package/dist/ui/assets/{google-BxN-4hiG.js → google-D54V8iXU.js} +1 -1
  26. package/dist/ui/assets/{google-shared-B4aYlVPY.js → google-shared-DmMRk9Cv.js} +1 -1
  27. package/dist/ui/assets/{google-shared-SOpeE19C.js → google-shared-e3u9gqCl.js} +1 -1
  28. package/dist/ui/assets/{google-vertex-BV9T7ZAt.js → google-vertex-CLc27EVn.js} +1 -1
  29. package/dist/ui/assets/{google-vertex-BWfTxcsR.js → google-vertex-Cv9VNCWC.js} +1 -1
  30. package/dist/ui/assets/{intercepted-oauth-C7d7QQVI.js → intercepted-oauth-DZHe-Tai.js} +1 -1
  31. package/dist/ui/assets/{kernel-worker-CyCJs40A.js → kernel-worker-BIUPWm8O.js} +228 -228
  32. package/dist/ui/assets/{lick-ws-bridge-CB_xyzpN.js → lick-ws-bridge-26T9mMJM.js} +1 -1
  33. package/dist/ui/assets/{local-llm-DA2-MaH8.js → local-llm-97m0E6NM.js} +1 -1
  34. package/dist/ui/assets/{magick-wasm-DZd7eWMi.js → magick-wasm-CymoKvi4.js} +1 -1
  35. package/dist/ui/assets/{main-BJ2uTMm6.js → main-DpUosXL9.js} +125 -125
  36. package/dist/ui/assets/{mistral-e9m8_s5P.js → mistral-BcLzQwyi.js} +1 -1
  37. package/dist/ui/assets/{mistral-W4QJJdzV.js → mistral-D2e_VrJK.js} +1 -1
  38. package/dist/ui/assets/{nodejs-5irR1LHy.js → nodejs-CV0Ynarx.js} +1 -1
  39. package/dist/ui/assets/{nuke-command-CVzJkwfv.js → nuke-command-BcBJRlex.js} +1 -1
  40. package/dist/ui/assets/{oauth-3qcxsbc2.js → oauth-C0Y7C5K-.js} +1 -1
  41. package/dist/ui/assets/{oauth-bootstrap-Brizx1sU.js → oauth-bootstrap-BtrpF6Wz.js} +2 -2
  42. package/dist/ui/assets/{oauth-service-DzqMSub-.js → oauth-service-B78p149M.js} +1 -1
  43. package/dist/ui/assets/oauth-service-oyjp7YXN.js +1 -0
  44. package/dist/ui/assets/{offscreen-client-5busJoPt.js → offscreen-client-2Z2A7hpb.js} +1 -1
  45. package/dist/ui/assets/{onboarding-orchestrator-C91Mlf5j.js → onboarding-orchestrator-DpekEY6A.js} +1 -1
  46. package/dist/ui/assets/{openai-codex--Yp7-7Z5.js → openai-codex-CrO2cZ20.js} +1 -1
  47. package/dist/ui/assets/{openai-codex-C-AjuizZ.js → openai-codex-D4neICy1.js} +1 -1
  48. package/dist/ui/assets/{openai-codex-responses-Bm_0qhvH.js → openai-codex-responses-BQlIkzRV.js} +1 -1
  49. package/dist/ui/assets/{openai-codex-responses-W4HAflF-.js → openai-codex-responses-D1e_lQpN.js} +1 -1
  50. package/dist/ui/assets/{openai-completions-Cw8_L8Xr.js → openai-completions-DqLOpM4D.js} +1 -1
  51. package/dist/ui/assets/{openai-responses-D3iDP_oI.js → openai-responses-7jJnF-86.js} +1 -1
  52. package/dist/ui/assets/{openai-responses-ZzUTala8.js → openai-responses-CjbVaJOT.js} +1 -1
  53. package/dist/ui/assets/{openai-responses-shared-BX6tnqpi.js → openai-responses-shared-DkG0maXW.js} +1 -1
  54. package/dist/ui/assets/{openai-responses-shared-DYLu2Zp0.js → openai-responses-shared-gss6qxsV.js} +1 -1
  55. package/dist/ui/assets/{openrouter-BzZrnZGs.js → openrouter-BF7VnByE.js} +1 -1
  56. package/dist/ui/assets/{openrouter-jEmgHPS4.js → openrouter-CD-hMqk2.js} +1 -1
  57. package/dist/ui/assets/{panel-rpc-handlers-D5gl8OCN.js → panel-rpc-handlers-CTrw3gqi.js} +1 -1
  58. package/dist/ui/assets/{provider-Cr5grONL.js → provider-B0hmGmdj.js} +2 -2
  59. package/dist/ui/assets/{provider-C-jyIoxd.js → provider-Cm0gm8WS.js} +1 -1
  60. package/dist/ui/assets/provider-store-access-5LUvoScx.js +1 -0
  61. package/dist/ui/assets/provider-store-access-CLxyw1z5.js +1 -0
  62. package/dist/ui/assets/{proxied-fetch-BfAfPAb8.js → proxied-fetch-W2ZQXDjh.js} +1 -1
  63. package/dist/ui/assets/{pyodide-wtFIlZhs.js → pyodide-nMKeqf-Z.js} +2 -2
  64. package/dist/ui/assets/{remote-terminal-view-TV-7yccw.js → remote-terminal-view-B2yz9FyW.js} +1 -1
  65. package/dist/ui/assets/{secret-env-ATAFK-l7.js → secret-env-tRUiF-ct.js} +1 -1
  66. package/dist/ui/assets/{slicc-editor--10xc_r8.js → slicc-editor-PqVgtH5A.js} +1 -1
  67. package/dist/ui/assets/{spawn-DUGV5yTf.js → spawn-DduGL1YU.js} +1 -1
  68. package/dist/ui/assets/{sql-wasm-D-F3Sver.js → sql-wasm-BvTPJiAa.js} +1 -1
  69. package/dist/ui/assets/{store-UGcMsrpW.js → store-DfqtQzoR.js} +1 -1
  70. package/dist/ui/assets/{tray-leave-runtime-C1SGBu3D.js → tray-leave-runtime-Ce9r1HLQ.js} +1 -1
  71. package/dist/ui/assets/{typescript-VVTdKuA_.js → typescript-A2fHgRZe.js} +1 -1
  72. package/dist/ui/assets/{upgrade-detection-DC3-8klG.js → upgrade-detection-G-uMGJkr.js} +1 -1
  73. package/dist/ui/assets/{web-Dg3d8ZUx.js → web-DcH-XRmI.js} +1 -1
  74. package/dist/ui/assets/{ws-subscribers-CwfxO1ZU.js → ws-subscribers-CW2YEara.js} +1 -1
  75. package/dist/ui/assets/{xai-grok-B-1r34dF.js → xai-grok-BXx314lE.js} +1 -1
  76. package/dist/ui/assets/{xai-grok-qazFMvH6.js → xai-grok-CQOzP3D5.js} +1 -1
  77. package/dist/ui/index.html +1 -1
  78. package/dist/ui/packages/webapp/index.html +1 -1
  79. package/package.json +1 -1
  80. package/dist/ui/assets/adobe-X0NFxs5L.js +0 -2
  81. package/dist/ui/assets/adobe-uKGa5Psy.js +0 -1
  82. package/dist/ui/assets/cost-command-JHIeIZ1F.js +0 -1
  83. package/dist/ui/assets/oauth-service-BMa6Ij6L.js +0 -1
  84. package/dist/ui/assets/provider-store-access-BYWbG4Fv.js +0 -1
  85. package/dist/ui/assets/provider-store-access-BylhffW_.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-BJ2uTMm6.js","assets/modulepreload-polyfill-Dezn_h7o.js","assets/main-CvlDeETm.css"])))=>i.map(i=>d[i]);
2
- import{E as e,O as t,et as n,g as r,h as i,u as a}from"./main-BJ2uTMm6.js";import{getOAuthPageOrigin as o}from"./oauth-service-DzqMSub-.js";import{t as s}from"./global-db-CbuLl-zx.js";var c={clientId:``,scopes:`repo,read:user,user:email`};function l(){try{let e=localStorage.getItem(t);if(e)return e.replace(/\/$/,``)}catch{}return e}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;async function h(){if(p)return p;if(g){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 g=typeof chrome<`u`&&!!chrome?.runtime?.id;function _(){return a().find(e=>e.providerId===`github`)}function v(e){try{return new URL(e).searchParams.get(`code`)}catch{return null}}async function y(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 b(e,t){return`${e}+${t}@users.noreply.github.com`}async function x(e){try{let{VirtualFS:t}=await n(async()=>{let{VirtualFS:e}=await import(`./main-BJ2uTMm6.js`).then(e=>e.i);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 S(){try{let{VirtualFS:e}=await n(async()=>{let{VirtualFS:e}=await import(`./main-BJ2uTMm6.js`).then(e=>e.i);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 C(e){if(!(!e.login||e.id===void 0))try{let{VirtualFS:t}=await n(async()=>{let{VirtualFS:e}=await import(`./main-BJ2uTMm6.js`).then(e=>e.i);return{VirtualFS:e}},__vite__mapDeps([0,1,2])),{readGlobalGitConfigValue:r,writeGlobalGitConfigValue:i}=await n(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=b(e.id,e.login);!await r(a,`user.name`)&&o&&await i(a,`user.name`,o),await r(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 w(){let e=_();if(!e?.accessToken)throw Error(`Not logged in to GitHub — please log in first`);return e.accessToken}var T={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,n)=>{let a=await h();if(!a)throw Error(`GitHub OAuth not configured — no client ID available`);let s=n?.scopes??f.scopes,c=g?null:await o(),d=g?`${l()}/auth/callback`:`${m??c.origin}/auth/callback`,p=crypto.randomUUID(),_=g?chrome.runtime.id:``,b=g?{source:`extension`,extensionId:_,path:`/github`,nonce:p}:{port:parseInt(new URL(c.href).port||`5710`,10),path:`/auth/callback`,nonce:p},w=btoa(JSON.stringify(b)),T=p,E=new URLSearchParams({client_id:a,scope:s,redirect_uri:d});w&&E.set(`state`,w);let D=await e(`https://github.com/login/oauth/authorize?${E}`);if(!D)return;if(T)try{if(new URL(D).searchParams.get(`nonce`)!==T){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 O=v(D);if(!O){console.error(`[github] Could not extract authorization code from redirect URL`);return}let k=await u({provider:`github`,code:O,redirectUri:d}),A=await y(k.access_token);await r({providerId:`github`,accessToken:k.access_token,userName:A.name,userAvatar:A.avatar});let j=i(`github`)?.maskedValue;j?await x(j):await S(),await C(A),t()},onOAuthLogout:async()=>{let e=_();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 S(),await r({providerId:`github`,accessToken:``})}};export{b as buildNoreplyEmail,T as config,v as extractCodeFromUrl,w as getValidAccessToken,C as syncGitIdentityFromGitHub};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-DpUosXL9.js","assets/modulepreload-polyfill-Dezn_h7o.js","assets/main-CvlDeETm.css"])))=>i.map(i=>d[i]);
2
+ import{E as e,O as t,et as n,g as r,h as i,u as a}from"./main-DpUosXL9.js";import{getOAuthPageOrigin as o}from"./oauth-service-B78p149M.js";import{t as s}from"./global-db-CbuLl-zx.js";var c={clientId:``,scopes:`repo,read:user,user:email`};function l(){try{let e=localStorage.getItem(t);if(e)return e.replace(/\/$/,``)}catch{}return e}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;async function h(){if(p)return p;if(g){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 g=typeof chrome<`u`&&!!chrome?.runtime?.id;function _(){return a().find(e=>e.providerId===`github`)}function v(e){try{return new URL(e).searchParams.get(`code`)}catch{return null}}async function y(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 b(e,t){return`${e}+${t}@users.noreply.github.com`}async function x(e){try{let{VirtualFS:t}=await n(async()=>{let{VirtualFS:e}=await import(`./main-DpUosXL9.js`).then(e=>e.i);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 S(){try{let{VirtualFS:e}=await n(async()=>{let{VirtualFS:e}=await import(`./main-DpUosXL9.js`).then(e=>e.i);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 C(e){if(!(!e.login||e.id===void 0))try{let{VirtualFS:t}=await n(async()=>{let{VirtualFS:e}=await import(`./main-DpUosXL9.js`).then(e=>e.i);return{VirtualFS:e}},__vite__mapDeps([0,1,2])),{readGlobalGitConfigValue:r,writeGlobalGitConfigValue:i}=await n(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=b(e.id,e.login);!await r(a,`user.name`)&&o&&await i(a,`user.name`,o),await r(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 w(){let e=_();if(!e?.accessToken)throw Error(`Not logged in to GitHub — please log in first`);return e.accessToken}var T={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,n)=>{let a=await h();if(!a)throw Error(`GitHub OAuth not configured — no client ID available`);let s=n?.scopes??f.scopes,c=g?null:await o(),d=g?`${l()}/auth/callback`:`${m??c.origin}/auth/callback`,p=crypto.randomUUID(),_=g?chrome.runtime.id:``,b=g?{source:`extension`,extensionId:_,path:`/github`,nonce:p}:{port:parseInt(new URL(c.href).port||`5710`,10),path:`/auth/callback`,nonce:p},w=btoa(JSON.stringify(b)),T=p,E=new URLSearchParams({client_id:a,scope:s,redirect_uri:d});w&&E.set(`state`,w);let D=await e(`https://github.com/login/oauth/authorize?${E}`);if(!D)return;if(T)try{if(new URL(D).searchParams.get(`nonce`)!==T){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 O=v(D);if(!O){console.error(`[github] Could not extract authorization code from redirect URL`);return}let k=await u({provider:`github`,code:O,redirectUri:d}),A=await y(k.access_token);await r({providerId:`github`,accessToken:k.access_token,userName:A.name,userAvatar:A.avatar});let j=i(`github`)?.maskedValue;j?await x(j):await S(),await C(A),t()},onOAuthLogout:async()=>{let e=_();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 S(),await r({providerId:`github`,accessToken:``})},getOAuthLogoutUrl:e=>`https://github.com/logout`};export{b as buildNoreplyEmail,T as config,v as extractCodeFromUrl,w as getValidAccessToken,C as syncGitIdentityFromGitHub};
@@ -1 +1 @@
1
- import{B as e,H as t,U as n,b as r,o as i,q as a}from"./kernel-worker-CyCJs40A.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-SOpeE19C.js";let p=0;const m=(n,r,i)=>{let o=new e;return(async()=>{let e={role:`assistant`,content:[],api:`google-generative-ai`,provider:n.provider,model:n.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(n,i?.apiKey||a(n.provider)||``,i?.headers),d=_(n,r,i),f=await i?.onPayload?.(d,n);f!==void 0&&(d=f);let m=await c.models.generateContentStream(d);o.push({type:`start`,partial:e});let h=null,v=e.content,y=()=>v.length-1;for await(let r of m){e.responseId||=r.responseId;let i=r.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=u(t);(!h||n&&h.type!==`thinking`||!n&&h.type!==`text`)&&(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:v.length-1,content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e})),n?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:e})):(h={type:`text`,text:``},e.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:e}))),h.type===`thinking`?(h.thinking+=t.text,h.thinkingSignature=l(h.thinkingSignature,t.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:t.text,partial:e})):(h.text+=t.text,h.textSignature=l(h.textSignature,t.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:t.text,partial:e}))}if(t.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e}),null);let n=t.functionCall.id,r={type:`toolCall`,id:!n||e.content.some(e=>e.type===`toolCall`&&e.id===n)?`${t.functionCall.name}_${Date.now()}_${++p}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),o.push({type:`toolcall_start`,contentIndex:y(),partial:e}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(r.arguments),partial:e}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:r,partial:e})}}i?.finishReason&&(e.stopReason=s(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&(e.stopReason=`toolUse`)),r.usageMetadata&&(e.usage={input:(r.usageMetadata.promptTokenCount||0)-(r.usageMetadata.cachedContentTokenCount||0),output:(r.usageMetadata.candidatesTokenCount||0)+(r.usageMetadata.thoughtsTokenCount||0),cacheRead:r.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:r.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},t(n,e.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e})),i?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`aborted`||e.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:e.stopReason,message:e}),o.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=i?.signal?.aborted?`aborted`:`error`,e.errorMessage=t instanceof Error?t.message:JSON.stringify(t),o.push({type:`error`,reason:e.stopReason,error:e}),o.end()}})(),o},h=(e,t,i)=>{let o=i?.apiKey||a(e.provider);if(!o)throw Error(`No API key for provider: ${e.provider}`);let s=r(e,i,o);if(!i?.reasoning)return m(e,t,{...s,thinking:{enabled:!1}});let c=n(e,i.reasoning),l=c===`off`?`high`:c,u=e;return y(u)||b(u)||v(u)?m(e,t,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(e,t,{...s,thinking:{enabled:!0,budgetTokens:C(u,l,i.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),a={};n.temperature!==void 0&&(a.temperature=n.temperature),n.maxTokens!==void 0&&(a.maxOutputTokens=n.maxTokens);let s={...Object.keys(a).length>0&&a,...t.systemPrompt&&{systemInstruction:i(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:c(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?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{B as e,H as t,U as n,b as r,o as i,q as a}from"./kernel-worker-BIUPWm8O.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-e3u9gqCl.js";let p=0;const m=(n,r,i)=>{let o=new e;return(async()=>{let e={role:`assistant`,content:[],api:`google-generative-ai`,provider:n.provider,model:n.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(n,i?.apiKey||a(n.provider)||``,i?.headers),d=_(n,r,i),f=await i?.onPayload?.(d,n);f!==void 0&&(d=f);let m=await c.models.generateContentStream(d);o.push({type:`start`,partial:e});let h=null,v=e.content,y=()=>v.length-1;for await(let r of m){e.responseId||=r.responseId;let i=r.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=u(t);(!h||n&&h.type!==`thinking`||!n&&h.type!==`text`)&&(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:v.length-1,content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e})),n?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:e})):(h={type:`text`,text:``},e.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:e}))),h.type===`thinking`?(h.thinking+=t.text,h.thinkingSignature=l(h.thinkingSignature,t.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:y(),delta:t.text,partial:e})):(h.text+=t.text,h.textSignature=l(h.textSignature,t.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:t.text,partial:e}))}if(t.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e}),null);let n=t.functionCall.id,r={type:`toolCall`,id:!n||e.content.some(e=>e.type===`toolCall`&&e.id===n)?`${t.functionCall.name}_${Date.now()}_${++p}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),o.push({type:`toolcall_start`,contentIndex:y(),partial:e}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(r.arguments),partial:e}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:r,partial:e})}}i?.finishReason&&(e.stopReason=s(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&(e.stopReason=`toolUse`)),r.usageMetadata&&(e.usage={input:(r.usageMetadata.promptTokenCount||0)-(r.usageMetadata.cachedContentTokenCount||0),output:(r.usageMetadata.candidatesTokenCount||0)+(r.usageMetadata.thoughtsTokenCount||0),cacheRead:r.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:r.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},t(n,e.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:e}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:e})),i?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`aborted`||e.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:e.stopReason,message:e}),o.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=i?.signal?.aborted?`aborted`:`error`,e.errorMessage=t instanceof Error?t.message:JSON.stringify(t),o.push({type:`error`,reason:e.stopReason,error:e}),o.end()}})(),o},h=(e,t,i)=>{let o=i?.apiKey||a(e.provider);if(!o)throw Error(`No API key for provider: ${e.provider}`);let s=r(e,i,o);if(!i?.reasoning)return m(e,t,{...s,thinking:{enabled:!1}});let c=n(e,i.reasoning),l=c===`off`?`high`:c,u=e;return y(u)||b(u)||v(u)?m(e,t,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(e,t,{...s,thinking:{enabled:!0,budgetTokens:C(u,l,i.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),a={};n.temperature!==void 0&&(a.temperature=n.temperature),n.maxTokens!==void 0&&(a.maxOutputTokens=n.maxTokens);let s={...Object.keys(a).length>0&&a,...t.systemPrompt&&{systemInstruction:i(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:c(t.tools)}};if(t.tools&&t.tools.length>0&&n.toolChoice?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{G as e,K as t,U as n,X as r,b as i}from"./main-BJ2uTMm6.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-B4aYlVPY.js";var p=0,m=(t,i,a)=>{let o=new n;return(async()=>{let n={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||r(t.provider)||``,a?.headers),d=_(t,i,a),f=await a?.onPayload?.(d,t);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}},e(t,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=(e,n,a)=>{let o=a?.apiKey||r(e.provider);if(!o)throw Error(`No API key for provider: ${e.provider}`);let s=i(e,a,o);if(!a?.reasoning)return m(e,n,{...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,n,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(e,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{G as e,K as t,U as n,X as r,b as i}from"./main-DpUosXL9.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-DmMRk9Cv.js";var p=0,m=(t,i,a)=>{let o=new n;return(async()=>{let n={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||r(t.provider)||``,a?.headers),d=_(t,i,a),f=await a?.onPayload?.(d,t);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}},e(t,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=(e,n,a)=>{let o=a?.apiKey||r(e.provider);if(!o)throw Error(`No API key for provider: ${e.provider}`);let s=i(e,a,o);if(!a?.reasoning)return m(e,n,{...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,n,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(e,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};