Skip to content

Commit 66d2671

Browse files
feat: acp manager (#304)
* feat: acp 控制器第一版 * feat: acp-link 命令二合一
1 parent c7bc8c8 commit 66d2671

11 files changed

Lines changed: 897 additions & 49 deletions

File tree

bun.lock

Lines changed: 30 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/acp-link/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,22 @@ acp-link can register to a Remote Control Server (RCS) for remote access. Set th
100100

101101
You can also use `--group <id>` on the CLI. The CLI flag takes priority over the env var.
102102

103+
## Manager UI
104+
105+
通过 `--manager` flag 启动独立的管理服务(不启动代理):
106+
107+
```bash
108+
# 启动 Manager(默认端口 9315)
109+
acp-link --manager
110+
111+
# 指定端口
112+
acp-link --manager --port 3210
113+
```
114+
115+
在浏览器打开 `http://localhost:<port>` 即可访问管理界面,创建、停止、删除多个 acp-link 子进程实例并实时查看日志。
116+
117+
通过 Manager UI 创建的子进程会自动跳过 Manager UI。
118+
103119
## License
104120

105121
MIT

packages/acp-link/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "acp-link",
3-
"version": "1.1.0",
3+
"version": "2.0.0",
44
"description": "ACP proxy server that bridges WebSocket clients to ACP agents",
55
"author": "claude-code-best",
66
"type": "module",
@@ -15,11 +15,14 @@
1515
"scripts": {
1616
"build": "tsc",
1717
"dev": "ACP_RCS_URL=http://localhost:3000 ACP_RCS_TOKEN=test-my-key bun run src/cli/bin.ts ccb-bun -- --acp",
18+
"dev:remote": "ACP_RCS_URL=https://remote-control.claude-code-best.win/ ACP_RCS_TOKEN=test-my-key bun run src/cli/bin.ts ccb-bun -- --acp",
19+
"dev:manager": "ACP_RCS_URL=http://localhost:3000 ACP_RCS_TOKEN=test-my-key bun run src/cli/bin.ts --manager",
1820
"prepublishOnly": "bun run build"
1921
},
2022
"devDependencies": {
2123
"@types/selfsigned": "^2.0.4",
22-
"@types/ws": "^8.18.1"
24+
"@types/ws": "^8.18.1",
25+
"@types/bun": "^1.3.12"
2326
},
2427
"dependencies": {
2528
"@agentclientprotocol/sdk": "^0.19.0",

packages/acp-link/src/cli/command.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export const command = buildCommand({
99
"The agent command is spawned as a subprocess and communicates via stdin/stdout.\n\n" +
1010
"Use -- to pass arguments to the agent:\n" +
1111
" acp-link /path/to/agent -- --verbose --model gpt-4\n\n" +
12+
"Use --manager to start the Manager Web UI instead:\n" +
13+
" acp-link --manager\n\n" +
1214
"For remote access, set ACP_AUTH_TOKEN environment variable or let it auto-generate.",
1315
},
1416
parameters: {
@@ -40,6 +42,11 @@ export const command = buildCommand({
4042
brief: "Enable HTTPS with auto-generated self-signed certificate",
4143
default: false,
4244
},
45+
manager: {
46+
kind: "boolean",
47+
brief: "Start Manager Web UI (no proxy)",
48+
default: false,
49+
},
4350
group: {
4451
kind: "parsed",
4552
parse: (value: string) => {
@@ -59,20 +66,34 @@ export const command = buildCommand({
5966
parse: String,
6067
placeholder: "command",
6168
},
62-
minimum: 1,
69+
minimum: 0,
6370
},
6471
},
6572
func: async function (
6673
this: LocalContext,
67-
flags: { port: number; host: string; debug: boolean; "no-auth": boolean; https: boolean; group: string | undefined },
74+
flags: { port: number; host: string; debug: boolean; "no-auth": boolean; https: boolean; manager: boolean; group: string | undefined },
6875
...args: readonly string[]
6976
) {
7077
const port = flags.port;
7178
const host = flags.host;
7279
const debug = flags.debug;
7380
const noAuth = flags["no-auth"];
7481
const https = flags.https;
82+
const manager = flags.manager;
7583
const group = flags.group;
84+
85+
// Manager mode: start web UI only, no proxy
86+
if (manager) {
87+
const { startManager } = await import("../manager/index.js");
88+
await startManager(port);
89+
return;
90+
}
91+
92+
// Proxy mode: agent command is required
93+
if (args.length === 0) {
94+
console.error("Error: agent command is required (or use --manager)");
95+
process.exit(1);
96+
}
7697
const [command, ...agentArgs] = args;
7798
const cwd = process.cwd();
7899

0 commit comments

Comments
 (0)