gaslamp 2.2.0 → 2.2.1
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 +3 -1
- package/package.json +1 -1
- package/src/consult.mjs +12 -4
package/README.md
CHANGED
|
@@ -292,7 +292,9 @@ threads, `--schema`, fleets — with these differences:
|
|
|
292
292
|
writes, shell commands and URL fetches under its default `request-review`
|
|
293
293
|
preset; standing allow rules in its permission files would run
|
|
294
294
|
unprompted, so a read-only consult refuses to start when they grant more
|
|
295
|
-
than reads, read-only git and the end_session off-ramp,
|
|
295
|
+
than reads, read-only git and the end_session off-ramp, or set a lax
|
|
296
|
+
`toolPermission` or `agentMode: auto` (which approves writes and commands
|
|
297
|
+
under any preset, unreported), and fails if the
|
|
296
298
|
harness doesn't confirm the preset in its init event. Like claude's
|
|
297
299
|
read-only, that is read-capable rather than airtight: an allowed
|
|
298
300
|
`git diff` still accepts git's own `--output=<file>`.
|
package/package.json
CHANGED
package/src/consult.mjs
CHANGED
|
@@ -124,6 +124,10 @@ function backendEnv(backend) {
|
|
|
124
124
|
// presence refuses the consult rather than letting "read-only" mean less.
|
|
125
125
|
const AGY_READ_GRANT = /^(read_file|read_url)\(|^command\(git (diff|log|show|status)\)$|^mcp\(end-conversation\/(\*|end_session)\)$/;
|
|
126
126
|
const AGY_LAX_PRESETS = new Set(["always-proceed", "proceed-in-sandbox"]);
|
|
127
|
+
// agentMode "auto" approves file edits and commands itself: under it a print
|
|
128
|
+
// run wrote a file and ran `touch` while init still reported request-review
|
|
129
|
+
// (1.4.3), so the init check cannot see it. accept-edits is refused likewise.
|
|
130
|
+
const AGY_LAX_MODES = new Set(["auto", "accept-edits"]);
|
|
127
131
|
|
|
128
132
|
// Allow rules and the tool-permission preset from every file the CLI merges:
|
|
129
133
|
// its settings.json, the settings shared with the Antigravity app, and the
|
|
@@ -135,20 +139,21 @@ function agyPermissionState() {
|
|
|
135
139
|
for (const f of readdirSync(join(root, "config", "projects")))
|
|
136
140
|
if (f.endsWith(".json")) files.push(join(root, "config", "projects", f));
|
|
137
141
|
} catch {}
|
|
138
|
-
const grants = [], presets = [];
|
|
142
|
+
const grants = [], presets = [], modes = [];
|
|
139
143
|
const walk = (node, file) => {
|
|
140
144
|
if (Array.isArray(node)) return node.forEach((n) => walk(n, file));
|
|
141
145
|
if (!node || typeof node !== "object") return;
|
|
142
146
|
for (const [k, v] of Object.entries(node)) {
|
|
143
147
|
if (k === "allow" && Array.isArray(v)) for (const r of v) if (typeof r === "string") grants.push({ rule: r, file });
|
|
144
148
|
if (k === "toolPermission" && typeof v === "string") presets.push({ preset: v, file });
|
|
149
|
+
if (k === "agentMode" && typeof v === "string") modes.push({ mode: v, file });
|
|
145
150
|
walk(v, file);
|
|
146
151
|
}
|
|
147
152
|
};
|
|
148
153
|
for (const f of files) {
|
|
149
154
|
try { walk(JSON.parse(readFileSync(f, "utf8")), f); } catch {}
|
|
150
155
|
}
|
|
151
|
-
return { grants, presets };
|
|
156
|
+
return { grants, presets, modes };
|
|
152
157
|
}
|
|
153
158
|
|
|
154
159
|
// The consult preamble: the one piece of framing a consulted agent needs.
|
|
@@ -521,10 +526,13 @@ export function runConsult(backend, argv) {
|
|
|
521
526
|
if (backend === "gemini" && sandbox === "read-only") {
|
|
522
527
|
const state = agyPermissionState();
|
|
523
528
|
const lax = state.presets.filter((p) => AGY_LAX_PRESETS.has(p.preset));
|
|
529
|
+
const modes = state.modes.filter((m) => AGY_LAX_MODES.has(m.mode));
|
|
524
530
|
const open = state.grants.filter((g) => !AGY_READ_GRANT.test(g.rule));
|
|
525
|
-
if (lax.length || open.length)
|
|
531
|
+
if (lax.length || modes.length || open.length)
|
|
526
532
|
die(1, "Antigravity's settings would let a read-only consult act unprompted — " +
|
|
527
|
-
[...lax.map((p) => `toolPermission "${p.preset}" (${p.file})`),
|
|
533
|
+
[...lax.map((p) => `toolPermission "${p.preset}" (${p.file})`),
|
|
534
|
+
...modes.map((m) => `agentMode "${m.mode}" (${m.file})`),
|
|
535
|
+
...open.map((g) => `${g.rule} (${g.file})`)].join(", ") +
|
|
528
536
|
". Remove them, or pass --sandbox danger-full-access to consult without the guarantee.");
|
|
529
537
|
grants = state.grants.map((g) => g.rule);
|
|
530
538
|
}
|