Connect
| Task | OpenCodeOpenCode 2.0.32 |
|---|---|
| Start the server | opencode service startforeground: opencode serve |
| Connect a client | opencode --server <url> |
| Credentials | CLI server: generated password signed session credentials also accepted |
| Connection security | Password rotation revokes sessions embedded servers may omit password |
| Relay or tunnel | opencode pair --remoteencrypted OpenTunnel |
| Pair a device | Interactive consent or --yesconsent remembered |
| Requirements | Access to your server execution stays on its host |
| Run in background | Shared background service |
Cloud tasks
| Task | OpenCodeOpenCode 2.0.32 |
|---|---|
| Send to cloud | Provider cloud handoff not established |
| Bring work back | Not established |
Sessions
| Task | OpenCodeOpenCode 2.0.32 |
|---|---|
| List sessions | HTTP session list/get |
| Read history | HTTP messages and snapshots |
| Resume | Continue server-owned session ACP resume also available |
| Fork | Session fork conversation copy only |
| Join running work | Multiple UI/API clients same server sessions |
| Answer approvals | HTTP permission/form handling ACP permission decisions |
| Receive updates | Server event stream |
| Stop a turn | /api/session/:sessionID/interruptACP session/cancel |
Execution
| Task | OpenCodeOpenCode 2.0.32 |
|---|---|
| When the client disconnects | Background service survives viewer closing |
| Restart and recovery | Restart recovery exists in-flight tools may be interrupted |
| Where tools run | Server host and selected workspace |
Build an integration
| Task | OpenCodeOpenCode 2.0.32 |
|---|---|
| ACP | Native ACP stdio separate from HTTP and OpenTunnel |
| API or SDK | Native HTTP API/client |
| Custom relay clients | Use HTTP API check embedded server auth separately |
Research and evidence
OpenCode, Source inspected, Remote execution not tested
- Default password and pairing behavior applies to the released 2.x CLI-managed service, not all embeddings.
- OpenTunnel exposure needs consent and a running server; OpenCode 1.x has separate historical behavior.
- No OpenTunnel provisioning, device pairing, permission turn or restart recovery probe was run.
- Source inspection and official documentation establish implementation or documented behavior, not a passing end-to-end remote probe.
- connect:
opencode service startruns the shared background HTTP server and web UI;opencode serveruns it in the foreground. Connect a TUI withopencode --server <url>. Default loopback ports are 49374 on macOS/Linux/WSL and 28894 on Windows; use service status for the actual address. - 2.1.3+ latest-channel Windows default is 28894 (0x70DE); other platform/channel defaults remain separate. The CLI service launch calls defaultPort; service status reports the actual bound address.
- auth: The CLI-managed server generates password protection by default. HTTP authorization accepts the server password or a signed session credential, including paired browser cookies. Password rotation invalidates all issued sessions. The lower-level server auth Config can omit a password: do not infer that every custom embedded server is protected.
- Pairing codes are single-use with a five-minute TTL; resulting credentials last 30 days. Listen address, CORS and authentication are separate settings.
- relay:
opencode pair --remoteexposes the server through an end-to-end encrypted OpenTunnel address. Initial exposure requires interactive consent or--yes; acceptance is remembered. Pairing grants access to this server, while execution stays on its host. This tunnel is distinct from provider cloud task handoff. - cloud: The native service and OpenTunnel connect clients to your execution host. They do not establish a provider-hosted Cloud Agent conversation handoff or teleport workflow. No such handoff is inferred from server availability.
- history: The HTTP API has session list/get and message/snapshot operations plus session fork. Clients can read stored history and continue server-owned sessions. ACP separately registers list/load/resume/fork; load replays history while resume can attach without that replay. A copied fork is a distinct conversation, not a filesystem snapshot.
- attach: Multiple UI/API clients talk to the same running server and its sessions. Event streaming gives live updates; reopening persisted history is separate from watching an active session. The native HTTP routes and ACP session methods are different protocols.
- controls: The native HTTP API exposes
session.interruptat/api/session/:sessionID/interrupt, along with permission/form handling. ACP translates permission decisions and session/cancel to server control operations. Disconnecting a viewer is distinct from explicitly interrupting execution; cancelling queued input is another operation. - lifetime: The shared background service survives an individual TUI or browser closing. Foreground serve lasts with its process or supervisor. Service configuration changes stop the background server and need a subsequent start. Restart recovery exists, but uninterrupted in-flight tools across server death are not guaranteed.
- 2.1.2+ experimental.location_idle_timeout accepts a duration or false, read per location (default 60 minutes). Waiting/running executions and owned background shell/subagent jobs keep a location loaded. Service-process lifetime and per-location eviction are separate.
- workspace: Files, shell tools, configuration and session state belong to the OpenCode server host and selected workspace. Pairing a phone or opening a remote TUI does not move execution to that client.
- acp: Native OpenCode ACP runs over stdio, with list/load/resume/fork and cancellation registered as separate protocol handlers. It drives the OpenCode service through its client; the stdio endpoint is not itself the HTTP API or an OpenTunnel URL.
- embedding: Use the native HTTP API/client for custom remote interfaces and event streams. The server auth module, middleware and CLI launch/configuration path must be considered together; a password default in the CLI is not a universal framework guarantee.
- 2.1.4 adds experimental connectClientMcp for client-hosted tools over a reconnecting WebSocket. Server-side origin/authentication and location-scoped attach remain required; this does not turn OpenCode into an MCP server.
- opencode v2.0.32: services/www/src/docs/content/cli/web.mdx, Documentation, checked 2026-10-19
- opencode v2.0.32: packages/server/src/auth.ts, Source code, checked 2026-10-19
- opencode v2.0.32: packages/server/src/pairing.ts, Source code, checked 2026-10-19
- opencode v2.0.32: packages/server/src/middleware/authorization.ts, Source code, checked 2026-10-19
- opencode v2.0.32: packages/server/src/handlers/session.ts, Source code, checked 2026-10-19
- opencode v2.0.32: packages/cli/src/acp/agent.ts, Source code, checked 2026-10-19
- opencode v2.0.32: packages/cli/src/acp/replay.ts, Source code, checked 2026-10-19
- opencode v2.0.32: packages/server/src/process.ts, Source code, checked 2026-10-19
- opencode v2.0.32: packages/cli/src/acp/service.ts, Source code, checked 2026-10-19
- opencode v2.0.32: packages/protocol/src/groups/session.ts, Source code, checked 2026-10-19
- OpenCode 2.0.32 ACP turn permissions and interrupt, Source code, checked 2026-10-19
- 2026-10-24 release review: opencode oc-port, Source code, checked 2026-10-24
- 2026-10-24 release review: opencode oc-port-caller, Source code, checked 2026-10-24
- OpenCode v2.0.32 pairing command implementation, Source code, checked 2026-10-20
- 2026-10-24 release review: opencode oc-location, Source code, checked 2026-10-24
- OpenCode v2.0.32 ACP documentation, Documentation, checked 2026-10-20
- 2026-10-24 release review: opencode oc-client-mcp, Source code, checked 2026-10-24
- 2026-10-24 release review: opencode oc-client-mcp-server, Source code, checked 2026-10-24