Add OpenCode 2 beta adapter - #6
Open
shanebishop1 wants to merge 15 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an isolated OpenCode 2 beta package while keeping the existing V1 package and release line unchanged.
What changed
opencode-command-hooks-v2@0.1.0-beta.0, pinned to@opencode-ai/plugin@0.0.0-next-15853.session.startandsession.idlehooks.subagent/agentevents to the existingtask/subagent_typeconfig contract.resume: falsefor synthetic messages to avoid unsolicited turns.Why
OpenCode 2 does not load V1 plugin exports and runs as a long-lived multi-location service. A separate package avoids breaking V1 users, while the shared host-neutral core prevents the adapters from drifting. Resolving each session through the V2 client provides the correct project directory instead of relying on process cwd.
Real-host verification
The E2E installs the packed V2 package and
@opencode-ai/cli@0.0.0-next-15853into a temporary project, starts a private server on an OS-selected port, and polls until plugin activation completes. Temporary HOME/XDG paths and explicit test credentials keep it separate from the normalopencodeinstallation and service. The test passes and confirmsopencode-command-hooks.v2completes setup in the real host.Verification
npm run lintnpm run typecheckbun test: 143 passedOPENCODE2_E2E=1 bun test tests/e2e.v2.test.ts: passed twice consecutivelybun run build:allnpm pack --dry-run: passedOpenCode 2 remains beta. Server plugins still cannot display TUI toasts, and exact CLI/plugin version pins remain required.
Issue #5: active subagent waits
excludeSubagentWaitsupport forsession.idlehooks in both adapters.taskcalls; V2 normalizes nativesubagentcalls to the same lifecycle.sessionScopeapproach was fully reverted because it did not address active subagents.Verification:
npm run lint,npm run typecheck,npx --yes bun@1.3.9 test --timeout 20000(142 passed, 3 gated skips), V1 TypeScript build, and V2 bundle build.