@ag-ui/core 0.1.1-canary.beta.0 → 1.0.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/dist/schemas.js CHANGED
@@ -1,160 +1,477 @@
1
- const require_events = require('./events-CMtdFXWl.js');
1
+ const require_version = require('./version-BIes0ykB.js');
2
2
  let zod_v4 = require("zod/v4");
3
3
 
4
- //#region src/schemas.ts
5
- const EventTypeSchema = zod_v4.z.enum([
6
- "TEXT_MESSAGE_START",
7
- "TEXT_MESSAGE_CONTENT",
8
- "TEXT_MESSAGE_END",
9
- "TEXT_MESSAGE_CHUNK",
10
- "TOOL_CALL_START",
11
- "TOOL_CALL_ARGS",
12
- "TOOL_CALL_END",
13
- "TOOL_CALL_CHUNK",
14
- "TOOL_CALL_RESULT",
15
- "THINKING_START",
16
- "THINKING_END",
17
- "THINKING_TEXT_MESSAGE_START",
18
- "THINKING_TEXT_MESSAGE_CONTENT",
19
- "THINKING_TEXT_MESSAGE_END",
20
- "STATE_SNAPSHOT",
21
- "STATE_DELTA",
22
- "MESSAGES_SNAPSHOT",
23
- "ACTIVITY_SNAPSHOT",
24
- "ACTIVITY_DELTA",
25
- "RAW",
26
- "CUSTOM",
27
- "RUN_STARTED",
28
- "RUN_FINISHED",
29
- "RUN_ERROR",
30
- "STEP_STARTED",
31
- "STEP_FINISHED",
32
- "REASONING_START",
33
- "REASONING_MESSAGE_START",
34
- "REASONING_MESSAGE_CONTENT",
35
- "REASONING_MESSAGE_END",
36
- "REASONING_MESSAGE_CHUNK",
37
- "REASONING_END",
38
- "REASONING_ENCRYPTED_VALUE"
4
+ //#region src/generated/schemas.ts
5
+ /**
6
+ * The discriminator carried by every event.
7
+ */
8
+ const EventTypeSchema = zod_v4.z.enum(require_version.EventType);
9
+ /**
10
+ * Extra information attached to an event, a message, a tool call, a tool, an
11
+ * interrupt or a resume entry. Open by key: any JSON value is allowed under a
12
+ * key, including null, because a null there is meaningful data. The object
13
+ * itself may be absent but is never null when present. The key ag-ui is
14
+ * reserved for the protocol's own use; reservation is by convention, since
15
+ * validating the shape of a key's value would contradict being open by key.
16
+ */
17
+ const MetadataSchema = zod_v4.z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value));
18
+ /**
19
+ * An opaque handle for one subagent invocation, not a reusable name for a
20
+ * subagent definition: two invocations of the same subagent carry two
21
+ * different values. Named to mirror runId one level down, the way the
22
+ * subagent's name mirrors agentId.
23
+ */
24
+ const SubagentRunIdSchema = zod_v4.z.string();
25
+ /**
26
+ * The roles a streamed text message may take. Excludes tool, which is carried
27
+ * by TOOL_CALL_RESULT rather than streamed as text.
28
+ */
29
+ const TextMessageRoleSchema = zod_v4.z.enum([
30
+ "developer",
31
+ "system",
32
+ "assistant",
33
+ "user"
39
34
  ]);
40
- const FunctionCallSchema = zod_v4.z.object({
41
- name: zod_v4.z.string(),
42
- arguments: zod_v4.z.string()
35
+ /**
36
+ * Opens a streamed text message. The content arrives as TEXT_MESSAGE_CONTENT
37
+ * events and the message closes with TEXT_MESSAGE_END.
38
+ */
39
+ const TextMessageStartEventSchema = zod_v4.z.looseObject({
40
+ type: zod_v4.z.literal(require_version.EventType.TEXT_MESSAGE_START),
41
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
42
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
43
+ metadata: MetadataSchema.optional(),
44
+ subagentRunId: SubagentRunIdSchema.optional(),
45
+ messageId: zod_v4.z.string(),
46
+ role: TextMessageRoleSchema.optional(),
47
+ name: zod_v4.z.string().optional()
43
48
  });
44
- const ToolCallSchema = zod_v4.z.object({
45
- id: zod_v4.z.string(),
46
- type: zod_v4.z.literal("function"),
47
- function: FunctionCallSchema,
48
- encryptedValue: zod_v4.z.string().optional()
49
+ /**
50
+ * Appends a fragment to a streamed text message.
51
+ */
52
+ const TextMessageContentEventSchema = zod_v4.z.looseObject({
53
+ type: zod_v4.z.literal(require_version.EventType.TEXT_MESSAGE_CONTENT),
54
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
55
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
56
+ metadata: MetadataSchema.optional(),
57
+ subagentRunId: SubagentRunIdSchema.optional(),
58
+ messageId: zod_v4.z.string(),
59
+ delta: zod_v4.z.string()
60
+ });
61
+ /**
62
+ * Closes a streamed text message.
63
+ */
64
+ const TextMessageEndEventSchema = zod_v4.z.looseObject({
65
+ type: zod_v4.z.literal(require_version.EventType.TEXT_MESSAGE_END),
66
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
67
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
68
+ metadata: MetadataSchema.optional(),
69
+ subagentRunId: SubagentRunIdSchema.optional(),
70
+ messageId: zod_v4.z.string()
49
71
  });
50
- const TextInputContentSchema = zod_v4.z.object({
72
+ /**
73
+ * A shorthand that stands in for a start, content and end sequence, for
74
+ * producers that cannot know in advance where a message begins. Every field is
75
+ * optional because a continuation chunk omits what has not changed; which
76
+ * message a field-less chunk continues is a sequence question the prose
77
+ * specification answers.
78
+ */
79
+ const TextMessageChunkEventSchema = zod_v4.z.looseObject({
80
+ type: zod_v4.z.literal(require_version.EventType.TEXT_MESSAGE_CHUNK),
81
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
82
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
83
+ metadata: MetadataSchema.optional(),
84
+ subagentRunId: SubagentRunIdSchema.optional(),
85
+ messageId: zod_v4.z.string().optional(),
86
+ role: TextMessageRoleSchema.optional(),
87
+ delta: zod_v4.z.string().optional(),
88
+ name: zod_v4.z.string().optional()
89
+ });
90
+ /**
91
+ * Opens a tool call. The arguments arrive as TOOL_CALL_ARGS events and the
92
+ * call closes with TOOL_CALL_END.
93
+ */
94
+ const ToolCallStartEventSchema = zod_v4.z.looseObject({
95
+ type: zod_v4.z.literal(require_version.EventType.TOOL_CALL_START),
96
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
97
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
98
+ metadata: MetadataSchema.optional(),
99
+ subagentRunId: SubagentRunIdSchema.optional(),
100
+ toolCallId: zod_v4.z.string(),
101
+ toolCallName: zod_v4.z.string(),
102
+ parentMessageId: zod_v4.z.string().optional()
103
+ });
104
+ /**
105
+ * Appends a fragment of a tool call's arguments.
106
+ */
107
+ const ToolCallArgsEventSchema = zod_v4.z.looseObject({
108
+ type: zod_v4.z.literal(require_version.EventType.TOOL_CALL_ARGS),
109
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
110
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
111
+ metadata: MetadataSchema.optional(),
112
+ subagentRunId: SubagentRunIdSchema.optional(),
113
+ toolCallId: zod_v4.z.string(),
114
+ delta: zod_v4.z.string()
115
+ });
116
+ /**
117
+ * Closes a tool call, meaning its arguments are complete.
118
+ */
119
+ const ToolCallEndEventSchema = zod_v4.z.looseObject({
120
+ type: zod_v4.z.literal(require_version.EventType.TOOL_CALL_END),
121
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
122
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
123
+ metadata: MetadataSchema.optional(),
124
+ subagentRunId: SubagentRunIdSchema.optional(),
125
+ toolCallId: zod_v4.z.string()
126
+ });
127
+ /**
128
+ * A shorthand that stands in for a tool call's start, args and end sequence.
129
+ * Every field is optional for the same reason as TEXT_MESSAGE_CHUNK.
130
+ */
131
+ const ToolCallChunkEventSchema = zod_v4.z.looseObject({
132
+ type: zod_v4.z.literal(require_version.EventType.TOOL_CALL_CHUNK),
133
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
134
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
135
+ metadata: MetadataSchema.optional(),
136
+ subagentRunId: SubagentRunIdSchema.optional(),
137
+ toolCallId: zod_v4.z.string().optional(),
138
+ toolCallName: zod_v4.z.string().optional(),
139
+ parentMessageId: zod_v4.z.string().optional(),
140
+ delta: zod_v4.z.string().optional()
141
+ });
142
+ /**
143
+ * A text part.
144
+ */
145
+ const TextPartSchema = zod_v4.z.looseObject({
51
146
  type: zod_v4.z.literal("text"),
52
- text: zod_v4.z.string()
147
+ id: zod_v4.z.string().optional(),
148
+ text: zod_v4.z.string(),
149
+ metadata: zod_v4.z.any().refine((value) => value !== null).optional()
53
150
  });
54
- const InputContentDataSourceSchema = zod_v4.z.object({
151
+ /**
152
+ * Bytes carried inline.
153
+ */
154
+ const DataSourceSchema = zod_v4.z.looseObject({
55
155
  type: zod_v4.z.literal("data"),
56
156
  value: zod_v4.z.string(),
57
157
  mimeType: zod_v4.z.string()
58
158
  });
59
- const InputContentUrlSourceSchema = zod_v4.z.object({
159
+ /**
160
+ * Bytes referenced by URL, fetched by whoever needs them.
161
+ */
162
+ const UrlSourceSchema = zod_v4.z.looseObject({
60
163
  type: zod_v4.z.literal("url"),
61
164
  value: zod_v4.z.string(),
62
165
  mimeType: zod_v4.z.string().optional()
63
166
  });
64
- const InputContentSourceSchema = zod_v4.z.discriminatedUnion("type", [InputContentDataSourceSchema, InputContentUrlSourceSchema]);
65
- const ImageInputContentSchema = zod_v4.z.object({
167
+ /**
168
+ * Bytes already at the provider, named by a handle the provider issued: an
169
+ * OpenAI or Anthropic file id, a Gemini file URI, a storage URL only that
170
+ * provider can read. No bytes travel and nothing is fetched. Only the provider
171
+ * that minted the handle can resolve it; a peer that cannot drops the part as
172
+ * it drops any part it cannot use.
173
+ */
174
+ const FileSourceSchema = zod_v4.z.looseObject({
175
+ type: zod_v4.z.literal("file"),
176
+ value: zod_v4.z.string(),
177
+ provider: zod_v4.z.string().optional(),
178
+ mimeType: zod_v4.z.string().optional()
179
+ });
180
+ /**
181
+ * Where a media part's bytes come from: carried inline, referenced by URL, or
182
+ * already at the provider under a handle it issued.
183
+ */
184
+ const PartSourceSchema = zod_v4.z.discriminatedUnion("type", [
185
+ DataSourceSchema,
186
+ UrlSourceSchema,
187
+ FileSourceSchema
188
+ ]);
189
+ /**
190
+ * An image part.
191
+ */
192
+ const ImagePartSchema = zod_v4.z.looseObject({
66
193
  type: zod_v4.z.literal("image"),
67
- source: InputContentSourceSchema,
68
- metadata: zod_v4.z.unknown().optional()
194
+ id: zod_v4.z.string().optional(),
195
+ source: PartSourceSchema,
196
+ metadata: zod_v4.z.any().refine((value) => value !== null).optional()
69
197
  });
70
- const AudioInputContentSchema = zod_v4.z.object({
198
+ /**
199
+ * An audio part.
200
+ */
201
+ const AudioPartSchema = zod_v4.z.looseObject({
71
202
  type: zod_v4.z.literal("audio"),
72
- source: InputContentSourceSchema,
73
- metadata: zod_v4.z.unknown().optional()
203
+ id: zod_v4.z.string().optional(),
204
+ source: PartSourceSchema,
205
+ metadata: zod_v4.z.any().refine((value) => value !== null).optional()
74
206
  });
75
- const VideoInputContentSchema = zod_v4.z.object({
207
+ /**
208
+ * A video part.
209
+ */
210
+ const VideoPartSchema = zod_v4.z.looseObject({
76
211
  type: zod_v4.z.literal("video"),
77
- source: InputContentSourceSchema,
78
- metadata: zod_v4.z.unknown().optional()
212
+ id: zod_v4.z.string().optional(),
213
+ source: PartSourceSchema,
214
+ metadata: zod_v4.z.any().refine((value) => value !== null).optional()
79
215
  });
80
- const DocumentInputContentSchema = zod_v4.z.object({
216
+ /**
217
+ * A document part.
218
+ */
219
+ const DocumentPartSchema = zod_v4.z.looseObject({
81
220
  type: zod_v4.z.literal("document"),
82
- source: InputContentSourceSchema,
83
- metadata: zod_v4.z.unknown().optional()
84
- });
85
- const ImageInputPartSchema = ImageInputContentSchema;
86
- const AudioInputPartSchema = AudioInputContentSchema;
87
- const VideoInputPartSchema = VideoInputContentSchema;
88
- const DocumentInputPartSchema = DocumentInputContentSchema;
89
- const BinaryInputContentSchema = zod_v4.z.object({
90
- type: zod_v4.z.literal("binary"),
91
- mimeType: zod_v4.z.string(),
92
221
  id: zod_v4.z.string().optional(),
93
- url: zod_v4.z.string().optional(),
94
- data: zod_v4.z.string().optional(),
95
- filename: zod_v4.z.string().optional()
96
- }).refine((value) => Boolean(value.id || value.url || value.data), { message: "BinaryInputContent requires at least one of id, url, or data." });
97
- const InputContentSchema = zod_v4.z.discriminatedUnion("type", [
98
- TextInputContentSchema,
99
- ImageInputContentSchema,
100
- AudioInputContentSchema,
101
- VideoInputContentSchema,
102
- DocumentInputContentSchema,
103
- zod_v4.z.object({
104
- type: zod_v4.z.literal("binary"),
105
- mimeType: zod_v4.z.string(),
106
- id: zod_v4.z.string().optional(),
107
- url: zod_v4.z.string().optional(),
108
- data: zod_v4.z.string().optional(),
109
- filename: zod_v4.z.string().optional()
110
- })
111
- ]).refine((value) => {
112
- if (value.type === "binary") return Boolean(value.id || value.url || value.data);
113
- return true;
114
- }, { message: "BinaryInputContent requires at least one of id, url, or data." });
115
- const InputContentPartSchema = InputContentSchema;
116
- const BaseMessageSchema = zod_v4.z.object({
117
- id: zod_v4.z.string(),
118
- name: zod_v4.z.string().optional(),
119
- encryptedValue: zod_v4.z.string().optional()
222
+ source: PartSourceSchema,
223
+ metadata: zod_v4.z.any().refine((value) => value !== null).optional()
120
224
  });
121
- const DeveloperMessageSchema = BaseMessageSchema.extend({
225
+ /**
226
+ * One part of a message body: what a person sends in a user message, or what a
227
+ * tool returns in a tool message. Discriminated by type. Named by what the
228
+ * part is rather than by direction, because the same part travels into the
229
+ * model inside a user message and back out of the stream inside a tool result.
230
+ */
231
+ const ContentPartSchema = zod_v4.z.discriminatedUnion("type", [
232
+ TextPartSchema,
233
+ ImagePartSchema,
234
+ AudioPartSchema,
235
+ VideoPartSchema,
236
+ DocumentPartSchema
237
+ ]);
238
+ /**
239
+ * Carries what a tool returned. Mints a tool message rather than appending to
240
+ * an existing one, which is why it has its own messageId.
241
+ */
242
+ const ToolCallResultEventSchema = zod_v4.z.looseObject({
243
+ type: zod_v4.z.literal(require_version.EventType.TOOL_CALL_RESULT),
244
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
245
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
246
+ metadata: MetadataSchema.optional(),
247
+ subagentRunId: SubagentRunIdSchema.optional(),
248
+ messageId: zod_v4.z.string(),
249
+ toolCallId: zod_v4.z.string(),
250
+ content: zod_v4.z.union([zod_v4.z.string(), zod_v4.z.array(ContentPartSchema)]),
251
+ role: zod_v4.z.literal("tool").optional()
252
+ });
253
+ /**
254
+ * Agent state. Any JSON value: the protocol carries state without interpreting
255
+ * it, so an object, an array, a string and a number are all valid.
256
+ */
257
+ const StateSchema = zod_v4.z.any();
258
+ /**
259
+ * Replaces the agent state wholesale. Sent when a delta cannot express the
260
+ * change, or to resynchronise a consumer.
261
+ */
262
+ const StateSnapshotEventSchema = zod_v4.z.looseObject({
263
+ type: zod_v4.z.literal(require_version.EventType.STATE_SNAPSHOT),
264
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
265
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
266
+ metadata: MetadataSchema.optional(),
267
+ subagentRunId: SubagentRunIdSchema.optional(),
268
+ snapshot: StateSchema.refine((value) => value !== void 0)
269
+ });
270
+ /**
271
+ * A JSON Pointer as defined by RFC 6901. Either the empty string, meaning the
272
+ * whole document, or a sequence of slash-prefixed reference tokens in which a
273
+ * tilde is escaped as ~0 and a slash as ~1. A value with no leading slash, or
274
+ * a tilde followed by anything other than 0 or 1, is not a JSON Pointer.
275
+ */
276
+ const JsonPointerSchema = zod_v4.z.string().regex(/* @__PURE__ */ new RegExp("^(/([^/~]|~[01])*)*$"));
277
+ /**
278
+ * Inserts value at path. RFC 6902 section 4.1.
279
+ */
280
+ const AddOperationSchema = zod_v4.z.looseObject({
281
+ op: zod_v4.z.literal("add"),
282
+ path: JsonPointerSchema,
283
+ value: zod_v4.z.any().refine((value) => value !== void 0)
284
+ }).meta({ specOpen: true });
285
+ /**
286
+ * Removes the value at path. RFC 6902 section 4.2.
287
+ */
288
+ const RemoveOperationSchema = zod_v4.z.looseObject({
289
+ op: zod_v4.z.literal("remove"),
290
+ path: JsonPointerSchema
291
+ }).meta({ specOpen: true });
292
+ /**
293
+ * Replaces the value at path. RFC 6902 section 4.3.
294
+ */
295
+ const ReplaceOperationSchema = zod_v4.z.looseObject({
296
+ op: zod_v4.z.literal("replace"),
297
+ path: JsonPointerSchema,
298
+ value: zod_v4.z.any().refine((value) => value !== void 0)
299
+ }).meta({ specOpen: true });
300
+ /**
301
+ * Moves the value at from to path. RFC 6902 section 4.4.
302
+ */
303
+ const MoveOperationSchema = zod_v4.z.looseObject({
304
+ op: zod_v4.z.literal("move"),
305
+ from: JsonPointerSchema,
306
+ path: JsonPointerSchema
307
+ }).meta({ specOpen: true });
308
+ /**
309
+ * Copies the value at from to path. RFC 6902 section 4.5.
310
+ */
311
+ const CopyOperationSchema = zod_v4.z.looseObject({
312
+ op: zod_v4.z.literal("copy"),
313
+ from: JsonPointerSchema,
314
+ path: JsonPointerSchema
315
+ }).meta({ specOpen: true });
316
+ /**
317
+ * Asserts that the value at path equals value. RFC 6902 section 4.6.
318
+ */
319
+ const TestOperationSchema = zod_v4.z.looseObject({
320
+ op: zod_v4.z.literal("test"),
321
+ path: JsonPointerSchema,
322
+ value: zod_v4.z.any().refine((value) => value !== void 0)
323
+ }).meta({ specOpen: true });
324
+ /**
325
+ * A single RFC 6902 operation. Exactly one of the operation shapes must match,
326
+ * discriminated by op. Unlike the protocol's own objects, the operations are
327
+ * open: RFC 6902 section 4 requires members an operation does not define to be
328
+ * ignored rather than rejected, so a remove carrying a leftover value is a
329
+ * valid patch. Two of the RFC's rules are relations between values rather than
330
+ * shapes, so no static schema can express them and neither is checked here: a
331
+ * move whose from is a proper prefix of its path (section 4.4), and any
332
+ * operation whose pointer does not resolve in the target document. Both are
333
+ * the applier's to reject.
334
+ */
335
+ const JsonPatchOperationSchema = zod_v4.z.discriminatedUnion("op", [
336
+ AddOperationSchema,
337
+ RemoveOperationSchema,
338
+ ReplaceOperationSchema,
339
+ MoveOperationSchema,
340
+ CopyOperationSchema,
341
+ TestOperationSchema
342
+ ]);
343
+ /**
344
+ * A JSON Patch document as defined by RFC 6902, referenced by
345
+ * STATE_DELTA.delta and ACTIVITY_DELTA.patch: an ordered sequence of
346
+ * operations applied to a target document. An empty array is a valid no-op
347
+ * patch. Whether the operations actually apply to the document they target is
348
+ * a runtime question RFC 6902 leaves to the applier; structural validity here
349
+ * says nothing about it.
350
+ */
351
+ const JsonPatchSchema = zod_v4.z.array(JsonPatchOperationSchema);
352
+ /**
353
+ * Changes the agent state incrementally.
354
+ */
355
+ const StateDeltaEventSchema = zod_v4.z.looseObject({
356
+ type: zod_v4.z.literal(require_version.EventType.STATE_DELTA),
357
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
358
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
359
+ metadata: MetadataSchema.optional(),
360
+ subagentRunId: SubagentRunIdSchema.optional(),
361
+ delta: JsonPatchSchema
362
+ });
363
+ /**
364
+ * Instructions from the application developer.
365
+ */
366
+ const DeveloperMessageSchema = zod_v4.z.looseObject({
367
+ subagentRunId: SubagentRunIdSchema.optional(),
368
+ id: zod_v4.z.string(),
122
369
  role: zod_v4.z.literal("developer"),
370
+ name: zod_v4.z.string().optional(),
371
+ encryptedValue: zod_v4.z.string().optional(),
372
+ metadata: MetadataSchema.optional(),
123
373
  content: zod_v4.z.string()
124
374
  });
125
- const SystemMessageSchema = BaseMessageSchema.extend({
375
+ /**
376
+ * Instructions from the system.
377
+ */
378
+ const SystemMessageSchema = zod_v4.z.looseObject({
379
+ subagentRunId: SubagentRunIdSchema.optional(),
380
+ id: zod_v4.z.string(),
126
381
  role: zod_v4.z.literal("system"),
382
+ name: zod_v4.z.string().optional(),
383
+ encryptedValue: zod_v4.z.string().optional(),
384
+ metadata: MetadataSchema.optional(),
127
385
  content: zod_v4.z.string()
128
386
  });
129
- const AssistantMessageSchema = BaseMessageSchema.extend({
387
+ /**
388
+ * The name and arguments of a tool call.
389
+ */
390
+ const FunctionCallSchema = zod_v4.z.looseObject({
391
+ name: zod_v4.z.string(),
392
+ arguments: zod_v4.z.string()
393
+ });
394
+ /**
395
+ * A call an assistant message made. Carries no subagent attribution of its own
396
+ * and inherits its containing message's, since several calls can share one
397
+ * parent.
398
+ */
399
+ const ToolCallSchema = zod_v4.z.looseObject({
400
+ id: zod_v4.z.string(),
401
+ type: zod_v4.z.literal("function"),
402
+ function: FunctionCallSchema,
403
+ encryptedValue: zod_v4.z.string().optional(),
404
+ metadata: MetadataSchema.optional()
405
+ });
406
+ /**
407
+ * A message from the agent. Content is optional because a turn may consist
408
+ * only of tool calls.
409
+ */
410
+ const AssistantMessageSchema = zod_v4.z.looseObject({
411
+ subagentRunId: SubagentRunIdSchema.optional(),
412
+ id: zod_v4.z.string(),
130
413
  role: zod_v4.z.literal("assistant"),
414
+ name: zod_v4.z.string().optional(),
415
+ encryptedValue: zod_v4.z.string().optional(),
416
+ metadata: MetadataSchema.optional(),
131
417
  content: zod_v4.z.string().optional(),
132
418
  toolCalls: zod_v4.z.array(ToolCallSchema).optional()
133
419
  });
134
- const UserMessageSchema = BaseMessageSchema.extend({
420
+ /**
421
+ * A message from the person using the application.
422
+ */
423
+ const UserMessageSchema = zod_v4.z.looseObject({
424
+ subagentRunId: SubagentRunIdSchema.optional(),
425
+ id: zod_v4.z.string(),
135
426
  role: zod_v4.z.literal("user"),
136
- content: zod_v4.z.union([zod_v4.z.string(), zod_v4.z.array(InputContentSchema)])
427
+ name: zod_v4.z.string().optional(),
428
+ encryptedValue: zod_v4.z.string().optional(),
429
+ metadata: MetadataSchema.optional(),
430
+ content: zod_v4.z.union([zod_v4.z.string(), zod_v4.z.array(ContentPartSchema)])
137
431
  });
138
- const ToolMessageSchema = zod_v4.z.object({
432
+ /**
433
+ * What a tool returned, as a message in the conversation. Stands alone rather
434
+ * than composing BaseMessage, because it carries no name.
435
+ */
436
+ const ToolMessageSchema = zod_v4.z.looseObject({
437
+ subagentRunId: SubagentRunIdSchema.optional(),
139
438
  id: zod_v4.z.string(),
140
- content: zod_v4.z.string(),
141
439
  role: zod_v4.z.literal("tool"),
440
+ content: zod_v4.z.union([zod_v4.z.string(), zod_v4.z.array(ContentPartSchema)]),
142
441
  toolCallId: zod_v4.z.string(),
143
442
  error: zod_v4.z.string().optional(),
144
- encryptedValue: zod_v4.z.string().optional()
443
+ encryptedValue: zod_v4.z.string().optional(),
444
+ metadata: MetadataSchema.optional()
145
445
  });
146
- const ActivityMessageSchema = zod_v4.z.object({
446
+ /**
447
+ * Structured progress that is not conversation content, materialised as a
448
+ * message so it keeps its place in the sequence. Stands alone rather than
449
+ * composing BaseMessage, because its content is an object rather than a
450
+ * string.
451
+ */
452
+ const ActivityMessageSchema = zod_v4.z.looseObject({
453
+ subagentRunId: SubagentRunIdSchema.optional(),
147
454
  id: zod_v4.z.string(),
148
455
  role: zod_v4.z.literal("activity"),
149
456
  activityType: zod_v4.z.string(),
150
- content: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.any())
457
+ content: zod_v4.z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value)),
458
+ metadata: MetadataSchema.optional()
151
459
  });
152
- const ReasoningMessageSchema = zod_v4.z.object({
460
+ /**
461
+ * A span of the agent's reasoning, materialised as a message. Stands alone
462
+ * rather than composing BaseMessage, because it carries no name.
463
+ */
464
+ const ReasoningMessageSchema = zod_v4.z.looseObject({
465
+ subagentRunId: SubagentRunIdSchema.optional(),
153
466
  id: zod_v4.z.string(),
154
467
  role: zod_v4.z.literal("reasoning"),
155
468
  content: zod_v4.z.string(),
156
- encryptedValue: zod_v4.z.string().optional()
469
+ encryptedValue: zod_v4.z.string().optional(),
470
+ metadata: MetadataSchema.optional()
157
471
  });
472
+ /**
473
+ * Any message in a conversation. Discriminated by role.
474
+ */
158
475
  const MessageSchema = zod_v4.z.discriminatedUnion("role", [
159
476
  DeveloperMessageSchema,
160
477
  SystemMessageSchema,
@@ -164,255 +481,421 @@ const MessageSchema = zod_v4.z.discriminatedUnion("role", [
164
481
  ActivityMessageSchema,
165
482
  ReasoningMessageSchema
166
483
  ]);
167
- const RoleSchema = zod_v4.z.union([
168
- zod_v4.z.literal("developer"),
169
- zod_v4.z.literal("system"),
170
- zod_v4.z.literal("assistant"),
171
- zod_v4.z.literal("user"),
172
- zod_v4.z.literal("tool"),
173
- zod_v4.z.literal("activity"),
174
- zod_v4.z.literal("reasoning")
175
- ]);
176
- const ContextSchema = zod_v4.z.object({
177
- description: zod_v4.z.string(),
178
- value: zod_v4.z.string()
484
+ /**
485
+ * The complete set of messages the producer owns, in order. Conversation-wide
486
+ * rather than a plain overwrite: a consumer may keep messages of its own that
487
+ * no producer tracks, so exactly how a snapshot reconciles with those is
488
+ * behavioural and belongs in the prose. Being conversation-wide it cannot
489
+ * belong to a single subagent, so it carries no attribution; it does establish
490
+ * which subagent owns each message it contains, through the messages
491
+ * themselves.
492
+ */
493
+ const MessagesSnapshotEventSchema = zod_v4.z.looseObject({
494
+ type: zod_v4.z.literal(require_version.EventType.MESSAGES_SNAPSHOT),
495
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
496
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
497
+ metadata: MetadataSchema.optional(),
498
+ messages: zod_v4.z.array(MessageSchema)
499
+ });
500
+ /**
501
+ * Reports structured progress that is not conversation content, such as a step
502
+ * a UI renders as its own widget.
503
+ */
504
+ const ActivitySnapshotEventSchema = zod_v4.z.looseObject({
505
+ type: zod_v4.z.literal(require_version.EventType.ACTIVITY_SNAPSHOT),
506
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
507
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
508
+ metadata: MetadataSchema.optional(),
509
+ subagentRunId: SubagentRunIdSchema.optional(),
510
+ messageId: zod_v4.z.string(),
511
+ activityType: zod_v4.z.string(),
512
+ content: zod_v4.z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value)),
513
+ replace: zod_v4.z.boolean().optional()
514
+ });
515
+ /**
516
+ * Changes an activity message's content incrementally.
517
+ */
518
+ const ActivityDeltaEventSchema = zod_v4.z.looseObject({
519
+ type: zod_v4.z.literal(require_version.EventType.ACTIVITY_DELTA),
520
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
521
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
522
+ metadata: MetadataSchema.optional(),
523
+ subagentRunId: SubagentRunIdSchema.optional(),
524
+ messageId: zod_v4.z.string(),
525
+ activityType: zod_v4.z.string(),
526
+ patch: JsonPatchSchema
527
+ });
528
+ /**
529
+ * Passes a provider-native event through untranslated, for consumers that need
530
+ * detail the protocol does not model.
531
+ */
532
+ const RawEventSchema = zod_v4.z.looseObject({
533
+ type: zod_v4.z.literal(require_version.EventType.RAW),
534
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
535
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
536
+ metadata: MetadataSchema.optional(),
537
+ subagentRunId: SubagentRunIdSchema.optional(),
538
+ event: zod_v4.z.any().refine((value) => value !== void 0),
539
+ source: zod_v4.z.string().optional()
179
540
  });
180
- const ToolSchema = zod_v4.z.object({
541
+ /**
542
+ * The protocol's extension point for an application's own events. Anything a
543
+ * consumer does with one is outside the protocol.
544
+ */
545
+ const CustomEventSchema = zod_v4.z.looseObject({
546
+ type: zod_v4.z.literal(require_version.EventType.CUSTOM),
547
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
548
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
549
+ metadata: MetadataSchema.optional(),
550
+ subagentRunId: SubagentRunIdSchema.optional(),
551
+ name: zod_v4.z.string(),
552
+ value: zod_v4.z.any().refine((value) => value !== void 0)
553
+ });
554
+ /**
555
+ * A tool the agent may call.
556
+ */
557
+ const ToolSchema = zod_v4.z.looseObject({
181
558
  name: zod_v4.z.string(),
182
559
  description: zod_v4.z.string(),
183
- parameters: zod_v4.z.any().optional(),
184
- metadata: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.any()).optional()
560
+ parameters: zod_v4.z.any().refine((value) => value !== null).optional(),
561
+ metadata: MetadataSchema.optional()
185
562
  });
186
- const InterruptSchema = zod_v4.z.object({
187
- id: zod_v4.z.string(),
188
- reason: zod_v4.z.string(),
189
- message: zod_v4.z.string().optional(),
190
- toolCallId: zod_v4.z.string().optional(),
191
- responseSchema: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.any()).optional(),
192
- expiresAt: zod_v4.z.string().optional(),
193
- metadata: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.any()).optional()
563
+ /**
564
+ * A named piece of ambient information given to the agent for the run,
565
+ * distinct from the conversation.
566
+ */
567
+ const ContextSchema = zod_v4.z.looseObject({
568
+ description: zod_v4.z.string(),
569
+ value: zod_v4.z.string()
194
570
  });
195
- const ResumeEntrySchema = zod_v4.z.object({
571
+ /**
572
+ * An answer to one interrupt, sent on the run that continues from it.
573
+ */
574
+ const ResumeEntrySchema = zod_v4.z.looseObject({
196
575
  interruptId: zod_v4.z.string(),
197
576
  status: zod_v4.z.enum(["resolved", "cancelled"]),
198
- payload: zod_v4.z.any().optional()
577
+ payload: zod_v4.z.any().refine((value) => value !== null).optional(),
578
+ metadata: MetadataSchema.optional()
199
579
  });
200
- const RunAgentInputSchema = zod_v4.z.object({
580
+ /**
581
+ * A request to run an agent. Also echoed back as RUN_STARTED.input. Only
582
+ * threadId, runId and messages are required: those are the three the SDKs
583
+ * already agree on, and for tools and context an absent key and an empty array
584
+ * mean the same thing, so requiring them would catch nothing a producer could
585
+ * get wrong.
586
+ */
587
+ const RunAgentInputSchema = zod_v4.z.looseObject({
201
588
  threadId: zod_v4.z.string(),
202
589
  runId: zod_v4.z.string(),
590
+ protocolVersion: zod_v4.z.string().optional(),
203
591
  parentRunId: zod_v4.z.string().optional(),
204
- state: zod_v4.z.any().optional(),
592
+ state: StateSchema.refine((value) => value !== null).nullable().transform((value) => value ?? void 0).optional(),
205
593
  messages: zod_v4.z.array(MessageSchema),
206
- tools: zod_v4.z.array(ToolSchema),
207
- context: zod_v4.z.array(ContextSchema),
208
- forwardedProps: zod_v4.z.any().optional(),
594
+ tools: zod_v4.z.array(ToolSchema).default(() => []),
595
+ context: zod_v4.z.array(ContextSchema).default(() => []),
596
+ forwardedProps: zod_v4.z.any().refine((value) => value !== null).optional(),
209
597
  resume: zod_v4.z.array(ResumeEntrySchema).optional()
210
598
  });
211
- const StateSchema = zod_v4.z.any();
212
- const TextMessageRoleSchema = zod_v4.z.union([
213
- zod_v4.z.literal("developer"),
214
- zod_v4.z.literal("system"),
215
- zod_v4.z.literal("assistant"),
216
- zod_v4.z.literal("user")
217
- ]);
218
- const BaseEventSchema = zod_v4.z.object({
219
- type: EventTypeSchema,
220
- timestamp: zod_v4.z.number().optional(),
221
- rawEvent: zod_v4.z.any().optional()
222
- }).passthrough();
223
- const TextMessageStartEventSchema = BaseEventSchema.extend({
224
- type: zod_v4.z.literal(require_events.EventType.TEXT_MESSAGE_START),
225
- messageId: zod_v4.z.string(),
226
- role: TextMessageRoleSchema.default("assistant"),
227
- name: zod_v4.z.string().optional()
228
- });
229
- const TextMessageContentEventSchema = BaseEventSchema.extend({
230
- type: zod_v4.z.literal(require_events.EventType.TEXT_MESSAGE_CONTENT),
231
- messageId: zod_v4.z.string(),
232
- delta: zod_v4.z.string()
233
- });
234
- const TextMessageEndEventSchema = BaseEventSchema.extend({
235
- type: zod_v4.z.literal(require_events.EventType.TEXT_MESSAGE_END),
236
- messageId: zod_v4.z.string()
237
- });
238
- const TextMessageChunkEventSchema = BaseEventSchema.extend({
239
- type: zod_v4.z.literal(require_events.EventType.TEXT_MESSAGE_CHUNK),
240
- messageId: zod_v4.z.string().optional(),
241
- role: TextMessageRoleSchema.optional(),
242
- delta: zod_v4.z.string().optional(),
243
- name: zod_v4.z.string().optional()
244
- });
245
599
  /**
246
- * @deprecated Use ReasoningTextMessageStartEventSchema instead. Will be removed in 1.0.0.
600
+ * Opens a run. Run-scoped, so it carries no subagent attribution.
247
601
  */
248
- const ThinkingTextMessageStartEventSchema = BaseEventSchema.extend({ type: zod_v4.z.literal(require_events.EventType.THINKING_TEXT_MESSAGE_START) });
602
+ const RunStartedEventSchema = zod_v4.z.looseObject({
603
+ type: zod_v4.z.literal(require_version.EventType.RUN_STARTED),
604
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
605
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
606
+ metadata: MetadataSchema.optional(),
607
+ threadId: zod_v4.z.string(),
608
+ runId: zod_v4.z.string(),
609
+ protocolVersion: zod_v4.z.string().optional(),
610
+ parentRunId: zod_v4.z.string().optional(),
611
+ input: RunAgentInputSchema.optional()
612
+ });
249
613
  /**
250
- * @deprecated Use ReasoningMessageContentEventSchema instead. Will be removed in 1.0.0.
614
+ * The run completed. Equivalent to an absent outcome. Closed like every other
615
+ * object, which is also what keeps it from carrying the suspended sibling's
616
+ * interrupts — a success with an interrupt still pending would be a
617
+ * contradiction, not an extension. A completed run may still have left
618
+ * frontend tool calls for the application to answer; pendingToolCallIds names
619
+ * them.
251
620
  */
252
- const ThinkingTextMessageContentEventSchema = BaseEventSchema.extend({
253
- type: zod_v4.z.literal(require_events.EventType.THINKING_TEXT_MESSAGE_CONTENT),
254
- delta: zod_v4.z.string()
621
+ const RunFinishedSuccessOutcomeSchema = zod_v4.z.looseObject({
622
+ type: zod_v4.z.literal("success"),
623
+ pendingToolCallIds: zod_v4.z.array(zod_v4.z.string()).optional()
255
624
  });
256
625
  /**
257
- * @deprecated Use ReasoningMessageEndEventSchema instead. Will be removed in 1.0.0.
626
+ * Something a run needs from outside before it can continue, such as an
627
+ * approval or a missing value.
258
628
  */
259
- const ThinkingTextMessageEndEventSchema = BaseEventSchema.extend({ type: zod_v4.z.literal(require_events.EventType.THINKING_TEXT_MESSAGE_END) });
260
- const ToolCallStartEventSchema = BaseEventSchema.extend({
261
- type: zod_v4.z.literal(require_events.EventType.TOOL_CALL_START),
262
- toolCallId: zod_v4.z.string(),
263
- toolCallName: zod_v4.z.string(),
264
- parentMessageId: zod_v4.z.string().nullable().optional().transform((v) => v ?? void 0)
265
- });
266
- const ToolCallArgsEventSchema = BaseEventSchema.extend({
267
- type: zod_v4.z.literal(require_events.EventType.TOOL_CALL_ARGS),
268
- toolCallId: zod_v4.z.string(),
269
- delta: zod_v4.z.string()
270
- });
271
- const ToolCallEndEventSchema = BaseEventSchema.extend({
272
- type: zod_v4.z.literal(require_events.EventType.TOOL_CALL_END),
273
- toolCallId: zod_v4.z.string()
274
- });
275
- const ToolCallResultEventSchema = BaseEventSchema.extend({
276
- messageId: zod_v4.z.string(),
277
- type: zod_v4.z.literal(require_events.EventType.TOOL_CALL_RESULT),
278
- toolCallId: zod_v4.z.string(),
279
- content: zod_v4.z.string(),
280
- role: zod_v4.z.literal("tool").optional()
281
- });
282
- const ToolCallChunkEventSchema = BaseEventSchema.extend({
283
- type: zod_v4.z.literal(require_events.EventType.TOOL_CALL_CHUNK),
629
+ const InterruptSchema = zod_v4.z.looseObject({
630
+ subagentRunId: SubagentRunIdSchema.optional(),
631
+ id: zod_v4.z.string(),
632
+ reason: zod_v4.z.string(),
633
+ message: zod_v4.z.string().optional(),
284
634
  toolCallId: zod_v4.z.string().optional(),
285
- toolCallName: zod_v4.z.string().optional(),
286
- parentMessageId: zod_v4.z.string().nullable().optional().transform((v) => v ?? void 0),
287
- delta: zod_v4.z.string().optional()
635
+ responseSchema: zod_v4.z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value)).optional(),
636
+ expiresAt: zod_v4.z.string().optional(),
637
+ metadata: MetadataSchema.optional()
288
638
  });
289
639
  /**
290
- * @deprecated Use ReasoningStartEventSchema instead. Will be removed in 1.0.0.
640
+ * The run is paused, waiting for something outside it. Resuming means starting
641
+ * a new run whose resume entries answer these interrupts.
291
642
  */
292
- const ThinkingStartEventSchema = BaseEventSchema.extend({
293
- type: zod_v4.z.literal(require_events.EventType.THINKING_START),
294
- title: zod_v4.z.string().optional()
643
+ const RunFinishedInterruptOutcomeSchema = zod_v4.z.looseObject({
644
+ type: zod_v4.z.literal("interrupt"),
645
+ interrupts: zod_v4.z.array(InterruptSchema).min(1)
295
646
  });
296
647
  /**
297
- * @deprecated Use ReasoningEndEventSchema instead. Will be removed in 1.0.0.
648
+ * The run was stopped before it completed, by whoever was running it, and did
649
+ * not fail. Neither success nor interrupt: nothing was produced as a result,
650
+ * and nothing is waited for, so the next run on the thread is an ordinary new
651
+ * run rather than a resume. Closed like its siblings: a cancelled run has no
652
+ * interrupts to carry. Named in the schema before 1.0 because an outcome a
653
+ * consumer does not recognise is stripped and read as success — a cancellation
654
+ * added later would reach every 1.0 consumer as a completed run.
298
655
  */
299
- const ThinkingEndEventSchema = BaseEventSchema.extend({ type: zod_v4.z.literal(require_events.EventType.THINKING_END) });
300
- const StateSnapshotEventSchema = BaseEventSchema.extend({
301
- type: zod_v4.z.literal(require_events.EventType.STATE_SNAPSHOT),
302
- snapshot: StateSchema.optional()
303
- });
304
- const StateDeltaEventSchema = BaseEventSchema.extend({
305
- type: zod_v4.z.literal(require_events.EventType.STATE_DELTA),
306
- delta: zod_v4.z.array(zod_v4.z.any())
307
- });
308
- const MessagesSnapshotEventSchema = BaseEventSchema.extend({
309
- type: zod_v4.z.literal(require_events.EventType.MESSAGES_SNAPSHOT),
310
- messages: zod_v4.z.array(MessageSchema)
311
- });
312
- const ActivitySnapshotEventSchema = BaseEventSchema.extend({
313
- type: zod_v4.z.literal(require_events.EventType.ACTIVITY_SNAPSHOT),
314
- messageId: zod_v4.z.string(),
315
- activityType: zod_v4.z.string(),
316
- content: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.any()),
317
- replace: zod_v4.z.boolean().optional().default(true)
318
- });
319
- const ActivityDeltaEventSchema = BaseEventSchema.extend({
320
- type: zod_v4.z.literal(require_events.EventType.ACTIVITY_DELTA),
321
- messageId: zod_v4.z.string(),
322
- activityType: zod_v4.z.string(),
323
- patch: zod_v4.z.array(zod_v4.z.any())
324
- });
325
- const RawEventSchema = BaseEventSchema.extend({
326
- type: zod_v4.z.literal(require_events.EventType.RAW),
327
- event: zod_v4.z.any().optional(),
328
- source: zod_v4.z.string().optional()
329
- });
330
- const CustomEventSchema = BaseEventSchema.extend({
331
- type: zod_v4.z.literal(require_events.EventType.CUSTOM),
332
- name: zod_v4.z.string(),
333
- value: zod_v4.z.any().optional()
334
- });
335
- const RunStartedEventSchema = BaseEventSchema.extend({
336
- type: zod_v4.z.literal(require_events.EventType.RUN_STARTED),
337
- threadId: zod_v4.z.string(),
338
- runId: zod_v4.z.string(),
339
- parentRunId: zod_v4.z.string().optional(),
340
- input: RunAgentInputSchema.optional()
656
+ const RunFinishedCancelledOutcomeSchema = zod_v4.z.looseObject({ type: zod_v4.z.literal("cancelled") });
657
+ /**
658
+ * Why a run ended.
659
+ */
660
+ const RunFinishedOutcomeSchema = zod_v4.z.discriminatedUnion("type", [
661
+ RunFinishedSuccessOutcomeSchema,
662
+ RunFinishedInterruptOutcomeSchema,
663
+ RunFinishedCancelledOutcomeSchema
664
+ ]);
665
+ /**
666
+ * Token counts for one provider and model, in the protocol's own accounting:
667
+ * every count is either a total or a named part of one, so entries from
668
+ * different providers add up without double-counting. inputTokens and
669
+ * outputTokens are the totals; reasoningTokens, cachedInputTokens and
670
+ * cacheWriteInputTokens are parts of them, never additions to them;
671
+ * totalTokens is the two totals summed. Every field is a label or a number —
672
+ * nothing content-bearing or identifying, no prompts, completions, messages,
673
+ * or thread, run and user identifiers.
674
+ */
675
+ const TokenUsageSchema = zod_v4.z.looseObject({
676
+ provider: zod_v4.z.string().optional(),
677
+ model: zod_v4.z.string().optional(),
678
+ inputTokens: zod_v4.z.int().min(0).max(9007199254740991).optional(),
679
+ outputTokens: zod_v4.z.int().min(0).max(9007199254740991).optional(),
680
+ totalTokens: zod_v4.z.int().min(0).max(9007199254740991).optional(),
681
+ reasoningTokens: zod_v4.z.int().min(0).max(9007199254740991).optional(),
682
+ cachedInputTokens: zod_v4.z.int().min(0).max(9007199254740991).optional(),
683
+ cacheWriteInputTokens: zod_v4.z.int().min(0).max(9007199254740991).optional()
341
684
  });
342
- const RunFinishedSuccessOutcomeSchema = zod_v4.z.object({ type: zod_v4.z.literal("success") }).strict();
343
- const RunFinishedInterruptOutcomeSchema = zod_v4.z.object({
344
- type: zod_v4.z.literal("interrupt"),
345
- interrupts: zod_v4.z.array(InterruptSchema).min(1)
346
- }).strict();
347
- const RunFinishedOutcomeSchema = zod_v4.z.discriminatedUnion("type", [RunFinishedSuccessOutcomeSchema, RunFinishedInterruptOutcomeSchema]);
348
- const RunFinishedEventSchema = BaseEventSchema.extend({
349
- type: zod_v4.z.literal(require_events.EventType.RUN_FINISHED),
685
+ /**
686
+ * Closes a run that did not fail. Run-scoped, so it carries no subagent
687
+ * attribution.
688
+ */
689
+ const RunFinishedEventSchema = zod_v4.z.looseObject({
690
+ type: zod_v4.z.literal(require_version.EventType.RUN_FINISHED),
691
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
692
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
693
+ metadata: MetadataSchema.optional(),
350
694
  threadId: zod_v4.z.string(),
351
695
  runId: zod_v4.z.string(),
352
- result: zod_v4.z.any().optional(),
353
- outcome: RunFinishedOutcomeSchema.nullable().optional().transform((v) => v ?? void 0)
696
+ result: zod_v4.z.any().refine((value) => value !== null).optional(),
697
+ outcome: RunFinishedOutcomeSchema.optional(),
698
+ usage: zod_v4.z.array(TokenUsageSchema).optional()
354
699
  });
355
- const RunErrorEventSchema = BaseEventSchema.extend({
356
- type: zod_v4.z.literal(require_events.EventType.RUN_ERROR),
700
+ /**
701
+ * Ends a run that failed. Run-scoped, so it carries no subagent attribution; a
702
+ * subagent that fails without ending the run reports SUBAGENT_ERROR instead.
703
+ */
704
+ const RunErrorEventSchema = zod_v4.z.looseObject({
705
+ type: zod_v4.z.literal(require_version.EventType.RUN_ERROR),
706
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
707
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
708
+ metadata: MetadataSchema.optional(),
357
709
  message: zod_v4.z.string(),
358
- code: zod_v4.z.string().optional()
710
+ code: zod_v4.z.string().optional(),
711
+ usage: zod_v4.z.array(TokenUsageSchema).optional()
359
712
  });
360
- const StepStartedEventSchema = BaseEventSchema.extend({
361
- type: zod_v4.z.literal(require_events.EventType.STEP_STARTED),
713
+ /**
714
+ * Opens a named step within a run, for producers whose frameworks have a step
715
+ * concept worth surfacing.
716
+ */
717
+ const StepStartedEventSchema = zod_v4.z.looseObject({
718
+ type: zod_v4.z.literal(require_version.EventType.STEP_STARTED),
719
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
720
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
721
+ metadata: MetadataSchema.optional(),
722
+ subagentRunId: SubagentRunIdSchema.optional(),
362
723
  stepName: zod_v4.z.string()
363
724
  });
364
- const StepFinishedEventSchema = BaseEventSchema.extend({
365
- type: zod_v4.z.literal(require_events.EventType.STEP_FINISHED),
725
+ /**
726
+ * Closes a named step.
727
+ */
728
+ const StepFinishedEventSchema = zod_v4.z.looseObject({
729
+ type: zod_v4.z.literal(require_version.EventType.STEP_FINISHED),
730
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
731
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
732
+ metadata: MetadataSchema.optional(),
733
+ subagentRunId: SubagentRunIdSchema.optional(),
366
734
  stepName: zod_v4.z.string()
367
735
  });
368
- const ReasoningEncryptedValueSubtypeSchema = zod_v4.z.union([zod_v4.z.literal("tool-call"), zod_v4.z.literal("message")]);
369
- const ReasoningStartEventSchema = BaseEventSchema.extend({
370
- type: zod_v4.z.literal(require_events.EventType.REASONING_START),
736
+ /**
737
+ * Opens a span of reasoning. A span may contain several reasoning messages.
738
+ */
739
+ const ReasoningStartEventSchema = zod_v4.z.looseObject({
740
+ type: zod_v4.z.literal(require_version.EventType.REASONING_START),
741
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
742
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
743
+ metadata: MetadataSchema.optional(),
744
+ subagentRunId: SubagentRunIdSchema.optional(),
371
745
  messageId: zod_v4.z.string()
372
746
  });
373
- const ReasoningMessageStartEventSchema = BaseEventSchema.extend({
374
- type: zod_v4.z.literal(require_events.EventType.REASONING_MESSAGE_START),
747
+ /**
748
+ * Opens a streamed reasoning message.
749
+ */
750
+ const ReasoningMessageStartEventSchema = zod_v4.z.looseObject({
751
+ type: zod_v4.z.literal(require_version.EventType.REASONING_MESSAGE_START),
752
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
753
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
754
+ metadata: MetadataSchema.optional(),
755
+ subagentRunId: SubagentRunIdSchema.optional(),
375
756
  messageId: zod_v4.z.string(),
376
757
  role: zod_v4.z.literal("reasoning")
377
758
  });
378
- const ReasoningMessageContentEventSchema = BaseEventSchema.extend({
379
- type: zod_v4.z.literal(require_events.EventType.REASONING_MESSAGE_CONTENT),
759
+ /**
760
+ * Appends a fragment to a streamed reasoning message.
761
+ */
762
+ const ReasoningMessageContentEventSchema = zod_v4.z.looseObject({
763
+ type: zod_v4.z.literal(require_version.EventType.REASONING_MESSAGE_CONTENT),
764
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
765
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
766
+ metadata: MetadataSchema.optional(),
767
+ subagentRunId: SubagentRunIdSchema.optional(),
380
768
  messageId: zod_v4.z.string(),
381
769
  delta: zod_v4.z.string()
382
770
  });
383
- const ReasoningMessageEndEventSchema = BaseEventSchema.extend({
384
- type: zod_v4.z.literal(require_events.EventType.REASONING_MESSAGE_END),
771
+ /**
772
+ * Closes a streamed reasoning message.
773
+ */
774
+ const ReasoningMessageEndEventSchema = zod_v4.z.looseObject({
775
+ type: zod_v4.z.literal(require_version.EventType.REASONING_MESSAGE_END),
776
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
777
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
778
+ metadata: MetadataSchema.optional(),
779
+ subagentRunId: SubagentRunIdSchema.optional(),
385
780
  messageId: zod_v4.z.string()
386
781
  });
387
- const ReasoningMessageChunkEventSchema = BaseEventSchema.extend({
388
- type: zod_v4.z.literal(require_events.EventType.REASONING_MESSAGE_CHUNK),
782
+ /**
783
+ * A shorthand that stands in for a reasoning message's start, content and end
784
+ * sequence.
785
+ */
786
+ const ReasoningMessageChunkEventSchema = zod_v4.z.looseObject({
787
+ type: zod_v4.z.literal(require_version.EventType.REASONING_MESSAGE_CHUNK),
788
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
789
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
790
+ metadata: MetadataSchema.optional(),
791
+ subagentRunId: SubagentRunIdSchema.optional(),
389
792
  messageId: zod_v4.z.string().optional(),
390
793
  delta: zod_v4.z.string().optional()
391
794
  });
392
- const ReasoningEndEventSchema = BaseEventSchema.extend({
393
- type: zod_v4.z.literal(require_events.EventType.REASONING_END),
795
+ /**
796
+ * Closes a span of reasoning.
797
+ */
798
+ const ReasoningEndEventSchema = zod_v4.z.looseObject({
799
+ type: zod_v4.z.literal(require_version.EventType.REASONING_END),
800
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
801
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
802
+ metadata: MetadataSchema.optional(),
803
+ subagentRunId: SubagentRunIdSchema.optional(),
394
804
  messageId: zod_v4.z.string()
395
805
  });
396
- const ReasoningEncryptedValueEventSchema = BaseEventSchema.extend({
397
- type: zod_v4.z.literal(require_events.EventType.REASONING_ENCRYPTED_VALUE),
806
+ /**
807
+ * Whether a REASONING_ENCRYPTED_VALUE belongs to a message or to a tool call.
808
+ */
809
+ const ReasoningEncryptedValueSubtypeSchema = zod_v4.z.enum(["tool-call", "message"]);
810
+ /**
811
+ * Carries a provider's opaque, encrypted reasoning artefact, which a consumer
812
+ * stores and returns on a later turn without being able to read it.
813
+ */
814
+ const ReasoningEncryptedValueEventSchema = zod_v4.z.looseObject({
815
+ type: zod_v4.z.literal(require_version.EventType.REASONING_ENCRYPTED_VALUE),
816
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
817
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
818
+ metadata: MetadataSchema.optional(),
819
+ subagentRunId: SubagentRunIdSchema.optional(),
398
820
  subtype: ReasoningEncryptedValueSubtypeSchema,
399
821
  entityId: zod_v4.z.string(),
400
822
  encryptedValue: zod_v4.z.string()
401
823
  });
402
824
  /**
403
- * Discriminated union of all AG-UI event schemas. Suitable for validating
404
- * untrusted event payloads from the wire.
825
+ * Announces that a subagent invocation has begun. Everything the subagent
826
+ * produces afterwards is attributed by carrying its subagentRunId, so a
827
+ * consumer can group the work without replaying the stream. Composed from
828
+ * BaseEvent alone rather than Attributable, because here subagentRunId
829
+ * identifies the subagent rather than attributing the event to one;
830
+ * attribution to an enclosing subagent is parentSubagentRunId.
405
831
  */
406
- const EventSchemas = zod_v4.z.discriminatedUnion("type", [
832
+ const SubagentStartedEventSchema = zod_v4.z.looseObject({
833
+ type: zod_v4.z.literal(require_version.EventType.SUBAGENT_STARTED),
834
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
835
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
836
+ metadata: MetadataSchema.optional(),
837
+ subagentRunId: SubagentRunIdSchema,
838
+ name: zod_v4.z.string(),
839
+ description: zod_v4.z.string().optional(),
840
+ parentSubagentRunId: SubagentRunIdSchema.optional(),
841
+ parentToolCallId: zod_v4.z.string().optional(),
842
+ parentMessageId: zod_v4.z.string().optional()
843
+ });
844
+ /**
845
+ * The subagent completed its work. Equivalent to an absent outcome.
846
+ */
847
+ const SubagentFinishedSuccessOutcomeSchema = zod_v4.z.looseObject({ type: zod_v4.z.literal("success") });
848
+ /**
849
+ * The subagent is paused awaiting outside input. Terminal for this stream, not
850
+ * for the subagent: a later run may continue the same invocation once the
851
+ * interrupts are answered.
852
+ */
853
+ const SubagentFinishedSuspendedOutcomeSchema = zod_v4.z.looseObject({
854
+ type: zod_v4.z.literal("suspended"),
855
+ interruptIds: zod_v4.z.array(zod_v4.z.string()).optional()
856
+ });
857
+ /**
858
+ * Why a subagent's segment of a run ended. Mirrors RunFinishedOutcome one
859
+ * level down.
860
+ */
861
+ const SubagentFinishedOutcomeSchema = zod_v4.z.discriminatedUnion("type", [SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema]);
862
+ /**
863
+ * Ends a subagent invocation's segment of this run, either because the work
864
+ * completed or because it is suspended awaiting outside input.
865
+ */
866
+ const SubagentFinishedEventSchema = zod_v4.z.looseObject({
867
+ type: zod_v4.z.literal(require_version.EventType.SUBAGENT_FINISHED),
868
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
869
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
870
+ metadata: MetadataSchema.optional(),
871
+ subagentRunId: SubagentRunIdSchema,
872
+ result: zod_v4.z.any().refine((value) => value !== null).optional(),
873
+ outcome: SubagentFinishedOutcomeSchema.optional()
874
+ });
875
+ /**
876
+ * Reports that a subagent invocation failed. The run may continue: a parent
877
+ * agent is free to handle a failed subagent, which is why this is not
878
+ * RUN_ERROR.
879
+ */
880
+ const SubagentErrorEventSchema = zod_v4.z.looseObject({
881
+ type: zod_v4.z.literal(require_version.EventType.SUBAGENT_ERROR),
882
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
883
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
884
+ metadata: MetadataSchema.optional(),
885
+ subagentRunId: SubagentRunIdSchema,
886
+ message: zod_v4.z.string(),
887
+ code: zod_v4.z.string().optional()
888
+ });
889
+ /**
890
+ * Any AG-UI event. Every member is normative: there is no optional tier and no
891
+ * event a consumer may decline to implement. Discriminated by the type
892
+ * property.
893
+ */
894
+ const EventSchema = zod_v4.z.discriminatedUnion("type", [
407
895
  TextMessageStartEventSchema,
408
896
  TextMessageContentEventSchema,
409
897
  TextMessageEndEventSchema,
410
898
  TextMessageChunkEventSchema,
411
- ThinkingStartEventSchema,
412
- ThinkingEndEventSchema,
413
- ThinkingTextMessageStartEventSchema,
414
- ThinkingTextMessageContentEventSchema,
415
- ThinkingTextMessageEndEventSchema,
416
899
  ToolCallStartEventSchema,
417
900
  ToolCallArgsEventSchema,
418
901
  ToolCallEndEventSchema,
@@ -436,30 +919,51 @@ const EventSchemas = zod_v4.z.discriminatedUnion("type", [
436
919
  ReasoningMessageEndEventSchema,
437
920
  ReasoningMessageChunkEventSchema,
438
921
  ReasoningEndEventSchema,
439
- ReasoningEncryptedValueEventSchema
922
+ ReasoningEncryptedValueEventSchema,
923
+ SubagentStartedEventSchema,
924
+ SubagentFinishedEventSchema,
925
+ SubagentErrorEventSchema
440
926
  ]);
441
- /** Describes a sub-agent that can be invoked by a parent agent. */
442
- const SubAgentInfoSchema = zod_v4.z.object({
927
+ /**
928
+ * Every role a materialised message may have.
929
+ */
930
+ const RoleSchema = zod_v4.z.enum([
931
+ "developer",
932
+ "system",
933
+ "assistant",
934
+ "user",
935
+ "tool",
936
+ "activity",
937
+ "reasoning"
938
+ ]);
939
+ /**
940
+ * Describes a subagent that can be invoked by a parent agent.
941
+ */
942
+ const SubagentInfoSchema = zod_v4.z.looseObject({
443
943
  name: zod_v4.z.string(),
444
944
  description: zod_v4.z.string().optional()
445
945
  });
446
946
  /**
447
- * Basic metadata about the agent. Useful for discovery UIs, agent marketplaces,
448
- * and debugging.
947
+ * Basic metadata about the agent. Useful for discovery UIs, agent
948
+ * marketplaces, and debugging. Set these when you want clients to display
949
+ * agent information or when multiple agents are available and users need to
950
+ * pick one.
449
951
  */
450
- const IdentityCapabilitiesSchema = zod_v4.z.object({
952
+ const IdentityCapabilitiesSchema = zod_v4.z.looseObject({
451
953
  name: zod_v4.z.string().optional(),
452
954
  type: zod_v4.z.string().optional(),
453
955
  description: zod_v4.z.string().optional(),
454
956
  version: zod_v4.z.string().optional(),
455
957
  provider: zod_v4.z.string().optional(),
456
958
  documentationUrl: zod_v4.z.string().optional(),
457
- metadata: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.unknown()).optional()
959
+ metadata: MetadataSchema.optional()
458
960
  });
459
961
  /**
460
- * Declares which transport mechanisms the agent supports.
962
+ * Declares which transport mechanisms the agent supports. Clients use this to
963
+ * pick the best connection strategy. Only set flags to true for transports
964
+ * your agent actually handles — omit or set false for unsupported ones.
461
965
  */
462
- const TransportCapabilitiesSchema = zod_v4.z.object({
966
+ const TransportCapabilitiesSchema = zod_v4.z.looseObject({
463
967
  streaming: zod_v4.z.boolean().optional(),
464
968
  websocket: zod_v4.z.boolean().optional(),
465
969
  httpBinary: zod_v4.z.boolean().optional(),
@@ -467,51 +971,61 @@ const TransportCapabilitiesSchema = zod_v4.z.object({
467
971
  resumable: zod_v4.z.boolean().optional()
468
972
  });
469
973
  /**
470
- * Tool calling capabilities.
974
+ * Tool calling capabilities. Distinguishes between tools the agent itself
975
+ * provides (listed in items) and tools the client passes at runtime via
976
+ * RunAgentInput.tools. Enable this when your agent can call functions, search
977
+ * the web, execute code, etc.
471
978
  */
472
- const ToolsCapabilitiesSchema = zod_v4.z.object({
979
+ const ToolsCapabilitiesSchema = zod_v4.z.looseObject({
473
980
  supported: zod_v4.z.boolean().optional(),
474
981
  items: zod_v4.z.array(ToolSchema).optional(),
475
982
  parallelCalls: zod_v4.z.boolean().optional(),
476
983
  clientProvided: zod_v4.z.boolean().optional()
477
984
  });
478
985
  /**
479
- * Output format support.
986
+ * Output format support. Enable structuredOutput when your agent can return
987
+ * responses conforming to a JSON schema, which is useful for programmatic
988
+ * consumption.
480
989
  */
481
- const OutputCapabilitiesSchema = zod_v4.z.object({
990
+ const OutputCapabilitiesSchema = zod_v4.z.looseObject({
482
991
  structuredOutput: zod_v4.z.boolean().optional(),
483
992
  supportedMimeTypes: zod_v4.z.array(zod_v4.z.string()).optional()
484
993
  });
485
994
  /**
486
- * State and memory management capabilities.
995
+ * State and memory management capabilities. These tell the client how the
996
+ * agent handles shared state and whether conversation context persists across
997
+ * runs.
487
998
  */
488
- const StateCapabilitiesSchema = zod_v4.z.object({
999
+ const StateCapabilitiesSchema = zod_v4.z.looseObject({
489
1000
  snapshots: zod_v4.z.boolean().optional(),
490
1001
  deltas: zod_v4.z.boolean().optional(),
491
1002
  memory: zod_v4.z.boolean().optional(),
492
1003
  persistentState: zod_v4.z.boolean().optional()
493
1004
  });
494
1005
  /**
495
- * Multi-agent coordination capabilities.
1006
+ * Multi-agent coordination capabilities. Enable these when your agent can
1007
+ * orchestrate or hand off work to other agents.
496
1008
  */
497
- const MultiAgentCapabilitiesSchema = zod_v4.z.object({
1009
+ const MultiAgentCapabilitiesSchema = zod_v4.z.looseObject({
498
1010
  supported: zod_v4.z.boolean().optional(),
499
1011
  delegation: zod_v4.z.boolean().optional(),
500
1012
  handoffs: zod_v4.z.boolean().optional(),
501
- subAgents: zod_v4.z.array(SubAgentInfoSchema).optional()
1013
+ subagents: zod_v4.z.array(SubagentInfoSchema).optional()
502
1014
  });
503
1015
  /**
504
- * Reasoning and thinking capabilities.
1016
+ * Reasoning and thinking capabilities. Enable these when your agent exposes
1017
+ * its internal thought process (e.g., chain-of-thought, extended thinking).
505
1018
  */
506
- const ReasoningCapabilitiesSchema = zod_v4.z.object({
1019
+ const ReasoningCapabilitiesSchema = zod_v4.z.looseObject({
507
1020
  supported: zod_v4.z.boolean().optional(),
508
1021
  streaming: zod_v4.z.boolean().optional(),
509
1022
  encrypted: zod_v4.z.boolean().optional()
510
1023
  });
511
1024
  /**
512
- * Modalities the agent can accept as input.
1025
+ * Modalities the agent can accept as input. Clients use this to show or hide
1026
+ * file upload buttons, audio recorders, image pickers, etc.
513
1027
  */
514
- const MultimodalInputCapabilitiesSchema = zod_v4.z.object({
1028
+ const MultimodalInputCapabilitiesSchema = zod_v4.z.looseObject({
515
1029
  image: zod_v4.z.boolean().optional(),
516
1030
  audio: zod_v4.z.boolean().optional(),
517
1031
  video: zod_v4.z.boolean().optional(),
@@ -519,32 +1033,38 @@ const MultimodalInputCapabilitiesSchema = zod_v4.z.object({
519
1033
  file: zod_v4.z.boolean().optional()
520
1034
  });
521
1035
  /**
522
- * Modalities the agent can produce as output.
1036
+ * Modalities the agent can produce as output. Clients use this to anticipate
1037
+ * rich content in the agent's response.
523
1038
  */
524
- const MultimodalOutputCapabilitiesSchema = zod_v4.z.object({
1039
+ const MultimodalOutputCapabilitiesSchema = zod_v4.z.looseObject({
525
1040
  image: zod_v4.z.boolean().optional(),
526
1041
  audio: zod_v4.z.boolean().optional()
527
1042
  });
528
1043
  /**
529
- * Multimodal input and output support.
1044
+ * Multimodal input and output support. Organized into input and output
1045
+ * sub-objects so clients can independently query what the agent accepts versus
1046
+ * what it produces.
530
1047
  */
531
- const MultimodalCapabilitiesSchema = zod_v4.z.object({
1048
+ const MultimodalCapabilitiesSchema = zod_v4.z.looseObject({
532
1049
  input: MultimodalInputCapabilitiesSchema.optional(),
533
1050
  output: MultimodalOutputCapabilitiesSchema.optional()
534
1051
  });
535
1052
  /**
536
- * Execution control and limits.
1053
+ * Execution control and limits. Declare these so clients can set expectations
1054
+ * about how long or how many steps an agent run might take.
537
1055
  */
538
- const ExecutionCapabilitiesSchema = zod_v4.z.object({
1056
+ const ExecutionCapabilitiesSchema = zod_v4.z.looseObject({
539
1057
  codeExecution: zod_v4.z.boolean().optional(),
540
1058
  sandboxed: zod_v4.z.boolean().optional(),
541
- maxIterations: zod_v4.z.number().optional(),
542
- maxExecutionTime: zod_v4.z.number().optional()
1059
+ maxIterations: zod_v4.z.int().min(0).max(9007199254740991).optional(),
1060
+ maxExecutionTime: zod_v4.z.int().min(0).max(9007199254740991).optional()
543
1061
  });
544
1062
  /**
545
- * Human-in-the-loop interaction support.
1063
+ * Human-in-the-loop interaction support. Enable these when your agent can
1064
+ * pause execution to request human input, approval, or feedback before
1065
+ * continuing.
546
1066
  */
547
- const HumanInTheLoopCapabilitiesSchema = zod_v4.z.object({
1067
+ const HumanInTheLoopCapabilitiesSchema = zod_v4.z.looseObject({
548
1068
  supported: zod_v4.z.boolean().optional(),
549
1069
  approvals: zod_v4.z.boolean().optional(),
550
1070
  interventions: zod_v4.z.boolean().optional(),
@@ -553,10 +1073,13 @@ const HumanInTheLoopCapabilitiesSchema = zod_v4.z.object({
553
1073
  approveWithEdits: zod_v4.z.boolean().optional()
554
1074
  });
555
1075
  /**
556
- * A typed, categorized snapshot of an agent's current capabilities.
557
- * Returned by `getCapabilities()` on `AbstractAgent`.
1076
+ * A typed, categorized snapshot of an agent's current capabilities. All fields
1077
+ * are optional agents only declare what they support. An omitted field means
1078
+ * the capability is not declared (unknown), not that it is unsupported. The
1079
+ * custom field is an escape hatch for integration-specific capabilities that
1080
+ * do not fit into the standard categories.
558
1081
  */
559
- const AgentCapabilitiesSchema = zod_v4.z.object({
1082
+ const AgentCapabilitiesSchema = zod_v4.z.looseObject({
560
1083
  identity: IdentityCapabilitiesSchema.optional(),
561
1084
  transport: TransportCapabilitiesSchema.optional(),
562
1085
  tools: ToolsCapabilitiesSchema.optional(),
@@ -567,144 +1090,121 @@ const AgentCapabilitiesSchema = zod_v4.z.object({
567
1090
  multimodal: MultimodalCapabilitiesSchema.optional(),
568
1091
  execution: ExecutionCapabilitiesSchema.optional(),
569
1092
  humanInTheLoop: HumanInTheLoopCapabilitiesSchema.optional(),
570
- custom: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.unknown()).optional()
1093
+ custom: zod_v4.z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value)).optional()
1094
+ });
1095
+ /**
1096
+ * Composed into everything that can belong to a subagent's work: the events
1097
+ * that describe content or progress, the message types, and each interrupt.
1098
+ * Run-scoped events omit it — RUN_STARTED, RUN_FINISHED and RUN_ERROR describe
1099
+ * the run itself and MESSAGES_SNAPSHOT is conversation-wide, so none of them
1100
+ * can belong to one subagent. A tool call omits it too and inherits its
1101
+ * containing message's attribution.
1102
+ */
1103
+ const AttributableSchema = zod_v4.z.looseObject({ subagentRunId: SubagentRunIdSchema.optional() });
1104
+ /**
1105
+ * The fields every event carries, whatever its type. Composed into each event
1106
+ * definition rather than repeated, so a change here reaches every event at
1107
+ * once.
1108
+ */
1109
+ const BaseEventSchema = zod_v4.z.looseObject({
1110
+ type: EventTypeSchema,
1111
+ timestamp: zod_v4.z.int().min(-9007199254740991).max(9007199254740991).optional(),
1112
+ rawEvent: zod_v4.z.any().refine((value) => value !== null).optional(),
1113
+ metadata: MetadataSchema.optional()
1114
+ });
1115
+ /**
1116
+ * The fields shared by the developer, system, assistant and user messages.
1117
+ * Deliberately excludes content, because a user message's content may be an
1118
+ * array while the others are strings, and composition here intersects rather
1119
+ * than overrides: a base that constrained content to a string would make an
1120
+ * array content invalid. The tool, activity and reasoning messages do not
1121
+ * compose this, because they carry no name.
1122
+ */
1123
+ const BaseMessageSchema = zod_v4.z.looseObject({
1124
+ subagentRunId: SubagentRunIdSchema.optional(),
1125
+ id: zod_v4.z.string(),
1126
+ role: zod_v4.z.string(),
1127
+ name: zod_v4.z.string().optional(),
1128
+ encryptedValue: zod_v4.z.string().optional(),
1129
+ metadata: MetadataSchema.optional()
571
1130
  });
572
1131
 
573
1132
  //#endregion
574
- //#region src/event-factories.ts
575
- const buildEvent = (eventType, schema, props) => schema.parse({
576
- ...props,
577
- type: eventType
578
- });
579
- /** Creates a TEXT_MESSAGE_START event. `role` defaults to `"assistant"` when omitted. */
580
- const createTextMessageStartEvent = (props) => buildEvent(require_events.EventType.TEXT_MESSAGE_START, TextMessageStartEventSchema, props);
581
- /** Creates a TEXT_MESSAGE_CONTENT event. */
582
- const createTextMessageContentEvent = (props) => buildEvent(require_events.EventType.TEXT_MESSAGE_CONTENT, TextMessageContentEventSchema, props);
583
- /** Creates a TEXT_MESSAGE_END event. */
584
- const createTextMessageEndEvent = (props) => buildEvent(require_events.EventType.TEXT_MESSAGE_END, TextMessageEndEventSchema, props);
585
- /** Creates a TEXT_MESSAGE_CHUNK event. */
586
- const createTextMessageChunkEvent = (props) => buildEvent(require_events.EventType.TEXT_MESSAGE_CHUNK, TextMessageChunkEventSchema, props);
587
- /** @deprecated Use `createReasoningMessageStartEvent` instead. Will be removed in 1.0.0. */
588
- const createThinkingTextMessageStartEvent = (props) => buildEvent(require_events.EventType.THINKING_TEXT_MESSAGE_START, ThinkingTextMessageStartEventSchema, props);
589
- /** @deprecated Use `createReasoningMessageContentEvent` instead. Will be removed in 1.0.0. */
590
- const createThinkingTextMessageContentEvent = (props) => buildEvent(require_events.EventType.THINKING_TEXT_MESSAGE_CONTENT, ThinkingTextMessageContentEventSchema, props);
591
- /** @deprecated Use `createReasoningMessageEndEvent` instead. Will be removed in 1.0.0. */
592
- const createThinkingTextMessageEndEvent = (props) => buildEvent(require_events.EventType.THINKING_TEXT_MESSAGE_END, ThinkingTextMessageEndEventSchema, props);
593
- /** Creates a TOOL_CALL_START event. */
594
- const createToolCallStartEvent = (props) => buildEvent(require_events.EventType.TOOL_CALL_START, ToolCallStartEventSchema, props);
595
- /** Creates a TOOL_CALL_ARGS event. */
596
- const createToolCallArgsEvent = (props) => buildEvent(require_events.EventType.TOOL_CALL_ARGS, ToolCallArgsEventSchema, props);
597
- /** Creates a TOOL_CALL_END event. */
598
- const createToolCallEndEvent = (props) => buildEvent(require_events.EventType.TOOL_CALL_END, ToolCallEndEventSchema, props);
599
- /** Creates a TOOL_CALL_CHUNK event. */
600
- const createToolCallChunkEvent = (props) => buildEvent(require_events.EventType.TOOL_CALL_CHUNK, ToolCallChunkEventSchema, props);
601
- /** Creates a TOOL_CALL_RESULT event. */
602
- const createToolCallResultEvent = (props) => buildEvent(require_events.EventType.TOOL_CALL_RESULT, ToolCallResultEventSchema, props);
603
- /** @deprecated Use `createReasoningStartEvent` instead. Will be removed in 1.0.0. */
604
- const createThinkingStartEvent = (props) => buildEvent(require_events.EventType.THINKING_START, ThinkingStartEventSchema, props);
605
- /** @deprecated Use `createReasoningEndEvent` instead. Will be removed in 1.0.0. */
606
- const createThinkingEndEvent = (props) => buildEvent(require_events.EventType.THINKING_END, ThinkingEndEventSchema, props);
607
- /** Creates a STATE_SNAPSHOT event. */
608
- const createStateSnapshotEvent = (props) => buildEvent(require_events.EventType.STATE_SNAPSHOT, StateSnapshotEventSchema, props);
609
- /** Creates a STATE_DELTA event. */
610
- const createStateDeltaEvent = (props) => buildEvent(require_events.EventType.STATE_DELTA, StateDeltaEventSchema, props);
611
- /** Creates a MESSAGES_SNAPSHOT event. */
612
- const createMessagesSnapshotEvent = (props) => buildEvent(require_events.EventType.MESSAGES_SNAPSHOT, MessagesSnapshotEventSchema, props);
613
- /** Creates an ACTIVITY_SNAPSHOT event. `replace` defaults to `true` when omitted. */
614
- const createActivitySnapshotEvent = (props) => buildEvent(require_events.EventType.ACTIVITY_SNAPSHOT, ActivitySnapshotEventSchema, props);
615
- /** Creates an ACTIVITY_DELTA event. */
616
- const createActivityDeltaEvent = (props) => buildEvent(require_events.EventType.ACTIVITY_DELTA, ActivityDeltaEventSchema, props);
617
- /** Creates a RAW event. */
618
- const createRawEvent = (props) => buildEvent(require_events.EventType.RAW, RawEventSchema, props);
619
- /** Creates a CUSTOM event. */
620
- const createCustomEvent = (props) => buildEvent(require_events.EventType.CUSTOM, CustomEventSchema, props);
621
- /** Creates a RUN_STARTED event. */
622
- const createRunStartedEvent = (props) => buildEvent(require_events.EventType.RUN_STARTED, RunStartedEventSchema, props);
623
- /**
624
- * Creates a RUN_FINISHED event.
1133
+ //#region src/schemas.ts
1134
+ /**
1135
+ * How metadata is declared on events and messages.
1136
+ *
1137
+ * The object itself is absent or an object, never `null` — and parsing enforces
1138
+ * that invariant rather than coercing a `null` to absent. The schema pinning it
1139
+ * now lives in the generated source (MetadataSchema in
1140
+ * src/generated/schemas.ts); this comment survives as the recorded reasoning.
625
1141
  *
626
- * `outcome` is optional. Omit it for legacy/back-compat behavior, or set it
627
- * explicitly to `{ type: "success" }` or `{ type: "interrupt", interrupts }` —
628
- * see `createRunFinishedSuccessEvent` and `createRunFinishedInterruptEvent` for
629
- * convenience helpers. `outcome: null` is normalized to `outcome` being omitted.
630
- */
631
- const createRunFinishedEvent = (props) => buildEvent(require_events.EventType.RUN_FINISHED, RunFinishedEventSchema, props);
632
- /** Creates a RUN_FINISHED event with `outcome: { type: "success" }`. */
633
- const createRunFinishedSuccessEvent = (props) => buildEvent(require_events.EventType.RUN_FINISHED, RunFinishedEventSchema, {
634
- ...props,
635
- outcome: { type: "success" }
636
- });
637
- /**
638
- * Creates a RUN_FINISHED event with `outcome: { type: "interrupt", interrupts }`.
639
- * Throws if `interrupts` is empty (the schema requires at least one entry).
640
- */
641
- const createRunFinishedInterruptEvent = (props) => {
642
- const { interrupts, ...rest } = props;
643
- return buildEvent(require_events.EventType.RUN_FINISHED, RunFinishedEventSchema, {
644
- ...rest,
645
- outcome: {
646
- type: "interrupt",
647
- interrupts
648
- }
649
- });
650
- };
651
- /** Creates a RUN_ERROR event. */
652
- const createRunErrorEvent = (props) => buildEvent(require_events.EventType.RUN_ERROR, RunErrorEventSchema, props);
653
- /** Creates a STEP_STARTED event. */
654
- const createStepStartedEvent = (props) => buildEvent(require_events.EventType.STEP_STARTED, StepStartedEventSchema, props);
655
- /** Creates a STEP_FINISHED event. */
656
- const createStepFinishedEvent = (props) => buildEvent(require_events.EventType.STEP_FINISHED, StepFinishedEventSchema, props);
657
- /** Creates a REASONING_START event. */
658
- const createReasoningStartEvent = (props) => buildEvent(require_events.EventType.REASONING_START, ReasoningStartEventSchema, props);
659
- /** Creates a REASONING_MESSAGE_START event. */
660
- const createReasoningMessageStartEvent = (props) => buildEvent(require_events.EventType.REASONING_MESSAGE_START, ReasoningMessageStartEventSchema, props);
661
- /** Creates a REASONING_MESSAGE_CONTENT event. */
662
- const createReasoningMessageContentEvent = (props) => buildEvent(require_events.EventType.REASONING_MESSAGE_CONTENT, ReasoningMessageContentEventSchema, props);
663
- /** Creates a REASONING_MESSAGE_END event. */
664
- const createReasoningMessageEndEvent = (props) => buildEvent(require_events.EventType.REASONING_MESSAGE_END, ReasoningMessageEndEventSchema, props);
665
- /** Creates a REASONING_MESSAGE_CHUNK event. */
666
- const createReasoningMessageChunkEvent = (props) => buildEvent(require_events.EventType.REASONING_MESSAGE_CHUNK, ReasoningMessageChunkEventSchema, props);
667
- /** Creates a REASONING_END event. */
668
- const createReasoningEndEvent = (props) => buildEvent(require_events.EventType.REASONING_END, ReasoningEndEventSchema, props);
669
- /** Creates a REASONING_ENCRYPTED_VALUE event. */
670
- const createReasoningEncryptedValueEvent = (props) => buildEvent(require_events.EventType.REASONING_ENCRYPTED_VALUE, ReasoningEncryptedValueEventSchema, props);
1142
+ * Historically tolerated whole optional nulls are translated to absence in
1143
+ * the client's compatibility boundary before validation. That includes the
1144
+ * legacy `parentMessageId` and `outcome` cases and optional JSON fields such as
1145
+ * `rawEvent`, `result`, and media content-part `metadata`; see the repo-root
1146
+ * DEPRECATIONS.md for the exact list. Event and message metadata already
1147
+ * rejected a whole `null`, so their restriction remains. Compatibility for
1148
+ * media content-part metadata does not broaden this shared metadata schema.
1149
+ *
1150
+ * A `null` *value under a key* is meaningful data and is preserved. Only a
1151
+ * `null` in place of the whole object is a contract violation.
1152
+ */
1153
+ const OptionalMetadataSchema = MetadataSchema.optional();
671
1154
 
672
1155
  //#endregion
673
1156
  exports.ActivityDeltaEventSchema = ActivityDeltaEventSchema;
674
1157
  exports.ActivityMessageSchema = ActivityMessageSchema;
675
1158
  exports.ActivitySnapshotEventSchema = ActivitySnapshotEventSchema;
1159
+ exports.AddOperationSchema = AddOperationSchema;
676
1160
  exports.AgentCapabilitiesSchema = AgentCapabilitiesSchema;
677
1161
  exports.AssistantMessageSchema = AssistantMessageSchema;
678
- exports.AudioInputContentSchema = AudioInputContentSchema;
679
- exports.AudioInputPartSchema = AudioInputPartSchema;
1162
+ exports.AttributableSchema = AttributableSchema;
1163
+ exports.AudioInputContentSchema = AudioPartSchema;
1164
+ exports.AudioInputPartSchema = AudioPartSchema;
1165
+ exports.AudioPartSchema = AudioPartSchema;
680
1166
  exports.BaseEventSchema = BaseEventSchema;
681
- exports.BinaryInputContentSchema = BinaryInputContentSchema;
1167
+ exports.BaseMessageSchema = BaseMessageSchema;
1168
+ exports.ContentPartSchema = ContentPartSchema;
682
1169
  exports.ContextSchema = ContextSchema;
1170
+ exports.CopyOperationSchema = CopyOperationSchema;
683
1171
  exports.CustomEventSchema = CustomEventSchema;
1172
+ exports.DataSourceSchema = DataSourceSchema;
684
1173
  exports.DeveloperMessageSchema = DeveloperMessageSchema;
685
- exports.DocumentInputContentSchema = DocumentInputContentSchema;
686
- exports.DocumentInputPartSchema = DocumentInputPartSchema;
687
- exports.EventSchemas = EventSchemas;
1174
+ exports.DocumentInputContentSchema = DocumentPartSchema;
1175
+ exports.DocumentInputPartSchema = DocumentPartSchema;
1176
+ exports.DocumentPartSchema = DocumentPartSchema;
1177
+ exports.EventSchema = EventSchema;
1178
+ exports.EventSchemas = EventSchema;
688
1179
  exports.EventTypeSchema = EventTypeSchema;
689
1180
  exports.ExecutionCapabilitiesSchema = ExecutionCapabilitiesSchema;
1181
+ exports.FileSourceSchema = FileSourceSchema;
690
1182
  exports.FunctionCallSchema = FunctionCallSchema;
691
1183
  exports.HumanInTheLoopCapabilitiesSchema = HumanInTheLoopCapabilitiesSchema;
692
1184
  exports.IdentityCapabilitiesSchema = IdentityCapabilitiesSchema;
693
- exports.ImageInputContentSchema = ImageInputContentSchema;
694
- exports.ImageInputPartSchema = ImageInputPartSchema;
695
- exports.InputContentDataSourceSchema = InputContentDataSourceSchema;
696
- exports.InputContentPartSchema = InputContentPartSchema;
697
- exports.InputContentSchema = InputContentSchema;
698
- exports.InputContentSourceSchema = InputContentSourceSchema;
699
- exports.InputContentUrlSourceSchema = InputContentUrlSourceSchema;
1185
+ exports.ImageInputContentSchema = ImagePartSchema;
1186
+ exports.ImageInputPartSchema = ImagePartSchema;
1187
+ exports.ImagePartSchema = ImagePartSchema;
1188
+ exports.InputContentDataSourceSchema = DataSourceSchema;
1189
+ exports.InputContentSchema = ContentPartSchema;
1190
+ exports.InputContentSourceSchema = PartSourceSchema;
1191
+ exports.InputContentUrlSourceSchema = UrlSourceSchema;
700
1192
  exports.InterruptSchema = InterruptSchema;
1193
+ exports.JsonPatchOperationSchema = JsonPatchOperationSchema;
1194
+ exports.JsonPatchSchema = JsonPatchSchema;
1195
+ exports.JsonPointerSchema = JsonPointerSchema;
701
1196
  exports.MessageSchema = MessageSchema;
702
1197
  exports.MessagesSnapshotEventSchema = MessagesSnapshotEventSchema;
1198
+ exports.MetadataSchema = MetadataSchema;
1199
+ exports.MoveOperationSchema = MoveOperationSchema;
703
1200
  exports.MultiAgentCapabilitiesSchema = MultiAgentCapabilitiesSchema;
704
1201
  exports.MultimodalCapabilitiesSchema = MultimodalCapabilitiesSchema;
705
1202
  exports.MultimodalInputCapabilitiesSchema = MultimodalInputCapabilitiesSchema;
706
1203
  exports.MultimodalOutputCapabilitiesSchema = MultimodalOutputCapabilitiesSchema;
1204
+ exports.OptionalMetadataSchema = OptionalMetadataSchema;
707
1205
  exports.OutputCapabilitiesSchema = OutputCapabilitiesSchema;
1206
+ exports.PROTOCOL_VERSION = require_version.PROTOCOL_VERSION;
1207
+ exports.PartSourceSchema = PartSourceSchema;
708
1208
  exports.RawEventSchema = RawEventSchema;
709
1209
  exports.ReasoningCapabilitiesSchema = ReasoningCapabilitiesSchema;
710
1210
  exports.ReasoningEncryptedValueEventSchema = ReasoningEncryptedValueEventSchema;
@@ -716,10 +1216,13 @@ exports.ReasoningMessageEndEventSchema = ReasoningMessageEndEventSchema;
716
1216
  exports.ReasoningMessageSchema = ReasoningMessageSchema;
717
1217
  exports.ReasoningMessageStartEventSchema = ReasoningMessageStartEventSchema;
718
1218
  exports.ReasoningStartEventSchema = ReasoningStartEventSchema;
1219
+ exports.RemoveOperationSchema = RemoveOperationSchema;
1220
+ exports.ReplaceOperationSchema = ReplaceOperationSchema;
719
1221
  exports.ResumeEntrySchema = ResumeEntrySchema;
720
1222
  exports.RoleSchema = RoleSchema;
721
1223
  exports.RunAgentInputSchema = RunAgentInputSchema;
722
1224
  exports.RunErrorEventSchema = RunErrorEventSchema;
1225
+ exports.RunFinishedCancelledOutcomeSchema = RunFinishedCancelledOutcomeSchema;
723
1226
  exports.RunFinishedEventSchema = RunFinishedEventSchema;
724
1227
  exports.RunFinishedInterruptOutcomeSchema = RunFinishedInterruptOutcomeSchema;
725
1228
  exports.RunFinishedOutcomeSchema = RunFinishedOutcomeSchema;
@@ -731,18 +1234,24 @@ exports.StateSchema = StateSchema;
731
1234
  exports.StateSnapshotEventSchema = StateSnapshotEventSchema;
732
1235
  exports.StepFinishedEventSchema = StepFinishedEventSchema;
733
1236
  exports.StepStartedEventSchema = StepStartedEventSchema;
734
- exports.SubAgentInfoSchema = SubAgentInfoSchema;
1237
+ exports.SubagentErrorEventSchema = SubagentErrorEventSchema;
1238
+ exports.SubagentFinishedEventSchema = SubagentFinishedEventSchema;
1239
+ exports.SubagentFinishedOutcomeSchema = SubagentFinishedOutcomeSchema;
1240
+ exports.SubagentFinishedSuccessOutcomeSchema = SubagentFinishedSuccessOutcomeSchema;
1241
+ exports.SubagentFinishedSuspendedOutcomeSchema = SubagentFinishedSuspendedOutcomeSchema;
1242
+ exports.SubagentInfoSchema = SubagentInfoSchema;
1243
+ exports.SubagentRunIdSchema = SubagentRunIdSchema;
1244
+ exports.SubagentStartedEventSchema = SubagentStartedEventSchema;
735
1245
  exports.SystemMessageSchema = SystemMessageSchema;
736
- exports.TextInputContentSchema = TextInputContentSchema;
1246
+ exports.TestOperationSchema = TestOperationSchema;
1247
+ exports.TextInputContentSchema = TextPartSchema;
737
1248
  exports.TextMessageChunkEventSchema = TextMessageChunkEventSchema;
738
1249
  exports.TextMessageContentEventSchema = TextMessageContentEventSchema;
739
1250
  exports.TextMessageEndEventSchema = TextMessageEndEventSchema;
1251
+ exports.TextMessageRoleSchema = TextMessageRoleSchema;
740
1252
  exports.TextMessageStartEventSchema = TextMessageStartEventSchema;
741
- exports.ThinkingEndEventSchema = ThinkingEndEventSchema;
742
- exports.ThinkingStartEventSchema = ThinkingStartEventSchema;
743
- exports.ThinkingTextMessageContentEventSchema = ThinkingTextMessageContentEventSchema;
744
- exports.ThinkingTextMessageEndEventSchema = ThinkingTextMessageEndEventSchema;
745
- exports.ThinkingTextMessageStartEventSchema = ThinkingTextMessageStartEventSchema;
1253
+ exports.TextPartSchema = TextPartSchema;
1254
+ exports.TokenUsageSchema = TokenUsageSchema;
746
1255
  exports.ToolCallArgsEventSchema = ToolCallArgsEventSchema;
747
1256
  exports.ToolCallChunkEventSchema = ToolCallChunkEventSchema;
748
1257
  exports.ToolCallEndEventSchema = ToolCallEndEventSchema;
@@ -753,42 +1262,9 @@ exports.ToolMessageSchema = ToolMessageSchema;
753
1262
  exports.ToolSchema = ToolSchema;
754
1263
  exports.ToolsCapabilitiesSchema = ToolsCapabilitiesSchema;
755
1264
  exports.TransportCapabilitiesSchema = TransportCapabilitiesSchema;
1265
+ exports.UrlSourceSchema = UrlSourceSchema;
756
1266
  exports.UserMessageSchema = UserMessageSchema;
757
- exports.VideoInputContentSchema = VideoInputContentSchema;
758
- exports.VideoInputPartSchema = VideoInputPartSchema;
759
- exports.createActivityDeltaEvent = createActivityDeltaEvent;
760
- exports.createActivitySnapshotEvent = createActivitySnapshotEvent;
761
- exports.createCustomEvent = createCustomEvent;
762
- exports.createMessagesSnapshotEvent = createMessagesSnapshotEvent;
763
- exports.createRawEvent = createRawEvent;
764
- exports.createReasoningEncryptedValueEvent = createReasoningEncryptedValueEvent;
765
- exports.createReasoningEndEvent = createReasoningEndEvent;
766
- exports.createReasoningMessageChunkEvent = createReasoningMessageChunkEvent;
767
- exports.createReasoningMessageContentEvent = createReasoningMessageContentEvent;
768
- exports.createReasoningMessageEndEvent = createReasoningMessageEndEvent;
769
- exports.createReasoningMessageStartEvent = createReasoningMessageStartEvent;
770
- exports.createReasoningStartEvent = createReasoningStartEvent;
771
- exports.createRunErrorEvent = createRunErrorEvent;
772
- exports.createRunFinishedEvent = createRunFinishedEvent;
773
- exports.createRunFinishedInterruptEvent = createRunFinishedInterruptEvent;
774
- exports.createRunFinishedSuccessEvent = createRunFinishedSuccessEvent;
775
- exports.createRunStartedEvent = createRunStartedEvent;
776
- exports.createStateDeltaEvent = createStateDeltaEvent;
777
- exports.createStateSnapshotEvent = createStateSnapshotEvent;
778
- exports.createStepFinishedEvent = createStepFinishedEvent;
779
- exports.createStepStartedEvent = createStepStartedEvent;
780
- exports.createTextMessageChunkEvent = createTextMessageChunkEvent;
781
- exports.createTextMessageContentEvent = createTextMessageContentEvent;
782
- exports.createTextMessageEndEvent = createTextMessageEndEvent;
783
- exports.createTextMessageStartEvent = createTextMessageStartEvent;
784
- exports.createThinkingEndEvent = createThinkingEndEvent;
785
- exports.createThinkingStartEvent = createThinkingStartEvent;
786
- exports.createThinkingTextMessageContentEvent = createThinkingTextMessageContentEvent;
787
- exports.createThinkingTextMessageEndEvent = createThinkingTextMessageEndEvent;
788
- exports.createThinkingTextMessageStartEvent = createThinkingTextMessageStartEvent;
789
- exports.createToolCallArgsEvent = createToolCallArgsEvent;
790
- exports.createToolCallChunkEvent = createToolCallChunkEvent;
791
- exports.createToolCallEndEvent = createToolCallEndEvent;
792
- exports.createToolCallResultEvent = createToolCallResultEvent;
793
- exports.createToolCallStartEvent = createToolCallStartEvent;
1267
+ exports.VideoInputContentSchema = VideoPartSchema;
1268
+ exports.VideoInputPartSchema = VideoPartSchema;
1269
+ exports.VideoPartSchema = VideoPartSchema;
794
1270
  //# sourceMappingURL=schemas.js.map