@shipfox/api-agent-access-dto 20.3.0 → 21.1.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 (41) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +4 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/schemas/diagnostic-tools.d.ts +322 -0
  8. package/dist/schemas/diagnostic-tools.d.ts.map +1 -0
  9. package/dist/schemas/diagnostic-tools.js +325 -0
  10. package/dist/schemas/diagnostic-tools.js.map +1 -0
  11. package/dist/schemas/log-tools.d.ts +215 -0
  12. package/dist/schemas/log-tools.d.ts.map +1 -0
  13. package/dist/schemas/log-tools.js +224 -0
  14. package/dist/schemas/log-tools.js.map +1 -0
  15. package/dist/schemas/paged-tools.d.ts.map +1 -1
  16. package/dist/schemas/paged-tools.js +1 -6
  17. package/dist/schemas/paged-tools.js.map +1 -1
  18. package/dist/schemas/primitives.d.ts +5 -0
  19. package/dist/schemas/primitives.d.ts.map +1 -0
  20. package/dist/schemas/primitives.js +9 -0
  21. package/dist/schemas/primitives.js.map +1 -0
  22. package/dist/schemas/workflow-diagnostics.d.ts +862 -0
  23. package/dist/schemas/workflow-diagnostics.d.ts.map +1 -0
  24. package/dist/schemas/workflow-diagnostics.js +876 -0
  25. package/dist/schemas/workflow-diagnostics.js.map +1 -0
  26. package/dist/schemas/workflow-tools.d.ts +1305 -0
  27. package/dist/schemas/workflow-tools.d.ts.map +1 -0
  28. package/dist/schemas/workflow-tools.js +938 -0
  29. package/dist/schemas/workflow-tools.js.map +1 -0
  30. package/dist/tsconfig.test.tsbuildinfo +1 -1
  31. package/package.json +3 -2
  32. package/src/index.ts +115 -0
  33. package/src/schemas/diagnostic-tools.ts +255 -0
  34. package/src/schemas/log-tools.ts +209 -0
  35. package/src/schemas/paged-tools.ts +1 -10
  36. package/src/schemas/primitives.ts +14 -0
  37. package/src/schemas/workflow-diagnostics.test.ts +277 -0
  38. package/src/schemas/workflow-diagnostics.ts +693 -0
  39. package/src/schemas/workflow-tools.test.ts +202 -0
  40. package/src/schemas/workflow-tools.ts +738 -0
  41. package/tsconfig.build.tsbuildinfo +1 -1
@@ -0,0 +1,876 @@
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
+ import { AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX } from './workflow-tools.js';
5
+ /** Smaller per-value allowance used by Agent Access before the common response ceiling. */ export const AGENT_ACCESS_WORKFLOW_DIAGNOSTIC_VALUE_MAX_BYTES = 16 * 1024;
6
+ /** Source is text, but it still needs enough room to be useful in a diagnostic response. */ export const AGENT_ACCESS_WORKFLOW_SOURCE_MAX_BYTES = AGENT_ACCESS_WORKFLOW_DIAGNOSTIC_VALUE_MAX_BYTES;
7
+ const textSchema = utf8CappedString(AGENT_ACCESS_TEXT_MAX_BYTES);
8
+ const sourceTextSchema = utf8CappedString(AGENT_ACCESS_WORKFLOW_SOURCE_MAX_BYTES);
9
+ const attemptSchema = z.number().int().min(1).max(AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX);
10
+ const diagnosticFields = [
11
+ 'authored_config',
12
+ 'config',
13
+ 'evaluation_trace',
14
+ 'output',
15
+ 'outputs',
16
+ 'response',
17
+ 'error',
18
+ 'gate_result',
19
+ 'restart_feedback',
20
+ 'job_outputs',
21
+ 'execution_outputs',
22
+ 'job_evaluation_trace',
23
+ 'execution_evaluation_trace',
24
+ 'condition',
25
+ 'trigger_events'
26
+ ];
27
+ export const agentAccessWorkflowDiagnosticFieldSchema = z.enum(diagnosticFields);
28
+ const oversizedReasonSchema = z.enum([
29
+ 'legacy_value_exceeds_inline_limit',
30
+ 'value_exceeds_inline_limit',
31
+ 'value_truncated_at_write_limit'
32
+ ]);
33
+ export const agentAccessOversizedFieldSchema = z.object({
34
+ field: agentAccessWorkflowDiagnosticFieldSchema,
35
+ stored_bytes: z.number().int().nonnegative(),
36
+ reason: oversizedReasonSchema
37
+ }).strict();
38
+ const stepErrorReasons = [
39
+ 'checkout_failed',
40
+ 'checkout_auth_failed',
41
+ 'checkout_unavailable',
42
+ 'checkout_path_invalid',
43
+ 'checkout_destination_occupied',
44
+ 'git_unavailable',
45
+ 'workspace_prep_failed',
46
+ 'setup_aborted',
47
+ 'config_unresolvable',
48
+ 'output_invalid',
49
+ 'agent_config_invalid',
50
+ 'agent_invocation_failed',
51
+ 'agent_harness_unavailable',
52
+ 'agent_inference_credentials_unavailable',
53
+ 'agent_session_key_invalid',
54
+ 'agent_session_held',
55
+ 'agent_session_harness_mismatch',
56
+ 'agent_session_unavailable',
57
+ 'execution_payload_too_large',
58
+ 'step_result_too_large',
59
+ 'diagnostic_too_large',
60
+ 'tool_error',
61
+ 'tool_config_invalid',
62
+ 'invocation_interrupted'
63
+ ];
64
+ const agentConfigIssues = [
65
+ 'step_config_invalid',
66
+ 'provider_not_configured',
67
+ 'provider_unsupported',
68
+ 'model_unavailable',
69
+ 'credentials_invalid'
70
+ ];
71
+ const errorCategories = [
72
+ 'setup',
73
+ 'user'
74
+ ];
75
+ const gateKinds = [
76
+ 'none',
77
+ 'not_evaluated',
78
+ 'passed',
79
+ 'failed',
80
+ 'uncheckable',
81
+ 'evaluation_error',
82
+ 'unknown'
83
+ ];
84
+ const sourceUnavailableReasons = [
85
+ 'temporary_run',
86
+ 'pre_snapshot_run',
87
+ 'legacy_snapshot_too_large'
88
+ ];
89
+ const explanationStatuses = [
90
+ 'failed',
91
+ 'skipped'
92
+ ];
93
+ const evaluationTraceValueSchema = z.object({
94
+ expression: textSchema,
95
+ roots: z.array(textSchema),
96
+ fill_target: textSchema,
97
+ evaluated_at: textSchema,
98
+ field: textSchema,
99
+ value: textSchema.optional(),
100
+ truncated: z.boolean().optional(),
101
+ expr_truncated: z.boolean().optional(),
102
+ reference: z.boolean().optional(),
103
+ degraded: z.boolean().optional(),
104
+ env_key: textSchema.optional()
105
+ }).strict();
106
+ const evaluationTraceLimitSchema = z.object({
107
+ truncated: z.literal(true),
108
+ dropped: z.number().int().nonnegative()
109
+ }).strict();
110
+ const evaluationTraceSchema = z.array(z.union([
111
+ evaluationTraceValueSchema,
112
+ evaluationTraceLimitSchema
113
+ ]));
114
+ const workflowExecutionEventSchema = z.object({
115
+ source: textSchema,
116
+ event: textSchema,
117
+ delivery_id: textSchema,
118
+ received_at: dateTimeSchema,
119
+ project: z.object({
120
+ id: idSchema
121
+ }).strict().nullable(),
122
+ repository: textSchema.nullable(),
123
+ ref: textSchema.nullable(),
124
+ commit: textSchema.nullable(),
125
+ data: z.unknown()
126
+ }).strict();
127
+ const stepErrorSchema = z.object({
128
+ message: textSchema,
129
+ code: textSchema.optional(),
130
+ managed_provider_id: textSchema.optional(),
131
+ exit_code: z.number().int().nullable().optional(),
132
+ signal: textSchema.optional(),
133
+ reason: z.enum(stepErrorReasons).optional(),
134
+ field: textSchema.optional(),
135
+ source: textSchema.optional(),
136
+ agent_config_issue: z.enum(agentConfigIssues).optional(),
137
+ category: z.enum(errorCategories).optional(),
138
+ retryable: z.boolean().optional(),
139
+ limit_bytes: z.number().int().positive().optional(),
140
+ measured_bytes: z.number().int().positive().optional(),
141
+ overshoot_bytes: z.number().int().positive().optional()
142
+ }).strict().nullable();
143
+ const gateResultSchema = z.object({
144
+ kind: z.enum(gateKinds),
145
+ passed: z.boolean().optional(),
146
+ source: textSchema.optional(),
147
+ exit_code: z.number().int().nullable().optional(),
148
+ uncheckable: z.boolean().optional(),
149
+ reason: textSchema.optional(),
150
+ data: z.unknown().optional()
151
+ }).strict().nullable();
152
+ const sessionSchema = z.object({
153
+ id: idSchema,
154
+ key: textSchema,
155
+ mode: z.enum([
156
+ 'resume',
157
+ 'fork'
158
+ ]),
159
+ segment: z.number().int().nonnegative()
160
+ }).strict().nullable();
161
+ const invocationSchema = z.object({
162
+ call_index: z.number().int().nonnegative(),
163
+ started_at: textSchema,
164
+ finished_at: textSchema.optional(),
165
+ outcome: textSchema.optional(),
166
+ error_code: textSchema.optional(),
167
+ duration_ms: z.number().int().nonnegative().optional(),
168
+ next_due_at: textSchema.optional()
169
+ }).strict();
170
+ export const getWorkflowRunSourceInputSchema = z.object({
171
+ run_id: idSchema,
172
+ attempt: attemptSchema
173
+ }).strict();
174
+ export const getWorkflowExecutionContextInputSchema = z.object({
175
+ job_id: idSchema,
176
+ execution_id: idSchema
177
+ }).strict();
178
+ export const getStepAttemptInputSchema = z.object({
179
+ step_id: idSchema,
180
+ attempt: attemptSchema.optional()
181
+ }).strict();
182
+ export const listWorkflowRunJobExplanationsInputSchema = z.object({
183
+ run_id: idSchema,
184
+ attempt: attemptSchema,
185
+ limit: z.number().int().min(1).max(AGENT_ACCESS_PAGE_LIMIT_MAX).default(100),
186
+ cursor: z.string().min(1).optional()
187
+ }).strict();
188
+ const sourceSnapshotSchema = z.object({
189
+ content: sourceTextSchema,
190
+ format: z.literal('yaml')
191
+ }).strict();
192
+ export const getWorkflowRunSourceResultSchema = z.discriminatedUnion('kind', [
193
+ z.object({
194
+ kind: z.literal('available'),
195
+ workflow_run_id: idSchema,
196
+ workflow_run_attempt: attemptSchema,
197
+ source_snapshot: sourceSnapshotSchema,
198
+ source_snapshot_truncated: z.literal(true).optional(),
199
+ source_snapshot_total_bytes: z.number().int().nonnegative().optional()
200
+ }).strict(),
201
+ z.object({
202
+ kind: z.literal('unavailable'),
203
+ workflow_run_id: idSchema,
204
+ workflow_run_attempt: attemptSchema,
205
+ reason: z.enum(sourceUnavailableReasons)
206
+ }).strict()
207
+ ]);
208
+ export const getWorkflowExecutionContextResultSchema = z.object({
209
+ workflow_run_id: idSchema,
210
+ workflow_run_attempt: attemptSchema,
211
+ job_id: idSchema,
212
+ job_execution_id: idSchema,
213
+ job_runner: z.array(textSchema).nullable(),
214
+ execution_runner: z.array(textSchema).nullable(),
215
+ job_outputs: z.unknown().nullable(),
216
+ execution_outputs: z.unknown().nullable(),
217
+ trigger_events: z.array(workflowExecutionEventSchema).max(AGENT_ACCESS_PAGE_LIMIT_MAX),
218
+ trigger_events_truncated: z.literal(true).optional(),
219
+ trigger_events_total_count: z.number().int().nonnegative().optional(),
220
+ job_evaluation_trace: evaluationTraceSchema.nullable(),
221
+ execution_evaluation_trace: evaluationTraceSchema.nullable(),
222
+ condition: textSchema.nullable(),
223
+ condition_truncated: z.literal(true).optional(),
224
+ condition_total_bytes: z.number().int().nonnegative().optional(),
225
+ oversized_fields: z.array(agentAccessOversizedFieldSchema).max(AGENT_ACCESS_PAGE_LIMIT_MAX)
226
+ }).strict();
227
+ export const getStepAttemptResultSchema = z.object({
228
+ workflow_run_id: idSchema,
229
+ workflow_run_attempt: attemptSchema,
230
+ job_id: idSchema,
231
+ job_execution_id: idSchema,
232
+ step_id: idSchema,
233
+ step_attempt_id: idSchema,
234
+ attempt: attemptSchema,
235
+ authored_config: z.unknown().nullable(),
236
+ config: z.unknown().nullable(),
237
+ session: sessionSchema,
238
+ evaluation_trace: evaluationTraceSchema.nullable(),
239
+ output: z.unknown().nullable(),
240
+ outputs: z.unknown().nullable(),
241
+ response: textSchema.nullable(),
242
+ error: stepErrorSchema,
243
+ gate_result: gateResultSchema,
244
+ invocations: z.array(invocationSchema).max(10),
245
+ restart_feedback: textSchema.nullable(),
246
+ restart_feedback_truncated: z.literal(true).optional(),
247
+ restart_feedback_total_bytes: z.number().int().nonnegative().optional(),
248
+ response_text_truncated: z.literal(true).optional(),
249
+ response_text_total_bytes: z.number().int().nonnegative().optional(),
250
+ oversized_fields: z.array(agentAccessOversizedFieldSchema).max(AGENT_ACCESS_PAGE_LIMIT_MAX)
251
+ }).strict();
252
+ const explanationSchema = z.object({
253
+ job_id: idSchema,
254
+ job_label: textSchema,
255
+ job_position: z.number().int().nonnegative().max(AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX),
256
+ status: z.enum(explanationStatuses),
257
+ status_reason: textSchema.nullable(),
258
+ evaluation_trace: evaluationTraceSchema.nullable()
259
+ }).strict();
260
+ export const listWorkflowRunJobExplanationsResultSchema = z.object({
261
+ workflow_run_id: idSchema,
262
+ workflow_run_attempt: attemptSchema,
263
+ explanations: z.array(explanationSchema).max(AGENT_ACCESS_PAGE_LIMIT_MAX),
264
+ next_cursor: z.string().nullable()
265
+ }).strict();
266
+ const uuid = {
267
+ type: 'string',
268
+ format: 'uuid'
269
+ };
270
+ const dateTime = {
271
+ type: 'string',
272
+ format: 'date-time'
273
+ };
274
+ const text = {
275
+ type: 'string',
276
+ maxLength: AGENT_ACCESS_TEXT_MAX_BYTES
277
+ };
278
+ const sourceText = {
279
+ type: 'string',
280
+ maxLength: AGENT_ACCESS_WORKFLOW_SOURCE_MAX_BYTES
281
+ };
282
+ const dynamicJson = {};
283
+ const nullable = (schema)=>({
284
+ anyOf: [
285
+ schema,
286
+ {
287
+ type: 'null'
288
+ }
289
+ ]
290
+ });
291
+ const nullableDynamicJson = nullable(dynamicJson);
292
+ export const getWorkflowRunSourceInputJsonSchema = {
293
+ type: 'object',
294
+ properties: {
295
+ run_id: uuid,
296
+ attempt: {
297
+ type: 'integer',
298
+ minimum: 1,
299
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
300
+ }
301
+ },
302
+ required: [
303
+ 'run_id',
304
+ 'attempt'
305
+ ],
306
+ additionalProperties: false
307
+ };
308
+ export const getWorkflowExecutionContextInputJsonSchema = {
309
+ type: 'object',
310
+ properties: {
311
+ job_id: uuid,
312
+ execution_id: uuid
313
+ },
314
+ required: [
315
+ 'job_id',
316
+ 'execution_id'
317
+ ],
318
+ additionalProperties: false
319
+ };
320
+ export const getStepAttemptInputJsonSchema = {
321
+ type: 'object',
322
+ properties: {
323
+ step_id: uuid,
324
+ attempt: {
325
+ type: 'integer',
326
+ minimum: 1,
327
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
328
+ }
329
+ },
330
+ required: [
331
+ 'step_id'
332
+ ],
333
+ additionalProperties: false
334
+ };
335
+ export const listWorkflowRunJobExplanationsInputJsonSchema = {
336
+ type: 'object',
337
+ properties: {
338
+ run_id: uuid,
339
+ attempt: {
340
+ type: 'integer',
341
+ minimum: 1,
342
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
343
+ },
344
+ limit: {
345
+ type: 'integer',
346
+ minimum: 1,
347
+ maximum: AGENT_ACCESS_PAGE_LIMIT_MAX,
348
+ default: 100
349
+ },
350
+ cursor: {
351
+ type: 'string',
352
+ minLength: 1
353
+ }
354
+ },
355
+ required: [
356
+ 'run_id',
357
+ 'attempt'
358
+ ],
359
+ additionalProperties: false
360
+ };
361
+ const oversizedFieldJson = {
362
+ type: 'object',
363
+ properties: {
364
+ field: {
365
+ type: 'string',
366
+ enum: diagnosticFields
367
+ },
368
+ stored_bytes: {
369
+ type: 'integer',
370
+ minimum: 0
371
+ },
372
+ reason: {
373
+ type: 'string',
374
+ enum: oversizedReasonSchema.options
375
+ }
376
+ },
377
+ required: [
378
+ 'field',
379
+ 'stored_bytes',
380
+ 'reason'
381
+ ],
382
+ additionalProperties: false
383
+ };
384
+ const evaluationTraceValueJson = {
385
+ type: 'object',
386
+ properties: {
387
+ expression: text,
388
+ roots: {
389
+ type: 'array',
390
+ items: text
391
+ },
392
+ fill_target: text,
393
+ evaluated_at: text,
394
+ field: text,
395
+ value: text,
396
+ truncated: {
397
+ type: 'boolean'
398
+ },
399
+ expr_truncated: {
400
+ type: 'boolean'
401
+ },
402
+ reference: {
403
+ type: 'boolean'
404
+ },
405
+ degraded: {
406
+ type: 'boolean'
407
+ },
408
+ env_key: text
409
+ },
410
+ required: [
411
+ 'expression',
412
+ 'roots',
413
+ 'fill_target',
414
+ 'evaluated_at',
415
+ 'field'
416
+ ],
417
+ additionalProperties: false
418
+ };
419
+ const evaluationTraceJson = {
420
+ type: 'array',
421
+ items: {
422
+ anyOf: [
423
+ evaluationTraceValueJson,
424
+ {
425
+ type: 'object',
426
+ properties: {
427
+ truncated: {
428
+ const: true
429
+ },
430
+ dropped: {
431
+ type: 'integer',
432
+ minimum: 0
433
+ }
434
+ },
435
+ required: [
436
+ 'truncated',
437
+ 'dropped'
438
+ ],
439
+ additionalProperties: false
440
+ }
441
+ ]
442
+ }
443
+ };
444
+ const workflowExecutionEventJson = {
445
+ type: 'object',
446
+ properties: {
447
+ source: text,
448
+ event: text,
449
+ delivery_id: text,
450
+ received_at: dateTime,
451
+ project: nullable({
452
+ type: 'object',
453
+ properties: {
454
+ id: uuid
455
+ },
456
+ required: [
457
+ 'id'
458
+ ],
459
+ additionalProperties: false
460
+ }),
461
+ repository: nullable(text),
462
+ ref: nullable(text),
463
+ commit: nullable(text),
464
+ data: dynamicJson
465
+ },
466
+ required: [
467
+ 'source',
468
+ 'event',
469
+ 'delivery_id',
470
+ 'received_at',
471
+ 'project',
472
+ 'repository',
473
+ 'ref',
474
+ 'commit',
475
+ 'data'
476
+ ],
477
+ additionalProperties: false
478
+ };
479
+ const stepErrorJson = {
480
+ type: 'object',
481
+ properties: {
482
+ message: text,
483
+ code: text,
484
+ managed_provider_id: text,
485
+ exit_code: nullable({
486
+ type: 'integer'
487
+ }),
488
+ signal: text,
489
+ reason: {
490
+ type: 'string',
491
+ enum: stepErrorReasons
492
+ },
493
+ field: text,
494
+ source: text,
495
+ agent_config_issue: {
496
+ type: 'string',
497
+ enum: agentConfigIssues
498
+ },
499
+ category: {
500
+ type: 'string',
501
+ enum: errorCategories
502
+ },
503
+ retryable: {
504
+ type: 'boolean'
505
+ },
506
+ limit_bytes: {
507
+ type: 'integer',
508
+ minimum: 1
509
+ },
510
+ measured_bytes: {
511
+ type: 'integer',
512
+ minimum: 1
513
+ },
514
+ overshoot_bytes: {
515
+ type: 'integer',
516
+ minimum: 1
517
+ }
518
+ },
519
+ required: [
520
+ 'message'
521
+ ],
522
+ additionalProperties: false
523
+ };
524
+ const gateResultJson = {
525
+ type: 'object',
526
+ properties: {
527
+ kind: {
528
+ type: 'string',
529
+ enum: gateKinds
530
+ },
531
+ passed: {
532
+ type: 'boolean'
533
+ },
534
+ source: text,
535
+ exit_code: nullable({
536
+ type: 'integer'
537
+ }),
538
+ uncheckable: {
539
+ type: 'boolean'
540
+ },
541
+ reason: text,
542
+ data: dynamicJson
543
+ },
544
+ required: [
545
+ 'kind'
546
+ ],
547
+ additionalProperties: false
548
+ };
549
+ const sessionJson = {
550
+ type: 'object',
551
+ properties: {
552
+ id: uuid,
553
+ key: text,
554
+ mode: {
555
+ type: 'string',
556
+ enum: [
557
+ 'resume',
558
+ 'fork'
559
+ ]
560
+ },
561
+ segment: {
562
+ type: 'integer',
563
+ minimum: 0
564
+ }
565
+ },
566
+ required: [
567
+ 'id',
568
+ 'key',
569
+ 'mode',
570
+ 'segment'
571
+ ],
572
+ additionalProperties: false
573
+ };
574
+ const invocationJson = {
575
+ type: 'object',
576
+ properties: {
577
+ call_index: {
578
+ type: 'integer',
579
+ minimum: 0
580
+ },
581
+ started_at: text,
582
+ finished_at: text,
583
+ outcome: text,
584
+ error_code: text,
585
+ duration_ms: {
586
+ type: 'integer',
587
+ minimum: 0
588
+ },
589
+ next_due_at: text
590
+ },
591
+ required: [
592
+ 'call_index',
593
+ 'started_at'
594
+ ],
595
+ additionalProperties: false
596
+ };
597
+ const sourceSnapshotJson = {
598
+ type: 'object',
599
+ properties: {
600
+ content: sourceText,
601
+ format: {
602
+ const: 'yaml'
603
+ }
604
+ },
605
+ required: [
606
+ 'content',
607
+ 'format'
608
+ ],
609
+ additionalProperties: false
610
+ };
611
+ export const getWorkflowRunSourceResultJsonSchema = {
612
+ type: 'object',
613
+ properties: {
614
+ kind: {
615
+ type: 'string',
616
+ enum: [
617
+ 'available',
618
+ 'unavailable'
619
+ ]
620
+ },
621
+ workflow_run_id: uuid,
622
+ workflow_run_attempt: {
623
+ type: 'integer',
624
+ minimum: 1,
625
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
626
+ },
627
+ source_snapshot: sourceSnapshotJson,
628
+ source_snapshot_truncated: {
629
+ const: true
630
+ },
631
+ source_snapshot_total_bytes: {
632
+ type: 'integer',
633
+ minimum: 0
634
+ },
635
+ reason: {
636
+ type: 'string',
637
+ enum: sourceUnavailableReasons
638
+ }
639
+ },
640
+ required: [
641
+ 'kind',
642
+ 'workflow_run_id',
643
+ 'workflow_run_attempt'
644
+ ],
645
+ additionalProperties: false,
646
+ oneOf: [
647
+ {
648
+ properties: {
649
+ kind: {
650
+ const: 'available'
651
+ }
652
+ },
653
+ required: [
654
+ 'source_snapshot'
655
+ ],
656
+ not: {
657
+ required: [
658
+ 'reason'
659
+ ]
660
+ }
661
+ },
662
+ {
663
+ properties: {
664
+ kind: {
665
+ const: 'unavailable'
666
+ }
667
+ },
668
+ required: [
669
+ 'reason'
670
+ ],
671
+ not: {
672
+ required: [
673
+ 'source_snapshot'
674
+ ]
675
+ }
676
+ }
677
+ ]
678
+ };
679
+ export const getWorkflowExecutionContextResultJsonSchema = {
680
+ type: 'object',
681
+ properties: {
682
+ workflow_run_id: uuid,
683
+ workflow_run_attempt: {
684
+ type: 'integer',
685
+ minimum: 1,
686
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
687
+ },
688
+ job_id: uuid,
689
+ job_execution_id: uuid,
690
+ job_runner: nullable({
691
+ type: 'array',
692
+ items: text
693
+ }),
694
+ execution_runner: nullable({
695
+ type: 'array',
696
+ items: text
697
+ }),
698
+ job_outputs: nullableDynamicJson,
699
+ execution_outputs: nullableDynamicJson,
700
+ trigger_events: {
701
+ type: 'array',
702
+ maxItems: AGENT_ACCESS_PAGE_LIMIT_MAX,
703
+ items: workflowExecutionEventJson
704
+ },
705
+ trigger_events_truncated: {
706
+ const: true
707
+ },
708
+ trigger_events_total_count: {
709
+ type: 'integer',
710
+ minimum: 0
711
+ },
712
+ job_evaluation_trace: nullable(evaluationTraceJson),
713
+ execution_evaluation_trace: nullable(evaluationTraceJson),
714
+ condition: nullable(text),
715
+ condition_truncated: {
716
+ const: true
717
+ },
718
+ condition_total_bytes: {
719
+ type: 'integer',
720
+ minimum: 0
721
+ },
722
+ oversized_fields: {
723
+ type: 'array',
724
+ maxItems: AGENT_ACCESS_PAGE_LIMIT_MAX,
725
+ items: oversizedFieldJson
726
+ }
727
+ },
728
+ required: [
729
+ 'workflow_run_id',
730
+ 'workflow_run_attempt',
731
+ 'job_id',
732
+ 'job_execution_id',
733
+ 'job_runner',
734
+ 'execution_runner',
735
+ 'job_outputs',
736
+ 'execution_outputs',
737
+ 'trigger_events',
738
+ 'job_evaluation_trace',
739
+ 'execution_evaluation_trace',
740
+ 'condition',
741
+ 'oversized_fields'
742
+ ],
743
+ additionalProperties: false
744
+ };
745
+ export const getStepAttemptResultJsonSchema = {
746
+ type: 'object',
747
+ properties: {
748
+ workflow_run_id: uuid,
749
+ workflow_run_attempt: {
750
+ type: 'integer',
751
+ minimum: 1,
752
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
753
+ },
754
+ job_id: uuid,
755
+ job_execution_id: uuid,
756
+ step_id: uuid,
757
+ step_attempt_id: uuid,
758
+ attempt: {
759
+ type: 'integer',
760
+ minimum: 1,
761
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
762
+ },
763
+ authored_config: nullableDynamicJson,
764
+ config: nullableDynamicJson,
765
+ session: nullable(sessionJson),
766
+ evaluation_trace: nullable(evaluationTraceJson),
767
+ output: nullableDynamicJson,
768
+ outputs: nullableDynamicJson,
769
+ response: nullable(text),
770
+ error: nullable(stepErrorJson),
771
+ gate_result: nullable(gateResultJson),
772
+ invocations: {
773
+ type: 'array',
774
+ maxItems: 10,
775
+ items: invocationJson
776
+ },
777
+ restart_feedback: nullable(text),
778
+ restart_feedback_truncated: {
779
+ const: true
780
+ },
781
+ restart_feedback_total_bytes: {
782
+ type: 'integer',
783
+ minimum: 0
784
+ },
785
+ response_text_truncated: {
786
+ const: true
787
+ },
788
+ response_text_total_bytes: {
789
+ type: 'integer',
790
+ minimum: 0
791
+ },
792
+ oversized_fields: {
793
+ type: 'array',
794
+ maxItems: AGENT_ACCESS_PAGE_LIMIT_MAX,
795
+ items: oversizedFieldJson
796
+ }
797
+ },
798
+ required: [
799
+ 'workflow_run_id',
800
+ 'workflow_run_attempt',
801
+ 'job_id',
802
+ 'job_execution_id',
803
+ 'step_id',
804
+ 'step_attempt_id',
805
+ 'attempt',
806
+ 'authored_config',
807
+ 'config',
808
+ 'session',
809
+ 'evaluation_trace',
810
+ 'output',
811
+ 'outputs',
812
+ 'response',
813
+ 'error',
814
+ 'gate_result',
815
+ 'invocations',
816
+ 'restart_feedback',
817
+ 'oversized_fields'
818
+ ],
819
+ additionalProperties: false
820
+ };
821
+ const explanationJson = {
822
+ type: 'object',
823
+ properties: {
824
+ job_id: uuid,
825
+ job_label: text,
826
+ job_position: {
827
+ type: 'integer',
828
+ minimum: 0,
829
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
830
+ },
831
+ status: {
832
+ type: 'string',
833
+ enum: explanationStatuses
834
+ },
835
+ status_reason: nullable(text),
836
+ evaluation_trace: nullable(evaluationTraceJson)
837
+ },
838
+ required: [
839
+ 'job_id',
840
+ 'job_label',
841
+ 'job_position',
842
+ 'status',
843
+ 'status_reason',
844
+ 'evaluation_trace'
845
+ ],
846
+ additionalProperties: false
847
+ };
848
+ export const listWorkflowRunJobExplanationsResultJsonSchema = {
849
+ type: 'object',
850
+ properties: {
851
+ workflow_run_id: uuid,
852
+ workflow_run_attempt: {
853
+ type: 'integer',
854
+ minimum: 1,
855
+ maximum: AGENT_ACCESS_WORKFLOW_ATTEMPT_MAX
856
+ },
857
+ explanations: {
858
+ type: 'array',
859
+ maxItems: AGENT_ACCESS_PAGE_LIMIT_MAX,
860
+ items: explanationJson
861
+ },
862
+ next_cursor: nullable({
863
+ type: 'string',
864
+ minLength: 1
865
+ })
866
+ },
867
+ required: [
868
+ 'workflow_run_id',
869
+ 'workflow_run_attempt',
870
+ 'explanations',
871
+ 'next_cursor'
872
+ ],
873
+ additionalProperties: false
874
+ };
875
+
876
+ //# sourceMappingURL=workflow-diagnostics.js.map