Official

opencode

OpenCode agent provider: runs opencode serve and talks to it 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: cvg install convergence/opencode@0.2.0

Permissions in 0.2.0

  • Read files fs.readMediumReads files in the listed places.Read, once, the servers the previous OpenCode provider keptPlaces: its own data folder
  • Provide agents agents.provideMediumAdds agents to the app.Provide the OpenCode agent, and serve plugin tools to it through the host's loopback MCP server
  • Run named programs processMediumStarts the listed programs.Run the OpenCode server (`opencode serve`, or the binary you choose in Settings), read its catalog from the command line when the server cannot answer, upgrade it (`opencode upgrade`), and ask or tell the npm installation that owns it about a newer versionPrograms: opencodenpm${settings.binaryPath}
  • 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, and to the external server you choose in SettingsHosts: localhost:*${settings.serverUrl}
  • Environment variables envMediumReads the listed environment variables.Expand ~ in a configured binary, and read the OpenCode settings you set in the environment: the binary to run, an external server's address, and the server's user name and passwordVariables: HOMEOPENCODE_PATHOPENCODE_SERVER_URLOPENCODE_SERVER_USERNAMEOPENCODE_SERVER_PASSWORDCONVERGENCE_OPENCODE_SERVER_PASSWORD

Files

instances.test.ts2.4 KB
import { test } from "node:test";
import assert from "node:assert/strict";
import { agentId, command, defaultInstance, displayName, parseInstances, serverUrl } from "./instances.ts";

test("the local server is the plain agent id", () => {
  const local = defaultInstance();
  assert.equal(agentId(local), "opencode");
  assert.equal(displayName(local), "OpenCode");
});

test("a named instance points at its own server, without the trailing slash", () => {
  const instance = { ...defaultInstance(), id: "team", serverUrl: "https://opencode.example:4096/" };
  assert.equal(agentId(instance), "opencode:team");
  assert.equal(displayName(instance), "OpenCode (team)");
  // The slash would double up in every request path.
  assert.equal(serverUrl(instance), "https://opencode.example:4096");
});

test("an instance can name the binary it starts; only the default agent reads OPENCODE_PATH", () => {
  const env = { HOME: "/Users/me", OPENCODE_PATH: "/opt/oc/opencode" };
  const pinned = { ...defaultInstance(), id: "old", command: "~/.opencode/bin/opencode" };
  assert.equal(command(pinned, env), "/Users/me/.opencode/bin/opencode");
  assert.equal(command({ ...defaultInstance(), id: "team" }, env), null);
  assert.equal(command(defaultInstance(), env), "/opt/oc/opencode");
  assert.equal(command(defaultInstance(), {}), null);
});

test("the local agent takes its binary and name from the unnamed entry", () => {
  const all = parseInstances([
    { id: "", command: "/opt/oc/opencode", name: "Local OC" },
    { id: "team", serverUrl: "http://t:1", password: "p" },
    { id: "team", serverUrl: "http://other:1" },
  ]);
  assert.equal(all.length, 2, "a repeated id is left out");
  assert.equal(all[0].command, "/opt/oc/opencode");
  assert.equal(displayName(all[0]), "Local OC");
  assert.equal(agentId(all[0]), "opencode");
  assert.equal(agentId(all[1]), "opencode:team");
  assert.equal(all[1].password, "p");
  assert.deepEqual(parseInstances(null), [defaultInstance()]);
  assert.deepEqual(parseInstances({ not: "a list" }), [defaultInstance()]);
});

test("a configured instance never falls back to the environment's server", () => {
  const env = { OPENCODE_SERVER_URL: "http://ambient:4096/" };
  assert.equal(serverUrl({ ...defaultInstance(), id: "local2" }, env), null);
  // The default agent still honours it, as it did before instances.
  assert.equal(serverUrl(defaultInstance(), env), "http://ambient:4096");
  assert.equal(serverUrl(defaultInstance(), {}), null);
});

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.2.0latestOct 5, 2026>=2 <394.8 KB5 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.