Official

opencode-v2

OpenCode 2 agent provider: runs opencode serve (2.x) and talks to its /api over HTTP and server-sent events.

The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/opencode-v2@0.1.5

Permissions in 0.1.5

  • Provide agents agents.provideMediumAdds agents to the app.Provide the OpenCode 2 agent, and serve plugin tools to it through the host's loopback MCP server
  • Run named programs processMediumStarts the listed programs.Run the OpenCode 2 server (`opencode serve`, or the binary you choose in Settings), read its version and update it (`opencode upgrade`), and ask npm for the newest versionPrograms: opencode${settings.binaryPath}npm
  • Network access netMediumConnects to the listed hosts.Talk to the OpenCode server it starts on this computer, at the port it picks for each launch, to the OpenCode background service on this computer, and to the external server you choose in SettingsHosts: localhost:*${settings.serverUrl}
  • Environment variables envMediumReads the listed environment variables.Read the user name and password of the OpenCode server, and where OpenCode keeps its background service recordVariables: OPENCODE_SERVER_USERNAMEOPENCODE_SERVER_PASSWORDDIVERGENCE_OPENCODE_SERVER_PASSWORDXDG_STATE_HOMEHOME
  • Read files fs.readMediumReads files in the listed places.Read the record of the OpenCode background service (its address and password) so chats use the service you already run instead of starting another serverPlaces: ~/.local/state/opencode/service.json

Files

maintenance.ts1.8 KB
// Whether the OpenCode 2 binary is out of date, and how to update it.
//
// OpenCode 2 updates itself: `opencode upgrade` finds the method it was
// installed with (its install script, npm, Homebrew and others) and uses
// it, so the plugin never has to prove the owner. The newest version is the
// npm package's, which every method ships.
import * as Effect from "effect/Effect";
import type { AgentMaintenance } from "divergence/protocol";
import { runProcess } from "../sdk/effect.ts";
import { isNewer, latestNpmEffect, LOOKUP_TIMEOUT } from "../sdk/maintenance.ts";

/// The npm package that ships OpenCode 2.
export const NPM_PACKAGE = "@opencode/cli";

/// `2.1.1` out of `opencode v2.1.1`, `null` when the line has no version.
export function versionIn(line: string): string | null {
  return /\d+\.\d+\.\d+[^\s]*/.exec(line)?.[0] ?? null;
}

/// The maintenance block of `AgentInfo` for the binary `program`.
export const describe = Effect.fn("OpenCodeV2.describe")(function* (program: string) {
  const ran = yield* runProcess(program, ["--version"], { timeout: LOOKUP_TIMEOUT }).pipe(
    Effect.scoped,
    Effect.catch(() => Effect.succeed(null)),
  );
  const installed = ran ? versionIn(ran.stdout) : null;
  const out: AgentMaintenance = { manager: "native", canUpdate: true };
  if (!installed) return out;
  out.installedVersion = installed;
  const latest = yield* latestNpmEffect(NPM_PACKAGE, null);
  if (latest && isNewer(installed, latest)) out.latestVersion = latest;
  return out;
});

/// Runs `program upgrade`.
export const upgrade = Effect.fn("OpenCodeV2.upgrade")(function* (program: string) {
  const result = yield* runProcess(program, ["upgrade"]).pipe(Effect.scoped);
  if (result.code !== 0)
    return yield* Effect.fail(
      new Error(`${program} upgrade failed: ${(result.stderr || result.stdout).trim() || result.code}`),
    );
});

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.1.5latestNov 21, 2026>=5 <672.4 KB5 permissionsListed
0.1.4Nov 16, 2026>=5 <672 KB5 permissionsListed
0.1.3Nov 11, 2026>=5 <662.4 KB5 permissionsListed
0.1.2Nov 9, 2026>=5 <659.2 KB5 permissionsListed
0.1.1Oct 27, 2026>=2 <458.4 KB5 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.