Skip to content

C2: Port the plugin runtime to the v2 Effect-first plugin API #25

Closed

Description

@diegohb

Parent

Part of #23 (Spec: opencode-architect 1.0.0)

What to build

The plugin registers under an opencode v2 host via the v2 Effect-based plugin definition with a stable id. Agents are injected through the v2 agent domain transform, replacing the v1 config hook. Permission registration (the external-directory allow) migrates to v2 permission semantics per the verified-facts record. Prompt path rewriting, at-most-once advisories, and the startup non-interference invariant (registration failures degrade to a warning and advisory, never abort startup) are all preserved. The v1 factory and its types are removed; dependencies move to the v2 packages adjudicated in C1, Effect-first.

Acceptance criteria

  • Plugin loads under a v2 host and registers all ten agents
  • Permission registration works under v2 semantics
  • Prompt path rewriting and advisories behave as before
  • No v1 plugin API usage remains in the runtime
  • Typecheck and migrated test suite green

Blocked by

  • #C1

Activity

  1. diegohb commented on Oct 6, 2026

    @diegohb
    MemberAuthor

    All five acceptance criteria verified at 8670c4b on v2/issue-25-effect-ts:

    • v2 definition, ten agents — default export is { id: "opencode-architect", effect } via Plugin.define from @opencode/plugin/effect (opencode-v2-facts §1–2 contract); the activation test registers exactly 10 agents through ctx.agent.transform/editor.update with non-empty system and valid mode. Host-level load smoke lands with C4's harness per the spec's ticket split.
    • v2 permission semantics — external-directory allow is a ctx.permission.hook("evaluate") decision: upgrades ask→allow only for resources inside the bundled assets dir; explicit config denies are final under v2 (never reach the hook), preserving the old deny-wins behavior. Nine decision-table tests.
    • Prompt rewriting + advisories unchanged — resolveReferencePaths untouched (reference-resolution tests assert no unrewritten relative refs, resolvable absolute paths); stale-cache advisory fires exactly once with the cache-path text and <version> fallback; not-installed advisory keeps its separate once-guard and stays suppressed after install; failure skips it, matching v1 ordering.
    • No v1 plugin API in the runtime — zero @opencode-ai/* references in src/; no config hook; @opencode-ai/plugin and @opencode-ai/sdk removed from dependencies (@opencode/plugin@2.0.23, effect@4.0.0-rc.112 pinned; 2.0.24 was latest at execution — flagged, not adopted per spec; consumer-facing templates use @latest).
    • Typecheck + migrated suite — tsc --noEmit clean; 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).

    Commits: aa6fd0d, 3191c06, ebf71c7, 8670c4b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions