Skip to content

[Discussion] OpenCode V2 Plugin Support #31

Description

@CasualDeveloper

Hey @makeittech - I opened this to coordinate OpenCode V2 support and avoid duplicating work.

Current Status

I completed a plugin v3 implementation for OpenCode V2 on my fork’s beta branch. The current implementation is in 3af03f6.

It uses a native OpenCode LanguageModelV3 adapter over Cursor AgentService. OpenCode owns transcript reconstruction, credentials, permissions, tool execution, persistence, and compaction. A Cursor Run remains alive only while resolving its exact tool-result loop, then it is discarded.

The native path retains private Composer models, live model and variant discovery, image input, cancellation, parallel tools, tool-error propagation, phase-aware stall watchdogs, bounded worker capacity, usage accounting, OAuth refresh, and HTTP/2 pooling.

npm run verify passes with 36 tests, typecheck, build, packed-package validation, and the OpenCode V2 loader smoke test.

Proposed Release Structure

  • main: OpenCode V1 maintenance, plugin v2.x, npm latest.
  • beta: OpenCode V2 implementation, plugin 3.0.0-beta.N, npm beta.
  • Eventually promote beta to main; preserve OpenCode V1 support through tags or a maintenance branch.

Implementation Scope

The OpenCode V2 branch removes:

  • The OpenCode V1 Hooks/plugin-function entrypoint
  • config, provider.models, chat.headers, chat.params, and legacy auth hooks
  • OpenCode V1 config generation, documentation, compatibility tests, and dependency surface
  • The localhost OpenAI/SSE proxy, retained Cursor checkpoints, conversation mutexes, and session-routing headers

It retains and adapts:

  • Cursor OAuth and refresh
  • Live model discovery and normalization
  • AgentService and private-model transport
  • Exact model and variant routing
  • Ephemeral tool-loop continuity while OpenCode executes tools
  • Security, lifecycle, cancellation, capacity, and stall hardening

These pieces are integrated through OpenCode V2’s Plugin.define, ctx.integration, ctx.catalog.transform, ctx.aisdk, and ctx.session APIs.

Next Step

Since upstream currently has no beta branch, I have not opened a PR against main. If you create an upstream beta branch for OpenCode V2, or prefer another integration target, I can open the plugin v3 PR against it.

Relevant OpenCode V2 documentation:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions