@chipschat/acp 1.0.38 → 1.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,14 +58,27 @@ also looks where that line puts the agent, since a terminal opened before doesn'
58
58
  Goose and Grok offer their models as a session's `model` option, where they do, and the bridge
59
59
  offers them in Chips as it does Claude Code's and Codex's, each once (Copilot on GitHub's free plan
60
60
  lists Auto twice). Their files aren't read.
61
- - The Permissions page shows what each one's own settings let through, read and never written:
62
- Copilot's Allow all, as its sessions say it (off: it asks before a tool, a path or a URL; on: it
63
- never asks); Grok's mode, its rules from `~/.grok/config.toml` (`[permission] rules`), and the
64
- permission rules it takes from Claude Code's settings, yours in `~/.claude` and each agent
65
- folder's. Grok takes its mode from a Claude Code `defaultMode` first (the most specific file's),
66
- then from its own `[ui] permission_mode` (or the older `yolo`), else Ask, and the page says which
67
- file set it. For Antigravity and Goose it shows the mode a session runs in. Cursor's own settings
68
- aren't read yet.
61
+ - The Permissions page shows what each one's own settings let through, as Claude Code's are shown:
62
+ its mode, and what it runs on its own, asks about, and refuses, read and never written.
63
+ - **Copilot**: its Allow all, as its sessions say it (off: it asks before a tool, a path or a URL;
64
+ on: it never asks), each "don't ask again" it saved for an agent's folder
65
+ (`~/.copilot/permissions-config.json`, in `COPILOT_HOME`), and the URLs its `settings.json`
66
+ always allows or denies.
67
+ - **Grok**: its mode, its rules from `~/.grok/config.toml` (`[permission] rules`), and the
68
+ permission rules it takes from Claude Code's settings, yours in `~/.claude` and each agent
69
+ folder's. Grok takes its mode from a Claude Code `defaultMode` first (the most specific
70
+ file's), then from its own `[ui] permission_mode` (or the older `yolo`), else Ask, and the page
71
+ says which file set it.
72
+ - **Antigravity**: the mode Chips starts its sessions in, its `permissions` lists in
73
+ `~/.gemini/antigravity-cli/settings.json` (`command(git)`, `write_file(src/)`, …), and its
74
+ `toolPermission` where that says more (Always proceed lets everything through). Its project and
75
+ shared scopes aren't files the bridge can read.
76
+ - **Goose**: the mode Chips starts its sessions in, and the tools its `permission.yaml` (in
77
+ `~/.config/goose`, or `GOOSE_PATH_ROOT`'s) always allows, asks before, and never allows.
78
+ - **Cursor**: its `approvalMode` and `permissions` in `~/.cursor/cli-config.json`, with each agent
79
+ folder's `.cursor/cli.json` rules.
80
+ - While Google wants an Antigravity account verified, Antigravity answers only "⚠ Verification
81
+ Required". The bridge fails that turn with what to do instead: `agy -p hi` prints the link.
69
82
  - An agent's refusal reaches the room in its own words: where JSON-RPC's message is only "Internal
70
83
  error", what its details say, as Grok's API answer ("Your Grok CLI version (0.2.99) is outdated …").
71
84
  - What signs one in from the environment is carried to the copy kept running: `CURSOR_API_KEY`,
@@ -1,6 +1,6 @@
1
1
  # Third-party notices
2
2
 
3
- `dist/main.js` in @chipschat/acp 1.0.38 carries these packages, bundled in. Each one's
3
+ `dist/main.js` in @chipschat/acp 1.0.39 carries these packages, bundled in. Each one's
4
4
  licence follows.
5
5
 
6
6
  ## @chipschat/harness 1.0.11 (Apache-2.0)
package/dist/main.js CHANGED
@@ -28113,7 +28113,11 @@ var KNOWN2 = [
28113
28113
  signIn: "run `agy acp --login` and paste back the code it asks for",
28114
28114
  signInLine: "agy acp --login",
28115
28115
  signInDoing: "Run this in Terminal, then try again. It gives you a Google sign-in link; paste back the code you get.",
28116
- keys: ["GEMINI_API_KEY"]
28116
+ keys: ["GEMINI_API_KEY"],
28117
+ stops: {
28118
+ reply: /^[\s⚠\uFE0F]*Verification Required[\s.!]*$/i,
28119
+ says: "Google wants this Antigravity account verified before it answers. Run `agy -p hi` in a new terminal: it prints a link to verify the account in your browser. Then send this again."
28120
+ }
28117
28121
  },
28118
28122
  {
28119
28123
  id: "grok",
@@ -28153,6 +28157,10 @@ var knownBy = (kind2) => {
28153
28157
  return KNOWN2.find((each) => each.program === program);
28154
28158
  };
28155
28159
  var speaksAcp = (known) => known.adapter === void 0;
28160
+ function stoppedWith(kind2, reply) {
28161
+ const stops = knownBy(kind2)?.stops;
28162
+ return stops !== void 0 && stops.reply.test(reply) ? stops.says : void 0;
28163
+ }
28156
28164
  function signedOutBy(kind2, error62) {
28157
28165
  if (isAuthRequired(error62)) return true;
28158
28166
  const unready = knownBy(kind2)?.unready;
@@ -29110,12 +29118,55 @@ function modeOwnRules(name, running, mode) {
29110
29118
  if (mode === void 0) return { read_from, mode: running, runs: [] };
29111
29119
  return { read_from, mode: mode.name, ...mode.everything === true ? { everything: true } : {}, note: mode.words, runs: [] };
29112
29120
  }
29113
- function copilotOwnRules(allowAll) {
29114
- const read_from = ["Copilot's Allow all, as its sessions say it"];
29121
+ function copilotEntries(approval) {
29122
+ if (!isRecord2(approval) || typeof approval["kind"] !== "string") return [];
29123
+ const kind2 = approval["kind"];
29124
+ if (kind2 === "commands") {
29125
+ const said = approval["commandIdentifiers"];
29126
+ return (Array.isArray(said) ? said : []).filter((each) => typeof each === "string" && each.trim() !== "").map((each) => {
29127
+ const words4 = bashWords(each.trim());
29128
+ return { kind: "command", name: "shell", ...words4 === void 0 ? {} : { words: words4 }, raw: clip(each.trim(), LONGEST_RAW) };
29129
+ });
29130
+ }
29131
+ if (kind2 === "read" || kind2 === "write") return [{ kind: kind2, name: kind2, raw: kind2 }];
29132
+ if (kind2 === "mcp") {
29133
+ const server = typeof approval["serverName"] === "string" ? approval["serverName"] : "";
29134
+ const tool2 = typeof approval["toolName"] === "string" ? approval["toolName"] : "*";
29135
+ return server === "" ? [] : [{ kind: "tool", name: clip(`${server}(${tool2})`, LONGEST_NAME), raw: clip(`${server}(${tool2})`, LONGEST_RAW) }];
29136
+ }
29137
+ const tool = typeof approval["toolName"] === "string" ? approval["toolName"] : typeof approval["extensionName"] === "string" ? approval["extensionName"] : void 0;
29138
+ const label2 = tool === void 0 ? kind2 : `${kind2}(${tool})`;
29139
+ return [{ kind: "tool", name: clip(label2, LONGEST_NAME), raw: clip(label2, LONGEST_RAW) }];
29140
+ }
29141
+ function urlEntries(said) {
29142
+ return (Array.isArray(said) ? said : []).filter((each) => typeof each === "string" && each.trim() !== "").map((each) => ({ kind: "web", name: "url", raw: clip(each.trim(), LONGEST_RAW) }));
29143
+ }
29144
+ function once(entries2) {
29145
+ const seen = /* @__PURE__ */ new Set();
29146
+ return entries2.filter((entry) => {
29147
+ const key = `${entry.kind} ${entry.name} ${entry.raw ?? ""}`;
29148
+ if (seen.has(key)) return false;
29149
+ seen.add(key);
29150
+ return true;
29151
+ }).slice(0, MOST);
29152
+ }
29153
+ function copilotOwnRules(allowAll, saved) {
29154
+ const home = saved?.home ?? homedir6();
29155
+ const files = saved === void 0 ? [] : [saved.config === void 0 ? void 0 : saved.configPath, saved.settings === void 0 ? void 0 : saved.settingsPath];
29156
+ const read_from = ["Copilot's Allow all, as its sessions say it", ...files.filter((path) => path !== void 0).map((path) => tilde(path, home))];
29115
29157
  if (allowAll === "on") {
29116
29158
  return { read_from, mode: "Allow all", everything: true, note: "Copilot approves every tool, path and URL request without asking.", runs: [] };
29117
29159
  }
29118
- return { read_from, mode: "Asks first", note: "Copilot asks before it uses a tool, reaches a path or fetches a URL.", runs: [] };
29160
+ const locations = isRecord2(saved?.config?.["locations"]) ? saved?.config?.["locations"] : {};
29161
+ const folders = saved?.folders ?? [];
29162
+ const approvals = Object.entries(locations).filter(([place]) => folders.some((folder2) => folder2 === place || folder2.startsWith(`${place}/`))).flatMap(([, held]) => isRecord2(held) && Array.isArray(held["tool_approvals"]) ? held["tool_approvals"] : []);
29163
+ const runs = once([...approvals.flatMap(copilotEntries), ...urlEntries(saved?.settings?.["allowedUrls"])]);
29164
+ const refuses = once(urlEntries(saved?.settings?.["deniedUrls"]));
29165
+ const note = [
29166
+ "Copilot asks before it uses a tool, reaches a path or fetches a URL.",
29167
+ runs.length > 0 ? "It runs on its own what it was told to keep allowing in these agents' folders." : void 0
29168
+ ].filter((line) => line !== void 0).join(" ");
29169
+ return { read_from, mode: "Asks first", note, runs, ...refuses.length > 0 ? { refuses } : {} };
29119
29170
  }
29120
29171
  function tomlSection(toml, name) {
29121
29172
  let inside3 = false;
@@ -29216,6 +29267,165 @@ function grokOwnRules(options) {
29216
29267
  refuses: [...own2.deny, ...borrowed.deny].slice(0, MOST)
29217
29268
  };
29218
29269
  }
29270
+ function actionRule(rule) {
29271
+ const said = /^\s*([^()\s]+)\s*(?:\((.*)\))?\s*$/s.exec(rule);
29272
+ const action2 = said?.[1];
29273
+ if (action2 === void 0) return void 0;
29274
+ const target = said?.[2]?.trim();
29275
+ return target === void 0 || target === "" ? { action: action2 } : { action: action2, target };
29276
+ }
29277
+ function ruleList(rules, entry) {
29278
+ if (!Array.isArray(rules)) return [];
29279
+ const seen = /* @__PURE__ */ new Set();
29280
+ const entries2 = [];
29281
+ for (const rule of rules) {
29282
+ if (typeof rule !== "string" || rule.trim() === "" || seen.has(rule.trim())) continue;
29283
+ seen.add(rule.trim());
29284
+ const made = entry(rule.trim());
29285
+ if (made !== void 0) entries2.push(made);
29286
+ }
29287
+ return entries2.slice(0, MOST);
29288
+ }
29289
+ function antigravityEntry(rule) {
29290
+ const parts = actionRule(rule);
29291
+ if (parts === void 0) return void 0;
29292
+ const name = clip(parts.action, LONGEST_NAME);
29293
+ const raw = clip(rule, LONGEST_RAW);
29294
+ switch (parts.action) {
29295
+ case "command":
29296
+ case "unsandboxed": {
29297
+ const words4 = parts.target?.startsWith("regex:") === true ? void 0 : bashWords(parts.target);
29298
+ return { kind: "command", name, ...words4 === void 0 ? {} : { words: words4 }, raw };
29299
+ }
29300
+ case "read_file":
29301
+ return { kind: "read", name, raw };
29302
+ case "write_file":
29303
+ return { kind: "write", name, raw };
29304
+ case "read_url":
29305
+ case "execute_url":
29306
+ return { kind: "web", name, raw };
29307
+ default:
29308
+ return { kind: "tool", name, raw };
29309
+ }
29310
+ }
29311
+ var ANTIGRAVITY_TOOL_PERMISSION = {
29312
+ strict: "Its tool permission is Strict: it asks before every command, whatever the mode.",
29313
+ "proceed-in-sandbox": "Its tool permission is Proceed in sandbox: it runs commands in its sandbox without asking, and asks before any outside it."
29314
+ };
29315
+ function antigravityOwnRules(options) {
29316
+ const home = options.home ?? homedir6();
29317
+ const read_from = ["the mode Chips starts each Antigravity session in", tilde(options.settingsPath, home)];
29318
+ const tool = options.settings?.["toolPermission"];
29319
+ const name = options.mode?.name ?? options.running;
29320
+ if (tool === "always-proceed" || options.mode?.everything === true) {
29321
+ const note2 = tool === "always-proceed" ? "Its tool permission is Always proceed: it approves every step without asking." : options.mode?.words;
29322
+ return { read_from, mode: name, everything: true, ...note2 === void 0 ? {} : { note: note2 }, runs: [] };
29323
+ }
29324
+ const permissions = options.settings?.["permissions"];
29325
+ const lists = isRecord2(permissions) ? permissions : {};
29326
+ const note = [options.mode?.words, typeof tool === "string" ? ANTIGRAVITY_TOOL_PERMISSION[tool] : void 0].filter((line) => line !== void 0).join(" ");
29327
+ return {
29328
+ read_from,
29329
+ mode: name,
29330
+ ...note === "" ? {} : { note },
29331
+ runs: ruleList(lists["allow"], antigravityEntry),
29332
+ asks: ruleList(lists["ask"], antigravityEntry),
29333
+ refuses: ruleList(lists["deny"], antigravityEntry)
29334
+ };
29335
+ }
29336
+ function goosePermissionsOf(yaml) {
29337
+ const lists = { always_allow: [], ask_before: [], never_allow: [] };
29338
+ let section;
29339
+ let list;
29340
+ const unquoted = (text) => text.trim().replace(/^(['"])(.*)\1$/, "$2");
29341
+ for (const line of (yaml ?? "").split("\n")) {
29342
+ if (/^\s*(#.*)?$/.test(line)) continue;
29343
+ const top = /^([A-Za-z_][\w-]*):\s*(?:#.*)?$/.exec(line);
29344
+ if (top !== null) {
29345
+ section = top[1];
29346
+ list = void 0;
29347
+ continue;
29348
+ }
29349
+ if (section !== "user") continue;
29350
+ const key = /^\s+(always_allow|ask_before|never_allow):\s*(.*)$/.exec(line);
29351
+ if (key !== null) {
29352
+ list = key[1];
29353
+ const inline = /^\[(.*)\]\s*(?:#.*)?$/.exec(key[2]?.trim() ?? "");
29354
+ if (inline !== null) {
29355
+ for (const each of (inline[1] ?? "").split(",")) if (unquoted(each) !== "") lists[list].push(unquoted(each));
29356
+ list = void 0;
29357
+ }
29358
+ continue;
29359
+ }
29360
+ const item = /^\s*-\s*(.+?)\s*(?:#.*)?$/.exec(line);
29361
+ if (item !== null && list !== void 0 && unquoted(item[1] ?? "") !== "") lists[list].push(unquoted(item[1] ?? ""));
29362
+ }
29363
+ return lists;
29364
+ }
29365
+ function gooseEntry(tool) {
29366
+ const name = clip(tool, LONGEST_NAME);
29367
+ return /(^|__)shell$/.test(tool) ? { kind: "command", name, raw: name } : { kind: "tool", name, raw: name };
29368
+ }
29369
+ function gooseOwnRules(options) {
29370
+ const home = options.home ?? homedir6();
29371
+ const read_from = ["the mode Chips starts each Goose session in", tilde(options.permissionPath, home)];
29372
+ const name = options.mode?.name ?? options.running;
29373
+ const note = options.mode?.words;
29374
+ if (options.mode?.everything === true) return { read_from, mode: name, everything: true, ...note === void 0 ? {} : { note }, runs: [] };
29375
+ const lists = goosePermissionsOf(options.yaml);
29376
+ return {
29377
+ read_from,
29378
+ mode: name,
29379
+ ...note === void 0 ? {} : { note },
29380
+ runs: once(lists.always_allow.map(gooseEntry)),
29381
+ asks: once(lists.ask_before.map(gooseEntry)),
29382
+ refuses: once(lists.never_allow.map(gooseEntry))
29383
+ };
29384
+ }
29385
+ function cursorEntry(rule) {
29386
+ const parts = actionRule(rule);
29387
+ if (parts === void 0) return void 0;
29388
+ const name = clip(parts.action, LONGEST_NAME);
29389
+ const raw = clip(rule, LONGEST_RAW);
29390
+ switch (parts.action) {
29391
+ case "Shell": {
29392
+ const words4 = bashWords(parts.target);
29393
+ return { kind: "command", name, ...words4 === void 0 ? {} : { words: words4 }, raw };
29394
+ }
29395
+ case "Read":
29396
+ return { kind: "read", name, raw };
29397
+ case "Write":
29398
+ return { kind: "write", name, raw };
29399
+ case "WebFetch":
29400
+ return { kind: "web", name, raw };
29401
+ default:
29402
+ return { kind: "tool", name, raw };
29403
+ }
29404
+ }
29405
+ var CURSOR_MODES = {
29406
+ allowlist: { name: "Allowlist", note: "Cursor runs what its allow list allows, and asks before the rest." },
29407
+ "auto-review": {
29408
+ name: "Auto-review",
29409
+ note: "Cursor runs what its allow list allows, runs other commands in its sandbox where it can, and its own check decides the rest."
29410
+ },
29411
+ unrestricted: { name: "Run everything", note: "Cursor runs every step without asking.", everything: true }
29412
+ };
29413
+ function cursorOwnRules(options) {
29414
+ const home = options.home ?? homedir6();
29415
+ const read_from = [tilde(options.configPath, home), ...options.folders.map((each) => tilde(each.path, home))].slice(0, MOST_PLACES);
29416
+ const said = options.config?.["approvalMode"];
29417
+ const mode = typeof said === "string" ? CURSOR_MODES[said] : void 0;
29418
+ if (mode?.everything === true) return { read_from, mode: mode.name, everything: true, note: mode.note, runs: [] };
29419
+ const layers = [...options.config === void 0 ? [] : [options.config], ...options.folders.map((each) => each.layer)];
29420
+ const listed = (key) => once(layers.flatMap((layer) => ruleList(isRecord2(layer["permissions"]) ? layer["permissions"][key] : void 0, cursorEntry)));
29421
+ return {
29422
+ read_from,
29423
+ mode: mode?.name ?? "Cursor's own",
29424
+ note: mode?.note ?? "Cursor asks as its own Run Mode says: Auto-review, Allowlist or Run everything.",
29425
+ runs: listed("allow"),
29426
+ refuses: listed("deny")
29427
+ };
29428
+ }
29219
29429
  async function sendOwnRules(settings, copy) {
29220
29430
  const send = settings?.ownRules;
29221
29431
  if (typeof send !== "function") return false;
@@ -29409,6 +29619,13 @@ function compactionFacts(update) {
29409
29619
  }
29410
29620
 
29411
29621
  // src/bridge.ts
29622
+ function readText(path) {
29623
+ try {
29624
+ return readFileSync9(path, "utf8");
29625
+ } catch {
29626
+ return void 0;
29627
+ }
29628
+ }
29412
29629
  var QUIET_MS = 1500;
29413
29630
  var WAIT_FOR_AGENT_MS = 15e3;
29414
29631
  var MOST_RESPAWN_MS = 6e4;
@@ -30448,6 +30665,12 @@ ${files.join("\n")}`;
30448
30665
  await run2.fail({ error: `${room.record.name} refused.` });
30449
30666
  return;
30450
30667
  }
30668
+ const stopped2 = stoppedWith(this.options.kind, turn.reply);
30669
+ if (stopped2 !== void 0) {
30670
+ this.log(`${room.record.name} couldn't answer: ${stopped2}`);
30671
+ await run2.fail({ error: stopped2, retryable: true });
30672
+ return;
30673
+ }
30451
30674
  const answer = instead ?? (turn.reply.trim() || (turn.said.at(-1) ?? ""));
30452
30675
  const { change, note } = await this.sendProject(room, turn, answer);
30453
30676
  const { chips: chips2 } = this.options;
@@ -30657,11 +30880,22 @@ ${files.join("\n")}`;
30657
30880
  if (this.knownKind === void 0) {
30658
30881
  const { kind: kind2 } = this.options;
30659
30882
  const id2 = knownOf(kind2)?.id;
30660
- if (id2 === "copilot") return copilotOwnRules(this.permissionsNow);
30883
+ if (id2 === "copilot") return copilotOwnRules(this.permissionsNow, this.copilotSaved());
30661
30884
  if (id2 === "grok") return this.grokOwnRules();
30885
+ if (id2 === "cursor") return this.cursorOwnRules();
30662
30886
  const running = this.runningMode();
30663
30887
  if (id2 === void 0 || running === void 0 || modesOf(kind2).length === 0) return void 0;
30664
- return modeOwnRules(kind2.name, running, modesOf(kind2).find((mode) => mode.id === running));
30888
+ const mode = modesOf(kind2).find((each) => each.id === running);
30889
+ const { home } = this.places;
30890
+ if (id2 === "antigravity") {
30891
+ const settingsPath = join10(home, ".gemini", "antigravity-cli", "settings.json");
30892
+ return antigravityOwnRules({ settingsPath, settings: readLayer(settingsPath), running, mode, home });
30893
+ }
30894
+ if (id2 === "goose") {
30895
+ const permissionPath = join10(this.gooseConfigDir(), "permission.yaml");
30896
+ return gooseOwnRules({ permissionPath, yaml: readText(permissionPath), running, mode, home });
30897
+ }
30898
+ return modeOwnRules(kind2.name, running, mode);
30665
30899
  }
30666
30900
  if (this.knownKind !== "claude-code") return void 0;
30667
30901
  const userPath = join10(this.places.claudeHome, "settings.json");
@@ -30679,6 +30913,41 @@ ${files.join("\n")}`;
30679
30913
  home: this.places.home
30680
30914
  });
30681
30915
  }
30916
+ /**
30917
+ * Copilot's: what it saved on disk, its yeses by folder in `permissions-config.json` and its URL
30918
+ * rules in `settings.json`, both in `COPILOT_HOME` (`~/.copilot`).
30919
+ */
30920
+ copilotSaved() {
30921
+ const { home } = this.places;
30922
+ const root = this.env["COPILOT_HOME"] || join10(home, ".copilot");
30923
+ const configPath2 = join10(root, "permissions-config.json");
30924
+ const settingsPath = join10(root, "settings.json");
30925
+ return {
30926
+ configPath: configPath2,
30927
+ config: readLayer(configPath2) ?? readLayer(join10(root, "permissions-config")),
30928
+ settingsPath,
30929
+ settings: readLayer(settingsPath),
30930
+ folders: [...new Set(this.records().map((record2) => record2.folder))],
30931
+ home
30932
+ };
30933
+ }
30934
+ /** Cursor's: its own config, and each agent folder's `.cursor/cli.json`. */
30935
+ cursorOwnRules() {
30936
+ const { home } = this.places;
30937
+ const configPath2 = join10(home, ".cursor", "cli-config.json");
30938
+ const folders = [...new Set(this.records().map((record2) => record2.folder))].flatMap((folder2) => {
30939
+ const path = join10(folder2, ".cursor", "cli.json");
30940
+ const layer = readLayer(path);
30941
+ return layer === void 0 ? [] : [{ path, layer }];
30942
+ });
30943
+ return cursorOwnRules({ configPath: configPath2, config: readLayer(configPath2), folders, home });
30944
+ }
30945
+ /** Goose's config folder: `GOOSE_PATH_ROOT`'s, else `~/.config/goose` (or `XDG_CONFIG_HOME`'s). */
30946
+ gooseConfigDir() {
30947
+ const root = this.env["GOOSE_PATH_ROOT"];
30948
+ if (root) return join10(root, "config");
30949
+ return join10(this.env["XDG_CONFIG_HOME"] || join10(this.places.home, ".config"), "goose");
30950
+ }
30682
30951
  /**
30683
30952
  * Grok's: its own config, and the Claude Code settings it takes permission rules from: yours, in
30684
30953
  * `~/.claude`, and each agent folder's `.claude`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipschat/acp",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "An agent that speaks the Agent Client Protocol, as a Chips harness of its kind: agents made from Chips, each in a folder of its own, each room a session.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {