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

maintenance.ts5.3 KB
// Whether an ACP agent's program is out of date, and how to update it.
//
// The registry names each agent's newest version. An agent the plugin
// starts through a package runner (`npx -y pkg@1.2.3`, `uvx pkg==1.2.3`)
// already runs the pinned version the registry lists, so it never falls
// behind. An agent the user installed is updated by the installer that
// owns its binary, proven from the binary's real path as the other
// providers do (`../sdk/maintenance.ts`). With no provable owner, the
// program's own `update` command, when its help lists one, is offered to
// run in a terminal.
import * as Effect from "effect/Effect";
import type { AgentMaintenance } from "divergence/protocol";
import { isNewer, latestBrewEffect, latestNpmEffect, LOOKUP_TIMEOUT } from "../sdk/maintenance.ts";
import { runProcess } from "../sdk/effect.ts";
import type { Entry, Launch } from "./registry.ts";

export type Owner =
  | { manager: "runner" }
  | { manager: "npm"; prefix: string; pkg: string }
  | { manager: "homebrew"; name: string; cask: boolean }
  | { manager: "uv"; tool: string }
  | { manager: "" };

const RUNNERS = new Set(["npx", "uvx"]);

function base(path: string) {
  const tail = path.replace(/\\/g, "/").split("/").pop() ?? "";
  return tail.replace(/\.(cmd|exe)$/i, "");
}

/// Who owns the program `launch` starts, from where its binary really is.
export function ownerOf(launch: Launch, realPath: string | null): Owner {
  if (RUNNERS.has(base(launch.program))) return { manager: "runner" };
  const path = String(realPath ?? launch.program).replace(/\\/g, "/");
  const at = path.lastIndexOf("/lib/node_modules/");
  const pkg = at < 0 ? null : /^(?:@[^/]+\/)?[^/]+(?=\/)/.exec(path.slice(at + "/lib/node_modules/".length))?.[0];
  const prefix = path.slice(0, Math.max(at, 0));
  // A `node_modules` above the package is a project's dependency, never
  // a global install.
  if (pkg && !prefix.includes("/node_modules/")) return { manager: "npm", prefix: prefix || "/", pkg };
  const brew = /\/(Cellar|Caskroom)\/([^/]+)\//.exec(path);
  if (brew?.[2]) return { manager: "homebrew", name: brew[2], cask: brew[1] === "Caskroom" };
  const uv = /\/uv\/tools\/([^/]+)\//.exec(path);
  if (uv?.[1]) return { manager: "uv", tool: uv[1] };
  return { manager: "" };
}

/// The program and arguments that install `latest` for `owner`, or `null`
/// when no installer owns the binary provably.
export function updatePlan(owner: Owner, latest: string | null): { program: string; args: string[] } | null {
  switch (owner.manager) {
    case "npm":
      return {
        program: "npm",
        args: [
          "install",
          "-g",
          "--prefix",
          owner.prefix,
          // npm no longer runs install scripts by default and still exits
          // 0, so a package that downloads its binary would not update.
          `--allow-scripts=${owner.pkg}`,
          `${owner.pkg}@${latest ?? "latest"}`,
        ],
      };
    case "homebrew":
      return { program: "brew", args: owner.cask ? ["upgrade", "--cask", owner.name] : ["upgrade", owner.name] };
    case "uv":
      return { program: "uv", args: ["tool", "upgrade", owner.tool] };
    default:
      return null;
  }
}

/// The subcommand a program's help lists for updating itself, if any:
/// a line of its command list that starts with the word.
export function updateSubcommand(help: string): string | null {
  const found = /^\s+(self-update|update|upgrade)(?=[\s,]|$)/m.exec(help);
  return found?.[1] ?? null;
}

function quote(text: string) {
  return /^[\w@%+=:,./-]+$/.test(text) ? text : `'${text.replace(/'/g, `'\\''`)}'`;
}

/// The newest version the owner can deliver: its own registry's for npm
/// and Homebrew (a cask trails the ACP registry by hours), else the ACP
/// registry's.
const latestFor = Effect.fn("Acp.latestFor")(function* (owner: Owner, entry: Entry) {
  if (owner.manager === "npm") return yield* latestNpmEffect(owner.pkg, owner.prefix);
  if (owner.manager === "homebrew") return yield* latestBrewEffect(owner.name);
  return entry.version;
});

/// The `--help` of a program, empty when it does not answer in time.
const helpOf = Effect.fn("Acp.helpOf")(function* (program: string) {
  const result = yield* runProcess(program, ["--help"], { timeout: LOOKUP_TIMEOUT }).pipe(
    Effect.scoped,
    Effect.catch(() => Effect.succeed(null)),
  );
  return result ? `${result.stdout}\n${result.stderr}` : "";
});

/// The maintenance block of the agent's `AgentInfo`, or `null` for an
/// agent that cannot fall behind (one a package runner starts, or one the
/// registry does not version).
export const describe = Effect.fn("Acp.describe")(function* (
  entry: Entry,
  launch: Launch,
  realPath: string | null,
  installedVersion: string | null,
) {
  if (entry.source.kind !== "registry" || !installedVersion) return null;
  const owner = ownerOf(launch, realPath);
  if (owner.manager === "runner") return null;
  const latest = yield* latestFor(owner, entry);
  const plan = updatePlan(owner, latest);
  const out: AgentMaintenance = { installedVersion, canUpdate: plan !== null };
  if (owner.manager) out.manager = owner.manager;
  if (!latest || !isNewer(installedVersion, latest)) return out;
  out.latestVersion = latest;
  if (!plan) {
    const word = updateSubcommand(yield* helpOf(launch.program));
    if (word) out.command = `${quote(launch.program)} ${word}`;
  }
  return out;
});

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.