Skip to content

feat: support OpenCode 2 alongside OpenCode 1 - #8

Merged
razmser merged 1 commit into
mainfrom
opencode2-support
Oct 14, 2026
Merged

razmser merged 1 commit into
mainfrom
opencode2-support

Conversation

@razmser

@razmser razmser commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

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.

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.
@razmser
razmser merged commit a76680b into main Oct 14, 2026
1 check passed
@razmser
razmser deleted the opencode2-support branch October 14, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant