What Changed
Adds an opencode2 provider driver beside the existing opencode (v1) driver.
OpenCode 2 is a different architecture than v1 — one shared background service instead of a spawned per-thread server, and an Effect-native client instead of promises — so it can't be handled by the v1 driver.
opencode2Runtime.ts: connects to the background service (or a configured serverUrl), 2.x version gate, loads model/skill inventory.
OpenCode2Adapter.ts: drives turns from session.execution.* events; reconnects with backoff and reconciles, since v2 streams have no replay. Resume re-adopts a versioned session cursor, rollback forks, compaction is native.
buildOpenCode2SessionRules: maps T3 runtime modes onto server-enforced permission rules, so supervised modes hold on a shared server.
- MCP: per-thread registrations carrying that thread's credential; rules deny every foreign registration so a restricted session can't run another thread's tools.
OpenCode2Provider / OpenCode2Driver: health + inventory probe, manual-only maintenance, text generation via generate.text.
Also registers the driver in the web and mobile pickers/settings, and adds OpenCode2Settings to contracts.
Why
T3 Code lists OpenCode as supported, but the v1 driver targets a different product and cannot connect to OpenCode 2. Users on v2 have no working path today.
Building on @opencode/client/effect avoids promise bridging, per-thread server processes, and string-matching on errors, and lets supervised modes be enforced server-side.
Verified against a live OpenCode 2.0.3 service: inventory loads, MCP tool calls work through the per-thread token, title generation succeeds, sessions resume across restarts.
Also, note that it uses official opencode Effect client instead of wrapping promise-based client like #8207 does. Besides this, runtime code was duplicated intentionally instead of reusing OpenCode 1's code - keeping it separate.
UI Changes
One provider entry: Settings row, model picker, icon mapping, default model openai/gpt-6-astra (v1-era gpt-5 is gone from the v2 catalog).
Checklist
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes
- I included a video for animation/interaction changes
Summary by CodeRabbit
- New Features
- Added OpenCode 2 as a supported provider.
- Added model discovery, custom server connections, authentication, MCP support, permissions, attachments, and text generation.
- Added OpenCode 2 configuration options, model selection support, and provider icons.
- Added handling for unavailable OpenCode 2 models.
- Bug Fixes
- Preserved provider metadata and unavailable models for OpenCode and OpenCode 2.
- Improved model variant handling and server health validation.