@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.
Files changed (73) 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/connectors/slack.d.mts +43 -0
  9. package/dist/connectors/slack.mjs +50 -0
  10. package/dist/connectors/slack.mjs.map +1 -0
  11. package/dist/driver-Bbd25rNM.mjs +23 -0
  12. package/dist/driver-Bbd25rNM.mjs.map +1 -0
  13. package/dist/driver-CrZsy7sm.d.mts +34 -0
  14. package/dist/eve/index.d.mts +1101 -0
  15. package/dist/eve/index.mjs +853 -0
  16. package/dist/eve/index.mjs.map +1 -0
  17. package/dist/github-3sbHe-fo.d.mts +149 -0
  18. package/dist/github.d.mts +2 -0
  19. package/dist/github.mjs +332 -0
  20. package/dist/github.mjs.map +1 -0
  21. package/dist/id-DwCihQr4.mjs +31 -0
  22. package/dist/id-DwCihQr4.mjs.map +1 -0
  23. package/dist/index-WNGZJRRH.d.mts +67 -0
  24. package/dist/index.d.mts +187 -0
  25. package/dist/index.mjs +907 -0
  26. package/dist/index.mjs.map +1 -0
  27. package/dist/next-page.d.mts +5 -0
  28. package/dist/next-page.mjs +71 -0
  29. package/dist/next-page.mjs.map +1 -0
  30. package/dist/next.d.mts +12 -0
  31. package/dist/{next.js → next.mjs} +13 -14
  32. package/dist/next.mjs.map +1 -0
  33. package/dist/postgres/index.d.mts +137 -0
  34. package/dist/postgres/index.mjs +96 -0
  35. package/dist/postgres/index.mjs.map +1 -0
  36. package/dist/signal-CHVEmzvI.d.mts +59 -0
  37. package/dist/task-Cj7Ei9Nh.mjs +336 -0
  38. package/dist/task-Cj7Ei9Nh.mjs.map +1 -0
  39. package/package.json +29 -22
  40. package/dist/approval-Z7iaWibT.d.ts +0 -541
  41. package/dist/blob/index.d.ts +0 -26
  42. package/dist/blob/index.js +0 -127
  43. package/dist/blob/index.js.map +0 -1
  44. package/dist/chunk-2JFES6BA.js +0 -41
  45. package/dist/chunk-2JFES6BA.js.map +0 -1
  46. package/dist/chunk-CEF6VJZC.js +0 -28
  47. package/dist/chunk-CEF6VJZC.js.map +0 -1
  48. package/dist/chunk-D2XMABG4.js +0 -311
  49. package/dist/chunk-D2XMABG4.js.map +0 -1
  50. package/dist/chunk-EFL4PDDE.js +0 -325
  51. package/dist/chunk-EFL4PDDE.js.map +0 -1
  52. package/dist/common-CaHaEOAS.d.ts +0 -18
  53. package/dist/connectors/index.d.ts +0 -53
  54. package/dist/connectors/index.js +0 -64
  55. package/dist/connectors/index.js.map +0 -1
  56. package/dist/driver-tRNggCCJ.d.ts +0 -32
  57. package/dist/eve/index.d.ts +0 -1053
  58. package/dist/eve/index.js +0 -752
  59. package/dist/eve/index.js.map +0 -1
  60. package/dist/github.d.ts +0 -139
  61. package/dist/github.js +0 -27
  62. package/dist/github.js.map +0 -1
  63. package/dist/index.d.ts +0 -164
  64. package/dist/index.js +0 -940
  65. package/dist/index.js.map +0 -1
  66. package/dist/next-page.d.ts +0 -5
  67. package/dist/next-page.js +0 -75
  68. package/dist/next-page.js.map +0 -1
  69. package/dist/next.d.ts +0 -12
  70. package/dist/next.js.map +0 -1
  71. package/dist/postgres/index.d.ts +0 -137
  72. package/dist/postgres/index.js +0 -118
  73. package/dist/postgres/index.js.map +0 -1
@@ -0,0 +1,1101 @@
1
+ import { c as Finding, k as FactoryStores, t as ApprovalPolicy } from "../approval-h5aj8HYN.mjs";
2
+ import { d as GitHubReviewComment } from "../github-3sbHe-fo.mjs";
3
+ import { z } from "zod";
4
+ //#region src/eve/fetch.d.ts
5
+ /** The subset of the eve sandbox handle a credentialed git operation needs. */
6
+ interface CommandSandbox {
7
+ run(options: {
8
+ command: string;
9
+ }): PromiseLike<{
10
+ stdout: string;
11
+ stderr?: string;
12
+ exitCode?: number;
13
+ }>;
14
+ }
15
+ interface FetchPullRequestOptions<S extends CommandSandbox = CommandSandbox> {
16
+ /**
17
+ * Runs one git command against `slug` with a credential the sandbox does not
18
+ * otherwise have, and removes it again before resolving. Supplied by the
19
+ * app, which owns how credentials are minted and where they are injected;
20
+ * the library only decides what is fetched.
21
+ */
22
+ withCredential: (sandbox: S, slug: string, command: string) => Promise<{
23
+ stdout: string;
24
+ stderr?: string;
25
+ exitCode?: number;
26
+ }>;
27
+ /** Path of the checkout inside the sandbox. Defaults to `repo`. */
28
+ repoPath?: string;
29
+ /** Fetch depth for the pull request head. Defaults to 50. */
30
+ depth?: number;
31
+ }
32
+ type FetchPullRequestResult = {
33
+ fetched: false;
34
+ reason: string;
35
+ } | {
36
+ fetched: true;
37
+ prNumber: number;
38
+ prUrl: string;
39
+ branch: string;
40
+ headSha: string;
41
+ };
42
+ /**
43
+ * The verifier's way in to the change under review. The sandbox has no
44
+ * GitHub credential while the agent runs, so trusted code does the one fetch
45
+ * the agent cannot: the pull request number and repository come from the
46
+ * change record, never from the agent, and the credential is gone again
47
+ * before control returns. Mirrors how publication reads commits out of the
48
+ * sandbox instead of letting the agent push.
49
+ */
50
+ declare function fetchPullRequestTool<S extends CommandSandbox>(stores: FactoryStores, options: FetchPullRequestOptions<S>): import("eve/tools").ToolDefinition<{
51
+ changeId: string;
52
+ }, FetchPullRequestResult> & {
53
+ execute(input: {
54
+ changeId: string;
55
+ }, ctx: import("eve/tools").ToolContext): Promise<FetchPullRequestResult>;
56
+ };
57
+ //#endregion
58
+ //#region src/eve/conflict.d.ts
59
+ declare const mergeConflictPayloadSchema: z.ZodObject<{
60
+ repository: z.ZodString;
61
+ prNumber: z.ZodNumber;
62
+ prUrl: z.ZodURL;
63
+ headBranch: z.ZodString;
64
+ headSha: z.ZodString;
65
+ baseBranch: z.ZodString;
66
+ baseSha: z.ZodString;
67
+ }, z.core.$strict>;
68
+ type MergeConflictPayload = z.infer<typeof mergeConflictPayloadSchema>;
69
+ interface MergeConflictToolOptions<S extends CommandSandbox = CommandSandbox> {
70
+ withCredential: (sandbox: S, repository: string, command: string) => Promise<{
71
+ stdout: string;
72
+ stderr?: string;
73
+ exitCode?: number;
74
+ }>;
75
+ repoPath?: string;
76
+ }
77
+ declare function mergeConflictTools<S extends CommandSandbox>(stores: FactoryStores, options: MergeConflictToolOptions<S>): {
78
+ fetch_merge_conflict: import("eve/tools").ToolDefinition<{
79
+ taskId: string;
80
+ }, {
81
+ conflictedFiles: string[];
82
+ repository: string;
83
+ prNumber: number;
84
+ prUrl: string;
85
+ headBranch: string;
86
+ headSha: string;
87
+ baseBranch: string;
88
+ baseSha: string;
89
+ }> & {
90
+ execute(input: {
91
+ taskId: string;
92
+ }, ctx: import("eve/tools").ToolContext): Promise<{
93
+ conflictedFiles: string[];
94
+ repository: string;
95
+ prNumber: number;
96
+ prUrl: string;
97
+ headBranch: string;
98
+ headSha: string;
99
+ baseBranch: string;
100
+ baseSha: string;
101
+ }>;
102
+ };
103
+ publish_merge_resolution: import("eve/tools").ToolDefinition<{
104
+ taskId: string;
105
+ summary: string;
106
+ }, {
107
+ updated: true;
108
+ prNumber: number;
109
+ prUrl: string;
110
+ }> & {
111
+ execute(input: {
112
+ taskId: string;
113
+ summary: string;
114
+ }, ctx: import("eve/tools").ToolContext): Promise<{
115
+ updated: true;
116
+ prNumber: number;
117
+ prUrl: string;
118
+ }>;
119
+ };
120
+ };
121
+ //#endregion
122
+ //#region src/eve/finding.d.ts
123
+ interface RecordFindingOptions {
124
+ /** Signal source the findings are recorded under. Defaults to security_scan. */
125
+ source?: string;
126
+ /** Which resulting tasks wait for a human. Defaults to the standard policy. */
127
+ approval?: ApprovalPolicy;
128
+ }
129
+ type RecordFindingResult = {
130
+ recorded: false;
131
+ reason: string;
132
+ duplicate?: true;
133
+ signalId?: string;
134
+ } | {
135
+ recorded: true;
136
+ signalId: string;
137
+ taskId: string;
138
+ approval: "required" | "not_required";
139
+ };
140
+ /**
141
+ * Turn one finding into a signal and a fix task. The fingerprint is the
142
+ * signal's delivery id, so the same problem reported twice is a no-op. The
143
+ * signal is accepted on the reporter's own verification (a human gate follows
144
+ * when the approval policy says so), and the task carries the approval
145
+ * decision from the moment it exists. Shared by record_finding and scanner
146
+ * tools that record on the agent's behalf.
147
+ */
148
+ declare function recordFinding(stores: FactoryStores, repositoryId: string, finding: Finding, options?: RecordFindingOptions): Promise<RecordFindingResult>;
149
+ /**
150
+ * The scanner's outcome tool: turns one finding into a signal and a fix task
151
+ * in a single deterministic step. The finding's fingerprint is the signal's
152
+ * delivery id, so reporting the same problem twice is a no-op. The signal is
153
+ * accepted on the reporter's own verification (a human gate follows when the
154
+ * approval policy says so), and the task carries the approval decision from
155
+ * the moment it exists.
156
+ */
157
+ declare function recordFindingTool(stores: FactoryStores, options?: RecordFindingOptions): import("eve/tools").ToolDefinition<{
158
+ repositoryId: string;
159
+ finding: {
160
+ title: string;
161
+ body: string;
162
+ priority: "P0" | "P1" | "P2" | "P3";
163
+ category: "security" | "correctness" | "reliability" | "performance" | "compatibility" | "accessibility" | "documentation" | "maintainability" | "testing" | "usability";
164
+ verification: {
165
+ level: "unverified" | "supported" | "confirmed";
166
+ method: "documentation" | "code_inspection" | "static_analysis" | "manual_reproduction" | "unit_test" | "integration_test" | "e2e_test" | "runtime_observation";
167
+ summary: string;
168
+ limitations?: string | undefined;
169
+ };
170
+ path?: string | undefined;
171
+ line?: number | undefined;
172
+ endLine?: number | undefined;
173
+ tool?: string | undefined;
174
+ ruleId?: string | undefined;
175
+ };
176
+ }, RecordFindingResult> & {
177
+ execute(input: {
178
+ repositoryId: string;
179
+ finding: {
180
+ title: string;
181
+ body: string;
182
+ priority: "P0" | "P1" | "P2" | "P3";
183
+ category: "security" | "correctness" | "reliability" | "performance" | "compatibility" | "accessibility" | "documentation" | "maintainability" | "testing" | "usability";
184
+ verification: {
185
+ level: "unverified" | "supported" | "confirmed";
186
+ method: "documentation" | "code_inspection" | "static_analysis" | "manual_reproduction" | "unit_test" | "integration_test" | "e2e_test" | "runtime_observation";
187
+ summary: string;
188
+ limitations?: string | undefined;
189
+ };
190
+ path?: string | undefined;
191
+ line?: number | undefined;
192
+ endLine?: number | undefined;
193
+ tool?: string | undefined;
194
+ ruleId?: string | undefined;
195
+ };
196
+ }, ctx: import("eve/tools").ToolContext): Promise<RecordFindingResult>;
197
+ };
198
+ //#endregion
199
+ //#region src/eve/deepsec.d.ts
200
+ interface DeepsecScanOptions<S extends CommandSandbox = CommandSandbox> extends RecordFindingOptions {
201
+ /**
202
+ * Runs one shell command with the model credential deepsec's gateway route
203
+ * expects, and removes it again before resolving. Supplied by the app, which
204
+ * owns where the credential comes from: on Vercel it is the deployment's own
205
+ * OIDC identity (VERCEL_OIDC_TOKEN), so nothing has to be configured.
206
+ */
207
+ withModelCredential: (sandbox: S, command: string) => Promise<{
208
+ stdout: string;
209
+ stderr?: string;
210
+ exitCode?: number;
211
+ }>;
212
+ /** deepsec agent backend: claude, codex, or pi. */
213
+ agent?: "claude" | "codex" | "pi";
214
+ /** Model deepsec's investigation agent uses, through the AI Gateway (e.g. claude-sonnet-4-6). */
215
+ model?: string;
216
+ /** Reasoning effort for the investigation: minimal, low, medium, high, or xhigh. */
217
+ thinkingLevel?: "minimal" | "low" | "medium" | "high" | "xhigh";
218
+ /** Parallel investigation batches. */
219
+ concurrency?: number;
220
+ /** deepsec version to install. */
221
+ version?: string;
222
+ /** Repository checkout inside the sandbox. Defaults to `repo`. */
223
+ repoPath?: string;
224
+ /** deepsec workspace inside the sandbox. Defaults to `deepsec`. */
225
+ workspacePath?: string;
226
+ /** Shell run before every deepsec command, e.g. to put a Node 24 on PATH. */
227
+ commandPrefix?: string;
228
+ /**
229
+ * Candidate files investigated per run. deepsec keeps state, so successive
230
+ * scans continue where the last one stopped; the cap keeps one run inside
231
+ * the deployment's time limit on large repositories. Defaults to 40.
232
+ */
233
+ filesPerRun?: number;
234
+ }
235
+ /** deepsec's exported finding shape, as far as we depend on it. */
236
+ declare const deepsecFindingSchema: z.ZodObject<{
237
+ title: z.ZodString;
238
+ description: z.ZodString;
239
+ severity: z.ZodString;
240
+ metadata: z.ZodOptional<z.ZodObject<{
241
+ filePath: z.ZodOptional<z.ZodString>;
242
+ lineNumbers: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
243
+ vulnSlug: z.ZodOptional<z.ZodString>;
244
+ confidence: z.ZodOptional<z.ZodString>;
245
+ runId: z.ZodOptional<z.ZodString>;
246
+ }, z.core.$loose>>;
247
+ }, z.core.$loose>;
248
+ /** Convert one deepsec finding into the factory's Finding. Pure; exported for tests. */
249
+ declare function findingFromDeepsec(raw: z.infer<typeof deepsecFindingSchema>): Finding;
250
+ /**
251
+ * Runs deepsec (vercel-labs/deepsec) against the sandbox checkout and records
252
+ * what it finds through the same path as record_finding, so every deepsec
253
+ * finding becomes a fix task subject to the approval policy. Trusted code
254
+ * owns the command sequence and the credential; the agent chooses when to
255
+ * scan and reports the outcome.
256
+ */
257
+ declare function deepsecScanTool<S extends CommandSandbox>(stores: FactoryStores, options: DeepsecScanOptions<S>): import("eve/tools").ToolDefinition<{
258
+ repositoryId: string;
259
+ limit?: number | undefined;
260
+ }, {
261
+ scanned: false;
262
+ reason: string;
263
+ tool?: undefined;
264
+ found?: undefined;
265
+ recorded?: undefined;
266
+ duplicates?: undefined;
267
+ awaitingApproval?: undefined;
268
+ findings?: undefined;
269
+ } | {
270
+ scanned: true;
271
+ tool: string;
272
+ found: number;
273
+ recorded: number;
274
+ duplicates: number;
275
+ awaitingApproval: number;
276
+ findings: ({
277
+ taskId: string;
278
+ approval: "required" | "not_required";
279
+ title: string;
280
+ priority: "P0" | "P1" | "P2" | "P3";
281
+ path: string | undefined;
282
+ line: number | undefined;
283
+ } | {
284
+ duplicate: boolean;
285
+ title: string;
286
+ priority: "P0" | "P1" | "P2" | "P3";
287
+ path: string | undefined;
288
+ line: number | undefined;
289
+ })[];
290
+ reason?: undefined;
291
+ }> & {
292
+ execute(input: {
293
+ repositoryId: string;
294
+ limit?: number | undefined;
295
+ }, ctx: import("eve/tools").ToolContext): Promise<{
296
+ scanned: false;
297
+ reason: string;
298
+ tool?: undefined;
299
+ found?: undefined;
300
+ recorded?: undefined;
301
+ duplicates?: undefined;
302
+ awaitingApproval?: undefined;
303
+ findings?: undefined;
304
+ } | {
305
+ scanned: true;
306
+ tool: string;
307
+ found: number;
308
+ recorded: number;
309
+ duplicates: number;
310
+ awaitingApproval: number;
311
+ findings: ({
312
+ taskId: string;
313
+ approval: "required" | "not_required";
314
+ title: string;
315
+ priority: "P0" | "P1" | "P2" | "P3";
316
+ path: string | undefined;
317
+ line: number | undefined;
318
+ } | {
319
+ duplicate: boolean;
320
+ title: string;
321
+ priority: "P0" | "P1" | "P2" | "P3";
322
+ path: string | undefined;
323
+ line: number | undefined;
324
+ })[];
325
+ reason?: undefined;
326
+ }>;
327
+ };
328
+ //#endregion
329
+ //#region src/eve/invoke.d.ts
330
+ interface InvokeAgentOptions {
331
+ /** The factory task kind the handoff creates, e.g. "verification". */
332
+ kind: string;
333
+ /** Model-facing description of what the target agent does and when to invoke it. */
334
+ description: string;
335
+ /**
336
+ * Base URL of the target agent's eve transport, e.g.
337
+ * `https://factory.example.com/eve/agents/verifier`. Resolved at call time so
338
+ * a deployment can derive it from its own origin.
339
+ */
340
+ targetUrl: () => string;
341
+ /** Bearer token for the target agent's eve channel, when it requires auth. */
342
+ token?: () => Promise<string | undefined>;
343
+ /** Extra headers for the session request, e.g. a deployment protection bypass. */
344
+ headers?: () => Record<string, string> | Promise<Record<string, string>>;
345
+ fetch?: typeof fetch;
346
+ }
347
+ /**
348
+ * A tool that lets one agent hand work to another, NMA-style: the caller
349
+ * decides to invoke; trusted code owns the how. The handoff is recorded as a
350
+ * factory task (single-winner dispatch, receipts), then a fresh session is
351
+ * started on the target agent carrying only the task id — never the caller's
352
+ * context. The session start is create-once on the task id, so a retried
353
+ * tool call cannot start a second session.
354
+ */
355
+ declare function invokeAgentTool(stores: FactoryStores, options: InvokeAgentOptions): import("eve/tools").ToolDefinition<{
356
+ repositoryIds: string[];
357
+ channel: string;
358
+ address: string;
359
+ brief: string;
360
+ parentTaskId?: string | undefined;
361
+ changeId?: string | undefined;
362
+ }, {
363
+ taskId: string;
364
+ kind: string;
365
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
366
+ }> & {
367
+ execute(input: {
368
+ repositoryIds: string[];
369
+ channel: string;
370
+ address: string;
371
+ brief: string;
372
+ parentTaskId?: string | undefined;
373
+ changeId?: string | undefined;
374
+ }, ctx: import("eve/tools").ToolContext): Promise<{
375
+ taskId: string;
376
+ kind: string;
377
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
378
+ }>;
379
+ };
380
+ //#endregion
381
+ //#region src/eve/review.d.ts
382
+ interface ReviewCommentToolOptions<S extends CommandSandbox = CommandSandbox> {
383
+ tokenForRepository: (repository: string) => Promise<string>;
384
+ withCredential?: (sandbox: S, repository: string, command: string) => Promise<{
385
+ stdout: string;
386
+ stderr?: string;
387
+ exitCode?: number;
388
+ }>;
389
+ fetch?: typeof globalThis.fetch;
390
+ repoPath?: string;
391
+ }
392
+ declare function reviewCommentTools<S extends CommandSandbox>(stores: FactoryStores, options: ReviewCommentToolOptions<S>): {
393
+ read_review_comment: import("eve/tools").ToolDefinition<{
394
+ changeId: string;
395
+ commentId: number;
396
+ }, GitHubReviewComment> & {
397
+ execute(input: {
398
+ changeId: string;
399
+ commentId: number;
400
+ }, ctx: import("eve/tools").ToolContext): Promise<GitHubReviewComment>;
401
+ };
402
+ answer_review_comment: import("eve/tools").ToolDefinition<{
403
+ changeId: string;
404
+ commentId: number;
405
+ body: string;
406
+ }, GitHubReviewComment> & {
407
+ execute(input: {
408
+ changeId: string;
409
+ commentId: number;
410
+ body: string;
411
+ }, ctx: import("eve/tools").ToolContext): Promise<GitHubReviewComment>;
412
+ };
413
+ suggest_review_fix: import("eve/tools").ToolDefinition<{
414
+ changeId: string;
415
+ commentId: number;
416
+ confidence: "medium";
417
+ replacement: string;
418
+ summary: string;
419
+ }, GitHubReviewComment> & {
420
+ execute(input: {
421
+ changeId: string;
422
+ commentId: number;
423
+ confidence: "medium";
424
+ replacement: string;
425
+ summary: string;
426
+ }, ctx: import("eve/tools").ToolContext): Promise<GitHubReviewComment>;
427
+ };
428
+ apply_review_fix: import("eve/tools").ToolDefinition<{
429
+ changeId: string;
430
+ commentId: number;
431
+ confidence: "high";
432
+ summary: string;
433
+ }, {
434
+ updated: true;
435
+ prNumber: number;
436
+ prUrl: string;
437
+ reply: GitHubReviewComment;
438
+ }> & {
439
+ execute(input: {
440
+ changeId: string;
441
+ commentId: number;
442
+ confidence: "high";
443
+ summary: string;
444
+ }, ctx: import("eve/tools").ToolContext): Promise<{
445
+ updated: true;
446
+ prNumber: number;
447
+ prUrl: string;
448
+ reply: GitHubReviewComment;
449
+ }>;
450
+ };
451
+ };
452
+ //#endregion
453
+ //#region src/eve/verification.d.ts
454
+ /**
455
+ * The verifier's outcome tool. Writes evidence onto the change and moves it
456
+ * to ready only when the verdict is pass; a failed verdict leaves the change
457
+ * verifying with the evidence recorded, and the verification task itself
458
+ * ends with a receipt either way. The change's own code_change task follows
459
+ * the verdict too: succeeded on pass, failed on fail with the verifier's
460
+ * summary as the reason, so the ledger never shows a verified-and-rejected fix
461
+ * as still in progress. Fail closed: the agent cannot mark a change ready
462
+ * without supplying every evidence field.
463
+ */
464
+ declare function recordVerificationTool(stores: FactoryStores): import("eve/tools").ToolDefinition<{
465
+ taskId: string;
466
+ changeId: string;
467
+ verdict: "pass" | "fail";
468
+ evidence: {
469
+ reproVerified: boolean;
470
+ testsAdded: number;
471
+ checksGreen: boolean;
472
+ attackPassed: boolean;
473
+ scopeMatches: boolean;
474
+ previewUrl?: string | undefined;
475
+ };
476
+ confidence: "low" | "medium" | "high";
477
+ summary: string;
478
+ }, {
479
+ recorded: false;
480
+ reason: string;
481
+ verdict?: undefined;
482
+ changeState?: undefined;
483
+ taskState?: undefined;
484
+ } | {
485
+ recorded: true;
486
+ verdict: "pass" | "fail";
487
+ changeState: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
488
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
489
+ reason?: undefined;
490
+ }> & {
491
+ execute(input: {
492
+ taskId: string;
493
+ changeId: string;
494
+ verdict: "pass" | "fail";
495
+ evidence: {
496
+ reproVerified: boolean;
497
+ testsAdded: number;
498
+ checksGreen: boolean;
499
+ attackPassed: boolean;
500
+ scopeMatches: boolean;
501
+ previewUrl?: string | undefined;
502
+ };
503
+ confidence: "low" | "medium" | "high";
504
+ summary: string;
505
+ }, ctx: import("eve/tools").ToolContext): Promise<{
506
+ recorded: false;
507
+ reason: string;
508
+ verdict?: undefined;
509
+ changeState?: undefined;
510
+ taskState?: undefined;
511
+ } | {
512
+ recorded: true;
513
+ verdict: "pass" | "fail";
514
+ changeState: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
515
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
516
+ reason?: undefined;
517
+ }>;
518
+ };
519
+ //#endregion
520
+ //#region src/eve/index.d.ts
521
+ declare const recordChangeInputSchema: z.ZodObject<{
522
+ taskId: z.ZodString;
523
+ repositoryId: z.ZodString;
524
+ prNumber: z.ZodNumber;
525
+ prUrl: z.ZodURL;
526
+ risk: z.ZodEnum<{
527
+ low: "low";
528
+ medium: "medium";
529
+ high: "high";
530
+ }>;
531
+ confidence: z.ZodEnum<{
532
+ low: "low";
533
+ medium: "medium";
534
+ high: "high";
535
+ }>;
536
+ summary: z.ZodString;
537
+ }, z.core.$strip>;
538
+ type RecordChangeInput = z.infer<typeof recordChangeInputSchema>;
539
+ type GateVerdict = {
540
+ ok: true;
541
+ } | {
542
+ ok: false;
543
+ reason: string;
544
+ };
545
+ interface FactoryToolsOptions {
546
+ /**
547
+ * Pre-action gate for record_change, run as an eve approval policy before
548
+ * the tool executes. Refusals reach the model as a denial with the reason.
549
+ * Gates must fail closed: when they cannot verify, they refuse.
550
+ */
551
+ recordChangeGate?: (input: RecordChangeInput) => Promise<GateVerdict>;
552
+ }
553
+ /**
554
+ * The factory's store operations wrapped as eve tools. Expose a tool to an
555
+ * agent by re-exporting it from a file under agent/tools/, e.g.
556
+ * `export default factoryTools(stores).get_task;`. Every write goes through
557
+ * the engine, so agents inherit transition legality and receipts.
558
+ */
559
+ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptions): {
560
+ get_task: import("eve/tools").ToolDefinition<{
561
+ taskId: string;
562
+ }, {
563
+ schemaVersion: 1;
564
+ id: string;
565
+ kind: string;
566
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
567
+ origin: {
568
+ signalId?: string | undefined;
569
+ parentTaskId?: string | undefined;
570
+ operator?: string | undefined;
571
+ };
572
+ replyTo: {
573
+ channel: string;
574
+ address: string;
575
+ };
576
+ attempt: number;
577
+ createdAt: string;
578
+ updatedAt: string;
579
+ repositoryIds?: string[] | undefined;
580
+ area?: string | undefined;
581
+ approval?: "required" | "granted" | "denied" | undefined;
582
+ dependsOn?: string[] | undefined;
583
+ devbox?: {
584
+ devboxId: string;
585
+ remoteId: string;
586
+ harness: string;
587
+ } | undefined;
588
+ reservedUsd?: number | undefined;
589
+ settledUsd?: number | undefined;
590
+ question?: {
591
+ text: string;
592
+ options: string[];
593
+ answer?: string | undefined;
594
+ answeredBy?: string | undefined;
595
+ } | undefined;
596
+ changeId?: string | undefined;
597
+ reportRef?: string | undefined;
598
+ } | {
599
+ found: false;
600
+ taskId: string;
601
+ }> & {
602
+ execute(input: {
603
+ taskId: string;
604
+ }, ctx: import("eve/tools").ToolContext): Promise<{
605
+ schemaVersion: 1;
606
+ id: string;
607
+ kind: string;
608
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
609
+ origin: {
610
+ signalId?: string | undefined;
611
+ parentTaskId?: string | undefined;
612
+ operator?: string | undefined;
613
+ };
614
+ replyTo: {
615
+ channel: string;
616
+ address: string;
617
+ };
618
+ attempt: number;
619
+ createdAt: string;
620
+ updatedAt: string;
621
+ repositoryIds?: string[] | undefined;
622
+ area?: string | undefined;
623
+ approval?: "required" | "granted" | "denied" | undefined;
624
+ dependsOn?: string[] | undefined;
625
+ devbox?: {
626
+ devboxId: string;
627
+ remoteId: string;
628
+ harness: string;
629
+ } | undefined;
630
+ reservedUsd?: number | undefined;
631
+ settledUsd?: number | undefined;
632
+ question?: {
633
+ text: string;
634
+ options: string[];
635
+ answer?: string | undefined;
636
+ answeredBy?: string | undefined;
637
+ } | undefined;
638
+ changeId?: string | undefined;
639
+ reportRef?: string | undefined;
640
+ } | {
641
+ found: false;
642
+ taskId: string;
643
+ }>;
644
+ };
645
+ decide_signal: import("eve/tools").ToolDefinition<{
646
+ signalId: string;
647
+ outcome: "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
648
+ reason: string;
649
+ detail?: string | undefined;
650
+ }, {
651
+ schemaVersion: 1;
652
+ id: string;
653
+ repositoryId: string;
654
+ source: string;
655
+ deliveryId: string;
656
+ replyTo: {
657
+ channel: string;
658
+ address: string;
659
+ };
660
+ payload: unknown;
661
+ receivedAt: string;
662
+ outcome: "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored" | "pending";
663
+ detail?: string | undefined;
664
+ reason?: string | undefined;
665
+ decidedAt?: string | undefined;
666
+ }> & {
667
+ execute(input: {
668
+ signalId: string;
669
+ outcome: "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
670
+ reason: string;
671
+ detail?: string | undefined;
672
+ }, ctx: import("eve/tools").ToolContext): Promise<{
673
+ schemaVersion: 1;
674
+ id: string;
675
+ repositoryId: string;
676
+ source: string;
677
+ deliveryId: string;
678
+ replyTo: {
679
+ channel: string;
680
+ address: string;
681
+ };
682
+ payload: unknown;
683
+ receivedAt: string;
684
+ outcome: "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored" | "pending";
685
+ detail?: string | undefined;
686
+ reason?: string | undefined;
687
+ decidedAt?: string | undefined;
688
+ }>;
689
+ };
690
+ record_change: import("eve/tools").ToolDefinition<{
691
+ taskId: string;
692
+ repositoryId: string;
693
+ prNumber: number;
694
+ prUrl: string;
695
+ risk: "low" | "medium" | "high";
696
+ confidence: "low" | "medium" | "high";
697
+ summary: string;
698
+ }, {
699
+ change: {
700
+ schemaVersion: 1;
701
+ id: string;
702
+ repositoryId: string;
703
+ prNumber: number;
704
+ prUrl: string;
705
+ author: string;
706
+ risk: "low" | "medium" | "high";
707
+ confidence: "low" | "medium" | "high";
708
+ evidence: {
709
+ reproVerified: boolean;
710
+ testsAdded: number;
711
+ checksGreen: boolean;
712
+ attackPassed: boolean;
713
+ scopeMatches: boolean;
714
+ previewUrl?: string | undefined;
715
+ };
716
+ state: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
717
+ createdAt: string;
718
+ updatedAt: string;
719
+ taskId?: string | undefined;
720
+ groupId?: string | undefined;
721
+ decidedBy?: string | undefined;
722
+ };
723
+ task: {
724
+ schemaVersion: 1;
725
+ id: string;
726
+ kind: string;
727
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
728
+ origin: {
729
+ signalId?: string | undefined;
730
+ parentTaskId?: string | undefined;
731
+ operator?: string | undefined;
732
+ };
733
+ replyTo: {
734
+ channel: string;
735
+ address: string;
736
+ };
737
+ attempt: number;
738
+ createdAt: string;
739
+ updatedAt: string;
740
+ repositoryIds?: string[] | undefined;
741
+ area?: string | undefined;
742
+ approval?: "required" | "granted" | "denied" | undefined;
743
+ dependsOn?: string[] | undefined;
744
+ devbox?: {
745
+ devboxId: string;
746
+ remoteId: string;
747
+ harness: string;
748
+ } | undefined;
749
+ reservedUsd?: number | undefined;
750
+ settledUsd?: number | undefined;
751
+ question?: {
752
+ text: string;
753
+ options: string[];
754
+ answer?: string | undefined;
755
+ answeredBy?: string | undefined;
756
+ } | undefined;
757
+ changeId?: string | undefined;
758
+ reportRef?: string | undefined;
759
+ };
760
+ }> & {
761
+ execute(input: {
762
+ taskId: string;
763
+ repositoryId: string;
764
+ prNumber: number;
765
+ prUrl: string;
766
+ risk: "low" | "medium" | "high";
767
+ confidence: "low" | "medium" | "high";
768
+ summary: string;
769
+ }, ctx: import("eve/tools").ToolContext): Promise<{
770
+ change: {
771
+ schemaVersion: 1;
772
+ id: string;
773
+ repositoryId: string;
774
+ prNumber: number;
775
+ prUrl: string;
776
+ author: string;
777
+ risk: "low" | "medium" | "high";
778
+ confidence: "low" | "medium" | "high";
779
+ evidence: {
780
+ reproVerified: boolean;
781
+ testsAdded: number;
782
+ checksGreen: boolean;
783
+ attackPassed: boolean;
784
+ scopeMatches: boolean;
785
+ previewUrl?: string | undefined;
786
+ };
787
+ state: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
788
+ createdAt: string;
789
+ updatedAt: string;
790
+ taskId?: string | undefined;
791
+ groupId?: string | undefined;
792
+ decidedBy?: string | undefined;
793
+ };
794
+ task: {
795
+ schemaVersion: 1;
796
+ id: string;
797
+ kind: string;
798
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
799
+ origin: {
800
+ signalId?: string | undefined;
801
+ parentTaskId?: string | undefined;
802
+ operator?: string | undefined;
803
+ };
804
+ replyTo: {
805
+ channel: string;
806
+ address: string;
807
+ };
808
+ attempt: number;
809
+ createdAt: string;
810
+ updatedAt: string;
811
+ repositoryIds?: string[] | undefined;
812
+ area?: string | undefined;
813
+ approval?: "required" | "granted" | "denied" | undefined;
814
+ dependsOn?: string[] | undefined;
815
+ devbox?: {
816
+ devboxId: string;
817
+ remoteId: string;
818
+ harness: string;
819
+ } | undefined;
820
+ reservedUsd?: number | undefined;
821
+ settledUsd?: number | undefined;
822
+ question?: {
823
+ text: string;
824
+ options: string[];
825
+ answer?: string | undefined;
826
+ answeredBy?: string | undefined;
827
+ } | undefined;
828
+ changeId?: string | undefined;
829
+ reportRef?: string | undefined;
830
+ };
831
+ }>;
832
+ };
833
+ finish_task: import("eve/tools").ToolDefinition<{
834
+ taskId: string;
835
+ summary: string;
836
+ }, {
837
+ finished: false;
838
+ reason: string;
839
+ taskState?: undefined;
840
+ } | {
841
+ finished: true;
842
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
843
+ reason?: undefined;
844
+ }> & {
845
+ execute(input: {
846
+ taskId: string;
847
+ summary: string;
848
+ }, ctx: import("eve/tools").ToolContext): Promise<{
849
+ finished: false;
850
+ reason: string;
851
+ taskState?: undefined;
852
+ } | {
853
+ finished: true;
854
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
855
+ reason?: undefined;
856
+ }>;
857
+ };
858
+ report_blocked: import("eve/tools").ToolDefinition<{
859
+ taskId: string;
860
+ reason: string;
861
+ }, {
862
+ schemaVersion: 1;
863
+ id: string;
864
+ kind: string;
865
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
866
+ origin: {
867
+ signalId?: string | undefined;
868
+ parentTaskId?: string | undefined;
869
+ operator?: string | undefined;
870
+ };
871
+ replyTo: {
872
+ channel: string;
873
+ address: string;
874
+ };
875
+ attempt: number;
876
+ createdAt: string;
877
+ updatedAt: string;
878
+ repositoryIds?: string[] | undefined;
879
+ area?: string | undefined;
880
+ approval?: "required" | "granted" | "denied" | undefined;
881
+ dependsOn?: string[] | undefined;
882
+ devbox?: {
883
+ devboxId: string;
884
+ remoteId: string;
885
+ harness: string;
886
+ } | undefined;
887
+ reservedUsd?: number | undefined;
888
+ settledUsd?: number | undefined;
889
+ question?: {
890
+ text: string;
891
+ options: string[];
892
+ answer?: string | undefined;
893
+ answeredBy?: string | undefined;
894
+ } | undefined;
895
+ changeId?: string | undefined;
896
+ reportRef?: string | undefined;
897
+ }> & {
898
+ execute(input: {
899
+ taskId: string;
900
+ reason: string;
901
+ }, ctx: import("eve/tools").ToolContext): Promise<{
902
+ schemaVersion: 1;
903
+ id: string;
904
+ kind: string;
905
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
906
+ origin: {
907
+ signalId?: string | undefined;
908
+ parentTaskId?: string | undefined;
909
+ operator?: string | undefined;
910
+ };
911
+ replyTo: {
912
+ channel: string;
913
+ address: string;
914
+ };
915
+ attempt: number;
916
+ createdAt: string;
917
+ updatedAt: string;
918
+ repositoryIds?: string[] | undefined;
919
+ area?: string | undefined;
920
+ approval?: "required" | "granted" | "denied" | undefined;
921
+ dependsOn?: string[] | undefined;
922
+ devbox?: {
923
+ devboxId: string;
924
+ remoteId: string;
925
+ harness: string;
926
+ } | undefined;
927
+ reservedUsd?: number | undefined;
928
+ settledUsd?: number | undefined;
929
+ question?: {
930
+ text: string;
931
+ options: string[];
932
+ answer?: string | undefined;
933
+ answeredBy?: string | undefined;
934
+ } | undefined;
935
+ changeId?: string | undefined;
936
+ reportRef?: string | undefined;
937
+ }>;
938
+ };
939
+ ask_question: import("eve/tools").ToolDefinition<{
940
+ repositoryIds: string[];
941
+ channel: string;
942
+ address: string;
943
+ question: {
944
+ text: string;
945
+ options: string[];
946
+ };
947
+ parentTaskId?: string | undefined;
948
+ }, {
949
+ schemaVersion: 1;
950
+ id: string;
951
+ kind: string;
952
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
953
+ origin: {
954
+ signalId?: string | undefined;
955
+ parentTaskId?: string | undefined;
956
+ operator?: string | undefined;
957
+ };
958
+ replyTo: {
959
+ channel: string;
960
+ address: string;
961
+ };
962
+ attempt: number;
963
+ createdAt: string;
964
+ updatedAt: string;
965
+ repositoryIds?: string[] | undefined;
966
+ area?: string | undefined;
967
+ approval?: "required" | "granted" | "denied" | undefined;
968
+ dependsOn?: string[] | undefined;
969
+ devbox?: {
970
+ devboxId: string;
971
+ remoteId: string;
972
+ harness: string;
973
+ } | undefined;
974
+ reservedUsd?: number | undefined;
975
+ settledUsd?: number | undefined;
976
+ question?: {
977
+ text: string;
978
+ options: string[];
979
+ answer?: string | undefined;
980
+ answeredBy?: string | undefined;
981
+ } | undefined;
982
+ changeId?: string | undefined;
983
+ reportRef?: string | undefined;
984
+ }> & {
985
+ execute(input: {
986
+ repositoryIds: string[];
987
+ channel: string;
988
+ address: string;
989
+ question: {
990
+ text: string;
991
+ options: string[];
992
+ };
993
+ parentTaskId?: string | undefined;
994
+ }, ctx: import("eve/tools").ToolContext): Promise<{
995
+ schemaVersion: 1;
996
+ id: string;
997
+ kind: string;
998
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
999
+ origin: {
1000
+ signalId?: string | undefined;
1001
+ parentTaskId?: string | undefined;
1002
+ operator?: string | undefined;
1003
+ };
1004
+ replyTo: {
1005
+ channel: string;
1006
+ address: string;
1007
+ };
1008
+ attempt: number;
1009
+ createdAt: string;
1010
+ updatedAt: string;
1011
+ repositoryIds?: string[] | undefined;
1012
+ area?: string | undefined;
1013
+ approval?: "required" | "granted" | "denied" | undefined;
1014
+ dependsOn?: string[] | undefined;
1015
+ devbox?: {
1016
+ devboxId: string;
1017
+ remoteId: string;
1018
+ harness: string;
1019
+ } | undefined;
1020
+ reservedUsd?: number | undefined;
1021
+ settledUsd?: number | undefined;
1022
+ question?: {
1023
+ text: string;
1024
+ options: string[];
1025
+ answer?: string | undefined;
1026
+ answeredBy?: string | undefined;
1027
+ } | undefined;
1028
+ changeId?: string | undefined;
1029
+ reportRef?: string | undefined;
1030
+ }>;
1031
+ };
1032
+ append_receipt: import("eve/tools").ToolDefinition<{
1033
+ repositoryIds: string[];
1034
+ kind: string;
1035
+ state: string;
1036
+ taskId?: string | undefined;
1037
+ changeId?: string | undefined;
1038
+ reason?: string | undefined;
1039
+ dedupeKey?: string | undefined;
1040
+ }, {
1041
+ schemaVersion: 1;
1042
+ receiptId: string;
1043
+ repositoryIds: string[];
1044
+ kind: string;
1045
+ state: string;
1046
+ attempt: number;
1047
+ recordedAt: string;
1048
+ taskId?: string | undefined;
1049
+ changeId?: string | undefined;
1050
+ phase?: string | undefined;
1051
+ reason?: string | undefined;
1052
+ cost?: {
1053
+ totalUsd: number;
1054
+ } | undefined;
1055
+ decidedBy?: string | undefined;
1056
+ }> & {
1057
+ execute(input: {
1058
+ repositoryIds: string[];
1059
+ kind: string;
1060
+ state: string;
1061
+ taskId?: string | undefined;
1062
+ changeId?: string | undefined;
1063
+ reason?: string | undefined;
1064
+ dedupeKey?: string | undefined;
1065
+ }, ctx: import("eve/tools").ToolContext): Promise<{
1066
+ schemaVersion: 1;
1067
+ receiptId: string;
1068
+ repositoryIds: string[];
1069
+ kind: string;
1070
+ state: string;
1071
+ attempt: number;
1072
+ recordedAt: string;
1073
+ taskId?: string | undefined;
1074
+ changeId?: string | undefined;
1075
+ phase?: string | undefined;
1076
+ reason?: string | undefined;
1077
+ cost?: {
1078
+ totalUsd: number;
1079
+ } | undefined;
1080
+ decidedBy?: string | undefined;
1081
+ }>;
1082
+ };
1083
+ };
1084
+ type FactoryTools = ReturnType<typeof factoryTools>;
1085
+ /**
1086
+ * Observe-only eve hooks that keep the ledger honest about session outcomes.
1087
+ * Mount by re-exporting from agent/hooks/, e.g.
1088
+ * `export default factoryHooks(stores).factory;`.
1089
+ *
1090
+ * turn.completed: a turn that ends while its task is still running means the
1091
+ * agent finished talking without recording an outcome; the task moves to
1092
+ * needs_human instead of rotting. The task is found by the session's
1093
+ * channel address, which dispatch set from the task's replyTo.
1094
+ */
1095
+ declare function factoryHooks(stores: FactoryStores): {
1096
+ factory: import("eve/hooks").HookDefinition<"turn.completed">;
1097
+ };
1098
+ type FactoryHooks = ReturnType<typeof factoryHooks>;
1099
+ //#endregion
1100
+ export { type CommandSandbox, type DeepsecScanOptions, FactoryHooks, FactoryTools, FactoryToolsOptions, type FetchPullRequestOptions, type FetchPullRequestResult, GateVerdict, type InvokeAgentOptions, type MergeConflictPayload, type MergeConflictToolOptions, RecordChangeInput, type RecordFindingOptions, type RecordFindingResult, type ReviewCommentToolOptions, deepsecScanTool, factoryHooks, factoryTools, fetchPullRequestTool, findingFromDeepsec, invokeAgentTool, mergeConflictPayloadSchema, mergeConflictTools, recordFinding, recordFindingTool, recordVerificationTool, reviewCommentTools };
1101
+ //# sourceMappingURL=index.d.mts.map