opencode-pty icon indicating copy to clipboard operation
opencode-pty copied to clipboard

Plugin fails to load on OpenCode v2.0.27 - incompatible plugin API

Open Swcmb opened this issue 1 month ago • 1 comments

Bug Description

[email protected] fails to load as a plugin on OpenCode v2.0.27 with the following error:

Plugin must export a default definition with an id and an effect or setup function.

Environment

  • OpenCode version: v2.0.27
  • opencode-pty version: 0.4.0 (latest on npm)
  • Platform: Windows 11
  • Node: v22.18.0

Steps to Reproduce

  1. Install opencode-pty: opencode plugin add opencode-pty@latest
  2. Start OpenCode v2.0.27
  3. Plugin fails to load with the error above

Root Cause

OpenCode 2.0 introduced a new Effect-based plugin API that requires plugins to export a default definition with id and effect or setup function keys. opencode-pty currently uses the old export format (named exports like export { PTYPlugin }).

Expected Behavior

opencode-pty should either:

  • Adapt to the new Effect-based plugin API, OR
  • Provide a compatibility shim for OpenCode 2.x

Additional Context

  • Similar issues reported for oh-my-openagent: https://github.com/code-yeongyu/oh-my-openagent/issues/10089
  • Related v2 plugin installation bug: https://github.com/shekohex/opencode-pty/issues/67

Swcmb avatar Oct 13 '26 09:10 Swcmb

Confirming this is still current as of 2026-10-16 — nothing changed on either side:

  • Host upgraded to OpenCode 2.0.30 (@opencode/cli, channel latest), Windows 11, Node v22.18.0
  • [email protected] remains npm latest (last publish 2026-09-18)
  • Load still fails deterministically with the same message: Plugin must export a default definition with an id and an effect or setup function. (refs err_ee462d92, err_5a1c4f26)

The host ships no V1 compatibility layer (https://opencode.ai/v2/docs/build/plugins/migrate-v1), so a V2-shaped default export ({ id, effect } or { id, setup }) is required for 2.x. Happy to re-test a V2 build.

Swcmb avatar Oct 15 '26 23:10 Swcmb