flavor-code 1.2.6 → 1.2.8

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.
@@ -15,8 +15,8 @@ import {
15
15
  packageVersion,
16
16
  redactErrorText,
17
17
  transcriptReducer
18
- } from "./chunk-RYDCJHXW.js";
19
- import "./chunk-HFR2WS6T.js";
18
+ } from "./chunk-ED4R7ZCP.js";
19
+ import "./chunk-MBLAXTUP.js";
20
20
  import {
21
21
  Box_default,
22
22
  ClockContext,
@@ -4,7 +4,7 @@ import {
4
4
  message,
5
5
  redactErrorText,
6
6
  redactSecrets
7
- } from "./chunk-RYDCJHXW.js";
7
+ } from "./chunk-ED4R7ZCP.js";
8
8
 
9
9
  // src/rpc/server.ts
10
10
  import { createInterface } from "readline";
@@ -12,7 +12,7 @@ import {
12
12
  redactConfig,
13
13
  setProjectMcpServerDisabled,
14
14
  updateProtectedFile
15
- } from "./chunk-HFR2WS6T.js";
15
+ } from "./chunk-MBLAXTUP.js";
16
16
  import {
17
17
  AuditLogger,
18
18
  appendUsageLog,
@@ -7335,6 +7335,10 @@ function normalizeToolCallInput(input, maxDepth = 3) {
7335
7335
  }
7336
7336
 
7337
7337
  // src/models/anthropic.ts
7338
+ var CLAUDE_CLIENT_HEADERS = {
7339
+ "User-Agent": "claude-cli/2.1.0 (external, cli)",
7340
+ "x-app": "cli"
7341
+ };
7338
7342
  var DEFAULT_MAX_OUTPUT_TOKENS = 32768;
7339
7343
  var MAX_CACHE_MARKERS = 4;
7340
7344
  function collectCacheMarkers(system, messages) {
@@ -7407,7 +7411,8 @@ var AnthropicModelAdapter = class {
7407
7411
  this.debugUsage = options.debugUsage ?? isEnvTruthy(process.env.FLAVOR_DEBUG_USAGE);
7408
7412
  this.client = options.client ?? new Anthropic({
7409
7413
  ...options.apiKey === void 0 ? {} : { apiKey: options.apiKey },
7410
- ...options.baseURL === void 0 ? {} : { baseURL: options.baseURL }
7414
+ ...options.baseURL === void 0 ? {} : { baseURL: options.baseURL },
7415
+ ...options.headers === void 0 ? {} : { defaultHeaders: options.headers }
7411
7416
  });
7412
7417
  }
7413
7418
  #logUsage(request, snapshot2, shape) {
@@ -13918,9 +13923,17 @@ async function createProductionRuntime(options) {
13918
13923
  const home = resolve21(options.home ?? homedir());
13919
13924
  const environment = options.environment ?? process.env;
13920
13925
  const ide = new FlavorIdeClient({ workspace, home, environment });
13926
+ const ideReady = ide.initialize();
13927
+ const gitRepository = detectGitRepository(workspace);
13921
13928
  const loaded = await loadConfig({ cwd: workspace, home, environment });
13922
- await ide.initialize();
13923
13929
  const config = loaded.config;
13930
+ const mcpReady = connectMcpServers({
13931
+ servers: config.mcpServers,
13932
+ workspace,
13933
+ clientFactory: options.mcpClientFactory ?? connectSdkMcpClient
13934
+ });
13935
+ mcpReady.catch(() => void 0);
13936
+ let mcpDiscarded = false;
13924
13937
  const sessionStore = new SessionStore({ workspace, maxSessions: config.maxSessions });
13925
13938
  const memoryStore = config.memory.enabled ? new MemoryStore({
13926
13939
  workspace,
@@ -14148,12 +14161,6 @@ async function createProductionRuntime(options) {
14148
14161
  await pluginHost.loadAll();
14149
14162
  let sleepScheduler;
14150
14163
  try {
14151
- mcpManager = await connectMcpServers({
14152
- servers: config.mcpServers,
14153
- workspace,
14154
- clientFactory: options.mcpClientFactory ?? connectSdkMcpClient
14155
- });
14156
- diagnostics.push(...mcpManager.diagnostics);
14157
14164
  const syncMcpTools = () => {
14158
14165
  for (const tool of mcpTools) remove(tools, tool);
14159
14166
  mcpTools.length = 0;
@@ -14168,14 +14175,25 @@ async function createProductionRuntime(options) {
14168
14175
  }
14169
14176
  if (harnessCreated) harness.replaceMainTools(tools);
14170
14177
  };
14171
- syncMcpTools();
14178
+ void mcpReady.then((manager) => {
14179
+ if (mcpDiscarded) {
14180
+ void manager.close().catch(() => void 0);
14181
+ return;
14182
+ }
14183
+ mcpManager = manager;
14184
+ diagnostics.push(...manager.diagnostics);
14185
+ syncMcpTools();
14186
+ }, (error) => {
14187
+ diagnostics.push(`MCP servers could not start: ${message(error)}`);
14188
+ });
14172
14189
  const skills = new SkillRegistry({
14173
14190
  globalRoots: [join17(home, ".flavor-code", "skills")],
14174
14191
  projectRoots: [join17(workspace, ".flavor", "skills"), ...pluginSkillRoots],
14175
14192
  authorizeResource: async () => true,
14176
14193
  disabledNames: config.skills.disabled
14177
14194
  });
14178
- await skills.discover();
14195
+ const skillsReady = skills.discover();
14196
+ skillsReady.catch(() => void 0);
14179
14197
  tools.push(createSkillResourceTool(skills));
14180
14198
  const flavor = await optionalText2(join17(workspace, "FLAVOR.md"));
14181
14199
  let memoryContext;
@@ -14203,6 +14221,7 @@ async function createProductionRuntime(options) {
14203
14221
  let sessionId = recovered?.sessionId ?? `session-${(/* @__PURE__ */ new Date()).toISOString().replace(/[^0-9]/g, "").slice(0, 17)}-${randomUUID10().slice(0, 8)}`;
14204
14222
  setUsageSession(sessionId);
14205
14223
  ideSessionId = sessionId;
14224
+ await ideReady;
14206
14225
  await ide.startSession(sessionId);
14207
14226
  let createdAt = recovered?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
14208
14227
  let memoryLifecycle = recovered?.memory ?? { status: "active", taskId: createMemoryTaskId(), messageStart: 0 };
@@ -14332,7 +14351,7 @@ async function createProductionRuntime(options) {
14332
14351
  platform: process.platform,
14333
14352
  osVersion: `${osVersion()} ${osRelease()}`,
14334
14353
  shell: environment.ComSpec ?? environment.SHELL ?? "unknown",
14335
- isGitRepository: await detectGitRepository(workspace)
14354
+ isGitRepository: await gitRepository
14336
14355
  });
14337
14356
  const createContext = (agent, agentTools, contextModelId, parentContext) => {
14338
14357
  const taskState = serializedTaskState();
@@ -14392,6 +14411,7 @@ async function createProductionRuntime(options) {
14392
14411
  showWarnings: config.hallucination.showWarnings,
14393
14412
  evaluationTimeoutMs: config.hallucination.evaluationTimeoutMs
14394
14413
  });
14414
+ await skillsReady;
14395
14415
  harness = new LocalHarness({
14396
14416
  registry,
14397
14417
  hooks,
@@ -14819,7 +14839,7 @@ async function createProductionRuntime(options) {
14819
14839
  runGoal: (goal, signal) => persistEach(runGoalSession(goalOrchestrator, goal, signal), persist),
14820
14840
  mcp: async (command, signal) => {
14821
14841
  signal.throwIfAborted();
14822
- const manager = mcpManager;
14842
+ const manager = await mcpReady;
14823
14843
  if (command.action === "status") return redactSecrets(formatMcpStatus(manager), secrets);
14824
14844
  if (command.action === "tools") return redactSecrets(formatMcpTools(manager, command.target), secrets);
14825
14845
  if (command.action === "reconnect") {
@@ -15072,7 +15092,10 @@ ${renderMemoryDocument(entries)}`;
15072
15092
  baseURL: next.baseURL,
15073
15093
  ...next.maxOutputTokens === void 0 ? {} : { maxOutputTokens: next.maxOutputTokens }
15074
15094
  };
15075
- registry.register(next.providerId, next.apiType === "anthropic" ? new AnthropicModelAdapter(adapterOptions) : new OpenAIModelAdapter(adapterOptions));
15095
+ registry.register(next.providerId, next.apiType === "anthropic" ? new AnthropicModelAdapter({
15096
+ ...adapterOptions,
15097
+ ...providerConfig?.claudeClient === true ? { headers: CLAUDE_CLIENT_HEADERS } : {}
15098
+ }) : new OpenAIModelAdapter(adapterOptions));
15076
15099
  effectiveLlm = next;
15077
15100
  mainModel = `${next.providerId}:${next.defaultModel}`;
15078
15101
  childModel = `${next.providerId}:${next.cheapModel}`;
@@ -15128,6 +15151,7 @@ ${renderMemoryDocument(entries)}`;
15128
15151
  async dispose() {
15129
15152
  if (disposed) return;
15130
15153
  disposed = true;
15154
+ mcpDiscarded = true;
15131
15155
  await sleepScheduler?.dispose();
15132
15156
  await memoryCoordinator?.flush();
15133
15157
  await persist();
@@ -15140,6 +15164,7 @@ ${renderMemoryDocument(entries)}`;
15140
15164
  }
15141
15165
  };
15142
15166
  } catch (primaryError) {
15167
+ mcpDiscarded = true;
15143
15168
  memoryReviews.dispose();
15144
15169
  try {
15145
15170
  if (ideSessionId !== void 0) await ide.endSession(ideSessionId);
@@ -15478,7 +15503,10 @@ async function registerConfiguredAdapters(providers, registry, environment, diag
15478
15503
  ...runtimeProvider.baseURL === void 0 ? {} : { baseURL: runtimeProvider.baseURL },
15479
15504
  ...runtimeProvider.maxOutputTokens === void 0 ? {} : { maxOutputTokens: runtimeProvider.maxOutputTokens }
15480
15505
  };
15481
- const adapter = apiProtocol === "anthropic" ? new AnthropicModelAdapter(adapterOptions) : new OpenAIModelAdapter(adapterOptions);
15506
+ const adapter = apiProtocol === "anthropic" ? new AnthropicModelAdapter({
15507
+ ...adapterOptions,
15508
+ ...runtimeProvider.claudeClient === true ? { headers: CLAUDE_CLIENT_HEADERS } : {}
15509
+ }) : new OpenAIModelAdapter(adapterOptions);
15482
15510
  const cacheProfile = resolveCacheProfile({ apiType: apiProtocol, baseURL: runtimeProvider.baseURL });
15483
15511
  if (apiProtocol === "openai" && isDashScopeBaseURL(runtimeProvider.baseURL)) {
15484
15512
  diagnostics.push(
@@ -33,6 +33,9 @@ var ProviderConfigSchema = z.object({
33
33
  cheapModel: z.string().min(1).optional(),
34
34
  models: z.array(z.string().min(1)).max(100).optional(),
35
35
  maxOutputTokens: z.number().int().positive().optional(),
36
+ // Send the Claude Code client fingerprint (User-Agent/x-app) with Anthropic requests,
37
+ // for gateways that restrict the Anthropic protocol to Claude clients.
38
+ claudeClient: z.boolean().optional(),
36
39
  // OAuth PKCE fields
37
40
  apiType: z.enum(["openai", "anthropic"]).optional(),
38
41
  authorizationUrl: z.string().url().optional(),
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module"; const require = createRequire(impor
3
3
  import {
4
4
  FlavorRpcServer,
5
5
  TraceRecorder
6
- } from "./chunk-CXSXBPD6.js";
6
+ } from "./chunk-6X5PHLZI.js";
7
7
  import {
8
8
  staticTaskLines
9
9
  } from "./chunk-KKIBYDJI.js";
@@ -20,7 +20,7 @@ import {
20
20
  message,
21
21
  packageVersion,
22
22
  redactErrorText
23
- } from "./chunk-RYDCJHXW.js";
23
+ } from "./chunk-ED4R7ZCP.js";
24
24
  import {
25
25
  McpServerConfigSchema,
26
26
  McpServerNameSchema,
@@ -29,7 +29,7 @@ import {
29
29
  readRecoverableFile,
30
30
  setProjectSkillDisabled,
31
31
  updateProtectedFile
32
- } from "./chunk-HFR2WS6T.js";
32
+ } from "./chunk-MBLAXTUP.js";
33
33
  import "./chunk-N2S7USST.js";
34
34
  import "./chunk-S32JRDZK.js";
35
35
 
@@ -669,7 +669,7 @@ async function runEvaluationFile(path, outputPath) {
669
669
  })),
670
670
  ...parsed.maxTokens === void 0 ? {} : { maxTokens: parsed.maxTokens }
671
671
  };
672
- const configured = await import("./load-XC5JYYBQ.js").then(({ loadConfig: loadConfig2 }) => loadConfig2({ cwd: workspace, home: process.env.USERPROFILE ?? process.env.HOME ?? workspace }));
672
+ const configured = await import("./load-RN3WBX4C.js").then(({ loadConfig: loadConfig2 }) => loadConfig2({ cwd: workspace, home: process.env.USERPROFILE ?? process.env.HOME ?? workspace }));
673
673
  const environment = createExecutionEnvironment(workspace, configured.config.execution) ?? new LocalExecutionEnvironment();
674
674
  let report;
675
675
  try {
@@ -771,7 +771,7 @@ function createProgram() {
771
771
  const [{ render, AlternateScreen }, { createElement }, { App }] = await Promise.all([
772
772
  import("./claude-ink-WPWPEL5A.js"),
773
773
  import("react"),
774
- import("./app-WRTEXGA6.js")
774
+ import("./app-NL2O75LQ.js")
775
775
  ]);
776
776
  const instance = await render(createElement(
777
777
  AlternateScreen,
@@ -19,6 +19,7 @@ export declare const ProviderConfigSchema: z.ZodObject<{
19
19
  cheapModel: z.ZodOptional<z.ZodString>;
20
20
  models: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
21
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
22
+ claudeClient: z.ZodOptional<z.ZodBoolean>;
22
23
  apiType: z.ZodOptional<z.ZodEnum<{
23
24
  anthropic: "anthropic";
24
25
  openai: "openai";
@@ -67,6 +68,7 @@ export declare const FlavorConfigSchema: z.ZodObject<{
67
68
  cheapModel: z.ZodOptional<z.ZodString>;
68
69
  models: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
70
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
71
+ claudeClient: z.ZodOptional<z.ZodBoolean>;
70
72
  apiType: z.ZodOptional<z.ZodEnum<{
71
73
  anthropic: "anthropic";
72
74
  openai: "openai";
@@ -35,6 +35,9 @@ var ProviderConfigSchema = z.object({
35
35
  cheapModel: z.string().min(1).optional(),
36
36
  models: z.array(z.string().min(1)).max(100).optional(),
37
37
  maxOutputTokens: z.number().int().positive().optional(),
38
+ // Send the Claude Code client fingerprint (User-Agent/x-app) with Anthropic requests,
39
+ // for gateways that restrict the Anthropic protocol to Claude clients.
40
+ claudeClient: z.boolean().optional(),
38
41
  // OAuth PKCE fields
39
42
  apiType: z.enum(["openai", "anthropic"]).optional(),
40
43
  authorizationUrl: z.string().url().optional(),
@@ -6336,6 +6339,10 @@ var AuditLogger = class {
6336
6339
  };
6337
6340
 
6338
6341
  // src/models/anthropic.ts
6342
+ var CLAUDE_CLIENT_HEADERS = {
6343
+ "User-Agent": "claude-cli/2.1.0 (external, cli)",
6344
+ "x-app": "cli"
6345
+ };
6339
6346
  var DEFAULT_MAX_OUTPUT_TOKENS = 32768;
6340
6347
  var MAX_CACHE_MARKERS = 4;
6341
6348
  function collectCacheMarkers(system, messages) {
@@ -6408,7 +6415,8 @@ var AnthropicModelAdapter = class {
6408
6415
  this.debugUsage = options.debugUsage ?? isEnvTruthy(process.env.FLAVOR_DEBUG_USAGE);
6409
6416
  this.client = options.client ?? new Anthropic({
6410
6417
  ...options.apiKey === void 0 ? {} : { apiKey: options.apiKey },
6411
- ...options.baseURL === void 0 ? {} : { baseURL: options.baseURL }
6418
+ ...options.baseURL === void 0 ? {} : { baseURL: options.baseURL },
6419
+ ...options.headers === void 0 ? {} : { defaultHeaders: options.headers }
6412
6420
  });
6413
6421
  }
6414
6422
  #logUsage(request, snapshot2, shape) {
@@ -14914,9 +14922,17 @@ async function createProductionRuntime(options) {
14914
14922
  const home = resolve23(options.home ?? homedir());
14915
14923
  const environment = options.environment ?? process.env;
14916
14924
  const ide = new FlavorIdeClient({ workspace, home, environment });
14925
+ const ideReady = ide.initialize();
14926
+ const gitRepository = detectGitRepository(workspace);
14917
14927
  const loaded = await loadConfig({ cwd: workspace, home, environment });
14918
- await ide.initialize();
14919
14928
  const config = loaded.config;
14929
+ const mcpReady = connectMcpServers({
14930
+ servers: config.mcpServers,
14931
+ workspace,
14932
+ clientFactory: options.mcpClientFactory ?? connectSdkMcpClient
14933
+ });
14934
+ mcpReady.catch(() => void 0);
14935
+ let mcpDiscarded = false;
14920
14936
  const sessionStore = new SessionStore({ workspace, maxSessions: config.maxSessions });
14921
14937
  const memoryStore = config.memory.enabled ? new MemoryStore({
14922
14938
  workspace,
@@ -15144,12 +15160,6 @@ async function createProductionRuntime(options) {
15144
15160
  await pluginHost.loadAll();
15145
15161
  let sleepScheduler;
15146
15162
  try {
15147
- mcpManager = await connectMcpServers({
15148
- servers: config.mcpServers,
15149
- workspace,
15150
- clientFactory: options.mcpClientFactory ?? connectSdkMcpClient
15151
- });
15152
- diagnostics.push(...mcpManager.diagnostics);
15153
15163
  const syncMcpTools = () => {
15154
15164
  for (const tool of mcpTools) remove(tools, tool);
15155
15165
  mcpTools.length = 0;
@@ -15164,14 +15174,25 @@ async function createProductionRuntime(options) {
15164
15174
  }
15165
15175
  if (harnessCreated) harness.replaceMainTools(tools);
15166
15176
  };
15167
- syncMcpTools();
15177
+ void mcpReady.then((manager) => {
15178
+ if (mcpDiscarded) {
15179
+ void manager.close().catch(() => void 0);
15180
+ return;
15181
+ }
15182
+ mcpManager = manager;
15183
+ diagnostics.push(...manager.diagnostics);
15184
+ syncMcpTools();
15185
+ }, (error) => {
15186
+ diagnostics.push(`MCP servers could not start: ${message(error)}`);
15187
+ });
15168
15188
  const skills = new SkillRegistry({
15169
15189
  globalRoots: [join21(home, ".flavor-code", "skills")],
15170
15190
  projectRoots: [join21(workspace, ".flavor", "skills"), ...pluginSkillRoots],
15171
15191
  authorizeResource: async () => true,
15172
15192
  disabledNames: config.skills.disabled
15173
15193
  });
15174
- await skills.discover();
15194
+ const skillsReady = skills.discover();
15195
+ skillsReady.catch(() => void 0);
15175
15196
  tools.push(createSkillResourceTool(skills));
15176
15197
  const flavor = await optionalText2(join21(workspace, "FLAVOR.md"));
15177
15198
  let memoryContext;
@@ -15199,6 +15220,7 @@ async function createProductionRuntime(options) {
15199
15220
  let sessionId = recovered?.sessionId ?? `session-${(/* @__PURE__ */ new Date()).toISOString().replace(/[^0-9]/g, "").slice(0, 17)}-${randomUUID12().slice(0, 8)}`;
15200
15221
  setUsageSession(sessionId);
15201
15222
  ideSessionId = sessionId;
15223
+ await ideReady;
15202
15224
  await ide.startSession(sessionId);
15203
15225
  let createdAt = recovered?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
15204
15226
  let memoryLifecycle = recovered?.memory ?? { status: "active", taskId: createMemoryTaskId(), messageStart: 0 };
@@ -15328,7 +15350,7 @@ async function createProductionRuntime(options) {
15328
15350
  platform: process.platform,
15329
15351
  osVersion: `${osVersion()} ${osRelease()}`,
15330
15352
  shell: environment.ComSpec ?? environment.SHELL ?? "unknown",
15331
- isGitRepository: await detectGitRepository(workspace)
15353
+ isGitRepository: await gitRepository
15332
15354
  });
15333
15355
  const createContext = (agent, agentTools, contextModelId, parentContext) => {
15334
15356
  const taskState = serializedTaskState();
@@ -15388,6 +15410,7 @@ async function createProductionRuntime(options) {
15388
15410
  showWarnings: config.hallucination.showWarnings,
15389
15411
  evaluationTimeoutMs: config.hallucination.evaluationTimeoutMs
15390
15412
  });
15413
+ await skillsReady;
15391
15414
  harness = new LocalHarness({
15392
15415
  registry,
15393
15416
  hooks,
@@ -15815,7 +15838,7 @@ async function createProductionRuntime(options) {
15815
15838
  runGoal: (goal, signal) => persistEach(runGoalSession(goalOrchestrator, goal, signal), persist),
15816
15839
  mcp: async (command, signal) => {
15817
15840
  signal.throwIfAborted();
15818
- const manager = mcpManager;
15841
+ const manager = await mcpReady;
15819
15842
  if (command.action === "status") return redactSecrets(formatMcpStatus(manager), secrets);
15820
15843
  if (command.action === "tools") return redactSecrets(formatMcpTools(manager, command.target), secrets);
15821
15844
  if (command.action === "reconnect") {
@@ -16068,7 +16091,10 @@ ${renderMemoryDocument(entries)}`;
16068
16091
  baseURL: next.baseURL,
16069
16092
  ...next.maxOutputTokens === void 0 ? {} : { maxOutputTokens: next.maxOutputTokens }
16070
16093
  };
16071
- registry.register(next.providerId, next.apiType === "anthropic" ? new AnthropicModelAdapter(adapterOptions) : new OpenAIModelAdapter(adapterOptions));
16094
+ registry.register(next.providerId, next.apiType === "anthropic" ? new AnthropicModelAdapter({
16095
+ ...adapterOptions,
16096
+ ...providerConfig?.claudeClient === true ? { headers: CLAUDE_CLIENT_HEADERS } : {}
16097
+ }) : new OpenAIModelAdapter(adapterOptions));
16072
16098
  effectiveLlm = next;
16073
16099
  mainModel = `${next.providerId}:${next.defaultModel}`;
16074
16100
  childModel = `${next.providerId}:${next.cheapModel}`;
@@ -16124,6 +16150,7 @@ ${renderMemoryDocument(entries)}`;
16124
16150
  async dispose() {
16125
16151
  if (disposed) return;
16126
16152
  disposed = true;
16153
+ mcpDiscarded = true;
16127
16154
  await sleepScheduler?.dispose();
16128
16155
  await memoryCoordinator?.flush();
16129
16156
  await persist();
@@ -16136,6 +16163,7 @@ ${renderMemoryDocument(entries)}`;
16136
16163
  }
16137
16164
  };
16138
16165
  } catch (primaryError) {
16166
+ mcpDiscarded = true;
16139
16167
  memoryReviews.dispose();
16140
16168
  try {
16141
16169
  if (ideSessionId !== void 0) await ide.endSession(ideSessionId);
@@ -16474,7 +16502,10 @@ async function registerConfiguredAdapters(providers, registry, environment, diag
16474
16502
  ...runtimeProvider.baseURL === void 0 ? {} : { baseURL: runtimeProvider.baseURL },
16475
16503
  ...runtimeProvider.maxOutputTokens === void 0 ? {} : { maxOutputTokens: runtimeProvider.maxOutputTokens }
16476
16504
  };
16477
- const adapter = apiProtocol === "anthropic" ? new AnthropicModelAdapter(adapterOptions) : new OpenAIModelAdapter(adapterOptions);
16505
+ const adapter = apiProtocol === "anthropic" ? new AnthropicModelAdapter({
16506
+ ...adapterOptions,
16507
+ ...runtimeProvider.claudeClient === true ? { headers: CLAUDE_CLIENT_HEADERS } : {}
16508
+ }) : new OpenAIModelAdapter(adapterOptions);
16478
16509
  const cacheProfile = resolveCacheProfile({ apiType: apiProtocol, baseURL: runtimeProvider.baseURL });
16479
16510
  if (apiProtocol === "openai" && isDashScopeBaseURL(runtimeProvider.baseURL)) {
16480
16511
  diagnostics.push(