Repository navigation
Description
Summary
The OpenCode 2 (plugin/opencode2) entry assumes ctx.catalog (transform / reload). That domain exists on OpenCode 2.0 beta, but stable OpenCode 2.0.5 / 2.0.6 exposes ctx.provider / ctx.model / ctx.integration / ctx.aisdk and does not ship ctx.catalog.
Result: loading cursor-opencode-provider/plugin/opencode2 on stable OC2 crashes during setup (ctx.catalog.transform is undefined), so Cursor auth + model picker never come up.
Volunteer: @ebysofyan — will open a PR fixing this. Maintainer: please assign this issue to ebysofyan if possible (reporter lacks triage permission to self-assign).
Environment
| Item | Value |
|---|---|
| OpenCode | stable 2.0.5 / 2.0.6 (not beta) |
| Plugin entry | cursor-opencode-provider/plugin/opencode2 (or symlink to dist/plugin-opencode2.js) |
| Config dir | $OPENCODE_CONFIG_DIR (e.g. ~/.config/opencode2) |
| Classic OC1 | unaffected (plugin / plugin/v2) |
Repro
- Install OpenCode stable 2.0.x (not the beta build that has
ctx.catalog). - Point config at a dedicated dir, e.g.
OPENCODE_CONFIG_DIR=~/.config/opencode2. - Register the OC2 plugin entry (
plugin/opencode2or aplugins/cursor.jssymlink todist/plugin-opencode2.js). - Start / restart the OpenCode 2 service and open the model picker / Cursor auth flow.
Expected
- Plugin loads on stable OC2 without throwing.
- Cursor provider authenticates.
- Discovered Cursor models appear in the picker.
- Beta hosts that do have
ctx.catalogkeep the existing catalog transform path.
Actual
Setup crashes when the plugin calls ctx.catalog.transform (domain absent on stable). Provider/model transforms alone do not flush models into the live picker on 2.0.5.
Root cause (investigation)
Stable OC2 plugin surface:
- present:
ctx.provider,ctx.model,ctx.integration,ctx.aisdk - missing:
ctx.catalog
Draft mutations via ctx.provider / ctx.model transforms do not show up in list() on stable; the picker only honors models written under providers.cursor in the user config document (opencode.json / opencode.jsonc under OPENCODE_CONFIG_DIR).
Proposed fix
Keep OC1 entrypoints untouched. For OC2:
- Detect catalog: if
typeof ctx.catalog?.transform === "function"→ keep current betactx.catalog.transformpath. - Else (stable fallback): after model discovery, sync Cursor models into
providers.cursorin$OPENCODE_CONFIG_DIR/opencode.json(c)(AI SDK package + model map), so auth / aisdk hooks / picker work on 2.0.5+. - Add regression tests for the config-sync helper and document the stable vs beta paths in README.
Working implementation on fork; PR will reference this issue (Fixes #N).
References
- Fork branch: https://github.com/ebysofyan/cursor-opencode-provider/tree/fix/oc2-stable-no-catalog-compat
- Commit: ebysofyan@6c6ee89
Checklist for PR
- Guard
ctx.catalog(beta path unchanged when present) - Stable fallback: sync
providers.cursorinto config - Tests for config sync / catalog detection
- README: stable 2.0.5+ vs beta notes
- No behavior change for classic OpenCode 1.x plugin entries
Activity
fix(opencode2): support stable 2.0.x without ctx.catalog
fix: steer host notes into the running Cursor turn
fix: steer host notes into the running Cursor turn
fix: steer host notes into the running Cursor turn