跳转到内容

acp

运行与 CoderClaw Gateway 网关通信的 ACP(Agent Client Protocol)桥接器。

此命令通过 stdio 使用 ACP 协议与 IDE 通信,并通过 WebSocket 将提示转发到 Gateway 网关。它将 ACP 会话映射到 Gateway 网关会话键。

Terminal window
coderclaw acp
# Remote Gateway
coderclaw acp --url wss://gateway-host:18789 --token <token>
# Attach to an existing session key
coderclaw acp --session agent:main:main
# Attach by label (must already exist)
coderclaw acp --session-label "support inbox"
# Reset the session key before the first prompt
coderclaw acp --session agent:main:main --reset-session

使用内置 ACP 客户端在没有 IDE 的情况下检查桥接器的安装完整性。 它会启动 ACP 桥接器并让你交互式输入提示。

Terminal window
coderclaw acp client
# Point the spawned bridge at a remote Gateway
coderclaw acp client --server-args --url wss://gateway-host:18789 --token <token>
# Override the server command (default: coderclaw)
coderclaw acp client --server "node" --server-args coderclaw.mjs acp --url ws://127.0.0.1:19001

当 IDE(或其他客户端)使用 Agent Client Protocol 并且你希望它驱动 CoderClaw Gateway 网关会话时,请使用 ACP。

  1. 确保 Gateway 网关正在运行(本地或远程)。
  2. 配置 Gateway 网关目标(配置或标志)。
  3. 将你的 IDE 配置为通过 stdio 运行 coderclaw acp

示例配置(持久化):

Terminal window
coderclaw config set gateway.remote.url wss://gateway-host:18789
coderclaw config set gateway.remote.token <token>

示例直接运行(不写入配置):

Terminal window
coderclaw acp --url wss://gateway-host:18789 --token <token>

ACP 不直接选择智能体。它通过 Gateway 网关会话键进行路由。

使用智能体作用域的会话键来定位特定智能体:

Terminal window
coderclaw acp --session agent:main:main
coderclaw acp --session agent:design:main
coderclaw acp --session agent:qa:bug-123

每个 ACP 会话映射到单个 Gateway 网关会话键。一个智能体可以有多个会话;除非你覆盖键或标签,否则 ACP 默认使用隔离的 acp:<uuid> 会话。

~/.config/zed/settings.json 中添加自定义 ACP 智能体(或使用 Zed 的设置界面):

{
"agent_servers": {
"CoderClaw ACP": {
"type": "custom",
"command": "coderclaw",
"args": ["acp"],
"env": {}
}
}
}

要定位特定的 Gateway 网关或智能体:

{
"agent_servers": {
"CoderClaw ACP": {
"type": "custom",
"command": "coderclaw",
"args": [
"acp",
"--url",
"wss://gateway-host:18789",
"--token",
"<token>",
"--session",
"agent:design:main"
],
"env": {}
}
}
}

在 Zed 中,打开 Agent 面板并选择”CoderClaw ACP”来开始一个会话。

默认情况下,ACP 会话获得一个带有 acp: 前缀的隔离 Gateway 网关会话键。 要重用已知会话,请传递会话键或标签:

  • --session <key>:使用特定的 Gateway 网关会话键。
  • --session-label <label>:通过标签解析现有会话。
  • --reset-session:为该键生成新的会话 ID(相同键,新对话记录)。

如果你的 ACP 客户端支持元数据,你可以按会话覆盖:

{
"_meta": {
"sessionKey": "agent:main:main",
"sessionLabel": "support inbox",
"resetSession": true
}
}

/concepts/session 了解更多关于会话键的信息。

  • --url <url>:Gateway 网关 WebSocket URL(配置后默认为 gateway.remote.url)。
  • --token <token>:Gateway 网关认证令牌。
  • --password <password>:Gateway 网关认证密码。
  • --session <key>:默认会话键。
  • --session-label <label>:要解析的默认会话标签。
  • --require-existing:如果会话键/标签不存在则失败。
  • --reset-session:在首次使用前重置会话键。
  • --no-prefix-cwd:不在提示前添加工作目录前缀。
  • --verbose, -v:向 stderr 输出详细日志。
  • --cwd <dir>:ACP 会话的工作目录。
  • --server <command>:ACP 服务器命令(默认:coderclaw)。
  • --server-args <args...>:传递给 ACP 服务器的额外参数。
  • --server-verbose:启用 ACP 服务器的详细日志。
  • --verbose, -v:详细客户端日志。