chatccc 0.2.240 → 0.2.241
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/package.json +71 -71
- package/src/__tests__/builtin-chat-session.test.ts +37 -0
- package/src/builtin/index.ts +25 -11
package/package.json
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "chatccc",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Feishu bot bridge for Claude Code",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "./src/index.ts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"chatccc": "bin/chatccc.mjs",
|
|
10
|
-
"cccagent": "bin/cccagent.mjs"
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"src/",
|
|
14
|
-
"bin/",
|
|
15
|
-
"scripts/postinstall-sharp-check.mjs",
|
|
16
|
-
"demo/ilink_echo_probe.ts",
|
|
17
|
-
"agent-prompts/",
|
|
18
|
-
"im-skills/",
|
|
19
|
-
".agents/skills/create-chatccc-feishu-app/",
|
|
20
|
-
".claude/skills/create-chatccc-feishu-app/",
|
|
21
|
-
".cursor/skills/create-chatccc-feishu-app/",
|
|
22
|
-
"images/img_readme_*.jpg",
|
|
23
|
-
"images/img_readme_*.png",
|
|
24
|
-
"images/avatars/status_*.png",
|
|
25
|
-
"images/avatars/badges/",
|
|
26
|
-
"images/avatars/combinations/",
|
|
27
|
-
"package.json",
|
|
28
|
-
"README.md",
|
|
29
|
-
"config.sample.json"
|
|
30
|
-
],
|
|
31
|
-
"scripts": {
|
|
32
|
-
"dev": "tsx src/index.ts",
|
|
33
|
-
"chatccc": "tsx src/index.ts",
|
|
34
|
-
"start": "tsx src/index.ts",
|
|
35
|
-
"demo:bot-test": "tsx demo/bot_test.ts",
|
|
36
|
-
"demo:bot-test:local": "tsx demo/bot_test.ts --local",
|
|
37
|
-
"demo:create-group": "tsx src/index.ts",
|
|
38
|
-
"demo:create-group:local": "tsx src/index.ts --local",
|
|
39
|
-
"demo:permission-check": "tsx demo/permission_check.ts",
|
|
40
|
-
"demo:claude-hi": "tsx demo/claude_say_hi.ts",
|
|
41
|
-
"demo:codex-hi": "tsx demo/codex_say_hi.ts",
|
|
42
|
-
"demo:codex-app-server-approval": "tsx demo/codex-app-server-approval/approval_demo.ts",
|
|
43
|
-
"demo:ilink-echo": "tsx demo/ilink_echo_probe.ts",
|
|
44
|
-
"claude-proxy": "tsx src/litellm-proxy.ts",
|
|
45
|
-
"test": "vitest run",
|
|
46
|
-
"test:watch": "vitest",
|
|
47
|
-
"postinstall": "node scripts/postinstall-sharp-check.mjs"
|
|
48
|
-
},
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"@ai-sdk/openai-compatible": "^2.0.47",
|
|
51
|
-
"@larksuiteoapi/node-sdk": "^1.59.0",
|
|
52
|
-
"@openilink/openilink-sdk-node": "^0.6.0",
|
|
53
|
-
"@vscode/ripgrep": "^1.18.0",
|
|
54
|
-
"ai": "^6.0.184",
|
|
55
|
-
"nodemailer": "^8.0.7",
|
|
56
|
-
"qrcode-terminal": "^0.12.0",
|
|
57
|
-
"sharp": "^0.34.5",
|
|
58
|
-
"tsx": "^4.0.0",
|
|
59
|
-
"ws": "^8.18.0"
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@types/node": "^20.0.0",
|
|
63
|
-
"@types/qrcode-terminal": "^0.12.2",
|
|
64
|
-
"@types/ws": "^8.18.1",
|
|
65
|
-
"typescript": "^5.0.0",
|
|
66
|
-
"vitest": "^3.2.4"
|
|
67
|
-
},
|
|
68
|
-
"engines": {
|
|
69
|
-
"node": ">=20"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "chatccc",
|
|
3
|
+
"version": "0.2.241",
|
|
4
|
+
"description": "Feishu bot bridge for Claude Code",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./src/index.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"chatccc": "bin/chatccc.mjs",
|
|
10
|
+
"cccagent": "bin/cccagent.mjs"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"src/",
|
|
14
|
+
"bin/",
|
|
15
|
+
"scripts/postinstall-sharp-check.mjs",
|
|
16
|
+
"demo/ilink_echo_probe.ts",
|
|
17
|
+
"agent-prompts/",
|
|
18
|
+
"im-skills/",
|
|
19
|
+
".agents/skills/create-chatccc-feishu-app/",
|
|
20
|
+
".claude/skills/create-chatccc-feishu-app/",
|
|
21
|
+
".cursor/skills/create-chatccc-feishu-app/",
|
|
22
|
+
"images/img_readme_*.jpg",
|
|
23
|
+
"images/img_readme_*.png",
|
|
24
|
+
"images/avatars/status_*.png",
|
|
25
|
+
"images/avatars/badges/",
|
|
26
|
+
"images/avatars/combinations/",
|
|
27
|
+
"package.json",
|
|
28
|
+
"README.md",
|
|
29
|
+
"config.sample.json"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"dev": "tsx src/index.ts",
|
|
33
|
+
"chatccc": "tsx src/index.ts",
|
|
34
|
+
"start": "tsx src/index.ts",
|
|
35
|
+
"demo:bot-test": "tsx demo/bot_test.ts",
|
|
36
|
+
"demo:bot-test:local": "tsx demo/bot_test.ts --local",
|
|
37
|
+
"demo:create-group": "tsx src/index.ts",
|
|
38
|
+
"demo:create-group:local": "tsx src/index.ts --local",
|
|
39
|
+
"demo:permission-check": "tsx demo/permission_check.ts",
|
|
40
|
+
"demo:claude-hi": "tsx demo/claude_say_hi.ts",
|
|
41
|
+
"demo:codex-hi": "tsx demo/codex_say_hi.ts",
|
|
42
|
+
"demo:codex-app-server-approval": "tsx demo/codex-app-server-approval/approval_demo.ts",
|
|
43
|
+
"demo:ilink-echo": "tsx demo/ilink_echo_probe.ts",
|
|
44
|
+
"claude-proxy": "tsx src/litellm-proxy.ts",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:watch": "vitest",
|
|
47
|
+
"postinstall": "node scripts/postinstall-sharp-check.mjs"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@ai-sdk/openai-compatible": "^2.0.47",
|
|
51
|
+
"@larksuiteoapi/node-sdk": "^1.59.0",
|
|
52
|
+
"@openilink/openilink-sdk-node": "^0.6.0",
|
|
53
|
+
"@vscode/ripgrep": "^1.18.0",
|
|
54
|
+
"ai": "^6.0.184",
|
|
55
|
+
"nodemailer": "^8.0.7",
|
|
56
|
+
"qrcode-terminal": "^0.12.0",
|
|
57
|
+
"sharp": "^0.34.5",
|
|
58
|
+
"tsx": "^4.0.0",
|
|
59
|
+
"ws": "^8.18.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^20.0.0",
|
|
63
|
+
"@types/qrcode-terminal": "^0.12.2",
|
|
64
|
+
"@types/ws": "^8.18.1",
|
|
65
|
+
"typescript": "^5.0.0",
|
|
66
|
+
"vitest": "^3.2.4"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=20"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -92,6 +92,43 @@ describe("ChatSession context management", () => {
|
|
|
92
92
|
);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
+
it("keeps execution discipline sections in the stable system prompt prefix", async () => {
|
|
96
|
+
const { ChatSession } = await import("../builtin/index.ts");
|
|
97
|
+
const dir = await mkdtemp(join(tmpdir(), "deepccc-session-discipline-"));
|
|
98
|
+
await writeFile(join(dir, "AGENTS.md"), "PROJECT GUIDANCE MARKER", "utf-8");
|
|
99
|
+
streamTextMock.mockReturnValueOnce({ textStream: textStream("done") });
|
|
100
|
+
|
|
101
|
+
const session = new ChatSession(
|
|
102
|
+
{ apiKey: "sk-test" },
|
|
103
|
+
{
|
|
104
|
+
cwd: dir,
|
|
105
|
+
sessionId: "execution-discipline",
|
|
106
|
+
systemPrompt: "CUSTOM PROMPT MARKER",
|
|
107
|
+
},
|
|
108
|
+
);
|
|
109
|
+
await collect(session.chat("build a feature"));
|
|
110
|
+
|
|
111
|
+
const system = streamTextMock.mock.calls.at(-1)?.[0].system as string;
|
|
112
|
+
// 先盘点再动手:动手前低开销盘点 + 输出含验证策略的计划
|
|
113
|
+
expect(system).toContain("## Survey Before Acting");
|
|
114
|
+
expect(system).toContain("map the landscape");
|
|
115
|
+
expect(system).toContain("how you will verify the result");
|
|
116
|
+
// 授权自主:用户委托决策后只问真正阻塞项,不抛实现级选择题
|
|
117
|
+
expect(system).toContain("## Delegated Authority");
|
|
118
|
+
expect(system).toContain("irreversible actions");
|
|
119
|
+
expect(system).toContain("Do not bounce implementation-level multiple-choice");
|
|
120
|
+
// 交付自检:声明做了什么/如何验证/未验证项
|
|
121
|
+
expect(system).toContain("## Pre-Delivery Self-Check");
|
|
122
|
+
expect(system).toContain("remains unverified or risky");
|
|
123
|
+
// 稳定前缀全部位于项目指令与 runtime 上下文之前
|
|
124
|
+
for (const section of ["## Survey Before Acting", "## Delegated Authority", "## Pre-Delivery Self-Check"]) {
|
|
125
|
+
expect(system.indexOf(section)).toBeGreaterThan(0);
|
|
126
|
+
expect(system.indexOf(section)).toBeLessThan(system.indexOf("PROJECT GUIDANCE MARKER"));
|
|
127
|
+
expect(system.indexOf(section)).toBeLessThan(system.indexOf("Current working directory"));
|
|
128
|
+
expect(system.indexOf(section)).toBeLessThan(system.indexOf("CUSTOM PROMPT MARKER"));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
95
132
|
it("injects cwd project instruction files before runtime workspace details", async () => {
|
|
96
133
|
const { ChatSession } = await import("../builtin/index.ts");
|
|
97
134
|
const dir = await mkdtemp(join(tmpdir(), "deepccc-session-instructions-"));
|
package/src/builtin/index.ts
CHANGED
|
@@ -42,17 +42,31 @@ const SYSTEM_PROMPT = [
|
|
|
42
42
|
"- Respond in the user's language unless they ask otherwise.",
|
|
43
43
|
"- Prefer direct, usable answers and concrete actions over long explanations.",
|
|
44
44
|
"- For code tasks, inspect the relevant files before editing and verify with tests or checks when practical.",
|
|
45
|
-
"- Preserve user work. Do not overwrite concurrent changes unless the user explicitly asks.",
|
|
46
|
-
"- Keep immutable platform rules above project guidance and runtime details.",
|
|
47
|
-
"",
|
|
48
|
-
"## Evidence-Gated Conclusions",
|
|
49
|
-
"- Apply this gate before consequential claims or actions that could affect code, data, deployments, or user decisions, and whenever the available evidence is indirect.",
|
|
50
|
-
"- Identify the claim and its authoritative source of truth. Separate direct observations from inferences, and test plausible alternative explanations before choosing one.",
|
|
51
|
-
"- 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.",
|
|
52
|
-
"- 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.",
|
|
53
|
-
"- Use definitive language only after the evidence closes the loop. Otherwise state uncertainty, identify the missing evidence, and name the next check.",
|
|
54
|
-
"- Do not repeat checks once decisive evidence exists.",
|
|
55
|
-
|
|
45
|
+
"- Preserve user work. Do not overwrite concurrent changes unless the user explicitly asks.",
|
|
46
|
+
"- Keep immutable platform rules above project guidance and runtime details.",
|
|
47
|
+
"",
|
|
48
|
+
"## Evidence-Gated Conclusions",
|
|
49
|
+
"- Apply this gate before consequential claims or actions that could affect code, data, deployments, or user decisions, and whenever the available evidence is indirect.",
|
|
50
|
+
"- Identify the claim and its authoritative source of truth. Separate direct observations from inferences, and test plausible alternative explanations before choosing one.",
|
|
51
|
+
"- 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.",
|
|
52
|
+
"- 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.",
|
|
53
|
+
"- Use definitive language only after the evidence closes the loop. Otherwise state uncertainty, identify the missing evidence, and name the next check.",
|
|
54
|
+
"- Do not repeat checks once decisive evidence exists.",
|
|
55
|
+
"",
|
|
56
|
+
"## Survey Before Acting",
|
|
57
|
+
"- Before diving into any task, first map the landscape at low cost: project instructions, directory layout, routes/APIs, existing tests, and git state.",
|
|
58
|
+
"- Produce a brief execution plan that includes how you will verify the result, then execute.",
|
|
59
|
+
"- When evidence contradicts an early assumption, revisit the plan instead of tunneling on one direction.",
|
|
60
|
+
"",
|
|
61
|
+
"## Delegated Authority",
|
|
62
|
+
"- When the user delegates decisions (\"you decide\", \"do it elegantly\", \"up to you\"), act autonomously on implementation details.",
|
|
63
|
+
"- Only ask about genuine blockers: irreversible actions, security boundaries, credentials, or scope changes.",
|
|
64
|
+
"- Do not bounce implementation-level multiple-choice questions back to the user after they delegated.",
|
|
65
|
+
"",
|
|
66
|
+
"## Pre-Delivery Self-Check",
|
|
67
|
+
"- Before reporting completion, verify: the change runs, edge cases are covered, assumptions are listed, and anything unverified is explicitly labeled as such.",
|
|
68
|
+
"- State what was done, how it was verified, and what remains unverified or risky.",
|
|
69
|
+
].join("\n");
|
|
56
70
|
|
|
57
71
|
const SUMMARY_SYSTEM_PROMPT = [
|
|
58
72
|
"You are DeepCCC's context compactor.",
|