opencode-acp-bridge
v0.0.0
Published
Bridge Agent Client Protocol (ACP) agents into opencode as model providers.
Readme
opencode-acp-bridge
Bridge Agent Client Protocol (ACP) agents into opencode as model providers.
This plugin starts configured ACP agent processes, discovers the models they expose, registers them under opencode provider IDs like acp-gemini or acp-copilot, and streams prompts/responses through the ACP session.
What It Does
- Registers each configured ACP agent as an opencode provider.
- Discovers models from ACP session config options, with legacy
models.availableModelsfallback. - Selects models through standard ACP
session/set_config_optionwhen available. - Falls back to legacy
session/set_modelonly for agents that still expose model switching that way. - Forwards opencode MCP servers into the ACP session.
- Streams ACP
agent_message_chunktext back through AI SDK v3.
Requirements
- Bun
- opencode
- One or more ACP-capable agent CLIs, for example:
- Gemini CLI with
--acp - GitHub Copilot CLI with
--acp
- Gemini CLI with
Install
Install dependencies:
bun installRegister the plugin in your opencode config:
// ~/.config/opencode/opencode.jsonc
{
"plugin": [
"/absolute/path/to/opencode-acp-bridge"
]
}During local development, the absolute path can be this repository path.
Configure ACP Agents
Create:
~/.config/opencode/opencode-acp-bridge.jsoncExample:
{
"agents": {
"gemini": {
"command": ["gemini", "--acp"]
},
"copilot": {
"command": ["copilot", "--acp"]
}
}
}Agent IDs become provider IDs:
gemini -> acp-gemini
copilot -> acp-copilotYou can disable an agent without deleting it:
{
"agents": {
"copilot": {
"enabled": false,
"command": ["copilot", "--acp"]
}
}
}command must be an array. The first item is the executable, and the rest are arguments.
Config Lookup
The loader follows the same broad convention as oh-my-openagent:
User config:
~/.config/opencode/opencode-acp-bridge.jsonc ~/.config/opencode/opencode-acp-bridge.jsonProject config, walking from the current workspace toward
$HOME:.opencode/opencode-acp-bridge.jsonc .opencode/opencode-acp-bridge.json
User config loads first. Project configs are merged on top, and the closest project config wins. A project config can override a single field without repeating the whole agent block.
OPENCODE_CONFIG_DIR overrides the user config directory, which is useful for tests or isolated installs.
JSONC files are parsed with Bun's built-in JSON5.parse, so comments and trailing commas are supported.
Verify
List models discovered from an ACP agent:
opencode models acp-gemini --verbose
opencode models acp-copilot --verboseRun a prompt with an explicit ACP-backed model:
opencode run --model acp-gemini/gemini-2.5-flash "Say hi in one short sentence."Development
Run tests:
bun testTypecheck:
bun run tsc --noEmitFormat and lint:
bunx biome check --write .Notes
This package is intentionally a bridge, not a model provider by itself. The real model list, model switching behavior, permission prompts, and output stream come from the ACP agent process you configure.
