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