sliccy 3.2.3 → 3.3.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.
- package/dist/ui/assets/{adobe-QN2CGEuK.js → adobe-BdCtqEqU.js} +1 -1
- package/dist/ui/assets/adobe-JQRe3bod.js +2 -0
- package/dist/ui/assets/{agent-bridge-C3yTqUsW.js → agent-bridge-BWE_pp9l.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-DA9jQnkg.js → agent-message-to-chat-BM6jzZ6n.js} +1 -1
- package/dist/ui/assets/{anthropic-Iifm_Ljc.js → anthropic-B7fNhak0.js} +4 -4
- package/dist/ui/assets/{anthropic-vLH5Wqs1.js → anthropic-aUxP169Q.js} +2 -2
- package/dist/ui/assets/apps-DWZCyXIN.js +27 -0
- package/dist/ui/assets/azure-openai-PfW3sU2b.js +1 -0
- package/dist/ui/assets/{azure-openai-Dul8yrdC.js → azure-openai-i66UDzXv.js} +1 -1
- package/dist/ui/assets/{azure-openai-responses-v6_djoy0.js → azure-openai-responses-BkGRRdAD.js} +1 -1
- package/dist/ui/assets/{azure-openai-responses-Bv_GxAPf.js → azure-openai-responses-D7UJrvli.js} +1 -1
- package/dist/ui/assets/{bsh-watchdog-S8D_8Nfa.js → bsh-watchdog-CionJQzX.js} +1 -1
- package/dist/ui/assets/{cdp-Dov9DJkT.js → cdp-Bi_ZZORW.js} +4 -4
- package/dist/ui/assets/cost-command-DU2TIEMo.js +1 -0
- package/dist/ui/assets/{es-BCrJzVim.js → es-D5fSLUeK.js} +5 -5
- package/dist/ui/assets/{follower-sprinkle-bridge-B3x8kxZm.js → follower-sprinkle-bridge-ClXxojMG.js} +1 -1
- package/dist/ui/assets/github-DvIH7nBH.js +2 -0
- package/dist/ui/assets/{github-CGR7VRwT.js → github-w_6fA7fI.js} +1 -1
- package/dist/ui/assets/global-db-B97_fwjD.js +1 -0
- package/dist/ui/assets/google-BR3KH-kW.js +1 -0
- package/dist/ui/assets/google-ckNp9qko.js +1 -0
- package/dist/ui/assets/{google-shared-CZf2rVDo.js → google-shared-BBm3X1gE.js} +1 -1
- package/dist/ui/assets/{google-shared-D_dLvQOv.js → google-shared-DVo3REsz.js} +3 -3
- package/dist/ui/assets/{google-vertex-DjRs7IYH.js → google-vertex-CvP5D3qn.js} +1 -1
- package/dist/ui/assets/{google-vertex-ROGH_e7C.js → google-vertex-DMNr4B05.js} +1 -1
- package/dist/ui/assets/index-DjZsBrmT.js +1574 -0
- package/dist/ui/assets/{intercepted-oauth-BRuy2Kfs.js → intercepted-oauth-DXYHEGEL.js} +1 -1
- package/dist/ui/assets/{kernel-worker-DD8Usyxx.js → kernel-worker-3eWlr-XP.js} +1043 -961
- package/dist/ui/assets/lick-ws-bridge-D8_HMPGU.js +1 -0
- package/dist/ui/assets/{local-llm-EzEzei9O.js → local-llm-MXMrQ9Qy.js} +2 -2
- package/dist/ui/assets/{magick-wasm-27-2_Eho.js → magick-wasm-D0TJQdQE.js} +1 -1
- package/dist/ui/assets/{mistral-D8AzlZW_.js → mistral-DTDNhiYb.js} +2 -2
- package/dist/ui/assets/{mistral-DLpWJDUH.js → mistral-hrlZ9Fvn.js} +2 -2
- package/dist/ui/assets/{nuke-command-DDKQSsN7.js → nuke-command-BLKb4RXp.js} +1 -1
- package/dist/ui/assets/oauth-Cedh7cQP.js +1 -0
- package/dist/ui/assets/oauth-bootstrap-DOpOUmX1.js +2 -0
- package/dist/ui/assets/{oauth-service-CHW2vtTw.js → oauth-service-BnWJPxHa.js} +1 -1
- package/dist/ui/assets/{oauth-service-oUFpJ_KO.js → oauth-service-L6LpBh52.js} +1 -1
- package/dist/ui/assets/{offscreen-client-D1PbNub7.js → offscreen-client-C6iYkH_v.js} +1 -1
- package/dist/ui/assets/{onboarding-orchestrator-B82tihZv.js → onboarding-orchestrator-gxtgdjmG.js} +1 -1
- package/dist/ui/assets/{openai-codex-responses-DKXkHpcT.js → openai-codex-responses-Ca8W_NiF.js} +2 -2
- package/dist/ui/assets/{openai-codex-responses-C3po1AZV.js → openai-codex-responses-Ct8QA5QT.js} +4 -4
- package/dist/ui/assets/{openai-completions-B8rB17k5.js → openai-completions-CLlXSPdb.js} +3 -3
- package/dist/ui/assets/{openai-responses-C0p9Yysz.js → openai-responses-BZ2RM91p.js} +1 -1
- package/dist/ui/assets/{openai-responses-D0Pv1V2J.js → openai-responses-CPOMk1dt.js} +1 -1
- package/dist/ui/assets/{openai-responses-shared-tMsFRUiy.js → openai-responses-shared-BWBDlq5C.js} +5 -5
- package/dist/ui/assets/{openai-responses-shared-BHD4dY5m.js → openai-responses-shared-pPqB4OJp.js} +1 -1
- package/dist/ui/assets/panel-rpc-handlers-CrrAIzUK.js +1 -0
- package/dist/ui/assets/provider-BvQcRKGs.js +1 -0
- package/dist/ui/assets/provider-DmtVgsFn.js +2 -0
- package/dist/ui/assets/provider-store-access-CNmZMEgu.js +1 -0
- package/dist/ui/assets/provider-store-access-CzxlROAo.js +1 -0
- package/dist/ui/assets/proxied-fetch-DktYWmJT.js +1 -0
- package/dist/ui/assets/{pyodide-DgAqpC8i.js → pyodide-V32Gh4TZ.js} +2 -2
- package/dist/ui/assets/{remote-terminal-view-J9J7pk1H.js → remote-terminal-view-DTwtF24a.js} +3 -3
- package/dist/ui/assets/{secret-env--0BcYjEq.js → secret-env-Ca6g9EJr.js} +1 -1
- package/dist/ui/assets/{slicc-editor-BzGs3P5h.js → slicc-editor-EjiRB92k.js} +1 -1
- package/dist/ui/assets/{spawn-KTT1KFUY.js → spawn-DP9_12yt.js} +1 -1
- package/dist/ui/assets/{sql-wasm-BgLnn2vi.js → sql-wasm-C33d0bG7.js} +2 -2
- package/dist/ui/assets/store-C0fTrWzc.js +1 -0
- package/dist/ui/assets/{tray-leave-runtime-B-6PC-Ne.js → tray-leave-runtime-CvLzwPJU.js} +1 -1
- package/dist/ui/assets/upgrade-detection-C7EfIRB6.js +1 -0
- package/dist/ui/assets/{xai-grok-Bs1PPsw-.js → xai-grok-BTgDW3MI.js} +1 -1
- package/dist/ui/assets/{xai-grok-D-OPqtYg.js → xai-grok-EEexU6rP.js} +1 -1
- package/dist/ui/assets/{xai-grok-sanitize-CiOn_xsO.js → xai-grok-sanitize-h_8XMTD9.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/packages/webapp/index.html +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/adobe-C6L-KqM8.js +0 -2
- package/dist/ui/assets/azure-openai-E3Wl5zJa.js +0 -1
- package/dist/ui/assets/cost-command-yt4lKOdD.js +0 -1
- package/dist/ui/assets/github-BwW6n9oL.js +0 -2
- package/dist/ui/assets/google-C-gvkOTh.js +0 -1
- package/dist/ui/assets/google-CajcZ91f.js +0 -1
- package/dist/ui/assets/index-C4gHNw6L.js +0 -1574
- package/dist/ui/assets/lick-ws-bridge-ZB_XB9cZ.js +0 -1
- package/dist/ui/assets/oauth-bootstrap-BEREFAjD.js +0 -1
- package/dist/ui/assets/panel-rpc-handlers-zcYFQzD1.js +0 -1
- package/dist/ui/assets/upgrade-detection-CKnfP1Ro.js +0 -1
- /package/dist/ui/assets/{active-transport-DeSPCdTV.js → active-transport-Dm6CWYVE.js} +0 -0
- /package/dist/ui/assets/{azure-ai-foundry-k_w7vD5C.js → azure-ai-foundry-BHLfY_0t.js} +0 -0
- /package/dist/ui/assets/{chat-fixture-BNN19l1e.js → chat-fixture-DOzffHLr.js} +0 -0
- /package/dist/ui/assets/{git-config-DFJqG7AS.js → git-config-CGMfR0WK.js} +0 -0
- /package/dist/ui/assets/{page-storage-sync-BxtXNbwY.js → page-storage-sync-CqMAh8jG.js} +0 -0
- /package/dist/ui/assets/{rum-wVO4iYd-.js → rum-DCU8sePD.js} +0 -0
- /package/dist/ui/assets/{sprinkle-bridge-channel-no1Jz9ii.js → sprinkle-bridge-channel-DJC5SGWr.js} +0 -0
- /package/dist/ui/assets/{xai-grok-errors-CGcnoVae.js → xai-grok-errors-Bzn3oNvW.js} +0 -0
- /package/dist/ui/assets/{xai-grok-models-0q2zveAT.js → xai-grok-models-DMYWtapT.js} +0 -0
package/dist/ui/assets/{follower-sprinkle-bridge-B3x8kxZm.js → follower-sprinkle-bridge-ClXxojMG.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-DjZsBrmT.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DjZsBrmT.js","assets/index-BeHZmqLr.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{D as e,F as t,J as n,R as r,T as i,V as a,g as o,h as s,q as c,u as l}from"./index-DjZsBrmT.js";import{getOAuthPageOrigin as u}from"./oauth-service-L6LpBh52.js";import{t as d}from"./global-db-B97_fwjD.js";var f={clientId:``,scopes:`repo,read:user,user:email`};function p(){try{let t=localStorage.getItem(e);if(t)return t.replace(/\/$/,``)}catch{}return i}async function m(e){let t=`${p()}/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 h(e){let t=`${p()}/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 g=Object.assign({"/packages/webapp/providers/github-config.json":f})[`/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(`${p()}/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 l().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 n(async()=>{let{VirtualFS:e}=await import(`./index-DjZsBrmT.js`);return{VirtualFS:e}},__vite__mapDeps([0,1]));await(await t.create({dbName:d})).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 n(async()=>{let{VirtualFS:e}=await import(`./index-DjZsBrmT.js`);return{VirtualFS:e}},__vite__mapDeps([0,1]));await(await e.create({dbName:d})).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 n(async()=>{let{VirtualFS:e}=await import(`./index-DjZsBrmT.js`);return{VirtualFS:e}},__vite__mapDeps([0,1])),{readGlobalGitConfigValue:r,writeGlobalGitConfigValue:i}=await n(async()=>{let{readGlobalGitConfigValue:e,writeGlobalGitConfigValue:t}=await import(`./git-config-CGMfR0WK.js`);return{readGlobalGitConfigValue:e,writeGlobalGitConfigValue:t}},[]),a=await t.create({dbName:d}),o=e.name||e.login,s=w(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`,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=a();return(async()=>{try{let a=await O(),o=t({...e,baseUrl:k,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},n,{...r,apiKey:a});for await(let e of o)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,t,n)=>{let i=a();return(async()=>{try{let a=await O(),o=r({...e,baseUrl:k,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},t,{...n,apiKey:a});for await(let e of o)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},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,a=b?null:await u(),c=b?`${p()}/auth/callback`:`${v??a.origin}/auth/callback`,l=crypto.randomUUID(),d=b?chrome.runtime.id:``,f=b?{source:`extension`,extensionId:d,path:`/github`,nonce:l}:{port:parseInt(new URL(a.href).port||`5710`,10),path:`/auth/callback`,nonce:l},h=btoa(JSON.stringify(f)),_=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 m({provider:`github`,code:O,redirectUri:c}),A=await C(k.access_token);await o({providerId:`github`,accessToken:k.access_token,userName:A.name,userAvatar:A.avatar});let j=s(`github`)?.maskedValue;j?await T(j):await E(),await D(A),t()},onOAuthLogout:async()=>{let e=x();e?.accessToken&&await h({provider:`github`,accessToken:e.accessToken}).catch(e=>console.warn(`[github] Token revocation failed:`,e instanceof Error?e.message:String(e))),await E(),await o({providerId:`github`,accessToken:``})}};function F(){c({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{$ as e,F as t,G as n,M as r,Q as i,R as a,_ as o,p as s,q as c,v as l}from"./kernel-worker-3eWlr-XP.js";import{getOAuthPageOrigin as u}from"./oauth-service-BnWJPxHa.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 i}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 s().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-3eWlr-XP.js`);await(await t.create({dbName:c})).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-3eWlr-XP.js`);await(await e.create({dbName:c})).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-3eWlr-XP.js`),{readGlobalGitConfigValue:n,writeGlobalGitConfigValue:r}=await import(`./kernel-worker-3eWlr-XP.js`),i=await t.create({dbName:c}),a=e.name||e.login,o=C(e.id,e.login);!await n(i,`user.name`)&&a&&await r(i,`user.name`,a),await n(i,`user.email`)||await r(i,`user.email`,o)}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=(e,t,n={})=>{let i=a();return(async()=>{try{let a=await D(),o=r({...e,baseUrl:O,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},t,{...n,apiKey:a});for await(let e of o)i.push(e);i.end()}catch(t){console.error(`[github] Stream error:`,t instanceof Error?t.message:String(t)),i.push(A(e,t)),i.end()}})(),i},M=(e,n,r)=>{let i=a();return(async()=>{try{let a=await D(),o=t({...e,baseUrl:O,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1,supportsUsageInStreaming:!1,maxTokensField:`max_tokens`}},n,{...r,apiKey:a});for await(let e of o)i.push(e);i.end()}catch(t){console.error(`[github] Stream error:`,t instanceof Error?t.message:String(t)),i.push(A(e,t)),i.end()}})(),i},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(){n({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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`slicc-fs-global`;export{e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as e,H as t,K as n,U as r,b as i}from"./index-DjZsBrmT.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-BBm3X1gE.js";var p=0,m=(r,i,a)=>{let o=new e;return(async()=>{let e={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||n(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:e});let h=null,v=e.content,y=()=>v.length-1;for await(let n of m){e.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=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`)),n.usageMetadata&&(e.usage={input:(n.usageMetadata.promptTokenCount||0)-(n.usageMetadata.cachedContentTokenCount||0),output:(n.usageMetadata.candidatesTokenCount||0)+(n.usageMetadata.thoughtsTokenCount||0),cacheRead:n.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:n.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},t(r,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})),a?.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=a?.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,a)=>{let o=a?.apiKey||n(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,t,{...s,thinking:{enabled:!1}});let c=r(e,a.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,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{B as e,L as t,U as n,b as r,o as i,z as a}from"./kernel-worker-3eWlr-XP.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-DVo3REsz.js";let p=0;const m=(e,r,i)=>{let o=new t;return(async()=>{let t={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,i?.apiKey||n(e.provider)||``,i?.headers),d=_(e,r,i),f=await i?.onPayload?.(d,e);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 n of m){t.responseId||=n.responseId;let r=n.candidates?.[0];if(r?.content?.parts)for(let e of r.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})}}r?.finishReason&&(t.stopReason=s(r.finishReason),t.content.some(e=>e.type===`toolCall`)&&(t.stopReason=`toolUse`)),n.usageMetadata&&(t.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}},a(e,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})),i?.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=i?.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,i,a)=>{let o=a?.apiKey||n(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,i,{...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,i,{...s,thinking:{enabled:!0,level:S(l,u)}}):m(t,i,{...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),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};
|