@jpcasabiancai/cayenne 0.5.19 → 0.5.20
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/dist/cli.js +57 -27
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -20167,7 +20167,7 @@ function inSecretDir(path) {
|
|
|
20167
20167
|
return SECRET_DIRS.has(p) || p === ".config" && CONFIG_SECRET_DIRS.has(next) || p === ".docker" && next === "config.json";
|
|
20168
20168
|
});
|
|
20169
20169
|
}
|
|
20170
|
-
function taskSecretDenyRules(protectedPaths2 = []) {
|
|
20170
|
+
function taskSecretDenyRules(protectedPaths2 = [], exemptPaths = []) {
|
|
20171
20171
|
const names = [
|
|
20172
20172
|
".env*",
|
|
20173
20173
|
".envrc",
|
|
@@ -20184,7 +20184,9 @@ function taskSecretDenyRules(protectedPaths2 = []) {
|
|
|
20184
20184
|
const dirs = [...SECRET_DIRS, ...[...CONFIG_SECRET_DIRS].map((d) => `.config/${d}`)].map(
|
|
20185
20185
|
(dir) => `Read(**/${dir}/**)`
|
|
20186
20186
|
);
|
|
20187
|
+
const holdsExempt = (p) => withReal(p).some((root) => exemptPaths.some((e) => within3(e, root)));
|
|
20187
20188
|
const absolute = protectedPaths2.flatMap((p) => {
|
|
20189
|
+
if (holdsExempt(p)) return [];
|
|
20188
20190
|
const abs = `/${p.replace(/^\/+/, "")}`;
|
|
20189
20191
|
return [`Read(/${abs})`, `Read(/${abs}/**)`];
|
|
20190
20192
|
});
|
|
@@ -20233,19 +20235,14 @@ function globTargetsSecrets(glob) {
|
|
|
20233
20235
|
return PROBES.some((p) => re.test(p)) && !CONTROLS.some((c) => re.test(c));
|
|
20234
20236
|
});
|
|
20235
20237
|
}
|
|
20236
|
-
function createSecretGuard(cwd, protectedPaths2 = [], mode = "task") {
|
|
20238
|
+
function createSecretGuard(cwd, protectedPaths2 = [], mode = "task", exemptPaths = []) {
|
|
20237
20239
|
const refusal = mode === "autopilot" ? AUTOPILOT_SECRET_REFUSAL : SECRET_READ_REFUSAL;
|
|
20238
20240
|
const home = homedir12();
|
|
20239
|
-
const protectedReal = protectedPaths2.flatMap(
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
return real === p ? [p] : [p, real];
|
|
20243
|
-
} catch {
|
|
20244
|
-
return [p];
|
|
20245
|
-
}
|
|
20246
|
-
});
|
|
20241
|
+
const protectedReal = protectedPaths2.flatMap(withReal);
|
|
20242
|
+
const exemptReal = exemptPaths.flatMap(withReal);
|
|
20243
|
+
const inProtected = (path) => protectedReal.some((root) => within3(path, root)) && !exemptReal.some((root) => within3(path, root));
|
|
20247
20244
|
const expand = (arg) => arg === "~" ? home : arg.startsWith("~/") ? resolve6(home, arg.slice(2)) : arg;
|
|
20248
|
-
const pathShaped = (path) => isSecretFileName(basename6(path)) || inSecretDir(path) ||
|
|
20245
|
+
const pathShaped = (path) => isSecretFileName(basename6(path)) || inSecretDir(path) || inProtected(path);
|
|
20249
20246
|
const argTargets = (raw) => {
|
|
20250
20247
|
if (GLOB_CHARS.test(raw))
|
|
20251
20248
|
return globTargetsSecrets(raw) || pathShaped(resolve6(cwd, expand(raw.replace(/[*?[{].*$/, ""))));
|
|
@@ -20274,7 +20271,7 @@ function createSecretGuard(cwd, protectedPaths2 = [], mode = "task") {
|
|
|
20274
20271
|
}
|
|
20275
20272
|
}
|
|
20276
20273
|
};
|
|
20277
|
-
const writesProtected = (raw) => writesWhere(raw,
|
|
20274
|
+
const writesProtected = (raw) => writesWhere(raw, inProtected);
|
|
20278
20275
|
const cwds = [cwd];
|
|
20279
20276
|
try {
|
|
20280
20277
|
const real = realpathSync21.native(cwd);
|
|
@@ -20324,7 +20321,7 @@ function createSecretGuard(cwd, protectedPaths2 = [], mode = "task") {
|
|
|
20324
20321
|
}
|
|
20325
20322
|
};
|
|
20326
20323
|
}
|
|
20327
|
-
var SECRET_NAMES, SECRET_EXTENSIONS, SSH_KEY, SECRET_DIRS, CONFIG_SECRET_DIRS, SECRET_LIST, SECRET_READ_REFUSAL, CONFIG_WRITE_REFUSAL, AUTOPILOT_SECRET_REFUSAL, PROBES, CONTROLS, GLOB_CHARS, within3, PATH_KEYS2, WRITE_KEYS, GLOB_KEYS, globWords, shellWords;
|
|
20324
|
+
var SECRET_NAMES, SECRET_EXTENSIONS, SSH_KEY, SECRET_DIRS, CONFIG_SECRET_DIRS, SECRET_LIST, SECRET_READ_REFUSAL, CONFIG_WRITE_REFUSAL, AUTOPILOT_SECRET_REFUSAL, PROBES, CONTROLS, GLOB_CHARS, withReal, within3, PATH_KEYS2, WRITE_KEYS, GLOB_KEYS, globWords, shellWords;
|
|
20328
20325
|
var init_secret_files = __esm({
|
|
20329
20326
|
"src/sessions/secret-files.ts"() {
|
|
20330
20327
|
"use strict";
|
|
@@ -20362,6 +20359,14 @@ var init_secret_files = __esm({
|
|
|
20362
20359
|
];
|
|
20363
20360
|
CONTROLS = ["x.txt", "x.ts", "x.md", "readme", ".gitignore"];
|
|
20364
20361
|
GLOB_CHARS = /[*?[{]/;
|
|
20362
|
+
withReal = (p) => {
|
|
20363
|
+
try {
|
|
20364
|
+
const real = realpathSync21.native(p);
|
|
20365
|
+
return real === p ? [p] : [p, real];
|
|
20366
|
+
} catch {
|
|
20367
|
+
return [p];
|
|
20368
|
+
}
|
|
20369
|
+
};
|
|
20365
20370
|
within3 = (path, root) => {
|
|
20366
20371
|
const rel = relative17(root, path);
|
|
20367
20372
|
return rel === "" || rel !== ".." && !rel.startsWith(`..${sep18}`) && !isAbsolute24(rel);
|
|
@@ -20878,6 +20883,7 @@ var init_manager = __esm({
|
|
|
20878
20883
|
}
|
|
20879
20884
|
const { cwd, root, roots, record, repo } = place;
|
|
20880
20885
|
const guard = place.guard === "repository" && this.isTaskSession(sessionId) ? "repository+task" : place.guard;
|
|
20886
|
+
if (guard === "repository+task") this.assertTaskSessionMode(sessionId, p.permissionMode);
|
|
20881
20887
|
try {
|
|
20882
20888
|
this.assertNotRemoving(cwd);
|
|
20883
20889
|
} catch (err) {
|
|
@@ -22313,29 +22319,44 @@ var init_manager = __esm({
|
|
|
22313
22319
|
readInsideDirs: toolResults
|
|
22314
22320
|
})
|
|
22315
22321
|
};
|
|
22316
|
-
return guard === "repository" ? repository : this.withTaskGuard(repository, cwd);
|
|
22322
|
+
return guard === "repository" ? repository : this.withTaskGuard(repository, cwd, permissionMode, sessionId);
|
|
22317
22323
|
}
|
|
22318
22324
|
const gitGuard = this.reachesManagedRoot(roots) ? createManagedGitGuard(this.deps.managedRoot, cwd) : null;
|
|
22319
22325
|
const policy = this.settingsPolicy(createdBy, cwd, permissionMode, this.deps.trustedRoots);
|
|
22320
22326
|
this.warnBypassWithoutUserGuards(createdBy, permissionMode, policy, sessionId);
|
|
22321
22327
|
const guarded = gitGuard ? { ...policy, toolGuard: gitGuard } : policy;
|
|
22322
|
-
return guard === "task" ? this.withTaskGuard(guarded, cwd) : guarded;
|
|
22328
|
+
return guard === "task" ? this.withTaskGuard(guarded, cwd, permissionMode, sessionId) : guarded;
|
|
22329
|
+
}
|
|
22330
|
+
/**
|
|
22331
|
+
* A repository chat's own checkout, which lies inside the runner's home and is not a protected
|
|
22332
|
+
* path. Its own worktree only: sibling worktrees and other clones stay protected.
|
|
22333
|
+
*/
|
|
22334
|
+
managedExempt(cwd) {
|
|
22335
|
+
return isAtOrBelow3(cwd, this.deps.managedRoot) ? [cwd] : [];
|
|
22323
22336
|
}
|
|
22324
22337
|
/** Protocol §2.8's task guard added to `policy`: asked before the guard it already has. */
|
|
22325
|
-
withTaskGuard(policy, cwd) {
|
|
22338
|
+
withTaskGuard(policy, cwd, permissionMode, sessionId) {
|
|
22326
22339
|
const permissions = policy.settings?.permissions;
|
|
22327
|
-
const
|
|
22340
|
+
const exempt = this.managedExempt(cwd);
|
|
22341
|
+
const secretGuard = createSecretGuard(cwd, this.deps.protectedPaths, "task", exempt);
|
|
22328
22342
|
return {
|
|
22329
22343
|
...policy,
|
|
22330
22344
|
settings: {
|
|
22331
22345
|
...policy.settings,
|
|
22332
22346
|
permissions: {
|
|
22333
22347
|
...permissions,
|
|
22334
|
-
deny: [
|
|
22348
|
+
deny: [
|
|
22349
|
+
...permissions?.deny ?? [],
|
|
22350
|
+
...taskSecretDenyRules(this.deps.protectedPaths, exempt)
|
|
22351
|
+
]
|
|
22335
22352
|
}
|
|
22336
22353
|
},
|
|
22337
22354
|
toolGuard: policy.toolGuard ? firstRefusal(secretGuard, policy.toolGuard) : secretGuard,
|
|
22338
|
-
|
|
22355
|
+
// A flow session this runner accepted in `auto` runs with nobody at the card, and the CLI
|
|
22356
|
+
// does raise a hook's `ask` in `auto` (probed live 2026-11-12): the step would wait out its
|
|
22357
|
+
// timeout. D79's amendment accepted the risk; the guard above still refuses. Asked again
|
|
22358
|
+
// here, so a start that missed its mode check still gets the card.
|
|
22359
|
+
...permissionMode === "auto" && sessionId !== void 0 && this.acceptedFlowAuto(sessionId) ? {} : { askTools: TASK_ASK_TOOLS }
|
|
22339
22360
|
};
|
|
22340
22361
|
}
|
|
22341
22362
|
/**
|
|
@@ -22395,15 +22416,19 @@ var init_manager = __esm({
|
|
|
22395
22416
|
* a record that cannot be read refuses.
|
|
22396
22417
|
*/
|
|
22397
22418
|
assertTaskSessionMode(sessionId, mode) {
|
|
22398
|
-
if (mode === "auto" && this.
|
|
22399
|
-
try {
|
|
22400
|
-
if (this.flowAutoSessions().has(sessionId)) return;
|
|
22401
|
-
} catch (err) {
|
|
22402
|
-
this.deps.log.warn({ err, sessionId }, "flow auto record unreadable; refusing auto");
|
|
22403
|
-
}
|
|
22404
|
-
}
|
|
22419
|
+
if (mode === "auto" && this.acceptedFlowAuto(sessionId)) return;
|
|
22405
22420
|
assertTaskMode(mode);
|
|
22406
22421
|
}
|
|
22422
|
+
/** A flow session recorded as started in `auto`, while `allowFlowAuto` stands; unreadable is no. */
|
|
22423
|
+
acceptedFlowAuto(sessionId) {
|
|
22424
|
+
if (this.deps.allowFlowAuto !== true) return false;
|
|
22425
|
+
try {
|
|
22426
|
+
return this.flowAutoSessions().has(sessionId);
|
|
22427
|
+
} catch (err) {
|
|
22428
|
+
this.deps.log.warn({ err, sessionId }, "flow auto record unreadable; refusing auto");
|
|
22429
|
+
return false;
|
|
22430
|
+
}
|
|
22431
|
+
}
|
|
22407
22432
|
markTaskSession(sessionId) {
|
|
22408
22433
|
try {
|
|
22409
22434
|
this.taskSessions().mark(sessionId);
|
|
@@ -22666,7 +22691,12 @@ var init_manager = __esm({
|
|
|
22666
22691
|
* so a database blip does not bind a chat that never ran Auto Pilot.
|
|
22667
22692
|
*/
|
|
22668
22693
|
autopilotSecretGuard(sessionId, cwd, prior) {
|
|
22669
|
-
const secret = createSecretGuard(
|
|
22694
|
+
const secret = createSecretGuard(
|
|
22695
|
+
cwd,
|
|
22696
|
+
this.deps.protectedPaths,
|
|
22697
|
+
"autopilot",
|
|
22698
|
+
this.managedExempt(cwd)
|
|
22699
|
+
);
|
|
22670
22700
|
this.autopilotAskedAt.delete(sessionId);
|
|
22671
22701
|
const armed = async () => {
|
|
22672
22702
|
if (this.autopilotSessions().has(sessionId)) return true;
|