@vercel/factory 0.0.2 → 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.
- 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/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 +1057 -0
- package/dist/eve/index.mjs +777 -0
- package/dist/eve/index.mjs.map +1 -0
- package/dist/github-5qQPCaXj.d.mts +123 -0
- package/dist/github.d.mts +2 -0
- package/dist/github.mjs +286 -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 +175 -0
- package/dist/index.mjs +882 -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 +28 -21
- 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-CEF6VJZC.js +0 -28
- package/dist/chunk-CEF6VJZC.js.map +0 -1
- package/dist/chunk-LBEYCOSR.js +0 -351
- package/dist/chunk-LBEYCOSR.js.map +0 -1
- package/dist/common-CaHaEOAS.d.ts +0 -18
- package/dist/connectors/github.d.ts +0 -62
- package/dist/connectors/github.js +0 -112
- package/dist/connectors/github.js.map +0 -1
- package/dist/driver-tRNggCCJ.d.ts +0 -32
- package/dist/eve/index.d.ts +0 -962
- package/dist/eve/index.js +0 -601
- package/dist/eve/index.js.map +0 -1
- package/dist/index.d.ts +0 -164
- package/dist/index.js +0 -938
- 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
|
@@ -1,541 +0,0 @@
|
|
|
1
|
-
import { R as ReplyTo } from './common-CaHaEOAS.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { S as StoreDriver } from './driver-tRNggCCJ.js';
|
|
4
|
-
|
|
5
|
-
declare const factoryIdSchema: z.ZodString;
|
|
6
|
-
declare const repositoryIdSchema: z.ZodString;
|
|
7
|
-
declare const signalIdSchema: z.ZodString;
|
|
8
|
-
declare const taskIdSchema: z.ZodString;
|
|
9
|
-
declare const changeIdSchema: z.ZodString;
|
|
10
|
-
declare const receiptIdSchema: z.ZodString;
|
|
11
|
-
declare const repositoryIdsSchema: z.ZodArray<z.ZodString>;
|
|
12
|
-
type FactoryId = z.infer<typeof factoryIdSchema>;
|
|
13
|
-
type RepositoryId = z.infer<typeof repositoryIdSchema>;
|
|
14
|
-
type SignalId = z.infer<typeof signalIdSchema>;
|
|
15
|
-
type TaskId = z.infer<typeof taskIdSchema>;
|
|
16
|
-
type ChangeId = z.infer<typeof changeIdSchema>;
|
|
17
|
-
type ReceiptId = z.infer<typeof receiptIdSchema>;
|
|
18
|
-
|
|
19
|
-
declare const levelSchema: z.ZodEnum<{
|
|
20
|
-
low: "low";
|
|
21
|
-
medium: "medium";
|
|
22
|
-
high: "high";
|
|
23
|
-
}>;
|
|
24
|
-
declare const changeStateSchema: z.ZodEnum<{
|
|
25
|
-
verifying: "verifying";
|
|
26
|
-
ready: "ready";
|
|
27
|
-
merged: "merged";
|
|
28
|
-
deployed: "deployed";
|
|
29
|
-
rolled_out: "rolled_out";
|
|
30
|
-
rolled_back: "rolled_back";
|
|
31
|
-
closed: "closed";
|
|
32
|
-
}>;
|
|
33
|
-
declare const changeEvidenceSchema: z.ZodObject<{
|
|
34
|
-
reproVerified: z.ZodBoolean;
|
|
35
|
-
testsAdded: z.ZodNumber;
|
|
36
|
-
checksGreen: z.ZodBoolean;
|
|
37
|
-
attackPassed: z.ZodBoolean;
|
|
38
|
-
scopeMatches: z.ZodBoolean;
|
|
39
|
-
previewUrl: z.ZodOptional<z.ZodURL>;
|
|
40
|
-
}, z.core.$strict>;
|
|
41
|
-
declare const changeSchema: z.ZodObject<{
|
|
42
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
43
|
-
id: z.ZodString;
|
|
44
|
-
repositoryId: z.ZodString;
|
|
45
|
-
taskId: z.ZodOptional<z.ZodString>;
|
|
46
|
-
groupId: z.ZodOptional<z.ZodString>;
|
|
47
|
-
prNumber: z.ZodNumber;
|
|
48
|
-
prUrl: z.ZodURL;
|
|
49
|
-
author: z.ZodString;
|
|
50
|
-
risk: z.ZodEnum<{
|
|
51
|
-
low: "low";
|
|
52
|
-
medium: "medium";
|
|
53
|
-
high: "high";
|
|
54
|
-
}>;
|
|
55
|
-
confidence: z.ZodEnum<{
|
|
56
|
-
low: "low";
|
|
57
|
-
medium: "medium";
|
|
58
|
-
high: "high";
|
|
59
|
-
}>;
|
|
60
|
-
evidence: z.ZodObject<{
|
|
61
|
-
reproVerified: z.ZodBoolean;
|
|
62
|
-
testsAdded: z.ZodNumber;
|
|
63
|
-
checksGreen: z.ZodBoolean;
|
|
64
|
-
attackPassed: z.ZodBoolean;
|
|
65
|
-
scopeMatches: z.ZodBoolean;
|
|
66
|
-
previewUrl: z.ZodOptional<z.ZodURL>;
|
|
67
|
-
}, z.core.$strict>;
|
|
68
|
-
state: z.ZodEnum<{
|
|
69
|
-
verifying: "verifying";
|
|
70
|
-
ready: "ready";
|
|
71
|
-
merged: "merged";
|
|
72
|
-
deployed: "deployed";
|
|
73
|
-
rolled_out: "rolled_out";
|
|
74
|
-
rolled_back: "rolled_back";
|
|
75
|
-
closed: "closed";
|
|
76
|
-
}>;
|
|
77
|
-
decidedBy: z.ZodOptional<z.ZodString>;
|
|
78
|
-
createdAt: z.ZodISODateTime;
|
|
79
|
-
updatedAt: z.ZodISODateTime;
|
|
80
|
-
}, z.core.$strict>;
|
|
81
|
-
type Level = z.infer<typeof levelSchema>;
|
|
82
|
-
type ChangeState = z.infer<typeof changeStateSchema>;
|
|
83
|
-
type ChangeEvidence = z.infer<typeof changeEvidenceSchema>;
|
|
84
|
-
type Change = z.infer<typeof changeSchema>;
|
|
85
|
-
|
|
86
|
-
/** States the engine writes on transitions. Any vocabulary value is valid. */
|
|
87
|
-
declare const standardReceiptStates: readonly ["approved", "rejected", "dispatched", "succeeded", "failed", "needs_human", "cancelled", "settled", "merged", "deployed", "rolled_out", "rolled_back"];
|
|
88
|
-
/** Phases the standard loop uses. Any vocabulary value is valid. */
|
|
89
|
-
declare const standardReceiptPhases: readonly ["approval", "budget", "dispatch", "implementation", "verification", "pull_request", "cleanup"];
|
|
90
|
-
/** Kinds the standard loop writes: the standard task kinds plus "change". */
|
|
91
|
-
declare const standardReceiptKinds: readonly ["code_change", "verification", "investigation", "question", "change"];
|
|
92
|
-
declare const receiptStateSchema: z.ZodString;
|
|
93
|
-
declare const receiptPhaseSchema: z.ZodString;
|
|
94
|
-
declare const receiptKindSchema: z.ZodString;
|
|
95
|
-
declare const costSchema: z.ZodObject<{
|
|
96
|
-
totalUsd: z.ZodNumber;
|
|
97
|
-
}, z.core.$strict>;
|
|
98
|
-
declare const receiptSchema: z.ZodObject<{
|
|
99
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
100
|
-
receiptId: z.ZodString;
|
|
101
|
-
repositoryIds: z.ZodArray<z.ZodString>;
|
|
102
|
-
taskId: z.ZodOptional<z.ZodString>;
|
|
103
|
-
changeId: z.ZodOptional<z.ZodString>;
|
|
104
|
-
kind: z.ZodString;
|
|
105
|
-
state: z.ZodString;
|
|
106
|
-
phase: z.ZodOptional<z.ZodString>;
|
|
107
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
108
|
-
attempt: z.ZodNumber;
|
|
109
|
-
cost: z.ZodOptional<z.ZodObject<{
|
|
110
|
-
totalUsd: z.ZodNumber;
|
|
111
|
-
}, z.core.$strict>>;
|
|
112
|
-
decidedBy: z.ZodOptional<z.ZodString>;
|
|
113
|
-
recordedAt: z.ZodISODateTime;
|
|
114
|
-
}, z.core.$strict>;
|
|
115
|
-
type ReceiptState = z.infer<typeof receiptStateSchema>;
|
|
116
|
-
type ReceiptPhase = z.infer<typeof receiptPhaseSchema>;
|
|
117
|
-
type ReceiptKind = z.infer<typeof receiptKindSchema>;
|
|
118
|
-
type Cost = z.infer<typeof costSchema>;
|
|
119
|
-
type Receipt = z.infer<typeof receiptSchema>;
|
|
120
|
-
|
|
121
|
-
declare const repositorySlugSchema: z.ZodString;
|
|
122
|
-
declare const repositorySchema: z.ZodObject<{
|
|
123
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
124
|
-
id: z.ZodString;
|
|
125
|
-
slug: z.ZodString;
|
|
126
|
-
defaultBranch: z.ZodString;
|
|
127
|
-
enabled: z.ZodBoolean;
|
|
128
|
-
dependsOn: z.ZodArray<z.ZodString>;
|
|
129
|
-
devbox: z.ZodOptional<z.ZodObject<{
|
|
130
|
-
projectId: z.ZodString;
|
|
131
|
-
teamId: z.ZodString;
|
|
132
|
-
snapshot: z.ZodOptional<z.ZodString>;
|
|
133
|
-
}, z.core.$strict>>;
|
|
134
|
-
connectedAt: z.ZodISODateTime;
|
|
135
|
-
}, z.core.$strict>;
|
|
136
|
-
type RepositorySlug = z.infer<typeof repositorySlugSchema>;
|
|
137
|
-
type Repository = z.infer<typeof repositorySchema>;
|
|
138
|
-
|
|
139
|
-
/** Sources used by the standard connectors. Any vocabulary value is valid. */
|
|
140
|
-
declare const standardSignalSources: readonly ["github_issue", "github_pr", "github_pr_comment", "slack", "human", "github_ci_failure", "vercel_deploy_failure", "security_scan", "investigation", "api"];
|
|
141
|
-
declare const signalSourceSchema: z.ZodString;
|
|
142
|
-
declare const signalOutcomeSchema: z.ZodEnum<{
|
|
143
|
-
pending: "pending";
|
|
144
|
-
accepted: "accepted";
|
|
145
|
-
duplicate: "duplicate";
|
|
146
|
-
unactionable: "unactionable";
|
|
147
|
-
low_confidence: "low_confidence";
|
|
148
|
-
ignored: "ignored";
|
|
149
|
-
}>;
|
|
150
|
-
declare const signalSchema: z.ZodObject<{
|
|
151
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
152
|
-
id: z.ZodString;
|
|
153
|
-
repositoryId: z.ZodString;
|
|
154
|
-
source: z.ZodString;
|
|
155
|
-
deliveryId: z.ZodString;
|
|
156
|
-
replyTo: z.ZodObject<{
|
|
157
|
-
channel: z.ZodString;
|
|
158
|
-
address: z.ZodString;
|
|
159
|
-
}, z.core.$strict>;
|
|
160
|
-
payload: z.ZodUnknown;
|
|
161
|
-
receivedAt: z.ZodISODateTime;
|
|
162
|
-
outcome: z.ZodEnum<{
|
|
163
|
-
pending: "pending";
|
|
164
|
-
accepted: "accepted";
|
|
165
|
-
duplicate: "duplicate";
|
|
166
|
-
unactionable: "unactionable";
|
|
167
|
-
low_confidence: "low_confidence";
|
|
168
|
-
ignored: "ignored";
|
|
169
|
-
}>;
|
|
170
|
-
detail: z.ZodOptional<z.ZodString>;
|
|
171
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
172
|
-
decidedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
173
|
-
}, z.core.$strict>;
|
|
174
|
-
type SignalSource = z.infer<typeof signalSourceSchema>;
|
|
175
|
-
type SignalOutcome = z.infer<typeof signalOutcomeSchema>;
|
|
176
|
-
type Signal = z.infer<typeof signalSchema>;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Kinds the standard loop understands. Any vocabulary value is valid; the
|
|
180
|
-
* kind-scoped rules below apply only to these standard kinds.
|
|
181
|
-
*/
|
|
182
|
-
declare const standardTaskKinds: readonly ["code_change", "verification", "investigation", "question"];
|
|
183
|
-
declare const taskKindSchema: z.ZodString;
|
|
184
|
-
declare const taskStateSchema: z.ZodEnum<{
|
|
185
|
-
queued: "queued";
|
|
186
|
-
running: "running";
|
|
187
|
-
verifying: "verifying";
|
|
188
|
-
succeeded: "succeeded";
|
|
189
|
-
failed: "failed";
|
|
190
|
-
needs_human: "needs_human";
|
|
191
|
-
cancelled: "cancelled";
|
|
192
|
-
}>;
|
|
193
|
-
declare const taskApprovalSchema: z.ZodEnum<{
|
|
194
|
-
required: "required";
|
|
195
|
-
granted: "granted";
|
|
196
|
-
denied: "denied";
|
|
197
|
-
}>;
|
|
198
|
-
declare const harnessSchema: z.ZodString;
|
|
199
|
-
declare const taskOriginSchema: z.ZodObject<{
|
|
200
|
-
signalId: z.ZodOptional<z.ZodString>;
|
|
201
|
-
parentTaskId: z.ZodOptional<z.ZodString>;
|
|
202
|
-
operator: z.ZodOptional<z.ZodString>;
|
|
203
|
-
}, z.core.$strict>;
|
|
204
|
-
declare const taskDevboxSchema: z.ZodObject<{
|
|
205
|
-
devboxId: z.ZodString;
|
|
206
|
-
remoteId: z.ZodString;
|
|
207
|
-
harness: z.ZodString;
|
|
208
|
-
}, z.core.$strict>;
|
|
209
|
-
declare const taskQuestionSchema: z.ZodObject<{
|
|
210
|
-
text: z.ZodString;
|
|
211
|
-
options: z.ZodArray<z.ZodString>;
|
|
212
|
-
answer: z.ZodOptional<z.ZodString>;
|
|
213
|
-
answeredBy: z.ZodOptional<z.ZodString>;
|
|
214
|
-
}, z.core.$strict>;
|
|
215
|
-
declare const taskSchema: z.ZodObject<{
|
|
216
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
217
|
-
id: z.ZodString;
|
|
218
|
-
repositoryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
219
|
-
kind: z.ZodString;
|
|
220
|
-
area: z.ZodOptional<z.ZodString>;
|
|
221
|
-
state: z.ZodEnum<{
|
|
222
|
-
queued: "queued";
|
|
223
|
-
running: "running";
|
|
224
|
-
verifying: "verifying";
|
|
225
|
-
succeeded: "succeeded";
|
|
226
|
-
failed: "failed";
|
|
227
|
-
needs_human: "needs_human";
|
|
228
|
-
cancelled: "cancelled";
|
|
229
|
-
}>;
|
|
230
|
-
approval: z.ZodOptional<z.ZodEnum<{
|
|
231
|
-
required: "required";
|
|
232
|
-
granted: "granted";
|
|
233
|
-
denied: "denied";
|
|
234
|
-
}>>;
|
|
235
|
-
origin: z.ZodObject<{
|
|
236
|
-
signalId: z.ZodOptional<z.ZodString>;
|
|
237
|
-
parentTaskId: z.ZodOptional<z.ZodString>;
|
|
238
|
-
operator: z.ZodOptional<z.ZodString>;
|
|
239
|
-
}, z.core.$strict>;
|
|
240
|
-
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
241
|
-
replyTo: z.ZodObject<{
|
|
242
|
-
channel: z.ZodString;
|
|
243
|
-
address: z.ZodString;
|
|
244
|
-
}, z.core.$strict>;
|
|
245
|
-
devbox: z.ZodOptional<z.ZodObject<{
|
|
246
|
-
devboxId: z.ZodString;
|
|
247
|
-
remoteId: z.ZodString;
|
|
248
|
-
harness: z.ZodString;
|
|
249
|
-
}, z.core.$strict>>;
|
|
250
|
-
attempt: z.ZodNumber;
|
|
251
|
-
reservedUsd: z.ZodOptional<z.ZodNumber>;
|
|
252
|
-
settledUsd: z.ZodOptional<z.ZodNumber>;
|
|
253
|
-
question: z.ZodOptional<z.ZodObject<{
|
|
254
|
-
text: z.ZodString;
|
|
255
|
-
options: z.ZodArray<z.ZodString>;
|
|
256
|
-
answer: z.ZodOptional<z.ZodString>;
|
|
257
|
-
answeredBy: z.ZodOptional<z.ZodString>;
|
|
258
|
-
}, z.core.$strict>>;
|
|
259
|
-
changeId: z.ZodOptional<z.ZodString>;
|
|
260
|
-
reportRef: z.ZodOptional<z.ZodString>;
|
|
261
|
-
createdAt: z.ZodISODateTime;
|
|
262
|
-
updatedAt: z.ZodISODateTime;
|
|
263
|
-
}, z.core.$strict>;
|
|
264
|
-
type TaskApproval = z.infer<typeof taskApprovalSchema>;
|
|
265
|
-
type TaskKind = z.infer<typeof taskKindSchema>;
|
|
266
|
-
type TaskState = z.infer<typeof taskStateSchema>;
|
|
267
|
-
type Task = z.infer<typeof taskSchema>;
|
|
268
|
-
|
|
269
|
-
/** An approval decision that does not apply to the task's current approval or state. */
|
|
270
|
-
declare class ApprovalError extends Error {
|
|
271
|
-
readonly taskId: TaskId;
|
|
272
|
-
readonly reason: string;
|
|
273
|
-
constructor(taskId: TaskId, reason: string);
|
|
274
|
-
}
|
|
275
|
-
interface CreateSignalInput {
|
|
276
|
-
repositoryId: RepositoryId;
|
|
277
|
-
source: SignalSource;
|
|
278
|
-
deliveryId: string;
|
|
279
|
-
replyTo: ReplyTo;
|
|
280
|
-
payload: unknown;
|
|
281
|
-
}
|
|
282
|
-
interface DecideSignalOptions {
|
|
283
|
-
detail?: string;
|
|
284
|
-
reason?: string;
|
|
285
|
-
}
|
|
286
|
-
interface CreateTaskInput {
|
|
287
|
-
repositoryIds: RepositoryId[];
|
|
288
|
-
kind: Task["kind"];
|
|
289
|
-
origin: Task["origin"];
|
|
290
|
-
replyTo: ReplyTo;
|
|
291
|
-
area?: string;
|
|
292
|
-
dependsOn?: TaskId[];
|
|
293
|
-
question?: Task["question"];
|
|
294
|
-
/** Stamp the task as needing a human decision before dispatch. */
|
|
295
|
-
approval?: "required";
|
|
296
|
-
}
|
|
297
|
-
interface ApprovalDecision {
|
|
298
|
-
/** Authenticated operator making the decision. */
|
|
299
|
-
by: string;
|
|
300
|
-
reason?: string;
|
|
301
|
-
}
|
|
302
|
-
type TaskPatch = Partial<Pick<Task, "devbox" | "changeId" | "reportRef" | "reservedUsd" | "settledUsd" | "question">>;
|
|
303
|
-
interface TaskTransitionOptions {
|
|
304
|
-
patch?: TaskPatch;
|
|
305
|
-
reason?: string;
|
|
306
|
-
}
|
|
307
|
-
interface CreateChangeInput {
|
|
308
|
-
repositoryId: RepositoryId;
|
|
309
|
-
taskId?: TaskId;
|
|
310
|
-
groupId?: TaskId;
|
|
311
|
-
prNumber: number;
|
|
312
|
-
prUrl: string;
|
|
313
|
-
author: string;
|
|
314
|
-
risk: Level;
|
|
315
|
-
confidence: Level;
|
|
316
|
-
evidence: Change["evidence"];
|
|
317
|
-
}
|
|
318
|
-
type ChangePatch = Partial<Pick<Change, "confidence" | "evidence" | "decidedBy">>;
|
|
319
|
-
interface ChangeTransitionOptions {
|
|
320
|
-
patch?: ChangePatch;
|
|
321
|
-
reason?: string;
|
|
322
|
-
}
|
|
323
|
-
interface AppendReceiptInput {
|
|
324
|
-
repositoryIds: RepositoryId[];
|
|
325
|
-
taskId?: TaskId;
|
|
326
|
-
changeId?: ChangeId;
|
|
327
|
-
kind: string;
|
|
328
|
-
state: string;
|
|
329
|
-
phase?: string;
|
|
330
|
-
reason?: string;
|
|
331
|
-
attempt?: number;
|
|
332
|
-
cost?: Cost;
|
|
333
|
-
decidedBy?: string;
|
|
334
|
-
/** Same key twice appends one receipt and returns the existing one. */
|
|
335
|
-
dedupeKey?: string;
|
|
336
|
-
}
|
|
337
|
-
interface FactoryStores {
|
|
338
|
-
driverName: string;
|
|
339
|
-
repositories: {
|
|
340
|
-
put(repository: Repository): Promise<Repository>;
|
|
341
|
-
get(id: RepositoryId): Promise<Repository | null>;
|
|
342
|
-
list(): Promise<Repository[]>;
|
|
343
|
-
};
|
|
344
|
-
signals: {
|
|
345
|
-
create(input: CreateSignalInput): Promise<Signal>;
|
|
346
|
-
get(id: SignalId): Promise<Signal | null>;
|
|
347
|
-
decide(id: SignalId, outcome: SignalOutcome, options?: DecideSignalOptions): Promise<Signal>;
|
|
348
|
-
list(): Promise<Signal[]>;
|
|
349
|
-
};
|
|
350
|
-
tasks: {
|
|
351
|
-
create(input: CreateTaskInput): Promise<Task>;
|
|
352
|
-
get(id: TaskId): Promise<Task | null>;
|
|
353
|
-
transition(id: TaskId, to: TaskState, options?: TaskTransitionOptions): Promise<Task>;
|
|
354
|
-
/** Grant a required approval. The task stays queued; dispatch may now take it. */
|
|
355
|
-
approve(id: TaskId, decision: ApprovalDecision): Promise<Task>;
|
|
356
|
-
/** Deny a required approval. The task is cancelled with the reason. */
|
|
357
|
-
reject(id: TaskId, decision: ApprovalDecision): Promise<Task>;
|
|
358
|
-
list(): Promise<Task[]>;
|
|
359
|
-
};
|
|
360
|
-
changes: {
|
|
361
|
-
create(input: CreateChangeInput): Promise<Change>;
|
|
362
|
-
get(id: ChangeId): Promise<Change | null>;
|
|
363
|
-
transition(id: ChangeId, to: ChangeState, options?: ChangeTransitionOptions): Promise<Change>;
|
|
364
|
-
list(): Promise<Change[]>;
|
|
365
|
-
};
|
|
366
|
-
receipts: {
|
|
367
|
-
append(input: AppendReceiptInput): Promise<Receipt>;
|
|
368
|
-
get(id: string): Promise<Receipt | null>;
|
|
369
|
-
list(): Promise<Receipt[]>;
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
interface CreateStoresOptions {
|
|
373
|
-
driver: StoreDriver;
|
|
374
|
-
now?: () => string;
|
|
375
|
-
}
|
|
376
|
-
declare function createStores(options: CreateStoresOptions): FactoryStores;
|
|
377
|
-
|
|
378
|
-
declare const findingPrioritySchema: z.ZodEnum<{
|
|
379
|
-
P0: "P0";
|
|
380
|
-
P1: "P1";
|
|
381
|
-
P2: "P2";
|
|
382
|
-
P3: "P3";
|
|
383
|
-
}>;
|
|
384
|
-
declare const findingCategorySchema: z.ZodEnum<{
|
|
385
|
-
security: "security";
|
|
386
|
-
correctness: "correctness";
|
|
387
|
-
reliability: "reliability";
|
|
388
|
-
performance: "performance";
|
|
389
|
-
compatibility: "compatibility";
|
|
390
|
-
accessibility: "accessibility";
|
|
391
|
-
documentation: "documentation";
|
|
392
|
-
maintainability: "maintainability";
|
|
393
|
-
testing: "testing";
|
|
394
|
-
usability: "usability";
|
|
395
|
-
}>;
|
|
396
|
-
declare const findingVerificationLevelSchema: z.ZodEnum<{
|
|
397
|
-
unverified: "unverified";
|
|
398
|
-
supported: "supported";
|
|
399
|
-
confirmed: "confirmed";
|
|
400
|
-
}>;
|
|
401
|
-
declare const findingVerificationMethodSchema: z.ZodEnum<{
|
|
402
|
-
documentation: "documentation";
|
|
403
|
-
code_inspection: "code_inspection";
|
|
404
|
-
static_analysis: "static_analysis";
|
|
405
|
-
manual_reproduction: "manual_reproduction";
|
|
406
|
-
unit_test: "unit_test";
|
|
407
|
-
integration_test: "integration_test";
|
|
408
|
-
e2e_test: "e2e_test";
|
|
409
|
-
runtime_observation: "runtime_observation";
|
|
410
|
-
}>;
|
|
411
|
-
/**
|
|
412
|
-
* What was done to check the finding. Forces a reporter to distinguish "I
|
|
413
|
-
* think this is a problem" from "I demonstrated it", which is the axis a human
|
|
414
|
-
* approving fixes cares about most.
|
|
415
|
-
*/
|
|
416
|
-
declare const findingVerificationSchema: z.ZodObject<{
|
|
417
|
-
level: z.ZodEnum<{
|
|
418
|
-
unverified: "unverified";
|
|
419
|
-
supported: "supported";
|
|
420
|
-
confirmed: "confirmed";
|
|
421
|
-
}>;
|
|
422
|
-
method: z.ZodEnum<{
|
|
423
|
-
documentation: "documentation";
|
|
424
|
-
code_inspection: "code_inspection";
|
|
425
|
-
static_analysis: "static_analysis";
|
|
426
|
-
manual_reproduction: "manual_reproduction";
|
|
427
|
-
unit_test: "unit_test";
|
|
428
|
-
integration_test: "integration_test";
|
|
429
|
-
e2e_test: "e2e_test";
|
|
430
|
-
runtime_observation: "runtime_observation";
|
|
431
|
-
}>;
|
|
432
|
-
summary: z.ZodString;
|
|
433
|
-
limitations: z.ZodOptional<z.ZodString>;
|
|
434
|
-
}, z.core.$strict>;
|
|
435
|
-
/** A single problem found in a repository, as a scanner or agent reports it. */
|
|
436
|
-
declare const findingSchema: z.ZodObject<{
|
|
437
|
-
title: z.ZodString;
|
|
438
|
-
body: z.ZodString;
|
|
439
|
-
path: z.ZodOptional<z.ZodString>;
|
|
440
|
-
line: z.ZodOptional<z.ZodNumber>;
|
|
441
|
-
endLine: z.ZodOptional<z.ZodNumber>;
|
|
442
|
-
priority: z.ZodEnum<{
|
|
443
|
-
P0: "P0";
|
|
444
|
-
P1: "P1";
|
|
445
|
-
P2: "P2";
|
|
446
|
-
P3: "P3";
|
|
447
|
-
}>;
|
|
448
|
-
category: z.ZodEnum<{
|
|
449
|
-
security: "security";
|
|
450
|
-
correctness: "correctness";
|
|
451
|
-
reliability: "reliability";
|
|
452
|
-
performance: "performance";
|
|
453
|
-
compatibility: "compatibility";
|
|
454
|
-
accessibility: "accessibility";
|
|
455
|
-
documentation: "documentation";
|
|
456
|
-
maintainability: "maintainability";
|
|
457
|
-
testing: "testing";
|
|
458
|
-
usability: "usability";
|
|
459
|
-
}>;
|
|
460
|
-
verification: z.ZodObject<{
|
|
461
|
-
level: z.ZodEnum<{
|
|
462
|
-
unverified: "unverified";
|
|
463
|
-
supported: "supported";
|
|
464
|
-
confirmed: "confirmed";
|
|
465
|
-
}>;
|
|
466
|
-
method: z.ZodEnum<{
|
|
467
|
-
documentation: "documentation";
|
|
468
|
-
code_inspection: "code_inspection";
|
|
469
|
-
static_analysis: "static_analysis";
|
|
470
|
-
manual_reproduction: "manual_reproduction";
|
|
471
|
-
unit_test: "unit_test";
|
|
472
|
-
integration_test: "integration_test";
|
|
473
|
-
e2e_test: "e2e_test";
|
|
474
|
-
runtime_observation: "runtime_observation";
|
|
475
|
-
}>;
|
|
476
|
-
summary: z.ZodString;
|
|
477
|
-
limitations: z.ZodOptional<z.ZodString>;
|
|
478
|
-
}, z.core.$strict>;
|
|
479
|
-
tool: z.ZodOptional<z.ZodString>;
|
|
480
|
-
ruleId: z.ZodOptional<z.ZodString>;
|
|
481
|
-
}, z.core.$strict>;
|
|
482
|
-
type FindingPriority = z.infer<typeof findingPrioritySchema>;
|
|
483
|
-
type FindingCategory = z.infer<typeof findingCategorySchema>;
|
|
484
|
-
type FindingVerification = z.infer<typeof findingVerificationSchema>;
|
|
485
|
-
type Finding = z.infer<typeof findingSchema>;
|
|
486
|
-
/**
|
|
487
|
-
* Stable identity of a finding across scans, used as the signal's delivery id
|
|
488
|
-
* so re-reporting is a no-op instead of a second task. A scanner finding is
|
|
489
|
-
* the same problem when the same tool reports the same rule on the same file;
|
|
490
|
-
* its title is model-written prose and changes between runs, so it is left
|
|
491
|
-
* out. Without a rule id the title is all there is, normalised.
|
|
492
|
-
*/
|
|
493
|
-
declare function findingFingerprint(repositoryId: string, finding: Finding): string;
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* One approval rule. Every listed field must match for the rule to apply;
|
|
497
|
-
* absent fields match anything. Rules are evaluated first-match.
|
|
498
|
-
*/
|
|
499
|
-
declare const approvalRuleSchema: z.ZodObject<{
|
|
500
|
-
source: z.ZodOptional<z.ZodString>;
|
|
501
|
-
kind: z.ZodOptional<z.ZodString>;
|
|
502
|
-
priority: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
503
|
-
P0: "P0";
|
|
504
|
-
P1: "P1";
|
|
505
|
-
P2: "P2";
|
|
506
|
-
P3: "P3";
|
|
507
|
-
}>>>;
|
|
508
|
-
require: z.ZodBoolean;
|
|
509
|
-
}, z.core.$strict>;
|
|
510
|
-
declare const approvalPolicySchema: z.ZodArray<z.ZodObject<{
|
|
511
|
-
source: z.ZodOptional<z.ZodString>;
|
|
512
|
-
kind: z.ZodOptional<z.ZodString>;
|
|
513
|
-
priority: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
514
|
-
P0: "P0";
|
|
515
|
-
P1: "P1";
|
|
516
|
-
P2: "P2";
|
|
517
|
-
P3: "P3";
|
|
518
|
-
}>>>;
|
|
519
|
-
require: z.ZodBoolean;
|
|
520
|
-
}, z.core.$strict>>;
|
|
521
|
-
type ApprovalRule = z.infer<typeof approvalRuleSchema>;
|
|
522
|
-
type ApprovalPolicy = z.infer<typeof approvalPolicySchema>;
|
|
523
|
-
/**
|
|
524
|
-
* The default: fixes for security findings wait for a human; everything else
|
|
525
|
-
* runs as it always has. Handoffs between agents (verification) never wait,
|
|
526
|
-
* because a human already approved the work they continue.
|
|
527
|
-
*/
|
|
528
|
-
declare const defaultApprovalPolicy: ApprovalPolicy;
|
|
529
|
-
interface ApprovalSubject {
|
|
530
|
-
source?: string;
|
|
531
|
-
kind: string;
|
|
532
|
-
priority?: FindingPriority;
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Decide at task-creation time whether a task needs approval. Pure: the answer
|
|
536
|
-
* is stamped on the task and never re-evaluated, so a later policy change
|
|
537
|
-
* cannot silently release work a human was expecting to see.
|
|
538
|
-
*/
|
|
539
|
-
declare function requiresApproval(policy: ApprovalPolicy, subject: ApprovalSubject): boolean;
|
|
540
|
-
|
|
541
|
-
export { factoryIdSchema as $, type ApprovalPolicy as A, type ReceiptPhase as B, type ChangeState as C, type DecideSignalOptions as D, type ReceiptState as E, type FactoryStores as F, type RepositoryId as G, type RepositorySlug as H, type SignalId as I, type SignalSource as J, type TaskApproval as K, type Level as L, type TaskKind as M, type TaskPatch as N, type TaskTransitionOptions as O, approvalPolicySchema as P, approvalRuleSchema as Q, type Repository as R, type SignalOutcome as S, type Task as T, changeEvidenceSchema as U, changeIdSchema as V, changeSchema as W, changeStateSchema as X, costSchema as Y, createStores as Z, defaultApprovalPolicy as _, type Finding as a, findingCategorySchema as a0, findingFingerprint as a1, findingPrioritySchema as a2, findingSchema as a3, findingVerificationLevelSchema as a4, findingVerificationMethodSchema as a5, findingVerificationSchema as a6, harnessSchema as a7, levelSchema as a8, receiptIdSchema as a9, receiptKindSchema as aa, receiptPhaseSchema as ab, receiptSchema as ac, receiptStateSchema as ad, repositoryIdSchema as ae, repositoryIdsSchema as af, repositorySchema as ag, repositorySlugSchema as ah, requiresApproval as ai, signalIdSchema as aj, signalOutcomeSchema as ak, signalSchema as al, signalSourceSchema as am, standardReceiptKinds as an, standardReceiptPhases as ao, standardReceiptStates as ap, standardSignalSources as aq, standardTaskKinds as ar, taskApprovalSchema as as, taskDevboxSchema as at, taskIdSchema as au, taskKindSchema as av, taskOriginSchema as aw, taskQuestionSchema as ax, taskSchema as ay, taskStateSchema as az, type TaskId as b, type TaskState as c, type CreateSignalInput as d, type Signal as e, type AppendReceiptInput as f, type ApprovalDecision as g, ApprovalError as h, type ApprovalRule as i, type ApprovalSubject as j, type Change as k, type ChangeEvidence as l, type ChangeId as m, type ChangePatch as n, type ChangeTransitionOptions as o, type Cost as p, type CreateChangeInput as q, type CreateStoresOptions as r, type CreateTaskInput as s, type FactoryId as t, type FindingCategory as u, type FindingPriority as v, type FindingVerification as w, type Receipt as x, type ReceiptId as y, type ReceiptKind as z };
|
package/dist/blob/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { S as StoreDriver } from '../driver-tRNggCCJ.js';
|
|
2
|
-
|
|
3
|
-
/** The narrow blob operations the driver needs; injectable for tests. */
|
|
4
|
-
interface BlobClient {
|
|
5
|
-
read(pathname: string): Promise<string | null>;
|
|
6
|
-
/** Must reject with an already-exists error when overwrite is false and the path exists. */
|
|
7
|
-
write(pathname: string, body: string, overwrite: boolean): Promise<void>;
|
|
8
|
-
listPaths(prefix: string): Promise<string[]>;
|
|
9
|
-
}
|
|
10
|
-
declare const vercelBlobClient: BlobClient;
|
|
11
|
-
interface BlobDriverOptions {
|
|
12
|
-
client?: BlobClient;
|
|
13
|
-
/** Path prefix inside the blob store; defaults to "factory". */
|
|
14
|
-
prefix?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Store driver on Vercel Blob: durable and dependency-free (one Blob store on
|
|
18
|
-
* the project, no database). Inserts and receipts are exactly as safe as on
|
|
19
|
-
* Postgres (create-if-absent is atomic). The compare-and-swap update is
|
|
20
|
-
* BEST-EFFORT: the version check reads then writes without a lock, so two
|
|
21
|
-
* simultaneous writers can race. Acceptable for low-volume factories; use the
|
|
22
|
-
* Postgres driver when concurrent dispatchers are expected.
|
|
23
|
-
*/
|
|
24
|
-
declare function createBlobDriver(options?: BlobDriverOptions): StoreDriver;
|
|
25
|
-
|
|
26
|
-
export { type BlobClient, type BlobDriverOptions, createBlobDriver, vercelBlobClient };
|
package/dist/blob/index.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RecordExistsError,
|
|
3
|
-
RecordNotFoundError,
|
|
4
|
-
VersionConflictError
|
|
5
|
-
} from "../chunk-CEF6VJZC.js";
|
|
6
|
-
|
|
7
|
-
// src/blob/index.ts
|
|
8
|
-
import { get, head, list, put } from "@vercel/blob";
|
|
9
|
-
function isNotFoundError(error) {
|
|
10
|
-
return error instanceof Error && (error.name === "BlobNotFoundError" || /does not exist|not.?found|404/iu.test(error.message));
|
|
11
|
-
}
|
|
12
|
-
function isAlreadyExistsError(error) {
|
|
13
|
-
return error instanceof Error && /already exists|not allowed to overwrite|overwrite/iu.test(error.message);
|
|
14
|
-
}
|
|
15
|
-
var vercelBlobClient = {
|
|
16
|
-
async read(pathname) {
|
|
17
|
-
let url;
|
|
18
|
-
try {
|
|
19
|
-
url = (await head(pathname)).url;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
if (isNotFoundError(error)) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
throw error;
|
|
25
|
-
}
|
|
26
|
-
const result = await get(url, { access: "private" });
|
|
27
|
-
if (result === null) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
return new Response(result.stream).text();
|
|
31
|
-
},
|
|
32
|
-
async write(pathname, body, overwrite) {
|
|
33
|
-
await put(pathname, body, {
|
|
34
|
-
access: "private",
|
|
35
|
-
allowOverwrite: overwrite,
|
|
36
|
-
contentType: "application/json"
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
async listPaths(prefix) {
|
|
40
|
-
const paths = [];
|
|
41
|
-
let cursor;
|
|
42
|
-
do {
|
|
43
|
-
const page = await list({ prefix, cursor, limit: 1e3 });
|
|
44
|
-
paths.push(...page.blobs.map((blob) => blob.pathname));
|
|
45
|
-
cursor = page.hasMore ? page.cursor : void 0;
|
|
46
|
-
} while (cursor !== void 0);
|
|
47
|
-
return paths;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
function createBlobDriver(options = {}) {
|
|
51
|
-
const client = options.client ?? vercelBlobClient;
|
|
52
|
-
const prefix = options.prefix ?? "factory";
|
|
53
|
-
function pathFor(collection, id) {
|
|
54
|
-
return `${prefix}/${collection}/${id}.json`;
|
|
55
|
-
}
|
|
56
|
-
async function readRecord(collection, id) {
|
|
57
|
-
let text;
|
|
58
|
-
try {
|
|
59
|
-
text = await client.read(pathFor(collection, id));
|
|
60
|
-
} catch (error) {
|
|
61
|
-
if (isNotFoundError(error)) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
throw error;
|
|
65
|
-
}
|
|
66
|
-
if (text === null) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
const parsed = JSON.parse(text);
|
|
70
|
-
if (typeof parsed.version !== "number") {
|
|
71
|
-
throw new Error(`malformed stored record at ${pathFor(collection, id)}`);
|
|
72
|
-
}
|
|
73
|
-
return parsed;
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
name: "blob",
|
|
77
|
-
get(collection, id) {
|
|
78
|
-
return readRecord(collection, id);
|
|
79
|
-
},
|
|
80
|
-
async insert(collection, id, value) {
|
|
81
|
-
try {
|
|
82
|
-
await client.write(
|
|
83
|
-
pathFor(collection, id),
|
|
84
|
-
JSON.stringify({ value, version: 1 }),
|
|
85
|
-
false
|
|
86
|
-
);
|
|
87
|
-
} catch (error) {
|
|
88
|
-
if (isAlreadyExistsError(error)) {
|
|
89
|
-
throw new RecordExistsError(collection, id);
|
|
90
|
-
}
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
async update(collection, id, value, expectedVersion) {
|
|
95
|
-
const existing = await readRecord(collection, id);
|
|
96
|
-
if (existing === null) {
|
|
97
|
-
throw new RecordNotFoundError(collection, id);
|
|
98
|
-
}
|
|
99
|
-
if (existing.version !== expectedVersion) {
|
|
100
|
-
throw new VersionConflictError(collection, id, expectedVersion);
|
|
101
|
-
}
|
|
102
|
-
await client.write(
|
|
103
|
-
pathFor(collection, id),
|
|
104
|
-
JSON.stringify({ value, version: expectedVersion + 1 }),
|
|
105
|
-
true
|
|
106
|
-
);
|
|
107
|
-
},
|
|
108
|
-
async list(collection) {
|
|
109
|
-
const dir = `${prefix}/${collection}/`;
|
|
110
|
-
const paths = await client.listPaths(dir);
|
|
111
|
-
const entries = [];
|
|
112
|
-
for (const pathname of paths) {
|
|
113
|
-
const id = pathname.slice(dir.length).replace(/\.json$/u, "");
|
|
114
|
-
const record = await readRecord(collection, id);
|
|
115
|
-
if (record !== null) {
|
|
116
|
-
entries.push({ id, record });
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return entries;
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
export {
|
|
124
|
-
createBlobDriver,
|
|
125
|
-
vercelBlobClient
|
|
126
|
-
};
|
|
127
|
-
//# sourceMappingURL=index.js.map
|