@github/copilot 0.0.348-6 → 0.0.348-7
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/index.js +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1966,7 +1966,7 @@ ${I}`;await r.logMCPSetup(e,s),this.logger.log(`Updated session log for ${e} wit
|
|
|
1966
1966
|
`).filter(Z=>Z.trim()),h=[];for(let Z=0;Z<p.length;Z++)try{let N=JSON.parse(p[Z]),y=t(N);h.push(y)}catch(N){throw new Error(`Invalid event at line ${Z+1} in ${u}: ${N}`)}return h}catch(b){throw new Error(`Failed to read JSONL from ${u}: ${b}`)}},append:async(d,u)=>{let b=r(u),p=Array.isArray(d)?d:[d];try{await QMt(b);let h=p.map(Z=>JSON.stringify(Z)).join(`
|
|
1967
1967
|
`)+`
|
|
1968
1968
|
`;await YVe.runExclusive(b,()=>j1n(b,h,{mode:384}))}catch(h){throw new Error(`Failed to append to JSONL file ${b}: ${h}`)}},path:r,directoryFiles:async()=>{let d=eN(l(),n());try{let b=(await yVe(d,{withFileTypes:!0})).filter(h=>h.isFile()&&h.name.endsWith(".jsonl")).map(h=>h.name),p=await Promise.all(b.map(async h=>{let Z=eN(d,h);try{let N=await EVe(Z);return{file:h,mtime:N.mtime}}catch{return{file:h,mtime:new Date}}}));return p.sort((h,Z)=>Z.mtime.getTime()-h.mtime.getTime()),p.map(h=>h.file)}catch{return[]}},directoryFilesWithMetadata:async()=>{let d=eN(l(),n());try{let b=(await yVe(d,{withFileTypes:!0})).filter(h=>h.isFile()&&h.name.endsWith(".jsonl")).map(h=>h.name),p=await Promise.all(b.map(async h=>{let Z=eN(d,h);try{let N=await EVe(Z);return{file:h,mtime:N.mtime,ctime:N.ctime}}catch{return{file:h,mtime:new Date,ctime:new Date}}}));return p.sort((h,Z)=>Z.mtime.getTime()-h.mtime.getTime()),p}catch{return[]}},home:l,directory:n}};var vMt=Dl({host:Rt(),login:Rt()}),lVn=Dl({banner:_g(["always","once","never"]).optional(),beep:Yo().optional(),last_logged_in_user:vMt.optional(),logged_in_users:Jd(vMt).optional(),model:Rt().optional(),render_markdown:Yo().optional(),screen_reader:Yo().optional(),theme:Rt().optional(),trusted_folders:Jd(Rt()).optional(),store_token_plaintext:Yo().optional(),stream:Yo().optional(),feature_flags:Dl({enabled:Jd(Rt()).optional()}).optional(),asked_setup_terminals:Jd(Rt()).optional(),capi_hmac_key:Rt().optional(),copilot_hmac_key:Rt().optional(),copilot_integration_id:Rt().optional(),copilot_tokens:x2(Rt(),Rt()).optional(),copilot_url:Rt().optional(),staff:Yo().optional(),log_level:_g(["none","error","warning","info","debug","all","default"]).optional()}),nVn=x2(Rt(),wje()),rVn=nVn.transform(t=>(0,fMt.default)(t,(e,l)=>{let n=l.toLowerCase();return n==="github_copilot_integration_id"?"copilot_integration_id":n})),IVn=rVn.pipe(lVn),kr=wVe(IVn.parse,"config");c();function rL(){return process.env.COPILOT_ENABLE_ALT_PROVIDERS==="true"}var YO=["claude-sonnet-4.5","claude-sonnet-4","claude-haiku-4.5","gpt-5"];function HMt(t,e){let l=" ".repeat(e);return t.map(n=>`${l}- "${n}"`).join(`
|
|
1969
|
-
`)}function k8(t){return YO.includes(t)||rL()}function RO(t,e){if(!e)return!0;let l=e.find(n=>n.id===t);return l?l.policy?l.policy.state!=="disabled":!0:!1}function p8e(t){return YO.find(e=>RO(e,t))}function L8(t,e){if(e&&e.length>0){let n=e.find(r=>r.id===t);if(n?.billing?.multiplier!==void 0)return n.billing.multiplier}return{"claude-sonnet-4":1,"gpt-5":1,"claude-sonnet-4.5":1,"claude-haiku-4.5":.33}[t]??1}async function VO(t,e,l,n){if(rL()&&process.env.COPILOT_AGENT_MODEL){let{model:a}=Lj(process.env.COPILOT_AGENT_MODEL);if(a)return a}if(t){if(RO(t,l))return t;n?.warning(`Model '${t}' from CLI argument is not available. Falling back to next option.`)}if(e){let a=await e?.getSelectedModel?.();if(a){if(RO(a,l))return a;n?.warning(`Model '${a}' from session is not available. Falling back to next option.`)}}let r=process.env.COPILOT_MODEL;if(r&&k8(r)){if(RO(r,l))return r;n?.warning(`Model '${r}' from COPILOT_MODEL environment variable is not available. Falling back to next option.`)}try{let s=(await kr.load()||{}).model;if(typeof s=="string"&&s&&k8(s)){if(RO(s,l))return s;n?.warning(`Model '${s}' from config file is not available. Falling back to default.`)}}catch{}let I=p8e(l);return I&&n?.info(`Using default model: ${I}`),I}c();function Yw(t){return"host"in t?t.host:"https://github.com"}function FVe(t){return M2(t,{onHMACAuthInfo:()=>"Logged in with HMAC",onEnvAuthInfo:e=>`Logged in with ${e.envVar} as user: ${e.login}`,onUserAuthInfo:e=>`Logged in as user: ${Iue(e)}`,onGhCliAuthInfo:e=>`Logged in with gh as user: ${Iue(e)}`,onApiKeyAuthInfo:e=>`Logged in with API key to ${e.host}`})}function aue(t){return M2(t,{onHMACAuthInfo:()=>"Unknown (via HMAC)",onEnvAuthInfo:e=>`${e.login} (via ${e.envVar})`,onUserAuthInfo:e=>Iue(e),onGhCliAuthInfo:e=>`${e.login} (via gh)`,onApiKeyAuthInfo:e=>`${e.host} (via API key)`})}function h8e(t,e){return M2(t,{onHMACAuthInfo:l=>e.type==="hmac"&&l.hmac===e.hmac,onEnvAuthInfo:l=>e.type==="env"&&l.envVar===e.envVar&&l.login===e.login,onUserAuthInfo:l=>e.type==="user"&&wO(l,e),onGhCliAuthInfo:l=>e.type==="gh-cli"&&wO(l,e),onApiKeyAuthInfo:l=>e.type==="api-key"&&l.host===e.host&&l.apiKey===e.apiKey})}async function XMt(t,e){let l=await t.getAllAuthAvailable(),n=">",r="-";return l.map(I=>`${e&&h8e(I.authInfo,e)?n:r} ${aue(I.authInfo)}`)}function Iue(t){return t.host!==tL?`${t.login} (${t.host})`:t.login}async function kMt(){let t=await kr.load()||{};return t?.last_logged_in_user??t.logged_in_users?.[0]??void 0}async function A8e(t){await kr.writeKey("last_logged_in_user",t)}async function CVe(){return(await kr.load()||{}).logged_in_users||[]}async function LMt(t,e){await kr.writeKey("last_logged_in_user",t),await kr.writeKey("logged_in_users",e)}async function JMt(t){let e=await CVe();return e.some(n=>wO(n,t))?(e=e.filter(n=>!wO(n,t)),await LMt(void 0,e),e.length>0):!1}async function xMt(t){let e=await CVe();e.some(n=>wO(n,t))||(e.push(t),await LMt(t,e))}function wO(t,e){return t.login===e.login&&t.host===e.host}c();async function SMt(t,e){try{let l=aVn(),n=await e.execReturn("gh",["auth","token","--hostname",l],{silent:!0,ignoreReturnCode:!0});if(n.exitCode!==0||!n.stdout.trim()){let I=`Failed to retrieve GitHub token from CLI (exit code: ${n.exitCode})`,a=n.stderr?.trim();return a?t.debug(`${I}: ${a}`):t.debug(I),null}let r=n.stdout.trim();return r.startsWith("ghp_")?(t.debug("GitHub token is a classic PAT"),null):(t.debug("GitHub CLI authenticated with valid token"),{token:r,host:l})}catch(l){let n=`Error checking GitHub CLI: ${l}`;return l&&typeof l=="object"&&"stderr"in l&&typeof l.stderr=="string"&&(n+=` (stderr: ${l.stderr.trim()})`),t.debug(n),null}}function aVn(){return process.env.GH_HOST||"github.com"}function Z8e(){let t=process.env.GH_HOST;return t?t.startsWith("https://")?t:`https://${t}`:tL}c();import{existsSync as TMt}from"fs";var vVe="copilot-cli",fVe;async function HVe(){if(fVe)return fVe;let t=await Promise.resolve().then(()=>lt(OMt(),1));return fVe=t.default||t,fVe}var oue=(t,e)=>{if(!(!t||!e))return`${t}:${e}`},iVn=()=>{let t=new Map,e=async(o,d)=>{let u=oue(o,d);if(u)if(TMt(kr.path()))try{let h=(await kr.load())?.copilot_tokens?.[u];t.set(u,h&&h.trim()!==""?h:void 0)}catch{t.set(u,void 0)}else t.set(u,void 0)},l=async()=>{if(TMt(kr.path()))try{let d=(await kr.load())?.copilot_tokens;if(d){let u=Object.values(d).filter(b=>b&&b.trim()!=="");if(u.length>0)return u[0]}}catch{return}},n=async(o,d)=>{let u=oue(o,d);if(!u)return;if(t.has(u))return t.get(u);if((await kr.load())?.store_token_plaintext)return await e(o,d),t.get(u);try{let h=await(await HVe()).getPassword(vVe,u);h?t.set(u,h):await e(o,d)}catch{await e(o,d)}return t.get(u)},r=async()=>{if(t.size>0)return t.values().next().value;if((await kr.load())?.store_token_plaintext)return await l();let d;try{d=await(await HVe()).findPassword(vVe)}catch{}return d||(d=await l()),d},I=async(o,d)=>{let u=oue(o,d);if(u){t.delete(u);try{return(await HVe()).deletePassword(vVe,u)}catch{let h=(await kr.load())?.copilot_tokens??{};return delete h[u],await kr.writeKey("copilot_tokens",h),Promise.resolve(!0)}}},a=async(o,d,u)=>{if(!o)throw new Error("No token provided to store");let b=oue(d,u);if(!b)return;if(t.set(b,o),(await kr.load())?.store_token_plaintext)return await s(d,u),!0;try{return await(await HVe()).setPassword(vVe,b,o),!0}catch{return!1}},s=async(o,d)=>{let u=oue(o,d);if(!u)return;let b=t.get(u);if(!b)return;let h=(await kr.load())?.copilot_tokens??{};h[u]=b,await kr.writeKey("copilot_tokens",h)};return{getToken:n,getAnyToken:r,removeToken:I,storeToken:a,storeCurrentTokenInConfig:s}},lf=iVn();function M2(t,e){switch(t.type){case"hmac":return e.onHMACAuthInfo(t);case"env":return e.onEnvAuthInfo(t);case"user":return e.onUserAuthInfo(t);case"gh-cli":return e.onGhCliAuthInfo(t);case"api-key":return e.onApiKeyAuthInfo(t);default:{let l=t;throw new Error(`unexpected auth info type: ${JSON.stringify(t)}`)}}}async function zW(t){return await M2(t,{onHMACAuthInfo:async()=>{},onEnvAuthInfo:async e=>e.token,onUserAuthInfo:async e=>await lf.getToken(e.host,e.login)||void 0,onGhCliAuthInfo:async e=>e.token,onApiKeyAuthInfo:async()=>{}})}var g8e=class{currentAuthInfo=null;logger=new Hc;authCallbacks=[];setLogger(e){this.logger=e}onAuthChange(e){this.authCallbacks.push(e)}removeAuthCallback(e){let l=this.authCallbacks.indexOf(e);l>-1&&this.authCallbacks.splice(l,1)}async notifyAuthChange(e,l){this.currentAuthInfo=e;for(let n of this.authCallbacks)try{await n(e,l)}catch(r){this.logger.error(`Error in auth change callback: ${r}`)}}async tryHMACLogin(){let e=await kr.load()||{},l=e.copilot_hmac_key||e.capi_hmac_key||process.env.CAPI_HMAC_KEY||process.env.COPILOT_HMAC_KEY;return l?[{authInfo:{type:"hmac",hmac:l}}]:[]}async tryGitHubTokenLogin(){let e=process.env.GH_TOKEN||process.env.GITHUB_TOKEN;if(!e)return[];if(e.startsWith("ghp_"))return this.logger.error("Classic PATs are not supported. Please use fine-grained PATs or other supported token types."),[];if(!e.startsWith("gho_")&&!e.startsWith("ghu_")&&!e.startsWith("github_pat_"))return this.logger.error("Unsupported token type, ignoring."),[];let l=Z8e();try{let n=await F8(l,e);return[{authInfo:{type:"env",host:l,login:n,token:e,envVar:process.env.GH_TOKEN?"GH_TOKEN":"GITHUB_TOKEN"},token:e}]}catch(n){n instanceof eL?this.logger.error(`Failed to fetch PAT user login (${n.status}): ${n.message}`):this.logger.error("Failed to fetch PAT user login")}return[]}async tryGhCliTokenLogin(){let e=new rW(this.logger),l=await SMt(this.logger,e);if(!l)return[];let{token:n,host:r}=l;try{let I=r.startsWith("https://")?r:`https://${r}`,a=await F8(I,n);return[{authInfo:{type:"gh-cli",host:I,login:a,token:n},token:n}]}catch(I){I instanceof eL?this.logger.error(`Failed to fetch GitHub CLI user login (${I.status}): ${I.message}`):this.logger.error("Failed to fetch GitHub CLI user login")}return[]}async tryApiKeyLogin(){if(!rL())return[];let e=process.env.ANTHROPIC_API_KEY||process.env.AZURE_OPENAI_API_KEY,l=process.env.ANTHROPIC_API_KEY?"https://api.anthropic.com":process.env.AZURE_OPENAI_API_KEY?process.env.AZURE_OPENAI_API_ENDPOINT||process.env.OPENAI_BASE_URL||"https://api.openai.com":void 0;return!e||!l?[]:[{authInfo:{type:"api-key",apiKey:e,host:l}}]}async tryLoginToken(){let e=await kMt(),l;if(e){if(l=await lf.getToken(e.host,e.login),!l||l.trim()==="")return[]}else{if(l=await lf.getAnyToken(),!l||l.trim()==="")return[];let n=Z8e();e={host:n,login:await F8(n,l)}}return[{authInfo:{type:"user",host:e.host,login:e.login},token:l}]}async getAllGitHubLoginTokens(){let l=(await this.tryGitHubTokenLogin()).at(0),n=await CVe(),r=[];for(let I of n){if(l?.authInfo.type==="user"&&wO(I,l.authInfo))continue;let a=await lf.getToken(I.host,I.login);a&&r.push({authInfo:{type:"user",host:I.host,login:I.login},token:a})}return r}async getAllAuthAvailable(){let e=[],l=this.getPrioritizedAuthMethods(!0);for(let n of l){let r=await n();e.push(...r)}return e}getPrioritizedAuthMethods(e){return[this.tryHMACLogin.bind(this),this.tryApiKeyLogin.bind(this),this.tryGitHubTokenLogin.bind(this),e?this.getAllGitHubLoginTokens.bind(this):this.tryLoginToken.bind(this),this.tryGhCliTokenLogin.bind(this)]}async loadAuthInfo(){let e=this.currentAuthInfo!==null;this.currentAuthInfo=null;let l=this.getPrioritizedAuthMethods(!1);for(let n of l){let r=await n();if(r.length>0){let{authInfo:I,token:a}=r[0];I.type==="user"&&A8e({host:I.host,login:I.login}),this.currentAuthInfo=I,e||await this.notifyAuthChange(I,a);return}}}async getCurrentAuthInfo(){return this.currentAuthInfo||await this.loadAuthInfo(),this.currentAuthInfo}async loginUser(e,l){let n={host:e,login:l},r={type:"user",...n};await xMt(n);let I=await zW(r);await this.notifyAuthChange(r,I)}async switchToAuth(e){this.currentAuthInfo=e.authInfo,e.authInfo.type==="user"&&await A8e({host:e.authInfo.host,login:e.authInfo.login}),await this.notifyAuthChange(e.authInfo,e.token)}async logout(){if(!this.currentAuthInfo)return!1;let e=await M2(this.currentAuthInfo,{onHMACAuthInfo:async()=>!1,onEnvAuthInfo:async()=>!1,onUserAuthInfo:async l=>(await lf.removeToken(l.host,l.login),await JMt(l)),onGhCliAuthInfo:async()=>!1,onApiKeyAuthInfo:async()=>!1});return await this.notifyAuthChange(null),e}},cVn=new g8e,XVe=cVn;var nf=class t extends tue{constructor(l,n,r,I){super(l,n,I,"direct");this.exec=r}static GITHUB_SERVER_NAME="github-mcp-server";static BUILTIN_SERVERS=[t.GITHUB_SERVER_NAME];static getBuiltInServerNames(){return[...t.BUILTIN_SERVERS]}hasUserConfiguredGitHubServer=!1;lastGitHubAuthInfo=null;githubMcpToken;async configureGitHubAuth(l){if(this.isServerDisabled(t.GITHUB_SERVER_NAME))return this.logger.debug("GitHub MCP server is disabled, skipping auto-configuration"),!1;if(this.hasUserConfiguredGitHubServer)return this.logger.debug("User has explicitly configured github-mcp-server, ignoring auth changes"),!1;if(await this.shouldHandleGitHubAuth(l)){let r=await zW(l);if(!r)return this.logger.debug("No token available for GitHub authentication"),!1;if(this.lastGitHubAuthInfo=l,r===this.githubMcpToken)return!1;this.githubMcpToken=r;let I=await this.createGitHubServerConfig(r,l);try{return await this.restartServer(t.GITHUB_SERVER_NAME,I),this.logger.log("GitHub MCP server configured after authentication"),!0}catch(a){return this.logger.error(`Failed to configure GitHub MCP server after auth: ${a}`),!1}}return!1}async removeGitHubAuth(){if(this.hasUserConfiguredGitHubServer)return this.logger.debug("User has explicitly configured github-mcp-server, ignoring auth changes"),!1;this.githubMcpToken=void 0;try{return this.isServerRunning(t.GITHUB_SERVER_NAME)?(await this.stopServer(t.GITHUB_SERVER_NAME),this.logger.debug("Removed GitHub MCP server"),!0):!1}catch(l){return this.logger.error(`Failed to remove GitHub server: ${l}`),!1}}async shouldHandleGitHubAuth(l){return await M2(l,{onHMACAuthInfo:async()=>!1,onEnvAuthInfo:async()=>!0,onUserAuthInfo:async()=>!0,onGhCliAuthInfo:async()=>!0,onApiKeyAuthInfo:async()=>!1})}async createGitHubServerConfig(l,n){let r="https://api.githubcopilot.com/mcp/readonly";try{let I=await M2(n,{onHMACAuthInfo:async()=>"https://github.com",onEnvAuthInfo:async s=>s.host,onUserAuthInfo:async s=>s.host,onGhCliAuthInfo:async s=>s.host,onApiKeyAuthInfo:async s=>s.host}),a=await o0(I,l);r=new URL("/mcp/readonly",a).toString(),this.logger.log(`Using Copilot API endpoint: ${r}`)}catch(I){this.logger.error(`Failed to fetch Copilot URL, using default: ${I}`)}return{type:"http",url:r,headers:{Authorization:"Bearer "+l,"X-MCP-Toolsets":"repos,issues,users,pull_requests,code_security,secret_protection,actions,web_search","X-MCP-Host":"copilot-cli"},tools:["*"],isDefaultServer:!0,filterMapping:{get_issue:"markdown",get_issue_comments:"markdown",get_pull_request:"markdown",get_pull_request_comments:"markdown",get_pull_request_reviews:"markdown"}}}async injectDefaultServers(l){if(l.mcpServers[t.GITHUB_SERVER_NAME]){this.hasUserConfiguredGitHubServer=!0,this.logger.debug("User has already configured github-mcp-server, skipping auto-configuration");return}}async startBuiltInServer(l){l===t.GITHUB_SERVER_NAME&&!this.hasUserConfiguredGitHubServer?this.lastGitHubAuthInfo?(this.logger.log("Attempting to configure GitHub MCP server using stored authentication"),await this.configureGitHubAuth(this.lastGitHubAuthInfo)?this.logger.log("GitHub MCP server configured successfully after enabling"):this.logger.log("GitHub MCP server enabled but could not be configured - authentication may be invalid or insufficient")):this.logger.log("GitHub MCP server enabled - will be configured automatically when authentication becomes available"):await super.startBuiltInServer(l)}};c();c();var dVn=Dl({commandHistory:Jd(Rt())}),N8e=QVe(dVn.parse,"command-history");var uVn=50,W8e=class{commandHistory=[];historyIndex=-1;isNavigatingHistory=!1;unSubmittedCommand=null;async initialize(){try{let e=await N8e.load();this.commandHistory=e?.commandHistory||[],this.resetNavigation()}catch{this.commandHistory=[]}}async addCommand(e){this.commandHistory=this.commandHistory.filter(l=>l!==e),this.commandHistory.unshift(e),this.commandHistory=this.commandHistory.slice(0,uVn),this.resetNavigation(),this.unSubmittedCommand=null,await this.saveHistory()}async updateCurrentCommand(e){this.historyIndex!==-1?(this.commandHistory[this.historyIndex]=e,await this.saveHistory()):this.unSubmittedCommand=e}navigateUp(e){if(this.commandHistory.length===0)return;let l=this.historyIndex+1;if(l<this.commandHistory.length){this.historyIndex=l,this.isNavigatingHistory=!0;let n=this.getCurrentHistoryItem();n&&e.setText(n)}}navigateDown(e){if(this.historyIndex===-1)return;if(this.historyIndex===0)this.resetNavigation();else{let n=this.historyIndex-1;this.historyIndex=n,this.isNavigatingHistory=!0}let l=this.getCurrentHistoryItem();l?(e.setText(l),e.setCursorPosition(0)):e.clear()}resetNavigation(){this.historyIndex=-1,this.isNavigatingHistory=!1}getHistoryIndex(){return this.historyIndex}getHistory(){return this.commandHistory}getCurrentHistoryItem(){return this.historyIndex===-1?this.unSubmittedCommand?this.unSubmittedCommand:void 0:this.commandHistory[this.historyIndex]}isNavigating(){return this.isNavigatingHistory}setNavigating(e){this.isNavigatingHistory=e}async saveHistory(){try{await N8e.write({commandHistory:this.commandHistory})}catch{}}},_2=new W8e;c();c();function MMt(t,e){var l=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),l.push.apply(l,n)}return l}function _Mt(t){for(var e=1;e<arguments.length;e++){var l=arguments[e]!=null?arguments[e]:{};e%2?MMt(Object(l),!0).forEach(function(n){mVn(t,n,l[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(l)):MMt(Object(l)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(l,n))})}return t}function mVn(t,e,l){return e=bVn(e),e in t?Object.defineProperty(t,e,{value:l,enumerable:!0,configurable:!0,writable:!0}):t[e]=l,t}function bVn(t){var e=GVn(t,"string");return typeof e=="symbol"?e:String(e)}function GVn(t,e){if(typeof t!="object"||t===null)return t;var l=t[Symbol.toPrimitive];if(l!==void 0){var n=l.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pVn=zMt({}),DMt=pVn;function zMt(t){return e.withOptions=l=>zMt(_Mt(_Mt({},t),l)),e;function e(l,...n){let r=typeof l=="string"?[l]:l.raw,{escapeSpecialCharacters:I=Array.isArray(l),trimWhitespace:a=!0}=t,s="";for(let u=0;u<r.length;u++){let b=r[u];I&&(b=b.replace(/\\\n[ \t]*/g,"").replace(/\\`/g,"`").replace(/\\\$/g,"$").replace(/\\\{/g,"{")),s+=b,u<n.length&&(s+=n[u])}let o=s.split(`
|
|
1969
|
+
`)}function k8(t){return YO.includes(t)||rL()}function RO(t,e){if(!e)return!0;let l=e.find(n=>n.id===t);return l?l.policy?l.policy.state!=="disabled":!0:!1}function p8e(t){return YO.find(e=>RO(e,t))}function L8(t,e){if(e&&e.length>0){let n=e.find(r=>r.id===t);if(n?.billing?.multiplier!==void 0)return n.billing.multiplier}return{"claude-sonnet-4":1,"gpt-5":1,"claude-sonnet-4.5":1,"claude-haiku-4.5":.33}[t]??1}async function VO(t,e,l,n){if(rL()&&process.env.COPILOT_AGENT_MODEL){let{model:a}=Lj(process.env.COPILOT_AGENT_MODEL);if(a)return a}if(t){if(RO(t,l))return t;n?.warning(`Model '${t}' from CLI argument is not available. Falling back to next option.`)}if(e){let a=await e?.getSelectedModel?.();if(a){if(RO(a,l))return a;n?.warning(`Model '${a}' from session is not available. Falling back to next option.`)}}let r=process.env.COPILOT_MODEL;if(r&&k8(r)){if(RO(r,l))return r;n?.warning(`Model '${r}' from COPILOT_MODEL environment variable is not available. Falling back to next option.`)}try{let s=(await kr.load()||{}).model;if(typeof s=="string"&&s&&k8(s)){if(RO(s,l))return s;n?.warning(`Model '${s}' from config file is not available. Falling back to default.`)}}catch{}let I=p8e(l);return I&&n?.info(`Using default model: ${I}`),I}c();function Yw(t){return"host"in t?t.host:"https://github.com"}function FVe(t){return M2(t,{onHMACAuthInfo:()=>"Logged in with HMAC",onEnvAuthInfo:e=>`Logged in with ${e.envVar} as user: ${e.login}`,onUserAuthInfo:e=>`Logged in as user: ${Iue(e)}`,onGhCliAuthInfo:e=>`Logged in with gh as user: ${Iue(e)}`,onApiKeyAuthInfo:e=>`Logged in with API key to ${e.host}`})}function aue(t){return M2(t,{onHMACAuthInfo:()=>"Unknown (via HMAC)",onEnvAuthInfo:e=>`${e.login} (via ${e.envVar})`,onUserAuthInfo:e=>Iue(e),onGhCliAuthInfo:e=>`${e.login} (via gh)`,onApiKeyAuthInfo:e=>`${e.host} (via API key)`})}function h8e(t,e){return M2(t,{onHMACAuthInfo:l=>e.type==="hmac"&&l.hmac===e.hmac,onEnvAuthInfo:l=>e.type==="env"&&l.envVar===e.envVar&&l.login===e.login,onUserAuthInfo:l=>e.type==="user"&&wO(l,e),onGhCliAuthInfo:l=>e.type==="gh-cli"&&wO(l,e),onApiKeyAuthInfo:l=>e.type==="api-key"&&l.host===e.host&&l.apiKey===e.apiKey})}async function XMt(t,e){let l=await t.getAllAuthAvailable(),n=">",r="-";return l.map(I=>`${e&&h8e(I.authInfo,e)?n:r} ${aue(I.authInfo)}`)}function Iue(t){return t.host!==tL?`${t.login} (${t.host})`:t.login}async function kMt(){let t=await kr.load()||{};return t?.last_logged_in_user??t.logged_in_users?.[0]??void 0}async function A8e(t){await kr.writeKey("last_logged_in_user",t)}async function CVe(){return(await kr.load()||{}).logged_in_users||[]}async function LMt(t,e){await kr.writeKey("last_logged_in_user",t),await kr.writeKey("logged_in_users",e)}async function JMt(t){let e=await CVe();return e.some(n=>wO(n,t))?(e=e.filter(n=>!wO(n,t)),await LMt(void 0,e),e.length>0):!1}async function xMt(t){let e=await CVe();e.some(n=>wO(n,t))||(e.push(t),await LMt(t,e))}function wO(t,e){return t.login===e.login&&t.host===e.host}c();async function SMt(t,e){try{let l=aVn(),n=await e.execReturn("gh",["auth","token","--hostname",l],{silent:!0,ignoreReturnCode:!0});if(n.exitCode!==0||!n.stdout.trim()){let I=`Failed to retrieve GitHub token from CLI (exit code: ${n.exitCode})`,a=n.stderr?.trim();return a?t.debug(`${I}: ${a}`):t.debug(I),null}let r=n.stdout.trim();return r.startsWith("ghp_")?(t.debug("GitHub token is a classic PAT"),null):(t.debug("GitHub CLI authenticated with valid token"),{token:r,host:l})}catch(l){let n=`Error checking GitHub CLI: ${l}`;return l&&typeof l=="object"&&"stderr"in l&&typeof l.stderr=="string"&&(n+=` (stderr: ${l.stderr.trim()})`),t.debug(n),null}}function aVn(){return process.env.GH_HOST||"github.com"}function Z8e(){let t=process.env.GH_HOST;return t?t.startsWith("https://")?t:`https://${t}`:tL}c();import{existsSync as TMt}from"fs";var vVe="copilot-cli",fVe;async function HVe(){if(fVe)return fVe;let t=await Promise.resolve().then(()=>lt(OMt(),1));return fVe=t.default||t,fVe}var oue=(t,e)=>{if(!(!t||!e))return`${t}:${e}`},iVn=()=>{let t=new Map,e=async(o,d)=>{let u=oue(o,d);if(u)if(TMt(kr.path()))try{let h=(await kr.load())?.copilot_tokens?.[u];t.set(u,h&&h.trim()!==""?h:void 0)}catch{t.set(u,void 0)}else t.set(u,void 0)},l=async()=>{if(TMt(kr.path()))try{let d=(await kr.load())?.copilot_tokens;if(d){let u=Object.values(d).filter(b=>b&&b.trim()!=="");if(u.length>0)return u[0]}}catch{return}},n=async(o,d)=>{let u=oue(o,d);if(!u)return;if(t.has(u))return t.get(u);if((await kr.load())?.store_token_plaintext)return await e(o,d),t.get(u);try{let h=await(await HVe()).getPassword(vVe,u);h?t.set(u,h):await e(o,d)}catch{await e(o,d)}return t.get(u)},r=async()=>{if(t.size>0)return t.values().next().value;if((await kr.load())?.store_token_plaintext)return await l();let d;try{d=await(await HVe()).findPassword(vVe)}catch{}return d||(d=await l()),d},I=async(o,d)=>{let u=oue(o,d);if(u){t.delete(u);try{return(await HVe()).deletePassword(vVe,u)}catch{let h=(await kr.load())?.copilot_tokens??{};return delete h[u],await kr.writeKey("copilot_tokens",h),Promise.resolve(!0)}}},a=async(o,d,u)=>{if(!o)throw new Error("No token provided to store");let b=oue(d,u);if(!b)return;if(t.set(b,o),(await kr.load())?.store_token_plaintext)return await s(d,u),!0;try{return await(await HVe()).setPassword(vVe,b,o),!0}catch{return!1}},s=async(o,d)=>{let u=oue(o,d);if(!u)return;let b=t.get(u);if(!b)return;let h=(await kr.load())?.copilot_tokens??{};h[u]=b,await kr.writeKey("copilot_tokens",h)};return{getToken:n,getAnyToken:r,removeToken:I,storeToken:a,storeCurrentTokenInConfig:s}},lf=iVn();function M2(t,e){switch(t.type){case"hmac":return e.onHMACAuthInfo(t);case"env":return e.onEnvAuthInfo(t);case"user":return e.onUserAuthInfo(t);case"gh-cli":return e.onGhCliAuthInfo(t);case"api-key":return e.onApiKeyAuthInfo(t);default:{let l=t;throw new Error(`unexpected auth info type: ${JSON.stringify(t)}`)}}}async function zW(t){return await M2(t,{onHMACAuthInfo:async()=>process.env.GITHUB_MCP_SERVER_TOKEN,onEnvAuthInfo:async e=>e.token,onUserAuthInfo:async e=>await lf.getToken(e.host,e.login)||void 0,onGhCliAuthInfo:async e=>e.token,onApiKeyAuthInfo:async()=>{}})}var g8e=class{currentAuthInfo=null;logger=new Hc;authCallbacks=[];setLogger(e){this.logger=e}onAuthChange(e){this.authCallbacks.push(e)}removeAuthCallback(e){let l=this.authCallbacks.indexOf(e);l>-1&&this.authCallbacks.splice(l,1)}async notifyAuthChange(e,l){this.currentAuthInfo=e;for(let n of this.authCallbacks)try{await n(e,l)}catch(r){this.logger.error(`Error in auth change callback: ${r}`)}}async tryHMACLogin(){let e=await kr.load()||{},l=e.copilot_hmac_key||e.capi_hmac_key||process.env.CAPI_HMAC_KEY||process.env.COPILOT_HMAC_KEY;return l?[{authInfo:{type:"hmac",hmac:l}}]:[]}async tryGitHubTokenLogin(){let e=process.env.GH_TOKEN||process.env.GITHUB_TOKEN;if(!e)return[];if(e.startsWith("ghp_"))return this.logger.error("Classic PATs are not supported. Please use fine-grained PATs or other supported token types."),[];if(!e.startsWith("gho_")&&!e.startsWith("ghu_")&&!e.startsWith("github_pat_"))return this.logger.error("Unsupported token type, ignoring."),[];let l=Z8e();try{let n=await F8(l,e);return[{authInfo:{type:"env",host:l,login:n,token:e,envVar:process.env.GH_TOKEN?"GH_TOKEN":"GITHUB_TOKEN"},token:e}]}catch(n){n instanceof eL?this.logger.error(`Failed to fetch PAT user login (${n.status}): ${n.message}`):this.logger.error("Failed to fetch PAT user login")}return[]}async tryGhCliTokenLogin(){let e=new rW(this.logger),l=await SMt(this.logger,e);if(!l)return[];let{token:n,host:r}=l;try{let I=r.startsWith("https://")?r:`https://${r}`,a=await F8(I,n);return[{authInfo:{type:"gh-cli",host:I,login:a,token:n},token:n}]}catch(I){I instanceof eL?this.logger.error(`Failed to fetch GitHub CLI user login (${I.status}): ${I.message}`):this.logger.error("Failed to fetch GitHub CLI user login")}return[]}async tryApiKeyLogin(){if(!rL())return[];let e=process.env.ANTHROPIC_API_KEY||process.env.AZURE_OPENAI_API_KEY,l=process.env.ANTHROPIC_API_KEY?"https://api.anthropic.com":process.env.AZURE_OPENAI_API_KEY?process.env.AZURE_OPENAI_API_ENDPOINT||process.env.OPENAI_BASE_URL||"https://api.openai.com":void 0;return!e||!l?[]:[{authInfo:{type:"api-key",apiKey:e,host:l}}]}async tryLoginToken(){let e=await kMt(),l;if(e){if(l=await lf.getToken(e.host,e.login),!l||l.trim()==="")return[]}else{if(l=await lf.getAnyToken(),!l||l.trim()==="")return[];let n=Z8e();e={host:n,login:await F8(n,l)}}return[{authInfo:{type:"user",host:e.host,login:e.login},token:l}]}async getAllGitHubLoginTokens(){let l=(await this.tryGitHubTokenLogin()).at(0),n=await CVe(),r=[];for(let I of n){if(l?.authInfo.type==="user"&&wO(I,l.authInfo))continue;let a=await lf.getToken(I.host,I.login);a&&r.push({authInfo:{type:"user",host:I.host,login:I.login},token:a})}return r}async getAllAuthAvailable(){let e=[],l=this.getPrioritizedAuthMethods(!0);for(let n of l){let r=await n();e.push(...r)}return e}getPrioritizedAuthMethods(e){return[this.tryHMACLogin.bind(this),this.tryApiKeyLogin.bind(this),this.tryGitHubTokenLogin.bind(this),e?this.getAllGitHubLoginTokens.bind(this):this.tryLoginToken.bind(this),this.tryGhCliTokenLogin.bind(this)]}async loadAuthInfo(){let e=this.currentAuthInfo!==null;this.currentAuthInfo=null;let l=this.getPrioritizedAuthMethods(!1);for(let n of l){let r=await n();if(r.length>0){let{authInfo:I,token:a}=r[0];I.type==="user"&&A8e({host:I.host,login:I.login}),this.currentAuthInfo=I,e||await this.notifyAuthChange(I,a);return}}}async getCurrentAuthInfo(){return this.currentAuthInfo||await this.loadAuthInfo(),this.currentAuthInfo}async loginUser(e,l){let n={host:e,login:l},r={type:"user",...n};await xMt(n);let I=await zW(r);await this.notifyAuthChange(r,I)}async switchToAuth(e){this.currentAuthInfo=e.authInfo,e.authInfo.type==="user"&&await A8e({host:e.authInfo.host,login:e.authInfo.login}),await this.notifyAuthChange(e.authInfo,e.token)}async logout(){if(!this.currentAuthInfo)return!1;let e=await M2(this.currentAuthInfo,{onHMACAuthInfo:async()=>!1,onEnvAuthInfo:async()=>!1,onUserAuthInfo:async l=>(await lf.removeToken(l.host,l.login),await JMt(l)),onGhCliAuthInfo:async()=>!1,onApiKeyAuthInfo:async()=>!1});return await this.notifyAuthChange(null),e}},cVn=new g8e,XVe=cVn;var nf=class t extends tue{constructor(l,n,r,I){super(l,n,I,"direct");this.exec=r}static GITHUB_SERVER_NAME="github-mcp-server";static BUILTIN_SERVERS=[t.GITHUB_SERVER_NAME];static getBuiltInServerNames(){return[...t.BUILTIN_SERVERS]}hasUserConfiguredGitHubServer=!1;lastGitHubAuthInfo=null;githubMcpToken;async configureGitHubAuth(l){if(this.isServerDisabled(t.GITHUB_SERVER_NAME))return this.logger.debug("GitHub MCP server is disabled, skipping auto-configuration"),!1;if(this.hasUserConfiguredGitHubServer)return this.logger.debug("User has explicitly configured github-mcp-server, ignoring auth changes"),!1;if(await this.shouldHandleGitHubAuth(l)){let r=await zW(l);if(!r)return this.logger.debug("No token available for GitHub authentication"),!1;if(this.lastGitHubAuthInfo=l,r===this.githubMcpToken)return!1;this.githubMcpToken=r;let I=await this.createGitHubServerConfig(r,l);try{return await this.restartServer(t.GITHUB_SERVER_NAME,I),this.logger.log("GitHub MCP server configured after authentication"),!0}catch(a){return this.logger.error(`Failed to configure GitHub MCP server after auth: ${a}`),!1}}return!1}async removeGitHubAuth(){if(this.hasUserConfiguredGitHubServer)return this.logger.debug("User has explicitly configured github-mcp-server, ignoring auth changes"),!1;this.githubMcpToken=void 0;try{return this.isServerRunning(t.GITHUB_SERVER_NAME)?(await this.stopServer(t.GITHUB_SERVER_NAME),this.logger.debug("Removed GitHub MCP server"),!0):!1}catch(l){return this.logger.error(`Failed to remove GitHub server: ${l}`),!1}}async shouldHandleGitHubAuth(l){return await M2(l,{onHMACAuthInfo:async()=>!!process.env.GITHUB_MCP_SERVER_TOKEN,onEnvAuthInfo:async()=>!0,onUserAuthInfo:async()=>!0,onGhCliAuthInfo:async()=>!0,onApiKeyAuthInfo:async()=>!1})}async createGitHubServerConfig(l,n){let r="https://api.githubcopilot.com/mcp/readonly";try{let I=await M2(n,{onHMACAuthInfo:async()=>"https://github.com",onEnvAuthInfo:async s=>s.host,onUserAuthInfo:async s=>s.host,onGhCliAuthInfo:async s=>s.host,onApiKeyAuthInfo:async s=>s.host}),a=await o0(I,l);r=new URL("/mcp/readonly",a).toString(),this.logger.log(`Using Copilot API endpoint: ${r}`)}catch(I){this.logger.error(`Failed to fetch Copilot URL, using default: ${I}`)}return{type:"http",url:r,headers:{Authorization:"Bearer "+l,"X-MCP-Toolsets":"repos,issues,users,pull_requests,code_security,secret_protection,actions,web_search","X-MCP-Host":"copilot-cli"},tools:["*"],isDefaultServer:!0,filterMapping:{get_issue:"markdown",get_issue_comments:"markdown",get_pull_request:"markdown",get_pull_request_comments:"markdown",get_pull_request_reviews:"markdown"}}}async injectDefaultServers(l){if(l.mcpServers[t.GITHUB_SERVER_NAME]){this.hasUserConfiguredGitHubServer=!0,this.logger.debug("User has already configured github-mcp-server, skipping auto-configuration");return}}async startBuiltInServer(l){l===t.GITHUB_SERVER_NAME&&!this.hasUserConfiguredGitHubServer?this.lastGitHubAuthInfo?(this.logger.log("Attempting to configure GitHub MCP server using stored authentication"),await this.configureGitHubAuth(this.lastGitHubAuthInfo)?this.logger.log("GitHub MCP server configured successfully after enabling"):this.logger.log("GitHub MCP server enabled but could not be configured - authentication may be invalid or insufficient")):this.logger.log("GitHub MCP server enabled - will be configured automatically when authentication becomes available"):await super.startBuiltInServer(l)}};c();c();var dVn=Dl({commandHistory:Jd(Rt())}),N8e=QVe(dVn.parse,"command-history");var uVn=50,W8e=class{commandHistory=[];historyIndex=-1;isNavigatingHistory=!1;unSubmittedCommand=null;async initialize(){try{let e=await N8e.load();this.commandHistory=e?.commandHistory||[],this.resetNavigation()}catch{this.commandHistory=[]}}async addCommand(e){this.commandHistory=this.commandHistory.filter(l=>l!==e),this.commandHistory.unshift(e),this.commandHistory=this.commandHistory.slice(0,uVn),this.resetNavigation(),this.unSubmittedCommand=null,await this.saveHistory()}async updateCurrentCommand(e){this.historyIndex!==-1?(this.commandHistory[this.historyIndex]=e,await this.saveHistory()):this.unSubmittedCommand=e}navigateUp(e){if(this.commandHistory.length===0)return;let l=this.historyIndex+1;if(l<this.commandHistory.length){this.historyIndex=l,this.isNavigatingHistory=!0;let n=this.getCurrentHistoryItem();n&&e.setText(n)}}navigateDown(e){if(this.historyIndex===-1)return;if(this.historyIndex===0)this.resetNavigation();else{let n=this.historyIndex-1;this.historyIndex=n,this.isNavigatingHistory=!0}let l=this.getCurrentHistoryItem();l?(e.setText(l),e.setCursorPosition(0)):e.clear()}resetNavigation(){this.historyIndex=-1,this.isNavigatingHistory=!1}getHistoryIndex(){return this.historyIndex}getHistory(){return this.commandHistory}getCurrentHistoryItem(){return this.historyIndex===-1?this.unSubmittedCommand?this.unSubmittedCommand:void 0:this.commandHistory[this.historyIndex]}isNavigating(){return this.isNavigatingHistory}setNavigating(e){this.isNavigatingHistory=e}async saveHistory(){try{await N8e.write({commandHistory:this.commandHistory})}catch{}}},_2=new W8e;c();c();function MMt(t,e){var l=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),l.push.apply(l,n)}return l}function _Mt(t){for(var e=1;e<arguments.length;e++){var l=arguments[e]!=null?arguments[e]:{};e%2?MMt(Object(l),!0).forEach(function(n){mVn(t,n,l[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(l)):MMt(Object(l)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(l,n))})}return t}function mVn(t,e,l){return e=bVn(e),e in t?Object.defineProperty(t,e,{value:l,enumerable:!0,configurable:!0,writable:!0}):t[e]=l,t}function bVn(t){var e=GVn(t,"string");return typeof e=="symbol"?e:String(e)}function GVn(t,e){if(typeof t!="object"||t===null)return t;var l=t[Symbol.toPrimitive];if(l!==void 0){var n=l.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pVn=zMt({}),DMt=pVn;function zMt(t){return e.withOptions=l=>zMt(_Mt(_Mt({},t),l)),e;function e(l,...n){let r=typeof l=="string"?[l]:l.raw,{escapeSpecialCharacters:I=Array.isArray(l),trimWhitespace:a=!0}=t,s="";for(let u=0;u<r.length;u++){let b=r[u];I&&(b=b.replace(/\\\n[ \t]*/g,"").replace(/\\`/g,"`").replace(/\\\$/g,"$").replace(/\\\{/g,"{")),s+=b,u<n.length&&(s+=n[u])}let o=s.split(`
|
|
1970
1970
|
`),d=null;for(let u of o){let b=u.match(/^(\s+)\S+/);if(b){let p=b[1].length;d?d=Math.min(d,p):d=p}}if(d!==null){let u=d;s=o.map(b=>b[0]===" "||b[0]===" "?b.slice(u):b).join(`
|
|
1971
1971
|
`)}return a&&(s=s.trim()),I&&(s=s.replace(/\\n/g,`
|
|
1972
1972
|
`)),s}}import{homedir as ADt}from"node:os";import MFn,{resolve as _Fn}from"node:path";c();function hVn(t){return t.length>0&&/^[0-9a-zA-Z_-]+$/.test(t)}function jMt(t){return!t||t.length===0?{valid:!1,error:"MCP server name cannot be empty"}:/^[0-9a-zA-Z_-]+$/.test(t)?{valid:!0}:{valid:!1,error:"MCP server name must only contain alphanumeric characters, underscores, and hyphens"}}var PMt=_g(["none","markdown","hidden_characters"]),KMt=Dl({tools:Jd(Rt()),type:Rt().optional(),isDefaultServer:Yo().optional(),filterMapping:x2(Rt(),PMt).or(PMt).optional()}),AVn=KMt.extend({type:Zr("local").optional(),command:Rt(),args:Jd(Rt()),env:x2(Rt(),Rt()).optional()}),ZVn=KMt.extend({type:Zr("http").or(Zr("sse")),url:Rt(),headers:x2(Rt(),Rt()).optional()}),y8e=Dl({mcpServers:x2(Rt().min(1,"MCP server name cannot be empty").refine(hVn,{message:"MCP server name must only contain alphanumeric characters, underscores, and hyphens"}),AVn.or(ZVn))}),D2=wVe(y8e.parse,"mcp");c();c();function qMt(t){let e=t.r/255,l=t.g/255,n=t.b/255,r=Math.max(e,l,n),I=Math.min(e,l,n),a=r-I,s=0,o=0,d=(r+I)/2;if(a!==0){switch(o=d>.5?a/(2-r-I):a/(r+I),r){case e:s=(l-n)/a+(l<n?6:0);break;case l:s=(n-e)/a+2;break;case n:s=(e-l)/a+4;break}s/=6}return{h:s*360,s:o,l:d}}function gVn(t){if(t.length<12||t.length>18)return null;let e=t.match(/rgb:([0-9a-f]+)\/([0-9a-f]+)\/([0-9a-f]+)/i);if(!e)return null;let[,l,n,r]=e,I=d=>d.length>=2?parseInt(d.substring(0,2),16):d.length===1?parseInt(d+d,16):0,a=I(l),s=I(n),o=I(r);return{r:a,g:s,b:o}}var $Mt=["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff","#000000","#00005f","#000087","#0000af","#0000d7","#0000ff","#005f00","#005f5f","#005f87","#005faf","#005fd7","#005fff","#008700","#00875f","#008787","#0087af","#0087d7","#0087ff","#00af00","#00af5f","#00af87","#00afaf","#00afd7","#00afff","#00d700","#00d75f","#00d787","#00d7af","#00d7d7","#00d7ff","#00ff00","#00ff5f","#00ff87","#00ffaf","#00ffd7","#00ffff","#5f0000","#5f005f","#5f0087","#5f00af","#5f00d7","#5f00ff","#5f5f00","#5f5f5f","#5f5f87","#5f5faf","#5f5fd7","#5f5fff","#5f8700","#5f875f","#5f8787","#5f87af","#5f87d7","#5f87ff","#5faf00","#5faf5f","#5faf87","#5fafaf","#5fafd7","#5fafff","#5fd700","#5fd75f","#5fd787","#5fd7af","#5fd7d7","#5fd7ff","#5fff00","#5fff5f","#5fff87","#5fffaf","#5fffd7","#5fffff","#870000","#87005f","#870087","#8700af","#8700d7","#8700ff","#875f00","#875f5f","#875f87","#875faf","#875fd7","#875fff","#878700","#87875f","#878787","#8787af","#8787d7","#8787ff","#87af00","#87af5f","#87af87","#87afaf","#87afd7","#87afff","#87d700","#87d75f","#87d787","#87d7af","#87d7d7","#87d7ff","#87ff00","#87ff5f","#87ff87","#87ffaf","#87ffd7","#87ffff","#af0000","#af005f","#af0087","#af00af","#af00d7","#af00ff","#af5f00","#af5f5f","#af5f87","#af5faf","#af5fd7","#af5fff","#af8700","#af875f","#af8787","#af87af","#af87d7","#af87ff","#afaf00","#afaf5f","#afaf87","#afafaf","#afafd7","#afafff","#afd700","#afd75f","#afd787","#afd7af","#afd7d7","#afd7ff","#afff00","#afff5f","#afff87","#afffaf","#afffd7","#afffff","#d70000","#d7005f","#d70087","#d700af","#d700d7","#d700ff","#d75f00","#d75f5f","#d75f87","#d75faf","#d75fd7","#d75fff","#d78700","#d7875f","#d78787","#d787af","#d787d7","#d787ff","#d7af00","#d7af5f","#d7af87","#d7afaf","#d7afd7","#d7afff","#d7d700","#d7d75f","#d7d787","#d7d7af","#d7d7d7","#d7d7ff","#d7ff00","#d7ff5f","#d7ff87","#d7ffaf","#d7ffd7","#d7ffff","#ff0000","#ff005f","#ff0087","#ff00af","#ff00d7","#ff00ff","#ff5f00","#ff5f5f","#ff5f87","#ff5faf","#ff5fd7","#ff5fff","#ff8700","#ff875f","#ff8787","#ff87af","#ff87d7","#ff87ff","#ffaf00","#ffaf5f","#ffaf87","#ffafaf","#ffafd7","#ffafff","#ffd700","#ffd75f","#ffd787","#ffd7af","#ffd7d7","#ffd7ff","#ffff00","#ffff5f","#ffff87","#ffffaf","#ffffd7","#ffffff","#080808","#121212","#1c1c1c","#262626","#303030","#3a3a3a","#444444","#4e4e4e","#585858","#626262","#6c6c6c","#767676","#808080","#8a8a8a","#949494","#9e9e9e","#a8a8a8","#b2b2b2","#bcbcbc","#c6c6c6","#d0d0d0","#dadada","#e4e4e4","#eeeeee"];function NVn(t){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:{r:0,g:0,b:0}}function WVn(t){return t<0||t>=$Mt.length?{r:0,g:0,b:0}:NVn($Mt[t])}function e_t(t){if(t.length<15||t.length>30)return null;let e=t;e.endsWith("\x07")?e=e.slice(0,-1):e.endsWith("\x1B\\")?e=e.slice(0,-2):e.endsWith("\x9C")&&(e=e.slice(0,-1));let l=e;return l.startsWith("11;")&&(l=l.substring(3)),l.startsWith("rgb:")?gVn(l):null}async function yVn(t=100){return new Promise(e=>{if(!process.stdout.isTTY||!process.stdin.isTTY){e(null);return}let l="",n=null,r=()=>{process.stdin.removeListener("data",I),process.stdin.setRawMode(!1),n&&clearTimeout(n)},I=a=>{l+=a.toString();let s=l.match(/\x1b\]11;([^\x07\x1b\x9c]*?)(?:\x07|\x1b\\|\x9c)/);if(s){r();let d=`11;${s[1]}`;e(e_t(d));return}let o=l.match(/11;rgb:([0-9a-f/]+)(?:\x07|\x1b\\|\x9c)/i);if(o){r(),e(e_t(`11;rgb:${o[1]}`));return}};n=setTimeout(()=>{r(),e(null)},t);try{process.stdin.setRawMode(!0),process.stdin.on("data",I),process.stdout.write("\x1B]11;?\x1B\\")}catch{r(),e(null)}})}function EVn(){let t=process.env.COLORFGBG;if(!t||!t.includes(";"))return null;let e=t.split(";"),l=e[e.length-1],n=parseInt(l,10);return isNaN(n)?null:WVn(n)}async function t_t(){try{let t=await yVn();if(t)return qMt(t).l<.5;let e=EVn();return e?qMt(e).l<.5:!0}catch{return!0}}var l_t={FG:"whiteBright",ACCENT:"blue",SUCCESS:"green",DIFF_ADDED_HIGHLIGHT_FG:"black",DIFF_REMOVED_HIGHLIGHT_FG:"whiteBright",ERROR:"red",WARNING:"yellow",COPILOT:"magenta",COPILOT_BRIGHT:"magentaBright",MUTED:"white",SELECTED:"cyan",BORDER:"blackBright"},RVn={FG:"black",ACCENT:"blue",SUCCESS:"green",DIFF_ADDED_HIGHLIGHT_FG:"black",DIFF_REMOVED_HIGHLIGHT_FG:"whiteBright",ERROR:"red",WARNING:"yellow",COPILOT:"magenta",COPILOT_BRIGHT:"magentaBright",MUTED:"blackBright",SELECTED:"cyan",BORDER:"blackBright"};function E8e(t){return t==="auto"||t==="dark"||t==="light"}function kVe(t){switch(t){case"dark":return l_t;case"light":return RVn;default:return l_t}}var LVe=await t_t();async function JVe(){let e=(await kr.load())?.theme||"";return E8e(e)?e:"auto"}async function n_t(t){await kr.writeKey("theme",t)}var r_t=t=>{let e=t?xl.whiteBright:xl.black,l=t?xl.cyanBright:xl.blueBright,n=t?xl.magentaBright:xl.magenta;return{text:e,paragraph:e,html:e,table:e,blockquote:e,heading:xl.bold,firstHeading:xl.whiteBright.bold,strong:xl.bold,em:xl.italic,del:xl.strikethrough,hr:xl.white,link:l,href:l,image:(r,I,a)=>n(a?`Image: ${a} \u2192 ${r}`:`Image: ${r}`),codespan:xl.cyan,code:xl.cyan,list:(r,I,a)=>{let s=r.replace(/^(\s*)\* /gm,"$1- ");return a&&(s=s.split(`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@github/copilot",
|
|
3
3
|
"description": "GitHub Copilot CLI brings the power of Copilot coding agent directly to your terminal.",
|
|
4
|
-
"version": "0.0.348-
|
|
4
|
+
"version": "0.0.348-7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"worker/**/*"
|
|
36
36
|
],
|
|
37
37
|
"buildMetadata": {
|
|
38
|
-
"gitCommit": "
|
|
38
|
+
"gitCommit": "0f57c60"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"sharp": "^0.34.3"
|