Uh oh!
There was an error while loading. Please reload this page.
feat(acp): stage edits for native review in ACP clients - #31392
Conversation
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
1a2ac59 to
2dab6a1Compare6517bab to
3ee004cCompare278709b to
72426bfCompare72426bf to
70f55c9Compare01855c7 to
2678171Compare63b0b5e to
f323fceComparef323fce to
0f207c3Comparef753cca to
8680040CompareIn-memory overlay that holds staged file content during an ACP turn so add/update writes can be sent to the client for native review instead of hitting disk immediately.
Gate review staging on the client writeTextFile capability, flush staged edits through ACP, and wrap FSUtil so tool writes land in the overlay instead of disk while review mode is active.
Wire review mode into ACP session lifecycle, tool registry, and edit/write/ apply_patch tools so add/update changes reach the client review UI via writeTextFile. Delete/move still hit disk and show as tool_call diffs.
Upstream dropped @opencode-ai/core/util/log; migrate ACP review paths to Effect.logInfo/logError so typecheck passes after the rebase.
ToolRegistry.defaultLayer already provides Agent; align the registry test layer with skill.test and use an inline build agent to satisfy Effect types.
… migration Re-add ReviewFs to ToolRegistry.node and createRoutes so tool writes stage in memory again. Remove misplaced ReviewFs from AppRuntime, which ACP does not use.
Verify ToolRegistry.node with ReviewFs stages edits through the same layer wiring used by the HTTP server after the LayerNode migration.
Adapt ReviewFs.node and the HTTP review regression test to the new LayerNode.make object form and compile() after upstream rebase.
Replace removed FSUtil.defaultLayer usage with compile-based ReviewFs nodes and global FSUtil replacement in the HTTP app graph so ACP review staging keeps working on the current dev stack.
8680040 to
a8d3d1aCompareAutomated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Related to #4240
Related to #30913
Type of change
What does this PR do?
This makes opencode work with the native file review in ACP clients like Zed and Devin.
Before, opencode wrote files directly to disk during the turn. Because of this, the client could not show its native review UI (the "Keep / Reject" diff).
Now, when the client supports
fs.writeTextFile:writeTextFile, so they appear in the native review UI.writeTextFile, opencode writes to disk like before (safe fallback).How it works
How did you verify your code works?
Added and updated unit tests: review-mode capability gating, staging via the tool registry, the apply_patch disk note, and clearing the overlay when a prompt fails. All tests pass and typecheck is clean.
Tested manually in Zed and Devin (see screenshots below).
How to try it
You need an ACP client that supports the
fs.writeTextFilecapability (Zed and Devin do).bun install./path/to/opencodewith your local path, and make surebunis on yourPATH(or use the full path to thebunbinary).apply_patchdeletes and moves, you see a diff in the tool call.Zed
Add this to your Zed
settings.json:{ "agent_servers": { "OpenCode (Review UI)": { "type": "custom", "command": "bun", "args": [ "run", "--conditions=browser", "/path/to/opencode/packages/opencode/src/index.ts", "acp" ] } } }Windsurf / Devin
Add this entry to your ACP
registry.json:{ "id": "opencode-review-ui", "name": "OpenCode (Review UI)", "version": "1.0.0", "description": "OpenCode ACP review-at-end", "distribution": { "binary": { "darwin-aarch64": { "archive": "", "cmd": "bun", "args": [ "run", "--conditions=browser", "/path/to/opencode/packages/opencode/src/index.ts", "acp" ] } } } }Use the platform key that matches your OS (for example
darwin-aarch64for Apple Silicon).Screenshots / recordings
Checklist