@eigenpal/sdk 0.25.13 → 1.0.0-rc.1

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/README.md +27 -105
  2. package/dist/client.d.ts +164 -0
  3. package/dist/client.js +234 -0
  4. package/dist/core.d.ts +82 -0
  5. package/dist/core.js +311 -0
  6. package/dist/errors.d.ts +64 -0
  7. package/dist/errors.js +132 -0
  8. package/dist/generated/operations.gen.d.ts +336 -0
  9. package/dist/generated/operations.gen.js +135 -0
  10. package/dist/generated/public.gen.d.ts +2 -0
  11. package/dist/generated/public.gen.js +2 -0
  12. package/dist/generated/resources.gen.d.ts +490 -0
  13. package/dist/generated/resources.gen.js +659 -0
  14. package/dist/generated/types.gen.d.ts +2457 -0
  15. package/dist/generated/types.gen.js +2 -0
  16. package/dist/index.d.ts +20 -0
  17. package/dist/index.js +15 -0
  18. package/dist/lib/fetch-body.d.ts +23 -0
  19. package/dist/lib/fetch-body.js +66 -0
  20. package/dist/lib/files.d.ts +134 -0
  21. package/dist/lib/files.js +296 -0
  22. package/dist/lib/upload-app-chunked.d.ts +36 -0
  23. package/dist/lib/upload-app-chunked.js +94 -0
  24. package/dist/lib/upload-limits.d.ts +32 -0
  25. package/dist/lib/upload-limits.js +60 -0
  26. package/dist/lib/upload-presigned-multipart.d.ts +74 -0
  27. package/dist/lib/upload-presigned-multipart.js +212 -0
  28. package/dist/page.d.ts +30 -0
  29. package/dist/page.js +38 -0
  30. package/dist/resources.d.ts +85 -0
  31. package/dist/resources.js +247 -0
  32. package/dist/telemetry.d.ts +20 -0
  33. package/{src/telemetry.ts → dist/telemetry.js} +26 -31
  34. package/dist/upload-file.d.ts +31 -0
  35. package/dist/upload-file.js +286 -0
  36. package/{src/upload.ts → dist/upload.d.ts} +4 -4
  37. package/dist/upload.js +12 -0
  38. package/package.json +19 -15
  39. package/src/client.ts +0 -656
  40. package/src/errors.ts +0 -130
  41. package/src/generated/client/client.gen.ts +0 -277
  42. package/src/generated/client/index.ts +0 -27
  43. package/src/generated/client/types.gen.ts +0 -218
  44. package/src/generated/client/utils.gen.ts +0 -316
  45. package/src/generated/client.gen.ts +0 -18
  46. package/src/generated/core/auth.gen.ts +0 -48
  47. package/src/generated/core/bodySerializer.gen.ts +0 -82
  48. package/src/generated/core/params.gen.ts +0 -178
  49. package/src/generated/core/pathSerializer.gen.ts +0 -171
  50. package/src/generated/core/queryKeySerializer.gen.ts +0 -117
  51. package/src/generated/core/serverSentEvents.gen.ts +0 -242
  52. package/src/generated/core/types.gen.ts +0 -110
  53. package/src/generated/core/utils.gen.ts +0 -140
  54. package/src/generated/index.ts +0 -4
  55. package/src/generated/sdk.gen.ts +0 -1361
  56. package/src/generated/types.gen.ts +0 -9282
  57. package/src/index.ts +0 -120
  58. package/src/lib/fetch-body.ts +0 -92
  59. package/src/lib/files.ts +0 -390
  60. package/src/lib/upload-app-chunked.ts +0 -121
  61. package/src/lib/upload-limits.ts +0 -72
  62. package/src/lib/upload-presigned-multipart.ts +0 -285
  63. package/src/resources/auth.ts +0 -18
  64. package/src/resources/automations.ts +0 -830
  65. package/src/resources/dataset-review-requests.ts +0 -38
  66. package/src/resources/email-servers.ts +0 -95
  67. package/src/resources/files.ts +0 -592
  68. package/src/resources/folders.ts +0 -77
  69. package/src/resources/human-reviews.ts +0 -106
  70. package/src/resources/models.ts +0 -37
  71. package/src/resources/runs.ts +0 -350
  72. package/src/resources/templates.ts +0 -153
  73. package/src/runtime-config.ts +0 -14
@@ -0,0 +1,2457 @@
1
+ export type AbortFileUploadResponse = {
2
+ aborted: true;
3
+ };
4
+ export type AcceptHttpChunkedUploadChunkResponse = {
5
+ accepted: true;
6
+ chunkIndex: number;
7
+ size: number;
8
+ };
9
+ export type AgentEvaluation = {
10
+ evaluators: Record<string, {
11
+ kind: 'custom';
12
+ } | {
13
+ kind: 'exact_diff';
14
+ options?: {
15
+ rules?: Record<string, {
16
+ ignore?: true;
17
+ order?: 'ordered' | 'unordered';
18
+ items?: 'at_least' | 'at_most' | 'exactly';
19
+ matchBy?: string | string[];
20
+ allowExtraFields?: boolean;
21
+ numericTolerance?: number;
22
+ }>;
23
+ paths?: string[];
24
+ unorderedPaths?: string[];
25
+ numericTolerance?: number;
26
+ allowExtraFields?: boolean;
27
+ };
28
+ } | {
29
+ kind: 'llm_judge';
30
+ prompt: string;
31
+ model?: string;
32
+ }>;
33
+ pass: {
34
+ kind: 'callback';
35
+ } | {
36
+ kind: 'weighted';
37
+ weights: Record<string, number>;
38
+ threshold: number;
39
+ };
40
+ };
41
+ export type AgentEvaluatorConfigResponse = {
42
+ automationId: string;
43
+ kind: 'agent';
44
+ source: {
45
+ path: string;
46
+ ref: string;
47
+ commit: string;
48
+ };
49
+ evaluation: AgentEvaluation | null;
50
+ /** JSON Schema of the agent output at the same pinned source commit. */
51
+ outputSchema: Record<string, unknown> | null;
52
+ };
53
+ export type ApiErrorEnvelope = {
54
+ /** One stable snake_case word to branch on: the route's own code (approval_required, not_live, …) or the default of the HTTP status (validation_failed, key_rejected, not_signed_in, forbidden, not_found, conflict, too_large, rate_limited, server_error). */
55
+ code: string;
56
+ /** One sentence saying what went wrong. */
57
+ message: string;
58
+ issues: ApiErrorIssue[];
59
+ /** Request id echoed via the x-request-id header */
60
+ requestId: string;
61
+ /** What to do next. */
62
+ hint: string;
63
+ /** Link to relevant docs */
64
+ docsUrl?: string;
65
+ };
66
+ export type ApiErrorIssue = {
67
+ /** JSON path of the offending field, or "<root>" */
68
+ field: string;
69
+ /** Human-readable error message */
70
+ message: string;
71
+ /** Machine-readable error code (e.g. invalid_value, not_found, api_trigger_disabled, manual_trigger_disabled) */
72
+ code?: string;
73
+ /** Issue severity */
74
+ severity: 'error' | 'warning';
75
+ };
76
+ export type AuthCheckResponse = {
77
+ ok: true;
78
+ organizationId: string;
79
+ organizationSlug: string;
80
+ organizationName: string | null;
81
+ userId: string | null;
82
+ keyId: string;
83
+ email: string | null;
84
+ name: string | null;
85
+ /** The organization role of the key's user (owner, admin, member, viewer); null for a key with no member behind it (the service agent). */
86
+ role: string | null;
87
+ scope: string[];
88
+ /** The project a project API key is limited to; null for an organization-wide key. */
89
+ project: {
90
+ id: string;
91
+ slug: string;
92
+ } | null;
93
+ };
94
+ export type AutomationDetail = {
95
+ /** Implementation id for the automation. Workflow automations use workflow ids; agent automations use agent workflow ids. */
96
+ id: string;
97
+ kind: AutomationKind;
98
+ /** The automation's name: its folder in the project, what runs and URLs name it by. */
99
+ name: string;
100
+ /** The label people read, or null. */
101
+ title: string | null;
102
+ description?: string | null;
103
+ status?: string;
104
+ version?: string | null;
105
+ triggers?: AutomationTriggerState;
106
+ /** The automation's project id. */
107
+ projectId?: string | null;
108
+ createdAt: string;
109
+ updatedAt?: string;
110
+ inputSchema?: Record<string, unknown> | null;
111
+ outputSchema?: Record<string, unknown> | null;
112
+ /** The variables the steps of an SDK workflow read, by name. */
113
+ variables?: string[];
114
+ };
115
+ export type AutomationKind = 'workflow' | 'agent';
116
+ export type AutomationList = {
117
+ data: AutomationSummary[];
118
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
119
+ nextCursor: string | null;
120
+ };
121
+ export type AutomationSummary = {
122
+ /** Implementation id for the automation. Workflow automations use workflow ids; agent automations use agent workflow ids. */
123
+ id: string;
124
+ kind: AutomationKind;
125
+ /** The automation's name: its folder in the project, what runs and URLs name it by. */
126
+ name: string;
127
+ /** The label people read, or null. */
128
+ title: string | null;
129
+ description?: string | null;
130
+ status?: string;
131
+ version?: string | null;
132
+ triggers?: AutomationTriggerState;
133
+ /** The automation's project id. */
134
+ projectId?: string | null;
135
+ createdAt: string;
136
+ updatedAt?: string;
137
+ };
138
+ export type AutomationTriggerState = {
139
+ api: boolean;
140
+ email: boolean;
141
+ manual: boolean;
142
+ webhook: boolean;
143
+ };
144
+ export type CreatedProjectRelease = {
145
+ /** planned: a dry run (nothing changed). released: numbered (an operation result). */
146
+ status: 'planned' | 'released';
147
+ version?: string;
148
+ /** Null in a branch dry run that cannot number yet. */
149
+ tag?: string | null;
150
+ commit?: string | null;
151
+ buildId?: string | null;
152
+ /** What the release holds: every workflow and agent of the build, each marked changed. Null in a branch dry run whose head is not built yet. */
153
+ automations?: Array<{
154
+ name: string;
155
+ kind: 'workflow' | 'agent';
156
+ /** New or changed against the newest release before it (true in the first release). */
157
+ changed: boolean;
158
+ }> | null;
159
+ release?: ProjectRelease;
160
+ /** Branch releases: false when the build was numbered already (that release is answered). */
161
+ changed?: boolean;
162
+ /** Branch releases: the branch and where it stands against the tracked branch. */
163
+ branch?: {
164
+ name: string;
165
+ head: string;
166
+ trackedBranch: string;
167
+ ahead: number | null;
168
+ behind: number | null;
169
+ } | null;
170
+ /** Branch dry run: what a real call would still do. update: the tracked branch moved, so it is merged into the branch first. approval: the branch rules leave merging to a person. */
171
+ steps?: Array<'update' | 'request' | 'merge' | 'approval' | 'build' | 'tag'>;
172
+ /** GitHub and GitLab branch releases: the request's pull request check (EigenPal / <slug>) as it stands. Shown only: a release merges and numbers whatever it says. Null without a request, or right after the branch was updated. */
173
+ check?: {
174
+ name: string;
175
+ status: 'queued' | 'running' | 'passed' | 'failed' | 'neutral';
176
+ summary: string | null;
177
+ /** The commit it checks: the branch head (the request head once merged). */
178
+ commit: string;
179
+ /** Where to read it: the check's details page, else the request. */
180
+ url: string;
181
+ } | null;
182
+ /** waiting update: the merge commit that brought the tracked branch into the branch, and how many of its commits it brought; null while the host prepares it. */
183
+ updated?: {
184
+ commit: string;
185
+ commits: number | null;
186
+ } | null;
187
+ /** While building: the build of the landed commit, null before it started. */
188
+ build?: {
189
+ id: string;
190
+ status: string;
191
+ } | null;
192
+ /** GitHub and GitLab branch releases: the pull or merge request that lands the branch. */
193
+ request?: ProjectReleaseRequest | null;
194
+ };
195
+ export type DatasetDraftBody = {
196
+ /** The version the experiment will run, as `version` of the experiment request (informational). */
197
+ version?: string;
198
+ /** The client's digest of the whole folder (informational). */
199
+ digest?: string;
200
+ /** The examples of the local dataset folder, at most 1000 per request (send a bigger folder in several requests). */
201
+ examples: Array<{
202
+ /** The example folder name. */
203
+ name: string;
204
+ /** The client's hash of the example folder (informational: the server hashes the content itself). */
205
+ hash?: string;
206
+ /** Content of `input.json`. */
207
+ input: unknown;
208
+ /** Content of `expected.json`, or null when the example has none. */
209
+ expected?: unknown;
210
+ /** Content of `meta.json`, or null. */
211
+ meta?: Record<string, unknown> | null;
212
+ files?: DraftDatasetFile[];
213
+ }>;
214
+ };
215
+ export type DatasetDraftObjectVerifyBody = {
216
+ /** Git LFS object id: the lowercase hex SHA-256 of the bytes. */
217
+ oid: string;
218
+ /** Size in bytes. */
219
+ size: number;
220
+ /** For `transfer: files`: the file the bytes were uploaded as with `POST /api/v1/files/uploads`. Omit after a direct upload. */
221
+ fileId?: string;
222
+ };
223
+ export type DatasetExample = {
224
+ /** Stable public example id. Workflow examples use DB ids; agent examples use deterministic name-derived ids. */
225
+ id: string;
226
+ /** Human-readable dataset example name. */
227
+ name: string;
228
+ /** Automation that owns this example. */
229
+ automationId: string;
230
+ kind: AutomationKind;
231
+ /** Input arguments used when this example is run. Null when listing with `include=metadata`. */
232
+ input: Record<string, unknown> | null;
233
+ /** Expected JSON output for evaluator comparisons. Null when listing with `include=metadata`. */
234
+ expected: unknown;
235
+ /** Expected files attached to this example. */
236
+ expectedFiles: Array<{
237
+ /** Expected file name. */
238
+ name: string;
239
+ /** Download URL for the expected file. */
240
+ url?: string;
241
+ }>;
242
+ /** Caller-managed metadata for sorting or filtering examples. */
243
+ metadata: Record<string, unknown> | null;
244
+ /** Human note about the example. */
245
+ annotation: string | null;
246
+ /** Optional display order within the dataset. */
247
+ rowOrder: number | null;
248
+ /** Step output overrides used when running this example. */
249
+ overrides: Record<string, unknown> | null;
250
+ /** Most recent run id created from this example. */
251
+ latestRunId: string | null;
252
+ createdAt?: string;
253
+ updatedAt?: string | null;
254
+ };
255
+ export type DatasetExampleList = {
256
+ data: DatasetExample[];
257
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
258
+ nextCursor: string | null;
259
+ };
260
+ export type DatasetReviewCreateBody = {
261
+ title: string;
262
+ /** Note shown to the reviewer for the whole request. */
263
+ instructions?: string | null;
264
+ /** Expected-output paths to highlight. Other fields stay normal unless listed in ignoredFields. */
265
+ focusFields?: DatasetReviewFocusField[];
266
+ /** Expected-output paths reviewers can skip. Shown muted as not required. Prefixes apply to nested leaves. */
267
+ ignoredFields?: string[];
268
+ /** Optional per-example and per-field notes seeded as commented events at create time. */
269
+ itemNotes?: DatasetReviewCreateItemNote[];
270
+ exampleNames: string[];
271
+ status?: 'draft' | 'open' | 'paused';
272
+ };
273
+ export type DatasetReviewCreateItemNote = {
274
+ exampleName: string;
275
+ comment?: string | null;
276
+ fields?: DatasetReviewItemFieldNote[];
277
+ };
278
+ export type DatasetReviewDetail = {
279
+ id: string;
280
+ automationId: string;
281
+ title: string;
282
+ instructions: string | null;
283
+ focusFields: DatasetReviewFocusField[];
284
+ ignoredFields: string[];
285
+ status: 'draft' | 'open' | 'paused' | 'closed' | 'cancelled';
286
+ exampleNames: string[];
287
+ progress: DatasetReviewProgress;
288
+ createdBy: string | null;
289
+ createdAt: string;
290
+ closedAt: string | null;
291
+ items: DatasetReviewItem[];
292
+ events?: DatasetReviewEvent[];
293
+ };
294
+ export type DatasetReviewEvent = {
295
+ id: string;
296
+ reviewId: string;
297
+ itemId: string | null;
298
+ actorUserId: string | null;
299
+ action: 'created' | 'approved' | 'edited' | 'removed' | 'reopened' | 'commented' | 'field_decision' | 'file_decision' | 'file_edited';
300
+ diffSummary: unknown;
301
+ createdAt: string;
302
+ };
303
+ export type DatasetReviewEventList = {
304
+ data: DatasetReviewEvent[];
305
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
306
+ nextCursor: string | null;
307
+ };
308
+ export type DatasetReviewExpectedFile = {
309
+ /** Expected-file path relative to the example expected/ folder. */
310
+ path: string;
311
+ /** Version id for the current bytes. Empty for snapshot-origin files, which resolve by path. */
312
+ fileId: string;
313
+ filename: string;
314
+ /** Whether the current bytes are the snapshotted dataset file, a reviewer-corrected version, or a brand-new reviewer upload. */
315
+ origin: 'snapshot' | 'corrected' | 'uploaded';
316
+ };
317
+ export type DatasetReviewFieldDecision = {
318
+ decision: 'approved' | 'removed';
319
+ comment?: string | null;
320
+ reviewerId: string;
321
+ updatedAt: string;
322
+ };
323
+ export type DatasetReviewFileDecision = {
324
+ decision: 'approved' | 'removed';
325
+ comment?: string | null;
326
+ reviewerId: string;
327
+ updatedAt: string;
328
+ };
329
+ export type DatasetReviewFocusField = {
330
+ /** Dotted expected-output path the reviewer should inspect, e.g. vendor.iban. */
331
+ path: string;
332
+ /** Optional reason this field needs attention. */
333
+ reason?: string | null;
334
+ };
335
+ export type DatasetReviewInboxItem = {
336
+ id: string;
337
+ automationId: string;
338
+ title: string;
339
+ instructions: string | null;
340
+ focusFields: DatasetReviewFocusField[];
341
+ ignoredFields: string[];
342
+ status: 'draft' | 'open' | 'paused' | 'closed' | 'cancelled';
343
+ exampleNames: string[];
344
+ progress: DatasetReviewProgress;
345
+ createdBy: string | null;
346
+ createdAt: string;
347
+ closedAt: string | null;
348
+ /** Display name for the automation that owns this review request. */
349
+ automationName: string;
350
+ };
351
+ export type DatasetReviewInboxList = {
352
+ data: DatasetReviewInboxItem[];
353
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
354
+ nextCursor: string | null;
355
+ };
356
+ export type DatasetReviewItem = {
357
+ id: string;
358
+ reviewId: string;
359
+ exampleName: string;
360
+ snapshotInputJson: Record<string, unknown> | null;
361
+ snapshotExpectedJson: unknown;
362
+ snapshotManifest: {
363
+ expectedFiles: Array<{
364
+ name: string;
365
+ }>;
366
+ metadata: Record<string, unknown> | null;
367
+ inputFileHashes?: Array<{
368
+ path: string;
369
+ sha256: string;
370
+ }>;
371
+ };
372
+ status: 'pending' | 'approved' | 'edited' | 'removed';
373
+ currentExpectedJson: unknown;
374
+ fieldDecisions: Record<string, DatasetReviewFieldDecision>;
375
+ /** Overlay of the snapshot manifest expected files. Null means pristine: the reviewer has not corrected or uploaded any file yet. */
376
+ currentExpectedFiles: DatasetReviewExpectedFile[] | null;
377
+ /** Durable per-expected-file approve/remove, keyed by expected-file path. */
378
+ fileDecisions: Record<string, DatasetReviewFileDecision>;
379
+ /** True when live dataset input-file bytes no longer match the hashes captured at request creation. */
380
+ inputDrifted: boolean;
381
+ updatedBy: string | null;
382
+ updatedAt: string;
383
+ };
384
+ export type DatasetReviewItemFieldNote = {
385
+ path: string;
386
+ comment: string;
387
+ };
388
+ export type DatasetReviewItemUpdateBody = {
389
+ /** file_decision records a per-expected-file approve/remove (or a note). edit_file uploads corrected bytes and is multipart-only; JSON callers get a 400 pointing at the multipart form. */
390
+ action: 'approve' | 'edit' | 'remove' | 'reopen' | 'comment' | 'field_decision' | 'file_decision' | 'edit_file';
391
+ expected?: unknown;
392
+ comment?: string | null;
393
+ fieldPath?: string | null;
394
+ /** Expected-file path for action file_decision. */
395
+ filePath?: string | null;
396
+ decision?: 'approved' | 'removed' | null;
397
+ /** ISO timestamp of the item `updatedAt` the client last observed. Required for optimistic concurrency. */
398
+ expectedUpdatedAt: string;
399
+ };
400
+ export type DatasetReviewProgress = {
401
+ total: number;
402
+ pending: number;
403
+ approved: number;
404
+ edited: number;
405
+ removed: number;
406
+ /** Count of examples still pending a decision. */
407
+ remaining: number;
408
+ /** True when every example has been approved, edited, or removed. Close the request when review is finished; dataset write-back is always manual. */
409
+ complete: boolean;
410
+ };
411
+ export type DatasetReviewRequest = {
412
+ id: string;
413
+ automationId: string;
414
+ title: string;
415
+ instructions: string | null;
416
+ focusFields: DatasetReviewFocusField[];
417
+ ignoredFields: string[];
418
+ status: 'draft' | 'open' | 'paused' | 'closed' | 'cancelled';
419
+ exampleNames: string[];
420
+ progress: DatasetReviewProgress;
421
+ createdBy: string | null;
422
+ createdAt: string;
423
+ closedAt: string | null;
424
+ };
425
+ export type DatasetReviewRequestList = {
426
+ data: DatasetReviewRequest[];
427
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
428
+ nextCursor: string | null;
429
+ };
430
+ export type DatasetReviewUpdateBody = {
431
+ title?: string;
432
+ instructions?: string | null;
433
+ focusFields?: DatasetReviewFocusField[];
434
+ ignoredFields?: string[];
435
+ status?: 'draft' | 'open' | 'paused' | 'closed' | 'cancelled';
436
+ };
437
+ export type DeletedVariable = {
438
+ id: string;
439
+ name: string;
440
+ type: 'string' | 'number' | 'boolean';
441
+ secret: boolean;
442
+ /** The value; always null for a secret (secrets are write-only). */
443
+ value: string | null;
444
+ description: string | null;
445
+ /** organization: every project of the organization; project: one project. */
446
+ scope: 'organization' | 'project';
447
+ project: {
448
+ id: string;
449
+ slug: string;
450
+ } | null;
451
+ updatedAt: string;
452
+ updatedBy: string | null;
453
+ deleted: true;
454
+ };
455
+ export type DeleteEmailServerResponse = {
456
+ deleted: true;
457
+ id: string;
458
+ };
459
+ export type DeleteFileResponse = {
460
+ deleted: boolean;
461
+ };
462
+ export type DeletePromotionRouteResponse = {
463
+ plan: {
464
+ route: string;
465
+ projects: string[];
466
+ };
467
+ applied: boolean;
468
+ };
469
+ export type DeleteTemplateResponse = {
470
+ deleted: boolean;
471
+ };
472
+ export type DraftDatasetFile = {
473
+ /** Whether the file is under `input/` or `expected/` of the example folder. */
474
+ role: 'input' | 'expected';
475
+ /** Path under `input/` or `expected/`, as `$file` references name it. */
476
+ path: string;
477
+ /** Git LFS object id: the lowercase hex SHA-256 of the bytes. */
478
+ oid: string;
479
+ /** Size in bytes. */
480
+ size: number;
481
+ };
482
+ export type DraftDatasetObjectVerified = {
483
+ oid: string;
484
+ size: number;
485
+ /** False when the project already held the object. */
486
+ stored: boolean;
487
+ };
488
+ export type DraftDatasetResponse = {
489
+ /** The automation id the examples are staged on. */
490
+ automationId: string;
491
+ /** True when every file was on the server and the examples are written; false when `missing` lists files to send first. */
492
+ ready: boolean;
493
+ /** Files this project does not hold yet. */
494
+ missing: Array<{
495
+ /** Git LFS object id: the lowercase hex SHA-256 of the bytes. */
496
+ oid: string;
497
+ size: number;
498
+ /** `direct`: PUT the bytes to `actions.upload`, then POST `{ oid, size }` to `actions.verify`. `files`: upload the bytes with `POST /api/v1/files/uploads` (any transport it negotiates), then POST `{ oid, size, fileId }` to `actions.verify`. */
499
+ transfer: 'direct' | 'files';
500
+ actions: {
501
+ upload?: {
502
+ /** Absolute URL (a signed bucket URL: send only `header`, never the API key) or an API path. */
503
+ href: string;
504
+ header?: Record<string, string>;
505
+ expires_in?: number;
506
+ };
507
+ verify: {
508
+ /** Absolute URL (a signed bucket URL: send only `header`, never the API key) or an API path. */
509
+ href: string;
510
+ header?: Record<string, string>;
511
+ expires_in?: number;
512
+ };
513
+ };
514
+ }>;
515
+ /** When ready: one entry per example of the request. */
516
+ examples: Array<{
517
+ /** The example folder name. */
518
+ name: string;
519
+ /** Pass in `examples` of `POST /api/v1/automations/{id}/experiments`. */
520
+ ref: string;
521
+ /** The working copy example name. */
522
+ example: string;
523
+ /** False when the same content was already there. */
524
+ written: boolean;
525
+ }>;
526
+ written: number;
527
+ unchanged: number;
528
+ files: number;
529
+ };
530
+ export type EmailServer = PublicResendEmailServer | PublicSmtpEmailServer;
531
+ export type EmailServerCreateBody = {
532
+ name: string;
533
+ enabled?: boolean;
534
+ transport: 'resend';
535
+ apiKey: string;
536
+ fromEmail: string;
537
+ fromName: string;
538
+ } | {
539
+ name: string;
540
+ enabled?: boolean;
541
+ transport: 'smtp';
542
+ host: string;
543
+ port?: number;
544
+ security?: 'starttls' | 'tls' | 'none';
545
+ username?: string;
546
+ password?: string;
547
+ caPem?: string;
548
+ fromEmail: string;
549
+ fromName: string;
550
+ };
551
+ export type EmailServerList = {
552
+ data: EmailServer[];
553
+ nextCursor: string | null;
554
+ };
555
+ export type EmailServerTestBody = {
556
+ to: string;
557
+ };
558
+ export type EmailServerUpdateBody = {
559
+ name?: string;
560
+ enabled?: boolean;
561
+ transport: 'resend';
562
+ apiKey?: string;
563
+ fromEmail: string;
564
+ fromName: string;
565
+ } | {
566
+ name?: string;
567
+ enabled?: boolean;
568
+ transport: 'smtp';
569
+ host: string;
570
+ port: number;
571
+ security: 'starttls' | 'tls' | 'none';
572
+ username?: string | null;
573
+ password?: string;
574
+ caPem?: string | null;
575
+ fromEmail: string;
576
+ fromName: string;
577
+ } | {
578
+ name?: string;
579
+ enabled?: boolean;
580
+ transport?: unknown;
581
+ };
582
+ export type EvalResult = {
583
+ /** Evaluator result id. */
584
+ id: string;
585
+ /** Run this score belongs to. */
586
+ runId: string;
587
+ /** Automation this score belongs to. */
588
+ automationId: string | null;
589
+ /** Evaluator name from configuration. */
590
+ evaluatorName: string;
591
+ /** Evaluator implementation type. */
592
+ evaluatorType: string;
593
+ /** Automated evaluator score. Do not confuse this with a human review verdict. */
594
+ score: number | null;
595
+ /** Whether this evaluator passed. */
596
+ passed: boolean | null;
597
+ /** Optional evaluator label. */
598
+ label: string | null;
599
+ /** Weight used in aggregate scoring. */
600
+ weight: number | null;
601
+ /** Score threshold required for this evaluator to pass. */
602
+ passThreshold: number | null;
603
+ /** Evaluator description. */
604
+ description: string | null;
605
+ /** Evaluator-specific details. */
606
+ details: unknown;
607
+ /** Evaluator error, when scoring failed. */
608
+ error: string | null;
609
+ createdAt: string;
610
+ };
611
+ export type EvaluatorConfigResponse = WorkflowEvaluatorConfigResponse | AgentEvaluatorConfigResponse;
612
+ export type ExecutionObservability = {
613
+ phases: Array<{
614
+ runId: string;
615
+ phase: 'queued' | 'starting' | 'preparing_inputs' | 'preparing_environment' | 'installing_dependencies' | 'running' | 'collecting_outputs' | 'finalizing';
616
+ phaseOrder: number;
617
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'skipped' | 'cancelled';
618
+ startedAt?: string | null;
619
+ completedAt?: string | null;
620
+ message?: string | null;
621
+ failureCode?: string | null;
622
+ durationMs?: number | null;
623
+ }>;
624
+ currentPhase?: 'queued' | 'starting' | 'preparing_inputs' | 'preparing_environment' | 'installing_dependencies' | 'running' | 'collecting_outputs' | 'finalizing';
625
+ failure?: {
626
+ phase: 'queued' | 'starting' | 'preparing_inputs' | 'preparing_environment' | 'installing_dependencies' | 'running' | 'collecting_outputs' | 'finalizing';
627
+ code: string;
628
+ category: 'input' | 'source' | 'environment' | 'runtime' | 'output' | 'finalization' | 'system';
629
+ provider?: string;
630
+ retryable: boolean;
631
+ diagnostic?: {
632
+ inputPath?: string;
633
+ correlationId: string;
634
+ };
635
+ userMessage: string;
636
+ occurredAt: string;
637
+ };
638
+ derived: boolean;
639
+ };
640
+ export type Experiment = {
641
+ /** Experiment batch id. Some CLI commands historically call this a batch id. */
642
+ id: string;
643
+ /** Automation this experiment belongs to. */
644
+ automationId: string;
645
+ kind: AutomationKind;
646
+ /** Where the experiment stands, in the words runs use: queued, running, waiting (every unfinished run waits for a person), succeeded (finished; failed examples are counted in `failedCount`), failed (every run failed), cancelled. */
647
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
648
+ /** Total runs in the experiment. */
649
+ runCount: number;
650
+ /** Runs that have completed. */
651
+ completedCount: number;
652
+ /** Runs whose evaluator scores passed. */
653
+ passedCount: number;
654
+ /** Runs whose evaluator scores failed. */
655
+ failedCount: number;
656
+ /** Average automated evaluator score. */
657
+ avgScore: number | null;
658
+ createdAt: string;
659
+ completedAt: string | null;
660
+ version: string | null;
661
+ };
662
+ export type ExperimentCreateBody = {
663
+ /** Optional dataset example ids to run. Omit to run the full dataset. */
664
+ examples?: string[];
665
+ /** Example runs at once. Absent: the server default. */
666
+ concurrency?: number | null;
667
+ /** What runs, as in a run start: a release number, a range or a commit. Absent: what is live. */
668
+ version?: string;
669
+ /** Labels on every run of a workflow experiment, to find it again with `?tag=` when listing. Results recorded for a live build are tagged `eigenpal:baseline`. Tags starting with `eigenpal:` need the right to deploy to the default branch (403 otherwise). */
670
+ tags?: string | string[];
671
+ };
672
+ export type ExperimentCreateResponse = {
673
+ /** Experiment batch id. */
674
+ id: string;
675
+ /** Runs enqueued for this experiment. */
676
+ runs: Array<{
677
+ /** Run id. */
678
+ id: string;
679
+ /** Dataset example id. */
680
+ exampleId: string | null;
681
+ }>;
682
+ /** Number of runs enqueued. */
683
+ total: number;
684
+ };
685
+ export type ExperimentDetail = {
686
+ /** Experiment batch id. Some CLI commands historically call this a batch id. */
687
+ id: string;
688
+ /** Automation this experiment belongs to. */
689
+ automationId: string;
690
+ kind: AutomationKind;
691
+ /** Where the experiment stands, in the words runs use: queued, running, waiting (every unfinished run waits for a person), succeeded (finished; failed examples are counted in `failedCount`), failed (every run failed), cancelled. */
692
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
693
+ /** Total runs in the experiment. */
694
+ runCount: number;
695
+ /** Runs that have completed. */
696
+ completedCount: number;
697
+ /** Runs whose evaluator scores passed. */
698
+ passedCount: number;
699
+ /** Runs whose evaluator scores failed. */
700
+ failedCount: number;
701
+ /** Average automated evaluator score. */
702
+ avgScore: number | null;
703
+ createdAt: string;
704
+ completedAt: string | null;
705
+ version: string | null;
706
+ /** Runs created for dataset examples in this experiment. */
707
+ runs: Array<{
708
+ /** Run id created for the experiment. */
709
+ id: string;
710
+ /** Where the run stands. */
711
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
712
+ /** Where the run stands, including grading. `pending` covers queued, running and finished runs still waiting for evaluators; `ungraded` means no evaluator verdict will arrive. */
713
+ outcome: 'pending' | 'passed' | 'failed' | 'errored' | 'ungraded';
714
+ /** Dataset example id for the run. */
715
+ exampleId: string | null;
716
+ /** Dataset example name for the run. */
717
+ exampleName: string | null;
718
+ /** Persisted weighted evaluator score. */
719
+ evalScore: number | null;
720
+ /** Persisted aggregate evaluator verdict. */
721
+ evalPassed: boolean | null;
722
+ createdAt: string;
723
+ completedAt: string | null;
724
+ }>;
725
+ /** Evaluator results keyed by run id. */
726
+ resultsByRun: Record<string, EvalResult[]>;
727
+ };
728
+ export type ExperimentList = {
729
+ data: Experiment[];
730
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
731
+ nextCursor: string | null;
732
+ };
733
+ export type ExperimentRef = {
734
+ id: string;
735
+ automationId: string;
736
+ };
737
+ export type File = {
738
+ id: string;
739
+ filename: string;
740
+ contentType: string | null;
741
+ size: number | null;
742
+ /** Optional lifecycle marker. `run_input` marks a retry-safe temporary run pre-upload reaped after 24 hours. Omitted/null means a durable reusable file. */
743
+ purpose?: string | null;
744
+ createdAt: string;
745
+ };
746
+ export type FileUploadCreateBody = {
747
+ filename: string;
748
+ contentType: string;
749
+ size: number;
750
+ purpose?: 'run_input';
751
+ idempotencyKey?: string;
752
+ };
753
+ export type FileUploadNegotiation = PresignedFileUploadSession | PresignedMultipartFileUploadSession | HttpChunkedFileUploadSession | MultipartFileUploadFallback;
754
+ export type FileUploadPartList = {
755
+ transport: 'presigned_multipart';
756
+ uploadId: string;
757
+ fileId: string;
758
+ partSizeBytes: number;
759
+ partCount: number;
760
+ expiresAt: string;
761
+ parts: Array<{
762
+ partNumber: number;
763
+ size?: number;
764
+ etag: string;
765
+ }>;
766
+ };
767
+ export type FileUploadPartPresignBody = {
768
+ partNumber: number;
769
+ };
770
+ export type FileUploadSession = {
771
+ uploadId: string;
772
+ fileId: string;
773
+ transport: 'presigned_put' | 'presigned_multipart' | 'http_chunked';
774
+ status: string;
775
+ expiresAt: string;
776
+ partSizeBytes?: number | null;
777
+ partCount?: number | null;
778
+ chunkSizeBytes?: number | null;
779
+ chunkCount?: number | null;
780
+ parts?: Array<{
781
+ partNumber: number;
782
+ size?: number;
783
+ etag: string;
784
+ }>;
785
+ };
786
+ export type HttpChunkedFileUploadSession = {
787
+ transport: 'http_chunked';
788
+ uploadId: string;
789
+ fileId: string;
790
+ chunkSizeBytes: number;
791
+ chunkCount: number;
792
+ chunksUrl: string;
793
+ completeUrl: string;
794
+ expiresAt: string;
795
+ maxFileSizeBytes: number;
796
+ };
797
+ export type ModelList = {
798
+ data: PublicModel[];
799
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
800
+ nextCursor: string | null;
801
+ };
802
+ export type MultipartFileUploadFallback = {
803
+ transport: 'multipart';
804
+ url: string;
805
+ maxFileSizeBytes: number;
806
+ };
807
+ export type PresignedFileUploadSession = {
808
+ transport: 'presigned_put';
809
+ uploadId: string;
810
+ fileId: string;
811
+ url: string;
812
+ headers: Record<string, string>;
813
+ expiresAt: string;
814
+ maxFileSizeBytes: number;
815
+ };
816
+ export type PresignedMultipartFileUploadSession = {
817
+ transport: 'presigned_multipart';
818
+ uploadId: string;
819
+ fileId: string;
820
+ partSizeBytes: number;
821
+ partCount: number;
822
+ partsUrl: string;
823
+ completeUrl: string;
824
+ expiresAt: string;
825
+ maxFileSizeBytes: number;
826
+ };
827
+ export type PresignFileUploadPartResponse = {
828
+ transport: 'presigned_multipart';
829
+ partNumber: number;
830
+ url: string;
831
+ headers: Record<string, string>;
832
+ expiresAt: string;
833
+ partSizeBytes: number;
834
+ };
835
+ export type Project = {
836
+ id: string;
837
+ slug: string;
838
+ provider: 'eigenpal' | 'github' | 'gitlab';
839
+ repository: string;
840
+ rootDirectory: string;
841
+ trackedBranch: string;
842
+ previews: boolean;
843
+ connectionId: string | null;
844
+ /** The repository's web page on GitHub or GitLab, on the connection's own host for a self-managed one. Null for EigenPal Git, which has no web view, and when EigenPal cannot tell. */
845
+ repositoryUrl: string | null;
846
+ createdAt: string;
847
+ archivedAt: string | null;
848
+ /** The caller's access to the project (owners and admins: manager). A Manager changes its settings, promotes and rolls it back. */
849
+ myAccess?: 'viewer' | 'runner' | 'editor' | 'manager';
850
+ /** What EigenPal builds and runs from the live branch; null until the branch was first seen. */
851
+ live: {
852
+ /** The branch whose builds go live. */
853
+ branch: string;
854
+ /** Its head when EigenPal last looked. */
855
+ headCommit: string;
856
+ /** The build asked for its current project files. */
857
+ buildId: string | null;
858
+ /** The build that is live. */
859
+ appliedBuildId: string | null;
860
+ /** Why the latest build is not live: it failed, it holds agents a server build cannot make live yet, or applying it failed. Null when it is live or still building. */
861
+ problem: string | null;
862
+ /** When the live branch last changed. */
863
+ updatedAt: string;
864
+ } | null;
865
+ };
866
+ export type ProjectBuildQueue = {
867
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
868
+ nextCursor: string | null;
869
+ data: Array<{
870
+ id: string;
871
+ commitSha: string;
872
+ status: 'queued' | 'running' | 'succeeded' | 'failed';
873
+ queuedAt: string;
874
+ startedAt: string | null;
875
+ finishedAt: string | null;
876
+ /** Queued builds of your organization a worker takes before this one; 0 once it runs or ended. */
877
+ ahead: number;
878
+ }>;
879
+ };
880
+ export type ProjectList = {
881
+ data: Project[];
882
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
883
+ nextCursor: string | null;
884
+ };
885
+ export type ProjectOperationError = {
886
+ code: string;
887
+ message: string;
888
+ hint?: string | null;
889
+ /** What the refusal names (the request to approve, conflicting files). */
890
+ details?: Record<string, unknown>;
891
+ };
892
+ export type ProjectOperationStep = {
893
+ /** queued, merging, building, approval (a person must merge the request), retrying, released, requested, unchanged, up_to_date or failed. */
894
+ name: string;
895
+ at: string;
896
+ /** What the step waits on: host or update while merging, the build state, an error code. */
897
+ detail?: string | null;
898
+ /** The request the step is about. */
899
+ url?: string | null;
900
+ };
901
+ export type ProjectPromoteBody = {
902
+ /** The environment to promote to, by name. It must be the next environment after this installation; omitted, that one. */
903
+ environment?: string;
904
+ /** What to promote: a tag named `<project path>/<version>` (inside the project `v1.4.0` is enough), a commit SHA, or a branch this environment previews (a hotfix). Omitted: the latest commit on this environment's branch whose build passed a pull request check. */
905
+ ref?: string;
906
+ /** Answer what would happen (`planned`) and change nothing. */
907
+ dryRun?: boolean;
908
+ };
909
+ export type ProjectPromotion = {
910
+ /** Dry run: planned, or build_needed (the source commit is not built yet; the operation builds it first). Operation result: requested, unchanged (that request is already open) or up_to_date. */
911
+ status: 'build_needed' | 'planned' | 'requested' | 'unchanged' | 'up_to_date';
912
+ project: {
913
+ id: string;
914
+ slug: string;
915
+ };
916
+ environment: {
917
+ name: string;
918
+ label: string;
919
+ };
920
+ source: {
921
+ commit: string;
922
+ kind: 'default' | 'tag' | 'commit' | 'branch' | 'next_hop';
923
+ /** The Git tag of the source, if it is one. */
924
+ tag: string | null;
925
+ branch: string | null;
926
+ };
927
+ record?: ProjectPromotionRecord;
928
+ changedFiles?: number;
929
+ /** A dry run (`planned`): the files the request would change. */
930
+ files?: Array<{
931
+ /** Relative to the project folder. */
932
+ path: string;
933
+ change: 'added' | 'modified' | 'deleted';
934
+ }>;
935
+ /** A dry run (`planned`): the automations those files belong to. */
936
+ automations?: Array<{
937
+ kind: 'workflow' | 'agent';
938
+ name: string;
939
+ }>;
940
+ branch?: string;
941
+ request?: {
942
+ number: number;
943
+ url: string;
944
+ branch: string;
945
+ };
946
+ superseded?: Array<{
947
+ number: number;
948
+ url: string;
949
+ branch: string;
950
+ }>;
951
+ /** Dry run only: why the organization's release rules would refuse the real call, or null when they allow it. A dry run is a read, so a refusal is answered here instead of as a 403. */
952
+ refusal?: string | null;
953
+ };
954
+ export type ProjectPromotionRecord = {
955
+ /** EigenPal-Source: the commit the folder comes from. */
956
+ source: string;
957
+ /** EigenPal-Tag: the Git tag promoted, if any. */
958
+ tag: string | null;
959
+ /** EigenPal-Digest: v1: followed by the sha256 over the compiled automations. */
960
+ digest: string;
961
+ /** EigenPal-Compiler: the compiler version. */
962
+ compiler: string;
963
+ };
964
+ export type ProjectRelease = {
965
+ id: string;
966
+ /** The release number, `X.Y.Z`. */
967
+ version: string;
968
+ /** The Git tag: `v1.4.0`, or `<folder>/v1.4.0`. */
969
+ tag: string;
970
+ /** The commit the tag pointed at when it was recorded. */
971
+ commit: string;
972
+ /** The build of that commit that went live here. */
973
+ buildId: string;
974
+ origin: 'cli' | 'studio' | 'git' | 'migration' | 'promotion';
975
+ notes: string | null;
976
+ createdAt: string;
977
+ createdBy: string | null;
978
+ /** Set while withdrawn: version ranges skip the release, its exact number still resolves. */
979
+ withdrawn: {
980
+ at: string;
981
+ reason: string | null;
982
+ } | null;
983
+ /** Its build is what is live here now. */
984
+ live: boolean;
985
+ };
986
+ export type ProjectReleaseCreateBody = {
987
+ /** patch, minor (default) or major, counted from the newest release; or an exact X.Y.Z higher than every release. The first release of a project is 1.0.0. */
988
+ version?: string;
989
+ /** A commit whose build was live here before; default what is live now. A commit that never ran here is refused (409 not_live). */
990
+ ref?: string;
991
+ /** Release a branch: the operation puts it on the tracked branch, waits until that build is live, then numbers it. EigenPal Git: a fast-forward. GitHub and GitLab: open (or reuse) the pull or merge request and merge it right away when the branch rules let the token (else the operation is `waiting` with error approval_required and the request: a person approves and merges it, and the server then numbers the merged commit on its own). The project's pull request check (EigenPal / <slug>) is shown in check, never waited for: merge authority is the rule, so a pending or failed check does not hold the merge. While the Git host prepares the request the step is merging (detail host); a branch behind the tracked head gets it merged in first (merging, detail update; failed with conflict and the files when it does not merge cleanly, or behind_live when the host will not merge it); then building until the build is live. The tracked branch itself, or no branch: number what is live. */
992
+ branch?: string;
993
+ /** Release notes: the tag message. */
994
+ notes?: string;
995
+ /** Answer what would happen (`planned`) and change nothing. */
996
+ dryRun?: boolean;
997
+ };
998
+ export type ProjectReleaseDetail = {
999
+ id: string;
1000
+ /** The release number, `X.Y.Z`. */
1001
+ version: string;
1002
+ /** The Git tag: `v1.4.0`, or `<folder>/v1.4.0`. */
1003
+ tag: string;
1004
+ /** The commit the tag pointed at when it was recorded. */
1005
+ commit: string;
1006
+ /** The build of that commit that went live here. */
1007
+ buildId: string;
1008
+ origin: 'cli' | 'studio' | 'git' | 'migration' | 'promotion';
1009
+ notes: string | null;
1010
+ createdAt: string;
1011
+ createdBy: string | null;
1012
+ /** Set while withdrawn: version ranges skip the release, its exact number still resolves. */
1013
+ withdrawn: {
1014
+ at: string;
1015
+ reason: string | null;
1016
+ } | null;
1017
+ /** Its build is what is live here now. */
1018
+ live: boolean;
1019
+ /** Every workflow and agent of the release's build. */
1020
+ automations: Array<{
1021
+ name: string;
1022
+ kind: 'workflow' | 'agent';
1023
+ /** New or changed since the release numbered before it; true in the first release. */
1024
+ changed: boolean;
1025
+ }>;
1026
+ };
1027
+ export type ProjectReleaseList = {
1028
+ /** Newest number first. */
1029
+ data: ProjectRelease[];
1030
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
1031
+ nextCursor: string | null;
1032
+ };
1033
+ export type ProjectReleaseRequest = {
1034
+ number: number;
1035
+ url: string;
1036
+ state: 'open' | 'merged' | 'closed';
1037
+ /** The head commit the Git host lists for the request. Behind the branch head after a push the host has not processed yet (GitLab refreshes merge requests in the background): the merge waits until the host lists it (waiting host). */
1038
+ head: string;
1039
+ };
1040
+ export type ProjectRollback = {
1041
+ status: 'planned' | 'rolled_back';
1042
+ project: {
1043
+ id: string;
1044
+ slug: string;
1045
+ };
1046
+ environment: {
1047
+ name: string;
1048
+ label: string;
1049
+ } | null;
1050
+ from: {
1051
+ id: string;
1052
+ commit: string;
1053
+ digest: string | null;
1054
+ };
1055
+ to: {
1056
+ id: string;
1057
+ commit: string;
1058
+ digest: string | null;
1059
+ };
1060
+ changed: string[];
1061
+ /** What a rollback leaves as it is: workflows only the current build added are not archived. */
1062
+ note: string;
1063
+ /** The release rolled back to (`to`), if any. */
1064
+ release: string | null;
1065
+ /** Releases of the build left that were withdrawn (planned: would be), so version ranges go back too. Empty with keepRelease. */
1066
+ withdrawn: string[];
1067
+ /** Dry run only: why the organization's release rules would refuse the real call, or null when they allow it. A dry run is a read, so a refusal is answered here instead of as a 403. */
1068
+ refusal?: string | null;
1069
+ };
1070
+ export type ProjectRollbackBody = {
1071
+ /** The environment to roll back. It must be this installation's: each environment rolls back on its own. */
1072
+ environment?: string;
1073
+ /** A release of the project to roll back to; default the build live before. */
1074
+ to?: string;
1075
+ /** Keep the release of the build left. By default it is withdrawn, so callers of a version range go back with the rollback. */
1076
+ keepRelease?: boolean;
1077
+ /** Answer what would happen (`planned`) and change nothing. */
1078
+ dryRun?: boolean;
1079
+ };
1080
+ export type ProjectsOperationsGetResponse = ReleaseOperation | PromotionOperation;
1081
+ export type ProjectsPromoteResponse = ProjectPromotion | PromotionOperation;
1082
+ export type ProjectsReleasesCreateResponse = CreatedProjectRelease | ReleaseOperation;
1083
+ export type ProjectStatus = {
1084
+ live: {
1085
+ branch: string;
1086
+ headCommit: string;
1087
+ /** The latest build of the live branch. */
1088
+ build: {
1089
+ id: string;
1090
+ status: 'queued' | 'running' | 'succeeded' | 'failed';
1091
+ commitSha: string;
1092
+ /** When the build started. */
1093
+ createdAt: string;
1094
+ /** When it last entered the queue. */
1095
+ queuedAt: string;
1096
+ /** When a worker picked it up; null while it waits in the queue. */
1097
+ startedAt: string | null;
1098
+ finishedAt: string | null;
1099
+ /** When the build last went live; null if it never did. */
1100
+ activatedAt: string | null;
1101
+ /** The first error of a failed build. A caller who cannot manage projects and cannot see every workflow of the project gets only the number of errors. */
1102
+ error: string | null;
1103
+ } | null;
1104
+ /** The build that is live, when it is not the latest one. */
1105
+ appliedBuild: {
1106
+ id: string;
1107
+ status: 'queued' | 'running' | 'succeeded' | 'failed';
1108
+ commitSha: string;
1109
+ /** When the build started. */
1110
+ createdAt: string;
1111
+ /** When it last entered the queue. */
1112
+ queuedAt: string;
1113
+ /** When a worker picked it up; null while it waits in the queue. */
1114
+ startedAt: string | null;
1115
+ finishedAt: string | null;
1116
+ /** When the build last went live; null if it never did. */
1117
+ activatedAt: string | null;
1118
+ /** The first error of a failed build. A caller who cannot manage projects and cannot see every workflow of the project gets only the number of errors. */
1119
+ error: string | null;
1120
+ } | null;
1121
+ /** The latest build is live. */
1122
+ live: boolean;
1123
+ /** Why the latest build is not live; generic for a caller who cannot see every workflow of the project. */
1124
+ problem: string | null;
1125
+ /** `problem` already quotes the latest build's first error. */
1126
+ problemQuotesError: boolean;
1127
+ /** Set while the latest build has waited in the queue for more than two minutes and no worker picked it up. */
1128
+ waitingForBuilder: {
1129
+ since: string;
1130
+ /** Workers reporting in now. */
1131
+ workers: number;
1132
+ } | null;
1133
+ /** What EigenPal found in the production branch; null for a caller who cannot see every workflow of the project. */
1134
+ detected: {
1135
+ /** The build the automations were read from; null when no build succeeded yet. */
1136
+ commitSha: string | null;
1137
+ automations: Array<{
1138
+ kind: 'workflow' | 'agent';
1139
+ slug: string;
1140
+ file: string;
1141
+ /** It has evals the build could read. */
1142
+ evals: boolean;
1143
+ /** Examples in its dataset; null without a dataset. */
1144
+ examples: number | null;
1145
+ /** Where it opens: the workflow id, or the agent slug; null until it exists here. */
1146
+ ref: string | null;
1147
+ /** Its most recent run. */
1148
+ lastRunAt: string | null;
1149
+ /** It is in the build that runs. False: only the latest build has it, and that build failed. */
1150
+ built: boolean;
1151
+ }>;
1152
+ /** Compile errors of the latest build when it failed, unreadable eval suites and dataset errors. */
1153
+ problems: Array<{
1154
+ message: string;
1155
+ file: string | null;
1156
+ line: number | null;
1157
+ /** A compile error of the latest build, an eval suite that does not load, or a dataset error. */
1158
+ source: 'build' | 'evals' | 'dataset';
1159
+ /** The automation the problem belongs to; null for a problem of the project as a whole. */
1160
+ automation: {
1161
+ kind: 'workflow' | 'agent';
1162
+ slug: string;
1163
+ } | null;
1164
+ }>;
1165
+ } | null;
1166
+ } | null;
1167
+ previews: Array<{
1168
+ branch: string;
1169
+ headCommit: string;
1170
+ build: {
1171
+ id: string;
1172
+ status: 'queued' | 'running' | 'succeeded' | 'failed';
1173
+ commitSha: string;
1174
+ /** When the build started. */
1175
+ createdAt: string;
1176
+ /** When it last entered the queue. */
1177
+ queuedAt: string;
1178
+ /** When a worker picked it up; null while it waits in the queue. */
1179
+ startedAt: string | null;
1180
+ finishedAt: string | null;
1181
+ /** When the build last went live; null if it never did. */
1182
+ activatedAt: string | null;
1183
+ /** The first error of a failed build. A caller who cannot manage projects and cannot see every workflow of the project gets only the number of errors. */
1184
+ error: string | null;
1185
+ } | null;
1186
+ previewed: boolean;
1187
+ /** No build yet: the project already previews `previewLimit` branches. */
1188
+ waitingForSlot: boolean;
1189
+ problem: string | null;
1190
+ /** `problem` already quotes the build's first error. */
1191
+ problemQuotesError: boolean;
1192
+ updatedAt: string;
1193
+ /** The preview workflows of the branch the caller can open. */
1194
+ workflows: Array<{
1195
+ id: string;
1196
+ name: string;
1197
+ }>;
1198
+ }>;
1199
+ previewLimit: number;
1200
+ checks: Array<{
1201
+ number: number;
1202
+ headSha: string;
1203
+ status: 'building' | 'evaluating' | 'completed';
1204
+ conclusion: 'success' | 'failure' | 'neutral' | null;
1205
+ title: string | null;
1206
+ url: string | null;
1207
+ detailsUrl: string | null;
1208
+ updatedAt: string;
1209
+ }>;
1210
+ /** The 1.0.0 release migration while it holds the project back (not cut over, set aside for a person, or a review-mode request not merged yet); null once done. */
1211
+ migration: {
1212
+ status: 'pending' | 'running' | 'published' | 'complete' | 'needs_operator' | 'failed' | 'reverted';
1213
+ mode: 'hosted' | 'review';
1214
+ /** Why the project waits, for a banner: e.g. the migration request was closed without merging (status needs_operator). Never workflow content. */
1215
+ problem: string | null;
1216
+ /** Review mode: the pull or merge request with the converted workflows. */
1217
+ requestUrl: string | null;
1218
+ } | null;
1219
+ /** Set when this installation promotes and no promotion route holds the project: it builds and runs here, and promotes nowhere until an admin adds a route for its folder. */
1220
+ routeProblem: string | null;
1221
+ /** The project itself. */
1222
+ project: {
1223
+ id: string;
1224
+ slug: string;
1225
+ /** eigenpal, github or gitlab. */
1226
+ provider: string;
1227
+ repository: string;
1228
+ /** The folder in the repository; empty for the root. */
1229
+ rootDirectory: string;
1230
+ /** The branch that goes live. */
1231
+ trackedBranch: string;
1232
+ archived: boolean;
1233
+ };
1234
+ /** What is live in this installation; null when nothing is. */
1235
+ current: {
1236
+ commit: string;
1237
+ buildId: string;
1238
+ /** Its newest release that is not withdrawn. */
1239
+ release: string | null;
1240
+ /** When it went live. */
1241
+ at: string | null;
1242
+ } | null;
1243
+ /** The newest 10 releases, withdrawn ones included. */
1244
+ releases: ProjectRelease[];
1245
+ /** Where the project stands in each environment, in promotion order (one entry, the tracked branch, without a promotion block). Empty with `environments=false`. */
1246
+ environments: Array<{
1247
+ name: string;
1248
+ label: string;
1249
+ /** This installation. */
1250
+ current: boolean;
1251
+ /** Where the environment is reached. */
1252
+ url: string | null;
1253
+ repository: string | null;
1254
+ branch: string;
1255
+ requireTag: boolean;
1256
+ /** The release it runs, when known. */
1257
+ release: string | null;
1258
+ running: {
1259
+ commit: string | null;
1260
+ source: string | null;
1261
+ version: string | null;
1262
+ state: 'live' | 'merged';
1263
+ } | null;
1264
+ behind: number | null;
1265
+ /** The open promotion request into it. */
1266
+ request: {
1267
+ number: number;
1268
+ url: string;
1269
+ source: string | null;
1270
+ version: string | null;
1271
+ /** The receiving environment's check of the request; null before it reported. */
1272
+ check: 'building' | 'passed' | 'failed' | 'held' | null;
1273
+ } | null;
1274
+ problem: string | null;
1275
+ }>;
1276
+ };
1277
+ export type PromotionOperation = {
1278
+ /** Operation id (opaque). */
1279
+ id: string;
1280
+ kind: 'promotion';
1281
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed';
1282
+ project: {
1283
+ id: string;
1284
+ slug: string;
1285
+ };
1286
+ /** Progress, oldest first. */
1287
+ steps: ProjectOperationStep[];
1288
+ /** Once succeeded: what it made. */
1289
+ result: ProjectPromotion | null;
1290
+ /** Once failed, or while waiting for a person: what stopped it. */
1291
+ error: ProjectOperationError | null;
1292
+ createdAt: string;
1293
+ updatedAt: string;
1294
+ completedAt: string | null;
1295
+ };
1296
+ export type PromotionRoute = {
1297
+ name: string;
1298
+ origin: 'config' | 'app';
1299
+ status: 'active' | 'replaced' | 'locked' | 'invalid' | 'elsewhere' | 'no_credential';
1300
+ environments: PromotionRouteEnvironment[];
1301
+ /** Active projects at its location here. */
1302
+ projects: number;
1303
+ problems: Array<{
1304
+ code: string;
1305
+ message: string;
1306
+ field?: string;
1307
+ other?: string;
1308
+ }>;
1309
+ };
1310
+ export type PromotionRouteCheck = {
1311
+ environment: string;
1312
+ visible: boolean;
1313
+ writesAs: string | null;
1314
+ branchExists: boolean | null;
1315
+ problem: string | null;
1316
+ };
1317
+ export type PromotionRouteEnvironment = {
1318
+ /** The environment, one of the installation path. */
1319
+ name: string;
1320
+ /** The credential that reaches the repository. */
1321
+ credential: string;
1322
+ /** The repository path on the Git host. */
1323
+ repository: string;
1324
+ branch: string;
1325
+ /** The folder in the repository; '' is all of it. */
1326
+ folder: string;
1327
+ /** The Git user this environment writes as there. */
1328
+ bot: string;
1329
+ acceptsFrom?: string;
1330
+ /** Whether this installation holds a token for it. */
1331
+ visible?: boolean;
1332
+ };
1333
+ export type PromotionRouteList = {
1334
+ data: PromotionRoute[];
1335
+ /** Always null: the list is complete. */
1336
+ nextCursor: string | null;
1337
+ };
1338
+ export type PromotionRoutePlan = {
1339
+ plan: {
1340
+ route: string;
1341
+ created: boolean;
1342
+ changes: string[];
1343
+ issues: Array<{
1344
+ code: string;
1345
+ message: string;
1346
+ field?: string;
1347
+ other?: string;
1348
+ }>;
1349
+ checks: PromotionRouteCheck[];
1350
+ };
1351
+ applied: boolean;
1352
+ route?: PromotionRoute;
1353
+ };
1354
+ export type PromotionRoutePutBody = {
1355
+ /** For each environment, in order from the first: name, credential, repository, branch, bot, and optionally folder and acceptsFrom. */
1356
+ environments: Array<Record<string, unknown>>;
1357
+ };
1358
+ export type PromotionSettings = {
1359
+ /** routesInApp: false. Routes and access come from the installation settings only. */
1360
+ locked: boolean;
1361
+ /** This installation's environment. */
1362
+ environment: string;
1363
+ /** The release path in order, from the installation settings. */
1364
+ path: Array<{
1365
+ name: string;
1366
+ label: string;
1367
+ url: string | null;
1368
+ }>;
1369
+ };
1370
+ export type PublicModel = {
1371
+ id: string;
1372
+ kind: 'llm' | 'ocr';
1373
+ provider: string;
1374
+ label: string;
1375
+ capabilities: Array<'text' | 'vision' | 'ocr'>;
1376
+ configured: boolean;
1377
+ available: boolean;
1378
+ /** Configuration state only: `configured` means credentials are present in this environment; `unconfigured` means the catalog entry exists but credentials are missing. This list does not probe live providers, so it never reports healthy/degraded/outage. `unknown` is reserved and is not emitted by this endpoint. */
1379
+ health: 'configured' | 'unconfigured' | 'unknown';
1380
+ defaultFor: Array<'text' | 'vision' | 'ocr'>;
1381
+ /** `local` means on-prem / no cloud provider egress (`local: true` or tesseract). `hosted` means the provider is a cloud API. Endpoints are never returned. */
1382
+ location: 'local' | 'hosted';
1383
+ limits?: PublicModelLimits;
1384
+ /** Static EigenPal credit rates when known without a live vendor catalog. Omitted for OpenParser OCR and for LLMs (token prices are not part of this catalog). */
1385
+ cost?: PublicModelCost;
1386
+ aliases: string[];
1387
+ tags: string[];
1388
+ /** Optional picker rank. Higher is more capable. Omitted on catalog rows that do not set it. Does not change role defaults. */
1389
+ capabilityRank?: number;
1390
+ };
1391
+ export type PublicModelCost = {
1392
+ creditsPerPage?: number;
1393
+ unit: 'credits';
1394
+ };
1395
+ export type PublicModelLimits = {
1396
+ requestTimeoutSeconds?: number;
1397
+ maxConcurrentRequests?: number;
1398
+ };
1399
+ export type PublicResendEmailServer = {
1400
+ id: string;
1401
+ name: string;
1402
+ enabled: boolean;
1403
+ createdAt: string;
1404
+ updatedAt: string;
1405
+ transport: 'resend';
1406
+ fromEmail: string;
1407
+ fromName: string;
1408
+ apiKeyConfigured: true;
1409
+ };
1410
+ export type PublicSmtpEmailServer = {
1411
+ id: string;
1412
+ name: string;
1413
+ enabled: boolean;
1414
+ createdAt: string;
1415
+ updatedAt: string;
1416
+ transport: 'smtp';
1417
+ fromEmail: string;
1418
+ fromName: string;
1419
+ host: string;
1420
+ port: number;
1421
+ security: 'starttls' | 'tls' | 'none';
1422
+ username: string | null;
1423
+ passwordConfigured: boolean;
1424
+ caPemConfigured: boolean;
1425
+ };
1426
+ export type ReleaseOperation = {
1427
+ /** Operation id (opaque). */
1428
+ id: string;
1429
+ kind: 'release';
1430
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed';
1431
+ project: {
1432
+ id: string;
1433
+ slug: string;
1434
+ };
1435
+ /** Progress, oldest first. */
1436
+ steps: ProjectOperationStep[];
1437
+ /** Once succeeded: what it made. */
1438
+ result: CreatedProjectRelease | null;
1439
+ /** Once failed, or while waiting for a person: what stopped it. */
1440
+ error: ProjectOperationError | null;
1441
+ createdAt: string;
1442
+ updatedAt: string;
1443
+ completedAt: string | null;
1444
+ };
1445
+ export type ReviewApproveBody = {
1446
+ expectedVersion: number;
1447
+ };
1448
+ export type ReviewConfirmFieldBody = {
1449
+ expectedVersion: number;
1450
+ idempotencyKey: string;
1451
+ path: string;
1452
+ value: string | number | boolean | null;
1453
+ confirmed?: boolean;
1454
+ };
1455
+ export type ReviewList = {
1456
+ data: Array<{
1457
+ id: string;
1458
+ runId: string;
1459
+ automationId: string;
1460
+ automationName: string;
1461
+ project?: {
1462
+ id: string;
1463
+ slug: string;
1464
+ } | null;
1465
+ sourceKind: 'workflow_step' | 'agent_tool';
1466
+ sourceLabel: string;
1467
+ status: 'pending' | 'approved' | 'rejected' | 'cancelled';
1468
+ requiredCount: number;
1469
+ confirmedCount: number;
1470
+ version: number;
1471
+ createdAt: string;
1472
+ updatedAt: string;
1473
+ }>;
1474
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
1475
+ nextCursor: string | null;
1476
+ };
1477
+ export type ReviewRejectBody = {
1478
+ expectedVersion: number;
1479
+ idempotencyKey: string;
1480
+ reason: string;
1481
+ };
1482
+ export type ReviewTaskDetail = {
1483
+ id: string;
1484
+ runId: string;
1485
+ automationId: string;
1486
+ automationName: string;
1487
+ project?: {
1488
+ id: string;
1489
+ slug: string;
1490
+ } | null;
1491
+ sourceKind: 'workflow_step' | 'agent_tool';
1492
+ sourceLabel: string;
1493
+ status: 'pending' | 'approved' | 'rejected' | 'cancelled';
1494
+ requiredCount: number;
1495
+ confirmedCount: number;
1496
+ version: number;
1497
+ createdAt: string;
1498
+ updatedAt: string;
1499
+ files: Array<{
1500
+ fileId: string;
1501
+ filename: string;
1502
+ mimeType?: string;
1503
+ size?: number;
1504
+ fieldName?: string;
1505
+ artifactPath: string;
1506
+ /** run_input for authorized run input files; attachment for extra current-run files. Omitted on historical tasks and inferred at read time. */
1507
+ role?: 'run_input' | 'attachment';
1508
+ }>;
1509
+ /** Non-file trigger input derived at read time. Null when every field is a file or external source id. omitted_too_large when the projection exceeds the review data byte limit. */
1510
+ input: {
1511
+ status: 'available';
1512
+ data: Record<string, unknown> | unknown[];
1513
+ } | {
1514
+ status: 'omitted_too_large';
1515
+ } | null;
1516
+ machineData: Record<string, unknown> | unknown[];
1517
+ draftData: Record<string, unknown> | unknown[];
1518
+ schema: Record<string, unknown> | null;
1519
+ fieldMetadata: Record<string, {
1520
+ /** Routing confidence: categorical low|medium|high from ai.extract grounding, or legacy 0–1 numeric when authored. Numeric grounding scores from extract land in display.score instead. Not calibrated by Eigenpal. */
1521
+ confidence?: number | 'low' | 'medium' | 'high' | string;
1522
+ /** Short label shown in the review UI */
1523
+ label?: string;
1524
+ /** Longer reviewer guidance for this field */
1525
+ description?: string;
1526
+ /** Legacy per-field override kept for existing tasks. Prefer selection.fields.review. */
1527
+ review?: 'auto' | 'always' | 'never';
1528
+ /** Opaque display metadata preserved for the review UI. When metadataFrom is ai.extract, numeric grounding scores are copied here as display.score; routing confidence stays on confidence as categorical low|medium|high. */
1529
+ display?: Record<string, unknown>;
1530
+ }>;
1531
+ requiredPaths: string[];
1532
+ selectionReasons: Record<string, 'always' | 'explicit' | 'low_confidence' | 'missing_confidence' | 'all' | 'reviewer_edit' | 'threshold_met' | 'never' | 'excluded' | 'unmatched' | 'missing_confidence_skip'>;
1533
+ decisions: Array<{
1534
+ id: string;
1535
+ path: string;
1536
+ originalValue: string | number | boolean | null;
1537
+ currentValue: string | number | boolean | null;
1538
+ required: boolean;
1539
+ reason: 'always' | 'explicit' | 'low_confidence' | 'missing_confidence' | 'all' | 'reviewer_edit' | 'threshold_met' | 'never' | 'excluded' | 'unmatched' | 'missing_confidence_skip';
1540
+ confirmedBy: string | null;
1541
+ confirmedAt: string | null;
1542
+ version: number;
1543
+ }>;
1544
+ instructions: string | null;
1545
+ completedBy: string | null;
1546
+ completedAt: string | null;
1547
+ outcomeReason: string | null;
1548
+ /** Optional lineage@1 document resolved from the extract sidecar. Omitted when missing or unreadable. Validate with @openparser/lineage. */
1549
+ lineage?: Record<string, unknown>;
1550
+ /** Optional ParsedDocument resolved from the extract sidecar. Omitted when missing or unreadable. Validate with @openparser/schema. */
1551
+ parsedDocument?: Record<string, unknown>;
1552
+ };
1553
+ export type Run = {
1554
+ id: string;
1555
+ kind: 'workflow' | 'agent';
1556
+ /** Slug of the project of the automation that ran. Null once it is deleted. */
1557
+ project: string | null;
1558
+ /** Name of the automation that ran. */
1559
+ automation: string | null;
1560
+ /** Release number that ran. When the source that ran is no release (a draft, a branch or a build made live without one), an agent run carries the version it asked for and a workflow run null. `commit` then says what ran. */
1561
+ version: string | null;
1562
+ /** Source commit that ran; null when none is recorded. */
1563
+ commit: string | null;
1564
+ /** The version the caller asked for (`live`, `1.2.3`, `^1`, a commit), as sent. Null for runs nobody asked a version of. */
1565
+ requested: string | null;
1566
+ /** Where the run stands: queued, running, waiting (a person must act: see `reviewTaskId`), succeeded, failed, cancelled. */
1567
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
1568
+ /** While `state` is `waiting`: the human review task to open (`GET /api/v1/reviews/{taskId}`). Null otherwise. */
1569
+ reviewTaskId: string | null;
1570
+ tags: string[];
1571
+ /** Deterministic pseudo-random rank in [0, 1) for this run within the organization. Use with a sample rate threshold to review a stable subset. */
1572
+ sampleRank: number;
1573
+ /** Parent run id when this run was started by an invoke step. Omitted for top-level runs. */
1574
+ parentRunId?: string;
1575
+ timing: RunTiming;
1576
+ trigger: RunTrigger;
1577
+ /** Present only on eval-scoped runs. Omitted otherwise. */
1578
+ eval?: RunEval;
1579
+ /** Whether the completed output matched the output schema of the automation. */
1580
+ schemaValid: boolean | null;
1581
+ /** Experiment batch id when the run is part of a batch. */
1582
+ batchId: string | null;
1583
+ retry: RunRetry;
1584
+ /** Review state: the summary on list rows, the full review of a run read with `expand=steps`. */
1585
+ review?: RunReviewSummary | RunReview | null;
1586
+ /** Pending in-flight human review when the run is waiting on a reviewer. */
1587
+ humanReview?: RunHumanReviewSummary | null;
1588
+ /** Structured processing failure, independent of the HTTP response status. Includes control.fail statusCode and step when known. Present on ended runs; null when no error is recorded. Absent while in flight. */
1589
+ error?: RunError | null;
1590
+ /** Succeeded runs only. Per-automation business result, not a generic schema. Absent until then. */
1591
+ output?: Record<string, unknown> | null;
1592
+ /** Succeeded runs only. Download with GET /v1/runs/{id}/artifacts/{path}. Absent until then. */
1593
+ artifacts?: RunArtifact[];
1594
+ /** Build the run started on, pinned at creation (workflow runs, `GET /v1/runs/{id}` detail only). Null for runs created before builds were recorded. */
1595
+ build?: RunBuild | null;
1596
+ /** Present only with `expand=input`. */
1597
+ input?: RunInput;
1598
+ /** Present only with `expand=usage`. Null for old runs without telemetry. */
1599
+ usage?: RunUsage | null;
1600
+ /** Present only with `expand=debug`. */
1601
+ debug?: RunDebug;
1602
+ /** `expand=steps`, workflow runs: one row per step. Full `input`/`output` live on `GET /api/v1/runs/{id}/steps/{stepId}`. */
1603
+ steps?: RunStep[];
1604
+ /** `expand=steps`, workflow runs: runs started by invoke steps, and their steps. Omitted when there are none. */
1605
+ childRuns?: RunChildRun[];
1606
+ /** `expand=steps`, agent runs: output files the agent produced. */
1607
+ outputFiles?: RunFile[];
1608
+ /** `expand=steps`: ground-truth expected output and files. */
1609
+ expected?: {
1610
+ output?: unknown;
1611
+ files?: RunFile[];
1612
+ };
1613
+ /** `expand=steps`, agent eval runs: expected against actual (ended runs only). */
1614
+ comparison?: RunComparison;
1615
+ };
1616
+ export type RunAccepted = {
1617
+ id: string;
1618
+ kind: 'workflow' | 'agent';
1619
+ /** Slug of the project of the automation that ran. Null once it is deleted. */
1620
+ project: string | null;
1621
+ /** Name of the automation that ran. */
1622
+ automation: string | null;
1623
+ /** Release number that ran. When the source that ran is no release (a draft, a branch or a build made live without one), an agent run carries the version it asked for and a workflow run null. `commit` then says what ran. */
1624
+ version: string | null;
1625
+ /** Source commit that ran; null when none is recorded. */
1626
+ commit: string | null;
1627
+ /** The version the caller asked for (`live`, `1.2.3`, `^1`, a commit), as sent. Null for runs nobody asked a version of. */
1628
+ requested: string | null;
1629
+ /** `queued` when the run was only accepted, `running` when the wait ran out before it ended. Read `state` on `GET /api/v1/runs/{id}` for the rest. */
1630
+ state: 'queued' | 'running';
1631
+ };
1632
+ export type RunArtifact = {
1633
+ name: string;
1634
+ /** `input`, `output`, `debug`, `report`, or another stable artifact role. */
1635
+ role: string;
1636
+ /** Canonical artifact path for GET /v1/runs/{id}/artifacts/{path}. */
1637
+ path: string;
1638
+ /** Workflow step that produced the file, when known. */
1639
+ stepName?: string;
1640
+ contentType?: string | null;
1641
+ size?: number | null;
1642
+ };
1643
+ export type RunArtifactsResponse = {
1644
+ data: RunArtifact[];
1645
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
1646
+ nextCursor: string | null;
1647
+ };
1648
+ export type RunBuild = {
1649
+ /** Short build id, e.g. `b-k3xq9m2a`. */
1650
+ id: string;
1651
+ /** SHA-256 of the stored workflow definition and the code it references. Does not cover per-run inputs such as pinned inline invoke targets or step overrides. */
1652
+ digest: string;
1653
+ /** When this digest was first deployed in the organization. */
1654
+ createdAt: string;
1655
+ /** The author's source commit recorded in the build manifest. Null for drafts, Studio saves and builds that did not record one. */
1656
+ commitSha: string | null;
1657
+ /** Link to `commitSha` in the author's repository, when the workflow records one. Never built from the published commit. */
1658
+ commitUrl: string | null;
1659
+ };
1660
+ export type RunCancelResponse = {
1661
+ id: string;
1662
+ kind: 'workflow' | 'agent';
1663
+ /** Where the run stands: queued, running, waiting (a person must act: see `reviewTaskId`), succeeded, failed, cancelled. */
1664
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
1665
+ cancellation: {
1666
+ /** `cancelled`: the run was terminated immediately (it had not started). `requested`: the run is in-flight; cancellation was requested and `state` will become `cancelled` shortly. `already_terminal`: the run had already ended; nothing changed. */
1667
+ state: 'cancelled' | 'requested' | 'already_terminal';
1668
+ /** Where the run stood when the cancel request was received. */
1669
+ wasState: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
1670
+ };
1671
+ };
1672
+ export type RunChildRun = {
1673
+ runId: string;
1674
+ /** The invoked automation. */
1675
+ name: string | null;
1676
+ /** The invoke step that started it. */
1677
+ parentStepName: string;
1678
+ invokeChain: Array<{
1679
+ stepName: string;
1680
+ name: string | null;
1681
+ }>;
1682
+ steps: RunStep[];
1683
+ };
1684
+ export type RunComparison = {
1685
+ /** The example has no expected output. */
1686
+ noExpectedData: boolean;
1687
+ passed: boolean;
1688
+ matchedFields: number;
1689
+ totalFields: number;
1690
+ mismatches: Array<{
1691
+ path: string;
1692
+ /** The expected value (user data). */
1693
+ expected: unknown;
1694
+ /** The actual value (user data). */
1695
+ actual: unknown;
1696
+ }>;
1697
+ avgScore?: number | null;
1698
+ };
1699
+ export type RunDebug = {
1700
+ /** Execution phase timeline and structured failure. */
1701
+ observability: ExecutionObservability | null;
1702
+ /** Workflow trace id for span lookup (workflow runs only). */
1703
+ traceId?: string | null;
1704
+ };
1705
+ export type RunError = {
1706
+ /** Machine-readable failure code. Do not branch on message text. */
1707
+ code: string;
1708
+ /** Human-readable failure explanation. */
1709
+ message: string;
1710
+ /** HTTP-style business code configured by control.fail, not the API response status. Absent for untyped failures. */
1711
+ statusCode?: number;
1712
+ /** Name of the control.fail step that rejected the run, when known. */
1713
+ step?: string;
1714
+ /** Whether another attempt might succeed. Does not schedule a retry. */
1715
+ retryable: boolean;
1716
+ };
1717
+ export type RunEval = {
1718
+ /** Eval example label (agent example name or workflow example id). */
1719
+ example: string | null;
1720
+ /** Workflow eval example folder id (workflow runs only). */
1721
+ exampleId?: string | null;
1722
+ score: number | null;
1723
+ passed: boolean | null;
1724
+ };
1725
+ export type RunEvent = {
1726
+ id?: string;
1727
+ type: string;
1728
+ timestamp: string;
1729
+ status?: string | null;
1730
+ message?: string | null;
1731
+ metadata?: Record<string, unknown>;
1732
+ };
1733
+ export type RunEventsResponse = {
1734
+ data: RunEvent[];
1735
+ /** Set when more events exist than one response holds (1000 at most): read again with `cursor` set to this value. Null on the last page. */
1736
+ nextCursor: string | null;
1737
+ };
1738
+ export type RunExample = {
1739
+ run: {
1740
+ id: string;
1741
+ automation: {
1742
+ id: string;
1743
+ name: string | null;
1744
+ kind: 'workflow' | 'agent';
1745
+ };
1746
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
1747
+ };
1748
+ /** The example name: the folder `dataset/<name>/`. */
1749
+ name: string;
1750
+ /** `input.json`, with `$file` paths as in the folder. */
1751
+ input: unknown;
1752
+ /** `expected.json`: the reviewer's corrected output when there is one, else the run's output; null when there is neither. */
1753
+ expected: unknown;
1754
+ expectedSource: 'review' | 'output' | 'none';
1755
+ /** `meta.json`; null: write none. */
1756
+ meta: unknown;
1757
+ files: Array<{
1758
+ /** Where it goes in the folder: `input/<field>/<file>` or `expected/<path>`. */
1759
+ path: string;
1760
+ role: 'input' | 'expected';
1761
+ /** The run artifact path it is read from. */
1762
+ artifact: string;
1763
+ /** Where to download its bytes (same sign-in). */
1764
+ download: string;
1765
+ bytes: number | null;
1766
+ contentType: string | null;
1767
+ }>;
1768
+ };
1769
+ export type RunFile = {
1770
+ name: string;
1771
+ };
1772
+ export type RunHumanReviewSummary = {
1773
+ taskId: string;
1774
+ sourceKind: 'workflow_step' | 'agent_tool';
1775
+ sourceLabel: string;
1776
+ status: 'pending';
1777
+ requiredCount: number;
1778
+ confirmedCount: number;
1779
+ version: number;
1780
+ };
1781
+ export type RunInput = {
1782
+ /** Input arguments the run was started with. */
1783
+ args: unknown;
1784
+ /** Uploaded input files (agent runs only). */
1785
+ files?: RunFile[];
1786
+ /** Caller-supplied run metadata, if any. */
1787
+ metadata?: unknown;
1788
+ };
1789
+ export type RunList = {
1790
+ data: RunListItem[];
1791
+ nextCursor: string | null;
1792
+ };
1793
+ export type RunListItem = {
1794
+ id: string;
1795
+ kind: 'workflow' | 'agent';
1796
+ /** Slug of the project of the automation that ran. Null once it is deleted. */
1797
+ project: string | null;
1798
+ /** Name of the automation that ran. */
1799
+ automation: string | null;
1800
+ /** Release number that ran. When the source that ran is no release (a draft, a branch or a build made live without one), an agent run carries the version it asked for and a workflow run null. `commit` then says what ran. */
1801
+ version: string | null;
1802
+ /** Source commit that ran; null when none is recorded. */
1803
+ commit: string | null;
1804
+ /** The version the caller asked for (`live`, `1.2.3`, `^1`, a commit), as sent. Null for runs nobody asked a version of. */
1805
+ requested: string | null;
1806
+ /** Where the run stands: queued, running, waiting (a person must act: see `reviewTaskId`), succeeded, failed, cancelled. */
1807
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
1808
+ /** While `state` is `waiting`: the human review task to open (`GET /api/v1/reviews/{taskId}`). Null otherwise. */
1809
+ reviewTaskId: string | null;
1810
+ tags: string[];
1811
+ /** Deterministic pseudo-random rank in [0, 1) for this run within the organization. Use with a sample rate threshold to review a stable subset. */
1812
+ sampleRank: number;
1813
+ /** Parent run id when this run was started by an invoke step. Omitted for top-level runs. */
1814
+ parentRunId?: string;
1815
+ timing: RunTiming;
1816
+ trigger: RunTrigger;
1817
+ /** Present only on eval-scoped runs. Omitted otherwise. */
1818
+ eval?: RunEval;
1819
+ /** Whether the completed output matched the output schema of the automation. */
1820
+ schemaValid: boolean | null;
1821
+ /** Experiment batch id when the run is part of a batch. */
1822
+ batchId: string | null;
1823
+ retry: RunRetry;
1824
+ /** Review state: the summary on list rows, the full review of a run read with `expand=steps`. */
1825
+ review?: RunReviewSummary | RunReview | null;
1826
+ /** Pending in-flight human review when the run is waiting on a reviewer. */
1827
+ humanReview?: RunHumanReviewSummary | null;
1828
+ /** Structured processing failure, independent of the HTTP response status. Includes control.fail statusCode and step when known. Present on ended runs; null when no error is recorded. Absent while in flight. */
1829
+ error?: RunError | null;
1830
+ };
1831
+ export type RunRetry = {
1832
+ /** Retry attempt index (0 = original run). */
1833
+ number: number;
1834
+ /** Run id of the prior attempt in the retry chain. */
1835
+ previousRunId: string | null;
1836
+ /** Retry run spawned from this run, if any. `state` here is the later retry, not this run. */
1837
+ nextRun: {
1838
+ id: string;
1839
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
1840
+ } | null;
1841
+ };
1842
+ export type RunReview = {
1843
+ id: string;
1844
+ verdict: 'correct' | 'incorrect' | null;
1845
+ status: 'open' | 'closed' | 'wont_fix';
1846
+ note: string;
1847
+ correctedOutput?: unknown;
1848
+ /** User id of the last reviewer. Read-only; set from the authenticated user or API key creator. */
1849
+ reviewedBy: string | null;
1850
+ /** Email of the last reviewer. Read-only; set from the authenticated user or API key creator. */
1851
+ reviewedByEmail: string | null;
1852
+ reviewedAt: string;
1853
+ /** User id recorded when the review was closed. Read-only; set when status becomes closed or wont_fix. */
1854
+ closedBy: string | null;
1855
+ /** Email recorded when the review was closed. Read-only; set when status becomes closed or wont_fix. */
1856
+ closedByEmail: string | null;
1857
+ closedAt: string | null;
1858
+ closedNote: string | null;
1859
+ createdAt: string;
1860
+ updatedAt: string;
1861
+ corrections: RunReviewCorrection[];
1862
+ };
1863
+ export type RunReviewCorrection = {
1864
+ id: string;
1865
+ kind: 'field' | 'file';
1866
+ /** JSON Pointer for field corrections, or canonical artifact path for file reviews. */
1867
+ path: string;
1868
+ label: string | null;
1869
+ originalValue?: unknown;
1870
+ correctedValue?: unknown;
1871
+ note: string;
1872
+ correctedArtifactPath?: string | null;
1873
+ createdAt: string;
1874
+ updatedAt: string;
1875
+ };
1876
+ export type RunReviewSummary = {
1877
+ verdict: 'correct' | 'incorrect' | null;
1878
+ status: 'open' | 'closed' | 'wont_fix';
1879
+ /** True when review notes were left. */
1880
+ hasNote: boolean;
1881
+ /** Number of field/file corrections. */
1882
+ correctionCount: number;
1883
+ };
1884
+ export type RunStartBody = {
1885
+ /** Project slug. Required for personal and service account keys; a project API key implies its own project and refuses another. */
1886
+ project?: string;
1887
+ /** Name of the automation in the project, without a kind prefix. */
1888
+ automation: string;
1889
+ /** What to run: `live` (default), a release (`1.2.3`), a range of releases (`1`, `1.x`, `^1.2.3`, `~1.2.3`, `>=1 <3`; the highest released one that matches) or a 40-character commit sha. */
1890
+ version?: string;
1891
+ /** Seconds to wait for the run to end before answering (max 600). Omit to return at once. */
1892
+ wait?: number;
1893
+ /** One exact tag or a list of up to 100 (256 characters each). Tags are returned on the run and in every webhook event as `data.run.tags`, so use them to carry your own correlation IDs. */
1894
+ tags?: string | string[];
1895
+ /** Scalar and structured automation arguments. */
1896
+ input?: Record<string, unknown>;
1897
+ /** File inputs as ingress references (`{ "$fileId": "file_..." }` or `{ "$inline": { filename, mimeType, base64 } }`). Upload bytes via multipart `files.<fieldName>` parts instead. */
1898
+ files?: Record<string, {
1899
+ /** Reusable file-pool id to materialize */
1900
+ $fileId: string;
1901
+ } | {
1902
+ $inline: {
1903
+ /** Original filename for the materialized artifact */
1904
+ filename: string;
1905
+ /** MIME type for the materialized artifact */
1906
+ mimeType: string;
1907
+ /** Base64-encoded file bytes */
1908
+ base64: string;
1909
+ };
1910
+ } | Array<{
1911
+ /** Reusable file-pool id to materialize */
1912
+ $fileId: string;
1913
+ } | {
1914
+ $inline: {
1915
+ /** Original filename for the materialized artifact */
1916
+ filename: string;
1917
+ /** MIME type for the materialized artifact */
1918
+ mimeType: string;
1919
+ /** Base64-encoded file bytes */
1920
+ base64: string;
1921
+ };
1922
+ }>>;
1923
+ /** Per-step output overrides. Workflow runs only. */
1924
+ overrides?: {
1925
+ steps?: Record<string, Record<string, unknown>>;
1926
+ };
1927
+ /** Caller-supplied run metadata. */
1928
+ metadata?: Record<string, unknown>;
1929
+ };
1930
+ export type RunStep = {
1931
+ /** Step id: read it in full at GET /runs/{id}/steps/{stepId}. */
1932
+ id: string;
1933
+ /** The run the step ran in (a child run for an invoke). */
1934
+ runId: string;
1935
+ /** The step name in the workflow. */
1936
+ name: string;
1937
+ type: string | null;
1938
+ action: string | null;
1939
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'skipped' | 'cancelled';
1940
+ /** Retries before this attempt (0 for the first). */
1941
+ attempt: number;
1942
+ order: number | null;
1943
+ startedAt: string | null;
1944
+ completedAt: string | null;
1945
+ durationMs: number | null;
1946
+ /** The error, cut to 10 KiB (`errorTruncated`). */
1947
+ error: string | null;
1948
+ errorTruncated: boolean;
1949
+ skippedReason: string | null;
1950
+ };
1951
+ export type RunStepDetail = {
1952
+ /** Step id: read it in full at GET /runs/{id}/steps/{stepId}. */
1953
+ id: string;
1954
+ /** The run the step ran in (a child run for an invoke). */
1955
+ runId: string;
1956
+ /** The step name in the workflow. */
1957
+ name: string;
1958
+ type: string | null;
1959
+ action: string | null;
1960
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'skipped' | 'cancelled';
1961
+ /** Retries before this attempt (0 for the first). */
1962
+ attempt: number;
1963
+ order: number | null;
1964
+ startedAt: string | null;
1965
+ completedAt: string | null;
1966
+ durationMs: number | null;
1967
+ /** The error, cut to 10 KiB (`errorTruncated`). */
1968
+ error: string | null;
1969
+ errorTruncated: boolean;
1970
+ skippedReason: string | null;
1971
+ /** The step's resolved input. */
1972
+ input: unknown;
1973
+ /** The step's output (the workflow's own shape). */
1974
+ output: unknown;
1975
+ /** What a code step printed, per attempt (masked and trimmed). */
1976
+ attemptLogs: Array<{
1977
+ attempt: number;
1978
+ state: 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'skipped' | 'cancelled';
1979
+ logs: unknown;
1980
+ }>;
1981
+ /** The model and provider of each distinct LLM call of the step. */
1982
+ models: Array<{
1983
+ model: string;
1984
+ provider: string | null;
1985
+ }>;
1986
+ };
1987
+ export type RunTiming = {
1988
+ createdAt: string;
1989
+ startedAt: string | null;
1990
+ completedAt: string | null;
1991
+ durationMs: number | null;
1992
+ /** Of the time since `startedAt`, how long the run waited for a code sandbox because all were busy (the ongoing wait included). Part of `durationMs`; 0 when it never waited. */
1993
+ sandboxWaitMs: number;
1994
+ /** True while the run is back in the queue for a code sandbox; its status stays `running`. */
1995
+ waitingForSandbox: boolean;
1996
+ /** When the user requested cancel; status may still be `running` until the worker stops. */
1997
+ cancelRequestedAt: string | null;
1998
+ };
1999
+ export type RunTraceEvent = {
2000
+ /** Event type when present. Agent traces mirror trace.jsonl events; workflow traces use execution phase or step records. */
2001
+ type?: string;
2002
+ /** Workflow execution phase, when present. */
2003
+ phase?: string;
2004
+ /** Workflow step name, when present. */
2005
+ stepName?: string;
2006
+ /** Event or execution status, when present. */
2007
+ status?: string;
2008
+ /** Event start timestamp. */
2009
+ startedAt?: string | null;
2010
+ /** Event completion timestamp. */
2011
+ completedAt?: string | null;
2012
+ /** Human-readable event message. */
2013
+ message?: string | null;
2014
+ [key: string]: unknown;
2015
+ };
2016
+ export type RunTraceResponse = {
2017
+ /** Chronological trace events. Workflow runs return observability phases or step executions; agent runs return parsed trace.jsonl events. */
2018
+ data: RunTraceEvent[];
2019
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
2020
+ nextCursor: string | null;
2021
+ };
2022
+ export type RunTrigger = {
2023
+ type: 'api' | 'cli' | 'manual' | 'webhook' | 'email' | 'eval' | null;
2024
+ by: {
2025
+ id: string;
2026
+ name: string | null;
2027
+ email: string;
2028
+ } | null;
2029
+ /** Inbound email trigger details (agent runs, `expand=input` not required). */
2030
+ email?: unknown;
2031
+ };
2032
+ export type RunUsage = {
2033
+ tokens: {
2034
+ input: number | null;
2035
+ output: number | null;
2036
+ cacheRead: number | null;
2037
+ cacheWrite: number | null;
2038
+ };
2039
+ creditsCharged: number | null;
2040
+ durationMs: number | null;
2041
+ /** LLM call count (workflow runs only). */
2042
+ llmCallCount?: number;
2043
+ /** OCR pages processed (workflow runs only). */
2044
+ ocrPagesProcessed?: number;
2045
+ /** Agent conversation turns (agent runs only). */
2046
+ agentTurns?: number | null;
2047
+ };
2048
+ export type Template = {
2049
+ /** Stable logical template id (tmpl_…). */
2050
+ id: string;
2051
+ name: string;
2052
+ description?: string | null;
2053
+ filename: string;
2054
+ format: 'docx' | 'xlsx';
2055
+ mimeType: string;
2056
+ size?: number | null;
2057
+ sha256?: string | null;
2058
+ tokens: Array<{
2059
+ name: string;
2060
+ path?: string[];
2061
+ kind?: 'variable' | 'loop';
2062
+ type?: 'string' | 'number' | 'date' | 'boolean' | 'array' | 'object';
2063
+ required?: boolean;
2064
+ description?: string;
2065
+ }>;
2066
+ grammar: {
2067
+ syntax: string;
2068
+ tokenDiscovery: boolean;
2069
+ capabilities: string[];
2070
+ };
2071
+ currentRevision?: TemplateRevision | null;
2072
+ createdAt: string;
2073
+ updatedAt?: string | null;
2074
+ };
2075
+ export type TemplateCreateBody = {
2076
+ /** Reusable file id produced by the direct file upload flow. It is consumed as upload transport, not exposed as template identity. */
2077
+ fileId: string;
2078
+ name?: string;
2079
+ description?: string;
2080
+ };
2081
+ export type TemplateList = {
2082
+ data: Template[];
2083
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
2084
+ nextCursor: string | null;
2085
+ };
2086
+ export type TemplateReplaceBody = {
2087
+ /** Reusable file id produced by the direct file upload flow. It is consumed as upload transport, not exposed as template identity. */
2088
+ fileId: string;
2089
+ };
2090
+ export type TemplateRevision = {
2091
+ /** Immutable template revision id (tmpr_…). */
2092
+ id: string;
2093
+ number: number;
2094
+ sha256: string;
2095
+ createdAt: string;
2096
+ };
2097
+ export type TestEmailServerResponse = {
2098
+ ok: true;
2099
+ transport: 'resend' | 'smtp';
2100
+ messageId: string;
2101
+ } | {
2102
+ ok: false;
2103
+ error: string;
2104
+ };
2105
+ export type Variable = {
2106
+ id: string;
2107
+ name: string;
2108
+ type: 'string' | 'number' | 'boolean';
2109
+ secret: boolean;
2110
+ /** The value; always null for a secret (secrets are write-only). */
2111
+ value: string | null;
2112
+ description: string | null;
2113
+ /** organization: every project of the organization; project: one project. */
2114
+ scope: 'organization' | 'project';
2115
+ project: {
2116
+ id: string;
2117
+ slug: string;
2118
+ } | null;
2119
+ updatedAt: string;
2120
+ updatedBy: string | null;
2121
+ };
2122
+ export type VariableList = {
2123
+ data: Variable[];
2124
+ /** Pass it as `cursor` to read the next page. Null on the last page. */
2125
+ nextCursor: string | null;
2126
+ };
2127
+ export type VariableSetBody = {
2128
+ /** Project slug or id; absent or null: organization-wide. */
2129
+ project?: string | null;
2130
+ /** The value. For a secret it is stored encrypted and never returned. Send it in the body, never in a URL. */
2131
+ value: string;
2132
+ /** Store it as a secret. Default false for a new variable; kept on a replace. */
2133
+ secret?: boolean;
2134
+ /** Default string for a new variable; kept on a replace. Secrets are strings. */
2135
+ type?: 'string' | 'number' | 'boolean';
2136
+ description?: string | null;
2137
+ };
2138
+ export type VariableSetResponse = {
2139
+ id: string;
2140
+ name: string;
2141
+ type: 'string' | 'number' | 'boolean';
2142
+ secret: boolean;
2143
+ /** The value; always null for a secret (secrets are write-only). */
2144
+ value: string | null;
2145
+ description: string | null;
2146
+ /** organization: every project of the organization; project: one project. */
2147
+ scope: 'organization' | 'project';
2148
+ project: {
2149
+ id: string;
2150
+ slug: string;
2151
+ } | null;
2152
+ updatedAt: string;
2153
+ updatedBy: string | null;
2154
+ /** The variable did not exist before. */
2155
+ created: boolean;
2156
+ /** Something changed (false when it was already so). */
2157
+ changed: boolean;
2158
+ };
2159
+ export type WorkflowEvaluatorConfig = {
2160
+ evaluators: unknown[];
2161
+ passThreshold: number;
2162
+ };
2163
+ export type WorkflowEvaluatorConfigResponse = {
2164
+ automationId: string;
2165
+ kind: 'workflow';
2166
+ /** True when evaluators are versioned in workflow source. */
2167
+ readOnly?: boolean;
2168
+ /** Workflow evaluator configuration YAML. */
2169
+ yaml: string;
2170
+ /** A workflow written with the SDK: its evaluator plan from workflow.ts (.defineEvaluator() and .defineEvalPass()), the shape an agent has. Its YAML configuration is then empty. */
2171
+ evaluation?: AgentEvaluation | null;
2172
+ config: WorkflowEvaluatorConfig;
2173
+ };
2174
+ export interface StatusOptions {
2175
+ /** false skips the environments (no Git host calls). Default true. */
2176
+ environments?: boolean;
2177
+ /** Project slug or id; defaults to the client project. */
2178
+ project?: string;
2179
+ signal?: AbortSignal;
2180
+ }
2181
+ export interface AutomationsListOptions {
2182
+ /** Substring match against the name, title or description */
2183
+ search?: string;
2184
+ /** Only workflows or only agents. */
2185
+ kind?: 'workflow' | 'agent';
2186
+ /** Maximum number of automations to return. */
2187
+ limit?: number;
2188
+ /** The `nextCursor` of the page before. */
2189
+ cursor?: string;
2190
+ /** Project slug or id; defaults to the client project. */
2191
+ project?: string;
2192
+ signal?: AbortSignal;
2193
+ }
2194
+ export interface AutomationsGetOptions {
2195
+ signal?: AbortSignal;
2196
+ }
2197
+ export interface RunsListOptions {
2198
+ /** Only runs carrying any of these tags (exact, case-sensitive). Repeat the key per tag. */
2199
+ tag?: string[];
2200
+ /** Only workflow runs or only agent runs. */
2201
+ kind?: 'workflow' | 'agent';
2202
+ /** Only runs of these automations, by name. With `project`, only that project's. */
2203
+ automation?: string[];
2204
+ /** Only runs that stand in one of these states. */
2205
+ state?: Array<'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled'>;
2206
+ /** Only runs started by one of these triggers. */
2207
+ trigger?: Array<'api' | 'cli' | 'manual' | 'webhook' | 'email' | 'eval'>;
2208
+ /** Only runs these users started (user ids), or `__system__` for runs no user started. */
2209
+ triggeredBy?: string[];
2210
+ batchId?: string;
2211
+ exampleId?: string;
2212
+ exampleIdContains?: string;
2213
+ /** Only runs linked to a dataset example (eval and example runs). */
2214
+ hasExample?: boolean;
2215
+ createdAfter?: string;
2216
+ createdBefore?: string;
2217
+ completedAfter?: string;
2218
+ completedBefore?: string;
2219
+ limit?: number;
2220
+ /** Only these runs (at most 100). */
2221
+ ids?: string[];
2222
+ /** false leaves out the runs of experiments. Default true. */
2223
+ experiments?: boolean;
2224
+ reviewStatus?: Array<'open' | 'closed' | 'wont_fix'>;
2225
+ /** `nit`: reviewed without a verdict. */
2226
+ reviewVerdict?: Array<'correct' | 'incorrect' | 'nit'>;
2227
+ hasReview?: boolean;
2228
+ noReview?: boolean;
2229
+ hasCorrections?: boolean;
2230
+ reviewNoteContains?: string;
2231
+ reviewCreatedAfter?: string;
2232
+ reviewCreatedBefore?: string;
2233
+ reviewUpdatedAfter?: string;
2234
+ reviewUpdatedBefore?: string;
2235
+ reviewClosedAfter?: string;
2236
+ reviewClosedBefore?: string;
2237
+ /** Only runs since the newest closed review. */
2238
+ sinceLastClosed?: boolean;
2239
+ /** Keep runs whose `sampleRank` is below this threshold (0–1). Pages may return fewer than `limit` rows when filtered. */
2240
+ sampleRate?: number;
2241
+ /** The `nextCursor` of the page before. */
2242
+ cursor?: string;
2243
+ /** Project slug or id; defaults to the client project. */
2244
+ project?: string;
2245
+ signal?: AbortSignal;
2246
+ }
2247
+ export interface RunsGetOptions {
2248
+ /** More sections of the run. Ended runs always include top-level output, artifacts, and error. */
2249
+ expand?: Array<'input' | 'usage' | 'steps' | 'debug'>;
2250
+ /** Wait until the record is final (default false). */
2251
+ wait?: boolean;
2252
+ /** How long to wait, in milliseconds (default 30 minutes). */
2253
+ timeoutMs?: number;
2254
+ signal?: AbortSignal;
2255
+ }
2256
+ export interface RunsCancelOptions {
2257
+ signal?: AbortSignal;
2258
+ }
2259
+ export interface RunsRerunOptions {
2260
+ /** Version for the new run: `live` (default), `original` (the source run's version), a release (`1.2.3`; a withdrawn release still resolves by its exact number), a range of releases (`^1`, `1.2.x`, `~1.2.3`; the highest release that is not withdrawn), or a 40-character commit sha. */
2261
+ version?: string;
2262
+ /** Wait until the record is final (default true). */
2263
+ wait?: boolean;
2264
+ /** How long to wait, in milliseconds (default 30 minutes). */
2265
+ timeoutMs?: number;
2266
+ signal?: AbortSignal;
2267
+ }
2268
+ export interface ExperimentsListOptions {
2269
+ /** Maximum number of experiment batches to return. */
2270
+ limit?: number;
2271
+ /** Filter to experiment batches created at or after this date or relative date. */
2272
+ createdAfter?: string;
2273
+ /** Filter to experiment batches created at or before this date or relative date. */
2274
+ createdBefore?: string;
2275
+ /** Only experiments whose runs carry this tag (workflow experiments). */
2276
+ tag?: string;
2277
+ /** The `nextCursor` of the page before. */
2278
+ cursor?: string;
2279
+ signal?: AbortSignal;
2280
+ }
2281
+ export interface ReleasesListOptions {
2282
+ /** Project slug or id; defaults to the client project. */
2283
+ project?: string;
2284
+ signal?: AbortSignal;
2285
+ }
2286
+ export interface ReleasesGetOptions {
2287
+ /** Project slug or id; defaults to the client project. */
2288
+ project?: string;
2289
+ signal?: AbortSignal;
2290
+ }
2291
+ export interface ReleasesWithdrawOptions {
2292
+ /** Project slug or id; defaults to the client project. */
2293
+ project?: string;
2294
+ signal?: AbortSignal;
2295
+ }
2296
+ export interface ReleasesRestoreOptions {
2297
+ /** Project slug or id; defaults to the client project. */
2298
+ project?: string;
2299
+ signal?: AbortSignal;
2300
+ }
2301
+ export interface DatasetsReviewsCreateOptions {
2302
+ title: string;
2303
+ /** Note shown to the reviewer for the whole request. */
2304
+ instructions?: string | null;
2305
+ /** Expected-output paths to highlight. Other fields stay normal unless listed in ignoredFields. */
2306
+ focusFields?: DatasetReviewFocusField[];
2307
+ /** Expected-output paths reviewers can skip. Shown muted as not required. Prefixes apply to nested leaves. */
2308
+ ignoredFields?: string[];
2309
+ /** Optional per-example and per-field notes seeded as commented events at create time. */
2310
+ itemNotes?: DatasetReviewCreateItemNote[];
2311
+ exampleNames: string[];
2312
+ status?: 'draft' | 'open' | 'paused';
2313
+ signal?: AbortSignal;
2314
+ }
2315
+ export interface DatasetsReviewsListOptions {
2316
+ /** Only reviews in one of these statuses. */
2317
+ status?: Array<'draft' | 'open' | 'paused' | 'closed' | 'cancelled'>;
2318
+ limit?: number;
2319
+ /** The `nextCursor` of the page before. */
2320
+ cursor?: string;
2321
+ /** Project slug or id; defaults to the client project. */
2322
+ project?: string;
2323
+ signal?: AbortSignal;
2324
+ }
2325
+ export interface ReviewsListOptions {
2326
+ automationId?: string;
2327
+ waitingBefore?: string;
2328
+ limit?: number;
2329
+ /** The `nextCursor` of the page before. */
2330
+ cursor?: string;
2331
+ /** Project slug or id; defaults to the client project. */
2332
+ project?: string;
2333
+ signal?: AbortSignal;
2334
+ }
2335
+ export interface ReviewsGetOptions {
2336
+ signal?: AbortSignal;
2337
+ }
2338
+ export interface ReviewsSetOptions {
2339
+ expectedVersion: number;
2340
+ idempotencyKey: string;
2341
+ confirmed?: boolean;
2342
+ signal?: AbortSignal;
2343
+ }
2344
+ export interface ReviewsApproveOptions {
2345
+ expectedVersion: number;
2346
+ signal?: AbortSignal;
2347
+ }
2348
+ export interface ReviewsRejectOptions {
2349
+ expectedVersion: number;
2350
+ idempotencyKey: string;
2351
+ reason: string;
2352
+ signal?: AbortSignal;
2353
+ }
2354
+ export interface ReviewsDownloadOptions {
2355
+ signal?: AbortSignal;
2356
+ }
2357
+ export interface VariablesListOptions {
2358
+ /** Only organization-wide or only project variables (default all). */
2359
+ scope?: 'all' | 'organization' | 'project';
2360
+ /** Project slug or id; defaults to the client project. */
2361
+ project?: string;
2362
+ signal?: AbortSignal;
2363
+ }
2364
+ export interface VariablesSetOptions {
2365
+ /** The value. For a secret it is stored encrypted and never returned. Send it in the body, never in a URL. */
2366
+ value: string;
2367
+ /** Store it as a secret. Default false for a new variable; kept on a replace. */
2368
+ secret?: boolean;
2369
+ /** Default string for a new variable; kept on a replace. Secrets are strings. */
2370
+ type?: 'string' | 'number' | 'boolean';
2371
+ description?: string | null;
2372
+ /** Project slug or id; defaults to the client project. */
2373
+ project?: string;
2374
+ signal?: AbortSignal;
2375
+ }
2376
+ export interface VariablesDeleteOptions {
2377
+ /** Project slug or id; defaults to the client project. */
2378
+ project?: string;
2379
+ signal?: AbortSignal;
2380
+ }
2381
+ export interface ProjectsListOptions {
2382
+ /** true: archived projects too. */
2383
+ archived?: boolean;
2384
+ signal?: AbortSignal;
2385
+ }
2386
+ export interface ModelsListOptions {
2387
+ /** Return only models that support this capability (`text`, `vision`, or `ocr`). */
2388
+ capability?: 'text' | 'vision' | 'ocr';
2389
+ signal?: AbortSignal;
2390
+ }
2391
+ export interface TemplatesListOptions {
2392
+ limit?: number;
2393
+ /** The `nextCursor` of the page before. */
2394
+ cursor?: string;
2395
+ signal?: AbortSignal;
2396
+ }
2397
+ export interface TemplatesGetOptions {
2398
+ signal?: AbortSignal;
2399
+ }
2400
+ export interface TemplatesDownloadOptions {
2401
+ /** Immutable revision id (tmpr_…). Omit for the current content. */
2402
+ revisionId?: string;
2403
+ signal?: AbortSignal;
2404
+ }
2405
+ export interface TemplatesDeleteOptions {
2406
+ signal?: AbortSignal;
2407
+ }
2408
+ export interface EmailServersListOptions {
2409
+ /** Maximum number of email servers to return (1–100). */
2410
+ limit?: number;
2411
+ /** The `nextCursor` of the page before. */
2412
+ cursor?: string;
2413
+ signal?: AbortSignal;
2414
+ }
2415
+ export interface EmailServersGetOptions {
2416
+ signal?: AbortSignal;
2417
+ }
2418
+ export interface EmailServersTestOptions {
2419
+ to: string;
2420
+ signal?: AbortSignal;
2421
+ }
2422
+ export interface EmailServersDeleteOptions {
2423
+ signal?: AbortSignal;
2424
+ }
2425
+ export interface RoutesListOptions {
2426
+ signal?: AbortSignal;
2427
+ }
2428
+ export interface RoutesGetOptions {
2429
+ signal?: AbortSignal;
2430
+ }
2431
+ export interface RoutesSetOptions {
2432
+ /** true: validate and return what would change; nothing is written. */
2433
+ dryRun?: boolean;
2434
+ /** For each environment, in order from the first: name, credential, repository, branch, bot, and optionally folder and acceptsFrom. */
2435
+ environments: Array<Record<string, unknown>>;
2436
+ signal?: AbortSignal;
2437
+ }
2438
+ export interface RoutesDeleteOptions {
2439
+ /** true: validate and return what would change; nothing is written. */
2440
+ dryRun?: boolean;
2441
+ signal?: AbortSignal;
2442
+ }
2443
+ export interface FilesGetOptions {
2444
+ signal?: AbortSignal;
2445
+ }
2446
+ export interface FilesDownloadOptions {
2447
+ signal?: AbortSignal;
2448
+ }
2449
+ export interface FilesDeleteOptions {
2450
+ signal?: AbortSignal;
2451
+ }
2452
+ /** Options of `client.api(method, path, options)`. */
2453
+ export interface ApiCallOptions {
2454
+ query?: Record<string, string | number | boolean | undefined>;
2455
+ body?: unknown;
2456
+ signal?: AbortSignal;
2457
+ }