Repository navigation
Conversation
The OpenCode 2 inventory registered `package: "aisdk:cursor-opencode-provider"`. OpenCode resolves a bare npm name as `@latest`, and on 2.0.22 the language model is built from that spec: the built-in `opencode.provider.dynamic` plugin is registered before external plugins and its `sdk` hook installs and imports the package itself (anomalyco/opencode#42788), so this plugin's own `sdk` hook finds `event.sdk` already set. A user who pinned `cursor-opencode-provider@0.8.0` in `plugins` therefore ran the last published language model (`<cache>/npm/cursor-opencode-provider@latest/`), and that copy changed whenever OpenCode refreshed its package cache. Register `aisdk:cursor-opencode-provider@<version>`, read from this package's own package.json (two levels above both src/opencode2 and dist/opencode2), and fall back to the bare name when that file is missing or describes another package. `CURSOR_OPENCODE2_DEV_ENTRY` still wins. Same fix as stablekernel/opencode-cursor#129.
nkoynov
force-pushed
the
fix/pin-aisdk-package-version
branch
from
October 5, 2026 18:17
6231ac3 to
bf4f48e
Compare
Contributor
Author
|
Closing this since I no longer need it: I now point OpenCode at a pinned local build of the package, so the @latest lookup never happens on my side. Happy to reopen if it's useful to you. |
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.
The 2.0 inventory registers
package: "aisdk:cursor-opencode-provider", and OpenCode resolves a bare npm name as@latest. On 2.0.22 the language model is built from that spec. The built-inopencode.provider.dynamicplugin is registered before external plugins and itssdkhook installs the package itself (anomalyco/opencode#42788), so this plugin'ssdkhook returns atif (event.sdk) return. The README troubleshooting row and docs/opencode-2.md already say that 2.0 npm-installs the published package.As a result,
"plugins": ["cursor-opencode-provider@0.8.0"]still runs the latest published language model, and that copy can change whenever OpenCode refreshes its package cache.This PR registers
aisdk:cursor-opencode-provider@<version>:package.json, two levels above bothsrc/opencode2/anddist/opencode2/.CURSOR_OPENCODE2_DEV_ENTRYstill wins.This is the same fix as stablekernel/opencode-cursor#129. That project inlines the version at build time because its bundle has no
package.jsonnext to it. tsc keeps the layout here, so reading the file at runtime works and the build doesn't change.plugin-opencode2.test.tschecks the pinned spec and the fallbacks (missing file, other package, version range).DEV_ENTRYunset, one ping):maininstallsnpm/cursor-opencode-provider@latest/.npm/cursor-opencode-provider@0.8.0/.package.jsonset to 0.7.6 installs@0.7.6. Its Runs come from that copy: they log 0.7.6'sskills=field.