@vercel/factory 0.0.9 → 0.0.10

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.
@@ -87,11 +87,11 @@ type Change = z.infer<typeof changeSchema>;
87
87
  //#endregion
88
88
  //#region src/schema/receipt.d.ts
89
89
  /** States the engine writes on transitions. Any vocabulary value is valid. */
90
- declare const standardReceiptStates: readonly ["approved", "rejected", "dispatched", "succeeded", "failed", "needs_human", "cancelled", "settled", "merged", "deployed", "rolled_out", "rolled_back"];
90
+ declare const standardReceiptStates: readonly ["approved", "rejected", "dispatched", "succeeded", "failed", "needs_human", "cancelled", "settled", "ready", "merged", "deployed", "rolled_out", "rolled_back"];
91
91
  /** Phases the standard loop uses. Any vocabulary value is valid. */
92
92
  declare const standardReceiptPhases: readonly ["approval", "budget", "dispatch", "implementation", "verification", "pull_request", "cleanup"];
93
93
  /** Kinds the standard loop writes: the standard task kinds plus "change". */
94
- declare const standardReceiptKinds: readonly ["code_change", "verification", "investigation", "question", "change"];
94
+ declare const standardReceiptKinds: readonly ["coordination", "code_change", "verification", "investigation", "question", "change"];
95
95
  declare const receiptStateSchema: z.ZodString;
96
96
  declare const receiptPhaseSchema: z.ZodString;
97
97
  declare const receiptKindSchema: z.ZodString;
@@ -145,7 +145,7 @@ type Repository = z.infer<typeof repositorySchema>;
145
145
  * Kinds the standard loop understands. Any vocabulary value is valid; the
146
146
  * kind-scoped rules below apply only to these standard kinds.
147
147
  */
148
- declare const standardTaskKinds: readonly ["code_change", "verification", "investigation", "question"];
148
+ declare const standardTaskKinds: readonly ["coordination", "code_change", "verification", "investigation", "question"];
149
149
  declare const taskKindSchema: z.ZodString;
150
150
  declare const taskStateSchema: z.ZodEnum<{
151
151
  queued: "queued";
@@ -161,6 +161,8 @@ declare const taskApprovalSchema: z.ZodEnum<{
161
161
  granted: "granted";
162
162
  denied: "denied";
163
163
  }>;
164
+ declare const taskExecutionRepositoryIdsSchema: z.ZodTuple<[z.ZodString], null>;
165
+ declare const coordinationRepositoryIdsSchema: z.ZodTuple<[z.ZodString, z.ZodString], z.ZodString>;
164
166
  declare const harnessSchema: z.ZodString;
165
167
  declare const taskOriginSchema: z.ZodObject<{
166
168
  signalId: z.ZodOptional<z.ZodString>;
@@ -181,7 +183,7 @@ declare const taskQuestionSchema: z.ZodObject<{
181
183
  declare const taskSchema: z.ZodObject<{
182
184
  schemaVersion: z.ZodLiteral<1>;
183
185
  id: z.ZodString;
184
- repositoryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
186
+ repositoryIds: z.ZodArray<z.ZodString>;
185
187
  kind: z.ZodString;
186
188
  area: z.ZodOptional<z.ZodString>;
187
189
  state: z.ZodEnum<{
@@ -239,6 +241,12 @@ declare class ApprovalError extends Error {
239
241
  readonly reason: string;
240
242
  constructor(taskId: TaskId, reason: string);
241
243
  }
244
+ declare class ChangeAssociationError extends Error {
245
+ readonly taskId: TaskId;
246
+ readonly repositoryId: RepositoryId;
247
+ readonly reason: string;
248
+ constructor(taskId: TaskId, repositoryId: RepositoryId, reason: string);
249
+ }
242
250
  interface CreateSignalInput {
243
251
  repositoryId: RepositoryId;
244
252
  source: SignalSource;
@@ -507,5 +515,5 @@ interface ApprovalSubject {
507
515
  */
508
516
  declare function requiresApproval(policy: ApprovalPolicy, subject: ApprovalSubject): boolean;
509
517
  //#endregion
510
- export { ReceiptPhase as $, TaskPatch as A, taskDevboxSchema as B, ChangeTransitionOptions as C, changeIdSchema as Ct, CreateTaskInput as D, repositoryIdsSchema as Dt, CreateStoresOptions as E, repositoryIdSchema as Et, TaskKind as F, taskStateSchema as G, taskOriginSchema as H, TaskState as I, repositorySchema as J, Repository as K, harnessSchema as L, createStores as M, Task as N, DecideSignalOptions as O, signalIdSchema as Ot, TaskApproval as P, ReceiptKind as Q, standardTaskKinds as R, ChangePatch as S, TaskId as St, CreateSignalInput as T, receiptIdSchema as Tt, taskQuestionSchema as U, taskKindSchema as V, taskSchema as W, Cost as X, repositorySlugSchema as Y, Receipt as Z, findingVerificationMethodSchema as _, ChangeId as _t, approvalRuleSchema as a, receiptStateSchema as at, ApprovalDecision as b, RepositoryId as bt, Finding as c, standardReceiptStates as ct, FindingVerification as d, ChangeState as dt, ReceiptState as et, findingCategorySchema as f, Level as ft, findingVerificationLevelSchema as g, levelSchema as gt, findingSchema as h, changeStateSchema as ht, approvalPolicySchema as i, receiptSchema as it, TaskTransitionOptions as j, FactoryStores as k, taskIdSchema as kt, FindingCategory as l, Change as lt, findingPrioritySchema as m, changeSchema as mt, ApprovalRule as n, receiptKindSchema as nt, defaultApprovalPolicy as o, standardReceiptKinds as ot, findingFingerprint as p, changeEvidenceSchema as pt, RepositorySlug as q, ApprovalSubject as r, receiptPhaseSchema as rt, requiresApproval as s, standardReceiptPhases as st, ApprovalPolicy as t, costSchema as tt, FindingPriority as u, ChangeEvidence as ut, findingVerificationSchema as v, FactoryId as vt, CreateChangeInput as w, factoryIdSchema as wt, ApprovalError as x, SignalId as xt, AppendReceiptInput as y, ReceiptId as yt, taskApprovalSchema as z };
511
- //# sourceMappingURL=approval-MoiwGpkh.d.mts.map
518
+ export { Cost as $, FactoryStores as A, repositoryIdsSchema as At, standardTaskKinds as B, ChangePatch as C, RepositoryId as Ct, CreateStoresOptions as D, factoryIdSchema as Dt, CreateSignalInput as E, changeIdSchema as Et, TaskApproval as F, taskOriginSchema as G, taskDevboxSchema as H, TaskKind as I, taskStateSchema as J, taskQuestionSchema as K, TaskState as L, TaskTransitionOptions as M, taskIdSchema as Mt, createStores as N, CreateTaskInput as O, receiptIdSchema as Ot, Task as P, repositorySlugSchema as Q, coordinationRepositoryIdsSchema as R, ChangeAssociationError as S, ReceiptId as St, CreateChangeInput as T, TaskId as Tt, taskExecutionRepositoryIdsSchema as U, taskApprovalSchema as V, taskKindSchema as W, RepositorySlug as X, Repository as Y, repositorySchema as Z, findingVerificationMethodSchema as _, changeSchema as _t, approvalRuleSchema as a, receiptKindSchema as at, ApprovalDecision as b, ChangeId as bt, Finding as c, receiptStateSchema as ct, FindingVerification as d, standardReceiptStates as dt, Receipt as et, findingCategorySchema as f, Change as ft, findingVerificationLevelSchema as g, changeEvidenceSchema as gt, findingSchema as h, Level as ht, approvalPolicySchema as i, costSchema as it, TaskPatch as j, signalIdSchema as jt, DecideSignalOptions as k, repositoryIdSchema as kt, FindingCategory as l, standardReceiptKinds as lt, findingPrioritySchema as m, ChangeState as mt, ApprovalRule as n, ReceiptPhase as nt, defaultApprovalPolicy as o, receiptPhaseSchema as ot, findingFingerprint as p, ChangeEvidence as pt, taskSchema as q, ApprovalSubject as r, ReceiptState as rt, requiresApproval as s, receiptSchema as st, ApprovalPolicy as t, ReceiptKind as tt, FindingPriority as u, standardReceiptPhases as ut, findingVerificationSchema as v, changeStateSchema as vt, ChangeTransitionOptions as w, SignalId as wt, ApprovalError as x, FactoryId as xt, AppendReceiptInput as y, levelSchema as yt, harnessSchema as z };
519
+ //# sourceMappingURL=approval-CDiBco2V.d.mts.map
@@ -1,6 +1,121 @@
1
1
  import { a as repositoryIdsSchema, d as schemaVersionSchema, f as usdSchema, i as repositoryIdSchema, l as isoDateTimeSchema, o as signalIdSchema, p as vocabularySchema, s as taskIdSchema, t as changeIdSchema, u as replyToSchema } from "./id-DwCihQr4.mjs";
2
2
  import { n as RecordNotFoundError } from "./driver-Bbd25rNM.mjs";
3
3
  import { z } from "zod";
4
+ //#region src/schema/task.ts
5
+ /**
6
+ * Kinds the standard loop understands. Any vocabulary value is valid; the
7
+ * kind-scoped rules below apply only to these standard kinds.
8
+ */
9
+ const standardTaskKinds = [
10
+ "coordination",
11
+ "code_change",
12
+ "verification",
13
+ "investigation",
14
+ "question"
15
+ ];
16
+ const taskKindSchema = vocabularySchema.describe("What kind of work this is, e.g. code_change, question, or a registered custom kind.");
17
+ const taskStateSchema = z.enum([
18
+ "queued",
19
+ "running",
20
+ "verifying",
21
+ "succeeded",
22
+ "failed",
23
+ "needs_human",
24
+ "cancelled"
25
+ ]).describe("Lifecycle state. Transitions are fixed; see taskTransitions.");
26
+ const taskApprovalSchema = z.enum([
27
+ "required",
28
+ "granted",
29
+ "denied"
30
+ ]).describe("Human approval status. Absent means no approval is needed. Stamped required at creation by policy; granted or denied by an operator.");
31
+ const taskExecutionRepositoryIdsSchema = z.tuple([repositoryIdSchema]).describe("The one repository used to execute a task.");
32
+ const coordinationRepositoryIdsSchema = z.tuple([repositoryIdSchema, repositoryIdSchema]).rest(repositoryIdSchema).refine((repositoryIds) => new Set(repositoryIds).size === repositoryIds.length, { message: "Coordination tasks require distinct repositories." }).describe("The distinct repositories coordinated by a non-executable parent task.");
33
+ const harnessSchema = z.string().min(1).describe("Coding harness used in the devbox, e.g. claude-code or codex.");
34
+ const taskOriginSchema = z.strictObject({
35
+ signalId: signalIdSchema.optional().describe("Signal that led to this task."),
36
+ parentTaskId: taskIdSchema.optional().describe("Parent task that planned this child."),
37
+ operator: z.string().min(1).optional().describe("Human operator who requested it.")
38
+ }).refine((origin) => origin.signalId !== void 0 || origin.parentTaskId !== void 0 || origin.operator !== void 0, { message: "origin requires a signalId, parentTaskId, or operator" });
39
+ const taskDevboxSchema = z.strictObject({
40
+ devboxId: z.string().min(1).describe("Devbox running or having run this task."),
41
+ remoteId: z.string().min(1).describe("Provider-side id of the execution."),
42
+ harness: harnessSchema
43
+ });
44
+ const taskQuestionSchema = z.strictObject({
45
+ text: z.string().min(1).describe("The question a human must answer."),
46
+ options: z.array(z.string().min(1)).describe("Suggested answers; free-text is also allowed."),
47
+ answer: z.string().min(1).optional(),
48
+ answeredBy: z.string().min(1).optional().describe("Authenticated operator who answered.")
49
+ });
50
+ const taskSchema = z.strictObject({
51
+ schemaVersion: schemaVersionSchema,
52
+ id: taskIdSchema,
53
+ repositoryIds: repositoryIdsSchema.describe("Repositories the task concerns."),
54
+ kind: taskKindSchema,
55
+ area: z.string().min(1).optional().describe("Investigation area, e.g. onboarding or security. Investigation tasks only."),
56
+ state: taskStateSchema,
57
+ approval: taskApprovalSchema.optional(),
58
+ origin: taskOriginSchema,
59
+ dependsOn: z.array(taskIdSchema).min(1).optional().describe("Sibling tasks that must produce a change before this one may run."),
60
+ replyTo: replyToSchema,
61
+ devbox: taskDevboxSchema.optional(),
62
+ attempt: z.number().int().min(1).describe("Execution attempt, starting at 1; bumps on retry."),
63
+ reservedUsd: usdSchema.optional().describe("Budget reserved before dispatch."),
64
+ settledUsd: usdSchema.optional().describe("Measured cost settled after execution."),
65
+ question: taskQuestionSchema.optional(),
66
+ changeId: changeIdSchema.optional().describe("Change this code_change task produced."),
67
+ reportRef: z.string().min(1).optional().describe("Reference to the report artifact an investigation produced."),
68
+ createdAt: isoDateTimeSchema,
69
+ updatedAt: isoDateTimeSchema
70
+ }).superRefine((task, ctx) => {
71
+ if (task.kind === "coordination" && !coordinationRepositoryIdsSchema.safeParse(task.repositoryIds).success) ctx.addIssue({
72
+ code: "custom",
73
+ path: ["repositoryIds"],
74
+ message: "coordination tasks require at least two distinct repositories"
75
+ });
76
+ if ((task.kind === "code_change" || task.kind === "verification") && task.repositoryIds.length !== 1) ctx.addIssue({
77
+ code: "custom",
78
+ path: ["repositoryIds"],
79
+ message: `${task.kind} tasks require exactly one repository`
80
+ });
81
+ if (task.area !== void 0 && task.kind !== "investigation") ctx.addIssue({
82
+ code: "custom",
83
+ path: ["area"],
84
+ message: "area is only valid on investigation tasks"
85
+ });
86
+ if (task.kind === "question") {
87
+ if (task.question === void 0) ctx.addIssue({
88
+ code: "custom",
89
+ path: ["question"],
90
+ message: "question tasks require a question"
91
+ });
92
+ if (task.devbox !== void 0) ctx.addIssue({
93
+ code: "custom",
94
+ path: ["devbox"],
95
+ message: "question tasks never run in a devbox"
96
+ });
97
+ } else if (task.question !== void 0) ctx.addIssue({
98
+ code: "custom",
99
+ path: ["question"],
100
+ message: "question is only valid on question tasks"
101
+ });
102
+ if (task.kind === "coordination" && task.devbox !== void 0) ctx.addIssue({
103
+ code: "custom",
104
+ path: ["devbox"],
105
+ message: "coordination tasks never run in a devbox"
106
+ });
107
+ if (task.changeId !== void 0 && task.kind !== "code_change") ctx.addIssue({
108
+ code: "custom",
109
+ path: ["changeId"],
110
+ message: "changeId is only valid on code_change tasks"
111
+ });
112
+ if (task.reportRef !== void 0 && task.kind !== "investigation") ctx.addIssue({
113
+ code: "custom",
114
+ path: ["reportRef"],
115
+ message: "reportRef is only valid on investigation tasks"
116
+ });
117
+ });
118
+ //#endregion
4
119
  //#region src/dispatch.ts
5
120
  var DispatchRefusedError = class extends Error {
6
121
  taskId;
@@ -24,6 +139,8 @@ async function dispatchTask(stores, taskId, options) {
24
139
  const task = await stores.tasks.get(taskId);
25
140
  if (task === null) throw new RecordNotFoundError("tasks", taskId);
26
141
  if (task.kind === "question") throw new DispatchRefusedError(taskId, "question tasks are answered, not dispatched");
142
+ if (task.kind === "coordination") throw new DispatchRefusedError(taskId, "coordination tasks are reconciled, not dispatched");
143
+ if (!taskExecutionRepositoryIdsSchema.safeParse(task.repositoryIds).success) throw new DispatchRefusedError(taskId, "task execution requires exactly one repository");
27
144
  if (task.approval === "required") throw new DispatchRefusedError(taskId, "awaiting human approval");
28
145
  if (task.approval === "denied") throw new DispatchRefusedError(taskId, "approval was denied");
29
146
  for (const dependencyId of task.dependsOn ?? []) {
@@ -108,103 +225,6 @@ const changeSchema = z.strictObject({
108
225
  });
109
226
  });
110
227
  //#endregion
111
- //#region src/schema/task.ts
112
- /**
113
- * Kinds the standard loop understands. Any vocabulary value is valid; the
114
- * kind-scoped rules below apply only to these standard kinds.
115
- */
116
- const standardTaskKinds = [
117
- "code_change",
118
- "verification",
119
- "investigation",
120
- "question"
121
- ];
122
- const taskKindSchema = vocabularySchema.describe("What kind of work this is, e.g. code_change, question, or a registered custom kind.");
123
- const taskStateSchema = z.enum([
124
- "queued",
125
- "running",
126
- "verifying",
127
- "succeeded",
128
- "failed",
129
- "needs_human",
130
- "cancelled"
131
- ]).describe("Lifecycle state. Transitions are fixed; see taskTransitions.");
132
- const taskApprovalSchema = z.enum([
133
- "required",
134
- "granted",
135
- "denied"
136
- ]).describe("Human approval status. Absent means no approval is needed. Stamped required at creation by policy; granted or denied by an operator.");
137
- const harnessSchema = z.string().min(1).describe("Coding harness used in the devbox, e.g. claude-code or codex.");
138
- const taskOriginSchema = z.strictObject({
139
- signalId: signalIdSchema.optional().describe("Signal that led to this task."),
140
- parentTaskId: taskIdSchema.optional().describe("Parent task that planned this child."),
141
- operator: z.string().min(1).optional().describe("Human operator who requested it.")
142
- }).refine((origin) => origin.signalId !== void 0 || origin.parentTaskId !== void 0 || origin.operator !== void 0, { message: "origin requires a signalId, parentTaskId, or operator" });
143
- const taskDevboxSchema = z.strictObject({
144
- devboxId: z.string().min(1).describe("Devbox running or having run this task."),
145
- remoteId: z.string().min(1).describe("Provider-side id of the execution."),
146
- harness: harnessSchema
147
- });
148
- const taskQuestionSchema = z.strictObject({
149
- text: z.string().min(1).describe("The question a human must answer."),
150
- options: z.array(z.string().min(1)).describe("Suggested answers; free-text is also allowed."),
151
- answer: z.string().min(1).optional(),
152
- answeredBy: z.string().min(1).optional().describe("Authenticated operator who answered.")
153
- });
154
- const taskSchema = z.strictObject({
155
- schemaVersion: schemaVersionSchema,
156
- id: taskIdSchema,
157
- repositoryIds: repositoryIdsSchema.optional().describe("Repositories the task works on; absent only on a multi-repo parent."),
158
- kind: taskKindSchema,
159
- area: z.string().min(1).optional().describe("Investigation area, e.g. onboarding or security. Investigation tasks only."),
160
- state: taskStateSchema,
161
- approval: taskApprovalSchema.optional(),
162
- origin: taskOriginSchema,
163
- dependsOn: z.array(taskIdSchema).min(1).optional().describe("Sibling tasks that must produce a change before this one may run."),
164
- replyTo: replyToSchema,
165
- devbox: taskDevboxSchema.optional(),
166
- attempt: z.number().int().min(1).describe("Execution attempt, starting at 1; bumps on retry."),
167
- reservedUsd: usdSchema.optional().describe("Budget reserved before dispatch."),
168
- settledUsd: usdSchema.optional().describe("Measured cost settled after execution."),
169
- question: taskQuestionSchema.optional(),
170
- changeId: changeIdSchema.optional().describe("Change this code_change task produced."),
171
- reportRef: z.string().min(1).optional().describe("Reference to the report artifact an investigation produced."),
172
- createdAt: isoDateTimeSchema,
173
- updatedAt: isoDateTimeSchema
174
- }).superRefine((task, ctx) => {
175
- if (task.area !== void 0 && task.kind !== "investigation") ctx.addIssue({
176
- code: "custom",
177
- path: ["area"],
178
- message: "area is only valid on investigation tasks"
179
- });
180
- if (task.kind === "question") {
181
- if (task.question === void 0) ctx.addIssue({
182
- code: "custom",
183
- path: ["question"],
184
- message: "question tasks require a question"
185
- });
186
- if (task.devbox !== void 0) ctx.addIssue({
187
- code: "custom",
188
- path: ["devbox"],
189
- message: "question tasks never run in a devbox"
190
- });
191
- } else if (task.question !== void 0) ctx.addIssue({
192
- code: "custom",
193
- path: ["question"],
194
- message: "question is only valid on question tasks"
195
- });
196
- if (task.changeId !== void 0 && task.kind !== "code_change") ctx.addIssue({
197
- code: "custom",
198
- path: ["changeId"],
199
- message: "changeId is only valid on code_change tasks"
200
- });
201
- if (task.reportRef !== void 0 && task.kind !== "investigation") ctx.addIssue({
202
- code: "custom",
203
- path: ["reportRef"],
204
- message: "reportRef is only valid on investigation tasks"
205
- });
206
- });
207
- //#endregion
208
- export { taskKindSchema as a, taskSchema as c, changeSchema as d, changeStateSchema as f, dispatchTask as g, DispatchRefusedError as h, taskDevboxSchema as i, taskStateSchema as l, DEFAULT_MAX_LAUNCH_ATTEMPTS as m, standardTaskKinds as n, taskOriginSchema as o, levelSchema as p, taskApprovalSchema as r, taskQuestionSchema as s, harnessSchema as t, changeEvidenceSchema as u };
228
+ export { taskSchema as _, DEFAULT_MAX_LAUNCH_ATTEMPTS as a, coordinationRepositoryIdsSchema as c, taskApprovalSchema as d, taskDevboxSchema as f, taskQuestionSchema as g, taskOriginSchema as h, levelSchema as i, harnessSchema as l, taskKindSchema as m, changeSchema as n, DispatchRefusedError as o, taskExecutionRepositoryIdsSchema as p, changeStateSchema as r, dispatchTask as s, changeEvidenceSchema as t, standardTaskKinds as u, taskStateSchema as v };
209
229
 
210
- //# sourceMappingURL=task-DMHuvBI0.mjs.map
230
+ //# sourceMappingURL=change-BPYhWKuL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"change-BPYhWKuL.mjs","names":[],"sources":["../src/schema/task.ts","../src/dispatch.ts","../src/schema/change.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n isoDateTimeSchema,\n replyToSchema,\n schemaVersionSchema,\n usdSchema,\n vocabularySchema,\n} from \"./common\";\nimport {\n changeIdSchema,\n repositoryIdSchema,\n repositoryIdsSchema,\n signalIdSchema,\n taskIdSchema,\n} from \"./id\";\n\n/**\n * Kinds the standard loop understands. Any vocabulary value is valid; the\n * kind-scoped rules below apply only to these standard kinds.\n */\nexport const standardTaskKinds = [\n \"coordination\",\n \"code_change\",\n \"verification\",\n \"investigation\",\n \"question\",\n] as const;\n\nexport const taskKindSchema = vocabularySchema.describe(\n \"What kind of work this is, e.g. code_change, question, or a registered custom kind.\",\n);\n\nexport const taskStateSchema = z\n .enum([\"queued\", \"running\", \"verifying\", \"succeeded\", \"failed\", \"needs_human\", \"cancelled\"])\n .describe(\"Lifecycle state. Transitions are fixed; see taskTransitions.\");\n\nexport const taskApprovalSchema = z\n .enum([\"required\", \"granted\", \"denied\"])\n .describe(\n \"Human approval status. Absent means no approval is needed. Stamped required at creation by policy; granted or denied by an operator.\",\n );\n\nexport const taskExecutionRepositoryIdsSchema = z\n .tuple([repositoryIdSchema])\n .describe(\"The one repository used to execute a task.\");\n\nexport const coordinationRepositoryIdsSchema = z\n .tuple([repositoryIdSchema, repositoryIdSchema])\n .rest(repositoryIdSchema)\n .refine((repositoryIds) => new Set(repositoryIds).size === repositoryIds.length, {\n message: \"Coordination tasks require distinct repositories.\",\n })\n .describe(\"The distinct repositories coordinated by a non-executable parent task.\");\n\nexport const harnessSchema = z\n .string()\n .min(1)\n .describe(\"Coding harness used in the devbox, e.g. claude-code or codex.\");\n\nexport const taskOriginSchema = z\n .strictObject({\n signalId: signalIdSchema.optional().describe(\"Signal that led to this task.\"),\n parentTaskId: taskIdSchema.optional().describe(\"Parent task that planned this child.\"),\n operator: z.string().min(1).optional().describe(\"Human operator who requested it.\"),\n })\n .refine(\n (origin) =>\n origin.signalId !== undefined ||\n origin.parentTaskId !== undefined ||\n origin.operator !== undefined,\n { message: \"origin requires a signalId, parentTaskId, or operator\" },\n );\n\nexport const taskDevboxSchema = z.strictObject({\n devboxId: z.string().min(1).describe(\"Devbox running or having run this task.\"),\n remoteId: z.string().min(1).describe(\"Provider-side id of the execution.\"),\n harness: harnessSchema,\n});\n\nexport const taskQuestionSchema = z.strictObject({\n text: z.string().min(1).describe(\"The question a human must answer.\"),\n options: z.array(z.string().min(1)).describe(\"Suggested answers; free-text is also allowed.\"),\n answer: z.string().min(1).optional(),\n answeredBy: z.string().min(1).optional().describe(\"Authenticated operator who answered.\"),\n});\n\nexport const taskSchema = z\n .strictObject({\n schemaVersion: schemaVersionSchema,\n id: taskIdSchema,\n repositoryIds: repositoryIdsSchema.describe(\"Repositories the task concerns.\"),\n kind: taskKindSchema,\n area: z\n .string()\n .min(1)\n .optional()\n .describe(\"Investigation area, e.g. onboarding or security. Investigation tasks only.\"),\n state: taskStateSchema,\n approval: taskApprovalSchema.optional(),\n origin: taskOriginSchema,\n dependsOn: z\n .array(taskIdSchema)\n .min(1)\n .optional()\n .describe(\"Sibling tasks that must produce a change before this one may run.\"),\n replyTo: replyToSchema,\n devbox: taskDevboxSchema.optional(),\n attempt: z\n .number()\n .int()\n .min(1)\n .describe(\"Execution attempt, starting at 1; bumps on retry.\"),\n reservedUsd: usdSchema.optional().describe(\"Budget reserved before dispatch.\"),\n settledUsd: usdSchema.optional().describe(\"Measured cost settled after execution.\"),\n question: taskQuestionSchema.optional(),\n changeId: changeIdSchema.optional().describe(\"Change this code_change task produced.\"),\n reportRef: z\n .string()\n .min(1)\n .optional()\n .describe(\"Reference to the report artifact an investigation produced.\"),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n })\n .superRefine((task, ctx) => {\n if (\n task.kind === \"coordination\" &&\n !coordinationRepositoryIdsSchema.safeParse(task.repositoryIds).success\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"repositoryIds\"],\n message: \"coordination tasks require at least two distinct repositories\",\n });\n }\n if (\n (task.kind === \"code_change\" || task.kind === \"verification\") &&\n task.repositoryIds.length !== 1\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"repositoryIds\"],\n message: `${task.kind} tasks require exactly one repository`,\n });\n }\n if (task.area !== undefined && task.kind !== \"investigation\") {\n ctx.addIssue({\n code: \"custom\",\n path: [\"area\"],\n message: \"area is only valid on investigation tasks\",\n });\n }\n if (task.kind === \"question\") {\n if (task.question === undefined) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"question\"],\n message: \"question tasks require a question\",\n });\n }\n if (task.devbox !== undefined) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"devbox\"],\n message: \"question tasks never run in a devbox\",\n });\n }\n } else if (task.question !== undefined) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"question\"],\n message: \"question is only valid on question tasks\",\n });\n }\n if (task.kind === \"coordination\" && task.devbox !== undefined) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"devbox\"],\n message: \"coordination tasks never run in a devbox\",\n });\n }\n if (task.changeId !== undefined && task.kind !== \"code_change\") {\n ctx.addIssue({\n code: \"custom\",\n path: [\"changeId\"],\n message: \"changeId is only valid on code_change tasks\",\n });\n }\n if (task.reportRef !== undefined && task.kind !== \"investigation\") {\n ctx.addIssue({\n code: \"custom\",\n path: [\"reportRef\"],\n message: \"reportRef is only valid on investigation tasks\",\n });\n }\n });\n\nexport type TaskApproval = z.infer<typeof taskApprovalSchema>;\nexport type TaskKind = z.infer<typeof taskKindSchema>;\nexport type TaskState = z.infer<typeof taskStateSchema>;\nexport type Task = z.infer<typeof taskSchema>;\n","import type { TaskId } from \"./schema/id\";\nimport { taskExecutionRepositoryIdsSchema, type Task } from \"./schema/task\";\nimport { RecordNotFoundError } from \"./store/driver\";\nimport type { FactoryStores } from \"./store/engine\";\n\nexport class DispatchRefusedError extends Error {\n readonly taskId: TaskId;\n readonly reason: string;\n\n constructor(taskId: TaskId, reason: string) {\n super(`dispatch of \"${taskId}\" refused: ${reason}`);\n this.name = \"DispatchRefusedError\";\n this.taskId = taskId;\n this.reason = reason;\n }\n}\n\nexport interface DispatchOptions {\n /**\n * Starts the durable execution for the task (an Eve agent run). Runs after\n * the task has won the queued -> running transition. The execution owns its\n * own provisioning: it creates its Devbox as its first step and patches the\n * task record with the result.\n */\n launch: (task: Task) => Promise<void>;\n /** How many launches to try before the task fails for good; a failure re-queues for the next sweep. */\n maxLaunchAttempts?: number;\n}\n\n// A fresh Vercel project rejects its own agents' sessions until its identity\n// finishes provisioning; at one sweep per minute the budget must outlast that.\nexport const DEFAULT_MAX_LAUNCH_ATTEMPTS = 45;\n\n/**\n * The handshake between recorded work and execution: win the store-gated\n * transition (at most one dispatcher can succeed), then start the run. A\n * launch failure re-queues the task (bumping its attempt) until the attempt\n * limit, then fails it; a crash between the transition and the launch leaves\n * a running task with no execution, which the sweep reaps.\n */\nexport async function dispatchTask(\n stores: FactoryStores,\n taskId: TaskId,\n options: DispatchOptions,\n): Promise<Task> {\n const task = await stores.tasks.get(taskId);\n if (task === null) {\n throw new RecordNotFoundError(\"tasks\", taskId);\n }\n if (task.kind === \"question\") {\n throw new DispatchRefusedError(taskId, \"question tasks are answered, not dispatched\");\n }\n if (task.kind === \"coordination\") {\n throw new DispatchRefusedError(taskId, \"coordination tasks are reconciled, not dispatched\");\n }\n if (!taskExecutionRepositoryIdsSchema.safeParse(task.repositoryIds).success) {\n throw new DispatchRefusedError(taskId, \"task execution requires exactly one repository\");\n }\n if (task.approval === \"required\") {\n throw new DispatchRefusedError(taskId, \"awaiting human approval\");\n }\n if (task.approval === \"denied\") {\n throw new DispatchRefusedError(taskId, \"approval was denied\");\n }\n for (const dependencyId of task.dependsOn ?? []) {\n const dependency = await stores.tasks.get(dependencyId);\n if (dependency === null) {\n throw new DispatchRefusedError(taskId, `dependency \"${dependencyId}\" does not exist`);\n }\n if (dependency.changeId === undefined) {\n throw new DispatchRefusedError(\n taskId,\n `dependency \"${dependencyId}\" has not produced a change`,\n );\n }\n }\n\n const running = await stores.tasks.transition(taskId, \"running\");\n try {\n await options.launch(running);\n } catch (error) {\n const reason = (error instanceof Error ? error.message : String(error)).slice(0, 500);\n const limit = options.maxLaunchAttempts ?? DEFAULT_MAX_LAUNCH_ATTEMPTS;\n if (running.attempt < limit) {\n const retryReason = `launch failed (attempt ${running.attempt} of ${limit}), will retry: ${reason}`;\n await stores.tasks.transition(taskId, \"queued\", { reason: retryReason }).catch(() => undefined);\n // The queued transition writes no receipt; leave one so the retry is visible.\n if (running.repositoryIds !== undefined) {\n await stores.receipts\n .append({\n repositoryIds: running.repositoryIds,\n taskId,\n kind: \"task\",\n state: \"launch_retry\",\n reason: retryReason,\n dedupeKey: `task:${taskId}:launch_retry:${running.attempt}`,\n })\n .catch(() => undefined);\n }\n } else {\n await stores.tasks\n .transition(taskId, \"failed\", { reason: `launch failed after ${running.attempt} attempts: ${reason}` })\n .catch(() => undefined);\n }\n throw error;\n }\n return running;\n}\n","import { z } from \"zod\";\nimport { isoDateTimeSchema, schemaVersionSchema } from \"./common\";\nimport { changeIdSchema, repositoryIdSchema, taskIdSchema } from \"./id\";\n\nexport const levelSchema = z.enum([\"low\", \"medium\", \"high\"]);\n\nexport const changeStateSchema = z.enum([\n \"verifying\",\n \"ready\",\n \"merged\",\n \"deployed\",\n \"rolled_out\",\n \"rolled_back\",\n \"closed\",\n]);\n\nconst postMergeStates: readonly string[] = [\"merged\", \"deployed\", \"rolled_out\", \"rolled_back\"];\n\nexport const changeEvidenceSchema = z.strictObject({\n reproVerified: z.boolean(),\n testsAdded: z.number().int().min(0),\n checksGreen: z.boolean(),\n attackPassed: z.boolean(),\n scopeMatches: z.boolean(),\n previewUrl: z.url().optional(),\n});\n\nexport const changeSchema = z\n .strictObject({\n schemaVersion: schemaVersionSchema,\n id: changeIdSchema,\n repositoryId: repositoryIdSchema,\n taskId: taskIdSchema.optional(),\n groupId: taskIdSchema.optional(),\n prNumber: z.number().int().min(1),\n prUrl: z.url(),\n author: z.string().min(1),\n risk: levelSchema,\n confidence: levelSchema,\n evidence: changeEvidenceSchema,\n state: changeStateSchema,\n mergeSha: z\n .string()\n .regex(/^[0-9a-f]{40}$/)\n .optional()\n .describe(\"Merge commit sha recorded when the pull request merges, matched against production deployments.\"),\n decidedBy: z.string().min(1).optional(),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n })\n .superRefine((change, ctx) => {\n if (postMergeStates.includes(change.state) && change.decidedBy === undefined) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"decidedBy\"],\n message: `${change.state} changes require decidedBy`,\n });\n }\n });\n\nexport type Level = z.infer<typeof levelSchema>;\nexport type ChangeState = z.infer<typeof changeStateSchema>;\nexport type ChangeEvidence = z.infer<typeof changeEvidenceSchema>;\nexport type Change = z.infer<typeof changeSchema>;\n"],"mappings":";;;;;;;;AAoBA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,iBAAiB,iBAAiB,SAC7C,qFACF;AAEA,MAAa,kBAAkB,EAC5B,KAAK;CAAC;CAAU;CAAW;CAAa;CAAa;CAAU;CAAe;AAAW,CAAC,CAAC,CAC3F,SAAS,8DAA8D;AAE1E,MAAa,qBAAqB,EAC/B,KAAK;CAAC;CAAY;CAAW;AAAQ,CAAC,CAAC,CACvC,SACC,sIACF;AAEF,MAAa,mCAAmC,EAC7C,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAC3B,SAAS,4CAA4C;AAExD,MAAa,kCAAkC,EAC5C,MAAM,CAAC,oBAAoB,kBAAkB,CAAC,CAAC,CAC/C,KAAK,kBAAkB,CAAC,CACxB,QAAQ,kBAAkB,IAAI,IAAI,aAAa,CAAC,CAAC,SAAS,cAAc,QAAQ,EA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ACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,kBAAqC;CAAC;CAAU;CAAY;CAAc;AAAa;AAE7F,MAAa,uBAAuB,EAAE,aAAa;CACjD,eAAe,EAAE,QAAQ;CACzB,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAClC,aAAa,EAAE,QAAQ;CACvB,cAAc,EAAE,QAAQ;CACxB,cAAc,EAAE,QAAQ;CACxB,YAAY,EAAE,IAAI,CAAC,CAAC,SAAS;AAC/B,CAAC;AAED,MAAa,eAAe,EACzB,aAAa;CACZ,eAAe;CACf,IAAI;CACJ,cAAc;CACd,QAAQ,aAAa,SAAS;CAC9B,SAAS,aAAa,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAChC,OAAO,EAAE,IAAI;CACb,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACxB,MAAM;CACN,YAAY;CACZ,UAAU;CACV,OAAO;CACP,UAAU,EACP,OAAO,CAAC,CACR,MAAM,gBAAgB,CAAC,CACvB,SAAS,CAAC,CACV,SAAS,iGAAiG;CAC7G,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CACtC,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,aAAa,QAAQ,QAAQ;CAC5B,IAAI,gBAAgB,SAAS,OAAO,KAAK,KAAK,OAAO,cAAc,KAAA,GACjE,IAAI,SAAS;EACX,MAAM;EACN,MAAM,CAAC,WAAW;EAClB,SAAS,GAAG,OAAO,MAAM;CAC3B,CAAC;AAEL,CAAC"}
@@ -1,5 +1,5 @@
1
- import { c as Finding, k as FactoryStores, t as ApprovalPolicy } from "../approval-MoiwGpkh.mjs";
2
- import { d as GitHubReviewComment } from "../github-DMOypeIu.mjs";
1
+ import { A as FactoryStores, c as Finding, t as ApprovalPolicy } from "../approval-CDiBco2V.mjs";
2
+ import { T as PullRequestReviewComment, b as GitHubReviewComment, j as SubmittedPullRequestReview } from "../github-wThBfbm-.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/eve/fetch.d.ts
5
5
  /** The subset of the eve sandbox handle a credentialed git operation needs. */
@@ -378,6 +378,76 @@ declare function invokeAgentTool(stores: FactoryStores, options: InvokeAgentOpti
378
378
  }>;
379
379
  };
380
380
  //#endregion
381
+ //#region src/eve/post-review.d.ts
382
+ interface PublishedReview {
383
+ taskId: string;
384
+ changeId: string;
385
+ repository: string;
386
+ headSha: string;
387
+ verdict: "approve" | "request_changes" | "comment";
388
+ summary: string;
389
+ comments: readonly PullRequestReviewComment[];
390
+ review: SubmittedPullRequestReview;
391
+ }
392
+ interface PostReviewToolOptions {
393
+ tokenForRepository: (repository: string) => Promise<string>;
394
+ onPublished?: (published: PublishedReview) => Promise<void>;
395
+ fetch?: typeof globalThis.fetch;
396
+ }
397
+ /**
398
+ * Publish an independent review of an existing pull request and finish the
399
+ * review task without changing the pull request's factory lifecycle.
400
+ */
401
+ declare function postReviewTool(stores: FactoryStores, options: PostReviewToolOptions): import("eve/tools").ToolDefinition<{
402
+ taskId: string;
403
+ changeId: string;
404
+ verdict: "approve" | "request_changes" | "comment";
405
+ headSha: string;
406
+ summary: string;
407
+ comments: {
408
+ path: string;
409
+ line: number;
410
+ body: string;
411
+ }[];
412
+ }, {
413
+ recorded: false;
414
+ reason: string;
415
+ verdict?: undefined;
416
+ review?: undefined;
417
+ taskState?: undefined;
418
+ } | {
419
+ recorded: true;
420
+ verdict: "approve" | "request_changes" | "comment";
421
+ review: SubmittedPullRequestReview;
422
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
423
+ reason?: undefined;
424
+ }> & {
425
+ execute(input: {
426
+ taskId: string;
427
+ changeId: string;
428
+ verdict: "approve" | "request_changes" | "comment";
429
+ headSha: string;
430
+ summary: string;
431
+ comments: {
432
+ path: string;
433
+ line: number;
434
+ body: string;
435
+ }[];
436
+ }, ctx: import("eve/tools").ToolContext): Promise<{
437
+ recorded: false;
438
+ reason: string;
439
+ verdict?: undefined;
440
+ review?: undefined;
441
+ taskState?: undefined;
442
+ } | {
443
+ recorded: true;
444
+ verdict: "approve" | "request_changes" | "comment";
445
+ review: SubmittedPullRequestReview;
446
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
447
+ reason?: undefined;
448
+ }>;
449
+ };
450
+ //#endregion
381
451
  //#region src/eve/review.d.ts
382
452
  interface ReviewCommentToolOptions<S extends CommandSandbox = CommandSandbox> {
383
453
  tokenForRepository: (repository: string) => Promise<string>;
@@ -562,6 +632,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
562
632
  }, {
563
633
  schemaVersion: 1;
564
634
  id: string;
635
+ repositoryIds: string[];
565
636
  kind: string;
566
637
  state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
567
638
  origin: {
@@ -576,7 +647,6 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
576
647
  attempt: number;
577
648
  createdAt: string;
578
649
  updatedAt: string;
579
- repositoryIds?: string[] | undefined;
580
650
  area?: string | undefined;
581
651
  approval?: "required" | "granted" | "denied" | undefined;
582
652
  dependsOn?: string[] | undefined;
@@ -604,6 +674,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
604
674
  }, ctx: import("eve/tools").ToolContext): Promise<{
605
675
  schemaVersion: 1;
606
676
  id: string;
677
+ repositoryIds: string[];
607
678
  kind: string;
608
679
  state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
609
680
  origin: {
@@ -618,7 +689,6 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
618
689
  attempt: number;
619
690
  createdAt: string;
620
691
  updatedAt: string;
621
- repositoryIds?: string[] | undefined;
622
692
  area?: string | undefined;
623
693
  approval?: "required" | "granted" | "denied" | undefined;
624
694
  dependsOn?: string[] | undefined;
@@ -724,6 +794,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
724
794
  task: {
725
795
  schemaVersion: 1;
726
796
  id: string;
797
+ repositoryIds: string[];
727
798
  kind: string;
728
799
  state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
729
800
  origin: {
@@ -738,7 +809,6 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
738
809
  attempt: number;
739
810
  createdAt: string;
740
811
  updatedAt: string;
741
- repositoryIds?: string[] | undefined;
742
812
  area?: string | undefined;
743
813
  approval?: "required" | "granted" | "denied" | undefined;
744
814
  dependsOn?: string[] | undefined;
@@ -796,6 +866,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
796
866
  task: {
797
867
  schemaVersion: 1;
798
868
  id: string;
869
+ repositoryIds: string[];
799
870
  kind: string;
800
871
  state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
801
872
  origin: {
@@ -810,7 +881,6 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
810
881
  attempt: number;
811
882
  createdAt: string;
812
883
  updatedAt: string;
813
- repositoryIds?: string[] | undefined;
814
884
  area?: string | undefined;
815
885
  approval?: "required" | "granted" | "denied" | undefined;
816
886
  dependsOn?: string[] | undefined;
@@ -863,6 +933,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
863
933
  }, {
864
934
  schemaVersion: 1;
865
935
  id: string;
936
+ repositoryIds: string[];
866
937
  kind: string;
867
938
  state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
868
939
  origin: {
@@ -877,7 +948,6 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
877
948
  attempt: number;
878
949
  createdAt: string;
879
950
  updatedAt: string;
880
- repositoryIds?: string[] | undefined;
881
951
  area?: string | undefined;
882
952
  approval?: "required" | "granted" | "denied" | undefined;
883
953
  dependsOn?: string[] | undefined;
@@ -903,6 +973,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
903
973
  }, ctx: import("eve/tools").ToolContext): Promise<{
904
974
  schemaVersion: 1;
905
975
  id: string;
976
+ repositoryIds: string[];
906
977
  kind: string;
907
978
  state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
908
979
  origin: {
@@ -917,7 +988,6 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
917
988
  attempt: number;
918
989
  createdAt: string;
919
990
  updatedAt: string;
920
- repositoryIds?: string[] | undefined;
921
991
  area?: string | undefined;
922
992
  approval?: "required" | "granted" | "denied" | undefined;
923
993
  dependsOn?: string[] | undefined;
@@ -950,6 +1020,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
950
1020
  }, {
951
1021
  schemaVersion: 1;
952
1022
  id: string;
1023
+ repositoryIds: string[];
953
1024
  kind: string;
954
1025
  state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
955
1026
  origin: {
@@ -964,7 +1035,6 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
964
1035
  attempt: number;
965
1036
  createdAt: string;
966
1037
  updatedAt: string;
967
- repositoryIds?: string[] | undefined;
968
1038
  area?: string | undefined;
969
1039
  approval?: "required" | "granted" | "denied" | undefined;
970
1040
  dependsOn?: string[] | undefined;
@@ -996,6 +1066,7 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
996
1066
  }, ctx: import("eve/tools").ToolContext): Promise<{
997
1067
  schemaVersion: 1;
998
1068
  id: string;
1069
+ repositoryIds: string[];
999
1070
  kind: string;
1000
1071
  state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
1001
1072
  origin: {
@@ -1010,7 +1081,6 @@ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptio
1010
1081
  attempt: number;
1011
1082
  createdAt: string;
1012
1083
  updatedAt: string;
1013
- repositoryIds?: string[] | undefined;
1014
1084
  area?: string | undefined;
1015
1085
  approval?: "required" | "granted" | "denied" | undefined;
1016
1086
  dependsOn?: string[] | undefined;
@@ -1099,5 +1169,5 @@ declare function factoryHooks(stores: FactoryStores): {
1099
1169
  };
1100
1170
  type FactoryHooks = ReturnType<typeof factoryHooks>;
1101
1171
  //#endregion
1102
- export { type CommandSandbox, type DeepsecScanOptions, FactoryHooks, FactoryTools, FactoryToolsOptions, type FetchPullRequestOptions, type FetchPullRequestResult, GateVerdict, type InvokeAgentOptions, type MergeConflictPayload, type MergeConflictToolOptions, RecordChangeInput, type RecordFindingOptions, type RecordFindingResult, type ReviewCommentToolOptions, deepsecScanTool, factoryHooks, factoryTools, fetchPullRequestTool, findingFromDeepsec, invokeAgentTool, mergeConflictPayloadSchema, mergeConflictTools, recordFinding, recordFindingTool, recordVerificationTool, reviewCommentTools };
1172
+ export { type CommandSandbox, type DeepsecScanOptions, FactoryHooks, FactoryTools, FactoryToolsOptions, type FetchPullRequestOptions, type FetchPullRequestResult, GateVerdict, type InvokeAgentOptions, type MergeConflictPayload, type MergeConflictToolOptions, type PostReviewToolOptions, type PublishedReview, RecordChangeInput, type RecordFindingOptions, type RecordFindingResult, type ReviewCommentToolOptions, deepsecScanTool, factoryHooks, factoryTools, fetchPullRequestTool, findingFromDeepsec, invokeAgentTool, mergeConflictPayloadSchema, mergeConflictTools, postReviewTool, recordFinding, recordFindingTool, recordVerificationTool, reviewCommentTools };
1103
1173
  //# sourceMappingURL=index.d.mts.map