feat(plugin): add opencode v2 dual compatibility support - #107
Draft
anthonyhaussman wants to merge 23 commits into
Draft
anthonyhaussman wants to merge 23 commits into
anthonyhaussman wants to merge 23 commits into
Conversation
anthonyhaussman
force-pushed
the
tone/feat/opencode-v2-dual-compat
branch
8 times, most recently
from
September 19, 2026 10:18
2a565ef to
9dc0b7a
Compare
anthonyhaussman
force-pushed
the
tone/feat/opencode-v2-dual-compat
branch
4 times, most recently
from
September 24, 2026 16:00
f821504 to
6539e46
Compare
This was referenced Sep 25, 2026
Assisted-by: Gemini 3.8 Flash
Assisted-by: Gemini 3.8 Flash
Assisted-by: Gemini 3.8 Flash
Assisted-by: Gemini 3.8 Flash
Assisted-by: Gemini 3.8 Flash
Document dual runtime paths, capability mappings, and update surface review checklist for v2 adapter. Assisted-by: Gemini 3.8 Flash
Assisted-by: Gemini 3.8 Flash
Configure provider package prefix as 'aisdk:@ai-sdk/google' for bundled adapter mapping. Register model variants for tiered models from TIER_MAPPING in catalog transforms. Assisted-by: Gemini 3.8 Flash
Configure integration transform for oauth login and attach providerID filter to session hooks to route requests and strip api key. Assisted-by: Gemini 3.8 Flash
Register aisdk sdk hook with dummy apiKey and v2 fetch interceptor. Implement full Google OAuth authorize method and token exchange callback in integration transform. Assisted-by: Gemini 3.8 Flash
Use standard authorizeAgy with PKCE verification in v2 integration transform. Auto inject bearer token from stored credentials in session http request hook. Assisted-by: Gemini 3.8 Flash
Avoid automatically launching web browser during coverage runs. Assisted-by: Gemini 3.8 Flash
Add test launcher hook to prevent browser popup during unit tests. Stub stored credentials in v2 tests to fix CI assertions. Assisted-by: Gemini 3.8 Flash
Guard openBrowserUrl against launching desktop browsers in vitest test environments. Mock browser launcher in unit tests while preserving coverage. Assisted-by: Gemini 3.8 Flash
Align v2 oauth callback schema to Credential.OAuth and rewrite generativelanguage requests to Code Assist endpoint with payload transformations. Guard auth storage against test overwrites. Assisted-by: Gemini 3.8 Flash
Add unit tests for request header mutation and fallback handling. Ensures coverage thresholds pass on CI. Assisted-by: Gemini 3.8 Flash
Await transformAgyResponse in http.response hook to prevent undefined response status in OpenCode v2 executor. Correlate requested model across rewritten request URLs. Assisted-by: Gemini 3.8 Flash
Document v2 integration transform with PKCE flow, AI SDK hook, dual auth storage, surface checklist, and local v2 smoke testing. Assisted-by: Gemini 3.8 Flash
Support top-level provider and model registries introduced in OpenCode v2.0.8. Retain catalog fallback for backward compatibility. Assisted-by: Gemini 3.8 Flash
Split v2 plugin logic across modular submodules. Extract shared headers, tier resolution, auth storage, fetch interceptor, and session hooks. Colocate tool and command definitions. Assisted-by: Gemini 3.8 Flash
Clone Request instance with updated url instead of mutating read-only property in request hook fallback. Assisted-by: Gemini 3.8 Flash
Delete parameters_json_schema and parametersJsonSchema fields to avoid backend rejection when parameters is set. Assisted-by: Gemini 3.8 Flash
anthonyhaussman
force-pushed
the
tone/feat/opencode-v2-dual-compat
branch
from
September 25, 2026 06:31
68104cf to
c7d92ef
Compare
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.
Description
Reference Issue: #106.
Plugin Core Architecture
Add OpenCode v2 plugin contracts and composite entrypoint support to maintain full backward and forward compatibility.
Enable OpenCode v1 runtimes to invoke the existing server lifecycle while OpenCode v2 runtimes execute the setup hook from a single package.
V2 Adapter Implementation
Implement OpenCode v2 setup adapter integrating catalog, tool, command, and session hooks.
Route model registration, quota tools, CLI quota commands, HTTP request header injections, and backoff retry logic through native v2 extension points.
Package Entrypoint & Exports
Export the dual v1 and v2 plugin definition from index.ts.
Preserve named exports for v1 consumers while exposing the default composite object expected by both runtime generations.
Documentation
Document the dual v1 and v2 architectural design and runtime execution paths in README.md and AGENTS.md.
Detail runtime resolution mechanics, version capability mappings, and updated surface review checklists for future maintenance.