Skip to content

Commit 39335a8

Browse files
feat: add OpenCode as ACP agent backend
OpenCode ships native ACP support via `opencode acp` — pure stdio JSON-RPC, zero adapter layer required. Integration is configuration-only: no changes to src/. - config.toml.example: add commented opencode [agent] block - Dockerfile.opencode: multi-stage build using debian:bookworm-slim + official install script (not node:22 — opencode is a self-contained binary; npm package is only a 9 KB download wrapper) - README.md: add opencode to description, features, backend table, and Manual config section Verified against opencode v1.4.3 on openab v0.7.1. Multi-turn conversations stable end-to-end via Discord.
1 parent 13cc314 commit 39335a8

3 files changed

Lines changed: 67 additions & 3 deletions

File tree

Dockerfile.opencode

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# --- Build stage ---
2+
FROM rust:1-bookworm AS builder
3+
WORKDIR /build
4+
COPY Cargo.toml Cargo.lock ./
5+
RUN mkdir src && echo 'fn main() {}' > src/main.rs && cargo build --release && rm -rf src
6+
COPY src/ src/
7+
RUN touch src/main.rs && cargo build --release
8+
9+
# --- Runtime stage ---
10+
# node:22-bookworm-slim mirrors the base image used by Dockerfile.claude,
11+
# Dockerfile.codex, and Dockerfile.gemini, keeping the project on a single
12+
# consistent runtime base.
13+
#
14+
# opencode is published to npm as `opencode-ai`; the npm package is a thin
15+
# postinstall wrapper (~9 KB) that downloads the same pre-compiled binary
16+
# used by the official install script, so `npm install -g` and
17+
# `curl | bash` are equivalent in the end result.
18+
#
19+
# Version is pinned for reproducible builds.
20+
# opencode releases very frequently (often daily); bump this version via
21+
# a dedicated PR when a new release is needed.
22+
#
23+
# Note: opencode does not publish SHA256 checksums for its releases,
24+
# so checksum verification is not possible at this time.
25+
FROM node:22-bookworm-slim
26+
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/*
27+
28+
# Install opencode
29+
RUN npm install -g opencode-ai@1.4.3 --retry 3
30+
31+
# Install gh CLI (matches Dockerfile.claude / Dockerfile.gemini / Dockerfile.codex)
32+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
33+
-o /usr/share/keyrings/githubcli-archive-keyring.gpg && \
34+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
35+
> /etc/apt/sources.list.d/github-cli.list && \
36+
apt-get update && apt-get install -y --no-install-recommends gh && \
37+
rm -rf /var/lib/apt/lists/*
38+
39+
ENV HOME=/home/node
40+
WORKDIR /home/node
41+
42+
COPY --from=builder --chown=node:node /build/target/release/openab /usr/local/bin/openab
43+
44+
USER node
45+
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
46+
CMD pgrep -x openab || exit 1
47+
ENTRYPOINT ["openab"]
48+
CMD ["/etc/openab/config.toml"]

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OpenAB — Open Agent Broker
22

3-
A lightweight, secure, cloud-native ACP harness that bridges Discord and any [Agent Client Protocol](https://github.com/anthropics/agent-protocol)-compatible coding CLI (Kiro CLI, Claude Code, Codex, Gemini, etc.) over stdio JSON-RPC — delivering the next-generation development experience.
3+
A lightweight, secure, cloud-native ACP harness that bridges Discord and any [Agent Client Protocol](https://github.com/anthropics/agent-protocol)-compatible coding CLI (Kiro CLI, Claude Code, Codex, Gemini, OpenCode, etc.) over stdio JSON-RPC — delivering the next-generation development experience.
44

55
🪼 **Join our community!** Come say hi on Discord — we'd love to have you: **[🪼 OpenAB — Official](https://discord.gg/YNksK9M6)** 🎉
66

@@ -17,7 +17,7 @@ A lightweight, secure, cloud-native ACP harness that bridges Discord and any [Ag
1717

1818
## Features
1919

20-
- **Pluggable agent backend** — swap between Kiro CLI, Claude Code, Codex, Gemini via config
20+
- **Pluggable agent backend** — swap between Kiro CLI, Claude Code, Codex, Gemini, OpenCode via config
2121
- **@mention trigger** — mention the bot in an allowed channel to start a conversation
2222
- **Thread-based multi-turn** — auto-creates threads; no @mention needed for follow-ups
2323
- **Edit-streaming** — live-updates the Discord message every 1.5s as tokens arrive
@@ -85,14 +85,15 @@ The bot creates a thread. After that, just type in the thread — no @mention ne
8585

8686
## Pluggable Agent Backends
8787

88-
Supports Kiro CLI, Claude Code, Codex, Gemini, and any ACP-compatible CLI.
88+
Supports Kiro CLI, Claude Code, Codex, Gemini, OpenCode, and any ACP-compatible CLI.
8989

9090
| Agent key | CLI | ACP Adapter | Auth |
9191
|-----------|-----|-------------|------|
9292
| `kiro` (default) | Kiro CLI | Native `kiro-cli acp` | `kiro-cli login --use-device-flow` |
9393
| `codex` | Codex | [@zed-industries/codex-acp](https://github.com/zed-industries/codex-acp) | `codex login --device-auth` |
9494
| `claude` | Claude Code | [@agentclientprotocol/claude-agent-acp](https://github.com/agentclientprotocol/claude-agent-acp) | `claude setup-token` |
9595
| `gemini` | Gemini CLI | Native `gemini --acp` | Google OAuth or `GEMINI_API_KEY` |
96+
| `opencode` | OpenCode | Native `opencode acp` | `opencode auth login` |
9697

9798
### Helm Install (recommended)
9899

@@ -158,6 +159,12 @@ command = "gemini"
158159
args = ["--acp"]
159160
working_dir = "/home/node"
160161
env = { GEMINI_API_KEY = "${GEMINI_API_KEY}" }
162+
163+
# OpenCode (requires opencode in PATH; run `opencode auth login` first)
164+
[agent]
165+
command = "opencode"
166+
args = ["acp"]
167+
working_dir = "/home/node"
161168
```
162169

163170
## Configuration Reference

config.toml.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ working_dir = "/home/agent"
2626
# working_dir = "/home/agent"
2727
# env = { GEMINI_API_KEY = "${GEMINI_API_KEY}" }
2828

29+
# [agent]
30+
# command = "opencode"
31+
# args = ["acp"]
32+
# working_dir = "/home/node"
33+
# # Note: opencode handles tool authorization internally and never emits
34+
# # session/request_permission — all tools run without user confirmation,
35+
# # equivalent to --trust-all-tools on other backends.
36+
# # Run `opencode auth login` once before starting openab.
37+
2938
[pool]
3039
max_sessions = 10
3140
session_ttl_hours = 24

0 commit comments

Comments
 (0)