@chipschat/acp 1.0.38 → 1.0.40
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 +21 -8
- package/dist/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/main.js +298 -12
- package/package.json +1 -1
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,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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`,
|
package/dist/main.js
CHANGED
|
@@ -27995,7 +27995,11 @@ var CODEX_MODES = [
|
|
|
27995
27995
|
var ANTIGRAVITY_MODES = [
|
|
27996
27996
|
{ id: "default", name: "Default", words: "Asks before edits and commands its settings don't allow." },
|
|
27997
27997
|
{ id: "accept-edits", name: "Accept edits", words: "Edits files in its folder without asking. Commands still ask." },
|
|
27998
|
-
{
|
|
27998
|
+
{
|
|
27999
|
+
id: "auto",
|
|
28000
|
+
name: "Auto",
|
|
28001
|
+
words: "Edits files and runs commands in its sandbox without asking. Asks before a command outside it that it can't undo."
|
|
28002
|
+
}
|
|
27999
28003
|
];
|
|
28000
28004
|
var GOOSE_MODES = [
|
|
28001
28005
|
{ id: "approve", name: "Approve", words: "Asks before every tool call its own permission list doesn't settle." },
|
|
@@ -28113,7 +28117,11 @@ var KNOWN2 = [
|
|
|
28113
28117
|
signIn: "run `agy acp --login` and paste back the code it asks for",
|
|
28114
28118
|
signInLine: "agy acp --login",
|
|
28115
28119
|
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"]
|
|
28120
|
+
keys: ["GEMINI_API_KEY"],
|
|
28121
|
+
stops: {
|
|
28122
|
+
reply: /^[\s⚠\uFE0F]*Verification Required[\s.!]*$/i,
|
|
28123
|
+
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."
|
|
28124
|
+
}
|
|
28117
28125
|
},
|
|
28118
28126
|
{
|
|
28119
28127
|
id: "grok",
|
|
@@ -28153,6 +28161,10 @@ var knownBy = (kind2) => {
|
|
|
28153
28161
|
return KNOWN2.find((each) => each.program === program);
|
|
28154
28162
|
};
|
|
28155
28163
|
var speaksAcp = (known) => known.adapter === void 0;
|
|
28164
|
+
function stoppedWith(kind2, reply) {
|
|
28165
|
+
const stops = knownBy(kind2)?.stops;
|
|
28166
|
+
return stops !== void 0 && stops.reply.test(reply) ? stops.says : void 0;
|
|
28167
|
+
}
|
|
28156
28168
|
function signedOutBy(kind2, error62) {
|
|
28157
28169
|
if (isAuthRequired(error62)) return true;
|
|
28158
28170
|
const unready = knownBy(kind2)?.unready;
|
|
@@ -29110,12 +29122,55 @@ function modeOwnRules(name, running, mode) {
|
|
|
29110
29122
|
if (mode === void 0) return { read_from, mode: running, runs: [] };
|
|
29111
29123
|
return { read_from, mode: mode.name, ...mode.everything === true ? { everything: true } : {}, note: mode.words, runs: [] };
|
|
29112
29124
|
}
|
|
29113
|
-
function
|
|
29114
|
-
|
|
29125
|
+
function copilotEntries(approval) {
|
|
29126
|
+
if (!isRecord2(approval) || typeof approval["kind"] !== "string") return [];
|
|
29127
|
+
const kind2 = approval["kind"];
|
|
29128
|
+
if (kind2 === "commands") {
|
|
29129
|
+
const said = approval["commandIdentifiers"];
|
|
29130
|
+
return (Array.isArray(said) ? said : []).filter((each) => typeof each === "string" && each.trim() !== "").map((each) => {
|
|
29131
|
+
const words4 = bashWords(each.trim());
|
|
29132
|
+
return { kind: "command", name: "shell", ...words4 === void 0 ? {} : { words: words4 }, raw: clip(each.trim(), LONGEST_RAW) };
|
|
29133
|
+
});
|
|
29134
|
+
}
|
|
29135
|
+
if (kind2 === "read" || kind2 === "write") return [{ kind: kind2, name: kind2, raw: kind2 }];
|
|
29136
|
+
if (kind2 === "mcp") {
|
|
29137
|
+
const server = typeof approval["serverName"] === "string" ? approval["serverName"] : "";
|
|
29138
|
+
const tool2 = typeof approval["toolName"] === "string" ? approval["toolName"] : "*";
|
|
29139
|
+
return server === "" ? [] : [{ kind: "tool", name: clip(`${server}(${tool2})`, LONGEST_NAME), raw: clip(`${server}(${tool2})`, LONGEST_RAW) }];
|
|
29140
|
+
}
|
|
29141
|
+
const tool = typeof approval["toolName"] === "string" ? approval["toolName"] : typeof approval["extensionName"] === "string" ? approval["extensionName"] : void 0;
|
|
29142
|
+
const label2 = tool === void 0 ? kind2 : `${kind2}(${tool})`;
|
|
29143
|
+
return [{ kind: "tool", name: clip(label2, LONGEST_NAME), raw: clip(label2, LONGEST_RAW) }];
|
|
29144
|
+
}
|
|
29145
|
+
function urlEntries(said) {
|
|
29146
|
+
return (Array.isArray(said) ? said : []).filter((each) => typeof each === "string" && each.trim() !== "").map((each) => ({ kind: "web", name: "url", raw: clip(each.trim(), LONGEST_RAW) }));
|
|
29147
|
+
}
|
|
29148
|
+
function once(entries2) {
|
|
29149
|
+
const seen = /* @__PURE__ */ new Set();
|
|
29150
|
+
return entries2.filter((entry) => {
|
|
29151
|
+
const key = `${entry.kind} ${entry.name} ${entry.raw ?? ""}`;
|
|
29152
|
+
if (seen.has(key)) return false;
|
|
29153
|
+
seen.add(key);
|
|
29154
|
+
return true;
|
|
29155
|
+
}).slice(0, MOST);
|
|
29156
|
+
}
|
|
29157
|
+
function copilotOwnRules(allowAll, saved) {
|
|
29158
|
+
const home = saved?.home ?? homedir6();
|
|
29159
|
+
const files = saved === void 0 ? [] : [saved.config === void 0 ? void 0 : saved.configPath, saved.settings === void 0 ? void 0 : saved.settingsPath];
|
|
29160
|
+
const read_from = ["Copilot's Allow all, as its sessions say it", ...files.filter((path) => path !== void 0).map((path) => tilde(path, home))];
|
|
29115
29161
|
if (allowAll === "on") {
|
|
29116
29162
|
return { read_from, mode: "Allow all", everything: true, note: "Copilot approves every tool, path and URL request without asking.", runs: [] };
|
|
29117
29163
|
}
|
|
29118
|
-
|
|
29164
|
+
const locations = isRecord2(saved?.config?.["locations"]) ? saved?.config?.["locations"] : {};
|
|
29165
|
+
const folders = saved?.folders ?? [];
|
|
29166
|
+
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"] : []);
|
|
29167
|
+
const runs = once([...approvals.flatMap(copilotEntries), ...urlEntries(saved?.settings?.["allowedUrls"])]);
|
|
29168
|
+
const refuses = once(urlEntries(saved?.settings?.["deniedUrls"]));
|
|
29169
|
+
const note = [
|
|
29170
|
+
"Copilot asks before it uses a tool, reaches a path or fetches a URL.",
|
|
29171
|
+
runs.length > 0 ? "It runs on its own what it was told to keep allowing in these agents' folders." : void 0
|
|
29172
|
+
].filter((line) => line !== void 0).join(" ");
|
|
29173
|
+
return { read_from, mode: "Asks first", note, runs, ...refuses.length > 0 ? { refuses } : {} };
|
|
29119
29174
|
}
|
|
29120
29175
|
function tomlSection(toml, name) {
|
|
29121
29176
|
let inside3 = false;
|
|
@@ -29216,6 +29271,165 @@ function grokOwnRules(options) {
|
|
|
29216
29271
|
refuses: [...own2.deny, ...borrowed.deny].slice(0, MOST)
|
|
29217
29272
|
};
|
|
29218
29273
|
}
|
|
29274
|
+
function actionRule(rule) {
|
|
29275
|
+
const said = /^\s*([^()\s]+)\s*(?:\((.*)\))?\s*$/s.exec(rule);
|
|
29276
|
+
const action2 = said?.[1];
|
|
29277
|
+
if (action2 === void 0) return void 0;
|
|
29278
|
+
const target = said?.[2]?.trim();
|
|
29279
|
+
return target === void 0 || target === "" ? { action: action2 } : { action: action2, target };
|
|
29280
|
+
}
|
|
29281
|
+
function ruleList(rules, entry) {
|
|
29282
|
+
if (!Array.isArray(rules)) return [];
|
|
29283
|
+
const seen = /* @__PURE__ */ new Set();
|
|
29284
|
+
const entries2 = [];
|
|
29285
|
+
for (const rule of rules) {
|
|
29286
|
+
if (typeof rule !== "string" || rule.trim() === "" || seen.has(rule.trim())) continue;
|
|
29287
|
+
seen.add(rule.trim());
|
|
29288
|
+
const made = entry(rule.trim());
|
|
29289
|
+
if (made !== void 0) entries2.push(made);
|
|
29290
|
+
}
|
|
29291
|
+
return entries2.slice(0, MOST);
|
|
29292
|
+
}
|
|
29293
|
+
function antigravityEntry(rule) {
|
|
29294
|
+
const parts = actionRule(rule);
|
|
29295
|
+
if (parts === void 0) return void 0;
|
|
29296
|
+
const name = clip(parts.action, LONGEST_NAME);
|
|
29297
|
+
const raw = clip(rule, LONGEST_RAW);
|
|
29298
|
+
switch (parts.action) {
|
|
29299
|
+
case "command":
|
|
29300
|
+
case "unsandboxed": {
|
|
29301
|
+
const words4 = parts.target?.startsWith("regex:") === true ? void 0 : bashWords(parts.target);
|
|
29302
|
+
return { kind: "command", name, ...words4 === void 0 ? {} : { words: words4 }, raw };
|
|
29303
|
+
}
|
|
29304
|
+
case "read_file":
|
|
29305
|
+
return { kind: "read", name, raw };
|
|
29306
|
+
case "write_file":
|
|
29307
|
+
return { kind: "write", name, raw };
|
|
29308
|
+
case "read_url":
|
|
29309
|
+
case "execute_url":
|
|
29310
|
+
return { kind: "web", name, raw };
|
|
29311
|
+
default:
|
|
29312
|
+
return { kind: "tool", name, raw };
|
|
29313
|
+
}
|
|
29314
|
+
}
|
|
29315
|
+
var ANTIGRAVITY_TOOL_PERMISSION = {
|
|
29316
|
+
strict: "Its tool permission is Strict: it asks before every command, whatever the mode.",
|
|
29317
|
+
"proceed-in-sandbox": "Its tool permission is Proceed in sandbox: it runs commands in its sandbox without asking, and asks before any outside it."
|
|
29318
|
+
};
|
|
29319
|
+
function antigravityOwnRules(options) {
|
|
29320
|
+
const home = options.home ?? homedir6();
|
|
29321
|
+
const read_from = ["the mode Chips starts each Antigravity session in", tilde(options.settingsPath, home)];
|
|
29322
|
+
const tool = options.settings?.["toolPermission"];
|
|
29323
|
+
const name = options.mode?.name ?? options.running;
|
|
29324
|
+
if (tool === "always-proceed" || options.mode?.everything === true) {
|
|
29325
|
+
const note2 = tool === "always-proceed" ? "Its tool permission is Always proceed: it approves every step without asking." : options.mode?.words;
|
|
29326
|
+
return { read_from, mode: name, everything: true, ...note2 === void 0 ? {} : { note: note2 }, runs: [] };
|
|
29327
|
+
}
|
|
29328
|
+
const permissions = options.settings?.["permissions"];
|
|
29329
|
+
const lists = isRecord2(permissions) ? permissions : {};
|
|
29330
|
+
const note = [options.mode?.words, typeof tool === "string" ? ANTIGRAVITY_TOOL_PERMISSION[tool] : void 0].filter((line) => line !== void 0).join(" ");
|
|
29331
|
+
return {
|
|
29332
|
+
read_from,
|
|
29333
|
+
mode: name,
|
|
29334
|
+
...note === "" ? {} : { note },
|
|
29335
|
+
runs: ruleList(lists["allow"], antigravityEntry),
|
|
29336
|
+
asks: ruleList(lists["ask"], antigravityEntry),
|
|
29337
|
+
refuses: ruleList(lists["deny"], antigravityEntry)
|
|
29338
|
+
};
|
|
29339
|
+
}
|
|
29340
|
+
function goosePermissionsOf(yaml) {
|
|
29341
|
+
const lists = { always_allow: [], ask_before: [], never_allow: [] };
|
|
29342
|
+
let section;
|
|
29343
|
+
let list;
|
|
29344
|
+
const unquoted = (text) => text.trim().replace(/^(['"])(.*)\1$/, "$2");
|
|
29345
|
+
for (const line of (yaml ?? "").split("\n")) {
|
|
29346
|
+
if (/^\s*(#.*)?$/.test(line)) continue;
|
|
29347
|
+
const top = /^([A-Za-z_][\w-]*):\s*(?:#.*)?$/.exec(line);
|
|
29348
|
+
if (top !== null) {
|
|
29349
|
+
section = top[1];
|
|
29350
|
+
list = void 0;
|
|
29351
|
+
continue;
|
|
29352
|
+
}
|
|
29353
|
+
if (section !== "user") continue;
|
|
29354
|
+
const key = /^\s+(always_allow|ask_before|never_allow):\s*(.*)$/.exec(line);
|
|
29355
|
+
if (key !== null) {
|
|
29356
|
+
list = key[1];
|
|
29357
|
+
const inline = /^\[(.*)\]\s*(?:#.*)?$/.exec(key[2]?.trim() ?? "");
|
|
29358
|
+
if (inline !== null) {
|
|
29359
|
+
for (const each of (inline[1] ?? "").split(",")) if (unquoted(each) !== "") lists[list].push(unquoted(each));
|
|
29360
|
+
list = void 0;
|
|
29361
|
+
}
|
|
29362
|
+
continue;
|
|
29363
|
+
}
|
|
29364
|
+
const item = /^\s*-\s*(.+?)\s*(?:#.*)?$/.exec(line);
|
|
29365
|
+
if (item !== null && list !== void 0 && unquoted(item[1] ?? "") !== "") lists[list].push(unquoted(item[1] ?? ""));
|
|
29366
|
+
}
|
|
29367
|
+
return lists;
|
|
29368
|
+
}
|
|
29369
|
+
function gooseEntry(tool) {
|
|
29370
|
+
const name = clip(tool, LONGEST_NAME);
|
|
29371
|
+
return /(^|__)shell$/.test(tool) ? { kind: "command", name, raw: name } : { kind: "tool", name, raw: name };
|
|
29372
|
+
}
|
|
29373
|
+
function gooseOwnRules(options) {
|
|
29374
|
+
const home = options.home ?? homedir6();
|
|
29375
|
+
const read_from = ["the mode Chips starts each Goose session in", tilde(options.permissionPath, home)];
|
|
29376
|
+
const name = options.mode?.name ?? options.running;
|
|
29377
|
+
const note = options.mode?.words;
|
|
29378
|
+
if (options.mode?.everything === true) return { read_from, mode: name, everything: true, ...note === void 0 ? {} : { note }, runs: [] };
|
|
29379
|
+
const lists = goosePermissionsOf(options.yaml);
|
|
29380
|
+
return {
|
|
29381
|
+
read_from,
|
|
29382
|
+
mode: name,
|
|
29383
|
+
...note === void 0 ? {} : { note },
|
|
29384
|
+
runs: once(lists.always_allow.map(gooseEntry)),
|
|
29385
|
+
asks: once(lists.ask_before.map(gooseEntry)),
|
|
29386
|
+
refuses: once(lists.never_allow.map(gooseEntry))
|
|
29387
|
+
};
|
|
29388
|
+
}
|
|
29389
|
+
function cursorEntry(rule) {
|
|
29390
|
+
const parts = actionRule(rule);
|
|
29391
|
+
if (parts === void 0) return void 0;
|
|
29392
|
+
const name = clip(parts.action, LONGEST_NAME);
|
|
29393
|
+
const raw = clip(rule, LONGEST_RAW);
|
|
29394
|
+
switch (parts.action) {
|
|
29395
|
+
case "Shell": {
|
|
29396
|
+
const words4 = bashWords(parts.target);
|
|
29397
|
+
return { kind: "command", name, ...words4 === void 0 ? {} : { words: words4 }, raw };
|
|
29398
|
+
}
|
|
29399
|
+
case "Read":
|
|
29400
|
+
return { kind: "read", name, raw };
|
|
29401
|
+
case "Write":
|
|
29402
|
+
return { kind: "write", name, raw };
|
|
29403
|
+
case "WebFetch":
|
|
29404
|
+
return { kind: "web", name, raw };
|
|
29405
|
+
default:
|
|
29406
|
+
return { kind: "tool", name, raw };
|
|
29407
|
+
}
|
|
29408
|
+
}
|
|
29409
|
+
var CURSOR_MODES = {
|
|
29410
|
+
allowlist: { name: "Allowlist", note: "Cursor runs what its allow list allows, and asks before the rest." },
|
|
29411
|
+
"auto-review": {
|
|
29412
|
+
name: "Auto-review",
|
|
29413
|
+
note: "Cursor runs what its allow list allows, runs other commands in its sandbox where it can, and its own check decides the rest."
|
|
29414
|
+
},
|
|
29415
|
+
unrestricted: { name: "Run everything", note: "Cursor runs every step without asking.", everything: true }
|
|
29416
|
+
};
|
|
29417
|
+
function cursorOwnRules(options) {
|
|
29418
|
+
const home = options.home ?? homedir6();
|
|
29419
|
+
const read_from = [tilde(options.configPath, home), ...options.folders.map((each) => tilde(each.path, home))].slice(0, MOST_PLACES);
|
|
29420
|
+
const said = options.config?.["approvalMode"];
|
|
29421
|
+
const mode = typeof said === "string" ? CURSOR_MODES[said] : void 0;
|
|
29422
|
+
if (mode?.everything === true) return { read_from, mode: mode.name, everything: true, note: mode.note, runs: [] };
|
|
29423
|
+
const layers = [...options.config === void 0 ? [] : [options.config], ...options.folders.map((each) => each.layer)];
|
|
29424
|
+
const listed = (key) => once(layers.flatMap((layer) => ruleList(isRecord2(layer["permissions"]) ? layer["permissions"][key] : void 0, cursorEntry)));
|
|
29425
|
+
return {
|
|
29426
|
+
read_from,
|
|
29427
|
+
mode: mode?.name ?? "Cursor's own",
|
|
29428
|
+
note: mode?.note ?? "Cursor asks as its own Run Mode says: Auto-review, Allowlist or Run everything.",
|
|
29429
|
+
runs: listed("allow"),
|
|
29430
|
+
refuses: listed("deny")
|
|
29431
|
+
};
|
|
29432
|
+
}
|
|
29219
29433
|
async function sendOwnRules(settings, copy) {
|
|
29220
29434
|
const send = settings?.ownRules;
|
|
29221
29435
|
if (typeof send !== "function") return false;
|
|
@@ -29409,6 +29623,13 @@ function compactionFacts(update) {
|
|
|
29409
29623
|
}
|
|
29410
29624
|
|
|
29411
29625
|
// src/bridge.ts
|
|
29626
|
+
function readText(path) {
|
|
29627
|
+
try {
|
|
29628
|
+
return readFileSync9(path, "utf8");
|
|
29629
|
+
} catch {
|
|
29630
|
+
return void 0;
|
|
29631
|
+
}
|
|
29632
|
+
}
|
|
29412
29633
|
var QUIET_MS = 1500;
|
|
29413
29634
|
var WAIT_FOR_AGENT_MS = 15e3;
|
|
29414
29635
|
var MOST_RESPAWN_MS = 6e4;
|
|
@@ -30448,6 +30669,12 @@ ${files.join("\n")}`;
|
|
|
30448
30669
|
await run2.fail({ error: `${room.record.name} refused.` });
|
|
30449
30670
|
return;
|
|
30450
30671
|
}
|
|
30672
|
+
const stopped2 = stoppedWith(this.options.kind, turn.reply);
|
|
30673
|
+
if (stopped2 !== void 0) {
|
|
30674
|
+
this.log(`${room.record.name} couldn't answer: ${stopped2}`);
|
|
30675
|
+
await run2.fail({ error: stopped2, retryable: true });
|
|
30676
|
+
return;
|
|
30677
|
+
}
|
|
30451
30678
|
const answer = instead ?? (turn.reply.trim() || (turn.said.at(-1) ?? ""));
|
|
30452
30679
|
const { change, note } = await this.sendProject(room, turn, answer);
|
|
30453
30680
|
const { chips: chips2 } = this.options;
|
|
@@ -30657,11 +30884,22 @@ ${files.join("\n")}`;
|
|
|
30657
30884
|
if (this.knownKind === void 0) {
|
|
30658
30885
|
const { kind: kind2 } = this.options;
|
|
30659
30886
|
const id2 = knownOf(kind2)?.id;
|
|
30660
|
-
if (id2 === "copilot") return copilotOwnRules(this.permissionsNow);
|
|
30887
|
+
if (id2 === "copilot") return copilotOwnRules(this.permissionsNow, this.copilotSaved());
|
|
30661
30888
|
if (id2 === "grok") return this.grokOwnRules();
|
|
30889
|
+
if (id2 === "cursor") return this.cursorOwnRules();
|
|
30662
30890
|
const running = this.runningMode();
|
|
30663
30891
|
if (id2 === void 0 || running === void 0 || modesOf(kind2).length === 0) return void 0;
|
|
30664
|
-
|
|
30892
|
+
const mode = modesOf(kind2).find((each) => each.id === running);
|
|
30893
|
+
const { home } = this.places;
|
|
30894
|
+
if (id2 === "antigravity") {
|
|
30895
|
+
const settingsPath = join10(home, ".gemini", "antigravity-cli", "settings.json");
|
|
30896
|
+
return antigravityOwnRules({ settingsPath, settings: readLayer(settingsPath), running, mode, home });
|
|
30897
|
+
}
|
|
30898
|
+
if (id2 === "goose") {
|
|
30899
|
+
const permissionPath = join10(this.gooseConfigDir(), "permission.yaml");
|
|
30900
|
+
return gooseOwnRules({ permissionPath, yaml: readText(permissionPath), running, mode, home });
|
|
30901
|
+
}
|
|
30902
|
+
return modeOwnRules(kind2.name, running, mode);
|
|
30665
30903
|
}
|
|
30666
30904
|
if (this.knownKind !== "claude-code") return void 0;
|
|
30667
30905
|
const userPath = join10(this.places.claudeHome, "settings.json");
|
|
@@ -30679,6 +30917,41 @@ ${files.join("\n")}`;
|
|
|
30679
30917
|
home: this.places.home
|
|
30680
30918
|
});
|
|
30681
30919
|
}
|
|
30920
|
+
/**
|
|
30921
|
+
* Copilot's: what it saved on disk, its yeses by folder in `permissions-config.json` and its URL
|
|
30922
|
+
* rules in `settings.json`, both in `COPILOT_HOME` (`~/.copilot`).
|
|
30923
|
+
*/
|
|
30924
|
+
copilotSaved() {
|
|
30925
|
+
const { home } = this.places;
|
|
30926
|
+
const root = this.env["COPILOT_HOME"] || join10(home, ".copilot");
|
|
30927
|
+
const configPath2 = join10(root, "permissions-config.json");
|
|
30928
|
+
const settingsPath = join10(root, "settings.json");
|
|
30929
|
+
return {
|
|
30930
|
+
configPath: configPath2,
|
|
30931
|
+
config: readLayer(configPath2) ?? readLayer(join10(root, "permissions-config")),
|
|
30932
|
+
settingsPath,
|
|
30933
|
+
settings: readLayer(settingsPath),
|
|
30934
|
+
folders: [...new Set(this.records().map((record2) => record2.folder))],
|
|
30935
|
+
home
|
|
30936
|
+
};
|
|
30937
|
+
}
|
|
30938
|
+
/** Cursor's: its own config, and each agent folder's `.cursor/cli.json`. */
|
|
30939
|
+
cursorOwnRules() {
|
|
30940
|
+
const { home } = this.places;
|
|
30941
|
+
const configPath2 = join10(home, ".cursor", "cli-config.json");
|
|
30942
|
+
const folders = [...new Set(this.records().map((record2) => record2.folder))].flatMap((folder2) => {
|
|
30943
|
+
const path = join10(folder2, ".cursor", "cli.json");
|
|
30944
|
+
const layer = readLayer(path);
|
|
30945
|
+
return layer === void 0 ? [] : [{ path, layer }];
|
|
30946
|
+
});
|
|
30947
|
+
return cursorOwnRules({ configPath: configPath2, config: readLayer(configPath2), folders, home });
|
|
30948
|
+
}
|
|
30949
|
+
/** Goose's config folder: `GOOSE_PATH_ROOT`'s, else `~/.config/goose` (or `XDG_CONFIG_HOME`'s). */
|
|
30950
|
+
gooseConfigDir() {
|
|
30951
|
+
const root = this.env["GOOSE_PATH_ROOT"];
|
|
30952
|
+
if (root) return join10(root, "config");
|
|
30953
|
+
return join10(this.env["XDG_CONFIG_HOME"] || join10(this.places.home, ".config"), "goose");
|
|
30954
|
+
}
|
|
30682
30955
|
/**
|
|
30683
30956
|
* Grok's: its own config, and the Claude Code settings it takes permission rules from: yours, in
|
|
30684
30957
|
* `~/.claude`, and each agent folder's `.claude`.
|
|
@@ -31241,7 +31514,10 @@ ${files.join("\n")}`;
|
|
|
31241
31514
|
const input2 = call["rawInput"];
|
|
31242
31515
|
const asked = turn.run.approval({
|
|
31243
31516
|
action: { kind: `acp.${slugOf(kind2)}`, input: input2 ?? {} },
|
|
31244
|
-
question: questionFor(title2, input2
|
|
31517
|
+
question: questionFor(title2, input2, {
|
|
31518
|
+
...typeof call["name"] === "string" ? { tool: call["name"] } : {},
|
|
31519
|
+
...typeof call["kind"] === "string" ? { kind: call["kind"] } : {}
|
|
31520
|
+
}),
|
|
31245
31521
|
lasts: "once",
|
|
31246
31522
|
risk: riskOf(kind2),
|
|
31247
31523
|
...input2 === void 0 ? {} : { preview: { format: "json", body: JSON.stringify(input2, null, 2).slice(0, 2e5) } },
|
|
@@ -31390,16 +31666,26 @@ function lowerFirst(text) {
|
|
|
31390
31666
|
return text.length === 0 ? text : `${text[0]?.toLowerCase() ?? ""}${text.slice(1)}`;
|
|
31391
31667
|
}
|
|
31392
31668
|
var QUESTION_MAX = 200;
|
|
31393
|
-
function questionFor(title2, input2) {
|
|
31669
|
+
function questionFor(title2, input2, call = {}) {
|
|
31394
31670
|
const fields = typeof input2 === "object" && input2 !== null ? input2 : {};
|
|
31395
|
-
const said = oneLine(fields["description"])?.replace(/[\s.?!:;,]+$/, "");
|
|
31396
|
-
|
|
31671
|
+
const said = (oneLine(fields["description"]) ?? oneLine(fields["toolSummary"]))?.replace(/[\s.?!:;,]+$/, "");
|
|
31672
|
+
const given = fields["command"] ?? fields["CommandLine"];
|
|
31673
|
+
const command = oneLine(Array.isArray(given) ? given.join(" ") : given);
|
|
31674
|
+
if (said === void 0 || said === "") return `Allow it to ${titleSaid(title2, command, call)}?`.slice(0, QUESTION_MAX);
|
|
31397
31675
|
const asked = `${clip2(said, QUESTION_MAX - 1)}?`;
|
|
31398
|
-
const command = oneLine(Array.isArray(fields["command"]) ? fields["command"].join(" ") : fields["command"]);
|
|
31399
31676
|
const room = QUESTION_MAX - asked.length - 3;
|
|
31400
31677
|
if (command === void 0 || command.includes("`") || room < 12) return asked;
|
|
31401
31678
|
return `${asked} \`${clip2(command, room)}\``;
|
|
31402
31679
|
}
|
|
31680
|
+
var FILE_VERBS = { read: "read", edit: "edit", delete: "delete", move: "move" };
|
|
31681
|
+
function titleSaid(title2, command, call) {
|
|
31682
|
+
const bare = title2.replace(/^`(.*)`$/s, "$1").trim();
|
|
31683
|
+
if (command !== void 0 && bare === command && !command.includes("`")) return `run \`${command}\``;
|
|
31684
|
+
const file3 = /^File\s+(\S.*)$/s.exec(title2);
|
|
31685
|
+
const verb = /^([a-z]+)_file$/.exec(call.tool ?? "")?.[1] ?? FILE_VERBS[call.kind ?? ""];
|
|
31686
|
+
if (file3 !== null && verb !== void 0) return `${verb} ${file3[1]}`;
|
|
31687
|
+
return lowerFirst(title2);
|
|
31688
|
+
}
|
|
31403
31689
|
function oneLine(value) {
|
|
31404
31690
|
const line = typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "";
|
|
31405
31691
|
return line === "" ? void 0 : line;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chipschat/acp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
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": {
|