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

types.ts3.7 KB
// Provider state and boundary schemas. Output types come directly from
// the Convergence agent protocol; OpenCode's own shapes stay `unknown`
// until the mapper reads them.
import * as z from "zod";
import type { AgentEvent, PromptDelivery, RunOutcome } from "convergence/protocol";
import type * as Deferred from "effect/Deferred";
import type * as Fiber from "effect/Fiber";

export type {
  ConfigChoice as Choice,
  ConfigOption,
  ToolContent,
  ToolCall,
  QuestionOption,
  QuestionField,
  TaskInfo as Task,
  Usage,
  TranscriptItem,
  AgentInfo,
} from "convergence/protocol";

export type { AgentEvent as Event } from "convergence/protocol";
export type { Instance } from "./instances.ts";

/// A chat the host knows: its folder, the options it chose, the model its
/// last turn ran on, and the plugin tools and instructions it was created
/// with.
export interface SessionState {
  workspace: string;
  options: Record<string, unknown>;
  ranOn: [string, string] | null;
  tools: { name: string; description?: string; inputSchema?: unknown }[];
  instructions: string | null;
}

/// An active run: its id, the error it reported (if any), and when the
/// prompt was sent (so a reconnect can tell a lost idle from a new turn).
export interface RunState {
  id: string;
  error: string | null;
  startedAt?: number;
  delivery?: PromptDelivery & { nativeInputId: string; consumed: boolean };
  stopping?: boolean;
  outcome?: RunOutcome;
}

/// One workspace folder's event-stream subscription.
export interface StreamEntry {
  stopped: boolean;
  body: { cancel?: () => unknown; end?: () => unknown } | null;
  fiber: Fiber.Fiber<void> | null;
  ready: Deferred.Deferred<void>;
  droppedAt?: number | null;
}

const sessionSchema = z.looseObject({
  sessionId: z.string().optional(),
  workspace: z.string().optional(),
  options: z.record(z.string(), z.unknown()).optional(),
  tools: z
    .array(z.object({ name: z.string(), description: z.string().optional(), inputSchema: z.unknown().optional() }))
    .optional(),
  instructions: z.string().nullish(),
});

const promptBlock = z.looseObject({
  type: z.string().optional(),
  text: z.string().optional(),
  path: z.string().optional(),
  mimeType: z.string().optional(),
  data: z.string().optional(),
  name: z.string().optional(),
  input: z.string().optional(),
});

export const promptSchema = z.object({
  itemId: z.string().optional(),
  blocks: z.array(promptBlock).optional(),
  delivery: z
    .object({ inputId: z.string(), attemptId: z.string(), intent: z.enum(["send", "steer", "queue"]) })
    .optional(),
});

export type PromptInput = z.infer<typeof promptSchema>;

const answerSchema = z.object({
  cancelled: z.boolean().optional(),
  values: z.record(z.string(), z.unknown()).optional(),
});

export type QuestionInput = z.infer<typeof answerSchema>;

export const schemas = {
  session: z.object({ sessionId: z.string() }),
  workspace: z.object({ workspace: z.string().optional() }),
  skills: z.object({ workspace: z.string() }),
  create: sessionSchema,
  resume: sessionSchema.extend({ sessionId: z.string() }),
  prompt: z.object({ sessionId: z.string(), input: promptSchema.optional() }),
  cancelTask: z.object({ sessionId: z.string(), taskId: z.string() }),
  setOption: z.object({ sessionId: z.string(), optionId: z.string(), value: z.unknown() }),
  approval: z.object({ approvalId: z.string(), optionId: z.string() }),
  question: z.object({ questionId: z.string(), answer: answerSchema.optional() }),
  rollback: z.object({ sessionId: z.string(), itemId: z.string() }),
  fork: sessionSchema.extend({ sessionId: z.string() }),
  authenticate: z.object({ method: z.unknown().optional() }),
  empty: z.unknown(),
};

export type SessionParams = z.infer<typeof sessionSchema>;

Versions

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

Reviews and comments

0 threads · 0 reviews

No comments yet.