ACP Support

Sử dụng OpenCode trong các ACP-compatible editors.


Tổng quan

OpenCode hỗ trợ Agent Client Protocol (ACP), cho phép bạn dùng OpenCode trực tiếp trong các editors và IDEs hỗ trợ ACP.

ACP là giao thức mở, chuẩn hóa giao tiếp giữa code editors và AI coding agents.


Cấu hình

Để dùng OpenCode qua ACP, cấu hình editor chạy lệnh opencode acp.

Lệnh này khởi động OpenCode như một ACP-compatible subprocess, giao tiếp với editor qua JSON-RPC.


Zed

Thêm vào ~/.config/zed/settings.json:

{
  "agent_servers": {
    "OpenCode": {
      "command": "opencode",
      "args": ["acp"]
    }
  }
}

Mở bằng action agent: new thread trong Command Palette.

JetBrains IDEs

Thêm vào acp.json:

{
  "agent_servers": {
    "OpenCode": {
      "command": "/absolute/path/bin/opencode",
      "args": ["acp"]
    }
  }
}

Avante.nvim

{
  acp_providers = {
    ["opencode"] = {
      command = "opencode",
      args = { "acp" }
    }
  }
}

CodeCompanion.nvim

require("codecompanion").setup({
  interactions = {
    chat = {
      adapter = {
        name = "opencode",
        model = "claude-sonnet-4",
      },
    },
  },
})

Features hỗ trợ

OpenCode hoạt động giống hệt qua ACP như trong terminal. Tất cả features đều được hỗ trợ:

  • Built-in tools (file operations, terminal commands)
  • Custom tools và slash commands
  • MCP servers
  • Project rules từ AGENTS.md
  • Custom formatters và linters
  • Agents và permissions system

:::note Một số slash commands như /undo/redo hiện chưa được hỗ trợ qua ACP. :::