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.4
Permissions in 0.2.4
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.
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
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.5latest | Nov 21, 2026 | >=5 <6 | 134 KB | 6 permissions | Listed |
| 0.2.4 | Nov 16, 2026 | >=5 <6 | 132.8 KB | 6 permissions | Listed |
| 0.2.3 | Nov 11, 2026 | >=5 <6 | 108.9 KB | 6 permissions | Listed |
| 0.2.2 | Nov 9, 2026 | >=5 <6 | 105.6 KB | 6 permissions | Listed |
| 0.2.1 | Oct 27, 2026 | >=2 <4 | 105.3 KB | 6 permissions | Listed |
No comments yet.