Official

claude

Claude Code agent provider: runs the Claude Code CLI headless for each account.

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/claude@0.2.7

Permissions in 0.2.7

  • Provide agents agents.provideMediumAdds agents to the app.Provide the Claude Code agent and pass its tool calls to plugin tools
  • Run named programs processMediumStarts the listed programs.Run the Claude Code CLI (sessions, sign-in, `claude update`), and ask the npm installation that owns it about a newer versionPrograms: claudenpm
  • Read files fs.readMediumReads files in the listed places.Read Claude Code's sessions, settings and skills (in ~/.claude, other accounts' ~/.claude-* folders, the shared skills and the folder you choose in Settings), the project's .claude folder, the administrator's skill policy, and once, what the previous provider keptPlaces: ~/.claude/**~/.claude*/**~/.agents/skills/**the open workspaceits own data folder/Library/Application Support/ClaudeCode/managed-settings.json/etc/claude-code/managed-settings.json${settings.configDir}
  • Environment variables envMediumReads the listed environment variables.Find Claude Code's configuration directory, and the launch settings you set in CLAUDE_* variables (extra arguments, MCP servers, setting sources, appended system prompt, extra folders)Variables: HOMECLAUDE_CONFIG_DIRCLAUDE_EXTRA_ARGSCLAUDE_MCP_CONFIGCLAUDE_STRICT_MCP_CONFIGCLAUDE_SETTING_SOURCESCLAUDE_APPEND_SYSTEM_PROMPTCLAUDE_ADD_DIRS

Files

elicitation.ts4.9 KB
// MCP form schemas use the question fields the host can render today.
import type { QuestionField } from "divergence/protocol";
import type { QuestionRequest } from "./types.ts";
import type { Answer } from "./session.ts";
import * as wire from "./wire.ts";

function choices(schema: Record<string, unknown>) {
  if (Array.isArray(schema.enum))
    return schema.enum.map((value, index) => ({
      value: String(value),
      label: String(Array.isArray(schema.enumNames) ? (schema.enumNames[index] ?? value) : value),
    }));
  const variants = schema.oneOf ?? schema.anyOf;
  if (!Array.isArray(variants)) return [];
  return variants.map((variant) => {
    const entry = wire.objectOf(variant);
    return { value: String(entry.const), label: typeof entry.title === "string" ? entry.title : String(entry.const) };
  });
}

export function elicitationQuestion(id: string, request: wire.ControlRequest): QuestionRequest {
  const message = `${request.mcp_server_name}: ${String(request.message)}`;
  if (request.mode === "url") return { id, message, url: request.url ?? undefined, responseMode: "tool", fields: [] };
  const schema = request.requested_schema ?? {};
  const properties = wire.objectOf(schema.properties);
  const order = request.property_order ?? Object.keys(properties);
  const fields: QuestionField[] = order.map((key) => {
    const property = wire.objectOf(properties[key]);
    const options = choices(property.type === "array" ? wire.objectOf(property.items) : property);
    let kind: QuestionField["kind"];
    switch (property.type) {
      case "boolean":
        kind = "boolean";
        break;
      case "number":
      case "integer":
        kind = "text";
        break;
      case "string":
        kind = options.length ? "select" : "text";
        break;
      case "array":
        if (!options.length) throw new Error(`Claude requested an unsupported form field: ${key}.`);
        kind = "multi_select";
        break;
      default:
        throw new Error(`Claude requested an unsupported form field: ${key}.`);
    }
    return {
      id: key,
      label: typeof property.title === "string" ? property.title : key,
      ...(typeof property.description === "string" ? { description: property.description } : {}),
      kind,
      ...(options.length ? { options } : {}),
      allowOther: false,
      required: Array.isArray(schema.required) && schema.required.includes(key),
    };
  });
  return { id, message, responseMode: "tool", fields };
}

export function elicitationResult(request: wire.ControlRequest, answer: Answer) {
  if (answer.cancelled) return { action: "cancel" };
  if (request.mode === "url") return { action: "accept" };
  const properties = wire.objectOf(request.requested_schema?.properties);
  const content: Record<string, unknown> = {};
  for (const field of elicitationQuestion("", request).fields) {
    let value = answer.values?.[field.id];
    if (value === undefined) {
      if (field.required) throw new Error(`An answer is required for ${field.label}.`);
      continue;
    }
    const property = wire.objectOf(properties[field.id]);
    if (property.type === "number" || property.type === "integer") {
      value = typeof value === "string" && value.trim() ? Number(value) : value;
      if (
        typeof value !== "number" ||
        !Number.isFinite(value) ||
        (property.type === "integer" && !Number.isInteger(value))
      )
        throw new Error(`${field.label} requires a ${property.type}.`);
      if (
        (typeof property.minimum === "number" && value < property.minimum) ||
        (typeof property.maximum === "number" && value > property.maximum)
      )
        throw new Error(`${field.label} is outside the allowed range.`);
    } else if (field.kind === "boolean") {
      if (typeof value !== "boolean") throw new Error(`${field.label} requires a boolean.`);
    } else if (field.kind === "multi_select") {
      if (!Array.isArray(value) || value.some((entry) => !field.options?.some((option) => option.value === entry)))
        throw new Error(`${field.label} requires the listed choices.`);
      if (
        (typeof property.minItems === "number" && value.length < property.minItems) ||
        (typeof property.maxItems === "number" && value.length > property.maxItems)
      )
        throw new Error(`${field.label} has an invalid number of choices.`);
    } else {
      if (typeof value !== "string" || (field.options && !field.options.some((option) => option.value === value)))
        throw new Error(`${field.label} requires a valid answer.`);
      if (
        (typeof property.minLength === "number" && value.length < property.minLength) ||
        (typeof property.maxLength === "number" && value.length > property.maxLength) ||
        (typeof property.pattern === "string" && !new RegExp(property.pattern).test(value))
      )
        throw new Error(`${field.label} does not match the requested format.`);
    }
    content[field.id] = value;
  }
  return { action: "accept", content };
}

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.2.7latestNov 21, 2026>=5 <6207.5 KB4 permissionsListed
0.2.6Nov 16, 2026>=5 <6206 KB4 permissionsListed
0.2.5Nov 11, 2026>=5 <6168.3 KB4 permissionsListed
0.2.4Nov 9, 2026>=5 <6166.1 KB4 permissionsListed
0.2.3Oct 27, 2026>=2 <4151.6 KB4 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.