@vercel/factory 0.0.12 → 0.0.14

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.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/dist/api.d.mts +225 -0
  3. package/dist/api.mjs +312 -0
  4. package/dist/api.mjs.map +1 -0
  5. package/dist/{approval-DdvEKLiE.mjs → approval-JX2Px9IC.mjs} +2 -2
  6. package/dist/{approval-DdvEKLiE.mjs.map → approval-JX2Px9IC.mjs.map} +1 -1
  7. package/dist/blob/index.d.mts +4 -3
  8. package/dist/blob/index.mjs +21 -15
  9. package/dist/blob/index.mjs.map +1 -1
  10. package/dist/budget-DzSiIA4t.mjs +42 -0
  11. package/dist/budget-DzSiIA4t.mjs.map +1 -0
  12. package/dist/build-factory.d.mts +1 -1
  13. package/dist/build-factory.mjs +1 -1
  14. package/dist/change-D2U6v7Ek.mjs +554 -0
  15. package/dist/change-D2U6v7Ek.mjs.map +1 -0
  16. package/dist/communication-Kd9nU5RP.mjs +30 -0
  17. package/dist/communication-Kd9nU5RP.mjs.map +1 -0
  18. package/dist/connectors/index.d.mts +3 -2
  19. package/dist/connectors/index.mjs +53 -26
  20. package/dist/connectors/index.mjs.map +1 -1
  21. package/dist/connectors/slack.d.mts +17 -6
  22. package/dist/connectors/slack.mjs +99 -32
  23. package/dist/connectors/slack.mjs.map +1 -1
  24. package/dist/coordination-Cq08hb1l.mjs +76 -0
  25. package/dist/coordination-Cq08hb1l.mjs.map +1 -0
  26. package/dist/dispatch-BaZS3PT8.d.mts +76 -0
  27. package/dist/{driver-CrZsy7sm.d.mts → driver-BC0Mt5KG.d.mts} +2 -2
  28. package/dist/driver-Bbd25rNM.mjs.map +1 -1
  29. package/dist/engine-DFHU2Pe-.d.mts +781 -0
  30. package/dist/engine-WaUM2cGA.mjs +1068 -0
  31. package/dist/engine-WaUM2cGA.mjs.map +1 -0
  32. package/dist/eve/index.d.mts +289 -153
  33. package/dist/eve/index.mjs +378 -89
  34. package/dist/eve/index.mjs.map +1 -1
  35. package/dist/{factory-config-ifd3JxiU.mjs → factory-config-BoRXOw43.mjs} +23 -22
  36. package/dist/factory-config-BoRXOw43.mjs.map +1 -0
  37. package/dist/{factory-config-Bu4mklm9.d.mts → factory-config-D2yU3G0c.d.mts} +21 -2
  38. package/dist/{github-wThBfbm-.d.mts → github-C5HNBN6p.d.mts} +34 -3
  39. package/dist/github.d.mts +2 -2
  40. package/dist/github.mjs +61 -1
  41. package/dist/github.mjs.map +1 -1
  42. package/dist/{id-DwCihQr4.mjs → id-BLIkCVue.mjs} +4 -2
  43. package/dist/{id-DwCihQr4.mjs.map → id-BLIkCVue.mjs.map} +1 -1
  44. package/dist/index-Bw6hggoH.d.mts +40 -0
  45. package/dist/index.d.mts +291 -61
  46. package/dist/index.mjs +140 -783
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/postgres/index.d.mts +1 -1
  49. package/dist/task-CcOyOJ3k.mjs +154 -0
  50. package/dist/task-CcOyOJ3k.mjs.map +1 -0
  51. package/package.json +5 -1
  52. package/dist/approval-CIXB8IF8.d.mts +0 -522
  53. package/dist/change-CFNGXVqD.mjs +0 -230
  54. package/dist/change-CFNGXVqD.mjs.map +0 -1
  55. package/dist/factory-config-ifd3JxiU.mjs.map +0 -1
  56. package/dist/index-Cy4jfXh5.d.mts +0 -67
  57. package/dist/signal-CHVEmzvI.d.mts +0 -59
@@ -0,0 +1,781 @@
1
+ import { i as StoreDriver } from "./driver-BC0Mt5KG.mjs";
2
+ import { z } from "zod";
3
+ //#region src/schema/budget.d.ts
4
+ declare const budgetMonthSchema: z.ZodString;
5
+ declare const budgetLimitsSchema: z.ZodObject<{
6
+ totalUsd: z.ZodNumber;
7
+ investigationUsd: z.ZodNumber;
8
+ perTaskReservationUsd: z.ZodNumber;
9
+ warningPercent: z.ZodNumber;
10
+ perRepositoryUsd: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
11
+ }, z.core.$strict>;
12
+ declare const budgetSchema: z.ZodObject<{
13
+ schemaVersion: z.ZodLiteral<1>;
14
+ factoryId: z.ZodString;
15
+ month: z.ZodString;
16
+ limits: z.ZodObject<{
17
+ totalUsd: z.ZodNumber;
18
+ investigationUsd: z.ZodNumber;
19
+ perTaskReservationUsd: z.ZodNumber;
20
+ warningPercent: z.ZodNumber;
21
+ perRepositoryUsd: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
22
+ }, z.core.$strict>;
23
+ notices: z.ZodObject<{
24
+ warningAt: z.ZodOptional<z.ZodISODateTime>;
25
+ exhaustedAt: z.ZodOptional<z.ZodISODateTime>;
26
+ }, z.core.$strict>;
27
+ }, z.core.$strict>;
28
+ type BudgetLimits = z.infer<typeof budgetLimitsSchema>;
29
+ type Budget = z.infer<typeof budgetSchema>;
30
+ //#endregion
31
+ //#region src/schema/id.d.ts
32
+ declare const factoryIdSchema: z.ZodString;
33
+ declare const repositoryIdSchema: z.ZodString;
34
+ declare const signalIdSchema: z.ZodString;
35
+ declare const taskIdSchema: z.ZodString;
36
+ declare const changeIdSchema: z.ZodString;
37
+ declare const receiptIdSchema: z.ZodString;
38
+ declare const outboxIdSchema: z.ZodString;
39
+ declare const answerIdSchema: z.ZodString;
40
+ declare const repositoryIdsSchema: z.ZodArray<z.ZodString>;
41
+ type FactoryId = z.infer<typeof factoryIdSchema>;
42
+ type RepositoryId = z.infer<typeof repositoryIdSchema>;
43
+ type SignalId = z.infer<typeof signalIdSchema>;
44
+ type TaskId = z.infer<typeof taskIdSchema>;
45
+ type ChangeId = z.infer<typeof changeIdSchema>;
46
+ type ReceiptId = z.infer<typeof receiptIdSchema>;
47
+ type OutboxId = z.infer<typeof outboxIdSchema>;
48
+ type AnswerId = z.infer<typeof answerIdSchema>;
49
+ //#endregion
50
+ //#region src/schema/task.d.ts
51
+ /**
52
+ * Kinds the standard loop understands. Any vocabulary value is valid; the
53
+ * kind-scoped rules below apply only to these standard kinds.
54
+ */
55
+ declare const standardTaskKinds: readonly ["coordination", "code_change", "verification", "investigation", "question"];
56
+ declare const taskKindSchema: z.ZodString;
57
+ declare const taskStateSchema: z.ZodEnum<{
58
+ succeeded: "succeeded";
59
+ failed: "failed";
60
+ needs_human: "needs_human";
61
+ queued: "queued";
62
+ running: "running";
63
+ stalled: "stalled";
64
+ verifying: "verifying";
65
+ cancelled: "cancelled";
66
+ }>;
67
+ declare const taskApprovalSchema: z.ZodEnum<{
68
+ required: "required";
69
+ granted: "granted";
70
+ denied: "denied";
71
+ }>;
72
+ declare const taskExecutionRepositoryIdsSchema: z.ZodTuple<[z.ZodString], null>;
73
+ declare const coordinationRepositoryIdsSchema: z.ZodTuple<[z.ZodString, z.ZodString], z.ZodString>;
74
+ declare const taskOriginSchema: z.ZodObject<{
75
+ signalId: z.ZodOptional<z.ZodString>;
76
+ parentTaskId: z.ZodOptional<z.ZodString>;
77
+ operator: z.ZodOptional<z.ZodString>;
78
+ }, z.core.$strict>;
79
+ declare const harnessSchema: z.ZodString;
80
+ /**
81
+ * The provider's handle on the current attempt's execution. Opaque to the
82
+ * lifecycle: Factory records it so the execution can be inspected or
83
+ * cancelled, never to mirror the provider's own state machine.
84
+ */
85
+ declare const executionReferenceSchema: z.ZodObject<{
86
+ provider: z.ZodString;
87
+ sessionId: z.ZodString;
88
+ environmentId: z.ZodOptional<z.ZodString>;
89
+ harness: z.ZodOptional<z.ZodString>;
90
+ traceId: z.ZodOptional<z.ZodString>;
91
+ }, z.core.$strict>;
92
+ declare const taskUsageSchema: z.ZodObject<{
93
+ costUsd: z.ZodNumber;
94
+ inputTokens: z.ZodNumber;
95
+ outputTokens: z.ZodNumber;
96
+ cacheReadTokens: z.ZodNumber;
97
+ cacheWriteTokens: z.ZodNumber;
98
+ steps: z.ZodRecord<z.ZodString, z.ZodNumber>;
99
+ }, z.core.$strict>;
100
+ declare const taskQuestionSchema: z.ZodObject<{
101
+ text: z.ZodString;
102
+ options: z.ZodArray<z.ZodString>;
103
+ answer: z.ZodOptional<z.ZodString>;
104
+ answeredBy: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strict>;
106
+ declare const taskSchema: z.ZodObject<{
107
+ schemaVersion: z.ZodLiteral<1>;
108
+ id: z.ZodString;
109
+ repositoryIds: z.ZodArray<z.ZodString>;
110
+ kind: z.ZodString;
111
+ area: z.ZodOptional<z.ZodString>;
112
+ state: z.ZodEnum<{
113
+ succeeded: "succeeded";
114
+ failed: "failed";
115
+ needs_human: "needs_human";
116
+ queued: "queued";
117
+ running: "running";
118
+ stalled: "stalled";
119
+ verifying: "verifying";
120
+ cancelled: "cancelled";
121
+ }>;
122
+ approval: z.ZodOptional<z.ZodEnum<{
123
+ required: "required";
124
+ granted: "granted";
125
+ denied: "denied";
126
+ }>>;
127
+ origin: z.ZodObject<{
128
+ signalId: z.ZodOptional<z.ZodString>;
129
+ parentTaskId: z.ZodOptional<z.ZodString>;
130
+ operator: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$strict>;
132
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString>>;
133
+ replyTo: z.ZodObject<{
134
+ channel: z.ZodString;
135
+ address: z.ZodString;
136
+ }, z.core.$strict>;
137
+ attempt: z.ZodNumber;
138
+ execution: z.ZodOptional<z.ZodObject<{
139
+ provider: z.ZodString;
140
+ sessionId: z.ZodString;
141
+ environmentId: z.ZodOptional<z.ZodString>;
142
+ harness: z.ZodOptional<z.ZodString>;
143
+ traceId: z.ZodOptional<z.ZodString>;
144
+ }, z.core.$strict>>;
145
+ lastProgressAt: z.ZodOptional<z.ZodISODateTime>;
146
+ stalledAt: z.ZodOptional<z.ZodISODateTime>;
147
+ stalledReason: z.ZodOptional<z.ZodString>;
148
+ reservedUsd: z.ZodOptional<z.ZodNumber>;
149
+ reservedAt: z.ZodOptional<z.ZodISODateTime>;
150
+ usage: z.ZodOptional<z.ZodObject<{
151
+ costUsd: z.ZodNumber;
152
+ inputTokens: z.ZodNumber;
153
+ outputTokens: z.ZodNumber;
154
+ cacheReadTokens: z.ZodNumber;
155
+ cacheWriteTokens: z.ZodNumber;
156
+ steps: z.ZodRecord<z.ZodString, z.ZodNumber>;
157
+ }, z.core.$strict>>;
158
+ settledUsd: z.ZodOptional<z.ZodNumber>;
159
+ question: z.ZodOptional<z.ZodObject<{
160
+ text: z.ZodString;
161
+ options: z.ZodArray<z.ZodString>;
162
+ answer: z.ZodOptional<z.ZodString>;
163
+ answeredBy: z.ZodOptional<z.ZodString>;
164
+ }, z.core.$strict>>;
165
+ questionTaskId: z.ZodOptional<z.ZodString>;
166
+ answerEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
167
+ changeId: z.ZodOptional<z.ZodString>;
168
+ reportRef: z.ZodOptional<z.ZodString>;
169
+ createdAt: z.ZodISODateTime;
170
+ updatedAt: z.ZodISODateTime;
171
+ }, z.core.$strict>;
172
+ type TaskApproval = z.infer<typeof taskApprovalSchema>;
173
+ type TaskKind = z.infer<typeof taskKindSchema>;
174
+ type TaskState = z.infer<typeof taskStateSchema>;
175
+ type TaskUsage = z.infer<typeof taskUsageSchema>;
176
+ type ExecutionReference = z.infer<typeof executionReferenceSchema>;
177
+ type Task = z.infer<typeof taskSchema>;
178
+ //#endregion
179
+ //#region src/schema/answer.d.ts
180
+ declare const answerEventSchema: z.ZodObject<{
181
+ schemaVersion: z.ZodLiteral<1>;
182
+ id: z.ZodString;
183
+ questionTaskId: z.ZodString;
184
+ parentTaskId: z.ZodOptional<z.ZodString>;
185
+ repositoryIds: z.ZodArray<z.ZodString>;
186
+ replyTo: z.ZodObject<{
187
+ channel: z.ZodString;
188
+ address: z.ZodString;
189
+ }, z.core.$strict>;
190
+ question: z.ZodString;
191
+ answer: z.ZodString;
192
+ answeredBy: z.ZodString;
193
+ recordedAt: z.ZodISODateTime;
194
+ }, z.core.$strict>;
195
+ type AnswerEvent = z.infer<typeof answerEventSchema>;
196
+ //#endregion
197
+ //#region src/schema/session.d.ts
198
+ declare const agentSessionIdSchema: z.ZodString;
199
+ declare const agentSessionSchema: z.ZodObject<{
200
+ schemaVersion: z.ZodLiteral<1>;
201
+ id: z.ZodString;
202
+ owner: z.ZodString;
203
+ agent: z.ZodString;
204
+ repositoryId: z.ZodOptional<z.ZodString>;
205
+ routeId: z.ZodOptional<z.ZodString>;
206
+ message: z.ZodString;
207
+ changeId: z.ZodOptional<z.ZodString>;
208
+ taskId: z.ZodOptional<z.ZodString>;
209
+ execution: z.ZodOptional<z.ZodObject<{
210
+ provider: z.ZodString;
211
+ sessionId: z.ZodString;
212
+ environmentId: z.ZodOptional<z.ZodString>;
213
+ harness: z.ZodOptional<z.ZodString>;
214
+ traceId: z.ZodOptional<z.ZodString>;
215
+ }, z.core.$strict>>;
216
+ notifications: z.ZodDefault<z.ZodArray<z.ZodObject<{
217
+ eventId: z.ZodString;
218
+ repositoryIds: z.ZodArray<z.ZodString>;
219
+ taskId: z.ZodOptional<z.ZodString>;
220
+ changeId: z.ZodOptional<z.ZodString>;
221
+ replyTo: z.ZodObject<{
222
+ channel: z.ZodString;
223
+ address: z.ZodString;
224
+ }, z.core.$strict>;
225
+ outcome: z.ZodEnum<{
226
+ message: "message";
227
+ accepted: "accepted";
228
+ started: "started";
229
+ succeeded: "succeeded";
230
+ failed: "failed";
231
+ needs_human: "needs_human";
232
+ question: "question";
233
+ digest: "digest";
234
+ rolled_back: "rolled_back";
235
+ budget_warning: "budget_warning";
236
+ budget_exhausted: "budget_exhausted";
237
+ }>;
238
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
239
+ }, z.core.$strict>>>;
240
+ createdAt: z.ZodISODateTime;
241
+ }, z.core.$strict>;
242
+ type AgentSession = z.infer<typeof agentSessionSchema>;
243
+ //#endregion
244
+ //#region src/schema/common.d.ts
245
+ declare const SCHEMA_VERSION = 1;
246
+ declare const schemaVersionSchema: z.ZodLiteral<1>;
247
+ declare const isoDateTimeSchema: z.ZodISODateTime;
248
+ declare const usdSchema: z.ZodNumber;
249
+ /**
250
+ * Open vocabulary value. Standard values ship as exported constants; custom
251
+ * values matching the pattern are equally valid.
252
+ */
253
+ declare const vocabularySchema: z.ZodString;
254
+ declare const replyToSchema: z.ZodObject<{
255
+ channel: z.ZodString;
256
+ address: z.ZodString;
257
+ }, z.core.$strict>;
258
+ type ReplyTo = z.infer<typeof replyToSchema>;
259
+ //#endregion
260
+ //#region src/schema/communication.d.ts
261
+ declare const communicationOutcomes: readonly ["accepted", "started", "succeeded", "failed", "needs_human", "question", "digest", "rolled_back", "budget_warning", "budget_exhausted", "message"];
262
+ declare const communicationOutcomeSchema: z.ZodEnum<{
263
+ message: "message";
264
+ accepted: "accepted";
265
+ started: "started";
266
+ succeeded: "succeeded";
267
+ failed: "failed";
268
+ needs_human: "needs_human";
269
+ question: "question";
270
+ digest: "digest";
271
+ rolled_back: "rolled_back";
272
+ budget_warning: "budget_warning";
273
+ budget_exhausted: "budget_exhausted";
274
+ }>;
275
+ declare const communicationEventSchema: z.ZodObject<{
276
+ eventId: z.ZodString;
277
+ repositoryIds: z.ZodArray<z.ZodString>;
278
+ taskId: z.ZodOptional<z.ZodString>;
279
+ changeId: z.ZodOptional<z.ZodString>;
280
+ replyTo: z.ZodObject<{
281
+ channel: z.ZodString;
282
+ address: z.ZodString;
283
+ }, z.core.$strict>;
284
+ outcome: z.ZodEnum<{
285
+ message: "message";
286
+ accepted: "accepted";
287
+ started: "started";
288
+ succeeded: "succeeded";
289
+ failed: "failed";
290
+ needs_human: "needs_human";
291
+ question: "question";
292
+ digest: "digest";
293
+ rolled_back: "rolled_back";
294
+ budget_warning: "budget_warning";
295
+ budget_exhausted: "budget_exhausted";
296
+ }>;
297
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
298
+ }, z.core.$strict>;
299
+ type CommunicationOutcome = z.infer<typeof communicationOutcomeSchema>;
300
+ type CommunicationEvent = z.infer<typeof communicationEventSchema>;
301
+ //#endregion
302
+ //#region src/schema/change.d.ts
303
+ declare const levelSchema: z.ZodEnum<{
304
+ low: "low";
305
+ medium: "medium";
306
+ high: "high";
307
+ }>;
308
+ declare const changeStateSchema: z.ZodEnum<{
309
+ rolled_back: "rolled_back";
310
+ verifying: "verifying";
311
+ ready: "ready";
312
+ merged: "merged";
313
+ deployed: "deployed";
314
+ rolled_out: "rolled_out";
315
+ closed: "closed";
316
+ }>;
317
+ declare const changeEvidenceSchema: z.ZodObject<{
318
+ reproVerified: z.ZodBoolean;
319
+ testsAdded: z.ZodNumber;
320
+ checksGreen: z.ZodBoolean;
321
+ attackPassed: z.ZodBoolean;
322
+ scopeMatches: z.ZodBoolean;
323
+ previewUrl: z.ZodOptional<z.ZodURL>;
324
+ }, z.core.$strict>;
325
+ declare const changeSchema: z.ZodObject<{
326
+ schemaVersion: z.ZodLiteral<1>;
327
+ id: z.ZodString;
328
+ repositoryId: z.ZodString;
329
+ taskId: z.ZodOptional<z.ZodString>;
330
+ groupId: z.ZodOptional<z.ZodString>;
331
+ prNumber: z.ZodNumber;
332
+ prUrl: z.ZodURL;
333
+ author: z.ZodString;
334
+ risk: z.ZodEnum<{
335
+ low: "low";
336
+ medium: "medium";
337
+ high: "high";
338
+ }>;
339
+ confidence: z.ZodEnum<{
340
+ low: "low";
341
+ medium: "medium";
342
+ high: "high";
343
+ }>;
344
+ evidence: z.ZodObject<{
345
+ reproVerified: z.ZodBoolean;
346
+ testsAdded: z.ZodNumber;
347
+ checksGreen: z.ZodBoolean;
348
+ attackPassed: z.ZodBoolean;
349
+ scopeMatches: z.ZodBoolean;
350
+ previewUrl: z.ZodOptional<z.ZodURL>;
351
+ }, z.core.$strict>;
352
+ state: z.ZodEnum<{
353
+ rolled_back: "rolled_back";
354
+ verifying: "verifying";
355
+ ready: "ready";
356
+ merged: "merged";
357
+ deployed: "deployed";
358
+ rolled_out: "rolled_out";
359
+ closed: "closed";
360
+ }>;
361
+ mergeSha: z.ZodOptional<z.ZodString>;
362
+ decidedBy: z.ZodOptional<z.ZodString>;
363
+ createdAt: z.ZodISODateTime;
364
+ updatedAt: z.ZodISODateTime;
365
+ }, z.core.$strict>;
366
+ type Level = z.infer<typeof levelSchema>;
367
+ type ChangeState = z.infer<typeof changeStateSchema>;
368
+ type ChangeEvidence = z.infer<typeof changeEvidenceSchema>;
369
+ type Change = z.infer<typeof changeSchema>;
370
+ //#endregion
371
+ //#region src/schema/outbox.d.ts
372
+ declare const outboxStateSchema: z.ZodEnum<{
373
+ pending: "pending";
374
+ delivering: "delivering";
375
+ delivered: "delivered";
376
+ }>;
377
+ declare const outboxMessageSchema: z.ZodObject<{
378
+ schemaVersion: z.ZodLiteral<1>;
379
+ id: z.ZodString;
380
+ event: z.ZodObject<{
381
+ eventId: z.ZodString;
382
+ repositoryIds: z.ZodArray<z.ZodString>;
383
+ taskId: z.ZodOptional<z.ZodString>;
384
+ changeId: z.ZodOptional<z.ZodString>;
385
+ replyTo: z.ZodObject<{
386
+ channel: z.ZodString;
387
+ address: z.ZodString;
388
+ }, z.core.$strict>;
389
+ outcome: z.ZodEnum<{
390
+ message: "message";
391
+ accepted: "accepted";
392
+ started: "started";
393
+ succeeded: "succeeded";
394
+ failed: "failed";
395
+ needs_human: "needs_human";
396
+ question: "question";
397
+ digest: "digest";
398
+ rolled_back: "rolled_back";
399
+ budget_warning: "budget_warning";
400
+ budget_exhausted: "budget_exhausted";
401
+ }>;
402
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
403
+ }, z.core.$strict>;
404
+ state: z.ZodEnum<{
405
+ pending: "pending";
406
+ delivering: "delivering";
407
+ delivered: "delivered";
408
+ }>;
409
+ attempt: z.ZodNumber;
410
+ availableAt: z.ZodISODateTime;
411
+ leaseUntil: z.ZodOptional<z.ZodISODateTime>;
412
+ deliveredAt: z.ZodOptional<z.ZodISODateTime>;
413
+ lastError: z.ZodOptional<z.ZodString>;
414
+ createdAt: z.ZodISODateTime;
415
+ updatedAt: z.ZodISODateTime;
416
+ }, z.core.$strict>;
417
+ type OutboxMessage = z.infer<typeof outboxMessageSchema>;
418
+ declare const outboxQueueSchema: z.ZodObject<{
419
+ schemaVersion: z.ZodLiteral<1>;
420
+ id: z.ZodString;
421
+ messages: z.ZodArray<z.ZodObject<{
422
+ schemaVersion: z.ZodLiteral<1>;
423
+ id: z.ZodString;
424
+ event: z.ZodObject<{
425
+ eventId: z.ZodString;
426
+ repositoryIds: z.ZodArray<z.ZodString>;
427
+ taskId: z.ZodOptional<z.ZodString>;
428
+ changeId: z.ZodOptional<z.ZodString>;
429
+ replyTo: z.ZodObject<{
430
+ channel: z.ZodString;
431
+ address: z.ZodString;
432
+ }, z.core.$strict>;
433
+ outcome: z.ZodEnum<{
434
+ message: "message";
435
+ accepted: "accepted";
436
+ started: "started";
437
+ succeeded: "succeeded";
438
+ failed: "failed";
439
+ needs_human: "needs_human";
440
+ question: "question";
441
+ digest: "digest";
442
+ rolled_back: "rolled_back";
443
+ budget_warning: "budget_warning";
444
+ budget_exhausted: "budget_exhausted";
445
+ }>;
446
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
447
+ }, z.core.$strict>;
448
+ state: z.ZodEnum<{
449
+ pending: "pending";
450
+ delivering: "delivering";
451
+ delivered: "delivered";
452
+ }>;
453
+ attempt: z.ZodNumber;
454
+ availableAt: z.ZodISODateTime;
455
+ leaseUntil: z.ZodOptional<z.ZodISODateTime>;
456
+ deliveredAt: z.ZodOptional<z.ZodISODateTime>;
457
+ lastError: z.ZodOptional<z.ZodString>;
458
+ createdAt: z.ZodISODateTime;
459
+ updatedAt: z.ZodISODateTime;
460
+ }, z.core.$strict>>;
461
+ updatedAt: z.ZodISODateTime;
462
+ }, z.core.$strict>;
463
+ type OutboxQueue = z.infer<typeof outboxQueueSchema>;
464
+ //#endregion
465
+ //#region src/schema/receipt.d.ts
466
+ /** States the engine writes on transitions. Any vocabulary value is valid. */
467
+ declare const standardReceiptStates: readonly ["approved", "rejected", "queued", "dispatched", "stalled", "succeeded", "failed", "needs_human", "cancelled", "settled", "verifying", "ready", "merged", "deployed", "rolled_out", "rolled_back"];
468
+ /** Phases the standard loop uses. Any vocabulary value is valid. */
469
+ declare const standardReceiptPhases: readonly ["approval", "budget", "dispatch", "implementation", "verification", "pull_request", "cleanup"];
470
+ /** Kinds the standard loop writes: the standard task kinds plus "change". */
471
+ declare const standardReceiptKinds: readonly ["coordination", "code_change", "verification", "investigation", "question", "change"];
472
+ declare const receiptStateSchema: z.ZodString;
473
+ declare const receiptPhaseSchema: z.ZodString;
474
+ declare const receiptKindSchema: z.ZodString;
475
+ declare const costSchema: z.ZodObject<{
476
+ totalUsd: z.ZodNumber;
477
+ }, z.core.$strict>;
478
+ declare const receiptSchema: z.ZodObject<{
479
+ schemaVersion: z.ZodLiteral<1>;
480
+ receiptId: z.ZodString;
481
+ repositoryIds: z.ZodArray<z.ZodString>;
482
+ taskId: z.ZodOptional<z.ZodString>;
483
+ changeId: z.ZodOptional<z.ZodString>;
484
+ kind: z.ZodString;
485
+ state: z.ZodString;
486
+ phase: z.ZodOptional<z.ZodString>;
487
+ reason: z.ZodOptional<z.ZodString>;
488
+ attempt: z.ZodNumber;
489
+ cost: z.ZodOptional<z.ZodObject<{
490
+ totalUsd: z.ZodNumber;
491
+ }, z.core.$strict>>;
492
+ decidedBy: z.ZodOptional<z.ZodString>;
493
+ recordedAt: z.ZodISODateTime;
494
+ }, z.core.$strict>;
495
+ type ReceiptState = z.infer<typeof receiptStateSchema>;
496
+ type ReceiptPhase = z.infer<typeof receiptPhaseSchema>;
497
+ type ReceiptKind = z.infer<typeof receiptKindSchema>;
498
+ type Cost = z.infer<typeof costSchema>;
499
+ type Receipt = z.infer<typeof receiptSchema>;
500
+ //#endregion
501
+ //#region src/schema/repository.d.ts
502
+ declare const repositorySlugSchema: z.ZodString;
503
+ declare const repositorySchema: z.ZodObject<{
504
+ schemaVersion: z.ZodLiteral<1>;
505
+ id: z.ZodString;
506
+ slug: z.ZodString;
507
+ defaultBranch: z.ZodString;
508
+ enabled: z.ZodBoolean;
509
+ dependsOn: z.ZodArray<z.ZodString>;
510
+ devbox: z.ZodOptional<z.ZodObject<{
511
+ projectId: z.ZodString;
512
+ teamId: z.ZodString;
513
+ snapshot: z.ZodOptional<z.ZodString>;
514
+ }, z.core.$strict>>;
515
+ connectedAt: z.ZodISODateTime;
516
+ }, z.core.$strict>;
517
+ type RepositorySlug = z.infer<typeof repositorySlugSchema>;
518
+ type Repository = z.infer<typeof repositorySchema>;
519
+ //#endregion
520
+ //#region src/schema/signal.d.ts
521
+ /** Sources used by the standard connectors. Any vocabulary value is valid. */
522
+ declare const standardSignalSources: readonly ["github_issue", "github_pr", "github_pr_comment", "slack", "human", "github_ci_failure", "vercel_deploy_failure", "security_scan", "investigation", "api"];
523
+ declare const signalSourceSchema: z.ZodString;
524
+ declare const signalOutcomeSchema: z.ZodEnum<{
525
+ accepted: "accepted";
526
+ duplicate: "duplicate";
527
+ unactionable: "unactionable";
528
+ low_confidence: "low_confidence";
529
+ ignored: "ignored";
530
+ pending: "pending";
531
+ }>;
532
+ declare const signalSchema: z.ZodObject<{
533
+ schemaVersion: z.ZodLiteral<1>;
534
+ id: z.ZodString;
535
+ repositoryId: z.ZodString;
536
+ source: z.ZodString;
537
+ deliveryId: z.ZodString;
538
+ replyTo: z.ZodObject<{
539
+ channel: z.ZodString;
540
+ address: z.ZodString;
541
+ }, z.core.$strict>;
542
+ payload: z.ZodUnknown;
543
+ receivedAt: z.ZodISODateTime;
544
+ outcome: z.ZodEnum<{
545
+ accepted: "accepted";
546
+ duplicate: "duplicate";
547
+ unactionable: "unactionable";
548
+ low_confidence: "low_confidence";
549
+ ignored: "ignored";
550
+ pending: "pending";
551
+ }>;
552
+ detail: z.ZodOptional<z.ZodString>;
553
+ reason: z.ZodOptional<z.ZodString>;
554
+ decidedAt: z.ZodOptional<z.ZodISODateTime>;
555
+ }, z.core.$strict>;
556
+ type SignalSource = z.infer<typeof signalSourceSchema>;
557
+ type SignalOutcome = z.infer<typeof signalOutcomeSchema>;
558
+ type Signal = z.infer<typeof signalSchema>;
559
+ //#endregion
560
+ //#region src/store/engine.d.ts
561
+ /** An approval decision that does not apply to the task's current approval or state. */
562
+ declare class ApprovalError extends Error {
563
+ readonly taskId: TaskId;
564
+ readonly reason: string;
565
+ constructor(taskId: TaskId, reason: string);
566
+ }
567
+ /** A settlement that does not apply to the task's current state. */
568
+ declare class SettlementError extends Error {
569
+ readonly taskId: TaskId;
570
+ readonly reason: string;
571
+ constructor(taskId: TaskId, reason: string);
572
+ }
573
+ declare class ChangeAssociationError extends Error {
574
+ readonly taskId: TaskId;
575
+ readonly repositoryId: RepositoryId;
576
+ readonly reason: string;
577
+ constructor(taskId: TaskId, repositoryId: RepositoryId, reason: string);
578
+ }
579
+ declare class OutboxEventConflictError extends Error {
580
+ constructor(eventId: string);
581
+ }
582
+ declare class AnswerEventConflictError extends Error {
583
+ constructor(questionTaskId: TaskId);
584
+ }
585
+ interface CreateSignalInput {
586
+ repositoryId: RepositoryId;
587
+ source: SignalSource;
588
+ deliveryId: string;
589
+ replyTo: ReplyTo;
590
+ payload: unknown;
591
+ }
592
+ interface DecideSignalOptions {
593
+ detail?: string;
594
+ reason?: string;
595
+ }
596
+ interface CreateTaskInput {
597
+ repositoryIds: RepositoryId[];
598
+ kind: Task["kind"];
599
+ origin: Task["origin"];
600
+ replyTo: ReplyTo;
601
+ /** Same key creates one task and returns it on workflow retries. */
602
+ dedupeKey?: string;
603
+ area?: string;
604
+ changeId?: ChangeId;
605
+ dependsOn?: TaskId[];
606
+ question?: Task["question"];
607
+ /** Stamp the task as needing a human decision before dispatch. */
608
+ approval?: "required";
609
+ }
610
+ interface ApprovalDecision {
611
+ /** Authenticated operator making the decision. */
612
+ by: string;
613
+ reason?: string;
614
+ }
615
+ interface AnswerQuestionInput {
616
+ questionTaskId: TaskId;
617
+ answer: string;
618
+ answeredBy: string;
619
+ }
620
+ type TaskPatch = Partial<Pick<Task, "changeId" | "reportRef" | "reservedUsd" | "reservedAt" | "question">>;
621
+ /** One completed model step's usage, as eve's step.completed event carries it. */
622
+ interface StepUsage {
623
+ turnId: string;
624
+ stepIndex: number;
625
+ costUsd?: number;
626
+ inputTokens?: number;
627
+ outputTokens?: number;
628
+ cacheReadTokens?: number;
629
+ cacheWriteTokens?: number;
630
+ }
631
+ interface TaskTransitionOptions {
632
+ patch?: TaskPatch;
633
+ reason?: string;
634
+ /** Required when a non-question task waits, so validation is a direct read. */
635
+ questionTaskId?: TaskId;
636
+ /**
637
+ * Refuse unless the task is in this state at write time. Closes
638
+ * check-then-act races where the transition would also be legal from the
639
+ * state a concurrent writer moved the task into.
640
+ */
641
+ expectFrom?: TaskState;
642
+ }
643
+ interface CreateChangeInput {
644
+ repositoryId: RepositoryId;
645
+ taskId?: TaskId;
646
+ groupId?: TaskId;
647
+ prNumber: number;
648
+ prUrl: string;
649
+ author: string;
650
+ risk: Level;
651
+ confidence: Level;
652
+ evidence: Change["evidence"];
653
+ }
654
+ type ChangePatch = Partial<Pick<Change, "confidence" | "evidence" | "decidedBy" | "mergeSha">>;
655
+ interface ChangeTransitionOptions {
656
+ patch?: ChangePatch;
657
+ reason?: string;
658
+ }
659
+ interface EnsureBudgetInput {
660
+ factoryId: FactoryId;
661
+ month: string;
662
+ limits: Budget["limits"];
663
+ }
664
+ interface SettleTaskOptions {
665
+ reason?: string;
666
+ }
667
+ interface AppendReceiptInput {
668
+ repositoryIds: RepositoryId[];
669
+ taskId?: TaskId;
670
+ changeId?: ChangeId;
671
+ kind: string;
672
+ state: string;
673
+ phase?: string;
674
+ reason?: string;
675
+ attempt?: number;
676
+ cost?: Cost;
677
+ decidedBy?: string;
678
+ /** Same key twice appends one receipt and returns the existing one. */
679
+ dedupeKey?: string;
680
+ }
681
+ declare class SessionConflictError extends Error {}
682
+ interface FactoryStores {
683
+ driverName: string;
684
+ sessions: {
685
+ create(input: Omit<AgentSession, "schemaVersion" | "id" | "createdAt" | "execution" | "taskId" | "notifications"> & {
686
+ operationId: string;
687
+ }): Promise<AgentSession>;
688
+ get(id: string): Promise<AgentSession | null>;
689
+ list(): Promise<AgentSession[]>;
690
+ bind(id: string, reference: {
691
+ taskId: TaskId;
692
+ } | {
693
+ execution: ExecutionReference;
694
+ }): Promise<AgentSession>;
695
+ notify(event: CommunicationEvent): Promise<void>;
696
+ };
697
+ repositories: {
698
+ put(repository: Repository): Promise<Repository>;
699
+ get(id: RepositoryId): Promise<Repository | null>;
700
+ list(): Promise<Repository[]>;
701
+ };
702
+ signals: {
703
+ create(input: CreateSignalInput): Promise<Signal>;
704
+ get(id: SignalId): Promise<Signal | null>;
705
+ decide(id: SignalId, outcome: SignalOutcome, options?: DecideSignalOptions): Promise<Signal>;
706
+ list(): Promise<Signal[]>;
707
+ };
708
+ tasks: {
709
+ create(input: CreateTaskInput): Promise<Task>;
710
+ get(id: TaskId): Promise<Task | null>;
711
+ transition(id: TaskId, to: TaskState, options?: TaskTransitionOptions): Promise<Task>;
712
+ answerQuestion(input: AnswerQuestionInput): Promise<{
713
+ answerEvent: AnswerEvent;
714
+ questionTask: Task;
715
+ parentTask: Task | null;
716
+ }>;
717
+ /** Grant a required approval. The task stays queued; dispatch may now take it. */
718
+ approve(id: TaskId, decision: ApprovalDecision): Promise<Task>;
719
+ /** Deny a required approval. The task is cancelled with the reason. */
720
+ reject(id: TaskId, decision: ApprovalDecision): Promise<Task>;
721
+ /**
722
+ * Record the provider's handle on the running attempt's execution, so the
723
+ * reconciler can inspect or cancel it. Refused unless the task is running.
724
+ */
725
+ recordExecution(id: TaskId, execution: ExecutionReference): Promise<Task>;
726
+ /** Add one model step's usage to the task. Idempotent per (turnId, stepIndex). Never settles. */
727
+ recordUsage(id: TaskId, step: StepUsage): Promise<Task>;
728
+ /**
729
+ * Record measured cost on a terminal task. Idempotent: an already settled
730
+ * task returns unchanged and writes no second receipt.
731
+ */
732
+ settle(id: TaskId, cost: Cost, options?: SettleTaskOptions): Promise<Task>;
733
+ list(): Promise<Task[]>;
734
+ };
735
+ changes: {
736
+ create(input: CreateChangeInput): Promise<Change>;
737
+ get(id: ChangeId): Promise<Change | null>;
738
+ transition(id: ChangeId, to: ChangeState, options?: ChangeTransitionOptions): Promise<Change>;
739
+ list(): Promise<Change[]>;
740
+ };
741
+ receipts: {
742
+ append(input: AppendReceiptInput): Promise<Receipt>;
743
+ get(id: string): Promise<Receipt | null>;
744
+ list(): Promise<Receipt[]>;
745
+ };
746
+ budgets: {
747
+ /**
748
+ * Insert-once per month; refreshes limits when configuration changed and
749
+ * preserves notices. Safe under concurrent sweeps.
750
+ */
751
+ ensure(input: EnsureBudgetInput): Promise<Budget>;
752
+ get(month: string): Promise<Budget | null>;
753
+ /**
754
+ * Write-once notice stamp. `stamped` is false when the notice was already
755
+ * set or a concurrent stamp won, so callers notify at most once.
756
+ */
757
+ stampNotice(month: string, notice: "warning" | "exhausted"): Promise<{
758
+ budget: Budget;
759
+ stamped: boolean;
760
+ }>;
761
+ };
762
+ answers: {
763
+ get(id: AnswerId): Promise<AnswerEvent | null>;
764
+ };
765
+ outbox: {
766
+ enqueue(event: CommunicationEvent): Promise<OutboxMessage>;
767
+ get(id: OutboxId): Promise<OutboxMessage | null>;
768
+ claim(id: OutboxId, leaseMs?: number): Promise<OutboxMessage | null>;
769
+ retry(id: OutboxId, attempt: number, reason: string, delayMs: number): Promise<OutboxMessage | null>;
770
+ complete(id: OutboxId, attempt: number): Promise<OutboxMessage | null>;
771
+ pending(limit?: number): Promise<OutboxMessage[]>;
772
+ };
773
+ }
774
+ interface CreateStoresOptions {
775
+ driver: StoreDriver;
776
+ now?: () => string;
777
+ }
778
+ declare function createStores(options: CreateStoresOptions): FactoryStores;
779
+ //#endregion
780
+ export { Change as $, outboxIdSchema as $t, standardSignalSources as A, coordinationRepositoryIdsSchema as At, costSchema as B, taskStateSchema as Bt, createStores as C, answerEventSchema as Ct, signalOutcomeSchema as D, TaskKind as Dt, SignalSource as E, TaskApproval as Et, Cost as F, taskExecutionRepositoryIdsSchema as Ft, standardReceiptKinds as G, OutboxId as Gt, receiptPhaseSchema as H, AnswerId as Ht, Receipt as I, taskKindSchema as It, OutboxMessage as J, SignalId as Jt, standardReceiptPhases as K, ReceiptId as Kt, ReceiptKind as L, taskOriginSchema as Lt, RepositorySlug as M, harnessSchema as Mt, repositorySchema as N, standardTaskKinds as Nt, signalSchema as O, TaskState as Ot, repositorySlugSchema as P, taskApprovalSchema as Pt, outboxStateSchema as Q, factoryIdSchema as Qt, ReceiptPhase as R, taskQuestionSchema as Rt, TaskTransitionOptions as S, AnswerEvent as St, SignalOutcome as T, Task as Tt, receiptSchema as U, ChangeId as Ut, receiptKindSchema as V, taskUsageSchema as Vt, receiptStateSchema as W, FactoryId as Wt, outboxMessageSchema as X, answerIdSchema as Xt, OutboxQueue as Y, TaskId as Yt, outboxQueueSchema as Z, changeIdSchema as Zt, SessionConflictError as _, usdSchema as _t, ApprovalError as a, Budget as an, changeStateSchema as at, StepUsage as b, agentSessionIdSchema as bt, ChangeTransitionOptions as c, budgetMonthSchema as cn, CommunicationOutcome as ct, CreateStoresOptions as d, communicationOutcomes as dt, receiptIdSchema as en, ChangeEvidence as et, CreateTaskInput as f, ReplyTo as ft, OutboxEventConflictError as g, schemaVersionSchema as gt, FactoryStores as h, replyToSchema as ht, ApprovalDecision as i, taskIdSchema as in, changeSchema as it, Repository as j, executionReferenceSchema as jt, signalSourceSchema as k, TaskUsage as kt, CreateChangeInput as l, budgetSchema as ln, communicationEventSchema as lt, EnsureBudgetInput as m, isoDateTimeSchema as mt, AnswerQuestionInput as n, repositoryIdsSchema as nn, Level as nt, ChangeAssociationError as o, BudgetLimits as on, levelSchema as ot, DecideSignalOptions as p, SCHEMA_VERSION as pt, standardReceiptStates as q, RepositoryId as qt, AppendReceiptInput as r, signalIdSchema as rn, changeEvidenceSchema as rt, ChangePatch as s, budgetLimitsSchema as sn, CommunicationEvent as st, AnswerEventConflictError as t, repositoryIdSchema as tn, ChangeState as tt, CreateSignalInput as u, communicationOutcomeSchema as ut, SettleTaskOptions as v, vocabularySchema as vt, Signal as w, ExecutionReference as wt, TaskPatch as x, agentSessionSchema as xt, SettlementError as y, AgentSession as yt, ReceiptState as z, taskSchema as zt };
781
+ //# sourceMappingURL=engine-DFHU2Pe-.d.mts.map