@jpcasabiancai/cayenne 0.5.17 → 0.5.19
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 +66 -27
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -629,12 +629,12 @@ var init_flows = __esm({
|
|
|
629
629
|
"trigger.slack": entry("Slack message", "trigger", ["integration_id", "channel"], ["message"]),
|
|
630
630
|
"trigger.cron": entry("Schedule", "trigger", ["cron_expr", "tz"], ["firedAt"]),
|
|
631
631
|
"trigger.manual": entry("Run manually", "trigger", [], ["input"], { optional: ["input"] }),
|
|
632
|
-
skill: entry("Run skill", "runner", ["skill"
|
|
633
|
-
"claude.run": entry("Claude session", "runner", ["prompt"
|
|
632
|
+
skill: entry("Run skill", "runner", ["skill"], SESSION_OUTPUTS, session),
|
|
633
|
+
"claude.run": entry("Claude session", "runner", ["prompt"], SESSION_OUTPUTS, session),
|
|
634
634
|
"chat.create": entry(
|
|
635
635
|
"Create chat",
|
|
636
636
|
"runner",
|
|
637
|
-
["project", "prompt"
|
|
637
|
+
["project", "prompt"],
|
|
638
638
|
["chatId", "reply"],
|
|
639
639
|
session
|
|
640
640
|
),
|
|
@@ -1139,7 +1139,7 @@ var init_skills = __esm({
|
|
|
1139
1139
|
|
|
1140
1140
|
// ../../packages/shared/src/protocol/integrations.ts
|
|
1141
1141
|
import { z as z12 } from "zod";
|
|
1142
|
-
var INTEGRATION_PROVIDERS, AUTH_KINDS, IntegrationProviderSchema, AuthKindSchema, ProviderConfigPublic, ConnectStartRequest, ConnectStartResponse, ConnectCompleteRequest, DisconnectRequest, MessageResourceKind, ReplyRequest, ReplyResponse, ResourceList, SetSubscriptionsRequest, INBOX_ERROR_CODES, InboxErrorCode, CONVERSATION_KINDS, ConversationKind, MESSAGE_ATTACHMENTS_MAX, MessageAttachment, MessageAttachments, INBOX_CHANNELS, InboxChannel, INBOX_CATEGORIES, InboxCategory, ATTACHMENT_KINDS, AttachmentKind, INTEL_STATUSES, IntelStatus, Probability, IntelNeeds, IntelFlags, InboxIntel, MessageIntel, INTEGRATION_STATUSES, GithubAccountsResponse, SetGithubAccountRequest;
|
|
1142
|
+
var INTEGRATION_PROVIDERS, AUTH_KINDS, IntegrationProviderSchema, AuthKindSchema, ProviderConfigPublic, ConnectStartRequest, ConnectStartResponse, ConnectCompleteRequest, DisconnectRequest, MessageResourceKind, ReplyRequest, ReplyResponse, ResourceList, SetSubscriptionsRequest, INBOX_ERROR_CODES, InboxErrorCode, CONVERSATION_KINDS, ConversationKind, MESSAGE_ATTACHMENTS_MAX, MessageAttachment, MessageAttachments, INBOX_CHANNELS, InboxChannel, INBOX_CATEGORIES, InboxCategory, ATTACHMENT_KINDS, AttachmentKind, INTEL_STATUSES, IntelStatus, Probability, IntelNeeds, IntelFlags, GenStatus, InboxIntel, SavedSearches, MessageIntel, INTEGRATION_STATUSES, GithubAccountsResponse, SetGithubAccountRequest;
|
|
1143
1143
|
var init_integrations = __esm({
|
|
1144
1144
|
"../../packages/shared/src/protocol/integrations.ts"() {
|
|
1145
1145
|
"use strict";
|
|
@@ -1263,6 +1263,7 @@ var init_integrations = __esm({
|
|
|
1263
1263
|
contract: Probability.optional(),
|
|
1264
1264
|
security: Probability.optional()
|
|
1265
1265
|
});
|
|
1266
|
+
GenStatus = z12.enum(["none", "pending", "done", "failed", "skipped"]);
|
|
1266
1267
|
InboxIntel = z12.object({
|
|
1267
1268
|
status: IntelStatus,
|
|
1268
1269
|
importance: z12.number().min(0).max(3).nullable(),
|
|
@@ -1271,8 +1272,17 @@ var init_integrations = __esm({
|
|
|
1271
1272
|
flags: IntelFlags,
|
|
1272
1273
|
labels: z12.record(z12.string(), Probability),
|
|
1273
1274
|
/** The member's own call (0146): the message's, else its sender rule's; null leaves it to Jev. */
|
|
1274
|
-
importance_override: z12.boolean().nullable().optional()
|
|
1275
|
+
importance_override: z12.boolean().nullable().optional(),
|
|
1276
|
+
/** Generated text (0150, D88): untrusted, plain text only. Absent on rows read before 0150. */
|
|
1277
|
+
summary: z12.string().max(600).nullable().optional(),
|
|
1278
|
+
/** What the member needs to do; null when the message asks for nothing. */
|
|
1279
|
+
action: z12.string().max(200).nullable().optional(),
|
|
1280
|
+
/** The body's language, two lower-case letters. */
|
|
1281
|
+
lang: z12.string().regex(/^[a-z]{2}$/).nullable().optional(),
|
|
1282
|
+
due_on: z12.iso.date().nullable().optional(),
|
|
1283
|
+
gen_status: GenStatus.optional()
|
|
1275
1284
|
});
|
|
1285
|
+
SavedSearches = z12.array(z12.strictObject({ name: z12.string().min(1).max(40), q: z12.string().min(1).max(200) })).max(10);
|
|
1276
1286
|
MessageIntel = InboxIntel.extend({
|
|
1277
1287
|
message_id: z12.string(),
|
|
1278
1288
|
highlights: z12.array(z12.object({ source: z12.literal("body"), text: z12.string(), p: Probability })),
|
|
@@ -1281,7 +1291,10 @@ var init_integrations = __esm({
|
|
|
1281
1291
|
id: z12.string(),
|
|
1282
1292
|
kind: AttachmentKind.nullable(),
|
|
1283
1293
|
read: z12.boolean(),
|
|
1284
|
-
highlights: z12.array(z12.object({ text: z12.string(), p: Probability }))
|
|
1294
|
+
highlights: z12.array(z12.object({ text: z12.string(), p: Probability })),
|
|
1295
|
+
/** Generated (0150): what the file says, and up to six facts read from it. */
|
|
1296
|
+
summary: z12.string().max(200).nullable().optional(),
|
|
1297
|
+
fields: z12.array(z12.object({ label: z12.string().min(1).max(40), value: z12.string().max(120) })).max(6).nullable().optional()
|
|
1285
1298
|
})
|
|
1286
1299
|
),
|
|
1287
1300
|
error_code: z12.string().nullable(),
|
|
@@ -1496,9 +1509,7 @@ function refineFlow(p, flow, ctx) {
|
|
|
1496
1509
|
if (p.resumeProviderSessionId !== void 0 || p.forkSession === true) {
|
|
1497
1510
|
issue("a flow step starts a new session", "flow");
|
|
1498
1511
|
}
|
|
1499
|
-
if (p.task !== void 0
|
|
1500
|
-
issue("a flow session cannot be a task or repository chat", "flow");
|
|
1501
|
-
}
|
|
1512
|
+
if (p.task !== void 0) issue("a flow session cannot be a task chat", "flow");
|
|
1502
1513
|
if (!p.initialPrompt) issue("a flow session needs initialPrompt", "initialPrompt");
|
|
1503
1514
|
else if (flow.step === "skill" && !p.initialPrompt.startsWith("/")) {
|
|
1504
1515
|
issue("a skill step starts with its slash command", "initialPrompt");
|
|
@@ -1577,8 +1588,9 @@ var init_command = __esm({
|
|
|
1577
1588
|
// A repository chat (D50, protocol §2.9): `cwd` must be
|
|
1578
1589
|
// `managedClonePath(capabilities.repoClone.root, repository)`, and the runner clones or
|
|
1579
1590
|
// fetches the repository there and starts the provider in a worktree it names itself
|
|
1580
|
-
// (`repositoryWorktreeName`). A new session, never a task
|
|
1581
|
-
//
|
|
1591
|
+
// (`repositoryWorktreeName`). A new session, never a task; a flow step's session may be one
|
|
1592
|
+
// (D87). Sent only to a runner
|
|
1593
|
+
// that publishes `capabilities.repoClone`: an older one strips the field (the flow engine checks the same through `repositoryCwd`).
|
|
1582
1594
|
repository: RepositoryRef.optional(),
|
|
1583
1595
|
// A flow step's session (D79, protocol §2.13): honoured only on a row with
|
|
1584
1596
|
// `flow_run_step_id` set, else VALIDATION. The runner ends a `skill` or `claude.run` session
|
|
@@ -2530,6 +2542,12 @@ var init_runner = __esm({
|
|
|
2530
2542
|
* the step `RUNNER_OUTDATED` instead. Absent reads as false; optional so an older row parses.
|
|
2531
2543
|
*/
|
|
2532
2544
|
flows: z23.boolean().optional(),
|
|
2545
|
+
/**
|
|
2546
|
+
* Whether this runner accepts `flow` together with `repository` on `session.start` (D87). An
|
|
2547
|
+
* older runner refuses the payload at parse and reports nothing, so the engine fails the step
|
|
2548
|
+
* `RUNNER_OUTDATED` instead. Absent reads as false.
|
|
2549
|
+
*/
|
|
2550
|
+
flowRepositories: z23.boolean().optional(),
|
|
2533
2551
|
/**
|
|
2534
2552
|
* Whether this runner sends `session.prompt` attachments to the provider (D37, R31, protocol §9).
|
|
2535
2553
|
* An older runner parses `attachments` and ignores them, so a client offers images only when
|
|
@@ -8178,7 +8196,9 @@ function readFrontmatter(text5) {
|
|
|
8178
8196
|
if (block === void 0) return { ok: false };
|
|
8179
8197
|
const raw = {};
|
|
8180
8198
|
let list3 = null;
|
|
8181
|
-
|
|
8199
|
+
const lines = block.split(/\r?\n/);
|
|
8200
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8201
|
+
const line = lines[i] ?? "";
|
|
8182
8202
|
if (line.trim() === "" || line.trimStart().startsWith("#")) continue;
|
|
8183
8203
|
const item = ITEM2.exec(line);
|
|
8184
8204
|
if (item?.[1] !== void 0) {
|
|
@@ -8199,6 +8219,18 @@ function readFrontmatter(text5) {
|
|
|
8199
8219
|
continue;
|
|
8200
8220
|
}
|
|
8201
8221
|
list3 = null;
|
|
8222
|
+
const style = /^([>|])[-+]?$/.exec(rest)?.[1];
|
|
8223
|
+
if (style !== void 0) {
|
|
8224
|
+
const body = [];
|
|
8225
|
+
while (i + 1 < lines.length && /^([ \t]|$)/.test(lines[i + 1] ?? "")) {
|
|
8226
|
+
i++;
|
|
8227
|
+
body.push((lines[i] ?? "").trim());
|
|
8228
|
+
}
|
|
8229
|
+
const value2 = (style === "|" ? body.join("\n") : body.map((l) => l === "" ? "\n" : l).join(" ").replace(/ ?\n ?/g, "\n")).trim();
|
|
8230
|
+
if (value2 === "") return { ok: false };
|
|
8231
|
+
raw[key] = value2;
|
|
8232
|
+
continue;
|
|
8233
|
+
}
|
|
8202
8234
|
if (rest.startsWith("[")) {
|
|
8203
8235
|
if (!rest.endsWith("]")) return { ok: false };
|
|
8204
8236
|
const inner = rest.slice(1, -1).trim();
|
|
@@ -19630,9 +19662,7 @@ function assertFlowStart(p, stepId) {
|
|
|
19630
19662
|
if (p.resumeProviderSessionId !== void 0 || p.forkSession) {
|
|
19631
19663
|
throw new Error("VALIDATION: a flow step starts a new session");
|
|
19632
19664
|
}
|
|
19633
|
-
if (p.task !== void 0
|
|
19634
|
-
throw new Error("VALIDATION: a flow session cannot be a task or repository chat");
|
|
19635
|
-
}
|
|
19665
|
+
if (p.task !== void 0) throw new Error("VALIDATION: a flow session cannot be a task chat");
|
|
19636
19666
|
if (!p.initialPrompt) throw new Error("VALIDATION: a flow session needs initialPrompt");
|
|
19637
19667
|
}
|
|
19638
19668
|
function flowOutputFormat(outputs) {
|
|
@@ -20833,7 +20863,7 @@ var init_manager = __esm({
|
|
|
20833
20863
|
const forking = p.forkSession === true && p.resumeProviderSessionId !== void 0;
|
|
20834
20864
|
const mark = this.repoMark(sessionId);
|
|
20835
20865
|
const repositoryChat = p.repository !== void 0 || mark !== null;
|
|
20836
|
-
if (repositoryChat) this.assertRepositoryStart(sessionId, p, task);
|
|
20866
|
+
if (repositoryChat) this.assertRepositoryStart(sessionId, p, task, mark !== null);
|
|
20837
20867
|
const source = forking ? await this.readForkSource(p.resumeProviderSessionId) : null;
|
|
20838
20868
|
if (source?.data && this.repoMark(source.data.id) !== null) {
|
|
20839
20869
|
throw new Error(REPO_NO_DUPLICATE);
|
|
@@ -20846,7 +20876,8 @@ var init_manager = __esm({
|
|
|
20846
20876
|
} else {
|
|
20847
20877
|
place = await this.placeDirectoryChat(sessionId, p, createdBy, provider, task, source);
|
|
20848
20878
|
}
|
|
20849
|
-
const { cwd, root, roots, record,
|
|
20879
|
+
const { cwd, root, roots, record, repo } = place;
|
|
20880
|
+
const guard = place.guard === "repository" && this.isTaskSession(sessionId) ? "repository+task" : place.guard;
|
|
20850
20881
|
try {
|
|
20851
20882
|
this.assertNotRemoving(cwd);
|
|
20852
20883
|
} catch (err) {
|
|
@@ -20901,7 +20932,7 @@ var init_manager = __esm({
|
|
|
20901
20932
|
} : {}
|
|
20902
20933
|
}
|
|
20903
20934
|
},
|
|
20904
|
-
{ roots, task: guard === "task", repo }
|
|
20935
|
+
{ roots, task: guard === "task" || guard === "repository+task", repo }
|
|
20905
20936
|
);
|
|
20906
20937
|
} catch (err) {
|
|
20907
20938
|
this.discardSkills(sessionId);
|
|
@@ -21176,15 +21207,17 @@ var init_manager = __esm({
|
|
|
21176
21207
|
/**
|
|
21177
21208
|
* The schema's `repository` refinements (§2.9), held by the runner too and applied to a marked
|
|
21178
21209
|
* id whatever its start carries: a repository chat is a new session in the worktree the
|
|
21179
|
-
* runner names, never a task session. A fork naming a marked id is a duplicate.
|
|
21210
|
+
* runner names, never a task session. A fork naming a marked id is a duplicate. A task-marked id
|
|
21211
|
+
* is a repository chat only through a flow step (D87): its first start carries `flow`, and
|
|
21212
|
+
* `marked` says a later one is that same chat.
|
|
21180
21213
|
*/
|
|
21181
|
-
assertRepositoryStart(sessionId, p, task) {
|
|
21214
|
+
assertRepositoryStart(sessionId, p, task, marked) {
|
|
21182
21215
|
if (p.worktree) throw new Error("VALIDATION: a repository chat gets its own worktree");
|
|
21183
21216
|
if (p.forkSession === true && p.repository === void 0) throw new Error(REPO_NO_DUPLICATE);
|
|
21184
21217
|
if (p.repository !== void 0 && (p.forkSession === true || p.resumeProviderSessionId !== void 0)) {
|
|
21185
21218
|
throw new Error("VALIDATION: a repository chat starts a new session");
|
|
21186
21219
|
}
|
|
21187
|
-
if (task !== void 0 || this.isTaskSession(sessionId)) {
|
|
21220
|
+
if (task !== void 0 || !p.flow && !marked && this.isTaskSession(sessionId)) {
|
|
21188
21221
|
throw new Error("VALIDATION: a task session cannot be a repository chat");
|
|
21189
21222
|
}
|
|
21190
21223
|
}
|
|
@@ -22255,7 +22288,7 @@ var init_manager = __esm({
|
|
|
22255
22288
|
* gets both guards, the secret-file one asked first.
|
|
22256
22289
|
*/
|
|
22257
22290
|
claudePolicy(createdBy, cwd, permissionMode, guard, roots, skills = {}, sessionId) {
|
|
22258
|
-
if (guard === "repository") {
|
|
22291
|
+
if (guard === "repository" || guard === "repository+task") {
|
|
22259
22292
|
const readDirs = (skills.plugins ?? []).map((plugin) => plugin.path);
|
|
22260
22293
|
if (sessionId !== void 0)
|
|
22261
22294
|
readDirs.push(
|
|
@@ -22270,7 +22303,7 @@ var init_manager = __esm({
|
|
|
22270
22303
|
};
|
|
22271
22304
|
const policy2 = this.settingsPolicy(createdBy, cwd, permissionMode, []);
|
|
22272
22305
|
this.warnBypassWithoutUserGuards(createdBy, permissionMode, policy2, sessionId);
|
|
22273
|
-
|
|
22306
|
+
const repository = {
|
|
22274
22307
|
...policy2,
|
|
22275
22308
|
// Plan mode writes its plan file inside the worktree, where the bound lets it; the daemon
|
|
22276
22309
|
// keeps the directory out of git status (`info/exclude`, `managed.ts`).
|
|
@@ -22280,11 +22313,16 @@ var init_manager = __esm({
|
|
|
22280
22313
|
readInsideDirs: toolResults
|
|
22281
22314
|
})
|
|
22282
22315
|
};
|
|
22316
|
+
return guard === "repository" ? repository : this.withTaskGuard(repository, cwd);
|
|
22283
22317
|
}
|
|
22284
22318
|
const gitGuard = this.reachesManagedRoot(roots) ? createManagedGitGuard(this.deps.managedRoot, cwd) : null;
|
|
22285
22319
|
const policy = this.settingsPolicy(createdBy, cwd, permissionMode, this.deps.trustedRoots);
|
|
22286
22320
|
this.warnBypassWithoutUserGuards(createdBy, permissionMode, policy, sessionId);
|
|
22287
|
-
|
|
22321
|
+
const guarded = gitGuard ? { ...policy, toolGuard: gitGuard } : policy;
|
|
22322
|
+
return guard === "task" ? this.withTaskGuard(guarded, cwd) : guarded;
|
|
22323
|
+
}
|
|
22324
|
+
/** Protocol §2.8's task guard added to `policy`: asked before the guard it already has. */
|
|
22325
|
+
withTaskGuard(policy, cwd) {
|
|
22288
22326
|
const permissions = policy.settings?.permissions;
|
|
22289
22327
|
const secretGuard = createSecretGuard(cwd, this.deps.protectedPaths);
|
|
22290
22328
|
return {
|
|
@@ -22296,7 +22334,7 @@ var init_manager = __esm({
|
|
|
22296
22334
|
deny: [...permissions?.deny ?? [], ...taskSecretDenyRules(this.deps.protectedPaths)]
|
|
22297
22335
|
}
|
|
22298
22336
|
},
|
|
22299
|
-
toolGuard:
|
|
22337
|
+
toolGuard: policy.toolGuard ? firstRefusal(secretGuard, policy.toolGuard) : secretGuard,
|
|
22300
22338
|
askTools: TASK_ASK_TOOLS
|
|
22301
22339
|
};
|
|
22302
22340
|
}
|
|
@@ -23014,7 +23052,6 @@ var init_manager = __esm({
|
|
|
23014
23052
|
let roots;
|
|
23015
23053
|
let repo = null;
|
|
23016
23054
|
if (mark !== null) {
|
|
23017
|
-
if (guarded) throw new Error("VALIDATION: a task session cannot be a repository chat");
|
|
23018
23055
|
const recorded = await this.recordedRepoWorktree(sessionId, mark);
|
|
23019
23056
|
cwd = recorded.real;
|
|
23020
23057
|
roots = [cwd];
|
|
@@ -23039,7 +23076,7 @@ var init_manager = __esm({
|
|
|
23039
23076
|
const started = this.markStarting(cwd, sessionId);
|
|
23040
23077
|
try {
|
|
23041
23078
|
const skills = provider === "claude" ? await this.materialise(sessionId, cwd, data.owner_id ?? null) : {};
|
|
23042
|
-
const guard = repo ? "repository" : guarded ? "task" : null;
|
|
23079
|
+
const guard = repo ? guarded ? "repository+task" : "repository" : guarded ? "task" : null;
|
|
23043
23080
|
const resumed = await this.spawn(
|
|
23044
23081
|
sessionId,
|
|
23045
23082
|
provider,
|
|
@@ -27626,6 +27663,8 @@ async function compose(cfg, lock, host, preflight) {
|
|
|
27626
27663
|
taskStart: true,
|
|
27627
27664
|
// D79, protocol §2.13: this build enforces `session.start.flow` and reports the step.
|
|
27628
27665
|
flows: true,
|
|
27666
|
+
// D87: this build accepts `flow` with `repository` on `session.start`.
|
|
27667
|
+
flowRepositories: true,
|
|
27629
27668
|
// D40: this build mirrors what a session writes under `.cayenne/docs`, so the Documents tab
|
|
27630
27669
|
// can say "this runner does not publish documents" about an older one instead of "none yet".
|
|
27631
27670
|
// Nothing else is composed here: the mirror is one service per live session, built by the
|