chatccc 0.2.243 → 0.2.245
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 +6 -6
- package/bin/cccagent.mjs +17 -17
- package/deepccc-agent/README.md +14 -8
- package/deepccc-agent/bin/deepccc.mjs +26 -26
- package/deepccc-agent/os-prompts/darwin.md +8 -0
- package/deepccc-agent/os-prompts/linux.md +8 -0
- package/deepccc-agent/os-prompts/win32.md +9 -0
- package/deepccc-agent/package-lock.json +2 -2
- package/deepccc-agent/package.json +63 -62
- package/deepccc-agent/src/__tests__/chat-session.test.ts +682 -578
- package/deepccc-agent/src/__tests__/cli-json.test.ts +49 -49
- package/deepccc-agent/src/__tests__/config.test.ts +26 -26
- package/deepccc-agent/src/__tests__/context.test.ts +319 -319
- package/deepccc-agent/src/__tests__/file-tools.test.ts +240 -240
- package/deepccc-agent/src/__tests__/permissions.test.ts +195 -195
- package/deepccc-agent/src/__tests__/privacy.test.ts +8 -5
- package/deepccc-agent/src/__tests__/progress-reducer.test.ts +121 -121
- package/deepccc-agent/src/__tests__/session-search.test.ts +262 -262
- package/deepccc-agent/src/__tests__/session-select.test.ts +116 -116
- package/deepccc-agent/src/__tests__/sigint.test.ts +56 -56
- package/deepccc-agent/src/__tests__/skills.test.ts +284 -284
- package/deepccc-agent/src/__tests__/terminal-renderer.test.ts +247 -247
- package/deepccc-agent/src/__tests__/web-tools.test.ts +220 -220
- package/deepccc-agent/src/cli.ts +7 -6
- package/deepccc-agent/src/config.ts +88 -84
- package/deepccc-agent/src/context.ts +465 -465
- package/deepccc-agent/src/file-log.ts +38 -38
- package/deepccc-agent/src/index.ts +103 -36
- package/deepccc-agent/src/proc-tree-kill.ts +61 -61
- package/deepccc-agent/src/progress/cards-helpers.ts +76 -76
- package/deepccc-agent/src/progress/reducer.ts +113 -113
- package/deepccc-agent/src/progress/terminal-renderer.ts +294 -294
- package/deepccc-agent/src/progress/view.ts +77 -77
- package/deepccc-agent/src/raw-stream-log.ts +124 -124
- package/deepccc-agent/src/session-search.ts +370 -370
- package/deepccc-agent/src/session-select.ts +48 -48
- package/deepccc-agent/src/sigint.ts +50 -50
- package/deepccc-agent/src/skills.ts +205 -205
- package/deepccc-agent/src/web-tools.ts +313 -313
- package/deepccc-agent/tsconfig.build.json +13 -13
- package/deepccc-agent/tsconfig.json +13 -13
- package/deepccc-agent/vitest.config.ts +7 -7
- package/package.json +1 -1
- package/src/__tests__/builtin-chat-session.test.ts +522 -522
- package/src/__tests__/builtin-config.test.ts +26 -26
- package/src/__tests__/builtin-context.test.ts +319 -319
- package/src/__tests__/builtin-file-tools.test.ts +240 -240
- package/src/__tests__/builtin-permissions.test.ts +211 -211
- package/src/__tests__/builtin-session-search.test.ts +262 -262
- package/src/__tests__/builtin-session-select.test.ts +116 -116
- package/src/__tests__/builtin-sigint.test.ts +56 -56
- package/src/__tests__/builtin-skills.test.ts +284 -284
- package/src/__tests__/builtin-web-tools.test.ts +220 -220
- package/src/__tests__/ccc-adapter.test.ts +15 -0
- package/src/__tests__/config.test.ts +17 -17
- package/src/__tests__/progress-reducer.test.ts +121 -121
- package/src/__tests__/session-ccc-config.test.ts +45 -45
- package/src/__tests__/session.test.ts +369 -306
- package/src/adapters/adapter-interface.ts +8 -2
- package/src/adapters/ccc-adapter.ts +149 -145
- package/src/config-utils.ts +13 -13
- package/src/config.ts +13 -13
- package/src/progress/reducer.ts +113 -113
- package/src/session-chat-binding.ts +83 -83
- package/src/session.ts +323 -320
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { promisify } from "node:util";
|
|
6
|
-
|
|
7
|
-
import { describe, expect, it } from "vitest";
|
|
8
|
-
|
|
9
|
-
const execFileAsync = promisify(execFile);
|
|
10
|
-
|
|
11
|
-
// 兼容两种布局:<root>/deepccc-agent/src/__tests__(chatccc 子目录)或 <root>/src/__tests__(deepccc 镜像)
|
|
12
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
13
|
-
const cliBin = [
|
|
14
|
-
join(here, "..", "..", "..", "bin", "deepccc.mjs"),
|
|
15
|
-
join(here, "..", "..", "bin", "deepccc.mjs"),
|
|
16
|
-
].find(existsSync);
|
|
17
|
-
|
|
18
|
-
describe("deepccc cli --stream-json", () => {
|
|
19
|
-
it("writes only JSON lines to stdout when startup fails", async () => {
|
|
20
|
-
let caught: unknown;
|
|
21
|
-
try {
|
|
22
|
-
await execFileAsync(process.execPath, [
|
|
23
|
-
cliBin!,
|
|
24
|
-
"--stream-json",
|
|
25
|
-
"--prompt",
|
|
26
|
-
"hello",
|
|
27
|
-
"--api-key",
|
|
28
|
-
"",
|
|
29
|
-
], {
|
|
30
|
-
cwd: dirname(cliBin!),
|
|
31
|
-
timeout: 10_000,
|
|
32
|
-
windowsHide: true,
|
|
33
|
-
});
|
|
34
|
-
} catch (err) {
|
|
35
|
-
caught = err;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
expect(caught).toMatchObject({ code: 1 });
|
|
39
|
-
const stdout = (caught as { stdout?: string }).stdout ?? "";
|
|
40
|
-
const lines = stdout.trim().split(/\r?\n/).filter(Boolean);
|
|
41
|
-
expect(lines.length).toBeGreaterThan(0);
|
|
42
|
-
for (const line of lines) {
|
|
43
|
-
expect(() => JSON.parse(line)).not.toThrow();
|
|
44
|
-
}
|
|
45
|
-
expect(JSON.parse(lines.at(-1)!)).toEqual(expect.objectContaining({
|
|
46
|
-
type: "error",
|
|
47
|
-
}));
|
|
48
|
-
});
|
|
49
|
-
});
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
|
|
7
|
+
import { describe, expect, it } from "vitest";
|
|
8
|
+
|
|
9
|
+
const execFileAsync = promisify(execFile);
|
|
10
|
+
|
|
11
|
+
// 兼容两种布局:<root>/deepccc-agent/src/__tests__(chatccc 子目录)或 <root>/src/__tests__(deepccc 镜像)
|
|
12
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const cliBin = [
|
|
14
|
+
join(here, "..", "..", "..", "bin", "deepccc.mjs"),
|
|
15
|
+
join(here, "..", "..", "bin", "deepccc.mjs"),
|
|
16
|
+
].find(existsSync);
|
|
17
|
+
|
|
18
|
+
describe("deepccc cli --stream-json", () => {
|
|
19
|
+
it("writes only JSON lines to stdout when startup fails", async () => {
|
|
20
|
+
let caught: unknown;
|
|
21
|
+
try {
|
|
22
|
+
await execFileAsync(process.execPath, [
|
|
23
|
+
cliBin!,
|
|
24
|
+
"--stream-json",
|
|
25
|
+
"--prompt",
|
|
26
|
+
"hello",
|
|
27
|
+
"--api-key",
|
|
28
|
+
"",
|
|
29
|
+
], {
|
|
30
|
+
cwd: dirname(cliBin!),
|
|
31
|
+
timeout: 10_000,
|
|
32
|
+
windowsHide: true,
|
|
33
|
+
});
|
|
34
|
+
} catch (err) {
|
|
35
|
+
caught = err;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
expect(caught).toMatchObject({ code: 1 });
|
|
39
|
+
const stdout = (caught as { stdout?: string }).stdout ?? "";
|
|
40
|
+
const lines = stdout.trim().split(/\r?\n/).filter(Boolean);
|
|
41
|
+
expect(lines.length).toBeGreaterThan(0);
|
|
42
|
+
for (const line of lines) {
|
|
43
|
+
expect(() => JSON.parse(line)).not.toThrow();
|
|
44
|
+
}
|
|
45
|
+
expect(JSON.parse(lines.at(-1)!)).toEqual(expect.objectContaining({
|
|
46
|
+
type: "error",
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it } from "vitest";
|
|
2
|
-
|
|
3
|
-
import { ChatSession } from "../index.js";
|
|
4
|
-
import { config } from "../config.js";
|
|
5
|
-
|
|
6
|
-
const originalDeepSeekApiKey = process.env.DEEPSEEK_API_KEY;
|
|
7
|
-
const originalDeepCccApiKey = config.apiKey;
|
|
8
|
-
|
|
9
|
-
afterEach(() => {
|
|
10
|
-
if (originalDeepSeekApiKey === undefined) {
|
|
11
|
-
delete process.env.DEEPSEEK_API_KEY;
|
|
12
|
-
} else {
|
|
13
|
-
process.env.DEEPSEEK_API_KEY = originalDeepSeekApiKey;
|
|
14
|
-
}
|
|
15
|
-
config.apiKey = originalDeepCccApiKey;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
describe("builtin ChatSession config", () => {
|
|
19
|
-
it("uses the builtin ~/.deepccc config when no apiKey is passed", () => {
|
|
20
|
-
expect(() => new ChatSession()).not.toThrow();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("allows constructor parameters to override config defaults", () => {
|
|
24
|
-
expect(() => new ChatSession({ apiKey: "sk-test" })).not.toThrow();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
1
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { ChatSession } from "../index.js";
|
|
4
|
+
import { config } from "../config.js";
|
|
5
|
+
|
|
6
|
+
const originalDeepSeekApiKey = process.env.DEEPSEEK_API_KEY;
|
|
7
|
+
const originalDeepCccApiKey = config.apiKey;
|
|
8
|
+
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
if (originalDeepSeekApiKey === undefined) {
|
|
11
|
+
delete process.env.DEEPSEEK_API_KEY;
|
|
12
|
+
} else {
|
|
13
|
+
process.env.DEEPSEEK_API_KEY = originalDeepSeekApiKey;
|
|
14
|
+
}
|
|
15
|
+
config.apiKey = originalDeepCccApiKey;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe("builtin ChatSession config", () => {
|
|
19
|
+
it("uses the builtin ~/.deepccc config when no apiKey is passed", () => {
|
|
20
|
+
expect(() => new ChatSession()).not.toThrow();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("allows constructor parameters to override config defaults", () => {
|
|
24
|
+
expect(() => new ChatSession({ apiKey: "sk-test" })).not.toThrow();
|
|
25
|
+
});
|
|
26
|
+
});
|