feat: migrate to OpenCode v2 plugin API - #4
Merged
Merged
Conversation
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.
Summary
@opencode/pluginwith a stablePlugin.define()entrypoint and public v2 session/tool hooks.ctx.generate.text()for translation so OpenCode owns provider selection, model variants, SQLite credentials, and OAuth refresh/persistence; remove the v1 auth-file readers and custom provider/OAuth adapters.Compatibility and behavior changes
opencode2 v0.0.0-dev-18322did not pass the host smoke test.pluginsusing{ package, options }entries. Local builds must point to the dist directory, notdist/index.js.opencode-translate@1.Verification
bun run check:cibun run typecheckbun run knipbun run test:coverage— 76 passing tests, 100% function coverage and 99.16% line coveragebun run buildbun run test:package— install the packed artifact and exercise the v2 entrypointbun run test:hostwith OpenCode 2.0.3 — actual plugin activation, SQLite credential storage/rotation, bilingual persisted messages, English-only model requests, and restart recoverygit diff --checkThe host test uses an isolated server/database and a local fake provider. Native stream tests use OpenCode’s actual protocol parsers. Browser and terminal visual rendering were not separately automated.
Reference: https://opencode.ai/v2/docs/build/plugins/migrate-v1