@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.
Files changed (63) hide show
  1. package/dist/approval-h5aj8HYN.d.mts +510 -0
  2. package/dist/blob/index.d.mts +32 -0
  3. package/dist/blob/index.mjs +141 -0
  4. package/dist/blob/index.mjs.map +1 -0
  5. package/dist/connectors/index.d.mts +2 -0
  6. package/dist/connectors/index.mjs +49 -0
  7. package/dist/connectors/index.mjs.map +1 -0
  8. package/dist/driver-Bbd25rNM.mjs +23 -0
  9. package/dist/driver-Bbd25rNM.mjs.map +1 -0
  10. package/dist/driver-CrZsy7sm.d.mts +34 -0
  11. package/dist/eve/index.d.mts +1057 -0
  12. package/dist/eve/index.mjs +777 -0
  13. package/dist/eve/index.mjs.map +1 -0
  14. package/dist/github-5qQPCaXj.d.mts +123 -0
  15. package/dist/github.d.mts +2 -0
  16. package/dist/github.mjs +286 -0
  17. package/dist/github.mjs.map +1 -0
  18. package/dist/id-DwCihQr4.mjs +31 -0
  19. package/dist/id-DwCihQr4.mjs.map +1 -0
  20. package/dist/index-WNGZJRRH.d.mts +67 -0
  21. package/dist/index.d.mts +175 -0
  22. package/dist/index.mjs +882 -0
  23. package/dist/index.mjs.map +1 -0
  24. package/dist/next-page.d.mts +5 -0
  25. package/dist/next-page.mjs +71 -0
  26. package/dist/next-page.mjs.map +1 -0
  27. package/dist/next.d.mts +12 -0
  28. package/dist/{next.js → next.mjs} +13 -14
  29. package/dist/next.mjs.map +1 -0
  30. package/dist/postgres/index.d.mts +137 -0
  31. package/dist/postgres/index.mjs +96 -0
  32. package/dist/postgres/index.mjs.map +1 -0
  33. package/dist/signal-CHVEmzvI.d.mts +59 -0
  34. package/dist/task-Cj7Ei9Nh.mjs +336 -0
  35. package/dist/task-Cj7Ei9Nh.mjs.map +1 -0
  36. package/package.json +28 -21
  37. package/dist/approval-Z7iaWibT.d.ts +0 -541
  38. package/dist/blob/index.d.ts +0 -26
  39. package/dist/blob/index.js +0 -127
  40. package/dist/blob/index.js.map +0 -1
  41. package/dist/chunk-CEF6VJZC.js +0 -28
  42. package/dist/chunk-CEF6VJZC.js.map +0 -1
  43. package/dist/chunk-LBEYCOSR.js +0 -351
  44. package/dist/chunk-LBEYCOSR.js.map +0 -1
  45. package/dist/common-CaHaEOAS.d.ts +0 -18
  46. package/dist/connectors/github.d.ts +0 -62
  47. package/dist/connectors/github.js +0 -112
  48. package/dist/connectors/github.js.map +0 -1
  49. package/dist/driver-tRNggCCJ.d.ts +0 -32
  50. package/dist/eve/index.d.ts +0 -962
  51. package/dist/eve/index.js +0 -601
  52. package/dist/eve/index.js.map +0 -1
  53. package/dist/index.d.ts +0 -164
  54. package/dist/index.js +0 -938
  55. package/dist/index.js.map +0 -1
  56. package/dist/next-page.d.ts +0 -5
  57. package/dist/next-page.js +0 -75
  58. package/dist/next-page.js.map +0 -1
  59. package/dist/next.d.ts +0 -12
  60. package/dist/next.js.map +0 -1
  61. package/dist/postgres/index.d.ts +0 -137
  62. package/dist/postgres/index.js +0 -118
  63. package/dist/postgres/index.js.map +0 -1
@@ -0,0 +1,1057 @@
1
+ import { c as Finding, k as FactoryStores, t as ApprovalPolicy } from "../approval-h5aj8HYN.mjs";
2
+ import { l as GitHubReviewComment } from "../github-5qQPCaXj.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 {
383
+ tokenForRepository: (repository: string) => Promise<string>;
384
+ fetch?: typeof globalThis.fetch;
385
+ }
386
+ declare function reviewCommentTools(stores: FactoryStores, options: ReviewCommentToolOptions): {
387
+ read_review_comment: import("eve/tools").ToolDefinition<{
388
+ changeId: string;
389
+ commentId: number;
390
+ }, GitHubReviewComment> & {
391
+ execute(input: {
392
+ changeId: string;
393
+ commentId: number;
394
+ }, ctx: import("eve/tools").ToolContext): Promise<GitHubReviewComment>;
395
+ };
396
+ answer_review_comment: import("eve/tools").ToolDefinition<{
397
+ changeId: string;
398
+ commentId: number;
399
+ body: string;
400
+ }, GitHubReviewComment> & {
401
+ execute(input: {
402
+ changeId: string;
403
+ commentId: number;
404
+ body: string;
405
+ }, ctx: import("eve/tools").ToolContext): Promise<GitHubReviewComment>;
406
+ };
407
+ };
408
+ //#endregion
409
+ //#region src/eve/verification.d.ts
410
+ /**
411
+ * The verifier's outcome tool. Writes evidence onto the change and moves it
412
+ * to ready only when the verdict is pass; a failed verdict leaves the change
413
+ * verifying with the evidence recorded, and the verification task itself
414
+ * ends with a receipt either way. The change's own code_change task follows
415
+ * the verdict too: succeeded on pass, failed on fail with the verifier's
416
+ * summary as the reason, so the ledger never shows a verified-and-rejected fix
417
+ * as still in progress. Fail closed: the agent cannot mark a change ready
418
+ * without supplying every evidence field.
419
+ */
420
+ declare function recordVerificationTool(stores: FactoryStores): import("eve/tools").ToolDefinition<{
421
+ taskId: string;
422
+ changeId: string;
423
+ verdict: "pass" | "fail";
424
+ evidence: {
425
+ reproVerified: boolean;
426
+ testsAdded: number;
427
+ checksGreen: boolean;
428
+ attackPassed: boolean;
429
+ scopeMatches: boolean;
430
+ previewUrl?: string | undefined;
431
+ };
432
+ confidence: "low" | "medium" | "high";
433
+ summary: string;
434
+ }, {
435
+ recorded: false;
436
+ reason: string;
437
+ verdict?: undefined;
438
+ changeState?: undefined;
439
+ taskState?: undefined;
440
+ } | {
441
+ recorded: true;
442
+ verdict: "pass" | "fail";
443
+ changeState: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
444
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
445
+ reason?: undefined;
446
+ }> & {
447
+ execute(input: {
448
+ taskId: string;
449
+ changeId: string;
450
+ verdict: "pass" | "fail";
451
+ evidence: {
452
+ reproVerified: boolean;
453
+ testsAdded: number;
454
+ checksGreen: boolean;
455
+ attackPassed: boolean;
456
+ scopeMatches: boolean;
457
+ previewUrl?: string | undefined;
458
+ };
459
+ confidence: "low" | "medium" | "high";
460
+ summary: string;
461
+ }, ctx: import("eve/tools").ToolContext): Promise<{
462
+ recorded: false;
463
+ reason: string;
464
+ verdict?: undefined;
465
+ changeState?: undefined;
466
+ taskState?: undefined;
467
+ } | {
468
+ recorded: true;
469
+ verdict: "pass" | "fail";
470
+ changeState: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
471
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
472
+ reason?: undefined;
473
+ }>;
474
+ };
475
+ //#endregion
476
+ //#region src/eve/index.d.ts
477
+ declare const recordChangeInputSchema: z.ZodObject<{
478
+ taskId: z.ZodString;
479
+ repositoryId: z.ZodString;
480
+ prNumber: z.ZodNumber;
481
+ prUrl: z.ZodURL;
482
+ risk: z.ZodEnum<{
483
+ low: "low";
484
+ medium: "medium";
485
+ high: "high";
486
+ }>;
487
+ confidence: z.ZodEnum<{
488
+ low: "low";
489
+ medium: "medium";
490
+ high: "high";
491
+ }>;
492
+ summary: z.ZodString;
493
+ }, z.core.$strip>;
494
+ type RecordChangeInput = z.infer<typeof recordChangeInputSchema>;
495
+ type GateVerdict = {
496
+ ok: true;
497
+ } | {
498
+ ok: false;
499
+ reason: string;
500
+ };
501
+ interface FactoryToolsOptions {
502
+ /**
503
+ * Pre-action gate for record_change, run as an eve approval policy before
504
+ * the tool executes. Refusals reach the model as a denial with the reason.
505
+ * Gates must fail closed: when they cannot verify, they refuse.
506
+ */
507
+ recordChangeGate?: (input: RecordChangeInput) => Promise<GateVerdict>;
508
+ }
509
+ /**
510
+ * The factory's store operations wrapped as eve tools. Expose a tool to an
511
+ * agent by re-exporting it from a file under agent/tools/, e.g.
512
+ * `export default factoryTools(stores).get_task;`. Every write goes through
513
+ * the engine, so agents inherit transition legality and receipts.
514
+ */
515
+ declare function factoryTools(stores: FactoryStores, options?: FactoryToolsOptions): {
516
+ get_task: import("eve/tools").ToolDefinition<{
517
+ taskId: string;
518
+ }, {
519
+ schemaVersion: 1;
520
+ id: string;
521
+ kind: string;
522
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
523
+ origin: {
524
+ signalId?: string | undefined;
525
+ parentTaskId?: string | undefined;
526
+ operator?: string | undefined;
527
+ };
528
+ replyTo: {
529
+ channel: string;
530
+ address: string;
531
+ };
532
+ attempt: number;
533
+ createdAt: string;
534
+ updatedAt: string;
535
+ repositoryIds?: string[] | undefined;
536
+ area?: string | undefined;
537
+ approval?: "required" | "granted" | "denied" | undefined;
538
+ dependsOn?: string[] | undefined;
539
+ devbox?: {
540
+ devboxId: string;
541
+ remoteId: string;
542
+ harness: string;
543
+ } | undefined;
544
+ reservedUsd?: number | undefined;
545
+ settledUsd?: number | undefined;
546
+ question?: {
547
+ text: string;
548
+ options: string[];
549
+ answer?: string | undefined;
550
+ answeredBy?: string | undefined;
551
+ } | undefined;
552
+ changeId?: string | undefined;
553
+ reportRef?: string | undefined;
554
+ } | {
555
+ found: false;
556
+ taskId: string;
557
+ }> & {
558
+ execute(input: {
559
+ taskId: string;
560
+ }, ctx: import("eve/tools").ToolContext): Promise<{
561
+ schemaVersion: 1;
562
+ id: string;
563
+ kind: string;
564
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
565
+ origin: {
566
+ signalId?: string | undefined;
567
+ parentTaskId?: string | undefined;
568
+ operator?: string | undefined;
569
+ };
570
+ replyTo: {
571
+ channel: string;
572
+ address: string;
573
+ };
574
+ attempt: number;
575
+ createdAt: string;
576
+ updatedAt: string;
577
+ repositoryIds?: string[] | undefined;
578
+ area?: string | undefined;
579
+ approval?: "required" | "granted" | "denied" | undefined;
580
+ dependsOn?: string[] | undefined;
581
+ devbox?: {
582
+ devboxId: string;
583
+ remoteId: string;
584
+ harness: string;
585
+ } | undefined;
586
+ reservedUsd?: number | undefined;
587
+ settledUsd?: number | undefined;
588
+ question?: {
589
+ text: string;
590
+ options: string[];
591
+ answer?: string | undefined;
592
+ answeredBy?: string | undefined;
593
+ } | undefined;
594
+ changeId?: string | undefined;
595
+ reportRef?: string | undefined;
596
+ } | {
597
+ found: false;
598
+ taskId: string;
599
+ }>;
600
+ };
601
+ decide_signal: import("eve/tools").ToolDefinition<{
602
+ signalId: string;
603
+ outcome: "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
604
+ reason: string;
605
+ detail?: string | undefined;
606
+ }, {
607
+ schemaVersion: 1;
608
+ id: string;
609
+ repositoryId: string;
610
+ source: string;
611
+ deliveryId: string;
612
+ replyTo: {
613
+ channel: string;
614
+ address: string;
615
+ };
616
+ payload: unknown;
617
+ receivedAt: string;
618
+ outcome: "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored" | "pending";
619
+ detail?: string | undefined;
620
+ reason?: string | undefined;
621
+ decidedAt?: string | undefined;
622
+ }> & {
623
+ execute(input: {
624
+ signalId: string;
625
+ outcome: "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
626
+ reason: string;
627
+ detail?: string | undefined;
628
+ }, ctx: import("eve/tools").ToolContext): Promise<{
629
+ schemaVersion: 1;
630
+ id: string;
631
+ repositoryId: string;
632
+ source: string;
633
+ deliveryId: string;
634
+ replyTo: {
635
+ channel: string;
636
+ address: string;
637
+ };
638
+ payload: unknown;
639
+ receivedAt: string;
640
+ outcome: "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored" | "pending";
641
+ detail?: string | undefined;
642
+ reason?: string | undefined;
643
+ decidedAt?: string | undefined;
644
+ }>;
645
+ };
646
+ record_change: import("eve/tools").ToolDefinition<{
647
+ taskId: string;
648
+ repositoryId: string;
649
+ prNumber: number;
650
+ prUrl: string;
651
+ risk: "low" | "medium" | "high";
652
+ confidence: "low" | "medium" | "high";
653
+ summary: string;
654
+ }, {
655
+ change: {
656
+ schemaVersion: 1;
657
+ id: string;
658
+ repositoryId: string;
659
+ prNumber: number;
660
+ prUrl: string;
661
+ author: string;
662
+ risk: "low" | "medium" | "high";
663
+ confidence: "low" | "medium" | "high";
664
+ evidence: {
665
+ reproVerified: boolean;
666
+ testsAdded: number;
667
+ checksGreen: boolean;
668
+ attackPassed: boolean;
669
+ scopeMatches: boolean;
670
+ previewUrl?: string | undefined;
671
+ };
672
+ state: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
673
+ createdAt: string;
674
+ updatedAt: string;
675
+ taskId?: string | undefined;
676
+ groupId?: string | undefined;
677
+ decidedBy?: string | undefined;
678
+ };
679
+ task: {
680
+ schemaVersion: 1;
681
+ id: string;
682
+ kind: string;
683
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
684
+ origin: {
685
+ signalId?: string | undefined;
686
+ parentTaskId?: string | undefined;
687
+ operator?: string | undefined;
688
+ };
689
+ replyTo: {
690
+ channel: string;
691
+ address: string;
692
+ };
693
+ attempt: number;
694
+ createdAt: string;
695
+ updatedAt: string;
696
+ repositoryIds?: string[] | undefined;
697
+ area?: string | undefined;
698
+ approval?: "required" | "granted" | "denied" | undefined;
699
+ dependsOn?: string[] | undefined;
700
+ devbox?: {
701
+ devboxId: string;
702
+ remoteId: string;
703
+ harness: string;
704
+ } | undefined;
705
+ reservedUsd?: number | undefined;
706
+ settledUsd?: number | undefined;
707
+ question?: {
708
+ text: string;
709
+ options: string[];
710
+ answer?: string | undefined;
711
+ answeredBy?: string | undefined;
712
+ } | undefined;
713
+ changeId?: string | undefined;
714
+ reportRef?: string | undefined;
715
+ };
716
+ }> & {
717
+ execute(input: {
718
+ taskId: string;
719
+ repositoryId: string;
720
+ prNumber: number;
721
+ prUrl: string;
722
+ risk: "low" | "medium" | "high";
723
+ confidence: "low" | "medium" | "high";
724
+ summary: string;
725
+ }, ctx: import("eve/tools").ToolContext): Promise<{
726
+ change: {
727
+ schemaVersion: 1;
728
+ id: string;
729
+ repositoryId: string;
730
+ prNumber: number;
731
+ prUrl: string;
732
+ author: string;
733
+ risk: "low" | "medium" | "high";
734
+ confidence: "low" | "medium" | "high";
735
+ evidence: {
736
+ reproVerified: boolean;
737
+ testsAdded: number;
738
+ checksGreen: boolean;
739
+ attackPassed: boolean;
740
+ scopeMatches: boolean;
741
+ previewUrl?: string | undefined;
742
+ };
743
+ state: "verifying" | "ready" | "merged" | "deployed" | "rolled_out" | "rolled_back" | "closed";
744
+ createdAt: string;
745
+ updatedAt: string;
746
+ taskId?: string | undefined;
747
+ groupId?: string | undefined;
748
+ decidedBy?: string | undefined;
749
+ };
750
+ task: {
751
+ schemaVersion: 1;
752
+ id: string;
753
+ kind: string;
754
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
755
+ origin: {
756
+ signalId?: string | undefined;
757
+ parentTaskId?: string | undefined;
758
+ operator?: string | undefined;
759
+ };
760
+ replyTo: {
761
+ channel: string;
762
+ address: string;
763
+ };
764
+ attempt: number;
765
+ createdAt: string;
766
+ updatedAt: string;
767
+ repositoryIds?: string[] | undefined;
768
+ area?: string | undefined;
769
+ approval?: "required" | "granted" | "denied" | undefined;
770
+ dependsOn?: string[] | undefined;
771
+ devbox?: {
772
+ devboxId: string;
773
+ remoteId: string;
774
+ harness: string;
775
+ } | undefined;
776
+ reservedUsd?: number | undefined;
777
+ settledUsd?: number | undefined;
778
+ question?: {
779
+ text: string;
780
+ options: string[];
781
+ answer?: string | undefined;
782
+ answeredBy?: string | undefined;
783
+ } | undefined;
784
+ changeId?: string | undefined;
785
+ reportRef?: string | undefined;
786
+ };
787
+ }>;
788
+ };
789
+ finish_task: import("eve/tools").ToolDefinition<{
790
+ taskId: string;
791
+ summary: string;
792
+ }, {
793
+ finished: false;
794
+ reason: string;
795
+ taskState?: undefined;
796
+ } | {
797
+ finished: true;
798
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
799
+ reason?: undefined;
800
+ }> & {
801
+ execute(input: {
802
+ taskId: string;
803
+ summary: string;
804
+ }, ctx: import("eve/tools").ToolContext): Promise<{
805
+ finished: false;
806
+ reason: string;
807
+ taskState?: undefined;
808
+ } | {
809
+ finished: true;
810
+ taskState: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
811
+ reason?: undefined;
812
+ }>;
813
+ };
814
+ report_blocked: import("eve/tools").ToolDefinition<{
815
+ taskId: string;
816
+ reason: string;
817
+ }, {
818
+ schemaVersion: 1;
819
+ id: string;
820
+ kind: string;
821
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
822
+ origin: {
823
+ signalId?: string | undefined;
824
+ parentTaskId?: string | undefined;
825
+ operator?: string | undefined;
826
+ };
827
+ replyTo: {
828
+ channel: string;
829
+ address: string;
830
+ };
831
+ attempt: number;
832
+ createdAt: string;
833
+ updatedAt: string;
834
+ repositoryIds?: string[] | undefined;
835
+ area?: string | undefined;
836
+ approval?: "required" | "granted" | "denied" | undefined;
837
+ dependsOn?: string[] | undefined;
838
+ devbox?: {
839
+ devboxId: string;
840
+ remoteId: string;
841
+ harness: string;
842
+ } | undefined;
843
+ reservedUsd?: number | undefined;
844
+ settledUsd?: number | undefined;
845
+ question?: {
846
+ text: string;
847
+ options: string[];
848
+ answer?: string | undefined;
849
+ answeredBy?: string | undefined;
850
+ } | undefined;
851
+ changeId?: string | undefined;
852
+ reportRef?: string | undefined;
853
+ }> & {
854
+ execute(input: {
855
+ taskId: string;
856
+ reason: string;
857
+ }, ctx: import("eve/tools").ToolContext): Promise<{
858
+ schemaVersion: 1;
859
+ id: string;
860
+ kind: string;
861
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
862
+ origin: {
863
+ signalId?: string | undefined;
864
+ parentTaskId?: string | undefined;
865
+ operator?: string | undefined;
866
+ };
867
+ replyTo: {
868
+ channel: string;
869
+ address: string;
870
+ };
871
+ attempt: number;
872
+ createdAt: string;
873
+ updatedAt: string;
874
+ repositoryIds?: string[] | undefined;
875
+ area?: string | undefined;
876
+ approval?: "required" | "granted" | "denied" | undefined;
877
+ dependsOn?: string[] | undefined;
878
+ devbox?: {
879
+ devboxId: string;
880
+ remoteId: string;
881
+ harness: string;
882
+ } | undefined;
883
+ reservedUsd?: number | undefined;
884
+ settledUsd?: number | undefined;
885
+ question?: {
886
+ text: string;
887
+ options: string[];
888
+ answer?: string | undefined;
889
+ answeredBy?: string | undefined;
890
+ } | undefined;
891
+ changeId?: string | undefined;
892
+ reportRef?: string | undefined;
893
+ }>;
894
+ };
895
+ ask_question: import("eve/tools").ToolDefinition<{
896
+ repositoryIds: string[];
897
+ channel: string;
898
+ address: string;
899
+ question: {
900
+ text: string;
901
+ options: string[];
902
+ };
903
+ parentTaskId?: string | undefined;
904
+ }, {
905
+ schemaVersion: 1;
906
+ id: string;
907
+ kind: string;
908
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
909
+ origin: {
910
+ signalId?: string | undefined;
911
+ parentTaskId?: string | undefined;
912
+ operator?: string | undefined;
913
+ };
914
+ replyTo: {
915
+ channel: string;
916
+ address: string;
917
+ };
918
+ attempt: number;
919
+ createdAt: string;
920
+ updatedAt: string;
921
+ repositoryIds?: string[] | undefined;
922
+ area?: string | undefined;
923
+ approval?: "required" | "granted" | "denied" | undefined;
924
+ dependsOn?: string[] | undefined;
925
+ devbox?: {
926
+ devboxId: string;
927
+ remoteId: string;
928
+ harness: string;
929
+ } | undefined;
930
+ reservedUsd?: number | undefined;
931
+ settledUsd?: number | undefined;
932
+ question?: {
933
+ text: string;
934
+ options: string[];
935
+ answer?: string | undefined;
936
+ answeredBy?: string | undefined;
937
+ } | undefined;
938
+ changeId?: string | undefined;
939
+ reportRef?: string | undefined;
940
+ }> & {
941
+ execute(input: {
942
+ repositoryIds: string[];
943
+ channel: string;
944
+ address: string;
945
+ question: {
946
+ text: string;
947
+ options: string[];
948
+ };
949
+ parentTaskId?: string | undefined;
950
+ }, ctx: import("eve/tools").ToolContext): Promise<{
951
+ schemaVersion: 1;
952
+ id: string;
953
+ kind: string;
954
+ state: "queued" | "running" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
955
+ origin: {
956
+ signalId?: string | undefined;
957
+ parentTaskId?: string | undefined;
958
+ operator?: string | undefined;
959
+ };
960
+ replyTo: {
961
+ channel: string;
962
+ address: string;
963
+ };
964
+ attempt: number;
965
+ createdAt: string;
966
+ updatedAt: string;
967
+ repositoryIds?: string[] | undefined;
968
+ area?: string | undefined;
969
+ approval?: "required" | "granted" | "denied" | undefined;
970
+ dependsOn?: string[] | undefined;
971
+ devbox?: {
972
+ devboxId: string;
973
+ remoteId: string;
974
+ harness: string;
975
+ } | undefined;
976
+ reservedUsd?: number | undefined;
977
+ settledUsd?: number | undefined;
978
+ question?: {
979
+ text: string;
980
+ options: string[];
981
+ answer?: string | undefined;
982
+ answeredBy?: string | undefined;
983
+ } | undefined;
984
+ changeId?: string | undefined;
985
+ reportRef?: string | undefined;
986
+ }>;
987
+ };
988
+ append_receipt: import("eve/tools").ToolDefinition<{
989
+ repositoryIds: string[];
990
+ kind: string;
991
+ state: string;
992
+ taskId?: string | undefined;
993
+ changeId?: string | undefined;
994
+ reason?: string | undefined;
995
+ dedupeKey?: string | undefined;
996
+ }, {
997
+ schemaVersion: 1;
998
+ receiptId: string;
999
+ repositoryIds: string[];
1000
+ kind: string;
1001
+ state: string;
1002
+ attempt: number;
1003
+ recordedAt: string;
1004
+ taskId?: string | undefined;
1005
+ changeId?: string | undefined;
1006
+ phase?: string | undefined;
1007
+ reason?: string | undefined;
1008
+ cost?: {
1009
+ totalUsd: number;
1010
+ } | undefined;
1011
+ decidedBy?: string | undefined;
1012
+ }> & {
1013
+ execute(input: {
1014
+ repositoryIds: string[];
1015
+ kind: string;
1016
+ state: string;
1017
+ taskId?: string | undefined;
1018
+ changeId?: string | undefined;
1019
+ reason?: string | undefined;
1020
+ dedupeKey?: string | undefined;
1021
+ }, ctx: import("eve/tools").ToolContext): Promise<{
1022
+ schemaVersion: 1;
1023
+ receiptId: string;
1024
+ repositoryIds: string[];
1025
+ kind: string;
1026
+ state: string;
1027
+ attempt: number;
1028
+ recordedAt: string;
1029
+ taskId?: string | undefined;
1030
+ changeId?: string | undefined;
1031
+ phase?: string | undefined;
1032
+ reason?: string | undefined;
1033
+ cost?: {
1034
+ totalUsd: number;
1035
+ } | undefined;
1036
+ decidedBy?: string | undefined;
1037
+ }>;
1038
+ };
1039
+ };
1040
+ type FactoryTools = ReturnType<typeof factoryTools>;
1041
+ /**
1042
+ * Observe-only eve hooks that keep the ledger honest about session outcomes.
1043
+ * Mount by re-exporting from agent/hooks/, e.g.
1044
+ * `export default factoryHooks(stores).factory;`.
1045
+ *
1046
+ * turn.completed: a turn that ends while its task is still running means the
1047
+ * agent finished talking without recording an outcome; the task moves to
1048
+ * needs_human instead of rotting. The task is found by the session's
1049
+ * channel address, which dispatch set from the task's replyTo.
1050
+ */
1051
+ declare function factoryHooks(stores: FactoryStores): {
1052
+ factory: import("eve/hooks").HookDefinition<"turn.completed">;
1053
+ };
1054
+ type FactoryHooks = ReturnType<typeof factoryHooks>;
1055
+ //#endregion
1056
+ 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 };
1057
+ //# sourceMappingURL=index.d.mts.map