chatccc 0.2.249 → 0.2.251

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.
@@ -1,8 +1,8 @@
1
- ## macOS Command-Line Notes
1
+ ## macOS 命令行提示
2
2
 
3
- You are running on macOS. run_command executes through zsh, a POSIX shell. Quoting follows standard POSIX conventions (the same habits you already know from bash):
3
+ 你运行在 macOS 上。run_command 通过 zshPOSIX shell)执行。引号遵循标准 POSIX 约定(与你在 bash 中已有的习惯相同):
4
4
 
5
- - Double quotes are stripped and group an argument containing spaces: `echo "hello world"` prints `hello world`.
6
- - Single quotes are literal quoting characters: `'a b'` is a single argument `a b`.
7
- - Backticks and `$(...)` perform command substitution; quote them if you need literal text.
8
- - Paths use `/` separators and `~` expands to the home directory.
5
+ - 双引号会被剥离并用于组合含空格参数:`echo "hello world"` 打印 `hello world`。
6
+ - 单引号是字面量引用字符:`'a b'` 是单个参数 `a b`。
7
+ - 反引号和 `$(...)` 执行命令替换;需要字面文本时请加引号。
8
+ - 路径使用 `/` 分隔符,`~` 展开为主目录。
@@ -1,8 +1,8 @@
1
- ## Linux Command-Line Notes
1
+ ## Linux 命令行提示
2
2
 
3
- You are running on Linux. run_command executes through a POSIX shell (bash/sh). Quoting follows standard POSIX conventions (the same habits you already know from bash):
3
+ 你运行在 Linux 上。run_command 通过 POSIX shellbash/sh)执行。引语遵循标准 POSIX 约定(与你在 bash 中已有的习惯相同):
4
4
 
5
- - Double quotes are stripped and group an argument containing spaces: `echo "hello world"` prints `hello world`.
6
- - Single quotes are literal quoting characters: `'a b'` is a single argument `a b`.
7
- - Backticks and `$(...)` perform command substitution; quote them if you need literal text.
8
- - Paths use `/` separators and `~` expands to the home directory.
5
+ - 双引号会被剥离并用于组合含空格参数:`echo "hello world"` 打印 `hello world`。
6
+ - 单引号是字面量引用字符:`'a b'` 是单个参数 `a b`。
7
+ - 反引号和 `$(...)` 执行命令替换;需要字面文本时请加引号。
8
+ - 路径使用 `/` 分隔符,`~` 展开为主目录。
@@ -1,9 +1,11 @@
1
- ## Windows Command-Line Notes
1
+ ## Windows 命令行提示
2
2
 
3
- You are running on Windows. run_command executes through cmd.exe, not bash. cmd quoting differs from bash and breaks common habits:
3
+ 你运行在 Windows 上。run_command 通过 cmd.exe 执行,而不是 bashcmd 的引号规则与 bash 不同,容易踩坑:
4
4
 
5
- - Double quotes are NOT stripped: `echo "hello world"` prints `"hello world"` (quotes included), and `"a b" "c"` passes the literal arguments `"a b"` and `"c"` (quotes included) to the program.
6
- - Single quotes are NOT quoting characters in cmd.exe: `'a b'` is parsed as two arguments (`'a` and `b'`).
7
- - Multi-line or quote-heavy inline scripts (python -c "...\n...", ssh host "bash -c '...'") frequently break under cmd quoting; write the script to a temporary file and execute that file instead.
8
- - PowerShell-only syntax (Get-Item, 2>$null, Select-Object) is unavailable; the shell is cmd.exe unless you explicitly invoke powershell.
9
- - To pass an argument containing spaces, use double quotes and expect the quotes to reach the program literally; when the target accepts file input, prefer writing the value to a file.
5
+ - 双引号不会被剥离:`echo "hello world"` 会原样打印 `"hello world"`(含引号),`"a b" "c"` 会把带引号的字面量 `"a b"` `"c"` 传给程序。
6
+ - 单引号在 cmd.exe 中不是引用字符:`'a b'` 会被解析成两个参数(`'a` `b'`)。
7
+ - 多行或引号密集的内联脚本(python -c "...\n...", ssh host "bash -c '...'")在 cmd 引号规则下经常失败;把脚本写入临时文件再执行该文件。
8
+ - PowerShell 专用语法(Get-Item2>$nullSelect-Object)不可用;除非显式调用 powershell,否则 shell cmd.exe
9
+ - 传含空格参数时用双引号,并预期引号会原样到达程序;当目标接受文件输入时,优先把值写入文件。
10
+ - cmd.exe 跨盘 `cd` 需要 `/d`:`cd /d D:\repo` 才真正切换盘符和目录;裸 `cd D:\repo` 只打印目标路径、停留在原盘,后续命令会在错误的目录执行。
11
+ - npm 11.x 在 Windows 上忽略 `--prefix` 对 `npm publish` 的作用:`npm --prefix D:/repo publish` 发布的是**当前目录**的包,而不是 `--prefix` 指向的目录。务必先 `cd /d` 进入包目录,再执行 `npm publish`。
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "deepccc",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "deepccc",
9
- "version": "0.1.18",
9
+ "version": "0.1.20",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@ai-sdk/anthropic": "^3.0.105",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepccc",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "A lightweight coding agent with OpenAI-compatible and Anthropic Messages API support.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -238,21 +238,21 @@ describe("ChatSession context management", () => {
238
238
  await collect(session.chat("diagnose a consequential problem"));
239
239
 
240
240
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
241
- expect(system).toContain("## Evidence-Gated Conclusions");
242
- expect(system).toContain("source of truth");
243
- expect(system).toContain("direct observations from inferences");
244
- expect(system).toContain("plausible alternative explanations");
245
- expect(system).toContain("runtime behavior for runtime claims");
246
- expect(system).toContain("state uncertainty");
247
- expect(system).toContain("Do not repeat checks once decisive evidence exists");
241
+ expect(system).toContain("## 证据门控结论");
242
+ expect(system).toContain("权威事实来源");
243
+ expect(system).toContain("区分直接观察与推断");
244
+ expect(system).toContain("合理的替代解释");
245
+ expect(system).toContain("运行时结论用运行时行为");
246
+ expect(system).toContain("说明不确定性");
247
+ expect(system).toContain("一旦已有决定性证据");
248
248
  expect(system).not.toContain("CodesForUnity");
249
- expect(system.indexOf("## Evidence-Gated Conclusions")).toBeLessThan(
249
+ expect(system.indexOf("## 证据门控结论")).toBeLessThan(
250
250
  system.indexOf("PROJECT GUIDANCE MARKER"),
251
251
  );
252
- expect(system.indexOf("## Evidence-Gated Conclusions")).toBeLessThan(
253
- system.indexOf("Current working directory"),
252
+ expect(system.indexOf("## 证据门控结论")).toBeLessThan(
253
+ system.indexOf("当前工作目录"),
254
254
  );
255
- expect(system.indexOf("## Evidence-Gated Conclusions")).toBeLessThan(
255
+ expect(system.indexOf("## 证据门控结论")).toBeLessThan(
256
256
  system.indexOf("CUSTOM PROMPT MARKER"),
257
257
  );
258
258
  });
@@ -275,21 +275,21 @@ describe("ChatSession context management", () => {
275
275
 
276
276
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
277
277
  // 先盘点再动手:动手前低开销盘点 + 输出含验证策略的计划
278
- expect(system).toContain("## Survey Before Acting");
279
- expect(system).toContain("map the landscape");
280
- expect(system).toContain("how you will verify the result");
278
+ expect(system).toContain("## 行动前先调查");
279
+ expect(system).toContain("以低成本盘点环境");
280
+ expect(system).toContain("如何验证结果");
281
281
  // 授权自主:用户委托决策后只问真正阻塞项,不抛实现级选择题
282
- expect(system).toContain("## Delegated Authority");
283
- expect(system).toContain("irreversible actions");
284
- expect(system).toContain("Do not bounce implementation-level multiple-choice");
282
+ expect(system).toContain("## 授权范围");
283
+ expect(system).toContain("不可逆操作");
284
+ expect(system).toContain("不要把实现级选择题抛回给用户");
285
285
  // 交付自检:声明做了什么/如何验证/未验证项
286
- expect(system).toContain("## Pre-Delivery Self-Check");
287
- expect(system).toContain("remains unverified or risky");
286
+ expect(system).toContain("## 交付前自检");
287
+ expect(system).toContain("未验证或有风险");
288
288
  // 稳定前缀全部位于项目指令与 runtime 上下文之前
289
- for (const section of ["## Survey Before Acting", "## Delegated Authority", "## Pre-Delivery Self-Check"]) {
289
+ for (const section of ["## 行动前先调查", "## 授权范围", "## 交付前自检"]) {
290
290
  expect(system.indexOf(section)).toBeGreaterThan(0);
291
291
  expect(system.indexOf(section)).toBeLessThan(system.indexOf("PROJECT GUIDANCE MARKER"));
292
- expect(system.indexOf(section)).toBeLessThan(system.indexOf("Current working directory"));
292
+ expect(system.indexOf(section)).toBeLessThan(system.indexOf("当前工作目录"));
293
293
  expect(system.indexOf(section)).toBeLessThan(system.indexOf("CUSTOM PROMPT MARKER"));
294
294
  }
295
295
  });
@@ -313,7 +313,7 @@ describe("ChatSession context management", () => {
313
313
  await collect(session.chat("hi"));
314
314
 
315
315
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
316
- expect(system).toContain("## Project Instructions");
316
+ expect(system).toContain("## 项目指令");
317
317
  expect(system).toContain("### AGENTS.md");
318
318
  expect(system).toContain("agents root guidance");
319
319
  expect(system).toContain("### AGENTS.local.md");
@@ -355,10 +355,10 @@ describe("ChatSession context management", () => {
355
355
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
356
356
  expect(system).toContain("demo-skill");
357
357
  expect(system).toContain("CUSTOM PROMPT MARKER");
358
- expect(system).toContain("Current working directory");
358
+ expect(system).toContain("当前工作目录");
359
359
  // 稳定性排序:固定规则 → 项目指令 → runtime → custom → 技能索引(最后)
360
360
  expect(system.indexOf("CUSTOM PROMPT MARKER")).toBeGreaterThan(
361
- system.indexOf("Current working directory"),
361
+ system.indexOf("当前工作目录"),
362
362
  );
363
363
  expect(system.indexOf("demo-skill")).toBeGreaterThan(system.indexOf("CUSTOM PROMPT MARKER"));
364
364
  });
@@ -635,7 +635,7 @@ describe("ChatSession context management", () => {
635
635
 
636
636
  const persisted = session.history.at(-1)?.content ?? "";
637
637
  expect(persisted.length).toBeLessThan(40_000);
638
- expect(persisted).toContain("tool transcript truncated");
638
+ expect(persisted).toContain("工具记录已截断");
639
639
  });
640
640
 
641
641
  it("persists structured tool calls alongside the text transcript", async () => {
@@ -662,7 +662,7 @@ describe("ChatSession context management", () => {
662
662
  expect(state.messages[1].toolCalls).toEqual([
663
663
  { name: "read_file", input: "{\"path\":\"package.json\"}", output: "{\"content\":\"{}\"}" },
664
664
  ]);
665
- expect(state.messages[1].content).toContain("[Tool transcript]");
665
+ expect(state.messages[1].content).toContain("[工具记录]");
666
666
  });
667
667
 
668
668
  it("records tool errors and preserves tool call order in structured tool calls", async () => {
@@ -767,16 +767,16 @@ describe("platform-specific system prompt injection", () => {
767
767
  await collect(session.chat("hi"));
768
768
 
769
769
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
770
- expect(system).toContain("## Windows Command-Line Notes");
770
+ expect(system).toContain("## Windows 命令行提示");
771
771
  expect(system).toContain("cmd.exe");
772
- expect(system).toMatch(/double quotes/i);
773
- expect(system).toMatch(/single quotes/i);
772
+ expect(system).toMatch(/双引号/);
773
+ expect(system).toMatch(/单引号/);
774
774
  // 平台指引属于固定规则区,位于 runtime workspace 上下文之前
775
- expect(system.indexOf("## Windows Command-Line Notes")).toBeGreaterThan(
776
- system.indexOf("## Fixed Rules"),
775
+ expect(system.indexOf("## Windows 命令行提示")).toBeGreaterThan(
776
+ system.indexOf("## 固定规则"),
777
777
  );
778
- expect(system.indexOf("## Windows Command-Line Notes")).toBeLessThan(
779
- system.indexOf("Current working directory"),
778
+ expect(system.indexOf("## Windows 命令行提示")).toBeLessThan(
779
+ system.indexOf("当前工作目录"),
780
780
  );
781
781
  });
782
782
 
@@ -793,7 +793,7 @@ describe("platform-specific system prompt injection", () => {
793
793
  await collect(session.chat("hi"));
794
794
 
795
795
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
796
- expect(system).not.toContain("## Windows Command-Line Notes");
796
+ expect(system).not.toContain("## Windows 命令行提示");
797
797
  });
798
798
  });
799
799
 
@@ -832,10 +832,10 @@ describe("loadPlatformCommandPrompt", () => {
832
832
 
833
833
  it("loads builtin guidance from os-prompts/<platform>.md", async () => {
834
834
  const text = await loadPrompt("win32", { builtinDir });
835
- expect(text).toContain("## Windows Command-Line Notes");
835
+ expect(text).toContain("## Windows 命令行提示");
836
836
  expect(text).toContain("cmd.exe");
837
- expect(text).toMatch(/double quotes/i);
838
- expect(text).toMatch(/single quotes/i);
837
+ expect(text).toMatch(/双引号/);
838
+ expect(text).toMatch(/单引号/);
839
839
  });
840
840
 
841
841
  it("prefers the user override at ~/.deepccc/prompts/<platform>.md", async () => {
@@ -33,7 +33,7 @@ describe("BuiltinContextManager", () => {
33
33
 
34
34
  const prompt = buildSummaryPrompt(context.planCompaction()!);
35
35
 
36
- expect(prompt).toContain("existing summary truncated for compaction");
36
+ expect(prompt).toContain("已有摘要为压缩而截断");
37
37
  expect(prompt.length).toBeLessThan(40_000);
38
38
  });
39
39
 
@@ -71,7 +71,7 @@ describe("BuiltinContextManager", () => {
71
71
  const prompt = buildSummaryPrompt(context.planCompaction()!);
72
72
 
73
73
  expect(prompt.length).toBeLessThan(90_000);
74
- expect(prompt).toContain("truncated for compaction");
74
+ expect(prompt).toContain("为压缩而截断");
75
75
  });
76
76
 
77
77
  it("persists and restores summary, messages, and total message count", async () => {
@@ -144,7 +144,7 @@ describe("BuiltinContextManager", () => {
144
144
  expect(context.buildModelMessages()).toEqual([
145
145
  {
146
146
  role: "user",
147
- content: expect.stringContaining("The following is an earlier conversation summary"),
147
+ content: expect.stringContaining("以下是更早的对话摘要"),
148
148
  },
149
149
  { role: "assistant", content: "recent" },
150
150
  ]);
@@ -160,7 +160,7 @@ describe("BuiltinContextManager", () => {
160
160
  });
161
161
  first.appendMessage({
162
162
  role: "assistant",
163
- content: "回复\n\n[Tool transcript]\ntool_call run_command: {}\ntool_result run_command: {}",
163
+ content: "回复\n\n[工具记录]\ntool_call run_command: {}\ntool_result run_command: {}",
164
164
  toolCalls: [
165
165
  { name: "run_command", input: "{\"command\":\"npm test\"}", output: "{\"exitCode\":0}" },
166
166
  { name: "read_file", input: "{\"path\":\"a.ts\"}", output: "...", is_error: true },
@@ -235,7 +235,7 @@ describe("BuiltinContextManager", () => {
235
235
 
236
236
  expect(message.role).toBe("assistant");
237
237
  expect(message.content).toContain("回复正文");
238
- expect(message.content).toContain("[Tool transcript]");
238
+ expect(message.content).toContain("[工具记录]");
239
239
  expect(message.content).toContain("tool_call run_command");
240
240
  expect(message.toolCalls).toEqual([
241
241
  { name: "run_command", input: "{\"command\":\"npm test\"}", output: "{\"exitCode\":0}" },
@@ -249,7 +249,7 @@ describe("BuiltinContextManager", () => {
249
249
  });
250
250
 
251
251
  expect(message.content).toBe("纯文本回复");
252
- expect(message.content).not.toContain("[Tool transcript]");
252
+ expect(message.content).not.toContain("[工具记录]");
253
253
  expect(message.toolCalls).toBeUndefined();
254
254
  });
255
255
 
@@ -262,8 +262,8 @@ describe("BuiltinContextManager", () => {
262
262
  });
263
263
 
264
264
  expect(message.content.length).toBeLessThan(7_000);
265
- expect(message.content).toContain("assistant response truncated");
266
- expect(message.content).toContain("tool transcript truncated");
265
+ expect(message.content).toContain("助手回复已在上下文中截断");
266
+ expect(message.content).toContain("工具记录已截断");
267
267
  });
268
268
 
269
269
  it("reset clears memory and the persisted context file", async () => {
@@ -239,10 +239,10 @@ describe("buildSkillsIndexPrompt", () => {
239
239
  },
240
240
  ]);
241
241
 
242
- expect(prompt).toContain("## Available Skills");
242
+ expect(prompt).toContain("## 可用技能");
243
243
  expect(prompt).toContain("**feishu-doc**");
244
244
  expect(prompt).toContain("[codex:global]");
245
- expect(prompt).toContain("## Creating Skills");
245
+ expect(prompt).toContain("## 创建技能");
246
246
  expect(prompt).toContain(".deepccc/skills");
247
247
  expect(prompt).toContain("read_file");
248
248
  });
@@ -250,8 +250,8 @@ function truncateMiddle(value: string, maxChars: number, marker: string): string
250
250
 
251
251
  export const DEFAULT_PERSISTED_ASSISTANT_TEXT_CHARS = 32_000;
252
252
  export const DEFAULT_PERSISTED_TOOL_TRANSCRIPT_CHARS = 24_000;
253
- const ASSISTANT_TRUNCATED_MARKER = "...[assistant response truncated in context]...";
254
- const TOOL_TRANSCRIPT_TRUNCATED_MARKER = "...[tool transcript truncated]...";
253
+ const ASSISTANT_TRUNCATED_MARKER = "...[助手回复已在上下文中截断]...";
254
+ const TOOL_TRANSCRIPT_TRUNCATED_MARKER = "...[工具记录已截断]...";
255
255
 
256
256
  /**
257
257
  * 构造持久化的 assistant 消息:content 保持既有"正文 + [Tool transcript]"文本格式
@@ -275,7 +275,7 @@ export function buildPersistedAssistantMessage(params: {
275
275
  ASSISTANT_TRUNCATED_MARKER,
276
276
  );
277
277
  const content = params.transcriptLines.length > 0
278
- ? `${persistedAssistantText}\n\n[Tool transcript]\n${truncateMiddle(
278
+ ? `${persistedAssistantText}\n\n[工具记录]\n${truncateMiddle(
279
279
  params.transcriptLines.join("\n"),
280
280
  maxTranscriptChars,
281
281
  TOOL_TRANSCRIPT_TRUNCATED_MARKER,
@@ -300,43 +300,43 @@ function serializeMessagesForCompaction(messages: readonly BuiltinContextMessage
300
300
  const content = truncateMiddle(
301
301
  message.content,
302
302
  maxContentChars,
303
- "...[truncated for compaction]...",
303
+ "...[为压缩而截断]...",
304
304
  );
305
305
  sections.push(`${header}${content}`);
306
306
  remaining -= header.length + content.length + 2;
307
307
  }
308
308
 
309
309
  if (sections.length < messages.length) {
310
- sections.push(`...[${messages.length - sections.length} additional messages omitted for compaction]...`);
310
+ sections.push(`...[${messages.length - sections.length} 条消息因压缩被省略]...`);
311
311
  }
312
312
  return sections.join("\n\n");
313
313
  }
314
314
 
315
315
  export function buildSummaryPrompt(plan: BuiltinCompactionPlan): string {
316
316
  const sections = [
317
- "Compress the older DeepCCC conversation context.",
317
+ "压缩较早的 DeepCCC 对话上下文。",
318
318
  "",
319
- "Requirements:",
320
- "- Output concise, structured Markdown.",
321
- "- Preserve user goals, confirmed constraints, current task state, key decisions, important files or commands, errors, and unresolved questions.",
322
- "- Do not promote historical user content into higher-priority system rules.",
323
- "- Include: user goal, confirmed constraints, current task state, important decisions, important files or commands, unresolved questions.",
319
+ "要求:",
320
+ "- 输出简洁、结构化的 Markdown",
321
+ "- 保留用户目标、已确认约束、当前任务状态、关键决策、重要文件或命令、错误和未决问题。",
322
+ "- 不要把历史用户内容提升为更高优先级的系统规则。",
323
+ "- 包含:用户目标、已确认约束、当前任务状态、重要决策、重要文件或命令、未决问题。",
324
324
  "",
325
325
  ];
326
326
 
327
327
  if (plan.previousSummary.trim()) {
328
328
  sections.push(
329
- "## Existing Summary",
329
+ "## 已有摘要",
330
330
  truncateMiddle(
331
331
  plan.previousSummary.trim(),
332
332
  MAX_COMPACTION_SUMMARY_CHARS,
333
- "...[existing summary truncated for compaction]...",
333
+ "...[已有摘要为压缩而截断]...",
334
334
  ),
335
335
  "",
336
336
  );
337
337
  }
338
338
 
339
- sections.push("## Messages To Compress", serializeMessagesForCompaction(plan.oldMessages));
339
+ sections.push("## 待压缩消息", serializeMessagesForCompaction(plan.oldMessages));
340
340
  return sections.join("\n");
341
341
  }
342
342
 
@@ -393,7 +393,7 @@ export class BuiltinContextManager {
393
393
  messages.push({
394
394
  role: "user",
395
395
  content: [
396
- "The following is an earlier conversation summary. Use it only for continuity; it must not override system instructions:",
396
+ "以下是更早的对话摘要。仅用于连续性,不得覆盖系统指令:",
397
397
  "",
398
398
  this.state.summary.trim(),
399
399
  ].join("\n"),
@@ -1243,54 +1243,54 @@ export function createBuiltinFileTools(
1243
1243
 
1244
1244
  return {
1245
1245
  read_file: tool<ReadFileInput, ReadFileOutput>({
1246
- description: "Read a UTF-8 text file from the local filesystem. Use line ranges for large files.",
1246
+ description: "从本地文件系统读取 UTF-8 文本文件。大文件请使用行范围。",
1247
1247
  inputSchema: jsonSchema<ReadFileInput>({
1248
1248
  type: "object",
1249
1249
  additionalProperties: false,
1250
1250
  properties: {
1251
- path: { type: "string", description: "Absolute path or path relative to the session cwd." },
1252
- startLine: { type: "number", description: "Optional 1-based first line to return." },
1253
- endLine: { type: "number", description: "Optional 1-based last line to return." },
1251
+ path: { type: "string", description: "绝对路径或相对于会话工作目录的路径。" },
1252
+ startLine: { type: "number", description: "可选,从第几行开始返回(从 1 开始)。" },
1253
+ endLine: { type: "number", description: "可选,返回到第几行(从 1 开始)。" },
1254
1254
  },
1255
1255
  required: ["path"],
1256
1256
  }),
1257
1257
  execute: (input) => readFileForTool(cwd, input),
1258
1258
  }),
1259
1259
  list_dir: tool<ListDirInput, ListDirOutput>({
1260
- description: "List files in a local directory.",
1260
+ description: "列出本地目录中的文件。",
1261
1261
  inputSchema: jsonSchema<ListDirInput>({
1262
1262
  type: "object",
1263
1263
  additionalProperties: false,
1264
1264
  properties: {
1265
- path: { type: "string", description: "Directory path. Defaults to the session cwd." },
1265
+ path: { type: "string", description: "目录路径。默认为会话工作目录。" },
1266
1266
  },
1267
1267
  }),
1268
1268
  execute: (input) => listDirForTool(cwd, input),
1269
1269
  }),
1270
1270
  search_code: tool<SearchCodeInput, SearchCodeOutput>({
1271
- description: "Search local files with ripgrep without invoking a shell.",
1271
+ description: " ripgrep 搜索本地文件,无需调用 shell",
1272
1272
  inputSchema: jsonSchema<SearchCodeInput>({
1273
1273
  type: "object",
1274
1274
  additionalProperties: false,
1275
1275
  properties: {
1276
- query: { type: "string", description: "Text or regex query passed to ripgrep." },
1277
- path: { type: "string", description: "File or directory to search. Defaults to the session cwd." },
1278
- glob: { type: "string", description: "Optional ripgrep glob filter, for example **/*.ts." },
1279
- maxResults: { type: "number", description: "Maximum result lines, capped internally." },
1276
+ query: { type: "string", description: "传递给 ripgrep 的文本或正则查询。" },
1277
+ path: { type: "string", description: "要搜索的文件或目录。默认为会话工作目录。" },
1278
+ glob: { type: "string", description: "可选的 ripgrep glob 过滤器,例如 **/*.ts" },
1279
+ maxResults: { type: "number", description: "最大结果行数,内部设有上限。" },
1280
1280
  },
1281
1281
  required: ["query"],
1282
1282
  }),
1283
1283
  execute: (input, options) => searchCodeForTool(cwd, input, options.abortSignal),
1284
1284
  }),
1285
1285
  run_command: tool<RunCommandInput, RunCommandOutput>({
1286
- description: "Run a non-interactive shell command in the local workspace. Use for tests, git, and package scripts. Returns stdout/stderr and exitCode; non-zero exit codes are not tool errors.",
1286
+ description: "在本地工作区运行非交互式 shell 命令。用于测试、git 和包脚本。返回 stdout/stderr exitCode;非零退出码不是工具错误。",
1287
1287
  inputSchema: jsonSchema<RunCommandInput>({
1288
1288
  type: "object",
1289
1289
  additionalProperties: false,
1290
1290
  properties: {
1291
- command: { type: "string", description: "Command line to run in the platform shell." },
1292
- cwd: { type: "string", description: "Optional working directory. Defaults to the session cwd." },
1293
- timeoutMs: { type: "number", description: `Optional timeout in milliseconds, capped at ${MAX_COMMAND_TIMEOUT_MS}.` },
1291
+ command: { type: "string", description: "要在平台 shell 中运行的命令行。" },
1292
+ cwd: { type: "string", description: "可选的工作目录。默认为会话工作目录。" },
1293
+ timeoutMs: { type: "number", description: `可选超时(毫秒),上限为 ${MAX_COMMAND_TIMEOUT_MS}。` },
1294
1294
  },
1295
1295
  required: ["command"],
1296
1296
  }),
@@ -1305,13 +1305,13 @@ export function createBuiltinFileTools(
1305
1305
  },
1306
1306
  }),
1307
1307
  edit_file: tool<EditFileInput, EditFileOutput>({
1308
- description: "Edit an existing UTF-8 text file by applying exact oldText -> newText replacements. Uses optional SHA-256 precondition to avoid overwriting concurrent edits.",
1308
+ description: "通过精确的 oldText -> newText 替换编辑现有 UTF-8 文本文件。可行时使用 SHA-256 前置条件以避免覆盖并发编辑。",
1309
1309
  inputSchema: jsonSchema<EditFileInput>({
1310
1310
  type: "object",
1311
1311
  additionalProperties: false,
1312
1312
  properties: {
1313
- path: { type: "string", description: "Absolute path or path relative to the session cwd." },
1314
- expectedSha256: { type: "string", description: "Optional SHA-256 hash of the current file content." },
1313
+ path: { type: "string", description: "绝对路径或相对于会话工作目录的路径。" },
1314
+ expectedSha256: { type: "string", description: "当前文件内容的可选 SHA-256 哈希。" },
1315
1315
  edits: {
1316
1316
  type: "array",
1317
1317
  minItems: 1,
@@ -1319,9 +1319,9 @@ export function createBuiltinFileTools(
1319
1319
  type: "object",
1320
1320
  additionalProperties: false,
1321
1321
  properties: {
1322
- oldText: { type: "string", description: "Exact text to replace. Include enough context to make it unique." },
1323
- newText: { type: "string", description: "Replacement text." },
1324
- replaceAll: { type: "boolean", description: "Replace every occurrence when oldText appears multiple times." },
1322
+ oldText: { type: "string", description: "要替换的精确文本。包含足够的上下文使其唯一。" },
1323
+ newText: { type: "string", description: "替换文本。" },
1324
+ replaceAll: { type: "boolean", description: " oldText 出现多次时替换所有出现。" },
1325
1325
  },
1326
1326
  required: ["oldText", "newText"],
1327
1327
  },
@@ -1341,15 +1341,15 @@ export function createBuiltinFileTools(
1341
1341
  },
1342
1342
  }),
1343
1343
  create_file: tool<CreateFileInput, FileWriteOutput>({
1344
- description: "Create a UTF-8 text file, or overwrite an existing one when overwrite=true.",
1344
+ description: "创建 UTF-8 文本文件,或在 overwrite=true 时覆盖现有文件。",
1345
1345
  inputSchema: jsonSchema<CreateFileInput>({
1346
1346
  type: "object",
1347
1347
  additionalProperties: false,
1348
1348
  properties: {
1349
- path: { type: "string", description: "Absolute path or path relative to the session cwd." },
1350
- content: { type: "string", description: "Complete file content to write." },
1351
- overwrite: { type: "boolean", description: "Allow replacing an existing file." },
1352
- expectedSha256: { type: "string", description: "Optional SHA-256 hash required when overwriting an existing file." },
1349
+ path: { type: "string", description: "绝对路径或相对于会话工作目录的路径。" },
1350
+ content: { type: "string", description: "要写入的完整文件内容。" },
1351
+ overwrite: { type: "boolean", description: "允许替换现有文件。" },
1352
+ expectedSha256: { type: "string", description: "覆盖现有文件时需要的可选 SHA-256 哈希。" },
1353
1353
  },
1354
1354
  required: ["path", "content"],
1355
1355
  }),
@@ -1365,13 +1365,13 @@ export function createBuiltinFileTools(
1365
1365
  },
1366
1366
  }),
1367
1367
  delete_file: tool<DeleteFileInput, DeleteFileOutput>({
1368
- description: "Delete an existing text file. Use expectedSha256 to avoid deleting a file that changed after reading.",
1368
+ description: "删除现有的文本文件。使用 expectedSha256 避免删除读取后已更改的文件。",
1369
1369
  inputSchema: jsonSchema<DeleteFileInput>({
1370
1370
  type: "object",
1371
1371
  additionalProperties: false,
1372
1372
  properties: {
1373
- path: { type: "string", description: "Absolute path or path relative to the session cwd." },
1374
- expectedSha256: { type: "string", description: "Optional SHA-256 hash of the file that must be deleted." },
1373
+ path: { type: "string", description: "绝对路径或相对于会话工作目录的路径。" },
1374
+ expectedSha256: { type: "string", description: "必须删除的文件的可选 SHA-256 哈希。" },
1375
1375
  },
1376
1376
  required: ["path"],
1377
1377
  }),
@@ -1387,16 +1387,16 @@ export function createBuiltinFileTools(
1387
1387
  },
1388
1388
  }),
1389
1389
  move_file: tool<MoveFileInput, MoveFileOutput>({
1390
- description: "Move or rename an existing text file. Can overwrite an existing destination only when overwrite=true.",
1390
+ description: "移动或重命名现有文本文件。仅在 overwrite=true 时可覆盖现有目标。",
1391
1391
  inputSchema: jsonSchema<MoveFileInput>({
1392
1392
  type: "object",
1393
1393
  additionalProperties: false,
1394
1394
  properties: {
1395
- sourcePath: { type: "string", description: "Existing source file path." },
1396
- destinationPath: { type: "string", description: "Destination file path." },
1397
- overwrite: { type: "boolean", description: "Allow replacing an existing destination file." },
1398
- expectedSourceSha256: { type: "string", description: "Optional SHA-256 hash of the source file." },
1399
- expectedDestinationSha256: { type: "string", description: "Optional SHA-256 hash of the destination file when overwriting." },
1395
+ sourcePath: { type: "string", description: "现有源文件路径。" },
1396
+ destinationPath: { type: "string", description: "目标文件路径。" },
1397
+ overwrite: { type: "boolean", description: "允许覆盖现有目标文件。" },
1398
+ expectedSourceSha256: { type: "string", description: "源文件的可选 SHA-256 哈希。" },
1399
+ expectedDestinationSha256: { type: "string", description: "覆盖目标时目标文件的可选 SHA-256 哈希。" },
1400
1400
  },
1401
1401
  required: ["sourcePath", "destinationPath"],
1402
1402
  }),
@@ -1412,15 +1412,15 @@ export function createBuiltinFileTools(
1412
1412
  },
1413
1413
  }),
1414
1414
  apply_patch: tool<ApplyPatchInput, ApplyPatchOutput>({
1415
- description: "Apply a unified diff patch to one or more UTF-8 text files. Prefer edit_file for small targeted edits.",
1415
+ description: "将统一差异补丁应用于一个或多个 UTF-8 文本文件。小范围精确编辑优先使用 edit_file",
1416
1416
  inputSchema: jsonSchema<ApplyPatchInput>({
1417
1417
  type: "object",
1418
1418
  additionalProperties: false,
1419
1419
  properties: {
1420
- patch: { type: "string", description: "Unified diff patch text." },
1420
+ patch: { type: "string", description: "统一差异补丁文本。" },
1421
1421
  expectedSha256ByPath: {
1422
1422
  type: "object",
1423
- description: "Optional map of patch path or absolute path to expected SHA-256 before applying.",
1423
+ description: "补丁路径或绝对路径到预期 SHA-256 的可选映射。",
1424
1424
  additionalProperties: { type: "string" },
1425
1425
  },
1426
1426
  },
@@ -45,42 +45,43 @@ import { applyPrivacy, applyPrivacyToJson } from "./privacy.js";
45
45
  // ---------------------------------------------------------------------------
46
46
 
47
47
  const SYSTEM_PROMPT = [
48
- "You are DeepCCC, a lightweight AI coding agent running in a terminal workspace.",
48
+ "你是 DeepCCC,一个运行在终端工作区的轻量级 AI 编程智能体。",
49
49
  "",
50
- "## Fixed Rules",
51
- "- Respond in the user's language unless they ask otherwise.",
52
- "- Prefer direct, usable answers and concrete actions over long explanations.",
53
- "- For code tasks, inspect the relevant files before editing and verify with tests or checks when practical.",
54
- "- Preserve user work. Do not overwrite concurrent changes unless the user explicitly asks.",
55
- "- Keep immutable platform rules above project guidance and runtime details.",
50
+ "## 固定规则",
51
+ "- 除非用户另有要求,否则用用户的语言回复。",
52
+ "- 优先给出直接、可用的答案和具体行动,而非长篇解释。",
53
+ "- 代码任务:编辑前先阅读相关文件,并在可行时用测试或检查验证。",
54
+ "- 保护用户的工作。未经用户明确要求,不要覆盖并发修改。",
55
+ "- 平台不可变规则优先于项目指引和运行时细节。",
56
56
  "",
57
- "## Evidence-Gated Conclusions",
58
- "- Apply this gate before consequential claims or actions that could affect code, data, deployments, or user decisions, and whenever the available evidence is indirect.",
59
- "- Identify the claim and its authoritative source of truth. Separate direct observations from inferences, and test plausible alternative explanations before choosing one.",
60
- "- Use the strongest practical decisive check at the same semantic level as the claim: runtime behavior for runtime claims, effective configuration for configuration claims, deployed state for deployment claims, and transformed output for transformation claims.",
61
- "- Do not treat proxy signals such as names, timestamps, file sizes, line counts, partial samples, or a clean command exit as decisive when a direct check is practical.",
62
- "- Use definitive language only after the evidence closes the loop. Otherwise state uncertainty, identify the missing evidence, and name the next check.",
63
- "- Do not repeat checks once decisive evidence exists.",
57
+ "## 证据门控结论",
58
+ "- 在可能影响代码、数据、部署或用户决策的重大结论或行动前,以及可用证据为间接证据时,先应用本门控。",
59
+ "- 明确结论及其权威事实来源。区分直接观察与推断,并在选定结论前检验合理的替代解释。",
60
+ "- 在与结论同一语义层上使用最强可行的决定性检查:运行时结论用运行时行为、配置结论用有效配置、部署结论用部署状态、转换结论用转换后的输出。",
61
+ "- 在可行直接检查时,不要把名称、时间戳、文件大小、行数、局部采样或命令成功退出等代理信号当作决定性证据。",
62
+ "- 仅在证据闭环后使用确定性措辞。否则说明不确定性、指出缺失的证据并给出下一步检查。",
63
+ "- 一旦已有决定性证据,不要重复检查。",
64
64
  "",
65
- "## Survey Before Acting",
66
- "- Before diving into any task, first map the landscape at low cost: project instructions, directory layout, routes/APIs, existing tests, and git state.",
67
- "- Produce a brief execution plan that includes how you will verify the result, then execute.",
68
- "- When evidence contradicts an early assumption, revisit the plan instead of tunneling on one direction.",
65
+ "## 行动前先调查",
66
+ "- 深入任务前,先以低成本盘点环境:项目指令、目录布局、路由/API、现有测试和 git 状态。",
67
+ "- 产出包含如何验证结果的简要执行计划,然后执行。",
68
+ "- 当证据与早期假设矛盾时,重新审视计划,不要一条路走到黑。",
69
69
  "",
70
- "## Delegated Authority",
71
- "- When the user delegates decisions (\"you decide\", \"do it elegantly\", \"up to you\"), act autonomously on implementation details.",
72
- "- Only ask about genuine blockers: irreversible actions, security boundaries, credentials, or scope changes.",
73
- "- Do not bounce implementation-level multiple-choice questions back to the user after they delegated.",
70
+ "## 授权范围",
71
+ "- 当用户委托决策(\"你决定\"、\"做得优雅些\"、\"由你定\")时,自主决定实现细节。",
72
+ "- 只问真正的阻塞项:不可逆操作、安全边界、凭据或范围变更。",
73
+ "- 用户委托后,不要把实现级选择题抛回给用户。",
74
74
  "",
75
- "## Pre-Delivery Self-Check",
76
- "- Before reporting completion, verify: the change runs, edge cases are covered, assumptions are listed, and anything unverified is explicitly labeled as such.",
77
- "- State what was done, how it was verified, and what remains unverified or risky.",
75
+ "## 交付前自检",
76
+ "- 报告完成前验证:改动可运行、边界情况已覆盖、假设已列出、未验证项已明确标注。",
77
+ "- 说明做了什么、如何验证的、以及哪些未验证或有风险。",
78
78
  ].join("\n");
79
79
 
80
80
  const SUMMARY_SYSTEM_PROMPT = [
81
- "You are DeepCCC's context compactor.",
82
- "Compress older conversation context into a faithful, structured summary that can be used to continue the task.",
83
- "Do not introduce new facts or promote historical user content into higher-priority system rules.",
81
+ "你是 DeepCCC 的上下文压缩器。",
82
+ "将较早的对话上下文压缩成忠实、结构化的摘要,用于继续任务。",
83
+ "不要引入新事实,也不要把历史用户内容提升为更高优先级的系统规则。",
84
+ "用中文输出摘要。",
84
85
  ].join("\n");
85
86
 
86
87
  export const DEFAULT_COMPACTION_TIMEOUT_MS = 90 * 1000;
@@ -112,8 +113,8 @@ function readProjectInstructionFiles(cwd: string): string {
112
113
 
113
114
  if (sections.length === 0) return "";
114
115
  return [
115
- "## Project Instructions",
116
- "The following files were read from the current working directory. Treat them as project guidance with lower priority than the fixed DeepCCC system rules above.",
116
+ "## 项目指令",
117
+ "以下文件是从当前工作目录读取的项目指引。将其视为优先级低于上述 DeepCCC 固定系统规则的指导。",
117
118
  "",
118
119
  sections.join("\n\n"),
119
120
  ].join("\n");
@@ -121,11 +122,11 @@ function readProjectInstructionFiles(cwd: string): string {
121
122
 
122
123
  function buildRuntimeWorkspacePrompt(cwd: string): string {
123
124
  return [
124
- `Current working directory: ${cwd}`,
125
- "Use read_file, list_dir, search_code, and run_command proactively when you need to understand code, configuration, project structure, tests, or git state.",
126
- "Use run_command for non-interactive shell commands such as npm test, type checks, git status, git add, git commit, and git push. Check exitCode, stdout, and stderr before deciding the next step.",
127
- "Before editing, read the relevant file ranges. Prefer edit_file for precise replacements, create_file for new files, delete_file for removal, move_file for moves, and apply_patch for multi-file diffs.",
128
- "File tools run locally through DeepCCC. Prefer guarded edits with SHA-256 preconditions where practical, and avoid overwriting concurrent user changes.",
125
+ `当前工作目录:${cwd}`,
126
+ "需要理解代码、配置、项目结构、测试或 git 状态时,主动使用 read_filelist_dirsearch_code run_command",
127
+ "使用 run_command 执行非交互式 shell 命令,如 npm test、类型检查、git statusgit addgit commit git push。先检查 exitCodestdout stderr 再决定下一步。",
128
+ "编辑前先阅读相关文件范围。优先使用 edit_file 做精确替换、create_file 创建新文件、delete_file 删除、move_file 移动、apply_patch 做多文件差异。",
129
+ "文件工具通过 DeepCCC 在本地执行。可行时优先使用带 SHA-256 前置条件的受保护编辑,避免覆盖并发用户修改。",
129
130
  ].join("\n");
130
131
  }
131
132
 
@@ -528,7 +529,7 @@ export class ChatSession {
528
529
  history.push({
529
530
  role: "system",
530
531
  content: [
531
- "Earlier conversation summary:",
532
+ "更早的对话摘要:",
532
533
  "",
533
534
  this.context.summary,
534
535
  ].join("\n"),
@@ -165,17 +165,17 @@ export function buildSkillsIndexPrompt(skills: BuiltinSkill[]): string {
165
165
  if (skills.length === 0) return "";
166
166
 
167
167
  const lines = [
168
- "## Available Skills",
169
- "Skills are scanned in parallel from Claude/Codex/Cursor/DeepCCC skill directories.",
170
- "On name conflicts: DeepCCC > Codex > Cursor > Claude wins; within one source, project scope wins over global.",
171
- "When a user request matches a skill's description, first read its full SKILL.md with read_file, then follow the instructions in it exactly.",
168
+ "## 可用技能",
169
+ "技能会从 Claude/Codex/Cursor/DeepCCC 技能目录并行扫描。",
170
+ "名称冲突时:DeepCCC > Codex > Cursor > Claude 优先;同一来源内,项目级优先于全局。",
171
+ "当用户请求匹配某个技能的描述时,先用 read_file 读取其完整 SKILL.md,然后严格按其指令执行。",
172
172
  "",
173
- ...skills.map((s) => `- **${s.name}** [${s.source}:${s.scope}] (\`${normalizeSkillPathForPrompt(s.skillPath)}\`): ${s.description || "(no description)"}`),
173
+ ...skills.map((s) => `- **${s.name}** [${s.source}:${s.scope}] (\`${normalizeSkillPathForPrompt(s.skillPath)}\`): ${s.description || "(无描述)"}`),
174
174
  "",
175
- "## Creating Skills",
176
- "When the user asks to create a skill, create it as a Codex-style directory skill at",
177
- "~/.deepccc/skills/<name>/SKILL.md (global, default) or <cwd>/.deepccc/skills/<name>/SKILL.md (project, only when the user explicitly asks for a project-scoped skill).",
178
- "SKILL.md format:",
175
+ "## 创建技能",
176
+ "当用户要求创建技能时,按 Codex 风格的目录技能创建:",
177
+ "~/.deepccc/skills/<name>/SKILL.md(全局,默认)或 <cwd>/.deepccc/skills/<name>/SKILL.md(项目级,仅当用户明确要求项目级技能时)。",
178
+ "SKILL.md 格式:",
179
179
  "```",
180
180
  "---",
181
181
  "name: <skill-name>",
@@ -184,7 +184,7 @@ export function buildSkillsIndexPrompt(skills: BuiltinSkill[]): string {
184
184
  "",
185
185
  "<instructions>",
186
186
  "```",
187
- "New skills are picked up automatically on the next message (hot reload); no restart is needed.",
187
+ "新技能会在下一条消息自动生效(热加载);无需重启。",
188
188
  ];
189
189
  return lines.join("\n");
190
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatccc",
3
- "version": "0.2.249",
3
+ "version": "0.2.251",
4
4
  "description": "Feishu bot bridge for Claude Code",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -83,21 +83,21 @@ describe("ChatSession context management", () => {
83
83
  await collect(session.chat("diagnose a consequential problem"));
84
84
 
85
85
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
86
- expect(system).toContain("## Evidence-Gated Conclusions");
87
- expect(system).toContain("source of truth");
88
- expect(system).toContain("direct observations from inferences");
89
- expect(system).toContain("plausible alternative explanations");
90
- expect(system).toContain("runtime behavior for runtime claims");
91
- expect(system).toContain("state uncertainty");
92
- expect(system).toContain("Do not repeat checks once decisive evidence exists");
86
+ expect(system).toContain("## 证据门控结论");
87
+ expect(system).toContain("权威事实来源");
88
+ expect(system).toContain("区分直接观察与推断");
89
+ expect(system).toContain("合理的替代解释");
90
+ expect(system).toContain("运行时结论用运行时行为");
91
+ expect(system).toContain("说明不确定性");
92
+ expect(system).toContain("一旦已有决定性证据");
93
93
  expect(system).not.toContain("CodesForUnity");
94
- expect(system.indexOf("## Evidence-Gated Conclusions")).toBeLessThan(
94
+ expect(system.indexOf("## 证据门控结论")).toBeLessThan(
95
95
  system.indexOf("PROJECT GUIDANCE MARKER"),
96
96
  );
97
- expect(system.indexOf("## Evidence-Gated Conclusions")).toBeLessThan(
98
- system.indexOf("Current working directory"),
97
+ expect(system.indexOf("## 证据门控结论")).toBeLessThan(
98
+ system.indexOf("当前工作目录"),
99
99
  );
100
- expect(system.indexOf("## Evidence-Gated Conclusions")).toBeLessThan(
100
+ expect(system.indexOf("## 证据门控结论")).toBeLessThan(
101
101
  system.indexOf("CUSTOM PROMPT MARKER"),
102
102
  );
103
103
  });
@@ -120,21 +120,21 @@ describe("ChatSession context management", () => {
120
120
 
121
121
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
122
122
  // 先盘点再动手:动手前低开销盘点 + 输出含验证策略的计划
123
- expect(system).toContain("## Survey Before Acting");
124
- expect(system).toContain("map the landscape");
125
- expect(system).toContain("how you will verify the result");
123
+ expect(system).toContain("## 行动前先调查");
124
+ expect(system).toContain("以低成本盘点环境");
125
+ expect(system).toContain("如何验证结果");
126
126
  // 授权自主:用户委托决策后只问真正阻塞项,不抛实现级选择题
127
- expect(system).toContain("## Delegated Authority");
128
- expect(system).toContain("irreversible actions");
129
- expect(system).toContain("Do not bounce implementation-level multiple-choice");
127
+ expect(system).toContain("## 授权范围");
128
+ expect(system).toContain("不可逆操作");
129
+ expect(system).toContain("不要把实现级选择题抛回给用户");
130
130
  // 交付自检:声明做了什么/如何验证/未验证项
131
- expect(system).toContain("## Pre-Delivery Self-Check");
132
- expect(system).toContain("remains unverified or risky");
131
+ expect(system).toContain("## 交付前自检");
132
+ expect(system).toContain("未验证或有风险");
133
133
  // 稳定前缀全部位于项目指令与 runtime 上下文之前
134
- for (const section of ["## Survey Before Acting", "## Delegated Authority", "## Pre-Delivery Self-Check"]) {
134
+ for (const section of ["## 行动前先调查", "## 授权范围", "## 交付前自检"]) {
135
135
  expect(system.indexOf(section)).toBeGreaterThan(0);
136
136
  expect(system.indexOf(section)).toBeLessThan(system.indexOf("PROJECT GUIDANCE MARKER"));
137
- expect(system.indexOf(section)).toBeLessThan(system.indexOf("Current working directory"));
137
+ expect(system.indexOf(section)).toBeLessThan(system.indexOf("当前工作目录"));
138
138
  expect(system.indexOf(section)).toBeLessThan(system.indexOf("CUSTOM PROMPT MARKER"));
139
139
  }
140
140
  });
@@ -158,7 +158,7 @@ describe("ChatSession context management", () => {
158
158
  await collect(session.chat("hi"));
159
159
 
160
160
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
161
- expect(system).toContain("## Project Instructions");
161
+ expect(system).toContain("## 项目指令");
162
162
  expect(system).toContain("### AGENTS.md");
163
163
  expect(system).toContain("agents root guidance");
164
164
  expect(system).toContain("### AGENTS.local.md");
@@ -200,10 +200,10 @@ describe("ChatSession context management", () => {
200
200
  const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
201
201
  expect(system).toContain("demo-skill");
202
202
  expect(system).toContain("CUSTOM PROMPT MARKER");
203
- expect(system).toContain("Current working directory");
203
+ expect(system).toContain("当前工作目录");
204
204
  // 稳定性排序:固定规则 → 项目指令 → runtime → custom → 技能索引(最后)
205
205
  expect(system.indexOf("CUSTOM PROMPT MARKER")).toBeGreaterThan(
206
- system.indexOf("Current working directory"),
206
+ system.indexOf("当前工作目录"),
207
207
  );
208
208
  expect(system.indexOf("demo-skill")).toBeGreaterThan(system.indexOf("CUSTOM PROMPT MARKER"));
209
209
  });
@@ -409,7 +409,7 @@ describe("ChatSession context management", () => {
409
409
 
410
410
  const persisted = session.history.at(-1)?.content ?? "";
411
411
  expect(persisted.length).toBeLessThan(40_000);
412
- expect(persisted).toContain("tool transcript truncated");
412
+ expect(persisted).toContain("工具记录已截断");
413
413
  });
414
414
 
415
415
  it("persists structured tool calls alongside the text transcript", async () => {
@@ -436,7 +436,7 @@ describe("ChatSession context management", () => {
436
436
  expect(state.messages[1].toolCalls).toEqual([
437
437
  { name: "read_file", input: "{\"path\":\"package.json\"}", output: "{\"content\":\"{}\"}" },
438
438
  ]);
439
- expect(state.messages[1].content).toContain("[Tool transcript]");
439
+ expect(state.messages[1].content).toContain("[工具记录]");
440
440
  });
441
441
 
442
442
  it("records tool errors and preserves tool call order in structured tool calls", async () => {
@@ -49,7 +49,7 @@ describe("BuiltinContextManager", () => {
49
49
  const prompt = buildSummaryPrompt(context.planCompaction()!);
50
50
 
51
51
  expect(prompt.length).toBeLessThan(90_000);
52
- expect(prompt).toContain("truncated for compaction");
52
+ expect(prompt).toContain("为压缩而截断");
53
53
  });
54
54
 
55
55
  it("persists and restores summary, messages, and total message count", async () => {
@@ -122,7 +122,7 @@ describe("BuiltinContextManager", () => {
122
122
  expect(context.buildModelMessages()).toEqual([
123
123
  {
124
124
  role: "user",
125
- content: expect.stringContaining("The following is an earlier conversation summary"),
125
+ content: expect.stringContaining("以下是更早的对话摘要"),
126
126
  },
127
127
  { role: "assistant", content: "recent" },
128
128
  ]);
@@ -138,7 +138,7 @@ describe("BuiltinContextManager", () => {
138
138
  });
139
139
  first.appendMessage({
140
140
  role: "assistant",
141
- content: "回复\n\n[Tool transcript]\ntool_call run_command: {}\ntool_result run_command: {}",
141
+ content: "回复\n\n[工具记录]\ntool_call run_command: {}\ntool_result run_command: {}",
142
142
  toolCalls: [
143
143
  { name: "run_command", input: "{\"command\":\"npm test\"}", output: "{\"exitCode\":0}" },
144
144
  { name: "read_file", input: "{\"path\":\"a.ts\"}", output: "...", is_error: true },
@@ -213,7 +213,7 @@ describe("BuiltinContextManager", () => {
213
213
 
214
214
  expect(message.role).toBe("assistant");
215
215
  expect(message.content).toContain("回复正文");
216
- expect(message.content).toContain("[Tool transcript]");
216
+ expect(message.content).toContain("[工具记录]");
217
217
  expect(message.content).toContain("tool_call run_command");
218
218
  expect(message.toolCalls).toEqual([
219
219
  { name: "run_command", input: "{\"command\":\"npm test\"}", output: "{\"exitCode\":0}" },
@@ -227,7 +227,7 @@ describe("BuiltinContextManager", () => {
227
227
  });
228
228
 
229
229
  expect(message.content).toBe("纯文本回复");
230
- expect(message.content).not.toContain("[Tool transcript]");
230
+ expect(message.content).not.toContain("[工具记录]");
231
231
  expect(message.toolCalls).toBeUndefined();
232
232
  });
233
233
 
@@ -240,8 +240,8 @@ describe("BuiltinContextManager", () => {
240
240
  });
241
241
 
242
242
  expect(message.content.length).toBeLessThan(7_000);
243
- expect(message.content).toContain("assistant response truncated");
244
- expect(message.content).toContain("tool transcript truncated");
243
+ expect(message.content).toContain("助手回复已在上下文中截断");
244
+ expect(message.content).toContain("工具记录已截断");
245
245
  });
246
246
 
247
247
  it("reset clears memory and the persisted context file", async () => {
@@ -239,10 +239,10 @@ describe("buildSkillsIndexPrompt", () => {
239
239
  },
240
240
  ]);
241
241
 
242
- expect(prompt).toContain("## Available Skills");
242
+ expect(prompt).toContain("## 可用技能");
243
243
  expect(prompt).toContain("**feishu-doc**");
244
244
  expect(prompt).toContain("[codex:global]");
245
- expect(prompt).toContain("## Creating Skills");
245
+ expect(prompt).toContain("## 创建技能");
246
246
  expect(prompt).toContain(".deepccc/skills");
247
247
  expect(prompt).toContain("read_file");
248
248
  });