@vercel/factory 0.0.3 → 0.0.4

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 (70) hide show
  1. package/dist/approval-h5aj8HYN.d.mts +510 -0
  2. package/dist/blob/index.d.mts +32 -0
  3. package/dist/blob/index.mjs +141 -0
  4. package/dist/blob/index.mjs.map +1 -0
  5. package/dist/connectors/index.d.mts +2 -0
  6. package/dist/connectors/index.mjs +49 -0
  7. package/dist/connectors/index.mjs.map +1 -0
  8. package/dist/driver-Bbd25rNM.mjs +23 -0
  9. package/dist/driver-Bbd25rNM.mjs.map +1 -0
  10. package/dist/driver-CrZsy7sm.d.mts +34 -0
  11. package/dist/eve/index.d.mts +1057 -0
  12. package/dist/eve/index.mjs +777 -0
  13. package/dist/eve/index.mjs.map +1 -0
  14. package/dist/github-5qQPCaXj.d.mts +123 -0
  15. package/dist/github.d.mts +2 -0
  16. package/dist/github.mjs +286 -0
  17. package/dist/github.mjs.map +1 -0
  18. package/dist/id-DwCihQr4.mjs +31 -0
  19. package/dist/id-DwCihQr4.mjs.map +1 -0
  20. package/dist/index-WNGZJRRH.d.mts +67 -0
  21. package/dist/index.d.mts +175 -0
  22. package/dist/index.mjs +882 -0
  23. package/dist/index.mjs.map +1 -0
  24. package/dist/next-page.d.mts +5 -0
  25. package/dist/next-page.mjs +71 -0
  26. package/dist/next-page.mjs.map +1 -0
  27. package/dist/next.d.mts +12 -0
  28. package/dist/{next.js → next.mjs} +13 -14
  29. package/dist/next.mjs.map +1 -0
  30. package/dist/postgres/index.d.mts +137 -0
  31. package/dist/postgres/index.mjs +96 -0
  32. package/dist/postgres/index.mjs.map +1 -0
  33. package/dist/signal-CHVEmzvI.d.mts +59 -0
  34. package/dist/task-Cj7Ei9Nh.mjs +336 -0
  35. package/dist/task-Cj7Ei9Nh.mjs.map +1 -0
  36. package/package.json +25 -22
  37. package/dist/approval-Z7iaWibT.d.ts +0 -541
  38. package/dist/blob/index.d.ts +0 -26
  39. package/dist/blob/index.js +0 -127
  40. package/dist/blob/index.js.map +0 -1
  41. package/dist/chunk-2JFES6BA.js +0 -41
  42. package/dist/chunk-2JFES6BA.js.map +0 -1
  43. package/dist/chunk-CEF6VJZC.js +0 -28
  44. package/dist/chunk-CEF6VJZC.js.map +0 -1
  45. package/dist/chunk-D2XMABG4.js +0 -311
  46. package/dist/chunk-D2XMABG4.js.map +0 -1
  47. package/dist/chunk-EFL4PDDE.js +0 -325
  48. package/dist/chunk-EFL4PDDE.js.map +0 -1
  49. package/dist/common-CaHaEOAS.d.ts +0 -18
  50. package/dist/connectors/index.d.ts +0 -53
  51. package/dist/connectors/index.js +0 -64
  52. package/dist/connectors/index.js.map +0 -1
  53. package/dist/driver-tRNggCCJ.d.ts +0 -32
  54. package/dist/eve/index.d.ts +0 -1053
  55. package/dist/eve/index.js +0 -752
  56. package/dist/eve/index.js.map +0 -1
  57. package/dist/github.d.ts +0 -139
  58. package/dist/github.js +0 -27
  59. package/dist/github.js.map +0 -1
  60. package/dist/index.d.ts +0 -164
  61. package/dist/index.js +0 -940
  62. package/dist/index.js.map +0 -1
  63. package/dist/next-page.d.ts +0 -5
  64. package/dist/next-page.js +0 -75
  65. package/dist/next-page.js.map +0 -1
  66. package/dist/next.d.ts +0 -12
  67. package/dist/next.js.map +0 -1
  68. package/dist/postgres/index.d.ts +0 -137
  69. package/dist/postgres/index.js +0 -118
  70. package/dist/postgres/index.js.map +0 -1
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ //#region src/schema/common.ts
3
+ const SCHEMA_VERSION = 1;
4
+ const schemaVersionSchema = z.literal(1).describe("Version of the entity schema this row was written with.");
5
+ const isoDateTimeSchema = z.iso.datetime().describe("UTC timestamp in ISO 8601 format, e.g. 2026-08-26T12:00:00Z.");
6
+ const usdSchema = z.number().finite().nonnegative().describe("Amount in US dollars.");
7
+ /**
8
+ * Open vocabulary value. Standard values ship as exported constants; custom
9
+ * values matching the pattern are equally valid.
10
+ */
11
+ const vocabularySchema = z.string().regex(/^[a-z][a-z0-9_]{0,63}$/, "must be lowercase snake_case starting with a letter").describe("Lowercase snake_case name, e.g. github_issue or sentry_alert.");
12
+ const replyToSchema = z.strictObject({
13
+ channel: z.string().min(1).describe("Connector that should carry replies, e.g. github or slack."),
14
+ address: z.string().min(1).describe("Connector-specific reply address, e.g. acme/web#41 or a Slack thread id.")
15
+ });
16
+ //#endregion
17
+ //#region src/schema/id.ts
18
+ function idSchema(prefix) {
19
+ return z.string().regex(new RegExp(`^${prefix}_[a-z0-9]{6,64}$`));
20
+ }
21
+ const factoryIdSchema = idSchema("fac");
22
+ const repositoryIdSchema = idSchema("repo");
23
+ const signalIdSchema = idSchema("sig");
24
+ const taskIdSchema = idSchema("task");
25
+ const changeIdSchema = idSchema("chg");
26
+ const receiptIdSchema = idSchema("rcpt");
27
+ const repositoryIdsSchema = z.array(repositoryIdSchema).min(1);
28
+ //#endregion
29
+ export { repositoryIdsSchema as a, SCHEMA_VERSION as c, schemaVersionSchema as d, usdSchema as f, repositoryIdSchema as i, isoDateTimeSchema as l, factoryIdSchema as n, signalIdSchema as o, vocabularySchema as p, receiptIdSchema as r, taskIdSchema as s, changeIdSchema as t, replyToSchema as u };
30
+
31
+ //# sourceMappingURL=id-DwCihQr4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id-DwCihQr4.mjs","names":[],"sources":["../src/schema/common.ts","../src/schema/id.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const SCHEMA_VERSION = 1;\n\nexport const schemaVersionSchema = z\n .literal(SCHEMA_VERSION)\n .describe(\"Version of the entity schema this row was written with.\");\n\nexport const isoDateTimeSchema = z.iso\n .datetime()\n .describe(\"UTC timestamp in ISO 8601 format, e.g. 2026-08-26T12:00:00Z.\");\n\nexport const usdSchema = z.number().finite().nonnegative().describe(\"Amount in US dollars.\");\n\n/**\n * Open vocabulary value. Standard values ship as exported constants; custom\n * values matching the pattern are equally valid.\n */\nexport const vocabularySchema = z\n .string()\n .regex(/^[a-z][a-z0-9_]{0,63}$/, \"must be lowercase snake_case starting with a letter\")\n .describe(\"Lowercase snake_case name, e.g. github_issue or sentry_alert.\");\n\nexport const replyToSchema = z.strictObject({\n channel: z\n .string()\n .min(1)\n .describe(\"Connector that should carry replies, e.g. github or slack.\"),\n address: z\n .string()\n .min(1)\n .describe(\"Connector-specific reply address, e.g. acme/web#41 or a Slack thread id.\"),\n});\n\nexport type ReplyTo = z.infer<typeof replyToSchema>;\n","import { z } from \"zod\";\n\nfunction idSchema(prefix: string) {\n return z.string().regex(new RegExp(`^${prefix}_[a-z0-9]{6,64}$`));\n}\n\nexport const factoryIdSchema = idSchema(\"fac\");\nexport const repositoryIdSchema = idSchema(\"repo\");\nexport const signalIdSchema = idSchema(\"sig\");\nexport const taskIdSchema = idSchema(\"task\");\nexport const changeIdSchema = idSchema(\"chg\");\nexport const receiptIdSchema = idSchema(\"rcpt\");\n\nexport const repositoryIdsSchema = z.array(repositoryIdSchema).min(1);\n\nexport type FactoryId = z.infer<typeof factoryIdSchema>;\nexport type RepositoryId = z.infer<typeof repositoryIdSchema>;\nexport type SignalId = z.infer<typeof signalIdSchema>;\nexport type TaskId = z.infer<typeof taskIdSchema>;\nexport type ChangeId = z.infer<typeof changeIdSchema>;\nexport type ReceiptId = z.infer<typeof receiptIdSchema>;\n"],"mappings":";;AAEA,MAAa,iBAAiB;AAE9B,MAAa,sBAAsB,EAChC,QAAA,CAAsB,CAAC,CACvB,SAAS,yDAAyD;AAErE,MAAa,oBAAoB,EAAE,IAChC,SAAS,CAAC,CACV,SAAS,8DAA8D;AAE1E,MAAa,YAAY,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,uBAAuB;;;;;AAM3F,MAAa,mBAAmB,EAC7B,OAAO,CAAC,CACR,MAAM,0BAA0B,qDAAqD,CAAC,CACtF,SAAS,+DAA+D;AAE3E,MAAa,gBAAgB,EAAE,aAAa;CAC1C,SAAS,EACN,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SAAS,4DAA4D;CACxE,SAAS,EACN,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SAAS,0EAA0E;AACxF,CAAC;;;AC9BD,SAAS,SAAS,QAAgB;CAChC,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,IAAI,OAAO,IAAI,OAAO,iBAAiB,CAAC;AAClE;AAEA,MAAa,kBAAkB,SAAS,KAAK;AAC7C,MAAa,qBAAqB,SAAS,MAAM;AACjD,MAAa,iBAAiB,SAAS,KAAK;AAC5C,MAAa,eAAe,SAAS,MAAM;AAC3C,MAAa,iBAAiB,SAAS,KAAK;AAC5C,MAAa,kBAAkB,SAAS,MAAM;AAE9C,MAAa,sBAAsB,EAAE,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { c as ReplyTo, r as SignalSource } from "./signal-CHVEmzvI.mjs";
2
+ import { z } from "zod";
3
+ //#region src/connectors/index.d.ts
4
+ interface WebhookEvent {
5
+ deliveryId: string;
6
+ event: string;
7
+ payload: unknown;
8
+ }
9
+ interface NormalizedSignal<TSource extends SignalSource = SignalSource> {
10
+ source: TSource;
11
+ deliveryId: string;
12
+ replyTo: ReplyTo;
13
+ payload: unknown;
14
+ }
15
+ type SignalNormalizer<TSignal extends NormalizedSignal = NormalizedSignal> = (event: WebhookEvent) => TSignal | null;
16
+ declare const communicationOutcomes: readonly ["accepted", "started", "succeeded", "failed", "needs_human", "question", "digest", "rolled_back", "budget_warning", "budget_exhausted", "message"];
17
+ declare const communicationOutcomeSchema: z.ZodEnum<{
18
+ message: "message";
19
+ succeeded: "succeeded";
20
+ failed: "failed";
21
+ needs_human: "needs_human";
22
+ question: "question";
23
+ accepted: "accepted";
24
+ rolled_back: "rolled_back";
25
+ started: "started";
26
+ digest: "digest";
27
+ budget_warning: "budget_warning";
28
+ budget_exhausted: "budget_exhausted";
29
+ }>;
30
+ declare const communicationEventSchema: z.ZodObject<{
31
+ eventId: z.ZodString;
32
+ repositoryId: z.ZodString;
33
+ taskId: z.ZodOptional<z.ZodString>;
34
+ changeId: z.ZodOptional<z.ZodString>;
35
+ replyTo: z.ZodObject<{
36
+ channel: z.ZodString;
37
+ address: z.ZodString;
38
+ }, z.core.$strict>;
39
+ outcome: z.ZodEnum<{
40
+ message: "message";
41
+ succeeded: "succeeded";
42
+ failed: "failed";
43
+ needs_human: "needs_human";
44
+ question: "question";
45
+ accepted: "accepted";
46
+ rolled_back: "rolled_back";
47
+ started: "started";
48
+ digest: "digest";
49
+ budget_warning: "budget_warning";
50
+ budget_exhausted: "budget_exhausted";
51
+ }>;
52
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
53
+ }, z.core.$strict>;
54
+ type CommunicationOutcome = z.infer<typeof communicationOutcomeSchema>;
55
+ type CommunicationEvent = z.infer<typeof communicationEventSchema>;
56
+ interface CommunicationAdapter {
57
+ readonly channel: string;
58
+ deliver(event: CommunicationEvent): Promise<void>;
59
+ }
60
+ interface CommunicationRouter {
61
+ readonly channels: readonly string[];
62
+ deliver(event: CommunicationEvent): Promise<void>;
63
+ }
64
+ declare function createCommunicationRouter(adapters: readonly CommunicationAdapter[]): CommunicationRouter;
65
+ //#endregion
66
+ export { NormalizedSignal as a, communicationEventSchema as c, createCommunicationRouter as d, CommunicationRouter as i, communicationOutcomeSchema as l, CommunicationEvent as n, SignalNormalizer as o, CommunicationOutcome as r, WebhookEvent as s, CommunicationAdapter as t, communicationOutcomes as u };
67
+ //# sourceMappingURL=index-WNGZJRRH.d.mts.map
@@ -0,0 +1,175 @@
1
+ import { a as StoredEntry, i as StoreDriver, n as RecordExistsError, o as StoredRecord, r as RecordNotFoundError, s as VersionConflictError, t as CollectionName } from "./driver-CrZsy7sm.mjs";
2
+ import { a as signalSchema, c as ReplyTo, d as replyToSchema, f as schemaVersionSchema, i as signalOutcomeSchema, l as SCHEMA_VERSION, m as vocabularySchema, n as SignalOutcome, o as signalSourceSchema, p as usdSchema, r as SignalSource, s as standardSignalSources, t as Signal, u as isoDateTimeSchema } from "./signal-CHVEmzvI.mjs";
3
+ import { $ as ReceiptPhase, A as TaskPatch, B as taskDevboxSchema, C as ChangeTransitionOptions, Ct as changeIdSchema, D as CreateTaskInput, Dt as repositoryIdsSchema, E as CreateStoresOptions, Et as repositoryIdSchema, F as TaskKind, G as taskStateSchema, H as taskOriginSchema, I as TaskState, J as repositorySchema, K as Repository, L as harnessSchema, M as createStores, N as Task, O as DecideSignalOptions, Ot as signalIdSchema, P as TaskApproval, Q as ReceiptKind, R as standardTaskKinds, S as ChangePatch, St as TaskId, T as CreateSignalInput, Tt as receiptIdSchema, U as taskQuestionSchema, V as taskKindSchema, W as taskSchema, X as Cost, Y as repositorySlugSchema, Z as Receipt, _ as findingVerificationMethodSchema, _t as ChangeId, a as approvalRuleSchema, at as receiptStateSchema, b as ApprovalDecision, bt as RepositoryId, c as Finding, ct as standardReceiptStates, d as FindingVerification, dt as ChangeState, et as ReceiptState, f as findingCategorySchema, ft as Level, g as findingVerificationLevelSchema, gt as levelSchema, h as findingSchema, ht as changeStateSchema, i as approvalPolicySchema, it as receiptSchema, j as TaskTransitionOptions, k as FactoryStores, kt as taskIdSchema, l as FindingCategory, lt as Change, m as findingPrioritySchema, mt as changeSchema, n as ApprovalRule, nt as receiptKindSchema, o as defaultApprovalPolicy, ot as standardReceiptKinds, p as findingFingerprint, pt as changeEvidenceSchema, q as RepositorySlug, r as ApprovalSubject, rt as receiptPhaseSchema, s as requiresApproval, st as standardReceiptPhases, t as ApprovalPolicy, tt as costSchema, u as FindingPriority, ut as ChangeEvidence, v as findingVerificationSchema, vt as FactoryId, w as CreateChangeInput, wt as factoryIdSchema, x as ApprovalError, xt as SignalId, y as AppendReceiptInput, yt as ReceiptId, z as taskApprovalSchema } from "./approval-h5aj8HYN.mjs";
4
+ import { z } from "zod";
5
+ import { EveNextConfig, EveNextConfigFunction, EveNextConfigInput } from "eve/next";
6
+ //#region src/briefs.d.ts
7
+ /** The finding behind a task, when its signal carries one. */
8
+ declare function findingForTask(stores: FactoryStores, task: Task): Promise<Finding | null>;
9
+ /**
10
+ * The foreman's starting message for a fix task: facts only, never the
11
+ * reporter's reasoning. The finding text is untrusted data and is labelled so.
12
+ */
13
+ declare function fixBrief(task: Task, repository: Repository, finding: Finding | null): string;
14
+ /** The scanner's starting message for a scan task. */
15
+ declare function scanBrief(task: Task, repository: Repository): string;
16
+ //#endregion
17
+ //#region src/schema/factory-config.d.ts
18
+ declare const factoryConfigRepositorySchema: z.ZodObject<{
19
+ slug: z.ZodString;
20
+ dependsOn: z.ZodDefault<z.ZodArray<z.ZodString>>;
21
+ }, z.core.$strict>;
22
+ declare const factoryConfigSchema: z.ZodObject<{
23
+ connectors: z.ZodDefault<z.ZodObject<{
24
+ github: z.ZodArray<z.ZodObject<{
25
+ owner: z.ZodString;
26
+ connector: z.ZodString;
27
+ }, z.core.$strict>>;
28
+ }, z.core.$strict>>;
29
+ repositories: z.ZodArray<z.ZodObject<{
30
+ slug: z.ZodString;
31
+ dependsOn: z.ZodDefault<z.ZodArray<z.ZodString>>;
32
+ }, z.core.$strict>>;
33
+ operators: z.ZodArray<z.ZodString>;
34
+ approval: z.ZodDefault<z.ZodArray<z.ZodObject<{
35
+ source: z.ZodOptional<z.ZodString>;
36
+ kind: z.ZodOptional<z.ZodString>;
37
+ priority: z.ZodOptional<z.ZodArray<z.ZodEnum<{
38
+ P0: "P0";
39
+ P1: "P1";
40
+ P2: "P2";
41
+ P3: "P3";
42
+ }>>>;
43
+ require: z.ZodBoolean;
44
+ }, z.core.$strict>>>;
45
+ }, z.core.$strict>;
46
+ type FactoryConfig = z.infer<typeof factoryConfigSchema>;
47
+ type FactoryConfigInput = z.input<typeof factoryConfigSchema>;
48
+ declare function defineFactory(config: FactoryConfigInput): FactoryConfig;
49
+ //#endregion
50
+ //#region src/build-factory.d.ts
51
+ interface FactoryArgs<TConfig extends EveNextConfig = EveNextConfig> {
52
+ factoryConfig: FactoryConfigInput;
53
+ nextConfig: EveNextConfigInput<TConfig>;
54
+ root?: string;
55
+ }
56
+ declare function buildFactory<TConfig extends EveNextConfig>({ factoryConfig, nextConfig, root }: FactoryArgs<TConfig>): EveNextConfigFunction<TConfig>;
57
+ //#endregion
58
+ //#region src/dispatch.d.ts
59
+ declare class DispatchRefusedError extends Error {
60
+ readonly taskId: TaskId;
61
+ readonly reason: string;
62
+ constructor(taskId: TaskId, reason: string);
63
+ }
64
+ interface DispatchOptions {
65
+ /**
66
+ * Starts the durable execution for the task (an Eve agent run). Runs after
67
+ * the task has won the queued -> running transition. The execution owns its
68
+ * own provisioning: it creates its Devbox as its first step and patches the
69
+ * task record with the result.
70
+ */
71
+ launch: (task: Task) => Promise<void>;
72
+ /** How many launches to try before the task fails for good; a failure re-queues for the next sweep. */
73
+ maxLaunchAttempts?: number;
74
+ }
75
+ declare const DEFAULT_MAX_LAUNCH_ATTEMPTS = 45;
76
+ /**
77
+ * The handshake between recorded work and execution: win the store-gated
78
+ * transition (at most one dispatcher can succeed), then start the run. A
79
+ * launch failure re-queues the task (bumping its attempt) until the attempt
80
+ * limit, then fails it; a crash between the transition and the launch leaves
81
+ * a running task with no execution, which the sweep reaps.
82
+ */
83
+ declare function dispatchTask(stores: FactoryStores, taskId: TaskId, options: DispatchOptions): Promise<Task>;
84
+ //#endregion
85
+ //#region src/schema/budget.d.ts
86
+ declare const budgetMonthSchema: z.ZodString;
87
+ declare const budgetSchema: z.ZodObject<{
88
+ schemaVersion: z.ZodLiteral<1>;
89
+ factoryId: z.ZodString;
90
+ month: z.ZodString;
91
+ limits: z.ZodObject<{
92
+ totalUsd: z.ZodNumber;
93
+ investigationUsd: z.ZodNumber;
94
+ perTaskReservationUsd: z.ZodNumber;
95
+ warningPercent: z.ZodNumber;
96
+ perRepositoryUsd: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
97
+ }, z.core.$strict>;
98
+ notices: z.ZodObject<{
99
+ warningAt: z.ZodOptional<z.ZodISODateTime>;
100
+ exhaustedAt: z.ZodOptional<z.ZodISODateTime>;
101
+ }, z.core.$strict>;
102
+ }, z.core.$strict>;
103
+ type Budget = z.infer<typeof budgetSchema>;
104
+ //#endregion
105
+ //#region src/schema/transitions.d.ts
106
+ type TransitionActor = "system" | "reconciler" | "foreman" | "operator" | "webhook" | "human";
107
+ interface Transition<State extends string> {
108
+ readonly from: State;
109
+ readonly to: State;
110
+ readonly trigger: string;
111
+ readonly actor: TransitionActor;
112
+ }
113
+ declare const taskInitialState = "queued";
114
+ declare const taskTransitions: readonly Transition<TaskState>[];
115
+ declare const changeInitialState = "verifying";
116
+ declare const changeTransitions: readonly Transition<ChangeState>[];
117
+ declare const signalInitialOutcome = "pending";
118
+ declare const signalOutcomeTransitions: readonly Transition<SignalOutcome>[];
119
+ declare function isTransitionAllowed<State extends string>(transitions: readonly Transition<State>[], from: State, to: State): boolean;
120
+ declare function legalNextStates<State extends string>(transitions: readonly Transition<State>[], from: State): readonly State[];
121
+ declare class InvalidTransitionError<State extends string> extends Error {
122
+ readonly from: State;
123
+ readonly to: State;
124
+ readonly legalNextStates: readonly State[];
125
+ constructor(from: State, to: State, legal: readonly State[]);
126
+ }
127
+ declare function assertTransition<State extends string>(transitions: readonly Transition<State>[], from: State, to: State): void;
128
+ declare function terminalStates<State extends string>(transitions: readonly Transition<State>[]): readonly State[];
129
+ //#endregion
130
+ //#region src/signals.d.ts
131
+ interface SignalCreator {
132
+ create(input: CreateSignalInput): Promise<Signal>;
133
+ }
134
+ /**
135
+ * Bind normalized intake to signal creation alone. Connectors and API routes
136
+ * own authentication and normalization; configured workflows own what happens
137
+ * next.
138
+ */
139
+ declare function createSignalCreator(stores: Pick<FactoryStores, "signals">): SignalCreator;
140
+ //#endregion
141
+ //#region src/store/memory.d.ts
142
+ declare function createInMemoryDriver(): StoreDriver;
143
+ //#endregion
144
+ //#region src/sweep.d.ts
145
+ /** Starts the agent for one task kind. Supplied by the app, which knows its agents' addresses. */
146
+ type TaskLauncher = (task: Task, repository: Repository) => Promise<void>;
147
+ interface SweepOptions {
148
+ /** Launcher per task kind, e.g. code_change -> foreman, security_scan -> security-scanner. */
149
+ launchers: Readonly<Record<string, TaskLauncher>>;
150
+ }
151
+ interface SweepResult {
152
+ dispatched: string[];
153
+ /** Tasks left in the queue and why: awaiting approval, no launcher, missing repository. */
154
+ skipped: {
155
+ taskId: string;
156
+ reason: string;
157
+ }[];
158
+ /** Tasks whose launch threw; dispatchTask has already recorded them as failed. */
159
+ failed: {
160
+ taskId: string;
161
+ reason: string;
162
+ }[];
163
+ }
164
+ /**
165
+ * One pass of the factory's dispatcher, meant to run on a schedule inside the
166
+ * deployment: every queued task that is allowed to run is started, in
167
+ * creation order. Nothing outside the factory ever starts an agent; the CLI
168
+ * and the dashboard only write tasks and approvals, and this picks them up.
169
+ * Idempotent by construction: dispatchTask's single-winner transition means
170
+ * two overlapping sweeps cannot start the same task twice.
171
+ */
172
+ declare function sweepQueued(stores: FactoryStores, options: SweepOptions): Promise<SweepResult>;
173
+ //#endregion
174
+ export { AppendReceiptInput, ApprovalDecision, ApprovalError, ApprovalPolicy, ApprovalRule, ApprovalSubject, Budget, Change, ChangeEvidence, ChangeId, ChangePatch, ChangeState, ChangeTransitionOptions, CollectionName, Cost, CreateChangeInput, CreateSignalInput, CreateStoresOptions, CreateTaskInput, DEFAULT_MAX_LAUNCH_ATTEMPTS, DecideSignalOptions, DispatchOptions, DispatchRefusedError, FactoryArgs, FactoryConfig, FactoryConfigInput, FactoryId, FactoryStores, Finding, FindingCategory, FindingPriority, FindingVerification, InvalidTransitionError, Level, Receipt, ReceiptId, ReceiptKind, ReceiptPhase, ReceiptState, RecordExistsError, RecordNotFoundError, ReplyTo, Repository, RepositoryId, RepositorySlug, SCHEMA_VERSION, Signal, SignalCreator, SignalId, SignalOutcome, SignalSource, StoreDriver, StoredEntry, StoredRecord, SweepOptions, SweepResult, Task, TaskApproval, TaskId, TaskKind, TaskLauncher, TaskPatch, TaskState, TaskTransitionOptions, Transition, TransitionActor, VersionConflictError, approvalPolicySchema, approvalRuleSchema, assertTransition, budgetMonthSchema, budgetSchema, buildFactory, changeEvidenceSchema, changeIdSchema, changeInitialState, changeSchema, changeStateSchema, changeTransitions, costSchema, createInMemoryDriver, createSignalCreator, createStores, defaultApprovalPolicy, defineFactory, dispatchTask, factoryConfigRepositorySchema, factoryConfigSchema, factoryIdSchema, findingCategorySchema, findingFingerprint, findingForTask, findingPrioritySchema, findingSchema, findingVerificationLevelSchema, findingVerificationMethodSchema, findingVerificationSchema, fixBrief, harnessSchema, isTransitionAllowed, isoDateTimeSchema, legalNextStates, levelSchema, receiptIdSchema, receiptKindSchema, receiptPhaseSchema, receiptSchema, receiptStateSchema, replyToSchema, repositoryIdSchema, repositoryIdsSchema, repositorySchema, repositorySlugSchema, requiresApproval, scanBrief, schemaVersionSchema, signalIdSchema, signalInitialOutcome, signalOutcomeSchema, signalOutcomeTransitions, signalSchema, signalSourceSchema, standardReceiptKinds, standardReceiptPhases, standardReceiptStates, standardSignalSources, standardTaskKinds, sweepQueued, taskApprovalSchema, taskDevboxSchema, taskIdSchema, taskInitialState, taskKindSchema, taskOriginSchema, taskQuestionSchema, taskSchema, taskStateSchema, taskTransitions, terminalStates, usdSchema, vocabularySchema };
175
+ //# sourceMappingURL=index.d.mts.map