chatccc 0.2.300 → 0.2.302

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.
Files changed (55) hide show
  1. package/.agents/skills/create-chatccc-feishu-app/SKILL.md +85 -85
  2. package/.claude/skills/create-chatccc-feishu-app/SKILL.md +85 -85
  3. package/.cursor/skills/create-chatccc-feishu-app/SKILL.md +85 -85
  4. package/README.md +8 -3
  5. package/agent-prompts/claude_specific.md +45 -45
  6. package/agent-prompts/codex_specific.md +2 -2
  7. package/agent-prompts/cursor_specific.md +13 -13
  8. package/bin/cccagent.mjs +26 -26
  9. package/bin/chatccc.mjs +15 -15
  10. package/config.sample.json +7 -6
  11. package/deepccc-agent/README.md +21 -4
  12. package/deepccc-agent/os-prompts/darwin.md +8 -8
  13. package/deepccc-agent/os-prompts/linux.md +8 -8
  14. package/deepccc-agent/os-prompts/win32.md +11 -11
  15. package/deepccc-agent/package.json +68 -68
  16. package/dist/deepccc-agent/src/attachments.js +7 -5
  17. package/dist/deepccc-agent/src/cli.js +52 -7
  18. package/dist/deepccc-agent/src/completion-session.js +100 -0
  19. package/dist/deepccc-agent/src/config.js +4 -0
  20. package/dist/deepccc-agent/src/context.js +4 -1
  21. package/dist/deepccc-agent/src/decision-session.js +314 -0
  22. package/dist/deepccc-agent/src/file-tools.js +5 -0
  23. package/dist/deepccc-agent/src/index.js +41 -4
  24. package/dist/deepccc-agent/src/json-mode-fetch.js +12 -0
  25. package/dist/deepccc-agent/src/json-response.js +33 -0
  26. package/dist/deepccc-agent/src/multimodal.js +291 -0
  27. package/dist/deepccc-agent/src/progress/reducer.js +2 -0
  28. package/dist/deepccc-agent/src/web-page.js +411 -411
  29. package/dist/deepccc-agent/src/web-runtime.js +3 -0
  30. package/dist/deepccc-agent/src/web-server.js +2 -0
  31. package/dist/src/adapters/ccc-adapter.js +4 -0
  32. package/dist/src/agent-team/web/agent-team-page.js +250 -250
  33. package/dist/src/config.js +2 -0
  34. package/dist/src/engines/engine-specs.js +71 -71
  35. package/dist/src/feishu-api.js +11 -11
  36. package/dist/src/format-message.js +38 -19
  37. package/dist/src/litellm-proxy.js +15 -15
  38. package/dist/src/progress/reducer.js +2 -0
  39. package/dist/src/session.js +1 -0
  40. package/dist/src/web-ui.js +80 -66
  41. package/im-skills/feishu-skill/receive-send-file.md +65 -65
  42. package/im-skills/feishu-skill/receive-send-image.md +26 -26
  43. package/im-skills/feishu-skill/send-file.mjs +6 -6
  44. package/im-skills/feishu-skill/send-image.mjs +6 -6
  45. package/im-skills/feishu-skill/skill.md +28 -28
  46. package/im-skills/wechat-file-skill/receive-send-file.md +38 -38
  47. package/im-skills/wechat-file-skill/send-file.mjs +83 -83
  48. package/im-skills/wechat-file-skill/skill.md +10 -10
  49. package/im-skills/wechat-image-skill/skill.md +10 -10
  50. package/im-skills/wechat-video-skill/receive-send-video.md +38 -38
  51. package/im-skills/wechat-video-skill/send-video.mjs +79 -79
  52. package/im-skills/wechat-video-skill/skill.md +10 -10
  53. package/package.json +77 -77
  54. package/scripts/postinstall-sharp-check.mjs +58 -58
  55. package/scripts/self-update-helper.mjs +301 -301
@@ -324,6 +324,7 @@ function loadConfig() {
324
324
  DEEPSEEK_API_KEY: "",
325
325
  DEEPSEEK_BASE_URL: DEFAULT_CCC_DEEPSEEK_BASE_URL,
326
326
  model: DEFAULT_CCC_MODEL,
327
+ visionModel: "",
327
328
  subModel: "",
328
329
  alternativeModel: "",
329
330
  effort: "",
@@ -536,6 +537,7 @@ function loadConfig() {
536
537
  }),
537
538
  model: normalizeOptionalConfigField(cccRaw.model, { label: "ccc.model", fallback: DEFAULT_CCC_MODEL }),
538
539
  subModel: normalizeOptionalConfigField(cccRaw.subModel, { label: "ccc.subModel" }),
540
+ visionModel: normalizeOptionalConfigField(cccRaw.visionModel, { label: "ccc.visionModel" }),
539
541
  alternativeModel: normalizeOptionalConfigField(cccRaw.alternativeModel, { label: "ccc.alternativeModel" }),
540
542
  effort: normalizeOptionalConfigField(cccRaw.effort, { label: "ccc.effort" }),
541
543
  maxOutputTokens: normalizeNullablePositiveInteger(cccRaw.maxOutputTokens, "ccc.maxOutputTokens"),
@@ -33,77 +33,77 @@ const DSH_PACKAGES = {
33
33
  "@deepseek-ai/dsh-token-meter": DSH_ENGINE_VERSION,
34
34
  "@deepseek-ai/dsh-compaction-basic": DSH_ENGINE_VERSION,
35
35
  };
36
- export const DSH_RUNTIME_CONFIG = `# Generated and owned by ChatCCC. Secrets are supplied through the child environment.
37
- - id: sdk-jsonrpc-server
38
- name: '@deepseek-ai/dsh-sdk-jsonrpc-server'
39
- config:
40
- maxTokensAsSuccess: true
41
- - id: agent-core
42
- name: '@deepseek-ai/dsh-agent-spine-demo'
43
- config:
44
- persona: !!js process.env.DSH_SYSTEM_PROMPT ?? 'You are a coding agent.'
45
- workspaceContext: false
46
- skills:
47
- enabled: false
48
- toolBash:
49
- enableRunInBackground: false
50
- toolJobs: false
51
- - id: llm-deepseek
52
- name: '@deepseek-ai/dsh-llm-deepseek'
53
- config:
54
- thinking: enabled
55
- reasoningEffort: max
56
- - id: sessions
57
- name: '@deepseek-ai/dsh-session-persistence-jsonl'
58
- config:
59
- root: !!js process.env.DSH_SESSION_ROOT
60
- compression: zstd
61
- - id: session-checkpoints
62
- name: '@deepseek-ai/dsh-session-checkpoint-policy'
63
- - id: subprocess
64
- name: '@deepseek-ai/dsh-subprocess-local'
65
- - id: bash
66
- name: '@deepseek-ai/dsh-bash-local'
67
- config:
68
- cwd: !!js process.env.DSH_CWD
69
- timeoutMs: 60000
70
- - id: fs-local
71
- name: '@deepseek-ai/dsh-fs-local'
72
- config:
73
- cwd: !!js process.env.DSH_CWD
74
- - id: subagent
75
- name: '@deepseek-ai/dsh-subagent'
76
- - id: subagent-spawn-in-process
77
- name: '@deepseek-ai/dsh-subagent-spawn-in-process'
78
- config:
79
- providerName: spawn
80
- - id: tool-subagent
81
- name: '@deepseek-ai/dsh-tool-subagent'
82
- config:
83
- provider: spawn
84
- toolName: subagent
85
- enableRunInBackground: false
86
- agentOptions:
87
- provider: !!js process.env.DSH_SUBAGENT_PROVIDER ?? 'deepseek-official'
88
- model: !!js process.env.DSH_SUBAGENT_MODEL ?? 'deepseek-v4-flash'
89
- maxTokens: !!js Number(process.env.DSH_SUBAGENT_MAX_TOKENS ?? '49152')
90
- - id: tool-todo
91
- name: '@deepseek-ai/dsh-tool-todo'
92
- config:
93
- allowParallelInProgress: true
94
- - id: fs-observation-policy
95
- name: '@deepseek-ai/dsh-fs-observation-policy'
96
- - id: tool-fs
97
- name: '@deepseek-ai/dsh-tool-fs'
98
- - id: token-meter
99
- name: '@deepseek-ai/dsh-token-meter'
100
- - id: compaction-basic
101
- name: '@deepseek-ai/dsh-compaction-basic'
102
- config:
103
- thresholdRatio: 0.8
104
- retainRatio: 0.16
105
- maxTokens: 8192
106
- compactionRetries: 1
36
+ export const DSH_RUNTIME_CONFIG = `# Generated and owned by ChatCCC. Secrets are supplied through the child environment.
37
+ - id: sdk-jsonrpc-server
38
+ name: '@deepseek-ai/dsh-sdk-jsonrpc-server'
39
+ config:
40
+ maxTokensAsSuccess: true
41
+ - id: agent-core
42
+ name: '@deepseek-ai/dsh-agent-spine-demo'
43
+ config:
44
+ persona: !!js process.env.DSH_SYSTEM_PROMPT ?? 'You are a coding agent.'
45
+ workspaceContext: false
46
+ skills:
47
+ enabled: false
48
+ toolBash:
49
+ enableRunInBackground: false
50
+ toolJobs: false
51
+ - id: llm-deepseek
52
+ name: '@deepseek-ai/dsh-llm-deepseek'
53
+ config:
54
+ thinking: enabled
55
+ reasoningEffort: max
56
+ - id: sessions
57
+ name: '@deepseek-ai/dsh-session-persistence-jsonl'
58
+ config:
59
+ root: !!js process.env.DSH_SESSION_ROOT
60
+ compression: zstd
61
+ - id: session-checkpoints
62
+ name: '@deepseek-ai/dsh-session-checkpoint-policy'
63
+ - id: subprocess
64
+ name: '@deepseek-ai/dsh-subprocess-local'
65
+ - id: bash
66
+ name: '@deepseek-ai/dsh-bash-local'
67
+ config:
68
+ cwd: !!js process.env.DSH_CWD
69
+ timeoutMs: 60000
70
+ - id: fs-local
71
+ name: '@deepseek-ai/dsh-fs-local'
72
+ config:
73
+ cwd: !!js process.env.DSH_CWD
74
+ - id: subagent
75
+ name: '@deepseek-ai/dsh-subagent'
76
+ - id: subagent-spawn-in-process
77
+ name: '@deepseek-ai/dsh-subagent-spawn-in-process'
78
+ config:
79
+ providerName: spawn
80
+ - id: tool-subagent
81
+ name: '@deepseek-ai/dsh-tool-subagent'
82
+ config:
83
+ provider: spawn
84
+ toolName: subagent
85
+ enableRunInBackground: false
86
+ agentOptions:
87
+ provider: !!js process.env.DSH_SUBAGENT_PROVIDER ?? 'deepseek-official'
88
+ model: !!js process.env.DSH_SUBAGENT_MODEL ?? 'deepseek-v4-flash'
89
+ maxTokens: !!js Number(process.env.DSH_SUBAGENT_MAX_TOKENS ?? '49152')
90
+ - id: tool-todo
91
+ name: '@deepseek-ai/dsh-tool-todo'
92
+ config:
93
+ allowParallelInProgress: true
94
+ - id: fs-observation-policy
95
+ name: '@deepseek-ai/dsh-fs-observation-policy'
96
+ - id: tool-fs
97
+ name: '@deepseek-ai/dsh-tool-fs'
98
+ - id: token-meter
99
+ name: '@deepseek-ai/dsh-token-meter'
100
+ - id: compaction-basic
101
+ name: '@deepseek-ai/dsh-compaction-basic'
102
+ config:
103
+ thresholdRatio: 0.8
104
+ retainRatio: 0.16
105
+ maxTokens: 8192
106
+ compactionRetries: 1
107
107
  `;
108
108
  export const ENGINE_SPECS = [
109
109
  {
@@ -720,17 +720,17 @@ function buildCodexFastFrameOverlay() {
720
720
  const size = AVATAR_BADGE_SIZE + 20;
721
721
  const innerOffset = 9;
722
722
  const innerSize = size - innerOffset * 2;
723
- const frame = Buffer.from(`
724
- <svg width="${size}" height="${size}" xmlns="http://www.w3.org/2000/svg">
725
- <defs>
726
- <linearGradient id="champagne" x1="0" y1="0" x2="${size}" y2="${size}" gradientUnits="userSpaceOnUse">
727
- <stop offset="0" stop-color="#FFF0BE"/>
728
- <stop offset="0.55" stop-color="#FFD56A"/>
729
- <stop offset="1" stop-color="#EFA923"/>
730
- </linearGradient>
731
- </defs>
732
- <rect x="0.5" y="0.5" width="${size - 1}" height="${size - 1}" rx="25" fill="url(#champagne)"/>
733
- <rect x="${innerOffset}" y="${innerOffset}" width="${innerSize}" height="${innerSize}" rx="21" fill="#fffdf4"/>
723
+ const frame = Buffer.from(`
724
+ <svg width="${size}" height="${size}" xmlns="http://www.w3.org/2000/svg">
725
+ <defs>
726
+ <linearGradient id="champagne" x1="0" y1="0" x2="${size}" y2="${size}" gradientUnits="userSpaceOnUse">
727
+ <stop offset="0" stop-color="#FFF0BE"/>
728
+ <stop offset="0.55" stop-color="#FFD56A"/>
729
+ <stop offset="1" stop-color="#EFA923"/>
730
+ </linearGradient>
731
+ </defs>
732
+ <rect x="0.5" y="0.5" width="${size - 1}" height="${size - 1}" rx="25" fill="url(#champagne)"/>
733
+ <rect x="${innerOffset}" y="${innerOffset}" width="${innerSize}" height="${innerSize}" rx="21" fill="#fffdf4"/>
734
734
  </svg>`);
735
735
  return {
736
736
  input: frame,
@@ -32,7 +32,7 @@ export async function formatMessageContent(message) {
32
32
  return text.trim();
33
33
  }
34
34
  if (message.message_type === "post") {
35
- return formatPostContentWithImages(content, message.message_id);
35
+ return formatPostContentWithAttachments(content, message.message_id);
36
36
  }
37
37
  if (message.message_type === "image") {
38
38
  const imageKey = content.image_key;
@@ -50,20 +50,10 @@ export async function formatMessageContent(message) {
50
50
  }
51
51
  }
52
52
  if (message.message_type === "media") {
53
- const fileKey = content.file_key;
54
- const fileName = content.file_name || "video.mp4";
55
- const messageId = message.message_id;
56
- if (!fileKey || !messageId)
57
- return contentStr;
58
- return `[视频] message_id=${messageId} file_key=${fileKey} file_name=${fileName}`;
53
+ return formatFileAttachment("media", content, message.message_id);
59
54
  }
60
55
  if (message.message_type === "file") {
61
- const fileKey = content.file_key;
62
- const fileName = content.file_name || "download.bin";
63
- const messageId = message.message_id;
64
- if (!fileKey || !messageId)
65
- return contentStr;
66
- return `[文件] message_id=${messageId} file_key=${fileKey} file_name=${fileName}`;
56
+ return formatFileAttachment("file", content, message.message_id);
67
57
  }
68
58
  if (message.message_type === "interactive") {
69
59
  const raw = JSON.stringify(content);
@@ -109,8 +99,32 @@ function getPostParagraphs(content) {
109
99
  }
110
100
  return [];
111
101
  }
112
- function formatPostTextElement(el) {
102
+ function attachmentString(value) {
103
+ return typeof value === "string" ? value.trim() : "";
104
+ }
105
+ /** Preserve downloadable resource metadata; a media image_key is only its cover. */
106
+ function formatFileAttachment(type, content, messageId) {
107
+ const fileKey = attachmentString(content.file_key);
108
+ const fileName = attachmentString(content.file_name) || (type === "media" ? "video.mp4" : "download.bin");
109
+ const coverKey = type === "media" ? attachmentString(content.image_key) : "";
110
+ const parts = [type === "media" ? "[视频]" : "[文件]"];
111
+ if (messageId)
112
+ parts.push(`message_id=${messageId}`);
113
+ if (fileKey)
114
+ parts.push(`file_key=${fileKey}`);
115
+ parts.push(`file_name=${fileName}`);
116
+ if (coverKey)
117
+ parts.push(`cover_image_key=${coverKey}`);
118
+ const missing = [!messageId ? "message_id" : "", !fileKey ? "file_key" : ""].filter(Boolean);
119
+ if (missing.length)
120
+ parts.push(`(附件元数据不完整:缺少 ${missing.join("、")},无法下载原附件)`);
121
+ return parts.join(" ");
122
+ }
123
+ function formatPostTextElement(el, messageId) {
113
124
  const t = typeof el.text === "string" ? el.text : "";
125
+ if (el.tag === "media" || el.tag === "file") {
126
+ return formatFileAttachment(el.tag, el, messageId);
127
+ }
114
128
  // 超链接元素:必须保留 URL,否则 AI 拿不到链接(飞书 post 里链接是独立元素,
115
129
  // 不与相邻 text 合并)。文本与 URL 相同时只输出 URL,避免 "url (url)" 冗余。
116
130
  if (el.tag === "a") {
@@ -129,7 +143,7 @@ function formatPostTextElement(el) {
129
143
  return t;
130
144
  }
131
145
  // 图片元素由 getPostImageKey 单独处理(可能带 image_key/file_key),此处不重复输出。
132
- if (el.tag === "img" || getPostImageKey(el))
146
+ if (el.tag === "img")
133
147
  return "";
134
148
  // 兜底:飞书可能新增富文本元素类型,而历史上曾因入口重写而整类元素被静默丢弃
135
149
  // (见 tag="a" 丢失链接)。未知 tag 不再静默丢弃,尽量透传可读内容并留 warn 日志,
@@ -140,11 +154,16 @@ function formatPostTextElement(el) {
140
154
  const fallback = t && href && t !== href
141
155
  ? `[${t}](${href})`
142
156
  : t || href || (userName ? `@${userName}` : "");
157
+ // Unknown attachment types must not be mistaken for images or silently lost.
158
+ const attachment = el.file_key || el.image_key ? `[未知附件] ${JSON.stringify(el)}` : "";
159
+ const readable = [fallback, attachment].filter(Boolean).join("\n");
143
160
  console.warn(`[${ts()}] [POST] 未知富文本元素 tag=${tag},` +
144
- (fallback ? `已降级透传:${fallback}` : "无可透传内容,已丢弃(请补充分支)"));
145
- return fallback;
161
+ (readable ? `已降级透传:${readable}` : "无可透传内容,已丢弃(请补充分支)"));
162
+ return readable;
146
163
  }
147
164
  function getPostImageKey(el) {
165
+ if (el.tag !== "img")
166
+ return undefined;
148
167
  const imageKey = el.image_key;
149
168
  if (typeof imageKey === "string" && imageKey.trim())
150
169
  return imageKey;
@@ -155,7 +174,7 @@ function getPostImageKey(el) {
155
174
  }
156
175
  return undefined;
157
176
  }
158
- async function formatPostContentWithImages(content, messageId) {
177
+ async function formatPostContentWithAttachments(content, messageId) {
159
178
  const paragraphs = getPostParagraphs(content);
160
179
  if (!Array.isArray(paragraphs))
161
180
  return "";
@@ -167,7 +186,7 @@ async function formatPostContentWithImages(content, messageId) {
167
186
  const el = elem;
168
187
  if (!el || typeof el !== "object")
169
188
  continue;
170
- const text = formatPostTextElement(el);
189
+ const text = formatPostTextElement(el, messageId);
171
190
  if (text)
172
191
  parts.push(text);
173
192
  const imageKey = getPostImageKey(el);
@@ -72,21 +72,21 @@ function readConfig() {
72
72
  };
73
73
  }
74
74
  function printHelp() {
75
- console.log(`Usage: npm run claude-proxy -- [options]
76
-
77
- Options:
78
- --host <host> Listen host, default 127.0.0.1
79
- --port <port> Listen port, default 18081
80
- --upstream <url> Upstream LiteLLM base URL, default https://litellm.hypergryph.net
81
- --log-dir <path> Log directory, default %USERPROFILE%/.chatccc/logs/litellm-proxy
82
- --log-secrets Log sensitive headers instead of redacting them
83
-
84
- Equivalent env vars:
85
- CHATCCC_LITELLM_PROXY_HOST
86
- CHATCCC_LITELLM_PROXY_PORT
87
- CHATCCC_LITELLM_PROXY_UPSTREAM
88
- CHATCCC_LITELLM_PROXY_LOG_DIR
89
- CHATCCC_LITELLM_PROXY_LOG_SECRETS=1
75
+ console.log(`Usage: npm run claude-proxy -- [options]
76
+
77
+ Options:
78
+ --host <host> Listen host, default 127.0.0.1
79
+ --port <port> Listen port, default 18081
80
+ --upstream <url> Upstream LiteLLM base URL, default https://litellm.hypergryph.net
81
+ --log-dir <path> Log directory, default %USERPROFILE%/.chatccc/logs/litellm-proxy
82
+ --log-secrets Log sensitive headers instead of redacting them
83
+
84
+ Equivalent env vars:
85
+ CHATCCC_LITELLM_PROXY_HOST
86
+ CHATCCC_LITELLM_PROXY_PORT
87
+ CHATCCC_LITELLM_PROXY_UPSTREAM
88
+ CHATCCC_LITELLM_PROXY_LOG_DIR
89
+ CHATCCC_LITELLM_PROXY_LOG_SECRETS=1
90
90
  `);
91
91
  }
92
92
  function nextRequestId() {
@@ -50,6 +50,8 @@ export function summarizeToolResult(content, maxChars = 120) {
50
50
  */
51
51
  export function reduceProgress(prev, event) {
52
52
  switch (event.type) {
53
+ case "image_input":
54
+ return withProgressView(prev, { headerTitle: `图片理解:${event.model}(${event.count} 张)` });
53
55
  case "status":
54
56
  return withProgressView(prev, {
55
57
  headerTitle: event.phase === "compacting" ? "压缩上下文中..." : "生成回复中...",
@@ -571,6 +571,7 @@ export function getAdapterForTool(tool, sessionId) {
571
571
  // 留空("")不传 → ChatSession 跟随 DeepCCC 内核配置(~/.deepccc/config.json 或 DEEPCCC_PROVIDER)
572
572
  ...(config.ccc.provider ? { provider: config.ccc.provider } : {}),
573
573
  ...(config.ccc.subModel ? { subModel: config.ccc.subModel } : {}),
574
+ ...(config.ccc.visionModel ? { visionModel: config.ccc.visionModel } : {}),
574
575
  ...(config.ccc.gitCoAuthor !== null ? { gitCoAuthor: config.ccc.gitCoAuthor } : {}),
575
576
  hasPendingInjection,
576
577
  });