fix: opencode plugin loading, native binding self-heal, variants, plan mode#8
Merged
Conversation
opencode resolves a plugin's entrypoint only from exports["./server"] or main; neither existed, so the package installed but registered no hooks and the cursor provider never appeared. Keep ./plugin for back-compat and correct the README install spec (bare package name).
opencode installs plugin packages with bun, which skips sqlite3's
install script, so @cursor/sdk's eager require("sqlite3") crashes with
"Could not locate the bindings file". Before loading the SDK (in-process
or sidecar), detect the missing binding and run sqlite3's own
prebuild-install -r napi under the system Node. One attempt per
process; failures log a manual fix and never throw.
Hosts position a part where it starts; appending later deltas to one long-lived text part rendered the final answer above the thinking blocks that preceded it. Close the open text part when reasoning begins and start a fresh text-N part for each resume.
opencode discards the provider.models() hook for providers outside its models.dev catalog, so config-seeded models are the only channel for variants — toOpencodeModels now includes them. Rename variants against the real catalog shapes: boolean params (thinking=[false,true]) collapse to one param-named variant instead of literal true/false; enum params (effort, reasoning) key by bare value with id-prefix only on collision. Drop the plan variant — plan is opencode's plan agent, mapped via chat.params.
chat.params fires after opencode merges the selected variant, so the agent-based default only applies when no explicit mode was chosen.
This was referenced Jun 10, 2026
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.
What
Five fixes from live testing against opencode 1.16.2:
./serverexport so opencode loads plugin — opencode resolves a plugin entrypoint only fromexports["./server"]ormain; neither existed, so the package installed but registered zero hooks (no provider, no models). README install spec corrected to the bare package name.@cursor/sdk's eagerrequire("sqlite3")then crashes ("Could not locate the bindings file"). The plugin now detects the missing binding before SDK load and runs sqlite3's ownprebuild-install -r napiunder the system Node. One attempt per process, never throws, logs a manual fix on failure.text-Npart.provider.models()hook for providers outside its models.dev catalog, so variants must ride on the config-seeded models. Variant naming reworked against the real catalog: boolean params collapse to a single param-named variant (no more literaltrue/false), enum params key by bare value, and theplanvariant is gone (plan is opencode's agent).chat.paramsfires post-variant-merge, so the agent default never clobbers an explicit mode.Testing
tsc --noEmitclean,tsupbuild clean.