Skip to content

feat(opencode): add ACP client backend support#28994

Draft
chaitanyarahalkar wants to merge 13 commits into
anomalyco:devfrom
chaitanyarahalkar:feat/acp-client-support
Draft

feat(opencode): add ACP client backend support#28994
chaitanyarahalkar wants to merge 13 commits into
anomalyco:devfrom
chaitanyarahalkar:feat/acp-client-support

Conversation

@chaitanyarahalkar
Copy link
Copy Markdown

@chaitanyarahalkar chaitanyarahalkar commented May 23, 2026

Issue for this PR

Closes #28991

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds ACP client-backed agents to opencode. This lets an agent config point at a local ACP server, then routes prompt turns through that server while storing the output in opencode sessions.

The implementation adds ACP server config, an agent backend field, an ACP client runtime, TUI state for ACP options/commands, snapshot/revert integration, and tests for streaming, multi-turn output, file writes, terminal commands, and fallback responses.

How did you verify your code works?

  • bun run typecheck
  • bun test test/acp test/config/config.test.ts test/session/prompt.test.ts test/session/snapshot-tool-race.test.ts
  • pre-push hook: bun turbo typecheck

Screenshots / recordings

I tested locally in the TUI with Cursor ACP. I can add screenshots if helpful.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Add ACP client-backed agents so opencode sessions can delegate turns to configured ACP servers while preserving TUI state, tool output, and native snapshot/revert behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 23, 2026
chaitanyarahalkar and others added 2 commits May 23, 2026 10:26
Handle ACP servers that briefly return internal errors when session/new is sent immediately after initialization.

Co-authored-by: Cursor <cursoragent@cursor.com>
Support ACP terminal commands that include shell syntax such as cd, pipes, and redirects instead of spawning them as executable names.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

chaitanyarahalkar and others added 7 commits May 23, 2026 11:18
Show ACP options for servers that expose legacy modes or models without configOptions, and route selections through the corresponding legacy ACP methods.

Co-authored-by: Cursor <cursoragent@cursor.com>
Show ACP options for ACP-backed sessions even before configOptions are synced, and support legacy modes/models from ACP servers.

Co-authored-by: Cursor <cursoragent@cursor.com>
Register /acp-options for every session so ACP configuration remains discoverable before backend option state finishes syncing.

Co-authored-by: Cursor <cursoragent@cursor.com>
Show /acp-options in every session regardless of whether ACP session metadata has synced yet.

Co-authored-by: Cursor <cursoragent@cursor.com>
Prefer ACP model state from the active session when rendering the prompt footer so model selections made through ACP options are visible.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use ACP config option state when rendering the prompt footer and keep legacy model state in sync after model option changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Update ACP session state from the config option HTTP response so the prompt footer reflects model changes without waiting for SSE propagation.

Co-authored-by: Cursor <cursoragent@cursor.com>
@chaitanyarahalkar chaitanyarahalkar marked this pull request as draft May 23, 2026 16:43
chaitanyarahalkar and others added 3 commits May 23, 2026 11:43
Adds an ACPClient.prepare path and a POST /session/:id/acp/prepare
endpoint that create the remote ACP session without running a prompt,
so config options (model, mode, etc.) are available before the user
sends their first message. The TUI now surfaces /acp-options on the
home view whenever the current agent is ACP-backed, auto-creates a
session and prepares the backend when invoked from home, and warms
the ACP session on session-route entry when configOptions are missing.
Also switches the ACP sync store update to granular path-based
setStore calls inside a batch so footer memos reactively pick up
configOption changes (Composer 2.5 etc.) without needing a refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>
For ACP-backed agents, the per-message footer was rendering the
opencode-side providerID/modelID (e.g. "GPT-5.5") that gets recorded
on the session, even though the actual response came from the ACP
backend (e.g. Composer 2.5). Override the displayed model with the
current ACP model from sync.data.acp when the message's agent is
ACP-backed so the message footer matches the prompt footer.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Support ACP-backed agents in opencode

1 participant