chatccc 0.2.201 → 0.2.203
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.
- package/README.md +23 -21
- package/agent-prompts/claude_specific.md +45 -45
- package/agent-prompts/codex_specific.md +2 -2
- package/agent-prompts/cursor_specific.md +13 -13
- package/bin/cccagent.mjs +17 -17
- package/config.sample.json +27 -27
- package/im-skills/feishu-skill/receive-send-file.md +63 -63
- package/im-skills/feishu-skill/receive-send-image.md +24 -24
- package/im-skills/feishu-skill/skill.md +3 -3
- package/im-skills/wechat-file-skill/receive-send-file.md +38 -38
- package/im-skills/wechat-file-skill/send-file.mjs +83 -83
- package/im-skills/wechat-file-skill/skill.md +10 -10
- package/im-skills/wechat-image-skill/skill.md +10 -10
- package/im-skills/wechat-video-skill/receive-send-video.md +38 -38
- package/im-skills/wechat-video-skill/send-video.mjs +79 -79
- package/im-skills/wechat-video-skill/skill.md +10 -10
- package/package.json +1 -1
- package/scripts/postinstall-sharp-check.mjs +58 -58
- package/src/__tests__/agent-delegate-task-rpc.test.ts +165 -165
- package/src/__tests__/agent-reload-config-rpc.test.ts +99 -99
- package/src/__tests__/builtin-chat-session.test.ts +277 -277
- package/src/__tests__/builtin-cli-json.test.ts +39 -39
- package/src/__tests__/builtin-config.test.ts +33 -33
- package/src/__tests__/builtin-context.test.ts +163 -163
- package/src/__tests__/builtin-file-tools.test.ts +224 -224
- package/src/__tests__/builtin-session-select.test.ts +116 -116
- package/src/__tests__/builtin-sigint.test.ts +56 -56
- package/src/__tests__/card-plain-text.test.ts +5 -5
- package/src/__tests__/cardkit.test.ts +60 -60
- package/src/__tests__/cards.test.ts +133 -122
- package/src/__tests__/ccc-adapter.test.ts +114 -114
- package/src/__tests__/chatgpt-subscription-rpc.test.ts +89 -89
- package/src/__tests__/chatgpt-subscription.test.ts +135 -135
- package/src/__tests__/chrome-devtools-guard.test.ts +165 -165
- package/src/__tests__/claude-adapter.test.ts +592 -592
- package/src/__tests__/claude-raw-stream-log.test.ts +87 -87
- package/src/__tests__/codex-raw-stream-log.test.ts +163 -163
- package/src/__tests__/codex-reset-actions.test.ts +146 -146
- package/src/__tests__/config-reload.test.ts +10 -10
- package/src/__tests__/config-sample.test.ts +18 -18
- package/src/__tests__/cursor-adapter.test.ts +226 -226
- package/src/__tests__/feishu-api.test.ts +60 -60
- package/src/__tests__/feishu-avatar.test.ts +90 -90
- package/src/__tests__/feishu-platform.test.ts +22 -22
- package/src/__tests__/format-message.test.ts +47 -47
- package/src/__tests__/jsonl-stream.test.ts +79 -79
- package/src/__tests__/orchestrator.test.ts +464 -301
- package/src/__tests__/privacy.test.ts +198 -198
- package/src/__tests__/raw-stream-log.test.ts +106 -106
- package/src/__tests__/session.test.ts +46 -44
- package/src/__tests__/shared-prefix.test.ts +36 -36
- package/src/__tests__/sim-platform.test.ts +12 -12
- package/src/__tests__/stream-state.test.ts +42 -42
- package/src/__tests__/update-command-guard.test.ts +144 -0
- package/src/__tests__/web-ui.test.ts +209 -209
- package/src/adapters/ccc-adapter.ts +121 -121
- package/src/adapters/claude-adapter.ts +603 -603
- package/src/adapters/claude-session-meta-store.ts +120 -120
- package/src/adapters/codex-adapter.ts +380 -380
- package/src/adapters/cursor-adapter.ts +673 -673
- package/src/adapters/jsonl-stream.ts +157 -157
- package/src/adapters/raw-stream-log.ts +124 -124
- package/src/adapters/resource-monitor.ts +140 -140
- package/src/agent-delegate-task-rpc.ts +153 -153
- package/src/agent-delegate-task.ts +81 -81
- package/src/agent-reload-config-rpc.ts +34 -34
- package/src/agent-stop-stuck.ts +129 -129
- package/src/builtin/cli.ts +473 -473
- package/src/builtin/context.ts +323 -323
- package/src/builtin/file-tools.ts +1072 -1072
- package/src/builtin/index.ts +404 -404
- package/src/builtin/session-select.ts +48 -48
- package/src/builtin/sigint.ts +50 -50
- package/src/cards.ts +222 -210
- package/src/chatgpt-subscription-rpc.ts +27 -27
- package/src/chatgpt-subscription.ts +299 -299
- package/src/chrome-devtools-guard.ts +318 -318
- package/src/codex-reset-actions.ts +184 -184
- package/src/config.ts +125 -125
- package/src/feishu-api.ts +118 -118
- package/src/feishu-platform.ts +20 -20
- package/src/format-message.ts +293 -293
- package/src/index.ts +48 -9
- package/src/litellm-proxy.ts +374 -374
- package/src/orchestrator.ts +391 -346
- package/src/privacy.ts +118 -118
- package/src/runtime-reload.ts +34 -34
- package/src/session-chat-binding.ts +6 -6
- package/src/session-name.ts +8 -8
- package/src/session.ts +177 -169
- package/src/shared-prefix.ts +29 -29
- package/src/sim-platform.ts +20 -20
- package/src/turn-cards.ts +117 -117
- package/src/update-command-guard.ts +165 -0
- package/src/web-ui.ts +205 -205
package/src/index.ts
CHANGED
|
@@ -189,16 +189,21 @@ function getInnerEvent(data: Evt): InnerEvent {
|
|
|
189
189
|
return (data.event ?? data) as InnerEvent;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
import { formatMessageContent } from "./format-message.ts";
|
|
192
|
+
import { formatMessageContent } from "./format-message.ts";
|
|
193
|
+
import {
|
|
194
|
+
buildUpdateCommandId,
|
|
195
|
+
extractFeishuEventId,
|
|
196
|
+
} from "./update-command-guard.ts";
|
|
193
197
|
|
|
194
198
|
// ---------------------------------------------------------------------------
|
|
195
199
|
// Card action helper: parse button click into text command
|
|
196
200
|
// ---------------------------------------------------------------------------
|
|
197
201
|
|
|
198
|
-
interface CardActionResult {
|
|
199
|
-
text: string;
|
|
200
|
-
chatId: string;
|
|
201
|
-
openId: string;
|
|
202
|
+
interface CardActionResult {
|
|
203
|
+
text: string;
|
|
204
|
+
chatId: string;
|
|
205
|
+
openId: string;
|
|
206
|
+
commandId?: string;
|
|
202
207
|
}
|
|
203
208
|
|
|
204
209
|
function parseCardAction(data: unknown): CardActionResult | null {
|
|
@@ -237,7 +242,12 @@ function parseCardAction(data: unknown): CardActionResult | null {
|
|
|
237
242
|
((raw as Record<string, unknown>).operator as Record<string, unknown>)?.open_id as string ??
|
|
238
243
|
"";
|
|
239
244
|
|
|
240
|
-
return {
|
|
245
|
+
return {
|
|
246
|
+
text,
|
|
247
|
+
chatId,
|
|
248
|
+
openId,
|
|
249
|
+
commandId: buildUpdateCommandId("card", extractFeishuEventId(data)),
|
|
250
|
+
};
|
|
241
251
|
}
|
|
242
252
|
|
|
243
253
|
// ---------------------------------------------------------------------------
|
|
@@ -432,7 +442,18 @@ async function startBotServiceCore(): Promise<void> {
|
|
|
432
442
|
const delayToken = await getTenantAccessToken();
|
|
433
443
|
await sendCardReply(delayToken, chatId, "延迟送达", delayNotice, "yellow").catch(() => {});
|
|
434
444
|
}
|
|
435
|
-
|
|
445
|
+
// 仅 `/update` 会使用这个稳定 ID 做跨重启幂等;其他命令仍沿用
|
|
446
|
+
// processedMessages 的进程内去重。
|
|
447
|
+
await handleCommand(
|
|
448
|
+
feishuPlatform,
|
|
449
|
+
text,
|
|
450
|
+
chatId,
|
|
451
|
+
openId,
|
|
452
|
+
msgTimestamp,
|
|
453
|
+
chatType,
|
|
454
|
+
traceId,
|
|
455
|
+
buildUpdateCommandId("message", messageId),
|
|
456
|
+
);
|
|
436
457
|
} catch (err) {
|
|
437
458
|
logTrace(traceId, "ERROR", { message: (err as Error).message });
|
|
438
459
|
console.error(`[${ts()}] [FATAL] im.message.receive_v1 handler crashed: ${(err as Error).message}`);
|
|
@@ -483,7 +504,16 @@ async function startBotServiceCore(): Promise<void> {
|
|
|
483
504
|
const result = parseCardAction(data);
|
|
484
505
|
if (!result) return;
|
|
485
506
|
console.log(`[BTN] chat=${result.chatId} text="${result.text}"`);
|
|
486
|
-
handleCommand(
|
|
507
|
+
handleCommand(
|
|
508
|
+
feishuPlatform,
|
|
509
|
+
result.text,
|
|
510
|
+
result.chatId,
|
|
511
|
+
result.openId,
|
|
512
|
+
Date.now(),
|
|
513
|
+
"group",
|
|
514
|
+
undefined,
|
|
515
|
+
result.commandId,
|
|
516
|
+
).catch((err) =>
|
|
487
517
|
console.error(`[${ts()}] [BTN] handleCommand failed: ${(err as Error).message}`)
|
|
488
518
|
);
|
|
489
519
|
} catch (err) {
|
|
@@ -508,7 +538,16 @@ async function startBotServiceCore(): Promise<void> {
|
|
|
508
538
|
const data = JSON.parse(raw.toString()) as Evt;
|
|
509
539
|
const action = parseCardAction(data);
|
|
510
540
|
if (action) {
|
|
511
|
-
handleCommand(
|
|
541
|
+
handleCommand(
|
|
542
|
+
feishuPlatform,
|
|
543
|
+
action.text,
|
|
544
|
+
action.chatId,
|
|
545
|
+
action.openId,
|
|
546
|
+
Date.now(),
|
|
547
|
+
"group",
|
|
548
|
+
undefined,
|
|
549
|
+
action.commandId,
|
|
550
|
+
).catch((err) =>
|
|
512
551
|
console.error(`[${ts()}] [BTN] handleCommand failed: ${(err as Error).message}`)
|
|
513
552
|
);
|
|
514
553
|
return;
|