@chipschat/acp 1.0.36 → 1.0.37

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
@@ -37,7 +37,7 @@ also looks where that line puts the agent, since a terminal opened before doesn'
37
37
  | `copilot` | `copilot --acp` | `curl -fsSL https://gh.io/copilot-install \| bash` | `copilot login` | none |
38
38
  | `antigravity` | `agy acp` | `curl -fsSL https://antigravity.google/cli/install.sh \| bash` | `agy acp --login` | Default, Accept edits, Auto |
39
39
  | `goose` | `goose acp` | Goose's `download_cli.sh` | `goose configure` (a model provider and its key) | Approve, Smart approve, Auto |
40
- | `grok` | `grok --no-auto-update agent stdio` | `curl -fsSL https://x.ai/cli/install.sh \| bash` | `grok login` | none |
40
+ | `grok` | `grok agent stdio` | `curl -fsSL https://x.ai/cli/install.sh \| bash` | `grok login` | none |
41
41
 
42
42
  - **Cursor** and **Copilot** offer modes that are ways of working (Agent, Plan, Ask; Agent, Plan,
43
43
  Autopilot), not how much they may do, so Chips puts them in none: each session asks as the agent's
@@ -49,13 +49,23 @@ also looks where that line puts the agent, since a terminal opened before doesn'
49
49
  naming `GOOSE_PROVIDER`, which the bridge says as "Goose has no model provider set up".
50
50
  - **Grok** opens no session until it is asked to sign in (`authenticate`), as xAI's own ACP example
51
51
  does: by its API key where `XAI_API_KEY` is set, else by what `grok login` saved. Signed out, it
52
- offers neither, and its session is refused. Its ACP sessions have no mode to be put in.
52
+ offers neither, and its session is refused. Its ACP sessions have no mode to be put in. It is left
53
+ to update itself: xAI's API refuses one too old, and a Grok only Chips runs would never be updated
54
+ otherwise.
53
55
  - **Antigravity**'s Auto is offered only where Antigravity has it: a personal Google account with
54
56
  its terminal sandbox on.
55
57
  - None of the five copies a session (`session/fork`), so their cards leave Fork off. Cursor, Copilot,
56
58
  Goose and Grok offer their models as a session's `model` option, where they do, and the bridge
57
- offers them in Chips as it does Claude Code's and Codex's. Their files and own settings aren't
58
- read: the Permissions page shows the mode a session runs in, where Chips may pick one.
59
+ offers them in Chips as it does Claude Code's and Codex's, each once (Copilot on GitHub's free plan
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 and rules from `~/.grok/config.toml` (`[ui] permission_mode`, or the older
64
+ `yolo`; `[permission] rules`) together with the permission rules it takes from Claude Code's
65
+ settings, yours in `~/.claude` and each agent folder's; and for Antigravity and Goose the mode a
66
+ session runs in. Cursor's own settings aren't read yet.
67
+ - An agent's refusal reaches the room in its own words: where JSON-RPC's message is only "Internal
68
+ error", what its details say, as Grok's API answer ("Your Grok CLI version (0.2.99) is outdated …").
59
69
  - What signs one in from the environment is carried to the copy kept running: `CURSOR_API_KEY`,
60
70
  `COPILOT_GITHUB_TOKEN` (not `GH_TOKEN` or `GITHUB_TOKEN`, which are the gh command's too and
61
71
  would beat Copilot's saved sign-in), `GEMINI_API_KEY`, `XAI_API_KEY`, and Goose's
@@ -1,6 +1,6 @@
1
1
  # Third-party notices
2
2
 
3
- `dist/main.js` in @chipschat/acp 1.0.36 carries these packages, bundled in. Each one's
3
+ `dist/main.js` in @chipschat/acp 1.0.37 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
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  };
9
9
 
10
10
  // src/main.ts
11
- import { existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "node:fs";
11
+ import { existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync11, writeFileSync as writeFileSync5 } from "node:fs";
12
12
  import { basename as basename6, dirname as dirname7, join as join12 } from "node:path";
13
13
 
14
14
  // node_modules/zod/v4/classic/external.js
@@ -27737,6 +27737,12 @@ var AcpError = class extends Error {
27737
27737
  data;
27738
27738
  name = "AcpError";
27739
27739
  };
27740
+ function agentWords(error62) {
27741
+ const data = error62.data;
27742
+ const said = typeof data === "string" ? data : typeof data === "object" && data !== null && typeof data.message === "string" ? data.message : void 0;
27743
+ if (said === void 0 || said.trim() === "" || !/^internal error$/i.test(error62.message.trim())) return error62.message;
27744
+ return said.trim().slice(0, 600);
27745
+ }
27740
27746
  function isAuthRequired(error62) {
27741
27747
  return error62 instanceof AcpError && error62.code === -32e3 && /auth/i.test(error62.message);
27742
27748
  }
@@ -28113,9 +28119,9 @@ var KNOWN2 = [
28113
28119
  id: "grok",
28114
28120
  name: "Grok",
28115
28121
  program: "grok",
28116
- // Grok updates itself in the background unless told not to, which xAI asks of anything that
28117
- // runs it as an ACP agent: the person's own `grok` in a terminal still keeps itself current.
28118
- args: ["--no-auto-update", "agent", "stdio"],
28122
+ // Left to update itself as it does: xAI's API refuses a Grok too old (it refused 0.2.99 with
28123
+ // a 426), and a Grok only Chips runs would never be updated otherwise.
28124
+ args: ["agent", "stdio"],
28119
28125
  fetches: false,
28120
28126
  agent: "grok",
28121
28127
  installLine: "curl -fsSL https://x.ai/cli/install.sh | bash",
@@ -28528,7 +28534,7 @@ function forgetAdapter(id2, home = homedir5()) {
28528
28534
 
28529
28535
  // src/bridge.ts
28530
28536
  import { randomBytes } from "node:crypto";
28531
- import { existsSync as existsSync8 } from "node:fs";
28537
+ import { existsSync as existsSync8, readFileSync as readFileSync9 } from "node:fs";
28532
28538
  import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
28533
28539
  import { homedir as homedir7 } from "node:os";
28534
28540
  import { join as join10 } from "node:path";
@@ -28936,6 +28942,10 @@ function currentIn(options) {
28936
28942
  const value = modeOption(options)?.currentValue;
28937
28943
  return value === void 0 || value === "" ? void 0 : value;
28938
28944
  }
28945
+ function permissionsIn(options) {
28946
+ const value = options?.find((option) => option.category === "permissions")?.currentValue;
28947
+ return value === void 0 || value === "" ? void 0 : value;
28948
+ }
28939
28949
  function withCurrent(options, mode) {
28940
28950
  const option = modeOption(options);
28941
28951
  return option === void 0 ? options : options.map((each) => each === option ? { ...each, currentValue: mode } : each);
@@ -29100,6 +29110,82 @@ function modeOwnRules(name, running, mode) {
29100
29110
  if (mode === void 0) return { read_from, mode: running, runs: [] };
29101
29111
  return { read_from, mode: mode.name, ...mode.everything === true ? { everything: true } : {}, note: mode.words, runs: [] };
29102
29112
  }
29113
+ function copilotOwnRules(allowAll) {
29114
+ const read_from = ["Copilot's Allow all, as its sessions say it"];
29115
+ if (allowAll === "on") {
29116
+ return { read_from, mode: "Allow all", everything: true, note: "Copilot approves every tool, path and URL request without asking.", runs: [] };
29117
+ }
29118
+ return { read_from, mode: "Asks first", note: "Copilot asks before it uses a tool, reaches a path or fetches a URL.", runs: [] };
29119
+ }
29120
+ function tomlSection(toml, name) {
29121
+ let inside3 = false;
29122
+ const lines2 = [];
29123
+ for (const line of toml.split("\n")) {
29124
+ const header = /^\s*\[([^\]]+)\]\s*(?:#.*)?$/.exec(line);
29125
+ if (header !== null) {
29126
+ inside3 = header[1]?.trim() === name;
29127
+ continue;
29128
+ }
29129
+ if (inside3) lines2.push(line);
29130
+ }
29131
+ return lines2.join("\n");
29132
+ }
29133
+ var tomlString = (section, key) => new RegExp(`^\\s*${key}\\s*=\\s*"([^"]*)"`, "m").exec(section)?.[1];
29134
+ var tomlTrue = (section, key) => new RegExp(`^\\s*${key}\\s*=\\s*true\\b`, "m").test(section);
29135
+ function grokModeOf(toml) {
29136
+ const ui = tomlSection(toml ?? "", "ui");
29137
+ const said = tomlString(ui, "permission_mode") ?? tomlString(ui, "approval_mode");
29138
+ if (said === "auto" || said === "always-approve" || said === "ask") return said;
29139
+ return tomlTrue(ui, "yolo") ? "always-approve" : "ask";
29140
+ }
29141
+ var GROK_MODES = {
29142
+ ask: { name: "Ask", note: "Grok asks before anything its rules don't allow." },
29143
+ auto: { name: "Auto", note: "Grok's own check lets safe steps through and asks about risky ones." },
29144
+ "always-approve": { name: "Always-approve", note: "Grok approves every step without asking: only deny rules and hooks stop one." }
29145
+ };
29146
+ function grokEntry(tool, pattern, raw) {
29147
+ const name = clip(tool, LONGEST_NAME);
29148
+ const lower = tool.toLowerCase();
29149
+ if (lower === "bash") {
29150
+ const words4 = bashWords(pattern);
29151
+ return { kind: "command", name, ...words4 === void 0 ? {} : { words: words4 }, raw: clip(raw, LONGEST_RAW) };
29152
+ }
29153
+ const kind2 = lower === "read" || lower === "grep" ? "read" : lower === "edit" ? "write" : lower.startsWith("web") ? "web" : "tool";
29154
+ return { kind: kind2, name, raw: clip(raw, LONGEST_RAW) };
29155
+ }
29156
+ function grokRulesOf(toml) {
29157
+ const rules = { allow: [], ask: [], deny: [] };
29158
+ const section = tomlSection(toml ?? "", "permission");
29159
+ for (const table of section.matchAll(/\{([^{}]*)\}/g)) {
29160
+ const body = table[1] ?? "";
29161
+ const field = (key) => new RegExp(`\\b${key}\\s*=\\s*"([^"]*)"`).exec(body)?.[1];
29162
+ const action2 = field("action");
29163
+ const tool = field("tool");
29164
+ if ((action2 === "allow" || action2 === "ask" || action2 === "deny") && tool !== void 0) {
29165
+ rules[action2].push(grokEntry(tool, field("pattern"), `{${body.trim()}}`));
29166
+ }
29167
+ }
29168
+ return { allow: rules.allow.slice(0, MOST), ask: rules.ask.slice(0, MOST), deny: rules.deny.slice(0, MOST) };
29169
+ }
29170
+ function grokOwnRules(options) {
29171
+ const home = options.home ?? homedir6();
29172
+ const mode = grokModeOf(options.config);
29173
+ const own2 = grokRulesOf(options.config);
29174
+ const layers = options.claude.map((each) => each.layer);
29175
+ const borrowed = { allow: joined(layers, "allow"), ask: joined(layers, "ask"), deny: joined(layers, "deny") };
29176
+ const withClaude = borrowed.allow.length + borrowed.ask.length + borrowed.deny.length > 0;
29177
+ const read_from = [tilde(options.configPath, home), ...withClaude ? options.claude.map((each) => tilde(each.path, home)) : []].slice(0, MOST_PLACES);
29178
+ const note = [GROK_MODES[mode].note, withClaude ? "It follows your Claude Code permission rules too, as listed here." : void 0].filter((line) => line !== void 0).join(" ");
29179
+ if (mode === "always-approve") return { read_from, mode: GROK_MODES[mode].name, everything: true, note, runs: [] };
29180
+ return {
29181
+ read_from,
29182
+ mode: GROK_MODES[mode].name,
29183
+ note,
29184
+ runs: [...own2.allow, ...borrowed.allow].slice(0, MOST),
29185
+ asks: [...own2.ask, ...borrowed.ask].slice(0, MOST),
29186
+ refuses: [...own2.deny, ...borrowed.deny].slice(0, MOST)
29187
+ };
29188
+ }
29103
29189
  async function sendOwnRules(settings, copy) {
29104
29190
  const send = settings?.ownRules;
29105
29191
  if (typeof send !== "function") return false;
@@ -29144,7 +29230,8 @@ async function lookAt(options, set2) {
29144
29230
  const model = modelOption(options);
29145
29231
  const fallback = pickOf(options);
29146
29232
  if (model === void 0 || fallback === void 0) return { refused: [] };
29147
- const listed = model.options.some((each) => each.value === fallback.model) ? model.options : [{ value: fallback.model, name: fallback.model }, ...model.options];
29233
+ const named = model.options.some((each) => each.value === fallback.model) ? model.options : [{ value: fallback.model, name: fallback.model }, ...model.options];
29234
+ const listed = named.filter((each, at) => named.findIndex((other) => other.value === each.value) === at);
29148
29235
  let others = MODEL_CHOICES_MAX - 1;
29149
29236
  const offered = listed.filter((each) => each.value === fallback.model || others-- > 0);
29150
29237
  const choices = [];
@@ -29375,6 +29462,8 @@ var Bridge = class {
29375
29462
  modeSaid = /* @__PURE__ */ new Map();
29376
29463
  /** What it runs on its own, to send again in a moment: a mode change moves every session at once. */
29377
29464
  ownRulesTimer;
29465
+ /** Its sessions' permission option, as the last to say it said: Copilot's Allow all. */
29466
+ permissionsNow;
29378
29467
  /** Hear what Chips asks, learn the agents Chips has, run the agent, and close idle sessions. */
29379
29468
  async start() {
29380
29469
  const { chips: chips2 } = this.options;
@@ -29582,6 +29671,7 @@ var Bridge = class {
29582
29671
  copied = { client, sessionId: forked.sessionId };
29583
29672
  this.process.live.add(forked.sessionId);
29584
29673
  this.sessionOptions.set(forked.sessionId, forked.configOptions);
29674
+ this.permissionsHeard(forked.configOptions);
29585
29675
  await this.moded(client, forked.sessionId);
29586
29676
  }
29587
29677
  record2 = await this.made(forkName(original.name), {
@@ -30154,6 +30244,7 @@ ${files.join("\n")}`;
30154
30244
  const loaded = await client.loadSession(kept2, record2.folder, [], this.sessionMeta(record2));
30155
30245
  live.add(kept2);
30156
30246
  this.sessionOptions.set(kept2, loaded.configOptions);
30247
+ this.permissionsHeard(loaded.configOptions);
30157
30248
  await this.moded(client, kept2);
30158
30249
  await this.modelled(client, record2, kept2);
30159
30250
  return kept2;
@@ -30164,6 +30255,7 @@ ${files.join("\n")}`;
30164
30255
  const made = await client.newSession(record2.folder, [], this.sessionMeta(record2));
30165
30256
  live.add(made.sessionId);
30166
30257
  this.sessionOptions.set(made.sessionId, made.configOptions);
30258
+ this.permissionsHeard(made.configOptions);
30167
30259
  await this.moded(client, made.sessionId);
30168
30260
  await this.modelled(client, record2, made.sessionId);
30169
30261
  state2.sessions[key] = made.sessionId;
@@ -30253,6 +30345,13 @@ ${files.join("\n")}`;
30253
30345
  this.modeNow = mode;
30254
30346
  this.ownRulesSoon();
30255
30347
  }
30348
+ /** A session's permission option, heard: what it runs on its own is sent again when it moved. */
30349
+ permissionsHeard(options) {
30350
+ const now = permissionsIn(options);
30351
+ if (now === void 0 || now === this.permissionsNow) return;
30352
+ this.permissionsNow = now;
30353
+ this.ownRulesSoon();
30354
+ }
30256
30355
  /** What it runs on its own, sent again in a moment. */
30257
30356
  ownRulesSoon() {
30258
30357
  clearTimeout(this.ownRulesTimer);
@@ -30527,8 +30626,11 @@ ${files.join("\n")}`;
30527
30626
  if (this.knownKind === "codex") return codexOwnRules(this.runningMode() ?? "workspace-write");
30528
30627
  if (this.knownKind === void 0) {
30529
30628
  const { kind: kind2 } = this.options;
30629
+ const id2 = knownOf(kind2)?.id;
30630
+ if (id2 === "copilot") return copilotOwnRules(this.permissionsNow);
30631
+ if (id2 === "grok") return this.grokOwnRules();
30530
30632
  const running = this.runningMode();
30531
- if (knownOf(kind2) === void 0 || running === void 0 || modesOf(kind2).length === 0) return void 0;
30633
+ if (id2 === void 0 || running === void 0 || modesOf(kind2).length === 0) return void 0;
30532
30634
  return modeOwnRules(kind2.name, running, modesOf(kind2).find((mode) => mode.id === running));
30533
30635
  }
30534
30636
  if (this.knownKind !== "claude-code") return void 0;
@@ -30547,6 +30649,31 @@ ${files.join("\n")}`;
30547
30649
  home: this.places.home
30548
30650
  });
30549
30651
  }
30652
+ /**
30653
+ * Grok's: its own config, and the Claude Code settings it takes permission rules from: yours, in
30654
+ * `~/.claude`, and each agent folder's `.claude`.
30655
+ */
30656
+ grokOwnRules() {
30657
+ const { home, claudeHome } = this.places;
30658
+ const configPath2 = join10(home, ".grok", "config.toml");
30659
+ let config2;
30660
+ try {
30661
+ config2 = readFileSync9(configPath2, "utf8");
30662
+ } catch {
30663
+ config2 = void 0;
30664
+ }
30665
+ const folders = [...new Set(this.records().map((record2) => record2.folder))];
30666
+ const paths = [
30667
+ join10(claudeHome, "settings.json"),
30668
+ join10(claudeHome, "settings.local.json"),
30669
+ ...folders.flatMap((folder2) => [join10(folder2, ".claude", "settings.json"), join10(folder2, ".claude", "settings.local.json")])
30670
+ ];
30671
+ const claude = paths.flatMap((path) => {
30672
+ const layer = readLayer(path);
30673
+ return layer === void 0 ? [] : [{ path, layer }];
30674
+ });
30675
+ return grokOwnRules({ configPath: configPath2, config: config2, claude, home });
30676
+ }
30550
30677
  /** The harness's own set and each agent's files, as they are on disk now. */
30551
30678
  async sendContexts() {
30552
30679
  const files = this.files;
@@ -30668,6 +30795,7 @@ ${files.join("\n")}`;
30668
30795
  const options = configOptionsOf(update);
30669
30796
  if (this.sessionOptions.has(sessionId) && options.length > 0) {
30670
30797
  this.sessionOptions.set(sessionId, options);
30798
+ this.permissionsHeard(options);
30671
30799
  const now = currentIn(options);
30672
30800
  if (now !== void 0) {
30673
30801
  this.modeSaid.set(sessionId, now);
@@ -30945,6 +31073,7 @@ ${files.join("\n")}`;
30945
31073
  try {
30946
31074
  const made = await client.newSession(kind2.folder ?? kind2.folders);
30947
31075
  sessionId = made.sessionId;
31076
+ this.permissionsHeard(made.configOptions);
30948
31077
  const offered = offeredIn(made.configOptions);
30949
31078
  if (offered !== void 0 && offered.join() !== this.offered?.join()) {
30950
31079
  this.offered = offered;
@@ -31169,7 +31298,7 @@ function settingsFor(kind2, bridge2) {
31169
31298
  };
31170
31299
  }
31171
31300
  function messageOf(error62) {
31172
- if (error62 instanceof AcpError) return error62.message;
31301
+ if (error62 instanceof AcpError) return agentWords(error62);
31173
31302
  return error62 instanceof Error ? error62.message : String(error62);
31174
31303
  }
31175
31304
  function goalOf(message, name) {
@@ -31354,7 +31483,7 @@ function keepIfAsked(label2, url2, names, log2, before = () => void 0) {
31354
31483
  }
31355
31484
 
31356
31485
  // src/move.ts
31357
- import { lstatSync, mkdirSync as mkdirSync5, readdirSync as readdirSync2, readFileSync as readFileSync9, renameSync as renameSync2, rmdirSync, writeFileSync as writeFileSync4 } from "node:fs";
31486
+ import { lstatSync, mkdirSync as mkdirSync5, readdirSync as readdirSync2, readFileSync as readFileSync10, renameSync as renameSync2, rmdirSync, writeFileSync as writeFileSync4 } from "node:fs";
31358
31487
  import { homedir as homedir8 } from "node:os";
31359
31488
  import { basename as basename5, dirname as dirname6, join as join11, resolve as resolve5 } from "node:path";
31360
31489
  var there = (path) => {
@@ -31412,7 +31541,7 @@ function writeJson(path, value) {
31412
31541
  }
31413
31542
  var readJson = (path) => {
31414
31543
  try {
31415
- const read = JSON.parse(readFileSync9(path, "utf8"));
31544
+ const read = JSON.parse(readFileSync10(path, "utf8"));
31416
31545
  return typeof read === "object" && read !== null ? read : void 0;
31417
31546
  } catch {
31418
31547
  return void 0;
@@ -31558,7 +31687,7 @@ var joined2 = await join3({
31558
31687
  onCode: (code) => log(`Allow this harness in Chips: ${code}`)
31559
31688
  }).catch(refused2);
31560
31689
  keepIfAsked(LABEL, joined2.url, keptEnvOf(kind), log);
31561
- var kept = existsSync10(statePath) ? JSON.parse(readFileSync10(statePath, "utf8")) : {};
31690
+ var kept = existsSync10(statePath) ? JSON.parse(readFileSync11(statePath, "utf8")) : {};
31562
31691
  var state = {
31563
31692
  sessions: kept.sessions ?? {},
31564
31693
  agents: kept.agents ?? {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipschat/acp",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
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": {