@clearideas/agent-runtime-contracts 0.1.0-alpha.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.
@@ -0,0 +1,917 @@
1
+ import { z } from "zod";
2
+ export declare const AGENT_MANIFEST_SCHEMA_VERSION: "1.0";
3
+ export declare const AGENT_RUN_MANIFEST_SCHEMA_VERSION: "1.0";
4
+ export type JsonPrimitive = string | number | boolean | null;
5
+ export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
6
+ export type JsonObject = {
7
+ [key: string]: JsonValue;
8
+ };
9
+ export declare const jsonValueSchema: z.ZodType<JsonValue>;
10
+ export declare const jsonObjectSchema: z.ZodType<JsonObject>;
11
+ export type VariableState = Record<string, JsonValue>;
12
+ export declare const variableStateSchema: z.ZodType<VariableState>;
13
+ export declare const isSafeVariablePath: (value: string) => boolean;
14
+ export declare const variablePathSchema: z.ZodString;
15
+ export declare const AGENT_VARIABLE_TYPES: readonly ["string", "number", "boolean", "object", "array", "json"];
16
+ export type AgentVariableType = (typeof AGENT_VARIABLE_TYPES)[number];
17
+ export declare const agentVariableKeySchema: z.ZodString;
18
+ export interface StatePatch {
19
+ set?: VariableState;
20
+ unset?: string[];
21
+ }
22
+ export interface ArtifactRef {
23
+ id: string;
24
+ name: string;
25
+ mediaType: string;
26
+ uri?: string;
27
+ size?: number;
28
+ sha256?: string;
29
+ metadata?: JsonObject;
30
+ }
31
+ export interface ModelUsage {
32
+ inputTokens?: number;
33
+ outputTokens?: number;
34
+ reasoningTokens?: number;
35
+ cachedInputTokens?: number;
36
+ cacheWriteTokens?: number;
37
+ totalTokens?: number;
38
+ estimatedCost?: number;
39
+ metadata?: JsonObject;
40
+ }
41
+ export interface ToolCall {
42
+ id: string;
43
+ name: string;
44
+ input: JsonObject;
45
+ stepId?: string;
46
+ }
47
+ export interface ToolResult {
48
+ callId: string;
49
+ name: string;
50
+ output?: JsonValue;
51
+ error?: RunError;
52
+ artifacts?: ArtifactRef[];
53
+ metadata?: JsonObject;
54
+ }
55
+ export type ContentPart = {
56
+ type: "text";
57
+ text: string;
58
+ } | {
59
+ type: "reasoning";
60
+ text?: string;
61
+ encrypted?: string;
62
+ } | {
63
+ type: "json";
64
+ value: JsonValue;
65
+ } | {
66
+ type: "image";
67
+ artifact?: ArtifactRef;
68
+ url?: string;
69
+ mediaType?: string;
70
+ } | {
71
+ type: "file";
72
+ artifact: ArtifactRef;
73
+ } | {
74
+ type: "tool-call";
75
+ call: ToolCall;
76
+ } | {
77
+ type: "tool-result";
78
+ result: ToolResult;
79
+ };
80
+ export interface TranscriptItem {
81
+ id: string;
82
+ type: "message" | "reasoning" | "tool-call" | "tool-result" | "artifact" | "error";
83
+ role?: "system" | "user" | "assistant" | "tool";
84
+ content: ContentPart[];
85
+ createdAt: string;
86
+ model?: string;
87
+ usage?: ModelUsage;
88
+ metadata?: JsonObject;
89
+ }
90
+ export type ModelReference = {
91
+ provider: string;
92
+ model: string;
93
+ options?: JsonObject;
94
+ } | {
95
+ /** Host-defined model profile. The resolved provider and model never contain credentials. */
96
+ ref: string;
97
+ options?: JsonObject;
98
+ };
99
+ export interface AgentConnectionBinding {
100
+ /** Host-defined connection name. */
101
+ ref: string;
102
+ /** Stable prefix used for tools exposed by this connection. Defaults to ref. */
103
+ alias?: string;
104
+ /** Optional per-agent narrowing of the connection's tool allowlist. */
105
+ tools?: string[];
106
+ /** An agent may request fewer privileges than the configured connection, never more. */
107
+ mode?: "read" | "read_write";
108
+ required?: boolean;
109
+ }
110
+ export interface AgentVariableDefinition {
111
+ key: string;
112
+ type: AgentVariableType;
113
+ value?: JsonValue;
114
+ requiresOverride?: boolean;
115
+ description?: string;
116
+ metadata?: JsonObject;
117
+ }
118
+ export interface AgentVariableOverride {
119
+ key: string;
120
+ value: JsonValue;
121
+ }
122
+ export declare const valueMatchesAgentVariableType: (value: JsonValue, type: AgentVariableType) => boolean;
123
+ export declare const agentVariableDefinitionSchema: z.ZodType<AgentVariableDefinition>;
124
+ export declare const agentVariableOverrideSchema: z.ZodType<AgentVariableOverride>;
125
+ export declare const agentVariableOverridesSchema: z.ZodArray<z.ZodType<AgentVariableOverride, unknown, z.core.$ZodTypeInternals<AgentVariableOverride, unknown>>>;
126
+ export declare const parseAgentVariableOverrides: (input: unknown) => AgentVariableOverride[];
127
+ export interface AgentStepBase {
128
+ id: string;
129
+ name?: string;
130
+ description?: string;
131
+ when?: string;
132
+ outputVariable?: string;
133
+ includeInFinalOutput?: boolean;
134
+ metadata?: JsonObject;
135
+ extensions?: JsonObject;
136
+ }
137
+ export interface PromptStep extends AgentStepBase {
138
+ type: "prompt";
139
+ prompt: string;
140
+ systemPrompt?: string;
141
+ model?: ModelReference;
142
+ outputSchema?: JsonObject;
143
+ tools?: string[];
144
+ maxOutputTokens?: number;
145
+ completionPolicy?: {
146
+ /** Truncated responses fail by default because they may contain only reasoning or partial data. */
147
+ onTruncation?: "fail" | "accept";
148
+ /** Require a non-empty string or a defined structured value after tool execution finishes. */
149
+ requireOutput?: boolean;
150
+ };
151
+ }
152
+ export interface LoopDefinition {
153
+ source?: string;
154
+ delimiter?: string;
155
+ itemVariable?: string;
156
+ indexVariable?: string;
157
+ condition?: string;
158
+ goal?: string;
159
+ outputMode?: "array" | "final";
160
+ resultVariable?: string;
161
+ maxIterations?: number;
162
+ }
163
+ export interface LoopStep extends AgentStepBase {
164
+ type: "loop";
165
+ loop: LoopDefinition;
166
+ steps: AgentStep[];
167
+ }
168
+ export interface WebhookStep extends AgentStepBase {
169
+ type: "webhook";
170
+ url: string;
171
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
172
+ headers?: Record<string, string>;
173
+ body?: JsonValue;
174
+ timeoutMs?: number;
175
+ retries?: number;
176
+ idempotencyKey?: string;
177
+ }
178
+ export interface ApprovalStep extends AgentStepBase {
179
+ type: "approval";
180
+ prompt: string;
181
+ action?: "pause" | "complete" | "cancel";
182
+ }
183
+ export interface SubRunStep extends AgentStepBase {
184
+ type: "sub-run";
185
+ manifest?: AgentManifest;
186
+ manifestRef?: string;
187
+ variableMappings?: Record<string, string>;
188
+ }
189
+ export interface CodeStep extends AgentStepBase {
190
+ type: "code";
191
+ language: "python" | string;
192
+ code: string;
193
+ timeoutMs?: number;
194
+ environment?: Record<string, string>;
195
+ }
196
+ export type AgentStep = PromptStep | LoopStep | WebhookStep | ApprovalStep | SubRunStep | CodeStep;
197
+ export declare const agentStepSchema: z.ZodType<AgentStep>;
198
+ export interface AgentManifest {
199
+ schemaVersion: typeof AGENT_MANIFEST_SCHEMA_VERSION;
200
+ id?: string;
201
+ name?: string;
202
+ description?: string;
203
+ model?: ModelReference;
204
+ variables?: AgentVariableDefinition[];
205
+ connections?: AgentConnectionBinding[];
206
+ steps: AgentStep[];
207
+ limits?: {
208
+ maxSteps?: number;
209
+ maxOutputBytes?: number;
210
+ maxToolCallsPerIteration?: number;
211
+ providerTimeoutMs?: number;
212
+ };
213
+ metadata?: JsonObject;
214
+ extensions?: JsonObject;
215
+ }
216
+ export declare const agentManifestSchema: z.ZodType<AgentManifest>;
217
+ export interface AgentRunManifest {
218
+ schemaVersion: typeof AGENT_RUN_MANIFEST_SCHEMA_VERSION;
219
+ agent: {
220
+ ref: string;
221
+ };
222
+ runId?: string;
223
+ variables?: AgentVariableOverride[];
224
+ execution?: AgentRunExecution;
225
+ }
226
+ export declare const AGENT_RUN_EXECUTION_MODES: readonly ["sequential", "parallel"];
227
+ export type AgentRunExecutionMode = (typeof AGENT_RUN_EXECUTION_MODES)[number];
228
+ export interface AgentRunExecution {
229
+ mode: AgentRunExecutionMode;
230
+ maxConcurrency?: number;
231
+ }
232
+ export declare const agentRunExecutionSchema: z.ZodType<AgentRunExecution>;
233
+ export declare const agentRunManifestSchema: z.ZodType<AgentRunManifest>;
234
+ export interface ExecutionCursor {
235
+ stepIndex: number;
236
+ stepId?: string;
237
+ stepPath?: string;
238
+ loopIteration?: number;
239
+ childIndex?: number;
240
+ }
241
+ export interface StepResult {
242
+ stepId: string;
243
+ stepIndex: number;
244
+ status: "completed";
245
+ output?: JsonValue;
246
+ variables?: VariableState;
247
+ transcript?: TranscriptItem[];
248
+ artifacts?: ArtifactRef[];
249
+ usage?: ModelUsage;
250
+ completedAt: string;
251
+ metadata?: JsonObject;
252
+ }
253
+ export interface RunCheckpoint {
254
+ id: string;
255
+ runId: string;
256
+ sequence: number;
257
+ /** Execution attempt that produced this checkpoint. Defaults to 1 for legacy data. */
258
+ attempt?: number;
259
+ manifestHash: string;
260
+ contractVersion: string;
261
+ runtimeVersion: string;
262
+ cursor: ExecutionCursor;
263
+ state: VariableState;
264
+ stepResults: StepResult[];
265
+ transcript: TranscriptItem[];
266
+ artifacts: ArtifactRef[];
267
+ /** Cumulative content produced by the currently active nested step. */
268
+ activeStepTranscript?: TranscriptItem[];
269
+ activeStepArtifacts?: ArtifactRef[];
270
+ /** Executor-owned, JSON-safe continuation data for an active nested step. */
271
+ continuation?: JsonObject;
272
+ createdAt: string;
273
+ metadata?: JsonObject;
274
+ }
275
+ export interface RunError {
276
+ code: string;
277
+ message: string;
278
+ retryable?: boolean;
279
+ details?: JsonObject;
280
+ stack?: string;
281
+ }
282
+ export declare const artifactRefSchema: z.ZodObject<{
283
+ id: z.ZodString;
284
+ name: z.ZodString;
285
+ mediaType: z.ZodString;
286
+ uri: z.ZodOptional<z.ZodString>;
287
+ size: z.ZodOptional<z.ZodNumber>;
288
+ sha256: z.ZodOptional<z.ZodString>;
289
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
290
+ }, z.core.$strict>;
291
+ export declare const modelUsageSchema: z.ZodObject<{
292
+ inputTokens: z.ZodOptional<z.ZodNumber>;
293
+ outputTokens: z.ZodOptional<z.ZodNumber>;
294
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
295
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
296
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
297
+ totalTokens: z.ZodOptional<z.ZodNumber>;
298
+ estimatedCost: z.ZodOptional<z.ZodNumber>;
299
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
300
+ }, z.core.$strict>;
301
+ export declare const runErrorSchema: z.ZodObject<{
302
+ code: z.ZodString;
303
+ message: z.ZodString;
304
+ retryable: z.ZodOptional<z.ZodBoolean>;
305
+ details: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
306
+ stack: z.ZodOptional<z.ZodString>;
307
+ }, z.core.$strict>;
308
+ export declare const transcriptItemSchema: z.ZodObject<{
309
+ id: z.ZodString;
310
+ type: z.ZodEnum<{
311
+ message: "message";
312
+ error: "error";
313
+ reasoning: "reasoning";
314
+ "tool-call": "tool-call";
315
+ "tool-result": "tool-result";
316
+ artifact: "artifact";
317
+ }>;
318
+ role: z.ZodOptional<z.ZodEnum<{
319
+ system: "system";
320
+ user: "user";
321
+ assistant: "assistant";
322
+ tool: "tool";
323
+ }>>;
324
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
325
+ type: z.ZodLiteral<"text">;
326
+ text: z.ZodString;
327
+ }, z.core.$strict>, z.ZodObject<{
328
+ type: z.ZodLiteral<"reasoning">;
329
+ text: z.ZodOptional<z.ZodString>;
330
+ encrypted: z.ZodOptional<z.ZodString>;
331
+ }, z.core.$strict>, z.ZodObject<{
332
+ type: z.ZodLiteral<"json">;
333
+ value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
334
+ }, z.core.$strict>, z.ZodObject<{
335
+ type: z.ZodLiteral<"image">;
336
+ artifact: z.ZodOptional<z.ZodObject<{
337
+ id: z.ZodString;
338
+ name: z.ZodString;
339
+ mediaType: z.ZodString;
340
+ uri: z.ZodOptional<z.ZodString>;
341
+ size: z.ZodOptional<z.ZodNumber>;
342
+ sha256: z.ZodOptional<z.ZodString>;
343
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
344
+ }, z.core.$strict>>;
345
+ url: z.ZodOptional<z.ZodString>;
346
+ mediaType: z.ZodOptional<z.ZodString>;
347
+ }, z.core.$strict>, z.ZodObject<{
348
+ type: z.ZodLiteral<"file">;
349
+ artifact: z.ZodObject<{
350
+ id: z.ZodString;
351
+ name: z.ZodString;
352
+ mediaType: z.ZodString;
353
+ uri: z.ZodOptional<z.ZodString>;
354
+ size: z.ZodOptional<z.ZodNumber>;
355
+ sha256: z.ZodOptional<z.ZodString>;
356
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
357
+ }, z.core.$strict>;
358
+ }, z.core.$strict>, z.ZodObject<{
359
+ type: z.ZodLiteral<"tool-call">;
360
+ call: z.ZodObject<{
361
+ id: z.ZodString;
362
+ name: z.ZodString;
363
+ input: z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>;
364
+ stepId: z.ZodOptional<z.ZodString>;
365
+ }, z.core.$strict>;
366
+ }, z.core.$strict>, z.ZodObject<{
367
+ type: z.ZodLiteral<"tool-result">;
368
+ result: z.ZodObject<{
369
+ callId: z.ZodString;
370
+ name: z.ZodString;
371
+ output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
372
+ error: z.ZodOptional<z.ZodObject<{
373
+ code: z.ZodString;
374
+ message: z.ZodString;
375
+ retryable: z.ZodOptional<z.ZodBoolean>;
376
+ details: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
377
+ stack: z.ZodOptional<z.ZodString>;
378
+ }, z.core.$strict>>;
379
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
380
+ id: z.ZodString;
381
+ name: z.ZodString;
382
+ mediaType: z.ZodString;
383
+ uri: z.ZodOptional<z.ZodString>;
384
+ size: z.ZodOptional<z.ZodNumber>;
385
+ sha256: z.ZodOptional<z.ZodString>;
386
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
387
+ }, z.core.$strict>>>;
388
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
389
+ }, z.core.$strict>;
390
+ }, z.core.$strict>], "type">>;
391
+ createdAt: z.ZodISODateTime;
392
+ model: z.ZodOptional<z.ZodString>;
393
+ usage: z.ZodOptional<z.ZodObject<{
394
+ inputTokens: z.ZodOptional<z.ZodNumber>;
395
+ outputTokens: z.ZodOptional<z.ZodNumber>;
396
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
397
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
398
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
399
+ totalTokens: z.ZodOptional<z.ZodNumber>;
400
+ estimatedCost: z.ZodOptional<z.ZodNumber>;
401
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
402
+ }, z.core.$strict>>;
403
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
404
+ }, z.core.$strict>;
405
+ export declare const stepResultSchema: z.ZodObject<{
406
+ stepId: z.ZodString;
407
+ stepIndex: z.ZodNumber;
408
+ status: z.ZodLiteral<"completed">;
409
+ output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
410
+ variables: z.ZodOptional<z.ZodType<VariableState, unknown, z.core.$ZodTypeInternals<VariableState, unknown>>>;
411
+ transcript: z.ZodOptional<z.ZodArray<z.ZodObject<{
412
+ id: z.ZodString;
413
+ type: z.ZodEnum<{
414
+ message: "message";
415
+ error: "error";
416
+ reasoning: "reasoning";
417
+ "tool-call": "tool-call";
418
+ "tool-result": "tool-result";
419
+ artifact: "artifact";
420
+ }>;
421
+ role: z.ZodOptional<z.ZodEnum<{
422
+ system: "system";
423
+ user: "user";
424
+ assistant: "assistant";
425
+ tool: "tool";
426
+ }>>;
427
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
428
+ type: z.ZodLiteral<"text">;
429
+ text: z.ZodString;
430
+ }, z.core.$strict>, z.ZodObject<{
431
+ type: z.ZodLiteral<"reasoning">;
432
+ text: z.ZodOptional<z.ZodString>;
433
+ encrypted: z.ZodOptional<z.ZodString>;
434
+ }, z.core.$strict>, z.ZodObject<{
435
+ type: z.ZodLiteral<"json">;
436
+ value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
437
+ }, z.core.$strict>, z.ZodObject<{
438
+ type: z.ZodLiteral<"image">;
439
+ artifact: z.ZodOptional<z.ZodObject<{
440
+ id: z.ZodString;
441
+ name: z.ZodString;
442
+ mediaType: z.ZodString;
443
+ uri: z.ZodOptional<z.ZodString>;
444
+ size: z.ZodOptional<z.ZodNumber>;
445
+ sha256: z.ZodOptional<z.ZodString>;
446
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
447
+ }, z.core.$strict>>;
448
+ url: z.ZodOptional<z.ZodString>;
449
+ mediaType: z.ZodOptional<z.ZodString>;
450
+ }, z.core.$strict>, z.ZodObject<{
451
+ type: z.ZodLiteral<"file">;
452
+ artifact: z.ZodObject<{
453
+ id: z.ZodString;
454
+ name: z.ZodString;
455
+ mediaType: z.ZodString;
456
+ uri: z.ZodOptional<z.ZodString>;
457
+ size: z.ZodOptional<z.ZodNumber>;
458
+ sha256: z.ZodOptional<z.ZodString>;
459
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
460
+ }, z.core.$strict>;
461
+ }, z.core.$strict>, z.ZodObject<{
462
+ type: z.ZodLiteral<"tool-call">;
463
+ call: z.ZodObject<{
464
+ id: z.ZodString;
465
+ name: z.ZodString;
466
+ input: z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>;
467
+ stepId: z.ZodOptional<z.ZodString>;
468
+ }, z.core.$strict>;
469
+ }, z.core.$strict>, z.ZodObject<{
470
+ type: z.ZodLiteral<"tool-result">;
471
+ result: z.ZodObject<{
472
+ callId: z.ZodString;
473
+ name: z.ZodString;
474
+ output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
475
+ error: z.ZodOptional<z.ZodObject<{
476
+ code: z.ZodString;
477
+ message: z.ZodString;
478
+ retryable: z.ZodOptional<z.ZodBoolean>;
479
+ details: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
480
+ stack: z.ZodOptional<z.ZodString>;
481
+ }, z.core.$strict>>;
482
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
483
+ id: z.ZodString;
484
+ name: z.ZodString;
485
+ mediaType: z.ZodString;
486
+ uri: z.ZodOptional<z.ZodString>;
487
+ size: z.ZodOptional<z.ZodNumber>;
488
+ sha256: z.ZodOptional<z.ZodString>;
489
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
490
+ }, z.core.$strict>>>;
491
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
492
+ }, z.core.$strict>;
493
+ }, z.core.$strict>], "type">>;
494
+ createdAt: z.ZodISODateTime;
495
+ model: z.ZodOptional<z.ZodString>;
496
+ usage: z.ZodOptional<z.ZodObject<{
497
+ inputTokens: z.ZodOptional<z.ZodNumber>;
498
+ outputTokens: z.ZodOptional<z.ZodNumber>;
499
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
500
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
501
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
502
+ totalTokens: z.ZodOptional<z.ZodNumber>;
503
+ estimatedCost: z.ZodOptional<z.ZodNumber>;
504
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
505
+ }, z.core.$strict>>;
506
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
507
+ }, z.core.$strict>>>;
508
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
509
+ id: z.ZodString;
510
+ name: z.ZodString;
511
+ mediaType: z.ZodString;
512
+ uri: z.ZodOptional<z.ZodString>;
513
+ size: z.ZodOptional<z.ZodNumber>;
514
+ sha256: z.ZodOptional<z.ZodString>;
515
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
516
+ }, z.core.$strict>>>;
517
+ usage: z.ZodOptional<z.ZodObject<{
518
+ inputTokens: z.ZodOptional<z.ZodNumber>;
519
+ outputTokens: z.ZodOptional<z.ZodNumber>;
520
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
521
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
522
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
523
+ totalTokens: z.ZodOptional<z.ZodNumber>;
524
+ estimatedCost: z.ZodOptional<z.ZodNumber>;
525
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
526
+ }, z.core.$strict>>;
527
+ completedAt: z.ZodISODateTime;
528
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
529
+ }, z.core.$strict>;
530
+ export declare const runCheckpointSchema: z.ZodObject<{
531
+ id: z.ZodString;
532
+ runId: z.ZodString;
533
+ sequence: z.ZodNumber;
534
+ attempt: z.ZodOptional<z.ZodNumber>;
535
+ manifestHash: z.ZodString;
536
+ contractVersion: z.ZodString;
537
+ runtimeVersion: z.ZodString;
538
+ cursor: z.ZodObject<{
539
+ stepIndex: z.ZodNumber;
540
+ stepId: z.ZodOptional<z.ZodString>;
541
+ stepPath: z.ZodOptional<z.ZodString>;
542
+ loopIteration: z.ZodOptional<z.ZodNumber>;
543
+ childIndex: z.ZodOptional<z.ZodNumber>;
544
+ }, z.core.$strict>;
545
+ state: z.ZodType<VariableState, unknown, z.core.$ZodTypeInternals<VariableState, unknown>>;
546
+ stepResults: z.ZodArray<z.ZodObject<{
547
+ stepId: z.ZodString;
548
+ stepIndex: z.ZodNumber;
549
+ status: z.ZodLiteral<"completed">;
550
+ output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
551
+ variables: z.ZodOptional<z.ZodType<VariableState, unknown, z.core.$ZodTypeInternals<VariableState, unknown>>>;
552
+ transcript: z.ZodOptional<z.ZodArray<z.ZodObject<{
553
+ id: z.ZodString;
554
+ type: z.ZodEnum<{
555
+ message: "message";
556
+ error: "error";
557
+ reasoning: "reasoning";
558
+ "tool-call": "tool-call";
559
+ "tool-result": "tool-result";
560
+ artifact: "artifact";
561
+ }>;
562
+ role: z.ZodOptional<z.ZodEnum<{
563
+ system: "system";
564
+ user: "user";
565
+ assistant: "assistant";
566
+ tool: "tool";
567
+ }>>;
568
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
569
+ type: z.ZodLiteral<"text">;
570
+ text: z.ZodString;
571
+ }, z.core.$strict>, z.ZodObject<{
572
+ type: z.ZodLiteral<"reasoning">;
573
+ text: z.ZodOptional<z.ZodString>;
574
+ encrypted: z.ZodOptional<z.ZodString>;
575
+ }, z.core.$strict>, z.ZodObject<{
576
+ type: z.ZodLiteral<"json">;
577
+ value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
578
+ }, z.core.$strict>, z.ZodObject<{
579
+ type: z.ZodLiteral<"image">;
580
+ artifact: z.ZodOptional<z.ZodObject<{
581
+ id: z.ZodString;
582
+ name: z.ZodString;
583
+ mediaType: z.ZodString;
584
+ uri: z.ZodOptional<z.ZodString>;
585
+ size: z.ZodOptional<z.ZodNumber>;
586
+ sha256: z.ZodOptional<z.ZodString>;
587
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
588
+ }, z.core.$strict>>;
589
+ url: z.ZodOptional<z.ZodString>;
590
+ mediaType: z.ZodOptional<z.ZodString>;
591
+ }, z.core.$strict>, z.ZodObject<{
592
+ type: z.ZodLiteral<"file">;
593
+ artifact: z.ZodObject<{
594
+ id: z.ZodString;
595
+ name: z.ZodString;
596
+ mediaType: z.ZodString;
597
+ uri: z.ZodOptional<z.ZodString>;
598
+ size: z.ZodOptional<z.ZodNumber>;
599
+ sha256: z.ZodOptional<z.ZodString>;
600
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
601
+ }, z.core.$strict>;
602
+ }, z.core.$strict>, z.ZodObject<{
603
+ type: z.ZodLiteral<"tool-call">;
604
+ call: z.ZodObject<{
605
+ id: z.ZodString;
606
+ name: z.ZodString;
607
+ input: z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>;
608
+ stepId: z.ZodOptional<z.ZodString>;
609
+ }, z.core.$strict>;
610
+ }, z.core.$strict>, z.ZodObject<{
611
+ type: z.ZodLiteral<"tool-result">;
612
+ result: z.ZodObject<{
613
+ callId: z.ZodString;
614
+ name: z.ZodString;
615
+ output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
616
+ error: z.ZodOptional<z.ZodObject<{
617
+ code: z.ZodString;
618
+ message: z.ZodString;
619
+ retryable: z.ZodOptional<z.ZodBoolean>;
620
+ details: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
621
+ stack: z.ZodOptional<z.ZodString>;
622
+ }, z.core.$strict>>;
623
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
624
+ id: z.ZodString;
625
+ name: z.ZodString;
626
+ mediaType: z.ZodString;
627
+ uri: z.ZodOptional<z.ZodString>;
628
+ size: z.ZodOptional<z.ZodNumber>;
629
+ sha256: z.ZodOptional<z.ZodString>;
630
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
631
+ }, z.core.$strict>>>;
632
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
633
+ }, z.core.$strict>;
634
+ }, z.core.$strict>], "type">>;
635
+ createdAt: z.ZodISODateTime;
636
+ model: z.ZodOptional<z.ZodString>;
637
+ usage: z.ZodOptional<z.ZodObject<{
638
+ inputTokens: z.ZodOptional<z.ZodNumber>;
639
+ outputTokens: z.ZodOptional<z.ZodNumber>;
640
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
641
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
642
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
643
+ totalTokens: z.ZodOptional<z.ZodNumber>;
644
+ estimatedCost: z.ZodOptional<z.ZodNumber>;
645
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
646
+ }, z.core.$strict>>;
647
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
648
+ }, z.core.$strict>>>;
649
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
650
+ id: z.ZodString;
651
+ name: z.ZodString;
652
+ mediaType: z.ZodString;
653
+ uri: z.ZodOptional<z.ZodString>;
654
+ size: z.ZodOptional<z.ZodNumber>;
655
+ sha256: z.ZodOptional<z.ZodString>;
656
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
657
+ }, z.core.$strict>>>;
658
+ usage: z.ZodOptional<z.ZodObject<{
659
+ inputTokens: z.ZodOptional<z.ZodNumber>;
660
+ outputTokens: z.ZodOptional<z.ZodNumber>;
661
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
662
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
663
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
664
+ totalTokens: z.ZodOptional<z.ZodNumber>;
665
+ estimatedCost: z.ZodOptional<z.ZodNumber>;
666
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
667
+ }, z.core.$strict>>;
668
+ completedAt: z.ZodISODateTime;
669
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
670
+ }, z.core.$strict>>;
671
+ transcript: z.ZodArray<z.ZodObject<{
672
+ id: z.ZodString;
673
+ type: z.ZodEnum<{
674
+ message: "message";
675
+ error: "error";
676
+ reasoning: "reasoning";
677
+ "tool-call": "tool-call";
678
+ "tool-result": "tool-result";
679
+ artifact: "artifact";
680
+ }>;
681
+ role: z.ZodOptional<z.ZodEnum<{
682
+ system: "system";
683
+ user: "user";
684
+ assistant: "assistant";
685
+ tool: "tool";
686
+ }>>;
687
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
688
+ type: z.ZodLiteral<"text">;
689
+ text: z.ZodString;
690
+ }, z.core.$strict>, z.ZodObject<{
691
+ type: z.ZodLiteral<"reasoning">;
692
+ text: z.ZodOptional<z.ZodString>;
693
+ encrypted: z.ZodOptional<z.ZodString>;
694
+ }, z.core.$strict>, z.ZodObject<{
695
+ type: z.ZodLiteral<"json">;
696
+ value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
697
+ }, z.core.$strict>, z.ZodObject<{
698
+ type: z.ZodLiteral<"image">;
699
+ artifact: z.ZodOptional<z.ZodObject<{
700
+ id: z.ZodString;
701
+ name: z.ZodString;
702
+ mediaType: z.ZodString;
703
+ uri: z.ZodOptional<z.ZodString>;
704
+ size: z.ZodOptional<z.ZodNumber>;
705
+ sha256: z.ZodOptional<z.ZodString>;
706
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
707
+ }, z.core.$strict>>;
708
+ url: z.ZodOptional<z.ZodString>;
709
+ mediaType: z.ZodOptional<z.ZodString>;
710
+ }, z.core.$strict>, z.ZodObject<{
711
+ type: z.ZodLiteral<"file">;
712
+ artifact: z.ZodObject<{
713
+ id: z.ZodString;
714
+ name: z.ZodString;
715
+ mediaType: z.ZodString;
716
+ uri: z.ZodOptional<z.ZodString>;
717
+ size: z.ZodOptional<z.ZodNumber>;
718
+ sha256: z.ZodOptional<z.ZodString>;
719
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
720
+ }, z.core.$strict>;
721
+ }, z.core.$strict>, z.ZodObject<{
722
+ type: z.ZodLiteral<"tool-call">;
723
+ call: z.ZodObject<{
724
+ id: z.ZodString;
725
+ name: z.ZodString;
726
+ input: z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>;
727
+ stepId: z.ZodOptional<z.ZodString>;
728
+ }, z.core.$strict>;
729
+ }, z.core.$strict>, z.ZodObject<{
730
+ type: z.ZodLiteral<"tool-result">;
731
+ result: z.ZodObject<{
732
+ callId: z.ZodString;
733
+ name: z.ZodString;
734
+ output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
735
+ error: z.ZodOptional<z.ZodObject<{
736
+ code: z.ZodString;
737
+ message: z.ZodString;
738
+ retryable: z.ZodOptional<z.ZodBoolean>;
739
+ details: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
740
+ stack: z.ZodOptional<z.ZodString>;
741
+ }, z.core.$strict>>;
742
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
743
+ id: z.ZodString;
744
+ name: z.ZodString;
745
+ mediaType: z.ZodString;
746
+ uri: z.ZodOptional<z.ZodString>;
747
+ size: z.ZodOptional<z.ZodNumber>;
748
+ sha256: z.ZodOptional<z.ZodString>;
749
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
750
+ }, z.core.$strict>>>;
751
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
752
+ }, z.core.$strict>;
753
+ }, z.core.$strict>], "type">>;
754
+ createdAt: z.ZodISODateTime;
755
+ model: z.ZodOptional<z.ZodString>;
756
+ usage: z.ZodOptional<z.ZodObject<{
757
+ inputTokens: z.ZodOptional<z.ZodNumber>;
758
+ outputTokens: z.ZodOptional<z.ZodNumber>;
759
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
760
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
761
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
762
+ totalTokens: z.ZodOptional<z.ZodNumber>;
763
+ estimatedCost: z.ZodOptional<z.ZodNumber>;
764
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
765
+ }, z.core.$strict>>;
766
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
767
+ }, z.core.$strict>>;
768
+ artifacts: z.ZodArray<z.ZodObject<{
769
+ id: z.ZodString;
770
+ name: z.ZodString;
771
+ mediaType: z.ZodString;
772
+ uri: z.ZodOptional<z.ZodString>;
773
+ size: z.ZodOptional<z.ZodNumber>;
774
+ sha256: z.ZodOptional<z.ZodString>;
775
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
776
+ }, z.core.$strict>>;
777
+ activeStepTranscript: z.ZodOptional<z.ZodArray<z.ZodObject<{
778
+ id: z.ZodString;
779
+ type: z.ZodEnum<{
780
+ message: "message";
781
+ error: "error";
782
+ reasoning: "reasoning";
783
+ "tool-call": "tool-call";
784
+ "tool-result": "tool-result";
785
+ artifact: "artifact";
786
+ }>;
787
+ role: z.ZodOptional<z.ZodEnum<{
788
+ system: "system";
789
+ user: "user";
790
+ assistant: "assistant";
791
+ tool: "tool";
792
+ }>>;
793
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
794
+ type: z.ZodLiteral<"text">;
795
+ text: z.ZodString;
796
+ }, z.core.$strict>, z.ZodObject<{
797
+ type: z.ZodLiteral<"reasoning">;
798
+ text: z.ZodOptional<z.ZodString>;
799
+ encrypted: z.ZodOptional<z.ZodString>;
800
+ }, z.core.$strict>, z.ZodObject<{
801
+ type: z.ZodLiteral<"json">;
802
+ value: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
803
+ }, z.core.$strict>, z.ZodObject<{
804
+ type: z.ZodLiteral<"image">;
805
+ artifact: z.ZodOptional<z.ZodObject<{
806
+ id: z.ZodString;
807
+ name: z.ZodString;
808
+ mediaType: z.ZodString;
809
+ uri: z.ZodOptional<z.ZodString>;
810
+ size: z.ZodOptional<z.ZodNumber>;
811
+ sha256: z.ZodOptional<z.ZodString>;
812
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
813
+ }, z.core.$strict>>;
814
+ url: z.ZodOptional<z.ZodString>;
815
+ mediaType: z.ZodOptional<z.ZodString>;
816
+ }, z.core.$strict>, z.ZodObject<{
817
+ type: z.ZodLiteral<"file">;
818
+ artifact: z.ZodObject<{
819
+ id: z.ZodString;
820
+ name: z.ZodString;
821
+ mediaType: z.ZodString;
822
+ uri: z.ZodOptional<z.ZodString>;
823
+ size: z.ZodOptional<z.ZodNumber>;
824
+ sha256: z.ZodOptional<z.ZodString>;
825
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
826
+ }, z.core.$strict>;
827
+ }, z.core.$strict>, z.ZodObject<{
828
+ type: z.ZodLiteral<"tool-call">;
829
+ call: z.ZodObject<{
830
+ id: z.ZodString;
831
+ name: z.ZodString;
832
+ input: z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>;
833
+ stepId: z.ZodOptional<z.ZodString>;
834
+ }, z.core.$strict>;
835
+ }, z.core.$strict>, z.ZodObject<{
836
+ type: z.ZodLiteral<"tool-result">;
837
+ result: z.ZodObject<{
838
+ callId: z.ZodString;
839
+ name: z.ZodString;
840
+ output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
841
+ error: z.ZodOptional<z.ZodObject<{
842
+ code: z.ZodString;
843
+ message: z.ZodString;
844
+ retryable: z.ZodOptional<z.ZodBoolean>;
845
+ details: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
846
+ stack: z.ZodOptional<z.ZodString>;
847
+ }, z.core.$strict>>;
848
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
849
+ id: z.ZodString;
850
+ name: z.ZodString;
851
+ mediaType: z.ZodString;
852
+ uri: z.ZodOptional<z.ZodString>;
853
+ size: z.ZodOptional<z.ZodNumber>;
854
+ sha256: z.ZodOptional<z.ZodString>;
855
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
856
+ }, z.core.$strict>>>;
857
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
858
+ }, z.core.$strict>;
859
+ }, z.core.$strict>], "type">>;
860
+ createdAt: z.ZodISODateTime;
861
+ model: z.ZodOptional<z.ZodString>;
862
+ usage: z.ZodOptional<z.ZodObject<{
863
+ inputTokens: z.ZodOptional<z.ZodNumber>;
864
+ outputTokens: z.ZodOptional<z.ZodNumber>;
865
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
866
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
867
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
868
+ totalTokens: z.ZodOptional<z.ZodNumber>;
869
+ estimatedCost: z.ZodOptional<z.ZodNumber>;
870
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
871
+ }, z.core.$strict>>;
872
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
873
+ }, z.core.$strict>>>;
874
+ activeStepArtifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
875
+ id: z.ZodString;
876
+ name: z.ZodString;
877
+ mediaType: z.ZodString;
878
+ uri: z.ZodOptional<z.ZodString>;
879
+ size: z.ZodOptional<z.ZodNumber>;
880
+ sha256: z.ZodOptional<z.ZodString>;
881
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
882
+ }, z.core.$strict>>>;
883
+ continuation: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
884
+ createdAt: z.ZodISODateTime;
885
+ metadata: z.ZodOptional<z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
886
+ }, z.core.$strict>;
887
+ export declare const parseRunCheckpoint: (input: unknown) => RunCheckpoint;
888
+ export type RunEventType = "run.started" | "run.resumed" | "run.completed" | "run.failed" | "run.cancelled" | "run.suspended" | "run.heartbeat" | "step.started" | "step.skipped" | "step.completed" | "step.failed" | "checkpoint.saved" | "loop.iteration.started" | "loop.iteration.completed" | "loop.iteration.skipped" | "loop.goal.met" | "approval.requested" | "approval.resolved" | "webhook.attempt.started" | "webhook.attempt.completed" | "webhook.retry.scheduled" | "code.execution.started" | "code.execution.completed" | "sub-run.started" | "sub-run.completed" | "model.started" | "model.text.delta" | "model.reasoning.delta" | "model.tool.requested" | "model.tool.started" | "model.tool.completed" | "model.usage" | "model.completed" | "artifact.created" | "diagnostic";
889
+ export interface RunEvent {
890
+ id: string;
891
+ runId: string;
892
+ sequence: number;
893
+ /** Sequence numbers are monotonic within this atomically reserved attempt. */
894
+ attempt?: number;
895
+ timestamp: string;
896
+ type: RunEventType | (string & {});
897
+ stepId?: string;
898
+ stepPath?: string;
899
+ data?: JsonObject;
900
+ payload?: JsonObject;
901
+ }
902
+ export interface RunResult {
903
+ runId: string;
904
+ output?: JsonValue;
905
+ state: VariableState;
906
+ stepResults: StepResult[];
907
+ transcript: TranscriptItem[];
908
+ artifacts: ArtifactRef[];
909
+ usage?: ModelUsage;
910
+ startedAt: string;
911
+ completedAt: string;
912
+ metadata?: JsonObject;
913
+ }
914
+ export declare const parseAgentManifest: (input: unknown) => AgentManifest;
915
+ export declare const safeParseAgentManifest: (input: unknown) => z.ZodSafeParseResult<AgentManifest>;
916
+ export declare const parseAgentRunManifest: (input: unknown) => AgentRunManifest;
917
+ export declare const safeParseAgentRunManifest: (input: unknown) => z.ZodSafeParseResult<AgentRunManifest>;