var y=class{async fetch(n,e){let r={method:e.method||"GET",headers:e.headers,signal:e.signal};e.json?(r.body=JSON.stringify(e.json),r.headers={"Content-Type":"application/json",...r.headers}):e.body&&(r.body=e.body);let t,i;e.timeout&&!e.signal&&(i=new AbortController,r.signal=i.signal,t=setTimeout(()=>{i.abort()},e.timeout));try{let s=await fetch(n,r);return t&&clearTimeout(t),s}catch(s){throw t&&clearTimeout(t),s}}async fetchWithPagination(n,e){let r=[],t=e.pageSize??20,i=e.startPage??1,s=!1;do{let a=e.buildUrl(n,t,i),l=await this.fetch(a,e);if(!l.ok)return r;let g=await l.json(),d=e.getItemsFromResponse(g);r.push(...d),s=d.length===t,i++}while(s);return r}createWebSocket(n,e){return{webSocket:new WebSocket(n)}}};var m=class m{constructor(){this._telemetryBaseUrl="https://copilot-telemetry.githubusercontent.com";this._originTrackerUrl="https://origin-tracker.githubusercontent.com";this._dotcomAPIUrl=this._getDotComAPIUrl(),this._proxyBaseUrl=this._getProxyUrl(void 0),this._capiBaseUrl=this._getCAPIUrl(void 0)}updateDomains(n,e){let r=this._dotcomAPIUrl,t=this._capiBaseUrl,i=this._telemetryBaseUrl,s=this._proxyBaseUrl;return this._enterpriseUrlConfig!==e&&(this._enterpriseUrlConfig=e,this._dotcomAPIUrl=this._getDotComAPIUrl()),n?(this._proxyBaseUrl=this._getProxyUrl(n),this._capiBaseUrl=this._getCAPIUrl(n),this._telemetryBaseUrl=n.endpoints.telemetry||"https://copilot-telemetry.githubusercontent.com",n.endpoints["origin-tracker"]&&(this._originTrackerUrl=n.endpoints["origin-tracker"])):(this._capiBaseUrl="https://api.githubcopilot.com",this._telemetryBaseUrl="https://copilot-telemetry.githubusercontent.com"),{dotcomUrlChanged:r!==this._dotcomAPIUrl,capiUrlChanged:t!==this._capiBaseUrl,telemetryUrlChanged:i!==this._telemetryBaseUrl,proxyUrlChanged:s!==this._proxyBaseUrl}}_getDotComAPIUrl(){if(this._enterpriseUrlConfig)try{let n=new URL(this._enterpriseUrlConfig);return`${n.protocol}//api.${n.hostname}${n.port?":"+n.port:""}`}catch(n){return console.warn("Failed to parse enterprise URL config:",this._enterpriseUrlConfig,n),"https://api.github.com"}return"https://api.github.com"}_getCAPIUrl(n){return n&&n.endpoints.api||"https://api.githubcopilot.com"}_getProxyUrl(n){return n&&n.endpoints.proxy||m.DEFAULT_PROXY_BASE_URL}get proxyBaseURL(){return this._proxyBaseUrl}get capiBaseURL(){return this._capiBaseUrl}get capiChatURL(){return`${this._capiBaseUrl}/chat/completions`}get capiResponsesURL(){return`${this._capiBaseUrl}/responses`}get capiMessagesURL(){return`${this._capiBaseUrl}/v1/messages`}get capiEmbeddingsURL(){return`${this._capiBaseUrl}/embeddings`}get capiModelsURL(){return`${this._capiBaseUrl}/models`}get capiAutoModelURL(){return`${this.capiModelsURL}/session`}get capiModelRouterURL(){return`${this.capiAutoModelURL}/intent`}get embeddingsModelURL(){return`${this.embeddingsURL}/models`}get chunksURL(){return`${this.dotComAPIURL}/chunks`}get embeddingsURL(){return`${this.dotComAPIURL}/embeddings`}get embeddingsCodeSearchURL(){return`${this.dotComAPIURL}/embeddings/code/search`}get telemetryURL(){return`${this._telemetryBaseUrl}/telemetry`}get remoteAgentsURL(){return`${this._capiBaseUrl}/agents`}get listSkillsURL(){return`${this._capiBaseUrl}/skills`}get searchSkillURL(){return`${this._capiBaseUrl}/search`}get contentExclusionURL(){return`${this._dotcomAPIUrl}/copilot_internal/content_exclusion`}get copilotUserInfoURL(){return`${this._dotcomAPIUrl}/copilot_internal/user`}get tokenURL(){return this._dotcomAPIUrl+"/copilot_internal/v2/token"}get tokenNoAuthURL(){return`${this._dotcomAPIUrl}/copilot_internal/v2/nltoken`}get dotComAPIURL(){return this._dotcomAPIUrl}get originTrackerURL(){return this._originTrackerUrl}get chatAttachmentUploadURL(){return"https://uploads.github.com/copilot/chat/attachments"}get copilotAgentSessionsURL(){return`${this._capiBaseUrl}/agents/sessions`}get copilotAgentJobsURL(){return`${this._capiBaseUrl}/agents/swe`}get copilotAgentTasksURL(){return`${this._dotcomAPIUrl}/cmc_internal/api/agents`}get CCAModelsURL(){return`${this._capiBaseUrl}/agents/swe/models`}get copilotCustomAgentsURL(){return`${this._capiBaseUrl}/agents/swe/custom-agents`}get copilotAgentMemoryURL(){return`${this._capiBaseUrl}/agents/swe/internal/memory/v0`}};m.DEFAULT_PROXY_BASE_URL="https://copilot-proxy.githubusercontent.com",m.CAPI_MODEL_LAB_URL="https://api-model-lab.githubcopilot.com";var p=m;var C=`The \u201C@vscode/copilot-api\u201D npm Module Terms and Conditions ("Terms") are a legal agreement between you (either as an individual or on behalf of an entity) and GitHub, Inc. regarding your use of \u201C@vscode/copilot-api\u201D npm library and associated documentation (collectively, the "Software"). By using the Software, you accept these Terms. Please read all of these Terms; in many cases, provisions set forth later in the Terms limit and qualify provisions set forth earlier in the Terms. If you do not accept these Terms, do not download, install, use, or copy the Software.

IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.

1. INSTALLATION AND USE RIGHTS. You may install and use any number of copies of the software only with the Visual Studio Code or Code-OSS and successor Microsoft products and services for use with GitHub Copilot. The use with Code-OSS is allowed for development purposes only. No other use is permitted. 

2. TERMS FOR SPECIFIC COMPONENTS. The software may include third party components with separate legal notices or governed by other agreements, as may be described in the notices file(s) accompanying the software.

3. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. GitHub reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not: 
  a) work around any technical limitations in the software;
  b) reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software except, and only to the extent required by third party licensing terms governing the use of certain open source components that may be included in the software;
  c) remove, minimize, block or modify any notices of GitHub or its suppliers in the software; 
  d) use the Software to create or propagate malware, or in any other way that is prohibited by law; 
  e) share, publish, rent or lease the software, except in combining the software with GitHub applications; or 
  f) provide the software as a stand-alone offering or combined with any of your applications for others to use, or transfer the software or this agreement to any third party, except in combining the software with GitHub applications. 

4. EXPORT RESTRICTIONS. You must comply with all domestic and international export laws and regulations that apply to the software, which include restrictions on destinations, end users, and end use.

5. SUPPORT SERVICES. Because this software is "as is," we may not provide support services for it.

6. FEEDBACK.  If you give feedback about the software to GitHub, you give to GitHub the right to use, share, and commercialize your feedback in any way and for any purpose, without payment to you. You agree that you will not give feedback that is subject to any license that would require GitHub to license its software or documentation to third parties if we included your feedback in them.

7. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for this Software and support services. These Terms may only be modified by a written amendment signed by an authorized representative of GitHub, or by the posting by GitHub of a revised version.

8. APPLICABLE LAW. If you acquired the software in the United States, California law applies to interpretation of and claims for breach of this agreement, and the laws of the state where you live apply to all other claims. If you acquired the software in any other country, its laws apply.

9. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights. You may have other rights, including consumer rights, under the laws of your state or country. Separate and apart from your relationship with GitHub, you may also have rights with respect to the party from which you acquired the software. This agreement does not change those other rights if the laws of your state or country do not permit it to do so. For example, if you acquired the software in one of the below regions, or mandatory country law applies, then the following provisions apply to you:
a. Australia. You have statutory guarantees under the Australian Consumer Law and nothing in this agreement is intended to affect those rights.

b. Canada. If you acquired this software in Canada, you may stop receiving updates by turning off the automatic update feature, disconnecting your device from the Internet (if and when you re-connect to the Internet, however, the software will resume checking for and installing updates), or uninstalling the software. The product documentation, if any, may also specify how to turn off updates for your specific device or software.

c. Germany and Austria.
(i)	Warranty. The properly licensed software will perform substantially as described in any GitHub materials that accompany the software. However, GitHub gives no contractual guarantee in relation to the licensed software.
(ii)	Limitation of Liability. In case of intentional conduct, gross negligence, claims based on the Product Liability Act, as well as, in case of death or personal or physical injury, GitHub is liable according to the statutory law.
Subject to the foregoing clause (ii), GitHub will only be liable for slight negligence if GitHub is in breach of such material contractual obligations, the fulfillment of which facilitate the due performance of this agreement, the breach of which would endanger the purpose of this agreement and the compliance with which a party may constantly trust in (so-called "cardinal obligations"). In other cases of slight negligence, GitHub will not be liable for slight negligence.

10. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED "AS-IS." YOU BEAR THE RISK OF USING IT. GITHUB GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, GITHUB EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.

11. LIMITATION ON AND EXCLUSION OF DAMAGES. YOU CAN RECOVER FROM GITHUB AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $50.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.

This limitation applies to (a) anything related to the software, services, content (including code) on third party Internet sites, or third party applications; and (b) claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.

It also applies even if GitHub knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.`,S=`I have read and agree to the following license terms:

${C}
`;var k=(o=>(o.CopilotToken="CopilotToken",o.CopilotNLToken="CopilotNLToken",o.ChatCompletions="ChatCompletions",o.ChatResponses="ChatResponses",o.ChatMessages="ChatMessages",o.ProxyCompletions="ProxyCompletions",o.ProxyChatCompletions="ProxyChatCompletions",o.RemoteAgent="RemoteAgent",o.RemoteAgentChat="RemoteAgentChat",o.CodeReviewAgent="CodeReviewAgent",o.CAPIEmbeddings="CAPIEmbeddings",o.DotcomEmbeddings="DotcomEmbeddings",o.EmbeddingsModels="EmbeddingsModels",o.Models="Models",o.AutoModels="AutoModels",o.Chunks="Chunks",o.EmbeddingsCodeSearch="EmbeddingsCodeSearch",o.ListSkills="ListSkills",o.SearchSkill="SearchSkill",o.ContentExclusion="ContentExclusion",o.Telemetry="Telemetry",o.CopilotUserInfo="CopilotUserInfo",o.ModelPolicy="ModelPolicy",o.ListModel="ListModel",o.SnippyMatch="SnippyMatch",o.SnippyFilesForMatch="SnippyFlesForMatch",o.CodingGuidelines="CodingGuidelines",o.EmbeddingsIndex="EmbedingsIndex",o.ChatAttachmentUpload="ChatAttachmentUpload",o.CopilotSessionLogs="CopilotSessionLogs",o.CopilotSessionDetails="CopilotSessionDetails",o.CopilotSessions="CopilotSessions",o.CopilotAgentJob="CopilotAgentJob",o.CCAModelsList="CCAModelsList",o.CopilotCustomAgents="CopilotCustomAgents",o.CopilotCustomAgentsDetail="CopilotCustomAgentsDetail",o.OrgCustomInstructions="OrgCustomInstructions",o.CopilotAgentMemory="CopilotAgentMemory",o.CopilotAgentJobEnabled="CopilotAgentJobEnabled",o.AgentTask="AgentTask",o.ModelRouter="ModelRouter",o))(k||{});async function v(h){if(!h)return;let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(h),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),e=Math.floor(Date.now()/1e3).toString(),t=new TextEncoder().encode(e),i=await crypto.subtle.sign("HMAC",n,t),a=Array.from(new Uint8Array(i)).map(l=>l.toString(16).padStart(2,"0")).join("");return`${e}.${a}`}function _(h){return new Set(["ChatCompletions","ChatResponses","ChatMessages","CAPIEmbeddings","Models","RemoteAgent","CodeReviewAgent","RemoteAgentChat","ListSkills","SearchSkill","ModelPolicy","ListModel","AutoModels","CopilotSessionLogs","CopilotSessionDetails","CopilotSessions","CopilotAgentJob","CCAModelsList","CopilotCustomAgents","CopilotAgentMemory","ModelRouter"]).has(h)}var f=class{constructor(n,e,r,t,i){this._extensionInfo=n;this._integrationId=i;this._licenseCheckSucceeded=!1;if(e&&e===S&&(this._licenseCheckSucceeded=!0),this._domainService=new p,this._fetcherService=r??new y,this._hmacSecret=t,this._integrationId==="vscode-chat"||this._integrationId==="code-oss")throw new Error(`Integration ID ${this._integrationId} is reserved and cannot be used.`)}updateDomains(n,e){return n&&n.sku&&(this._copilotSku=n.sku),this._domainService.updateDomains(n,e)}async makeRequest(n,e){let{type:r}=e;await this._mixinHeaders(n,e);let t={...n,callSite:n.callSite??r};switch(r){case"CopilotToken":return this._fetcherService.fetch(this._domainService.tokenURL,t);case"CopilotNLToken":return this._fetcherService.fetch(this._domainService.tokenNoAuthURL,t);case"ProxyCompletions":return this._fetcherService.fetch(`${this._domainService.proxyBaseURL}/v1/engines/gpt-4o-copilot/completions`,t);case"ProxyChatCompletions":return this._fetcherService.fetch(`${this._domainService.proxyBaseURL}/chat/completions`,t);case"RemoteAgent":return this._fetcherService.fetch(this._domainService.remoteAgentsURL,t);case"CodeReviewAgent":return this._fetcherService.fetch(`${this._domainService.remoteAgentsURL}/github-code-review`,t);case"CAPIEmbeddings":return this._fetcherService.fetch(this._domainService.capiEmbeddingsURL,t);case"DotcomEmbeddings":return this._fetcherService.fetch(this._domainService.embeddingsURL,t);case"EmbeddingsModels":return this._fetcherService.fetch(this._domainService.embeddingsModelURL,t);case"Chunks":return this._fetcherService.fetch(this._domainService.chunksURL,t);case"EmbeddingsCodeSearch":return this._fetcherService.fetch(this._domainService.embeddingsCodeSearchURL,t);case"ListSkills":return this._fetcherService.fetch(this._domainService.listSkillsURL,t);case"Telemetry":return this._fetcherService.fetch(this._domainService.telemetryURL,t);case"CopilotUserInfo":return this._fetcherService.fetch(this._domainService.copilotUserInfoURL,t);case"SnippyMatch":return this._fetcherService.fetch(`${this._domainService.originTrackerURL}/twirp/github.snippy.v1.SnippyAPI/Match`,t);case"SnippyFlesForMatch":return this._fetcherService.fetch(`${this._domainService.originTrackerURL}/twirp/github.snippy.v1.SnippyAPI/FilesForMatch`,t);case"EmbedingsIndex":if(!("repoWithOwner"in e))throw new Error("repoWithOwner is required for EmbeddingsIndex request");return this._fetcherService.fetch(`${this._domainService.dotComAPIURL}/repos/${e.repoWithOwner}/copilot_internal/embeddings_index`,t);case"CodingGuidelines":if(!("repoWithOwner"in e))throw new Error("repoWithOwner is required for CodingGuidelines request");return this._fetcherService.fetch(`${this._domainService.dotComAPIURL}/repos/${e.repoWithOwner}/copilot_internal/coding_guidelines`,t);case"AutoModels":return this._fetcherService.fetch(this._domainService.capiAutoModelURL,t);case"ModelRouter":return this._fetcherService.fetch(this._domainService.capiModelRouterURL,t);case"Models":return"isModelLab"in e&&e.isModelLab?this._fetcherService.fetch(`${p.CAPI_MODEL_LAB_URL}/models`,t):this._fetcherService.fetch(this._domainService.capiModelsURL,t);case"ChatCompletions":return"isModelLab"in e&&e.isModelLab?this._fetcherService.fetch(`${p.CAPI_MODEL_LAB_URL}/chat/completions`,t):this._fetcherService.fetch(this._domainService.capiChatURL,t);case"ChatResponses":return"isModelLab"in e&&e.isModelLab?this._fetcherService.fetch(`${p.CAPI_MODEL_LAB_URL}/responses`,t):this._fetcherService.fetch(this._domainService.capiResponsesURL,t);case"ChatMessages":return"isModelLab"in e&&e.isModelLab?this._fetcherService.fetch(`${p.CAPI_MODEL_LAB_URL}/v1/messages`,t):this._fetcherService.fetch(this._domainService.capiMessagesURL,t);case"ContentExclusion":if(!("repos"in e))throw new Error("Repos are required for ContentExclusion request");return this._fetcherService.fetch(this._prepareContentExclusionUrl(e.repos),t);case"RemoteAgentChat":return"slug"in e&&e.slug?this._fetcherService.fetch(`${this._domainService.remoteAgentsURL}/${e.slug}?chat`,t):this._fetcherService.fetch(`${this._domainService.remoteAgentsURL}/chat`,t);case"SearchSkill":if(!("slug"in e))throw new Error("Skill slug is required for SearchSkill request");return this._fetcherService.fetch(`${this._domainService.searchSkillURL}/${e.slug}`,t);case"ModelPolicy":if(!("modelId"in e))throw new Error("Model ID is required for ModelPolicy request");return this._fetcherService.fetch(`${this._domainService.capiModelsURL}/${e.modelId}/policy`,t);case"ListModel":if(!("modelId"in e))throw new Error("Model ID is required for ListModel request");return this._fetcherService.fetch(`${this._domainService.capiModelsURL}/${e.modelId}`,t);case"ChatAttachmentUpload":if(!("uploadName"in e)||!("mimeType"in e))throw new Error("uploadName and mimeType are required for ChatAttachmentUpload request");return this._fetcherService.fetch(`${this._domainService.chatAttachmentUploadURL}?name=${e.uploadName}&content_type=${e.mimeType}`,t);case"CopilotSessionLogs":if(!("sessionId"in e))throw new Error("sessionId is required for CopilotSessionLogs request");return this._fetcherService.fetch(`${this._domainService.copilotAgentSessionsURL}/${e.sessionId}/logs`,t);case"CopilotSessionDetails":if(!("sessionId"in e))throw new Error("sessionId is required for CopilotSessionDetails request");return this._fetcherService.fetch(`${this._domainService.copilotAgentSessionsURL}/${e.sessionId}`,t);case"CopilotSessions":let i={...t,getItemsFromResponse:s=>{let a=s;return a&&Array.isArray(a.sessions)?a.sessions:[]},buildUrl:(s,a,l)=>{let g=new URL(s);return g.searchParams.set("page_size",a.toString()),g.searchParams.set("page_number",l.toString()),"resourceState"in e&&e.resourceState&&g.searchParams.set("resource_state",e.resourceState),"nwo"in e&&e.nwo&&g.searchParams.set("repo_nwo",e.nwo),g.toString()}};return"prId"in e&&e.prId?this._fetcherService.fetch(`${this._domainService.copilotAgentSessionsURL}/resource/pull/${e.prId}`,t):this._fetcherService.fetchWithPagination(this._domainService.copilotAgentSessionsURL,i);case"CopilotAgentJob":if(!("owner"in e)||!("repo"in e))throw new Error("owner and repo are required for CopilotAgentJob request");if("jobId"in e&&e.jobId){let s="apiVersion"in e&&e.apiVersion||"v1";return this._fetcherService.fetch(`${this._domainService.copilotAgentJobsURL}/${s}/jobs/${e.owner}/${e.repo}/${e.jobId}`,t)}if("sessionId"in e&&e.sessionId){let s="apiVersion"in e&&e.apiVersion||"v1";return this._fetcherService.fetch(`${this._domainService.copilotAgentJobsURL}/${s}/jobs/${e.owner}/${e.repo}/session/${e.sessionId}`,t)}if("payload"in e&&e.payload){let s="apiVersion"in e&&e.apiVersion||"v1";return this._fetcherService.fetch(`${this._domainService.copilotAgentJobsURL}/${s}/jobs/${e.owner}/${e.repo}`,t)}throw new Error("jobId or sessionId is required for CopilotAgentJob request");case"CCAModelsList":return this._fetcherService.fetch(this._domainService.CCAModelsURL,t);case"CopilotCustomAgents":{if(!("owner"in e)||!("repo"in e))throw new Error("owner and repo are required for CopilotCustomAgents request");let s=new URL(`${this._domainService.copilotCustomAgentsURL}/${e.owner}/${e.repo}`);return"target"in e&&e.target&&s.searchParams.set("target",e.target),"exclude_invalid_config"in e&&e.exclude_invalid_config!==void 0&&s.searchParams.set("exclude_invalid_config",e.exclude_invalid_config.toString()),"dedupe"in e&&e.dedupe!==void 0&&s.searchParams.set("dedupe",e.dedupe.toString()),"include_sources"in e&&e.include_sources&&s.searchParams.set("include_sources",e.include_sources.join(",")),this._fetcherService.fetch(s.toString(),t)}case"CopilotCustomAgentsDetail":{if(!("owner"in e)||!("repo"in e)||!("customAgentName"in e))throw new Error("owner, repo and customAgentName are required for CopilotCustomAgents request");let s=new URL(`${this._domainService.copilotCustomAgentsURL}/${e.owner}/${e.repo}/${e.customAgentName}`);return"version"in e&&e.version&&s.searchParams.set("version",e.version),this._fetcherService.fetch(s.toString(),t)}case"OrgCustomInstructions":if(!("orgLogin"in e))throw new Error("orgLogin is required for OrgCustomInstructions request");return this._fetcherService.fetch(`${this._domainService.dotComAPIURL}/copilot_internal/org_custom_instructions/${e.orgLogin}`,t);case"CopilotAgentMemory":{if(!("repo"in e))throw new Error("repo is required for CopilotAgentMemory request");let s="action"in e?e.action:"",a=`${this._domainService.copilotAgentMemoryURL}/${e.repo}`;return s&&(a+=`/${s}`,s==="recent"&&"limit"in e&&e.limit!==void 0&&(a+=`?limit=${e.limit}`)),this._fetcherService.fetch(a,t)}case"CopilotAgentJobEnabled":{if(!("owner"in e)||!("repo"in e))throw new Error("owner and repo are required for CopilotAgentJobEnabled request");return this._fetcherService.fetch(`${this._domainService.copilotAgentJobsURL}/v1/jobs/${e.owner}/${e.repo}/enabled`,t)}case"AgentTask":return this._fetcherService.fetch(this._buildAgentTaskURL(e),t);default:throw new Error(`Unsupported request type: ${r}`)}}_buildAgentTaskURL(n){let e=this._domainService.copilotAgentTasksURL,{action:r,owner:t,repo:i,taskId:s,searchParams:a}=n,l=()=>{if(!s)throw new Error(`taskId is required for AgentTask action "${r}"`);return s},g=()=>{if(!t||!i)throw new Error(`owner and repo are required for AgentTask action "${r}"`);return{owner:t,repo:i}},d;switch(r){case"create":{let c=g();d=`/repos/${c.owner}/${c.repo}/tasks`;break}case"list":d="/tasks";break;case"list-for-repo":{let c=g();d=`/repos/${c.owner}/${c.repo}/tasks`;break}case"get":d=`/tasks/${l()}`;break;case"events":d=`/tasks/${l()}/events`;break;case"steer":d=`/tasks/${l()}/steer`;break;case"create-pr":{let c=g();d=`/repos/${c.owner}/${c.repo}/tasks/${l()}/pulls`;break}case"archive":d=`/tasks/${l()}/archive`;break;case"unarchive":d=`/tasks/${l()}/unarchive`;break;default:{let c=r;throw new Error(`Unsupported AgentTask action: ${c}`)}}let A=`${e}${d}`;if(a){let c=new URLSearchParams;for(let[b,u]of Object.entries(a))u!=null&&c.set(b,String(u));let T=c.toString();T&&(A+=`?${T}`)}return A}async createResponsesWebSocket(n){return await this._mixinHeaders(n,{type:"ChatResponses"}),this._fetcherService.createWebSocket(this._domainService.capiResponsesURL,n)}_prepareContentExclusionUrl(n){let e=n.join(","),r=new URL(this._domainService.contentExclusionURL);return n.length!==0&&r.searchParams.set("repos",e),r.searchParams.set("scope","repo"),r.toString()}async _mixinHeaders(n,e){if(!_(e.type))return;let r=n.headers||{};r["X-GitHub-Api-Version"]="2026-06-01",r["VScode-SessionId"]=this._extensionInfo.sessionId,r["VScode-MachineId"]=this._extensionInfo.machineId,r["Editor-Device-Id"]=this._extensionInfo.deviceId,r["Editor-Plugin-Version"]=`copilot-chat/${this._extensionInfo.version}`,r["Editor-Version"]=`vscode/${this._extensionInfo.vscodeVersion}`;let t="";n.suppressIntegrationId||(t="code-oss",this._integrationId&&this._hmacSecret?t=this._integrationId:this._copilotSku==="no_auth_limited_copilot"?t="vscode-nl":this._licenseCheckSucceeded&&this._extensionInfo.buildType==="prod"?t="vscode-chat":this._extensionInfo.buildType==="dev"&&this._hmacSecret&&(t="vscode-chat-dev"),r["Copilot-Integration-Id"]=t),t==="vscode-chat-dev"&&(r["Request-Hmac"]=await v(this._hmacSecret)),n.headers=r}get copilotTelemetryURL(){return this._domainService.telemetryURL}get dotcomAPIURL(){return this._domainService.dotComAPIURL}get capiPingURL(){return`${this._domainService.capiBaseURL}/_ping`}get proxyBaseURL(){return this._domainService.proxyBaseURL}get originTrackerURL(){return this._domainService.originTrackerURL}get snippyMatchPath(){return"twirp/github.snippy.v1.SnippyAPI/Match"}get snippyFilesForMatchPath(){return"twirp/github.snippy.v1.SnippyAPI/FilesForMatch"}};export{f as CAPIClient,k as RequestType};//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/6a44c352bd24569c417e530095901b649960f9f8/node_modules/@vscode/copilot-api/dist/index.js.map
