@github/copilot 1.0.1 → 1.0.2

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 CHANGED
@@ -786,7 +786,7 @@ ${e}* After running ${t.TOOL_NAME}, investigate all alerts it discovers.
786
786
  ${a.alerts.map((d,u)=>Q4n(d,u,r)).join(`
787
787
  `)}`}),s=this.countTotalAlerts(e),l=e.map(a=>a.language);return l.length===0?"No code changes detected for languages that CodeQL can analyze, so no analysis was performed.":`Analysis Result for '${l.join(", ")}'. Found ${cUe("alert",s)}:
788
788
  ${o.join(`
789
- `)}`}countTotalAlerts(e){return e.reduce((n,r)=>n+r.alerts.length,0)}async logProgress(e,n=3,r){switch(r&&this.logger.startGroup(r),n){case 4:this.logger.debug(e);break;case 3:this.logger.info(e);break;case 2:this.logger.warning(e);break;case 1:this.logger.error(e);break;default:this.logger.log(e);break}r&&this.logger.endGroup(),this.config.callback&&await this.config.callback?.progress({kind:"log",message:e})}createCodeQLScratchDir(e){let n=kzo.createHash("sha256").update(e).digest("hex").slice(0,16),r=Lzo.join(Szo.tmpdir(),`codeql-scratch-${n}`);return xzo.mkdirSync(r,{recursive:!0}),r}createTelemetryByLanguage(e,n){let r=[];for(let[o,s]of Object.entries(e)){if(H4n(s)){let a={event:"codeql-checker-completion",properties:{"codeql.language":o,"codeql.skipped":"true","codeql.version":n},metrics:{},restrictedProperties:{}};r.push(a);continue}let l={event:"codeql-checker-completion",properties:{"codeql.language":o,"codeql.databaseCreationSuccess":s.databaseCreationSuccess?"true":"false","codeql.analysisRuleIds":$Ie(s)?s.analysisRuleIds.join(","):"","codeql.version":n,"codeql.querySuite":$Ie(s)?s.querySuite:void 0},metrics:{"codeql.databaseCreationTimeMs":s.databaseCreationTimeMs,"codeql.analysisTimeMs":$Ie(s)?s.analysisTimeMs:void 0,"codeql.alertCount":$Ie(s)?s.analysisRuleIds.length:0},restrictedProperties:{}};s.aborted&&(l.properties["codeql.aborted"]="true"),s.databaseCreationError&&(JN({telemetry:l},s.databaseCreationError,"codeql.databaseCreationError"),l.restrictedProperties["codeql.databaseCreationStack"]=String(s.databaseCreationError.stack)),$Ie(s)&&(l.properties["codeql.analysisSuccess"]=s.analysisSuccess?"true":"false",s.analysisError&&(JN({telemetry:l},s.analysisError,"codeql.analysisError"),l.restrictedProperties["codeql.analysisStack"]=String(s.analysisError.stack))),"databaseOverlayStatus"in s&&(l.properties["codeql.databaseOverlayStatus"]=s.databaseOverlayStatus),s.databaseOverlayBaseDatabaseNotAvailableBecause&&(l.properties["codeql.databaseOverlayBaseDatabaseNotAvailableBecause"]=s.databaseOverlayBaseDatabaseNotAvailableBecause),s.databaseOverlayError&&JN({telemetry:l},s.databaseOverlayError,"codeql.databaseOverlayError"),s.databaseOverlayDownloadTimeMs!==void 0&&(l.metrics["codeql.databaseOverlayDownloadTimeMs"]=s.databaseOverlayDownloadTimeMs),r.push(l)}return r}async shouldAnalyzeLanguage(e,n){if(n=="actions")return!0;let r=await e.getRepositorySize(n);if(r===void 0)return!0;let o=r<=t.DEFAULT_MAX_REPO_SIZE_BYTES;return o||this.logProgress(`Skipping analysis for ${n} because the repository size is ${r} bytes, which exceeds the limit of ${t.DEFAULT_MAX_REPO_SIZE_BYTES} bytes.`,2),o}}});function Bzo(t){if(t instanceof Error){let e=t.name.toLowerCase(),n=t.message.toLowerCase();return e.includes("timeout")||e.includes("connect")||e.includes("network")||n.includes("timeout")||n.includes("econnrefused")||n.includes("enotfound")||n.includes("connect")}return!1}function uBn(t,e){let n=dBn.get(t);return n||(n=new QQt({...e,name:t}),dBn.set(t,n)),n}function mBn(t){try{return(typeof t=="string"?new URL(t):t).host}catch{return typeof t=="string"?t:t.toString()}}var yC,Jzo,HQt,QQt,n4,dBn,wDe=w(()=>{"use strict";yC={CLOSED:"CLOSED",OPEN:"OPEN",HALF_OPEN:"HALF_OPEN"},Jzo={failureThreshold:5,resetTimeoutMs:3e4,probeTimeoutMs:3e4},HQt=[500,502,503,504];QQt=class{state=yC.CLOSED;failureCount=0;lastFailureTime=0;probeInFlight=!1;probeStartTime=0;options;constructor(e={}){this.options={...Jzo,...e}}getState(){return this.updateState(),this.state}canRequest(){switch(this.updateState(),this.state){case yC.CLOSED:return!0;case yC.HALF_OPEN:return this.probeInFlight&&Date.now()-this.probeStartTime>=this.options.probeTimeoutMs&&(this.probeInFlight=!1),this.probeInFlight?!1:(this.probeInFlight=!0,this.probeStartTime=Date.now(),!0);case yC.OPEN:return!1}}recordSuccess(){this.failureCount=0,this.probeInFlight=!1,this.state=yC.CLOSED}recordFailure(){this.failureCount++,this.lastFailureTime=Date.now(),this.probeInFlight=!1,this.failureCount>=this.options.failureThreshold&&(this.state=yC.OPEN)}recordErrorIfApplicable(e){return Bzo(e)?(this.recordFailure(),!0):!1}recordResponseIfApplicable(e){return HQt.includes(e)?(this.recordFailure(),!0):!1}getFailureCount(){return this.failureCount}getTimeUntilRetry(){if(this.state!==yC.OPEN)return 0;let e=Date.now()-this.lastFailureTime,n=this.options.resetTimeoutMs-e;return Math.max(0,n)}reset(){this.state=yC.CLOSED,this.failureCount=0,this.lastFailureTime=0,this.probeInFlight=!1,this.probeStartTime=0}updateState(){this.state===yC.OPEN&&Date.now()-this.lastFailureTime>=this.options.resetTimeoutMs&&(this.state=yC.HALF_OPEN)}},n4=class extends Error{circuitName;timeUntilRetryMs;constructor(e,n){super(`Circuit breaker '${e}' is open. Requests are being rejected to prevent cascading failures. Will retry in ${Math.ceil(n/1e3)} seconds.`),this.name="CircuitBreakerError",this.circuitName=e,this.timeUntilRetryMs=n}},dBn=new Map});var Hde,XQt=w(()=>{"use strict";Hde=class extends Error{constructor(e){super(`HTTP ${e.status} response does not appear to originate from GitHub. Is a proxy or firewall intercepting this request? https://gh.io/copilot-firewall`),this.name="ProxyResponseError"}}});async function IE(t,e,n,r="GitHub API",o=nwe){let s=o.maxRetries??nwe.maxRetries,l=o.defaultRetryDelaySeconds??nwe.defaultRetryDelaySeconds,a=o.backoffFactor??nwe.backoffFactor,c=o.enableCircuitBreaker??nwe.enableCircuitBreaker,I=mBn(t),d=c?uBn(I):null;if(d&&!d.canRequest()){let m=d.getTimeUntilRetry();throw n.warning(`Circuit breaker for ${I} is open (${d.getFailureCount()} consecutive failures). Rejecting ${r} request. Will allow retry in ${Math.ceil(m/1e3)} seconds.`),new n4(I,m)}let u=0;for(;u<=s;){if(d&&u>0&&!d.canRequest()){let g=d.getTimeUntilRetry();throw n.warning(`Circuit breaker for ${I} opened during retries. Aborting ${r} request after ${u} attempts.`),new n4(I,g)}let m;try{m=await fetch(t,e)}catch(g){let f=typeof g=="object"&&g!==null&&"cause"in g?g.cause:g;if(n.error(`Error making ${r} request: ${ue(f)}`),d?.recordErrorIfApplicable(f)&&d.getState()===yC.OPEN){let N=d.getTimeUntilRetry();throw n.warning(`Circuit breaker for ${I} is now open after ${d.getFailureCount()} consecutive failures. Aborting retries immediately.`),new n4(I,N)}if(u>=s)throw g}if(m){if(m.ok)return d?.recordSuccess(),m;if(d?.recordResponseIfApplicable(m.status)&&d.getState()===yC.OPEN){let N=d.getTimeUntilRetry();throw n.warning(`Circuit breaker for ${I} is now open after ${d.getFailureCount()} consecutive failures. Aborting retries immediately.`),new n4(I,N)}HQt.includes(m.status)||d?.recordSuccess();let g=m.clone(),f=g.headers.get("x-github-request-id")||"unknown";if(n.error(`Request to ${r} at ${t.toString()} failed with status ${g.status} (request ID: ${f}), body: ${await g.text()}`),!pBn(m)&&!m.headers.get("x-github-request-id"))throw new Hde(m);if(!pBn(m)||u>=s)return m}let p=m?.headers.get("retry-after");u++;let h=p?parseInt(p,10):l,G=Math.floor(h*Math.pow(a,u-1));n.warning(`Retrying request to ${r} in ${G} seconds. Attempt ${u}/${s}`),await new Promise(g=>setTimeout(g,G*1e3))}throw new Error(`Failed to make ${r} request.`)}function pBn(t){return Tzo.includes(t.status)}var nwe,Tzo,Xde=w(()=>{"use strict";wDe();_n();XQt();wDe();nwe={maxRetries:5,defaultRetryDelaySeconds:5,backoffFactor:2,enableCircuitBreaker:!0},Tzo=[429,500,502]});function kQt(t){return Vi(t,Ozo)}async function zzo(t,e,n){let r=dJe(t),o=xH(t),s=new URL(r);s.pathname.endsWith("/")||(s.pathname+="/");let l=new URL(`./jobs/${o}/pulls`,s),a={"Content-Type":"application/json","Copilot-Integration-Id":YM(t),Authorization:`Bearer ${EJ(t)}`};t.job?.nonce&&(a["X-GitHub-Job-Nonce"]=t.job.nonce),t.api?.copilot?.traceParent&&(a["X-Copilot-Traceparent"]=t.api.copilot.traceParent);let c=JSON.stringify({title:n.title,description:n.description??"",draft:n.draft??!0}),I=await IE(l,{method:"POST",body:c,headers:a},e,"create pull request");if(Dzo.includes(I.status))return e.info(`Pull request already exists for this branch (HTTP ${I.status})`),{github_number:(await I.json().catch(()=>({}))).github_number,alreadyExists:!0};if(!I.ok){let u=await I.text().catch(()=>"");throw new Error(`API returned ${I.status}: ${u}`)}return{github_number:(await I.json()).github_number,alreadyExists:!1}}var _zo,Ozo,hBn,Mzo,Uzo,Dzo,bBn,vDe=w(()=>{"use strict";qo();_n();Xde();yA();Ap();Ou();_zo="create_pull_request",Ozo="coding_agent_create_pull_request",hBn=ie.object({title:ie.string().min(1).describe("The title for the pull request"),description:ie.string().optional().describe("The body/description for the pull request in markdown format"),draft:ie.boolean().optional().describe("Whether to create the pull request as a draft. Defaults to true.")}),Mzo="Create a pull request for the current branch. Call this tool when the task is complete and the changes are ready for review. If a pull request already exists for the branch, this tool will return successfully and indicate that.",Uzo=`## Examples
789
+ `)}`}countTotalAlerts(e){return e.reduce((n,r)=>n+r.alerts.length,0)}async logProgress(e,n=3,r){switch(r&&this.logger.startGroup(r),n){case 4:this.logger.debug(e);break;case 3:this.logger.info(e);break;case 2:this.logger.warning(e);break;case 1:this.logger.error(e);break;default:this.logger.log(e);break}r&&this.logger.endGroup(),this.config.callback&&await this.config.callback?.progress({kind:"log",message:e})}createCodeQLScratchDir(e){let n=kzo.createHash("sha256").update(e).digest("hex").slice(0,16),r=Lzo.join(Szo.tmpdir(),`codeql-scratch-${n}`);return xzo.mkdirSync(r,{recursive:!0}),r}createTelemetryByLanguage(e,n){let r=[];for(let[o,s]of Object.entries(e)){if(H4n(s)){let a={event:"codeql-checker-completion",properties:{"codeql.language":o,"codeql.skipped":"true","codeql.version":n},metrics:{},restrictedProperties:{}};r.push(a);continue}let l={event:"codeql-checker-completion",properties:{"codeql.language":o,"codeql.databaseCreationSuccess":s.databaseCreationSuccess?"true":"false","codeql.analysisRuleIds":$Ie(s)?s.analysisRuleIds.join(","):"","codeql.version":n,"codeql.querySuite":$Ie(s)?s.querySuite:void 0},metrics:{"codeql.databaseCreationTimeMs":s.databaseCreationTimeMs,"codeql.analysisTimeMs":$Ie(s)?s.analysisTimeMs:void 0,"codeql.alertCount":$Ie(s)?s.analysisRuleIds.length:0},restrictedProperties:{}};s.aborted&&(l.properties["codeql.aborted"]="true"),s.databaseCreationError&&(JN({telemetry:l},s.databaseCreationError,"codeql.databaseCreationError"),l.restrictedProperties["codeql.databaseCreationStack"]=String(s.databaseCreationError.stack)),$Ie(s)&&(l.properties["codeql.analysisSuccess"]=s.analysisSuccess?"true":"false",s.analysisError&&(JN({telemetry:l},s.analysisError,"codeql.analysisError"),l.restrictedProperties["codeql.analysisStack"]=String(s.analysisError.stack))),"databaseOverlayStatus"in s&&(l.properties["codeql.databaseOverlayStatus"]=s.databaseOverlayStatus),s.databaseOverlayBaseDatabaseNotAvailableBecause&&(l.properties["codeql.databaseOverlayBaseDatabaseNotAvailableBecause"]=s.databaseOverlayBaseDatabaseNotAvailableBecause),s.databaseOverlayError&&JN({telemetry:l},s.databaseOverlayError,"codeql.databaseOverlayError"),s.databaseOverlayDownloadTimeMs!==void 0&&(l.metrics["codeql.databaseOverlayDownloadTimeMs"]=s.databaseOverlayDownloadTimeMs),r.push(l)}return r}async shouldAnalyzeLanguage(e,n){if(n=="actions")return!0;let r=await e.getRepositorySize(n);if(r===void 0)return!0;let o=r<=t.DEFAULT_MAX_REPO_SIZE_BYTES;return o||this.logProgress(`Skipping analysis for ${n} because the repository size is ${r} bytes, which exceeds the limit of ${t.DEFAULT_MAX_REPO_SIZE_BYTES} bytes.`,2),o}}});function Bzo(t){if(t instanceof Error){let e=t.name.toLowerCase(),n=t.message.toLowerCase();return e.includes("timeout")||e.includes("connect")||e.includes("network")||n.includes("timeout")||n.includes("econnrefused")||n.includes("enotfound")||n.includes("connect")}return!1}function uBn(t,e){let n=dBn.get(t);return n||(n=new QQt({...e,name:t}),dBn.set(t,n)),n}function mBn(t){try{return(typeof t=="string"?new URL(t):t).host}catch{return typeof t=="string"?t:t.toString()}}var yC,Jzo,HQt,QQt,n4,dBn,wDe=w(()=>{"use strict";yC={CLOSED:"CLOSED",OPEN:"OPEN",HALF_OPEN:"HALF_OPEN"},Jzo={failureThreshold:5,resetTimeoutMs:3e4,probeTimeoutMs:3e4},HQt=[500,502,503,504];QQt=class{state=yC.CLOSED;failureCount=0;lastFailureTime=0;probeInFlight=!1;probeStartTime=0;options;constructor(e={}){this.options={...Jzo,...e}}getState(){return this.updateState(),this.state}canRequest(){switch(this.updateState(),this.state){case yC.CLOSED:return!0;case yC.HALF_OPEN:return this.probeInFlight&&Date.now()-this.probeStartTime>=this.options.probeTimeoutMs&&(this.probeInFlight=!1),this.probeInFlight?!1:(this.probeInFlight=!0,this.probeStartTime=Date.now(),!0);case yC.OPEN:return!1}}recordSuccess(){this.failureCount=0,this.probeInFlight=!1,this.state=yC.CLOSED}recordFailure(){this.failureCount++,this.lastFailureTime=Date.now(),this.probeInFlight=!1,this.failureCount>=this.options.failureThreshold&&(this.state=yC.OPEN)}recordErrorIfApplicable(e){return Bzo(e)?(this.recordFailure(),!0):!1}recordResponseIfApplicable(e){return HQt.includes(e)?(this.recordFailure(),!0):!1}getFailureCount(){return this.failureCount}getTimeUntilRetry(){if(this.state!==yC.OPEN)return 0;let e=Date.now()-this.lastFailureTime,n=this.options.resetTimeoutMs-e;return Math.max(0,n)}reset(){this.state=yC.CLOSED,this.failureCount=0,this.lastFailureTime=0,this.probeInFlight=!1,this.probeStartTime=0}updateState(){this.state===yC.OPEN&&Date.now()-this.lastFailureTime>=this.options.resetTimeoutMs&&(this.state=yC.HALF_OPEN)}},n4=class extends Error{circuitName;timeUntilRetryMs;constructor(e,n){super(`Circuit breaker '${e}' is open. Requests are being rejected to prevent cascading failures. Will retry in ${Math.ceil(n/1e3)} seconds.`),this.name="CircuitBreakerError",this.circuitName=e,this.timeUntilRetryMs=n}},dBn=new Map});var Hde,XQt=w(()=>{"use strict";Hde=class extends Error{constructor(e){super(`HTTP ${e.status} response does not appear to originate from GitHub. Is a proxy or firewall intercepting this request? https://gh.io/copilot-firewall`),this.name="ProxyResponseError"}}});async function IE(t,e,n,r="GitHub API",o=nwe){let s=o.maxRetries??nwe.maxRetries,l=o.defaultRetryDelaySeconds??nwe.defaultRetryDelaySeconds,a=o.backoffFactor??nwe.backoffFactor,c=o.enableCircuitBreaker??nwe.enableCircuitBreaker,I=mBn(t),d=c?uBn(I):null;if(d&&!d.canRequest()){let m=d.getTimeUntilRetry();throw n.warning(`Circuit breaker for ${I} is open (${d.getFailureCount()} consecutive failures). Rejecting ${r} request. Will allow retry in ${Math.ceil(m/1e3)} seconds.`),new n4(I,m)}let u=0;for(;u<=s;){if(d&&u>0&&!d.canRequest()){let g=d.getTimeUntilRetry();throw n.warning(`Circuit breaker for ${I} opened during retries. Aborting ${r} request after ${u} attempts.`),new n4(I,g)}let m;try{m=await fetch(t,e)}catch(g){let f=typeof g=="object"&&g!==null&&"cause"in g?g.cause:g;if(n.error(`Error making ${r} request: ${ue(f)}`),d?.recordErrorIfApplicable(f)&&d.getState()===yC.OPEN){let N=d.getTimeUntilRetry();throw n.warning(`Circuit breaker for ${I} is now open after ${d.getFailureCount()} consecutive failures. Aborting retries immediately.`),new n4(I,N)}if(u>=s)throw g}if(m){if(m.ok)return d?.recordSuccess(),m;if(d?.recordResponseIfApplicable(m.status)&&d.getState()===yC.OPEN){let N=d.getTimeUntilRetry();throw n.warning(`Circuit breaker for ${I} is now open after ${d.getFailureCount()} consecutive failures. Aborting retries immediately.`),new n4(I,N)}HQt.includes(m.status)||d?.recordSuccess();let g=m.clone(),f=g.headers.get("x-github-request-id")||"unknown";if(n.error(`Request to ${r} at ${t.toString()} failed with status ${g.status} (request ID: ${f}), body: ${await g.text()}`),!pBn(m)&&!m.headers.get("x-github-request-id"))throw new Hde(m);if(!pBn(m)||u>=s)return m}let p=m?.headers.get("retry-after");u++;let h=p?parseInt(p,10):l,G=Math.floor(h*Math.pow(a,u-1));n.warning(`Retrying request to ${r} in ${G} seconds. Attempt ${u}/${s}`),await new Promise(g=>setTimeout(g,G*1e3))}throw new Error(`Failed to make ${r} request.`)}function pBn(t){return Tzo.includes(t.status)}var nwe,Tzo,Xde=w(()=>{"use strict";wDe();_n();XQt();wDe();nwe={maxRetries:5,defaultRetryDelaySeconds:5,backoffFactor:2,enableCircuitBreaker:!0},Tzo=[429,500,502]});function kQt(t){return Vi(t,Ozo)}async function zzo(t,e,n){let r=dJe(t),o=xH(t),s=new URL(r);s.pathname.endsWith("/")||(s.pathname+="/");let l=new URL(`./jobs/${o}/pulls`,s),a={"Content-Type":"application/json","Copilot-Integration-Id":YM(t),Authorization:`Bearer ${EJ(t)}`};t.job?.nonce&&(a["X-GitHub-Job-Nonce"]=t.job.nonce),t.api?.copilot?.traceParent&&(a["X-Copilot-Traceparent"]=t.api.copilot.traceParent);let c=JSON.stringify({title:n.title,description:n.description??"",draft:n.draft??!0}),I=await IE(l,{method:"POST",body:c,headers:a},e,"create pull request");if(Dzo.includes(I.status))return e.info(`Pull request already exists for this branch (HTTP ${I.status})`),{github_number:(await I.json().catch(()=>({}))).github_number,alreadyExists:!0};if(!I.ok){let u=await I.text().catch(()=>"");throw new Error(`API returned ${I.status}: ${u}`)}return{github_number:(await I.json()).github_number,alreadyExists:!1}}var _zo,Ozo,hBn,Mzo,Uzo,Dzo,bBn,vDe=w(()=>{"use strict";qo();_n();Xde();yA();Ap();Ou();_zo="create_pull_request",Ozo="coding_agent_create_pull_request",hBn=ie.object({title:ie.string().min(1).describe("The title for the pull request"),description:ie.string().optional().describe("The body/description for the pull request in markdown format"),draft:ie.boolean().optional().describe("Whether to create the pull request as a draft. Defaults to true.")}),Mzo="Create a pull request for the current branch. Call this tool when the task is complete and the changes are ready for review. If a pull request already exists for the branch, this tool will return successfully and indicate that. Only call this tool when the user explicitly asks for a pull request to be created.",Uzo=`## Examples
790
790
 
791
791
  ### Create a standard pull request
792
792
  \`\`\`json
@@ -3261,7 +3261,7 @@ ${a}`}}}let r=await t.workspace.listCheckpoints();if(r.length===0)return{kind:"a
3261
3261
  `)}}}if(n==="plan"){if(!t.workspace)return{kind:"add-timeline-entry",entry:{type:"info",text:"Workspace features are not enabled for this session."}};let r=await t.workspace.readPlan();return r?{kind:"add-timeline-entry",entry:{type:"info",text:`Session Plan
3262
3262
  ${"\u2500".repeat(40)}
3263
3263
  ${r}`}}:{kind:"add-timeline-entry",entry:{type:"info",text:"No plan exists for this session."}}}if(n==="rename"){if(!t.workspace)return{kind:"add-timeline-entry",entry:{type:"info",text:"Workspace features are not enabled for this session."}};let r=e.slice(1).join(" ").trim();return r?r.length>100?{kind:"add-timeline-entry",entry:{type:"error",text:"Session name must be 100 characters or less."}}:(await t.workspace.renameSession(r),{kind:"add-timeline-entry",entry:{type:"info",text:`Session renamed to: ${r}`}}):{kind:"add-timeline-entry",entry:{type:"error",text:`Usage: /session rename <name>
3264
- Example: /session rename Building e-commerce platform`}}}return n==="prune"?t.featureFlags.SESSION_CLEANUP?gBs(t,e.slice(1)):b7t(e[0],t.featureFlags.SESSION_CLEANUP):n==="cleanup"&&t.featureFlags.SESSION_CLEANUP?ABs(t,e.slice(1)):b7t(e[0],t.featureFlags.SESSION_CLEANUP)};OYr={name:ait,args:"[checkpoints [n]|files|plan|rename <name>]",help:"Show session info and workspace summary. Use subcommands for details.",allowDuringAgentExecution:!0,execute:async(t,e)=>_Yr(t,e)},MYr={name:oit,args:"<name>",help:"Rename the current session (alias for /session rename)",allowDuringAgentExecution:!0,execute:async(t,e)=>_Yr(t,["rename",...e])}});function DYr(){return!!process.env.CI||!!process.env.BUILD_NUMBER||!!process.env.RUN_ID||!!process.env.SYSTEM_COLLECTIONURI}var zYr=w(()=>{"use strict"});var KYr={};vc(KYr,{fetchLatestRelease:()=>cre,fetchReleaseByTag:()=>yBs,getUpdateChannel:()=>sj,getVersion:()=>u_,getVersionWithoutUpdateCheck:()=>G7t,isPrerelease:()=>PYr,showVersionWithUpdateCheck:()=>g7t});function u_(){return process.env.COPILOT_CLI_VERSION||"1.0.1"}function PYr(){try{let t=(0,fit.parse)("1.0.1");return t!==null&&t.prerelease.length>0}catch{return!1}}function sj(t,e){return t||(e||PYr()?"prerelease":"stable")}function G7t(){return`GitHub Copilot CLI ${Mm().version}.
3264
+ Example: /session rename Building e-commerce platform`}}}return n==="prune"?t.featureFlags.SESSION_CLEANUP?gBs(t,e.slice(1)):b7t(e[0],t.featureFlags.SESSION_CLEANUP):n==="cleanup"&&t.featureFlags.SESSION_CLEANUP?ABs(t,e.slice(1)):b7t(e[0],t.featureFlags.SESSION_CLEANUP)};OYr={name:ait,args:"[checkpoints [n]|files|plan|rename <name>]",help:"Show session info and workspace summary. Use subcommands for details.",allowDuringAgentExecution:!0,execute:async(t,e)=>_Yr(t,e)},MYr={name:oit,args:"<name>",help:"Rename the current session (alias for /session rename)",allowDuringAgentExecution:!0,execute:async(t,e)=>_Yr(t,["rename",...e])}});function DYr(){return!!process.env.CI||!!process.env.BUILD_NUMBER||!!process.env.RUN_ID||!!process.env.SYSTEM_COLLECTIONURI}var zYr=w(()=>{"use strict"});var KYr={};vc(KYr,{fetchLatestRelease:()=>cre,fetchReleaseByTag:()=>yBs,getUpdateChannel:()=>sj,getVersion:()=>u_,getVersionWithoutUpdateCheck:()=>G7t,isPrerelease:()=>PYr,showVersionWithUpdateCheck:()=>g7t});function u_(){return process.env.COPILOT_CLI_VERSION||"1.0.2"}function PYr(){try{let t=(0,fit.parse)("1.0.2");return t!==null&&t.prerelease.length>0}catch{return!1}}function sj(t,e){return t||(e||PYr()?"prerelease":"stable")}function G7t(){return`GitHub Copilot CLI ${Mm().version}.
3265
3265
  Run 'copilot update' to check for updates.`}async function g7t(t){let e=Mm();process.stdout.write(`GitHub Copilot CLI ${e.version}
3266
3266
  `);let n=sj(t.update_channel,t.staff),r=await cre(n);if("error"in r){process.stderr.write(`
3267
3267
  Unable to check for updates: ${String(r.error)}
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": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
7
7
  "repository": {
@@ -43,14 +43,14 @@
43
43
  "conpty_console_list_agent.js"
44
44
  ],
45
45
  "buildMetadata": {
46
- "gitCommit": "16ce75c"
46
+ "gitCommit": "4a50c0e"
47
47
  },
48
48
  "optionalDependencies": {
49
- "@github/copilot-linux-x64": "1.0.1",
50
- "@github/copilot-linux-arm64": "1.0.1",
51
- "@github/copilot-darwin-x64": "1.0.1",
52
- "@github/copilot-darwin-arm64": "1.0.1",
53
- "@github/copilot-win32-x64": "1.0.1",
54
- "@github/copilot-win32-arm64": "1.0.1"
49
+ "@github/copilot-linux-x64": "1.0.2",
50
+ "@github/copilot-linux-arm64": "1.0.2",
51
+ "@github/copilot-darwin-x64": "1.0.2",
52
+ "@github/copilot-darwin-arm64": "1.0.2",
53
+ "@github/copilot-win32-x64": "1.0.2",
54
+ "@github/copilot-win32-arm64": "1.0.2"
55
55
  }
56
56
  }
Binary file
Binary file
Binary file
Binary file
package/sdk/index.js CHANGED
@@ -800,7 +800,7 @@ ${e}* After running ${t.TOOL_NAME}, investigate all alerts it discovers.
800
800
  ${I.alerts.map((c,d)=>kDt(c,d,r)).join(`
801
801
  `)}`}),s=this.countTotalAlerts(e),o=e.map(I=>I.language);return o.length===0?"No code changes detected for languages that CodeQL can analyze, so no analysis was performed.":`Analysis Result for '${o.join(", ")}'. Found ${PWe("alert",s)}:
802
802
  ${l.join(`
803
- `)}`}countTotalAlerts(e){return e.reduce((n,r)=>n+r.alerts.length,0)}async logProgress(e,n=3,r){switch(r&&this.logger.startGroup(r),n){case 4:this.logger.debug(e);break;case 3:this.logger.info(e);break;case 2:this.logger.warning(e);break;case 1:this.logger.error(e);break;default:this.logger.log(e);break}r&&this.logger.endGroup(),this.config.callback&&await this.config.callback?.progress({kind:"log",message:e})}createCodeQLScratchDir(e){let n=tkr.createHash("sha256").update(e).digest("hex").slice(0,16),r=lkr.join(rkr.tmpdir(),`codeql-scratch-${n}`);return nkr.mkdirSync(r,{recursive:!0}),r}createTelemetryByLanguage(e,n){let r=[];for(let[l,s]of Object.entries(e)){if(JDt(s)){let I={event:"codeql-checker-completion",properties:{"codeql.language":l,"codeql.skipped":"true","codeql.version":n},metrics:{},restrictedProperties:{}};r.push(I);continue}let o={event:"codeql-checker-completion",properties:{"codeql.language":l,"codeql.databaseCreationSuccess":s.databaseCreationSuccess?"true":"false","codeql.analysisRuleIds":$z(s)?s.analysisRuleIds.join(","):"","codeql.version":n,"codeql.querySuite":$z(s)?s.querySuite:void 0},metrics:{"codeql.databaseCreationTimeMs":s.databaseCreationTimeMs,"codeql.analysisTimeMs":$z(s)?s.analysisTimeMs:void 0,"codeql.alertCount":$z(s)?s.analysisRuleIds.length:0},restrictedProperties:{}};s.aborted&&(o.properties["codeql.aborted"]="true"),s.databaseCreationError&&(_u({telemetry:o},s.databaseCreationError,"codeql.databaseCreationError"),o.restrictedProperties["codeql.databaseCreationStack"]=String(s.databaseCreationError.stack)),$z(s)&&(o.properties["codeql.analysisSuccess"]=s.analysisSuccess?"true":"false",s.analysisError&&(_u({telemetry:o},s.analysisError,"codeql.analysisError"),o.restrictedProperties["codeql.analysisStack"]=String(s.analysisError.stack))),"databaseOverlayStatus"in s&&(o.properties["codeql.databaseOverlayStatus"]=s.databaseOverlayStatus),s.databaseOverlayBaseDatabaseNotAvailableBecause&&(o.properties["codeql.databaseOverlayBaseDatabaseNotAvailableBecause"]=s.databaseOverlayBaseDatabaseNotAvailableBecause),s.databaseOverlayError&&_u({telemetry:o},s.databaseOverlayError,"codeql.databaseOverlayError"),s.databaseOverlayDownloadTimeMs!==void 0&&(o.metrics["codeql.databaseOverlayDownloadTimeMs"]=s.databaseOverlayDownloadTimeMs),r.push(o)}return r}async shouldAnalyzeLanguage(e,n){if(n=="actions")return!0;let r=await e.getRepositorySize(n);if(r===void 0)return!0;let l=r<=t.DEFAULT_MAX_REPO_SIZE_BYTES;return l||this.logProgress(`Skipping analysis for ${n} because the repository size is ${r} bytes, which exceeds the limit of ${t.DEFAULT_MAX_REPO_SIZE_BYTES} bytes.`,2),l}}});function I_e(t){return cr(t,okr)}async function ckr(t,e,n){let r=HGe(t),l=OW(t),s=new URL(r);s.pathname.endsWith("/")||(s.pathname+="/");let o=new URL(`./jobs/${l}/pulls`,s),I={"Content-Type":"application/json","Copilot-Integration-Id":i5(t),Authorization:`Bearer ${uV(t)}`};t.job?.nonce&&(I["X-GitHub-Job-Nonce"]=t.job.nonce),t.api?.copilot?.traceParent&&(I["X-Copilot-Traceparent"]=t.api.copilot.traceParent);let i=JSON.stringify({title:n.title,description:n.description??"",draft:n.draft??!0}),a=await Yg(o,{method:"POST",body:i,headers:I},e,"create pull request");if(akr.includes(a.status))return e.info(`Pull request already exists for this branch (HTTP ${a.status})`),{github_number:(await a.json().catch(()=>({}))).github_number,alreadyExists:!0};if(!a.ok){let d=await a.text().catch(()=>"");throw new Error(`API returned ${a.status}: ${d}`)}return{github_number:(await a.json()).github_number,alreadyExists:!1}}var skr,okr,bKt,Ikr,ikr,akr,hKt,mAe=p(()=>{"use strict";Ln();Lt();W_();Qm();zI();eI();skr="create_pull_request",okr="coding_agent_create_pull_request",bKt=x.object({title:x.string().min(1).describe("The title for the pull request"),description:x.string().optional().describe("The body/description for the pull request in markdown format"),draft:x.boolean().optional().describe("Whether to create the pull request as a draft. Defaults to true.")}),Ikr="Create a pull request for the current branch. Call this tool when the task is complete and the changes are ready for review. If a pull request already exists for the branch, this tool will return successfully and indicate that.",ikr=`## Examples
803
+ `)}`}countTotalAlerts(e){return e.reduce((n,r)=>n+r.alerts.length,0)}async logProgress(e,n=3,r){switch(r&&this.logger.startGroup(r),n){case 4:this.logger.debug(e);break;case 3:this.logger.info(e);break;case 2:this.logger.warning(e);break;case 1:this.logger.error(e);break;default:this.logger.log(e);break}r&&this.logger.endGroup(),this.config.callback&&await this.config.callback?.progress({kind:"log",message:e})}createCodeQLScratchDir(e){let n=tkr.createHash("sha256").update(e).digest("hex").slice(0,16),r=lkr.join(rkr.tmpdir(),`codeql-scratch-${n}`);return nkr.mkdirSync(r,{recursive:!0}),r}createTelemetryByLanguage(e,n){let r=[];for(let[l,s]of Object.entries(e)){if(JDt(s)){let I={event:"codeql-checker-completion",properties:{"codeql.language":l,"codeql.skipped":"true","codeql.version":n},metrics:{},restrictedProperties:{}};r.push(I);continue}let o={event:"codeql-checker-completion",properties:{"codeql.language":l,"codeql.databaseCreationSuccess":s.databaseCreationSuccess?"true":"false","codeql.analysisRuleIds":$z(s)?s.analysisRuleIds.join(","):"","codeql.version":n,"codeql.querySuite":$z(s)?s.querySuite:void 0},metrics:{"codeql.databaseCreationTimeMs":s.databaseCreationTimeMs,"codeql.analysisTimeMs":$z(s)?s.analysisTimeMs:void 0,"codeql.alertCount":$z(s)?s.analysisRuleIds.length:0},restrictedProperties:{}};s.aborted&&(o.properties["codeql.aborted"]="true"),s.databaseCreationError&&(_u({telemetry:o},s.databaseCreationError,"codeql.databaseCreationError"),o.restrictedProperties["codeql.databaseCreationStack"]=String(s.databaseCreationError.stack)),$z(s)&&(o.properties["codeql.analysisSuccess"]=s.analysisSuccess?"true":"false",s.analysisError&&(_u({telemetry:o},s.analysisError,"codeql.analysisError"),o.restrictedProperties["codeql.analysisStack"]=String(s.analysisError.stack))),"databaseOverlayStatus"in s&&(o.properties["codeql.databaseOverlayStatus"]=s.databaseOverlayStatus),s.databaseOverlayBaseDatabaseNotAvailableBecause&&(o.properties["codeql.databaseOverlayBaseDatabaseNotAvailableBecause"]=s.databaseOverlayBaseDatabaseNotAvailableBecause),s.databaseOverlayError&&_u({telemetry:o},s.databaseOverlayError,"codeql.databaseOverlayError"),s.databaseOverlayDownloadTimeMs!==void 0&&(o.metrics["codeql.databaseOverlayDownloadTimeMs"]=s.databaseOverlayDownloadTimeMs),r.push(o)}return r}async shouldAnalyzeLanguage(e,n){if(n=="actions")return!0;let r=await e.getRepositorySize(n);if(r===void 0)return!0;let l=r<=t.DEFAULT_MAX_REPO_SIZE_BYTES;return l||this.logProgress(`Skipping analysis for ${n} because the repository size is ${r} bytes, which exceeds the limit of ${t.DEFAULT_MAX_REPO_SIZE_BYTES} bytes.`,2),l}}});function I_e(t){return cr(t,okr)}async function ckr(t,e,n){let r=HGe(t),l=OW(t),s=new URL(r);s.pathname.endsWith("/")||(s.pathname+="/");let o=new URL(`./jobs/${l}/pulls`,s),I={"Content-Type":"application/json","Copilot-Integration-Id":i5(t),Authorization:`Bearer ${uV(t)}`};t.job?.nonce&&(I["X-GitHub-Job-Nonce"]=t.job.nonce),t.api?.copilot?.traceParent&&(I["X-Copilot-Traceparent"]=t.api.copilot.traceParent);let i=JSON.stringify({title:n.title,description:n.description??"",draft:n.draft??!0}),a=await Yg(o,{method:"POST",body:i,headers:I},e,"create pull request");if(akr.includes(a.status))return e.info(`Pull request already exists for this branch (HTTP ${a.status})`),{github_number:(await a.json().catch(()=>({}))).github_number,alreadyExists:!0};if(!a.ok){let d=await a.text().catch(()=>"");throw new Error(`API returned ${a.status}: ${d}`)}return{github_number:(await a.json()).github_number,alreadyExists:!1}}var skr,okr,bKt,Ikr,ikr,akr,hKt,mAe=p(()=>{"use strict";Ln();Lt();W_();Qm();zI();eI();skr="create_pull_request",okr="coding_agent_create_pull_request",bKt=x.object({title:x.string().min(1).describe("The title for the pull request"),description:x.string().optional().describe("The body/description for the pull request in markdown format"),draft:x.boolean().optional().describe("Whether to create the pull request as a draft. Defaults to true.")}),Ikr="Create a pull request for the current branch. Call this tool when the task is complete and the changes are ready for review. If a pull request already exists for the branch, this tool will return successfully and indicate that. Only call this tool when the user explicitly asks for a pull request to be created.",ikr=`## Examples
804
804
 
805
805
  ### Create a standard pull request
806
806
  \`\`\`json
@@ -2880,7 +2880,7 @@ ${I}`}}}let r=await t.workspace.listCheckpoints();if(r.length===0)return{kind:"a
2880
2880
  `)}}}if(n==="plan"){if(!t.workspace)return{kind:"add-timeline-entry",entry:{type:"info",text:"Workspace features are not enabled for this session."}};let r=await t.workspace.readPlan();return r?{kind:"add-timeline-entry",entry:{type:"info",text:`Session Plan
2881
2881
  ${"\u2500".repeat(40)}
2882
2882
  ${r}`}}:{kind:"add-timeline-entry",entry:{type:"info",text:"No plan exists for this session."}}}if(n==="rename"){if(!t.workspace)return{kind:"add-timeline-entry",entry:{type:"info",text:"Workspace features are not enabled for this session."}};let r=e.slice(1).join(" ").trim();return r?r.length>100?{kind:"add-timeline-entry",entry:{type:"error",text:"Session name must be 100 characters or less."}}:(await t.workspace.renameSession(r),{kind:"add-timeline-entry",entry:{type:"info",text:`Session renamed to: ${r}`}}):{kind:"add-timeline-entry",entry:{type:"error",text:`Usage: /session rename <name>
2883
- Example: /session rename Building e-commerce platform`}}}return n==="prune"?t.featureFlags.SESSION_CLEANUP?_4l(t,e.slice(1)):LWt(e[0],t.featureFlags.SESSION_CLEANUP):n==="cleanup"&&t.featureFlags.SESSION_CLEANUP?q4l(t,e.slice(1)):LWt(e[0],t.featureFlags.SESSION_CLEANUP)};$Bn={name:jXe,args:"[checkpoints [n]|files|plan|rename <name>]",help:"Show session info and workspace summary. Use subcommands for details.",allowDuringAgentExecution:!0,execute:async(t,e)=>qBn(t,e)},eSn={name:MXe,args:"<name>",help:"Rename the current session (alias for /session rename)",allowDuringAgentExecution:!0,execute:async(t,e)=>qBn(t,["rename",...e])}});var nSn=p(()=>{"use strict"});var sSn={};Eo(sSn,{fetchLatestRelease:()=>x6,fetchReleaseByTag:()=>nkl,getUpdateChannel:()=>qde,getVersion:()=>A3,getVersionWithoutUpdateCheck:()=>$4l,isPrerelease:()=>rSn,showVersionWithUpdateCheck:()=>ekl});function A3(){return process.env.COPILOT_CLI_VERSION||"1.0.1"}function rSn(){try{let t=(0,I5e.parse)("1.0.1");return t!==null&&t.prerelease.length>0}catch{return!1}}function qde(t,e){return t||(e||rSn()?"prerelease":"stable")}function $4l(){return`GitHub Copilot CLI ${sP().version}.
2883
+ Example: /session rename Building e-commerce platform`}}}return n==="prune"?t.featureFlags.SESSION_CLEANUP?_4l(t,e.slice(1)):LWt(e[0],t.featureFlags.SESSION_CLEANUP):n==="cleanup"&&t.featureFlags.SESSION_CLEANUP?q4l(t,e.slice(1)):LWt(e[0],t.featureFlags.SESSION_CLEANUP)};$Bn={name:jXe,args:"[checkpoints [n]|files|plan|rename <name>]",help:"Show session info and workspace summary. Use subcommands for details.",allowDuringAgentExecution:!0,execute:async(t,e)=>qBn(t,e)},eSn={name:MXe,args:"<name>",help:"Rename the current session (alias for /session rename)",allowDuringAgentExecution:!0,execute:async(t,e)=>qBn(t,["rename",...e])}});var nSn=p(()=>{"use strict"});var sSn={};Eo(sSn,{fetchLatestRelease:()=>x6,fetchReleaseByTag:()=>nkl,getUpdateChannel:()=>qde,getVersion:()=>A3,getVersionWithoutUpdateCheck:()=>$4l,isPrerelease:()=>rSn,showVersionWithUpdateCheck:()=>ekl});function A3(){return process.env.COPILOT_CLI_VERSION||"1.0.2"}function rSn(){try{let t=(0,I5e.parse)("1.0.2");return t!==null&&t.prerelease.length>0}catch{return!1}}function qde(t,e){return t||(e||rSn()?"prerelease":"stable")}function $4l(){return`GitHub Copilot CLI ${sP().version}.
2884
2884
  Run 'copilot update' to check for updates.`}async function ekl(t){let e=sP();process.stdout.write(`GitHub Copilot CLI ${e.version}
2885
2885
  `);let n=qde(t.update_channel,t.staff),r=await x6(n);if("error"in r){process.stderr.write(`
2886
2886
  Unable to check for updates: ${String(r.error)}