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
apps.ts3.3 KB
// ACP exposes embedded pages, but no client access to the agent's MCP servers.
import type { ToolContent } from "divergence/protocol";
import { array, record } from "./entities.ts";
import type { RecordValue } from "./entities.ts";
import type { Message } from "./wire.ts";
function identity(call: RecordValue): { server: string; tool: string } | null {
const meta = record(call._meta);
for (const source of [record(meta.mcp), meta, record(call.rawInput)]) {
if (typeof source.server === "string" && source.server && typeof source.tool === "string" && source.tool)
return { server: source.server, tool: source.tool };
}
for (const value of [call.name, call.title]) {
const match = typeof value === "string" ? /^mcp__([^\s]+?)__(\S+)$/.exec(value) : null;
if (match) return { server: match[1]!, tool: match[2]! };
}
return null;
}
export function embeddedApps(call: RecordValue, fallback: ToolContent[]): ToolContent[] {
const target = identity(call);
if (!target) return fallback;
const apps: ToolContent[] = [];
for (const value of array(call.content)) {
const item = record(value);
const block = record(item.content);
if (item.type !== "content" || block.type !== "resource") continue;
const resource = record(block.resource);
if (typeof resource.uri !== "string" || !resource.uri.startsWith("ui://")) continue;
if (resource.mimeType !== "text/html;profile=mcp-app" && resource.mimeType !== "text/html") continue;
let html = resource.text;
if (typeof html !== "string" && typeof resource.blob === "string") {
try {
html = new TextDecoder("utf-8", { fatal: true }).decode(
Uint8Array.from(atob(resource.blob), (character) => character.charCodeAt(0)),
);
} catch (error) {
console.warn(`acp: Cannot decode embedded MCP App ${resource.uri}: ${String(error)}`);
continue;
}
}
if (typeof html !== "string") continue;
const app: Extract<ToolContent, { type: "mcp_app" }> = {
type: "mcp_app", ...target, resourceUri: resource.uri, html,
};
const ui = record(resource._meta).ui;
if (ui != null) app.meta = ui;
// Only rawOutput can preserve an actual MCP result rather than ACP's display projection.
if (["completed", "failed", "cancelled"].includes(String(call.status)) && Array.isArray(record(call.rawOutput).content))
app.result = call.rawOutput;
apps.push(app);
}
return [...apps, ...fallback];
}
// V1 patches omit unchanged fields and replace metadata as a whole.
export class EmbeddedTools {
private readonly calls = new Map<string, { native: RecordValue; fallback: ToolContent[]; hadApp: boolean }>();
update(update: Message, fallback?: ToolContent[]): ToolContent[] | undefined {
const id = String(update.toolCallId);
const state = this.calls.get(id) ?? { native: {}, fallback: [], hadApp: false };
for (const [key, value] of Object.entries(update))
if (value !== undefined && (value !== null || key === "_meta")) state.native[key] = value;
if (fallback !== undefined) state.fallback = fallback;
const content = embeddedApps(state.native, state.fallback);
const hadApp = state.hadApp;
state.hadApp = content.some((item) => item.type === "mcp_app");
this.calls.set(id, state);
return hadApp || state.hadApp || fallback !== undefined ? content : undefined;
}
}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.