Official

acp

ACP agents from the ACP registry (Gemini, Cursor, Droid, Kilo, pi, ...), Oh My Pi, and your own entries (custom.json in the plugin's data folder). Agents are discovered at runtime.

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/acp@0.2.5

Permissions in 0.2.5

Take care. This plugin asks for permissions that can do anything your account can. The app asks you to hold Enable for two seconds or to type the plugin's name before it turns on.
  • Run any command process.anyDangerousStarts any program or shell command. This is as strong as your own account.Start the ACP agents, which the registry launches by path or through package runners such as npx and uvx, and run the terminal commands an agent asks for
  • Provide agents agents.provideMediumAdds agents to the app.Provide the agents of the ACP registry, and serve plugin tools to them through the host's loopback MCP server
  • Network access netMediumConnects to the listed hosts.Download the ACP registry and the agents' marks once a dayHosts: cdn.agentclientprotocol.com
  • Read files fs.readMediumReads files in the listed places.Read the files an agent asks for (ACP fs/read_text_file), only inside the chat's workspace, and your own agents from custom.json in this plugin's data folderPlaces: the open workspaceits own data folder
  • Write files fs.writeMediumCreates, changes and deletes files in the listed places.Write the files an agent asks to write (ACP fs/write_text_file), only inside the chat's workspace, and move the custom agents of the old ACP plugin into custom.json oncePlaces: the open workspaceits own data folder
  • Environment variables envMediumReads the listed environment variables.Sign Grok in with your xAI API key when you set one, and tell which Windows build of an agent to runVariables: XAI_API_KEYPROCESSOR_ARCHITECTURE

Files

entities.ts4.6 KB
// Persistent session entities shared by the two ACP versions retain native patches.
import type { AgentEventKind, TranscriptItem } from "divergence/protocol";
import { contentText } from "./map.ts";
import type { Message } from "./wire.ts";

export type RecordValue = Record<string, unknown>;
export const record = (value: unknown): RecordValue =>
  value !== null && typeof value === "object" && !Array.isArray(value) ? (value as RecordValue) : {};
export const array = (value: unknown): unknown[] => (Array.isArray(value) ? value : []);
export const textOf = (value: unknown) => array(value).map(contentText).join("");

// Metadata is patched by top-level key; other fields are replaced, including null.
export function patch(target: RecordValue, update: RecordValue, metadataPatches = true): void {
  for (const [key, value] of Object.entries(update)) {
    if (value === undefined) continue;
    if (key !== "_meta" || value === null || !metadataPatches) target[key] = value;
    else {
      const meta = { ...record(target._meta) };
      for (const [name, entry] of Object.entries(record(value))) {
        if (entry === null) delete meta[name];
        else meta[name] = entry;
      }
      target._meta = meta;
    }
  }
}

export class Entities {
  readonly version: 1 | 2;
  constructor(version: 1 | 2 = 1) {
    this.version = version;
  }
  readonly compactions = new Map<string, RecordValue>();
  readonly messages = new Map<string, RecordValue>();
  readonly items = new Map<string, TranscriptItem>();

  push(update: Message): AgentEventKind[] | null {
    switch (update.sessionUpdate) {
      case "compaction_update":
      case "compaction_summary_chunk":
        return this.compaction(update);
      case "session_message":
      case "session_message_chunk":
        return this.message(update);
      default:
        return null;
    }
  }

  private compaction(update: Message): AgentEventKind[] {
    if (typeof update.compactionId !== "string") return [];
    const id = update.compactionId;
    const state = this.compactions.get(id) ?? { status: "in_progress" };
    const before = state.status;
    const first = !this.compactions.has(id);
    if (update.sessionUpdate === "compaction_summary_chunk") state.summary = [...array(state.summary), update.content];
    else patch(state, update);
    this.compactions.set(id, state);
    const summary = textOf(state.summary);
    const item: TranscriptItem = {
      id: `compaction:${id}`,
      role: "compaction",
      summary,
      running: state.status === "in_progress",
    };
    // A failed compaction did not replace the model's context.
    this.items.set(
      `compaction:${id}`,
      state.status === "failed" || state.status === "cancelled"
        ? {
            id: item.id,
            role: "notice",
            text: typeof state.error === "string" ? state.error : `Compaction ${state.status}.`,
          }
        : item,
    );
    const events: AgentEventKind[] = [];
    if (first && state.status === "in_progress") events.push({ event: "compacting" });
    if (state.status !== "in_progress" && (first || before !== state.status)) {
      events.push({ event: "compacted", ...(summary ? { summary } : {}) });
      if (state.status === "failed" || state.status === "cancelled")
        events.push({
          event: "notice",
          level: state.status === "failed" ? "error" : "info",
          message: typeof state.error === "string" ? state.error : `Compaction ${state.status}.`,
        });
    }
    return events;
  }

  private message(update: Message): AgentEventKind[] {
    if (typeof update.messageId !== "string") return [];
    const id = update.messageId;
    const state = this.messages.get(id) ?? {};
    if (update.sessionUpdate === "session_message_chunk") state.content = [...array(state.content), update.content];
    else patch(state, update, this.version === 2);
    this.messages.set(id, state);
    const sender =
      typeof state.senderSessionId === "string" ? `From ${state.senderSessionId}` : "Message between sessions";
    const recipient = typeof state.recipientSessionId === "string" ? ` to ${state.recipientSessionId}` : "";
    const text = `${sender}${recipient}\n\n${textOf(state.content)}`;
    const itemId = `session-message:${id}`;
    this.items.set(itemId, { id: itemId, role: "assistant", text });
    return [{ event: "text_delta", itemId, mode: "replace", text }];
  }
}

export function notice(update: Message): AgentEventKind {
  return {
    event: "notice",
    level: update.severity === "warning" || update.severity === "error" ? update.severity : "info",
    message: [update.title, update.description].filter((part) => typeof part === "string" && part.length).join("\n\n"),
  };
}

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.2.5latestNov 21, 2026>=5 <6134 KB6 permissionsListed
0.2.4Nov 16, 2026>=5 <6132.8 KB6 permissionsListed
0.2.3Nov 11, 2026>=5 <6108.9 KB6 permissionsListed
0.2.2Nov 9, 2026>=5 <6105.6 KB6 permissionsListed
0.2.1Oct 27, 2026>=2 <4105.3 KB6 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.