@jpcasabiancai/cayenne 0.5.17 → 0.5.18
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 +51 -26
- 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
|
|
@@ -19630,9 +19648,7 @@ function assertFlowStart(p, stepId) {
|
|
|
19630
19648
|
if (p.resumeProviderSessionId !== void 0 || p.forkSession) {
|
|
19631
19649
|
throw new Error("VALIDATION: a flow step starts a new session");
|
|
19632
19650
|
}
|
|
19633
|
-
if (p.task !== void 0
|
|
19634
|
-
throw new Error("VALIDATION: a flow session cannot be a task or repository chat");
|
|
19635
|
-
}
|
|
19651
|
+
if (p.task !== void 0) throw new Error("VALIDATION: a flow session cannot be a task chat");
|
|
19636
19652
|
if (!p.initialPrompt) throw new Error("VALIDATION: a flow session needs initialPrompt");
|
|
19637
19653
|
}
|
|
19638
19654
|
function flowOutputFormat(outputs) {
|
|
@@ -20833,7 +20849,7 @@ var init_manager = __esm({
|
|
|
20833
20849
|
const forking = p.forkSession === true && p.resumeProviderSessionId !== void 0;
|
|
20834
20850
|
const mark = this.repoMark(sessionId);
|
|
20835
20851
|
const repositoryChat = p.repository !== void 0 || mark !== null;
|
|
20836
|
-
if (repositoryChat) this.assertRepositoryStart(sessionId, p, task);
|
|
20852
|
+
if (repositoryChat) this.assertRepositoryStart(sessionId, p, task, mark !== null);
|
|
20837
20853
|
const source = forking ? await this.readForkSource(p.resumeProviderSessionId) : null;
|
|
20838
20854
|
if (source?.data && this.repoMark(source.data.id) !== null) {
|
|
20839
20855
|
throw new Error(REPO_NO_DUPLICATE);
|
|
@@ -20846,7 +20862,8 @@ var init_manager = __esm({
|
|
|
20846
20862
|
} else {
|
|
20847
20863
|
place = await this.placeDirectoryChat(sessionId, p, createdBy, provider, task, source);
|
|
20848
20864
|
}
|
|
20849
|
-
const { cwd, root, roots, record,
|
|
20865
|
+
const { cwd, root, roots, record, repo } = place;
|
|
20866
|
+
const guard = place.guard === "repository" && this.isTaskSession(sessionId) ? "repository+task" : place.guard;
|
|
20850
20867
|
try {
|
|
20851
20868
|
this.assertNotRemoving(cwd);
|
|
20852
20869
|
} catch (err) {
|
|
@@ -20901,7 +20918,7 @@ var init_manager = __esm({
|
|
|
20901
20918
|
} : {}
|
|
20902
20919
|
}
|
|
20903
20920
|
},
|
|
20904
|
-
{ roots, task: guard === "task", repo }
|
|
20921
|
+
{ roots, task: guard === "task" || guard === "repository+task", repo }
|
|
20905
20922
|
);
|
|
20906
20923
|
} catch (err) {
|
|
20907
20924
|
this.discardSkills(sessionId);
|
|
@@ -21176,15 +21193,17 @@ var init_manager = __esm({
|
|
|
21176
21193
|
/**
|
|
21177
21194
|
* The schema's `repository` refinements (§2.9), held by the runner too and applied to a marked
|
|
21178
21195
|
* 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.
|
|
21196
|
+
* runner names, never a task session. A fork naming a marked id is a duplicate. A task-marked id
|
|
21197
|
+
* is a repository chat only through a flow step (D87): its first start carries `flow`, and
|
|
21198
|
+
* `marked` says a later one is that same chat.
|
|
21180
21199
|
*/
|
|
21181
|
-
assertRepositoryStart(sessionId, p, task) {
|
|
21200
|
+
assertRepositoryStart(sessionId, p, task, marked) {
|
|
21182
21201
|
if (p.worktree) throw new Error("VALIDATION: a repository chat gets its own worktree");
|
|
21183
21202
|
if (p.forkSession === true && p.repository === void 0) throw new Error(REPO_NO_DUPLICATE);
|
|
21184
21203
|
if (p.repository !== void 0 && (p.forkSession === true || p.resumeProviderSessionId !== void 0)) {
|
|
21185
21204
|
throw new Error("VALIDATION: a repository chat starts a new session");
|
|
21186
21205
|
}
|
|
21187
|
-
if (task !== void 0 || this.isTaskSession(sessionId)) {
|
|
21206
|
+
if (task !== void 0 || !p.flow && !marked && this.isTaskSession(sessionId)) {
|
|
21188
21207
|
throw new Error("VALIDATION: a task session cannot be a repository chat");
|
|
21189
21208
|
}
|
|
21190
21209
|
}
|
|
@@ -22255,7 +22274,7 @@ var init_manager = __esm({
|
|
|
22255
22274
|
* gets both guards, the secret-file one asked first.
|
|
22256
22275
|
*/
|
|
22257
22276
|
claudePolicy(createdBy, cwd, permissionMode, guard, roots, skills = {}, sessionId) {
|
|
22258
|
-
if (guard === "repository") {
|
|
22277
|
+
if (guard === "repository" || guard === "repository+task") {
|
|
22259
22278
|
const readDirs = (skills.plugins ?? []).map((plugin) => plugin.path);
|
|
22260
22279
|
if (sessionId !== void 0)
|
|
22261
22280
|
readDirs.push(
|
|
@@ -22270,7 +22289,7 @@ var init_manager = __esm({
|
|
|
22270
22289
|
};
|
|
22271
22290
|
const policy2 = this.settingsPolicy(createdBy, cwd, permissionMode, []);
|
|
22272
22291
|
this.warnBypassWithoutUserGuards(createdBy, permissionMode, policy2, sessionId);
|
|
22273
|
-
|
|
22292
|
+
const repository = {
|
|
22274
22293
|
...policy2,
|
|
22275
22294
|
// Plan mode writes its plan file inside the worktree, where the bound lets it; the daemon
|
|
22276
22295
|
// keeps the directory out of git status (`info/exclude`, `managed.ts`).
|
|
@@ -22280,11 +22299,16 @@ var init_manager = __esm({
|
|
|
22280
22299
|
readInsideDirs: toolResults
|
|
22281
22300
|
})
|
|
22282
22301
|
};
|
|
22302
|
+
return guard === "repository" ? repository : this.withTaskGuard(repository, cwd);
|
|
22283
22303
|
}
|
|
22284
22304
|
const gitGuard = this.reachesManagedRoot(roots) ? createManagedGitGuard(this.deps.managedRoot, cwd) : null;
|
|
22285
22305
|
const policy = this.settingsPolicy(createdBy, cwd, permissionMode, this.deps.trustedRoots);
|
|
22286
22306
|
this.warnBypassWithoutUserGuards(createdBy, permissionMode, policy, sessionId);
|
|
22287
|
-
|
|
22307
|
+
const guarded = gitGuard ? { ...policy, toolGuard: gitGuard } : policy;
|
|
22308
|
+
return guard === "task" ? this.withTaskGuard(guarded, cwd) : guarded;
|
|
22309
|
+
}
|
|
22310
|
+
/** Protocol §2.8's task guard added to `policy`: asked before the guard it already has. */
|
|
22311
|
+
withTaskGuard(policy, cwd) {
|
|
22288
22312
|
const permissions = policy.settings?.permissions;
|
|
22289
22313
|
const secretGuard = createSecretGuard(cwd, this.deps.protectedPaths);
|
|
22290
22314
|
return {
|
|
@@ -22296,7 +22320,7 @@ var init_manager = __esm({
|
|
|
22296
22320
|
deny: [...permissions?.deny ?? [], ...taskSecretDenyRules(this.deps.protectedPaths)]
|
|
22297
22321
|
}
|
|
22298
22322
|
},
|
|
22299
|
-
toolGuard:
|
|
22323
|
+
toolGuard: policy.toolGuard ? firstRefusal(secretGuard, policy.toolGuard) : secretGuard,
|
|
22300
22324
|
askTools: TASK_ASK_TOOLS
|
|
22301
22325
|
};
|
|
22302
22326
|
}
|
|
@@ -23014,7 +23038,6 @@ var init_manager = __esm({
|
|
|
23014
23038
|
let roots;
|
|
23015
23039
|
let repo = null;
|
|
23016
23040
|
if (mark !== null) {
|
|
23017
|
-
if (guarded) throw new Error("VALIDATION: a task session cannot be a repository chat");
|
|
23018
23041
|
const recorded = await this.recordedRepoWorktree(sessionId, mark);
|
|
23019
23042
|
cwd = recorded.real;
|
|
23020
23043
|
roots = [cwd];
|
|
@@ -23039,7 +23062,7 @@ var init_manager = __esm({
|
|
|
23039
23062
|
const started = this.markStarting(cwd, sessionId);
|
|
23040
23063
|
try {
|
|
23041
23064
|
const skills = provider === "claude" ? await this.materialise(sessionId, cwd, data.owner_id ?? null) : {};
|
|
23042
|
-
const guard = repo ? "repository" : guarded ? "task" : null;
|
|
23065
|
+
const guard = repo ? guarded ? "repository+task" : "repository" : guarded ? "task" : null;
|
|
23043
23066
|
const resumed = await this.spawn(
|
|
23044
23067
|
sessionId,
|
|
23045
23068
|
provider,
|
|
@@ -27626,6 +27649,8 @@ async function compose(cfg, lock, host, preflight) {
|
|
|
27626
27649
|
taskStart: true,
|
|
27627
27650
|
// D79, protocol §2.13: this build enforces `session.start.flow` and reports the step.
|
|
27628
27651
|
flows: true,
|
|
27652
|
+
// D87: this build accepts `flow` with `repository` on `session.start`.
|
|
27653
|
+
flowRepositories: true,
|
|
27629
27654
|
// D40: this build mirrors what a session writes under `.cayenne/docs`, so the Documents tab
|
|
27630
27655
|
// can say "this runner does not publish documents" about an older one instead of "none yet".
|
|
27631
27656
|
// Nothing else is composed here: the mirror is one service per live session, built by the
|