chatccc 0.2.246 → 0.2.248

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.
@@ -107,6 +107,7 @@ describe("unflattenConfig", () => {
107
107
  CHATCCC_CCC_MODEL: "deepseek-v4-flash",
108
108
  CHATCCC_CCC_ALTERNATIVE_MODEL: "deepseek-v4-pro",
109
109
  CHATCCC_CCC_EFFORT: "max",
110
+ CHATCCC_CCC_PROVIDER: "anthropic",
110
111
  }),
111
112
  ).toEqual({
112
113
  ccc: {
@@ -117,6 +118,7 @@ describe("unflattenConfig", () => {
117
118
  model: "deepseek-v4-flash",
118
119
  alternativeModel: "deepseek-v4-pro",
119
120
  effort: "max",
121
+ provider: "anthropic",
120
122
  },
121
123
  });
122
124
  });
@@ -66,21 +66,21 @@ export interface UnifiedSearchResultBlock {
66
66
  query: string;
67
67
  }
68
68
 
69
- export interface UnifiedCompactBoundaryBlock {
70
- type: "compact_boundary";
71
- trigger: "manual" | "auto";
72
- pre_tokens: number;
73
- post_tokens?: number;
74
- }
75
-
76
- export interface UnifiedAgentStatusBlock {
77
- type: "agent_status";
78
- status: "compacting" | "responding";
79
- }
80
-
81
- export type UnifiedBlock =
82
- | UnifiedAgentStatusBlock
83
- | UnifiedThinkingBlock
69
+ export interface UnifiedCompactBoundaryBlock {
70
+ type: "compact_boundary";
71
+ trigger: "manual" | "auto";
72
+ pre_tokens: number;
73
+ post_tokens?: number;
74
+ }
75
+
76
+ export interface UnifiedAgentStatusBlock {
77
+ type: "agent_status";
78
+ status: "compacting" | "responding";
79
+ }
80
+
81
+ export type UnifiedBlock =
82
+ | UnifiedAgentStatusBlock
83
+ | UnifiedThinkingBlock
84
84
  | UnifiedTextBlock
85
85
  | UnifiedTextFinalBlock
86
86
  | UnifiedToolUseBlock
@@ -93,17 +93,17 @@ export type UnifiedBlock =
93
93
  // UnifiedStreamMessage — 一次 SDK/CLI 事件对应的归一化消息
94
94
  // ---------------------------------------------------------------------------
95
95
 
96
- export interface UnifiedStreamMessage {
97
- type: "assistant" | "user" | "system";
98
- blocks: UnifiedBlock[];
99
- /**
100
- * 适配器确认本事件代表一条完整、权威的最终回复,而不是流式文本片段。
101
- *
102
- * response-stall 终止与最终事件可能在同一事件循环边界竞态;只有该标记
103
- * 为 true 时,上层才允许把已经触发的超时改判为正常完成。
104
- */
105
- isFinalResponse?: boolean;
106
- }
96
+ export interface UnifiedStreamMessage {
97
+ type: "assistant" | "user" | "system";
98
+ blocks: UnifiedBlock[];
99
+ /**
100
+ * 适配器确认本事件代表一条完整、权威的最终回复,而不是流式文本片段。
101
+ *
102
+ * response-stall 终止与最终事件可能在同一事件循环边界竞态;只有该标记
103
+ * 为 true 时,上层才允许把已经触发的超时改判为正常完成。
104
+ */
105
+ isFinalResponse?: boolean;
106
+ }
107
107
 
108
108
  // ---------------------------------------------------------------------------
109
109
  // CreateSessionResult
@@ -151,25 +151,25 @@ export interface ToolPromptOptions {
151
151
  // ToolAdapter — 统一的 AI 工具适配器接口
152
152
  // ---------------------------------------------------------------------------
153
153
 
154
- export interface ToolAdapter {
154
+ export interface ToolAdapter {
155
155
  /** 日志/展示用名称,如 "Claude" */
156
156
  readonly displayName: string;
157
157
 
158
158
  /** 群描述中会话 ID 的前缀,如 "Claude Session:" */
159
- readonly sessionDescPrefix: string;
160
-
161
- /**
162
- * Whether ChatCCC may infer a stalled response from unchanged streamed output.
163
- * Defaults to true. Adapters that only emit output after a request completes must disable it.
164
- */
165
- readonly responseStallDetectionEnabled?: boolean;
166
-
167
- /**
168
- * 创建新会话,返回会话 ID。
169
- * 适配器内部需处理后台流消费(静默消费 stream 中除 init 外的所有事件)。
170
- * signal 用于上层在长期收不到 init 事件时终止底层 SDK/CLI。
171
- */
172
- createSession(cwd: string, signal?: AbortSignal): Promise<CreateSessionResult>;
159
+ readonly sessionDescPrefix: string;
160
+
161
+ /**
162
+ * Whether ChatCCC may infer a stalled response from unchanged streamed output.
163
+ * Defaults to true. Adapters that only emit output after a request completes must disable it.
164
+ */
165
+ readonly responseStallDetectionEnabled?: boolean;
166
+
167
+ /**
168
+ * 创建新会话,返回会话 ID。
169
+ * 适配器内部需处理后台流消费(静默消费 stream 中除 init 外的所有事件)。
170
+ * signal 用于上层在长期收不到 init 事件时终止底层 SDK/CLI。
171
+ */
172
+ createSession(cwd: string, signal?: AbortSignal): Promise<CreateSessionResult>;
173
173
 
174
174
  /**
175
175
  * 向已有会话发送提示文本,返回归一化消息的异步迭代器。
@@ -214,4 +214,4 @@ export function parseUserCommand(userText: string): UserCommand {
214
214
  if (original.startsWith("/plan")) return { original, mode: "plan" };
215
215
  if (original.startsWith("/ask")) return { original, mode: "ask" };
216
216
  return { original, mode: null };
217
- }
217
+ }
@@ -1,150 +1,150 @@
1
- import { ChatSession, type ChatSessionConfig, type ChatSessionOptions } from "../../deepccc-agent/src/index.ts";
2
- import { config as deepCccConfig } from "../../deepccc-agent/src/config.ts";
3
- import {
4
- getBuiltinContextSession,
5
- newBuiltinSessionId,
6
- normalizeBuiltinSessionId,
7
- } from "../../deepccc-agent/src/context.ts";
8
- import { config, CCC_SESSION_PREFIX } from "../config.ts";
9
- import type {
10
- CreateSessionResult,
11
- SessionInfo,
12
- ToolAdapter,
13
- ToolPromptOptions,
14
- UnifiedStreamMessage,
15
- } from "./adapter-interface.ts";
16
-
17
- export interface CccAdapterOptions extends ChatSessionConfig {
18
- contextDir?: string;
19
- compactAtTokens?: number;
20
- keepRecentMessages?: number;
21
- compactionTimeoutMs?: number;
22
- maxSteps?: number;
23
- }
24
-
25
- function toChatSessionOptions(
26
- sessionId: string,
27
- cwd: string,
28
- options: CccAdapterOptions,
29
- ): ChatSessionOptions {
30
- return {
31
- cwd,
32
- persist: true,
33
- sessionId,
34
- contextDir: options.contextDir,
35
- compactAtTokens: options.compactAtTokens,
36
- keepRecentMessages: options.keepRecentMessages,
37
- compactionTimeoutMs: options.compactionTimeoutMs,
38
- maxSteps: options.maxSteps,
39
- // chatccc 无终端可交互,且对齐 claude/codex 适配器的 bypass 模式:
40
- // 高危命令不询问,全部放行(与独立 deepccc CLI 的 ask 模式不同)
41
- permissionMode: "bypass",
42
- };
43
- }
44
-
45
- export function createCccAdapter(options: CccAdapterOptions = {}): ToolAdapter {
46
- if (!options.apiKey?.trim()) {
47
- throw new Error("ChatCCC 未配置 CCC Agent API Key。请先填写 ccc.DEEPSEEK_API_KEY 后再启用 CCC Agent。");
48
- }
49
-
50
- const chatConfig: ChatSessionConfig = {
51
- apiKey: options.apiKey,
52
- ...(options.provider !== undefined ? { provider: options.provider } : {}),
53
- ...(options.baseURL !== undefined ? { baseURL: options.baseURL } : {}),
54
- ...(options.model !== undefined ? { model: options.model } : {}),
55
- ...(options.effort !== undefined ? { effort: options.effort } : {}),
56
- };
57
-
58
- return {
59
- displayName: "CCC Agent",
60
- sessionDescPrefix: CCC_SESSION_PREFIX,
61
- // Non-streaming DeepCCC emits its reply only after the provider request finishes,
62
- // so unchanged output cannot distinguish a slow request from a stalled response.
63
- responseStallDetectionEnabled: deepCccConfig.streaming,
64
-
65
- async createSession(cwd: string): Promise<CreateSessionResult> {
66
- const sessionId = newBuiltinSessionId();
67
- const session = new ChatSession(
68
- chatConfig,
69
- toChatSessionOptions(sessionId, cwd, options),
70
- );
71
- session.reset();
72
- return { sessionId };
73
- },
74
-
75
- async *prompt(
76
- sessionId: string,
77
- userText: string,
78
- cwd: string,
79
- signal?: AbortSignal,
80
- _promptOptions?: ToolPromptOptions,
81
- ): AsyncIterable<UnifiedStreamMessage> {
82
- const normalizedSessionId = normalizeBuiltinSessionId(sessionId);
83
- const session = new ChatSession(
84
- chatConfig,
85
- toChatSessionOptions(normalizedSessionId, cwd, options),
86
- );
87
-
88
- for await (const event of session.chat(userText, signal)) {
89
- if (event.type === "status") {
90
- yield {
91
- type: "assistant",
92
- blocks: [{
93
- type: "agent_status",
94
- status: event.phase === "compacting" ? "compacting" : "responding",
95
- }],
96
- };
97
- } else if (event.type === "text") {
98
- yield {
99
- type: "assistant",
100
- blocks: [{ type: "text", text: event.text }],
101
- };
102
- } else if (event.type === "tool_use") {
103
- yield {
104
- type: "assistant",
105
- blocks: [{
106
- type: "tool_use",
107
- id: event.id,
108
- name: event.name,
109
- input: event.input,
110
- }],
111
- };
112
- } else if (event.type === "tool_result") {
113
- yield {
114
- type: "assistant",
115
- blocks: [{
116
- type: "tool_result",
117
- tool_use_id: event.tool_use_id,
118
- content: event.content,
119
- is_error: event.is_error,
120
- }],
121
- };
122
- } else if (event.type === "done" && !signal?.aborted) {
123
- yield {
124
- type: "assistant",
125
- blocks: [],
126
- isFinalResponse: true,
127
- };
128
- } else if (event.type === "error") {
129
- throw new Error(event.message);
130
- }
131
- }
132
- },
133
-
134
- async getSessionInfo(sessionId: string): Promise<SessionInfo | undefined> {
135
- const normalizedSessionId = normalizeBuiltinSessionId(sessionId);
136
- const info = getBuiltinContextSession(normalizedSessionId, options.contextDir);
137
- if (!info) return undefined;
138
- return {
139
- sessionId: info.sessionId,
140
- cwd: info.cwd,
141
- lastModified: info.updatedAt,
142
- model: options.model ?? config.ccc.model,
143
- };
144
- },
145
-
146
- async closeSession(_sessionId: string): Promise<void> {
147
- // ChatSession uses one request-scoped stream per prompt. AbortSignal handles cancellation.
148
- },
149
- };
150
- }
1
+ import { ChatSession, type ChatSessionConfig, type ChatSessionOptions } from "../../deepccc-agent/src/index.ts";
2
+ import { config as deepCccConfig } from "../../deepccc-agent/src/config.ts";
3
+ import {
4
+ getBuiltinContextSession,
5
+ newBuiltinSessionId,
6
+ normalizeBuiltinSessionId,
7
+ } from "../../deepccc-agent/src/context.ts";
8
+ import { config, CCC_SESSION_PREFIX } from "../config.ts";
9
+ import type {
10
+ CreateSessionResult,
11
+ SessionInfo,
12
+ ToolAdapter,
13
+ ToolPromptOptions,
14
+ UnifiedStreamMessage,
15
+ } from "./adapter-interface.ts";
16
+
17
+ export interface CccAdapterOptions extends ChatSessionConfig {
18
+ contextDir?: string;
19
+ compactAtTokens?: number;
20
+ keepRecentMessages?: number;
21
+ compactionTimeoutMs?: number;
22
+ maxSteps?: number;
23
+ }
24
+
25
+ function toChatSessionOptions(
26
+ sessionId: string,
27
+ cwd: string,
28
+ options: CccAdapterOptions,
29
+ ): ChatSessionOptions {
30
+ return {
31
+ cwd,
32
+ persist: true,
33
+ sessionId,
34
+ contextDir: options.contextDir,
35
+ compactAtTokens: options.compactAtTokens,
36
+ keepRecentMessages: options.keepRecentMessages,
37
+ compactionTimeoutMs: options.compactionTimeoutMs,
38
+ maxSteps: options.maxSteps,
39
+ // chatccc 无终端可交互,且对齐 claude/codex 适配器的 bypass 模式:
40
+ // 高危命令不询问,全部放行(与独立 deepccc CLI 的 ask 模式不同)
41
+ permissionMode: "bypass",
42
+ };
43
+ }
44
+
45
+ export function createCccAdapter(options: CccAdapterOptions = {}): ToolAdapter {
46
+ if (!options.apiKey?.trim()) {
47
+ throw new Error("ChatCCC 未配置 CCC Agent API Key。请先填写 ccc.DEEPSEEK_API_KEY 后再启用 CCC Agent。");
48
+ }
49
+
50
+ const chatConfig: ChatSessionConfig = {
51
+ apiKey: options.apiKey,
52
+ ...(options.provider !== undefined ? { provider: options.provider } : {}),
53
+ ...(options.baseURL !== undefined ? { baseURL: options.baseURL } : {}),
54
+ ...(options.model !== undefined ? { model: options.model } : {}),
55
+ ...(options.effort !== undefined ? { effort: options.effort } : {}),
56
+ };
57
+
58
+ return {
59
+ displayName: "CCC Agent",
60
+ sessionDescPrefix: CCC_SESSION_PREFIX,
61
+ // Non-streaming DeepCCC emits its reply only after the provider request finishes,
62
+ // so unchanged output cannot distinguish a slow request from a stalled response.
63
+ responseStallDetectionEnabled: deepCccConfig.streaming,
64
+
65
+ async createSession(cwd: string): Promise<CreateSessionResult> {
66
+ const sessionId = newBuiltinSessionId();
67
+ const session = new ChatSession(
68
+ chatConfig,
69
+ toChatSessionOptions(sessionId, cwd, options),
70
+ );
71
+ session.reset();
72
+ return { sessionId };
73
+ },
74
+
75
+ async *prompt(
76
+ sessionId: string,
77
+ userText: string,
78
+ cwd: string,
79
+ signal?: AbortSignal,
80
+ _promptOptions?: ToolPromptOptions,
81
+ ): AsyncIterable<UnifiedStreamMessage> {
82
+ const normalizedSessionId = normalizeBuiltinSessionId(sessionId);
83
+ const session = new ChatSession(
84
+ chatConfig,
85
+ toChatSessionOptions(normalizedSessionId, cwd, options),
86
+ );
87
+
88
+ for await (const event of session.chat(userText, signal)) {
89
+ if (event.type === "status") {
90
+ yield {
91
+ type: "assistant",
92
+ blocks: [{
93
+ type: "agent_status",
94
+ status: event.phase === "compacting" ? "compacting" : "responding",
95
+ }],
96
+ };
97
+ } else if (event.type === "text") {
98
+ yield {
99
+ type: "assistant",
100
+ blocks: [{ type: "text", text: event.text }],
101
+ };
102
+ } else if (event.type === "tool_use") {
103
+ yield {
104
+ type: "assistant",
105
+ blocks: [{
106
+ type: "tool_use",
107
+ id: event.id,
108
+ name: event.name,
109
+ input: event.input,
110
+ }],
111
+ };
112
+ } else if (event.type === "tool_result") {
113
+ yield {
114
+ type: "assistant",
115
+ blocks: [{
116
+ type: "tool_result",
117
+ tool_use_id: event.tool_use_id,
118
+ content: event.content,
119
+ is_error: event.is_error,
120
+ }],
121
+ };
122
+ } else if (event.type === "done" && !signal?.aborted) {
123
+ yield {
124
+ type: "assistant",
125
+ blocks: [],
126
+ isFinalResponse: true,
127
+ };
128
+ } else if (event.type === "error") {
129
+ throw new Error(event.message);
130
+ }
131
+ }
132
+ },
133
+
134
+ async getSessionInfo(sessionId: string): Promise<SessionInfo | undefined> {
135
+ const normalizedSessionId = normalizeBuiltinSessionId(sessionId);
136
+ const info = getBuiltinContextSession(normalizedSessionId, options.contextDir);
137
+ if (!info) return undefined;
138
+ return {
139
+ sessionId: info.sessionId,
140
+ cwd: info.cwd,
141
+ lastModified: info.updatedAt,
142
+ model: options.model ?? config.ccc.model,
143
+ };
144
+ },
145
+
146
+ async closeSession(_sessionId: string): Promise<void> {
147
+ // ChatSession uses one request-scoped stream per prompt. AbortSignal handles cancellation.
148
+ },
149
+ };
150
+ }
@@ -20,7 +20,7 @@ import { join } from "node:path";
20
20
  * - `value` 去除空白后等于 `"default"`(不区分大小写)→ 视作 `""` 并 warn。
21
21
  * - 其余情况原样返回(不裁剪两端空白,留给具体调用方决定)。
22
22
  */
23
- export function normalizeOptionalConfigField(
23
+ export function normalizeOptionalConfigField(
24
24
  value: unknown,
25
25
  options: { label: string; fallback?: string },
26
26
  ): string {
@@ -33,18 +33,42 @@ export function normalizeOptionalConfigField(
33
33
  );
34
34
  return "";
35
35
  }
36
- return value;
37
- }
38
-
39
- /**
40
- * CCC Agent requires credentials owned by ChatCCC. An explicit enabled=true
41
- * must not make the agent selectable when that credential is absent.
42
- */
43
- export function resolveCccEnabled(rawEnabled: unknown, apiKey: unknown): boolean {
44
- const hasApiKey = typeof apiKey === "string" && apiKey.trim().length > 0;
45
- if (!hasApiKey) return false;
46
- return typeof rawEnabled === "boolean" ? rawEnabled : true;
47
- }
36
+ return value;
37
+ }
38
+
39
+ /**
40
+ * ccc.provider 的合法取值:空字符串表示不 override(跟随 DeepCCC 内核配置),
41
+ * 或者显式指定 openai / anthropic 两种协议之一。
42
+ */
43
+ export type CccProviderOverride = "" | "openai" | "anthropic";
44
+
45
+ /**
46
+ * 归一化 `ccc.provider`(ChatCCC 主进程配置对 DeepCCC 内核传输层的 override):
47
+ * - 非字符串 / 空串 / 字面量 "default" → `""`(不 override,跟随
48
+ * ~/.deepccc/config.json 或 DEEPCCC_PROVIDER,向后兼容旧 config.json)
49
+ * - `openai` / `anthropic`(大小写不敏感)→ 规范化小写返回
50
+ * - 其它非法值 → `""` 并打印 warning(避免运行时 normalizeDeepCccProvider 抛错)
51
+ */
52
+ export function normalizeCccProviderOverride(value: unknown): CccProviderOverride {
53
+ if (typeof value !== "string") return "";
54
+ const trimmed = value.trim().toLowerCase();
55
+ if (trimmed === "" || trimmed === "default") return "";
56
+ if (trimmed === "openai" || trimmed === "anthropic") return trimmed;
57
+ console.warn(
58
+ `[CONFIG] ccc.provider 的值 "${value}" 非法,已忽略(仅支持 openai / anthropic / 空字符串)。`,
59
+ );
60
+ return "";
61
+ }
62
+
63
+ /**
64
+ * CCC Agent requires credentials owned by ChatCCC. An explicit enabled=true
65
+ * must not make the agent selectable when that credential is absent.
66
+ */
67
+ export function resolveCccEnabled(rawEnabled: unknown, apiKey: unknown): boolean {
68
+ const hasApiKey = typeof apiKey === "string" && apiKey.trim().length > 0;
69
+ if (!hasApiKey) return false;
70
+ return typeof rawEnabled === "boolean" ? rawEnabled : true;
71
+ }
48
72
 
49
73
  // ---------------------------------------------------------------------------
50
74
  // /git 超时配置相关
package/src/config.ts CHANGED
@@ -11,10 +11,12 @@ import {
11
11
  anthropicConfigDisplay,
12
12
  autoDetectCodexPath,
13
13
  autoDetectCursorPath,
14
- normalizeOptionalConfigField,
15
- readToolCliPath,
16
- resolveCccEnabled,
17
- } from "./config-utils.ts";
14
+ normalizeCccProviderOverride,
15
+ normalizeOptionalConfigField,
16
+ readToolCliPath,
17
+ resolveCccEnabled,
18
+ } from "./config-utils.ts";
19
+ import type { CccProviderOverride } from "./config-utils.ts";
18
20
 
19
21
  // 重新导出 config-utils 中的纯函数/常量,保持对外 API 不变
20
22
  // (历史上这些符号都从 ./config.ts 导入;新代码可直接从 ./config-utils.ts 导入以避免触发本文件的副作用)
@@ -23,11 +25,11 @@ export {
23
25
  MIN_GIT_TIMEOUT_SECONDS,
24
26
  MAX_GIT_TIMEOUT_SECONDS,
25
27
  parseGitTimeoutSeconds,
26
- normalizeOptionalConfigField,
27
- isAnthropicConfigEmpty,
28
- anthropicConfigDisplay,
29
- resolveCccEnabled,
30
- } from "./config-utils.ts";
28
+ normalizeOptionalConfigField,
29
+ isAnthropicConfigEmpty,
30
+ anthropicConfigDisplay,
31
+ resolveCccEnabled,
32
+ } from "./config-utils.ts";
31
33
  export type { ParsedGitTimeout } from "./config-utils.ts";
32
34
 
33
35
  // ---------------------------------------------------------------------------
@@ -123,6 +125,12 @@ export interface CccConfig {
123
125
  * DeepSeek reasoning_effort 请求字段;留空表示不传(服务端默认 medium)。
124
126
  */
125
127
  effort: string;
128
+ /**
129
+ * API 协议 override(选填):openai(OpenAI 兼容协议)或 anthropic(Anthropic
130
+ * Messages 协议)。留空("")表示不 override,跟随 DeepCCC 内核配置
131
+ * (~/.deepccc/config.json 的 provider 或 DEEPCCC_PROVIDER 环境变量)。
132
+ */
133
+ provider: CccProviderOverride;
126
134
  }
127
135
 
128
136
  export interface FeishuConfig {
@@ -470,6 +478,7 @@ function loadConfig(): AppConfig {
470
478
  model: DEFAULT_CCC_MODEL,
471
479
  alternativeModel: "",
472
480
  effort: "",
481
+ provider: "",
473
482
  },
474
483
  };
475
484
 
@@ -597,10 +606,10 @@ function loadConfig(): AppConfig {
597
606
  );
598
607
  // 旧版 ccc 配置没有 enabled。只用 API Key 推断启用,避免 sample 中自带的
599
608
  // 默认 Base URL / model 让升级用户在未配置凭证时意外启用 CCC Agent。
600
- const claudeEnabled = resolveEnabled(claude.enabled, claudeNonEmpty);
601
- const cursorEnabled = resolveEnabled(cursorRaw.enabled, cursorNonEmpty);
602
- const codexEnabled = resolveEnabled(codexRaw.enabled, codexNonEmpty);
603
- const cccEnabled = resolveCccEnabled(cccRaw.enabled, cccRaw.DEEPSEEK_API_KEY);
609
+ const claudeEnabled = resolveEnabled(claude.enabled, claudeNonEmpty);
610
+ const cursorEnabled = resolveEnabled(cursorRaw.enabled, cursorNonEmpty);
611
+ const codexEnabled = resolveEnabled(codexRaw.enabled, codexNonEmpty);
612
+ const cccEnabled = resolveCccEnabled(cccRaw.enabled, cccRaw.DEEPSEEK_API_KEY);
604
613
  const chromeDevtoolsPort = Number(chromeDevtoolsRaw.port);
605
614
  const explicitDefaultTool: AgentTool | null =
606
615
  typeof claude.defaultAgent === "boolean" && claude.defaultAgent && claudeEnabled ? "claude" :
@@ -702,6 +711,7 @@ function loadConfig(): AppConfig {
702
711
  model: normalizeOptionalConfigField(cccRaw.model, { label: "ccc.model", fallback: DEFAULT_CCC_MODEL }),
703
712
  alternativeModel: normalizeOptionalConfigField(cccRaw.alternativeModel, { label: "ccc.alternativeModel" }),
704
713
  effort: normalizeOptionalConfigField(cccRaw.effort, { label: "ccc.effort" }),
714
+ provider: normalizeCccProviderOverride(cccRaw.provider),
705
715
  },
706
716
  };
707
717
  }
package/src/session.ts CHANGED
@@ -713,6 +713,8 @@ export function getAdapterForTool(tool: string, sessionId?: string): ToolAdapter
713
713
  baseURL: config.ccc.DEEPSEEK_BASE_URL,
714
714
  model: effectiveModel || undefined,
715
715
  effort: effectiveEffort || undefined,
716
+ // 留空("")不传 → ChatSession 跟随 DeepCCC 内核配置(~/.deepccc/config.json 或 DEEPCCC_PROVIDER)
717
+ ...(config.ccc.provider ? { provider: config.ccc.provider } : {}),
716
718
  });
717
719
  } else {
718
720
  adapter = createClaudeAdapter({