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.6

Permissions in 0.2.6

  • 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

control.ts5.9 KB
// Claude's acknowledged control operations and session metadata updates.
import * as Effect from "effect/Effect";
import type { Session } from "./session.ts";
import {
  DEFAULT,
  EFFORT,
  FAST_MODE,
  MODEL,
  PERMISSION_MODE,
  ULTRACODE,
  effortSettings,
  permissionFlag,
} from "./options.ts";
import { outcome, permissionMode } from "../sdk/agent.ts";
import * as wire from "./wire.ts";
import { sessionFile } from "./history.ts";
import { capabilitiesFor, refreshAppsLater, supportsApps } from "./mcp.ts";

/// How long a run may take to report a result after an interrupt.
export const CANCEL_TIMEOUT = 10_000;

export const setOption = Effect.fn("Claude.setOption")(function* (this: Session, optionId: string, value: unknown) {
  if (this.proc?.alive) {
    switch (optionId) {
      case MODEL:
        yield* this.controlRequest({
          subtype: "set_model",
          ...(typeof value === "string" && value !== DEFAULT ? { model: value } : {}),
        });
        break;
      case EFFORT:
        yield* this.controlRequest({
          subtype: "apply_flag_settings",
          settings: { ...effortSettings(typeof value === "string" ? value : DEFAULT), ultracode: this.ultracode() },
        });
        break;
      case ULTRACODE:
        yield* this.controlRequest({ subtype: "apply_flag_settings", settings: { ultracode: value === true } });
        break;
      case PERMISSION_MODE:
        yield* this.controlRequest({
          subtype: "set_permission_mode",
          mode: permissionFlag(typeof value === "string" ? value : permissionMode.SUPERVISED),
        });
        break;
      case FAST_MODE:
        yield* this.controlRequest({ subtype: "apply_flag_settings", settings: { fastMode: value === true } });
        break;
    }
  }
  this.values[optionId] = value;
  if (this.proc?.alive) {
    if (optionId === MODEL) yield* this.readContext().pipe(Effect.forkIn(this.ctx.scope));
    if ((optionId === MODEL || optionId === ULTRACODE) && this.ultracode()) yield* this.checkUltracode();
  }
  return this.options();
});

export const cancel = Effect.fn("Claude.cancel")(function* (this: Session) {
  if (!this.run) {
    this.stopBeforeRun = true;
    return;
  }
  const runId = this.run;
  this.cancelled = true;
  for (const id of [...this.pending.keys()])
    this.withdraw(id, { behavior: "deny", message: "The user stopped the run." });
  // The watchdog starts before the receipt wait so an unresponsive CLI
  // cannot keep the run open for the control-request timeout.
  yield* Effect.sleep(CANCEL_TIMEOUT).pipe(
    Effect.andThen(
      Effect.sync(() => {
        if (this.cancelled && this.run === runId) {
          this.cancelled = false;
          this.finishRun(outcome.cancelled());
        }
      }),
    ),
    Effect.forkIn(this.ctx.scope),
  );
  const receipt = wire.objectOf(
    yield* this.controlRequest({
      subtype: "interrupt",
      ...(this.capabilities === null || this.capabilities.has("interrupt_cancel_queued_v1")
        ? { cancel_queued: true }
        : {}),
    }),
  );
  const cancelled = Array.isArray(receipt.cancelled) ? receipt.cancelled : [];
  const survivors = Array.isArray(receipt.still_queued) ? receipt.still_queued : [];
  for (const uuid of survivors) {
    if (typeof uuid !== "string" || !this.inputs.has(uuid)) continue;
    const response = wire.objectOf(yield* this.controlRequest({ subtype: "cancel_async_message", message_uuid: uuid }));
    if (response.cancelled === true) cancelled.push(uuid);
    else
      this.emitEvent({
        event: "notice",
        level: "warning",
        message: "Claude could not withdraw a submitted message after Stop; it may still run.",
      });
  }
  for (const uuid of cancelled) {
    const input = typeof uuid === "string" ? this.inputs.get(uuid) : undefined;
    if (input) input.answered = true;
  }
});

/// Handles native session metadata before transcript mapping or run attribution.
export const sessionUpdate = Effect.fn("Claude.sessionUpdate")(function* (session: Session, message: wire.Record) {
  if (message.type === "conversation_reset" && message.new_conversation_id) {
    session.cli = message.new_conversation_id;
    session.sent = {};
    session.rewound = null;
    session.startMode = { kind: "resume" };
    const path = sessionFile(session.configDir, session.workspace, session.cli);
    session.read = path ? { path, offset: 0 } : null;
    session.inbox = { offset: 0, heard: new Map(), other: new Set() };
    session.replies.clear();
    yield* session.ctx.store.save(session.id, { cli: session.cli, sent: {}, rewound: null });
    yield* session.ctx.store.keepAlias(session.cli, session.id);
    return true;
  }
  if (message.type !== "system") return false;
  switch (message.subtype) {
    case "init":
      session.capabilities = new Set(message.capabilities ?? []);
      if (session.ctx.hostFeatures?.has("mcpApps")) {
        yield* capabilitiesFor(session, message.claude_code_version, false);
        session.mapper.mcp.enabled = supportsApps(session.capabilities);
        yield* refreshAppsLater(session);
      }
      return false;
    case "commands_changed":
      if (!message.commands) return true;
      session.catalog.commands = message.commands;
      session.emitEvent({ event: "commands", commands: session.commands() });
      yield* session.refreshSkills();
      return true;
    case "elicitation_complete":
      for (const [id, pending] of session.pending) {
        const request = pending.kind === "elicitation" ? pending.request : null;
        if (
          request?.mode === "url" &&
          request.elicitation_id === message.elicitation_id &&
          request.mcp_server_name === message.mcp_server_name
        ) {
          session.respondToQuestion(id, {});
          session.emitEvent({ event: "question_resolved", id });
        }
      }
      session.emitEvent({
        event: "notice",
        level: "info",
        message: `The browser request from ${message.mcp_server_name} completed.`,
      });
      return true;
    default:
      return false;
  }
});

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.