Skip to content

Conversation

josephschmitt
Copy link
Contributor

@josephschmitt josephschmitt commented Sep 4, 2025

Summary

  • Adds an ACP-compliant JSON-RPC server over stdio so Zed can use opencode as a headless agent.
  • Reuses existing session and tool pipelines; minimal-first implementation, ready to iterate on streaming.

What Changed

  • New packages/opencode/src/acp/server.ts: stdio JSON-RPC 2.0 server for ACP.
  • CLI: --acp flag and ZED_ACP env switch in packages/opencode/src/index.ts.
  • Tests: packages/opencode/test/acp.test.ts covers initialize → complete → shutdown.
  • Docs: packages/opencode/README.md updated with ACP usage and methods.

ACP Methods

  • initialize, shutdown
  • text/complete (non-streaming for now)
  • tool/list, tool/run
  • files/read, files/write
  • fs/glob
  • session/start, session/stop
  • diagnostics/log

Tooling Surface

  • Exposes a basic set via ToolRegistry: read, write, glob, bash, webfetch.

Usage

  • Run from repo: bun run packages/opencode/src/index.ts --acp
  • Or install and run: set ZED_ACP=1 and invoke opencode
  • Zed settings: add an ACP provider that runs ["opencode", "--acp"] (or the bun dev command).

Testing

  • E2E: bun test packages/opencode/test/acp.test.ts
  • Manual: pipe JSON-RPC lines to bun run packages/opencode/src/index.ts --acp and observe responses.

Notes

  • Headless; respects project cwd provided by Zed.
  • No streaming yet (planned follow-up).
  • No breaking changes to existing HTTP server or CLI.

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.

1 participant