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