@shipfox/api-agent-access-dto 21.0.0 → 21.2.0

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 (49) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-type.log +0 -1
  3. package/CHANGELOG.md +19 -0
  4. package/dist/index.d.ts +4 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +4 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/schemas/diagnostic-tools.d.ts +3 -1
  9. package/dist/schemas/diagnostic-tools.d.ts.map +1 -1
  10. package/dist/schemas/diagnostic-tools.js +7 -8
  11. package/dist/schemas/diagnostic-tools.js.map +1 -1
  12. package/dist/schemas/log-tools.d.ts +215 -0
  13. package/dist/schemas/log-tools.d.ts.map +1 -0
  14. package/dist/schemas/log-tools.js +224 -0
  15. package/dist/schemas/log-tools.js.map +1 -0
  16. package/dist/schemas/paged-tools.d.ts.map +1 -1
  17. package/dist/schemas/paged-tools.js +1 -6
  18. package/dist/schemas/paged-tools.js.map +1 -1
  19. package/dist/schemas/primitives.d.ts +5 -0
  20. package/dist/schemas/primitives.d.ts.map +1 -0
  21. package/dist/schemas/primitives.js +9 -0
  22. package/dist/schemas/primitives.js.map +1 -0
  23. package/dist/schemas/workflow-diagnostics.d.ts +862 -0
  24. package/dist/schemas/workflow-diagnostics.d.ts.map +1 -0
  25. package/dist/schemas/workflow-diagnostics.js +876 -0
  26. package/dist/schemas/workflow-diagnostics.js.map +1 -0
  27. package/dist/schemas/workflow-execution-events.d.ts +272 -0
  28. package/dist/schemas/workflow-execution-events.d.ts.map +1 -0
  29. package/dist/schemas/workflow-execution-events.js +250 -0
  30. package/dist/schemas/workflow-execution-events.js.map +1 -0
  31. package/dist/schemas/workflow-tools.d.ts +1305 -0
  32. package/dist/schemas/workflow-tools.d.ts.map +1 -0
  33. package/dist/schemas/workflow-tools.js +938 -0
  34. package/dist/schemas/workflow-tools.js.map +1 -0
  35. package/dist/tsconfig.test.tsbuildinfo +1 -1
  36. package/package.json +3 -2
  37. package/src/index.ts +113 -0
  38. package/src/schemas/diagnostic-tools.test.ts +43 -0
  39. package/src/schemas/diagnostic-tools.ts +12 -14
  40. package/src/schemas/log-tools.ts +209 -0
  41. package/src/schemas/paged-tools.ts +1 -10
  42. package/src/schemas/primitives.ts +14 -0
  43. package/src/schemas/workflow-diagnostics.test.ts +277 -0
  44. package/src/schemas/workflow-diagnostics.ts +693 -0
  45. package/src/schemas/workflow-execution-events.test.ts +126 -0
  46. package/src/schemas/workflow-execution-events.ts +217 -0
  47. package/src/schemas/workflow-tools.test.ts +202 -0
  48. package/src/schemas/workflow-tools.ts +738 -0
  49. package/tsconfig.build.tsbuildinfo +1 -1
@@ -0,0 +1,938 @@
1
+ import { z } from 'zod';
2
+ import { AGENT_ACCESS_PAGE_LIMIT_MAX, AGENT_ACCESS_TEXT_MAX_BYTES } from './paged-tools.js';
3
+ import { dateTimeSchema, idSchema, utf8CappedString } from './primitives.js';
4
+ export const AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX = 2_147_483_647;
5
+ export const AGENT_ACCESS_WORKFLOW_RUN_ATTEMPT_PAGE_LIMIT = 25;
6
+ export const AGENT_ACCESS_WORKFLOW_JOB_PAGE_LIMIT = 100;
7
+ export const AGENT_ACCESS_WORKFLOW_EXECUTION_PAGE_LIMIT = 25;
8
+ export const AGENT_ACCESS_WORKFLOW_STEP_PAGE_LIMIT = 100;
9
+ export const AGENT_ACCESS_WORKFLOW_STEP_ATTEMPT_PAGE_LIMIT = 25;
10
+ export const AGENT_ACCESS_WORKFLOW_EXECUTION_COUNT_MAX = 100;
11
+ const textSchema = utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES);
12
+ const attemptSchema = z.number().int().min(1).max(AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX);
13
+ const pageInput = (defaultLimit)=>({
14
+ limit: z.number().int().min(1).max(AGENT_ACCESS_PAGE_LIMIT_MAX).default(defaultLimit),
15
+ cursor: z.string().min(1).optional()
16
+ });
17
+ export const getWorkflowRunInputSchema = z.object({
18
+ run_id: idSchema,
19
+ attempt: attemptSchema.optional()
20
+ }).strict();
21
+ export const listWorkflowRunAttemptsInputSchema = z.object({
22
+ run_id: idSchema,
23
+ ...pageInput(AGENT_ACCESS_WORKFLOW_RUN_ATTEMPT_PAGE_LIMIT)
24
+ }).strict();
25
+ export const listWorkflowRunJobsInputSchema = z.object({
26
+ run_id: idSchema,
27
+ attempt: attemptSchema,
28
+ ...pageInput(AGENT_ACCESS_WORKFLOW_JOB_PAGE_LIMIT)
29
+ }).strict();
30
+ export const getWorkflowJobInputSchema = z.object({
31
+ job_id: idSchema,
32
+ execution_id: idSchema.optional()
33
+ }).strict();
34
+ export const listWorkflowJobExecutionsInputSchema = z.object({
35
+ job_id: idSchema,
36
+ ...pageInput(AGENT_ACCESS_WORKFLOW_EXECUTION_PAGE_LIMIT)
37
+ }).strict();
38
+ export const listWorkflowExecutionStepsInputSchema = z.object({
39
+ job_id: idSchema,
40
+ execution_id: idSchema,
41
+ ...pageInput(AGENT_ACCESS_WORKFLOW_STEP_PAGE_LIMIT)
42
+ }).strict();
43
+ export const listWorkflowStepAttemptsInputSchema = z.object({
44
+ step_id: idSchema,
45
+ ...pageInput(AGENT_ACCESS_WORKFLOW_STEP_ATTEMPT_PAGE_LIMIT)
46
+ }).strict();
47
+ const workflowRunStatusSchema = z.enum([
48
+ 'pending',
49
+ 'running',
50
+ 'succeeded',
51
+ 'failed',
52
+ 'cancelled'
53
+ ]);
54
+ const workflowRunOriginSchema = z.enum([
55
+ 'synced',
56
+ 'dev'
57
+ ]);
58
+ const workflowRunRerunModeSchema = z.enum([
59
+ 'all',
60
+ 'failed'
61
+ ]);
62
+ const jobStatusSchema = z.enum([
63
+ 'pending',
64
+ 'running',
65
+ 'succeeded',
66
+ 'failed',
67
+ 'cancelled',
68
+ 'skipped'
69
+ ]);
70
+ const jobStatusReasonSchema = z.enum([
71
+ 'dependency_not_completed',
72
+ 'condition_false',
73
+ 'default_gate_rejected',
74
+ 'condition_rejected',
75
+ 'condition_errored',
76
+ 'user_cancelled',
77
+ 'run_cancelled',
78
+ 'timed_out',
79
+ 'runner_lost',
80
+ 'output_too_large',
81
+ 'step_failed',
82
+ 'unknown',
83
+ 'output_invalid'
84
+ ]);
85
+ const jobModeSchema = z.enum([
86
+ 'one_shot',
87
+ 'listening'
88
+ ]);
89
+ const listenerStatusSchema = z.enum([
90
+ 'inactive',
91
+ 'listening',
92
+ 'resolved'
93
+ ]);
94
+ const executionStatusSchema = z.enum([
95
+ 'pending',
96
+ 'running',
97
+ 'succeeded',
98
+ 'failed',
99
+ 'cancelled'
100
+ ]);
101
+ const stepStatusSchema = jobStatusSchema;
102
+ const stepTypeSchema = z.enum([
103
+ 'setup',
104
+ 'run',
105
+ 'agent',
106
+ 'checkout',
107
+ 'tool'
108
+ ]);
109
+ const stepStatusReasonSchema = z.enum([
110
+ 'default_gate_rejected',
111
+ 'condition_rejected',
112
+ 'condition_errored'
113
+ ]);
114
+ const boundedExecutionCountSchema = z.union([
115
+ z.number().int().nonnegative().max(AGENT_ACCESS_WORKFLOW_EXECUTION_COUNT_MAX),
116
+ z.literal('100+')
117
+ ]);
118
+ const workflowRunAttemptResultSchema = z.object({
119
+ id: idSchema,
120
+ workflow_run_id: idSchema,
121
+ attempt: attemptSchema,
122
+ status: workflowRunStatusSchema,
123
+ created_at: dateTimeSchema,
124
+ started_at: dateTimeSchema.nullable(),
125
+ finished_at: dateTimeSchema.nullable(),
126
+ rerun_mode: workflowRunRerunModeSchema.nullable()
127
+ }).strict();
128
+ const workflowRunDevSourceSchema = z.object({
129
+ ref: textSchema,
130
+ commit: textSchema,
131
+ config_path: textSchema,
132
+ initiated_by_user_id: idSchema,
133
+ replay_of_event_id: idSchema.nullable()
134
+ }).strict();
135
+ const workflowRunTriggerReferenceSchema = z.object({
136
+ repository: textSchema.nullable(),
137
+ ref: textSchema.nullable(),
138
+ commit: textSchema.nullable(),
139
+ actor: textSchema.nullable()
140
+ }).strict();
141
+ const jobExecutionSummarySchema = z.object({
142
+ id: idSchema,
143
+ sequence: z.number().int().positive(),
144
+ name: textSchema,
145
+ status: executionStatusSchema,
146
+ display_status: executionStatusSchema,
147
+ status_reason: jobStatusReasonSchema.nullable(),
148
+ status_reason_message: textSchema.nullable(),
149
+ queued_at: dateTimeSchema.nullable(),
150
+ started_at: dateTimeSchema.nullable(),
151
+ finished_at: dateTimeSchema.nullable(),
152
+ timed_out_at: dateTimeSchema.nullable(),
153
+ updated_at: dateTimeSchema
154
+ }).strict();
155
+ const jobExecutionStatusCountsSchema = z.object({
156
+ pending: boundedExecutionCountSchema,
157
+ running: boundedExecutionCountSchema,
158
+ succeeded: boundedExecutionCountSchema,
159
+ failed: boundedExecutionCountSchema,
160
+ cancelled: boundedExecutionCountSchema
161
+ }).strict();
162
+ const workflowJobSummarySchema = z.object({
163
+ id: idSchema,
164
+ key: textSchema,
165
+ name: textSchema.nullable(),
166
+ position: z.number().int().nonnegative(),
167
+ status: jobStatusSchema,
168
+ status_reason: jobStatusReasonSchema.nullable(),
169
+ mode: jobModeSchema,
170
+ listener_status: listenerStatusSchema,
171
+ carried_over: z.boolean(),
172
+ execution_count: boundedExecutionCountSchema,
173
+ execution_status_counts: jobExecutionStatusCountsSchema,
174
+ default_execution: jobExecutionSummarySchema.nullable()
175
+ }).strict();
176
+ const workflowRunJobStatusCountSchema = z.object({
177
+ status: jobStatusSchema,
178
+ count: z.number().int().positive()
179
+ }).strict();
180
+ /** Compact run data used to start traversal; it deliberately has no jobs field. */ export const getWorkflowRunResultSchema = z.object({
181
+ id: idSchema,
182
+ project_id: idSchema,
183
+ definition_id: idSchema,
184
+ number: z.number().int().positive(),
185
+ name: textSchema,
186
+ workflow_name: textSchema,
187
+ status: workflowRunStatusSchema,
188
+ origin: workflowRunOriginSchema,
189
+ dev_source: workflowRunDevSourceSchema.nullable(),
190
+ trigger_provider: textSchema.nullable(),
191
+ trigger_source: textSchema,
192
+ trigger_event: textSchema,
193
+ trigger_reference: workflowRunTriggerReferenceSchema.nullable(),
194
+ created_at: dateTimeSchema,
195
+ started_at: dateTimeSchema.nullable(),
196
+ finished_at: dateTimeSchema.nullable(),
197
+ attempt: workflowRunAttemptResultSchema,
198
+ job_status_counts: z.array(workflowRunJobStatusCountSchema),
199
+ has_started_job_execution: z.boolean()
200
+ }).strict();
201
+ export const listWorkflowRunAttemptsResultSchema = z.object({
202
+ attempts: z.array(workflowRunAttemptResultSchema).max(AGENT_ACCESS_PAGE_LIMIT_MAX),
203
+ next_cursor: z.string().nullable()
204
+ }).strict();
205
+ export const listWorkflowRunJobsResultSchema = z.object({
206
+ workflow_run_id: idSchema,
207
+ workflow_run_attempt: attemptSchema,
208
+ jobs: z.array(workflowJobSummarySchema).max(AGENT_ACCESS_PAGE_LIMIT_MAX),
209
+ next_cursor: z.string().nullable(),
210
+ total: z.number().int().nonnegative().optional()
211
+ }).strict();
212
+ const selectedExecutionSummarySchema = jobExecutionSummarySchema.extend({
213
+ has_context: z.boolean()
214
+ }).strict();
215
+ export const getWorkflowJobResultSchema = z.object({
216
+ workflow_run_id: idSchema,
217
+ workflow_run_attempt: attemptSchema,
218
+ job: workflowJobSummarySchema,
219
+ selected_execution: selectedExecutionSummarySchema.nullable()
220
+ }).strict();
221
+ export const listWorkflowJobExecutionsResultSchema = z.object({
222
+ job_id: idSchema,
223
+ executions: z.array(jobExecutionSummarySchema).max(AGENT_ACCESS_PAGE_LIMIT_MAX),
224
+ next_cursor: z.string().nullable(),
225
+ total: boundedExecutionCountSchema.optional()
226
+ }).strict();
227
+ const workflowStepSummarySchema = z.object({
228
+ id: idSchema,
229
+ key: textSchema.nullable(),
230
+ name: textSchema,
231
+ type: stepTypeSchema,
232
+ position: z.number().int().nonnegative(),
233
+ status: stepStatusSchema,
234
+ status_reason: stepStatusReasonSchema.nullable(),
235
+ current_attempt: attemptSchema
236
+ }).strict();
237
+ export const listWorkflowExecutionStepsResultSchema = z.object({
238
+ job_id: idSchema,
239
+ execution_id: idSchema,
240
+ steps: z.array(workflowStepSummarySchema).max(AGENT_ACCESS_PAGE_LIMIT_MAX),
241
+ next_cursor: z.string().nullable(),
242
+ total: z.number().int().nonnegative().optional()
243
+ }).strict();
244
+ const workflowStepAttemptSummarySchema = z.object({
245
+ id: idSchema,
246
+ attempt: attemptSchema,
247
+ execution_order: z.number().int().positive(),
248
+ status: stepStatusSchema,
249
+ exit_code: z.number().int().nullable(),
250
+ started_at: dateTimeSchema,
251
+ finished_at: dateTimeSchema.nullable()
252
+ }).strict();
253
+ export const listWorkflowStepAttemptsResultSchema = z.object({
254
+ step_id: idSchema,
255
+ attempts: z.array(workflowStepAttemptSummarySchema).max(AGENT_ACCESS_PAGE_LIMIT_MAX),
256
+ next_cursor: z.string().nullable(),
257
+ total: z.number().int().nonnegative().optional()
258
+ }).strict();
259
+ const uuid = {
260
+ type: 'string',
261
+ format: 'uuid'
262
+ };
263
+ const dateTime = {
264
+ type: 'string',
265
+ format: 'date-time'
266
+ };
267
+ const text = {
268
+ type: 'string',
269
+ maxLength: AGENT_ACCESS_TEXT_MAX_BYTES
270
+ };
271
+ const nullable = (schema)=>({
272
+ anyOf: [
273
+ schema,
274
+ {
275
+ type: 'null'
276
+ }
277
+ ]
278
+ });
279
+ const pageInputJson = (defaultLimit)=>({
280
+ limit: {
281
+ type: 'integer',
282
+ minimum: 1,
283
+ maximum: AGENT_ACCESS_PAGE_LIMIT_MAX,
284
+ default: defaultLimit
285
+ },
286
+ cursor: {
287
+ type: 'string',
288
+ minLength: 1
289
+ }
290
+ });
291
+ export const getWorkflowRunInputJsonSchema = {
292
+ type: 'object',
293
+ properties: {
294
+ run_id: uuid,
295
+ attempt: {
296
+ type: 'integer',
297
+ minimum: 1,
298
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
299
+ }
300
+ },
301
+ required: [
302
+ 'run_id'
303
+ ],
304
+ additionalProperties: false
305
+ };
306
+ export const listWorkflowRunAttemptsInputJsonSchema = {
307
+ type: 'object',
308
+ properties: {
309
+ run_id: uuid,
310
+ ...pageInputJson(AGENT_ACCESS_WORKFLOW_RUN_ATTEMPT_PAGE_LIMIT)
311
+ },
312
+ required: [
313
+ 'run_id'
314
+ ],
315
+ additionalProperties: false
316
+ };
317
+ export const listWorkflowRunJobsInputJsonSchema = {
318
+ type: 'object',
319
+ properties: {
320
+ run_id: uuid,
321
+ attempt: {
322
+ type: 'integer',
323
+ minimum: 1,
324
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
325
+ },
326
+ ...pageInputJson(AGENT_ACCESS_WORKFLOW_JOB_PAGE_LIMIT)
327
+ },
328
+ required: [
329
+ 'run_id',
330
+ 'attempt'
331
+ ],
332
+ additionalProperties: false
333
+ };
334
+ export const getWorkflowJobInputJsonSchema = {
335
+ type: 'object',
336
+ properties: {
337
+ job_id: uuid,
338
+ execution_id: uuid
339
+ },
340
+ required: [
341
+ 'job_id'
342
+ ],
343
+ additionalProperties: false
344
+ };
345
+ export const listWorkflowJobExecutionsInputJsonSchema = {
346
+ type: 'object',
347
+ properties: {
348
+ job_id: uuid,
349
+ ...pageInputJson(AGENT_ACCESS_WORKFLOW_EXECUTION_PAGE_LIMIT)
350
+ },
351
+ required: [
352
+ 'job_id'
353
+ ],
354
+ additionalProperties: false
355
+ };
356
+ export const listWorkflowExecutionStepsInputJsonSchema = {
357
+ type: 'object',
358
+ properties: {
359
+ job_id: uuid,
360
+ execution_id: uuid,
361
+ ...pageInputJson(AGENT_ACCESS_WORKFLOW_STEP_PAGE_LIMIT)
362
+ },
363
+ required: [
364
+ 'job_id',
365
+ 'execution_id'
366
+ ],
367
+ additionalProperties: false
368
+ };
369
+ export const listWorkflowStepAttemptsInputJsonSchema = {
370
+ type: 'object',
371
+ properties: {
372
+ step_id: uuid,
373
+ ...pageInputJson(AGENT_ACCESS_WORKFLOW_STEP_ATTEMPT_PAGE_LIMIT)
374
+ },
375
+ required: [
376
+ 'step_id'
377
+ ],
378
+ additionalProperties: false
379
+ };
380
+ const workflowRunAttemptJsonSchema = {
381
+ type: 'object',
382
+ properties: {
383
+ id: uuid,
384
+ workflow_run_id: uuid,
385
+ attempt: {
386
+ type: 'integer',
387
+ minimum: 1,
388
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
389
+ },
390
+ status: {
391
+ type: 'string',
392
+ enum: [
393
+ 'pending',
394
+ 'running',
395
+ 'succeeded',
396
+ 'failed',
397
+ 'cancelled'
398
+ ]
399
+ },
400
+ created_at: dateTime,
401
+ started_at: nullable(dateTime),
402
+ finished_at: nullable(dateTime),
403
+ rerun_mode: nullable({
404
+ type: 'string',
405
+ enum: [
406
+ 'all',
407
+ 'failed'
408
+ ]
409
+ })
410
+ },
411
+ required: [
412
+ 'id',
413
+ 'workflow_run_id',
414
+ 'attempt',
415
+ 'status',
416
+ 'created_at',
417
+ 'started_at',
418
+ 'finished_at',
419
+ 'rerun_mode'
420
+ ],
421
+ additionalProperties: false
422
+ };
423
+ const devSourceJsonSchema = {
424
+ type: 'object',
425
+ properties: {
426
+ ref: text,
427
+ commit: text,
428
+ config_path: text,
429
+ initiated_by_user_id: uuid,
430
+ replay_of_event_id: nullable(uuid)
431
+ },
432
+ required: [
433
+ 'ref',
434
+ 'commit',
435
+ 'config_path',
436
+ 'initiated_by_user_id',
437
+ 'replay_of_event_id'
438
+ ],
439
+ additionalProperties: false
440
+ };
441
+ const triggerReferenceJsonSchema = {
442
+ type: 'object',
443
+ properties: {
444
+ repository: nullable(text),
445
+ ref: nullable(text),
446
+ commit: nullable(text),
447
+ actor: nullable(text)
448
+ },
449
+ required: [
450
+ 'repository',
451
+ 'ref',
452
+ 'commit',
453
+ 'actor'
454
+ ],
455
+ additionalProperties: false
456
+ };
457
+ const executionStatusJsonSchema = {
458
+ type: 'string',
459
+ enum: [
460
+ 'pending',
461
+ 'running',
462
+ 'succeeded',
463
+ 'failed',
464
+ 'cancelled'
465
+ ]
466
+ };
467
+ const boundedExecutionCountJsonSchema = {
468
+ anyOf: [
469
+ {
470
+ type: 'integer',
471
+ minimum: 0,
472
+ maximum: AGENT_ACCESS_WORKFLOW_EXECUTION_COUNT_MAX
473
+ },
474
+ {
475
+ const: '100+'
476
+ }
477
+ ]
478
+ };
479
+ const executionSummaryJsonSchema = {
480
+ type: 'object',
481
+ properties: {
482
+ id: uuid,
483
+ sequence: {
484
+ type: 'integer',
485
+ minimum: 1
486
+ },
487
+ name: text,
488
+ status: executionStatusJsonSchema,
489
+ display_status: executionStatusJsonSchema,
490
+ status_reason: nullable({
491
+ type: 'string',
492
+ enum: [
493
+ 'dependency_not_completed',
494
+ 'condition_false',
495
+ 'default_gate_rejected',
496
+ 'condition_rejected',
497
+ 'condition_errored',
498
+ 'user_cancelled',
499
+ 'run_cancelled',
500
+ 'timed_out',
501
+ 'runner_lost',
502
+ 'output_too_large',
503
+ 'step_failed',
504
+ 'unknown',
505
+ 'output_invalid'
506
+ ]
507
+ }),
508
+ status_reason_message: nullable(text),
509
+ queued_at: nullable(dateTime),
510
+ started_at: nullable(dateTime),
511
+ finished_at: nullable(dateTime),
512
+ timed_out_at: nullable(dateTime),
513
+ updated_at: dateTime
514
+ },
515
+ required: [
516
+ 'id',
517
+ 'sequence',
518
+ 'name',
519
+ 'status',
520
+ 'display_status',
521
+ 'status_reason',
522
+ 'status_reason_message',
523
+ 'queued_at',
524
+ 'started_at',
525
+ 'finished_at',
526
+ 'timed_out_at',
527
+ 'updated_at'
528
+ ],
529
+ additionalProperties: false
530
+ };
531
+ const executionCountsJsonSchema = {
532
+ type: 'object',
533
+ properties: {
534
+ pending: boundedExecutionCountJsonSchema,
535
+ running: boundedExecutionCountJsonSchema,
536
+ succeeded: boundedExecutionCountJsonSchema,
537
+ failed: boundedExecutionCountJsonSchema,
538
+ cancelled: boundedExecutionCountJsonSchema
539
+ },
540
+ required: [
541
+ 'pending',
542
+ 'running',
543
+ 'succeeded',
544
+ 'failed',
545
+ 'cancelled'
546
+ ],
547
+ additionalProperties: false
548
+ };
549
+ const jobStatusJsonSchema = {
550
+ type: 'string',
551
+ enum: [
552
+ 'pending',
553
+ 'running',
554
+ 'succeeded',
555
+ 'failed',
556
+ 'cancelled',
557
+ 'skipped'
558
+ ]
559
+ };
560
+ const jobReasonJsonSchema = nullable({
561
+ type: 'string',
562
+ enum: [
563
+ 'dependency_not_completed',
564
+ 'condition_false',
565
+ 'default_gate_rejected',
566
+ 'condition_rejected',
567
+ 'condition_errored',
568
+ 'user_cancelled',
569
+ 'run_cancelled',
570
+ 'timed_out',
571
+ 'runner_lost',
572
+ 'output_too_large',
573
+ 'step_failed',
574
+ 'unknown',
575
+ 'output_invalid'
576
+ ]
577
+ });
578
+ const jobSummaryJsonSchema = {
579
+ type: 'object',
580
+ properties: {
581
+ id: uuid,
582
+ key: text,
583
+ name: nullable(text),
584
+ position: {
585
+ type: 'integer',
586
+ minimum: 0
587
+ },
588
+ status: jobStatusJsonSchema,
589
+ status_reason: jobReasonJsonSchema,
590
+ mode: {
591
+ type: 'string',
592
+ enum: [
593
+ 'one_shot',
594
+ 'listening'
595
+ ]
596
+ },
597
+ listener_status: {
598
+ type: 'string',
599
+ enum: [
600
+ 'inactive',
601
+ 'listening',
602
+ 'resolved'
603
+ ]
604
+ },
605
+ carried_over: {
606
+ type: 'boolean'
607
+ },
608
+ execution_count: boundedExecutionCountJsonSchema,
609
+ execution_status_counts: executionCountsJsonSchema,
610
+ default_execution: nullable(executionSummaryJsonSchema)
611
+ },
612
+ required: [
613
+ 'id',
614
+ 'key',
615
+ 'name',
616
+ 'position',
617
+ 'status',
618
+ 'status_reason',
619
+ 'mode',
620
+ 'listener_status',
621
+ 'carried_over',
622
+ 'execution_count',
623
+ 'execution_status_counts',
624
+ 'default_execution'
625
+ ],
626
+ additionalProperties: false
627
+ };
628
+ export const getWorkflowRunResultJsonSchema = {
629
+ type: 'object',
630
+ properties: {
631
+ id: uuid,
632
+ project_id: uuid,
633
+ definition_id: uuid,
634
+ number: {
635
+ type: 'integer',
636
+ minimum: 1
637
+ },
638
+ name: text,
639
+ workflow_name: text,
640
+ status: {
641
+ type: 'string',
642
+ enum: [
643
+ 'pending',
644
+ 'running',
645
+ 'succeeded',
646
+ 'failed',
647
+ 'cancelled'
648
+ ]
649
+ },
650
+ origin: {
651
+ type: 'string',
652
+ enum: [
653
+ 'synced',
654
+ 'dev'
655
+ ]
656
+ },
657
+ dev_source: nullable(devSourceJsonSchema),
658
+ trigger_provider: nullable(text),
659
+ trigger_source: text,
660
+ trigger_event: text,
661
+ trigger_reference: nullable(triggerReferenceJsonSchema),
662
+ created_at: dateTime,
663
+ started_at: nullable(dateTime),
664
+ finished_at: nullable(dateTime),
665
+ attempt: workflowRunAttemptJsonSchema,
666
+ job_status_counts: {
667
+ type: 'array',
668
+ items: {
669
+ type: 'object',
670
+ properties: {
671
+ status: jobStatusJsonSchema,
672
+ count: {
673
+ type: 'integer',
674
+ minimum: 1
675
+ }
676
+ },
677
+ required: [
678
+ 'status',
679
+ 'count'
680
+ ],
681
+ additionalProperties: false
682
+ }
683
+ },
684
+ has_started_job_execution: {
685
+ type: 'boolean'
686
+ }
687
+ },
688
+ required: [
689
+ 'id',
690
+ 'project_id',
691
+ 'definition_id',
692
+ 'number',
693
+ 'name',
694
+ 'workflow_name',
695
+ 'status',
696
+ 'origin',
697
+ 'dev_source',
698
+ 'trigger_provider',
699
+ 'trigger_source',
700
+ 'trigger_event',
701
+ 'trigger_reference',
702
+ 'created_at',
703
+ 'started_at',
704
+ 'finished_at',
705
+ 'attempt',
706
+ 'job_status_counts',
707
+ 'has_started_job_execution'
708
+ ],
709
+ additionalProperties: false
710
+ };
711
+ const attemptsArrayJsonSchema = {
712
+ type: 'array',
713
+ items: workflowRunAttemptJsonSchema
714
+ };
715
+ export const listWorkflowRunAttemptsResultJsonSchema = {
716
+ type: 'object',
717
+ properties: {
718
+ attempts: attemptsArrayJsonSchema,
719
+ next_cursor: nullable({
720
+ type: 'string'
721
+ })
722
+ },
723
+ required: [
724
+ 'attempts',
725
+ 'next_cursor'
726
+ ],
727
+ additionalProperties: false
728
+ };
729
+ const stepsJsonSchema = {
730
+ type: 'object',
731
+ properties: {
732
+ id: uuid,
733
+ key: nullable(text),
734
+ name: text,
735
+ type: {
736
+ type: 'string',
737
+ enum: [
738
+ 'setup',
739
+ 'run',
740
+ 'agent',
741
+ 'checkout',
742
+ 'tool'
743
+ ]
744
+ },
745
+ position: {
746
+ type: 'integer',
747
+ minimum: 0
748
+ },
749
+ status: jobStatusJsonSchema,
750
+ status_reason: nullable({
751
+ type: 'string',
752
+ enum: [
753
+ 'default_gate_rejected',
754
+ 'condition_rejected',
755
+ 'condition_errored'
756
+ ]
757
+ }),
758
+ current_attempt: {
759
+ type: 'integer',
760
+ minimum: 1,
761
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
762
+ }
763
+ },
764
+ required: [
765
+ 'id',
766
+ 'key',
767
+ 'name',
768
+ 'type',
769
+ 'position',
770
+ 'status',
771
+ 'status_reason',
772
+ 'current_attempt'
773
+ ],
774
+ additionalProperties: false
775
+ };
776
+ const stepAttemptsJsonSchema = {
777
+ type: 'object',
778
+ properties: {
779
+ id: uuid,
780
+ attempt: {
781
+ type: 'integer',
782
+ minimum: 1,
783
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
784
+ },
785
+ execution_order: {
786
+ type: 'integer',
787
+ minimum: 1
788
+ },
789
+ status: jobStatusJsonSchema,
790
+ exit_code: nullable({
791
+ type: 'integer'
792
+ }),
793
+ started_at: dateTime,
794
+ finished_at: nullable(dateTime)
795
+ },
796
+ required: [
797
+ 'id',
798
+ 'attempt',
799
+ 'execution_order',
800
+ 'status',
801
+ 'exit_code',
802
+ 'started_at',
803
+ 'finished_at'
804
+ ],
805
+ additionalProperties: false
806
+ };
807
+ export const listWorkflowRunJobsResultJsonSchema = {
808
+ type: 'object',
809
+ properties: {
810
+ workflow_run_id: uuid,
811
+ workflow_run_attempt: {
812
+ type: 'integer',
813
+ minimum: 1,
814
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
815
+ },
816
+ jobs: {
817
+ type: 'array',
818
+ items: jobSummaryJsonSchema
819
+ },
820
+ next_cursor: nullable({
821
+ type: 'string'
822
+ }),
823
+ total: {
824
+ type: 'integer',
825
+ minimum: 0
826
+ }
827
+ },
828
+ required: [
829
+ 'workflow_run_id',
830
+ 'workflow_run_attempt',
831
+ 'jobs',
832
+ 'next_cursor'
833
+ ],
834
+ additionalProperties: false
835
+ };
836
+ const selectedExecutionJsonSchema = {
837
+ ...executionSummaryJsonSchema,
838
+ properties: {
839
+ ...executionSummaryJsonSchema.properties,
840
+ has_context: {
841
+ type: 'boolean'
842
+ }
843
+ },
844
+ required: [
845
+ ...executionSummaryJsonSchema.required,
846
+ 'has_context'
847
+ ]
848
+ };
849
+ export const getWorkflowJobResultJsonSchema = {
850
+ type: 'object',
851
+ properties: {
852
+ workflow_run_id: uuid,
853
+ workflow_run_attempt: {
854
+ type: 'integer',
855
+ minimum: 1,
856
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
857
+ },
858
+ job: jobSummaryJsonSchema,
859
+ selected_execution: nullable(selectedExecutionJsonSchema)
860
+ },
861
+ required: [
862
+ 'workflow_run_id',
863
+ 'workflow_run_attempt',
864
+ 'job',
865
+ 'selected_execution'
866
+ ],
867
+ additionalProperties: false
868
+ };
869
+ export const listWorkflowJobExecutionsResultJsonSchema = {
870
+ type: 'object',
871
+ properties: {
872
+ job_id: uuid,
873
+ executions: {
874
+ type: 'array',
875
+ items: executionSummaryJsonSchema
876
+ },
877
+ next_cursor: nullable({
878
+ type: 'string'
879
+ }),
880
+ total: boundedExecutionCountJsonSchema
881
+ },
882
+ required: [
883
+ 'job_id',
884
+ 'executions',
885
+ 'next_cursor'
886
+ ],
887
+ additionalProperties: false
888
+ };
889
+ export const listWorkflowExecutionStepsResultJsonSchema = {
890
+ type: 'object',
891
+ properties: {
892
+ job_id: uuid,
893
+ execution_id: uuid,
894
+ steps: {
895
+ type: 'array',
896
+ items: stepsJsonSchema
897
+ },
898
+ next_cursor: nullable({
899
+ type: 'string'
900
+ }),
901
+ total: {
902
+ type: 'integer',
903
+ minimum: 0
904
+ }
905
+ },
906
+ required: [
907
+ 'job_id',
908
+ 'execution_id',
909
+ 'steps',
910
+ 'next_cursor'
911
+ ],
912
+ additionalProperties: false
913
+ };
914
+ export const listWorkflowStepAttemptsResultJsonSchema = {
915
+ type: 'object',
916
+ properties: {
917
+ step_id: uuid,
918
+ attempts: {
919
+ type: 'array',
920
+ items: stepAttemptsJsonSchema
921
+ },
922
+ next_cursor: nullable({
923
+ type: 'string'
924
+ }),
925
+ total: {
926
+ type: 'integer',
927
+ minimum: 0
928
+ }
929
+ },
930
+ required: [
931
+ 'step_id',
932
+ 'attempts',
933
+ 'next_cursor'
934
+ ],
935
+ additionalProperties: false
936
+ };
937
+
938
+ //# sourceMappingURL=workflow-tools.js.map