@agent-dock/cli 0.2.3 → 0.3.1
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/dist/agents/claude-acp.mjs +29 -7
- package/dist/agents/codex-acp.mjs +8 -3
- package/dist/cli.js +7016 -3237
- package/dist/cli.js.map +4 -4
- package/dist/lark.proto +210 -0
- package/dist/vendor/claude-agent-acp.mjs +96428 -0
- package/dist/vendor/codex-acp.mjs +55145 -0
- package/dist/vendor/lark-sdk.cjs +8 -8
- package/package.json +21 -19
- package/public/assets/ImageLightbox-C_dUCVuL.js +1 -0
- package/public/assets/ImageLightbox-cV5bVqLR.css +1 -0
- package/public/assets/PromptEditor-BnDqjFHu.js +22 -0
- package/public/assets/index-DZAR38tD.js +41 -0
- package/public/assets/index-DilP23gl.css +1 -0
- package/public/assets/main-C86Qw1nm.css +32 -0
- package/public/assets/main-DJqDRQLw.js +1101 -0
- package/public/assets/{sourcesRouter-CQHtuzW_.js → sourcesRouter-DwLS_0VU.js} +1 -1
- package/public/assets/syntax-highlighter-d-DuIo_w.js +22 -0
- package/public/index.html +5 -5
- package/public/sources-router.html +4 -4
- package/public/assets/ImageLightbox-BSCYBGWp.js +0 -1
- package/public/assets/ImageLightbox-DUblxfbA.css +0 -1
- package/public/assets/PromptEditor-BjgTNlEl.js +0 -22
- package/public/assets/index-BNnCMpf7.css +0 -1
- package/public/assets/index-CJsF9Xgi.js +0 -41
- package/public/assets/main-BhHjggOq.js +0 -917
- package/public/assets/main-DssGYdaU.css +0 -32
- package/public/assets/syntax-highlighter-DOKegME5.js +0 -22
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { access, readFile } from 'node:fs/promises';
|
|
2
|
-
import { constants } from 'node:fs';
|
|
2
|
+
import { constants, existsSync } from 'node:fs';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
|
-
import { delimiter, join } from 'node:path';
|
|
4
|
+
import { delimiter, dirname, join, resolve } from 'node:path';
|
|
5
5
|
import { spawn } from 'node:child_process';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { parseEnv } from 'node:util';
|
|
@@ -41,12 +41,34 @@ const settingsEnv = Object.assign(
|
|
|
41
41
|
await settingsEnvironment(join(process.cwd(), '.claude', 'settings.local.json'))
|
|
42
42
|
);
|
|
43
43
|
const env = { ...settingsEnv, ...process.env };
|
|
44
|
-
const installedClaude = await findClaudeExecutable(env.PATH);
|
|
44
|
+
const installedClaude = env.CLAUDE_CODE_EXECUTABLE || await findClaudeExecutable(env.PATH);
|
|
45
45
|
if (installedClaude) env.CLAUDE_CODE_EXECUTABLE = installedClaude;
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const customCommand = process.env.AGENTDOCK_CLAUDE_ACP_COMMAND;
|
|
47
|
+
const customArgs = process.env.AGENTDOCK_CLAUDE_ACP_ARGS_JSON;
|
|
48
|
+
// 发布包不再携带 @anthropic-ai/claude-agent-sdk 的平台二进制,必须复用本机 CLI。
|
|
49
|
+
// 自定义 ACP 命令的调用方自行负责运行时,不做这个检查。
|
|
50
|
+
if (!installedClaude && !customCommand && !customArgs) {
|
|
51
|
+
process.stderr.write('未找到本机 Claude Code。请先安装 claude CLI 并加入 PATH,或设置 CLAUDE_CODE_EXECUTABLE 后重试。\n');
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
// 发布包里加载同目录的 vendor 产物;源码调试(packages/acp-client/agents)没有
|
|
55
|
+
// ../vendor,回退到 workspace 内的 node_modules。claude-agent-acp 0.103+ 不再
|
|
56
|
+
// 允许 deep import dist/*,所以从 package.json 的 bin 字段解析 CLI 入口。
|
|
57
|
+
let bundledClaudeAcp;
|
|
58
|
+
if (!customArgs) {
|
|
59
|
+
const vendoredClaudeAcp = fileURLToPath(new URL('../vendor/claude-agent-acp.mjs', import.meta.url));
|
|
60
|
+
if (existsSync(vendoredClaudeAcp)) bundledClaudeAcp = vendoredClaudeAcp;
|
|
61
|
+
else {
|
|
62
|
+
const packageJsonPath = fileURLToPath(import.meta.resolve('@agentclientprotocol/claude-agent-acp/package.json'));
|
|
63
|
+
const { bin } = JSON.parse(await readFile(packageJsonPath, 'utf8'));
|
|
64
|
+
const relative = typeof bin === 'string' ? bin : bin?.['claude-agent-acp'];
|
|
65
|
+
if (!relative) throw new Error('@agentclientprotocol/claude-agent-acp 未声明 CLI 入口。');
|
|
66
|
+
bundledClaudeAcp = resolve(dirname(packageJsonPath), relative);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const command = customCommand || process.execPath;
|
|
70
|
+
const args = customArgs
|
|
71
|
+
? JSON.parse(customArgs)
|
|
50
72
|
: [bundledClaudeAcp];
|
|
51
73
|
const child = spawn(command, args, { cwd: process.cwd(), env, stdio: 'inherit' });
|
|
52
74
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { pathToFileURL } from 'node:url';
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
import { spawnSync } from 'node:child_process';
|
|
4
4
|
|
|
5
5
|
import { access, stat } from 'node:fs/promises';
|
|
6
|
-
import { constants } from 'node:fs';
|
|
6
|
+
import { constants, existsSync } from 'node:fs';
|
|
7
7
|
import { delimiter, resolve } from 'node:path';
|
|
8
8
|
import { homedir } from 'node:os';
|
|
9
9
|
|
|
@@ -68,5 +68,10 @@ if (process.env.agentdock_codex_model) {
|
|
|
68
68
|
if (!config || typeof config !== 'object' || Array.isArray(config)) throw new Error('Codex CODEX_CONFIG 必须是有效的 JSON 对象。');
|
|
69
69
|
process.env.CODEX_CONFIG = JSON.stringify({ ...config, model: process.env.agentdock_codex_model });
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
// 发布包加载同目录的 vendor 产物;源码调试(packages/acp-client/agents)没有
|
|
72
|
+
// ../vendor,回退到 workspace 内的 node_modules。
|
|
73
|
+
const vendoredCodexAcp = fileURLToPath(new URL('../vendor/codex-acp.mjs', import.meta.url));
|
|
74
|
+
const adapter = existsSync(vendoredCodexAcp)
|
|
75
|
+
? vendoredCodexAcp
|
|
76
|
+
: createRequire(import.meta.url).resolve('@agentclientprotocol/codex-acp');
|
|
72
77
|
await import(pathToFileURL(adapter).href);
|