Repository navigation
C2: Port the plugin runtime to the v2 Effect-first plugin API - #33
Merged
Merged
Conversation
added 4 commits
October 6, 2026 00:54
…@4.0.0-rc.112 v1 packages stay until the runtime port commit removes them, so this commit typechecks and tests at baseline. Versions pinned to the C1 adjudication (opencode-v2-facts #24); @opencode/plugin 2.0.24 is out but the spec forbids silently upgrading the 2.0.23 pin.
The default export is now a v2 plugin definition { id, effect } built
with Plugin.define from @opencode/plugin/effect, carrying the stable id
'opencode-architect'. Agents register through ctx.agent.transform via
editor.update upserts (system, description, mode, permissions) — the
v1 config hook is gone.
The external-directory allow migrates to v2 permission semantics: the
plugin registers a permission evaluate hook that upgrades a pending ask
to allow only for external_directory resources inside the bundled
assets directory. Explicit config denies are final under v2 and never
reach the hook, preserving the old deny-wins behavior.
Frontmatter translation follows the verified-facts record (opencode-v2-facts
sections 4-6): prompt becomes system, the tools boolean map and the
permission keyed record become a v2 permission ruleset using the pinned
normalizeAction renames (write/patch to edit, task to subagent, bash to
shell).
Startup non-interference is preserved: a failed load degrades to the
at-most-once stale-cache advisory and skips the not-installed advisory,
matching v1 ordering; successful activations advise once and stay
suppressed. Prompt path rewriting is untouched.
Dependencies move to the C1-adjudicated v2 packages (@opencode/plugin
2.0.23, effect 4.0.0-rc.112); @opencode-ai/plugin and @opencode-ai/sdk
are removed. Tests migrate to a v2 activation harness with spy agent
and permission domains.
…elpers into AgentLoader AgentFrontmatter now uses nullable fields per the coding standard, with absent YAML keys normalized to null at the parse boundary. The frontmatter translation helpers move into AgentLoader as private methods per classes-over-helpers, and the adviseIfNotInstalled wrapper is inlined.
…eeps the 2.0.23 pin The full-package manifest template names @opencode/plugin and effect at latest so generated packages pick up current versions at time of use; the opencode-architect runtime stays pinned to the C1 adjudication (2.0.23 / 4.0.0-rc.112; 2.0.24 was latest at execution — flagged, not adopted). The policy is recorded in opencode-v2-facts section 15 so the guidance-rewrite tickets (C5-C7) enforce it.
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.
Closes #25 (C2, child of spec #23)
What
Ports the plugin runtime from the v1
@opencode-ai/pluginfactory to the opencode v2 Effect-first plugin API, per the C1 verified-facts record (docs/reference/opencode-v2-facts.md, pinned toanomalyco/opencodev2.0.23).{ id: "opencode-architect", effect }built withPlugin.definefrom@opencode/plugin/effect(facts §1–2). The v1 factory, its types, and theconfighook are gone.ctx.agent.transform+editor.updateupserts (system,description,mode,permissions), mirroring the pinned first-party exemplarcore/src/config/plugin/agent.ts.ctx.permission.hook("evaluate")decision that upgrades a pendingasktoallowonly forexternal_directoryresources inside the bundled assets directory. Explicit config denies are final under v2 and never reach the hook, preserving the old deny-wins behavior.prompt→system; thetoolsboolean map andpermissionkeyed record become a v2 permission ruleset using the pinnednormalizeActionrenames (write/patch→edit,task→subagent,bash→shell) (facts §4–6).@opencode/plugin@2.0.23+effect@4.0.0-rc.112pinned (C1 adjudication; 2.0.24 waslatestat execution — flagged, not adopted per spec).@opencode-ai/pluginand@opencode-ai/sdkremoved. Consumer-facing templates declare@opencode/pluginandeffectat@latestso generated packages resolve current versions at time of use — policy recorded in facts §15 for C5–C7.Acceptance criteria (all verified at 8670c4b)
systemand validmode; host-level load smoke lands with C4's harness per the spec's ticket split@opencode-ai/*insrc/tsc --noEmitclean; migrated tests 23/23; full suite 143 pass with only the 5 failures that pre-exist on the base commit (Windows-only environment artifacts in tarball/cache tests; CI runs ubuntu)Evidence: issue comment
Test plan
bun run check(tsc --noEmit)bun test— baseline diff vsfbbaed8shows no new failuresOut of scope (owned by sibling tickets)