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
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
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.0latest | Oct 5, 2026 | >=2 <3 | 94.8 KB | 5 permissions | Listed |
No comments yet.