Repository navigation
feat: add opencode v2 support (dual v1/v2 plugin entrypoint) - #127
Merged
Merged
Conversation
opencode v2 ships as a separate npm scope (@opencode/cli) with a new plugin API. The default export is now an object carrying both entrypoints: v1 (>= 1.18.29) calls `server`, v2 calls `setup`. Each host ignores the other's key. v2 `setup` (src/plugin/v2.ts) registers the Cursor provider and model catalog (real per-model cost, settings.cwd pinned to the session directory), stored-key/env auth methods, the session context and title hooks, and cursor_refresh_models. Cleanup removes the generated system rule. Not exposed on v2: cursor_delegate / cursor_cloud_agent (v2 has no plugin-drivable approval path, so they stay absent rather than ungated) and cursor_update_plugin (v1 cache layout; use `opencode plugin update`). Remaining gaps are listed in the README. cursor_refresh_models / cursor_update_plugin bodies move to a shared builder in cursor-tools.ts; v1 behavior is unchanged. A root server.js re-export lets v2 load a file:// directory plugin.
This was referenced Sep 29, 2026
justin-carper
added a commit
that referenced
this pull request
Oct 3, 2026
Promotes the 0.10.0 line from @next to latest: opencode v2 support alongside v1 (#127), the subagent transcript fix (#114), regenerated model limits/costs, and the repaired weekly model-data drift check. Consolidates pre-releases 0.9.1-next.0, 0.10.0-next.1, and 0.10.0-next.2 (0.10.0-next.0 was tagged but never published). The README v2 install example switches back to @latest.
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
Adds opencode v2 support while keeping v1 working. v2 is a separate npm scope (
@opencode/cli, first 2.x on 2026-09-11) with its own plugin API, not a 2.x ofopencode-ai.The default export is now
{ id, setup, server }. v1 (>= 1.18.29) callsserver(unchangedCursorPlugin); v2 callssetup(newsrc/plugin/v2.ts). Each host ignores the other's key.What v2 gets
settings.cwdpinned to the session directory)CURSOR_API_KEYauth methodscontexthook (sessionID / plan-mode forwarding) andtitlehook (ephemeral, same race fix as v1'schat.params)cursor_refresh_modelsNot on v2 (documented in README, CHANGELOG, SECURITY.md)
cursor_delegate/cursor_cloud_agentare deliberately not registered. v1 gates them fail-closed withcontext.ask. v2's pluginToolContexthas no approval path a plugin can drive, and nothing else in 2.0.19 enforces one, so registering them would run Cursor agents ungated. Absent beats silently ungated.cursor_update_plugin(clears the v1 cache layout; on v2 useopencode plugin update)provider.cursor.optionsblock (includingautoCompaction), live MCP forwarding, skill mirror, plugin-tools bridge, subagent task-part stamping, update toast,app.logbridgeReview notes
server.jsat the repo root is new and is infiles. v2's loader probes literal root entrypoints forfile://directory plugins and never readspackage.jsonexports. npm installs by name are unaffected.cursor_refresh_models/cursor_update_pluginbodies moved verbatim intobuildMaintenanceTools()incursor-tools.ts, shared by both entrypoints. v1 description text and behavior are byte-identical.resolveApiKeymay now be async.CursorPluginimport. Assertion logic is unchanged.package-lock.jsonis intentionally not part of this PR.package.jsongains no dependencies, and the lockfile onmainalready drifts against the registry.Verification
npm test: 42 files, 641 tests, exit 0.npm run typecheckandnpm run buildexit 0.dist/plugin/index.{js,d.ts}contain no reference to@opencode/plugin;server.jsis in thenpm packfile list.cursor/claude-haiku-4-5,reply with exactly: OKreturnedOK):@opencode/cli2.0.19, run withrun --standalonefrom a project dir that is its own git rootcursor_refresh_modelscompleted. That run used the built-inopencode/big-picklemodel because Claude Haiku chose bash over the tool.--standalonewas exercised), and thecwdsetting under that mode.OPENCODE_CURSOR_PROVIDER_NPM=file://<checkout>/dist/provider/index.js; the v2 loader otherwise resolves the npm-published provider copy.scripts/integration-test.sh(CI's real-host smoke) was not run locally; CI will exercise it.Changelog entry is under
[Unreleased].