sliccy 6.54.13 → 6.55.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 (76) hide show
  1. package/dist/ui/assets/{account-store-pQMbIKRa.js → account-store-CwFk0vrn.js} +1 -1
  2. package/dist/ui/assets/{account-store-BRpzGwSS.js → account-store-OPlVgm9n.js} +1 -1
  3. package/dist/ui/assets/adobe-C4-28UHy.js +1 -0
  4. package/dist/ui/assets/adobe-CV9MxauL.js +2 -0
  5. package/dist/ui/assets/{apply-layout-Be2Qcnda.js → apply-layout-CU6uv2SV.js} +1 -1
  6. package/dist/ui/assets/{apps-D6MnssxE.js → apps-nVwOwYNZ.js} +1 -1
  7. package/dist/ui/assets/{azure-openai-Z_D3fXwY.js → azure-openai-CoNdWu6S.js} +1 -1
  8. package/dist/ui/assets/{azure-openai-Cwxq_3Mt.js → azure-openai-DE7XJJ_W.js} +1 -1
  9. package/dist/ui/assets/{cerebras-CDVcbO1O.js → cerebras-Cb6alYLA.js} +1 -1
  10. package/dist/ui/assets/{cerebras-B49pvEJd.js → cerebras-Da0ljDfP.js} +1 -1
  11. package/dist/ui/assets/{connect-surface-CjQItEnQ.js → connect-surface-C4wPsDoy.js} +1 -1
  12. package/dist/ui/assets/{fs-Y-fVUpZ9.js → fs-B-xI_nsy.js} +1 -1
  13. package/dist/ui/assets/{fs-CDJr3bDE.js → fs-DwsOvha-.js} +2 -2
  14. package/dist/ui/assets/{github-CMAkM-0x.js → github-B51gbFRM.js} +1 -1
  15. package/dist/ui/assets/{github-D-A-J0Ck.js → github-DHy_XZw0.js} +2 -2
  16. package/dist/ui/assets/{github-copilot-Cx1_4gLB.js → github-copilot-CFAaxZPF.js} +1 -1
  17. package/dist/ui/assets/{github-copilot-BNl8zl1C.js → github-copilot-CrE6ukCz.js} +1 -1
  18. package/dist/ui/assets/{github-install-CdnT5Spa.js → github-install-5tP5z8Sp.js} +1 -1
  19. package/dist/ui/assets/{github-zip-BgOqP-1S.js → github-zip-CXQB6COR.js} +1 -1
  20. package/dist/ui/assets/{kernel-worker-BgrR0qdt.js → kernel-worker-wEr6Yo6G.js} +544 -544
  21. package/dist/ui/assets/{local-llm-4Hutkt0a.js → local-llm-Bj89Xaik.js} +1 -1
  22. package/dist/ui/assets/{local-llm-Dl4HYPjL.js → local-llm-o-9HoXMQ.js} +1 -1
  23. package/dist/ui/assets/{main-D_1C-4BL.js → main-55zLxBLF.js} +3 -3
  24. package/dist/ui/assets/{mount-C5dUHntl.js → mount-BAQtIqJM.js} +1 -1
  25. package/dist/ui/assets/{mount-HJT_o-gh.js → mount-Bbl8m0YN.js} +2 -2
  26. package/dist/ui/assets/{mount-recovery-DAY-eCdm.js → mount-recovery-Dh_lrATP.js} +1 -1
  27. package/dist/ui/assets/{new-session-C3ZpUaHt.js → new-session-DzxiQ6Fo.js} +2 -2
  28. package/dist/ui/assets/{oauth-bootstrap-BxoVVVjE.js → oauth-bootstrap-D6sh22mp.js} +2 -2
  29. package/dist/ui/assets/{openai-codex-C7ErxokZ.js → openai-codex-B6vWughU.js} +1 -1
  30. package/dist/ui/assets/{openai-codex-DOORE66d.js → openai-codex-C2YERBkE.js} +1 -1
  31. package/dist/ui/assets/{openrouter-Dm1FOFGr.js → openrouter-D7rca13W.js} +1 -1
  32. package/dist/ui/assets/{openrouter-D3jhhw7M.js → openrouter-DRSWugHj.js} +1 -1
  33. package/dist/ui/assets/{openrouter-oauth-UpJj0S4D.js → openrouter-oauth-CM283kz1.js} +1 -1
  34. package/dist/ui/assets/{openrouter-oauth--BwpCiy_.js → openrouter-oauth-Ccm-7hP1.js} +1 -1
  35. package/dist/ui/assets/{panel-rpc-handlers-Bbsy8seG.js → panel-rpc-handlers-CPDysGzr.js} +2 -2
  36. package/dist/ui/assets/{provider-0sYjabik.js → provider-D4_spYyQ.js} +1 -1
  37. package/dist/ui/assets/{provider-C0rhFgji.js → provider-D95ajDI-.js} +2 -2
  38. package/dist/ui/assets/{provider-settings-sp1fyeqV.js → provider-settings-CZPFzFww.js} +1 -1
  39. package/dist/ui/assets/{provider-settings-D-LmW8cG.js → provider-settings-DHCjadXO.js} +1 -1
  40. package/dist/ui/assets/{provider-store-access-aAhTyz64.js → provider-store-access-ZzG9_DW9.js} +2 -2
  41. package/dist/ui/assets/provider-store-access-nDgnx6NL.js +1 -0
  42. package/dist/ui/assets/{providers-DbXqr5pt.js → providers-Bz8hOO4e.js} +1 -1
  43. package/dist/ui/assets/{providers-bpZvwzMY.js → providers-CMbA_5pP.js} +2 -2
  44. package/dist/ui/assets/{quick-llm-Bq4l6kSy.js → quick-llm-r-RNLFOD.js} +1 -1
  45. package/dist/ui/assets/{recovery-screen-VA6jy0Sd.js → recovery-screen-k0KG52c_.js} +1 -1
  46. package/dist/ui/assets/{redirect-uri-C3vBDcN-.js → redirect-uri-Dlgdgq9c.js} +1 -1
  47. package/dist/ui/assets/script-catalog-Bt94D0RP.js +2 -0
  48. package/dist/ui/assets/{session-freezer-D0oHu7vz.js → session-freezer-BdNDYJka.js} +3 -3
  49. package/dist/ui/assets/{setup-feature-flags-remote-DOQAlaRV.js → setup-feature-flags-remote-Cni0vF5s.js} +1 -1
  50. package/dist/ui/assets/{setup-standalone-prelude-UYsZJ27y.js → setup-standalone-prelude-Aaw6ZTqE.js} +1 -1
  51. package/dist/ui/assets/{setup-sudo-KfIEWWJc.js → setup-sudo-DE101L1A.js} +2 -2
  52. package/dist/ui/assets/{skills-BFfsWc15.js → skills-CD6n7K64.js} +1 -1
  53. package/dist/ui/assets/{store-BtaxZwnf.js → store-B-j0AMTP.js} +1 -1
  54. package/dist/ui/assets/{store-Djo5Jo_a.js → store-PS_6K9ig.js} +1 -1
  55. package/dist/ui/assets/{sudo-CGybs8um.js → sudo-C0Frl1uv.js} +1 -1
  56. package/dist/ui/assets/upgrade-detection-C6lKX0sw.js +1 -0
  57. package/dist/ui/assets/{wc-extension-Ba_v7Gj0.js → wc-extension-DiMYH909.js} +2 -2
  58. package/dist/ui/assets/{wc-follower-FuProqO-.js → wc-follower-XRDd6kcV.js} +3 -3
  59. package/dist/ui/assets/{wc-live-B7UR433W.js → wc-live-CeUom_i0.js} +4 -4
  60. package/dist/ui/assets/{wc-nav-D2lqJLa8.js → wc-nav-oFUaoh0U.js} +2 -2
  61. package/dist/ui/assets/{wc-onboarding-Bt-N8WDE.js → wc-onboarding-CTPJpqjh.js} +2 -2
  62. package/dist/ui/assets/{wc-placeholder-D_15tGX_.js → wc-placeholder-CbIosT0I.js} +2 -2
  63. package/dist/ui/assets/{wc-settings-DCjoEzk_.js → wc-settings-DMFk0-ha.js} +2 -2
  64. package/dist/ui/assets/{wc-shell-CsNFqqJ2.js → wc-shell-CsrNIkU0.js} +2 -2
  65. package/dist/ui/assets/{wc-sprinkles-i4f4Odn2.js → wc-sprinkles-CQZ3LlUK.js} +2 -2
  66. package/dist/ui/assets/{wc-tray-D1JT7oSF.js → wc-tray-DckHZGXQ.js} +2 -2
  67. package/dist/ui/assets/{xai-grok-DZQmav2K.js → xai-grok-BOQIeqyM.js} +1 -1
  68. package/dist/ui/assets/{xai-grok-D5bSGhhb.js → xai-grok-DtwSyWqH.js} +1 -1
  69. package/dist/ui/index.html +6 -6
  70. package/dist/ui/packages/webapp/index.html +6 -6
  71. package/package.json +4 -3
  72. package/dist/ui/assets/adobe-BpHI0CPu.js +0 -2
  73. package/dist/ui/assets/adobe-CRqw_QBY.js +0 -1
  74. package/dist/ui/assets/provider-store-access-D6u16dha.js +0 -1
  75. package/dist/ui/assets/script-catalog-e0GUPxAf.js +0 -2
  76. package/dist/ui/assets/upgrade-detection-B1IJuYfG.js +0 -1
@@ -1 +1 @@
1
- import{d as e,z as t}from"./account-store-pQMbIKRa.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{d as r,p as i,u as a}from"./bedrock-camp-BfNg24Ce.js";import{a as o,c as s,i as c,r as l,s as u,t as d}from"./legacy-api-aliases-qI5FdR49.js";import"./provider-settings-sp1fyeqV.js";const f=`github-copilot`,p=atob(`SXYxLmI1MDdhMDhjODdlY2ZlOTg=`),m={Accept:`application/json`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`},h={Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`};function g(){return e().find(e=>e.providerId===f)}async function _(){let e=await fetch(`https://github.com/login/device/code`,{method:`POST`,headers:h,body:new URLSearchParams({client_id:p,scope:`read:user`})});if(!e.ok)throw Error(`GitHub device-code request failed: ${e.status} ${e.statusText} — ${await e.text().catch(()=>``)}`);let t=await e.json();if(typeof t.device_code!=`string`||typeof t.user_code!=`string`||typeof t.verification_uri!=`string`||typeof t.expires_in!=`number`||typeof t.interval!=`number`)throw Error(`GitHub device-code response had an unexpected shape`);return t}async function v(e,t){let n=Date.now()+e.expires_in*1e3,r=Math.max(1e3,Math.floor(e.interval*1e3)),i=1.2;for(;Date.now()<n;){if(t.aborted)throw Error(`Copilot login cancelled`);await y(Math.ceil(r*i),t);let n=await fetch(`https://github.com/login/oauth/access_token`,{method:`POST`,headers:h,body:new URLSearchParams({client_id:p,device_code:e.device_code,grant_type:`urn:ietf:params:oauth:grant-type:device_code`})});if(!n.ok)throw Error(`GitHub token poll failed: ${n.status} ${n.statusText} — ${await n.text().catch(()=>``)}`);let a=await n.json();if(typeof a.access_token==`string`&&a.access_token.length>0)return a.access_token;if(a.error!==`authorization_pending`){if(a.error===`slow_down`){r=typeof a.interval==`number`?a.interval*1e3:r+5e3,i=1.4;continue}if(a.error){let e=a.error_description?`: ${a.error_description}`:``;throw Error(`Device flow failed (${a.error})${e}`)}}}throw Error(`Copilot device flow timed out (device code expired)`)}function y(e,t){return new Promise((n,r)=>{if(t.aborted){r(Error(`Copilot login cancelled`));return}let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(Error(`Copilot login cancelled`))},{once:!0})})}function b(e){let t=e.match(/proxy-ep=([^;]+)/);return t?`https://${t[1].replace(/^proxy\./,`api.`)}`:null}async function x(e){let t=await fetch(`https://api.github.com/copilot_internal/v2/token`,{headers:{...m,Authorization:`Bearer ${e}`}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`Copilot token exchange failed: ${t.status} ${t.statusText} — ${e.slice(0,300)}`)}let n=await t.json();if(typeof n.token!=`string`||typeof n.expires_at!=`number`)throw Error(`Copilot token exchange returned an unexpected payload`);if(n.chat_enabled===!1)throw Error(`GitHub Copilot Chat is disabled for this account (no chat features granted)`);return{copilotToken:n.token,expiresAtMs:n.expires_at*1e3-3e5,apiBaseUrl:b(n.token)??`https://api.individual.githubcopilot.com`,githubAccessToken:e}}const S=`github-copilot.models.v1`;function C(e){let t=e.supported_endpoints??[],n=(e.vendor??``).toLowerCase(),r=e.id;return n===`anthropic`&&t.includes(`/v1/messages`)?`anthropic-messages`:n===`openai`&&(/^gpt-5/i.test(r)||/codex/i.test(r)||/^o\d/i.test(r))?`openai-responses`:`openai-completions`}function w(e){if(!e||typeof e!=`object`)return[];let t=e.data;if(!Array.isArray(t))return[];let n=[];for(let e of t)e.capabilities?.type&&e.capabilities.type!==`chat`||e.model_picker_enabled!==!1&&e.id&&n.push({id:e.id,name:e.name??e.id,vendor:e.vendor??``,api:C(e),contextWindow:e.capabilities?.limits?.max_context_window_tokens??e.capabilities?.limits?.max_prompt_tokens??128e3,maxTokens:e.capabilities?.limits?.max_output_tokens??8192,supportsTools:e.capabilities?.supports?.tool_calls===!0,supportsStreaming:e.capabilities?.supports?.streaming!==!1,supportsVision:e.capabilities?.supports?.vision===!0,supportsReasoning:e.capabilities?.supports?.adaptive_thinking===!0||Array.isArray(e.capabilities?.supports?.reasoning_effort),policyState:e.policy?.state??`enabled`});return n}async function T(e){let t=await fetch(`${e.apiBaseUrl}/models`,{headers:{...m,Authorization:`Bearer ${e.copilotToken}`,Accept:`application/json`}});if(!t.ok)throw Error(`Copilot /models returned ${t.status} ${t.statusText}`);return w(await t.json())}function E(){if(typeof localStorage>`u`)return[];try{let e=localStorage.getItem(S);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function D(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(S,JSON.stringify(e))}catch{}}function O(e){return E().find(t=>t.id===e)??null}async function k(e){let t;try{t=await T(e)}catch(e){console.warn(`[github-copilot] Catalog refresh failed; keeping previous cache.`,e instanceof Error?e.message:String(e));return}D(t),await Promise.all(t.filter(e=>e.policyState===`disabled`).map(async t=>{let n=`${e.apiBaseUrl}/models/${encodeURIComponent(t.id)}/policy`;try{let r=await fetch(n,{method:`POST`,headers:{...m,"Content-Type":`application/json`,Authorization:`Bearer ${e.copilotToken}`,"openai-intent":`chat-policy`,"x-interaction-type":`chat-policy`},body:JSON.stringify({state:`enabled`})});r.ok?t.policyState=`enabled`:r.status!==404&&r.status!==400&&console.warn(`[github-copilot] enable policy for ${t.id} returned ${r.status} ${r.statusText}`)}catch(e){console.warn(`[github-copilot] enable policy for ${t.id} failed:`,e instanceof Error?e.message:String(e))}})),D(t)}async function A(e,n){await t({providerId:f,accessToken:e.copilotToken,refreshToken:e.githubAccessToken,tokenExpiresAt:e.expiresAtMs,baseUrl:e.apiBaseUrl,userName:n})}async function j(){let e=g();if(!e?.accessToken||!e.refreshToken)throw Error(`Not logged in to GitHub Copilot — click "Login" in the provider settings`);let t=e.tokenExpiresAt??0;if(Date.now()<t-6e4)return e.accessToken;let n=await x(e.refreshToken);return await A(n,e.userName),n.copilotToken}const M=[`mini`,`nano`,`flash`,`haiku`,`lite`,`embedding`];function N(e){let t=[e.id,e.name??``].flatMap(e=>{let t=e.toLowerCase();return[t,t.replace(/[\s_.:]+/g,`-`)]});return!M.some(e=>t.some(t=>t.includes(e)))}function P(){if(!g()?.accessToken)return[];let e=E();if(e.length>0)return e.filter(e=>!e.policyState.startsWith(`unavailable:`)).filter(e=>N(e)).map(e=>({id:e.id,name:e.name,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.supportsReasoning,input:e.supportsVision?[`text`,`image`]:[`text`]}));let t;try{t=r(`github-copilot`)}catch{return[]}return t.filter(e=>N({id:e.id,name:e.name})).map(e=>({id:e.id,name:e.name??e.id,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.reasoning,input:e.input}))}function F(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:e.api,provider:f,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 I={"User-Agent":`GitHubCopilotChat/0.35.0`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`};function L(e){let t=g(),n=t?.baseUrl??`https://api.individual.githubcopilot.com`,r=O(e);if(r)return{api:r.api,baseUrl:n,headers:{...I}};try{let n=a(`github-copilot`,e);return{api:n.api,baseUrl:t?.baseUrl??n.baseUrl,headers:{...n.headers??{},...I}}}catch{return null}}function R(e,t){let n=E(),r=n.findIndex(t=>t.id===e);r<0||(n[r]={...n[r],policyState:`unavailable:${t}`},D(n))}function z(e,t){return`GitHub Copilot rejected "${e}" with model_not_supported. This usually means the model isn't included in your Copilot plan (Opus and other premium models require Copilot Pro / Pro+ / Business / Enterprise). Try Claude Sonnet 4.6 or another model that appears in the picker after a fresh login. Original error: ${t}`}function B(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.type!==`error`)return null;if(t.error&&typeof t.error==`object`){let e=t.error.errorMessage;if(typeof e==`string`)return e}return typeof t.errorMessage==`string`?t.errorMessage:null}function V(e,t){return e===`anthropic-messages`?t?o:d:e===`openai-responses`?t?s:c:t?u:l}function H(e,t,n){let r=B(n);if(r&&/model_not_supported/i.test(r)){R(t.id,`model_not_supported`);let n=z(t.id,r);return console.error(`[github-copilot] Plan-gated model rejection:`,n),e.push(F(t,Error(n))),e.end(),!0}return e.push(n),!1}function U(e,t,n){let r=n instanceof Error?n.message:String(n),i=n;/model_not_supported/i.test(r)&&(R(t.id,`model_not_supported`),i=Error(z(t.id,r))),console.error(`[github-copilot] Stream error:`,i instanceof Error?i.message:String(i)),e.push(F(t,i)),e.end()}async function W(e,t,n,r,i){try{let a=await j(),o=L(t.id);if(!o)throw Error(`GitHub Copilot does not recognize "${t.id}" — open the picker (the model list refreshes on login) and pick a current model.`);let s={...t,api:o.api,baseUrl:o.baseUrl,headers:o.headers,provider:`github-copilot`},c={...r,apiKey:a},l=V(o.api,i)(s,n,c);for await(let n of l)if(H(e,t,n))return;e.end()}catch(n){U(e,t,n)}}function G(e){return(t,r,i={})=>{let a=n();return W(a,t,r,i,e),a}}const K=G(!1),q=G(!0),J=({userCode:e,verificationUrl:t})=>typeof document>`u`?(console.info(`[github-copilot] Device verification code: ${e} — open ${t} in a browser to authorize.`),Promise.resolve(`continue`)):new Promise(t=>{let n=document.createElement(`div`);n.setAttribute(`data-slicc-overlay`,`github-copilot-device`),n.style.cssText=[`position:fixed`,`top:24px`,`right:24px`,`z-index:2147483647`,`background:#0d1117`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:10px`,`padding:16px 18px`,`box-shadow:0 8px 32px rgba(0,0,0,0.45)`,`font:13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,`min-width:260px`,`max-width:340px`].join(`;`);let r=document.createElement(`div`);r.textContent=`GitHub Copilot — verification code`,r.style.cssText=`font-weight:600;margin-bottom:8px;color:#7ee787`;let i=document.createElement(`div`);i.textContent=e,i.style.cssText=[`font:600 22px ui-monospace, SFMono-Regular, Menlo, monospace`,`letter-spacing:2px`,`background:#161b22`,`border:1px solid #30363d`,`border-radius:6px`,`padding:10px 12px`,`text-align:center`,`margin-bottom:10px`,`user-select:all`,`cursor:text`].join(`;`);let a=document.createElement(`div`);a.style.cssText=`color:#8b949e;font-size:12px;line-height:1.5`,a.textContent=`Copy the code, then click Continue to open the GitHub authorization page in a new tab.`;let o=document.createElement(`div`);o.style.cssText=`display:flex;gap:8px;margin-top:12px;justify-content:flex-end`;let s=document.createElement(`button`);s.type=`button`,s.textContent=`Cancel`,s.style.cssText=[`background:transparent`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let c=document.createElement(`button`);c.type=`button`,c.textContent=`Copy & Continue`,c.style.cssText=[`background:#238636`,`color:#fff`,`border:0`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let l=()=>{try{n.remove()}catch{}};s.addEventListener(`click`,()=>{l(),t(`cancel`)}),c.addEventListener(`click`,()=>{(async()=>{try{let{copyTextToClipboard:t}=await import(`./clipboard-CknViQHB.js`).then(e=>e.t);await t(e)}catch{}l(),t(`continue`)})()}),o.appendChild(s),o.appendChild(c),n.appendChild(r),n.appendChild(i),n.appendChild(a),n.appendChild(o),document.body.appendChild(n)}),Y={id:f,name:`GitHub Copilot`,description:`Use your GitHub Copilot subscription to access Claude, GPT-5, Codex, Gemini, and Grok models. Sign in with the GitHub device-code flow.`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`claude-sonnet-4.6`,oauthTokenDomains:[`*.githubcopilot.com`,`api.individual.githubcopilot.com`,`api.business.githubcopilot.com`,`api.enterprise.githubcopilot.com`],getModelIds:P,onOAuthLoginIntercepted:async(e,t,n)=>{let r=await _(),i=new URL(r.verification_uri);if(i.searchParams.set(`user_code`,r.user_code),await(n?.presentDeviceCode??J)({userCode:r.user_code,verificationUrl:i.toString(),expiresInSeconds:r.expires_in})===`cancel`)throw Error(`GitHub Copilot login cancelled`);let a=new AbortController,o=e({authorizeUrl:i.toString(),redirectUriPattern:`https://github.com/login/device/success*`,onCapture:`close`,timeoutMs:r.expires_in*1e3}).catch(e=>(console.warn(`[github-copilot] Launcher failed:`,e instanceof Error?e.message:String(e)),null)),s;try{s=await v(r,a.signal)}catch(e){throw a.abort(),await o,e}await o;let c=await x(s),l;try{let e=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${s}`,Accept:`application/json`}});if(e.ok){let t=await e.json();l=t.name||t.login}}catch{}await A(c,l),await k(c),t()},onOAuthLogout:async()=>{await t({providerId:f,accessToken:``})},onSilentRenew:async()=>{let e=g();if(!e?.refreshToken)return null;try{let t=await x(e.refreshToken);return await A(t,e.userName),await k(t),t.copilotToken}catch(e){return console.warn(`[github-copilot] Silent renew failed:`,e instanceof Error?e.message:String(e)),null}}};function X(){i({api:`github-copilot-anthropic`,stream:K,streamSimple:q}),i({api:`github-copilot-openai`,stream:K,streamSimple:q})}export{Y as config,N as isCopilotConeCompatible,X as register};
1
+ import{d as e,z as t}from"./account-store-CwFk0vrn.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{d as r,p as i,u as a}from"./bedrock-camp-BfNg24Ce.js";import{a as o,c as s,i as c,r as l,s as u,t as d}from"./legacy-api-aliases-qI5FdR49.js";import"./provider-settings-CZPFzFww.js";const f=`github-copilot`,p=atob(`SXYxLmI1MDdhMDhjODdlY2ZlOTg=`),m={Accept:`application/json`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`},h={Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`};function g(){return e().find(e=>e.providerId===f)}async function _(){let e=await fetch(`https://github.com/login/device/code`,{method:`POST`,headers:h,body:new URLSearchParams({client_id:p,scope:`read:user`})});if(!e.ok)throw Error(`GitHub device-code request failed: ${e.status} ${e.statusText} — ${await e.text().catch(()=>``)}`);let t=await e.json();if(typeof t.device_code!=`string`||typeof t.user_code!=`string`||typeof t.verification_uri!=`string`||typeof t.expires_in!=`number`||typeof t.interval!=`number`)throw Error(`GitHub device-code response had an unexpected shape`);return t}async function v(e,t){let n=Date.now()+e.expires_in*1e3,r=Math.max(1e3,Math.floor(e.interval*1e3)),i=1.2;for(;Date.now()<n;){if(t.aborted)throw Error(`Copilot login cancelled`);await y(Math.ceil(r*i),t);let n=await fetch(`https://github.com/login/oauth/access_token`,{method:`POST`,headers:h,body:new URLSearchParams({client_id:p,device_code:e.device_code,grant_type:`urn:ietf:params:oauth:grant-type:device_code`})});if(!n.ok)throw Error(`GitHub token poll failed: ${n.status} ${n.statusText} — ${await n.text().catch(()=>``)}`);let a=await n.json();if(typeof a.access_token==`string`&&a.access_token.length>0)return a.access_token;if(a.error!==`authorization_pending`){if(a.error===`slow_down`){r=typeof a.interval==`number`?a.interval*1e3:r+5e3,i=1.4;continue}if(a.error){let e=a.error_description?`: ${a.error_description}`:``;throw Error(`Device flow failed (${a.error})${e}`)}}}throw Error(`Copilot device flow timed out (device code expired)`)}function y(e,t){return new Promise((n,r)=>{if(t.aborted){r(Error(`Copilot login cancelled`));return}let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(Error(`Copilot login cancelled`))},{once:!0})})}function b(e){let t=e.match(/proxy-ep=([^;]+)/);return t?`https://${t[1].replace(/^proxy\./,`api.`)}`:null}async function x(e){let t=await fetch(`https://api.github.com/copilot_internal/v2/token`,{headers:{...m,Authorization:`Bearer ${e}`}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`Copilot token exchange failed: ${t.status} ${t.statusText} — ${e.slice(0,300)}`)}let n=await t.json();if(typeof n.token!=`string`||typeof n.expires_at!=`number`)throw Error(`Copilot token exchange returned an unexpected payload`);if(n.chat_enabled===!1)throw Error(`GitHub Copilot Chat is disabled for this account (no chat features granted)`);return{copilotToken:n.token,expiresAtMs:n.expires_at*1e3-3e5,apiBaseUrl:b(n.token)??`https://api.individual.githubcopilot.com`,githubAccessToken:e}}const S=`github-copilot.models.v1`;function C(e){let t=e.supported_endpoints??[],n=(e.vendor??``).toLowerCase(),r=e.id;return n===`anthropic`&&t.includes(`/v1/messages`)?`anthropic-messages`:n===`openai`&&(/^gpt-5/i.test(r)||/codex/i.test(r)||/^o\d/i.test(r))?`openai-responses`:`openai-completions`}function w(e){if(!e||typeof e!=`object`)return[];let t=e.data;if(!Array.isArray(t))return[];let n=[];for(let e of t)e.capabilities?.type&&e.capabilities.type!==`chat`||e.model_picker_enabled!==!1&&e.id&&n.push({id:e.id,name:e.name??e.id,vendor:e.vendor??``,api:C(e),contextWindow:e.capabilities?.limits?.max_context_window_tokens??e.capabilities?.limits?.max_prompt_tokens??128e3,maxTokens:e.capabilities?.limits?.max_output_tokens??8192,supportsTools:e.capabilities?.supports?.tool_calls===!0,supportsStreaming:e.capabilities?.supports?.streaming!==!1,supportsVision:e.capabilities?.supports?.vision===!0,supportsReasoning:e.capabilities?.supports?.adaptive_thinking===!0||Array.isArray(e.capabilities?.supports?.reasoning_effort),policyState:e.policy?.state??`enabled`});return n}async function T(e){let t=await fetch(`${e.apiBaseUrl}/models`,{headers:{...m,Authorization:`Bearer ${e.copilotToken}`,Accept:`application/json`}});if(!t.ok)throw Error(`Copilot /models returned ${t.status} ${t.statusText}`);return w(await t.json())}function E(){if(typeof localStorage>`u`)return[];try{let e=localStorage.getItem(S);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function D(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(S,JSON.stringify(e))}catch{}}function O(e){return E().find(t=>t.id===e)??null}async function k(e){let t;try{t=await T(e)}catch(e){console.warn(`[github-copilot] Catalog refresh failed; keeping previous cache.`,e instanceof Error?e.message:String(e));return}D(t),await Promise.all(t.filter(e=>e.policyState===`disabled`).map(async t=>{let n=`${e.apiBaseUrl}/models/${encodeURIComponent(t.id)}/policy`;try{let r=await fetch(n,{method:`POST`,headers:{...m,"Content-Type":`application/json`,Authorization:`Bearer ${e.copilotToken}`,"openai-intent":`chat-policy`,"x-interaction-type":`chat-policy`},body:JSON.stringify({state:`enabled`})});r.ok?t.policyState=`enabled`:r.status!==404&&r.status!==400&&console.warn(`[github-copilot] enable policy for ${t.id} returned ${r.status} ${r.statusText}`)}catch(e){console.warn(`[github-copilot] enable policy for ${t.id} failed:`,e instanceof Error?e.message:String(e))}})),D(t)}async function A(e,n){await t({providerId:f,accessToken:e.copilotToken,refreshToken:e.githubAccessToken,tokenExpiresAt:e.expiresAtMs,baseUrl:e.apiBaseUrl,userName:n})}async function j(){let e=g();if(!e?.accessToken||!e.refreshToken)throw Error(`Not logged in to GitHub Copilot — click "Login" in the provider settings`);let t=e.tokenExpiresAt??0;if(Date.now()<t-6e4)return e.accessToken;let n=await x(e.refreshToken);return await A(n,e.userName),n.copilotToken}const M=[`mini`,`nano`,`flash`,`haiku`,`lite`,`embedding`];function N(e){let t=[e.id,e.name??``].flatMap(e=>{let t=e.toLowerCase();return[t,t.replace(/[\s_.:]+/g,`-`)]});return!M.some(e=>t.some(t=>t.includes(e)))}function P(){if(!g()?.accessToken)return[];let e=E();if(e.length>0)return e.filter(e=>!e.policyState.startsWith(`unavailable:`)).filter(e=>N(e)).map(e=>({id:e.id,name:e.name,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.supportsReasoning,input:e.supportsVision?[`text`,`image`]:[`text`]}));let t;try{t=r(`github-copilot`)}catch{return[]}return t.filter(e=>N({id:e.id,name:e.name})).map(e=>({id:e.id,name:e.name??e.id,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.reasoning,input:e.input}))}function F(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:e.api,provider:f,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 I={"User-Agent":`GitHubCopilotChat/0.35.0`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`};function L(e){let t=g(),n=t?.baseUrl??`https://api.individual.githubcopilot.com`,r=O(e);if(r)return{api:r.api,baseUrl:n,headers:{...I}};try{let n=a(`github-copilot`,e);return{api:n.api,baseUrl:t?.baseUrl??n.baseUrl,headers:{...n.headers??{},...I}}}catch{return null}}function R(e,t){let n=E(),r=n.findIndex(t=>t.id===e);r<0||(n[r]={...n[r],policyState:`unavailable:${t}`},D(n))}function z(e,t){return`GitHub Copilot rejected "${e}" with model_not_supported. This usually means the model isn't included in your Copilot plan (Opus and other premium models require Copilot Pro / Pro+ / Business / Enterprise). Try Claude Sonnet 4.6 or another model that appears in the picker after a fresh login. Original error: ${t}`}function B(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.type!==`error`)return null;if(t.error&&typeof t.error==`object`){let e=t.error.errorMessage;if(typeof e==`string`)return e}return typeof t.errorMessage==`string`?t.errorMessage:null}function V(e,t){return e===`anthropic-messages`?t?o:d:e===`openai-responses`?t?s:c:t?u:l}function H(e,t,n){let r=B(n);if(r&&/model_not_supported/i.test(r)){R(t.id,`model_not_supported`);let n=z(t.id,r);return console.error(`[github-copilot] Plan-gated model rejection:`,n),e.push(F(t,Error(n))),e.end(),!0}return e.push(n),!1}function U(e,t,n){let r=n instanceof Error?n.message:String(n),i=n;/model_not_supported/i.test(r)&&(R(t.id,`model_not_supported`),i=Error(z(t.id,r))),console.error(`[github-copilot] Stream error:`,i instanceof Error?i.message:String(i)),e.push(F(t,i)),e.end()}async function W(e,t,n,r,i){try{let a=await j(),o=L(t.id);if(!o)throw Error(`GitHub Copilot does not recognize "${t.id}" — open the picker (the model list refreshes on login) and pick a current model.`);let s={...t,api:o.api,baseUrl:o.baseUrl,headers:o.headers,provider:`github-copilot`},c={...r,apiKey:a},l=V(o.api,i)(s,n,c);for await(let n of l)if(H(e,t,n))return;e.end()}catch(n){U(e,t,n)}}function G(e){return(t,r,i={})=>{let a=n();return W(a,t,r,i,e),a}}const K=G(!1),q=G(!0),J=({userCode:e,verificationUrl:t})=>typeof document>`u`?(console.info(`[github-copilot] Device verification code: ${e} — open ${t} in a browser to authorize.`),Promise.resolve(`continue`)):new Promise(t=>{let n=document.createElement(`div`);n.setAttribute(`data-slicc-overlay`,`github-copilot-device`),n.style.cssText=[`position:fixed`,`top:24px`,`right:24px`,`z-index:2147483647`,`background:#0d1117`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:10px`,`padding:16px 18px`,`box-shadow:0 8px 32px rgba(0,0,0,0.45)`,`font:13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,`min-width:260px`,`max-width:340px`].join(`;`);let r=document.createElement(`div`);r.textContent=`GitHub Copilot — verification code`,r.style.cssText=`font-weight:600;margin-bottom:8px;color:#7ee787`;let i=document.createElement(`div`);i.textContent=e,i.style.cssText=[`font:600 22px ui-monospace, SFMono-Regular, Menlo, monospace`,`letter-spacing:2px`,`background:#161b22`,`border:1px solid #30363d`,`border-radius:6px`,`padding:10px 12px`,`text-align:center`,`margin-bottom:10px`,`user-select:all`,`cursor:text`].join(`;`);let a=document.createElement(`div`);a.style.cssText=`color:#8b949e;font-size:12px;line-height:1.5`,a.textContent=`Copy the code, then click Continue to open the GitHub authorization page in a new tab.`;let o=document.createElement(`div`);o.style.cssText=`display:flex;gap:8px;margin-top:12px;justify-content:flex-end`;let s=document.createElement(`button`);s.type=`button`,s.textContent=`Cancel`,s.style.cssText=[`background:transparent`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let c=document.createElement(`button`);c.type=`button`,c.textContent=`Copy & Continue`,c.style.cssText=[`background:#238636`,`color:#fff`,`border:0`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let l=()=>{try{n.remove()}catch{}};s.addEventListener(`click`,()=>{l(),t(`cancel`)}),c.addEventListener(`click`,()=>{(async()=>{try{let{copyTextToClipboard:t}=await import(`./clipboard-CknViQHB.js`).then(e=>e.t);await t(e)}catch{}l(),t(`continue`)})()}),o.appendChild(s),o.appendChild(c),n.appendChild(r),n.appendChild(i),n.appendChild(a),n.appendChild(o),document.body.appendChild(n)}),Y={id:f,name:`GitHub Copilot`,description:`Use your GitHub Copilot subscription to access Claude, GPT-5, Codex, Gemini, and Grok models. Sign in with the GitHub device-code flow.`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`claude-sonnet-4.6`,oauthTokenDomains:[`*.githubcopilot.com`,`api.individual.githubcopilot.com`,`api.business.githubcopilot.com`,`api.enterprise.githubcopilot.com`],getModelIds:P,onOAuthLoginIntercepted:async(e,t,n)=>{let r=await _(),i=new URL(r.verification_uri);if(i.searchParams.set(`user_code`,r.user_code),await(n?.presentDeviceCode??J)({userCode:r.user_code,verificationUrl:i.toString(),expiresInSeconds:r.expires_in})===`cancel`)throw Error(`GitHub Copilot login cancelled`);let a=new AbortController,o=e({authorizeUrl:i.toString(),redirectUriPattern:`https://github.com/login/device/success*`,onCapture:`close`,timeoutMs:r.expires_in*1e3}).catch(e=>(console.warn(`[github-copilot] Launcher failed:`,e instanceof Error?e.message:String(e)),null)),s;try{s=await v(r,a.signal)}catch(e){throw a.abort(),await o,e}await o;let c=await x(s),l;try{let e=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${s}`,Accept:`application/json`}});if(e.ok){let t=await e.json();l=t.name||t.login}}catch{}await A(c,l),await k(c),t()},onOAuthLogout:async()=>{await t({providerId:f,accessToken:``})},onSilentRenew:async()=>{let e=g();if(!e?.refreshToken)return null;try{let t=await x(e.refreshToken);return await A(t,e.userName),await k(t),t.copilotToken}catch(e){return console.warn(`[github-copilot] Silent renew failed:`,e instanceof Error?e.message:String(e)),null}}};function X(){i({api:`github-copilot-anthropic`,stream:K,streamSimple:q}),i({api:`github-copilot-openai`,stream:K,streamSimple:q})}export{Y as config,N as isCopilotConeCompatible,X as register};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./fetch-body-DDu_AU5I.js";import{a as n,i as r,n as i,o as a,t as o,u as s}from"./github-zip-BgOqP-1S.js";async function c(){try{let e=(typeof window<`u`?window:globalThis).__slicc_reloadSkills;if(typeof e==`function`){await e();return}typeof chrome<`u`&&chrome?.runtime?.sendMessage&&chrome.runtime.sendMessage({source:`panel`,payload:{type:`reload-skills`}})}catch{}}async function l(){try{let e=globalThis.__slicc_sprinkleManager;e&&typeof e.openNewAutoOpenSprinkles==`function`&&await e.openNewAutoOpenSprinkles()}catch{}}async function u(){await l(),await c()}async function d(e,t,n,r,i=!1){let a=`${s}/${t}`;try{if(await r.stat(a),!i)return{ok:!1,error:`skill "${t}" already exists (use --force to overwrite)`};await r.rm(a,{recursive:!0})}catch{}let o=e.replace(/^\/|\/$/g,``),c=o?o+`/`:``;await r.mkdir(a,{recursive:!0});let l=0;try{for(let[e,t]of Object.entries(n)){if(!e.startsWith(c))continue;let n=e.slice(c.length);if(!n||e.endsWith(`/`))continue;let i=`${a}/${n}`,o=i.replace(/\/+/g,`/`);if(o.includes(`/../`)||o.includes(`/..`)||!o.startsWith(a+`/`))continue;let s=i.substring(0,i.lastIndexOf(`/`));s!==a&&await r.mkdir(s,{recursive:!0}),await r.writeFile(i,t),l++}}catch(e){throw await r.rm(a,{recursive:!0}).catch(()=>{}),e}return l===0?(await r.rm(a,{recursive:!0}).catch(()=>{}),{ok:!1,error:`no files found for skill "${t}" in ZIP`}):{ok:!0}}var f=e({installFromGitHub:()=>h,listGitHubSkills:()=>m,parseGitHubRef:()=>g,parseGitHubUrl:()=>p});function p(e){let t=e.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);return t?{owner:t[1],repo:t[2].replace(/\.git$/,``)}:null}async function m(e,n,o,s,c,l){if(c){let t=await i(e,n,c,l);if(t.status===`ok`){let e=r(t.files),n=[],i=s?s.replace(/^\/|\/$/g,``)+`/`:``;for(let t of Object.keys(e))if(t.startsWith(i)&&(t.split(`/`).pop()||``)===`SKILL.md`){let e=t.replace(/\/SKILL\.md$/,``),r=e.split(`/`).pop()||e;n.push({name:r,path:e})}return{skills:n}}}let u=[];async function d(r){let i=`https://api.github.com/repos/${e}/${n}/contents/${r}`,s=l?`${i}?ref=${encodeURIComponent(l)}`:i,c=await o.request(s);if(c.status!==200)throw Error(a(c,`${e}/${n}${r?`/${r}`:``}`,o.hasToken));let f=t(c.body);for(let e of f)if(e.type===`file`&&e.name===`SKILL.md`){let t=e.path.replace(`/SKILL.md`,``),n=t.split(`/`).pop()||t;u.push({name:n,path:t})}else e.type===`dir`&&await d(e.path)}try{return await d(s||``),{skills:u}}catch(e){return{skills:[],error:e instanceof Error?e.message:String(e)}}}async function h(e,d,f,p,m,h,g=!1,_,v){try{let y=`${s}/${p}`;try{if(await m.stat(y),!g)return{stdout:``,stderr:`upskill: skill "${p}" already exists (use --force to overwrite)\n`,exitCode:1};await m.rm(y,{recursive:!0})}catch{}if(_){let t=await i(e,d,_,v);if(t.status===`ok`){let i=r(t.files),a=f.replace(/^\/|\/$/g,``)+`/`;if(await m.mkdir(y,{recursive:!0}),await n(i,a,y,m)>0)return await l(),await c(),{stdout:`Installed skill "${p}" from ${e}/${d}\n`,stderr:``,exitCode:0}}}let b=`https://api.github.com/repos/${e}/${d}/contents/${f}`,x=v?`${b}?ref=${encodeURIComponent(v)}`:b,S=await h.request(x);if(S.status!==200)return{stdout:``,stderr:`upskill: ${a(S,`${e}/${d}/${f}`,h.hasToken)}\n`,exitCode:1};let C=t(S.body);await m.mkdir(y,{recursive:!0});try{await o(C,y,e,d,v,m,h)}catch(e){try{await m.rm(y,{recursive:!0})}catch{}throw e}return await u(),{stdout:`Installed skill "${p}" from ${e}/${d}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`upskill: failed to install from GitHub: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function g(e){let t=e.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?(?:\/tree\/([^/]+?)(?:\/(.+?))?)?\/?$/);if(t)return{owner:t[1],repo:t[2],branch:t[3],path:t[4]};let n=e.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)(?:@([a-zA-Z0-9_./-]+))?$/);return n?{owner:n[1],repo:n[2],branch:n[3]}:null}export{p as a,g as i,h as n,d as o,m as r,u as s,f as t};
1
+ import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./fetch-body-DDu_AU5I.js";import{a as n,i as r,n as i,o as a,t as o,u as s}from"./github-zip-CXQB6COR.js";async function c(){try{let e=(typeof window<`u`?window:globalThis).__slicc_reloadSkills;if(typeof e==`function`){await e();return}typeof chrome<`u`&&chrome?.runtime?.sendMessage&&chrome.runtime.sendMessage({source:`panel`,payload:{type:`reload-skills`}})}catch{}}async function l(){try{let e=globalThis.__slicc_sprinkleManager;e&&typeof e.openNewAutoOpenSprinkles==`function`&&await e.openNewAutoOpenSprinkles()}catch{}}async function u(){await l(),await c()}async function d(e,t,n,r,i=!1){let a=`${s}/${t}`;try{if(await r.stat(a),!i)return{ok:!1,error:`skill "${t}" already exists (use --force to overwrite)`};await r.rm(a,{recursive:!0})}catch{}let o=e.replace(/^\/|\/$/g,``),c=o?o+`/`:``;await r.mkdir(a,{recursive:!0});let l=0;try{for(let[e,t]of Object.entries(n)){if(!e.startsWith(c))continue;let n=e.slice(c.length);if(!n||e.endsWith(`/`))continue;let i=`${a}/${n}`,o=i.replace(/\/+/g,`/`);if(o.includes(`/../`)||o.includes(`/..`)||!o.startsWith(a+`/`))continue;let s=i.substring(0,i.lastIndexOf(`/`));s!==a&&await r.mkdir(s,{recursive:!0}),await r.writeFile(i,t),l++}}catch(e){throw await r.rm(a,{recursive:!0}).catch(()=>{}),e}return l===0?(await r.rm(a,{recursive:!0}).catch(()=>{}),{ok:!1,error:`no files found for skill "${t}" in ZIP`}):{ok:!0}}var f=e({installFromGitHub:()=>h,listGitHubSkills:()=>m,parseGitHubRef:()=>g,parseGitHubUrl:()=>p});function p(e){let t=e.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);return t?{owner:t[1],repo:t[2].replace(/\.git$/,``)}:null}async function m(e,n,o,s,c,l){if(c){let t=await i(e,n,c,l);if(t.status===`ok`){let e=r(t.files),n=[],i=s?s.replace(/^\/|\/$/g,``)+`/`:``;for(let t of Object.keys(e))if(t.startsWith(i)&&(t.split(`/`).pop()||``)===`SKILL.md`){let e=t.replace(/\/SKILL\.md$/,``),r=e.split(`/`).pop()||e;n.push({name:r,path:e})}return{skills:n}}}let u=[];async function d(r){let i=`https://api.github.com/repos/${e}/${n}/contents/${r}`,s=l?`${i}?ref=${encodeURIComponent(l)}`:i,c=await o.request(s);if(c.status!==200)throw Error(a(c,`${e}/${n}${r?`/${r}`:``}`,o.hasToken));let f=t(c.body);for(let e of f)if(e.type===`file`&&e.name===`SKILL.md`){let t=e.path.replace(`/SKILL.md`,``),n=t.split(`/`).pop()||t;u.push({name:n,path:t})}else e.type===`dir`&&await d(e.path)}try{return await d(s||``),{skills:u}}catch(e){return{skills:[],error:e instanceof Error?e.message:String(e)}}}async function h(e,d,f,p,m,h,g=!1,_,v){try{let y=`${s}/${p}`;try{if(await m.stat(y),!g)return{stdout:``,stderr:`upskill: skill "${p}" already exists (use --force to overwrite)\n`,exitCode:1};await m.rm(y,{recursive:!0})}catch{}if(_){let t=await i(e,d,_,v);if(t.status===`ok`){let i=r(t.files),a=f.replace(/^\/|\/$/g,``)+`/`;if(await m.mkdir(y,{recursive:!0}),await n(i,a,y,m)>0)return await l(),await c(),{stdout:`Installed skill "${p}" from ${e}/${d}\n`,stderr:``,exitCode:0}}}let b=`https://api.github.com/repos/${e}/${d}/contents/${f}`,x=v?`${b}?ref=${encodeURIComponent(v)}`:b,S=await h.request(x);if(S.status!==200)return{stdout:``,stderr:`upskill: ${a(S,`${e}/${d}/${f}`,h.hasToken)}\n`,exitCode:1};let C=t(S.body);await m.mkdir(y,{recursive:!0});try{await o(C,y,e,d,v,m,h)}catch(e){try{await m.rm(y,{recursive:!0})}catch{}throw e}return await u(),{stdout:`Installed skill "${p}" from ${e}/${d}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`upskill: failed to install from GitHub: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function g(e){let t=e.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?(?:\/tree\/([^/]+?)(?:\/(.+?))?)?\/?$/);if(t)return{owner:t[1],repo:t[2],branch:t[3],path:t[4]};let n=e.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)(?:@([a-zA-Z0-9_./-]+))?$/);return n?{owner:n[1],repo:n[2],branch:n[3]}:null}export{p as a,g as i,h as n,d as o,m as r,u as s,f as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t}from"./binary-cache-bSOhqXB1.js";import{n,r,t as i}from"./fetch-body-DDu_AU5I.js";import{n as a}from"./fs-Y-fVUpZ9.js";import{r as o}from"./browser-BAL8RehA.js";import{t as s}from"./global-db-DJXlpNui.js";const c=`https://api.tessl.io`,l=`https://browse.sh/api/skills`,u=`/workspace/skills`,d=s,f=`application/vnd.github.v3+json`,p=`https://www.sliccy.com/skills/`,m=`${p}catalog.json`;function h(e,t){let n=e instanceof Error?e.message:String(e),r;try{r=new URL(t).host}catch{return n}return!r||n.includes(r)?n:`${n} (host: ${r} — network or CORS error)`}let g;function _(){return g||=a.create({dbName:d}),g}async function v(){try{return(await(await _()).readTextFile(`/workspace/.git/github-token`)).trim()||void 0}catch{return}}function y(e,t=f){let n={Accept:t,"User-Agent":`slicc-upskill`};return e&&(n.Authorization=`Bearer ${e}`),n}async function b(e){let t=await v();return{hasToken:!!t,request:async(n,r=f)=>{try{return await e(n,{headers:y(t,r)})}catch(e){throw Error(h(e,n))}}}}function x(e,t){if(!e)return;let n=t.toLowerCase();for(let[t,r]of Object.entries(e))if(t.toLowerCase()===n)return r}function S(e){let t=i(e);if(!t)return;try{let e=JSON.parse(t);if(typeof e.message==`string`&&e.message.trim())return e.message.trim()}catch{}let n=t.trim();if(n)return n.slice(0,200)}function C(e,t,n){let r=S(e.body),i=r?` GitHub said: ${r}`:``,a=x(e.headers,`retry-after`),o=x(e.headers,`x-ratelimit-remaining`),s=r?.toLowerCase()??``;if(e.status===429||o===`0`||s.includes(`rate limit`))return n?`GitHub rate-limited access to ${t} (HTTP ${e.status}). The configured github.token was used, so retry later${a?` after about ${a} seconds`:``}.${i}`:`GitHub rate-limited anonymous access to ${t} (HTTP ${e.status}). This often happens on shared VPNs or corporate egress IPs because unauthenticated GitHub API requests are limited per IP. Configure a token with: git config github.token <PAT>, then retry. You can also retry off VPN or later.${i}`;if(e.status===401)return n?`GitHub rejected the configured github.token while accessing ${t} (HTTP 401). Update it with: git config github.token <PAT>, then retry.${i}`:`GitHub requires authentication to access ${t} (HTTP 401). Configure a token with: git config github.token <PAT>, then retry.${i}`;if(e.status===404)return`GitHub could not find ${t} (HTTP 404). Check the repository, path, and permissions.${i}`;if(e.status===403)return n?`GitHub denied access to ${t} (HTTP 403). Check that your github.token can access this repository or retry later if GitHub is throttling requests.${i}`:`GitHub denied anonymous access to ${t} (HTTP 403). If this repo is public on a shared VPN, you may have hit GitHub's shared IP limit; otherwise the repository or path may require authentication. Configure a token with: git config github.token <PAT>, then retry.${i}`;let c=e.statusText?` ${e.statusText}`:``;return`GitHub request for ${t} failed (HTTP ${e.status}${c}).${i}`}var w=e({downloadGitHubDir:()=>O,fetchRepoZip:()=>T,stripZipPrefix:()=>E,writeZipFilesToDir:()=>D});async function T(e,r,i,a=`main`){let s=`https://codeload.github.com/${e}/${r}/zip/refs/heads/${a}`,c;try{c=await i(s,{headers:{"User-Agent":`slicc-upskill`}})}catch(e){return{status:`error`,message:h(e,s)}}if(c.status===404)return a===`main`?T(e,r,i,`master`):{status:`error`,message:`codeload returned HTTP 404`};if(c.status!==200)return{status:`error`,message:`codeload returned HTTP ${c.status}`};let l=t(s);l||=n(c.body);try{return{status:`ok`,files:o(l)}}catch(e){return{status:`error`,message:`failed to unzip: ${e instanceof Error?e.message:String(e)}`}}}function E(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.indexOf(`/`);if(e<0)continue;let i=n.slice(e+1);i&&(t[i]=r)}return t}async function D(e,t,n,r){let i=0;for(let[a,o]of Object.entries(e)){if(!a.startsWith(t))continue;let e=a.slice(t.length);if(!e||a.endsWith(`/`))continue;let s=`${n}/${e}`,c=s.substring(0,s.lastIndexOf(`/`));c!==n&&await r.mkdir(c,{recursive:!0}),await r.writeFile(s,o),i++}return i}async function O(e,n,i,a,o,s,c){for(let l of e)if(l.type===`file`&&l.download_url){let e=await c.request(l.download_url,`*/*`);if(e.status!==200)throw Error(C(e,`${i}/${a}/${l.path}`,c.hasToken));let r=t(l.download_url);await s.writeFile(`${n}/${l.name}`,r??e.body)}else if(l.type===`dir`){let e=`https://api.github.com/repos/${i}/${a}/contents/${l.path}`,t=o?`${e}?ref=${encodeURIComponent(o)}`:e,u=await c.request(t);if(u.status!==200)throw Error(C(u,`${i}/${a}/${l.path}`,c.hasToken));let d=r(u.body);await s.mkdir(`${n}/${l.name}`,{recursive:!0}),await O(d,`${n}/${l.name}`,i,a,o,s,c)}}export{D as a,h as c,p as d,m as f,E as i,l,T as n,C as o,c as p,w as r,b as s,O as t,u};
1
+ import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t}from"./binary-cache-bSOhqXB1.js";import{n,r,t as i}from"./fetch-body-DDu_AU5I.js";import{n as a}from"./fs-B-xI_nsy.js";import{r as o}from"./browser-BAL8RehA.js";import{t as s}from"./global-db-DJXlpNui.js";const c=`https://api.tessl.io`,l=`https://browse.sh/api/skills`,u=`/workspace/skills`,d=s,f=`application/vnd.github.v3+json`,p=`https://www.sliccy.com/skills/`,m=`${p}catalog.json`;function h(e,t){let n=e instanceof Error?e.message:String(e),r;try{r=new URL(t).host}catch{return n}return!r||n.includes(r)?n:`${n} (host: ${r} — network or CORS error)`}let g;function _(){return g||=a.create({dbName:d}),g}async function v(){try{return(await(await _()).readTextFile(`/workspace/.git/github-token`)).trim()||void 0}catch{return}}function y(e,t=f){let n={Accept:t,"User-Agent":`slicc-upskill`};return e&&(n.Authorization=`Bearer ${e}`),n}async function b(e){let t=await v();return{hasToken:!!t,request:async(n,r=f)=>{try{return await e(n,{headers:y(t,r)})}catch(e){throw Error(h(e,n))}}}}function x(e,t){if(!e)return;let n=t.toLowerCase();for(let[t,r]of Object.entries(e))if(t.toLowerCase()===n)return r}function S(e){let t=i(e);if(!t)return;try{let e=JSON.parse(t);if(typeof e.message==`string`&&e.message.trim())return e.message.trim()}catch{}let n=t.trim();if(n)return n.slice(0,200)}function C(e,t,n){let r=S(e.body),i=r?` GitHub said: ${r}`:``,a=x(e.headers,`retry-after`),o=x(e.headers,`x-ratelimit-remaining`),s=r?.toLowerCase()??``;if(e.status===429||o===`0`||s.includes(`rate limit`))return n?`GitHub rate-limited access to ${t} (HTTP ${e.status}). The configured github.token was used, so retry later${a?` after about ${a} seconds`:``}.${i}`:`GitHub rate-limited anonymous access to ${t} (HTTP ${e.status}). This often happens on shared VPNs or corporate egress IPs because unauthenticated GitHub API requests are limited per IP. Configure a token with: git config github.token <PAT>, then retry. You can also retry off VPN or later.${i}`;if(e.status===401)return n?`GitHub rejected the configured github.token while accessing ${t} (HTTP 401). Update it with: git config github.token <PAT>, then retry.${i}`:`GitHub requires authentication to access ${t} (HTTP 401). Configure a token with: git config github.token <PAT>, then retry.${i}`;if(e.status===404)return`GitHub could not find ${t} (HTTP 404). Check the repository, path, and permissions.${i}`;if(e.status===403)return n?`GitHub denied access to ${t} (HTTP 403). Check that your github.token can access this repository or retry later if GitHub is throttling requests.${i}`:`GitHub denied anonymous access to ${t} (HTTP 403). If this repo is public on a shared VPN, you may have hit GitHub's shared IP limit; otherwise the repository or path may require authentication. Configure a token with: git config github.token <PAT>, then retry.${i}`;let c=e.statusText?` ${e.statusText}`:``;return`GitHub request for ${t} failed (HTTP ${e.status}${c}).${i}`}var w=e({downloadGitHubDir:()=>O,fetchRepoZip:()=>T,stripZipPrefix:()=>E,writeZipFilesToDir:()=>D});async function T(e,r,i,a=`main`){let s=`https://codeload.github.com/${e}/${r}/zip/refs/heads/${a}`,c;try{c=await i(s,{headers:{"User-Agent":`slicc-upskill`}})}catch(e){return{status:`error`,message:h(e,s)}}if(c.status===404)return a===`main`?T(e,r,i,`master`):{status:`error`,message:`codeload returned HTTP 404`};if(c.status!==200)return{status:`error`,message:`codeload returned HTTP ${c.status}`};let l=t(s);l||=n(c.body);try{return{status:`ok`,files:o(l)}}catch(e){return{status:`error`,message:`failed to unzip: ${e instanceof Error?e.message:String(e)}`}}}function E(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.indexOf(`/`);if(e<0)continue;let i=n.slice(e+1);i&&(t[i]=r)}return t}async function D(e,t,n,r){let i=0;for(let[a,o]of Object.entries(e)){if(!a.startsWith(t))continue;let e=a.slice(t.length);if(!e||a.endsWith(`/`))continue;let s=`${n}/${e}`,c=s.substring(0,s.lastIndexOf(`/`));c!==n&&await r.mkdir(c,{recursive:!0}),await r.writeFile(s,o),i++}return i}async function O(e,n,i,a,o,s,c){for(let l of e)if(l.type===`file`&&l.download_url){let e=await c.request(l.download_url,`*/*`);if(e.status!==200)throw Error(C(e,`${i}/${a}/${l.path}`,c.hasToken));let r=t(l.download_url);await s.writeFile(`${n}/${l.name}`,r??e.body)}else if(l.type===`dir`){let e=`https://api.github.com/repos/${i}/${a}/contents/${l.path}`,t=o?`${e}?ref=${encodeURIComponent(o)}`:e,u=await c.request(t);if(u.status!==200)throw Error(C(u,`${i}/${a}/${l.path}`,c.hasToken));let d=r(u.body);await s.mkdir(`${n}/${l.name}`,{recursive:!0}),await O(d,`${n}/${l.name}`,i,a,o,s,c)}}export{D as a,h as c,p as d,m as f,E as i,l,T as n,C as o,c as p,w as r,b as s,O as t,u};