@nick3/copilot-api 1.9.2 → 1.10.4
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/README.md +114 -89
- package/README.zh-CN.md +114 -86
- package/dist/{account-MllYSdRC.js → account-COtMmvzU.js} +20 -24
- package/dist/account-COtMmvzU.js.map +1 -0
- package/dist/admin/assets/index-CBMFCvqO.css +1 -0
- package/dist/admin/assets/index-DG4TRVMu.js +110 -0
- package/dist/admin/index.html +2 -2
- package/dist/{auth-DZoQA-kn.js → auth-B0y-2njL.js} +103 -112
- package/dist/auth-B0y-2njL.js.map +1 -0
- package/dist/{check-usage-DEbsehjH.js → check-usage-DdevqHE5.js} +6 -7
- package/dist/{check-usage-DEbsehjH.js.map → check-usage-DdevqHE5.js.map} +1 -1
- package/dist/{debug-BJfZVBB7.js → debug-BMo6ltbp.js} +6 -6
- package/dist/debug-BMo6ltbp.js.map +1 -0
- package/dist/{get-copilot-token-4mCKt94e.js → get-copilot-token-8Rm-rVsp.js} +3 -4
- package/dist/{get-copilot-token-4mCKt94e.js.map → get-copilot-token-8Rm-rVsp.js.map} +1 -1
- package/dist/main.js +6 -7
- package/dist/main.js.map +1 -1
- package/dist/{paths-DGlr310R.js → paths-CclKwouX.js} +3 -5
- package/dist/{paths-DGlr310R.js.map → paths-CclKwouX.js.map} +1 -1
- package/dist/{poll-access-token-Dvk6Ho0R.js → poll-access-token-BAgM2-7k.js} +65 -21
- package/dist/poll-access-token-BAgM2-7k.js.map +1 -0
- package/dist/{accounts-manager-BM66oT38.js → proxy-BwmADhKh.js} +494 -52
- package/dist/proxy-BwmADhKh.js.map +1 -0
- package/dist/request-outbound-BJjWS_jF.js +2 -0
- package/dist/{request-outbound-qyTeXbzy.js → request-outbound-Pu1kp2x8.js} +16 -9
- package/dist/request-outbound-Pu1kp2x8.js.map +1 -0
- package/dist/{server-DR9ZR_MN.js → server-DxQsi1x2.js} +2106 -935
- package/dist/server-DxQsi1x2.js.map +1 -0
- package/dist/{start-DDhYUFQR.js → start-8QHzPrcg.js} +11 -60
- package/dist/start-8QHzPrcg.js.map +1 -0
- package/package.json +20 -7
- package/dist/account-MllYSdRC.js.map +0 -1
- package/dist/accounts-manager-BM66oT38.js.map +0 -1
- package/dist/admin/assets/index-8eGib92I.js +0 -107
- package/dist/admin/assets/index-B2qj1asn.css +0 -1
- package/dist/auth-DZoQA-kn.js.map +0 -1
- package/dist/debug-BJfZVBB7.js.map +0 -1
- package/dist/poll-access-token-Dvk6Ho0R.js.map +0 -1
- package/dist/request-outbound-DhI9-SrV.js +0 -4
- package/dist/request-outbound-qyTeXbzy.js.map +0 -1
- package/dist/server-DR9ZR_MN.js.map +0 -1
- package/dist/start-DDhYUFQR.js.map +0 -1
|
@@ -5,7 +5,16 @@ import { exec } from "node:child_process";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { networkInterfaces } from "node:os";
|
|
8
|
-
|
|
8
|
+
const compactSystemPromptStarts = ["You are a helpful AI assistant tasked with summarizing conversations", "You are an anchored context summarization assistant for coding sessions."];
|
|
9
|
+
const compactTextOnlyGuard = "CRITICAL: Respond with TEXT ONLY. Do NOT call any tools.";
|
|
10
|
+
const compactSummaryPromptStart = "Your task is to create a detailed summary of the conversation so far";
|
|
11
|
+
const compactAutoContinuePromptStarts = [
|
|
12
|
+
"This session is being continued from a previous conversation that ran out of context. The summary below covers the earlier portion of the conversation.",
|
|
13
|
+
"Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed.",
|
|
14
|
+
"The previous request exceeded the provider's size limit due to large media attachments. The conversation was compacted and media files were removed from context."
|
|
15
|
+
];
|
|
16
|
+
const compactMessageSections = ["Pending Tasks:", "Current Work:"];
|
|
17
|
+
//#endregion
|
|
9
18
|
//#region src/lib/opencode.ts
|
|
10
19
|
const execAsync = (command) => {
|
|
11
20
|
return new Promise((resolve, reject) => {
|
|
@@ -39,7 +48,6 @@ const initOpencodeVersion = () => {
|
|
|
39
48
|
const getCachedOpencodeVersion = () => {
|
|
40
49
|
return opencodeVersionCache;
|
|
41
50
|
};
|
|
42
|
-
|
|
43
51
|
//#endregion
|
|
44
52
|
//#region src/lib/request-context.ts
|
|
45
53
|
const TRACE_ID_MAX_LENGTH = 64;
|
|
@@ -100,7 +108,6 @@ function resolveTraceId(traceId) {
|
|
|
100
108
|
if (!candidate || candidate.length > TRACE_ID_MAX_LENGTH || !TRACE_ID_PATTERN.test(candidate)) return generateTraceId();
|
|
101
109
|
return candidate;
|
|
102
110
|
}
|
|
103
|
-
|
|
104
111
|
//#endregion
|
|
105
112
|
//#region src/lib/state.ts
|
|
106
113
|
const state = {
|
|
@@ -129,7 +136,6 @@ function accountFromState() {
|
|
|
129
136
|
clientSessionId: state.vsCodeSessionId
|
|
130
137
|
};
|
|
131
138
|
}
|
|
132
|
-
|
|
133
139
|
//#endregion
|
|
134
140
|
//#region src/lib/api-config.ts
|
|
135
141
|
const isOpencodeOauthApp = () => {
|
|
@@ -191,7 +197,13 @@ const getOauthAppConfig = () => {
|
|
|
191
197
|
};
|
|
192
198
|
};
|
|
193
199
|
const prepareForCompact = (headers, compactType) => {
|
|
194
|
-
if (compactType)
|
|
200
|
+
if (compactType) {
|
|
201
|
+
headers["x-initiator"] = "agent";
|
|
202
|
+
if (!isOpencodeOauthApp() && compactType === 1) {
|
|
203
|
+
headers["x-interaction-type"] = "conversation-compaction";
|
|
204
|
+
headers["openai-intent"] = "conversation-agent";
|
|
205
|
+
}
|
|
206
|
+
}
|
|
195
207
|
};
|
|
196
208
|
const prepareInteractionHeaders = (sessionId, isSubagent, headers) => {
|
|
197
209
|
const sendInteractionHeaders = !isOpencodeOauthApp();
|
|
@@ -212,11 +224,13 @@ const getOpencodeVersion = () => {
|
|
|
212
224
|
};
|
|
213
225
|
const OPENCODE_VERSION = "opencode/1.14.29";
|
|
214
226
|
const OPENCODE_LLM_USER_AGENT = "opencode/1.14.29 ai-sdk/provider-utils/4.0.23 runtime/bun/1.3.13, opencode/1.14.29";
|
|
215
|
-
const COPILOT_VERSION = "0.
|
|
227
|
+
const COPILOT_VERSION = "0.47.1";
|
|
216
228
|
const EDITOR_PLUGIN_VERSION = `copilot-chat/${COPILOT_VERSION}`;
|
|
217
229
|
const USER_AGENT = `GitHubCopilotChat/${COPILOT_VERSION}`;
|
|
218
230
|
const CLAUDE_AGENT_USER_AGENT = "vscode_claude_code/2.1.112 (external, sdk-ts, agent-sdk/0.2.112)";
|
|
219
|
-
const
|
|
231
|
+
const EDITOR_WEBSOCKET_PLUGIN_VERSION = `copilot-chat/${COPILOT_VERSION}`;
|
|
232
|
+
const API_VERSION = "2026-01-09";
|
|
233
|
+
const WEBSOCKET_API_VERSION = API_VERSION;
|
|
220
234
|
const copilotBaseUrl = (account) => {
|
|
221
235
|
const enterpriseDomain = getEnterpriseDomain();
|
|
222
236
|
if (enterpriseDomain) return `https://copilot-api.${enterpriseDomain}`;
|
|
@@ -276,6 +290,44 @@ const copilotHeaders = (account, vision = false, requestId) => {
|
|
|
276
290
|
}
|
|
277
291
|
return githubCopilotHeaders(account, vision, requestId);
|
|
278
292
|
};
|
|
293
|
+
const copilotWebSocketHeaders = (preparedHeaders) => {
|
|
294
|
+
if (isOpencodeOauthApp()) return omitHeader(preparedHeaders, "x-initiator");
|
|
295
|
+
const requestId = getPreparedHeader(preparedHeaders, "x-request-id") ?? randomUUID();
|
|
296
|
+
const source = createHeaderResolver(preparedHeaders);
|
|
297
|
+
const headers = {
|
|
298
|
+
Authorization: source("authorization"),
|
|
299
|
+
"X-Request-Id": requestId,
|
|
300
|
+
"OpenAI-Intent": source("openai-intent", "conversation-agent"),
|
|
301
|
+
"X-GitHub-Api-Version": source("x-github-api-version", WEBSOCKET_API_VERSION),
|
|
302
|
+
"X-Interaction-Id": source("x-interaction-id", requestId),
|
|
303
|
+
"X-Interaction-Type": source("x-interaction-type", "conversation-agent"),
|
|
304
|
+
"X-Agent-Task-Id": source("x-agent-task-id", requestId)
|
|
305
|
+
};
|
|
306
|
+
setPreparedHeader(headers, "VScode-SessionId", preparedHeaders, "vscode-sessionid");
|
|
307
|
+
setPreparedHeader(headers, "VScode-MachineId", preparedHeaders, "vscode-machineid");
|
|
308
|
+
Object.assign(headers, {
|
|
309
|
+
"Editor-Device-Id": source("editor-device-id"),
|
|
310
|
+
"Editor-Plugin-Version": source("editor-plugin-version", EDITOR_WEBSOCKET_PLUGIN_VERSION),
|
|
311
|
+
"Editor-Version": source("editor-version"),
|
|
312
|
+
"Copilot-Integration-Id": source("copilot-integration-id", "vscode-chat")
|
|
313
|
+
});
|
|
314
|
+
setPreparedHeader(headers, "Copilot-Vision-Request", preparedHeaders, "copilot-vision-request");
|
|
315
|
+
headers["user-agent"] = "node";
|
|
316
|
+
return headers;
|
|
317
|
+
};
|
|
318
|
+
const createHeaderResolver = (headers) => (headerName, fallback = "") => getPreparedHeader(headers, headerName) ?? fallback;
|
|
319
|
+
const getPreparedHeader = (headers, headerName) => {
|
|
320
|
+
const normalizedHeaderName = headerName.toLowerCase();
|
|
321
|
+
return Object.entries(headers).find(([key]) => key.toLowerCase() === normalizedHeaderName)?.[1];
|
|
322
|
+
};
|
|
323
|
+
const setPreparedHeader = (target, targetHeaderName, source, sourceHeaderName) => {
|
|
324
|
+
const value = getPreparedHeader(source, sourceHeaderName);
|
|
325
|
+
if (value) target[targetHeaderName] = value;
|
|
326
|
+
};
|
|
327
|
+
const omitHeader = (headers, headerName) => {
|
|
328
|
+
const normalizedHeaderName = headerName.toLowerCase();
|
|
329
|
+
return Object.fromEntries(Object.entries(headers).filter(([key]) => key.toLowerCase() !== normalizedHeaderName));
|
|
330
|
+
};
|
|
279
331
|
const githubCopilotHeaders = (account, vision = false, requestId) => {
|
|
280
332
|
const resolvedRequestId = requestId ?? randomUUID();
|
|
281
333
|
const resolvedDeviceId = account.clientDeviceId ?? state.vsCodeDeviceId;
|
|
@@ -318,7 +370,6 @@ const GITHUB_BASE_URL = "https://github.com";
|
|
|
318
370
|
const GITHUB_CLIENT_ID = "Iv1.b507a08c87ecfe98";
|
|
319
371
|
const GITHUB_APP_SCOPES = ["read:user"].join(" ");
|
|
320
372
|
const OPENCODE_GITHUB_CLIENT_ID = "Ov23li8tweQw6odWQebz";
|
|
321
|
-
|
|
322
373
|
//#endregion
|
|
323
374
|
//#region src/lib/error.ts
|
|
324
375
|
var HTTPError = class extends Error {
|
|
@@ -371,7 +422,6 @@ async function forwardError(c, error) {
|
|
|
371
422
|
type: "error"
|
|
372
423
|
} }, 500);
|
|
373
424
|
}
|
|
374
|
-
|
|
375
425
|
//#endregion
|
|
376
426
|
//#region src/services/github/get-copilot-usage.ts
|
|
377
427
|
const getCopilotUsage = async (account) => {
|
|
@@ -380,7 +430,6 @@ const getCopilotUsage = async (account) => {
|
|
|
380
430
|
if (!response.ok) throw new HTTPError("Failed to get Copilot usage", response);
|
|
381
431
|
return await response.json();
|
|
382
432
|
};
|
|
383
|
-
|
|
384
433
|
//#endregion
|
|
385
434
|
//#region src/services/github/get-device-code.ts
|
|
386
435
|
async function getDeviceCode(options) {
|
|
@@ -397,7 +446,6 @@ async function getDeviceCode(options) {
|
|
|
397
446
|
if (!response.ok) throw new HTTPError("Failed to get device code", response);
|
|
398
447
|
return await response.json();
|
|
399
448
|
}
|
|
400
|
-
|
|
401
449
|
//#endregion
|
|
402
450
|
//#region src/services/github/get-user.ts
|
|
403
451
|
const resolveGitHubUserAccount = (account) => {
|
|
@@ -411,15 +459,13 @@ async function getGitHubUser(account) {
|
|
|
411
459
|
if (!response.ok) throw new HTTPError("Failed to get GitHub user", response);
|
|
412
460
|
return await response.json();
|
|
413
461
|
}
|
|
414
|
-
|
|
415
462
|
//#endregion
|
|
416
463
|
//#region src/services/get-vscode-version.ts
|
|
417
|
-
const FALLBACK = "1.
|
|
464
|
+
const FALLBACK = "1.119.1";
|
|
418
465
|
async function getVSCodeVersion() {
|
|
419
466
|
await Promise.resolve();
|
|
420
467
|
return FALLBACK;
|
|
421
468
|
}
|
|
422
|
-
|
|
423
469
|
//#endregion
|
|
424
470
|
//#region src/lib/deviceid.ts
|
|
425
471
|
const WINDOWS_DEVICE_ID_KEY = String.raw`\SOFTWARE\Microsoft\DeveloperTools`;
|
|
@@ -450,9 +496,9 @@ const isMissingFileError = (error) => {
|
|
|
450
496
|
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
451
497
|
};
|
|
452
498
|
const readStoredDeviceIdFile = async (filePath) => {
|
|
453
|
-
const { readFile
|
|
499
|
+
const { readFile } = await import("node:fs/promises");
|
|
454
500
|
try {
|
|
455
|
-
return await readFile
|
|
501
|
+
return await readFile(filePath, "utf8");
|
|
456
502
|
} catch (error) {
|
|
457
503
|
if (isMissingFileError(error)) return;
|
|
458
504
|
throw error;
|
|
@@ -560,7 +606,6 @@ async function getVSCodeDeviceId() {
|
|
|
560
606
|
}
|
|
561
607
|
return newDeviceId;
|
|
562
608
|
}
|
|
563
|
-
|
|
564
609
|
//#endregion
|
|
565
610
|
//#region src/lib/utils.ts
|
|
566
611
|
const sleep = (ms) => new Promise((resolve) => {
|
|
@@ -727,7 +772,6 @@ const resolveAffinityKey = (params) => {
|
|
|
727
772
|
affinityKeySource: "upstream_request_id_fallback"
|
|
728
773
|
};
|
|
729
774
|
};
|
|
730
|
-
|
|
731
775
|
//#endregion
|
|
732
776
|
//#region src/services/github/poll-access-token.ts
|
|
733
777
|
async function pollAccessToken(deviceCode, options) {
|
|
@@ -759,7 +803,7 @@ async function pollAccessToken(deviceCode, options) {
|
|
|
759
803
|
else await sleep(sleepDuration);
|
|
760
804
|
}
|
|
761
805
|
}
|
|
762
|
-
|
|
763
806
|
//#endregion
|
|
764
|
-
export {
|
|
765
|
-
|
|
807
|
+
export { state as A, compactTextOnlyGuard as B, getGitHubApiBaseUrl as C, prepareInteractionHeaders as D, prepareForCompact as E, initOpencodeVersion as F, compactAutoContinuePromptStarts as I, compactMessageSections as L, consumeOutboundHeadersSnapshot as M, requestContext as N, prepareMessageProxyHeaders as O, resolveTraceId as P, compactSummaryPromptStart as R, copilotWebSocketHeaders as S, normalizeDomain as T, HTTPError as _, cacheVsCodeSessionId as a, copilotHeaders as b, getUUID as c, parseUserIdMetadata as d, resolveAffinityKey as f, getCopilotUsage as g, getDeviceCode as h, cacheVsCodeDeviceId as i, captureOutboundHeadersSnapshot as j, accountFromState as k, isNullish as l, getGitHubUser as m, cacheMacMachineId as n, generateRequestIdFromPayload as o, sleep as p, cacheVSCodeVersion as r, getRootSessionId as s, pollAccessToken as t, normalizeStableSessionId as u, forwardError as v, githubHeaders as w, copilotModelsHeaders as x, copilotBaseUrl as y, compactSystemPromptStarts as z };
|
|
808
|
+
|
|
809
|
+
//# sourceMappingURL=poll-access-token-BAgM2-7k.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll-access-token-BAgM2-7k.js","names":["COPILOT_WEBSOCKET_VERSION"],"sources":["../src/lib/compact.ts","../src/lib/opencode.ts","../src/lib/request-context.ts","../src/lib/state.ts","../src/lib/api-config.ts","../src/lib/error.ts","../src/services/github/get-copilot-usage.ts","../src/services/github/get-device-code.ts","../src/services/github/get-user.ts","../src/services/get-vscode-version.ts","../src/lib/deviceid.ts","../src/lib/utils.ts","../src/services/github/poll-access-token.ts"],"sourcesContent":["export const COMPACT_REQUEST = 1 as const\nexport const COMPACT_AUTO_CONTINUE = 2 as const\n\nexport const compactSystemPromptStart =\n \"You are a helpful AI assistant tasked with summarizing conversations\"\nexport const compactOpenCodeSystemPromptStart =\n \"You are an anchored context summarization assistant for coding sessions.\"\nexport const compactSystemPromptStarts = [\n compactSystemPromptStart,\n compactOpenCodeSystemPromptStart,\n] as const\nexport const compactTextOnlyGuard =\n \"CRITICAL: Respond with TEXT ONLY. Do NOT call any tools.\"\nexport const compactSummaryPromptStart =\n \"Your task is to create a detailed summary of the conversation so far\"\nexport const compactAutoContinueClaudeCodePromptStart =\n \"This session is being continued from a previous conversation that ran out of context. The summary below covers the earlier portion of the conversation.\"\nexport const compactAutoContinueOpenCodePromptStart =\n \"Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed.\"\nexport const compactAutoContinueOpenCodePromptStart2 =\n \"The previous request exceeded the provider's size limit due to large media attachments. The conversation was compacted and media files were removed from context.\"\nexport const compactAutoContinuePromptStarts = [\n compactAutoContinueClaudeCodePromptStart,\n compactAutoContinueOpenCodePromptStart,\n compactAutoContinueOpenCodePromptStart2,\n] as const\nexport const compactMessageSections = [\n \"Pending Tasks:\",\n \"Current Work:\",\n] as const\n\nexport type CompactType =\n | 0\n | typeof COMPACT_REQUEST\n | typeof COMPACT_AUTO_CONTINUE\n","import consola from \"consola\"\nimport { exec } from \"node:child_process\"\nimport { readFile } from \"node:fs/promises\"\nimport path from \"node:path\"\n\nconst execAsync = (command: string): Promise<string> => {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout) => {\n if (error) {\n reject(error)\n return\n }\n\n resolve(stdout)\n })\n })\n}\n\nlet opencodeVersionCache: string | undefined\n\nconst getGlobalNpmRoot = async (): Promise<string> => {\n const stdout = await execAsync(\"npm root -g\")\n return stdout.trim()\n}\n\nasync function resolveOpencodeVersion(): Promise<void> {\n try {\n const npmRootPath = await getGlobalNpmRoot()\n const opencodePackagePath = path.join(\n npmRootPath,\n \"opencode-ai\",\n \"package.json\",\n )\n const packageJson = await readFile(opencodePackagePath, \"utf8\")\n const { version } = JSON.parse(packageJson) as { version: string }\n opencodeVersionCache = version\n } catch (error) {\n consola.warn(`Failed to resolve opencode version`, error)\n }\n}\n\nexport const initOpencodeVersion = (): Promise<void> => {\n if (process.env.COPILOT_API_OAUTH_APP?.trim() !== \"opencode\") {\n return Promise.resolve()\n }\n return resolveOpencodeVersion()\n}\n\nexport const getCachedOpencodeVersion = (): string | undefined => {\n return opencodeVersionCache\n}\n","import { AsyncLocalStorage } from \"node:async_hooks\"\n\nexport interface OutboundHeadersSnapshot {\n xRequestId?: string\n xAgentTaskId?: string\n xInteractionId?: string\n xInteractionType?: string\n openaiIntent?: string\n userAgent?: string\n}\n\nexport interface RequestContext {\n traceId: string\n startTime: number\n userAgent: string\n sessionAffinity: string | undefined\n parentSessionId: string | undefined\n outboundHeaders?: OutboundHeadersSnapshot\n fetchImpl?: typeof fetch\n}\n\nconst TRACE_ID_MAX_LENGTH = 64\nconst TRACE_ID_PATTERN = /^\\w[\\w.-]*$/\n\nconst asyncLocalStorage = new AsyncLocalStorage<RequestContext>()\n\nexport const requestContext = {\n getStore: () => asyncLocalStorage.getStore(),\n run: <T>(context: RequestContext, callback: () => T) =>\n asyncLocalStorage.run(context, callback),\n}\n\nexport function generateTraceId(): string {\n const timestamp = Date.now().toString(36)\n const random = Math.random().toString(36).slice(2, 8)\n return `${timestamp}-${random}`\n}\n\nfunction buildOutboundHeadersSnapshot(\n headers: Record<string, string>,\n): OutboundHeadersSnapshot {\n const snapshot: OutboundHeadersSnapshot = {\n xRequestId: undefined,\n xAgentTaskId: undefined,\n xInteractionId: undefined,\n xInteractionType: undefined,\n openaiIntent: undefined,\n userAgent: undefined,\n }\n\n for (const [name, value] of Object.entries(headers)) {\n switch (name.toLowerCase()) {\n case \"x-request-id\": {\n snapshot.xRequestId = value\n break\n }\n case \"x-agent-task-id\": {\n snapshot.xAgentTaskId = value\n break\n }\n case \"x-interaction-id\": {\n snapshot.xInteractionId = value\n break\n }\n case \"x-interaction-type\": {\n snapshot.xInteractionType = value\n break\n }\n case \"openai-intent\": {\n snapshot.openaiIntent = value\n break\n }\n case \"user-agent\": {\n snapshot.userAgent = value\n break\n }\n default: {\n break\n }\n }\n }\n\n return snapshot\n}\n\nexport function captureOutboundHeadersSnapshot(\n headers: Record<string, string>,\n): void {\n const store = asyncLocalStorage.getStore()\n if (!store) return\n\n store.outboundHeaders = buildOutboundHeadersSnapshot(headers)\n}\n\nexport function getOutboundHeadersSnapshot():\n | OutboundHeadersSnapshot\n | undefined {\n return asyncLocalStorage.getStore()?.outboundHeaders\n}\n\nexport function consumeOutboundHeadersSnapshot():\n | OutboundHeadersSnapshot\n | undefined {\n const store = asyncLocalStorage.getStore()\n const snapshot = store?.outboundHeaders\n\n if (store) {\n store.outboundHeaders = undefined\n }\n\n return snapshot\n}\n\nexport function resolveTraceId(traceId: string | null | undefined): string {\n const candidate = traceId?.trim()\n\n if (\n !candidate\n || candidate.length > TRACE_ID_MAX_LENGTH\n || !TRACE_ID_PATTERN.test(candidate)\n ) {\n return generateTraceId()\n }\n\n return candidate\n}\n","import { randomUUID } from \"node:crypto\"\n\nimport type { AccountContext, AccountType } from \"./types/account\"\n\nexport interface State {\n githubToken?: string\n userName?: string\n copilotToken?: string\n\n accountType: AccountType\n vsCodeVersion?: string\n\n macMachineId?: string\n vsCodeSessionId?: string\n vsCodeDeviceId: string\n\n manualApprove: boolean\n rateLimitWait: boolean\n showToken: boolean\n\n // Rate limiting configuration\n rateLimitSeconds?: number\n lastRequestTimestamp?: number\n verbose: boolean\n\n copilotApiUrl?: string\n}\n\nexport const state: State = {\n accountType: \"individual\",\n manualApprove: false,\n rateLimitWait: false,\n showToken: false,\n verbose: false,\n vsCodeDeviceId: randomUUID(),\n}\n\n/**\n * Create an AccountContext from the current global state.\n * This is a compatibility layer for transitioning to multi-account support.\n * @throws Error if githubToken is not set in state\n */\nexport function accountFromState(): AccountContext {\n if (!state.githubToken) {\n throw new Error(\"GitHub token not set in state\")\n }\n return {\n githubToken: state.githubToken,\n copilotToken: state.copilotToken,\n ...(state.copilotApiUrl !== undefined ?\n { copilotApiUrl: state.copilotApiUrl }\n : {}),\n accountType: state.accountType,\n vsCodeVersion: state.vsCodeVersion,\n clientDeviceId: state.vsCodeDeviceId,\n clientMachineId: state.macMachineId,\n clientSessionId: state.vsCodeSessionId,\n }\n}\n","import { randomUUID } from \"node:crypto\"\n\nimport { COMPACT_REQUEST, type CompactType } from \"./compact\"\nimport type { AccountContext } from \"./types/account\"\n\nimport { getCachedOpencodeVersion } from \"./opencode\"\nimport { requestContext } from \"./request-context\"\nimport { state } from \"./state\"\n\nexport const isOpencodeOauthApp = (): boolean => {\n return process.env.COPILOT_API_OAUTH_APP?.trim() === \"opencode\"\n}\n\nexport const normalizeDomain = (input: string): string => {\n return input\n .trim()\n .replace(/^https?:\\/\\//u, \"\")\n .replace(/\\/+$/u, \"\")\n}\n\nexport const getEnterpriseDomain = (): string | null => {\n const raw = (process.env.COPILOT_API_ENTERPRISE_URL ?? \"\").trim()\n if (!raw) return null\n const normalized = normalizeDomain(raw)\n return normalized || null\n}\n\nexport const getGitHubBaseUrl = (): string => {\n const resolvedDomain = getEnterpriseDomain()\n return resolvedDomain ? `https://${resolvedDomain}` : GITHUB_BASE_URL\n}\n\nexport const getGitHubApiBaseUrl = (): string => {\n const resolvedDomain = getEnterpriseDomain()\n return resolvedDomain ? `https://api.${resolvedDomain}` : GITHUB_API_BASE_URL\n}\n\nconst getOpencodeOauthHeaders = (): Record<string, string> => {\n return {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n \"User-Agent\": getOpencodeVersion(),\n }\n}\n\nconst getOpencodeLLMHeaders = (): Record<string, string> => {\n return {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n \"User-Agent\": OPENCODE_LLM_USER_AGENT,\n }\n}\n\nconst normalizeOpencodeUserAgent = (userAgent: string): string => {\n const candidate = userAgent.trim()\n const opencodeProduct = candidate.match(/^opencode\\/[^\\s,]+/u)?.[0]\n\n if (!opencodeProduct || candidate.includes(`, ${opencodeProduct}`)) {\n return candidate\n }\n\n return `${candidate}, ${opencodeProduct}`\n}\n\nexport const getOauthUrls = (): {\n deviceCodeUrl: string\n accessTokenUrl: string\n} => {\n const githubBaseUrl = getGitHubBaseUrl()\n\n return {\n deviceCodeUrl: `${githubBaseUrl}/login/device/code`,\n accessTokenUrl: `${githubBaseUrl}/login/oauth/access_token`,\n }\n}\n\ninterface OauthAppConfig {\n clientId: string\n headers: Record<string, string>\n scope: string\n}\n\nexport const getOauthAppConfig = (): OauthAppConfig => {\n if (isOpencodeOauthApp()) {\n return {\n clientId: OPENCODE_GITHUB_CLIENT_ID,\n headers: getOpencodeOauthHeaders(),\n scope: GITHUB_APP_SCOPES,\n }\n }\n\n return {\n clientId: GITHUB_CLIENT_ID,\n headers: standardHeaders(),\n scope: GITHUB_APP_SCOPES,\n }\n}\n\nexport const prepareForCompact = (\n headers: Record<string, string>,\n compactType?: CompactType,\n) => {\n if (compactType) {\n headers[\"x-initiator\"] = \"agent\"\n if (!isOpencodeOauthApp() && compactType === COMPACT_REQUEST) {\n headers[\"x-interaction-type\"] = \"conversation-compaction\"\n headers[\"openai-intent\"] = \"conversation-agent\"\n }\n }\n}\n\nexport const prepareInteractionHeaders = (\n sessionId: string | undefined,\n isSubagent: boolean,\n headers: Record<string, string>,\n) => {\n const sendInteractionHeaders = !isOpencodeOauthApp()\n\n if (isSubagent) {\n headers[\"x-initiator\"] = \"agent\"\n if (sendInteractionHeaders) {\n headers[\"x-interaction-type\"] = \"conversation-subagent\"\n }\n }\n\n if (sessionId && sendInteractionHeaders) {\n headers[\"x-interaction-id\"] = sessionId\n }\n}\n\nexport const standardHeaders = () => ({\n \"content-type\": \"application/json\",\n accept: \"application/json\",\n})\n\nexport const getOpencodeVersion = () => {\n const version = getCachedOpencodeVersion()\n if (version) {\n return \"opencode/\" + version\n }\n return OPENCODE_VERSION\n}\n\nconst OPENCODE_VERSION = \"opencode/1.14.29\"\nconst OPENCODE_LLM_USER_AGENT =\n \"opencode/1.14.29 ai-sdk/provider-utils/4.0.23 runtime/bun/1.3.13, opencode/1.14.29\"\n\nconst COPILOT_VERSION = \"0.47.1\"\nconst EDITOR_PLUGIN_VERSION = `copilot-chat/${COPILOT_VERSION}`\nconst USER_AGENT = `GitHubCopilotChat/${COPILOT_VERSION}`\nconst CLAUDE_AGENT_USER_AGENT =\n \"vscode_claude_code/2.1.112 (external, sdk-ts, agent-sdk/0.2.112)\"\nconst COPILOT_WEBSOCKET_VERSION = COPILOT_VERSION\nconst EDITOR_WEBSOCKET_PLUGIN_VERSION = `copilot-chat/${COPILOT_WEBSOCKET_VERSION}`\n\nconst API_VERSION = \"2026-01-09\"\nconst WEBSOCKET_API_VERSION = API_VERSION\n\nexport const copilotBaseUrl = (account: AccountContext): string => {\n const enterpriseDomain = getEnterpriseDomain()\n if (enterpriseDomain) {\n return `https://copilot-api.${enterpriseDomain}`\n }\n\n if (isOpencodeOauthApp()) {\n return \"https://api.githubcopilot.com\"\n }\n\n if (account.copilotApiUrl) {\n return account.copilotApiUrl\n }\n\n return account.accountType === \"individual\" ?\n \"https://api.githubcopilot.com\"\n : `https://api.${account.accountType}.githubcopilot.com`\n}\n\nexport const prepareMessageProxyHeaders = (headers: Record<string, string>) => {\n if (isOpencodeOauthApp()) {\n return\n }\n\n // vscode copilot claude agent regenerates request id for\n // each request, keeping it consistent\n const requestIdValue = randomUUID()\n headers[\"x-agent-task-id\"] = requestIdValue\n headers[\"x-request-id\"] = requestIdValue\n\n // Consistent with vscode copilot claude agent\n headers[\"x-interaction-type\"] = \"messages-proxy\"\n headers[\"openai-intent\"] = \"messages-proxy\"\n headers[\"user-agent\"] = CLAUDE_AGENT_USER_AGENT\n\n delete headers[\"copilot-integration-id\"]\n}\n\nexport const githubUserHeaders = (\n account: AccountContext,\n): Record<string, string> => {\n if (isOpencodeOauthApp()) {\n return {\n Authorization: `Bearer ${account.githubToken}`,\n \"User-Agent\": getOpencodeVersion(),\n }\n }\n\n return {\n accept: \"application/vnd.github+json\",\n authorization: `token ${account.githubToken}`,\n \"user-agent\": USER_AGENT,\n \"x-github-api-version\": \"2022-11-28\",\n \"x-vscode-user-agent-library-version\": \"electron-fetch\",\n }\n}\n\nexport const copilotModelsHeaders = (\n account: AccountContext,\n): Record<string, string> => {\n if (isOpencodeOauthApp()) {\n const token = account.copilotToken ?? account.githubToken\n return {\n Authorization: `Bearer ${token}`,\n \"User-Agent\": getOpencodeVersion(),\n }\n }\n const headers = githubCopilotHeaders(account)\n headers[\"x-interaction-type\"] = \"model-access\"\n headers[\"openai-intent\"] = \"model-access\"\n delete headers[\"x-interaction-id\"]\n delete headers[\"content-type\"]\n return headers\n}\n\nexport const copilotHeaders = (\n account: AccountContext,\n vision: boolean = false,\n requestId?: string,\n): Record<string, string> => {\n if (isOpencodeOauthApp()) {\n const token = account.copilotToken ?? account.githubToken\n const headers: Record<string, string> = {\n Authorization: `Bearer ${token}`,\n ...getOpencodeLLMHeaders(),\n \"Openai-Intent\": \"conversation-edits\",\n }\n\n const store = requestContext.getStore()\n const userAgent = store?.userAgent.trim()\n // Real opencode traffic already carries a versioned opencode/* UA,\n // so prefer the inbound header to keep upstream behavior aligned.\n if (userAgent?.startsWith(\"opencode/\")) {\n headers[\"User-Agent\"] = normalizeOpencodeUserAgent(userAgent)\n }\n\n if (store?.sessionAffinity) {\n headers[\"x-session-affinity\"] = store.sessionAffinity\n }\n\n if (store?.parentSessionId) {\n headers[\"x-parent-session-id\"] = store.parentSessionId\n }\n\n if (vision) headers[\"Copilot-Vision-Request\"] = \"true\"\n\n return headers\n }\n\n return githubCopilotHeaders(account, vision, requestId)\n}\n\nexport const copilotWebSocketHeaders = (\n preparedHeaders: Record<string, string>,\n) => {\n if (isOpencodeOauthApp()) {\n return omitHeader(preparedHeaders, \"x-initiator\")\n }\n\n const requestId =\n getPreparedHeader(preparedHeaders, \"x-request-id\") ?? randomUUID()\n const source = createHeaderResolver(preparedHeaders)\n const headers: Record<string, string> = {\n Authorization: source(\"authorization\"),\n \"X-Request-Id\": requestId,\n \"OpenAI-Intent\": source(\"openai-intent\", \"conversation-agent\"),\n \"X-GitHub-Api-Version\": source(\n \"x-github-api-version\",\n WEBSOCKET_API_VERSION,\n ),\n \"X-Interaction-Id\": source(\"x-interaction-id\", requestId),\n \"X-Interaction-Type\": source(\"x-interaction-type\", \"conversation-agent\"),\n \"X-Agent-Task-Id\": source(\"x-agent-task-id\", requestId),\n }\n\n setPreparedHeader(\n headers,\n \"VScode-SessionId\",\n preparedHeaders,\n \"vscode-sessionid\",\n )\n\n setPreparedHeader(\n headers,\n \"VScode-MachineId\",\n preparedHeaders,\n \"vscode-machineid\",\n )\n\n Object.assign(headers, {\n \"Editor-Device-Id\": source(\"editor-device-id\"),\n \"Editor-Plugin-Version\": source(\n \"editor-plugin-version\",\n EDITOR_WEBSOCKET_PLUGIN_VERSION,\n ),\n \"Editor-Version\": source(\"editor-version\"),\n \"Copilot-Integration-Id\": source(\"copilot-integration-id\", \"vscode-chat\"),\n })\n\n setPreparedHeader(\n headers,\n \"Copilot-Vision-Request\",\n preparedHeaders,\n \"copilot-vision-request\",\n )\n\n headers[\"user-agent\"] = \"node\"\n\n return headers\n}\n\nconst createHeaderResolver =\n (headers: Record<string, string>) =>\n (headerName: string, fallback: string = \"\"): string =>\n getPreparedHeader(headers, headerName) ?? fallback\n\nconst getPreparedHeader = (\n headers: Record<string, string>,\n headerName: string,\n): string | undefined => {\n const normalizedHeaderName = headerName.toLowerCase()\n const match = Object.entries(headers).find(\n ([key]) => key.toLowerCase() === normalizedHeaderName,\n )\n\n return match?.[1]\n}\n\nconst setPreparedHeader = (\n target: Record<string, string>,\n targetHeaderName: string,\n source: Record<string, string>,\n sourceHeaderName: string,\n): void => {\n const value = getPreparedHeader(source, sourceHeaderName)\n if (value) {\n target[targetHeaderName] = value\n }\n}\n\nconst omitHeader = (\n headers: Record<string, string>,\n headerName: string,\n): Record<string, string> => {\n const normalizedHeaderName = headerName.toLowerCase()\n return Object.fromEntries(\n Object.entries(headers).filter(\n ([key]) => key.toLowerCase() !== normalizedHeaderName,\n ),\n )\n}\n\nconst githubCopilotHeaders = (\n account: AccountContext,\n vision: boolean = false,\n requestId?: string,\n): Record<string, string> => {\n const resolvedRequestId = requestId ?? randomUUID()\n const resolvedDeviceId = account.clientDeviceId ?? state.vsCodeDeviceId\n const resolvedMachineId = account.clientMachineId ?? state.macMachineId\n const resolvedSessionId = account.clientSessionId ?? state.vsCodeSessionId\n const headers: Record<string, string> = {\n Authorization: `Bearer ${account.copilotToken}`,\n \"content-type\": standardHeaders()[\"content-type\"],\n \"copilot-integration-id\": \"vscode-chat\",\n \"editor-version\": `vscode/${account.vsCodeVersion}`,\n \"editor-device-id\": resolvedDeviceId,\n \"editor-plugin-version\": EDITOR_PLUGIN_VERSION,\n \"user-agent\": USER_AGENT,\n \"openai-intent\": \"conversation-agent\",\n \"x-github-api-version\": API_VERSION,\n \"x-request-id\": resolvedRequestId,\n \"x-vscode-user-agent-library-version\": \"electron-fetch\",\n \"x-agent-task-id\": resolvedRequestId,\n \"x-interaction-type\": \"conversation-agent\",\n }\n\n if (vision) headers[\"copilot-vision-request\"] = \"true\"\n\n if (resolvedMachineId) {\n headers[\"vscode-machineid\"] = resolvedMachineId\n }\n\n if (resolvedSessionId) {\n headers[\"vscode-sessionid\"] = resolvedSessionId\n }\n\n return headers\n}\n\nexport const GITHUB_API_BASE_URL = \"https://api.github.com\"\nexport const githubHeaders = (\n account: AccountContext,\n): Record<string, string> => {\n if (isOpencodeOauthApp()) {\n return {\n Authorization: `Bearer ${account.githubToken}`,\n ...getOpencodeOauthHeaders(),\n }\n }\n\n return {\n authorization: `token ${account.githubToken}`,\n \"user-agent\": USER_AGENT,\n \"x-github-api-version\": API_VERSION,\n \"x-vscode-user-agent-library-version\": \"electron-fetch\",\n }\n}\n\nexport const GITHUB_BASE_URL = \"https://github.com\"\nexport const GITHUB_CLIENT_ID = \"Iv1.b507a08c87ecfe98\"\nexport const GITHUB_APP_SCOPES = [\"read:user\"].join(\" \")\nexport const OPENCODE_GITHUB_CLIENT_ID = \"Ov23li8tweQw6odWQebz\"\n","import type { Context } from \"hono\"\nimport type { ContentfulStatusCode } from \"hono/utils/http-status\"\n\nimport consola from \"consola\"\n\nexport class HTTPError extends Error {\n response: Response\n\n constructor(message: string, response: Response) {\n super(message)\n this.response = response\n }\n}\n\nexport class CancelledError extends Error {}\n\nfunction getFallbackHttpErrorMessage(error: HTTPError): string {\n return error.message || `HTTP ${error.response.status}`\n}\n\nasync function readHttpErrorText(error: HTTPError): Promise<string> {\n try {\n const text = await error.response.text()\n return text || getFallbackHttpErrorMessage(error)\n } catch (readError) {\n consola.warn(\"Failed to read HTTP error response body:\", readError)\n return getFallbackHttpErrorMessage(error)\n }\n}\n\nfunction getErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message || \"Unknown error\"\n }\n\n if (typeof error === \"string\") {\n return error\n }\n\n if (\n typeof error === \"number\"\n || typeof error === \"boolean\"\n || typeof error === \"bigint\"\n ) {\n return `${error}`\n }\n\n return \"Unknown error\"\n}\n\nexport async function forwardError(\n c: Context,\n error: unknown,\n): Promise<Response> {\n consola.error(\"Error occurred:\", error)\n\n if (error instanceof HTTPError) {\n if (error.response.status === 429) {\n for (const [name, value] of error.response.headers) {\n const lowerName = name.toLowerCase()\n if (lowerName === \"retry-after\" || lowerName.startsWith(\"x-\")) {\n c.header(name, value)\n }\n }\n }\n\n const errorText = await readHttpErrorText(error)\n let errorJson: unknown\n try {\n errorJson = JSON.parse(errorText)\n } catch {\n errorJson = errorText\n }\n consola.error(\"HTTP error:\", errorJson)\n return c.json(\n {\n error: {\n message: errorText,\n type: \"error\",\n },\n },\n error.response.status as ContentfulStatusCode,\n )\n }\n\n return c.json(\n {\n error: {\n message: getErrorMessage(error),\n type: \"error\",\n },\n },\n 500,\n )\n}\n","import type { AccountContext } from \"~/lib/types/account\"\n\nimport { getGitHubApiBaseUrl, githubHeaders } from \"~/lib/api-config\"\nimport { HTTPError } from \"~/lib/error\"\nimport { accountFromState } from \"~/lib/state\"\n\nexport const getCopilotUsage = async (\n account?: AccountContext,\n): Promise<CopilotUsageResponse> => {\n const ctx = account ?? accountFromState()\n const response = await fetch(\n `${getGitHubApiBaseUrl()}/copilot_internal/user`,\n {\n headers: githubHeaders(ctx),\n },\n )\n\n if (!response.ok) {\n throw new HTTPError(\"Failed to get Copilot usage\", response)\n }\n\n return (await response.json()) as CopilotUsageResponse\n}\n\nexport interface QuotaDetail {\n entitlement: number\n overage_count: number\n overage_permitted: boolean\n percent_remaining: number\n quota_id: string\n quota_remaining: number\n remaining: number\n unlimited: boolean\n}\n\ninterface QuotaSnapshots {\n chat: QuotaDetail\n completions: QuotaDetail\n premium_interactions: QuotaDetail\n}\n\ninterface CopilotUsageResponse {\n login: string\n access_type_sku: string\n analytics_tracking_id: string\n assigned_date: string\n can_signup_for_limited: boolean\n chat_enabled: boolean\n copilot_plan?: string\n organization_login_list: Array<unknown>\n organization_list: Array<unknown>\n quota_reset_date: string\n quota_snapshots: QuotaSnapshots\n endpoints: {\n api: string\n telemetry: string\n }\n}\n","import { getOauthAppConfig, getOauthUrls } from \"~/lib/api-config\"\nimport { HTTPError } from \"~/lib/error\"\n\nexport interface DeviceCodeOptions {\n overrideUrls?: {\n deviceCodeUrl: string\n accessTokenUrl: string\n }\n}\n\nexport async function getDeviceCode(\n options?: DeviceCodeOptions,\n): Promise<DeviceCodeResponse> {\n const { clientId, headers, scope } = getOauthAppConfig()\n const { deviceCodeUrl } = options?.overrideUrls ?? getOauthUrls()\n\n const response = await fetch(deviceCodeUrl, {\n method: \"POST\",\n headers,\n body: JSON.stringify({\n client_id: clientId,\n scope,\n }),\n })\n\n if (!response.ok) throw new HTTPError(\"Failed to get device code\", response)\n\n return (await response.json()) as DeviceCodeResponse\n}\n\nexport interface DeviceCodeResponse {\n device_code: string\n user_code: string\n verification_uri: string\n expires_in: number\n interval: number\n}\n","import type { AccountContext } from \"~/lib/types/account\"\n\nimport { getGitHubApiBaseUrl, githubUserHeaders } from \"~/lib/api-config\"\nimport { HTTPError } from \"~/lib/error\"\nimport { accountFromState, state } from \"~/lib/state\"\n\nconst resolveGitHubUserAccount = (account?: AccountContext): AccountContext => {\n if (account) {\n return account\n }\n\n if (!state.githubToken) {\n throw new Error(\"GitHub token not set\")\n }\n\n return accountFromState()\n}\n\nexport async function getGitHubUser(account?: AccountContext) {\n const resolvedAccount = resolveGitHubUserAccount(account)\n\n const response = await fetch(`${getGitHubApiBaseUrl()}/user`, {\n headers: githubUserHeaders(resolvedAccount),\n })\n\n if (!response.ok) throw new HTTPError(\"Failed to get GitHub user\", response)\n\n return (await response.json()) as GithubUserResponse\n}\n\n// Trimmed for the sake of simplicity\nexport interface GithubUserResponse {\n login: string\n}\n","const FALLBACK = \"1.119.1\"\n\nexport async function getVSCodeVersion() {\n await Promise.resolve()\n return FALLBACK\n}\n","import consola from \"consola\"\nimport { randomUUID } from \"node:crypto\"\nimport path from \"node:path\"\n\nconst WINDOWS_DEVICE_ID_KEY = String.raw`\\SOFTWARE\\Microsoft\\DeveloperTools`\nconst WINDOWS_DEVICE_ID_NAME = \"deviceid\"\n\ntype RegistryArch = \"x86\" | \"x64\"\n\ninterface WinregConstructor {\n new (options: {\n hive: string\n key: string\n arch?: RegistryArch\n }): WinregRegistry\n HKCU: string\n REG_SZ: string\n}\n\ninterface WinregRegistry {\n get(\n name: string,\n callback: (error: RegistryError | null, item: RegistryItem | null) => void,\n ): void\n set(\n name: string,\n type: string,\n value: string,\n callback: (error: RegistryError | null) => void,\n ): void\n}\n\ninterface RegistryItem {\n value?: string\n}\n\ninterface RegistryError extends Error {\n code?: number | string\n}\n\nconst windows64Architectures = new Set([\"AMD64\", \"ARM64\", \"IA64\"])\n\nconst getPosixHomeDir = (): string => {\n if (!process.env.HOME) {\n throw new Error(\"Home directory not found\")\n }\n\n return process.env.HOME\n}\n\nconst getDeviceIdFilePath = (): string => {\n let folder: string\n\n switch (process.platform) {\n case \"darwin\": {\n folder = path.posix.join(\n getPosixHomeDir(),\n \"Library\",\n \"Application Support\",\n )\n break\n }\n case \"linux\": {\n folder =\n process.env.XDG_CACHE_HOME\n ?? path.posix.join(getPosixHomeDir(), \".cache\")\n break\n }\n default: {\n throw new Error(\"Unsupported platform\")\n }\n }\n\n return path.posix.join(folder, \"Microsoft\", \"DeveloperTools\", \"deviceid\")\n}\n\nconst isMissingFileError = (error: unknown): error is NodeJS.ErrnoException => {\n return error instanceof Error && \"code\" in error && error.code === \"ENOENT\"\n}\n\nconst readStoredDeviceIdFile = async (\n filePath: string,\n): Promise<string | undefined> => {\n const { readFile } = await import(\"node:fs/promises\")\n\n try {\n return await readFile(filePath, \"utf8\")\n } catch (error) {\n if (isMissingFileError(error)) {\n return undefined\n }\n\n throw error\n }\n}\n\nconst writeStoredDeviceIdFile = async (\n filePath: string,\n deviceId: string,\n): Promise<void> => {\n const { mkdir, writeFile } = await import(\"node:fs/promises\")\n\n await mkdir(path.posix.dirname(filePath), { recursive: true })\n await writeFile(filePath, deviceId, \"utf8\")\n}\n\nconst getWindowsRegistryArch = (): RegistryArch | undefined => {\n const architecture = (\n process.env.PROCESSOR_ARCHITEW6432 ?? process.env.PROCESSOR_ARCHITECTURE\n )?.toUpperCase()\n\n return architecture && windows64Architectures.has(architecture) ?\n \"x64\"\n : undefined\n}\n\nconst loadWinreg = async (): Promise<WinregConstructor> => {\n const module = await import(\"winreg\")\n const winreg =\n \"default\" in module ? (module.default as unknown) : (module as unknown)\n\n return winreg as WinregConstructor\n}\n\nconst isMissingRegistryError = (error: RegistryError | null): boolean => {\n if (!error) {\n return false\n }\n\n const errorCode = Number(error.code)\n\n return Number.isFinite(errorCode) && errorCode === 1\n}\n\nconst createWindowsRegistry = async (): Promise<{\n registry: WinregRegistry\n regSz: string\n}> => {\n const Winreg = await loadWinreg()\n\n return {\n registry: new Winreg({\n hive: Winreg.HKCU,\n key: WINDOWS_DEVICE_ID_KEY,\n arch: getWindowsRegistryArch(),\n }),\n regSz: Winreg.REG_SZ,\n }\n}\n\nconst readRegistryString = async (\n registry: WinregRegistry,\n name: string,\n): Promise<string | undefined> => {\n return new Promise((resolve, reject) => {\n registry.get(name, (error, item) => {\n if (isMissingRegistryError(error)) {\n resolve(undefined)\n return\n }\n\n if (error) {\n reject(\n error instanceof Error ? error : new Error(\"Unknown registry error\"),\n )\n return\n }\n\n resolve(item?.value)\n })\n })\n}\n\nconst writeRegistryString = async ({\n registry,\n regSz,\n name,\n value,\n}: {\n registry: WinregRegistry\n regSz: string\n name: string\n value: string\n}): Promise<void> => {\n return new Promise((resolve, reject) => {\n registry.set(name, regSz, value, (error) => {\n if (error) {\n reject(\n error instanceof Error ? error : new Error(\"Unknown registry error\"),\n )\n return\n }\n\n resolve()\n })\n })\n}\n\nexport const getStoredVSCodeDeviceId = async (): Promise<\n string | undefined\n> => {\n switch (process.platform) {\n case \"win32\": {\n const { registry } = await createWindowsRegistry()\n\n return readRegistryString(registry, WINDOWS_DEVICE_ID_NAME)\n }\n case \"darwin\":\n case \"linux\": {\n return readStoredDeviceIdFile(getDeviceIdFilePath())\n }\n default: {\n throw new Error(\"Unsupported platform\")\n }\n }\n}\n\nconst setStoredVSCodeDeviceId = async (deviceId: string): Promise<void> => {\n switch (process.platform) {\n case \"win32\": {\n const { registry, regSz } = await createWindowsRegistry()\n\n await writeRegistryString({\n registry,\n regSz,\n name: WINDOWS_DEVICE_ID_NAME,\n value: deviceId,\n })\n return\n }\n case \"darwin\":\n case \"linux\": {\n await writeStoredDeviceIdFile(getDeviceIdFilePath(), deviceId)\n return\n }\n default: {\n throw new Error(\"Unsupported platform\")\n }\n }\n}\n\nconst createVSCodeDeviceId = (): string => randomUUID().toLowerCase()\n\nexport async function getVSCodeDeviceId(): Promise<string> {\n let deviceId: string | undefined\n\n try {\n deviceId = await getStoredVSCodeDeviceId()\n } catch (error) {\n consola.debug(\"Failed to read VSCode device id\", error)\n }\n\n if (deviceId) {\n return deviceId\n }\n\n const newDeviceId = createVSCodeDeviceId()\n\n try {\n await setStoredVSCodeDeviceId(newDeviceId)\n } catch (error) {\n consola.warn(\n \"Failed to persist VSCode device id, using ephemeral id\",\n error,\n )\n }\n\n return newDeviceId\n}\n","import type { Context } from \"hono\"\n\nimport consola from \"consola\"\nimport { createHash, randomUUID } from \"node:crypto\"\nimport { networkInterfaces } from \"node:os\"\n\nimport type { AnthropicMessagesPayload } from \"~/routes/messages/anthropic-types\"\n\nimport { getVSCodeVersion } from \"~/services/get-vscode-version\"\n\nimport { getVSCodeDeviceId } from \"./deviceid\"\nimport { state } from \"./state\"\n\nexport const sleep = (ms: number) =>\n new Promise((resolve) => {\n setTimeout(resolve, ms)\n })\n\nexport const isNullish = (value: unknown): value is null | undefined =>\n value === null || value === undefined\n\nexport const cacheVSCodeVersion = async () => {\n const response = await getVSCodeVersion()\n state.vsCodeVersion = response\n\n consola.info(`Using VSCode version: ${response}`)\n}\n\nconst invalidMacAddresses = new Set([\n \"00:00:00:00:00:00\",\n \"ff:ff:ff:ff:ff:ff\",\n \"ac:de:48:00:11:22\",\n])\n\nfunction validateMacAddress(candidate: string): boolean {\n const tempCandidate = candidate.replaceAll(\"-\", \":\").toLowerCase()\n return !invalidMacAddresses.has(tempCandidate)\n}\n\nexport function getMac(): string | null {\n const ifaces = networkInterfaces()\n // eslint-disable-next-line guard-for-in\n for (const name in ifaces) {\n const networkInterface = ifaces[name]\n if (networkInterface) {\n for (const { mac } of networkInterface) {\n if (validateMacAddress(mac)) {\n return mac\n }\n }\n }\n }\n return null\n}\n\nexport const cacheMacMachineId = () => {\n const macAddress = getMac() ?? randomUUID()\n state.macMachineId = createHash(\"sha256\")\n .update(macAddress, \"utf8\")\n .digest(\"hex\")\n consola.debug(`Using machine ID: ${state.macMachineId}`)\n}\n\nexport const cacheVsCodeDeviceId = async () => {\n state.vsCodeDeviceId = await getVSCodeDeviceId()\n consola.debug(`Using VSCode device ID: ${state.vsCodeDeviceId}`)\n}\n\nconst SESSION_REFRESH_BASE_MS = 60 * 60 * 1000\nconst SESSION_REFRESH_JITTER_MS = 20 * 60 * 1000\nlet vsCodeSessionRefreshTimer: ReturnType<typeof setTimeout> | null = null\n\nconst generateSessionId = () => {\n state.vsCodeSessionId = randomUUID() + Date.now().toString()\n consola.debug(`Generated VSCode session ID: ${state.vsCodeSessionId}`)\n}\n\nexport const stopVsCodeSessionRefreshLoop = () => {\n if (vsCodeSessionRefreshTimer) {\n clearTimeout(vsCodeSessionRefreshTimer)\n vsCodeSessionRefreshTimer = null\n }\n}\n\nconst scheduleSessionIdRefresh = () => {\n const randomDelay = Math.floor(Math.random() * SESSION_REFRESH_JITTER_MS)\n const delay = SESSION_REFRESH_BASE_MS + randomDelay\n consola.debug(\n `Scheduling next VSCode session ID refresh in ${Math.round(\n delay / 1000,\n )} seconds`,\n )\n\n stopVsCodeSessionRefreshLoop()\n vsCodeSessionRefreshTimer = setTimeout(() => {\n try {\n generateSessionId()\n } catch (error) {\n consola.error(\"Failed to refresh session ID, rescheduling...\", error)\n } finally {\n scheduleSessionIdRefresh()\n }\n }, delay)\n}\n\nexport const cacheVsCodeSessionId = () => {\n stopVsCodeSessionRefreshLoop()\n generateSessionId()\n scheduleSessionIdRefresh()\n}\n\ninterface PayloadMessage {\n role?: string\n content?: string | Array<{ type?: string; text?: string }> | null\n type?: string\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null\n\nconst getUserIdJsonField = (\n userIdPayload: Record<string, unknown> | null,\n field: string,\n): string | null => {\n const value = userIdPayload?.[field]\n return typeof value === \"string\" && value.length > 0 ? value : null\n}\n\nconst parseJsonUserId = (userId: string): Record<string, unknown> | null => {\n try {\n const parsed: unknown = JSON.parse(userId)\n return isRecord(parsed) ? parsed : null\n } catch {\n return null\n }\n}\n\nexport const parseUserIdMetadata = (\n userId: string | undefined,\n): { safetyIdentifier: string | null; sessionId: string | null } => {\n if (!userId || typeof userId !== \"string\") {\n return { safetyIdentifier: null, sessionId: null }\n }\n\n const legacySafetyIdentifier =\n userId.match(/user_([^_]+)_account/)?.[1] ?? null\n const legacySessionId = userId.match(/_session_(.+)$/)?.[1] ?? null\n\n const parsedUserId =\n legacySafetyIdentifier && legacySessionId ? null : parseJsonUserId(userId)\n\n const safetyIdentifier =\n legacySafetyIdentifier\n ?? getUserIdJsonField(parsedUserId, \"device_id\")\n ?? getUserIdJsonField(parsedUserId, \"account_uuid\")\n const sessionId =\n legacySessionId ?? getUserIdJsonField(parsedUserId, \"session_id\")\n\n return { safetyIdentifier, sessionId }\n}\n\nconst findLastUserContent = (\n messages: Array<PayloadMessage>,\n): string | null => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const msg = messages[i]\n if (msg.role === \"user\" && msg.content) {\n if (typeof msg.content === \"string\") {\n return msg.content\n } else if (Array.isArray(msg.content)) {\n const array = msg.content\n .filter((n) => n.type !== \"tool_result\")\n .map((n) => ({ ...n, cache_control: undefined }))\n if (array.length > 0) {\n return JSON.stringify(array)\n }\n }\n }\n }\n return null\n}\n\nexport const generateRequestIdFromPayload = (\n payload: {\n messages: string | Array<PayloadMessage> | undefined\n },\n sessionId?: string,\n): string => {\n const messages = payload.messages\n if (messages) {\n const lastUserContent =\n typeof messages === \"string\" ? messages : findLastUserContent(messages)\n\n if (lastUserContent) {\n return getUUID((sessionId ?? \"\") + lastUserContent)\n }\n }\n\n return randomUUID()\n}\n\nexport const normalizeStableSessionId = (\n sessionId?: string | null,\n): string | undefined => {\n const trimmedSessionId = sessionId?.trim()\n return trimmedSessionId ? getUUID(trimmedSessionId) : undefined\n}\n\nexport const getRootSessionId = (\n anthropicPayload: AnthropicMessagesPayload,\n c: Context,\n): string | undefined => {\n const userId = anthropicPayload.metadata?.user_id\n const sessionId =\n userId ?\n parseUserIdMetadata(userId).sessionId || undefined\n : c.req.header(\"x-session-id\")\n\n return normalizeStableSessionId(sessionId)\n}\n\nexport const getUUID = (content: string): string => {\n const uuidBytes = createHash(\"sha256\")\n .update(content)\n .digest()\n .subarray(0, 16)\n\n uuidBytes[6] = (uuidBytes[6] & 0x0f) | 0x40\n uuidBytes[8] = (uuidBytes[8] & 0x3f) | 0x80\n\n const uuidHex = uuidBytes.toString(\"hex\")\n\n return `${uuidHex.slice(0, 8)}-${uuidHex.slice(8, 12)}-${uuidHex.slice(12, 16)}-${uuidHex.slice(16, 20)}-${uuidHex.slice(20)}`\n}\n\nexport type AffinityKeySource =\n | \"prompt_cache_key\"\n | \"metadata_session_id\"\n | \"x_session_id\"\n | \"upstream_request_id_fallback\"\n\nexport interface ResolvedAffinityKey {\n requestId: string\n affinityKeyUsed: string\n affinityKeySource: AffinityKeySource\n}\n\n/**\n * Unified affinity key resolution with fixed priority:\n * 1. payload.prompt_cache_key (used as-is)\n * 2. metadata.user_id.session_id (normalized via getUUID)\n * 3. x-session-id header (normalized via getUUID)\n * 4. generateRequestIdFromPayload fallback (used as-is)\n */\nexport const resolveAffinityKey = (params: {\n promptCacheKey?: string | null\n metadataSessionId?: string | null\n headerSessionId?: string | null\n upstreamRequestId: string\n}): ResolvedAffinityKey => {\n const {\n promptCacheKey,\n metadataSessionId,\n headerSessionId,\n upstreamRequestId,\n } = params\n\n if (promptCacheKey) {\n return {\n requestId: promptCacheKey,\n affinityKeyUsed: promptCacheKey,\n affinityKeySource: \"prompt_cache_key\",\n }\n }\n\n if (metadataSessionId) {\n return {\n requestId: getUUID(metadataSessionId),\n affinityKeyUsed: metadataSessionId,\n affinityKeySource: \"metadata_session_id\",\n }\n }\n\n if (headerSessionId) {\n return {\n requestId: getUUID(headerSessionId),\n affinityKeyUsed: headerSessionId,\n affinityKeySource: \"x_session_id\",\n }\n }\n\n return {\n requestId: upstreamRequestId,\n affinityKeyUsed: upstreamRequestId,\n affinityKeySource: \"upstream_request_id_fallback\",\n }\n}\n","import consola from \"consola\"\n\nimport { getOauthAppConfig, getOauthUrls } from \"~/lib/api-config\"\nimport { CancelledError } from \"~/lib/error\"\nimport { sleep } from \"~/lib/utils\"\n\nimport type { DeviceCodeResponse } from \"./get-device-code\"\n\nexport interface PollAccessTokenOptions {\n overrideUrls?: {\n deviceCodeUrl: string\n accessTokenUrl: string\n }\n signal?: AbortSignal\n}\n\nexport async function pollAccessToken(\n deviceCode: DeviceCodeResponse,\n options?: PollAccessTokenOptions,\n): Promise<string> {\n const { clientId, headers } = getOauthAppConfig()\n const { accessTokenUrl } = options?.overrideUrls ?? getOauthUrls()\n\n // Interval is in seconds, we need to multiply by 1000 to get milliseconds\n // I'm also adding another second, just to be safe\n const sleepDuration = (deviceCode.interval + 1) * 1000\n consola.debug(`Polling access token with interval of ${sleepDuration}ms`)\n\n while (true) {\n if (options?.signal?.aborted) {\n throw new CancelledError(\"Authentication cancelled\")\n }\n\n const response = await fetch(accessTokenUrl, {\n method: \"POST\",\n headers,\n body: JSON.stringify({\n client_id: clientId,\n device_code: deviceCode.device_code,\n grant_type: \"urn:ietf:params:oauth:grant-type:device_code\",\n }),\n signal: options?.signal,\n })\n\n if (!response.ok) {\n await sleep(sleepDuration)\n consola.error(\"Failed to poll access token:\", await response.text())\n\n continue\n }\n\n const json = await response.json()\n consola.debug(\"Polling access token response:\", json)\n\n const { access_token } = json as AccessTokenResponse\n\n if (access_token) {\n return access_token\n } else {\n await sleep(sleepDuration)\n }\n }\n}\n\ninterface AccessTokenResponse {\n access_token: string\n token_type: string\n scope: string\n}\n"],"mappings":";;;;;;;AAOA,MAAa,4BAA4B,CACvC,wEACA,2EACD;AACD,MAAa,uBACX;AACF,MAAa,4BACX;AAOF,MAAa,kCAAkC;CAC7C;CACA;CACA;CACD;AACD,MAAa,yBAAyB,CACpC,kBACA,gBACD;;;ACxBD,MAAM,aAAa,YAAqC;CACtD,OAAO,IAAI,SAAS,SAAS,WAAW;EACtC,KAAK,UAAU,OAAO,WAAW;GAC/B,IAAI,OAAO;IACT,OAAO,MAAM;IACb;;GAGF,QAAQ,OAAO;IACf;GACF;;AAGJ,IAAI;AAEJ,MAAM,mBAAmB,YAA6B;CAEpD,QAAO,MADc,UAAU,cAAc,EAC/B,MAAM;;AAGtB,eAAe,yBAAwC;CACrD,IAAI;EACF,MAAM,cAAc,MAAM,kBAAkB;EAM5C,MAAM,cAAc,MAAM,SALE,KAAK,KAC/B,aACA,eACA,eAEoD,EAAE,OAAO;EAC/D,MAAM,EAAE,YAAY,KAAK,MAAM,YAAY;EAC3C,uBAAuB;UAChB,OAAO;EACd,QAAQ,KAAK,sCAAsC,MAAM;;;AAI7D,MAAa,4BAA2C;CACtD,IAAI,QAAQ,IAAI,uBAAuB,MAAM,KAAK,YAChD,OAAO,QAAQ,SAAS;CAE1B,OAAO,wBAAwB;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