sliccy 3.2.1 → 3.2.3
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.
- package/README.md +1 -0
- package/dist/ui/assets/{adobe-nI2lXFZS.js → adobe-C6L-KqM8.js} +2 -2
- package/dist/ui/assets/adobe-QN2CGEuK.js +1 -0
- package/dist/ui/assets/{agent-bridge-BOSnTfFR.js → agent-bridge-C3yTqUsW.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-DWcpzWsT.js → agent-message-to-chat-DA9jQnkg.js} +1 -1
- package/dist/ui/assets/{anthropic-DSZwm6Il.js → anthropic-Iifm_Ljc.js} +2 -2
- package/dist/ui/assets/{anthropic-Dr7XjLnI.js → anthropic-vLH5Wqs1.js} +2 -2
- package/dist/ui/assets/{azure-openai-B0c3bdmX.js → azure-openai-Dul8yrdC.js} +1 -1
- package/dist/ui/assets/{azure-openai-Sl6IRfiF.js → azure-openai-E3Wl5zJa.js} +1 -1
- package/dist/ui/assets/{azure-openai-responses-DlELGil5.js → azure-openai-responses-Bv_GxAPf.js} +1 -1
- package/dist/ui/assets/{azure-openai-responses-CyInI5pN.js → azure-openai-responses-v6_djoy0.js} +1 -1
- package/dist/ui/assets/{bsh-watchdog-COpOvHJO.js → bsh-watchdog-S8D_8Nfa.js} +1 -1
- package/dist/ui/assets/{cdp-aFMV5D5H.js → cdp-Dov9DJkT.js} +4 -4
- package/dist/ui/assets/cost-command-yt4lKOdD.js +1 -0
- package/dist/ui/assets/{es-Fg9CJu2a.js → es-BCrJzVim.js} +5 -5
- package/dist/ui/assets/{follower-sprinkle-bridge-DhazpaQ4.js → follower-sprinkle-bridge-B3x8kxZm.js} +1 -1
- package/dist/ui/assets/{github-B6QNU-3A.js → github-BwW6n9oL.js} +2 -2
- package/dist/ui/assets/{github-sM7l0VoL.js → github-CGR7VRwT.js} +1 -1
- package/dist/ui/assets/{google-D6c_sIut.js → google-C-gvkOTh.js} +1 -1
- package/dist/ui/assets/google-CajcZ91f.js +1 -0
- package/dist/ui/assets/{google-shared-BulFztPz.js → google-shared-CZf2rVDo.js} +1 -1
- package/dist/ui/assets/{google-shared-DhHenZn9.js → google-shared-D_dLvQOv.js} +1 -1
- package/dist/ui/assets/{google-vertex-Bagm5hdl.js → google-vertex-DjRs7IYH.js} +1 -1
- package/dist/ui/assets/{google-vertex-B1MO0HYD.js → google-vertex-ROGH_e7C.js} +1 -1
- package/dist/ui/assets/{index-CVQ53vhp.js → index-C4gHNw6L.js} +164 -164
- package/dist/ui/assets/intercepted-oauth-BRuy2Kfs.js +1 -0
- package/dist/ui/assets/{kernel-worker-DXnVtalJ.js → kernel-worker-DD8Usyxx.js} +727 -716
- package/dist/ui/assets/lick-manager-proxy-BnnMFbgv.js +1 -0
- package/dist/ui/assets/lick-ws-bridge-ZB_XB9cZ.js +1 -0
- package/dist/ui/assets/{local-llm-D75Fgjs0.js → local-llm-EzEzei9O.js} +2 -2
- package/dist/ui/assets/{magick-wasm-2lkhWhgt.js → magick-wasm-27-2_Eho.js} +1 -1
- package/dist/ui/assets/{mistral-BlIxxwbs.js → mistral-D8AzlZW_.js} +2 -2
- package/dist/ui/assets/{mistral-BRR29uMI.js → mistral-DLpWJDUH.js} +2 -2
- package/dist/ui/assets/{nuke-command-DTqz_Ptx.js → nuke-command-DDKQSsN7.js} +1 -1
- package/dist/ui/assets/{oauth-bootstrap-BVwa_nfZ.js → oauth-bootstrap-BEREFAjD.js} +1 -1
- package/dist/ui/assets/{oauth-service-DqXJQYDI.js → oauth-service-CHW2vtTw.js} +1 -1
- package/dist/ui/assets/{oauth-service-DPEJn1wm.js → oauth-service-oUFpJ_KO.js} +1 -1
- package/dist/ui/assets/{offscreen-client-CRpw9tqj.js → offscreen-client-D1PbNub7.js} +1 -1
- package/dist/ui/assets/{onboarding-orchestrator-lQP1nZ0U.js → onboarding-orchestrator-B82tihZv.js} +1 -1
- package/dist/ui/assets/{openai-codex-responses-_IImRqdn.js → openai-codex-responses-C3po1AZV.js} +5 -5
- package/dist/ui/assets/{openai-codex-responses-Dc1_JfHA.js → openai-codex-responses-DKXkHpcT.js} +5 -5
- package/dist/ui/assets/{openai-completions-Btrw7eXb.js → openai-completions-B8rB17k5.js} +2 -2
- package/dist/ui/assets/{openai-responses-JZsTLlZ6.js → openai-responses-C0p9Yysz.js} +1 -1
- package/dist/ui/assets/openai-responses-D0Pv1V2J.js +1 -0
- package/dist/ui/assets/{openai-responses-shared-C6-6OmQ7.js → openai-responses-shared-BHD4dY5m.js} +4 -4
- package/dist/ui/assets/{openai-responses-shared-QJEgheLX.js → openai-responses-shared-tMsFRUiy.js} +4 -4
- package/dist/ui/assets/panel-rpc-handlers-zcYFQzD1.js +1 -0
- package/dist/ui/assets/{pyodide-C5AaR78M.js → pyodide-DgAqpC8i.js} +2 -2
- package/dist/ui/assets/{remote-terminal-view-C7kjPBGc.js → remote-terminal-view-J9J7pk1H.js} +3 -3
- package/dist/ui/assets/{secret-env-BREbgKZt.js → secret-env--0BcYjEq.js} +1 -1
- package/dist/ui/assets/{slicc-editor-D8qyzAmK.js → slicc-editor-BzGs3P5h.js} +1 -1
- package/dist/ui/assets/{spawn-DDHiq6QX.js → spawn-KTT1KFUY.js} +1 -1
- package/dist/ui/assets/{sql-wasm-C4rwSbnn.js → sql-wasm-BgLnn2vi.js} +2 -2
- package/dist/ui/assets/tray-leave-runtime-B-6PC-Ne.js +1 -0
- package/dist/ui/assets/{upgrade-detection-ARQ7pi6W.js → upgrade-detection-CKnfP1Ro.js} +1 -1
- package/dist/ui/assets/{xai-grok-dQuvw1db.js → xai-grok-Bs1PPsw-.js} +1 -1
- package/dist/ui/assets/{xai-grok-CJqWJw1A.js → xai-grok-D-OPqtYg.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/packages/webapp/index.html +1 -1
- package/package.json +3 -3
- package/dist/ui/assets/adobe-CIhJaB8m.js +0 -1
- package/dist/ui/assets/cost-command-CAuxDd3O.js +0 -1
- package/dist/ui/assets/google-CnlnlpZP.js +0 -1
- package/dist/ui/assets/intercepted-oauth-CLysites.js +0 -1
- package/dist/ui/assets/lick-manager-proxy-DfectiMI.js +0 -1
- package/dist/ui/assets/openai-responses-C_hKR-4u.js +0 -1
- package/dist/ui/assets/panel-rpc-handlers-Daa9NEEL.js +0 -1
- /package/dist/ui/assets/{sprinkle-bridge-channel-BBxRgvga.js → sprinkle-bridge-channel-DojIojh7.js} +0 -0
package/dist/ui/assets/{follower-sprinkle-bridge-DhazpaQ4.js → follower-sprinkle-bridge-B3x8kxZm.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-C4gHNw6L.js";var t=15e3,n=class{sender;listeners;pending=new Map;unsubscribe;fetchTimeoutMs;nextId=1;disposed=!1;constructor(n,r,i={},a={}){this.sender=n,this.listeners=i,this.fetchTimeoutMs=a.fetchTimeoutMs??t,this.unsubscribe=r.onMessage(t=>{if(t.source!==`offscreen`)return;let n=e(t.payload,`follower-sprinkles-list`);if(n){this.listeners.onSprinklesList?.(n.sprinkles);return}let r=e(t.payload,`follower-sprinkle-update`);if(r){this.listeners.onSprinkleUpdate?.(r.sprinkleName,r.data);return}let i=e(t.payload,`follower-sprinkle-fetch-result`);if(i){let e=this.pending.get(i.id);if(!e)return;clearTimeout(e.timer),this.pending.delete(i.id),i.ok===!0?e.resolve(i.content):i.ok===!1?e.reject(Error(i.error)):e.reject(Error("Malformed follower-sprinkle-fetch-result: missing or non-boolean `ok`"))}})}fetchSprinkleContent(e){if(this.disposed)return Promise.reject(Error(`PanelFollowerSprinkleProxy disposed`));let t=`panel-${Date.now()}-${this.nextId++}`;return new Promise((n,r)=>{let i=setTimeout(()=>{this.pending.delete(t);let n={type:`follower-sprinkle-fetch-cancel`,sprinkleName:e};this.sender.send({source:`panel`,payload:n}),r(Error(`follower-sprinkle-fetch for "${e}" timed out after ${this.fetchTimeoutMs}ms — offscreen document may not be in follower mode`))},this.fetchTimeoutMs);this.pending.set(t,{resolve:n,reject:r,timer:i});let a={type:`follower-sprinkle-fetch`,id:t,sprinkleName:e};this.sender.send({source:`panel`,payload:a})})}cancelSprinkleFetch(e,t){}sendSprinkleLick(e,t,n){if(this.disposed)return;let r={type:`follower-sprinkle-lick`,sprinkleName:e,body:t,targetScoop:n};this.sender.send({source:`panel`,payload:r})}dispose(){if(this.disposed)return;this.disposed=!0,this.unsubscribe();let e=Error(`PanelFollowerSprinkleProxy disposed`);for(let t of this.pending.values())clearTimeout(t.timer),t.reject(e);this.pending.clear()}};export{n as PanelFollowerSprinkleProxy};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C4gHNw6L.js","assets/index-BeHZmqLr.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{C as e,L as t,P as n,U as r,W as i,f as a,j as o,p as s,s as c,x as l}from"./index-C4gHNw6L.js";import{getOAuthPageOrigin as u}from"./oauth-service-oUFpJ_KO.js";var d={clientId:``,scopes:`repo,read:user,user:email`};function f(){try{let t=localStorage.getItem(e);if(t)return t.replace(/\/$/,``)}catch{}return l}async function p(e){let t=`${f()}/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 m(e){let t=`${f()}/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 h=`slicc-fs-global`,g=Object.assign({"/packages/webapp/providers/github-config.json":d})[`/packages/webapp/providers/github-config.json`]??{clientId:``,scopes:`repo,read:user,user:email`},_=null,v=null;async function y(){if(_)return _;if(b){try{let e=await fetch(`${f()}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return _=t.oauth.github,_}}catch{}return g.clientId}try{let e=await fetch(`/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return _=t.oauth.github,_;if(t.trayWorkerBaseUrl){v=t.trayWorkerBaseUrl;let e=await fetch(`${t.trayWorkerBaseUrl}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return _=t.oauth.github,_}}}}catch{}return g.clientId}var b=typeof chrome<`u`&&!!chrome?.runtime?.id;function x(){return c().find(e=>e.providerId===`github`)}function S(e){try{return new URL(e).searchParams.get(`code`)}catch{return null}}async function C(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 w(e,t){return`${e}+${t}@users.noreply.github.com`}async function T(e){try{let{VirtualFS:t}=await i(async()=>{let{VirtualFS:e}=await import(`./index-C4gHNw6L.js`);return{VirtualFS:e}},__vite__mapDeps([0,1]));await(await t.create({dbName:h})).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 E(){try{let{VirtualFS:e}=await i(async()=>{let{VirtualFS:e}=await import(`./index-C4gHNw6L.js`);return{VirtualFS:e}},__vite__mapDeps([0,1]));await(await e.create({dbName:h})).rm(`/workspace/.git/github-token`),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch{}}async function D(e){if(!(!e.login||e.id===void 0))try{let{VirtualFS:t}=await i(async()=>{let{VirtualFS:e}=await import(`./index-C4gHNw6L.js`);return{VirtualFS:e}},__vite__mapDeps([0,1])),{readGlobalGitConfigValue:n,writeGlobalGitConfigValue:r}=await i(async()=>{let{readGlobalGitConfigValue:e,writeGlobalGitConfigValue:t}=await import(`./git-config-DFJqG7AS.js`);return{readGlobalGitConfigValue:e,writeGlobalGitConfigValue:t}},[]),a=await t.create({dbName:h}),o=e.name||e.login,s=w(e.id,e.login);!await n(a,`user.name`)&&o&&await r(a,`user.name`,o),await n(a,`user.email`)||await r(a,`user.email`,s)}catch(e){console.warn(`[github] Failed to seed git identity:`,e instanceof Error?e.message:String(e))}}async function O(){let e=x();if(!e?.accessToken)throw Error(`Not logged in to GitHub — please log in first`);return e.accessToken}var k=`https://models.github.ai/inference`,A=[{id:`openai/gpt-4.1`,name:`GPT-4.1`,api:`openai`,context_window:1047576,max_tokens:32768,reasoning:!1,input:[`text`,`image`]},{id:`openai/gpt-4.1-mini`,name:`GPT-4.1 mini`,api:`openai`,context_window:1047576,max_tokens:32768,reasoning:!1,input:[`text`,`image`]}];function j(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`github-openai`,provider:`github`,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:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}var M=(e,n,r={})=>{let i=t();return(async()=>{try{let t=await O(),a=o({...e,baseUrl:k,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},n,{...r,apiKey:t});for await(let e of a)i.push(e);i.end()}catch(t){console.error(`[github] Stream error:`,t instanceof Error?t.message:String(t)),i.push(j(e,t)),i.end()}})(),i},N=(e,r,i)=>{let a=t();return(async()=>{try{let t=await O(),o=n({...e,baseUrl:k,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},r,{...i,apiKey:t});for await(let e of o)a.push(e);a.end()}catch(t){console.error(`[github] Stream error:`,t instanceof Error?t.message:String(t)),a.push(j(e,t)),a.end()}})(),a},P={id:`github`,name:`GitHub`,description:`GitHub Models + git authentication — login with your GitHub account`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`gpt-4.1`,oauthTokenDomains:[`github.com`,`*.github.com`,`api.github.com`,`raw.githubusercontent.com`,`models.github.ai`],getModelIds:()=>A,onOAuthLogin:async(e,t,n)=>{let r=await y();if(!r)throw Error(`GitHub OAuth not configured — no client ID available`);let i=n?.scopes??g.scopes,o=b?null:await u(),c=b?`${f()}/auth/callback`:`${v??o.origin}/auth/callback`,l=crypto.randomUUID(),d=b?chrome.runtime.id:``,m=b?{source:`extension`,extensionId:d,path:`/github`,nonce:l}:{port:parseInt(new URL(o.href).port||`5710`,10),path:`/auth/callback`,nonce:l},h=btoa(JSON.stringify(m)),_=l,x=new URLSearchParams({client_id:r,scope:i,redirect_uri:c});h&&x.set(`state`,h);let w=await e(`https://github.com/login/oauth/authorize?${x}`);if(!w)return;if(_)try{if(new URL(w).searchParams.get(`nonce`)!==_){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=S(w);if(!O){console.error(`[github] Could not extract authorization code from redirect URL`);return}let k=await p({provider:`github`,code:O,redirectUri:c}),A=await C(k.access_token);await s({providerId:`github`,accessToken:k.access_token,userName:A.name,userAvatar:A.avatar});let j=a(`github`)?.maskedValue;j?await T(j):await E(),await D(A),t()},onOAuthLogout:async()=>{let e=x();e?.accessToken&&await m({provider:`github`,accessToken:e.accessToken}).catch(e=>console.warn(`[github] Token revocation failed:`,e instanceof Error?e.message:String(e))),await E(),await s({providerId:`github`,accessToken:``})}};function F(){r({api:`github-openai`,stream:M,streamSimple:N})}export{w as buildNoreplyEmail,P as config,S as extractCodeFromUrl,O as getValidAccessToken,F as register,D as syncGitIdentityFromGitHub};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{F as e,H as t,J as n,M as r,W as i,Y as a,_ as o,k as s,p as c,v as l}from"./kernel-worker-DD8Usyxx.js";import{getOAuthPageOrigin as u}from"./oauth-service-CHW2vtTw.js";var d={clientId:``,scopes:`repo,read:user,user:email`};function f(){try{let e=localStorage.getItem(a);if(e)return e.replace(/\/$/,``)}catch{}return n}async function p(e){let t=`${f()}/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 m(e){let t=`${f()}/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})`)}}const h=Object.assign({"/packages/webapp/providers/github-config.json":d})[`/packages/webapp/providers/github-config.json`]??{clientId:``,scopes:`repo,read:user,user:email`};let g=null,_=null;async function v(){if(g)return g;if(y){try{let e=await fetch(`${f()}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return g=t.oauth.github,g}}catch{}return h.clientId}try{let e=await fetch(`/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return g=t.oauth.github,g;if(t.trayWorkerBaseUrl){_=t.trayWorkerBaseUrl;let e=await fetch(`${t.trayWorkerBaseUrl}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return g=t.oauth.github,g}}}}catch{}return h.clientId}const y=typeof chrome<`u`&&!!chrome?.runtime?.id;function b(){return c().find(e=>e.providerId===`github`)}function x(e){try{return new URL(e).searchParams.get(`code`)}catch{return null}}async function S(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 C(e,t){return`${e}+${t}@users.noreply.github.com`}async function w(e){try{let{VirtualFS:t}=await import(`./kernel-worker-DD8Usyxx.js`);await(await t.create({dbName:i})).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 T(){try{let{VirtualFS:e}=await import(`./kernel-worker-DD8Usyxx.js`);await(await e.create({dbName:i})).rm(`/workspace/.git/github-token`),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch{}}async function E(e){if(!(!e.login||e.id===void 0))try{let{VirtualFS:t}=await import(`./kernel-worker-DD8Usyxx.js`),{readGlobalGitConfigValue:n,writeGlobalGitConfigValue:r}=await import(`./kernel-worker-DD8Usyxx.js`),a=await t.create({dbName:i}),o=e.name||e.login,s=C(e.id,e.login);!await n(a,`user.name`)&&o&&await r(a,`user.name`,o),await n(a,`user.email`)||await r(a,`user.email`,s)}catch(e){console.warn(`[github] Failed to seed git identity:`,e instanceof Error?e.message:String(e))}}async function D(){let e=b();if(!e?.accessToken)throw Error(`Not logged in to GitHub — please log in first`);return e.accessToken}const O=`https://models.github.ai/inference`,k=[{id:`openai/gpt-4.1`,name:`GPT-4.1`,api:`openai`,context_window:1047576,max_tokens:32768,reasoning:!1,input:[`text`,`image`]},{id:`openai/gpt-4.1-mini`,name:`GPT-4.1 mini`,api:`openai`,context_window:1047576,max_tokens:32768,reasoning:!1,input:[`text`,`image`]}];function A(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`github-openai`,provider:`github`,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:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}const j=(t,n,r={})=>{let i=e();return(async()=>{try{let e=await D(),a=s({...t,baseUrl:O,api:`openai-completions`,compat:{...t.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},n,{...r,apiKey:e});for await(let e of a)i.push(e);i.end()}catch(e){console.error(`[github] Stream error:`,e instanceof Error?e.message:String(e)),i.push(A(t,e)),i.end()}})(),i},M=(t,n,i)=>{let a=e();return(async()=>{try{let e=await D(),o=r({...t,baseUrl:O,api:`openai-completions`,compat:{...t.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},n,{...i,apiKey:e});for await(let e of o)a.push(e);a.end()}catch(e){console.error(`[github] Stream error:`,e instanceof Error?e.message:String(e)),a.push(A(t,e)),a.end()}})(),a},N={id:`github`,name:`GitHub`,description:`GitHub Models + git authentication — login with your GitHub account`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`gpt-4.1`,oauthTokenDomains:[`github.com`,`*.github.com`,`api.github.com`,`raw.githubusercontent.com`,`models.github.ai`],getModelIds:()=>k,onOAuthLogin:async(e,t,n)=>{let r=await v();if(!r)throw Error(`GitHub OAuth not configured — no client ID available`);let i=n?.scopes??h.scopes,a=y?null:await u(),s=y?`${f()}/auth/callback`:`${_??a.origin}/auth/callback`,c=crypto.randomUUID(),d=y?chrome.runtime.id:``,m=y?{source:`extension`,extensionId:d,path:`/github`,nonce:c}:{port:parseInt(new URL(a.href).port||`5710`,10),path:`/auth/callback`,nonce:c},g=btoa(JSON.stringify(m)),b=c,C=new URLSearchParams({client_id:r,scope:i,redirect_uri:s});g&&C.set(`state`,g);let D=await e(`https://github.com/login/oauth/authorize?${C}`);if(!D)return;if(b)try{if(new URL(D).searchParams.get(`nonce`)!==b){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=x(D);if(!O){console.error(`[github] Could not extract authorization code from redirect URL`);return}let k=await p({provider:`github`,code:O,redirectUri:s}),A=await S(k.access_token);await l({providerId:`github`,accessToken:k.access_token,userName:A.name,userAvatar:A.avatar});let j=o(`github`)?.maskedValue;j?await w(j):await T(),await E(A),t()},onOAuthLogout:async()=>{let e=b();e?.accessToken&&await m({provider:`github`,accessToken:e.accessToken}).catch(e=>console.warn(`[github] Token revocation failed:`,e instanceof Error?e.message:String(e))),await T(),await l({providerId:`github`,accessToken:``})}};function P(){t({api:`github-openai`,stream:j,streamSimple:M})}export{C as buildNoreplyEmail,N as config,x as extractCodeFromUrl,D as getValidAccessToken,P as register,E as syncGitIdentityFromGitHub};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{B as e,I as t,L as n,P as r,b as i,o as a}from"./kernel-worker-DD8Usyxx.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-D_dLvQOv.js";let p=0;const m=(n,i,a)=>{let o=new r;return(async()=>{let r={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,a?.apiKey||e(n.provider)||``,a?.headers),d=_(n,i,a),f=await a?.onPayload?.(d,n);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 e of m){r.responseId||=e.responseId;let i=e.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`)),e.usageMetadata&&(r.usage={input:(e.usageMetadata.promptTokenCount||0)-(e.usageMetadata.cachedContentTokenCount||0),output:(e.usageMetadata.candidatesTokenCount||0)+(e.usageMetadata.thoughtsTokenCount||0),cacheRead:e.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:e.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},t(n,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=(t,r,a)=>{let o=a?.apiKey||e(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,r,{...s,thinking:{enabled:!1}});let c=n(t,a.reasoning),l=c===`off`?`high`:c,u=t;return y(u)||b(u)||v(u)?m(t,r,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(t,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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as e,I as t,R as n,_ as r,z as i}from"./index-C4gHNw6L.js";import{t as a}from"./sanitize-unicode-h0KEBmEw.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-CZf2rVDo.js";var p=0,m=(r,i,a)=>{let o=new t;return(async()=>{let t={role:`assistant`,content:[],api:`google-generative-ai`,provider:r.provider,model:r.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(r,a?.apiKey||e(r.provider)||``,a?.headers),d=_(r,i,a),f=await a?.onPayload?.(d,r);f!==void 0&&(d=f);let m=await c.models.generateContentStream(d);o.push({type:`start`,partial:t});let h=null,v=t.content,y=()=>v.length-1;for await(let e of m){t.responseId||=e.responseId;let i=e.candidates?.[0];if(i?.content?.parts)for(let e of i.content.parts){if(e.text!==void 0){let n=u(e);(!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:t}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:t})),n?(h={type:`thinking`,thinking:``,thinkingSignature:void 0},t.content.push(h),o.push({type:`thinking_start`,contentIndex:y(),partial:t})):(h={type:`text`,text:``},t.content.push(h),o.push({type:`text_start`,contentIndex:y(),partial:t}))),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:t})):(h.text+=e.text,h.textSignature=l(h.textSignature,e.thoughtSignature),o.push({type:`text_delta`,contentIndex:y(),delta:e.text,partial:t}))}if(e.functionCall){h&&=(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:t}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:t}),null);let n=e.functionCall.id,r={type:`toolCall`,id:!n||t.content.some(e=>e.type===`toolCall`&&e.id===n)?`${e.functionCall.name}_${Date.now()}_${++p}`:n,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};t.content.push(r),o.push({type:`toolcall_start`,contentIndex:y(),partial:t}),o.push({type:`toolcall_delta`,contentIndex:y(),delta:JSON.stringify(r.arguments),partial:t}),o.push({type:`toolcall_end`,contentIndex:y(),toolCall:r,partial:t})}}i?.finishReason&&(t.stopReason=s(i.finishReason),t.content.some(e=>e.type===`toolCall`)&&(t.stopReason=`toolUse`)),e.usageMetadata&&(t.usage={input:(e.usageMetadata.promptTokenCount||0)-(e.usageMetadata.cachedContentTokenCount||0),output:(e.usageMetadata.candidatesTokenCount||0)+(e.usageMetadata.thoughtsTokenCount||0),cacheRead:e.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:e.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},n(r,t.usage))}if(h&&(h.type===`text`?o.push({type:`text_end`,contentIndex:y(),content:h.text,partial:t}):o.push({type:`thinking_end`,contentIndex:y(),content:h.thinking,partial:t})),a?.signal?.aborted)throw Error(`Request was aborted`);if(t.stopReason===`aborted`||t.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:t.stopReason,message:t}),o.end()}catch(e){for(let e of t.content)`index`in e&&delete e.index;t.stopReason=a?.signal?.aborted?`aborted`:`error`,t.errorMessage=e instanceof Error?e.message:JSON.stringify(e),o.push({type:`error`,reason:t.stopReason,error:t}),o.end()}})(),o},h=(t,n,a)=>{let o=a?.apiKey||e(t.provider);if(!o)throw Error(`No API key for provider: ${t.provider}`);let s=r(t,a,o);if(!a?.reasoning)return m(t,n,{...s,thinking:{enabled:!1}});let c=i(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};
|