[idea] Add native OpenCode 2 beta integration #1971
Replies: 2 comments
Verification update: deterministic route ownership and teardownI reproduced a stronger version of the multi-pane bug with two OpenCode 2 TUIs in the same cwd. The focused conversation belonged to one pane, but the cwd/latest-session fallback attributed its session ID to the other pane. Cwd filtering is therefore not an ownership boundary and should be removed rather than refined. For the installed
The corrected local integration now:
Verification on Herdr
One Herdr lifecycle detail mattered during testing: reusing the exact session ID immediately after releasing it is intentionally suppressed as a stale same-process report. A fresh session ID reacquired authority correctly. This is expected stale-resurrection protection, not an OpenCode attribution failure. For the same reason, The native V2 integration should therefore use route identity only and must return a teardown cleanup that releases the pane. |
|
chiming in since i hit exactly this — opencode2 is more than a rename: the v1 plugin file doesn't load on v2 at all (different registry shape), so even with the symlink trick you lose lifecycle reporting and session restore and fall back to the screen manifest. while waiting on a native integration i got both hosts covered from one plugin: |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
idea / problem
OpenCode 2 is available as the separate
opencode2beta executable. Herdr 0.7.5 acceptsherdr integration install opencode, but that installer writes the V1 plugin shape. OpenCode 2 requires a default{ id, setup }V2 plugin, so the installed integration is not activated there.I locally ported it and confirmed Herdr reports the OpenCode session ID and lifecycle state with
opencode2 v0.0.0-next-16365.The V2 plugin API is still beta, so the integration may need to track API changes until 2.0 is stable.
Screenshot of the local proof:

update: multi-pane attribution bug
Testing two simultaneous OpenCode 2 TUIs exposed a cross-pane bug in the first proof. A TUI plugin is pane-scoped, but
ctx.data.listencan still receive events for sessions owned by other TUI panes. Without ownership filtering, both panes can report another pane's session ID and Herdr animates the wrong agent row.The corrected local integration now:
~/.config/opencode/cli.jsonctx.data.session.root()Verified with
~/.config/opencodeandorfloat-adminopen simultaneously: each Herdr pane now reports its own OpenCode session ID and idle state.requested change
Please add a native
opencode2integration target during beta, or make the existingopencodeinstaller version-aware.The V2 integration should be loaded as a TUI plugin through
~/.config/opencode/cli.json, not as an auto-discovered server plugin. OpenCode 2's background server is shared, whileHERDR_PANE_IDandHERDR_SOCKET_PATHare pane-scoped in the TUI process. TUI process scoping alone is insufficient because session events still require explicit ownership filtering.Suggested event mapping:
workingidleblockedworkingIt should include status and uninstall handling, detect the
opencode2executable, and coexist with V1 while the beta uses a separate name.why you want this
This would make Herdr's built-in integration work with OpenCode 2 without requiring users to maintain a local compatibility plugin. Correct session-family filtering keeps multi-pane state transitions and session restoration reliable with the shared service architecture.
Related, but distinct: #1885 asks for multiple OpenCode sessions per pane. This request is specifically for OpenCode 2 API compatibility.
All reactions