chatccc 0.2.259 → 0.2.261

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.
@@ -298,6 +298,8 @@ async function resolveUsageTarget(chatId) {
298
298
  return { tool: "cursor", sessionId: record?.sessionId };
299
299
  if (tool === "ccc")
300
300
  return { tool: "ccc", sessionId: record?.sessionId };
301
+ if (tool === "dsh")
302
+ return { tool: "dsh", sessionId: record?.sessionId };
301
303
  return { tool: "codex", sessionId: record?.sessionId };
302
304
  }
303
305
  catch {
@@ -345,25 +347,28 @@ function refreshUsageAvatar(platform, chatId, tool, status, usageHints, sessionI
345
347
  });
346
348
  }
347
349
  async function sendUsageSummary(platform, chatId, tool, avatarStatus = "idle", sessionId) {
348
- if (tool === "ccc") {
349
- const baseURL = config.ccc.DEEPSEEK_BASE_URL;
350
+ if (tool === "ccc" || tool === "dsh") {
351
+ const isDsh = tool === "dsh";
352
+ const baseURL = isDsh ? config.dsh.baseUrl : config.ccc.DEEPSEEK_BASE_URL;
353
+ const apiKey = isDsh ? config.dsh.apiKey : config.ccc.DEEPSEEK_API_KEY;
354
+ const toolLabel = isDsh ? "DeepSeek Harness" : "CCC";
350
355
  if (!isOfficialDeepSeek(baseURL)) {
351
- const msg = "CCC 用量查询仅支持官方 DeepSeek API (api.deepseek.com),当前使用的非官方接口不支持余额查询。";
356
+ const msg = `${toolLabel} 用量查询仅支持官方 DeepSeek API (api.deepseek.com),当前使用的非官方接口不支持余额查询。`;
352
357
  if (platform.kind === "wechat") {
353
358
  await platform.sendText(chatId, msg).catch(() => { });
354
359
  }
355
360
  else {
356
- await platform.sendCard(chatId, "CCC Usage", msg, "blue");
361
+ await platform.sendCard(chatId, `${toolLabel} Usage`, msg, "blue");
357
362
  }
358
363
  return;
359
364
  }
360
- const balance = await fetchDeepSeekBalance(config.ccc.DEEPSEEK_API_KEY, baseURL);
365
+ const balance = await fetchDeepSeekBalance(apiKey, baseURL);
361
366
  const content = formatDeepSeekBalance(balance);
362
367
  if (platform.kind === "wechat") {
363
368
  await platform.sendText(chatId, content).catch(() => { });
364
369
  }
365
370
  else {
366
- await platform.sendCard(chatId, "CCC Usage", content, "blue");
371
+ await platform.sendCard(chatId, `${toolLabel} Usage`, content, "blue");
367
372
  }
368
373
  return;
369
374
  }
@@ -396,7 +401,7 @@ async function sendUsageSummary(platform, chatId, tool, avatarStatus = "idle", s
396
401
  refreshUsageAvatar(platform, chatId, tool, avatarStatus, { codexUsage: usage }, sessionId);
397
402
  }
398
403
  async function sendUsageError(platform, chatId, tool, err) {
399
- const toolLabel = tool === "cursor" ? "Cursor" : tool === "ccc" ? "CCC" : "Codex";
404
+ const toolLabel = tool === "cursor" ? "Cursor" : tool === "ccc" ? "CCC" : tool === "dsh" ? "DeepSeek Harness" : "Codex";
400
405
  const message = `${toolLabel} 用量获取失败:${err.message}`;
401
406
  if (platform.kind === "wechat") {
402
407
  await platform.sendText(chatId, message).catch(() => { });
@@ -985,10 +990,10 @@ export async function handleCommand(platform, text, chatId, openId, msgTimestamp
985
990
  const toolArg = text.slice(5).trim().toLowerCase();
986
991
  const tool = toolArg || resolveDefaultAgentTool();
987
992
  logTrace(tid, "BRANCH", { cmd: "/new", tool });
988
- const validTools = ["claude", "cursor", "codex", "ccc"];
993
+ const validTools = ["claude", "cursor", "codex", "ccc", "dsh"];
989
994
  if (!validTools.includes(tool)) {
990
995
  logTrace(tid, "DONE", { outcome: "new_invalid_tool", tool });
991
- await platform.sendCard(chatId, "Error", `未知的工具类型: "${toolArg}"。支持: claude (Claude Code), cursor (Cursor), codex (Codex), ccc (CCC Agent)。`, "red");
996
+ await platform.sendCard(chatId, "Error", `未知的工具类型: "${toolArg}"。支持: claude (Claude Code), cursor (Cursor), codex (Codex), ccc (CCC Agent), dsh (DeepSeek Harness)。`, "red");
992
997
  return;
993
998
  }
994
999
  const toolLabel = toolDisplayName(tool);
@@ -1525,13 +1530,17 @@ export async function handleCommand(platform, text, chatId, openId, msgTimestamp
1525
1530
  const index = parseInt(sessionMatch[1], 10) - 1;
1526
1531
  logTrace(tid, "BRANCH", { cmd: "/session", index: index + 1 });
1527
1532
  const allSessions = await getAllSessionsStatus();
1528
- const claudeOrdered = allSessions.filter((s) => s.tool !== "cursor" && s.tool !== "codex");
1533
+ const claudeOrdered = allSessions.filter((s) => s.tool === "claude");
1529
1534
  const cursorOrdered = allSessions.filter((s) => s.tool === "cursor");
1530
1535
  const codexOrdered = allSessions.filter((s) => s.tool === "codex");
1536
+ const cccOrdered = allSessions.filter((s) => s.tool === "ccc");
1537
+ const dshOrdered = allSessions.filter((s) => s.tool === "dsh");
1531
1538
  const ordered = [
1532
1539
  ...claudeOrdered,
1533
1540
  ...cursorOrdered,
1534
1541
  ...codexOrdered,
1542
+ ...cccOrdered,
1543
+ ...dshOrdered,
1535
1544
  ];
1536
1545
  if (ordered.length === 0) {
1537
1546
  await platform.sendCard(chatId, "/session", "暂无历史会话。", "yellow");
@@ -1941,6 +1950,8 @@ export async function handleCommand(platform, text, chatId, openId, msgTimestamp
1941
1950
  currentModel = config.codex.model;
1942
1951
  else if (defaultTool === "ccc")
1943
1952
  currentModel = config.ccc.model;
1953
+ else if (defaultTool === "dsh")
1954
+ currentModel = config.dsh.model;
1944
1955
  else
1945
1956
  currentModel = CLAUDE_MODEL;
1946
1957
  if (platform.kind === "wechat") {
@@ -10,6 +10,7 @@ import { createClaudeAdapter } from "./adapters/claude-adapter.js";
10
10
  import { createCursorAdapter } from "./adapters/cursor-adapter.js";
11
11
  import { createCodexAdapter } from "./adapters/codex-adapter.js";
12
12
  import { createCccAdapter } from "./adapters/ccc-adapter.js";
13
+ import { createDshAdapter } from "./adapters/dsh-adapter.js";
13
14
  import { killProcessTree } from "./adapters/proc-tree-kill.js";
14
15
  import { resourceMonitor, registerProcess, unregisterProcess } from "./adapters/resource-monitor.js";
15
16
  import { buildImSkillsPromptCached, exportSkillSubDocs } from "./im-skills.js";
@@ -418,6 +419,8 @@ export function getEffectiveModelForTool(tool, sessionId) {
418
419
  return config.codex.model;
419
420
  if (tool === "ccc")
420
421
  return config.ccc.model;
422
+ if (tool === "dsh")
423
+ return config.dsh.model;
421
424
  return CLAUDE_MODEL;
422
425
  }
423
426
  export function getEffectiveEffortForTool(tool, sessionId) {
@@ -536,6 +539,15 @@ export function getAdapterForTool(tool, sessionId) {
536
539
  ...(config.ccc.subModel ? { subModel: config.ccc.subModel } : {}),
537
540
  });
538
541
  }
542
+ else if (tool === "dsh") {
543
+ adapter = createDshAdapter({
544
+ apiKey: config.dsh.apiKey,
545
+ baseUrl: config.dsh.baseUrl,
546
+ model: effectiveModel || config.dsh.model,
547
+ provider: config.dsh.provider,
548
+ maxTokens: config.dsh.maxTokens,
549
+ });
550
+ }
539
551
  else {
540
552
  adapter = createClaudeAdapter({
541
553
  model: effectiveModel,
@@ -852,6 +864,10 @@ function formatToolConfigForLog(tool, sessionModel, sessionId) {
852
864
  const modelStr = m.trim() !== "" ? m : "(not configured)";
853
865
  return `model=${modelStr}, baseURL=${config.ccc.DEEPSEEK_BASE_URL}`;
854
866
  }
867
+ if (tool === "dsh") {
868
+ const model = getEffectiveModelForTool(tool, sessionId);
869
+ return `model=${model || "(not configured)"}, baseURL=${config.dsh.baseUrl}`;
870
+ }
855
871
  return `model=${anthropicConfigDisplay(getModelForSession(sessionId))}, subagentModel=${anthropicConfigDisplay(CLAUDE_SUBAGENT_MODEL)}, effort=${anthropicConfigDisplay(getEffectiveEffortForTool(tool, sessionId))}`;
856
872
  }
857
873
  export async function initClaudeSession(tool, overrideCwd, chatId) {
@@ -2061,6 +2077,13 @@ async function resolveModelEffort(tool, sessionId) {
2061
2077
  effort: null,
2062
2078
  };
2063
2079
  }
2080
+ if (tool === "dsh") {
2081
+ const model = getEffectiveModelForTool(tool, sessionId);
2082
+ return {
2083
+ model: model.trim() !== "" ? model : UNKNOWN_MODEL_PLACEHOLDER,
2084
+ effort: null,
2085
+ };
2086
+ }
2064
2087
  return {
2065
2088
  model: anthropicConfigDisplay(getModelForSession(sessionId)),
2066
2089
  effort: anthropicConfigDisplay(getEffectiveEffortForTool(tool, sessionId)),