feat(opencode): add ACP client backend support#28994
Draft
chaitanyarahalkar wants to merge 13 commits into
Draft
feat(opencode): add ACP client backend support#28994chaitanyarahalkar wants to merge 13 commits into
chaitanyarahalkar wants to merge 13 commits into
Conversation
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>
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>
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #28991
Type of change
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
backendfield, 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 typecheckbun test test/acp test/config/config.test.ts test/session/prompt.test.ts test/session/snapshot-tool-race.test.tsbun turbo typecheckScreenshots / recordings
I tested locally in the TUI with Cursor ACP. I can add screenshots if helpful.
Checklist