@vercel/factory 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/approval-h5aj8HYN.d.mts +510 -0
- package/dist/blob/index.d.mts +32 -0
- package/dist/blob/index.mjs +141 -0
- package/dist/blob/index.mjs.map +1 -0
- package/dist/connectors/index.d.mts +2 -0
- package/dist/connectors/index.mjs +49 -0
- package/dist/connectors/index.mjs.map +1 -0
- package/dist/connectors/slack.d.mts +43 -0
- package/dist/connectors/slack.mjs +50 -0
- package/dist/connectors/slack.mjs.map +1 -0
- package/dist/driver-Bbd25rNM.mjs +23 -0
- package/dist/driver-Bbd25rNM.mjs.map +1 -0
- package/dist/driver-CrZsy7sm.d.mts +34 -0
- package/dist/eve/index.d.mts +1101 -0
- package/dist/eve/index.mjs +853 -0
- package/dist/eve/index.mjs.map +1 -0
- package/dist/github-3sbHe-fo.d.mts +149 -0
- package/dist/github.d.mts +2 -0
- package/dist/github.mjs +332 -0
- package/dist/github.mjs.map +1 -0
- package/dist/id-DwCihQr4.mjs +31 -0
- package/dist/id-DwCihQr4.mjs.map +1 -0
- package/dist/index-WNGZJRRH.d.mts +67 -0
- package/dist/index.d.mts +187 -0
- package/dist/index.mjs +907 -0
- package/dist/index.mjs.map +1 -0
- package/dist/next-page.d.mts +5 -0
- package/dist/next-page.mjs +71 -0
- package/dist/next-page.mjs.map +1 -0
- package/dist/next.d.mts +12 -0
- package/dist/{next.js → next.mjs} +13 -14
- package/dist/next.mjs.map +1 -0
- package/dist/postgres/index.d.mts +137 -0
- package/dist/postgres/index.mjs +96 -0
- package/dist/postgres/index.mjs.map +1 -0
- package/dist/signal-CHVEmzvI.d.mts +59 -0
- package/dist/task-Cj7Ei9Nh.mjs +336 -0
- package/dist/task-Cj7Ei9Nh.mjs.map +1 -0
- package/package.json +29 -22
- package/dist/approval-Z7iaWibT.d.ts +0 -541
- package/dist/blob/index.d.ts +0 -26
- package/dist/blob/index.js +0 -127
- package/dist/blob/index.js.map +0 -1
- package/dist/chunk-2JFES6BA.js +0 -41
- package/dist/chunk-2JFES6BA.js.map +0 -1
- package/dist/chunk-CEF6VJZC.js +0 -28
- package/dist/chunk-CEF6VJZC.js.map +0 -1
- package/dist/chunk-D2XMABG4.js +0 -311
- package/dist/chunk-D2XMABG4.js.map +0 -1
- package/dist/chunk-EFL4PDDE.js +0 -325
- package/dist/chunk-EFL4PDDE.js.map +0 -1
- package/dist/common-CaHaEOAS.d.ts +0 -18
- package/dist/connectors/index.d.ts +0 -53
- package/dist/connectors/index.js +0 -64
- package/dist/connectors/index.js.map +0 -1
- package/dist/driver-tRNggCCJ.d.ts +0 -32
- package/dist/eve/index.d.ts +0 -1053
- package/dist/eve/index.js +0 -752
- package/dist/eve/index.js.map +0 -1
- package/dist/github.d.ts +0 -139
- package/dist/github.js +0 -27
- package/dist/github.js.map +0 -1
- package/dist/index.d.ts +0 -164
- package/dist/index.js +0 -940
- package/dist/index.js.map +0 -1
- package/dist/next-page.d.ts +0 -5
- package/dist/next-page.js +0 -75
- package/dist/next-page.js.map +0 -1
- package/dist/next.d.ts +0 -12
- package/dist/next.js.map +0 -1
- package/dist/postgres/index.d.ts +0 -137
- package/dist/postgres/index.js +0 -118
- package/dist/postgres/index.js.map +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
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
|
+
slack: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
29
|
+
connector: z.ZodString;
|
|
30
|
+
}, z.core.$strict>>>;
|
|
31
|
+
}, z.core.$strict>>;
|
|
32
|
+
repositories: z.ZodArray<z.ZodObject<{
|
|
33
|
+
slug: z.ZodString;
|
|
34
|
+
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
35
|
+
}, z.core.$strict>>;
|
|
36
|
+
operators: z.ZodArray<z.ZodString>;
|
|
37
|
+
approval: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
38
|
+
source: z.ZodOptional<z.ZodString>;
|
|
39
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
40
|
+
priority: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
41
|
+
P0: "P0";
|
|
42
|
+
P1: "P1";
|
|
43
|
+
P2: "P2";
|
|
44
|
+
P3: "P3";
|
|
45
|
+
}>>>;
|
|
46
|
+
require: z.ZodBoolean;
|
|
47
|
+
}, z.core.$strict>>>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
type FactoryConfig = z.infer<typeof factoryConfigSchema>;
|
|
50
|
+
type FactoryConfigInput = z.input<typeof factoryConfigSchema>;
|
|
51
|
+
declare function defineFactory(config: FactoryConfigInput): FactoryConfig;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/build-factory.d.ts
|
|
54
|
+
interface FactoryArgs<TConfig extends EveNextConfig = EveNextConfig> {
|
|
55
|
+
factoryConfig: FactoryConfigInput;
|
|
56
|
+
nextConfig: EveNextConfigInput<TConfig>;
|
|
57
|
+
root?: string;
|
|
58
|
+
}
|
|
59
|
+
declare function buildFactory<TConfig extends EveNextConfig>({ factoryConfig, nextConfig, root }: FactoryArgs<TConfig>): EveNextConfigFunction<TConfig>;
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/changes.d.ts
|
|
62
|
+
interface AdoptPullRequestInput {
|
|
63
|
+
repositoryId: RepositoryId;
|
|
64
|
+
prNumber: number;
|
|
65
|
+
prUrl: string;
|
|
66
|
+
author: string;
|
|
67
|
+
}
|
|
68
|
+
declare function adoptPullRequest(stores: Pick<FactoryStores, "changes">, input: AdoptPullRequestInput): Promise<Change>;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/dispatch.d.ts
|
|
71
|
+
declare class DispatchRefusedError extends Error {
|
|
72
|
+
readonly taskId: TaskId;
|
|
73
|
+
readonly reason: string;
|
|
74
|
+
constructor(taskId: TaskId, reason: string);
|
|
75
|
+
}
|
|
76
|
+
interface DispatchOptions {
|
|
77
|
+
/**
|
|
78
|
+
* Starts the durable execution for the task (an Eve agent run). Runs after
|
|
79
|
+
* the task has won the queued -> running transition. The execution owns its
|
|
80
|
+
* own provisioning: it creates its Devbox as its first step and patches the
|
|
81
|
+
* task record with the result.
|
|
82
|
+
*/
|
|
83
|
+
launch: (task: Task) => Promise<void>;
|
|
84
|
+
/** How many launches to try before the task fails for good; a failure re-queues for the next sweep. */
|
|
85
|
+
maxLaunchAttempts?: number;
|
|
86
|
+
}
|
|
87
|
+
declare const DEFAULT_MAX_LAUNCH_ATTEMPTS = 45;
|
|
88
|
+
/**
|
|
89
|
+
* The handshake between recorded work and execution: win the store-gated
|
|
90
|
+
* transition (at most one dispatcher can succeed), then start the run. A
|
|
91
|
+
* launch failure re-queues the task (bumping its attempt) until the attempt
|
|
92
|
+
* limit, then fails it; a crash between the transition and the launch leaves
|
|
93
|
+
* a running task with no execution, which the sweep reaps.
|
|
94
|
+
*/
|
|
95
|
+
declare function dispatchTask(stores: FactoryStores, taskId: TaskId, options: DispatchOptions): Promise<Task>;
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/schema/budget.d.ts
|
|
98
|
+
declare const budgetMonthSchema: z.ZodString;
|
|
99
|
+
declare const budgetSchema: z.ZodObject<{
|
|
100
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
101
|
+
factoryId: z.ZodString;
|
|
102
|
+
month: z.ZodString;
|
|
103
|
+
limits: z.ZodObject<{
|
|
104
|
+
totalUsd: z.ZodNumber;
|
|
105
|
+
investigationUsd: z.ZodNumber;
|
|
106
|
+
perTaskReservationUsd: z.ZodNumber;
|
|
107
|
+
warningPercent: z.ZodNumber;
|
|
108
|
+
perRepositoryUsd: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
notices: z.ZodObject<{
|
|
111
|
+
warningAt: z.ZodOptional<z.ZodISODateTime>;
|
|
112
|
+
exhaustedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
type Budget = z.infer<typeof budgetSchema>;
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/schema/transitions.d.ts
|
|
118
|
+
type TransitionActor = "system" | "reconciler" | "foreman" | "operator" | "webhook" | "human";
|
|
119
|
+
interface Transition<State extends string> {
|
|
120
|
+
readonly from: State;
|
|
121
|
+
readonly to: State;
|
|
122
|
+
readonly trigger: string;
|
|
123
|
+
readonly actor: TransitionActor;
|
|
124
|
+
}
|
|
125
|
+
declare const taskInitialState = "queued";
|
|
126
|
+
declare const taskTransitions: readonly Transition<TaskState>[];
|
|
127
|
+
declare const changeInitialState = "verifying";
|
|
128
|
+
declare const changeTransitions: readonly Transition<ChangeState>[];
|
|
129
|
+
declare const signalInitialOutcome = "pending";
|
|
130
|
+
declare const signalOutcomeTransitions: readonly Transition<SignalOutcome>[];
|
|
131
|
+
declare function isTransitionAllowed<State extends string>(transitions: readonly Transition<State>[], from: State, to: State): boolean;
|
|
132
|
+
declare function legalNextStates<State extends string>(transitions: readonly Transition<State>[], from: State): readonly State[];
|
|
133
|
+
declare class InvalidTransitionError<State extends string> extends Error {
|
|
134
|
+
readonly from: State;
|
|
135
|
+
readonly to: State;
|
|
136
|
+
readonly legalNextStates: readonly State[];
|
|
137
|
+
constructor(from: State, to: State, legal: readonly State[]);
|
|
138
|
+
}
|
|
139
|
+
declare function assertTransition<State extends string>(transitions: readonly Transition<State>[], from: State, to: State): void;
|
|
140
|
+
declare function terminalStates<State extends string>(transitions: readonly Transition<State>[]): readonly State[];
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/signals.d.ts
|
|
143
|
+
interface SignalCreator {
|
|
144
|
+
create(input: CreateSignalInput): Promise<Signal>;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Bind normalized intake to signal creation alone. Connectors and API routes
|
|
148
|
+
* own authentication and normalization; configured workflows own what happens
|
|
149
|
+
* next.
|
|
150
|
+
*/
|
|
151
|
+
declare function createSignalCreator(stores: Pick<FactoryStores, "signals">): SignalCreator;
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/store/memory.d.ts
|
|
154
|
+
declare function createInMemoryDriver(): StoreDriver;
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/sweep.d.ts
|
|
157
|
+
/** Starts the agent for one task kind. Supplied by the app, which knows its agents' addresses. */
|
|
158
|
+
type TaskLauncher = (task: Task, repository: Repository) => Promise<void>;
|
|
159
|
+
interface SweepOptions {
|
|
160
|
+
/** Launcher per task kind, e.g. code_change -> foreman, security_scan -> security-scanner. */
|
|
161
|
+
launchers: Readonly<Record<string, TaskLauncher>>;
|
|
162
|
+
}
|
|
163
|
+
interface SweepResult {
|
|
164
|
+
dispatched: string[];
|
|
165
|
+
/** Tasks left in the queue and why: awaiting approval, no launcher, missing repository. */
|
|
166
|
+
skipped: {
|
|
167
|
+
taskId: string;
|
|
168
|
+
reason: string;
|
|
169
|
+
}[];
|
|
170
|
+
/** Tasks whose launch threw; dispatchTask has already recorded them as failed. */
|
|
171
|
+
failed: {
|
|
172
|
+
taskId: string;
|
|
173
|
+
reason: string;
|
|
174
|
+
}[];
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* One pass of the factory's dispatcher, meant to run on a schedule inside the
|
|
178
|
+
* deployment: every queued task that is allowed to run is started, in
|
|
179
|
+
* creation order. Nothing outside the factory ever starts an agent; the CLI
|
|
180
|
+
* and the dashboard only write tasks and approvals, and this picks them up.
|
|
181
|
+
* Idempotent by construction: dispatchTask's single-winner transition means
|
|
182
|
+
* two overlapping sweeps cannot start the same task twice.
|
|
183
|
+
*/
|
|
184
|
+
declare function sweepQueued(stores: FactoryStores, options: SweepOptions): Promise<SweepResult>;
|
|
185
|
+
//#endregion
|
|
186
|
+
export { AdoptPullRequestInput, 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, adoptPullRequest, 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 };
|
|
187
|
+
//# sourceMappingURL=index.d.mts.map
|