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

approvals.ts4.9 KB
// The CLI's permission prompts as the user sees them: a `can_use_tool`
// request becomes an approval card, `AskUserQuestion` a question, and the
// user's choice goes back as the CLI's `control_response` payload.
import * as wire from "./wire.ts";
import type { ApprovalRequest, QuestionRequest } from "./types.ts";
import type { Answer } from "./session.ts";
import { titleOf, toolCall } from "./tools.ts";

/// The answer to a question the user dismissed.
export const DISMISSED = { behavior: "deny", message: "The user dismissed the question." };

/// Maps a `can_use_tool` control request to an approval for the user. The
/// CLI's `display_name` is only the tool's name; what the tool is about to
/// do is more useful on the card, so it comes first.
export function approvalRequest(id: string, request: wire.ControlRequest): ApprovalRequest {
  const toolName = typeof request.tool_name === "string" ? request.tool_name : "";
  const input = request.input ?? null;
  let title = typeof request.title === "string" ? request.title : null;
  if (title === null) {
    const own = titleOf(toolName, input);
    title = own === toolName && typeof request.display_name === "string" ? request.display_name : own;
  }
  return {
    id,
    title,
    toolCall: toolCall(typeof request.tool_use_id === "string" ? request.tool_use_id : "", toolName, input, "pending"),
    options: [
      { id: "allow_once", name: "Allow once", kind: "allow_once" },
      ...(request.suppress_always_allow_rule === true
        ? []
        : [{ id: "allow_always", name: "Allow always", kind: "allow_always" as const }]),
      { id: "reject", name: "Reject", kind: "reject_once" },
    ],
  };
}

/// The `control_response` payload for one approval option. "Allow always"
/// prefers the rules the CLI suggested and otherwise adds a session rule
/// for the tool.
export function approvalDecision(optionId: string, toolName: string, suggestions: unknown, suppressAlways = false) {
  if (optionId === "allow_once") return { behavior: "allow" };
  if (optionId === "allow_always" && !suppressAlways) {
    const updates = Array.isArray(suggestions)
      ? suggestions
      : [{ type: "addRules", rules: [{ toolName }], behavior: "allow", destination: "session" }];
    return { behavior: "allow", updatedPermissions: updates };
  }
  return { behavior: "deny", message: "The user rejected this tool call." };
}

/// Maps an `AskUserQuestion` input to a question for the user.
export function questionRequest(id: string, raw: unknown): QuestionRequest {
  const input = wire.inputOf(raw);
  const questions = Array.isArray(input?.questions) ? input.questions : [];
  const fields = questions.map((question) => {
    const text = typeof question?.question === "string" ? question.question : "";
    const options = (Array.isArray(question?.options) ? question.options : []).map((option) => {
      const label = typeof option?.label === "string" ? option.label : "";
      const out: { value: string; label: string; description?: string } = { value: label, label };
      if (typeof option?.description === "string") out.description = option.description;
      return out;
    });
    const field: import("divergence/protocol").QuestionField = {
      id: text,
      label: typeof question?.header === "string" ? question.header : text,
      description: text,
      kind: question?.multiSelect === true ? "multi_select" : "select",
      allowOther: true,
      required: false,
    };
    if (options.length) field.options = options;
    return field;
  });
  return { responseMode: "tool", id, fields };
}

/// Writes the user's answers back into the `AskUserQuestion` input. The
/// CLI validates `updatedInput` against the tool's schema and reads the
/// answers from an `answers` map keyed by the question text; free text
/// that answers no listed question goes into `response`.
export function answeredInput(raw: unknown, answer: Answer) {
  const input = wire.inputOf(raw);
  const updated: wire.Input & { answers?: Record<string, unknown>; response?: string } =
    input && typeof input === "object" && !Array.isArray(input) ? { ...input } : {};
  const values = answer?.values ?? {};
  const questions = Array.isArray(input?.questions) ? input.questions : [];
  const answers: Record<string, unknown> = {};
  for (const question of questions) {
    const text = question?.question;
    if (typeof text !== "string" || !Object.hasOwn(values, text)) continue;
    const value = values[text];
    if (typeof value === "string") answers[text] = value;
    else if (Array.isArray(value)) answers[text] = value;
    else if (typeof value === "boolean") answers[text] = String(value);
  }
  const free = [];
  for (const [key, value] of Object.entries(values)) {
    if (!questions.some((question) => question?.question === key) && typeof value === "string") free.push(value);
  }
  updated.answers = answers;
  if (free.length) updated.response = free.join("\n");
  return updated;
}

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.