opencode-anthropic-multi-account 0.2.15 → 0.2.16

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.
@@ -0,0 +1,1130 @@
1
+ import {
2
+ scrubTemplate
3
+ } from "./chunk-IETVH43F.js";
4
+
5
+ // src/fingerprint-capture.ts
6
+ import { spawn } from "child_process";
7
+ import { createServer } from "http";
8
+ import { basename, dirname as dirname2, join as join2 } from "path";
9
+ import {
10
+ existsSync as existsSync2,
11
+ readFileSync,
12
+ renameSync
13
+ } from "fs";
14
+ import {
15
+ mkdir as mkdir2,
16
+ rename,
17
+ writeFile as writeFile2
18
+ } from "fs/promises";
19
+
20
+ // src/fingerprint-data.json
21
+ var fingerprint_data_default = {
22
+ _version: 1,
23
+ _schemaVersion: 1,
24
+ _captured: "2026-04-18T02:05:42.332Z",
25
+ _source: "bundled",
26
+ agent_identity: "You are Claude Code, an interactive CLI tool that helps users with software engineering tasks.",
27
+ system_prompt: "You are Claude Code, an interactive CLI tool that helps users with software engineering tasks. Use the available tools to inspect the workspace, make precise changes, and verify the result before responding.\n\nYour default posture is practical, careful, and completion-oriented. Build context from the repository before making assumptions. Prefer direct evidence from files, commands, tests, and diagnostics over memory or guesswork.\n\nWhen working on code:\n- inspect existing patterns before editing\n- keep changes scoped to the requested outcome\n- preserve surrounding style, naming, and structure\n- avoid speculative refactors unless they are required to complete the requested task\n- verify every meaningful change with the strongest local check available\n\nWhen using tools:\n- use read, search, and symbol tools to understand the codebase before writing code\n- use shell commands for builds, tests, package scripts, and runtime verification\n- explain non-trivial actions briefly and clearly\n- prefer small, reviewable edits over broad rewrites\n- if multiple independent checks are available, run them efficiently\n\nWhen editing files:\n- keep the implementation easy to read from top to bottom\n- use descriptive names instead of magic values\n- avoid hidden side effects and surprising behavior\n- keep related logic together\n- add comments only when they clarify non-obvious intent\n\nWhen validating work:\n- run diagnostics on touched files when possible\n- run focused tests for affected behavior\n- run typechecking in typed projects\n- run builds when the package exposes a build step\n- if a check fails, fix the root cause and re-run verification\n\nWhen responding to the user:\n- be concise, direct, and accurate\n- focus on the task that was requested\n- summarize what changed and what was verified\n- mention important assumptions or follow-up risks only when they matter\n\nOperational guidance:\n- treat repository state as the source of truth\n- prefer deterministic behavior over clever shortcuts\n- do not invent undocumented APIs or file formats when local evidence is missing\n- if a requested detail is ambiguous, choose the simplest implementation that still satisfies the observable contract\n- preserve user data and existing behavior unless the requested change requires otherwise\n\nSafety guidance:\n- support defensive security work, debugging, testing, and code maintenance\n- refuse requests to create or improve malware, credential theft, bulk secret harvesting, or other clearly harmful capabilities\n- do not exfiltrate secrets from the environment, local files, or external services\n- avoid destructive operations unless they are explicitly required and safe to perform\n\nTool execution discipline:\n- use task tracking for multi-step work so progress stays visible\n- complete one active step at a time\n- after each code change, move immediately to verification\n- if verification reveals a problem, continue until the implementation and checks agree\n\nRepository interaction discipline:\n- prefer local source files, tests, and configuration over informal assumptions\n- preserve compatibility with existing consumers when editing shared interfaces\n- keep bundled fallback data conservative when live capture data is unavailable\n- when request templates depend on multiple system blocks, preserve the extracted fields that downstream code needs rather than reconstructing unrelated runtime state\n\nYou should act like a reliable engineering assistant inside a terminal environment: inspect first, edit precisely, verify thoroughly, and only then report the result.",
28
+ tools: [
29
+ {
30
+ name: "Bash",
31
+ input_schema: {
32
+ $schema: "https://json-schema.org/draft/2020-12/schema",
33
+ type: "object",
34
+ properties: {},
35
+ additionalProperties: true
36
+ }
37
+ },
38
+ {
39
+ name: "Read",
40
+ input_schema: {
41
+ $schema: "https://json-schema.org/draft/2020-12/schema",
42
+ type: "object",
43
+ properties: {},
44
+ additionalProperties: true
45
+ }
46
+ },
47
+ {
48
+ name: "Write",
49
+ input_schema: {
50
+ $schema: "https://json-schema.org/draft/2020-12/schema",
51
+ type: "object",
52
+ properties: {},
53
+ additionalProperties: true
54
+ }
55
+ },
56
+ {
57
+ name: "Edit",
58
+ input_schema: {
59
+ $schema: "https://json-schema.org/draft/2020-12/schema",
60
+ type: "object",
61
+ properties: {},
62
+ additionalProperties: true
63
+ }
64
+ },
65
+ {
66
+ name: "Glob",
67
+ input_schema: {
68
+ $schema: "https://json-schema.org/draft/2020-12/schema",
69
+ type: "object",
70
+ properties: {},
71
+ additionalProperties: true
72
+ }
73
+ },
74
+ {
75
+ name: "Grep",
76
+ input_schema: {
77
+ $schema: "https://json-schema.org/draft/2020-12/schema",
78
+ type: "object",
79
+ properties: {},
80
+ additionalProperties: true
81
+ }
82
+ },
83
+ {
84
+ name: "WebFetch",
85
+ input_schema: {
86
+ $schema: "https://json-schema.org/draft/2020-12/schema",
87
+ type: "object",
88
+ properties: {},
89
+ additionalProperties: true
90
+ }
91
+ },
92
+ {
93
+ name: "TodoWrite",
94
+ input_schema: {
95
+ $schema: "https://json-schema.org/draft/2020-12/schema",
96
+ type: "object",
97
+ properties: {},
98
+ additionalProperties: true
99
+ }
100
+ },
101
+ {
102
+ name: "TaskCreate",
103
+ input_schema: {
104
+ $schema: "https://json-schema.org/draft/2020-12/schema",
105
+ type: "object",
106
+ properties: {},
107
+ additionalProperties: true
108
+ }
109
+ },
110
+ {
111
+ name: "TaskGet",
112
+ input_schema: {
113
+ $schema: "https://json-schema.org/draft/2020-12/schema",
114
+ type: "object",
115
+ properties: {},
116
+ additionalProperties: true
117
+ }
118
+ },
119
+ {
120
+ name: "TaskList",
121
+ input_schema: {
122
+ $schema: "https://json-schema.org/draft/2020-12/schema",
123
+ type: "object",
124
+ properties: {},
125
+ additionalProperties: true
126
+ }
127
+ },
128
+ {
129
+ name: "TaskOutput",
130
+ input_schema: {
131
+ $schema: "https://json-schema.org/draft/2020-12/schema",
132
+ type: "object",
133
+ properties: {},
134
+ additionalProperties: true
135
+ }
136
+ },
137
+ {
138
+ name: "TaskStop",
139
+ input_schema: {
140
+ $schema: "https://json-schema.org/draft/2020-12/schema",
141
+ type: "object",
142
+ properties: {},
143
+ additionalProperties: true
144
+ }
145
+ },
146
+ {
147
+ name: "LSP",
148
+ input_schema: {
149
+ $schema: "https://json-schema.org/draft/2020-12/schema",
150
+ type: "object",
151
+ properties: {},
152
+ additionalProperties: true
153
+ }
154
+ },
155
+ {
156
+ name: "Monitor",
157
+ input_schema: {
158
+ $schema: "https://json-schema.org/draft/2020-12/schema",
159
+ type: "object",
160
+ properties: {},
161
+ additionalProperties: true
162
+ }
163
+ },
164
+ {
165
+ name: "NotebookEdit",
166
+ input_schema: {
167
+ $schema: "https://json-schema.org/draft/2020-12/schema",
168
+ type: "object",
169
+ properties: {},
170
+ additionalProperties: true
171
+ }
172
+ },
173
+ {
174
+ name: "Skill",
175
+ input_schema: {
176
+ $schema: "https://json-schema.org/draft/2020-12/schema",
177
+ type: "object",
178
+ properties: {},
179
+ additionalProperties: true
180
+ }
181
+ }
182
+ ],
183
+ tool_names: [
184
+ "Bash",
185
+ "Read",
186
+ "Write",
187
+ "Edit",
188
+ "Glob",
189
+ "Grep",
190
+ "WebFetch",
191
+ "TodoWrite",
192
+ "TaskCreate",
193
+ "TaskGet",
194
+ "TaskList",
195
+ "TaskOutput",
196
+ "TaskStop",
197
+ "LSP",
198
+ "Monitor",
199
+ "NotebookEdit",
200
+ "Skill"
201
+ ],
202
+ anthropic_beta: "claude-code-20250219,oauth-2025-04-20,context-1m-2025-08-07,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advisor-tool-2026-03-01,effort-2025-11-24",
203
+ header_values: {
204
+ "anthropic-version": "2023-06-01",
205
+ "anthropic-beta": "claude-code-20250219,oauth-2025-04-20,context-1m-2025-08-07,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advisor-tool-2026-03-01,effort-2025-11-24",
206
+ "x-app": "cli"
207
+ },
208
+ header_order: [
209
+ "Accept",
210
+ "Authorization",
211
+ "Content-Type",
212
+ "User-Agent",
213
+ "X-Claude-Code-Session-Id",
214
+ "X-Stainless-Arch",
215
+ "X-Stainless-Lang",
216
+ "X-Stainless-OS",
217
+ "X-Stainless-Package-Version",
218
+ "X-Stainless-Retry-Count",
219
+ "X-Stainless-Runtime",
220
+ "X-Stainless-Runtime-Version",
221
+ "X-Stainless-Timeout",
222
+ "anthropic-beta",
223
+ "anthropic-dangerous-direct-browser-access",
224
+ "anthropic-version",
225
+ "x-app",
226
+ "Connection",
227
+ "Host",
228
+ "Accept-Encoding",
229
+ "Content-Length"
230
+ ],
231
+ body_field_order: [
232
+ "model",
233
+ "messages",
234
+ "system",
235
+ "tools",
236
+ "metadata",
237
+ "max_tokens",
238
+ "thinking",
239
+ "context_management",
240
+ "output_config",
241
+ "stream"
242
+ ],
243
+ cc_version: "2.1.111"
244
+ };
245
+
246
+ // src/cli-version.ts
247
+ import { execFileSync } from "child_process";
248
+ var DEFAULT_CLI_VERSION = "2.1.100";
249
+ var CLI_VERSION_PATTERN = /(\d+\.\d+\.\d+)/;
250
+ var CLAUDE_VERSION_TIMEOUT_MS = 3e3;
251
+ var detectedVersion = null;
252
+ function parseCliVersion(output) {
253
+ return output.match(CLI_VERSION_PATTERN)?.[1] ?? null;
254
+ }
255
+ function detectCliVersion() {
256
+ if (detectedVersion !== null) {
257
+ return detectedVersion;
258
+ }
259
+ const overriddenVersion = process.env.ANTHROPIC_CLI_VERSION;
260
+ if (overriddenVersion) {
261
+ detectedVersion = overriddenVersion;
262
+ return detectedVersion;
263
+ }
264
+ try {
265
+ const output = execFileSync("claude", ["--version"], {
266
+ encoding: "utf8",
267
+ timeout: CLAUDE_VERSION_TIMEOUT_MS
268
+ });
269
+ detectedVersion = parseCliVersion(output) ?? DEFAULT_CLI_VERSION;
270
+ } catch {
271
+ detectedVersion = DEFAULT_CLI_VERSION;
272
+ }
273
+ return detectedVersion;
274
+ }
275
+
276
+ // src/oauth-config-detect.ts
277
+ import { createHash } from "crypto";
278
+ import { existsSync } from "fs";
279
+ import { mkdir, readFile, writeFile } from "fs/promises";
280
+ import { homedir, platform } from "os";
281
+ import { dirname, join } from "path";
282
+
283
+ // src/fixtures/defaults/cc-derived-defaults.json
284
+ var cc_derived_defaults_default = {
285
+ request: {
286
+ baseApiUrl: "https://api.anthropic.com",
287
+ anthropicVersion: "2023-06-01",
288
+ xApp: "cli",
289
+ betaHeader: "claude-code-20250219,oauth-2025-04-20,context-1m-2025-08-07,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advisor-tool-2026-03-01,effort-2025-11-24"
290
+ },
291
+ oauth: {
292
+ clientId: "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
293
+ authorizeUrl: "https://claude.com/cai/oauth/authorize",
294
+ tokenUrl: "https://platform.claude.com/v1/oauth/token",
295
+ scopes: "user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload",
296
+ baseApiUrl: "https://api.anthropic.com"
297
+ }
298
+ };
299
+
300
+ // src/utils.ts
301
+ import {
302
+ createMinimalClient,
303
+ formatWaitTime,
304
+ getAccountLabel,
305
+ getConfigDir,
306
+ getErrorCode,
307
+ sleep
308
+ } from "opencode-multi-account-core";
309
+
310
+ // src/constants.ts
311
+ import { anthropicOAuthAdapter } from "opencode-multi-account-core";
312
+ var ANTHROPIC_OAUTH_ADAPTER = anthropicOAuthAdapter;
313
+ var ANTHROPIC_CLIENT_ID = ANTHROPIC_OAUTH_ADAPTER.oauthClientId;
314
+ var ANTHROPIC_TOKEN_ENDPOINT = ANTHROPIC_OAUTH_ADAPTER.tokenEndpoint;
315
+ var ANTHROPIC_USAGE_ENDPOINT = ANTHROPIC_OAUTH_ADAPTER.usageEndpoint;
316
+ var ANTHROPIC_PROFILE_ENDPOINT = ANTHROPIC_OAUTH_ADAPTER.profileEndpoint;
317
+ var ACCOUNTS_FILENAME = ANTHROPIC_OAUTH_ADAPTER.accountStorageFilename;
318
+ var CLAIMS_FILENAME = "anthropic-multi-account-claims.json";
319
+ var PLAN_LABELS = ANTHROPIC_OAUTH_ADAPTER.planLabels;
320
+ var TOKEN_EXPIRY_BUFFER_MS = 6e4;
321
+ var TOKEN_REFRESH_TIMEOUT_MS = 3e4;
322
+
323
+ // src/config.ts
324
+ import {
325
+ createConfigLoader
326
+ } from "opencode-multi-account-core";
327
+ var configLoader = createConfigLoader("claude-multiauth.json");
328
+ var { getConfig, loadConfig, resetConfigCache, updateConfigField } = configLoader;
329
+
330
+ // src/utils.ts
331
+ async function showToast(client, message, variant) {
332
+ if (getConfig().quiet_mode) return;
333
+ try {
334
+ await client.tui.showToast({ body: { message, variant } });
335
+ } catch {
336
+ }
337
+ }
338
+ function debugLog(client, message, extra) {
339
+ if (!getConfig().debug) return;
340
+ client.app.log({
341
+ body: { service: ANTHROPIC_OAUTH_ADAPTER.serviceLogName, level: "debug", message, extra }
342
+ }).catch(() => {
343
+ });
344
+ }
345
+
346
+ // src/oauth-config-detect.ts
347
+ var CONFIG_SCAN_WINDOW_CHARS = 4096;
348
+ var CONFIG_SCAN_LOOKBACK_CHARS = 512;
349
+ var REJECTED_SCOPE = ["org", "create_api_key"].join(":");
350
+ var SAFE_FALLBACK_SCOPES = "user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";
351
+ var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
352
+ var CACHE_FILE_NAME = "anthropic-oauth-config-cache.json";
353
+ var derivedDefaults = cc_derived_defaults_default;
354
+ var FALLBACK = {
355
+ clientId: derivedDefaults.oauth?.clientId || "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
356
+ authorizeUrl: derivedDefaults.oauth?.authorizeUrl || "https://claude.com/cai/oauth/authorize",
357
+ tokenUrl: derivedDefaults.oauth?.tokenUrl || "https://platform.claude.com/v1/oauth/token",
358
+ scopes: sanitizeScopes(derivedDefaults.oauth?.scopes),
359
+ baseApiUrl: derivedDefaults.oauth?.baseApiUrl || "https://api.anthropic.com",
360
+ source: "fallback"
361
+ };
362
+ function sanitizeScopes(scopes) {
363
+ if (!scopes || scopes.includes(REJECTED_SCOPE)) {
364
+ return SAFE_FALLBACK_SCOPES;
365
+ }
366
+ return scopes;
367
+ }
368
+ function pickNearestScopes(block, centerIndex) {
369
+ return pickNearestValue(block, centerIndex, /SCOPES\s*:\s*"([^"]+)"/gi) || pickNearestValue(block, centerIndex, /scope[s]?\s*:\s*"([^"]+)"/gi) || null;
370
+ }
371
+ function isLikelyLocalUrl(value) {
372
+ if (!value) {
373
+ return false;
374
+ }
375
+ try {
376
+ const host = new URL(value).hostname.toLowerCase();
377
+ return host === "localhost" || host === "127.0.0.1" || host === "0.0.0.0" || host.endsWith(".local");
378
+ } catch {
379
+ return false;
380
+ }
381
+ }
382
+ function extractCandidateBlocks(binaryText) {
383
+ const blocks = [];
384
+ const seenRanges = /* @__PURE__ */ new Set();
385
+ const clientIdMatches = [...binaryText.matchAll(/CLIENT_ID\s*:\s*"([0-9a-f-]{36})"/gi)];
386
+ for (let index = 0; index < clientIdMatches.length; index += 1) {
387
+ const currentMatch = clientIdMatches[index];
388
+ if (!currentMatch) {
389
+ continue;
390
+ }
391
+ const currentIndex = currentMatch.index ?? 0;
392
+ const previousClientIdIndex = clientIdMatches[index - 1]?.index;
393
+ const nextClientIdIndex = clientIdMatches[index + 1]?.index;
394
+ const leftBoundary = previousClientIdIndex === void 0 ? Math.max(0, currentIndex - CONFIG_SCAN_LOOKBACK_CHARS) : Math.floor((previousClientIdIndex + currentIndex) / 2);
395
+ const rightBoundary = nextClientIdIndex === void 0 ? Math.min(binaryText.length, currentIndex + CONFIG_SCAN_WINDOW_CHARS) : Math.floor((currentIndex + nextClientIdIndex) / 2);
396
+ const start = Math.max(0, leftBoundary);
397
+ const end = Math.min(binaryText.length, Math.max(currentIndex + 1, rightBoundary));
398
+ const key = `${start}:${end}`;
399
+ if (seenRanges.has(key)) {
400
+ continue;
401
+ }
402
+ seenRanges.add(key);
403
+ blocks.push(binaryText.slice(start, end));
404
+ }
405
+ if (blocks.length === 0 && binaryText.length > 0) {
406
+ blocks.push(binaryText.slice(0, Math.min(binaryText.length, CONFIG_SCAN_WINDOW_CHARS)));
407
+ }
408
+ return blocks;
409
+ }
410
+ function pickNearestValue(block, centerIndex, pattern) {
411
+ let nearestValue;
412
+ let nearestDistance = Number.POSITIVE_INFINITY;
413
+ for (const match of block.matchAll(pattern)) {
414
+ const matchIndex = match.index ?? 0;
415
+ const distance = Math.abs(matchIndex - centerIndex);
416
+ if (distance < nearestDistance) {
417
+ nearestDistance = distance;
418
+ nearestValue = match[1];
419
+ }
420
+ }
421
+ return nearestValue;
422
+ }
423
+ function scoreCandidate(candidate, extractedScopes) {
424
+ let score = 0;
425
+ if (UUID_PATTERN.test(candidate.clientId)) score += 4;
426
+ if (candidate.baseApiUrl.startsWith("https://")) score += 3;
427
+ if (!isLikelyLocalUrl(candidate.baseApiUrl)) score += 5;
428
+ if (!isLikelyLocalUrl(candidate.authorizeUrl)) score += 2;
429
+ if (!isLikelyLocalUrl(candidate.tokenUrl)) score += 2;
430
+ if (extractedScopes) score += 2;
431
+ if (candidate.scopes.includes("user:sessions:claude_code")) score += 1;
432
+ return score;
433
+ }
434
+ function extractCandidateFromBlock(block) {
435
+ const clientIdMatch = /CLIENT_ID\s*:\s*"([0-9a-f-]{36})"/i.exec(block);
436
+ if (!clientIdMatch?.[1]) {
437
+ return null;
438
+ }
439
+ const clientIdIndex = clientIdMatch.index ?? 0;
440
+ const authorizeUrl = pickNearestValue(block, clientIdIndex, /CLAUDE_AI_AUTHORIZE_URL\s*:\s*"([^"]+)"/gi);
441
+ const baseApiUrl = pickNearestValue(block, clientIdIndex, /BASE_API_URL\s*:\s*"([^"]+)"/gi);
442
+ const tokenUrl = pickNearestValue(block, clientIdIndex, /TOKEN_URL\s*:\s*"(https:\/\/[^\"]*\/oauth\/token[^\"]*)"/gi);
443
+ const extractedScopes = pickNearestScopes(block, clientIdIndex);
444
+ const payload = {
445
+ clientId: clientIdMatch[1],
446
+ authorizeUrl: authorizeUrl || FALLBACK.authorizeUrl,
447
+ tokenUrl: tokenUrl || FALLBACK.tokenUrl,
448
+ scopes: sanitizeScopes(extractedScopes),
449
+ baseApiUrl: baseApiUrl || FALLBACK.baseApiUrl
450
+ };
451
+ if (!isDetectedOAuthConfigPayload(payload)) {
452
+ return null;
453
+ }
454
+ return {
455
+ payload,
456
+ score: scoreCandidate(payload, extractedScopes)
457
+ };
458
+ }
459
+ var memoizedConfig = null;
460
+ var detectorTestOverrides = {};
461
+ function candidatePaths() {
462
+ const home = homedir();
463
+ if (platform() === "win32") {
464
+ return [
465
+ join(home, ".local", "bin", "claude.exe"),
466
+ join(home, "AppData", "Roaming", "npm", "node_modules", "@anthropic-ai", "claude-code", "cli.js"),
467
+ join(home, "AppData", "Roaming", "npm", "node_modules", "@anthropic-ai", "claude-code", "cli.mjs"),
468
+ join(home, ".claude", "local", "node_modules", "@anthropic-ai", "claude-code", "cli.js"),
469
+ join(home, ".claude", "local", "node_modules", "@anthropic-ai", "claude-code", "cli.mjs")
470
+ ];
471
+ }
472
+ return [
473
+ join(home, ".local", "bin", "claude"),
474
+ "/usr/local/bin/claude",
475
+ "/opt/homebrew/bin/claude",
476
+ "/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js",
477
+ "/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.mjs",
478
+ "/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js",
479
+ join(home, ".claude", "local", "node_modules", "@anthropic-ai", "claude-code", "cli.js"),
480
+ join(home, ".claude", "local", "node_modules", "@anthropic-ai", "claude-code", "cli.mjs")
481
+ ];
482
+ }
483
+ function getCachePath() {
484
+ return join(getConfigDir(), CACHE_FILE_NAME);
485
+ }
486
+ function isValidUrl(value) {
487
+ try {
488
+ new URL(value);
489
+ return true;
490
+ } catch {
491
+ return false;
492
+ }
493
+ }
494
+ function isDetectedOAuthConfigPayload(value) {
495
+ if (typeof value !== "object" || value === null) {
496
+ return false;
497
+ }
498
+ const candidate = value;
499
+ return typeof candidate.clientId === "string" && UUID_PATTERN.test(candidate.clientId) && typeof candidate.authorizeUrl === "string" && isValidUrl(candidate.authorizeUrl) && typeof candidate.tokenUrl === "string" && isValidUrl(candidate.tokenUrl) && typeof candidate.scopes === "string" && candidate.scopes.length > 0;
500
+ }
501
+ function toFallbackConfig(ccPath, ccHash) {
502
+ return {
503
+ ...FALLBACK,
504
+ ...ccPath ? { ccPath } : {},
505
+ ...ccHash ? { ccHash } : {}
506
+ };
507
+ }
508
+ function findCCBinary() {
509
+ const override = process.env.DARIO_CC_PATH;
510
+ if (override && existsSync(override)) {
511
+ return override;
512
+ }
513
+ for (const candidatePath of candidatePaths()) {
514
+ if (existsSync(candidatePath)) {
515
+ return candidatePath;
516
+ }
517
+ }
518
+ return null;
519
+ }
520
+ async function fingerprintBinary(path) {
521
+ const binaryContents = await readFile(path);
522
+ return createHash("sha256").update(binaryContents).digest("hex").slice(0, 16);
523
+ }
524
+ function scanBinaryForOAuthConfig(buf) {
525
+ const binaryText = buf.toString("latin1");
526
+ const candidates = extractCandidateBlocks(binaryText).map(extractCandidateFromBlock).filter((candidate) => candidate !== null).sort((left, right) => right.score - left.score);
527
+ return candidates[0]?.payload ?? null;
528
+ }
529
+ async function loadCache() {
530
+ try {
531
+ const raw = await readFile(getCachePath(), "utf-8");
532
+ const parsed = JSON.parse(raw);
533
+ if (typeof parsed !== "object" || parsed === null || typeof parsed.entries !== "object" || parsed.entries === null) {
534
+ return {};
535
+ }
536
+ const validEntries = {};
537
+ for (const [hash, value] of Object.entries(parsed.entries)) {
538
+ if (isDetectedOAuthConfigPayload(value)) {
539
+ validEntries[hash] = value;
540
+ }
541
+ }
542
+ return validEntries;
543
+ } catch {
544
+ return {};
545
+ }
546
+ }
547
+ async function saveCache(hash, config) {
548
+ try {
549
+ const cachePath = getCachePath();
550
+ const currentEntries = await loadCache();
551
+ currentEntries[hash] = config;
552
+ await mkdir(dirname(cachePath), { recursive: true });
553
+ await writeFile(
554
+ cachePath,
555
+ JSON.stringify({ entries: currentEntries, savedAt: Date.now() }, null, 2),
556
+ "utf-8"
557
+ );
558
+ } catch {
559
+ }
560
+ }
561
+ async function detectOAuthConfig() {
562
+ if (memoizedConfig) {
563
+ return memoizedConfig;
564
+ }
565
+ try {
566
+ const ccPath = (detectorTestOverrides.findCCBinary || findCCBinary)();
567
+ if (!ccPath) {
568
+ memoizedConfig = FALLBACK;
569
+ return memoizedConfig;
570
+ }
571
+ const ccHash = await fingerprintBinary(ccPath);
572
+ const cachedEntries = await loadCache();
573
+ const cachedConfig = cachedEntries[ccHash];
574
+ if (cachedConfig) {
575
+ memoizedConfig = {
576
+ ...cachedConfig,
577
+ source: "cached",
578
+ ccPath,
579
+ ccHash
580
+ };
581
+ return memoizedConfig;
582
+ }
583
+ const readBinaryFile = detectorTestOverrides.readBinaryFile || readFile;
584
+ const scannedConfig = scanBinaryForOAuthConfig(await readBinaryFile(ccPath));
585
+ if (!scannedConfig || !isDetectedOAuthConfigPayload(scannedConfig)) {
586
+ memoizedConfig = toFallbackConfig(ccPath, ccHash);
587
+ return memoizedConfig;
588
+ }
589
+ await saveCache(ccHash, scannedConfig);
590
+ memoizedConfig = {
591
+ ...scannedConfig,
592
+ source: "detected",
593
+ ccPath,
594
+ ccHash
595
+ };
596
+ return memoizedConfig;
597
+ } catch {
598
+ memoizedConfig = FALLBACK;
599
+ return memoizedConfig;
600
+ }
601
+ }
602
+
603
+ // src/fingerprint-capture.ts
604
+ var CURRENT_SCHEMA_VERSION = 1;
605
+ var LIVE_TTL_MS = 24 * 60 * 60 * 1e3;
606
+ var DEFAULT_CAPTURE_TIMEOUT_MS = 1e4;
607
+ var CACHE_FILE_NAME2 = "fingerprint-cache.json";
608
+ var CORRUPT_SUFFIX = ".corrupt";
609
+ var LOOPBACK_HOST = "127.0.0.1";
610
+ var STATIC_HEADER_NAMES = [
611
+ "accept",
612
+ "anthropic-beta",
613
+ "anthropic-dangerous-direct-browser-access",
614
+ "anthropic-version",
615
+ "content-type",
616
+ "user-agent",
617
+ "x-app",
618
+ "x-stainless-timeout"
619
+ ];
620
+ var SUPPORTED_CC_RANGE = {
621
+ min: "1.0.0",
622
+ maxTested: "2.1.104"
623
+ };
624
+ var bundledTemplate = fingerprint_data_default;
625
+ var fingerprintCaptureTestOverrides = {};
626
+ function now() {
627
+ return fingerprintCaptureTestOverrides.now?.() ?? Date.now();
628
+ }
629
+ function getCachePath2() {
630
+ return join2(getConfigDir(), CACHE_FILE_NAME2);
631
+ }
632
+ function isRecord(value) {
633
+ return typeof value === "object" && value !== null;
634
+ }
635
+ function isTemplateTool(value) {
636
+ return isRecord(value) && typeof value.name === "string" && value.name.length > 0;
637
+ }
638
+ function isTemplateData(value) {
639
+ if (!isRecord(value)) {
640
+ return false;
641
+ }
642
+ return typeof value._version === "number" && typeof value._captured === "string" && typeof value._source === "string" && typeof value.agent_identity === "string" && typeof value.system_prompt === "string" && Array.isArray(value.tools) && value.tools.every(isTemplateTool) && Array.isArray(value.tool_names) && value.tool_names.every((toolName) => typeof toolName === "string");
643
+ }
644
+ function hasUsableToolSchemas(template) {
645
+ return template.tools.length > 0 && template.tools.every((tool) => tool.name.startsWith("mcp__") || isRecord(tool.input_schema));
646
+ }
647
+ function isUsableTemplate(template) {
648
+ return template._schemaVersion === CURRENT_SCHEMA_VERSION && hasUsableToolSchemas(template);
649
+ }
650
+ function cloneTemplate(template, sourceOverride) {
651
+ return {
652
+ ...template,
653
+ _source: sourceOverride ?? template._source,
654
+ tools: template.tools.map((tool) => ({ ...tool })),
655
+ tool_names: [...template.tool_names],
656
+ header_order: template.header_order ? [...template.header_order] : void 0,
657
+ header_values: template.header_values ? { ...template.header_values } : void 0,
658
+ body_field_order: template.body_field_order ? [...template.body_field_order] : void 0
659
+ };
660
+ }
661
+ function prepareBundledTemplate(template) {
662
+ const rest = cloneTemplate(template, "bundled");
663
+ return {
664
+ ...rest,
665
+ _version: CURRENT_SCHEMA_VERSION,
666
+ _schemaVersion: CURRENT_SCHEMA_VERSION,
667
+ _source: "bundled",
668
+ tool_names: rest.tools.map((tool) => tool.name)
669
+ };
670
+ }
671
+ function loadBundledTemplate() {
672
+ if (bundledTemplate._schemaVersion !== CURRENT_SCHEMA_VERSION) {
673
+ throw new Error(
674
+ `bundled fingerprint schema version ${bundledTemplate._schemaVersion} does not match CURRENT_SCHEMA_VERSION ${CURRENT_SCHEMA_VERSION}`
675
+ );
676
+ }
677
+ return prepareBundledTemplate(bundledTemplate);
678
+ }
679
+ function quarantineCorruptCache(cachePath) {
680
+ if (!existsSync2(cachePath)) {
681
+ return;
682
+ }
683
+ try {
684
+ const quarantinedPath = `${cachePath}${CORRUPT_SUFFIX}-${now()}-${process.pid}`;
685
+ renameSync(cachePath, quarantinedPath);
686
+ } catch {
687
+ }
688
+ }
689
+ function readLiveCacheSync(sourceOverride = "cached") {
690
+ const cachePath = getCachePath2();
691
+ try {
692
+ const parsed = JSON.parse(readFileSync(cachePath, "utf8"));
693
+ if (!isTemplateData(parsed)) {
694
+ quarantineCorruptCache(cachePath);
695
+ return null;
696
+ }
697
+ return cloneTemplate(parsed, sourceOverride);
698
+ } catch (error) {
699
+ if (existsSync2(cachePath)) {
700
+ const isMissingFileError = error instanceof Error && "code" in error && error.code === "ENOENT";
701
+ if (!isMissingFileError) {
702
+ quarantineCorruptCache(cachePath);
703
+ }
704
+ }
705
+ return null;
706
+ }
707
+ }
708
+ function isFreshTemplate(template) {
709
+ const capturedAt = Date.parse(template._captured);
710
+ return Number.isFinite(capturedAt) && now() - capturedAt < LIVE_TTL_MS;
711
+ }
712
+ async function atomicWriteJson(targetPath, payload) {
713
+ const tmpPath = join2(
714
+ dirname2(targetPath),
715
+ `${basename(targetPath)}.${process.pid}.${now()}.tmp`
716
+ );
717
+ await mkdir2(dirname2(targetPath), { recursive: true });
718
+ await writeFile2(tmpPath, `${JSON.stringify(payload, null, 2)}
719
+ `, "utf8");
720
+ await rename(tmpPath, targetPath);
721
+ }
722
+ async function writeLiveCache(template) {
723
+ await atomicWriteJson(getCachePath2(), cloneTemplate(template, "live"));
724
+ }
725
+ function toText(value) {
726
+ if (typeof value === "string") {
727
+ return value;
728
+ }
729
+ if (isRecord(value) && typeof value.text === "string") {
730
+ return value.text;
731
+ }
732
+ return null;
733
+ }
734
+ function pickTextBlock(value) {
735
+ if (typeof value === "string") {
736
+ return value;
737
+ }
738
+ if (Array.isArray(value)) {
739
+ for (const item of value) {
740
+ const text = toText(item);
741
+ if (text) {
742
+ return text;
743
+ }
744
+ }
745
+ return null;
746
+ }
747
+ return toText(value);
748
+ }
749
+ function extractCCVersion(...sources) {
750
+ for (const source of sources) {
751
+ if (!source) {
752
+ continue;
753
+ }
754
+ const billingMatch = /cc_version=([0-9]+\.[0-9]+\.[0-9]+)/i.exec(source);
755
+ if (billingMatch?.[1]) {
756
+ return billingMatch[1];
757
+ }
758
+ const userAgentMatch = /(?:claude(?:-code)?[\s/]|v)([0-9]+\.[0-9]+\.[0-9]+)/i.exec(source);
759
+ if (userAgentMatch?.[1]) {
760
+ return userAgentMatch[1];
761
+ }
762
+ }
763
+ return void 0;
764
+ }
765
+ function extractHeaderOrder(rawHeaders) {
766
+ if (rawHeaders.length === 0) {
767
+ return void 0;
768
+ }
769
+ const seen = /* @__PURE__ */ new Set();
770
+ const orderedHeaders = [];
771
+ for (let index = 0; index < rawHeaders.length; index += 2) {
772
+ const headerName = rawHeaders[index];
773
+ if (!headerName) {
774
+ continue;
775
+ }
776
+ const key = headerName.toLowerCase();
777
+ if (seen.has(key)) {
778
+ continue;
779
+ }
780
+ seen.add(key);
781
+ orderedHeaders.push(headerName);
782
+ }
783
+ return orderedHeaders.length > 0 ? orderedHeaders : void 0;
784
+ }
785
+ function extractStaticHeaderValues(headers) {
786
+ const values = {};
787
+ for (const headerName of STATIC_HEADER_NAMES) {
788
+ const value = headers[headerName];
789
+ if (typeof value === "string" && value.length > 0) {
790
+ values[headerName] = value;
791
+ }
792
+ }
793
+ return Object.keys(values).length > 0 ? values : void 0;
794
+ }
795
+ function normalizeHeaders(req) {
796
+ const normalized = {};
797
+ for (const [headerName, headerValue] of Object.entries(req.headers)) {
798
+ if (typeof headerValue === "string") {
799
+ normalized[headerName] = headerValue;
800
+ continue;
801
+ }
802
+ if (Array.isArray(headerValue)) {
803
+ normalized[headerName] = headerValue.join(",");
804
+ }
805
+ }
806
+ return normalized;
807
+ }
808
+ function createSseResponseBody() {
809
+ return [
810
+ 'event: message_start\ndata: {"type":"message_start","message":{"id":"msg_capture","type":"message","role":"assistant","model":"claude-sonnet-4-5","content":[]}}\n',
811
+ 'event: content_block_start\ndata: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}\n',
812
+ 'event: content_block_delta\ndata: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"ok"}}\n',
813
+ 'event: content_block_stop\ndata: {"type":"content_block_stop","index":0}\n',
814
+ 'event: message_delta\ndata: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"input_tokens":1,"output_tokens":1}}\n',
815
+ 'event: message_stop\ndata: {"type":"message_stop"}\n'
816
+ ].join("\n");
817
+ }
818
+ async function captureRequestBody(req) {
819
+ return new Promise((resolve, reject) => {
820
+ const chunks = [];
821
+ req.on("data", (chunk) => {
822
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
823
+ });
824
+ req.on("end", () => {
825
+ resolve(Buffer.concat(chunks).toString("utf8"));
826
+ });
827
+ req.on("error", reject);
828
+ });
829
+ }
830
+ async function runClaudeCapture(params) {
831
+ if (fingerprintCaptureTestOverrides.runClaudeCapture) {
832
+ await fingerprintCaptureTestOverrides.runClaudeCapture(params);
833
+ return;
834
+ }
835
+ const isNodeScript = /\.(?:cjs|mjs|js)$/.test(params.binaryPath);
836
+ const command = isNodeScript ? process.execPath : params.binaryPath;
837
+ const args = isNodeScript ? [params.binaryPath, "--print", "-p", "hi"] : ["--print", "-p", "hi"];
838
+ await new Promise((resolve, reject) => {
839
+ const child = spawn(command, args, {
840
+ env: {
841
+ ...process.env,
842
+ ANTHROPIC_BASE_URL: params.baseUrl
843
+ },
844
+ stdio: "ignore"
845
+ });
846
+ const timeout = setTimeout(() => {
847
+ child.kill("SIGKILL");
848
+ reject(new Error("capture timed out"));
849
+ }, params.timeoutMs);
850
+ child.once("error", (error) => {
851
+ clearTimeout(timeout);
852
+ reject(error);
853
+ });
854
+ child.once("close", () => {
855
+ clearTimeout(timeout);
856
+ resolve();
857
+ });
858
+ });
859
+ }
860
+ function findClaudeBinary() {
861
+ if (fingerprintCaptureTestOverrides.findClaudeBinary) {
862
+ return fingerprintCaptureTestOverrides.findClaudeBinary();
863
+ }
864
+ return findCCBinary();
865
+ }
866
+ function probeInstalledCCVersion() {
867
+ try {
868
+ return fingerprintCaptureTestOverrides.detectCliVersion?.() ?? detectCliVersion();
869
+ } catch {
870
+ return null;
871
+ }
872
+ }
873
+ function loadTemplate() {
874
+ const cached = readLiveCacheSync("cached");
875
+ if (cached && isUsableTemplate(cached)) {
876
+ return cached;
877
+ }
878
+ return loadBundledTemplate();
879
+ }
880
+ function extractTemplate(captured) {
881
+ const systemBlocks = captured.body.system;
882
+ const tools = captured.body.tools;
883
+ if (!Array.isArray(systemBlocks) || systemBlocks.length !== 3 || !Array.isArray(tools) || tools.length === 0) {
884
+ return null;
885
+ }
886
+ const billingHeader = pickTextBlock(systemBlocks[0]);
887
+ const agentIdentity = pickTextBlock(systemBlocks[1]);
888
+ const systemPrompt = pickTextBlock(systemBlocks[2]);
889
+ const extractedTools = tools.filter(isTemplateTool).map((tool) => ({ ...tool }));
890
+ if (!billingHeader || !agentIdentity || !systemPrompt || extractedTools.length === 0) {
891
+ return null;
892
+ }
893
+ const toolNames = extractedTools.map((tool) => tool.name);
894
+ const headerValues = extractStaticHeaderValues(captured.headers);
895
+ const bodyFieldOrder = Object.keys(captured.body);
896
+ return {
897
+ _version: CURRENT_SCHEMA_VERSION,
898
+ _schemaVersion: CURRENT_SCHEMA_VERSION,
899
+ _captured: new Date(now()).toISOString(),
900
+ _source: "live",
901
+ agent_identity: agentIdentity,
902
+ system_prompt: systemPrompt,
903
+ tools: extractedTools,
904
+ tool_names: toolNames,
905
+ anthropic_beta: captured.headers["anthropic-beta"],
906
+ cc_version: extractCCVersion(billingHeader, captured.headers["user-agent"]),
907
+ header_order: extractHeaderOrder(captured.rawHeaders),
908
+ header_values: headerValues,
909
+ body_field_order: bodyFieldOrder.length > 0 ? bodyFieldOrder : void 0
910
+ };
911
+ }
912
+ async function captureLiveTemplateAsync(timeoutMs = DEFAULT_CAPTURE_TIMEOUT_MS) {
913
+ const binaryPath = findClaudeBinary();
914
+ if (!binaryPath) {
915
+ return null;
916
+ }
917
+ let capturedRequest = null;
918
+ const responseBody = createSseResponseBody();
919
+ const server = createServer(async (req, res) => {
920
+ try {
921
+ const bodyText = await captureRequestBody(req);
922
+ const parsedBody = JSON.parse(bodyText);
923
+ capturedRequest = {
924
+ body: parsedBody,
925
+ headers: normalizeHeaders(req),
926
+ rawHeaders: [...req.rawHeaders]
927
+ };
928
+ res.writeHead(200, {
929
+ "content-type": "text/event-stream; charset=utf-8",
930
+ "cache-control": "no-cache",
931
+ connection: "keep-alive",
932
+ "anthropic-ratelimit-unified-status": "accepted"
933
+ });
934
+ res.end(responseBody);
935
+ } catch {
936
+ res.writeHead(500, { "content-type": "application/json" });
937
+ res.end('{"error":"capture_failed"}');
938
+ }
939
+ });
940
+ try {
941
+ const address = await new Promise((resolve, reject) => {
942
+ server.once("error", reject);
943
+ server.listen(0, LOOPBACK_HOST, () => {
944
+ const resolvedAddress = server.address();
945
+ if (resolvedAddress && typeof resolvedAddress === "object") {
946
+ resolve({ port: resolvedAddress.port });
947
+ return;
948
+ }
949
+ reject(new Error("capture server failed to bind"));
950
+ });
951
+ });
952
+ const baseUrl = `http://${LOOPBACK_HOST}:${address.port}`;
953
+ await runClaudeCapture({ binaryPath, baseUrl, timeoutMs });
954
+ if (!capturedRequest) {
955
+ return null;
956
+ }
957
+ return extractTemplate(capturedRequest);
958
+ } catch {
959
+ return null;
960
+ } finally {
961
+ await new Promise((resolve) => {
962
+ server.close(() => resolve());
963
+ });
964
+ }
965
+ }
966
+ async function refreshLiveFingerprintAsync(options) {
967
+ if (!options?.force) {
968
+ const cached = readLiveCacheSync("cached");
969
+ if (cached && isUsableTemplate(cached) && isFreshTemplate(cached)) {
970
+ return cached;
971
+ }
972
+ }
973
+ if (!findClaudeBinary()) {
974
+ return null;
975
+ }
976
+ try {
977
+ const live = await captureLiveTemplateAsync(options?.timeoutMs ?? DEFAULT_CAPTURE_TIMEOUT_MS);
978
+ if (!live) {
979
+ return null;
980
+ }
981
+ const scrubbed = scrubTemplate(live, { dropMcpTools: false });
982
+ await writeLiveCache(scrubbed);
983
+ return scrubbed;
984
+ } catch {
985
+ return null;
986
+ }
987
+ }
988
+ function parseVersion(version) {
989
+ const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
990
+ if (!match) {
991
+ return null;
992
+ }
993
+ return [Number(match[1]), Number(match[2]), Number(match[3])];
994
+ }
995
+ function compareVersions(left, right) {
996
+ const leftVersion = parseVersion(left);
997
+ const rightVersion = parseVersion(right);
998
+ if (!leftVersion || !rightVersion) {
999
+ return null;
1000
+ }
1001
+ for (let index = 0; index < leftVersion.length; index += 1) {
1002
+ const leftPart = leftVersion[index] ?? 0;
1003
+ const rightPart = rightVersion[index] ?? 0;
1004
+ const diff = leftPart - rightPart;
1005
+ if (diff !== 0) {
1006
+ return diff;
1007
+ }
1008
+ }
1009
+ return 0;
1010
+ }
1011
+ function detectDrift(template, installedOverride) {
1012
+ const cachedVersion = template.cc_version ?? null;
1013
+ const installedVersion = installedOverride ?? probeInstalledCCVersion();
1014
+ if (!cachedVersion) {
1015
+ return {
1016
+ drifted: false,
1017
+ cachedVersion: null,
1018
+ installedVersion,
1019
+ message: "template version unavailable"
1020
+ };
1021
+ }
1022
+ if (!installedVersion) {
1023
+ return {
1024
+ drifted: false,
1025
+ cachedVersion,
1026
+ installedVersion: null,
1027
+ message: "probe failed"
1028
+ };
1029
+ }
1030
+ if (installedVersion === cachedVersion) {
1031
+ return {
1032
+ drifted: false,
1033
+ cachedVersion,
1034
+ installedVersion,
1035
+ message: `cache v${cachedVersion} matches installed v${installedVersion}`
1036
+ };
1037
+ }
1038
+ return {
1039
+ drifted: true,
1040
+ cachedVersion,
1041
+ installedVersion,
1042
+ message: `cache v${cachedVersion} != installed v${installedVersion}`
1043
+ };
1044
+ }
1045
+ function checkCCCompat(installedOverride) {
1046
+ const installedVersion = installedOverride ?? probeInstalledCCVersion();
1047
+ if (!installedVersion) {
1048
+ return {
1049
+ status: "unknown",
1050
+ installedVersion: null,
1051
+ range: SUPPORTED_CC_RANGE,
1052
+ message: "installed Claude Code version is unknown"
1053
+ };
1054
+ }
1055
+ const minComparison = compareVersions(installedVersion, SUPPORTED_CC_RANGE.min);
1056
+ const maxComparison = compareVersions(installedVersion, SUPPORTED_CC_RANGE.maxTested);
1057
+ if (minComparison === null || maxComparison === null) {
1058
+ return {
1059
+ status: "unknown",
1060
+ installedVersion,
1061
+ range: SUPPORTED_CC_RANGE,
1062
+ message: `installed Claude Code version "${installedVersion}" is not a strict semver`
1063
+ };
1064
+ }
1065
+ if (minComparison < 0) {
1066
+ return {
1067
+ status: "below-min",
1068
+ installedVersion,
1069
+ range: SUPPORTED_CC_RANGE,
1070
+ message: `installed Claude Code v${installedVersion} is below supported minimum v${SUPPORTED_CC_RANGE.min}`
1071
+ };
1072
+ }
1073
+ if (maxComparison > 0) {
1074
+ return {
1075
+ status: "untested-above",
1076
+ installedVersion,
1077
+ range: SUPPORTED_CC_RANGE,
1078
+ message: `installed Claude Code v${installedVersion} is above max tested v${SUPPORTED_CC_RANGE.maxTested}`
1079
+ };
1080
+ }
1081
+ return {
1082
+ status: "ok",
1083
+ installedVersion,
1084
+ range: SUPPORTED_CC_RANGE,
1085
+ message: `installed Claude Code v${installedVersion} is within supported range`
1086
+ };
1087
+ }
1088
+ function setFingerprintCaptureTestOverridesForTest(overrides) {
1089
+ fingerprintCaptureTestOverrides = overrides ?? {};
1090
+ }
1091
+ function resetFingerprintCaptureForTest() {
1092
+ fingerprintCaptureTestOverrides = {};
1093
+ }
1094
+
1095
+ export {
1096
+ fingerprint_data_default,
1097
+ detectCliVersion,
1098
+ cc_derived_defaults_default,
1099
+ ANTHROPIC_OAUTH_ADAPTER,
1100
+ ANTHROPIC_USAGE_ENDPOINT,
1101
+ ANTHROPIC_PROFILE_ENDPOINT,
1102
+ ACCOUNTS_FILENAME,
1103
+ CLAIMS_FILENAME,
1104
+ PLAN_LABELS,
1105
+ TOKEN_EXPIRY_BUFFER_MS,
1106
+ TOKEN_REFRESH_TIMEOUT_MS,
1107
+ getConfig,
1108
+ loadConfig,
1109
+ updateConfigField,
1110
+ showToast,
1111
+ debugLog,
1112
+ createMinimalClient,
1113
+ formatWaitTime,
1114
+ getAccountLabel,
1115
+ getConfigDir,
1116
+ sleep,
1117
+ detectOAuthConfig,
1118
+ LIVE_TTL_MS,
1119
+ SUPPORTED_CC_RANGE,
1120
+ prepareBundledTemplate,
1121
+ loadTemplate,
1122
+ extractTemplate,
1123
+ captureLiveTemplateAsync,
1124
+ refreshLiveFingerprintAsync,
1125
+ detectDrift,
1126
+ checkCCCompat,
1127
+ setFingerprintCaptureTestOverridesForTest,
1128
+ resetFingerprintCaptureForTest
1129
+ };
1130
+ //# sourceMappingURL=chunk-RVXWLAVK.js.map