@jpcasabiancai/cayenne 0.5.19 → 0.5.21
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 +74 -31
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -614,7 +614,9 @@ var init_flows = __esm({
|
|
|
614
614
|
FlowVisibility = z6.enum(["private", "workspace"]);
|
|
615
615
|
SESSION_OUTPUTS = ["sessionId", "branch", "prUrl", "resultText"];
|
|
616
616
|
later = { status: "later" };
|
|
617
|
-
session = {
|
|
617
|
+
session = {
|
|
618
|
+
optional: ["permission_mode", "model", "effort", "timeout_min", "autopilot"]
|
|
619
|
+
};
|
|
618
620
|
STEP_CATALOG = {
|
|
619
621
|
"trigger.clickup": entry(
|
|
620
622
|
"ClickUp task moved",
|
|
@@ -729,7 +731,8 @@ var init_flows = __esm({
|
|
|
729
731
|
"needs_setup",
|
|
730
732
|
"integration_not_owned",
|
|
731
733
|
"github_account_missing",
|
|
732
|
-
"runner_refused"
|
|
734
|
+
"runner_refused",
|
|
735
|
+
"plan_feature_autopilot"
|
|
733
736
|
]);
|
|
734
737
|
FlowProblem = z6.object({
|
|
735
738
|
stepId: z6.string().nullable(),
|
|
@@ -2601,6 +2604,13 @@ var init_runner = __esm({
|
|
|
2601
2604
|
* say. Optional so an older row parses.
|
|
2602
2605
|
*/
|
|
2603
2606
|
flowAuto: z23.boolean().optional().catch(void 0),
|
|
2607
|
+
/**
|
|
2608
|
+
* The runner's local config `allowAutoPilot`, reported by a build that applies an Auto Pilot
|
|
2609
|
+
* answer on a flow step (D89, protocol §2.13). The engine and `flow_start_session` require it
|
|
2610
|
+
* true before a step that sets `autopilot` starts. Absent on an older runner, which would refuse
|
|
2611
|
+
* every such answer. Optional so an older row parses.
|
|
2612
|
+
*/
|
|
2613
|
+
flowAutoPilot: z23.boolean().optional().catch(void 0),
|
|
2604
2614
|
/**
|
|
2605
2615
|
* The raw Ed25519 public key of the running process (32 bytes, unpadded base64url), which signs
|
|
2606
2616
|
* the local server's `hello` (protocol §6.2). New on every start, republished by every capabilities refresh that changes the row;
|
|
@@ -20167,7 +20177,7 @@ function inSecretDir(path) {
|
|
|
20167
20177
|
return SECRET_DIRS.has(p) || p === ".config" && CONFIG_SECRET_DIRS.has(next) || p === ".docker" && next === "config.json";
|
|
20168
20178
|
});
|
|
20169
20179
|
}
|
|
20170
|
-
function taskSecretDenyRules(protectedPaths2 = []) {
|
|
20180
|
+
function taskSecretDenyRules(protectedPaths2 = [], exemptPaths = []) {
|
|
20171
20181
|
const names = [
|
|
20172
20182
|
".env*",
|
|
20173
20183
|
".envrc",
|
|
@@ -20184,7 +20194,9 @@ function taskSecretDenyRules(protectedPaths2 = []) {
|
|
|
20184
20194
|
const dirs = [...SECRET_DIRS, ...[...CONFIG_SECRET_DIRS].map((d) => `.config/${d}`)].map(
|
|
20185
20195
|
(dir) => `Read(**/${dir}/**)`
|
|
20186
20196
|
);
|
|
20197
|
+
const holdsExempt = (p) => withReal(p).some((root) => exemptPaths.some((e) => within3(e, root)));
|
|
20187
20198
|
const absolute = protectedPaths2.flatMap((p) => {
|
|
20199
|
+
if (holdsExempt(p)) return [];
|
|
20188
20200
|
const abs = `/${p.replace(/^\/+/, "")}`;
|
|
20189
20201
|
return [`Read(/${abs})`, `Read(/${abs}/**)`];
|
|
20190
20202
|
});
|
|
@@ -20233,19 +20245,14 @@ function globTargetsSecrets(glob) {
|
|
|
20233
20245
|
return PROBES.some((p) => re.test(p)) && !CONTROLS.some((c) => re.test(c));
|
|
20234
20246
|
});
|
|
20235
20247
|
}
|
|
20236
|
-
function createSecretGuard(cwd, protectedPaths2 = [], mode = "task") {
|
|
20248
|
+
function createSecretGuard(cwd, protectedPaths2 = [], mode = "task", exemptPaths = []) {
|
|
20237
20249
|
const refusal = mode === "autopilot" ? AUTOPILOT_SECRET_REFUSAL : SECRET_READ_REFUSAL;
|
|
20238
20250
|
const home = homedir12();
|
|
20239
|
-
const protectedReal = protectedPaths2.flatMap(
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
return real === p ? [p] : [p, real];
|
|
20243
|
-
} catch {
|
|
20244
|
-
return [p];
|
|
20245
|
-
}
|
|
20246
|
-
});
|
|
20251
|
+
const protectedReal = protectedPaths2.flatMap(withReal);
|
|
20252
|
+
const exemptReal = exemptPaths.flatMap(withReal);
|
|
20253
|
+
const inProtected = (path) => protectedReal.some((root) => within3(path, root)) && !exemptReal.some((root) => within3(path, root));
|
|
20247
20254
|
const expand = (arg) => arg === "~" ? home : arg.startsWith("~/") ? resolve6(home, arg.slice(2)) : arg;
|
|
20248
|
-
const pathShaped = (path) => isSecretFileName(basename6(path)) || inSecretDir(path) ||
|
|
20255
|
+
const pathShaped = (path) => isSecretFileName(basename6(path)) || inSecretDir(path) || inProtected(path);
|
|
20249
20256
|
const argTargets = (raw) => {
|
|
20250
20257
|
if (GLOB_CHARS.test(raw))
|
|
20251
20258
|
return globTargetsSecrets(raw) || pathShaped(resolve6(cwd, expand(raw.replace(/[*?[{].*$/, ""))));
|
|
@@ -20274,7 +20281,7 @@ function createSecretGuard(cwd, protectedPaths2 = [], mode = "task") {
|
|
|
20274
20281
|
}
|
|
20275
20282
|
}
|
|
20276
20283
|
};
|
|
20277
|
-
const writesProtected = (raw) => writesWhere(raw,
|
|
20284
|
+
const writesProtected = (raw) => writesWhere(raw, inProtected);
|
|
20278
20285
|
const cwds = [cwd];
|
|
20279
20286
|
try {
|
|
20280
20287
|
const real = realpathSync21.native(cwd);
|
|
@@ -20324,7 +20331,7 @@ function createSecretGuard(cwd, protectedPaths2 = [], mode = "task") {
|
|
|
20324
20331
|
}
|
|
20325
20332
|
};
|
|
20326
20333
|
}
|
|
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;
|
|
20334
|
+
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
20335
|
var init_secret_files = __esm({
|
|
20329
20336
|
"src/sessions/secret-files.ts"() {
|
|
20330
20337
|
"use strict";
|
|
@@ -20362,6 +20369,14 @@ var init_secret_files = __esm({
|
|
|
20362
20369
|
];
|
|
20363
20370
|
CONTROLS = ["x.txt", "x.ts", "x.md", "readme", ".gitignore"];
|
|
20364
20371
|
GLOB_CHARS = /[*?[{]/;
|
|
20372
|
+
withReal = (p) => {
|
|
20373
|
+
try {
|
|
20374
|
+
const real = realpathSync21.native(p);
|
|
20375
|
+
return real === p ? [p] : [p, real];
|
|
20376
|
+
} catch {
|
|
20377
|
+
return [p];
|
|
20378
|
+
}
|
|
20379
|
+
};
|
|
20365
20380
|
within3 = (path, root) => {
|
|
20366
20381
|
const rel = relative17(root, path);
|
|
20367
20382
|
return rel === "" || rel !== ".." && !rel.startsWith(`..${sep18}`) && !isAbsolute24(rel);
|
|
@@ -20878,6 +20893,7 @@ var init_manager = __esm({
|
|
|
20878
20893
|
}
|
|
20879
20894
|
const { cwd, root, roots, record, repo } = place;
|
|
20880
20895
|
const guard = place.guard === "repository" && this.isTaskSession(sessionId) ? "repository+task" : place.guard;
|
|
20896
|
+
if (guard === "repository+task") this.assertTaskSessionMode(sessionId, p.permissionMode);
|
|
20881
20897
|
try {
|
|
20882
20898
|
this.assertNotRemoving(cwd);
|
|
20883
20899
|
} catch (err) {
|
|
@@ -21442,7 +21458,7 @@ var init_manager = __esm({
|
|
|
21442
21458
|
let decision = p.result;
|
|
21443
21459
|
let refusal = null;
|
|
21444
21460
|
try {
|
|
21445
|
-
this.assertAutopilotOrigin(sessionId, createdBy, origin);
|
|
21461
|
+
this.assertAutopilotOrigin(sessionId, createdBy, origin, true);
|
|
21446
21462
|
await this.assertAutopilotShellConfig(live, origin);
|
|
21447
21463
|
this.assertAutopilotLiveMode(live, origin);
|
|
21448
21464
|
if (decision.behavior === "allow") {
|
|
@@ -22313,29 +22329,44 @@ var init_manager = __esm({
|
|
|
22313
22329
|
readInsideDirs: toolResults
|
|
22314
22330
|
})
|
|
22315
22331
|
};
|
|
22316
|
-
return guard === "repository" ? repository : this.withTaskGuard(repository, cwd);
|
|
22332
|
+
return guard === "repository" ? repository : this.withTaskGuard(repository, cwd, permissionMode, sessionId);
|
|
22317
22333
|
}
|
|
22318
22334
|
const gitGuard = this.reachesManagedRoot(roots) ? createManagedGitGuard(this.deps.managedRoot, cwd) : null;
|
|
22319
22335
|
const policy = this.settingsPolicy(createdBy, cwd, permissionMode, this.deps.trustedRoots);
|
|
22320
22336
|
this.warnBypassWithoutUserGuards(createdBy, permissionMode, policy, sessionId);
|
|
22321
22337
|
const guarded = gitGuard ? { ...policy, toolGuard: gitGuard } : policy;
|
|
22322
|
-
return guard === "task" ? this.withTaskGuard(guarded, cwd) : guarded;
|
|
22338
|
+
return guard === "task" ? this.withTaskGuard(guarded, cwd, permissionMode, sessionId) : guarded;
|
|
22339
|
+
}
|
|
22340
|
+
/**
|
|
22341
|
+
* A repository chat's own checkout, which lies inside the runner's home and is not a protected
|
|
22342
|
+
* path. Its own worktree only: sibling worktrees and other clones stay protected.
|
|
22343
|
+
*/
|
|
22344
|
+
managedExempt(cwd) {
|
|
22345
|
+
return isAtOrBelow3(cwd, this.deps.managedRoot) ? [cwd] : [];
|
|
22323
22346
|
}
|
|
22324
22347
|
/** Protocol §2.8's task guard added to `policy`: asked before the guard it already has. */
|
|
22325
|
-
withTaskGuard(policy, cwd) {
|
|
22348
|
+
withTaskGuard(policy, cwd, permissionMode, sessionId) {
|
|
22326
22349
|
const permissions = policy.settings?.permissions;
|
|
22327
|
-
const
|
|
22350
|
+
const exempt = this.managedExempt(cwd);
|
|
22351
|
+
const secretGuard = createSecretGuard(cwd, this.deps.protectedPaths, "task", exempt);
|
|
22328
22352
|
return {
|
|
22329
22353
|
...policy,
|
|
22330
22354
|
settings: {
|
|
22331
22355
|
...policy.settings,
|
|
22332
22356
|
permissions: {
|
|
22333
22357
|
...permissions,
|
|
22334
|
-
deny: [
|
|
22358
|
+
deny: [
|
|
22359
|
+
...permissions?.deny ?? [],
|
|
22360
|
+
...taskSecretDenyRules(this.deps.protectedPaths, exempt)
|
|
22361
|
+
]
|
|
22335
22362
|
}
|
|
22336
22363
|
},
|
|
22337
22364
|
toolGuard: policy.toolGuard ? firstRefusal(secretGuard, policy.toolGuard) : secretGuard,
|
|
22338
|
-
|
|
22365
|
+
// A flow session this runner accepted in `auto` runs with nobody at the card, and the CLI
|
|
22366
|
+
// does raise a hook's `ask` in `auto` (probed live 2026-11-12): the step would wait out its
|
|
22367
|
+
// timeout. D79's amendment accepted the risk; the guard above still refuses. Asked again
|
|
22368
|
+
// here, so a start that missed its mode check still gets the card.
|
|
22369
|
+
...permissionMode === "auto" && sessionId !== void 0 && this.acceptedFlowAuto(sessionId) ? {} : { askTools: TASK_ASK_TOOLS }
|
|
22339
22370
|
};
|
|
22340
22371
|
}
|
|
22341
22372
|
/**
|
|
@@ -22395,15 +22426,19 @@ var init_manager = __esm({
|
|
|
22395
22426
|
* a record that cannot be read refuses.
|
|
22396
22427
|
*/
|
|
22397
22428
|
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
|
-
}
|
|
22429
|
+
if (mode === "auto" && this.acceptedFlowAuto(sessionId)) return;
|
|
22405
22430
|
assertTaskMode(mode);
|
|
22406
22431
|
}
|
|
22432
|
+
/** A flow session recorded as started in `auto`, while `allowFlowAuto` stands; unreadable is no. */
|
|
22433
|
+
acceptedFlowAuto(sessionId) {
|
|
22434
|
+
if (this.deps.allowFlowAuto !== true) return false;
|
|
22435
|
+
try {
|
|
22436
|
+
return this.flowAutoSessions().has(sessionId);
|
|
22437
|
+
} catch (err) {
|
|
22438
|
+
this.deps.log.warn({ err, sessionId }, "flow auto record unreadable; refusing auto");
|
|
22439
|
+
return false;
|
|
22440
|
+
}
|
|
22441
|
+
}
|
|
22407
22442
|
markTaskSession(sessionId) {
|
|
22408
22443
|
try {
|
|
22409
22444
|
this.taskSessions().mark(sessionId);
|
|
@@ -22625,9 +22660,10 @@ var init_manager = __esm({
|
|
|
22625
22660
|
* only where this machine's owner set `allowAutoPilot`. `created_by` on such a row is the session
|
|
22626
22661
|
* owner, so a missing one is not the runner owner and is refused like a member.
|
|
22627
22662
|
*/
|
|
22628
|
-
assertAutopilotOrigin(sessionId, createdBy, origin) {
|
|
22663
|
+
assertAutopilotOrigin(sessionId, createdBy, origin, answer2 = false) {
|
|
22629
22664
|
if (origin !== "autopilot") return;
|
|
22630
22665
|
if (this.isTaskSession(sessionId)) {
|
|
22666
|
+
if (answer2 && this.flows.has(sessionId) && this.deps.allowAutoPilot === true) return;
|
|
22631
22667
|
throw new Error("VALIDATION: a task session cannot run Auto Pilot");
|
|
22632
22668
|
}
|
|
22633
22669
|
if (createdBy !== this.deps.runnerUserId && this.deps.allowAutoPilot !== true) {
|
|
@@ -22666,7 +22702,12 @@ var init_manager = __esm({
|
|
|
22666
22702
|
* so a database blip does not bind a chat that never ran Auto Pilot.
|
|
22667
22703
|
*/
|
|
22668
22704
|
autopilotSecretGuard(sessionId, cwd, prior) {
|
|
22669
|
-
const secret = createSecretGuard(
|
|
22705
|
+
const secret = createSecretGuard(
|
|
22706
|
+
cwd,
|
|
22707
|
+
this.deps.protectedPaths,
|
|
22708
|
+
"autopilot",
|
|
22709
|
+
this.managedExempt(cwd)
|
|
22710
|
+
);
|
|
22670
22711
|
this.autopilotAskedAt.delete(sessionId);
|
|
22671
22712
|
const armed = async () => {
|
|
22672
22713
|
if (this.autopilotSessions().has(sessionId)) return true;
|
|
@@ -27675,6 +27716,8 @@ async function compose(cfg, lock, host, preflight) {
|
|
|
27675
27716
|
contextAssembly: true,
|
|
27676
27717
|
// D62, protocol §2.12: what the start RPC reads before a member's chat runs Auto Pilot here.
|
|
27677
27718
|
autoPilot: cfg.allowAutoPilot,
|
|
27719
|
+
// D89, protocol §2.13: this build takes an Auto Pilot answer on a running flow step.
|
|
27720
|
+
flowAutoPilot: cfg.allowAutoPilot,
|
|
27678
27721
|
// D79 amendment, protocol §2.13: shown by the automation builder; the manager still decides.
|
|
27679
27722
|
flowAuto: cfg.allowFlowAuto,
|
|
27680
27723
|
// D50: this build opens repository chats; present only when the value passes its schema.
|