1+ import type { State } from "./state"
2+
13export const COPILOT_API_CONFIG = {
24 baseURL : "https://api.individual.githubcopilot.com" ,
35 headers : {
@@ -8,16 +10,20 @@ export const COPILOT_API_CONFIG = {
810} as const
911
1012export const COPILOT_API_BASE_URL = "https://api.individual.githubcopilot.com"
11- const COPILOT_API_SPOOF_HEADERS = {
13+ export const copilotHeaders = ( state : State ) => ( {
14+ Authorization : `token ${ state . copilotToken } ` ,
1215 "copilot-integration-id" : "vscode-chat" ,
13- }
14-
15- export const buildCopilotHeaders = ( token : string ) => ( {
16- Authorization : `token ${ token } ` ,
17- ...COPILOT_API_SPOOF_HEADERS ,
1816} )
1917
2018export const GITHUB_API_BASE_URL = "https://api.github.com"
19+ export const githubHeaders = ( state : State ) => ( {
20+ authorization : `token ${ state . githubToken } ` ,
21+ "editor-version" : `vscode/${ state . vsCodeVersion } ` ,
22+ "editor-plugin-version" : "copilot-chat/0.24.1" ,
23+ "user-agent" : "GitHubCopilotChat/0.24.1" ,
24+ "x-github-api-version" : "2024-12-15" ,
25+ "x-vscode-user-agent-library-version" : "electron-fetch" ,
26+ } )
2127
2228export const GITHUB_BASE_URL = "https://github.com"
2329export const GITHUB_CLIENT_ID = "01ab8ac9400c4e429b23"
0 commit comments