Repository navigation
feat: support OpenCode 2 alongside OpenCode 1 - #8
Merged
Merged
Conversation
One default export now serves both majors: OpenCode 1 calls server() (the existing implementation, moved to src/v1.ts) and OpenCode 2 calls setup() (new src/v2.ts). Imports from @opencode/plugin are type-only because OpenCode 1 does not provide that package at runtime. On OpenCode 2 the plugin registers the coreinfra integration (API key or COREINFRA_API_KEY), fetches the Hub inventory for the active connection and adds the coreinfra provider with native protocol packages. Model metadata and thinking variants come from OpenCode's built-in catalog. The inventory refreshes when the active credential switches. setup() does nothing in the preview V2 host that OpenCode 1.18+ also runs, since server() already covers it there. Chat-route models (DeepSeek, ZAI, Moonshot) get reasoning effort variants from the upstream effort list on both majors. OpenCode 1 otherwise guesses them from the model ID and offered no "max" for the Hub's deepseek-flash alias; OpenCode 2 offered none at all. Moonshot models no longer advertise temperature support: Moonshot only accepts 1, and OpenCode's title agent sent another value.
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.
One default export now serves both majors: OpenCode 1 calls server() (the existing implementation, moved to src/v1.ts) and OpenCode 2 calls setup() (new src/v2.ts). Imports from @opencode/plugin are type-only because OpenCode 1 does not provide that package at runtime.
On OpenCode 2 the plugin registers the coreinfra integration (API key or COREINFRA_API_KEY), fetches the Hub inventory for the active connection and adds the coreinfra provider with native protocol packages. Model metadata and thinking variants come from OpenCode's built-in catalog. The inventory refreshes when the active credential switches. setup() does nothing in the preview V2 host that OpenCode 1.18+ also runs, since server() already covers it there.
Chat-route models (DeepSeek, ZAI, Moonshot) get reasoning effort variants from the upstream effort list on both majors. OpenCode 1 otherwise guesses them from the model ID and offered no "max" for the Hub's deepseek-flash alias; OpenCode 2 offered none at all.
Moonshot models no longer advertise temperature support: Moonshot only accepts 1, and OpenCode's title agent sent another value.