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

replies.ts5.9 KB
// Native UUIDs identify retractions; row ids identify the text to replace.
import type { Emission, TranscriptItem } from "./types.ts";
import type * as wire from "./wire.ts";

export interface ReplyRow {
  id: string;
  type: "text" | "reasoning" | "other";
  text: string;
  task: string | null;
}

export class Replies {
  rows = new Map<string, ReplyRow[]>();
  cleared = new Set<string>();
  applied = new Set<string>();
  replaced = new Set<string>();
  destinations = new Map<string, ReplyRow>();
  order = new Map<string, number>();
  thinking = new Map<string, { index: number; item: number; text: string }>();

  liveRows(message: wire.Record, before: number, task: string | null): ReplyRow[] {
    const content = message.message?.content;
    const messageId = message.message?.id ?? "message";
    if (!Array.isArray(content)) return [];
    return content.map((block, position) => {
      const index = content.length === 1 ? before : position;
      const previous = this.thinking.get(messageId);
      const joins = block.type === "thinking" && previous?.index === index - 1;
      const item = joins ? previous.item : index;
      const text = String(block.text ?? block.thinking ?? "");
      if (block.type === "thinking") this.thinking.set(messageId, { index, item, text });
      else this.thinking.delete(messageId);
      return { id: `${messageId}:${item}`, task, text,
        type: block.type === "text" ? "text" : block.type === "thinking" ? "reasoning" : "other" };
    });
  }

  apply(message: wire.Record, rows: ReplyRow[] = []): Emission[] {
    const uuid = message.uuid;
    if (uuid && rows.length && !this.applied.has(uuid)) this.rows.set(uuid, rows);
    for (const row of rows) if (!this.order.has(row.id)) this.order.set(row.id, this.order.size);
    const edits: Emission[] = [];
    const write = (row: ReplyRow, text: string) => {
      if (row.type === "other") return;
      row.text = text;
      edits.push({ task: row.task, kind: {
        event: row.type === "text" ? "text_delta" : "reasoning_delta", itemId: row.id, text, mode: "replace",
      } });
    };
    const clear = (ids: readonly string[]) => {
      for (const id of ids) {
        if (this.cleared.has(id)) continue;
        this.cleared.add(id);
        for (const row of this.rows.get(id) ?? []) write(row, "");
      }
    };
    if (message.type === "system" || (message.type === "user" && (message.isSynthetic === true || message.isMeta === true)))
      clear(message.retracted_message_uuids ?? message.retractedWireUuids ?? message.retractedMessageUuids ?? []);
    if (message.type !== "assistant" || (uuid && this.applied.has(uuid))) return edits;
    const supersedes = message.supersedes ?? message.supersedesUuids ?? [];
    const messageId = message.message?.id;
    const target = supersedes.filter((id) => !this.replaced.has(id)).flatMap((id) => this.rows.get(id) ?? [])
      .filter((row) => row.type === "text").sort((a, b) => this.order.get(a.id)! - this.order.get(b.id)!)[0];
    clear(supersedes);
    for (const id of supersedes) this.replaced.add(id);
    if (target && messageId) this.destinations.set(messageId, target);
    const destination = target ?? (messageId ? this.destinations.get(messageId) : undefined);
    const textRows = rows.filter((row) => row.type === "text");
    if (!destination || !textRows.length) return edits;
    if (uuid) this.applied.add(uuid);
    const text = textRows.map((row) => row.text).join("\n");
    for (const row of textRows) if (row.id !== destination.id) write(row, "");
    write(destination, destination.text ? `${destination.text}\n${text}` : text);
    if (uuid) this.rows.set(uuid, [destination, ...rows.filter((row) => row.type !== "text")]);
    return edits;
  }
}

/// History keeps the same empty rows and the same replacement position as a run.
export function reviseReplies(records: wire.Record[], items: TranscriptItem[], streamed: WeakMap<TranscriptItem, string>) {
  if (!records.some((record) => record.supersedes?.length || record.supersedesUuids?.length ||
    record.retracted_message_uuids?.length || record.retractedWireUuids?.length || record.retractedMessageUuids?.length)) return;
  const byUuid = new Map<string, TranscriptItem[]>();
  const byId = new Map(items.map((item) => [item.id, item]));
  for (const item of items) {
    const uuid = item.id.split(":")[0]!;
    const rows = byUuid.get(uuid) ?? [];
    rows.push(item);
    byUuid.set(uuid, rows);
  }
  const replies = new Replies();
  const byStream = new Map(items.map((item) => [streamed.get(item), item]));
  const counts = new Map<string, number>();
  const rowOf = (item: TranscriptItem): ReplyRow => ({
    id: item.id, type: item.role === "assistant" ? "text" : item.role === "reasoning" ? "reasoning" : "other",
    text: item.role === "assistant" || item.role === "reasoning" ? item.text : "", task: null,
  });
  for (const record of records) {
    const rows = (byUuid.get(record.uuid ?? "") ?? []).map(rowOf);
    if (record.type === "assistant") {
      const messageId = record.message?.id ?? "message";
      const before = counts.get(messageId) ?? 0;
      const live = replies.liveRows(record, before, null);
      counts.set(messageId, live.length === 1 ? before + 1 : Math.max(before, live.length));
      live.forEach((row, index) => {
        const item = byStream.get(row.id);
        if (!item) return;
        const native = rows.find((row) => row.id === item.id) ?? rowOf(item);
        if (!rows.includes(native)) rows.push(native);
        // Claude's qh/RDt normalizer replaces a multi-block UUID's last 12 digits with the block index.
        if (live.length > 1 && record.uuid)
          replies.rows.set(`${record.uuid.slice(0, 24)}${index.toString(16).padStart(12, "0")}`, [native]);
      });
    }
    for (const { kind } of replies.apply(record, rows)) {
      if (kind.event !== "text_delta" && kind.event !== "reasoning_delta") continue;
      const item = byId.get(kind.itemId);
      if (item?.role === "assistant" || item?.role === "reasoning") item.text = kind.text;
    }
  }
}

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.