@@ -6,6 +6,10 @@ import { resolveApiKeyForProfile } from "../agents/auth-profiles/oauth.js";
66import { resolveAuthProfileOrder } from "../agents/auth-profiles/order.js" ;
77import { listProfilesForProvider } from "../agents/auth-profiles/profiles.js" ;
88import { ensureAuthProfileStore } from "../agents/auth-profiles/store.js" ;
9+ import {
10+ COPILOT_INTEGRATION_ID ,
11+ buildCopilotIdeHeaders ,
12+ } from "../agents/copilot-dynamic-headers.js" ;
913import { resolveEnvApiKey } from "../agents/model-auth-env.js" ;
1014import type { OpenClawConfig } from "../config/config.js" ;
1115import { resolveStateDir } from "../config/paths.js" ;
@@ -94,19 +98,17 @@ export {
9498 DEFAULT_OAUTH_REFRESH_MARGIN_MS ,
9599 hasUsableOAuthCredential ,
96100} from "../agents/auth-profiles/credential-state.js" ;
101+ export {
102+ COPILOT_EDITOR_PLUGIN_VERSION ,
103+ COPILOT_EDITOR_VERSION ,
104+ COPILOT_GITHUB_API_VERSION ,
105+ COPILOT_INTEGRATION_ID ,
106+ COPILOT_USER_AGENT ,
107+ buildCopilotIdeHeaders ,
108+ } from "../agents/copilot-dynamic-headers.js" ;
97109
98110const COPILOT_TOKEN_URL = "https://api.github.com/copilot_internal/v2/token" ;
99111
100- /** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
101- export const COPILOT_EDITOR_VERSION = "vscode/1.107.0" ;
102- /** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
103- export const COPILOT_USER_AGENT = "GitHubCopilotChat/0.35.0" ;
104- /** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
105- export const COPILOT_EDITOR_PLUGIN_VERSION = "copilot-chat/0.35.0" ;
106- /** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
107- export const COPILOT_GITHUB_API_VERSION = "2025-04-01" ;
108- /** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
109- export const COPILOT_INTEGRATION_ID = "vscode-chat" ;
110112/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
111113export const DEFAULT_COPILOT_API_BASE_URL = "https://api.individual.githubcopilot.com" ;
112114
@@ -118,21 +120,6 @@ export type CachedCopilotToken = {
118120 integrationId ?: string ;
119121} ;
120122
121- /** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
122- export function buildCopilotIdeHeaders (
123- params : {
124- includeApiVersion ?: boolean ;
125- } = { } ,
126- ) : Record < string , string > {
127- return {
128- "Accept-Encoding" : "identity" ,
129- "Editor-Version" : COPILOT_EDITOR_VERSION ,
130- "Editor-Plugin-Version" : COPILOT_EDITOR_PLUGIN_VERSION ,
131- "User-Agent" : COPILOT_USER_AGENT ,
132- ...( params . includeApiVersion ? { "X-Github-Api-Version" : COPILOT_GITHUB_API_VERSION } : { } ) ,
133- } ;
134- }
135-
136123function resolveCopilotTokenCachePath ( env : NodeJS . ProcessEnv = process . env ) {
137124 return path . join ( resolveStateDir ( env ) , "credentials" , "github-copilot.token.json" ) ;
138125}
0 commit comments