feat: support opencode v2 plugin API alongside v1 - #81
Merged
Merged
Conversation
Single-read override loading and shared merge helpers. Keep replay callbacks pure with warnings outside transforms. Set-based command lookup, hardened arg parsing, v2 logging.
Contributor
Author
|
Hey @iHildy! Hope all's well, just wanted to tag you here so it shows up on your radar in case you're not watching the PRs here. Thanks in advance! |
This was referenced Sep 23, 2026
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
One package supporting both opencode v1 (
@opencode-ai/plugin,pluginkey)and v2 (
@opencode/plugin,pluginskey). V1 minimum>= 1.18.29(objectentrypoints), v2
^2.0.0. Seedocs/v2.mdfor the full mapping.V2 replaces the single mutable config object with replayable, synchronous,
per-domain transforms, so each override key maps to the domain that owns it
(
mcp/agent/model/provider); everything else warns instead of merging.What's in the stack (13 commits)
Base v2 support (6):
refactor: extract shared sync plugin core—executeSyncCommand,command loading, tool args into
src/shared.tsfeat: injectable AI provider and node shell shim—createV1AiProviderin
src/sync/ai.ts,createNodeShellinsrc/shell-node.tsfeat: support opencode v2 plugin API—setupV2insrc/v2.tstest: v2 dual export and domain transforms, docs, CI assertionReview hardening (7, from senior review of
docs/v2.md):feat: shared blankEnvPlaceholders helper— single{env:…}pattern insrc/sync/config.ts, reused by v2 for secret-free disabled MCP configsfeat: SyncService.dispose— stops the Turso sync loop/idle-flush timers;wired into v2 setup cleanup (fixes hot-reload leak)
docs: node shell shim differences— POSIX//bin/sh, inherited env,32 MiB buffer,
execerror shaperefactor: harden v2 transforms— single-read override load (no TOCTOU),shared
deepMerge, pure replay callbacks (unknown-ID warnings movedoutside via best-effort
list()), removed dead no-op fallback call,Set-based command lookup, hardened bare-repo parsing, prefixed loggingfix: explicit dual entrypoint—{id, setup, server}, no spreadtest: replay purity, arg parsing, idempotent cleanupdocs: rewrite docs/v2.mdto match the implementationKnown parity gaps (documented in
docs/v2.md)syncs immediately).
owner/repotoken only; full options need theopencode_synctool.reload()calls.CommandDefinitionhas notemplate/agent/model— md templates executedirectly with a
session.syntheticreply.Test plan
bun run checkcleanbun test/vitest run— 205 pass (incl. 9 new v2 tests)bun run buildclean;distexposes{id, setup, server}plugin) and v2 (plugins)Fixes: n/a (new feature). Breaking: no — v1
server()behavior unchanged.