Skip to content

Support OpenCode v2 plugin API - #121

Open
dbpolito wants to merge 4 commits into
mainfrom
feature/opencode-v2-plugin
Open

Support OpenCode v2 plugin API#121
dbpolito wants to merge 4 commits into
mainfrom
feature/opencode-v2-plugin

Conversation

@dbpolito

Copy link
Copy Markdown
Contributor

Ticket

SKIPPED

Description

Add OpenCode v2 plugin support to the existing adapter package while preserving OpenCode 1 behavior. The implementation shares core Zod tool definitions across both APIs, keeps Navigator and Rift on the v1 surface where the required host APIs exist, and documents the version-specific capability boundary.

Checklist

Dual Plugin Support

  • Load OpenCode 1 through the legacy server plugin entry
  • Load OpenCode 2 through the new setup definition
  • Preserve v2 subtask and inline command behavior

Shared Tools

  • Reuse the six core tool definitions and schemas across both APIs
  • Keep Navigator and Rift fully available on OpenCode 1
  • Exclude unsupported Navigator tools from OpenCode 2

Documentation

  • Document installation for both plugin APIs
  • Clarify the OpenCode 1 Navigator boundary

Validation

  • Verify that bun run compile succeeds
  • Confirm that bun run typecheck succeeds
  • Confirm that all 151 tests pass
  • Check that the OpenCode package build succeeds

- preserve OpenCode 1 Navigator and Rift behavior
- share tool definitions across plugin versions
- document version-specific capabilities
@dbpolito dbpolito self-assigned this Aug 31, 2026

@kompassdev kompassdev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

★★★★☆

Overall this is a careful dual-API refactor: I verified the { id, server, setup } default export against the OpenCode 1.18.7 loader contract (readV1Plugin detect + PluginModule.server), confirmed legacy-plugin.ts matches the published v1 plugin API (the real tool helper is identity and already zod 4-based), and checked the v2 usage against the beta SDK types (SessionPromptInput, AgentDraft, Tool.Result). One behavioral divergence in the reimplemented command template expansion is worth fixing before this ships.

Comment thread packages/opencode/v2.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant