Support opencode v2?
Feature Description As stated in the title
I can reproduce the V2 incompatibility with [email protected] and the published @opencode/[email protected].
When the V2 loader reaches the plugin's built dist entry, registration fails with:
Plugin must export a default definition with an id and an effect or setup function.
The package currently default-exports the V1 OpenAIOAuthPlugin function. V2 resolves a server entry (falling back to the root entry) and expects an identified setup/effect definition. Merely changing the export shape is not sufficient: auth registration, request interception, retry/rotation, tools, and lifecycle cleanup need their actual V2 contracts.
Native V2 baseline
I also ran six controlled scenarios against the real 2.0.16 executable with the built-in OpenAI provider, two synthetic OAuth credential records and a local Responses/SSE fixture. No external plugins, real accounts, or subscription quota were used. Transport was explicitly HTTP, not WebSocket.
- Credential A and B each succeeded independently.
429 insufficient_quotaon A failed without trying B.- Explicitly activating B and resending recovered the same failed session.
- Synthetic
429 usage_limit_reachedand429 rate_limit_exceededeach made 11 requests (initial + 10 retries), all using A, then failed. B was never selected.
These are controlled HTTP observations, not a real ChatGPT login/refresh or default-WebSocket acceptance test. They distinguish native multiple-credential storage/selection from automatic rotation; they should not be generalized to every possible provider response or future V2 release.
Proposed contribution scope
I am investigating an additive V2 server adapter, keeping the V1 entry intact and reusing the existing account/storage/request logic rather than replacing it with a second account manager. Proposed acceptance gates:
- V2 loader registration and unload cleanup.
- Existing V1 build/typecheck/tests remain valid.
- Isolated positive and negative tests for credential selection, bounded retries, account isolation and cancellation, respecting existing cooldowns/provider limits.
- Explicit HTTP versus WebSocket support boundaries; no silent claim of full parity.
- Documentation and package entry points that do not rewrite an existing user's configuration unexpectedly.
I will keep implementation linked to this issue rather than opening a duplicate. If there is already an unpublished V2 branch or a preferred adapter direction, please point me to it before overlapping work grows. This is an investigation/contribution start, not a claim that V2 support is implemented or ready to release.
OpenCode V2 support was added in merged PR #269, which directly addresses this request